@genesislcap/grid-pro 15.17.0 → 15.18.0-FUI-2601.3

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 (59) hide show
  1. package/dist/custom-elements.json +9111 -7238
  2. package/dist/dts/columns-tool-panel/columns-tool-panel-ag-drag.d.ts +12 -0
  3. package/dist/dts/columns-tool-panel/columns-tool-panel-ag-drag.d.ts.map +1 -0
  4. package/dist/dts/columns-tool-panel/columns-tool-panel.d.ts +150 -0
  5. package/dist/dts/columns-tool-panel/columns-tool-panel.d.ts.map +1 -0
  6. package/dist/dts/columns-tool-panel/columns-tool-panel.styles.d.ts +9 -0
  7. package/dist/dts/columns-tool-panel/columns-tool-panel.styles.d.ts.map +1 -0
  8. package/dist/dts/columns-tool-panel/columns-tool-panel.template.d.ts +12 -0
  9. package/dist/dts/columns-tool-panel/columns-tool-panel.template.d.ts.map +1 -0
  10. package/dist/dts/columns-tool-panel/columns-tool-panel.utils.d.ts +48 -0
  11. package/dist/dts/columns-tool-panel/columns-tool-panel.utils.d.ts.map +1 -0
  12. package/dist/dts/columns-tool-panel/grid-pro-column-drag-bridge.d.ts +39 -0
  13. package/dist/dts/columns-tool-panel/grid-pro-column-drag-bridge.d.ts.map +1 -0
  14. package/dist/dts/columns-tool-panel/index.d.ts +5 -0
  15. package/dist/dts/columns-tool-panel/index.d.ts.map +1 -0
  16. package/dist/dts/grid-pro-beta.d.ts +28 -3
  17. package/dist/dts/grid-pro-beta.d.ts.map +1 -1
  18. package/dist/dts/grid-pro.styles.d.ts.map +1 -1
  19. package/dist/dts/grid-pro.template.d.ts.map +1 -1
  20. package/dist/dts/grid-pro.types.d.ts +10 -0
  21. package/dist/dts/grid-pro.types.d.ts.map +1 -1
  22. package/dist/dts/index.d.ts +2 -0
  23. package/dist/dts/index.d.ts.map +1 -1
  24. package/dist/dts/react.d.ts +29 -9
  25. package/dist/dts/side-bar/index.d.ts +6 -0
  26. package/dist/dts/side-bar/index.d.ts.map +1 -0
  27. package/dist/dts/side-bar/side-bar.d.ts +417 -0
  28. package/dist/dts/side-bar/side-bar.d.ts.map +1 -0
  29. package/dist/dts/side-bar/side-bar.styles.d.ts +19 -0
  30. package/dist/dts/side-bar/side-bar.styles.d.ts.map +1 -0
  31. package/dist/dts/side-bar/side-bar.template.d.ts +11 -0
  32. package/dist/dts/side-bar/side-bar.template.d.ts.map +1 -0
  33. package/dist/dts/side-bar/side-bar.tools.d.ts +12 -0
  34. package/dist/dts/side-bar/side-bar.tools.d.ts.map +1 -0
  35. package/dist/dts/side-bar/side-bar.types.d.ts +77 -0
  36. package/dist/dts/side-bar/side-bar.types.d.ts.map +1 -0
  37. package/dist/esm/columns-tool-panel/columns-tool-panel-ag-drag.js +50 -0
  38. package/dist/esm/columns-tool-panel/columns-tool-panel.js +500 -0
  39. package/dist/esm/columns-tool-panel/columns-tool-panel.styles.js +180 -0
  40. package/dist/esm/columns-tool-panel/columns-tool-panel.template.js +70 -0
  41. package/dist/esm/columns-tool-panel/columns-tool-panel.utils.js +185 -0
  42. package/dist/esm/columns-tool-panel/grid-pro-column-drag-bridge.js +57 -0
  43. package/dist/esm/columns-tool-panel/index.js +4 -0
  44. package/dist/esm/grid-pro-beta.js +93 -3
  45. package/dist/esm/grid-pro.styles.js +4 -0
  46. package/dist/esm/grid-pro.template.js +19 -2
  47. package/dist/esm/grid-pro.types.js +11 -0
  48. package/dist/esm/index.js +2 -0
  49. package/dist/esm/side-bar/index.js +5 -0
  50. package/dist/esm/side-bar/side-bar.js +188 -0
  51. package/dist/esm/side-bar/side-bar.styles.js +155 -0
  52. package/dist/esm/side-bar/side-bar.template.js +48 -0
  53. package/dist/esm/side-bar/side-bar.tools.js +19 -0
  54. package/dist/esm/side-bar/side-bar.types.js +45 -0
  55. package/dist/grid-pro.api.json +10626 -7663
  56. package/dist/grid-pro.d.ts +968 -153
  57. package/dist/react.cjs +20 -6
  58. package/dist/react.mjs +17 -5
  59. package/package.json +14 -14
@@ -0,0 +1,500 @@
1
+ import { __decorate } from "tslib";
2
+ import { DOM, attr, customElement, observable } from '@microsoft/fast-element';
3
+ import { FoundationElement } from '@microsoft/fast-foundation';
4
+ import { bindAgColumnPickerDrag, } from './columns-tool-panel-ag-drag';
5
+ import { columnsToolPanelStyles as styles } from './columns-tool-panel.styles';
6
+ import { columnsToolPanelTemplate } from './columns-tool-panel.template';
7
+ import { applyVisibleOrder, getPickerItems, GRID_PRO_COLUMNS_TOOL_PANEL_SORT_DEFAULT, orderColumnsForPicker, partitionPickerItems, reorderVisibleIds, resolveColumnsToolPanelSort, } from './columns-tool-panel.utils';
8
+ import { resolveColumnDragBridgeDirect, resolveColumnDragBridgeFromApi, } from './grid-pro-column-drag-bridge';
9
+ /** Max animation-frame retries while waiting for AG column-drag bridge beans. */
10
+ const DRAG_BRIDGE_RETRY_MAX_ATTEMPTS = 30;
11
+ /**
12
+ * Custom columns tool panel. Replaces AG Grid Enterprise `agColumnsToolPanel`.
13
+ *
14
+ * @public
15
+ * @remarks
16
+ * Registered as `gridProColumnsToolPanel` (`GridProToolPanelTypes.columns`).
17
+ * `resolveGridProSideBar` rewrites `sideBar: ['columns']` / `agColumnsToolPanel` to this
18
+ * component when using AG's Enterprise `SideBarModule`.
19
+ *
20
+ * Prefer mounting via `with-side-bar` on {@link GridProBeta} for a Community-only UI
21
+ * that does not register any AG Enterprise modules.
22
+ *
23
+ * Layout: select-all + search → column list. Ordering via `toolPanelParams.sort`
24
+ * (`selected-first` default, or `ag-grid`). Checkboxes toggle visibility via
25
+ * `api.setColumnsVisible`; drag handles on hidden rows use AG native DnD onto the grid
26
+ * (`allowDragFromColumnsToolPanel`); visible rows reorder inside the picker via HTML5 drag.
27
+ *
28
+ * HTML Element: \<grid-pro-columns-tool-panel\>
29
+ */
30
+ let ColumnsToolPanel = class ColumnsToolPanel extends FoundationElement {
31
+ constructor() {
32
+ super(...arguments);
33
+ this.prefix = 'foundation';
34
+ /** From `toolPanelParams.sort`; default `selected-first`. */
35
+ this.sort = GRID_PRO_COLUMNS_TOOL_PANEL_SORT_DEFAULT;
36
+ /** Source colId while a visible-row drag is in progress. */
37
+ this.dragColId = null;
38
+ /** Row currently showing drag-over highlight (avoid observable updates mid-drag). */
39
+ this.dragOverElement = null;
40
+ /** Cancels row drag listeners when the selected list re-renders. */
41
+ this.dragBindingAbort = null;
42
+ /** AG ToolPanel drag sources registered on hidden-row handles (grid drop). */
43
+ this.agDragBindings = [];
44
+ /** Shared DnD bridge from Grid Pro (`toolPanelParams` / context). */
45
+ this.columnDragBridge = null;
46
+ /** Retries `bindRowDrag` until the DnD bridge is populated. */
47
+ this.dragBridgeRetryId = 0;
48
+ /** Optimistic visibility while the grid applies setColumnsVisible. */
49
+ this.pendingVisibility = new Map();
50
+ this.search = '';
51
+ this.selectedItems = [];
52
+ this.unselectedItems = [];
53
+ /** Master checkbox checked when every toggleable column is visible. */
54
+ this.selectAllChecked = false;
55
+ /** Master checkbox mixed when some (but not all) toggleable columns are visible. */
56
+ this.selectAllIndeterminate = false;
57
+ /** Stable listener refs so `destroy` can remove the same functions `init` added. */
58
+ this.boundRefresh = () => this.refresh();
59
+ }
60
+ /** Drag reorder / grid drop disabled while search filter is active. */
61
+ get canDrag() {
62
+ return !this.search.trim();
63
+ }
64
+ /** Handle is draggable onto the grid (hidden columns, or all when using ag-grid sort). */
65
+ canDragToGrid(item) {
66
+ if (!this.canDrag || item.lockVisible) {
67
+ return false;
68
+ }
69
+ if (this.sort === 'ag-grid') {
70
+ return true;
71
+ }
72
+ return !item.visible;
73
+ }
74
+ /** Columns in the current (search-filtered) picker lists that can be toggled. */
75
+ get toggleableItems() {
76
+ return [...this.selectedItems, ...this.unselectedItems].filter((item) => !item.lockVisible);
77
+ }
78
+ connectedCallback() {
79
+ var _a;
80
+ super.connectedCallback();
81
+ const sideBarPrefix = (_a = this.closest('grid-pro-side-bar')) === null || _a === void 0 ? void 0 : _a.getAttribute('prefix');
82
+ if (sideBarPrefix && sideBarPrefix !== this.prefix) {
83
+ this.prefix = sideBarPrefix;
84
+ }
85
+ this.classList.add('grid-pro-columns-tool-panel');
86
+ this.setAttribute('data-test-id', 'grid-pro-columns-tool-panel');
87
+ this.refresh();
88
+ }
89
+ /**
90
+ * AG Grid `IToolPanelComp` entry. Subscribes to column events so the picker
91
+ * stays in sync with header menu / API visibility changes.
92
+ */
93
+ init(params) {
94
+ var _a;
95
+ this.params = params;
96
+ this.api = params.api;
97
+ this.sort = resolveColumnsToolPanelSort(params.sort);
98
+ this.columnDragBridge = (_a = params.columnDragBridge) !== null && _a !== void 0 ? _a : null;
99
+ this.api.addEventListener('columnVisible', this.boundRefresh);
100
+ this.api.addEventListener('columnMoved', this.boundRefresh);
101
+ this.api.addEventListener('newColumnsLoaded', this.boundRefresh);
102
+ this.api.addEventListener('displayedColumnsChanged', this.boundRefresh);
103
+ this.refresh();
104
+ }
105
+ /**
106
+ * Rebuilds picker lists from current grid column state.
107
+ * Ordering follows `toolPanelParams.sort` (`selected-first` | `ag-grid`).
108
+ */
109
+ refresh(params) {
110
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
111
+ if ((params === null || params === void 0 ? void 0 : params.sort) != null) {
112
+ this.sort = resolveColumnsToolPanelSort(params.sort);
113
+ }
114
+ if ((params === null || params === void 0 ? void 0 : params.columnDragBridge) != null) {
115
+ this.columnDragBridge = params.columnDragBridge;
116
+ }
117
+ if (!this.api) {
118
+ return;
119
+ }
120
+ const activeElement = document.activeElement;
121
+ const activeTestId = activeElement && this.contains(activeElement)
122
+ ? activeElement.getAttribute('data-test-id')
123
+ : null;
124
+ const displayed = (_c = (_b = (_a = this.api).getAllDisplayedColumns) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : [];
125
+ const all = (_f = (_e = (_d = this.api).getColumns) === null || _e === void 0 ? void 0 : _e.call(_d)) !== null && _f !== void 0 ? _f : [];
126
+ const columnState = (_j = (_h = (_g = this.api).getColumnState) === null || _h === void 0 ? void 0 : _h.call(_g)) !== null && _j !== void 0 ? _j : [];
127
+ const ordered = orderColumnsForPicker(displayed, all, this.sort, columnState);
128
+ const items = this.applyPendingVisibility(getPickerItems(ordered));
129
+ const { selected, unselected } = partitionPickerItems(items, this.search, this.sort);
130
+ this.selectedItems = selected;
131
+ this.unselectedItems = unselected;
132
+ this.syncSelectAllState();
133
+ if (activeTestId) {
134
+ DOM.queueUpdate(() => {
135
+ var _a;
136
+ (_a = this.querySelector(`[data-test-id="${activeTestId}"]`)) === null || _a === void 0 ? void 0 : _a.focus();
137
+ });
138
+ }
139
+ DOM.queueUpdate(() => {
140
+ this.syncAgHeaderHeightVar();
141
+ this.applySelectAllCheckboxState();
142
+ this.bindRowDrag();
143
+ });
144
+ }
145
+ /**
146
+ * AG Columns uses `height: var(--ag-header-height)` on `.ag-column-select-header` /
147
+ * `.ag-pivot-mode-panel`. That var lives on the grid root (sibling of our side bar),
148
+ * so copy it onto this panel for the same alignment without measuring DOM height.
149
+ */
150
+ syncAgHeaderHeightVar() {
151
+ var _a, _b;
152
+ const gridHost = this.closest('rapid-grid-pro, zero-grid-pro, foundation-grid-pro, grid-pro');
153
+ const root = (_b = (_a = gridHost === null || gridHost === void 0 ? void 0 : gridHost.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('[part="grid"] .ag-root-wrapper, [part="grid"] .ag-root, [part="grid"]')) !== null && _b !== void 0 ? _b : null;
154
+ if (!root) {
155
+ return;
156
+ }
157
+ const style = getComputedStyle(root);
158
+ for (const name of [
159
+ '--ag-header-height',
160
+ '--ag-grid-size',
161
+ '--ag-widget-container-horizontal-padding',
162
+ ]) {
163
+ const value = style.getPropertyValue(name).trim();
164
+ if (value) {
165
+ this.style.setProperty(name, value);
166
+ }
167
+ }
168
+ }
169
+ syncSelectAllState() {
170
+ const items = this.toggleableItems;
171
+ const visibleCount = items.filter((item) => item.visible).length;
172
+ this.selectAllChecked = items.length > 0 && visibleCount === items.length;
173
+ this.selectAllIndeterminate = visibleCount > 0 && visibleCount < items.length;
174
+ }
175
+ /**
176
+ * FAST checkbox `indeterminate` is an observable property (not a boolean attr), and its
177
+ * click handler clears it — re-apply after render so mixed state stays visible.
178
+ */
179
+ applySelectAllCheckboxState() {
180
+ const selectAll = this.querySelector('[data-test-id="grid-pro-columns-select-all"]');
181
+ if (!selectAll) {
182
+ return;
183
+ }
184
+ selectAll.checked = this.selectAllChecked;
185
+ selectAll.indeterminate = this.selectAllIndeterminate;
186
+ selectAll.setAttribute('aria-checked', this.selectAllIndeterminate ? 'mixed' : this.selectAllChecked ? 'true' : 'false');
187
+ }
188
+ applyPendingVisibility(items) {
189
+ if (!this.pendingVisibility.size) {
190
+ return items;
191
+ }
192
+ return items.map((item) => {
193
+ const pending = this.pendingVisibility.get(item.colId);
194
+ if (pending === undefined) {
195
+ return item;
196
+ }
197
+ if (item.visible === pending) {
198
+ this.pendingVisibility.delete(item.colId);
199
+ }
200
+ return Object.assign(Object.assign({}, item), { visible: pending });
201
+ });
202
+ }
203
+ resolveDragBridge() {
204
+ var _a;
205
+ return ((_a = resolveColumnDragBridgeDirect(this.columnDragBridge)) !== null && _a !== void 0 ? _a : resolveColumnDragBridgeFromApi(this.api));
206
+ }
207
+ /**
208
+ * Visible rows: HTML5 reorder inside the picker.
209
+ * Hidden rows (or all rows when `sort=ag-grid`): AG ToolPanel drag onto the grid header.
210
+ */
211
+ bindRowDrag() {
212
+ var _a;
213
+ (_a = this.dragBindingAbort) === null || _a === void 0 ? void 0 : _a.abort();
214
+ this.dragBindingAbort = null;
215
+ for (const binding of this.agDragBindings) {
216
+ binding.remove();
217
+ }
218
+ this.agDragBindings = [];
219
+ if (!this.canDrag || !this.api) {
220
+ return;
221
+ }
222
+ const bridge = this.resolveDragBridge();
223
+ const rows = this.querySelectorAll('.grid-pro-columns-item');
224
+ if (!rows.length) {
225
+ return;
226
+ }
227
+ const abort = new AbortController();
228
+ this.dragBindingAbort = abort;
229
+ const { signal } = abort;
230
+ let needsBridgeRetry = false;
231
+ let boundGridDrag = false;
232
+ rows.forEach((row) => {
233
+ const colId = row.dataset.colId;
234
+ const handle = row.querySelector('.grid-pro-columns-handle');
235
+ if (!colId || !handle) {
236
+ return;
237
+ }
238
+ handle.classList.remove('grid-pro-columns-handle--grid-drag', 'grid-pro-columns-handle--panel-drag');
239
+ handle.removeAttribute('draggable');
240
+ const item = [...this.selectedItems, ...this.unselectedItems].find((i) => i.colId === colId);
241
+ if (!item) {
242
+ return;
243
+ }
244
+ const dragToGrid = this.canDragToGrid(item);
245
+ const reorderInPanel = this.sort === 'selected-first' &&
246
+ item.visible &&
247
+ !row.classList.contains('grid-pro-columns-item--unselected');
248
+ if (dragToGrid) {
249
+ if (bridge) {
250
+ const binding = bindAgColumnPickerDrag(bridge, this.api, handle, colId, item.headerName);
251
+ if (binding) {
252
+ boundGridDrag = true;
253
+ this.agDragBindings.push(binding);
254
+ handle.classList.add('grid-pro-columns-handle--grid-drag');
255
+ if (!reorderInPanel) {
256
+ return;
257
+ }
258
+ }
259
+ }
260
+ else {
261
+ needsBridgeRetry = true;
262
+ }
263
+ }
264
+ if (!reorderInPanel) {
265
+ return;
266
+ }
267
+ handle.draggable = true;
268
+ handle.classList.add('grid-pro-columns-handle--panel-drag');
269
+ handle.addEventListener('dragstart', (event) => {
270
+ this.onDragStart(event, colId, row);
271
+ }, { signal });
272
+ handle.addEventListener('dragend', () => this.onDragEnd(), { signal });
273
+ row.addEventListener('dragover', (event) => {
274
+ this.onDragOver(event, row);
275
+ }, { signal });
276
+ row.addEventListener('dragleave', (event) => {
277
+ this.onDragLeave(event, row);
278
+ }, { signal });
279
+ row.addEventListener('drop', (event) => {
280
+ this.onDrop(event, colId);
281
+ }, { signal });
282
+ });
283
+ if (needsBridgeRetry && !boundGridDrag) {
284
+ this.scheduleDragBridgeRetry();
285
+ }
286
+ }
287
+ scheduleDragBridgeRetry(attempt = 0) {
288
+ if (attempt > DRAG_BRIDGE_RETRY_MAX_ATTEMPTS || !this.api || !this.canDrag) {
289
+ return;
290
+ }
291
+ this.dragBridgeRetryId += 1;
292
+ const retryId = this.dragBridgeRetryId;
293
+ requestAnimationFrame(() => {
294
+ if (retryId !== this.dragBridgeRetryId || !this.isConnected) {
295
+ return;
296
+ }
297
+ if (this.resolveDragBridge()) {
298
+ this.bindRowDrag();
299
+ return;
300
+ }
301
+ this.scheduleDragBridgeRetry(attempt + 1);
302
+ });
303
+ }
304
+ /** Root element AG Grid mounts into the sidebar. */
305
+ getGui() {
306
+ return this;
307
+ }
308
+ destroy() {
309
+ var _a;
310
+ this.dragBridgeRetryId += 1;
311
+ (_a = this.dragBindingAbort) === null || _a === void 0 ? void 0 : _a.abort();
312
+ this.dragBindingAbort = null;
313
+ for (const binding of this.agDragBindings) {
314
+ binding.remove();
315
+ }
316
+ this.agDragBindings = [];
317
+ this.pendingVisibility.clear();
318
+ if (this.api) {
319
+ this.api.removeEventListener('columnVisible', this.boundRefresh);
320
+ this.api.removeEventListener('columnMoved', this.boundRefresh);
321
+ this.api.removeEventListener('newColumnsLoaded', this.boundRefresh);
322
+ this.api.removeEventListener('displayedColumnsChanged', this.boundRefresh);
323
+ }
324
+ this.api = null;
325
+ }
326
+ /**
327
+ * @internal
328
+ */
329
+ onSearchInput(value) {
330
+ this.search = value;
331
+ this.refresh();
332
+ }
333
+ /**
334
+ * @internal
335
+ */
336
+ onSelectAllClick(event) {
337
+ event.preventDefault();
338
+ event.stopImmediatePropagation();
339
+ if (!this.api) {
340
+ return;
341
+ }
342
+ const items = this.toggleableItems;
343
+ if (!items.length) {
344
+ return;
345
+ }
346
+ const makeVisible = !this.selectAllChecked;
347
+ const ids = items.filter((item) => item.visible !== makeVisible).map((item) => item.colId);
348
+ if (!ids.length) {
349
+ return;
350
+ }
351
+ for (const id of ids) {
352
+ this.pendingVisibility.set(id, makeVisible);
353
+ }
354
+ this.api.setColumnsVisible(ids, makeVisible);
355
+ this.refresh();
356
+ }
357
+ /**
358
+ * @internal
359
+ */
360
+ onCheckboxClick(item, event) {
361
+ event.preventDefault();
362
+ event.stopPropagation();
363
+ this.onVisibilityChange(item, !item.visible);
364
+ }
365
+ /**
366
+ * @internal
367
+ */
368
+ onVisibilityChange(item, visible) {
369
+ if (item.lockVisible || !this.api || item.visible === visible) {
370
+ return;
371
+ }
372
+ this.pendingVisibility.set(item.colId, visible);
373
+ this.api.setColumnsVisible([item.colId], visible);
374
+ this.refresh();
375
+ }
376
+ /**
377
+ * @internal
378
+ */
379
+ onDragStart(event, colId, row) {
380
+ if (!this.canDrag) {
381
+ event.preventDefault();
382
+ return;
383
+ }
384
+ this.dragColId = colId;
385
+ if (event.dataTransfer) {
386
+ event.dataTransfer.setData('text/plain', colId);
387
+ event.dataTransfer.effectAllowed = 'move';
388
+ }
389
+ (row !== null && row !== void 0 ? row : event.currentTarget).classList.add('dragging');
390
+ }
391
+ /**
392
+ * @internal
393
+ */
394
+ onDragEnd() {
395
+ this.dragColId = null;
396
+ this.clearDragOverHighlight();
397
+ this.querySelectorAll('.grid-pro-columns-item.dragging').forEach((row) => {
398
+ row.classList.remove('dragging');
399
+ });
400
+ }
401
+ /**
402
+ * @internal
403
+ */
404
+ onDragOver(event, row) {
405
+ var _a;
406
+ if (!this.canDrag) {
407
+ return;
408
+ }
409
+ event.preventDefault();
410
+ if (event.dataTransfer) {
411
+ event.dataTransfer.dropEffect = 'move';
412
+ }
413
+ if (this.dragOverElement !== row) {
414
+ (_a = this.dragOverElement) === null || _a === void 0 ? void 0 : _a.classList.remove('drag-over');
415
+ this.dragOverElement = row;
416
+ row.classList.add('drag-over');
417
+ }
418
+ }
419
+ /**
420
+ * @internal
421
+ */
422
+ onDragLeave(event, row) {
423
+ if (this.dragOverElement === row && !row.contains(event.relatedTarget)) {
424
+ row.classList.remove('drag-over');
425
+ this.dragOverElement = null;
426
+ }
427
+ }
428
+ /**
429
+ * @internal
430
+ */
431
+ onDrop(event, colId) {
432
+ var _a;
433
+ event.preventDefault();
434
+ this.clearDragOverHighlight();
435
+ const fromId = this.dragColId || ((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData('text/plain'));
436
+ if (fromId) {
437
+ this.reorderSelected(fromId, colId);
438
+ }
439
+ }
440
+ clearDragOverHighlight() {
441
+ var _a;
442
+ (_a = this.dragOverElement) === null || _a === void 0 ? void 0 : _a.classList.remove('drag-over');
443
+ this.dragOverElement = null;
444
+ }
445
+ /**
446
+ * Applies a new visible-column order via `applyColumnState({ applyOrder: true })`.
447
+ * Hidden columns keep their relative positions; only the visible slice is permuted.
448
+ */
449
+ reorderSelected(fromId, toId) {
450
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
451
+ if (!this.api || !this.api.getColumnState || !this.api.applyColumnState) {
452
+ return;
453
+ }
454
+ const displayed = (_c = (_b = (_a = this.api).getAllDisplayedColumns) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : [];
455
+ const all = (_f = (_e = (_d = this.api).getColumns) === null || _e === void 0 ? void 0 : _e.call(_d)) !== null && _f !== void 0 ? _f : [];
456
+ const columnState = (_j = (_h = (_g = this.api).getColumnState) === null || _h === void 0 ? void 0 : _h.call(_g)) !== null && _j !== void 0 ? _j : [];
457
+ const ordered = orderColumnsForPicker(displayed, all, this.sort, columnState);
458
+ const items = getPickerItems(ordered);
459
+ const allVisibleIds = items.filter((item) => item.visible).map((item) => item.colId);
460
+ const { selected } = partitionPickerItems(items, this.search, this.sort);
461
+ const shownIds = this.sort === 'selected-first'
462
+ ? selected.map((item) => item.colId)
463
+ : selected.filter((item) => item.visible).map((item) => item.colId);
464
+ const nextOrder = reorderVisibleIds(allVisibleIds, shownIds, fromId, toId);
465
+ if (!nextOrder) {
466
+ return;
467
+ }
468
+ this.api.applyColumnState({
469
+ state: applyVisibleOrder(columnState, nextOrder),
470
+ applyOrder: true,
471
+ });
472
+ }
473
+ };
474
+ __decorate([
475
+ attr
476
+ ], ColumnsToolPanel.prototype, "prefix", void 0);
477
+ __decorate([
478
+ observable
479
+ ], ColumnsToolPanel.prototype, "search", void 0);
480
+ __decorate([
481
+ observable
482
+ ], ColumnsToolPanel.prototype, "selectedItems", void 0);
483
+ __decorate([
484
+ observable
485
+ ], ColumnsToolPanel.prototype, "unselectedItems", void 0);
486
+ __decorate([
487
+ observable
488
+ ], ColumnsToolPanel.prototype, "selectAllChecked", void 0);
489
+ __decorate([
490
+ observable
491
+ ], ColumnsToolPanel.prototype, "selectAllIndeterminate", void 0);
492
+ ColumnsToolPanel = __decorate([
493
+ customElement({
494
+ name: 'grid-pro-columns-tool-panel',
495
+ template: columnsToolPanelTemplate,
496
+ styles,
497
+ shadowOptions: null,
498
+ })
499
+ ], ColumnsToolPanel);
500
+ export { ColumnsToolPanel };
@@ -0,0 +1,180 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ /**
3
+ * Styles for {@link ColumnsToolPanel}.
4
+ * Class selectors only — the element has no shadow root so styles land on the
5
+ * parent root (Grid Pro shadow / document); `:host` would target the wrong node.
6
+ * @public
7
+ */
8
+ export const columnsToolPanelStyles = css `
9
+ .grid-pro-columns-tool-panel,
10
+ .grid-pro-columns-tool-panel *,
11
+ .grid-pro-columns-tool-panel *::before,
12
+ .grid-pro-columns-tool-panel *::after {
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ .grid-pro-columns-tool-panel {
17
+ display: flex;
18
+ flex-grow: 1;
19
+ flex-direction: column;
20
+ height: 100%;
21
+ min-width: 200px;
22
+ padding: 0;
23
+ color: var(--ag-foreground-color, var(--neutral-foreground-rest));
24
+ background: var(--ag-control-panel-background-color, var(--neutral-layer-2));
25
+ font-family: var(--ag-font-family, var(--body-font));
26
+ font-size: var(--ag-data-font-size, var(--type-ramp-minus-1-font-size));
27
+ }
28
+
29
+ .grid-pro-columns-toolbar {
30
+ display: flex;
31
+ align-items: center;
32
+ gap: 8px;
33
+ flex: none;
34
+ width: 100%;
35
+ height: var(--ag-header-height, calc(var(--ag-grid-size, 4px) * 8));
36
+ min-height: var(--ag-header-height, calc(var(--ag-grid-size, 4px) * 8));
37
+ margin: 0;
38
+ padding: 0 var(--ag-widget-container-horizontal-padding, 8px);
39
+ border-bottom: var(--ag-borders-secondary, 1px solid)
40
+ var(--ag-secondary-border-color, var(--ag-border-color, var(--neutral-stroke-divider-rest)));
41
+ }
42
+
43
+ .grid-pro-columns-toolbar .grid-pro-columns-search {
44
+ flex: 1 1 auto;
45
+ min-width: 0;
46
+ width: auto;
47
+ display: block;
48
+
49
+ --design-unit: 3;
50
+ }
51
+
52
+ .grid-pro-columns-toolbar > .grid-pro-columns-search {
53
+ flex: 1 1 auto !important;
54
+ height: auto !important;
55
+ min-height: 0 !important;
56
+ }
57
+
58
+ .grid-pro-columns-select-all {
59
+ flex: 0 0 auto;
60
+ margin: 0;
61
+
62
+ --design-unit: 3;
63
+ }
64
+
65
+ /* Prototype: gray fill + white dash (FAST default is accent + square blob). */
66
+ .grid-pro-columns-select-all.indeterminate::part(control),
67
+ .grid-pro-columns-select-all[aria-checked='mixed']::part(control) {
68
+ background: var(--neutral-fill-strong-rest, var(--neutral-stroke-rest, #9aa0a6));
69
+ border-color: var(--neutral-fill-strong-rest, var(--neutral-stroke-rest, #9aa0a6));
70
+ }
71
+
72
+ .grid-pro-columns-select-all.indeterminate:not([disabled]):hover::part(control),
73
+ .grid-pro-columns-select-all[aria-checked='mixed']:not([disabled]):hover::part(control) {
74
+ background: var(--neutral-fill-strong-hover, var(--neutral-stroke-hover, #7d848c));
75
+ border-color: var(--neutral-fill-strong-hover, var(--neutral-stroke-hover, #7d848c));
76
+ }
77
+
78
+ .grid-pro-columns-select-all.indeterminate::part(checked-indicator),
79
+ .grid-pro-columns-select-all[aria-checked='mixed']::part(checked-indicator) {
80
+ opacity: 0%;
81
+ }
82
+
83
+ .grid-pro-columns-select-all.indeterminate::part(indeterminate-indicator),
84
+ .grid-pro-columns-select-all[aria-checked='mixed']::part(indeterminate-indicator) {
85
+ width: 10px;
86
+ height: 2px;
87
+ border-radius: 1px;
88
+ background: var(--neutral-fill-input-rest, #fff);
89
+ opacity: 100%;
90
+ }
91
+
92
+ .grid-pro-columns-select-all.indeterminate:not([disabled]):hover::part(indeterminate-indicator),
93
+ .grid-pro-columns-select-all[aria-checked='mixed']:not([disabled]):hover::part(
94
+ indeterminate-indicator
95
+ ) {
96
+ background: var(--neutral-fill-input-rest, #fff);
97
+ }
98
+
99
+ .grid-pro-columns-list {
100
+ display: flex;
101
+ flex-direction: column;
102
+ gap: 2px;
103
+ flex: 1 1 0;
104
+ min-height: 0;
105
+ overflow: auto;
106
+ padding: 8px;
107
+ }
108
+
109
+ .grid-pro-columns-section {
110
+ display: flex;
111
+ flex-direction: column;
112
+ gap: 2px;
113
+ flex: 0 0 auto;
114
+ }
115
+
116
+ .grid-pro-columns-item {
117
+ display: flex;
118
+ align-items: center;
119
+ gap: 6px;
120
+ padding: 2px 0;
121
+ border-radius: 4px;
122
+ cursor: default;
123
+ user-select: none;
124
+ }
125
+
126
+ .grid-pro-columns-item.dragging {
127
+ opacity: 50%;
128
+ }
129
+
130
+ .grid-pro-columns-item.drag-over {
131
+ background: var(--ag-row-hover-color, var(--neutral-fill-hover));
132
+ }
133
+
134
+ .grid-pro-columns-handle {
135
+ flex: 0 0 auto;
136
+ display: inline-flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ min-width: 20px;
140
+ min-height: 24px;
141
+ margin: -4px 0;
142
+ padding: 4px 6px;
143
+ box-sizing: border-box;
144
+ opacity: 45%;
145
+ letter-spacing: -1px;
146
+ font-size: 12px;
147
+ line-height: 1;
148
+ touch-action: none;
149
+ }
150
+
151
+ .grid-pro-columns-handle[draggable='true'],
152
+ .grid-pro-columns-handle.grid-pro-columns-handle--grid-drag,
153
+ .grid-pro-columns-handle.grid-pro-columns-handle--panel-drag {
154
+ cursor: grab;
155
+ opacity: 65%;
156
+ }
157
+
158
+ .grid-pro-columns-handle[draggable='true']:active,
159
+ .grid-pro-columns-handle.grid-pro-columns-handle--grid-drag:active,
160
+ .grid-pro-columns-handle.grid-pro-columns-handle--panel-drag:active {
161
+ cursor: grabbing;
162
+ }
163
+
164
+ .grid-pro-columns-checkbox {
165
+ flex: 0 0 auto;
166
+ margin: 0;
167
+
168
+ --design-unit: 3;
169
+ }
170
+
171
+ .grid-pro-columns-checkbox[aria-checked='true']:not([disabled]):hover::part(checked-indicator) {
172
+ fill: var(--foreground-on-accent-hover);
173
+ }
174
+
175
+ .grid-pro-columns-label {
176
+ overflow: hidden;
177
+ text-overflow: ellipsis;
178
+ white-space: nowrap;
179
+ }
180
+ `;