@lavalogic/scoria 0.0.41 → 0.0.43
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/Rows/Columns/TableQuerySelect.svelte +1 -0
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.d.ts +2 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.js +2 -0
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.d.ts +4 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.js +2 -0
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +2 -1
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +5 -2
- package/dist/Components/Table/Types/Context/TableInitOptions.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ export interface QueryDefProps<T extends object> extends ColumnDefProps<T> {
|
|
|
6
6
|
valueAsObject: boolean;
|
|
7
7
|
query: (queryString: string, item: T, index: number) => Promise<Array<SelectOption<unknown>>>;
|
|
8
8
|
getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
9
|
+
clearable?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare class QueryDef<T extends object> extends AccessorDef<T, StringFilterValueType> {
|
|
11
12
|
readonly accessorType: "Query";
|
|
@@ -13,4 +14,5 @@ export declare class QueryDef<T extends object> extends AccessorDef<T, StringFil
|
|
|
13
14
|
readonly valueAsObject: boolean;
|
|
14
15
|
readonly getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
15
16
|
readonly query: (queryString: string, item: T, index: number) => Promise<Array<SelectOption<unknown>>>;
|
|
17
|
+
readonly clearable: boolean;
|
|
16
18
|
}
|
|
@@ -7,8 +7,10 @@ export class QueryDef extends AccessorDef {
|
|
|
7
7
|
this.valueAsObject = $derived(props.valueAsObject);
|
|
8
8
|
this.query = $derived(props.query);
|
|
9
9
|
this.getDisplayValue = $derived(props.getDisplayValue);
|
|
10
|
+
this.clearable = $derived(props.clearable ?? true);
|
|
10
11
|
}
|
|
11
12
|
valueAsObject;
|
|
12
13
|
getDisplayValue;
|
|
13
14
|
query;
|
|
15
|
+
clearable;
|
|
14
16
|
}
|
|
@@ -5,8 +5,9 @@ export interface SelectDefProps<T extends object> extends ColumnDefProps<T> {
|
|
|
5
5
|
getOptions: () => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
6
6
|
getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
7
7
|
sortingFn?: (a: T, b: T) => 1 | -1 | 0;
|
|
8
|
-
getSpecificOptions?: (item
|
|
8
|
+
getSpecificOptions?: (item: T, index: number) => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
9
9
|
optional?: boolean;
|
|
10
|
+
clearable?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare class SelectDef<T extends object> extends AccessorDef<T, T> {
|
|
12
13
|
constructor(props: SelectDefProps<T>);
|
|
@@ -14,6 +15,7 @@ export declare class SelectDef<T extends object> extends AccessorDef<T, T> {
|
|
|
14
15
|
readonly sortingFn?: (a: T, b: T) => 1 | -1 | 0;
|
|
15
16
|
readonly getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
16
17
|
readonly optional: boolean;
|
|
17
|
-
readonly
|
|
18
|
+
readonly clearable: boolean;
|
|
19
|
+
readonly getSpecificOptions?: (item: T, index: number) => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
18
20
|
readonly getOptions: () => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
19
21
|
}
|
|
@@ -7,12 +7,14 @@ export class SelectDef extends AccessorDef {
|
|
|
7
7
|
this.getOptions = $derived(props.getOptions);
|
|
8
8
|
this.sortingFn = $derived(props.sortingFn);
|
|
9
9
|
this.optional = $derived(props.optional ?? false);
|
|
10
|
+
this.clearable = $derived(props.clearable ?? true);
|
|
10
11
|
this.getDisplayValue = $derived(props.getDisplayValue);
|
|
11
12
|
}
|
|
12
13
|
accessorType = AccessorType.Select;
|
|
13
14
|
sortingFn;
|
|
14
15
|
getDisplayValue;
|
|
15
16
|
optional;
|
|
17
|
+
clearable;
|
|
16
18
|
getSpecificOptions;
|
|
17
19
|
getOptions;
|
|
18
20
|
}
|
|
@@ -25,6 +25,7 @@ export declare class TableContext<T extends object> {
|
|
|
25
25
|
enableResize: boolean;
|
|
26
26
|
allowColumnReordering: boolean;
|
|
27
27
|
allowQuickFiltering: boolean;
|
|
28
|
+
showQuickFilterByDefault: boolean;
|
|
28
29
|
allowAdvancedFiltering: boolean;
|
|
29
30
|
toolbarPosition: ToolbarPosition;
|
|
30
31
|
displayFooter: boolean;
|
|
@@ -33,7 +34,7 @@ export declare class TableContext<T extends object> {
|
|
|
33
34
|
private _onEditCell;
|
|
34
35
|
static readonly identifier: unique symbol;
|
|
35
36
|
static init<T extends object>(defaultColumnDefs: DefsWrapper<T>, tableName: string, dataRepo: IDataRepository<T>, options: TableInitOptions<T>): TableContext<T>;
|
|
36
|
-
protected constructor(INTERNAL_ONLY: symbol, defaultColumnDefs: DefsWrapper<T>, tableName: string, dataRepo: IDataRepository<T>, allowCopy: boolean, enableResize: boolean, allowColumnReordering: boolean, allowQuickFiltering: boolean, allowAdvancedFiltering: boolean, toolbarPosition: ToolbarPosition, displayFooter: boolean, selectionExtractor: TableInitOptions<T>['selectionExtractor'], getUserId: () => string | undefined, _onEditCell?: TableInitOptions<T>['onEditCell']);
|
|
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']);
|
|
37
38
|
private readonly userId;
|
|
38
39
|
private isSelectable;
|
|
39
40
|
__queryValues: SvelteMap<string, unknown>;
|
|
@@ -25,6 +25,7 @@ export class TableContext {
|
|
|
25
25
|
enableResize;
|
|
26
26
|
allowColumnReordering;
|
|
27
27
|
allowQuickFiltering;
|
|
28
|
+
showQuickFilterByDefault;
|
|
28
29
|
allowAdvancedFiltering;
|
|
29
30
|
toolbarPosition;
|
|
30
31
|
displayFooter;
|
|
@@ -33,11 +34,11 @@ export class TableContext {
|
|
|
33
34
|
_onEditCell;
|
|
34
35
|
static identifier = Symbol();
|
|
35
36
|
static init(defaultColumnDefs, tableName, dataRepo, options) {
|
|
36
|
-
const context = new this(InternalSymbol, defaultColumnDefs, tableName, dataRepo, options.allowCopy ?? true, options.enableResize ?? true, options.allowColumnReordering ?? true, options.allowQuickFiltering ?? true, options.allowAdvancedFiltering ?? true, options.toolbar ?? ToolbarPosition.Right, options.displayFooter ?? true, options.selectionExtractor, options.getUserId, options.onEditCell);
|
|
37
|
+
const context = new this(InternalSymbol, defaultColumnDefs, tableName, dataRepo, options.allowCopy ?? true, options.enableResize ?? true, options.allowColumnReordering ?? true, options.allowQuickFiltering ?? true, options.showQuickFilterByDefault ?? true, options.allowAdvancedFiltering ?? true, options.toolbar ?? ToolbarPosition.Right, options.displayFooter ?? true, options.selectionExtractor, options.getUserId, options.onEditCell);
|
|
37
38
|
return context;
|
|
38
39
|
}
|
|
39
40
|
// #region constructor
|
|
40
|
-
constructor(INTERNAL_ONLY, defaultColumnDefs, tableName, dataRepo, allowCopy, enableResize, allowColumnReordering, allowQuickFiltering, allowAdvancedFiltering, toolbarPosition, displayFooter, selectionExtractor, getUserId, _onEditCell = async () => {
|
|
41
|
+
constructor(INTERNAL_ONLY, defaultColumnDefs, tableName, dataRepo, allowCopy, enableResize, allowColumnReordering, allowQuickFiltering, showQuickFilterByDefault, allowAdvancedFiltering, toolbarPosition, displayFooter, selectionExtractor, getUserId, _onEditCell = async () => {
|
|
41
42
|
console.warn('Cannot edit immutable table');
|
|
42
43
|
}) {
|
|
43
44
|
this.defaultColumnDefs = defaultColumnDefs;
|
|
@@ -46,6 +47,7 @@ export class TableContext {
|
|
|
46
47
|
this.enableResize = enableResize;
|
|
47
48
|
this.allowColumnReordering = allowColumnReordering;
|
|
48
49
|
this.allowQuickFiltering = allowQuickFiltering;
|
|
50
|
+
this.showQuickFilterByDefault = showQuickFilterByDefault;
|
|
49
51
|
this.allowAdvancedFiltering = allowAdvancedFiltering;
|
|
50
52
|
this.toolbarPosition = toolbarPosition;
|
|
51
53
|
this.displayFooter = displayFooter;
|
|
@@ -91,6 +93,7 @@ export class TableContext {
|
|
|
91
93
|
};
|
|
92
94
|
this.setupDefaultColumnDefs()
|
|
93
95
|
.then((defs) => {
|
|
96
|
+
this.showQuickFiltering = this.showQuickFilterByDefault;
|
|
94
97
|
this.isSelectable = defs.some((it) => it.id.startsWith('is-selectable-'));
|
|
95
98
|
if (this.allowColumnReordering) {
|
|
96
99
|
const savedPresets = localStorage.getItem(`${this.userId}-${tableName}-presets`);
|
|
@@ -6,6 +6,7 @@ export interface TableInitOptions<T extends object> {
|
|
|
6
6
|
enableResize?: boolean;
|
|
7
7
|
allowColumnReordering?: boolean;
|
|
8
8
|
allowQuickFiltering?: boolean;
|
|
9
|
+
showQuickFilterByDefault?: boolean;
|
|
9
10
|
allowAdvancedFiltering?: boolean;
|
|
10
11
|
toolbar?: ToolbarPosition;
|
|
11
12
|
displayFooter?: boolean;
|