@toolbox-web/grid 3.10.0 → 3.10.1

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 (35) hide show
  1. package/all.js +1 -1
  2. package/all.js.map +1 -1
  3. package/index.js +1 -1
  4. package/lib/features/registry.js +1 -1
  5. package/lib/plugins/editing/index.js +1 -1
  6. package/lib/plugins/editing/index.js.map +1 -1
  7. package/lib/plugins/editing/internal/helpers.d.ts +23 -0
  8. package/lib/plugins/editing/types.d.ts +11 -0
  9. package/lib/plugins/grouping-rows/index.js +1 -1
  10. package/lib/plugins/grouping-rows/index.js.map +1 -1
  11. package/lib/plugins/master-detail/index.js +1 -1
  12. package/lib/plugins/master-detail/index.js.map +1 -1
  13. package/lib/plugins/master-detail/master-detail-plugin.d.ts +6 -1
  14. package/lib/plugins/shared/structural-toggle.d.ts +14 -0
  15. package/lib/plugins/tree/index.js +1 -1
  16. package/lib/plugins/tree/index.js.map +1 -1
  17. package/lib/plugins/undo-redo/index.d.ts +1 -1
  18. package/lib/plugins/undo-redo/index.js +1 -1
  19. package/lib/plugins/undo-redo/index.js.map +1 -1
  20. package/lib/plugins/undo-redo/types.d.ts +20 -2
  21. package/lib/plugins/undo-redo/undo-redo-plugin.d.ts +8 -0
  22. package/package.json +1 -1
  23. package/umd/grid.all.umd.js +1 -1
  24. package/umd/grid.all.umd.js.map +1 -1
  25. package/umd/grid.umd.js +1 -1
  26. package/umd/plugins/editing.umd.js +1 -1
  27. package/umd/plugins/editing.umd.js.map +1 -1
  28. package/umd/plugins/grouping-rows.umd.js +1 -1
  29. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  30. package/umd/plugins/master-detail.umd.js +1 -1
  31. package/umd/plugins/master-detail.umd.js.map +1 -1
  32. package/umd/plugins/tree.umd.js +1 -1
  33. package/umd/plugins/tree.umd.js.map +1 -1
  34. package/umd/plugins/undo-redo.umd.js +1 -1
  35. package/umd/plugins/undo-redo.umd.js.map +1 -1
@@ -1,2 +1,2 @@
1
- import{BaseGridPlugin as e}from"@toolbox-web/grid";var t=/{{\s*([^}]+)\s*}}/g,i="__DG_EMPTY__",n=/^[\w$. '?+\-*/%:()!<>=,&|]+$/,s="__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".split("|").map(e=>e.split("").reverse().join("")),a=new RegExp(`__(proto|defineGetter|defineSetter)|${s.slice(3).join("|")}|this\\b`);var r=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|math".split("|")),o=/^on\w+$/i,l=new Set("href|src|action|formaction|data|srcdoc|xlink:href|poster|srcset".split("|")),d=/^\s*(javascript|vbscript|data|blob):/i;function c(e,t){t&&"string"==typeof t?-1!==t.indexOf("<")||-1!==t.indexOf("&")?e.replaceChildren(function(e){const t=document.createElement("template");return e&&"string"==typeof e&&(t.innerHTML=e,h(t.content)),t.content}(t)):e.textContent=t:e.replaceChildren()}function h(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)&&Array.from(n.attributes).some(e=>o.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();o.test(e)?i.push(t.name):"is"!==e?(l.has(e)&&d.test(t.value)||"style"===e&&/expression\s*\(|javascript:|behavior\s*:/i.test(t.value))&&i.push(t.name):i.push(t.name)}i.forEach(e=>n.removeAttribute(e))}t.forEach(e=>e.remove())}function u(e,t){const i=function(e){const t=[];let i=0;for(;i<e.length;){const n=e[i];if(" "!==n){if(n>="0"&&n<="9"||"."===n&&i+1<e.length&&e[i+1]>="0"&&e[i+1]<="9"){const n=i;for(;i<e.length&&(e[i]>="0"&&e[i]<="9"||"."===e[i]);)i++;t.push({type:"num",v:Number(e.slice(n,i))});continue}if("'"===n){let n="";for(i++;i<e.length&&"'"!==e[i];)n+=e[i++];if(i>=e.length)return null;i++,t.push({type:"str",v:n});continue}if(n>="a"&&n<="z"||n>="A"&&n<="Z"||"_"===n||"$"===n){const n=i;for(;i<e.length&&/[\w$.]/.test(e[i]);)i++;t.push({type:"id",v:e.slice(n,i)});continue}if(i+2<e.length){const n=e.slice(i,i+3);if("==="===n||"!=="===n){t.push({type:"op",v:n}),i+=3;continue}}if(i+1<e.length){const n=e.slice(i,i+2);if("=="===n||"!="===n||"<="===n||">="===n||"&&"===n||"||"===n){t.push({type:"op",v:n}),i+=2;continue}}if(!"+-*/%<>!?:(),".includes(n))return null;t.push({type:"op",v:n}),i++}else i++}return t}(e);if(!i)return;const n=i;let s=0;function a(){return n[s]}function r(){return n[s++]}function o(e,t){const i=a();return!!i&&(i.type===e&&(void 0===t||i.v===t))}function l(){const e=function(){let e=d();for(;o("op","||");)r(),e=e||d();return e}();if(o("op","?")){r();const t=l();if(!o("op",":"))return;r();const i=l();return e?t:i}return e}function d(){let e=c();for(;o("op","&&");)r(),e=e&&c();return e}function c(){let e=h();for(;;){const t=a();if(!t||"op"!==t.type)break;if("==="===t.v)r(),e=e===h();else if("!=="===t.v)r(),e=e!==h();else if("=="===t.v)r(),e=e==h();else{if("!="!==t.v)break;r(),e=e!=h()}}return e}function h(){let e=u();for(;;){const t=a();if(!t||"op"!==t.type)break;if("<"===t.v)r(),e=e<u();else if(">"===t.v)r(),e=e>u();else if("<="===t.v)r(),e=e<=u();else{if(">="!==t.v)break;r(),e=e>=u()}}return e}function u(){let e=p();for(;;){const t=a();if(!t||"op"!==t.type)break;if("+"===t.v)r(),e+=p();else{if("-"!==t.v)break;r(),e-=p()}}return e}function p(){let e=f();for(;;){const t=a();if(!t||"op"!==t.type)break;if("*"===t.v)r(),e*=f();else if("/"===t.v)r(),e/=f();else{if("%"!==t.v)break;r(),e%=f()}}return e}function f(){return o("op","!")?(r(),!f()):g()}function g(){const e=a();if(e){if("num"===e.type)return r(),e.v;if("str"===e.type)return r(),e.v;if("id"===e.type)return r(),function(e){if("value"===e)return t.value;if(e.startsWith("row.")){const i=e.slice(4);return t.row?t.row[i]:void 0}if(e.startsWith("typeDefault.")){const i=e.slice(12);return t.typeDefault?t.typeDefault[i]:void 0}return"row"===e?t.row:"typeDefault"===e?t.typeDefault:void 0}(e.v);if("op"===e.type&&"("===e.v){r();const e=l();return o("op",")")&&r(),e}return"op"===e.type&&"-"===e.v?(r(),-g()):void 0}}const w=l();return s<n.length?void 0:w}function p(e,s){if(!e||-1===e.indexOf("{{"))return e;const r=[],o=(l=e.replace(t,(e,t)=>{const o=function(e,t){if(!(e=(e||"").trim()))return i;if(f.test(e))return i;if("value"===e)return null==t.value?i:String(t.value);if(e.startsWith("row.")&&!/[()?]/.test(e)&&!e.includes(":")){const n=e.slice(4),s=t.row?t.row[n]:void 0;return null==s?i:String(s)}if(e.startsWith("typeDefault.")&&!/[()?]/.test(e)&&!e.includes(":")){const n=e.slice(12),s=t.typeDefault?t.typeDefault[n]:void 0;return null==s?i:String(s)}if(e.length>80)return i;if(!n.test(e)||a.test(e))return i;const s=e.match(/\./g);if(s&&s.length>1)return i;try{const n=u(e,t),s=null==n?"":String(n);return f.test(s)?i:s||i}catch{return i}}(t,s);return r.push({expr:t.trim(),result:o}),o===i?o:(l=o)&&"string"==typeof l?l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"):"";var l}),l?l.replace(new RegExp(i,"g"),"").replace(/Reflect\.[^<>{}\s]+|\bProxy\b|ownKeys\([^)]*\)/g,""):l);var l;const d=r.length&&r.every(e=>""===e.result||e.result===i);return f.test(e)||d?"":o}var f=/Reflect|Proxy|ownKeys/;var g="__tbw_expander";function w(e){return e.field===g}var m=class t extends e{name="masterDetail";styles='@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{justify-content:center;align-items:center;padding:0;display:flex;border-right:none!important}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .master-detail-expander{justify-content:center;align-items:center;width:100%;height:100%;display:flex}tbw-grid .master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;display:inline-flex}tbw-grid .master-detail-toggle:hover{opacity:1}tbw-grid .master-detail-toggle{position:relative}tbw-grid .master-detail-toggle:after{content:"";inline-size:var(--tbw-touch-target-min,24px);block-size:var(--tbw-touch-target-min,24px);position:absolute;inset-block-start:50%;inset-inline-start:50%;translate:-50% -50%}@media (pointer:coarse){tbw-grid .master-detail-toggle{min-width:var(--tbw-touch-target-min,24px);min-height:var(--tbw-touch-target-min,24px)}}tbw-grid .master-detail-row{background:var(--tbw-master-detail-bg,var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border,var(--tbw-color-border));grid-column:1/-1;display:grid;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}}}';static dependencies=[{name:"serverSide",required:!1,reason:"Fetches detail data via datasource:fetch-children on expand"}];get#e(){return this.grid}get defaultConfig(){return{detailHeight:"auto",expandOnRowClick:!1,animation:"slide"}}attach(e){super.attach(e),this.parseLightDomDetail(),this.on("datasource:children",e=>{const t=e;if("master-detail"!==t.context?.source)return;t.claimed=!0;const i=t.context.row;this.detailLoads.delete(i),i&&this.#t(i)&&(this.detailDataMap.set(i,t.rows),this.#i(i),this.requestRender())}),this.on("datasource:error",e=>{const t=e;if("master-detail"!==t.context?.source)return;const i=t.context.row;i&&this.detailLoads.delete(i)&&(this.#i(i),this.emit("detail-load-error",{rowIndex:this.rows.indexOf(i),row:i,error:t.error}),this.requestRender())}),this.on("datasource:data",e=>{this.#n=e})}#s(){const e=this.#n;if(this.#n=void 0,!e||e.claimed||0===this.detailLoads.size)return;const t=new Set(this.rows);for(const i of this.detailLoads.keys())t.has(i)||this.#a(i)}#r(e){if(null==e)return!1;const t=e;return!t.__isGroupRow&&!0!==t.__loading}#t(e){return!!this.#r(e)&&(!!function(e,t){return e.has(t)}(this.expandedRows,e)||this.#o&&!this.#l.has(e))}#d(){return this.#o||this.expandedRows.size>0}#c(e,t){t?(this.#l.delete(e),this.expandedRows=function(e,t){return e.add(t),e}(this.expandedRows,e)):(this.expandedRows=function(e,t){return e.delete(t),e}(this.expandedRows,e),this.#o&&this.#l.add(e))}#i(e){const t=this.detailElements.get(e);t&&(this.#h(e,t),this.measuredDetailHeights.delete(e))}#h(e,t){const i=this.#e.__frameworkAdapter;if(i?.unmount){const e=t.querySelector(".master-detail-cell")?.firstElementChild;e&&i.unmount(e)}t.parentNode&&t.remove(),this.detailElements.delete(e)}#u(e,t,i){if(this.detailDataMap.has(e)||this.detailLoads.has(e))return;if(!this.#r(e))return;if(this.#p.has(e))return;if(!(i??this.queryBoolean("datasource:is-active")))return;this.#p.add(e);const n=new AbortController;this.detailLoads.set(e,n),this.grid.query("datasource:fetch-children",{context:{source:"master-detail",row:e,rowIndex:t},signal:n.signal})}#a(e){this.detailLoads.get(e)?.abort(),this.detailLoads.delete(e),null!==e&&"object"==typeof e&&this.#p.delete(e)}parseLightDomDetail(){const e=this.gridElement;if(!e)return;const t=e.querySelector("tbw-grid-detail");if(!t)return;const i=this.#e.__frameworkAdapter;if(i?.parseDetailElement){const e=i.parseDetailElement(t);if(e)return void(this.config={...this.config,detailRenderer:e})}const n=t.getAttribute("animation"),s=t.getAttribute("show-expand-column"),a=t.getAttribute("expand-on-row-click"),r=t.getAttribute("height"),o={};null!==n&&(o.animation="false"!==n&&n),null!==s&&(o.showExpandColumn="false"!==s),null!==a&&(o.expandOnRowClick="true"===a),null!==r&&(o.detailHeight="auto"===r?"auto":parseInt(r,10));const l=t.innerHTML.trim();l&&!this.config.detailRenderer&&(o.detailRenderer=(e,t)=>function(e){if(!e||"string"!=typeof e)return"";if(-1===e.indexOf("<"))return e;const t=document.createElement("template");return t.innerHTML=e,h(t.content),t.innerHTML}(p(l,{value:e,row:e}))),Object.keys(o).length>0&&(this.config={...this.config,...o})}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 s=()=>{n||(n=!0,e.classList.remove("tbw-expanding"),void 0!==t&&void 0!==i&&this.#f(e,t,i))};return e.addEventListener("animationend",s,{once:!0}),setTimeout(s,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)}#f(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 WeakMap;rowsToAnimate=/* @__PURE__ */new Set;detailLoads=/* @__PURE__ */new Map;detailDataMap=/* @__PURE__ */new WeakMap;#o=!1;#l=/* @__PURE__ */new WeakSet;#p=/* @__PURE__ */new WeakSet;#n;static DEFAULT_DETAIL_HEIGHT=150;getDetailHeight(e){const i=this.detailElements.get(e);if(i&&!i.classList.contains("tbw-expanding")&&!i.classList.contains("tbw-collapsing")){const t=i.offsetHeight;if(t>0)return this.measuredDetailHeights.set(e,t),t}const n=this.measuredDetailHeights.get(e);return n&&n>0?n:"number"==typeof this.config?.detailHeight?this.config.detailHeight:t.DEFAULT_DETAIL_HEIGHT}toggleAndEmit(e,t){if(!this.#r(e))return;const i=!this.#t(e);this.#c(e,i),i?this.rowsToAnimate.add(e):this.#a(e),this.emit("detail-expand",{rowIndex:t,row:e,expanded:i}),i&&this.#t(e)&&this.#u(e,t),this.requestRender()}detach(){this.expandedRows.clear(),this.detailElements.clear(),this.measuredDetailHeights=/* @__PURE__ */new WeakMap,this.rowsToAnimate.clear();for(const e of this.detailLoads.values())e.abort();this.detailLoads.clear(),this.detailDataMap=/* @__PURE__ */new WeakMap,this.#o=!1,this.#l=/* @__PURE__ */new WeakSet,this.#p=/* @__PURE__ */new WeakSet,this.#n=void 0}processColumns(e){if(!(!0===this.config.showExpandColumn||!1!==this.config.showExpandColumn&&this.config.detailRenderer))return[...e];const t=[...e];if(function(e){return e.find(w)}(t))return t;const i=(n=this.name,{field:g,header:"",width:32,resizable:!1,sortable:!1,filterable:!1,lockPosition:!0,utility:!0,meta:{expanderColumn:!0,expanderPlugin:n}});var n;return i.viewRenderer=e=>{const{row:t}=e,i=this.#t(t),n=document.createElement("span");n.className="master-detail-expander expander-cell";const s=document.createElement("span");return s.className="master-detail-toggle"+(i?" expanded":""),this.setIcon(s,i?"collapse":"expand"),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-expanded",String(i)),s.setAttribute("aria-label",i?"Collapse details":"Expand details"),n.appendChild(s),n},[i,...t]}onRowClick(e){if(this.config.expandOnRowClick&&this.config.detailRenderer)return this.toggleAndEmit(e.row,e.rowIndex),!1}onCellClick(e){if((e.originalEvent?.target)?.classList.contains("master-detail-toggle"))return this.toggleAndEmit(e.row,e.rowIndex),!0;this.#d()&&queueMicrotask(()=>this.#g())}onKeyDown(e){if(" "!==e.key)return;if(function(e){const t=e.composedPath?.()??[],i=t.length?t[0]:e.target;if(!(i instanceof HTMLElement))return!1;const n=i.tagName;return"INPUT"===n||"SELECT"===n||"TEXTAREA"===n||i.isContentEditable}(e))return;const t=this.grid._focusCol,i=this.grid._focusRow,n=this.visibleColumns[t];if(!n||!w(n))return;const s=this.rows[i];return s?(e.preventDefault(),this.toggleAndEmit(s,i),this.requestRenderWithFocus(),!0):void 0}afterRender(){this.#s(),this.#w(),this.#g()}#w(){const e=this.gridElement?.querySelector('.header-row .cell[data-field="__tbw_expander"]');if(!e)return;const t=parseInt(e.getAttribute("data-col")||"0",10),i=e.nextElementSibling;i&&(i.style.gridColumn=`${t+1} / ${t+3}`)}onScrollRender(){this.config.detailRenderer&&this.#d()&&this.#g()}#g(){const e=this.config.detailRenderer;if(!e)return;const t=this.gridElement?.querySelector(".rows");if(!t)return;const i=this.#m(t);this.#x(i);const n=this.columns.length,s=this.#d()&&this.queryBoolean("datasource:is-active");for(const[a,r]of i){const t=this.rows[a];t&&this.#b(t,a,r,n,e,s)}}#b(e,t,i,n,s,a){const r=this.#t(e);if(i.classList.toggle("tbw-row-expanded",r),!r)return;if(this.#u(e,t,a),!this.#t(e))return void i.classList.remove("tbw-row-expanded");const o=this.detailElements.get(e);o?o.previousElementSibling!==i&&i.after(o):this.#v(e,t,i,n,s)}#m(e){const t=this.grid,i=t._rowPool,n=t._virtualization?.start??0,s=t._virtualization?.end??0,a=/* @__PURE__ */new Map;if(i){const t=Math.min(i.length,s-n);for(let s=0;s<t;s++){const t=i[s];t.parentNode===e&&a.set(n+s,t)}return a}for(const r of e.querySelectorAll(".data-grid-row")){const e=r.querySelector(".cell[data-row]"),t=e?parseInt(e.getAttribute("data-row")??"-1",10):-1;t>=0&&a.set(t,r)}return a}#x(e){for(const[t,i]of this.detailElements){const n=this.rows.indexOf(t),s=n>=0&&e.has(n);this.#t(t)&&s||this.#h(t,i)}}#v(e,t,i,n,s){const a=function(e,t,i,n){const s=document.createElement("div");s.className="master-detail-row",s.setAttribute("data-detail-for",String(t)),s.setAttribute("role","row");const a=document.createElement("div");a.className="master-detail-cell",a.setAttribute("role","cell"),a.style.gridColumn=`1 / ${n+1}`;const r=i(e,t);return"string"==typeof r?c(a,r):r instanceof HTMLElement&&a.appendChild(r),s.appendChild(a),s}(e,t,s,n);"number"==typeof this.config.detailHeight&&(a.style.height=`${this.config.detailHeight}px`),i.after(a),this.detailElements.set(e,a);const r=this.rowsToAnimate.has(e);r&&this.rowsToAnimate.delete(e),r&&this.animateExpand(a,e,t)||requestAnimationFrame(()=>{this.#f(a,e,t)})}getRowHeight(e,t){if(this.#t(e))return(this.grid.defaultRowHeight??28)+this.getDetailHeight(e)}#R(e){const t=this.rows,i=[];for(let n=0,s=Math.min(e,t.length);n<s;n++)this.#t(t[n])&&i.push({index:n,row:t[n]});return i}#D(e,t,i){const n=this.rows;let s=e;for(let a=Math.min(e,i.length)-1;a>=0;a--){const e=i[a];if(e.offset+e.height<=t)break;this.#t(n[a])&&(s=a)}return s}adjustVirtualStart(e,t,i){if(!this.#d())return e;const n=this.grid?._virtualization?.positionCache;if(n&&n.length>0)return this.#D(e,t,n);let s=e,a=0;for(const{index:r,row:o}of this.#R(e)){const e=r*i+a,n=this.getDetailHeight(o);a+=n,e+i+n>t&&r<s&&(s=r)}return s}expand(e){const t=this.rows[e];if(this.#r(t)){const i=this.#t(t);this.rowsToAnimate.add(t),this.#c(t,!0),i||this.#u(t,e),this.requestRender()}}collapse(e){const t=this.rows[e];t&&(this.#c(t,!1),this.#a(t),this.requestRender())}toggle(e){const t=this.rows[e];if(this.#r(t)){const i=!this.#t(t);this.#c(t,i),i?(this.rowsToAnimate.add(t),this.#u(t,e)):this.#a(t),this.requestRender()}}isExpanded(e){const t=this.rows[e];return!!t&&this.#t(t)}expandAll(){const e=this.queryBoolean("datasource:is-active"),t=this.rows,i=[];for(let n=0;n<t.length;n++){const e=t[n];this.#r(e)&&!this.#t(e)&&i.push({row:e,index:n})}this.#o=!0,this.#l=/* @__PURE__ */new WeakSet;for(const{row:n,index:s}of i)this.#t(n)&&(this.rowsToAnimate.add(n),this.#u(n,s,e));this.requestRender()}collapseAll(){this.#o=!1,this.#l=/* @__PURE__ */new WeakSet;for(const e of[...this.detailLoads.keys()])this.#a(e);this.#p=/* @__PURE__ */new WeakSet,this.expandedRows.clear(),this.requestRender()}getExpandedRows(){return this.#R(this.rows.length).map(e=>e.index)}getDetailElement(e){const t=this.rows[e];return t?this.detailElements.get(t):void 0}getDetailData(e){const t=this.rows[e];return t?this.detailDataMap.get(t):void 0}isDetailLoading(e){const t=this.rows[e];return!!t&&this.detailLoads.has(t)}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.#e;"function"==typeof e.refreshColumns?e.refreshColumns():this.requestRender()}}};export{m as MasterDetailPlugin};
1
+ import{BaseGridPlugin as e}from"@toolbox-web/grid";var t=/{{\s*([^}]+)\s*}}/g,i="__DG_EMPTY__",n=/^[\w$. '?+\-*/%:()!<>=,&|]+$/,s="__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".split("|").map(e=>e.split("").reverse().join("")),a=new RegExp(`__(proto|defineGetter|defineSetter)|${s.slice(3).join("|")}|this\\b`);var r=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|math".split("|")),o=/^on\w+$/i,l=new Set("href|src|action|formaction|data|srcdoc|xlink:href|poster|srcset".split("|")),d=/^\s*(javascript|vbscript|data|blob):/i;function c(e,t){t&&"string"==typeof t?-1!==t.indexOf("<")||-1!==t.indexOf("&")?e.replaceChildren(function(e){const t=document.createElement("template");return e&&"string"==typeof e&&(t.innerHTML=e,h(t.content)),t.content}(t)):e.textContent=t:e.replaceChildren()}function h(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)&&Array.from(n.attributes).some(e=>o.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();o.test(e)?i.push(t.name):"is"!==e?(l.has(e)&&d.test(t.value)||"style"===e&&/expression\s*\(|javascript:|behavior\s*:/i.test(t.value))&&i.push(t.name):i.push(t.name)}i.forEach(e=>n.removeAttribute(e))}t.forEach(e=>e.remove())}function u(e,t){const i=function(e){const t=[];let i=0;for(;i<e.length;){const n=e[i];if(" "!==n){if(n>="0"&&n<="9"||"."===n&&i+1<e.length&&e[i+1]>="0"&&e[i+1]<="9"){const n=i;for(;i<e.length&&(e[i]>="0"&&e[i]<="9"||"."===e[i]);)i++;t.push({type:"num",v:Number(e.slice(n,i))});continue}if("'"===n){let n="";for(i++;i<e.length&&"'"!==e[i];)n+=e[i++];if(i>=e.length)return null;i++,t.push({type:"str",v:n});continue}if(n>="a"&&n<="z"||n>="A"&&n<="Z"||"_"===n||"$"===n){const n=i;for(;i<e.length&&/[\w$.]/.test(e[i]);)i++;t.push({type:"id",v:e.slice(n,i)});continue}if(i+2<e.length){const n=e.slice(i,i+3);if("==="===n||"!=="===n){t.push({type:"op",v:n}),i+=3;continue}}if(i+1<e.length){const n=e.slice(i,i+2);if("=="===n||"!="===n||"<="===n||">="===n||"&&"===n||"||"===n){t.push({type:"op",v:n}),i+=2;continue}}if(!"+-*/%<>!?:(),".includes(n))return null;t.push({type:"op",v:n}),i++}else i++}return t}(e);if(!i)return;const n=i;let s=0;function a(){return n[s]}function r(){return n[s++]}function o(e,t){const i=a();return!!i&&(i.type===e&&(void 0===t||i.v===t))}function l(){const e=function(){let e=d();for(;o("op","||");)r(),e=e||d();return e}();if(o("op","?")){r();const t=l();if(!o("op",":"))return;r();const i=l();return e?t:i}return e}function d(){let e=c();for(;o("op","&&");)r(),e=e&&c();return e}function c(){let e=h();for(;;){const t=a();if(!t||"op"!==t.type)break;if("==="===t.v)r(),e=e===h();else if("!=="===t.v)r(),e=e!==h();else if("=="===t.v)r(),e=e==h();else{if("!="!==t.v)break;r(),e=e!=h()}}return e}function h(){let e=u();for(;;){const t=a();if(!t||"op"!==t.type)break;if("<"===t.v)r(),e=e<u();else if(">"===t.v)r(),e=e>u();else if("<="===t.v)r(),e=e<=u();else{if(">="!==t.v)break;r(),e=e>=u()}}return e}function u(){let e=p();for(;;){const t=a();if(!t||"op"!==t.type)break;if("+"===t.v)r(),e+=p();else{if("-"!==t.v)break;r(),e-=p()}}return e}function p(){let e=f();for(;;){const t=a();if(!t||"op"!==t.type)break;if("*"===t.v)r(),e*=f();else if("/"===t.v)r(),e/=f();else{if("%"!==t.v)break;r(),e%=f()}}return e}function f(){return o("op","!")?(r(),!f()):g()}function g(){const e=a();if(e){if("num"===e.type)return r(),e.v;if("str"===e.type)return r(),e.v;if("id"===e.type)return r(),function(e){if("value"===e)return t.value;if(e.startsWith("row.")){const i=e.slice(4);return t.row?t.row[i]:void 0}if(e.startsWith("typeDefault.")){const i=e.slice(12);return t.typeDefault?t.typeDefault[i]:void 0}return"row"===e?t.row:"typeDefault"===e?t.typeDefault:void 0}(e.v);if("op"===e.type&&"("===e.v){r();const e=l();return o("op",")")&&r(),e}return"op"===e.type&&"-"===e.v?(r(),-g()):void 0}}const w=l();return s<n.length?void 0:w}function p(e,s){if(!e||-1===e.indexOf("{{"))return e;const r=[],o=(l=e.replace(t,(e,t)=>{const o=function(e,t){if(!(e=(e||"").trim()))return i;if(f.test(e))return i;if("value"===e)return null==t.value?i:String(t.value);if(e.startsWith("row.")&&!/[()?]/.test(e)&&!e.includes(":")){const n=e.slice(4),s=t.row?t.row[n]:void 0;return null==s?i:String(s)}if(e.startsWith("typeDefault.")&&!/[()?]/.test(e)&&!e.includes(":")){const n=e.slice(12),s=t.typeDefault?t.typeDefault[n]:void 0;return null==s?i:String(s)}if(e.length>80)return i;if(!n.test(e)||a.test(e))return i;const s=e.match(/\./g);if(s&&s.length>1)return i;try{const n=u(e,t),s=null==n?"":String(n);return f.test(s)?i:s||i}catch{return i}}(t,s);return r.push({expr:t.trim(),result:o}),o===i?o:(l=o)&&"string"==typeof l?l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"):"";var l}),l?l.replace(new RegExp(i,"g"),"").replace(/Reflect\.[^<>{}\s]+|\bProxy\b|ownKeys\([^)]*\)/g,""):l);var l;const d=r.length&&r.every(e=>""===e.result||e.result===i);return f.test(e)||d?"":o}var f=/Reflect|Proxy|ownKeys/;var g="__tbw_expander";function w(e){return e.field===g}var m="master-detail-toggle";var x=`.${"tree-toggle"},.${m},.${"group-toggle"}`;var v=class t extends e{name="masterDetail";styles='@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{justify-content:center;align-items:center;padding:0;display:flex;border-right:none!important}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .master-detail-expander{justify-content:center;align-items:center;width:100%;height:100%;display:flex}tbw-grid .master-detail-toggle{cursor:pointer;opacity:.7;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;display:inline-flex}tbw-grid .master-detail-toggle:hover{opacity:1}tbw-grid .master-detail-toggle{position:relative}tbw-grid .master-detail-toggle:after{content:"";inline-size:var(--tbw-touch-target-min,24px);block-size:var(--tbw-touch-target-min,24px);position:absolute;inset-block-start:50%;inset-inline-start:50%;translate:-50% -50%}@media (pointer:coarse){tbw-grid .master-detail-toggle{min-width:var(--tbw-touch-target-min,24px);min-height:var(--tbw-touch-target-min,24px)}}tbw-grid .master-detail-row{background:var(--tbw-master-detail-bg,var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border,var(--tbw-color-border));grid-column:1/-1;display:grid;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}}}';static manifest={hookPriority:{onCellClick:-10}};static dependencies=[{name:"serverSide",required:!1,reason:"Fetches detail data via datasource:fetch-children on expand"}];get#e(){return this.grid}get defaultConfig(){return{detailHeight:"auto",expandOnRowClick:!1,animation:"slide"}}attach(e){super.attach(e),this.parseLightDomDetail(),this.on("datasource:children",e=>{const t=e;if("master-detail"!==t.context?.source)return;t.claimed=!0;const i=t.context.row;this.detailLoads.delete(i),i&&this.#t(i)&&(this.detailDataMap.set(i,t.rows),this.#i(i),this.requestRender())}),this.on("datasource:error",e=>{const t=e;if("master-detail"!==t.context?.source)return;const i=t.context.row;i&&this.detailLoads.delete(i)&&(this.#i(i),this.emit("detail-load-error",{rowIndex:this.rows.indexOf(i),row:i,error:t.error}),this.requestRender())}),this.on("datasource:data",e=>{this.#n=e})}#s(){const e=this.#n;if(this.#n=void 0,!e||e.claimed||0===this.detailLoads.size)return;const t=new Set(this.rows);for(const i of this.detailLoads.keys())t.has(i)||this.#a(i)}#r(e){if(null==e)return!1;const t=e;return!t.__isGroupRow&&!0!==t.__loading}#t(e){return!!this.#r(e)&&(!!function(e,t){return e.has(t)}(this.expandedRows,e)||this.#o&&!this.#l.has(e))}#d(){return this.#o||this.expandedRows.size>0}#c(e,t){t?(this.#l.delete(e),this.expandedRows=function(e,t){return e.add(t),e}(this.expandedRows,e)):(this.expandedRows=function(e,t){return e.delete(t),e}(this.expandedRows,e),this.#o&&this.#l.add(e))}#i(e){const t=this.detailElements.get(e);t&&(this.#h(e,t),this.measuredDetailHeights.delete(e))}#h(e,t){const i=this.#e.__frameworkAdapter;if(i?.unmount){const e=t.querySelector(".master-detail-cell")?.firstElementChild;e&&i.unmount(e)}t.parentNode&&t.remove(),this.detailElements.delete(e)}#u(e,t,i){if(this.detailDataMap.has(e)||this.detailLoads.has(e))return;if(!this.#r(e))return;if(this.#p.has(e))return;if(!(i??this.queryBoolean("datasource:is-active")))return;this.#p.add(e);const n=new AbortController;this.detailLoads.set(e,n),this.grid.query("datasource:fetch-children",{context:{source:"master-detail",row:e,rowIndex:t},signal:n.signal})}#a(e){this.detailLoads.get(e)?.abort(),this.detailLoads.delete(e),null!==e&&"object"==typeof e&&this.#p.delete(e)}parseLightDomDetail(){const e=this.gridElement;if(!e)return;const t=e.querySelector("tbw-grid-detail");if(!t)return;const i=this.#e.__frameworkAdapter;if(i?.parseDetailElement){const e=i.parseDetailElement(t);if(e)return void(this.config={...this.config,detailRenderer:e})}const n=t.getAttribute("animation"),s=t.getAttribute("show-expand-column"),a=t.getAttribute("expand-on-row-click"),r=t.getAttribute("height"),o={};null!==n&&(o.animation="false"!==n&&n),null!==s&&(o.showExpandColumn="false"!==s),null!==a&&(o.expandOnRowClick="true"===a),null!==r&&(o.detailHeight="auto"===r?"auto":parseInt(r,10));const l=t.innerHTML.trim();l&&!this.config.detailRenderer&&(o.detailRenderer=(e,t)=>function(e){if(!e||"string"!=typeof e)return"";if(-1===e.indexOf("<"))return e;const t=document.createElement("template");return t.innerHTML=e,h(t.content),t.innerHTML}(p(l,{value:e,row:e}))),Object.keys(o).length>0&&(this.config={...this.config,...o})}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 s=()=>{n||(n=!0,e.classList.remove("tbw-expanding"),void 0!==t&&void 0!==i&&this.#f(e,t,i))};return e.addEventListener("animationend",s,{once:!0}),setTimeout(s,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)}#f(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 WeakMap;rowsToAnimate=/* @__PURE__ */new Set;detailLoads=/* @__PURE__ */new Map;detailDataMap=/* @__PURE__ */new WeakMap;#o=!1;#l=/* @__PURE__ */new WeakSet;#p=/* @__PURE__ */new WeakSet;#n;static DEFAULT_DETAIL_HEIGHT=150;getDetailHeight(e){const i=this.detailElements.get(e);if(i&&!i.classList.contains("tbw-expanding")&&!i.classList.contains("tbw-collapsing")){const t=i.offsetHeight;if(t>0)return this.measuredDetailHeights.set(e,t),t}const n=this.measuredDetailHeights.get(e);return n&&n>0?n:"number"==typeof this.config?.detailHeight?this.config.detailHeight:t.DEFAULT_DETAIL_HEIGHT}toggleAndEmit(e,t){if(!this.#r(e))return;const i=!this.#t(e);this.#c(e,i),i?this.rowsToAnimate.add(e):this.#a(e),this.emit("detail-expand",{rowIndex:t,row:e,expanded:i}),i&&this.#t(e)&&this.#u(e,t),this.requestRender()}detach(){this.expandedRows.clear(),this.detailElements.clear(),this.measuredDetailHeights=/* @__PURE__ */new WeakMap,this.rowsToAnimate.clear();for(const e of this.detailLoads.values())e.abort();this.detailLoads.clear(),this.detailDataMap=/* @__PURE__ */new WeakMap,this.#o=!1,this.#l=/* @__PURE__ */new WeakSet,this.#p=/* @__PURE__ */new WeakSet,this.#n=void 0}processColumns(e){if(!(!0===this.config.showExpandColumn||!1!==this.config.showExpandColumn&&this.config.detailRenderer))return[...e];const t=[...e];if(function(e){return e.find(w)}(t))return t;const i=(n=this.name,{field:g,header:"",width:32,resizable:!1,sortable:!1,filterable:!1,lockPosition:!0,utility:!0,meta:{expanderColumn:!0,expanderPlugin:n}});var n;return i.viewRenderer=e=>{const{row:t}=e,i=this.#t(t),n=document.createElement("span");n.className="master-detail-expander expander-cell";const s=document.createElement("span");return s.className=`${m}${i?" expanded":""}`,this.setIcon(s,i?"collapse":"expand"),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("aria-expanded",String(i)),s.setAttribute("aria-label",i?"Collapse details":"Expand details"),n.appendChild(s),n},[i,...t]}onRowClick(e){if(this.config.expandOnRowClick&&this.config.detailRenderer&&"dblclick"!==e.originalEvent.type&&!function(e){return!!e.target?.closest?.(x)}(e.originalEvent))return this.toggleAndEmit(e.row,e.rowIndex),!1}onCellClick(e){if(function(e){return!!(e?.target)?.closest?.(`.${m}`)}(e.originalEvent))return"dblclick"===e.originalEvent.type||this.toggleAndEmit(e.row,e.rowIndex),!0;this.#d()&&queueMicrotask(()=>this.#g())}onKeyDown(e){if(" "!==e.key)return;if(function(e){const t=e.composedPath?.()??[],i=t.length?t[0]:e.target;if(!(i instanceof HTMLElement))return!1;const n=i.tagName;return"INPUT"===n||"SELECT"===n||"TEXTAREA"===n||i.isContentEditable}(e))return;const t=this.grid._focusCol,i=this.grid._focusRow,n=this.visibleColumns[t];if(!n||!w(n))return;const s=this.rows[i];return s?(e.preventDefault(),this.toggleAndEmit(s,i),this.requestRenderWithFocus(),!0):void 0}afterRender(){this.#s(),this.#w(),this.#g()}#w(){const e=this.gridElement?.querySelector('.header-row .cell[data-field="__tbw_expander"]');if(!e)return;const t=parseInt(e.getAttribute("data-col")||"0",10),i=e.nextElementSibling;i&&(i.style.gridColumn=`${t+1} / ${t+3}`)}onScrollRender(){this.config.detailRenderer&&this.#d()&&this.#g()}#g(){const e=this.config.detailRenderer;if(!e)return;const t=this.gridElement?.querySelector(".rows");if(!t)return;const i=this.#m(t);this.#x(i);const n=this.columns.length,s=this.#d()&&this.queryBoolean("datasource:is-active");for(const[a,r]of i){const t=this.rows[a];t&&this.#v(t,a,r,n,e,s)}}#v(e,t,i,n,s,a){const r=this.#t(e);if(i.classList.toggle("tbw-row-expanded",r),!r)return;if(this.#u(e,t,a),!this.#t(e))return void i.classList.remove("tbw-row-expanded");const o=this.detailElements.get(e);o?o.previousElementSibling!==i&&i.after(o):this.#b(e,t,i,n,s)}#m(e){const t=this.grid,i=t._rowPool,n=t._virtualization?.start??0,s=t._virtualization?.end??0,a=/* @__PURE__ */new Map;if(i){const t=Math.min(i.length,s-n);for(let s=0;s<t;s++){const t=i[s];t.parentNode===e&&a.set(n+s,t)}return a}for(const r of e.querySelectorAll(".data-grid-row")){const e=r.querySelector(".cell[data-row]"),t=e?parseInt(e.getAttribute("data-row")??"-1",10):-1;t>=0&&a.set(t,r)}return a}#x(e){for(const[t,i]of this.detailElements){const n=this.rows.indexOf(t),s=n>=0&&e.has(n);this.#t(t)&&s||this.#h(t,i)}}#b(e,t,i,n,s){const a=function(e,t,i,n){const s=document.createElement("div");s.className="master-detail-row",s.setAttribute("data-detail-for",String(t)),s.setAttribute("role","row");const a=document.createElement("div");a.className="master-detail-cell",a.setAttribute("role","cell"),a.style.gridColumn=`1 / ${n+1}`;const r=i(e,t);return"string"==typeof r?c(a,r):r instanceof HTMLElement&&a.appendChild(r),s.appendChild(a),s}(e,t,s,n);"number"==typeof this.config.detailHeight&&(a.style.height=`${this.config.detailHeight}px`),i.after(a),this.detailElements.set(e,a);const r=this.rowsToAnimate.has(e);r&&this.rowsToAnimate.delete(e),r&&this.animateExpand(a,e,t)||requestAnimationFrame(()=>{this.#f(a,e,t)})}getRowHeight(e,t){if(this.#t(e))return(this.grid.defaultRowHeight??28)+this.getDetailHeight(e)}#R(e){const t=this.rows,i=[];for(let n=0,s=Math.min(e,t.length);n<s;n++)this.#t(t[n])&&i.push({index:n,row:t[n]});return i}#D(e,t,i){const n=this.rows;let s=e;for(let a=Math.min(e,i.length)-1;a>=0;a--){const e=i[a];if(e.offset+e.height<=t)break;this.#t(n[a])&&(s=a)}return s}adjustVirtualStart(e,t,i){if(!this.#d())return e;const n=this.grid?._virtualization?.positionCache;if(n&&n.length>0)return this.#D(e,t,n);let s=e,a=0;for(const{index:r,row:o}of this.#R(e)){const e=r*i+a,n=this.getDetailHeight(o);a+=n,e+i+n>t&&r<s&&(s=r)}return s}expand(e){const t=this.rows[e];if(this.#r(t)){const i=this.#t(t);this.rowsToAnimate.add(t),this.#c(t,!0),i||this.#u(t,e),this.requestRender()}}collapse(e){const t=this.rows[e];t&&(this.#c(t,!1),this.#a(t),this.requestRender())}toggle(e){const t=this.rows[e];if(this.#r(t)){const i=!this.#t(t);this.#c(t,i),i?(this.rowsToAnimate.add(t),this.#u(t,e)):this.#a(t),this.requestRender()}}isExpanded(e){const t=this.rows[e];return!!t&&this.#t(t)}expandAll(){const e=this.queryBoolean("datasource:is-active"),t=this.rows,i=[];for(let n=0;n<t.length;n++){const e=t[n];this.#r(e)&&!this.#t(e)&&i.push({row:e,index:n})}this.#o=!0,this.#l=/* @__PURE__ */new WeakSet;for(const{row:n,index:s}of i)this.#t(n)&&(this.rowsToAnimate.add(n),this.#u(n,s,e));this.requestRender()}collapseAll(){this.#o=!1,this.#l=/* @__PURE__ */new WeakSet;for(const e of[...this.detailLoads.keys()])this.#a(e);this.#p=/* @__PURE__ */new WeakSet,this.expandedRows.clear(),this.requestRender()}getExpandedRows(){return this.#R(this.rows.length).map(e=>e.index)}getDetailElement(e){const t=this.rows[e];return t?this.detailElements.get(t):void 0}getDetailData(e){const t=this.rows[e];return t?this.detailDataMap.get(t):void 0}isDetailLoading(e){const t=this.rows[e];return!!t&&this.detailLoads.has(t)}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.#e;"function"==typeof e.refreshColumns?e.refreshColumns():this.requestRender()}}};export{v as MasterDetailPlugin};
2
2
  //# sourceMappingURL=index.js.map