@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
|
@@ -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>
|
|
@@ -780,7 +807,7 @@
|
|
|
780
807
|
{/if}
|
|
781
808
|
{/if}
|
|
782
809
|
|
|
783
|
-
{#if filteredOptions?.length === 0
|
|
810
|
+
{#if filteredOptions?.length === 0}
|
|
784
811
|
<div class="option">
|
|
785
812
|
<span>
|
|
786
813
|
<i class="ri-close-line"></i>
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import SuperPopover from "../SuperPopover/SuperPopover.svelte";
|
|
5
5
|
import SuperList from "../SuperList/SuperList.svelte";
|
|
6
6
|
import CellSkeleton from "./CellSkeleton.svelte";
|
|
7
|
+
import Switch from "../UI/elements/Switch.svelte";
|
|
7
8
|
import "./CellCommon.css";
|
|
8
9
|
const dispatch = createEventDispatcher();
|
|
9
10
|
const { API, QueryUtils, fetchData, memo, derivedMemo, builderStore } =
|
|
@@ -14,7 +15,6 @@
|
|
|
14
15
|
export let fieldSchema;
|
|
15
16
|
export let multi = true;
|
|
16
17
|
export let autofocus;
|
|
17
|
-
export let label;
|
|
18
18
|
|
|
19
19
|
let anchor;
|
|
20
20
|
let editor;
|
|
@@ -386,128 +386,126 @@
|
|
|
386
386
|
on:focusout={cellState.focusout}
|
|
387
387
|
on:keydown={editorState.handleKeyboard}
|
|
388
388
|
>
|
|
389
|
-
{#
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
{
|
|
393
|
-
{#
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
<input
|
|
389
|
+
{#key loading}
|
|
390
|
+
{#if loading}
|
|
391
|
+
<CellSkeleton />
|
|
392
|
+
{:else}
|
|
393
|
+
{#key controlType}
|
|
394
|
+
{#if controlType == "list"}
|
|
395
|
+
<SuperList
|
|
396
|
+
items={localValue}
|
|
397
|
+
itemsColors={$colors}
|
|
398
|
+
itemsLabels={labels}
|
|
399
|
+
showColors={cellOptions.optionsViewMode != "text"}
|
|
400
|
+
reorderOnly={cellOptions.reorderOnly}
|
|
401
|
+
placeholder={cellOptions.placeholder}
|
|
402
|
+
readonly={cellOptions.readonly || cellOptions.disabled}
|
|
403
|
+
{editorState}
|
|
404
|
+
{cellState}
|
|
405
|
+
{fullSelection}
|
|
406
|
+
bind:inactive
|
|
407
|
+
on:togglePicker={editorState.toggle}
|
|
408
|
+
on:clear={() => {
|
|
409
|
+
localValue = [];
|
|
410
|
+
editorState.close();
|
|
411
|
+
anchor.focus();
|
|
412
|
+
}}
|
|
413
|
+
on:change={(e) => {
|
|
414
|
+
localValue = [...e.detail];
|
|
415
|
+
anchor.focus();
|
|
416
|
+
}}
|
|
417
|
+
/>
|
|
418
|
+
{:else if radios == true}
|
|
419
|
+
<div
|
|
420
|
+
class="radios"
|
|
421
|
+
class:inline={role == "inlineInput"}
|
|
422
|
+
class:column={direction == "column"}
|
|
423
|
+
on:mouseleave={() => (focusedOptionIdx = -1)}
|
|
424
|
+
>
|
|
425
|
+
{#each $options as option, idx}
|
|
426
|
+
<div
|
|
427
|
+
class="radio"
|
|
428
|
+
class:selected={localValue?.includes(option)}
|
|
429
|
+
class:focused={focusedOptionIdx === idx}
|
|
430
|
+
on:mousedown={(e) => editorState.toggleOption(idx)}
|
|
431
|
+
on:mouseenter={() => (focusedOptionIdx = idx)}
|
|
432
|
+
>
|
|
433
|
+
<i
|
|
434
|
+
style:color={$colors[option]}
|
|
435
|
+
class={radios && localValue.includes(option)
|
|
436
|
+
? "ph-fill ph-radio-button"
|
|
437
|
+
: radios
|
|
438
|
+
? "ph ph-circle"
|
|
439
|
+
: localValue.includes(option)
|
|
440
|
+
? "ph-fill ph-check-square"
|
|
441
|
+
: "ph ph-square"}
|
|
442
|
+
></i>
|
|
443
|
+
{labels[option] || option}
|
|
444
|
+
</div>
|
|
445
|
+
{/each}
|
|
446
|
+
</div>
|
|
447
|
+
{:else if isButtons == true}
|
|
448
|
+
<div class="buttons">
|
|
449
|
+
{#each $options as option, idx}
|
|
450
|
+
<div
|
|
451
|
+
class="button"
|
|
452
|
+
class:selected={localValue?.includes(option)}
|
|
453
|
+
style:--option-color={$colors[option]}
|
|
454
|
+
on:click={() => editorState.toggleOption(idx)}
|
|
455
|
+
>
|
|
456
|
+
{labels[option] || option}
|
|
457
|
+
</div>
|
|
458
|
+
{/each}
|
|
459
|
+
</div>
|
|
460
|
+
{:else if controlType == "switch"}
|
|
461
|
+
<div
|
|
462
|
+
class="switches"
|
|
463
|
+
class:inline={role == "inlineInput"}
|
|
464
|
+
class:column={cellOptions.direction == "column"}
|
|
465
|
+
on:mouseleave={() => (focusedOptionIdx = -1)}
|
|
466
|
+
>
|
|
467
|
+
{#if cellOptions.toggleAll}
|
|
468
|
+
<div
|
|
469
|
+
class="switch toggle-all"
|
|
470
|
+
on:mouseenter={() => (focusedOptionIdx = -1)}
|
|
471
|
+
>
|
|
472
|
+
<div class="text">All</div>
|
|
473
|
+
{#if !(readonly || disabled)}
|
|
474
|
+
<Switch
|
|
476
475
|
checked={allSelected}
|
|
477
|
-
|
|
478
|
-
|
|
476
|
+
disabled={readonly || disabled}
|
|
477
|
+
size="small"
|
|
478
|
+
on:change={() => editorState.toggleAll()}
|
|
479
479
|
/>
|
|
480
|
-
|
|
480
|
+
{/if}
|
|
481
|
+
</div>
|
|
482
|
+
{/if}
|
|
483
|
+
{#each $options as option, idx (idx)}
|
|
484
|
+
<div
|
|
485
|
+
class="switch"
|
|
486
|
+
class:selected={localValue.includes(option)}
|
|
487
|
+
class:focused={focusedOptionIdx === idx}
|
|
488
|
+
style:--option-color={$colors[option]}
|
|
489
|
+
on:mouseenter={() => (focusedOptionIdx = idx)}
|
|
490
|
+
on:click|stopPropagation={() => editorState.toggleOption(idx)}
|
|
491
|
+
>
|
|
492
|
+
<i class={optionIcons[option] || "no-icon"}></i>
|
|
493
|
+
<div class="text">
|
|
494
|
+
{labels[option] || option}
|
|
481
495
|
</div>
|
|
482
|
-
|
|
483
|
-
</div>
|
|
484
|
-
{/if}
|
|
485
|
-
{#each $options as option, idx (idx)}
|
|
486
|
-
<div
|
|
487
|
-
class="switch"
|
|
488
|
-
class:selected={localValue.includes(option)}
|
|
489
|
-
class:focused={focusedOptionIdx === idx}
|
|
490
|
-
style:--option-color={$colors[option]}
|
|
491
|
-
on:click={(e) => editorState.toggleOption(idx)}
|
|
492
|
-
on:mouseenter={() => (focusedOptionIdx = idx)}
|
|
493
|
-
>
|
|
494
|
-
<i class={optionIcons[option] || "no-icon"}></i>
|
|
495
|
-
<div class="text">{labels[option] || option}</div>
|
|
496
|
-
<div class="spectrum-Switch spectrum-Switch--emphasized">
|
|
497
|
-
<input
|
|
496
|
+
<Switch
|
|
498
497
|
checked={localValue.includes(option)}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
498
|
+
disabled={readonly || disabled}
|
|
499
|
+
size="small"
|
|
500
|
+
on:change={() => editorState.toggleOption(idx)}
|
|
502
501
|
/>
|
|
503
|
-
<span class="spectrum-Switch-switch small"> </span>
|
|
504
502
|
</div>
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
{/
|
|
509
|
-
{/
|
|
510
|
-
{/
|
|
503
|
+
{/each}
|
|
504
|
+
</div>
|
|
505
|
+
{/if}
|
|
506
|
+
{/key}
|
|
507
|
+
{/if}
|
|
508
|
+
{/key}
|
|
511
509
|
</div>
|
|
512
510
|
|
|
513
511
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
@@ -604,7 +602,7 @@
|
|
|
604
602
|
flex: auto;
|
|
605
603
|
display: flex;
|
|
606
604
|
flex-wrap: wrap;
|
|
607
|
-
gap: 0.
|
|
605
|
+
gap: 0.25rem;
|
|
608
606
|
justify-items: flex-start;
|
|
609
607
|
}
|
|
610
608
|
|
|
@@ -612,34 +610,40 @@
|
|
|
612
610
|
flex-direction: column;
|
|
613
611
|
gap: 0.25rem;
|
|
614
612
|
}
|
|
615
|
-
.buttons .button {
|
|
613
|
+
.buttons > .button {
|
|
616
614
|
flex: none;
|
|
617
615
|
display: flex;
|
|
618
616
|
align-items: center;
|
|
619
617
|
justify-content: center;
|
|
620
618
|
padding: 0.25rem 0.75rem;
|
|
621
|
-
border: 1px solid var(--spectrum-global-color-gray-
|
|
622
|
-
border-radius:
|
|
623
|
-
background-color: var(--spectrum-global-color-gray-
|
|
619
|
+
border: 1px solid var(--spectrum-global-color-gray-400);
|
|
620
|
+
border-radius: 0.5rem;
|
|
621
|
+
background-color: var(--spectrum-global-color-gray-100);
|
|
624
622
|
color: var(--spectrum-global-color-gray-600);
|
|
625
623
|
cursor: pointer;
|
|
626
624
|
user-select: none;
|
|
627
|
-
font-
|
|
628
|
-
font-weight: 500;
|
|
625
|
+
font-weight: 400;
|
|
629
626
|
transition: all 0.15s ease-in-out;
|
|
630
627
|
white-space: nowrap;
|
|
631
628
|
text-overflow: ellipsis;
|
|
632
629
|
overflow: hidden;
|
|
633
630
|
max-width: 100%;
|
|
634
631
|
gap: 0.35rem;
|
|
632
|
+
max-height: 1.75rem;
|
|
635
633
|
}
|
|
636
634
|
|
|
637
635
|
.button:hover {
|
|
638
|
-
background-color: var(--spectrum-global-color-gray-
|
|
636
|
+
background-color: var(--spectrum-global-color-gray-300);
|
|
639
637
|
border-color: var(--spectrum-global-color-gray-300);
|
|
640
|
-
color: var(--spectrum-global-color-gray-
|
|
638
|
+
color: var(--spectrum-global-color-gray-800);
|
|
641
639
|
cursor: pointer;
|
|
642
640
|
}
|
|
641
|
+
|
|
642
|
+
.button:active {
|
|
643
|
+
border-color: var(--spectrum-global-color-gray-500);
|
|
644
|
+
color: var(--spectrum-global-color-gray-800);
|
|
645
|
+
}
|
|
646
|
+
|
|
643
647
|
.button.selected {
|
|
644
648
|
background-color: var(
|
|
645
649
|
--option-color,
|
|
@@ -703,9 +707,7 @@
|
|
|
703
707
|
}
|
|
704
708
|
|
|
705
709
|
.switches.inline {
|
|
706
|
-
|
|
707
|
-
border-radius: 4px;
|
|
708
|
-
padding: 0.25rem 0.25rem;
|
|
710
|
+
padding: 0rem;
|
|
709
711
|
}
|
|
710
712
|
|
|
711
713
|
.switches.inline > .switch {
|