@lavalogic/scoria 0.7.2 → 0.7.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.
|
@@ -11,6 +11,7 @@ import { DisplayDef } from '../Types/Columns/Definitions/Display/DisplayDef.svel
|
|
|
11
11
|
import { ProgressBarDef } from '../Types/Columns/Definitions/Display/ProgressBarDef.svelte.js';
|
|
12
12
|
import { ValidityDef } from '../Types/Columns/Definitions/Display/ValidityDef.svelte.js';
|
|
13
13
|
import { asyncSleep } from '../../../Helpers/Helpers.svelte.js';
|
|
14
|
+
import { QueryDef } from '../Types/Columns/Definitions/Accessors/QueryDef.svelte.js';
|
|
14
15
|
export class ExampleItemColumnDef {
|
|
15
16
|
static generateExampleItemColumnDefs(modal) {
|
|
16
17
|
let defs = $state([
|
|
@@ -39,6 +40,32 @@ export class ExampleItemColumnDef {
|
|
|
39
40
|
id: 'id',
|
|
40
41
|
filterValueType: 'Number'
|
|
41
42
|
}),
|
|
43
|
+
new QueryDef({
|
|
44
|
+
header: 'simulated query def',
|
|
45
|
+
valueAsObject: true,
|
|
46
|
+
getDisplayValue: async (item, index) => {
|
|
47
|
+
if (item.someDate) {
|
|
48
|
+
return item.someDate.getTime().toString();
|
|
49
|
+
}
|
|
50
|
+
return index.toString();
|
|
51
|
+
},
|
|
52
|
+
isEditable: () => true,
|
|
53
|
+
id: 'simulatedQuery',
|
|
54
|
+
query: async (v, item, index) => {
|
|
55
|
+
if (!v) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
asyncSleep(100);
|
|
59
|
+
return item.someDate
|
|
60
|
+
? new Array(5).fill(0).map((it, index) => {
|
|
61
|
+
return {
|
|
62
|
+
label: (it + index).toString(),
|
|
63
|
+
value: (it + index).toString()
|
|
64
|
+
};
|
|
65
|
+
})
|
|
66
|
+
: [];
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
42
69
|
new TextInputDef({
|
|
43
70
|
header: 'Name',
|
|
44
71
|
id: 'name',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SQLDate } from '../Internal/Misc.js';
|
|
2
|
+
import type { SelectOption } from '../Internal/SelectOption.js';
|
|
2
3
|
import type { ExampleSelectEnum } from './ExampleSelectEnum.js';
|
|
3
4
|
export interface ExampleItem {
|
|
4
5
|
id: number;
|
|
@@ -12,4 +13,5 @@ export interface ExampleItem {
|
|
|
12
13
|
floDateWithTime: SQLDate | null;
|
|
13
14
|
someSelect: ExampleSelectEnum | null;
|
|
14
15
|
someBubbles: string[];
|
|
16
|
+
simulatedQuery: SelectOption<string> | null;
|
|
15
17
|
}
|