@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
@@ -1,15 +1,24 @@
1
1
  /**
2
2
  * @fileoverview Shared type definitions for SuperTableCells components using JSDoc
3
3
  * These types provide IntelliSense and type checking for both JavaScript and TypeScript files.
4
+ *
5
+ * Uses a unified CellOptions type with common base properties and optional type-specific extensions.
4
6
  */
5
7
 
8
+ // ============================================================================
9
+ // ENUMS & PRIMITIVE TYPES
10
+ // ============================================================================
11
+
6
12
  /**
7
13
  * Cell role determines the rendering context and styling
8
14
  * @typedef {"formInput" | "tableCell" | "inlineInput"} CellRole
9
15
  */
10
16
 
11
17
  /**
12
- * Cell state for FSM
18
+ * Cell state for FSM. Represents reachable states in the cell component finite state machines.
19
+ * - View: Default read-only display state
20
+ * - Editing: User is actively editing the cell value
21
+ * - Loading: Data is being fetched (used by cells with data dependencies)
13
22
  * @typedef {"View" | "Editing" | "Loading"} CellState
14
23
  */
15
24
 
@@ -19,211 +28,151 @@
19
28
  */
20
29
 
21
30
  /**
22
- * Common options available to all cell components
23
- * @typedef {Object} BaseCellOptions
24
- * @property {CellRole} [role] - Role determines the rendering context
25
- * @property {CellState} [initialState] - Initial FSM state
26
- * @property {number} [debounce] - Debounce delay in milliseconds for change events
27
- * @property {boolean} [readonly] - Whether the cell is read-only
28
- * @property {boolean} [disabled] - Whether the cell is disabled
29
- * @property {string} [placeholder] - Placeholder text when empty
30
- * @property {string} [template] - Template string for formatting display value
31
- * @property {string} [icon] - Icon to display (CSS class)
32
- * @property {boolean} [error] - Whether the cell has an error
33
- * @property {boolean} [showDirty] - Whether to show dirty indicator
34
- * @property {CellAlign} [align] - Text/content alignment
35
- * @property {string} [color] - Text color
36
- * @property {string} [background] - Background color
31
+ * Control type union covering all cell variants
32
+ * @typedef {"input" | "textarea" | "switch" | "checkbox" | "pills" | "text" | "links" | "list" | "buttons" | "radio" | "grid" | "carousel" | "expanded" | "inputSelect"} CellControlType
37
33
  */
38
34
 
39
- /**
40
- * Options specific to CellString component
41
- * @typedef {Object} CellStringOptions
42
- * @property {CellRole} [role] - Role determines the rendering context
43
- * @property {CellState} [initialState] - Initial FSM state
44
- * @property {number} [debounce] - Debounce delay in milliseconds
45
- * @property {boolean} [readonly] - Whether the cell is read-only
46
- * @property {boolean} [disabled] - Whether the cell is disabled
47
- * @property {string} [placeholder] - Placeholder text when empty
48
- * @property {string} [template] - Template string for formatting display value
49
- * @property {string} [icon] - Icon to display (CSS class)
50
- * @property {boolean} [error] - Whether the cell has an error
51
- * @property {boolean} [showDirty] - Whether to show dirty indicator
52
- * @property {CellAlign} [align] - Text/content alignment
53
- * @property {string} [color] - Text color
54
- * @property {string} [background] - Background color
55
- * @property {"input" | "textarea"} [controlType] - Control type for input
56
- * @property {boolean} [clearIcon] - Whether to show clear icon
57
- */
35
+ // ============================================================================
36
+ // UNIFIED CELL OPTIONS
37
+ // ============================================================================
58
38
 
59
39
  /**
60
- * Options specific to CellNumber component
61
- * @typedef {Object} CellNumberOptions
62
- * @property {CellRole} [role] - Role determines the rendering context
63
- * @property {CellState} [initialState] - Initial FSM state
64
- * @property {number} [debounce] - Debounce delay in milliseconds
65
- * @property {boolean} [readonly] - Whether the cell is read-only
66
- * @property {boolean} [disabled] - Whether the cell is disabled
67
- * @property {string} [placeholder] - Placeholder text when empty
68
- * @property {string} [template] - Template string for formatting display value
69
- * @property {string} [icon] - Icon to display (CSS class)
70
- * @property {boolean} [error] - Whether the cell has an error
71
- * @property {boolean} [showDirty] - Whether to show dirty indicator
72
- * @property {CellAlign} [align] - Text/content alignment
73
- * @property {string} [color] - Text color
74
- * @property {string} [background] - Background color
75
- * @property {number} [defaultValue] - Default value for the cell
76
- * @property {boolean} [showStepper] - Whether to show stepper controls
77
- * @property {number} [stepSize] - Step increment value
78
- * @property {number} [min] - Minimum value
79
- * @property {number} [max] - Maximum value
80
- * @property {number} [decimals] - Decimal places to show
81
- * @property {string} [thousandsSeparator] - Thousands separator character
82
- * @property {string} [clearValueIcon] - Icon to clear value
83
- * @property {boolean} [enableWheel] - Whether to enable mouse wheel
84
- */
85
-
86
- /**
87
- * Options specific to CellBoolean component
88
- * @typedef {Object} CellBooleanOptions
89
- * @property {CellRole} [role] - Role determines the rendering context
90
- * @property {CellState} [initialState] - Initial FSM state
91
- * @property {number} [debounce] - Debounce delay in milliseconds
92
- * @property {boolean} [readonly] - Whether the cell is read-only
93
- * @property {boolean} [disabled] - Whether the cell is disabled
94
- * @property {string} [placeholder] - Placeholder text when empty
95
- * @property {string} [template] - Template string for formatting display value
96
- * @property {string} [icon] - Icon to display (CSS class)
97
- * @property {boolean} [error] - Whether the cell has an error
98
- * @property {boolean} [showDirty] - Whether to show dirty indicator
99
- * @property {CellAlign} [align] - Text/content alignment
100
- * @property {string} [color] - Text color
101
- * @property {string} [background] - Background color
102
- * @property {string | number} [fontWeight] - Font weight
103
- * @property {"switch" | "checkbox"} [controlType] - Control type: switch or checkbox
104
- * @property {string} [inlineLabel] - Label to display inline with control
105
- */
106
-
107
- /**
108
- * Options specific to CellOptions/CellOptionsAdvanced components
109
- * @typedef {Object} CellOptionsOptions
110
- * @property {CellRole} [role] - Role determines the rendering context
111
- * @property {CellState} [initialState] - Initial FSM state
112
- * @property {number} [debounce] - Debounce delay in milliseconds
40
+ * Unified options for all Cell components.
41
+ * Contains common base properties and optional type-specific extensions.
42
+ *
43
+ * @typedef {Object} CellOptions
44
+ *
45
+ * ---------------------------------------------------------------------------
46
+ * COMMON PROPERTIES (used by all/most cells)
47
+ * ---------------------------------------------------------------------------
48
+ * @property {CellRole} [role="formInput"] - Role determines the rendering context and styling
49
+ * @property {CellState} [initialState="View"] - Initial FSM state
50
+ * @property {number} [debounce] - Debounce delay in milliseconds for change events
113
51
  * @property {boolean} [readonly] - Whether the cell is read-only
114
52
  * @property {boolean} [disabled] - Whether the cell is disabled
115
53
  * @property {string} [placeholder] - Placeholder text when empty
116
- * @property {string} [template] - Template string for formatting display value
117
- * @property {string} [icon] - Icon to display (CSS class)
118
- * @property {boolean} [error] - Whether the cell has an error
119
- * @property {boolean} [showDirty] - Whether to show dirty indicator
54
+ * @property {string} [template] - Template string for formatting display value (uses processStringSync)
55
+ * @property {string} [icon] - Icon CSS class to display (e.g., "ph ph-warning")
56
+ * @property {boolean} [error] - Whether the cell has an error state
57
+ * @property {boolean} [showDirty] - Whether to show dirty/modified indicator
120
58
  * @property {CellAlign} [align] - Text/content alignment
121
- * @property {string} [color] - Text color
122
- * @property {string} [background] - Background color
59
+ * @property {string} [color] - Text color (CSS value)
60
+ * @property {string} [background] - Background color (CSS value)
123
61
  * @property {string | number} [fontWeight] - Font weight
62
+ * @property {CellControlType} [controlType] - Control type variant for the cell
63
+ * @property {boolean} [clearIcon] - Whether to show clear/reset icon
64
+ *
65
+ * ---------------------------------------------------------------------------
66
+ * NUMBER PROPERTIES
67
+ * ---------------------------------------------------------------------------
68
+ * @property {number} [defaultValue] - Default numeric value
69
+ * @property {boolean} [showStepper] - Whether to show increment/decrement stepper controls
70
+ * @property {number} [stepSize] - Step increment value for stepper
71
+ * @property {number} [min] - Minimum allowed value
72
+ * @property {number} [max] - Maximum allowed value
73
+ * @property {number} [decimals] - Number of decimal places to display
74
+ * @property {string} [thousandsSeparator] - Thousands separator character (e.g., ",")
75
+ * @property {string} [clearValueIcon] - Icon for clearing numeric value
76
+ * @property {boolean} [enableWheel] - Whether to enable mouse wheel for value changes
77
+ *
78
+ * ---------------------------------------------------------------------------
79
+ * BOOLEAN PROPERTIES
80
+ * ---------------------------------------------------------------------------
81
+ * @property {string} [inlineLabel] - Label to display inline with boolean control
82
+ * @property {boolean} [showFalse] - Whether to show icon/indicator for false value
83
+ *
84
+ * ---------------------------------------------------------------------------
85
+ * OPTIONS/SELECT PROPERTIES
86
+ * ---------------------------------------------------------------------------
124
87
  * @property {"pills" | "text" | "links" | "list" | "buttons" | "radio"} [optionsViewMode] - View mode for options display
125
- * @property {boolean} [reorderOnly] - Whether to allow reordering
126
- * @property {boolean} [showColors] - Whether to show colors
127
- * @property {"schema" | "custom" | "datasource"} [optionsSource] - Data source type
88
+ * @property {"schema" | "custom" | "data"} [optionsSource] - Data source type for options
128
89
  * @property {Array<{label: string, value: any, color?: string}>} [customOptions] - Custom options array
129
- */
130
-
131
- /**
132
- * Options specific to CellAttachment components
133
- * @typedef {Object} CellAttachmentOptions
134
- * @property {CellRole} [role] - Role determines the rendering context
135
- * @property {CellState} [initialState] - Initial FSM state
136
- * @property {number} [debounce] - Debounce delay in milliseconds
137
- * @property {boolean} [readonly] - Whether the cell is read-only
138
- * @property {boolean} [disabled] - Whether the cell is disabled
139
- * @property {string} [placeholder] - Placeholder text when empty
140
- * @property {string} [template] - Template string for formatting display value
141
- * @property {string} [icon] - Icon to display (CSS class)
142
- * @property {boolean} [error] - Whether the cell has an error
143
- * @property {boolean} [showDirty] - Whether to show dirty indicator
144
- * @property {CellAlign} [align] - Text/content alignment
145
- * @property {string} [color] - Text color
146
- * @property {string} [background] - Background color
147
- * @property {string | number} [fontWeight] - Font weight
148
- * @property {"list" | "grid" | "carousel"} [controlType] - Control type for display
90
+ * @property {boolean} [reorderOnly] - Whether to only allow reordering (no add/remove)
91
+ * @property {boolean} [showColors] - Whether to show option colors
92
+ * @property {boolean} [autocomplete] - Whether to enable autocomplete filtering
93
+ * @property {string} [valueColumn] - Column name for option values (datasource mode)
94
+ * @property {string} [labelColumn] - Column name for option labels (datasource mode)
95
+ * @property {string} [colorColumn] - Column name for option colors (datasource mode)
96
+ * @property {string} [sortColumn] - Column to sort options by
97
+ * @property {"ascending" | "descending"} [sortOrder] - Sort order for options
98
+ * @property {Object} [datasource] - Datasource configuration for options
99
+ * @property {Array} [filter] - Filter array for datasource options
100
+ *
101
+ * ---------------------------------------------------------------------------
102
+ * DATETIME PROPERTIES
103
+ * ---------------------------------------------------------------------------
104
+ * @property {"default" | "MM/DD/YYYY" | "DD/MM/YYYY" | "YYYY-MM-DD" | "MMM DD, YYYY" | "DD MMM YYYY"} [dateFormat] - Date format string
105
+ * @property {boolean} [showTime] - Whether to show time picker
106
+ *
107
+ * ---------------------------------------------------------------------------
108
+ * JSON PROPERTIES
109
+ * ---------------------------------------------------------------------------
110
+ * @property {boolean} [multiline] - Whether to enable multiline JSON editing
111
+ *
112
+ * ---------------------------------------------------------------------------
113
+ * LINK/RELATIONSHIP PROPERTIES
114
+ * ---------------------------------------------------------------------------
115
+ * @property {"pills" | "text"} [relViewMode] - View mode for relationship display
116
+ * @property {boolean} [simpleView] - Use simple text view for links
117
+ * @property {number} [limit] - Limit number of related records to fetch
118
+ * @property {string} [search] - Search term for filtering related records
119
+ * @property {string} [ownId] - Current row ID (for self-referencing relationships)
120
+ * @property {string} [joinColumn] - Join column for SQL relationships
121
+ *
122
+ * ---------------------------------------------------------------------------
123
+ * ATTACHMENT PROPERTIES
124
+ * ---------------------------------------------------------------------------
149
125
  * @property {"landscape" | "portrait" | "square"} [imageRatio] - Image aspect ratio
150
- * @property {number} [gridColumns] - Grid columns (for grid mode)
126
+ * @property {number} [gridColumns] - Number of grid columns (for grid mode)
151
127
  * @property {boolean} [isGallery] - Whether in gallery mode
152
- * @property {"view" | "download" | "none"} [onClickAction] - Action on click
128
+ * @property {"view" | "download" | "none"} [onClickAction] - Action on attachment click
153
129
  * @property {boolean} [slotted] - Whether using slot content
154
- * @property {boolean} [carouselDots] - Show carousel dots
155
- * @property {boolean} [carouselArrows] - Show carousel arrows
156
- * @property {boolean} [carouselInfinite] - Enable infinite carousel
157
- * @property {boolean} [carouselAutoplay] - Enable autoplay
158
- * @property {number} [carouselAutoplaySpeed] - Autoplay speed in ms
159
- * @property {number} [carouselItemsToShow] - Number of items to show
160
- * @property {number} [carouselItemsToScroll] - Number of items to scroll
161
- * @property {"standard" | "marquee"} [carouselMode] - Carousel mode
162
- */
163
-
164
- /**
165
- * Options specific to CellDatetime/CellDateRange components
166
- * @typedef {Object} CellDatetimeOptions
167
- * @property {CellRole} [role] - Role determines the rendering context
168
- * @property {CellState} [initialState] - Initial FSM state
169
- * @property {number} [debounce] - Debounce delay in milliseconds
170
- * @property {boolean} [readonly] - Whether the cell is read-only
171
- * @property {boolean} [disabled] - Whether the cell is disabled
172
- * @property {string} [placeholder] - Placeholder text when empty
173
- * @property {string} [template] - Template string for formatting display value
174
- * @property {string} [icon] - Icon to display (CSS class)
175
- * @property {boolean} [error] - Whether the cell has an error
176
- * @property {boolean} [showDirty] - Whether to show dirty indicator
177
- * @property {CellAlign} [align] - Text/content alignment
178
- * @property {string} [color] - Text color
179
- * @property {string} [background] - Background color
180
- * @property {string | number} [fontWeight] - Font weight
181
- * @property {"default" | "MM/DD/YYYY" | "DD/MM/YYYY" | "YYYY-MM-DD" | "MMM DD, YYYY" | "DD MMM YYYY"} [dateFormat] - Date format string
182
- * @property {boolean} [showTime] - Whether to show time picker
183
- */
184
-
185
- /**
186
- * Options specific to CellJSON component
187
- * @typedef {Object} CellJSONOptions
188
- * @property {CellRole} [role] - Role determines the rendering context
189
- * @property {CellState} [initialState] - Initial FSM state
190
- * @property {number} [debounce] - Debounce delay in milliseconds
191
- * @property {boolean} [readonly] - Whether the cell is read-only
192
- * @property {boolean} [disabled] - Whether the cell is disabled
193
- * @property {string} [placeholder] - Placeholder text when empty
194
- * @property {string} [template] - Template string for formatting display value
195
- * @property {string} [icon] - Icon to display (CSS class)
196
- * @property {boolean} [error] - Whether the cell has an error
197
- * @property {boolean} [showDirty] - Whether to show dirty indicator
198
- * @property {CellAlign} [align] - Text/content alignment
199
- * @property {string} [color] - Text color
200
- * @property {string} [background] - Background color
201
- * @property {string | number} [fontWeight] - Font weight
202
- * @property {boolean} [multiline] - Whether to enable multiline editing
203
- */
204
-
205
- /**
206
- * Options specific to CellLink/CellLinkAdvanced/CellSQLLink components
207
- * @typedef {Object} CellLinkOptions
208
- * @property {CellRole} [role] - Role determines the rendering context
209
- * @property {CellState} [initialState] - Initial FSM state
210
- * @property {number} [debounce] - Debounce delay in milliseconds
211
- * @property {boolean} [readonly] - Whether the cell is read-only
212
- * @property {boolean} [disabled] - Whether the cell is disabled
213
- * @property {string} [placeholder] - Placeholder text when empty
214
- * @property {string} [template] - Template string for formatting display value
215
- * @property {string} [icon] - Icon to display (CSS class)
216
- * @property {boolean} [error] - Whether the cell has an error
217
- * @property {boolean} [showDirty] - Whether to show dirty indicator
218
- * @property {CellAlign} [align] - Text/content alignment
219
- * @property {string} [color] - Text color
220
- * @property {string} [background] - Background color
221
- * @property {string | number} [fontWeight] - Font weight
222
- * @property {boolean} [simpleView] - View mode for links display
223
- * @property {*} [filter] - Filter for relationship options
224
- * @property {number} [limit] - Limit number of options
225
- * @property {string} [search] - Search term
226
- */
130
+ * @property {boolean} [carouselDots] - Show carousel navigation dots
131
+ * @property {boolean} [carouselArrows] - Show carousel navigation arrows
132
+ * @property {boolean} [carouselInfinite] - Enable infinite carousel loop
133
+ * @property {boolean} [carouselAutoplay] - Enable carousel autoplay
134
+ * @property {number} [carouselAutoplaySpeed] - Autoplay speed in milliseconds
135
+ * @property {number} [carouselItemsToShow] - Number of items to show in carousel
136
+ * @property {number} [carouselItemsToScroll] - Number of items to scroll per action
137
+ * @property {"standard" | "marquee"} [carouselMode] - Carousel animation mode
138
+ *
139
+ * ---------------------------------------------------------------------------
140
+ * ICON PROPERTIES
141
+ * ---------------------------------------------------------------------------
142
+ * @property {boolean} [showCategories] - Whether to show icon category tabs
143
+ *
144
+ * ---------------------------------------------------------------------------
145
+ * COLOR PROPERTIES
146
+ * ---------------------------------------------------------------------------
147
+ * @property {boolean} [allowCustom] - Whether to allow custom color input
148
+ * @property {"circle" | "square"} [swatch] - Color swatch shape
149
+ * @property {boolean} [themeColors] - Whether to show theme colors
150
+ * @property {boolean} [staticColors] - Whether to show static colors
151
+ * @property {Array<{label: string, value: string}>} [customColors] - Custom color palette
152
+ *
153
+ * ---------------------------------------------------------------------------
154
+ * TAGS PROPERTIES
155
+ * ---------------------------------------------------------------------------
156
+ * @property {boolean} [suggestions] - Whether to show tag suggestions from datasource
157
+ */
158
+
159
+ // ============================================================================
160
+ // BACKWARD-COMPATIBLE TYPE ALIASES
161
+ // These allow existing imports to continue working during migration
162
+ // ============================================================================
163
+
164
+ /** @typedef {CellOptions} BaseCellOptions - @deprecated Use CellOptions instead */
165
+ /** @typedef {CellOptions} CellStringOptions - @deprecated Use CellOptions instead */
166
+ /** @typedef {CellOptions} CellNumberOptions - @deprecated Use CellOptions instead */
167
+ /** @typedef {CellOptions} CellBooleanOptions - @deprecated Use CellOptions instead */
168
+ /** @typedef {CellOptions} CellOptionsOptions - @deprecated Use CellOptions instead */
169
+ /** @typedef {CellOptions} CellAttachmentOptions - @deprecated Use CellOptions instead */
170
+ /** @typedef {CellOptions} CellDatetimeOptions - @deprecated Use CellOptions instead */
171
+ /** @typedef {CellOptions} CellJSONOptions - @deprecated Use CellOptions instead */
172
+ /** @typedef {CellOptions} CellLinkOptions - @deprecated Use CellOptions instead */
173
+ /** @typedef {CellOptions} CellColorOptions - @deprecated Use CellOptions instead */
174
+ /** @typedef {CellOptions} CellIconOptions - @deprecated Use CellOptions instead */
175
+ /** @typedef {CellOptions} CellTagsOptions - @deprecated Use CellOptions instead */
227
176
 
228
177
  /**
229
178
  * Common API interface for all cell components
@@ -387,7 +387,7 @@
387
387
  on:dblclick={columnState.resetSize}
388
388
  on:mouseenter={() => (considerResizing = true)}
389
389
  on:mouseleave={() => (considerResizing = false)}
390
- />
390
+ ></div>
391
391
  {/if}
392
392
 
393
393
  {#if $columnOptionsStore.showHeader}
@@ -112,7 +112,7 @@
112
112
  style="align-self: center; font-size: 14px;"
113
113
  on:click|preventDefault={() =>
114
114
  (showFilteringOptions = !showFilteringOptions)}
115
- />
115
+ ></i>
116
116
  {/if}
117
117
  <svelte:component
118
118
  this={$columnOptions.headerComponent}
@@ -146,7 +146,7 @@
146
146
  <i
147
147
  class={sorted == "ascending" ? "ri-sort-asc" : "ri-sort-desc"}
148
148
  class:sorted
149
- />
149
+ ></i>
150
150
  {/if}
151
151
  </span>
152
152
  {/if}
@@ -22,7 +22,7 @@
22
22
  export let disabled;
23
23
 
24
24
  // the default height
25
- export let rowHeight;
25
+
26
26
  let viewport;
27
27
  let info;
28
28
 
@@ -97,8 +97,10 @@
97
97
  style:justify-content={$columnSettings.align}
98
98
  on:mouseenter={() => ($stbHovered = index)}
99
99
  on:mouseleave={() => ($stbHovered = undefined)}
100
- on:click={() =>
101
- stbState.handleRowClick(index, field, deepGet(row, field), id)}
100
+ on:click={() => {
101
+ if (!meta.disabled)
102
+ stbState.handleRowClick(index, field, deepGet(row, field), id);
103
+ }}
102
104
  on:contextmenu|preventDefault={() => {
103
105
  stbAPI.showContextMenu(index, viewport);
104
106
  }}
@@ -49,7 +49,7 @@
49
49
  {#if theme === "list" && list_title}
50
50
  <div class="tab list-title">
51
51
  {#if list_icon}
52
- <i class={list_icon} />
52
+ <i class={list_icon}></i>
53
53
  {/if}
54
54
  {list_title}
55
55
  </div>
@@ -76,7 +76,7 @@
76
76
  class={container.icon}
77
77
  style:font-size={tabsIconsOnly ? "20px" : null}
78
78
  style:color={container.color}
79
- />
79
+ ></i>
80
80
  {/if}
81
81
 
82
82
  {#if !tabsIconsOnly || !container.icon}
@@ -1,5 +1,6 @@
1
1
  <script>
2
- import { createEventDispatcher } from "svelte";
2
+ import { createEventDispatcher, onDestroy } from "svelte";
3
+ import Tooltip from "../UI/elements/Tooltip.svelte";
3
4
  const dispatch = createEventDispatcher();
4
5
 
5
6
  export let tree;
@@ -13,40 +14,70 @@
13
14
  ? $selectedGroups.includes(tree.id)
14
15
  : !!$selectedNodes.find((x) => x.id == tree.id);
15
16
 
17
+ $: if (hasSelectedDescendant(tree.children || [])) open = true;
18
+
16
19
  let labelElement;
17
- $: isOverflowing = labelElement && labelElement.scrollWidth > labelElement.clientWidth;
20
+ let tooltipShow = false;
21
+ let tooltipTimer;
22
+
23
+ $: isOverflowing =
24
+ labelElement && labelElement.scrollWidth > labelElement.clientWidth;
25
+
18
26
  $: tooltip = isOverflowing ? tree.label || "Not Set" : null;
19
27
 
28
+ const showTooltip = () => {
29
+ if (!tooltip) return;
30
+ if (tooltipTimer) clearTimeout(tooltipTimer);
31
+ tooltipTimer = setTimeout(() => {
32
+ tooltipShow = true;
33
+ }, 750);
34
+ };
35
+
36
+ const hideTooltip = () => {
37
+ if (tooltipTimer) {
38
+ clearTimeout(tooltipTimer);
39
+ tooltipTimer = null;
40
+ }
41
+ tooltipShow = false;
42
+ };
43
+
20
44
  const toggleOpen = (e) => {
21
45
  if (tree.disabled) return;
46
+ if (open && hasSelectedDescendant(tree.children || [])) return;
22
47
  open = !open;
23
48
  dispatch("nodeClick", { id: tree.id, label: tree.label });
24
49
  };
25
50
 
26
51
  // Recursion
27
- const hasChildSelected = (children) => {
28
- let found = false;
29
- if (!$selectedNodes.length) return found;
30
-
31
- if (children.findIndex((x) => x.id == $selectedNodes[0].id) > -1) {
32
- found = true;
33
- } else {
34
- children.forEach((element) => {
35
- found = hasChildSelected(element.children);
36
- });
52
+ const hasSelectedDescendant = (children) => {
53
+ if (!children || !children.length) return false;
54
+ for (let child of children) {
55
+ if (
56
+ child.isGroup
57
+ ? $selectedGroups.includes(child.id)
58
+ : $selectedNodes.some((node) => node.id === child.id)
59
+ ) {
60
+ return true;
61
+ }
62
+ if (hasSelectedDescendant(child.children)) {
63
+ return true;
64
+ }
37
65
  }
38
- return found;
66
+ return false;
39
67
  };
40
68
 
41
69
  const toggleNode = (e) => {
42
- if (tree.selectable && !tree.disabled)
43
- dispatch("nodeSelect", {
44
- id: tree.id,
45
- label: tree.label,
46
- row: tree.row,
47
- group: tree.group,
48
- });
70
+ dispatch("nodeSelect", {
71
+ id: tree.id,
72
+ label: tree.label,
73
+ row: tree.row,
74
+ group: tree.group,
75
+ });
49
76
  };
77
+
78
+ onDestroy(() => {
79
+ if (tooltipTimer) clearTimeout(tooltipTimer);
80
+ });
50
81
  </script>
51
82
 
52
83
  <!-- svelte-ignore a11y-missing-attribute -->
@@ -58,28 +89,33 @@
58
89
  class:is-disabled={tree.disabled}
59
90
  class:is-open={open}
60
91
  >
61
- <div
62
- class="spectrum-TreeView-itemLink"
63
- style:padding-left={tree?.children?.length ? "0.25rem" : "1.5rem"}
64
- style:padding-right={"0.5rem"}
65
- >
66
- {#if tree.children?.length}
67
- <i
68
- class={"ri-arrow-right-s-line"}
69
- class:open
70
- style:z-index={1}
71
- style:font-size={"16px"}
72
- on:mousedown|self|preventDefault|stopPropagation={toggleOpen}
73
- />
74
- {/if}
92
+ <div class="spectrum-TreeView-itemLink" style:padding-right={"0.5rem"}>
93
+ <i
94
+ class={"ri-arrow-right-s-line"}
95
+ class:open
96
+ class:is-disabled={tree.children.length == 0 || tree.disabled}
97
+ style:font-size={"16px"}
98
+ style:z-index={"1"}
99
+ on:mousedown|stopPropagation={toggleOpen}
100
+ ></i>
75
101
  <div
76
- style:z-index={2}
77
102
  style:width={"100%"}
78
- on:mousedown|preventDefault|stopPropagation={toggleNode}
103
+ style:z-index={"1"}
104
+ on:mousedown|stopPropagation|preventDefault={toggleNode}
79
105
  >
80
- <span class="spectrum-TreeView-itemLabel" style:padding-left={"0.25rem"} bind:this={labelElement} title={tooltip}
81
- >{tree.label || "Not Set"}</span
106
+ <div
107
+ class="spectrum-TreeView-itemLabel"
108
+ style:padding-left={"0.25rem"}
109
+ style:z-index={"10"}
110
+ style:text-overflow={"ellipsis"}
111
+ style:overflow={"hidden"}
112
+ style:white-space={"nowrap"}
113
+ bind:this={labelElement}
114
+ on:mouseenter={showTooltip}
115
+ on:mouseleave={hideTooltip}
82
116
  >
117
+ {tree.label || "Not Set"}
118
+ </div>
83
119
  </div>
84
120
 
85
121
  {#if selected}
@@ -91,6 +127,10 @@
91
127
  {/if}
92
128
  </div>
93
129
 
130
+ {#if tooltip}
131
+ <Tooltip anchor={labelElement} content={tooltip} show={tooltipShow} />
132
+ {/if}
133
+
94
134
  {#if tree.children?.length}
95
135
  <ul class="spectrum-TreeView">
96
136
  {#each tree.children as node, idx}
@@ -119,11 +159,17 @@
119
159
  align-items: center;
120
160
  gap: 0.25rem;
121
161
  max-height: 1.75rem;
162
+ padding: 0.25rem 0.5rem;
122
163
  }
123
164
 
124
165
  i {
125
166
  transition: all 130ms;
126
167
  }
168
+
169
+ i.is-disabled {
170
+ opacity: 0.3;
171
+ pointer-events: none;
172
+ }
127
173
  .open {
128
174
  transform: rotate(90deg);
129
175
  }