@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.
- package/README.md +10 -13
- package/all.js +1124 -1047
- package/all.js.map +1 -1
- package/index.js +688 -515
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +10 -0
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/config-manager.d.ts +1 -0
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/utils.d.ts +1 -0
- package/lib/core/internal/utils.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts +14 -0
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +105 -1
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/expander-column.d.ts +51 -0
- package/lib/core/plugin/expander-column.d.ts.map +1 -0
- package/lib/core/plugin/index.d.ts +1 -0
- package/lib/core/plugin/index.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +1 -1
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +117 -1
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +4 -2
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +9 -2
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.d.ts +1 -1
- package/lib/plugins/clipboard/index.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +303 -185
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +72 -2
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +0 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +116 -24
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +0 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +164 -72
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +1 -7
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +213 -133
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/ExportPlugin.d.ts +0 -1
- package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
- package/lib/plugins/export/index.js +195 -103
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +5 -2
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +145 -43
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -2
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/grouping-columns.d.ts +1 -1
- package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +162 -68
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +14 -2
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +246 -138
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +13 -11
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +281 -196
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/master-detail/types.d.ts +0 -10
- package/lib/plugins/master-detail/types.d.ts.map +1 -1
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +1 -2
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.js +121 -31
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +0 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +144 -52
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +1 -2
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +178 -88
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts +26 -4
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +414 -310
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/pivot/pivot-rows.d.ts +2 -1
- package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts +13 -10
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/index.js +304 -226
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +21 -3
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +2 -2
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +292 -145
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +24 -0
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/ServerSidePlugin.d.ts +0 -1
- package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js +95 -3
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +5 -1
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +213 -112
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/tree/types.d.ts +0 -10
- package/lib/plugins/tree/types.d.ts.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +7 -2
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +112 -12
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +14 -5
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +168 -65
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +21 -17
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +14 -8
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -7
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js +1 -1
- package/umd/plugins/column-virtualization.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/export.umd.js +1 -1
- package/umd/plugins/export.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/grouping-columns.umd.js +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/reorder.umd.js +1 -1
- package/umd/plugins/reorder.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/server-side.umd.js +1 -1
- package/umd/plugins/server-side.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/umd/plugins/undo-redo.umd.js +1 -1
- package/umd/plugins/undo-redo.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
|
@@ -14,7 +14,7 @@ import { ColumnGroup, GroupingColumnsConfig } from './types';
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class GroupingColumnsPlugin extends BaseGridPlugin<GroupingColumnsConfig> {
|
|
16
16
|
readonly name = "groupingColumns";
|
|
17
|
-
readonly
|
|
17
|
+
readonly styles: string;
|
|
18
18
|
protected get defaultConfig(): Partial<GroupingColumnsConfig>;
|
|
19
19
|
private groups;
|
|
20
20
|
private isActive;
|
|
@@ -46,6 +46,5 @@ export declare class GroupingColumnsPlugin extends BaseGridPlugin<GroupingColumn
|
|
|
46
46
|
* Refresh column groups (recompute from current columns).
|
|
47
47
|
*/
|
|
48
48
|
refresh(): void;
|
|
49
|
-
readonly styles: string;
|
|
50
49
|
}
|
|
51
50
|
//# sourceMappingURL=GroupingColumnsPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingColumnsPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-columns/GroupingColumnsPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAElE;;;;;;;;;;GAUG;AACH,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,qBAAqB,CAAC;IAC9E,QAAQ,CAAC,IAAI,qBAAqB;IAClC,SAAkB,
|
|
1
|
+
{"version":3,"file":"GroupingColumnsPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-columns/GroupingColumnsPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrD,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAElE;;;;;;;;;;GAUG;AACH,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,qBAAqB,CAAC;IAC9E,QAAQ,CAAC,IAAI,qBAAqB;IAClC,SAAkB,MAAM,SAAU;IAElC,cAAuB,aAAa,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAIrE;IAGD,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAS;IAKhB,MAAM,IAAI,IAAI;IAQvB;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;IAchD,cAAc,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,YAAY,EAAE;IA0ChE,WAAW,IAAI,IAAI;IAgD5B;;;OAGG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;;OAGG;IACH,SAAS,IAAI,WAAW,EAAE;IAI1B;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE;IAKhD;;OAEG;IACH,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -20,7 +20,7 @@ export declare function applyGroupedHeaderCellClasses(headerRowEl: HTMLElement |
|
|
|
20
20
|
* Build the group header row element.
|
|
21
21
|
*
|
|
22
22
|
* @param groups - The computed column groups
|
|
23
|
-
* @param columns - The column configurations
|
|
23
|
+
* @param columns - The column configurations (final array including any plugin-added columns)
|
|
24
24
|
* @returns The group header row element, or null if no groups
|
|
25
25
|
*/
|
|
26
26
|
export declare function buildGroupHeaderRow(groups: ColumnGroup[], columns: ColumnConfig[]): HTMLElement | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grouping-columns.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-columns/grouping-columns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,SAAS,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CA+DnF;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,WAAW,GAAG,IAAI,EAC/B,MAAM,EAAE,WAAW,EAAE,EACrB,OAAO,EAAE,YAAY,EAAE,GACtB,IAAI,CA8BN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,WAAW,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"grouping-columns.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-columns/grouping-columns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,SAAS,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,CA+DnF;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,WAAW,GAAG,IAAI,EAC/B,MAAM,EAAE,WAAW,EAAE,EACrB,OAAO,EAAE,YAAY,EAAE,GACtB,IAAI,CA8BN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,WAAW,GAAG,IAAI,CA4BtG;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAIzE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const g = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -8,9 +8,28 @@ const c = {
|
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
9
|
toolPanel: "☰"
|
|
10
10
|
};
|
|
11
|
-
class
|
|
12
|
-
/**
|
|
13
|
-
|
|
11
|
+
class h {
|
|
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 a {
|
|
|
97
116
|
emit(e, r) {
|
|
98
117
|
this.grid?.dispatchEvent?.(new CustomEvent(e, { detail: r, 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(e, r) {
|
|
124
|
+
const t = new CustomEvent(e, { detail: r, bubbles: !0, cancelable: !0 });
|
|
125
|
+
return this.grid?.dispatchEvent?.(t), t.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 a {
|
|
|
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
|
*/
|
|
@@ -168,8 +216,53 @@ class a {
|
|
|
168
216
|
*/
|
|
169
217
|
get gridIcons() {
|
|
170
218
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
171
|
-
return { ...
|
|
219
|
+
return { ...g, ...e };
|
|
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 e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
240
|
+
if (e === !1 || e === "off") return !1;
|
|
241
|
+
if (e === !0 || e === "on") return !0;
|
|
242
|
+
const r = this.shadowRoot?.host;
|
|
243
|
+
return r ? getComputedStyle(r).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 e = this.shadowRoot?.host;
|
|
259
|
+
if (e) {
|
|
260
|
+
const r = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), t = parseInt(r, 10);
|
|
261
|
+
if (!isNaN(t)) return t;
|
|
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.
|
|
@@ -199,74 +292,76 @@ class a {
|
|
|
199
292
|
}
|
|
200
293
|
// #endregion
|
|
201
294
|
}
|
|
202
|
-
function
|
|
203
|
-
if (!
|
|
204
|
-
const e = /* @__PURE__ */ new Map(), r = [], t = (o,
|
|
205
|
-
if (!
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
|
|
295
|
+
function c(l) {
|
|
296
|
+
if (!l.length) return [];
|
|
297
|
+
const e = /* @__PURE__ */ new Map(), r = [], t = (o, i) => {
|
|
298
|
+
if (!i.length) return;
|
|
299
|
+
const s = r[r.length - 1];
|
|
300
|
+
if (s && s.implicit && s.firstIndex + s.columns.length === o) {
|
|
301
|
+
s.columns.push(...i);
|
|
209
302
|
return;
|
|
210
303
|
}
|
|
211
304
|
r.push({
|
|
212
305
|
id: "__implicit__" + o,
|
|
213
306
|
label: void 0,
|
|
214
|
-
columns:
|
|
307
|
+
columns: i,
|
|
215
308
|
firstIndex: o,
|
|
216
309
|
implicit: !0
|
|
217
310
|
});
|
|
218
311
|
};
|
|
219
|
-
let
|
|
220
|
-
return
|
|
221
|
-
const
|
|
222
|
-
if (!
|
|
223
|
-
|
|
312
|
+
let u = [], n = 0;
|
|
313
|
+
return l.forEach((o, i) => {
|
|
314
|
+
const s = o.group;
|
|
315
|
+
if (!s) {
|
|
316
|
+
u.length === 0 && (n = i), u.push(o);
|
|
224
317
|
return;
|
|
225
318
|
}
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
let
|
|
229
|
-
|
|
230
|
-
id:
|
|
231
|
-
label: typeof
|
|
319
|
+
u.length && (t(n, u.slice()), u = []);
|
|
320
|
+
const d = typeof s == "string" ? s : s.id;
|
|
321
|
+
let a = e.get(d);
|
|
322
|
+
a || (a = {
|
|
323
|
+
id: d,
|
|
324
|
+
label: typeof s == "string" ? void 0 : s.label,
|
|
232
325
|
columns: [],
|
|
233
|
-
firstIndex:
|
|
234
|
-
}, e.set(
|
|
235
|
-
}),
|
|
326
|
+
firstIndex: i
|
|
327
|
+
}, e.set(d, a), r.push(a)), a.columns.push(o);
|
|
328
|
+
}), u.length && t(n, u), r.length === 1 && r[0].implicit && r[0].columns.length === l.length ? [] : r;
|
|
236
329
|
}
|
|
237
|
-
function p(
|
|
238
|
-
if (!e.length || !
|
|
330
|
+
function p(l, e, r) {
|
|
331
|
+
if (!e.length || !l) return;
|
|
239
332
|
const t = /* @__PURE__ */ new Map();
|
|
240
|
-
for (const
|
|
241
|
-
for (const o of
|
|
242
|
-
o.field && t.set(o.field,
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
const o =
|
|
246
|
-
|
|
333
|
+
for (const n of e)
|
|
334
|
+
for (const o of n.columns)
|
|
335
|
+
o.field && t.set(o.field, n.id);
|
|
336
|
+
const u = Array.from(l.querySelectorAll(".cell[data-field]"));
|
|
337
|
+
u.forEach((n) => {
|
|
338
|
+
const o = n.getAttribute("data-field") || "", i = t.get(o);
|
|
339
|
+
i && (n.classList.add("grouped"), n.getAttribute("data-group") || n.setAttribute("data-group", i));
|
|
247
340
|
});
|
|
248
|
-
for (const
|
|
249
|
-
const o =
|
|
250
|
-
|
|
341
|
+
for (const n of e) {
|
|
342
|
+
const o = n.columns[n.columns.length - 1], i = u.find((s) => s.getAttribute("data-field") === o.field);
|
|
343
|
+
i && i.classList.add("group-end");
|
|
251
344
|
}
|
|
252
345
|
}
|
|
253
|
-
function f(
|
|
254
|
-
if (
|
|
346
|
+
function f(l, e) {
|
|
347
|
+
if (l.length === 0) return null;
|
|
255
348
|
const r = document.createElement("div");
|
|
256
349
|
r.className = "header-group-row", r.setAttribute("role", "row");
|
|
257
|
-
for (const t of
|
|
258
|
-
const
|
|
259
|
-
|
|
350
|
+
for (const t of l) {
|
|
351
|
+
const u = t.columns[0], n = u ? e.findIndex((d) => d.field === u.field) : -1;
|
|
352
|
+
if (n === -1) continue;
|
|
353
|
+
const o = String(t.id).startsWith("__implicit__"), i = o ? "" : t.label || t.id, s = document.createElement("div");
|
|
354
|
+
s.className = "cell header-group-cell", o && s.classList.add("implicit-group"), s.setAttribute("data-group", String(t.id)), s.style.gridColumn = `${n + 1} / span ${t.columns.length}`, s.textContent = i, r.appendChild(s);
|
|
260
355
|
}
|
|
261
356
|
return r;
|
|
262
357
|
}
|
|
263
|
-
function m(
|
|
264
|
-
return
|
|
358
|
+
function m(l) {
|
|
359
|
+
return l.some((e) => e.group != null);
|
|
265
360
|
}
|
|
266
361
|
const b = ".header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:4px 8px;font-weight:600;font-size:.9em;text-transform:uppercase;letter-spacing:.5px;border-right:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong))}.header-row .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}";
|
|
267
|
-
class w extends
|
|
362
|
+
class w extends h {
|
|
268
363
|
name = "groupingColumns";
|
|
269
|
-
|
|
364
|
+
styles = b;
|
|
270
365
|
get defaultConfig() {
|
|
271
366
|
return {
|
|
272
367
|
showGroupBorders: !0
|
|
@@ -298,37 +393,39 @@ class w extends a {
|
|
|
298
393
|
const r = this.grid?.gridConfig?.columnGroups;
|
|
299
394
|
let t;
|
|
300
395
|
if (r && Array.isArray(r) && r.length > 0) {
|
|
301
|
-
const
|
|
396
|
+
const n = /* @__PURE__ */ new Map();
|
|
302
397
|
for (const o of r)
|
|
303
|
-
for (const
|
|
304
|
-
|
|
398
|
+
for (const i of o.children)
|
|
399
|
+
n.set(i, { id: o.id, label: o.header });
|
|
305
400
|
t = e.map((o) => {
|
|
306
|
-
const
|
|
307
|
-
return
|
|
401
|
+
const i = n.get(o.field);
|
|
402
|
+
return i && !o.group ? { ...o, group: i } : o;
|
|
308
403
|
});
|
|
309
404
|
} else
|
|
310
405
|
t = [...e];
|
|
311
|
-
const
|
|
312
|
-
return
|
|
406
|
+
const u = c(t);
|
|
407
|
+
return u.length === 0 ? (this.isActive = !1, this.groups = [], t) : (this.isActive = !0, this.groups = u, t);
|
|
313
408
|
}
|
|
314
409
|
afterRender() {
|
|
315
|
-
if (!this.isActive
|
|
316
|
-
const
|
|
317
|
-
|
|
410
|
+
if (!this.isActive) {
|
|
411
|
+
const s = this.shadowRoot?.querySelector(".header")?.querySelector(".header-group-row");
|
|
412
|
+
s && s.remove();
|
|
318
413
|
return;
|
|
319
414
|
}
|
|
320
415
|
const e = this.shadowRoot?.querySelector(".header");
|
|
321
416
|
if (!e) return;
|
|
322
417
|
const r = e.querySelector(".header-group-row");
|
|
323
418
|
r && r.remove();
|
|
324
|
-
const t =
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
419
|
+
const t = this.columns, u = c(t);
|
|
420
|
+
if (u.length === 0) return;
|
|
421
|
+
const n = f(u, t);
|
|
422
|
+
if (n) {
|
|
423
|
+
n.classList.toggle("no-borders", !this.config.showGroupBorders);
|
|
424
|
+
const i = e.querySelector(".header-row");
|
|
425
|
+
i ? e.insertBefore(n, i) : e.appendChild(n);
|
|
329
426
|
}
|
|
330
|
-
const
|
|
331
|
-
|
|
427
|
+
const o = e.querySelector(".header-row");
|
|
428
|
+
o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), p(o, u));
|
|
332
429
|
}
|
|
333
430
|
// #endregion
|
|
334
431
|
// #region Public API
|
|
@@ -362,9 +459,6 @@ class w extends a {
|
|
|
362
459
|
this.requestRender();
|
|
363
460
|
}
|
|
364
461
|
// #endregion
|
|
365
|
-
// #region Styles
|
|
366
|
-
styles = b;
|
|
367
|
-
// #endregion
|
|
368
462
|
}
|
|
369
463
|
export {
|
|
370
464
|
w as GroupingColumnsPlugin
|