@alaarab/ogrid-angular 2.5.4 → 2.5.6

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/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelectFilterFields,deriveFilterOptionsFromData,processClientSideData,validateColumns,processClientSideDataAsync,validateRowIds,computeNextSortState,mergeFilter,applyResponsiveHiding,resolveResponsiveConfig,CHECKBOX_COLUMN_WIDTH,DEFAULT_MIN_COLUMN_WIDTH,CELL_PADDING,parseValue,UndoRedoStack,rangesEqual,normalizeSelectionRange,formatSelectionAsTsv,parseTsvClipboard,getCellValue,applyCellDeletion,getScrollTopForRow,computeTabNavigation,applyFillValues,computeAggregations,getDataGridStatusBarConfig,computeVisibleRange,computeTotalHeight,computeVisibleColumnRange,validateVirtualScrollConfig,GRID_BORDER_RADIUS,getStatusBarParts,GRID_CONTEXT_MENU_ITEMS,formatShortcut,injectGlobalStyles,partitionColumnsForVirtualization,buildHeaderRows,ROW_NUMBER_COLUMN_ID,ROW_NUMBER_COLUMN_WIDTH,getHeaderFilterConfig,getCellRenderDescriptor,resolveCellDisplayContent,resolveCellStyle,buildPopoverEditorProps,ROW_NUMBER_COLUMN_MIN_WIDTH,measureColumnContentWidth,getPaginationViewModel,getColumnHeaderMenuItems,reorderColumnArray,findCtrlArrowTarget,measureRange}from'@alaarab/ogrid-core';export{AUTOSIZE_EXTRA_PX,AUTOSIZE_MAX_PX,CELL_PADDING,CHECKBOX_COLUMN_WIDTH,COLUMN_HEADER_MENU_ITEMS,CellDescriptorCache,DEFAULT_DEBOUNCE_MS,DEFAULT_MIN_COLUMN_WIDTH,GRID_BORDER_RADIUS,GRID_CONTEXT_MENU_ITEMS,MAX_PAGE_BUTTONS,PAGE_SIZE_OPTIONS,PEOPLE_SEARCH_DEBOUNCE_MS,RESPONSIVE_BREAKPOINTS,ROW_NUMBER_COLUMN_ID,ROW_NUMBER_COLUMN_MIN_WIDTH,ROW_NUMBER_COLUMN_WIDTH,SIDEBAR_TRANSITION_MS,UndoRedoStack,Z_INDEX,applyCellDeletion,applyCutClear,applyFillValues,applyPastedValues,applyRangeRowSelection,applyResponsiveHiding,areGridRowPropsEqual,booleanParser,buildCellIndex,buildCsvHeader,buildCsvRows,buildHeaderRows,buildInlineEditorProps,buildPopoverEditorProps,calculateDropTarget,clampSelectionToBounds,columnLetterToIndex,computeAggregations,computeArrowNavigation,computeAutoScrollSpeed,computeNextSortState,computeRowSelectionState,computeTabNavigation,computeTotalHeight,computeVisibleColumnRange,computeVisibleRange,createGridDataAccessor,createSortFilterWorker,currencyParser,dateParser,debounce,deriveFilterOptionsFromData,emailParser,escapeCsvValue,exportToCsv,extractValueMatrix,findCtrlArrowTarget,flattenColumns,formatCellReference,formatCellValueForTsv,formatSelectionAsTsv,formatShortcut,getCellRenderDescriptor,getCellValue,getColumnHeaderMenuItems,getContextMenuHandlers,getDataGridStatusBarConfig,getFilterField,getHeaderFilterConfig,getMultiSelectFilterFields,getPaginationViewModel,getPinStateForColumn,getResponsiveHiddenColumns,getScrollTopForRow,getStatusBarParts,indexToColumnLetter,injectGlobalStyles,isColumnEditable,isFilterConfig,isInSelectionRange,isRowInRange,measureColumnContentWidth,measureRange,mergeFilter,normalizeSelectionRange,numberParser,parseTsvClipboard,parseValue,partitionColumnsForVirtualization,processClientSideData,processClientSideDataAsync,rangesEqual,reorderColumnArray,resolveCellDisplayContent,resolveCellStyle,resolveResponsiveConfig,terminateSortFilterWorker,toUserLike,triggerCsvDownload,validateColumns,validateRowIds,validateVirtualScrollConfig}from'@alaarab/ogrid-core';import {handleFormulaBarKeyDown,FormulaEngine,deriveFormulaBarText,extractFormulaReferences,FORMULA_REF_COLORS}from'@alaarab/ogrid-core/formula';export{CIRC_ERROR,DIV_ZERO_ERROR,DependencyGraph,FORMULA_BAR_CSS,FORMULA_BAR_STYLES,FORMULA_REF_COLORS,FormulaEngine,FormulaError,FormulaEvaluator,GENERAL_ERROR,NAME_ERROR,NA_ERROR,REF_ERROR,VALUE_ERROR,adjustFormulaReferences,canInsertReference,createBuiltInFunctions,deriveFormulaBarText,extractFormulaReferences,flattenArgs,formatAddress,formulaToString,fromCellKey,handleFormulaBarKeyDown,insertReferenceAtCursor,isFormulaError,parse,parseCellRef,parseRange,processFormulaBarCommit,toBoolean,toCellKey,toNumber,tokenize}from'@alaarab/ogrid-core/formula';import {Injectable,Input,Component,ChangeDetectionStrategy,ViewEncapsulation,Output,ViewChild,input,output,viewChild,effect,inject,DestroyRef,signal,computed,NgZone,EventEmitter,Injector,EnvironmentInjector,createComponent}from'@angular/core';import {NgTemplateOutlet}from'@angular/common';var Ht=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var l=(p,e,t,n)=>{for(var i=n>1?void 0:n?Bt(e,t):e,o=p.length-1,r;o>=0;o--)(r=p[o])&&(i=(n?r(e,t,i):r(i))||i);return n&&i&&Ht(e,t,i),i};var ne=class{constructor(){this.destroyRef=inject(DestroyRef);this.engine=null;this.initialLoaded=false;this.items=[];this.flatColumns=[];this.enabled=signal(false);this.lastRecalcResult=signal(null);this.formulaCount=computed(()=>(this.lastRecalcResult(),this.engine?.getAllFormulas().length??0));this.destroyRef.onDestroy(()=>{this.engine?.clear(),this.engine=null;});}configure(e){let{formulas:t,initialFormulas:n,formulaFunctions:i,onFormulaRecalc:o,namedRanges:r,sheets:s}=e;if(this.onFormulaRecalcFn=o,t&&!this.engine){if(this.engine=new FormulaEngine({customFunctions:i,namedRanges:r}),s)for(let[u,d]of Object.entries(s))this.engine.registerSheet(u,d);this.enabled.set(true);}else !t&&this.engine&&(this.engine.clear(),this.engine=null,this.enabled.set(false),this.lastRecalcResult.set(null),this.initialLoaded=false);if(t&&this.engine&&n&&!this.initialLoaded){this.initialLoaded=true;let u=this.createAccessor(),d=this.engine.loadFormulas(n,u);d.updatedCells.length>0&&(this.lastRecalcResult.set(d),this.onFormulaRecalcFn?.(d));}}setData(e,t){this.items=e,this.flatColumns=t;}setFormula(e,t,n,i){if(!this.engine)return;let o=i??this.createAccessor(),r=this.engine.setFormula(e,t,n,o);r.updatedCells.length>0&&(this.lastRecalcResult.set(r),this.onFormulaRecalcFn?.(r));}onCellChanged(e,t,n){if(!this.engine)return;let i=n??this.createAccessor(),o=this.engine.onCellChanged(e,t,i);o.updatedCells.length>0&&(this.lastRecalcResult.set(o),this.onFormulaRecalcFn?.(o));}getValue(e,t){return this.engine?.getValue(e,t)}hasFormula(e,t){return this.engine?.hasFormula(e,t)??false}getFormula(e,t){return this.engine?.getFormula(e,t)}recalcAll(e){if(!this.engine)return;let t=e??this.createAccessor(),n=this.engine.recalcAll(t);n.updatedCells.length>0&&(this.lastRecalcResult.set(n),this.onFormulaRecalcFn?.(n));}getAllFormulas(){return this.engine?.getAllFormulas()??[]}registerFunction(e,t){this.engine?.registerFunction(e,t);}clear(){this.engine?.clear(),this.lastRecalcResult.set(null);}defineNamedRange(e,t){this.engine?.defineNamedRange(e,t);}removeNamedRange(e){this.engine?.removeNamedRange(e);}registerSheet(e,t){this.engine?.registerSheet(e,t);}unregisterSheet(e){this.engine?.unregisterSheet(e);}getPrecedents(e,t){return this.engine?.getPrecedents(e,t)??[]}getDependents(e,t){return this.engine?.getDependents(e,t)??[]}getAuditTrail(e,t){return this.engine?.getAuditTrail(e,t)??null}createAccessor(){return createGridDataAccessor(this.items,this.flatColumns)}};ne=l([Injectable()],ne);var sn=25,an={},ut=["columns","filters"],ie=class{constructor(){this.destroyRef=inject(DestroyRef);this.columnsProp=signal([]);this.getRowId=signal(e=>e.id);this.data=signal(void 0);this.dataSource=signal(void 0);this.controlledPage=signal(void 0);this.controlledPageSize=signal(void 0);this.controlledSort=signal(void 0);this.controlledFilters=signal(void 0);this.controlledVisibleColumns=signal(void 0);this.controlledLoading=signal(void 0);this.onPageChange=signal(void 0);this.onPageSizeChange=signal(void 0);this.onSortChange=signal(void 0);this.onFiltersChange=signal(void 0);this.onVisibleColumnsChange=signal(void 0);this.columnOrder=signal(void 0);this.onColumnOrderChange=signal(void 0);this.onColumnResized=signal(void 0);this.onAutosizeColumn=signal(void 0);this.onColumnPinned=signal(void 0);this.defaultPageSize=signal(sn);this.defaultSortBy=signal(void 0);this.defaultSortDirection=signal("asc");this.toolbar=signal(void 0);this.toolbarBelow=signal(void 0);this.emptyState=signal(void 0);this.entityLabelPlural=signal("items");this.className=signal(void 0);this.layoutMode=signal("fill");this.suppressHorizontalScroll=signal(void 0);this.stickyHeader=signal(true);this.fullScreen=signal(false);this.editable=signal(void 0);this.cellSelection=signal(void 0);this.density=signal("normal");this.rowHeight=signal(void 0);this.onCellValueChanged=signal(void 0);this.onUndo=signal(void 0);this.onRedo=signal(void 0);this.canUndo=signal(void 0);this.canRedo=signal(void 0);this.rowSelection=signal("none");this.selectedRows=signal(void 0);this.onSelectionChange=signal(void 0);this.statusBar=signal(void 0);this.pageSizeOptions=signal(void 0);this.sideBarConfig=signal(void 0);this.onFirstDataRendered=signal(void 0);this.onError=signal(void 0);this.columnChooserProp=signal(void 0);this.columnReorder=signal(void 0);this.responsiveColumns=signal(void 0);this.virtualScroll=signal(void 0);this.ariaLabel=signal(void 0);this.ariaLabelledBy=signal(void 0);this.workerSort=signal(false);this.showRowNumbers=signal(false);this.cellReferences=signal(false);this.formulasEnabled=signal(false);this.initialFormulas=signal(void 0);this.onFormulaRecalc=signal(void 0);this.formulaFunctions=signal(void 0);this.namedRanges=signal(void 0);this.sheets=signal(void 0);this.sheetDefs=signal(void 0);this.activeSheet=signal(void 0);this.onSheetChange=signal(void 0);this.onSheetAdd=signal(void 0);this.activeCellRef=signal(null);this.activeCellCoords=signal(null);this.handleActiveCellChange=e=>{if(this.activeCellRef.set(e),e){let t=e.match(/^([A-Z]+)(\d+)$/);t?this.activeCellCoords.set({col:columnLetterToIndex(t[1]),row:parseInt(t[2],10)-1}):this.activeCellCoords.set(null);}else this.activeCellCoords.set(null);};this.formulaBarEditing=signal(false);this.formulaBarEditText=signal("");this.formulaService=new ne;this.formulaVersion=signal(0);this.getFormulaValueFn=(e,t)=>this.formulaService.getValue(e,t);this.hasFormulaFn=(e,t)=>this.formulaService.hasFormula(e,t);this.getFormulaFn=(e,t)=>this.formulaService.getFormula(e,t);this.setFormulaFn=(e,t,n)=>this.formulaService.setFormula(e,t,n??"");this.onFormulaCellChangedFn=(e,t)=>this.formulaService.onCellChanged(e,t);this.getPrecedentsFn=(e,t)=>this.formulaService.getPrecedents(e,t);this.getDependentsFn=(e,t)=>this.formulaService.getDependents(e,t);this.getAuditTrailFn=(e,t)=>this.formulaService.getAuditTrail(e,t);this.internalData=signal([]);this.internalLoading=signal(false);this.internalPage=signal(1);this.internalPageSizeOverride=signal(null);this.internalSortOverride=signal(null);this.internalFilters=signal({});this.internalVisibleColumnsOverride=signal(null);this.internalSelectedRows=signal(new Set);this.columnWidthOverrides=signal({});this.pinnedOverrides=signal({});this.serverItems=signal([]);this.serverTotalCount=signal(0);this.serverLoading=signal(true);this.fetchAbortController=null;this.filterAbortController=null;this.refreshCounter=signal(0);this.firstDataRendered=signal(false);this.asyncClientItems=signal(null);this.workerSortAbortId=0;this.sideBarActivePanel=signal(null);this.serverFilterOptions=signal({});this.loadingFilterOptions=signal({});this.columns=computed(()=>flattenColumns(this.columnsProp()));this.isServerSide=computed(()=>this.dataSource()!=null);this.isClientSide=computed(()=>!this.isServerSide());this.displayData=computed(()=>this.data()??this.internalData());this.displayLoading=computed(()=>this.controlledLoading()??this.internalLoading());this.defaultSortField=computed(()=>this.defaultSortBy()??this.columns()[0]?.columnId??"");this.page=computed(()=>this.controlledPage()??this.internalPage());this.pageSize=computed(()=>this.controlledPageSize()??this.internalPageSizeOverride()??this.defaultPageSize());this.sort=computed(()=>this.controlledSort()??this.internalSortOverride()??{field:this.defaultSortField(),direction:this.defaultSortDirection()});this.filters=computed(()=>this.controlledFilters()??this.internalFilters());this.visibleColumns=computed(()=>{let e=this.controlledVisibleColumns();if(e)return e;let t=this.internalVisibleColumnsOverride();if(t)return t;let n=this.columns();if(n.length===0)return new Set;let i=n.filter(o=>o.defaultVisible!==false).map(o=>o.columnId);return new Set(i.length>0?i:n.map(o=>o.columnId))});this.effectiveSelectedRows=computed(()=>this.selectedRows()??this.internalSelectedRows());this.columnChooserPlacement=computed(()=>{let e=this.columnChooserProp();return e===false?"none":e==="sidebar"?"sidebar":"toolbar"});this.multiSelectFilterFields=computed(()=>getMultiSelectFilterFields(this.columns()));this.hasServerFilterOptions=computed(()=>this.dataSource()?.fetchFilterOptions!=null);this.clientFilterOptions=computed(()=>this.hasServerFilterOptions()?this.serverFilterOptions():deriveFilterOptionsFromData(this.displayData(),this.columns()));this.clientItemsAndTotal=computed(()=>{if(!this.isClientSide()||this.workerSort())return null;let e=processClientSideData(this.displayData(),this.columns(),this.filters(),this.sort().field,this.sort().direction),t=e.length,n=(this.page()-1)*this.pageSize();return {items:e.slice(n,n+this.pageSize()),totalCount:t}});this.resolvedClientItems=computed(()=>{let e=this.clientItemsAndTotal();return e||this.asyncClientItems()});this.displayItems=computed(()=>{let e=this.resolvedClientItems();return this.isClientSide()&&e?e.items:this.serverItems()});this.displayTotalCount=computed(()=>{let e=this.resolvedClientItems();return this.isClientSide()&&e?e.totalCount:this.serverTotalCount()});this.hasActiveFilters=computed(()=>Object.values(this.filters()).some(e=>e!==void 0));this.columnChooserColumns=computed(()=>this.columns().map(e=>({columnId:e.columnId,name:e.name,required:e.required===true})));this.statusBarConfig=computed(()=>{let e=this.statusBar();if(!e)return;if(typeof e=="object")return e;let t=this.isClientSide()?this.data()?.length??0:this.serverTotalCount(),n=this.displayTotalCount();return {totalCount:t,filteredCount:this.hasActiveFilters()?n:void 0,selectedCount:this.effectiveSelectedRows().size,suppressRowCount:true}});this.isLoadingResolved=computed(()=>this.isServerSide()&&this.serverLoading()||this.displayLoading());this.sideBarEnabled=computed(()=>{let e=this.sideBarConfig();return e!=null&&e!==false});this.sideBarParsed=computed(()=>{let e=this.sideBarConfig();if(!this.sideBarEnabled()||e===true)return {panels:ut,position:"right",defaultPanel:null};let t=e;return {panels:t.panels??ut,position:t.position??"right",defaultPanel:t.defaultPanel??null}});this.filterableColumns=computed(()=>this.columns().filter(e=>e.filterable&&e.filterable.type).map(e=>({columnId:e.columnId,name:e.name,filterField:e.filterable?.filterField??e.columnId,filterType:e.filterable?.type})));this.sideBarState=computed(()=>({isEnabled:this.sideBarEnabled(),activePanel:this.sideBarActivePanel(),setActivePanel:e=>this.sideBarActivePanel.set(e),panels:this.sideBarParsed().panels,position:this.sideBarParsed().position,isOpen:this.sideBarActivePanel()!==null,toggle:e=>this.sideBarActivePanel.update(t=>t===e?null:e),close:()=>this.sideBarActivePanel.set(null)}));this.formulaBarDisplayText=computed(()=>{let e=this.activeCellCoords();if(!e)return "";let t=this.formulaService.enabled()?(r,s)=>this.formulaService.getFormula(r,s):void 0,n=this.displayItems(),i=this.columns(),o=(r,s)=>{if(!(s<0||s>=n.length||r<0||r>=i.length))return getCellValue(n[s],i[r])};return deriveFormulaBarText(e.col,e.row,t,o)});this.formulaBarText=computed(()=>this.formulaBarEditing()?this.formulaBarEditText():this.formulaBarDisplayText());this.formulaBarReferences=computed(()=>extractFormulaReferences(this.formulaBarText()));this.formulaBarOnInputChangeFn=e=>{this.formulaBarEditText.set(e);};this.formulaBarOnCommitFn=()=>{this.commitFormulaBar();};this.formulaBarOnCancelFn=()=>{this.cancelFormulaBar();};this.formulaBarStartEditingFn=()=>{this.startFormulaBarEditing();};this.formulaBarState=computed(()=>({cellRef:this.activeCellRef(),formulaText:this.formulaBarText(),isEditing:this.formulaBarEditing(),onInputChange:this.formulaBarOnInputChangeFn,onCommit:this.formulaBarOnCommitFn,onCancel:this.formulaBarOnCancelFn,startEditing:this.formulaBarStartEditingFn,referencedCells:this.formulaBarReferences()}));this.handleSortFn=(e,t)=>this.handleSort(e,t);this.handleColumnResizedFn=(e,t)=>this.handleColumnResized(e,t);this.handleColumnPinnedFn=(e,t)=>this.handleColumnPinned(e,t);this.handleSelectionChangeFn=e=>this.handleSelectionChange(e);this.handleFilterChangeFn=(e,t)=>this.handleFilterChange(e,t);this.clearAllFiltersFn=()=>this.setFilters({});this.setPageFn=e=>this.setPage(e);this.setPageSizeFn=e=>this.setPageSize(e);this.handleVisibilityChangeFn=(e,t)=>this.handleVisibilityChange(e,t);this.dataGridProps=computed(()=>({items:this.displayItems(),columns:this.columnsProp(),getRowId:this.getRowId(),sortBy:this.sort().field,sortDirection:this.sort().direction,onColumnSort:this.handleSortFn,visibleColumns:this.visibleColumns(),columnOrder:this.columnOrder(),onColumnOrderChange:this.onColumnOrderChange(),onColumnResized:this.handleColumnResizedFn,onAutosizeColumn:this.onAutosizeColumn(),onColumnPinned:this.handleColumnPinnedFn,pinnedColumns:this.pinnedOverrides(),initialColumnWidths:this.columnWidthOverrides(),editable:this.editable(),cellSelection:this.cellSelection(),density:this.density(),rowHeight:this.rowHeight(),onCellValueChanged:this.onCellValueChanged(),onUndo:this.onUndo(),onRedo:this.onRedo(),canUndo:this.canUndo(),canRedo:this.canRedo(),rowSelection:this.rowSelection(),selectedRows:this.effectiveSelectedRows(),onSelectionChange:this.handleSelectionChangeFn,showRowNumbers:this.showRowNumbers()||this.cellReferences()||this.formulasEnabled(),showColumnLetters:!!(this.cellReferences()||this.formulasEnabled()),showNameBox:!!(this.cellReferences()&&!this.formulasEnabled()),onActiveCellChange:this.cellReferences()||this.formulasEnabled()?this.handleActiveCellChange:void 0,currentPage:this.page(),pageSize:this.pageSize(),statusBar:this.statusBarConfig(),isLoading:this.isLoadingResolved(),filters:this.filters(),onFilterChange:this.handleFilterChangeFn,filterOptions:this.clientFilterOptions(),loadingFilterOptions:this.dataSource()?.fetchFilterOptions?this.loadingFilterOptions():an,peopleSearch:this.dataSource()?.searchPeople?.bind(this.dataSource()),getUserByEmail:this.dataSource()?.getUserByEmail?.bind(this.dataSource()),layoutMode:this.layoutMode(),suppressHorizontalScroll:this.suppressHorizontalScroll(),stickyHeader:this.stickyHeader(),columnReorder:this.columnReorder(),responsiveColumns:this.responsiveColumns(),virtualScroll:this.virtualScroll(),"aria-label":this.ariaLabel(),"aria-labelledby":this.ariaLabelledBy(),emptyState:{hasActiveFilters:this.hasActiveFilters(),onClearAll:this.clearAllFiltersFn,message:this.emptyState()?.message,render:this.emptyState()?.render},formulas:this.formulasEnabled(),formulaVersion:this.formulaVersion(),formulaReferences:this.formulaBarReferences().length>0?this.formulaBarReferences():void 0,...this.formulaService.enabled()?{getFormulaValue:this.getFormulaValueFn,hasFormula:this.hasFormulaFn,getFormula:this.getFormulaFn,setFormula:this.setFormulaFn,onFormulaCellChanged:this.onFormulaCellChangedFn,getPrecedents:this.getPrecedentsFn,getDependents:this.getDependentsFn,getAuditTrail:this.getAuditTrailFn}:{}}));this.pagination=computed(()=>({page:this.page(),pageSize:this.pageSize(),displayTotalCount:this.displayTotalCount(),setPage:this.setPageFn,setPageSize:this.setPageSizeFn,pageSizeOptions:this.pageSizeOptions(),entityLabelPlural:this.entityLabelPlural()}));this.columnChooser=computed(()=>({columns:this.columnChooserColumns(),visibleColumns:this.visibleColumns(),onVisibilityChange:this.handleVisibilityChangeFn,placement:this.columnChooserPlacement()}));this.filtersResult=computed(()=>({hasActiveFilters:this.hasActiveFilters(),setFilters:e=>this.setFilters(e)}));this.sideBarProps=computed(()=>{let e=this.sideBarState();return e.isEnabled?{activePanel:e.activePanel,onPanelChange:e.setActivePanel,panels:e.panels,position:e.position,columns:this.columnChooserColumns(),visibleColumns:this.visibleColumns(),onVisibilityChange:(t,n)=>this.handleVisibilityChange(t,n),onSetVisibleColumns:t=>this.setVisibleColumns(t),filterableColumns:this.filterableColumns(),filters:this.filters(),onFilterChange:(t,n)=>this.handleFilterChange(t,n),filterOptions:this.clientFilterOptions()}:null});let e=false;effect(()=>{let n=this.columns();!e&&n.length>0&&(e=true,validateColumns(n));}),effect(n=>{if(!this.isClientSide()||!this.workerSort())return;let i=this.displayData(),o=this.columns(),r=this.filters(),s=this.sort().field,u=this.sort().direction,d=this.page(),c=this.pageSize(),m=++this.workerSortAbortId;processClientSideDataAsync(i,o,r,s,u).then(f=>{if(m!==this.workerSortAbortId)return;let b=f.length,R=(d-1)*c,v=f.slice(R,R+c);this.asyncClientItems.set({items:v,totalCount:b});}).catch(()=>{if(m!==this.workerSortAbortId)return;let f=processClientSideData(i,o,r,s,u),b=f.length,R=(d-1)*c,v=f.slice(R,R+c);this.asyncClientItems.set({items:v,totalCount:b});}),n(()=>{this.workerSortAbortId++;});}),effect(n=>{let i=this.dataSource();if(!this.isServerSide()||!i){this.isServerSide()||this.serverLoading.set(false);return}let o=this.page(),r=this.pageSize(),s=this.sort(),u=this.filters();this.refreshCounter();let d=new AbortController;this.fetchAbortController=d,this.serverLoading.set(true),i.fetchPage({page:o,pageSize:r,sort:{field:s.field,direction:s.direction},filters:u}).then(c=>{d.signal.aborted||(this.serverItems.set(c.items),this.serverTotalCount.set(c.totalCount));}).catch(c=>{d.signal.aborted||(this.onError()?.(c),this.serverItems.set([]),this.serverTotalCount.set(0));}).finally(()=>{d.signal.aborted||this.serverLoading.set(false);}),n(()=>{d.abort();});});let t=false;effect(()=>{let n=this.displayItems();!this.firstDataRendered()&&n.length>0&&(this.firstDataRendered.set(true),this.onFirstDataRendered()?.()),!t&&n.length>0&&(t=true,validateRowIds(n,this.getRowId()));}),effect(n=>{let i=this.dataSource(),o=this.multiSelectFilterFields(),r=i&&"fetchFilterOptions"in i&&typeof i.fetchFilterOptions=="function"?i.fetchFilterOptions.bind(i):void 0;if(!r||o.length===0){this.serverFilterOptions.set({}),this.loadingFilterOptions.set({});return}let s=new AbortController;this.filterAbortController=s;let u={};o.forEach(c=>{u[c]=true;}),this.loadingFilterOptions.set(u);let d={};Promise.all(o.map(async c=>{try{d[c]=await r(c);}catch{d[c]=[];}})).then(()=>{s.signal.aborted||(this.serverFilterOptions.set(d),this.loadingFilterOptions.set({}));}),n(()=>{s.abort();});}),effect(()=>{let n=this.sideBarParsed();n.defaultPanel&&this.sideBarActivePanel.set(n.defaultPanel);}),effect(()=>{this.activeCellCoords(),this.formulaBarEditing.set(false);}),effect(()=>{let n=this.onFormulaRecalc();this.formulaService.configure({formulas:this.formulasEnabled(),initialFormulas:this.initialFormulas(),formulaFunctions:this.formulaFunctions(),onFormulaRecalc:i=>{this.formulaVersion.update(o=>o+1),n?.(i);},namedRanges:this.namedRanges(),sheets:this.sheets()});}),effect(()=>{let n=this.displayItems(),i=this.columns();this.formulaService.setData(n,i);}),this.destroyRef.onDestroy(()=>{this.fetchAbortController?.abort(),this.filterAbortController?.abort(),this.fetchAbortController=null,this.filterAbortController=null,this.onPageChange.set(void 0),this.onPageSizeChange.set(void 0),this.onSortChange.set(void 0),this.onFiltersChange.set(void 0),this.onVisibleColumnsChange.set(void 0),this.onColumnOrderChange.set(void 0),this.onColumnResized.set(void 0),this.onAutosizeColumn.set(void 0),this.onColumnPinned.set(void 0),this.onCellValueChanged.set(void 0),this.onSelectionChange.set(void 0),this.onFirstDataRendered.set(void 0),this.onError.set(void 0),this.onUndo.set(void 0),this.onRedo.set(void 0);});}setPage(e){this.controlledPage()===void 0&&this.internalPage.set(e),this.onPageChange()?.(e);}setPageSize(e){this.controlledPageSize()===void 0&&this.internalPageSizeOverride.set(e),this.onPageSizeChange()?.(e),this.setPage(1);}setSort(e){this.controlledSort()===void 0&&this.internalSortOverride.set(e),this.onSortChange()?.(e),this.setPage(1);}setFilters(e){this.controlledFilters()===void 0&&this.internalFilters.set(e),this.onFiltersChange()?.(e),this.setPage(1);}setVisibleColumns(e){this.controlledVisibleColumns()===void 0&&this.internalVisibleColumnsOverride.set(e),this.onVisibleColumnsChange()?.(e);}handleSort(e,t){this.setSort(computeNextSortState(this.sort(),e,t));}handleFilterChange(e,t){this.setFilters(mergeFilter(this.filters(),e,t));}handleVisibilityChange(e,t){let n=new Set(this.visibleColumns());t?n.add(e):n.delete(e),this.setVisibleColumns(n);}handleSelectionChange(e){this.selectedRows()===void 0&&this.internalSelectedRows.set(new Set(e.selectedRowIds)),this.onSelectionChange()?.(e);}handleColumnResized(e,t){this.columnWidthOverrides.update(n=>({...n,[e]:t})),this.onColumnResized()?.(e,t);}handleColumnPinned(e,t){this.pinnedOverrides.update(n=>{if(t===null){let{[e]:i,...o}=n;return o}return {...n,[e]:t}}),this.onColumnPinned()?.(e,t);}startFormulaBarEditing(){this.formulaBarEditText.set(this.formulaBarDisplayText()),this.formulaBarEditing.set(true);}commitFormulaBar(){let e=this.activeCellCoords();if(!e)return;let t=this.formulaBarEditText().trim();t.startsWith("=")?(this.formulaService.setFormula(e.col,e.row,t),this.formulaVersion.update(n=>n+1)):(this.formulaService.setFormula(e.col,e.row,null),this.onCellValueChanged()?.({rowIndex:e.row,columnId:this.columns()[e.col]?.columnId??"",oldValue:void 0,newValue:t})),this.formulaBarEditing.set(false);}cancelFormulaBar(){this.formulaBarEditing.set(false),this.formulaBarEditText.set("");}configure(e){if(this.columnsProp.set(e.columns),Object.keys(this.pinnedOverrides()).length===0){let t={};for(let n of flattenColumns(e.columns))n.pinned&&(t[n.columnId]=n.pinned);Object.keys(t).length>0&&this.pinnedOverrides.set(t);}this.getRowId.set(e.getRowId),"data"in e&&e.data!==void 0&&this.data.set(e.data),"dataSource"in e&&e.dataSource!==void 0&&this.dataSource.set(e.dataSource),e.page!==void 0&&this.controlledPage.set(e.page),e.pageSize!==void 0&&this.controlledPageSize.set(e.pageSize),e.sort!==void 0&&this.controlledSort.set(e.sort),e.filters!==void 0&&this.controlledFilters.set(e.filters),e.visibleColumns!==void 0&&this.controlledVisibleColumns.set(e.visibleColumns),e.isLoading!==void 0&&this.controlledLoading.set(e.isLoading),e.onPageChange&&this.onPageChange.set(e.onPageChange),e.onPageSizeChange&&this.onPageSizeChange.set(e.onPageSizeChange),e.onSortChange&&this.onSortChange.set(e.onSortChange),e.onFiltersChange&&this.onFiltersChange.set(e.onFiltersChange),e.onVisibleColumnsChange&&this.onVisibleColumnsChange.set(e.onVisibleColumnsChange),e.columnOrder!==void 0&&this.columnOrder.set(e.columnOrder),e.onColumnOrderChange&&this.onColumnOrderChange.set(e.onColumnOrderChange),e.onColumnResized&&this.onColumnResized.set(e.onColumnResized),e.onAutosizeColumn&&this.onAutosizeColumn.set(e.onAutosizeColumn),e.onColumnPinned&&this.onColumnPinned.set(e.onColumnPinned),e.defaultPageSize!==void 0&&this.defaultPageSize.set(e.defaultPageSize),e.defaultSortBy!==void 0&&this.defaultSortBy.set(e.defaultSortBy),e.defaultSortDirection!==void 0&&this.defaultSortDirection.set(e.defaultSortDirection),e.editable!==void 0&&this.editable.set(e.editable),e.cellSelection!==void 0&&this.cellSelection.set(e.cellSelection),e.density!==void 0&&this.density.set(e.density),e.rowHeight!==void 0&&this.rowHeight.set(e.rowHeight),e.onCellValueChanged&&this.onCellValueChanged.set(e.onCellValueChanged),e.onUndo&&this.onUndo.set(e.onUndo),e.onRedo&&this.onRedo.set(e.onRedo),e.canUndo!==void 0&&this.canUndo.set(e.canUndo),e.canRedo!==void 0&&this.canRedo.set(e.canRedo),e.rowSelection!==void 0&&this.rowSelection.set(e.rowSelection),e.selectedRows!==void 0&&this.selectedRows.set(e.selectedRows),e.onSelectionChange&&this.onSelectionChange.set(e.onSelectionChange),e.statusBar!==void 0&&this.statusBar.set(e.statusBar),e.pageSizeOptions!==void 0&&this.pageSizeOptions.set(e.pageSizeOptions),e.sideBar!==void 0&&this.sideBarConfig.set(e.sideBar),e.onFirstDataRendered&&this.onFirstDataRendered.set(e.onFirstDataRendered),e.onError&&this.onError.set(e.onError),e.columnChooser!==void 0&&this.columnChooserProp.set(e.columnChooser),e.columnReorder!==void 0&&this.columnReorder.set(e.columnReorder),e.responsiveColumns!==void 0&&this.responsiveColumns.set(e.responsiveColumns),e.virtualScroll!==void 0&&this.virtualScroll.set(e.virtualScroll),e.workerSort!==void 0&&this.workerSort.set(e.workerSort),e.showRowNumbers!==void 0&&this.showRowNumbers.set(e.showRowNumbers),e.cellReferences!==void 0&&this.cellReferences.set(e.cellReferences),e.formulas!==void 0&&this.formulasEnabled.set(e.formulas),e.initialFormulas!==void 0&&this.initialFormulas.set(e.initialFormulas),e.onFormulaRecalc&&this.onFormulaRecalc.set(e.onFormulaRecalc),e.formulaFunctions!==void 0&&this.formulaFunctions.set(e.formulaFunctions),e.namedRanges!==void 0&&this.namedRanges.set(e.namedRanges),e.sheets!==void 0&&this.sheets.set(e.sheets),e.sheetDefs!==void 0&&this.sheetDefs.set(e.sheetDefs),e.activeSheet!==void 0&&this.activeSheet.set(e.activeSheet),e.onSheetChange&&this.onSheetChange.set(e.onSheetChange),e.onSheetAdd&&this.onSheetAdd.set(e.onSheetAdd),e.entityLabelPlural!==void 0&&this.entityLabelPlural.set(e.entityLabelPlural),e.className!==void 0&&this.className.set(e.className),e.layoutMode!==void 0&&this.layoutMode.set(e.layoutMode),e.suppressHorizontalScroll!==void 0&&this.suppressHorizontalScroll.set(e.suppressHorizontalScroll),e.stickyHeader!==void 0&&this.stickyHeader.set(e.stickyHeader),e.fullScreen!==void 0&&this.fullScreen.set(e.fullScreen),e["aria-label"]!==void 0&&this.ariaLabel.set(e["aria-label"]),e["aria-labelledby"]!==void 0&&this.ariaLabelledBy.set(e["aria-labelledby"]);}pinColumn(e,t){this.pinnedOverrides.update(n=>({...n,[e]:t})),this.onColumnPinned()?.(e,t);}unpinColumn(e){this.pinnedOverrides.update(t=>{let{[e]:n,...i}=t;return i}),this.onColumnPinned()?.(e,null);}isPinned(e){return this.pinnedOverrides()[e]}computeLeftOffsets(e,t,n,i,o){let r={},s=this.pinnedOverrides(),u=i?o:0;for(let d of e)s[d.columnId]==="left"&&(r[d.columnId]=u,u+=t[d.columnId]??n);return r}computeRightOffsets(e,t,n){let i={},o=this.pinnedOverrides(),r=0;for(let s=e.length-1;s>=0;s--){let u=e[s];o[u.columnId]==="right"&&(i[u.columnId]=r,r+=t[u.columnId]??n);}return i}getApi(){return {setRowData:e=>{this.isServerSide()||this.internalData.set(e);},setLoading:e=>this.internalLoading.set(e),getColumnState:()=>({visibleColumns:Array.from(this.visibleColumns()),sort:this.sort(),columnOrder:this.columnOrder()??void 0,columnWidths:Object.keys(this.columnWidthOverrides()).length>0?this.columnWidthOverrides():void 0,filters:Object.keys(this.filters()).length>0?this.filters():void 0,pinnedColumns:Object.keys(this.pinnedOverrides()).length>0?this.pinnedOverrides():void 0}),applyColumnState:e=>{e.visibleColumns&&this.setVisibleColumns(new Set(e.visibleColumns)),e.sort&&this.setSort(e.sort),e.columnOrder&&this.onColumnOrderChange()?.(e.columnOrder),e.columnWidths&&this.columnWidthOverrides.set(e.columnWidths),e.filters&&this.setFilters(e.filters),e.pinnedColumns&&this.pinnedOverrides.set(e.pinnedColumns);},setFilterModel:e=>this.setFilters(e),getSelectedRows:()=>Array.from(this.effectiveSelectedRows()),setSelectedRows:e=>{this.selectedRows()===void 0&&this.internalSelectedRows.set(new Set(e));},selectAll:()=>{let e=new Set(this.displayItems().map(t=>this.getRowId()(t)));this.selectedRows()===void 0&&this.internalSelectedRows.set(e),this.onSelectionChange()?.({selectedRowIds:Array.from(e),selectedItems:this.displayItems()});},deselectAll:()=>{this.selectedRows()===void 0&&this.internalSelectedRows.set(new Set),this.onSelectionChange()?.({selectedRowIds:[],selectedItems:[]});},clearFilters:()=>this.setFilters({}),clearSort:()=>this.setSort({field:this.defaultSortField(),direction:this.defaultSortDirection()}),resetGridState:e=>{this.setFilters({}),this.setSort({field:this.defaultSortField(),direction:this.defaultSortDirection()}),e?.keepSelection||(this.selectedRows()===void 0&&this.internalSelectedRows.set(new Set),this.onSelectionChange()?.({selectedRowIds:[],selectedItems:[]}));},getDisplayedRows:()=>this.displayItems(),refreshData:()=>{this.isServerSide()&&this.refreshCounter.update(e=>e+1);},getColumnOrder:()=>this.columnOrder()??this.columns().map(e=>e.columnId),setColumnOrder:e=>{this.onColumnOrderChange()?.(e);},scrollToRow:(e,t)=>{}}}};ie=l([Injectable()],ie);var Re=class{constructor(e,t,n){this.containerWidthSig=signal(0);this.columnSizingOverridesSig=signal({});this.resizeObserver=null;this.props=e,this.wrapperEl=t,this.initialColumnWidthsSig=computed(()=>this.props()?.initialColumnWidths),this.flatColumnsRaw=computed(()=>{let i=this.props();return i?flattenColumns(i.columns):[]}),this.flatColumns=computed(()=>{let i=this.flatColumnsRaw(),r=this.props()?.pinnedColumns;return !r||Object.keys(r).length===0?i:i.map(s=>{let u=r[s.columnId];return u&&s.pinned!==u?{...s,pinned:u}:s})}),this.visibleCols=computed(()=>{let i=this.props();if(!i)return [];let o=this.flatColumns(),r=i.visibleColumns?o.filter(d=>i.visibleColumns.has(d.columnId)):o,s,u=i.columnOrder;if(!u?.length)s=r;else {let d=new Map;for(let c=0;c<u.length;c++)d.set(u[c],c);s=[...r].sort((c,m)=>{let f=d.get(c.columnId)??-1,b=d.get(m.columnId)??-1;return f===-1&&b===-1?0:f===-1?1:b===-1?-1:f-b});}return applyResponsiveHiding(s,this.containerWidthSig(),resolveResponsiveConfig(i.responsiveColumns))}),this.visibleColumnCount=computed(()=>this.visibleCols().length),this.hasCheckboxCol=computed(()=>(this.props()?.rowSelection??"none")==="multiple"),this.hasRowNumbersCol=computed(()=>!!this.props()?.showRowNumbers),this.specialColsCount=computed(()=>(this.hasCheckboxCol()?1:0)+(this.hasRowNumbersCol()?1:0)),this.totalColCount=computed(()=>this.visibleColumnCount()+this.specialColsCount()),this.colOffset=computed(()=>this.specialColsCount()),this.rowIndexByRowId=computed(()=>{let i=this.props();if(!i)return new Map;let o=new Map;return i.items.forEach((r,s)=>o.set(i.getRowId(r),s)),o}),this.minTableWidth=computed(()=>{let i=this.hasCheckboxCol()?CHECKBOX_COLUMN_WIDTH:0;return this.visibleCols().reduce((o,r)=>o+(r.minWidth??DEFAULT_MIN_COLUMN_WIDTH)+CELL_PADDING,i)}),this.desiredTableWidth=computed(()=>{let i=this.hasCheckboxCol()?CHECKBOX_COLUMN_WIDTH:0,o=this.columnSizingOverridesSig();return this.visibleCols().reduce((r,s)=>{let u=o[s.columnId],d=u?u.widthPx:s.idealWidth??s.defaultWidth??s.minWidth??DEFAULT_MIN_COLUMN_WIDTH;return r+Math.max(s.minWidth??DEFAULT_MIN_COLUMN_WIDTH,d)+CELL_PADDING},i)}),effect(()=>{let i=this.initialColumnWidthsSig();if(i){let o={};for(let[r,s]of Object.entries(i))o[r]={widthPx:s};this.columnSizingOverridesSig.set(o);}}),effect(()=>{let i=this.wrapperEl();if(this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),!i)return;let o=()=>{let r=i.getBoundingClientRect(),s=window.getComputedStyle(i),u=(parseFloat(s.borderLeftWidth||"0")||0)+(parseFloat(s.borderRightWidth||"0")||0);this.containerWidthSig.set(Math.max(0,r.width-u));};n.runOutsideAngular(()=>{this.resizeObserver=new ResizeObserver(o),this.resizeObserver.observe(i);}),o();}),effect(()=>{let i=new Set(this.flatColumns().map(o=>o.columnId));this.columnSizingOverridesSig.update(o=>{let r={},s=false;for(let[u,d]of Object.entries(o))i.has(u)?r[u]=d:s=true;return s?r:o});});}destroy(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null);}};var we=class{constructor(e,t,n,i,o,r){this.editingCellSig=signal(null);this.pendingEditorValueSig=signal(void 0);this.popoverAnchorElSig=signal(null);this.getVisibleCols=e,this.getItems=t,this.getWrappedOnCellValueChanged=n,this.setActiveCellFn=i,this.setSelectionRangeFn=o,this.getColOffset=r;}setEditingCell(e){this.editingCellSig.set(e);}setPendingEditorValue(e){this.pendingEditorValueSig.set(e);}commitCellEdit(e,t,n,i,o,r){let s=this.getVisibleCols().find(c=>c.columnId===t);if(s){let c=parseValue(i,n,e,s);if(!c.valid){this.editingCellSig.set(null),this.popoverAnchorElSig.set(null),this.pendingEditorValueSig.set(void 0);return}i=c.value;}this.getWrappedOnCellValueChanged()?.({item:e,columnId:t,oldValue:n,newValue:i,rowIndex:o}),this.editingCellSig.set(null),this.popoverAnchorElSig.set(null),this.pendingEditorValueSig.set(void 0);let d=this.getItems();if(o<d.length-1){let c=o+1,m=r-this.getColOffset();this.setActiveCellFn({rowIndex:c,columnIndex:r}),this.setSelectionRangeFn({startRow:c,startCol:m,endRow:c,endCol:m});}}cancelPopoverEdit(){this.editingCellSig.set(null),this.popoverAnchorElSig.set(null),this.pendingEditorValueSig.set(void 0);}};var Ie=class{constructor(){this.activeCellSig=signal(null);this.selectionRangeSig=signal(null);this.isDraggingSig=signal(false);this.contextMenuPositionSig=signal(null);this.cutRangeSig=signal(null);this.copyRangeSig=signal(null);this.internalClipboard=null;this.undoRedoStack=new UndoRedoStack(100);this.undoLengthSig=signal(0);this.redoLengthSig=signal(0);this.canUndo=computed(()=>this.undoLengthSig()>0);this.canRedo=computed(()=>this.redoLengthSig()>0);this.hasCellSelection=computed(()=>this.selectionRangeSig()!=null||this.activeCellSig()!=null);this.fillDragStart=null;this.fillRafId=0;this.fillMoveHandler=null;this.fillUpHandler=null;this.dragStartPos=null;this.dragMoved=false;this.isDraggingRef=false;this.liveDragRange=null;this.rafId=0;this.lastMousePos=null;this.autoScrollInterval=null;}setActiveCell(e){let t=this.activeCellSig();t!==e&&(t&&e&&t.rowIndex===e.rowIndex&&t.columnIndex===e.columnIndex||this.activeCellSig.set(e));}setSelectionRange(e){let t=this.selectionRangeSig();rangesEqual(t,e)||this.selectionRangeSig.set(e);}setContextMenuPosition(e){this.contextMenuPositionSig.set(e);}handleCellContextMenu(e){e.preventDefault?.(),this.contextMenuPositionSig.set({x:e.clientX,y:e.clientY});}closeContextMenu(){this.contextMenuPositionSig.set(null);}handleCopy(e,t,n){let i=this.getEffectiveRange(n);if(i==null)return;let o=normalizeSelectionRange(i),r=formatSelectionAsTsv(e,t,o);this.internalClipboard=r,this.copyRangeSig.set(o),navigator.clipboard.writeText(r).catch(()=>{});}handleCut(e,t,n,i,o){if(i===false)return;let r=this.getEffectiveRange(n);if(r==null||!o)return;let s=normalizeSelectionRange(r);this.cutRangeSig.set(s),this.copyRangeSig.set(null),this.handleCopy(e,t,n),this.copyRangeSig.set(null);}async handlePaste(e,t,n,i,o){if(i===false||!o)return;let r;try{r=await navigator.clipboard.readText();}catch{r="";}if(!r.trim()&&this.internalClipboard!=null&&(r=this.internalClipboard),!r.trim())return;let s=this.getEffectiveRange(n),u=s?s.startRow:0,d=s?s.startCol:0,c=parseTsvClipboard(r);this.beginBatch();for(let f=0;f<c.length;f++){let b=c[f];for(let R=0;R<b.length;R++){let v=u+f,V=d+R;if(v>=e.length||V>=t.length)continue;let D=e[v],C=t[V];if(!(C.editable===true||typeof C.editable=="function"&&C.editable(D)))continue;let _=b[R]??"",O=getCellValue(D,C),w=parseValue(_,O,D,C);w.valid&&o({item:D,columnId:C.columnId,oldValue:O,newValue:w.value,rowIndex:v});}}let m=this.cutRangeSig();if(m){for(let f=m.startRow;f<=m.endRow;f++)for(let b=m.startCol;b<=m.endCol;b++){if(f>=e.length||b>=t.length)continue;let R=e[f],v=t[b];if(!(v.editable===true||typeof v.editable=="function"&&v.editable(R)))continue;let D=getCellValue(R,v),C=parseValue("",D,R,v);C.valid&&o({item:R,columnId:v.columnId,oldValue:D,newValue:C.value,rowIndex:f});}this.cutRangeSig.set(null);}this.endBatch(),this.copyRangeSig.set(null);}clearClipboardRanges(){this.copyRangeSig.set(null),this.cutRangeSig.set(null);}beginBatch(){this.undoRedoStack.beginBatch();}endBatch(){this.undoRedoStack.endBatch(),this.undoLengthSig.set(this.undoRedoStack.historyLength),this.redoLengthSig.set(this.undoRedoStack.redoLength);}undo(e){if(!e)return;let t=this.undoRedoStack.undo();if(t){this.undoLengthSig.set(this.undoRedoStack.historyLength),this.redoLengthSig.set(this.undoRedoStack.redoLength);for(let n=t.length-1;n>=0;n--){let i=t[n];e({...i,oldValue:i.newValue,newValue:i.oldValue});}}}redo(e){if(!e)return;let t=this.undoRedoStack.redo();if(t){this.undoLengthSig.set(this.undoRedoStack.historyLength),this.redoLengthSig.set(this.undoRedoStack.redoLength);for(let n of t)e(n);}}handleCellMouseDown(e,t,n,i,o){if(e.button!==0||(o?.focus({preventScroll:true}),this.clearClipboardRanges(),n<i))return;e.preventDefault();let r=n-i,s=this.selectionRangeSig();if(e.shiftKey&&s!=null)this.setSelectionRange(normalizeSelectionRange({startRow:s.startRow,startCol:s.startCol,endRow:t,endCol:r})),this.setActiveCell({rowIndex:t,columnIndex:n});else {this.dragStartPos={row:t,col:r},this.dragMoved=false;let u={startRow:t,startCol:r,endRow:t,endCol:r};this.setSelectionRange(u),this.liveDragRange=u,this.setActiveCell({rowIndex:t,columnIndex:n}),this.isDraggingRef=true;}}handleSelectAllCells(e,t,n){e===0||t===0||(this.setSelectionRange({startRow:0,startCol:0,endRow:e-1,endCol:t-1}),this.setActiveCell({rowIndex:0,columnIndex:n}));}handleFillHandleMouseDown(e){e.preventDefault(),e.stopPropagation();let t=this.selectionRangeSig();t&&(this.fillDragStart={startRow:t.startRow,startCol:t.startCol});}handleGridKeyDown(e,t,n,i,o,r,s,u,d,c,m,f,b,R,v,V,D){if(D&&(D(e),e.defaultPrevented))return;let C=this.activeCellSig(),I=this.selectionRangeSig(),_=t.length-1,O=s-1+o;if(t.length===0)return;if(C===null){["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Tab","Enter","Home","End","PageDown","PageUp"].includes(e.key)&&(this.setActiveCell({rowIndex:0,columnIndex:o}),e.preventDefault());return}let{rowIndex:w,columnIndex:G}=C,x=G-o,Se=e.shiftKey,B=e.ctrlKey||e.metaKey,Ae=(g,y)=>{if(g<0||g>=t.length||y<0||y>=i.length)return true;let P=getCellValue(t[g],i[y]);return P==null||P===""},ke=findCtrlArrowTarget;switch(e.key){case "c":if(B){if(v!=null)break;e.preventDefault(),this.handleCopy(t,i,o);}break;case "x":if(B){if(v!=null)break;e.preventDefault(),this.handleCut(t,i,o,u,d);}break;case "v":if(B){if(v!=null)break;e.preventDefault(),this.handlePaste(t,i,o,u,d);}break;case "d":if(B){if(v!=null)break;if(u!==false&&d!=null){let g=I??(C!=null?{startRow:C.rowIndex,startCol:C.columnIndex-o,endRow:C.rowIndex,endCol:C.columnIndex-o}:null);if(g!=null){e.preventDefault();let y=normalizeSelectionRange(g),P=applyFillValues(y,y.startRow,y.startCol,t,i);if(P.length>0){this.undoRedoStack.beginBatch();for(let te of P)d(te);this.undoRedoStack.endBatch(),this.undoLengthSig.set(this.undoRedoStack.historyLength),this.redoLengthSig.set(this.undoRedoStack.redoLength);}}}}break;case "ArrowDown":{if(v!=null)break;e.preventDefault();let g=B?ke(w,_,1,y=>Ae(y,Math.max(0,x))):Math.min(w+1,_);Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:g,endCol:I?.endCol??x})):this.setSelectionRange({startRow:g,startCol:x,endRow:g,endCol:x}),this.setActiveCell({rowIndex:g,columnIndex:G});break}case "ArrowUp":{if(v!=null)break;e.preventDefault();let g=B?ke(w,0,-1,y=>Ae(y,Math.max(0,x))):Math.max(w-1,0);Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:g,endCol:I?.endCol??x})):this.setSelectionRange({startRow:g,startCol:x,endRow:g,endCol:x}),this.setActiveCell({rowIndex:g,columnIndex:G});break}case "ArrowRight":{if(v!=null)break;e.preventDefault();let g;B&&x>=0?g=ke(x,i.length-1,1,P=>Ae(w,P))+o:g=Math.min(G+1,O);let y=g-o;Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:I?.endRow??w,endCol:y})):this.setSelectionRange({startRow:w,startCol:y,endRow:w,endCol:y}),this.setActiveCell({rowIndex:w,columnIndex:g});break}case "ArrowLeft":{if(v!=null)break;e.preventDefault();let g;B&&x>=0?g=ke(x,0,-1,P=>Ae(w,P))+o:g=Math.max(G-1,o);let y=g-o;Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:I?.endRow??w,endCol:y})):this.setSelectionRange({startRow:w,startCol:y,endRow:w,endCol:y}),this.setActiveCell({rowIndex:w,columnIndex:g});break}case "Tab":{e.preventDefault();let g=computeTabNavigation(w,G,_,O,o,e.shiftKey),y=g.columnIndex-o;this.setSelectionRange({startRow:g.rowIndex,startCol:y,endRow:g.rowIndex,endCol:y}),this.setActiveCell({rowIndex:g.rowIndex,columnIndex:g.columnIndex});break}case "Home":{e.preventDefault();let g=B?0:w;this.setSelectionRange({startRow:g,startCol:0,endRow:g,endCol:0}),this.setActiveCell({rowIndex:g,columnIndex:o});break}case "End":{e.preventDefault();let g=B?_:w;this.setSelectionRange({startRow:g,startCol:s-1,endRow:g,endCol:s-1}),this.setActiveCell({rowIndex:g,columnIndex:O});break}case "PageDown":case "PageUp":{e.preventDefault();let g=10,y=36;if(b){let Ue=b.querySelector("tbody tr");Ue&&Ue.offsetHeight>0&&(y=Ue.offsetHeight,g=Math.max(1,Math.floor(b.clientHeight/y)));}let P=e.key==="PageDown"?1:-1,te=Math.max(0,Math.min(w+P*g,_));Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:te,endCol:I?.endCol??x})):this.setSelectionRange({startRow:te,startCol:x,endRow:te,endCol:x}),this.setActiveCell({rowIndex:te,columnIndex:G}),b&&(b.scrollTop=getScrollTopForRow(te,y,b.clientHeight,"center"));break}case "Enter":case "F2":{if(e.preventDefault(),x>=0&&x<i.length){let g=i[x],y=t[w];if(y&&g){let P=g.editable===true||typeof g.editable=="function"&&g.editable(y);u!==false&&P&&d!=null&&V({rowId:n(y),columnId:g.columnId});}}break}case "Escape":e.preventDefault(),v!=null?V(null):(this.clearClipboardRanges(),this.setActiveCell(null),this.setSelectionRange(null));break;case " ":if(m!=="none"&&G===0&&r){e.preventDefault();let g=t[w];if(g){let y=n(g),P=f.has(y);R(y,!P,w,e.shiftKey);}}break;case "z":B&&v==null&&(e.shiftKey?(e.preventDefault(),this.redo(c)):(e.preventDefault(),this.undo(c)));break;case "y":B&&v==null&&(e.preventDefault(),this.redo(c));break;case "a":if(B){if(v!=null)break;e.preventDefault(),t.length>0&&s>0&&(this.setSelectionRange({startRow:0,startCol:0,endRow:t.length-1,endCol:s-1}),this.setActiveCell({rowIndex:0,columnIndex:o}));}break;case "Delete":case "Backspace":{if(v!=null||u===false||d==null)break;let g=I??(C!=null?{startRow:C.rowIndex,startCol:C.columnIndex-o,endRow:C.rowIndex,endCol:C.columnIndex-o}:null);if(g==null)break;e.preventDefault();let y=applyCellDeletion(normalizeSelectionRange(g),t,i);for(let P of y)d(P);break}case "F10":if(e.shiftKey)if(e.preventDefault(),C!=null&&b){let g=`[data-row-index="${C.rowIndex}"][data-col-index="${C.columnIndex}"]`,y=b.querySelector(g);if(y){let P=y.getBoundingClientRect();this.setContextMenuPosition({x:P.left+P.width/2,y:P.top+P.height/2});}else this.setContextMenuPosition({x:100,y:100});}else this.setContextMenuPosition({x:100,y:100});break;}}onWindowMouseMove(e,t,n){!this.isDraggingRef||!this.dragStartPos||(this.dragMoved||(this.dragMoved=true,this.isDraggingSig.set(true)),this.lastMousePos={cx:e.clientX,cy:e.clientY},this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=0;let i=this.lastMousePos;if(!i)return;let o=this.resolveRangeFromMouse(i.cx,i.cy,t);if(!o)return;let r=this.liveDragRange;r&&r.startRow===o.startRow&&r.startCol===o.startCol&&r.endRow===o.endRow&&r.endCol===o.endCol||(this.liveDragRange=o,this.applyDragAttrs(o,t,n));}));}onWindowMouseUp(e,t){if(!this.isDraggingRef)return;this.autoScrollInterval&&(clearInterval(this.autoScrollInterval),this.autoScrollInterval=null),this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=0),this.isDraggingRef=false;let n=this.dragMoved;if(n){let i=this.lastMousePos;if(i){let r=this.resolveRangeFromMouse(i.cx,i.cy,e);r&&(this.liveDragRange=r);}let o=this.liveDragRange;if(o){this.setSelectionRange(o);let r=this.dragStartPos;r&&this.setActiveCell({rowIndex:r.row,columnIndex:r.col+e});}}this.clearDragAttrs(t),this.liveDragRange=null,this.lastMousePos=null,this.dragStartPos=null,n&&this.isDraggingSig.set(false);}resolveRangeFromMouse(e,t,n){if(!this.dragStartPos)return null;let o=document.elementFromPoint(e,t)?.closest?.("[data-row-index][data-col-index]");if(!o)return null;let r=parseInt(o.getAttribute("data-row-index")??"",10),s=parseInt(o.getAttribute("data-col-index")??"",10);if(Number.isNaN(r)||Number.isNaN(s)||s<n)return null;let u=s-n,d=this.dragStartPos;return normalizeSelectionRange({startRow:d.row,startCol:d.col,endRow:r,endCol:u})}applyDragAttrs(e,t,n){if(!n)return;let i=Math.min(e.startRow,e.endRow),o=Math.max(e.startRow,e.endRow),r=Math.min(e.startCol,e.endCol),s=Math.max(e.startCol,e.endCol),u=n.querySelectorAll("[data-row-index][data-col-index]");for(let d=0;d<u.length;d++){let c=u[d],m=parseInt(c.getAttribute("data-row-index")??"",10),f=parseInt(c.getAttribute("data-col-index")??"",10)-t;m>=i&&m<=o&&f>=r&&f<=s?c.hasAttribute("data-drag-range")||c.setAttribute("data-drag-range",""):c.hasAttribute("data-drag-range")&&c.removeAttribute("data-drag-range");}}clearDragAttrs(e){if(!e)return;let t=e.querySelectorAll("[data-drag-range]");for(let n=0;n<t.length;n++)t[n].removeAttribute("data-drag-range");}getEffectiveRange(e){let t=this.selectionRangeSig(),n=this.activeCellSig();return t??(n!=null?{startRow:n.rowIndex,startCol:n.columnIndex-e,endRow:n.rowIndex,endCol:n.columnIndex-e}:null)}destroy(){this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=0),this.fillRafId&&(cancelAnimationFrame(this.fillRafId),this.fillRafId=0),this.autoScrollInterval&&(clearInterval(this.autoScrollInterval),this.autoScrollInterval=null),this.fillMoveHandler&&(window.removeEventListener("pointermove",this.fillMoveHandler,true),this.fillMoveHandler=null),this.fillUpHandler&&(window.removeEventListener("pointerup",this.fillUpHandler,true),this.fillUpHandler=null),this.undoRedoStack.clear();}};var xe=()=>{},Tn=async()=>{},Fn=(p,e,t)=>{},On=p=>{},An=p=>{},oe=class{constructor(){this.destroyRef=inject(DestroyRef);this.ngZone=inject(NgZone);this.props=signal(null);this.wrapperEl=signal(null);this.internalSelectedRows=signal(new Set);this.lastClickedRow=-1;this.headerMenuIsOpenSig=signal(false);this.headerMenuOpenForColumnSig=signal(null);this.headerMenuAnchorElementSig=signal(null);this.propsResolved=computed(()=>{let e=this.props();if(!e)throw new Error("DataGridStateService: props must be set before use");return e});this.cellSelection=computed(()=>{let e=this.props();return e?e.cellSelection!==false:true});this.originalOnCellValueChanged=computed(()=>this.props()?.onCellValueChanged);this.wrappedOnCellValueChanged=computed(()=>{let e=this.originalOnCellValueChanged();if(e)return t=>{this.interactionHelper.undoRedoStack.record(t),this.interactionHelper.undoRedoStack.isBatching||(this.interactionHelper.undoLengthSig.set(this.interactionHelper.undoRedoStack.historyLength),this.interactionHelper.redoLengthSig.set(this.interactionHelper.undoRedoStack.redoLength)),e(t);}});this.flatColumnsRaw=computed(()=>this.layoutHelper.flatColumnsRaw());this.flatColumns=computed(()=>this.layoutHelper.flatColumns());this.visibleCols=computed(()=>this.layoutHelper.visibleCols());this.visibleColumnCount=computed(()=>this.layoutHelper.visibleColumnCount());this.hasCheckboxCol=computed(()=>this.layoutHelper.hasCheckboxCol());this.hasRowNumbersCol=computed(()=>this.layoutHelper.hasRowNumbersCol());this.specialColsCount=computed(()=>this.layoutHelper.specialColsCount());this.totalColCount=computed(()=>this.layoutHelper.totalColCount());this.colOffset=computed(()=>this.layoutHelper.colOffset());this.rowIndexByRowId=computed(()=>this.layoutHelper.rowIndexByRowId());this.selectedRowIds=computed(()=>{let e=this.props();if(!e)return new Set;let t=e.selectedRows;return t!=null?t instanceof Set?t:new Set(t):this.internalSelectedRows()});this.allSelected=computed(()=>{let e=this.props();if(!e||e.items.length===0)return false;let t=this.selectedRowIds();return t.size!==e.items.length?false:e.items.every(n=>t.has(e.getRowId(n)))});this.someSelected=computed(()=>{let e=this.props();if(!e)return false;let t=this.selectedRowIds();return !this.allSelected()&&e.items.some(n=>t.has(e.getRowId(n)))});this.hasCellSelection=computed(()=>this.interactionHelper.hasCellSelection());this.canUndo=computed(()=>this.interactionHelper.canUndo());this.canRedo=computed(()=>this.interactionHelper.canRedo());this.minTableWidth=computed(()=>this.layoutHelper.minTableWidth());this.desiredTableWidth=computed(()=>this.layoutHelper.desiredTableWidth());this.aggregation=computed(()=>{let e=this.props();return e?computeAggregations(e.items,this.visibleCols(),this.cellSelection()?this.interactionHelper.selectionRangeSig():null):null});this.statusBarConfig=computed(()=>{let e=this.props();if(!e)return null;let t=getDataGridStatusBarConfig(e.statusBar,e.items.length,this.selectedRowIds().size);return t?{...t,aggregation:this.aggregation()??void 0}:null});this.showEmptyInGrid=computed(()=>{let e=this.props();return e?e.items.length===0&&!!e.emptyState&&!e.isLoading:false});this._setColumnSizingOverrides=e=>this.layoutHelper.columnSizingOverridesSig.set(e);this._updateSelection=e=>this.updateSelection(e);this._handleRowCheckboxChange=(e,t,n,i)=>this.handleRowCheckboxChange(e,t,n,i);this._handleSelectAll=e=>this.handleSelectAll(e);this._setEditingCell=e=>this.setEditingCell(e);this._setPendingEditorValue=e=>this.setPendingEditorValue(e);this._commitCellEdit=(e,t,n,i,o,r)=>this.commitCellEdit(e,t,n,i,o,r);this._cancelPopoverEdit=()=>this.cancelPopoverEdit();this._setPopoverAnchorEl=e=>this.editingHelper.popoverAnchorElSig.set(e);this._setActiveCell=e=>this.setActiveCell(e);this._setSelectionRange=e=>this.setSelectionRange(e);this._handleCellMouseDown=(e,t,n)=>this.handleCellMouseDown(e,t,n);this._handleSelectAllCells=()=>this.handleSelectAllCells();this._handleGridKeyDown=e=>this.handleGridKeyDown(e);this._handleFillHandleMouseDown=e=>this.handleFillHandleMouseDown(e);this._handleCopy=()=>this.handleCopy();this._handleCut=()=>this.handleCut();this._handlePaste=()=>this.handlePaste();this._clearClipboardRanges=()=>this.clearClipboardRanges();this._onUndo=()=>this.undo();this._onRedo=()=>this.redo();this._setContextMenuPosition=e=>this.setContextMenuPosition(e);this._handleCellContextMenu=e=>this.handleCellContextMenu(e);this._closeContextMenu=()=>this.closeContextMenu();this._headerFilterOnColumnSort=(e,t)=>this.props()?.onColumnSort(e,t);this._headerFilterOnFilterChange=(e,t)=>this.props()?.onFilterChange(e,t);this._pinColumn=(e,t)=>this.pinColumn(e,t);this._unpinColumn=e=>this.unpinColumn(e);this._isPinned=e=>this.isPinned(e);this._openHeaderMenu=(e,t)=>this.openHeaderMenu(e,t);this._closeHeaderMenu=()=>this.closeHeaderMenu();this._headerMenuPinLeft=()=>this.headerMenuPinLeft();this._headerMenuPinRight=()=>this.headerMenuPinRight();this._headerMenuUnpin=()=>this.headerMenuUnpin();this.layoutHelper=new Re(this.props,this.wrapperEl,this.ngZone),this.interactionHelper=new Ie,this.editingHelper=new we(()=>this.visibleCols(),()=>this.props()?.items??[],()=>this.wrappedOnCellValueChanged(),e=>this.setActiveCell(e),e=>this.setSelectionRange(e),()=>this.colOffset()),effect(e=>{let t=i=>this.onWindowMouseMove(i),n=()=>this.onWindowMouseUp();this.ngZone.runOutsideAngular(()=>{window.addEventListener("pointermove",t,true),window.addEventListener("pointerup",n,true);}),e(()=>{window.removeEventListener("pointermove",t,true),window.removeEventListener("pointerup",n,true);});}),this.destroyRef.onDestroy(()=>{this.interactionHelper.destroy(),this.layoutHelper.destroy();});}updateSelection(e){let t=this.props();t&&(t.selectedRows===void 0&&this.internalSelectedRows.set(e),t.onSelectionChange?.({selectedRowIds:Array.from(e),selectedItems:t.items.filter(n=>e.has(t.getRowId(n)))}));}handleRowCheckboxChange(e,t,n,i){let o=this.props();if(!o)return;if((o.rowSelection??"none")==="single"){this.updateSelection(t?new Set([e]):new Set),this.lastClickedRow=n;return}let s=new Set(this.selectedRowIds());if(i&&this.lastClickedRow>=0&&this.lastClickedRow!==n){let u=Math.min(this.lastClickedRow,n),d=Math.max(this.lastClickedRow,n);for(let c=u;c<=d;c++)if(c<o.items.length){let m=o.getRowId(o.items[c]);t?s.add(m):s.delete(m);}}else t?s.add(e):s.delete(e);this.lastClickedRow=n,this.updateSelection(s);}handleSelectAll(e){let t=this.props();t&&(e?this.updateSelection(new Set(t.items.map(n=>t.getRowId(n)))):this.updateSelection(new Set));}setEditingCell(e){this.editingHelper.setEditingCell(e);}setPendingEditorValue(e){this.editingHelper.setPendingEditorValue(e);}setActiveCell(e){this.interactionHelper.setActiveCell(e);}setSelectionRange(e){this.interactionHelper.setSelectionRange(e);}commitCellEdit(e,t,n,i,o,r){this.editingHelper.commitCellEdit(e,t,n,i,o,r);}cancelPopoverEdit(){this.editingHelper.cancelPopoverEdit();}handleCellMouseDown(e,t,n){this.interactionHelper.handleCellMouseDown(e,t,n,this.colOffset(),this.wrapperEl());}handleSelectAllCells(){let e=this.props();e&&this.interactionHelper.handleSelectAllCells(e.items.length,this.visibleColumnCount(),this.colOffset());}setContextMenuPosition(e){this.interactionHelper.setContextMenuPosition(e);}handleCellContextMenu(e){this.interactionHelper.handleCellContextMenu(e);}closeContextMenu(){this.interactionHelper.closeContextMenu();}handleCopy(){let e=this.props();e&&this.interactionHelper.handleCopy(e.items,this.visibleCols(),this.colOffset());}handleCut(){let e=this.props();e&&this.interactionHelper.handleCut(e.items,this.visibleCols(),this.colOffset(),e.editable,this.wrappedOnCellValueChanged());}async handlePaste(){let e=this.props();e&&await this.interactionHelper.handlePaste(e.items,this.visibleCols(),this.colOffset(),e.editable,this.wrappedOnCellValueChanged());}clearClipboardRanges(){this.interactionHelper.clearClipboardRanges();}beginBatch(){this.interactionHelper.beginBatch();}endBatch(){this.interactionHelper.endBatch();}undo(){let e=this.props();this.interactionHelper.undo(e?.onCellValueChanged);}redo(){let e=this.props();this.interactionHelper.redo(e?.onCellValueChanged);}handleGridKeyDown(e){let t=this.props();t&&this.interactionHelper.handleGridKeyDown(e,t.items,t.getRowId,this.visibleCols(),this.colOffset(),this.hasCheckboxCol(),this.visibleColumnCount(),t.editable,this.wrappedOnCellValueChanged(),t.onCellValueChanged,t.rowSelection??"none",this.selectedRowIds(),this.wrapperEl(),(n,i,o,r)=>this.handleRowCheckboxChange(n,i,o,r),this.editingHelper.editingCellSig(),n=>this.setEditingCell(n),t.onKeyDown);}handleFillHandleMouseDown(e){this.interactionHelper.handleFillHandleMouseDown(e),this.setupFillHandleDrag();}pinColumn(e,t){this.props()?.onColumnPinned?.(e,t);}unpinColumn(e){this.props()?.onColumnPinned?.(e,null);}isPinned(e){return this.props()?.pinnedColumns?.[e]}getPinState(e){let t=this.isPinned(e);return {canPinLeft:t!=="left",canPinRight:t!=="right",canUnpin:!!t}}openHeaderMenu(e,t){this.headerMenuOpenForColumnSig.set(e),this.headerMenuAnchorElementSig.set(t),this.headerMenuIsOpenSig.set(true);}closeHeaderMenu(){this.headerMenuIsOpenSig.set(false),this.headerMenuOpenForColumnSig.set(null),this.headerMenuAnchorElementSig.set(null);}headerMenuPinLeft(){let e=this.headerMenuOpenForColumnSig();e&&this.isPinned(e)!=="left"&&(this.pinColumn(e,"left"),this.closeHeaderMenu());}headerMenuPinRight(){let e=this.headerMenuOpenForColumnSig();e&&this.isPinned(e)!=="right"&&(this.pinColumn(e,"right"),this.closeHeaderMenu());}headerMenuUnpin(){let e=this.headerMenuOpenForColumnSig();e&&this.isPinned(e)&&(this.unpinColumn(e),this.closeHeaderMenu());}getState(){let e=this.props(),t=this.cellSelection(),n={flatColumns:this.flatColumns(),visibleCols:this.visibleCols(),visibleColumnCount:this.visibleColumnCount(),totalColCount:this.totalColCount(),colOffset:this.colOffset(),hasCheckboxCol:this.hasCheckboxCol(),hasRowNumbersCol:this.hasRowNumbersCol(),rowIndexByRowId:this.rowIndexByRowId(),containerWidth:this.layoutHelper.containerWidthSig(),minTableWidth:this.minTableWidth(),desiredTableWidth:this.desiredTableWidth(),columnSizingOverrides:this.layoutHelper.columnSizingOverridesSig(),setColumnSizingOverrides:this._setColumnSizingOverrides,onColumnResized:e?.onColumnResized,onAutosizeColumn:e?.onAutosizeColumn},i={selectedRowIds:this.selectedRowIds(),updateSelection:this._updateSelection,handleRowCheckboxChange:this._handleRowCheckboxChange,handleSelectAll:this._handleSelectAll,allSelected:this.allSelected(),someSelected:this.someSelected()},o={editingCell:this.editingHelper.editingCellSig(),setEditingCell:this._setEditingCell,pendingEditorValue:this.editingHelper.pendingEditorValueSig(),setPendingEditorValue:this._setPendingEditorValue,commitCellEdit:this._commitCellEdit,cancelPopoverEdit:this._cancelPopoverEdit,popoverAnchorEl:this.editingHelper.popoverAnchorElSig(),setPopoverAnchorEl:this._setPopoverAnchorEl},r={activeCell:t?this.interactionHelper.activeCellSig():null,setActiveCell:t?this._setActiveCell:void 0,selectionRange:t?this.interactionHelper.selectionRangeSig():null,setSelectionRange:t?this._setSelectionRange:void 0,handleCellMouseDown:t?this._handleCellMouseDown:Fn,handleSelectAllCells:t?this._handleSelectAllCells:xe,hasCellSelection:t?this.hasCellSelection():false,handleGridKeyDown:t?this._handleGridKeyDown:On,handleFillHandleMouseDown:t?this._handleFillHandleMouseDown:void 0,handleCopy:t?this._handleCopy:xe,handleCut:t?this._handleCut:xe,handlePaste:t?this._handlePaste:Tn,cutRange:t?this.interactionHelper.cutRangeSig():null,copyRange:t?this.interactionHelper.copyRangeSig():null,clearClipboardRanges:t?this._clearClipboardRanges:xe,canUndo:this.canUndo(),canRedo:this.canRedo(),onUndo:this._onUndo,onRedo:this._onRedo,isDragging:t?this.interactionHelper.isDraggingSig():false},s={menuPosition:t?this.interactionHelper.contextMenuPositionSig():null,setMenuPosition:t?this._setContextMenuPosition:void 0,handleCellContextMenu:t?this._handleCellContextMenu:An,closeContextMenu:t?this._closeContextMenu:xe},u={headerFilterInput:{sortBy:e?.sortBy,sortDirection:e?.sortDirection??"asc",onColumnSort:this._headerFilterOnColumnSort,filters:e?.filters??{},onFilterChange:this._headerFilterOnFilterChange,filterOptions:e?.filterOptions??{},loadingFilterOptions:e?.loadingFilterOptions??{},peopleSearch:e?.peopleSearch},cellDescriptorInput:{editingCell:this.editingHelper.editingCellSig(),activeCell:t?this.interactionHelper.activeCellSig():null,selectionRange:t?this.interactionHelper.selectionRangeSig():null,cutRange:t?this.interactionHelper.cutRangeSig():null,copyRange:t?this.interactionHelper.copyRangeSig():null,colOffset:this.colOffset(),itemsLength:e?.items.length??0,getRowId:e?.getRowId??(f=>f.id),editable:e?.editable,onCellValueChanged:this.wrappedOnCellValueChanged(),isDragging:t?this.interactionHelper.isDraggingSig():false,getFormulaValue:e?.getFormulaValue,hasFormula:e?.hasFormula,getFormula:e?.getFormula,formulaVersion:e?.formulaVersion},statusBarConfig:this.statusBarConfig(),showEmptyInGrid:this.showEmptyInGrid(),onCellError:e?.onCellError},d=this.headerMenuOpenForColumnSig(),c=d?e?.pinnedColumns?.[d]:void 0,m={pinnedColumns:e?.pinnedColumns??{},pinColumn:this._pinColumn,unpinColumn:this._unpinColumn,isPinned:this._isPinned,headerMenu:{isOpen:this.headerMenuIsOpenSig(),openForColumn:d,anchorElement:this.headerMenuAnchorElementSig(),open:this._openHeaderMenu,close:this._closeHeaderMenu,handlePinLeft:this._headerMenuPinLeft,handlePinRight:this._headerMenuPinRight,handleUnpin:this._headerMenuUnpin,canPinLeft:c!=="left",canPinRight:c!=="right",canUnpin:!!c}};return {layout:n,rowSelection:i,editing:o,interaction:r,contextMenu:s,viewModels:u,pinning:m}}onWindowMouseMove(e){this.interactionHelper.onWindowMouseMove(e,this.colOffset(),this.wrapperEl());}onWindowMouseUp(){this.interactionHelper.onWindowMouseUp(this.colOffset(),this.wrapperEl());}setupFillHandleDrag(){let e=this.props(),t=this.interactionHelper.fillDragStart;if(!t||e?.editable===false||!this.wrappedOnCellValueChanged())return;let n=this.colOffset(),i=t,o={endRow:i.startRow,endCol:i.startCol},r=null,s=null,u=(m,f)=>{let R=document.elementFromPoint(m,f)?.closest?.("[data-row-index][data-col-index]"),v=this.wrapperEl();if(!R||!v?.contains(R))return null;let V=parseInt(R.getAttribute("data-row-index")??"",10),D=parseInt(R.getAttribute("data-col-index")??"",10);if(Number.isNaN(V)||Number.isNaN(D)||D<n)return null;let C=D-n;return normalizeSelectionRange({startRow:i.startRow,startCol:i.startCol,endRow:V,endCol:C})},d=m=>{s={cx:m.clientX,cy:m.clientY},this.interactionHelper.fillRafId&&cancelAnimationFrame(this.interactionHelper.fillRafId),this.interactionHelper.fillRafId=requestAnimationFrame(()=>{if(this.interactionHelper.fillRafId=0,!s)return;let f=u(s.cx,s.cy);f&&(r&&r.startRow===f.startRow&&r.startCol===f.startCol&&r.endRow===f.endRow&&r.endCol===f.endCol||(r=f,o={endRow:f.endRow,endCol:f.endCol},this.interactionHelper.applyDragAttrs(f,n,this.wrapperEl())));});},c=()=>{if(window.removeEventListener("pointermove",d,true),window.removeEventListener("pointerup",c,true),this.interactionHelper.fillMoveHandler=null,this.interactionHelper.fillUpHandler=null,this.interactionHelper.fillRafId&&(cancelAnimationFrame(this.interactionHelper.fillRafId),this.interactionHelper.fillRafId=0),s){let D=u(s.cx,s.cy);D&&(r=D,o={endRow:D.endRow,endCol:D.endCol});}this.interactionHelper.clearDragAttrs(this.wrapperEl());let m=normalizeSelectionRange({startRow:i.startRow,startCol:i.startCol,endRow:o.endRow,endCol:o.endCol});if(this.setSelectionRange(m),this.setActiveCell({rowIndex:i.startRow,columnIndex:i.startCol+n}),!e)return;let f=e.items,b=this.visibleCols(),R=f[m.startRow],v=b[m.startCol],V=this.wrappedOnCellValueChanged();if(R&&v&&V){let D=getCellValue(R,v);this.beginBatch();for(let C=m.startRow;C<=m.endRow;C++)for(let I=m.startCol;I<=m.endCol;I++){if(C===i.startRow&&I===i.startCol||C>=f.length||I>=b.length)continue;let _=f[C],O=b[I];if(!(O.editable===true||typeof O.editable=="function"&&O.editable(_)))continue;let G=getCellValue(_,O),x=parseValue(D,G,_,O);x.valid&&V({item:_,columnId:O.columnId,oldValue:G,newValue:x.value,rowIndex:C});}this.endBatch();}this.interactionHelper.fillDragStart=null;};this.interactionHelper.fillMoveHandler=d,this.interactionHelper.fillUpHandler=c,this.ngZone.runOutsideAngular(()=>{window.addEventListener("pointermove",d,true),window.addEventListener("pointerup",c,true);});}};oe=l([Injectable()],oe);var _n=8,le=class{constructor(){this.destroyRef=inject(DestroyRef);this.columns=signal([]);this.columnOrder=signal(void 0);this.onColumnOrderChange=signal(void 0);this.enabled=signal(true);this.wrapperEl=signal(null);this.isDragging=signal(false);this.dropIndicatorX=signal(null);this.rafId=0;this.cleanupFn=null;this.latestDropTargetIndex=null;this.destroyRef.onDestroy(()=>{this.cleanupFn&&(this.cleanupFn(),this.cleanupFn=null),this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=0);});}handleHeaderMouseDown(e,t){if(!this.enabled()||!this.onColumnOrderChange()||t.button!==0)return;let i=t.currentTarget.getBoundingClientRect();if(t.clientX>i.right-_n||this.columns().findIndex(b=>b.columnId===e)===-1)return;t.preventDefault();let s=t.clientX,u=false;this.latestDropTargetIndex=null;let d=document.body.style.userSelect;document.body.style.userSelect="none";let c=b=>{!u&&Math.abs(b.clientX-s)<5||(u||(u=true,this.isDragging.set(true)),this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=0;let R=this.wrapperEl();if(!R)return;let v=R.querySelectorAll("th[data-column-id]"),V=[];for(let C=0;C<v.length;C++){let I=v[C],_=I.getAttribute("data-column-id");if(!_)continue;let O=I.getBoundingClientRect();V.push({columnId:_,left:O.left,right:O.right,centerX:O.left+O.width/2});}let D=this.calculateDrop(e,b.clientX,V);this.latestDropTargetIndex=D.dropIndex,this.dropIndicatorX.set(D.indicatorX);}));},m=()=>{window.removeEventListener("pointermove",c,true),window.removeEventListener("pointerup",f,true),this.cleanupFn=null,document.body.style.userSelect=d,this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=0);},f=()=>{if(m(),u&&this.latestDropTargetIndex!=null){let b=this.columnOrder()??this.columns().map(v=>v.columnId),R=reorderColumnArray(b,e,this.latestDropTargetIndex);this.onColumnOrderChange()?.(R);}this.isDragging.set(false),this.dropIndicatorX.set(null);};window.addEventListener("pointermove",c,true),window.addEventListener("pointerup",f,true),this.cleanupFn=m;}calculateDrop(e,t,n){if(n.length===0)return {dropIndex:null,indicatorX:null};let i=this.columnOrder()??this.columns().map(d=>d.columnId),o=i.indexOf(e),r=0,s=null;if(t<=n[0].centerX)r=0,s=n[0].left;else if(t>=n[n.length-1].centerX)r=n.length,s=n[n.length-1].right;else for(let d=0;d<n.length-1;d++)if(t>=n[d].centerX&&t<n[d+1].centerX){r=d+1,s=n[d].right;break}let u=r<n.length?i.indexOf(n[r]?.columnId??""):i.length;return o===u||o+1===u?{dropIndex:u,indicatorX:null}:{dropIndex:u,indicatorX:s}}};le=l([Injectable()],le);var qn=100,ae=class{constructor(){this.destroyRef=inject(DestroyRef);this.totalRows=signal(0);this.config=signal({rowHeight:36});this.containerHeight=signal(0);this.scrollTop=signal(0);this.scrollLeft=signal(0);this.columnWidths=signal([]);this.containerWidth=signal(0);this.containerEl=null;this.rowHeight=computed(()=>this.config().rowHeight??36);this.overscan=computed(()=>this.config().overscan??5);this.enabled=computed(()=>this.config().enabled!==false);this.threshold=computed(()=>this.config().threshold??qn);this.isActive=computed(()=>this.enabled()&&this.totalRows()>=this.threshold());this.visibleRange=computed(()=>this.isActive()?computeVisibleRange(this.scrollTop(),this.rowHeight(),this.containerHeight(),this.totalRows(),this.overscan()):{startIndex:0,endIndex:Math.max(0,this.totalRows()-1),offsetTop:0,offsetBottom:0});this.totalHeight=computed(()=>computeTotalHeight(this.totalRows(),this.rowHeight()));this.columnsEnabled=computed(()=>this.config().columns===true);this.columnOverscan=computed(()=>this.config().columnOverscan??2);this.columnRange=computed(()=>{if(!this.columnsEnabled())return null;let e=this.columnWidths();return e.length===0?null:computeVisibleColumnRange(this.scrollLeft(),e,this.containerWidth(),this.columnOverscan())});this.destroyRef.onDestroy(()=>{this.containerEl=null;});}setContainer(e){this.containerEl=e;}onScroll(e){let t=e.target;this.scrollTop.set(t.scrollTop),this.scrollLeft.set(t.scrollLeft);}scrollToRow(e,t="start"){let n=this.containerEl;if(!n)return;let i=getScrollTopForRow(e,this.rowHeight(),this.containerHeight(),t);n.scrollTo({top:i,behavior:"auto"});}updateConfig(e){this.config.update(t=>{let n={...t,...e};return validateVirtualScrollConfig(n),n});}};ae=l([Injectable()],ae);var Zn={columns:"Columns",filters:"Filters"},Q=class{constructor(){this.sideBarProps=null;this.panelLabels=Zn;}onTabClick(e){let t=this.sideBarProps;t&&t.onPanelChange(t.activePanel===e?null:e);}allVisible(){let e=this.sideBarProps;return e?e.columns.every(t=>e.visibleColumns.has(t.columnId)):false}onSelectAll(){let e=this.sideBarProps;if(!e)return;let t=new Set(e.visibleColumns);e.columns.forEach(n=>t.add(n.columnId)),e.onSetVisibleColumns(t);}onClearAll(){let e=this.sideBarProps;if(!e)return;let t=new Set;e.columns.forEach(n=>{n.required&&e.visibleColumns.has(n.columnId)&&t.add(n.columnId);}),e.onSetVisibleColumns(t);}onVisibilityChange(e,t){this.sideBarProps?.onVisibilityChange(e,t);}getTextFilterValue(e){let n=this.sideBarProps?.filters?.[e];return n?.type==="text"?n.value:""}onTextFilterChange(e,t){this.sideBarProps?.onFilterChange(e,t?{type:"text",value:t}:void 0);}getDateFrom(e){let t=this.sideBarProps?.filters?.[e];return t?.type==="date"?t.value.from??"":""}getDateTo(e){let t=this.sideBarProps?.filters?.[e];return t?.type==="date"?t.value.to??"":""}onDateFromChange(e,t){let n=this.sideBarProps?.filters?.[e],i=n?.type==="date"?n.value:{},o=t||void 0,r=i.to;this.sideBarProps?.onFilterChange(e,o||r?{type:"date",value:{from:o,to:r}}:void 0);}onDateToChange(e,t){let n=this.sideBarProps?.filters?.[e],i=n?.type==="date"?n.value:{},o=t||void 0,r=i.from;this.sideBarProps?.onFilterChange(e,r||o?{type:"date",value:{from:r,to:o}}:void 0);}getFilterOptions(e){return this.sideBarProps?.filterOptions?.[e]??[]}isMultiSelectChecked(e,t){let n=this.sideBarProps?.filters?.[e];return n?.type==="multiSelect"?n.value.includes(t):false}onMultiSelectChange(e,t,n){let i=this.sideBarProps?.filters?.[e],o=i?.type==="multiSelect"?i.value:[],r=n?[...o,t]:o.filter(s=>s!==t);this.sideBarProps?.onFilterChange(e,r.length>0?{type:"multiSelect",value:r}:void 0);}};l([Input()],Q.prototype,"sideBarProps",2),Q=l([Component({selector:"ogrid-sidebar",standalone:true,changeDetection:ChangeDetectionStrategy.OnPush,imports:[NgTemplateOutlet],styles:[`
1
+ import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelectFilterFields,deriveFilterOptionsFromData,processClientSideData,validateColumns,processClientSideDataAsync,validateRowIds,computeNextSortState,mergeFilter,applyResponsiveHiding,resolveResponsiveConfig,CHECKBOX_COLUMN_WIDTH,DEFAULT_MIN_COLUMN_WIDTH,CELL_PADDING,parseValue,UndoRedoStack,rangesEqual,normalizeSelectionRange,formatSelectionAsTsv,parseTsvClipboard,getCellValue,applyCellDeletion,getScrollTopForRow,computeTabNavigation,applyFillValues,computeAggregations,getDataGridStatusBarConfig,computeVisibleRange,computeTotalHeight,computeVisibleColumnRange,validateVirtualScrollConfig,GRID_BORDER_RADIUS,getStatusBarParts,GRID_CONTEXT_MENU_ITEMS,formatShortcut,injectGlobalStyles,partitionColumnsForVirtualization,buildHeaderRows,ROW_NUMBER_COLUMN_ID,ROW_NUMBER_COLUMN_WIDTH,getHeaderFilterConfig,getCellRenderDescriptor,resolveCellDisplayContent,resolveCellStyle,buildPopoverEditorProps,ROW_NUMBER_COLUMN_MIN_WIDTH,measureColumnContentWidth,getPaginationViewModel,formatDateForDisplay,parseUserInputDate,getDateInputPlaceholder,getColumnHeaderMenuItems,reorderColumnArray,findCtrlArrowTarget,measureRange}from'@alaarab/ogrid-core';export{AUTOSIZE_EXTRA_PX,AUTOSIZE_MAX_PX,CELL_PADDING,CHECKBOX_COLUMN_WIDTH,COLUMN_HEADER_MENU_ITEMS,CellDescriptorCache,DEFAULT_DEBOUNCE_MS,DEFAULT_MIN_COLUMN_WIDTH,GRID_BORDER_RADIUS,GRID_CONTEXT_MENU_ITEMS,MAX_PAGE_BUTTONS,PAGE_SIZE_OPTIONS,PEOPLE_SEARCH_DEBOUNCE_MS,RESPONSIVE_BREAKPOINTS,ROW_NUMBER_COLUMN_ID,ROW_NUMBER_COLUMN_MIN_WIDTH,ROW_NUMBER_COLUMN_WIDTH,SIDEBAR_TRANSITION_MS,UndoRedoStack,Z_INDEX,applyCellDeletion,applyCutClear,applyFillValues,applyPastedValues,applyRangeRowSelection,applyResponsiveHiding,areGridRowPropsEqual,booleanParser,buildCellIndex,buildCsvHeader,buildCsvRows,buildHeaderRows,buildInlineEditorProps,buildPopoverEditorProps,calculateDropTarget,clampSelectionToBounds,columnLetterToIndex,computeAggregations,computeArrowNavigation,computeAutoScrollSpeed,computeNextSortState,computeRowSelectionState,computeTabNavigation,computeTotalHeight,computeVisibleColumnRange,computeVisibleRange,createGridDataAccessor,createSortFilterWorker,currencyParser,dateParser,debounce,deriveFilterOptionsFromData,emailParser,escapeCsvValue,exportToCsv,extractValueMatrix,findCtrlArrowTarget,flattenColumns,formatCellReference,formatCellValueForTsv,formatSelectionAsTsv,formatShortcut,getCellRenderDescriptor,getCellValue,getColumnHeaderMenuItems,getContextMenuHandlers,getDataGridStatusBarConfig,getFilterField,getHeaderFilterConfig,getMultiSelectFilterFields,getPaginationViewModel,getPinStateForColumn,getResponsiveHiddenColumns,getScrollTopForRow,getStatusBarParts,indexToColumnLetter,injectGlobalStyles,isColumnEditable,isFilterConfig,isInSelectionRange,isRowInRange,measureColumnContentWidth,measureRange,mergeFilter,normalizeSelectionRange,numberParser,parseTsvClipboard,parseValue,partitionColumnsForVirtualization,processClientSideData,processClientSideDataAsync,rangesEqual,reorderColumnArray,resolveCellDisplayContent,resolveCellStyle,resolveResponsiveConfig,terminateSortFilterWorker,toUserLike,triggerCsvDownload,validateColumns,validateRowIds,validateVirtualScrollConfig}from'@alaarab/ogrid-core';import {handleFormulaBarKeyDown,FormulaEngine,deriveFormulaBarText,extractFormulaReferences,FORMULA_REF_COLORS}from'@alaarab/ogrid-core/formula';export{CIRC_ERROR,DIV_ZERO_ERROR,DependencyGraph,FORMULA_BAR_CSS,FORMULA_BAR_STYLES,FORMULA_REF_COLORS,FormulaEngine,FormulaError,FormulaEvaluator,GENERAL_ERROR,NAME_ERROR,NA_ERROR,REF_ERROR,VALUE_ERROR,adjustFormulaReferences,canInsertReference,createBuiltInFunctions,deriveFormulaBarText,extractFormulaReferences,flattenArgs,formatAddress,formulaToString,fromCellKey,handleFormulaBarKeyDown,insertReferenceAtCursor,isFormulaError,parse,parseCellRef,parseRange,processFormulaBarCommit,toBoolean,toCellKey,toNumber,tokenize}from'@alaarab/ogrid-core/formula';import {Injectable,Input,Component,ChangeDetectionStrategy,ViewEncapsulation,Output,ViewChild,input,output,viewChild,effect,inject,DestroyRef,signal,computed,NgZone,EventEmitter,Injector,EnvironmentInjector,createComponent}from'@angular/core';import {NgTemplateOutlet}from'@angular/common';var Bt=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var l=(p,e,t,n)=>{for(var i=n>1?void 0:n?zt(e,t):e,o=p.length-1,r;o>=0;o--)(r=p[o])&&(i=(n?r(e,t,i):r(i))||i);return n&&i&&Bt(e,t,i),i};var ne=class{constructor(){this.destroyRef=inject(DestroyRef);this.engine=null;this.initialLoaded=false;this.items=[];this.flatColumns=[];this.enabled=signal(false);this.lastRecalcResult=signal(null);this.formulaCount=computed(()=>(this.lastRecalcResult(),this.engine?.getAllFormulas().length??0));this.destroyRef.onDestroy(()=>{this.engine?.clear(),this.engine=null;});}configure(e){let{formulas:t,initialFormulas:n,formulaFunctions:i,onFormulaRecalc:o,namedRanges:r,sheets:s}=e;if(this.onFormulaRecalcFn=o,t&&!this.engine){if(this.engine=new FormulaEngine({customFunctions:i,namedRanges:r}),s)for(let[u,d]of Object.entries(s))this.engine.registerSheet(u,d);this.enabled.set(true);}else !t&&this.engine&&(this.engine.clear(),this.engine=null,this.enabled.set(false),this.lastRecalcResult.set(null),this.initialLoaded=false);if(t&&this.engine&&n&&!this.initialLoaded){this.initialLoaded=true;let u=this.createAccessor(),d=this.engine.loadFormulas(n,u);d.updatedCells.length>0&&(this.lastRecalcResult.set(d),this.onFormulaRecalcFn?.(d));}}setData(e,t){this.items=e,this.flatColumns=t;}setFormula(e,t,n,i){if(!this.engine)return;let o=i??this.createAccessor(),r=this.engine.setFormula(e,t,n,o);r.updatedCells.length>0&&(this.lastRecalcResult.set(r),this.onFormulaRecalcFn?.(r));}onCellChanged(e,t,n){if(!this.engine)return;let i=n??this.createAccessor(),o=this.engine.onCellChanged(e,t,i);o.updatedCells.length>0&&(this.lastRecalcResult.set(o),this.onFormulaRecalcFn?.(o));}getValue(e,t){return this.engine?.getValue(e,t)}hasFormula(e,t){return this.engine?.hasFormula(e,t)??false}getFormula(e,t){return this.engine?.getFormula(e,t)}recalcAll(e){if(!this.engine)return;let t=e??this.createAccessor(),n=this.engine.recalcAll(t);n.updatedCells.length>0&&(this.lastRecalcResult.set(n),this.onFormulaRecalcFn?.(n));}getAllFormulas(){return this.engine?.getAllFormulas()??[]}registerFunction(e,t){this.engine?.registerFunction(e,t);}clear(){this.engine?.clear(),this.lastRecalcResult.set(null);}defineNamedRange(e,t){this.engine?.defineNamedRange(e,t);}removeNamedRange(e){this.engine?.removeNamedRange(e);}registerSheet(e,t){this.engine?.registerSheet(e,t);}unregisterSheet(e){this.engine?.unregisterSheet(e);}getPrecedents(e,t){return this.engine?.getPrecedents(e,t)??[]}getDependents(e,t){return this.engine?.getDependents(e,t)??[]}getAuditTrail(e,t){return this.engine?.getAuditTrail(e,t)??null}createAccessor(){return createGridDataAccessor(this.items,this.flatColumns)}};ne=l([Injectable()],ne);var an=25,dn={},ut=["columns","filters"],ie=class{constructor(){this.destroyRef=inject(DestroyRef);this.columnsProp=signal([]);this.getRowId=signal(e=>e.id);this.data=signal(void 0);this.dataSource=signal(void 0);this.controlledPage=signal(void 0);this.controlledPageSize=signal(void 0);this.controlledSort=signal(void 0);this.controlledFilters=signal(void 0);this.controlledVisibleColumns=signal(void 0);this.controlledLoading=signal(void 0);this.onPageChange=signal(void 0);this.onPageSizeChange=signal(void 0);this.onSortChange=signal(void 0);this.onFiltersChange=signal(void 0);this.onVisibleColumnsChange=signal(void 0);this.columnOrder=signal(void 0);this.onColumnOrderChange=signal(void 0);this.onColumnResized=signal(void 0);this.onAutosizeColumn=signal(void 0);this.onColumnPinned=signal(void 0);this.defaultPageSize=signal(an);this.defaultSortBy=signal(void 0);this.defaultSortDirection=signal("asc");this.toolbar=signal(void 0);this.toolbarBelow=signal(void 0);this.emptyState=signal(void 0);this.entityLabelPlural=signal("items");this.className=signal(void 0);this.layoutMode=signal("fill");this.suppressHorizontalScroll=signal(void 0);this.stickyHeader=signal(true);this.fullScreen=signal(false);this.editable=signal(void 0);this.cellSelection=signal(void 0);this.density=signal("normal");this.rowHeight=signal(void 0);this.onCellValueChanged=signal(void 0);this.onUndo=signal(void 0);this.onRedo=signal(void 0);this.canUndo=signal(void 0);this.canRedo=signal(void 0);this.rowSelection=signal("none");this.selectedRows=signal(void 0);this.onSelectionChange=signal(void 0);this.statusBar=signal(void 0);this.pageSizeOptions=signal(void 0);this.sideBarConfig=signal(void 0);this.onFirstDataRendered=signal(void 0);this.onError=signal(void 0);this.columnChooserProp=signal(void 0);this.columnReorder=signal(void 0);this.responsiveColumns=signal(void 0);this.virtualScroll=signal(void 0);this.ariaLabel=signal(void 0);this.ariaLabelledBy=signal(void 0);this.workerSort=signal(false);this.showRowNumbers=signal(false);this.cellReferences=signal(false);this.formulasEnabled=signal(false);this.initialFormulas=signal(void 0);this.onFormulaRecalc=signal(void 0);this.formulaFunctions=signal(void 0);this.namedRanges=signal(void 0);this.sheets=signal(void 0);this.sheetDefs=signal(void 0);this.activeSheet=signal(void 0);this.onSheetChange=signal(void 0);this.onSheetAdd=signal(void 0);this.activeCellRef=signal(null);this.activeCellCoords=signal(null);this.handleActiveCellChange=e=>{if(this.activeCellRef.set(e),e){let t=e.match(/^([A-Z]+)(\d+)$/);t?this.activeCellCoords.set({col:columnLetterToIndex(t[1]),row:parseInt(t[2],10)-1}):this.activeCellCoords.set(null);}else this.activeCellCoords.set(null);};this.formulaBarEditing=signal(false);this.formulaBarEditText=signal("");this.formulaService=new ne;this.formulaVersion=signal(0);this.getFormulaValueFn=(e,t)=>this.formulaService.getValue(e,t);this.hasFormulaFn=(e,t)=>this.formulaService.hasFormula(e,t);this.getFormulaFn=(e,t)=>this.formulaService.getFormula(e,t);this.setFormulaFn=(e,t,n)=>this.formulaService.setFormula(e,t,n??"");this.onFormulaCellChangedFn=(e,t)=>this.formulaService.onCellChanged(e,t);this.getPrecedentsFn=(e,t)=>this.formulaService.getPrecedents(e,t);this.getDependentsFn=(e,t)=>this.formulaService.getDependents(e,t);this.getAuditTrailFn=(e,t)=>this.formulaService.getAuditTrail(e,t);this.internalData=signal([]);this.internalLoading=signal(false);this.internalPage=signal(1);this.internalPageSizeOverride=signal(null);this.internalSortOverride=signal(null);this.internalFilters=signal({});this.internalVisibleColumnsOverride=signal(null);this.internalSelectedRows=signal(new Set);this.columnWidthOverrides=signal({});this.pinnedOverrides=signal({});this.serverItems=signal([]);this.serverTotalCount=signal(0);this.serverLoading=signal(true);this.fetchAbortController=null;this.filterAbortController=null;this.refreshCounter=signal(0);this.firstDataRendered=signal(false);this.asyncClientItems=signal(null);this.workerSortAbortId=0;this.sideBarActivePanel=signal(null);this.serverFilterOptions=signal({});this.loadingFilterOptions=signal({});this.columns=computed(()=>flattenColumns(this.columnsProp()));this.isServerSide=computed(()=>this.dataSource()!=null);this.isClientSide=computed(()=>!this.isServerSide());this.displayData=computed(()=>this.data()??this.internalData());this.displayLoading=computed(()=>this.controlledLoading()??this.internalLoading());this.defaultSortField=computed(()=>this.defaultSortBy()??this.columns()[0]?.columnId??"");this.page=computed(()=>this.controlledPage()??this.internalPage());this.pageSize=computed(()=>this.controlledPageSize()??this.internalPageSizeOverride()??this.defaultPageSize());this.sort=computed(()=>this.controlledSort()??this.internalSortOverride()??{field:this.defaultSortField(),direction:this.defaultSortDirection()});this.filters=computed(()=>this.controlledFilters()??this.internalFilters());this.visibleColumns=computed(()=>{let e=this.controlledVisibleColumns();if(e)return e;let t=this.internalVisibleColumnsOverride();if(t)return t;let n=this.columns();if(n.length===0)return new Set;let i=n.filter(o=>o.defaultVisible!==false).map(o=>o.columnId);return new Set(i.length>0?i:n.map(o=>o.columnId))});this.effectiveSelectedRows=computed(()=>this.selectedRows()??this.internalSelectedRows());this.columnChooserPlacement=computed(()=>{let e=this.columnChooserProp();return e===false?"none":e==="sidebar"?"sidebar":"toolbar"});this.multiSelectFilterFields=computed(()=>getMultiSelectFilterFields(this.columns()));this.hasServerFilterOptions=computed(()=>this.dataSource()?.fetchFilterOptions!=null);this.clientFilterOptions=computed(()=>this.hasServerFilterOptions()?this.serverFilterOptions():deriveFilterOptionsFromData(this.displayData(),this.columns()));this.clientItemsAndTotal=computed(()=>{if(!this.isClientSide()||this.workerSort())return null;let e=processClientSideData(this.displayData(),this.columns(),this.filters(),this.sort().field,this.sort().direction),t=e.length,n=(this.page()-1)*this.pageSize();return {items:e.slice(n,n+this.pageSize()),totalCount:t}});this.resolvedClientItems=computed(()=>{let e=this.clientItemsAndTotal();return e||this.asyncClientItems()});this.displayItems=computed(()=>{let e=this.resolvedClientItems();return this.isClientSide()&&e?e.items:this.serverItems()});this.displayTotalCount=computed(()=>{let e=this.resolvedClientItems();return this.isClientSide()&&e?e.totalCount:this.serverTotalCount()});this.hasActiveFilters=computed(()=>Object.values(this.filters()).some(e=>e!==void 0));this.columnChooserColumns=computed(()=>this.columns().map(e=>({columnId:e.columnId,name:e.name,required:e.required===true})));this.statusBarConfig=computed(()=>{let e=this.statusBar();if(!e)return;if(typeof e=="object")return e;let t=this.isClientSide()?this.data()?.length??0:this.serverTotalCount(),n=this.displayTotalCount();return {totalCount:t,filteredCount:this.hasActiveFilters()?n:void 0,selectedCount:this.effectiveSelectedRows().size,suppressRowCount:true}});this.isLoadingResolved=computed(()=>this.isServerSide()&&this.serverLoading()||this.displayLoading());this.sideBarEnabled=computed(()=>{let e=this.sideBarConfig();return e!=null&&e!==false});this.sideBarParsed=computed(()=>{let e=this.sideBarConfig();if(!this.sideBarEnabled()||e===true)return {panels:ut,position:"right",defaultPanel:null};let t=e;return {panels:t.panels??ut,position:t.position??"right",defaultPanel:t.defaultPanel??null}});this.filterableColumns=computed(()=>this.columns().filter(e=>e.filterable&&e.filterable.type).map(e=>({columnId:e.columnId,name:e.name,filterField:e.filterable?.filterField??e.columnId,filterType:e.filterable?.type})));this.sideBarState=computed(()=>({isEnabled:this.sideBarEnabled(),activePanel:this.sideBarActivePanel(),setActivePanel:e=>this.sideBarActivePanel.set(e),panels:this.sideBarParsed().panels,position:this.sideBarParsed().position,isOpen:this.sideBarActivePanel()!==null,toggle:e=>this.sideBarActivePanel.update(t=>t===e?null:e),close:()=>this.sideBarActivePanel.set(null)}));this.formulaBarDisplayText=computed(()=>{let e=this.activeCellCoords();if(!e)return "";let t=this.formulaService.enabled()?(r,s)=>this.formulaService.getFormula(r,s):void 0,n=this.displayItems(),i=this.columns(),o=(r,s)=>{if(!(s<0||s>=n.length||r<0||r>=i.length))return getCellValue(n[s],i[r])};return deriveFormulaBarText(e.col,e.row,t,o)});this.formulaBarText=computed(()=>this.formulaBarEditing()?this.formulaBarEditText():this.formulaBarDisplayText());this.formulaBarReferences=computed(()=>extractFormulaReferences(this.formulaBarText()));this.formulaBarOnInputChangeFn=e=>{this.formulaBarEditText.set(e);};this.formulaBarOnCommitFn=()=>{this.commitFormulaBar();};this.formulaBarOnCancelFn=()=>{this.cancelFormulaBar();};this.formulaBarStartEditingFn=()=>{this.startFormulaBarEditing();};this.formulaBarState=computed(()=>({cellRef:this.activeCellRef(),formulaText:this.formulaBarText(),isEditing:this.formulaBarEditing(),onInputChange:this.formulaBarOnInputChangeFn,onCommit:this.formulaBarOnCommitFn,onCancel:this.formulaBarOnCancelFn,startEditing:this.formulaBarStartEditingFn,referencedCells:this.formulaBarReferences()}));this.handleSortFn=(e,t)=>this.handleSort(e,t);this.handleColumnResizedFn=(e,t)=>this.handleColumnResized(e,t);this.handleColumnPinnedFn=(e,t)=>this.handleColumnPinned(e,t);this.handleSelectionChangeFn=e=>this.handleSelectionChange(e);this.handleFilterChangeFn=(e,t)=>this.handleFilterChange(e,t);this.clearAllFiltersFn=()=>this.setFilters({});this.setPageFn=e=>this.setPage(e);this.setPageSizeFn=e=>this.setPageSize(e);this.handleVisibilityChangeFn=(e,t)=>this.handleVisibilityChange(e,t);this.dataGridProps=computed(()=>({items:this.displayItems(),columns:this.columnsProp(),getRowId:this.getRowId(),sortBy:this.sort().field,sortDirection:this.sort().direction,onColumnSort:this.handleSortFn,visibleColumns:this.visibleColumns(),columnOrder:this.columnOrder(),onColumnOrderChange:this.onColumnOrderChange(),onColumnResized:this.handleColumnResizedFn,onAutosizeColumn:this.onAutosizeColumn(),onColumnPinned:this.handleColumnPinnedFn,pinnedColumns:this.pinnedOverrides(),initialColumnWidths:this.columnWidthOverrides(),editable:this.editable(),cellSelection:this.cellSelection(),density:this.density(),rowHeight:this.rowHeight(),onCellValueChanged:this.onCellValueChanged(),onUndo:this.onUndo(),onRedo:this.onRedo(),canUndo:this.canUndo(),canRedo:this.canRedo(),rowSelection:this.rowSelection(),selectedRows:this.effectiveSelectedRows(),onSelectionChange:this.handleSelectionChangeFn,showRowNumbers:this.showRowNumbers()||this.cellReferences()||this.formulasEnabled(),showColumnLetters:!!(this.cellReferences()||this.formulasEnabled()),showNameBox:!!(this.cellReferences()&&!this.formulasEnabled()),onActiveCellChange:this.cellReferences()||this.formulasEnabled()?this.handleActiveCellChange:void 0,currentPage:this.page(),pageSize:this.pageSize(),statusBar:this.statusBarConfig(),isLoading:this.isLoadingResolved(),filters:this.filters(),onFilterChange:this.handleFilterChangeFn,filterOptions:this.clientFilterOptions(),loadingFilterOptions:this.dataSource()?.fetchFilterOptions?this.loadingFilterOptions():dn,peopleSearch:this.dataSource()?.searchPeople?.bind(this.dataSource()),getUserByEmail:this.dataSource()?.getUserByEmail?.bind(this.dataSource()),layoutMode:this.layoutMode(),suppressHorizontalScroll:this.suppressHorizontalScroll(),stickyHeader:this.stickyHeader(),columnReorder:this.columnReorder(),responsiveColumns:this.responsiveColumns(),virtualScroll:this.virtualScroll(),"aria-label":this.ariaLabel(),"aria-labelledby":this.ariaLabelledBy(),emptyState:{hasActiveFilters:this.hasActiveFilters(),onClearAll:this.clearAllFiltersFn,message:this.emptyState()?.message,render:this.emptyState()?.render},formulas:this.formulasEnabled(),formulaVersion:this.formulaVersion(),formulaReferences:this.formulaBarReferences().length>0?this.formulaBarReferences():void 0,...this.formulaService.enabled()?{getFormulaValue:this.getFormulaValueFn,hasFormula:this.hasFormulaFn,getFormula:this.getFormulaFn,setFormula:this.setFormulaFn,onFormulaCellChanged:this.onFormulaCellChangedFn,getPrecedents:this.getPrecedentsFn,getDependents:this.getDependentsFn,getAuditTrail:this.getAuditTrailFn}:{}}));this.pagination=computed(()=>({page:this.page(),pageSize:this.pageSize(),displayTotalCount:this.displayTotalCount(),setPage:this.setPageFn,setPageSize:this.setPageSizeFn,pageSizeOptions:this.pageSizeOptions(),entityLabelPlural:this.entityLabelPlural()}));this.columnChooser=computed(()=>({columns:this.columnChooserColumns(),visibleColumns:this.visibleColumns(),onVisibilityChange:this.handleVisibilityChangeFn,placement:this.columnChooserPlacement()}));this.filtersResult=computed(()=>({hasActiveFilters:this.hasActiveFilters(),setFilters:e=>this.setFilters(e)}));this.sideBarProps=computed(()=>{let e=this.sideBarState();return e.isEnabled?{activePanel:e.activePanel,onPanelChange:e.setActivePanel,panels:e.panels,position:e.position,columns:this.columnChooserColumns(),visibleColumns:this.visibleColumns(),onVisibilityChange:(t,n)=>this.handleVisibilityChange(t,n),onSetVisibleColumns:t=>this.setVisibleColumns(t),filterableColumns:this.filterableColumns(),filters:this.filters(),onFilterChange:(t,n)=>this.handleFilterChange(t,n),filterOptions:this.clientFilterOptions()}:null});let e=false;effect(()=>{let n=this.columns();!e&&n.length>0&&(e=true,validateColumns(n));}),effect(n=>{if(!this.isClientSide()||!this.workerSort())return;let i=this.displayData(),o=this.columns(),r=this.filters(),s=this.sort().field,u=this.sort().direction,d=this.page(),c=this.pageSize(),m=++this.workerSortAbortId;processClientSideDataAsync(i,o,r,s,u).then(f=>{if(m!==this.workerSortAbortId)return;let b=f.length,R=(d-1)*c,v=f.slice(R,R+c);this.asyncClientItems.set({items:v,totalCount:b});}).catch(()=>{if(m!==this.workerSortAbortId)return;let f=processClientSideData(i,o,r,s,u),b=f.length,R=(d-1)*c,v=f.slice(R,R+c);this.asyncClientItems.set({items:v,totalCount:b});}),n(()=>{this.workerSortAbortId++;});}),effect(n=>{let i=this.dataSource();if(!this.isServerSide()||!i){this.isServerSide()||this.serverLoading.set(false);return}let o=this.page(),r=this.pageSize(),s=this.sort(),u=this.filters();this.refreshCounter();let d=new AbortController;this.fetchAbortController=d,this.serverLoading.set(true),i.fetchPage({page:o,pageSize:r,sort:{field:s.field,direction:s.direction},filters:u}).then(c=>{d.signal.aborted||(this.serverItems.set(c.items),this.serverTotalCount.set(c.totalCount));}).catch(c=>{d.signal.aborted||(this.onError()?.(c),this.serverItems.set([]),this.serverTotalCount.set(0));}).finally(()=>{d.signal.aborted||this.serverLoading.set(false);}),n(()=>{d.abort();});});let t=false;effect(()=>{let n=this.displayItems();!this.firstDataRendered()&&n.length>0&&(this.firstDataRendered.set(true),this.onFirstDataRendered()?.()),!t&&n.length>0&&(t=true,validateRowIds(n,this.getRowId()));}),effect(n=>{let i=this.dataSource(),o=this.multiSelectFilterFields(),r=i&&"fetchFilterOptions"in i&&typeof i.fetchFilterOptions=="function"?i.fetchFilterOptions.bind(i):void 0;if(!r||o.length===0){this.serverFilterOptions.set({}),this.loadingFilterOptions.set({});return}let s=new AbortController;this.filterAbortController=s;let u={};o.forEach(c=>{u[c]=true;}),this.loadingFilterOptions.set(u);let d={};Promise.all(o.map(async c=>{try{d[c]=await r(c);}catch{d[c]=[];}})).then(()=>{s.signal.aborted||(this.serverFilterOptions.set(d),this.loadingFilterOptions.set({}));}),n(()=>{s.abort();});}),effect(()=>{let n=this.sideBarParsed();n.defaultPanel&&this.sideBarActivePanel.set(n.defaultPanel);}),effect(()=>{this.activeCellCoords(),this.formulaBarEditing.set(false);}),effect(()=>{let n=this.onFormulaRecalc();this.formulaService.configure({formulas:this.formulasEnabled(),initialFormulas:this.initialFormulas(),formulaFunctions:this.formulaFunctions(),onFormulaRecalc:i=>{this.formulaVersion.update(o=>o+1),n?.(i);},namedRanges:this.namedRanges(),sheets:this.sheets()});}),effect(()=>{let n=this.displayItems(),i=this.columns();this.formulaService.setData(n,i);}),this.destroyRef.onDestroy(()=>{this.fetchAbortController?.abort(),this.filterAbortController?.abort(),this.fetchAbortController=null,this.filterAbortController=null,this.onPageChange.set(void 0),this.onPageSizeChange.set(void 0),this.onSortChange.set(void 0),this.onFiltersChange.set(void 0),this.onVisibleColumnsChange.set(void 0),this.onColumnOrderChange.set(void 0),this.onColumnResized.set(void 0),this.onAutosizeColumn.set(void 0),this.onColumnPinned.set(void 0),this.onCellValueChanged.set(void 0),this.onSelectionChange.set(void 0),this.onFirstDataRendered.set(void 0),this.onError.set(void 0),this.onUndo.set(void 0),this.onRedo.set(void 0);});}setPage(e){this.controlledPage()===void 0&&this.internalPage.set(e),this.onPageChange()?.(e);}setPageSize(e){this.controlledPageSize()===void 0&&this.internalPageSizeOverride.set(e),this.onPageSizeChange()?.(e),this.setPage(1);}setSort(e){this.controlledSort()===void 0&&this.internalSortOverride.set(e),this.onSortChange()?.(e),this.setPage(1);}setFilters(e){this.controlledFilters()===void 0&&this.internalFilters.set(e),this.onFiltersChange()?.(e),this.setPage(1);}setVisibleColumns(e){this.controlledVisibleColumns()===void 0&&this.internalVisibleColumnsOverride.set(e),this.onVisibleColumnsChange()?.(e);}handleSort(e,t){this.setSort(computeNextSortState(this.sort(),e,t));}handleFilterChange(e,t){this.setFilters(mergeFilter(this.filters(),e,t));}handleVisibilityChange(e,t){let n=new Set(this.visibleColumns());t?n.add(e):n.delete(e),this.setVisibleColumns(n);}handleSelectionChange(e){this.selectedRows()===void 0&&this.internalSelectedRows.set(new Set(e.selectedRowIds)),this.onSelectionChange()?.(e);}handleColumnResized(e,t){this.columnWidthOverrides.update(n=>({...n,[e]:t})),this.onColumnResized()?.(e,t);}handleColumnPinned(e,t){this.pinnedOverrides.update(n=>{if(t===null){let{[e]:i,...o}=n;return o}return {...n,[e]:t}}),this.onColumnPinned()?.(e,t);}startFormulaBarEditing(){this.formulaBarEditText.set(this.formulaBarDisplayText()),this.formulaBarEditing.set(true);}commitFormulaBar(){let e=this.activeCellCoords();if(!e)return;let t=this.formulaBarEditText().trim();t.startsWith("=")?(this.formulaService.setFormula(e.col,e.row,t),this.formulaVersion.update(n=>n+1)):(this.formulaService.setFormula(e.col,e.row,null),this.onCellValueChanged()?.({rowIndex:e.row,columnId:this.columns()[e.col]?.columnId??"",oldValue:void 0,newValue:t})),this.formulaBarEditing.set(false);}cancelFormulaBar(){this.formulaBarEditing.set(false),this.formulaBarEditText.set("");}configure(e){if(this.columnsProp.set(e.columns),Object.keys(this.pinnedOverrides()).length===0){let t={};for(let n of flattenColumns(e.columns))n.pinned&&(t[n.columnId]=n.pinned);Object.keys(t).length>0&&this.pinnedOverrides.set(t);}this.getRowId.set(e.getRowId),"data"in e&&e.data!==void 0&&this.data.set(e.data),"dataSource"in e&&e.dataSource!==void 0&&this.dataSource.set(e.dataSource),e.page!==void 0&&this.controlledPage.set(e.page),e.pageSize!==void 0&&this.controlledPageSize.set(e.pageSize),e.sort!==void 0&&this.controlledSort.set(e.sort),e.filters!==void 0&&this.controlledFilters.set(e.filters),e.visibleColumns!==void 0&&this.controlledVisibleColumns.set(e.visibleColumns),e.isLoading!==void 0&&this.controlledLoading.set(e.isLoading),e.onPageChange&&this.onPageChange.set(e.onPageChange),e.onPageSizeChange&&this.onPageSizeChange.set(e.onPageSizeChange),e.onSortChange&&this.onSortChange.set(e.onSortChange),e.onFiltersChange&&this.onFiltersChange.set(e.onFiltersChange),e.onVisibleColumnsChange&&this.onVisibleColumnsChange.set(e.onVisibleColumnsChange),e.columnOrder!==void 0&&this.columnOrder.set(e.columnOrder),e.onColumnOrderChange&&this.onColumnOrderChange.set(e.onColumnOrderChange),e.onColumnResized&&this.onColumnResized.set(e.onColumnResized),e.onAutosizeColumn&&this.onAutosizeColumn.set(e.onAutosizeColumn),e.onColumnPinned&&this.onColumnPinned.set(e.onColumnPinned),e.defaultPageSize!==void 0&&this.defaultPageSize.set(e.defaultPageSize),e.defaultSortBy!==void 0&&this.defaultSortBy.set(e.defaultSortBy),e.defaultSortDirection!==void 0&&this.defaultSortDirection.set(e.defaultSortDirection),e.editable!==void 0&&this.editable.set(e.editable),e.cellSelection!==void 0&&this.cellSelection.set(e.cellSelection),e.density!==void 0&&this.density.set(e.density),e.rowHeight!==void 0&&this.rowHeight.set(e.rowHeight),e.onCellValueChanged&&this.onCellValueChanged.set(e.onCellValueChanged),e.onUndo&&this.onUndo.set(e.onUndo),e.onRedo&&this.onRedo.set(e.onRedo),e.canUndo!==void 0&&this.canUndo.set(e.canUndo),e.canRedo!==void 0&&this.canRedo.set(e.canRedo),e.rowSelection!==void 0&&this.rowSelection.set(e.rowSelection),e.selectedRows!==void 0&&this.selectedRows.set(e.selectedRows),e.onSelectionChange&&this.onSelectionChange.set(e.onSelectionChange),e.statusBar!==void 0&&this.statusBar.set(e.statusBar),e.pageSizeOptions!==void 0&&this.pageSizeOptions.set(e.pageSizeOptions),e.sideBar!==void 0&&this.sideBarConfig.set(e.sideBar),e.onFirstDataRendered&&this.onFirstDataRendered.set(e.onFirstDataRendered),e.onError&&this.onError.set(e.onError),e.columnChooser!==void 0&&this.columnChooserProp.set(e.columnChooser),e.columnReorder!==void 0&&this.columnReorder.set(e.columnReorder),e.responsiveColumns!==void 0&&this.responsiveColumns.set(e.responsiveColumns),e.virtualScroll!==void 0&&this.virtualScroll.set(e.virtualScroll),e.workerSort!==void 0&&this.workerSort.set(e.workerSort),e.showRowNumbers!==void 0&&this.showRowNumbers.set(e.showRowNumbers),e.cellReferences!==void 0&&this.cellReferences.set(e.cellReferences),e.formulas!==void 0&&this.formulasEnabled.set(e.formulas),e.initialFormulas!==void 0&&this.initialFormulas.set(e.initialFormulas),e.onFormulaRecalc&&this.onFormulaRecalc.set(e.onFormulaRecalc),e.formulaFunctions!==void 0&&this.formulaFunctions.set(e.formulaFunctions),e.namedRanges!==void 0&&this.namedRanges.set(e.namedRanges),e.sheets!==void 0&&this.sheets.set(e.sheets),e.sheetDefs!==void 0&&this.sheetDefs.set(e.sheetDefs),e.activeSheet!==void 0&&this.activeSheet.set(e.activeSheet),e.onSheetChange&&this.onSheetChange.set(e.onSheetChange),e.onSheetAdd&&this.onSheetAdd.set(e.onSheetAdd),e.entityLabelPlural!==void 0&&this.entityLabelPlural.set(e.entityLabelPlural),e.className!==void 0&&this.className.set(e.className),e.layoutMode!==void 0&&this.layoutMode.set(e.layoutMode),e.suppressHorizontalScroll!==void 0&&this.suppressHorizontalScroll.set(e.suppressHorizontalScroll),e.stickyHeader!==void 0&&this.stickyHeader.set(e.stickyHeader),e.fullScreen!==void 0&&this.fullScreen.set(e.fullScreen),e["aria-label"]!==void 0&&this.ariaLabel.set(e["aria-label"]),e["aria-labelledby"]!==void 0&&this.ariaLabelledBy.set(e["aria-labelledby"]);}pinColumn(e,t){this.pinnedOverrides.update(n=>({...n,[e]:t})),this.onColumnPinned()?.(e,t);}unpinColumn(e){this.pinnedOverrides.update(t=>{let{[e]:n,...i}=t;return i}),this.onColumnPinned()?.(e,null);}isPinned(e){return this.pinnedOverrides()[e]}computeLeftOffsets(e,t,n,i,o){let r={},s=this.pinnedOverrides(),u=i?o:0;for(let d of e)s[d.columnId]==="left"&&(r[d.columnId]=u,u+=t[d.columnId]??n);return r}computeRightOffsets(e,t,n){let i={},o=this.pinnedOverrides(),r=0;for(let s=e.length-1;s>=0;s--){let u=e[s];o[u.columnId]==="right"&&(i[u.columnId]=r,r+=t[u.columnId]??n);}return i}getApi(){return {setRowData:e=>{this.isServerSide()||this.internalData.set(e);},setLoading:e=>this.internalLoading.set(e),getColumnState:()=>({visibleColumns:Array.from(this.visibleColumns()),sort:this.sort(),columnOrder:this.columnOrder()??void 0,columnWidths:Object.keys(this.columnWidthOverrides()).length>0?this.columnWidthOverrides():void 0,filters:Object.keys(this.filters()).length>0?this.filters():void 0,pinnedColumns:Object.keys(this.pinnedOverrides()).length>0?this.pinnedOverrides():void 0}),applyColumnState:e=>{e.visibleColumns&&this.setVisibleColumns(new Set(e.visibleColumns)),e.sort&&this.setSort(e.sort),e.columnOrder&&this.onColumnOrderChange()?.(e.columnOrder),e.columnWidths&&this.columnWidthOverrides.set(e.columnWidths),e.filters&&this.setFilters(e.filters),e.pinnedColumns&&this.pinnedOverrides.set(e.pinnedColumns);},setFilterModel:e=>this.setFilters(e),getSelectedRows:()=>Array.from(this.effectiveSelectedRows()),setSelectedRows:e=>{this.selectedRows()===void 0&&this.internalSelectedRows.set(new Set(e));},selectAll:()=>{let e=new Set(this.displayItems().map(t=>this.getRowId()(t)));this.selectedRows()===void 0&&this.internalSelectedRows.set(e),this.onSelectionChange()?.({selectedRowIds:Array.from(e),selectedItems:this.displayItems()});},deselectAll:()=>{this.selectedRows()===void 0&&this.internalSelectedRows.set(new Set),this.onSelectionChange()?.({selectedRowIds:[],selectedItems:[]});},clearFilters:()=>this.setFilters({}),clearSort:()=>this.setSort({field:this.defaultSortField(),direction:this.defaultSortDirection()}),resetGridState:e=>{this.setFilters({}),this.setSort({field:this.defaultSortField(),direction:this.defaultSortDirection()}),e?.keepSelection||(this.selectedRows()===void 0&&this.internalSelectedRows.set(new Set),this.onSelectionChange()?.({selectedRowIds:[],selectedItems:[]}));},getDisplayedRows:()=>this.displayItems(),refreshData:()=>{this.isServerSide()&&this.refreshCounter.update(e=>e+1);},getColumnOrder:()=>this.columnOrder()??this.columns().map(e=>e.columnId),setColumnOrder:e=>{this.onColumnOrderChange()?.(e);},scrollToRow:(e,t)=>{}}}};ie=l([Injectable()],ie);var Re=class{constructor(e,t,n){this.containerWidthSig=signal(0);this.columnSizingOverridesSig=signal({});this.resizeObserver=null;this.props=e,this.wrapperEl=t,this.initialColumnWidthsSig=computed(()=>this.props()?.initialColumnWidths),this.flatColumnsRaw=computed(()=>{let i=this.props();return i?flattenColumns(i.columns):[]}),this.flatColumns=computed(()=>{let i=this.flatColumnsRaw(),r=this.props()?.pinnedColumns;return !r||Object.keys(r).length===0?i:i.map(s=>{let u=r[s.columnId];return u&&s.pinned!==u?{...s,pinned:u}:s})}),this.visibleCols=computed(()=>{let i=this.props();if(!i)return [];let o=this.flatColumns(),r=i.visibleColumns?o.filter(d=>i.visibleColumns.has(d.columnId)):o,s,u=i.columnOrder;if(!u?.length)s=r;else {let d=new Map;for(let c=0;c<u.length;c++)d.set(u[c],c);s=[...r].sort((c,m)=>{let f=d.get(c.columnId)??-1,b=d.get(m.columnId)??-1;return f===-1&&b===-1?0:f===-1?1:b===-1?-1:f-b});}return applyResponsiveHiding(s,this.containerWidthSig(),resolveResponsiveConfig(i.responsiveColumns))}),this.visibleColumnCount=computed(()=>this.visibleCols().length),this.hasCheckboxCol=computed(()=>(this.props()?.rowSelection??"none")==="multiple"),this.hasRowNumbersCol=computed(()=>!!this.props()?.showRowNumbers),this.specialColsCount=computed(()=>(this.hasCheckboxCol()?1:0)+(this.hasRowNumbersCol()?1:0)),this.totalColCount=computed(()=>this.visibleColumnCount()+this.specialColsCount()),this.colOffset=computed(()=>this.specialColsCount()),this.rowIndexByRowId=computed(()=>{let i=this.props();if(!i)return new Map;let o=new Map;return i.items.forEach((r,s)=>o.set(i.getRowId(r),s)),o}),this.minTableWidth=computed(()=>{let i=this.hasCheckboxCol()?CHECKBOX_COLUMN_WIDTH:0;return this.visibleCols().reduce((o,r)=>o+(r.minWidth??DEFAULT_MIN_COLUMN_WIDTH)+CELL_PADDING,i)}),this.desiredTableWidth=computed(()=>{let i=this.hasCheckboxCol()?CHECKBOX_COLUMN_WIDTH:0,o=this.columnSizingOverridesSig();return this.visibleCols().reduce((r,s)=>{let u=o[s.columnId],d=u?u.widthPx:s.idealWidth??s.defaultWidth??s.minWidth??DEFAULT_MIN_COLUMN_WIDTH;return r+Math.max(s.minWidth??DEFAULT_MIN_COLUMN_WIDTH,d)+CELL_PADDING},i)}),effect(()=>{let i=this.initialColumnWidthsSig();if(i){let o={};for(let[r,s]of Object.entries(i))o[r]={widthPx:s};this.columnSizingOverridesSig.set(o);}}),effect(()=>{let i=this.wrapperEl();if(this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),!i)return;let o=()=>{let r=i.getBoundingClientRect(),s=window.getComputedStyle(i),u=(parseFloat(s.borderLeftWidth||"0")||0)+(parseFloat(s.borderRightWidth||"0")||0);this.containerWidthSig.set(Math.max(0,r.width-u));};n.runOutsideAngular(()=>{this.resizeObserver=new ResizeObserver(o),this.resizeObserver.observe(i);}),o();}),effect(()=>{let i=new Set(this.flatColumns().map(o=>o.columnId));this.columnSizingOverridesSig.update(o=>{let r={},s=false;for(let[u,d]of Object.entries(o))i.has(u)?r[u]=d:s=true;return s?r:o});});}destroy(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null);}};var we=class{constructor(e,t,n,i,o,r){this.editingCellSig=signal(null);this.pendingEditorValueSig=signal(void 0);this.popoverAnchorElSig=signal(null);this.getVisibleCols=e,this.getItems=t,this.getWrappedOnCellValueChanged=n,this.setActiveCellFn=i,this.setSelectionRangeFn=o,this.getColOffset=r;}setEditingCell(e){this.editingCellSig.set(e);}setPendingEditorValue(e){this.pendingEditorValueSig.set(e);}commitCellEdit(e,t,n,i,o,r){let s=this.getVisibleCols().find(c=>c.columnId===t);if(s){let c=parseValue(i,n,e,s);if(!c.valid){this.editingCellSig.set(null),this.popoverAnchorElSig.set(null),this.pendingEditorValueSig.set(void 0);return}i=c.value;}this.getWrappedOnCellValueChanged()?.({item:e,columnId:t,oldValue:n,newValue:i,rowIndex:o}),this.editingCellSig.set(null),this.popoverAnchorElSig.set(null),this.pendingEditorValueSig.set(void 0);let d=this.getItems();if(o<d.length-1){let c=o+1,m=r-this.getColOffset();this.setActiveCellFn({rowIndex:c,columnIndex:r}),this.setSelectionRangeFn({startRow:c,startCol:m,endRow:c,endCol:m});}}cancelPopoverEdit(){this.editingCellSig.set(null),this.popoverAnchorElSig.set(null),this.pendingEditorValueSig.set(void 0);}};var Ie=class{constructor(){this.activeCellSig=signal(null);this.selectionRangeSig=signal(null);this.isDraggingSig=signal(false);this.contextMenuPositionSig=signal(null);this.cutRangeSig=signal(null);this.copyRangeSig=signal(null);this.internalClipboard=null;this.undoRedoStack=new UndoRedoStack(100);this.undoLengthSig=signal(0);this.redoLengthSig=signal(0);this.canUndo=computed(()=>this.undoLengthSig()>0);this.canRedo=computed(()=>this.redoLengthSig()>0);this.hasCellSelection=computed(()=>this.selectionRangeSig()!=null||this.activeCellSig()!=null);this.fillDragStart=null;this.fillRafId=0;this.fillMoveHandler=null;this.fillUpHandler=null;this.dragStartPos=null;this.dragMoved=false;this.isDraggingRef=false;this.liveDragRange=null;this.rafId=0;this.lastMousePos=null;this.autoScrollInterval=null;}setActiveCell(e){let t=this.activeCellSig();t!==e&&(t&&e&&t.rowIndex===e.rowIndex&&t.columnIndex===e.columnIndex||this.activeCellSig.set(e));}setSelectionRange(e){let t=this.selectionRangeSig();rangesEqual(t,e)||this.selectionRangeSig.set(e);}setContextMenuPosition(e){this.contextMenuPositionSig.set(e);}handleCellContextMenu(e){e.preventDefault?.(),this.contextMenuPositionSig.set({x:e.clientX,y:e.clientY});}closeContextMenu(){this.contextMenuPositionSig.set(null);}handleCopy(e,t,n){let i=this.getEffectiveRange(n);if(i==null)return;let o=normalizeSelectionRange(i),r=formatSelectionAsTsv(e,t,o);this.internalClipboard=r,this.copyRangeSig.set(o),navigator.clipboard.writeText(r).catch(()=>{});}handleCut(e,t,n,i,o){if(i===false)return;let r=this.getEffectiveRange(n);if(r==null||!o)return;let s=normalizeSelectionRange(r);this.cutRangeSig.set(s),this.copyRangeSig.set(null),this.handleCopy(e,t,n),this.copyRangeSig.set(null);}async handlePaste(e,t,n,i,o){if(i===false||!o)return;let r;try{r=await navigator.clipboard.readText();}catch{r="";}if(!r.trim()&&this.internalClipboard!=null&&(r=this.internalClipboard),!r.trim())return;let s=this.getEffectiveRange(n),u=s?s.startRow:0,d=s?s.startCol:0,c=parseTsvClipboard(r);this.beginBatch();for(let f=0;f<c.length;f++){let b=c[f];for(let R=0;R<b.length;R++){let v=u+f,V=d+R;if(v>=e.length||V>=t.length)continue;let D=e[v],C=t[V];if(!(C.editable===true||typeof C.editable=="function"&&C.editable(D)))continue;let _=b[R]??"",O=getCellValue(D,C),w=parseValue(_,O,D,C);w.valid&&o({item:D,columnId:C.columnId,oldValue:O,newValue:w.value,rowIndex:v});}}let m=this.cutRangeSig();if(m){for(let f=m.startRow;f<=m.endRow;f++)for(let b=m.startCol;b<=m.endCol;b++){if(f>=e.length||b>=t.length)continue;let R=e[f],v=t[b];if(!(v.editable===true||typeof v.editable=="function"&&v.editable(R)))continue;let D=getCellValue(R,v),C=parseValue("",D,R,v);C.valid&&o({item:R,columnId:v.columnId,oldValue:D,newValue:C.value,rowIndex:f});}this.cutRangeSig.set(null);}this.endBatch(),this.copyRangeSig.set(null);}clearClipboardRanges(){this.copyRangeSig.set(null),this.cutRangeSig.set(null);}beginBatch(){this.undoRedoStack.beginBatch();}endBatch(){this.undoRedoStack.endBatch(),this.undoLengthSig.set(this.undoRedoStack.historyLength),this.redoLengthSig.set(this.undoRedoStack.redoLength);}undo(e){if(!e)return;let t=this.undoRedoStack.undo();if(t){this.undoLengthSig.set(this.undoRedoStack.historyLength),this.redoLengthSig.set(this.undoRedoStack.redoLength);for(let n=t.length-1;n>=0;n--){let i=t[n];e({...i,oldValue:i.newValue,newValue:i.oldValue});}}}redo(e){if(!e)return;let t=this.undoRedoStack.redo();if(t){this.undoLengthSig.set(this.undoRedoStack.historyLength),this.redoLengthSig.set(this.undoRedoStack.redoLength);for(let n of t)e(n);}}handleCellMouseDown(e,t,n,i,o){if(e.button!==0||(o?.focus({preventScroll:true}),this.clearClipboardRanges(),n<i))return;e.preventDefault();let r=n-i,s=this.selectionRangeSig();if(e.shiftKey&&s!=null)this.setSelectionRange(normalizeSelectionRange({startRow:s.startRow,startCol:s.startCol,endRow:t,endCol:r})),this.setActiveCell({rowIndex:t,columnIndex:n});else {this.dragStartPos={row:t,col:r},this.dragMoved=false;let u={startRow:t,startCol:r,endRow:t,endCol:r};this.setSelectionRange(u),this.liveDragRange=u,this.setActiveCell({rowIndex:t,columnIndex:n}),this.isDraggingRef=true;}}handleSelectAllCells(e,t,n){e===0||t===0||(this.setSelectionRange({startRow:0,startCol:0,endRow:e-1,endCol:t-1}),this.setActiveCell({rowIndex:0,columnIndex:n}));}handleFillHandleMouseDown(e){e.preventDefault(),e.stopPropagation();let t=this.selectionRangeSig();t&&(this.fillDragStart={startRow:t.startRow,startCol:t.startCol});}handleGridKeyDown(e,t,n,i,o,r,s,u,d,c,m,f,b,R,v,V,D){if(D&&(D(e),e.defaultPrevented))return;let C=this.activeCellSig(),I=this.selectionRangeSig(),_=t.length-1,O=s-1+o;if(t.length===0)return;if(C===null){["ArrowDown","ArrowUp","ArrowLeft","ArrowRight","Tab","Enter","Home","End","PageDown","PageUp"].includes(e.key)&&(this.setActiveCell({rowIndex:0,columnIndex:o}),e.preventDefault());return}let{rowIndex:w,columnIndex:G}=C,x=G-o,Se=e.shiftKey,B=e.ctrlKey||e.metaKey,Ae=(g,y)=>{if(g<0||g>=t.length||y<0||y>=i.length)return true;let P=getCellValue(t[g],i[y]);return P==null||P===""},ke=findCtrlArrowTarget;switch(e.key){case "c":if(B){if(v!=null)break;e.preventDefault(),this.handleCopy(t,i,o);}break;case "x":if(B){if(v!=null)break;e.preventDefault(),this.handleCut(t,i,o,u,d);}break;case "v":if(B){if(v!=null)break;e.preventDefault(),this.handlePaste(t,i,o,u,d);}break;case "d":if(B){if(v!=null)break;if(u!==false&&d!=null){let g=I??(C!=null?{startRow:C.rowIndex,startCol:C.columnIndex-o,endRow:C.rowIndex,endCol:C.columnIndex-o}:null);if(g!=null){e.preventDefault();let y=normalizeSelectionRange(g),P=applyFillValues(y,y.startRow,y.startCol,t,i);if(P.length>0){this.undoRedoStack.beginBatch();for(let te of P)d(te);this.undoRedoStack.endBatch(),this.undoLengthSig.set(this.undoRedoStack.historyLength),this.redoLengthSig.set(this.undoRedoStack.redoLength);}}}}break;case "ArrowDown":{if(v!=null)break;e.preventDefault();let g=B?ke(w,_,1,y=>Ae(y,Math.max(0,x))):Math.min(w+1,_);Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:g,endCol:I?.endCol??x})):this.setSelectionRange({startRow:g,startCol:x,endRow:g,endCol:x}),this.setActiveCell({rowIndex:g,columnIndex:G});break}case "ArrowUp":{if(v!=null)break;e.preventDefault();let g=B?ke(w,0,-1,y=>Ae(y,Math.max(0,x))):Math.max(w-1,0);Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:g,endCol:I?.endCol??x})):this.setSelectionRange({startRow:g,startCol:x,endRow:g,endCol:x}),this.setActiveCell({rowIndex:g,columnIndex:G});break}case "ArrowRight":{if(v!=null)break;e.preventDefault();let g;B&&x>=0?g=ke(x,i.length-1,1,P=>Ae(w,P))+o:g=Math.min(G+1,O);let y=g-o;Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:I?.endRow??w,endCol:y})):this.setSelectionRange({startRow:w,startCol:y,endRow:w,endCol:y}),this.setActiveCell({rowIndex:w,columnIndex:g});break}case "ArrowLeft":{if(v!=null)break;e.preventDefault();let g;B&&x>=0?g=ke(x,0,-1,P=>Ae(w,P))+o:g=Math.max(G-1,o);let y=g-o;Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:I?.endRow??w,endCol:y})):this.setSelectionRange({startRow:w,startCol:y,endRow:w,endCol:y}),this.setActiveCell({rowIndex:w,columnIndex:g});break}case "Tab":{e.preventDefault();let g=computeTabNavigation(w,G,_,O,o,e.shiftKey),y=g.columnIndex-o;this.setSelectionRange({startRow:g.rowIndex,startCol:y,endRow:g.rowIndex,endCol:y}),this.setActiveCell({rowIndex:g.rowIndex,columnIndex:g.columnIndex});break}case "Home":{e.preventDefault();let g=B?0:w;this.setSelectionRange({startRow:g,startCol:0,endRow:g,endCol:0}),this.setActiveCell({rowIndex:g,columnIndex:o});break}case "End":{e.preventDefault();let g=B?_:w;this.setSelectionRange({startRow:g,startCol:s-1,endRow:g,endCol:s-1}),this.setActiveCell({rowIndex:g,columnIndex:O});break}case "PageDown":case "PageUp":{e.preventDefault();let g=10,y=36;if(b){let Ue=b.querySelector("tbody tr");Ue&&Ue.offsetHeight>0&&(y=Ue.offsetHeight,g=Math.max(1,Math.floor(b.clientHeight/y)));}let P=e.key==="PageDown"?1:-1,te=Math.max(0,Math.min(w+P*g,_));Se?this.setSelectionRange(normalizeSelectionRange({startRow:I?.startRow??w,startCol:I?.startCol??x,endRow:te,endCol:I?.endCol??x})):this.setSelectionRange({startRow:te,startCol:x,endRow:te,endCol:x}),this.setActiveCell({rowIndex:te,columnIndex:G}),b&&(b.scrollTop=getScrollTopForRow(te,y,b.clientHeight,"center"));break}case "Enter":case "F2":{if(e.preventDefault(),x>=0&&x<i.length){let g=i[x],y=t[w];if(y&&g){let P=g.editable===true||typeof g.editable=="function"&&g.editable(y);u!==false&&P&&d!=null&&V({rowId:n(y),columnId:g.columnId});}}break}case "Escape":e.preventDefault(),v!=null?V(null):(this.clearClipboardRanges(),this.setActiveCell(null),this.setSelectionRange(null));break;case " ":if(m!=="none"&&G===0&&r){e.preventDefault();let g=t[w];if(g){let y=n(g),P=f.has(y);R(y,!P,w,e.shiftKey);}}break;case "z":B&&v==null&&(e.shiftKey?(e.preventDefault(),this.redo(c)):(e.preventDefault(),this.undo(c)));break;case "y":B&&v==null&&(e.preventDefault(),this.redo(c));break;case "a":if(B){if(v!=null)break;e.preventDefault(),t.length>0&&s>0&&(this.setSelectionRange({startRow:0,startCol:0,endRow:t.length-1,endCol:s-1}),this.setActiveCell({rowIndex:0,columnIndex:o}));}break;case "Delete":case "Backspace":{if(v!=null||u===false||d==null)break;let g=I??(C!=null?{startRow:C.rowIndex,startCol:C.columnIndex-o,endRow:C.rowIndex,endCol:C.columnIndex-o}:null);if(g==null)break;e.preventDefault();let y=applyCellDeletion(normalizeSelectionRange(g),t,i);for(let P of y)d(P);break}case "F10":if(e.shiftKey)if(e.preventDefault(),C!=null&&b){let g=`[data-row-index="${C.rowIndex}"][data-col-index="${C.columnIndex}"]`,y=b.querySelector(g);if(y){let P=y.getBoundingClientRect();this.setContextMenuPosition({x:P.left+P.width/2,y:P.top+P.height/2});}else this.setContextMenuPosition({x:100,y:100});}else this.setContextMenuPosition({x:100,y:100});break;}}onWindowMouseMove(e,t,n){!this.isDraggingRef||!this.dragStartPos||(this.dragMoved||(this.dragMoved=true,this.isDraggingSig.set(true)),this.lastMousePos={cx:e.clientX,cy:e.clientY},this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=0;let i=this.lastMousePos;if(!i)return;let o=this.resolveRangeFromMouse(i.cx,i.cy,t);if(!o)return;let r=this.liveDragRange;r&&r.startRow===o.startRow&&r.startCol===o.startCol&&r.endRow===o.endRow&&r.endCol===o.endCol||(this.liveDragRange=o,this.applyDragAttrs(o,t,n));}));}onWindowMouseUp(e,t){if(!this.isDraggingRef)return;this.autoScrollInterval&&(clearInterval(this.autoScrollInterval),this.autoScrollInterval=null),this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=0),this.isDraggingRef=false;let n=this.dragMoved;if(n){let i=this.lastMousePos;if(i){let r=this.resolveRangeFromMouse(i.cx,i.cy,e);r&&(this.liveDragRange=r);}let o=this.liveDragRange;if(o){this.setSelectionRange(o);let r=this.dragStartPos;r&&this.setActiveCell({rowIndex:r.row,columnIndex:r.col+e});}}this.clearDragAttrs(t),this.liveDragRange=null,this.lastMousePos=null,this.dragStartPos=null,n&&this.isDraggingSig.set(false);}resolveRangeFromMouse(e,t,n){if(!this.dragStartPos)return null;let o=document.elementFromPoint(e,t)?.closest?.("[data-row-index][data-col-index]");if(!o)return null;let r=parseInt(o.getAttribute("data-row-index")??"",10),s=parseInt(o.getAttribute("data-col-index")??"",10);if(Number.isNaN(r)||Number.isNaN(s)||s<n)return null;let u=s-n,d=this.dragStartPos;return normalizeSelectionRange({startRow:d.row,startCol:d.col,endRow:r,endCol:u})}applyDragAttrs(e,t,n){if(!n)return;let i=Math.min(e.startRow,e.endRow),o=Math.max(e.startRow,e.endRow),r=Math.min(e.startCol,e.endCol),s=Math.max(e.startCol,e.endCol),u=n.querySelectorAll("[data-row-index][data-col-index]");for(let d=0;d<u.length;d++){let c=u[d],m=parseInt(c.getAttribute("data-row-index")??"",10),f=parseInt(c.getAttribute("data-col-index")??"",10)-t;m>=i&&m<=o&&f>=r&&f<=s?c.hasAttribute("data-drag-range")||c.setAttribute("data-drag-range",""):c.hasAttribute("data-drag-range")&&c.removeAttribute("data-drag-range");}}clearDragAttrs(e){if(!e)return;let t=e.querySelectorAll("[data-drag-range]");for(let n=0;n<t.length;n++)t[n].removeAttribute("data-drag-range");}getEffectiveRange(e){let t=this.selectionRangeSig(),n=this.activeCellSig();return t??(n!=null?{startRow:n.rowIndex,startCol:n.columnIndex-e,endRow:n.rowIndex,endCol:n.columnIndex-e}:null)}destroy(){this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=0),this.fillRafId&&(cancelAnimationFrame(this.fillRafId),this.fillRafId=0),this.autoScrollInterval&&(clearInterval(this.autoScrollInterval),this.autoScrollInterval=null),this.fillMoveHandler&&(window.removeEventListener("pointermove",this.fillMoveHandler,true),this.fillMoveHandler=null),this.fillUpHandler&&(window.removeEventListener("pointerup",this.fillUpHandler,true),this.fillUpHandler=null),this.undoRedoStack.clear();}};var xe=()=>{},Fn=async()=>{},On=(p,e,t)=>{},An=p=>{},kn=p=>{},oe=class{constructor(){this.destroyRef=inject(DestroyRef);this.ngZone=inject(NgZone);this.props=signal(null);this.wrapperEl=signal(null);this.internalSelectedRows=signal(new Set);this.lastClickedRow=-1;this.headerMenuIsOpenSig=signal(false);this.headerMenuOpenForColumnSig=signal(null);this.headerMenuAnchorElementSig=signal(null);this.propsResolved=computed(()=>{let e=this.props();if(!e)throw new Error("DataGridStateService: props must be set before use");return e});this.cellSelection=computed(()=>{let e=this.props();return e?e.cellSelection!==false:true});this.originalOnCellValueChanged=computed(()=>this.props()?.onCellValueChanged);this.wrappedOnCellValueChanged=computed(()=>{let e=this.originalOnCellValueChanged();if(e)return t=>{this.interactionHelper.undoRedoStack.record(t),this.interactionHelper.undoRedoStack.isBatching||(this.interactionHelper.undoLengthSig.set(this.interactionHelper.undoRedoStack.historyLength),this.interactionHelper.redoLengthSig.set(this.interactionHelper.undoRedoStack.redoLength)),e(t);}});this.flatColumnsRaw=computed(()=>this.layoutHelper.flatColumnsRaw());this.flatColumns=computed(()=>this.layoutHelper.flatColumns());this.visibleCols=computed(()=>this.layoutHelper.visibleCols());this.visibleColumnCount=computed(()=>this.layoutHelper.visibleColumnCount());this.hasCheckboxCol=computed(()=>this.layoutHelper.hasCheckboxCol());this.hasRowNumbersCol=computed(()=>this.layoutHelper.hasRowNumbersCol());this.specialColsCount=computed(()=>this.layoutHelper.specialColsCount());this.totalColCount=computed(()=>this.layoutHelper.totalColCount());this.colOffset=computed(()=>this.layoutHelper.colOffset());this.rowIndexByRowId=computed(()=>this.layoutHelper.rowIndexByRowId());this.selectedRowIds=computed(()=>{let e=this.props();if(!e)return new Set;let t=e.selectedRows;return t!=null?t instanceof Set?t:new Set(t):this.internalSelectedRows()});this.allSelected=computed(()=>{let e=this.props();if(!e||e.items.length===0)return false;let t=this.selectedRowIds();return t.size!==e.items.length?false:e.items.every(n=>t.has(e.getRowId(n)))});this.someSelected=computed(()=>{let e=this.props();if(!e)return false;let t=this.selectedRowIds();return !this.allSelected()&&e.items.some(n=>t.has(e.getRowId(n)))});this.hasCellSelection=computed(()=>this.interactionHelper.hasCellSelection());this.canUndo=computed(()=>this.interactionHelper.canUndo());this.canRedo=computed(()=>this.interactionHelper.canRedo());this.minTableWidth=computed(()=>this.layoutHelper.minTableWidth());this.desiredTableWidth=computed(()=>this.layoutHelper.desiredTableWidth());this.aggregation=computed(()=>{let e=this.props();return e?computeAggregations(e.items,this.visibleCols(),this.cellSelection()?this.interactionHelper.selectionRangeSig():null):null});this.statusBarConfig=computed(()=>{let e=this.props();if(!e)return null;let t=getDataGridStatusBarConfig(e.statusBar,e.items.length,this.selectedRowIds().size);return t?{...t,aggregation:this.aggregation()??void 0}:null});this.showEmptyInGrid=computed(()=>{let e=this.props();return e?e.items.length===0&&!!e.emptyState&&!e.isLoading:false});this._setColumnSizingOverrides=e=>this.layoutHelper.columnSizingOverridesSig.set(e);this._updateSelection=e=>this.updateSelection(e);this._handleRowCheckboxChange=(e,t,n,i)=>this.handleRowCheckboxChange(e,t,n,i);this._handleSelectAll=e=>this.handleSelectAll(e);this._setEditingCell=e=>this.setEditingCell(e);this._setPendingEditorValue=e=>this.setPendingEditorValue(e);this._commitCellEdit=(e,t,n,i,o,r)=>this.commitCellEdit(e,t,n,i,o,r);this._cancelPopoverEdit=()=>this.cancelPopoverEdit();this._setPopoverAnchorEl=e=>this.editingHelper.popoverAnchorElSig.set(e);this._setActiveCell=e=>this.setActiveCell(e);this._setSelectionRange=e=>this.setSelectionRange(e);this._handleCellMouseDown=(e,t,n)=>this.handleCellMouseDown(e,t,n);this._handleSelectAllCells=()=>this.handleSelectAllCells();this._handleGridKeyDown=e=>this.handleGridKeyDown(e);this._handleFillHandleMouseDown=e=>this.handleFillHandleMouseDown(e);this._handleCopy=()=>this.handleCopy();this._handleCut=()=>this.handleCut();this._handlePaste=()=>this.handlePaste();this._clearClipboardRanges=()=>this.clearClipboardRanges();this._onUndo=()=>this.undo();this._onRedo=()=>this.redo();this._setContextMenuPosition=e=>this.setContextMenuPosition(e);this._handleCellContextMenu=e=>this.handleCellContextMenu(e);this._closeContextMenu=()=>this.closeContextMenu();this._headerFilterOnColumnSort=(e,t)=>this.props()?.onColumnSort(e,t);this._headerFilterOnFilterChange=(e,t)=>this.props()?.onFilterChange(e,t);this._pinColumn=(e,t)=>this.pinColumn(e,t);this._unpinColumn=e=>this.unpinColumn(e);this._isPinned=e=>this.isPinned(e);this._openHeaderMenu=(e,t)=>this.openHeaderMenu(e,t);this._closeHeaderMenu=()=>this.closeHeaderMenu();this._headerMenuPinLeft=()=>this.headerMenuPinLeft();this._headerMenuPinRight=()=>this.headerMenuPinRight();this._headerMenuUnpin=()=>this.headerMenuUnpin();this.layoutHelper=new Re(this.props,this.wrapperEl,this.ngZone),this.interactionHelper=new Ie,this.editingHelper=new we(()=>this.visibleCols(),()=>this.props()?.items??[],()=>this.wrappedOnCellValueChanged(),e=>this.setActiveCell(e),e=>this.setSelectionRange(e),()=>this.colOffset()),effect(e=>{let t=i=>this.onWindowMouseMove(i),n=()=>this.onWindowMouseUp();this.ngZone.runOutsideAngular(()=>{window.addEventListener("pointermove",t,true),window.addEventListener("pointerup",n,true);}),e(()=>{window.removeEventListener("pointermove",t,true),window.removeEventListener("pointerup",n,true);});}),this.destroyRef.onDestroy(()=>{this.interactionHelper.destroy(),this.layoutHelper.destroy();});}updateSelection(e){let t=this.props();t&&(t.selectedRows===void 0&&this.internalSelectedRows.set(e),t.onSelectionChange?.({selectedRowIds:Array.from(e),selectedItems:t.items.filter(n=>e.has(t.getRowId(n)))}));}handleRowCheckboxChange(e,t,n,i){let o=this.props();if(!o)return;if((o.rowSelection??"none")==="single"){this.updateSelection(t?new Set([e]):new Set),this.lastClickedRow=n;return}let s=new Set(this.selectedRowIds());if(i&&this.lastClickedRow>=0&&this.lastClickedRow!==n){let u=Math.min(this.lastClickedRow,n),d=Math.max(this.lastClickedRow,n);for(let c=u;c<=d;c++)if(c<o.items.length){let m=o.getRowId(o.items[c]);t?s.add(m):s.delete(m);}}else t?s.add(e):s.delete(e);this.lastClickedRow=n,this.updateSelection(s);}handleSelectAll(e){let t=this.props();t&&(e?this.updateSelection(new Set(t.items.map(n=>t.getRowId(n)))):this.updateSelection(new Set));}setEditingCell(e){this.editingHelper.setEditingCell(e);}setPendingEditorValue(e){this.editingHelper.setPendingEditorValue(e);}setActiveCell(e){this.interactionHelper.setActiveCell(e);}setSelectionRange(e){this.interactionHelper.setSelectionRange(e);}commitCellEdit(e,t,n,i,o,r){this.editingHelper.commitCellEdit(e,t,n,i,o,r);}cancelPopoverEdit(){this.editingHelper.cancelPopoverEdit();}handleCellMouseDown(e,t,n){this.interactionHelper.handleCellMouseDown(e,t,n,this.colOffset(),this.wrapperEl());}handleSelectAllCells(){let e=this.props();e&&this.interactionHelper.handleSelectAllCells(e.items.length,this.visibleColumnCount(),this.colOffset());}setContextMenuPosition(e){this.interactionHelper.setContextMenuPosition(e);}handleCellContextMenu(e){this.interactionHelper.handleCellContextMenu(e);}closeContextMenu(){this.interactionHelper.closeContextMenu();}handleCopy(){let e=this.props();e&&this.interactionHelper.handleCopy(e.items,this.visibleCols(),this.colOffset());}handleCut(){let e=this.props();e&&this.interactionHelper.handleCut(e.items,this.visibleCols(),this.colOffset(),e.editable,this.wrappedOnCellValueChanged());}async handlePaste(){let e=this.props();e&&await this.interactionHelper.handlePaste(e.items,this.visibleCols(),this.colOffset(),e.editable,this.wrappedOnCellValueChanged());}clearClipboardRanges(){this.interactionHelper.clearClipboardRanges();}beginBatch(){this.interactionHelper.beginBatch();}endBatch(){this.interactionHelper.endBatch();}undo(){let e=this.props();this.interactionHelper.undo(e?.onCellValueChanged);}redo(){let e=this.props();this.interactionHelper.redo(e?.onCellValueChanged);}handleGridKeyDown(e){let t=this.props();t&&this.interactionHelper.handleGridKeyDown(e,t.items,t.getRowId,this.visibleCols(),this.colOffset(),this.hasCheckboxCol(),this.visibleColumnCount(),t.editable,this.wrappedOnCellValueChanged(),t.onCellValueChanged,t.rowSelection??"none",this.selectedRowIds(),this.wrapperEl(),(n,i,o,r)=>this.handleRowCheckboxChange(n,i,o,r),this.editingHelper.editingCellSig(),n=>this.setEditingCell(n),t.onKeyDown);}handleFillHandleMouseDown(e){this.interactionHelper.handleFillHandleMouseDown(e),this.setupFillHandleDrag();}pinColumn(e,t){this.props()?.onColumnPinned?.(e,t);}unpinColumn(e){this.props()?.onColumnPinned?.(e,null);}isPinned(e){return this.props()?.pinnedColumns?.[e]}getPinState(e){let t=this.isPinned(e);return {canPinLeft:t!=="left",canPinRight:t!=="right",canUnpin:!!t}}openHeaderMenu(e,t){this.headerMenuOpenForColumnSig.set(e),this.headerMenuAnchorElementSig.set(t),this.headerMenuIsOpenSig.set(true);}closeHeaderMenu(){this.headerMenuIsOpenSig.set(false),this.headerMenuOpenForColumnSig.set(null),this.headerMenuAnchorElementSig.set(null);}headerMenuPinLeft(){let e=this.headerMenuOpenForColumnSig();e&&this.isPinned(e)!=="left"&&(this.pinColumn(e,"left"),this.closeHeaderMenu());}headerMenuPinRight(){let e=this.headerMenuOpenForColumnSig();e&&this.isPinned(e)!=="right"&&(this.pinColumn(e,"right"),this.closeHeaderMenu());}headerMenuUnpin(){let e=this.headerMenuOpenForColumnSig();e&&this.isPinned(e)&&(this.unpinColumn(e),this.closeHeaderMenu());}getState(){let e=this.props(),t=this.cellSelection(),n={flatColumns:this.flatColumns(),visibleCols:this.visibleCols(),visibleColumnCount:this.visibleColumnCount(),totalColCount:this.totalColCount(),colOffset:this.colOffset(),hasCheckboxCol:this.hasCheckboxCol(),hasRowNumbersCol:this.hasRowNumbersCol(),rowIndexByRowId:this.rowIndexByRowId(),containerWidth:this.layoutHelper.containerWidthSig(),minTableWidth:this.minTableWidth(),desiredTableWidth:this.desiredTableWidth(),columnSizingOverrides:this.layoutHelper.columnSizingOverridesSig(),setColumnSizingOverrides:this._setColumnSizingOverrides,onColumnResized:e?.onColumnResized,onAutosizeColumn:e?.onAutosizeColumn},i={selectedRowIds:this.selectedRowIds(),updateSelection:this._updateSelection,handleRowCheckboxChange:this._handleRowCheckboxChange,handleSelectAll:this._handleSelectAll,allSelected:this.allSelected(),someSelected:this.someSelected()},o={editingCell:this.editingHelper.editingCellSig(),setEditingCell:this._setEditingCell,pendingEditorValue:this.editingHelper.pendingEditorValueSig(),setPendingEditorValue:this._setPendingEditorValue,commitCellEdit:this._commitCellEdit,cancelPopoverEdit:this._cancelPopoverEdit,popoverAnchorEl:this.editingHelper.popoverAnchorElSig(),setPopoverAnchorEl:this._setPopoverAnchorEl},r={activeCell:t?this.interactionHelper.activeCellSig():null,setActiveCell:t?this._setActiveCell:void 0,selectionRange:t?this.interactionHelper.selectionRangeSig():null,setSelectionRange:t?this._setSelectionRange:void 0,handleCellMouseDown:t?this._handleCellMouseDown:On,handleSelectAllCells:t?this._handleSelectAllCells:xe,hasCellSelection:t?this.hasCellSelection():false,handleGridKeyDown:t?this._handleGridKeyDown:An,handleFillHandleMouseDown:t?this._handleFillHandleMouseDown:void 0,handleCopy:t?this._handleCopy:xe,handleCut:t?this._handleCut:xe,handlePaste:t?this._handlePaste:Fn,cutRange:t?this.interactionHelper.cutRangeSig():null,copyRange:t?this.interactionHelper.copyRangeSig():null,clearClipboardRanges:t?this._clearClipboardRanges:xe,canUndo:this.canUndo(),canRedo:this.canRedo(),onUndo:this._onUndo,onRedo:this._onRedo,isDragging:t?this.interactionHelper.isDraggingSig():false},s={menuPosition:t?this.interactionHelper.contextMenuPositionSig():null,setMenuPosition:t?this._setContextMenuPosition:void 0,handleCellContextMenu:t?this._handleCellContextMenu:kn,closeContextMenu:t?this._closeContextMenu:xe},u={headerFilterInput:{sortBy:e?.sortBy,sortDirection:e?.sortDirection??"asc",onColumnSort:this._headerFilterOnColumnSort,filters:e?.filters??{},onFilterChange:this._headerFilterOnFilterChange,filterOptions:e?.filterOptions??{},loadingFilterOptions:e?.loadingFilterOptions??{},peopleSearch:e?.peopleSearch},cellDescriptorInput:{editingCell:this.editingHelper.editingCellSig(),activeCell:t?this.interactionHelper.activeCellSig():null,selectionRange:t?this.interactionHelper.selectionRangeSig():null,cutRange:t?this.interactionHelper.cutRangeSig():null,copyRange:t?this.interactionHelper.copyRangeSig():null,colOffset:this.colOffset(),itemsLength:e?.items.length??0,getRowId:e?.getRowId??(f=>f.id),editable:e?.editable,onCellValueChanged:this.wrappedOnCellValueChanged(),isDragging:t?this.interactionHelper.isDraggingSig():false,getFormulaValue:e?.getFormulaValue,hasFormula:e?.hasFormula,getFormula:e?.getFormula,formulaVersion:e?.formulaVersion},statusBarConfig:this.statusBarConfig(),showEmptyInGrid:this.showEmptyInGrid(),onCellError:e?.onCellError},d=this.headerMenuOpenForColumnSig(),c=d?e?.pinnedColumns?.[d]:void 0,m={pinnedColumns:e?.pinnedColumns??{},pinColumn:this._pinColumn,unpinColumn:this._unpinColumn,isPinned:this._isPinned,headerMenu:{isOpen:this.headerMenuIsOpenSig(),openForColumn:d,anchorElement:this.headerMenuAnchorElementSig(),open:this._openHeaderMenu,close:this._closeHeaderMenu,handlePinLeft:this._headerMenuPinLeft,handlePinRight:this._headerMenuPinRight,handleUnpin:this._headerMenuUnpin,canPinLeft:c!=="left",canPinRight:c!=="right",canUnpin:!!c}};return {layout:n,rowSelection:i,editing:o,interaction:r,contextMenu:s,viewModels:u,pinning:m}}onWindowMouseMove(e){this.interactionHelper.onWindowMouseMove(e,this.colOffset(),this.wrapperEl());}onWindowMouseUp(){this.interactionHelper.onWindowMouseUp(this.colOffset(),this.wrapperEl());}setupFillHandleDrag(){let e=this.props(),t=this.interactionHelper.fillDragStart;if(!t||e?.editable===false||!this.wrappedOnCellValueChanged())return;let n=this.colOffset(),i=t,o={endRow:i.startRow,endCol:i.startCol},r=null,s=null,u=(m,f)=>{let R=document.elementFromPoint(m,f)?.closest?.("[data-row-index][data-col-index]"),v=this.wrapperEl();if(!R||!v?.contains(R))return null;let V=parseInt(R.getAttribute("data-row-index")??"",10),D=parseInt(R.getAttribute("data-col-index")??"",10);if(Number.isNaN(V)||Number.isNaN(D)||D<n)return null;let C=D-n;return normalizeSelectionRange({startRow:i.startRow,startCol:i.startCol,endRow:V,endCol:C})},d=m=>{s={cx:m.clientX,cy:m.clientY},this.interactionHelper.fillRafId&&cancelAnimationFrame(this.interactionHelper.fillRafId),this.interactionHelper.fillRafId=requestAnimationFrame(()=>{if(this.interactionHelper.fillRafId=0,!s)return;let f=u(s.cx,s.cy);f&&(r&&r.startRow===f.startRow&&r.startCol===f.startCol&&r.endRow===f.endRow&&r.endCol===f.endCol||(r=f,o={endRow:f.endRow,endCol:f.endCol},this.interactionHelper.applyDragAttrs(f,n,this.wrapperEl())));});},c=()=>{if(window.removeEventListener("pointermove",d,true),window.removeEventListener("pointerup",c,true),this.interactionHelper.fillMoveHandler=null,this.interactionHelper.fillUpHandler=null,this.interactionHelper.fillRafId&&(cancelAnimationFrame(this.interactionHelper.fillRafId),this.interactionHelper.fillRafId=0),s){let D=u(s.cx,s.cy);D&&(r=D,o={endRow:D.endRow,endCol:D.endCol});}this.interactionHelper.clearDragAttrs(this.wrapperEl());let m=normalizeSelectionRange({startRow:i.startRow,startCol:i.startCol,endRow:o.endRow,endCol:o.endCol});if(this.setSelectionRange(m),this.setActiveCell({rowIndex:i.startRow,columnIndex:i.startCol+n}),!e)return;let f=e.items,b=this.visibleCols(),R=f[m.startRow],v=b[m.startCol],V=this.wrappedOnCellValueChanged();if(R&&v&&V){let D=getCellValue(R,v);this.beginBatch();for(let C=m.startRow;C<=m.endRow;C++)for(let I=m.startCol;I<=m.endCol;I++){if(C===i.startRow&&I===i.startCol||C>=f.length||I>=b.length)continue;let _=f[C],O=b[I];if(!(O.editable===true||typeof O.editable=="function"&&O.editable(_)))continue;let G=getCellValue(_,O),x=parseValue(D,G,_,O);x.valid&&V({item:_,columnId:O.columnId,oldValue:G,newValue:x.value,rowIndex:C});}this.endBatch();}this.interactionHelper.fillDragStart=null;};this.interactionHelper.fillMoveHandler=d,this.interactionHelper.fillUpHandler=c,this.ngZone.runOutsideAngular(()=>{window.addEventListener("pointermove",d,true),window.addEventListener("pointerup",c,true);});}};oe=l([Injectable()],oe);var Hn=8,le=class{constructor(){this.destroyRef=inject(DestroyRef);this.columns=signal([]);this.columnOrder=signal(void 0);this.onColumnOrderChange=signal(void 0);this.enabled=signal(true);this.wrapperEl=signal(null);this.isDragging=signal(false);this.dropIndicatorX=signal(null);this.rafId=0;this.cleanupFn=null;this.latestDropTargetIndex=null;this.destroyRef.onDestroy(()=>{this.cleanupFn&&(this.cleanupFn(),this.cleanupFn=null),this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=0);});}handleHeaderMouseDown(e,t){if(!this.enabled()||!this.onColumnOrderChange()||t.button!==0)return;let i=t.currentTarget.getBoundingClientRect();if(t.clientX>i.right-Hn||this.columns().findIndex(b=>b.columnId===e)===-1)return;t.preventDefault();let s=t.clientX,u=false;this.latestDropTargetIndex=null;let d=document.body.style.userSelect;document.body.style.userSelect="none";let c=b=>{!u&&Math.abs(b.clientX-s)<5||(u||(u=true,this.isDragging.set(true)),this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=0;let R=this.wrapperEl();if(!R)return;let v=R.querySelectorAll("th[data-column-id]"),V=[];for(let C=0;C<v.length;C++){let I=v[C],_=I.getAttribute("data-column-id");if(!_)continue;let O=I.getBoundingClientRect();V.push({columnId:_,left:O.left,right:O.right,centerX:O.left+O.width/2});}let D=this.calculateDrop(e,b.clientX,V);this.latestDropTargetIndex=D.dropIndex,this.dropIndicatorX.set(D.indicatorX);}));},m=()=>{window.removeEventListener("pointermove",c,true),window.removeEventListener("pointerup",f,true),this.cleanupFn=null,document.body.style.userSelect=d,this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=0);},f=()=>{if(m(),u&&this.latestDropTargetIndex!=null){let b=this.columnOrder()??this.columns().map(v=>v.columnId),R=reorderColumnArray(b,e,this.latestDropTargetIndex);this.onColumnOrderChange()?.(R);}this.isDragging.set(false),this.dropIndicatorX.set(null);};window.addEventListener("pointermove",c,true),window.addEventListener("pointerup",f,true),this.cleanupFn=m;}calculateDrop(e,t,n){if(n.length===0)return {dropIndex:null,indicatorX:null};let i=this.columnOrder()??this.columns().map(d=>d.columnId),o=i.indexOf(e),r=0,s=null;if(t<=n[0].centerX)r=0,s=n[0].left;else if(t>=n[n.length-1].centerX)r=n.length,s=n[n.length-1].right;else for(let d=0;d<n.length-1;d++)if(t>=n[d].centerX&&t<n[d+1].centerX){r=d+1,s=n[d].right;break}let u=r<n.length?i.indexOf(n[r]?.columnId??""):i.length;return o===u||o+1===u?{dropIndex:u,indicatorX:null}:{dropIndex:u,indicatorX:s}}};le=l([Injectable()],le);var jn=100,ae=class{constructor(){this.destroyRef=inject(DestroyRef);this.totalRows=signal(0);this.config=signal({rowHeight:36});this.containerHeight=signal(0);this.scrollTop=signal(0);this.scrollLeft=signal(0);this.columnWidths=signal([]);this.containerWidth=signal(0);this.containerEl=null;this.rowHeight=computed(()=>this.config().rowHeight??36);this.overscan=computed(()=>this.config().overscan??5);this.enabled=computed(()=>this.config().enabled!==false);this.threshold=computed(()=>this.config().threshold??jn);this.isActive=computed(()=>this.enabled()&&this.totalRows()>=this.threshold());this.visibleRange=computed(()=>this.isActive()?computeVisibleRange(this.scrollTop(),this.rowHeight(),this.containerHeight(),this.totalRows(),this.overscan()):{startIndex:0,endIndex:Math.max(0,this.totalRows()-1),offsetTop:0,offsetBottom:0});this.totalHeight=computed(()=>computeTotalHeight(this.totalRows(),this.rowHeight()));this.columnsEnabled=computed(()=>this.config().columns===true);this.columnOverscan=computed(()=>this.config().columnOverscan??2);this.columnRange=computed(()=>{if(!this.columnsEnabled())return null;let e=this.columnWidths();return e.length===0?null:computeVisibleColumnRange(this.scrollLeft(),e,this.containerWidth(),this.columnOverscan())});this.destroyRef.onDestroy(()=>{this.containerEl=null;});}setContainer(e){this.containerEl=e;}onScroll(e){let t=e.target;this.scrollTop.set(t.scrollTop),this.scrollLeft.set(t.scrollLeft);}scrollToRow(e,t="start"){let n=this.containerEl;if(!n)return;let i=getScrollTopForRow(e,this.rowHeight(),this.containerHeight(),t);n.scrollTo({top:i,behavior:"auto"});}updateConfig(e){this.config.update(t=>{let n={...t,...e};return validateVirtualScrollConfig(n),n});}};ae=l([Injectable()],ae);var Jn={columns:"Columns",filters:"Filters"},Q=class{constructor(){this.sideBarProps=null;this.panelLabels=Jn;}onTabClick(e){let t=this.sideBarProps;t&&t.onPanelChange(t.activePanel===e?null:e);}allVisible(){let e=this.sideBarProps;return e?e.columns.every(t=>e.visibleColumns.has(t.columnId)):false}onSelectAll(){let e=this.sideBarProps;if(!e)return;let t=new Set(e.visibleColumns);e.columns.forEach(n=>t.add(n.columnId)),e.onSetVisibleColumns(t);}onClearAll(){let e=this.sideBarProps;if(!e)return;let t=new Set;e.columns.forEach(n=>{n.required&&e.visibleColumns.has(n.columnId)&&t.add(n.columnId);}),e.onSetVisibleColumns(t);}onVisibilityChange(e,t){this.sideBarProps?.onVisibilityChange(e,t);}getTextFilterValue(e){let n=this.sideBarProps?.filters?.[e];return n?.type==="text"?n.value:""}onTextFilterChange(e,t){this.sideBarProps?.onFilterChange(e,t?{type:"text",value:t}:void 0);}getDateFrom(e){let t=this.sideBarProps?.filters?.[e];return t?.type==="date"?t.value.from??"":""}getDateTo(e){let t=this.sideBarProps?.filters?.[e];return t?.type==="date"?t.value.to??"":""}onDateFromChange(e,t){let n=this.sideBarProps?.filters?.[e],i=n?.type==="date"?n.value:{},o=t||void 0,r=i.to;this.sideBarProps?.onFilterChange(e,o||r?{type:"date",value:{from:o,to:r}}:void 0);}onDateToChange(e,t){let n=this.sideBarProps?.filters?.[e],i=n?.type==="date"?n.value:{},o=t||void 0,r=i.from;this.sideBarProps?.onFilterChange(e,r||o?{type:"date",value:{from:r,to:o}}:void 0);}getFilterOptions(e){return this.sideBarProps?.filterOptions?.[e]??[]}isMultiSelectChecked(e,t){let n=this.sideBarProps?.filters?.[e];return n?.type==="multiSelect"?n.value.includes(t):false}onMultiSelectChange(e,t,n){let i=this.sideBarProps?.filters?.[e],o=i?.type==="multiSelect"?i.value:[],r=n?[...o,t]:o.filter(s=>s!==t);this.sideBarProps?.onFilterChange(e,r.length>0?{type:"multiSelect",value:r}:void 0);}};l([Input()],Q.prototype,"sideBarProps",2),Q=l([Component({selector:"ogrid-sidebar",standalone:true,changeDetection:ChangeDetectionStrategy.OnPush,imports:[NgTemplateOutlet],styles:[`
2
2
  .ogrid-sidebar-root { display: flex; flex-direction: row; flex-shrink: 0; }
3
3
  .ogrid-sidebar-tab-strip {
4
4
  display: flex; flex-direction: column;
@@ -627,7 +627,7 @@ import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelect
627
627
  />
628
628
  </svg>
629
629
  }
630
- `})],H);function Oi(p,e,t){let n=e.col+t,i=(e.endCol??e.col)+t,o=e.endRow??e.row,r=p.querySelector(`[data-row-index="${e.row}"][data-col-index="${n}"]`),s=p.querySelector(`[data-row-index="${o}"][data-col-index="${i}"]`);if(!r||!s)return null;let u=p.getBoundingClientRect(),d=r.getBoundingClientRect(),c=s.getBoundingClientRect();return {top:Math.round(d.top-u.top),left:Math.round(d.left-u.left),width:Math.round(c.right-d.left),height:Math.round(c.bottom-d.top),color:FORMULA_REF_COLORS[e.colorIndex%FORMULA_REF_COLORS.length]}}var Ee=class{constructor(){this.containerEl=input(null);this.references=input([]);this.colOffset=input(0);this.rects=signal([]);this.rafId=0;effect(()=>{let e=this.references(),t=this.containerEl(),n=this.colOffset();if(cancelAnimationFrame(this.rafId),!t||e.length===0){this.rects.set([]);return}this.rafId=requestAnimationFrame(()=>{let i=[];for(let o of e){let r=Oi(t,o,n);r&&i.push(r);}this.rects.set(i);});});}max0(e){return Math.max(0,e)}};Ee=l([Component({selector:"ogrid-formula-ref-overlay",standalone:true,encapsulation:ViewEncapsulation.None,changeDetection:ChangeDetectionStrategy.OnPush,template:`
630
+ `})],H);function Ai(p,e,t){let n=e.col+t,i=(e.endCol??e.col)+t,o=e.endRow??e.row,r=p.querySelector(`[data-row-index="${e.row}"][data-col-index="${n}"]`),s=p.querySelector(`[data-row-index="${o}"][data-col-index="${i}"]`);if(!r||!s)return null;let u=p.getBoundingClientRect(),d=r.getBoundingClientRect(),c=s.getBoundingClientRect();return {top:Math.round(d.top-u.top),left:Math.round(d.left-u.left),width:Math.round(c.right-d.left),height:Math.round(c.bottom-d.top),color:FORMULA_REF_COLORS[e.colorIndex%FORMULA_REF_COLORS.length]}}var Ee=class{constructor(){this.containerEl=input(null);this.references=input([]);this.colOffset=input(0);this.rects=signal([]);this.rafId=0;effect(()=>{let e=this.references(),t=this.containerEl(),n=this.colOffset();if(cancelAnimationFrame(this.rafId),!t||e.length===0){this.rects.set([]);return}this.rafId=requestAnimationFrame(()=>{let i=[];for(let o of e){let r=Ai(t,o,n);r&&i.push(r);}this.rects.set(i);});});}max0(e){return Math.max(0,e)}};Ee=l([Component({selector:"ogrid-formula-ref-overlay",standalone:true,encapsulation:ViewEncapsulation.None,changeDetection:ChangeDetectionStrategy.OnPush,template:`
631
631
  @for (r of rects(); track $index) {
632
632
  <svg
633
633
  [style.position]="'absolute'"
@@ -670,7 +670,7 @@ import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelect
670
670
  } @else {
671
671
  There are no items available at this time.
672
672
  }
673
- `})],Z);var Le=class{constructor(){this.propsSignal=signal(void 0);this.ogridService=inject(ie);effect(()=>{let e=this.propsSignal();e&&this.ogridService.configure(e);});}set props(e){this.propsSignal.set(e);}get showToolbar(){return this.ogridService.columnChooserPlacement()==="toolbar"||this.ogridService.toolbar()!=null||this.ogridService.fullScreen()}onPageSizeChange(e){this.ogridService.pagination().setPageSize(e);}};l([Input({required:true})],Le.prototype,"props",1);function Rt(p,e){let t=signal(p());return effect(n=>{let i=p(),o=setTimeout(()=>{t.set(i);},e);n(()=>clearTimeout(o));}),t}function wt(p,e){let t=null;return((...n)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{p(...n),t=null;},e);})}function xt(p){return((...e)=>p()(...e))}var nt=class{constructor(){this.stateService=inject(oe);this.columnReorderService=inject(le);this.virtualScrollService=inject(ae);this.lastMouseShift=false;this.columnSizingVersion=signal(0);this.measureDirty=signal(true);this.measuredColumnWidths=signal({});this.wrapperElSignal=signal(null);this.tableContainerElSignal=signal(null);this.state=computed(()=>this.stateService.getState());this.layoutState=computed(()=>this.state().layout);this.rowSelectionState=computed(()=>this.state().rowSelection);this.editingState=computed(()=>this.state().editing);this.interactionState=computed(()=>this.state().interaction);this.contextMenuState=computed(()=>this.state().contextMenu);this.viewModelsState=computed(()=>this.state().viewModels);this.pinningState=computed(()=>this.state().pinning);this.tableContainerEl=computed(()=>this.tableContainerElSignal());this.items=computed(()=>this.getProps()?.items??[]);this.getRowId=computed(()=>this.getProps()?.getRowId??(e=>e.id));this.isLoading=computed(()=>this.getProps()?.isLoading??false);this.loadingMessage=computed(()=>"Loading\u2026");this.layoutModeFit=computed(()=>(this.getProps()?.layoutMode??"fill")==="content");this.rowHeightCssVar=computed(()=>{let e=this.getProps()?.rowHeight;return e?`${e}px`:null});this.ariaLabel=computed(()=>this.getProps()?.["aria-label"]??"Data grid");this.ariaLabelledBy=computed(()=>this.getProps()?.["aria-labelledby"]);this.stickyHeader=computed(()=>this.getProps()?.stickyHeader??true);this.emptyState=computed(()=>this.getProps()?.emptyState);this.currentPage=computed(()=>this.getProps()?.currentPage??1);this.pageSize=computed(()=>this.getProps()?.pageSize??25);this.rowNumberOffset=computed(()=>this.hasRowNumbersCol()?(this.currentPage()-1)*this.pageSize():0);this.propsVisibleColumns=computed(()=>this.getProps()?.visibleColumns);this.propsColumnOrder=computed(()=>this.getProps()?.columnOrder);this.visibleCols=computed(()=>this.layoutState().visibleCols);this.hasCheckboxCol=computed(()=>this.layoutState().hasCheckboxCol);this.hasRowNumbersCol=computed(()=>this.layoutState().hasRowNumbersCol);this.colOffset=computed(()=>this.layoutState().colOffset);this.containerWidth=computed(()=>this.layoutState().containerWidth);this.minTableWidth=computed(()=>this.layoutState().minTableWidth);this.desiredTableWidth=computed(()=>this.layoutState().desiredTableWidth);this.columnSizingOverrides=computed(()=>this.layoutState().columnSizingOverrides);this.selectedRowIds=computed(()=>this.rowSelectionState().selectedRowIds);this.allSelected=computed(()=>this.rowSelectionState().allSelected);this.someSelected=computed(()=>this.rowSelectionState().someSelected);this.editingCell=computed(()=>this.editingState().editingCell);this.pendingEditorValue=computed(()=>this.editingState().pendingEditorValue);this.activeCell=computed(()=>this.interactionState().activeCell);this.selectionRange=computed(()=>this.interactionState().selectionRange);this.hasCellSelection=computed(()=>this.interactionState().hasCellSelection);this.cutRange=computed(()=>this.interactionState().cutRange);this.copyRange=computed(()=>this.interactionState().copyRange);this.canUndo=computed(()=>this.interactionState().canUndo);this.canRedo=computed(()=>this.interactionState().canRedo);this.isDragging=computed(()=>this.interactionState().isDragging);this.menuPosition=computed(()=>this.contextMenuState().menuPosition);this.statusBarConfig=computed(()=>this.viewModelsState().statusBarConfig);this.showEmptyInGrid=computed(()=>this.viewModelsState().showEmptyInGrid);this.headerFilterInput=computed(()=>this.viewModelsState().headerFilterInput);this.cellDescriptorInput=computed(()=>this.viewModelsState().cellDescriptorInput);this.pinnedColumnsMap=computed(()=>this.pinningState().pinnedColumns);this.vsEnabled=computed(()=>this.virtualScrollService.isActive());this.vsVisibleRange=computed(()=>this.virtualScrollService.visibleRange());this.vsTopSpacerHeight=computed(()=>this.vsEnabled()?this.vsVisibleRange().offsetTop:0);this.vsBottomSpacerHeight=computed(()=>this.vsEnabled()?this.vsVisibleRange().offsetBottom:0);this.vsVisibleItems=computed(()=>{let e=this.items();if(!this.vsEnabled())return e;let t=this.vsVisibleRange();return e.slice(t.startIndex,Math.min(t.endIndex+1,e.length))});this.vsStartIndex=computed(()=>this.vsEnabled()?this.vsVisibleRange().startIndex:0);this.vsColumnsEnabled=computed(()=>this.virtualScrollService.columnsEnabled());this.vsColumnRange=computed(()=>this.virtualScrollService.columnRange());this.vsColumnPartition=computed(()=>{if(!this.vsColumnsEnabled())return null;let e=this.visibleCols(),t=this.vsColumnRange(),i=this.getProps()?.pinnedColumns;return partitionColumnsForVirtualization(e,t,i)});this.vsColumnLayouts=computed(()=>{let e=this.columnLayouts(),t=this.vsColumnPartition();if(!t)return e;let n=new Set;for(let i of t.pinnedLeft)n.add(i.columnId);for(let i of t.virtualizedUnpinned)n.add(i.columnId);for(let i of t.pinnedRight)n.add(i.columnId);return e.filter(i=>n.has(i.col.columnId))});this.vsVisibleCols=computed(()=>{let e=this.visibleCols(),t=this.vsColumnPartition();if(!t)return e;let n=new Set;for(let i of t.pinnedLeft)n.add(i.columnId);for(let i of t.virtualizedUnpinned)n.add(i.columnId);for(let i of t.pinnedRight)n.add(i.columnId);return e.filter(i=>n.has(i.columnId))});this.vsLeftSpacerWidth=computed(()=>this.vsColumnPartition()?.leftSpacerWidth??0);this.vsRightSpacerWidth=computed(()=>this.vsColumnPartition()?.rightSpacerWidth??0);this.globalColIndexMap=computed(()=>{let e=this.visibleCols(),t=new Map;for(let n=0;n<e.length;n++)t.set(e[n].columnId,n);return t});this.popoverAnchorEl=computed(()=>this.editingState().popoverAnchorEl);this.pendingEditorValueForPopover=computed(()=>this.editingState().pendingEditorValue);this.allowOverflowX=computed(()=>{if(this.getProps()?.suppressHorizontalScroll)return false;let t=this.containerWidth(),n=this.minTableWidth(),i=this.desiredTableWidth();return t>0&&(n>t||i>t)});this.selectionCellCount=computed(()=>{let e=this.selectionRange();if(e)return (Math.abs(e.endRow-e.startRow)+1)*(Math.abs(e.endCol-e.startCol)+1)});this.headerRows=computed(()=>{let e=this.getProps();return e?buildHeaderRows(e.columns,e.visibleColumns):[]});this.columnLayouts=computed(()=>{let e=this.visibleCols(),n=this.getProps()?.pinnedColumns??{},i=this.measuredColumnWidths(),o=this.columnSizingOverrides();return e.map(r=>{let s=n[r.columnId],u=s==="left"||r.pinned==="left",d=s==="right"||r.pinned==="right",c=this.getColumnWidth(r),m=!!o[r.columnId],f=i[r.columnId],b=r.minWidth??DEFAULT_MIN_COLUMN_WIDTH,R=m?c:Math.max(b,f??0);return {col:r,pinnedLeft:u,pinnedRight:d,minWidth:R,width:c}})});this.pinningOffsets=computed(()=>{let e=this.columnLayouts(),t={},n={},i=0;this.hasCheckboxCol()&&(i+=CHECKBOX_COLUMN_WIDTH),this.hasRowNumbersCol()&&(i+=this.getRowNumberWidth());let o=0,r=e.length;for(let s=0;s<r;s++){let u=e[s];u.pinnedLeft&&(t[u.col.columnId]=i,i+=u.width+CELL_PADDING);let d=r-1-s,c=e[d];c.pinnedRight&&(n[c.col.columnId]=o,o+=c.width+CELL_PADDING);}return {leftOffsets:t,rightOffsets:n}});this.columnMenuHandlersMap=computed(()=>{let e=this.visibleCols(),t=new Map;for(let n of e)t.set(n.columnId,this.buildColumnMenuHandlers(n.columnId));return t});}ngAfterViewInit(){let e=this.getWrapperRef()?.nativeElement??null,t=this.getTableContainerRef()?.nativeElement??null;e&&this.wrapperElSignal.set(e),t&&this.tableContainerElSignal.set(t),this.measureColumnWidths();}ngAfterViewChecked(){this.measureDirty()&&(this.measureDirty.set(false),this.measureColumnWidths());}measureColumnWidths(){let e=this.getWrapperRef()?.nativeElement;if(!e)return;let t=e.querySelectorAll("th[data-column-id]");if(t.length===0)return;let n={};t.forEach(r=>{let s=r.getAttribute("data-column-id");s&&(n[s]=r.offsetWidth);});let i=this.measuredColumnWidths(),o=Object.keys(n).length!==Object.keys(i).length;if(!o){for(let r in n)if(i[r]!==n[r]){o=true;break}}o&&this.measuredColumnWidths.set(n);}getGlobalColIndex(e){return this.globalColIndexMap().get(e.columnId)??0}getRowNumberWidth(){let t=this.columnSizingOverrides()[ROW_NUMBER_COLUMN_ID];return t?t.widthPx:ROW_NUMBER_COLUMN_WIDTH}initBase(){effect(()=>{let e=this.getProps();e&&this.stateService.props.set(e);}),effect(()=>{let e=this.wrapperElSignal();e&&(this.stateService.wrapperEl.set(e),this.columnReorderService.wrapperEl.set(e));}),effect(()=>{let e=this.getProps();if(e){let t=this.visibleCols();this.columnReorderService.columns.set(t),this.columnReorderService.columnOrder.set(e.columnOrder),this.columnReorderService.onColumnOrderChange.set(e.onColumnOrderChange),this.columnReorderService.enabled.set(e.columnReorder===true);}}),effect(()=>{this.visibleCols(),this.columnSizingOverrides(),this.columnSizingVersion(),this.measureDirty.set(true);}),effect(()=>{let e=this.getProps();e&&(this.virtualScrollService.totalRows.set(e.items.length),e.virtualScroll&&this.virtualScrollService.updateConfig({enabled:e.virtualScroll.enabled,rowHeight:e.virtualScroll.rowHeight,overscan:e.virtualScroll.overscan,columns:e.virtualScroll.columns,columnOverscan:e.virtualScroll.columnOverscan}));}),effect(()=>{let e=this.columnLayouts(),n=this.getProps()?.pinnedColumns??{},i=e.filter(o=>!o.pinnedLeft&&!o.pinnedRight&&!n[o.col.columnId]).map(o=>o.width);this.virtualScrollService.columnWidths.set(i);}),effect(()=>{let e=this.wrapperElSignal();e&&(this.virtualScrollService.setContainer(e),this.virtualScrollService.containerHeight.set(e.clientHeight),this.virtualScrollService.containerWidth.set(e.clientWidth));});}getEffectiveMinWidth(e){return this.columnLayouts().find(n=>n.col.columnId===e.columnId)?.minWidth??e.minWidth??DEFAULT_MIN_COLUMN_WIDTH}getCellInteractionProps(e){return {tabIndex:e.isActive?0:-1,dataRowIndex:e.rowIndex,dataColIndex:e.globalColIndex,dataInRange:e.isInRange?"true":null,role:e.canEditAny?"button":null}}asColumnDef(e){return e}visibleColIndex(e){return this.visibleCols().indexOf(e)}getColumnWidth(e){let n=this.columnSizingOverrides()[e.columnId];return n?n.widthPx:e.defaultWidth??e.minWidth??DEFAULT_MIN_COLUMN_WIDTH}getFilterConfig(e){return getHeaderFilterConfig(e,this.headerFilterInput())}buildColumnMenuHandlers(e){return {onPinLeft:()=>this.onPinColumn(e,"left"),onPinRight:()=>this.onPinColumn(e,"right"),onUnpin:()=>this.onUnpinColumn(e),onSortAsc:()=>this.onSortAsc(e),onSortDesc:()=>this.onSortDesc(e),onClearSort:()=>this.onClearSort(e),onAutosizeThis:()=>this.onAutosizeColumn(e),onAutosizeAll:()=>this.onAutosizeAllColumns(),onClose:()=>{}}}getColumnMenuHandlersMemoized(e){return this.columnMenuHandlersMap().get(e)??this.buildColumnMenuHandlers(e)}getCellDescriptor(e,t,n,i){return getCellRenderDescriptor(e,t,n,i,this.cellDescriptorInput())}resolveCellContent(e,t,n){try{return resolveCellDisplayContent(e,t,n)}catch(i){let o=this.getProps()?.onCellError;return o&&o(i instanceof Error?i:new Error(String(i)),void 0),""}}resolveCellStyleFn(e,t,n){return resolveCellStyle(e,t,n)}buildPopoverEditorProps(e,t,n){return buildPopoverEditorProps(e,t,n,this.pendingEditorValue(),{setPendingEditorValue:i=>this.setPendingEditorValue(i),commitCellEdit:(i,o,r,s,u,d)=>this.commitEdit(i,o,r,s,u,d),cancelPopoverEdit:()=>this.cancelPopoverEdit()})}isActiveCell(e,t){let n=this.activeCell();return n?n.rowIndex===e&&n.columnIndex===t+this.colOffset():false}isInSelectionRange(e,t){let n=this.selectionRange();if(!n)return false;let i=Math.min(n.startRow,n.endRow),o=Math.max(n.startRow,n.endRow),r=Math.min(n.startCol,n.endCol),s=Math.max(n.startCol,n.endCol);return e>=i&&e<=o&&t>=r&&t<=s}isSelectionEndCell(e,t){let n=this.selectionRange();return !n||this.isDragging()||this.copyRange()||this.cutRange()?false:e===n.endRow&&t===n.endCol}getCellBackground(e,t){return this.isInSelectionRange(e,t)?"var(--ogrid-range-bg, rgba(33, 115, 70, 0.08))":null}getEditorType(e,t){return e.cellEditor==="text"||e.cellEditor==="select"||e.cellEditor==="checkbox"||e.cellEditor==="date"||e.cellEditor==="richSelect"?e.cellEditor:e.type==="date"?"date":e.type==="boolean"?"checkbox":"text"}getSelectValues(e){let t=e.cellEditorParams;return t&&typeof t=="object"&&"values"in t?t.values.map(String):[]}formatDateForInput(e){if(!e)return "";let t=new Date(String(e));return Number.isNaN(t.getTime())?"":t.toISOString().split("T")[0]}getPinnedLeftOffset(e){return this.pinningOffsets().leftOffsets[e]??null}getPinnedRightOffset(e){return this.pinningOffsets().rightOffsets[e]??null}onWrapperScroll(e){this.virtualScrollService.onScroll(e);}setPopoverAnchorEl(e){this.state().editing.setPopoverAnchorEl(e);}setPendingEditorValue(e){this.state().editing.setPendingEditorValue(e);}cancelPopoverEdit(){this.state().editing.cancelPopoverEdit();}commitPopoverEdit(e,t,n,i,o,r){this.state().editing.commitCellEdit(e,t,n,i,o,r);}onWrapperMouseDown(e){this.lastMouseShift=e.shiftKey;}onGridKeyDown(e){this.state().interaction.handleGridKeyDown(e);}onCellMouseDown(e,t,n){this.state().editing.setEditingCell(null),this.state().interaction.handleCellMouseDown(e,t,n);}onCellClick(e,t){this.state().interaction.setActiveCell?.({rowIndex:e,columnIndex:t});}onCellContextMenu(e){this.state().contextMenu.handleCellContextMenu(e);}onCellDblClick(e,t){this.state().editing.setEditingCell({rowId:e,columnId:t});}onFillHandleMouseDown(e){this.state().interaction.handleFillHandleMouseDown?.(e);}onResizeStart(e,t){e.preventDefault(),this.state().interaction.setActiveCell?.(null),this.state().interaction.setSelectionRange?.(null),this.getWrapperRef()?.nativeElement.focus({preventScroll:true});let n=e.clientX,i=t.columnId,o=i===ROW_NUMBER_COLUMN_ID?this.getRowNumberWidth():this.getColumnWidth(t),r=i===ROW_NUMBER_COLUMN_ID?ROW_NUMBER_COLUMN_MIN_WIDTH:t.minWidth??DEFAULT_MIN_COLUMN_WIDTH,s=d=>{let c=d.clientX-n,m=Math.max(r,o+c),f={...this.columnSizingOverrides(),[t.columnId]:{widthPx:m}};this.state().layout.setColumnSizingOverrides(f),this.columnSizingVersion.update(b=>b+1);},u=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",u);let d=this.getColumnWidth(t);this.state().layout.onColumnResized?.(t.columnId,d);};window.addEventListener("pointermove",s),window.addEventListener("pointerup",u);}onResizeDoubleClick(e,t){e.preventDefault(),e.stopPropagation();let n=t.columnId,o=(e.currentTarget.closest("th")??e.currentTarget.parentElement)?.closest("table")?.parentElement??void 0,r=t.minWidth??DEFAULT_MIN_COLUMN_WIDTH,s=measureColumnContentWidth(n,r,o),u={...this.columnSizingOverrides(),[n]:{widthPx:s}};this.state().layout.setColumnSizingOverrides(u),this.columnSizingVersion.update(d=>d+1),this.state().layout.onColumnResized?.(n,s);}onSelectAllChange(e){let t=e.target.checked;this.state().rowSelection.handleSelectAll(!!t);}onRowClick(e,t){if(this.getProps()?.rowSelection!=="single")return;let i=this.selectedRowIds();this.state().rowSelection.updateSelection(i.has(t)?new Set:new Set([t]));}onRowCheckboxChange(e,t,n){let i=t.target.checked;this.state().rowSelection.handleRowCheckboxChange(e,i,n,this.lastMouseShift);}commitEdit(e,t,n,i,o,r){this.state().editing.commitCellEdit(e,t,n,i,o,r);}cancelEdit(){this.state().editing.setEditingCell(null);}onEditorKeydown(e,t,n,i,o,r){if(e.key==="Enter"){e.preventDefault();let s=e.target.value;this.commitEdit(t,n,i,s,o,r);}else e.key==="Escape"&&(e.preventDefault(),this.cancelEdit());}closeContextMenu(){this.state().contextMenu.closeContextMenu();}handleCopy(){this.state().interaction.handleCopy();}handleCut(){this.state().interaction.handleCut();}handlePaste(){this.state().interaction.handlePaste();}handleSelectAllCells(){this.state().interaction.handleSelectAllCells();}onUndo(){this.state().interaction.onUndo?.();}onRedo(){this.state().interaction.onRedo?.();}onHeaderMouseDown(e,t){this.columnReorderService.handleHeaderMouseDown(e,t);}onPinColumn(e,t){this.state().pinning.pinColumn(e,t);}onUnpinColumn(e){this.state().pinning.unpinColumn(e);}isPinned(e){return this.state().pinning.isPinned(e)}getPinState(e){let t=this.isPinned(e);return {canPinLeft:t!=="left",canPinRight:t!=="right",canUnpin:!!t}}onSortAsc(e){this.getProps()?.onColumnSort?.(e,"asc");}onSortDesc(e){this.getProps()?.onColumnSort?.(e,"desc");}onClearSort(e){let t=this.getProps(),n=e??t?.sortBy;n&&t?.onColumnSort?.(n,null);}getSortState(e){let t=this.getProps();return t?.sortBy===e?t.sortDirection??"asc":null}onAutosizeColumn(e){let t=this.visibleCols().find(i=>i.columnId===e);if(!t)return;let n=measureColumnContentWidth(e,t.minWidth,this.tableContainerEl()??void 0);this.state().layout.setColumnSizingOverrides({...this.columnSizingOverrides(),[e]:{widthPx:n}}),(this.state().layout.onAutosizeColumn??this.state().layout.onColumnResized)?.(e,n);}onAutosizeAllColumns(){let e=this.tableContainerEl()??void 0,t={};for(let n of this.visibleCols()){let i=measureColumnContentWidth(n.columnId,n.minWidth,e);t[n.columnId]={widthPx:i},(this.state().layout.onAutosizeColumn??this.state().layout.onColumnResized)?.(n.columnId,i);}this.state().layout.setColumnSizingOverrides({...this.columnSizingOverrides(),...t});}};var T=class{constructor(){this._filterType=signal("none");this._selectedValues=signal(void 0);this._options=signal(void 0);this._textValue=signal("");this._selectedUser=signal(void 0);this._dateValue=signal(void 0);this.isSorted=false;this.isSortedDescending=false;this.onSort=void 0;this.onFilterChange=void 0;this.isLoadingOptions=false;this.onTextChange=void 0;this.onUserChange=void 0;this.peopleSearch=void 0;this.onDateChange=void 0;this.isFilterOpen=signal(false);this.tempTextValue=signal("");this.searchText=signal("");this.tempSelected=signal(new Set);this.peopleSearchText=signal("");this.peopleSuggestions=signal([]);this.isPeopleLoading=signal(false);this.tempDateFrom=signal("");this.tempDateTo=signal("");this.popoverTop=signal(0);this.popoverLeft=signal(0);this.peopleDebounceTimer=null;this.hasActiveFilter=computed(()=>{let e=this._filterType();return e==="text"?!!this._textValue():e==="multiSelect"?(this._selectedValues()?.length??0)>0:e==="people"?this._selectedUser()!=null:e==="date"?this._dateValue()!=null:false});this.filteredOptions=computed(()=>{let e=this._options()??[],t=this.searchText().toLowerCase().trim();return t?e.filter(n=>n.toLowerCase().includes(t)):e});}set filterType(e){this._filterType.set(e);}get filterType(){return this._filterType()}set selectedValues(e){this._selectedValues.set(e);}get selectedValues(){return this._selectedValues()}set options(e){this._options.set(e);}get options(){return this._options()}set textValue(e){this._textValue.set(e);}get textValue(){return this._textValue()}set selectedUser(e){this._selectedUser.set(e);}get selectedUser(){return this._selectedUser()}set dateValue(e){this._dateValue.set(e);}get dateValue(){return this._dateValue()}asInputValue(e){return e.target.value}toggleFilter(e){if(e.stopPropagation(),this.isFilterOpen()){this.isFilterOpen.set(false);return}this.tempTextValue.set(this.textValue),this.tempSelected.set(new Set(this.selectedValues??[])),this.searchText.set(""),this.peopleSearchText.set(""),this.peopleSuggestions.set([]);let t=this.dateValue;this.tempDateFrom.set(t?.from??""),this.tempDateTo.set(t?.to??"");let n=this.getHeaderEl()?.nativeElement;if(n){let i=n.getBoundingClientRect();this.popoverTop.set(i.bottom+4),this.popoverLeft.set(i.left);}this.isFilterOpen.set(true);}onTextKeydown(e){e.stopPropagation(),e.key==="Enter"&&(e.preventDefault(),this.handleTextApply());}handleTextApply(){this.onTextChange&&this.onTextChange(this.tempTextValue()),this.isFilterOpen.set(false);}handleTextClear(){this.tempTextValue.set(""),this.onTextChange&&this.onTextChange(""),this.isFilterOpen.set(false);}handleCheckboxChange(e,t){let n=t.target.checked;this.tempSelected.update(i=>{let o=new Set(i);return n?o.add(e):o.delete(e),o});}handleSelectAllFiltered(){this.tempSelected.update(e=>{let t=new Set(e);for(let n of this.filteredOptions())t.add(n);return t});}handleClearSelection(){this.tempSelected.set(new Set);}handleApplyMultiSelect(){this.onFilterChange&&this.onFilterChange(Array.from(this.tempSelected())),this.isFilterOpen.set(false);}onPeopleSearchInput(e){let t=e.target.value;this.peopleSearchText.set(t),this.peopleDebounceTimer&&clearTimeout(this.peopleDebounceTimer);let n=t.trim();if(!n){this.peopleSuggestions.set([]),this.isPeopleLoading.set(false);return}this.isPeopleLoading.set(true),this.peopleDebounceTimer=setTimeout(()=>{let i=this.peopleSearch;i&&i(n).then(o=>{this.peopleSuggestions.set(o),this.isPeopleLoading.set(false);}).catch(()=>{this.peopleSuggestions.set([]),this.isPeopleLoading.set(false);});},300);}handleUserSelect(e){this.onUserChange&&this.onUserChange(e),this.isFilterOpen.set(false);}handleClearUser(){this.onUserChange&&this.onUserChange(void 0),this.isFilterOpen.set(false);}handleDateApply(){let e=this.tempDateFrom(),t=this.tempDateTo();this.onDateChange&&(!e&&!t?this.onDateChange(void 0):this.onDateChange({from:e||void 0,to:t||void 0})),this.isFilterOpen.set(false);}handleDateClear(){this.tempDateFrom.set(""),this.tempDateTo.set(""),this.onDateChange&&this.onDateChange(void 0),this.isFilterOpen.set(false);}ngOnDestroy(){this.peopleDebounceTimer&&(clearTimeout(this.peopleDebounceTimer),this.peopleDebounceTimer=null);}onDocumentClick(e,t){let n=e.target;!n.closest(t)&&!n.closest(".ogrid-header-filter__popover")&&this.isFilterOpen.set(false);}};l([Input({required:true})],T.prototype,"columnKey",2),l([Input({required:true})],T.prototype,"columnName",2),l([Input({required:true})],T.prototype,"filterType",1),l([Input()],T.prototype,"selectedValues",1),l([Input()],T.prototype,"options",1),l([Input()],T.prototype,"textValue",1),l([Input()],T.prototype,"selectedUser",1),l([Input()],T.prototype,"dateValue",1),l([Input()],T.prototype,"isSorted",2),l([Input()],T.prototype,"isSortedDescending",2),l([Input()],T.prototype,"onSort",2),l([Input()],T.prototype,"onFilterChange",2),l([Input()],T.prototype,"isLoadingOptions",2),l([Input()],T.prototype,"onTextChange",2),l([Input()],T.prototype,"onUserChange",2),l([Input()],T.prototype,"peopleSearch",2),l([Input()],T.prototype,"onDateChange",2);var ve=class{constructor(){this._columns=signal([]);this._visibleColumns=signal(new Set);this.visibilityChange=new EventEmitter;this.isOpen=signal(false);this.visibleCount=computed(()=>this._visibleColumns().size);this.totalCount=computed(()=>this._columns().length);}set columns(e){this._columns.set(e);}get columns(){return this._columns()}set visibleColumns(e){this._visibleColumns.set(e);}get visibleColumns(){return this._visibleColumns()}toggle(){this.isOpen.update(e=>!e);}onCheckboxChange(e,t){let n=t.target.checked;this.visibilityChange.emit({columnKey:e,visible:n});}onToggle(e,t){this.visibilityChange.emit({columnKey:e,visible:t});}selectAll(){for(let e of this.columns)this.visibleColumns.has(e.columnId)||this.visibilityChange.emit({columnKey:e.columnId,visible:true});}clearAll(){for(let e of this.columns)this.visibleColumns.has(e.columnId)&&this.visibilityChange.emit({columnKey:e.columnId,visible:false});}onClearAll(){for(let e of this.columns)e.required!==true&&this.visibleColumns.has(e.columnId)&&this.visibilityChange.emit({columnKey:e.columnId,visible:false});}onSelectAll(){for(let e of this.columns)this.visibleColumns.has(e.columnId)||this.visibilityChange.emit({columnKey:e.columnId,visible:true});}};l([Input({required:true})],ve.prototype,"columns",1),l([Input({required:true})],ve.prototype,"visibleColumns",1),l([Output()],ve.prototype,"visibilityChange",2);var $=class{constructor(){this._currentPage=signal(1);this._pageSize=signal(25);this._totalCount=signal(0);this._pageSizeOptions=signal(void 0);this._entityLabelPlural=signal("items");this.pageChange=new EventEmitter;this.pageSizeChange=new EventEmitter;this.labelPlural=computed(()=>this._entityLabelPlural()??"items");this.vm=computed(()=>{let e=this._pageSizeOptions();return getPaginationViewModel(this._currentPage(),this._pageSize(),this._totalCount(),e?{pageSizeOptions:e}:void 0)});}set currentPage(e){this._currentPage.set(e);}get currentPage(){return this._currentPage()}set pageSize(e){this._pageSize.set(e);}get pageSize(){return this._pageSize()}set totalCount(e){this._totalCount.set(e);}get totalCount(){return this._totalCount()}set pageSizeOptions(e){this._pageSizeOptions.set(e);}get pageSizeOptions(){return this._pageSizeOptions()}set entityLabelPlural(e){this._entityLabelPlural.set(e);}get entityLabelPlural(){return this._entityLabelPlural()}onPageSizeSelect(e){let t=Number(e.target.value);this.pageSizeChange.emit(t);}onPageSizeChange(e){this.pageSizeChange.emit(Number(e));}};l([Input({required:true})],$.prototype,"currentPage",1),l([Input({required:true})],$.prototype,"pageSize",1),l([Input({required:true})],$.prototype,"totalCount",1),l([Input()],$.prototype,"pageSizeOptions",1),l([Input()],$.prototype,"entityLabelPlural",1),l([Output()],$.prototype,"pageChange",2),l([Output()],$.prototype,"pageSizeChange",2);var L=class{constructor(){this.commit=new EventEmitter;this.cancel=new EventEmitter;this.localValue=signal("");this.highlightedIndex=signal(0);this.selectOptions=signal([]);this.searchText=signal("");this.scrollCleanup=null;this.filteredOptions=computed(()=>{let e=this.selectOptions(),t=this.searchText().trim().toLowerCase();return t?e.filter(n=>this.getDisplayText(n).toLowerCase().includes(t)):e});this._initialized=false;}ngOnInit(){this._initialized=true,this.syncFromInputs();}ngOnChanges(){this._initialized&&this.syncFromInputs();}syncFromInputs(){let e=this.value,t=e!=null?String(e):"";this.editorType==="date"&&t.match(/^\d{4}-\d{2}-\d{2}/)&&(t=t.substring(0,10)),this.localValue.set(t);let n=this.column;if(n?.cellEditorParams?.values){let i=n.cellEditorParams.values;this.selectOptions.set(i);let o=i.findIndex(r=>String(r)===String(e));this.highlightedIndex.set(Math.max(o,0));}}ngAfterViewInit(){setTimeout(()=>{let e=this.richSelectInput?.nativeElement;if(e){e.focus(),e.select(),this.positionFixedDropdown(this.richSelectWrapper,this.richSelectDropdown),this.attachScrollClose(this.richSelectWrapper?.nativeElement);return}let t=this.selectWrapper?.nativeElement;if(t){t.focus(),this.positionFixedDropdown(this.selectWrapper,this.selectDropdown),this.attachScrollClose(t);return}let n=this.inputEl?.nativeElement;n&&(n.focus(),n instanceof HTMLInputElement&&n.type==="text"&&n.select());});}ngOnDestroy(){this.scrollCleanup?.();}attachScrollClose(e){if(!e)return;let t=e.closest("[data-ogrid-scroll-container]")??e.closest('[style*="overflow"]'),n=()=>this.cancel.emit(),i=requestAnimationFrame(()=>{t&&t.addEventListener("scroll",n,{passive:true}),window.addEventListener("scroll",n,{passive:true});});this.scrollCleanup=()=>{cancelAnimationFrame(i),t&&t.removeEventListener("scroll",n),window.removeEventListener("scroll",n);};}commitValue(e){this.commit.emit(e);}onTextKeyDown(e){e.key==="Enter"?(e.preventDefault(),this.commitValue(this.localValue())):e.key==="Escape"?(e.preventDefault(),this.cancel.emit()):e.key==="Tab"&&(e.preventDefault(),this.commitValue(this.localValue()));}getDisplayText(e){let t=this.column?.cellEditorParams?.formatValue;return t?t(e):e!=null?String(e):""}onCustomSelectKeyDown(e){let t=this.selectOptions();switch(e.key){case "ArrowDown":e.preventDefault(),this.highlightedIndex.set(Math.min(this.highlightedIndex()+1,t.length-1)),this.scrollOptionIntoView(this.selectDropdown);break;case "ArrowUp":e.preventDefault(),this.highlightedIndex.set(Math.max(this.highlightedIndex()-1,0)),this.scrollOptionIntoView(this.selectDropdown);break;case "Enter":e.preventDefault(),e.stopPropagation(),t.length>0&&this.highlightedIndex()<t.length&&this.commitValue(t[this.highlightedIndex()]);break;case "Tab":e.preventDefault(),t.length>0&&this.highlightedIndex()<t.length&&this.commitValue(t[this.highlightedIndex()]);break;case "Escape":e.preventDefault(),e.stopPropagation(),this.cancel.emit();break}}onRichSelectSearch(e){this.searchText.set(e),this.highlightedIndex.set(0);}onRichSelectKeyDown(e){let t=this.filteredOptions();switch(e.key){case "ArrowDown":e.preventDefault(),this.highlightedIndex.set(Math.min(this.highlightedIndex()+1,t.length-1)),this.scrollOptionIntoView(this.richSelectDropdown);break;case "ArrowUp":e.preventDefault(),this.highlightedIndex.set(Math.max(this.highlightedIndex()-1,0)),this.scrollOptionIntoView(this.richSelectDropdown);break;case "Enter":e.preventDefault(),e.stopPropagation(),t.length>0&&this.highlightedIndex()<t.length&&this.commitValue(t[this.highlightedIndex()]);break;case "Escape":e.preventDefault(),e.stopPropagation(),this.cancel.emit();break}}onCheckboxKeyDown(e){e.key==="Escape"&&(e.preventDefault(),this.cancel.emit());}onTextBlur(){this.commitValue(this.localValue());}getInputStyle(){let e="width:100%;box-sizing:border-box;padding:6px 10px;border:none;outline:none;font:inherit;background:transparent;color:inherit;";return this.column.type==="numeric"?e+"text-align:right;":e}positionFixedDropdown(e,t){let n=e?.nativeElement,i=t?.nativeElement;if(!n||!i)return;let o=n.getBoundingClientRect(),r=200,s=window.innerHeight-o.bottom,u=s<r&&o.top>s;i.style.position="fixed",i.style.left=`${o.left}px`,i.style.width=`${o.width}px`,i.style.maxHeight=`${r}px`,i.style.zIndex="9999",i.style.right="auto",i.style.textAlign="left",u?(i.style.top="auto",i.style.bottom=`${window.innerHeight-o.top}px`):i.style.top=`${o.bottom}px`;}scrollOptionIntoView(e){setTimeout(()=>{let t=e?.nativeElement;if(!t)return;t.children[this.highlightedIndex()]?.scrollIntoView({block:"nearest"});});}};l([Input({required:true})],L.prototype,"value",2),l([Input({required:true})],L.prototype,"item",2),l([Input({required:true})],L.prototype,"column",2),l([Input({required:true})],L.prototype,"rowIndex",2),l([Input({required:true})],L.prototype,"editorType",2),l([Output()],L.prototype,"commit",2),l([Output()],L.prototype,"cancel",2),l([ViewChild("inputEl")],L.prototype,"inputEl",2),l([ViewChild("selectWrapper")],L.prototype,"selectWrapper",2),l([ViewChild("selectDropdown")],L.prototype,"selectDropdown",2),l([ViewChild("richSelectWrapper")],L.prototype,"richSelectWrapper",2),l([ViewChild("richSelectInput")],L.prototype,"richSelectInput",2),l([ViewChild("richSelectDropdown")],L.prototype,"richSelectDropdown",2);var q=class{constructor(){this._canPinLeft=signal(true);this._canPinRight=signal(true);this._canUnpin=signal(false);this._currentSort=signal(null);this._isSortable=signal(true);this._isResizable=signal(true);this.handlers={};this.menuItems=computed(()=>getColumnHeaderMenuItems({canPinLeft:this._canPinLeft(),canPinRight:this._canPinRight(),canUnpin:this._canUnpin(),currentSort:this._currentSort(),isSortable:this._isSortable(),isResizable:this._isResizable()}));}set canPinLeft(e){this._canPinLeft.set(e);}set canPinRight(e){this._canPinRight.set(e);}set canUnpin(e){this._canUnpin.set(e);}set currentSort(e){this._currentSort.set(e);}set isSortable(e){this._isSortable.set(e);}set isResizable(e){this._isResizable.set(e);}handleMenuItemClick(e){let t=this.handlers,i={pinLeft:t.onPinLeft,pinRight:t.onPinRight,unpin:t.onUnpin,sortAsc:t.onSortAsc,sortDesc:t.onSortDesc,clearSort:t.onClearSort,autosizeThis:t.onAutosizeThis,autosizeAll:t.onAutosizeAll}[e];i&&(i(),t.onClose?.());}};l([Input({required:true})],q.prototype,"columnId",2),l([Input()],q.prototype,"canPinLeft",1),l([Input()],q.prototype,"canPinRight",1),l([Input()],q.prototype,"canUnpin",1),l([Input()],q.prototype,"currentSort",1),l([Input()],q.prototype,"isSortable",1),l([Input()],q.prototype,"isResizable",1),l([Input()],q.prototype,"handlers",2);var to=`
673
+ `})],Z);var Le=class{constructor(){this.propsSignal=signal(void 0);this.ogridService=inject(ie);effect(()=>{let e=this.propsSignal();e&&this.ogridService.configure(e);});}set props(e){this.propsSignal.set(e);}get showToolbar(){return this.ogridService.columnChooserPlacement()==="toolbar"||this.ogridService.toolbar()!=null||this.ogridService.fullScreen()}onPageSizeChange(e){this.ogridService.pagination().setPageSize(e);}};l([Input({required:true})],Le.prototype,"props",1);function Rt(p,e){let t=signal(p());return effect(n=>{let i=p(),o=setTimeout(()=>{t.set(i);},e);n(()=>clearTimeout(o));}),t}function wt(p,e){let t=null;return((...n)=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{p(...n),t=null;},e);})}function xt(p){return((...e)=>p()(...e))}var nt=class{constructor(){this.stateService=inject(oe);this.columnReorderService=inject(le);this.virtualScrollService=inject(ae);this.lastMouseShift=false;this.columnSizingVersion=signal(0);this.measureDirty=signal(true);this.measuredColumnWidths=signal({});this.wrapperElSignal=signal(null);this.tableContainerElSignal=signal(null);this.state=computed(()=>this.stateService.getState());this.layoutState=computed(()=>this.state().layout);this.rowSelectionState=computed(()=>this.state().rowSelection);this.editingState=computed(()=>this.state().editing);this.interactionState=computed(()=>this.state().interaction);this.contextMenuState=computed(()=>this.state().contextMenu);this.viewModelsState=computed(()=>this.state().viewModels);this.pinningState=computed(()=>this.state().pinning);this.tableContainerEl=computed(()=>this.tableContainerElSignal());this.items=computed(()=>this.getProps()?.items??[]);this.getRowId=computed(()=>this.getProps()?.getRowId??(e=>e.id));this.isLoading=computed(()=>this.getProps()?.isLoading??false);this.loadingMessage=computed(()=>"Loading\u2026");this.layoutModeFit=computed(()=>(this.getProps()?.layoutMode??"fill")==="content");this.rowHeightCssVar=computed(()=>{let e=this.getProps()?.rowHeight;return e?`${e}px`:null});this.ariaLabel=computed(()=>this.getProps()?.["aria-label"]??"Data grid");this.ariaLabelledBy=computed(()=>this.getProps()?.["aria-labelledby"]);this.stickyHeader=computed(()=>this.getProps()?.stickyHeader??true);this.emptyState=computed(()=>this.getProps()?.emptyState);this.currentPage=computed(()=>this.getProps()?.currentPage??1);this.pageSize=computed(()=>this.getProps()?.pageSize??25);this.rowNumberOffset=computed(()=>this.hasRowNumbersCol()?(this.currentPage()-1)*this.pageSize():0);this.propsVisibleColumns=computed(()=>this.getProps()?.visibleColumns);this.propsColumnOrder=computed(()=>this.getProps()?.columnOrder);this.visibleCols=computed(()=>this.layoutState().visibleCols);this.hasCheckboxCol=computed(()=>this.layoutState().hasCheckboxCol);this.hasRowNumbersCol=computed(()=>this.layoutState().hasRowNumbersCol);this.colOffset=computed(()=>this.layoutState().colOffset);this.containerWidth=computed(()=>this.layoutState().containerWidth);this.minTableWidth=computed(()=>this.layoutState().minTableWidth);this.desiredTableWidth=computed(()=>this.layoutState().desiredTableWidth);this.columnSizingOverrides=computed(()=>this.layoutState().columnSizingOverrides);this.selectedRowIds=computed(()=>this.rowSelectionState().selectedRowIds);this.allSelected=computed(()=>this.rowSelectionState().allSelected);this.someSelected=computed(()=>this.rowSelectionState().someSelected);this.editingCell=computed(()=>this.editingState().editingCell);this.pendingEditorValue=computed(()=>this.editingState().pendingEditorValue);this.activeCell=computed(()=>this.interactionState().activeCell);this.selectionRange=computed(()=>this.interactionState().selectionRange);this.hasCellSelection=computed(()=>this.interactionState().hasCellSelection);this.cutRange=computed(()=>this.interactionState().cutRange);this.copyRange=computed(()=>this.interactionState().copyRange);this.canUndo=computed(()=>this.interactionState().canUndo);this.canRedo=computed(()=>this.interactionState().canRedo);this.isDragging=computed(()=>this.interactionState().isDragging);this.menuPosition=computed(()=>this.contextMenuState().menuPosition);this.statusBarConfig=computed(()=>this.viewModelsState().statusBarConfig);this.showEmptyInGrid=computed(()=>this.viewModelsState().showEmptyInGrid);this.headerFilterInput=computed(()=>this.viewModelsState().headerFilterInput);this.cellDescriptorInput=computed(()=>this.viewModelsState().cellDescriptorInput);this.pinnedColumnsMap=computed(()=>this.pinningState().pinnedColumns);this.vsEnabled=computed(()=>this.virtualScrollService.isActive());this.vsVisibleRange=computed(()=>this.virtualScrollService.visibleRange());this.vsTopSpacerHeight=computed(()=>this.vsEnabled()?this.vsVisibleRange().offsetTop:0);this.vsBottomSpacerHeight=computed(()=>this.vsEnabled()?this.vsVisibleRange().offsetBottom:0);this.vsVisibleItems=computed(()=>{let e=this.items();if(!this.vsEnabled())return e;let t=this.vsVisibleRange();return e.slice(t.startIndex,Math.min(t.endIndex+1,e.length))});this.vsStartIndex=computed(()=>this.vsEnabled()?this.vsVisibleRange().startIndex:0);this.vsColumnsEnabled=computed(()=>this.virtualScrollService.columnsEnabled());this.vsColumnRange=computed(()=>this.virtualScrollService.columnRange());this.vsColumnPartition=computed(()=>{if(!this.vsColumnsEnabled())return null;let e=this.visibleCols(),t=this.vsColumnRange(),i=this.getProps()?.pinnedColumns;return partitionColumnsForVirtualization(e,t,i)});this.vsColumnLayouts=computed(()=>{let e=this.columnLayouts(),t=this.vsColumnPartition();if(!t)return e;let n=new Set;for(let i of t.pinnedLeft)n.add(i.columnId);for(let i of t.virtualizedUnpinned)n.add(i.columnId);for(let i of t.pinnedRight)n.add(i.columnId);return e.filter(i=>n.has(i.col.columnId))});this.vsVisibleCols=computed(()=>{let e=this.visibleCols(),t=this.vsColumnPartition();if(!t)return e;let n=new Set;for(let i of t.pinnedLeft)n.add(i.columnId);for(let i of t.virtualizedUnpinned)n.add(i.columnId);for(let i of t.pinnedRight)n.add(i.columnId);return e.filter(i=>n.has(i.columnId))});this.vsLeftSpacerWidth=computed(()=>this.vsColumnPartition()?.leftSpacerWidth??0);this.vsRightSpacerWidth=computed(()=>this.vsColumnPartition()?.rightSpacerWidth??0);this.globalColIndexMap=computed(()=>{let e=this.visibleCols(),t=new Map;for(let n=0;n<e.length;n++)t.set(e[n].columnId,n);return t});this.popoverAnchorEl=computed(()=>this.editingState().popoverAnchorEl);this.pendingEditorValueForPopover=computed(()=>this.editingState().pendingEditorValue);this.allowOverflowX=computed(()=>{if(this.getProps()?.suppressHorizontalScroll)return false;let t=this.containerWidth(),n=this.minTableWidth(),i=this.desiredTableWidth();return t>0&&(n>t||i>t)});this.selectionCellCount=computed(()=>{let e=this.selectionRange();if(e)return (Math.abs(e.endRow-e.startRow)+1)*(Math.abs(e.endCol-e.startCol)+1)});this.headerRows=computed(()=>{let e=this.getProps();return e?buildHeaderRows(e.columns,e.visibleColumns):[]});this.columnLayouts=computed(()=>{let e=this.visibleCols(),n=this.getProps()?.pinnedColumns??{},i=this.measuredColumnWidths(),o=this.columnSizingOverrides();return e.map(r=>{let s=n[r.columnId],u=s==="left"||r.pinned==="left",d=s==="right"||r.pinned==="right",c=this.getColumnWidth(r),m=!!o[r.columnId],f=i[r.columnId],b=r.minWidth??DEFAULT_MIN_COLUMN_WIDTH,R=m?c:Math.max(b,f??0);return {col:r,pinnedLeft:u,pinnedRight:d,minWidth:R,width:c}})});this.pinningOffsets=computed(()=>{let e=this.columnLayouts(),t={},n={},i=0;this.hasCheckboxCol()&&(i+=CHECKBOX_COLUMN_WIDTH),this.hasRowNumbersCol()&&(i+=this.getRowNumberWidth());let o=0,r=e.length;for(let s=0;s<r;s++){let u=e[s];u.pinnedLeft&&(t[u.col.columnId]=i,i+=u.width+CELL_PADDING);let d=r-1-s,c=e[d];c.pinnedRight&&(n[c.col.columnId]=o,o+=c.width+CELL_PADDING);}return {leftOffsets:t,rightOffsets:n}});this.columnMenuHandlersMap=computed(()=>{let e=this.visibleCols(),t=new Map;for(let n of e)t.set(n.columnId,this.buildColumnMenuHandlers(n.columnId));return t});}ngAfterViewInit(){let e=this.getWrapperRef()?.nativeElement??null,t=this.getTableContainerRef()?.nativeElement??null;e&&this.wrapperElSignal.set(e),t&&this.tableContainerElSignal.set(t),this.measureColumnWidths();}ngAfterViewChecked(){this.measureDirty()&&(this.measureDirty.set(false),this.measureColumnWidths());}measureColumnWidths(){let e=this.getWrapperRef()?.nativeElement;if(!e)return;let t=e.querySelectorAll("th[data-column-id]");if(t.length===0)return;let n={};t.forEach(r=>{let s=r.getAttribute("data-column-id");s&&(n[s]=r.offsetWidth);});let i=this.measuredColumnWidths(),o=Object.keys(n).length!==Object.keys(i).length;if(!o){for(let r in n)if(i[r]!==n[r]){o=true;break}}o&&this.measuredColumnWidths.set(n);}getGlobalColIndex(e){return this.globalColIndexMap().get(e.columnId)??0}getRowNumberWidth(){let t=this.columnSizingOverrides()[ROW_NUMBER_COLUMN_ID];return t?t.widthPx:ROW_NUMBER_COLUMN_WIDTH}initBase(){effect(()=>{let e=this.getProps();e&&this.stateService.props.set(e);}),effect(()=>{let e=this.wrapperElSignal();e&&(this.stateService.wrapperEl.set(e),this.columnReorderService.wrapperEl.set(e));}),effect(()=>{let e=this.getProps();if(e){let t=this.visibleCols();this.columnReorderService.columns.set(t),this.columnReorderService.columnOrder.set(e.columnOrder),this.columnReorderService.onColumnOrderChange.set(e.onColumnOrderChange),this.columnReorderService.enabled.set(e.columnReorder===true);}}),effect(()=>{this.visibleCols(),this.columnSizingOverrides(),this.columnSizingVersion(),this.measureDirty.set(true);}),effect(()=>{let e=this.getProps();e&&(this.virtualScrollService.totalRows.set(e.items.length),e.virtualScroll&&this.virtualScrollService.updateConfig({enabled:e.virtualScroll.enabled,rowHeight:e.virtualScroll.rowHeight,overscan:e.virtualScroll.overscan,columns:e.virtualScroll.columns,columnOverscan:e.virtualScroll.columnOverscan}));}),effect(()=>{let e=this.columnLayouts(),n=this.getProps()?.pinnedColumns??{},i=e.filter(o=>!o.pinnedLeft&&!o.pinnedRight&&!n[o.col.columnId]).map(o=>o.width);this.virtualScrollService.columnWidths.set(i);}),effect(()=>{let e=this.wrapperElSignal();e&&(this.virtualScrollService.setContainer(e),this.virtualScrollService.containerHeight.set(e.clientHeight),this.virtualScrollService.containerWidth.set(e.clientWidth));});}getEffectiveMinWidth(e){return this.columnLayouts().find(n=>n.col.columnId===e.columnId)?.minWidth??e.minWidth??DEFAULT_MIN_COLUMN_WIDTH}getCellInteractionProps(e){return {tabIndex:e.isActive?0:-1,dataRowIndex:e.rowIndex,dataColIndex:e.globalColIndex,dataInRange:e.isInRange?"true":null,role:e.canEditAny?"button":null}}asColumnDef(e){return e}visibleColIndex(e){return this.visibleCols().indexOf(e)}getColumnWidth(e){let n=this.columnSizingOverrides()[e.columnId];return n?n.widthPx:e.defaultWidth??e.minWidth??DEFAULT_MIN_COLUMN_WIDTH}getFilterConfig(e){return getHeaderFilterConfig(e,this.headerFilterInput())}buildColumnMenuHandlers(e){return {onPinLeft:()=>this.onPinColumn(e,"left"),onPinRight:()=>this.onPinColumn(e,"right"),onUnpin:()=>this.onUnpinColumn(e),onSortAsc:()=>this.onSortAsc(e),onSortDesc:()=>this.onSortDesc(e),onClearSort:()=>this.onClearSort(e),onAutosizeThis:()=>this.onAutosizeColumn(e),onAutosizeAll:()=>this.onAutosizeAllColumns(),onClose:()=>{}}}getColumnMenuHandlersMemoized(e){return this.columnMenuHandlersMap().get(e)??this.buildColumnMenuHandlers(e)}getCellDescriptor(e,t,n,i){return getCellRenderDescriptor(e,t,n,i,this.cellDescriptorInput())}resolveCellContent(e,t,n){try{return resolveCellDisplayContent(e,t,n)}catch(i){let o=this.getProps()?.onCellError;return o&&o(i instanceof Error?i:new Error(String(i)),void 0),""}}resolveCellStyleFn(e,t,n){return resolveCellStyle(e,t,n)}buildPopoverEditorProps(e,t,n){return buildPopoverEditorProps(e,t,n,this.pendingEditorValue(),{setPendingEditorValue:i=>this.setPendingEditorValue(i),commitCellEdit:(i,o,r,s,u,d)=>this.commitEdit(i,o,r,s,u,d),cancelPopoverEdit:()=>this.cancelPopoverEdit()})}isActiveCell(e,t){let n=this.activeCell();return n?n.rowIndex===e&&n.columnIndex===t+this.colOffset():false}isInSelectionRange(e,t){let n=this.selectionRange();if(!n)return false;let i=Math.min(n.startRow,n.endRow),o=Math.max(n.startRow,n.endRow),r=Math.min(n.startCol,n.endCol),s=Math.max(n.startCol,n.endCol);return e>=i&&e<=o&&t>=r&&t<=s}isSelectionEndCell(e,t){let n=this.selectionRange();return !n||this.isDragging()||this.copyRange()||this.cutRange()?false:e===n.endRow&&t===n.endCol}getCellBackground(e,t){return this.isInSelectionRange(e,t)?"var(--ogrid-range-bg, rgba(33, 115, 70, 0.08))":null}getEditorType(e,t){return e.cellEditor==="text"||e.cellEditor==="select"||e.cellEditor==="checkbox"||e.cellEditor==="date"||e.cellEditor==="richSelect"?e.cellEditor:e.type==="date"?"date":e.type==="boolean"?"checkbox":"text"}getSelectValues(e){let t=e.cellEditorParams;return t&&typeof t=="object"&&"values"in t?t.values.map(String):[]}formatDateForInput(e){if(!e)return "";let t=new Date(String(e));return Number.isNaN(t.getTime())?"":t.toISOString().split("T")[0]}getPinnedLeftOffset(e){return this.pinningOffsets().leftOffsets[e]??null}getPinnedRightOffset(e){return this.pinningOffsets().rightOffsets[e]??null}onWrapperScroll(e){this.virtualScrollService.onScroll(e);}setPopoverAnchorEl(e){this.state().editing.setPopoverAnchorEl(e);}setPendingEditorValue(e){this.state().editing.setPendingEditorValue(e);}cancelPopoverEdit(){this.state().editing.cancelPopoverEdit();}commitPopoverEdit(e,t,n,i,o,r){this.state().editing.commitCellEdit(e,t,n,i,o,r);}onWrapperMouseDown(e){this.lastMouseShift=e.shiftKey;}onGridKeyDown(e){this.state().interaction.handleGridKeyDown(e);}onCellMouseDown(e,t,n){this.state().editing.setEditingCell(null),this.state().interaction.handleCellMouseDown(e,t,n);}onCellClick(e,t){this.state().interaction.setActiveCell?.({rowIndex:e,columnIndex:t});}onCellContextMenu(e){this.state().contextMenu.handleCellContextMenu(e);}onCellDblClick(e,t){this.state().editing.setEditingCell({rowId:e,columnId:t});}onFillHandleMouseDown(e){this.state().interaction.handleFillHandleMouseDown?.(e);}onResizeStart(e,t){e.preventDefault(),this.state().interaction.setActiveCell?.(null),this.state().interaction.setSelectionRange?.(null),this.getWrapperRef()?.nativeElement.focus({preventScroll:true});let n=e.clientX,i=t.columnId,o=i===ROW_NUMBER_COLUMN_ID?this.getRowNumberWidth():this.getColumnWidth(t),r=i===ROW_NUMBER_COLUMN_ID?ROW_NUMBER_COLUMN_MIN_WIDTH:t.minWidth??DEFAULT_MIN_COLUMN_WIDTH,s=d=>{let c=d.clientX-n,m=Math.max(r,o+c),f={...this.columnSizingOverrides(),[t.columnId]:{widthPx:m}};this.state().layout.setColumnSizingOverrides(f),this.columnSizingVersion.update(b=>b+1);},u=()=>{window.removeEventListener("pointermove",s),window.removeEventListener("pointerup",u);let d=this.getColumnWidth(t);this.state().layout.onColumnResized?.(t.columnId,d);};window.addEventListener("pointermove",s),window.addEventListener("pointerup",u);}onResizeDoubleClick(e,t){e.preventDefault(),e.stopPropagation();let n=t.columnId,o=(e.currentTarget.closest("th")??e.currentTarget.parentElement)?.closest("table")?.parentElement??void 0,r=t.minWidth??DEFAULT_MIN_COLUMN_WIDTH,s=measureColumnContentWidth(n,r,o),u={...this.columnSizingOverrides(),[n]:{widthPx:s}};this.state().layout.setColumnSizingOverrides(u),this.columnSizingVersion.update(d=>d+1),this.state().layout.onColumnResized?.(n,s);}onSelectAllChange(e){let t=e.target.checked;this.state().rowSelection.handleSelectAll(!!t);}onRowClick(e,t){if(this.getProps()?.rowSelection!=="single")return;let i=this.selectedRowIds();this.state().rowSelection.updateSelection(i.has(t)?new Set:new Set([t]));}onRowCheckboxChange(e,t,n){let i=t.target.checked;this.state().rowSelection.handleRowCheckboxChange(e,i,n,this.lastMouseShift);}commitEdit(e,t,n,i,o,r){this.state().editing.commitCellEdit(e,t,n,i,o,r);}cancelEdit(){this.state().editing.setEditingCell(null);}onEditorKeydown(e,t,n,i,o,r){if(e.key==="Enter"){e.preventDefault();let s=e.target.value;this.commitEdit(t,n,i,s,o,r);}else e.key==="Escape"&&(e.preventDefault(),this.cancelEdit());}closeContextMenu(){this.state().contextMenu.closeContextMenu();}handleCopy(){this.state().interaction.handleCopy();}handleCut(){this.state().interaction.handleCut();}handlePaste(){this.state().interaction.handlePaste();}handleSelectAllCells(){this.state().interaction.handleSelectAllCells();}onUndo(){this.state().interaction.onUndo?.();}onRedo(){this.state().interaction.onRedo?.();}onHeaderMouseDown(e,t){this.columnReorderService.handleHeaderMouseDown(e,t);}onPinColumn(e,t){this.state().pinning.pinColumn(e,t);}onUnpinColumn(e){this.state().pinning.unpinColumn(e);}isPinned(e){return this.state().pinning.isPinned(e)}getPinState(e){let t=this.isPinned(e);return {canPinLeft:t!=="left",canPinRight:t!=="right",canUnpin:!!t}}onSortAsc(e){this.getProps()?.onColumnSort?.(e,"asc");}onSortDesc(e){this.getProps()?.onColumnSort?.(e,"desc");}onClearSort(e){let t=this.getProps(),n=e??t?.sortBy;n&&t?.onColumnSort?.(n,null);}getSortState(e){let t=this.getProps();return t?.sortBy===e?t.sortDirection??"asc":null}onAutosizeColumn(e){let t=this.visibleCols().find(i=>i.columnId===e);if(!t)return;let n=measureColumnContentWidth(e,t.minWidth,this.tableContainerEl()??void 0);this.state().layout.setColumnSizingOverrides({...this.columnSizingOverrides(),[e]:{widthPx:n}}),(this.state().layout.onAutosizeColumn??this.state().layout.onColumnResized)?.(e,n);}onAutosizeAllColumns(){let e=this.tableContainerEl()??void 0,t={};for(let n of this.visibleCols()){let i=measureColumnContentWidth(n.columnId,n.minWidth,e);t[n.columnId]={widthPx:i},(this.state().layout.onAutosizeColumn??this.state().layout.onColumnResized)?.(n.columnId,i);}this.state().layout.setColumnSizingOverrides({...this.columnSizingOverrides(),...t});}};var T=class{constructor(){this._filterType=signal("none");this._selectedValues=signal(void 0);this._options=signal(void 0);this._textValue=signal("");this._selectedUser=signal(void 0);this._dateValue=signal(void 0);this.isSorted=false;this.isSortedDescending=false;this.onSort=void 0;this.onFilterChange=void 0;this.isLoadingOptions=false;this.onTextChange=void 0;this.onUserChange=void 0;this.peopleSearch=void 0;this.onDateChange=void 0;this.isFilterOpen=signal(false);this.tempTextValue=signal("");this.searchText=signal("");this.tempSelected=signal(new Set);this.peopleSearchText=signal("");this.peopleSuggestions=signal([]);this.isPeopleLoading=signal(false);this.tempDateFrom=signal("");this.tempDateTo=signal("");this.popoverTop=signal(0);this.popoverLeft=signal(0);this.peopleDebounceTimer=null;this.hasActiveFilter=computed(()=>{let e=this._filterType();return e==="text"?!!this._textValue():e==="multiSelect"?(this._selectedValues()?.length??0)>0:e==="people"?this._selectedUser()!=null:e==="date"?this._dateValue()!=null:false});this.filteredOptions=computed(()=>{let e=this._options()??[],t=this.searchText().toLowerCase().trim();return t?e.filter(n=>n.toLowerCase().includes(t)):e});}set filterType(e){this._filterType.set(e);}get filterType(){return this._filterType()}set selectedValues(e){this._selectedValues.set(e);}get selectedValues(){return this._selectedValues()}set options(e){this._options.set(e);}get options(){return this._options()}set textValue(e){this._textValue.set(e);}get textValue(){return this._textValue()}set selectedUser(e){this._selectedUser.set(e);}get selectedUser(){return this._selectedUser()}set dateValue(e){this._dateValue.set(e);}get dateValue(){return this._dateValue()}asInputValue(e){return e.target.value}toggleFilter(e){if(e.stopPropagation(),this.isFilterOpen()){this.isFilterOpen.set(false);return}this.tempTextValue.set(this.textValue),this.tempSelected.set(new Set(this.selectedValues??[])),this.searchText.set(""),this.peopleSearchText.set(""),this.peopleSuggestions.set([]);let t=this.dateValue;this.tempDateFrom.set(t?.from??""),this.tempDateTo.set(t?.to??"");let n=this.getHeaderEl()?.nativeElement;if(n){let i=n.getBoundingClientRect();this.popoverTop.set(i.bottom+4),this.popoverLeft.set(i.left);}this.isFilterOpen.set(true);}onTextKeydown(e){e.stopPropagation(),e.key==="Enter"&&(e.preventDefault(),this.handleTextApply());}handleTextApply(){this.onTextChange&&this.onTextChange(this.tempTextValue()),this.isFilterOpen.set(false);}handleTextClear(){this.tempTextValue.set(""),this.onTextChange&&this.onTextChange(""),this.isFilterOpen.set(false);}handleCheckboxChange(e,t){let n=t.target.checked;this.tempSelected.update(i=>{let o=new Set(i);return n?o.add(e):o.delete(e),o});}handleSelectAllFiltered(){this.tempSelected.update(e=>{let t=new Set(e);for(let n of this.filteredOptions())t.add(n);return t});}handleClearSelection(){this.tempSelected.set(new Set);}handleApplyMultiSelect(){this.onFilterChange&&this.onFilterChange(Array.from(this.tempSelected())),this.isFilterOpen.set(false);}onPeopleSearchInput(e){let t=e.target.value;this.peopleSearchText.set(t),this.peopleDebounceTimer&&clearTimeout(this.peopleDebounceTimer);let n=t.trim();if(!n){this.peopleSuggestions.set([]),this.isPeopleLoading.set(false);return}this.isPeopleLoading.set(true),this.peopleDebounceTimer=setTimeout(()=>{let i=this.peopleSearch;i&&i(n).then(o=>{this.peopleSuggestions.set(o),this.isPeopleLoading.set(false);}).catch(()=>{this.peopleSuggestions.set([]),this.isPeopleLoading.set(false);});},300);}handleUserSelect(e){this.onUserChange&&this.onUserChange(e),this.isFilterOpen.set(false);}handleClearUser(){this.onUserChange&&this.onUserChange(void 0),this.isFilterOpen.set(false);}handleDateApply(){let e=this.tempDateFrom(),t=this.tempDateTo();this.onDateChange&&(!e&&!t?this.onDateChange(void 0):this.onDateChange({from:e||void 0,to:t||void 0})),this.isFilterOpen.set(false);}handleDateClear(){this.tempDateFrom.set(""),this.tempDateTo.set(""),this.onDateChange&&this.onDateChange(void 0),this.isFilterOpen.set(false);}ngOnDestroy(){this.peopleDebounceTimer&&(clearTimeout(this.peopleDebounceTimer),this.peopleDebounceTimer=null);}onDocumentClick(e,t){let n=e.target;!n.closest(t)&&!n.closest(".ogrid-header-filter__popover")&&this.isFilterOpen.set(false);}};l([Input({required:true})],T.prototype,"columnKey",2),l([Input({required:true})],T.prototype,"columnName",2),l([Input({required:true})],T.prototype,"filterType",1),l([Input()],T.prototype,"selectedValues",1),l([Input()],T.prototype,"options",1),l([Input()],T.prototype,"textValue",1),l([Input()],T.prototype,"selectedUser",1),l([Input()],T.prototype,"dateValue",1),l([Input()],T.prototype,"isSorted",2),l([Input()],T.prototype,"isSortedDescending",2),l([Input()],T.prototype,"onSort",2),l([Input()],T.prototype,"onFilterChange",2),l([Input()],T.prototype,"isLoadingOptions",2),l([Input()],T.prototype,"onTextChange",2),l([Input()],T.prototype,"onUserChange",2),l([Input()],T.prototype,"peopleSearch",2),l([Input()],T.prototype,"onDateChange",2);var Ce=class{constructor(){this._columns=signal([]);this._visibleColumns=signal(new Set);this.visibilityChange=new EventEmitter;this.isOpen=signal(false);this.visibleCount=computed(()=>this._visibleColumns().size);this.totalCount=computed(()=>this._columns().length);}set columns(e){this._columns.set(e);}get columns(){return this._columns()}set visibleColumns(e){this._visibleColumns.set(e);}get visibleColumns(){return this._visibleColumns()}toggle(){this.isOpen.update(e=>!e);}onCheckboxChange(e,t){let n=t.target.checked;this.visibilityChange.emit({columnKey:e,visible:n});}onToggle(e,t){this.visibilityChange.emit({columnKey:e,visible:t});}selectAll(){for(let e of this.columns)this.visibleColumns.has(e.columnId)||this.visibilityChange.emit({columnKey:e.columnId,visible:true});}clearAll(){for(let e of this.columns)this.visibleColumns.has(e.columnId)&&this.visibilityChange.emit({columnKey:e.columnId,visible:false});}onClearAll(){for(let e of this.columns)e.required!==true&&this.visibleColumns.has(e.columnId)&&this.visibilityChange.emit({columnKey:e.columnId,visible:false});}onSelectAll(){for(let e of this.columns)this.visibleColumns.has(e.columnId)||this.visibilityChange.emit({columnKey:e.columnId,visible:true});}};l([Input({required:true})],Ce.prototype,"columns",1),l([Input({required:true})],Ce.prototype,"visibleColumns",1),l([Output()],Ce.prototype,"visibilityChange",2);var $=class{constructor(){this._currentPage=signal(1);this._pageSize=signal(25);this._totalCount=signal(0);this._pageSizeOptions=signal(void 0);this._entityLabelPlural=signal("items");this.pageChange=new EventEmitter;this.pageSizeChange=new EventEmitter;this.labelPlural=computed(()=>this._entityLabelPlural()??"items");this.vm=computed(()=>{let e=this._pageSizeOptions();return getPaginationViewModel(this._currentPage(),this._pageSize(),this._totalCount(),e?{pageSizeOptions:e}:void 0)});}set currentPage(e){this._currentPage.set(e);}get currentPage(){return this._currentPage()}set pageSize(e){this._pageSize.set(e);}get pageSize(){return this._pageSize()}set totalCount(e){this._totalCount.set(e);}get totalCount(){return this._totalCount()}set pageSizeOptions(e){this._pageSizeOptions.set(e);}get pageSizeOptions(){return this._pageSizeOptions()}set entityLabelPlural(e){this._entityLabelPlural.set(e);}get entityLabelPlural(){return this._entityLabelPlural()}onPageSizeSelect(e){let t=Number(e.target.value);this.pageSizeChange.emit(t);}onPageSizeChange(e){this.pageSizeChange.emit(Number(e));}};l([Input({required:true})],$.prototype,"currentPage",1),l([Input({required:true})],$.prototype,"pageSize",1),l([Input({required:true})],$.prototype,"totalCount",1),l([Input()],$.prototype,"pageSizeOptions",1),l([Input()],$.prototype,"entityLabelPlural",1),l([Output()],$.prototype,"pageChange",2),l([Output()],$.prototype,"pageSizeChange",2);var L=class{constructor(){this.commit=new EventEmitter;this.cancel=new EventEmitter;this.localValue=signal("");this.highlightedIndex=signal(0);this.selectOptions=signal([]);this.searchText=signal("");this.scrollCleanup=null;this.filteredOptions=computed(()=>{let e=this.selectOptions(),t=this.searchText().trim().toLowerCase();return t?e.filter(n=>this.getDisplayText(n).toLowerCase().includes(t)):e});this._initialized=false;}ngOnInit(){this._initialized=true,this.syncFromInputs();}ngOnChanges(){this._initialized&&this.syncFromInputs();}syncFromInputs(){let e=this.value,t=e!=null?String(e):"";if(this.editorType==="date"){let i=this.getDateFormat();this.getCellEditorType()==="native"?t=t.match(/^\d{4}-\d{2}-\d{2}/)?t.substring(0,10):t:t=formatDateForDisplay(t,i)??t;}this.localValue.set(t);let n=this.column;if(n?.cellEditorParams?.values){let i=n.cellEditorParams.values;this.selectOptions.set(i);let o=i.findIndex(r=>String(r)===String(e));this.highlightedIndex.set(Math.max(o,0));}}ngAfterViewInit(){setTimeout(()=>{let e=this.richSelectInput?.nativeElement;if(e){e.focus(),e.select(),this.positionFixedDropdown(this.richSelectWrapper,this.richSelectDropdown),this.attachScrollClose(this.richSelectWrapper?.nativeElement);return}let t=this.selectWrapper?.nativeElement;if(t){t.focus(),this.positionFixedDropdown(this.selectWrapper,this.selectDropdown),this.attachScrollClose(t);return}let n=this.inputEl?.nativeElement;n&&(n.focus(),n instanceof HTMLInputElement&&n.type==="text"&&n.select());});}ngOnDestroy(){this.scrollCleanup?.();}attachScrollClose(e){if(!e)return;let t=e.closest("[data-ogrid-scroll-container]")??e.closest('[style*="overflow"]'),n=()=>this.cancel.emit(),i=requestAnimationFrame(()=>{t&&t.addEventListener("scroll",n,{passive:true}),window.addEventListener("scroll",n,{passive:true});});this.scrollCleanup=()=>{cancelAnimationFrame(i),t&&t.removeEventListener("scroll",n),window.removeEventListener("scroll",n);};}commitValue(e){this.commit.emit(e);}onTextKeyDown(e){e.key==="Enter"?(e.preventDefault(),this.commitDateOrValue()):e.key==="Escape"?(e.preventDefault(),this.cancel.emit()):e.key==="Tab"&&(e.preventDefault(),this.commitDateOrValue());}commitDateOrValue(){if(this.editorType==="date"&&this.getCellEditorType()!=="native"){let t=String(this.localValue());if(!t.trim()){this.commitValue(null);return}let n=parseUserInputDate(t,this.getDateFormat()),i=n instanceof Date?n.toISOString().substring(0,10):t;this.commitValue(i);return}this.commitValue(this.localValue());}getDateFormat(){return this.column?.cellEditorParams?.dateFormat??this.column?.dateFormat??"YYYY-MM-DD"}getCellEditorType(){return this.column?.cellEditorParams?.editorType??"text"}getDatePlaceholder(){return getDateInputPlaceholder(this.getDateFormat())}getDisplayText(e){let t=this.column?.cellEditorParams?.formatValue;return t?t(e):e!=null?String(e):""}onCustomSelectKeyDown(e){let t=this.selectOptions();switch(e.key){case "ArrowDown":e.preventDefault(),this.highlightedIndex.set(Math.min(this.highlightedIndex()+1,t.length-1)),this.scrollOptionIntoView(this.selectDropdown);break;case "ArrowUp":e.preventDefault(),this.highlightedIndex.set(Math.max(this.highlightedIndex()-1,0)),this.scrollOptionIntoView(this.selectDropdown);break;case "Enter":e.preventDefault(),e.stopPropagation(),t.length>0&&this.highlightedIndex()<t.length&&this.commitValue(t[this.highlightedIndex()]);break;case "Tab":e.preventDefault(),t.length>0&&this.highlightedIndex()<t.length&&this.commitValue(t[this.highlightedIndex()]);break;case "Escape":e.preventDefault(),e.stopPropagation(),this.cancel.emit();break}}onRichSelectSearch(e){this.searchText.set(e),this.highlightedIndex.set(0);}onRichSelectKeyDown(e){let t=this.filteredOptions();switch(e.key){case "ArrowDown":e.preventDefault(),this.highlightedIndex.set(Math.min(this.highlightedIndex()+1,t.length-1)),this.scrollOptionIntoView(this.richSelectOptions);break;case "ArrowUp":e.preventDefault(),this.highlightedIndex.set(Math.max(this.highlightedIndex()-1,0)),this.scrollOptionIntoView(this.richSelectOptions);break;case "Enter":e.preventDefault(),e.stopPropagation(),t.length>0&&this.highlightedIndex()<t.length&&this.commitValue(t[this.highlightedIndex()]);break;case "Escape":e.preventDefault(),e.stopPropagation(),this.cancel.emit();break}}onCheckboxKeyDown(e){e.key==="Escape"&&(e.preventDefault(),this.cancel.emit());}onTextBlur(){if(this.editorType==="date"&&this.getCellEditorType()!=="native"){let t=String(this.localValue());if(!t.trim()){this.commitValue(null);return}let n=parseUserInputDate(t,this.getDateFormat()),i=n instanceof Date?n.toISOString():t;this.commitValue(i);return}this.commitValue(this.localValue());}getInputStyle(){let e="width:100%;box-sizing:border-box;padding:6px 10px;border:none;outline:none;font:inherit;background:transparent;color:inherit;";return this.column.type==="numeric"?e+"text-align:right;":e}positionFixedDropdown(e,t){let n=e?.nativeElement,i=t?.nativeElement;if(!n||!i)return;let o=n.getBoundingClientRect(),r=200,s=window.innerHeight-o.bottom,u=s<r&&o.top>s;i.style.position="fixed",i.style.left=`${o.left}px`,i.style.width=`${o.width}px`,i.style.maxHeight=`${r}px`,i.style.zIndex="9999",i.style.right="auto",i.style.textAlign="left",u?(i.style.top="auto",i.style.bottom=`${window.innerHeight-o.top}px`):i.style.top=`${o.bottom}px`;}scrollOptionIntoView(e){setTimeout(()=>{let t=e?.nativeElement;if(!t)return;t.children[this.highlightedIndex()]?.scrollIntoView({block:"nearest"});});}};l([Input({required:true})],L.prototype,"value",2),l([Input({required:true})],L.prototype,"item",2),l([Input({required:true})],L.prototype,"column",2),l([Input({required:true})],L.prototype,"rowIndex",2),l([Input({required:true})],L.prototype,"editorType",2),l([Output()],L.prototype,"commit",2),l([Output()],L.prototype,"cancel",2),l([ViewChild("inputEl")],L.prototype,"inputEl",2),l([ViewChild("selectWrapper")],L.prototype,"selectWrapper",2),l([ViewChild("selectDropdown")],L.prototype,"selectDropdown",2),l([ViewChild("richSelectWrapper")],L.prototype,"richSelectWrapper",2),l([ViewChild("richSelectInput")],L.prototype,"richSelectInput",2),l([ViewChild("richSelectDropdown")],L.prototype,"richSelectDropdown",2),l([ViewChild("richSelectOptions")],L.prototype,"richSelectOptions",2);var q=class{constructor(){this._canPinLeft=signal(true);this._canPinRight=signal(true);this._canUnpin=signal(false);this._currentSort=signal(null);this._isSortable=signal(true);this._isResizable=signal(true);this.handlers={};this.menuItems=computed(()=>getColumnHeaderMenuItems({canPinLeft:this._canPinLeft(),canPinRight:this._canPinRight(),canUnpin:this._canUnpin(),currentSort:this._currentSort(),isSortable:this._isSortable(),isResizable:this._isResizable()}));}set canPinLeft(e){this._canPinLeft.set(e);}set canPinRight(e){this._canPinRight.set(e);}set canUnpin(e){this._canUnpin.set(e);}set currentSort(e){this._currentSort.set(e);}set isSortable(e){this._isSortable.set(e);}set isResizable(e){this._isResizable.set(e);}handleMenuItemClick(e){let t=this.handlers,i={pinLeft:t.onPinLeft,pinRight:t.onPinRight,unpin:t.onUnpin,sortAsc:t.onSortAsc,sortDesc:t.onSortDesc,clearSort:t.onClearSort,autosizeThis:t.onAutosizeThis,autosizeAll:t.onAutosizeAll}[e];i&&(i(),t.onClose?.());}};l([Input({required:true})],q.prototype,"columnId",2),l([Input()],q.prototype,"canPinLeft",1),l([Input()],q.prototype,"canPinRight",1),l([Input()],q.prototype,"canUnpin",1),l([Input()],q.prototype,"currentSort",1),l([Input()],q.prototype,"isSortable",1),l([Input()],q.prototype,"isResizable",1),l([Input()],q.prototype,"handlers",2);var oo=`
674
674
  @switch (editorType) {
675
675
  @case ('text') {
676
676
  <input
@@ -686,28 +686,34 @@ import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelect
686
686
  @case ('richSelect') {
687
687
  <div #richSelectWrapper
688
688
  style="width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;min-width:0;position:relative">
689
- <input
690
- #richSelectInput
691
- type="text"
692
- [value]="searchText()"
693
- (input)="onRichSelectSearch($any($event.target).value)"
694
- (keydown)="onRichSelectKeyDown($event)"
695
- placeholder="Search..."
696
- style="width:100%;padding:0;border:none;background:transparent;color:inherit;font:inherit;font-size:13px;outline:none;min-width:0"
697
- />
689
+ <div style="display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer;font-size:13px;color:inherit">
690
+ <span>{{ getDisplayText(value) }}</span>
691
+ <span style="margin-left:4px;font-size:10px;opacity:0.5">&#9662;</span>
692
+ </div>
698
693
  <div #richSelectDropdown role="listbox"
699
- style="position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2);text-align:left">
700
- @for (opt of filteredOptions(); track opt; let i = $index) {
701
- <div role="option"
702
- [attr.aria-selected]="i === highlightedIndex()"
703
- (click)="commitValue(opt)"
704
- [style]="i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424)'">
705
- {{ getDisplayText(opt) }}
706
- </div>
707
- }
708
- @if (filteredOptions().length === 0) {
709
- <div style="padding:6px 8px;color:var(--ogrid-muted, #999)">No matches</div>
710
- }
694
+ style="position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2);text-align:left;font-size:13px;font-family:inherit">
695
+ <input
696
+ #richSelectInput
697
+ type="text"
698
+ [value]="searchText()"
699
+ (input)="onRichSelectSearch($any($event.target).value)"
700
+ (keydown)="onRichSelectKeyDown($event)"
701
+ placeholder="Search..."
702
+ style="width:100%;padding:6px 8px;border:none;border-bottom:1px solid var(--ogrid-border, rgba(0,0,0,0.12));background:var(--ogrid-bg, #fff);color:inherit;font:inherit;font-size:13px;outline:none;box-sizing:border-box;position:sticky;top:0;z-index:1"
703
+ />
704
+ <div #richSelectOptions>
705
+ @for (opt of filteredOptions(); track opt; let i = $index) {
706
+ <div role="option"
707
+ [attr.aria-selected]="i === highlightedIndex()"
708
+ (click)="commitValue(opt)"
709
+ [style]="i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);font-size:13px;background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);font-size:13px'">
710
+ {{ getDisplayText(opt) }}
711
+ </div>
712
+ }
713
+ @if (filteredOptions().length === 0) {
714
+ <div style="padding:6px 8px;color:var(--ogrid-muted, #999);font-size:13px">No matches</div>
715
+ }
716
+ </div>
711
717
  </div>
712
718
  </div>
713
719
  }
@@ -720,12 +726,12 @@ import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelect
720
726
  <span style="margin-left:4px;font-size:10px;opacity:0.5">&#9662;</span>
721
727
  </div>
722
728
  <div #selectDropdown role="listbox"
723
- style="position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2);text-align:left">
729
+ style="position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2);text-align:left;font-size:13px;font-family:inherit">
724
730
  @for (opt of selectOptions(); track opt; let i = $index) {
725
731
  <div role="option"
726
732
  [attr.aria-selected]="i === highlightedIndex()"
727
733
  (click)="commitValue(opt)"
728
- [style]="i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424)'">
734
+ [style]="i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);font-size:13px;background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);font-size:13px'">
729
735
  {{ getDisplayText(opt) }}
730
736
  </div>
731
737
  }
@@ -743,15 +749,28 @@ import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelect
743
749
  </div>
744
750
  }
745
751
  @case ('date') {
746
- <input
747
- #inputEl
748
- type="text"
749
- [value]="localValue()"
750
- (input)="localValue.set($any($event.target).value)"
751
- (keydown)="onTextKeyDown($event)"
752
- (blur)="onTextBlur()"
753
- [style]="getInputStyle()"
754
- />
752
+ @if (getCellEditorType() === 'native') {
753
+ <input
754
+ #inputEl
755
+ type="date"
756
+ [value]="localValue()"
757
+ (input)="localValue.set($any($event.target).value)"
758
+ (keydown)="onTextKeyDown($event)"
759
+ (blur)="onTextBlur()"
760
+ [style]="getInputStyle()"
761
+ />
762
+ } @else {
763
+ <input
764
+ #inputEl
765
+ type="text"
766
+ [placeholder]="getDatePlaceholder()"
767
+ [value]="localValue()"
768
+ (input)="localValue.set($any($event.target).value)"
769
+ (keydown)="onTextKeyDown($event)"
770
+ (blur)="onTextBlur()"
771
+ [style]="getInputStyle()"
772
+ />
773
+ }
755
774
  }
756
775
  @default {
757
776
  <input
@@ -765,13 +784,13 @@ import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelect
765
784
  />
766
785
  }
767
786
  }
768
- `,no=`
787
+ `,ro=`
769
788
  :host {
770
789
  display: block;
771
790
  width: 100%;
772
791
  height: 100%;
773
792
  }
774
- `;var so=`
793
+ `;var co=`
775
794
  <div #anchorEl
776
795
  class="ogrid-popover-anchor"
777
796
  [attr.data-row-index]="rowIndex"
@@ -784,7 +803,7 @@ import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelect
784
803
  <div class="ogrid-popover-editor-content" #editorContainer></div>
785
804
  </div>
786
805
  }
787
- `,ao=`
806
+ `,ho=`
788
807
  :host { display: contents; }
789
808
  .ogrid-popover-editor-overlay {
790
809
  position: fixed; inset: 0; z-index: 1000;
@@ -797,4 +816,4 @@ import {createGridDataAccessor,columnLetterToIndex,flattenColumns,getMultiSelect
797
816
  max-width: 90vw; max-height: 90vh; overflow: auto;
798
817
  color: var(--ogrid-fg, rgba(0, 0, 0, 0.87));
799
818
  }
800
- `,W=class{constructor(){this.injector=inject(Injector);this.envInjector=inject(EnvironmentInjector);this.showEditor=signal(false);effect(()=>{this.anchorRef&&setTimeout(()=>this.showEditor.set(true),0);}),effect(e=>{let t=this.editorContainerRef,n=this.editorProps,i=this.column;if(!t||!this.showEditor()||typeof i.cellEditor!="function")return;let o=i.cellEditor,r=createComponent(o,{environmentInjector:this.envInjector,elementInjector:this.injector});Object.assign(r.instance,n),r.changeDetectorRef.detectChanges(),t.nativeElement.appendChild(r.location.nativeElement),e(()=>r.destroy());});}handleOverlayClick(){this.onCancel();}};l([Input({required:true})],W.prototype,"item",2),l([Input({required:true})],W.prototype,"column",2),l([Input({required:true})],W.prototype,"rowIndex",2),l([Input({required:true})],W.prototype,"globalColIndex",2),l([Input({required:true})],W.prototype,"displayValue",2),l([Input({required:true})],W.prototype,"editorProps",2),l([Input({required:true})],W.prototype,"onCancel",2),l([ViewChild("anchorEl")],W.prototype,"anchorRef",2),l([ViewChild("editorContainer")],W.prototype,"editorContainerRef",2);export{ve as BaseColumnChooserComponent,T as BaseColumnHeaderFilterComponent,q as BaseColumnHeaderMenuComponent,nt as BaseDataGridTableComponent,L as BaseInlineCellEditorComponent,Le as BaseOGridComponent,$ as BasePaginationControlsComponent,W as BasePopoverCellEditorComponent,le as ColumnReorderService,we as DataGridEditingHelper,Ie as DataGridInteractionHelper,Re as DataGridLayoutHelper,oe as DataGridStateService,Z as EmptyStateComponent,de as FormulaBarComponent,ne as FormulaEngineService,Ee as FormulaRefOverlayComponent,F as GridContextMenuComponent,no as INLINE_CELL_EDITOR_STYLES,to as INLINE_CELL_EDITOR_TEMPLATE,H as MarchingAntsOverlayComponent,Xe as OGRID_THEME_VARS_CSS,A as OGridLayoutComponent,ie as OGridService,ao as POPOVER_CELL_EDITOR_OVERLAY_STYLES,so as POPOVER_CELL_EDITOR_TEMPLATE,ue as SheetTabsComponent,Q as SideBarComponent,N as StatusBarComponent,ae as VirtualScrollService,wt as createDebouncedCallback,Rt as createDebouncedSignal,xt as createLatestCallback};
819
+ `,W=class{constructor(){this.injector=inject(Injector);this.envInjector=inject(EnvironmentInjector);this.showEditor=signal(false);effect(()=>{this.anchorRef&&setTimeout(()=>this.showEditor.set(true),0);}),effect(e=>{let t=this.editorContainerRef,n=this.editorProps,i=this.column;if(!t||!this.showEditor()||typeof i.cellEditor!="function")return;let o=i.cellEditor,r=createComponent(o,{environmentInjector:this.envInjector,elementInjector:this.injector});Object.assign(r.instance,n),r.changeDetectorRef.detectChanges(),t.nativeElement.appendChild(r.location.nativeElement),e(()=>r.destroy());});}handleOverlayClick(){this.onCancel();}};l([Input({required:true})],W.prototype,"item",2),l([Input({required:true})],W.prototype,"column",2),l([Input({required:true})],W.prototype,"rowIndex",2),l([Input({required:true})],W.prototype,"globalColIndex",2),l([Input({required:true})],W.prototype,"displayValue",2),l([Input({required:true})],W.prototype,"editorProps",2),l([Input({required:true})],W.prototype,"onCancel",2),l([ViewChild("anchorEl")],W.prototype,"anchorRef",2),l([ViewChild("editorContainer")],W.prototype,"editorContainerRef",2);export{Ce as BaseColumnChooserComponent,T as BaseColumnHeaderFilterComponent,q as BaseColumnHeaderMenuComponent,nt as BaseDataGridTableComponent,L as BaseInlineCellEditorComponent,Le as BaseOGridComponent,$ as BasePaginationControlsComponent,W as BasePopoverCellEditorComponent,le as ColumnReorderService,we as DataGridEditingHelper,Ie as DataGridInteractionHelper,Re as DataGridLayoutHelper,oe as DataGridStateService,Z as EmptyStateComponent,de as FormulaBarComponent,ne as FormulaEngineService,Ee as FormulaRefOverlayComponent,F as GridContextMenuComponent,ro as INLINE_CELL_EDITOR_STYLES,oo as INLINE_CELL_EDITOR_TEMPLATE,H as MarchingAntsOverlayComponent,Xe as OGRID_THEME_VARS_CSS,A as OGridLayoutComponent,ie as OGridService,ho as POPOVER_CELL_EDITOR_OVERLAY_STYLES,co as POPOVER_CELL_EDITOR_TEMPLATE,ue as SheetTabsComponent,Q as SideBarComponent,N as StatusBarComponent,ae as VirtualScrollService,wt as createDebouncedCallback,Rt as createDebouncedSignal,xt as createLatestCallback};
@@ -19,7 +19,7 @@ export declare abstract class BaseDataGridTableComponent<T = unknown> {
19
19
  readonly virtualScrollService: VirtualScrollService;
20
20
  protected lastMouseShift: boolean;
21
21
  readonly columnSizingVersion: import("@angular/core").WritableSignal<number>;
22
- /** Dirty flagset when column layout changes, cleared after measurement. */
22
+ /** Dirty flag - set when column layout changes, cleared after measurement. */
23
23
  private readonly measureDirty;
24
24
  /** DOM-measured column widths from the last layout pass.
25
25
  * Used as a minWidth floor to prevent columns from shrinking
@@ -33,9 +33,9 @@ export declare abstract class BaseDataGridTableComponent<T = unknown> {
33
33
  protected abstract getWrapperRef(): ElementRef<HTMLElement> | undefined;
34
34
  /** Return the table container element ref */
35
35
  protected abstract getTableContainerRef(): ElementRef<HTMLElement> | undefined;
36
- /** Lifecycle hookpopulate element signals from @ViewChild refs */
36
+ /** Lifecycle hook - populate element signals from @ViewChild refs */
37
37
  ngAfterViewInit(): void;
38
- /** Lifecycle hookre-measure column widths only when layout changed */
38
+ /** Lifecycle hook - re-measure column widths only when layout changed */
39
39
  ngAfterViewChecked(): void;
40
40
  /** Measure actual th widths from the DOM and update the measuredColumnWidths signal.
41
41
  * Only updates the signal when values actually change, to avoid render loops. */
@@ -195,8 +195,8 @@ export declare abstract class BaseDataGridTableComponent<T = unknown> {
195
195
  * ensure the first (null) run is a safe no-op.
196
196
  *
197
197
  * Sequence:
198
- * 1. Constructor`initBase()`effects created, first run (signals nullno-ops)
199
- * 2. `ngAfterViewInit``wrapperElSignal.set(el)`effects re-run with real values
198
+ * 1. Constructor to `initBase()` to effects created, first run (signals null to no-ops)
199
+ * 2. `ngAfterViewInit` to `wrapperElSignal.set(el)` to effects re-run with real values
200
200
  */
201
201
  protected initBase(): void;
202
202
  /** Lookup effective min-width for a column (includes measured width floor) */
@@ -223,7 +223,7 @@ export declare abstract class BaseDataGridTableComponent<T = unknown> {
223
223
  visibleColIndex(col: IColumnDef<T>): number;
224
224
  getColumnWidth(col: IColumnDef<T>): number;
225
225
  getFilterConfig(col: IColumnDef<T>): HeaderFilterConfig;
226
- /** Memoized column menu handlersavoids recreating objects on every CD cycle */
226
+ /** Memoized column menu handlers - avoids recreating objects on every CD cycle */
227
227
  protected readonly columnMenuHandlersMap: import("@angular/core").Signal<Map<string, {
228
228
  onPinLeft: () => void;
229
229
  onPinRight: () => void;
@@ -21,6 +21,7 @@ export declare abstract class BaseInlineCellEditorComponent<T = unknown> {
21
21
  richSelectWrapper?: ElementRef<HTMLDivElement>;
22
22
  richSelectInput?: ElementRef<HTMLInputElement>;
23
23
  richSelectDropdown?: ElementRef<HTMLDivElement>;
24
+ richSelectOptions?: ElementRef<HTMLDivElement>;
24
25
  readonly localValue: import("@angular/core").WritableSignal<unknown>;
25
26
  readonly highlightedIndex: import("@angular/core").WritableSignal<number>;
26
27
  readonly selectOptions: import("@angular/core").WritableSignal<unknown[]>;
@@ -39,6 +40,10 @@ export declare abstract class BaseInlineCellEditorComponent<T = unknown> {
39
40
  private attachScrollClose;
40
41
  commitValue(value: unknown): void;
41
42
  onTextKeyDown(e: KeyboardEvent): void;
43
+ private commitDateOrValue;
44
+ getDateFormat(): string;
45
+ getCellEditorType(): 'native' | 'text' | 'calendar';
46
+ getDatePlaceholder(): string;
42
47
  getDisplayText(value: unknown): string;
43
48
  onCustomSelectKeyDown(e: KeyboardEvent): void;
44
49
  onRichSelectSearch(text: string): void;
@@ -7,7 +7,7 @@ import { EventEmitter } from '@angular/core';
7
7
  * 1. Provide a @Component decorator with template and styles
8
8
  *
9
9
  * Uses @Input setter + signal pattern so computed() can track dependencies.
10
- * (Plain @Input properties are NOT tracked by computed()only signals are.)
10
+ * (Plain @Input properties are NOT tracked by computed() - only signals are.)
11
11
  */
12
12
  export declare abstract class BasePaginationControlsComponent {
13
13
  private readonly _currentPage;
@@ -2,5 +2,5 @@
2
2
  * Shared inline cell editor template used by all Angular UI packages.
3
3
  * The template is identical across Material, PrimeNG, and Radix implementations.
4
4
  */
5
- export declare const INLINE_CELL_EDITOR_TEMPLATE = "\n @switch (editorType) {\n @case ('text') {\n <input\n #inputEl\n type=\"text\"\n [value]=\"localValue()\"\n (input)=\"localValue.set($any($event.target).value)\"\n (keydown)=\"onTextKeyDown($event)\"\n (blur)=\"onTextBlur()\"\n [style]=\"getInputStyle()\"\n />\n }\n @case ('richSelect') {\n <div #richSelectWrapper\n style=\"width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;min-width:0;position:relative\">\n <input\n #richSelectInput\n type=\"text\"\n [value]=\"searchText()\"\n (input)=\"onRichSelectSearch($any($event.target).value)\"\n (keydown)=\"onRichSelectKeyDown($event)\"\n placeholder=\"Search...\"\n style=\"width:100%;padding:0;border:none;background:transparent;color:inherit;font:inherit;font-size:13px;outline:none;min-width:0\"\n />\n <div #richSelectDropdown role=\"listbox\"\n style=\"position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2);text-align:left\">\n @for (opt of filteredOptions(); track opt; let i = $index) {\n <div role=\"option\"\n [attr.aria-selected]=\"i === highlightedIndex()\"\n (click)=\"commitValue(opt)\"\n [style]=\"i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424)'\">\n {{ getDisplayText(opt) }}\n </div>\n }\n @if (filteredOptions().length === 0) {\n <div style=\"padding:6px 8px;color:var(--ogrid-muted, #999)\">No matches</div>\n }\n </div>\n </div>\n }\n @case ('select') {\n <div #selectWrapper tabindex=\"0\"\n style=\"width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;min-width:0;position:relative\"\n (keydown)=\"onCustomSelectKeyDown($event)\">\n <div style=\"display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer;font-size:13px;color:inherit\">\n <span>{{ getDisplayText(value) }}</span>\n <span style=\"margin-left:4px;font-size:10px;opacity:0.5\">&#9662;</span>\n </div>\n <div #selectDropdown role=\"listbox\"\n style=\"position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2);text-align:left\">\n @for (opt of selectOptions(); track opt; let i = $index) {\n <div role=\"option\"\n [attr.aria-selected]=\"i === highlightedIndex()\"\n (click)=\"commitValue(opt)\"\n [style]=\"i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424)'\">\n {{ getDisplayText(opt) }}\n </div>\n }\n </div>\n </div>\n }\n @case ('checkbox') {\n <div style=\"display:flex;align-items:center;justify-content:center;width:100%;height:100%\">\n <input\n type=\"checkbox\"\n [checked]=\"!!localValue()\"\n (change)=\"commitValue($any($event.target).checked)\"\n (keydown)=\"onCheckboxKeyDown($event)\"\n />\n </div>\n }\n @case ('date') {\n <input\n #inputEl\n type=\"text\"\n [value]=\"localValue()\"\n (input)=\"localValue.set($any($event.target).value)\"\n (keydown)=\"onTextKeyDown($event)\"\n (blur)=\"onTextBlur()\"\n [style]=\"getInputStyle()\"\n />\n }\n @default {\n <input\n #inputEl\n type=\"text\"\n [value]=\"localValue()\"\n (input)=\"localValue.set($any($event.target).value)\"\n (keydown)=\"onTextKeyDown($event)\"\n (blur)=\"onTextBlur()\"\n [style]=\"getInputStyle()\"\n />\n }\n }\n";
5
+ export declare const INLINE_CELL_EDITOR_TEMPLATE = "\n @switch (editorType) {\n @case ('text') {\n <input\n #inputEl\n type=\"text\"\n [value]=\"localValue()\"\n (input)=\"localValue.set($any($event.target).value)\"\n (keydown)=\"onTextKeyDown($event)\"\n (blur)=\"onTextBlur()\"\n [style]=\"getInputStyle()\"\n />\n }\n @case ('richSelect') {\n <div #richSelectWrapper\n style=\"width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;min-width:0;position:relative\">\n <div style=\"display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer;font-size:13px;color:inherit\">\n <span>{{ getDisplayText(value) }}</span>\n <span style=\"margin-left:4px;font-size:10px;opacity:0.5\">&#9662;</span>\n </div>\n <div #richSelectDropdown role=\"listbox\"\n style=\"position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2);text-align:left;font-size:13px;font-family:inherit\">\n <input\n #richSelectInput\n type=\"text\"\n [value]=\"searchText()\"\n (input)=\"onRichSelectSearch($any($event.target).value)\"\n (keydown)=\"onRichSelectKeyDown($event)\"\n placeholder=\"Search...\"\n style=\"width:100%;padding:6px 8px;border:none;border-bottom:1px solid var(--ogrid-border, rgba(0,0,0,0.12));background:var(--ogrid-bg, #fff);color:inherit;font:inherit;font-size:13px;outline:none;box-sizing:border-box;position:sticky;top:0;z-index:1\"\n />\n <div #richSelectOptions>\n @for (opt of filteredOptions(); track opt; let i = $index) {\n <div role=\"option\"\n [attr.aria-selected]=\"i === highlightedIndex()\"\n (click)=\"commitValue(opt)\"\n [style]=\"i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);font-size:13px;background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);font-size:13px'\">\n {{ getDisplayText(opt) }}\n </div>\n }\n @if (filteredOptions().length === 0) {\n <div style=\"padding:6px 8px;color:var(--ogrid-muted, #999);font-size:13px\">No matches</div>\n }\n </div>\n </div>\n </div>\n }\n @case ('select') {\n <div #selectWrapper tabindex=\"0\"\n style=\"width:100%;height:100%;display:flex;align-items:center;padding:6px 10px;box-sizing:border-box;min-width:0;position:relative\"\n (keydown)=\"onCustomSelectKeyDown($event)\">\n <div style=\"display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer;font-size:13px;color:inherit\">\n <span>{{ getDisplayText(value) }}</span>\n <span style=\"margin-left:4px;font-size:10px;opacity:0.5\">&#9662;</span>\n </div>\n <div #selectDropdown role=\"listbox\"\n style=\"position:absolute;top:100%;left:0;right:0;max-height:200px;overflow-y:auto;background:var(--ogrid-bg, #fff);border:1px solid var(--ogrid-border, rgba(0,0,0,0.12));z-index:10;box-shadow:0 4px 16px rgba(0,0,0,0.2);text-align:left;font-size:13px;font-family:inherit\">\n @for (opt of selectOptions(); track opt; let i = $index) {\n <div role=\"option\"\n [attr.aria-selected]=\"i === highlightedIndex()\"\n (click)=\"commitValue(opt)\"\n [style]=\"i === highlightedIndex() ? 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);font-size:13px;background:var(--ogrid-bg-hover, #e8f0fe)' : 'padding:6px 8px;cursor:pointer;color:var(--ogrid-fg, #242424);font-size:13px'\">\n {{ getDisplayText(opt) }}\n </div>\n }\n </div>\n </div>\n }\n @case ('checkbox') {\n <div style=\"display:flex;align-items:center;justify-content:center;width:100%;height:100%\">\n <input\n type=\"checkbox\"\n [checked]=\"!!localValue()\"\n (change)=\"commitValue($any($event.target).checked)\"\n (keydown)=\"onCheckboxKeyDown($event)\"\n />\n </div>\n }\n @case ('date') {\n @if (getCellEditorType() === 'native') {\n <input\n #inputEl\n type=\"date\"\n [value]=\"localValue()\"\n (input)=\"localValue.set($any($event.target).value)\"\n (keydown)=\"onTextKeyDown($event)\"\n (blur)=\"onTextBlur()\"\n [style]=\"getInputStyle()\"\n />\n } @else {\n <input\n #inputEl\n type=\"text\"\n [placeholder]=\"getDatePlaceholder()\"\n [value]=\"localValue()\"\n (input)=\"localValue.set($any($event.target).value)\"\n (keydown)=\"onTextKeyDown($event)\"\n (blur)=\"onTextBlur()\"\n [style]=\"getInputStyle()\"\n />\n }\n }\n @default {\n <input\n #inputEl\n type=\"text\"\n [value]=\"localValue()\"\n (input)=\"localValue.set($any($event.target).value)\"\n (keydown)=\"onTextKeyDown($event)\"\n (blur)=\"onTextBlur()\"\n [style]=\"getInputStyle()\"\n />\n }\n }\n";
6
6
  export declare const INLINE_CELL_EDITOR_STYLES = "\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n";
@@ -5,7 +5,7 @@ type IColumnDef<T> = IAngularColumnDef<T>;
5
5
  * Manages cell editing state, inline/popover editor, and commit/cancel logic.
6
6
  * Extracted from DataGridStateService for modularity.
7
7
  *
8
- * Not @Injectableinstantiated and owned by DataGridStateService.
8
+ * Not @Injectable - instantiated and owned by DataGridStateService.
9
9
  */
10
10
  export declare class DataGridEditingHelper<T> {
11
11
  readonly editingCellSig: import("@angular/core").WritableSignal<{
@@ -6,7 +6,7 @@ type IColumnDef<T> = IAngularColumnDef<T>;
6
6
  * Manages cell selection, keyboard navigation, clipboard, fill handle, and undo/redo.
7
7
  * Extracted from DataGridStateService for modularity.
8
8
  *
9
- * Not @Injectableinstantiated and owned by DataGridStateService.
9
+ * Not @Injectable - instantiated and owned by DataGridStateService.
10
10
  */
11
11
  export declare class DataGridInteractionHelper<T> {
12
12
  readonly activeCellSig: import("@angular/core").WritableSignal<IActiveCell | null>;
@@ -7,7 +7,7 @@ type IColumnDef<T> = IAngularColumnDef<T>;
7
7
  * Manages column layout, visibility, sizing, and container measurement.
8
8
  * Extracted from DataGridStateService for modularity.
9
9
  *
10
- * Not @Injectableinstantiated and owned by DataGridStateService.
10
+ * Not @Injectable - instantiated and owned by DataGridStateService.
11
11
  */
12
12
  export declare class DataGridLayoutHelper<T> {
13
13
  readonly props: ReturnType<typeof signal<IOGridDataGridProps<T> | null>>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * FormulaEngineServiceAngular service for integrating the formula engine with the grid.
2
+ * FormulaEngineService - Angular service for integrating the formula engine with the grid.
3
3
  *
4
4
  * Lazily creates a FormulaEngine instance when configured with `formulas: true`.
5
5
  * Provides an accessor bridge between grid data and formula coordinates.
@@ -21,7 +21,7 @@ export interface FormulaEngineConfig {
21
21
  formulaFunctions?: Record<string, IFormulaFunction>;
22
22
  /** Called when recalculation produces cascading updates. */
23
23
  onFormulaRecalc?: (result: IRecalcResult) => void;
24
- /** Named ranges: namecell/range reference string. */
24
+ /** Named ranges: name to cell/range reference string. */
25
25
  namedRanges?: Record<string, string>;
26
26
  /** Sheet accessors for cross-sheet references. */
27
27
  sheets?: Record<string, IGridDataAccessor>;
@@ -29,7 +29,7 @@ export interface FormulaEngineConfig {
29
29
  /**
30
30
  * Per-component injectable service that wraps FormulaEngine from @alaarab/ogrid-core.
31
31
  *
32
- * Not providedIn: 'root'provide it per component so each grid instance
32
+ * Not providedIn: 'root' - provide it per component so each grid instance
33
33
  * gets its own formula engine.
34
34
  */
35
35
  export declare class FormulaEngineService<T = unknown> {
@@ -150,7 +150,7 @@ export declare class OGridService<T> {
150
150
  private readonly formulaBarEditing;
151
151
  private readonly formulaBarEditText;
152
152
  private readonly formulaService;
153
- /** Monotonic counter incremented on formula recalculationdrives cache invalidation. */
153
+ /** Monotonic counter incremented on formula recalculation - drives cache invalidation. */
154
154
  readonly formulaVersion: import("@angular/core").WritableSignal<number>;
155
155
  private readonly getFormulaValueFn;
156
156
  private readonly hasFormulaFn;
@@ -206,7 +206,7 @@ export declare class OGridService<T> {
206
206
  items: T[];
207
207
  totalCount: number;
208
208
  } | null>;
209
- /** Resolved client itemssync or async depending on workerSort. */
209
+ /** Resolved client items - sync or async depending on workerSort. */
210
210
  readonly resolvedClientItems: import("@angular/core").Signal<{
211
211
  items: T[];
212
212
  totalCount: number;
@@ -2,7 +2,7 @@
2
2
  * Shared OGrid CSS theme variables (light + dark mode).
3
3
  * Used by all Angular UI packages (Material, PrimeNG, Radix) to avoid duplication.
4
4
  *
5
- * Uses :where() selectors for ZERO specificityconsumer overrides always win.
5
+ * Uses :where() selectors for ZERO specificity - consumer overrides always win.
6
6
  * Dark mode: auto via prefers-color-scheme, explicit via [data-theme="dark"].
7
7
  */
8
8
  export declare const OGRID_THEME_VARS_CSS = "\n/* \u2500\u2500\u2500 OGrid Light Theme (default) \u2500\u2500\u2500 */\n:where(:root) {\n --ogrid-bg: #ffffff;\n --ogrid-fg: rgba(0, 0, 0, 0.87);\n --ogrid-fg-secondary: rgba(0, 0, 0, 0.6);\n --ogrid-fg-muted: rgba(0, 0, 0, 0.5);\n --ogrid-border: rgba(0, 0, 0, 0.12);\n --ogrid-border-strong: rgba(0, 0, 0, 0.5);\n --ogrid-border-hover: rgba(0, 0, 0, 0.3);\n --ogrid-header-bg: #f5f5f5;\n --ogrid-hover-bg: rgba(0, 0, 0, 0.04);\n --ogrid-selected-row-bg: #e6f0fb;\n --ogrid-bg-selected-hover: #dae8f8;\n --ogrid-active-cell-bg: rgba(0, 0, 0, 0.02);\n --ogrid-range-bg: rgba(33, 115, 70, 0.12);\n --ogrid-accent: #0078d4;\n --ogrid-accent-dark: #005a9e;\n --ogrid-selection-color: #217346;\n --ogrid-primary: #0078d4;\n --ogrid-primary-fg: #fff;\n --ogrid-primary-hover: #106ebe;\n --ogrid-bg-subtle: #f5f5f5;\n --ogrid-bg-hover: rgba(0, 0, 0, 0.04);\n --ogrid-active-bg: rgba(0, 0, 0, 0.06);\n --ogrid-muted: rgba(0, 0, 0, 0.5);\n --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);\n --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);\n --ogrid-pinned-shadow: rgba(0, 0, 0, 0.1);\n --ogrid-loading-overlay: rgba(255, 255, 255, 0.7);\n --ogrid-selection: #217346;\n --ogrid-bg-range: rgba(33, 115, 70, 0.12);\n --ogrid-bg-selected: #e6f0fb;\n --ogrid-loading-bg: rgba(255, 255, 255, 0.7);\n}\n/* \u2500\u2500\u2500 Auto Dark (system preference) \u2500\u2500\u2500 */\n@media (prefers-color-scheme: dark) {\n :where(:root:not([data-theme=\"light\"])) {\n --ogrid-bg: #1e1e1e;\n --ogrid-fg: rgba(255, 255, 255, 0.87);\n --ogrid-fg-secondary: rgba(255, 255, 255, 0.6);\n --ogrid-fg-muted: rgba(255, 255, 255, 0.5);\n --ogrid-border: rgba(255, 255, 255, 0.12);\n --ogrid-border-strong: rgba(255, 255, 255, 0.5);\n --ogrid-border-hover: rgba(255, 255, 255, 0.3);\n --ogrid-header-bg: #2c2c2c;\n --ogrid-hover-bg: rgba(255, 255, 255, 0.08);\n --ogrid-selected-row-bg: #1a3a5c;\n --ogrid-bg-selected-hover: #1f3650;\n --ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);\n --ogrid-range-bg: rgba(46, 160, 67, 0.15);\n --ogrid-accent: #4da6ff;\n --ogrid-accent-dark: #3390e0;\n --ogrid-selection-color: #2ea043;\n --ogrid-primary: #4da6ff;\n --ogrid-primary-fg: #fff;\n --ogrid-primary-hover: #66b3ff;\n --ogrid-bg-subtle: rgba(255, 255, 255, 0.04);\n --ogrid-bg-hover: rgba(255, 255, 255, 0.08);\n --ogrid-active-bg: rgba(255, 255, 255, 0.08);\n --ogrid-muted: rgba(255, 255, 255, 0.5);\n --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);\n --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);\n --ogrid-pinned-shadow: rgba(0, 0, 0, 0.3);\n --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);\n --ogrid-selection: #2ea043;\n --ogrid-bg-range: rgba(46, 160, 67, 0.15);\n --ogrid-bg-selected: #1a3a5c;\n --ogrid-loading-bg: rgba(0, 0, 0, 0.7);\n }\n}\n/* \u2500\u2500\u2500 Explicit Dark \u2500\u2500\u2500 */\n:where([data-theme=\"dark\"]) {\n --ogrid-bg: #1e1e1e;\n --ogrid-fg: rgba(255, 255, 255, 0.87);\n --ogrid-fg-secondary: rgba(255, 255, 255, 0.6);\n --ogrid-fg-muted: rgba(255, 255, 255, 0.5);\n --ogrid-border: rgba(255, 255, 255, 0.12);\n --ogrid-border-strong: rgba(255, 255, 255, 0.5);\n --ogrid-border-hover: rgba(255, 255, 255, 0.3);\n --ogrid-header-bg: #2c2c2c;\n --ogrid-hover-bg: rgba(255, 255, 255, 0.08);\n --ogrid-selected-row-bg: #1a3a5c;\n --ogrid-bg-selected-hover: #1f3650;\n --ogrid-active-cell-bg: rgba(255, 255, 255, 0.06);\n --ogrid-range-bg: rgba(46, 160, 67, 0.15);\n --ogrid-accent: #4da6ff;\n --ogrid-accent-dark: #3390e0;\n --ogrid-selection-color: #2ea043;\n --ogrid-primary: #4da6ff;\n --ogrid-primary-fg: #fff;\n --ogrid-primary-hover: #66b3ff;\n --ogrid-bg-subtle: rgba(255, 255, 255, 0.04);\n --ogrid-bg-hover: rgba(255, 255, 255, 0.08);\n --ogrid-active-bg: rgba(255, 255, 255, 0.08);\n --ogrid-muted: rgba(255, 255, 255, 0.5);\n --ogrid-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);\n --ogrid-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);\n --ogrid-pinned-shadow: rgba(0, 0, 0, 0.3);\n --ogrid-loading-overlay: rgba(0, 0, 0, 0.7);\n --ogrid-selection: #2ea043;\n --ogrid-bg-range: rgba(46, 160, 67, 0.15);\n --ogrid-bg-selected: #1a3a5c;\n --ogrid-loading-bg: rgba(0, 0, 0, 0.7);\n}";
@@ -16,7 +16,7 @@ export interface ICellEditorProps<T = unknown> {
16
16
  * with renderCell, cellStyle, and a narrowed cellEditor type.
17
17
  */
18
18
  export interface IColumnDef<T = unknown> extends ICoreColumnDef<T> {
19
- /** Custom cell rendererTemplateRef or string function (Angular-specific). */
19
+ /** Custom cell renderer - TemplateRef or string function (Angular-specific). */
20
20
  renderCell?: TemplateRef<{
21
21
  $implicit: T;
22
22
  }> | ((item: T) => string);
@@ -89,7 +89,7 @@ interface IOGridBaseProps<T> {
89
89
  onFormulaRecalc?: (result: IRecalcResult) => void;
90
90
  /** Custom formula functions to register with the formula engine (e.g. { MYFUNC: { minArgs: 1, maxArgs: 1, evaluate: ... } }). */
91
91
  formulaFunctions?: Record<string, IFormulaFunction>;
92
- /** Named ranges for the formula engine: namecell/range ref string (e.g. { Revenue: 'A1:A10' }). */
92
+ /** Named ranges for the formula engine: name to cell/range ref string (e.g. { Revenue: 'A1:A10' }). */
93
93
  namedRanges?: Record<string, string>;
94
94
  /** Sheet accessors for cross-sheet formula references (e.g. { Sheet2: accessor }). */
95
95
  sheets?: Record<string, IGridDataAccessor>;
@@ -199,7 +199,7 @@ export interface IOGridDataGridProps<T> {
199
199
  getDependents?: (col: number, row: number) => IAuditEntry[];
200
200
  /** Get full audit trail for a cell. */
201
201
  getAuditTrail?: (col: number, row: number) => IAuditTrail | null;
202
- /** Monotonic counter incremented on each formula recalculationused for cache invalidation. */
202
+ /** Monotonic counter incremented on each formula recalculation - used for cache invalidation. */
203
203
  formulaVersion?: number;
204
204
  /** Cell references to highlight (from active formula in formula bar). */
205
205
  formulaReferences?: FormulaReference[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alaarab/ogrid-angular",
3
- "version": "2.5.4",
3
+ "version": "2.5.6",
4
4
  "description": "OGrid Angular – Angular services, signals, and headless components for OGrid data grids.",
5
5
  "main": "dist/esm/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -35,7 +35,7 @@
35
35
  "node": ">=18"
36
36
  },
37
37
  "dependencies": {
38
- "@alaarab/ogrid-core": "2.5.4"
38
+ "@alaarab/ogrid-core": "2.5.5"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@angular/core": "^21.0.0",