@toolbox-web/grid 3.9.2 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/all.js +1 -1
  2. package/all.js.map +1 -1
  3. package/index.js +1 -1
  4. package/index.js.map +1 -1
  5. package/lib/core/types.d.ts +6 -3
  6. package/lib/features/clipboard.js.map +1 -1
  7. package/lib/features/column-virtualization.js.map +1 -1
  8. package/lib/features/context-menu.js.map +1 -1
  9. package/lib/features/editing.js.map +1 -1
  10. package/lib/features/export.js.map +1 -1
  11. package/lib/features/filtering.js.map +1 -1
  12. package/lib/features/grouping-columns.js.map +1 -1
  13. package/lib/features/grouping-rows.js.map +1 -1
  14. package/lib/features/master-detail.js.map +1 -1
  15. package/lib/features/multi-sort.js.map +1 -1
  16. package/lib/features/pinned-columns.js.map +1 -1
  17. package/lib/features/pinned-rows.js.map +1 -1
  18. package/lib/features/pivot.js.map +1 -1
  19. package/lib/features/print.js.map +1 -1
  20. package/lib/features/registry.js +1 -1
  21. package/lib/features/registry.js.map +1 -1
  22. package/lib/features/reorder-columns.js.map +1 -1
  23. package/lib/features/responsive.js.map +1 -1
  24. package/lib/features/row-drag-drop.js.map +1 -1
  25. package/lib/features/selection.js.map +1 -1
  26. package/lib/features/server-side.js.map +1 -1
  27. package/lib/features/shell.js.map +1 -1
  28. package/lib/features/sticky-rows.js.map +1 -1
  29. package/lib/features/tooltip.js.map +1 -1
  30. package/lib/features/tree.js.map +1 -1
  31. package/lib/features/undo-redo.js.map +1 -1
  32. package/lib/features/visibility.js.map +1 -1
  33. package/lib/plugins/clipboard/index.js.map +1 -1
  34. package/lib/plugins/column-virtualization/index.js.map +1 -1
  35. package/lib/plugins/context-menu/index.js.map +1 -1
  36. package/lib/plugins/editing/editors.d.ts +15 -0
  37. package/lib/plugins/editing/index.js +1 -1
  38. package/lib/plugins/editing/index.js.map +1 -1
  39. package/lib/plugins/editing/types.d.ts +5 -1
  40. package/lib/plugins/export/index.js +1 -1
  41. package/lib/plugins/export/index.js.map +1 -1
  42. package/lib/plugins/filtering/filter-model.d.ts +20 -1
  43. package/lib/plugins/filtering/filter-panel-default.d.ts +15 -1
  44. package/lib/plugins/filtering/index.d.ts +1 -1
  45. package/lib/plugins/filtering/index.js +1 -1
  46. package/lib/plugins/filtering/index.js.map +1 -1
  47. package/lib/plugins/filtering/types.d.ts +58 -3
  48. package/lib/plugins/grouping-columns/index.js.map +1 -1
  49. package/lib/plugins/grouping-rows/index.js +1 -1
  50. package/lib/plugins/grouping-rows/index.js.map +1 -1
  51. package/lib/plugins/hierarchy/index.js.map +1 -1
  52. package/lib/plugins/master-detail/index.js +1 -1
  53. package/lib/plugins/master-detail/index.js.map +1 -1
  54. package/lib/plugins/multi-sort/index.js.map +1 -1
  55. package/lib/plugins/pinned-columns/index.js.map +1 -1
  56. package/lib/plugins/pinned-rows/index.js.map +1 -1
  57. package/lib/plugins/pivot/index.js +1 -1
  58. package/lib/plugins/pivot/index.js.map +1 -1
  59. package/lib/plugins/pivot/pivot-plugin.d.ts +2 -0
  60. package/lib/plugins/pivot/types.d.ts +2 -0
  61. package/lib/plugins/print/index.js.map +1 -1
  62. package/lib/plugins/reorder-columns/index.js.map +1 -1
  63. package/lib/plugins/responsive/index.js.map +1 -1
  64. package/lib/plugins/row-drag-drop/index.js.map +1 -1
  65. package/lib/plugins/selection/index.js +1 -1
  66. package/lib/plugins/selection/index.js.map +1 -1
  67. package/lib/plugins/server-side/index.js.map +1 -1
  68. package/lib/plugins/shared/form-field-target.d.ts +10 -0
  69. package/lib/plugins/shared/format-value.d.ts +12 -0
  70. package/lib/plugins/shell/index.js.map +1 -1
  71. package/lib/plugins/sticky-rows/index.js.map +1 -1
  72. package/lib/plugins/tooltip/index.js.map +1 -1
  73. package/lib/plugins/tree/index.js +1 -1
  74. package/lib/plugins/tree/index.js.map +1 -1
  75. package/lib/plugins/undo-redo/index.js.map +1 -1
  76. package/lib/plugins/visibility/index.js.map +1 -1
  77. package/package.json +1 -1
  78. package/umd/grid.all.umd.js +1 -1
  79. package/umd/grid.all.umd.js.map +1 -1
  80. package/umd/grid.umd.js +1 -1
  81. package/umd/grid.umd.js.map +1 -1
  82. package/umd/plugins/clipboard.umd.js.map +1 -1
  83. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  84. package/umd/plugins/context-menu.umd.js.map +1 -1
  85. package/umd/plugins/editing.umd.js +1 -1
  86. package/umd/plugins/editing.umd.js.map +1 -1
  87. package/umd/plugins/export.umd.js +1 -1
  88. package/umd/plugins/export.umd.js.map +1 -1
  89. package/umd/plugins/filtering.umd.js +1 -1
  90. package/umd/plugins/filtering.umd.js.map +1 -1
  91. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  92. package/umd/plugins/grouping-rows.umd.js +1 -1
  93. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  94. package/umd/plugins/hierarchy.umd.js.map +1 -1
  95. package/umd/plugins/master-detail.umd.js +1 -1
  96. package/umd/plugins/master-detail.umd.js.map +1 -1
  97. package/umd/plugins/multi-sort.umd.js.map +1 -1
  98. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  99. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  100. package/umd/plugins/pivot.umd.js +1 -1
  101. package/umd/plugins/pivot.umd.js.map +1 -1
  102. package/umd/plugins/print.umd.js.map +1 -1
  103. package/umd/plugins/reorder-columns.umd.js.map +1 -1
  104. package/umd/plugins/responsive.umd.js.map +1 -1
  105. package/umd/plugins/row-drag-drop.umd.js.map +1 -1
  106. package/umd/plugins/selection.umd.js +1 -1
  107. package/umd/plugins/selection.umd.js.map +1 -1
  108. package/umd/plugins/server-side.umd.js.map +1 -1
  109. package/umd/plugins/shell.umd.js.map +1 -1
  110. package/umd/plugins/sticky-rows.umd.js.map +1 -1
  111. package/umd/plugins/tooltip.umd.js.map +1 -1
  112. package/umd/plugins/tree.umd.js +1 -1
  113. package/umd/plugins/tree.umd.js.map +1 -1
  114. package/umd/plugins/undo-redo.umd.js.map +1 -1
  115. package/umd/plugins/visibility.umd.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../../libs/grid/src/lib/core/constants.ts","../../../../../../libs/grid/src/lib/plugins/shared/drag-alternative-menu.ts","../../../../../../libs/grid/src/lib/plugins/visibility/visibility.css?inline","../../../../../../libs/grid/src/lib/plugins/visibility/visibility-plugin.ts"],"sourcesContent":["/**\n * Grid DOM Constants\n *\n * Centralized constants for CSS classes, data attributes, and selectors\n * used throughout the grid. Use these instead of magic strings.\n *\n * Note: Some constants here are used by plugins but defined in core because:\n * 1. The core CSS needs to style these elements (e.g., sticky positioning)\n * 2. Multiple plugins may share the same class names\n *\n * Plugins can define their own additional constants and export them.\n * See each plugin's index.ts for plugin-specific exports.\n */\n\n/**\n * CSS selector for focusable editor elements within a cell.\n * Used by EditingPlugin, UndoRedoPlugin, and keyboard navigation. Defined here\n * (a leaf module) rather than in `rows.ts` so `keyboard.ts` can consume it\n * without creating a rows ↔ keyboard import cycle.\n */\nexport const FOCUSABLE_EDITOR_SELECTOR =\n 'input,select,textarea,[contenteditable=\"true\"],[contenteditable=\"\"],[tabindex]:not([tabindex=\"-1\"])';\n\n// #region CSS Classes\n\n/**\n * CSS class names used in the grid's DOM.\n * Use these when adding/removing classes or querying elements.\n *\n * Classes are organized by:\n * - Core: Used by the grid core for structure and basic functionality\n * - Shared: Used by multiple features/plugins, styled by core CSS\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport const GridClasses = {\n // ─── Core Structure ───────────────────────────────────────────────\n ROOT: 'tbw-grid-root',\n HEADER: 'header',\n HEADER_ROW: 'header-row',\n HEADER_CELL: 'header-cell',\n\n // Body structure\n ROWS_VIEWPORT: 'rows-viewport',\n ROWS_SPACER: 'rows-spacer',\n ROWS_CONTAINER: 'rows',\n\n // Row elements\n DATA_ROW: 'data-grid-row',\n GROUP_ROW: 'group-row',\n\n // Cell elements\n DATA_CELL: 'cell',\n\n // ─── Core States ──────────────────────────────────────────────────\n SELECTED: 'selected',\n FOCUSED: 'focused',\n EDITING: 'editing',\n EXPANDED: 'expanded',\n COLLAPSED: 'collapsed',\n DRAGGING: 'dragging',\n RESIZING: 'resizing',\n\n // Sorting (core feature)\n SORTABLE: 'sortable',\n SORTED_ASC: 'sorted-asc',\n SORTED_DESC: 'sorted-desc',\n\n // Visibility\n HIDDEN: 'hidden',\n\n // ─── Shared Classes (used by plugins, styled by core CSS) ────────\n // These are defined here because core CSS provides the base styling.\n // Plugins apply these classes; core CSS defines how they look.\n\n // Sticky positioning (PinnedColumnsPlugin applies, core CSS styles)\n STICKY_LEFT: 'sticky-left',\n STICKY_RIGHT: 'sticky-right',\n\n // Pinned rows (PinnedRowsPlugin applies, core CSS styles)\n PINNED_TOP: 'pinned-top',\n PINNED_BOTTOM: 'pinned-bottom',\n\n // Tree structure (TreePlugin applies, core CSS styles)\n TREE_TOGGLE: 'tree-toggle',\n TREE_INDENT: 'tree-indent',\n\n // Grouping (GroupingRowsPlugin applies, core CSS styles)\n GROUP_TOGGLE: 'group-toggle',\n GROUP_LABEL: 'group-label',\n GROUP_COUNT: 'group-count',\n\n // Selection (SelectionPlugin applies, core CSS styles)\n RANGE_SELECTION: 'range-selection',\n SELECTION_OVERLAY: 'selection-overlay',\n} as const;\n\n// #endregion\n\n// #region Data Attributes\n\n/**\n * Data attribute names used on grid elements.\n * Use these when getting/setting data attributes.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport const GridDataAttrs = {\n // ─── Core Attributes ──────────────────────────────────────────────\n FIELD: 'data-field',\n\n /**\n * Marks a `title` the grid itself put on a cell to reveal ellipsised text\n * (WCAG SC 1.4.12). Anything that sets its own `title` on a cell must clear\n * this, or the grid will later mistake that title for its own and replace it.\n *\n * @since 3.6.0\n */\n TRUNCATED: 'data-tbw-truncated',\n\n // ─── Shared Attributes (used by plugins) ──────────────────────────\n GROUP_KEY: 'data-group-key', // GroupingRowsPlugin\n} as const;\n\n// #endregion\n\n// #region Selectors\n\n/**\n * Common CSS selectors for querying grid elements.\n * Built from the class constants for consistency.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport const GridSelectors = {\n ROOT: `.${GridClasses.ROOT}`,\n HEADER: `.${GridClasses.HEADER}`,\n HEADER_ROW: `.${GridClasses.HEADER_ROW}`,\n HEADER_CELL: `.${GridClasses.HEADER_CELL}`,\n ROWS_VIEWPORT: `.${GridClasses.ROWS_VIEWPORT}`,\n ROWS_CONTAINER: `.${GridClasses.ROWS_CONTAINER}`,\n DATA_ROW: `.${GridClasses.DATA_ROW}`,\n DATA_CELL: `.${GridClasses.DATA_CELL}`,\n GROUP_ROW: `.${GridClasses.GROUP_ROW}`,\n\n // By data attribute\n CELL_BY_FIELD: (field: string) => `.${GridClasses.DATA_CELL}[${GridDataAttrs.FIELD}=\"${field}\"]`,\n\n // State selectors\n SELECTED_ROWS: `.${GridClasses.DATA_ROW}.${GridClasses.SELECTED}`,\n EDITING_CELL: `.${GridClasses.DATA_CELL}.${GridClasses.EDITING}`,\n} as const;\n\n// #endregion\n\n// #region CSS Custom Properties\n\n/**\n * CSS custom property names for theming.\n * Use these when programmatically setting styles.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport const GridCSSVars = {\n // Colors\n COLOR_BG: '--tbw-color-bg',\n COLOR_FG: '--tbw-color-fg',\n COLOR_FG_MUTED: '--tbw-color-fg-muted',\n COLOR_BORDER: '--tbw-color-border',\n COLOR_ACCENT: '--tbw-color-accent',\n COLOR_HEADER_BG: '--tbw-color-header-bg',\n COLOR_HEADER_FG: '--tbw-color-header-fg',\n COLOR_SELECTION: '--tbw-color-selection',\n COLOR_ROW_HOVER: '--tbw-color-row-hover',\n COLOR_ROW_ALT: '--tbw-color-row-alt',\n\n // Sizing\n ROW_HEIGHT: '--tbw-row-height',\n HEADER_HEIGHT: '--tbw-header-height',\n CELL_PADDING: '--tbw-cell-padding',\n\n // Typography\n FONT_FAMILY: '--tbw-font-family',\n FONT_SIZE: '--tbw-font-size',\n\n // Borders\n BORDER_RADIUS: '--tbw-border-radius',\n FOCUS_OUTLINE: '--tbw-focus-outline',\n} as const;\n\n// #endregion\n\n// Type helpers\n\n/**\n * Union of all CSS class names used in the grid's DOM.\n * Use `GridClasses` to access individual values by key.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport type GridClassName = (typeof GridClasses)[keyof typeof GridClasses];\n\n/**\n * Union of all `data-*` attribute names used on grid elements.\n * Use `GridDataAttrs` to access individual values by key.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport type GridDataAttr = (typeof GridDataAttrs)[keyof typeof GridDataAttrs];\n\n/**\n * Union of all CSS custom property names (`--tbw-*`) available for theming.\n * Use `GridCSSVars` to access individual values by key.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport type GridCSSVar = (typeof GridCSSVars)[keyof typeof GridCSSVars];\n","/**\n * Generic click-only action menu — the shared building block for WCAG 2.2\n * SC 2.5.7 \"Dragging Movements\" alternatives in plugins.\n *\n * Every drag affordance in the grid needs a path that works with plain clicks\n * or taps. A keyboard equivalent is **not** enough: SC 2.5.7 is specifically\n * about pointer input, and the W3C Understanding text calls out \"a pop-up menu\n * after tap\" as a conforming alternative. This module is that pop-up.\n *\n * Lives under `plugins/shared/` on purpose: each plugin bundle is built\n * self-contained, so this code is duplicated into the plugins that use it and\n * never lands in the core `index.js` budget.\n *\n * @since 3.6.0\n * @internal\n */\n\n/** Gap between the anchor element and the menu, in px. */\nconst ANCHOR_GAP_PX = 6;\n\n/** Runtime check — happy-dom and older browsers may lack the Popover API. */\nfunction supportsPopover(): boolean {\n return typeof HTMLElement.prototype?.showPopover === 'function';\n}\n\nlet hoverlessQuery: MediaQueryList | null | undefined;\n\n/** Whether the primary pointer cannot hover (touch, most switch devices). */\nfunction isHoverless(): boolean {\n if (hoverlessQuery === undefined) hoverlessQuery = globalThis.matchMedia?.('(hover: none)') ?? null;\n return hoverlessQuery?.matches ?? false;\n}\n\n/**\n * Whether a plugin should also expose its drag alternative as a dedicated\n * inline control, on top of the menu that is always available.\n *\n * Hover-less pointers get one unconditionally — a control revealed on hover is\n * unreachable when nothing can hover, and long-press is the wrong fallback for\n * the tremor and low-dexterity users SC 2.5.7 exists for.\n *\n * Driven by `a11y.dragAlternatives` on the grid config.\n */\nexport function prefersInlineDragAlternative(grid: {\n effectiveConfig?: { a11y?: { dragAlternatives?: 'menu' | 'inline' } };\n}): boolean {\n return grid.effectiveConfig?.a11y?.dragAlternatives === 'inline' || isHoverless();\n}\n\n/** One clickable entry in the menu. */\nexport interface DragAlternativeAction {\n /** Visible text, also the accessible name. */\n label: string;\n /** Render the entry but refuse the click (e.g. \"Move up\" on the first row). */\n disabled?: boolean;\n /** Invoked on click; the menu closes first so focus handling is predictable. */\n run(): void;\n}\n\nexport interface DragAlternativeMenu {\n /**\n * Show `actions` anchored to `anchor`, with `label` as the group's accessible\n * name. Mounted inside the anchor's grid host so it inherits theme tokens.\n */\n open(anchor: HTMLElement, label: string, actions: readonly DragAlternativeAction[]): void;\n /** Hide the menu. Safe to call when already closed. */\n close(): void;\n /** Remove the element and every document-level listener. */\n dispose(): void;\n /** The menu element, or `null` before the first {@link DragAlternativeMenu.open}. */\n readonly element: HTMLElement | null;\n}\n\n/**\n * Create a menu instance.\n *\n * @param id - DOM id for the menu element, unique per owning plugin.\n * @param className - Root class name, so each plugin can style its own menu.\n */\nexport function createDragAlternativeMenu(id: string, className: string): DragAlternativeMenu {\n let root: HTMLDivElement | null = null;\n let opened = false;\n let disposed = false;\n const abort = new AbortController();\n\n function close(): void {\n if (!opened || !root) return;\n opened = false;\n if (supportsPopover()) root.hidePopover();\n root.hidden = true;\n }\n\n function build(): HTMLDivElement {\n const el = document.createElement('div');\n el.id = id;\n el.className = className;\n el.setAttribute('popover', 'manual');\n el.setAttribute('role', 'group');\n // Without the Popover API there is no UA `display: none`, so hide it here.\n el.hidden = true;\n // Tabbing past either end dismisses instead of stranding the user — the\n // menu has no visible trigger to tab back to. A null `relatedTarget` (click\n // focus in Firefox/Safari, focus leaving the document) is ignored.\n el.addEventListener(\n 'focusout',\n (e) => {\n const next = (e as FocusEvent).relatedTarget;\n if (next instanceof Node && !el.contains(next)) close();\n },\n { signal: abort.signal },\n );\n return el;\n }\n\n /**\n * Position against the anchor in viewport coordinates. The menu lives in the\n * top layer, so its containing block is the viewport regardless of where the\n * anchor sits in the DOM.\n */\n function place(anchor: HTMLElement): void {\n if (!root) return;\n const a = anchor.getBoundingClientRect();\n const box = root.getBoundingClientRect();\n const left = Math.max(4, Math.min(a.left, window.innerWidth - box.width - 4));\n const below = a.bottom + ANCHOR_GAP_PX;\n const top = below + box.height <= window.innerHeight ? below : Math.max(4, a.top - ANCHOR_GAP_PX - box.height);\n root.style.left = `${Math.round(left)}px`;\n root.style.top = `${Math.round(top)}px`;\n }\n\n // Any pointer press outside the menu dismisses it. Capture phase so the press\n // that lands on a grid cell still reaches its own handler afterwards.\n document.addEventListener(\n 'pointerdown',\n (e) => {\n if (opened && root && !e.composedPath().includes(root)) close();\n },\n { capture: true, signal: abort.signal },\n );\n document.addEventListener(\n 'keydown',\n (e) => {\n if ((e as KeyboardEvent).key === 'Escape') close();\n },\n { capture: true, signal: abort.signal },\n );\n\n return {\n get element() {\n return root;\n },\n open(anchor, label, actions) {\n if (disposed || actions.length === 0) return;\n if (!root) root = build();\n // Mount inside the grid host (light DOM) so theme custom properties and\n // `color-scheme` cascade in; the top layer keeps it out of overflow.\n const host = anchor.closest<HTMLElement>('tbw-grid, [data-tbw-grid]') ?? document.body;\n if (root.parentNode !== host) host.appendChild(root);\n root.setAttribute('aria-label', label);\n root.replaceChildren();\n for (const action of actions) {\n const btn = document.createElement('button');\n btn.type = 'button';\n btn.className = `${className}-item`;\n btn.textContent = action.label;\n btn.disabled = action.disabled === true;\n btn.addEventListener('click', () => {\n close();\n action.run();\n });\n root.appendChild(btn);\n }\n root.hidden = false;\n if (!opened && supportsPopover()) root.showPopover();\n opened = true;\n place(anchor);\n root.querySelector<HTMLButtonElement>('button:not([disabled])')?.focus();\n },\n close,\n dispose() {\n disposed = true;\n close();\n abort.abort();\n root?.remove();\n root = null;\n },\n };\n}\n","@layer tbw-plugins {\n .tbw-visibility-content {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .tbw-visibility-list {\n flex: 1;\n overflow-y: auto;\n padding: var(--tbw-panel-padding, var(--tbw-spacing-md, 0.5rem));\n }\n\n .tbw-visibility-row {\n display: flex;\n align-items: center;\n gap: var(--tbw-panel-gap, var(--tbw-spacing-md, 0.5rem));\n padding: var(--tbw-menu-item-padding, 0.375rem 0.25rem);\n cursor: pointer;\n font-size: var(--tbw-font-size-sm, 0.8125rem);\n border-radius: var(--tbw-border-radius, 0.25rem);\n position: relative;\n }\n .tbw-visibility-row:hover {\n background: var(--tbw-visibility-hover, var(--tbw-color-row-hover));\n }\n .tbw-visibility-row input[type='checkbox'] {\n cursor: pointer;\n }\n .tbw-visibility-row.locked span {\n color: var(--tbw-color-fg-muted);\n }\n\n /* Drag handle */\n .tbw-visibility-handle {\n cursor: grab;\n color: var(--tbw-color-fg-muted);\n font-size: var(--tbw-font-size-2xs, 0.625rem);\n letter-spacing: -2px;\n user-select: none;\n flex-shrink: 0;\n }\n .tbw-visibility-row.reorderable:hover .tbw-visibility-handle {\n color: var(--tbw-color-fg);\n }\n /* Label wrapper for checkbox and text */\n .tbw-visibility-label {\n display: flex;\n align-items: center;\n gap: var(--tbw-panel-gap, var(--tbw-spacing-md, 0.5rem));\n flex: 1;\n cursor: pointer;\n }\n\n /* Drag states */\n .tbw-visibility-row.dragging {\n opacity: 0.5;\n cursor: grabbing;\n }\n .tbw-visibility-row.drop-before::before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n height: 2px;\n background: var(--tbw-visibility-indicator, var(--tbw-color-accent));\n }\n .tbw-visibility-row.drop-after::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 2px;\n background: var(--tbw-visibility-indicator, var(--tbw-color-accent));\n }\n\n .tbw-visibility-show-all {\n margin: var(--tbw-panel-padding, var(--tbw-spacing-md, 0.5rem));\n padding: var(--tbw-button-padding, 0.5rem 0.75rem);\n border: 1px solid var(--tbw-visibility-border, var(--tbw-color-border));\n border-radius: var(--tbw-border-radius, 0.25rem);\n background: var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));\n color: var(--tbw-color-fg);\n cursor: pointer;\n font-size: var(--tbw-font-size-sm, 0.8125rem);\n }\n .tbw-visibility-show-all:hover {\n background: var(--tbw-visibility-hover, var(--tbw-color-row-hover));\n }\n\n /* Group header */\n .tbw-visibility-group-header {\n display: flex;\n align-items: center;\n padding: var(--tbw-menu-item-padding, 0.375rem 0.25rem);\n font-size: var(--tbw-font-size-sm, 0.8125rem);\n font-weight: 600;\n color: var(--tbw-color-fg);\n border-bottom: 1px solid var(--tbw-color-border);\n margin-top: var(--tbw-spacing-sm, 0.25rem);\n position: relative;\n }\n .tbw-visibility-group-header:first-child {\n margin-top: 0;\n }\n .tbw-visibility-group-header .tbw-visibility-label {\n gap: var(--tbw-panel-gap, var(--tbw-spacing-md, 0.5rem));\n }\n\n /* Reorderable group header */\n .tbw-visibility-group-header.reorderable {\n cursor: grab;\n }\n .tbw-visibility-group-header.reorderable:hover {\n background: var(--tbw-visibility-hover, var(--tbw-color-row-hover));\n }\n .tbw-visibility-group-header .tbw-visibility-handle {\n cursor: grab;\n color: var(--tbw-color-fg-muted);\n font-size: var(--tbw-font-size-2xs, 0.625rem);\n letter-spacing: -2px;\n user-select: none;\n flex-shrink: 0;\n }\n .tbw-visibility-group-header.reorderable:hover .tbw-visibility-handle {\n color: var(--tbw-color-fg);\n }\n\n /* Coarse pointer (touch): handles always in active colour and large enough to tap */\n @media (hover: none) {\n .tbw-visibility-row.reorderable .tbw-visibility-handle,\n .tbw-visibility-group-header.reorderable .tbw-visibility-handle {\n color: var(--tbw-color-fg);\n }\n }\n\n @media (pointer: coarse) {\n .tbw-visibility-handle {\n min-width: var(--tbw-touch-target-min, 24px);\n min-height: var(--tbw-touch-target-min, 24px);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n }\n\n /* Group drag states */\n .tbw-visibility-group-header.dragging {\n opacity: 0.5;\n cursor: grabbing;\n }\n .tbw-visibility-group-header.drop-before::before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n height: 2px;\n background: var(--tbw-visibility-indicator, var(--tbw-color-accent));\n }\n .tbw-visibility-group-header.drop-after::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 2px;\n background: var(--tbw-visibility-indicator, var(--tbw-color-accent));\n }\n\n /* Indented column rows within a group */\n .tbw-visibility-row--grouped {\n padding-left: calc(var(--tbw-panel-padding, var(--tbw-spacing-md, 0.5rem)) + 0.75rem);\n }\n\n /* ===== Handle move menu (WCAG 2.2 SC 2.5.7) ===== */\n\n .tbw-visibility-move-menu {\n position: fixed;\n margin: 0;\n padding: 4px;\n display: flex;\n flex-direction: column;\n min-width: 10rem;\n background: var(--tbw-color-panel-bg, light-dark(#fff, #1e1e1e));\n color: var(--tbw-color-panel-fg, light-dark(#1a1a1a, #eaeaea));\n border: 1px solid var(--tbw-color-border, light-dark(#d0d0d0, #3a3a3a));\n border-radius: var(--tbw-border-radius, 0.25rem);\n box-shadow: var(--tbw-shadow-panel, 0 4px 12px light-dark(rgb(0 0 0 / 20%), rgb(0 0 0 / 50%)));\n font: inherit;\n z-index: 10001;\n\n &[hidden] {\n display: none;\n }\n }\n\n .tbw-visibility-move-menu-item {\n min-height: var(--tbw-touch-target-min, 24px);\n padding: 4px 8px;\n text-align: start;\n background: none;\n color: inherit;\n font: inherit;\n border: 0;\n /* Themes set radii for much larger surfaces (Material uses 12px), which\n turns a 24px row into a lozenge. */\n border-radius: min(var(--tbw-border-radius, 0.25rem), 6px);\n cursor: pointer;\n\n &:hover:not(:disabled) {\n background: var(--tbw-color-row-hover, light-dark(#00000010, #ffffff14));\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: default;\n }\n }\n} /* End @layer tbw-plugins */\n","/**\n * Column Visibility Plugin (Class-based)\n *\n * Provides a UI for column visibility control via the shell's tool panel system.\n * Column visibility is a core grid feature - this plugin provides:\n * - A tool panel for column visibility management (registered with the shell)\n * - Backward-compatible API methods that delegate to grid.setColumnVisible(), etc.\n *\n * The grid emits 'column-visibility' events when columns are shown/hidden,\n * allowing consumers to save user preferences.\n *\n * When a reorder plugin is present, column rows become draggable for reordering.\n * Drag-drop emits 'column-reorder-request' events that the ReorderPlugin can listen for.\n */\n\nimport { GridClasses } from '../../core/constants';\nimport {\n BaseGridPlugin,\n type PluginDependency,\n type PluginManifest,\n type PluginQuery,\n} from '../../core/plugin/base-plugin';\nimport type { ColumnConfig, ColumnInternal } from '../../core/types';\nimport type { ContextMenuParams, HeaderContextMenuItem } from '../context-menu/types';\nimport {\n createDragAlternativeMenu,\n type DragAlternativeAction,\n type DragAlternativeMenu,\n} from '../shared/drag-alternative-menu';\nimport type { ToolPanelDefinition } from '../shell/types';\nimport type { ColumnGroupInfo, ColumnReorderRequestDetail, VisibilityConfig } from './types';\nimport styles from './visibility.css?inline';\n\n/** Column metadata shape returned by `grid.getAllColumns()`. */\ntype ColumnEntry = {\n field: string;\n header: string;\n visible: boolean;\n lockVisible?: boolean;\n utility?: boolean;\n};\n\n/** A contiguous run of same-group columns, or a single ungrouped column. */\ntype PanelFragment = { group: ColumnGroupInfo | null; columns: ColumnEntry[] };\n\n/**\n * Column Visibility Plugin for tbw-grid\n *\n * Gives users control over which columns are displayed. Hide less important columns\n * by default, let users toggle them via a column chooser UI, or programmatically\n * show/hide columns based on user preferences or screen size.\n *\n * > **Optional Enhancement:** When ReorderPlugin is also loaded, columns in the\n * > visibility panel become draggable for reordering.\n *\n * ## Installation\n *\n * ```ts\n * import { VisibilityPlugin } from '@toolbox-web/grid/plugins/visibility';\n * ```\n *\n * ## Column Configuration\n *\n * | Property | Type | Default | Description |\n * |----------|------|---------|-------------|\n * | `visible` | `boolean` | `true` | Initial visibility state |\n * | `lockVisible` | `boolean` | `false` | Prevent user from toggling (legacy `meta.lockVisibility` is honored) |\n *\n * ## CSS Custom Properties\n *\n * | Property | Default | Description |\n * |----------|---------|-------------|\n * | `--tbw-visibility-hover` | `var(--tbw-color-row-hover)` | Row hover background |\n * | `--tbw-panel-padding` | `0.75em` | Panel content padding |\n * | `--tbw-panel-gap` | `0.5em` | Gap between items |\n *\n * @example Columns Hidden by Default\n * ```ts\n * import { queryGrid } from '@toolbox-web/grid';\n * import { VisibilityPlugin } from '@toolbox-web/grid/plugins/visibility';\n *\n * const grid = queryGrid('tbw-grid');\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID' },\n * { field: 'name', header: 'Name' },\n * { field: 'phone', header: 'Phone', visible: false }, // Hidden by default\n * { field: 'address', header: 'Address', visible: false },\n * ],\n * plugins: [new VisibilityPlugin()],\n * };\n *\n * // Toggle programmatically\n * const plugin = grid.getPluginByName('visibility');\n * plugin.showColumn('phone');\n * ```\n *\n * @example With Drag-to-Reorder\n * ```ts\n * import { VisibilityPlugin } from '@toolbox-web/grid/plugins/visibility';\n * import { ReorderPlugin } from '@toolbox-web/grid/plugins/reorder-columns';\n *\n * grid.gridConfig = {\n * plugins: [\n * new ReorderPlugin(), // Enables drag-drop in visibility panel\n * new VisibilityPlugin(),\n * ],\n * };\n * ```\n *\n * @see {@link VisibilityConfig} for configuration options\n * @see ReorderPlugin for drag-to-reorder integration\n *\n * @internal Extends BaseGridPlugin\n * @since 0.1.1\n */\nexport class VisibilityPlugin extends BaseGridPlugin<VisibilityConfig> {\n /**\n * Plugin dependencies.\n *\n * - `shell` (required): VisibilityPlugin renders its column list inside a\n * shell tool panel. Without the shell plugin there is no host for the\n * panel. The shell auto-registers today, so this only bites once the\n * auto-register is removed at v3 (#370).\n * - `reorder` (optional): when present, columns in the visibility panel\n * become draggable.\n * @internal\n */\n static override readonly dependencies: PluginDependency[] = [\n { name: 'shell', required: true, reason: 'VisibilityPlugin renders its column list in a shell tool panel' },\n { name: 'reorder', required: false, reason: 'Enables drag-to-reorder columns in visibility panel' },\n ];\n\n /**\n * Plugin manifest - declares handled queries.\n * @internal\n */\n static override readonly manifest: PluginManifest = {\n queries: [\n {\n type: 'getContextMenuItems',\n description: 'Contributes \"Hide column\" item to the header context menu',\n },\n ],\n };\n\n /** @internal */\n readonly name = 'visibility';\n\n /** Tool panel ID for shell integration */\n static readonly PANEL_ID = 'columns';\n /** @internal */\n override readonly styles = styles;\n\n /** @internal */\n protected override get defaultConfig(): Partial<VisibilityConfig> {\n return {};\n }\n\n // #region Internal State\n private columnListElement: HTMLElement | null = null;\n\n // Drag state for reorder integration\n private isDragging = false;\n private draggedField: string | null = null;\n private draggedIndex: number | null = null;\n private dropIndex: number | null = null;\n /** When dragging a group, holds the group ID; null for individual column drags. */\n private draggedGroupId: string | null = null;\n /** Fields belonging to the group currently being dragged. */\n private draggedGroupFields: string[] = [];\n /** Click-only move menu (SC 2.5.7). One instance shared by every drag handle. */\n private moveMenu: DragAlternativeMenu | null = null;\n\n /** Clear drag-related classes from all rows and group headers in a list. */\n private clearDragClasses(container: HTMLElement): void {\n container.querySelectorAll('.tbw-visibility-row, .tbw-visibility-group-header').forEach((r) => {\n r.classList.remove(GridClasses.DRAGGING, 'drop-target', 'drop-before', 'drop-after');\n });\n }\n // #endregion\n\n // #region Lifecycle\n\n /** @internal */\n override attach(grid: import('../../core/plugin/base-plugin').GridElement): void {\n super.attach(grid);\n\n // Listen for column-move events (emitted by ReorderPlugin after any reorder,\n // including header drag-drop and visibility panel drag-drop) to keep the\n // panel list in sync with the grid's column order.\n this.gridElement.addEventListener(\n 'column-move',\n () => {\n if (this.columnListElement) {\n // column-move fires BEFORE setColumnOrder runs. Defer the rebuild\n // to allow the full reorder cycle (setColumnOrder + renderHeader +\n // refreshVirtualWindow) to complete before reading the new order.\n // Use RAF to run after the current synchronous work and any\n // animation frames queued by the animation system.\n requestAnimationFrame(() => {\n if (this.columnListElement) {\n this.rebuildToggles(this.columnListElement);\n }\n });\n }\n },\n { signal: this.disconnectSignal },\n );\n }\n\n /** @internal */\n override detach(): void {\n this.columnListElement = null;\n this.isDragging = false;\n this.draggedField = null;\n this.draggedIndex = null;\n this.dropIndex = null;\n this.moveMenu?.dispose();\n this.moveMenu = null;\n }\n // #endregion\n\n // #region Render Hooks\n\n /**\n * Read declarative visibility attributes from the originating\n * `<tbw-grid-column>` element (issue #272). `hidden` and `lock-visible`\n * only seed the initial state — the `=== undefined` guards ensure a runtime\n * toggle (`setColumnVisible`, which writes `col.hidden = false`) or an\n * explicit config value always wins over the attribute.\n * @internal\n */\n override processColumns(columns: ColumnConfig[]): ColumnConfig[] {\n for (const col of columns) {\n const el = (col as ColumnInternal).__element;\n if (!el) continue;\n if (col.hidden === undefined && el.hasAttribute('hidden') && el.getAttribute('hidden') !== 'false') {\n col.hidden = true;\n }\n if (\n col.lockVisible === undefined &&\n el.hasAttribute('lock-visible') &&\n el.getAttribute('lock-visible') !== 'false'\n ) {\n col.lockVisible = true;\n }\n }\n return columns;\n }\n // #endregion\n\n // #region Query Handlers\n\n /**\n * Handle inter-plugin queries.\n * Contributes a \"Hide column\" item to the header context menu.\n * @internal\n */\n override handleQuery(query: PluginQuery): unknown {\n if (query.type === 'getContextMenuItems') {\n const params = query.context as ContextMenuParams;\n if (!params.isHeader) return undefined;\n\n const column = params.column as ColumnConfig;\n if (!column?.field) return undefined;\n\n // Don't offer \"Hide\" for locked-visibility columns\n // (top-level `lockVisible` preferred; legacy `meta.lockVisibility` honored for back-compat)\n if (column.lockVisible || column.meta?.lockVisibility) return undefined;\n\n const items: HeaderContextMenuItem[] = [\n {\n id: 'visibility/hide-column',\n label: this.t('columns.hideColumn', 'Hide Column'),\n icon: '👁',\n order: 30,\n action: () => this.hideColumn(column.field),\n },\n ];\n\n return items;\n }\n return undefined;\n }\n // #endregion\n\n // #region Shell Integration\n\n /**\n * Register the column visibility tool panel with the shell.\n * @internal\n */\n override getToolPanel(): ToolPanelDefinition | undefined {\n return {\n id: VisibilityPlugin.PANEL_ID,\n title: this.t('columns.panelTitle', 'Columns'),\n icon: '☰',\n tooltip: 'Column visibility',\n order: 100, // High order so it appears last\n render: (container) => this.renderPanelContent(container),\n };\n }\n // #endregion\n\n // #region Public API\n\n /**\n * Resolve the shell plugin (#370). The visibility tool panel lives in the\n * shell, so panel open/close/toggle is delegated to the ShellPlugin instance\n * rather than the deprecated core `grid.*` shell delegates.\n */\n #shell() {\n return this.grid.getPluginByName('shell');\n }\n\n /**\n * Show the visibility sidebar panel.\n * Opens the tool panel and ensures this section is expanded.\n */\n show(): void {\n this.#shell()?.openToolPanel(VisibilityPlugin.PANEL_ID);\n }\n\n /**\n * Hide the visibility sidebar panel.\n */\n hide(): void {\n this.#shell()?.closeToolPanel();\n }\n\n /**\n * Toggle the visibility sidebar panel section.\n */\n toggle(): void {\n const shell = this.#shell();\n // If tool panel is closed, open it first\n if (!shell?.isToolPanelOpen) {\n shell?.openToolPanel();\n }\n shell?.toggleToolPanelSection(VisibilityPlugin.PANEL_ID);\n }\n\n /**\n * Check if a specific column is visible.\n * Delegates to grid.isColumnVisible().\n * @param field - The field name to check\n * @returns True if the column is visible\n */\n isColumnVisible(field: string): boolean {\n return this.grid.isColumnVisible(field);\n }\n\n /**\n * Set visibility for a specific column.\n * Delegates to grid.setColumnVisible().\n * @param field - The field name of the column\n * @param visible - Whether the column should be visible\n */\n setColumnVisible(field: string, visible: boolean): void {\n this.grid.setColumnVisible(field, visible);\n }\n\n /**\n * Get list of all visible column fields.\n * @returns Array of visible field names\n */\n getVisibleColumns(): string[] {\n return this.grid\n .getAllColumns()\n .filter((c) => c.visible)\n .map((c) => c.field);\n }\n\n /**\n * Get list of all hidden column fields.\n * @returns Array of hidden field names\n */\n getHiddenColumns(): string[] {\n return this.grid\n .getAllColumns()\n .filter((c) => !c.visible)\n .map((c) => c.field);\n }\n\n /**\n * Show all columns.\n * Delegates to grid.showAllColumns().\n */\n showAll(): void {\n this.grid.showAllColumns();\n }\n\n /**\n * Toggle visibility for a specific column.\n * Delegates to grid.toggleColumnVisibility().\n * @param field - The field name of the column\n */\n toggleColumn(field: string): void {\n this.grid.toggleColumnVisibility(field);\n }\n\n /**\n * Show a specific column.\n * Delegates to grid.setColumnVisible().\n * @param field - The field name of the column to show\n */\n showColumn(field: string): void {\n this.setColumnVisible(field, true);\n }\n\n /**\n * Hide a specific column.\n * Delegates to grid.setColumnVisible().\n * @param field - The field name of the column to hide\n */\n hideColumn(field: string): void {\n this.setColumnVisible(field, false);\n }\n\n /**\n * Get all columns with their visibility status.\n * Useful for building visibility UI.\n * @returns Array of column info with visibility status\n */\n getAllColumns(): Array<{\n field: string;\n header: string;\n visible: boolean;\n lockVisible?: boolean;\n utility?: boolean;\n }> {\n return this.grid.getAllColumns();\n }\n\n /**\n * Check if the sidebar panel is currently open.\n * @returns True if the panel section is expanded\n */\n isPanelVisible(): boolean {\n const shell = this.#shell();\n return !!shell?.isToolPanelOpen && shell.expandedToolPanelSections.includes(VisibilityPlugin.PANEL_ID);\n }\n // #endregion\n\n // #region Private Methods\n\n /**\n * Render the panel content into the shell's tool panel container.\n * Returns a cleanup function.\n */\n private renderPanelContent(container: HTMLElement): (() => void) | void {\n // Create content wrapper\n const wrapper = document.createElement('div');\n wrapper.className = 'tbw-visibility-content';\n\n // Column list container\n const columnList = document.createElement('div');\n columnList.className = 'tbw-visibility-list';\n wrapper.appendChild(columnList);\n\n // Show all button\n const showAllBtn = document.createElement('button');\n showAllBtn.type = 'button';\n showAllBtn.className = 'tbw-visibility-show-all';\n showAllBtn.textContent = this.t('columns.showAll', 'Show All');\n showAllBtn.addEventListener('click', () => {\n this.grid.showAllColumns();\n this.rebuildToggles(columnList);\n });\n wrapper.appendChild(showAllBtn);\n\n // Store reference\n this.columnListElement = columnList;\n\n // Build initial toggles\n this.rebuildToggles(columnList);\n\n // Append to container\n container.appendChild(wrapper);\n\n // Return cleanup function\n return () => {\n this.columnListElement = null;\n this.moveMenu?.close();\n wrapper.remove();\n };\n }\n\n /**\n * Check if a reorder plugin is present (by name to avoid static import).\n */\n private hasReorderPlugin(): boolean {\n const plugin = this.grid?.getPluginByName?.('reorder');\n // Duck-type check - just verify the plugin exists and has a moveColumn method\n return !!(plugin && typeof (plugin as { moveColumn?: unknown }).moveColumn === 'function');\n }\n\n /**\n * Ask the plugin system whether a column may be reordered.\n *\n * Looks up the real `ColumnConfig` by field (the projection from `getAllColumns()`\n * intentionally omits plugin-owned flags like `lockPosition`) and forwards it to\n * the `canMoveColumn` query handled by ReorderPlugin and vetoed by other plugins\n * (e.g. PinnedColumnsPlugin blocking sticky columns). Returns `false` when no\n * plugin answers, which keeps the panel non-draggable when reorder is absent.\n */\n private canMoveColumn(column: ColumnEntry): boolean {\n const config = this.grid.columns.find((c) => c.field === column.field);\n if (!config) return false;\n const responses = this.grid.query<boolean>('canMoveColumn', config);\n return responses.length > 0 && !responses.includes(false);\n }\n\n /**\n * Build the column toggle checkboxes.\n * When GroupingColumnsPlugin is present, renders columns under collapsible group headers.\n * Groups that are fragmented (same group split across non-contiguous positions) are\n * shown as separate sections to match the grid's visual layout.\n * When a reorder plugin is present, adds drag handles for reordering.\n */\n private rebuildToggles(columnList: HTMLElement): void {\n const reorderEnabled = this.hasReorderPlugin();\n\n columnList.innerHTML = '';\n\n // getAllColumns() returns columns in their effective display order\n // Filter out utility columns (e.g., expander column) as they're internal\n const allColumns = this.grid.getAllColumns().filter((c) => !c.utility);\n const fragments = this.currentFragments();\n\n if (fragments.every((f) => !f.group)) {\n // No grouping — render flat list (original behavior)\n this.renderFlatColumnList(allColumns, reorderEnabled, columnList);\n return;\n }\n\n for (const fragment of fragments) {\n if (fragment.group) {\n this.renderGroupSection(fragment.group, fragment.columns, reorderEnabled, columnList);\n } else {\n // Ungrouped column — render as individual row\n const fullIndex = allColumns.indexOf(fragment.columns[0]);\n columnList.appendChild(this.createColumnRow(fragment.columns[0], fullIndex, reorderEnabled, columnList));\n }\n }\n }\n\n /**\n * The panel's current top-level rows, in display order: one entry per group\n * fragment plus one per ungrouped column. Recomputed from live grid state on\n * every call so the move menu can never act on a stale panel.\n *\n * Walks columns in display order and detects contiguous fragments. A fragment\n * is a run of consecutive columns belonging to the same group. Fragmented\n * groups (same group ID at non-contiguous positions) produce separate sections\n * so the panel matches the grid's visual layout.\n */\n private currentFragments(): PanelFragment[] {\n const allColumns = this.grid.getAllColumns().filter((c) => !c.utility);\n\n // Query for column grouping info from GroupingColumnsPlugin (or any responder)\n const groupResults = this.grid.query<ColumnGroupInfo[]>('getColumnGrouping');\n const groups: ColumnGroupInfo[] = groupResults?.flat().filter((g) => g && g.fields.length > 0) ?? [];\n if (groups.length === 0) return allColumns.map((c) => ({ group: null, columns: [c] }));\n\n const fieldToGroup = new Map<string, ColumnGroupInfo>();\n for (const group of groups) {\n for (const field of group.fields) fieldToGroup.set(field, group);\n }\n return this.computeFragments(allColumns, fieldToGroup);\n }\n\n /**\n * Compute contiguous column fragments from display-order columns.\n * Each fragment is either a group section (contiguous run of same-group columns)\n * or a single ungrouped column.\n */\n private computeFragments(\n allColumns: ColumnEntry[],\n fieldToGroup: Map<string, ColumnGroupInfo>,\n ): PanelFragment[] {\n const fragments: PanelFragment[] = [];\n let currentGroup: ColumnGroupInfo | null = null;\n let currentCols: ColumnEntry[] = [];\n\n for (const col of allColumns) {\n const group = fieldToGroup.get(col.field) ?? null;\n\n if (group && currentGroup && group.id === currentGroup.id) {\n // Same group continues — extend fragment\n currentCols.push(col);\n } else {\n // Flush previous fragment\n if (currentCols.length > 0) {\n fragments.push({ group: currentGroup, columns: currentCols });\n }\n currentGroup = group;\n currentCols = [col];\n }\n }\n // Flush last fragment\n if (currentCols.length > 0) {\n fragments.push({ group: currentGroup, columns: currentCols });\n }\n\n return fragments;\n }\n\n /**\n * Render a group fragment section with header checkbox and indented column rows.\n * A fragment is a contiguous run of columns from the same group. When a group is\n * fragmented (split across non-contiguous positions), each fragment gets its own section.\n */\n private renderGroupSection(\n group: ColumnGroupInfo,\n columns: ColumnEntry[],\n reorderEnabled: boolean,\n container: HTMLElement,\n ): void {\n // The fragment's fields — only the columns in this contiguous section\n const fragmentFields = columns.map((c) => c.field);\n\n // Group header row\n const header = document.createElement('div');\n header.className = 'tbw-visibility-group-header';\n header.setAttribute('data-group-id', group.id);\n\n // Make group header draggable when reorder is enabled.\n // Pass only this fragment's fields so dragging moves just this\n // contiguous block, not all columns of the (possibly fragmented) group.\n if (reorderEnabled) {\n header.draggable = true;\n header.classList.add('reorderable');\n this.setupGroupDragListeners(header, group, fragmentFields, container);\n }\n\n const headerLabel = document.createElement('label');\n headerLabel.className = 'tbw-visibility-label';\n\n const groupCheckbox = document.createElement('input');\n groupCheckbox.type = 'checkbox';\n\n // Calculate tri-state: all visible, all hidden, or mixed\n const visibleCount = columns.filter((c) => c.visible).length;\n const allLocked = columns.every((c) => c.lockVisible);\n if (visibleCount === columns.length) {\n groupCheckbox.checked = true;\n groupCheckbox.indeterminate = false;\n } else if (visibleCount === 0) {\n groupCheckbox.checked = false;\n groupCheckbox.indeterminate = false;\n } else {\n groupCheckbox.checked = false;\n groupCheckbox.indeterminate = true;\n }\n groupCheckbox.disabled = allLocked;\n\n // Toggle all columns in group\n groupCheckbox.addEventListener('change', () => {\n const newVisible = groupCheckbox.checked;\n for (const col of columns) {\n if (col.lockVisible) continue;\n this.grid.setColumnVisible(col.field, newVisible);\n }\n setTimeout(() => this.rebuildToggles(container), 0);\n });\n\n const headerText = document.createElement('span');\n headerText.textContent = group.label;\n\n headerLabel.appendChild(groupCheckbox);\n headerLabel.appendChild(headerText);\n header.appendChild(headerLabel);\n\n // Add drag handle icon for group if reorderable\n if (reorderEnabled) {\n const handle = document.createElement('span');\n handle.className = 'tbw-visibility-handle';\n this.setIcon(handle, 'dragHandle');\n handle.title = this.t('columns.dragGroupHandle', 'Drag to reorder group, or click for move options');\n this.wireMoveHandle(handle, group.label, () => this.groupMoveActions(fragmentFields));\n // Insert handle before the label\n header.insertBefore(handle, headerLabel);\n }\n\n container.appendChild(header);\n\n // Render indented column rows\n const allColumnsFullList = this.grid.getAllColumns().filter((c) => !c.utility);\n for (const col of columns) {\n const fullIndex = allColumnsFullList.findIndex((c) => c.field === col.field);\n const row = this.createColumnRow(col, fullIndex, reorderEnabled, container);\n row.classList.add('tbw-visibility-row--grouped');\n container.appendChild(row);\n }\n }\n\n /**\n * Render a flat (ungrouped) list of column rows.\n */\n private renderFlatColumnList(columns: ColumnEntry[], reorderEnabled: boolean, container: HTMLElement): void {\n const allColumnsFullList = this.grid.getAllColumns().filter((c) => !c.utility);\n for (const col of columns) {\n const fullIndex = allColumnsFullList.findIndex((c) => c.field === col.field);\n container.appendChild(this.createColumnRow(col, fullIndex, reorderEnabled, container));\n }\n }\n\n /**\n * Create a single column visibility row element.\n */\n private createColumnRow(\n col: ColumnEntry,\n index: number,\n reorderEnabled: boolean,\n columnList: HTMLElement,\n ): HTMLElement {\n const label = col.header || col.field;\n\n const row = document.createElement('div');\n row.className = col.lockVisible ? 'tbw-visibility-row locked' : 'tbw-visibility-row';\n row.setAttribute('data-field', col.field);\n row.setAttribute('data-index', String(index));\n\n // Add drag handle if reorder is enabled\n if (reorderEnabled && this.canMoveColumn(col)) {\n row.draggable = true;\n row.classList.add('reorderable');\n this.setupDragListeners(row, col.field, index, columnList);\n }\n\n const labelWrapper = document.createElement('label');\n labelWrapper.className = 'tbw-visibility-label';\n\n const checkbox = document.createElement('input');\n checkbox.type = 'checkbox';\n checkbox.checked = col.visible;\n checkbox.disabled = col.lockVisible ?? false;\n checkbox.addEventListener('change', () => {\n this.grid.toggleColumnVisibility(col.field);\n // Refresh after toggle (grid may re-render)\n setTimeout(() => this.rebuildToggles(columnList), 0);\n });\n\n const text = document.createElement('span');\n text.textContent = label;\n\n labelWrapper.appendChild(checkbox);\n labelWrapper.appendChild(text);\n\n // Add drag handle icon if reorderable\n if (reorderEnabled && this.canMoveColumn(col)) {\n const handle = document.createElement('span');\n handle.className = 'tbw-visibility-handle';\n this.setIcon(handle, 'dragHandle');\n handle.title = this.t('columns.dragHandle', 'Drag to reorder, or click for move options');\n this.wireMoveHandle(handle, label, () => this.columnMoveActions(col.field));\n row.appendChild(handle);\n }\n\n row.appendChild(labelWrapper);\n return row;\n }\n\n /**\n * Turn a drag handle into the pointer alternative required by WCAG 2.2\n * SC 2.5.7: a press-and-release without movement never fires `dragstart`, so\n * a plain click on the handle is the tap the criterion asks us to honour.\n *\n * The handle stays part of the row's drag surface — it is deliberately not\n * marked `draggable=\"false\"` — so dragging by the handle keeps working.\n * Actions are resolved on click, never at render time, so a stale panel can\n * never move the wrong column.\n */\n private wireMoveHandle(handle: HTMLElement, name: string, actions: () => DragAlternativeAction[]): void {\n handle.setAttribute('role', 'button');\n handle.tabIndex = -1;\n handle.setAttribute('aria-label', `${name} — ${this.t('columns.moveHandleHint', 'drag, or activate for move options')}`);\n handle.addEventListener('click', () => {\n this.moveMenu ??= createDragAlternativeMenu('tbw-visibility-move-menu', 'tbw-visibility-move-menu');\n this.moveMenu.open(handle, name, actions());\n });\n }\n\n /**\n * Emit the reorder request a drop at `dropIndex` would have produced.\n * `fromIndex`/`dropIndex` are positions in the panel's non-utility list;\n * `toIndex` is converted to the full column order the way the drop handler\n * does it, so the click path and the drag path can never diverge.\n */\n private requestColumnMove(field: string, fromIndex: number, dropIndex: number): void {\n const effectiveToIndex = dropIndex > fromIndex ? dropIndex - 1 : dropIndex;\n if (effectiveToIndex === fromIndex) return;\n\n const allColumns = this.grid.getAllColumns();\n const nonUtilityColumns = allColumns.filter((c) => !c.utility);\n const targetField = nonUtilityColumns[effectiveToIndex]?.field;\n const toIndex = targetField ? allColumns.findIndex((c) => c.field === targetField) : allColumns.length;\n\n this.emit<ColumnReorderRequestDetail>('column-reorder-request', { field, fromIndex, toIndex });\n }\n\n /** Click-only move actions for a single column row. */\n private columnMoveActions(field: string): DragAlternativeAction[] {\n const columns = this.grid.getAllColumns().filter((c) => !c.utility);\n const from = columns.findIndex((c) => c.field === field);\n const landable = (i: number) => i >= 0 && i < columns.length && this.canMoveColumn(columns[i]);\n\n return [\n {\n label: this.t('columns.moveUp', 'Move up'),\n disabled: !landable(from - 1),\n run: () => this.requestColumnMove(field, from, from - 1),\n },\n {\n label: this.t('columns.moveDown', 'Move down'),\n // The drop path takes an insert-before index, so stepping down one\n // place means aiming past the row that follows.\n disabled: !landable(from + 1),\n run: () => this.requestColumnMove(field, from, from + 2),\n },\n {\n label: this.t('columns.moveToTop', 'Move to top'),\n disabled: from <= 0 || !landable(0),\n run: () => this.requestColumnMove(field, from, 0),\n },\n {\n label: this.t('columns.moveToBottom', 'Move to bottom'),\n disabled: from < 0 || from >= columns.length - 1 || !landable(columns.length - 1),\n run: () => this.requestColumnMove(field, from, columns.length),\n },\n ];\n }\n\n /** Click-only move actions for a group fragment header. */\n private groupMoveActions(fragmentFields: string[]): DragAlternativeAction[] {\n const fragments = this.currentFragments();\n const at = fragments.findIndex((f) => f.columns[0]?.field === fragmentFields[0]);\n const fieldsAt = (i: number) => fragments[i].columns.map((c) => c.field);\n const first = at <= 0;\n const last = at < 0 || at >= fragments.length - 1;\n\n return [\n {\n label: this.t('columns.moveUp', 'Move up'),\n disabled: first,\n run: () => this.executeGroupDrop(fragmentFields, fieldsAt(at - 1), true),\n },\n {\n label: this.t('columns.moveDown', 'Move down'),\n disabled: last,\n run: () => this.executeGroupDrop(fragmentFields, fieldsAt(at + 1), false),\n },\n {\n label: this.t('columns.moveToTop', 'Move to top'),\n disabled: first,\n run: () => this.executeGroupDrop(fragmentFields, fieldsAt(0), true),\n },\n {\n label: this.t('columns.moveToBottom', 'Move to bottom'),\n disabled: last,\n run: () => this.executeGroupDrop(fragmentFields, fieldsAt(fragments.length - 1), false),\n },\n ];\n }\n\n /**\n * Set up drag-and-drop listeners for a group header row.\n * Dragging a group fragment moves only the columns in that fragment as a block.\n * When a group is fragmented, each fragment header drags independently.\n */\n private setupGroupDragListeners(\n header: HTMLElement,\n group: ColumnGroupInfo,\n fragmentFields: string[],\n columnList: HTMLElement,\n ): void {\n header.addEventListener('dragstart', (e: DragEvent) => {\n this.isDragging = true;\n this.draggedGroupId = group.id;\n this.draggedGroupFields = [...fragmentFields];\n // Use first field as representative for dataTransfer\n this.draggedField = null;\n this.draggedIndex = null;\n\n if (e.dataTransfer) {\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/plain', `group:${group.id}`);\n }\n\n // Mark entire group (header + children) as dragging\n header.classList.add(GridClasses.DRAGGING);\n columnList.querySelectorAll(`.tbw-visibility-row--grouped`).forEach((row) => {\n const field = row.getAttribute('data-field');\n if (field && this.draggedGroupFields.includes(field)) {\n row.classList.add(GridClasses.DRAGGING);\n }\n });\n });\n\n header.addEventListener('dragend', () => {\n this.isDragging = false;\n this.draggedGroupId = null;\n this.draggedGroupFields = [];\n this.draggedField = null;\n this.draggedIndex = null;\n this.dropIndex = null;\n this.clearDragClasses(columnList);\n });\n\n // Group headers are also drop targets for other groups (or other fragments of the same group)\n header.addEventListener('dragover', (e: DragEvent) => {\n e.preventDefault();\n if (!this.isDragging) return;\n // Can't drop onto the same fragment (same exact fields)\n if (\n this.draggedGroupFields.length === fragmentFields.length &&\n this.draggedGroupFields.every((f) => fragmentFields.includes(f))\n )\n return;\n // Can't drop individual columns onto group headers\n if (!this.draggedGroupId) return;\n\n const rect = header.getBoundingClientRect();\n const midY = rect.top + rect.height / 2;\n const before = e.clientY < midY;\n\n this.clearDragClasses(columnList);\n header.classList.add('drop-target');\n header.classList.toggle('drop-before', before);\n header.classList.toggle('drop-after', !before);\n });\n\n header.addEventListener('dragleave', () => {\n header.classList.remove('drop-target', 'drop-before', 'drop-after');\n });\n\n header.addEventListener('drop', (e: DragEvent) => {\n e.preventDefault();\n if (!this.isDragging || !this.draggedGroupId) return;\n // Can't drop onto the same fragment\n if (\n this.draggedGroupFields.length === fragmentFields.length &&\n this.draggedGroupFields.every((f) => fragmentFields.includes(f))\n )\n return;\n\n const rect = header.getBoundingClientRect();\n const before = e.clientY < rect.top + rect.height / 2;\n\n this.executeGroupDrop(this.draggedGroupFields, fragmentFields, before);\n });\n }\n\n /**\n * Execute a group drop — move the dragged fragment's fields as a block\n * to the position relative to the target group/column.\n * Routes through the ReorderPlugin when available for proper animation and\n * full render cycle, otherwise falls back to direct grid.setColumnOrder().\n */\n private executeGroupDrop(draggedFields: string[], targetFields: string[], before: boolean): void {\n const allColumns = this.grid.getAllColumns();\n const currentOrder = allColumns.map((c) => c.field);\n\n // Remove dragged fields from current order\n const remaining = currentOrder.filter((f) => !draggedFields.includes(f));\n\n // Find insertion point relative to target\n // Use the first field of target group if inserting before, last if after\n const anchorField = before ? targetFields[0] : targetFields[targetFields.length - 1];\n const insertAt = remaining.indexOf(anchorField);\n if (insertAt === -1) return;\n\n // Insert the dragged group block at the correct position\n const insertIndex = before ? insertAt : insertAt + 1;\n\n // Preserve the dragged fields' original relative order\n const draggedInOrder = currentOrder.filter((f) => draggedFields.includes(f));\n remaining.splice(insertIndex, 0, ...draggedInOrder);\n\n // Route through ReorderPlugin.setColumnOrder when available and attached —\n // this calls updateColumnOrder which handles animation and forceLayout for\n // proper body cell rebuilds. Fall back to direct grid.setColumnOrder otherwise.\n const reorderPlugin = this.grid.getPluginByName?.('reorder') as\n { setColumnOrder?: (o: string[]) => void; gridElement?: unknown } | undefined;\n if (reorderPlugin?.setColumnOrder && reorderPlugin.gridElement) {\n reorderPlugin.setColumnOrder(remaining);\n } else {\n this.grid.setColumnOrder(remaining);\n }\n\n // Panel rebuild is handled by the column-move listener when ReorderPlugin\n // emits the event. For the direct fallback path, trigger manually.\n requestAnimationFrame(() => {\n if (this.columnListElement) {\n this.rebuildToggles(this.columnListElement);\n }\n });\n }\n\n /**\n * Set up drag-and-drop event listeners for a row.\n * On drop, emits a 'column-reorder-request' event for other plugins to handle.\n */\n private setupDragListeners(row: HTMLElement, field: string, index: number, columnList: HTMLElement): void {\n row.addEventListener('dragstart', (e: DragEvent) => {\n this.isDragging = true;\n this.draggedField = field;\n this.draggedIndex = index;\n // Clear any stale group drag state\n this.draggedGroupId = null;\n this.draggedGroupFields = [];\n\n if (e.dataTransfer) {\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/plain', field);\n }\n\n row.classList.add(GridClasses.DRAGGING);\n });\n\n row.addEventListener('dragend', () => {\n this.isDragging = false;\n this.draggedField = null;\n this.draggedIndex = null;\n this.dropIndex = null;\n this.clearDragClasses(columnList);\n });\n\n row.addEventListener('dragover', (e: DragEvent) => {\n e.preventDefault();\n if (!this.isDragging) return;\n\n // If dragging a group, only allow drop on ungrouped rows\n if (this.draggedGroupId) {\n if (row.classList.contains('tbw-visibility-row--grouped')) return;\n } else if (this.draggedField === field) {\n return;\n }\n\n const rect = row.getBoundingClientRect();\n const midY = rect.top + rect.height / 2;\n\n this.dropIndex = e.clientY < midY ? index : index + 1;\n\n // Clear other highlights\n this.clearDragClasses(columnList);\n // Re-mark dragged elements\n if (this.draggedGroupId) {\n columnList\n .querySelector(`.tbw-visibility-group-header[data-group-id=\"${this.draggedGroupId}\"]`)\n ?.classList.add(GridClasses.DRAGGING);\n columnList.querySelectorAll('.tbw-visibility-row--grouped').forEach((r) => {\n const f = r.getAttribute('data-field');\n if (f && this.draggedGroupFields.includes(f)) r.classList.add(GridClasses.DRAGGING);\n });\n } else if (this.draggedField) {\n columnList\n .querySelector(`.tbw-visibility-row[data-field=\"${this.draggedField}\"]`)\n ?.classList.add(GridClasses.DRAGGING);\n }\n\n row.classList.add('drop-target');\n row.classList.toggle('drop-before', e.clientY < midY);\n row.classList.toggle('drop-after', e.clientY >= midY);\n });\n\n row.addEventListener('dragleave', () => {\n row.classList.remove('drop-target', 'drop-before', 'drop-after');\n });\n\n row.addEventListener('drop', (e: DragEvent) => {\n e.preventDefault();\n\n if (!this.isDragging) return;\n\n // Group drop onto an ungrouped row\n if (this.draggedGroupId && this.draggedGroupFields.length > 0) {\n if (row.classList.contains('tbw-visibility-row--grouped')) return;\n const rect = row.getBoundingClientRect();\n const before = e.clientY < rect.top + rect.height / 2;\n this.executeGroupDrop(this.draggedGroupFields, [field], before);\n return;\n }\n\n // Individual column drop\n const draggedField = this.draggedField;\n const draggedIndex = this.draggedIndex;\n const dropIndex = this.dropIndex;\n\n if (draggedField === null || draggedIndex === null || dropIndex === null) {\n return;\n }\n\n // Calculate the effective target index (in the filtered non-utility list)\n const effectiveToIndex = dropIndex > draggedIndex ? dropIndex - 1 : dropIndex;\n\n if (effectiveToIndex !== draggedIndex) {\n // Convert from non-utility index to full column order index\n // by counting how many utility columns come before the target position\n const allColumns = this.grid.getAllColumns();\n const nonUtilityColumns = allColumns.filter((c) => !c.utility);\n\n // Find the target field at effectiveToIndex in non-utility list\n const targetField = nonUtilityColumns[effectiveToIndex]?.field;\n // Find its actual index in the full column order\n const fullOrderToIndex = targetField ? allColumns.findIndex((c) => c.field === targetField) : allColumns.length;\n\n // Emit a request event - other plugins (like ReorderPlugin) can listen and handle\n const detail: ColumnReorderRequestDetail = {\n field: draggedField,\n fromIndex: draggedIndex, // Not used by ReorderPlugin, just for info\n toIndex: fullOrderToIndex,\n };\n this.emit<ColumnReorderRequestDetail>('column-reorder-request', detail);\n // Panel rebuild is handled by the column-move listener in attach()\n }\n });\n }\n // #endregion\n}\n"],"mappings":"mDAoCA,IAAa,EAyBD,WCxCZ,SAAS,IACP,MAAqD,mBAAvC,YAAY,WAAW,WACvC,CAwDA,SAAgB,EAA0B,EAAY,GACpD,IAAI,EAA8B,KAC9B,GAAS,EACT,GAAW,EACf,MAAM,EAAQ,IAAI,gBAElB,SAAS,IACF,GAAW,IAChB,GAAS,EACL,KAAmB,EAAK,cAC5B,EAAK,QAAS,EAChB,CAyDA,OAfA,SAAS,iBACP,cACC,IACK,GAAU,IAAS,EAAE,eAAe,SAAS,IAAO,KAE1D,CAAE,SAAS,EAAM,OAAQ,EAAM,SAEjC,SAAS,iBACP,UACC,IACkC,WAA5B,EAAoB,KAAkB,KAE7C,CAAE,SAAS,EAAM,OAA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,SAGhB,IAAmB,MAKnD,EAAqC,CACzC,MAAO,EACP,UAAW,EACX,QANuB,EAAc,EAAW,UAAW,GAAM,EAAE,QAAU,GAAe,EAAW,QAQzG,KAAK,KAAiC,yBAA0B,EAElE,GAEJ"}
1
+ {"version":3,"file":"index.js","names":["styles","BaseGridPlugin","GridClasses","supportsPopover","HTMLElement","prototype","showPopover","createDragAlternativeMenu","id","className","root","opened","disposed","abort","AbortController","close","hidePopover","hidden","document","addEventListener","e","composedPath","includes","capture","signal","key","element","open","anchor","label","actions","length","el","createElement","setAttribute","next","relatedTarget","Node","contains","build","host","closest","body","parentNode","appendChild","replaceChildren","action","btn","type","textContent","disabled","run","a","getBoundingClientRect","box","left","Math","max","min","window","innerWidth","width","below","bottom","top","height","innerHeight","style","round","place","querySelector","focus","dispose","remove","VisibilityPlugin","static","name","required","reason","queries","description","styles","defaultConfig","columnListElement","isDragging","draggedField","draggedIndex","dropIndex","draggedGroupId","draggedGroupFields","moveMenu","clearDragClasses","container","querySelectorAll","forEach","r","classList","attach","grid","super","this","gridElement","requestAnimationFrame","rebuildToggles","disconnectSignal","detach","processColumns","columns","col","__element","hasAttribute","getAttribute","lockVisible","handleQuery","query","params","context","isHeader","column","field","meta","lockVisibility","t","icon","order","hideColumn","getToolPanel","PANEL_ID","title","tooltip","render","renderPanelContent","shell","getPluginByName","show","openToolPanel","hide","closeToolPanel","toggle","isToolPanelOpen","toggleToolPanelSection","isColumnVisible","setColumnVisible","visible","getVisibleColumns","getAllColumns","filter","c","map","getHiddenColumns","showAll","showAllColumns","toggleColumn","toggleColumnVisibility","showColumn","isPanelVisible","expandedToolPanelSections","wrapper","columnList","showAllBtn","hasReorderPlugin","plugin","moveColumn","canMoveColumn","config","find","responses","reorderEnabled","innerHTML","allColumns","utility","fragments","currentFragments","every","f","group","renderFlatColumnList","fragment","renderGroupSection","fullIndex","indexOf","createColumnRow","groups","flat","g","fields","fieldToGroup","Map","set","computeFragments","currentGroup","currentCols","get","push","fragmentFields","header","draggable","add","setupGroupDragListeners","headerLabel","groupCheckbox","visibleCount","allLocked","checked","indeterminate","newVisible","setTimeout","headerText","handle","setIcon","wireMoveHandle","groupMoveActions","insertBefore","allColumnsFullList","findIndex","row","index","String","setupDragListeners","labelWrapper","checkbox","text","columnMoveActions","tabIndex","requestColumnMove","fromIndex","effectiveToIndex","targetField","toIndex","emit","from","landable","i","at","fieldsAt","first","last","executeGroupDrop","dataTransfer","effectAllowed","setData","preventDefault","rect","midY","before","clientY","draggedFields","targetFields","currentOrder","remaining","anchorField","insertAt","insertIndex","draggedInOrder","splice","reorderPlugin","setColumnOrder","detail"],"sources":["../../../../../../libs/grid/src/lib/core/constants.ts","../../../../../../libs/grid/src/lib/plugins/shared/drag-alternative-menu.ts","../../../../../../libs/grid/src/lib/plugins/visibility/visibility.css?inline","../../../../../../libs/grid/src/lib/plugins/visibility/visibility-plugin.ts"],"sourcesContent":["/**\n * Grid DOM Constants\n *\n * Centralized constants for CSS classes, data attributes, and selectors\n * used throughout the grid. Use these instead of magic strings.\n *\n * Note: Some constants here are used by plugins but defined in core because:\n * 1. The core CSS needs to style these elements (e.g., sticky positioning)\n * 2. Multiple plugins may share the same class names\n *\n * Plugins can define their own additional constants and export them.\n * See each plugin's index.ts for plugin-specific exports.\n */\n\n/**\n * CSS selector for focusable editor elements within a cell.\n * Used by EditingPlugin, UndoRedoPlugin, and keyboard navigation. Defined here\n * (a leaf module) rather than in `rows.ts` so `keyboard.ts` can consume it\n * without creating a rows ↔ keyboard import cycle.\n */\nexport const FOCUSABLE_EDITOR_SELECTOR =\n 'input,select,textarea,[contenteditable=\"true\"],[contenteditable=\"\"],[tabindex]:not([tabindex=\"-1\"])';\n\n// #region CSS Classes\n\n/**\n * CSS class names used in the grid's DOM.\n * Use these when adding/removing classes or querying elements.\n *\n * Classes are organized by:\n * - Core: Used by the grid core for structure and basic functionality\n * - Shared: Used by multiple features/plugins, styled by core CSS\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport const GridClasses = {\n // ─── Core Structure ───────────────────────────────────────────────\n ROOT: 'tbw-grid-root',\n HEADER: 'header',\n HEADER_ROW: 'header-row',\n HEADER_CELL: 'header-cell',\n\n // Body structure\n ROWS_VIEWPORT: 'rows-viewport',\n ROWS_SPACER: 'rows-spacer',\n ROWS_CONTAINER: 'rows',\n\n // Row elements\n DATA_ROW: 'data-grid-row',\n GROUP_ROW: 'group-row',\n\n // Cell elements\n DATA_CELL: 'cell',\n\n // ─── Core States ──────────────────────────────────────────────────\n SELECTED: 'selected',\n FOCUSED: 'focused',\n EDITING: 'editing',\n EXPANDED: 'expanded',\n COLLAPSED: 'collapsed',\n DRAGGING: 'dragging',\n RESIZING: 'resizing',\n\n // Sorting (core feature)\n SORTABLE: 'sortable',\n SORTED_ASC: 'sorted-asc',\n SORTED_DESC: 'sorted-desc',\n\n // Visibility\n HIDDEN: 'hidden',\n\n // ─── Shared Classes (used by plugins, styled by core CSS) ────────\n // These are defined here because core CSS provides the base styling.\n // Plugins apply these classes; core CSS defines how they look.\n\n // Sticky positioning (PinnedColumnsPlugin applies, core CSS styles)\n STICKY_LEFT: 'sticky-left',\n STICKY_RIGHT: 'sticky-right',\n\n // Pinned rows (PinnedRowsPlugin applies, core CSS styles)\n PINNED_TOP: 'pinned-top',\n PINNED_BOTTOM: 'pinned-bottom',\n\n // Tree structure (TreePlugin applies, core CSS styles)\n TREE_TOGGLE: 'tree-toggle',\n TREE_INDENT: 'tree-indent',\n\n // Grouping (GroupingRowsPlugin applies, core CSS styles)\n GROUP_TOGGLE: 'group-toggle',\n GROUP_LABEL: 'group-label',\n GROUP_COUNT: 'group-count',\n\n // Selection (SelectionPlugin applies, core CSS styles)\n RANGE_SELECTION: 'range-selection',\n SELECTION_OVERLAY: 'selection-overlay',\n} as const;\n\n// #endregion\n\n// #region Data Attributes\n\n/**\n * Data attribute names used on grid elements.\n * Use these when getting/setting data attributes.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport const GridDataAttrs = {\n // ─── Core Attributes ──────────────────────────────────────────────\n FIELD: 'data-field',\n\n /**\n * Marks a `title` the grid itself put on a cell to reveal ellipsised text\n * (WCAG SC 1.4.12). Anything that sets its own `title` on a cell must clear\n * this, or the grid will later mistake that title for its own and replace it.\n *\n * @since 3.6.0\n */\n TRUNCATED: 'data-tbw-truncated',\n\n // ─── Shared Attributes (used by plugins) ──────────────────────────\n GROUP_KEY: 'data-group-key', // GroupingRowsPlugin\n} as const;\n\n// #endregion\n\n// #region Selectors\n\n/**\n * Common CSS selectors for querying grid elements.\n * Built from the class constants for consistency.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport const GridSelectors = {\n ROOT: `.${GridClasses.ROOT}`,\n HEADER: `.${GridClasses.HEADER}`,\n HEADER_ROW: `.${GridClasses.HEADER_ROW}`,\n HEADER_CELL: `.${GridClasses.HEADER_CELL}`,\n ROWS_VIEWPORT: `.${GridClasses.ROWS_VIEWPORT}`,\n ROWS_CONTAINER: `.${GridClasses.ROWS_CONTAINER}`,\n DATA_ROW: `.${GridClasses.DATA_ROW}`,\n DATA_CELL: `.${GridClasses.DATA_CELL}`,\n GROUP_ROW: `.${GridClasses.GROUP_ROW}`,\n\n // By data attribute\n CELL_BY_FIELD: (field: string) => `.${GridClasses.DATA_CELL}[${GridDataAttrs.FIELD}=\"${field}\"]`,\n\n // State selectors\n SELECTED_ROWS: `.${GridClasses.DATA_ROW}.${GridClasses.SELECTED}`,\n EDITING_CELL: `.${GridClasses.DATA_CELL}.${GridClasses.EDITING}`,\n} as const;\n\n// #endregion\n\n// #region CSS Custom Properties\n\n/**\n * CSS custom property names for theming.\n * Use these when programmatically setting styles.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport const GridCSSVars = {\n // Colors\n COLOR_BG: '--tbw-color-bg',\n COLOR_FG: '--tbw-color-fg',\n COLOR_FG_MUTED: '--tbw-color-fg-muted',\n COLOR_BORDER: '--tbw-color-border',\n COLOR_ACCENT: '--tbw-color-accent',\n COLOR_HEADER_BG: '--tbw-color-header-bg',\n COLOR_HEADER_FG: '--tbw-color-header-fg',\n COLOR_SELECTION: '--tbw-color-selection',\n COLOR_ROW_HOVER: '--tbw-color-row-hover',\n COLOR_ROW_ALT: '--tbw-color-row-alt',\n\n // Sizing\n ROW_HEIGHT: '--tbw-row-height',\n HEADER_HEIGHT: '--tbw-header-height',\n CELL_PADDING: '--tbw-cell-padding',\n\n // Typography\n FONT_FAMILY: '--tbw-font-family',\n FONT_SIZE: '--tbw-font-size',\n\n // Borders\n BORDER_RADIUS: '--tbw-border-radius',\n FOCUS_OUTLINE: '--tbw-focus-outline',\n} as const;\n\n// #endregion\n\n// Type helpers\n\n/**\n * Union of all CSS class names used in the grid's DOM.\n * Use `GridClasses` to access individual values by key.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport type GridClassName = (typeof GridClasses)[keyof typeof GridClasses];\n\n/**\n * Union of all `data-*` attribute names used on grid elements.\n * Use `GridDataAttrs` to access individual values by key.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport type GridDataAttr = (typeof GridDataAttrs)[keyof typeof GridDataAttrs];\n\n/**\n * Union of all CSS custom property names (`--tbw-*`) available for theming.\n * Use `GridCSSVars` to access individual values by key.\n *\n * @category Plugin Development\n * @since 0.1.1\n */\nexport type GridCSSVar = (typeof GridCSSVars)[keyof typeof GridCSSVars];\n","/**\n * Generic click-only action menu — the shared building block for WCAG 2.2\n * SC 2.5.7 \"Dragging Movements\" alternatives in plugins.\n *\n * Every drag affordance in the grid needs a path that works with plain clicks\n * or taps. A keyboard equivalent is **not** enough: SC 2.5.7 is specifically\n * about pointer input, and the W3C Understanding text calls out \"a pop-up menu\n * after tap\" as a conforming alternative. This module is that pop-up.\n *\n * Lives under `plugins/shared/` on purpose: each plugin bundle is built\n * self-contained, so this code is duplicated into the plugins that use it and\n * never lands in the core `index.js` budget.\n *\n * @since 3.6.0\n * @internal\n */\n\n/** Gap between the anchor element and the menu, in px. */\nconst ANCHOR_GAP_PX = 6;\n\n/** Runtime check — happy-dom and older browsers may lack the Popover API. */\nfunction supportsPopover(): boolean {\n return typeof HTMLElement.prototype?.showPopover === 'function';\n}\n\nlet hoverlessQuery: MediaQueryList | null | undefined;\n\n/** Whether the primary pointer cannot hover (touch, most switch devices). */\nfunction isHoverless(): boolean {\n if (hoverlessQuery === undefined) hoverlessQuery = globalThis.matchMedia?.('(hover: none)') ?? null;\n return hoverlessQuery?.matches ?? false;\n}\n\n/**\n * Whether a plugin should also expose its drag alternative as a dedicated\n * inline control, on top of the menu that is always available.\n *\n * Hover-less pointers get one unconditionally — a control revealed on hover is\n * unreachable when nothing can hover, and long-press is the wrong fallback for\n * the tremor and low-dexterity users SC 2.5.7 exists for.\n *\n * Driven by `a11y.dragAlternatives` on the grid config.\n */\nexport function prefersInlineDragAlternative(grid: {\n effectiveConfig?: { a11y?: { dragAlternatives?: 'menu' | 'inline' } };\n}): boolean {\n return grid.effectiveConfig?.a11y?.dragAlternatives === 'inline' || isHoverless();\n}\n\n/** One clickable entry in the menu. */\nexport interface DragAlternativeAction {\n /** Visible text, also the accessible name. */\n label: string;\n /** Render the entry but refuse the click (e.g. \"Move up\" on the first row). */\n disabled?: boolean;\n /** Invoked on click; the menu closes first so focus handling is predictable. */\n run(): void;\n}\n\nexport interface DragAlternativeMenu {\n /**\n * Show `actions` anchored to `anchor`, with `label` as the group's accessible\n * name. Mounted inside the anchor's grid host so it inherits theme tokens.\n */\n open(anchor: HTMLElement, label: string, actions: readonly DragAlternativeAction[]): void;\n /** Hide the menu. Safe to call when already closed. */\n close(): void;\n /** Remove the element and every document-level listener. */\n dispose(): void;\n /** The menu element, or `null` before the first {@link DragAlternativeMenu.open}. */\n readonly element: HTMLElement | null;\n}\n\n/**\n * Create a menu instance.\n *\n * @param id - DOM id for the menu element, unique per owning plugin.\n * @param className - Root class name, so each plugin can style its own menu.\n */\nexport function createDragAlternativeMenu(id: string, className: string): DragAlternativeMenu {\n let root: HTMLDivElement | null = null;\n let opened = false;\n let disposed = false;\n const abort = new AbortController();\n\n function close(): void {\n if (!opened || !root) return;\n opened = false;\n if (supportsPopover()) root.hidePopover();\n root.hidden = true;\n }\n\n function build(): HTMLDivElement {\n const el = document.createElement('div');\n el.id = id;\n el.className = className;\n el.setAttribute('popover', 'manual');\n el.setAttribute('role', 'group');\n // Without the Popover API there is no UA `display: none`, so hide it here.\n el.hidden = true;\n // Tabbing past either end dismisses instead of stranding the user — the\n // menu has no visible trigger to tab back to. A null `relatedTarget` (click\n // focus in Firefox/Safari, focus leaving the document) is ignored.\n el.addEventListener(\n 'focusout',\n (e) => {\n const next = (e as FocusEvent).relatedTarget;\n if (next instanceof Node && !el.contains(next)) close();\n },\n { signal: abort.signal },\n );\n return el;\n }\n\n /**\n * Position against the anchor in viewport coordinates. The menu lives in the\n * top layer, so its containing block is the viewport regardless of where the\n * anchor sits in the DOM.\n */\n function place(anchor: HTMLElement): void {\n if (!root) return;\n const a = anchor.getBoundingClientRect();\n const box = root.getBoundingClientRect();\n const left = Math.max(4, Math.min(a.left, window.innerWidth - box.width - 4));\n const below = a.bottom + ANCHOR_GAP_PX;\n const top = below + box.height <= window.innerHeight ? below : Math.max(4, a.top - ANCHOR_GAP_PX - box.height);\n root.style.left = `${Math.round(left)}px`;\n root.style.top = `${Math.round(top)}px`;\n }\n\n // Any pointer press outside the menu dismisses it. Capture phase so the press\n // that lands on a grid cell still reaches its own handler afterwards.\n document.addEventListener(\n 'pointerdown',\n (e) => {\n if (opened && root && !e.composedPath().includes(root)) close();\n },\n { capture: true, signal: abort.signal },\n );\n document.addEventListener(\n 'keydown',\n (e) => {\n if ((e as KeyboardEvent).key === 'Escape') close();\n },\n { capture: true, signal: abort.signal },\n );\n\n return {\n get element() {\n return root;\n },\n open(anchor, label, actions) {\n if (disposed || actions.length === 0) return;\n if (!root) root = build();\n // Mount inside the grid host (light DOM) so theme custom properties and\n // `color-scheme` cascade in; the top layer keeps it out of overflow.\n const host = anchor.closest<HTMLElement>('tbw-grid, [data-tbw-grid]') ?? document.body;\n if (root.parentNode !== host) host.appendChild(root);\n root.setAttribute('aria-label', label);\n root.replaceChildren();\n for (const action of actions) {\n const btn = document.createElement('button');\n btn.type = 'button';\n btn.className = `${className}-item`;\n btn.textContent = action.label;\n btn.disabled = action.disabled === true;\n btn.addEventListener('click', () => {\n close();\n action.run();\n });\n root.appendChild(btn);\n }\n root.hidden = false;\n if (!opened && supportsPopover()) root.showPopover();\n opened = true;\n place(anchor);\n root.querySelector<HTMLButtonElement>('button:not([disabled])')?.focus();\n },\n close,\n dispose() {\n disposed = true;\n close();\n abort.abort();\n root?.remove();\n root = null;\n },\n };\n}\n","@layer tbw-plugins {\n .tbw-visibility-content {\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .tbw-visibility-list {\n flex: 1;\n overflow-y: auto;\n padding: var(--tbw-panel-padding, var(--tbw-spacing-md, 0.5rem));\n }\n\n .tbw-visibility-row {\n display: flex;\n align-items: center;\n gap: var(--tbw-panel-gap, var(--tbw-spacing-md, 0.5rem));\n padding: var(--tbw-menu-item-padding, 0.375rem 0.25rem);\n cursor: pointer;\n font-size: var(--tbw-font-size-sm, 0.8125rem);\n border-radius: var(--tbw-border-radius, 0.25rem);\n position: relative;\n }\n .tbw-visibility-row:hover {\n background: var(--tbw-visibility-hover, var(--tbw-color-row-hover));\n }\n .tbw-visibility-row input[type='checkbox'] {\n cursor: pointer;\n }\n .tbw-visibility-row.locked span {\n color: var(--tbw-color-fg-muted);\n }\n\n /* Drag handle */\n .tbw-visibility-handle {\n cursor: grab;\n color: var(--tbw-color-fg-muted);\n font-size: var(--tbw-font-size-2xs, 0.625rem);\n letter-spacing: -2px;\n user-select: none;\n flex-shrink: 0;\n }\n .tbw-visibility-row.reorderable:hover .tbw-visibility-handle {\n color: var(--tbw-color-fg);\n }\n /* Label wrapper for checkbox and text */\n .tbw-visibility-label {\n display: flex;\n align-items: center;\n gap: var(--tbw-panel-gap, var(--tbw-spacing-md, 0.5rem));\n flex: 1;\n cursor: pointer;\n }\n\n /* Drag states */\n .tbw-visibility-row.dragging {\n opacity: 0.5;\n cursor: grabbing;\n }\n .tbw-visibility-row.drop-before::before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n height: 2px;\n background: var(--tbw-visibility-indicator, var(--tbw-color-accent));\n }\n .tbw-visibility-row.drop-after::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 2px;\n background: var(--tbw-visibility-indicator, var(--tbw-color-accent));\n }\n\n .tbw-visibility-show-all {\n margin: var(--tbw-panel-padding, var(--tbw-spacing-md, 0.5rem));\n padding: var(--tbw-button-padding, 0.5rem 0.75rem);\n border: 1px solid var(--tbw-visibility-border, var(--tbw-color-border));\n border-radius: var(--tbw-border-radius, 0.25rem);\n background: var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));\n color: var(--tbw-color-fg);\n cursor: pointer;\n font-size: var(--tbw-font-size-sm, 0.8125rem);\n }\n .tbw-visibility-show-all:hover {\n background: var(--tbw-visibility-hover, var(--tbw-color-row-hover));\n }\n\n /* Group header */\n .tbw-visibility-group-header {\n display: flex;\n align-items: center;\n padding: var(--tbw-menu-item-padding, 0.375rem 0.25rem);\n font-size: var(--tbw-font-size-sm, 0.8125rem);\n font-weight: 600;\n color: var(--tbw-color-fg);\n border-bottom: 1px solid var(--tbw-color-border);\n margin-top: var(--tbw-spacing-sm, 0.25rem);\n position: relative;\n }\n .tbw-visibility-group-header:first-child {\n margin-top: 0;\n }\n .tbw-visibility-group-header .tbw-visibility-label {\n gap: var(--tbw-panel-gap, var(--tbw-spacing-md, 0.5rem));\n }\n\n /* Reorderable group header */\n .tbw-visibility-group-header.reorderable {\n cursor: grab;\n }\n .tbw-visibility-group-header.reorderable:hover {\n background: var(--tbw-visibility-hover, var(--tbw-color-row-hover));\n }\n .tbw-visibility-group-header .tbw-visibility-handle {\n cursor: grab;\n color: var(--tbw-color-fg-muted);\n font-size: var(--tbw-font-size-2xs, 0.625rem);\n letter-spacing: -2px;\n user-select: none;\n flex-shrink: 0;\n }\n .tbw-visibility-group-header.reorderable:hover .tbw-visibility-handle {\n color: var(--tbw-color-fg);\n }\n\n /* Coarse pointer (touch): handles always in active colour and large enough to tap */\n @media (hover: none) {\n .tbw-visibility-row.reorderable .tbw-visibility-handle,\n .tbw-visibility-group-header.reorderable .tbw-visibility-handle {\n color: var(--tbw-color-fg);\n }\n }\n\n @media (pointer: coarse) {\n .tbw-visibility-handle {\n min-width: var(--tbw-touch-target-min, 24px);\n min-height: var(--tbw-touch-target-min, 24px);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n }\n\n /* Group drag states */\n .tbw-visibility-group-header.dragging {\n opacity: 0.5;\n cursor: grabbing;\n }\n .tbw-visibility-group-header.drop-before::before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n height: 2px;\n background: var(--tbw-visibility-indicator, var(--tbw-color-accent));\n }\n .tbw-visibility-group-header.drop-after::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n height: 2px;\n background: var(--tbw-visibility-indicator, var(--tbw-color-accent));\n }\n\n /* Indented column rows within a group */\n .tbw-visibility-row--grouped {\n padding-left: calc(var(--tbw-panel-padding, var(--tbw-spacing-md, 0.5rem)) + 0.75rem);\n }\n\n /* ===== Handle move menu (WCAG 2.2 SC 2.5.7) ===== */\n\n .tbw-visibility-move-menu {\n position: fixed;\n margin: 0;\n padding: 4px;\n display: flex;\n flex-direction: column;\n min-width: 10rem;\n background: var(--tbw-color-panel-bg, light-dark(#fff, #1e1e1e));\n color: var(--tbw-color-panel-fg, light-dark(#1a1a1a, #eaeaea));\n border: 1px solid var(--tbw-color-border, light-dark(#d0d0d0, #3a3a3a));\n border-radius: var(--tbw-border-radius, 0.25rem);\n box-shadow: var(--tbw-shadow-panel, 0 4px 12px light-dark(rgb(0 0 0 / 20%), rgb(0 0 0 / 50%)));\n font: inherit;\n z-index: 10001;\n\n &[hidden] {\n display: none;\n }\n }\n\n .tbw-visibility-move-menu-item {\n min-height: var(--tbw-touch-target-min, 24px);\n padding: 4px 8px;\n text-align: start;\n background: none;\n color: inherit;\n font: inherit;\n border: 0;\n /* Themes set radii for much larger surfaces (Material uses 12px), which\n turns a 24px row into a lozenge. */\n border-radius: min(var(--tbw-border-radius, 0.25rem), 6px);\n cursor: pointer;\n\n &:hover:not(:disabled) {\n background: var(--tbw-color-row-hover, light-dark(#00000010, #ffffff14));\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: default;\n }\n }\n} /* End @layer tbw-plugins */\n","/**\n * Column Visibility Plugin (Class-based)\n *\n * Provides a UI for column visibility control via the shell's tool panel system.\n * Column visibility is a core grid feature - this plugin provides:\n * - A tool panel for column visibility management (registered with the shell)\n * - Backward-compatible API methods that delegate to grid.setColumnVisible(), etc.\n *\n * The grid emits 'column-visibility' events when columns are shown/hidden,\n * allowing consumers to save user preferences.\n *\n * When a reorder plugin is present, column rows become draggable for reordering.\n * Drag-drop emits 'column-reorder-request' events that the ReorderPlugin can listen for.\n */\n\nimport { GridClasses } from '../../core/constants';\nimport {\n BaseGridPlugin,\n type PluginDependency,\n type PluginManifest,\n type PluginQuery,\n} from '../../core/plugin/base-plugin';\nimport type { ColumnConfig, ColumnInternal } from '../../core/types';\nimport type { ContextMenuParams, HeaderContextMenuItem } from '../context-menu/types';\nimport {\n createDragAlternativeMenu,\n type DragAlternativeAction,\n type DragAlternativeMenu,\n} from '../shared/drag-alternative-menu';\nimport type { ToolPanelDefinition } from '../shell/types';\nimport type { ColumnGroupInfo, ColumnReorderRequestDetail, VisibilityConfig } from './types';\nimport styles from './visibility.css?inline';\n\n/** Column metadata shape returned by `grid.getAllColumns()`. */\ntype ColumnEntry = {\n field: string;\n header: string;\n visible: boolean;\n lockVisible?: boolean;\n utility?: boolean;\n};\n\n/** A contiguous run of same-group columns, or a single ungrouped column. */\ntype PanelFragment = { group: ColumnGroupInfo | null; columns: ColumnEntry[] };\n\n/**\n * Column Visibility Plugin for tbw-grid\n *\n * Gives users control over which columns are displayed. Hide less important columns\n * by default, let users toggle them via a column chooser UI, or programmatically\n * show/hide columns based on user preferences or screen size.\n *\n * > **Optional Enhancement:** When ReorderPlugin is also loaded, columns in the\n * > visibility panel become draggable for reordering.\n *\n * ## Installation\n *\n * ```ts\n * import { VisibilityPlugin } from '@toolbox-web/grid/plugins/visibility';\n * ```\n *\n * ## Column Configuration\n *\n * | Property | Type | Default | Description |\n * |----------|------|---------|-------------|\n * | `visible` | `boolean` | `true` | Initial visibility state |\n * | `lockVisible` | `boolean` | `false` | Prevent user from toggling (legacy `meta.lockVisibility` is honored) |\n *\n * ## CSS Custom Properties\n *\n * | Property | Default | Description |\n * |----------|---------|-------------|\n * | `--tbw-visibility-hover` | `var(--tbw-color-row-hover)` | Row hover background |\n * | `--tbw-panel-padding` | `0.75em` | Panel content padding |\n * | `--tbw-panel-gap` | `0.5em` | Gap between items |\n *\n * @example Columns Hidden by Default\n * ```ts\n * import { queryGrid } from '@toolbox-web/grid';\n * import { VisibilityPlugin } from '@toolbox-web/grid/plugins/visibility';\n *\n * const grid = queryGrid('tbw-grid');\n * grid.gridConfig = {\n * columns: [\n * { field: 'id', header: 'ID' },\n * { field: 'name', header: 'Name' },\n * { field: 'phone', header: 'Phone', visible: false }, // Hidden by default\n * { field: 'address', header: 'Address', visible: false },\n * ],\n * plugins: [new VisibilityPlugin()],\n * };\n *\n * // Toggle programmatically\n * const plugin = grid.getPluginByName('visibility');\n * plugin.showColumn('phone');\n * ```\n *\n * @example With Drag-to-Reorder\n * ```ts\n * import { VisibilityPlugin } from '@toolbox-web/grid/plugins/visibility';\n * import { ReorderPlugin } from '@toolbox-web/grid/plugins/reorder-columns';\n *\n * grid.gridConfig = {\n * plugins: [\n * new ReorderPlugin(), // Enables drag-drop in visibility panel\n * new VisibilityPlugin(),\n * ],\n * };\n * ```\n *\n * @see {@link VisibilityConfig} for configuration options\n * @see ReorderPlugin for drag-to-reorder integration\n *\n * @internal Extends BaseGridPlugin\n * @since 0.1.1\n */\nexport class VisibilityPlugin extends BaseGridPlugin<VisibilityConfig> {\n /**\n * Plugin dependencies.\n *\n * - `shell` (required): VisibilityPlugin renders its column list inside a\n * shell tool panel. Without the shell plugin there is no host for the\n * panel. The shell auto-registers today, so this only bites once the\n * auto-register is removed at v3 (#370).\n * - `reorder` (optional): when present, columns in the visibility panel\n * become draggable.\n * @internal\n */\n static override readonly dependencies: PluginDependency[] = [\n { name: 'shell', required: true, reason: 'VisibilityPlugin renders its column list in a shell tool panel' },\n { name: 'reorder', required: false, reason: 'Enables drag-to-reorder columns in visibility panel' },\n ];\n\n /**\n * Plugin manifest - declares handled queries.\n * @internal\n */\n static override readonly manifest: PluginManifest = {\n queries: [\n {\n type: 'getContextMenuItems',\n description: 'Contributes \"Hide column\" item to the header context menu',\n },\n ],\n };\n\n /** @internal */\n readonly name = 'visibility';\n\n /** Tool panel ID for shell integration */\n static readonly PANEL_ID = 'columns';\n /** @internal */\n override readonly styles = styles;\n\n /** @internal */\n protected override get defaultConfig(): Partial<VisibilityConfig> {\n return {};\n }\n\n // #region Internal State\n private columnListElement: HTMLElement | null = null;\n\n // Drag state for reorder integration\n private isDragging = false;\n private draggedField: string | null = null;\n private draggedIndex: number | null = null;\n private dropIndex: number | null = null;\n /** When dragging a group, holds the group ID; null for individual column drags. */\n private draggedGroupId: string | null = null;\n /** Fields belonging to the group currently being dragged. */\n private draggedGroupFields: string[] = [];\n /** Click-only move menu (SC 2.5.7). One instance shared by every drag handle. */\n private moveMenu: DragAlternativeMenu | null = null;\n\n /** Clear drag-related classes from all rows and group headers in a list. */\n private clearDragClasses(container: HTMLElement): void {\n container.querySelectorAll('.tbw-visibility-row, .tbw-visibility-group-header').forEach((r) => {\n r.classList.remove(GridClasses.DRAGGING, 'drop-target', 'drop-before', 'drop-after');\n });\n }\n // #endregion\n\n // #region Lifecycle\n\n /** @internal */\n override attach(grid: import('../../core/plugin/base-plugin').GridElement): void {\n super.attach(grid);\n\n // Listen for column-move events (emitted by ReorderPlugin after any reorder,\n // including header drag-drop and visibility panel drag-drop) to keep the\n // panel list in sync with the grid's column order.\n this.gridElement.addEventListener(\n 'column-move',\n () => {\n if (this.columnListElement) {\n // column-move fires BEFORE setColumnOrder runs. Defer the rebuild\n // to allow the full reorder cycle (setColumnOrder + renderHeader +\n // refreshVirtualWindow) to complete before reading the new order.\n // Use RAF to run after the current synchronous work and any\n // animation frames queued by the animation system.\n requestAnimationFrame(() => {\n if (this.columnListElement) {\n this.rebuildToggles(this.columnListElement);\n }\n });\n }\n },\n { signal: this.disconnectSignal },\n );\n }\n\n /** @internal */\n override detach(): void {\n this.columnListElement = null;\n this.isDragging = false;\n this.draggedField = null;\n this.draggedIndex = null;\n this.dropIndex = null;\n this.moveMenu?.dispose();\n this.moveMenu = null;\n }\n // #endregion\n\n // #region Render Hooks\n\n /**\n * Read declarative visibility attributes from the originating\n * `<tbw-grid-column>` element (issue #272). `hidden` and `lock-visible`\n * only seed the initial state — the `=== undefined` guards ensure a runtime\n * toggle (`setColumnVisible`, which writes `col.hidden = false`) or an\n * explicit config value always wins over the attribute.\n * @internal\n */\n override processColumns(columns: ColumnConfig[]): ColumnConfig[] {\n for (const col of columns) {\n const el = (col as ColumnInternal).__element;\n if (!el) continue;\n if (col.hidden === undefined && el.hasAttribute('hidden') && el.getAttribute('hidden') !== 'false') {\n col.hidden = true;\n }\n if (\n col.lockVisible === undefined &&\n el.hasAttribute('lock-visible') &&\n el.getAttribute('lock-visible') !== 'false'\n ) {\n col.lockVisible = true;\n }\n }\n return columns;\n }\n // #endregion\n\n // #region Query Handlers\n\n /**\n * Handle inter-plugin queries.\n * Contributes a \"Hide column\" item to the header context menu.\n * @internal\n */\n override handleQuery(query: PluginQuery): unknown {\n if (query.type === 'getContextMenuItems') {\n const params = query.context as ContextMenuParams;\n if (!params.isHeader) return undefined;\n\n const column = params.column as ColumnConfig;\n if (!column?.field) return undefined;\n\n // Don't offer \"Hide\" for locked-visibility columns\n // (top-level `lockVisible` preferred; legacy `meta.lockVisibility` honored for back-compat)\n if (column.lockVisible || column.meta?.lockVisibility) return undefined;\n\n const items: HeaderContextMenuItem[] = [\n {\n id: 'visibility/hide-column',\n label: this.t('columns.hideColumn', 'Hide Column'),\n icon: '👁',\n order: 30,\n action: () => this.hideColumn(column.field),\n },\n ];\n\n return items;\n }\n return undefined;\n }\n // #endregion\n\n // #region Shell Integration\n\n /**\n * Register the column visibility tool panel with the shell.\n * @internal\n */\n override getToolPanel(): ToolPanelDefinition | undefined {\n return {\n id: VisibilityPlugin.PANEL_ID,\n title: this.t('columns.panelTitle', 'Columns'),\n icon: '☰',\n tooltip: 'Column visibility',\n order: 100, // High order so it appears last\n render: (container) => this.renderPanelContent(container),\n };\n }\n // #endregion\n\n // #region Public API\n\n /**\n * Resolve the shell plugin (#370). The visibility tool panel lives in the\n * shell, so panel open/close/toggle is delegated to the ShellPlugin instance\n * rather than the deprecated core `grid.*` shell delegates.\n */\n #shell() {\n return this.grid.getPluginByName('shell');\n }\n\n /**\n * Show the visibility sidebar panel.\n * Opens the tool panel and ensures this section is expanded.\n */\n show(): void {\n this.#shell()?.openToolPanel(VisibilityPlugin.PANEL_ID);\n }\n\n /**\n * Hide the visibility sidebar panel.\n */\n hide(): void {\n this.#shell()?.closeToolPanel();\n }\n\n /**\n * Toggle the visibility sidebar panel section.\n */\n toggle(): void {\n const shell = this.#shell();\n // If tool panel is closed, open it first\n if (!shell?.isToolPanelOpen) {\n shell?.openToolPanel();\n }\n shell?.toggleToolPanelSection(VisibilityPlugin.PANEL_ID);\n }\n\n /**\n * Check if a specific column is visible.\n * Delegates to grid.isColumnVisible().\n * @param field - The field name to check\n * @returns True if the column is visible\n */\n isColumnVisible(field: string): boolean {\n return this.grid.isColumnVisible(field);\n }\n\n /**\n * Set visibility for a specific column.\n * Delegates to grid.setColumnVisible().\n * @param field - The field name of the column\n * @param visible - Whether the column should be visible\n */\n setColumnVisible(field: string, visible: boolean): void {\n this.grid.setColumnVisible(field, visible);\n }\n\n /**\n * Get list of all visible column fields.\n * @returns Array of visible field names\n */\n getVisibleColumns(): string[] {\n return this.grid\n .getAllColumns()\n .filter((c) => c.visible)\n .map((c) => c.field);\n }\n\n /**\n * Get list of all hidden column fields.\n * @returns Array of hidden field names\n */\n getHiddenColumns(): string[] {\n return this.grid\n .getAllColumns()\n .filter((c) => !c.visible)\n .map((c) => c.field);\n }\n\n /**\n * Show all columns.\n * Delegates to grid.showAllColumns().\n */\n showAll(): void {\n this.grid.showAllColumns();\n }\n\n /**\n * Toggle visibility for a specific column.\n * Delegates to grid.toggleColumnVisibility().\n * @param field - The field name of the column\n */\n toggleColumn(field: string): void {\n this.grid.toggleColumnVisibility(field);\n }\n\n /**\n * Show a specific column.\n * Delegates to grid.setColumnVisible().\n * @param field - The field name of the column to show\n */\n showColumn(field: string): void {\n this.setColumnVisible(field, true);\n }\n\n /**\n * Hide a specific column.\n * Delegates to grid.setColumnVisible().\n * @param field - The field name of the column to hide\n */\n hideColumn(field: string): void {\n this.setColumnVisible(field, false);\n }\n\n /**\n * Get all columns with their visibility status.\n * Useful for building visibility UI.\n * @returns Array of column info with visibility status\n */\n getAllColumns(): Array<{\n field: string;\n header: string;\n visible: boolean;\n lockVisible?: boolean;\n utility?: boolean;\n }> {\n return this.grid.getAllColumns();\n }\n\n /**\n * Check if the sidebar panel is currently open.\n * @returns True if the panel section is expanded\n */\n isPanelVisible(): boolean {\n const shell = this.#shell();\n return !!shell?.isToolPanelOpen && shell.expandedToolPanelSections.includes(VisibilityPlugin.PANEL_ID);\n }\n // #endregion\n\n // #region Private Methods\n\n /**\n * Render the panel content into the shell's tool panel container.\n * Returns a cleanup function.\n */\n private renderPanelContent(container: HTMLElement): (() => void) | void {\n // Create content wrapper\n const wrapper = document.createElement('div');\n wrapper.className = 'tbw-visibility-content';\n\n // Column list container\n const columnList = document.createElement('div');\n columnList.className = 'tbw-visibility-list';\n wrapper.appendChild(columnList);\n\n // Show all button\n const showAllBtn = document.createElement('button');\n showAllBtn.type = 'button';\n showAllBtn.className = 'tbw-visibility-show-all';\n showAllBtn.textContent = this.t('columns.showAll', 'Show All');\n showAllBtn.addEventListener('click', () => {\n this.grid.showAllColumns();\n this.rebuildToggles(columnList);\n });\n wrapper.appendChild(showAllBtn);\n\n // Store reference\n this.columnListElement = columnList;\n\n // Build initial toggles\n this.rebuildToggles(columnList);\n\n // Append to container\n container.appendChild(wrapper);\n\n // Return cleanup function\n return () => {\n this.columnListElement = null;\n this.moveMenu?.close();\n wrapper.remove();\n };\n }\n\n /**\n * Check if a reorder plugin is present (by name to avoid static import).\n */\n private hasReorderPlugin(): boolean {\n const plugin = this.grid?.getPluginByName?.('reorder');\n // Duck-type check - just verify the plugin exists and has a moveColumn method\n return !!(plugin && typeof (plugin as { moveColumn?: unknown }).moveColumn === 'function');\n }\n\n /**\n * Ask the plugin system whether a column may be reordered.\n *\n * Looks up the real `ColumnConfig` by field (the projection from `getAllColumns()`\n * intentionally omits plugin-owned flags like `lockPosition`) and forwards it to\n * the `canMoveColumn` query handled by ReorderPlugin and vetoed by other plugins\n * (e.g. PinnedColumnsPlugin blocking sticky columns). Returns `false` when no\n * plugin answers, which keeps the panel non-draggable when reorder is absent.\n */\n private canMoveColumn(column: ColumnEntry): boolean {\n const config = this.grid.columns.find((c) => c.field === column.field);\n if (!config) return false;\n const responses = this.grid.query<boolean>('canMoveColumn', config);\n return responses.length > 0 && !responses.includes(false);\n }\n\n /**\n * Build the column toggle checkboxes.\n * When GroupingColumnsPlugin is present, renders columns under collapsible group headers.\n * Groups that are fragmented (same group split across non-contiguous positions) are\n * shown as separate sections to match the grid's visual layout.\n * When a reorder plugin is present, adds drag handles for reordering.\n */\n private rebuildToggles(columnList: HTMLElement): void {\n const reorderEnabled = this.hasReorderPlugin();\n\n columnList.innerHTML = '';\n\n // getAllColumns() returns columns in their effective display order\n // Filter out utility columns (e.g., expander column) as they're internal\n const allColumns = this.grid.getAllColumns().filter((c) => !c.utility);\n const fragments = this.currentFragments();\n\n if (fragments.every((f) => !f.group)) {\n // No grouping — render flat list (original behavior)\n this.renderFlatColumnList(allColumns, reorderEnabled, columnList);\n return;\n }\n\n for (const fragment of fragments) {\n if (fragment.group) {\n this.renderGroupSection(fragment.group, fragment.columns, reorderEnabled, columnList);\n } else {\n // Ungrouped column — render as individual row\n const fullIndex = allColumns.indexOf(fragment.columns[0]);\n columnList.appendChild(this.createColumnRow(fragment.columns[0], fullIndex, reorderEnabled, columnList));\n }\n }\n }\n\n /**\n * The panel's current top-level rows, in display order: one entry per group\n * fragment plus one per ungrouped column. Recomputed from live grid state on\n * every call so the move menu can never act on a stale panel.\n *\n * Walks columns in display order and detects contiguous fragments. A fragment\n * is a run of consecutive columns belonging to the same group. Fragmented\n * groups (same group ID at non-contiguous positions) produce separate sections\n * so the panel matches the grid's visual layout.\n */\n private currentFragments(): PanelFragment[] {\n const allColumns = this.grid.getAllColumns().filter((c) => !c.utility);\n\n // Query for column grouping info from GroupingColumnsPlugin (or any responder)\n const groupResults = this.grid.query<ColumnGroupInfo[]>('getColumnGrouping');\n const groups: ColumnGroupInfo[] = groupResults?.flat().filter((g) => g && g.fields.length > 0) ?? [];\n if (groups.length === 0) return allColumns.map((c) => ({ group: null, columns: [c] }));\n\n const fieldToGroup = new Map<string, ColumnGroupInfo>();\n for (const group of groups) {\n for (const field of group.fields) fieldToGroup.set(field, group);\n }\n return this.computeFragments(allColumns, fieldToGroup);\n }\n\n /**\n * Compute contiguous column fragments from display-order columns.\n * Each fragment is either a group section (contiguous run of same-group columns)\n * or a single ungrouped column.\n */\n private computeFragments(\n allColumns: ColumnEntry[],\n fieldToGroup: Map<string, ColumnGroupInfo>,\n ): PanelFragment[] {\n const fragments: PanelFragment[] = [];\n let currentGroup: ColumnGroupInfo | null = null;\n let currentCols: ColumnEntry[] = [];\n\n for (const col of allColumns) {\n const group = fieldToGroup.get(col.field) ?? null;\n\n if (group && currentGroup && group.id === currentGroup.id) {\n // Same group continues — extend fragment\n currentCols.push(col);\n } else {\n // Flush previous fragment\n if (currentCols.length > 0) {\n fragments.push({ group: currentGroup, columns: currentCols });\n }\n currentGroup = group;\n currentCols = [col];\n }\n }\n // Flush last fragment\n if (currentCols.length > 0) {\n fragments.push({ group: currentGroup, columns: currentCols });\n }\n\n return fragments;\n }\n\n /**\n * Render a group fragment section with header checkbox and indented column rows.\n * A fragment is a contiguous run of columns from the same group. When a group is\n * fragmented (split across non-contiguous positions), each fragment gets its own section.\n */\n private renderGroupSection(\n group: ColumnGroupInfo,\n columns: ColumnEntry[],\n reorderEnabled: boolean,\n container: HTMLElement,\n ): void {\n // The fragment's fields — only the columns in this contiguous section\n const fragmentFields = columns.map((c) => c.field);\n\n // Group header row\n const header = document.createElement('div');\n header.className = 'tbw-visibility-group-header';\n header.setAttribute('data-group-id', group.id);\n\n // Make group header draggable when reorder is enabled.\n // Pass only this fragment's fields so dragging moves just this\n // contiguous block, not all columns of the (possibly fragmented) group.\n if (reorderEnabled) {\n header.draggable = true;\n header.classList.add('reorderable');\n this.setupGroupDragListeners(header, group, fragmentFields, container);\n }\n\n const headerLabel = document.createElement('label');\n headerLabel.className = 'tbw-visibility-label';\n\n const groupCheckbox = document.createElement('input');\n groupCheckbox.type = 'checkbox';\n\n // Calculate tri-state: all visible, all hidden, or mixed\n const visibleCount = columns.filter((c) => c.visible).length;\n const allLocked = columns.every((c) => c.lockVisible);\n if (visibleCount === columns.length) {\n groupCheckbox.checked = true;\n groupCheckbox.indeterminate = false;\n } else if (visibleCount === 0) {\n groupCheckbox.checked = false;\n groupCheckbox.indeterminate = false;\n } else {\n groupCheckbox.checked = false;\n groupCheckbox.indeterminate = true;\n }\n groupCheckbox.disabled = allLocked;\n\n // Toggle all columns in group\n groupCheckbox.addEventListener('change', () => {\n const newVisible = groupCheckbox.checked;\n for (const col of columns) {\n if (col.lockVisible) continue;\n this.grid.setColumnVisible(col.field, newVisible);\n }\n setTimeout(() => this.rebuildToggles(container), 0);\n });\n\n const headerText = document.createElement('span');\n headerText.textContent = group.label;\n\n headerLabel.appendChild(groupCheckbox);\n headerLabel.appendChild(headerText);\n header.appendChild(headerLabel);\n\n // Add drag handle icon for group if reorderable\n if (reorderEnabled) {\n const handle = document.createElement('span');\n handle.className = 'tbw-visibility-handle';\n this.setIcon(handle, 'dragHandle');\n handle.title = this.t('columns.dragGroupHandle', 'Drag to reorder group, or click for move options');\n this.wireMoveHandle(handle, group.label, () => this.groupMoveActions(fragmentFields));\n // Insert handle before the label\n header.insertBefore(handle, headerLabel);\n }\n\n container.appendChild(header);\n\n // Render indented column rows\n const allColumnsFullList = this.grid.getAllColumns().filter((c) => !c.utility);\n for (const col of columns) {\n const fullIndex = allColumnsFullList.findIndex((c) => c.field === col.field);\n const row = this.createColumnRow(col, fullIndex, reorderEnabled, container);\n row.classList.add('tbw-visibility-row--grouped');\n container.appendChild(row);\n }\n }\n\n /**\n * Render a flat (ungrouped) list of column rows.\n */\n private renderFlatColumnList(columns: ColumnEntry[], reorderEnabled: boolean, container: HTMLElement): void {\n const allColumnsFullList = this.grid.getAllColumns().filter((c) => !c.utility);\n for (const col of columns) {\n const fullIndex = allColumnsFullList.findIndex((c) => c.field === col.field);\n container.appendChild(this.createColumnRow(col, fullIndex, reorderEnabled, container));\n }\n }\n\n /**\n * Create a single column visibility row element.\n */\n private createColumnRow(\n col: ColumnEntry,\n index: number,\n reorderEnabled: boolean,\n columnList: HTMLElement,\n ): HTMLElement {\n const label = col.header || col.field;\n\n const row = document.createElement('div');\n row.className = col.lockVisible ? 'tbw-visibility-row locked' : 'tbw-visibility-row';\n row.setAttribute('data-field', col.field);\n row.setAttribute('data-index', String(index));\n\n // Add drag handle if reorder is enabled\n if (reorderEnabled && this.canMoveColumn(col)) {\n row.draggable = true;\n row.classList.add('reorderable');\n this.setupDragListeners(row, col.field, index, columnList);\n }\n\n const labelWrapper = document.createElement('label');\n labelWrapper.className = 'tbw-visibility-label';\n\n const checkbox = document.createElement('input');\n checkbox.type = 'checkbox';\n checkbox.checked = col.visible;\n checkbox.disabled = col.lockVisible ?? false;\n checkbox.addEventListener('change', () => {\n this.grid.toggleColumnVisibility(col.field);\n // Refresh after toggle (grid may re-render)\n setTimeout(() => this.rebuildToggles(columnList), 0);\n });\n\n const text = document.createElement('span');\n text.textContent = label;\n\n labelWrapper.appendChild(checkbox);\n labelWrapper.appendChild(text);\n\n // Add drag handle icon if reorderable\n if (reorderEnabled && this.canMoveColumn(col)) {\n const handle = document.createElement('span');\n handle.className = 'tbw-visibility-handle';\n this.setIcon(handle, 'dragHandle');\n handle.title = this.t('columns.dragHandle', 'Drag to reorder, or click for move options');\n this.wireMoveHandle(handle, label, () => this.columnMoveActions(col.field));\n row.appendChild(handle);\n }\n\n row.appendChild(labelWrapper);\n return row;\n }\n\n /**\n * Turn a drag handle into the pointer alternative required by WCAG 2.2\n * SC 2.5.7: a press-and-release without movement never fires `dragstart`, so\n * a plain click on the handle is the tap the criterion asks us to honour.\n *\n * The handle stays part of the row's drag surface — it is deliberately not\n * marked `draggable=\"false\"` — so dragging by the handle keeps working.\n * Actions are resolved on click, never at render time, so a stale panel can\n * never move the wrong column.\n */\n private wireMoveHandle(handle: HTMLElement, name: string, actions: () => DragAlternativeAction[]): void {\n handle.setAttribute('role', 'button');\n handle.tabIndex = -1;\n handle.setAttribute('aria-label', `${name} — ${this.t('columns.moveHandleHint', 'drag, or activate for move options')}`);\n handle.addEventListener('click', () => {\n this.moveMenu ??= createDragAlternativeMenu('tbw-visibility-move-menu', 'tbw-visibility-move-menu');\n this.moveMenu.open(handle, name, actions());\n });\n }\n\n /**\n * Emit the reorder request a drop at `dropIndex` would have produced.\n * `fromIndex`/`dropIndex` are positions in the panel's non-utility list;\n * `toIndex` is converted to the full column order the way the drop handler\n * does it, so the click path and the drag path can never diverge.\n */\n private requestColumnMove(field: string, fromIndex: number, dropIndex: number): void {\n const effectiveToIndex = dropIndex > fromIndex ? dropIndex - 1 : dropIndex;\n if (effectiveToIndex === fromIndex) return;\n\n const allColumns = this.grid.getAllColumns();\n const nonUtilityColumns = allColumns.filter((c) => !c.utility);\n const targetField = nonUtilityColumns[effectiveToIndex]?.field;\n const toIndex = targetField ? allColumns.findIndex((c) => c.field === targetField) : allColumns.length;\n\n this.emit<ColumnReorderRequestDetail>('column-reorder-request', { field, fromIndex, toIndex });\n }\n\n /** Click-only move actions for a single column row. */\n private columnMoveActions(field: string): DragAlternativeAction[] {\n const columns = this.grid.getAllColumns().filter((c) => !c.utility);\n const from = columns.findIndex((c) => c.field === field);\n const landable = (i: number) => i >= 0 && i < columns.length && this.canMoveColumn(columns[i]);\n\n return [\n {\n label: this.t('columns.moveUp', 'Move up'),\n disabled: !landable(from - 1),\n run: () => this.requestColumnMove(field, from, from - 1),\n },\n {\n label: this.t('columns.moveDown', 'Move down'),\n // The drop path takes an insert-before index, so stepping down one\n // place means aiming past the row that follows.\n disabled: !landable(from + 1),\n run: () => this.requestColumnMove(field, from, from + 2),\n },\n {\n label: this.t('columns.moveToTop', 'Move to top'),\n disabled: from <= 0 || !landable(0),\n run: () => this.requestColumnMove(field, from, 0),\n },\n {\n label: this.t('columns.moveToBottom', 'Move to bottom'),\n disabled: from < 0 || from >= columns.length - 1 || !landable(columns.length - 1),\n run: () => this.requestColumnMove(field, from, columns.length),\n },\n ];\n }\n\n /** Click-only move actions for a group fragment header. */\n private groupMoveActions(fragmentFields: string[]): DragAlternativeAction[] {\n const fragments = this.currentFragments();\n const at = fragments.findIndex((f) => f.columns[0]?.field === fragmentFields[0]);\n const fieldsAt = (i: number) => fragments[i].columns.map((c) => c.field);\n const first = at <= 0;\n const last = at < 0 || at >= fragments.length - 1;\n\n return [\n {\n label: this.t('columns.moveUp', 'Move up'),\n disabled: first,\n run: () => this.executeGroupDrop(fragmentFields, fieldsAt(at - 1), true),\n },\n {\n label: this.t('columns.moveDown', 'Move down'),\n disabled: last,\n run: () => this.executeGroupDrop(fragmentFields, fieldsAt(at + 1), false),\n },\n {\n label: this.t('columns.moveToTop', 'Move to top'),\n disabled: first,\n run: () => this.executeGroupDrop(fragmentFields, fieldsAt(0), true),\n },\n {\n label: this.t('columns.moveToBottom', 'Move to bottom'),\n disabled: last,\n run: () => this.executeGroupDrop(fragmentFields, fieldsAt(fragments.length - 1), false),\n },\n ];\n }\n\n /**\n * Set up drag-and-drop listeners for a group header row.\n * Dragging a group fragment moves only the columns in that fragment as a block.\n * When a group is fragmented, each fragment header drags independently.\n */\n private setupGroupDragListeners(\n header: HTMLElement,\n group: ColumnGroupInfo,\n fragmentFields: string[],\n columnList: HTMLElement,\n ): void {\n header.addEventListener('dragstart', (e: DragEvent) => {\n this.isDragging = true;\n this.draggedGroupId = group.id;\n this.draggedGroupFields = [...fragmentFields];\n // Use first field as representative for dataTransfer\n this.draggedField = null;\n this.draggedIndex = null;\n\n if (e.dataTransfer) {\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/plain', `group:${group.id}`);\n }\n\n // Mark entire group (header + children) as dragging\n header.classList.add(GridClasses.DRAGGING);\n columnList.querySelectorAll(`.tbw-visibility-row--grouped`).forEach((row) => {\n const field = row.getAttribute('data-field');\n if (field && this.draggedGroupFields.includes(field)) {\n row.classList.add(GridClasses.DRAGGING);\n }\n });\n });\n\n header.addEventListener('dragend', () => {\n this.isDragging = false;\n this.draggedGroupId = null;\n this.draggedGroupFields = [];\n this.draggedField = null;\n this.draggedIndex = null;\n this.dropIndex = null;\n this.clearDragClasses(columnList);\n });\n\n // Group headers are also drop targets for other groups (or other fragments of the same group)\n header.addEventListener('dragover', (e: DragEvent) => {\n e.preventDefault();\n if (!this.isDragging) return;\n // Can't drop onto the same fragment (same exact fields)\n if (\n this.draggedGroupFields.length === fragmentFields.length &&\n this.draggedGroupFields.every((f) => fragmentFields.includes(f))\n )\n return;\n // Can't drop individual columns onto group headers\n if (!this.draggedGroupId) return;\n\n const rect = header.getBoundingClientRect();\n const midY = rect.top + rect.height / 2;\n const before = e.clientY < midY;\n\n this.clearDragClasses(columnList);\n header.classList.add('drop-target');\n header.classList.toggle('drop-before', before);\n header.classList.toggle('drop-after', !before);\n });\n\n header.addEventListener('dragleave', () => {\n header.classList.remove('drop-target', 'drop-before', 'drop-after');\n });\n\n header.addEventListener('drop', (e: DragEvent) => {\n e.preventDefault();\n if (!this.isDragging || !this.draggedGroupId) return;\n // Can't drop onto the same fragment\n if (\n this.draggedGroupFields.length === fragmentFields.length &&\n this.draggedGroupFields.every((f) => fragmentFields.includes(f))\n )\n return;\n\n const rect = header.getBoundingClientRect();\n const before = e.clientY < rect.top + rect.height / 2;\n\n this.executeGroupDrop(this.draggedGroupFields, fragmentFields, before);\n });\n }\n\n /**\n * Execute a group drop — move the dragged fragment's fields as a block\n * to the position relative to the target group/column.\n * Routes through the ReorderPlugin when available for proper animation and\n * full render cycle, otherwise falls back to direct grid.setColumnOrder().\n */\n private executeGroupDrop(draggedFields: string[], targetFields: string[], before: boolean): void {\n const allColumns = this.grid.getAllColumns();\n const currentOrder = allColumns.map((c) => c.field);\n\n // Remove dragged fields from current order\n const remaining = currentOrder.filter((f) => !draggedFields.includes(f));\n\n // Find insertion point relative to target\n // Use the first field of target group if inserting before, last if after\n const anchorField = before ? targetFields[0] : targetFields[targetFields.length - 1];\n const insertAt = remaining.indexOf(anchorField);\n if (insertAt === -1) return;\n\n // Insert the dragged group block at the correct position\n const insertIndex = before ? insertAt : insertAt + 1;\n\n // Preserve the dragged fields' original relative order\n const draggedInOrder = currentOrder.filter((f) => draggedFields.includes(f));\n remaining.splice(insertIndex, 0, ...draggedInOrder);\n\n // Route through ReorderPlugin.setColumnOrder when available and attached —\n // this calls updateColumnOrder which handles animation and forceLayout for\n // proper body cell rebuilds. Fall back to direct grid.setColumnOrder otherwise.\n const reorderPlugin = this.grid.getPluginByName?.('reorder') as\n { setColumnOrder?: (o: string[]) => void; gridElement?: unknown } | undefined;\n if (reorderPlugin?.setColumnOrder && reorderPlugin.gridElement) {\n reorderPlugin.setColumnOrder(remaining);\n } else {\n this.grid.setColumnOrder(remaining);\n }\n\n // Panel rebuild is handled by the column-move listener when ReorderPlugin\n // emits the event. For the direct fallback path, trigger manually.\n requestAnimationFrame(() => {\n if (this.columnListElement) {\n this.rebuildToggles(this.columnListElement);\n }\n });\n }\n\n /**\n * Set up drag-and-drop event listeners for a row.\n * On drop, emits a 'column-reorder-request' event for other plugins to handle.\n */\n private setupDragListeners(row: HTMLElement, field: string, index: number, columnList: HTMLElement): void {\n row.addEventListener('dragstart', (e: DragEvent) => {\n this.isDragging = true;\n this.draggedField = field;\n this.draggedIndex = index;\n // Clear any stale group drag state\n this.draggedGroupId = null;\n this.draggedGroupFields = [];\n\n if (e.dataTransfer) {\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/plain', field);\n }\n\n row.classList.add(GridClasses.DRAGGING);\n });\n\n row.addEventListener('dragend', () => {\n this.isDragging = false;\n this.draggedField = null;\n this.draggedIndex = null;\n this.dropIndex = null;\n this.clearDragClasses(columnList);\n });\n\n row.addEventListener('dragover', (e: DragEvent) => {\n e.preventDefault();\n if (!this.isDragging) return;\n\n // If dragging a group, only allow drop on ungrouped rows\n if (this.draggedGroupId) {\n if (row.classList.contains('tbw-visibility-row--grouped')) return;\n } else if (this.draggedField === field) {\n return;\n }\n\n const rect = row.getBoundingClientRect();\n const midY = rect.top + rect.height / 2;\n\n this.dropIndex = e.clientY < midY ? index : index + 1;\n\n // Clear other highlights\n this.clearDragClasses(columnList);\n // Re-mark dragged elements\n if (this.draggedGroupId) {\n columnList\n .querySelector(`.tbw-visibility-group-header[data-group-id=\"${this.draggedGroupId}\"]`)\n ?.classList.add(GridClasses.DRAGGING);\n columnList.querySelectorAll('.tbw-visibility-row--grouped').forEach((r) => {\n const f = r.getAttribute('data-field');\n if (f && this.draggedGroupFields.includes(f)) r.classList.add(GridClasses.DRAGGING);\n });\n } else if (this.draggedField) {\n columnList\n .querySelector(`.tbw-visibility-row[data-field=\"${this.draggedField}\"]`)\n ?.classList.add(GridClasses.DRAGGING);\n }\n\n row.classList.add('drop-target');\n row.classList.toggle('drop-before', e.clientY < midY);\n row.classList.toggle('drop-after', e.clientY >= midY);\n });\n\n row.addEventListener('dragleave', () => {\n row.classList.remove('drop-target', 'drop-before', 'drop-after');\n });\n\n row.addEventListener('drop', (e: DragEvent) => {\n e.preventDefault();\n\n if (!this.isDragging) return;\n\n // Group drop onto an ungrouped row\n if (this.draggedGroupId && this.draggedGroupFields.length > 0) {\n if (row.classList.contains('tbw-visibility-row--grouped')) return;\n const rect = row.getBoundingClientRect();\n const before = e.clientY < rect.top + rect.height / 2;\n this.executeGroupDrop(this.draggedGroupFields, [field], before);\n return;\n }\n\n // Individual column drop\n const draggedField = this.draggedField;\n const draggedIndex = this.draggedIndex;\n const dropIndex = this.dropIndex;\n\n if (draggedField === null || draggedIndex === null || dropIndex === null) {\n return;\n }\n\n // Calculate the effective target index (in the filtered non-utility list)\n const effectiveToIndex = dropIndex > draggedIndex ? dropIndex - 1 : dropIndex;\n\n if (effectiveToIndex !== draggedIndex) {\n // Convert from non-utility index to full column order index\n // by counting how many utility columns come before the target position\n const allColumns = this.grid.getAllColumns();\n const nonUtilityColumns = allColumns.filter((c) => !c.utility);\n\n // Find the target field at effectiveToIndex in non-utility list\n const targetField = nonUtilityColumns[effectiveToIndex]?.field;\n // Find its actual index in the full column order\n const fullOrderToIndex = targetField ? allColumns.findIndex((c) => c.field === targetField) : allColumns.length;\n\n // Emit a request event - other plugins (like ReorderPlugin) can listen and handle\n const detail: ColumnReorderRequestDetail = {\n field: draggedField,\n fromIndex: draggedIndex, // Not used by ReorderPlugin, just for info\n toIndex: fullOrderToIndex,\n };\n this.emit<ColumnReorderRequestDetail>('column-reorder-request', detail);\n // Panel rebuild is handled by the column-move listener in attach()\n }\n });\n }\n // #endregion\n}\n"],"mappings":"yB,0BAoCA,IAAaE,EAyBD,WCxCZ,SAASC,IACP,MAAqD,mBAAvCC,YAAYC,WAAWC,WACvC,CAwDA,SAAgBC,EAA0BC,EAAYC,GACpD,IAAIC,EAA8B,KAC9BC,GAAS,EACT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B,EAAIvH,UAAU0C,OAAO,aAActH,EAAEiO,SAAWF,KAGlD5B,EAAIpM,iBAAiB,YAAA,KACnBoM,EAAIvH,UAAUvB,OAAO,cAAe,cAAe,gBAGrD8I,EAAIpM,iBAAiB,OAASC,IAG5B,GAFAA,EAAE6N,kBAEG7I,KAAKhB,WAAY,OAGtB,GAAIgB,KAAKZ,gBAAkBY,KAAKX,mBAAmB1D,OAAS,EAAG,CAC7D,GAAIwL,EAAIvH,UAAU1D,SAAS,+BAAgC,OAC3D,MAAM4M,EAAO3B,EAAIlK,wBACX+L,EAAShO,EAAEiO,QAAUH,EAAKlL,IAAMkL,EAAKjL,OAAS,EAEpD,YADAmC,KAAKyI,iBAAiBzI,KAAKX,mBAAoB,CAAC8B,GAAQ6H,EAE1D,CAGA,MAAM/J,EAAee,KAAKf,aACpBC,EAAec,KAAKd,aACpBC,EAAYa,KAAKb,UAEvB,GAAqB,OAAjBF,GAA0C,OAAjBC,GAAuC,OAAdC,EACpD,OAIF,MAAM2I,EAAmB3I,EAAYD,EAAeC,EAAY,EAAIA,EAEpE,GAAI2I,IAAqB5I,EAAc,CAGrC,MAAMmF,EAAarE,KAAKF,KAAK+C,gBAIvBkF,EAHoB1D,EAAWvB,OAAQC,IAAOA,EAAEuB,SAGhBwD,IAAmB3G,MAKnD0I,EAAqC,CACzC1I,MAAOlC,EACP4I,UAAW3I,EACX8I,QANuBD,EAAc1D,EAAW6C,UAAWnE,GAAMA,EAAE5B,QAAU4G,GAAe1D,EAAW1I,QAQzGqE,KAAKiI,KAAiC,yBAA0B4B,EAElE,GAEJ,U"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolbox-web/grid",
3
- "version": "3.9.2",
3
+ "version": "3.10.0",
4
4
  "description": "Zero-dependency, framework-agnostic data grid web component with virtualization, sorting, filtering, editing, and 20+ plugins. Works in vanilla JS, React, Vue, Angular, and any framework.",
5
5
  "type": "module",
6
6
  "main": "./index.js",