@poirazis/supercomponents-shared 1.2.15 → 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.
Files changed (37) hide show
  1. package/dist/index.js +17704 -22252
  2. package/dist/index.umd.cjs +19 -18
  3. package/package.json +11 -11
  4. package/src/lib/SuperButton/SuperButton.svelte +65 -35
  5. package/src/lib/SuperField/SuperField.svelte +8 -11
  6. package/src/lib/SuperForm/InnerForm.svelte +14 -8
  7. package/src/lib/SuperForm/SuperForm.svelte +5 -5
  8. package/src/lib/SuperPopover/SuperPopover.svelte +1 -1
  9. package/src/lib/SuperTable/SuperTable.css +13 -6
  10. package/src/lib/SuperTable/SuperTable.svelte +28 -19
  11. package/src/lib/SuperTable/constants.js +1 -1
  12. package/src/lib/SuperTable/controls/RowButtonsColumn.svelte +33 -17
  13. package/src/lib/SuperTable/controls/SelectionColumn.svelte +2 -2
  14. package/src/lib/SuperTableCells/CellBoolean.svelte +52 -45
  15. package/src/lib/SuperTableCells/CellCommon.css +97 -35
  16. package/src/lib/SuperTableCells/CellDatetime.svelte +267 -120
  17. package/src/lib/SuperTableCells/CellLink.svelte +22 -13
  18. package/src/lib/SuperTableCells/CellLinkPickerSelect.svelte +28 -24
  19. package/src/lib/SuperTableCells/CellLinkPickerTree.svelte +22 -20
  20. package/src/lib/SuperTableCells/CellNumber.svelte +55 -53
  21. package/src/lib/SuperTableCells/CellOptions.svelte +356 -246
  22. package/src/lib/SuperTableCells/CellOptionsAdvanced.svelte +199 -180
  23. package/src/lib/SuperTableCells/CellSQLLink.svelte +32 -32
  24. package/src/lib/SuperTableCells/CellSQLLinkPicker.svelte +2 -7
  25. package/src/lib/SuperTableCells/CellSkeleton.svelte +1 -1
  26. package/src/lib/SuperTableCells/CellString.svelte +62 -80
  27. package/src/lib/SuperTableCells/CellStringMask.svelte +41 -40
  28. package/src/lib/SuperTableCells/CellStringSimple.svelte +1 -4
  29. package/src/lib/SuperTableColumn/SuperTableColumn.svelte +3 -1
  30. package/src/lib/SuperTableColumn/parts/SuperColumnBody.svelte +3 -0
  31. package/src/lib/SuperTableColumn/parts/SuperColumnHeader.svelte +44 -42
  32. package/src/lib/SuperTableColumn/parts/SuperColumnRow.svelte +2 -4
  33. package/src/lib/SuperTabs/SuperTabs.svelte +33 -17
  34. package/src/lib/UI/elements/Checkbox.svelte +68 -10
  35. package/src/lib/UI/elements/Switch.svelte +162 -0
  36. package/src/lib/UI/elements/Tooltip.svelte +15 -43
  37. package/src/lib/SuperTableCells/JSDOC_GUIDE.md +0 -869
@@ -5,7 +5,6 @@
5
5
 
6
6
  const stbSettings = getContext("stbSettings");
7
7
  const stbState = getContext("stbState");
8
- const stbData = getContext("stbData");
9
8
  const stbHorizontalScrollPos = getContext("stbHorizontalScrollPos");
10
9
  const stbHovered = getContext("stbHovered");
11
10
  const stbEditing = getContext("stbEditing");
@@ -16,6 +15,8 @@
16
15
 
17
16
  const stbAPI = getContext("stbAPI");
18
17
 
18
+ const allContext = getContext("context");
19
+
19
20
  export let right;
20
21
  export let rowMenu;
21
22
  export let rowMenuItems;
@@ -57,6 +58,12 @@
57
58
  <div
58
59
  class="super-column-body"
59
60
  style:margin-top={"var(--super-column-top-offset)"}
61
+ style:border-right={right
62
+ ? null
63
+ : "1px solid var(--super-table-devider-color, --spectrum-global-color-gray-200)"}
64
+ style:border-left={right
65
+ ? "1px solid var(--super-table-devider-color, --spectrum-global-color-gray-200)"
66
+ : null}
60
67
  class:quiet
61
68
  class:sticky
62
69
  class:zebra={$stbSettings.appearance.zebraColors}
@@ -76,7 +83,7 @@
76
83
  <!-- svelte-ignore a11y-click-events-have-key-events -->
77
84
  <div
78
85
  class="row-buttons"
79
- style:gap={inlineButtons.length > 1 ? "0.5rem" : "0rem"}
86
+ style:gap={inlineButtons.length > 1 ? "0.25rem" : "0rem"}
80
87
  >
81
88
  {#if rowMenu && inlineButtons?.length}
82
89
  {#each inlineButtons as { conditions, disabledTemplate, onClick, disabled, ...rest }}
@@ -89,6 +96,7 @@
89
96
  stbAPI.shouldDisableButton(
90
97
  disabledTemplate,
91
98
  stbAPI.enrichContext($data[visibleRow]),
99
+ $allContext,
92
100
  )}
93
101
  onClick={() => {
94
102
  stbAPI.executeRowButtonAction(visibleRow, onClick);
@@ -99,7 +107,7 @@
99
107
  {/if}
100
108
  {#if rowMenu && menuItems?.length}
101
109
  <SuperButton
102
- size="S"
110
+ size="XS"
103
111
  icon={menuIcon}
104
112
  text=""
105
113
  quiet="true"
@@ -134,20 +142,28 @@
134
142
  {#if menuItems?.length}
135
143
  <!-- svelte-ignore a11y-no-static-element-interactions -->
136
144
  <div class="action-menu">
137
- {#each menuItems as { text, icon, disabled, onClick, size }}
138
- <SuperButton
139
- {size}
140
- {icon}
141
- {text}
142
- {disabled}
143
- menuItem
144
- menuAlign={right ? "right" : "left"}
145
- onClick={() => {
146
- stbAPI.executeRowButtonAction($stbMenuID, onClick);
147
- openMenu = false;
148
- $stbMenuID = undefined;
149
- }}
150
- />
145
+ {#each menuItems as { text, icon, disabled, onClick, size, conditions, disabledTemplate }}
146
+ {#if stbAPI.shouldShowButton(conditions || [], stbAPI.enrichContext($data[$stbMenuID]))}
147
+ <SuperButton
148
+ {size}
149
+ {icon}
150
+ {text}
151
+ disabled={disabled ||
152
+ $stbEditing == $stbMenuID ||
153
+ $rowMetadata[$stbMenuID].disabled ||
154
+ stbAPI.shouldDisableButton(
155
+ disabledTemplate,
156
+ stbAPI.enrichContext($data[$stbMenuID]),
157
+ )}
158
+ menuItem
159
+ menuAlign={right ? "right" : "left"}
160
+ onClick={() => {
161
+ stbAPI.executeRowButtonAction($stbMenuID, onClick);
162
+ openMenu = false;
163
+ $stbMenuID = undefined;
164
+ }}
165
+ />
166
+ {/if}
151
167
  {/each}
152
168
  </div>
153
169
  {/if}
@@ -73,7 +73,7 @@
73
73
  class:quiet
74
74
  class:sticky
75
75
  style:margin-top={"var(--super-column-top-offset)"}
76
- style:border-right={"1px solid var(--spectrum-global-color-gray-200)"}
76
+ style:border-right={"1px solid var(--super-table-devider-color, --spectrum-global-color-gray-200)"}
77
77
  >
78
78
  {#each $stbVisibleRows as visibleRow (visibleRow)}
79
79
  {@const selected = $stbRowMetadata[visibleRow]?.selected}
@@ -95,7 +95,7 @@
95
95
  {#if $stbSettings.features.canSelect && !hideSelectionColumn}
96
96
  <Checkbox
97
97
  checked={selected}
98
- disabled={$stbRowMetadata[visibleRow]?.disabled}
98
+ locked={$stbRowMetadata[visibleRow]?.disabled}
99
99
  hovered={$stbHovered == visibleRow}
100
100
  on:change={() => stbAPI.selectRow(visibleRow)}
101
101
  />
@@ -1,6 +1,8 @@
1
1
  <script>
2
- import { createEventDispatcher, getContext } from "svelte";
2
+ import { createEventDispatcher } from "svelte";
3
3
  import fsm from "svelte-fsm";
4
+ import Switch from "../UI/elements/Switch.svelte";
5
+ import Checkbox from "../UI/elements/Checkbox.svelte";
4
6
  import "./CellCommon.css";
5
7
 
6
8
  export let value;
@@ -21,20 +23,20 @@
21
23
  View: {
22
24
  focus() {
23
25
  if (!cellOptions.readonly && !cellOptions.disabled) return "Editing";
24
- editor?.focus();
25
26
  },
26
27
  },
27
28
  Editing: {
28
29
  _enter() {
29
30
  originalValue = value;
30
- editor?.focus();
31
31
  dispatch("enteredit");
32
32
  },
33
33
  _exit() {
34
34
  dispatch("exitedit");
35
35
  },
36
- focus() {
37
- editor?.focus();
36
+ focus() {},
37
+ toggle() {
38
+ value = !value;
39
+ dispatch("change", value);
38
40
  },
39
41
  change(e) {
40
42
  if (cellOptions.debounce) dispatch("change", value);
@@ -56,15 +58,10 @@
56
58
  $: inline = cellOptions.role == "inlineInput";
57
59
  $: inEdit = $cellState == "Editing";
58
60
  $: isDirty = inEdit && originalValue !== value;
59
- $: checkbox = cellOptions?.controlType == "checkbox";
60
61
  $: tableCell = cellOptions.role == "tableCell";
61
62
  $: inlineLabel = cellOptions.inlineLabel;
62
63
  $: icon = cellOptions.error ? "ri-error-warning-line" : cellOptions.icon;
63
64
  $: error = cellOptions.error;
64
-
65
- const focus = (node) => {
66
- if (cellOptions.role == "tableCell") node.focus();
67
- };
68
65
  </script>
69
66
 
70
67
  <!-- svelte-ignore a11y-click-events-have-key-events -->
@@ -72,6 +69,7 @@
72
69
  <!-- svelte-ignore a11y-no-static-element-interactions -->
73
70
  <div
74
71
  class="superCell"
72
+ tabindex={cellOptions.disabled || cellOptions.readonly ? undefined : "1"}
75
73
  class:inEdit
76
74
  class:isDirty={isDirty && cellOptions.showDirty}
77
75
  class:inline
@@ -84,6 +82,11 @@
84
82
  ? "var(--spectrum-global-color-gray-50)"
85
83
  : cellOptions.background}
86
84
  style:font-weight={cellOptions.fontWeight}
85
+ on:keydown={(e) => {
86
+ if (e.code == "Space") cellState.toggle();
87
+ }}
88
+ on:focusin={cellState.focus}
89
+ on:focusout={cellState.submit}
87
90
  >
88
91
  {#if icon}
89
92
  <i class={icon + " field-icon"} class:with-error={error}></i>
@@ -95,48 +98,40 @@
95
98
  class:naked-field={!tableCell}
96
99
  style:justify-content={cellOptions.align ?? "center"}
97
100
  >
98
- {#if !checkbox}
99
- <div class="spectrum-Switch spectrum-Switch--emphasized">
100
- <input
101
- class="spectrum-Switch-input"
102
- bind:checked={value}
103
- bind:this={editor}
104
- type="checkbox"
101
+ {#if cellOptions.controlType == "switch"}
102
+ <div class="switch-wrapper">
103
+ <Switch
104
+ checked={value}
105
105
  disabled={cellOptions.disabled || cellOptions.readonly}
106
- on:focusin={cellState.focus}
107
- on:focusout={cellState.submit}
108
- on:change={cellState.change}
109
- use:focus
106
+ size="medium"
107
+ on:change={(e) => {
108
+ value = e.detail.checked;
109
+ cellState.change();
110
+ }}
110
111
  />
111
- <span class="spectrum-Switch-switch"></span>
112
112
  {#if inlineLabel}
113
- <span class="spectrum-Switch-label">{inlineLabel}</span>
113
+ <span class="switch-label">{inlineLabel}</span>
114
114
  {/if}
115
115
  </div>
116
116
  {:else}
117
- <input
118
- class="checkbox"
119
- bind:checked={value}
120
- bind:this={editor}
121
- type="checkbox"
122
- disabled={cellOptions.disabled || cellOptions.readonly}
123
- on:focusin={cellState.focus}
124
- on:focusout={cellState.submit}
125
- on:change={cellState.change}
126
- use:focus
127
- />
128
- {#if inlineLabel}
129
- <span class="checkbox-label">{inlineLabel}</span>
130
- {/if}
117
+ <div class="checkbox-wrapper">
118
+ <Checkbox
119
+ checked={value}
120
+ size="medium"
121
+ disabled={cellOptions.disabled || cellOptions.readonly}
122
+ on:change={(e) => {
123
+ value = e.detail.checked;
124
+ cellState.change();
125
+ }}
126
+ />
127
+ {#if inlineLabel}
128
+ <span class="checkbox-label">{inlineLabel}</span>
129
+ {/if}
130
+ </div>
131
131
  {/if}
132
132
  </div>
133
133
  {:else}
134
- <div
135
- class="value"
136
- tabIndex="0"
137
- style:justify-content={cellOptions.align ?? "center"}
138
- on:focusin={cellState.focus}
139
- >
134
+ <div class="value" style:justify-content={cellOptions.align ?? "center"}>
140
135
  {#if value}
141
136
  <i class="ri-check-line valueicon"></i>
142
137
  {:else if cellOptions.showFalse}
@@ -147,8 +142,20 @@
147
142
  </div>
148
143
 
149
144
  <style>
150
- .spectrum-Switch {
151
- margin-left: 0.25rem !important;
145
+ .switch-wrapper {
146
+ display: flex;
147
+ align-items: center;
148
+ gap: 0.5rem;
149
+ }
150
+
151
+ .checkbox-wrapper {
152
+ display: flex;
153
+ align-items: center;
154
+ gap: 0.5rem;
155
+ }
156
+
157
+ .switch-label {
158
+ margin-left: 0.25rem;
152
159
  }
153
160
 
154
161
  .checkbox-label {
@@ -9,8 +9,11 @@
9
9
  width: 100%;
10
10
  max-height: 2rem;
11
11
  font-size: 13px;
12
- padding: 0 0.5rem 0 0.75rem;
12
+ padding: 0 0.75rem 0 0.75rem;
13
13
  gap: 0.5rem;
14
+ font-family:
15
+ var(--spectrum-textfield-text-font-family),
16
+ var(--spectrum-global-font-family-base);
14
17
 
15
18
  &.multirow {
16
19
  padding: unset;
@@ -66,32 +69,43 @@
66
69
  overflow: hidden;
67
70
  gap: 0.5rem;
68
71
 
72
+ span {
73
+ overflow: hidden;
74
+ text-overflow: ellipsis;
75
+ white-space: nowrap;
76
+ }
77
+
69
78
  &:focus {
70
79
  outline: none;
71
80
  }
72
81
 
73
82
  &.placeholder {
74
- font-weight: 400;
75
- color: var(--spectrum-global-color-gray-500);
76
83
  overflow: hidden;
77
84
  text-overflow: ellipsis;
78
85
  white-space: nowrap;
86
+ font-weight: 400;
87
+ color: var(--spectrum-global-color-gray-500);
88
+ font-style: italic !important;
79
89
 
80
- & > span {
90
+ span {
91
+ overflow: hidden;
92
+ text-overflow: ellipsis;
93
+ white-space: nowrap;
94
+ font-weight: 400;
95
+ color: var(--spectrum-global-color-gray-500);
81
96
  font-style: italic !important;
82
97
  }
83
98
  }
84
99
 
85
- & > span {
86
- overflow: hidden;
87
- text-overflow: ellipsis;
88
- white-space: nowrap;
89
- padding: unset !important;
100
+ &.textarea {
101
+ flex: 1;
102
+ padding: 0.5rem 0.75rem !important;
103
+ display: flex;
104
+ align-items: flex-start;
105
+ overflow-y: auto;
90
106
 
91
- &.multiline {
92
- overflow: auto;
93
- white-space: normal;
94
- text-overflow: unset;
107
+ span {
108
+ white-space: pre-wrap;
95
109
  }
96
110
  }
97
111
 
@@ -108,7 +122,7 @@
108
122
  display: flex;
109
123
  align-items: center;
110
124
  overflow: hidden;
111
- padding: 0.15rem 0.5rem;
125
+ padding: 0rem 0.5rem;
112
126
 
113
127
  .loope {
114
128
  display: none;
@@ -258,6 +272,42 @@
258
272
  }
259
273
  }
260
274
 
275
+ .superCell.loading {
276
+ pointer-events: none;
277
+ background-color: rgb(
278
+ from var(--spectrum-global-color-gray-200) r g b / 0.75
279
+ ) !important;
280
+ border: 1px solid rgb(from var(--spectrum-global-color-gray-200) r g b / 0.75) !important;
281
+ }
282
+ .superCell.loading::after {
283
+ content: "";
284
+ position: absolute;
285
+ top: 0;
286
+ left: 0;
287
+ right: 0;
288
+ bottom: 0;
289
+ opacity: 0.65;
290
+ background-image: linear-gradient(
291
+ 90deg,
292
+ rgba(255, 255, 255, 0) 0,
293
+ rgba(255, 255, 255, 0.15) 20%,
294
+ rgba(255, 255, 255, 0.2) 60%,
295
+ rgba(255, 255, 255, 0.15) 80%,
296
+ rgba(255, 255, 255, 0)
297
+ ) !important;
298
+ animation: loadingShimmer 2s infinite;
299
+ pointer-events: none;
300
+ }
301
+
302
+ @keyframes loadingShimmer {
303
+ 0% {
304
+ transform: translateX(-80%);
305
+ }
306
+ 100% {
307
+ transform: translateX(100%);
308
+ }
309
+ }
310
+
261
311
  .superCell.formInput {
262
312
  border-radius: 4px;
263
313
  color: var(--spectrum-global-color-gray-800);
@@ -266,15 +316,18 @@
266
316
  min-height: 2rem;
267
317
 
268
318
  &.inEdit:not(.naked-field):not(.has-popup) {
269
- border: 1px solid var(--spectrum-global-color-blue-400);
319
+ border: 1px solid var(--primaryColor, --spectrum-global-color-blue-400);
270
320
 
271
321
  &:focus-within:not(.naked-field):not(.has-popup) {
272
- border: 1px solid var(--spectrum-global-color-blue-400);
322
+ border: 1px solid var(--primaryColor, --spectrum-global-color-blue-400);
273
323
  }
274
324
  }
275
325
 
276
- &:hover:not(.disabled):not(.readonly):not(.inEdit) {
277
- border: 1px solid var(--spectrum-global-color-gray-400);
326
+ &:hover:not(.disabled):not(.readonly):not(.inEdit):not(.naked-field) {
327
+ border: 1px solid
328
+ rgb(
329
+ from var(--primaryColor, --spectrum-global-color-blue-400) r g b / 0.5
330
+ ) !important;
278
331
  cursor: pointer;
279
332
  }
280
333
 
@@ -307,8 +360,15 @@
307
360
  }
308
361
 
309
362
  .superCell.formInput.has-popup {
363
+ background-color: var(--spectrum-global-color-gray-50);
364
+
365
+ &:hover:not(.disabled):not(.readonly):not(.inEdit) {
366
+ border-color: var(--spectrum-global-color-gray-100) !important;
367
+ cursor: pointer;
368
+ }
369
+
310
370
  &.inEdit {
311
- border: 1px solid var(--spectrum-global-color-blue-400) !important;
371
+ border: 1px solid var(--spectrum-global-color-gray-200) !important;
312
372
  background-color: var(--spectrum-global-color-gray-200) !important;
313
373
  cursor: pointer !important;
314
374
  }
@@ -322,7 +382,7 @@
322
382
  min-height: unset;
323
383
  max-height: unset;
324
384
  border: 1px solid transparent;
325
- padding: 0 0.5rem;
385
+ padding: 0 0.5rem !important;
326
386
 
327
387
  &:hover:not(.readonly):not(.inEdit) {
328
388
  border: 1px dashed var(--spectrum-global-color-blue-400);
@@ -353,6 +413,10 @@
353
413
  color: inherit;
354
414
  letter-spacing: inherit;
355
415
  font-size: inherit;
416
+ padding: unset !important;
417
+ font-family:
418
+ var(--spectrum-textfield-text-font-family),
419
+ var(--spectrum-global-font-family-base);
356
420
 
357
421
  &:focus {
358
422
  outline: none;
@@ -363,22 +427,20 @@
363
427
  }
364
428
 
365
429
  &.placeholder {
430
+ overflow: hidden;
431
+ text-overflow: ellipsis;
432
+ white-space: nowrap;
433
+ font-weight: 400;
434
+ color: var(--spectrum-global-color-gray-500);
366
435
  font-style: italic !important;
367
- }
368
-
369
- &.textarea {
370
- flex: 1 1 auto;
371
- padding: 0.5rem 0rem;
372
- justify-content: flex-start;
373
- align-items: stretch;
374
- white-space: normal;
375
- overflow: auto;
376
- resize: none;
377
- font-family: inherit;
378
- font-size: inherit;
379
- line-height: inherit;
380
- color: inherit;
381
- height: unset;
436
+ span {
437
+ overflow: hidden;
438
+ text-overflow: ellipsis;
439
+ white-space: nowrap;
440
+ font-weight: 400;
441
+ color: var(--spectrum-global-color-gray-500);
442
+ font-style: italic !important;
443
+ }
382
444
  }
383
445
  }
384
446