@toolbox-web/grid 0.6.0 → 1.0.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.
- package/README.md +79 -26
- package/all.js +731 -1739
- package/all.js.map +1 -1
- package/index.js +1382 -2410
- package/index.js.map +1 -1
- package/lib/core/constants.d.ts +8 -0
- package/lib/core/constants.d.ts.map +1 -1
- package/lib/core/grid.d.ts +704 -55
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/config-manager.d.ts +3 -7
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/dom-builder.d.ts +2 -10
- package/lib/core/internal/dom-builder.d.ts.map +1 -1
- package/lib/core/internal/inference.d.ts.map +1 -1
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/render-scheduler.d.ts +2 -0
- package/lib/core/internal/render-scheduler.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts +9 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +41 -41
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +2 -15
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +33 -6
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +376 -68
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +89 -2
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.d.ts +2 -0
- package/lib/plugins/clipboard/index.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +24 -35
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +57 -2
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.d.ts +2 -0
- package/lib/plugins/column-virtualization/index.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +7 -17
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +75 -5
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.d.ts +3 -1
- package/lib/plugins/context-menu/index.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +15 -27
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +101 -9
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/editors.d.ts +9 -1
- package/lib/plugins/editing/editors.d.ts.map +1 -1
- package/lib/plugins/editing/index.d.ts +4 -2
- package/lib/plugins/editing/index.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +412 -279
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +88 -0
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/ExportPlugin.d.ts +73 -7
- package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
- package/lib/plugins/export/index.d.ts +2 -0
- package/lib/plugins/export/index.d.ts.map +1 -1
- package/lib/plugins/export/index.js +4 -19
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +98 -2
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.d.ts +2 -0
- package/lib/plugins/filtering/index.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +50 -58
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +80 -6
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.d.ts +2 -0
- package/lib/plugins/grouping-columns/index.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +10 -21
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +81 -5
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.d.ts +3 -1
- package/lib/plugins/grouping-rows/index.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +13 -21
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +90 -5
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.d.ts +2 -0
- package/lib/plugins/master-detail/index.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +11 -17
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +83 -2
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.d.ts +2 -0
- package/lib/plugins/multi-sort/index.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.js +11 -19
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +61 -2
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.d.ts +3 -1
- package/lib/plugins/pinned-columns/index.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +7 -17
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +71 -10
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.d.ts +3 -1
- package/lib/plugins/pinned-rows/index.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +5 -17
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts +81 -4
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.d.ts +2 -0
- package/lib/plugins/pivot/index.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +10 -17
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts +71 -3
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/index.d.ts +2 -0
- package/lib/plugins/reorder/index.d.ts.map +1 -1
- package/lib/plugins/reorder/index.js +8 -18
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/reorder/types.d.ts +0 -5
- package/lib/plugins/reorder/types.d.ts.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +84 -20
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +2 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +70 -131
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +25 -4
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/ServerSidePlugin.d.ts +65 -4
- package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -1
- package/lib/plugins/server-side/index.d.ts +3 -1
- package/lib/plugins/server-side/index.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js +5 -17
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +89 -2
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.d.ts +3 -2
- package/lib/plugins/tree/index.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +59 -94
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +66 -3
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.d.ts +3 -1
- package/lib/plugins/undo-redo/index.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +5 -17
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +86 -2
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.d.ts +2 -0
- package/lib/plugins/visibility/index.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +6 -17
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +30 -2
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +19 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +11 -11
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js.map +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.map +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +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.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.map +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
|
@@ -4,19 +4,98 @@ import { MultiSortConfig, SortModel } from './types';
|
|
|
4
4
|
/**
|
|
5
5
|
* Multi-Sort Plugin for tbw-grid
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Enables sorting by multiple columns at once—hold Shift and click additional column
|
|
8
|
+
* headers to build up a sort stack. Priority badges show the sort order, so users
|
|
9
|
+
* always know which column takes precedence.
|
|
10
|
+
*
|
|
11
|
+
* ## Installation
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { MultiSortPlugin } from '@toolbox-web/grid/plugins/multi-sort';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## Configuration Options
|
|
18
|
+
*
|
|
19
|
+
* | Option | Type | Default | Description |
|
|
20
|
+
* |--------|------|---------|-------------|
|
|
21
|
+
* | `maxSortColumns` | `number` | `3` | Maximum columns to sort by |
|
|
22
|
+
* | `showSortIndex` | `boolean` | `true` | Show sort priority badges |
|
|
23
|
+
* | `initialSort` | `SortModel[]` | - | Pre-configured sort order on load |
|
|
24
|
+
*
|
|
25
|
+
* ## Keyboard Shortcuts
|
|
26
|
+
*
|
|
27
|
+
* | Shortcut | Action |
|
|
28
|
+
* |----------|--------|
|
|
29
|
+
* | `Click header` | Sort by column (clears other sorts) |
|
|
30
|
+
* | `Shift + Click` | Add column to multi-sort stack |
|
|
31
|
+
* | `Ctrl + Click` | Toggle sort direction |
|
|
32
|
+
*
|
|
33
|
+
* ## Events
|
|
34
|
+
*
|
|
35
|
+
* | Event | Detail | Description |
|
|
36
|
+
* |-------|--------|-------------|
|
|
37
|
+
* | `sort-change` | `{ sortModel: SortModel[] }` | Fired when sort changes |
|
|
38
|
+
*
|
|
39
|
+
* ## Programmatic API
|
|
40
|
+
*
|
|
41
|
+
* | Method | Signature | Description |
|
|
42
|
+
* |--------|-----------|-------------|
|
|
43
|
+
* | `setSort` | `(sortModel: SortModel[]) => void` | Set sort programmatically |
|
|
44
|
+
* | `getSortModel` | `() => SortModel[]` | Get current sort model |
|
|
45
|
+
* | `clearSort` | `() => void` | Clear all sorting |
|
|
46
|
+
* | `addSort` | `(field, direction) => void` | Add a column to sort |
|
|
47
|
+
* | `removeSort` | `(field) => void` | Remove a column from sort |
|
|
48
|
+
*
|
|
49
|
+
* @example Basic Multi-Column Sorting
|
|
50
|
+
* ```ts
|
|
51
|
+
* import '@toolbox-web/grid';
|
|
52
|
+
* import { MultiSortPlugin } from '@toolbox-web/grid/plugins/multi-sort';
|
|
53
|
+
*
|
|
54
|
+
* const grid = document.querySelector('tbw-grid');
|
|
55
|
+
* grid.gridConfig = {
|
|
56
|
+
* columns: [
|
|
57
|
+
* { field: 'name', header: 'Name', sortable: true },
|
|
58
|
+
* { field: 'department', header: 'Department', sortable: true },
|
|
59
|
+
* { field: 'salary', header: 'Salary', type: 'number', sortable: true },
|
|
60
|
+
* ],
|
|
61
|
+
* plugins: [new MultiSortPlugin({ maxSortColumns: 3, showSortIndex: true })],
|
|
62
|
+
* };
|
|
63
|
+
*
|
|
64
|
+
* grid.addEventListener('sort-change', (e) => {
|
|
65
|
+
* console.log('Active sorts:', e.detail.sortModel);
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example Initial Sort Configuration
|
|
8
70
|
* ```ts
|
|
9
|
-
* new MultiSortPlugin({
|
|
71
|
+
* new MultiSortPlugin({
|
|
72
|
+
* initialSort: [
|
|
73
|
+
* { field: 'department', direction: 'asc' },
|
|
74
|
+
* { field: 'salary', direction: 'desc' },
|
|
75
|
+
* ],
|
|
76
|
+
* })
|
|
10
77
|
* ```
|
|
78
|
+
*
|
|
79
|
+
* @see {@link MultiSortConfig} for all configuration options
|
|
80
|
+
* @see {@link SortModel} for the sort model structure
|
|
81
|
+
*
|
|
82
|
+
* @internal Extends BaseGridPlugin
|
|
11
83
|
*/
|
|
12
84
|
export declare class MultiSortPlugin extends BaseGridPlugin<MultiSortConfig> {
|
|
85
|
+
/** @internal */
|
|
13
86
|
readonly name = "multiSort";
|
|
87
|
+
/** @internal */
|
|
14
88
|
readonly styles: string;
|
|
89
|
+
/** @internal */
|
|
15
90
|
protected get defaultConfig(): Partial<MultiSortConfig>;
|
|
16
91
|
private sortModel;
|
|
92
|
+
/** @internal */
|
|
17
93
|
detach(): void;
|
|
94
|
+
/** @internal */
|
|
18
95
|
processRows(rows: readonly unknown[]): unknown[];
|
|
96
|
+
/** @internal */
|
|
19
97
|
onHeaderClick(event: HeaderClickEvent): boolean;
|
|
98
|
+
/** @internal */
|
|
20
99
|
afterRender(): void;
|
|
21
100
|
/**
|
|
22
101
|
* Get the current sort model.
|
|
@@ -46,11 +125,13 @@ export declare class MultiSortPlugin extends BaseGridPlugin<MultiSortConfig> {
|
|
|
46
125
|
getSortDirection(field: string): 'asc' | 'desc' | undefined;
|
|
47
126
|
/**
|
|
48
127
|
* Return sort state for a column if it's in the sort model.
|
|
128
|
+
* @internal
|
|
49
129
|
*/
|
|
50
130
|
getColumnState(field: string): Partial<ColumnState> | undefined;
|
|
51
131
|
/**
|
|
52
132
|
* Apply sort state from column state.
|
|
53
133
|
* Rebuilds the sort model from all column states.
|
|
134
|
+
* @internal
|
|
54
135
|
*/
|
|
55
136
|
applyColumnState(field: string, state: ColumnState): void;
|
|
56
137
|
}
|
|
@@ -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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,qBAAa,eAAgB,SAAQ,cAAc,CAAC,eAAe,CAAC;IAClE,gBAAgB;IAChB,QAAQ,CAAC,IAAI,eAAe;IAC5B,gBAAgB;IAChB,SAAkB,MAAM,SAAU;IAElC,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,eAAe,CAAC,CAK/D;IAGD,OAAO,CAAC,SAAS,CAAmB;IAKpC,gBAAgB;IACP,MAAM,IAAI,IAAI;IAOvB,gBAAgB;IACP,WAAW,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE;IAOzD,gBAAgB;IACP,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO;IAexD,gBAAgB;IACP,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;;;OAGG;IACM,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,SAAS;IAaxE;;;;OAIG;IACM,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI;CA2BnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/multi-sort/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/multi-sort/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -184,23 +184,6 @@ class x {
|
|
|
184
184
|
get gridElement() {
|
|
185
185
|
return this.grid;
|
|
186
186
|
}
|
|
187
|
-
/**
|
|
188
|
-
* Get the render root of the grid for DOM queries.
|
|
189
|
-
* @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
|
|
190
|
-
*
|
|
191
|
-
* With Shadow DOM removed, the grid element itself is the render root.
|
|
192
|
-
* All new code should use `this.gridElement` for DOM queries.
|
|
193
|
-
*
|
|
194
|
-
* @example
|
|
195
|
-
* // OLD (deprecated)
|
|
196
|
-
* const rows = this.shadowRoot?.querySelector('.rows');
|
|
197
|
-
*
|
|
198
|
-
* // NEW (preferred)
|
|
199
|
-
* const rows = this.gridElement.querySelector('.rows');
|
|
200
|
-
*/
|
|
201
|
-
get shadowRoot() {
|
|
202
|
-
return this.gridElement;
|
|
203
|
-
}
|
|
204
187
|
/**
|
|
205
188
|
* Get the disconnect signal for event listener cleanup.
|
|
206
189
|
* This signal is aborted when the grid disconnects from the DOM.
|
|
@@ -328,9 +311,12 @@ function m(r, t) {
|
|
|
328
311
|
return r.find((e) => e.field === t)?.direction;
|
|
329
312
|
}
|
|
330
313
|
const M = '@layer tbw-plugins{.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}}';
|
|
331
|
-
class
|
|
314
|
+
class I extends x {
|
|
315
|
+
/** @internal */
|
|
332
316
|
name = "multiSort";
|
|
317
|
+
/** @internal */
|
|
333
318
|
styles = M;
|
|
319
|
+
/** @internal */
|
|
334
320
|
get defaultConfig() {
|
|
335
321
|
return {
|
|
336
322
|
maxSortColumns: 3,
|
|
@@ -341,19 +327,23 @@ class w extends x {
|
|
|
341
327
|
sortModel = [];
|
|
342
328
|
// #endregion
|
|
343
329
|
// #region Lifecycle
|
|
330
|
+
/** @internal */
|
|
344
331
|
detach() {
|
|
345
332
|
this.sortModel = [];
|
|
346
333
|
}
|
|
347
334
|
// #endregion
|
|
348
335
|
// #region Hooks
|
|
336
|
+
/** @internal */
|
|
349
337
|
processRows(t) {
|
|
350
338
|
return this.sortModel.length === 0 ? [...t] : S([...t], this.sortModel, [...this.columns]);
|
|
351
339
|
}
|
|
340
|
+
/** @internal */
|
|
352
341
|
onHeaderClick(t) {
|
|
353
342
|
if (!this.columns.find((n) => n.field === t.field)?.sortable) return !1;
|
|
354
343
|
const o = t.originalEvent.shiftKey, i = this.config.maxSortColumns ?? 3;
|
|
355
344
|
return this.sortModel = C(this.sortModel, t.field, o, i), this.emit("sort-change", { sortModel: [...this.sortModel] }), this.requestRender(), !0;
|
|
356
345
|
}
|
|
346
|
+
/** @internal */
|
|
357
347
|
afterRender() {
|
|
358
348
|
const t = this.gridElement;
|
|
359
349
|
if (!t) return;
|
|
@@ -417,6 +407,7 @@ class w extends x {
|
|
|
417
407
|
// #region Column State Hooks
|
|
418
408
|
/**
|
|
419
409
|
* Return sort state for a column if it's in the sort model.
|
|
410
|
+
* @internal
|
|
420
411
|
*/
|
|
421
412
|
getColumnState(t) {
|
|
422
413
|
const e = this.sortModel.findIndex((i) => i.field === t);
|
|
@@ -430,6 +421,7 @@ class w extends x {
|
|
|
430
421
|
/**
|
|
431
422
|
* Apply sort state from column state.
|
|
432
423
|
* Rebuilds the sort model from all column states.
|
|
424
|
+
* @internal
|
|
433
425
|
*/
|
|
434
426
|
applyColumnState(t, e) {
|
|
435
427
|
if (!e.sort) {
|
|
@@ -445,6 +437,6 @@ class w extends x {
|
|
|
445
437
|
// #endregion
|
|
446
438
|
}
|
|
447
439
|
export {
|
|
448
|
-
|
|
440
|
+
I as MultiSortPlugin
|
|
449
441
|
};
|
|
450
442
|
//# sourceMappingURL=index.js.map
|