@toolbox-web/grid 0.4.0 → 0.4.2

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 (161) hide show
  1. package/README.md +10 -13
  2. package/all.js +1124 -1047
  3. package/all.js.map +1 -1
  4. package/index.js +688 -515
  5. package/index.js.map +1 -1
  6. package/lib/core/grid.d.ts +10 -0
  7. package/lib/core/grid.d.ts.map +1 -1
  8. package/lib/core/internal/config-manager.d.ts +1 -0
  9. package/lib/core/internal/config-manager.d.ts.map +1 -1
  10. package/lib/core/internal/keyboard.d.ts.map +1 -1
  11. package/lib/core/internal/utils.d.ts +1 -0
  12. package/lib/core/internal/utils.d.ts.map +1 -1
  13. package/lib/core/internal/validate-config.d.ts +14 -0
  14. package/lib/core/internal/validate-config.d.ts.map +1 -1
  15. package/lib/core/plugin/base-plugin.d.ts +105 -1
  16. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  17. package/lib/core/plugin/expander-column.d.ts +51 -0
  18. package/lib/core/plugin/expander-column.d.ts.map +1 -0
  19. package/lib/core/plugin/index.d.ts +1 -0
  20. package/lib/core/plugin/index.d.ts.map +1 -1
  21. package/lib/core/plugin/plugin-manager.d.ts +1 -1
  22. package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
  23. package/lib/core/plugin/types.d.ts +117 -1
  24. package/lib/core/plugin/types.d.ts.map +1 -1
  25. package/lib/core/types.d.ts +4 -2
  26. package/lib/core/types.d.ts.map +1 -1
  27. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +9 -2
  28. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
  29. package/lib/plugins/clipboard/index.d.ts +1 -1
  30. package/lib/plugins/clipboard/index.d.ts.map +1 -1
  31. package/lib/plugins/clipboard/index.js +303 -185
  32. package/lib/plugins/clipboard/index.js.map +1 -1
  33. package/lib/plugins/clipboard/types.d.ts +72 -2
  34. package/lib/plugins/clipboard/types.d.ts.map +1 -1
  35. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +0 -1
  36. package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
  37. package/lib/plugins/column-virtualization/index.js +116 -24
  38. package/lib/plugins/column-virtualization/index.js.map +1 -1
  39. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +0 -1
  40. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  41. package/lib/plugins/context-menu/index.js +164 -72
  42. package/lib/plugins/context-menu/index.js.map +1 -1
  43. package/lib/plugins/editing/EditingPlugin.d.ts +1 -7
  44. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  45. package/lib/plugins/editing/index.js +213 -133
  46. package/lib/plugins/editing/index.js.map +1 -1
  47. package/lib/plugins/export/ExportPlugin.d.ts +0 -1
  48. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
  49. package/lib/plugins/export/index.js +195 -103
  50. package/lib/plugins/export/index.js.map +1 -1
  51. package/lib/plugins/filtering/FilteringPlugin.d.ts +5 -2
  52. package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
  53. package/lib/plugins/filtering/index.js +145 -43
  54. package/lib/plugins/filtering/index.js.map +1 -1
  55. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -2
  56. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  57. package/lib/plugins/grouping-columns/grouping-columns.d.ts +1 -1
  58. package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -1
  59. package/lib/plugins/grouping-columns/index.js +162 -68
  60. package/lib/plugins/grouping-columns/index.js.map +1 -1
  61. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +14 -2
  62. package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
  63. package/lib/plugins/grouping-rows/index.js +246 -138
  64. package/lib/plugins/grouping-rows/index.js.map +1 -1
  65. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +13 -11
  66. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
  67. package/lib/plugins/master-detail/index.js +281 -196
  68. package/lib/plugins/master-detail/index.js.map +1 -1
  69. package/lib/plugins/master-detail/types.d.ts +0 -10
  70. package/lib/plugins/master-detail/types.d.ts.map +1 -1
  71. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +1 -2
  72. package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
  73. package/lib/plugins/multi-sort/index.js +121 -31
  74. package/lib/plugins/multi-sort/index.js.map +1 -1
  75. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +0 -1
  76. package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
  77. package/lib/plugins/pinned-columns/index.js +144 -52
  78. package/lib/plugins/pinned-columns/index.js.map +1 -1
  79. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +1 -2
  80. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  81. package/lib/plugins/pinned-rows/index.js +178 -88
  82. package/lib/plugins/pinned-rows/index.js.map +1 -1
  83. package/lib/plugins/pivot/PivotPlugin.d.ts +26 -4
  84. package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
  85. package/lib/plugins/pivot/index.js +414 -310
  86. package/lib/plugins/pivot/index.js.map +1 -1
  87. package/lib/plugins/pivot/pivot-rows.d.ts +2 -1
  88. package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -1
  89. package/lib/plugins/reorder/ReorderPlugin.d.ts +13 -10
  90. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
  91. package/lib/plugins/reorder/index.js +304 -226
  92. package/lib/plugins/reorder/index.js.map +1 -1
  93. package/lib/plugins/selection/SelectionPlugin.d.ts +21 -3
  94. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  95. package/lib/plugins/selection/index.d.ts +2 -2
  96. package/lib/plugins/selection/index.d.ts.map +1 -1
  97. package/lib/plugins/selection/index.js +292 -145
  98. package/lib/plugins/selection/index.js.map +1 -1
  99. package/lib/plugins/selection/types.d.ts +24 -0
  100. package/lib/plugins/selection/types.d.ts.map +1 -1
  101. package/lib/plugins/server-side/ServerSidePlugin.d.ts +0 -1
  102. package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -1
  103. package/lib/plugins/server-side/index.js +95 -3
  104. package/lib/plugins/server-side/index.js.map +1 -1
  105. package/lib/plugins/tree/TreePlugin.d.ts +5 -1
  106. package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
  107. package/lib/plugins/tree/index.js +213 -112
  108. package/lib/plugins/tree/index.js.map +1 -1
  109. package/lib/plugins/tree/types.d.ts +0 -10
  110. package/lib/plugins/tree/types.d.ts.map +1 -1
  111. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +7 -2
  112. package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
  113. package/lib/plugins/undo-redo/index.js +112 -12
  114. package/lib/plugins/undo-redo/index.js.map +1 -1
  115. package/lib/plugins/visibility/VisibilityPlugin.d.ts +14 -5
  116. package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
  117. package/lib/plugins/visibility/index.js +168 -65
  118. package/lib/plugins/visibility/index.js.map +1 -1
  119. package/package.json +1 -1
  120. package/umd/grid.all.umd.js +21 -17
  121. package/umd/grid.all.umd.js.map +1 -1
  122. package/umd/grid.umd.js +14 -8
  123. package/umd/grid.umd.js.map +1 -1
  124. package/umd/plugins/clipboard.umd.js +5 -7
  125. package/umd/plugins/clipboard.umd.js.map +1 -1
  126. package/umd/plugins/column-virtualization.umd.js +1 -1
  127. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  128. package/umd/plugins/context-menu.umd.js +1 -1
  129. package/umd/plugins/context-menu.umd.js.map +1 -1
  130. package/umd/plugins/editing.umd.js +1 -1
  131. package/umd/plugins/editing.umd.js.map +1 -1
  132. package/umd/plugins/export.umd.js +1 -1
  133. package/umd/plugins/export.umd.js.map +1 -1
  134. package/umd/plugins/filtering.umd.js +1 -1
  135. package/umd/plugins/filtering.umd.js.map +1 -1
  136. package/umd/plugins/grouping-columns.umd.js +1 -1
  137. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  138. package/umd/plugins/grouping-rows.umd.js +1 -1
  139. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  140. package/umd/plugins/master-detail.umd.js +1 -1
  141. package/umd/plugins/master-detail.umd.js.map +1 -1
  142. package/umd/plugins/multi-sort.umd.js +1 -1
  143. package/umd/plugins/multi-sort.umd.js.map +1 -1
  144. package/umd/plugins/pinned-columns.umd.js +1 -1
  145. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  146. package/umd/plugins/pinned-rows.umd.js +1 -1
  147. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  148. package/umd/plugins/pivot.umd.js +1 -1
  149. package/umd/plugins/pivot.umd.js.map +1 -1
  150. package/umd/plugins/reorder.umd.js +1 -1
  151. package/umd/plugins/reorder.umd.js.map +1 -1
  152. package/umd/plugins/selection.umd.js +1 -1
  153. package/umd/plugins/selection.umd.js.map +1 -1
  154. package/umd/plugins/server-side.umd.js +1 -1
  155. package/umd/plugins/server-side.umd.js.map +1 -1
  156. package/umd/plugins/tree.umd.js +1 -1
  157. package/umd/plugins/tree.umd.js.map +1 -1
  158. package/umd/plugins/undo-redo.umd.js +1 -1
  159. package/umd/plugins/undo-redo.umd.js.map +1 -1
  160. package/umd/plugins/visibility.umd.js +1 -1
  161. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -1,15 +1,5 @@
1
1
  import { ExpandCollapseAnimation } from '../../core/types';
2
2
  export type { ExpandCollapseAnimation } from '../../core/types';
3
- /** View renderer function with optional marker for master-detail-wrapped renderers */
4
- export interface MasterDetailWrappedRenderer {
5
- (ctx: {
6
- value: unknown;
7
- row: Record<string, unknown>;
8
- column: unknown;
9
- }): Node | string | null;
10
- /** Marker to prevent double-wrapping */
11
- __masterDetailWrapped?: boolean;
12
- }
13
3
  /** Configuration options for the master-detail plugin */
14
4
  export interface MasterDetailConfig {
15
5
  /** Renderer function that returns detail content for a row */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/master-detail/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,sFAAsF;AACtF,MAAM,WAAW,2BAA2B;IAC1C,CAAC,GAAG,EAAE;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/F,wCAAwC;IACxC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,yDAAyD;AACzD,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,WAAW,GAAG,MAAM,CAAC;IAC1F,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sEAAsE;IACtE,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,uBAAuB,CAAC;CACrC;AAED,yDAAyD;AACzD,MAAM,WAAW,iBAAiB;IAChC,yDAAyD;IACzD,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,4CAA4C;IAC5C,cAAc,EA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MAAM,CAAC;IACjB,mBAAmB;IACnB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,sCAAsC;IACtC,QAAQ,EAAE,OAAO,CAAC;CACnB"}
@@ -11,7 +11,7 @@ import { MultiSortConfig, SortModel } from './types';
11
11
  */
12
12
  export declare class MultiSortPlugin extends BaseGridPlugin<MultiSortConfig> {
13
13
  readonly name = "multiSort";
14
- readonly version = "1.0.0";
14
+ readonly styles: string;
15
15
  protected get defaultConfig(): Partial<MultiSortConfig>;
16
16
  private sortModel;
17
17
  detach(): void;
@@ -53,6 +53,5 @@ export declare class MultiSortPlugin extends BaseGridPlugin<MultiSortConfig> {
53
53
  * Rebuilds the sort model from all column states.
54
54
  */
55
55
  applyColumnState(field: string, state: ColumnState): void;
56
- readonly styles: string;
57
56
  }
58
57
  //# sourceMappingURL=MultiSortPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSortPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/multi-sort/MultiSortPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGpD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,cAAc,CAAC,eAAe,CAAC;IAClE,QAAQ,CAAC,IAAI,eAAe;IAC5B,SAAkB,OAAO,WAAW;IAEpC,cAAuB,aAAa,IAAI,OAAO,CAAC,eAAe,CAAC,CAK/D;IAGD,OAAO,CAAC,SAAS,CAAmB;IAK3B,MAAM,IAAI,IAAI;IAOd,WAAW,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE;IAOhD,aAAa,CAAC,KAAK,EAAE,g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EAAE,gBAAgB,GAAG,OAAO;IAe/C,WAAW,IAAI,IAAI;IAiE5B;;;OAGG;IACH,YAAY,IAAI,SAAS,EAAE;IAI3B;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI;IAMtC;;OAEG;IACH,SAAS,IAAI,IAAI;IAMjB;;;;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI/C;;;;OAIG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS;IAO3D;;OAEG;IACM,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,SAAS;IAaxE;;;OAGG;IACM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;CA2BnE"}
@@ -8,9 +8,28 @@ const x = {
8
8
  dragHandle: "⋮⋮",
9
9
  toolPanel: "☰"
10
10
  };
11
- class M {
12
- /** Plugin version - override in subclass if needed */
13
- version = "1.0.0";
11
+ class b {
12
+ /**
13
+ * Plugin dependencies - declare other plugins this one requires.
14
+ *
15
+ * Dependencies are validated when the plugin is attached.
16
+ * Required dependencies throw an error if missing.
17
+ * Optional dependencies log an info message if missing.
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * static readonly dependencies: PluginDependency[] = [
22
+ * { name: 'editing', required: true, reason: 'Tracks cell edits for undo/redo' },
23
+ * { name: 'selection', required: false, reason: 'Enables selection-based undo' },
24
+ * ];
25
+ * ```
26
+ */
27
+ static dependencies;
28
+ /**
29
+ * Plugin version - defaults to grid version for built-in plugins.
30
+ * Third-party plugins can override with their own semver.
31
+ */
32
+ version = typeof __GRID_VERSION__ < "u" ? __GRID_VERSION__ : "dev";
14
33
  /** CSS styles to inject into the grid's shadow DOM */
15
34
  styles;
16
35
  /** Custom cell renderers keyed by type name */
@@ -97,12 +116,28 @@ class M {
97
116
  emit(t, e) {
98
117
  this.grid?.dispatchEvent?.(new CustomEvent(t, { detail: e, bubbles: !0 }));
99
118
  }
119
+ /**
120
+ * Emit a cancelable custom event from the grid.
121
+ * @returns `true` if the event was cancelled (preventDefault called), `false` otherwise
122
+ */
123
+ emitCancelable(t, e) {
124
+ const i = new CustomEvent(t, { detail: e, bubbles: !0, cancelable: !0 });
125
+ return this.grid?.dispatchEvent?.(i), i.defaultPrevented;
126
+ }
100
127
  /**
101
128
  * Request a re-render of the grid.
102
129
  */
103
130
  requestRender() {
104
131
  this.grid?.requestRender?.();
105
132
  }
133
+ /**
134
+ * Request a re-render and restore focus styling afterward.
135
+ * Use this when a plugin action (like expand/collapse) triggers a render
136
+ * but needs to maintain keyboard navigation focus.
137
+ */
138
+ requestRenderWithFocus() {
139
+ this.grid?.requestRenderWithFocus?.();
140
+ }
106
141
  /**
107
142
  * Request a lightweight style update without rebuilding DOM.
108
143
  * Use this instead of requestRender() when only CSS classes need updating.
@@ -136,6 +171,19 @@ class M {
136
171
  get visibleColumns() {
137
172
  return this.grid?._visibleColumns ?? [];
138
173
  }
174
+ /**
175
+ * Get the grid as an HTMLElement for direct DOM operations.
176
+ * Use sparingly - prefer the typed GridElementRef API when possible.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const width = this.gridElement.clientWidth;
181
+ * this.gridElement.classList.add('my-plugin-active');
182
+ * ```
183
+ */
184
+ get gridElement() {
185
+ return this.grid;
186
+ }
139
187
  /**
140
188
  * Get the shadow root of the grid.
141
189
  */
@@ -170,6 +218,51 @@ class M {
170
218
  const t = this.grid?.gridConfig?.icons ?? {};
171
219
  return { ...x, ...t };
172
220
  }
221
+ // #region Animation Helpers
222
+ /**
223
+ * Check if animations are enabled at the grid level.
224
+ * Respects gridConfig.animation.mode and the CSS variable set by the grid.
225
+ *
226
+ * Plugins should use this to skip animations when:
227
+ * - Animation mode is 'off' or `false`
228
+ * - User prefers reduced motion and mode is 'reduced-motion' (default)
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * private get animationStyle(): 'slide' | 'fade' | false {
233
+ * if (!this.isAnimationEnabled) return false;
234
+ * return this.config.animation ?? 'slide';
235
+ * }
236
+ * ```
237
+ */
238
+ get isAnimationEnabled() {
239
+ const t = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
240
+ if (t === !1 || t === "off") return !1;
241
+ if (t === !0 || t === "on") return !0;
242
+ const e = this.shadowRoot?.host;
243
+ return e ? getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
244
+ }
245
+ /**
246
+ * Get the animation duration in milliseconds from CSS variable.
247
+ * Falls back to 200ms if not set.
248
+ *
249
+ * Plugins can use this for their animation timing to stay consistent
250
+ * with the grid-level animation.duration setting.
251
+ *
252
+ * @example
253
+ * ```ts
254
+ * element.animate(keyframes, { duration: this.animationDuration });
255
+ * ```
256
+ */
257
+ get animationDuration() {
258
+ const t = this.shadowRoot?.host;
259
+ if (t) {
260
+ const e = getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(e, 10);
261
+ if (!isNaN(i)) return i;
262
+ }
263
+ return 200;
264
+ }
265
+ // #endregion
173
266
  /**
174
267
  * Resolve an icon value to string or HTMLElement.
175
268
  * Checks plugin config first, then grid-level icons, then defaults.
@@ -200,11 +293,11 @@ class M {
200
293
  // #endregion
201
294
  }
202
295
  function S(r, t, e) {
203
- return t.length ? [...r].sort((n, o) => {
204
- for (const i of t) {
205
- const d = e.find((a) => a.field === i.field)?.sortComparator ?? C, u = n[i.field], f = o[i.field], s = d(u, f, n, o);
296
+ return t.length ? [...r].sort((i, o) => {
297
+ for (const n of t) {
298
+ const d = e.find((c) => c.field === n.field)?.sortComparator ?? C, u = i[n.field], f = o[n.field], s = d(u, f, i, o);
206
299
  if (s !== 0)
207
- return i.direction === "asc" ? s : -s;
300
+ return n.direction === "asc" ? s : -s;
208
301
  }
209
302
  return 0;
210
303
  }) : [...r];
@@ -212,21 +305,21 @@ function S(r, t, e) {
212
305
  function C(r, t) {
213
306
  return r == null && t == null ? 0 : r == null ? 1 : t == null ? -1 : typeof r == "number" && typeof t == "number" ? r - t : r instanceof Date && t instanceof Date ? r.getTime() - t.getTime() : typeof r == "boolean" && typeof t == "boolean" ? r === t ? 0 : r ? -1 : 1 : String(r).localeCompare(String(t));
214
307
  }
215
- function y(r, t, e, n) {
216
- const o = r.find((i) => i.field === t);
217
- return e ? o ? o.direction === "asc" ? r.map((i) => i.field === t ? { ...i, direction: "desc" } : i) : r.filter((i) => i.field !== t) : r.length < n ? [...r, { field: t, direction: "asc" }] : r : o?.direction === "asc" ? [{ field: t, direction: "desc" }] : o?.direction === "desc" ? [] : [{ field: t, direction: "asc" }];
308
+ function y(r, t, e, i) {
309
+ const o = r.find((n) => n.field === t);
310
+ return e ? o ? o.direction === "asc" ? r.map((n) => n.field === t ? { ...n, direction: "desc" } : n) : r.filter((n) => n.field !== t) : r.length < i ? [...r, { field: t, direction: "asc" }] : r : o?.direction === "asc" ? [{ field: t, direction: "desc" }] : o?.direction === "desc" ? [] : [{ field: t, direction: "asc" }];
218
311
  }
219
- function h(r, t) {
220
- const e = r.findIndex((n) => n.field === t);
312
+ function g(r, t) {
313
+ const e = r.findIndex((i) => i.field === t);
221
314
  return e >= 0 ? e + 1 : void 0;
222
315
  }
223
316
  function m(r, t) {
224
317
  return r.find((e) => e.field === t)?.direction;
225
318
  }
226
- const b = '.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}';
227
- class w extends M {
319
+ const M = '.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}';
320
+ class w extends b {
228
321
  name = "multiSort";
229
- version = "1.0.0";
322
+ styles = M;
230
323
  get defaultConfig() {
231
324
  return {
232
325
  maxSortColumns: 3,
@@ -246,26 +339,26 @@ class w extends M {
246
339
  return this.sortModel.length === 0 ? [...t] : S([...t], this.sortModel, [...this.columns]);
247
340
  }
248
341
  onHeaderClick(t) {
249
- if (!this.columns.find((i) => i.field === t.field)?.sortable) return !1;
250
- const n = t.originalEvent.shiftKey, o = this.config.maxSortColumns ?? 3;
251
- return this.sortModel = y(this.sortModel, t.field, n, o), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
342
+ if (!this.columns.find((n) => n.field === t.field)?.sortable) return !1;
343
+ const i = t.originalEvent.shiftKey, o = this.config.maxSortColumns ?? 3;
344
+ return this.sortModel = y(this.sortModel, t.field, i, o), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
252
345
  }
253
346
  afterRender() {
254
347
  const t = this.shadowRoot;
255
348
  if (!t) return;
256
349
  const e = this.config.showSortIndex !== !1;
257
350
  t.querySelectorAll(".header-row .cell[data-field]").forEach((o) => {
258
- const i = o.getAttribute("data-field");
259
- if (!i) return;
260
- const c = h(this.sortModel, i), d = m(this.sortModel, i);
351
+ const n = o.getAttribute("data-field");
352
+ if (!n) return;
353
+ const a = g(this.sortModel, n), d = m(this.sortModel, n);
261
354
  if (o.querySelector(".sort-index")?.remove(), d) {
262
355
  o.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), o.setAttribute("data-sort", d);
263
356
  const s = document.createElement("span");
264
357
  s.className = "sort-indicator", this.setIcon(s, this.resolveIcon(d === "asc" ? "sortAsc" : "sortDesc"));
265
- const a = o.querySelector(".tbw-filter-btn"), p = o.querySelector(".resize-handle"), g = a ?? p;
266
- if (g ? o.insertBefore(s, g) : o.appendChild(s), e && this.sortModel.length > 1 && c !== void 0) {
358
+ const c = o.querySelector(".tbw-filter-btn"), p = o.querySelector(".resize-handle"), h = c ?? p;
359
+ if (h ? o.insertBefore(s, h) : o.appendChild(s), e && this.sortModel.length > 1 && a !== void 0) {
267
360
  const l = document.createElement("span");
268
- l.className = "sort-index", l.textContent = String(c), s.nextSibling ? o.insertBefore(l, s.nextSibling) : o.appendChild(l);
361
+ l.className = "sort-index", l.textContent = String(a), s.nextSibling ? o.insertBefore(l, s.nextSibling) : o.appendChild(l);
269
362
  }
270
363
  } else
271
364
  o.removeAttribute("data-sort");
@@ -299,7 +392,7 @@ class w extends M {
299
392
  * @returns 1-based index or undefined if not sorted
300
393
  */
301
394
  getSortIndex(t) {
302
- return h(this.sortModel, t);
395
+ return g(this.sortModel, t);
303
396
  }
304
397
  /**
305
398
  * Get the sort direction for a specific field.
@@ -329,19 +422,16 @@ class w extends M {
329
422
  */
330
423
  applyColumnState(t, e) {
331
424
  if (!e.sort) {
332
- this.sortModel = this.sortModel.filter((i) => i.field !== t);
425
+ this.sortModel = this.sortModel.filter((n) => n.field !== t);
333
426
  return;
334
427
  }
335
- const n = this.sortModel.findIndex((i) => i.field === t), o = {
428
+ const i = this.sortModel.findIndex((n) => n.field === t), o = {
336
429
  field: t,
337
430
  direction: e.sort.direction
338
431
  };
339
- n !== -1 ? this.sortModel[n] = o : this.sortModel.splice(e.sort.priority, 0, o);
432
+ i !== -1 ? this.sortModel[i] = o : this.sortModel.splice(e.sort.priority, 0, o);
340
433
  }
341
434
  // #endregion
342
- // #region Styles
343
- styles = b;
344
- // #endregion
345
435
  }
346
436
  export {
347
437
  w as MultiSortPlugin