@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,79 +1,52 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
module
|
|
6
|
-
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Checkbox: TableCheckbox,
|
|
48
|
-
Text: TableTextInput,
|
|
49
|
-
}) as unknown as Readonly<
|
|
50
|
-
Record<'Number' | 'Date' | 'Select' | 'Checkbox' | 'Query' | 'Text', AccessorCellComponent>
|
|
51
|
-
>;
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<script
|
|
55
|
-
lang="ts"
|
|
56
|
-
generics="T extends object"
|
|
57
|
-
>
|
|
58
|
-
/** Single cell to render for the supplied {@link TableCell}. The accessor type discriminator is read off `cell.column.columnDef`. */
|
|
59
|
-
const { cell }: AccessorComponentProps<T> = $props();
|
|
60
|
-
|
|
61
|
-
const CurrentComponent = $derived(getAppropriateAccessorDef(cell.column.columnDef));
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Returns the cell-host component for `columnDef`'s discriminant. Falls back
|
|
65
|
-
* to `FocusableImmutableCell` when the column is not an `AccessorDef` (this
|
|
66
|
-
* branch is technically dead in the live dispatcher since `TableColumn`
|
|
67
|
-
* filters first, but the total function keeps this file safe to call
|
|
68
|
-
* directly from other dispatch sites).
|
|
69
|
-
*/
|
|
70
|
-
function getAppropriateAccessorDef(columnDef: ColumnDef<T>): AccessorCellComponent {
|
|
71
|
-
if (columnDef instanceof AccessorDef) {
|
|
72
|
-
return cellTypes[columnDef.accessorType];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return FocusableImmutableCell as unknown as AccessorCellComponent;
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
|
+
>import { AccessorDef } from "../../../Types/Columns/Definitions/Accessors/AccessorDef.svelte.js";
|
|
7
|
+
import FocusableImmutableCell from "./FocusableImmutableCell.svelte";
|
|
8
|
+
import TableCheckbox from "./TableCheckbox.svelte";
|
|
9
|
+
import TableDatePicker from "./TableDatePicker.svelte";
|
|
10
|
+
import TableNumberInput from "./TableNumberInput.svelte";
|
|
11
|
+
import TableQuerySelect from "./TableQuerySelect.svelte";
|
|
12
|
+
import TableSelect from "./TableSelect.svelte";
|
|
13
|
+
import TableTextInput from "./TableTextInput.svelte";
|
|
14
|
+
/**
|
|
15
|
+
* Frozen lookup from `AccessorDef.accessorType` discriminator to the matching
|
|
16
|
+
* cell-host Svelte component. Hoisted to module scope so the table does not
|
|
17
|
+
* allocate a fresh 6-key object per cell on each render (with 100 rows by
|
|
18
|
+
* roughly 10 accessor columns that would be 1000 redundant allocations per
|
|
19
|
+
* render).
|
|
20
|
+
*/
|
|
21
|
+
const cellTypes = Object.freeze({
|
|
22
|
+
Number: TableNumberInput,
|
|
23
|
+
Date: TableDatePicker,
|
|
24
|
+
Select: TableSelect,
|
|
25
|
+
Query: TableQuerySelect,
|
|
26
|
+
Checkbox: TableCheckbox,
|
|
27
|
+
Text: TableTextInput
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<script
|
|
32
|
+
lang="ts"
|
|
33
|
+
generics="T extends object"
|
|
34
|
+
>/** Single cell to render for the supplied {@link TableCell}. The accessor type discriminator is read off `cell.column.columnDef`. */
|
|
35
|
+
const { cell } = $props();
|
|
36
|
+
const CurrentComponent = $derived(getAppropriateAccessorDef(cell.column.columnDef));
|
|
37
|
+
/**
|
|
38
|
+
* Returns the cell-host component for `columnDef`'s discriminant. Falls back
|
|
39
|
+
* to `FocusableImmutableCell` when the column is not an `AccessorDef` (this
|
|
40
|
+
* branch is technically dead in the live dispatcher since `TableColumn`
|
|
41
|
+
* filters first, but the total function keeps this file safe to call
|
|
42
|
+
* directly from other dispatch sites).
|
|
43
|
+
*/
|
|
44
|
+
function getAppropriateAccessorDef(columnDef) {
|
|
45
|
+
if (columnDef instanceof AccessorDef) {
|
|
46
|
+
return cellTypes[columnDef.accessorType];
|
|
76
47
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
48
|
+
return FocusableImmutableCell;
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<CurrentComponent {cell} />
|
|
@@ -1,187 +1,168 @@
|
|
|
1
|
-
<svelte:options runes />
|
|
2
|
-
|
|
3
|
-
<script
|
|
4
|
-
lang="ts"
|
|
5
|
-
module
|
|
6
|
-
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
x = rect.x + totalOffsetX;
|
|
55
|
-
y = rect.y + totalOffsetY;
|
|
56
|
-
});
|
|
1
|
+
<svelte:options runes />
|
|
2
|
+
|
|
3
|
+
<script
|
|
4
|
+
lang="ts"
|
|
5
|
+
module
|
|
6
|
+
>import Action from "../../../../Action.svelte";
|
|
7
|
+
import Portal from "../../../../Portal.svelte";
|
|
8
|
+
import { TableContext } from "../../../Types/Context/TableContext.svelte.js";
|
|
9
|
+
import { MultiFocusEdge } from "../../../Types/Focus/MultiFocusEdge.js";
|
|
10
|
+
import { asyncMap, devCatch, isValidityTuple } from "../../../../../Helpers/Helpers.svelte.js";
|
|
11
|
+
import { Colour, ColourSet } from "../../../../../scss/colours.js";
|
|
12
|
+
import { Size } from "../../../../../Types/Internal/Size.js";
|
|
13
|
+
import { Validity } from "../../../../../Types/Internal/Validity.js";
|
|
14
|
+
import { getContext, untrack } from "svelte";
|
|
15
|
+
import TableAction from "./TableAction.svelte";
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<script
|
|
19
|
+
lang="ts"
|
|
20
|
+
generics="T extends object, FilterValueType, RowIdType extends Primitive"
|
|
21
|
+
>const { cell } = $props();
|
|
22
|
+
const value = $derived(cell.getValue());
|
|
23
|
+
const tableContext = getContext(TableContext.identifier);
|
|
24
|
+
const actions = $derived(cell.column.columnDef.actions);
|
|
25
|
+
const thisPopup = $state(Symbol());
|
|
26
|
+
const thisPopupIsVisibile = $derived(thisPopup === tableContext.shownActionsPopup);
|
|
27
|
+
const hasValue = $derived(value !== undefined);
|
|
28
|
+
const edge = $state();
|
|
29
|
+
const focusDetails = $derived(tableContext._focus.getFocusDetailsFor(cell));
|
|
30
|
+
let cellRef = $state();
|
|
31
|
+
let x = $state(0);
|
|
32
|
+
let y = $state(0);
|
|
33
|
+
$effect.pre(() => {
|
|
34
|
+
if (thisPopupIsVisibile && cellRef) {
|
|
35
|
+
const rect = cellRef.getBoundingClientRect();
|
|
36
|
+
untrack(() => {
|
|
37
|
+
const totalOffsetX = -6;
|
|
38
|
+
const totalOffsetY = rect.height / 2;
|
|
39
|
+
x = rect.x + totalOffsetX;
|
|
40
|
+
y = rect.y + totalOffsetY;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
let validity = $state(Validity.Valid);
|
|
45
|
+
$effect(() => {
|
|
46
|
+
const validityPromise = focusDetails.validity;
|
|
47
|
+
validityPromise.then((v) => {
|
|
48
|
+
if (!v) {
|
|
49
|
+
validity = Validity.Neutral;
|
|
50
|
+
} else if (isValidityTuple(v)) {
|
|
51
|
+
validity = v.value;
|
|
52
|
+
} else {
|
|
53
|
+
validity = v;
|
|
57
54
|
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
{
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
style="--y: {y}px; --x: {x}px;"
|
|
170
|
-
>
|
|
171
|
-
<div class="action-container">
|
|
172
|
-
{#each actions as [action, label] (label)}
|
|
173
|
-
<TableAction
|
|
174
|
-
{action}
|
|
175
|
-
{cell}
|
|
176
|
-
/>
|
|
177
|
-
{/each}
|
|
178
|
-
</div>
|
|
179
|
-
</div>
|
|
180
|
-
</Portal>
|
|
181
|
-
{/await}
|
|
182
|
-
{/if}
|
|
183
|
-
</div>
|
|
184
|
-
|
|
55
|
+
}).catch(devCatch);
|
|
56
|
+
});
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<!-- svelte-ignore a11y_mouse_events_have_key_events -->
|
|
60
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
61
|
+
<div
|
|
62
|
+
id={`${tableContext.tableName}-cell-${cell.row.visibleIndex}-${cell.column.id}`}
|
|
63
|
+
tabIndex={hasValue ? 0 : undefined}
|
|
64
|
+
class="focusable"
|
|
65
|
+
class:multifocus={hasValue && focusDetails.isMultiFocused}
|
|
66
|
+
class:multifocus-start={hasValue && focusDetails.isMultiFocusStart}
|
|
67
|
+
class:left={edge === MultiFocusEdge.Left}
|
|
68
|
+
class:top-left={edge === MultiFocusEdge.TopLeft}
|
|
69
|
+
class:top={edge === MultiFocusEdge.Top}
|
|
70
|
+
class:top-right={edge === MultiFocusEdge.TopRight}
|
|
71
|
+
class:right={edge === MultiFocusEdge.Right}
|
|
72
|
+
class:bottom-right={edge === MultiFocusEdge.BottomRight}
|
|
73
|
+
class:bottom={edge === MultiFocusEdge.Bottom}
|
|
74
|
+
class:bottom-left={edge === MultiFocusEdge.BottomLeft}
|
|
75
|
+
class:info={validity == Validity.Info}
|
|
76
|
+
class:success={validity == Validity.Valid}
|
|
77
|
+
class:warning={validity == Validity.Warning}
|
|
78
|
+
class:error={validity == Validity.Invalid}
|
|
79
|
+
onmousedown={(e) => {
|
|
80
|
+
// start focus only on left click
|
|
81
|
+
if (e.button === 0) {
|
|
82
|
+
if (e.shiftKey) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
tableContext.setFocusEnd(focusDetails.coordinates);
|
|
85
|
+
} else {
|
|
86
|
+
tableContext.startFocus(focusDetails.coordinates);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}}
|
|
90
|
+
onmouseover={() => {
|
|
91
|
+
if (tableContext.isMousingDown) {
|
|
92
|
+
tableContext.setFocusEnd(focusDetails.coordinates);
|
|
93
|
+
}
|
|
94
|
+
}}
|
|
95
|
+
onmouseup={() => {
|
|
96
|
+
tableContext.endFocus(focusDetails.coordinates);
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
100
|
+
<div
|
|
101
|
+
class="slot-wrapper"
|
|
102
|
+
class:multifocus={focusDetails.isMultiFocused}
|
|
103
|
+
class:multifocus-start={focusDetails.isMultiFocusStart}
|
|
104
|
+
bind:this={cellRef}
|
|
105
|
+
onmousedown={(e) => {
|
|
106
|
+
// Suppress click side effects that jump the table horizontally
|
|
107
|
+
// on Action clicks:
|
|
108
|
+
// 1. `preventDefault()` cancels the default mousedown ->
|
|
109
|
+
// focus on the inner `<button>`, which would otherwise
|
|
110
|
+
// call `scrollIntoView` against the button's position
|
|
111
|
+
// at the far right (the Actions column is sticky-pinned
|
|
112
|
+
// right).
|
|
113
|
+
// 2. `stopPropagation()` keeps the event out of the outer
|
|
114
|
+
// `.focusable` cell handler, which would otherwise call
|
|
115
|
+
// `tableContext.startFocus(...)` and trigger another
|
|
116
|
+
// `scrollIntoView` via Table.svelte's focusStart effect.
|
|
117
|
+
// The Action's `onclick` still fires (click is dispatched on
|
|
118
|
+
// mouseup independent of mousedown), so the popup toggle works.
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
e.stopPropagation();
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<!-- TODO {isMultiFocusStart} -->
|
|
124
|
+
<Action
|
|
125
|
+
style={focusDetails.outline}
|
|
126
|
+
border={false}
|
|
127
|
+
size={Size.FillWidth}
|
|
128
|
+
icon={{ name: 'ellipsis', size: Size.Medium, colour: Colour['$brand-primary'] }}
|
|
129
|
+
colourSet={ColourSet.Auxiliary}
|
|
130
|
+
onclick={() => {
|
|
131
|
+
if (tableContext.shownActionsPopup === thisPopup) {
|
|
132
|
+
tableContext.shownActionsPopup = undefined;
|
|
133
|
+
} else {
|
|
134
|
+
tableContext.shownActionsPopup = thisPopup;
|
|
135
|
+
}
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
{#if thisPopupIsVisibile}
|
|
140
|
+
{@const awaitedActions = asyncMap<TableActionButton<T>, [TableActionButton<T>, string]>(
|
|
141
|
+
actions,
|
|
142
|
+
async (item) => {
|
|
143
|
+
return [item, await item.getLabel(cell.row.original, cell.row.visibleIndex)];
|
|
144
|
+
}
|
|
145
|
+
)}
|
|
146
|
+
{#await awaitedActions then actions}
|
|
147
|
+
<Portal>
|
|
148
|
+
<div
|
|
149
|
+
class="popup"
|
|
150
|
+
style="--y: {y}px; --x: {x}px;"
|
|
151
|
+
>
|
|
152
|
+
<div class="action-container">
|
|
153
|
+
{#each actions as [action, label] (label)}
|
|
154
|
+
<TableAction
|
|
155
|
+
{action}
|
|
156
|
+
{cell}
|
|
157
|
+
/>
|
|
158
|
+
{/each}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</Portal>
|
|
162
|
+
{/await}
|
|
163
|
+
{/if}
|
|
164
|
+
</div>
|
|
165
|
+
|
|
185
166
|
<style>.focusable,
|
|
186
167
|
.checkbox-cell,
|
|
187
168
|
.input-cell,
|
|
@@ -333,4 +314,4 @@ div.slot-wrapper {
|
|
|
333
314
|
display: flex;
|
|
334
315
|
align-items: center;
|
|
335
316
|
justify-content: center;
|
|
336
|
-
}</style>
|
|
317
|
+
}</style>
|