@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
|
@@ -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 {
|
|
@@ -108,9 +108,7 @@
|
|
|
108
108
|
$: pills = cellOptions.relViewMode == "pills";
|
|
109
109
|
$: ownId = ownId || cellOptions?.ownId;
|
|
110
110
|
|
|
111
|
-
$:
|
|
112
|
-
localValue = enrichValue(value);
|
|
113
|
-
}
|
|
111
|
+
$: localValue = enrichValue(value);
|
|
114
112
|
|
|
115
113
|
$: inEdit = $cellState == "Editing";
|
|
116
114
|
$: isDirty = inEdit && originalValue != JSON.stringify(localValue);
|
|
@@ -246,36 +244,38 @@
|
|
|
246
244
|
{/if}
|
|
247
245
|
|
|
248
246
|
<div class="value" class:placeholder={localValue?.length < 1}>
|
|
249
|
-
{#
|
|
250
|
-
<
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
{#
|
|
260
|
-
<
|
|
261
|
-
<
|
|
262
|
-
|
|
247
|
+
{#key localValue}
|
|
248
|
+
{#if localValue?.length < 1}
|
|
249
|
+
<span> {placeholder} </span>
|
|
250
|
+
{:else if pills}
|
|
251
|
+
<div
|
|
252
|
+
class="items"
|
|
253
|
+
class:pills
|
|
254
|
+
class:withCount={localValue.length > 5}
|
|
255
|
+
class:inEdit
|
|
256
|
+
>
|
|
257
|
+
{#each localValue as val, idx}
|
|
258
|
+
{#if idx < 5}
|
|
259
|
+
<div class="item">
|
|
260
|
+
<span>{val.primaryDisplay}</span>
|
|
261
|
+
</div>
|
|
262
|
+
{/if}
|
|
263
|
+
{/each}
|
|
264
|
+
{#if localValue.length > 5}
|
|
265
|
+
<span class="count">
|
|
266
|
+
(+ {localValue.length - 5})
|
|
267
|
+
</span>
|
|
263
268
|
{/if}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
({localValue.length})
|
|
275
|
-
{/if}
|
|
276
|
-
{localValue.map((v) => v.primaryDisplay).join(", ")}
|
|
277
|
-
</span>
|
|
278
|
-
{/if}
|
|
269
|
+
</div>
|
|
270
|
+
{:else}
|
|
271
|
+
<span>
|
|
272
|
+
{#if cellOptions.role == "formInput" && localValue.length > 1}
|
|
273
|
+
({localValue.length})
|
|
274
|
+
{/if}
|
|
275
|
+
{localValue.map((v) => v.primaryDisplay).join(", ")}
|
|
276
|
+
</span>
|
|
277
|
+
{/if}
|
|
278
|
+
{/key}
|
|
279
279
|
</div>
|
|
280
280
|
{#if !readonly && (cellOptions.role == "formInput" || inEdit)}
|
|
281
281
|
<i class="ph ph-caret-down control-icon"></i>
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
</div>
|
|
349
349
|
{/each}
|
|
350
350
|
|
|
351
|
-
{#if $optionsFetch
|
|
351
|
+
{#if $optionsFetch}
|
|
352
352
|
<!-- Unselected rows -->
|
|
353
353
|
{#key localValue.length}
|
|
354
354
|
{#each $optionsFetch.rows as row, idx (row[relatedField])}
|
|
@@ -370,14 +370,9 @@
|
|
|
370
370
|
{#if $optionsFetch?.loading}
|
|
371
371
|
<div class="option loading">
|
|
372
372
|
<i class="ri-loader-2-line rotating"></i>
|
|
373
|
-
Loading
|
|
373
|
+
Loading...
|
|
374
374
|
</div>
|
|
375
375
|
{/if}
|
|
376
|
-
{:else if $optionsFetch?.loading && !$optionsFetch.loaded}
|
|
377
|
-
<div class="option loading">
|
|
378
|
-
<i class="ri-loader-2-line rotating"></i>
|
|
379
|
-
Loading...
|
|
380
|
-
</div>
|
|
381
376
|
{:else}
|
|
382
377
|
<div class="option">No Results Found</div>
|
|
383
378
|
{/if}
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
$: ({
|
|
39
39
|
controlType,
|
|
40
40
|
role,
|
|
41
|
-
disabled,
|
|
42
41
|
readonly,
|
|
43
42
|
error: optionError,
|
|
44
43
|
icon: optionIcon,
|
|
@@ -60,6 +59,7 @@
|
|
|
60
59
|
: (value ?? undefined);
|
|
61
60
|
$: placeholder = placeholderText ?? "";
|
|
62
61
|
$: textarea = controlType === "textarea";
|
|
62
|
+
$: disabled = cellOptions?.disabled;
|
|
63
63
|
|
|
64
64
|
// Reset when value changes externally
|
|
65
65
|
$: cellState.reset(value);
|
|
@@ -201,54 +201,56 @@
|
|
|
201
201
|
style:background
|
|
202
202
|
on:focusin={cellState.focus}
|
|
203
203
|
>
|
|
204
|
-
{#
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
{#if
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
204
|
+
{#key inEdit}
|
|
205
|
+
{#if icon && !textarea}
|
|
206
|
+
<i class={icon + " field-icon"} class:with-error={error}></i>
|
|
207
|
+
{/if}
|
|
208
|
+
{#if inEdit}
|
|
209
|
+
{#if textarea}
|
|
210
|
+
<textarea
|
|
211
|
+
tabindex="0"
|
|
212
|
+
class:placeholder={!value && !formattedValue && !localValue}
|
|
213
|
+
placeholder={cellOptions?.placeholder ?? ""}
|
|
214
|
+
value={localValue ?? ""}
|
|
215
|
+
on:input={cellState.debounce}
|
|
216
|
+
on:focusout={cellState.focusout}
|
|
217
|
+
on:keydown={cellState.handleKeyboard}
|
|
218
|
+
use:focus
|
|
219
|
+
></textarea>
|
|
220
|
+
{:else}
|
|
221
|
+
<input
|
|
222
|
+
tabindex="0"
|
|
223
|
+
class="editor"
|
|
224
|
+
class:placeholder={!value && !formattedValue && !localValue}
|
|
225
|
+
value={localValue ?? ""}
|
|
226
|
+
placeholder={cellOptions?.placeholder ?? ""}
|
|
227
|
+
style:text-align={cellOptions.align == "center"
|
|
228
|
+
? "center"
|
|
229
|
+
: cellOptions.align == "flex-end"
|
|
230
|
+
? "right"
|
|
231
|
+
: "left"}
|
|
232
|
+
on:input={cellState.debounce}
|
|
233
|
+
on:focusout={cellState.focusout}
|
|
234
|
+
on:keydown={cellState.handleKeyboard}
|
|
235
|
+
use:focus
|
|
236
|
+
/>
|
|
237
|
+
<i
|
|
238
|
+
class="ri-close-line clear-icon"
|
|
239
|
+
class:visible={localValue && cellOptions?.clearIcon !== false}
|
|
240
|
+
on:mousedown|self|preventDefault={cellState.clear}
|
|
241
|
+
></i>
|
|
242
|
+
{/if}
|
|
219
243
|
{:else}
|
|
220
|
-
<
|
|
221
|
-
|
|
222
|
-
class
|
|
223
|
-
class:placeholder={!value && !formattedValue
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
: cellOptions.align == "flex-end"
|
|
229
|
-
? "right"
|
|
230
|
-
: "left"}
|
|
231
|
-
on:input={cellState.debounce}
|
|
232
|
-
on:focusout={cellState.focusout}
|
|
233
|
-
on:keydown={cellState.handleKeyboard}
|
|
234
|
-
use:focus
|
|
235
|
-
/>
|
|
236
|
-
<i
|
|
237
|
-
class="ri-close-line clear-icon"
|
|
238
|
-
class:visible={localValue && cellOptions?.clearIcon !== false}
|
|
239
|
-
on:mousedown|self|preventDefault={cellState.clear}
|
|
240
|
-
></i>
|
|
244
|
+
<div
|
|
245
|
+
class="value"
|
|
246
|
+
class:textarea
|
|
247
|
+
class:placeholder={!value && !formattedValue}
|
|
248
|
+
style:justify-content={cellOptions.align}
|
|
249
|
+
>
|
|
250
|
+
<span>{formattedValue || value || placeholder}</span>
|
|
251
|
+
</div>
|
|
241
252
|
{/if}
|
|
242
|
-
{
|
|
243
|
-
<div
|
|
244
|
-
class="value"
|
|
245
|
-
class:textarea
|
|
246
|
-
class:placeholder={!value && !formattedValue}
|
|
247
|
-
style:justify-content={cellOptions.align}
|
|
248
|
-
>
|
|
249
|
-
<span>{formattedValue || value || placeholder}</span>
|
|
250
|
-
</div>
|
|
251
|
-
{/if}
|
|
253
|
+
{/key}
|
|
252
254
|
</div>
|
|
253
255
|
|
|
254
256
|
<style>
|
|
@@ -354,49 +354,50 @@
|
|
|
354
354
|
: cellOptions.background}
|
|
355
355
|
style:font-weight={cellOptions.fontWeight}
|
|
356
356
|
>
|
|
357
|
-
{#
|
|
358
|
-
|
|
359
|
-
|
|
357
|
+
{#key $cellState}
|
|
358
|
+
{#if icon}
|
|
359
|
+
<i class={icon + " field-icon"} class:with-error={error}></i>
|
|
360
|
+
{/if}
|
|
360
361
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
{#if localValue && cellOptions?.clearIcon !== false}
|
|
362
|
+
{#if inEdit}
|
|
363
|
+
<input
|
|
364
|
+
bind:this={inputElement}
|
|
365
|
+
tabindex="0"
|
|
366
|
+
class="editor"
|
|
367
|
+
{placeholder}
|
|
368
|
+
style:color={!isComplete
|
|
369
|
+
? "var(--spectrum-global-color-gray-700)"
|
|
370
|
+
: cellOptions.color}
|
|
371
|
+
style:text-align={cellOptions.align == "center"
|
|
372
|
+
? "center"
|
|
373
|
+
: cellOptions.align == "flex-end"
|
|
374
|
+
? "right"
|
|
375
|
+
: "left"}
|
|
376
|
+
style:padding-right={cellOptions.align != "flex-start"
|
|
377
|
+
? "2rem"
|
|
378
|
+
: "0.75rem"}
|
|
379
|
+
on:focusout={cellState.focusout}
|
|
380
|
+
on:keydown={cellState.handleKeyboard}
|
|
381
|
+
use:focus
|
|
382
|
+
use:initIMask={mask}
|
|
383
|
+
/>
|
|
384
384
|
<i
|
|
385
|
-
class="ri-close-line
|
|
385
|
+
class="ri-close-line clear-icon"
|
|
386
|
+
class:visible={localValue && cellOptions?.clearIcon !== false}
|
|
386
387
|
on:mousedown|self|preventDefault={cellState.clear}
|
|
387
388
|
></i>
|
|
389
|
+
{:else}
|
|
390
|
+
<div
|
|
391
|
+
class="value"
|
|
392
|
+
tabindex={cellOptions.readonly || cellOptions.disabled ? "-1" : "0"}
|
|
393
|
+
class:placeholder={!value}
|
|
394
|
+
style:justify-content={cellOptions.align}
|
|
395
|
+
on:focusin={cellState.focus}
|
|
396
|
+
>
|
|
397
|
+
<span>
|
|
398
|
+
{displayValue || placeholder}
|
|
399
|
+
</span>
|
|
400
|
+
</div>
|
|
388
401
|
{/if}
|
|
389
|
-
{
|
|
390
|
-
<div
|
|
391
|
-
class="value"
|
|
392
|
-
tabindex={cellOptions.readonly || cellOptions.disabled ? "-1" : "0"}
|
|
393
|
-
class:placeholder={!value}
|
|
394
|
-
style:justify-content={cellOptions.align}
|
|
395
|
-
on:focusin={cellState.focus}
|
|
396
|
-
>
|
|
397
|
-
<span>
|
|
398
|
-
{displayValue || placeholder}
|
|
399
|
-
</span>
|
|
400
|
-
</div>
|
|
401
|
-
{/if}
|
|
402
|
+
{/key}
|
|
402
403
|
</div>
|
|
@@ -192,6 +192,7 @@
|
|
|
192
192
|
startResizing(e) {
|
|
193
193
|
e.stopPropagation();
|
|
194
194
|
e.preventDefault();
|
|
195
|
+
stbAPI.startResize();
|
|
195
196
|
resizing = true;
|
|
196
197
|
startPoint = e.clientX;
|
|
197
198
|
startWidth = viewport.clientWidth;
|
|
@@ -203,6 +204,7 @@
|
|
|
203
204
|
stopResizing(e) {
|
|
204
205
|
e.preventDefault();
|
|
205
206
|
e.stopPropagation();
|
|
207
|
+
stbAPI.endResize();
|
|
206
208
|
resizing = false;
|
|
207
209
|
startPoint = undefined;
|
|
208
210
|
width = $lockWidth;
|