@lavalogic/scoria 0.8.2 → 0.8.3
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 +9 -2
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.d.ts +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.js +3 -4
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +3 -0
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js +2 -0
- package/package.json +1 -1
|
@@ -45,7 +45,9 @@
|
|
|
45
45
|
const customFilter = $derived(customFilters?.get(def.id));
|
|
46
46
|
|
|
47
47
|
const isSelect = $derived(
|
|
48
|
-
def instanceof SelectDef ||
|
|
48
|
+
def instanceof SelectDef ||
|
|
49
|
+
def.filterValueType == CustomFilterType.Select ||
|
|
50
|
+
customFilter?.type === CustomFilterType.Select
|
|
49
51
|
);
|
|
50
52
|
|
|
51
53
|
const hasFilterFn = $derived(!!def.filterFn && typeof def.filterFn === 'function');
|
|
@@ -65,8 +67,13 @@
|
|
|
65
67
|
def.filterValueType == 'Number' ||
|
|
66
68
|
customFilter?.type === CustomFilterType.Number
|
|
67
69
|
);
|
|
70
|
+
|
|
71
|
+
function emptyOptsAndWarn(): Array<never> {
|
|
72
|
+
console.warn(`def ${def.id} is declared as a select filter but has no getOptions() function`);
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
68
75
|
const options = $derived(
|
|
69
|
-
isSelect ? (
|
|
76
|
+
isSelect ? (def?.getOptions?.() ?? customFilter?.options ?? emptyOptsAndWarn()) : []
|
|
70
77
|
);
|
|
71
78
|
const isDate = $derived(def instanceof DateInputDef);
|
|
72
79
|
const isRemoteSelect = $derived(customFilter?.type === CustomFilterType.Select);
|
|
@@ -21,5 +21,5 @@ export declare class SelectDef<T extends object> extends AccessorDef<T, SelectFi
|
|
|
21
21
|
readonly optional: boolean;
|
|
22
22
|
readonly clearable: boolean;
|
|
23
23
|
readonly getSpecificOptions?: (item: T, index: number) => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
24
|
-
|
|
24
|
+
getOptions: () => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
25
25
|
}
|
|
@@ -3,12 +3,12 @@ import { AccessorType } from './AccessorType.js';
|
|
|
3
3
|
export class SelectDef extends AccessorDef {
|
|
4
4
|
constructor(props) {
|
|
5
5
|
super(props);
|
|
6
|
-
this.getSpecificOptions = $derived(props.getSpecificOptions);
|
|
7
|
-
this.getOptions = $derived(props.getOptions);
|
|
6
|
+
this.getSpecificOptions = $derived(props.getSpecificOptions); //done in the base class now
|
|
7
|
+
// this.getOptions = $derived(props.getOptions); // done in the base class now
|
|
8
8
|
this.sortingFn = $derived(props.sortingFn);
|
|
9
9
|
this.optional = $derived(props.optional ?? false);
|
|
10
10
|
this.clearable = $derived(props.clearable ?? true);
|
|
11
|
-
this.getDisplayValue = $derived(props.getDisplayValue);
|
|
11
|
+
// this.getDisplayValue = $derived(props.getDisplayValue); //done in the base class now
|
|
12
12
|
this._filterFn = $state(props.filterFn);
|
|
13
13
|
}
|
|
14
14
|
accessorType = AccessorType.Select;
|
|
@@ -23,5 +23,4 @@ export class SelectDef extends AccessorDef {
|
|
|
23
23
|
optional;
|
|
24
24
|
clearable;
|
|
25
25
|
getSpecificOptions;
|
|
26
|
-
getOptions;
|
|
27
26
|
}
|
|
@@ -6,6 +6,7 @@ import { ColumnType } from '../ColumnType.js';
|
|
|
6
6
|
import type { AccessorFn } from './AccessorFn.js';
|
|
7
7
|
import type { ValidationFn } from './ValidationFn.js';
|
|
8
8
|
import type { FilterValueType } from '../../Filtering/FilterValueType.js';
|
|
9
|
+
import type { SelectOption } from '../../../../../Types/Internal/SelectOption.js';
|
|
9
10
|
export interface ColumnDefProps<T extends object, FilterFnType = undefined> {
|
|
10
11
|
id: string;
|
|
11
12
|
header: string | Snippet;
|
|
@@ -21,6 +22,7 @@ export interface ColumnDefProps<T extends object, FilterFnType = undefined> {
|
|
|
21
22
|
isValid?: ValidationFn<T>;
|
|
22
23
|
filterFn?: FilterFn<T, FilterFnType> | CustomFilterFn;
|
|
23
24
|
filterValueType?: FilterValueType;
|
|
25
|
+
getOptions?: () => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
24
26
|
accessorFn?: AccessorFn<T>;
|
|
25
27
|
getDisplayValue?: (item: T, index: number) => string | null | Promise<string | null>;
|
|
26
28
|
}
|
|
@@ -60,4 +62,5 @@ export declare abstract class ColumnDef<T extends object, FilterFnType = undefin
|
|
|
60
62
|
readonly isEditable: (item: T, index: number) => boolean | Promise<boolean>;
|
|
61
63
|
readonly resizable: boolean;
|
|
62
64
|
readonly header: string | Snippet;
|
|
65
|
+
readonly getOptions?: () => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
63
66
|
}
|
|
@@ -16,6 +16,7 @@ export class ColumnDef {
|
|
|
16
16
|
this._filterValueType = $derived(props.filterValueType);
|
|
17
17
|
this._getDisplayValue = $derived(props.getDisplayValue);
|
|
18
18
|
this.debug = $derived(props.debug ?? false);
|
|
19
|
+
this.getOptions = $derived(props.getOptions);
|
|
19
20
|
}
|
|
20
21
|
id;
|
|
21
22
|
debug;
|
|
@@ -87,4 +88,5 @@ export class ColumnDef {
|
|
|
87
88
|
isEditable;
|
|
88
89
|
resizable;
|
|
89
90
|
header;
|
|
91
|
+
getOptions;
|
|
90
92
|
}
|