@lavalogic/scoria 0.0.38 → 0.0.39
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 +18 -10
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +29 -48
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte.d.ts +10 -2
- package/dist/Components/Table/ColumnDefinitions/ExampleItemColumnDef.svelte.js +1 -0
- package/dist/Components/Table/Misc/FilterInput.svelte +15 -14
- package/dist/Components/Table/Types/Columns/Column.d.ts +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.d.ts +7 -5
- package/dist/Components/Table/Types/Columns/Definitions/Accessors/SelectDef.svelte.js +5 -3
- package/dist/Components/Table/Types/Columns/Definitions/Actions/ActionsDef.svelte.js +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +4 -2
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js +5 -3
- package/dist/Components/Table/Types/Columns/Definitions/Display/ValidityDef.svelte.js +1 -1
- package/dist/Components/Table/Types/Columns/Definitions/RowSelection/RowSelectionDef.svelte.js +1 -1
- package/dist/Components/Table/Types/Columns/TableCell.d.ts +1 -1
- package/dist/Components/Table/Types/Context/TableContext.svelte.js +8 -8
- package/package.json +1 -1
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
);
|
|
72
72
|
const options = $derived(
|
|
73
73
|
isSelect
|
|
74
|
-
? ((def as SelectDef<T>)?.
|
|
75
|
-
(def as SelectDef<T>).
|
|
74
|
+
? ((def as SelectDef<T>)?.getOptions?.() ??
|
|
75
|
+
(def as SelectDef<T>).getSpecificOptions?.() ??
|
|
76
76
|
customFilter?.options ??
|
|
77
77
|
[])
|
|
78
78
|
: []
|
|
@@ -91,12 +91,12 @@
|
|
|
91
91
|
|
|
92
92
|
const isSelectOpen = $derived(openedSelect?.value === selectSymbol);
|
|
93
93
|
|
|
94
|
-
let value: SelectOption<
|
|
94
|
+
let value: SelectOption<unknown> | string | number | null | undefined = $state(null);
|
|
95
95
|
let valueMin: number | null = $state(null);
|
|
96
96
|
let valueMax: number | null = $state(null);
|
|
97
97
|
|
|
98
|
-
let selectedOptions: Array<SelectOption<
|
|
99
|
-
let lastQueryOptions: Array<SelectOption<
|
|
98
|
+
let selectedOptions: Array<SelectOption<unknown>> = $state([]);
|
|
99
|
+
let lastQueryOptions: Array<SelectOption<unknown>> = $state([]);
|
|
100
100
|
|
|
101
101
|
const inputId = $derived(`${tableContext.tableName}-cell-quicksearch-${column.id}`);
|
|
102
102
|
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
if (hasQuery) {
|
|
124
124
|
untrack(async () => {
|
|
125
125
|
const gotValue = filteringStateValue as unknown as
|
|
126
|
-
| Array<string | number | SelectOption<
|
|
126
|
+
| Array<string | number | SelectOption<unknown>>
|
|
127
127
|
| undefined;
|
|
128
128
|
|
|
129
129
|
try {
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
if (gotValue != undefined) {
|
|
133
133
|
const key = customFilter?.label ?? customFilter?.objectName ?? customFilter?.queryKey;
|
|
134
134
|
const x = key == null ? null : tableContext.__queryValues.get(key);
|
|
135
|
-
value = (x ?? null) as SelectOption<
|
|
135
|
+
value = (x ?? null) as SelectOption<unknown> | null;
|
|
136
136
|
}
|
|
137
137
|
} catch (e) {
|
|
138
138
|
console.warn(e);
|
|
@@ -145,12 +145,20 @@
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
const gotValue = filteringStateValue as unknown as
|
|
148
|
-
| Array<string | number | SelectOption<
|
|
148
|
+
| Array<string | number | SelectOption<unknown>>
|
|
149
149
|
| undefined;
|
|
150
150
|
|
|
151
151
|
untrack(async () => {
|
|
152
152
|
const x = (await options).filter((it) => {
|
|
153
|
-
|
|
153
|
+
if (it.value == undefined) {
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (typeof it.value == 'string' || typeof it.value == 'number') {
|
|
158
|
+
return (gotValue as unknown as Array<string | number> | undefined)?.includes(it.value);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return false;
|
|
154
162
|
});
|
|
155
163
|
selectedOptions = x;
|
|
156
164
|
});
|
|
@@ -296,7 +304,7 @@
|
|
|
296
304
|
onchange={(newValue) => {
|
|
297
305
|
tableContext.paginationRepo?.filterBy(def.id, newValue?.value ?? null);
|
|
298
306
|
tableContext.__queryValues.set(label, newValue);
|
|
299
|
-
value = newValue as SelectOption<
|
|
307
|
+
value = newValue as SelectOption<unknown> | null;
|
|
300
308
|
}}
|
|
301
309
|
/>
|
|
302
310
|
{:else}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
<svelte:options runes />
|
|
2
2
|
|
|
3
3
|
<script lang="ts" module>
|
|
4
|
-
export interface TableSelectProps<T extends object> {
|
|
5
|
-
cell: TableCell<T>;
|
|
6
|
-
}
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<script lang="ts" generics="T extends object">
|
|
10
4
|
import { dev } from '$app/environment';
|
|
11
5
|
import SingleSelect from '../../../../SingleSelect.svelte';
|
|
6
|
+
import type { Column } from '../../../Types/Columns/Column.js';
|
|
12
7
|
import type { SelectDef } from '../../../Types/Columns/Definitions/Accessors/SelectDef.svelte.js';
|
|
13
8
|
import type { TableCell } from '../../../Types/Columns/TableCell.js';
|
|
14
9
|
import { TableContext } from '../../../Types/Context/TableContext.svelte.js';
|
|
@@ -16,13 +11,29 @@
|
|
|
16
11
|
import { ToastContext } from '../../../../../Contexts/ToastContext.svelte.js';
|
|
17
12
|
import type { SelectOption } from '../../../../../Types/Internal/SelectOption.js';
|
|
18
13
|
import { Validity } from '../../../../../Types/Internal/Validity.js';
|
|
19
|
-
import { getContext, tick, untrack
|
|
14
|
+
import { getContext, tick, untrack } from 'svelte';
|
|
15
|
+
|
|
16
|
+
export interface SelectColumn<T extends object> extends Column<T> {
|
|
17
|
+
columnDef: SelectDef<T>;
|
|
18
|
+
}
|
|
19
|
+
export interface SelectTableCell<T extends object> extends TableCell<T> {
|
|
20
|
+
column: SelectColumn<T>;
|
|
21
|
+
}
|
|
22
|
+
export interface TableSelectProps<T extends object> {
|
|
23
|
+
cell: SelectTableCell<T>;
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
20
26
|
|
|
27
|
+
<script lang="ts" generics="T extends object">
|
|
21
28
|
const { cell }: TableSelectProps<T> = $props();
|
|
22
29
|
|
|
23
30
|
let tdref = $state<HTMLTableCellElement | undefined>();
|
|
24
31
|
|
|
25
|
-
const
|
|
32
|
+
const selectValue = $derived(cell.getValue());
|
|
33
|
+
|
|
34
|
+
const visibleValue = $derived(
|
|
35
|
+
cell.column.columnDef.getDisplayValue(cell.row.original, cell.row.originalIndex)
|
|
36
|
+
);
|
|
26
37
|
|
|
27
38
|
const optional = $derived((cell.column.columnDef as SelectDef<T>).optional ?? false);
|
|
28
39
|
|
|
@@ -76,42 +87,12 @@
|
|
|
76
87
|
});
|
|
77
88
|
|
|
78
89
|
const optionsPromise = $derived(
|
|
79
|
-
|
|
90
|
+
cell.column.columnDef.getSpecificOptions?.(
|
|
80
91
|
cell.row.original,
|
|
81
92
|
focusDetails.coordinates.column
|
|
82
|
-
)
|
|
93
|
+
) ?? cell.column.columnDef.getOptions()
|
|
83
94
|
);
|
|
84
95
|
|
|
85
|
-
const valuePromise = $derived(getValueFromOptions(optionsPromise, value));
|
|
86
|
-
|
|
87
|
-
async function getValueFromOptions(
|
|
88
|
-
optionsPromise: Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>,
|
|
89
|
-
value: unknown
|
|
90
|
-
): Promise<SelectOption<unknown> | null> {
|
|
91
|
-
void value;
|
|
92
|
-
void optionsPromise;
|
|
93
|
-
|
|
94
|
-
if (value == null) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
const options = await optionsPromise;
|
|
98
|
-
value = await value;
|
|
99
|
-
|
|
100
|
-
if (typeof value === typeof options[0]?.value) {
|
|
101
|
-
const foundOption = options.find((it) => it.value === value);
|
|
102
|
-
return foundOption ?? null;
|
|
103
|
-
} else if (typeof value === typeof options[0]?.label) {
|
|
104
|
-
const foundOption = options.find((it) => it.label === value);
|
|
105
|
-
return foundOption ?? null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (dev) {
|
|
109
|
-
console.warn('could not match value to any type:', value);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
96
|
let previousValidity: Validity = $state(Validity.Valid);
|
|
116
97
|
let validity: Validity = $state(Validity.Valid);
|
|
117
98
|
$effect(() => {
|
|
@@ -217,21 +198,21 @@
|
|
|
217
198
|
<!-- onkeydown={handleInputKeydown} -->
|
|
218
199
|
<!-- onkeydown={handleEsc} -->
|
|
219
200
|
<td class="select-cell" bind:this={tdref}>
|
|
220
|
-
{#await Promise.all([optionsPromise,
|
|
201
|
+
{#await Promise.all([optionsPromise, selectValue])}
|
|
221
202
|
loading…
|
|
222
|
-
{:then [options,
|
|
203
|
+
{:then [options, value]}
|
|
223
204
|
<SingleSelect
|
|
224
205
|
focusOnLoad
|
|
225
206
|
name="Item"
|
|
226
207
|
valueProp="value"
|
|
227
208
|
labelProp="label"
|
|
228
|
-
value={
|
|
209
|
+
value={selectValue}
|
|
229
210
|
{options}
|
|
230
211
|
width="100%"
|
|
231
212
|
clearable={optional}
|
|
232
213
|
onfocus={addKeydownEvent}
|
|
233
|
-
valueAsObject
|
|
234
|
-
onchange={(newValue) => {
|
|
214
|
+
valueAsObject={false}
|
|
215
|
+
onchange={(newValue: SelectOption<unknown> | null) => {
|
|
235
216
|
if (newValue?.value !== value) {
|
|
236
217
|
if (optional || newValue?.value != null) {
|
|
237
218
|
tableContext.onEditCell(cell.row.original, focusDetails.coordinates, newValue?.value);
|
|
@@ -284,10 +265,10 @@
|
|
|
284
265
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
285
266
|
handleSingleClick() || tableContext.endFocus(focusDetails.coordinates);
|
|
286
267
|
}}
|
|
287
|
-
>{#await
|
|
268
|
+
>{#await visibleValue}
|
|
288
269
|
loading…
|
|
289
|
-
{:then
|
|
290
|
-
{value
|
|
270
|
+
{:then value}
|
|
271
|
+
{value ?? '-'}
|
|
291
272
|
{:catch e}
|
|
292
273
|
{@debug e}
|
|
293
274
|
Could not retrieve options
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import type { Column } from '../../../Types/Columns/Column.js';
|
|
2
|
+
import type { SelectDef } from '../../../Types/Columns/Definitions/Accessors/SelectDef.svelte.js';
|
|
3
|
+
import type { TableCell } from '../../../Types/Columns/TableCell.js';
|
|
4
|
+
export interface SelectColumn<T extends object> extends Column<T> {
|
|
5
|
+
columnDef: SelectDef<T>;
|
|
6
|
+
}
|
|
7
|
+
export interface SelectTableCell<T extends object> extends TableCell<T> {
|
|
8
|
+
column: SelectColumn<T>;
|
|
9
|
+
}
|
|
1
10
|
export interface TableSelectProps<T extends object> {
|
|
2
|
-
cell:
|
|
11
|
+
cell: SelectTableCell<T>;
|
|
3
12
|
}
|
|
4
|
-
import type { TableCell } from '../../../Types/Columns/TableCell.js';
|
|
5
13
|
declare function $$render<T extends object>(): {
|
|
6
14
|
props: TableSelectProps<T>;
|
|
7
15
|
exports: {};
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
const isRemoteSelect = $derived(customFilter?.type === CustomFilterType.Select);
|
|
91
91
|
const isValueAsObject = $derived(!(customFilter?.valueAsObject == false));
|
|
92
92
|
|
|
93
|
-
let value: SelectOption<
|
|
93
|
+
let value: SelectOption<unknown> | string | number | null | undefined = $state(null);
|
|
94
94
|
let valueMin: number | null = $state(null);
|
|
95
95
|
let valueMax: number | null = $state(null);
|
|
96
96
|
|
|
97
|
-
let selectedOptions: Array<SelectOption<
|
|
97
|
+
let selectedOptions: Array<SelectOption<unknown>> = $state([]);
|
|
98
98
|
let lastQueryOptions: Array<SelectOption<unknown>> = $state([]);
|
|
99
99
|
|
|
100
100
|
const isNumeric = $derived(
|
|
@@ -120,17 +120,15 @@
|
|
|
120
120
|
|
|
121
121
|
const options = $derived(
|
|
122
122
|
isSelect
|
|
123
|
-
? ((def as SelectDef<T>)?.
|
|
124
|
-
(def as SelectDef<T>).
|
|
123
|
+
? ((def as SelectDef<T>)?.getOptions?.() ??
|
|
124
|
+
(def as SelectDef<T>).getSpecificOptions?.() ??
|
|
125
125
|
customFilter?.options ??
|
|
126
126
|
[])
|
|
127
127
|
: []
|
|
128
128
|
);
|
|
129
129
|
|
|
130
|
-
let optionsPromise:
|
|
131
|
-
|
|
132
|
-
| Promise<Array<SelectOption<string | number>>> = $state(
|
|
133
|
-
[] as Array<SelectOption<string | number>> | Promise<Array<SelectOption<string | number>>>
|
|
130
|
+
let optionsPromise: Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>> = $state(
|
|
131
|
+
[] as Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>
|
|
134
132
|
);
|
|
135
133
|
|
|
136
134
|
onMount(() => {
|
|
@@ -138,7 +136,7 @@
|
|
|
138
136
|
});
|
|
139
137
|
|
|
140
138
|
function retryOptionsPromise() {
|
|
141
|
-
optionsPromise = def instanceof SelectDef ?
|
|
139
|
+
optionsPromise = def instanceof SelectDef ? def.getOptions() : [];
|
|
142
140
|
}
|
|
143
141
|
|
|
144
142
|
// function isNumber(def: ColumnDef<T>): def is INumberInputColumnAccessorDef<T> {
|
|
@@ -164,7 +162,7 @@
|
|
|
164
162
|
const x = tableContext.__queryValues.get(
|
|
165
163
|
customFilter?.label ?? customFilter?.objectName ?? customFilter?.queryKey ?? _uuid
|
|
166
164
|
);
|
|
167
|
-
value = (x ?? null) as SelectOption<
|
|
165
|
+
value = (x ?? null) as SelectOption<unknown> | null;
|
|
168
166
|
}
|
|
169
167
|
} catch (e) {
|
|
170
168
|
console.warn(e);
|
|
@@ -175,9 +173,12 @@
|
|
|
175
173
|
untrack(async () => {
|
|
176
174
|
try {
|
|
177
175
|
const x = (await options).filter((it) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
if (it.value != null && (typeof it.value == 'string' || typeof it.value == 'number')) {
|
|
177
|
+
return (
|
|
178
|
+
filteringStateValue as unknown as Array<string | number> | undefined
|
|
179
|
+
)?.includes(it.value);
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
181
182
|
});
|
|
182
183
|
selectedOptions = x;
|
|
183
184
|
} catch (e) {
|
|
@@ -370,7 +371,7 @@
|
|
|
370
371
|
onchange={(newValue) => {
|
|
371
372
|
tableContext.paginationRepo?.filterBy(def.id, newValue?.value ?? null);
|
|
372
373
|
tableContext.__queryValues.set(label ?? _uuid, newValue);
|
|
373
|
-
value = newValue as SelectOption<
|
|
374
|
+
value = newValue as SelectOption<unknown> | null;
|
|
374
375
|
}}
|
|
375
376
|
/>
|
|
376
377
|
{:else}
|
|
@@ -2,16 +2,18 @@ import type { SelectOption } from '../../../../../../Types/Internal/SelectOption
|
|
|
2
2
|
import type { ColumnDefProps } from '../ColumnDef.svelte.js';
|
|
3
3
|
import { AccessorDef } from './AccessorDef.svelte.js';
|
|
4
4
|
export interface SelectDefProps<T extends object> extends ColumnDefProps<T> {
|
|
5
|
-
getOptions: (
|
|
6
|
-
|
|
5
|
+
getOptions: () => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
6
|
+
getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
7
7
|
sortingFn?: (a: T, b: T) => 1 | -1 | 0;
|
|
8
|
-
|
|
8
|
+
getSpecificOptions?: (item?: T, index?: number) => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
9
|
+
optional?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare class SelectDef<T extends object> extends AccessorDef<T, T> {
|
|
11
12
|
constructor(props: SelectDefProps<T>);
|
|
12
13
|
readonly accessorType: "Select";
|
|
13
14
|
readonly sortingFn?: (a: T, b: T) => 1 | -1 | 0;
|
|
15
|
+
readonly getDisplayValue: (item: T, index: number) => string | null | Promise<string | null>;
|
|
14
16
|
readonly optional: boolean;
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
+
readonly getSpecificOptions?: (item?: T, index?: number) => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
18
|
+
readonly getOptions: () => Array<SelectOption<unknown>> | Promise<Array<SelectOption<unknown>>>;
|
|
17
19
|
}
|
|
@@ -3,14 +3,16 @@ 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);
|
|
6
7
|
this.getOptions = $derived(props.getOptions);
|
|
7
|
-
this.getAllOptions = $derived(props.getAllOptions);
|
|
8
8
|
this.sortingFn = $derived(props.sortingFn);
|
|
9
|
-
this.optional = $derived(props.optional);
|
|
9
|
+
this.optional = $derived(props.optional ?? false);
|
|
10
|
+
this.getDisplayValue = $derived(props.getDisplayValue);
|
|
10
11
|
}
|
|
11
12
|
accessorType = AccessorType.Select;
|
|
12
13
|
sortingFn;
|
|
14
|
+
getDisplayValue;
|
|
13
15
|
optional;
|
|
16
|
+
getSpecificOptions;
|
|
14
17
|
getOptions;
|
|
15
|
-
getAllOptions;
|
|
16
18
|
}
|
|
@@ -10,7 +10,8 @@ export interface ColumnDefProps<T extends object> {
|
|
|
10
10
|
id: string;
|
|
11
11
|
header: string | Snippet;
|
|
12
12
|
index?: number;
|
|
13
|
-
|
|
13
|
+
allowFiltering?: boolean;
|
|
14
|
+
allowSorting?: boolean;
|
|
14
15
|
defaultHidden?: boolean;
|
|
15
16
|
minSize?: Pixels;
|
|
16
17
|
width?: Pixels;
|
|
@@ -29,7 +30,8 @@ export declare abstract class ColumnDef<T extends object, __filterValueType = un
|
|
|
29
30
|
set index(v: number);
|
|
30
31
|
abstract readonly columnType: ColumnType;
|
|
31
32
|
readonly defaultHidden: boolean;
|
|
32
|
-
readonly
|
|
33
|
+
readonly allowSorting: boolean;
|
|
34
|
+
readonly allowFiltering: boolean;
|
|
33
35
|
readonly isValid: ValidationFn<T> | undefined;
|
|
34
36
|
readonly accessorFn: AccessorFn<T> | undefined;
|
|
35
37
|
private _filterFn;
|
|
@@ -4,7 +4,8 @@ export class ColumnDef {
|
|
|
4
4
|
this.id = $derived(props.id);
|
|
5
5
|
this._index = $state(props.index ?? 0); // HACK this may prove problematic and be turned to a required property
|
|
6
6
|
this.defaultHidden = $derived(props.defaultHidden ?? false);
|
|
7
|
-
this.
|
|
7
|
+
this.allowFiltering = $derived(props.allowFiltering ?? true);
|
|
8
|
+
this.allowSorting = $derived(props.allowSorting ?? true);
|
|
8
9
|
this.isValid = $derived(props.isValid);
|
|
9
10
|
this._filterFn = $state(props.filterFn);
|
|
10
11
|
this.accessorFn = $derived(props.accessorFn);
|
|
@@ -24,7 +25,8 @@ export class ColumnDef {
|
|
|
24
25
|
this._index = v;
|
|
25
26
|
}
|
|
26
27
|
defaultHidden;
|
|
27
|
-
|
|
28
|
+
allowSorting;
|
|
29
|
+
allowFiltering;
|
|
28
30
|
isValid;
|
|
29
31
|
accessorFn;
|
|
30
32
|
_filterFn;
|
|
@@ -64,7 +66,7 @@ export class ColumnDef {
|
|
|
64
66
|
return this._visible;
|
|
65
67
|
}
|
|
66
68
|
set visible(v) {
|
|
67
|
-
if (v && !this.
|
|
69
|
+
if (v && !this.allowSorting) {
|
|
68
70
|
console.warn(`Column ${this.id} is not sortable`);
|
|
69
71
|
return;
|
|
70
72
|
}
|
|
@@ -3,7 +3,7 @@ import { DisplayType } from '../../DisplayType.js';
|
|
|
3
3
|
export class ValidityDef extends AbstractDisplayDef {
|
|
4
4
|
displayType = DisplayType.Validity;
|
|
5
5
|
constructor(props) {
|
|
6
|
-
props.
|
|
6
|
+
props.allowSorting = false;
|
|
7
7
|
super(props);
|
|
8
8
|
this.isValid = $derived(props.isValid);
|
|
9
9
|
}
|
|
@@ -615,11 +615,11 @@ export class TableContext {
|
|
|
615
615
|
return {
|
|
616
616
|
column: {
|
|
617
617
|
columnDef: def,
|
|
618
|
-
getCanSort: () => def.
|
|
618
|
+
getCanSort: () => def.allowSorting,
|
|
619
619
|
getIsResizing: () => def.isResizing,
|
|
620
620
|
getIsSorted: () => isSorted,
|
|
621
621
|
getIsVisible: () => isVisible,
|
|
622
|
-
getToggleSortingHandler: () => def.
|
|
622
|
+
getToggleSortingHandler: () => def.allowSorting ? this.getToggleSortingHandler(def) : undefined,
|
|
623
623
|
id: def.id
|
|
624
624
|
},
|
|
625
625
|
id: `${index}_${def.id}`,
|
|
@@ -1038,7 +1038,7 @@ export class TableContext {
|
|
|
1038
1038
|
measureHeaderWidth = (columnDef) => {
|
|
1039
1039
|
const label = columnDef.header;
|
|
1040
1040
|
if (typeof label === 'string' && localStorage) {
|
|
1041
|
-
const extraWidth = columnDef.
|
|
1041
|
+
const extraWidth = columnDef.allowSorting ? SORTING_ICON_WIDTH : 0;
|
|
1042
1042
|
const canvasContext = getCanvasContext();
|
|
1043
1043
|
if (canvasContext) {
|
|
1044
1044
|
const headerWidth = Math.ceil(extraWidth + canvasContext.measureText(`pad${label}pad`).width);
|
|
@@ -1166,7 +1166,7 @@ export class TableContext {
|
|
|
1166
1166
|
const col = affectedColumns[i];
|
|
1167
1167
|
if (col instanceof SelectDef) {
|
|
1168
1168
|
const item = items[i];
|
|
1169
|
-
selectColumns.set(i, await col.
|
|
1169
|
+
selectColumns.set(i, await (col.getSpecificOptions?.(item, indicesByItem.get(item)) ?? col.getOptions()));
|
|
1170
1170
|
}
|
|
1171
1171
|
}
|
|
1172
1172
|
const separator = this.commaSeparatedCopy ? ',' : '\t';
|
|
@@ -1588,11 +1588,11 @@ export class TableContext {
|
|
|
1588
1588
|
return {
|
|
1589
1589
|
column: {
|
|
1590
1590
|
columnDef: def,
|
|
1591
|
-
getCanSort: () => def.
|
|
1591
|
+
getCanSort: () => def.allowSorting,
|
|
1592
1592
|
getIsResizing: () => def.isResizing,
|
|
1593
1593
|
getIsSorted: () => isSorted,
|
|
1594
1594
|
getIsVisible: () => isVisible,
|
|
1595
|
-
getToggleSortingHandler: () => def.
|
|
1595
|
+
getToggleSortingHandler: () => def.allowSorting ? this.getToggleSortingHandler(def) : undefined,
|
|
1596
1596
|
id: def.id
|
|
1597
1597
|
},
|
|
1598
1598
|
id: `${index}_${def.id}`,
|
|
@@ -2097,8 +2097,8 @@ function generateTableOptions(contextObj) {
|
|
|
2097
2097
|
id: def.id,
|
|
2098
2098
|
getIsResizing: () => def.isResizing,
|
|
2099
2099
|
columnDef: def,
|
|
2100
|
-
getCanSort: () => def.
|
|
2101
|
-
getToggleSortingHandler: () => def.
|
|
2100
|
+
getCanSort: () => def.allowSorting,
|
|
2101
|
+
getToggleSortingHandler: () => def.allowSorting ? contextObj.getToggleSortingHandler(def) : undefined,
|
|
2102
2102
|
getIsSorted: () => isSorted,
|
|
2103
2103
|
getIsVisible: () => isVisible
|
|
2104
2104
|
},
|