@bexis2/bexis2-core-ui 0.3.14 → 0.4.1
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.
- package/README.md +13 -1
- package/dist/TableView.svelte.d.ts +2 -2
- package/dist/components/CodeEditor/CodeEditor.svelte +1 -1
- package/dist/components/CodeEditor/CodeEditor.svelte.d.ts +3 -4
- package/dist/components/File/FileIcon.svelte.d.ts +2 -2
- package/dist/components/File/FileInfo.svelte.d.ts +2 -2
- package/dist/components/File/FileUploader.svelte +1 -1
- package/dist/components/File/FileUploader.svelte.d.ts +2 -2
- package/dist/components/ListView.svelte.d.ts +2 -2
- package/dist/components/Table/Table.svelte.d.ts +2 -2
- package/dist/components/Table/TableContent.svelte +39 -13
- package/dist/components/Table/TableContent.svelte.d.ts +2 -2
- package/dist/components/Table/TableFilter.svelte +51 -25
- package/dist/components/Table/TableFilter.svelte.d.ts +4 -2
- package/dist/components/Table/TableFilterServer.svelte +1 -1
- package/dist/components/Table/TableFilterServer.svelte.d.ts +2 -2
- package/dist/components/Table/TablePagination.svelte +1 -1
- package/dist/components/Table/TablePagination.svelte.d.ts +2 -2
- package/dist/components/Table/TablePaginationServer.svelte +1 -1
- package/dist/components/Table/TablePaginationServer.svelte.d.ts +2 -2
- package/dist/components/Table/shared.js +8 -8
- package/dist/components/form/Checkbox.svelte.d.ts +2 -2
- package/dist/components/form/CheckboxKvPList.svelte.d.ts +2 -2
- package/dist/components/form/CheckboxList.svelte.d.ts +2 -2
- package/dist/components/form/DateInput.svelte.d.ts +2 -2
- package/dist/components/form/DropdownKvP.svelte.d.ts +8 -8
- package/dist/components/form/InputContainer.svelte.d.ts +2 -2
- package/dist/components/form/MultiSelect.svelte.d.ts +6 -6
- package/dist/components/form/NumberInput.svelte.d.ts +2 -2
- package/dist/components/form/TextArea.svelte.d.ts +2 -2
- package/dist/components/form/TextInput.svelte.d.ts +2 -2
- package/dist/components/page/Alert.svelte.d.ts +2 -2
- package/dist/components/page/BackToTop.svelte.d.ts +2 -2
- package/dist/components/page/Docs.svelte +1 -1
- package/dist/components/page/Docs.svelte.d.ts +2 -2
- package/dist/components/page/ErrorMessage.svelte.d.ts +2 -2
- package/dist/components/page/Footer.svelte.d.ts +2 -2
- package/dist/components/page/GoToTop.svelte +1 -1
- package/dist/components/page/GoToTop.svelte.d.ts +2 -2
- package/dist/components/page/Header.svelte.d.ts +2 -2
- package/dist/components/page/HelpPopUp.svelte +1 -1
- package/dist/components/page/HelpPopUp.svelte.d.ts +2 -2
- package/dist/components/page/Notification.svelte.d.ts +2 -2
- package/dist/components/page/Page.svelte.d.ts +2 -2
- package/dist/components/page/Spinner.svelte.d.ts +2 -2
- package/dist/components/page/TablePlaceholder.svelte.d.ts +2 -2
- package/dist/components/page/breadcrumb/Breadcrumb.svelte.d.ts +2 -2
- package/dist/components/page/menu/Menu.svelte +1 -1
- package/dist/components/page/menu/Menu.svelte.d.ts +2 -2
- package/dist/components/page/menu/MenuBar.svelte.d.ts +2 -2
- package/dist/components/page/menu/MenuItem.svelte.d.ts +2 -2
- package/dist/components/page/menu/MenuSublist.svelte.d.ts +2 -2
- package/dist/components/page/menu/SettingsBar.svelte +1 -1
- package/dist/components/page/menu/SettingsBar.svelte.d.ts +2 -2
- package/dist/components/toggle/Toggle.svelte +1 -1
- package/dist/components/toggle/Toggle.svelte.d.ts +2 -2
- package/dist/models/Enums.d.ts +15 -15
- package/dist/models/Models.d.ts +1 -0
- package/dist/models/Models.js +2 -0
- package/dist/stores/pageStores.d.ts +4 -3
- package/dist/themes/theme-bexis2.js +78 -78
- package/package.json +44 -41
- package/src/lib/components/CodeEditor/CodeEditor.svelte +1 -1
- package/src/lib/components/Table/TableContent.svelte +41 -14
- package/src/lib/components/Table/TableFilter.svelte +62 -36
- package/src/lib/components/Table/TableFilterServer.svelte +1 -1
- package/src/lib/components/Table/TablePagination.svelte +1 -1
- package/src/lib/components/Table/TablePaginationServer.svelte +1 -1
- package/src/lib/components/Table/shared.ts +9 -8
- package/src/lib/components/file/FileUploader.svelte +1 -1
- package/src/lib/components/page/Docs.svelte +1 -1
- package/src/lib/components/page/GoToTop.svelte +1 -1
- package/src/lib/components/page/HelpPopUp.svelte +1 -1
- package/src/lib/components/page/menu/Menu.svelte +1 -1
- package/src/lib/components/page/menu/SettingsBar.svelte +1 -1
- package/src/lib/components/toggle/Toggle.svelte +1 -1
- package/src/lib/models/Models.ts +2 -0
package/README.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# bexis-core-ui
|
|
2
|
-
## 0.
|
|
2
|
+
## 0.4.1
|
|
3
|
+
- table
|
|
4
|
+
- Server-side searching
|
|
5
|
+
- Case-insensitive filtering of missing values
|
|
6
|
+
- Date formatting for display patterns
|
|
7
|
+
- Handle missing values regardless of the data type
|
|
8
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
- update dependency libaries
|
|
11
|
+
- svelte
|
|
12
|
+
- sveltekit
|
|
13
|
+
- vite
|
|
14
|
+
|
|
3
15
|
## 0.3.13
|
|
4
16
|
## 0.3.12
|
|
5
17
|
- table
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @typedef {typeof __propDef.props} TableViewProps */
|
|
2
2
|
/** @typedef {typeof __propDef.events} TableViewEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} TableViewSlots */
|
|
4
|
-
export default class TableView extends
|
|
4
|
+
export default class TableView extends SvelteComponent<{
|
|
5
5
|
[x: string]: never;
|
|
6
6
|
}, {
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
@@ -10,7 +10,7 @@ export default class TableView extends SvelteComponentTyped<{
|
|
|
10
10
|
export type TableViewProps = typeof __propDef.props;
|
|
11
11
|
export type TableViewEvents = typeof __propDef.events;
|
|
12
12
|
export type TableViewSlots = typeof __propDef.slots;
|
|
13
|
-
import {
|
|
13
|
+
import { SvelteComponent } from "svelte";
|
|
14
14
|
declare const __propDef: {
|
|
15
15
|
props: {
|
|
16
16
|
[x: string]: never;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
2
|
import CodeMirror from "svelte-codemirror-editor";
|
|
3
|
-
import Fa from "svelte-fa
|
|
3
|
+
import Fa from "svelte-fa";
|
|
4
4
|
import Linter from "eslint4b-prebuilt";
|
|
5
5
|
import { html } from "@codemirror/lang-html";
|
|
6
6
|
import { javascript, esLint } from "@codemirror/lang-javascript";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ThemeSpec } from 'svelte-codemirror-editor';
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
3
2
|
declare const __propDef: {
|
|
4
3
|
props: {
|
|
5
4
|
id: string;
|
|
@@ -11,7 +10,7 @@ declare const __propDef: {
|
|
|
11
10
|
toggle?: boolean | undefined;
|
|
12
11
|
actions?: boolean | undefined;
|
|
13
12
|
isValid?: boolean | undefined;
|
|
14
|
-
styles?:
|
|
13
|
+
styles?: any;
|
|
15
14
|
};
|
|
16
15
|
events: {
|
|
17
16
|
cancel: CustomEvent<any>;
|
|
@@ -28,6 +27,6 @@ declare const __propDef: {
|
|
|
28
27
|
export type CodeEditorProps = typeof __propDef.props;
|
|
29
28
|
export type CodeEditorEvents = typeof __propDef.events;
|
|
30
29
|
export type CodeEditorSlots = typeof __propDef.slots;
|
|
31
|
-
export default class CodeEditor extends
|
|
30
|
+
export default class CodeEditor extends SvelteComponent<CodeEditorProps, CodeEditorEvents, CodeEditorSlots> {
|
|
32
31
|
}
|
|
33
32
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @typedef {typeof __propDef.props} FileIconProps */
|
|
2
2
|
/** @typedef {typeof __propDef.events} FileIconEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} FileIconSlots */
|
|
4
|
-
export default class FileIcon extends
|
|
4
|
+
export default class FileIcon extends SvelteComponent<{
|
|
5
5
|
type?: string | undefined;
|
|
6
6
|
}, {
|
|
7
7
|
[evt: string]: CustomEvent<any>;
|
|
@@ -10,7 +10,7 @@ export default class FileIcon extends SvelteComponentTyped<{
|
|
|
10
10
|
export type FileIconProps = typeof __propDef.props;
|
|
11
11
|
export type FileIconEvents = typeof __propDef.events;
|
|
12
12
|
export type FileIconSlots = typeof __propDef.slots;
|
|
13
|
-
import {
|
|
13
|
+
import { SvelteComponent } from "svelte";
|
|
14
14
|
declare const __propDef: {
|
|
15
15
|
props: {
|
|
16
16
|
type?: string | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @typedef {typeof __propDef.props} FileInfoProps */
|
|
2
2
|
/** @typedef {typeof __propDef.events} FileInfoEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} FileInfoSlots */
|
|
4
|
-
export default class FileInfo extends
|
|
4
|
+
export default class FileInfo extends SvelteComponent<{
|
|
5
5
|
type?: string | undefined;
|
|
6
6
|
name?: string | undefined;
|
|
7
7
|
size?: string | undefined;
|
|
@@ -12,7 +12,7 @@ export default class FileInfo extends SvelteComponentTyped<{
|
|
|
12
12
|
export type FileInfoProps = typeof __propDef.props;
|
|
13
13
|
export type FileInfoEvents = typeof __propDef.events;
|
|
14
14
|
export type FileInfoSlots = typeof __propDef.slots;
|
|
15
|
-
import {
|
|
15
|
+
import { SvelteComponent } from "svelte";
|
|
16
16
|
declare const __propDef: {
|
|
17
17
|
props: {
|
|
18
18
|
type?: string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import Dropzone from "svelte-file-dropzone";
|
|
2
|
-
import Fa from "svelte-fa
|
|
2
|
+
import Fa from "svelte-fa";
|
|
3
3
|
import Spinner from "../page/Spinner.svelte";
|
|
4
4
|
import { createEventDispatcher } from "svelte";
|
|
5
5
|
import { faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { fileUploaderType } from '../../models/Models.js';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -22,6 +22,6 @@ declare const __propDef: {
|
|
|
22
22
|
export type FileUploaderProps = typeof __propDef.props;
|
|
23
23
|
export type FileUploaderEvents = typeof __propDef.events;
|
|
24
24
|
export type FileUploaderSlots = typeof __propDef.slots;
|
|
25
|
-
export default class FileUploader extends
|
|
25
|
+
export default class FileUploader extends SvelteComponent<FileUploaderProps, FileUploaderEvents, FileUploaderSlots> {
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: Record<string, never>;
|
|
4
4
|
events: {
|
|
@@ -9,6 +9,6 @@ declare const __propDef: {
|
|
|
9
9
|
export type ListViewProps = typeof __propDef.props;
|
|
10
10
|
export type ListViewEvents = typeof __propDef.events;
|
|
11
11
|
export type ListViewSlots = typeof __propDef.slots;
|
|
12
|
-
export default class ListView extends
|
|
12
|
+
export default class ListView extends SvelteComponent<ListViewProps, ListViewEvents, ListViewSlots> {
|
|
13
13
|
}
|
|
14
14
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: any;
|
|
3
3
|
export type TableProps = typeof __propDef.props;
|
|
4
4
|
export type TableEvents = typeof __propDef.events;
|
|
5
5
|
export type TableSlots = typeof __propDef.slots;
|
|
6
|
-
export default class Table extends
|
|
6
|
+
export default class Table extends SvelteComponent<TableProps, TableEvents, TableSlots> {
|
|
7
7
|
}
|
|
8
8
|
export {};
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floating-ui/dom";
|
|
15
15
|
import { SlideToggle, storePopup } from "@skeletonlabs/skeleton";
|
|
16
16
|
storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
|
|
17
|
+
import Spinner from "../page/Spinner.svelte";
|
|
17
18
|
import TableFilter from "./TableFilter.svelte";
|
|
18
19
|
import TableFilterServer from "./TableFilterServer.svelte";
|
|
19
20
|
import TablePagination from "./TablePagination.svelte";
|
|
@@ -68,6 +69,7 @@ let {
|
|
|
68
69
|
// Version ID to send with the request
|
|
69
70
|
} = config;
|
|
70
71
|
let searchValue = "";
|
|
72
|
+
let isFetching = false;
|
|
71
73
|
const filters = writable({});
|
|
72
74
|
const dispatch = createEventDispatcher();
|
|
73
75
|
const actionDispatcher = (obj) => dispatch("action", obj);
|
|
@@ -167,7 +169,9 @@ const tableColumns = [
|
|
|
167
169
|
tableId,
|
|
168
170
|
values,
|
|
169
171
|
toFilterableValueFn,
|
|
170
|
-
filters
|
|
172
|
+
filters,
|
|
173
|
+
toStringFn,
|
|
174
|
+
pageIndex
|
|
171
175
|
});
|
|
172
176
|
}
|
|
173
177
|
} : void 0,
|
|
@@ -205,7 +209,8 @@ const tableColumns = [
|
|
|
205
209
|
id,
|
|
206
210
|
tableId,
|
|
207
211
|
values,
|
|
208
|
-
filters
|
|
212
|
+
filters,
|
|
213
|
+
pageIndex
|
|
209
214
|
});
|
|
210
215
|
}
|
|
211
216
|
}
|
|
@@ -244,14 +249,25 @@ const updateTable = async () => {
|
|
|
244
249
|
sendModel.version = versionId;
|
|
245
250
|
sendModel.id = entityId;
|
|
246
251
|
sendModel.filter = normalizeFilters($filters);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
let fetchData;
|
|
253
|
+
try {
|
|
254
|
+
isFetching = true;
|
|
255
|
+
fetchData = await fetch(URL, {
|
|
256
|
+
headers: {
|
|
257
|
+
"Content-Type": "application/json",
|
|
258
|
+
Authorization: `Bearer ${token}`
|
|
259
|
+
},
|
|
260
|
+
method: "POST",
|
|
261
|
+
body: JSON.stringify(sendModel)
|
|
262
|
+
});
|
|
263
|
+
} catch (error) {
|
|
264
|
+
throw new Error(`Network error: ${error.message}`);
|
|
265
|
+
} finally {
|
|
266
|
+
isFetching = false;
|
|
267
|
+
}
|
|
268
|
+
if (!fetchData.ok) {
|
|
269
|
+
throw new Error("Failed to fetch data");
|
|
270
|
+
}
|
|
255
271
|
const response = await fetchData.json();
|
|
256
272
|
if (response.columns !== void 0) {
|
|
257
273
|
columns = convertServerColumns(response.columns);
|
|
@@ -282,7 +298,13 @@ $:
|
|
|
282
298
|
<!-- Enable the search filter if table is not empty -->
|
|
283
299
|
{#if $data.length > 0}
|
|
284
300
|
{#if !serverSide}
|
|
285
|
-
<
|
|
301
|
+
<form
|
|
302
|
+
class="flex gap-2"
|
|
303
|
+
on:submit|preventDefault={() => {
|
|
304
|
+
sendModel.q = searchValue;
|
|
305
|
+
$filterValue = searchValue;
|
|
306
|
+
}}
|
|
307
|
+
>
|
|
286
308
|
<div class="relative w-full flex items-center">
|
|
287
309
|
<input
|
|
288
310
|
class="input p-2 border border-primary-500"
|
|
@@ -295,18 +317,20 @@ $:
|
|
|
295
317
|
class="absolute right-3 items-center"
|
|
296
318
|
on:click|preventDefault={() => {
|
|
297
319
|
searchValue = '';
|
|
320
|
+
sendModel.q = '';
|
|
298
321
|
$filterValue = '';
|
|
299
322
|
}}><Fa icon={faXmark} /></button
|
|
300
323
|
>
|
|
301
324
|
</div>
|
|
302
325
|
<button
|
|
303
|
-
type="
|
|
326
|
+
type="submit"
|
|
304
327
|
class="btn variant-filled-primary"
|
|
305
328
|
on:click|preventDefault={() => {
|
|
306
329
|
$filterValue = searchValue;
|
|
330
|
+
sendModel.q = searchValue;
|
|
307
331
|
}}>Search</button
|
|
308
332
|
>
|
|
309
|
-
</
|
|
333
|
+
</form>
|
|
310
334
|
{/if}
|
|
311
335
|
<div class="flex justify-between items-center py-2 w-full">
|
|
312
336
|
<div>
|
|
@@ -407,6 +431,8 @@ $:
|
|
|
407
431
|
</tr>
|
|
408
432
|
</Subscribe>
|
|
409
433
|
{/each}
|
|
434
|
+
{:else if isFetching}
|
|
435
|
+
<div class="p-10"><Spinner /></div>
|
|
410
436
|
{:else}
|
|
411
437
|
<!-- Table is empty -->
|
|
412
438
|
<p class="items-center justify-center flex w-full p-10 italic">Nothing to show here.</p>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
import type { TableConfig } from '../../models/Models';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
@@ -14,6 +14,6 @@ declare const __propDef: {
|
|
|
14
14
|
export type TableContentProps = typeof __propDef.props;
|
|
15
15
|
export type TableContentEvents = typeof __propDef.events;
|
|
16
16
|
export type TableContentSlots = typeof __propDef.slots;
|
|
17
|
-
export default class TableContent extends
|
|
17
|
+
export default class TableContent extends SvelteComponent<TableContentProps, TableContentEvents, TableContentSlots> {
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import Fa from "svelte-fa
|
|
1
|
+
<script>import Fa from "svelte-fa";
|
|
2
2
|
import { faFilter, faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";
|
|
3
3
|
import { popup } from "@skeletonlabs/skeleton";
|
|
4
4
|
import { FilterOptionsEnum } from "../../models/Enums";
|
|
@@ -6,9 +6,24 @@ export let values;
|
|
|
6
6
|
export let id;
|
|
7
7
|
export let tableId;
|
|
8
8
|
export let toFilterableValueFn = void 0;
|
|
9
|
+
export let toStringFn = void 0;
|
|
9
10
|
export let filterValue;
|
|
10
11
|
export let filters;
|
|
12
|
+
export let pageIndex;
|
|
11
13
|
let active = false;
|
|
14
|
+
let type = "string";
|
|
15
|
+
let isDate = false;
|
|
16
|
+
let dropdowns = [];
|
|
17
|
+
$values.forEach((item) => {
|
|
18
|
+
if (item) {
|
|
19
|
+
type = typeof (toFilterableValueFn ? toFilterableValueFn(item) : item);
|
|
20
|
+
if (type === "object") {
|
|
21
|
+
if (item instanceof Date) {
|
|
22
|
+
isDate = true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
12
27
|
const options = {
|
|
13
28
|
number: [
|
|
14
29
|
{
|
|
@@ -89,28 +104,37 @@ const options = {
|
|
|
89
104
|
}
|
|
90
105
|
]
|
|
91
106
|
};
|
|
92
|
-
let dropdowns = [];
|
|
93
107
|
const popupId = `${tableId}-${id}`;
|
|
94
108
|
const popupFeatured = {
|
|
95
109
|
event: "click",
|
|
96
110
|
target: popupId,
|
|
97
111
|
placement: "bottom-start"
|
|
98
112
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
$values.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
const stringValues = (
|
|
114
|
+
// type === 'number' ?
|
|
115
|
+
$values.map((item) => toStringFn ? toStringFn(item) : item)
|
|
116
|
+
);
|
|
117
|
+
const missingValues = (
|
|
118
|
+
// type === 'number' ?
|
|
119
|
+
stringValues.reduce((acc, item, index) => {
|
|
120
|
+
acc[typeof item === "string" ? item.toLowerCase() : item] = $values[index];
|
|
121
|
+
return acc;
|
|
122
|
+
}, {})
|
|
123
|
+
);
|
|
124
|
+
const getMissingValue = (value) => {
|
|
125
|
+
return Object.keys(missingValues).includes(value.toLowerCase()) ? missingValues[value.toLowerCase()] : value;
|
|
126
|
+
};
|
|
111
127
|
const optionChangeHandler = (e, index) => {
|
|
112
128
|
delete $filters[id][dropdowns[index].option];
|
|
113
|
-
$filters[id] = {
|
|
129
|
+
$filters[id] = {
|
|
130
|
+
...$filters[id],
|
|
131
|
+
[e.target.value]: (
|
|
132
|
+
// type === 'number'
|
|
133
|
+
// ?
|
|
134
|
+
getMissingValue(dropdowns[index].value)
|
|
135
|
+
)
|
|
136
|
+
// : dropdowns[index].value
|
|
137
|
+
};
|
|
114
138
|
$filters = $filters;
|
|
115
139
|
dropdowns[index] = {
|
|
116
140
|
...dropdowns[index],
|
|
@@ -120,11 +144,18 @@ const optionChangeHandler = (e, index) => {
|
|
|
120
144
|
const valueChangeHandler = (e, index) => {
|
|
121
145
|
dropdowns[index] = {
|
|
122
146
|
...dropdowns[index],
|
|
123
|
-
value: type === "
|
|
147
|
+
value: type === "date" ? new Date(e.target.value) : e.target.value
|
|
124
148
|
};
|
|
125
149
|
$filters = {
|
|
126
150
|
...$filters,
|
|
127
|
-
[id]: {
|
|
151
|
+
[id]: {
|
|
152
|
+
...$filters[id],
|
|
153
|
+
[dropdowns[index].option]: (
|
|
154
|
+
// type === 'number' ?
|
|
155
|
+
getMissingValue(e.target.value)
|
|
156
|
+
)
|
|
157
|
+
// : dropdowns[index].value
|
|
158
|
+
}
|
|
128
159
|
};
|
|
129
160
|
};
|
|
130
161
|
const addFilter = (option, value) => {
|
|
@@ -178,6 +209,7 @@ $:
|
|
|
178
209
|
addFilter(options[type][0].value, undefined);
|
|
179
210
|
$filterValue = $filters[id];
|
|
180
211
|
active = false;
|
|
212
|
+
$pageIndex = 0;
|
|
181
213
|
}}>Clear Filters</button
|
|
182
214
|
>
|
|
183
215
|
|
|
@@ -212,14 +244,7 @@ $:
|
|
|
212
244
|
{/if}
|
|
213
245
|
</div>
|
|
214
246
|
|
|
215
|
-
{#if type === 'number'}
|
|
216
|
-
<input
|
|
217
|
-
type="number"
|
|
218
|
-
class="input p-1 border border-primary-500"
|
|
219
|
-
on:input={(e) => valueChangeHandler(e, index)}
|
|
220
|
-
bind:value={dropdown.value}
|
|
221
|
-
/>
|
|
222
|
-
{:else if type === 'string'}
|
|
247
|
+
{#if type === 'number' || type === 'string'}
|
|
223
248
|
<input
|
|
224
249
|
type="text"
|
|
225
250
|
class="input p-1 border border-primary-500"
|
|
@@ -258,6 +283,7 @@ $:
|
|
|
258
283
|
class="btn variant-filled-primary btn-sm"
|
|
259
284
|
type="button"
|
|
260
285
|
on:click|preventDefault={() => {
|
|
286
|
+
$pageIndex = 0;
|
|
261
287
|
$filterValue = $filters[id];
|
|
262
288
|
active = true;
|
|
263
289
|
}}>Apply</button
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
values: any;
|
|
5
5
|
id: any;
|
|
6
6
|
tableId: any;
|
|
7
7
|
toFilterableValueFn?: ((value: any) => any) | undefined;
|
|
8
|
+
toStringFn?: ((value: any) => string) | undefined;
|
|
8
9
|
filterValue: any;
|
|
9
10
|
filters: any;
|
|
11
|
+
pageIndex: any;
|
|
10
12
|
};
|
|
11
13
|
events: {
|
|
12
14
|
[evt: string]: CustomEvent<any>;
|
|
@@ -16,6 +18,6 @@ declare const __propDef: {
|
|
|
16
18
|
export type TableFilterProps = typeof __propDef.props;
|
|
17
19
|
export type TableFilterEvents = typeof __propDef.events;
|
|
18
20
|
export type TableFilterSlots = typeof __propDef.slots;
|
|
19
|
-
export default class TableFilter extends
|
|
21
|
+
export default class TableFilter extends SvelteComponent<TableFilterProps, TableFilterEvents, TableFilterSlots> {
|
|
20
22
|
}
|
|
21
23
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import Fa from "svelte-fa
|
|
1
|
+
<script>import Fa from "svelte-fa";
|
|
2
2
|
import { faFilter, faPlus, faXmark } from "@fortawesome/free-solid-svg-icons";
|
|
3
3
|
import { popup } from "@skeletonlabs/skeleton";
|
|
4
4
|
import { FilterOptionsEnum } from "../../models/Enums";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
values: any;
|
|
@@ -17,6 +17,6 @@ declare const __propDef: {
|
|
|
17
17
|
export type TableFilterServerProps = typeof __propDef.props;
|
|
18
18
|
export type TableFilterServerEvents = typeof __propDef.events;
|
|
19
19
|
export type TableFilterServerSlots = typeof __propDef.slots;
|
|
20
|
-
export default class TableFilterServer extends
|
|
20
|
+
export default class TableFilterServer extends SvelteComponent<TableFilterServerProps, TableFilterServerEvents, TableFilterServerSlots> {
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
pageConfig: any;
|
|
@@ -13,6 +13,6 @@ declare const __propDef: {
|
|
|
13
13
|
export type TablePaginationProps = typeof __propDef.props;
|
|
14
14
|
export type TablePaginationEvents = typeof __propDef.events;
|
|
15
15
|
export type TablePaginationSlots = typeof __propDef.slots;
|
|
16
|
-
export default class TablePagination extends
|
|
16
|
+
export default class TablePagination extends SvelteComponent<TablePaginationProps, TablePaginationEvents, TablePaginationSlots> {
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
id: any;
|
|
@@ -16,6 +16,6 @@ declare const __propDef: {
|
|
|
16
16
|
export type TablePaginationServerProps = typeof __propDef.props;
|
|
17
17
|
export type TablePaginationServerEvents = typeof __propDef.events;
|
|
18
18
|
export type TablePaginationServerSlots = typeof __propDef.slots;
|
|
19
|
-
export default class TablePaginationServer extends
|
|
19
|
+
export default class TablePaginationServer extends SvelteComponent<TablePaginationServerProps, TablePaginationServerEvents, TablePaginationServerSlots> {
|
|
20
20
|
}
|
|
21
21
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import dateFormat from 'dateformat';
|
|
1
2
|
// Function to determine minWidth for a column to simplify the logic in the HTML
|
|
2
3
|
export const minWidth = (id, columns) => {
|
|
3
4
|
if (columns && id in columns) {
|
|
@@ -94,14 +95,13 @@ export const convertServerColumns = (columns) => {
|
|
|
94
95
|
const columnsConfig = {};
|
|
95
96
|
columns.forEach((col) => {
|
|
96
97
|
let instructions = {};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// }
|
|
98
|
+
if (col.instructions?.displayPattern) {
|
|
99
|
+
instructions = {
|
|
100
|
+
toStringFn: (date) => dateFormat(date, col.instructions?.displayPattern || ''),
|
|
101
|
+
toSortableValueFn: (date) => date.getTime(),
|
|
102
|
+
toFilterableValueFn: (date) => date
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
105
|
if (col.instructions?.missingValues) {
|
|
106
106
|
instructions = {
|
|
107
107
|
...instructions,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
id?: string | undefined;
|
|
@@ -20,6 +20,6 @@ declare const __propDef: {
|
|
|
20
20
|
export type CheckboxProps = typeof __propDef.props;
|
|
21
21
|
export type CheckboxEvents = typeof __propDef.events;
|
|
22
22
|
export type CheckboxSlots = typeof __propDef.slots;
|
|
23
|
-
export default class Checkbox extends
|
|
23
|
+
export default class Checkbox extends SvelteComponent<CheckboxProps, CheckboxEvents, CheckboxSlots> {
|
|
24
24
|
}
|
|
25
25
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
id: any;
|
|
@@ -17,6 +17,6 @@ declare const __propDef: {
|
|
|
17
17
|
export type CheckboxKvPListProps = typeof __propDef.props;
|
|
18
18
|
export type CheckboxKvPListEvents = typeof __propDef.events;
|
|
19
19
|
export type CheckboxKvPListSlots = typeof __propDef.slots;
|
|
20
|
-
export default class CheckboxKvPList extends
|
|
20
|
+
export default class CheckboxKvPList extends SvelteComponent<CheckboxKvPListProps, CheckboxKvPListEvents, CheckboxKvPListSlots> {
|
|
21
21
|
}
|
|
22
22
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
source: any;
|
|
@@ -15,6 +15,6 @@ declare const __propDef: {
|
|
|
15
15
|
export type CheckboxListProps = typeof __propDef.props;
|
|
16
16
|
export type CheckboxListEvents = typeof __propDef.events;
|
|
17
17
|
export type CheckboxListSlots = typeof __propDef.slots;
|
|
18
|
-
export default class CheckboxList extends
|
|
18
|
+
export default class CheckboxList extends SvelteComponent<CheckboxListProps, CheckboxListEvents, CheckboxListSlots> {
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
id?: string | undefined;
|
|
@@ -22,6 +22,6 @@ declare const __propDef: {
|
|
|
22
22
|
export type DateInputProps = typeof __propDef.props;
|
|
23
23
|
export type DateInputEvents = typeof __propDef.events;
|
|
24
24
|
export type DateInputSlots = typeof __propDef.slots;
|
|
25
|
-
export default class DateInput extends
|
|
25
|
+
export default class DateInput extends SvelteComponent<DateInputProps, DateInputEvents, DateInputSlots> {
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/** @typedef {typeof __propDef.props} DropdownKvPProps */
|
|
2
2
|
/** @typedef {typeof __propDef.events} DropdownKvPEvents */
|
|
3
3
|
/** @typedef {typeof __propDef.slots} DropdownKvPSlots */
|
|
4
|
-
export default class DropdownKvP extends
|
|
4
|
+
export default class DropdownKvP extends SvelteComponent<{
|
|
5
5
|
id: any;
|
|
6
6
|
target: any;
|
|
7
|
-
source: any;
|
|
8
7
|
title: any;
|
|
8
|
+
source: any;
|
|
9
9
|
invalid?: boolean | undefined;
|
|
10
|
-
valid?: boolean | undefined;
|
|
11
10
|
feedback?: string[] | undefined;
|
|
12
11
|
required?: boolean | undefined;
|
|
13
|
-
complexTarget?: boolean | undefined;
|
|
14
12
|
help?: boolean | undefined;
|
|
13
|
+
valid?: boolean | undefined;
|
|
14
|
+
complexTarget?: boolean | undefined;
|
|
15
15
|
}, {
|
|
16
16
|
change: Event;
|
|
17
17
|
select: Event;
|
|
@@ -22,19 +22,19 @@ export default class DropdownKvP extends SvelteComponentTyped<{
|
|
|
22
22
|
export type DropdownKvPProps = typeof __propDef.props;
|
|
23
23
|
export type DropdownKvPEvents = typeof __propDef.events;
|
|
24
24
|
export type DropdownKvPSlots = typeof __propDef.slots;
|
|
25
|
-
import {
|
|
25
|
+
import { SvelteComponent } from "svelte";
|
|
26
26
|
declare const __propDef: {
|
|
27
27
|
props: {
|
|
28
28
|
id: any;
|
|
29
29
|
target: any;
|
|
30
|
-
source: any;
|
|
31
30
|
title: any;
|
|
31
|
+
source: any;
|
|
32
32
|
invalid?: boolean | undefined;
|
|
33
|
-
valid?: boolean | undefined;
|
|
34
33
|
feedback?: string[] | undefined;
|
|
35
34
|
required?: boolean | undefined;
|
|
36
|
-
complexTarget?: boolean | undefined;
|
|
37
35
|
help?: boolean | undefined;
|
|
36
|
+
valid?: boolean | undefined;
|
|
37
|
+
complexTarget?: boolean | undefined;
|
|
38
38
|
};
|
|
39
39
|
events: {
|
|
40
40
|
change: Event;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
id?: string | undefined;
|
|
@@ -17,6 +17,6 @@ declare const __propDef: {
|
|
|
17
17
|
export type InputContainerProps = typeof __propDef.props;
|
|
18
18
|
export type InputContainerEvents = typeof __propDef.events;
|
|
19
19
|
export type InputContainerSlots = typeof __propDef.slots;
|
|
20
|
-
export default class InputContainer extends
|
|
20
|
+
export default class InputContainer extends SvelteComponent<InputContainerProps, InputContainerEvents, InputContainerSlots> {
|
|
21
21
|
}
|
|
22
22
|
export {};
|