@lavalogic/scoria 0.3.1 → 0.3.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/Types/Columns/Definitions/Accessors/QueryDef.svelte.d.ts +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/QueryDef.svelte.js +3 -2
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +4 -0
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js +8 -0
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +4 -2
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ export declare class QueryDef<T extends object> extends AccessorDef<T, SelectFil
|
|
|
14
14
|
constructor(props: QueryDefProps<T>);
|
|
15
15
|
readonly filterFn: CustomFilterFn | FilterFn<T, SelectFilterValueType<T>> | undefined;
|
|
16
16
|
readonly valueAsObject: boolean;
|
|
17
|
-
|
|
17
|
+
get getDisplayValue(): (item: T, index: number) => string | null | Promise<string | null>;
|
|
18
18
|
readonly query: (queryString: string, item: T, index: number) => Promise<Array<SelectOption<unknown>>>;
|
|
19
19
|
readonly clearable: boolean;
|
|
20
20
|
}
|
|
@@ -6,12 +6,13 @@ export class QueryDef extends AccessorDef {
|
|
|
6
6
|
super(props);
|
|
7
7
|
this.valueAsObject = $derived(props.valueAsObject);
|
|
8
8
|
this.query = $derived(props.query);
|
|
9
|
-
this.getDisplayValue = $derived(props.getDisplayValue);
|
|
10
9
|
this.clearable = $derived(props.clearable ?? true);
|
|
11
10
|
}
|
|
12
11
|
filterFn;
|
|
13
12
|
valueAsObject;
|
|
14
|
-
getDisplayValue
|
|
13
|
+
get getDisplayValue() {
|
|
14
|
+
return this._getDisplayValue;
|
|
15
|
+
}
|
|
15
16
|
query;
|
|
16
17
|
clearable;
|
|
17
18
|
}
|
|
@@ -21,6 +21,7 @@ export interface ColumnDefProps<T extends object, FilterFnType = undefined> {
|
|
|
21
21
|
filterFn?: FilterFn<T, FilterFnType> | CustomFilterFn;
|
|
22
22
|
filterValueType?: FilterValueType;
|
|
23
23
|
accessorFn?: AccessorFn<T>;
|
|
24
|
+
getDisplayValue?: (item: T, index: number) => string | null | Promise<string | null>;
|
|
24
25
|
}
|
|
25
26
|
export declare abstract class ColumnDef<T extends object, FilterFnType = undefined> {
|
|
26
27
|
protected constructor(props: ColumnDefProps<T, FilterFnType>);
|
|
@@ -50,6 +51,9 @@ export declare abstract class ColumnDef<T extends object, FilterFnType = undefin
|
|
|
50
51
|
private _filterValueType;
|
|
51
52
|
get filterValueType(): FilterValueType | undefined;
|
|
52
53
|
set filterValueType(v: FilterValueType | undefined);
|
|
54
|
+
protected _getDisplayValue: ((item: T, index: number) => string | null | Promise<string | null>) | undefined;
|
|
55
|
+
get getDisplayValue(): ((item: T, index: number) => string | null | Promise<string | null>) | undefined;
|
|
56
|
+
set getDisplayValue(v: ((item: T, index: number) => string | null | Promise<string | null>) | undefined);
|
|
53
57
|
toJSON(): object;
|
|
54
58
|
readonly editable: boolean;
|
|
55
59
|
readonly resizable: boolean;
|
|
@@ -14,6 +14,7 @@ export class ColumnDef {
|
|
|
14
14
|
this.resizable = $derived(props.resizable ?? true);
|
|
15
15
|
this.header = $derived(props.header);
|
|
16
16
|
this._filterValueType = $derived(props.filterValueType);
|
|
17
|
+
this.getDisplayValue = $derived(props.getDisplayValue);
|
|
17
18
|
}
|
|
18
19
|
id;
|
|
19
20
|
_index;
|
|
@@ -71,6 +72,13 @@ export class ColumnDef {
|
|
|
71
72
|
set filterValueType(v) {
|
|
72
73
|
this._filterValueType = v;
|
|
73
74
|
}
|
|
75
|
+
_getDisplayValue;
|
|
76
|
+
get getDisplayValue() {
|
|
77
|
+
return this._getDisplayValue;
|
|
78
|
+
}
|
|
79
|
+
set getDisplayValue(v) {
|
|
80
|
+
this._getDisplayValue = v;
|
|
81
|
+
}
|
|
74
82
|
toJSON() {
|
|
75
83
|
return { columnType: this.columnType, id: this.id, header: this.header };
|
|
76
84
|
}
|
|
@@ -1749,7 +1749,8 @@ export class TableContext {
|
|
|
1749
1749
|
targetRow.push(key !== undefined && this.selectedItems.has(key) ? 'true' : 'false');
|
|
1750
1750
|
continue;
|
|
1751
1751
|
}
|
|
1752
|
-
const x =
|
|
1752
|
+
const x = (await col.getDisplayValue?.(item, this.sortedData.lastIndexOf(item))) ||
|
|
1753
|
+
('accessorFn' in col && (await col.accessorFn?.(item, this.sortedData.indexOf(item))));
|
|
1753
1754
|
if (x && typeof x === 'string') {
|
|
1754
1755
|
targetRow.push(x);
|
|
1755
1756
|
continue;
|
|
@@ -1817,7 +1818,8 @@ export class TableContext {
|
|
|
1817
1818
|
targetRow.push(key !== undefined && this.selectedItems.has(key) ? 'true' : 'false');
|
|
1818
1819
|
continue;
|
|
1819
1820
|
}
|
|
1820
|
-
const x =
|
|
1821
|
+
const x = (await col.getDisplayValue?.(item, this.sortedData.lastIndexOf(item))) ||
|
|
1822
|
+
('accessorFn' in col && (await col.accessorFn?.(item, this.sortedData.indexOf(item))));
|
|
1821
1823
|
if (x && typeof x === 'string') {
|
|
1822
1824
|
targetRow.push(x);
|
|
1823
1825
|
continue;
|