@agility-workbench/react-grid 1.11.0 → 1.12.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.
package/README.md CHANGED
@@ -119,6 +119,17 @@ later changes; in development builds the grid logs one `console.warn` naming the
119
119
  happens. Remount the grid (change its React `key`) to apply such a change. The React page of the
120
120
  documentation site has the full live-vs-creation table.
121
121
 
122
+ ### Event props
123
+
124
+ Each core event with a declarative callback is a prop, and the latest one passed is always the
125
+ one called: `onCellClicked`, `onRowClicked`, `onCellDoubleClicked`, `onRowDoubleClicked`,
126
+ `onCellValueChanged`, `onSelectionChanged`, `onSortChanged`, `onFilterChanged`,
127
+ `onQuickFilterFindChanged`, `onHistoryChanged`, `onColumnsChanged`, `onPaginationChanged` and
128
+ `onError`. `onColumnsChanged` (and `onSortChanged`) carry `source: "user" | "api"` — persist
129
+ column state on `"user"` so restoring it never echoes back. `onError` reports failed row-model
130
+ requests; the grid handles them the same way with or without it. Anything else:
131
+ `api.on(eventName, handler)`.
132
+
122
133
  ### React components in the grid
123
134
 
124
135
  `ReactColDef` component slots accept React components: `cellRenderer`, `cellEditor`,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var ze=Object.create;var w=Object.defineProperty;var We=Object.getOwnPropertyDescriptor;var je=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Ue=Object.prototype.hasOwnProperty;var qe=(t,e)=>{for(var n in e)w(t,n,{get:e[n],enumerable:!0})},S=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of je(e))!Ue.call(t,r)&&r!==n&&w(t,r,{get:()=>e[r],enumerable:!(a=We(e,r))||a.enumerable});return t},M=(t,e,n)=>(S(t,e,"default"),n&&S(n,e,"default")),h=(t,e,n)=>(n=t!=null?ze(_e(t)):{},S(e||!t||!t.__esModule?w(n,"default",{value:t,enumerable:!0}):n,t)),Je=t=>S(w({},"__esModule",{value:!0}),t);var p={};qe(p,{Grid:()=>Ie});module.exports=Je(p);M(p,require("@agility-workbench/grid"),module.exports);var i=h(require("react"),1),ke=require("@agility-workbench/grid");var m=h(require("react"),1);var le=require("react-dom"),ue=require("react-dom/client"),A=new Set,x=!1;function Qe(){x=!1;let t=Array.from(A);A.clear();for(let e of t)e.unmount()}function Ye(t){A.add(t),!x&&(x=!0,queueMicrotask(Qe))}var s=class{root;constructor(e){this.root=(0,ue.createRoot)(e)}render(e){this.root?.render(e)}renderSync(e){let n=this.root;n&&(0,le.flushSync)(()=>n.render(e))}destroy(){let e=this.root;e&&(this.root=null,Ye(e))}};var E=require("@agility-workbench/grid"),Re=require("@agility-workbench/grid"),ge=require("@agility-workbench/grid"),he=require("@agility-workbench/grid");var G=h(require("react"),1);var de=new WeakMap;function $e(t){let e=t?.prototype;return typeof t=="function"&&!!e&&typeof e.init=="function"&&typeof e.getGui=="function"}function Xe(t){return class{el=document.createElement("div");root=null;handle=G.default.createRef();init(n){this.el.style.width="100%",this.el.style.height="100%",this.root=new s(this.el);let a=G.default.createElement(t,{...n,ref:this.handle});this.root.renderSync(a)}getGui(){return this.el}getValue(){return this.handle.current?.getValue()}isParsed(){return this.handle.current?.isParsed?.()??!1}focus(){this.handle.current?.focus?.()}isCancelBeforeStart(){return this.handle.current?.isCancelBeforeStart?.()??!1}destroy(){let n=this.root;this.root=null,n?.destroy()}}}function N(t){if(t==null)return;if(typeof t=="string"||$e(t))return t;let e=de.get(t);if(e)return e;let n=Xe(t);return de.set(t,n),n}var ce=new WeakMap,se=new WeakMap,me=new WeakMap,Ce=new WeakMap,fe=new WeakMap;function y(t){return(typeof t=="function"||typeof t=="object")&&t!==null}function Ze(t){let e=t.colDef.cellRendererParams;return e==null||typeof e!="object"?t:{...t,...e}}function et(t){return class{el=document.createElement("span");root=null;init(n){this.el.style.display="inline-flex",this.el.style.alignItems="center",this.el.style.width="100%",this.el.style.height="100%",this.el.style.overflow="hidden",this.root=new s(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.render(m.default.createElement(t,Ze(n)))}}}function b(t){if(!t)return;if(typeof t=="function"&&(0,E.isClassRenderer)(t)||!y(t))return t;let e=ce.get(t);if(e)return e;let n=et(t);return ce.set(t,n),n}function tt(t){let e=t.colDef?.tooltipComponentParams;return e==null||typeof e!="object"?t:{...t,...e}}function nt(t){return class{el=document.createElement("div");root=null;init(n){this.root=new s(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.renderSync(m.default.createElement(t,tt(n)))}}}function T(t){if(!t)return;if(typeof t=="function"&&(0,Re.isClassTooltipComponent)(t)||!y(t))return t;let e=se.get(t);if(e)return e;let n=nt(t);return se.set(t,n),n}function F(t){if(t)return e=>{let n=t(e);return!n||typeof n.tooltip!="object"||n.tooltip==null?n:{...n,tooltip:{...n.tooltip,component:T(n.tooltip.component)}}}}function ye(t){return t==null||typeof t=="string"?t:T(t)}function ot(t){let e=t.colDef?.actionFrameComponentParams;return e==null||typeof e!="object"?t:{...t,...e}}function rt(t){return class{el=document.createElement("div");root=null;init(n){this.root=new s(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.render(m.default.createElement(t,ot(n)))}}}function pe(t){if(!t)return;if(typeof t=="function"&&(0,ge.isClassActionFrameComponent)(t)||!y(t))return t;let e=me.get(t);if(e)return e;let n=rt(t);return me.set(t,n),n}function it({node:t}){let e=m.default.useRef(null);return m.default.useLayoutEffect(()=>{let n=e.current;n&&n.firstChild!==t&&n.replaceChildren(t)},[t]),m.default.createElement("span",{ref:e,style:{display:"contents"}})}function at(t){if(!(typeof t=="function"&&!t.prototype?.isReactComponent))return r=>m.default.createElement(t,r);let n=t;function a(r){let d=n(r);return d instanceof HTMLElement?m.default.createElement(it,{node:d}):d}return r=>m.default.createElement(a,r)}function lt(t){let e=at(t);return class{el=document.createElement("div");root=null;init(a){this.el.className="pte-hcell-custom-root",this.el.style.display="flex",this.el.style.alignItems="center",this.el.style.width="100%",this.el.style.height="100%",this.el.style.overflow="hidden",this.root=new s(this.el),this.render(a)}getGui(){return this.el}refresh(a){return this.render(a),!0}destroy(){this.root?.destroy(),this.root=null}render(a){this.root?.render(e(a))}}}function P(t){if(!t)return;if(typeof t=="function"&&(0,he.isClassHeaderComponent)(t)||!y(t))return t;let e=fe.get(t);if(e)return e;let n=lt(t);return fe.set(t,n),n}function ut(t){return class{el=document.createElement("span");root=null;init(n){this.root=new s(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.render(m.default.createElement(t,n))}}}function v(t){if(!t)return;if(typeof t=="function"&&(0,E.isClassSetFilterComponent)(t)||!y(t))return t;let e=Ce.get(t);if(e)return e;let n=ut(t);return Ce.set(t,n),n}function Se(t){if(t)return{...t,valueComponent:v(t.valueComponent),selectAllComponent:v(t.selectAllComponent),blanksComponent:v(t.blanksComponent),groupComponent:v(t.groupComponent)}}function dt(t){return{...t,cellRenderer:b(t.cellRenderer),cellEditor:N(t.cellEditor),tooltipComponent:T(t.tooltipComponent),headerTooltip:ye(t.headerTooltip),actionFrameComponent:pe(t.actionFrameComponent),filterParams:Se(t.filterParams),headerComponent:P(t.headerComponent),headerCellComponent:P(t.headerCellComponent),children:t.children?B(t.children)??void 0:void 0}}function B(t){return t==null?t:t.map(e=>dt(e))}function we(t){let e={...t};return"cellRenderer"in t&&(e.cellRenderer=b(t.cellRenderer)),"cellEditor"in t&&(e.cellEditor=N(t.cellEditor)),"tooltipComponent"in t&&(e.tooltipComponent=T(t.tooltipComponent)),"headerTooltip"in t&&(e.headerTooltip=ye(t.headerTooltip)),"actionFrameComponent"in t&&(e.actionFrameComponent=pe(t.actionFrameComponent)),"filterParams"in t&&(e.filterParams=Se(t.filterParams)),"headerComponent"in t&&(e.headerComponent=P(t.headerComponent)),"headerCellComponent"in t&&(e.headerCellComponent=P(t.headerCellComponent)),e}function Me(t){if(t!=null)return we(t)}function L(t){if(t!=null)return we(t)}function o(t,e,n){n!=null&&(t[e]=n)}function ve(t){let e={};return o(e,"headerHeight",t.headerHeight),o(e,"leafHeaderHeight",t.leafHeaderHeight),o(e,"parentHeaderHeight",t.parentHeaderHeight),o(e,"rowHeight",t.rowHeight),o(e,"pinnedTopRowData",t.pinnedTopRowData),o(e,"pinnedBottomRowData",t.pinnedBottomRowData),o(e,"getRowId",t.getRowId),o(e,"rowIdKey",t.rowIdKey),o(e,"rowDataMode",t.rowDataMode),o(e,"asyncTransactionWaitMs",t.asyncTransactionWaitMs),o(e,"overscanRowCount",t.overscanRowCount),o(e,"minResizeWidth",t.minResizeWidth),o(e,"maxColumnWidth",t.maxColumnWidth),o(e,"pivotMode",t.pivotMode),o(e,"pivotColumns",t.pivotColumns),o(e,"maxPivotColumns",t.maxPivotColumns),o(e,"pivotColumnMoveMode",t.pivotColumnMoveMode),o(e,"autosizeColumnsOnDataChange",t.autosizeColumnsOnDataChange),o(e,"allowExportAsCSV",t.allowExportAsCSV),o(e,"allowExportAsExcel",t.allowExportAsExcel),o(e,"pagination",t.pagination),o(e,"paginationControls",t.paginationControls),o(e,"rowNumbers",t.rowNumbers),o(e,"rowHover",t.rowHover),o(e,"columnHover",t.columnHover),o(e,"zebraRows",t.zebraRows),o(e,"getRowClass",t.getRowClass),o(e,"getRowStyle",t.getRowStyle),o(e,"getRowPresentation",F(t.getRowPresentation)),o(e,"onCellClicked",t.onCellClicked),o(e,"onRowClicked",t.onRowClicked),o(e,"onCellDoubleClicked",t.onCellDoubleClicked),o(e,"onRowDoubleClicked",t.onRowDoubleClicked),o(e,"onCellValueChanged",t.onCellValueChanged),o(e,"onSelectionChanged",t.onSelectionChanged),o(e,"onSortChanged",t.onSortChanged),o(e,"onFilterChanged",t.onFilterChanged),o(e,"onQuickFilterFindChanged",t.onQuickFilterFindChanged),o(e,"onHistoryChanged",t.onHistoryChanged),o(e,"ariaLabel",t.ariaLabel),o(e,"ariaLabelledBy",t.ariaLabelledBy),o(e,"highlightActiveCell",t.highlightActiveCell),o(e,"rowSelection",t.rowSelection),o(e,"cellSelection",t.cellSelection),o(e,"rangeSelection",t.rangeSelection),o(e,"fillHandle",t.fillHandle),o(e,"columnSelection",t.columnSelection),o(e,"headerKeyboardNavigation",t.headerKeyboardNavigation),o(e,"showColumnButtonsOnHover",t.showColumnButtonsOnHover),o(e,"selectAllRowsOnHeaderClick",t.selectAllRowsOnHeaderClick),o(e,"selectAllScope",t.selectAllScope),o(e,"selectionPersistence",t.selectionPersistence),o(e,"clearSelectionOnBodyClick",t.clearSelectionOnBodyClick),o(e,"resetPageOn",t.resetPageOn),o(e,"pageSize",t.pageSize),o(e,"pageSizes",t.pageSizes),o(e,"serverSideBlockSize",t.serverSideBlockSize),o(e,"rowModelType",t.rowModelType),o(e,"getGroupChildCount",t.getGroupChildCount),o(e,"groupChildCount",t.groupChildCount),o(e,"paginationUnknownTotalTooltip",t.paginationUnknownTotalTooltip),o(e,"undoLimit",t.undoLimit),o(e,"editTrigger",t.editTrigger),o(e,"readOnlyEdit",t.readOnlyEdit),o(e,"initialSort",t.initialSort),o(e,"showSortPriority",t.showSortPriority),o(e,"pinnedRowsEditable",t.pinnedRowsEditable),o(e,"rowPinningMenu",t.rowPinningMenu),o(e,"rowInsertionMenu",t.rowInsertionMenu),o(e,"suppressKeyboardEdit",t.suppressKeyboardEdit),o(e,"suppressTypeToEdit",t.suppressTypeToEdit),o(e,"moveAfterEdit",t.moveAfterEdit),o(e,"commitOnBlur",t.commitOnBlur),o(e,"reevaluateOnEdit",t.reevaluateOnEdit),o(e,"groupDisplayType",t.groupDisplayType),o(e,"groupDefaultExpanded",t.groupDefaultExpanded),o(e,"groupSortMode",t.groupSortMode),o(e,"treeData",t.treeData),o(e,"groupRowsSelectable",t.groupRowsSelectable),o(e,"isRowSelectable",t.isRowSelectable),o(e,"isRowPinned",t.isRowPinned),o(e,"groupRowsSticky",t.groupRowsSticky),o(e,"isFullWidthRow",t.isFullWidthRow),o(e,"tooltip",t.tooltip),o(e,"quickFilter",t.quickFilter),o(e,"columnPanel",t.columnPanel),o(e,"toolbar",t.toolbar),o(e,"savedViews",t.savedViews),o(e,"sheets",t.sheets),o(e,"loadingMessage",t.loadingMessage),o(e,"noRowsMessage",t.noRowsMessage),o(e,"pivotNoValuesMessage",t.pivotNoValuesMessage),o(e,"pivotEmptyMessage",t.pivotEmptyMessage),o(e,"filterDebounceMs",t.filterDebounceMs),o(e,"cellFlashDuration",t.cellFlashDuration),o(e,"cellFadeDuration",t.cellFadeDuration),o(e,"icons",t.icons),o(e,"theme",t.theme),t.fullWidthCellRenderer!=null&&(e.fullWidthCellRenderer=b(t.fullWidthCellRenderer)),t.defaultColDef!=null&&(e.defaultColDef=Me(t.defaultColDef)),t.groupColumnDef!=null&&(e.groupColumnDef=L(t.groupColumnDef)),t.pivotResultColumnDef!=null&&(e.pivotResultColumnDef=L(t.pivotResultColumnDef)),t.bodyContextMenu===!1&&(e.bodyContextMenu=!1),t.multiColumnMenu!=null&&(e.multiColumnMenu=t.multiColumnMenu),t.rowModelType==="serverSide"&&(o(e,"serverSideDataSource",t.serverSideDataSource),o(e,"serverSideAggregationSource",t.serverSideAggregationSource)),o(e,"suppressStyleInjection",t.suppressStyleInjection),o(e,"styleNonce",t.styleNonce),e}var Pe=h(require("react"),1);var D=class{constructor(e){this.opts=e}resolveMenuItems(e,n){let a=[],r=n,d=this.opts.getBodyMenuItems?this.opts.getBodyMenuItems({ctx:e,items:r}):r;return{items:this.normalizeItems(d,a),cleanup:()=>{for(let R of a)R()}}}normalizeItems(e,n){return e.map(a=>{if(a.isSeparator)return{isSeparator:!0};let r=this.normalizeSlot(a.left,n),d=this.normalizeSlot(a.right,n);return{...a,left:r,right:d,subMenu:a.subMenu?this.normalizeItems(a.subMenu,n):void 0}})}normalizeSlot(e,n){if(e){if(typeof e=="string"||e instanceof HTMLElement)return e;if(Pe.default.isValidElement(e)){let{el:a,unmount:r}=this.mountReact(e);return n.push(r),a}}}mountReact(e){let n=document.createElement("span");n.style.display="inline-flex",n.style.alignItems="center";let a=new s(n);return a.render(e),{el:n,unmount:()=>a.destroy()}}};var Ee=h(require("react"),1);var H=class{constructor(e){this.opts=e}resolveMenuItems(e,n){let a=[],r=n,d=this.opts.getColumnMenuItems?this.opts.getColumnMenuItems({ctx:e,items:r}):r;return{items:this.normalizeItems(d,a),cleanup:()=>{for(let R of a)R()}}}normalizeItems(e,n){return e.map(a=>{if(a.isSeparator)return{isSeparator:!0};let r=this.normalizeSlot(a.left,n),d=this.normalizeSlot(a.right,n);return{...a,left:r,right:d,subMenu:a.subMenu?this.normalizeItems(a.subMenu,n):void 0}})}normalizeSlot(e,n){if(e){if(typeof e=="string"||e instanceof HTMLElement)return e;if(Ee.default.isValidElement(e)){let{el:a,unmount:r}=this.mountReact(e);return n.push(r),a}}}mountReact(e){let n=document.createElement("span");n.style.display="inline-flex",n.style.alignItems="center";let a=new s(n);return a.render(e),{el:n,unmount:()=>a.destroy()}}};var be=require("@agility-workbench/grid"),ct=new Set(["onCellClicked","onRowClicked","onCellDoubleClicked","onRowDoubleClicked","onCellValueChanged","onSelectionChanged","onSortChanged","onFilterChanged","onQuickFilterFindChanged","onHistoryChanged","onBeforeCellCommit","fillOperation","multiColumnMenu"]),st=be.CREATION_ONLY_OPTION_KEYS.filter(t=>!ct.has(t)),mt=["keyboardNavigationMode","enableKeyboardNavigationModeSwitch"],Te=Symbol("uncomparable");function Fe(t,e){let n=e;if(t==="treeData"&&e!=null&&typeof e=="object"){let a={...e};for(let r of mt)delete a[r];n=a}try{return JSON.stringify(n,(a,r)=>typeof r=="function"?`\u0192 ${String(r)}`:r===void 0?"\u2205undefined":r)??"\u2205undefined"}catch{return Te}}function De(t){let e=new Map;for(let n of st){let a=t[n];e.set(n,{value:a,fingerprint:Fe(n,a)})}return e}function He(){try{return process.env.NODE_ENV!=="production"}catch{return!0}}function Ct(t){return`[agility-workbench] <Grid> prop "${t}" changed after the grid was created. It is read only at creation, so the change is ignored. Remount the grid to apply it (for example, change the <Grid>'s React key).`}function Oe(t,e,n){for(let[a,r]of e){if(n.has(a))continue;let d=t[a];if(Object.is(d,r.value))continue;let f=Fe(a,d);f!==Te&&f===r.fingerprint||(n.add(a),console.warn(Ct(a)))}}var Ae=require("react/jsx-runtime");function C(t,e){if(t){if(typeof t=="function"){t(e);return}t.current=e}}function ft(t){if(!t.destroyed){t.destroyed=!0;try{t.api.destroy()}catch{}}}var Ie=i.default.forwardRef(function(e,n){let a=(0,i.useRef)(null),r=(0,i.useRef)(null),d=(0,i.useRef)(e.onGridReady),f=(0,i.useRef)(e.getColumnMenuItems),R=(0,i.useRef)(e.bodyContextMenu),V=(0,i.useRef)(e.multiColumnMenu),K=(0,i.useRef)(e.onCellClicked),z=(0,i.useRef)(e.onRowClicked),W=(0,i.useRef)(e.onCellDoubleClicked),j=(0,i.useRef)(e.onRowDoubleClicked),_=(0,i.useRef)(e.onCellValueChanged),U=(0,i.useRef)(e.onSelectionChanged),q=(0,i.useRef)(e.onSortChanged),J=(0,i.useRef)(e.onFilterChanged),Q=(0,i.useRef)(e.onQuickFilterFindChanged),Y=(0,i.useRef)(e.onHistoryChanged),$=(0,i.useRef)(e.onBeforeCellCommit),X=(0,i.useRef)(e.fillOperation);d.current=e.onGridReady,f.current=e.getColumnMenuItems,R.current=e.bodyContextMenu,V.current=e.multiColumnMenu,K.current=e.onCellClicked,z.current=e.onRowClicked,W.current=e.onCellDoubleClicked,j.current=e.onRowDoubleClicked,_.current=e.onCellValueChanged,U.current=e.onSelectionChanged,q.current=e.onSortChanged,J.current=e.onFilterChanged,Q.current=e.onQuickFilterFindChanged,Y.current=e.onHistoryChanged,$.current=e.onBeforeCellCommit,X.current=e.fillOperation,(0,i.useLayoutEffect)(()=>{let u=a.current;if(!u)return;let c=ve(e);c.onCellClicked=l=>K.current?.(l),c.onRowClicked=l=>z.current?.(l),c.onCellDoubleClicked=l=>W.current?.(l),c.onRowDoubleClicked=l=>j.current?.(l),c.onCellValueChanged=l=>_.current?.(l),c.onSelectionChanged=l=>U.current?.(l),c.onSortChanged=l=>q.current?.(l),c.onFilterChanged=l=>J.current?.(l),c.onQuickFilterFindChanged=l=>Q.current?.(l),c.onHistoryChanged=l=>Y.current?.(l),c.onBeforeCellCommit=l=>$.current?.(l),c.fillOperation=l=>X.current?.(l),e.multiColumnMenu!==!1&&(c.multiColumnMenu=l=>{let g=V.current;return g===!1?[]:typeof g!="function"?l.items:g(l)});let k=(0,ke.createGrid)(u,{...c,menuAdapter:new H({getColumnMenuItems:l=>f.current?.(l)??l.items}),bodyMenuAdapter:new D({getBodyMenuItems:l=>{let g=R.current;return typeof g=="function"?g(l):l.items}})}),I={api:k,destroyed:!1,appliedServerSideDataSource:c.serverSideDataSource,creationOnly:He()?{snapshot:De(e),warned:new Set}:null};return r.current=I,C(n,k),C(e.apiRef,k),()=>{r.current===I&&(r.current=null),C(n,null),C(e.apiRef,null),ft(I)}},[]),(0,i.useLayoutEffect)(()=>{let u=r.current?.api??null;return C(n,u),C(e.apiRef,u),()=>{C(n,null),C(e.apiRef,null)}},[n,e.apiRef]),(0,i.useLayoutEffect)(()=>{let u=r.current?.api;u&&u.updateGridOptions({columnDefs:B(e.columnDefs)})},[e.columnDefs]),(0,i.useLayoutEffect)(()=>{let u=r.current?.api;u&&e.rowModelType!=="serverSide"&&u.setRowData(e.rowData??e.data??[])},[e.data,e.rowData,e.rowModelType]);let O=(0,i.useRef)(null);(0,i.useLayoutEffect)(()=>{let u=r.current;if(!(!u||O.current===u))return O.current=u,d.current?.(u.api),()=>{O.current=null}},[]),(0,i.useLayoutEffect)(()=>{let u=r.current?.creationOnly;u&&Oe(e,u.snapshot,u.warned)}),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupDisplayType:e.groupDisplayType})},[e.groupDisplayType]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupSortMode:e.groupSortMode})},[e.groupSortMode]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupRowsSelectable:e.groupRowsSelectable})},[e.groupRowsSelectable]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupChildCount:e.groupChildCount})},[e.groupChildCount]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({headerHeight:e.headerHeight,leafHeaderHeight:e.leafHeaderHeight,parentHeaderHeight:e.parentHeaderHeight})},[e.headerHeight,e.leafHeaderHeight,e.parentHeaderHeight]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({pivotColumnMoveMode:e.pivotColumnMoveMode})},[e.pivotColumnMoveMode]);let Z=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!Z.current){Z.current=!0;return}e.pivotMode!=null&&r.current?.api.setPivotMode(e.pivotMode)},[e.pivotMode]);let xe=JSON.stringify(e.pivotColumns??null),ee=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!ee.current){ee.current=!0;return}e.pivotColumns!=null&&r.current?.api.setPivotColumns(e.pivotColumns)},[xe]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({isRowSelectable:e.isRowSelectable})},[e.isRowSelectable]);let Ge=JSON.stringify(e.rowSelection??null),te=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!te.current){te.current=!0;return}r.current?.api.updateGridOptions({rowSelection:e.rowSelection})},[Ge]),(0,i.useLayoutEffect)(()=>{r.current?.api.setTreeDataKeyboardNavigationOptions({keyboardNavigationMode:e.treeData?.keyboardNavigationMode,enableKeyboardNavigationModeSwitch:e.treeData?.enableKeyboardNavigationModeSwitch??!1})},[e.treeData?.keyboardNavigationMode,e.treeData?.enableKeyboardNavigationModeSwitch]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({pinnedTopRowData:e.pinnedTopRowData,pinnedBottomRowData:e.pinnedBottomRowData,isRowPinned:e.isRowPinned,groupRowsSticky:e.groupRowsSticky})},[e.pinnedTopRowData,e.pinnedBottomRowData,e.isRowPinned,e.groupRowsSticky]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({rowHover:e.rowHover??!0,columnHover:e.columnHover??!1,zebraRows:e.zebraRows??!1,getRowClass:e.getRowClass,getRowStyle:e.getRowStyle,getRowPresentation:F(e.getRowPresentation),ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,highlightActiveCell:e.highlightActiveCell??!1,cellSelection:e.cellSelection??!0,rangeSelection:e.rangeSelection??!0,fillHandle:e.fillHandle??!0,columnSelection:e.columnSelection??!0,headerKeyboardNavigation:e.headerKeyboardNavigation??!0,showColumnButtonsOnHover:e.showColumnButtonsOnHover??!1,bodyContextMenu:e.bodyContextMenu!==!1,editTrigger:e.editTrigger??"doubleClick",readOnlyEdit:e.readOnlyEdit??!1,pinnedRowsEditable:e.pinnedRowsEditable??!1,rowPinningMenu:e.rowPinningMenu??!1,rowInsertionMenu:e.rowInsertionMenu,suppressKeyboardEdit:e.suppressKeyboardEdit??!1,suppressTypeToEdit:e.suppressTypeToEdit??!1,moveAfterEdit:e.moveAfterEdit??!0,commitOnBlur:e.commitOnBlur??!0,asyncTransactionWaitMs:e.asyncTransactionWaitMs??16,loadingMessage:e.loadingMessage,noRowsMessage:e.noRowsMessage})},[e.rowHover,e.columnHover,e.zebraRows,e.getRowClass,e.getRowStyle,e.getRowPresentation,e.ariaLabel,e.ariaLabelledBy,e.highlightActiveCell,e.cellSelection,e.rangeSelection,e.fillHandle,e.columnSelection,e.headerKeyboardNavigation,e.showColumnButtonsOnHover,e.bodyContextMenu,e.editTrigger,e.readOnlyEdit,e.pinnedRowsEditable,e.rowPinningMenu,e.rowInsertionMenu,e.suppressKeyboardEdit,e.suppressTypeToEdit,e.moveAfterEdit,e.commitOnBlur,e.asyncTransactionWaitMs,e.loadingMessage,e.noRowsMessage]),(0,i.useLayoutEffect)(()=>{let u=r.current;!u||e.rowModelType!=="serverSide"||e.serverSideDataSource&&e.serverSideDataSource!==u.appliedServerSideDataSource&&(u.appliedServerSideDataSource=e.serverSideDataSource,u.api.updateGridOptions({serverSideDataSource:e.serverSideDataSource}))},[e.rowModelType,e.serverSideDataSource]),(0,i.useLayoutEffect)(()=>{let u=r.current;!u||e.rowModelType!=="serverSide"||e.serverSideAggregationSource&&u.api.updateGridOptions({serverSideAggregationSource:e.serverSideAggregationSource})},[e.rowModelType,e.serverSideAggregationSource]),(0,i.useLayoutEffect)(()=>{let u=r.current?.api;u&&u.dispatch({type:"overlayShow",overlayType:e.loading?"loading":"none"})},[e.loading]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({pagination:e.pagination})},[e.pagination]);let Ne=JSON.stringify(e.paginationControls??null),ne=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!ne.current){ne.current=!0;return}r.current?.api.updateGridOptions({paginationControls:e.paginationControls})},[Ne]);let Be=JSON.stringify(e.quickFilter??null),oe=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!oe.current){oe.current=!0;return}r.current?.api.updateGridOptions({quickFilter:e.quickFilter})},[Be]);let Le=JSON.stringify(e.tooltip??null),re=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!re.current){re.current=!0;return}r.current?.api.updateGridOptions({tooltip:e.tooltip})},[Le]);let Ve=JSON.stringify(e.columnPanel??null),ie=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!ie.current){ie.current=!0;return}r.current?.api.updateGridOptions({columnPanel:e.columnPanel})},[Ve]);let Ke=JSON.stringify(e.toolbar??null),ae=(0,i.useRef)(!1);return(0,i.useLayoutEffect)(()=>{if(!ae.current){ae.current=!0;return}r.current?.api.updateGridOptions({toolbar:e.toolbar})},[Ke]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({savedViews:e.savedViews})},[e.savedViews]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({sheets:e.sheets})},[e.sheets]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({theme:e.theme,icons:{...e.theme?.getIcons(),...e.icons}})},[e.theme,e.icons]),(0,Ae.jsx)("div",{ref:a,className:e.className,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",...e.style}})});0&&(module.exports={Grid,...require("@agility-workbench/grid")});
1
+ "use strict";var _e=Object.create;var S=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Je=Object.getPrototypeOf,Qe=Object.prototype.hasOwnProperty;var Ye=(t,e)=>{for(var n in e)S(t,n,{get:e[n],enumerable:!0})},w=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of qe(e))!Qe.call(t,r)&&r!==n&&S(t,r,{get:()=>e[r],enumerable:!(a=Ue(e,r))||a.enumerable});return t},M=(t,e,n)=>(w(t,e,"default"),n&&w(n,e,"default")),h=(t,e,n)=>(n=t!=null?_e(Je(t)):{},w(e||!t||!t.__esModule?S(n,"default",{value:t,enumerable:!0}):n,t)),$e=t=>w(S({},"__esModule",{value:!0}),t);var p={};Ye(p,{Grid:()=>Ge});module.exports=$e(p);M(p,require("@agility-workbench/grid"),module.exports);var i=h(require("react"),1),Ie=require("@agility-workbench/grid");var m=h(require("react"),1);var ce=require("react-dom"),se=require("react-dom/client"),x=new Set,I=!1;function Xe(){I=!1;let t=Array.from(x);x.clear();for(let e of t)e.unmount()}function Ze(t){x.add(t),!I&&(I=!0,queueMicrotask(Xe))}var s=class{root;constructor(e){this.root=(0,se.createRoot)(e)}render(e){this.root?.render(e)}renderSync(e){let n=this.root;n&&(0,ce.flushSync)(()=>n.render(e))}destroy(){let e=this.root;e&&(this.root=null,Ze(e))}};var E=require("@agility-workbench/grid"),ye=require("@agility-workbench/grid"),pe=require("@agility-workbench/grid"),we=require("@agility-workbench/grid");var G=h(require("react"),1);var me=new WeakMap;function et(t){let e=t?.prototype;return typeof t=="function"&&!!e&&typeof e.init=="function"&&typeof e.getGui=="function"}function tt(t){return class{el=document.createElement("div");root=null;handle=G.default.createRef();init(n){this.el.style.width="100%",this.el.style.height="100%",this.root=new s(this.el);let a=G.default.createElement(t,{...n,ref:this.handle});this.root.renderSync(a)}getGui(){return this.el}getValue(){return this.handle.current?.getValue()}isParsed(){return this.handle.current?.isParsed?.()??!1}focus(){this.handle.current?.focus?.()}isCancelBeforeStart(){return this.handle.current?.isCancelBeforeStart?.()??!1}destroy(){let n=this.root;this.root=null,n?.destroy()}}}function N(t){if(t==null)return;if(typeof t=="string"||et(t))return t;let e=me.get(t);if(e)return e;let n=tt(t);return me.set(t,n),n}var Ce=new WeakMap,fe=new WeakMap,Re=new WeakMap,ge=new WeakMap,he=new WeakMap;function y(t){return(typeof t=="function"||typeof t=="object")&&t!==null}function nt(t){let e=t.colDef.cellRendererParams;return e==null||typeof e!="object"?t:{...t,...e}}function ot(t){return class{el=document.createElement("span");root=null;init(n){this.el.style.display="inline-flex",this.el.style.alignItems="center",this.el.style.width="100%",this.el.style.height="100%",this.el.style.overflow="hidden",this.root=new s(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.render(m.default.createElement(t,nt(n)))}}}function T(t){if(!t)return;if(typeof t=="function"&&(0,E.isClassRenderer)(t)||!y(t))return t;let e=Ce.get(t);if(e)return e;let n=ot(t);return Ce.set(t,n),n}function rt(t){let e=t.colDef?.tooltipComponentParams;return e==null||typeof e!="object"?t:{...t,...e}}function it(t){return class{el=document.createElement("div");root=null;init(n){this.root=new s(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.renderSync(m.default.createElement(t,rt(n)))}}}function b(t){if(!t)return;if(typeof t=="function"&&(0,ye.isClassTooltipComponent)(t)||!y(t))return t;let e=fe.get(t);if(e)return e;let n=it(t);return fe.set(t,n),n}function F(t){if(t)return e=>{let n=t(e);return!n||typeof n.tooltip!="object"||n.tooltip==null?n:{...n,tooltip:{...n.tooltip,component:b(n.tooltip.component)}}}}function Se(t){return t==null||typeof t=="string"?t:b(t)}function at(t){let e=t.colDef?.actionFrameComponentParams;return e==null||typeof e!="object"?t:{...t,...e}}function lt(t){return class{el=document.createElement("div");root=null;init(n){this.root=new s(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.render(m.default.createElement(t,at(n)))}}}function Me(t){if(!t)return;if(typeof t=="function"&&(0,pe.isClassActionFrameComponent)(t)||!y(t))return t;let e=Re.get(t);if(e)return e;let n=lt(t);return Re.set(t,n),n}function ut({node:t}){let e=m.default.useRef(null);return m.default.useLayoutEffect(()=>{let n=e.current;n&&n.firstChild!==t&&n.replaceChildren(t)},[t]),m.default.createElement("span",{ref:e,style:{display:"contents"}})}function dt(t){if(!(typeof t=="function"&&!t.prototype?.isReactComponent))return r=>m.default.createElement(t,r);let n=t;function a(r){let c=n(r);return c instanceof HTMLElement?m.default.createElement(ut,{node:c}):c}return r=>m.default.createElement(a,r)}function ct(t){let e=dt(t);return class{el=document.createElement("div");root=null;init(a){this.el.className="pte-hcell-custom-root",this.el.style.display="flex",this.el.style.alignItems="center",this.el.style.width="100%",this.el.style.height="100%",this.el.style.overflow="hidden",this.root=new s(this.el),this.render(a)}getGui(){return this.el}refresh(a){return this.render(a),!0}destroy(){this.root?.destroy(),this.root=null}render(a){this.root?.render(e(a))}}}function P(t){if(!t)return;if(typeof t=="function"&&(0,we.isClassHeaderComponent)(t)||!y(t))return t;let e=he.get(t);if(e)return e;let n=ct(t);return he.set(t,n),n}function st(t){return class{el=document.createElement("span");root=null;init(n){this.root=new s(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.render(m.default.createElement(t,n))}}}function v(t){if(!t)return;if(typeof t=="function"&&(0,E.isClassSetFilterComponent)(t)||!y(t))return t;let e=ge.get(t);if(e)return e;let n=st(t);return ge.set(t,n),n}function ve(t){if(t)return{...t,valueComponent:v(t.valueComponent),selectAllComponent:v(t.selectAllComponent),blanksComponent:v(t.blanksComponent),groupComponent:v(t.groupComponent)}}function mt(t){return{...t,cellRenderer:T(t.cellRenderer),cellEditor:N(t.cellEditor),tooltipComponent:b(t.tooltipComponent),headerTooltip:Se(t.headerTooltip),actionFrameComponent:Me(t.actionFrameComponent),filterParams:ve(t.filterParams),headerComponent:P(t.headerComponent),headerCellComponent:P(t.headerCellComponent),children:t.children?B(t.children)??void 0:void 0}}function B(t){return t==null?t:t.map(e=>mt(e))}function Pe(t){let e={...t};return"cellRenderer"in t&&(e.cellRenderer=T(t.cellRenderer)),"cellEditor"in t&&(e.cellEditor=N(t.cellEditor)),"tooltipComponent"in t&&(e.tooltipComponent=b(t.tooltipComponent)),"headerTooltip"in t&&(e.headerTooltip=Se(t.headerTooltip)),"actionFrameComponent"in t&&(e.actionFrameComponent=Me(t.actionFrameComponent)),"filterParams"in t&&(e.filterParams=ve(t.filterParams)),"headerComponent"in t&&(e.headerComponent=P(t.headerComponent)),"headerCellComponent"in t&&(e.headerCellComponent=P(t.headerCellComponent)),e}function Ee(t){if(t!=null)return Pe(t)}function L(t){if(t!=null)return Pe(t)}function o(t,e,n){n!=null&&(t[e]=n)}function Te(t){let e={};return o(e,"headerHeight",t.headerHeight),o(e,"leafHeaderHeight",t.leafHeaderHeight),o(e,"parentHeaderHeight",t.parentHeaderHeight),o(e,"rowHeight",t.rowHeight),o(e,"pinnedTopRowData",t.pinnedTopRowData),o(e,"pinnedBottomRowData",t.pinnedBottomRowData),o(e,"getRowId",t.getRowId),o(e,"rowIdKey",t.rowIdKey),o(e,"rowDataMode",t.rowDataMode),o(e,"asyncTransactionWaitMs",t.asyncTransactionWaitMs),o(e,"overscanRowCount",t.overscanRowCount),o(e,"minResizeWidth",t.minResizeWidth),o(e,"maxColumnWidth",t.maxColumnWidth),o(e,"pivotMode",t.pivotMode),o(e,"pivotColumns",t.pivotColumns),o(e,"maxPivotColumns",t.maxPivotColumns),o(e,"pivotColumnMoveMode",t.pivotColumnMoveMode),o(e,"autosizeColumnsOnDataChange",t.autosizeColumnsOnDataChange),o(e,"allowExportAsCSV",t.allowExportAsCSV),o(e,"allowExportAsExcel",t.allowExportAsExcel),o(e,"pagination",t.pagination),o(e,"paginationControls",t.paginationControls),o(e,"rowNumbers",t.rowNumbers),o(e,"rowHover",t.rowHover),o(e,"columnHover",t.columnHover),o(e,"zebraRows",t.zebraRows),o(e,"getRowClass",t.getRowClass),o(e,"getRowStyle",t.getRowStyle),o(e,"getRowPresentation",F(t.getRowPresentation)),o(e,"onCellClicked",t.onCellClicked),o(e,"onRowClicked",t.onRowClicked),o(e,"onCellDoubleClicked",t.onCellDoubleClicked),o(e,"onRowDoubleClicked",t.onRowDoubleClicked),o(e,"onCellValueChanged",t.onCellValueChanged),o(e,"onSelectionChanged",t.onSelectionChanged),o(e,"onSortChanged",t.onSortChanged),o(e,"onColumnsChanged",t.onColumnsChanged),o(e,"onPaginationChanged",t.onPaginationChanged),o(e,"onError",t.onError),o(e,"onFilterChanged",t.onFilterChanged),o(e,"onQuickFilterFindChanged",t.onQuickFilterFindChanged),o(e,"onHistoryChanged",t.onHistoryChanged),o(e,"ariaLabel",t.ariaLabel),o(e,"ariaLabelledBy",t.ariaLabelledBy),o(e,"highlightActiveCell",t.highlightActiveCell),o(e,"rowSelection",t.rowSelection),o(e,"cellSelection",t.cellSelection),o(e,"rangeSelection",t.rangeSelection),o(e,"fillHandle",t.fillHandle),o(e,"columnSelection",t.columnSelection),o(e,"headerKeyboardNavigation",t.headerKeyboardNavigation),o(e,"showColumnButtonsOnHover",t.showColumnButtonsOnHover),o(e,"selectAllRowsOnHeaderClick",t.selectAllRowsOnHeaderClick),o(e,"selectAllScope",t.selectAllScope),o(e,"selectionPersistence",t.selectionPersistence),o(e,"clearSelectionOnBodyClick",t.clearSelectionOnBodyClick),o(e,"resetPageOn",t.resetPageOn),o(e,"pageSize",t.pageSize),o(e,"pageSizes",t.pageSizes),o(e,"serverSideBlockSize",t.serverSideBlockSize),o(e,"serverSideMaxBlocks",t.serverSideMaxBlocks),o(e,"rowModelType",t.rowModelType),o(e,"getGroupChildCount",t.getGroupChildCount),o(e,"groupChildCount",t.groupChildCount),o(e,"groupTotalRow",t.groupTotalRow),o(e,"grandTotalRow",t.grandTotalRow),o(e,"groupTotalRowLabel",t.groupTotalRowLabel),o(e,"paginationUnknownTotalTooltip",t.paginationUnknownTotalTooltip),o(e,"undoLimit",t.undoLimit),o(e,"editTrigger",t.editTrigger),o(e,"readOnlyEdit",t.readOnlyEdit),o(e,"initialSort",t.initialSort),o(e,"showSortPriority",t.showSortPriority),o(e,"pinnedRowsEditable",t.pinnedRowsEditable),o(e,"rowPinningMenu",t.rowPinningMenu),o(e,"rowInsertionMenu",t.rowInsertionMenu),o(e,"suppressKeyboardEdit",t.suppressKeyboardEdit),o(e,"suppressTypeToEdit",t.suppressTypeToEdit),o(e,"moveAfterEdit",t.moveAfterEdit),o(e,"commitOnBlur",t.commitOnBlur),o(e,"reevaluateOnEdit",t.reevaluateOnEdit),o(e,"groupDisplayType",t.groupDisplayType),o(e,"groupDefaultExpanded",t.groupDefaultExpanded),o(e,"groupSortMode",t.groupSortMode),o(e,"treeData",t.treeData),o(e,"groupRowsSelectable",t.groupRowsSelectable),o(e,"groupSelectsChildren",t.groupSelectsChildren),o(e,"aggFuncs",t.aggFuncs),o(e,"isRowSelectable",t.isRowSelectable),o(e,"isRowPinned",t.isRowPinned),o(e,"groupRowsSticky",t.groupRowsSticky),o(e,"isFullWidthRow",t.isFullWidthRow),o(e,"tooltip",t.tooltip),o(e,"quickFilter",t.quickFilter),o(e,"columnPanel",t.columnPanel),o(e,"toolbar",t.toolbar),o(e,"savedViews",t.savedViews),o(e,"sheets",t.sheets),o(e,"loadingMessage",t.loadingMessage),o(e,"noRowsMessage",t.noRowsMessage),o(e,"pivotNoValuesMessage",t.pivotNoValuesMessage),o(e,"pivotEmptyMessage",t.pivotEmptyMessage),o(e,"filterDebounceMs",t.filterDebounceMs),o(e,"cellFlashDuration",t.cellFlashDuration),o(e,"cellFadeDuration",t.cellFadeDuration),o(e,"icons",t.icons),o(e,"theme",t.theme),t.fullWidthCellRenderer!=null&&(e.fullWidthCellRenderer=T(t.fullWidthCellRenderer)),t.defaultColDef!=null&&(e.defaultColDef=Ee(t.defaultColDef)),t.groupColumnDef!=null&&(e.groupColumnDef=L(t.groupColumnDef)),t.pivotResultColumnDef!=null&&(e.pivotResultColumnDef=L(t.pivotResultColumnDef)),t.bodyContextMenu===!1&&(e.bodyContextMenu=!1),t.multiColumnMenu!=null&&(e.multiColumnMenu=t.multiColumnMenu),t.rowModelType==="serverSide"&&(o(e,"serverSideDataSource",t.serverSideDataSource),o(e,"serverSideAggregationSource",t.serverSideAggregationSource)),o(e,"suppressStyleInjection",t.suppressStyleInjection),o(e,"styleNonce",t.styleNonce),e}var be=h(require("react"),1);var D=class{constructor(e){this.opts=e}resolveMenuItems(e,n){let a=[],r=n,c=this.opts.getBodyMenuItems?this.opts.getBodyMenuItems({ctx:e,items:r}):r;return{items:this.normalizeItems(c,a),cleanup:()=>{for(let R of a)R()}}}normalizeItems(e,n){return e.map(a=>{if(a.isSeparator)return{isSeparator:!0};let r=this.normalizeSlot(a.left,n),c=this.normalizeSlot(a.right,n);return{...a,left:r,right:c,subMenu:a.subMenu?this.normalizeItems(a.subMenu,n):void 0}})}normalizeSlot(e,n){if(e){if(typeof e=="string"||e instanceof HTMLElement)return e;if(be.default.isValidElement(e)){let{el:a,unmount:r}=this.mountReact(e);return n.push(r),a}}}mountReact(e){let n=document.createElement("span");n.style.display="inline-flex",n.style.alignItems="center";let a=new s(n);return a.render(e),{el:n,unmount:()=>a.destroy()}}};var Fe=h(require("react"),1);var H=class{constructor(e){this.opts=e}resolveMenuItems(e,n){let a=[],r=n,c=this.opts.getColumnMenuItems?this.opts.getColumnMenuItems({ctx:e,items:r}):r;return{items:this.normalizeItems(c,a),cleanup:()=>{for(let R of a)R()}}}normalizeItems(e,n){return e.map(a=>{if(a.isSeparator)return{isSeparator:!0};let r=this.normalizeSlot(a.left,n),c=this.normalizeSlot(a.right,n);return{...a,left:r,right:c,subMenu:a.subMenu?this.normalizeItems(a.subMenu,n):void 0}})}normalizeSlot(e,n){if(e){if(typeof e=="string"||e instanceof HTMLElement)return e;if(Fe.default.isValidElement(e)){let{el:a,unmount:r}=this.mountReact(e);return n.push(r),a}}}mountReact(e){let n=document.createElement("span");n.style.display="inline-flex",n.style.alignItems="center";let a=new s(n);return a.render(e),{el:n,unmount:()=>a.destroy()}}};var De=require("@agility-workbench/grid"),Ct=new Set(["onCellClicked","onRowClicked","onCellDoubleClicked","onRowDoubleClicked","onCellValueChanged","onSelectionChanged","onSortChanged","onColumnsChanged","onPaginationChanged","onError","onFilterChanged","onQuickFilterFindChanged","onHistoryChanged","onBeforeCellCommit","fillOperation","multiColumnMenu"]),ft=De.CREATION_ONLY_OPTION_KEYS.filter(t=>!Ct.has(t)),Rt=["keyboardNavigationMode","enableKeyboardNavigationModeSwitch"],He=Symbol("uncomparable");function Oe(t,e){let n=e;if(t==="treeData"&&e!=null&&typeof e=="object"){let a={...e};for(let r of Rt)delete a[r];n=a}try{return JSON.stringify(n,(a,r)=>typeof r=="function"?`\u0192 ${String(r)}`:r===void 0?"\u2205undefined":r)??"\u2205undefined"}catch{return He}}function ke(t){let e=new Map;for(let n of ft){let a=t[n];e.set(n,{value:a,fingerprint:Oe(n,a)})}return e}function Ae(){try{return process.env.NODE_ENV!=="production"}catch{return!0}}function gt(t){return`[agility-workbench] <Grid> prop "${t}" changed after the grid was created. It is read only at creation, so the change is ignored. Remount the grid to apply it (for example, change the <Grid>'s React key).`}function xe(t,e,n){for(let[a,r]of e){if(n.has(a))continue;let c=t[a];if(Object.is(c,r.value))continue;let f=Oe(a,c);f!==He&&f===r.fingerprint||(n.add(a),console.warn(gt(a)))}}var Ne=require("react/jsx-runtime");function C(t,e){if(t){if(typeof t=="function"){t(e);return}t.current=e}}function ht(t){if(!t.destroyed){t.destroyed=!0;try{t.api.destroy()}catch{}}}var Ge=i.default.forwardRef(function(e,n){let a=(0,i.useRef)(null),r=(0,i.useRef)(null),c=(0,i.useRef)(e.onGridReady),f=(0,i.useRef)(e.getColumnMenuItems),R=(0,i.useRef)(e.bodyContextMenu),V=(0,i.useRef)(e.multiColumnMenu),K=(0,i.useRef)(e.onCellClicked),z=(0,i.useRef)(e.onRowClicked),W=(0,i.useRef)(e.onCellDoubleClicked),j=(0,i.useRef)(e.onRowDoubleClicked),_=(0,i.useRef)(e.onCellValueChanged),U=(0,i.useRef)(e.onSelectionChanged),q=(0,i.useRef)(e.onSortChanged),J=(0,i.useRef)(e.onColumnsChanged),Q=(0,i.useRef)(e.onPaginationChanged),Y=(0,i.useRef)(e.onError),$=(0,i.useRef)(e.onFilterChanged),X=(0,i.useRef)(e.onQuickFilterFindChanged),Z=(0,i.useRef)(e.onHistoryChanged),ee=(0,i.useRef)(e.onBeforeCellCommit),te=(0,i.useRef)(e.fillOperation);c.current=e.onGridReady,f.current=e.getColumnMenuItems,R.current=e.bodyContextMenu,V.current=e.multiColumnMenu,K.current=e.onCellClicked,z.current=e.onRowClicked,W.current=e.onCellDoubleClicked,j.current=e.onRowDoubleClicked,_.current=e.onCellValueChanged,U.current=e.onSelectionChanged,q.current=e.onSortChanged,J.current=e.onColumnsChanged,Q.current=e.onPaginationChanged,Y.current=e.onError,$.current=e.onFilterChanged,X.current=e.onQuickFilterFindChanged,Z.current=e.onHistoryChanged,ee.current=e.onBeforeCellCommit,te.current=e.fillOperation,(0,i.useLayoutEffect)(()=>{let u=a.current;if(!u)return;let d=Te(e);d.onCellClicked=l=>K.current?.(l),d.onRowClicked=l=>z.current?.(l),d.onCellDoubleClicked=l=>W.current?.(l),d.onRowDoubleClicked=l=>j.current?.(l),d.onCellValueChanged=l=>_.current?.(l),d.onSelectionChanged=l=>U.current?.(l),d.onSortChanged=l=>q.current?.(l),d.onColumnsChanged=l=>J.current?.(l),d.onPaginationChanged=l=>Q.current?.(l),d.onError=l=>Y.current?.(l),d.onFilterChanged=l=>$.current?.(l),d.onQuickFilterFindChanged=l=>X.current?.(l),d.onHistoryChanged=l=>Z.current?.(l),d.onBeforeCellCommit=l=>ee.current?.(l),d.fillOperation=l=>te.current?.(l),e.multiColumnMenu!==!1&&(d.multiColumnMenu=l=>{let g=V.current;return g===!1?[]:typeof g!="function"?l.items:g(l)});let k=(0,Ie.createGrid)(u,{...d,menuAdapter:new H({getColumnMenuItems:l=>f.current?.(l)??l.items}),bodyMenuAdapter:new D({getBodyMenuItems:l=>{let g=R.current;return typeof g=="function"?g(l):l.items}})}),A={api:k,destroyed:!1,appliedServerSideDataSource:d.serverSideDataSource,creationOnly:Ae()?{snapshot:ke(e),warned:new Set}:null};return r.current=A,C(n,k),C(e.apiRef,k),()=>{r.current===A&&(r.current=null),C(n,null),C(e.apiRef,null),ht(A)}},[]),(0,i.useLayoutEffect)(()=>{let u=r.current?.api??null;return C(n,u),C(e.apiRef,u),()=>{C(n,null),C(e.apiRef,null)}},[n,e.apiRef]),(0,i.useLayoutEffect)(()=>{let u=r.current?.api;u&&u.updateGridOptions({columnDefs:B(e.columnDefs)})},[e.columnDefs]),(0,i.useLayoutEffect)(()=>{let u=r.current?.api;u&&e.rowModelType!=="serverSide"&&u.setRowData(e.rowData??e.data??[])},[e.data,e.rowData,e.rowModelType]);let O=(0,i.useRef)(null);(0,i.useLayoutEffect)(()=>{let u=r.current;if(!(!u||O.current===u))return O.current=u,c.current?.(u.api),()=>{O.current=null}},[]),(0,i.useLayoutEffect)(()=>{let u=r.current?.creationOnly;u&&xe(e,u.snapshot,u.warned)}),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupDisplayType:e.groupDisplayType})},[e.groupDisplayType]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupSortMode:e.groupSortMode})},[e.groupSortMode]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupRowsSelectable:e.groupRowsSelectable})},[e.groupRowsSelectable]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupChildCount:e.groupChildCount})},[e.groupChildCount]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupTotalRow:e.groupTotalRow,grandTotalRow:e.grandTotalRow})},[e.groupTotalRow,e.grandTotalRow]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({groupTotalRowLabel:e.groupTotalRowLabel})},[e.groupTotalRowLabel]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({headerHeight:e.headerHeight,leafHeaderHeight:e.leafHeaderHeight,parentHeaderHeight:e.parentHeaderHeight})},[e.headerHeight,e.leafHeaderHeight,e.parentHeaderHeight]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({pivotColumnMoveMode:e.pivotColumnMoveMode})},[e.pivotColumnMoveMode]);let ne=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!ne.current){ne.current=!0;return}e.pivotMode!=null&&r.current?.api.setPivotMode(e.pivotMode)},[e.pivotMode]);let Be=JSON.stringify(e.pivotColumns??null),oe=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!oe.current){oe.current=!0;return}e.pivotColumns!=null&&r.current?.api.setPivotColumns(e.pivotColumns)},[Be]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({isRowSelectable:e.isRowSelectable})},[e.isRowSelectable]);let Le=JSON.stringify(e.rowSelection??null),re=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!re.current){re.current=!0;return}r.current?.api.updateGridOptions({rowSelection:e.rowSelection})},[Le]),(0,i.useLayoutEffect)(()=>{r.current?.api.setTreeDataKeyboardNavigationOptions({keyboardNavigationMode:e.treeData?.keyboardNavigationMode,enableKeyboardNavigationModeSwitch:e.treeData?.enableKeyboardNavigationModeSwitch??!1})},[e.treeData?.keyboardNavigationMode,e.treeData?.enableKeyboardNavigationModeSwitch]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({pinnedTopRowData:e.pinnedTopRowData,pinnedBottomRowData:e.pinnedBottomRowData,isRowPinned:e.isRowPinned,groupRowsSticky:e.groupRowsSticky})},[e.pinnedTopRowData,e.pinnedBottomRowData,e.isRowPinned,e.groupRowsSticky]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({rowHover:e.rowHover??!0,columnHover:e.columnHover??!1,zebraRows:e.zebraRows??!1,getRowClass:e.getRowClass,getRowStyle:e.getRowStyle,getRowPresentation:F(e.getRowPresentation),ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,highlightActiveCell:e.highlightActiveCell??!1,cellSelection:e.cellSelection??!0,rangeSelection:e.rangeSelection??!0,fillHandle:e.fillHandle??!0,columnSelection:e.columnSelection??!0,headerKeyboardNavigation:e.headerKeyboardNavigation??!0,showColumnButtonsOnHover:e.showColumnButtonsOnHover??!1,bodyContextMenu:e.bodyContextMenu!==!1,editTrigger:e.editTrigger??"doubleClick",readOnlyEdit:e.readOnlyEdit??!1,pinnedRowsEditable:e.pinnedRowsEditable??!1,rowPinningMenu:e.rowPinningMenu??!1,rowInsertionMenu:e.rowInsertionMenu,suppressKeyboardEdit:e.suppressKeyboardEdit??!1,suppressTypeToEdit:e.suppressTypeToEdit??!1,moveAfterEdit:e.moveAfterEdit??!0,commitOnBlur:e.commitOnBlur??!0,asyncTransactionWaitMs:e.asyncTransactionWaitMs??16,loadingMessage:e.loadingMessage,noRowsMessage:e.noRowsMessage})},[e.rowHover,e.columnHover,e.zebraRows,e.getRowClass,e.getRowStyle,e.getRowPresentation,e.ariaLabel,e.ariaLabelledBy,e.highlightActiveCell,e.cellSelection,e.rangeSelection,e.fillHandle,e.columnSelection,e.headerKeyboardNavigation,e.showColumnButtonsOnHover,e.bodyContextMenu,e.editTrigger,e.readOnlyEdit,e.pinnedRowsEditable,e.rowPinningMenu,e.rowInsertionMenu,e.suppressKeyboardEdit,e.suppressTypeToEdit,e.moveAfterEdit,e.commitOnBlur,e.asyncTransactionWaitMs,e.loadingMessage,e.noRowsMessage]),(0,i.useLayoutEffect)(()=>{let u=r.current;!u||e.rowModelType!=="serverSide"||e.serverSideDataSource&&e.serverSideDataSource!==u.appliedServerSideDataSource&&(u.appliedServerSideDataSource=e.serverSideDataSource,u.api.updateGridOptions({serverSideDataSource:e.serverSideDataSource}))},[e.rowModelType,e.serverSideDataSource]),(0,i.useLayoutEffect)(()=>{let u=r.current;!u||e.rowModelType!=="serverSide"||e.serverSideAggregationSource&&u.api.updateGridOptions({serverSideAggregationSource:e.serverSideAggregationSource})},[e.rowModelType,e.serverSideAggregationSource]),(0,i.useLayoutEffect)(()=>{let u=r.current?.api;u&&u.dispatch({type:"overlayShow",overlayType:e.loading?"loading":"none"})},[e.loading]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({pagination:e.pagination})},[e.pagination]);let Ve=JSON.stringify(e.paginationControls??null),ie=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!ie.current){ie.current=!0;return}r.current?.api.updateGridOptions({paginationControls:e.paginationControls})},[Ve]);let Ke=JSON.stringify(e.quickFilter??null),ae=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!ae.current){ae.current=!0;return}r.current?.api.updateGridOptions({quickFilter:e.quickFilter})},[Ke]);let ze=JSON.stringify(e.tooltip??null),le=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!le.current){le.current=!0;return}r.current?.api.updateGridOptions({tooltip:e.tooltip})},[ze]);let We=JSON.stringify(e.columnPanel??null),ue=(0,i.useRef)(!1);(0,i.useLayoutEffect)(()=>{if(!ue.current){ue.current=!0;return}r.current?.api.updateGridOptions({columnPanel:e.columnPanel})},[We]);let je=JSON.stringify(e.toolbar??null),de=(0,i.useRef)(!1);return(0,i.useLayoutEffect)(()=>{if(!de.current){de.current=!0;return}r.current?.api.updateGridOptions({toolbar:e.toolbar})},[je]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({savedViews:e.savedViews})},[e.savedViews]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({sheets:e.sheets})},[e.sheets]),(0,i.useLayoutEffect)(()=>{r.current?.api.updateGridOptions({theme:e.theme,icons:{...e.theme?.getIcons(),...e.icons}})},[e.theme,e.icons]),(0,Ne.jsx)("div",{ref:a,className:e.className,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",...e.style}})});0&&(module.exports={Grid,...require("@agility-workbench/grid")});
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ICellEditorParams, ColDef, CellRenderer, CellRendererParams, CellEditor, TooltipComponent, TooltipComponentParams, ActionFrameComponent, ActionFrameComponentParams, FilterParams, SetFilterValueComponent, SetFilterValueComponentParams, SetFilterSpecialValueComponent, SetFilterSpecialValueComponentParams, SetFilterGroupComponent, SetFilterGroupComponentParams, HeaderComponent, HeaderComponentParams, NON_DEFAULTABLE_COLDEF_KEYS, RowPresentationParams, RowPresentation, RowTooltipPresentation, MenuItem as MenuItem$1, GridOptions, IGridAPI, ColumnMenuContext, BodyMenuContext, Column } from '@agility-workbench/grid';
1
+ import { ICellEditorParams, ColDef, CellRenderer, CellRendererAlias, CellRendererParams, CellEditor, TooltipComponent, TooltipComponentParams, ActionFrameComponent, ActionFrameComponentParams, FilterParams, SetFilterValueComponent, SetFilterValueComponentParams, SetFilterSpecialValueComponent, SetFilterSpecialValueComponentParams, SetFilterGroupComponent, SetFilterGroupComponentParams, HeaderComponent, HeaderComponentParams, NON_DEFAULTABLE_COLDEF_KEYS, RowPresentationParams, RowPresentation, RowTooltipPresentation, MenuItem as MenuItem$1, GridOptions, IGridAPI, ColumnMenuContext, BodyMenuContext, Column } from '@agility-workbench/grid';
2
2
  export * from '@agility-workbench/grid';
3
3
  import React$1 from 'react';
4
4
 
@@ -51,7 +51,7 @@ type ReactFilterParams = Omit<FilterParams, "valueComponent" | "selectAllCompone
51
51
  groupComponent?: SetFilterGroupComponent | ReactSetFilterGroupComponent;
52
52
  };
53
53
  type ReactColDef = Omit<ColDef, "cellRenderer" | "cellEditor" | "children" | "tooltipComponent" | "headerTooltip" | "actionFrameComponent" | "filterParams" | "headerComponent" | "headerCellComponent"> & {
54
- cellRenderer?: CellRenderer | ReactCellRenderer;
54
+ cellRenderer?: CellRenderer | CellRendererAlias | ReactCellRenderer;
55
55
  cellEditor?: CellEditor | ReactCellEditor;
56
56
  tooltipComponent?: TooltipComponent | ReactTooltipComponent;
57
57
  headerTooltip?: string | TooltipComponent | ReactTooltipComponent;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ICellEditorParams, ColDef, CellRenderer, CellRendererParams, CellEditor, TooltipComponent, TooltipComponentParams, ActionFrameComponent, ActionFrameComponentParams, FilterParams, SetFilterValueComponent, SetFilterValueComponentParams, SetFilterSpecialValueComponent, SetFilterSpecialValueComponentParams, SetFilterGroupComponent, SetFilterGroupComponentParams, HeaderComponent, HeaderComponentParams, NON_DEFAULTABLE_COLDEF_KEYS, RowPresentationParams, RowPresentation, RowTooltipPresentation, MenuItem as MenuItem$1, GridOptions, IGridAPI, ColumnMenuContext, BodyMenuContext, Column } from '@agility-workbench/grid';
1
+ import { ICellEditorParams, ColDef, CellRenderer, CellRendererAlias, CellRendererParams, CellEditor, TooltipComponent, TooltipComponentParams, ActionFrameComponent, ActionFrameComponentParams, FilterParams, SetFilterValueComponent, SetFilterValueComponentParams, SetFilterSpecialValueComponent, SetFilterSpecialValueComponentParams, SetFilterGroupComponent, SetFilterGroupComponentParams, HeaderComponent, HeaderComponentParams, NON_DEFAULTABLE_COLDEF_KEYS, RowPresentationParams, RowPresentation, RowTooltipPresentation, MenuItem as MenuItem$1, GridOptions, IGridAPI, ColumnMenuContext, BodyMenuContext, Column } from '@agility-workbench/grid';
2
2
  export * from '@agility-workbench/grid';
3
3
  import React$1 from 'react';
4
4
 
@@ -51,7 +51,7 @@ type ReactFilterParams = Omit<FilterParams, "valueComponent" | "selectAllCompone
51
51
  groupComponent?: SetFilterGroupComponent | ReactSetFilterGroupComponent;
52
52
  };
53
53
  type ReactColDef = Omit<ColDef, "cellRenderer" | "cellEditor" | "children" | "tooltipComponent" | "headerTooltip" | "actionFrameComponent" | "filterParams" | "headerComponent" | "headerCellComponent"> & {
54
- cellRenderer?: CellRenderer | ReactCellRenderer;
54
+ cellRenderer?: CellRenderer | CellRendererAlias | ReactCellRenderer;
55
55
  cellEditor?: CellEditor | ReactCellEditor;
56
56
  tooltipComponent?: TooltipComponent | ReactTooltipComponent;
57
57
  headerTooltip?: string | TooltipComponent | ReactTooltipComponent;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export*from"@agility-workbench/grid";import tt,{useLayoutEffect as u,useRef as d}from"react";import{createGrid as nt}from"@agility-workbench/grid";import C from"react";import{flushSync as be}from"react-dom";import{createRoot as Te}from"react-dom/client";var D=new Set,H=!1;function Fe(){H=!1;let t=Array.from(D);D.clear();for(let e of t)e.unmount()}function De(t){D.add(t),!H&&(H=!0,queueMicrotask(Fe))}var m=class{root;constructor(e){this.root=Te(e)}render(e){this.root?.render(e)}renderSync(e){let n=this.root;n&&be(()=>n.render(e))}destroy(){let e=this.root;e&&(this.root=null,De(e))}};import{isClassRenderer as ke,isClassSetFilterComponent as Ie}from"@agility-workbench/grid";import{isClassTooltipComponent as Ae}from"@agility-workbench/grid";import{isClassActionFrameComponent as xe}from"@agility-workbench/grid";import{isClassHeaderComponent as Ge}from"@agility-workbench/grid";import te from"react";var ne=new WeakMap;function He(t){let e=t?.prototype;return typeof t=="function"&&!!e&&typeof e.init=="function"&&typeof e.getGui=="function"}function Oe(t){return class{el=document.createElement("div");root=null;handle=te.createRef();init(n){this.el.style.width="100%",this.el.style.height="100%",this.root=new m(this.el);let i=te.createElement(t,{...n,ref:this.handle});this.root.renderSync(i)}getGui(){return this.el}getValue(){return this.handle.current?.getValue()}isParsed(){return this.handle.current?.isParsed?.()??!1}focus(){this.handle.current?.focus?.()}isCancelBeforeStart(){return this.handle.current?.isCancelBeforeStart?.()??!1}destroy(){let n=this.root;this.root=null,n?.destroy()}}}function O(t){if(t==null)return;if(typeof t=="string"||He(t))return t;let e=ne.get(t);if(e)return e;let n=Oe(t);return ne.set(t,n),n}var oe=new WeakMap,re=new WeakMap,ie=new WeakMap,ae=new WeakMap,le=new WeakMap;function y(t){return(typeof t=="function"||typeof t=="object")&&t!==null}function Ne(t){let e=t.colDef.cellRendererParams;return e==null||typeof e!="object"?t:{...t,...e}}function Be(t){return class{el=document.createElement("span");root=null;init(n){this.el.style.display="inline-flex",this.el.style.alignItems="center",this.el.style.width="100%",this.el.style.height="100%",this.el.style.overflow="hidden",this.root=new m(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.render(C.createElement(t,Ne(n)))}}}function w(t){if(!t)return;if(typeof t=="function"&&ke(t)||!y(t))return t;let e=oe.get(t);if(e)return e;let n=Be(t);return oe.set(t,n),n}function Le(t){let e=t.colDef?.tooltipComponentParams;return e==null||typeof e!="object"?t:{...t,...e}}function Ve(t){return class{el=document.createElement("div");root=null;init(n){this.root=new m(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.renderSync(C.createElement(t,Le(n)))}}}function M(t){if(!t)return;if(typeof t=="function"&&Ae(t)||!y(t))return t;let e=re.get(t);if(e)return e;let n=Ve(t);return re.set(t,n),n}function v(t){if(t)return e=>{let n=t(e);return!n||typeof n.tooltip!="object"||n.tooltip==null?n:{...n,tooltip:{...n.tooltip,component:M(n.tooltip.component)}}}}function ue(t){return t==null||typeof t=="string"?t:M(t)}function Ke(t){let e=t.colDef?.actionFrameComponentParams;return e==null||typeof e!="object"?t:{...t,...e}}function ze(t){return class{el=document.createElement("div");root=null;init(n){this.root=new m(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.render(C.createElement(t,Ke(n)))}}}function de(t){if(!t)return;if(typeof t=="function"&&xe(t)||!y(t))return t;let e=ie.get(t);if(e)return e;let n=ze(t);return ie.set(t,n),n}function We({node:t}){let e=C.useRef(null);return C.useLayoutEffect(()=>{let n=e.current;n&&n.firstChild!==t&&n.replaceChildren(t)},[t]),C.createElement("span",{ref:e,style:{display:"contents"}})}function je(t){if(!(typeof t=="function"&&!t.prototype?.isReactComponent))return r=>C.createElement(t,r);let n=t;function i(r){let c=n(r);return c instanceof HTMLElement?C.createElement(We,{node:c}):c}return r=>C.createElement(i,r)}function _e(t){let e=je(t);return class{el=document.createElement("div");root=null;init(i){this.el.className="pte-hcell-custom-root",this.el.style.display="flex",this.el.style.alignItems="center",this.el.style.width="100%",this.el.style.height="100%",this.el.style.overflow="hidden",this.root=new m(this.el),this.render(i)}getGui(){return this.el}refresh(i){return this.render(i),!0}destroy(){this.root?.destroy(),this.root=null}render(i){this.root?.render(e(i))}}}function S(t){if(!t)return;if(typeof t=="function"&&Ge(t)||!y(t))return t;let e=le.get(t);if(e)return e;let n=_e(t);return le.set(t,n),n}function Ue(t){return class{el=document.createElement("span");root=null;init(n){this.root=new m(this.el),this.render(n)}getGui(){return this.el}refresh(n){return this.render(n),!0}destroy(){this.root?.destroy(),this.root=null}render(n){this.root?.render(C.createElement(t,n))}}}function p(t){if(!t)return;if(typeof t=="function"&&Ie(t)||!y(t))return t;let e=ae.get(t);if(e)return e;let n=Ue(t);return ae.set(t,n),n}function ce(t){if(t)return{...t,valueComponent:p(t.valueComponent),selectAllComponent:p(t.selectAllComponent),blanksComponent:p(t.blanksComponent),groupComponent:p(t.groupComponent)}}function qe(t){return{...t,cellRenderer:w(t.cellRenderer),cellEditor:O(t.cellEditor),tooltipComponent:M(t.tooltipComponent),headerTooltip:ue(t.headerTooltip),actionFrameComponent:de(t.actionFrameComponent),filterParams:ce(t.filterParams),headerComponent:S(t.headerComponent),headerCellComponent:S(t.headerCellComponent),children:t.children?k(t.children)??void 0:void 0}}function k(t){return t==null?t:t.map(e=>qe(e))}function se(t){let e={...t};return"cellRenderer"in t&&(e.cellRenderer=w(t.cellRenderer)),"cellEditor"in t&&(e.cellEditor=O(t.cellEditor)),"tooltipComponent"in t&&(e.tooltipComponent=M(t.tooltipComponent)),"headerTooltip"in t&&(e.headerTooltip=ue(t.headerTooltip)),"actionFrameComponent"in t&&(e.actionFrameComponent=de(t.actionFrameComponent)),"filterParams"in t&&(e.filterParams=ce(t.filterParams)),"headerComponent"in t&&(e.headerComponent=S(t.headerComponent)),"headerCellComponent"in t&&(e.headerCellComponent=S(t.headerCellComponent)),e}function me(t){if(t!=null)return se(t)}function I(t){if(t!=null)return se(t)}function o(t,e,n){n!=null&&(t[e]=n)}function Ce(t){let e={};return o(e,"headerHeight",t.headerHeight),o(e,"leafHeaderHeight",t.leafHeaderHeight),o(e,"parentHeaderHeight",t.parentHeaderHeight),o(e,"rowHeight",t.rowHeight),o(e,"pinnedTopRowData",t.pinnedTopRowData),o(e,"pinnedBottomRowData",t.pinnedBottomRowData),o(e,"getRowId",t.getRowId),o(e,"rowIdKey",t.rowIdKey),o(e,"rowDataMode",t.rowDataMode),o(e,"asyncTransactionWaitMs",t.asyncTransactionWaitMs),o(e,"overscanRowCount",t.overscanRowCount),o(e,"minResizeWidth",t.minResizeWidth),o(e,"maxColumnWidth",t.maxColumnWidth),o(e,"pivotMode",t.pivotMode),o(e,"pivotColumns",t.pivotColumns),o(e,"maxPivotColumns",t.maxPivotColumns),o(e,"pivotColumnMoveMode",t.pivotColumnMoveMode),o(e,"autosizeColumnsOnDataChange",t.autosizeColumnsOnDataChange),o(e,"allowExportAsCSV",t.allowExportAsCSV),o(e,"allowExportAsExcel",t.allowExportAsExcel),o(e,"pagination",t.pagination),o(e,"paginationControls",t.paginationControls),o(e,"rowNumbers",t.rowNumbers),o(e,"rowHover",t.rowHover),o(e,"columnHover",t.columnHover),o(e,"zebraRows",t.zebraRows),o(e,"getRowClass",t.getRowClass),o(e,"getRowStyle",t.getRowStyle),o(e,"getRowPresentation",v(t.getRowPresentation)),o(e,"onCellClicked",t.onCellClicked),o(e,"onRowClicked",t.onRowClicked),o(e,"onCellDoubleClicked",t.onCellDoubleClicked),o(e,"onRowDoubleClicked",t.onRowDoubleClicked),o(e,"onCellValueChanged",t.onCellValueChanged),o(e,"onSelectionChanged",t.onSelectionChanged),o(e,"onSortChanged",t.onSortChanged),o(e,"onFilterChanged",t.onFilterChanged),o(e,"onQuickFilterFindChanged",t.onQuickFilterFindChanged),o(e,"onHistoryChanged",t.onHistoryChanged),o(e,"ariaLabel",t.ariaLabel),o(e,"ariaLabelledBy",t.ariaLabelledBy),o(e,"highlightActiveCell",t.highlightActiveCell),o(e,"rowSelection",t.rowSelection),o(e,"cellSelection",t.cellSelection),o(e,"rangeSelection",t.rangeSelection),o(e,"fillHandle",t.fillHandle),o(e,"columnSelection",t.columnSelection),o(e,"headerKeyboardNavigation",t.headerKeyboardNavigation),o(e,"showColumnButtonsOnHover",t.showColumnButtonsOnHover),o(e,"selectAllRowsOnHeaderClick",t.selectAllRowsOnHeaderClick),o(e,"selectAllScope",t.selectAllScope),o(e,"selectionPersistence",t.selectionPersistence),o(e,"clearSelectionOnBodyClick",t.clearSelectionOnBodyClick),o(e,"resetPageOn",t.resetPageOn),o(e,"pageSize",t.pageSize),o(e,"pageSizes",t.pageSizes),o(e,"serverSideBlockSize",t.serverSideBlockSize),o(e,"rowModelType",t.rowModelType),o(e,"getGroupChildCount",t.getGroupChildCount),o(e,"groupChildCount",t.groupChildCount),o(e,"paginationUnknownTotalTooltip",t.paginationUnknownTotalTooltip),o(e,"undoLimit",t.undoLimit),o(e,"editTrigger",t.editTrigger),o(e,"readOnlyEdit",t.readOnlyEdit),o(e,"initialSort",t.initialSort),o(e,"showSortPriority",t.showSortPriority),o(e,"pinnedRowsEditable",t.pinnedRowsEditable),o(e,"rowPinningMenu",t.rowPinningMenu),o(e,"rowInsertionMenu",t.rowInsertionMenu),o(e,"suppressKeyboardEdit",t.suppressKeyboardEdit),o(e,"suppressTypeToEdit",t.suppressTypeToEdit),o(e,"moveAfterEdit",t.moveAfterEdit),o(e,"commitOnBlur",t.commitOnBlur),o(e,"reevaluateOnEdit",t.reevaluateOnEdit),o(e,"groupDisplayType",t.groupDisplayType),o(e,"groupDefaultExpanded",t.groupDefaultExpanded),o(e,"groupSortMode",t.groupSortMode),o(e,"treeData",t.treeData),o(e,"groupRowsSelectable",t.groupRowsSelectable),o(e,"isRowSelectable",t.isRowSelectable),o(e,"isRowPinned",t.isRowPinned),o(e,"groupRowsSticky",t.groupRowsSticky),o(e,"isFullWidthRow",t.isFullWidthRow),o(e,"tooltip",t.tooltip),o(e,"quickFilter",t.quickFilter),o(e,"columnPanel",t.columnPanel),o(e,"toolbar",t.toolbar),o(e,"savedViews",t.savedViews),o(e,"sheets",t.sheets),o(e,"loadingMessage",t.loadingMessage),o(e,"noRowsMessage",t.noRowsMessage),o(e,"pivotNoValuesMessage",t.pivotNoValuesMessage),o(e,"pivotEmptyMessage",t.pivotEmptyMessage),o(e,"filterDebounceMs",t.filterDebounceMs),o(e,"cellFlashDuration",t.cellFlashDuration),o(e,"cellFadeDuration",t.cellFadeDuration),o(e,"icons",t.icons),o(e,"theme",t.theme),t.fullWidthCellRenderer!=null&&(e.fullWidthCellRenderer=w(t.fullWidthCellRenderer)),t.defaultColDef!=null&&(e.defaultColDef=me(t.defaultColDef)),t.groupColumnDef!=null&&(e.groupColumnDef=I(t.groupColumnDef)),t.pivotResultColumnDef!=null&&(e.pivotResultColumnDef=I(t.pivotResultColumnDef)),t.bodyContextMenu===!1&&(e.bodyContextMenu=!1),t.multiColumnMenu!=null&&(e.multiColumnMenu=t.multiColumnMenu),t.rowModelType==="serverSide"&&(o(e,"serverSideDataSource",t.serverSideDataSource),o(e,"serverSideAggregationSource",t.serverSideAggregationSource)),o(e,"suppressStyleInjection",t.suppressStyleInjection),o(e,"styleNonce",t.styleNonce),e}import Je from"react";var P=class{constructor(e){this.opts=e}resolveMenuItems(e,n){let i=[],r=n,c=this.opts.getBodyMenuItems?this.opts.getBodyMenuItems({ctx:e,items:r}):r;return{items:this.normalizeItems(c,i),cleanup:()=>{for(let g of i)g()}}}normalizeItems(e,n){return e.map(i=>{if(i.isSeparator)return{isSeparator:!0};let r=this.normalizeSlot(i.left,n),c=this.normalizeSlot(i.right,n);return{...i,left:r,right:c,subMenu:i.subMenu?this.normalizeItems(i.subMenu,n):void 0}})}normalizeSlot(e,n){if(e){if(typeof e=="string"||e instanceof HTMLElement)return e;if(Je.isValidElement(e)){let{el:i,unmount:r}=this.mountReact(e);return n.push(r),i}}}mountReact(e){let n=document.createElement("span");n.style.display="inline-flex",n.style.alignItems="center";let i=new m(n);return i.render(e),{el:n,unmount:()=>i.destroy()}}};import Qe from"react";var E=class{constructor(e){this.opts=e}resolveMenuItems(e,n){let i=[],r=n,c=this.opts.getColumnMenuItems?this.opts.getColumnMenuItems({ctx:e,items:r}):r;return{items:this.normalizeItems(c,i),cleanup:()=>{for(let g of i)g()}}}normalizeItems(e,n){return e.map(i=>{if(i.isSeparator)return{isSeparator:!0};let r=this.normalizeSlot(i.left,n),c=this.normalizeSlot(i.right,n);return{...i,left:r,right:c,subMenu:i.subMenu?this.normalizeItems(i.subMenu,n):void 0}})}normalizeSlot(e,n){if(e){if(typeof e=="string"||e instanceof HTMLElement)return e;if(Qe.isValidElement(e)){let{el:i,unmount:r}=this.mountReact(e);return n.push(r),i}}}mountReact(e){let n=document.createElement("span");n.style.display="inline-flex",n.style.alignItems="center";let i=new m(n);return i.render(e),{el:n,unmount:()=>i.destroy()}}};import{CREATION_ONLY_OPTION_KEYS as Ye}from"@agility-workbench/grid";var $e=new Set(["onCellClicked","onRowClicked","onCellDoubleClicked","onRowDoubleClicked","onCellValueChanged","onSelectionChanged","onSortChanged","onFilterChanged","onQuickFilterFindChanged","onHistoryChanged","onBeforeCellCommit","fillOperation","multiColumnMenu"]),Xe=Ye.filter(t=>!$e.has(t)),Ze=["keyboardNavigationMode","enableKeyboardNavigationModeSwitch"],fe=Symbol("uncomparable");function Re(t,e){let n=e;if(t==="treeData"&&e!=null&&typeof e=="object"){let i={...e};for(let r of Ze)delete i[r];n=i}try{return JSON.stringify(n,(i,r)=>typeof r=="function"?`\u0192 ${String(r)}`:r===void 0?"\u2205undefined":r)??"\u2205undefined"}catch{return fe}}function ge(t){let e=new Map;for(let n of Xe){let i=t[n];e.set(n,{value:i,fingerprint:Re(n,i)})}return e}function he(){try{return process.env.NODE_ENV!=="production"}catch{return!0}}function et(t){return`[agility-workbench] <Grid> prop "${t}" changed after the grid was created. It is read only at creation, so the change is ignored. Remount the grid to apply it (for example, change the <Grid>'s React key).`}function ye(t,e,n){for(let[i,r]of e){if(n.has(i))continue;let c=t[i];if(Object.is(c,r.value))continue;let R=Re(i,c);R!==fe&&R===r.fingerprint||(n.add(i),console.warn(et(i)))}}import{jsx as it}from"react/jsx-runtime";function f(t,e){if(t){if(typeof t=="function"){t(e);return}t.current=e}}function ot(t){if(!t.destroyed){t.destroyed=!0;try{t.api.destroy()}catch{}}}var rt=tt.forwardRef(function(e,n){let i=d(null),r=d(null),c=d(e.onGridReady),R=d(e.getColumnMenuItems),g=d(e.bodyContextMenu),A=d(e.multiColumnMenu),x=d(e.onCellClicked),G=d(e.onRowClicked),N=d(e.onCellDoubleClicked),B=d(e.onRowDoubleClicked),L=d(e.onCellValueChanged),V=d(e.onSelectionChanged),K=d(e.onSortChanged),z=d(e.onFilterChanged),W=d(e.onQuickFilterFindChanged),j=d(e.onHistoryChanged),_=d(e.onBeforeCellCommit),U=d(e.fillOperation);c.current=e.onGridReady,R.current=e.getColumnMenuItems,g.current=e.bodyContextMenu,A.current=e.multiColumnMenu,x.current=e.onCellClicked,G.current=e.onRowClicked,N.current=e.onCellDoubleClicked,B.current=e.onRowDoubleClicked,L.current=e.onCellValueChanged,V.current=e.onSelectionChanged,K.current=e.onSortChanged,z.current=e.onFilterChanged,W.current=e.onQuickFilterFindChanged,j.current=e.onHistoryChanged,_.current=e.onBeforeCellCommit,U.current=e.fillOperation,u(()=>{let l=i.current;if(!l)return;let s=Ce(e);s.onCellClicked=a=>x.current?.(a),s.onRowClicked=a=>G.current?.(a),s.onCellDoubleClicked=a=>N.current?.(a),s.onRowDoubleClicked=a=>B.current?.(a),s.onCellValueChanged=a=>L.current?.(a),s.onSelectionChanged=a=>V.current?.(a),s.onSortChanged=a=>K.current?.(a),s.onFilterChanged=a=>z.current?.(a),s.onQuickFilterFindChanged=a=>W.current?.(a),s.onHistoryChanged=a=>j.current?.(a),s.onBeforeCellCommit=a=>_.current?.(a),s.fillOperation=a=>U.current?.(a),e.multiColumnMenu!==!1&&(s.multiColumnMenu=a=>{let h=A.current;return h===!1?[]:typeof h!="function"?a.items:h(a)});let T=nt(l,{...s,menuAdapter:new E({getColumnMenuItems:a=>R.current?.(a)??a.items}),bodyMenuAdapter:new P({getBodyMenuItems:a=>{let h=g.current;return typeof h=="function"?h(a):a.items}})}),F={api:T,destroyed:!1,appliedServerSideDataSource:s.serverSideDataSource,creationOnly:he()?{snapshot:ge(e),warned:new Set}:null};return r.current=F,f(n,T),f(e.apiRef,T),()=>{r.current===F&&(r.current=null),f(n,null),f(e.apiRef,null),ot(F)}},[]),u(()=>{let l=r.current?.api??null;return f(n,l),f(e.apiRef,l),()=>{f(n,null),f(e.apiRef,null)}},[n,e.apiRef]),u(()=>{let l=r.current?.api;l&&l.updateGridOptions({columnDefs:k(e.columnDefs)})},[e.columnDefs]),u(()=>{let l=r.current?.api;l&&e.rowModelType!=="serverSide"&&l.setRowData(e.rowData??e.data??[])},[e.data,e.rowData,e.rowModelType]);let b=d(null);u(()=>{let l=r.current;if(!(!l||b.current===l))return b.current=l,c.current?.(l.api),()=>{b.current=null}},[]),u(()=>{let l=r.current?.creationOnly;l&&ye(e,l.snapshot,l.warned)}),u(()=>{r.current?.api.updateGridOptions({groupDisplayType:e.groupDisplayType})},[e.groupDisplayType]),u(()=>{r.current?.api.updateGridOptions({groupSortMode:e.groupSortMode})},[e.groupSortMode]),u(()=>{r.current?.api.updateGridOptions({groupRowsSelectable:e.groupRowsSelectable})},[e.groupRowsSelectable]),u(()=>{r.current?.api.updateGridOptions({groupChildCount:e.groupChildCount})},[e.groupChildCount]),u(()=>{r.current?.api.updateGridOptions({headerHeight:e.headerHeight,leafHeaderHeight:e.leafHeaderHeight,parentHeaderHeight:e.parentHeaderHeight})},[e.headerHeight,e.leafHeaderHeight,e.parentHeaderHeight]),u(()=>{r.current?.api.updateGridOptions({pivotColumnMoveMode:e.pivotColumnMoveMode})},[e.pivotColumnMoveMode]);let q=d(!1);u(()=>{if(!q.current){q.current=!0;return}e.pivotMode!=null&&r.current?.api.setPivotMode(e.pivotMode)},[e.pivotMode]);let pe=JSON.stringify(e.pivotColumns??null),J=d(!1);u(()=>{if(!J.current){J.current=!0;return}e.pivotColumns!=null&&r.current?.api.setPivotColumns(e.pivotColumns)},[pe]),u(()=>{r.current?.api.updateGridOptions({isRowSelectable:e.isRowSelectable})},[e.isRowSelectable]);let Se=JSON.stringify(e.rowSelection??null),Q=d(!1);u(()=>{if(!Q.current){Q.current=!0;return}r.current?.api.updateGridOptions({rowSelection:e.rowSelection})},[Se]),u(()=>{r.current?.api.setTreeDataKeyboardNavigationOptions({keyboardNavigationMode:e.treeData?.keyboardNavigationMode,enableKeyboardNavigationModeSwitch:e.treeData?.enableKeyboardNavigationModeSwitch??!1})},[e.treeData?.keyboardNavigationMode,e.treeData?.enableKeyboardNavigationModeSwitch]),u(()=>{r.current?.api.updateGridOptions({pinnedTopRowData:e.pinnedTopRowData,pinnedBottomRowData:e.pinnedBottomRowData,isRowPinned:e.isRowPinned,groupRowsSticky:e.groupRowsSticky})},[e.pinnedTopRowData,e.pinnedBottomRowData,e.isRowPinned,e.groupRowsSticky]),u(()=>{r.current?.api.updateGridOptions({rowHover:e.rowHover??!0,columnHover:e.columnHover??!1,zebraRows:e.zebraRows??!1,getRowClass:e.getRowClass,getRowStyle:e.getRowStyle,getRowPresentation:v(e.getRowPresentation),ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,highlightActiveCell:e.highlightActiveCell??!1,cellSelection:e.cellSelection??!0,rangeSelection:e.rangeSelection??!0,fillHandle:e.fillHandle??!0,columnSelection:e.columnSelection??!0,headerKeyboardNavigation:e.headerKeyboardNavigation??!0,showColumnButtonsOnHover:e.showColumnButtonsOnHover??!1,bodyContextMenu:e.bodyContextMenu!==!1,editTrigger:e.editTrigger??"doubleClick",readOnlyEdit:e.readOnlyEdit??!1,pinnedRowsEditable:e.pinnedRowsEditable??!1,rowPinningMenu:e.rowPinningMenu??!1,rowInsertionMenu:e.rowInsertionMenu,suppressKeyboardEdit:e.suppressKeyboardEdit??!1,suppressTypeToEdit:e.suppressTypeToEdit??!1,moveAfterEdit:e.moveAfterEdit??!0,commitOnBlur:e.commitOnBlur??!0,asyncTransactionWaitMs:e.asyncTransactionWaitMs??16,loadingMessage:e.loadingMessage,noRowsMessage:e.noRowsMessage})},[e.rowHover,e.columnHover,e.zebraRows,e.getRowClass,e.getRowStyle,e.getRowPresentation,e.ariaLabel,e.ariaLabelledBy,e.highlightActiveCell,e.cellSelection,e.rangeSelection,e.fillHandle,e.columnSelection,e.headerKeyboardNavigation,e.showColumnButtonsOnHover,e.bodyContextMenu,e.editTrigger,e.readOnlyEdit,e.pinnedRowsEditable,e.rowPinningMenu,e.rowInsertionMenu,e.suppressKeyboardEdit,e.suppressTypeToEdit,e.moveAfterEdit,e.commitOnBlur,e.asyncTransactionWaitMs,e.loadingMessage,e.noRowsMessage]),u(()=>{let l=r.current;!l||e.rowModelType!=="serverSide"||e.serverSideDataSource&&e.serverSideDataSource!==l.appliedServerSideDataSource&&(l.appliedServerSideDataSource=e.serverSideDataSource,l.api.updateGridOptions({serverSideDataSource:e.serverSideDataSource}))},[e.rowModelType,e.serverSideDataSource]),u(()=>{let l=r.current;!l||e.rowModelType!=="serverSide"||e.serverSideAggregationSource&&l.api.updateGridOptions({serverSideAggregationSource:e.serverSideAggregationSource})},[e.rowModelType,e.serverSideAggregationSource]),u(()=>{let l=r.current?.api;l&&l.dispatch({type:"overlayShow",overlayType:e.loading?"loading":"none"})},[e.loading]),u(()=>{r.current?.api.updateGridOptions({pagination:e.pagination})},[e.pagination]);let we=JSON.stringify(e.paginationControls??null),Y=d(!1);u(()=>{if(!Y.current){Y.current=!0;return}r.current?.api.updateGridOptions({paginationControls:e.paginationControls})},[we]);let Me=JSON.stringify(e.quickFilter??null),$=d(!1);u(()=>{if(!$.current){$.current=!0;return}r.current?.api.updateGridOptions({quickFilter:e.quickFilter})},[Me]);let ve=JSON.stringify(e.tooltip??null),X=d(!1);u(()=>{if(!X.current){X.current=!0;return}r.current?.api.updateGridOptions({tooltip:e.tooltip})},[ve]);let Pe=JSON.stringify(e.columnPanel??null),Z=d(!1);u(()=>{if(!Z.current){Z.current=!0;return}r.current?.api.updateGridOptions({columnPanel:e.columnPanel})},[Pe]);let Ee=JSON.stringify(e.toolbar??null),ee=d(!1);return u(()=>{if(!ee.current){ee.current=!0;return}r.current?.api.updateGridOptions({toolbar:e.toolbar})},[Ee]),u(()=>{r.current?.api.updateGridOptions({savedViews:e.savedViews})},[e.savedViews]),u(()=>{r.current?.api.updateGridOptions({sheets:e.sheets})},[e.sheets]),u(()=>{r.current?.api.updateGridOptions({theme:e.theme,icons:{...e.theme?.getIcons(),...e.icons}})},[e.theme,e.icons]),it("div",{ref:i,className:e.className,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",...e.style}})});export{rt as Grid};
1
+ export*from"@agility-workbench/grid";import rt,{useLayoutEffect as l,useRef as d}from"react";import{createGrid as it}from"@agility-workbench/grid";import C from"react";import{flushSync as De}from"react-dom";import{createRoot as He}from"react-dom/client";var D=new Set,H=!1;function Oe(){H=!1;let t=Array.from(D);D.clear();for(let e of t)e.unmount()}function ke(t){D.add(t),!H&&(H=!0,queueMicrotask(Oe))}var m=class{root;constructor(e){this.root=He(e)}render(e){this.root?.render(e)}renderSync(e){let o=this.root;o&&De(()=>o.render(e))}destroy(){let e=this.root;e&&(this.root=null,ke(e))}};import{isClassRenderer as Ie,isClassSetFilterComponent as Ge}from"@agility-workbench/grid";import{isClassTooltipComponent as Ne}from"@agility-workbench/grid";import{isClassActionFrameComponent as Be}from"@agility-workbench/grid";import{isClassHeaderComponent as Le}from"@agility-workbench/grid";import re from"react";var ie=new WeakMap;function Ae(t){let e=t?.prototype;return typeof t=="function"&&!!e&&typeof e.init=="function"&&typeof e.getGui=="function"}function xe(t){return class{el=document.createElement("div");root=null;handle=re.createRef();init(o){this.el.style.width="100%",this.el.style.height="100%",this.root=new m(this.el);let i=re.createElement(t,{...o,ref:this.handle});this.root.renderSync(i)}getGui(){return this.el}getValue(){return this.handle.current?.getValue()}isParsed(){return this.handle.current?.isParsed?.()??!1}focus(){this.handle.current?.focus?.()}isCancelBeforeStart(){return this.handle.current?.isCancelBeforeStart?.()??!1}destroy(){let o=this.root;this.root=null,o?.destroy()}}}function O(t){if(t==null)return;if(typeof t=="string"||Ae(t))return t;let e=ie.get(t);if(e)return e;let o=xe(t);return ie.set(t,o),o}var ae=new WeakMap,le=new WeakMap,ue=new WeakMap,de=new WeakMap,ce=new WeakMap;function y(t){return(typeof t=="function"||typeof t=="object")&&t!==null}function Ve(t){let e=t.colDef.cellRendererParams;return e==null||typeof e!="object"?t:{...t,...e}}function Ke(t){return class{el=document.createElement("span");root=null;init(o){this.el.style.display="inline-flex",this.el.style.alignItems="center",this.el.style.width="100%",this.el.style.height="100%",this.el.style.overflow="hidden",this.root=new m(this.el),this.render(o)}getGui(){return this.el}refresh(o){return this.render(o),!0}destroy(){this.root?.destroy(),this.root=null}render(o){this.root?.render(C.createElement(t,Ve(o)))}}}function S(t){if(!t)return;if(typeof t=="function"&&Ie(t)||!y(t))return t;let e=ae.get(t);if(e)return e;let o=Ke(t);return ae.set(t,o),o}function ze(t){let e=t.colDef?.tooltipComponentParams;return e==null||typeof e!="object"?t:{...t,...e}}function We(t){return class{el=document.createElement("div");root=null;init(o){this.root=new m(this.el),this.render(o)}getGui(){return this.el}refresh(o){return this.render(o),!0}destroy(){this.root?.destroy(),this.root=null}render(o){this.root?.renderSync(C.createElement(t,ze(o)))}}}function M(t){if(!t)return;if(typeof t=="function"&&Ne(t)||!y(t))return t;let e=le.get(t);if(e)return e;let o=We(t);return le.set(t,o),o}function v(t){if(t)return e=>{let o=t(e);return!o||typeof o.tooltip!="object"||o.tooltip==null?o:{...o,tooltip:{...o.tooltip,component:M(o.tooltip.component)}}}}function se(t){return t==null||typeof t=="string"?t:M(t)}function je(t){let e=t.colDef?.actionFrameComponentParams;return e==null||typeof e!="object"?t:{...t,...e}}function _e(t){return class{el=document.createElement("div");root=null;init(o){this.root=new m(this.el),this.render(o)}getGui(){return this.el}refresh(o){return this.render(o),!0}destroy(){this.root?.destroy(),this.root=null}render(o){this.root?.render(C.createElement(t,je(o)))}}}function me(t){if(!t)return;if(typeof t=="function"&&Be(t)||!y(t))return t;let e=ue.get(t);if(e)return e;let o=_e(t);return ue.set(t,o),o}function Ue({node:t}){let e=C.useRef(null);return C.useLayoutEffect(()=>{let o=e.current;o&&o.firstChild!==t&&o.replaceChildren(t)},[t]),C.createElement("span",{ref:e,style:{display:"contents"}})}function qe(t){if(!(typeof t=="function"&&!t.prototype?.isReactComponent))return r=>C.createElement(t,r);let o=t;function i(r){let s=o(r);return s instanceof HTMLElement?C.createElement(Ue,{node:s}):s}return r=>C.createElement(i,r)}function Je(t){let e=qe(t);return class{el=document.createElement("div");root=null;init(i){this.el.className="pte-hcell-custom-root",this.el.style.display="flex",this.el.style.alignItems="center",this.el.style.width="100%",this.el.style.height="100%",this.el.style.overflow="hidden",this.root=new m(this.el),this.render(i)}getGui(){return this.el}refresh(i){return this.render(i),!0}destroy(){this.root?.destroy(),this.root=null}render(i){this.root?.render(e(i))}}}function w(t){if(!t)return;if(typeof t=="function"&&Le(t)||!y(t))return t;let e=ce.get(t);if(e)return e;let o=Je(t);return ce.set(t,o),o}function Qe(t){return class{el=document.createElement("span");root=null;init(o){this.root=new m(this.el),this.render(o)}getGui(){return this.el}refresh(o){return this.render(o),!0}destroy(){this.root?.destroy(),this.root=null}render(o){this.root?.render(C.createElement(t,o))}}}function p(t){if(!t)return;if(typeof t=="function"&&Ge(t)||!y(t))return t;let e=de.get(t);if(e)return e;let o=Qe(t);return de.set(t,o),o}function Ce(t){if(t)return{...t,valueComponent:p(t.valueComponent),selectAllComponent:p(t.selectAllComponent),blanksComponent:p(t.blanksComponent),groupComponent:p(t.groupComponent)}}function Ye(t){return{...t,cellRenderer:S(t.cellRenderer),cellEditor:O(t.cellEditor),tooltipComponent:M(t.tooltipComponent),headerTooltip:se(t.headerTooltip),actionFrameComponent:me(t.actionFrameComponent),filterParams:Ce(t.filterParams),headerComponent:w(t.headerComponent),headerCellComponent:w(t.headerCellComponent),children:t.children?k(t.children)??void 0:void 0}}function k(t){return t==null?t:t.map(e=>Ye(e))}function fe(t){let e={...t};return"cellRenderer"in t&&(e.cellRenderer=S(t.cellRenderer)),"cellEditor"in t&&(e.cellEditor=O(t.cellEditor)),"tooltipComponent"in t&&(e.tooltipComponent=M(t.tooltipComponent)),"headerTooltip"in t&&(e.headerTooltip=se(t.headerTooltip)),"actionFrameComponent"in t&&(e.actionFrameComponent=me(t.actionFrameComponent)),"filterParams"in t&&(e.filterParams=Ce(t.filterParams)),"headerComponent"in t&&(e.headerComponent=w(t.headerComponent)),"headerCellComponent"in t&&(e.headerCellComponent=w(t.headerCellComponent)),e}function Re(t){if(t!=null)return fe(t)}function A(t){if(t!=null)return fe(t)}function n(t,e,o){o!=null&&(t[e]=o)}function ge(t){let e={};return n(e,"headerHeight",t.headerHeight),n(e,"leafHeaderHeight",t.leafHeaderHeight),n(e,"parentHeaderHeight",t.parentHeaderHeight),n(e,"rowHeight",t.rowHeight),n(e,"pinnedTopRowData",t.pinnedTopRowData),n(e,"pinnedBottomRowData",t.pinnedBottomRowData),n(e,"getRowId",t.getRowId),n(e,"rowIdKey",t.rowIdKey),n(e,"rowDataMode",t.rowDataMode),n(e,"asyncTransactionWaitMs",t.asyncTransactionWaitMs),n(e,"overscanRowCount",t.overscanRowCount),n(e,"minResizeWidth",t.minResizeWidth),n(e,"maxColumnWidth",t.maxColumnWidth),n(e,"pivotMode",t.pivotMode),n(e,"pivotColumns",t.pivotColumns),n(e,"maxPivotColumns",t.maxPivotColumns),n(e,"pivotColumnMoveMode",t.pivotColumnMoveMode),n(e,"autosizeColumnsOnDataChange",t.autosizeColumnsOnDataChange),n(e,"allowExportAsCSV",t.allowExportAsCSV),n(e,"allowExportAsExcel",t.allowExportAsExcel),n(e,"pagination",t.pagination),n(e,"paginationControls",t.paginationControls),n(e,"rowNumbers",t.rowNumbers),n(e,"rowHover",t.rowHover),n(e,"columnHover",t.columnHover),n(e,"zebraRows",t.zebraRows),n(e,"getRowClass",t.getRowClass),n(e,"getRowStyle",t.getRowStyle),n(e,"getRowPresentation",v(t.getRowPresentation)),n(e,"onCellClicked",t.onCellClicked),n(e,"onRowClicked",t.onRowClicked),n(e,"onCellDoubleClicked",t.onCellDoubleClicked),n(e,"onRowDoubleClicked",t.onRowDoubleClicked),n(e,"onCellValueChanged",t.onCellValueChanged),n(e,"onSelectionChanged",t.onSelectionChanged),n(e,"onSortChanged",t.onSortChanged),n(e,"onColumnsChanged",t.onColumnsChanged),n(e,"onPaginationChanged",t.onPaginationChanged),n(e,"onError",t.onError),n(e,"onFilterChanged",t.onFilterChanged),n(e,"onQuickFilterFindChanged",t.onQuickFilterFindChanged),n(e,"onHistoryChanged",t.onHistoryChanged),n(e,"ariaLabel",t.ariaLabel),n(e,"ariaLabelledBy",t.ariaLabelledBy),n(e,"highlightActiveCell",t.highlightActiveCell),n(e,"rowSelection",t.rowSelection),n(e,"cellSelection",t.cellSelection),n(e,"rangeSelection",t.rangeSelection),n(e,"fillHandle",t.fillHandle),n(e,"columnSelection",t.columnSelection),n(e,"headerKeyboardNavigation",t.headerKeyboardNavigation),n(e,"showColumnButtonsOnHover",t.showColumnButtonsOnHover),n(e,"selectAllRowsOnHeaderClick",t.selectAllRowsOnHeaderClick),n(e,"selectAllScope",t.selectAllScope),n(e,"selectionPersistence",t.selectionPersistence),n(e,"clearSelectionOnBodyClick",t.clearSelectionOnBodyClick),n(e,"resetPageOn",t.resetPageOn),n(e,"pageSize",t.pageSize),n(e,"pageSizes",t.pageSizes),n(e,"serverSideBlockSize",t.serverSideBlockSize),n(e,"serverSideMaxBlocks",t.serverSideMaxBlocks),n(e,"rowModelType",t.rowModelType),n(e,"getGroupChildCount",t.getGroupChildCount),n(e,"groupChildCount",t.groupChildCount),n(e,"groupTotalRow",t.groupTotalRow),n(e,"grandTotalRow",t.grandTotalRow),n(e,"groupTotalRowLabel",t.groupTotalRowLabel),n(e,"paginationUnknownTotalTooltip",t.paginationUnknownTotalTooltip),n(e,"undoLimit",t.undoLimit),n(e,"editTrigger",t.editTrigger),n(e,"readOnlyEdit",t.readOnlyEdit),n(e,"initialSort",t.initialSort),n(e,"showSortPriority",t.showSortPriority),n(e,"pinnedRowsEditable",t.pinnedRowsEditable),n(e,"rowPinningMenu",t.rowPinningMenu),n(e,"rowInsertionMenu",t.rowInsertionMenu),n(e,"suppressKeyboardEdit",t.suppressKeyboardEdit),n(e,"suppressTypeToEdit",t.suppressTypeToEdit),n(e,"moveAfterEdit",t.moveAfterEdit),n(e,"commitOnBlur",t.commitOnBlur),n(e,"reevaluateOnEdit",t.reevaluateOnEdit),n(e,"groupDisplayType",t.groupDisplayType),n(e,"groupDefaultExpanded",t.groupDefaultExpanded),n(e,"groupSortMode",t.groupSortMode),n(e,"treeData",t.treeData),n(e,"groupRowsSelectable",t.groupRowsSelectable),n(e,"groupSelectsChildren",t.groupSelectsChildren),n(e,"aggFuncs",t.aggFuncs),n(e,"isRowSelectable",t.isRowSelectable),n(e,"isRowPinned",t.isRowPinned),n(e,"groupRowsSticky",t.groupRowsSticky),n(e,"isFullWidthRow",t.isFullWidthRow),n(e,"tooltip",t.tooltip),n(e,"quickFilter",t.quickFilter),n(e,"columnPanel",t.columnPanel),n(e,"toolbar",t.toolbar),n(e,"savedViews",t.savedViews),n(e,"sheets",t.sheets),n(e,"loadingMessage",t.loadingMessage),n(e,"noRowsMessage",t.noRowsMessage),n(e,"pivotNoValuesMessage",t.pivotNoValuesMessage),n(e,"pivotEmptyMessage",t.pivotEmptyMessage),n(e,"filterDebounceMs",t.filterDebounceMs),n(e,"cellFlashDuration",t.cellFlashDuration),n(e,"cellFadeDuration",t.cellFadeDuration),n(e,"icons",t.icons),n(e,"theme",t.theme),t.fullWidthCellRenderer!=null&&(e.fullWidthCellRenderer=S(t.fullWidthCellRenderer)),t.defaultColDef!=null&&(e.defaultColDef=Re(t.defaultColDef)),t.groupColumnDef!=null&&(e.groupColumnDef=A(t.groupColumnDef)),t.pivotResultColumnDef!=null&&(e.pivotResultColumnDef=A(t.pivotResultColumnDef)),t.bodyContextMenu===!1&&(e.bodyContextMenu=!1),t.multiColumnMenu!=null&&(e.multiColumnMenu=t.multiColumnMenu),t.rowModelType==="serverSide"&&(n(e,"serverSideDataSource",t.serverSideDataSource),n(e,"serverSideAggregationSource",t.serverSideAggregationSource)),n(e,"suppressStyleInjection",t.suppressStyleInjection),n(e,"styleNonce",t.styleNonce),e}import $e from"react";var P=class{constructor(e){this.opts=e}resolveMenuItems(e,o){let i=[],r=o,s=this.opts.getBodyMenuItems?this.opts.getBodyMenuItems({ctx:e,items:r}):r;return{items:this.normalizeItems(s,i),cleanup:()=>{for(let g of i)g()}}}normalizeItems(e,o){return e.map(i=>{if(i.isSeparator)return{isSeparator:!0};let r=this.normalizeSlot(i.left,o),s=this.normalizeSlot(i.right,o);return{...i,left:r,right:s,subMenu:i.subMenu?this.normalizeItems(i.subMenu,o):void 0}})}normalizeSlot(e,o){if(e){if(typeof e=="string"||e instanceof HTMLElement)return e;if($e.isValidElement(e)){let{el:i,unmount:r}=this.mountReact(e);return o.push(r),i}}}mountReact(e){let o=document.createElement("span");o.style.display="inline-flex",o.style.alignItems="center";let i=new m(o);return i.render(e),{el:o,unmount:()=>i.destroy()}}};import Xe from"react";var E=class{constructor(e){this.opts=e}resolveMenuItems(e,o){let i=[],r=o,s=this.opts.getColumnMenuItems?this.opts.getColumnMenuItems({ctx:e,items:r}):r;return{items:this.normalizeItems(s,i),cleanup:()=>{for(let g of i)g()}}}normalizeItems(e,o){return e.map(i=>{if(i.isSeparator)return{isSeparator:!0};let r=this.normalizeSlot(i.left,o),s=this.normalizeSlot(i.right,o);return{...i,left:r,right:s,subMenu:i.subMenu?this.normalizeItems(i.subMenu,o):void 0}})}normalizeSlot(e,o){if(e){if(typeof e=="string"||e instanceof HTMLElement)return e;if(Xe.isValidElement(e)){let{el:i,unmount:r}=this.mountReact(e);return o.push(r),i}}}mountReact(e){let o=document.createElement("span");o.style.display="inline-flex",o.style.alignItems="center";let i=new m(o);return i.render(e),{el:o,unmount:()=>i.destroy()}}};import{CREATION_ONLY_OPTION_KEYS as Ze}from"@agility-workbench/grid";var et=new Set(["onCellClicked","onRowClicked","onCellDoubleClicked","onRowDoubleClicked","onCellValueChanged","onSelectionChanged","onSortChanged","onColumnsChanged","onPaginationChanged","onError","onFilterChanged","onQuickFilterFindChanged","onHistoryChanged","onBeforeCellCommit","fillOperation","multiColumnMenu"]),tt=Ze.filter(t=>!et.has(t)),nt=["keyboardNavigationMode","enableKeyboardNavigationModeSwitch"],he=Symbol("uncomparable");function ye(t,e){let o=e;if(t==="treeData"&&e!=null&&typeof e=="object"){let i={...e};for(let r of nt)delete i[r];o=i}try{return JSON.stringify(o,(i,r)=>typeof r=="function"?`\u0192 ${String(r)}`:r===void 0?"\u2205undefined":r)??"\u2205undefined"}catch{return he}}function pe(t){let e=new Map;for(let o of tt){let i=t[o];e.set(o,{value:i,fingerprint:ye(o,i)})}return e}function we(){try{return process.env.NODE_ENV!=="production"}catch{return!0}}function ot(t){return`[agility-workbench] <Grid> prop "${t}" changed after the grid was created. It is read only at creation, so the change is ignored. Remount the grid to apply it (for example, change the <Grid>'s React key).`}function Se(t,e,o){for(let[i,r]of e){if(o.has(i))continue;let s=t[i];if(Object.is(s,r.value))continue;let R=ye(i,s);R!==he&&R===r.fingerprint||(o.add(i),console.warn(ot(i)))}}import{jsx as ut}from"react/jsx-runtime";function f(t,e){if(t){if(typeof t=="function"){t(e);return}t.current=e}}function at(t){if(!t.destroyed){t.destroyed=!0;try{t.api.destroy()}catch{}}}var lt=rt.forwardRef(function(e,o){let i=d(null),r=d(null),s=d(e.onGridReady),R=d(e.getColumnMenuItems),g=d(e.bodyContextMenu),x=d(e.multiColumnMenu),I=d(e.onCellClicked),G=d(e.onRowClicked),N=d(e.onCellDoubleClicked),B=d(e.onRowDoubleClicked),L=d(e.onCellValueChanged),V=d(e.onSelectionChanged),K=d(e.onSortChanged),z=d(e.onColumnsChanged),W=d(e.onPaginationChanged),j=d(e.onError),_=d(e.onFilterChanged),U=d(e.onQuickFilterFindChanged),q=d(e.onHistoryChanged),J=d(e.onBeforeCellCommit),Q=d(e.fillOperation);s.current=e.onGridReady,R.current=e.getColumnMenuItems,g.current=e.bodyContextMenu,x.current=e.multiColumnMenu,I.current=e.onCellClicked,G.current=e.onRowClicked,N.current=e.onCellDoubleClicked,B.current=e.onRowDoubleClicked,L.current=e.onCellValueChanged,V.current=e.onSelectionChanged,K.current=e.onSortChanged,z.current=e.onColumnsChanged,W.current=e.onPaginationChanged,j.current=e.onError,_.current=e.onFilterChanged,U.current=e.onQuickFilterFindChanged,q.current=e.onHistoryChanged,J.current=e.onBeforeCellCommit,Q.current=e.fillOperation,l(()=>{let u=i.current;if(!u)return;let c=ge(e);c.onCellClicked=a=>I.current?.(a),c.onRowClicked=a=>G.current?.(a),c.onCellDoubleClicked=a=>N.current?.(a),c.onRowDoubleClicked=a=>B.current?.(a),c.onCellValueChanged=a=>L.current?.(a),c.onSelectionChanged=a=>V.current?.(a),c.onSortChanged=a=>K.current?.(a),c.onColumnsChanged=a=>z.current?.(a),c.onPaginationChanged=a=>W.current?.(a),c.onError=a=>j.current?.(a),c.onFilterChanged=a=>_.current?.(a),c.onQuickFilterFindChanged=a=>U.current?.(a),c.onHistoryChanged=a=>q.current?.(a),c.onBeforeCellCommit=a=>J.current?.(a),c.fillOperation=a=>Q.current?.(a),e.multiColumnMenu!==!1&&(c.multiColumnMenu=a=>{let h=x.current;return h===!1?[]:typeof h!="function"?a.items:h(a)});let b=it(u,{...c,menuAdapter:new E({getColumnMenuItems:a=>R.current?.(a)??a.items}),bodyMenuAdapter:new P({getBodyMenuItems:a=>{let h=g.current;return typeof h=="function"?h(a):a.items}})}),F={api:b,destroyed:!1,appliedServerSideDataSource:c.serverSideDataSource,creationOnly:we()?{snapshot:pe(e),warned:new Set}:null};return r.current=F,f(o,b),f(e.apiRef,b),()=>{r.current===F&&(r.current=null),f(o,null),f(e.apiRef,null),at(F)}},[]),l(()=>{let u=r.current?.api??null;return f(o,u),f(e.apiRef,u),()=>{f(o,null),f(e.apiRef,null)}},[o,e.apiRef]),l(()=>{let u=r.current?.api;u&&u.updateGridOptions({columnDefs:k(e.columnDefs)})},[e.columnDefs]),l(()=>{let u=r.current?.api;u&&e.rowModelType!=="serverSide"&&u.setRowData(e.rowData??e.data??[])},[e.data,e.rowData,e.rowModelType]);let T=d(null);l(()=>{let u=r.current;if(!(!u||T.current===u))return T.current=u,s.current?.(u.api),()=>{T.current=null}},[]),l(()=>{let u=r.current?.creationOnly;u&&Se(e,u.snapshot,u.warned)}),l(()=>{r.current?.api.updateGridOptions({groupDisplayType:e.groupDisplayType})},[e.groupDisplayType]),l(()=>{r.current?.api.updateGridOptions({groupSortMode:e.groupSortMode})},[e.groupSortMode]),l(()=>{r.current?.api.updateGridOptions({groupRowsSelectable:e.groupRowsSelectable})},[e.groupRowsSelectable]),l(()=>{r.current?.api.updateGridOptions({groupChildCount:e.groupChildCount})},[e.groupChildCount]),l(()=>{r.current?.api.updateGridOptions({groupTotalRow:e.groupTotalRow,grandTotalRow:e.grandTotalRow})},[e.groupTotalRow,e.grandTotalRow]),l(()=>{r.current?.api.updateGridOptions({groupTotalRowLabel:e.groupTotalRowLabel})},[e.groupTotalRowLabel]),l(()=>{r.current?.api.updateGridOptions({headerHeight:e.headerHeight,leafHeaderHeight:e.leafHeaderHeight,parentHeaderHeight:e.parentHeaderHeight})},[e.headerHeight,e.leafHeaderHeight,e.parentHeaderHeight]),l(()=>{r.current?.api.updateGridOptions({pivotColumnMoveMode:e.pivotColumnMoveMode})},[e.pivotColumnMoveMode]);let Y=d(!1);l(()=>{if(!Y.current){Y.current=!0;return}e.pivotMode!=null&&r.current?.api.setPivotMode(e.pivotMode)},[e.pivotMode]);let Me=JSON.stringify(e.pivotColumns??null),$=d(!1);l(()=>{if(!$.current){$.current=!0;return}e.pivotColumns!=null&&r.current?.api.setPivotColumns(e.pivotColumns)},[Me]),l(()=>{r.current?.api.updateGridOptions({isRowSelectable:e.isRowSelectable})},[e.isRowSelectable]);let ve=JSON.stringify(e.rowSelection??null),X=d(!1);l(()=>{if(!X.current){X.current=!0;return}r.current?.api.updateGridOptions({rowSelection:e.rowSelection})},[ve]),l(()=>{r.current?.api.setTreeDataKeyboardNavigationOptions({keyboardNavigationMode:e.treeData?.keyboardNavigationMode,enableKeyboardNavigationModeSwitch:e.treeData?.enableKeyboardNavigationModeSwitch??!1})},[e.treeData?.keyboardNavigationMode,e.treeData?.enableKeyboardNavigationModeSwitch]),l(()=>{r.current?.api.updateGridOptions({pinnedTopRowData:e.pinnedTopRowData,pinnedBottomRowData:e.pinnedBottomRowData,isRowPinned:e.isRowPinned,groupRowsSticky:e.groupRowsSticky})},[e.pinnedTopRowData,e.pinnedBottomRowData,e.isRowPinned,e.groupRowsSticky]),l(()=>{r.current?.api.updateGridOptions({rowHover:e.rowHover??!0,columnHover:e.columnHover??!1,zebraRows:e.zebraRows??!1,getRowClass:e.getRowClass,getRowStyle:e.getRowStyle,getRowPresentation:v(e.getRowPresentation),ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,highlightActiveCell:e.highlightActiveCell??!1,cellSelection:e.cellSelection??!0,rangeSelection:e.rangeSelection??!0,fillHandle:e.fillHandle??!0,columnSelection:e.columnSelection??!0,headerKeyboardNavigation:e.headerKeyboardNavigation??!0,showColumnButtonsOnHover:e.showColumnButtonsOnHover??!1,bodyContextMenu:e.bodyContextMenu!==!1,editTrigger:e.editTrigger??"doubleClick",readOnlyEdit:e.readOnlyEdit??!1,pinnedRowsEditable:e.pinnedRowsEditable??!1,rowPinningMenu:e.rowPinningMenu??!1,rowInsertionMenu:e.rowInsertionMenu,suppressKeyboardEdit:e.suppressKeyboardEdit??!1,suppressTypeToEdit:e.suppressTypeToEdit??!1,moveAfterEdit:e.moveAfterEdit??!0,commitOnBlur:e.commitOnBlur??!0,asyncTransactionWaitMs:e.asyncTransactionWaitMs??16,loadingMessage:e.loadingMessage,noRowsMessage:e.noRowsMessage})},[e.rowHover,e.columnHover,e.zebraRows,e.getRowClass,e.getRowStyle,e.getRowPresentation,e.ariaLabel,e.ariaLabelledBy,e.highlightActiveCell,e.cellSelection,e.rangeSelection,e.fillHandle,e.columnSelection,e.headerKeyboardNavigation,e.showColumnButtonsOnHover,e.bodyContextMenu,e.editTrigger,e.readOnlyEdit,e.pinnedRowsEditable,e.rowPinningMenu,e.rowInsertionMenu,e.suppressKeyboardEdit,e.suppressTypeToEdit,e.moveAfterEdit,e.commitOnBlur,e.asyncTransactionWaitMs,e.loadingMessage,e.noRowsMessage]),l(()=>{let u=r.current;!u||e.rowModelType!=="serverSide"||e.serverSideDataSource&&e.serverSideDataSource!==u.appliedServerSideDataSource&&(u.appliedServerSideDataSource=e.serverSideDataSource,u.api.updateGridOptions({serverSideDataSource:e.serverSideDataSource}))},[e.rowModelType,e.serverSideDataSource]),l(()=>{let u=r.current;!u||e.rowModelType!=="serverSide"||e.serverSideAggregationSource&&u.api.updateGridOptions({serverSideAggregationSource:e.serverSideAggregationSource})},[e.rowModelType,e.serverSideAggregationSource]),l(()=>{let u=r.current?.api;u&&u.dispatch({type:"overlayShow",overlayType:e.loading?"loading":"none"})},[e.loading]),l(()=>{r.current?.api.updateGridOptions({pagination:e.pagination})},[e.pagination]);let Pe=JSON.stringify(e.paginationControls??null),Z=d(!1);l(()=>{if(!Z.current){Z.current=!0;return}r.current?.api.updateGridOptions({paginationControls:e.paginationControls})},[Pe]);let Ee=JSON.stringify(e.quickFilter??null),ee=d(!1);l(()=>{if(!ee.current){ee.current=!0;return}r.current?.api.updateGridOptions({quickFilter:e.quickFilter})},[Ee]);let Te=JSON.stringify(e.tooltip??null),te=d(!1);l(()=>{if(!te.current){te.current=!0;return}r.current?.api.updateGridOptions({tooltip:e.tooltip})},[Te]);let be=JSON.stringify(e.columnPanel??null),ne=d(!1);l(()=>{if(!ne.current){ne.current=!0;return}r.current?.api.updateGridOptions({columnPanel:e.columnPanel})},[be]);let Fe=JSON.stringify(e.toolbar??null),oe=d(!1);return l(()=>{if(!oe.current){oe.current=!0;return}r.current?.api.updateGridOptions({toolbar:e.toolbar})},[Fe]),l(()=>{r.current?.api.updateGridOptions({savedViews:e.savedViews})},[e.savedViews]),l(()=>{r.current?.api.updateGridOptions({sheets:e.sheets})},[e.sheets]),l(()=>{r.current?.api.updateGridOptions({theme:e.theme,icons:{...e.theme?.getIcons(),...e.icons}})},[e.theme,e.icons]),ut("div",{ref:i,className:e.className,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",...e.style}})});export{lt as Grid};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agility-workbench/react-grid",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "React bindings for @agility-workbench/grid — a high-performance data grid.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -61,7 +61,7 @@
61
61
  "prepublishOnly": "npm run build"
62
62
  },
63
63
  "dependencies": {
64
- "@agility-workbench/grid": "^1.11.0"
64
+ "@agility-workbench/grid": "^1.12.0"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "react": ">=18.0.0",