@lavalogic/scoria 0.5.0 → 0.5.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 +3 -3
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +2 -0
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +0 -1
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +6 -6
- package/dist/Components/Table/Misc/FilterInput.svelte +9 -3
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.d.ts +0 -1
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.js +0 -1
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +1 -2
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +2 -3
- package/dist/Components/Table/Types/DataRepository/IDataRepository.d.ts +1 -0
- package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.d.ts +1 -0
- package/dist/Components/Table/Types/DataRepository/TableDataRepository.svelte.js +1 -0
- package/package.json +1 -1
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
|
|
127
127
|
if (gotValue != undefined) {
|
|
128
128
|
const key = customFilter?.label ?? customFilter?.objectName ?? customFilter?.queryKey;
|
|
129
|
-
const x = key == null ? null : tableContext.__queryValues.get(key);
|
|
129
|
+
const x = key == null ? null : tableContext.dataRepo.__queryValues.get(key);
|
|
130
130
|
value = (x ?? null) as SelectOption<unknown> | null;
|
|
131
131
|
}
|
|
132
132
|
} catch (e) {
|
|
@@ -300,8 +300,8 @@
|
|
|
300
300
|
bind:options={lastQueryOptions}
|
|
301
301
|
onchange={(newValue) => {
|
|
302
302
|
tableContext.paginationRepo?.filterBy(def.id, newValue?.value ?? null);
|
|
303
|
-
tableContext.__queryValues.set(label, newValue);
|
|
304
|
-
value = newValue as SelectOption<
|
|
303
|
+
tableContext.dataRepo.__queryValues.set(label, newValue);
|
|
304
|
+
value = newValue as SelectOption<T> | null;
|
|
305
305
|
}}
|
|
306
306
|
/>
|
|
307
307
|
{:else}
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
|
|
29
29
|
let tdref = $state<HTMLTableCellElement | undefined>();
|
|
30
30
|
|
|
31
|
-
const selectValue = $derived(cell.getValue());
|
|
31
|
+
const selectValue = $derived(cell.getValue() as T |null|undefined);
|
|
32
32
|
|
|
33
33
|
const visibleValue = $derived(
|
|
34
|
-
cell.column.columnDef.getDisplayValue(cell.row.original, cell.row.originalIndex)
|
|
34
|
+
cell.column.columnDef.getDisplayValue!(cell.row.original, cell.row.originalIndex)
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
const optional = $derived((cell.column.columnDef as SelectDef<T>).optional ?? false);
|
|
@@ -86,10 +86,10 @@
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
const optionsPromise = $derived(
|
|
89
|
-
cell.column.columnDef.getSpecificOptions?.(
|
|
89
|
+
(cell.column.columnDef.getSpecificOptions?.(
|
|
90
90
|
cell.row.original,
|
|
91
91
|
focusDetails.coordinates.column
|
|
92
|
-
) ?? cell.column.columnDef.getOptions()
|
|
92
|
+
) ?? cell.column.columnDef.getOptions()) as SelectOption<T>[] | Promise<SelectOption<T>[]>
|
|
93
93
|
);
|
|
94
94
|
|
|
95
95
|
let previousValidity: Validity = $state(Validity.Valid);
|
|
@@ -205,13 +205,13 @@
|
|
|
205
205
|
name="Item"
|
|
206
206
|
valueProp="value"
|
|
207
207
|
labelProp="label"
|
|
208
|
-
value={selectValue}
|
|
208
|
+
value={selectValue ?? null}
|
|
209
209
|
{options}
|
|
210
210
|
width="100%"
|
|
211
211
|
clearable={cell.column.columnDef.clearable}
|
|
212
212
|
onfocus={addKeydownEvent}
|
|
213
213
|
valueAsObject={false}
|
|
214
|
-
onchange={(newValue: SelectOption<
|
|
214
|
+
onchange={(newValue: SelectOption<T> | null) => {
|
|
215
215
|
if (newValue?.value !== value) {
|
|
216
216
|
if (optional || newValue?.value != null) {
|
|
217
217
|
tableContext.onEditCell(
|
|
@@ -161,14 +161,20 @@
|
|
|
161
161
|
// as unknown as string | number | undefined;
|
|
162
162
|
|
|
163
163
|
if (filteringStateValue != undefined) {
|
|
164
|
-
|
|
164
|
+
console.log(`query values:`, tableContext.dataRepo.__queryValues);
|
|
165
|
+
const x = tableContext.dataRepo.__queryValues.get(
|
|
165
166
|
customFilter?.label ?? customFilter?.objectName ?? customFilter?.queryKey ?? _uuid
|
|
166
167
|
);
|
|
167
168
|
|
|
168
169
|
if (def.debug) {
|
|
169
|
-
console.log('value:', x);
|
|
170
|
+
console.log('value:', $state.snapshot(x));
|
|
170
171
|
}
|
|
171
172
|
value = (x ?? null) as SelectOption<unknown> | null;
|
|
173
|
+
} else if (def.debug) {
|
|
174
|
+
console.log(
|
|
175
|
+
'filtering state value was undefined',
|
|
176
|
+
$state.snapshot(tableContext.paginationRepo?.filtering)
|
|
177
|
+
);
|
|
172
178
|
}
|
|
173
179
|
} catch (e) {
|
|
174
180
|
console.warn(e);
|
|
@@ -386,7 +392,7 @@
|
|
|
386
392
|
bind:options={lastQueryOptions}
|
|
387
393
|
onchange={(newValue) => {
|
|
388
394
|
tableContext.paginationRepo?.filterBy(def.id, newValue?.value ?? null);
|
|
389
|
-
tableContext.__queryValues.set(label ?? _uuid, newValue);
|
|
395
|
+
tableContext.dataRepo.__queryValues.set(label ?? _uuid, newValue);
|
|
390
396
|
// FIXME <T> is lost when autoformatting. why?
|
|
391
397
|
value = newValue as SelectOption<T> | null;
|
|
392
398
|
}}
|
|
@@ -18,7 +18,6 @@ export declare class SelectDef<T extends object> extends AccessorDef<T, SelectFi
|
|
|
18
18
|
get filterFn(): FilterFn<T, SelectFilterValueType<T>> | CustomFilterFn | undefined;
|
|
19
19
|
set filterFn(v: FilterFn<T, SelectFilterValueType<T>> | CustomFilterFn | undefined);
|
|
20
20
|
readonly sortingFn?: (a: T, b: T) => 1 | -1 | 0;
|
|
21
|
-
readonly getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
22
21
|
readonly optional: boolean;
|
|
23
22
|
readonly clearable: boolean;
|
|
24
23
|
readonly getSpecificOptions?: (item: T, index: number) => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
@@ -37,7 +37,6 @@ export declare class TableContext<T extends object> {
|
|
|
37
37
|
protected constructor(INTERNAL_ONLY: symbol, defaultColumnDefs: DefsWrapper<T>, tableName: string, dataRepo: IDataRepository<T>, allowCopy: boolean, enableResize: boolean, allowColumnReordering: boolean, allowQuickFiltering: boolean, showQuickFilterByDefault: boolean, allowAdvancedFiltering: boolean, toolbarPosition: ToolbarPosition, displayFooter: boolean, selectionExtractor: TableInitOptions<T>['selectionExtractor'], getUserId: () => string | undefined, _onEditCell?: TableInitOptions<T>['onEditCell']);
|
|
38
38
|
private readonly userId;
|
|
39
39
|
private isSelectable;
|
|
40
|
-
__queryValues: SvelteMap<string, unknown>;
|
|
41
40
|
private _paginationRepo;
|
|
42
41
|
get paginationRepo(): IDataRepository<T> | undefined;
|
|
43
42
|
set paginationRepo(v: IDataRepository<T> | undefined);
|
|
@@ -45,7 +44,7 @@ export declare class TableContext<T extends object> {
|
|
|
45
44
|
get showQuickFiltering(): boolean;
|
|
46
45
|
set showQuickFiltering(v: boolean);
|
|
47
46
|
private _dataRepo;
|
|
48
|
-
get dataRepo(): IDataRepository<T
|
|
47
|
+
get dataRepo(): IDataRepository<T>;
|
|
49
48
|
private set dataRepo(value);
|
|
50
49
|
private _remoteFilters;
|
|
51
50
|
get remoteFilters(): CustomRemoteFilters | undefined;
|
|
@@ -64,7 +64,7 @@ export class TableContext {
|
|
|
64
64
|
if (INTERNAL_ONLY != InternalSymbol) {
|
|
65
65
|
throw new Error('This class may only be instantiated through the static init() method');
|
|
66
66
|
}
|
|
67
|
-
this.
|
|
67
|
+
this._dataRepo = $state(dataRepo);
|
|
68
68
|
// this.dataRepo.forceRefresh = this.forceVisibilityUpdate;
|
|
69
69
|
if (defaultColumnDefs.remoteFilters) {
|
|
70
70
|
this.remoteFilters = defaultColumnDefs.remoteFilters;
|
|
@@ -147,7 +147,6 @@ export class TableContext {
|
|
|
147
147
|
// #region stores
|
|
148
148
|
userId;
|
|
149
149
|
isSelectable = $state(false);
|
|
150
|
-
__queryValues = new SvelteMap();
|
|
151
150
|
_paginationRepo = $state();
|
|
152
151
|
get paginationRepo() {
|
|
153
152
|
return this._paginationRepo;
|
|
@@ -162,7 +161,7 @@ export class TableContext {
|
|
|
162
161
|
set showQuickFiltering(v) {
|
|
163
162
|
this._showQuickFiltering = this.allowQuickFiltering && v;
|
|
164
163
|
}
|
|
165
|
-
_dataRepo
|
|
164
|
+
_dataRepo;
|
|
166
165
|
get dataRepo() {
|
|
167
166
|
return this._dataRepo;
|
|
168
167
|
}
|
|
@@ -31,6 +31,7 @@ export interface IDataRepository<T extends object> {
|
|
|
31
31
|
pageStartIndex: number;
|
|
32
32
|
pageEndIndexExclusive: number;
|
|
33
33
|
previouslyViewedPage: number;
|
|
34
|
+
__queryValues: SvelteMap<string, unknown>;
|
|
34
35
|
readonly paginationType: PaginationType;
|
|
35
36
|
filterType: FilterType;
|
|
36
37
|
data: T[];
|
|
@@ -29,6 +29,7 @@ export declare abstract class TableDataRepository<T extends object> implements I
|
|
|
29
29
|
abstract pageStartIndex: number;
|
|
30
30
|
abstract pageEndIndexExclusive: number;
|
|
31
31
|
constructor(tableName: string, getUserId: () => string | undefined);
|
|
32
|
+
__queryValues: SvelteMap<string, unknown>;
|
|
32
33
|
private _paginationState;
|
|
33
34
|
get paginationState(): ReadonlyPaginationState;
|
|
34
35
|
set paginationState(v: ReadonlyPaginationState);
|