@lavalogic/scoria 0.17.0 → 0.17.2
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/dist/Components/Table/Body/QuickSearchCell.svelte +2 -2
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +0 -1
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +21 -26
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +10 -0
- package/dist/Components/Table/ColumnDefinitions/ExampleItemColumnDefRepository.svelte.js +3 -1
- package/dist/Components/Table/Misc/FilterInput.svelte +6 -6
- package/dist/Components/Table/Misc/FilterPanel.svelte +12 -3
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +6 -3
- package/dist/Components/Table/Types/Columns/DefsWrapper.d.ts +2 -2
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +1 -1
- package/dist/Components/Table/Types/DataRepository/IRemoteDataRepository.d.ts +1 -1
- package/dist/Components/Table/Types/Focus/TableFocusDetails.svelte.js +1 -0
- package/dist/Helpers/Helpers.svelte.js +2 -2
- package/package.json +1 -1
|
@@ -291,8 +291,8 @@
|
|
|
291
291
|
{#if isSearchable}
|
|
292
292
|
<div class="input-wrapper-parent">
|
|
293
293
|
{#if isDate}
|
|
294
|
-
{@const dateValues =
|
|
295
|
-
|
|
294
|
+
{@const dateValues = tableContext.paginationRepo?.filtering.find((it) => it.id === def.id)
|
|
295
|
+
?.value ?? [null, null]}
|
|
296
296
|
{#if isDateTuple(dateValues)}
|
|
297
297
|
{@const [fromDate, toDate] = dateValues}
|
|
298
298
|
<div class="spaced-around">
|
|
@@ -72,7 +72,6 @@
|
|
|
72
72
|
tableContext.focusEnd?.column === focusDetails.coordinates.column &&
|
|
73
73
|
tableContext.focusStart.row === focusDetails.coordinates.row &&
|
|
74
74
|
tableContext.focusEnd.row === focusDetails.coordinates.row &&
|
|
75
|
-
tableContext.isMousingDown &&
|
|
76
75
|
tableContext.focusStartIsBeingEdited
|
|
77
76
|
);
|
|
78
77
|
|
|
@@ -82,19 +82,17 @@
|
|
|
82
82
|
if (editable) {
|
|
83
83
|
tick()
|
|
84
84
|
.then(() => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
});
|
|
85
|
+
if (typeof value == 'object' && value instanceof Promise) {
|
|
86
|
+
value
|
|
87
|
+
.then((v: unknown) => {
|
|
88
|
+
tempTextValue = v?.toString() ?? '';
|
|
89
|
+
isBeingEdited = true;
|
|
90
|
+
})
|
|
91
|
+
.catch(devCatch);
|
|
92
|
+
} else {
|
|
93
|
+
tempTextValue = value?.toString() ?? '';
|
|
94
|
+
isBeingEdited = true;
|
|
95
|
+
}
|
|
98
96
|
})
|
|
99
97
|
.catch(devCatch);
|
|
100
98
|
} else {
|
|
@@ -106,17 +104,15 @@
|
|
|
106
104
|
})
|
|
107
105
|
.catch(devCatch);
|
|
108
106
|
}
|
|
109
|
-
} else {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
});
|
|
119
|
-
}
|
|
107
|
+
} else if (isBeingEdited) {
|
|
108
|
+
untrack(() => {
|
|
109
|
+
isBeingEdited = false;
|
|
110
|
+
tick()
|
|
111
|
+
.then(() => {
|
|
112
|
+
onBlur();
|
|
113
|
+
})
|
|
114
|
+
.catch(devCatch);
|
|
115
|
+
});
|
|
120
116
|
}
|
|
121
117
|
});
|
|
122
118
|
|
|
@@ -257,7 +253,6 @@
|
|
|
257
253
|
if (!selectAll) {
|
|
258
254
|
overrideEdit = true;
|
|
259
255
|
|
|
260
|
-
tableContext.isMousingDown = false;
|
|
261
256
|
tick()
|
|
262
257
|
.then(() => {
|
|
263
258
|
inputRef?.focus();
|
|
@@ -301,7 +296,7 @@
|
|
|
301
296
|
if (tdref != prevTdRef) {
|
|
302
297
|
untrack(() => {
|
|
303
298
|
prevTdRef = tdref;
|
|
304
|
-
|
|
299
|
+
tdref?.addEventListener('edit', onEdit);
|
|
305
300
|
unsubscriber = () => {
|
|
306
301
|
prevTdRef?.removeEventListener('edit', onEdit);
|
|
307
302
|
};
|
|
@@ -74,6 +74,12 @@
|
|
|
74
74
|
|
|
75
75
|
let validity = $derived(focusDetails.validityTuple);
|
|
76
76
|
|
|
77
|
+
$effect(() => {
|
|
78
|
+
if (ColumnDef.debug) {
|
|
79
|
+
$inspect(validity);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
77
83
|
$effect(() => {
|
|
78
84
|
void validity;
|
|
79
85
|
untrack(() => {
|
|
@@ -81,6 +87,10 @@
|
|
|
81
87
|
await tick();
|
|
82
88
|
const [validityValue] = await validity;
|
|
83
89
|
|
|
90
|
+
if (ColumnDef.debug) {
|
|
91
|
+
console.log('validity: ', $state.snapshot(validityValue));
|
|
92
|
+
}
|
|
93
|
+
|
|
84
94
|
if (validityValue === Validity.Invalid) {
|
|
85
95
|
return tableContext.addInvalidValue(cell.row.original);
|
|
86
96
|
} else {
|
|
@@ -60,7 +60,7 @@ export function generateExampleItemColumnDefs(modal) {
|
|
|
60
60
|
await asyncSleep(10);
|
|
61
61
|
return item.id;
|
|
62
62
|
},
|
|
63
|
-
debug: true,
|
|
63
|
+
// debug: true,
|
|
64
64
|
}),
|
|
65
65
|
new QueryDef({
|
|
66
66
|
header: 'simulated query def',
|
|
@@ -122,6 +122,8 @@ export function generateExampleItemColumnDefs(modal) {
|
|
|
122
122
|
}
|
|
123
123
|
return true;
|
|
124
124
|
},
|
|
125
|
+
debug: true,
|
|
126
|
+
// filterValueType: 'Date',
|
|
125
127
|
// defaultHidden: true
|
|
126
128
|
}),
|
|
127
129
|
new DateInputDef({
|
|
@@ -400,36 +400,36 @@
|
|
|
400
400
|
<div class="inner-row">
|
|
401
401
|
<label>
|
|
402
402
|
<input
|
|
403
|
-
value={
|
|
403
|
+
value={false}
|
|
404
404
|
type="radio"
|
|
405
405
|
bind:group={value}
|
|
406
406
|
onchange={() => {
|
|
407
407
|
tableContext.paginationRepo?.filterBy(def.id, value);
|
|
408
408
|
}}
|
|
409
409
|
/>
|
|
410
|
-
|
|
410
|
+
No
|
|
411
411
|
</label>
|
|
412
412
|
<label>
|
|
413
413
|
<input
|
|
414
|
-
value={
|
|
414
|
+
value={undefined}
|
|
415
415
|
type="radio"
|
|
416
416
|
bind:group={value}
|
|
417
417
|
onchange={() => {
|
|
418
418
|
tableContext.paginationRepo?.filterBy(def.id, value);
|
|
419
419
|
}}
|
|
420
420
|
/>
|
|
421
|
-
|
|
421
|
+
Any
|
|
422
422
|
</label>
|
|
423
423
|
<label>
|
|
424
424
|
<input
|
|
425
|
-
value={
|
|
425
|
+
value={true}
|
|
426
426
|
type="radio"
|
|
427
427
|
bind:group={value}
|
|
428
428
|
onchange={() => {
|
|
429
429
|
tableContext.paginationRepo?.filterBy(def.id, value);
|
|
430
430
|
}}
|
|
431
431
|
/>
|
|
432
|
-
|
|
432
|
+
Yes
|
|
433
433
|
</label>
|
|
434
434
|
</div>
|
|
435
435
|
{:else if isNumeric}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<svelte:options runes />
|
|
2
2
|
|
|
3
|
-
<script
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="T extends object"
|
|
6
|
+
>
|
|
4
7
|
import Button from '../../Button.svelte';
|
|
5
8
|
import { Size } from '../../../Types/Internal/Size.js';
|
|
6
9
|
import { Variant } from '../../../Types/Internal/Variant.js';
|
|
7
10
|
import { getContext } from 'svelte';
|
|
11
|
+
import type { ColumnDef } from '../Types/Columns/Definitions/ColumnDef.svelte.js';
|
|
8
12
|
import { TableContext } from '../Types/Context/TableContext.svelte.js';
|
|
9
13
|
import FilterInput from './FilterInput.svelte';
|
|
10
14
|
|
|
@@ -13,13 +17,18 @@
|
|
|
13
17
|
function reset() {
|
|
14
18
|
tableContext.paginationRepo?.resetFilters();
|
|
15
19
|
}
|
|
20
|
+
|
|
21
|
+
const defs = $derived(tableContext.columnDefs as Array<ColumnDef<T, unknown>>);
|
|
16
22
|
</script>
|
|
17
23
|
|
|
18
24
|
<div class="column-panel">
|
|
19
25
|
<h3>Filter by</h3>
|
|
20
26
|
|
|
21
|
-
{#each
|
|
22
|
-
<FilterInput
|
|
27
|
+
{#each defs as def (def.id)}
|
|
28
|
+
<FilterInput
|
|
29
|
+
{def}
|
|
30
|
+
customFilters={tableContext.remoteFilters}
|
|
31
|
+
/>
|
|
23
32
|
{/each}
|
|
24
33
|
|
|
25
34
|
<div class="reset-button">
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { Size } from '../../../Types/Internal/Size.js';
|
|
10
10
|
import { Variant } from '../../../Types/Internal/Variant.js';
|
|
11
11
|
import { getContext } from 'svelte';
|
|
12
|
+
import type { ColumnDef } from '../Types/Columns/Definitions/ColumnDef.svelte.js';
|
|
12
13
|
import { TableContext } from '../Types/Context/TableContext.svelte.js';
|
|
13
14
|
import FilterInput from './FilterInput.svelte';
|
|
14
15
|
|
|
@@ -24,11 +25,13 @@
|
|
|
24
25
|
const tableContext = getContext<TableContext<T, never>>(TableContext.identifier);
|
|
25
26
|
|
|
26
27
|
const { onclose }: FilterPanelModalProps = $props();
|
|
27
|
-
const refs: Array<FilterInput<T, never, unknown>> = $state([]);
|
|
28
|
+
// const refs: Array<FilterInput<T, never, unknown>> = $state([]);
|
|
28
29
|
|
|
29
30
|
function reset() {
|
|
30
31
|
tableContext.paginationRepo?.resetFilters();
|
|
31
32
|
}
|
|
33
|
+
|
|
34
|
+
const defs = $derived(tableContext.columnDefs as Array<ColumnDef<T, unknown>>);
|
|
32
35
|
</script>
|
|
33
36
|
|
|
34
37
|
<TouchModal
|
|
@@ -39,9 +42,9 @@
|
|
|
39
42
|
>
|
|
40
43
|
<div class="flex">
|
|
41
44
|
<div class="column-panel">
|
|
42
|
-
{#each
|
|
45
|
+
{#each defs as def (def.id)}
|
|
46
|
+
<!-- bind:this={refs[index]} -->
|
|
43
47
|
<FilterInput
|
|
44
|
-
bind:this={refs[index]}
|
|
45
48
|
{def}
|
|
46
49
|
customFilters={tableContext.remoteFilters}
|
|
47
50
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CustomRemoteFilters } from '../Filtering/CustomRemoteFilters.js';
|
|
2
2
|
import type { ColumnDef } from './Definitions/ColumnDef.svelte.js';
|
|
3
3
|
export interface DefsWrapper<T extends object> {
|
|
4
|
-
defs: Array<ColumnDef<T
|
|
5
|
-
remoteFilters?: CustomRemoteFilters<
|
|
4
|
+
defs: Array<ColumnDef<T>>;
|
|
5
|
+
remoteFilters?: CustomRemoteFilters<unknown>;
|
|
6
6
|
}
|
|
@@ -48,7 +48,7 @@ export declare class TableContext<T extends object, RowIdType extends Primitive>
|
|
|
48
48
|
get dataRepo(): IDataRepository<T>;
|
|
49
49
|
private set dataRepo(value);
|
|
50
50
|
private _remoteFilters;
|
|
51
|
-
get remoteFilters(): CustomRemoteFilters<
|
|
51
|
+
get remoteFilters(): CustomRemoteFilters<unknown> | undefined;
|
|
52
52
|
private set remoteFilters(value);
|
|
53
53
|
private _showSelectedOnly;
|
|
54
54
|
get showSelectedOnly(): boolean;
|
|
@@ -8,7 +8,7 @@ export interface IRemoteDataRepository<T extends object> extends IDataRepository
|
|
|
8
8
|
setPage: (page: number) => void;
|
|
9
9
|
nextPage: () => void;
|
|
10
10
|
prevPage: () => void;
|
|
11
|
-
filtering: ColumnFiltersState
|
|
11
|
+
filtering: ColumnFiltersState;
|
|
12
12
|
filterModes: SvelteMap<string, FilterMode>;
|
|
13
13
|
setFilterMode: (id: string, mode: FilterMode) => void;
|
|
14
14
|
filterBy: (id: string, value: unknown) => void;
|
|
@@ -119,6 +119,7 @@ export class TableFocusDetails {
|
|
|
119
119
|
});
|
|
120
120
|
async __validityTuple(isValid, original) {
|
|
121
121
|
try {
|
|
122
|
+
void original;
|
|
122
123
|
const result = (await isValid?.(original, await this.tableContext.selectionContains(original))) ??
|
|
123
124
|
Validity.Valid;
|
|
124
125
|
if (isWrapper(result)) {
|
|
@@ -259,13 +259,13 @@ export function hasQuery(customFilter) {
|
|
|
259
259
|
}
|
|
260
260
|
export function isDateTuple(value) {
|
|
261
261
|
return (Array.isArray(value) &&
|
|
262
|
-
value.length
|
|
262
|
+
value.length < 3 &&
|
|
263
263
|
(value[0] === null || (typeof value[0] == 'object' && value[0] instanceof Date)) &&
|
|
264
264
|
(value[1] === null || (typeof value[1] == 'object' && value[1] instanceof Date)));
|
|
265
265
|
}
|
|
266
266
|
export function isNumberTuple(value) {
|
|
267
267
|
return (Array.isArray(value) &&
|
|
268
|
-
value.length
|
|
268
|
+
value.length < 3 &&
|
|
269
269
|
(value[0] === null || typeof value[0] == 'number') &&
|
|
270
270
|
(value[1] === null || typeof value[1] == 'number'));
|
|
271
271
|
}
|