@bexis2/bexis2-core-ui 0.4.19 → 0.4.21
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 +18 -8
- package/dist/components/CodeEditor/CodeEditor.svelte +4 -0
- package/dist/components/Facets/Facets.svelte +23 -10
- package/dist/components/Facets/ShowMore.svelte +30 -17
- package/dist/components/Facets/ShowMore.svelte.d.ts +1 -1
- package/dist/components/File/FileUploader.svelte +1 -1
- package/dist/components/Table/ColumnsMenu.svelte +5 -0
- package/dist/components/Table/TableContent.svelte +13 -3
- package/dist/components/Table/TableFilter.svelte +12 -0
- package/dist/components/Table/TableFilterServer.svelte +13 -1
- package/dist/components/Table/TablePagination.svelte +10 -1
- package/dist/components/Table/TablePaginationServer.svelte +8 -0
- package/dist/components/form/Checkbox.svelte +1 -1
- package/dist/components/form/CheckboxKvPList.svelte +2 -1
- package/dist/components/form/CheckboxList.svelte +2 -2
- package/dist/components/form/DateInput.svelte +1 -1
- package/dist/components/form/DropdownKvP.svelte +1 -1
- package/dist/components/form/InputContainer.svelte +7 -1
- package/dist/components/form/MultiSelect.svelte +100 -106
- package/dist/components/form/NumberInput.svelte +1 -1
- package/dist/components/form/TextArea.svelte +1 -1
- package/dist/components/form/TextInput.svelte +1 -1
- package/dist/components/page/Alert.svelte +1 -1
- package/dist/components/page/BackToTop.svelte +1 -1
- package/dist/components/page/GoToTop.svelte +1 -0
- package/dist/components/page/HelpPopUp.svelte +1 -0
- package/dist/components/page/Page.svelte +5 -4
- package/package.json +1 -1
- package/src/lib/components/CodeEditor/CodeEditor.svelte +4 -0
- package/src/lib/components/Facets/Facets.svelte +28 -12
- package/src/lib/components/Facets/ShowMore.svelte +31 -17
- package/src/lib/components/File/FileUploader.svelte +1 -1
- package/src/lib/components/Table/ColumnsMenu.svelte +5 -0
- package/src/lib/components/Table/TableContent.svelte +13 -3
- package/src/lib/components/Table/TableFilter.svelte +12 -0
- package/src/lib/components/Table/TableFilterServer.svelte +13 -1
- package/src/lib/components/Table/TablePagination.svelte +10 -1
- package/src/lib/components/Table/TablePaginationServer.svelte +8 -0
- package/src/lib/components/form/Checkbox.svelte +1 -1
- package/src/lib/components/form/CheckboxKvPList.svelte +2 -1
- package/src/lib/components/form/CheckboxList.svelte +2 -2
- package/src/lib/components/form/DateInput.svelte +1 -1
- package/src/lib/components/form/DropdownKvP.svelte +1 -1
- package/src/lib/components/form/InputContainer.svelte +7 -1
- package/src/lib/components/form/MultiSelect.svelte +100 -106
- package/src/lib/components/form/NumberInput.svelte +1 -1
- package/src/lib/components/form/TextArea.svelte +1 -1
- package/src/lib/components/form/TextInput.svelte +1 -1
- package/src/lib/components/page/Alert.svelte +1 -1
- package/src/lib/components/page/BackToTop.svelte +1 -1
- package/src/lib/components/page/GoToTop.svelte +1 -0
- package/src/lib/components/page/HelpPopUp.svelte +1 -0
- package/src/lib/components/page/Page.svelte +5 -4
|
@@ -165,9 +165,9 @@
|
|
|
165
165
|
header: header ?? key,
|
|
166
166
|
accessor: accessor,
|
|
167
167
|
// Render the cell with the provided component, or use the toStringFn if provided, or just use the value
|
|
168
|
-
cell: ({ value, row }) => {
|
|
168
|
+
cell: ({ value, row, column }) => {
|
|
169
169
|
return renderComponent
|
|
170
|
-
? createRender(renderComponent, { value, row, dispatchFn: actionDispatcher })
|
|
170
|
+
? createRender(renderComponent, { value, row, column, dispatchFn: actionDispatcher })
|
|
171
171
|
: toStringFn
|
|
172
172
|
? toStringFn(value)
|
|
173
173
|
: value;
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
} else {
|
|
395
395
|
sendModel.q = searchValue;
|
|
396
396
|
}
|
|
397
|
-
|
|
397
|
+
|
|
398
398
|
$filterValue = searchValue;
|
|
399
399
|
}}
|
|
400
400
|
>
|
|
@@ -402,13 +402,16 @@
|
|
|
402
402
|
<input
|
|
403
403
|
class="input p-2 border border-primary-500"
|
|
404
404
|
type="text"
|
|
405
|
+
title="Search within all table rows"
|
|
405
406
|
bind:value={searchValue}
|
|
406
407
|
placeholder="Search rows..."
|
|
407
408
|
id="{tableId}-search"
|
|
408
409
|
/><button
|
|
409
410
|
type="reset"
|
|
411
|
+
title="Clear search"
|
|
410
412
|
id="{tableId}-searchReset"
|
|
411
413
|
class="absolute right-3 items-center"
|
|
414
|
+
aria-label="Clear search"
|
|
412
415
|
on:click|preventDefault={() => {
|
|
413
416
|
if (serverSide && !sendModel) {
|
|
414
417
|
throw new Error('Server-side configuration is missing');
|
|
@@ -423,6 +426,7 @@
|
|
|
423
426
|
</div>
|
|
424
427
|
<button
|
|
425
428
|
type="submit"
|
|
429
|
+
title="Search"
|
|
426
430
|
id="{tableId}-searchSubmit"
|
|
427
431
|
class="btn variant-filled-primary"
|
|
428
432
|
on:click|preventDefault={() => {
|
|
@@ -448,6 +452,7 @@
|
|
|
448
452
|
{#if toggle}
|
|
449
453
|
<SlideToggle
|
|
450
454
|
name="slider-label"
|
|
455
|
+
label="Fit to screen"
|
|
451
456
|
active="bg-primary-500"
|
|
452
457
|
size="sm"
|
|
453
458
|
checked={fitToScreen}
|
|
@@ -461,6 +466,7 @@
|
|
|
461
466
|
{#if resizable !== 'none'}
|
|
462
467
|
<button
|
|
463
468
|
type="button"
|
|
469
|
+
title="Reset column and row sizing"
|
|
464
470
|
class="btn btn-sm variant-filled-primary rounded-full order-last"
|
|
465
471
|
on:click|preventDefault={() =>
|
|
466
472
|
resetResize($headerRows, $pageRows, tableId, columns, resizable)}
|
|
@@ -470,6 +476,7 @@
|
|
|
470
476
|
{#if exportable}
|
|
471
477
|
<button
|
|
472
478
|
type="button"
|
|
479
|
+
title="Export table data as CSV"
|
|
473
480
|
class="btn btn-sm variant-filled-primary rounded-full order-last"
|
|
474
481
|
on:click|preventDefault={() => exportAsCsv(tableId, $exportedData)}
|
|
475
482
|
>Export as CSV</button
|
|
@@ -486,6 +493,7 @@
|
|
|
486
493
|
{...$tableAttrs}
|
|
487
494
|
class="table table-auto table-compact bg-tertiary-500/30 dark:bg-tertiary-900/10 overflow-clip"
|
|
488
495
|
id="{tableId}-table"
|
|
496
|
+
title="Table"
|
|
489
497
|
>
|
|
490
498
|
<!-- If table height is provided, making the top row sticky -->
|
|
491
499
|
<thead class={height != null && $pageRows.length > 0 ? `sticky top-0` : ''}>
|
|
@@ -511,6 +519,8 @@
|
|
|
511
519
|
<div class="flex gap-1 whitespace-pre-wrap">
|
|
512
520
|
<!-- Adding sorting config and styling -->
|
|
513
521
|
<span
|
|
522
|
+
role="button"
|
|
523
|
+
tabindex="0"
|
|
514
524
|
class:underline={props.sort.order}
|
|
515
525
|
class:normal-case={cell.id !== cell.label}
|
|
516
526
|
class:cursor-pointer={!props.sort.disabled}
|
|
@@ -240,6 +240,7 @@
|
|
|
240
240
|
type="button"
|
|
241
241
|
use:popup={popupFeatured}
|
|
242
242
|
id="{popupId}-button"
|
|
243
|
+
aria-label="Open filter menu for column {id}"
|
|
243
244
|
>
|
|
244
245
|
<Fa icon={faFilter} size="12" />
|
|
245
246
|
</button>
|
|
@@ -249,6 +250,7 @@
|
|
|
249
250
|
<button
|
|
250
251
|
class="btn variant-filled-primary btn-sm"
|
|
251
252
|
type="button"
|
|
253
|
+
aria-label="Clear Filters"
|
|
252
254
|
on:click|preventDefault={() => {
|
|
253
255
|
// Set the defaults when cleared
|
|
254
256
|
clearFilters();
|
|
@@ -273,6 +275,7 @@
|
|
|
273
275
|
{#each options[type] as option (option)}
|
|
274
276
|
<option
|
|
275
277
|
value={option.value}
|
|
278
|
+
aria-label={option.label}
|
|
276
279
|
selected={dropdown.option === option.value}
|
|
277
280
|
disabled={Object.keys($filters[id]).includes(option.value) &&
|
|
278
281
|
dropdown.option !== option.value}>{option.label}</option
|
|
@@ -281,7 +284,10 @@
|
|
|
281
284
|
</select>
|
|
282
285
|
{#if dropdowns.length > 1}
|
|
283
286
|
<div
|
|
287
|
+
role="button"
|
|
288
|
+
tabindex="0"
|
|
284
289
|
class="btn variant-filled-warning btn-sm h-full"
|
|
290
|
+
aria-label="Remove filter"
|
|
285
291
|
on:click|preventDefault={() => removeFilter(dropdown.option)}
|
|
286
292
|
on:keydown|preventDefault={() => removeFilter(dropdown.option)}
|
|
287
293
|
>
|
|
@@ -296,6 +302,7 @@
|
|
|
296
302
|
class="input p-1 border border-primary-500"
|
|
297
303
|
on:input={(e) => valueChangeHandler(e, index)}
|
|
298
304
|
bind:value={dropdown.value}
|
|
305
|
+
aria-label="Filter value"
|
|
299
306
|
/>
|
|
300
307
|
{:else}
|
|
301
308
|
<input
|
|
@@ -303,6 +310,7 @@
|
|
|
303
310
|
class="input p-1 border border-primary-500"
|
|
304
311
|
on:input={(e) => valueChangeHandler(e, index)}
|
|
305
312
|
bind:value={dropdown.formValue}
|
|
313
|
+
aria-label="Filter value"
|
|
306
314
|
/>
|
|
307
315
|
{/if}
|
|
308
316
|
</div>
|
|
@@ -315,12 +323,15 @@
|
|
|
315
323
|
{#if remainingFilters.length}
|
|
316
324
|
<div
|
|
317
325
|
class="btn variant-filled-secondary btn-sm cursor-pointer"
|
|
326
|
+
role="button"
|
|
327
|
+
tabindex="0"
|
|
318
328
|
on:click|stopPropagation={() => {
|
|
319
329
|
addFilter(remainingFilters[0].value, undefined);
|
|
320
330
|
}}
|
|
321
331
|
on:keydown|stopPropagation={() => {
|
|
322
332
|
addFilter(remainingFilters[0].value, undefined);
|
|
323
333
|
}}
|
|
334
|
+
aria-label="Add filter"
|
|
324
335
|
>
|
|
325
336
|
<div class="flex gap-1 items-center"><Fa icon={faPlus} />Add Filter</div>
|
|
326
337
|
</div>
|
|
@@ -328,6 +339,7 @@
|
|
|
328
339
|
<button
|
|
329
340
|
class="btn variant-filled-primary btn-sm"
|
|
330
341
|
type="button"
|
|
342
|
+
aria-label="Apply filters"
|
|
331
343
|
on:click|preventDefault={() => {
|
|
332
344
|
$pageIndex = 0;
|
|
333
345
|
$filterValue = $filters[id];
|
|
@@ -233,6 +233,7 @@
|
|
|
233
233
|
type="button"
|
|
234
234
|
use:popup={popupFeatured}
|
|
235
235
|
id="{popupId}-button"
|
|
236
|
+
aria-label="Open filter menu for column {id}"
|
|
236
237
|
>
|
|
237
238
|
<Fa icon={faFilter} size="12" />
|
|
238
239
|
</button>
|
|
@@ -242,6 +243,7 @@
|
|
|
242
243
|
<button
|
|
243
244
|
class="btn variant-filled-primary btn-sm"
|
|
244
245
|
type="button"
|
|
246
|
+
aria-label="Clear Filters"
|
|
245
247
|
on:click|preventDefault={() => {
|
|
246
248
|
// Set the defaults when cleared
|
|
247
249
|
clearFilters();
|
|
@@ -264,6 +266,7 @@
|
|
|
264
266
|
{#each options[type] as option (option)}
|
|
265
267
|
<option
|
|
266
268
|
value={option.value}
|
|
269
|
+
aria-label={option.label}
|
|
267
270
|
selected={dropdown.option === option.value}
|
|
268
271
|
disabled={Object.keys($filters[id]).includes(option.value) &&
|
|
269
272
|
dropdown.option !== option.value}>{option.label}</option
|
|
@@ -272,10 +275,13 @@
|
|
|
272
275
|
</select>
|
|
273
276
|
{#if dropdowns.length > 1}
|
|
274
277
|
<div
|
|
278
|
+
role="button"
|
|
279
|
+
tabindex="0"
|
|
275
280
|
class="btn variant-filled-warning btn-sm h-full"
|
|
276
281
|
on:click|preventDefault={() => removeFilter(dropdown.option)}
|
|
277
282
|
on:keydown|preventDefault={() => removeFilter(dropdown.option)}
|
|
278
|
-
|
|
283
|
+
aria-label="Remove filter"
|
|
284
|
+
>
|
|
279
285
|
<Fa icon={faXmark} />
|
|
280
286
|
</div>
|
|
281
287
|
{/if}
|
|
@@ -294,6 +300,7 @@
|
|
|
294
300
|
class="input p-1 border border-primary-500"
|
|
295
301
|
on:input={(e) => valueChangeHandler(e, index)}
|
|
296
302
|
bind:value={dropdown.value}
|
|
303
|
+
aria-label="Filter value"
|
|
297
304
|
/>
|
|
298
305
|
{:else}
|
|
299
306
|
<input
|
|
@@ -301,6 +308,7 @@
|
|
|
301
308
|
class="input p-1 border border-primary-500"
|
|
302
309
|
on:input={(e) => valueChangeHandler(e, index)}
|
|
303
310
|
bind:value={dropdown.value}
|
|
311
|
+
aria-label="Filter value"
|
|
304
312
|
/>
|
|
305
313
|
{/if}
|
|
306
314
|
</div>
|
|
@@ -313,6 +321,9 @@
|
|
|
313
321
|
{#if remainingFilters.length}
|
|
314
322
|
<div
|
|
315
323
|
class="btn variant-filled-secondary btn-sm cursor-pointer"
|
|
324
|
+
aria-label="Add filter"
|
|
325
|
+
role="button"
|
|
326
|
+
tabindex="0"
|
|
316
327
|
on:click|stopPropagation={() => {
|
|
317
328
|
addFilter(remainingFilters[0].value, undefined);
|
|
318
329
|
}}
|
|
@@ -326,6 +337,7 @@
|
|
|
326
337
|
<button
|
|
327
338
|
class="btn variant-filled-primary btn-sm"
|
|
328
339
|
type="button"
|
|
340
|
+
aria-label="Apply filters"
|
|
329
341
|
on:click|preventDefault={applyFilters}>Apply</button
|
|
330
342
|
>
|
|
331
343
|
</div>
|
|
@@ -62,7 +62,11 @@
|
|
|
62
62
|
{/each}
|
|
63
63
|
</select> -->
|
|
64
64
|
|
|
65
|
-
<button
|
|
65
|
+
<button
|
|
66
|
+
aria-label="Open menu to select number of items per page"
|
|
67
|
+
class="btn variant-filled-primary w-20 justify-between"
|
|
68
|
+
use:popup={pageSizePopup}
|
|
69
|
+
>
|
|
66
70
|
<span class="capitalize font-semibold">{pageSizeDropdownValue}</span>
|
|
67
71
|
<Fa icon={faChevronDown} size="xs" />
|
|
68
72
|
</button>
|
|
@@ -82,6 +86,7 @@
|
|
|
82
86
|
<button
|
|
83
87
|
class="btn btn-sm variant-filled-primary"
|
|
84
88
|
on:click|preventDefault={goToFirstPage}
|
|
89
|
+
aria-label="Go to first page"
|
|
85
90
|
disabled={goToFirstPageDisabled}
|
|
86
91
|
id="{id}-first"
|
|
87
92
|
>
|
|
@@ -90,6 +95,7 @@
|
|
|
90
95
|
<button
|
|
91
96
|
class="btn btn-sm variant-filled-primary"
|
|
92
97
|
id="{id}-previous"
|
|
98
|
+
aria-label="Go to previous page"
|
|
93
99
|
on:click|preventDefault={goToPreviousPage}
|
|
94
100
|
disabled={goToPreviousPageDisabled}><Fa icon={faAngleLeft} /></button
|
|
95
101
|
>
|
|
@@ -98,17 +104,20 @@
|
|
|
98
104
|
class="input border border-primary-500 rounded flex w-24"
|
|
99
105
|
value={$pageIndex + 1}
|
|
100
106
|
max={$pageCount}
|
|
107
|
+
aria-label="Current page"
|
|
101
108
|
min={1}
|
|
102
109
|
on:change={handleChange}
|
|
103
110
|
/>
|
|
104
111
|
<button
|
|
105
112
|
class="btn btn-sm variant-filled-primary"
|
|
106
113
|
id="{id}-next"
|
|
114
|
+
aria-label="Go to next page"
|
|
107
115
|
on:click|preventDefault={goToNextPage}
|
|
108
116
|
disabled={goToNextPageDisabled}><Fa icon={faAngleRight} /></button
|
|
109
117
|
>
|
|
110
118
|
<button
|
|
111
119
|
class="btn btn-sm variant-filled-primary"
|
|
120
|
+
aria-label="Go to last page"
|
|
112
121
|
id="{id}-last"
|
|
113
122
|
on:click|preventDefault={goToLastPage}
|
|
114
123
|
disabled={goToLastPageDisabled}><Fa icon={faAnglesRight} /></button
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
<select
|
|
74
74
|
name="pageSize"
|
|
75
75
|
id="{id}-pageSize"
|
|
76
|
+
aria-label="Open menu to select number of items per page"
|
|
76
77
|
class="select variant-filled-primary w-min font-bold"
|
|
77
78
|
bind:value={$pageSize}
|
|
78
79
|
>
|
|
@@ -84,21 +85,26 @@
|
|
|
84
85
|
<div class="flex justify-center gap-1">
|
|
85
86
|
<button
|
|
86
87
|
class="btn btn-sm variant-filled-primary"
|
|
88
|
+
title="Go to first page"
|
|
87
89
|
on:click|preventDefault={() => goTo('first')}
|
|
88
90
|
disabled={goToFirstPageDisabled}
|
|
91
|
+
aria-label="Go to first page"
|
|
89
92
|
id="{id}-first"
|
|
90
93
|
>
|
|
91
94
|
<Fa icon={faAnglesLeft} /></button
|
|
92
95
|
>
|
|
93
96
|
<button
|
|
94
97
|
class="btn btn-sm variant-filled-primary"
|
|
98
|
+
title="Go to previous page"
|
|
95
99
|
id="{id}-previous"
|
|
100
|
+
aria-label="Go to previous page"
|
|
96
101
|
on:click|preventDefault={() => goTo('previous')}
|
|
97
102
|
disabled={goToPreviousPageDisabled}><Fa icon={faAngleLeft} /></button
|
|
98
103
|
>
|
|
99
104
|
<input
|
|
100
105
|
type="number"
|
|
101
106
|
class="input border border-primary-500 rounded flex w-24"
|
|
107
|
+
aria-label="Current page"
|
|
102
108
|
value={$pageIndex + 1}
|
|
103
109
|
max={pageCount}
|
|
104
110
|
min={1}
|
|
@@ -108,11 +114,13 @@
|
|
|
108
114
|
class="btn btn-sm variant-filled-primary"
|
|
109
115
|
id="{id}-next"
|
|
110
116
|
on:click|preventDefault={() => goTo('next')}
|
|
117
|
+
aria-label="Go to next page"
|
|
111
118
|
disabled={goToNextPageDisabled}><Fa icon={faAngleRight} /></button
|
|
112
119
|
>
|
|
113
120
|
<button
|
|
114
121
|
class="btn btn-sm variant-filled-primary"
|
|
115
122
|
id="{id}-last"
|
|
123
|
+
aria-label="Go to last page"
|
|
116
124
|
on:click|preventDefault={() => goTo('last')}
|
|
117
125
|
disabled={goToLastPageDisabled}><Fa icon={faAnglesRight} /></button
|
|
118
126
|
>
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
<InputContainer {id} label={title} {feedback} {required} {help}>
|
|
17
17
|
{#each source as item}
|
|
18
|
-
<label class="flex items-center space-x-2" for={key}>
|
|
18
|
+
<label class="flex items-center space-x-2" for={item.key}>
|
|
19
19
|
<input
|
|
20
20
|
class="checkbox"
|
|
21
21
|
type="checkbox"
|
|
22
22
|
bind:group={target}
|
|
23
23
|
checked={item.key}
|
|
24
24
|
value={item.key}
|
|
25
|
+
id={item.key}
|
|
25
26
|
/>
|
|
26
27
|
<p>{item.value}</p>
|
|
27
28
|
</label>
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
<InputContainer label={title} {feedback} {required}>
|
|
15
15
|
{#each source as item}
|
|
16
|
-
<label class="flex items-center space-x-2" for={
|
|
17
|
-
<input class="checkbox" type="checkbox" bind:group={target} value={item} />
|
|
16
|
+
<label class="flex items-center space-x-2" for={item}>
|
|
17
|
+
<input class="checkbox" type="checkbox" bind:group={target} value={item} id={item}/>
|
|
18
18
|
<p>{item}</p>
|
|
19
19
|
</label>
|
|
20
20
|
{/each}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<InputContainer {id} {label} {feedback} {required} {help}>
|
|
16
16
|
<input
|
|
17
17
|
{id}
|
|
18
|
-
class="input variant-form-material"
|
|
18
|
+
class="input variant-form-material bg-zinc-50 dark:bg-zinc-700 placeholder:text-gray-400"
|
|
19
19
|
type="date"
|
|
20
20
|
class:input-success={valid}
|
|
21
21
|
class:input-error={invalid}
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<InputContainer {id} label={title} {feedback} {required} {help}>
|
|
40
40
|
<select
|
|
41
41
|
{id}
|
|
42
|
-
class="select variant-form-material"
|
|
42
|
+
class="select variant-form-material dark:bg-zinc-700 bg-zinc-50 placeholder:text-gray-400"
|
|
43
43
|
class:input-success={valid}
|
|
44
44
|
class:input-error={invalid}
|
|
45
45
|
bind:value={selected}
|
|
@@ -16,7 +16,13 @@
|
|
|
16
16
|
function onMouseOut() {}
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
|
-
<div
|
|
19
|
+
<div
|
|
20
|
+
id="{id}-container"
|
|
21
|
+
on:mouseover={onMouseOver}
|
|
22
|
+
on:focus={onMouseOver}
|
|
23
|
+
on:mouseout={onMouseOut}
|
|
24
|
+
on:blur={onMouseOut}
|
|
25
|
+
>
|
|
20
26
|
<label class="label">
|
|
21
27
|
<span
|
|
22
28
|
>{label}
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
import Select from 'svelte-select';
|
|
5
5
|
import { onMount } from 'svelte';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
7
|
export let source;
|
|
10
8
|
export let target;
|
|
11
9
|
export let id;
|
|
@@ -35,16 +33,14 @@
|
|
|
35
33
|
$: groupBy;
|
|
36
34
|
|
|
37
35
|
function updateTarget(selection) {
|
|
36
|
+
console.log('updateTarget', target, selection, isMulti);
|
|
37
|
+
if (selection == undefined) {
|
|
38
|
+
console.log('no update');
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
if(selection == undefined)
|
|
41
|
-
{
|
|
42
|
-
console.log("no update");
|
|
43
|
-
|
|
44
|
-
return;
|
|
40
|
+
return;
|
|
45
41
|
}
|
|
46
42
|
|
|
47
|
-
console.log(
|
|
43
|
+
console.log('update');
|
|
48
44
|
//different cases
|
|
49
45
|
//a) source is complex model is simple return array
|
|
50
46
|
if (complexSource && !complexTarget && isLoaded && isMulti) {
|
|
@@ -75,8 +71,8 @@
|
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
if (!complexSource && !complexTarget && isLoaded && !isMulti) {
|
|
78
|
-
console.log(
|
|
79
|
-
if(selection){
|
|
74
|
+
console.log('🚀 ~ updateTarget ~ selection:', selection);
|
|
75
|
+
if (selection) {
|
|
80
76
|
target = selection.value;
|
|
81
77
|
}
|
|
82
78
|
}
|
|
@@ -167,118 +163,116 @@
|
|
|
167
163
|
//console.log(t,value)
|
|
168
164
|
}
|
|
169
165
|
|
|
170
|
-
function filterItemStartFn(label, filterText, option) {
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
function filterItemStartFn(label, filterText, option) {
|
|
167
|
+
// console.log(label, filterText, option);
|
|
168
|
+
let itemFilter = label.toLowerCase().startsWith(filterText.toLowerCase());
|
|
173
169
|
|
|
174
|
-
|
|
175
|
-
}
|
|
170
|
+
return itemFilter;
|
|
171
|
+
}
|
|
176
172
|
|
|
177
|
-
function filterItemExactFn(label, filterText, option) {
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
function filterItemExactFn(label, filterText, option) {
|
|
174
|
+
// console.log(label, filterText, option);
|
|
175
|
+
let itemFilter = label.toLowerCase() == filterText.toLowerCase();
|
|
180
176
|
|
|
181
|
-
|
|
182
|
-
}
|
|
177
|
+
return itemFilter;
|
|
178
|
+
}
|
|
183
179
|
|
|
184
|
-
function filterItemIncludesFn(label, filterText, option) {
|
|
185
|
-
|
|
186
|
-
|
|
180
|
+
function filterItemIncludesFn(label, filterText, option) {
|
|
181
|
+
// console.log(label, filterText, option);
|
|
182
|
+
let itemFilter = label.toLowerCase().includes(filterText.toLowerCase());
|
|
187
183
|
|
|
188
|
-
|
|
189
|
-
}
|
|
184
|
+
return itemFilter;
|
|
185
|
+
}
|
|
190
186
|
|
|
191
|
-
function filterFn({
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}) {
|
|
205
|
-
|
|
206
|
-
|
|
187
|
+
function filterFn({
|
|
188
|
+
loadOptions,
|
|
189
|
+
filterText,
|
|
190
|
+
items,
|
|
191
|
+
multiple,
|
|
192
|
+
value,
|
|
193
|
+
itemId,
|
|
194
|
+
groupBy,
|
|
195
|
+
filterSelectedItems,
|
|
196
|
+
itemFilter,
|
|
197
|
+
convertStringItemsToObjects,
|
|
198
|
+
filterGroupedItems,
|
|
199
|
+
label
|
|
200
|
+
}) {
|
|
201
|
+
if (items && loadOptions) return items;
|
|
202
|
+
if (!items) return [];
|
|
203
|
+
|
|
204
|
+
if (items && items.length > 0 && typeof items[0] !== 'object') {
|
|
205
|
+
items = convertStringItemsToObjects(items);
|
|
206
|
+
}
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
let filterResults = filterListFn(
|
|
209
|
+
items,
|
|
210
|
+
label,
|
|
211
|
+
filterText,
|
|
212
|
+
multiple,
|
|
213
|
+
value,
|
|
214
|
+
filterSelectedItems,
|
|
215
|
+
itemId
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
if (groupBy) {
|
|
219
|
+
filterResults = filterGroupedItems(filterResults, label, filterText);
|
|
220
|
+
}
|
|
211
221
|
|
|
212
|
-
|
|
222
|
+
return filterResults;
|
|
223
|
+
}
|
|
213
224
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
225
|
+
// filter checks 3 types, exact, starts, includes
|
|
226
|
+
function filterListFn(items, label, filterText, multiple, value, filterSelectedItems, itemId) {
|
|
227
|
+
if (!items) return [];
|
|
217
228
|
|
|
218
|
-
|
|
219
|
-
|
|
229
|
+
let exact = items.filter((item) => {
|
|
230
|
+
let matchesFilter = filterItemExactFn(item[label], filterText, item);
|
|
231
|
+
if (matchesFilter && multiple && value?.length) {
|
|
232
|
+
matchesFilter = !value.some((x) => {
|
|
233
|
+
return filterSelectedItems ? x[itemId] === item[itemId] : false;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
220
236
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
{
|
|
237
|
+
return matchesFilter;
|
|
238
|
+
});
|
|
224
239
|
|
|
225
|
-
|
|
240
|
+
let starts = items.filter((item) => {
|
|
241
|
+
let matchesFilter = filterItemStartFn(item[label], filterText, item);
|
|
242
|
+
if (matchesFilter && multiple && value?.length) {
|
|
243
|
+
matchesFilter = !value.some((x) => {
|
|
244
|
+
return filterSelectedItems ? x[itemId] === item[itemId] : false;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
226
247
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (matchesFilter && multiple && value?.length) {
|
|
230
|
-
matchesFilter = !value.some((x) => {
|
|
231
|
-
return filterSelectedItems ? x[itemId] === item[itemId] : false;
|
|
232
|
-
});
|
|
233
|
-
}
|
|
248
|
+
return matchesFilter;
|
|
249
|
+
});
|
|
234
250
|
|
|
235
|
-
|
|
236
|
-
|
|
251
|
+
let includes = items.filter((item) => {
|
|
252
|
+
let matchesFilter = filterItemIncludesFn(item[label], filterText, item);
|
|
253
|
+
if (matchesFilter && multiple && value?.length) {
|
|
254
|
+
matchesFilter = !value.some((x) => {
|
|
255
|
+
return filterSelectedItems ? x[itemId] === item[itemId] : false;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
237
258
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (matchesFilter && multiple && value?.length) {
|
|
241
|
-
matchesFilter = !value.some((x) => {
|
|
242
|
-
return filterSelectedItems ? x[itemId] === item[itemId] : false;
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return matchesFilter;
|
|
247
|
-
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
let includes = items.filter((item) => {
|
|
251
|
-
let matchesFilter = filterItemIncludesFn(item[label], filterText, item);
|
|
252
|
-
if (matchesFilter && multiple && value?.length) {
|
|
253
|
-
matchesFilter = !value.some((x) => {
|
|
254
|
-
return filterSelectedItems ? x[itemId] === item[itemId] : false;
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
return matchesFilter;
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
let result = [...exact,...starts,...includes];
|
|
263
|
-
return [...new Set(result)];
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
function clearFn(e)
|
|
267
|
-
{
|
|
268
|
-
console.log("clear", target, e);
|
|
269
|
-
if(isMulti)
|
|
270
|
-
{
|
|
271
|
-
target = [];
|
|
272
|
-
}
|
|
273
|
-
else
|
|
274
|
-
{
|
|
275
|
-
target="";
|
|
276
|
-
}
|
|
259
|
+
return matchesFilter;
|
|
260
|
+
});
|
|
277
261
|
|
|
278
|
-
|
|
279
|
-
|
|
262
|
+
let result = [...exact, ...starts, ...includes];
|
|
263
|
+
return [...new Set(result)];
|
|
264
|
+
}
|
|
280
265
|
|
|
266
|
+
function clearFn(e) {
|
|
267
|
+
console.log('clear', target, e);
|
|
268
|
+
if (isMulti) {
|
|
269
|
+
target = [];
|
|
270
|
+
} else {
|
|
271
|
+
target = '';
|
|
272
|
+
}
|
|
281
273
|
|
|
274
|
+
console.log('after clear', target);
|
|
275
|
+
}
|
|
282
276
|
</script>
|
|
283
277
|
|
|
284
278
|
<InputContainer {id} label={title} {feedback} {required} {help}>
|
|
@@ -295,7 +289,7 @@ function clearFn(e)
|
|
|
295
289
|
{loading}
|
|
296
290
|
{clearable}
|
|
297
291
|
{disabled}
|
|
298
|
-
|
|
292
|
+
filter={filterFn}
|
|
299
293
|
on:change
|
|
300
294
|
on:input
|
|
301
295
|
on:focus
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<InputContainer {id} {label} {feedback} {required} {help}>
|
|
19
19
|
<input
|
|
20
20
|
{id}
|
|
21
|
-
class="input variant-form-material"
|
|
21
|
+
class="input variant-form-material dark:bg-zinc-700 bg-zinc-50 placeholder:text-gray-400"
|
|
22
22
|
type="number"
|
|
23
23
|
class:input-success={valid}
|
|
24
24
|
class:input-error={invalid}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<InputContainer {id} {label} {feedback} {required} {help}>
|
|
18
18
|
<textarea
|
|
19
19
|
{id}
|
|
20
|
-
class="textarea variant-form-material"
|
|
20
|
+
class="textarea variant-form-material dark:bg-zinc-700 bg-zinc-50 placeholder:text-gray-400"
|
|
21
21
|
class:input-success={valid}
|
|
22
22
|
class:input-error={invalid}
|
|
23
23
|
bind:value
|