@poirazis/supercomponents-shared 1.2.16 → 1.2.18
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/index.js +17703 -22317
- package/dist/index.umd.cjs +19 -19
- package/package.json +11 -11
- package/src/lib/SuperButton/SuperButton.svelte +57 -22
- package/src/lib/SuperField/SuperField.svelte +0 -2
- package/src/lib/SuperForm/InnerForm.svelte +7 -8
- package/src/lib/SuperTable/SuperTable.css +13 -6
- package/src/lib/SuperTable/SuperTable.svelte +26 -15
- package/src/lib/SuperTable/constants.js +1 -1
- package/src/lib/SuperTable/controls/RowButtonsColumn.svelte +33 -17
- package/src/lib/SuperTable/controls/SelectionColumn.svelte +2 -2
- package/src/lib/SuperTableCells/CellBoolean.svelte +52 -45
- package/src/lib/SuperTableCells/CellDatetime.svelte +268 -120
- package/src/lib/SuperTableCells/CellLink.svelte +16 -7
- package/src/lib/SuperTableCells/CellLinkPickerSelect.svelte +28 -24
- package/src/lib/SuperTableCells/CellLinkPickerTree.svelte +22 -20
- package/src/lib/SuperTableCells/CellNumber.svelte +55 -53
- package/src/lib/SuperTableCells/CellOptions.svelte +59 -32
- package/src/lib/SuperTableCells/CellOptionsAdvanced.svelte +131 -129
- package/src/lib/SuperTableCells/CellSQLLink.svelte +32 -32
- package/src/lib/SuperTableCells/CellSQLLinkPicker.svelte +2 -7
- package/src/lib/SuperTableCells/CellString.svelte +49 -47
- package/src/lib/SuperTableCells/CellStringMask.svelte +41 -40
- package/src/lib/SuperTableColumn/SuperTableColumn.svelte +2 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnBody.svelte +3 -0
- package/src/lib/SuperTableColumn/parts/SuperColumnHeader.svelte +44 -42
- package/src/lib/SuperTableColumn/parts/SuperColumnRow.svelte +1 -1
- package/src/lib/SuperTabs/SuperTabs.svelte +33 -17
- package/src/lib/UI/elements/Checkbox.svelte +68 -10
- package/src/lib/UI/elements/Switch.svelte +162 -0
- package/src/lib/UI/elements/Tooltip.svelte +15 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poirazis/supercomponents-shared",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
4
4
|
"description": "Shared Svelte components library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "bun@1.0.0",
|
|
@@ -40,23 +40,23 @@
|
|
|
40
40
|
"@phosphor-icons/web": "^2.1.2",
|
|
41
41
|
"@sveltejs/svelte-virtual-list": "^3.0.1",
|
|
42
42
|
"date-picker-svelte": "^2.17.0",
|
|
43
|
-
"imask": "^
|
|
43
|
+
"imask": "^7.6.1",
|
|
44
44
|
"shortid": "^2.2.17",
|
|
45
45
|
"svelte-carousel": "^1.0.25",
|
|
46
46
|
"svelte-dnd-action": "^0.9.69",
|
|
47
47
|
"svelte-fsm": "^1.2.0",
|
|
48
|
-
"zod": "4.3
|
|
48
|
+
"zod": "4.4.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@budibase/types": "^3.
|
|
51
|
+
"@budibase/types": "^3.38.4",
|
|
52
52
|
"@sveltejs/package": "^2.5.7",
|
|
53
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
53
|
+
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
54
54
|
"@tsconfig/svelte": "^5.0.8",
|
|
55
|
-
"postcss": "^8.5.
|
|
56
|
-
"sass": "^1.
|
|
57
|
-
"svelte": "^5.
|
|
58
|
-
"typescript": "^
|
|
59
|
-
"vite": "^
|
|
60
|
-
"vite-plugin-css-injected-by-js": "^
|
|
55
|
+
"postcss": "^8.5.14",
|
|
56
|
+
"sass": "^1.99.0",
|
|
57
|
+
"svelte": "^5.55.7",
|
|
58
|
+
"typescript": "^6.0.3",
|
|
59
|
+
"vite": "^8.0.13",
|
|
60
|
+
"vite-plugin-css-injected-by-js": "^5.0.1"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { onDestroy, onMount } from "svelte";
|
|
2
|
+
import { onDestroy, onMount, getContext } from "svelte";
|
|
3
3
|
import Tooltip from "../UI/elements/Tooltip.svelte";
|
|
4
4
|
|
|
5
|
+
const { enrichButtonActions } = getContext("sdk");
|
|
6
|
+
const context = getContext("context");
|
|
7
|
+
|
|
5
8
|
export let size = "M";
|
|
6
9
|
export let menuItem = false;
|
|
7
10
|
export let menuAlign = "right";
|
|
8
11
|
export let icon = undefined;
|
|
9
12
|
export let iconAfterText = undefined;
|
|
10
13
|
export let iconColor = undefined;
|
|
14
|
+
export let filledIcon = undefined;
|
|
11
15
|
export let text = "";
|
|
12
16
|
export let quiet = undefined;
|
|
13
17
|
export let selected = undefined;
|
|
14
18
|
export let disabled = undefined;
|
|
15
|
-
export let onClick
|
|
19
|
+
export let onClick;
|
|
16
20
|
export let buttonClass = "actionButton";
|
|
17
21
|
export let type = "primary";
|
|
18
22
|
export let tooltip;
|
|
@@ -38,13 +42,16 @@
|
|
|
38
42
|
export let onFalseCondition = undefined;
|
|
39
43
|
|
|
40
44
|
$: loop = safeParse(loopSource);
|
|
45
|
+
$: buttonText = text || (actionsMode == "timer" ? timerDuration : "");
|
|
41
46
|
$: icon_class = working
|
|
42
47
|
? "ph ph-spinner-gap ph-spin"
|
|
43
48
|
: icon && !icon.startsWith("ri-")
|
|
44
49
|
? "ph ph-" + icon
|
|
45
50
|
: icon
|
|
46
51
|
? icon
|
|
47
|
-
:
|
|
52
|
+
: actionsMode == "timer"
|
|
53
|
+
? "ph ph-timer"
|
|
54
|
+
: undefined;
|
|
48
55
|
|
|
49
56
|
let working = false;
|
|
50
57
|
let ui_timer = undefined;
|
|
@@ -55,24 +62,31 @@
|
|
|
55
62
|
let tooltipTimer;
|
|
56
63
|
|
|
57
64
|
const showTooltip = () => {
|
|
58
|
-
if (disabled) return;
|
|
65
|
+
if (disabled || tooltipShow || !tooltip) return;
|
|
59
66
|
if (tooltipTimer) clearTimeout(tooltipTimer);
|
|
60
67
|
tooltipTimer = setTimeout(() => {
|
|
61
68
|
tooltipShow = true;
|
|
62
|
-
},
|
|
69
|
+
}, 500);
|
|
63
70
|
};
|
|
64
71
|
|
|
65
|
-
const hideTooltip = () => {
|
|
72
|
+
const hideTooltip = (e) => {
|
|
66
73
|
if (tooltipTimer) {
|
|
67
74
|
clearTimeout(tooltipTimer);
|
|
68
|
-
tooltipTimer = null;
|
|
69
75
|
}
|
|
70
76
|
tooltipShow = false;
|
|
71
77
|
};
|
|
72
78
|
|
|
73
79
|
async function handleClick(e) {
|
|
80
|
+
let enrichedAction;
|
|
81
|
+
if (Array.isArray(onClick)) {
|
|
82
|
+
enrichedAction = enrichButtonActions(onClick, $context);
|
|
83
|
+
} else {
|
|
84
|
+
enrichedAction = onClick;
|
|
85
|
+
}
|
|
86
|
+
|
|
74
87
|
if (disabled || working || actionsMode == "timer") return;
|
|
75
88
|
working = true;
|
|
89
|
+
tooltipShow = false;
|
|
76
90
|
if (actionsMode == "loop") {
|
|
77
91
|
if (onLoopStart) await onLoopStart({ iterations: loopSource?.length });
|
|
78
92
|
if (Array.isArray(loop) && loopEvent) {
|
|
@@ -85,8 +99,8 @@
|
|
|
85
99
|
} else if (actionsMode == "conditional") {
|
|
86
100
|
if (condition == true) await onTrueCondition?.();
|
|
87
101
|
else await onFalseCondition?.();
|
|
88
|
-
} else if (
|
|
89
|
-
await
|
|
102
|
+
} else if (enrichedAction) {
|
|
103
|
+
await enrichedAction?.(e);
|
|
90
104
|
}
|
|
91
105
|
working = false;
|
|
92
106
|
}
|
|
@@ -161,11 +175,12 @@
|
|
|
161
175
|
>
|
|
162
176
|
<i
|
|
163
177
|
class={icon_class}
|
|
178
|
+
class:ph-fill={filledIcon}
|
|
164
179
|
style:order={iconAfterText ? 1 : 0}
|
|
165
180
|
style:color={disabled ? "var(--spectrum-global-color-gray-400)" : iconColor}
|
|
166
181
|
></i>
|
|
167
182
|
|
|
168
|
-
<span>{
|
|
183
|
+
<span>{buttonText}</span>
|
|
169
184
|
</button>
|
|
170
185
|
|
|
171
186
|
{#if tooltip}
|
|
@@ -181,31 +196,47 @@
|
|
|
181
196
|
align-items: center;
|
|
182
197
|
justify-content: center;
|
|
183
198
|
padding: 0rem 1rem;
|
|
184
|
-
min-width:
|
|
185
|
-
gap: 0.
|
|
199
|
+
min-width: 4rem;
|
|
200
|
+
gap: 0.75rem;
|
|
186
201
|
height: 2rem;
|
|
187
202
|
|
|
203
|
+
&.spectrum-ActionButton {
|
|
204
|
+
padding: 0rem 0.75rem !important;
|
|
205
|
+
border-radius: 4px !important;
|
|
206
|
+
}
|
|
207
|
+
&.spectrum-ActionButton.xsmall {
|
|
208
|
+
padding: 0rem 0.5rem !important;
|
|
209
|
+
border-radius: 4px !important;
|
|
210
|
+
}
|
|
188
211
|
&.xsmall {
|
|
189
212
|
height: 1.5rem;
|
|
190
|
-
|
|
191
|
-
padding: 0rem 0.5rem;
|
|
213
|
+
padding: 0rem 0.75rem;
|
|
192
214
|
min-width: unset;
|
|
215
|
+
gap: 0.5rem;
|
|
216
|
+
font-size: 12px;
|
|
217
|
+
border-radius: 1rem;
|
|
193
218
|
}
|
|
194
219
|
|
|
195
220
|
&.small {
|
|
196
221
|
min-width: 4rem;
|
|
197
|
-
padding: 0rem
|
|
222
|
+
padding: 0rem 0.75rem;
|
|
198
223
|
gap: 0.5rem;
|
|
199
|
-
height: 1.
|
|
224
|
+
height: 1.75rem;
|
|
225
|
+
font-size: 13px;
|
|
200
226
|
}
|
|
201
227
|
|
|
202
228
|
&.large {
|
|
203
229
|
height: 2.25rem;
|
|
230
|
+
font-size: 16px;
|
|
231
|
+
padding: 0rem 1.25rem;
|
|
232
|
+
|
|
233
|
+
& > i {
|
|
234
|
+
font-size: 18px;
|
|
235
|
+
}
|
|
204
236
|
}
|
|
205
237
|
|
|
206
238
|
& > span {
|
|
207
239
|
white-space: nowrap;
|
|
208
|
-
font-size: 14px;
|
|
209
240
|
font-weight: 600;
|
|
210
241
|
}
|
|
211
242
|
|
|
@@ -228,6 +259,7 @@
|
|
|
228
259
|
display: none;
|
|
229
260
|
opacity: 0.9;
|
|
230
261
|
font-weight: 400;
|
|
262
|
+
font-size: 15px;
|
|
231
263
|
}
|
|
232
264
|
}
|
|
233
265
|
|
|
@@ -254,6 +286,7 @@
|
|
|
254
286
|
i {
|
|
255
287
|
color: var(--iconColor);
|
|
256
288
|
transition: all 230ms ease-in-out;
|
|
289
|
+
font-size: 16px;
|
|
257
290
|
}
|
|
258
291
|
|
|
259
292
|
.cta {
|
|
@@ -311,13 +344,13 @@
|
|
|
311
344
|
.primary {
|
|
312
345
|
&:hover,
|
|
313
346
|
&:focus {
|
|
314
|
-
border: 1px solid var(--spectrum-global-color-gray-
|
|
315
|
-
background-color: var(--spectrum-global-color-gray-
|
|
316
|
-
color: var(--spectrum-global-color-gray-
|
|
347
|
+
border: 1px solid var(--spectrum-global-color-gray-500);
|
|
348
|
+
background-color: var(--spectrum-global-color-gray-200);
|
|
349
|
+
color: var(--spectrum-global-color-gray-900);
|
|
317
350
|
}
|
|
318
351
|
&:active {
|
|
319
352
|
background-color: var(--spectrum-global-color-gray-100);
|
|
320
|
-
border: 1px solid var(--spectrum-global-color-gray-
|
|
353
|
+
border: 1px solid var(--spectrum-global-color-gray-500);
|
|
321
354
|
}
|
|
322
355
|
|
|
323
356
|
&.quiet {
|
|
@@ -340,7 +373,7 @@
|
|
|
340
373
|
background-color: transparent;
|
|
341
374
|
|
|
342
375
|
&:hover {
|
|
343
|
-
background-color: var(--spectrum-global-color-gray-
|
|
376
|
+
background-color: var(--spectrum-global-color-gray-300);
|
|
344
377
|
}
|
|
345
378
|
}
|
|
346
379
|
|
|
@@ -365,6 +398,8 @@
|
|
|
365
398
|
|
|
366
399
|
&:hover {
|
|
367
400
|
border-color: var(--spectrum-global-color-red-400);
|
|
401
|
+
background-color: var(--spectrum-global-color-red-400);
|
|
402
|
+
color: white;
|
|
368
403
|
font-weight: bolder;
|
|
369
404
|
}
|
|
370
405
|
|
|
@@ -155,9 +155,7 @@
|
|
|
155
155
|
display: flex;
|
|
156
156
|
align-items: center;
|
|
157
157
|
justify-content: space-between;
|
|
158
|
-
font-weight: 300;
|
|
159
158
|
line-height: 1.65rem;
|
|
160
|
-
letter-spacing: 0.35px;
|
|
161
159
|
color: var(--spectrum-global-color-gray-700);
|
|
162
160
|
font-family: "inter", sans-serif;
|
|
163
161
|
gap: 1rem;
|
|
@@ -118,6 +118,11 @@
|
|
|
118
118
|
__editing: !readonly && !disabled,
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
+
$: scope =
|
|
122
|
+
provideContextScope === "local"
|
|
123
|
+
? ContextScopes.Local
|
|
124
|
+
: ContextScopes.Global;
|
|
125
|
+
|
|
121
126
|
const deriveFieldProperty = (
|
|
122
127
|
fieldStores: Readable<FieldInfo>[],
|
|
123
128
|
getProp: (_field: FieldInfo) => any,
|
|
@@ -584,18 +589,12 @@
|
|
|
584
589
|
|
|
585
590
|
{#key labelPosition}
|
|
586
591
|
{#if provideContext}
|
|
587
|
-
<Provider
|
|
588
|
-
{actions}
|
|
589
|
-
data={dataContext}
|
|
590
|
-
scope={provideContextScope === "local"
|
|
591
|
-
? ContextScopes.Local
|
|
592
|
-
: ContextScopes.Global}
|
|
593
|
-
>
|
|
592
|
+
<Provider {actions} data={dataContext} {scope}>
|
|
594
593
|
<div
|
|
595
594
|
class="super-form-inner-form"
|
|
596
595
|
class:labels-left={labelPosition === "left"}
|
|
597
596
|
class:no-labels={labelPosition === false || labelPosition === "none"}
|
|
598
|
-
class:field-group={
|
|
597
|
+
class:field-group={columns > 1}
|
|
599
598
|
style:grid-template-columns={`repeat(${columns * 6}, 1fr)`}
|
|
600
599
|
style:row-gap={rowGap}
|
|
601
600
|
style:column-gap={columnGap}
|
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
border-radius: 0.25rem;
|
|
9
9
|
overflow: hidden;
|
|
10
10
|
height: 360px;
|
|
11
|
-
--row-selection-color:
|
|
12
|
-
--row-hover-color:
|
|
11
|
+
--row-selection-color: rgb(from var(--primaryColor) r g b / 0.25);
|
|
12
|
+
--row-hover-color: rgb(from var(--primaryColor) r g b / 0.05);
|
|
13
13
|
|
|
14
14
|
&.quiet {
|
|
15
|
-
background:
|
|
15
|
+
background: rgb(from var(--spectrum-global-color-gray-50) r g b / 0.75);
|
|
16
|
+
color: var(--spectrum-global-color-gray-700);
|
|
16
17
|
--row-selection-color: var(--spectrum-global-color-gray-200);
|
|
18
|
+
--row-hover-color: var(--spectrum-global-color-gray-100);
|
|
17
19
|
border-color: var(--spectrum-global-color-gray-200);
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -86,7 +88,7 @@
|
|
|
86
88
|
flex: auto;
|
|
87
89
|
position: relative;
|
|
88
90
|
flex-direction: column;
|
|
89
|
-
|
|
91
|
+
|
|
90
92
|
overflow: hidden;
|
|
91
93
|
scrollbar-width: none;
|
|
92
94
|
|
|
@@ -134,6 +136,10 @@
|
|
|
134
136
|
cursor: col-resize;
|
|
135
137
|
}
|
|
136
138
|
}
|
|
139
|
+
|
|
140
|
+
&:last-child .super-column-body {
|
|
141
|
+
border-right: unset;
|
|
142
|
+
}
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
.super-column-header {
|
|
@@ -193,6 +199,7 @@
|
|
|
193
199
|
flex: auto;
|
|
194
200
|
overflow: hidden;
|
|
195
201
|
max-height: var(--super-table-body-height);
|
|
202
|
+
border-right: var(--super-table-vertical-dividers);
|
|
196
203
|
height: 100%;
|
|
197
204
|
|
|
198
205
|
&.zebra:not(.sticky) > .super-row:nth-child(even) {
|
|
@@ -251,8 +258,8 @@
|
|
|
251
258
|
}
|
|
252
259
|
|
|
253
260
|
&.disabled {
|
|
254
|
-
color: var(--spectrum-global-color-gray-
|
|
255
|
-
font-style: italic;
|
|
261
|
+
color: var(--spectrum-global-color-gray-600) !important;
|
|
262
|
+
font-style: italic !important;
|
|
256
263
|
}
|
|
257
264
|
|
|
258
265
|
&.isLast {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
import ControlSection from "./controls/ControlSection.svelte";
|
|
30
30
|
import ColumnsSection from "./controls/ColumnsSection.svelte";
|
|
31
31
|
import PaginationLimitOffset from "./controls/PaginationLimitOffset.svelte";
|
|
32
|
+
import { ta } from "zod/v4/locales";
|
|
32
33
|
|
|
33
34
|
const {
|
|
34
35
|
API,
|
|
@@ -132,6 +133,7 @@
|
|
|
132
133
|
const filterStore = memo(filter);
|
|
133
134
|
const cachedRows = writable([]);
|
|
134
135
|
const loading = writable(false);
|
|
136
|
+
const resizing = writable(false);
|
|
135
137
|
|
|
136
138
|
$: dataSourceStore.set(dataSource);
|
|
137
139
|
$: filterStore.set(filter);
|
|
@@ -659,11 +661,12 @@
|
|
|
659
661
|
// Clear errors on success
|
|
660
662
|
$new_row.errors = {};
|
|
661
663
|
$new_row = $new_row;
|
|
662
|
-
|
|
664
|
+
|
|
663
665
|
let richContext = { ...$context, [comp_id]: { row: saved_row } };
|
|
664
666
|
let cmd_after = enrichButtonActions(afterInsert, richContext);
|
|
665
667
|
await cmd_after?.({ row: saved_row });
|
|
666
668
|
stbState.endSave(); // Only on success
|
|
669
|
+
stbState.refresh();
|
|
667
670
|
return saved_row;
|
|
668
671
|
} catch (e) {
|
|
669
672
|
// Auto-clear errors after 2 seconds
|
|
@@ -691,6 +694,13 @@
|
|
|
691
694
|
} else {
|
|
692
695
|
// Fallback for generic errors
|
|
693
696
|
$new_row.errors = { general: e.message || "Save failed" };
|
|
697
|
+
stbState.endSave(); // End save state on generic errors as well
|
|
698
|
+
notificationStore.actions.error(
|
|
699
|
+
"Failed to insert " +
|
|
700
|
+
(entitySingular || "Row") +
|
|
701
|
+
": " +
|
|
702
|
+
(e.message || "Unknown error"),
|
|
703
|
+
);
|
|
694
704
|
}
|
|
695
705
|
}
|
|
696
706
|
}
|
|
@@ -896,6 +906,15 @@
|
|
|
896
906
|
? [ids]
|
|
897
907
|
: [];
|
|
898
908
|
},
|
|
909
|
+
refreshColumns: () => {
|
|
910
|
+
columnStates?.forEach(({ state }) => state.unlockWidth());
|
|
911
|
+
},
|
|
912
|
+
startResize: () => {
|
|
913
|
+
resizing.set(true);
|
|
914
|
+
},
|
|
915
|
+
endResize: () => {
|
|
916
|
+
resizing.set(false);
|
|
917
|
+
},
|
|
899
918
|
};
|
|
900
919
|
|
|
901
920
|
// Super Table State Machine
|
|
@@ -1496,6 +1515,9 @@
|
|
|
1496
1515
|
limit,
|
|
1497
1516
|
});
|
|
1498
1517
|
|
|
1518
|
+
// Allow Columns to resize
|
|
1519
|
+
$: tableAPI.refreshColumns(tableWidth, $stbData.loaded);
|
|
1520
|
+
|
|
1499
1521
|
// Virtual List Capabilities reacting to viewport change
|
|
1500
1522
|
$: stbState.calculateBoundaries(
|
|
1501
1523
|
clientHeight,
|
|
@@ -1584,17 +1606,6 @@
|
|
|
1584
1606
|
if (timer) clearInterval(timer);
|
|
1585
1607
|
if (scrollLockTimeout) clearTimeout(scrollLockTimeout);
|
|
1586
1608
|
});
|
|
1587
|
-
|
|
1588
|
-
// Unlock columns when table width changes to allow responsive re-rendering
|
|
1589
|
-
let previousTableWidth = 0;
|
|
1590
|
-
$: if (
|
|
1591
|
-
(tableWidth > 0 && tableWidth !== previousTableWidth) ||
|
|
1592
|
-
$columnsStore
|
|
1593
|
-
) {
|
|
1594
|
-
previousTableWidth = tableWidth;
|
|
1595
|
-
// Unlock all columns to allow responsive re-rendering
|
|
1596
|
-
columnStates?.forEach(({ state }) => state.unlockWidth());
|
|
1597
|
-
}
|
|
1598
1609
|
</script>
|
|
1599
1610
|
|
|
1600
1611
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
@@ -1604,7 +1615,7 @@
|
|
|
1604
1615
|
<div
|
|
1605
1616
|
class="super-table"
|
|
1606
1617
|
class:quiet
|
|
1607
|
-
class:initializing
|
|
1618
|
+
class:initializing={initializing || $stbData.loading}
|
|
1608
1619
|
bind:this={viewport}
|
|
1609
1620
|
bind:clientWidth={tableWidth}
|
|
1610
1621
|
bind:clientHeight
|
|
@@ -1635,7 +1646,7 @@
|
|
|
1635
1646
|
hideSelectionColumn={hideSelectionColumn || $superColumns.length === 0}
|
|
1636
1647
|
/>
|
|
1637
1648
|
|
|
1638
|
-
{#if showButtonColumnLeft}
|
|
1649
|
+
{#if showButtonColumnLeft && $superColumns.length > 0 && $stbData.loaded}
|
|
1639
1650
|
<RowButtonsColumn {rowMenuItems} {menuItemsVisible} {rowMenu} />
|
|
1640
1651
|
{/if}
|
|
1641
1652
|
|
|
@@ -1690,7 +1701,7 @@
|
|
|
1690
1701
|
/>
|
|
1691
1702
|
|
|
1692
1703
|
<EmptyResultSetOverlay
|
|
1693
|
-
{isEmpty}
|
|
1704
|
+
isEmpty={isEmpty && !$stbData.loading}
|
|
1694
1705
|
message={$stbSettings.data.emptyMessage}
|
|
1695
1706
|
top={$superColumns?.length
|
|
1696
1707
|
? $stbSettings.appearance.headerHeight + 16
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
const stbSettings = getContext("stbSettings");
|
|
7
7
|
const stbState = getContext("stbState");
|
|
8
|
-
const stbData = getContext("stbData");
|
|
9
8
|
const stbHorizontalScrollPos = getContext("stbHorizontalScrollPos");
|
|
10
9
|
const stbHovered = getContext("stbHovered");
|
|
11
10
|
const stbEditing = getContext("stbEditing");
|
|
@@ -16,6 +15,8 @@
|
|
|
16
15
|
|
|
17
16
|
const stbAPI = getContext("stbAPI");
|
|
18
17
|
|
|
18
|
+
const allContext = getContext("context");
|
|
19
|
+
|
|
19
20
|
export let right;
|
|
20
21
|
export let rowMenu;
|
|
21
22
|
export let rowMenuItems;
|
|
@@ -57,6 +58,12 @@
|
|
|
57
58
|
<div
|
|
58
59
|
class="super-column-body"
|
|
59
60
|
style:margin-top={"var(--super-column-top-offset)"}
|
|
61
|
+
style:border-right={right
|
|
62
|
+
? null
|
|
63
|
+
: "1px solid var(--super-table-devider-color, --spectrum-global-color-gray-200)"}
|
|
64
|
+
style:border-left={right
|
|
65
|
+
? "1px solid var(--super-table-devider-color, --spectrum-global-color-gray-200)"
|
|
66
|
+
: null}
|
|
60
67
|
class:quiet
|
|
61
68
|
class:sticky
|
|
62
69
|
class:zebra={$stbSettings.appearance.zebraColors}
|
|
@@ -76,7 +83,7 @@
|
|
|
76
83
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
77
84
|
<div
|
|
78
85
|
class="row-buttons"
|
|
79
|
-
style:gap={inlineButtons.length > 1 ? "0.
|
|
86
|
+
style:gap={inlineButtons.length > 1 ? "0.25rem" : "0rem"}
|
|
80
87
|
>
|
|
81
88
|
{#if rowMenu && inlineButtons?.length}
|
|
82
89
|
{#each inlineButtons as { conditions, disabledTemplate, onClick, disabled, ...rest }}
|
|
@@ -89,6 +96,7 @@
|
|
|
89
96
|
stbAPI.shouldDisableButton(
|
|
90
97
|
disabledTemplate,
|
|
91
98
|
stbAPI.enrichContext($data[visibleRow]),
|
|
99
|
+
$allContext,
|
|
92
100
|
)}
|
|
93
101
|
onClick={() => {
|
|
94
102
|
stbAPI.executeRowButtonAction(visibleRow, onClick);
|
|
@@ -99,7 +107,7 @@
|
|
|
99
107
|
{/if}
|
|
100
108
|
{#if rowMenu && menuItems?.length}
|
|
101
109
|
<SuperButton
|
|
102
|
-
size="
|
|
110
|
+
size="XS"
|
|
103
111
|
icon={menuIcon}
|
|
104
112
|
text=""
|
|
105
113
|
quiet="true"
|
|
@@ -134,20 +142,28 @@
|
|
|
134
142
|
{#if menuItems?.length}
|
|
135
143
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
136
144
|
<div class="action-menu">
|
|
137
|
-
{#each menuItems as { text, icon, disabled, onClick, size }}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
{#each menuItems as { text, icon, disabled, onClick, size, conditions, disabledTemplate }}
|
|
146
|
+
{#if stbAPI.shouldShowButton(conditions || [], stbAPI.enrichContext($data[$stbMenuID]))}
|
|
147
|
+
<SuperButton
|
|
148
|
+
{size}
|
|
149
|
+
{icon}
|
|
150
|
+
{text}
|
|
151
|
+
disabled={disabled ||
|
|
152
|
+
$stbEditing == $stbMenuID ||
|
|
153
|
+
$rowMetadata[$stbMenuID].disabled ||
|
|
154
|
+
stbAPI.shouldDisableButton(
|
|
155
|
+
disabledTemplate,
|
|
156
|
+
stbAPI.enrichContext($data[$stbMenuID]),
|
|
157
|
+
)}
|
|
158
|
+
menuItem
|
|
159
|
+
menuAlign={right ? "right" : "left"}
|
|
160
|
+
onClick={() => {
|
|
161
|
+
stbAPI.executeRowButtonAction($stbMenuID, onClick);
|
|
162
|
+
openMenu = false;
|
|
163
|
+
$stbMenuID = undefined;
|
|
164
|
+
}}
|
|
165
|
+
/>
|
|
166
|
+
{/if}
|
|
151
167
|
{/each}
|
|
152
168
|
</div>
|
|
153
169
|
{/if}
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
class:quiet
|
|
74
74
|
class:sticky
|
|
75
75
|
style:margin-top={"var(--super-column-top-offset)"}
|
|
76
|
-
style:border-right={"1px solid var(--spectrum-global-color-gray-200)"}
|
|
76
|
+
style:border-right={"1px solid var(--super-table-devider-color, --spectrum-global-color-gray-200)"}
|
|
77
77
|
>
|
|
78
78
|
{#each $stbVisibleRows as visibleRow (visibleRow)}
|
|
79
79
|
{@const selected = $stbRowMetadata[visibleRow]?.selected}
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
{#if $stbSettings.features.canSelect && !hideSelectionColumn}
|
|
96
96
|
<Checkbox
|
|
97
97
|
checked={selected}
|
|
98
|
-
|
|
98
|
+
locked={$stbRowMetadata[visibleRow]?.disabled}
|
|
99
99
|
hovered={$stbHovered == visibleRow}
|
|
100
100
|
on:change={() => stbAPI.selectRow(visibleRow)}
|
|
101
101
|
/>
|