@toolbox-web/grid 1.31.2 → 2.0.0-alpha

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 (129) hide show
  1. package/all.js +2 -2
  2. package/all.js.map +1 -1
  3. package/custom-elements.json +0 -11
  4. package/index.d.ts +1 -1
  5. package/index.js +1 -1
  6. package/index.js.map +1 -1
  7. package/lib/core/grid.d.ts +1 -29
  8. package/lib/core/internal/aggregators.bench.d.ts +1 -0
  9. package/lib/core/internal/aggregators.d.ts +0 -5
  10. package/lib/core/internal/aria.d.ts +13 -1
  11. package/lib/core/internal/config.bench.d.ts +1 -0
  12. package/lib/core/internal/diagnostics.d.ts +1 -3
  13. package/lib/core/internal/render-pipeline.bench.d.ts +9 -0
  14. package/lib/core/internal/shell.d.ts +0 -2
  15. package/lib/core/internal/sorting.bench.d.ts +1 -0
  16. package/lib/core/internal/virtualization.bench.d.ts +1 -0
  17. package/lib/core/plugin/base-plugin.d.ts +0 -116
  18. package/lib/core/plugin/index.d.ts +1 -1
  19. package/lib/core/plugin/plugin-manager.d.ts +0 -25
  20. package/lib/core/plugin/types.d.ts +0 -35
  21. package/lib/core/styles/index.d.ts +0 -1
  22. package/lib/core/types.d.ts +93 -25
  23. package/lib/features/multi-sort.d.ts +0 -2
  24. package/lib/features/multi-sort.js.map +1 -1
  25. package/lib/features/registry.d.ts +0 -1
  26. package/lib/features/registry.js +1 -1
  27. package/lib/features/registry.js.map +1 -1
  28. package/lib/features/reorder-columns.d.ts +0 -2
  29. package/lib/features/reorder-columns.js +1 -1
  30. package/lib/features/reorder-columns.js.map +1 -1
  31. package/lib/features/reorder-rows.d.ts +0 -2
  32. package/lib/features/reorder-rows.js +1 -1
  33. package/lib/features/reorder-rows.js.map +1 -1
  34. package/lib/plugins/clipboard/index.js +1 -1
  35. package/lib/plugins/clipboard/index.js.map +1 -1
  36. package/lib/plugins/column-virtualization/column-virtualization.bench.d.ts +1 -0
  37. package/lib/plugins/column-virtualization/index.js +1 -1
  38. package/lib/plugins/column-virtualization/index.js.map +1 -1
  39. package/lib/plugins/context-menu/index.js +1 -1
  40. package/lib/plugins/context-menu/index.js.map +1 -1
  41. package/lib/plugins/editing/index.d.ts +1 -1
  42. package/lib/plugins/editing/index.js +1 -1
  43. package/lib/plugins/editing/index.js.map +1 -1
  44. package/lib/plugins/editing/types.d.ts +0 -9
  45. package/lib/plugins/export/index.js +1 -1
  46. package/lib/plugins/export/index.js.map +1 -1
  47. package/lib/plugins/filtering/filter-model.bench.d.ts +1 -0
  48. package/lib/plugins/filtering/index.js +1 -1
  49. package/lib/plugins/filtering/index.js.map +1 -1
  50. package/lib/plugins/grouping-columns/grouping-columns.bench.d.ts +1 -0
  51. package/lib/plugins/grouping-columns/index.js +1 -1
  52. package/lib/plugins/grouping-columns/index.js.map +1 -1
  53. package/lib/plugins/grouping-rows/grouping-rows.bench.d.ts +1 -0
  54. package/lib/plugins/grouping-rows/grouping-rows.d.ts +3 -3
  55. package/lib/plugins/grouping-rows/index.js +2 -2
  56. package/lib/plugins/grouping-rows/index.js.map +1 -1
  57. package/lib/plugins/grouping-rows/types.d.ts +0 -2
  58. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +0 -14
  59. package/lib/plugins/master-detail/index.js +1 -1
  60. package/lib/plugins/master-detail/index.js.map +1 -1
  61. package/lib/plugins/master-detail/master-detail.bench.d.ts +1 -0
  62. package/lib/plugins/master-detail/master-detail.d.ts +3 -3
  63. package/lib/plugins/multi-sort/index.js +1 -1
  64. package/lib/plugins/multi-sort/index.js.map +1 -1
  65. package/lib/plugins/pinned-columns/index.d.ts +1 -1
  66. package/lib/plugins/pinned-columns/index.js +1 -1
  67. package/lib/plugins/pinned-columns/index.js.map +1 -1
  68. package/lib/plugins/pinned-columns/pinned-columns.bench.d.ts +1 -0
  69. package/lib/plugins/pinned-columns/pinned-columns.d.ts +3 -6
  70. package/lib/plugins/pinned-columns/types.d.ts +0 -12
  71. package/lib/plugins/pinned-rows/index.js +1 -1
  72. package/lib/plugins/pinned-rows/index.js.map +1 -1
  73. package/lib/plugins/pinned-rows/pinned-rows.d.ts +0 -1
  74. package/lib/plugins/pivot/index.js +1 -1
  75. package/lib/plugins/pivot/index.js.map +1 -1
  76. package/lib/plugins/pivot/pivot-engine.bench.d.ts +1 -0
  77. package/lib/plugins/pivot/pivot-engine.d.ts +1 -4
  78. package/lib/plugins/print/index.js +1 -1
  79. package/lib/plugins/print/index.js.map +1 -1
  80. package/lib/plugins/reorder-columns/index.js +1 -1
  81. package/lib/plugins/reorder-columns/index.js.map +1 -1
  82. package/lib/plugins/reorder-columns/types.d.ts +0 -4
  83. package/lib/plugins/reorder-rows/index.js +1 -1
  84. package/lib/plugins/reorder-rows/index.js.map +1 -1
  85. package/lib/plugins/reorder-rows/types.d.ts +0 -4
  86. package/lib/plugins/responsive/ResponsivePlugin.d.ts +0 -23
  87. package/lib/plugins/responsive/index.js +1 -1
  88. package/lib/plugins/responsive/index.js.map +1 -1
  89. package/lib/plugins/selection/SelectionPlugin.d.ts +2 -0
  90. package/lib/plugins/selection/index.js +1 -1
  91. package/lib/plugins/selection/index.js.map +1 -1
  92. package/lib/plugins/server-side/datasource.bench.d.ts +1 -0
  93. package/lib/plugins/server-side/index.js +1 -1
  94. package/lib/plugins/server-side/index.js.map +1 -1
  95. package/lib/plugins/tooltip/index.js +1 -1
  96. package/lib/plugins/tooltip/index.js.map +1 -1
  97. package/lib/plugins/tree/index.js +1 -1
  98. package/lib/plugins/tree/index.js.map +1 -1
  99. package/lib/plugins/tree/tree-data.bench.d.ts +1 -0
  100. package/lib/plugins/undo-redo/index.js +1 -1
  101. package/lib/plugins/undo-redo/index.js.map +1 -1
  102. package/lib/plugins/visibility/index.js +1 -1
  103. package/lib/plugins/visibility/index.js.map +1 -1
  104. package/package.json +1 -1
  105. package/public.d.ts +3 -6
  106. package/umd/grid.all.umd.js +1 -1
  107. package/umd/grid.all.umd.js.map +1 -1
  108. package/umd/grid.umd.js +1 -1
  109. package/umd/grid.umd.js.map +1 -1
  110. package/umd/plugins/editing.umd.js +1 -1
  111. package/umd/plugins/editing.umd.js.map +1 -1
  112. package/umd/plugins/filtering.umd.js +1 -1
  113. package/umd/plugins/filtering.umd.js.map +1 -1
  114. package/umd/plugins/grouping-rows.umd.js +1 -1
  115. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  116. package/umd/plugins/master-detail.umd.js +1 -1
  117. package/umd/plugins/master-detail.umd.js.map +1 -1
  118. package/umd/plugins/multi-sort.umd.js +1 -1
  119. package/umd/plugins/multi-sort.umd.js.map +1 -1
  120. package/umd/plugins/pinned-columns.umd.js +1 -1
  121. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  122. package/umd/plugins/pinned-rows.umd.js +1 -1
  123. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  124. package/umd/plugins/pivot.umd.js +1 -1
  125. package/umd/plugins/pivot.umd.js.map +1 -1
  126. package/umd/plugins/responsive.umd.js +1 -1
  127. package/umd/plugins/responsive.umd.js.map +1 -1
  128. package/umd/plugins/selection.umd.js +1 -1
  129. package/umd/plugins/selection.umd.js.map +1 -1
@@ -1,9 +1,7 @@
1
1
  import { TextDirection } from '../../core/internal/utils';
2
2
  import { PinnedPosition, ResolvedPinnedPosition } from './types';
3
- type StickyPosition = PinnedPosition;
4
- type ResolvedStickyPosition = ResolvedPinnedPosition;
5
3
  /**
6
- * Get the effective pinned position from a column, checking `pinned` first then `sticky` (deprecated).
4
+ * Get the effective pinned position from a column.
7
5
  *
8
6
  * @param col - Column configuration object
9
7
  * @returns The pinned position, or undefined if not pinned
@@ -20,7 +18,7 @@ export declare function getColumnPinned(col: any): PinnedPosition | undefined;
20
18
  * @param direction - Text direction ('ltr' or 'rtl')
21
19
  * @returns Physical pinned position ('left' or 'right')
22
20
  */
23
- export declare function resolveStickyPosition(position: StickyPosition, direction: TextDirection): ResolvedStickyPosition;
21
+ export declare function resolveStickyPosition(position: PinnedPosition, direction: TextDirection): ResolvedPinnedPosition;
24
22
  /**
25
23
  * Get columns that should be sticky on the left.
26
24
  *
@@ -50,7 +48,7 @@ export declare function hasStickyColumns(columns: any[]): boolean;
50
48
  * @param column - Column configuration
51
49
  * @returns The sticky position or null if not sticky
52
50
  */
53
- export declare function getColumnStickyPosition(column: any): StickyPosition | null;
51
+ export declare function getColumnStickyPosition(column: any): PinnedPosition | null;
54
52
  /**
55
53
  * Calculate left offsets for sticky-left columns.
56
54
  * Returns a map of field -> offset in pixels.
@@ -140,4 +138,3 @@ export declare function reorderColumnsForPinning(columns: readonly any[], direct
140
138
  * @param host - The grid host element (render root for DOM queries)
141
139
  */
142
140
  export declare function clearStickyOffsets(host: HTMLElement): void;
143
- export {};
@@ -27,19 +27,11 @@
27
27
  * ```
28
28
  */
29
29
  export type PinnedPosition = 'left' | 'right' | 'start' | 'end';
30
- /**
31
- * @deprecated Use {@link PinnedPosition} instead. Will be removed in v2.0.
32
- */
33
- export type StickyPosition = PinnedPosition;
34
30
  /**
35
31
  * Physical pin position after resolving logical values.
36
32
  * Used internally after applying RTL resolution.
37
33
  */
38
34
  export type ResolvedPinnedPosition = 'left' | 'right';
39
- /**
40
- * @deprecated Use {@link ResolvedPinnedPosition} instead. Will be removed in v2.0.
41
- */
42
- export type ResolvedStickyPosition = ResolvedPinnedPosition;
43
35
  /**
44
36
  * When PinnedColumnsPlugin is imported, the `pinned` property becomes available on column config.
45
37
  * This augments the core BaseColumnConfig interface.
@@ -60,10 +52,6 @@ declare module '../../core/types' {
60
52
  * Requires PinnedColumnsPlugin.
61
53
  */
62
54
  pinned?: PinnedPosition;
63
- /**
64
- * @deprecated Use `pinned` instead. Will be removed in v2.0.
65
- */
66
- sticky?: PinnedPosition;
67
55
  }
68
56
  interface PluginNameMap {
69
57
  pinnedColumns: import('./PinnedColumnsPlugin').PinnedColumnsPlugin;
@@ -1,2 +1,2 @@
1
- function t(t,e){return`[tbw-grid${t?`#${t}`:""}${e?`:${e}`:""}]`}function e(e,n,o,r){return`${t(o,r)} ${e}: ${n}\n\n → More info: ${function(t){return`https://toolboxjs.com/grid/errors#${t.toLowerCase()}`}(e)}`}["__otorp__","__retteGenifed__","__retteSenifed__","rotcurtsnoc","wodniw","sihTlabolg","labolg","ssecorp","noitcnuF","tropmi","lave","tcelfeR","yxorP","rorrE","stnemugra","tnemucod","noitacol","eikooc","egarotSlacol","egarotSnoisses","BDdexedni","hctef","tseuqeRpttHLMX","tekcoSbeW","rekroW","rekroWderahS","rekroWecivreS","renepo","tnerap","pot","semarf","fles"].map(t=>t.split("").reverse().join(""));const n=/* @__PURE__ */new Set(["script","iframe","object","embed","form","input","button","textarea","select","link","meta","base","style","template","slot","portal","frame","frameset","applet","noscript","noembed","plaintext","xmp","listing"]),o=/^on\w+$/i,r=/* @__PURE__ */new Set(["href","src","action","formaction","data","srcdoc","xlink:href","poster","srcset"]),i=/^\s*(javascript|vbscript|data|blob):/i;function s(t){if(!t||"string"!=typeof t)return"";if(-1===t.indexOf("<"))return t;const e=document.createElement("template");return e.innerHTML=t,function(t){const e=[],s=t.querySelectorAll("*");for(const a of s){const t=a.tagName.toLowerCase();if(n.has(t)){e.push(a);continue}if("svg"===t||"http://www.w3.org/2000/svg"===a.namespaceURI){if(Array.from(a.attributes).some(t=>o.test(t.name)||"href"===t.name||"xlink:href"===t.name)){e.push(a);continue}}const s=[];for(const e of a.attributes){const t=e.name.toLowerCase();o.test(t)?s.push(e.name):(r.has(t)&&i.test(e.value)||"style"===t&&/expression\s*\(|javascript:|behavior\s*:/i.test(e.value))&&s.push(e.name)}s.forEach(t=>a.removeAttribute(t))}e.forEach(t=>t.remove())}(e.content),e.innerHTML}const a='<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',l={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:a,filterActive:a,print:"🖨️"};class g{static dependencies;static manifest;aliases;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#t;get defaultConfig(){return{}}constructor(t={}){this.userConfig=t}attach(t){this.#t?.abort(),this.#t=new AbortController,this.grid=t,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#t?.abort(),this.#t=void 0}getPlugin(t){return this.grid?.getPlugin(t)}emit(t,e){this.grid?.dispatchEvent?.(new CustomEvent(t,{detail:e,bubbles:!0}))}emitCancelable(t,e){const n=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(n),n.defaultPrevented}on(t,e){this.grid?._pluginManager?.subscribe(this,t,e)}off(t){this.grid?._pluginManager?.unsubscribe(this,t)}emitPluginEvent(t,e){this.grid?._pluginManager?.emitPluginEvent(t,e)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}requestVirtualRefresh(){this.grid?.requestVirtualRefresh?.()}get rows(){return this.grid?.rows??[]}get sourceRows(){return this.grid?.sourceRows??[]}get columns(){return this.grid?.columns??[]}get visibleColumns(){return this.grid?._visibleColumns??[]}get gridElement(){return this.grid?._hostElement}get disconnectSignal(){return this.#t?.signal??this.grid?.disconnectSignal}get gridIcons(){const t=this.grid?.gridConfig?.icons??{};return{...l,...t}}get isAnimationEnabled(){const t=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===t||"off"===t)return!1;if(!0===t||"on"===t)return!0;const e=this.gridElement;if(e){return"0"!==getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const t=this.gridElement;if(t){const e=getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(),n=parseInt(e,10);if(!isNaN(n))return n}return 200}resolveIcon(t,e){return void 0!==e?e:this.gridIcons[t]}setIcon(t,e,n){t.dataset.icon=e.replace(/([A-Z])/g,"-$1").toLowerCase(),"collapse"===e?t.dataset.expanded="":"expand"===e&&delete t.dataset.expanded;const o=this.#e(e,n);void 0!==o?"string"==typeof o?t.innerHTML=s(o):o instanceof HTMLElement&&(t.innerHTML="",t.appendChild(o.cloneNode(!0))):t.innerHTML=""}#e(t,e){return void 0!==e?e:this.grid?.gridConfig?.icons?.[t]}updateSortIndicator(t,e){t.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove();const n=document.createElement("span");n.setAttribute("part","sort-indicator"),n.className="sort-indicator",e?(t.setAttribute("aria-sort","asc"===e?"ascending":"descending"),t.setAttribute("data-sort",e),this.setIcon(n,"asc"===e?"sortAsc":"sortDesc")):(t.setAttribute("aria-sort","none"),t.removeAttribute("data-sort"),this.setIcon(n,"sortNone"));const o=t.querySelector(".tbw-filter-btn")??t.querySelector(".resize-handle");return o?t.insertBefore(n,o):t.appendChild(n),n}warn(n,o){void 0!==o?console.warn(e(n,o,this.gridElement.id,this.name)):console.warn(`${t(this.gridElement.id,this.name)} ${n}`)}throwDiagnostic(t,n){throw new Error(e(t,n,this.gridElement.id,this.name))}}const c={sum:(t,e)=>t.reduce((t,n)=>t+(Number(n[e])||0),0),avg:(t,e)=>{const n=t.reduce((t,n)=>t+(Number(n[e])||0),0);return t.length?n/t.length:0},count:t=>t.length,min:(t,e)=>t.length?Math.min(...t.map(t=>Number(t[e])||1/0)):0,max:(t,e)=>t.length?Math.max(...t.map(t=>Number(t[e])||-1/0)):0,first:(t,e)=>t[0]?.[e],last:(t,e)=>t[t.length-1]?.[e]},d=/* @__PURE__ */new Map,h={register(t,e){d.set(t,e)},unregister(t){d.delete(t)},get(t){if(void 0!==t)return"function"==typeof t?t:d.get(t)??c[t]},run(t,e,n,o){const r=this.get(t);return r?r(e,n,o):void 0},has:t=>d.has(t)||t in c,list:()=>[...Object.keys(c),...d.keys()]};h.register.bind(h),h.unregister.bind(h);const u=h.get.bind(h);function p(t,e){const n=document.createElement("div");n.className="tbw-pinned-rows",n.setAttribute("role","presentation"),n.setAttribute("aria-live","polite");const o=document.createElement("div");o.className="tbw-pinned-rows-left";const r=document.createElement("div");r.className="tbw-pinned-rows-center";const i=document.createElement("div");if(i.className="tbw-pinned-rows-right",!1!==t.showRowCount){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-row-count",t.textContent=`Total: ${e.totalRows} rows`,o.appendChild(t)}if(t.showFilteredCount&&e.filteredRows!==e.totalRows){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-filtered-count",t.textContent=`Filtered: ${e.filteredRows}`,o.appendChild(t)}if(t.showSelectedCount&&e.selectedRows>0){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-selected-count",t.textContent=`Selected: ${e.selectedRows}`,i.appendChild(t)}if(t.customPanels)for(const s of t.customPanels){const t=C(s,e);switch(s.position){case"left":o.appendChild(t);break;case"center":r.appendChild(t);break;case"right":i.appendChild(t)}}return n.appendChild(o),n.appendChild(r),n.appendChild(i),n}function f(t){const e=document.createElement("div");return e.className=`tbw-aggregation-rows tbw-aggregation-rows-${t}`,e.setAttribute("role","presentation"),e}function m(t,e,n,o,r=!1){t.innerHTML="";for(const i of e){const e=document.createElement("div");e.className="tbw-aggregation-row",e.setAttribute("role","presentation"),i.id&&e.setAttribute("data-aggregation-id",i.id);i.fullWidth??r?b(e,i,n,o):w(e,i,n,o),t.appendChild(e)}}function b(t,e,n,o){const r=document.createElement("div");r.className="tbw-aggregation-cell tbw-aggregation-cell-full",r.style.gridColumn="1 / -1";const i="function"==typeof e.label?e.label(o,n):e.label;if(i){const t=document.createElement("span");t.className="tbw-aggregation-label",t.textContent=i,r.appendChild(t)}const s=function(t,e,n){const o=t.aggregators&&Object.keys(t.aggregators).length>0,r=t.cells&&Object.keys(t.cells).length>0;if(!o&&!r)return null;const i=document.createElement("span");i.className="tbw-aggregation-aggregates";for(const s of e){const{value:e,formatter:o}=v(t,s,n);if(null!=e){const t=document.createElement("span");t.className="tbw-aggregation-aggregate",t.setAttribute("data-field",s.field);const n=s.header??s.field,r=o?o(e,s.field,s):String(e);t.textContent=`${n}: ${r}`,i.appendChild(t)}}return i.children.length>0?i:null}(e,n,o);s&&r.appendChild(s),t.appendChild(r)}function w(t,e,n,o){for(const i of n){const n=document.createElement("div");n.className="tbw-aggregation-cell",n.setAttribute("data-field",i.field);const{value:r,formatter:s}=v(e,i,o);n.textContent=null!=r?s?s(r,i.field,i):String(r):"",t.appendChild(n)}const r="function"==typeof e.label?e.label(o,n):e.label;if(r){const e=document.createElement("span");e.className="tbw-aggregation-label",e.textContent=r,t.appendChild(e)}}function v(t,e,n){let o,r;const i=t.aggregators?.[e.field];if(i)if("object"==typeof(s=i)&&null!==s&&"aggFunc"in s){const t=u(i.aggFunc);t&&(o=t(n,e.field,e)),r=i.formatter}else{const t=u(i);t&&(o=t(n,e.field,e))}else if(t.cells&&Object.prototype.hasOwnProperty.call(t.cells,e.field)){const r=t.cells[e.field];o="function"==typeof r?r(n,e.field,e):r}var s;return{value:o,formatter:r}}function C(t,e){const n=document.createElement("div");n.className="tbw-status-panel tbw-status-panel-custom",n.id=`status-panel-${t.id}`;const o=t.render(e);return"string"==typeof o?n.innerHTML=o:n.appendChild(o),n}function E(t,e,n,o,r){return{totalRows:t.length,filteredRows:r?.cachedResult?.length??t.length,selectedRows:o?.selected?.size??0,columns:e,rows:t,grid:n}}h.run.bind(h),h.list.bind(h);class A extends g{name="pinnedRows";styles="@layer tbw-plugins{.tbw-scroll-area{container-type:inline-size}.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg);min-width:fit-content}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;position:sticky;left:0;min-width:0;width:100cqi}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600);position:relative;background:inherit}.tbw-aggregation-row>.tbw-aggregation-label{position:sticky;left:0;grid-row:1;grid-column:1;display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem);background:inherit;z-index:1;pointer-events:none}.tbw-aggregation-row>.tbw-aggregation-cell:first-child{grid-column:1;grid-row:1}.tbw-aggregation-cell:not(:empty){position:relative;z-index:2;background:inherit}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;align-content:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0;display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem)}.tbw-aggregation-label{white-space:nowrap}.tbw-aggregation-aggregates{display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem);font-weight:400;opacity:.85}.tbw-aggregation-aggregate{white-space:nowrap}}";get defaultConfig(){return{position:"bottom",showRowCount:!0,showSelectedCount:!0,showFilteredCount:!0}}infoBarElement=null;topAggregationContainer=null;bottomAggregationContainer=null;footerWrapper=null;detach(){this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null),this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null)}afterRender(){const t=this.gridElement;if(!t)return;const e=t.querySelector(".tbw-scroll-area")??t.querySelector(".tbw-grid-content")??t.querySelector(".tbw-grid-root");if(!e)return;this.footerWrapper&&!e.contains(this.footerWrapper)&&(this.footerWrapper=null,this.bottomAggregationContainer=null,this.infoBarElement=null),this.topAggregationContainer&&!e.contains(this.topAggregationContainer)&&(this.topAggregationContainer=null),this.infoBarElement&&!e.contains(this.infoBarElement)&&(this.infoBarElement=null);const n=this.getSelectionState(),o=this.getFilterState(),r=E(this.sourceRows,this.columns,this.gridElement,n,o),i=this.config.aggregationRows||[],s=i.filter(t=>"top"===t.position),a=i.filter(t=>"top"!==t.position);if(s.length>0){if(!this.topAggregationContainer){this.topAggregationContainer=f("top");const n=t.querySelector(".header");n&&n.nextSibling?e.insertBefore(this.topAggregationContainer,n.nextSibling):e.appendChild(this.topAggregationContainer)}m(this.topAggregationContainer,s,this.visibleColumns,this.sourceRows,this.config.fullWidth)}else this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null);const l=!1!==this.config.showRowCount||this.config.showSelectedCount&&r.selectedRows>0||this.config.showFilteredCount&&r.filteredRows!==r.totalRows||this.config.customPanels&&this.config.customPanels.length>0,g=l&&"top"!==this.config.position,c=a.length>0||g;if(l&&"top"===this.config.position)if(this.infoBarElement){const t=p(this.config,r);this.infoBarElement.replaceWith(t),this.infoBarElement=t}else this.infoBarElement=p(this.config,r),e.insertBefore(this.infoBarElement,e.firstChild);else"top"===this.config.position&&this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null);c?(this.footerWrapper||(this.footerWrapper=document.createElement("div"),this.footerWrapper.className="tbw-footer",e.appendChild(this.footerWrapper)),this.footerWrapper.innerHTML="",a.length>0&&(this.bottomAggregationContainer||(this.bottomAggregationContainer=f("bottom")),this.footerWrapper.appendChild(this.bottomAggregationContainer),m(this.bottomAggregationContainer,a,this.visibleColumns,this.sourceRows,this.config.fullWidth)),g&&(this.infoBarElement=p(this.config,r),this.footerWrapper.appendChild(this.infoBarElement))):this.cleanupFooter()}cleanup(){this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null),this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null)}cleanupFooter(){this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.infoBarElement&&"top"!==this.config.position&&(this.infoBarElement.remove(),this.infoBarElement=null)}getSelectionState(){try{return this.grid?.getPluginState?.("selection")??null}catch{return null}}getFilterState(){try{return this.grid?.getPluginState?.("filtering")??null}catch{return null}}refresh(){this.requestRender()}getContext(){const t=this.getSelectionState(),e=this.getFilterState();return E(this.rows,this.columns,this.gridElement,t,e)}addPanel(t){this.config.customPanels||(this.config.customPanels=[]),this.config.customPanels.push(t),this.requestRender()}removePanel(t){this.config.customPanels&&(this.config.customPanels=this.config.customPanels.filter(e=>e.id!==t),this.requestRender())}addAggregationRow(t){this.config.aggregationRows||(this.config.aggregationRows=[]),this.config.aggregationRows.push(t),this.requestRender()}removeAggregationRow(t){this.config.aggregationRows&&(this.config.aggregationRows=this.config.aggregationRows.filter(e=>e.id!==t),this.requestRender())}}export{A as PinnedRowsPlugin};
1
+ function t(t,e){return`[tbw-grid${t?`#${t}`:""}${e?`:${e}`:""}]`}function e(e,n,o,r){return`${t(o,r)} ${e}: ${n}\n\n → More info: ${function(t){return`https://toolboxjs.com/grid/errors#${t.toLowerCase()}`}(e)}`}["__otorp__","__retteGenifed__","__retteSenifed__","rotcurtsnoc","wodniw","sihTlabolg","labolg","ssecorp","noitcnuF","tropmi","lave","tcelfeR","yxorP","rorrE","stnemugra","tnemucod","noitacol","eikooc","egarotSlacol","egarotSnoisses","BDdexedni","hctef","tseuqeRpttHLMX","tekcoSbeW","rekroW","rekroWderahS","rekroWecivreS","renepo","tnerap","pot","semarf","fles"].map(t=>t.split("").reverse().join(""));const n=/* @__PURE__ */new Set(["script","iframe","object","embed","form","input","button","textarea","select","link","meta","base","style","template","slot","portal","frame","frameset","applet","noscript","noembed","plaintext","xmp","listing"]),o=/^on\w+$/i,r=/* @__PURE__ */new Set(["href","src","action","formaction","data","srcdoc","xlink:href","poster","srcset"]),i=/^\s*(javascript|vbscript|data|blob):/i;function s(t){if(!t||"string"!=typeof t)return"";if(-1===t.indexOf("<"))return t;const e=document.createElement("template");return e.innerHTML=t,function(t){const e=[],s=t.querySelectorAll("*");for(const a of s){const t=a.tagName.toLowerCase();if(n.has(t)){e.push(a);continue}if("svg"===t||"http://www.w3.org/2000/svg"===a.namespaceURI){if(Array.from(a.attributes).some(t=>o.test(t.name)||"href"===t.name||"xlink:href"===t.name)){e.push(a);continue}}const s=[];for(const e of a.attributes){const t=e.name.toLowerCase();o.test(t)?s.push(e.name):(r.has(t)&&i.test(e.value)||"style"===t&&/expression\s*\(|javascript:|behavior\s*:/i.test(e.value))&&s.push(e.name)}s.forEach(t=>a.removeAttribute(t))}e.forEach(t=>t.remove())}(e.content),e.innerHTML}const a='<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',l={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:a,filterActive:a,print:"🖨️"};class g{static dependencies;static manifest;aliases;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#t;get defaultConfig(){return{}}constructor(t={}){this.userConfig=t}attach(t){this.#t?.abort(),this.#t=new AbortController,this.grid=t,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#t?.abort(),this.#t=void 0}getPlugin(t){return this.grid?.getPlugin(t)}emit(t,e){this.grid?.dispatchEvent?.(new CustomEvent(t,{detail:e,bubbles:!0}))}emitCancelable(t,e){const n=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(n),n.defaultPrevented}on(t,e){this.grid?._pluginManager?.subscribe(this,t,e)}off(t){this.grid?._pluginManager?.unsubscribe(this,t)}emitPluginEvent(t,e){this.grid?._pluginManager?.emitPluginEvent(t,e)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}requestVirtualRefresh(){this.grid?.requestVirtualRefresh?.()}get rows(){return this.grid?.rows??[]}get sourceRows(){return this.grid?.sourceRows??[]}get columns(){return this.grid?.columns??[]}get visibleColumns(){return this.grid?._visibleColumns??[]}get gridElement(){return this.grid?._hostElement}get disconnectSignal(){return this.#t?.signal??this.grid?.disconnectSignal}get gridIcons(){const t=this.grid?.gridConfig?.icons??{};return{...l,...t}}get isAnimationEnabled(){const t=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===t||"off"===t)return!1;if(!0===t||"on"===t)return!0;const e=this.gridElement;if(e){return"0"!==getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const t=this.gridElement;if(t){const e=getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(),n=parseInt(e,10);if(!isNaN(n))return n}return 200}setIcon(t,e,n){t.dataset.icon=e.replace(/([A-Z])/g,"-$1").toLowerCase(),"collapse"===e?t.dataset.expanded="":"expand"===e&&delete t.dataset.expanded;const o=this.#e(e,n);void 0!==o?"string"==typeof o?t.innerHTML=s(o):o instanceof HTMLElement&&(t.innerHTML="",t.appendChild(o.cloneNode(!0))):t.innerHTML=""}#e(t,e){return void 0!==e?e:this.grid?.gridConfig?.icons?.[t]}updateSortIndicator(t,e){t.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove();const n=document.createElement("span");n.setAttribute("part","sort-indicator"),n.className="sort-indicator",e?(t.setAttribute("aria-sort","asc"===e?"ascending":"descending"),t.setAttribute("data-sort",e),this.setIcon(n,"asc"===e?"sortAsc":"sortDesc")):(t.setAttribute("aria-sort","none"),t.removeAttribute("data-sort"),this.setIcon(n,"sortNone"));const o=t.querySelector(".tbw-filter-btn")??t.querySelector(".resize-handle");return o?t.insertBefore(n,o):t.appendChild(n),n}warn(n,o){void 0!==o?console.warn(e(n,o,this.gridElement.id,this.name)):console.warn(`${t(this.gridElement.id,this.name)} ${n}`)}throwDiagnostic(t,n){throw new Error(e(t,n,this.gridElement.id,this.name))}}const c={sum:(t,e)=>{let n=0;for(let o=0;o<t.length;o++)n+=Number(t[o][e])||0;return n},avg:(t,e)=>{if(!t.length)return 0;let n=0;for(let o=0;o<t.length;o++)n+=Number(t[o][e])||0;return n/t.length},count:t=>t.length,min:(t,e)=>{if(!t.length)return 0;let n=1/0;for(let o=0;o<t.length;o++){const r=Number(t[o][e]);r<n&&(n=r)}return n},max:(t,e)=>{if(!t.length)return 0;let n=-1/0;for(let o=0;o<t.length;o++){const r=Number(t[o][e]);r>n&&(n=r)}return n},first:(t,e)=>t[0]?.[e],last:(t,e)=>t[t.length-1]?.[e]},d=/* @__PURE__ */new Map,h={register(t,e){d.set(t,e)},unregister(t){d.delete(t)},get(t){if(void 0!==t)return"function"==typeof t?t:d.get(t)??c[t]},run(t,e,n,o){const r=this.get(t);return r?r(e,n,o):void 0},has:t=>d.has(t)||t in c,list:()=>[...Object.keys(c),...d.keys()]};function u(t,e){const n=document.createElement("div");n.className="tbw-pinned-rows",n.setAttribute("role","presentation"),n.setAttribute("aria-live","polite");const o=document.createElement("div");o.className="tbw-pinned-rows-left";const r=document.createElement("div");r.className="tbw-pinned-rows-center";const i=document.createElement("div");if(i.className="tbw-pinned-rows-right",!1!==t.showRowCount){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-row-count",t.textContent=`Total: ${e.totalRows} rows`,o.appendChild(t)}if(t.showFilteredCount&&e.filteredRows!==e.totalRows){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-filtered-count",t.textContent=`Filtered: ${e.filteredRows}`,o.appendChild(t)}if(t.showSelectedCount&&e.selectedRows>0){const t=document.createElement("span");t.className="tbw-status-panel tbw-status-panel-selected-count",t.textContent=`Selected: ${e.selectedRows}`,i.appendChild(t)}if(t.customPanels)for(const s of t.customPanels){const t=C(s,e);switch(s.position){case"left":o.appendChild(t);break;case"center":r.appendChild(t);break;case"right":i.appendChild(t)}}return n.appendChild(o),n.appendChild(r),n.appendChild(i),n}function p(t){const e=document.createElement("div");return e.className=`tbw-aggregation-rows tbw-aggregation-rows-${t}`,e.setAttribute("role","presentation"),e}function f(t,e,n,o,r=!1){t.innerHTML="";for(const i of e){const e=document.createElement("div");e.className="tbw-aggregation-row",e.setAttribute("role","presentation"),i.id&&e.setAttribute("data-aggregation-id",i.id);i.fullWidth??r?m(e,i,n,o):b(e,i,n,o),t.appendChild(e)}}function m(t,e,n,o){const r=document.createElement("div");r.className="tbw-aggregation-cell tbw-aggregation-cell-full",r.style.gridColumn="1 / -1";const i="function"==typeof e.label?e.label(o,n):e.label;if(i){const t=document.createElement("span");t.className="tbw-aggregation-label",t.textContent=i,r.appendChild(t)}const s=function(t,e,n){const o=t.aggregators&&Object.keys(t.aggregators).length>0,r=t.cells&&Object.keys(t.cells).length>0;if(!o&&!r)return null;const i=document.createElement("span");i.className="tbw-aggregation-aggregates";for(const s of e){const{value:e,formatter:o}=w(t,s,n);if(null!=e){const t=document.createElement("span");t.className="tbw-aggregation-aggregate",t.setAttribute("data-field",s.field);const n=s.header??s.field,r=o?o(e,s.field,s):String(e);t.textContent=`${n}: ${r}`,i.appendChild(t)}}return i.children.length>0?i:null}(e,n,o);s&&r.appendChild(s),t.appendChild(r)}function b(t,e,n,o){for(const i of n){const n=document.createElement("div");n.className="tbw-aggregation-cell",n.setAttribute("data-field",i.field);const{value:r,formatter:s}=w(e,i,o);n.textContent=null!=r?s?s(r,i.field,i):String(r):"",t.appendChild(n)}const r="function"==typeof e.label?e.label(o,n):e.label;if(r){const e=document.createElement("span");e.className="tbw-aggregation-label",e.textContent=r,t.appendChild(e)}}function w(t,e,n){let o,r;const i=t.aggregators?.[e.field];if(i)if("object"==typeof(s=i)&&null!==s&&"aggFunc"in s){const t=h.get(i.aggFunc);t&&(o=t(n,e.field,e)),r=i.formatter}else{const t=h.get(i);t&&(o=t(n,e.field,e))}else if(t.cells&&Object.prototype.hasOwnProperty.call(t.cells,e.field)){const r=t.cells[e.field];o="function"==typeof r?r(n,e.field,e):r}var s;return{value:o,formatter:r}}function C(t,e){const n=document.createElement("div");n.className="tbw-status-panel tbw-status-panel-custom",n.id=`status-panel-${t.id}`;const o=t.render(e);return"string"==typeof o?n.innerHTML=o:n.appendChild(o),n}function v(t,e,n,o,r){return{totalRows:t.length,filteredRows:r?.cachedResult?.length??t.length,selectedRows:o?.selected?.size??0,columns:e,rows:t,grid:n}}class E extends g{name="pinnedRows";styles="@layer tbw-plugins{.tbw-scroll-area{container-type:inline-size}.tbw-footer{flex-shrink:0;z-index:var(--tbw-z-layer-pinned-rows, 20);background:var(--tbw-color-panel-bg);min-width:fit-content}.tbw-pinned-rows{display:flex;align-items:center;justify-content:space-between;padding:var(--tbw-button-padding, var(--tbw-spacing-md, .5rem) var(--tbw-spacing-lg, .75rem));background:var(--tbw-pinned-rows-bg, var(--tbw-color-panel-bg));border-top:1px solid var(--tbw-pinned-rows-border, var(--tbw-color-border));font-size:var(--tbw-font-size-xs, .75rem);color:var(--tbw-pinned-rows-color, var(--tbw-color-fg-muted));min-height:32px;box-sizing:border-box;position:sticky;left:0;min-width:0;width:100cqi}.tbw-pinned-rows-left,.tbw-pinned-rows-center,.tbw-pinned-rows-right{display:flex;align-items:center;gap:var(--tbw-spacing-xl, 1rem)}.tbw-pinned-rows-left{justify-content:flex-start}.tbw-pinned-rows-center{justify-content:center;flex:1}.tbw-pinned-rows-right{justify-content:flex-end}.tbw-status-panel{white-space:nowrap}.tbw-aggregation-rows{min-width:fit-content;background:var(--tbw-aggregation-bg, var(--tbw-color-header-bg))}.tbw-aggregation-rows-top{border-bottom:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-rows-bottom{border-top:1px solid var(--tbw-aggregation-border, var(--tbw-color-border))}.tbw-aggregation-row{display:grid;grid-template-columns:var(--tbw-column-template);font-size:var(--tbw-aggregation-font-size, .8em);font-weight:var(--tbw-aggregation-font-weight, 600);position:relative;background:inherit}.tbw-aggregation-row>.tbw-aggregation-label{position:sticky;left:0;grid-row:1;grid-column:1;display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem);background:inherit;z-index:1;pointer-events:none}.tbw-aggregation-row>.tbw-aggregation-cell:first-child{grid-column:1;grid-row:1}.tbw-aggregation-cell:not(:empty){position:relative;z-index:2;background:inherit}.tbw-aggregation-cell{padding:var(--tbw-cell-padding, .125rem .5rem);min-height:var(--tbw-row-height, 1.75rem);display:block;align-items:center;align-content:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;text-overflow:ellipsis;white-space:var(--tbw-cell-white-space, nowrap)}.tbw-aggregation-cell:last-child{border-right:0}.tbw-aggregation-cell-full{grid-column:1 / -1;border-right:0;display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem)}.tbw-aggregation-label{white-space:nowrap}.tbw-aggregation-aggregates{display:flex;align-items:center;gap:var(--tbw-spacing-lg, .75rem);font-weight:400;opacity:.85}.tbw-aggregation-aggregate{white-space:nowrap}}";get defaultConfig(){return{position:"bottom",showRowCount:!0,showSelectedCount:!0,showFilteredCount:!0}}infoBarElement=null;topAggregationContainer=null;bottomAggregationContainer=null;footerWrapper=null;detach(){this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null),this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null)}afterRender(){const t=this.gridElement;if(!t)return;const e=t.querySelector(".tbw-scroll-area")??t.querySelector(".tbw-grid-content")??t.querySelector(".tbw-grid-root");if(!e)return;this.footerWrapper&&!e.contains(this.footerWrapper)&&(this.footerWrapper=null,this.bottomAggregationContainer=null,this.infoBarElement=null),this.topAggregationContainer&&!e.contains(this.topAggregationContainer)&&(this.topAggregationContainer=null),this.infoBarElement&&!e.contains(this.infoBarElement)&&(this.infoBarElement=null);const n=this.getSelectionState(),o=this.getFilterState(),r=v(this.sourceRows,this.columns,this.gridElement,n,o),i=this.config.aggregationRows||[],s=i.filter(t=>"top"===t.position),a=i.filter(t=>"top"!==t.position);if(s.length>0){if(!this.topAggregationContainer){this.topAggregationContainer=p("top");const n=t.querySelector(".header");n&&n.nextSibling?e.insertBefore(this.topAggregationContainer,n.nextSibling):e.appendChild(this.topAggregationContainer)}f(this.topAggregationContainer,s,this.visibleColumns,this.sourceRows,this.config.fullWidth)}else this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null);const l=!1!==this.config.showRowCount||this.config.showSelectedCount&&r.selectedRows>0||this.config.showFilteredCount&&r.filteredRows!==r.totalRows||this.config.customPanels&&this.config.customPanels.length>0,g=l&&"top"!==this.config.position,c=a.length>0||g;if(l&&"top"===this.config.position)if(this.infoBarElement){const t=u(this.config,r);this.infoBarElement.replaceWith(t),this.infoBarElement=t}else this.infoBarElement=u(this.config,r),e.insertBefore(this.infoBarElement,e.firstChild);else"top"===this.config.position&&this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null);c?(this.footerWrapper||(this.footerWrapper=document.createElement("div"),this.footerWrapper.className="tbw-footer",e.appendChild(this.footerWrapper)),this.footerWrapper.innerHTML="",a.length>0&&(this.bottomAggregationContainer||(this.bottomAggregationContainer=p("bottom")),this.footerWrapper.appendChild(this.bottomAggregationContainer),f(this.bottomAggregationContainer,a,this.visibleColumns,this.sourceRows,this.config.fullWidth)),g&&(this.infoBarElement=u(this.config,r),this.footerWrapper.appendChild(this.infoBarElement))):this.cleanupFooter()}cleanup(){this.infoBarElement&&(this.infoBarElement.remove(),this.infoBarElement=null),this.topAggregationContainer&&(this.topAggregationContainer.remove(),this.topAggregationContainer=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null)}cleanupFooter(){this.footerWrapper&&(this.footerWrapper.remove(),this.footerWrapper=null),this.bottomAggregationContainer&&(this.bottomAggregationContainer.remove(),this.bottomAggregationContainer=null),this.infoBarElement&&"top"!==this.config.position&&(this.infoBarElement.remove(),this.infoBarElement=null)}getSelectionState(){try{return this.grid?.getPluginState?.("selection")??null}catch{return null}}getFilterState(){try{return this.grid?.getPluginState?.("filtering")??null}catch{return null}}refresh(){this.requestRender()}getContext(){const t=this.getSelectionState(),e=this.getFilterState();return v(this.rows,this.columns,this.gridElement,t,e)}addPanel(t){this.config.customPanels||(this.config.customPanels=[]),this.config.customPanels.push(t),this.requestRender()}removePanel(t){this.config.customPanels&&(this.config.customPanels=this.config.customPanels.filter(e=>e.id!==t),this.requestRender())}addAggregationRow(t){this.config.aggregationRows||(this.config.aggregationRows=[]),this.config.aggregationRows.push(t),this.requestRender()}removeAggregationRow(t){this.config.aggregationRows&&(this.config.aggregationRows=this.config.aggregationRows.filter(e=>e.id!==t),this.requestRender())}}export{E as PinnedRowsPlugin};
2
2
  //# sourceMappingURL=index.js.map