@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
|
@@ -145,7 +145,13 @@
|
|
|
145
145
|
|
|
146
146
|
if (singleSelect) {
|
|
147
147
|
editorState.close();
|
|
148
|
-
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (cellOptions.debounced) {
|
|
151
|
+
dispatch(
|
|
152
|
+
"change",
|
|
153
|
+
returnSingle && localValue ? localValue[0] : localValue,
|
|
154
|
+
);
|
|
149
155
|
}
|
|
150
156
|
};
|
|
151
157
|
|
|
@@ -193,7 +199,7 @@
|
|
|
193
199
|
class:open-popup={$editorState == "Open"}
|
|
194
200
|
style:color={cellOptions.color}
|
|
195
201
|
style:background={cellOptions.background}
|
|
196
|
-
on:
|
|
202
|
+
on:focus={cellState.focus}
|
|
197
203
|
on:keydown|self={handleKeyboard}
|
|
198
204
|
on:focusout={cellState.focusout}
|
|
199
205
|
on:mousedown={cellState.toggle}
|
|
@@ -203,14 +209,12 @@
|
|
|
203
209
|
{/if}
|
|
204
210
|
|
|
205
211
|
<div class="value" class:placeholder={localValue?.length < 1}>
|
|
206
|
-
{#if
|
|
207
|
-
<span> {placeholder} </span>
|
|
208
|
-
{:else if simpleView}
|
|
212
|
+
{#if simpleView}
|
|
209
213
|
<span>
|
|
210
214
|
{#if cellOptions.role == "formInput" && localValue.length > 1}
|
|
211
215
|
({localValue.length})
|
|
212
216
|
{/if}
|
|
213
|
-
{localValue.map((v) => v.primaryDisplay).join(", ")}
|
|
217
|
+
{localValue.map((v) => v.primaryDisplay).join(", ") || placeholder}
|
|
214
218
|
</span>
|
|
215
219
|
{:else}
|
|
216
220
|
<div
|
|
@@ -221,7 +225,7 @@
|
|
|
221
225
|
class:withCount={localValue.length > 5}
|
|
222
226
|
class:inEdit
|
|
223
227
|
>
|
|
224
|
-
{#each localValue as val, idx}
|
|
228
|
+
{#each localValue as val, idx (val)}
|
|
225
229
|
{#if idx < 5}
|
|
226
230
|
<div
|
|
227
231
|
class="item"
|
|
@@ -238,6 +242,11 @@
|
|
|
238
242
|
</div>
|
|
239
243
|
{/if}
|
|
240
244
|
{/each}
|
|
245
|
+
|
|
246
|
+
{#if localValue.length == 0}
|
|
247
|
+
<span>{placeholder}</span>
|
|
248
|
+
{/if}
|
|
249
|
+
|
|
241
250
|
{#if localValue.length > 5}
|
|
242
251
|
<span class="count">
|
|
243
252
|
(+ {localValue.length - 5})
|
|
@@ -265,34 +265,38 @@
|
|
|
265
265
|
<div class="list" bind:this={listElement} on:scroll={handleScroll}>
|
|
266
266
|
<div class="options">
|
|
267
267
|
{#key localValue}
|
|
268
|
-
{#
|
|
269
|
-
{#
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
268
|
+
{#key $fetch?.rows}
|
|
269
|
+
{#if $fetch?.rows?.length || ($fetch?.loading && !$fetch?.loaded)}
|
|
270
|
+
{#each $fetch?.rows || [] as row, idx (idx)}
|
|
271
|
+
<div
|
|
272
|
+
class="option"
|
|
273
|
+
class:selected={rowSelected(row)}
|
|
274
|
+
class:highlighted={focusIdx == idx}
|
|
275
|
+
on:mouseenter={() => (focusIdx = idx)}
|
|
276
|
+
on:mouseleave={() => (focusIdx = -1)}
|
|
277
|
+
on:mousedown|preventDefault|stopPropagation={selectRow(
|
|
278
|
+
row,
|
|
279
|
+
)}
|
|
280
|
+
>
|
|
281
|
+
{row[primaryDisplay]}
|
|
282
|
+
<i class="ri-check-line"></i>
|
|
283
|
+
</div>
|
|
284
|
+
{/each}
|
|
285
|
+
{#if $fetch?.loading && $fetch.loaded}
|
|
286
|
+
<div class="option loading">
|
|
287
|
+
<i class="ri-loader-2-line rotating"></i>
|
|
288
|
+
Loading more...
|
|
289
|
+
</div>
|
|
290
|
+
{/if}
|
|
291
|
+
{:else if $fetch?.loading}
|
|
283
292
|
<div class="option loading">
|
|
284
293
|
<i class="ri-loader-2-line rotating"></i>
|
|
285
|
-
Loading
|
|
294
|
+
Loading...
|
|
286
295
|
</div>
|
|
296
|
+
{:else}
|
|
297
|
+
<div class="option">No Results Found</div>
|
|
287
298
|
{/if}
|
|
288
|
-
{
|
|
289
|
-
<div class="option loading">
|
|
290
|
-
<i class="ri-loader-2-line rotating"></i>
|
|
291
|
-
Loading...
|
|
292
|
-
</div>
|
|
293
|
-
{:else}
|
|
294
|
-
<div class="option">No Results Found</div>
|
|
295
|
-
{/if}
|
|
299
|
+
{/key}
|
|
296
300
|
{/key}
|
|
297
301
|
</div>
|
|
298
302
|
</div>
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
$selectedNodes = [e.detail];
|
|
109
109
|
} else {
|
|
110
110
|
notificationStore.actions.warning(
|
|
111
|
-
"Cannot select more than " + maxNodeSelection + " items"
|
|
111
|
+
"Cannot select more than " + maxNodeSelection + " items",
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
} else {
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"change",
|
|
124
124
|
$selectedNodes.map((x) => {
|
|
125
125
|
return { _id: x.id, primaryDisplay: x.label };
|
|
126
|
-
})
|
|
126
|
+
}),
|
|
127
127
|
);
|
|
128
128
|
};
|
|
129
129
|
|
|
@@ -183,24 +183,26 @@
|
|
|
183
183
|
style="margin: unset;"
|
|
184
184
|
class:spectrum-TreeView--quiet={quiet}
|
|
185
185
|
>
|
|
186
|
-
{#
|
|
187
|
-
{#
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
186
|
+
{#key $fetch.rows}
|
|
187
|
+
{#if $fetch.loaded && $fetch.rows?.length}
|
|
188
|
+
{#each tree?.children as node, idx (idx)}
|
|
189
|
+
<SuperTree
|
|
190
|
+
tree={node}
|
|
191
|
+
nodeSelection
|
|
192
|
+
{selectedNodes}
|
|
193
|
+
on:nodeSelect={handleNodeSelect}
|
|
194
|
+
/>
|
|
195
|
+
{/each}
|
|
196
|
+
{:else if $fetch.loading}
|
|
197
|
+
<li class="spectrum-TreeView-item" class:is-open={true}>
|
|
198
|
+
<div class="spectrum-TreeView-itemLink">Loading</div>
|
|
199
|
+
</li>
|
|
200
|
+
{:else}
|
|
201
|
+
<li class="spectrum-TreeView-item" class:is-open={true}>
|
|
202
|
+
<div class="spectrum-TreeView-itemLink">No Matches</div>
|
|
203
|
+
</li>
|
|
204
|
+
{/if}
|
|
205
|
+
{/key}
|
|
204
206
|
</ul>
|
|
205
207
|
</div>
|
|
206
208
|
|
|
@@ -311,61 +311,63 @@
|
|
|
311
311
|
tabIndex={disabled ? -1 : (cellOptions.order ?? 0)}
|
|
312
312
|
on:focusin={cellState.focus}
|
|
313
313
|
>
|
|
314
|
-
{#
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
314
|
+
{#key $cellState}
|
|
315
|
+
{#if icon}
|
|
316
|
+
<i class={icon + " field-icon"} class:with-error={error}></i>
|
|
317
|
+
{/if}
|
|
318
|
+
|
|
319
|
+
{#if $cellState == "Editing"}
|
|
320
|
+
<input
|
|
321
|
+
class="editor"
|
|
322
|
+
bind:this={editor}
|
|
323
|
+
class:placeholder={!localValue}
|
|
324
|
+
style:text-align={cellOptions.align == "flex-start"
|
|
325
|
+
? "left"
|
|
326
|
+
: cellOptions.align == "center"
|
|
327
|
+
? "center"
|
|
328
|
+
: "right "}
|
|
329
|
+
value={localValue || ""}
|
|
330
|
+
on:keydown={(e) => cellState.handleKeyboard(e)}
|
|
331
|
+
on:input={(e) => cellState.handleInput(e)}
|
|
332
|
+
on:focusout={(e) => cellState.focusout(e)}
|
|
333
|
+
on:wheel={(e) => cellState.handleWheel(e)}
|
|
334
|
+
use:focus
|
|
335
|
+
/>
|
|
336
|
+
|
|
337
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
338
|
+
<i
|
|
339
|
+
class="ri-close-line clear-icon"
|
|
340
|
+
class:visible={clearValue}
|
|
341
|
+
on:mousedown|preventDefault|stopPropagation={cellState.clear}
|
|
342
|
+
>
|
|
343
|
+
</i>
|
|
344
|
+
|
|
345
|
+
{#if showStepper}
|
|
346
|
+
<div class="controls">
|
|
347
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
348
|
+
<i
|
|
349
|
+
class="ph ph-minus"
|
|
350
|
+
on:mousedown|preventDefault|stopPropagation={(e) =>
|
|
351
|
+
cellState.decrement(e)}
|
|
352
|
+
></i>
|
|
353
|
+
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
354
|
+
<i
|
|
355
|
+
class="ph ph-plus"
|
|
356
|
+
on:mousedown|preventDefault|stopPropagation={(e) =>
|
|
357
|
+
cellState.increment(e)}
|
|
358
|
+
></i>
|
|
359
|
+
</div>
|
|
360
|
+
{/if}
|
|
361
|
+
{:else}
|
|
362
|
+
<div
|
|
363
|
+
class="value"
|
|
364
|
+
class:placeholder={!value && value !== 0}
|
|
365
|
+
style:justify-content={cellOptions.align ?? "flex-end"}
|
|
366
|
+
>
|
|
367
|
+
{value != null ? formattedValue : placeholder || ""}
|
|
358
368
|
</div>
|
|
359
369
|
{/if}
|
|
360
|
-
{
|
|
361
|
-
<div
|
|
362
|
-
class="value"
|
|
363
|
-
class:placeholder={!value && value !== 0}
|
|
364
|
-
style:justify-content={cellOptions.align ?? "flex-end"}
|
|
365
|
-
>
|
|
366
|
-
{value != null ? formattedValue : placeholder || ""}
|
|
367
|
-
</div>
|
|
368
|
-
{/if}
|
|
370
|
+
{/key}
|
|
369
371
|
</div>
|
|
370
372
|
|
|
371
373
|
<style>
|
|
@@ -100,6 +100,12 @@
|
|
|
100
100
|
clearTimeout(timer);
|
|
101
101
|
timer = setTimeout(() => {
|
|
102
102
|
dispatch("change", multi ? localValue : localValue[0]);
|
|
103
|
+
dispatch(
|
|
104
|
+
"labelChange",
|
|
105
|
+
multi
|
|
106
|
+
? localValue.map((val) => $labels[val] || val)
|
|
107
|
+
: $labels[localValue[0]] || localValue[0],
|
|
108
|
+
);
|
|
103
109
|
}, cellOptions.debounce ?? 0);
|
|
104
110
|
}
|
|
105
111
|
|
|
@@ -196,7 +202,6 @@
|
|
|
196
202
|
},
|
|
197
203
|
handleKeyboard(e) {
|
|
198
204
|
if (e.key === "Backspace" || e.key === "Delete") {
|
|
199
|
-
console.log(searchTerm, "before deletion");
|
|
200
205
|
searchTerm = searchTerm.slice(0, -1);
|
|
201
206
|
this.filterOptions(searchTerm);
|
|
202
207
|
} else if (e.key.length === 1 && /[a-zA-Z0-9]/.test(e.key)) {
|
|
@@ -379,6 +384,8 @@
|
|
|
379
384
|
filteredOptions = $options;
|
|
380
385
|
},
|
|
381
386
|
loadCustomOptions() {
|
|
387
|
+
$options = [];
|
|
388
|
+
$labels = {};
|
|
382
389
|
if (customOptions?.length) {
|
|
383
390
|
customOptions.forEach((row) => {
|
|
384
391
|
$options.push(row.value || row);
|
|
@@ -469,6 +476,12 @@
|
|
|
469
476
|
if (cellOptions.debounce && isDirty) {
|
|
470
477
|
clearTimeout(timer);
|
|
471
478
|
dispatch("change", multi ? localValue : localValue[0]);
|
|
479
|
+
dispatch(
|
|
480
|
+
"labelChange",
|
|
481
|
+
multi
|
|
482
|
+
? localValue.map((val) => $labels[val] || val)
|
|
483
|
+
: $labels[localValue[0]] || localValue[0],
|
|
484
|
+
);
|
|
472
485
|
} else {
|
|
473
486
|
this.submit();
|
|
474
487
|
}
|
|
@@ -485,12 +498,24 @@
|
|
|
485
498
|
if (isDirty && !cellOptions.debounce) {
|
|
486
499
|
if (multi) dispatch("change", localValue);
|
|
487
500
|
else dispatch("change", localValue[0]);
|
|
501
|
+
|
|
502
|
+
if (multi) {
|
|
503
|
+
dispatch(
|
|
504
|
+
"labelChange",
|
|
505
|
+
localValue.map((val) => $labels[val] || val),
|
|
506
|
+
);
|
|
507
|
+
} else {
|
|
508
|
+
dispatch("labelChange", $labels[localValue[0]] || localValue[0]);
|
|
509
|
+
}
|
|
488
510
|
}
|
|
489
511
|
},
|
|
490
512
|
clear() {
|
|
491
513
|
localValue = [];
|
|
492
514
|
anchor?.focus();
|
|
493
|
-
if (cellOptions.debounce)
|
|
515
|
+
if (cellOptions.debounce) {
|
|
516
|
+
dispatch("change", null);
|
|
517
|
+
dispatch("labelChange", null);
|
|
518
|
+
}
|
|
494
519
|
},
|
|
495
520
|
cancel() {
|
|
496
521
|
localValue = JSON.parse(originalValue);
|
|
@@ -674,38 +699,40 @@
|
|
|
674
699
|
</div>
|
|
675
700
|
{:else}
|
|
676
701
|
<div class="value" class:placeholder={isEmpty && !searchTerm}>
|
|
677
|
-
{#
|
|
678
|
-
{#if
|
|
679
|
-
{
|
|
680
|
-
|
|
681
|
-
{loading ? "Loading..." : placeholder}
|
|
682
|
-
{/if}
|
|
683
|
-
{:else}
|
|
684
|
-
<div
|
|
685
|
-
class="items"
|
|
686
|
-
class:pills
|
|
687
|
-
class:bullets
|
|
688
|
-
style:justify-content={cellOptions.align ?? "flex-start"}
|
|
689
|
-
>
|
|
690
|
-
{#if plaintext}
|
|
691
|
-
{#each localValue as val, idx (val)}
|
|
692
|
-
{$labels[val] || val}
|
|
693
|
-
{idx < localValue.length - 1 ? ", " : ""}
|
|
694
|
-
{/each}
|
|
702
|
+
{#key isEmpty}
|
|
703
|
+
{#if localValue?.length < 1}
|
|
704
|
+
{#if open}
|
|
705
|
+
{searchTerm ? searchTerm : "Type to search..."}
|
|
695
706
|
{:else}
|
|
696
|
-
{
|
|
697
|
-
<div
|
|
698
|
-
class="item"
|
|
699
|
-
style:--option-color={$colors[val] ||
|
|
700
|
-
colorsArray[idx % colorsArray.length]}
|
|
701
|
-
>
|
|
702
|
-
<div class="loope"></div>
|
|
703
|
-
<span> {isObjects ? "JSON" : $labels[val] || val} </span>
|
|
704
|
-
</div>
|
|
705
|
-
{/each}
|
|
707
|
+
{loading ? "Loading..." : placeholder}
|
|
706
708
|
{/if}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
+
{:else}
|
|
710
|
+
<div
|
|
711
|
+
class="items"
|
|
712
|
+
class:pills
|
|
713
|
+
class:bullets
|
|
714
|
+
style:justify-content={cellOptions.align ?? "flex-start"}
|
|
715
|
+
>
|
|
716
|
+
{#if plaintext}
|
|
717
|
+
{#each localValue as val, idx (val)}
|
|
718
|
+
{$labels[val] || val}
|
|
719
|
+
{idx < localValue.length - 1 ? ", " : ""}
|
|
720
|
+
{/each}
|
|
721
|
+
{:else}
|
|
722
|
+
{#each localValue as val, idx (val)}
|
|
723
|
+
<div
|
|
724
|
+
class="item"
|
|
725
|
+
style:--option-color={$colors[val] ||
|
|
726
|
+
colorsArray[idx % colorsArray.length]}
|
|
727
|
+
>
|
|
728
|
+
<div class="loope"></div>
|
|
729
|
+
<span> {isObjects ? "JSON" : $labels[val] || val} </span>
|
|
730
|
+
</div>
|
|
731
|
+
{/each}
|
|
732
|
+
{/if}
|
|
733
|
+
</div>
|
|
734
|
+
{/if}
|
|
735
|
+
{/key}
|
|
709
736
|
</div>
|
|
710
737
|
{#if !readonly && (role == "formInput" || inEdit)}
|
|
711
738
|
<i class="ph ph-caret-down control-icon"></i>
|