@poirazis/supercomponents-shared 1.1.8 → 1.2.0

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 (48) hide show
  1. package/dist/index.js +21416 -40369
  2. package/dist/index.umd.cjs +19 -26
  3. package/dist/style.css +1 -1
  4. package/package.json +3 -3
  5. package/src/index.js +4 -0
  6. package/src/index.ts +3 -0
  7. package/src/lib/Actions/index.js +3 -3
  8. package/src/lib/SuperButton/SuperButton.svelte +34 -3
  9. package/src/lib/SuperForm/InnerForm.svelte +1 -1
  10. package/src/lib/SuperList/SuperList.svelte +2 -2
  11. package/src/lib/SuperList/drag-handle.svelte +8 -8
  12. package/src/lib/SuperTable/SuperTable.css +8 -3
  13. package/src/lib/SuperTable/SuperTable.svelte +3 -3
  14. package/src/lib/SuperTable/controls/PaginationLimitOffset.svelte +2 -0
  15. package/src/lib/SuperTable/controls/SelectionColumn.svelte +18 -49
  16. package/src/lib/SuperTable/controls/SuperTableWelcome.svelte +1 -1
  17. package/src/lib/SuperTable/overlays/AddNewRowOverlay.svelte +3 -3
  18. package/src/lib/SuperTable/overlays/EmptyResultSetOverlay.svelte +1 -1
  19. package/src/lib/SuperTable/overlays/ScrollbarsOverlay.svelte +43 -43
  20. package/src/lib/SuperTableCells/CellAttachmentExpanded.svelte +1 -1
  21. package/src/lib/SuperTableCells/CellAttachmentSlider.svelte +2 -3
  22. package/src/lib/SuperTableCells/CellBoolean.svelte +1 -1
  23. package/src/lib/SuperTableCells/CellColor.svelte +7 -7
  24. package/src/lib/SuperTableCells/CellCommon.css +1 -1
  25. package/src/lib/SuperTableCells/CellIcon.svelte +7 -7
  26. package/src/lib/SuperTableCells/CellJSON.svelte +2 -2
  27. package/src/lib/SuperTableCells/CellLink.svelte +50 -43
  28. package/src/lib/SuperTableCells/CellLinkAdvanced.svelte +2 -15
  29. package/src/lib/SuperTableCells/CellLinkPickerSelect.svelte +10 -11
  30. package/src/lib/SuperTableCells/CellLinkPickerTree.svelte +4 -2
  31. package/src/lib/SuperTableCells/CellNumber.svelte +24 -5
  32. package/src/lib/SuperTableCells/CellOptions.svelte +11 -23
  33. package/src/lib/SuperTableCells/CellOptionsAdvanced.svelte +5 -5
  34. package/src/lib/SuperTableCells/CellSQLLink.svelte +0 -11
  35. package/src/lib/SuperTableCells/CellSQLLinkPicker.svelte +9 -9
  36. package/src/lib/SuperTableCells/CellString.svelte +3 -3
  37. package/src/lib/SuperTableCells/CellStringMask.svelte +1 -1
  38. package/src/lib/SuperTableCells/CellTags.svelte +151 -108
  39. package/src/lib/SuperTableCells/JSDOC_GUIDE.md +163 -3
  40. package/src/lib/SuperTableCells/types.js +141 -192
  41. package/src/lib/SuperTableColumn/SuperTableColumn.svelte +1 -1
  42. package/src/lib/SuperTableColumn/parts/SuperColumnHeader.svelte +2 -2
  43. package/src/lib/SuperTableColumn/parts/SuperColumnRow.svelte +5 -3
  44. package/src/lib/SuperTabs/SuperTabs.svelte +2 -2
  45. package/src/lib/SuperTree/SuperTree.svelte +84 -38
  46. package/src/lib/UI/elements/Checkbox.svelte +36 -6
  47. package/src/lib/UI/elements/IconButton.svelte +115 -0
  48. package/src/lib/UI/elements/Tooltip.svelte +65 -0
@@ -34,17 +34,6 @@
34
34
  if (!cellOptions.readonly && !cellOptions.disabled) return "Editing";
35
35
  },
36
36
  },
37
- Hovered: {
38
- cancel: () => {
39
- return "View";
40
- },
41
- },
42
- Focused: {
43
- unfocus() {
44
- return "View";
45
- },
46
- },
47
- Error: { check: "View" },
48
37
  Editing: {
49
38
  _enter() {
50
39
  originalValue = JSON.stringify(localValue);
@@ -62,9 +51,7 @@
62
51
  if (popup?.contains(e.relatedTarget)) return;
63
52
  this.submit();
64
53
  },
65
- popupfocusout(e) {
66
- console.log(e);
67
- },
54
+ popupfocusout(e) {},
68
55
  clear() {
69
56
  localValue = [];
70
57
  },
@@ -216,7 +203,7 @@
216
203
  class={fieldSchema.type == "link"
217
204
  ? "ri-links-line"
218
205
  : "ri-user-line"}
219
- />
206
+ ></i>
220
207
  {/if}
221
208
  <span>{val.primaryDisplay}</span>
222
209
  </div>
@@ -140,9 +140,9 @@
140
140
  e.preventDefault();
141
141
  focusIdx -= 1;
142
142
  if (focusIdx < 0) focusIdx = $fetch.rows.length - 1;
143
- } else if (e.key == "Enter" && focusIdx > -1)
143
+ } else if (e.key == "Enter" && focusIdx > -1) {
144
144
  selectRow($fetch.rows[focusIdx]);
145
- if (e.key == "Tab" || e.key == "Escape") dispatch("close");
145
+ }
146
146
  };
147
147
 
148
148
  // Auto-fetch more if initial data doesn't fill viewport
@@ -180,7 +180,7 @@
180
180
  style:color={filterTerm
181
181
  ? "var(--spectrum-global-color-blue-400)"
182
182
  : "var(--spectrum-global-color-gray-700)"}
183
- />
183
+ ></i>
184
184
  <input
185
185
  bind:this={control}
186
186
  class="search"
@@ -191,7 +191,6 @@
191
191
  : "Search"}
192
192
  on:input={handleSearch}
193
193
  on:keydown={handleNavigation}
194
- on:blur={() => dispatch("close")}
195
194
  />
196
195
  </div>
197
196
 
@@ -214,19 +213,19 @@
214
213
  )}
215
214
  >
216
215
  {row[primaryDisplay]}
217
- <i class="ri-add-line" />
216
+ <i class="ri-add-line"></i>
218
217
  </div>
219
218
  {/if}
220
219
  {/each}
221
220
  {#if $fetch?.loading && $fetch.loaded}
222
221
  <div class="option wide loading">
223
- <i class="ri-loader-2-line rotating" />
222
+ <i class="ri-loader-2-line rotating"></i>
224
223
  Loading more...
225
224
  </div>
226
225
  {/if}
227
226
  {:else if $fetch?.loading}
228
227
  <div class="option wide loading">
229
- <i class="ri-loader-2-line rotating" />
228
+ <i class="ri-loader-2-line rotating"></i>
230
229
  Loading...
231
230
  </div>
232
231
  {:else}
@@ -248,7 +247,7 @@
248
247
  )}
249
248
  >
250
249
  {val.primaryDisplay}
251
- <i class="ri-close-line" />
250
+ <i class="ri-close-line"></i>
252
251
  </div>
253
252
  {/if}
254
253
  {/each}
@@ -274,18 +273,18 @@
274
273
  on:mousedown|preventDefault|stopPropagation={selectRow(row)}
275
274
  >
276
275
  {row[primaryDisplay]}
277
- <i class="ri-check-line" />
276
+ <i class="ri-check-line"></i>
278
277
  </div>
279
278
  {/each}
280
279
  {#if $fetch?.loading && $fetch.loaded}
281
280
  <div class="option loading">
282
- <i class="ri-loader-2-line rotating" />
281
+ <i class="ri-loader-2-line rotating"></i>
283
282
  Loading more...
284
283
  </div>
285
284
  {/if}
286
285
  {:else if $fetch?.loading}
287
286
  <div class="option loading">
288
- <i class="ri-loader-2-line rotating" />
287
+ <i class="ri-loader-2-line rotating"></i>
289
288
  Loading...
290
289
  </div>
291
290
  {:else}
@@ -163,8 +163,6 @@
163
163
  role: "inlineInput",
164
164
  debounce: 50,
165
165
  };
166
-
167
- export const api = {};
168
166
  </script>
169
167
 
170
168
  <!-- svelte-ignore a11y-no-static-element-interactions -->
@@ -226,4 +224,8 @@
226
224
  display: flex;
227
225
  align-items: stretch;
228
226
  }
227
+
228
+ .spectrum-TreeView {
229
+ width: 100%;
230
+ }
229
231
  </style>
@@ -8,7 +8,7 @@
8
8
  import fsm from "svelte-fsm";
9
9
 
10
10
  /**
11
- * @typedef {import('./types.js').CellNumberOptions} CellNumberOptions
11
+ * @typedef {import('./types.js').CellOptions} CellOptions
12
12
  * @typedef {import('./types.js').CellApi} CellApi
13
13
  */
14
14
 
@@ -18,7 +18,7 @@
18
18
 
19
19
  /** @type {number | null} */
20
20
  export let value;
21
- /** @type {CellNumberOptions} */
21
+ /** @type {CellOptions} */
22
22
  export let cellOptions = {};
23
23
  export let autofocus = false;
24
24
 
@@ -51,9 +51,28 @@
51
51
  } = cellOptions ?? {});
52
52
 
53
53
  // Helper function to format number with thousands separator
54
+ /**
55
+ * @param {number | string | null | undefined} num
56
+ * @param {string | undefined} separator
57
+ * @param {number | undefined} decimals
58
+ * @returns {string}
59
+ */
54
60
  function formatNumber(num, separator, decimals) {
55
- if (!num && num !== 0) return "";
56
- const fixed = num.toFixed(decimals ?? 0);
61
+ // Parse string to number if needed
62
+ const parsedNum = typeof num === "string" ? parseFloat(num) : num;
63
+
64
+ // Check if it's a valid number
65
+ if (isNaN(parsedNum) || (parsedNum !== 0 && !parsedNum)) return "";
66
+
67
+ // If decimals not specified and input was a string, preserve original decimals
68
+ let fixed;
69
+ if (decimals === undefined && typeof num === "string") {
70
+ // Keep the string representation to preserve decimals
71
+ fixed = parsedNum.toString();
72
+ } else {
73
+ fixed = parsedNum.toFixed(decimals ?? 0);
74
+ }
75
+
57
76
  if (!separator) return fixed;
58
77
 
59
78
  const parts = fixed.split(".");
@@ -113,7 +132,7 @@
113
132
  dispatch("exitedit");
114
133
  },
115
134
  clear() {
116
- if (debounceDelay) dispatch("change", null);
135
+ dispatch("change", null);
117
136
  lastEdit = new Date();
118
137
  localValue = null;
119
138
  },
@@ -158,6 +158,7 @@
158
158
  if (cellOptions.debounce) dispatch("change", null);
159
159
  },
160
160
  cancel() {
161
+ localValue = JSON.parse(originalValue);
161
162
  searchTerm = null;
162
163
  anchor?.blur();
163
164
  return "View";
@@ -541,7 +542,7 @@
541
542
  on:keydown={editorState.handleKeyboard}
542
543
  >
543
544
  {#if icon}
544
- <i class={icon + " field-icon"} class:active={searchTerm} />
545
+ <i class={icon + " field-icon"} class:active={searchTerm}></i>
545
546
  {/if}
546
547
 
547
548
  {#if inEdit && controlType == "inputSelect"}
@@ -564,7 +565,7 @@
564
565
  style:min-width={"4rem"}
565
566
  >
566
567
  {#if pills}
567
- <div class="loope" />
568
+ <div class="loope"></div>
568
569
  {/if}
569
570
  <span> {labels[val] || val} </span>
570
571
  </div>
@@ -617,7 +618,7 @@
617
618
  style:--option-color={$colors[val] ||
618
619
  colorsArray[idx % colorsArray.length]}
619
620
  >
620
- <i class={"ph-fill ph-square"} />
621
+ <i class={"ph-fill ph-square"}></i>
621
622
  <span> {isObjects ? "JSON" : labels[val] || val} </span>
622
623
  </div>
623
624
  {/each}
@@ -628,7 +629,7 @@
628
629
  <i
629
630
  class="ph ph-caret-down control-icon"
630
631
  on:mousedown={inEdit ? editorState.toggle : null}
631
- />
632
+ ></i>
632
633
  {/if}
633
634
  {/if}
634
635
  </div>
@@ -649,7 +650,7 @@
649
650
  <i
650
651
  class="search-icon ph ph-magnifying-glass"
651
652
  class:active={searchTerm}
652
- />
653
+ ></i>
653
654
  <span class="search-term">{searchTerm}</span>
654
655
  </div>
655
656
  {/if}
@@ -661,7 +662,7 @@
661
662
  >
662
663
  {#if optionsSource == "data" && $fetch?.loading && !$fetch?.rows?.length}
663
664
  <div class="option loading">
664
- <i class="ph ph-spinner spin" />
665
+ <i class="ph ph-spinner spin"></i>
665
666
  Loading...
666
667
  </div>
667
668
  {:else if filteredOptions?.length}
@@ -682,22 +683,22 @@
682
683
  ? "ph ph-" + $fetch?.rows?.[idx]?.[iconColumn]
683
684
  : "ph-fill ph-square"}
684
685
  style:color={$colors[option]}
685
- />
686
+ ></i>
686
687
  {labels[option] || option}
687
688
  </span>
688
- <i class="ph ph-check" />
689
+ <i class="ph ph-check"></i>
689
690
  </div>
690
691
  {/each}
691
692
  {#if optionsSource == "data" && $fetch?.loading}
692
693
  <div class="option loading">
693
- <i class="ph ph-spinner spin" />
694
+ <i class="ph ph-spinner spin"></i>
694
695
  Loading more...
695
696
  </div>
696
697
  {/if}
697
698
  {:else}
698
699
  <div class="option">
699
700
  <span>
700
- <i class="ri-close-line" />
701
+ <i class="ri-close-line"></i>
701
702
  No Options Found
702
703
  </span>
703
704
  </div>
@@ -774,19 +775,6 @@
774
775
  justify-content: center;
775
776
  color: var(--spectrum-global-color-gray-500);
776
777
  font-style: italic;
777
-
778
- & > i.rotating {
779
- animation: rotate 1s linear infinite;
780
- }
781
- }
782
-
783
- @keyframes rotate {
784
- from {
785
- transform: rotate(0deg);
786
- }
787
- to {
788
- transform: rotate(360deg);
789
- }
790
778
  }
791
779
 
792
780
  .action-icon {
@@ -441,7 +441,7 @@
441
441
  : localValue.includes(option)
442
442
  ? "ph-fill ph-check-square"
443
443
  : "ph ph-square"}
444
- />
444
+ ></i>
445
445
  {labels[option] || option}
446
446
  </div>
447
447
  {/each}
@@ -469,7 +469,7 @@
469
469
  type="checkbox"
470
470
  class="spectrum-Switch-input"
471
471
  />
472
- <span class="spectrum-Switch-switch" />
472
+ <span class="spectrum-Switch-switch"></span>
473
473
  </div>
474
474
  {/if}
475
475
  </div>
@@ -483,7 +483,7 @@
483
483
  on:click={(e) => editorState.toggleOption(idx)}
484
484
  on:mouseenter={() => (focusedOptionIdx = idx)}
485
485
  >
486
- <i class={optionIcons[option] || "no-icon"} />
486
+ <i class={optionIcons[option] || "no-icon"}></i>
487
487
  <div class="text">{labels[option] || option}</div>
488
488
  <div class="spectrum-Switch spectrum-Switch--emphasized">
489
489
  <input
@@ -518,7 +518,7 @@
518
518
  {#if filteredOptions?.length < 1 || filteredOptions.length == localValue.length}
519
519
  <div class="option">
520
520
  <span>
521
- <i class="ri-close-line" />
521
+ <i class="ri-close-line"></i>
522
522
  No Options Found
523
523
  </span>
524
524
  </div>
@@ -535,7 +535,7 @@
535
535
  on:mouseenter={() => (focusedOptionIdx = idx)}
536
536
  >
537
537
  <span>
538
- <i class="ri-checkbox-blank-fill" />
538
+ <i class="ri-checkbox-blank-fill"></i>
539
539
  {labels[option] || option}
540
540
  </span>
541
541
  </div>
@@ -39,17 +39,6 @@
39
39
  if (!cellOptions.readonly && !cellOptions.disabled) return "Editing";
40
40
  },
41
41
  },
42
- Hovered: {
43
- cancel: () => {
44
- return "View";
45
- },
46
- },
47
- Focused: {
48
- unfocus() {
49
- return "View";
50
- },
51
- },
52
- Error: { check: "View" },
53
42
  Editing: {
54
43
  _enter() {
55
44
  originalValue = JSON.stringify(localValue);
@@ -208,7 +208,7 @@
208
208
  style:color={filterTerm
209
209
  ? "var(--spectrum-global-color-blue-400)"
210
210
  : "var(--spectrum-global-color-gray-700)"}
211
- />
211
+ ></i>
212
212
  <input
213
213
  bind:this={control}
214
214
  class="search"
@@ -257,7 +257,7 @@
257
257
  {#each relatedColumns as col}
258
258
  <div class="data-cell">{row[col.name] || ""}</div>
259
259
  {/each}
260
- <div class="data-cell check"><i class="ri-check-line" /></div>
260
+ <div class="data-cell check"><i class="ri-check-line" ></i></div>
261
261
  </div>
262
262
  {/each}
263
263
 
@@ -278,7 +278,7 @@
278
278
  <div class="data-cell">{row[col.name] || ""}</div>
279
279
  {/each}
280
280
  <div class="data-cell check">
281
- <i class="ri-check-line" />
281
+ <i class="ri-check-line" ></i>
282
282
  </div>
283
283
  </div>
284
284
  {/if}
@@ -289,13 +289,13 @@
289
289
  {#if $optionsFetch?.loading}
290
290
  <div class="data-row loading">
291
291
  <div class="data-cell" style="grid-column: 1 / -1;">
292
- <i class="ri-loader-2-line rotating" /> Loading more...
292
+ <i class="ri-loader-2-line rotating" ></i> Loading more...
293
293
  </div>
294
294
  </div>
295
295
  {:else if $optionsFetch?.loading && !$optionsFetch.loaded}
296
296
  <div class="data-row loading">
297
297
  <div class="data-cell" style="grid-column: 1 / -1;">
298
- <i class="ri-loader-2-line rotating" /> Loading...
298
+ <i class="ri-loader-2-line rotating" ></i> Loading...
299
299
  </div>
300
300
  </div>
301
301
  {:else if !$optionsFetch?.loading && $optionsFetch?.loaded && !$optionsFetch.rows?.length}
@@ -319,7 +319,7 @@
319
319
  on:mousedown|preventDefault|stopPropagation={() => selectRow(row)}
320
320
  >
321
321
  {row.primaryDisplay || row[primaryDisplay]}
322
- <i class="ri-check-line" />
322
+ <i class="ri-check-line" ></i>
323
323
  </div>
324
324
  {/each}
325
325
 
@@ -337,20 +337,20 @@
337
337
  on:mousedown|preventDefault={() => selectRow(row)}
338
338
  >
339
339
  {row.primaryDisplay || row[primaryDisplay]}
340
- <i class="ri-check-line" />
340
+ <i class="ri-check-line" ></i>
341
341
  </div>
342
342
  {/if}
343
343
  {/each}
344
344
  {/key}
345
345
  {#if $optionsFetch?.loading}
346
346
  <div class="option loading">
347
- <i class="ri-loader-2-line rotating" />
347
+ <i class="ri-loader-2-line rotating" ></i>
348
348
  Loading more...
349
349
  </div>
350
350
  {/if}
351
351
  {:else if $optionsFetch?.loading && !$optionsFetch.loaded}
352
352
  <div class="option loading">
353
- <i class="ri-loader-2-line rotating" />
353
+ <i class="ri-loader-2-line rotating" ></i>
354
354
  Loading...
355
355
  </div>
356
356
  {:else}
@@ -8,7 +8,7 @@
8
8
  import fsm from "svelte-fsm";
9
9
 
10
10
  /**
11
- * @typedef {import('./types.js').CellStringOptions} CellStringOptions
11
+ * @typedef {import('./types.js').CellOptions} CellOptions
12
12
  * @typedef {import('./types.js').CellApi} CellApi
13
13
  */
14
14
 
@@ -21,7 +21,7 @@
21
21
  /** @type {string | undefined} */
22
22
  export let formattedValue = undefined;
23
23
 
24
- /** @type {CellStringOptions} */
24
+ /** @type {CellOptions} */
25
25
  export let cellOptions = {
26
26
  role: "formInput",
27
27
  initialState: "Editing",
@@ -260,7 +260,7 @@
260
260
  <i
261
261
  class="ri-close-line clearIcon"
262
262
  on:mousedown|self|preventDefault={cellState.clear}
263
- />
263
+ ></i>
264
264
  {/if}
265
265
  {/if}
266
266
  {:else if textarea}
@@ -290,7 +290,7 @@
290
290
  <i
291
291
  class="ri-close-line clearIcon"
292
292
  on:mousedown|self|preventDefault={cellState.clear}
293
- />
293
+ ></i>
294
294
  {/if}
295
295
  {:else}
296
296
  <div