@toolbox-web/grid 1.23.4 → 1.24.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 (207) hide show
  1. package/README.md +35 -6
  2. package/all.d.ts +2 -2
  3. package/all.d.ts.map +1 -1
  4. package/all.js +2 -2
  5. package/all.js.map +1 -1
  6. package/index.js +1 -1
  7. package/index.js.map +1 -1
  8. package/lib/core/grid.d.ts +21 -0
  9. package/lib/core/grid.d.ts.map +1 -1
  10. package/lib/core/internal/feature-hook.d.ts +8 -0
  11. package/lib/core/internal/feature-hook.d.ts.map +1 -0
  12. package/lib/core/plugin/base-plugin.d.ts +8 -2
  13. package/lib/core/plugin/base-plugin.d.ts.map +1 -1
  14. package/lib/core/plugin/types.d.ts +1 -1
  15. package/lib/core/types.d.ts +59 -0
  16. package/lib/core/types.d.ts.map +1 -1
  17. package/lib/features/clipboard.d.ts +8 -0
  18. package/lib/features/clipboard.d.ts.map +1 -0
  19. package/lib/features/clipboard.js +2 -0
  20. package/lib/features/clipboard.js.map +1 -0
  21. package/lib/features/column-virtualization.d.ts +8 -0
  22. package/lib/features/column-virtualization.d.ts.map +1 -0
  23. package/lib/features/column-virtualization.js +2 -0
  24. package/lib/features/column-virtualization.js.map +1 -0
  25. package/lib/features/context-menu.d.ts +8 -0
  26. package/lib/features/context-menu.d.ts.map +1 -0
  27. package/lib/features/context-menu.js +2 -0
  28. package/lib/features/context-menu.js.map +1 -0
  29. package/lib/features/editing.d.ts +8 -0
  30. package/lib/features/editing.d.ts.map +1 -0
  31. package/lib/features/editing.js +2 -0
  32. package/lib/features/editing.js.map +1 -0
  33. package/lib/features/export.d.ts +8 -0
  34. package/lib/features/export.d.ts.map +1 -0
  35. package/lib/features/export.js +2 -0
  36. package/lib/features/export.js.map +1 -0
  37. package/lib/features/filtering.d.ts +8 -0
  38. package/lib/features/filtering.d.ts.map +1 -0
  39. package/lib/features/filtering.js +2 -0
  40. package/lib/features/filtering.js.map +1 -0
  41. package/lib/features/grouping-columns.d.ts +8 -0
  42. package/lib/features/grouping-columns.d.ts.map +1 -0
  43. package/lib/features/grouping-columns.js +2 -0
  44. package/lib/features/grouping-columns.js.map +1 -0
  45. package/lib/features/grouping-rows.d.ts +8 -0
  46. package/lib/features/grouping-rows.d.ts.map +1 -0
  47. package/lib/features/grouping-rows.js +2 -0
  48. package/lib/features/grouping-rows.js.map +1 -0
  49. package/lib/features/magic-string.es-CkyDP9Ir.mjs.map +1 -0
  50. package/lib/features/master-detail.d.ts +8 -0
  51. package/lib/features/master-detail.d.ts.map +1 -0
  52. package/lib/features/master-detail.js +2 -0
  53. package/lib/features/master-detail.js.map +1 -0
  54. package/lib/features/multi-sort.d.ts +10 -0
  55. package/lib/features/multi-sort.d.ts.map +1 -0
  56. package/lib/features/multi-sort.js +2 -0
  57. package/lib/features/multi-sort.js.map +1 -0
  58. package/lib/features/pinned-columns.d.ts +18 -0
  59. package/lib/features/pinned-columns.d.ts.map +1 -0
  60. package/lib/features/pinned-columns.js +2 -0
  61. package/lib/features/pinned-columns.js.map +1 -0
  62. package/lib/features/pinned-rows.d.ts +8 -0
  63. package/lib/features/pinned-rows.d.ts.map +1 -0
  64. package/lib/features/pinned-rows.js +2 -0
  65. package/lib/features/pinned-rows.js.map +1 -0
  66. package/lib/features/pivot.d.ts +8 -0
  67. package/lib/features/pivot.d.ts.map +1 -0
  68. package/lib/features/pivot.js +2 -0
  69. package/lib/features/pivot.js.map +1 -0
  70. package/lib/features/print.d.ts +8 -0
  71. package/lib/features/print.d.ts.map +1 -0
  72. package/lib/features/print.js +2 -0
  73. package/lib/features/print.js.map +1 -0
  74. package/lib/features/registry.d.ts +50 -0
  75. package/lib/features/registry.d.ts.map +1 -0
  76. package/lib/features/registry.js +2 -0
  77. package/lib/features/registry.js.map +1 -0
  78. package/lib/features/registry.spec.js +5 -0
  79. package/lib/features/registry.spec.js.map +1 -0
  80. package/lib/features/reorder-columns.d.ts +10 -0
  81. package/lib/features/reorder-columns.d.ts.map +1 -0
  82. package/lib/features/reorder-columns.js +2 -0
  83. package/lib/features/reorder-columns.js.map +1 -0
  84. package/lib/features/reorder-rows.d.ts +10 -0
  85. package/lib/features/reorder-rows.d.ts.map +1 -0
  86. package/lib/features/reorder-rows.js +2 -0
  87. package/lib/features/reorder-rows.js.map +1 -0
  88. package/lib/features/responsive.d.ts +8 -0
  89. package/lib/features/responsive.d.ts.map +1 -0
  90. package/lib/features/responsive.js +2 -0
  91. package/lib/features/responsive.js.map +1 -0
  92. package/lib/features/selection.d.ts +8 -0
  93. package/lib/features/selection.d.ts.map +1 -0
  94. package/lib/features/selection.js +2 -0
  95. package/lib/features/selection.js.map +1 -0
  96. package/lib/features/server-side.d.ts +8 -0
  97. package/lib/features/server-side.d.ts.map +1 -0
  98. package/lib/features/server-side.js +2 -0
  99. package/lib/features/server-side.js.map +1 -0
  100. package/lib/features/tree.d.ts +8 -0
  101. package/lib/features/tree.d.ts.map +1 -0
  102. package/lib/features/tree.js +2 -0
  103. package/lib/features/tree.js.map +1 -0
  104. package/lib/features/undo-redo.d.ts +8 -0
  105. package/lib/features/undo-redo.d.ts.map +1 -0
  106. package/lib/features/undo-redo.js +2 -0
  107. package/lib/features/undo-redo.js.map +1 -0
  108. package/lib/features/visibility.d.ts +8 -0
  109. package/lib/features/visibility.d.ts.map +1 -0
  110. package/lib/features/visibility.js +2 -0
  111. package/lib/features/visibility.js.map +1 -0
  112. package/lib/plugins/clipboard/index.js +1 -1
  113. package/lib/plugins/clipboard/index.js.map +1 -1
  114. package/lib/plugins/column-virtualization/index.js +1 -1
  115. package/lib/plugins/column-virtualization/index.js.map +1 -1
  116. package/lib/plugins/context-menu/index.js +1 -1
  117. package/lib/plugins/context-menu/index.js.map +1 -1
  118. package/lib/plugins/editing/index.js +1 -1
  119. package/lib/plugins/editing/index.js.map +1 -1
  120. package/lib/plugins/export/index.js +1 -1
  121. package/lib/plugins/export/index.js.map +1 -1
  122. package/lib/plugins/filtering/index.js +1 -1
  123. package/lib/plugins/filtering/index.js.map +1 -1
  124. package/lib/plugins/filtering/types.d.ts +428 -27
  125. package/lib/plugins/filtering/types.d.ts.map +1 -1
  126. package/lib/plugins/grouping-columns/index.d.ts +1 -1
  127. package/lib/plugins/grouping-columns/index.js +1 -1
  128. package/lib/plugins/grouping-columns/index.js.map +1 -1
  129. package/lib/plugins/grouping-rows/index.d.ts +2 -2
  130. package/lib/plugins/grouping-rows/index.d.ts.map +1 -1
  131. package/lib/plugins/grouping-rows/index.js +1 -1
  132. package/lib/plugins/grouping-rows/index.js.map +1 -1
  133. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +2 -2
  134. package/lib/plugins/master-detail/index.js +1 -1
  135. package/lib/plugins/master-detail/index.js.map +1 -1
  136. package/lib/plugins/multi-sort/index.js +1 -1
  137. package/lib/plugins/multi-sort/index.js.map +1 -1
  138. package/lib/plugins/pinned-columns/index.js +1 -1
  139. package/lib/plugins/pinned-columns/index.js.map +1 -1
  140. package/lib/plugins/pinned-columns/types.d.ts +3 -3
  141. package/lib/plugins/pinned-rows/index.js +1 -1
  142. package/lib/plugins/pinned-rows/index.js.map +1 -1
  143. package/lib/plugins/pivot/index.js +1 -1
  144. package/lib/plugins/pivot/index.js.map +1 -1
  145. package/lib/plugins/print/index.js +1 -1
  146. package/lib/plugins/print/index.js.map +1 -1
  147. package/lib/plugins/{reorder → reorder-columns}/ReorderPlugin.d.ts +5 -3
  148. package/lib/plugins/reorder-columns/ReorderPlugin.d.ts.map +1 -0
  149. package/lib/plugins/reorder-columns/column-drag.d.ts.map +1 -0
  150. package/lib/plugins/{reorder → reorder-columns}/index.d.ts +2 -2
  151. package/lib/plugins/reorder-columns/index.d.ts.map +1 -0
  152. package/lib/plugins/reorder-columns/index.js +2 -0
  153. package/lib/plugins/reorder-columns/index.js.map +1 -0
  154. package/lib/plugins/{reorder → reorder-columns}/types.d.ts +5 -0
  155. package/lib/plugins/reorder-columns/types.d.ts.map +1 -0
  156. package/lib/plugins/{row-reorder → reorder-rows}/RowReorderPlugin.d.ts +5 -3
  157. package/lib/plugins/reorder-rows/RowReorderPlugin.d.ts.map +1 -0
  158. package/lib/plugins/{row-reorder → reorder-rows}/index.d.ts +2 -2
  159. package/lib/plugins/reorder-rows/index.d.ts.map +1 -0
  160. package/lib/plugins/reorder-rows/index.js +2 -0
  161. package/lib/plugins/reorder-rows/index.js.map +1 -0
  162. package/lib/plugins/{row-reorder → reorder-rows}/types.d.ts +5 -0
  163. package/lib/plugins/reorder-rows/types.d.ts.map +1 -0
  164. package/lib/plugins/responsive/ResponsivePlugin.d.ts +2 -2
  165. package/lib/plugins/responsive/index.js +1 -1
  166. package/lib/plugins/responsive/index.js.map +1 -1
  167. package/lib/plugins/selection/index.js +1 -1
  168. package/lib/plugins/selection/index.js.map +1 -1
  169. package/lib/plugins/server-side/index.js +1 -1
  170. package/lib/plugins/server-side/index.js.map +1 -1
  171. package/lib/plugins/tree/index.js +1 -1
  172. package/lib/plugins/tree/index.js.map +1 -1
  173. package/lib/plugins/undo-redo/index.js +1 -1
  174. package/lib/plugins/undo-redo/index.js.map +1 -1
  175. package/lib/plugins/visibility/VisibilityPlugin.d.ts +1 -1
  176. package/lib/plugins/visibility/index.js +1 -1
  177. package/lib/plugins/visibility/index.js.map +1 -1
  178. package/package.json +17 -2
  179. package/public.d.ts +9 -2
  180. package/public.d.ts.map +1 -1
  181. package/umd/grid.all.umd.js +1 -1
  182. package/umd/grid.all.umd.js.map +1 -1
  183. package/umd/grid.umd.js +1 -1
  184. package/umd/grid.umd.js.map +1 -1
  185. package/umd/plugins/master-detail.umd.js.map +1 -1
  186. package/umd/plugins/reorder-columns.umd.js +2 -0
  187. package/umd/plugins/reorder-columns.umd.js.map +1 -0
  188. package/umd/plugins/reorder-rows.umd.js +2 -0
  189. package/umd/plugins/reorder-rows.umd.js.map +1 -0
  190. package/umd/plugins/responsive.umd.js.map +1 -1
  191. package/umd/plugins/visibility.umd.js.map +1 -1
  192. package/lib/plugins/reorder/ReorderPlugin.d.ts.map +0 -1
  193. package/lib/plugins/reorder/column-drag.d.ts.map +0 -1
  194. package/lib/plugins/reorder/index.d.ts.map +0 -1
  195. package/lib/plugins/reorder/index.js +0 -2
  196. package/lib/plugins/reorder/index.js.map +0 -1
  197. package/lib/plugins/reorder/types.d.ts.map +0 -1
  198. package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +0 -1
  199. package/lib/plugins/row-reorder/index.d.ts.map +0 -1
  200. package/lib/plugins/row-reorder/index.js +0 -2
  201. package/lib/plugins/row-reorder/index.js.map +0 -1
  202. package/lib/plugins/row-reorder/types.d.ts.map +0 -1
  203. package/umd/plugins/reorder.umd.js +0 -2
  204. package/umd/plugins/reorder.umd.js.map +0 -1
  205. package/umd/plugins/row-reorder.umd.js +0 -2
  206. package/umd/plugins/row-reorder.umd.js.map +0 -1
  207. /package/lib/plugins/{reorder → reorder-columns}/column-drag.d.ts +0 -0
@@ -181,14 +181,14 @@ export declare class MasterDetailPlugin extends BaseGridPlugin<MasterDetailConfi
181
181
  * Return total extra height from all expanded detail rows.
182
182
  * Used by grid virtualization to adjust scrollbar height.
183
183
  *
184
- * @deprecated Use getRowHeight() instead. This hook will be removed in v3.0.
184
+ * @deprecated Use getRowHeight() instead. This hook will be removed in v2.0.
185
185
  */
186
186
  getExtraHeight(): number;
187
187
  /**
188
188
  * Return extra height that appears before a given row index.
189
189
  * This is the sum of heights of all expanded details whose parent row is before the given index.
190
190
  *
191
- * @deprecated Use getRowHeight() instead. This hook will be removed in v3.0.
191
+ * @deprecated Use getRowHeight() instead. This hook will be removed in v2.0.
192
192
  */
193
193
  getExtraHeightBefore(beforeRowIndex: number): number;
194
194
  /**
@@ -1,2 +1,2 @@
1
- const e=/{{\s*([^}]+)\s*}}/g,t="__DG_EMPTY__",i=/^[\w$. '?+\-*/%:()!<>=,&|]+$/,n=/__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/,r=/* @__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"]),s=/^on\w+$/i,o=/* @__PURE__ */new Set(["href","src","action","formaction","data","srcdoc","xlink:href","poster","srcset"]),a=/^\s*(javascript|vbscript|data|blob):/i;function l(e){if(!e||"string"!=typeof e)return"";if(-1===e.indexOf("<"))return e;const t=document.createElement("template");return t.innerHTML=e,function(e){const t=[],i=e.querySelectorAll("*");for(const n of i){const e=n.tagName.toLowerCase();if(r.has(e)){t.push(n);continue}if("svg"===e||"http://www.w3.org/2000/svg"===n.namespaceURI){if(Array.from(n.attributes).some(e=>s.test(e.name)||"href"===e.name||"xlink:href"===e.name)){t.push(n);continue}}const i=[];for(const t of n.attributes){const e=t.name.toLowerCase();s.test(e)?i.push(t.name):(o.has(e)&&a.test(t.value)||"style"===e&&/expression\s*\(|javascript:|behavior\s*:/i.test(t.value))&&i.push(t.name)}i.forEach(e=>n.removeAttribute(e))}t.forEach(e=>e.remove())}(t.content),t.innerHTML}function d(r,s){if(!r||-1===r.indexOf("{{"))return r;const o=[],a=r.replace(e,(e,r)=>{const a=function(e,r){if(e=(e||"").trim(),!e)return t;if(c.test(e))return t;if("value"===e)return null==r.value?t:String(r.value);if(e.startsWith("row.")&&!/[()?]/.test(e)&&!e.includes(":")){const i=e.slice(4),n=r.row?r.row[i]:void 0;return null==n?t:String(n)}if(e.length>80)return t;if(!i.test(e)||n.test(e))return t;const s=e.match(/\./g);if(s&&s.length>1)return t;try{const i=new Function("value","row",`return (${e});`)(r.value,r.row),n=null==i?"":String(i);return c.test(n)?t:n||t}catch{return t}}(r,s);return o.push({expr:r.trim(),result:a}),a}),l=(d=a)?d.replace(new RegExp(t,"g"),"").replace(/Reflect\.[^<>{}\s]+|\bProxy\b|ownKeys\([^)]*\)/g,""):d;var d;const h=o.length&&o.every(e=>""===e.result||e.result===t);return c.test(r)||h?"":l}const c=/Reflect|Proxy|ownKeys/;const h='<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>',u={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:h,filterActive:h,print:"🖨️"};class g{static dependencies;static manifest;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#e;get defaultConfig(){return{}}constructor(e={}){this.userConfig=e}attach(e){this.#e?.abort(),this.#e=new AbortController,this.grid=e,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#e?.abort(),this.#e=void 0}getPlugin(e){return this.grid?.getPlugin(e)}emit(e,t){this.grid?.dispatchEvent?.(new CustomEvent(e,{detail:t,bubbles:!0}))}emitCancelable(e,t){const i=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(i),i.defaultPrevented}on(e,t){this.grid?._pluginManager?.subscribe(this,e,t)}off(e){this.grid?._pluginManager?.unsubscribe(this,e)}emitPluginEvent(e,t){this.grid?._pluginManager?.emitPluginEvent(e,t)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}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}get disconnectSignal(){return this.#e?.signal??this.grid?.disconnectSignal}get gridIcons(){const e=this.grid?.gridConfig?.icons??{};return{...u,...e}}get isAnimationEnabled(){const e=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===e||"off"===e)return!1;if(!0===e||"on"===e)return!0;const t=this.gridElement;if(t){return"0"!==getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const e=this.gridElement;if(e){const t=getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(),i=parseInt(t,10);if(!isNaN(i))return i}return 200}resolveIcon(e,t){return void 0!==t?t:this.gridIcons[e]}setIcon(e,t){"string"==typeof t?e.innerHTML=t:t instanceof HTMLElement&&(e.innerHTML="",e.appendChild(t.cloneNode(!0)))}warn(e){console.warn(`[tbw-grid:${this.name}] ${e}`)}}const f="__tbw_expander";function m(e){return e.field===f}function p(e,t){const i=new Set(e);return i.has(t)?i.delete(t):i.add(t),i}function w(e,t,i,n){const r=document.createElement("div");r.className="master-detail-row",r.setAttribute("data-detail-for",String(t)),r.setAttribute("role","row");const s=document.createElement("div");s.className="master-detail-cell",s.setAttribute("role","cell"),s.style.gridColumn=`1 / ${n+1}`;const o=i(e,t);return"string"==typeof o?s.innerHTML=o:o instanceof HTMLElement&&s.appendChild(o),r.appendChild(s),r}class b extends g{name="masterDetail";styles="@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}tbw-grid .master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center}tbw-grid .master-detail-toggle:hover{opacity:1}tbw-grid .master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}tbw-grid .master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}tbw-grid .master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";get defaultConfig(){return{detailHeight:"auto",expandOnRowClick:!1,collapseOnClickOutside:!1,animation:"slide"}}attach(e){super.attach(e),this.parseLightDomDetail()}parseLightDomDetail(){const e=this.grid;if(!e||"function"!=typeof e.querySelector)return;const t=e.querySelector("tbw-grid-detail");if(!t)return;const i=e;if(i.__frameworkAdapter?.parseDetailElement){const e=i.__frameworkAdapter.parseDetailElement(t);if(e)return void(this.config={...this.config,detailRenderer:e})}const n=t.getAttribute("animation"),r=t.getAttribute("show-expand-column"),s=t.getAttribute("expand-on-row-click"),o=t.getAttribute("collapse-on-click-outside"),a=t.getAttribute("height"),c={};null!==n&&(c.animation="false"!==n&&n),null!==r&&(c.showExpandColumn="false"!==r),null!==s&&(c.expandOnRowClick="true"===s),null!==o&&(c.collapseOnClickOutside="true"===o),null!==a&&(c.detailHeight="auto"===a?"auto":parseInt(a,10));const h=t.innerHTML.trim();h&&!this.config.detailRenderer&&(c.detailRenderer=(e,t)=>l(d(h,{value:e,row:e}))),Object.keys(c).length>0&&(this.config={...this.config,...c})}get animationStyle(){return!!this.isAnimationEnabled&&(this.config.animation??"slide")}animateExpand(e,t,i){if(!this.isAnimationEnabled||!1===this.animationStyle)return!1;e.classList.add("tbw-expanding");let n=!1;const r=()=>{n||(n=!0,e.classList.remove("tbw-expanding"),void 0!==t&&void 0!==i&&this.#t(e,t,i))};return e.addEventListener("animationend",r,{once:!0}),setTimeout(r,this.animationDuration+50),!0}animateCollapse(e,t){if(!this.isAnimationEnabled||!1===this.animationStyle)return void t();e.classList.add("tbw-collapsing");const i=()=>{e.classList.remove("tbw-collapsing"),t()};e.addEventListener("animationend",i,{once:!0}),setTimeout(i,this.animationDuration+50)}#t(e,t,i){if(!e.isConnected)return;const n=e.offsetHeight;if(n>0){const e=this.measuredDetailHeights.get(t);this.measuredDetailHeights.set(t,n),e!==n&&this.grid.invalidateRowHeight(i)}}expandedRows=/* @__PURE__ */new Set;detailElements=/* @__PURE__ */new Map;measuredDetailHeights=/* @__PURE__ */new Map;rowsToAnimate=/* @__PURE__ */new Set;static DEFAULT_DETAIL_HEIGHT=150;getDetailHeight(e){const t=this.detailElements.get(e);if(t){if(!(t.classList.contains("tbw-expanding")||t.classList.contains("tbw-collapsing"))){const i=t.offsetHeight;if(i>0)return this.measuredDetailHeights.set(e,i),i}}const i=this.measuredDetailHeights.get(e);return i&&i>0?i:"number"==typeof this.config?.detailHeight?this.config.detailHeight:b.DEFAULT_DETAIL_HEIGHT}toggleAndEmit(e,t){this.expandedRows=p(this.expandedRows,e);const i=this.expandedRows.has(e);i&&this.rowsToAnimate.add(e),this.emit("detail-expand",{rowIndex:t,row:e,expanded:i}),this.requestRender()}detach(){this.expandedRows.clear(),this.detailElements.clear(),this.measuredDetailHeights.clear(),this.rowsToAnimate.clear()}processColumns(e){if(!(!0===this.config.showExpandColumn||!1!==this.config.showExpandColumn&&!!this.config.detailRenderer))return[...e];const t=[...e],i=function(e){return e.find(m)}(t);if(i)return t;const n=(r=this.name,{field:f,header:"",width:32,resizable:!1,sortable:!1,filterable:!1,meta:{lockPosition:!0,suppressMovable:!0,expanderColumn:!0,expanderPlugin:r,utility:!0}});var r;return n.viewRenderer=e=>{const{row:t}=e,i=this.expandedRows.has(t),n=document.createElement("span");n.className="master-detail-expander expander-cell";const r=document.createElement("span");return r.className="master-detail-toggle"+(i?" expanded":""),this.setIcon(r,this.resolveIcon(i?"collapse":"expand")),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-expanded",String(i)),r.setAttribute("aria-label",i?"Collapse details":"Expand details"),n.appendChild(r),n},[n,...t]}onRowClick(e){if(this.config.expandOnRowClick&&this.config.detailRenderer)return this.toggleAndEmit(e.row,e.rowIndex),!1}onCellClick(e){const t=e.originalEvent?.target;if(t?.classList.contains("master-detail-toggle"))return this.toggleAndEmit(e.row,e.rowIndex),!0;this.expandedRows.size>0&&queueMicrotask(()=>this.#i())}onKeyDown(e){if(" "!==e.key)return;const t=this.grid._focusCol,i=this.grid._focusRow,n=this.visibleColumns[t];if(!n||!m(n))return;const r=this.rows[i];return r?(e.preventDefault(),this.toggleAndEmit(r,i),this.requestRenderWithFocus(),!0):void 0}afterRender(){this.#i()}onScrollRender(){this.config.detailRenderer&&0!==this.expandedRows.size&&this.#i()}#i(){if(!this.config.detailRenderer)return;const e=this.gridElement?.querySelector(".rows");if(!e)return;const t=this.grid,i=t._rowPool,n=t._virtualization?.start??0,r=t._virtualization?.end??0,s=this.columns.length,o=n,a=r,l=/* @__PURE__ */new Map;if(i){const t=Math.min(i.length,a-o);for(let n=0;n<t;n++){const t=i[n];t.parentNode===e&&l.set(o+n,t)}}else{const t=e.querySelectorAll(".data-grid-row");for(const e of t){const t=e.querySelector(".cell[data-row]"),i=t?parseInt(t.getAttribute("data-row")??"-1",10):-1;i>=0&&l.set(i,e)}}for(const[d,c]of this.detailElements){const e=this.rows.indexOf(d),t=this.expandedRows.has(d),i=e>=0&&l.has(e);if(!t||!i){const e=this.grid.__frameworkAdapter;if(e?.unmount){const t=c.querySelector(".master-detail-cell"),i=t?.firstElementChild;i&&e.unmount(i)}c.parentNode&&c.remove(),this.detailElements.delete(d)}}for(const[d,c]of l){const e=this.rows[d];if(!e||!this.expandedRows.has(e))continue;const t=this.detailElements.get(e);if(t){t.previousElementSibling!==c&&c.after(t);continue}const i=w(e,d,this.config.detailRenderer,s);"number"==typeof this.config.detailHeight&&(i.style.height=`${this.config.detailHeight}px`),c.after(i),this.detailElements.set(e,i);const n=this.rowsToAnimate.has(e);n&&this.rowsToAnimate.delete(e);n&&this.animateExpand(i,e,d)||requestAnimationFrame(()=>{this.#t(i,e,d)})}}getExtraHeight(){let e=0;for(const t of this.expandedRows)e+=this.getDetailHeight(t);return e}getExtraHeightBefore(e){let t=0;for(const i of this.expandedRows){const n=this.rows.indexOf(i);n>=0&&n<e&&(t+=this.getDetailHeight(i))}return t}getRowHeight(e,t){if(!this.expandedRows.has(e))return;return(this.grid.defaultRowHeight??28)+this.getDetailHeight(e)}adjustVirtualStart(e,t,i){if(0===this.expandedRows.size)return e;const n=this.grid?._virtualization?.positionCache;let r=e;if(n&&n.length>0)for(const s of this.expandedRows){const i=this.rows.indexOf(s);if(i<0||i>=e)continue;n[i].offset+n[i].height>t&&i<r&&(r=i)}else{const n=[];for(const e of this.expandedRows){const t=this.rows.indexOf(e);t>=0&&n.push({index:t,row:e})}n.sort((e,t)=>e.index-t.index);let s=0;for(const{index:o,row:a}of n){const n=o*i+s,l=this.getDetailHeight(a);s+=l,o>=e||n+i+l>t&&o<r&&(r=o)}}return r}expand(e){const t=this.rows[e];t&&(this.rowsToAnimate.add(t),this.expandedRows=function(e,t){const i=new Set(e);return i.add(t),i}(this.expandedRows,t),this.requestRender())}collapse(e){const t=this.rows[e];t&&(this.expandedRows=function(e,t){const i=new Set(e);return i.delete(t),i}(this.expandedRows,t),this.requestRender())}toggle(e){const t=this.rows[e];t&&(this.expandedRows=p(this.expandedRows,t),this.expandedRows.has(t)&&this.rowsToAnimate.add(t),this.requestRender())}isExpanded(e){const t=this.rows[e];return!!t&&function(e,t){return e.has(t)}(this.expandedRows,t)}expandAll(){for(const e of this.rows)this.rowsToAnimate.add(e),this.expandedRows.add(e);this.requestRender()}collapseAll(){this.expandedRows.clear(),this.requestRender()}getExpandedRows(){const e=[];for(const t of this.expandedRows){const i=this.rows.indexOf(t);i>=0&&e.push(i)}return e}getDetailElement(e){const t=this.rows[e];return t?this.detailElements.get(t):void 0}refreshDetailRenderer(){const e=this.config.detailRenderer;if(this.config={...this.config,detailRenderer:void 0},this.parseLightDomDetail(),!this.config.detailRenderer&&e&&(this.config={...this.config,detailRenderer:e}),this.config.detailRenderer){const e=this.grid;"function"==typeof e.refreshColumns?e.refreshColumns():this.requestRender()}}}export{b as MasterDetailPlugin};
1
+ const e=/{{\s*([^}]+)\s*}}/g,t="__DG_EMPTY__",i=/^[\w$. '?+\-*/%:()!<>=,&|]+$/,n=/__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/,r=/* @__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"]),s=/^on\w+$/i,o=/* @__PURE__ */new Set(["href","src","action","formaction","data","srcdoc","xlink:href","poster","srcset"]),a=/^\s*(javascript|vbscript|data|blob):/i;function l(e){if(!e||"string"!=typeof e)return"";if(-1===e.indexOf("<"))return e;const t=document.createElement("template");return t.innerHTML=e,function(e){const t=[],i=e.querySelectorAll("*");for(const n of i){const e=n.tagName.toLowerCase();if(r.has(e)){t.push(n);continue}if("svg"===e||"http://www.w3.org/2000/svg"===n.namespaceURI){if(Array.from(n.attributes).some(e=>s.test(e.name)||"href"===e.name||"xlink:href"===e.name)){t.push(n);continue}}const i=[];for(const t of n.attributes){const e=t.name.toLowerCase();s.test(e)?i.push(t.name):(o.has(e)&&a.test(t.value)||"style"===e&&/expression\s*\(|javascript:|behavior\s*:/i.test(t.value))&&i.push(t.name)}i.forEach(e=>n.removeAttribute(e))}t.forEach(e=>e.remove())}(t.content),t.innerHTML}function d(r,s){if(!r||-1===r.indexOf("{{"))return r;const o=[],a=r.replace(e,(e,r)=>{const a=function(e,r){if(e=(e||"").trim(),!e)return t;if(c.test(e))return t;if("value"===e)return null==r.value?t:String(r.value);if(e.startsWith("row.")&&!/[()?]/.test(e)&&!e.includes(":")){const i=e.slice(4),n=r.row?r.row[i]:void 0;return null==n?t:String(n)}if(e.length>80)return t;if(!i.test(e)||n.test(e))return t;const s=e.match(/\./g);if(s&&s.length>1)return t;try{const i=new Function("value","row",`return (${e});`)(r.value,r.row),n=null==i?"":String(i);return c.test(n)?t:n||t}catch{return t}}(r,s);return o.push({expr:r.trim(),result:a}),a}),l=(d=a)?d.replace(new RegExp(t,"g"),"").replace(/Reflect\.[^<>{}\s]+|\bProxy\b|ownKeys\([^)]*\)/g,""):d;var d;const h=o.length&&o.every(e=>""===e.result||e.result===t);return c.test(r)||h?"":l}const c=/Reflect|Proxy|ownKeys/;const h='<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>',u={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:h,filterActive:h,print:"🖨️"};class g{static dependencies;static manifest;aliases;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#e;get defaultConfig(){return{}}constructor(e={}){this.userConfig=e}attach(e){this.#e?.abort(),this.#e=new AbortController,this.grid=e,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#e?.abort(),this.#e=void 0}getPlugin(e){return this.grid?.getPlugin(e)}emit(e,t){this.grid?.dispatchEvent?.(new CustomEvent(e,{detail:t,bubbles:!0}))}emitCancelable(e,t){const i=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(i),i.defaultPrevented}on(e,t){this.grid?._pluginManager?.subscribe(this,e,t)}off(e){this.grid?._pluginManager?.unsubscribe(this,e)}emitPluginEvent(e,t){this.grid?._pluginManager?.emitPluginEvent(e,t)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}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}get disconnectSignal(){return this.#e?.signal??this.grid?.disconnectSignal}get gridIcons(){const e=this.grid?.gridConfig?.icons??{};return{...u,...e}}get isAnimationEnabled(){const e=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===e||"off"===e)return!1;if(!0===e||"on"===e)return!0;const t=this.gridElement;if(t){return"0"!==getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const e=this.gridElement;if(e){const t=getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(),i=parseInt(t,10);if(!isNaN(i))return i}return 200}resolveIcon(e,t){return void 0!==t?t:this.gridIcons[e]}setIcon(e,t){"string"==typeof t?e.innerHTML=t:t instanceof HTMLElement&&(e.innerHTML="",e.appendChild(t.cloneNode(!0)))}warn(e){console.warn(`[tbw-grid:${this.name}] ${e}`)}}const f="__tbw_expander";function m(e){return e.field===f}function p(e,t){const i=new Set(e);return i.has(t)?i.delete(t):i.add(t),i}function w(e,t,i,n){const r=document.createElement("div");r.className="master-detail-row",r.setAttribute("data-detail-for",String(t)),r.setAttribute("role","row");const s=document.createElement("div");s.className="master-detail-cell",s.setAttribute("role","cell"),s.style.gridColumn=`1 / ${n+1}`;const o=i(e,t);return"string"==typeof o?s.innerHTML=o:o instanceof HTMLElement&&s.appendChild(o),r.appendChild(s),r}class b extends g{name="masterDetail";styles="@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}tbw-grid .master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center}tbw-grid .master-detail-toggle:hover{opacity:1}tbw-grid .master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}tbw-grid .master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}tbw-grid .master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";get defaultConfig(){return{detailHeight:"auto",expandOnRowClick:!1,collapseOnClickOutside:!1,animation:"slide"}}attach(e){super.attach(e),this.parseLightDomDetail()}parseLightDomDetail(){const e=this.grid;if(!e||"function"!=typeof e.querySelector)return;const t=e.querySelector("tbw-grid-detail");if(!t)return;const i=e;if(i.__frameworkAdapter?.parseDetailElement){const e=i.__frameworkAdapter.parseDetailElement(t);if(e)return void(this.config={...this.config,detailRenderer:e})}const n=t.getAttribute("animation"),r=t.getAttribute("show-expand-column"),s=t.getAttribute("expand-on-row-click"),o=t.getAttribute("collapse-on-click-outside"),a=t.getAttribute("height"),c={};null!==n&&(c.animation="false"!==n&&n),null!==r&&(c.showExpandColumn="false"!==r),null!==s&&(c.expandOnRowClick="true"===s),null!==o&&(c.collapseOnClickOutside="true"===o),null!==a&&(c.detailHeight="auto"===a?"auto":parseInt(a,10));const h=t.innerHTML.trim();h&&!this.config.detailRenderer&&(c.detailRenderer=(e,t)=>l(d(h,{value:e,row:e}))),Object.keys(c).length>0&&(this.config={...this.config,...c})}get animationStyle(){return!!this.isAnimationEnabled&&(this.config.animation??"slide")}animateExpand(e,t,i){if(!this.isAnimationEnabled||!1===this.animationStyle)return!1;e.classList.add("tbw-expanding");let n=!1;const r=()=>{n||(n=!0,e.classList.remove("tbw-expanding"),void 0!==t&&void 0!==i&&this.#t(e,t,i))};return e.addEventListener("animationend",r,{once:!0}),setTimeout(r,this.animationDuration+50),!0}animateCollapse(e,t){if(!this.isAnimationEnabled||!1===this.animationStyle)return void t();e.classList.add("tbw-collapsing");const i=()=>{e.classList.remove("tbw-collapsing"),t()};e.addEventListener("animationend",i,{once:!0}),setTimeout(i,this.animationDuration+50)}#t(e,t,i){if(!e.isConnected)return;const n=e.offsetHeight;if(n>0){const e=this.measuredDetailHeights.get(t);this.measuredDetailHeights.set(t,n),e!==n&&this.grid.invalidateRowHeight(i)}}expandedRows=/* @__PURE__ */new Set;detailElements=/* @__PURE__ */new Map;measuredDetailHeights=/* @__PURE__ */new Map;rowsToAnimate=/* @__PURE__ */new Set;static DEFAULT_DETAIL_HEIGHT=150;getDetailHeight(e){const t=this.detailElements.get(e);if(t){if(!(t.classList.contains("tbw-expanding")||t.classList.contains("tbw-collapsing"))){const i=t.offsetHeight;if(i>0)return this.measuredDetailHeights.set(e,i),i}}const i=this.measuredDetailHeights.get(e);return i&&i>0?i:"number"==typeof this.config?.detailHeight?this.config.detailHeight:b.DEFAULT_DETAIL_HEIGHT}toggleAndEmit(e,t){this.expandedRows=p(this.expandedRows,e);const i=this.expandedRows.has(e);i&&this.rowsToAnimate.add(e),this.emit("detail-expand",{rowIndex:t,row:e,expanded:i}),this.requestRender()}detach(){this.expandedRows.clear(),this.detailElements.clear(),this.measuredDetailHeights.clear(),this.rowsToAnimate.clear()}processColumns(e){if(!(!0===this.config.showExpandColumn||!1!==this.config.showExpandColumn&&!!this.config.detailRenderer))return[...e];const t=[...e],i=function(e){return e.find(m)}(t);if(i)return t;const n=(r=this.name,{field:f,header:"",width:32,resizable:!1,sortable:!1,filterable:!1,meta:{lockPosition:!0,suppressMovable:!0,expanderColumn:!0,expanderPlugin:r,utility:!0}});var r;return n.viewRenderer=e=>{const{row:t}=e,i=this.expandedRows.has(t),n=document.createElement("span");n.className="master-detail-expander expander-cell";const r=document.createElement("span");return r.className="master-detail-toggle"+(i?" expanded":""),this.setIcon(r,this.resolveIcon(i?"collapse":"expand")),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-expanded",String(i)),r.setAttribute("aria-label",i?"Collapse details":"Expand details"),n.appendChild(r),n},[n,...t]}onRowClick(e){if(this.config.expandOnRowClick&&this.config.detailRenderer)return this.toggleAndEmit(e.row,e.rowIndex),!1}onCellClick(e){const t=e.originalEvent?.target;if(t?.classList.contains("master-detail-toggle"))return this.toggleAndEmit(e.row,e.rowIndex),!0;this.expandedRows.size>0&&queueMicrotask(()=>this.#i())}onKeyDown(e){if(" "!==e.key)return;const t=this.grid._focusCol,i=this.grid._focusRow,n=this.visibleColumns[t];if(!n||!m(n))return;const r=this.rows[i];return r?(e.preventDefault(),this.toggleAndEmit(r,i),this.requestRenderWithFocus(),!0):void 0}afterRender(){this.#i()}onScrollRender(){this.config.detailRenderer&&0!==this.expandedRows.size&&this.#i()}#i(){if(!this.config.detailRenderer)return;const e=this.gridElement?.querySelector(".rows");if(!e)return;const t=this.grid,i=t._rowPool,n=t._virtualization?.start??0,r=t._virtualization?.end??0,s=this.columns.length,o=n,a=r,l=/* @__PURE__ */new Map;if(i){const t=Math.min(i.length,a-o);for(let n=0;n<t;n++){const t=i[n];t.parentNode===e&&l.set(o+n,t)}}else{const t=e.querySelectorAll(".data-grid-row");for(const e of t){const t=e.querySelector(".cell[data-row]"),i=t?parseInt(t.getAttribute("data-row")??"-1",10):-1;i>=0&&l.set(i,e)}}for(const[d,c]of this.detailElements){const e=this.rows.indexOf(d),t=this.expandedRows.has(d),i=e>=0&&l.has(e);if(!t||!i){const e=this.grid.__frameworkAdapter;if(e?.unmount){const t=c.querySelector(".master-detail-cell"),i=t?.firstElementChild;i&&e.unmount(i)}c.parentNode&&c.remove(),this.detailElements.delete(d)}}for(const[d,c]of l){const e=this.rows[d];if(!e||!this.expandedRows.has(e))continue;const t=this.detailElements.get(e);if(t){t.previousElementSibling!==c&&c.after(t);continue}const i=w(e,d,this.config.detailRenderer,s);"number"==typeof this.config.detailHeight&&(i.style.height=`${this.config.detailHeight}px`),c.after(i),this.detailElements.set(e,i);const n=this.rowsToAnimate.has(e);n&&this.rowsToAnimate.delete(e);n&&this.animateExpand(i,e,d)||requestAnimationFrame(()=>{this.#t(i,e,d)})}}getExtraHeight(){let e=0;for(const t of this.expandedRows)e+=this.getDetailHeight(t);return e}getExtraHeightBefore(e){let t=0;for(const i of this.expandedRows){const n=this.rows.indexOf(i);n>=0&&n<e&&(t+=this.getDetailHeight(i))}return t}getRowHeight(e,t){if(!this.expandedRows.has(e))return;return(this.grid.defaultRowHeight??28)+this.getDetailHeight(e)}adjustVirtualStart(e,t,i){if(0===this.expandedRows.size)return e;const n=this.grid?._virtualization?.positionCache;let r=e;if(n&&n.length>0)for(const s of this.expandedRows){const i=this.rows.indexOf(s);if(i<0||i>=e)continue;n[i].offset+n[i].height>t&&i<r&&(r=i)}else{const n=[];for(const e of this.expandedRows){const t=this.rows.indexOf(e);t>=0&&n.push({index:t,row:e})}n.sort((e,t)=>e.index-t.index);let s=0;for(const{index:o,row:a}of n){const n=o*i+s,l=this.getDetailHeight(a);s+=l,o>=e||n+i+l>t&&o<r&&(r=o)}}return r}expand(e){const t=this.rows[e];t&&(this.rowsToAnimate.add(t),this.expandedRows=function(e,t){const i=new Set(e);return i.add(t),i}(this.expandedRows,t),this.requestRender())}collapse(e){const t=this.rows[e];t&&(this.expandedRows=function(e,t){const i=new Set(e);return i.delete(t),i}(this.expandedRows,t),this.requestRender())}toggle(e){const t=this.rows[e];t&&(this.expandedRows=p(this.expandedRows,t),this.expandedRows.has(t)&&this.rowsToAnimate.add(t),this.requestRender())}isExpanded(e){const t=this.rows[e];return!!t&&function(e,t){return e.has(t)}(this.expandedRows,t)}expandAll(){for(const e of this.rows)this.rowsToAnimate.add(e),this.expandedRows.add(e);this.requestRender()}collapseAll(){this.expandedRows.clear(),this.requestRender()}getExpandedRows(){const e=[];for(const t of this.expandedRows){const i=this.rows.indexOf(t);i>=0&&e.push(i)}return e}getDetailElement(e){const t=this.rows[e];return t?this.detailElements.get(t):void 0}refreshDetailRenderer(){const e=this.config.detailRenderer;if(this.config={...this.config,detailRenderer:void 0},this.parseLightDomDetail(),!this.config.detailRenderer&&e&&(this.config={...this.config,detailRenderer:e}),this.config.detailRenderer){const e=this.grid;"function"==typeof e.refreshColumns?e.refreshColumns():this.requestRender()}}}export{b as MasterDetailPlugin};
2
2
  //# sourceMappingURL=index.js.map