@lavalogic/scoria 0.18.2 → 0.19.1
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/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 -13
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte.d.ts +6 -6
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +27 -2
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte.d.ts +6 -6
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +60 -15
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte.d.ts +6 -6
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +56 -44
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte.d.ts +6 -6
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +30 -6
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte.d.ts +6 -6
- package/dist/Components/Table/Body/TableBody.svelte +15 -16
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +6 -3
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +4 -1
- package/dist/Components/Table/Headers/TableHead.svelte +6 -0
- package/dist/Components/Table/Table.svelte +128 -133
- package/dist/Components/Table/Types/Context/TableContext.svelte.d.ts +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 +1 -0
- 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
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
const tableContext = getContext<TableContext<T, never>>(TableContext.identifier);
|
|
35
35
|
|
|
36
36
|
const editable = $derived(
|
|
37
|
-
|
|
37
|
+
cell.column.columnDef.isEditable(cell.row.original, cell.row.originalIndex)
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
const focusDetails: TableFocusDetails<T, never> = $derived(
|
|
@@ -50,40 +50,41 @@
|
|
|
50
50
|
tableContext.focusStartIsBeingEdited
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
let isBeingEdited = $
|
|
53
|
+
let isBeingEdited = $derived(false);
|
|
54
54
|
$effect(() => {
|
|
55
|
+
void editable;
|
|
55
56
|
if (wantsToBeEdited) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
editable
|
|
58
|
+
.then((isEditable) => {
|
|
59
|
+
if (isEditable) {
|
|
60
|
+
return tick().then(() => {
|
|
60
61
|
isBeingEdited = true;
|
|
61
62
|
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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);
|
|
73
81
|
} else {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
isBeingEdited = false;
|
|
83
|
-
});
|
|
84
|
-
})
|
|
85
|
-
.catch(devCatch);
|
|
86
|
-
}
|
|
82
|
+
tick()
|
|
83
|
+
.then(() => {
|
|
84
|
+
isBeingEdited = false;
|
|
85
|
+
tableContext.focusStartIsBeingEdited = false;
|
|
86
|
+
})
|
|
87
|
+
.catch(devCatch);
|
|
87
88
|
}
|
|
88
89
|
});
|
|
89
90
|
|
|
@@ -111,9 +112,9 @@
|
|
|
111
112
|
.catch(devCatch);
|
|
112
113
|
});
|
|
113
114
|
|
|
114
|
-
function handleTDFocus(): boolean {
|
|
115
|
+
async function handleTDFocus(): Promise<boolean> {
|
|
115
116
|
if (
|
|
116
|
-
editable &&
|
|
117
|
+
(await editable) &&
|
|
117
118
|
tableContext.focusStart?.column === focusDetails.coordinates.column &&
|
|
118
119
|
tableContext.focusStart.row === focusDetails.coordinates.row
|
|
119
120
|
) {
|
|
@@ -132,11 +133,11 @@
|
|
|
132
133
|
return false;
|
|
133
134
|
}
|
|
134
135
|
|
|
135
|
-
function handleSingleClick() {
|
|
136
|
-
return tableContext.singleClickEditing && handleTDFocus();
|
|
136
|
+
async function handleSingleClick(): Promise<boolean> {
|
|
137
|
+
return tableContext.singleClickEditing && (await handleTDFocus());
|
|
137
138
|
}
|
|
138
|
-
function handleDoubleClick() {
|
|
139
|
-
return !tableContext.singleClickEditing && handleTDFocus();
|
|
139
|
+
async function handleDoubleClick(): Promise<boolean> {
|
|
140
|
+
return !tableContext.singleClickEditing && (await handleTDFocus());
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
function handleTab(e: KeyboardEvent) {
|
|
@@ -176,11 +177,15 @@
|
|
|
176
177
|
target?.addEventListener('keydown', keydownForce);
|
|
177
178
|
}
|
|
178
179
|
|
|
180
|
+
function tryHandleTDFocus() {
|
|
181
|
+
handleTDFocus().catch(devCatch);
|
|
182
|
+
}
|
|
183
|
+
|
|
179
184
|
let prevtdref: HTMLTableCellElement | undefined = undefined;
|
|
180
185
|
$effect(() => {
|
|
181
186
|
if (tdref) {
|
|
182
187
|
if (tdref != prevtdref) {
|
|
183
|
-
tdref.addEventListener('edit',
|
|
188
|
+
tdref.addEventListener('edit', tryHandleTDFocus);
|
|
184
189
|
} else {
|
|
185
190
|
prevtdref = tdref;
|
|
186
191
|
}
|
|
@@ -196,7 +201,7 @@
|
|
|
196
201
|
bind:this={tdref}
|
|
197
202
|
>
|
|
198
203
|
{#await Promise.all([optionsPromise, selectValue])}
|
|
199
|
-
|
|
204
|
+
{loadingText}
|
|
200
205
|
{:then [options, value]}
|
|
201
206
|
<SingleSelect
|
|
202
207
|
focusOnLoad
|
|
@@ -249,7 +254,9 @@
|
|
|
249
254
|
class:success={validity == Validity.Valid}
|
|
250
255
|
class:warning={validity == Validity.Warning}
|
|
251
256
|
class:error={validity == Validity.Invalid}
|
|
252
|
-
ondblclick={
|
|
257
|
+
ondblclick={() => {
|
|
258
|
+
handleDoubleClick().catch(devCatch);
|
|
259
|
+
}}
|
|
253
260
|
onmousedown={(e) => {
|
|
254
261
|
// start focus only on left click
|
|
255
262
|
if (e.button === 0) {
|
|
@@ -267,11 +274,16 @@
|
|
|
267
274
|
}
|
|
268
275
|
}}
|
|
269
276
|
onmouseup={() => {
|
|
270
|
-
|
|
271
|
-
|
|
277
|
+
handleSingleClick()
|
|
278
|
+
.then((wasHandled) => {
|
|
279
|
+
if (!wasHandled) {
|
|
280
|
+
tableContext.endFocus(focusDetails.coordinates);
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
.catch(devCatch);
|
|
272
284
|
}}
|
|
273
285
|
>{#await visibleValue}
|
|
274
|
-
|
|
286
|
+
{loadingText}
|
|
275
287
|
{:then value}
|
|
276
288
|
{value ?? '-'}
|
|
277
289
|
{:catch e}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { TableSelectProps } from './TableSelectProps.js';
|
|
2
|
-
declare function $$render<T extends object>():
|
|
2
|
+
declare function $$render<T extends object>(): {
|
|
3
3
|
props: TableSelectProps<T, T>;
|
|
4
4
|
exports: {};
|
|
5
5
|
bindings: "";
|
|
6
6
|
slots: {};
|
|
7
7
|
events: {};
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
declare class __sveltets_Render<T extends object> {
|
|
10
|
-
props():
|
|
11
|
-
events():
|
|
12
|
-
slots():
|
|
10
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
11
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
12
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
13
13
|
bindings(): "";
|
|
14
|
-
exports():
|
|
14
|
+
exports(): {};
|
|
15
15
|
}
|
|
16
16
|
interface $$IsomorphicComponent {
|
|
17
17
|
new <T extends object>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
@@ -21,9 +21,35 @@
|
|
|
21
21
|
// getNumberColumnDefOrError(cell.column.columnDef)
|
|
22
22
|
// );
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const editableAsync = $derived(
|
|
25
25
|
cell.column.columnDef.isEditable(cell.row.original, cell.row.originalIndex)
|
|
26
26
|
);
|
|
27
|
+
let editable = $state(false);
|
|
28
|
+
|
|
29
|
+
let asyncCounter = 0;
|
|
30
|
+
$effect(() => {
|
|
31
|
+
void editableAsync;
|
|
32
|
+
const localCounter = (asyncCounter = asyncCounter + 1);
|
|
33
|
+
(async () => {
|
|
34
|
+
try {
|
|
35
|
+
const isEditable = await editableAsync;
|
|
36
|
+
if (asyncCounter === localCounter) {
|
|
37
|
+
editable = isEditable;
|
|
38
|
+
} else if (cell.column.columnDef.debug) {
|
|
39
|
+
console.log('skipping async editable because it is stale');
|
|
40
|
+
}
|
|
41
|
+
} catch (e) {
|
|
42
|
+
if (cell.column.columnDef.debug) {
|
|
43
|
+
console.error(e);
|
|
44
|
+
}
|
|
45
|
+
if (asyncCounter === localCounter) {
|
|
46
|
+
editable = false;
|
|
47
|
+
} else if (cell.column.columnDef.debug) {
|
|
48
|
+
console.log('skipping async editable because it is stale');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})().catch(devCatch);
|
|
52
|
+
});
|
|
27
53
|
|
|
28
54
|
const value = $derived(cell.getValue());
|
|
29
55
|
|
|
@@ -51,7 +77,7 @@
|
|
|
51
77
|
|
|
52
78
|
$effect(() => {
|
|
53
79
|
if (wantsToBeEdited) {
|
|
54
|
-
if (
|
|
80
|
+
if (editable) {
|
|
55
81
|
tick()
|
|
56
82
|
.then(() => {
|
|
57
83
|
if (typeof value == 'object' && value instanceof Promise) {
|
|
@@ -192,7 +218,7 @@
|
|
|
192
218
|
if (
|
|
193
219
|
tableContext.focusStart?.column === focusDetails.coordinates.column &&
|
|
194
220
|
tableContext.focusStart.row === focusDetails.coordinates.row &&
|
|
195
|
-
|
|
221
|
+
editable
|
|
196
222
|
) {
|
|
197
223
|
if (
|
|
198
224
|
tableContext.focusEnd?.column !== focusDetails.coordinates.column ||
|
|
@@ -259,8 +285,6 @@
|
|
|
259
285
|
|
|
260
286
|
return unsubscriber;
|
|
261
287
|
});
|
|
262
|
-
|
|
263
|
-
const isEditableText = $derived(await isEditable);
|
|
264
288
|
</script>
|
|
265
289
|
|
|
266
290
|
{#if isBeingEdited}
|
|
@@ -307,7 +331,7 @@
|
|
|
307
331
|
}}
|
|
308
332
|
bind:this={tdref}
|
|
309
333
|
tabIndex="0"
|
|
310
|
-
class:
|
|
334
|
+
class:editable
|
|
311
335
|
class="focusable"
|
|
312
336
|
class:multifocus={focusDetails.isMultiFocused}
|
|
313
337
|
class:multifocus-start={focusDetails.isMultiFocusStart}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { TableTextInputProps } from './TableTextInputProps.js';
|
|
2
|
-
declare function $$render<T extends object, FilterValueType>():
|
|
2
|
+
declare function $$render<T extends object, FilterValueType>(): {
|
|
3
3
|
props: TableTextInputProps<T, FilterValueType>;
|
|
4
4
|
exports: {};
|
|
5
5
|
bindings: "";
|
|
6
6
|
slots: {};
|
|
7
7
|
events: {};
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
declare class __sveltets_Render<T extends object, FilterValueType> {
|
|
10
|
-
props():
|
|
11
|
-
events():
|
|
12
|
-
slots():
|
|
10
|
+
props(): ReturnType<typeof $$render<T, FilterValueType>>['props'];
|
|
11
|
+
events(): ReturnType<typeof $$render<T, FilterValueType>>['events'];
|
|
12
|
+
slots(): ReturnType<typeof $$render<T, FilterValueType>>['slots'];
|
|
13
13
|
bindings(): "";
|
|
14
|
-
exports():
|
|
14
|
+
exports(): {};
|
|
15
15
|
}
|
|
16
16
|
interface $$IsomorphicComponent {
|
|
17
17
|
new <T extends object, FilterValueType>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T, FilterValueType>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T, FilterValueType>['props']>, ReturnType<__sveltets_Render<T, FilterValueType>['events']>, ReturnType<__sveltets_Render<T, FilterValueType>['slots']>> & {
|
|
@@ -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 {
|
|
@@ -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();
|
|
@@ -59,6 +59,12 @@
|
|
|
59
59
|
none: 'sort-none',
|
|
60
60
|
} as const;
|
|
61
61
|
|
|
62
|
+
$effect(() => {
|
|
63
|
+
if (tableContext.debug && !groups.length) {
|
|
64
|
+
$inspect(side, tableContext.table, tableContext.table.columnVisibility);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
62
68
|
let currentDropTarget: HTMLTableCellElement | null = $state(null);
|
|
63
69
|
|
|
64
70
|
function setCurrentDropTarget(target: EventTarget | null) {
|