@lavalogic/scoria 0.18.1 → 0.19.0
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/Base/Snippets.svelte +26 -0
- package/dist/Components/Base/Snippets.svelte.d.ts +5 -0
- package/dist/Components/CollapsibleCard.svelte +6 -3
- package/dist/Components/GridInput.svelte +18 -6
- package/dist/Components/LoadingAnimation.svelte +7 -2
- package/dist/Components/Table/Body/QuickSearchCell.svelte +30 -32
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +1 -1
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +15 -21
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +8 -2
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +43 -39
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +60 -44
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +57 -69
- package/dist/Components/Table/Body/TableBody.svelte +15 -16
- package/dist/Components/Table/ColumnDefinitions/ExampleItemColumnDefRepository.svelte.js +7 -7
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +6 -3
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +4 -1
- package/dist/Components/Table/Table.svelte +128 -133
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.d.ts +2 -2
- package/dist/Components/Table/Types/Columns/Definitions/ColumnDef.svelte.js +1 -1
- package/dist/Components/Touch/TouchModal.svelte +20 -6
- package/dist/Helpers/Helpers.svelte.d.ts +1 -0
- package/dist/Helpers/Helpers.svelte.js +2 -1
- package/package.json +1 -1
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
import SingleSelect from '../../../../SingleSelect.svelte';
|
|
9
9
|
import { TableContext } from '../../../Types/Context/TableContext.svelte.js';
|
|
10
10
|
import { TableFocusDetails } from '../../../Types/Focus/TableFocusDetails.svelte.js';
|
|
11
|
-
import { devCatch, isValidityTuple } from '../../../../../Helpers/Helpers.svelte.js';
|
|
11
|
+
import { devCatch, isValidityTuple, loadingText } from '../../../../../Helpers/Helpers.svelte.js';
|
|
12
12
|
import type { SelectOption } from '../../../../../Types/Internal/SelectOption.js';
|
|
13
13
|
import { Validity } from '../../../../../Types/Internal/Validity.js';
|
|
14
|
-
import { getContext, tick
|
|
14
|
+
import { getContext, tick } from 'svelte';
|
|
15
15
|
import type { TableSelectProps } from './TableSelectProps.js';
|
|
16
16
|
</script>
|
|
17
17
|
|
|
@@ -32,34 +32,10 @@
|
|
|
32
32
|
const optional = $derived(cell.column.columnDef.optional);
|
|
33
33
|
|
|
34
34
|
const tableContext = getContext<TableContext<T, never>>(TableContext.identifier);
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
const editable = $derived(
|
|
36
37
|
cell.column.columnDef.isEditable(cell.row.original, cell.row.originalIndex)
|
|
37
38
|
);
|
|
38
|
-
let editable = $state(false);
|
|
39
|
-
let asyncCounter = 0;
|
|
40
|
-
$effect(() => {
|
|
41
|
-
void editableAsync;
|
|
42
|
-
const localCounter = (asyncCounter = asyncCounter + 1);
|
|
43
|
-
(async () => {
|
|
44
|
-
try {
|
|
45
|
-
const isEditable = await editableAsync;
|
|
46
|
-
if (asyncCounter === localCounter) {
|
|
47
|
-
editable = isEditable;
|
|
48
|
-
} else if (cell.column.columnDef.debug) {
|
|
49
|
-
console.log('skipping async editable because it is stale');
|
|
50
|
-
}
|
|
51
|
-
} catch (e) {
|
|
52
|
-
if (cell.column.columnDef.debug) {
|
|
53
|
-
console.error(e);
|
|
54
|
-
}
|
|
55
|
-
if (asyncCounter === localCounter) {
|
|
56
|
-
editable = false;
|
|
57
|
-
} else if (cell.column.columnDef.debug) {
|
|
58
|
-
console.log('skipping async editable because it is stale');
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
})().catch(devCatch);
|
|
62
|
-
});
|
|
63
39
|
|
|
64
40
|
const focusDetails: TableFocusDetails<T, never> = $derived(
|
|
65
41
|
new TableFocusDetails(cell, tableContext)
|
|
@@ -74,40 +50,41 @@
|
|
|
74
50
|
tableContext.focusStartIsBeingEdited
|
|
75
51
|
);
|
|
76
52
|
|
|
77
|
-
let isBeingEdited = $
|
|
53
|
+
let isBeingEdited = $derived(false);
|
|
78
54
|
$effect(() => {
|
|
55
|
+
void editable;
|
|
79
56
|
if (wantsToBeEdited) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
57
|
+
editable
|
|
58
|
+
.then((isEditable) => {
|
|
59
|
+
if (isEditable) {
|
|
60
|
+
return tick().then(() => {
|
|
84
61
|
isBeingEdited = true;
|
|
85
62
|
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
63
|
+
} else {
|
|
64
|
+
if (isBeingEdited) {
|
|
65
|
+
return tick()
|
|
66
|
+
.then(() => {
|
|
67
|
+
if (!tableContext.singleClickEditing) {
|
|
68
|
+
tableContext.focusStartIsBeingEdited = false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
isBeingEdited = false;
|
|
72
|
+
})
|
|
73
|
+
.catch(devCatch);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return;
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
.catch(devCatch);
|
|
97
81
|
} else {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
isBeingEdited = false;
|
|
107
|
-
});
|
|
108
|
-
})
|
|
109
|
-
.catch(devCatch);
|
|
110
|
-
}
|
|
82
|
+
tick()
|
|
83
|
+
.then(() => {
|
|
84
|
+
isBeingEdited = false;
|
|
85
|
+
tableContext.focusStartIsBeingEdited = false;
|
|
86
|
+
})
|
|
87
|
+
.catch(devCatch);
|
|
111
88
|
}
|
|
112
89
|
});
|
|
113
90
|
|
|
@@ -135,9 +112,9 @@
|
|
|
135
112
|
.catch(devCatch);
|
|
136
113
|
});
|
|
137
114
|
|
|
138
|
-
function handleTDFocus(): boolean {
|
|
115
|
+
async function handleTDFocus(): Promise<boolean> {
|
|
139
116
|
if (
|
|
140
|
-
editable &&
|
|
117
|
+
(await editable) &&
|
|
141
118
|
tableContext.focusStart?.column === focusDetails.coordinates.column &&
|
|
142
119
|
tableContext.focusStart.row === focusDetails.coordinates.row
|
|
143
120
|
) {
|
|
@@ -156,11 +133,11 @@
|
|
|
156
133
|
return false;
|
|
157
134
|
}
|
|
158
135
|
|
|
159
|
-
function handleSingleClick() {
|
|
160
|
-
return tableContext.singleClickEditing && handleTDFocus();
|
|
136
|
+
async function handleSingleClick(): Promise<boolean> {
|
|
137
|
+
return tableContext.singleClickEditing && (await handleTDFocus());
|
|
161
138
|
}
|
|
162
|
-
function handleDoubleClick() {
|
|
163
|
-
return !tableContext.singleClickEditing && handleTDFocus();
|
|
139
|
+
async function handleDoubleClick(): Promise<boolean> {
|
|
140
|
+
return !tableContext.singleClickEditing && (await handleTDFocus());
|
|
164
141
|
}
|
|
165
142
|
|
|
166
143
|
function handleTab(e: KeyboardEvent) {
|
|
@@ -200,11 +177,15 @@
|
|
|
200
177
|
target?.addEventListener('keydown', keydownForce);
|
|
201
178
|
}
|
|
202
179
|
|
|
180
|
+
function tryHandleTDFocus() {
|
|
181
|
+
handleTDFocus().catch(devCatch);
|
|
182
|
+
}
|
|
183
|
+
|
|
203
184
|
let prevtdref: HTMLTableCellElement | undefined = undefined;
|
|
204
185
|
$effect(() => {
|
|
205
186
|
if (tdref) {
|
|
206
187
|
if (tdref != prevtdref) {
|
|
207
|
-
tdref.addEventListener('edit',
|
|
188
|
+
tdref.addEventListener('edit', tryHandleTDFocus);
|
|
208
189
|
} else {
|
|
209
190
|
prevtdref = tdref;
|
|
210
191
|
}
|
|
@@ -220,7 +201,7 @@
|
|
|
220
201
|
bind:this={tdref}
|
|
221
202
|
>
|
|
222
203
|
{#await Promise.all([optionsPromise, selectValue])}
|
|
223
|
-
|
|
204
|
+
{loadingText}
|
|
224
205
|
{:then [options, value]}
|
|
225
206
|
<SingleSelect
|
|
226
207
|
focusOnLoad
|
|
@@ -273,7 +254,9 @@
|
|
|
273
254
|
class:success={validity == Validity.Valid}
|
|
274
255
|
class:warning={validity == Validity.Warning}
|
|
275
256
|
class:error={validity == Validity.Invalid}
|
|
276
|
-
ondblclick={
|
|
257
|
+
ondblclick={() => {
|
|
258
|
+
handleDoubleClick().catch(devCatch);
|
|
259
|
+
}}
|
|
277
260
|
onmousedown={(e) => {
|
|
278
261
|
// start focus only on left click
|
|
279
262
|
if (e.button === 0) {
|
|
@@ -291,11 +274,16 @@
|
|
|
291
274
|
}
|
|
292
275
|
}}
|
|
293
276
|
onmouseup={() => {
|
|
294
|
-
|
|
295
|
-
|
|
277
|
+
handleSingleClick()
|
|
278
|
+
.then((wasHandled) => {
|
|
279
|
+
if (!wasHandled) {
|
|
280
|
+
tableContext.endFocus(focusDetails.coordinates);
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
.catch(devCatch);
|
|
296
284
|
}}
|
|
297
285
|
>{#await visibleValue}
|
|
298
|
-
|
|
286
|
+
{loadingText}
|
|
299
287
|
{:then value}
|
|
300
288
|
{value ?? '-'}
|
|
301
289
|
{:catch e}
|
|
@@ -48,24 +48,23 @@
|
|
|
48
48
|
{/each}
|
|
49
49
|
</tr>
|
|
50
50
|
{/if}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
|
|
52
|
+
{#await tableContext.paginationRowModel then prm}
|
|
53
|
+
{#each prm.rows as row, index (row)}
|
|
54
|
+
<!-- {@const customHeight = heights[index]?.applyTo.includes(side)
|
|
55
55
|
? heights[index].maxHeight
|
|
56
56
|
: undefined} -->
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
</svelte:boundary>
|
|
57
|
+
<!-- {customHeight} -->
|
|
58
|
+
<TableRow
|
|
59
|
+
customHeight={undefined}
|
|
60
|
+
{includeHighlight}
|
|
61
|
+
{row}
|
|
62
|
+
{side}
|
|
63
|
+
odd={index % 2 == 1}
|
|
64
|
+
/>
|
|
65
|
+
<!-- bind:this={rows[index]} -->
|
|
66
|
+
{/each}
|
|
67
|
+
{/await}
|
|
69
68
|
</tbody>
|
|
70
69
|
|
|
71
70
|
<style>td {
|
|
@@ -79,7 +79,7 @@ export function generateExampleItemColumnDefs(modal) {
|
|
|
79
79
|
getDisplayValue: (item) => {
|
|
80
80
|
return item.simulatedQuery?.value ?? null;
|
|
81
81
|
},
|
|
82
|
-
isEditable: () => true,
|
|
82
|
+
isEditable: () => Promise.resolve(true),
|
|
83
83
|
id: 'simulatedQuery',
|
|
84
84
|
query: async (_v, item) => {
|
|
85
85
|
void item.someDate;
|
|
@@ -98,13 +98,13 @@ export function generateExampleItemColumnDefs(modal) {
|
|
|
98
98
|
new TextInputDef({
|
|
99
99
|
header: 'Name',
|
|
100
100
|
id: 'name',
|
|
101
|
-
isEditable: () => true,
|
|
101
|
+
isEditable: () => Promise.resolve(true),
|
|
102
102
|
isValid,
|
|
103
103
|
}),
|
|
104
104
|
new NumberInputDef({
|
|
105
105
|
header: 'Some Number',
|
|
106
106
|
id: 'someNumber',
|
|
107
|
-
isEditable: () => true,
|
|
107
|
+
isEditable: () => Promise.resolve(true),
|
|
108
108
|
min: 0,
|
|
109
109
|
max: 12345,
|
|
110
110
|
isValid,
|
|
@@ -147,20 +147,20 @@ export function generateExampleItemColumnDefs(modal) {
|
|
|
147
147
|
new DateInputDef({
|
|
148
148
|
header: 'Some Date With Time',
|
|
149
149
|
id: 'someDateWithTime',
|
|
150
|
-
isEditable: () => true,
|
|
150
|
+
isEditable: () => Promise.resolve(true),
|
|
151
151
|
showTime: true,
|
|
152
152
|
isValid,
|
|
153
153
|
}),
|
|
154
154
|
new DateInputDef({
|
|
155
155
|
header: 'Flo Date',
|
|
156
156
|
id: 'floDate',
|
|
157
|
-
isEditable: () => true,
|
|
157
|
+
isEditable: () => Promise.resolve(true),
|
|
158
158
|
defaultHidden: true,
|
|
159
159
|
}),
|
|
160
160
|
new DateInputDef({
|
|
161
161
|
header: 'Flo Date With Time',
|
|
162
162
|
id: 'floDateWithTime',
|
|
163
|
-
isEditable: () => true,
|
|
163
|
+
isEditable: () => Promise.resolve(true),
|
|
164
164
|
defaultHidden: true,
|
|
165
165
|
showTime: true,
|
|
166
166
|
isValid,
|
|
@@ -191,7 +191,7 @@ export function generateExampleItemColumnDefs(modal) {
|
|
|
191
191
|
];
|
|
192
192
|
},
|
|
193
193
|
getDisplayValue: (item) => item.someSelect,
|
|
194
|
-
isEditable: () => true,
|
|
194
|
+
isEditable: () => Promise.resolve(true),
|
|
195
195
|
isValid,
|
|
196
196
|
}),
|
|
197
197
|
new BubbleDef({
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<svelte:options runes />
|
|
2
2
|
|
|
3
|
-
<script
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="T extends object"
|
|
6
|
+
>
|
|
4
7
|
import { devCatch } from '../../../Helpers/Helpers.svelte.js';
|
|
5
8
|
import { Colour } from '../../../scss/colours.js';
|
|
6
9
|
import { Size } from '../../../Types/Internal/Size.js';
|
|
@@ -34,7 +37,7 @@
|
|
|
34
37
|
hoverBackgroundColour={Colour['$brand-dark']}
|
|
35
38
|
size={Size.FillWidth}
|
|
36
39
|
icon={{
|
|
37
|
-
name: 'nothing'
|
|
40
|
+
name: 'nothing',
|
|
38
41
|
}}
|
|
39
42
|
onclick={() => {
|
|
40
43
|
tableContext.onHighlightAll();
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
hoverBackgroundColour={Colour['$brand-dark']}
|
|
47
50
|
size={Size.FillWidth}
|
|
48
51
|
icon={{
|
|
49
|
-
name: 'nothing'
|
|
52
|
+
name: 'nothing',
|
|
50
53
|
}}
|
|
51
54
|
onclick={() => {
|
|
52
55
|
tableContext.onHighlightAll();
|
|
@@ -103,12 +103,9 @@
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
$effect(() => {
|
|
106
|
-
|
|
107
|
-
tableContext.
|
|
108
|
-
|
|
109
|
-
tableContext.selectedItems;
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
111
|
-
tableContext.paginationRepo?.pageStartIndex;
|
|
106
|
+
void tableContext.dataRepo.data.length;
|
|
107
|
+
void tableContext.selectedItems;
|
|
108
|
+
void tableContext.paginationRepo?.pageStartIndex;
|
|
112
109
|
|
|
113
110
|
untrack(() => {
|
|
114
111
|
tableContext.recalculateAllSelectedInCurrentPage();
|
|
@@ -359,151 +356,149 @@
|
|
|
359
356
|
}}
|
|
360
357
|
/>
|
|
361
358
|
|
|
362
|
-
<
|
|
359
|
+
<div
|
|
360
|
+
class="grid"
|
|
361
|
+
class:nested
|
|
362
|
+
>
|
|
363
|
+
{#if tableContext.dataRepo.isLoading}
|
|
364
|
+
<LoadingOverlay
|
|
365
|
+
absolute
|
|
366
|
+
borderRadius="4px"
|
|
367
|
+
/>
|
|
368
|
+
{/if}
|
|
369
|
+
|
|
363
370
|
<div
|
|
364
|
-
class="
|
|
365
|
-
class:
|
|
371
|
+
class="horizontal-bar"
|
|
372
|
+
class:border={tableContext.toolbarPosition === ToolbarPosition.Top}
|
|
366
373
|
>
|
|
367
|
-
{#if tableContext.
|
|
368
|
-
<
|
|
369
|
-
absolute
|
|
370
|
-
borderRadius="4px"
|
|
371
|
-
/>
|
|
374
|
+
{#if tableContext.toolbarPosition === ToolbarPosition.Top}
|
|
375
|
+
<TableHorizontalBar />
|
|
372
376
|
{/if}
|
|
377
|
+
</div>
|
|
373
378
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
class:nested
|
|
397
|
-
style="--nested-height: {nestedHeight}px;"
|
|
398
|
-
>
|
|
399
|
-
{#if tableContext.toolbarPosition === ToolbarPosition.Right}
|
|
400
|
-
<div class="sidebar toolbar-right">
|
|
401
|
-
<TableSidebar />
|
|
402
|
-
</div>
|
|
403
|
-
{/if}
|
|
404
|
-
</div>
|
|
379
|
+
<div
|
|
380
|
+
class="sidebar-wrapper sidebar-wrapper-left"
|
|
381
|
+
class:nested
|
|
382
|
+
style="--nested-height: {nestedHeight}px;"
|
|
383
|
+
>
|
|
384
|
+
{#if tableContext.toolbarPosition === ToolbarPosition.Left}
|
|
385
|
+
<div class="sidebar toolbar-left">
|
|
386
|
+
<TableSidebar />
|
|
387
|
+
</div>
|
|
388
|
+
{/if}
|
|
389
|
+
</div>
|
|
390
|
+
<div
|
|
391
|
+
class="sidebar-wrapper sidebar-wrapper-right"
|
|
392
|
+
class:nested
|
|
393
|
+
style="--nested-height: {nestedHeight}px;"
|
|
394
|
+
>
|
|
395
|
+
{#if tableContext.toolbarPosition === ToolbarPosition.Right}
|
|
396
|
+
<div class="sidebar toolbar-right">
|
|
397
|
+
<TableSidebar />
|
|
398
|
+
</div>
|
|
399
|
+
{/if}
|
|
400
|
+
</div>
|
|
405
401
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
402
|
+
<div class="footer">
|
|
403
|
+
{#if tableContext.displayFooter}
|
|
404
|
+
<TableFooter />
|
|
405
|
+
{/if}
|
|
406
|
+
</div>
|
|
411
407
|
|
|
412
|
-
|
|
408
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
409
|
+
<div
|
|
410
|
+
bind:this={tableRef}
|
|
411
|
+
class="datatable"
|
|
412
|
+
class:nested
|
|
413
|
+
class:compact={tableContext.isCompact}
|
|
414
|
+
class:quick-filtering={tableContext.showQuickFiltering}
|
|
415
|
+
onkeydown={tableContext.handleTdKeydown}
|
|
416
|
+
>
|
|
413
417
|
<div
|
|
414
|
-
|
|
415
|
-
|
|
418
|
+
class="flex_table"
|
|
419
|
+
bind:this={ref}
|
|
416
420
|
class:nested
|
|
417
|
-
class:compact={tableContext.isCompact}
|
|
418
|
-
class:quick-filtering={tableContext.showQuickFiltering}
|
|
419
|
-
onkeydown={tableContext.handleTdKeydown}
|
|
420
421
|
>
|
|
421
422
|
<div
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
423
|
+
bind:this={unfocusRef}
|
|
424
|
+
class="table-wrapper"
|
|
425
|
+
oncontextmenu={openContextMenu}
|
|
425
426
|
>
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
class="
|
|
429
|
-
|
|
427
|
+
<!-- {#if leftTotalSize > 0} -->
|
|
428
|
+
<table
|
|
429
|
+
class="datatable__table left"
|
|
430
|
+
style="min-width: {leftTotalSize}px"
|
|
430
431
|
>
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
includeHighlight={appropriateSide == 'centre'}
|
|
462
|
-
columns={centreColumns}
|
|
463
|
-
side="centre"
|
|
464
|
-
/>
|
|
465
|
-
<!-- heights={totalRowSizes}
|
|
432
|
+
<TableHead
|
|
433
|
+
showHighlight={leftTotalSize > 0}
|
|
434
|
+
side="left"
|
|
435
|
+
/>
|
|
436
|
+
<TableBody
|
|
437
|
+
includeHighlight={appropriateSide == 'left'}
|
|
438
|
+
columns={leftColumns}
|
|
439
|
+
side="left"
|
|
440
|
+
/>
|
|
441
|
+
<!-- heights={totalRowSizes} -->
|
|
442
|
+
<!-- bind:this={leftTable} -->
|
|
443
|
+
</table>
|
|
444
|
+
<!-- {/if} -->
|
|
445
|
+
|
|
446
|
+
<!-- {#if centreTotalSize > 0} -->
|
|
447
|
+
|
|
448
|
+
<table
|
|
449
|
+
class="datatable__table centre"
|
|
450
|
+
style="min-width: {centreTotalSize}px"
|
|
451
|
+
>
|
|
452
|
+
<TableHead
|
|
453
|
+
showHighlight={leftTotalSize == 0}
|
|
454
|
+
side="centre"
|
|
455
|
+
/>
|
|
456
|
+
<TableBody
|
|
457
|
+
includeHighlight={appropriateSide == 'centre'}
|
|
458
|
+
columns={centreColumns}
|
|
459
|
+
side="centre"
|
|
460
|
+
/>
|
|
461
|
+
<!-- heights={totalRowSizes}
|
|
466
462
|
bind:this={centreTable} -->
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
<!-- {#if rightTotalSize > 0} -->
|
|
471
|
-
<table
|
|
472
|
-
class="datatable__table right"
|
|
473
|
-
style="min-width: {rightTotalSize}px"
|
|
474
|
-
>
|
|
475
|
-
<TableHead
|
|
476
|
-
showHighlight={false}
|
|
477
|
-
side="right"
|
|
478
|
-
/>
|
|
479
|
-
<TableBody
|
|
480
|
-
includeHighlight={appropriateSide == 'right'}
|
|
481
|
-
columns={rightColumns}
|
|
482
|
-
side="right"
|
|
483
|
-
/>
|
|
484
|
-
<!-- heights={totalRowSizes}
|
|
485
|
-
bind:this={rightTable} -->
|
|
486
|
-
</table>
|
|
487
|
-
<!-- {/if} -->
|
|
488
|
-
</div>
|
|
463
|
+
</table>
|
|
464
|
+
<!-- {/if} -->
|
|
489
465
|
|
|
490
|
-
<!--
|
|
466
|
+
<!-- {#if rightTotalSize > 0} -->
|
|
467
|
+
<table
|
|
468
|
+
class="datatable__table right"
|
|
469
|
+
style="min-width: {rightTotalSize}px"
|
|
470
|
+
>
|
|
471
|
+
<TableHead
|
|
472
|
+
showHighlight={false}
|
|
473
|
+
side="right"
|
|
474
|
+
/>
|
|
475
|
+
<TableBody
|
|
476
|
+
includeHighlight={appropriateSide == 'right'}
|
|
477
|
+
columns={rightColumns}
|
|
478
|
+
side="right"
|
|
479
|
+
/>
|
|
480
|
+
<!-- heights={totalRowSizes}
|
|
481
|
+
bind:this={rightTable} -->
|
|
482
|
+
</table>
|
|
483
|
+
<!-- {/if} -->
|
|
491
484
|
</div>
|
|
492
485
|
|
|
493
|
-
|
|
494
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
495
|
-
<div
|
|
496
|
-
class:isResizing
|
|
497
|
-
class="resizer"
|
|
498
|
-
onmousedown={(e) => {
|
|
499
|
-
e.preventDefault();
|
|
500
|
-
addOverrideResizeHandler();
|
|
501
|
-
}}
|
|
502
|
-
></div>
|
|
503
|
-
{/if}
|
|
486
|
+
<!-- TODO add filter callbacks -->
|
|
504
487
|
</div>
|
|
488
|
+
|
|
489
|
+
{#if nested}
|
|
490
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
491
|
+
<div
|
|
492
|
+
class:isResizing
|
|
493
|
+
class="resizer"
|
|
494
|
+
onmousedown={(e) => {
|
|
495
|
+
e.preventDefault();
|
|
496
|
+
addOverrideResizeHandler();
|
|
497
|
+
}}
|
|
498
|
+
></div>
|
|
499
|
+
{/if}
|
|
505
500
|
</div>
|
|
506
|
-
</
|
|
501
|
+
</div>
|
|
507
502
|
|
|
508
503
|
<style>div.grid {
|
|
509
504
|
border-radius: 4px;
|
|
@@ -16,7 +16,7 @@ export interface ColumnDefProps<T extends object, in FilterFnType, out OptionsTy
|
|
|
16
16
|
defaultHidden?: boolean;
|
|
17
17
|
minSize?: Pixels;
|
|
18
18
|
width?: Pixels;
|
|
19
|
-
isEditable?: (item: T, index: number) =>
|
|
19
|
+
isEditable?: (item: T, index: number) => Promise<boolean>;
|
|
20
20
|
resizable?: boolean;
|
|
21
21
|
isValid?: ValidationFn<T>;
|
|
22
22
|
filterFn?: FilterFn<T, FilterFnType>;
|
|
@@ -56,7 +56,7 @@ export declare abstract class ColumnDef<T extends object, in FilterFnType = neve
|
|
|
56
56
|
set filterValueType(v: FilterValueType | undefined);
|
|
57
57
|
readonly getDisplayValue: ((item: T, index: number) => string | null | Promise<string | null>) | undefined;
|
|
58
58
|
toJSON(): object;
|
|
59
|
-
readonly isEditable: (item: T, index: number) =>
|
|
59
|
+
readonly isEditable: (item: T, index: number) => Promise<boolean>;
|
|
60
60
|
readonly resizable: boolean;
|
|
61
61
|
readonly header: string | Snippet;
|
|
62
62
|
readonly getOptions?: () => Array<SelectOption<OptionsType>> | Promise<Array<SelectOption<OptionsType>>>;
|
|
@@ -10,7 +10,7 @@ export class ColumnDef {
|
|
|
10
10
|
this.accessorFn = $derived(props.accessorFn);
|
|
11
11
|
this._minSize = $state(props.minSize ?? 48);
|
|
12
12
|
this._width = $state(props.width ?? props.minSize ?? 48);
|
|
13
|
-
this.isEditable = $derived(props.isEditable ?? (() => false));
|
|
13
|
+
this.isEditable = $derived(props.isEditable ?? (() => Promise.resolve(false)));
|
|
14
14
|
this.resizable = $derived(props.resizable ?? true);
|
|
15
15
|
this.header = $derived(props.header);
|
|
16
16
|
this._filterValueType = $derived(props.filterValueType);
|