@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.
Files changed (143) hide show
  1. package/README.md +58 -58
  2. package/dist/Components/AccordionGroup.svelte +35 -46
  3. package/dist/Components/AccordionGroupButton.svelte +68 -76
  4. package/dist/Components/Action.svelte +103 -135
  5. package/dist/Components/AlertModal.svelte +171 -190
  6. package/dist/Components/AppointmentCalendar/AppointmentCalendar.svelte +614 -697
  7. package/dist/Components/Base/BaseModal.svelte +90 -116
  8. package/dist/Components/Base/ContextWrapper.svelte +67 -72
  9. package/dist/Components/Base/Pagination.svelte +173 -196
  10. package/dist/Components/Base/Snippets.svelte +34 -36
  11. package/dist/Components/BigRadioSet.svelte +36 -38
  12. package/dist/Components/Bubble.svelte +78 -101
  13. package/dist/Components/Button.svelte +175 -208
  14. package/dist/Components/Checkbox.svelte +75 -86
  15. package/dist/Components/CollapsibleCard.svelte +72 -87
  16. package/dist/Components/CollapsibleMenuGroup.svelte +53 -57
  17. package/dist/Components/ConditionBuilder/ConditionBuilder.svelte +39 -64
  18. package/dist/Components/Contexts/ContextMenu.svelte +141 -156
  19. package/dist/Components/Contexts/ContextMenuDivider.svelte +15 -15
  20. package/dist/Components/Contexts/ContextMenuOption.svelte +53 -60
  21. package/dist/Components/Contexts/Toast.svelte +81 -86
  22. package/dist/Components/Contexts/ToastContainer.svelte +58 -62
  23. package/dist/Components/Contexts/Tooltip.svelte +36 -37
  24. package/dist/Components/DataMatrixIcon.svelte +95 -108
  25. package/dist/Components/DateInput.svelte +118 -146
  26. package/dist/Components/DatePicker.svelte +255 -294
  27. package/dist/Components/DesktopModal.svelte +70 -90
  28. package/dist/Components/Dial.svelte +167 -197
  29. package/dist/Components/DimensionInput.svelte +124 -169
  30. package/dist/Components/DragMenu/DragMenuHolder.svelte +98 -114
  31. package/dist/Components/DragMenu/DraggableCard.svelte +64 -76
  32. package/dist/Components/FileCard.svelte +21 -24
  33. package/dist/Components/FileUpload.svelte +190 -225
  34. package/dist/Components/GridInput.svelte +159 -196
  35. package/dist/Components/GridInputSet.svelte +24 -29
  36. package/dist/Components/HorizontalTabGroup.svelte +73 -89
  37. package/dist/Components/HorizontalTabGroupButton.svelte +40 -44
  38. package/dist/Components/Icon.svelte +99 -128
  39. package/dist/Components/Icons.js +357 -357
  40. package/dist/Components/InfoAlert.svelte +35 -38
  41. package/dist/Components/LoadingAnimation.svelte +691 -755
  42. package/dist/Components/LoadingModal.svelte +36 -44
  43. package/dist/Components/LoadingOverlay.svelte +22 -26
  44. package/dist/Components/Modal.svelte +204 -254
  45. package/dist/Components/MultiSelect.svelte +186 -216
  46. package/dist/Components/Nav/Nav.svelte +94 -110
  47. package/dist/Components/Nav/NavServiceMenuList.svelte +57 -61
  48. package/dist/Components/Nav/NavTab.svelte +58 -62
  49. package/dist/Components/Nav/ServiceMenuItem.svelte +103 -111
  50. package/dist/Components/Nav/ServicesNav.svelte +72 -79
  51. package/dist/Components/NumberInput.svelte +121 -155
  52. package/dist/Components/OptionCards.svelte +62 -73
  53. package/dist/Components/PageHeading.svelte +23 -25
  54. package/dist/Components/PasswordInput.svelte +69 -88
  55. package/dist/Components/PopoverButton.svelte +151 -0
  56. package/dist/Components/PopoverButton.svelte.d.ts +9 -0
  57. package/dist/Components/PopoverButtonProps.d.ts +21 -0
  58. package/dist/Components/PopoverButtonProps.js +1 -0
  59. package/dist/Components/Portal.svelte +29 -35
  60. package/dist/Components/ProgressBubble.svelte +91 -106
  61. package/dist/Components/QuerySelect.svelte +260 -346
  62. package/dist/Components/SidebarPanel.svelte +34 -36
  63. package/dist/Components/SingleSelect.svelte +196 -244
  64. package/dist/Components/StepButton.svelte +65 -70
  65. package/dist/Components/StepForm.svelte +115 -135
  66. package/dist/Components/Switch.svelte +57 -69
  67. package/dist/Components/Table/ARCHITECTURE.md +298 -298
  68. package/dist/Components/Table/Body/QuickSearchCell.svelte +578 -655
  69. package/dist/Components/Table/Body/Rows/ColumnHighlight.svelte +42 -51
  70. package/dist/Components/Table/Body/Rows/ColumnList.svelte +42 -58
  71. package/dist/Components/Table/Body/Rows/ColumnListRow.svelte +403 -442
  72. package/dist/Components/Table/Body/Rows/Columns/AccessorComponent.svelte +51 -78
  73. package/dist/Components/Table/Body/Rows/Columns/ActionsCell.svelte +165 -184
  74. package/dist/Components/Table/Body/Rows/Columns/BubbleCell.svelte +110 -123
  75. package/dist/Components/Table/Body/Rows/Columns/ExpandCell.svelte +134 -160
  76. package/dist/Components/Table/Body/Rows/Columns/FocusableImmutableCell.svelte +190 -231
  77. package/dist/Components/Table/Body/Rows/Columns/ProgressCell.svelte +82 -104
  78. package/dist/Components/Table/Body/Rows/Columns/TableAction.svelte +52 -87
  79. package/dist/Components/Table/Body/Rows/Columns/TableCheckbox.svelte +122 -150
  80. package/dist/Components/Table/Body/Rows/Columns/TableColumn.svelte +132 -159
  81. package/dist/Components/Table/Body/Rows/Columns/TableDatePicker.svelte +190 -236
  82. package/dist/Components/Table/Body/Rows/Columns/TableNumberInput.svelte +173 -211
  83. package/dist/Components/Table/Body/Rows/Columns/TableQuerySelect.svelte +204 -244
  84. package/dist/Components/Table/Body/Rows/Columns/TableRowSelectionCheckbox.svelte +140 -177
  85. package/dist/Components/Table/Body/Rows/Columns/TableSelect.svelte +188 -217
  86. package/dist/Components/Table/Body/Rows/Columns/TableTextInput.svelte +173 -193
  87. package/dist/Components/Table/Body/Rows/Columns/ValidityCell.svelte +166 -187
  88. package/dist/Components/Table/Body/Rows/TableRow.svelte +245 -288
  89. package/dist/Components/Table/Body/TableBody.svelte +141 -154
  90. package/dist/Components/Table/Headers/HighlightAllHeader.svelte +35 -41
  91. package/dist/Components/Table/Headers/SelectAllHeader.svelte +24 -30
  92. package/dist/Components/Table/Headers/TableHead.svelte +348 -402
  93. package/dist/Components/Table/Misc/ColumnPanel.svelte +37 -39
  94. package/dist/Components/Table/Misc/ColumnPanelModal.svelte +35 -39
  95. package/dist/Components/Table/Misc/FilterInput.svelte +556 -619
  96. package/dist/Components/Table/Misc/FilterPanel.svelte +170 -183
  97. package/dist/Components/Table/Misc/FilterPanelModal.svelte +25 -31
  98. package/dist/Components/Table/Misc/ShareViewModal.svelte +252 -281
  99. package/dist/Components/Table/Misc/SidePanel.svelte +32 -35
  100. package/dist/Components/Table/Misc/TableConfigurationModal.svelte +574 -629
  101. package/dist/Components/Table/Misc/TableFooter.svelte +326 -332
  102. package/dist/Components/Table/Misc/TableHorizontalBar.svelte +134 -140
  103. package/dist/Components/Table/Misc/TableSidebar.svelte +183 -198
  104. package/dist/Components/Table/Misc/TableViewDropdown.svelte +83 -103
  105. package/dist/Components/Table/Misc/ToolboxPanel.svelte +83 -100
  106. package/dist/Components/Table/Misc/ToolboxPanelModal.svelte +88 -107
  107. package/dist/Components/Table/Misc/UpdateViewOptionsModal.svelte +163 -190
  108. package/dist/Components/Table/NestedTable.svelte +102 -128
  109. package/dist/Components/Table/Table.svelte +531 -663
  110. package/dist/Components/Test/TestContextConsumer.svelte +11 -13
  111. package/dist/Components/TextArea.svelte +95 -130
  112. package/dist/Components/TextInput.svelte +125 -176
  113. package/dist/Components/ThreeStateRadio.svelte +111 -130
  114. package/dist/Components/Touch/BoolCard.svelte +33 -45
  115. package/dist/Components/Touch/DateModal.svelte +164 -204
  116. package/dist/Components/Touch/EditCard.svelte +48 -59
  117. package/dist/Components/Touch/InfoCard.svelte +28 -31
  118. package/dist/Components/Touch/InfoTextCard.svelte +26 -28
  119. package/dist/Components/Touch/ModalExplanation.svelte +15 -17
  120. package/dist/Components/Touch/NumberKeyboard.svelte +181 -218
  121. package/dist/Components/Touch/NumberModal.svelte +59 -79
  122. package/dist/Components/Touch/PlusMinusCard.svelte +43 -46
  123. package/dist/Components/Touch/SelectModal.svelte +111 -126
  124. package/dist/Components/Touch/SummaryCard.svelte +80 -93
  125. package/dist/Components/Touch/TextAreaModal.svelte +72 -94
  126. package/dist/Components/Touch/TextModal.svelte +77 -105
  127. package/dist/Components/Touch/TouchCard.svelte +31 -33
  128. package/dist/Components/Touch/TouchModal.svelte +214 -270
  129. package/dist/Components/Touch/UtilityButton.svelte +88 -109
  130. package/dist/Components/VerticalTabGroup.svelte +60 -78
  131. package/dist/Components/VerticalTabGroupButton.svelte +54 -58
  132. package/dist/Helpers/Datamatrix.d.ts +19 -19
  133. package/dist/Helpers/Datamatrix.js +291 -291
  134. package/dist/Types/Examples/ExampleModal.svelte +31 -35
  135. package/dist/index.d.ts +2 -0
  136. package/dist/index.js +1 -0
  137. package/dist/scss/_basics.scss +12 -12
  138. package/dist/scss/_colours.scss +134 -134
  139. package/dist/scss/_mixins.scss +3392 -3392
  140. package/dist/scss/_motion.scss +57 -57
  141. package/dist/scss/_sizing.scss +85 -85
  142. package/dist/scss/_transitions.scss +8 -8
  143. package/package.json +1 -1
@@ -1,236 +1,195 @@
1
- <svelte:options runes />
2
-
3
- <script
4
- lang="ts"
5
- generics="T extends object, FilterValueType, RowIdType extends Primitive"
6
- >
7
- import type { AbstractDisplayDef } from '../../../Types/Columns/Definitions/Display/AbstractDisplayDef.svelte.js';
8
- import { TableContext } from '../../../Types/Context/TableContext.svelte.js';
9
- import { type Primitive } from '../../../Types/Context/TableInitOptions.js';
10
- import type { TableFocusDetails } from '../../../Types/Focus/TableFocusDetails.svelte.js';
11
- import {
12
- devCatch,
13
- formatDateTime,
14
- isValidityTuple,
15
- loadingText,
16
- } from '../../../../../Helpers/Helpers.svelte.js';
17
- import type { SelectOption } from '../../../../../Types/Internal/SelectOption.js';
18
- import { Validity } from '../../../../../Types/Internal/Validity.js';
19
- import { getContext, tick } from 'svelte';
20
- import type { FocusableImmutableCellProps } from './FocusableImmutableCellProps.js';
21
-
22
- const { cell, children }: FocusableImmutableCellProps<T, FilterValueType> = $props();
23
-
24
- const value = $derived(cell.getValue());
25
-
26
- /** Optional override-display value from the column def; falls back to the raw `value`. */
27
- const visibleValue = $derived(
28
- cell.column.columnDef.getDisplayValue?.(cell.row.original, cell.row.originalIndex) ?? value
29
- );
30
-
31
- /** For Date-typed display columns, expose both the local-time and UTC
32
- * representations of the raw accessor value as a multi-line tooltip.
33
- * The cell's body shows the locale-formatted value (via
34
- * `getDisplayValue`); the title attribute below lets users hover to
35
- * see Local + UTC side-by-side without expanding the column. */
36
- const dateTooltip: string | undefined = $derived.by(() => {
37
- if (cell.column.columnDef.filterValueType !== 'Date') {
38
- return undefined;
39
- }
40
- if (value == null || value === '' || value instanceof Promise) {
41
- return undefined;
42
- }
43
- let d: Date | undefined;
44
- if (value instanceof Date) {
45
- d = value;
46
- } else if (typeof value === 'string' || typeof value === 'number') {
47
- const parsed = new Date(value);
48
- if (!Number.isNaN(parsed.getTime())) {
49
- d = parsed;
50
- }
51
- }
52
- if (d == null) {
53
- return undefined;
54
- }
55
- // Both lines go through `formatDateTime` so the tooltip matches
56
- // every other date surface in the app; only the timezone differs —
57
- // the second call overrides it to UTC.
58
- return `Local: ${formatDateTime(d)}\nUTC: ${formatDateTime(d, undefined, 'UTC')}`;
59
- });
60
-
61
- const tableContext = getContext<TableContext<T, RowIdType>>(TableContext.identifier);
62
-
63
- const options: Array<SelectOption<unknown>> = $derived(
64
- ('options' in cell.column.columnDef ? cell.column.columnDef.options : []) as Array<
65
- SelectOption<unknown>
66
- >
67
- );
68
- const hasValue: boolean = $derived(value !== undefined);
69
-
70
- const focusDetails: TableFocusDetails<T, RowIdType> = $derived(
71
- tableContext._focus.getFocusDetailsFor(cell)
72
- );
73
-
74
- // `modal` lives on every `AbstractDisplayDef` subclass (Display,
75
- // Bubble, Progress, Validity), so a duck-typed read against the base
76
- // `ColumnDef` is sufficient and avoids importing the entire
77
- // AbstractDisplayDef class chain just to satisfy the type checker.
78
- const modalComponent = $derived(
79
- (cell.column.columnDef as AbstractDisplayDef<T, FilterValueType>).modal
80
- );
81
-
82
- let previousFocusElement: HTMLElement | undefined = $state();
83
- let showModal = $state(false);
84
-
85
- const thisId = $derived(
86
- `${tableContext.tableName}-cell-${cell.row.visibleIndex}-${cell.column.id}`
87
- );
88
-
89
- // Match the open-modal state by row-object identity and column id so
90
- // pagination / sort / filter does not silently re-target the modal at
91
- // a different row that happens to occupy the same visible index.
92
- $effect(() => {
93
- const target = tableContext.openModalCell;
94
- if (target !== null && target.row === cell.row.original && target.columnId === cell.column.id) {
95
- previousFocusElement = document.activeElement as HTMLElement | undefined;
96
- showModal = true;
97
- } else {
98
- showModal = false;
99
- }
100
- });
101
-
102
- function onclose() {
103
- tableContext.setOpenModalCell(null);
104
-
105
- if (previousFocusElement?.id != thisId) {
106
- tick()
107
- .then(() => {
108
- previousFocusElement?.focus();
109
- })
110
- .catch(devCatch);
111
- }
1
+ <svelte:options runes />
2
+
3
+ <script
4
+ lang="ts"
5
+ generics="T extends object, FilterValueType, RowIdType extends Primitive"
6
+ >import { TableContext } from "../../../Types/Context/TableContext.svelte.js";
7
+ import "../../../Types/Context/TableInitOptions.js";
8
+ import { devCatch, formatDateTime, isValidityTuple, loadingText } from "../../../../../Helpers/Helpers.svelte.js";
9
+ import { Validity } from "../../../../../Types/Internal/Validity.js";
10
+ import { getContext, tick } from "svelte";
11
+ const { cell, children } = $props();
12
+ const value = $derived(cell.getValue());
13
+ /** Optional override-display value from the column def; falls back to the raw `value`. */
14
+ const visibleValue = $derived(cell.column.columnDef.getDisplayValue?.(cell.row.original, cell.row.originalIndex) ?? value);
15
+ /** For Date-typed display columns, expose both the local-time and UTC
16
+ * representations of the raw accessor value as a multi-line tooltip.
17
+ * The cell's body shows the locale-formatted value (via
18
+ * `getDisplayValue`); the title attribute below lets users hover to
19
+ * see Local + UTC side-by-side without expanding the column. */
20
+ const dateTooltip = $derived.by(() => {
21
+ if (cell.column.columnDef.filterValueType !== "Date") {
22
+ return undefined;
112
23
  }
113
-
114
- let validity: Validity = $state(Validity.Valid);
115
- $effect(() => {
116
- const validityPromise = focusDetails.validity;
117
-
118
- validityPromise
119
- .then((v) => {
120
- if (!v) {
121
- validity = Validity.Neutral;
122
- } else if (isValidityTuple(v)) {
123
- validity = v.value;
124
- } else {
125
- validity = v;
126
- }
127
- })
128
- .catch(devCatch);
129
- });
130
- </script>
131
-
132
- <!-- svelte-ignore a11y_mouse_events_have_key_events -->
133
- <!-- svelte-ignore a11y_no_static_element_interactions -->
134
- <div
135
- id={thisId}
136
- class:info={validity == Validity.Info}
137
- class:success={validity == Validity.Valid}
138
- class:warning={validity == Validity.Warning}
139
- class:error={validity == Validity.Invalid}
140
- class:has-modal={!!modalComponent}
141
- tabIndex={hasValue ? 0 : undefined}
142
- class="focusable"
143
- title={dateTooltip}
144
- style={focusDetails.outline}
145
- class:multifocus={hasValue && focusDetails.isMultiFocused}
146
- class:multifocus-start={hasValue && focusDetails.isMultiFocusStart}
147
- onmousedown={(e) => {
148
- // start focus only on left click
149
- if (e.button === 0) {
150
- if (e.shiftKey) {
151
- e.preventDefault();
152
- tableContext.setFocusEnd(focusDetails.coordinates);
153
- } else {
154
- tableContext.startFocus(focusDetails.coordinates);
155
- }
156
- }
157
- }}
158
- onmouseover={() => {
159
- if (tableContext.isMousingDown) {
160
- tableContext.setFocusEnd(focusDetails.coordinates);
161
- }
162
- }}
163
- onmouseup={() => {
164
- tableContext.endFocus(focusDetails.coordinates);
165
- }}
166
- onclick={() => {
167
- // Open the per-cell modal if the column declares one. Click is
168
- // the right trigger here (focus already started on mousedown);
169
- // modal-less display cells fall through to the default focus
170
- // behaviour with no extra handler.
171
- if (modalComponent) {
172
- tableContext.setOpenModalCell({
173
- row: cell.row.original,
174
- columnId: cell.column.id,
175
- });
24
+ if (value == null || value === "" || value instanceof Promise) {
25
+ return undefined;
26
+ }
27
+ let d;
28
+ if (value instanceof Date) {
29
+ d = value;
30
+ } else if (typeof value === "string" || typeof value === "number") {
31
+ const parsed = new Date(value);
32
+ if (!Number.isNaN(parsed.getTime())) {
33
+ d = parsed;
176
34
  }
177
- }}
178
- onkeydown={(e) => {
179
- // Keyboard parity with `onclick` above: when the cell has DOM
180
- // focus (via `tabIndex`), Enter / Space opens the modal. Only
181
- // fires for columns that declare a `modal`; non-modal display
182
- // cells defer to the table's global keyboard navigation.
183
- if (modalComponent && (e.key === 'Enter' || e.key === ' ')) {
184
- e.preventDefault();
185
- tableContext.setOpenModalCell({
186
- row: cell.row.original,
187
- columnId: cell.column.id,
188
- });
35
+ }
36
+ if (d == null) {
37
+ return undefined;
38
+ }
39
+ // Both lines go through `formatDateTime` so the tooltip matches
40
+ // every other date surface in the app; only the timezone differs —
41
+ // the second call overrides it to UTC.
42
+ return `Local: ${formatDateTime(d)}\nUTC: ${formatDateTime(d, undefined, "UTC")}`;
43
+ });
44
+ const tableContext = getContext(TableContext.identifier);
45
+ const options = $derived("options" in cell.column.columnDef ? cell.column.columnDef.options : []);
46
+ const hasValue = $derived(value !== undefined);
47
+ const focusDetails = $derived(tableContext._focus.getFocusDetailsFor(cell));
48
+ // `modal` lives on every `AbstractDisplayDef` subclass (Display,
49
+ // Bubble, Progress, Validity), so a duck-typed read against the base
50
+ // `ColumnDef` is sufficient and avoids importing the entire
51
+ // AbstractDisplayDef class chain just to satisfy the type checker.
52
+ const modalComponent = $derived(cell.column.columnDef.modal);
53
+ let previousFocusElement = $state();
54
+ let showModal = $state(false);
55
+ const thisId = $derived(`${tableContext.tableName}-cell-${cell.row.visibleIndex}-${cell.column.id}`);
56
+ // Match the open-modal state by row-object identity and column id so
57
+ // pagination / sort / filter does not silently re-target the modal at
58
+ // a different row that happens to occupy the same visible index.
59
+ $effect(() => {
60
+ const target = tableContext.openModalCell;
61
+ if (target !== null && target.row === cell.row.original && target.columnId === cell.column.id) {
62
+ previousFocusElement = document.activeElement;
63
+ showModal = true;
64
+ } else {
65
+ showModal = false;
66
+ }
67
+ });
68
+ function onclose() {
69
+ tableContext.setOpenModalCell(null);
70
+ if (previousFocusElement?.id != thisId) {
71
+ tick().then(() => {
72
+ previousFocusElement?.focus();
73
+ }).catch(devCatch);
74
+ }
75
+ }
76
+ let validity = $state(Validity.Valid);
77
+ $effect(() => {
78
+ const validityPromise = focusDetails.validity;
79
+ validityPromise.then((v) => {
80
+ if (!v) {
81
+ validity = Validity.Neutral;
82
+ } else if (isValidityTuple(v)) {
83
+ validity = v.value;
84
+ } else {
85
+ validity = v;
189
86
  }
190
- }}
191
- >
192
- {#if hasValue}
193
- {#await visibleValue}
194
- {loadingText}
195
- {:then v}
196
- {(v instanceof Date
197
- ? v.toLocaleDateString()
198
- : options.length
199
- ? options.find((it) => it.value === v)?.label
200
- : v) ??
201
- v ??
202
- ''}
203
- {/await}
204
- {:else if children}
205
- <div
206
- class="slot-wrapper"
207
- class:multifocus={focusDetails.isMultiFocused}
208
- class:multifocus-start={focusDetails.isMultiFocusStart}
209
- >
210
- {@render children()}
211
- </div>
212
- {/if}
213
- </div>
214
- {#if showModal && modalComponent}
215
- <!--
216
- The component receives the public `DisplayModalProps<T>` shape
217
- `{ row, close }`. The dialog is NOT wrapped in
218
- `<Portal target={document.body}>` any more. `<dialog>` opened
219
- via `showModal()` enters the browser's top layer, so it already
220
- escapes overflow:hidden / sticky / transform ancestors without
221
- needing to be re-parented. Moving the `<div>` ancestor mid-mount
222
- (Portal's $effect runs during the same microtask round as
223
- BaseModal's `tick().then` `dialog.showModal()`) was popping the
224
- dialog out of the top layer and leaving it to render inline at
225
- the bottom of the page.
226
- -->
227
- {@const ModalComponent = modalComponent}
228
- <ModalComponent
229
- row={cell.row.original}
230
- close={onclose}
231
- />
232
- {/if}
233
-
87
+ }).catch(devCatch);
88
+ });
89
+ </script>
90
+
91
+ <!-- svelte-ignore a11y_mouse_events_have_key_events -->
92
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
93
+ <div
94
+ id={thisId}
95
+ class:info={validity == Validity.Info}
96
+ class:success={validity == Validity.Valid}
97
+ class:warning={validity == Validity.Warning}
98
+ class:error={validity == Validity.Invalid}
99
+ class:has-modal={!!modalComponent}
100
+ tabIndex={hasValue ? 0 : undefined}
101
+ class="focusable"
102
+ title={dateTooltip}
103
+ style={focusDetails.outline}
104
+ class:multifocus={hasValue && focusDetails.isMultiFocused}
105
+ class:multifocus-start={hasValue && focusDetails.isMultiFocusStart}
106
+ onmousedown={(e) => {
107
+ // start focus only on left click
108
+ if (e.button === 0) {
109
+ if (e.shiftKey) {
110
+ e.preventDefault();
111
+ tableContext.setFocusEnd(focusDetails.coordinates);
112
+ } else {
113
+ tableContext.startFocus(focusDetails.coordinates);
114
+ }
115
+ }
116
+ }}
117
+ onmouseover={() => {
118
+ if (tableContext.isMousingDown) {
119
+ tableContext.setFocusEnd(focusDetails.coordinates);
120
+ }
121
+ }}
122
+ onmouseup={() => {
123
+ tableContext.endFocus(focusDetails.coordinates);
124
+ }}
125
+ onclick={() => {
126
+ // Open the per-cell modal if the column declares one. Click is
127
+ // the right trigger here (focus already started on mousedown);
128
+ // modal-less display cells fall through to the default focus
129
+ // behaviour with no extra handler.
130
+ if (modalComponent) {
131
+ tableContext.setOpenModalCell({
132
+ row: cell.row.original,
133
+ columnId: cell.column.id,
134
+ });
135
+ }
136
+ }}
137
+ onkeydown={(e) => {
138
+ // Keyboard parity with `onclick` above: when the cell has DOM
139
+ // focus (via `tabIndex`), Enter / Space opens the modal. Only
140
+ // fires for columns that declare a `modal`; non-modal display
141
+ // cells defer to the table's global keyboard navigation.
142
+ if (modalComponent && (e.key === 'Enter' || e.key === ' ')) {
143
+ e.preventDefault();
144
+ tableContext.setOpenModalCell({
145
+ row: cell.row.original,
146
+ columnId: cell.column.id,
147
+ });
148
+ }
149
+ }}
150
+ >
151
+ {#if hasValue}
152
+ {#await visibleValue}
153
+ {loadingText}
154
+ {:then v}
155
+ {(v instanceof Date
156
+ ? v.toLocaleDateString()
157
+ : options.length
158
+ ? options.find((it) => it.value === v)?.label
159
+ : v) ??
160
+ v ??
161
+ ''}
162
+ {/await}
163
+ {:else if children}
164
+ <div
165
+ class="slot-wrapper"
166
+ class:multifocus={focusDetails.isMultiFocused}
167
+ class:multifocus-start={focusDetails.isMultiFocusStart}
168
+ >
169
+ {@render children()}
170
+ </div>
171
+ {/if}
172
+ </div>
173
+ {#if showModal && modalComponent}
174
+ <!--
175
+ The component receives the public `DisplayModalProps<T>` shape
176
+ `{ row, close }`. The dialog is NOT wrapped in
177
+ `<Portal target={document.body}>` any more. `<dialog>` opened
178
+ via `showModal()` enters the browser's top layer, so it already
179
+ escapes overflow:hidden / sticky / transform ancestors without
180
+ needing to be re-parented. Moving the `<div>` ancestor mid-mount
181
+ (Portal's $effect runs during the same microtask round as
182
+ BaseModal's `tick().then` `dialog.showModal()`) was popping the
183
+ dialog out of the top layer and leaving it to render inline at
184
+ the bottom of the page.
185
+ -->
186
+ {@const ModalComponent = modalComponent}
187
+ <ModalComponent
188
+ row={cell.row.original}
189
+ close={onclose}
190
+ />
191
+ {/if}
192
+
234
193
  <style>.focusable,
235
194
  .checkbox-cell,
236
195
  .input-cell,
@@ -321,4 +280,4 @@ div.slot-wrapper {
321
280
  .input-cell.error,
322
281
  .select-cell.error {
323
282
  background-color: #f9e9e9;
324
- }</style>
283
+ }</style>
@@ -1,107 +1,85 @@
1
- <svelte:options runes />
2
-
3
- <script
4
- lang="ts"
5
- module
6
- >
7
- import ProgressBubble from '../../../../ProgressBubble.svelte';
8
- import type { ProgressBarTableCell } from '../../../Types/Columns/ProgressBarTableCell.js';
9
- import { TableContext } from '../../../Types/Context/TableContext.svelte.js';
10
- import { type Primitive } from '../../../Types/Context/TableInitOptions.js';
11
- import { devCatch, isValidityTuple } from '../../../../../Helpers/Helpers.svelte.js';
12
- import { Validity } from '../../../../../Types/Internal/Validity.js';
13
- import { getContext } from 'svelte';
14
-
15
- /**
16
- * Props for {@link ProgressCell}. The cell renders a single `<ProgressBubble>`
17
- * whose `[done, total]` tuple comes from `cell.getValue()`.
18
- */
19
- export interface ProgressCellProps<T extends object, FilterValueType> {
20
- /** Progress-bar table cell whose `[done, total]` value should be rendered. */
21
- cell: ProgressBarTableCell<T, FilterValueType>;
22
- }
23
- </script>
24
-
25
- <script
26
- lang="ts"
27
- generics="T extends object, FilterValueType, RowIdType extends Primitive"
28
- >
29
- const { cell }: ProgressCellProps<T, FilterValueType> = $props();
30
-
31
- /**
32
- * Tuple of `[done, total]`. The cast is unavoidable until `ProgressBarDef`
33
- * carries a narrowed `TValue = [number, number]` generic; tracked under
34
- * the cross-cutting RowGenericThreading + ProgressBarDef.value follow-up.
35
- */
36
- const value: [number, number] = $derived(cell.getValue()) as [number, number];
37
-
38
- const tableContext = getContext<TableContext<T, RowIdType>>(TableContext.identifier);
39
-
40
- const focusDetails = $derived(tableContext._focus.getFocusDetailsFor(cell));
41
-
42
- let validity: Validity = $state(Validity.Valid);
43
- $effect(() => {
44
- const validityPromise = focusDetails.validity;
45
-
46
- validityPromise
47
- .then((v) => {
48
- if (!v) {
49
- validity = Validity.Neutral;
50
- } else if (isValidityTuple(v)) {
51
- validity = v.value;
52
- } else {
53
- validity = v;
54
- }
55
- })
56
- .catch(devCatch);
57
- });
58
-
59
- const colours = $derived(
60
- cell.column.columnDef.getColour(cell.row.original, cell.row.originalIndex, value)
61
- );
62
- </script>
63
-
64
- <!-- svelte-ignore a11y_mouse_events_have_key_events -->
65
- <!-- svelte-ignore a11y_no_static_element_interactions -->
66
- <div
67
- id={`${tableContext.tableName}-cell-${cell.row.visibleIndex}-${cell.column.id}`}
68
- tabIndex={0}
69
- class="focusable"
70
- class:multifocus={focusDetails.isMultiFocused}
71
- class:multifocus-start={focusDetails.isMultiFocusStart}
72
- style={focusDetails.outline}
73
- class:info={validity == Validity.Info}
74
- class:success={validity == Validity.Valid}
75
- class:warning={validity == Validity.Warning}
76
- class:error={validity == Validity.Invalid}
77
- onmousedown={(e) => {
78
- // start focus only on left click
79
- if (e.button === 0) {
80
- if (e.shiftKey) {
81
- e.preventDefault();
82
- tableContext.setFocusEnd(focusDetails.coordinates);
83
- } else {
84
- tableContext.startFocus(focusDetails.coordinates);
85
- }
86
- }
87
- }}
88
- onmouseover={() => {
89
- if (tableContext.isMousingDown) {
90
- tableContext.setFocusEnd(focusDetails.coordinates);
1
+ <svelte:options runes />
2
+
3
+ <script
4
+ lang="ts"
5
+ module
6
+ >import ProgressBubble from "../../../../ProgressBubble.svelte";
7
+ import { TableContext } from "../../../Types/Context/TableContext.svelte.js";
8
+ import "../../../Types/Context/TableInitOptions.js";
9
+ import { devCatch, isValidityTuple } from "../../../../../Helpers/Helpers.svelte.js";
10
+ import { Validity } from "../../../../../Types/Internal/Validity.js";
11
+ import { getContext } from "svelte";
12
+ </script>
13
+
14
+ <script
15
+ lang="ts"
16
+ generics="T extends object, FilterValueType, RowIdType extends Primitive"
17
+ >const { cell } = $props();
18
+ /**
19
+ * Tuple of `[done, total]`. The cast is unavoidable until `ProgressBarDef`
20
+ * carries a narrowed `TValue = [number, number]` generic; tracked under
21
+ * the cross-cutting RowGenericThreading + ProgressBarDef.value follow-up.
22
+ */
23
+ const value = $derived(cell.getValue());
24
+ const tableContext = getContext(TableContext.identifier);
25
+ const focusDetails = $derived(tableContext._focus.getFocusDetailsFor(cell));
26
+ let validity = $state(Validity.Valid);
27
+ $effect(() => {
28
+ const validityPromise = focusDetails.validity;
29
+ validityPromise.then((v) => {
30
+ if (!v) {
31
+ validity = Validity.Neutral;
32
+ } else if (isValidityTuple(v)) {
33
+ validity = v.value;
34
+ } else {
35
+ validity = v;
91
36
  }
92
- }}
93
- onmouseup={() => {
94
- tableContext.endFocus(focusDetails.coordinates);
95
- }}
96
- >
97
- <div class="bubble-parent">
98
- <ProgressBubble
99
- {value}
100
- {colours}
101
- />
102
- </div>
103
- </div>
104
-
37
+ }).catch(devCatch);
38
+ });
39
+ const colours = $derived(cell.column.columnDef.getColour(cell.row.original, cell.row.originalIndex, value));
40
+ </script>
41
+
42
+ <!-- svelte-ignore a11y_mouse_events_have_key_events -->
43
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
44
+ <div
45
+ id={`${tableContext.tableName}-cell-${cell.row.visibleIndex}-${cell.column.id}`}
46
+ tabIndex={0}
47
+ class="focusable"
48
+ class:multifocus={focusDetails.isMultiFocused}
49
+ class:multifocus-start={focusDetails.isMultiFocusStart}
50
+ style={focusDetails.outline}
51
+ class:info={validity == Validity.Info}
52
+ class:success={validity == Validity.Valid}
53
+ class:warning={validity == Validity.Warning}
54
+ class:error={validity == Validity.Invalid}
55
+ onmousedown={(e) => {
56
+ // start focus only on left click
57
+ if (e.button === 0) {
58
+ if (e.shiftKey) {
59
+ e.preventDefault();
60
+ tableContext.setFocusEnd(focusDetails.coordinates);
61
+ } else {
62
+ tableContext.startFocus(focusDetails.coordinates);
63
+ }
64
+ }
65
+ }}
66
+ onmouseover={() => {
67
+ if (tableContext.isMousingDown) {
68
+ tableContext.setFocusEnd(focusDetails.coordinates);
69
+ }
70
+ }}
71
+ onmouseup={() => {
72
+ tableContext.endFocus(focusDetails.coordinates);
73
+ }}
74
+ >
75
+ <div class="bubble-parent">
76
+ <ProgressBubble
77
+ {value}
78
+ {colours}
79
+ />
80
+ </div>
81
+ </div>
82
+
105
83
  <style>.focusable,
106
84
  .checkbox-cell,
107
85
  .input-cell,
@@ -188,4 +166,4 @@ div.bubble-parent {
188
166
  align-items: center;
189
167
  gap: 0.75rem;
190
168
  --line-height: 1;
191
- }</style>
169
+ }</style>