@lavalogic/scoria 0.40.13 → 0.40.15
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/README.md +58 -58
- package/dist/Components/AccordionGroup.svelte +35 -46
- package/dist/Components/AccordionGroupButton.svelte +68 -76
- package/dist/Components/Action.svelte +103 -135
- package/dist/Components/AlertModal.svelte +171 -190
- package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +614 -697
- package/dist/Components/Base/BaseModal.svelte +90 -116
- package/dist/Components/Base/ContextWrapper.svelte +67 -72
- package/dist/Components/Base/Pagination.svelte +173 -196
- package/dist/Components/Base/Snippets.svelte +34 -36
- package/dist/Components/BigRadioSet.svelte +36 -38
- package/dist/Components/Bubble.svelte +78 -101
- package/dist/Components/Button.svelte +175 -208
- package/dist/Components/Checkbox.svelte +75 -86
- package/dist/Components/CollapsibleCard.svelte +72 -87
- package/dist/Components/CollapsibleMenuGroup.svelte +53 -57
- package/dist/Components/ConditionBuilder/ConditionBuilder.svelte +39 -64
- package/dist/Components/Contexts/ContextMenu.svelte +141 -156
- package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
- package/dist/Components/Contexts/ContextMenuOption.svelte +53 -60
- package/dist/Components/Contexts/Toast.svelte +81 -86
- package/dist/Components/Contexts/ToastContainer.svelte +58 -62
- package/dist/Components/Contexts/Tooltip.svelte +36 -37
- package/dist/Components/DataMatrixIcon.svelte +95 -108
- package/dist/Components/DateInput.svelte +118 -146
- package/dist/Components/DatePicker.svelte +255 -294
- package/dist/Components/DesktopModal.svelte +70 -90
- package/dist/Components/Dial.svelte +167 -197
- package/dist/Components/DimensionInput.svelte +124 -169
- package/dist/Components/DragMenu/DragMenuHolder.svelte +98 -114
- package/dist/Components/DragMenu/DraggableCard.svelte +64 -76
- package/dist/Components/FileCard.svelte +21 -24
- package/dist/Components/FileUpload.svelte +190 -225
- package/dist/Components/GridInput.svelte +159 -196
- package/dist/Components/GridInputSet.svelte +24 -29
- package/dist/Components/HorizontalTabGroup.svelte +73 -89
- package/dist/Components/HorizontalTabGroupButton.svelte +40 -44
- package/dist/Components/Icon.svelte +99 -128
- package/dist/Components/Icons.js +357 -357
- package/dist/Components/InfoAlert.svelte +35 -38
- package/dist/Components/LoadingAnimation.svelte +691 -755
- package/dist/Components/LoadingModal.svelte +36 -44
- package/dist/Components/LoadingOverlay.svelte +22 -26
- package/dist/Components/Modal.svelte +204 -254
- package/dist/Components/MultiSelect.svelte +186 -216
- package/dist/Components/Nav/Nav.svelte +94 -110
- package/dist/Components/Nav/NavServiceMenuList.svelte +57 -61
- package/dist/Components/Nav/NavTab.svelte +58 -62
- package/dist/Components/Nav/ServiceMenuItem.svelte +103 -111
- package/dist/Components/Nav/ServicesNav.svelte +72 -79
- package/dist/Components/NumberInput.svelte +121 -155
- package/dist/Components/OptionCards.svelte +62 -73
- package/dist/Components/PageHeading.svelte +23 -25
- package/dist/Components/PasswordInput.svelte +69 -88
- package/dist/Components/PopoverButton.svelte +151 -0
- package/dist/Components/PopoverButton.svelte.d.ts +9 -0
- package/dist/Components/PopoverButtonProps.d.ts +21 -0
- package/dist/Components/PopoverButtonProps.js +1 -0
- package/dist/Components/Portal.svelte +29 -35
- package/dist/Components/ProgressBubble.svelte +91 -106
- package/dist/Components/QuerySelect.svelte +260 -346
- package/dist/Components/SidebarPanel.svelte +34 -36
- package/dist/Components/SingleSelect.svelte +196 -244
- package/dist/Components/StepButton.svelte +65 -70
- package/dist/Components/StepForm.svelte +115 -135
- package/dist/Components/Switch.svelte +57 -69
- package/dist/Components/Table/ARCHITECTURE.md +298 -298
- package/dist/Components/Table/Body/QuickSearchCell.svelte +578 -655
- package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +42 -51
- package/dist/Components/Table/Body/Rows/ColumnList.svelte +42 -58
- package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +403 -442
- package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +51 -78
- package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +165 -184
- package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +110 -123
- package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +134 -160
- package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +190 -231
- package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +82 -104
- package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +52 -87
- package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +122 -150
- package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +132 -159
- package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +190 -236
- package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +173 -211
- package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +204 -244
- package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +140 -177
- package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +188 -217
- package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +173 -193
- package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +166 -187
- package/dist/Components/Table/Body/Rows/TableRow.svelte +245 -288
- package/dist/Components/Table/Body/TableBody.svelte +141 -154
- package/dist/Components/Table/Headers/HighlightAllHeader.svelte +35 -41
- package/dist/Components/Table/Headers/SelectAllHeader.svelte +24 -30
- package/dist/Components/Table/Headers/TableHead.svelte +348 -402
- package/dist/Components/Table/Misc/ColumnPanel.svelte +37 -39
- package/dist/Components/Table/Misc/ColumnPanelModal.svelte +35 -39
- package/dist/Components/Table/Misc/FilterInput.svelte +556 -619
- package/dist/Components/Table/Misc/FilterPanel.svelte +170 -183
- package/dist/Components/Table/Misc/FilterPanelModal.svelte +25 -31
- package/dist/Components/Table/Misc/ShareViewModal.svelte +252 -281
- package/dist/Components/Table/Misc/SidePanel.svelte +32 -35
- package/dist/Components/Table/Misc/TableConfigurationModal.svelte +574 -629
- package/dist/Components/Table/Misc/TableFooter.svelte +326 -332
- package/dist/Components/Table/Misc/TableHorizontalBar.svelte +134 -140
- package/dist/Components/Table/Misc/TableSidebar.svelte +183 -198
- package/dist/Components/Table/Misc/TableViewDropdown.svelte +83 -103
- package/dist/Components/Table/Misc/ToolboxPanel.svelte +83 -100
- package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +88 -107
- package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +163 -190
- package/dist/Components/Table/NestedTable.svelte +102 -128
- package/dist/Components/Table/Table.svelte +531 -663
- package/dist/Components/Test/TestContextConsumer.svelte +11 -13
- package/dist/Components/TextArea.svelte +95 -130
- package/dist/Components/TextInput.svelte +125 -176
- package/dist/Components/ThreeStateRadio.svelte +111 -130
- package/dist/Components/Touch/BoolCard.svelte +33 -45
- package/dist/Components/Touch/DateModal.svelte +164 -204
- package/dist/Components/Touch/EditCard.svelte +48 -59
- package/dist/Components/Touch/InfoCard.svelte +28 -31
- package/dist/Components/Touch/InfoTextCard.svelte +26 -28
- package/dist/Components/Touch/ModalExplanation.svelte +15 -17
- package/dist/Components/Touch/NumberKeyboard.svelte +181 -218
- package/dist/Components/Touch/NumberModal.svelte +59 -79
- package/dist/Components/Touch/PlusMinusCard.svelte +43 -46
- package/dist/Components/Touch/SelectModal.svelte +111 -126
- package/dist/Components/Touch/SummaryCard.svelte +80 -93
- package/dist/Components/Touch/TextAreaModal.svelte +72 -94
- package/dist/Components/Touch/TextModal.svelte +77 -105
- package/dist/Components/Touch/TouchCard.svelte +31 -33
- package/dist/Components/Touch/TouchModal.svelte +214 -270
- package/dist/Components/Touch/UtilityButton.svelte +88 -109
- package/dist/Components/VerticalTabGroup.svelte +60 -78
- package/dist/Components/VerticalTabGroupButton.svelte +54 -58
- package/dist/Helpers/Datamatrix.d.ts +19 -19
- package/dist/Helpers/Datamatrix.js +291 -291
- package/dist/Types/Examples/ExampleModal.svelte +31 -35
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/scss/_basics.scss +12 -12
- package/dist/scss/_colours.scss +134 -134
- package/dist/scss/_mixins.scss +3392 -3392
- package/dist/scss/_motion.scss +57 -57
- package/dist/scss/_sizing.scss +85 -85
- package/dist/scss/_transitions.scss +8 -8
- package/package.json +1 -1
|
@@ -1,126 +1,113 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
generics="T extends object, FilterValueType, RowIdType extends Primitive"
|
|
6
|
-
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
let validity: Validity = $state(Validity.Valid);
|
|
34
|
-
$effect(() => {
|
|
35
|
-
const validityPromise = focusDetails.validity;
|
|
36
|
-
|
|
37
|
-
validityPromise
|
|
38
|
-
.then((v) => {
|
|
39
|
-
if (!v) {
|
|
40
|
-
validity = Validity.Neutral;
|
|
41
|
-
} else if (isValidityTuple(v)) {
|
|
42
|
-
validity = v.value;
|
|
43
|
-
} else {
|
|
44
|
-
validity = v;
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
.catch(devCatch);
|
|
48
|
-
});
|
|
49
|
-
</script>
|
|
50
|
-
|
|
51
|
-
<!-- svelte-ignore a11y_mouse_events_have_key_events -->
|
|
52
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
53
|
-
<div
|
|
54
|
-
id={`${tableContext.tableName}-cell-${cell.row.visibleIndex}-${cell.column.id}`}
|
|
55
|
-
tabIndex={0}
|
|
56
|
-
class="focusable"
|
|
57
|
-
class:multifocus={focusDetails.isMultiFocused}
|
|
58
|
-
class:multifocus-start={focusDetails.isMultiFocusStart}
|
|
59
|
-
style={focusDetails.outline}
|
|
60
|
-
class:info={validity == Validity.Info}
|
|
61
|
-
class:success={validity == Validity.Valid}
|
|
62
|
-
class:warning={validity == Validity.Warning}
|
|
63
|
-
class:error={validity == Validity.Invalid}
|
|
64
|
-
onmousedown={(e) => {
|
|
65
|
-
// start focus only on left click
|
|
66
|
-
if (e.button === 0) {
|
|
67
|
-
if (e.shiftKey) {
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
tableContext.setFocusEnd(focusDetails.coordinates);
|
|
70
|
-
} else {
|
|
71
|
-
tableContext.startFocus(focusDetails.coordinates);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}}
|
|
75
|
-
onmouseover={() => {
|
|
76
|
-
if (tableContext.isMousingDown) {
|
|
77
|
-
tableContext.setFocusEnd(focusDetails.coordinates);
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="T extends object, FilterValueType, RowIdType extends Primitive"
|
|
6
|
+
>import Bubble from "../../../../Bubble.svelte";
|
|
7
|
+
import { BubbleDef } from "../../../Types/Columns/Definitions/Display/BubbleDef.svelte.js";
|
|
8
|
+
import { TableContext } from "../../../Types/Context/TableContext.svelte.js";
|
|
9
|
+
import "../../../Types/Context/TableInitOptions.js";
|
|
10
|
+
import { devCatch, isValidityTuple } from "../../../../../Helpers/Helpers.svelte.js";
|
|
11
|
+
import { Validity } from "../../../../../Types/Internal/Validity.js";
|
|
12
|
+
import { getContext } from "svelte";
|
|
13
|
+
const { cell } = $props();
|
|
14
|
+
/**
|
|
15
|
+
* Awaited or sync array of string labels to render as Bubble chips.
|
|
16
|
+
* The cast is required because `BubbleDef` does not yet carry a
|
|
17
|
+
* narrowed `TValue` generic and the dispatch passes the loose
|
|
18
|
+
* `TableCell` rather than `BubbleTableCell<T, FilterValueType>`.
|
|
19
|
+
*/
|
|
20
|
+
const values = $derived(cell.getValue());
|
|
21
|
+
const tableContext = getContext(TableContext.identifier);
|
|
22
|
+
const focusDetails = $derived(tableContext._focus.getFocusDetailsFor(cell));
|
|
23
|
+
let validity = $state(Validity.Valid);
|
|
24
|
+
$effect(() => {
|
|
25
|
+
const validityPromise = focusDetails.validity;
|
|
26
|
+
validityPromise.then((v) => {
|
|
27
|
+
if (!v) {
|
|
28
|
+
validity = Validity.Neutral;
|
|
29
|
+
} else if (isValidityTuple(v)) {
|
|
30
|
+
validity = v.value;
|
|
31
|
+
} else {
|
|
32
|
+
validity = v;
|
|
78
33
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
34
|
+
}).catch(devCatch);
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<!-- svelte-ignore a11y_mouse_events_have_key_events -->
|
|
39
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
40
|
+
<div
|
|
41
|
+
id={`${tableContext.tableName}-cell-${cell.row.visibleIndex}-${cell.column.id}`}
|
|
42
|
+
tabIndex={0}
|
|
43
|
+
class="focusable"
|
|
44
|
+
class:multifocus={focusDetails.isMultiFocused}
|
|
45
|
+
class:multifocus-start={focusDetails.isMultiFocusStart}
|
|
46
|
+
style={focusDetails.outline}
|
|
47
|
+
class:info={validity == Validity.Info}
|
|
48
|
+
class:success={validity == Validity.Valid}
|
|
49
|
+
class:warning={validity == Validity.Warning}
|
|
50
|
+
class:error={validity == Validity.Invalid}
|
|
51
|
+
onmousedown={(e) => {
|
|
52
|
+
// start focus only on left click
|
|
53
|
+
if (e.button === 0) {
|
|
54
|
+
if (e.shiftKey) {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
tableContext.setFocusEnd(focusDetails.coordinates);
|
|
57
|
+
} else {
|
|
58
|
+
tableContext.startFocus(focusDetails.coordinates);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}}
|
|
62
|
+
onmouseover={() => {
|
|
63
|
+
if (tableContext.isMousingDown) {
|
|
64
|
+
tableContext.setFocusEnd(focusDetails.coordinates);
|
|
65
|
+
}
|
|
66
|
+
}}
|
|
67
|
+
onmouseup={() => {
|
|
68
|
+
tableContext.endFocus(focusDetails.coordinates);
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<div class="bubble-parent">
|
|
72
|
+
{#await values then values}
|
|
73
|
+
<!-- `maxBubbles` (default 3) caps how many pills render inline;
|
|
74
|
+
anything beyond gets a single `"+N more"` overflow chip with
|
|
75
|
+
the hidden labels as a hover tooltip. Key combines index and
|
|
76
|
+
value because duplicate labels would otherwise collapse and
|
|
77
|
+
reordering with identical labels would force unrelated
|
|
78
|
+
bubbles to swap. -->
|
|
79
|
+
{@const maxBubbles = (cell.column.columnDef as BubbleDef<T>).maxBubbles ?? 3}
|
|
80
|
+
{@const visibleBubbles = values.slice(0, maxBubbles)}
|
|
81
|
+
{@const overflowCount = Math.max(0, values.length - maxBubbles)}
|
|
82
|
+
{@const overflowTitle = values.slice(maxBubbles).join(', ')}
|
|
83
|
+
{#each visibleBubbles as value, index (`${index}:${value}`)}
|
|
84
|
+
{@const colourPromise = (cell.column.columnDef as BubbleDef<T>).getColour?.(
|
|
85
|
+
cell.row.original,
|
|
86
|
+
cell.row.originalIndex,
|
|
87
|
+
value
|
|
88
|
+
)}
|
|
89
|
+
|
|
90
|
+
{#if colourPromise == undefined}
|
|
91
|
+
<Bubble {value} />
|
|
92
|
+
{:else}
|
|
93
|
+
{#await colourPromise then colour}
|
|
94
|
+
<Bubble
|
|
95
|
+
{value}
|
|
96
|
+
colours={colour ?? undefined}
|
|
97
|
+
/>
|
|
98
|
+
{/await}
|
|
99
|
+
{/if}
|
|
100
|
+
{/each}
|
|
101
|
+
{#if overflowCount > 0}
|
|
102
|
+
<span
|
|
103
|
+
class="bubble-overflow"
|
|
104
|
+
title={overflowTitle}
|
|
105
|
+
>+{overflowCount} more</span>
|
|
106
|
+
{/if}
|
|
107
|
+
{/await}
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
124
111
|
<style>.focusable,
|
|
125
112
|
.checkbox-cell,
|
|
126
113
|
.input-cell,
|
|
@@ -218,4 +205,4 @@ div.bubble-parent {
|
|
|
218
205
|
font-weight: 500;
|
|
219
206
|
white-space: nowrap;
|
|
220
207
|
cursor: default;
|
|
221
|
-
}</style>
|
|
208
|
+
}</style>
|
|
@@ -1,165 +1,139 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
generics="T extends object, R extends object,FilterValueType, IdType extends Primitive"
|
|
6
|
-
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// Per-row toggle visibility. When `isVisible` resolves false the toggle is
|
|
34
|
-
// omitted entirely (rather than disabled). Sync booleans are used directly
|
|
35
|
-
// so non-visible rows never flash the icon; promises resolve into state.
|
|
36
|
-
const visibleRaw: boolean | Promise<boolean> = $derived(
|
|
37
|
-
cell.column.columnDef.isVisible
|
|
38
|
-
? cell.column.columnDef.isVisible(cell.row.original, cell.row.originalIndex)
|
|
39
|
-
: true
|
|
40
|
-
);
|
|
41
|
-
let visibleAsyncResolved = $state(true);
|
|
42
|
-
let visibleCounter = 0;
|
|
43
|
-
$effect(() => {
|
|
44
|
-
const raw = visibleRaw;
|
|
45
|
-
if (typeof raw === 'boolean') {
|
|
46
|
-
return;
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
generics="T extends object, R extends object,FilterValueType, IdType extends Primitive"
|
|
6
|
+
>import Action from "../../../../Action.svelte";
|
|
7
|
+
import { TableContext } from "../../../Types/Context/TableContext.svelte.js";
|
|
8
|
+
import { devCatch, isValidityTuple } from "../../../../../Helpers/Helpers.svelte.js";
|
|
9
|
+
import { ColourSet } from "../../../../../scss/colours.js";
|
|
10
|
+
import { Size } from "../../../../../Types/Internal/Size.js";
|
|
11
|
+
import { Validity } from "../../../../../Types/Internal/Validity.js";
|
|
12
|
+
import { getContext } from "svelte";
|
|
13
|
+
const { cell, expandedColumnDef, onExpandChange } = $props();
|
|
14
|
+
const tableContext = getContext(TableContext.identifier);
|
|
15
|
+
const focusDetails = $derived(tableContext._focus.getFocusDetailsFor(cell));
|
|
16
|
+
const enabled = $derived(cell.column.columnDef.isEnabled(cell.row.original, cell.row.originalIndex));
|
|
17
|
+
// Per-row toggle visibility. When `isVisible` resolves false the toggle is
|
|
18
|
+
// omitted entirely (rather than disabled). Sync booleans are used directly
|
|
19
|
+
// so non-visible rows never flash the icon; promises resolve into state.
|
|
20
|
+
const visibleRaw = $derived(cell.column.columnDef.isVisible ? cell.column.columnDef.isVisible(cell.row.original, cell.row.originalIndex) : true);
|
|
21
|
+
let visibleAsyncResolved = $state(true);
|
|
22
|
+
let visibleCounter = 0;
|
|
23
|
+
$effect(() => {
|
|
24
|
+
const raw = visibleRaw;
|
|
25
|
+
if (typeof raw === "boolean") {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const local = visibleCounter = visibleCounter + 1;
|
|
29
|
+
raw.then((v) => {
|
|
30
|
+
if (visibleCounter === local) {
|
|
31
|
+
visibleAsyncResolved = v;
|
|
47
32
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (visibleCounter === local) {
|
|
52
|
-
visibleAsyncResolved = v;
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
.catch(() => {
|
|
56
|
-
if (visibleCounter === local) {
|
|
57
|
-
visibleAsyncResolved = false;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
const visible = $derived(typeof visibleRaw === 'boolean' ? visibleRaw : visibleAsyncResolved);
|
|
62
|
-
|
|
63
|
-
let validity: Validity = $state(Validity.Valid);
|
|
64
|
-
$effect(() => {
|
|
65
|
-
const validityPromise = focusDetails.validity;
|
|
66
|
-
|
|
67
|
-
validityPromise
|
|
68
|
-
.then((v) => {
|
|
69
|
-
if (!v) {
|
|
70
|
-
validity = Validity.Neutral;
|
|
71
|
-
} else if (isValidityTuple(v)) {
|
|
72
|
-
validity = v.value;
|
|
73
|
-
} else {
|
|
74
|
-
validity = v;
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
.catch(devCatch);
|
|
78
|
-
});
|
|
79
|
-
</script>
|
|
80
|
-
|
|
81
|
-
<!-- svelte-ignore a11y_mouse_events_have_key_events -->
|
|
82
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
83
|
-
<div
|
|
84
|
-
class:info={validity == Validity.Info}
|
|
85
|
-
class:success={validity == Validity.Valid}
|
|
86
|
-
class:warning={validity == Validity.Warning}
|
|
87
|
-
class:error={validity == Validity.Invalid}
|
|
88
|
-
class="focusable"
|
|
89
|
-
onmousedown={(e) => {
|
|
90
|
-
// start focus only on left click
|
|
91
|
-
if (e.button === 0) {
|
|
92
|
-
if (e.shiftKey) {
|
|
93
|
-
e.preventDefault();
|
|
94
|
-
tableContext.setFocusEnd(focusDetails.coordinates);
|
|
95
|
-
} else {
|
|
96
|
-
tableContext.startFocus(focusDetails.coordinates);
|
|
97
|
-
}
|
|
33
|
+
}).catch(() => {
|
|
34
|
+
if (visibleCounter === local) {
|
|
35
|
+
visibleAsyncResolved = false;
|
|
98
36
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
const visible = $derived(typeof visibleRaw === "boolean" ? visibleRaw : visibleAsyncResolved);
|
|
40
|
+
let validity = $state(Validity.Valid);
|
|
41
|
+
$effect(() => {
|
|
42
|
+
const validityPromise = focusDetails.validity;
|
|
43
|
+
validityPromise.then((v) => {
|
|
44
|
+
if (!v) {
|
|
45
|
+
validity = Validity.Neutral;
|
|
46
|
+
} else if (isValidityTuple(v)) {
|
|
47
|
+
validity = v.value;
|
|
48
|
+
} else {
|
|
49
|
+
validity = v;
|
|
103
50
|
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
|
|
51
|
+
}).catch(devCatch);
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<!-- svelte-ignore a11y_mouse_events_have_key_events -->
|
|
56
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
57
|
+
<div
|
|
58
|
+
class:info={validity == Validity.Info}
|
|
59
|
+
class:success={validity == Validity.Valid}
|
|
60
|
+
class:warning={validity == Validity.Warning}
|
|
61
|
+
class:error={validity == Validity.Invalid}
|
|
62
|
+
class="focusable"
|
|
63
|
+
onmousedown={(e) => {
|
|
64
|
+
// start focus only on left click
|
|
65
|
+
if (e.button === 0) {
|
|
66
|
+
if (e.shiftKey) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
tableContext.setFocusEnd(focusDetails.coordinates);
|
|
69
|
+
} else {
|
|
70
|
+
tableContext.startFocus(focusDetails.coordinates);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}}
|
|
74
|
+
onmouseover={() => {
|
|
75
|
+
if (tableContext.isMousingDown) {
|
|
76
|
+
tableContext.setFocusEnd(focusDetails.coordinates);
|
|
77
|
+
}
|
|
78
|
+
}}
|
|
79
|
+
onmouseup={() => {
|
|
80
|
+
tableContext.endFocus(focusDetails.coordinates);
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<div
|
|
84
|
+
class="slot-wrapper"
|
|
85
|
+
class:multifocus={focusDetails.isMultiFocused}
|
|
86
|
+
class:multifocus-start={focusDetails.isMultiFocusStart}
|
|
87
|
+
>
|
|
88
|
+
{#if visible}
|
|
89
|
+
{#await enabled}
|
|
90
|
+
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
91
|
+
{@render action(false)}
|
|
92
|
+
{:then enabled}
|
|
93
|
+
<!-- eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -->
|
|
94
|
+
{@render action(enabled)}
|
|
95
|
+
{/await}
|
|
96
|
+
{/if}
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
{#snippet action(enabled: boolean)}
|
|
101
|
+
<div class="noninteractive">
|
|
102
|
+
<Action
|
|
103
|
+
id={`${tableContext.tableName}-cell-${cell.row.visibleIndex}-${cell.column.id}`}
|
|
104
|
+
style={focusDetails.outline}
|
|
105
|
+
disabled={!enabled}
|
|
106
|
+
border={false}
|
|
107
|
+
label={cell.column.columnDef.onActivate ? 'Open Related Table' : 'Expand Nested Table'}
|
|
108
|
+
size={Size.FillWidth}
|
|
109
|
+
icon={{
|
|
110
|
+
name:
|
|
111
|
+
!cell.column.columnDef.onActivate &&
|
|
112
|
+
expandedColumnDef?.id === cell.column.columnDef.id
|
|
113
|
+
? 'minus'
|
|
114
|
+
: 'plus',
|
|
115
|
+
size: Size.Medium,
|
|
116
|
+
}}
|
|
117
|
+
colourSet={expandedColumnDef?.id === cell.column.columnDef.id && !cell.column.columnDef.onActivate
|
|
118
|
+
? ColourSet.Primary
|
|
119
|
+
: ColourSet.Auxiliary}
|
|
120
|
+
onclick={(e: MouseEvent) => {
|
|
121
|
+
// FIXME why is this required? svelte bug?
|
|
122
|
+
e.stopImmediatePropagation();
|
|
123
|
+
// Navigate-instead-of-expand: when the column carries an
|
|
124
|
+
// `onActivate`, drive the consumer's drill-down rather than
|
|
125
|
+
// mounting an inner table.
|
|
126
|
+
const onActivate = cell.column.columnDef.onActivate;
|
|
127
|
+
if (onActivate) {
|
|
128
|
+
void onActivate(cell.row.original);
|
|
129
|
+
} else {
|
|
130
|
+
onExpandChange(cell.column.columnDef);
|
|
131
|
+
}
|
|
132
|
+
}}
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
{/snippet}
|
|
136
|
+
|
|
163
137
|
<style>.focusable,
|
|
164
138
|
.checkbox-cell,
|
|
165
139
|
.input-cell,
|
|
@@ -242,4 +216,4 @@ div.slot-wrapper {
|
|
|
242
216
|
.noninteractive {
|
|
243
217
|
display: contents;
|
|
244
218
|
user-select: none;
|
|
245
|
-
}</style>
|
|
219
|
+
}</style>
|