@bexis2/bexis2-core-ui 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +8 -7
  2. package/dist/TableView.svelte +1 -1
  3. package/dist/components/ListView.svelte +5 -5
  4. package/dist/components/Table/Table.svelte +167 -0
  5. package/dist/components/Table/Table.svelte.d.ts +17 -0
  6. package/dist/components/Table/TableFilter.svelte +168 -0
  7. package/dist/components/Table/TableFilter.svelte.d.ts +21 -0
  8. package/dist/components/Table/TablePagination.svelte +60 -0
  9. package/dist/components/Table/TablePagination.svelte.d.ts +17 -0
  10. package/dist/components/Table/filter.d.ts +4 -0
  11. package/dist/components/Table/filter.js +83 -0
  12. package/dist/components/file/FileIcon.svelte +45 -49
  13. package/dist/components/file/FileInfo.svelte +13 -14
  14. package/dist/components/file/FileUploader.svelte +34 -37
  15. package/dist/components/form/Checkbox.svelte +13 -17
  16. package/dist/components/form/CheckboxKvPList.svelte +10 -12
  17. package/dist/components/form/CheckboxList.svelte +10 -10
  18. package/dist/components/form/DateInput.svelte +17 -18
  19. package/dist/components/form/DateInput.svelte.d.ts +4 -4
  20. package/dist/components/form/DropdownKvP.svelte +44 -52
  21. package/dist/components/form/InputContainer.svelte +18 -20
  22. package/dist/components/form/InputContainer.svelte.d.ts +1 -1
  23. package/dist/components/form/MultiSelect.svelte +89 -101
  24. package/dist/components/form/NumberInput.svelte +17 -18
  25. package/dist/components/form/NumberInput.svelte.d.ts +4 -4
  26. package/dist/components/form/TextArea.svelte +16 -18
  27. package/dist/components/form/TextArea.svelte.d.ts +4 -5
  28. package/dist/components/form/TextInput.svelte +17 -21
  29. package/dist/components/form/TextInput.svelte.d.ts +4 -4
  30. package/dist/components/spinner/Spinner.svelte +9 -8
  31. package/dist/css/core.ui.css +5 -2
  32. package/dist/css/themes/theme-bexis2.css +96 -100
  33. package/dist/css/themes/theme-crimson.css +3 -2
  34. package/dist/css/themes/theme-hamlindigo.css +3 -2
  35. package/dist/css/themes/theme-seafoam.css +3 -2
  36. package/dist/models/Models.d.ts +28 -0
  37. package/dist/services/Api.js +12 -11
  38. package/dist/stores/apistore.js +13 -13
  39. package/package.json +101 -86
  40. package/src/lib/TableView.svelte +1 -1
  41. package/src/lib/components/ListView.svelte +11 -13
  42. package/src/lib/components/Table/Table.svelte +184 -0
  43. package/src/lib/components/Table/TableFilter.svelte +176 -0
  44. package/src/lib/components/Table/TablePagination.svelte +61 -0
  45. package/src/lib/components/Table/filter.ts +94 -0
  46. package/src/lib/components/file/FileIcon.svelte +45 -49
  47. package/src/lib/components/file/FileInfo.svelte +13 -14
  48. package/src/lib/components/file/FileUploader.svelte +184 -217
  49. package/src/lib/components/form/Checkbox.svelte +24 -32
  50. package/src/lib/components/form/CheckboxKvPList.svelte +21 -24
  51. package/src/lib/components/form/CheckboxList.svelte +21 -22
  52. package/src/lib/components/form/DateInput.svelte +24 -30
  53. package/src/lib/components/form/DropdownKvP.svelte +44 -52
  54. package/src/lib/components/form/InputContainer.svelte +22 -27
  55. package/src/lib/components/form/MultiSelect.svelte +89 -101
  56. package/src/lib/components/form/NumberInput.svelte +24 -30
  57. package/src/lib/components/form/TextArea.svelte +23 -28
  58. package/src/lib/components/form/TextInput.svelte +24 -33
  59. package/src/lib/components/spinner/Spinner.svelte +9 -8
  60. package/src/lib/css/core.ui.css +5 -2
  61. package/src/lib/css/themes/theme-bexis2.css +96 -100
  62. package/src/lib/css/themes/theme-crimson.css +3 -2
  63. package/src/lib/css/themes/theme-hamlindigo.css +3 -2
  64. package/src/lib/css/themes/theme-seafoam.css +3 -2
  65. package/src/lib/index.ts +31 -23
  66. package/src/lib/models/Models.ts +70 -39
  67. package/src/lib/services/Api.ts +55 -58
  68. package/src/lib/stores/apistore.ts +28 -32
package/README.md CHANGED
@@ -3,16 +3,17 @@
3
3
  ## new in version 0.0.23
4
4
 
5
5
  ## Updates
6
+
6
7
  - update bexis 2 theme
7
8
 
8
- ## Adds
9
+ ## Adds
10
+
9
11
  - Checkbox
10
- - CheckboxKVPList
11
- - CheckboxList
12
- - DateInput
13
- - DropdownKVP
14
- - MultiSelect
12
+ - CheckboxKVPList
13
+ - CheckboxList
14
+ - DateInput
15
+ - DropdownKVP
16
+ - MultiSelect
15
17
  - NumberInput
16
18
  - TextArea
17
19
  - TextInput
18
-
@@ -1 +1 @@
1
- <h1>table</h1>
1
+ <h1>table</h1>
@@ -1,6 +1,6 @@
1
1
  <script>let result = { name: "david" };
2
- </script>
3
-
4
- <h1>MyList</h1>
5
- {result.name}
6
- <b>from bexis-lib</b>
2
+ </script>
3
+
4
+ <h1>MyList</h1>
5
+ {result.name}
6
+ <b>from bexis-lib</b>
@@ -0,0 +1,167 @@
1
+ <script>import { createTable, Subscribe, Render, createRender } from "svelte-headless-table";
2
+ import {
3
+ addSortBy,
4
+ addPagination,
5
+ addExpandedRows,
6
+ addColumnFilters,
7
+ addTableFilter
8
+ } from "svelte-headless-table/plugins";
9
+ import TableFilter from "./TableFilter.svelte";
10
+ import TablePagination from "./TablePagination.svelte";
11
+ import { columnFilter, searchFilter } from "./filter";
12
+ export let config;
13
+ let {
14
+ id: tableId,
15
+ data,
16
+ columns,
17
+ optionsComponent,
18
+ defaultPageSize = 10,
19
+ pageSizes = [5, 10, 15, 20]
20
+ } = config;
21
+ const table = createTable(data, {
22
+ colFilter: addColumnFilters(),
23
+ tableFilter: addTableFilter({
24
+ fn: searchFilter
25
+ }),
26
+ sort: addSortBy({ disableMultiSort: true }),
27
+ page: addPagination({ initialPageSize: defaultPageSize }),
28
+ expand: addExpandedRows()
29
+ });
30
+ const accessors = Object.keys($data[0]);
31
+ const tableColumns = [
32
+ ...accessors.filter((accessor) => {
33
+ const key = accessor;
34
+ if (columns !== void 0 && key in columns && columns[key].exclude === true) {
35
+ return false;
36
+ }
37
+ return true;
38
+ }).map((accessor) => {
39
+ const key = accessor;
40
+ if (columns !== void 0 && key in columns) {
41
+ const { header, colFilterFn, colFilterComponent } = columns[key];
42
+ return table.column({
43
+ header: header ?? key,
44
+ accessor,
45
+ plugins: {
46
+ sort: { invert: true },
47
+ colFilter: {
48
+ fn: colFilterFn ?? columnFilter,
49
+ render: ({ filterValue: filterValue2, values, id }) => createRender(colFilterComponent ?? TableFilter, {
50
+ filterValue: filterValue2,
51
+ values,
52
+ id,
53
+ tableId
54
+ })
55
+ }
56
+ }
57
+ });
58
+ } else {
59
+ return table.column({
60
+ header: key,
61
+ accessor,
62
+ plugins: {
63
+ sort: { invert: true },
64
+ colFilter: {
65
+ fn: columnFilter,
66
+ render: ({ filterValue: filterValue2, values, id }) => createRender(TableFilter, { filterValue: filterValue2, values, id, tableId })
67
+ }
68
+ }
69
+ });
70
+ }
71
+ })
72
+ ];
73
+ if (optionsComponent !== void 0) {
74
+ tableColumns.push(
75
+ table.display({
76
+ id: "options",
77
+ header: "",
78
+ cell: ({ row }, _) => {
79
+ return createRender(optionsComponent, {
80
+ row: row.isData() ? row.original : null
81
+ });
82
+ }
83
+ })
84
+ );
85
+ }
86
+ const createdTableColumns = table.createColumns(tableColumns);
87
+ const { headerRows, pageRows, tableAttrs, tableBodyAttrs, pluginStates } = table.createViewModel(createdTableColumns);
88
+ const { filterValue } = pluginStates.tableFilter;
89
+ </script>
90
+
91
+ <div class="grid gap-2">
92
+ <div class="table-container">
93
+ <input
94
+ class="input p-2 mb-2 border border-primary-500"
95
+ type="text"
96
+ bind:value={$filterValue}
97
+ placeholder="Search rows..."
98
+ />
99
+ <table {...$tableAttrs} class="table table-compact bg-tertiary-200">
100
+ <thead>
101
+ {#each $headerRows as headerRow (headerRow.id)}
102
+ <Subscribe
103
+ rowAttrs={headerRow.attrs()}
104
+ let:rowAttrs
105
+ rowProps={headerRow.props()}
106
+ let:rowProps
107
+ >
108
+ <tr {...rowAttrs} class="bg-primary-300">
109
+ {#each headerRow.cells as cell (cell.id)}
110
+ <Subscribe attrs={cell.attrs()} props={cell.props()} let:props let:attrs>
111
+ <th scope="col" class="!p-2" {...attrs}>
112
+ <div class="flex w-full justify-between items-center">
113
+ <div class="flex gap-1">
114
+ <span
115
+ class:underline={props.sort.order}
116
+ class:normal-case={cell.id !== cell.label}
117
+ on:click={props.sort.toggle}
118
+ on:keydown={props.sort.toggle}
119
+ >
120
+ {cell.render()}
121
+ </span>
122
+ <div class="w-2">
123
+ {#if props.sort.order === 'asc'}
124
+
125
+ {:else if props.sort.order === 'desc'}
126
+
127
+ {/if}
128
+ </div>
129
+ </div>
130
+ {#if cell.isData()}
131
+ {#if props.colFilter?.render}
132
+ <div>
133
+ <Render of={props.colFilter.render} />
134
+ </div>
135
+ {/if}
136
+ {/if}
137
+ </div>
138
+ </th>
139
+ </Subscribe>
140
+ {/each}
141
+ </tr>
142
+ </Subscribe>
143
+ {/each}
144
+ </thead>
145
+
146
+ <tbody class="" {...$tableBodyAttrs}>
147
+ {#each $pageRows as row (row.id)}
148
+ <Subscribe rowAttrs={row.attrs()} let:rowAttrs>
149
+ <tr {...rowAttrs}>
150
+ {#each row.cells as cell (cell?.id)}
151
+ <Subscribe attrs={cell.attrs()} let:attrs>
152
+ <td {...attrs} class="!p-2">
153
+ <div class="flex items-center w-full h-full table-cell-fit">
154
+ <Render of={cell.render()} />
155
+ </div>
156
+ </td>
157
+ </Subscribe>
158
+ {/each}
159
+ </tr>
160
+ </Subscribe>
161
+ {/each}
162
+ </tbody>
163
+ </table>
164
+ </div>
165
+
166
+ <TablePagination pageConfig={pluginStates.page} {pageSizes} />
167
+ </div>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ import type { TableConfig } from '../../models/Models';
3
+ declare const __propDef: {
4
+ props: {
5
+ config: TableConfig<any>;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type TableProps = typeof __propDef.props;
13
+ export type TableEvents = typeof __propDef.events;
14
+ export type TableSlots = typeof __propDef.slots;
15
+ export default class Table extends SvelteComponentTyped<TableProps, TableEvents, TableSlots> {
16
+ }
17
+ export {};
@@ -0,0 +1,168 @@
1
+ <script>import Fa from "svelte-fa/src/fa.svelte";
2
+ import { faFilter } from "@fortawesome/free-solid-svg-icons";
3
+ import { popup } from "@skeletonlabs/skeleton";
4
+ export let filterValue;
5
+ export let values;
6
+ export let id;
7
+ export let tableId;
8
+ let firstOption;
9
+ let firstValue;
10
+ let secondOption;
11
+ let secondValue;
12
+ let active = false;
13
+ const options = {
14
+ number: [
15
+ {
16
+ value: "isequal",
17
+ label: "Is equal to"
18
+ },
19
+ {
20
+ value: "isgreaterorequal",
21
+ label: "Is greater than or equal to"
22
+ },
23
+ {
24
+ value: "isgreater",
25
+ label: "Is greater than"
26
+ },
27
+ {
28
+ value: "islessorequal",
29
+ label: "Is less than or equal to"
30
+ },
31
+ {
32
+ value: "isless",
33
+ label: "Is less than"
34
+ },
35
+ {
36
+ value: "isnotequal",
37
+ label: "Is not equal to"
38
+ }
39
+ ],
40
+ string: [
41
+ {
42
+ value: "isequal",
43
+ label: "Is equal to"
44
+ },
45
+ {
46
+ value: "isnotequal",
47
+ label: "Is not equal to"
48
+ },
49
+ {
50
+ value: "starts",
51
+ label: "Starts with"
52
+ },
53
+ {
54
+ value: "contains",
55
+ label: "Contains"
56
+ },
57
+ {
58
+ value: "notcontains",
59
+ label: "Does not contain"
60
+ },
61
+ {
62
+ value: "ends",
63
+ label: "Ends with"
64
+ }
65
+ ]
66
+ };
67
+ const popupId = `${tableId}-${id}`;
68
+ const popupFeatured = {
69
+ event: "click",
70
+ target: popupId,
71
+ placement: "bottom-start"
72
+ };
73
+ const type = typeof $values[0];
74
+ </script>
75
+
76
+ <form class="">
77
+ <button
78
+ class:variant-filled-primary={active}
79
+ class="btn w-max p-2"
80
+ type="button"
81
+ use:popup={popupFeatured}
82
+ >
83
+ <Fa icon={faFilter} size="12" />
84
+ </button>
85
+
86
+ <div data-popup={`${popupId}`}>
87
+ <div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min">
88
+ <button
89
+ class="btn variant-filled-primary btn-sm"
90
+ type="submit"
91
+ on:click={() => {
92
+ firstOption = 'isequal';
93
+ firstValue = undefined;
94
+ secondOption = 'isequal';
95
+ secondValue = undefined;
96
+
97
+ $filterValue = [firstOption, firstValue, secondOption, secondValue];
98
+ active = false;
99
+ }}>Clear Filter</button
100
+ >
101
+
102
+ <label for="" class="label normal-case text-sm">Show rows with value that</label>
103
+ <div class="grid gap-2 w-full">
104
+ <select
105
+ class="select border border-primary-500 text-sm p-1"
106
+ aria-label="Show rows with value that"
107
+ bind:value={firstOption}
108
+ on:click|stopPropagation
109
+ >
110
+ {#each options[type] as option (option)}
111
+ <option value={option.value}>{option.label}</option>
112
+ {/each}
113
+ </select>
114
+ {#if type === 'number'}
115
+ <input
116
+ type="number"
117
+ class="input p-1 border border-primary-500"
118
+ bind:value={firstValue}
119
+ on:click|stopPropagation
120
+ />
121
+ {:else}
122
+ <input
123
+ type="text"
124
+ class="input p-1 border border-primary-500"
125
+ bind:value={firstValue}
126
+ on:click|stopPropagation
127
+ />
128
+ {/if}
129
+ </div>
130
+ <label for="" class="label normal-case">And</label>
131
+ <div class="grid gap-2 w-max">
132
+ <select
133
+ class="select border border-primary-500 text-sm p-1"
134
+ aria-label="Show rows with value that"
135
+ bind:value={secondOption}
136
+ on:click|stopPropagation
137
+ >
138
+ {#each options[type] as option (option)}
139
+ <option value={option.value}>{option.label}</option>
140
+ {/each}
141
+ </select>
142
+ {#if type === 'number'}
143
+ <input
144
+ type="number"
145
+ class="input p-1 border border-primary-500"
146
+ bind:value={secondValue}
147
+ on:click|stopPropagation
148
+ />
149
+ {:else}
150
+ <input
151
+ type="text"
152
+ class="input p-1 border border-primary-500"
153
+ bind:value={secondValue}
154
+ on:click|stopPropagation
155
+ />
156
+ {/if}
157
+ </div>
158
+ <button
159
+ class="btn variant-filled-primary btn-sm"
160
+ type="submit"
161
+ on:click={() => {
162
+ active = firstValue?.toString().length > 0 || secondValue?.toString().length > 0;
163
+ $filterValue = [firstOption, firstValue, secondOption, secondValue];
164
+ }}>Submit</button
165
+ >
166
+ </div>
167
+ </div>
168
+ </form>
@@ -0,0 +1,21 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ filterValue: any;
5
+ values: any;
6
+ id: any;
7
+ tableId: any;
8
+ };
9
+ events: {
10
+ click: MouseEvent;
11
+ } & {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ };
16
+ export type TableFilterProps = typeof __propDef.props;
17
+ export type TableFilterEvents = typeof __propDef.events;
18
+ export type TableFilterSlots = typeof __propDef.slots;
19
+ export default class TableFilter extends SvelteComponentTyped<TableFilterProps, TableFilterEvents, TableFilterSlots> {
20
+ }
21
+ export {};
@@ -0,0 +1,60 @@
1
+ <script>import Fa from "svelte-fa/src/fa.svelte";
2
+ import {
3
+ faAnglesRight,
4
+ faAngleRight,
5
+ faAnglesLeft,
6
+ faAngleLeft
7
+ } from "@fortawesome/free-solid-svg-icons";
8
+ export let pageConfig;
9
+ export let pageSizes;
10
+ const { pageIndex, pageCount, pageSize, hasNextPage, hasPreviousPage } = pageConfig;
11
+ const goToFirstPage = () => $pageIndex = 0;
12
+ const goToLastPage = () => $pageIndex = $pageCount - 1;
13
+ const goToNextPage = () => $pageIndex += 1;
14
+ const goToPreviousPage = () => $pageIndex -= 1;
15
+ $:
16
+ goToFirstPageDisabled = !$pageIndex;
17
+ $:
18
+ goToLastPageDisabled = $pageIndex == $pageCount - 1;
19
+ $:
20
+ goToNextPageDisabled = !$hasNextPage;
21
+ $:
22
+ goToPreviousPageDisabled = !$hasPreviousPage;
23
+ </script>
24
+
25
+ <div class="flex justify-center gap-1">
26
+ <button
27
+ class="btn btn-sm variant-filled-primary"
28
+ on:click={goToFirstPage}
29
+ disabled={goToFirstPageDisabled}
30
+ >
31
+ <Fa icon={faAnglesLeft} /></button
32
+ >
33
+ <button
34
+ class="btn btn-sm variant-filled-primary"
35
+ on:click={goToPreviousPage}
36
+ disabled={goToPreviousPageDisabled}><Fa icon={faAngleLeft} /></button
37
+ >
38
+
39
+ <select
40
+ name="pageSize"
41
+ id="pageSize"
42
+ class="select btn btn-sm variant-filled-primary w-min font-bold"
43
+ bind:value={$pageSize}
44
+ >
45
+ {#each pageSizes as size}
46
+ <option value={size}>{size}</option>
47
+ {/each}
48
+ </select>
49
+
50
+ <button
51
+ class="btn btn-sm variant-filled-primary"
52
+ on:click={goToNextPage}
53
+ disabled={goToNextPageDisabled}><Fa icon={faAngleRight} /></button
54
+ >
55
+ <button
56
+ class="btn btn-sm variant-filled-primary"
57
+ on:click={goToLastPage}
58
+ disabled={goToLastPageDisabled}><Fa icon={faAnglesRight} /></button
59
+ >
60
+ </div>
@@ -0,0 +1,17 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ pageConfig: any;
5
+ pageSizes: any;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type TablePaginationProps = typeof __propDef.props;
13
+ export type TablePaginationEvents = typeof __propDef.events;
14
+ export type TablePaginationSlots = typeof __propDef.slots;
15
+ export default class TablePagination extends SvelteComponentTyped<TablePaginationProps, TablePaginationEvents, TablePaginationSlots> {
16
+ }
17
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { ColumnFilterFn } from 'svelte-headless-table/lib/plugins';
2
+ import type { TableFilterFn } from 'svelte-headless-table/lib/plugins/addTableFilter';
3
+ export declare const columnFilter: ColumnFilterFn;
4
+ export declare const searchFilter: TableFilterFn;
@@ -0,0 +1,83 @@
1
+ const textFilter = (filterOption, filterValue, value) => {
2
+ switch (filterOption) {
3
+ case 'isequal':
4
+ return value.toLowerCase() === filterValue.toLowerCase();
5
+ case 'isnotequal':
6
+ return value.toLowerCase() !== filterValue.toLowerCase();
7
+ case 'starts':
8
+ return value.toLowerCase().startsWith(filterValue.toLowerCase());
9
+ case 'ends':
10
+ return value.toLowerCase().endsWith(filterValue.toLowerCase());
11
+ case 'contains':
12
+ return value.toLowerCase().includes(filterValue.toLowerCase());
13
+ case 'notcontains':
14
+ return !value.toLowerCase().includes(filterValue.toLowerCase());
15
+ default:
16
+ return false;
17
+ }
18
+ };
19
+ const numberFilter = (filterOption, filterValue, value) => {
20
+ switch (filterOption) {
21
+ case 'isequal':
22
+ return value === filterValue;
23
+ case 'isnotequal':
24
+ return value !== filterValue;
25
+ case 'isgreater':
26
+ return value > filterValue;
27
+ case 'isless':
28
+ return value < filterValue;
29
+ case 'isgreaterorequal':
30
+ return value >= filterValue;
31
+ case 'islessorequal':
32
+ return value <= filterValue;
33
+ default:
34
+ return false;
35
+ }
36
+ };
37
+ const numericFilter = ({ filterValue, value }) => {
38
+ const [firstFilterOption, firstFilterValue, secondFilterOption, secondFilterValue] = filterValue;
39
+ if (!firstFilterValue && !secondFilterValue) {
40
+ return true;
41
+ }
42
+ else if ((!firstFilterOption || !firstFilterValue) && secondFilterOption && secondFilterValue) {
43
+ return numberFilter(secondFilterOption, secondFilterValue, value);
44
+ }
45
+ else if ((!secondFilterOption || !secondFilterValue) && firstFilterOption && firstFilterValue) {
46
+ return numberFilter(firstFilterOption, firstFilterValue, value);
47
+ }
48
+ return (numberFilter(firstFilterOption, firstFilterValue, value) &&
49
+ numberFilter(secondFilterOption, secondFilterValue, value));
50
+ };
51
+ const stringFilter = ({ filterValue, value }) => {
52
+ const [firstFilterOption, firstFilterValue, secondFilterOption, secondFilterValue] = filterValue;
53
+ if (!firstFilterValue?.length && !secondFilterValue?.length) {
54
+ return true;
55
+ }
56
+ else if ((!firstFilterOption || !firstFilterValue) &&
57
+ secondFilterOption &&
58
+ secondFilterValue?.length) {
59
+ return textFilter(secondFilterOption, secondFilterValue, value);
60
+ }
61
+ else if ((!secondFilterOption || !secondFilterValue?.length) &&
62
+ firstFilterOption &&
63
+ firstFilterValue?.length) {
64
+ return textFilter(firstFilterOption, firstFilterValue, value);
65
+ }
66
+ return (textFilter(firstFilterOption, firstFilterValue, value) &&
67
+ textFilter(secondFilterOption, secondFilterValue, value));
68
+ };
69
+ export const columnFilter = ({ filterValue, value }) => {
70
+ if (typeof value === 'string') {
71
+ return stringFilter({ filterValue, value });
72
+ }
73
+ else if (typeof value === 'number') {
74
+ return numericFilter({ filterValue, value });
75
+ }
76
+ return false;
77
+ };
78
+ export const searchFilter = ({ filterValue, value }) => {
79
+ if (value.toLowerCase().includes(filterValue.toLowerCase())) {
80
+ return true;
81
+ }
82
+ return false;
83
+ };
@@ -1,49 +1,45 @@
1
- <script>
2
-
3
- import Fa from 'svelte-fa'
4
- import { faFileAudio } from '@fortawesome/free-regular-svg-icons'
5
- import { faFileVideo } from '@fortawesome/free-regular-svg-icons'
6
- import { faFileWord } from '@fortawesome/free-regular-svg-icons'
7
- import { faFilePdf } from '@fortawesome/free-regular-svg-icons'
8
- import { faFileExcel } from '@fortawesome/free-regular-svg-icons'
9
- import { faFileAlt } from '@fortawesome/free-regular-svg-icons'
10
- import { faFileImage } from '@fortawesome/free-regular-svg-icons'
11
- import { faFileArchive } from '@fortawesome/free-regular-svg-icons'
12
-
13
- export let type = "";
14
-
15
- </script>
16
-
17
- {#if type.includes("excel") || type.includes("spreadsheetml")}
18
- <Fa icon={faFileExcel} />
19
- {/if}
20
-
21
- {#if type.includes("text")}
22
- <Fa icon={faFileAlt} />
23
- {/if}
24
-
25
- {#if type.includes("image")}
26
- <Fa icon={faFileImage} />
27
- {/if}
28
-
29
- {#if type.includes("audio")}
30
- <Fa icon={faFileAudio} />
31
- {/if}
32
-
33
- {#if type.includes("video")}
34
- <Fa icon={faFileVideo} />
35
- {/if}
36
-
37
- {#if type.includes("word")}
38
- <Fa icon={faFileWord} />
39
- {/if}
40
-
41
- {#if type.includes("pdf")}
42
- <Fa icon={faFilePdf} />
43
- {/if}
44
-
45
- {#if type.includes("zip")}
46
- <Fa icon={faFileArchive} />
47
- {/if}
48
-
49
-
1
+ <script>
2
+ import Fa from 'svelte-fa';
3
+ import { faFileAudio } from '@fortawesome/free-regular-svg-icons';
4
+ import { faFileVideo } from '@fortawesome/free-regular-svg-icons';
5
+ import { faFileWord } from '@fortawesome/free-regular-svg-icons';
6
+ import { faFilePdf } from '@fortawesome/free-regular-svg-icons';
7
+ import { faFileExcel } from '@fortawesome/free-regular-svg-icons';
8
+ import { faFileAlt } from '@fortawesome/free-regular-svg-icons';
9
+ import { faFileImage } from '@fortawesome/free-regular-svg-icons';
10
+ import { faFileArchive } from '@fortawesome/free-regular-svg-icons';
11
+
12
+ export let type = '';
13
+ </script>
14
+
15
+ {#if type.includes('excel') || type.includes('spreadsheetml')}
16
+ <Fa icon={faFileExcel} />
17
+ {/if}
18
+
19
+ {#if type.includes('text')}
20
+ <Fa icon={faFileAlt} />
21
+ {/if}
22
+
23
+ {#if type.includes('image')}
24
+ <Fa icon={faFileImage} />
25
+ {/if}
26
+
27
+ {#if type.includes('audio')}
28
+ <Fa icon={faFileAudio} />
29
+ {/if}
30
+
31
+ {#if type.includes('video')}
32
+ <Fa icon={faFileVideo} />
33
+ {/if}
34
+
35
+ {#if type.includes('word')}
36
+ <Fa icon={faFileWord} />
37
+ {/if}
38
+
39
+ {#if type.includes('pdf')}
40
+ <Fa icon={faFilePdf} />
41
+ {/if}
42
+
43
+ {#if type.includes('zip')}
44
+ <Fa icon={faFileArchive} />
45
+ {/if}