@lavalogic/scoria 0.18.2 → 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/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/Table.svelte +128 -133
- 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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
|
+
>
|
|
7
|
+
import { getErrorMessage, loadingText } from '../../Helpers/Helpers.svelte.js';
|
|
8
|
+
import Button from '../Button.svelte';
|
|
9
|
+
|
|
10
|
+
export const pending = _pending;
|
|
11
|
+
export const failed = _failed;
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{#snippet _pending()}
|
|
15
|
+
{loadingText}
|
|
16
|
+
{/snippet}
|
|
17
|
+
{#snippet _failed(e: unknown, retry?: () => void)}
|
|
18
|
+
Error: {getErrorMessage(e)}
|
|
19
|
+
{#if retry}
|
|
20
|
+
<Button
|
|
21
|
+
onclick={() => {
|
|
22
|
+
retry();
|
|
23
|
+
}}>Retry</Button
|
|
24
|
+
>
|
|
25
|
+
{/if}
|
|
26
|
+
{/snippet}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const pending: () => ReturnType<import("svelte").Snippet>;
|
|
2
|
+
export declare const failed: (e: unknown, retry?: () => void) => ReturnType<import("svelte").Snippet>;
|
|
3
|
+
declare const Snippets: import("svelte").Component<Record<string, never>, {}, "">;
|
|
4
|
+
type Snippets = ReturnType<typeof Snippets>;
|
|
5
|
+
export default Snippets;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
maxHeight: maxHeight,
|
|
13
13
|
children,
|
|
14
14
|
grow,
|
|
15
|
-
isCollapsed = $bindable(false)
|
|
15
|
+
isCollapsed = $bindable(false),
|
|
16
16
|
}: CollapsibleCardProps = $props();
|
|
17
17
|
|
|
18
18
|
let cardRef: HTMLDivElement | undefined = $state();
|
|
@@ -50,13 +50,16 @@
|
|
|
50
50
|
icon={{
|
|
51
51
|
name: isCollapsed ? 'circle-plus' : 'circle-minus',
|
|
52
52
|
colour: Colour['$ui-blue-5'],
|
|
53
|
-
size: Size.Medium
|
|
53
|
+
size: Size.Medium,
|
|
54
54
|
}}
|
|
55
55
|
/>
|
|
56
56
|
</div>
|
|
57
57
|
</div>
|
|
58
58
|
|
|
59
|
-
<div
|
|
59
|
+
<div
|
|
60
|
+
class="content"
|
|
61
|
+
class:is-collapsed={isCollapsed}
|
|
62
|
+
>
|
|
60
63
|
{#if children}
|
|
61
64
|
{@render children()}
|
|
62
65
|
{/if}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
<svelte:options runes />
|
|
2
2
|
|
|
3
|
-
<script
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
|
+
>
|
|
4
7
|
import { dev } from '$app/environment';
|
|
5
8
|
import type { GridItem } from '../Types/Internal/GridItem.js';
|
|
6
9
|
import type {
|
|
7
10
|
GridMultiSelectItem,
|
|
8
11
|
GridMultiSelectItemAsObject,
|
|
9
|
-
GridMultiSelectItemAsPrimitive
|
|
12
|
+
GridMultiSelectItemAsPrimitive,
|
|
10
13
|
} from '../Types/Internal/GridMultiSelectItem.js';
|
|
11
14
|
import type { GridSelectItem } from '../Types/Internal/GridSelectItem.js';
|
|
12
15
|
import type {
|
|
13
16
|
GridSingleSelectItem,
|
|
14
17
|
GridSingleSelectItemAsObject,
|
|
15
|
-
GridSingleSelectItemAsPrimitive
|
|
18
|
+
GridSingleSelectItemAsPrimitive,
|
|
16
19
|
} from '../Types/Internal/GridSingleSelectItem.js';
|
|
17
20
|
import type { GridTextItem } from '../Types/Internal/GridTextItem.js';
|
|
18
21
|
import type { ValueProp } from '../Types/Internal/Misc.js';
|
|
@@ -24,7 +27,10 @@
|
|
|
24
27
|
const textTypes = new Set(['text', 'email', 'tel']);
|
|
25
28
|
</script>
|
|
26
29
|
|
|
27
|
-
<script
|
|
30
|
+
<script
|
|
31
|
+
lang="ts"
|
|
32
|
+
generics="V extends object,VP extends ValueProp<V>"
|
|
33
|
+
>
|
|
28
34
|
const { item, first, last }: GridInputProps<V, VP> = $props();
|
|
29
35
|
|
|
30
36
|
let value = $derived(isText(item) ? (item.value ?? '') : '');
|
|
@@ -76,9 +82,15 @@
|
|
|
76
82
|
}
|
|
77
83
|
</script>
|
|
78
84
|
|
|
79
|
-
<label
|
|
85
|
+
<label
|
|
86
|
+
class:first
|
|
87
|
+
class:last
|
|
88
|
+
>
|
|
80
89
|
<div class="left">
|
|
81
|
-
<span
|
|
90
|
+
<span
|
|
91
|
+
class:first
|
|
92
|
+
class:last>{item.label}</span
|
|
93
|
+
>
|
|
82
94
|
</div>
|
|
83
95
|
{#if isText(item)}
|
|
84
96
|
<TextInput
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
<svelte:options runes />
|
|
2
2
|
|
|
3
|
-
<script
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
|
+
>
|
|
4
7
|
export interface LoadingAnimationProps {
|
|
5
8
|
showText?: boolean;
|
|
6
9
|
}
|
|
7
10
|
</script>
|
|
8
11
|
|
|
9
12
|
<script lang="ts">
|
|
13
|
+
import { loadingText } from '../Helpers/Helpers.svelte.js';
|
|
14
|
+
|
|
10
15
|
let { showText = true }: LoadingAnimationProps = $props();
|
|
11
16
|
</script>
|
|
12
17
|
|
|
@@ -14,7 +19,7 @@
|
|
|
14
19
|
<div id="cube">
|
|
15
20
|
<div class="front"></div>
|
|
16
21
|
<div class="front">
|
|
17
|
-
{#if showText}<span>
|
|
22
|
+
{#if showText}<span>{loadingText}</span>{/if}
|
|
18
23
|
</div>
|
|
19
24
|
<div class="back"></div>
|
|
20
25
|
<div class="right"></div>
|
|
@@ -478,38 +478,36 @@
|
|
|
478
478
|
/>
|
|
479
479
|
</div>
|
|
480
480
|
{:else}
|
|
481
|
-
<
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
{
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
{
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
</div>
|
|
512
|
-
</svelte:boundary>
|
|
481
|
+
<div class="input-wrapper right">
|
|
482
|
+
{#await isNullFilter}
|
|
483
|
+
loading
|
|
484
|
+
{:then isNullFilter}
|
|
485
|
+
{#if isNullFilter}
|
|
486
|
+
<TextInput
|
|
487
|
+
data-type="quicksearch"
|
|
488
|
+
id={inputId}
|
|
489
|
+
value="is Null"
|
|
490
|
+
disabled
|
|
491
|
+
variant={InputVariant.Table}
|
|
492
|
+
/>
|
|
493
|
+
{:else}
|
|
494
|
+
<!-- NOTE: This is a text input in order to support the __in functionality, which is a comma separated list of numbers -->
|
|
495
|
+
<TextInput
|
|
496
|
+
data-type="quicksearch"
|
|
497
|
+
id={inputId}
|
|
498
|
+
bind:value={asdfvalue as string | null}
|
|
499
|
+
placeholder="Filter…"
|
|
500
|
+
variant={InputVariant.Table}
|
|
501
|
+
oninput={() => {
|
|
502
|
+
tableContext.paginationRepo?.filterBy(def.id, [asdfvalue || null]);
|
|
503
|
+
}}
|
|
504
|
+
onkeydown={closeOnCtrlF}
|
|
505
|
+
/>
|
|
506
|
+
{/if}
|
|
507
|
+
{:catch e}
|
|
508
|
+
{@debug e}
|
|
509
|
+
{/await}
|
|
510
|
+
</div>
|
|
513
511
|
{/if}
|
|
514
512
|
{:else if asdfvalue == null || typeof asdfvalue == 'string'}
|
|
515
513
|
<div class="input-wrapper right">
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
>
|
|
7
7
|
import { TableContext } from '../../../Types/Context/TableContext.svelte.js';
|
|
8
8
|
import { TableFocusDetails } from '../../../Types/Focus/TableFocusDetails.svelte.js';
|
|
9
|
-
import { devCatch,
|
|
9
|
+
import { devCatch, isValidityTuple } from '../../../../../Helpers/Helpers.svelte.js';
|
|
10
10
|
import type { SelectOption } from '../../../../../Types/Internal/SelectOption.js';
|
|
11
11
|
import { Validity } from '../../../../../Types/Internal/Validity.js';
|
|
12
12
|
import { getContext } from 'svelte';
|
|
@@ -87,16 +87,10 @@ class:bottom={focusDetails.bottomEdge} -->
|
|
|
87
87
|
tableContext.endFocus(focusDetails.coordinates);
|
|
88
88
|
}}
|
|
89
89
|
>
|
|
90
|
-
|
|
91
|
-
{#
|
|
90
|
+
{#if hasValue}
|
|
91
|
+
{#await visibleValue}
|
|
92
92
|
loading…
|
|
93
|
-
{
|
|
94
|
-
{#snippet onerror(e)}
|
|
95
|
-
Error: {getErrorMessage(e)}
|
|
96
|
-
{/snippet}
|
|
97
|
-
{#if hasValue}
|
|
98
|
-
{@const v = await visibleValue}
|
|
99
|
-
|
|
93
|
+
{:then v}
|
|
100
94
|
{(v instanceof Date
|
|
101
95
|
? v.toLocaleDateString()
|
|
102
96
|
: options.length
|
|
@@ -104,17 +98,17 @@ class:bottom={focusDetails.bottomEdge} -->
|
|
|
104
98
|
: v) ??
|
|
105
99
|
v ??
|
|
106
100
|
''}
|
|
107
|
-
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
101
|
+
{/await}
|
|
102
|
+
{:else if children}
|
|
103
|
+
<div
|
|
104
|
+
class="slot-wrapper"
|
|
105
|
+
class:multifocus={focusDetails.isMultiFocused}
|
|
106
|
+
class:multifocus-start={focusDetails.isMultiFocusStart}
|
|
107
|
+
>
|
|
108
|
+
<!-- TODO {focusDetails.isMultiFocusStart} -->
|
|
109
|
+
{@render children()}
|
|
110
|
+
</div>
|
|
111
|
+
{/if}
|
|
118
112
|
</td>
|
|
119
113
|
|
|
120
114
|
<style>td {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<svelte:options runes />
|
|
2
2
|
|
|
3
|
-
<script
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
|
+
>
|
|
4
7
|
import Button from '../../../../Button.svelte';
|
|
5
8
|
import type { TableActionButton } from '../../../Types/Columns/TableActionButton.js';
|
|
6
9
|
import { getErrorMessage } from '../../../../../Helpers/Helpers.svelte.js';
|
|
@@ -14,7 +17,10 @@
|
|
|
14
17
|
}
|
|
15
18
|
</script>
|
|
16
19
|
|
|
17
|
-
<script
|
|
20
|
+
<script
|
|
21
|
+
lang="ts"
|
|
22
|
+
generics="T extends object,FilterValueType"
|
|
23
|
+
>
|
|
18
24
|
const { action, cell }: TableActionProps<T, FilterValueType> = $props();
|
|
19
25
|
|
|
20
26
|
const isEnabledPromise: boolean | Promise<boolean> = $derived.by(() => {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
const editable = $derived(
|
|
33
|
-
|
|
33
|
+
cell.column.columnDef.isEditable(cell.row.original, cell.row.originalIndex)
|
|
34
34
|
);
|
|
35
35
|
const focusDetails: TableFocusDetails<T, never> = $derived(
|
|
36
36
|
new TableFocusDetails(cell, tableContext)
|
|
@@ -38,9 +38,8 @@
|
|
|
38
38
|
|
|
39
39
|
let modalLock = $state(false);
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
tableContext.focusStart?.column === focusDetails.coordinates.column &&
|
|
41
|
+
const wantsToBeEdited = $derived(
|
|
42
|
+
tableContext.focusStart?.column === focusDetails.coordinates.column &&
|
|
44
43
|
tableContext.focusEnd?.column === focusDetails.coordinates.column &&
|
|
45
44
|
tableContext.focusStart.row === focusDetails.coordinates.row &&
|
|
46
45
|
tableContext.focusEnd.row === focusDetails.coordinates.row &&
|
|
@@ -48,10 +47,33 @@
|
|
|
48
47
|
);
|
|
49
48
|
|
|
50
49
|
$effect(() => {
|
|
51
|
-
|
|
50
|
+
void editable;
|
|
51
|
+
if (wantsToBeEdited) {
|
|
52
|
+
editable
|
|
53
|
+
.then((isEditable) => {
|
|
54
|
+
if (isEditable) {
|
|
55
|
+
return tick().then(() => {
|
|
56
|
+
modalLock = true;
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
if (modalLock) {
|
|
60
|
+
return tick().then(() => {
|
|
61
|
+
if (!tableContext.singleClickEditing) {
|
|
62
|
+
tableContext.focusStartIsBeingEdited = false;
|
|
63
|
+
}
|
|
64
|
+
modalLock = false;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
.catch(devCatch);
|
|
72
|
+
} else {
|
|
52
73
|
tick()
|
|
53
74
|
.then(() => {
|
|
54
|
-
modalLock =
|
|
75
|
+
modalLock = false;
|
|
76
|
+
tableContext.focusStartIsBeingEdited = false;
|
|
55
77
|
})
|
|
56
78
|
.catch(devCatch);
|
|
57
79
|
}
|
|
@@ -60,9 +82,9 @@
|
|
|
60
82
|
let tdref: HTMLTableCellElement | undefined = $state();
|
|
61
83
|
|
|
62
84
|
const id = $derived(`${tableContext.tableName}-cell-${cell.row.visibleIndex}-${cell.column.id}`);
|
|
63
|
-
function handleSingleClick(event?: Event) {
|
|
85
|
+
async function handleSingleClick(event?: Event) {
|
|
64
86
|
if (
|
|
65
|
-
editable &&
|
|
87
|
+
(await editable) &&
|
|
66
88
|
tableContext.singleClickEditing &&
|
|
67
89
|
(!event || !event.target || (event.target as HTMLElement).id === id)
|
|
68
90
|
) {
|
|
@@ -92,8 +114,8 @@
|
|
|
92
114
|
.catch(devCatch);
|
|
93
115
|
});
|
|
94
116
|
|
|
95
|
-
const handleDoubleClick = () => {
|
|
96
|
-
if (editable) {
|
|
117
|
+
const handleDoubleClick = async () => {
|
|
118
|
+
if (await editable) {
|
|
97
119
|
tableContext.focusStartIsBeingEdited = true;
|
|
98
120
|
}
|
|
99
121
|
};
|
|
@@ -108,11 +130,15 @@
|
|
|
108
130
|
.catch(devCatch);
|
|
109
131
|
}
|
|
110
132
|
|
|
133
|
+
function tryHandleDoubleClick() {
|
|
134
|
+
handleDoubleClick().catch(devCatch);
|
|
135
|
+
}
|
|
136
|
+
|
|
111
137
|
let prevtdref: HTMLTableCellElement | undefined = undefined;
|
|
112
138
|
$effect(() => {
|
|
113
139
|
if (tdref) {
|
|
114
140
|
if (tdref != prevtdref) {
|
|
115
|
-
tdref.addEventListener('edit',
|
|
141
|
+
tdref.addEventListener('edit', tryHandleDoubleClick);
|
|
116
142
|
} else {
|
|
117
143
|
prevtdref = tdref;
|
|
118
144
|
}
|
|
@@ -158,8 +184,12 @@
|
|
|
158
184
|
onmouseup={() => {
|
|
159
185
|
tableContext.endFocus(coordinates);
|
|
160
186
|
}}
|
|
161
|
-
onclick={
|
|
162
|
-
|
|
187
|
+
onclick={() => {
|
|
188
|
+
handleSingleClick().catch(devCatch);
|
|
189
|
+
}}
|
|
190
|
+
ondblclick={() => {
|
|
191
|
+
handleDoubleClick().catch(devCatch);
|
|
192
|
+
}}
|
|
163
193
|
>
|
|
164
194
|
{#if modalLock}
|
|
165
195
|
<DateModal
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { TableDatePickerProps } from './TableDatePickerProps.js';
|
|
2
|
-
declare function $$render<T extends object>():
|
|
2
|
+
declare function $$render<T extends object>(): {
|
|
3
3
|
props: TableDatePickerProps<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']>> & {
|
|
@@ -54,9 +54,34 @@
|
|
|
54
54
|
|
|
55
55
|
const tableContext = getContext<TableContext<T, never>>(TableContext.identifier);
|
|
56
56
|
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const editableAsync = $derived(
|
|
58
|
+
cell.column.columnDef.isEditable(cell.row.original, cell.row.originalIndex)
|
|
59
59
|
);
|
|
60
|
+
let editable = $state(false);
|
|
61
|
+
let asyncCounter = 0;
|
|
62
|
+
$effect(() => {
|
|
63
|
+
void editableAsync;
|
|
64
|
+
const localCounter = (asyncCounter = asyncCounter + 1);
|
|
65
|
+
(async () => {
|
|
66
|
+
try {
|
|
67
|
+
const isEditable = await editableAsync;
|
|
68
|
+
if (asyncCounter === localCounter) {
|
|
69
|
+
editable = isEditable;
|
|
70
|
+
} else if (cell.column.columnDef.debug) {
|
|
71
|
+
console.log('skipping async editable because it is stale');
|
|
72
|
+
}
|
|
73
|
+
} catch (e) {
|
|
74
|
+
if (cell.column.columnDef.debug) {
|
|
75
|
+
console.error(e);
|
|
76
|
+
}
|
|
77
|
+
if (asyncCounter === localCounter) {
|
|
78
|
+
editable = false;
|
|
79
|
+
} else if (cell.column.columnDef.debug) {
|
|
80
|
+
console.log('skipping async editable because it is stale');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
})().catch(devCatch);
|
|
84
|
+
});
|
|
60
85
|
|
|
61
86
|
const focusDetails: TableFocusDetails<T, never> = $derived(
|
|
62
87
|
new TableFocusDetails(cell, tableContext)
|
|
@@ -2,19 +2,19 @@ export interface TableNumberInputProps<T extends object> {
|
|
|
2
2
|
cell: TableCell<T>;
|
|
3
3
|
}
|
|
4
4
|
import type { TableCell } from '../../../Types/Columns/TableCell.js';
|
|
5
|
-
declare function $$render<T extends object>():
|
|
5
|
+
declare function $$render<T extends object>(): {
|
|
6
6
|
props: TableNumberInputProps<T>;
|
|
7
7
|
exports: {};
|
|
8
8
|
bindings: "";
|
|
9
9
|
slots: {};
|
|
10
10
|
events: {};
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
declare class __sveltets_Render<T extends object> {
|
|
13
|
-
props():
|
|
14
|
-
events():
|
|
15
|
-
slots():
|
|
13
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
14
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
15
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
16
16
|
bindings(): "";
|
|
17
|
-
exports():
|
|
17
|
+
exports(): {};
|
|
18
18
|
}
|
|
19
19
|
interface $$IsomorphicComponent {
|
|
20
20
|
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']>> & {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type { QueryDef } from '../../../Types/Columns/Definitions/Accessors/QueryDef.svelte.js';
|
|
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
14
|
import { getContext, tick, untrack } from 'svelte';
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
const tableContext = getContext<TableContext<T, never>>(TableContext.identifier);
|
|
33
33
|
|
|
34
34
|
const editable = $derived(
|
|
35
|
-
|
|
35
|
+
cell.column.columnDef.isEditable(cell.row.original, cell.row.originalIndex)
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
let valueAsyncCounter = 0;
|
|
@@ -89,7 +89,9 @@
|
|
|
89
89
|
|
|
90
90
|
let isBeingEdited = $state(false);
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
/*
|
|
93
|
+
$effect(() => {
|
|
94
|
+
void editable;
|
|
93
95
|
if (wantsToBeEdited) {
|
|
94
96
|
if (editable) {
|
|
95
97
|
tick()
|
|
@@ -124,6 +126,42 @@
|
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
});
|
|
129
|
+
*/
|
|
130
|
+
$effect(() => {
|
|
131
|
+
void editable;
|
|
132
|
+
if (wantsToBeEdited) {
|
|
133
|
+
editable
|
|
134
|
+
.then((isEditable) => {
|
|
135
|
+
if (isEditable) {
|
|
136
|
+
return tick().then(() => {
|
|
137
|
+
isBeingEdited = true;
|
|
138
|
+
});
|
|
139
|
+
} else {
|
|
140
|
+
if (isBeingEdited) {
|
|
141
|
+
return tick()
|
|
142
|
+
.then(() => {
|
|
143
|
+
if (!tableContext.singleClickEditing) {
|
|
144
|
+
tableContext.focusStartIsBeingEdited = false;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
isBeingEdited = false;
|
|
148
|
+
})
|
|
149
|
+
.catch(devCatch);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return;
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
.catch(devCatch);
|
|
157
|
+
} else {
|
|
158
|
+
tick()
|
|
159
|
+
.then(() => {
|
|
160
|
+
tableContext.focusStartIsBeingEdited = false;
|
|
161
|
+
})
|
|
162
|
+
.catch(devCatch);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
127
165
|
|
|
128
166
|
let validity: Validity = $state(Validity.Valid);
|
|
129
167
|
$effect(() => {
|
|
@@ -142,9 +180,9 @@
|
|
|
142
180
|
.catch(devCatch);
|
|
143
181
|
});
|
|
144
182
|
|
|
145
|
-
const handleTDFocus = () => {
|
|
183
|
+
const handleTDFocus = async () => {
|
|
146
184
|
if (
|
|
147
|
-
editable &&
|
|
185
|
+
(await editable) &&
|
|
148
186
|
tableContext.focusStart?.column === focusDetails.coordinates.column &&
|
|
149
187
|
tableContext.focusStart.row === focusDetails.coordinates.row
|
|
150
188
|
) {
|
|
@@ -163,11 +201,15 @@
|
|
|
163
201
|
return false;
|
|
164
202
|
};
|
|
165
203
|
|
|
166
|
-
function handleSingleClick() {
|
|
167
|
-
return tableContext.singleClickEditing && handleTDFocus();
|
|
204
|
+
async function handleSingleClick(): Promise<boolean> {
|
|
205
|
+
return tableContext.singleClickEditing && (await handleTDFocus());
|
|
168
206
|
}
|
|
169
|
-
function handleDoubleClick() {
|
|
170
|
-
return !tableContext.singleClickEditing && handleTDFocus();
|
|
207
|
+
async function handleDoubleClick(): Promise<boolean> {
|
|
208
|
+
return !tableContext.singleClickEditing && (await handleTDFocus());
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function tryHandleTDFocus() {
|
|
212
|
+
handleTDFocus().catch(devCatch);
|
|
171
213
|
}
|
|
172
214
|
|
|
173
215
|
function handleUnfocus(e: KeyboardEvent) {
|
|
@@ -222,7 +264,7 @@
|
|
|
222
264
|
void tdref;
|
|
223
265
|
untrack(() => {
|
|
224
266
|
if (tdref && tdref != prevtdref) {
|
|
225
|
-
tdref.addEventListener('edit',
|
|
267
|
+
tdref.addEventListener('edit', tryHandleTDFocus);
|
|
226
268
|
} else {
|
|
227
269
|
prevtdref = tdref;
|
|
228
270
|
}
|
|
@@ -300,14 +342,17 @@
|
|
|
300
342
|
}
|
|
301
343
|
}}
|
|
302
344
|
onmouseup={() => {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
345
|
+
handleSingleClick()
|
|
346
|
+
.then((wasHandled) => {
|
|
347
|
+
if (!wasHandled) {
|
|
348
|
+
tableContext.endFocus(focusDetails.coordinates);
|
|
349
|
+
}
|
|
350
|
+
})
|
|
351
|
+
.catch(devCatch);
|
|
307
352
|
}}
|
|
308
353
|
>
|
|
309
354
|
{#await visibleValue}
|
|
310
|
-
|
|
355
|
+
{loadingText}
|
|
311
356
|
{:then v}
|
|
312
357
|
{v}
|
|
313
358
|
{/await}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { TableQuerySelectProps } from './TableQuerySelectProps.js';
|
|
2
|
-
declare function $$render<T extends object>():
|
|
2
|
+
declare function $$render<T extends object>(): {
|
|
3
3
|
props: TableQuerySelectProps<T, unknown>;
|
|
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']>> & {
|