Skip to content

Commit

Permalink
CS fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierstoval committed Sep 21, 2024
1 parent 007cda3 commit 7566b5c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/lib/Crud/Form.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CrudOperation, FieldInterface, FieldOptions } from '$lib';

export type SubmittedData = Record<string, FormDataEntryValue|Array<FormDataEntryValue>>;
export type SubmittedData = Record<string, FormDataEntryValue | Array<FormDataEntryValue>>;

/**
* Function to get an record of {@link FormDataEntryValue} items from an "onSubmit" form {@link SubmitEvent} object.
Expand Down
13 changes: 8 additions & 5 deletions src/lib/themes/svelte/carbon/Crud/CrudList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@
]).then((results) => results[0]);
}
type Item = {id?: null|string|number, __crud_operation?: CrudOperation, [key: string]: unknown};
type Item = {
id?: null | string | number;
__crud_operation?: CrudOperation;
[key: string]: unknown;
};
rows = providerResponse.then((responseResults): Item[] => {
if (
Expand All @@ -89,10 +93,9 @@
);
}
let finalRows: Array<Item> =
(responseResults instanceof PaginatedResults
? responseResults.currentItems
: responseResults) as Array<Item>;
let finalRows: Array<Item> = (
responseResults instanceof PaginatedResults ? responseResults.currentItems : responseResults
) as Array<Item>;
paginator = responseResults instanceof PaginatedResults ? responseResults : undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/themes/svelte/carbon/DataTable/DataTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
export let globalActions: Array<Action> = [];
export let batchActions: Action[] = [];
export let filters: Array<FilterInterface<FilterOptions>> = [];
export let filtersValues: {[key: string]: string|Array<string>|undefined} = {};
export let filtersValues: { [key: string]: string | Array<string> | undefined } = {};
export let page: number | undefined;
export let theme: ThemeConfig;
export let sortable: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
export let actions: Array<Action> = [];
export let filters: Array<Filter<FilterOptions>> = [];
export let filtersValues: {[key: string]: string|Array<string>|undefined} = {};
export let filtersValues: { [key: string]: string | Array<string> | undefined } = {};
export let theme: ThemeConfig;
const dispatchEvent = createEventDispatcher<{ submitFilters: SubmittedData }>();
Expand Down Expand Up @@ -67,7 +67,7 @@

{#if filters.length}
<Accordion>
<AccordionItem open={Object.values(filtersValues).filter(i => !!i).length > 0}>
<AccordionItem open={Object.values(filtersValues).filter((i) => !!i).length > 0}>
<slot slot="title">
<FilterIcon />
{$_('datatable.filters.menu_title')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export let filter: FilterInterface<FilterOptions>;
export let theme: ThemeConfig;
export let value: undefined|string|Array<string>;
export let value: undefined | string | Array<string>;
const component = theme.filters[filter.componentName];
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import FilterContainer from '$lib/themes/svelte/carbon/FilterComponents/Internal/FilterContainer.svelte';
export let filter: DateRangeFilter;
export let value: undefined|string|Array<string>;
export let value: undefined | string | Array<string>;
let from: string = '' ;
let to: string = '' ;
let from: string = '';
let to: string = '';
if (value && Array.isArray(value)) {
if (value[0]) {
Expand Down
15 changes: 12 additions & 3 deletions src/testApp/BookCrud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,20 @@ export const bookCrud = new CrudDefinition<Book>({
return false;
}
if (filters.publishedAt) {
const publishedAtFilter = filters.publishedAt as unknown as [string|undefined, string|undefined];
if (publishedAtFilter[0] && new Date(entity.publishedAt) < new Date(publishedAtFilter[0])) {
const publishedAtFilter = filters.publishedAt as unknown as [
string | undefined,
string | undefined
];
if (
publishedAtFilter[0] &&
new Date(entity.publishedAt) < new Date(publishedAtFilter[0])
) {
return false;
}
if (publishedAtFilter[1] && new Date(entity.publishedAt) > new Date(publishedAtFilter[1])) {
if (
publishedAtFilter[1] &&
new Date(entity.publishedAt) > new Date(publishedAtFilter[1])
) {
return false;
}
}
Expand Down

0 comments on commit 7566b5c

Please sign in to comment.