@poirazis/supercomponents-shared 1.0.0 → 1.0.1
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 +3206 -3133
- package/dist/index.umd.cjs +9 -9
- package/dist/style.css +1 -1
- package/package.json +1 -57
- package/src/index.js +2 -2
- package/src/index.ts +10 -10
- package/src/lib/SuperField/SuperField.svelte +142 -0
- package/src/lib/SuperPopover/SuperPopover.svelte +1 -1
- package/src/lib/SuperTableCells/CellColor.svelte +51 -25
- package/src/lib/SuperTableCells/CellCommon.css +1 -0
- package/src/lib/SuperTableCells/CellIcon.svelte +2 -1
- package/src/lib/SuperTableCells/CellOptions.svelte +8 -11
- package/src/lib/SuperTableCells/CellOptionsAdvanced.svelte +2 -0
- package/src/lib/SuperFieldLabel/SuperFieldLabel.svelte +0 -91
- package/src/lib/SuperFieldsCommon.css +0 -54
@@ -23,7 +23,6 @@
|
|
23
23
|
let timer;
|
24
24
|
let picker;
|
25
25
|
let search;
|
26
|
-
let value_dom;
|
27
26
|
|
28
27
|
const colors = derivedMemo(options, ($options) => {
|
29
28
|
let obj = {};
|
@@ -161,6 +160,8 @@
|
|
161
160
|
_enter() {},
|
162
161
|
focus(e) {
|
163
162
|
if (!cellOptions.readonly && !cellOptions.disabled) {
|
163
|
+
// Open the popup if the focus in came from a TAB
|
164
|
+
editorState.open();
|
164
165
|
return "Editing";
|
165
166
|
}
|
166
167
|
},
|
@@ -170,7 +171,6 @@
|
|
170
171
|
originalValue = JSON.stringify(
|
171
172
|
Array.isArray(value) ? value : value ? [value] : []
|
172
173
|
);
|
173
|
-
if (controlType != "inputSelect") editorState.open();
|
174
174
|
dispatch("enteredit");
|
175
175
|
},
|
176
176
|
_exit() {
|
@@ -205,7 +205,6 @@
|
|
205
205
|
let editorState = fsm("Closed", {
|
206
206
|
"*": {
|
207
207
|
close() {
|
208
|
-
value_dom?.focus();
|
209
208
|
return "Closed";
|
210
209
|
},
|
211
210
|
toggleOption(idx) {
|
@@ -258,11 +257,9 @@
|
|
258
257
|
} else {
|
259
258
|
filteredOptions = $options;
|
260
259
|
search = false;
|
261
|
-
value_dom.focus();
|
262
260
|
}
|
263
261
|
},
|
264
262
|
toggle() {
|
265
|
-
value_dom?.focus();
|
266
263
|
return "Closed";
|
267
264
|
},
|
268
265
|
handleInputKeyboard(e) {
|
@@ -386,6 +383,7 @@
|
|
386
383
|
<div
|
387
384
|
bind:this={anchor}
|
388
385
|
class="superCell"
|
386
|
+
tabindex={cellOptions?.disabled ? "-1" : "0"}
|
389
387
|
class:isDirty={isDirty && cellOptions.showDirty}
|
390
388
|
class:inEdit
|
391
389
|
class:disabled
|
@@ -397,6 +395,9 @@
|
|
397
395
|
class:inline={role == "inlineInput"}
|
398
396
|
class:tableCell={role == "tableCell"}
|
399
397
|
class:formInput={role == "formInput"}
|
398
|
+
on:focusin={cellState.focus}
|
399
|
+
on:focusout={cellState.focusout}
|
400
|
+
on:keydown={editorState.handleKeyboard}
|
400
401
|
>
|
401
402
|
{#if icon}
|
402
403
|
<i class={icon + " icon"} />
|
@@ -450,12 +451,7 @@
|
|
450
451
|
class="value"
|
451
452
|
class:with-icon={icon}
|
452
453
|
class:placeholder={isEmpty}
|
453
|
-
|
454
|
-
bind:this={value_dom}
|
455
|
-
on:focusin={cellState.focus}
|
456
|
-
on:focusout={cellState.focusout}
|
457
|
-
on:keydown={editorState.handleKeyboard}
|
458
|
-
on:mousedown={inEdit ? editorState.toggle : () => {}}
|
454
|
+
on:mousedown={inEdit ? editorState.toggle : null}
|
459
455
|
>
|
460
456
|
{#if isEmpty}
|
461
457
|
<span>{placeholder}</span>
|
@@ -504,6 +500,7 @@
|
|
504
500
|
useAnchorWidth
|
505
501
|
maxHeight={400}
|
506
502
|
open={$editorState == "Open"}
|
503
|
+
on:close={editorState.close}
|
507
504
|
>
|
508
505
|
<div
|
509
506
|
bind:this={picker}
|
@@ -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 "./CellCommon.css";
|
7
8
|
const dispatch = createEventDispatcher();
|
8
9
|
const { API, QueryUtils, fetchData, memo, derivedMemo } = getContext("sdk");
|
9
10
|
|
@@ -612,6 +613,7 @@
|
|
612
613
|
gap: 0.25rem;
|
613
614
|
align-items: center;
|
614
615
|
cursor: pointer;
|
616
|
+
padding: 0 0.5rem;
|
615
617
|
&.focused {
|
616
618
|
background-color: var(--spectrum-global-color-gray-200) !important;
|
617
619
|
color: var(--spectrum-global-color-gray-800);
|
@@ -1,91 +0,0 @@
|
|
1
|
-
<script>
|
2
|
-
export let labelPos;
|
3
|
-
export let labelWidth;
|
4
|
-
export let label;
|
5
|
-
export let helpText;
|
6
|
-
export let error;
|
7
|
-
export let fieldState;
|
8
|
-
|
9
|
-
let showHelp;
|
10
|
-
$: width = labelPos == "left" ? (labelWidth ? labelWidth : "5rem") : "auto";
|
11
|
-
$: error = fieldState?.error;
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
15
|
-
{#if labelPos}
|
16
|
-
<div
|
17
|
-
class="superlabel"
|
18
|
-
class:notForm={!fieldState}
|
19
|
-
class:left={labelPos == "left"}
|
20
|
-
class:error
|
21
|
-
style:--label-width={width}
|
22
|
-
>
|
23
|
-
<div
|
24
|
-
class="label"
|
25
|
-
on:mouseenter={() => (showHelp = true)}
|
26
|
-
on:mouseleave={() => (showHelp = false)}
|
27
|
-
>
|
28
|
-
{#if showHelp && helpText}
|
29
|
-
{helpText}
|
30
|
-
{:else}
|
31
|
-
{label}
|
32
|
-
{/if}
|
33
|
-
</div>
|
34
|
-
{#if error}
|
35
|
-
<div class="error-message">
|
36
|
-
{error}
|
37
|
-
</div>
|
38
|
-
{/if}
|
39
|
-
</div>
|
40
|
-
{/if}
|
41
|
-
|
42
|
-
<style>
|
43
|
-
.superlabel {
|
44
|
-
flex: 0 0 auto;
|
45
|
-
width: var(--label-width);
|
46
|
-
overflow: hidden;
|
47
|
-
display: flex;
|
48
|
-
align-items: center;
|
49
|
-
justify-content: space-between;
|
50
|
-
font-size: 12px;
|
51
|
-
font-weight: 400;
|
52
|
-
line-height: 1.65rem;
|
53
|
-
color: var(--spectrum-global-color-gray-700);
|
54
|
-
padding-left: 2px;
|
55
|
-
gap: 1rem;
|
56
|
-
transition: 130ms;
|
57
|
-
|
58
|
-
&.notForm {
|
59
|
-
font-size: 14px;
|
60
|
-
padding-left: unset;
|
61
|
-
padding-bottom: 4px;
|
62
|
-
}
|
63
|
-
|
64
|
-
&.left {
|
65
|
-
flex-direction: column;
|
66
|
-
align-items: flex-start;
|
67
|
-
justify-content: center;
|
68
|
-
line-height: 1rem;
|
69
|
-
gap: 0px;
|
70
|
-
|
71
|
-
& > .label {
|
72
|
-
width: var(--label-width);
|
73
|
-
white-space: nowrap;
|
74
|
-
overflow: hidden;
|
75
|
-
text-overflow: ellipsis;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
& > .label {
|
80
|
-
min-width: 0;
|
81
|
-
white-space: nowrap;
|
82
|
-
overflow: hidden;
|
83
|
-
text-overflow: ellipsis;
|
84
|
-
}
|
85
|
-
|
86
|
-
& > .error-message {
|
87
|
-
color: var(--spectrum-global-color-red-400);
|
88
|
-
font-size: 11px;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
</style>
|
@@ -1,54 +0,0 @@
|
|
1
|
-
.superField {
|
2
|
-
width: 100%;
|
3
|
-
display: flex;
|
4
|
-
align-self: flex-start;
|
5
|
-
justify-content: stretch;
|
6
|
-
flex-direction: column;
|
7
|
-
|
8
|
-
&.left-label {
|
9
|
-
flex-direction: row;
|
10
|
-
align-items: center;
|
11
|
-
gap: 1rem;
|
12
|
-
}
|
13
|
-
&.multirow {
|
14
|
-
align-items: stretch;
|
15
|
-
|
16
|
-
& > .superlabel {
|
17
|
-
align-self: start;
|
18
|
-
|
19
|
-
&.left {
|
20
|
-
padding-top: 0.5rem;
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
&:focus-within {
|
26
|
-
& > .superlabel {
|
27
|
-
color: var(--spectrum-global-golor-gray-700);
|
28
|
-
font-weight: 500;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
.inline-cells {
|
34
|
-
flex: auto;
|
35
|
-
display: flex;
|
36
|
-
justify-content: stretch;
|
37
|
-
height: 2rem;
|
38
|
-
overflow: hidden;
|
39
|
-
|
40
|
-
&.multirow {
|
41
|
-
height: unset;
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
.inline-buttons {
|
46
|
-
display: flex;
|
47
|
-
gap: 0.25rem;
|
48
|
-
align-items: center;
|
49
|
-
padding-left: 0.5rem;
|
50
|
-
|
51
|
-
&.vertical {
|
52
|
-
flex-direction: column;
|
53
|
-
}
|
54
|
-
}
|