@poirazis/supercomponents-shared 1.2.16 → 1.2.19
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 +17785 -22317
- package/dist/index.umd.cjs +19 -19
- package/package.json +13 -13
- package/src/index.js +1 -0
- package/src/index.ts +1 -0
- package/src/lib/SuperButton/SuperButton.svelte +90 -43
- package/src/lib/SuperField/SuperField.svelte +2 -3
- package/src/lib/SuperForm/InnerForm.svelte +7 -8
- package/src/lib/SuperTable/SuperTable.css +13 -6
- package/src/lib/SuperTable/SuperTable.svelte +53 -38
- package/src/lib/SuperTable/constants.js +1 -1
- package/src/lib/SuperTable/controls/RowButtonsColumn.svelte +34 -18
- package/src/lib/SuperTable/controls/SelectionColumn.svelte +6 -5
- package/src/lib/SuperTableCells/CellBoolean.svelte +52 -45
- package/src/lib/SuperTableCells/CellCommon.css +0 -5
- 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 +60 -33
- package/src/lib/SuperTableCells/CellOptionsAdvanced.svelte +131 -129
- package/src/lib/SuperTableCells/CellSQLLink.svelte +35 -33
- package/src/lib/SuperTableCells/CellSQLLinkPicker.svelte +4 -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 +1 -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 +69 -11
- package/src/lib/UI/elements/Switch.svelte +162 -0
- package/src/lib/UI/elements/Textbox.svelte +210 -0
- package/src/lib/UI/elements/Tooltip.svelte +15 -43
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poirazis/supercomponents-shared",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"description": "Shared Svelte components library",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"packageManager": "bun@1.
|
|
6
|
+
"packageManager": "bun@1.3.11",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
9
9
|
"svelte": "src/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/poirazis/
|
|
24
|
+
"url": "https://github.com/poirazis/supercomponents_shared.git"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"svelte",
|
|
@@ -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
|
}
|
package/src/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { default as SuperPopover } from "./lib/SuperPopover/SuperPopover.svelte"
|
|
|
16
16
|
// UI Elements
|
|
17
17
|
export { default as Tooltip } from "./lib/UI/elements/Tooltip.svelte";
|
|
18
18
|
export { default as IconButton } from "./lib/UI/elements/IconButton.svelte";
|
|
19
|
+
export { default as Textbox } from "./lib/UI/elements/Textbox.svelte";
|
|
19
20
|
|
|
20
21
|
// Table components
|
|
21
22
|
export { default as SuperTable } from "./lib/SuperTable/SuperTable.svelte";
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export { default as SuperPopover } from "./lib/SuperPopover/SuperPopover.svelte"
|
|
|
15
15
|
|
|
16
16
|
// UI Elements
|
|
17
17
|
export { default as Tooltip } from "./lib/UI/elements/Tooltip.svelte";
|
|
18
|
+
export { default as Textbox } from "./lib/UI/elements/Textbox.svelte";
|
|
18
19
|
|
|
19
20
|
// Table components
|
|
20
21
|
export { default as SuperTable } from "./lib/SuperTable/SuperTable.svelte";
|
|
@@ -1,27 +1,31 @@
|
|
|
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;
|
|
19
|
-
|
|
23
|
+
export let confirm = false;
|
|
24
|
+
export let condition = undefined;
|
|
20
25
|
// Visibility Conditions
|
|
21
26
|
export const conditions = []; // Array of condition objects {field, operator, value}
|
|
22
27
|
|
|
23
28
|
export let actionsMode = "normal";
|
|
24
|
-
export let condition = undefined; // For backward compatibility
|
|
25
29
|
export let loopSource = undefined;
|
|
26
30
|
export let loopDelay = 0;
|
|
27
31
|
export let loopEvent = undefined;
|
|
@@ -36,43 +40,65 @@
|
|
|
36
40
|
export let onLoopEnd = undefined;
|
|
37
41
|
export let onTrueCondition = undefined;
|
|
38
42
|
export let onFalseCondition = undefined;
|
|
43
|
+
export let workingState;
|
|
44
|
+
|
|
45
|
+
$: enrichedAction = Array.isArray(onClick)
|
|
46
|
+
? enrichButtonActions(onClick, $context)
|
|
47
|
+
: onClick;
|
|
39
48
|
|
|
40
49
|
$: loop = safeParse(loopSource);
|
|
41
|
-
$:
|
|
42
|
-
? "
|
|
43
|
-
:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
$: buttonText = confirmMode
|
|
51
|
+
? "Confirm"
|
|
52
|
+
: text || (actionsMode == "timer" ? timerDuration : "");
|
|
53
|
+
$: icon_class =
|
|
54
|
+
working || workingState
|
|
55
|
+
? "ph ph-spinner-gap ph-spin"
|
|
56
|
+
: icon && !icon.startsWith("ri-")
|
|
57
|
+
? "ph ph-" + icon
|
|
58
|
+
: icon
|
|
59
|
+
? icon
|
|
60
|
+
: actionsMode == "timer"
|
|
61
|
+
? "ph ph-timer"
|
|
62
|
+
: undefined;
|
|
48
63
|
|
|
49
64
|
let working = false;
|
|
50
65
|
let ui_timer = undefined;
|
|
51
66
|
let elapsed = 0;
|
|
67
|
+
let confirmMode = false;
|
|
52
68
|
|
|
53
69
|
let buttonElement;
|
|
54
70
|
let tooltipShow = false;
|
|
55
71
|
let tooltipTimer;
|
|
56
72
|
|
|
57
73
|
const showTooltip = () => {
|
|
58
|
-
if (disabled) return;
|
|
74
|
+
if (disabled || tooltipShow || !tooltip) return;
|
|
59
75
|
if (tooltipTimer) clearTimeout(tooltipTimer);
|
|
60
76
|
tooltipTimer = setTimeout(() => {
|
|
61
77
|
tooltipShow = true;
|
|
62
|
-
},
|
|
78
|
+
}, 500);
|
|
63
79
|
};
|
|
64
80
|
|
|
65
|
-
const hideTooltip = () => {
|
|
81
|
+
const hideTooltip = (e) => {
|
|
66
82
|
if (tooltipTimer) {
|
|
67
83
|
clearTimeout(tooltipTimer);
|
|
68
|
-
tooltipTimer = null;
|
|
69
84
|
}
|
|
70
85
|
tooltipShow = false;
|
|
86
|
+
confirmMode = false;
|
|
71
87
|
};
|
|
72
88
|
|
|
73
89
|
async function handleClick(e) {
|
|
74
|
-
if (disabled ||
|
|
90
|
+
if (disabled || actionsMode == "timer") return;
|
|
91
|
+
|
|
92
|
+
// Handle confirmation flow
|
|
93
|
+
if (confirm && !confirmMode) {
|
|
94
|
+
confirmMode = true;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Reset confirm mode after executing action
|
|
99
|
+
confirmMode = false;
|
|
75
100
|
working = true;
|
|
101
|
+
tooltipShow = false;
|
|
76
102
|
if (actionsMode == "loop") {
|
|
77
103
|
if (onLoopStart) await onLoopStart({ iterations: loopSource?.length });
|
|
78
104
|
if (Array.isArray(loop) && loopEvent) {
|
|
@@ -85,8 +111,8 @@
|
|
|
85
111
|
} else if (actionsMode == "conditional") {
|
|
86
112
|
if (condition == true) await onTrueCondition?.();
|
|
87
113
|
else await onFalseCondition?.();
|
|
88
|
-
} else if (
|
|
89
|
-
await
|
|
114
|
+
} else if (enrichedAction) {
|
|
115
|
+
await enrichedAction?.(e);
|
|
90
116
|
}
|
|
91
117
|
working = false;
|
|
92
118
|
}
|
|
@@ -131,9 +157,14 @@
|
|
|
131
157
|
|
|
132
158
|
<button
|
|
133
159
|
bind:this={buttonElement}
|
|
134
|
-
on:click={
|
|
160
|
+
on:click={(e) => {
|
|
161
|
+
handleClick(e);
|
|
162
|
+
}}
|
|
135
163
|
on:mouseenter={showTooltip}
|
|
136
164
|
on:mouseleave={hideTooltip}
|
|
165
|
+
on:blur={() => {
|
|
166
|
+
confirmMode = false;
|
|
167
|
+
}}
|
|
137
168
|
tabindex={disabled ? -1 : 0}
|
|
138
169
|
class:super-button={true}
|
|
139
170
|
class:xsmall={size == "XS"}
|
|
@@ -157,15 +188,16 @@
|
|
|
157
188
|
? "spectrum-ActionButton spectrum-ActionButton--size" + size
|
|
158
189
|
: "spectrum-Button spectrum-Button--size" + size}
|
|
159
190
|
class:disabled
|
|
160
|
-
class:working
|
|
191
|
+
class:working={working || workingState}
|
|
161
192
|
>
|
|
162
193
|
<i
|
|
163
|
-
class={icon_class}
|
|
194
|
+
class={confirmMode ? "ph ph-check" : icon_class}
|
|
195
|
+
class:ph-fill={filledIcon}
|
|
164
196
|
style:order={iconAfterText ? 1 : 0}
|
|
165
197
|
style:color={disabled ? "var(--spectrum-global-color-gray-400)" : iconColor}
|
|
166
198
|
></i>
|
|
167
199
|
|
|
168
|
-
<span>{
|
|
200
|
+
<span>{buttonText}</span>
|
|
169
201
|
</button>
|
|
170
202
|
|
|
171
203
|
{#if tooltip}
|
|
@@ -181,31 +213,48 @@
|
|
|
181
213
|
align-items: center;
|
|
182
214
|
justify-content: center;
|
|
183
215
|
padding: 0rem 1rem;
|
|
184
|
-
min-width:
|
|
185
|
-
gap: 0.
|
|
216
|
+
min-width: 4rem;
|
|
217
|
+
gap: 0.75rem;
|
|
186
218
|
height: 2rem;
|
|
219
|
+
transition: all 150ms ease-in-out;
|
|
187
220
|
|
|
221
|
+
&.spectrum-ActionButton {
|
|
222
|
+
padding: 0rem 0.75rem !important;
|
|
223
|
+
border-radius: 4px !important;
|
|
224
|
+
}
|
|
225
|
+
&.spectrum-ActionButton.xsmall {
|
|
226
|
+
padding: 0rem 0.5rem !important;
|
|
227
|
+
border-radius: 4px !important;
|
|
228
|
+
}
|
|
188
229
|
&.xsmall {
|
|
189
230
|
height: 1.5rem;
|
|
190
|
-
|
|
191
|
-
padding: 0rem 0.5rem;
|
|
231
|
+
padding: 0rem 0.75rem;
|
|
192
232
|
min-width: unset;
|
|
233
|
+
gap: 0.5rem;
|
|
234
|
+
font-size: 12px;
|
|
235
|
+
border-radius: 1rem;
|
|
193
236
|
}
|
|
194
237
|
|
|
195
238
|
&.small {
|
|
196
239
|
min-width: 4rem;
|
|
197
|
-
padding: 0rem
|
|
240
|
+
padding: 0rem 0.75rem;
|
|
198
241
|
gap: 0.5rem;
|
|
199
|
-
height: 1.
|
|
242
|
+
height: 1.75rem;
|
|
243
|
+
font-size: 13px;
|
|
200
244
|
}
|
|
201
245
|
|
|
202
246
|
&.large {
|
|
203
247
|
height: 2.25rem;
|
|
248
|
+
font-size: 16px;
|
|
249
|
+
padding: 0rem 1.25rem;
|
|
250
|
+
|
|
251
|
+
& > i {
|
|
252
|
+
font-size: 18px;
|
|
253
|
+
}
|
|
204
254
|
}
|
|
205
255
|
|
|
206
256
|
& > span {
|
|
207
257
|
white-space: nowrap;
|
|
208
|
-
font-size: 14px;
|
|
209
258
|
font-weight: 600;
|
|
210
259
|
}
|
|
211
260
|
|
|
@@ -227,7 +276,6 @@
|
|
|
227
276
|
& > i {
|
|
228
277
|
display: none;
|
|
229
278
|
opacity: 0.9;
|
|
230
|
-
font-weight: 400;
|
|
231
279
|
}
|
|
232
280
|
}
|
|
233
281
|
|
|
@@ -300,24 +348,20 @@
|
|
|
300
348
|
}
|
|
301
349
|
}
|
|
302
350
|
&:hover,
|
|
303
|
-
&:focus {
|
|
351
|
+
&:focus:not(.working) {
|
|
304
352
|
background-color: var(--spectrum-global-color-gray-900);
|
|
305
353
|
}
|
|
306
|
-
|
|
307
|
-
&:active {
|
|
308
|
-
border: 1px solid var(--spectrum-global-color-blue-700);
|
|
309
|
-
}
|
|
310
354
|
}
|
|
311
355
|
.primary {
|
|
312
356
|
&:hover,
|
|
313
357
|
&: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-
|
|
358
|
+
border: 1px solid var(--spectrum-global-color-gray-500);
|
|
359
|
+
background-color: var(--spectrum-global-color-gray-200);
|
|
360
|
+
color: var(--spectrum-global-color-gray-900);
|
|
317
361
|
}
|
|
318
362
|
&:active {
|
|
319
363
|
background-color: var(--spectrum-global-color-gray-100);
|
|
320
|
-
border: 1px solid var(--spectrum-global-color-gray-
|
|
364
|
+
border: 1px solid var(--spectrum-global-color-gray-500);
|
|
321
365
|
}
|
|
322
366
|
|
|
323
367
|
&.quiet {
|
|
@@ -340,7 +384,7 @@
|
|
|
340
384
|
background-color: transparent;
|
|
341
385
|
|
|
342
386
|
&:hover {
|
|
343
|
-
background-color: var(--spectrum-global-color-gray-
|
|
387
|
+
background-color: var(--spectrum-global-color-gray-300);
|
|
344
388
|
}
|
|
345
389
|
}
|
|
346
390
|
|
|
@@ -365,6 +409,8 @@
|
|
|
365
409
|
|
|
366
410
|
&:hover {
|
|
367
411
|
border-color: var(--spectrum-global-color-red-400);
|
|
412
|
+
background-color: var(--spectrum-global-color-red-400);
|
|
413
|
+
color: white;
|
|
368
414
|
font-weight: bolder;
|
|
369
415
|
}
|
|
370
416
|
|
|
@@ -411,14 +457,15 @@
|
|
|
411
457
|
|
|
412
458
|
.working {
|
|
413
459
|
cursor: progress;
|
|
414
|
-
border: 1px solid var(--spectrum-global-color-gray-
|
|
460
|
+
border: 1px solid var(--spectrum-global-color-gray-400) !important;
|
|
461
|
+
background-color: var(--spectrum-global-color-gray-300) !important;
|
|
415
462
|
& > span {
|
|
416
|
-
color: var(--spectrum-global-color-gray-600);
|
|
463
|
+
color: var(--spectrum-global-color-gray-600) !important;
|
|
417
464
|
}
|
|
418
465
|
& > i {
|
|
419
466
|
display: block;
|
|
420
467
|
animation: spin 1s linear infinite;
|
|
421
|
-
color: var(--spectrum-global-color-
|
|
468
|
+
color: var(--spectrum-global-color-gray-700) !important;
|
|
422
469
|
}
|
|
423
470
|
}
|
|
424
471
|
</style>
|
|
@@ -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;
|
|
@@ -200,7 +198,8 @@
|
|
|
200
198
|
|
|
201
199
|
& > .error-message {
|
|
202
200
|
color: var(--spectrum-global-color-red-400);
|
|
203
|
-
font-size:
|
|
201
|
+
font-size: 10px;
|
|
202
|
+
white-space: nowrap;
|
|
204
203
|
}
|
|
205
204
|
}
|
|
206
205
|
</style>
|
|
@@ -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 {
|
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
const filterStore = memo(filter);
|
|
133
133
|
const cachedRows = writable([]);
|
|
134
134
|
const loading = writable(false);
|
|
135
|
+
const resizing = writable(false);
|
|
135
136
|
|
|
136
137
|
$: dataSourceStore.set(dataSource);
|
|
137
138
|
$: filterStore.set(filter);
|
|
@@ -659,11 +660,12 @@
|
|
|
659
660
|
// Clear errors on success
|
|
660
661
|
$new_row.errors = {};
|
|
661
662
|
$new_row = $new_row;
|
|
662
|
-
|
|
663
|
+
|
|
663
664
|
let richContext = { ...$context, [comp_id]: { row: saved_row } };
|
|
664
665
|
let cmd_after = enrichButtonActions(afterInsert, richContext);
|
|
665
666
|
await cmd_after?.({ row: saved_row });
|
|
666
667
|
stbState.endSave(); // Only on success
|
|
668
|
+
stbState.refresh();
|
|
667
669
|
return saved_row;
|
|
668
670
|
} catch (e) {
|
|
669
671
|
// Auto-clear errors after 2 seconds
|
|
@@ -691,6 +693,13 @@
|
|
|
691
693
|
} else {
|
|
692
694
|
// Fallback for generic errors
|
|
693
695
|
$new_row.errors = { general: e.message || "Save failed" };
|
|
696
|
+
stbState.endSave(); // End save state on generic errors as well
|
|
697
|
+
notificationStore.actions.error(
|
|
698
|
+
"Failed to insert " +
|
|
699
|
+
(entitySingular || "Row") +
|
|
700
|
+
": " +
|
|
701
|
+
(e.message || "Unknown error"),
|
|
702
|
+
);
|
|
694
703
|
}
|
|
695
704
|
}
|
|
696
705
|
}
|
|
@@ -896,6 +905,15 @@
|
|
|
896
905
|
? [ids]
|
|
897
906
|
: [];
|
|
898
907
|
},
|
|
908
|
+
refreshColumns: () => {
|
|
909
|
+
columnStates?.forEach(({ state }) => state.unlockWidth());
|
|
910
|
+
},
|
|
911
|
+
startResize: () => {
|
|
912
|
+
resizing.set(true);
|
|
913
|
+
},
|
|
914
|
+
endResize: () => {
|
|
915
|
+
resizing.set(false);
|
|
916
|
+
},
|
|
899
917
|
};
|
|
900
918
|
|
|
901
919
|
// Super Table State Machine
|
|
@@ -1496,6 +1514,9 @@
|
|
|
1496
1514
|
limit,
|
|
1497
1515
|
});
|
|
1498
1516
|
|
|
1517
|
+
// Allow Columns to resize
|
|
1518
|
+
$: tableAPI.refreshColumns(tableWidth, $stbData.loaded);
|
|
1519
|
+
|
|
1499
1520
|
// Virtual List Capabilities reacting to viewport change
|
|
1500
1521
|
$: stbState.calculateBoundaries(
|
|
1501
1522
|
clientHeight,
|
|
@@ -1584,17 +1605,6 @@
|
|
|
1584
1605
|
if (timer) clearInterval(timer);
|
|
1585
1606
|
if (scrollLockTimeout) clearTimeout(scrollLockTimeout);
|
|
1586
1607
|
});
|
|
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
1608
|
</script>
|
|
1599
1609
|
|
|
1600
1610
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
@@ -1604,7 +1614,7 @@
|
|
|
1604
1614
|
<div
|
|
1605
1615
|
class="super-table"
|
|
1606
1616
|
class:quiet
|
|
1607
|
-
class:initializing
|
|
1617
|
+
class:initializing={initializing || $stbData.loading}
|
|
1608
1618
|
bind:this={viewport}
|
|
1609
1619
|
bind:clientWidth={tableWidth}
|
|
1610
1620
|
bind:clientHeight
|
|
@@ -1630,30 +1640,35 @@
|
|
|
1630
1640
|
>
|
|
1631
1641
|
<Provider {actions} data={dataContext} />
|
|
1632
1642
|
|
|
1633
|
-
|
|
1634
|
-
<
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
{#if showButtonColumnLeft}
|
|
1639
|
-
<RowButtonsColumn {rowMenuItems} {menuItemsVisible} {rowMenu} />
|
|
1640
|
-
{/if}
|
|
1641
|
-
|
|
1642
|
-
{#if stickFirstColumn && $superColumns.length > 1}
|
|
1643
|
-
<SuperTableColumn
|
|
1644
|
-
sticky={true}
|
|
1645
|
-
scrollPos={$stbHorizontalScrollPos}
|
|
1646
|
-
columnOptions={{
|
|
1647
|
-
...$superColumns[0],
|
|
1648
|
-
...$commonColumnOptions,
|
|
1649
|
-
overflow,
|
|
1650
|
-
isFirst: true,
|
|
1651
|
-
isLast:
|
|
1652
|
-
$superColumns?.length == 1 && !showButtonColumnRight && canScroll,
|
|
1653
|
-
}}
|
|
1643
|
+
{#if !isEmpty}
|
|
1644
|
+
<ControlSection>
|
|
1645
|
+
<SelectionColumn
|
|
1646
|
+
hideSelectionColumn={hideSelectionColumn ||
|
|
1647
|
+
$superColumns.length === 0}
|
|
1654
1648
|
/>
|
|
1655
|
-
|
|
1656
|
-
|
|
1649
|
+
|
|
1650
|
+
{#if showButtonColumnLeft && $superColumns.length > 0 && $stbData.loaded}
|
|
1651
|
+
<RowButtonsColumn {rowMenuItems} {menuItemsVisible} {rowMenu} />
|
|
1652
|
+
{/if}
|
|
1653
|
+
|
|
1654
|
+
{#if stickFirstColumn && $superColumns.length > 1}
|
|
1655
|
+
<SuperTableColumn
|
|
1656
|
+
sticky={true}
|
|
1657
|
+
scrollPos={$stbHorizontalScrollPos}
|
|
1658
|
+
columnOptions={{
|
|
1659
|
+
...$superColumns[0],
|
|
1660
|
+
...$commonColumnOptions,
|
|
1661
|
+
overflow,
|
|
1662
|
+
isFirst: true,
|
|
1663
|
+
isLast:
|
|
1664
|
+
$superColumns?.length == 1 &&
|
|
1665
|
+
!showButtonColumnRight &&
|
|
1666
|
+
canScroll,
|
|
1667
|
+
}}
|
|
1668
|
+
/>
|
|
1669
|
+
{/if}
|
|
1670
|
+
</ControlSection>
|
|
1671
|
+
{/if}
|
|
1657
1672
|
|
|
1658
1673
|
<ColumnsSection
|
|
1659
1674
|
{stbSettings}
|
|
@@ -1667,7 +1682,7 @@
|
|
|
1667
1682
|
{/key}
|
|
1668
1683
|
</ColumnsSection>
|
|
1669
1684
|
|
|
1670
|
-
{#if showButtonColumnRight && $superColumns.length > 0}
|
|
1685
|
+
{#if showButtonColumnRight && $superColumns.length > 0 && !isEmpty}
|
|
1671
1686
|
<ControlSection>
|
|
1672
1687
|
<RowButtonsColumn
|
|
1673
1688
|
{rowMenuItems}
|
|
@@ -1690,7 +1705,7 @@
|
|
|
1690
1705
|
/>
|
|
1691
1706
|
|
|
1692
1707
|
<EmptyResultSetOverlay
|
|
1693
|
-
{isEmpty}
|
|
1708
|
+
isEmpty={isEmpty && !$stbData.loading}
|
|
1694
1709
|
message={$stbSettings.data.emptyMessage}
|
|
1695
1710
|
top={$superColumns?.length
|
|
1696
1711
|
? $stbSettings.appearance.headerHeight + 16
|