@keenmate/web-grid 1.0.0-rc09 → 1.0.0-rc10
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/grid.d.ts +61 -65
- package/dist/modules/navigation/index.d.ts +1 -1
- package/dist/types.d.ts +34 -34
- package/dist/web-component.d.ts +39 -42
- package/dist/web-grid.js +5130 -5118
- package/dist/web-grid.umd.js +237 -233
- package/package.json +78 -78
- package/src/css/_cells.css +13 -2
- package/src/css/_dialogs.css +2 -2
- package/src/css/_dropdown.css +33 -3
- package/src/css/_freeze.css +2 -2
- package/src/css/_header.css +46 -8
- package/src/css/_toolbar.css +7 -7
- package/src/css/_variables.css +35 -5
package/dist/web-grid.umd.js
CHANGED
|
@@ -1,216 +1,4 @@
|
|
|
1
|
-
(function(B,U){typeof exports=="object"&&typeof module<"u"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):(B=typeof globalThis<"u"?globalThis:B||self,U(B.WebGrid={}))})(this,function(B){"use strict";var In=Object.defineProperty;var Ln=(B,U,Ce)=>U in B?In(B,U,{enumerable:!0,configurable:!0,writable:!0,value:Ce}):B[U]=Ce;var w=(B,U,Ce)=>Ln(B,typeof U!="symbol"?U+"":U,Ce);const U={rowActions:"Row actions",inlineActionsHeader:"Actions",keyboardShortcuts:"Keyboard shortcuts",paginationFirst:"⏮",paginationPrevious:"◀",paginationNext:"▶",paginationLast:"⏭",paginationPageInfo:"Page {current} of {total}",paginationItemCount:"{count} items",paginationPerPage:"per page",dropdownNoOptions:"No options",dropdownSearching:"Searching...",contextMenu:{sortAsc:"Sort Ascending",sortDesc:"Sort Descending",clearSort:"Clear Sort",hideColumn:"Hide Column",freezeColumn:"Freeze Column",unfreezeColumn:"Unfreeze Column",columnVisibility:"Column Visibility",showAll:"Show all"}};class Ce{constructor(){w(this,"_items",[]);w(this,"_columns",[]);w(this,"_sortMode","none");w(this,"_filterable",!1);w(this,"_pageable",!1);w(this,"_pageSize",10);w(this,"_pageSizes",[10,25,50,100]);w(this,"_striped",!0);w(this,"_hoverable",!0);w(this,"_editable",!1);w(this,"_editTrigger","dblclick");w(this,"_editStartSelection","mousePosition");w(this,"_mode","excel");w(this,"_dropdownToggleVisibility","always");w(this,"_dropdownShowOnFocus",!0);w(this,"_openDropdownOnEnter",!1);w(this,"_checkboxAlwaysEditable",!1);w(this,"_showRowNumbers",!1);w(this,"_stickyRowNumbers",!1);w(this,"_freezeColumns",0);w(this,"_invalidCells",[]);w(this,"_showRowToolbar",!1);w(this,"_rowToolbar",["add","delete","duplicate"]);w(this,"_toolbarVerticalAlign","bottom");w(this,"_toolbarHorizontalAlign","center");w(this,"_toolbarTrigger","hover");w(this,"_toolbarPosition","auto");w(this,"_inlineActionsTitle","");w(this,"_contextMenu");w(this,"_contextMenuXOffset",8);w(this,"_contextMenuYOffset",0);w(this,"_headerContextMenu");w(this,"_rowShortcuts");w(this,"_showShortcutsHelp",!1);w(this,"_shortcutsHelpPosition","top-right");w(this,"_shortcutsHelpContentCallback");w(this,"_idValueMember");w(this,"_idValueCallback");w(this,"_rowLocking");w(this,"_externalLocks",new Map);w(this,"_onrowlockchange");w(this,"_gridName",null);w(this,"_persistColumnWidths",!1);w(this,"_columnWidths",new Map);w(this,"_oncolumnresize");w(this,"_allowColumnReorder",!1);w(this,"_persistColumnOrder",!1);w(this,"_columnOrder",new Map);w(this,"_oncolumnreorder");w(this,"_fillDirection","vertical");w(this,"_onfilldrag");w(this,"_onrowchange");w(this,"_onroweditstart");w(this,"_onroweditcancel");w(this,"_onvalidationerror");w(this,"_validationTooltipCallback");w(this,"_ontoolbarclick");w(this,"_onrowaction");w(this,"_oncontextmenuopen");w(this,"_onheadercontextmenuopen");w(this,"_ondatarequest");w(this,"_onrowdelete");w(this,"_sort",[]);w(this,"_filters",{});w(this,"_currentPage",1);w(this,"_totalItems",null);w(this,"_showPagination",!0);w(this,"_paginationPosition","bottom-center");w(this,"_paginationLabelsCallback");w(this,"_paginationLayout","pageSize|previous|pageInfo|next");w(this,"_summaryPosition");w(this,"_summaryContentCallback");w(this,"_summaryMetadata");w(this,"_summaryInline",!0);w(this,"_customStylesCallback");w(this,"_rowClassCallback");w(this,"_labels",{...U});w(this,"_virtualScroll",!1);w(this,"_virtualScrollThreshold",100);w(this,"_virtualScrollRowHeight",38);w(this,"_virtualScrollBuffer",10);w(this,"_infiniteScroll",!1);w(this,"_infiniteScrollThreshold",100);w(this,"_hasMoreItems",!0);w(this,"_isLoadingMore",!1);w(this,"_editingCell",null);w(this,"_currentCellError",null);w(this,"_isValidating",!1);w(this,"_draftRows",new Map);w(this,"_focusedCell",null);w(this,"_isCommittingFromKeyboard",!1);w(this,"_skipNextDropdownAutoEdit",!1);w(this,"_hoveredRowIndex",null);w(this,"_onInteractionChange",null);w(this,"_selectedRows",new Set);w(this,"_lastSelectedRowIndex",null);w(this,"_rangeShortcuts",[])}get items(){return this._items}set items(e){this._items=e,this.requestUpdate()}get columns(){return this._columns}set columns(e){this._columns=e,this.requestUpdate()}get sortMode(){return this._sortMode}set sortMode(e){this._sortMode=e,this.requestUpdate()}get filterable(){return this._filterable}set filterable(e){this._filterable=e,this.requestUpdate()}get pageable(){return this._pageable}set pageable(e){this._pageable=e,this.requestUpdate()}get pageSize(){return this._pageSize}set pageSize(e){this._pageSize=e,this.requestUpdate()}get pageSizes(){return this._pageSizes}set pageSizes(e){this._pageSizes=e,this.requestUpdate()}get striped(){return this._striped}set striped(e){this._striped=e,this.requestUpdate()}get hoverable(){return this._hoverable}set hoverable(e){this._hoverable=e,this.requestUpdate()}get editable(){return this._editable}set editable(e){this._editable=e,this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(e){this._editTrigger=e,this.requestUpdate()}get editStartSelection(){return this._editStartSelection}set editStartSelection(e){this._editStartSelection=e}get mode(){return this._mode}set mode(e){this._mode=e,this.applyModeDefaults(),this.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(e){this._dropdownToggleVisibility=e,this.requestUpdate()}getEffectiveToggleVisibility(e){return e.dropdownToggleVisibility??this._dropdownToggleVisibility}get dropdownShowOnFocus(){return this._dropdownShowOnFocus}set dropdownShowOnFocus(e){this._dropdownShowOnFocus=e}get openDropdownOnEnter(){return this._openDropdownOnEnter}set openDropdownOnEnter(e){this._openDropdownOnEnter=e}getEffectiveOpenDropdownOnEnter(e){return e.openDropdownOnEnter??this._openDropdownOnEnter}get checkboxAlwaysEditable(){return this._checkboxAlwaysEditable}set checkboxAlwaysEditable(e){this._checkboxAlwaysEditable=e,this.requestUpdate()}get showRowNumbers(){return this._showRowNumbers}set showRowNumbers(e){this._showRowNumbers=e,this.requestUpdate()}get stickyRowNumbers(){return this._stickyRowNumbers}set stickyRowNumbers(e){this._stickyRowNumbers=e,this.requestUpdate()}get freezeColumns(){return this._freezeColumns}set freezeColumns(e){this._freezeColumns=Math.max(0,Math.floor(e)),this.requestUpdate()}get visualColumns(){const e=[],t=[];this._columns.filter(n=>n.frozen&&!n.hidden).length,this._columns.forEach((n,s)=>{if(n.hidden)return;const a={column:n,originalIndex:s};n.frozen?e.push(a):t.push(a)});const i=[],r=[];return t.forEach((n,s)=>{s<this._freezeColumns?i.push(n):r.push(n)}),this._columnOrder.size>0&&r.sort((n,s)=>{const a=String(n.column.field),l=String(s.column.field),d=this._columnOrder.get(a)??n.originalIndex,g=this._columnOrder.get(l)??s.originalIndex;return d-g}),[...e,...i,...r]}get totalFrozenColumns(){return this._columns.filter(t=>t.frozen).length+this._freezeColumns}isColumnFrozen(e){return e<this.totalFrozenColumns}get invalidCells(){return this._invalidCells}set invalidCells(e){this._invalidCells=e,this.requestUpdate()}get editingCell(){return this._editingCell}get isValidating(){return this._isValidating}get currentCellError(){return this._currentCellError}get hoveredRowIndex(){return this._hoveredRowIndex}get showRowToolbar(){return this._showRowToolbar}set showRowToolbar(e){this._showRowToolbar=e,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(e){this._rowToolbar=e,this.requestUpdate()}get toolbarVerticalAlign(){return this._toolbarVerticalAlign}set toolbarVerticalAlign(e){this._toolbarVerticalAlign=e,this.requestUpdate()}get toolbarHorizontalAlign(){return this._toolbarHorizontalAlign}set toolbarHorizontalAlign(e){this._toolbarHorizontalAlign=e,this.requestUpdate()}get toolbarAlign(){return this._toolbarVerticalAlign}set toolbarAlign(e){this.toolbarVerticalAlign=e}get toolbarTopPosition(){return this._toolbarHorizontalAlign}set toolbarTopPosition(e){this.toolbarHorizontalAlign=e}get toolbarTrigger(){return this._toolbarTrigger}set toolbarTrigger(e){this._toolbarTrigger=e,this.requestUpdate()}get toolbarPosition(){return this._toolbarPosition}set toolbarPosition(e){this._toolbarPosition=e,this.requestUpdate()}get inlineActionsTitle(){return this._inlineActionsTitle}set inlineActionsTitle(e){this._inlineActionsTitle=e,this.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,this.requestUpdate()}get contextMenuXOffset(){return this._contextMenuXOffset}set contextMenuXOffset(e){this._contextMenuXOffset=e}get contextMenuYOffset(){return this._contextMenuYOffset}set contextMenuYOffset(e){this._contextMenuYOffset=e}get headerContextMenu(){return this._headerContextMenu}set headerContextMenu(e){this._headerContextMenu=e}get rowShortcuts(){return this._rowShortcuts}set rowShortcuts(e){this._rowShortcuts=e,this.requestUpdate()}get showShortcutsHelp(){return this._showShortcutsHelp}set showShortcutsHelp(e){this._showShortcutsHelp=e,this.requestUpdate()}get shortcutsHelpPosition(){return this._shortcutsHelpPosition}set shortcutsHelpPosition(e){this._shortcutsHelpPosition=e,this.requestUpdate()}get shortcutsHelpContentCallback(){return this._shortcutsHelpContentCallback}set shortcutsHelpContentCallback(e){this._shortcutsHelpContentCallback=e,this.requestUpdate()}get sort(){return this._sort}set sort(e){this._sort=e,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(e){this._currentPage=e,this.requestUpdate()}get totalItems(){return this._totalItems}set totalItems(e){this._totalItems=e,this.requestUpdate()}get showPagination(){return this._showPagination}set showPagination(e){this._showPagination=e,this.requestUpdate()}get paginationPosition(){return this._paginationPosition}set paginationPosition(e){this._paginationPosition=e,this.requestUpdate()}get paginationLabelsCallback(){return this._paginationLabelsCallback}set paginationLabelsCallback(e){this._paginationLabelsCallback=e,this.requestUpdate()}get paginationLayout(){return this._paginationLayout}set paginationLayout(e){this._paginationLayout=e,this.requestUpdate()}get summaryPosition(){return this._summaryPosition}set summaryPosition(e){this._summaryPosition=e,this.requestUpdate()}get summaryContentCallback(){return this._summaryContentCallback}set summaryContentCallback(e){this._summaryContentCallback=e,this.requestUpdate()}get summaryMetadata(){return this._summaryMetadata}set summaryMetadata(e){this._summaryMetadata=e,this.requestUpdate()}get summaryInline(){return this._summaryInline}set summaryInline(e){this._summaryInline=e,this.requestUpdate()}get customStylesCallback(){return this._customStylesCallback}set customStylesCallback(e){this._customStylesCallback=e}get rowClassCallback(){return this._rowClassCallback}set rowClassCallback(e){this._rowClassCallback=e,this.requestUpdate()}get labels(){return this._labels}set labels(e){this._labels={...U,...e},this.requestUpdate()}get virtualScroll(){return this._virtualScroll}set virtualScroll(e){this._virtualScroll=e,this.requestUpdate()}get virtualScrollThreshold(){return this._virtualScrollThreshold}set virtualScrollThreshold(e){this._virtualScrollThreshold=e,this.requestUpdate()}get virtualScrollRowHeight(){return this._virtualScrollRowHeight}set virtualScrollRowHeight(e){this._virtualScrollRowHeight=e,this.requestUpdate()}get virtualScrollBuffer(){return this._virtualScrollBuffer}set virtualScrollBuffer(e){this._virtualScrollBuffer=e,this.requestUpdate()}get infiniteScroll(){return this._infiniteScroll}set infiniteScroll(e){this._infiniteScroll=e,this.requestUpdate()}get infiniteScrollThreshold(){return this._infiniteScrollThreshold}set infiniteScrollThreshold(e){this._infiniteScrollThreshold=e}get hasMoreItems(){return this._hasMoreItems}set hasMoreItems(e){this._hasMoreItems=e}get isLoadingMore(){return this._isLoadingMore}set isLoadingMore(e){this._isLoadingMore=e}shouldUseVirtualScroll(){return this._virtualScroll===!1?!1:this._virtualScroll===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}get showRowActions(){return this._showRowToolbar}set showRowActions(e){this.showRowToolbar=e}get rowActions(){return this._rowToolbar}set rowActions(e){this.rowToolbar=e}set onrowchange(e){this._onrowchange=e}set onroweditstart(e){this._onroweditstart=e}set onroweditcancel(e){this._onroweditcancel=e}set onvalidationerror(e){this._onvalidationerror=e}get validationTooltipCallback(){return this._validationTooltipCallback}set validationTooltipCallback(e){this._validationTooltipCallback=e}get ontoolbarclick(){return this._ontoolbarclick}set ontoolbarclick(e){this._ontoolbarclick=e}set onrowaction(e){this._onrowaction=e}set oncontextmenuopen(e){this._oncontextmenuopen=e}get onheadercontextmenuopen(){return this._onheadercontextmenuopen}set onheadercontextmenuopen(e){this._onheadercontextmenuopen=e}get ondatarequest(){return this._ondatarequest}set ondatarequest(e){this._ondatarequest=e}get onrowdelete(){return this._onrowdelete}set onrowdelete(e){this._onrowdelete=e}get idValueMember(){return this._idValueMember}set idValueMember(e){this._idValueMember=e}get idValueCallback(){return this._idValueCallback}set idValueCallback(e){this._idValueCallback=e}get rowLocking(){return this._rowLocking}set rowLocking(e){this._rowLocking=e,this.requestUpdate()}get onrowlockchange(){return this._onrowlockchange}set onrowlockchange(e){this._onrowlockchange=e}get gridName(){return this._gridName}set gridName(e){this._gridName=e}get persistColumnWidths(){return this._persistColumnWidths}set persistColumnWidths(e){this._persistColumnWidths=e}get oncolumnresize(){return this._oncolumnresize}set oncolumnresize(e){this._oncolumnresize=e}get allowColumnReorder(){return this._allowColumnReorder}set allowColumnReorder(e){this._allowColumnReorder=e}get persistColumnOrder(){return this._persistColumnOrder}set persistColumnOrder(e){this._persistColumnOrder=e}get oncolumnreorder(){return this._oncolumnreorder}set oncolumnreorder(e){this._oncolumnreorder=e}get fillDirection(){return this._fillDirection}set fillDirection(e){this._fillDirection=e}get onfilldrag(){return this._onfilldrag}set onfilldrag(e){this._onfilldrag=e}get selectedRows(){return Array.from(this._selectedRows).sort((e,t)=>e-t)}get rangeShortcuts(){return this._rangeShortcuts}set rangeShortcuts(e){this._rangeShortcuts=e}isRowSelected(e){return this._selectedRows.has(e)}selectRow(e,t="replace"){switch(t){case"replace":this._selectedRows.clear(),this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"toggle":this._selectedRows.has(e)?this._selectedRows.delete(e):this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"range":if(this._lastSelectedRowIndex!==null){const i=Math.min(this._lastSelectedRowIndex,e),r=Math.max(this._lastSelectedRowIndex,e);for(let n=i;n<=r;n++)this._selectedRows.add(n)}else this._selectedRows.add(e),this._lastSelectedRowIndex=e;break}this.requestUpdate()}selectRowRange(e,t){this._selectedRows.clear();const i=Math.min(e,t),r=Math.max(e,t);for(let n=i;n<=r;n++)this._selectedRows.add(n);this._lastSelectedRowIndex=t,this.requestUpdate()}clearSelection(){this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null,this.requestUpdate())}getSelectedRowsData(){return this.selectedRows.map(e=>this.displayItems[e]).filter(Boolean)}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(e=>e.editTrigger==="navigate")}get filteredItems(){return!this._filterable||Object.keys(this._filters).length===0?this._items:this._items.filter(e=>Object.entries(this._filters).every(([t,i])=>i?String(e[t]??"").toLowerCase().includes(i.toLowerCase()):!0))}get sortedItems(){return this._sort.length===0?this.filteredItems:[...this.filteredItems].sort((e,t)=>{for(const i of this._sort){const r=e[i.column],n=t[i.column];if(r===n)continue;let s=0;return typeof r=="string"&&typeof n=="string"?s=r.localeCompare(n):typeof r=="number"&&typeof n=="number"?s=r-n:s=String(r??"").localeCompare(String(n??"")),i.direction==="asc"?s:-s}return 0})}get paginatedItems(){if(!this._pageable)return this.sortedItems;const e=(this._currentPage-1)*this._pageSize,t=e+this._pageSize;return this.sortedItems.slice(e,t)}get totalPages(){const e=this._totalItems!==null?this._totalItems:this.sortedItems.length;return Math.max(1,Math.ceil(e/this._pageSize))}get displayItems(){return this.paginatedItems}fireDataRequest(e){if(this._ondatarequest){const t=e==="loadMore"?this._items.length:(this._currentPage-1)*this._pageSize,i={sort:[...this._sort],page:this._currentPage,pageSize:this._pageSize,trigger:e,mode:e==="loadMore"?"append":"replace",skip:t};this._ondatarequest(i)}}getColumnSortState(e){return this._sort.find(t=>t.column===e)}getColumnSortPriority(e){const t=this._sort.findIndex(i=>i.column===e);return t>=0?t+1:0}applyModeDefaults(){switch(this._mode){case"read-only":this._editable=!1,this._dropdownToggleVisibility="on-focus";break;case"excel":this._editable=!0,this._editTrigger="navigate",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!1;break;case"input-matrix":this._editable=!0,this._editTrigger="always",this._dropdownToggleVisibility="always",this._dropdownShowOnFocus=!0;break}}requestUpdate(){}getRowDraft(e){return this._draftRows.get(e)}hasRowDraft(e){return this._draftRows.has(e)}discardRowDraft(e){this._draftRows.delete(e),this._invalidCells=this._invalidCells.filter(t=>t.rowIndex!==e),this.requestUpdate()}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(e,t,i){const r=this._draftRows.get(t);return r?r[i]:e[i]}getCellValue(e,t,i){if(t.templateCallback)return t.templateCallback(e);const r=i!==void 0?this.getCellRawValue(e,i,String(t.field)):e[String(t.field)];return t.formatCallback?t.formatCallback(r,e):String(r??"")}isCellInvalid(e,t){return this._invalidCells.some(i=>i.rowIndex===e&&i.field===t)}getCellValidationError(e,t){const i=this._invalidCells.find(r=>r.rowIndex===e&&r.field===t);return(i==null?void 0:i.error)||null}addInvalidCell(e,t,i){const r=this._invalidCells.findIndex(n=>n.rowIndex===e&&n.field===t);r>=0?this._invalidCells[r]={rowIndex:e,field:t,error:i}:this._invalidCells=[...this._invalidCells,{rowIndex:e,field:t,error:i}]}removeInvalidCell(e,t){this._invalidCells=this._invalidCells.filter(i=>!(i.rowIndex===e&&i.field===t))}isEditing(e,t){var i,r;return((i=this._editingCell)==null?void 0:i.rowIndex)===e&&((r=this._editingCell)==null?void 0:r.field)===t}startEdit(e,t,i){var s,a;if(!this.canEditCell(e,t))return;const r=this.displayItems[e];if(!r)return;this._draftRows.has(e)||this._draftRows.set(e,{...r});const n=this._editingCell;this._editingCell={rowIndex:e,field:t,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},(s=this._onInteractionChange)==null||s.call(this,"editingCell",{prev:n,current:this._editingCell}),this._currentCellError=null,(a=this._onroweditstart)==null||a.call(this,{row:r,rowIndex:e,field:t})}cancelEdit(){var e,t;if(this._editingCell){const i=this._editingCell,{rowIndex:r,field:n}=i,s=this.displayItems[r];s&&((e=this._onroweditcancel)==null||e.call(this,{row:s,rowIndex:r,field:n})),this._editingCell=null,(t=this._onInteractionChange)==null||t.call(this,"editingCell",{prev:i,current:null}),this._currentCellError=null}}normalizeValidationResult(e,t){return e==null||e===!0?{valid:!0,finalValue:t}:e===!1?{valid:!1,message:"Validation failed",finalValue:t}:typeof e=="string"?{valid:!1,message:e,finalValue:t}:{valid:e.valid,message:e.message,finalValue:e.transformedValue!==void 0?e.transformedValue:t}}async commitEdit(e,t,i){var c,h,f;const r=this._columns.find(p=>String(p.field)===t);if(!r)return;const n=this.displayItems[e];if(!n)return;const s=n[t];let a=i,l=null,d=!0;this._isValidating=!0;try{if(r.beforeCommitCallback){const p={value:i,oldValue:s,row:n,rowIndex:e,field:t},v=await Promise.resolve(r.beforeCommitCallback(p)),m=this.normalizeValidationResult(v,i);d=m.valid,l=m.message||null,a=m.finalValue}else if(r.validateCallback){const p=await Promise.resolve(r.validateCallback(i,n));p&&(d=!1,l=p)}}catch(p){d=!1,l=p instanceof Error?p.message:"Validation failed"}this._isValidating=!1;let g=this._draftRows.get(e);g||(g={...n},this._draftRows.set(e,g)),g[t]=a,d?(this.removeInvalidCell(e,t),this._currentCellError=null):(this.addInvalidCell(e,t,l||"Invalid value"),this._currentCellError=l,(c=this._onvalidationerror)==null||c.call(this,{row:n,rowIndex:e,field:t,error:l||"Invalid value"})),(h=this._onrowchange)==null||h.call(this,{row:n,draftRow:g,rowIndex:e,field:t,oldValue:s,newValue:a,isValid:d,validationError:l});const u=this._editingCell;this._editingCell=null,(f=this._onInteractionChange)==null||f.call(this,"editingCell",{prev:u,current:null})}isCellEditable(e){return e.editable===!1?!1:this._editable||e.editor!==void 0}getEditableColumns(){return this._columns.map((e,t)=>({index:t,column:e})).filter(({column:e})=>this.isCellEditable(e))}isCellFocused(e,t){var i,r;return((i=this._focusedCell)==null?void 0:i.rowIndex)===e&&((r=this._focusedCell)==null?void 0:r.colIndex)===t}get focusedCell(){return this._focusedCell}setFocusedCell(e,t){var n;const i=this._focusedCell,r={rowIndex:e,colIndex:t};(i==null?void 0:i.rowIndex)===r.rowIndex&&(i==null?void 0:i.colIndex)===r.colIndex||(this._focusedCell=r,(n=this._onInteractionChange)==null||n.call(this,"focusedCell",{prev:i,current:r}))}clearFocusedCell(){var t;const e=this._focusedCell;e!==null&&(this._focusedCell=null,(t=this._onInteractionChange)==null||t.call(this,"focusedCell",{prev:e,current:null}))}setHoveredRow(e){var i;if(this._hoveredRowIndex===e)return;const t=this._hoveredRowIndex;this._hoveredRowIndex=e,(i=this._onInteractionChange)==null||i.call(this,"hoveredRow",{prev:t,current:e})}getRowId(e){if(this._idValueCallback)return this._idValueCallback(e);if(this._idValueMember)return e[String(this._idValueMember)]}findRowById(e){const t=this._items.findIndex(i=>this.getRowId(i)===e);return t===-1?null:{row:this._items[t],index:t}}getRowLockInfo(e){let t,i,r=-1;if(typeof e=="object"&&e!==null)t=e,i=this.getRowId(t),r=this._items.indexOf(t),r===-1&&(r=this.displayItems.indexOf(t));else{i=e;const s=this.findRowById(i);s&&(t=s.row,r=s.index)}if(i!==void 0&&this._externalLocks.has(i))return this._externalLocks.get(i);if(!t)return null;const n=this._rowLocking;if(!n)return null;if(n.getLockInfoCallback){const s=n.getLockInfoCallback(t,r);if(s!=null&&s.isLocked)return s}if(n.isLockedCallback&&n.isLockedCallback(t,r))return{isLocked:!0};if(n.lockInfoMember){const s=t[String(n.lockInfoMember)];if(s!=null&&s.isLocked)return s}return n.lockedMember&&t[String(n.lockedMember)]?{isLocked:!0}:null}isRowLocked(e){const t=this.getRowLockInfo(e);return(t==null?void 0:t.isLocked)===!0}lockRowById(e,t){var n;const i={isLocked:!0,lockedBy:t==null?void 0:t.lockedBy,lockedAt:(t==null?void 0:t.lockedAt)??new Date,reason:t==null?void 0:t.reason,...t};this._externalLocks.set(e,i);const r=this.findRowById(e);return r&&this._editingCell&&this._editingCell.rowIndex===r.index&&this.cancelEdit(),this.requestUpdate(),(n=this._onrowlockchange)==null||n.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:i,source:"external"}),!0}unlockRowById(e){var i;const t=this._externalLocks.has(e);if(this._externalLocks.delete(e),t){this.requestUpdate();const r=this.findRowById(e);(i=this._onrowlockchange)==null||i.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:null,source:"external"})}return t}getExternalLocks(){return new Map(this._externalLocks)}clearExternalLocks(){this._externalLocks.clear(),this.requestUpdate()}updateRowById(e,t){const i=this.findRowById(e);if(!i)return!1;Object.assign(this._items[i.index],t);const r=this._draftRows.get(i.index);return r&&Object.assign(r,t),this.requestUpdate(),!0}replaceRowById(e,t){const i=this.findRowById(e);return i?(this._items[i.index]=t,this._draftRows.delete(i.index),this.requestUpdate(),!0):!1}canEditCell(e,t){var l;const i=this._columns.find(d=>String(d.field)===t);if(!i||!this.isCellEditable(i))return!1;const r=this.displayItems[e];if(!r)return!1;const n=this.getRowLockInfo(r);if(!(n!=null&&n.isLocked))return!0;const s=this._rowLocking;switch((s==null?void 0:s.lockedEditBehavior)??"block"){case"allow":return!0;case"callback":return((l=s==null?void 0:s.canEditLockedCallback)==null?void 0:l.call(s,r,n))??!1;case"block":default:return!1}}getColumnWidth(e){return this._columnWidths.get(e)}setColumnWidth(e,t,i=!1){this._columnWidths.set(e,t),i||this.requestUpdate()}setColumnWidths(e){for(const{field:t,width:i}of e)t&&i&&this._columnWidths.set(t,i);this.requestUpdate()}getColumnWidthsState(){return this._columns.map(e=>{const t=String(e.field),i=this._columnWidths.get(t)||e.width||"";return{field:t,width:i}}).filter(e=>e.width)}loadPersistedWidths(){this.loadPersistedState()}savePersistedWidths(){this.savePersistedState()}loadPersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,t=localStorage.getItem(e);if(!t)return;const i=JSON.parse(t),r=new Set(this._columns.map(s=>String(s.field)));let n=!1;if(i.columnWidths){this._columnWidths.clear();for(const s of i.columnWidths)r.has(s.field)?this._columnWidths.set(s.field,s.width):n=!0}if(i.columnOrder){this._columnOrder.clear();for(const s of i.columnOrder)r.has(s.field)?this._columnOrder.set(s.field,s.order):n=!0}n&&this.savePersistedState()}catch(e){console.warn("WebGrid: Failed to load persisted state",e)}}savePersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,t={};this._persistColumnWidths&&(t.columnWidths=this.getColumnWidthsState()),this._persistColumnOrder&&(t.columnOrder=this.getColumnOrderState()),localStorage.setItem(e,JSON.stringify(t))}catch(e){console.warn("WebGrid: Failed to save persisted state",e)}}getColumnOrder(e){return this._columnOrder.get(e)}setColumnOrder(e){this._columnOrder.clear();for(const{field:t,order:i}of e)t!==void 0&&i!==void 0&&this._columnOrder.set(t,i);this.requestUpdate()}getColumnOrderState(){const e=this.visualColumns,t=this.totalFrozenColumns;return e.slice(t).map((i,r)=>({field:String(i.column.field),order:r}))}moveColumn(e,t){const i=this.visualColumns,r=this.totalFrozenColumns,n=i.slice(r),s=n.findIndex(d=>String(d.column.field)===e);if(s===-1||s===t)return;this._columnOrder.clear();const a=[...n],[l]=a.splice(s,1);a.splice(t,0,l),a.forEach((d,g)=>{this._columnOrder.set(String(d.column.field),g)}),this.requestUpdate()}}const Yo=':host{--wg-rem: 10px;font-family:var(--wg-font-family);display:block;--wg-accent-color: var(--base-accent-color, #0078d4);--wg-accent-color-hover: var(--base-accent-color-hover, #106ebe);--wg-accent-color-active: var(--base-accent-color-active, #005a9e);--wg-accent-color-light: var(--base-accent-color-light, #e6f2ff);--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-text-on-accent: var(--base-text-color-on-accent, #ffffff);--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-color: var(--base-input-color, var(--wg-text-color-1));--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-input-border-hover: var(--base-input-border-hover, 1px solid #0078d4);--wg-input-border-focus: var(--base-input-border-focus, 1px solid #0078d4);--wg-input-placeholder-color: var(--base-input-placeholder-color, #707070);--wg-danger-color: var(--base-danger-color, #d13438);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-font-size-base: calc(var(--base-font-size-sm, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-xs, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-2xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-base, 1.6) * var(--wg-rem));--wg-font-family: var(--base-font-family, inherit);--wg-line-height-base: var(--base-line-height-normal, 1.5);--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--wg-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--wg-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--wg-rem));--wg-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--wg-rem));--wg-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--wg-rem));--wg-spacing-xs: calc(.4 * var(--wg-rem));--wg-spacing-sm: calc(.8 * var(--wg-rem));--wg-spacing-md: calc(1.2 * var(--wg-rem));--wg-spacing-lg: calc(1.6 * var(--wg-rem));--wg-spacing-xl: calc(2.4 * var(--wg-rem));--wg-table-bg: var(--wg-surface-1);--wg-table-border: 1px solid var(--wg-border-color);--wg-header-bg: var(--wg-surface-2);--wg-header-bg-hover: var(--wg-surface-3);--wg-header-bg-sorted: var(--wg-surface-3);--wg-header-color: var(--wg-text-color-1);--wg-header-border: 2px solid var(--wg-border-color);--wg-header-separator: 1px solid var(--wg-border-color);--wg-header-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-cell-padding: var(--wg-spacing-sm) var(--wg-spacing-md);--wg-cell-padding-block: var(--wg-spacing-sm);--wg-cell-padding-inline: var(--wg-spacing-md);--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--wg-cell-bg-hover: var(--wg-hover-bg);--wg-cell-bg-editing: var(--wg-surface-1);--wg-cell-readonly-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-border: 1px solid var(--wg-border-color);--wg-row-bg-even: var(--wg-surface-2);--wg-row-bg-hover: var(--wg-surface-3);--wg-filter-bg: var(--wg-surface-1);--wg-filter-border: 1px solid var(--wg-border-color);--wg-filter-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-filter-input-padding: calc(.4 * var(--wg-rem)) calc(.8 * var(--wg-rem));--wg-filter-input-bg: var(--wg-input-bg);--wg-filter-input-border: var(--wg-input-border);--wg-filter-input-border-focus: var(--wg-input-border-focus);--wg-filter-input-border-radius: var(--wg-border-radius-sm);--wg-filter-input-font-size: var(--wg-font-size-sm);--wg-sort-indicator-size: calc(1.4 * var(--wg-rem));--wg-sort-indicator-opacity: .9;--wg-sort-placeholder-opacity: .3;--wg-sort-priority-size: calc(1.1 * var(--wg-rem));--wg-pagination-padding: var(--wg-spacing-md);--wg-pagination-gap: calc(1.6 * var(--wg-rem));--wg-pagination-bg: var(--wg-surface-1);--wg-pagination-border: 1px solid var(--wg-border-color);--wg-pagination-btn-padding: calc(.6 * var(--wg-rem)) calc(1.6 * var(--wg-rem));--wg-pagination-btn-bg: var(--wg-surface-1);--wg-pagination-btn-bg-hover: var(--wg-surface-2);--wg-pagination-btn-bg-active: var(--wg-surface-3);--wg-pagination-btn-border: 1px solid var(--wg-border-color);--wg-pagination-btn-border-hover: 1px solid var(--wg-border-color-hover);--wg-pagination-btn-border-radius: var(--wg-border-radius-sm);--wg-pagination-btn-disabled-opacity: .4;--wg-empty-padding: var(--wg-spacing-xl);--wg-empty-color: var(--wg-text-color-3);--wg-error-cell-bg: var(--wg-danger-bg-light);--wg-error-cell-border: 1px solid var(--wg-danger-color);--wg-error-message-color: var(--wg-danger-color);--wg-error-message-font-size: var(--wg-font-size-xs);--wg-error-indicator-color: var(--wg-danger-color);--wg-editor-bg: var(--wg-surface-1);--wg-editor-outline: 2px solid var(--wg-accent-color);--wg-editor-outline-offset: -2px;--wg-editor-validating-opacity: .7;--wg-dropdown-toggle-right: var(--wg-spacing-md);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--wg-date-trigger-size: calc(2.8 * var(--wg-rem));--wg-toolbar-bg: var(--wg-surface-floating);--wg-toolbar-border: 1px solid var(--wg-border-color);--wg-toolbar-border-radius: var(--wg-border-radius-sm);--wg-toolbar-shadow: var(--base-dropdown-box-shadow, 0 2px 8px rgba(0, 0, 0, .15));--wg-toolbar-divider-color: var(--wg-border-color);--wg-toolbar-row-height: calc(3.7 * var(--wg-rem));--wg-toolbar-btn-min-width: calc(2.4 * var(--wg-rem));--wg-toolbar-btn-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-btn-border-radius: var(--wg-border-radius-sm);--wg-toolbar-btn-bg-hover: var(--wg-hover-bg);--wg-toolbar-btn-bg-active: var(--wg-active-bg);--wg-toolbar-btn-color: var(--wg-text-color-1);--wg-toolbar-trigger-color: var(--wg-text-color-3);--wg-toolbar-trigger-color-hover: var(--wg-text-color-1);--wg-toolbar-trigger-bg-hover: var(--wg-hover-bg);--wg-tooltip-bg: var(--base-tooltip-bg, #333);--wg-tooltip-color: var(--base-tooltip-color, #fff);--wg-context-menu-z-index: 1001;--wg-context-menu-min-width: calc(16 * var(--wg-rem));--wg-focus-outline: 2px solid var(--wg-accent-color);--wg-focus-outline-offset: -2px;--wg-focus-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-dropdown: 9999;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--wg-z-tooltip: 10000;--wg-frozen-column-bg: var(--wg-surface-1);--wg-frozen-header-bg: var(--wg-header-bg);--wg-frozen-column-shadow: 2px 0 4px rgba(0, 0, 0, .1);--wg-frozen-column-shadow-active: 6px 0 12px rgba(0, 0, 0, .25);--wg-frozen-column-border: 2px solid var(--wg-border-color);--wg-resize-handle-width: 12px;--wg-resize-handle-offset: -6px;--wg-resize-handle-line-width: 2px;--wg-resize-handle-color: var(--wg-border-color);--wg-resize-handle-active-color: var(--wg-accent-color);--wg-fill-handle-size: 8px;--wg-fill-handle-bg: var(--wg-background);--wg-fill-handle-border-color: var(--wg-accent-color);--wg-fill-handle-border-width: 2px;--wg-fill-range-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-fill-range-border-color: var(--wg-accent-color);--wg-selection-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-selection-row-number-bg: var(--wg-accent-color);--wg-selection-row-number-color: var(--base-text-inverted, #fff)}web-grid:not(:defined){display:block;min-height:calc(10 * var(--wg-rem));color:transparent!important;background:transparent}.wg{position:relative;width:100%;max-height:inherit;overflow:auto;overscroll-behavior:contain;border:var(--wg-table-border)}.wg__table{width:100%;min-width:max-content;border-collapse:collapse;table-layout:fixed;background:var(--wg-table-bg);font-size:var(--wg-font-size-base);line-height:var(--wg-line-height-base)}.wg__filler{width:auto;min-width:0;padding:0!important;border:none!important;box-shadow:none!important}th.wg__filler{position:sticky;top:0;z-index:1;background:var(--wg-header-bg);border-bottom:var(--wg-header-border)!important}td.wg__filler{background:transparent}.wg__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:40px;min-width:40px;max-width:40px;box-sizing:border-box;text-align:center;color:var(--wg-text-color-2);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number{box-shadow:inset -1px 0 0 var(--wg-border-color)}.wg__actions-column{width:32px;min-width:32px;max-width:32px;padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);border-bottom:var(--wg-header-border)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__header{position:sticky;top:0;z-index:1;background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);border-bottom:var(--wg-header-border);box-shadow:inset -1px 0 0 var(--wg-border-color);box-sizing:border-box;text-align:left;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__header:last-child{box-shadow:none}.wg__header--sortable{cursor:pointer}.wg__header--sortable:hover{background:var(--wg-header-bg-hover)}.wg__header--sorted{background:var(--wg-header-bg-sorted)}.wg__header-content{display:flex;align-items:center;gap:4px;justify-content:space-between}.wg__header-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center;display:inline-flex;align-items:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:600;margin-left:2px;vertical-align:super;line-height:1}.wg__header-info{display:inline-flex;align-items:center;color:var(--wg-accent-color);cursor:help;opacity:.7;margin-left:4px;vertical-align:middle}.wg__header-info:hover{opacity:1}.wg__filter-row th{padding:var(--wg-filter-padding);background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__filter-input{width:100%;padding:var(--wg-filter-input-padding);border:var(--wg-filter-input-border);border-radius:var(--wg-filter-input-border-radius);background:var(--wg-surface-1);color:var(--wg-text-color-1);font-family:inherit;font-size:var(--wg-filter-input-font-size);box-sizing:border-box}.wg__filter-input:focus{outline:none;border:var(--wg-filter-input-border-focus);box-shadow:0 0 0 1px var(--wg-accent-color)}.wg__resize-handle{position:absolute;top:0;right:var(--wg-resize-handle-offset);bottom:0;width:var(--wg-resize-handle-width);cursor:col-resize;z-index:2;opacity:0;transition:opacity .1s ease}.wg__header:hover .wg__resize-handle{opacity:1}.wg__resize-handle:after{content:"";position:absolute;top:25%;bottom:25%;left:50%;width:var(--wg-resize-handle-line-width);background:var(--wg-resize-handle-color);transform:translate(-50%);border-radius:1px}.wg__resize-handle:hover:after{background:var(--wg-resize-handle-active-color);top:15%;bottom:15%}.wg__resize-handle--active:after{background:var(--wg-resize-handle-active-color);top:0;bottom:0}.wg__resize-handle--disabled{cursor:not-allowed}.wg__resize-handle--disabled:after{display:none}.wg--resizing .wg__resize-handle{opacity:1}.wg--resizing{-webkit-user-select:none;user-select:none;cursor:col-resize}.wg--resizing .wg__cell,.wg--resizing .wg__header{cursor:col-resize}.wg--resizing .wg__table{min-width:0!important}.wg__header--dragging{opacity:1;background:var(--wg-header-bg)!important;outline:2px dashed var(--wg-accent-color);outline-offset:-2px}.wg__reorder-ghost{position:fixed;z-index:10000;background:var(--wg-header-bg);border:2px solid var(--wg-accent-color);border-radius:var(--wg-border-radius-sm);padding:.4em .8em;font-size:var(--wg-font-size-sm);font-weight:var(--wg-header-font-weight);color:var(--wg-header-color);box-shadow:0 4px 12px #00000026;opacity:.95;pointer-events:none;white-space:nowrap}.wg__drop-indicator{position:absolute;width:3px;background:var(--wg-accent-color);z-index:999;pointer-events:none;display:none}.wg__drop-indicator:before{content:"";position:absolute;top:0;left:50%;transform:translate(-50%);border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid var(--wg-accent-color)}.wg--reordering{cursor:grabbing;-webkit-user-select:none;user-select:none}.wg--reordering .wg__cell,.wg--reordering .wg__header{cursor:grabbing}.wg--reorderable .wg__header:not(.wg__header--frozen):hover{cursor:grab}.wg__header--frozen{cursor:default}.wg__fill-handle{position:absolute;width:var(--wg-fill-handle-size);height:var(--wg-fill-handle-size);background:var(--wg-fill-handle-bg);border:var(--wg-fill-handle-border-width) solid var(--wg-fill-handle-border-color);cursor:crosshair;z-index:10;pointer-events:auto;box-sizing:border-box}.wg__fill-handle:hover{transform:scale(1.2)}.wg__fill-range{position:absolute;background:var(--wg-fill-range-bg);border:1px dashed var(--wg-fill-range-border-color);pointer-events:none;z-index:5;box-sizing:border-box}.wg--filling{cursor:crosshair;-webkit-user-select:none;user-select:none}.wg--filling .wg__cell,.wg--filling .wg__header{cursor:crosshair}.wg__cell--editing .wg__fill-handle{display:none}.wg__row--selected>.wg__cell{background:var(--wg-selection-bg)}.wg__row--selected>.wg__row-number{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number[data-row-number]{cursor:pointer;-webkit-user-select:none;user-select:none}.wg__row-number[data-row-number]:hover{background:var(--wg-hover-bg)}.wg__row--selected>.wg__row-number:hover{background:var(--wg-selection-row-number-bg)}.wg--selecting{cursor:default;-webkit-user-select:none;user-select:none}.wg--selecting *{-webkit-user-select:none;user-select:none}.wg:focus{outline:none}.wg__header--frozen{background:var(--wg-frozen-header-bg, var(--wg-header-bg))}.wg__row-number-header.wg__header--frozen{z-index:4!important}.wg__cell--frozen{background:var(--wg-frozen-column-bg, var(--wg-surface-1))}.wg__cell--frozen-last{box-shadow:inset -1px 0 0 var(--wg-border-color)}.wg__row-number.wg__cell--frozen{background:var(--wg-header-bg);z-index:2!important}.wg--striped tbody tr:nth-child(2n) .wg__cell--frozen{background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover .wg__cell--frozen{background:var(--wg-row-bg-hover)}.wg__row--focused .wg__cell--frozen{background:var(--wg-focus-bg)}.wg__header.wg__header--frozen-last,.wg__cell.wg__cell--frozen-last{overflow:visible}.wg--scrolled-horizontal .wg__header--frozen-last:after,.wg--scrolled-horizontal .wg__cell--frozen-last:after{content:"";position:absolute;top:0;right:-8px;bottom:0;width:8px;background:linear-gradient(to right,rgba(0,0,0,.15),transparent);pointer-events:none}.wg__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);box-sizing:border-box;scroll-margin-top:3rem;scroll-margin-bottom:.5rem;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__cell-text{-webkit-user-select:none;user-select:none}.wg__cell--ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--editable{cursor:pointer;position:relative}.wg__cell--editable:hover{background:var(--wg-cell-bg-hover)}.wg__cell--editable:hover:after{content:"";position:absolute;top:2px;right:2px;bottom:2px;left:2px;border:1px dashed var(--wg-border-color);border-radius:2px;pointer-events:none}.wg__cell--editing{position:relative;background:var(--wg-surface-1);outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light, #fee);box-shadow:inset 0 0 0 2px var(--wg-danger-color, #c00)}.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg, #f5f5f5)}:host{--wg-row-locked-bg: var(--base-disabled-bg, #f5f5f5);--wg-row-locked-opacity: .7}.wg__row--locked{background:var(--wg-row-locked-bg)!important}.wg__row--locked .wg__cell{opacity:var(--wg-row-locked-opacity)}.wg__row--locked .wg__cell--editable{cursor:not-allowed}.wg__row--locked .wg__cell--editable:hover{background:inherit}.wg__row--locked .wg__cell--editable:hover:after{display:none}.wg__row-number--locked{opacity:1!important;cursor:help}.wg__editor{position:absolute;top:0;left:0;right:0;width:100%;padding:var(--wg-cell-padding);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:inherit;box-sizing:border-box}.wg__editor:focus,.wg__editor:focus-visible{outline:none;box-shadow:none}.wg__editor--text{text-align:inherit}.wg__editor--number{text-align:right}.wg__editor--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:0;outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size, 28px);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-color-3);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color, #0078d4);background:var(--wg-hover-bg, rgba(0, 0, 0, .05))}.wg__editor--checkbox{width:auto;height:auto;margin:0 auto}.wg__editor--custom{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);cursor:pointer}.wg__editor--custom:focus{outline:none}.wg__custom-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;cursor:pointer}.wg__editor--combobox,.wg__editor--autocomplete{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;padding:var(--wg-cell-padding);padding-right:0;background:transparent;box-sizing:border-box}.wg__combobox-input,.wg__autocomplete-input{flex:1;width:100%;height:100%;padding:0 24px 0 0;border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base);outline:none;box-sizing:border-box;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wg__combobox-input:focus,.wg__autocomplete-input:focus{outline:none}.wg__combobox-toggle{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-dropdown-toggle-size);color:var(--wg-text-color-2);pointer-events:auto;cursor:pointer}.wg__combobox-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:12px;animation:wg-pulse 1s infinite}@keyframes wg-pulse{0%,to{opacity:1}50%{opacity:.4}}.wg__select-trigger{display:flex;align-items:center;justify-content:space-between;cursor:pointer;background:transparent}.wg__select-trigger:focus,.wg__select-trigger:focus-visible{outline:none;box-shadow:none}.wg__select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__select-toggle{position:relative;font-size:var(--wg-dropdown-toggle-size);opacity:.6;margin-left:4px;flex-shrink:0;pointer-events:auto;cursor:pointer}.wg__select-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:0}.wg__cell:hover .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle,.wg__cell--focused .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:.6}.wg__cell-date-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.wg__cell-date-display .wg__date-trigger{position:relative;background:none;border:none;padding:0;margin:0;cursor:pointer;opacity:.6;display:flex;align-items:center;justify-content:center;color:inherit}.wg__cell-date-display .wg__date-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:0}.wg__cell:hover .wg__cell-date-display--toggle-on-focus .wg__date-trigger,.wg__cell--focused .wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:.6}.wg__dropdown{background:var(--wg-surface-floating, #fff);border:1px solid var(--wg-border-color, #d1d1d1);border-radius:4px;box-shadow:var(--wg-toolbar-shadow);max-height:200px;overflow-y:auto;font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base)}.wg__dropdown-option{display:flex;align-items:center;gap:var(--wg-spacing-sm);padding:6px 12px;cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg, #f0f0f0)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light, #e6f2ff)}.wg__dropdown-option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.wg__dropdown-option-icon{flex-shrink:0;width:1.5em;text-align:center}.wg__dropdown-option-content{flex:1;min-width:0;overflow:hidden}.wg__dropdown-option-label{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-option-subtitle{display:block;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-empty{padding:8px 12px;color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg--navigate-mode .wg__cell{cursor:cell}.wg--navigate-mode .wg__cell:focus{outline:none}.wg--navigate-mode .wg__cell.wg__cell--focused{outline:var(--wg-focus-outline);outline-offset:-2px}.wg__cell--focused:after{display:none}.wg__pagination{display:flex;align-items:center;justify-content:center;gap:var(--wg-pagination-gap);padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__pagination-btn{padding:var(--wg-pagination-btn-padding);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer;transition:all var(--wg-transition-fast)}.wg__pagination-btn:hover:not(:disabled){background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-btn:active:not(:disabled){background:var(--wg-pagination-btn-bg-active)}.wg__pagination-btn:disabled{opacity:var(--wg-pagination-btn-disabled-opacity);cursor:not-allowed}.wg__pagination-info{font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__pagination-count{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3);margin-left:4px}.wg__pagination-pagesize{display:flex;align-items:center;gap:6px}.wg__pagination-select{padding:4px 8px;background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer}.wg__pagination-select:hover{background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-select:focus{outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__pagination-label{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3)}.wg__pagination--left{justify-content:flex-start}.wg__pagination--right{justify-content:flex-end}.wg__pagination--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__summary{display:flex;align-items:center;padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg);font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__summary--left{justify-content:flex-start}.wg__summary--right{justify-content:flex-end}.wg__summary--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer{display:flex;align-items:center;justify-content:space-between;border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__footer--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer .wg__summary,.wg__footer .wg__pagination{border:none}.wg__footer .wg__summary{flex:0 0 auto}.wg__footer .wg__pagination{flex:0 0 auto;margin-left:auto}.wg__toolbar-container{position:fixed;z-index:var(--wg-z-toolbar, 1000)}.wg__toolbar{display:flex;flex-direction:column-reverse;gap:0;padding:0;background:var(--wg-toolbar-bg);border:var(--wg-toolbar-border);border-radius:var(--wg-toolbar-border-radius);box-shadow:var(--wg-toolbar-shadow)}.wg__toolbar-row{display:flex;gap:2px;align-items:center;height:var(--wg-toolbar-row-height);padding:0 4px}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:16px;background:var(--wg-toolbar-divider-color);margin:0 4px;flex-shrink:0}.wg__toolbar-btn{min-width:var(--wg-toolbar-btn-min-width);height:100%;border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:4px;font-family:inherit;font-size:var(--wg-font-size-base);font-weight:500;padding:var(--wg-toolbar-btn-padding);transition:background .1s ease}.wg__toolbar-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__toolbar-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__toolbar-btn:disabled{opacity:.5;cursor:not-allowed}.wg__toolbar-btn:disabled:hover{background:transparent}.wg__toolbar-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:12px;white-space:nowrap}.wg__actions-column{width:24px;min-width:24px;max-width:24px;padding:0!important;text-align:center}.wg__header .wg__actions-column{background:var(--wg-header-bg)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg)}.wg__toolbar-trigger{position:relative;padding:0;background:transparent;border:none;border-radius:var(--wg-border-radius-sm);cursor:pointer;font-size:var(--wg-font-size-base);line-height:1;color:var(--wg-toolbar-trigger-color)}.wg__toolbar-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.wg__inline-actions-header,.wg__inline-actions-cell{width:1%;white-space:nowrap;text-align:center;padding:var(--wg-spacing-xs) var(--wg-spacing-sm)}.wg__inline-actions-header{background:var(--wg-header-bg)}.wg__inline-actions-wrap{display:flex;flex-direction:column;gap:2px;align-items:center}.wg__inline-actions-row{display:flex;gap:2px;align-items:center;justify-content:center}.wg__inline-action-btn{min-width:var(--wg-toolbar-btn-min-width);height:calc(2.4 * var(--wg-rem));border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 var(--wg-spacing-xs);font-family:inherit;font-size:var(--wg-font-size-base);transition:background var(--wg-transition-fast)}.wg__inline-action-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__inline-action-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__inline-action-btn:disabled,.wg__inline-action-btn--disabled{opacity:.5;cursor:not-allowed}.wg__inline-action-btn:disabled:hover,.wg__inline-action-btn--disabled:hover{background:transparent}.wg__inline-action-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__shortcuts-help{position:absolute;top:var(--wg-spacing-xs);right:var(--wg-spacing-sm);z-index:5}.wg__shortcuts-help--left{right:auto;left:var(--wg-spacing-sm)}.wg__shortcuts-help-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:50%;background:var(--wg-surface-1);color:var(--wg-text-color-2);cursor:pointer;opacity:.7}.wg__shortcuts-help-icon:hover{opacity:1;background:var(--wg-surface-2)}.wg__shortcuts-help-icon svg{width:16px;height:16px}.wg__shortcuts-help-overlay{display:none;position:absolute;top:100%;right:0;margin-top:var(--wg-spacing-xs);padding:var(--wg-spacing-md);background:var(--wg-surface-1);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-md);box-shadow:0 4px 16px #00000026;min-width:200px;max-width:300px;z-index:100}.wg__shortcuts-help--left .wg__shortcuts-help-overlay{right:auto;left:0}.wg__shortcuts-help:hover .wg__shortcuts-help-overlay,.wg__shortcuts-help:focus-within .wg__shortcuts-help-overlay{display:block}.wg__shortcuts-help-title{font-weight:var(--wg-font-weight-semibold);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1);margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-xs);border-bottom:1px solid var(--wg-border-color)}.wg__shortcuts-help-custom{margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-sm);border-bottom:1px solid var(--wg-border-color);font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg__shortcuts-help-list{display:flex;flex-direction:column;gap:var(--wg-spacing-xs)}.wg__shortcuts-help-item{display:flex;align-items:center;gap:var(--wg-spacing-md)}.wg__shortcuts-help-key{display:inline-flex;align-items:center;justify-content:center;min-width:28px;padding:2px 6px;font-family:var(--wg-font-family-mono);font-size:var(--wg-font-size-xs);font-weight:var(--wg-font-weight-semibold);color:var(--wg-text-color-1);background:var(--wg-surface-2);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm)}.wg__shortcuts-help-label{flex:1;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg--striped tbody tr:nth-child(2n){background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover{background:var(--wg-row-bg-hover)}.wg__empty{text-align:center;padding:var(--wg-empty-padding);color:var(--wg-empty-color);font-style:italic}.wg__loading-more{text-align:center;padding:var(--wg-cell-padding);color:var(--wg-text-color-2);font-size:var(--wg-font-size-sm)}.wg__tooltip{position:fixed;z-index:var(--wg-z-tooltip);max-width:300px;padding:6px 10px;background:var(--wg-tooltip-bg, #333);color:var(--wg-tooltip-color, #fff);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:0 2px 8px #0003;pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:8px;height:8px;background:var(--wg-tooltip-bg, #333);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:-4px}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:-4px}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:-4px}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:-4px}.wg__tooltip-title{font-weight:600}.wg__tooltip-desc{opacity:.85;margin-top:2px}.wg__tooltip-shortcut{margin-top:4px;opacity:.7;font-size:.9em}.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0006;display:flex;align-items:center;justify-content:center;z-index:1000}.wg__goto-dialog{background:var(--wg-surface-1);border-radius:var(--wg-border-radius-md);padding:var(--wg-spacing-lg);box-shadow:0 4px 20px #00000026;min-width:250px}.wg__goto-label{display:block;margin-bottom:var(--wg-spacing-sm);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1)}.wg__goto-input{width:100%;padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-base);margin-bottom:var(--wg-spacing-md);box-sizing:border-box}.wg__goto-input:focus{outline:none;border-color:var(--wg-accent-color);box-shadow:0 0 0 2px #0078d433}.wg__goto-buttons{display:flex;gap:var(--wg-spacing-sm);justify-content:flex-end}.wg__goto-btn{padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-sm);cursor:pointer;background:var(--wg-surface-1);color:var(--wg-text-color-1)}.wg__goto-btn:hover{background:var(--wg-surface-2)}.wg__goto-btn--go{background:var(--wg-accent-color);border-color:var(--wg-accent-color);color:#fff}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover, #106ebe)}.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}@media (prefers-color-scheme: dark){:host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86}}:host([data-theme="dark"]),[data-theme=dark] :host,:host([data-bs-theme="dark"]),[data-bs-theme=dark] :host,.dark :host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86}';function it(o,e,t){const i=t.valueMember||"value",r=t.displayMember||"label",n=e.find(s=>s[i]===o);return n?String(n[r]??""):o!=null?String(o):""}function He(o,e){if(e.getDisplayCallback)return e.getDisplayCallback(o);const t=e.displayMember||"label";return String(o[t]??o.label??"")}function Se(o,e){if(e.getValueCallback)return e.getValueCallback(o);const t=e.valueMember||"value";return o[t]??o.value}function Wo(o,e){return e.getIconCallback?e.getIconCallback(o):e.iconMember&&o[e.iconMember]||null}function Bo(o,e){return e.getSubtitleCallback?e.getSubtitleCallback(o):e.subtitleMember&&o[e.subtitleMember]||null}function Pe(o,e){return e.getDisabledCallback?e.getDisabledCallback(o):e.disabledMember?!!o[e.disabledMember]:!1}const pe=Math.min,K=Math.max,Be=Math.round,Ue=Math.floor,ae=o=>({x:o,y:o}),Uo={left:"right",right:"left",bottom:"top",top:"bottom"},jo={start:"end",end:"start"};function rt(o,e,t){return K(o,pe(e,t))}function Re(o,e){return typeof o=="function"?o(e):o}function me(o){return o.split("-")[0]}function $e(o){return o.split("-")[1]}function Ft(o){return o==="x"?"y":"x"}function nt(o){return o==="y"?"height":"width"}const Ko=new Set(["top","bottom"]);function ge(o){return Ko.has(me(o))?"y":"x"}function st(o){return Ft(ge(o))}function Xo(o,e,t){t===void 0&&(t=!1);const i=$e(o),r=st(o),n=nt(r);let s=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(s=je(s)),[s,je(s)]}function Go(o){const e=je(o);return[lt(o),e,lt(e)]}function lt(o){return o.replace(/start|end/g,e=>jo[e])}const qt=["left","right"],Vt=["right","left"],Qo=["top","bottom"],Jo=["bottom","top"];function Zo(o,e,t){switch(o){case"top":case"bottom":return t?e?Vt:qt:e?qt:Vt;case"left":case"right":return e?Qo:Jo;default:return[]}}function ei(o,e,t,i){const r=$e(o);let n=Zo(me(o),t==="start",i);return r&&(n=n.map(s=>s+"-"+r),e&&(n=n.concat(n.map(lt)))),n}function je(o){return o.replace(/left|right|bottom|top/g,e=>Uo[e])}function ti(o){return{top:0,right:0,bottom:0,left:0,...o}}function Nt(o){return typeof o!="number"?ti(o):{top:o,right:o,bottom:o,left:o}}function Ke(o){const{x:e,y:t,width:i,height:r}=o;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function Yt(o,e,t){let{reference:i,floating:r}=o;const n=ge(e),s=st(e),a=nt(s),l=me(e),d=n==="y",g=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,c=i[a]/2-r[a]/2;let h;switch(l){case"top":h={x:g,y:i.y-r.height};break;case"bottom":h={x:g,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:u};break;case"left":h={x:i.x-r.width,y:u};break;default:h={x:i.x,y:i.y}}switch($e(e)){case"start":h[s]-=c*(t&&d?-1:1);break;case"end":h[s]+=c*(t&&d?-1:1);break}return h}const oi=async(o,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:n=[],platform:s}=t,a=n.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let d=await s.getElementRects({reference:o,floating:e,strategy:r}),{x:g,y:u}=Yt(d,i,l),c=i,h={},f=0;for(let p=0;p<a.length;p++){const{name:v,fn:m}=a[p],{x:y,y:_,data:S,reset:b}=await m({x:g,y:u,initialPlacement:i,placement:c,strategy:r,middlewareData:h,rects:d,platform:s,elements:{reference:o,floating:e}});g=y??g,u=_??u,h={...h,[v]:{...h[v],...S}},b&&f<=50&&(f++,typeof b=="object"&&(b.placement&&(c=b.placement),b.rects&&(d=b.rects===!0?await s.getElementRects({reference:o,floating:e,strategy:r}):b.rects),{x:g,y:u}=Yt(d,c,l)),p=-1)}return{x:g,y:u,placement:c,strategy:r,middlewareData:h}};async function at(o,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:n,rects:s,elements:a,strategy:l}=o,{boundary:d="clippingAncestors",rootBoundary:g="viewport",elementContext:u="floating",altBoundary:c=!1,padding:h=0}=Re(e,o),f=Nt(h),v=a[c?u==="floating"?"reference":"floating":u],m=Ke(await n.getClippingRect({element:(t=await(n.isElement==null?void 0:n.isElement(v)))==null||t?v:v.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(a.floating)),boundary:d,rootBoundary:g,strategy:l})),y=u==="floating"?{x:i,y:r,width:s.floating.width,height:s.floating.height}:s.reference,_=await(n.getOffsetParent==null?void 0:n.getOffsetParent(a.floating)),S=await(n.isElement==null?void 0:n.isElement(_))?await(n.getScale==null?void 0:n.getScale(_))||{x:1,y:1}:{x:1,y:1},b=Ke(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:_,strategy:l}):y);return{top:(m.top-b.top+f.top)/S.y,bottom:(b.bottom-m.bottom+f.bottom)/S.y,left:(m.left-b.left+f.left)/S.x,right:(b.right-m.right+f.right)/S.x}}const ii=o=>({name:"arrow",options:o,async fn(e){const{x:t,y:i,placement:r,rects:n,platform:s,elements:a,middlewareData:l}=e,{element:d,padding:g=0}=Re(o,e)||{};if(d==null)return{};const u=Nt(g),c={x:t,y:i},h=st(r),f=nt(h),p=await s.getDimensions(d),v=h==="y",m=v?"top":"left",y=v?"bottom":"right",_=v?"clientHeight":"clientWidth",S=n.reference[f]+n.reference[h]-c[h]-n.floating[f],b=c[h]-n.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let x=C?C[_]:0;(!x||!await(s.isElement==null?void 0:s.isElement(C)))&&(x=a.floating[_]||n.floating[f]);const k=S/2-b/2,T=x/2-p[f]/2-1,E=pe(u[m],T),M=pe(u[y],T),F=E,O=x-p[f]-M,I=x/2-p[f]/2+k,L=rt(F,I,O),D=!l.arrow&&$e(r)!=null&&I!==L&&n.reference[f]/2-(I<F?E:M)-p[f]/2<0,q=D?I<F?I-F:I-O:0;return{[h]:c[h]+q,data:{[h]:L,centerOffset:I-L-q,...D&&{alignmentOffset:q}},reset:D}}}),ri=function(o){return o===void 0&&(o={}),{name:"flip",options:o,async fn(e){var t,i;const{placement:r,middlewareData:n,rects:s,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:g=!0,crossAxis:u=!0,fallbackPlacements:c,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:p=!0,...v}=Re(o,e);if((t=n.arrow)!=null&&t.alignmentOffset)return{};const m=me(r),y=ge(a),_=me(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(d.floating)),b=c||(_||!p?[je(a)]:Go(a)),C=f!=="none";!c&&C&&b.push(...ei(a,p,f,S));const x=[a,...b],k=await at(e,v),T=[];let E=((i=n.flip)==null?void 0:i.overflows)||[];if(g&&T.push(k[m]),u){const I=Xo(r,s,S);T.push(k[I[0]],k[I[1]])}if(E=[...E,{placement:r,overflows:T}],!T.every(I=>I<=0)){var M,F;const I=(((M=n.flip)==null?void 0:M.index)||0)+1,L=x[I];if(L&&(!(u==="alignment"?y!==ge(L):!1)||E.every(V=>ge(V.placement)===y?V.overflows[0]>0:!0)))return{data:{index:I,overflows:E},reset:{placement:L}};let D=(F=E.filter(q=>q.overflows[0]<=0).sort((q,V)=>q.overflows[1]-V.overflows[1])[0])==null?void 0:F.placement;if(!D)switch(h){case"bestFit":{var O;const q=(O=E.filter(V=>{if(C){const A=ge(V.placement);return A===y||A==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(A=>A>0).reduce((A,We)=>A+We,0)]).sort((V,A)=>V[1]-A[1])[0])==null?void 0:O[0];q&&(D=q);break}case"initialPlacement":D=a;break}if(r!==D)return{reset:{placement:D}}}return{}}}},ni=new Set(["left","top"]);async function si(o,e){const{placement:t,platform:i,elements:r}=o,n=await(i.isRTL==null?void 0:i.isRTL(r.floating)),s=me(t),a=$e(t),l=ge(t)==="y",d=ni.has(s)?-1:1,g=n&&l?-1:1,u=Re(e,o);let{mainAxis:c,crossAxis:h,alignmentAxis:f}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof f=="number"&&(h=a==="end"?f*-1:f),l?{x:h*g,y:c*d}:{x:c*d,y:h*g}}const li=function(o){return o===void 0&&(o=0),{name:"offset",options:o,async fn(e){var t,i;const{x:r,y:n,placement:s,middlewareData:a}=e,l=await si(e,o);return s===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:n+l.y,data:{...l,placement:s}}}}},ai=function(o){return o===void 0&&(o={}),{name:"shift",options:o,async fn(e){const{x:t,y:i,placement:r}=e,{mainAxis:n=!0,crossAxis:s=!1,limiter:a={fn:v=>{let{x:m,y}=v;return{x:m,y}}},...l}=Re(o,e),d={x:t,y:i},g=await at(e,l),u=ge(me(r)),c=Ft(u);let h=d[c],f=d[u];if(n){const v=c==="y"?"top":"left",m=c==="y"?"bottom":"right",y=h+g[v],_=h-g[m];h=rt(y,h,_)}if(s){const v=u==="y"?"top":"left",m=u==="y"?"bottom":"right",y=f+g[v],_=f-g[m];f=rt(y,f,_)}const p=a.fn({...e,[c]:h,[u]:f});return{...p,data:{x:p.x-t,y:p.y-i,enabled:{[c]:n,[u]:s}}}}}},di=function(o){return o===void 0&&(o={}),{name:"size",options:o,async fn(e){var t,i;const{placement:r,rects:n,platform:s,elements:a}=e,{apply:l=()=>{},...d}=Re(o,e),g=await at(e,d),u=me(r),c=$e(r),h=ge(r)==="y",{width:f,height:p}=n.floating;let v,m;u==="top"||u==="bottom"?(v=u,m=c===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(m=u,v=c==="end"?"top":"bottom");const y=p-g.top-g.bottom,_=f-g.left-g.right,S=pe(p-g[v],y),b=pe(f-g[m],_),C=!e.middlewareData.shift;let x=S,k=b;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(k=_),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(x=y),C&&!c){const E=K(g.left,0),M=K(g.right,0),F=K(g.top,0),O=K(g.bottom,0);h?k=f-2*(E!==0||M!==0?E+M:K(g.left,g.right)):x=p-2*(F!==0||O!==0?F+O:K(g.top,g.bottom))}await l({...e,availableWidth:k,availableHeight:x});const T=await s.getDimensions(a.floating);return f!==T.width||p!==T.height?{reset:{rects:!0}}:{}}}};function Xe(){return typeof window<"u"}function Me(o){return Wt(o)?(o.nodeName||"").toLowerCase():"#document"}function X(o){var e;return(o==null||(e=o.ownerDocument)==null?void 0:e.defaultView)||window}function de(o){var e;return(e=(Wt(o)?o.ownerDocument:o.document)||window.document)==null?void 0:e.documentElement}function Wt(o){return Xe()?o instanceof Node||o instanceof X(o).Node:!1}function ie(o){return Xe()?o instanceof Element||o instanceof X(o).Element:!1}function ce(o){return Xe()?o instanceof HTMLElement||o instanceof X(o).HTMLElement:!1}function Bt(o){return!Xe()||typeof ShadowRoot>"u"?!1:o instanceof ShadowRoot||o instanceof X(o).ShadowRoot}const ci=new Set(["inline","contents"]);function Fe(o){const{overflow:e,overflowX:t,overflowY:i,display:r}=re(o);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!ci.has(r)}const gi=new Set(["table","td","th"]);function ui(o){return gi.has(Me(o))}const hi=[":popover-open",":modal"];function Ge(o){return hi.some(e=>{try{return o.matches(e)}catch{return!1}})}const fi=["transform","translate","scale","rotate","perspective"],wi=["transform","translate","scale","rotate","perspective","filter"],pi=["paint","layout","strict","content"];function dt(o){const e=ct(),t=ie(o)?re(o):o;return fi.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||wi.some(i=>(t.willChange||"").includes(i))||pi.some(i=>(t.contain||"").includes(i))}function mi(o){let e=be(o);for(;ce(e)&&!Te(e);){if(dt(e))return e;if(Ge(e))return null;e=be(e)}return null}function ct(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const bi=new Set(["html","body","#document"]);function Te(o){return bi.has(Me(o))}function re(o){return X(o).getComputedStyle(o)}function Qe(o){return ie(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:{scrollLeft:o.scrollX,scrollTop:o.scrollY}}function be(o){if(Me(o)==="html")return o;const e=o.assignedSlot||o.parentNode||Bt(o)&&o.host||de(o);return Bt(e)?e.host:e}function Ut(o){const e=be(o);return Te(e)?o.ownerDocument?o.ownerDocument.body:o.body:ce(e)&&Fe(e)?e:Ut(e)}function qe(o,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Ut(o),n=r===((i=o.ownerDocument)==null?void 0:i.body),s=X(r);if(n){const a=gt(s);return e.concat(s,s.visualViewport||[],Fe(r)?r:[],a&&t?qe(a):[])}return e.concat(r,qe(r,[],t))}function gt(o){return o.parent&&Object.getPrototypeOf(o.parent)?o.frameElement:null}function jt(o){const e=re(o);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=ce(o),n=r?o.offsetWidth:t,s=r?o.offsetHeight:i,a=Be(t)!==n||Be(i)!==s;return a&&(t=n,i=s),{width:t,height:i,$:a}}function ut(o){return ie(o)?o:o.contextElement}function ze(o){const e=ut(o);if(!ce(e))return ae(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:n}=jt(e);let s=(n?Be(t.width):t.width)/i,a=(n?Be(t.height):t.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const _i=ae(0);function Kt(o){const e=X(o);return!ct()||!e.visualViewport?_i:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function vi(o,e,t){return e===void 0&&(e=!1),!t||e&&t!==X(o)?!1:e}function xe(o,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=o.getBoundingClientRect(),n=ut(o);let s=ae(1);e&&(i?ie(i)&&(s=ze(i)):s=ze(o));const a=vi(n,t,i)?Kt(n):ae(0);let l=(r.left+a.x)/s.x,d=(r.top+a.y)/s.y,g=r.width/s.x,u=r.height/s.y;if(n){const c=X(n),h=i&&ie(i)?X(i):i;let f=c,p=gt(f);for(;p&&i&&h!==f;){const v=ze(p),m=p.getBoundingClientRect(),y=re(p),_=m.left+(p.clientLeft+parseFloat(y.paddingLeft))*v.x,S=m.top+(p.clientTop+parseFloat(y.paddingTop))*v.y;l*=v.x,d*=v.y,g*=v.x,u*=v.y,l+=_,d+=S,f=X(p),p=gt(f)}}return Ke({width:g,height:u,x:l,y:d})}function Je(o,e){const t=Qe(o).scrollLeft;return e?e.left+t:xe(de(o)).left+t}function Xt(o,e){const t=o.getBoundingClientRect(),i=t.left+e.scrollLeft-Je(o,t),r=t.top+e.scrollTop;return{x:i,y:r}}function yi(o){let{elements:e,rect:t,offsetParent:i,strategy:r}=o;const n=r==="fixed",s=de(i),a=e?Ge(e.floating):!1;if(i===s||a&&n)return t;let l={scrollLeft:0,scrollTop:0},d=ae(1);const g=ae(0),u=ce(i);if((u||!u&&!n)&&((Me(i)!=="body"||Fe(s))&&(l=Qe(i)),ce(i))){const h=xe(i);d=ze(i),g.x=h.x+i.clientLeft,g.y=h.y+i.clientTop}const c=s&&!u&&!n?Xt(s,l):ae(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+g.x+c.x,y:t.y*d.y-l.scrollTop*d.y+g.y+c.y}}function Ci(o){return Array.from(o.getClientRects())}function Si(o){const e=de(o),t=Qe(o),i=o.ownerDocument.body,r=K(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),n=K(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let s=-t.scrollLeft+Je(o);const a=-t.scrollTop;return re(i).direction==="rtl"&&(s+=K(e.clientWidth,i.clientWidth)-r),{width:r,height:n,x:s,y:a}}const Gt=25;function xi(o,e){const t=X(o),i=de(o),r=t.visualViewport;let n=i.clientWidth,s=i.clientHeight,a=0,l=0;if(r){n=r.width,s=r.height;const g=ct();(!g||g&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}const d=Je(i);if(d<=0){const g=i.ownerDocument,u=g.body,c=getComputedStyle(u),h=g.compatMode==="CSS1Compat"&&parseFloat(c.marginLeft)+parseFloat(c.marginRight)||0,f=Math.abs(i.clientWidth-u.clientWidth-h);f<=Gt&&(n-=f)}else d<=Gt&&(n+=d);return{width:n,height:s,x:a,y:l}}const ki=new Set(["absolute","fixed"]);function Di(o,e){const t=xe(o,!0,e==="fixed"),i=t.top+o.clientTop,r=t.left+o.clientLeft,n=ce(o)?ze(o):ae(1),s=o.clientWidth*n.x,a=o.clientHeight*n.y,l=r*n.x,d=i*n.y;return{width:s,height:a,x:l,y:d}}function Qt(o,e,t){let i;if(e==="viewport")i=xi(o,t);else if(e==="document")i=Si(de(o));else if(ie(e))i=Di(e,t);else{const r=Kt(o);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Ke(i)}function Jt(o,e){const t=be(o);return t===e||!ie(t)||Te(t)?!1:re(t).position==="fixed"||Jt(t,e)}function Ei(o,e){const t=e.get(o);if(t)return t;let i=qe(o,[],!1).filter(a=>ie(a)&&Me(a)!=="body"),r=null;const n=re(o).position==="fixed";let s=n?be(o):o;for(;ie(s)&&!Te(s);){const a=re(s),l=dt(s);!l&&a.position==="fixed"&&(r=null),(n?!l&&!r:!l&&a.position==="static"&&!!r&&ki.has(r.position)||Fe(s)&&!l&&Jt(o,s))?i=i.filter(g=>g!==s):r=a,s=be(s)}return e.set(o,i),i}function Ri(o){let{element:e,boundary:t,rootBoundary:i,strategy:r}=o;const s=[...t==="clippingAncestors"?Ge(e)?[]:Ei(e,this._c):[].concat(t),i],a=s[0],l=s.reduce((d,g)=>{const u=Qt(e,g,r);return d.top=K(u.top,d.top),d.right=pe(u.right,d.right),d.bottom=pe(u.bottom,d.bottom),d.left=K(u.left,d.left),d},Qt(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function $i(o){const{width:e,height:t}=jt(o);return{width:e,height:t}}function Mi(o,e,t){const i=ce(e),r=de(e),n=t==="fixed",s=xe(o,!0,n,e);let a={scrollLeft:0,scrollTop:0};const l=ae(0);function d(){l.x=Je(r)}if(i||!i&&!n)if((Me(e)!=="body"||Fe(r))&&(a=Qe(e)),i){const h=xe(e,!0,n,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else r&&d();n&&!i&&r&&d();const g=r&&!i&&!n?Xt(r,a):ae(0),u=s.left+a.scrollLeft-l.x-g.x,c=s.top+a.scrollTop-l.y-g.y;return{x:u,y:c,width:s.width,height:s.height}}function ht(o){return re(o).position==="static"}function Zt(o,e){if(!ce(o)||re(o).position==="fixed")return null;if(e)return e(o);let t=o.offsetParent;return de(o)===t&&(t=t.ownerDocument.body),t}function eo(o,e){const t=X(o);if(Ge(o))return t;if(!ce(o)){let r=be(o);for(;r&&!Te(r);){if(ie(r)&&!ht(r))return r;r=be(r)}return t}let i=Zt(o,e);for(;i&&ui(i)&&ht(i);)i=Zt(i,e);return i&&Te(i)&&ht(i)&&!dt(i)?t:i||mi(o)||t}const Ti=async function(o){const e=this.getOffsetParent||eo,t=this.getDimensions,i=await t(o.floating);return{reference:Mi(o.reference,await e(o.floating),o.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function zi(o){return re(o).direction==="rtl"}const Ii={convertOffsetParentRelativeRectToViewportRelativeRect:yi,getDocumentElement:de,getClippingRect:Ri,getOffsetParent:eo,getElementRects:Ti,getClientRects:Ci,getDimensions:$i,getScale:ze,isElement:ie,isRTL:zi};function to(o,e){return o.x===e.x&&o.y===e.y&&o.width===e.width&&o.height===e.height}function Li(o,e){let t=null,i;const r=de(o);function n(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),n();const d=o.getBoundingClientRect(),{left:g,top:u,width:c,height:h}=d;if(a||e(),!c||!h)return;const f=Ue(u),p=Ue(r.clientWidth-(g+c)),v=Ue(r.clientHeight-(u+h)),m=Ue(g),_={rootMargin:-f+"px "+-p+"px "+-v+"px "+-m+"px",threshold:K(0,pe(1,l))||1};let S=!0;function b(C){const x=C[0].intersectionRatio;if(x!==l){if(!S)return s();x?s(!1,x):i=setTimeout(()=>{s(!1,1e-7)},1e3)}x===1&&!to(d,o.getBoundingClientRect())&&s(),S=!1}try{t=new IntersectionObserver(b,{..._,root:r.ownerDocument})}catch{t=new IntersectionObserver(b,_)}t.observe(o)}return s(!0),n}function Ai(o,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:n=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,d=ut(o),g=r||n?[...d?qe(d):[],...qe(e)]:[];g.forEach(m=>{r&&m.addEventListener("scroll",t,{passive:!0}),n&&m.addEventListener("resize",t)});const u=d&&a?Li(d,t):null;let c=-1,h=null;s&&(h=new ResizeObserver(m=>{let[y]=m;y&&y.target===d&&h&&(h.unobserve(e),cancelAnimationFrame(c),c=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(e)})),t()}),d&&!l&&h.observe(d),h.observe(e));let f,p=l?xe(o):null;l&&v();function v(){const m=xe(o);p&&!to(p,m)&&t(),p=m,f=requestAnimationFrame(v)}return t(),()=>{var m;g.forEach(y=>{r&&y.removeEventListener("scroll",t),n&&y.removeEventListener("resize",t)}),u==null||u(),(m=h)==null||m.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const ft=li,Ze=ai,Ie=ri,Oi=di,Hi=ii,Le=(o,e,t)=>{const i=new Map,r={platform:Ii,...t},n={...r.platform,_c:i};return oi(o,e,{...r,platform:n})};function ke(o,e,t,i){var n;N(o);const r=document.createElement("div");if(r.className="wg__dropdown",r.style.cssText=`
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
max-height: 200px;
|
|
6
|
-
overflow-y: auto;
|
|
7
|
-
z-index: 1000;
|
|
8
|
-
`,t.length===0){const s=o.isSearching?i.searchingText||o.grid.labels.dropdownSearching:i.noOptionsText||o.grid.labels.dropdownNoOptions;r.innerHTML=`<div class="wg__dropdown-empty">${o.escapeHtml(s)}</div>`}else{const s=o.grid.editingCell,a=s?(n=o.grid.displayItems[s.rowIndex])==null?void 0:n[s.field]:void 0;r.innerHTML=t.map((l,d)=>{const g=d===o.highlightedIndex,u=Se(l,i)===a,c=Pe(l,i);if(i.renderOptionCallback){const _={index:d,isHighlighted:g,isSelected:u,isDisabled:c};return i.renderOptionCallback(l,_)}const h=He(l,i),f=Wo(l,i),p=Bo(l,i),v=["wg__dropdown-option"];g&&v.push("wg__dropdown-option--highlighted"),u&&v.push("wg__dropdown-option--selected"),c&&v.push("wg__dropdown-option--disabled");const m=f?`<span class="wg__dropdown-option-icon">${o.escapeHtml(f)}</span>`:"",y=p?`<span class="wg__dropdown-option-subtitle">${o.escapeHtml(p)}</span>`:"";return`<div class="${v.join(" ")}" data-index="${d}" ${c?'data-disabled="true"':""}>
|
|
9
|
-
${m}
|
|
10
|
-
<div class="wg__dropdown-option-content">
|
|
11
|
-
<span class="wg__dropdown-option-label">${o.escapeHtml(h)}</span>
|
|
12
|
-
${y}
|
|
13
|
-
</div>
|
|
14
|
-
</div>`}).join("")}return o.shadow.appendChild(r),o.dropdownOpen=!0,Le(e,r,{strategy:"fixed",placement:"bottom-start",middleware:[ft(1),Ie({fallbackPlacements:["top-start"]}),Oi({apply({rects:s}){Object.assign(r.style,{width:`${s.reference.width}px`})}})]}).then(({x:s,y:a})=>{Object.assign(r.style,{left:`${s}px`,top:`${a}px`})}),r}function N(o){const e=o.shadow.querySelector(".wg__dropdown");e==null||e.remove(),o.dropdownOpen=!1,o.highlightedIndex=-1,o.filterText=""}function Pi(o,e,t){if(o.grid.shouldUseVirtualScroll()){Fi(o,e);const s=o.shadow.querySelector(`[data-row="${e}"][data-col="${t}"]`);s&&s.focus({preventScroll:!0});return}const i=o.shadow.querySelector(`[data-row="${e}"][data-col="${t}"]`);if(!i)return;i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest"});const r=o.shadow.querySelector(".wg__header"),n=o.shadow.querySelector(".wg");if(r&&n){const s=r.getBoundingClientRect(),a=i.getBoundingClientRect();if(a.top<s.bottom){const l=a.top-s.bottom-4;n.scrollBy({top:l,behavior:"instant"})}}}function Fi(o,e){const t=o.shadow.querySelector(".wg");if(!t)return;const i=o.grid.virtualScrollRowHeight,r=t.scrollTop,n=t.clientHeight,s=o.shadow.querySelector(".wg__header"),a=(s==null?void 0:s.offsetHeight)||0,l=e*i,d=l+i,g=r+a,u=r+n;l<g?t.scrollTop=l-a:d>u&&(t.scrollTop=d-n)}let oo=0;const qi=100;function te(o,e,t){const i=e&&t&&e.rowIndex===t.rowIndex&&e.colIndex===t.colIndex,r=Date.now();if(i&&r-oo<qi)return;oo=r;const n=o.grid.editingCell;e&&(n&&n.rowIndex===e.rowIndex&&o.grid.columns.findIndex(a=>String(a.field)===n.field)===e.colIndex||j(o,e.rowIndex,e.colIndex)),t&&(n&&n.rowIndex===t.rowIndex&&o.grid.columns.findIndex(a=>String(a.field)===n.field)===t.colIndex||j(o,t.rowIndex,t.colIndex))}function G(o){const e=o.grid.editingCell;if(e){const t=o.grid.columns.findIndex(r=>String(r.field)===e.field),i=o.shadow.querySelector(`[data-row="${e.rowIndex}"][data-col="${t}"]`);i&&i.classList.remove("wg__cell--editing")}}let io=0;const Vi=50;function Ni(o,e,t){if(!o.grid.isNavigateMode)return;const i=Date.now();if(i-io<Vi){o.grid.setFocusedCell(e,t);return}io=i;const r=o.grid.focusedCell,n={rowIndex:e,colIndex:t};o.grid.setFocusedCell(e,t),te(o,r,n)}function z(o,e,t){const i=o.grid.focusedCell,r={rowIndex:e,colIndex:t};o.grid.setFocusedCell(e,t),te(o,i,r),Pi(o,e,t)}function oe(o,e,t,i){const r=o.grid.columns[t];if(!r||!o.grid.isCellEditable(r))return;const n=String(r.field);o.dropdownOpen&&N(o);const s=o.grid.focusedCell;s&&(s.rowIndex!==e||s.colIndex!==t)&&(o.grid.clearFocusedCell(),j(o,s.rowIndex,s.colIndex)),o.grid.startEdit(e,n,i),j(o,e,t,{focusEditor:!0,cursorPosition:i==null?void 0:i.cursorPosition,initialSearchQuery:i==null?void 0:i.initialSearchQuery})}function wt(o,e){const t=e.querySelector(".wg__cell-text");if(!t)return null;const i=t.textContent||"";if(!i.length)return 0;const r=o.clientX,n=t.getBoundingClientRect();if(r<=n.left)return 0;if(r>=n.right)return i.length;const s=t.firstChild;if(!s||s.nodeType!==Node.TEXT_NODE)return null;const a=document.createRange();let l=0,d=i.length;try{for(;l<d;){const g=Math.floor((l+d)/2);a.setStart(s,0),a.setEnd(s,g),a.getBoundingClientRect().right<r?l=g+1:d=g}if(l>0&&l<i.length){a.setStart(s,l-1),a.setEnd(s,l);const g=a.getBoundingClientRect(),u=g.left+g.width/2;r<u&&l--}}catch{return i.length}return l}function Yi(o,e){const t=e.relatedTarget,i=o.shadow.querySelector(".wg__table");if(!t||!(i!=null&&i.contains(t))){const r=o.grid.focusedCell;o.grid.clearFocusedCell(),te(o,r,null)}}function Wi(o,e){if(!o)return null;const[t,i,r]=o.split("-").map(Number),n=new Date(t,i-1,r);if(isNaN(n.getTime()))return null;switch(e){case"date":return n;case"timestamp":return n.getTime();case"iso":default:return o}}function pt(o,e,t){j(o,e,t)}function et(o,e){const t=parseInt(e.dataset.row||"0",10),i=e.dataset.field||"";let r;if(e instanceof HTMLInputElement)if(e.type==="checkbox"){const n=JSON.parse(e.dataset.trueValue||"true"),s=JSON.parse(e.dataset.falseValue||"false");r=e.checked?n:s}else e.classList.contains("wg__editor--number")?r=e.value===""?null:parseFloat(e.value):e.type==="date"?r=Wi(e.value,e.dataset.outputFormat||"iso"):r=e.value;else e instanceof HTMLSelectElement&&(r=e.value);o.grid.commitEdit(t,i,r)}function Bi(o,e){et(o,e)}function Ui(o,e,t){const i=o.grid.columns[t];if(!i)return;const r=String(i.field),n=o.grid.displayItems[e];if(!n)return;const s=i.editorOptions||{},a=s.trueValue??!0,l=s.falseValue??!1,g=n[r]===a?l:a;o.grid.commitEdit(e,r,g),j(o,e,t);const u=o.grid.displayItems;e<u.length-1&&requestAnimationFrame(()=>{z(o,e+1,t)})}function ji(o,e){if(!o.isCommittingFromKeyboard&&o.grid.editingCell){const t=parseInt(e.dataset.row||"0",10),i=e.dataset.field||"",r=o.grid.columns.findIndex(n=>String(n.field)===i);et(o,e),r>=0&&pt(o,t,r)}}function mt(o,e,t,i){const n=o.grid.columns.findIndex(d=>String(d.field)===t),s=o.grid.displayItems;let a=e,l=n;if(i==="down")a=Math.min(e+1,s.length-1);else if(i==="up")a=Math.max(e-1,0);else{const d=o.grid.getEditableColumns(),g=d.findIndex(u=>u.index===n);i==="next"?g>=0&&g<d.length-1?l=d[g+1].index:e<s.length-1&&(a=e+1,l=d[0].index):g>0?l=d[g-1].index:e>0&&(a=e-1,l=d[d.length-1].index)}pt(o,e,n),z(o,a,l),o.isCommittingFromKeyboard=!1}function Ki(o,e,t){const r=o.grid.columns.findIndex(n=>String(n.field)===t);r>=0&&(pt(o,e,r),z(o,e,r),o.isCommittingFromKeyboard=!1)}function tt(o,e,t,i){const r=String(i.field),n=o.grid.displayItems[e],s=o.grid.getCellRawValue(n,e,r);switch(i.editor||"text"){case"checkbox":return Zi(o,e,r,s,i);case"number":return Gi(o,e,r,s,i);case"date":return Qi(o,e,r,s,i);case"select":return er(o,e,r,s,i);case"combobox":return tr(o,e,r,s,i);case"autocomplete":return or(o,e,r,s,i);case"custom":return ir(o,e,r,s,i);case"text":default:return Xi(o,e,r,s,i)}}function Xi(o,e,t,i,r){var l;const n=r.editorOptions||{},s=(l=o.grid.editingCell)==null?void 0:l.initialSearchQuery,a=s!==void 0?s:i!=null?String(i):"";return`
|
|
15
|
-
<input
|
|
16
|
-
type="text"
|
|
17
|
-
class="wg__editor wg__editor--text"
|
|
18
|
-
value="${o.escapeHtml(a)}"
|
|
19
|
-
data-row="${e}"
|
|
20
|
-
data-field="${t}"
|
|
21
|
-
${n.maxLength?`maxlength="${n.maxLength}"`:""}
|
|
22
|
-
${n.placeholder?`placeholder="${o.escapeHtml(n.placeholder)}"`:""}
|
|
23
|
-
${n.pattern?`pattern="${o.escapeHtml(n.pattern)}"`:""}
|
|
24
|
-
/>
|
|
25
|
-
`}function Gi(o,e,t,i,r){var a;r.editorOptions;const n=(a=o.grid.editingCell)==null?void 0:a.initialSearchQuery;return`
|
|
26
|
-
<input
|
|
27
|
-
type="text"
|
|
28
|
-
inputmode="numeric"
|
|
29
|
-
class="wg__editor wg__editor--number"
|
|
30
|
-
value="${n!==void 0?n:i!=null?String(i):""}"
|
|
31
|
-
data-row="${e}"
|
|
32
|
-
data-field="${t}"
|
|
33
|
-
/>
|
|
34
|
-
`}function Qi(o,e,t,i,r){var d;const n=r.editorOptions||{},s=(d=o.grid.editingCell)==null?void 0:d.initialSearchQuery,a=bt(i),l=s!==void 0?s:Ji(i,n.dateFormat);return`
|
|
35
|
-
<div class="wg__editor wg__editor--date" data-row="${e}" data-field="${t}">
|
|
36
|
-
<input
|
|
37
|
-
type="text"
|
|
38
|
-
class="wg__date-input"
|
|
39
|
-
value="${o.escapeHtml(l)}"
|
|
40
|
-
data-row="${e}"
|
|
41
|
-
data-field="${t}"
|
|
42
|
-
data-date-value="${a}"
|
|
43
|
-
data-output-format="${n.outputFormat||"iso"}"
|
|
44
|
-
data-date-format="${n.dateFormat||"YYYY-MM-DD"}"
|
|
45
|
-
${n.minDate?`data-min-date="${bt(n.minDate)}"`:""}
|
|
46
|
-
${n.maxDate?`data-max-date="${bt(n.maxDate)}"`:""}
|
|
47
|
-
placeholder="${o.escapeHtml(n.dateFormat||"YYYY-MM-DD")}"
|
|
48
|
-
/>
|
|
49
|
-
<button type="button" class="wg__date-trigger" tabindex="-1">
|
|
50
|
-
<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
|
|
51
|
-
</button>
|
|
52
|
-
</div>
|
|
53
|
-
`}function Ji(o,e){if(!o)return"";let t=null;if(o instanceof Date?t=o:typeof o=="number"?t=new Date(o):typeof o=="string"&&(t=new Date(o)),!t||isNaN(t.getTime()))return"";const i=e||"YYYY-MM-DD",r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return i.replace("YYYY",String(r)).replace("YY",String(r).slice(-2)).replace("MM",n).replace("DD",s)}function bt(o){if(!o)return"";let e=null;if(o instanceof Date?e=o:typeof o=="number"?e=new Date(o):typeof o=="string"&&(e=new Date(o)),!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${i}-${r}`}function Zi(o,e,t,i,r){const n=r.editorOptions||{},s=n.trueValue!==void 0?n.trueValue:!0;return`
|
|
54
|
-
<input
|
|
55
|
-
type="checkbox"
|
|
56
|
-
class="wg__editor wg__editor--checkbox"
|
|
57
|
-
${i===s?"checked":""}
|
|
58
|
-
data-row="${e}"
|
|
59
|
-
data-field="${t}"
|
|
60
|
-
data-true-value="${o.escapeHtml(JSON.stringify(n.trueValue??!0))}"
|
|
61
|
-
data-false-value="${o.escapeHtml(JSON.stringify(n.falseValue??!1))}"
|
|
62
|
-
/>
|
|
63
|
-
`}function er(o,e,t,i,r){var d;const n=r.editorOptions||{},s=n.options||[],a=it(i,s,n),l=(d=o.grid.editingCell)==null?void 0:d.initialSearchQuery;return o.dropdownOptions=s,o.filterText=l||"",o.highlightedIndex=s.findIndex(g=>Se(g,n)===i),o.highlightedIndex<0&&s.length>0&&(o.highlightedIndex=0),`
|
|
64
|
-
<div
|
|
65
|
-
class="wg__editor wg__editor--select wg__select-trigger"
|
|
66
|
-
tabindex="0"
|
|
67
|
-
role="combobox"
|
|
68
|
-
aria-haspopup="listbox"
|
|
69
|
-
data-row="${e}"
|
|
70
|
-
data-field="${t}"
|
|
71
|
-
>
|
|
72
|
-
<span class="wg__select-value">${o.escapeHtml(a)}</span>
|
|
73
|
-
<span class="wg__select-toggle">▼</span>
|
|
74
|
-
</div>
|
|
75
|
-
`}function tr(o,e,t,i,r){var g;const n=r.editorOptions||{},s=n.options||[],a=it(i,s,n),l=(g=o.grid.editingCell)==null?void 0:g.initialSearchQuery,d=l!==void 0?l:a;return o.dropdownOptions=s,o.filterText=d,o.highlightedIndex=s.length>0?0:-1,`
|
|
76
|
-
<div class="wg__editor wg__editor--combobox" data-row="${e}" data-field="${t}">
|
|
77
|
-
<input
|
|
78
|
-
type="text"
|
|
79
|
-
class="wg__combobox-input"
|
|
80
|
-
value="${o.escapeHtml(d)}"
|
|
81
|
-
data-row="${e}"
|
|
82
|
-
data-field="${t}"
|
|
83
|
-
/>
|
|
84
|
-
<span class="wg__combobox-toggle">▼</span>
|
|
85
|
-
</div>
|
|
86
|
-
`}function or(o,e,t,i,r){var g;const n=r.editorOptions||{},s=n.initialOptions||n.options||[],a=it(i,s,n),l=(g=o.grid.editingCell)==null?void 0:g.initialSearchQuery,d=l!==void 0?l:a;return o.dropdownOptions=s,o.filterText=d,o.highlightedIndex=s.length>0?0:-1,`
|
|
87
|
-
<div class="wg__editor wg__editor--autocomplete" data-row="${e}" data-field="${t}">
|
|
88
|
-
<input
|
|
89
|
-
type="text"
|
|
90
|
-
class="wg__autocomplete-input"
|
|
91
|
-
value="${o.escapeHtml(d)}"
|
|
92
|
-
placeholder="${o.escapeHtml(n.placeholder||"")}"
|
|
93
|
-
data-row="${e}"
|
|
94
|
-
data-field="${t}"
|
|
95
|
-
/>
|
|
96
|
-
<span class="wg__combobox-toggle">▼</span>
|
|
97
|
-
<span class="wg__loading-indicator" style="display: none;">⏳</span>
|
|
98
|
-
</div>
|
|
99
|
-
`}function ir(o,e,t,i,r){const n=r.formatCallback?r.formatCallback(i,o.grid.displayItems[e]):i!=null?String(i):"";return`
|
|
100
|
-
<div
|
|
101
|
-
class="wg__editor wg__editor--custom"
|
|
102
|
-
tabindex="0"
|
|
103
|
-
data-row="${e}"
|
|
104
|
-
data-field="${t}"
|
|
105
|
-
>
|
|
106
|
-
<span class="wg__custom-value">${o.escapeHtml(n)}</span>
|
|
107
|
-
</div>
|
|
108
|
-
`}function _t(o,e,t,i,r,n){const s=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",a=i.editor==="date",l=String(i.field);return s?`
|
|
109
|
-
<div class="wg__cell-dropdown-display ${o.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-dropdown-display--toggle-on-focus":""}" data-row="${e}" data-field="${l}">
|
|
110
|
-
<span class="wg__select-value">${o.escapeHtml(r)}</span>
|
|
111
|
-
<span class="wg__select-toggle">▼</span>
|
|
112
|
-
</div>
|
|
113
|
-
`:a?`
|
|
114
|
-
<div class="wg__cell-date-display ${o.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-date-display--toggle-on-focus":""}" data-row="${e}" data-field="${l}">
|
|
115
|
-
<span class="wg__date-value">${o.escapeHtml(r)}</span>
|
|
116
|
-
<button type="button" class="wg__date-trigger" tabindex="-1">
|
|
117
|
-
<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
|
|
118
|
-
</button>
|
|
119
|
-
</div>
|
|
120
|
-
`:i.templateCallback?`<span class="wg__cell-text">${r}</span>`:`<span class="wg__cell-text">${o.escapeHtml(r)}</span>`}let Y={path:null,arrowPos:null,arrowDir:"right"};const rr={add:{icon:"+",title:"Add row"},delete:{icon:"−",title:"Delete row",danger:!0},duplicate:{icon:"⧉",title:"Duplicate row"},moveUp:{icon:"↑",title:"Move up"},moveDown:{icon:"↓",title:"Move down"}};function vt(o){return o.map((e,t)=>{if(typeof e=="string"){const i=rr[e];return i?{id:e,icon:i.icon,title:i.title,row:1,group:1,type:e,danger:i.danger}:(console.warn(`Unknown predefined toolbar action: ${e}`),null)}return{id:e.id||`toolbar-item-${t}`,icon:e.icon,title:e.title,label:e.label,row:e.row??1,group:e.group??1,type:e.type,danger:e.danger,disabled:e.disabled,hidden:e.hidden,onclick:e.onclick,tooltip:e.tooltip,tooltipCallback:e.tooltipCallback}}).filter(e=>e!==null)}function nr(o){const e=new Map;for(const r of o){const n=r.row;e.has(n)||e.set(n,[]),e.get(n).push(r)}const t=[],i=[...e.keys()].sort((r,n)=>r-n);for(const r of i){const n=e.get(r),s=new Map;for(const l of n){const d=l.group;s.has(d)||s.set(d,[]),s.get(d).push(l)}const a=[...s.keys()].sort((l,d)=>l-d);t.push({rowNum:r,groups:a.map(l=>({groupNum:l,items:s.get(l)}))})}return t}function sr(o){return o.replace(/\+/g," + ")}function lr(o,e){var r,n;const t=[];t.push(`<span class="wg__tooltip-title">${o.title}</span>`),(r=o.tooltip)!=null&&r.description&&t.push(`<div class="wg__tooltip-desc">${o.tooltip.description}</div>`);const i=((n=o.tooltip)==null?void 0:n.shortcut)||e;return i&&t.push(`<div class="wg__tooltip-shortcut">${sr(i)}</div>`),t.join("")}function ar(o,e,t,i=!1){let r=nr(o);return i&&(r=r.reverse()),`<div class="wg__toolbar">${r.map(({groups:s})=>`<div class="wg__toolbar-row">${s.map(({items:l},d)=>{const g=d>0?'<div class="wg__toolbar-divider"></div>':"",u=l.map(c=>{const h=typeof c.disabled=="function"?c.disabled(e,t):c.disabled,f=["wg__toolbar-btn",c.danger?"wg__toolbar-btn--danger":""].filter(Boolean).join(" "),p=c.label?`<span class="wg__toolbar-label">${c.label}</span>`:"";return`<button
|
|
121
|
-
class="${f}"
|
|
122
|
-
data-toolbar-item="${c.id}"
|
|
123
|
-
title="${c.title}"
|
|
124
|
-
${h?"disabled":""}
|
|
125
|
-
>${c.icon}${p}</button>`}).join("");return g+u}).join("")}</div>`).join("")}</div>`}let H=null;function dr(o,e,t,i,r,n,s){ot();const a=o.grid.toolbarVerticalAlign!=="top",l=ar(i,r,t,a),d=document.createElement("div");d.className="wg__toolbar-container",d.innerHTML=l,o.shadow.appendChild(d);const g=d.querySelector(".wg__toolbar");let u="left";g.style.position="fixed",g.style.visibility="hidden",requestAnimationFrame(()=>{const h=o.shadow.querySelector(`tr[data-row-index="${t}"]`);if(!h){ot();return}const f=o.grid.toolbarPosition,p=o.grid.toolbarVerticalAlign,v=o.grid.toolbarHorizontalAlign;let m,y,_="";p==="top"?_="-end":p==="bottom"&&(_="-start");const S=()=>v==="start"?"top-start":v==="end"?"top-end":"top";f==="left"?(m=`left${_}`,y=[`right${_}`,S()]):f==="right"?(m=`right${_}`,y=[`left${_}`,S()]):f==="top"?(m=S(),y=[`left${_}`,`right${_}`]):(m=`left${_}`,y=[`right${_}`,S()]);let b=h;if(v==="cursor"&&s!==void 0&&f==="top"){const C=h.getBoundingClientRect();b={getBoundingClientRect:()=>({x:s,y:C.top,top:C.top,left:s,bottom:C.bottom,right:s,width:0,height:C.height,toJSON:()=>({})})}}Le(b,g,{strategy:"fixed",placement:m,middleware:[Ie({fallbackPlacements:y}),Ze({padding:8})]}).then(({x:C,y:x,placement:k})=>{Object.assign(g.style,{left:`${C}px`,top:`${x}px`,visibility:"visible"}),u=k.split("-")[0],H&&(H.position=u)}).catch(()=>{g.style.visibility="visible"})});const c=h=>{const f=h.target.closest(".wg__toolbar-btn");if(f&&!f.disabled){const p=f.dataset.toolbarItem||"",v=i.find(m=>m.id===p);v&&n(v)}};d.addEventListener("click",c),H={container:d,toolbar:g,rowIndex:t,rowItem:r,position:u,hasRowMoved:!1,cursorX:s,cleanup:()=>{d.removeEventListener("click",c),d.remove()}},Y={path:null,arrowPos:null,arrowDir:"right"}}function ot(){H&&(H.cleanup(),H=null),Y={path:null,arrowPos:null,arrowDir:"right"}}function Ae(){return(H==null?void 0:H.rowIndex)??null}function ro(o){return(H==null?void 0:H.container.getRootNode())===o}function yt(o){return(H==null?void 0:H.rowIndex)===o}function cr(){return Y}function no(o,e){if(!H){Y={path:null,arrowPos:null,arrowDir:"right"};return}const{toolbar:t,rowItem:i,position:r}=H,n=e.findIndex(b=>b===i);if(n===-1){Y={path:null,arrowPos:null,arrowDir:"right"};return}const s=o.shadow.querySelector(`tr[data-row-index="${n}"]`);if(!s){Y={path:null,arrowPos:null,arrowDir:"right"};return}if(n===H.rowIndex||(H.hasRowMoved=!0),!H.hasRowMoved){Y={path:null,arrowPos:null,arrowDir:"right"};return}const l=t.getBoundingClientRect(),d=s.getBoundingClientRect(),g=o.shadow.querySelector(".wg__table"),u=g==null?void 0:g.getBoundingClientRect(),c=o.shadow.querySelector(".wg"),h=c==null?void 0:c.getBoundingClientRect();if(!u||!h){Y={path:null,arrowPos:null,arrowDir:"right"};return}const f=document.dir==="rtl"||document.documentElement.dir==="rtl",p=d.top+d.height/2,v=d.bottom<=h.top,m=d.top>=h.bottom,y=!v&&!m;let _,S="right";if(v?(_=h.top+8,S="up"):m?(_=h.bottom-8,S="down"):_=p,r==="left"){const b=l.right,C=l.top+l.height/2,x=f?h.right+15:h.left-15;if(!y){Y={path:`M ${b} ${C} H ${x} V ${_}`,arrowPos:{x,y:_},arrowDir:S};return}const k=f?h.right-8:h.left+8;S=f?"left":"right",Y={path:`M ${b} ${C} H ${x} V ${_} H ${k}`,arrowPos:{x:k,y:_},arrowDir:S};return}else if(r==="right"){const b=l.left,C=l.top+l.height/2,x=f?h.left-15:h.right+15;if(!y){Y={path:`M ${b} ${C} H ${x} V ${_}`,arrowPos:{x,y:_},arrowDir:S};return}const k=f?h.left+8:h.right-8;S=f?"right":"left",Y={path:`M ${b} ${C} H ${x} V ${_} H ${k}`,arrowPos:{x:k,y:_},arrowDir:S};return}else{const C=l.right,x=l.top+l.height/2,k=C+48,T=n-H.rowIndex,E=8;if(T===0){let M=d.top-E;m&&(M=h.bottom-E),Y={path:`M ${C} ${x} H ${k} V ${M}`,arrowPos:{x:k,y:M},arrowDir:"down"};return}else if(T===-1){const F=l.top+l.height*.25,O=l.top+l.height*.75,I=l.right+24,L=l.right+E;Y={path:`M ${l.right} ${F} H ${I} V ${O} H ${L}`,arrowPos:{x:L,y:O},arrowDir:"left"};return}else if(T<0){let M=d.bottom+E;v&&(M=h.top+E),Y={path:`M ${C} ${x} H ${k} V ${M}`,arrowPos:{x:k,y:M},arrowDir:"up"};return}else{let M=d.top-E;m&&(M=h.bottom-E),Y={path:`M ${C} ${x} H ${k} V ${M}`,arrowPos:{x:k,y:M},arrowDir:"down"};return}}}function so(o,e,t="Row actions"){return`<button
|
|
126
|
-
class="wg__toolbar-trigger ${e?"wg__toolbar-trigger--active":""}"
|
|
127
|
-
data-toolbar-trigger="${o}"
|
|
128
|
-
title="${t}"
|
|
129
|
-
>⋮</button>`}const Ct=40;function St(o){if(!o||o==="auto")return 150;const e=o.match(/^([\d.]+)(px|em|rem|%)?$/);if(!e)return 150;const t=parseFloat(e[1]);switch(e[2]||"px"){case"px":return t;case"em":return t*16;case"rem":return t*10;case"%":return 150;default:return t}}function gr(o){const e=["wg"];return o.grid.striped&&e.push("wg--striped"),o.grid.hoverable&&e.push("wg--hoverable"),o.grid.editable&&e.push("wg--editable"),o.grid.isNavigateMode&&e.push("wg--navigate-mode"),o.grid.allowColumnReorder&&e.push("wg--reorderable"),e.join(" ")}function ur(o){const e=o.grid.visualColumns;if(e.length===0)return"";let t=0,i="";if(o.grid.showRowNumbers){const d=o.grid.stickyRowNumbers;i=`<th class="wg__header wg__row-number-header${d?" wg__header--frozen":""}" style="${d?"position: sticky; left: 0; z-index: 4;":""}">#</th>`,t+=Ct}const n=o.grid.showRowToolbar&&o.grid.toolbarPosition==="inline"?`<th class="wg__header wg__inline-actions-header">${o.escapeHtml(o.grid.inlineActionsTitle||o.grid.labels.inlineActionsHeader)}</th>`:"",a=o.grid.showRowToolbar&&o.grid.toolbarTrigger==="button"&&o.grid.toolbarPosition!=="inline"?'<th class="wg__header wg__actions-column"></th>':"",l=e.map(({column:d,originalIndex:g},u)=>{const c=String(d.field),h=d.sortable!==!1&&o.grid.sortMode!=="none",f=o.grid.getColumnSortState(c),p=o.grid.getColumnSortPriority(c),v=f!==void 0,m=o.grid.isColumnFrozen(u),y=m&&u===o.grid.totalFrozenColumns-1,_=["wg__header"];h&&_.push("wg__header--sortable"),v&&_.push("wg__header--sorted"),m&&_.push("wg__header--frozen"),y&&_.push("wg__header--frozen-last");const b=o.grid.getColumnWidth(c)||d.width||d.maxWidth,C=St(b),x=d.minWidth,T=`style="${[m?"position: sticky":"",m?`left: ${t}px`:"",m?"z-index: 2":"",b?`width: ${b}`:"",b?`max-width: ${b}`:"",x?`min-width: ${x}`:"",`text-align: ${d.align||"left"}`].filter(Boolean).join("; ")}"`;m&&(t+=C);let E="";if(h)if(v){const I=f.direction==="asc"?"▲":"▼",L=o.grid.sort.length>1?`<sup class="wg__sort-priority">${p}</sup>`:"";E=`<span class="wg__sort-indicator">${I}${L}</span>`}else E='<span class="wg__sort-indicator wg__sort-placeholder">⬍</span>';let M="";d.headerInfo&&(M=`<span class="wg__header-info" data-tooltip="${o.escapeHtml(d.headerInfo)}"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg></span>`);const O=`<div class="wg__resize-handle${d.resizable!==!1?"":" wg__resize-handle--disabled"}" data-field="${c}"></div>`;return`
|
|
130
|
-
<th class="${_.join(" ")}" ${T} data-field="${c}">
|
|
131
|
-
<div class="wg__header-content">
|
|
132
|
-
<span class="wg__header-title">${o.escapeHtml(d.title)}</span>
|
|
133
|
-
${M}
|
|
134
|
-
${E}
|
|
135
|
-
</div>
|
|
136
|
-
${O}
|
|
137
|
-
</th>
|
|
138
|
-
`}).join("");return`<tr>${i}${n}${a}${l}<th class="wg__filler"> </th></tr>`}function hr(o){const e=o.grid.displayItems,t=o.grid.visualColumns,i=o.grid.showRowNumbers,r=o.grid.stickyRowNumbers,n=o.grid.showRowToolbar&&o.grid.toolbarPosition==="inline",s=o.grid.showRowToolbar&&o.grid.toolbarTrigger==="button"&&o.grid.toolbarPosition!=="inline",a=t.length+(s?1:0)+(i?1:0)+(n?1:0);if(e.length===0)return`
|
|
139
|
-
<tr>
|
|
140
|
-
<td class="wg__empty" colspan="${a}">
|
|
141
|
-
No items to display
|
|
142
|
-
</td>
|
|
143
|
-
</tr>
|
|
144
|
-
`;const l=Ae(),d=t.map(({column:g})=>St(g.width||g.maxWidth));return e.map((g,u)=>{const c=o.grid.getRowLockInfo(g),h=(c==null?void 0:c.isLocked)===!0;let f=0,p="";if(i){const b=r?"position: sticky; left: 0; z-index: 2;":"",C=r?" wg__cell--frozen":"";if(h){const x=c!=null&&c.lockedBy?`Locked by ${c.lockedBy}`:"This row is locked";p=`<td class="wg__cell wg__row-number wg__row-number--locked${C}" style="${b}" data-tooltip="${o.escapeHtml(x)}" data-row-number="${u}">🔒</td>`}else p=`<td class="wg__cell wg__row-number${C}" style="${b}" data-row-number="${u}">${u+1}</td>`;f+=Ct}const v=n?lo(o,g,u):"";let m="";s&&(m=`
|
|
145
|
-
<td class="wg__cell wg__actions-column">
|
|
146
|
-
${so(u,l===u,o.grid.labels.rowActions)}
|
|
147
|
-
</td>
|
|
148
|
-
`);const y=t.map(({column:b,originalIndex:C},x)=>{const k=String(b.field),T=o.grid.getCellValue(g,b,u),E=b.align||"left",M=o.grid.isCellEditable(b),F=o.grid.isCellFocused(u,C),O=o.grid.isColumnFrozen(x),I=O&&x===o.grid.totalFrozenColumns-1,L=["wg__cell"],D=o.grid.isEditing(u,k);if(M&&L.push("wg__cell--editable"),F&&!D&&L.push("wg__cell--focused"),b.textOverflow!=="wrap"&&L.push("wg__cell--ellipsis"),D&&L.push("wg__cell--editing"),o.grid.isCellInvalid(u,k)&&L.push("wg__cell--invalid"),O&&L.push("wg__cell--frozen"),I&&L.push("wg__cell--frozen-last"),b.cellClass&&L.push(b.cellClass),b.cellClassCallback){const Z=o.grid.getCellRawValue(g,u,k),W=b.cellClassCallback(Z,g);W&&L.push(W)}const V=o.grid.getColumnWidth(k)||b.width,A=b.minWidth,We=[O?"position: sticky":"",O?`left: ${f}px`:"",O?"z-index: 1":"",`text-align: ${E}`,V?`width: ${V}`:"",A?`min-width: ${A}`:"",b.maxWidth?`max-width: ${b.maxWidth}`:""].filter(Boolean).join("; ");O&&(f+=d[x]);const Ht=o.grid.isNavigateMode?'tabindex="0"':"";let we="";if(b.tooltipCallback){const Z=o.grid.getCellRawValue(g,u,k),W=b.tooltipCallback(Z,g);W&&(we=`data-tooltip="${o.escapeHtml(W)}"`)}else if(b.tooltipMember){const Z=g[b.tooltipMember];Z&&typeof Z=="string"&&(we=`data-tooltip="${o.escapeHtml(Z)}"`)}if(!we&&o.grid.isCellInvalid(u,k)){const Z=o.grid.getCellValidationError(u,k);if(Z){const W=b.validationTooltipCallback||o.grid.validationTooltipCallback;if(W){const Pt=o.grid.getCellRawValue(g,u,k),ee=W({field:k,error:Z,value:Pt,row:g,rowIndex:u});ee&&(we=`data-tooltip-html="${o.escapeHtml(ee)}"`)}we||(we=`data-tooltip="${o.escapeHtml(Z)}"`)}}return`
|
|
149
|
-
<td
|
|
150
|
-
class="${L.join(" ")}"
|
|
151
|
-
style="${We}"
|
|
152
|
-
data-row="${u}"
|
|
153
|
-
data-col="${C}"
|
|
154
|
-
data-field="${k}"
|
|
155
|
-
${Ht}
|
|
156
|
-
${we}
|
|
157
|
-
>
|
|
158
|
-
${o.grid.isEditing(u,k)?tt(o,u,C,b):_t(o,u,C,b,T)}
|
|
159
|
-
</td>
|
|
160
|
-
`}).join(""),_=["wg__row"];if(h&&_.push("wg__row--locked"),o.grid.isRowSelected(u)&&_.push("wg__row--selected"),o.grid.rowClassCallback){const b=o.grid.rowClassCallback(g,u);b&&_.push(b)}const S=h&&!i?`data-tooltip="${o.escapeHtml(c!=null&&c.lockedBy?`Locked by ${c.lockedBy}`:"This row is locked")}"`:"";return`<tr class="${_.join(" ")}" data-row-index="${u}" ${S}>${p}${v}${m}${y}<td class="wg__filler"></td></tr>`}).join("")}function lo(o,e,t){const r=vt(o.grid.rowToolbar).filter(l=>typeof l.hidden=="function"?!l.hidden(e,t):!l.hidden),n=new Map;for(const l of r){const d=l.row??1;n.has(d)||n.set(d,[]),n.get(d).push(l)}return`<td class="wg__cell wg__inline-actions-cell"><div class="wg__inline-actions-wrap">${[...n.keys()].sort((l,d)=>l-d).map(l=>`<div class="wg__inline-actions-row">${n.get(l).map(u=>{const c=typeof u.disabled=="function"?u.disabled(e,t):u.disabled,h=["wg__inline-action-btn",u.danger?"wg__inline-action-btn--danger":"",c?"wg__inline-action-btn--disabled":""].filter(Boolean).join(" "),f=c?"disabled":"";return`<button class="${h}" data-action-id="${u.id}" data-row="${t}" title="${o.escapeHtml(u.title)}" ${f}>${u.icon}</button>`}).join("")}</div>`).join("")}</div></td>`}function ao(o,e){const t=o.grid.displayItems,i=o.grid.visualColumns,{startIndex:r,endIndex:n,rowHeight:s,totalItems:a}=e,l=o.grid.showRowNumbers,d=o.grid.stickyRowNumbers,g=o.grid.showRowToolbar&&o.grid.toolbarPosition==="inline",u=o.grid.showRowToolbar&&o.grid.toolbarTrigger==="button"&&o.grid.toolbarPosition!=="inline",c=i.length+(u?1:0)+(l?1:0)+(g?1:0);if(t.length===0)return`
|
|
161
|
-
<tr>
|
|
162
|
-
<td class="wg__empty" colspan="${c}">
|
|
163
|
-
No items to display
|
|
164
|
-
</td>
|
|
165
|
-
</tr>
|
|
166
|
-
`;const h=Ae(),f=i.map(({column:S})=>St(S.width||S.maxWidth)),p=r*s,v=(a-n)*s,m=p>0?`<tr class="wg__spacer-top"><td colspan="${c}" style="height: ${p}px"></td></tr>`:"",y=[];for(let S=r;S<n&&S<t.length;S++){const b=t[S],C=S,x=o.grid.getRowLockInfo(b),k=(x==null?void 0:x.isLocked)===!0;let T=0,E="";if(l){const D=d?"position: sticky; left: 0; z-index: 2;":"",q=d?" wg__cell--frozen":"";if(k){const V=x!=null&&x.lockedBy?`Locked by ${x.lockedBy}`:"This row is locked";E=`<td class="wg__cell wg__row-number wg__row-number--locked${q}" style="${D}" data-tooltip="${o.escapeHtml(V)}" data-row-number="${C}">🔒</td>`}else E=`<td class="wg__cell wg__row-number${q}" style="${D}" data-row-number="${C}">${C+1}</td>`;T+=Ct}const M=g?lo(o,b,C):"";let F="";u&&(F=`
|
|
167
|
-
<td class="wg__cell wg__actions-column">
|
|
168
|
-
${so(C,h===C,o.grid.labels.rowActions)}
|
|
169
|
-
</td>
|
|
170
|
-
`);const O=i.map(({column:D,originalIndex:q},V)=>{const A=String(D.field),We=o.grid.getCellValue(b,D,C),Ht=D.align||"left",we=o.grid.isCellEditable(D),Z=o.grid.isCellFocused(C,q),W=o.grid.isColumnFrozen(V),Pt=W&&V===o.grid.totalFrozenColumns-1,ee=["wg__cell"],Fo=o.grid.isEditing(C,A);if(we&&ee.push("wg__cell--editable"),Z&&!Fo&&ee.push("wg__cell--focused"),D.textOverflow!=="wrap"&&ee.push("wg__cell--ellipsis"),Fo&&ee.push("wg__cell--editing"),o.grid.isCellInvalid(C,A)&&ee.push("wg__cell--invalid"),W&&ee.push("wg__cell--frozen"),Pt&&ee.push("wg__cell--frozen-last"),D.cellClass&&ee.push(D.cellClass),D.cellClassCallback){const le=o.grid.getCellRawValue(b,C,A),ye=D.cellClassCallback(le,b);ye&&ee.push(ye)}const qo=o.grid.getColumnWidth(A)||D.width,Vo=D.minWidth,Mn=[W?"position: sticky":"",W?`left: ${T}px`:"",W?"z-index: 1":"",`text-align: ${Ht}`,qo?`width: ${qo}`:"",Vo?`min-width: ${Vo}`:"",D.maxWidth?`max-width: ${D.maxWidth}`:""].filter(Boolean).join("; ");W&&(T+=f[V]);const Tn=o.grid.isNavigateMode?'tabindex="0"':"";let Ee="";if(D.tooltipCallback){const le=o.grid.getCellRawValue(b,C,A),ye=D.tooltipCallback(le,b);ye&&(Ee=`data-tooltip="${o.escapeHtml(ye)}"`)}else if(D.tooltipMember){const le=b[D.tooltipMember];le&&typeof le=="string"&&(Ee=`data-tooltip="${o.escapeHtml(le)}"`)}if(!Ee&&o.grid.isCellInvalid(C,A)){const le=o.grid.getCellValidationError(C,A);if(le){const ye=D.validationTooltipCallback||o.grid.validationTooltipCallback;if(ye){const zn=o.grid.getCellRawValue(b,C,A),No=ye({field:A,error:le,value:zn,row:b,rowIndex:C});No&&(Ee=`data-tooltip-html="${o.escapeHtml(No)}"`)}Ee||(Ee=`data-tooltip="${o.escapeHtml(le)}"`)}}return`
|
|
171
|
-
<td
|
|
172
|
-
class="${ee.join(" ")}"
|
|
173
|
-
style="${Mn}"
|
|
174
|
-
data-row="${C}"
|
|
175
|
-
data-col="${q}"
|
|
176
|
-
data-field="${A}"
|
|
177
|
-
${Tn}
|
|
178
|
-
${Ee}
|
|
179
|
-
>
|
|
180
|
-
${o.grid.isEditing(C,A)?tt(o,C,q,D):_t(o,C,q,D,We)}
|
|
181
|
-
</td>
|
|
182
|
-
`}).join(""),I=["wg__row"];if(k&&I.push("wg__row--locked"),o.grid.isRowSelected(C)&&I.push("wg__row--selected"),o.grid.rowClassCallback){const D=o.grid.rowClassCallback(b,C);D&&I.push(D)}const L=k&&!l?`data-tooltip="${o.escapeHtml(x!=null&&x.lockedBy?`Locked by ${x.lockedBy}`:"This row is locked")}"`:"";y.push(`<tr class="${I.join(" ")}" data-row-index="${C}" ${L}>${E}${M}${F}${O}<td class="wg__filler"></td></tr>`)}const _=v>0?`<tr class="wg__spacer-bottom"><td colspan="${c}" style="height: ${v}px"></td></tr>`:"";return m+y.join("")+_}function xt(o,e="bottom-center"){const t=o.grid.showPagination;if(!o.grid.pageable||t===!1||t==="auto"&&o.grid.totalPages<=1)return"";const i=o.grid.currentPage,r=o.grid.totalPages,n=o.grid.pageSize,s=o.grid.pageSizes,a=o.grid.totalItems!==null?o.grid.totalItems:o.grid.sortedItems.length,l=o.grid.labels,d={first:l.paginationFirst,previous:l.paginationPrevious,next:l.paginationNext,last:l.paginationLast,pageInfo:l.paginationPageInfo.replace("{current}",String(i)).replace("{total}",String(r)),itemCount:l.paginationItemCount.replace("{count}",String(a)),perPage:l.paginationPerPage},g=o.grid.paginationLabelsCallback,u=g?g({currentPage:i,totalPages:r,totalItems:a,pageSize:n}):{},c={...d,...u},h=e.startsWith("top-"),f=e.replace("top-","").replace("bottom-",""),p=["wg__pagination"];f==="left"?p.push("wg__pagination--left"):f==="right"&&p.push("wg__pagination--right"),h&&p.push("wg__pagination--top");const v={first:`
|
|
183
|
-
<button class="wg__pagination-btn" data-action="first" ${i===1?"disabled":""}>
|
|
184
|
-
${c.first}
|
|
185
|
-
</button>
|
|
186
|
-
`,previous:`
|
|
187
|
-
<button class="wg__pagination-btn" data-action="prev" ${i===1?"disabled":""}>
|
|
188
|
-
${c.previous}
|
|
189
|
-
</button>
|
|
190
|
-
`,next:`
|
|
191
|
-
<button class="wg__pagination-btn" data-action="next" ${i===r?"disabled":""}>
|
|
192
|
-
${c.next}
|
|
193
|
-
</button>
|
|
194
|
-
`,last:`
|
|
195
|
-
<button class="wg__pagination-btn" data-action="last" ${i===r?"disabled":""}>
|
|
196
|
-
${c.last}
|
|
197
|
-
</button>
|
|
198
|
-
`,pageInfo:`
|
|
199
|
-
<div class="wg__pagination-info">
|
|
200
|
-
${c.pageInfo}
|
|
201
|
-
<span class="wg__pagination-count">${c.itemCount}</span>
|
|
202
|
-
</div>
|
|
203
|
-
`,pageSize:s.length>0?`
|
|
204
|
-
<div class="wg__pagination-pagesize">
|
|
205
|
-
<select class="wg__pagination-select" data-action="pagesize">
|
|
206
|
-
${s.map(_=>`<option value="${_}" ${_===n?"selected":""}>${_}</option>`).join("")}
|
|
207
|
-
</select>
|
|
208
|
-
<span class="wg__pagination-label">${c.perPage}</span>
|
|
209
|
-
</div>
|
|
210
|
-
`:""},y=o.grid.paginationLayout.split("|").map(_=>_.trim()).map(_=>v[_]||"").join("");return`<div class="${p.join(" ")}">${y}</div>`}function kt(o,e){const t=o.grid.summaryContentCallback;if(!t)return"";const i=o.grid.currentPage,r=o.grid.pageSize,n=o.grid.sortedItems,s=o.grid.displayItems,a=o.grid.totalItems!==null?o.grid.totalItems:n.length,l=t({items:s,allItems:n,totalItems:a,currentPage:i,pageSize:r,metadata:o.grid.summaryMetadata}),d=e.startsWith("top-"),g=e.replace("top-","").replace("bottom-",""),u=["wg__summary"];return g==="left"?u.push("wg__summary--left"):g==="right"&&u.push("wg__summary--right"),d&&u.push("wg__summary--top"),`<div class="${u.join(" ")}">${l}</div>`}function j(o,e,t,i={}){const r=o.grid.columns[t];if(!r)return;const n=o.shadow.querySelector(`td[data-row="${e}"][data-col="${t}"]`);if(!n)return;const s=String(r.field),a=o.grid.displayItems[e];if(!a)return;const l=o.grid.isEditing(e,s),d=o.grid.isCellFocused(e,t),g=o.grid.isCellEditable(r),u=o.grid.isCellInvalid(e,s),c=["wg__cell"];if(g&&c.push("wg__cell--editable"),d&&!l&&c.push("wg__cell--focused"),r.textOverflow!=="wrap"&&c.push("wg__cell--ellipsis"),l&&c.push("wg__cell--editing"),u&&c.push("wg__cell--invalid"),r.cellClass&&c.push(r.cellClass),r.cellClassCallback){const h=o.grid.getCellRawValue(a,e,s),f=r.cellClassCallback(h,a);f&&c.push(f)}if(n.className=c.join(" "),l)n.innerHTML=tt(o,e,t,r),i.focusEditor&&fr(o,n,r,i);else{const h=o.grid.getCellValue(a,r,e);n.innerHTML=_t(o,e,t,r,h)}}function fr(o,e,t,i){var n;let r=e.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__select-trigger, .wg__date-input");if(r||(r=e.querySelector(".wg__editor")),!!r&&(r.focus(),r instanceof HTMLInputElement&&r.type==="text")){const s=i.cursorPosition,a=((n=t.editorOptions)==null?void 0:n.editStartSelection)||o.grid.editStartSelection;if(i.initialSearchQuery!==void 0){const l=r.value.length;r.setSelectionRange(l,l)}else switch(a){case"mousePosition":if(s!==void 0){const l=Math.min(s,r.value.length);r.setSelectionRange(l,l)}else r.setSelectionRange(r.value.length,r.value.length);break;case"cursorAtStart":r.setSelectionRange(0,0);break;case"cursorAtEnd":r.setSelectionRange(r.value.length,r.value.length);break;case"selectAll":default:r.select();break}}}function co(o,e,t=!0){const i=o.dropdownOptions[e];if(!i)return;const r=o.grid.editingCell;if(!r)return;const n=o.getCurrentEditorOptions();if(Pe(i,n))return;const s=Se(i,n),a=o.grid.columns.findIndex(d=>String(d.field)===r.field),l=o.grid.displayItems[r.rowIndex];n.onselect&&l&&n.onselect(i,l),o.justSelected=!0,o.isCommittingFromKeyboard=!0,N(o),o.grid.commitEdit(r.rowIndex,r.field,s),t?o.moveFocusAfterCommit(r.rowIndex,r.field,"down"):j(o,r.rowIndex,a),requestAnimationFrame(()=>{o.justSelected=!1})}function ue(o){const e=o.shadow.querySelector(".wg__dropdown");if(!e)return;e.querySelectorAll(".wg__dropdown-option").forEach((i,r)=>{i.classList.toggle("wg__dropdown-option--highlighted",r===o.highlightedIndex)})}function go(o){const e=o.shadow.querySelector(".wg__dropdown-option--highlighted");e==null||e.scrollIntoView({block:"nearest"})}function Dt(o,e){const t=o.shadow.querySelector(".wg__loading-indicator");t&&(t.style.display=e?"inline":"none");const i=o.shadow.querySelector(".wg__editor--autocomplete .wg__combobox-toggle");i&&(i.style.display=e?"none":"inline")}function ne(o){if(o.justSelected)return;const e=o.getCurrentEditingColumn();if(!e)return;const t=e.editorOptions||{},i=e.editor;let r=0;if(i==="select"){const d=t.options||[];if(o.filterText){const g=o.filterText.toLowerCase();o.dropdownOptions=d.filter(u=>He(u,t).toLowerCase().includes(g)),r=o.dropdownOptions.length>0?0:-1}else{o.dropdownOptions=d;const g=o.grid.editingCell;if(g){const u=o.grid.displayItems[g.rowIndex],c=u?u[g.field]:void 0,h=o.dropdownOptions.findIndex(f=>Se(f,t)===c);r=h>=0?h:0}else r=o.dropdownOptions.length>0?0:-1}}else if(i==="combobox"||i==="autocomplete"){const d=i==="autocomplete"?t.initialOptions||t.options||[]:t.options||[],g=o.grid.editingCell;let u;if(g){const h=o.grid.displayItems[g.rowIndex];u=h?h[g.field]:void 0}const c=d.findIndex(h=>Se(h,t)===u);if(c>=0)o.dropdownOptions=d,r=c;else if(u!=null&&u!==""){const h=t.valueMember||"value",f=t.displayMember||"label",p=String(u),v={value:u,label:p,[h]:u,[f]:p};o.dropdownOptions=[v,...d],r=0}else o.dropdownOptions=d,r=d.length>0?0:-1}const n=o.grid.editingCell;if(!n)return;const{rowIndex:s,field:a}=n,l=o.shadow.querySelector(`.wg__editor--select[data-row="${s}"][data-field="${a}"],
|
|
211
|
-
.wg__editor--combobox[data-row="${s}"][data-field="${a}"],
|
|
212
|
-
.wg__editor--autocomplete[data-row="${s}"][data-field="${a}"]`);if(l&&o.dropdownOptions.length>0){const d=o.filterText;o.isOpeningDropdown=!0;const g=ke(o,l,o.dropdownOptions,t);De(o,g),o.filterText=d,o.highlightedIndex=r,ue(o);const u=o.shadow.querySelector(`.wg__select-trigger[data-row="${s}"][data-field="${a}"]`),c=o.shadow.querySelector(`.wg__combobox-input[data-row="${s}"][data-field="${a}"],
|
|
213
|
-
.wg__autocomplete-input[data-row="${s}"][data-field="${a}"]`),h=u||c;h&&h.focus(),requestAnimationFrame(()=>{o.isOpeningDropdown=!1})}}function uo(o){o.dropdownOpen?N(o):ne(o)}function De(o,e){e.addEventListener("mousedown",t=>{t.preventDefault();const i=t.target.closest(".wg__dropdown-option");if(i&&!i.hasAttribute("data-disabled")){const r=parseInt(i.getAttribute("data-index")||"0",10);co(o,r,!1)}}),e.addEventListener("mouseover",t=>{const i=t.target.closest(".wg__dropdown-option");i&&!i.hasAttribute("data-disabled")&&(o.highlightedIndex=parseInt(i.getAttribute("data-index")||"0",10),ue(o))})}function ho(o,e){const t=e.options||[],i=o.filterText.toLowerCase(),r=o.filterText;o.dropdownOptions=t.filter(s=>He(s,e).toLowerCase().includes(i)),o.highlightedIndex=o.dropdownOptions.length>0?0:-1;const n=o.shadow.querySelector(".wg__editor--select");if(n){const s=ke(o,n,o.dropdownOptions,e);De(o,s),o.filterText=r,o.dropdownOptions.length>0&&(o.highlightedIndex=0,ue(o))}}function wr(o,e){const t=e.target;o.filterText=t.value,o.isUserFiltering=!0;const i=o.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},n=r.options||[];if(o.filterText.trim()){const a=o.filterText.toLowerCase();o.dropdownOptions=n.filter(l=>He(l,r).toLowerCase().includes(a))}else o.dropdownOptions=n;o.highlightedIndex=o.dropdownOptions.length>0?0:-1;const s=t.closest(".wg__editor--combobox");if(s){const a=ke(o,s,o.dropdownOptions,r);De(o,a),o.highlightedIndex=o.dropdownOptions.length>0?0:-1,ue(o)}}function pr(o,e){const t=e.target;o.filterText=t.value;const i=o.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},n=r.debounceMs??300,s=r.minSearchLength??1;o.searchDebounceTimer&&clearTimeout(o.searchDebounceTimer);const a=t.closest(".wg__editor--autocomplete");if(!o.dropdownOpen&&a){o.dropdownOptions=r.initialOptions||[];const l=ke(o,a,o.dropdownOptions,r);De(o,l),o.highlightedIndex=o.dropdownOptions.length>0?0:-1,ue(o)}if(o.filterText.length<s){if(o.dropdownOptions=r.initialOptions||[],a){const l=ke(o,a,o.dropdownOptions,r);De(o,l),o.highlightedIndex=o.dropdownOptions.length>0?0:-1,ue(o)}return}o.searchDebounceTimer=setTimeout(()=>{mr(o,o.filterText,i)},n)}async function mr(o,e,t){const i=t.editorOptions||{};if(!i.onSearchCallback)return;o.searchAbortController&&o.searchAbortController.abort(),o.searchAbortController=new AbortController;const r=o.searchAbortController.signal;o.isSearching=!0,Dt(o,!0);try{const n=o.grid.editingCell;if(!n)return;const s=o.grid.displayItems[n.rowIndex],a=await i.onSearchCallback(e,s,r);if(!r.aborted){o.isSearching=!1,Dt(o,!1),o.dropdownOptions=a;const{rowIndex:l,field:d}=n,g=o.shadow.querySelector(`.wg__editor--autocomplete[data-row="${l}"][data-field="${d}"]`);if(g){const u=ke(o,g,o.dropdownOptions,i);De(o,u),o.highlightedIndex=a.length>0?0:-1,ue(o)}}}catch(n){if(n instanceof Error&&n.name==="AbortError")return;console.error("Autocomplete search failed:",n),o.isSearching=!1,Dt(o,!1),o.dropdownOptions=[];const s=o.grid.editingCell;if(s){const{rowIndex:a,field:l}=s,d=o.shadow.querySelector(`.wg__editor--autocomplete[data-row="${a}"][data-field="${l}"]`);if(d){const g=ke(o,d,o.dropdownOptions,i);De(o,g)}}}}function Et(o,e,t,i,r){const n=i??o.tooltipShowDelay;o.tooltipHideTimer&&(clearTimeout(o.tooltipHideTimer),o.tooltipHideTimer=null),!(o.tooltipElement&&o.tooltipAnchor===e)&&(o.tooltipShowTimer&&clearTimeout(o.tooltipShowTimer),o.tooltipShowTimer=setTimeout(()=>{br(o,e,t,r)},n))}function fo(o,e){const t=e??o.tooltipHideDelay;o.tooltipShowTimer&&(clearTimeout(o.tooltipShowTimer),o.tooltipShowTimer=null),o.tooltipElement&&(o.tooltipHideTimer=setTimeout(()=>{o.tooltipElement&&(o.tooltipElement.classList.remove("wg__tooltip--visible"),setTimeout(()=>{var i;(i=o.tooltipElement)==null||i.remove(),o.tooltipElement=null,o.tooltipArrowElement=null,o.tooltipAnchor=null},100))},t))}function br(o,e,t,i){var a;(a=o.tooltipElement)==null||a.remove();const r=document.createElement("div");r.className="wg__tooltip";const n=document.createElement("div");n.className="wg__tooltip-content",i?n.innerHTML=t:n.textContent=t,r.appendChild(n);const s=document.createElement("div");s.className="wg__tooltip-arrow",r.appendChild(s),o.shadow.appendChild(r),o.tooltipElement=r,o.tooltipArrowElement=s,o.tooltipAnchor=e,Le(e,r,{strategy:"fixed",placement:"top",middleware:[ft(8),Ie({fallbackPlacements:["bottom","left","right"]}),Hi({element:s})]}).then(({x:l,y:d,placement:g,middlewareData:u})=>{if(r.style.left=`${l}px`,r.style.top=`${d}px`,r.setAttribute("data-placement",g),u.arrow){const{x:c,y:h}=u.arrow;c!=null&&(s.style.left=`${c}px`),h!=null&&(s.style.top=`${h}px`)}requestAnimationFrame(()=>{r.classList.add("wg__tooltip--visible")})})}const wo={today:"Today",clear:"Clear",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdayNamesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]};function Rt(o){const e={};let t="";return o.includes("-")?t="-":o.includes("/")?t="/":o.includes(".")&&(t="."),o.split(t).forEach((r,n)=>{r==="YYYY"||r==="YY"?e.year={index:n,length:r.length}:r==="MM"||r==="M"?e.month={index:n,length:2}:(r==="DD"||r==="D")&&(e.day={index:n,length:2})}),{format:o,separator:t,parts:e,maxLength:o.length}}function po(o,e){if(!o||isNaN(o.getTime()))return"";const t=o.getFullYear(),i=String(o.getMonth()+1).padStart(2,"0"),r=String(o.getDate()).padStart(2,"0"),{separator:n,parts:s}=e,a=[];for(let l=0;l<3;l++)s.year&&s.year.index===l?a.push(s.year.length===2?String(t).slice(-2):t):s.month&&s.month.index===l?a.push(i):s.day&&s.day.index===l&&a.push(r);return a.join(n)}function _r(o,e){if(!o)return null;const{separator:t,parts:i}=e,r=o.split(t);let n=null,s=null,a=null;if(r.forEach((d,g)=>{if(d){if(i.year&&i.year.index===g){const u=parseInt(d,10);i.year.length===4&&d.length===4?n=u:i.year.length===2&&d.length===2&&(n=u<100?u+2e3:u)}else if(i.month&&i.month.index===g){const u=parseInt(d,10);d.length===2&&u>=1&&u<=12&&(s=u)}else if(i.day&&i.day.index===g){const u=parseInt(d,10);d.length===2&&u>=1&&u<=31&&(a=u)}}}),n===null||s===null||a===null)return null;const l=new Date(n,s-1,a);return l.getMonth()!==s-1||l.getDate()!==a?null:l}function Q(o){if(!o)return null;let e;if(typeof o=="string"){const[t,i,r]=o.split("-").map(Number);!t||!i||!r?e=new Date(o):e=new Date(t,i-1,r)}else e=new Date(o);return e.setHours(0,0,0,0),isNaN(e.getTime())?null:e}function $t(o){const e=o.getFullYear(),t=String(o.getMonth()+1).padStart(2,"0"),i=String(o.getDate()).padStart(2,"0");return`${e}-${t}-${i}`}function Ve(o,e){return!o||!e?!1:o.getFullYear()===e.getFullYear()&&o.getMonth()===e.getMonth()&&o.getDate()===e.getDate()}function vr(o){return Ve(o,new Date)}function Oe(o,e){return new Date(o,e+1,0).getDate()}function yr(o,e){return new Date(o,e,1).getDay()}function Cr(o,e){if(!o)return{min:e-10,max:e+10};if(o.includes("-")){const[i,r]=o.split("-");return{min:parseInt(i,10),max:parseInt(r,10)}}const t=parseInt(o,10);return{min:t,max:t}}function Sr(o,e,t=wo){const i=xr(o,t),r=kr(o,e,t),n=Dr(o,e,t),s=e.showTodayButton!==!1?$r(t):"";return`
|
|
1
|
+
(function(K,V){typeof exports=="object"&&typeof module<"u"?V(exports):typeof define=="function"&&define.amd?define(["exports"],V):(K=typeof globalThis<"u"?globalThis:K||self,V(K.WebGrid={}))})(this,function(K){"use strict";var Ln=Object.defineProperty;var An=(K,V,F)=>V in K?Ln(K,V,{enumerable:!0,configurable:!0,writable:!0,value:F}):K[V]=F;var w=(K,V,F)=>An(K,typeof V!="symbol"?V+"":V,F);const V=Math.min,F=Math.max,Ye=Math.round,We=Math.floor,ae=o=>({x:o,y:o}),Wo={left:"right",right:"left",bottom:"top",top:"bottom"},Bo={start:"end",end:"start"};function ot(o,e,t){return F(o,V(e,t))}function De(o,e){return typeof o=="function"?o(e):o}function me(o){return o.split("-")[0]}function Ee(o){return o.split("-")[1]}function qt(o){return o==="x"?"y":"x"}function it(o){return o==="y"?"height":"width"}const Uo=new Set(["top","bottom"]);function ue(o){return Uo.has(me(o))?"y":"x"}function rt(o){return qt(ue(o))}function jo(o,e,t){t===void 0&&(t=!1);const i=Ee(o),r=rt(o),n=it(r);let s=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(s=Be(s)),[s,Be(s)]}function Ko(o){const e=Be(o);return[nt(o),e,nt(e)]}function nt(o){return o.replace(/start|end/g,e=>Bo[e])}const Nt=["left","right"],Yt=["right","left"],Xo=["top","bottom"],Go=["bottom","top"];function Qo(o,e,t){switch(o){case"top":case"bottom":return t?e?Yt:Nt:e?Nt:Yt;case"left":case"right":return e?Xo:Go;default:return[]}}function Jo(o,e,t,i){const r=Ee(o);let n=Qo(me(o),t==="start",i);return r&&(n=n.map(s=>s+"-"+r),e&&(n=n.concat(n.map(nt)))),n}function Be(o){return o.replace(/left|right|bottom|top/g,e=>Wo[e])}function Zo(o){return{top:0,right:0,bottom:0,left:0,...o}}function Wt(o){return typeof o!="number"?Zo(o):{top:o,right:o,bottom:o,left:o}}function Ue(o){const{x:e,y:t,width:i,height:r}=o;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function Bt(o,e,t){let{reference:i,floating:r}=o;const n=ue(e),s=rt(e),a=it(s),l=me(e),d=n==="y",c=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,g=i[a]/2-r[a]/2;let h;switch(l){case"top":h={x:c,y:i.y-r.height};break;case"bottom":h={x:c,y:i.y+i.height};break;case"right":h={x:i.x+i.width,y:u};break;case"left":h={x:i.x-r.width,y:u};break;default:h={x:i.x,y:i.y}}switch(Ee(e)){case"start":h[s]-=g*(t&&d?-1:1);break;case"end":h[s]+=g*(t&&d?-1:1);break}return h}const ei=async(o,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:n=[],platform:s}=t,a=n.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let d=await s.getElementRects({reference:o,floating:e,strategy:r}),{x:c,y:u}=Bt(d,i,l),g=i,h={},f=0;for(let p=0;p<a.length;p++){const{name:v,fn:m}=a[p],{x:y,y:_,data:S,reset:b}=await m({x:c,y:u,initialPlacement:i,placement:g,strategy:r,middlewareData:h,rects:d,platform:s,elements:{reference:o,floating:e}});c=y??c,u=_??u,h={...h,[v]:{...h[v],...S}},b&&f<=50&&(f++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(d=b.rects===!0?await s.getElementRects({reference:o,floating:e,strategy:r}):b.rects),{x:c,y:u}=Bt(d,g,l)),p=-1)}return{x:c,y:u,placement:g,strategy:r,middlewareData:h}};async function st(o,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:n,rects:s,elements:a,strategy:l}=o,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:u="floating",altBoundary:g=!1,padding:h=0}=De(e,o),f=Wt(h),v=a[g?u==="floating"?"reference":"floating":u],m=Ue(await n.getClippingRect({element:(t=await(n.isElement==null?void 0:n.isElement(v)))==null||t?v:v.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(a.floating)),boundary:d,rootBoundary:c,strategy:l})),y=u==="floating"?{x:i,y:r,width:s.floating.width,height:s.floating.height}:s.reference,_=await(n.getOffsetParent==null?void 0:n.getOffsetParent(a.floating)),S=await(n.isElement==null?void 0:n.isElement(_))?await(n.getScale==null?void 0:n.getScale(_))||{x:1,y:1}:{x:1,y:1},b=Ue(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:_,strategy:l}):y);return{top:(m.top-b.top+f.top)/S.y,bottom:(b.bottom-m.bottom+f.bottom)/S.y,left:(m.left-b.left+f.left)/S.x,right:(b.right-m.right+f.right)/S.x}}const ti=o=>({name:"arrow",options:o,async fn(e){const{x:t,y:i,placement:r,rects:n,platform:s,elements:a,middlewareData:l}=e,{element:d,padding:c=0}=De(o,e)||{};if(d==null)return{};const u=Wt(c),g={x:t,y:i},h=rt(r),f=it(h),p=await s.getDimensions(d),v=h==="y",m=v?"top":"left",y=v?"bottom":"right",_=v?"clientHeight":"clientWidth",S=n.reference[f]+n.reference[h]-g[h]-n.floating[f],b=g[h]-n.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let x=C?C[_]:0;(!x||!await(s.isElement==null?void 0:s.isElement(C)))&&(x=a.floating[_]||n.floating[f]);const k=S/2-b/2,T=x/2-p[f]/2-1,$=V(u[m],T),I=V(u[y],T),L=$,q=x-p[f]-I,M=x/2-p[f]/2+k,U=ot(L,M,q),D=!l.arrow&&Ee(r)!=null&&M!==U&&n.reference[f]/2-(M<L?$:I)-p[f]/2<0,A=D?M<L?M-L:M-q:0;return{[h]:g[h]+A,data:{[h]:U,centerOffset:M-U-A,...D&&{alignmentOffset:A}},reset:D}}}),oi=function(o){return o===void 0&&(o={}),{name:"flip",options:o,async fn(e){var t,i;const{placement:r,middlewareData:n,rects:s,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:p=!0,...v}=De(o,e);if((t=n.arrow)!=null&&t.alignmentOffset)return{};const m=me(r),y=ue(a),_=me(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(d.floating)),b=g||(_||!p?[Be(a)]:Ko(a)),C=f!=="none";!g&&C&&b.push(...Jo(a,p,f,S));const x=[a,...b],k=await st(e,v),T=[];let $=((i=n.flip)==null?void 0:i.overflows)||[];if(c&&T.push(k[m]),u){const M=jo(r,s,S);T.push(k[M[0]],k[M[1]])}if($=[...$,{placement:r,overflows:T}],!T.every(M=>M<=0)){var I,L;const M=(((I=n.flip)==null?void 0:I.index)||0)+1,U=x[M];if(U&&(!(u==="alignment"?y!==ue(U):!1)||$.every(N=>ue(N.placement)===y?N.overflows[0]>0:!0)))return{data:{index:M,overflows:$},reset:{placement:U}};let D=(L=$.filter(A=>A.overflows[0]<=0).sort((A,N)=>A.overflows[1]-N.overflows[1])[0])==null?void 0:L.placement;if(!D)switch(h){case"bestFit":{var q;const A=(q=$.filter(N=>{if(C){const O=ue(N.placement);return O===y||O==="y"}return!0}).map(N=>[N.placement,N.overflows.filter(O=>O>0).reduce((O,Ae)=>O+Ae,0)]).sort((N,O)=>N[1]-O[1])[0])==null?void 0:q[0];A&&(D=A);break}case"initialPlacement":D=a;break}if(r!==D)return{reset:{placement:D}}}return{}}}},ii=new Set(["left","top"]);async function ri(o,e){const{placement:t,platform:i,elements:r}=o,n=await(i.isRTL==null?void 0:i.isRTL(r.floating)),s=me(t),a=Ee(t),l=ue(t)==="y",d=ii.has(s)?-1:1,c=n&&l?-1:1,u=De(e,o);let{mainAxis:g,crossAxis:h,alignmentAxis:f}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof f=="number"&&(h=a==="end"?f*-1:f),l?{x:h*c,y:g*d}:{x:g*d,y:h*c}}const ni=function(o){return o===void 0&&(o=0),{name:"offset",options:o,async fn(e){var t,i;const{x:r,y:n,placement:s,middlewareData:a}=e,l=await ri(e,o);return s===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:n+l.y,data:{...l,placement:s}}}}},si=function(o){return o===void 0&&(o={}),{name:"shift",options:o,async fn(e){const{x:t,y:i,placement:r}=e,{mainAxis:n=!0,crossAxis:s=!1,limiter:a={fn:v=>{let{x:m,y}=v;return{x:m,y}}},...l}=De(o,e),d={x:t,y:i},c=await st(e,l),u=ue(me(r)),g=qt(u);let h=d[g],f=d[u];if(n){const v=g==="y"?"top":"left",m=g==="y"?"bottom":"right",y=h+c[v],_=h-c[m];h=ot(y,h,_)}if(s){const v=u==="y"?"top":"left",m=u==="y"?"bottom":"right",y=f+c[v],_=f-c[m];f=ot(y,f,_)}const p=a.fn({...e,[g]:h,[u]:f});return{...p,data:{x:p.x-t,y:p.y-i,enabled:{[g]:n,[u]:s}}}}}},li=function(o){return o===void 0&&(o={}),{name:"size",options:o,async fn(e){var t,i;const{placement:r,rects:n,platform:s,elements:a}=e,{apply:l=()=>{},...d}=De(o,e),c=await st(e,d),u=me(r),g=Ee(r),h=ue(r)==="y",{width:f,height:p}=n.floating;let v,m;u==="top"||u==="bottom"?(v=u,m=g===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(m=u,v=g==="end"?"top":"bottom");const y=p-c.top-c.bottom,_=f-c.left-c.right,S=V(p-c[v],y),b=V(f-c[m],_),C=!e.middlewareData.shift;let x=S,k=b;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(k=_),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(x=y),C&&!g){const $=F(c.left,0),I=F(c.right,0),L=F(c.top,0),q=F(c.bottom,0);h?k=f-2*($!==0||I!==0?$+I:F(c.left,c.right)):x=p-2*(L!==0||q!==0?L+q:F(c.top,c.bottom))}await l({...e,availableWidth:k,availableHeight:x});const T=await s.getDimensions(a.floating);return f!==T.width||p!==T.height?{reset:{rects:!0}}:{}}}};function je(){return typeof window<"u"}function Re(o){return Ut(o)?(o.nodeName||"").toLowerCase():"#document"}function G(o){var e;return(o==null||(e=o.ownerDocument)==null?void 0:e.defaultView)||window}function de(o){var e;return(e=(Ut(o)?o.ownerDocument:o.document)||window.document)==null?void 0:e.documentElement}function Ut(o){return je()?o instanceof Node||o instanceof G(o).Node:!1}function ie(o){return je()?o instanceof Element||o instanceof G(o).Element:!1}function ce(o){return je()?o instanceof HTMLElement||o instanceof G(o).HTMLElement:!1}function jt(o){return!je()||typeof ShadowRoot>"u"?!1:o instanceof ShadowRoot||o instanceof G(o).ShadowRoot}const ai=new Set(["inline","contents"]);function Oe(o){const{overflow:e,overflowX:t,overflowY:i,display:r}=re(o);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!ai.has(r)}const di=new Set(["table","td","th"]);function ci(o){return di.has(Re(o))}const gi=[":popover-open",":modal"];function Ke(o){return gi.some(e=>{try{return o.matches(e)}catch{return!1}})}const ui=["transform","translate","scale","rotate","perspective"],hi=["transform","translate","scale","rotate","perspective","filter"],fi=["paint","layout","strict","content"];function lt(o){const e=at(),t=ie(o)?re(o):o;return ui.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||hi.some(i=>(t.willChange||"").includes(i))||fi.some(i=>(t.contain||"").includes(i))}function wi(o){let e=be(o);for(;ce(e)&&!$e(e);){if(lt(e))return e;if(Ke(e))return null;e=be(e)}return null}function at(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const pi=new Set(["html","body","#document"]);function $e(o){return pi.has(Re(o))}function re(o){return G(o).getComputedStyle(o)}function Xe(o){return ie(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:{scrollLeft:o.scrollX,scrollTop:o.scrollY}}function be(o){if(Re(o)==="html")return o;const e=o.assignedSlot||o.parentNode||jt(o)&&o.host||de(o);return jt(e)?e.host:e}function Kt(o){const e=be(o);return $e(e)?o.ownerDocument?o.ownerDocument.body:o.body:ce(e)&&Oe(e)?e:Kt(e)}function Pe(o,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Kt(o),n=r===((i=o.ownerDocument)==null?void 0:i.body),s=G(r);if(n){const a=dt(s);return e.concat(s,s.visualViewport||[],Oe(r)?r:[],a&&t?Pe(a):[])}return e.concat(r,Pe(r,[],t))}function dt(o){return o.parent&&Object.getPrototypeOf(o.parent)?o.frameElement:null}function Xt(o){const e=re(o);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=ce(o),n=r?o.offsetWidth:t,s=r?o.offsetHeight:i,a=Ye(t)!==n||Ye(i)!==s;return a&&(t=n,i=s),{width:t,height:i,$:a}}function ct(o){return ie(o)?o:o.contextElement}function Me(o){const e=ct(o);if(!ce(e))return ae(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:n}=Xt(e);let s=(n?Ye(t.width):t.width)/i,a=(n?Ye(t.height):t.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const mi=ae(0);function Gt(o){const e=G(o);return!at()||!e.visualViewport?mi:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bi(o,e,t){return e===void 0&&(e=!1),!t||e&&t!==G(o)?!1:e}function ye(o,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=o.getBoundingClientRect(),n=ct(o);let s=ae(1);e&&(i?ie(i)&&(s=Me(i)):s=Me(o));const a=bi(n,t,i)?Gt(n):ae(0);let l=(r.left+a.x)/s.x,d=(r.top+a.y)/s.y,c=r.width/s.x,u=r.height/s.y;if(n){const g=G(n),h=i&&ie(i)?G(i):i;let f=g,p=dt(f);for(;p&&i&&h!==f;){const v=Me(p),m=p.getBoundingClientRect(),y=re(p),_=m.left+(p.clientLeft+parseFloat(y.paddingLeft))*v.x,S=m.top+(p.clientTop+parseFloat(y.paddingTop))*v.y;l*=v.x,d*=v.y,c*=v.x,u*=v.y,l+=_,d+=S,f=G(p),p=dt(f)}}return Ue({width:c,height:u,x:l,y:d})}function Ge(o,e){const t=Xe(o).scrollLeft;return e?e.left+t:ye(de(o)).left+t}function Qt(o,e){const t=o.getBoundingClientRect(),i=t.left+e.scrollLeft-Ge(o,t),r=t.top+e.scrollTop;return{x:i,y:r}}function _i(o){let{elements:e,rect:t,offsetParent:i,strategy:r}=o;const n=r==="fixed",s=de(i),a=e?Ke(e.floating):!1;if(i===s||a&&n)return t;let l={scrollLeft:0,scrollTop:0},d=ae(1);const c=ae(0),u=ce(i);if((u||!u&&!n)&&((Re(i)!=="body"||Oe(s))&&(l=Xe(i)),ce(i))){const h=ye(i);d=Me(i),c.x=h.x+i.clientLeft,c.y=h.y+i.clientTop}const g=s&&!u&&!n?Qt(s,l):ae(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+c.x+g.x,y:t.y*d.y-l.scrollTop*d.y+c.y+g.y}}function vi(o){return Array.from(o.getClientRects())}function yi(o){const e=de(o),t=Xe(o),i=o.ownerDocument.body,r=F(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),n=F(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let s=-t.scrollLeft+Ge(o);const a=-t.scrollTop;return re(i).direction==="rtl"&&(s+=F(e.clientWidth,i.clientWidth)-r),{width:r,height:n,x:s,y:a}}const Jt=25;function Ci(o,e){const t=G(o),i=de(o),r=t.visualViewport;let n=i.clientWidth,s=i.clientHeight,a=0,l=0;if(r){n=r.width,s=r.height;const c=at();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}const d=Ge(i);if(d<=0){const c=i.ownerDocument,u=c.body,g=getComputedStyle(u),h=c.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,f=Math.abs(i.clientWidth-u.clientWidth-h);f<=Jt&&(n-=f)}else d<=Jt&&(n+=d);return{width:n,height:s,x:a,y:l}}const Si=new Set(["absolute","fixed"]);function xi(o,e){const t=ye(o,!0,e==="fixed"),i=t.top+o.clientTop,r=t.left+o.clientLeft,n=ce(o)?Me(o):ae(1),s=o.clientWidth*n.x,a=o.clientHeight*n.y,l=r*n.x,d=i*n.y;return{width:s,height:a,x:l,y:d}}function Zt(o,e,t){let i;if(e==="viewport")i=Ci(o,t);else if(e==="document")i=yi(de(o));else if(ie(e))i=xi(e,t);else{const r=Gt(o);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return Ue(i)}function eo(o,e){const t=be(o);return t===e||!ie(t)||$e(t)?!1:re(t).position==="fixed"||eo(t,e)}function ki(o,e){const t=e.get(o);if(t)return t;let i=Pe(o,[],!1).filter(a=>ie(a)&&Re(a)!=="body"),r=null;const n=re(o).position==="fixed";let s=n?be(o):o;for(;ie(s)&&!$e(s);){const a=re(s),l=lt(s);!l&&a.position==="fixed"&&(r=null),(n?!l&&!r:!l&&a.position==="static"&&!!r&&Si.has(r.position)||Oe(s)&&!l&&eo(o,s))?i=i.filter(c=>c!==s):r=a,s=be(s)}return e.set(o,i),i}function Di(o){let{element:e,boundary:t,rootBoundary:i,strategy:r}=o;const s=[...t==="clippingAncestors"?Ke(e)?[]:ki(e,this._c):[].concat(t),i],a=s[0],l=s.reduce((d,c)=>{const u=Zt(e,c,r);return d.top=F(u.top,d.top),d.right=V(u.right,d.right),d.bottom=V(u.bottom,d.bottom),d.left=F(u.left,d.left),d},Zt(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ei(o){const{width:e,height:t}=Xt(o);return{width:e,height:t}}function Ri(o,e,t){const i=ce(e),r=de(e),n=t==="fixed",s=ye(o,!0,n,e);let a={scrollLeft:0,scrollTop:0};const l=ae(0);function d(){l.x=Ge(r)}if(i||!i&&!n)if((Re(e)!=="body"||Oe(r))&&(a=Xe(e)),i){const h=ye(e,!0,n,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else r&&d();n&&!i&&r&&d();const c=r&&!i&&!n?Qt(r,a):ae(0),u=s.left+a.scrollLeft-l.x-c.x,g=s.top+a.scrollTop-l.y-c.y;return{x:u,y:g,width:s.width,height:s.height}}function gt(o){return re(o).position==="static"}function to(o,e){if(!ce(o)||re(o).position==="fixed")return null;if(e)return e(o);let t=o.offsetParent;return de(o)===t&&(t=t.ownerDocument.body),t}function oo(o,e){const t=G(o);if(Ke(o))return t;if(!ce(o)){let r=be(o);for(;r&&!$e(r);){if(ie(r)&&!gt(r))return r;r=be(r)}return t}let i=to(o,e);for(;i&&ci(i)&>(i);)i=to(i,e);return i&&$e(i)&>(i)&&!lt(i)?t:i||wi(o)||t}const $i=async function(o){const e=this.getOffsetParent||oo,t=this.getDimensions,i=await t(o.floating);return{reference:Ri(o.reference,await e(o.floating),o.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Mi(o){return re(o).direction==="rtl"}const Ti={convertOffsetParentRelativeRectToViewportRelativeRect:_i,getDocumentElement:de,getClippingRect:Di,getOffsetParent:oo,getElementRects:$i,getClientRects:vi,getDimensions:Ei,getScale:Me,isElement:ie,isRTL:Mi};function io(o,e){return o.x===e.x&&o.y===e.y&&o.width===e.width&&o.height===e.height}function Ii(o,e){let t=null,i;const r=de(o);function n(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),n();const d=o.getBoundingClientRect(),{left:c,top:u,width:g,height:h}=d;if(a||e(),!g||!h)return;const f=We(u),p=We(r.clientWidth-(c+g)),v=We(r.clientHeight-(u+h)),m=We(c),_={rootMargin:-f+"px "+-p+"px "+-v+"px "+-m+"px",threshold:F(0,V(1,l))||1};let S=!0;function b(C){const x=C[0].intersectionRatio;if(x!==l){if(!S)return s();x?s(!1,x):i=setTimeout(()=>{s(!1,1e-7)},1e3)}x===1&&!io(d,o.getBoundingClientRect())&&s(),S=!1}try{t=new IntersectionObserver(b,{..._,root:r.ownerDocument})}catch{t=new IntersectionObserver(b,_)}t.observe(o)}return s(!0),n}function zi(o,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:n=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,d=ct(o),c=r||n?[...d?Pe(d):[],...Pe(e)]:[];c.forEach(m=>{r&&m.addEventListener("scroll",t,{passive:!0}),n&&m.addEventListener("resize",t)});const u=d&&a?Ii(d,t):null;let g=-1,h=null;s&&(h=new ResizeObserver(m=>{let[y]=m;y&&y.target===d&&h&&(h.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(e)})),t()}),d&&!l&&h.observe(d),h.observe(e));let f,p=l?ye(o):null;l&&v();function v(){const m=ye(o);p&&!io(p,m)&&t(),p=m,f=requestAnimationFrame(v)}return t(),()=>{var m;c.forEach(y=>{r&&y.removeEventListener("scroll",t),n&&y.removeEventListener("resize",t)}),u==null||u(),(m=h)==null||m.disconnect(),h=null,l&&cancelAnimationFrame(f)}}const ut=ni,Qe=si,Te=oi,Li=li,Ai=ti,Ie=(o,e,t)=>{const i=new Map,r={platform:Ti,...t},n={...r.platform,_c:i};return ei(o,e,{...r,platform:n})},ro={today:"Today",clear:"Clear",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdayNamesShort:["Su","Mo","Tu","We","Th","Fr","Sa"]};function Je(o){const e={};let t="";return o.includes("-")?t="-":o.includes("/")?t="/":o.includes(".")&&(t="."),o.split(t).forEach((r,n)=>{r==="YYYY"||r==="YY"?e.year={index:n,length:r.length}:r==="MM"||r==="M"?e.month={index:n,length:2}:(r==="DD"||r==="D")&&(e.day={index:n,length:2})}),{format:o,separator:t,parts:e,maxLength:o.length}}function ht(o,e){if(!o||isNaN(o.getTime()))return"";const t=o.getFullYear(),i=String(o.getMonth()+1).padStart(2,"0"),r=String(o.getDate()).padStart(2,"0"),{separator:n,parts:s}=e,a=[];for(let l=0;l<3;l++)s.year&&s.year.index===l?a.push(s.year.length===2?String(t).slice(-2):t):s.month&&s.month.index===l?a.push(i):s.day&&s.day.index===l&&a.push(r);return a.join(n)}function Oi(o,e){if(!o)return null;const{separator:t,parts:i}=e,r=o.split(t);let n=null,s=null,a=null;if(r.forEach((d,c)=>{if(d){if(i.year&&i.year.index===c){const u=parseInt(d,10);i.year.length===4&&d.length===4?n=u:i.year.length===2&&d.length===2&&(n=u<100?u+2e3:u)}else if(i.month&&i.month.index===c){const u=parseInt(d,10);d.length===2&&u>=1&&u<=12&&(s=u)}else if(i.day&&i.day.index===c){const u=parseInt(d,10);d.length===2&&u>=1&&u<=31&&(a=u)}}}),n===null||s===null||a===null)return null;const l=new Date(n,s-1,a);return l.getMonth()!==s-1||l.getDate()!==a?null:l}function Q(o){if(!o)return null;let e;if(typeof o=="string"){const[t,i,r]=o.split("-").map(Number);!t||!i||!r?e=new Date(o):e=new Date(t,i-1,r)}else e=new Date(o);return e.setHours(0,0,0,0),isNaN(e.getTime())?null:e}function ft(o){const e=o.getFullYear(),t=String(o.getMonth()+1).padStart(2,"0"),i=String(o.getDate()).padStart(2,"0");return`${e}-${t}-${i}`}function He(o,e){return!o||!e?!1:o.getFullYear()===e.getFullYear()&&o.getMonth()===e.getMonth()&&o.getDate()===e.getDate()}function Pi(o){return He(o,new Date)}function ze(o,e){return new Date(o,e+1,0).getDate()}function Hi(o,e){return new Date(o,e,1).getDay()}function Vi(o,e){if(!o)return{min:e-10,max:e+10};if(o.includes("-")){const[i,r]=o.split("-");return{min:parseInt(i,10),max:parseInt(r,10)}}const t=parseInt(o,10);return{min:t,max:t}}function Fi(o,e,t=ro){const i=qi(o,t),r=Ni(o,e,t),n=Yi(o,e,t),s=e.showTodayButton!==!1?Ui(t):"";return`
|
|
214
2
|
<div class="wg-datepicker">
|
|
215
3
|
<div class="wg-datepicker__header">
|
|
216
4
|
${i}
|
|
@@ -223,7 +11,7 @@
|
|
|
223
11
|
</div>
|
|
224
12
|
${s}
|
|
225
13
|
</div>
|
|
226
|
-
`}function
|
|
14
|
+
`}function qi(o,e){return`
|
|
227
15
|
<button type="button" class="wg-datepicker__nav wg-datepicker__nav--prev" data-action="prev-month">
|
|
228
16
|
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>
|
|
229
17
|
</button>
|
|
@@ -233,7 +21,7 @@
|
|
|
233
21
|
<button type="button" class="wg-datepicker__nav wg-datepicker__nav--next" data-action="next-month">
|
|
234
22
|
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"/></svg>
|
|
235
23
|
</button>
|
|
236
|
-
`}function
|
|
24
|
+
`}function Ni(o,e,t){const i=Vi(e.rollingYearRange,new Date().getFullYear());let r="";for(let s=i.min;s<=i.max;s++){const a=s===o.viewYear?" wg-datepicker__rolling-item--selected":"";r+=`<div class="wg-datepicker__rolling-item${a}" data-year="${s}">${s}</div>`}let n="";for(let s=0;s<12;s++){const a=s===o.viewMonth?" wg-datepicker__rolling-item--selected":"";n+=`<div class="wg-datepicker__rolling-item${a}" data-month="${s}">${t.monthNamesShort[s]}</div>`}return`
|
|
237
25
|
<div class="wg-datepicker__rolling-lists">
|
|
238
26
|
<div class="wg-datepicker__rolling-list" data-list="months">
|
|
239
27
|
${n}
|
|
@@ -242,20 +30,20 @@
|
|
|
242
30
|
${r}
|
|
243
31
|
</div>
|
|
244
32
|
</div>
|
|
245
|
-
`}function
|
|
33
|
+
`}function Yi(o,e,t){const i=Wi(t),r=no(o,e);return`
|
|
246
34
|
<div class="wg-datepicker__weekdays">
|
|
247
35
|
${i}
|
|
248
36
|
</div>
|
|
249
37
|
<div class="wg-datepicker__days">
|
|
250
38
|
${r}
|
|
251
39
|
</div>
|
|
252
|
-
`}function
|
|
40
|
+
`}function Wi(o){return o.weekdayNamesShort.map(e=>`<div class="wg-datepicker__weekday">${e}</div>`).join("")}function no(o,e){const{viewYear:t,viewMonth:i,selectedDate:r,focusedDate:n}=o,s=e.minDate?Q(e.minDate):null,a=e.maxDate?Q(e.maxDate):null,l=Hi(t,i),d=ze(t,i),c=ze(t,i-1),u=new Date(t,i-1,1),g=u.getFullYear(),h=u.getMonth(),f=new Date(t,i+1,1),p=f.getFullYear(),v=f.getMonth(),m=[];for(let b=l-1;b>=0;b--){const C=c-b;m.push({date:new Date(g,h,C),day:C,isOtherMonth:!0})}for(let b=1;b<=d;b++)m.push({date:new Date(t,i,b),day:b,isOtherMonth:!1});const _=Math.ceil((l+d)/7)*7-m.length;for(let b=1;b<=_;b++)m.push({date:new Date(p,v,b),day:b,isOtherMonth:!0});let S="";for(const b of m){const C=["wg-datepicker__day"];b.isOtherMonth&&C.push("wg-datepicker__day--other-month"),Bi(b.date,s,a)&&C.push("wg-datepicker__day--disabled"),Pi(b.date)&&C.push("wg-datepicker__day--today"),He(b.date,r)&&C.push("wg-datepicker__day--selected"),He(b.date,n)&&C.push("wg-datepicker__day--focused");const k=ft(b.date);S+=`<div class="${C.join(" ")}" data-date="${k}">${b.day}</div>`}return S}function Bi(o,e,t){return!!(e&&o<e||t&&o>t)}function Ui(o){return`
|
|
253
41
|
<div class="wg-datepicker__footer">
|
|
254
42
|
<button type="button" class="wg-datepicker__today-btn" data-action="today">
|
|
255
43
|
${o.today}
|
|
256
44
|
</button>
|
|
257
45
|
</div>
|
|
258
|
-
`}function
|
|
46
|
+
`}function ji(o,e,t){const i=o.querySelector(".wg-datepicker__days");i&&(i.innerHTML=no(e,t))}function Ki(o,e,t){const i=o.querySelector(".wg-datepicker__month-year");if(i){const r=t.monthNames[e.viewMonth];i.textContent=`${r} ${e.viewYear}`}}function Xi(o,e){const t=o.querySelector(".wg-datepicker__rolling-selector"),i=o.querySelector(".wg-datepicker__calendar");t&&t.classList.toggle("wg-datepicker__rolling-selector--visible",e),i&&i.classList.toggle("wg-datepicker__calendar--hidden",e)}function Gi(o,e){o.querySelectorAll("[data-year]").forEach(r=>{const n=parseInt(r.dataset.year||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",n===e.viewYear)}),o.querySelectorAll("[data-month]").forEach(r=>{const n=parseInt(r.dataset.month||"0",10);r.classList.toggle("wg-datepicker__rolling-item--selected",n===e.viewMonth)})}function so(o){const e=o.querySelector("[data-year].wg-datepicker__rolling-item--selected"),t=o.querySelector("[data-month].wg-datepicker__rolling-item--selected");if(e){const i=e.parentElement;if(i){const r=e.offsetTop-i.clientHeight/2+e.clientHeight/2;i.scrollTop=r}}if(t){const i=t.parentElement;if(i){const r=t.offsetTop-i.clientHeight/2+t.clientHeight/2;i.scrollTop=r}}}function wt(o){o.viewMonth===0?(o.viewMonth=11,o.viewYear--):o.viewMonth--}function pt(o){o.viewMonth===11?(o.viewMonth=0,o.viewYear++):o.viewMonth++}function Qi(o,e,t,i){var n,s,a,l;const{key:r}=o;if(r==="Escape")return(n=i.onClose)==null||n.call(i),!0;if(e.rollingSelectorOpen)return Zi(o,e);if((r==="ArrowLeft"||r==="ArrowRight")&&(o.ctrlKey||o.metaKey)){if(o.preventDefault(),r==="ArrowLeft"?wt(e):pt(e),e.focusedDate){const d=Math.min(e.focusedDate.getDate(),ze(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,d)}return!0}if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(r))return o.preventDefault(),Ji(e,r,t),!0;if(r==="Enter")return o.preventDefault(),o.stopPropagation(),e.focusedDate&&((s=i.onSelect)==null||s.call(i,e.focusedDate,"down")),!0;if(r==="Tab")return e.focusedDate?(a=i.onSelect)==null||a.call(i,e.focusedDate,"next"):(l=i.onClose)==null||l.call(i),!1;if(r==="Home"){if(o.preventDefault(),o.ctrlKey||o.metaKey){let d=e.viewYear;const c=new Date(d,0,1);if(e.focusedDate&&He(e.focusedDate,c)&&d--,t.minDate){const u=Q(t.minDate);u&&d<u.getFullYear()&&(d=u.getFullYear())}e.viewMonth=0,e.viewYear=d,e.focusedDate=new Date(d,0,1)}else e.focusedDate=new Date(e.viewYear,e.viewMonth,1);return!0}if(r==="End"){if(o.preventDefault(),o.ctrlKey||o.metaKey){let d=e.viewYear;const c=new Date(d,11,31);if(e.focusedDate&&He(e.focusedDate,c)&&d++,t.maxDate){const u=Q(t.maxDate);u&&d>u.getFullYear()&&(d=u.getFullYear())}e.viewMonth=11,e.viewYear=d,e.focusedDate=new Date(d,11,31)}else{const d=ze(e.viewYear,e.viewMonth);e.focusedDate=new Date(e.viewYear,e.viewMonth,d)}return!0}if(r==="PageUp"){if(o.preventDefault(),wt(e),e.focusedDate){const d=Math.min(e.focusedDate.getDate(),ze(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,d)}return!0}if(r==="PageDown"){if(o.preventDefault(),pt(e),e.focusedDate){const d=Math.min(e.focusedDate.getDate(),ze(e.viewYear,e.viewMonth));e.focusedDate=new Date(e.viewYear,e.viewMonth,d)}return!0}return!1}function Ji(o,e,t){if(!o.focusedDate){o.focusedDate=o.selectedDate?new Date(o.selectedDate):new Date(o.viewYear,o.viewMonth,1);return}const i=new Date(o.focusedDate),r=t.minDate?Q(t.minDate):null,n=t.maxDate?Q(t.maxDate):null;switch(e){case"ArrowLeft":i.setDate(i.getDate()-1);break;case"ArrowRight":i.setDate(i.getDate()+1);break;case"ArrowUp":i.setDate(i.getDate()-7);break;case"ArrowDown":i.setDate(i.getDate()+7);break}r&&i<r||n&&i>n||(o.focusedDate=i,(i.getMonth()!==o.viewMonth||i.getFullYear()!==o.viewYear)&&(o.viewMonth=i.getMonth(),o.viewYear=i.getFullYear()))}function Zi(o,e){const{key:t}=o;if(t==="ArrowUp"||t==="ArrowDown"){o.preventDefault();const i=t==="ArrowUp"?-1:1;if(e.rollingSelectorMode==="month"){const r=e.viewMonth+i;r>=0&&r<=11&&(e.viewMonth=r)}else e.viewYear+=i;return!0}return t==="ArrowLeft"||t==="ArrowRight"?(o.preventDefault(),e.rollingSelectorMode=e.rollingSelectorMode==="month"?"year":"month",!0):t==="Enter"||t==="Escape"?(o.preventDefault(),e.rollingSelectorOpen=!1,!0):!1}function er(o){if(o.selectedDate)o.focusedDate=new Date(o.selectedDate),o.viewYear=o.selectedDate.getFullYear(),o.viewMonth=o.selectedDate.getMonth();else{const e=new Date;o.focusedDate=new Date(o.viewYear,o.viewMonth,e.getDate())}}function tr(o,e,t){const i=o.dataset.date;if(!i||o.classList.contains("wg-datepicker__day--disabled"))return null;const[r,n,s]=i.split("-").map(Number),a=new Date(r,n-1,s),l=t.minDate?Q(t.minDate):null,d=t.maxDate?Q(t.maxDate):null;return l&&a<l||d&&a>d?null:(e.selectedDate=a,e.focusedDate=a,a)}function or(o,e){const t=new Date;t.setHours(0,0,0,0);const i=e.minDate?Q(e.minDate):null,r=e.maxDate?Q(e.maxDate):null;return i&&t<i||r&&t>r?null:(o.selectedDate=t,o.focusedDate=t,o.viewYear=t.getFullYear(),o.viewMonth=t.getMonth(),t)}function ir(o,e){const t=o.dataset.month;t!==void 0&&(e.viewMonth=parseInt(t,10))}function rr(o,e){const t=o.dataset.year;t!==void 0&&(e.viewYear=parseInt(t,10))}function mt(o,e){var u,g,h,f;const{separator:t,parts:i,maxLength:r}=e,n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=o.replace(new RegExp(n,"g"),""),a=((u=i.year)==null?void 0:u.length)??4,l=[{type:"year",pos:((g=i.year)==null?void 0:g.index)??0,length:a},{type:"month",pos:((h=i.month)==null?void 0:h.index)??1,length:2},{type:"day",pos:((f=i.day)==null?void 0:f.index)??2,length:2}].sort((p,v)=>p.pos-v.pos);let d="",c=0;for(let p=0;p<l.length;p++){const v=l[p],m=s.substring(c,c+v.length);if(!m)break;d+=m,c+=m.length,p<l.length-1&&m.length===v.length&&(d+=t)}return d.substring(0,r)}function nr(o,e,t){const i=o.value,r=o.selectionStart||0,n=i.length<t.length,{separator:s}=e,a=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=i.replace(new RegExp(`[^0-9${a}]`,"g"),""),d=mt(l,e);if(d!==i){o.value=d;let c=r;if(n)c=r;else if(d.length>i.length&&d[r]===s)c=r+1;else if(d.length>i.length){const u=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),g=(i.substring(0,r).match(new RegExp(u,"g"))||[]).length,f=(d.substring(0,r).match(new RegExp(u,"g"))||[]).length-g;c=r+f}o.setSelectionRange(c,c)}return d}function sr(o,e){const{key:t,ctrlKey:i,metaKey:r}=o,{separator:n}=e;if(["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t)||i||r)return!1;if(t===n){const a=o.target,l=a.selectionStart||0,d=a.value;let c=0;for(let g=l-1;g>=0;g--)if(d[g]===n){c=g+1;break}const u=d.substring(c,l);if(/^\d$/.test(u)){o.preventDefault();const g=d.substring(0,c)+"0"+u+n+d.substring(l);a.value=g;const h=c+2+n.length;return a.setSelectionRange(h,h),!0}}return!/^\d$/.test(t)&&t!==n?(o.preventDefault(),!0):!1}function lr(o,e,t){var h;o.preventDefault();const i=((h=o.clipboardData)==null?void 0:h.getData("text"))||"",{separator:r}=t,n=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=i.replace(new RegExp(`[^0-9${n}]`,"g"),""),a=mt(s,t),l=e.selectionStart||0,d=e.selectionEnd||0,c=e.value,u=c.substring(0,l)+a+c.substring(d);e.value=mt(u,t);const g=l+a.length;e.setSelectionRange(g,g)}function ar(o,e,t,i){if(!o||o.length<e.maxLength)return!1;const r=Oi(o,e);if(!r)return!1;const n=i.minDate?Q(i.minDate):null,s=i.maxDate?Q(i.maxDate):null;return n&&r<n||s&&r>s?!1:(t.selectedDate=r,t.focusedDate=r,t.viewYear=r.getFullYear(),t.viewMonth=r.getMonth(),!0)}const dr=`
|
|
259
47
|
.wg-datepicker-container {
|
|
260
48
|
position: fixed;
|
|
261
49
|
z-index: var(--wg-dp-z-index, 9999);
|
|
@@ -505,7 +293,223 @@
|
|
|
505
293
|
.wg-datepicker__today-btn:hover {
|
|
506
294
|
background-color: color-mix(in srgb, var(--wg-dp-accent-color) 10%, transparent);
|
|
507
295
|
}
|
|
508
|
-
`;let _o=!1;class It{constructor(e={}){w(this,"options");w(this,"state");w(this,"localeStrings");w(this,"formatInfo");w(this,"element",null);w(this,"anchor",null);w(this,"input",null);w(this,"cleanupAutoUpdate",null);w(this,"previousInputValue","");w(this,"boundHandleClickOutside");w(this,"boundHandleKeyDown");this.options={dateFormat:"YYYY-MM-DD",showTodayButton:!0,...e};const t=new Date;this.state={viewMonth:t.getMonth(),viewYear:t.getFullYear(),selectedDate:null,isOpen:!1,rollingSelectorOpen:!1,rollingSelectorMode:"month",focusedDate:null},this.localeStrings=this.initLocaleStrings(e.locale),this.formatInfo=Rt(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}initLocaleStrings(e){const t=e||navigator.language||"en";try{const i=new Intl.DateTimeFormat(t,{month:"long"}),r=new Intl.DateTimeFormat(t,{month:"short"}),n=new Intl.DateTimeFormat(t,{weekday:"long"}),s=new Intl.DateTimeFormat(t,{weekday:"short"}),a=[],l=[];for(let u=0;u<12;u++){const c=new Date(2024,u,1);a.push(i.format(c)),l.push(r.format(c))}const d=[],g=[];for(let u=0;u<7;u++){const c=new Date(2024,0,7+u);d.push(n.format(c));const h=s.format(c);g.push(h.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:a,monthNamesShort:l,weekdayNames:d,weekdayNamesShort:g}}catch{return wo}}static injectStyles(){if(_o)return;const e=document.createElement("style");e.id="wg-datepicker-styles",e.textContent=Ur,document.head.appendChild(e),_o=!0}open(e,t=null){It.injectStyles(),this.state.isOpen&&this.close(),this.anchor=e;const i=Q(t);if(i)this.state.selectedDate=i,this.state.viewYear=i.getFullYear(),this.state.viewMonth=i.getMonth();else{const r=new Date;this.state.viewYear=r.getFullYear(),this.state.viewMonth=r.getMonth()}Hr(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=Sr(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&bo(this.element)}close(e=!1){var t,i;this.state.isOpen&&(this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),document.removeEventListener("mousedown",this.boundHandleClickOutside),document.removeEventListener("keydown",this.boundHandleKeyDown),this.element&&(this.element.remove(),this.element=null),this.state.isOpen=!1,this.state.rollingSelectorOpen=!1,e||(i=(t=this.options).onClose)==null||i.call(t))}destroy(){this.close(),this.anchor=null,this.input=null}getSelectedDate(){return this.state.selectedDate}getFormattedValue(){return po(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const e=this.element.querySelector(".wg-datepicker");e&&(this.cleanupAutoUpdate=Ai(this.anchor,e,()=>{if(!this.anchor.isConnected){this.close(!0);return}Le(this.anchor,e,{placement:"bottom-start",middleware:[ft(4),Ie({fallbackPlacements:["top-start","bottom-end","top-end"]}),Ze({padding:8})]}).then(({x:t,y:i})=>{Object.assign(e.style,{left:`${t}px`,top:`${i}px`})})}))}attachListeners(){this.element&&(this.element.addEventListener("click",e=>this.handleClick(e)),setTimeout(()=>{document.addEventListener("mousedown",this.boundHandleClickOutside)},0),document.addEventListener("keydown",this.boundHandleKeyDown))}handleClick(e){var a;const t=e.target,i=(a=t.closest("[data-action]"))==null?void 0:a.getAttribute("data-action");if(i==="prev-month"){e.preventDefault(),Mt(this.state),this.render();return}if(i==="next-month"){e.preventDefault(),Tt(this.state),this.render();return}if(i==="toggle-rolling"){e.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&bo(this.element);return}if(i==="today"){e.preventDefault();const l=Fr(this.state,this.options);l&&this.selectDate(l);return}const r=t.closest(".wg-datepicker__day");if(r){e.preventDefault();const l=Pr(r,this.state,this.options);l&&this.selectDate(l);return}const n=t.closest("[data-month]");if(n&&this.state.rollingSelectorOpen){e.preventDefault(),qr(n,this.state),this.render();return}const s=t.closest("[data-year]");if(s&&this.state.rollingSelectorOpen){e.preventDefault(),Vr(s,this.state),this.render();return}}handleClickOutside(e){if(!this.element||!this.anchor)return;const t=e.target;!this.element.contains(t)&&!this.anchor.contains(t)&&this.close()}handleKeyDown(e){Lr(e,this.state,this.options,{onSelect:(i,r)=>this.selectDate(i,r),onClose:()=>this.close()})&&this.render()}selectDate(e,t){var i,r;this.state.selectedDate=e,(r=(i=this.options).onSelect)==null||r.call(i,e,t),this.close(!0)}render(){if(!this.element)return;const e=this.element.querySelector(".wg-datepicker");e&&(Tr(e,this.state,this.localeStrings),zr(e,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?Ir(e,this.state):Mr(e,this.state,this.options))}connectInput(e){this.input=e,this.previousInputValue=e.value,e.addEventListener("input",()=>{this.previousInputValue=Nr(e,this.formatInfo,this.previousInputValue),Br(e.value,this.formatInfo,this.state,this.options)}),e.addEventListener("keydown",t=>{Yr(t,this.formatInfo)}),e.addEventListener("paste",t=>{Wr(t,e,this.formatInfo)}),e.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,e.value)})}}const jr=`
|
|
296
|
+
`;let lo=!1;class bt{constructor(e={}){w(this,"options");w(this,"state");w(this,"localeStrings");w(this,"formatInfo");w(this,"element",null);w(this,"anchor",null);w(this,"input",null);w(this,"cleanupAutoUpdate",null);w(this,"previousInputValue","");w(this,"boundHandleClickOutside");w(this,"boundHandleKeyDown");this.options={dateFormat:"YYYY-MM-DD",showTodayButton:!0,...e};const t=new Date;this.state={viewMonth:t.getMonth(),viewYear:t.getFullYear(),selectedDate:null,isOpen:!1,rollingSelectorOpen:!1,rollingSelectorMode:"month",focusedDate:null},this.localeStrings=this.initLocaleStrings(e.locale),this.formatInfo=Je(this.options.dateFormat||"YYYY-MM-DD"),this.boundHandleClickOutside=this.handleClickOutside.bind(this),this.boundHandleKeyDown=this.handleKeyDown.bind(this)}initLocaleStrings(e){const t=e||navigator.language||"en";try{const i=new Intl.DateTimeFormat(t,{month:"long"}),r=new Intl.DateTimeFormat(t,{month:"short"}),n=new Intl.DateTimeFormat(t,{weekday:"long"}),s=new Intl.DateTimeFormat(t,{weekday:"short"}),a=[],l=[];for(let u=0;u<12;u++){const g=new Date(2024,u,1);a.push(i.format(g)),l.push(r.format(g))}const d=[],c=[];for(let u=0;u<7;u++){const g=new Date(2024,0,7+u);d.push(n.format(g));const h=s.format(g);c.push(h.substring(0,2))}return{today:"Today",clear:"Clear",monthNames:a,monthNamesShort:l,weekdayNames:d,weekdayNamesShort:c}}catch{return ro}}static injectStyles(){if(lo)return;const e=document.createElement("style");e.id="wg-datepicker-styles",e.textContent=dr,document.head.appendChild(e),lo=!0}open(e,t=null){bt.injectStyles(),this.state.isOpen&&this.close(),this.anchor=e;const i=Q(t);if(i)this.state.selectedDate=i,this.state.viewYear=i.getFullYear(),this.state.viewMonth=i.getMonth();else{const r=new Date;this.state.viewYear=r.getFullYear(),this.state.viewMonth=r.getMonth()}er(this.state),this.element=document.createElement("div"),this.element.className="wg-datepicker-container",this.element.innerHTML=Fi(this.state,this.options,this.localeStrings),document.body.appendChild(this.element),this.position(),this.attachListeners(),this.state.isOpen=!0,this.state.rollingSelectorOpen&&so(this.element)}close(e=!1){var t,i;this.state.isOpen&&(this.cleanupAutoUpdate&&(this.cleanupAutoUpdate(),this.cleanupAutoUpdate=null),document.removeEventListener("mousedown",this.boundHandleClickOutside),document.removeEventListener("keydown",this.boundHandleKeyDown),this.element&&(this.element.remove(),this.element=null),this.state.isOpen=!1,this.state.rollingSelectorOpen=!1,e||(i=(t=this.options).onClose)==null||i.call(t))}destroy(){this.close(),this.anchor=null,this.input=null}getSelectedDate(){return this.state.selectedDate}getFormattedValue(){return ht(this.state.selectedDate,this.formatInfo)}position(){if(!this.element||!this.anchor)return;const e=this.element.querySelector(".wg-datepicker");e&&(this.cleanupAutoUpdate=zi(this.anchor,e,()=>{if(!this.anchor.isConnected){this.close(!0);return}Ie(this.anchor,e,{placement:"bottom-start",middleware:[ut(4),Te({fallbackPlacements:["top-start","bottom-end","top-end"]}),Qe({padding:8})]}).then(({x:t,y:i})=>{Object.assign(e.style,{left:`${t}px`,top:`${i}px`})})}))}attachListeners(){this.element&&(this.element.addEventListener("click",e=>this.handleClick(e)),setTimeout(()=>{document.addEventListener("mousedown",this.boundHandleClickOutside)},0),document.addEventListener("keydown",this.boundHandleKeyDown))}handleClick(e){var a;const t=e.target,i=(a=t.closest("[data-action]"))==null?void 0:a.getAttribute("data-action");if(i==="prev-month"){e.preventDefault(),wt(this.state),this.render();return}if(i==="next-month"){e.preventDefault(),pt(this.state),this.render();return}if(i==="toggle-rolling"){e.preventDefault(),this.state.rollingSelectorOpen=!this.state.rollingSelectorOpen,this.render(),this.state.rollingSelectorOpen&&this.element&&so(this.element);return}if(i==="today"){e.preventDefault();const l=or(this.state,this.options);l&&this.selectDate(l);return}const r=t.closest(".wg-datepicker__day");if(r){e.preventDefault();const l=tr(r,this.state,this.options);l&&this.selectDate(l);return}const n=t.closest("[data-month]");if(n&&this.state.rollingSelectorOpen){e.preventDefault(),ir(n,this.state),this.render();return}const s=t.closest("[data-year]");if(s&&this.state.rollingSelectorOpen){e.preventDefault(),rr(s,this.state),this.render();return}}handleClickOutside(e){if(!this.element||!this.anchor)return;const t=e.target;!this.element.contains(t)&&!this.anchor.contains(t)&&this.close()}handleKeyDown(e){Qi(e,this.state,this.options,{onSelect:(i,r)=>this.selectDate(i,r),onClose:()=>this.close()})&&this.render()}selectDate(e,t){var i,r;this.state.selectedDate=e,(r=(i=this.options).onSelect)==null||r.call(i,e,t),this.close(!0)}render(){if(!this.element)return;const e=this.element.querySelector(".wg-datepicker");e&&(Ki(e,this.state,this.localeStrings),Xi(e,this.state.rollingSelectorOpen),this.state.rollingSelectorOpen?Gi(e,this.state):ji(e,this.state,this.options))}connectInput(e){this.input=e,this.previousInputValue=e.value,e.addEventListener("input",()=>{this.previousInputValue=nr(e,this.formatInfo,this.previousInputValue),ar(e.value,this.formatInfo,this.state,this.options)}),e.addEventListener("keydown",t=>{sr(t,this.formatInfo)}),e.addEventListener("paste",t=>{lr(t,e,this.formatInfo)}),e.addEventListener("focus",()=>{!this.state.isOpen&&this.anchor&&this.open(this.anchor,e.value)})}}const ao={rowActions:"Row actions",inlineActionsHeader:"Actions",keyboardShortcuts:"Keyboard shortcuts",paginationFirst:"⏮",paginationPrevious:"◀",paginationNext:"▶",paginationLast:"⏭",paginationPageInfo:"Page {current} of {total}",paginationItemCount:"{count} items",paginationPerPage:"per page",dropdownNoOptions:"No options",dropdownSearching:"Searching...",contextMenu:{sortAsc:"Sort Ascending",sortDesc:"Sort Descending",clearSort:"Clear Sort",hideColumn:"Hide Column",freezeColumn:"Freeze Column",unfreezeColumn:"Unfreeze Column",columnVisibility:"Column Visibility",showAll:"Show all"}};class co{constructor(){w(this,"_items",[]);w(this,"_columns",[]);w(this,"_sortMode","none");w(this,"_isFilterable",!1);w(this,"_isPageable",!1);w(this,"_pageSize",10);w(this,"_pageSizes",[10,25,50,100]);w(this,"_isStriped",!0);w(this,"_isHoverable",!0);w(this,"_isEditable",!1);w(this,"_editTrigger","dblclick");w(this,"_editStartSelection","mousePosition");w(this,"_mode","excel");w(this,"_dropdownToggleVisibility","always");w(this,"_shouldShowDropdownOnFocus",!0);w(this,"_shouldOpenDropdownOnEnter",!1);w(this,"_isCheckboxAlwaysEditable",!1);w(this,"_isRowNumbersVisible",!1);w(this,"_isStickyRowNumbers",!1);w(this,"_freezeColumns",0);w(this,"_invalidCells",[]);w(this,"_isRowToolbarVisible",!1);w(this,"_rowToolbar",["add","delete","duplicate"]);w(this,"_toolbarVerticalAlign","bottom");w(this,"_toolbarHorizontalAlign","center");w(this,"_toolbarTrigger","hover");w(this,"_toolbarPosition","auto");w(this,"_inlineActionsTitle","");w(this,"_contextMenu");w(this,"_contextMenuXOffset",8);w(this,"_contextMenuYOffset",0);w(this,"_headerContextMenu");w(this,"_rowShortcuts");w(this,"_isShortcutsHelpVisible",!1);w(this,"_shortcutsHelpPosition","top-right");w(this,"_shortcutsHelpContentCallback");w(this,"_idValueMember");w(this,"_idValueCallback");w(this,"_rowLocking");w(this,"_externalLocks",new Map);w(this,"_onrowlockchange");w(this,"_gridName",null);w(this,"_shouldPersistColumnWidths",!1);w(this,"_columnWidths",new Map);w(this,"_oncolumnresize");w(this,"_isColumnReorderAllowed",!1);w(this,"_shouldPersistColumnOrder",!1);w(this,"_columnOrder",new Map);w(this,"_oncolumnreorder");w(this,"_fillDirection","vertical");w(this,"_fillDragCallback");w(this,"_onrowchange");w(this,"_onroweditstart");w(this,"_onroweditcancel");w(this,"_onvalidationerror");w(this,"_validationTooltipCallback");w(this,"_ontoolbarclick");w(this,"_onrowaction");w(this,"_oncontextmenuopen");w(this,"_onheadercontextmenuopen");w(this,"_ondatarequest");w(this,"_onrowdelete");w(this,"_sort",[]);w(this,"_filters",{});w(this,"_currentPage",1);w(this,"_totalItems",null);w(this,"_showPagination",!0);w(this,"_paginationPosition","bottom-center");w(this,"_paginationLabelsCallback");w(this,"_paginationLayout","pageSize|previous|pageInfo|next");w(this,"_summaryPosition");w(this,"_summaryContentCallback");w(this,"_summaryMetadata");w(this,"_isSummaryInline",!0);w(this,"_customStylesCallback");w(this,"_rowClassCallback");w(this,"_labels",{...ao});w(this,"_isVirtualScrollEnabled",!1);w(this,"_virtualScrollThreshold",100);w(this,"_virtualScrollRowHeight",38);w(this,"_virtualScrollBuffer",10);w(this,"_isInfiniteScrollEnabled",!1);w(this,"_infiniteScrollThreshold",100);w(this,"_hasMoreItems",!0);w(this,"_isLoadingMore",!1);w(this,"_editingCell",null);w(this,"_currentCellError",null);w(this,"_isValidating",!1);w(this,"_draftRows",new Map);w(this,"_focusedCell",null);w(this,"_isCommittingFromKeyboard",!1);w(this,"_skipNextDropdownAutoEdit",!1);w(this,"_hoveredRowIndex",null);w(this,"_onInteractionChange",null);w(this,"_selectedRows",new Set);w(this,"_lastSelectedRowIndex",null);w(this,"_rangeShortcuts",[])}get items(){return this._items}set items(e){this._items=e,this.requestUpdate()}get columns(){return this._columns}set columns(e){this._columns=e,this.requestUpdate()}get sortMode(){return this._sortMode}set sortMode(e){this._sortMode=e,this.requestUpdate()}get isFilterable(){return this._isFilterable}set isFilterable(e){this._isFilterable=e,this.requestUpdate()}get isPageable(){return this._isPageable}set isPageable(e){this._isPageable=e,this.requestUpdate()}get pageSize(){return this._pageSize}set pageSize(e){this._pageSize=e,this.requestUpdate()}get pageSizes(){return this._pageSizes}set pageSizes(e){this._pageSizes=e,this.requestUpdate()}get isStriped(){return this._isStriped}set isStriped(e){this._isStriped=e,this.requestUpdate()}get isHoverable(){return this._isHoverable}set isHoverable(e){this._isHoverable=e,this.requestUpdate()}get isEditable(){return this._isEditable}set isEditable(e){this._isEditable=e,this.requestUpdate()}get editTrigger(){return this._editTrigger}set editTrigger(e){this._editTrigger=e,this.requestUpdate()}get editStartSelection(){return this._editStartSelection}set editStartSelection(e){this._editStartSelection=e}get mode(){return this._mode}set mode(e){this._mode=e,this.applyModeDefaults(),this.requestUpdate()}get dropdownToggleVisibility(){return this._dropdownToggleVisibility}set dropdownToggleVisibility(e){this._dropdownToggleVisibility=e,this.requestUpdate()}getEffectiveToggleVisibility(e){return e.dropdownToggleVisibility??this._dropdownToggleVisibility}get shouldShowDropdownOnFocus(){return this._shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(e){this._shouldShowDropdownOnFocus=e}get shouldOpenDropdownOnEnter(){return this._shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(e){this._shouldOpenDropdownOnEnter=e}getEffectiveShouldOpenDropdownOnEnter(e){return e.shouldOpenDropdownOnEnter??this._shouldOpenDropdownOnEnter}get isCheckboxAlwaysEditable(){return this._isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(e){this._isCheckboxAlwaysEditable=e,this.requestUpdate()}get isRowNumbersVisible(){return this._isRowNumbersVisible}set isRowNumbersVisible(e){this._isRowNumbersVisible=e,this.requestUpdate()}get isStickyRowNumbers(){return this._isStickyRowNumbers}set isStickyRowNumbers(e){this._isStickyRowNumbers=e,this.requestUpdate()}get freezeColumns(){return this._freezeColumns}set freezeColumns(e){this._freezeColumns=Math.max(0,Math.floor(e)),this.requestUpdate()}get visualColumns(){const e=[],t=[];this._columns.filter(n=>n.isFrozen&&!n.isHidden).length,this._columns.forEach((n,s)=>{if(n.isHidden)return;const a={column:n,originalIndex:s};n.isFrozen?e.push(a):t.push(a)});const i=[],r=[];return t.forEach((n,s)=>{s<this._freezeColumns?i.push(n):r.push(n)}),this._columnOrder.size>0&&r.sort((n,s)=>{const a=String(n.column.field),l=String(s.column.field),d=this._columnOrder.get(a)??n.originalIndex,c=this._columnOrder.get(l)??s.originalIndex;return d-c}),[...e,...i,...r]}get totalFrozenColumns(){return this._columns.filter(t=>t.isFrozen).length+this._freezeColumns}isColumnFrozen(e){return e<this.totalFrozenColumns}get invalidCells(){return this._invalidCells}set invalidCells(e){this._invalidCells=e,this.requestUpdate()}get editingCell(){return this._editingCell}get isValidating(){return this._isValidating}get currentCellError(){return this._currentCellError}get hoveredRowIndex(){return this._hoveredRowIndex}get isRowToolbarVisible(){return this._isRowToolbarVisible}set isRowToolbarVisible(e){this._isRowToolbarVisible=e,this.requestUpdate()}get rowToolbar(){return this._rowToolbar}set rowToolbar(e){this._rowToolbar=e,this.requestUpdate()}get toolbarVerticalAlign(){return this._toolbarVerticalAlign}set toolbarVerticalAlign(e){this._toolbarVerticalAlign=e,this.requestUpdate()}get toolbarHorizontalAlign(){return this._toolbarHorizontalAlign}set toolbarHorizontalAlign(e){this._toolbarHorizontalAlign=e,this.requestUpdate()}get toolbarAlign(){return this._toolbarVerticalAlign}set toolbarAlign(e){this.toolbarVerticalAlign=e}get toolbarTopPosition(){return this._toolbarHorizontalAlign}set toolbarTopPosition(e){this.toolbarHorizontalAlign=e}get toolbarTrigger(){return this._toolbarTrigger}set toolbarTrigger(e){this._toolbarTrigger=e,this.requestUpdate()}get toolbarPosition(){return this._toolbarPosition}set toolbarPosition(e){this._toolbarPosition=e,this.requestUpdate()}get inlineActionsTitle(){return this._inlineActionsTitle}set inlineActionsTitle(e){this._inlineActionsTitle=e,this.requestUpdate()}get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,this.requestUpdate()}get contextMenuXOffset(){return this._contextMenuXOffset}set contextMenuXOffset(e){this._contextMenuXOffset=e}get contextMenuYOffset(){return this._contextMenuYOffset}set contextMenuYOffset(e){this._contextMenuYOffset=e}get headerContextMenu(){return this._headerContextMenu}set headerContextMenu(e){this._headerContextMenu=e}get rowShortcuts(){return this._rowShortcuts}set rowShortcuts(e){this._rowShortcuts=e,this.requestUpdate()}get isShortcutsHelpVisible(){return this._isShortcutsHelpVisible}set isShortcutsHelpVisible(e){this._isShortcutsHelpVisible=e,this.requestUpdate()}get shortcutsHelpPosition(){return this._shortcutsHelpPosition}set shortcutsHelpPosition(e){this._shortcutsHelpPosition=e,this.requestUpdate()}get shortcutsHelpContentCallback(){return this._shortcutsHelpContentCallback}set shortcutsHelpContentCallback(e){this._shortcutsHelpContentCallback=e,this.requestUpdate()}get sort(){return this._sort}set sort(e){this._sort=e,this.requestUpdate()}get currentPage(){return this._currentPage}set currentPage(e){this._currentPage=e,this.requestUpdate()}get totalItems(){return this._totalItems}set totalItems(e){this._totalItems=e,this.requestUpdate()}get showPagination(){return this._showPagination}set showPagination(e){this._showPagination=e,this.requestUpdate()}get paginationPosition(){return this._paginationPosition}set paginationPosition(e){this._paginationPosition=e,this.requestUpdate()}get paginationLabelsCallback(){return this._paginationLabelsCallback}set paginationLabelsCallback(e){this._paginationLabelsCallback=e,this.requestUpdate()}get paginationLayout(){return this._paginationLayout}set paginationLayout(e){this._paginationLayout=e,this.requestUpdate()}get summaryPosition(){return this._summaryPosition}set summaryPosition(e){this._summaryPosition=e,this.requestUpdate()}get summaryContentCallback(){return this._summaryContentCallback}set summaryContentCallback(e){this._summaryContentCallback=e,this.requestUpdate()}get summaryMetadata(){return this._summaryMetadata}set summaryMetadata(e){this._summaryMetadata=e,this.requestUpdate()}get isSummaryInline(){return this._isSummaryInline}set isSummaryInline(e){this._isSummaryInline=e,this.requestUpdate()}get customStylesCallback(){return this._customStylesCallback}set customStylesCallback(e){this._customStylesCallback=e}get rowClassCallback(){return this._rowClassCallback}set rowClassCallback(e){this._rowClassCallback=e,this.requestUpdate()}get labels(){return this._labels}set labels(e){this._labels={...ao,...e},this.requestUpdate()}get isVirtualScrollEnabled(){return this._isVirtualScrollEnabled}set isVirtualScrollEnabled(e){this._isVirtualScrollEnabled=e,this.requestUpdate()}get virtualScrollThreshold(){return this._virtualScrollThreshold}set virtualScrollThreshold(e){this._virtualScrollThreshold=e,this.requestUpdate()}get virtualScrollRowHeight(){return this._virtualScrollRowHeight}set virtualScrollRowHeight(e){this._virtualScrollRowHeight=e,this.requestUpdate()}get virtualScrollBuffer(){return this._virtualScrollBuffer}set virtualScrollBuffer(e){this._virtualScrollBuffer=e,this.requestUpdate()}get isInfiniteScrollEnabled(){return this._isInfiniteScrollEnabled}set isInfiniteScrollEnabled(e){this._isInfiniteScrollEnabled=e,this.requestUpdate()}get infiniteScrollThreshold(){return this._infiniteScrollThreshold}set infiniteScrollThreshold(e){this._infiniteScrollThreshold=e}get hasMoreItems(){return this._hasMoreItems}set hasMoreItems(e){this._hasMoreItems=e}get isLoadingMore(){return this._isLoadingMore}set isLoadingMore(e){this._isLoadingMore=e}shouldUseVirtualScroll(){return this._isVirtualScrollEnabled===!1?!1:this._isVirtualScrollEnabled===!0?!0:this.displayItems.length>=this._virtualScrollThreshold}set onrowchange(e){this._onrowchange=e}set onroweditstart(e){this._onroweditstart=e}set onroweditcancel(e){this._onroweditcancel=e}set onvalidationerror(e){this._onvalidationerror=e}get validationTooltipCallback(){return this._validationTooltipCallback}set validationTooltipCallback(e){this._validationTooltipCallback=e}get ontoolbarclick(){return this._ontoolbarclick}set ontoolbarclick(e){this._ontoolbarclick=e}set onrowaction(e){this._onrowaction=e}set oncontextmenuopen(e){this._oncontextmenuopen=e}get onheadercontextmenuopen(){return this._onheadercontextmenuopen}set onheadercontextmenuopen(e){this._onheadercontextmenuopen=e}get ondatarequest(){return this._ondatarequest}set ondatarequest(e){this._ondatarequest=e}get onrowdelete(){return this._onrowdelete}set onrowdelete(e){this._onrowdelete=e}get idValueMember(){return this._idValueMember}set idValueMember(e){this._idValueMember=e}get idValueCallback(){return this._idValueCallback}set idValueCallback(e){this._idValueCallback=e}get rowLocking(){return this._rowLocking}set rowLocking(e){this._rowLocking=e,this.requestUpdate()}get onrowlockchange(){return this._onrowlockchange}set onrowlockchange(e){this._onrowlockchange=e}get gridName(){return this._gridName}set gridName(e){this._gridName=e}get shouldPersistColumnWidths(){return this._shouldPersistColumnWidths}set shouldPersistColumnWidths(e){this._shouldPersistColumnWidths=e}get oncolumnresize(){return this._oncolumnresize}set oncolumnresize(e){this._oncolumnresize=e}get isColumnReorderAllowed(){return this._isColumnReorderAllowed}set isColumnReorderAllowed(e){this._isColumnReorderAllowed=e}get shouldPersistColumnOrder(){return this._shouldPersistColumnOrder}set shouldPersistColumnOrder(e){this._shouldPersistColumnOrder=e}get oncolumnreorder(){return this._oncolumnreorder}set oncolumnreorder(e){this._oncolumnreorder=e}get fillDirection(){return this._fillDirection}set fillDirection(e){this._fillDirection=e}get fillDragCallback(){return this._fillDragCallback}set fillDragCallback(e){this._fillDragCallback=e}get selectedRows(){return Array.from(this._selectedRows).sort((e,t)=>e-t)}get rangeShortcuts(){return this._rangeShortcuts}set rangeShortcuts(e){this._rangeShortcuts=e}isRowSelected(e){return this._selectedRows.has(e)}selectRow(e,t="replace"){switch(t){case"replace":this._selectedRows.clear(),this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"toggle":this._selectedRows.has(e)?this._selectedRows.delete(e):this._selectedRows.add(e),this._lastSelectedRowIndex=e;break;case"range":if(this._lastSelectedRowIndex!==null){const i=Math.min(this._lastSelectedRowIndex,e),r=Math.max(this._lastSelectedRowIndex,e);for(let n=i;n<=r;n++)this._selectedRows.add(n)}else this._selectedRows.add(e),this._lastSelectedRowIndex=e;break}this.requestUpdate()}selectRowRange(e,t){this._selectedRows.clear();const i=Math.min(e,t),r=Math.max(e,t);for(let n=i;n<=r;n++)this._selectedRows.add(n);this._lastSelectedRowIndex=t,this.requestUpdate()}clearSelection(){this._selectedRows.size>0&&(this._selectedRows.clear(),this._lastSelectedRowIndex=null,this.requestUpdate())}getSelectedRowsData(){return this.selectedRows.map(e=>this.displayItems[e]).filter(Boolean)}get isNavigateMode(){return this._editTrigger==="navigate"||this._columns.some(e=>e.editTrigger==="navigate")}get filteredItems(){return!this._isFilterable||Object.keys(this._filters).length===0?this._items:this._items.filter(e=>Object.entries(this._filters).every(([t,i])=>i?String(e[t]??"").toLowerCase().includes(i.toLowerCase()):!0))}get sortedItems(){return this._sort.length===0?this.filteredItems:[...this.filteredItems].sort((e,t)=>{for(const i of this._sort){const r=e[i.column],n=t[i.column];if(r===n)continue;let s=0;return typeof r=="string"&&typeof n=="string"?s=r.localeCompare(n):typeof r=="number"&&typeof n=="number"?s=r-n:s=String(r??"").localeCompare(String(n??"")),i.direction==="asc"?s:-s}return 0})}get paginatedItems(){if(!this._isPageable)return this.sortedItems;const e=(this._currentPage-1)*this._pageSize,t=e+this._pageSize;return this.sortedItems.slice(e,t)}get totalPages(){const e=this._totalItems!==null?this._totalItems:this.sortedItems.length;return Math.max(1,Math.ceil(e/this._pageSize))}get displayItems(){return this.paginatedItems}fireDataRequest(e){if(this._ondatarequest){const t=e==="loadMore"?this._items.length:(this._currentPage-1)*this._pageSize,i={sort:[...this._sort],page:this._currentPage,pageSize:this._pageSize,trigger:e,mode:e==="loadMore"?"append":"replace",skip:t};this._ondatarequest(i)}}getColumnSortState(e){return this._sort.find(t=>t.column===e)}getColumnSortPriority(e){const t=this._sort.findIndex(i=>i.column===e);return t>=0?t+1:0}applyModeDefaults(){switch(this._mode){case"read-only":this._isEditable=!1,this._dropdownToggleVisibility="on-focus";break;case"excel":this._isEditable=!0,this._editTrigger="navigate",this._dropdownToggleVisibility="always",this._shouldShowDropdownOnFocus=!1;break;case"input-matrix":this._isEditable=!0,this._editTrigger="always",this._dropdownToggleVisibility="always",this._shouldShowDropdownOnFocus=!0;break}}requestUpdate(){}getRowDraft(e){return this._draftRows.get(e)}hasRowDraft(e){return this._draftRows.has(e)}discardRowDraft(e){this._draftRows.delete(e),this._invalidCells=this._invalidCells.filter(t=>t.rowIndex!==e),this.requestUpdate()}getDraftRowIndices(){return Array.from(this._draftRows.keys())}discardAllDrafts(){this._draftRows.clear(),this._invalidCells=[],this.requestUpdate()}getCellRawValue(e,t,i){const r=this._draftRows.get(t);return r?r[i]:e[i]}getCellValue(e,t,i){var n;if(t.templateCallback)return t.templateCallback(e);const r=i!==void 0?this.getCellRawValue(e,i,String(t.field)):e[String(t.field)];if(t.formatCallback)return t.formatCallback(r,e);if(t.editor==="date"&&((n=t.editorOptions)!=null&&n.dateFormat)&&r)try{const s=r instanceof Date?r:new Date(r);if(!isNaN(s.getTime())){const a=Je(t.editorOptions.dateFormat);return ht(s,a)}}catch{}return String(r??"")}isCellInvalid(e,t){return this._invalidCells.some(i=>i.rowIndex===e&&i.field===t)}getCellValidationError(e,t){const i=this._invalidCells.find(r=>r.rowIndex===e&&r.field===t);return(i==null?void 0:i.error)||null}addInvalidCell(e,t,i){const r=this._invalidCells.findIndex(n=>n.rowIndex===e&&n.field===t);r>=0?this._invalidCells[r]={rowIndex:e,field:t,error:i}:this._invalidCells=[...this._invalidCells,{rowIndex:e,field:t,error:i}]}removeInvalidCell(e,t){this._invalidCells=this._invalidCells.filter(i=>!(i.rowIndex===e&&i.field===t))}isEditing(e,t){var i,r;return((i=this._editingCell)==null?void 0:i.rowIndex)===e&&((r=this._editingCell)==null?void 0:r.field)===t}startEdit(e,t,i){var s,a;if(!this.canEditCell(e,t))return;const r=this.displayItems[e];if(!r)return;this._draftRows.has(e)||this._draftRows.set(e,{...r});const n=this._editingCell;this._editingCell={rowIndex:e,field:t,initialSearchQuery:i==null?void 0:i.initialSearchQuery,cursorPosition:i==null?void 0:i.cursorPosition},(s=this._onInteractionChange)==null||s.call(this,"editingCell",{prev:n,current:this._editingCell}),this._currentCellError=null,(a=this._onroweditstart)==null||a.call(this,{row:r,rowIndex:e,field:t})}cancelEdit(){var e,t;if(this._editingCell){const i=this._editingCell,{rowIndex:r,field:n}=i,s=this.displayItems[r];s&&((e=this._onroweditcancel)==null||e.call(this,{row:s,rowIndex:r,field:n})),this._editingCell=null,(t=this._onInteractionChange)==null||t.call(this,"editingCell",{prev:i,current:null}),this._currentCellError=null}}normalizeValidationResult(e,t){return e==null||e===!0?{valid:!0,finalValue:t}:e===!1?{valid:!1,message:"Validation failed",finalValue:t}:typeof e=="string"?{valid:!1,message:e,finalValue:t}:{valid:e.valid,message:e.message,finalValue:e.transformedValue!==void 0?e.transformedValue:t}}async commitEdit(e,t,i){var g,h,f;const r=this._columns.find(p=>String(p.field)===t);if(!r)return;const n=this.displayItems[e];if(!n)return;const s=n[t];let a=i,l=null,d=!0;this._isValidating=!0;try{if(r.beforeCommitCallback){const p={value:i,oldValue:s,row:n,rowIndex:e,field:t},v=await Promise.resolve(r.beforeCommitCallback(p)),m=this.normalizeValidationResult(v,i);d=m.valid,l=m.message||null,a=m.finalValue}else if(r.validateCallback){const p=await Promise.resolve(r.validateCallback(i,n));p&&(d=!1,l=p)}}catch(p){d=!1,l=p instanceof Error?p.message:"Validation failed"}this._isValidating=!1;let c=this._draftRows.get(e);c||(c={...n},this._draftRows.set(e,c)),c[t]=a,d?(this.removeInvalidCell(e,t),this._currentCellError=null):(this.addInvalidCell(e,t,l||"Invalid value"),this._currentCellError=l,(g=this._onvalidationerror)==null||g.call(this,{row:n,rowIndex:e,field:t,error:l||"Invalid value"})),(h=this._onrowchange)==null||h.call(this,{row:n,draftRow:c,rowIndex:e,field:t,oldValue:s,newValue:a,isValid:d,validationError:l});const u=this._editingCell;this._editingCell=null,(f=this._onInteractionChange)==null||f.call(this,"editingCell",{prev:u,current:null})}isCellEditable(e){return e.isEditable===!1?!1:this._isEditable||e.editor!==void 0}getEditableColumns(){return this._columns.map((e,t)=>({index:t,column:e})).filter(({column:e})=>this.isCellEditable(e))}isCellFocused(e,t){var i,r;return((i=this._focusedCell)==null?void 0:i.rowIndex)===e&&((r=this._focusedCell)==null?void 0:r.colIndex)===t}get focusedCell(){return this._focusedCell}setFocusedCell(e,t){var n;const i=this._focusedCell,r={rowIndex:e,colIndex:t};(i==null?void 0:i.rowIndex)===r.rowIndex&&(i==null?void 0:i.colIndex)===r.colIndex||(this._focusedCell=r,(n=this._onInteractionChange)==null||n.call(this,"focusedCell",{prev:i,current:r}))}clearFocusedCell(){var t;const e=this._focusedCell;e!==null&&(this._focusedCell=null,(t=this._onInteractionChange)==null||t.call(this,"focusedCell",{prev:e,current:null}))}setHoveredRow(e){var i;if(this._hoveredRowIndex===e)return;const t=this._hoveredRowIndex;this._hoveredRowIndex=e,(i=this._onInteractionChange)==null||i.call(this,"hoveredRow",{prev:t,current:e})}getRowId(e){if(this._idValueCallback)return this._idValueCallback(e);if(this._idValueMember)return e[String(this._idValueMember)]}findRowById(e){const t=this._items.findIndex(i=>this.getRowId(i)===e);return t===-1?null:{row:this._items[t],index:t}}getRowLockInfo(e){let t,i,r=-1;if(typeof e=="object"&&e!==null)t=e,i=this.getRowId(t),r=this._items.indexOf(t),r===-1&&(r=this.displayItems.indexOf(t));else{i=e;const s=this.findRowById(i);s&&(t=s.row,r=s.index)}if(i!==void 0&&this._externalLocks.has(i))return this._externalLocks.get(i);if(!t)return null;const n=this._rowLocking;if(!n)return null;if(n.getLockInfoCallback){const s=n.getLockInfoCallback(t,r);if(s!=null&&s.isLocked)return s}if(n.isLockedCallback&&n.isLockedCallback(t,r))return{isLocked:!0};if(n.lockInfoMember){const s=t[String(n.lockInfoMember)];if(s!=null&&s.isLocked)return s}return n.lockedMember&&t[String(n.lockedMember)]?{isLocked:!0}:null}isRowLocked(e){const t=this.getRowLockInfo(e);return(t==null?void 0:t.isLocked)===!0}lockRowById(e,t){var n;const i={isLocked:!0,lockedBy:t==null?void 0:t.lockedBy,lockedAt:(t==null?void 0:t.lockedAt)??new Date,reason:t==null?void 0:t.reason,...t};this._externalLocks.set(e,i);const r=this.findRowById(e);return r&&this._editingCell&&this._editingCell.rowIndex===r.index&&this.cancelEdit(),this.requestUpdate(),(n=this._onrowlockchange)==null||n.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:i,source:"external"}),!0}unlockRowById(e){var i;const t=this._externalLocks.has(e);if(this._externalLocks.delete(e),t){this.requestUpdate();const r=this.findRowById(e);(i=this._onrowlockchange)==null||i.call(this,{rowId:e,row:(r==null?void 0:r.row)??null,rowIndex:(r==null?void 0:r.index)??-1,lockInfo:null,source:"external"})}return t}getExternalLocks(){return new Map(this._externalLocks)}clearExternalLocks(){this._externalLocks.clear(),this.requestUpdate()}updateRowById(e,t){const i=this.findRowById(e);if(!i)return!1;Object.assign(this._items[i.index],t);const r=this._draftRows.get(i.index);return r&&Object.assign(r,t),this.requestUpdate(),!0}replaceRowById(e,t){const i=this.findRowById(e);return i?(this._items[i.index]=t,this._draftRows.delete(i.index),this.requestUpdate(),!0):!1}canEditCell(e,t){var l;const i=this._columns.find(d=>String(d.field)===t);if(!i||!this.isCellEditable(i))return!1;const r=this.displayItems[e];if(!r)return!1;const n=this.getRowLockInfo(r);if(!(n!=null&&n.isLocked))return!0;const s=this._rowLocking;switch((s==null?void 0:s.lockedEditBehavior)??"block"){case"allow":return!0;case"callback":return((l=s==null?void 0:s.canEditLockedCallback)==null?void 0:l.call(s,r,n))??!1;case"block":default:return!1}}getColumnWidth(e){return this._columnWidths.get(e)}setColumnWidth(e,t,i=!1){this._columnWidths.set(e,t),i||this.requestUpdate()}setColumnWidths(e){for(const{field:t,width:i}of e)t&&i&&this._columnWidths.set(t,i);this.requestUpdate()}getColumnWidthsState(){return this._columns.map(e=>{const t=String(e.field),i=this._columnWidths.get(t)||e.width||"";return{field:t,width:i}}).filter(e=>e.width)}loadPersistedWidths(){this.loadPersistedState()}savePersistedWidths(){this.savePersistedState()}loadPersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,t=localStorage.getItem(e);if(!t)return;const i=JSON.parse(t),r=new Set(this._columns.map(s=>String(s.field)));let n=!1;if(i.columnWidths){this._columnWidths.clear();for(const s of i.columnWidths)r.has(s.field)?this._columnWidths.set(s.field,s.width):n=!0}if(i.columnOrder){this._columnOrder.clear();for(const s of i.columnOrder)r.has(s.field)?this._columnOrder.set(s.field,s.order):n=!0}n&&this.savePersistedState()}catch(e){console.warn("WebGrid: Failed to load persisted state",e)}}savePersistedState(){if(!(!this._gridName||typeof localStorage>"u"))try{const e=`wg-${this._gridName}-state`,t={};this._shouldPersistColumnWidths&&(t.columnWidths=this.getColumnWidthsState()),this._shouldPersistColumnOrder&&(t.columnOrder=this.getColumnOrderState()),localStorage.setItem(e,JSON.stringify(t))}catch(e){console.warn("WebGrid: Failed to save persisted state",e)}}getColumnOrder(e){return this._columnOrder.get(e)}setColumnOrder(e){this._columnOrder.clear();for(const{field:t,order:i}of e)t!==void 0&&i!==void 0&&this._columnOrder.set(t,i);this.requestUpdate()}getColumnOrderState(){const e=this.visualColumns,t=this.totalFrozenColumns;return e.slice(t).map((i,r)=>({field:String(i.column.field),order:r}))}moveColumn(e,t){const i=this.visualColumns,r=this.totalFrozenColumns,n=i.slice(r),s=n.findIndex(d=>String(d.column.field)===e);if(s===-1||s===t)return;this._columnOrder.clear();const a=[...n],[l]=a.splice(s,1);a.splice(t,0,l),a.forEach((d,c)=>{this._columnOrder.set(String(d.column.field),c)}),this.requestUpdate()}}const cr=':host{--wg-rem: 10px;font-family:var(--wg-font-family);display:block;--wg-accent-color: var(--base-accent-color, #0078d4);--wg-accent-color-hover: var(--base-accent-color-hover, #106ebe);--wg-accent-color-active: var(--base-accent-color-active, #005a9e);--wg-accent-color-light: var(--base-accent-color-light, #e6f2ff);--wg-text-color-1: var(--base-text-color-1, #242424);--wg-text-color-2: var(--base-text-color-2, #424242);--wg-text-color-3: var(--base-text-color-3, #707070);--wg-text-on-accent: var(--base-text-color-on-accent, #ffffff);--wg-surface-1: var(--base-main-bg, #ffffff);--wg-surface-2: var(--base-elevated-bg, #f5f5f5);--wg-surface-3: var(--base-hover-bg, #ebebeb);--wg-surface-floating: var(--base-dropdown-bg, var(--base-main-bg, #ffffff));--wg-border-color: var(--base-border-color, #e0e0e0);--wg-border-color-hover: var(--base-border-color, #d1d1d1);--wg-input-bg: var(--base-input-bg, #ffffff);--wg-input-color: var(--base-input-color, var(--wg-text-color-1));--wg-input-border: var(--base-input-border, 1px solid #d1d1d1);--wg-input-border-hover: var(--base-input-border-hover, 1px solid #0078d4);--wg-input-border-focus: var(--base-input-border-focus, 1px solid #0078d4);--wg-input-placeholder-color: var(--base-input-placeholder-color, #707070);--wg-danger-color: var(--base-danger-color, #d13438);--wg-danger-bg-light: var(--base-danger-bg-light, #fde7e9);--wg-hover-bg: var(--base-hover-bg, #f0f0f0);--wg-active-bg: var(--base-hover-bg, #e0e0e0);--wg-font-size-base: calc(var(--base-font-size-sm, 1.4) * var(--wg-rem));--wg-font-size-sm: calc(var(--base-font-size-xs, 1.2) * var(--wg-rem));--wg-font-size-xs: calc(var(--base-font-size-2xs, 1.1) * var(--wg-rem));--wg-font-size-lg: calc(var(--base-font-size-base, 1.6) * var(--wg-rem));--wg-font-family: var(--base-font-family, inherit);--wg-line-height-base: var(--base-line-height-normal, 1.5);--wg-font-weight-normal: var(--base-font-weight-normal, 400);--wg-font-weight-semibold: var(--base-font-weight-semibold, 600);--wg-font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;--wg-border-radius-sm: calc(var(--base-border-radius-sm, .4) * var(--wg-rem));--wg-border-radius-md: calc(var(--base-border-radius-md, .6) * var(--wg-rem));--wg-border-radius-lg: calc(var(--base-border-radius-lg, .8) * var(--wg-rem));--wg-spacing-xs: calc(.4 * var(--wg-rem));--wg-spacing-sm: calc(.8 * var(--wg-rem));--wg-spacing-md: calc(1.2 * var(--wg-rem));--wg-spacing-lg: calc(1.6 * var(--wg-rem));--wg-spacing-xl: calc(2.4 * var(--wg-rem));--wg-table-bg: var(--wg-surface-1);--wg-table-border: 1px solid var(--wg-border-color);--wg-header-bg: var(--wg-surface-2);--wg-header-bg-hover: var(--wg-surface-3);--wg-header-bg-sorted: var(--wg-surface-3);--wg-header-color: var(--wg-text-color-1);--wg-header-border: 2px solid var(--wg-border-color);--wg-header-separator: 1px solid var(--wg-border-color);--wg-header-padding: var(--wg-spacing-sm);--wg-header-font-weight: var(--wg-font-weight-semibold);--wg-header-min-height: auto;--wg-cell-padding: var(--wg-spacing-sm);--wg-cell-padding-block: var(--wg-spacing-sm);--wg-cell-padding-inline: var(--wg-spacing-sm);--wg-row-min-height: auto;--wg-row-max-height: none;--wg-cell-color: var(--wg-text-color-1);--wg-cell-border: 1px solid var(--wg-border-color);--wg-cell-bg-hover: var(--wg-hover-bg);--wg-cell-bg-editing: var(--wg-surface-1);--wg-cell-readonly-bg: var(--base-disabled-bg, var(--wg-surface-2));--wg-row-border: 1px solid var(--wg-border-color);--wg-row-bg-even: var(--wg-surface-2);--wg-row-bg-hover: var(--wg-surface-3);--wg-filter-bg: var(--wg-surface-1);--wg-filter-border: 1px solid var(--wg-border-color);--wg-filter-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-filter-input-padding: calc(.4 * var(--wg-rem)) calc(.8 * var(--wg-rem));--wg-filter-input-bg: var(--wg-input-bg);--wg-filter-input-border: var(--wg-input-border);--wg-filter-input-border-focus: var(--wg-input-border-focus);--wg-filter-input-border-radius: var(--wg-border-radius-sm);--wg-filter-input-font-size: var(--wg-font-size-sm);--wg-sort-indicator-size: calc(1.4 * var(--wg-rem));--wg-sort-indicator-opacity: .9;--wg-sort-placeholder-opacity: .3;--wg-sort-priority-size: calc(1.1 * var(--wg-rem));--wg-pagination-padding: var(--wg-spacing-md);--wg-pagination-gap: calc(1.6 * var(--wg-rem));--wg-pagination-bg: var(--wg-surface-1);--wg-pagination-border: 1px solid var(--wg-border-color);--wg-pagination-btn-padding: calc(.6 * var(--wg-rem)) calc(1.6 * var(--wg-rem));--wg-pagination-btn-bg: var(--wg-surface-1);--wg-pagination-btn-bg-hover: var(--wg-surface-2);--wg-pagination-btn-bg-active: var(--wg-surface-3);--wg-pagination-btn-border: 1px solid var(--wg-border-color);--wg-pagination-btn-border-hover: 1px solid var(--wg-border-color-hover);--wg-pagination-btn-border-radius: var(--wg-border-radius-sm);--wg-pagination-btn-disabled-opacity: .4;--wg-empty-padding: var(--wg-spacing-xl);--wg-empty-color: var(--wg-text-color-3);--wg-error-cell-bg: var(--wg-danger-bg-light);--wg-error-cell-border: 1px solid var(--wg-danger-color);--wg-error-message-color: var(--wg-danger-color);--wg-error-message-font-size: var(--wg-font-size-xs);--wg-error-indicator-color: var(--wg-danger-color);--wg-editor-bg: var(--wg-surface-1);--wg-editor-outline: 2px solid var(--wg-accent-color);--wg-editor-outline-offset: -2px;--wg-editor-validating-opacity: .7;--wg-dropdown-toggle-right: var(--wg-spacing-sm);--wg-dropdown-toggle-size: calc(1.2 * var(--wg-rem));--wg-dropdown-toggle-hitbox: calc(2.4 * var(--wg-rem));--wg-date-trigger-size: calc(2.8 * var(--wg-rem));--wg-toolbar-bg: var(--wg-surface-floating);--wg-toolbar-border: 1px solid var(--wg-border-color);--wg-toolbar-border-radius: var(--wg-border-radius-sm);--wg-toolbar-shadow: var(--base-dropdown-box-shadow, 0 2px 8px rgba(0, 0, 0, .15));--wg-toolbar-divider-color: var(--wg-border-color);--wg-toolbar-row-height: calc(3.7 * var(--wg-rem));--wg-toolbar-btn-min-width: calc(2.4 * var(--wg-rem));--wg-toolbar-btn-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-btn-border-radius: var(--wg-border-radius-sm);--wg-toolbar-btn-bg-hover: var(--wg-hover-bg);--wg-toolbar-btn-bg-active: var(--wg-active-bg);--wg-toolbar-btn-color: var(--wg-text-color-1);--wg-toolbar-trigger-color: var(--wg-text-color-3);--wg-toolbar-trigger-color-hover: var(--wg-text-color-1);--wg-toolbar-trigger-bg-hover: var(--wg-hover-bg);--wg-tooltip-bg: var(--base-tooltip-bg, #333);--wg-tooltip-color: var(--base-tooltip-color, #fff);--wg-context-menu-z-index: 1001;--wg-context-menu-min-width: calc(16 * var(--wg-rem));--wg-focus-outline: 2px solid var(--wg-accent-color);--wg-focus-outline-offset: -2px;--wg-focus-bg: var(--wg-hover-bg);--wg-transition-fast: .1s ease;--wg-transition-normal: .15s ease;--wg-z-dropdown: 9999;--wg-z-toolbar: 1000;--wg-z-context-menu: 1001;--wg-z-tooltip: 10000;--wg-frozen-column-bg: var(--wg-surface-1);--wg-frozen-header-bg: var(--wg-header-bg);--wg-frozen-column-shadow: 2px 0 4px rgba(0, 0, 0, .1);--wg-frozen-column-shadow-active: 6px 0 12px rgba(0, 0, 0, .25);--wg-frozen-column-border: 2px solid var(--wg-border-color);--wg-resize-handle-width: 12px;--wg-resize-handle-offset: -6px;--wg-resize-handle-line-width: 2px;--wg-resize-handle-color: var(--wg-border-color);--wg-resize-handle-active-color: var(--wg-accent-color);--wg-fill-handle-size: 8px;--wg-fill-handle-bg: var(--wg-surface-1);--wg-fill-handle-border-color: var(--wg-accent-color);--wg-fill-handle-border-width: 2px;--wg-fill-range-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-fill-range-border-color: var(--wg-accent-color);--wg-selection-bg: color-mix(in srgb, var(--wg-accent-color) 15%, transparent);--wg-selection-row-number-bg: var(--wg-accent-color);--wg-selection-row-number-color: var(--base-text-inverted, #fff);--wg-dropdown-option-gap: var(--wg-spacing-sm);--wg-dropdown-option-padding: calc(.6 * var(--wg-rem)) var(--wg-spacing-sm) calc(.6 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-dropdown-empty-padding: calc(.8 * var(--wg-rem)) var(--wg-spacing-sm) calc(.8 * var(--wg-rem)) calc(var(--wg-spacing-sm) - 1px);--wg-inline-actions-padding: var(--wg-spacing-xs) var(--wg-spacing-sm);--wg-inline-actions-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-gap: calc(.2 * var(--wg-rem));--wg-toolbar-row-padding: 0 calc(.4 * var(--wg-rem));--wg-toolbar-label-font-size: var(--wg-font-size-sm);--wg-toolbar-btn-gap: calc(.4 * var(--wg-rem));--wg-tooltip-padding: calc(.6 * var(--wg-rem)) calc(1 * var(--wg-rem));--wg-tooltip-shadow: 0 2px 8px rgba(0, 0, 0, .2)}web-grid:not(:defined){display:block;min-height:calc(10 * var(--wg-rem));color:transparent!important;background:transparent}.wg{position:relative;width:100%;max-height:inherit;overflow:auto;overscroll-behavior:contain;border:var(--wg-table-border)}.wg__table{width:100%;min-width:max-content;border-collapse:collapse;table-layout:fixed;background:var(--wg-table-bg);font-size:var(--wg-font-size-base);line-height:var(--wg-line-height-base)}.wg__filler{width:auto;min-width:0;padding:0!important;border:none!important;box-shadow:none!important}th.wg__filler{position:sticky;top:0;z-index:1;background:var(--wg-header-bg);border-bottom:var(--wg-header-border)!important}td.wg__filler{background:transparent}.wg__table tbody tr{border-bottom:var(--wg-row-border)}.wg__row-number-header,.wg__row-number{width:40px;min-width:40px;max-width:40px;box-sizing:border-box;text-align:center;color:var(--wg-text-color-2);background:var(--wg-header-bg);-webkit-user-select:none;user-select:none;font-size:var(--wg-font-size-sm)}.wg__row-number{box-shadow:inset -1px 0 0 var(--wg-border-color)}.wg__actions-column{width:32px;min-width:32px;max-width:32px;padding:0!important;text-align:center}thead .wg__actions-column{background:var(--wg-header-bg);border-bottom:var(--wg-header-border)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__header{position:sticky;top:0;z-index:1;background:var(--wg-header-bg);color:var(--wg-header-color);font-weight:var(--wg-header-font-weight);padding:var(--wg-header-padding);height:var(--wg-header-min-height);border-bottom:var(--wg-header-border);box-shadow:inset -1px 0 0 var(--wg-border-color);box-sizing:border-box;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__header:last-child{box-shadow:none}.wg__header--sortable{cursor:pointer}.wg__header--sortable:hover{background:var(--wg-header-bg-hover)}.wg__header--sorted{background:var(--wg-header-bg-sorted)}.wg__header-container{display:flex;align-items:stretch;gap:4px;height:100%}.wg__header-content{flex:1;min-width:0;display:flex;align-items:center;justify-content:flex-start}.wg__header-content--align-left{justify-content:flex-start}.wg__header-content--align-center{justify-content:center}.wg__header-content--align-right{justify-content:flex-end}.wg__header-content--align-justify{justify-content:flex-start}.wg__header-content--valign-top{align-items:flex-start}.wg__header-content--valign-middle{align-items:center}.wg__header-content--valign-bottom{align-items:flex-end}.wg__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__header-controls{flex-shrink:0;display:flex;align-items:center}.wg__sort-indicator{font-size:var(--wg-sort-indicator-size);opacity:var(--wg-sort-indicator-opacity);min-width:16px;text-align:center}.wg__sort-placeholder{opacity:var(--wg-sort-placeholder-opacity)}.wg__sort-priority{font-size:var(--wg-sort-priority-size);font-weight:600;margin-left:2px;vertical-align:super;line-height:1}.wg__header-info{display:inline-flex;align-items:center;color:var(--wg-accent-color);cursor:help;opacity:.7;margin-left:4px;vertical-align:middle}.wg__header-info:hover{opacity:1}.wg__filter-row th{padding:var(--wg-filter-padding);background:var(--wg-filter-bg);border-bottom:var(--wg-filter-border)}.wg__filter-input{width:100%;padding:var(--wg-filter-input-padding);border:var(--wg-filter-input-border);border-radius:var(--wg-filter-input-border-radius);background:var(--wg-surface-1);color:var(--wg-text-color-1);font-family:inherit;font-size:var(--wg-filter-input-font-size);box-sizing:border-box}.wg__filter-input:focus{outline:none;border:var(--wg-filter-input-border-focus);box-shadow:0 0 0 1px var(--wg-accent-color)}.wg__resize-handle{position:absolute;top:0;right:var(--wg-resize-handle-offset);bottom:0;width:var(--wg-resize-handle-width);cursor:col-resize;z-index:2;opacity:0;transition:opacity .1s ease}.wg__header:hover .wg__resize-handle{opacity:1}.wg__resize-handle:after{content:"";position:absolute;top:25%;bottom:25%;left:50%;width:var(--wg-resize-handle-line-width);background:var(--wg-resize-handle-color);transform:translate(-50%);border-radius:1px}.wg__resize-handle:hover:after{background:var(--wg-resize-handle-active-color);top:15%;bottom:15%}.wg__resize-handle--active:after{background:var(--wg-resize-handle-active-color);top:0;bottom:0}.wg__resize-handle--disabled{cursor:not-allowed}.wg__resize-handle--disabled:after{display:none}.wg--resizing .wg__resize-handle{opacity:1}.wg--resizing{-webkit-user-select:none;user-select:none;cursor:col-resize}.wg--resizing .wg__cell,.wg--resizing .wg__header{cursor:col-resize}.wg--resizing .wg__table{min-width:0!important}.wg__header--dragging{opacity:1;background:var(--wg-header-bg)!important;outline:2px dashed var(--wg-accent-color);outline-offset:-2px}.wg__reorder-ghost{position:fixed;z-index:10000;background:var(--wg-header-bg);border:2px solid var(--wg-accent-color);border-radius:var(--wg-border-radius-sm);padding:.4em .8em;font-size:var(--wg-font-size-sm);font-weight:var(--wg-header-font-weight);color:var(--wg-header-color);box-shadow:0 4px 12px #00000026;opacity:.95;pointer-events:none;white-space:nowrap}.wg__drop-indicator{position:absolute;width:3px;background:var(--wg-accent-color);z-index:999;pointer-events:none;display:none}.wg__drop-indicator:before{content:"";position:absolute;top:0;left:50%;transform:translate(-50%);border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid var(--wg-accent-color)}.wg--reordering{cursor:grabbing;-webkit-user-select:none;user-select:none}.wg--reordering .wg__cell,.wg--reordering .wg__header{cursor:grabbing}.wg--reorderable .wg__header:not(.wg__header--frozen):hover{cursor:grab}.wg__header--frozen{cursor:default}.wg__fill-handle{position:absolute;width:var(--wg-fill-handle-size);height:var(--wg-fill-handle-size);background:var(--wg-fill-handle-bg);border:var(--wg-fill-handle-border-width) solid var(--wg-fill-handle-border-color);cursor:crosshair;z-index:10;pointer-events:auto;box-sizing:border-box}.wg__fill-handle:hover{transform:scale(1.2)}.wg__fill-range{position:absolute;background:var(--wg-fill-range-bg);border:1px dashed var(--wg-fill-range-border-color);pointer-events:none;z-index:5;box-sizing:border-box}.wg--filling{cursor:crosshair;-webkit-user-select:none;user-select:none}.wg--filling .wg__cell,.wg--filling .wg__header{cursor:crosshair}.wg__cell--editing .wg__fill-handle{display:none}.wg__row--selected>.wg__cell{background:var(--wg-selection-bg)}.wg__row--selected>.wg__row-number{background:var(--wg-selection-row-number-bg);color:var(--wg-selection-row-number-color)}.wg__row-number[data-row-number]{cursor:pointer;-webkit-user-select:none;user-select:none}.wg__row-number[data-row-number]:hover{background:var(--wg-hover-bg)}.wg__row--selected>.wg__row-number:hover{background:var(--wg-selection-row-number-bg)}.wg--selecting{cursor:default;-webkit-user-select:none;user-select:none}.wg--selecting *{-webkit-user-select:none;user-select:none}.wg:focus{outline:none}.wg__header--frozen{background:var(--wg-frozen-header-bg, var(--wg-header-bg))}.wg__row-number-header.wg__header--frozen{z-index:4!important}.wg__cell--frozen{background:var(--wg-frozen-column-bg, var(--wg-surface-1))}.wg__cell--frozen-last{box-shadow:inset -1px 0 0 var(--wg-border-color)}.wg__row-number.wg__cell--frozen{background:var(--wg-header-bg);z-index:2!important}.wg--striped tbody tr:nth-child(2n) .wg__cell--frozen{background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover .wg__cell--frozen{background:var(--wg-row-bg-hover)}.wg__row--focused .wg__cell--frozen{background:var(--wg-focus-bg)}.wg__header.wg__header--frozen-last,.wg__cell.wg__cell--frozen-last{overflow:visible}.wg--scrolled-horizontal .wg__header--frozen-last:after,.wg--scrolled-horizontal .wg__cell--frozen-last:after{content:"";position:absolute;top:0;right:-8px;bottom:0;width:8px;background:linear-gradient(to right,rgba(0,0,0,.15),transparent);pointer-events:none}.wg__cell{padding:var(--wg-cell-padding);color:var(--wg-cell-color);height:var(--wg-row-min-height);max-height:var(--wg-row-max-height);box-sizing:border-box;scroll-margin-top:3rem;scroll-margin-bottom:.5rem;-webkit-user-select:none;user-select:none;overflow:hidden}.wg__cell-text{-webkit-user-select:none;user-select:none}.wg__cell--ellipsis .wg__cell-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__cell--line-clamp .wg__cell-text{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.wg__cell--editable{cursor:pointer;position:relative}.wg__cell--editable:hover{background:var(--wg-cell-bg-hover)}.wg__cell--editable:hover:after{content:"";position:absolute;top:2px;right:2px;bottom:2px;left:2px;border:1px dashed var(--wg-border-color);border-radius:2px;pointer-events:none}.wg__cell--editing{position:relative;background:var(--wg-surface-1);outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__cell--editing:after{display:none}.wg__cell--invalid{background:var(--wg-danger-bg-light, #fee);box-shadow:inset 0 0 0 2px var(--wg-danger-color, #c00)}.wg--navigate-mode .wg__cell:not(.wg__cell--editable){background:var(--wg-cell-readonly-bg, #f5f5f5)}:host{--wg-row-locked-bg: var(--base-disabled-bg, #f5f5f5);--wg-row-locked-opacity: .7}.wg__row--locked{background:var(--wg-row-locked-bg)!important}.wg__row--locked .wg__cell{opacity:var(--wg-row-locked-opacity)}.wg__row--locked .wg__cell--editable{cursor:not-allowed}.wg__row--locked .wg__cell--editable:hover{background:inherit}.wg__row--locked .wg__cell--editable:hover:after{display:none}.wg__row-number--locked{opacity:1!important;cursor:help}.wg__editor{position:absolute;top:0;left:0;right:0;width:100%;padding:var(--wg-cell-padding);border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:inherit;box-sizing:border-box}.wg__editor:focus,.wg__editor:focus-visible{outline:none;box-shadow:none}.wg__editor--text{text-align:inherit}.wg__editor--number{text-align:right}.wg__editor--date{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding)}.wg__date-input{flex:1;min-width:0;height:100%;border:none;background:transparent;font:inherit;padding:0;outline:none;color:inherit}.wg__date-trigger{width:var(--wg-date-trigger-size, 28px);height:100%;display:flex;align-items:center;justify-content:center;border:none;background:transparent;color:var(--wg-text-color-3);cursor:pointer;padding:0;flex-shrink:0}.wg__date-trigger:hover{color:var(--wg-accent-color, #0078d4);background:var(--wg-hover-bg, rgba(0, 0, 0, .05))}.wg__editor--checkbox{width:auto;height:auto;margin:0 auto}.wg__editor--custom{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:var(--wg-editor-bg);padding:var(--wg-cell-padding-block) var(--wg-cell-padding-inline);cursor:pointer}.wg__editor--custom:focus{outline:none}.wg__custom-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;cursor:pointer}.wg__editor--combobox,.wg__editor--autocomplete{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;padding:var(--wg-cell-padding);padding-right:0;background:transparent;box-sizing:border-box}.wg__combobox-input,.wg__autocomplete-input{flex:1;width:100%;height:100%;padding:0 24px 0 0;border:none;background:transparent;color:var(--wg-text-color-1);font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base);outline:none;box-sizing:border-box;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wg__combobox-input:focus,.wg__autocomplete-input:focus{outline:none}.wg__combobox-toggle{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:var(--wg-dropdown-toggle-size);color:var(--wg-text-color-2);pointer-events:auto;cursor:pointer}.wg__combobox-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__loading-indicator{position:absolute;right:var(--wg-dropdown-toggle-right);top:50%;transform:translateY(-50%);font-size:12px;animation:wg-pulse 1s infinite}@keyframes wg-pulse{0%,to{opacity:1}50%{opacity:.4}}.wg__select-trigger{display:flex;align-items:center;justify-content:space-between;cursor:pointer;background:transparent}.wg__select-trigger:focus,.wg__select-trigger:focus-visible{outline:none;box-shadow:none}.wg__select-value{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wg__select-toggle{position:relative;font-size:var(--wg-dropdown-toggle-size);opacity:.6;margin-left:4px;flex-shrink:0;pointer-events:auto;cursor:pointer}.wg__select-toggle:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__cell-dropdown-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:0}.wg__cell:hover .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle,.wg__cell--focused .wg__cell-dropdown-display--toggle-on-focus .wg__select-toggle{opacity:.6}.wg__cell-date-display{display:flex;align-items:center;justify-content:space-between;width:100%;cursor:pointer}.wg__cell-date-display .wg__date-trigger{position:relative;background:none;border:none;padding:0;margin:0;cursor:pointer;opacity:.6;display:flex;align-items:center;justify-content:center;color:inherit}.wg__cell-date-display .wg__date-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:0}.wg__cell:hover .wg__cell-date-display--toggle-on-focus .wg__date-trigger,.wg__cell--focused .wg__cell-date-display--toggle-on-focus .wg__date-trigger{opacity:.6}.wg__dropdown{background:var(--wg-surface-floating, #fff);border:1px solid var(--wg-border-color, #d1d1d1);border-radius:4px;box-shadow:var(--wg-toolbar-shadow);max-height:200px;overflow-y:auto;font-size:var(--wg-font-size-base);font-family:inherit;line-height:var(--wg-line-height-base)}.wg__dropdown-option{display:flex;align-items:center;gap:var(--wg-dropdown-option-gap);padding:var(--wg-dropdown-option-padding);cursor:pointer;color:var(--wg-text-color-1)}.wg__dropdown-option:hover,.wg__dropdown-option--highlighted{background:var(--wg-hover-bg, #f0f0f0);box-shadow:inset 0 0 0 2px var(--wg-accent-color, #0078d4)}.wg__dropdown-option--selected{background:var(--wg-accent-color-light, #e6f2ff)}.wg__dropdown-option--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.wg__dropdown-option-icon{flex-shrink:0;width:1.5em;text-align:center}.wg__dropdown-option-content{flex:1;min-width:0;overflow:hidden}.wg__dropdown-option-label{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-option-subtitle{display:block;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wg__dropdown-empty{padding:var(--wg-dropdown-empty-padding);color:var(--wg-text-color-2);font-style:italic;text-align:center}.wg__dropdown-option--align-left{justify-content:flex-start}.wg__dropdown-option--align-left .wg__dropdown-option-content{text-align:left}.wg__dropdown-option--align-center{justify-content:center}.wg__dropdown-option--align-center .wg__dropdown-option-content{text-align:center}.wg__dropdown-option--align-right{justify-content:flex-end}.wg__dropdown-option--align-right .wg__dropdown-option-content{text-align:right}.wg__dropdown-option--align-justify{justify-content:flex-start}.wg__dropdown-option--align-justify .wg__dropdown-option-content{text-align:justify}.wg--navigate-mode .wg__cell{cursor:cell}.wg--navigate-mode .wg__cell:focus{outline:none}.wg--navigate-mode .wg__cell.wg__cell--focused{outline:var(--wg-focus-outline);outline-offset:-2px}.wg__cell--focused:after{display:none}.wg__pagination{display:flex;align-items:center;justify-content:center;gap:var(--wg-pagination-gap);padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__pagination-btn{padding:var(--wg-pagination-btn-padding);background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer;transition:all var(--wg-transition-fast)}.wg__pagination-btn:hover:not(:disabled){background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-btn:active:not(:disabled){background:var(--wg-pagination-btn-bg-active)}.wg__pagination-btn:disabled{opacity:var(--wg-pagination-btn-disabled-opacity);cursor:not-allowed}.wg__pagination-info{font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__pagination-count{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3);margin-left:4px}.wg__pagination-pagesize{display:flex;align-items:center;gap:6px}.wg__pagination-select{padding:4px 8px;background:var(--wg-pagination-btn-bg);border:var(--wg-pagination-btn-border);border-radius:var(--wg-pagination-btn-border-radius);color:var(--wg-cell-color);font-family:inherit;font-size:var(--wg-font-size-base);cursor:pointer}.wg__pagination-select:hover{background:var(--wg-pagination-btn-bg-hover);border:var(--wg-pagination-btn-border-hover)}.wg__pagination-select:focus{outline:2px solid var(--wg-accent-color);outline-offset:-2px}.wg__pagination-label{font-size:var(--wg-font-size-sm);color:var(--wg-text-color-3)}.wg__pagination--left{justify-content:flex-start}.wg__pagination--right{justify-content:flex-end}.wg__pagination--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__summary{display:flex;align-items:center;padding:var(--wg-pagination-padding);border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg);font-size:var(--wg-font-size-base);color:var(--wg-cell-color)}.wg__summary--left{justify-content:flex-start}.wg__summary--right{justify-content:flex-end}.wg__summary--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer{display:flex;align-items:center;justify-content:space-between;border-top:var(--wg-pagination-border);background:var(--wg-pagination-bg)}.wg__footer--top{border-top:none;border-bottom:var(--wg-pagination-border)}.wg__footer .wg__summary,.wg__footer .wg__pagination{border:none}.wg__footer .wg__summary{flex:0 0 auto}.wg__footer .wg__pagination{flex:0 0 auto;margin-left:auto}.wg__toolbar-container{position:fixed;z-index:var(--wg-z-toolbar, 1000)}.wg__toolbar{display:flex;flex-direction:column-reverse;gap:0;padding:0;background:var(--wg-toolbar-bg);border:var(--wg-toolbar-border);border-radius:var(--wg-toolbar-border-radius);box-shadow:var(--wg-toolbar-shadow)}.wg__toolbar-row{display:flex;gap:var(--wg-toolbar-row-gap);align-items:center;height:var(--wg-toolbar-row-height);padding:var(--wg-toolbar-row-padding)}.wg__toolbar-row+.wg__toolbar-row{border-top:1px solid var(--wg-toolbar-divider-color)}.wg__toolbar-divider{width:1px;height:16px;background:var(--wg-toolbar-divider-color);margin:0 4px;flex-shrink:0}.wg__toolbar-btn{min-width:var(--wg-toolbar-btn-min-width);height:100%;border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--wg-toolbar-btn-gap);font-family:inherit;font-size:var(--wg-font-size-base);font-weight:500;padding:var(--wg-toolbar-btn-padding);transition:background .1s ease}.wg__toolbar-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__toolbar-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__toolbar-btn:disabled{opacity:.5;cursor:not-allowed}.wg__toolbar-btn:disabled:hover{background:transparent}.wg__toolbar-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__toolbar-label{font-size:var(--wg-toolbar-label-font-size);white-space:nowrap}.wg__actions-column{width:24px;min-width:24px;max-width:24px;padding:0!important;text-align:center}.wg__header .wg__actions-column{background:var(--wg-header-bg)}.wg__filter-row .wg__actions-column{background:var(--wg-filter-bg)}.wg__toolbar-trigger{position:relative;padding:0;background:transparent;border:none;border-radius:var(--wg-border-radius-sm);cursor:pointer;font-size:var(--wg-font-size-base);line-height:1;color:var(--wg-toolbar-trigger-color)}.wg__toolbar-trigger:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--wg-dropdown-toggle-hitbox);height:48px}.wg__toolbar-trigger:hover,.wg__toolbar-trigger--active{color:var(--wg-toolbar-trigger-color-hover);background:var(--wg-toolbar-trigger-bg-hover)}.wg__inline-actions-header,.wg__inline-actions-cell{width:1%;white-space:nowrap;text-align:center;padding:var(--wg-inline-actions-padding)}.wg__inline-actions-header{background:var(--wg-header-bg)}.wg__inline-actions-wrap{display:flex;flex-direction:column;gap:var(--wg-inline-actions-gap);align-items:center}.wg__inline-actions-row{display:flex;gap:var(--wg-inline-actions-gap);align-items:center;justify-content:center}.wg__inline-action-btn{min-width:var(--wg-toolbar-btn-min-width);height:calc(2.4 * var(--wg-rem));border:none;border-radius:var(--wg-toolbar-btn-border-radius);background:transparent;color:var(--wg-toolbar-btn-color);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0 var(--wg-spacing-xs);font-family:inherit;font-size:var(--wg-font-size-base);transition:background var(--wg-transition-fast)}.wg__inline-action-btn:hover{background:var(--wg-toolbar-btn-bg-hover)}.wg__inline-action-btn:active{background:var(--wg-toolbar-btn-bg-active)}.wg__inline-action-btn:disabled,.wg__inline-action-btn--disabled{opacity:.5;cursor:not-allowed}.wg__inline-action-btn:disabled:hover,.wg__inline-action-btn--disabled:hover{background:transparent}.wg__inline-action-btn--danger:hover{background:var(--wg-danger-bg-light);color:var(--wg-danger-color)}.wg__shortcuts-help{position:absolute;top:var(--wg-spacing-xs);right:var(--wg-spacing-sm);z-index:5}.wg__shortcuts-help--left{right:auto;left:var(--wg-spacing-sm)}.wg__shortcuts-help-icon{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:50%;background:var(--wg-surface-1);color:var(--wg-text-color-2);cursor:pointer;opacity:.7}.wg__shortcuts-help-icon:hover{opacity:1;background:var(--wg-surface-2)}.wg__shortcuts-help-icon svg{width:16px;height:16px}.wg__shortcuts-help-overlay{display:none;position:absolute;top:100%;right:0;margin-top:var(--wg-spacing-xs);padding:var(--wg-spacing-md);background:var(--wg-surface-1);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-md);box-shadow:0 4px 16px #00000026;min-width:200px;max-width:300px;z-index:100}.wg__shortcuts-help--left .wg__shortcuts-help-overlay{right:auto;left:0}.wg__shortcuts-help:hover .wg__shortcuts-help-overlay,.wg__shortcuts-help:focus-within .wg__shortcuts-help-overlay{display:block}.wg__shortcuts-help-title{font-weight:var(--wg-font-weight-semibold);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1);margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-xs);border-bottom:1px solid var(--wg-border-color)}.wg__shortcuts-help-custom{margin-bottom:var(--wg-spacing-sm);padding-bottom:var(--wg-spacing-sm);border-bottom:1px solid var(--wg-border-color);font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg__shortcuts-help-list{display:flex;flex-direction:column;gap:var(--wg-spacing-xs)}.wg__shortcuts-help-item{display:flex;align-items:center;gap:var(--wg-spacing-md)}.wg__shortcuts-help-key{display:inline-flex;align-items:center;justify-content:center;min-width:28px;padding:2px 6px;font-family:var(--wg-font-family-mono);font-size:var(--wg-font-size-xs);font-weight:var(--wg-font-weight-semibold);color:var(--wg-text-color-1);background:var(--wg-surface-2);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm)}.wg__shortcuts-help-label{flex:1;font-size:var(--wg-font-size-sm);color:var(--wg-text-color-2)}.wg--striped tbody tr:nth-child(2n){background:var(--wg-row-bg-even)}.wg--hoverable tbody tr:hover{background:var(--wg-row-bg-hover)}.wg__empty{text-align:center;padding:var(--wg-empty-padding);color:var(--wg-empty-color);font-style:italic}.wg__loading-more{text-align:center;padding:var(--wg-cell-padding);color:var(--wg-text-color-2);font-size:var(--wg-font-size-sm)}.wg__tooltip{position:fixed;z-index:var(--wg-z-tooltip);max-width:300px;padding:var(--wg-tooltip-padding);background:var(--wg-tooltip-bg, #333);color:var(--wg-tooltip-color, #fff);font-size:var(--wg-font-size-sm);line-height:1.4;border-radius:var(--wg-border-radius-sm);box-shadow:var(--wg-tooltip-shadow);pointer-events:none;opacity:0;transition:opacity var(--wg-transition-fast)}.wg__tooltip--visible{opacity:1}.wg__tooltip-arrow{position:absolute;width:8px;height:8px;background:var(--wg-tooltip-bg, #333);transform:rotate(45deg)}.wg__tooltip[data-placement^=top] .wg__tooltip-arrow{bottom:-4px}.wg__tooltip[data-placement^=bottom] .wg__tooltip-arrow{top:-4px}.wg__tooltip[data-placement^=left] .wg__tooltip-arrow{right:-4px}.wg__tooltip[data-placement^=right] .wg__tooltip-arrow{left:-4px}.wg__tooltip-title{font-weight:600}.wg__tooltip-desc{opacity:.85;margin-top:2px}.wg__tooltip-shortcut{margin-top:4px;opacity:.7;font-size:.9em}.wg__goto-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0006;display:flex;align-items:center;justify-content:center;z-index:1000}.wg__goto-dialog{background:var(--wg-surface-1);border-radius:var(--wg-border-radius-md);padding:var(--wg-spacing-lg);box-shadow:0 4px 20px #00000026;min-width:250px}.wg__goto-label{display:block;margin-bottom:var(--wg-spacing-sm);font-size:var(--wg-font-size-base);color:var(--wg-text-color-1)}.wg__goto-input{width:100%;padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-base);margin-bottom:var(--wg-spacing-md);box-sizing:border-box}.wg__goto-input:focus{outline:none;border-color:var(--wg-accent-color);box-shadow:0 0 0 2px #0078d433}.wg__goto-buttons{display:flex;gap:var(--wg-spacing-sm);justify-content:flex-end}.wg__goto-btn{padding:var(--wg-spacing-sm) var(--wg-spacing-md);border:1px solid var(--wg-border-color);border-radius:var(--wg-border-radius-sm);font-family:inherit;font-size:var(--wg-font-size-sm);cursor:pointer;background:var(--wg-surface-1);color:var(--wg-text-color-1)}.wg__goto-btn:hover{background:var(--wg-surface-2)}.wg__goto-btn--go{background:var(--wg-accent-color);border-color:var(--wg-accent-color);color:#fff}.wg__goto-btn--go:hover{background:var(--wg-accent-color-hover, #106ebe)}.wg__spacer-top td,.wg__spacer-bottom td{padding:0;border:none;background:transparent;height:inherit;line-height:0}@media (prefers-color-scheme: dark){:host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86}}:host([data-theme="dark"]),[data-theme=dark] :host,:host([data-bs-theme="dark"]),[data-bs-theme=dark] :host,.dark :host{--wg-surface-1: #1f1f1f;--wg-surface-2: #2b2b2b;--wg-surface-3: #333333;--wg-surface-floating: #2b2b2b;--wg-text-color-1: #e0e0e0;--wg-text-color-2: #c0c0c0;--wg-text-color-3: #a0a0a0;--wg-border-color: #3d3d3d;--wg-border-color-hover: #5a5a5a;--wg-input-bg: #1f1f1f;--wg-input-border: 1px solid #5a5a5a;--wg-hover-bg: #3a3a3a;--wg-active-bg: #4a4a4a;--wg-danger-bg-light: #442726;--wg-danger-color: #f87c86}';function _t(o,e,t){const i=t.valueMember||"value",r=t.displayMember||"label",n=e.find(s=>s[i]===o);return n?String(n[r]??""):o!=null?String(o):""}function Ve(o,e){if(e.getDisplayCallback)return e.getDisplayCallback(o);const t=e.displayMember||"label";return String(o[t]??o.label??"")}function Ce(o,e){if(e.getValueCallback)return e.getValueCallback(o);const t=e.valueMember||"value";return o[t]??o.value}function gr(o,e){return e.getIconCallback?e.getIconCallback(o):e.iconMember&&o[e.iconMember]||null}function ur(o,e){return e.getSubtitleCallback?e.getSubtitleCallback(o):e.subtitleMember&&o[e.subtitleMember]||null}function Fe(o,e){return e.getDisabledCallback?e.getDisabledCallback(o):e.disabledMember?!!o[e.disabledMember]:!1}function Se(o,e,t,i){var n;Y(o);const r=document.createElement("div");if(r.className="wg__dropdown",r.style.cssText=`
|
|
297
|
+
position: fixed;
|
|
298
|
+
top: 0;
|
|
299
|
+
left: 0;
|
|
300
|
+
max-height: 200px;
|
|
301
|
+
overflow-y: auto;
|
|
302
|
+
z-index: 1000;
|
|
303
|
+
`,t.length===0){const s=o.isSearching?i.searchingText||o.grid.labels.dropdownSearching:i.noOptionsText||o.grid.labels.dropdownNoOptions;r.innerHTML=`<div class="wg__dropdown-empty">${o.escapeHtml(s)}</div>`}else{const s=o.grid.editingCell,a=s?(n=o.grid.displayItems[s.rowIndex])==null?void 0:n[s.field]:void 0,l=o.getCurrentEditingColumn(),d=(l==null?void 0:l.horizontalAlign)||"left";r.innerHTML=t.map((c,u)=>{const g=u===o.highlightedIndex,h=Ce(c,i)===a,f=Fe(c,i);if(i.renderOptionCallback){const b={index:u,isHighlighted:g,isSelected:h,isDisabled:f};return i.renderOptionCallback(c,b)}const p=Ve(c,i),v=gr(c,i),m=ur(c,i),y=["wg__dropdown-option",`wg__dropdown-option--align-${d}`];g&&y.push("wg__dropdown-option--highlighted"),h&&y.push("wg__dropdown-option--selected"),f&&y.push("wg__dropdown-option--disabled");const _=v?`<span class="wg__dropdown-option-icon">${o.escapeHtml(v)}</span>`:"",S=m?`<span class="wg__dropdown-option-subtitle">${o.escapeHtml(m)}</span>`:"";return`<div class="${y.join(" ")}" data-index="${u}" ${f?'data-disabled="true"':""}>
|
|
304
|
+
${_}
|
|
305
|
+
<div class="wg__dropdown-option-content">
|
|
306
|
+
<span class="wg__dropdown-option-label">${o.escapeHtml(p)}</span>
|
|
307
|
+
${S}
|
|
308
|
+
</div>
|
|
309
|
+
</div>`}).join("")}return o.shadow.appendChild(r),o.dropdownOpen=!0,Ie(e,r,{strategy:"fixed",placement:"bottom-start",middleware:[ut(1),Te({fallbackPlacements:["top-start"]}),Li({apply({rects:s}){Object.assign(r.style,{minWidth:i.dropdownMinWidth||`${s.reference.width}px`})}})]}).then(({x:s,y:a})=>{Object.assign(r.style,{left:`${s}px`,top:`${a}px`})}),r}function Y(o){const e=o.shadow.querySelector(".wg__dropdown");e==null||e.remove(),o.dropdownOpen=!1,o.highlightedIndex=-1,o.filterText=""}function vt(o,e,t,i,r,n){const s=i.editor==="select"||i.editor==="combobox"||i.editor==="autocomplete",a=i.editor==="date",l=String(i.field);if(s)return`
|
|
310
|
+
<div class="wg__cell-dropdown-display ${o.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-dropdown-display--toggle-on-focus":""}" data-row="${e}" data-field="${l}">
|
|
311
|
+
<span class="wg__select-value">${o.escapeHtml(r)}</span>
|
|
312
|
+
<span class="wg__select-toggle">▼</span>
|
|
313
|
+
</div>
|
|
314
|
+
`;if(a)return`
|
|
315
|
+
<div class="wg__cell-date-display ${o.grid.getEffectiveToggleVisibility(i)==="on-focus"?"wg__cell-date-display--toggle-on-focus":""}" data-row="${e}" data-field="${l}">
|
|
316
|
+
<span class="wg__date-value">${o.escapeHtml(r)}</span>
|
|
317
|
+
<button type="button" class="wg__date-trigger" tabindex="-1">
|
|
318
|
+
<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
|
|
319
|
+
</button>
|
|
320
|
+
</div>
|
|
321
|
+
`;const d=i.maxLines?`style="-webkit-line-clamp: ${i.maxLines}"`:"";return i.templateCallback?`<span class="wg__cell-text" ${d}>${r}</span>`:`<span class="wg__cell-text" ${d}>${o.escapeHtml(r)}</span>`}function W(o,e,t,i={}){const r=o.grid.columns[t];if(!r)return;const n=o.shadow.querySelector(`td[data-row="${e}"][data-col="${t}"]`);if(!n)return;const s=String(r.field),a=o.grid.displayItems[e];if(!a)return;const l=o.grid.isEditing(e,s),d=o.grid.isCellFocused(e,t),c=o.grid.isCellEditable(r),u=o.grid.isCellInvalid(e,s),g=["wg__cell"];if(c&&g.push("wg__cell--editable"),d&&!l&&g.push("wg__cell--focused"),r.textOverflow!=="wrap"&&g.push("wg__cell--ellipsis"),l&&g.push("wg__cell--editing"),u&&g.push("wg__cell--invalid"),r.cellClass&&g.push(r.cellClass),r.cellClassCallback){const h=o.grid.getCellRawValue(a,e,s),f=r.cellClassCallback(h,a);f&&g.push(f)}if(n.className=g.join(" "),l)n.innerHTML=et(o,e,t,r),i.focusEditor&&hr(o,n,r,i);else{const h=o.grid.getCellValue(a,r,e);n.innerHTML=vt(o,e,t,r,h)}}function hr(o,e,t,i){var n;let r=e.querySelector(".wg__combobox-input, .wg__autocomplete-input, .wg__select-trigger, .wg__date-input");if(r||(r=e.querySelector(".wg__editor")),!!r&&(r.focus(),r instanceof HTMLInputElement&&r.type==="text")){const s=i.cursorPosition,a=((n=t.editorOptions)==null?void 0:n.editStartSelection)||o.grid.editStartSelection;if(i.initialSearchQuery!==void 0){const l=r.value.length;r.setSelectionRange(l,l)}else switch(a){case"mousePosition":if(s!==void 0){const l=Math.min(s,r.value.length);r.setSelectionRange(l,l)}else r.setSelectionRange(r.value.length,r.value.length);break;case"cursorAtStart":r.setSelectionRange(0,0);break;case"cursorAtEnd":r.setSelectionRange(r.value.length,r.value.length);break;case"selectAll":default:r.select();break}}}const fr=5;function wr(o,e){var i,r;switch(e.editor||"text"){case"number":return typeof o=="number"&&!isNaN(o);case"select":case"combobox":{const n=(i=e.editorOptions)==null?void 0:i.options;if(!n||n.length===0)return!0;const s=((r=e.editorOptions)==null?void 0:r.valueMember)||"value";return n.some(a=>a[s]===o)}case"date":{if(o==null||o==="")return!0;if(o instanceof Date)return!isNaN(o.getTime());if(typeof o=="string"){if(!/\d{4}[-/]\d{1,2}[-/]\d{1,2}/.test(o)&&!/\d{1,2}[-/.]\d{1,2}[-/.]\d{2,4}/.test(o))return!1;const n=new Date(o);return!isNaN(n.getTime())}if(typeof o=="number"){const n=new Date("2000-01-01").getTime(),s=new Date("2100-01-01").getTime();if(o<n||o>s)return!1;const a=new Date(o);return!isNaN(a.getTime())}return!1}case"text":case"autocomplete":case"checkbox":case"custom":default:return!0}}let E={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:null,rangeElement:null},ge=null;function yt(o){const e=o.grid.focusedCell;if(!e||o.grid.editingCell){Ct();return}const{rowIndex:t,colIndex:i}=e,r=o.shadow.querySelector(`[data-row="${t}"][data-col="${i}"]`);if(!r){Ct();return}const n=o.shadow.querySelector(".wg");if(!n)return;if(!E.handleElement){const h=document.createElement("div");h.className="wg__fill-handle",n.appendChild(h),E.handleElement=h,h.addEventListener("mousedown",f=>pr(o,f))}const s=n.getBoundingClientRect(),a=r.getBoundingClientRect(),l=n.scrollLeft,d=n.scrollTop,c=8,u=a.right-s.left+l-c/2,g=a.bottom-s.top+d-c/2;E.handleElement.style.left=`${u}px`,E.handleElement.style.top=`${g}px`}function Ct(){E.handleElement&&(E.handleElement.remove(),E.handleElement=null)}function pr(o,e){var a;e.preventDefault(),e.stopPropagation();const t=o.grid.focusedCell;if(!t)return;const{rowIndex:i,colIndex:r}=t,s=(a=o.grid.visualColumns[r])==null?void 0:a.column;s&&(E={...E,isPending:!0,isDragging:!1,startRowIndex:i,startColIndex:r,startField:String(s.field),startX:e.clientX,startY:e.clientY,currentRowIndex:i,currentColIndex:r},ge=o,document.addEventListener("mousemove",go),document.addEventListener("mouseup",ho),document.addEventListener("keydown",fo))}function go(o){if(!ge)return;if(E.isPending){const t=o.clientX-E.startX,i=o.clientY-E.startY;Math.sqrt(t*t+i*i)>=fr&&mr(ge);return}if(!E.isDragging)return;const e=_r(ge,o.clientX,o.clientY);e&&(e.rowIndex!==E.currentRowIndex||e.colIndex!==E.currentColIndex)&&(E.currentRowIndex=e.rowIndex,E.currentColIndex=e.colIndex,uo(ge))}function mr(o){E.isPending=!1,E.isDragging=!0;const e=o.shadow.querySelector(".wg");e==null||e.classList.add("wg--filling"),br(o)}function br(o){const e=o.shadow.querySelector(".wg");if(!e)return;const t=document.createElement("div");t.className="wg__fill-range",e.appendChild(t),E.rangeElement=t,uo(o)}function uo(o){if(!E.rangeElement)return;const e=o.shadow.querySelector(".wg");if(!e)return;const{startRowIndex:t,startColIndex:i,currentRowIndex:r,currentColIndex:n}=E,s=Math.min(t,r),a=Math.max(t,r),l=Math.min(i,n),d=Math.max(i,n),c=o.shadow.querySelector(`[data-row="${s}"][data-col="${l}"]`),u=o.shadow.querySelector(`[data-row="${a}"][data-col="${d}"]`);if(!c||!u)return;const g=e.getBoundingClientRect(),h=c.getBoundingClientRect(),f=u.getBoundingClientRect(),p=e.scrollLeft,v=e.scrollTop,m=h.left-g.left+p,y=h.top-g.top+v,_=f.right-h.left,S=f.bottom-h.top;E.rangeElement.style.left=`${m}px`,E.rangeElement.style.top=`${y}px`,E.rangeElement.style.width=`${_}px`,E.rangeElement.style.height=`${S}px`}function ho(o){if(!ge)return;const e=ge;if(E.isPending){St(e);return}E.isDragging&&(yr(e),St(e))}function fo(o){o.key==="Escape"&&ge&&(o.preventDefault(),St(ge))}function _r(o,e,t){if(!o.shadow.querySelector(".wg"))return null;const r=o.shadow.querySelectorAll(".wg__cell[data-row][data-col]");for(const n of r){const s=n.getBoundingClientRect();if(e>=s.left&&e<=s.right&&t>=s.top&&t<=s.bottom){const a=parseInt(n.dataset.row||"-1",10),l=parseInt(n.dataset.col||"-1",10);if(a>=0&&l>=0)return{rowIndex:a,colIndex:l}}}return null}function vr(o,e,t,i){const r=t-o,n=i-e;return r===0&&n===0?"down":Math.abs(r)>=Math.abs(n)?r>0?"down":"up":n>0?"right":"left"}async function yr(o){var y,_;const{startRowIndex:e,startColIndex:t,currentRowIndex:i,currentColIndex:r,startField:n}=E,s=o.grid.visualColumns,a=(y=s[t])==null?void 0:y.column;if(!a)return;const l=o.grid.getRowDraft(e)??o.grid.displayItems[e];if(!l)return;const d=l[n],c=vr(e,t,i,r),u=a.fillDirection??o.grid.fillDirection,g=[],h=Math.min(e,i),f=Math.max(e,i),p=u==="vertical"?t:Math.min(t,r),v=u==="vertical"?t:Math.max(t,r);for(let S=h;S<=f;S++)for(let b=p;b<=v;b++){if(S===e&&b===t)continue;const C=(_=s[b])==null?void 0:_.column;if(!C)continue;const x=String(C.field);!o.grid.displayItems[S]||!(C.isEditable!==!1&&o.grid.isEditable)||wr(d,C)&&g.push({rowIndex:S,colIndex:b,field:x})}if(g.length===0)return;const m={sourceCell:{rowIndex:e,colIndex:t,field:n,value:d},targetCells:g,direction:c};if(!(o.grid.fillDragCallback&&o.grid.fillDragCallback(m)===!1))for(const S of g)await o.grid.commitEdit(S.rowIndex,S.field,d),W(o,S.rowIndex,S.colIndex)}function St(o){E.rangeElement&&(E.rangeElement.remove(),E.rangeElement=null);const e=o.shadow.querySelector(".wg");e==null||e.classList.remove("wg--filling"),document.removeEventListener("mousemove",go),document.removeEventListener("mouseup",ho),document.removeEventListener("keydown",fo),E={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:E.handleElement,rangeElement:null},ge=null}function Cr(o,e,t){if(o.grid.shouldUseVirtualScroll()){Sr(o,e);const s=o.shadow.querySelector(`[data-row="${e}"][data-col="${t}"]`);s&&s.focus({preventScroll:!0});return}const i=o.shadow.querySelector(`[data-row="${e}"][data-col="${t}"]`);if(!i)return;i.focus({preventScroll:!0}),i.scrollIntoView({block:"nearest",inline:"nearest"});const r=o.shadow.querySelector(".wg__header"),n=o.shadow.querySelector(".wg");if(r&&n){const s=r.getBoundingClientRect(),a=i.getBoundingClientRect();if(a.top<s.bottom){const l=a.top-s.bottom-4;n.scrollBy({top:l,behavior:"instant"})}}}function Sr(o,e){const t=o.shadow.querySelector(".wg");if(!t)return;const i=o.grid.virtualScrollRowHeight,r=t.scrollTop,n=t.clientHeight,s=o.shadow.querySelector(".wg__header"),a=(s==null?void 0:s.offsetHeight)||0,l=e*i,d=l+i,c=r+a,u=r+n;l<c?t.scrollTop=l-a:d>u&&(t.scrollTop=d-n)}let wo=0;const xr=100;function te(o,e,t){const i=e&&t&&e.rowIndex===t.rowIndex&&e.colIndex===t.colIndex,r=Date.now();if(i&&r-wo<xr)return;wo=r;const n=o.grid.editingCell;e&&(n&&n.rowIndex===e.rowIndex&&o.grid.columns.findIndex(a=>String(a.field)===n.field)===e.colIndex||W(o,e.rowIndex,e.colIndex)),t&&(n&&n.rowIndex===t.rowIndex&&o.grid.columns.findIndex(a=>String(a.field)===n.field)===t.colIndex||W(o,t.rowIndex,t.colIndex))}function J(o){const e=o.grid.editingCell;if(e){const t=o.grid.columns.findIndex(r=>String(r.field)===e.field),i=o.shadow.querySelector(`[data-row="${e.rowIndex}"][data-col="${t}"]`);i&&i.classList.remove("wg__cell--editing")}}function kr(o,e,t){W(o,e,t)}function Dr(o,e,t){if(!o.grid.isNavigateMode)return;const i=o.grid.focusedCell,r={rowIndex:e,colIndex:t};(i==null?void 0:i.rowIndex)===e&&(i==null?void 0:i.colIndex)===t||(o.grid.setFocusedCell(e,t),te(o,i,r))}function z(o,e,t){const i=o.grid.focusedCell,r={rowIndex:e,colIndex:t};o.grid.setFocusedCell(e,t),te(o,i,r),Cr(o,e,t)}function oe(o,e,t,i){const r=o.grid.columns[t];if(!r||!o.grid.isCellEditable(r))return;const n=String(r.field);o.dropdownOpen&&Y(o);const s=o.grid.focusedCell;s&&(s.rowIndex!==e||s.colIndex!==t)&&(o.grid.clearFocusedCell(),W(o,s.rowIndex,s.colIndex)),o.grid.startEdit(e,n,i),W(o,e,t,{focusEditor:!0,cursorPosition:i==null?void 0:i.cursorPosition,initialSearchQuery:i==null?void 0:i.initialSearchQuery})}function xt(o,e){const t=e.querySelector(".wg__cell-text");if(!t)return null;const i=t.textContent||"";if(!i.length)return 0;const r=o.clientX,n=t.getBoundingClientRect();if(r<=n.left)return 0;if(r>=n.right)return i.length;const s=t.firstChild;if(!s||s.nodeType!==Node.TEXT_NODE)return null;const a=document.createRange();let l=0,d=i.length;try{for(;l<d;){const c=Math.floor((l+d)/2);a.setStart(s,0),a.setEnd(s,c),a.getBoundingClientRect().right<r?l=c+1:d=c}if(l>0&&l<i.length){a.setStart(s,l-1),a.setEnd(s,l);const c=a.getBoundingClientRect(),u=c.left+c.width/2;r<u&&l--}}catch{return i.length}return l}function Er(o,e){const t=e.relatedTarget,i=o.shadow.querySelector(".wg__table");if(!t||!(i!=null&&i.contains(t))){const r=o.grid.focusedCell;o.grid.clearFocusedCell(),te(o,r,null),Ct()}}function Rr(o,e){if(!o)return null;const[t,i,r]=o.split("-").map(Number),n=new Date(t,i-1,r);if(isNaN(n.getTime()))return null;switch(e){case"date":return n;case"timestamp":return n.getTime();case"iso":default:return o}}function kt(o,e,t){W(o,e,t)}function Ze(o,e){const t=parseInt(e.dataset.row||"0",10),i=e.dataset.field||"";let r;if(e instanceof HTMLInputElement)if(e.type==="checkbox"){const n=JSON.parse(e.dataset.trueValue||"true"),s=JSON.parse(e.dataset.falseValue||"false");r=e.checked?n:s}else e.classList.contains("wg__editor--number")?r=e.value===""?null:parseFloat(e.value):e.type==="date"?r=Rr(e.value,e.dataset.outputFormat||"iso"):r=e.value;else e instanceof HTMLSelectElement&&(r=e.value);o.grid.commitEdit(t,i,r)}function $r(o,e){Ze(o,e)}function Mr(o,e,t){const i=o.grid.columns[t];if(!i)return;const r=String(i.field),n=o.grid.displayItems[e];if(!n)return;const s=i.editorOptions||{},a=s.trueValue??!0,l=s.falseValue??!1,c=n[r]===a?l:a;o.grid.commitEdit(e,r,c),W(o,e,t);const u=o.grid.displayItems;e<u.length-1&&requestAnimationFrame(()=>{z(o,e+1,t)})}function Tr(o,e){if(!o.isCommittingFromKeyboard&&o.grid.editingCell){const t=parseInt(e.dataset.row||"0",10),i=e.dataset.field||"",r=o.grid.columns.findIndex(n=>String(n.field)===i);Ze(o,e),r>=0&&kt(o,t,r)}}function Dt(o,e,t,i){const n=o.grid.columns.findIndex(d=>String(d.field)===t),s=o.grid.displayItems;let a=e,l=n;if(i==="down")a=Math.min(e+1,s.length-1);else if(i==="up")a=Math.max(e-1,0);else{const d=o.grid.getEditableColumns(),c=d.findIndex(u=>u.index===n);i==="next"?c>=0&&c<d.length-1?l=d[c+1].index:e<s.length-1&&(a=e+1,l=d[0].index):c>0?l=d[c-1].index:e>0&&(a=e-1,l=d[d.length-1].index)}kt(o,e,n),z(o,a,l),o.isCommittingFromKeyboard=!1}function Ir(o,e,t){const r=o.grid.columns.findIndex(n=>String(n.field)===t);r>=0&&(kt(o,e,r),z(o,e,r),o.isCommittingFromKeyboard=!1)}function et(o,e,t,i){const r=String(i.field),n=o.grid.displayItems[e],s=o.grid.getCellRawValue(n,e,r);switch(i.editor||"text"){case"checkbox":return Pr(o,e,r,s,i);case"number":return Lr(o,e,r,s,i);case"date":return Ar(o,e,r,s,i);case"select":return Hr(o,e,r,s,i);case"combobox":return Vr(o,e,r,s,i);case"autocomplete":return Fr(o,e,r,s,i);case"custom":return qr(o,e,r,s,i);case"text":default:return zr(o,e,r,s,i)}}function zr(o,e,t,i,r){var l;const n=r.editorOptions||{},s=(l=o.grid.editingCell)==null?void 0:l.initialSearchQuery,a=s!==void 0?s:i!=null?String(i):"";return`
|
|
322
|
+
<input
|
|
323
|
+
type="text"
|
|
324
|
+
class="wg__editor wg__editor--text"
|
|
325
|
+
value="${o.escapeHtml(a)}"
|
|
326
|
+
data-row="${e}"
|
|
327
|
+
data-field="${t}"
|
|
328
|
+
${n.maxLength?`maxlength="${n.maxLength}"`:""}
|
|
329
|
+
${n.placeholder?`placeholder="${o.escapeHtml(n.placeholder)}"`:""}
|
|
330
|
+
${n.pattern?`pattern="${o.escapeHtml(n.pattern)}"`:""}
|
|
331
|
+
/>
|
|
332
|
+
`}function Lr(o,e,t,i,r){var a;r.editorOptions;const n=(a=o.grid.editingCell)==null?void 0:a.initialSearchQuery;return`
|
|
333
|
+
<input
|
|
334
|
+
type="text"
|
|
335
|
+
inputmode="numeric"
|
|
336
|
+
class="wg__editor wg__editor--number"
|
|
337
|
+
value="${n!==void 0?n:i!=null?String(i):""}"
|
|
338
|
+
data-row="${e}"
|
|
339
|
+
data-field="${t}"
|
|
340
|
+
/>
|
|
341
|
+
`}function Ar(o,e,t,i,r){var d;const n=r.editorOptions||{},s=(d=o.grid.editingCell)==null?void 0:d.initialSearchQuery,a=Et(i),l=s!==void 0?s:Or(i,n.dateFormat);return`
|
|
342
|
+
<div class="wg__editor wg__editor--date" data-row="${e}" data-field="${t}">
|
|
343
|
+
<input
|
|
344
|
+
type="text"
|
|
345
|
+
class="wg__date-input"
|
|
346
|
+
value="${o.escapeHtml(l)}"
|
|
347
|
+
data-row="${e}"
|
|
348
|
+
data-field="${t}"
|
|
349
|
+
data-date-value="${a}"
|
|
350
|
+
data-output-format="${n.outputFormat||"iso"}"
|
|
351
|
+
data-date-format="${n.dateFormat||"YYYY-MM-DD"}"
|
|
352
|
+
${n.minDate?`data-min-date="${Et(n.minDate)}"`:""}
|
|
353
|
+
${n.maxDate?`data-max-date="${Et(n.maxDate)}"`:""}
|
|
354
|
+
placeholder="${o.escapeHtml(n.dateFormat||"YYYY-MM-DD")}"
|
|
355
|
+
/>
|
|
356
|
+
<button type="button" class="wg__date-trigger" tabindex="-1">
|
|
357
|
+
<svg viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z"/></svg>
|
|
358
|
+
</button>
|
|
359
|
+
</div>
|
|
360
|
+
`}function Or(o,e){if(!o)return"";let t=null;if(o instanceof Date?t=o:typeof o=="number"?t=new Date(o):typeof o=="string"&&(t=new Date(o)),!t||isNaN(t.getTime()))return"";const i=e||"YYYY-MM-DD",r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return i.replace("YYYY",String(r)).replace("YY",String(r).slice(-2)).replace("MM",n).replace("DD",s)}function Et(o){if(!o)return"";let e=null;if(o instanceof Date?e=o:typeof o=="number"?e=new Date(o):typeof o=="string"&&(e=new Date(o)),!e||isNaN(e.getTime()))return"";const t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${i}-${r}`}function Pr(o,e,t,i,r){const n=r.editorOptions||{},s=n.trueValue!==void 0?n.trueValue:!0;return`
|
|
361
|
+
<input
|
|
362
|
+
type="checkbox"
|
|
363
|
+
class="wg__editor wg__editor--checkbox"
|
|
364
|
+
${i===s?"checked":""}
|
|
365
|
+
data-row="${e}"
|
|
366
|
+
data-field="${t}"
|
|
367
|
+
data-true-value="${o.escapeHtml(JSON.stringify(n.trueValue??!0))}"
|
|
368
|
+
data-false-value="${o.escapeHtml(JSON.stringify(n.falseValue??!1))}"
|
|
369
|
+
/>
|
|
370
|
+
`}function Hr(o,e,t,i,r){var d;const n=r.editorOptions||{},s=n.options||[],a=_t(i,s,n),l=(d=o.grid.editingCell)==null?void 0:d.initialSearchQuery;return o.dropdownOptions=s,o.filterText=l||"",o.highlightedIndex=s.findIndex(c=>Ce(c,n)===i),o.highlightedIndex<0&&s.length>0&&(o.highlightedIndex=0),`
|
|
371
|
+
<div
|
|
372
|
+
class="wg__editor wg__editor--select wg__select-trigger"
|
|
373
|
+
tabindex="0"
|
|
374
|
+
role="combobox"
|
|
375
|
+
aria-haspopup="listbox"
|
|
376
|
+
data-row="${e}"
|
|
377
|
+
data-field="${t}"
|
|
378
|
+
>
|
|
379
|
+
<span class="wg__select-value">${o.escapeHtml(a)}</span>
|
|
380
|
+
<span class="wg__select-toggle">▼</span>
|
|
381
|
+
</div>
|
|
382
|
+
`}function Vr(o,e,t,i,r){var c;const n=r.editorOptions||{},s=n.options||[],a=_t(i,s,n),l=(c=o.grid.editingCell)==null?void 0:c.initialSearchQuery,d=l!==void 0?l:a;return o.dropdownOptions=s,o.filterText=d,o.highlightedIndex=s.length>0?0:-1,`
|
|
383
|
+
<div class="wg__editor wg__editor--combobox" data-row="${e}" data-field="${t}">
|
|
384
|
+
<input
|
|
385
|
+
type="text"
|
|
386
|
+
class="wg__combobox-input"
|
|
387
|
+
value="${o.escapeHtml(d)}"
|
|
388
|
+
data-row="${e}"
|
|
389
|
+
data-field="${t}"
|
|
390
|
+
/>
|
|
391
|
+
<span class="wg__combobox-toggle">▼</span>
|
|
392
|
+
</div>
|
|
393
|
+
`}function Fr(o,e,t,i,r){var c;const n=r.editorOptions||{},s=n.initialOptions||n.options||[],a=_t(i,s,n),l=(c=o.grid.editingCell)==null?void 0:c.initialSearchQuery,d=l!==void 0?l:a;return o.dropdownOptions=s,o.filterText=d,o.highlightedIndex=s.length>0?0:-1,`
|
|
394
|
+
<div class="wg__editor wg__editor--autocomplete" data-row="${e}" data-field="${t}">
|
|
395
|
+
<input
|
|
396
|
+
type="text"
|
|
397
|
+
class="wg__autocomplete-input"
|
|
398
|
+
value="${o.escapeHtml(d)}"
|
|
399
|
+
placeholder="${o.escapeHtml(n.placeholder||"")}"
|
|
400
|
+
data-row="${e}"
|
|
401
|
+
data-field="${t}"
|
|
402
|
+
/>
|
|
403
|
+
<span class="wg__combobox-toggle">▼</span>
|
|
404
|
+
<span class="wg__loading-indicator" style="display: none;">⏳</span>
|
|
405
|
+
</div>
|
|
406
|
+
`}function qr(o,e,t,i,r){const n=r.formatCallback?r.formatCallback(i,o.grid.displayItems[e]):i!=null?String(i):"";return`
|
|
407
|
+
<div
|
|
408
|
+
class="wg__editor wg__editor--custom"
|
|
409
|
+
tabindex="0"
|
|
410
|
+
data-row="${e}"
|
|
411
|
+
data-field="${t}"
|
|
412
|
+
>
|
|
413
|
+
<span class="wg__custom-value">${o.escapeHtml(n)}</span>
|
|
414
|
+
</div>
|
|
415
|
+
`}let B={path:null,arrowPos:null,arrowDir:"right"};const Nr={add:{icon:"+",title:"Add row"},delete:{icon:"−",title:"Delete row",danger:!0},duplicate:{icon:"⧉",title:"Duplicate row"},moveUp:{icon:"↑",title:"Move up"},moveDown:{icon:"↓",title:"Move down"}};function Rt(o){return o.map((e,t)=>{if(typeof e=="string"){const i=Nr[e];return i?{id:e,icon:i.icon,title:i.title,row:1,group:1,type:e,danger:i.danger}:(console.warn(`Unknown predefined toolbar action: ${e}`),null)}return{id:e.id||`toolbar-item-${t}`,icon:e.icon,title:e.title,label:e.label,row:e.row??1,group:e.group??1,type:e.type,danger:e.danger,disabled:e.disabled,hidden:e.hidden,onclick:e.onclick,tooltip:e.tooltip,tooltipCallback:e.tooltipCallback}}).filter(e=>e!==null)}function Yr(o){const e=new Map;for(const r of o){const n=r.row;e.has(n)||e.set(n,[]),e.get(n).push(r)}const t=[],i=[...e.keys()].sort((r,n)=>r-n);for(const r of i){const n=e.get(r),s=new Map;for(const l of n){const d=l.group;s.has(d)||s.set(d,[]),s.get(d).push(l)}const a=[...s.keys()].sort((l,d)=>l-d);t.push({rowNum:r,groups:a.map(l=>({groupNum:l,items:s.get(l)}))})}return t}function Wr(o){return o.replace(/\+/g," + ")}function Br(o,e){var r,n;const t=[];t.push(`<span class="wg__tooltip-title">${o.title}</span>`),(r=o.tooltip)!=null&&r.description&&t.push(`<div class="wg__tooltip-desc">${o.tooltip.description}</div>`);const i=((n=o.tooltip)==null?void 0:n.shortcut)||e;return i&&t.push(`<div class="wg__tooltip-shortcut">${Wr(i)}</div>`),t.join("")}function Ur(o,e,t,i=!1){let r=Yr(o);return i&&(r=r.reverse()),`<div class="wg__toolbar">${r.map(({groups:s})=>`<div class="wg__toolbar-row">${s.map(({items:l},d)=>{const c=d>0?'<div class="wg__toolbar-divider"></div>':"",u=l.map(g=>{const h=typeof g.disabled=="function"?g.disabled(e,t):g.disabled,f=["wg__toolbar-btn",g.danger?"wg__toolbar-btn--danger":""].filter(Boolean).join(" "),p=g.label?`<span class="wg__toolbar-label">${g.label}</span>`:"";return`<button
|
|
416
|
+
class="${f}"
|
|
417
|
+
data-toolbar-item="${g.id}"
|
|
418
|
+
title="${g.title}"
|
|
419
|
+
${h?"disabled":""}
|
|
420
|
+
>${g.icon}${p}</button>`}).join("");return c+u}).join("")}</div>`).join("")}</div>`}let P=null;function jr(o,e,t,i,r,n,s){tt();const a=o.grid.toolbarVerticalAlign!=="top",l=Ur(i,r,t,a),d=document.createElement("div");d.className="wg__toolbar-container",d.innerHTML=l,o.shadow.appendChild(d);const c=d.querySelector(".wg__toolbar");let u="left";c.style.position="fixed",c.style.visibility="hidden",requestAnimationFrame(()=>{const h=o.shadow.querySelector(`tr[data-row-index="${t}"]`);if(!h){tt();return}const f=o.grid.toolbarPosition,p=o.grid.toolbarVerticalAlign,v=o.grid.toolbarHorizontalAlign;let m,y,_="";p==="top"?_="-end":p==="bottom"&&(_="-start");const S=()=>v==="start"?"top-start":v==="end"?"top-end":"top";f==="left"?(m=`left${_}`,y=[`right${_}`,S()]):f==="right"?(m=`right${_}`,y=[`left${_}`,S()]):f==="top"?(m=S(),y=[`left${_}`,`right${_}`]):(m=`left${_}`,y=[`right${_}`,S()]);let b=h;if(v==="cursor"&&s!==void 0&&f==="top"){const C=h.getBoundingClientRect();b={getBoundingClientRect:()=>({x:s,y:C.top,top:C.top,left:s,bottom:C.bottom,right:s,width:0,height:C.height,toJSON:()=>({})})}}Ie(b,c,{strategy:"fixed",placement:m,middleware:[Te({fallbackPlacements:y}),Qe({padding:8})]}).then(({x:C,y:x,placement:k})=>{Object.assign(c.style,{left:`${C}px`,top:`${x}px`,visibility:"visible"}),u=k.split("-")[0],P&&(P.position=u)}).catch(()=>{c.style.visibility="visible"})});const g=h=>{const f=h.target.closest(".wg__toolbar-btn");if(f&&!f.disabled){const p=f.dataset.toolbarItem||"",v=i.find(m=>m.id===p);v&&n(v)}};d.addEventListener("click",g),P={container:d,toolbar:c,rowIndex:t,rowItem:r,position:u,hasRowMoved:!1,cursorX:s,cleanup:()=>{d.removeEventListener("click",g),d.remove()}},B={path:null,arrowPos:null,arrowDir:"right"}}function tt(){P&&(P.cleanup(),P=null),B={path:null,arrowPos:null,arrowDir:"right"}}function Le(){return(P==null?void 0:P.rowIndex)??null}function po(o){return(P==null?void 0:P.container.getRootNode())===o}function $t(o){return(P==null?void 0:P.rowIndex)===o}function Kr(){return B}function mo(o,e){if(!P){B={path:null,arrowPos:null,arrowDir:"right"};return}const{toolbar:t,rowItem:i,position:r}=P,n=e.findIndex(b=>b===i);if(n===-1){B={path:null,arrowPos:null,arrowDir:"right"};return}const s=o.shadow.querySelector(`tr[data-row-index="${n}"]`);if(!s){B={path:null,arrowPos:null,arrowDir:"right"};return}if(n===P.rowIndex||(P.hasRowMoved=!0),!P.hasRowMoved){B={path:null,arrowPos:null,arrowDir:"right"};return}const l=t.getBoundingClientRect(),d=s.getBoundingClientRect(),c=o.shadow.querySelector(".wg__table"),u=c==null?void 0:c.getBoundingClientRect(),g=o.shadow.querySelector(".wg"),h=g==null?void 0:g.getBoundingClientRect();if(!u||!h){B={path:null,arrowPos:null,arrowDir:"right"};return}const f=document.dir==="rtl"||document.documentElement.dir==="rtl",p=d.top+d.height/2,v=d.bottom<=h.top,m=d.top>=h.bottom,y=!v&&!m;let _,S="right";if(v?(_=h.top+8,S="up"):m?(_=h.bottom-8,S="down"):_=p,r==="left"){const b=l.right,C=l.top+l.height/2,x=f?h.right+15:h.left-15;if(!y){B={path:`M ${b} ${C} H ${x} V ${_}`,arrowPos:{x,y:_},arrowDir:S};return}const k=f?h.right-8:h.left+8;S=f?"left":"right",B={path:`M ${b} ${C} H ${x} V ${_} H ${k}`,arrowPos:{x:k,y:_},arrowDir:S};return}else if(r==="right"){const b=l.left,C=l.top+l.height/2,x=f?h.left-15:h.right+15;if(!y){B={path:`M ${b} ${C} H ${x} V ${_}`,arrowPos:{x,y:_},arrowDir:S};return}const k=f?h.left+8:h.right-8;S=f?"right":"left",B={path:`M ${b} ${C} H ${x} V ${_} H ${k}`,arrowPos:{x:k,y:_},arrowDir:S};return}else{const C=l.right,x=l.top+l.height/2,k=C+48,T=n-P.rowIndex,$=8;if(T===0){let I=d.top-$;m&&(I=h.bottom-$),B={path:`M ${C} ${x} H ${k} V ${I}`,arrowPos:{x:k,y:I},arrowDir:"down"};return}else if(T===-1){const L=l.top+l.height*.25,q=l.top+l.height*.75,M=l.right+24,U=l.right+$;B={path:`M ${l.right} ${L} H ${M} V ${q} H ${U}`,arrowPos:{x:U,y:q},arrowDir:"left"};return}else if(T<0){let I=d.bottom+$;v&&(I=h.top+$),B={path:`M ${C} ${x} H ${k} V ${I}`,arrowPos:{x:k,y:I},arrowDir:"up"};return}else{let I=d.top-$;m&&(I=h.bottom-$),B={path:`M ${C} ${x} H ${k} V ${I}`,arrowPos:{x:k,y:I},arrowDir:"down"};return}}}function bo(o,e,t="Row actions"){return`<button
|
|
421
|
+
class="wg__toolbar-trigger ${e?"wg__toolbar-trigger--active":""}"
|
|
422
|
+
data-toolbar-trigger="${o}"
|
|
423
|
+
title="${t}"
|
|
424
|
+
>⋮</button>`}const Mt=40;function Tt(o){if(!o||o==="auto")return 150;const e=o.match(/^([\d.]+)(px|em|rem|%)?$/);if(!e)return 150;const t=parseFloat(e[1]);switch(e[2]||"px"){case"px":return t;case"em":return t*16;case"rem":return t*10;case"%":return 150;default:return t}}function Xr(o){const e=["wg"];return o.grid.isStriped&&e.push("wg--striped"),o.grid.isHoverable&&e.push("wg--hoverable"),o.grid.isEditable&&e.push("wg--editable"),o.grid.isNavigateMode&&e.push("wg--navigate-mode"),o.grid.isColumnReorderAllowed&&e.push("wg--reorderable"),e.join(" ")}function Gr(o){const e=o.grid.visualColumns;if(e.length===0)return"";let t=0,i="";if(o.grid.isRowNumbersVisible){const d=o.grid.isStickyRowNumbers;i=`<th class="wg__header wg__row-number-header${d?" wg__header--frozen":""}" style="${d?"position: sticky; left: 0; z-index: 4;":""}">#</th>`,t+=Mt}const n=o.grid.isRowToolbarVisible&&o.grid.toolbarPosition==="inline"?`<th class="wg__header wg__inline-actions-header">${o.escapeHtml(o.grid.inlineActionsTitle||o.grid.labels.inlineActionsHeader)}</th>`:"",a=o.grid.isRowToolbarVisible&&o.grid.toolbarTrigger==="button"&&o.grid.toolbarPosition!=="inline"?'<th class="wg__header wg__actions-column"></th>':"",l=e.map(({column:d,originalIndex:c},u)=>{const g=String(d.field),h=d.isSortable!==!1&&o.grid.sortMode!=="none",f=o.grid.getColumnSortState(g),p=o.grid.getColumnSortPriority(g),v=f!==void 0,m=o.grid.isColumnFrozen(u),y=m&&u===o.grid.totalFrozenColumns-1,_=["wg__header"];h&&_.push("wg__header--sortable"),v&&_.push("wg__header--sorted"),m&&_.push("wg__header--frozen"),y&&_.push("wg__header--frozen-last");const b=o.grid.getColumnWidth(g)||d.width||d.maxWidth,C=Tt(b),x=d.minWidth,k=d.headerHorizontalAlign||d.horizontalAlign||"left",T=d.headerVerticalAlign||d.verticalAlign||"middle",I=`style="${[m?"position: sticky":"",m?`left: ${t}px`:"",m?"z-index: 2":"",b?`width: ${b}`:"",b?`max-width: ${b}`:"",x?`min-width: ${x}`:"",`text-align: ${k}`,`vertical-align: ${T}`].filter(Boolean).join("; ")}"`;m&&(t+=C);let L="";if(h)if(v){const D=f.direction==="asc"?"▲":"▼",A=o.grid.sort.length>1?`<sup class="wg__sort-priority">${p}</sup>`:"";L=`<span class="wg__sort-indicator">${D}${A}</span>`}else L='<span class="wg__sort-indicator wg__sort-placeholder">⬍</span>';let q="";d.headerInfo&&(q=`<span class="wg__header-info" data-tooltip="${o.escapeHtml(d.headerInfo)}"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg></span>`);const U=`<div class="wg__resize-handle${d.isResizable!==!1?"":" wg__resize-handle--disabled"}" data-field="${g}"></div>`;return`
|
|
425
|
+
<th class="${_.join(" ")}" ${I} data-field="${g}">
|
|
426
|
+
<div class="wg__header-container">
|
|
427
|
+
<div class="wg__header-content wg__header-content--align-${k} wg__header-content--valign-${T}">
|
|
428
|
+
<span class="wg__header-title">${o.escapeHtml(d.title)}</span>
|
|
429
|
+
${q}
|
|
430
|
+
</div>
|
|
431
|
+
<div class="wg__header-controls">
|
|
432
|
+
${L}
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
${U}
|
|
436
|
+
</th>
|
|
437
|
+
`}).join("");return`<tr>${i}${n}${a}${l}<th class="wg__filler"> </th></tr>`}function Qr(o){const e=o.grid.displayItems,t=o.grid.visualColumns,i=o.grid.isRowNumbersVisible,r=o.grid.isStickyRowNumbers,n=o.grid.isRowToolbarVisible&&o.grid.toolbarPosition==="inline",s=o.grid.isRowToolbarVisible&&o.grid.toolbarTrigger==="button"&&o.grid.toolbarPosition!=="inline",a=t.length+(s?1:0)+(i?1:0)+(n?1:0);if(e.length===0)return`
|
|
438
|
+
<tr>
|
|
439
|
+
<td class="wg__empty" colspan="${a}">
|
|
440
|
+
No items to display
|
|
441
|
+
</td>
|
|
442
|
+
</tr>
|
|
443
|
+
`;const l=Le(),d=t.map(({column:c})=>Tt(c.width||c.maxWidth));return e.map((c,u)=>{const g=o.grid.getRowLockInfo(c),h=(g==null?void 0:g.isLocked)===!0;let f=0,p="";if(i){const b=r?"position: sticky; left: 0; z-index: 2;":"",C=r?" wg__cell--frozen":"";if(h){const x=g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked";p=`<td class="wg__cell wg__row-number wg__row-number--locked${C}" style="${b}" data-tooltip="${o.escapeHtml(x)}" data-row-number="${u}">🔒</td>`}else p=`<td class="wg__cell wg__row-number${C}" style="${b}" data-row-number="${u}">${u+1}</td>`;f+=Mt}const v=n?_o(o,c,u):"";let m="";s&&(m=`
|
|
444
|
+
<td class="wg__cell wg__actions-column">
|
|
445
|
+
${bo(u,l===u,o.grid.labels.rowActions)}
|
|
446
|
+
</td>
|
|
447
|
+
`);const y=t.map(({column:b,originalIndex:C},x)=>{const k=String(b.field),T=o.grid.getCellValue(c,b,u),$=b.horizontalAlign||"left",I=b.verticalAlign||"middle",L=o.grid.isCellEditable(b),q=o.grid.isCellFocused(u,C),M=o.grid.isColumnFrozen(x),U=M&&x===o.grid.totalFrozenColumns-1,D=["wg__cell"],A=o.grid.isEditing(u,k);if(L&&D.push("wg__cell--editable"),q&&!A&&D.push("wg__cell--focused"),b.textOverflow!=="wrap"&&D.push("wg__cell--ellipsis"),b.maxLines&&D.push("wg__cell--line-clamp"),A&&D.push("wg__cell--editing"),o.grid.isCellInvalid(u,k)&&D.push("wg__cell--invalid"),M&&D.push("wg__cell--frozen"),U&&D.push("wg__cell--frozen-last"),b.cellClass&&D.push(b.cellClass),b.cellClassCallback){const ee=o.grid.getCellRawValue(c,u,k),j=b.cellClassCallback(ee,c);j&&D.push(j)}const O=o.grid.getColumnWidth(k)||b.width,Ae=b.minWidth,Ht=[M?"position: sticky":"",M?`left: ${f}px`:"",M?"z-index: 1":"",`text-align: ${$}`,`vertical-align: ${I}`,O?`width: ${O}`:"",Ae?`min-width: ${Ae}`:"",b.maxWidth?`max-width: ${b.maxWidth}`:""].filter(Boolean).join("; ");M&&(f+=d[x]);const Vt=o.grid.isNavigateMode?'tabindex="0"':"";let pe="";if(b.tooltipCallback){const ee=o.grid.getCellRawValue(c,u,k),j=b.tooltipCallback(ee,c);j&&(pe=`data-tooltip="${o.escapeHtml(j)}"`)}else if(b.tooltipMember){const ee=c[b.tooltipMember];ee&&typeof ee=="string"&&(pe=`data-tooltip="${o.escapeHtml(ee)}"`)}if(!pe&&o.grid.isCellInvalid(u,k)){const ee=o.grid.getCellValidationError(u,k);if(ee){const j=b.validationTooltipCallback||o.grid.validationTooltipCallback;if(j){const Ft=o.grid.getCellRawValue(c,u,k),X=j({field:k,error:ee,value:Ft,row:c,rowIndex:u});X&&(pe=`data-tooltip-html="${o.escapeHtml(X)}"`)}pe||(pe=`data-tooltip="${o.escapeHtml(ee)}"`)}}return`
|
|
448
|
+
<td
|
|
449
|
+
class="${D.join(" ")}"
|
|
450
|
+
style="${Ht}"
|
|
451
|
+
data-row="${u}"
|
|
452
|
+
data-col="${C}"
|
|
453
|
+
data-field="${k}"
|
|
454
|
+
${Vt}
|
|
455
|
+
${pe}
|
|
456
|
+
>
|
|
457
|
+
${o.grid.isEditing(u,k)?et(o,u,C,b):vt(o,u,C,b,T)}
|
|
458
|
+
</td>
|
|
459
|
+
`}).join(""),_=["wg__row"];if(h&&_.push("wg__row--locked"),o.grid.isRowSelected(u)&&_.push("wg__row--selected"),o.grid.rowClassCallback){const b=o.grid.rowClassCallback(c,u);b&&_.push(b)}const S=h&&!i?`data-tooltip="${o.escapeHtml(g!=null&&g.lockedBy?`Locked by ${g.lockedBy}`:"This row is locked")}"`:"";return`<tr class="${_.join(" ")}" data-row-index="${u}" ${S}>${p}${v}${m}${y}<td class="wg__filler"></td></tr>`}).join("")}function _o(o,e,t){const r=Rt(o.grid.rowToolbar).filter(l=>typeof l.hidden=="function"?!l.hidden(e,t):!l.hidden),n=new Map;for(const l of r){const d=l.row??1;n.has(d)||n.set(d,[]),n.get(d).push(l)}return`<td class="wg__cell wg__inline-actions-cell"><div class="wg__inline-actions-wrap">${[...n.keys()].sort((l,d)=>l-d).map(l=>`<div class="wg__inline-actions-row">${n.get(l).map(u=>{const g=typeof u.disabled=="function"?u.disabled(e,t):u.disabled,h=["wg__inline-action-btn",u.danger?"wg__inline-action-btn--danger":"",g?"wg__inline-action-btn--disabled":""].filter(Boolean).join(" "),f=g?"disabled":"";return`<button class="${h}" data-action-id="${u.id}" data-row="${t}" title="${o.escapeHtml(u.title)}" ${f}>${u.icon}</button>`}).join("")}</div>`).join("")}</div></td>`}function vo(o,e){const t=o.grid.displayItems,i=o.grid.visualColumns,{startIndex:r,endIndex:n,rowHeight:s,totalItems:a}=e,l=o.grid.isRowNumbersVisible,d=o.grid.isStickyRowNumbers,c=o.grid.isRowToolbarVisible&&o.grid.toolbarPosition==="inline",u=o.grid.isRowToolbarVisible&&o.grid.toolbarTrigger==="button"&&o.grid.toolbarPosition!=="inline",g=i.length+(u?1:0)+(l?1:0)+(c?1:0);if(t.length===0)return`
|
|
460
|
+
<tr>
|
|
461
|
+
<td class="wg__empty" colspan="${g}">
|
|
462
|
+
No items to display
|
|
463
|
+
</td>
|
|
464
|
+
</tr>
|
|
465
|
+
`;const h=Le(),f=i.map(({column:S})=>Tt(S.width||S.maxWidth)),p=r*s,v=(a-n)*s,m=p>0?`<tr class="wg__spacer-top"><td colspan="${g}" style="height: ${p}px"></td></tr>`:"",y=[];for(let S=r;S<n&&S<t.length;S++){const b=t[S],C=S,x=o.grid.getRowLockInfo(b),k=(x==null?void 0:x.isLocked)===!0;let T=0,$="";if(l){const D=d?"position: sticky; left: 0; z-index: 2;":"",A=d?" wg__cell--frozen":"";if(k){const N=x!=null&&x.lockedBy?`Locked by ${x.lockedBy}`:"This row is locked";$=`<td class="wg__cell wg__row-number wg__row-number--locked${A}" style="${D}" data-tooltip="${o.escapeHtml(N)}" data-row-number="${C}">🔒</td>`}else $=`<td class="wg__cell wg__row-number${A}" style="${D}" data-row-number="${C}">${C+1}</td>`;T+=Mt}const I=c?_o(o,b,C):"";let L="";u&&(L=`
|
|
466
|
+
<td class="wg__cell wg__actions-column">
|
|
467
|
+
${bo(C,h===C,o.grid.labels.rowActions)}
|
|
468
|
+
</td>
|
|
469
|
+
`);const q=i.map(({column:D,originalIndex:A},N)=>{const O=String(D.field),Ae=o.grid.getCellValue(b,D,C),Ht=D.horizontalAlign||"left",Vt=D.verticalAlign||"middle",pe=o.grid.isCellEditable(D),ee=o.grid.isCellFocused(C,A),j=o.grid.isColumnFrozen(N),Ft=j&&N===o.grid.totalFrozenColumns-1,X=["wg__cell"],Fo=o.grid.isEditing(C,O);if(pe&&X.push("wg__cell--editable"),ee&&!Fo&&X.push("wg__cell--focused"),D.textOverflow!=="wrap"&&X.push("wg__cell--ellipsis"),D.maxLines&&X.push("wg__cell--line-clamp"),Fo&&X.push("wg__cell--editing"),o.grid.isCellInvalid(C,O)&&X.push("wg__cell--invalid"),j&&X.push("wg__cell--frozen"),Ft&&X.push("wg__cell--frozen-last"),D.cellClass&&X.push(D.cellClass),D.cellClassCallback){const le=o.grid.getCellRawValue(b,C,O),ve=D.cellClassCallback(le,b);ve&&X.push(ve)}const qo=o.grid.getColumnWidth(O)||D.width,No=D.minWidth,Tn=[j?"position: sticky":"",j?`left: ${T}px`:"",j?"z-index: 1":"",`text-align: ${Ht}`,`vertical-align: ${Vt}`,qo?`width: ${qo}`:"",No?`min-width: ${No}`:"",D.maxWidth?`max-width: ${D.maxWidth}`:""].filter(Boolean).join("; ");j&&(T+=f[N]);const In=o.grid.isNavigateMode?'tabindex="0"':"";let ke="";if(D.tooltipCallback){const le=o.grid.getCellRawValue(b,C,O),ve=D.tooltipCallback(le,b);ve&&(ke=`data-tooltip="${o.escapeHtml(ve)}"`)}else if(D.tooltipMember){const le=b[D.tooltipMember];le&&typeof le=="string"&&(ke=`data-tooltip="${o.escapeHtml(le)}"`)}if(!ke&&o.grid.isCellInvalid(C,O)){const le=o.grid.getCellValidationError(C,O);if(le){const ve=D.validationTooltipCallback||o.grid.validationTooltipCallback;if(ve){const zn=o.grid.getCellRawValue(b,C,O),Yo=ve({field:O,error:le,value:zn,row:b,rowIndex:C});Yo&&(ke=`data-tooltip-html="${o.escapeHtml(Yo)}"`)}ke||(ke=`data-tooltip="${o.escapeHtml(le)}"`)}}return`
|
|
470
|
+
<td
|
|
471
|
+
class="${X.join(" ")}"
|
|
472
|
+
style="${Tn}"
|
|
473
|
+
data-row="${C}"
|
|
474
|
+
data-col="${A}"
|
|
475
|
+
data-field="${O}"
|
|
476
|
+
${In}
|
|
477
|
+
${ke}
|
|
478
|
+
>
|
|
479
|
+
${o.grid.isEditing(C,O)?et(o,C,A,D):vt(o,C,A,D,Ae)}
|
|
480
|
+
</td>
|
|
481
|
+
`}).join(""),M=["wg__row"];if(k&&M.push("wg__row--locked"),o.grid.isRowSelected(C)&&M.push("wg__row--selected"),o.grid.rowClassCallback){const D=o.grid.rowClassCallback(b,C);D&&M.push(D)}const U=k&&!l?`data-tooltip="${o.escapeHtml(x!=null&&x.lockedBy?`Locked by ${x.lockedBy}`:"This row is locked")}"`:"";y.push(`<tr class="${M.join(" ")}" data-row-index="${C}" ${U}>${$}${I}${L}${q}<td class="wg__filler"></td></tr>`)}const _=v>0?`<tr class="wg__spacer-bottom"><td colspan="${g}" style="height: ${v}px"></td></tr>`:"";return m+y.join("")+_}function It(o,e="bottom-center"){const t=o.grid.showPagination;if(!o.grid.isPageable||t===!1||t==="auto"&&o.grid.totalPages<=1)return"";const i=o.grid.currentPage,r=o.grid.totalPages,n=o.grid.pageSize,s=o.grid.pageSizes,a=o.grid.totalItems!==null?o.grid.totalItems:o.grid.sortedItems.length,l=o.grid.labels,d={first:l.paginationFirst,previous:l.paginationPrevious,next:l.paginationNext,last:l.paginationLast,pageInfo:l.paginationPageInfo.replace("{current}",String(i)).replace("{total}",String(r)),itemCount:l.paginationItemCount.replace("{count}",String(a)),perPage:l.paginationPerPage},c=o.grid.paginationLabelsCallback,u=c?c({currentPage:i,totalPages:r,totalItems:a,pageSize:n}):{},g={...d,...u},h=e.startsWith("top-"),f=e.replace("top-","").replace("bottom-",""),p=["wg__pagination"];f==="left"?p.push("wg__pagination--left"):f==="right"&&p.push("wg__pagination--right"),h&&p.push("wg__pagination--top");const v={first:`
|
|
482
|
+
<button class="wg__pagination-btn" data-action="first" ${i===1?"disabled":""}>
|
|
483
|
+
${g.first}
|
|
484
|
+
</button>
|
|
485
|
+
`,previous:`
|
|
486
|
+
<button class="wg__pagination-btn" data-action="prev" ${i===1?"disabled":""}>
|
|
487
|
+
${g.previous}
|
|
488
|
+
</button>
|
|
489
|
+
`,next:`
|
|
490
|
+
<button class="wg__pagination-btn" data-action="next" ${i===r?"disabled":""}>
|
|
491
|
+
${g.next}
|
|
492
|
+
</button>
|
|
493
|
+
`,last:`
|
|
494
|
+
<button class="wg__pagination-btn" data-action="last" ${i===r?"disabled":""}>
|
|
495
|
+
${g.last}
|
|
496
|
+
</button>
|
|
497
|
+
`,pageInfo:`
|
|
498
|
+
<div class="wg__pagination-info">
|
|
499
|
+
${g.pageInfo}
|
|
500
|
+
<span class="wg__pagination-count">${g.itemCount}</span>
|
|
501
|
+
</div>
|
|
502
|
+
`,pageSize:s.length>0?`
|
|
503
|
+
<div class="wg__pagination-pagesize">
|
|
504
|
+
<select class="wg__pagination-select" data-action="pagesize">
|
|
505
|
+
${s.map(_=>`<option value="${_}" ${_===n?"selected":""}>${_}</option>`).join("")}
|
|
506
|
+
</select>
|
|
507
|
+
<span class="wg__pagination-label">${g.perPage}</span>
|
|
508
|
+
</div>
|
|
509
|
+
`:""},y=o.grid.paginationLayout.split("|").map(_=>_.trim()).map(_=>v[_]||"").join("");return`<div class="${p.join(" ")}">${y}</div>`}function zt(o,e){const t=o.grid.summaryContentCallback;if(!t)return"";const i=o.grid.currentPage,r=o.grid.pageSize,n=o.grid.sortedItems,s=o.grid.displayItems,a=o.grid.totalItems!==null?o.grid.totalItems:n.length,l=t({items:s,allItems:n,totalItems:a,currentPage:i,pageSize:r,metadata:o.grid.summaryMetadata}),d=e.startsWith("top-"),c=e.replace("top-","").replace("bottom-",""),u=["wg__summary"];return c==="left"?u.push("wg__summary--left"):c==="right"&&u.push("wg__summary--right"),d&&u.push("wg__summary--top"),`<div class="${u.join(" ")}">${l}</div>`}function yo(o,e,t=!0){const i=o.dropdownOptions[e];if(!i)return;const r=o.grid.editingCell;if(!r)return;const n=o.getCurrentEditorOptions();if(Fe(i,n))return;const s=Ce(i,n),a=o.grid.columns.findIndex(d=>String(d.field)===r.field),l=o.grid.displayItems[r.rowIndex];n.onselect&&l&&n.onselect(i,l),o.justSelected=!0,o.isCommittingFromKeyboard=!0,Y(o),o.grid.commitEdit(r.rowIndex,r.field,s),t?o.moveFocusAfterCommit(r.rowIndex,r.field,"down"):W(o,r.rowIndex,a),requestAnimationFrame(()=>{o.justSelected=!1})}function he(o){const e=o.shadow.querySelector(".wg__dropdown");if(!e)return;e.querySelectorAll(".wg__dropdown-option").forEach((i,r)=>{i.classList.toggle("wg__dropdown-option--highlighted",r===o.highlightedIndex)})}function Co(o){const e=o.shadow.querySelector(".wg__dropdown-option--highlighted");e==null||e.scrollIntoView({block:"nearest"})}function Lt(o,e){const t=o.shadow.querySelector(".wg__loading-indicator");t&&(t.style.display=e?"inline":"none");const i=o.shadow.querySelector(".wg__editor--autocomplete .wg__combobox-toggle");i&&(i.style.display=e?"none":"inline")}function ne(o){if(o.justSelected)return;const e=o.getCurrentEditingColumn();if(!e)return;const t=e.editorOptions||{},i=e.editor;let r=0;if(i==="select"){const d=t.options||[];if(o.filterText){const c=o.filterText.toLowerCase();o.dropdownOptions=d.filter(u=>Ve(u,t).toLowerCase().includes(c)),r=o.dropdownOptions.length>0?0:-1}else{o.dropdownOptions=d;const c=o.grid.editingCell;if(c){const u=o.grid.displayItems[c.rowIndex],g=u?u[c.field]:void 0,h=o.dropdownOptions.findIndex(f=>Ce(f,t)===g);r=h>=0?h:0}else r=o.dropdownOptions.length>0?0:-1}}else if(i==="combobox"||i==="autocomplete"){const d=i==="autocomplete"?t.initialOptions||t.options||[]:t.options||[],c=o.grid.editingCell;let u;if(c){const h=o.grid.displayItems[c.rowIndex];u=h?h[c.field]:void 0}const g=d.findIndex(h=>Ce(h,t)===u);if(g>=0)o.dropdownOptions=d,r=g;else if(u!=null&&u!==""){const h=t.valueMember||"value",f=t.displayMember||"label",p=String(u),v={value:u,label:p,[h]:u,[f]:p};o.dropdownOptions=[v,...d],r=0}else o.dropdownOptions=d,r=d.length>0?0:-1}const n=o.grid.editingCell;if(!n)return;const{rowIndex:s,field:a}=n,l=o.shadow.querySelector(`.wg__editor--select[data-row="${s}"][data-field="${a}"],
|
|
510
|
+
.wg__editor--combobox[data-row="${s}"][data-field="${a}"],
|
|
511
|
+
.wg__editor--autocomplete[data-row="${s}"][data-field="${a}"]`);if(l&&o.dropdownOptions.length>0){const d=o.filterText;o.isOpeningDropdown=!0;const c=Se(o,l,o.dropdownOptions,t);xe(o,c),o.filterText=d,o.highlightedIndex=r,he(o);const u=o.shadow.querySelector(`.wg__select-trigger[data-row="${s}"][data-field="${a}"]`),g=o.shadow.querySelector(`.wg__combobox-input[data-row="${s}"][data-field="${a}"],
|
|
512
|
+
.wg__autocomplete-input[data-row="${s}"][data-field="${a}"]`),h=u||g;h&&h.focus(),requestAnimationFrame(()=>{o.isOpeningDropdown=!1})}}function So(o){o.dropdownOpen?Y(o):ne(o)}function xe(o,e){e.addEventListener("mousedown",t=>{t.preventDefault();const i=t.target.closest(".wg__dropdown-option");if(i&&!i.hasAttribute("data-disabled")){const r=parseInt(i.getAttribute("data-index")||"0",10);yo(o,r,!1)}}),e.addEventListener("mouseover",t=>{const i=t.target.closest(".wg__dropdown-option");i&&!i.hasAttribute("data-disabled")&&(o.highlightedIndex=parseInt(i.getAttribute("data-index")||"0",10),he(o))})}function xo(o,e){const t=e.options||[],i=o.filterText.toLowerCase(),r=o.filterText;o.dropdownOptions=t.filter(s=>Ve(s,e).toLowerCase().includes(i)),o.highlightedIndex=o.dropdownOptions.length>0?0:-1;const n=o.shadow.querySelector(".wg__editor--select");if(n){const s=Se(o,n,o.dropdownOptions,e);xe(o,s),o.filterText=r,o.dropdownOptions.length>0&&(o.highlightedIndex=0,he(o))}}function Jr(o,e){const t=e.target;o.filterText=t.value,o.isUserFiltering=!0;const i=o.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},n=r.options||[];if(o.filterText.trim()){const a=o.filterText.toLowerCase();o.dropdownOptions=n.filter(l=>Ve(l,r).toLowerCase().includes(a))}else o.dropdownOptions=n;o.highlightedIndex=o.dropdownOptions.length>0?0:-1;const s=t.closest(".wg__editor--combobox");if(s){const a=Se(o,s,o.dropdownOptions,r);xe(o,a),o.highlightedIndex=o.dropdownOptions.length>0?0:-1,he(o)}}function Zr(o,e){const t=e.target;o.filterText=t.value;const i=o.getCurrentEditingColumn();if(!i)return;const r=i.editorOptions||{},n=r.debounceMs??300,s=r.minSearchLength??1;o.searchDebounceTimer&&clearTimeout(o.searchDebounceTimer);const a=t.closest(".wg__editor--autocomplete");if(!o.dropdownOpen&&a){o.dropdownOptions=r.initialOptions||[];const l=Se(o,a,o.dropdownOptions,r);xe(o,l),o.highlightedIndex=o.dropdownOptions.length>0?0:-1,he(o)}if(o.filterText.length<s){if(o.dropdownOptions=r.initialOptions||[],a){const l=Se(o,a,o.dropdownOptions,r);xe(o,l),o.highlightedIndex=o.dropdownOptions.length>0?0:-1,he(o)}return}o.searchDebounceTimer=setTimeout(()=>{en(o,o.filterText,i)},n)}async function en(o,e,t){const i=t.editorOptions||{};if(!i.searchCallback)return;o.searchAbortController&&o.searchAbortController.abort(),o.searchAbortController=new AbortController;const r=o.searchAbortController.signal;o.isSearching=!0,Lt(o,!0);try{const n=o.grid.editingCell;if(!n)return;const s=o.grid.displayItems[n.rowIndex],a=await i.searchCallback(e,s,r);if(!r.aborted){o.isSearching=!1,Lt(o,!1),o.dropdownOptions=a;const{rowIndex:l,field:d}=n,c=o.shadow.querySelector(`.wg__editor--autocomplete[data-row="${l}"][data-field="${d}"]`);if(c){const u=Se(o,c,o.dropdownOptions,i);xe(o,u),o.highlightedIndex=a.length>0?0:-1,he(o)}}}catch(n){if(n instanceof Error&&n.name==="AbortError")return;console.error("Autocomplete search failed:",n),o.isSearching=!1,Lt(o,!1),o.dropdownOptions=[];const s=o.grid.editingCell;if(s){const{rowIndex:a,field:l}=s,d=o.shadow.querySelector(`.wg__editor--autocomplete[data-row="${a}"][data-field="${l}"]`);if(d){const c=Se(o,d,o.dropdownOptions,i);xe(o,c)}}}}function At(o,e,t,i,r){const n=i??o.tooltipShowDelay;o.tooltipHideTimer&&(clearTimeout(o.tooltipHideTimer),o.tooltipHideTimer=null),!(o.tooltipElement&&o.tooltipAnchor===e)&&(o.tooltipShowTimer&&clearTimeout(o.tooltipShowTimer),o.tooltipShowTimer=setTimeout(()=>{tn(o,e,t,r)},n))}function ko(o,e){const t=e??o.tooltipHideDelay;o.tooltipShowTimer&&(clearTimeout(o.tooltipShowTimer),o.tooltipShowTimer=null),o.tooltipElement&&(o.tooltipHideTimer=setTimeout(()=>{o.tooltipElement&&(o.tooltipElement.classList.remove("wg__tooltip--visible"),setTimeout(()=>{var i;(i=o.tooltipElement)==null||i.remove(),o.tooltipElement=null,o.tooltipArrowElement=null,o.tooltipAnchor=null},100))},t))}function tn(o,e,t,i){var a;(a=o.tooltipElement)==null||a.remove();const r=document.createElement("div");r.className="wg__tooltip";const n=document.createElement("div");n.className="wg__tooltip-content",i?n.innerHTML=t:n.textContent=t,r.appendChild(n);const s=document.createElement("div");s.className="wg__tooltip-arrow",r.appendChild(s),o.shadow.appendChild(r),o.tooltipElement=r,o.tooltipArrowElement=s,o.tooltipAnchor=e,Ie(e,r,{strategy:"fixed",placement:"top",middleware:[ut(8),Te({fallbackPlacements:["bottom","left","right"]}),Ai({element:s})]}).then(({x:l,y:d,placement:c,middlewareData:u})=>{if(r.style.left=`${l}px`,r.style.top=`${d}px`,r.setAttribute("data-placement",c),u.arrow){const{x:g,y:h}=u.arrow;g!=null&&(s.style.left=`${g}px`),h!=null&&(s.style.top=`${h}px`)}requestAnimationFrame(()=>{r.classList.add("wg__tooltip--visible")})})}const on=`
|
|
509
513
|
.wg-context-menu-container {
|
|
510
514
|
position: fixed;
|
|
511
515
|
z-index: var(--wg-cm-z-index, 10000);
|
|
@@ -634,8 +638,8 @@
|
|
|
634
638
|
.wg-context-menu__item--toggle.wg-context-menu__item--checked .wg-context-menu__icon {
|
|
635
639
|
opacity: 1;
|
|
636
640
|
}
|
|
637
|
-
`;let vo=!1;function yo(){if(vo)return;const o=document.createElement("style");o.id="wg-context-menu-styles",o.textContent=jr,document.head.appendChild(o),vo=!0}function Kr(o,e){const t=o.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(e):r.visible);return t.length===0?"":`<div class="wg-context-menu">${t.map((r,n)=>{const s=typeof r.label=="function"?r.label(e):r.label,a=typeof r.icon=="function"?r.icon(e):r.icon,l=r.shortcut,d=typeof r.disabled=="function"?r.disabled(e):r.disabled,g=r.danger===!0,u=["wg-context-menu__item",d?"wg-context-menu__item--disabled":"",g?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),c=r.dividerBefore&&n>0?'<div class="wg-context-menu__divider"></div>':"",h=a?`<span class="wg-context-menu__icon">${a}</span>`:"",f=l?`<span class="wg-context-menu__shortcut">${l}</span>`:"";return`${c}<div class="${u}" data-item-id="${r.id}" data-disabled="${d?"true":"false"}" data-shortcut="${l||""}">${h}<span class="wg-context-menu__label">${s}</span>${f}</div>`}).join("")}</div>`}function Xr(o,e,t,i,r,n,s,a,l){yo();const d=Kr(n,s);if(!d)return null;const g=document.createElement("div");g.className="wg-context-menu-container",g.innerHTML=d,document.body.appendChild(g);const u=g.querySelector(".wg-context-menu"),c=e+i,h=t+r;Le({getBoundingClientRect:()=>({width:0,height:0,x:c,y:h,top:h,left:c,right:c,bottom:h})},u,{placement:"bottom-start",middleware:[Ie({fallbackPlacements:["top-start","bottom-end","top-end"]}),Ze({padding:8})]}).then(({x:m,y})=>{Object.assign(u.style,{left:`${m}px`,top:`${y}px`})}),g.addEventListener("click",m=>{const y=m.target.closest(".wg-context-menu__item");if(y&&y.dataset.disabled!=="true"){const _=y.dataset.itemId||"";a(_)}});const p=m=>{g.contains(m.target)||(J(g,p,v),l())},v=m=>{if(m.key==="Escape"){m.preventDefault(),J(g,p,v),l();return}const y=m.key.toLowerCase(),_=g.querySelectorAll(".wg-context-menu__item");for(const S of _){const b=S.dataset.shortcut;if(S.dataset.disabled==="true"||!b)continue;if(b.toLowerCase()===y||b===m.key){m.preventDefault();const k=S.dataset.itemId||"";a(k),J(g,p,v),l();return}}};return setTimeout(()=>{document.addEventListener("mousedown",p),document.addEventListener("keydown",v)},0),g._cleanup={handleOutsideClick:p,handleKeyDown:v},g}function J(o,e,t){e&&document.removeEventListener("mousedown",e),t&&document.removeEventListener("keydown",t);const i=o._cleanup;i&&(i.handleOutsideClick&&document.removeEventListener("mousedown",i.handleOutsideClick),i.handleKeyDown&&document.removeEventListener("keydown",i.handleKeyDown)),o.remove()}const Gr={sortAsc:{icon:"↑",labelKey:"sortAsc"},sortDesc:{icon:"↓",labelKey:"sortDesc"},clearSort:{icon:"✕",labelKey:"clearSort"},hideColumn:{icon:"👁",labelKey:"hideColumn"},freezeColumn:{icon:"❄",labelKey:"freezeColumn"},unfreezeColumn:{icon:"☀",labelKey:"unfreezeColumn"},columnVisibility:{icon:"👁",labelKey:"columnVisibility",hasSubmenu:!0}};function Co(o,e){const t=[];let i=!1;for(let r=0;r<o.length;r++){const n=o[r];if(typeof n=="string"){const s=Gr[n];if(!s){console.warn(`Unknown predefined header menu action: ${n}`);continue}let a=!0;n==="sortAsc"||n==="sortDesc"?a=d=>d.column.sortable!==!1:n==="clearSort"?a=d=>d.sortDirection!==null:n==="freezeColumn"?a=d=>!d.isFrozen:n==="unfreezeColumn"&&(a=d=>d.isFrozen);let l;n==="columnVisibility"&&(l=d=>{const u=[{id:"show-all-columns",icon:d.allColumns.every(c=>!c.hidden)?"☑":"☐",label:d.labels.contextMenu.showAll,onclick:()=>{d.allColumns.forEach(c=>{c.hidden=!1})}}];return d.allColumns.forEach(c=>{u.push({id:`toggle-col-${String(c.field)}`,icon:c.hidden?"☐":"☑",label:c.title||String(c.field),onclick:()=>{c.hidden=!c.hidden}})}),u}),t.push({id:n,icon:s.icon,label:e.labels.contextMenu[s.labelKey],danger:s.danger,visible:a,dividerBefore:i,submenu:l}),i=!1}else n.dividerBefore&&!n.id&&!n.label?i=!0:(t.push({id:n.id||`header-menu-item-${r}`,...n,dividerBefore:i||n.dividerBefore}),i=!1)}return t}function So(o,e,t,i=!1){var y,_;const r=typeof o.label=="function"?o.label(e):o.label,n=typeof o.icon=="function"?o.icon(e):o.icon,s=o.shortcut,a=typeof o.disabled=="function"?o.disabled(e):o.disabled,l=o.danger===!0,d=((y=o.children)==null?void 0:y.length)||o.submenu,g=o.children||(o.submenu?o.submenu(e):[]);let u="";d&&g.length>0&&(u=`<div class="wg-context-menu wg-context-menu--submenu">${g.map((b,C)=>So(b,e,C,!0)).join("")}</div>`);const c=i&&((_=o.id)==null?void 0:_.startsWith("toggle-col-")),f=["wg-context-menu__item",a?"wg-context-menu__item--disabled":"",l?"wg-context-menu__item--danger":"",d?"wg-context-menu__item--has-submenu":"",c?"wg-context-menu__item--toggle":"",c&&n==="☑"?"wg-context-menu__item--checked":""].filter(Boolean).join(" "),p=o.dividerBefore&&t>0?'<div class="wg-context-menu__divider"></div>':"",v=n?`<span class="wg-context-menu__icon">${n}</span>`:"",m=s?`<span class="wg-context-menu__shortcut">${s}</span>`:"";return`${p}<div class="${f}" data-item-id="${o.id}" data-disabled="${a?"true":"false"}" data-shortcut="${s||""}">${v}<span class="wg-context-menu__label">${r}</span>${m}${u}</div>`}function xo(o,e){const t=o.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(e):r.visible);return t.length===0?"":`<div class="wg-context-menu">${t.map((r,n)=>So(r,e,n)).join("")}</div>`}function Qr(o,e,t,i=!1){const{field:r,columnIndex:n}=t;switch(e){case"sortAsc":case"sortDesc":{const s=e==="sortAsc"?"asc":"desc",a=[...o.grid.sort];if(i&&o.grid.sortMode==="multi"){const l=a.findIndex(d=>d.column===r);l>=0?a[l]={column:r,direction:s}:a.push({column:r,direction:s}),o.grid.sort=a}else o.grid.sort=[{column:r,direction:s}];break}case"clearSort":o.grid.sort=o.grid.sort.filter(s=>s.column!==r);break;case"hideColumn":{const s=o.grid.columns.find(a=>String(a.field)===r);s&&(s.hidden=!0,o.grid.columns=[...o.grid.columns]);break}case"freezeColumn":o.grid.freezeColumns=n+1;break;case"unfreezeColumn":o.grid.freezeColumns=Math.max(0,n);break}}function ko(o,e,t,i,r,n,s){yo();const a=xo(i,r);if(!a)return null;const l=document.createElement("div");l.className="wg-context-menu-container",l.innerHTML=a,document.body.appendChild(l);let d=l.querySelector(".wg-context-menu");Le({getBoundingClientRect:()=>({width:0,height:0,x:e,y:t,top:t,left:e,right:e,bottom:t})},d,{placement:"bottom-start",middleware:[Ie({fallbackPlacements:["top-start","bottom-end","top-end"]}),Ze({padding:8})]}).then(({x:p,y:v})=>{Object.assign(d.style,{left:`${p}px`,top:`${v}px`})}),l.addEventListener("click",p=>{const v=p.target.closest(".wg-context-menu__item");if(!v||v.dataset.disabled==="true")return;const m=v.dataset.itemId||"",y=p.ctrlKey;if(!v.classList.contains("wg-context-menu__item--has-submenu")){if(m.startsWith("toggle-col-")||m==="show-all-columns"){n(m,!0,y);const _=xo(i,r),S=document.createElement("div");S.innerHTML=_;const b=S.querySelector(".wg-context-menu");if(b&&d.parentNode){b.style.left=d.style.left,b.style.top=d.style.top,d.parentNode.replaceChild(b,d),d=b;const C=b.querySelector(".wg-context-menu--submenu");C&&(C.style.display="block")}return}n(m,!1,y)}});const u=()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",f),window.removeEventListener("scroll",h,!0),l.remove()},c=p=>{l.contains(p.target)||(u(),s())},h=()=>{u(),s()},f=p=>{if(p.key==="Escape"){p.preventDefault(),u(),s();return}const v=p.key.toLowerCase(),m=l.querySelectorAll(".wg-context-menu__item");for(const y of m){const _=y.dataset.shortcut;if(y.dataset.disabled==="true"||!_)continue;if(_.toLowerCase()===v||_===p.key){p.preventDefault();const C=y.dataset.itemId||"";n(C),u(),s();return}}};return setTimeout(()=>{document.addEventListener("mousedown",c),document.addEventListener("keydown",f),window.addEventListener("scroll",h,!0)},0),l._cleanup=u,l}function Ne(o){const e=o.split("+").map(i=>i.trim()),t={key:"",ctrl:!1,shift:!1,alt:!1,meta:!1};for(const i of e){const r=i.toLowerCase();r==="ctrl"||r==="control"?t.ctrl=!0:r==="shift"?t.shift=!0:r==="alt"?t.alt=!0:r==="meta"||r==="cmd"||r==="command"?t.meta=!0:t.key=i}return t}function Ye(o,e){if(e.ctrl!==o.ctrlKey||e.shift!==o.shiftKey||e.alt!==o.altKey||e.meta!==o.metaKey)return!1;const t=o.key.toLowerCase(),i=e.key.toLowerCase();return t===i}function Jr(o){return o.split("+").map(e=>{const t=e.trim();return["ctrl","control","shift","alt","meta","cmd","command"].includes(t.toLowerCase())?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():t}).join("+")}function Zr(o){const{scrollTop:e,viewportHeight:t,rowHeight:i,buffer:r,totalItems:n,editingRowIndex:s}=o;let a=Math.max(0,Math.floor(e/i)-r);const l=Math.ceil(t/i)+r*2;let d=Math.min(n,a+l);return s!==void 0&&(s<a&&(a=s),s>=d&&(d=s+1)),{startIndex:a,endIndex:d}}function en(o){const{targetRow:e,rowHeight:t,buffer:i,totalItems:r,viewportHeight:n,scrollHeight:s,clientHeight:a}=o,l=Math.max(0,(e-1)*t),d=Math.max(0,s-a),g=Math.min(l,d);let u=Math.max(0,Math.floor(g/t)-i);const c=Math.ceil(n/t)+i*2;let h=Math.min(r,u+c);return e<u&&(u=e),e>=h&&(h=e+1),{scrollTop:g,startIndex:u,endIndex:h}}function tn(o,e,t,i){return e-(o+t)<=i}function on(o,e){const i=e.target.closest(".wg__header--sortable");if(!i)return;const r=i.dataset.field;if(!r)return;const n=[...o.grid.sort],s=n.findIndex(l=>l.column===r);(e.ctrlKey||e.metaKey)&&o.grid.sortMode==="multi"?s>=0?n[s].direction==="asc"?n[s]={column:r,direction:"desc"}:n.splice(s,1):n.push({column:r,direction:"asc"}):s>=0&&n.length===1?n[0].direction==="asc"?n[0]={column:r,direction:"desc"}:n.length=0:(n.length=0,n.push({column:r,direction:"asc"})),o.grid.sort=n,o.grid.pageable&&(o.grid.currentPage=1),o.grid.fireDataRequest("sort")}function rn(o,e){const i=e.target.closest(".wg__pagination-btn");if(!i||i.hasAttribute("disabled"))return!1;const r=i.dataset.action;let n=!1;return r==="first"&&o.grid.currentPage!==1?(o.grid.currentPage=1,n=!0):r==="prev"&&o.grid.currentPage>1?(o.grid.currentPage--,n=!0):r==="next"&&o.grid.currentPage<o.grid.totalPages?(o.grid.currentPage++,n=!0):r==="last"&&o.grid.currentPage!==o.grid.totalPages&&(o.grid.currentPage=o.grid.totalPages,n=!0),n&&o.grid.fireDataRequest("page"),n}function nn(o,e){const t=parseInt(e.value,10);return t!==o.grid.pageSize?(o.grid.pageSize=t,o.grid.currentPage=1,o.grid.fireDataRequest("pageSize"),!0):!1}let P={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},he=null;function Do(o,e){if(!o)return e;const t=parseFloat(o);return isNaN(t)?e:t}function sn(o,e,t){const i=e.target,r=i.closest(".wg__header");if(!r)return;const n=o.grid.columns.find(l=>String(l.field)===t);if(!n||n.resizable===!1)return;const s=r.getBoundingClientRect().width;P={isResizing:!0,startX:e.clientX,startWidth:s,field:t,headerCell:r,minWidth:Do(n.minWidth,30),maxWidth:n.maxWidth?Do(n.maxWidth,1/0):null},he=o,n.minWidth?r.style.minWidth=n.minWidth:r.style.minWidth=`${P.minWidth}px`;const a=o.shadow.querySelector(".wg");a==null||a.classList.add("wg--resizing"),i.classList.add("wg__resize-handle--active"),document.addEventListener("mousemove",Eo),document.addEventListener("mouseup",Ro),e.preventDefault()}function Eo(o){if(!P.isResizing||!he)return;const e=o.clientX-P.startX;let t=P.startWidth+e;t=Math.max(t,P.minWidth),P.maxWidth!==null&&(t=Math.min(t,P.maxWidth)),P.headerCell&&(P.headerCell.style.width=`${t}px`,P.headerCell.style.maxWidth=`${t}px`),ln(he,P.field,`${t}px`),(he.grid.freezeColumns>0||he.grid.stickyRowNumbers)&&dn(he)}function Ro(o){if(!P.isResizing||!he)return;const e=he,t=P.field,i=`${P.startWidth}px`,r=o.clientX-P.startX;let n=P.startWidth+r;n=Math.max(n,P.minWidth),P.maxWidth!==null&&(n=Math.min(n,P.maxWidth));const s=`${n}px`;e.grid.setColumnWidth(t,s,!0);const a=e.shadow.querySelector(`col[data-field="${t}"]`);a&&(a.style.width=s);const l=e.shadow.querySelector(".wg");l==null||l.classList.remove("wg--resizing");const d=e.shadow.querySelector(".wg__resize-handle--active");d==null||d.classList.remove("wg__resize-handle--active"),e.grid.oncolumnresize&&e.grid.oncolumnresize({field:t,oldWidth:i,newWidth:s,allWidths:e.grid.getColumnWidthsState()}),e.grid.persistColumnWidths&&e.grid.gridName&&e.grid.savePersistedWidths(),document.removeEventListener("mousemove",Eo),document.removeEventListener("mouseup",Ro),P={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},he=null}function ln(o,e,t){o.shadow.querySelectorAll(`td[data-field="${e}"]`).forEach(r=>{r.style.width=t,r.style.maxWidth=t})}const an=40;function dn(o){const e=o.grid.freezeColumns;let i=o.grid.showRowNumbers&&o.grid.stickyRowNumbers?an:0;const r=o.grid.visualColumns;for(let n=0;n<e&&n<r.length;n++){const{column:s}=r[n],a=String(s.field),l=o.shadow.querySelector(`th[data-field="${a}"]`);l&&(l.style.left=`${i}px`,o.shadow.querySelectorAll(`td[data-field="${a}"]`).forEach(g=>{g.style.left=`${i}px`}),i+=l.getBoundingClientRect().width)}}const cn=5;let $={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},fe=null,Lt=!1;function gn(){return Lt?(Lt=!1,!0):$.isReordering}function un(o,e,t){const i=e.target,r=i.closest(".wg__header");if(!r||i.classList.contains("wg__resize-handle"))return;const n=o.grid.visualColumns,s=o.grid.totalFrozenColumns,a=n.findIndex(d=>String(d.column.field)===t);if(a<s)return;const l=a-s;$={isPending:!0,isReordering:!1,field:t,startX:e.clientX,startY:e.clientY,headerCell:r,ghost:null,dropIndicator:null,fromIndex:l,currentDropIndex:l},fe=o,document.addEventListener("mousemove",$o),document.addEventListener("mouseup",Mo),e.preventDefault()}function hn(o,e,t){var r;const i=document.createElement("div");i.className="wg__reorder-ghost",i.textContent=((r=e.querySelector(".wg__header-title"))==null?void 0:r.textContent)||"",i.style.left=`${t.clientX+10}px`,i.style.top=`${t.clientY-10}px`,o.shadow.appendChild(i),$.ghost=i}function fn(o){var t;const e=document.createElement("div");e.className="wg__drop-indicator",(t=o.shadow.querySelector(".wg"))==null||t.appendChild(e),$.dropIndicator=e}function wn(o,e){$.isPending=!1,$.isReordering=!0;const t=o.shadow.querySelector(".wg");t==null||t.classList.add("wg--reordering"),$.headerCell&&$.headerCell.classList.add("wg__header--dragging"),$.headerCell&&hn(o,$.headerCell,e),fn(o)}function $o(o){if(!fe)return;if($.isPending){const i=o.clientX-$.startX,r=o.clientY-$.startY;Math.sqrt(i*i+r*r)>=cn&&wn(fe,o);return}if(!$.isReordering||!fe.shadow.querySelector(".wg"))return;$.ghost&&($.ghost.style.left=`${o.clientX+10}px`,$.ghost.style.top=`${o.clientY-10}px`);const t=pn(fe,o.clientX);t!==$.currentDropIndex&&($.currentDropIndex=t,mn(fe,t))}function pn(o,e){const t=o.grid.visualColumns,i=o.grid.totalFrozenColumns,r=t.slice(i);if(r.length===0)return 0;const n=String(r[0].column.field),s=o.shadow.querySelector(`th[data-field="${n}"]`);if(s){const a=s.getBoundingClientRect();if(e<a.left)return 0}for(let a=0;a<r.length;a++){const l=String(r[a].column.field),d=o.shadow.querySelector(`th[data-field="${l}"]`);if(d){const g=d.getBoundingClientRect(),u=g.left+g.width/2;if(e<u)return a}}return r.length}function mn(o,e){const t=$.dropIndicator;if(!t)return;const i=o.grid.visualColumns,r=o.grid.totalFrozenColumns,n=i.slice(r),s=o.shadow.querySelector(".wg"),a=s==null?void 0:s.getBoundingClientRect();if(!a||!s)return;let l;if(e>=n.length){const u=String(n[n.length-1].column.field),c=o.shadow.querySelector(`th[data-field="${u}"]`);if(c)l=c.getBoundingClientRect().right-a.left+s.scrollLeft;else return}else{const u=String(n[e].column.field),c=o.shadow.querySelector(`th[data-field="${u}"]`);if(c)l=c.getBoundingClientRect().left-a.left+s.scrollLeft;else return}const d=s.scrollTop,g=s.clientHeight;t.style.left=`${l}px`,t.style.top=`${d}px`,t.style.height=`${g}px`,t.style.display="block"}function Mo(o){if(!fe)return;const e=fe;if($.isPending){To(e);return}if(!$.isReordering)return;const t=$.field,i=$.fromIndex,r=$.currentDropIndex;if(i!==r&&r!==i+1){const n=r>i?r-1:r;e.grid.moveColumn(t,n),e.grid.oncolumnreorder&&e.grid.oncolumnreorder({field:t,fromIndex:i,toIndex:n,allOrder:e.grid.getColumnOrderState()}),e.grid.persistColumnOrder&&e.grid.gridName&&e.grid.savePersistedState()}Lt=!0,To(e)}function To(o){$.ghost&&$.ghost.remove(),$.dropIndicator&&$.dropIndicator.remove();const e=o.shadow.querySelector(".wg");e==null||e.classList.remove("wg--reordering"),$.headerCell&&$.headerCell.classList.remove("wg__header--dragging"),document.removeEventListener("mousemove",$o),document.removeEventListener("mouseup",Mo),$={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},fe=null}const bn=5;function _n(o,e){var i,r;switch(e.editor||"text"){case"number":return typeof o=="number"&&!isNaN(o);case"select":case"combobox":{const n=(i=e.editorOptions)==null?void 0:i.options;if(!n||n.length===0)return!0;const s=((r=e.editorOptions)==null?void 0:r.valueMember)||"value";return n.some(a=>a[s]===o)}case"date":{if(o==null||o==="")return!0;if(o instanceof Date)return!isNaN(o.getTime());if(typeof o=="string"){if(!/\d{4}[-/]\d{1,2}[-/]\d{1,2}/.test(o)&&!/\d{1,2}[-/.]\d{1,2}[-/.]\d{2,4}/.test(o))return!1;const n=new Date(o);return!isNaN(n.getTime())}if(typeof o=="number"){const n=new Date("2000-01-01").getTime(),s=new Date("2100-01-01").getTime();if(o<n||o>s)return!1;const a=new Date(o);return!isNaN(a.getTime())}return!1}case"text":case"autocomplete":case"checkbox":case"custom":default:return!0}}let R={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:null,rangeElement:null},_e=null;function At(o){const e=o.grid.focusedCell;if(!e||o.grid.editingCell){zo();return}const{rowIndex:t,colIndex:i}=e,r=o.shadow.querySelector(`[data-row="${t}"][data-col="${i}"]`);if(!r){zo();return}const n=o.shadow.querySelector(".wg");if(!n)return;if(!R.handleElement){const h=document.createElement("div");h.className="wg__fill-handle",n.appendChild(h),R.handleElement=h,h.addEventListener("mousedown",f=>vn(o,f))}const s=n.getBoundingClientRect(),a=r.getBoundingClientRect(),l=n.scrollLeft,d=n.scrollTop,g=8,u=a.right-s.left+l-g/2,c=a.bottom-s.top+d-g/2;R.handleElement.style.left=`${u}px`,R.handleElement.style.top=`${c}px`}function zo(){R.handleElement&&(R.handleElement.remove(),R.handleElement=null)}function vn(o,e){var a;e.preventDefault(),e.stopPropagation();const t=o.grid.focusedCell;if(!t)return;const{rowIndex:i,colIndex:r}=t,s=(a=o.grid.visualColumns[r])==null?void 0:a.column;s&&(R={...R,isPending:!0,isDragging:!1,startRowIndex:i,startColIndex:r,startField:String(s.field),startX:e.clientX,startY:e.clientY,currentRowIndex:i,currentColIndex:r},_e=o,document.addEventListener("mousemove",Io),document.addEventListener("mouseup",Ao))}function Io(o){if(!_e)return;if(R.isPending){const t=o.clientX-R.startX,i=o.clientY-R.startY;Math.sqrt(t*t+i*i)>=bn&&yn(_e);return}if(!R.isDragging)return;const e=Sn(_e,o.clientX,o.clientY);e&&(e.rowIndex!==R.currentRowIndex||e.colIndex!==R.currentColIndex)&&(R.currentRowIndex=e.rowIndex,R.currentColIndex=e.colIndex,Lo(_e))}function yn(o){R.isPending=!1,R.isDragging=!0;const e=o.shadow.querySelector(".wg");e==null||e.classList.add("wg--filling"),Cn(o)}function Cn(o){const e=o.shadow.querySelector(".wg");if(!e)return;const t=document.createElement("div");t.className="wg__fill-range",e.appendChild(t),R.rangeElement=t,Lo(o)}function Lo(o){if(!R.rangeElement)return;const e=o.shadow.querySelector(".wg");if(!e)return;const{startRowIndex:t,startColIndex:i,currentRowIndex:r,currentColIndex:n}=R,s=Math.min(t,r),a=Math.max(t,r),l=Math.min(i,n),d=Math.max(i,n),g=o.shadow.querySelector(`[data-row="${s}"][data-col="${l}"]`),u=o.shadow.querySelector(`[data-row="${a}"][data-col="${d}"]`);if(!g||!u)return;const c=e.getBoundingClientRect(),h=g.getBoundingClientRect(),f=u.getBoundingClientRect(),p=e.scrollLeft,v=e.scrollTop,m=h.left-c.left+p,y=h.top-c.top+v,_=f.right-h.left,S=f.bottom-h.top;R.rangeElement.style.left=`${m}px`,R.rangeElement.style.top=`${y}px`,R.rangeElement.style.width=`${_}px`,R.rangeElement.style.height=`${S}px`}function Ao(o){if(!_e)return;const e=_e;if(R.isPending){Oo(e);return}R.isDragging&&(kn(e),Oo(e))}function Sn(o,e,t){if(!o.shadow.querySelector(".wg"))return null;const r=o.shadow.querySelectorAll(".wg__cell[data-row][data-col]");for(const n of r){const s=n.getBoundingClientRect();if(e>=s.left&&e<=s.right&&t>=s.top&&t<=s.bottom){const a=parseInt(n.dataset.row||"-1",10),l=parseInt(n.dataset.col||"-1",10);if(a>=0&&l>=0)return{rowIndex:a,colIndex:l}}}return null}function xn(o,e,t,i){const r=t-o,n=i-e;return r===0&&n===0?"down":Math.abs(r)>=Math.abs(n)?r>0?"down":"up":n>0?"right":"left"}async function kn(o){var y,_;const{startRowIndex:e,startColIndex:t,currentRowIndex:i,currentColIndex:r,startField:n}=R,s=o.grid.visualColumns,a=(y=s[t])==null?void 0:y.column;if(!a)return;const l=o.grid.getRowDraft(e)??o.grid.displayItems[e];if(!l)return;const d=l[n],g=xn(e,t,i,r),u=a.fillDirection??o.grid.fillDirection,c=[],h=Math.min(e,i),f=Math.max(e,i),p=u==="vertical"?t:Math.min(t,r),v=u==="vertical"?t:Math.max(t,r);for(let S=h;S<=f;S++)for(let b=p;b<=v;b++){if(S===e&&b===t)continue;const C=(_=s[b])==null?void 0:_.column;if(!C)continue;const x=String(C.field);!o.grid.displayItems[S]||!(C.editable!==!1&&o.grid.editable)||_n(d,C)&&c.push({rowIndex:S,colIndex:b,field:x})}if(c.length===0)return;const m={sourceCell:{rowIndex:e,colIndex:t,field:n,value:d},targetCells:c,direction:g};if(!(o.grid.onfilldrag&&o.grid.onfilldrag(m)===!1))for(const S of c)await o.grid.commitEdit(S.rowIndex,S.field,d),j(o,S.rowIndex,S.colIndex)}function Oo(o){R.rangeElement&&(R.rangeElement.remove(),R.rangeElement=null);const e=o.shadow.querySelector(".wg");e==null||e.classList.remove("wg--filling"),document.removeEventListener("mousemove",Io),document.removeEventListener("mouseup",Ao),R={isPending:!1,isDragging:!1,startRowIndex:-1,startColIndex:-1,startField:"",startX:0,startY:0,currentRowIndex:-1,currentColIndex:-1,handleElement:R.handleElement,rangeElement:null},_e=null}const Dn=5;let se={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},ve=null;function En(o,e,t){if(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.metaKey){o.grid.selectRow(e,"toggle"),requestAnimationFrame(()=>{const i=o.shadow.querySelector(".wg");i==null||i.focus()});return}if(t.shiftKey){o.grid.selectRow(e,"range"),requestAnimationFrame(()=>{const i=o.shadow.querySelector(".wg");i==null||i.focus()});return}se={isPending:!0,isDragging:!1,startRowIndex:e,startX:t.clientX,startY:t.clientY,currentRowIndex:e},ve=o,o.grid.selectRow(e,"replace"),document.addEventListener("mousemove",Ho),document.addEventListener("mouseup",Po)}function Ho(o){if(!ve)return;if(se.isPending){const t=o.clientX-se.startX,i=o.clientY-se.startY;Math.sqrt(t*t+i*i)>=Dn&&Rn(ve);return}if(!se.isDragging)return;const e=$n(ve,o.clientY);e!==null&&e!==se.currentRowIndex&&(se.currentRowIndex=e,ve.grid.selectRowRange(se.startRowIndex,e))}function Rn(o){se.isPending=!1,se.isDragging=!0;const e=o.shadow.querySelector(".wg");e==null||e.classList.add("wg--selecting")}function Po(){if(!ve)return;const o=ve,e=o.shadow.querySelector(".wg");e==null||e.classList.remove("wg--selecting"),requestAnimationFrame(()=>{const t=o.shadow.querySelector(".wg");t==null||t.focus()}),document.removeEventListener("mousemove",Ho),document.removeEventListener("mouseup",Po),se={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},ve=null}function $n(o,e){const t=o.shadow.querySelectorAll(".wg__row[data-row-index]");for(const i of t){const r=i.getBoundingClientRect();if(e>=r.top&&e<=r.bottom){const n=parseInt(i.dataset.rowIndex||"-1",10);if(n>=0)return n}}if(t.length>0){const i=t[0],r=t[t.length-1],n=i.getBoundingClientRect(),s=r.getBoundingClientRect();if(e<n.top)return parseInt(i.dataset.rowIndex||"0",10);if(e>s.bottom)return parseInt(r.dataset.rowIndex||"0",10)}return null}class Ot extends HTMLElement{constructor(){super();w(this,"grid");w(this,"shadow");w(this,"styleElement");w(this,"customStyleElement",null);w(this,"updatePending",!1);w(this,"isCommittingFromKeyboard",!1);w(this,"isTransitioningCells",!1);w(this,"wheelListenerAdded",!1);w(this,"toolbarOutsideClickAdded",!1);w(this,"toolbarScrollListenerAdded",!1);w(this,"toolbarMoveInProgress",!1);w(this,"toolbarHideTimeout",null);w(this,"toolbarHovered",!1);w(this,"toolbarShortcutHandler",null);w(this,"inlineShortcutHandler",null);w(this,"dropdownOpen",!1);w(this,"dropdownOptions",[]);w(this,"highlightedIndex",-1);w(this,"filterText","");w(this,"isUserFiltering",!1);w(this,"justSelected",!1);w(this,"isOpeningDropdown",!1);w(this,"isProgrammaticScroll",!1);w(this,"searchDebounceTimer",null);w(this,"searchAbortController",null);w(this,"isSearching",!1);w(this,"tooltipElement",null);w(this,"tooltipArrowElement",null);w(this,"tooltipAnchor",null);w(this,"tooltipShowTimer",null);w(this,"tooltipHideTimer",null);w(this,"_tooltipShowDelay",400);w(this,"_tooltipHideDelay",100);w(this,"datepicker",null);w(this,"contextMenuElement",null);w(this,"headerContextMenuElement",null);w(this,"virtualScrollStart",0);w(this,"virtualScrollEnd",0);w(this,"scrollListenerAdded",!1);w(this,"isLoadingMoreItems",!1);w(this,"handlePaste",t=>{var d;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,n=this.grid.columns[r],s=this.grid.displayItems[i];if(!n||!s||!this.grid.isCellEditable(n))return;t.preventDefault();let a=((d=t.clipboardData)==null?void 0:d.getData("text"))||"";if(n.beforePasteCallback){const g=n.beforePasteCallback(a,s);a=g!=null?String(g):""}const l=String(n.field);this.grid.commitEdit(i,l,a),this.render()});this.shadow=this.attachShadow({mode:"open"}),this.grid=new Ce,this.styleElement=document.createElement("style"),this.styleElement.textContent=Yo,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>this.requestUpdate(),this.grid._onInteractionChange=(t,i)=>{t==="editingCell"&&i.current===null&&N(this)}}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(t){this._tooltipShowDelay=t}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(t){this._tooltipHideDelay=t}connectedCallback(){this.grid.gridName&&this.grid.persistColumnWidths&&this.grid.loadPersistedWidths(),this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(J(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(J(this.headerContextMenuElement),this.headerContextMenuElement=null),ot(),this.removeInlineShortcuts()}get items(){return this.grid.items}set items(t){this.grid.items=t,this.isLoadingMoreItems=!1}get columns(){return this.grid.columns}set columns(t){this.grid.columns=t}get filterable(){return this.grid.filterable}set filterable(t){this.grid.filterable=t}get pageable(){return this.grid.pageable}set pageable(t){this.grid.pageable=t}get pageSize(){return this.grid.pageSize}set pageSize(t){this.grid.pageSize=t}get pageSizes(){return this.grid.pageSizes}set pageSizes(t){this.grid.pageSizes=t}get striped(){return this.grid.striped}set striped(t){this.grid.striped=t}get hoverable(){return this.grid.hoverable}set hoverable(t){this.grid.hoverable=t}get editable(){return this.grid.editable}set editable(t){this.grid.editable=t}get editTrigger(){return this.grid.editTrigger}set editTrigger(t){this.grid.editTrigger=t}get editStartSelection(){return this.grid.editStartSelection}set editStartSelection(t){this.grid.editStartSelection=t}get mode(){return this.grid.mode}set mode(t){this.grid.mode=t}get dropdownToggleVisibility(){return this.grid.dropdownToggleVisibility}set dropdownToggleVisibility(t){this.grid.dropdownToggleVisibility=t}get dropdownShowOnFocus(){return this.grid.dropdownShowOnFocus}set dropdownShowOnFocus(t){this.grid.dropdownShowOnFocus=t}get openDropdownOnEnter(){return this.grid.openDropdownOnEnter}set openDropdownOnEnter(t){this.grid.openDropdownOnEnter=t}get checkboxAlwaysEditable(){return this.grid.checkboxAlwaysEditable}set checkboxAlwaysEditable(t){this.grid.checkboxAlwaysEditable=t}get showRowNumbers(){return this.grid.showRowNumbers}set showRowNumbers(t){this.grid.showRowNumbers=t}get stickyRowNumbers(){return this.grid.stickyRowNumbers}set stickyRowNumbers(t){this.grid.stickyRowNumbers=t}get freezeColumns(){return this.grid.freezeColumns}set freezeColumns(t){this.grid.freezeColumns=t}get invalidCells(){return this.grid.invalidCells}set invalidCells(t){this.grid.invalidCells=t}get showRowToolbar(){return this.grid.showRowToolbar}set showRowToolbar(t){this.grid.showRowToolbar=t}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(t){this.grid.rowToolbar=t}get toolbarVerticalAlign(){return this.grid.toolbarVerticalAlign}set toolbarVerticalAlign(t){this.grid.toolbarVerticalAlign=t}get toolbarHorizontalAlign(){return this.grid.toolbarHorizontalAlign}set toolbarHorizontalAlign(t){this.grid.toolbarHorizontalAlign=t}get toolbarAlign(){return this.grid.toolbarVerticalAlign}set toolbarAlign(t){this.grid.toolbarVerticalAlign=t}get toolbarTopPosition(){return this.grid.toolbarHorizontalAlign}set toolbarTopPosition(t){this.grid.toolbarHorizontalAlign=t}get toolbarTrigger(){return this.grid.toolbarTrigger}set toolbarTrigger(t){this.grid.toolbarTrigger=t}get toolbarPosition(){return this.grid.toolbarPosition}set toolbarPosition(t){this.grid.toolbarPosition=t}get inlineActionsTitle(){return this.grid.inlineActionsTitle}set inlineActionsTitle(t){this.grid.inlineActionsTitle=t}get contextMenu(){return this.grid.contextMenu}set contextMenu(t){this.grid.contextMenu=t}get contextMenuXOffset(){return this.grid.contextMenuXOffset}set contextMenuXOffset(t){this.grid.contextMenuXOffset=t}get contextMenuYOffset(){return this.grid.contextMenuYOffset}set contextMenuYOffset(t){this.grid.contextMenuYOffset=t}get headerContextMenu(){return this.grid.headerContextMenu}set headerContextMenu(t){this.grid.headerContextMenu=t}set onheadercontextmenuopen(t){this.grid.onheadercontextmenuopen=t}get rowShortcuts(){return this.grid.rowShortcuts}set rowShortcuts(t){this.grid.rowShortcuts=t}get rangeShortcuts(){return this.grid.rangeShortcuts}set rangeShortcuts(t){this.grid.rangeShortcuts=t}get selectedRows(){return this.grid.selectedRows}selectRow(t,i="replace"){this.grid.selectRow(t,i)}selectRowRange(t,i){this.grid.selectRowRange(t,i)}clearSelection(){this.grid.clearSelection()}isRowSelected(t){return this.grid.isRowSelected(t)}getSelectedRowsData(){return this.grid.getSelectedRowsData()}get showShortcutsHelp(){return this.grid.showShortcutsHelp}set showShortcutsHelp(t){this.grid.showShortcutsHelp=t}get shortcutsHelpPosition(){return this.grid.shortcutsHelpPosition}set shortcutsHelpPosition(t){this.grid.shortcutsHelpPosition=t}get shortcutsHelpContentCallback(){return this.grid.shortcutsHelpContentCallback}set shortcutsHelpContentCallback(t){this.grid.shortcutsHelpContentCallback=t}get showRowActions(){return this.grid.showRowActions}set showRowActions(t){this.grid.showRowActions=t}get rowActions(){return this.grid.rowActions}set rowActions(t){this.grid.rowActions=t}set onrowchange(t){this.grid.onrowchange=t}set onroweditstart(t){this.grid.onroweditstart=t}set onroweditcancel(t){this.grid.onroweditcancel=t}set onvalidationerror(t){this.grid.onvalidationerror=t}get validationTooltipCallback(){return this.grid.validationTooltipCallback}set validationTooltipCallback(t){this.grid.validationTooltipCallback=t}set ontoolbarclick(t){this.grid.ontoolbarclick=t}set onrowaction(t){this.grid.onrowaction=t}set oncontextmenuopen(t){this.grid.oncontextmenuopen=t}get ondatarequest(){return this.grid.ondatarequest}set ondatarequest(t){this.grid.ondatarequest=t}get onrowdelete(){return this.grid.onrowdelete}set onrowdelete(t){this.grid.onrowdelete=t}get sort(){return this.grid.sort}set sort(t){this.grid.sort=t}get sortMode(){return this.grid.sortMode}set sortMode(t){this.grid.sortMode=t}get currentPage(){return this.grid.currentPage}set currentPage(t){this.grid.currentPage=t}get totalItems(){return this.grid.totalItems}set totalItems(t){this.grid.totalItems=t}get showPagination(){return this.grid.showPagination}set showPagination(t){this.grid.showPagination=t}get paginationPosition(){return this.grid.paginationPosition}set paginationPosition(t){this.grid.paginationPosition=t}get paginationLabelsCallback(){return this.grid.paginationLabelsCallback}set paginationLabelsCallback(t){this.grid.paginationLabelsCallback=t}get paginationLayout(){return this.grid.paginationLayout}set paginationLayout(t){this.grid.paginationLayout=t}get summaryPosition(){return this.grid.summaryPosition}set summaryPosition(t){this.grid.summaryPosition=t}get summaryContentCallback(){return this.grid.summaryContentCallback}set summaryContentCallback(t){this.grid.summaryContentCallback=t}get customStylesCallback(){return this.grid.customStylesCallback}set customStylesCallback(t){this.grid.customStylesCallback=t,this.updateCustomStyles()}get rowClassCallback(){return this.grid.rowClassCallback}set rowClassCallback(t){this.grid.rowClassCallback=t}get labels(){return this.grid.labels}set labels(t){this.grid.labels=t}get summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(t){this.grid.summaryMetadata=t}get summaryInline(){return this.grid.summaryInline}set summaryInline(t){this.grid.summaryInline=t}get idValueMember(){return this.grid.idValueMember}set idValueMember(t){this.grid.idValueMember=t}get idValueCallback(){return this.grid.idValueCallback}set idValueCallback(t){this.grid.idValueCallback=t}get rowLocking(){return this.grid.rowLocking}set rowLocking(t){this.grid.rowLocking=t}get onrowlockchange(){return this.grid.onrowlockchange}set onrowlockchange(t){this.grid.onrowlockchange=t}get gridName(){return this.grid.gridName}set gridName(t){this.grid.gridName=t,this.tryLoadPersistedWidths()}get persistColumnWidths(){return this.grid.persistColumnWidths}set persistColumnWidths(t){this.grid.persistColumnWidths=t,this.tryLoadPersistedState()}get allowColumnReorder(){return this.grid.allowColumnReorder}set allowColumnReorder(t){this.grid.allowColumnReorder=t}get persistColumnOrder(){return this.grid.persistColumnOrder}set persistColumnOrder(t){this.grid.persistColumnOrder=t,this.tryLoadPersistedState()}tryLoadPersistedState(){this.grid.gridName&&(this.grid.persistColumnWidths||this.grid.persistColumnOrder)&&(this.grid.loadPersistedState(),this.isConnected&&this.render())}tryLoadPersistedWidths(){this.tryLoadPersistedState()}get oncolumnresize(){return this.grid.oncolumnresize}set oncolumnresize(t){this.grid.oncolumnresize=t}get oncolumnreorder(){return this.grid.oncolumnreorder}set oncolumnreorder(t){this.grid.oncolumnreorder=t}get onfilldrag(){return this.grid.onfilldrag}set onfilldrag(t){this.grid.onfilldrag=t}get virtualScroll(){return this.grid.virtualScroll}set virtualScroll(t){this.grid.virtualScroll=t}get virtualScrollThreshold(){return this.grid.virtualScrollThreshold}set virtualScrollThreshold(t){this.grid.virtualScrollThreshold=t}get virtualScrollRowHeight(){return this.grid.virtualScrollRowHeight}set virtualScrollRowHeight(t){this.grid.virtualScrollRowHeight=t}get virtualScrollBuffer(){return this.grid.virtualScrollBuffer}set virtualScrollBuffer(t){this.grid.virtualScrollBuffer=t}get infiniteScroll(){return this.grid.infiniteScroll}set infiniteScroll(t){this.grid.infiniteScroll=t}get infiniteScrollThreshold(){return this.grid.infiniteScrollThreshold}set infiniteScrollThreshold(t){this.grid.infiniteScrollThreshold=t}get hasMoreItems(){return this.grid.hasMoreItems}set hasMoreItems(t){this.grid.hasMoreItems=t}get displayItems(){return this.grid.displayItems}get totalPages(){return this.grid.totalPages}get isNavigateMode(){return this.grid.isNavigateMode}getRowDraft(t){return this.grid.getRowDraft(t)}hasRowDraft(t){return this.grid.hasRowDraft(t)}discardRowDraft(t){this.grid.discardRowDraft(t)}getDraftRowIndices(){return this.grid.getDraftRowIndices()}discardAllDrafts(){this.grid.discardAllDrafts()}isCellInvalid(t,i){return this.grid.isCellInvalid(t,i)}getCellValidationError(t,i){return this.grid.getCellValidationError(t,i)}getRowId(t){return this.grid.getRowId(t)}findRowById(t){return this.grid.findRowById(t)}isRowLocked(t){return this.grid.isRowLocked(t)}getRowLockInfo(t){return this.grid.getRowLockInfo(t)}lockRowById(t,i){return this.grid.lockRowById(t,i)}unlockRowById(t){return this.grid.unlockRowById(t)}getExternalLocks(){return this.grid.getExternalLocks()}clearExternalLocks(){this.grid.clearExternalLocks()}updateRowById(t,i){return this.grid.updateRowById(t,i)}replaceRowById(t,i){return this.grid.replaceRowById(t,i)}canEditCell(t,i){return this.grid.canEditCell(t,i)}setColumnWidth(t,i){this.grid.setColumnWidth(t,i)}setColumnWidths(t){this.grid.setColumnWidths(t)}getColumnWidthsState(){return this.grid.getColumnWidthsState()}setColumnOrder(t){this.grid.setColumnOrder(t)}getColumnOrderState(){return this.grid.getColumnOrderState()}focusCell(t,i){const r=this.grid.columns,n=this.grid.displayItems;t<0||t>=n.length||i<0||i>=r.length||(this.grid.setFocusedCell(t,i),requestAnimationFrame(()=>{z(this,t,i)}))}startEditing(t,i){const r=this.grid.columns;if(i<0||i>=r.length)return;const n=r[i],s=String(n.field);this.grid.startEdit(t,s);const a=this.shadow.querySelector(`td[data-row="${t}"][data-col="${i}"]`);a&&(a.classList.remove("wg__cell--focused"),a.classList.add("wg__cell--editing"),a.innerHTML=tt(this,t,i,n))}escapeHtml(t){const i=document.createElement("div");return i.textContent=t,i.innerHTML}getCurrentEditingColumn(){const t=this.grid.editingCell;return t&&this.grid.columns.find(i=>String(i.field)===t.field)||null}getCurrentEditorOptions(){const t=this.getCurrentEditingColumn();return(t==null?void 0:t.editorOptions)||{}}moveFocusAfterCommit(t,i,r){mt(this,t,i,r)}requestUpdate(){this.updatePending||(this.updatePending=!0,queueMicrotask(()=>{this.updatePending=!1,this.render()}))}updateCustomStyles(){const t=this.grid.customStylesCallback;if(t){const i=t();this.customStyleElement||(this.customStyleElement=document.createElement("style"),this.shadow.appendChild(this.customStyleElement)),this.customStyleElement.textContent=i}else this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}handleCellKeyDown(t,i,r){var u;if(!this.grid.isNavigateMode)return;const n=this.grid.columns,s=this.grid.displayItems,a=this.grid.getEditableColumns(),l=a.findIndex(c=>c.index===r);if((t.ctrlKey||t.metaKey)&&t.key==="c"){const c=n[r],h=s[i];if(c&&h){let f=this.grid.getCellRawValue(h,i,String(c.field));c.beforeCopyCallback&&(f=c.beforeCopyCallback(f,h));const p=f!=null?String(f):"";navigator.clipboard.writeText(p)}return}const d=this.grid.selectedRows;if(d.length>0){const c=this.grid.rangeShortcuts;if(c&&c.length>0)for(const h of c){const f=Ne(h.key);if(Ye(t,f)){const p={rows:this.grid.getSelectedRowsData(),rowIndices:d};if(!(typeof h.disabled=="function"?h.disabled(p):h.disabled===!0)){t.preventDefault(),h.action(p);return}}}}const g=this.grid.rowShortcuts;if(g&&g.length>0){const c=n[r],h=s[i];if(c&&h)for(const f of g){const p=Ne(f.key);if(Ye(t,p)){const v={row:h,rowIndex:i,colIndex:r,column:c,cellValue:this.grid.getCellRawValue(h,i,String(c.field))};if(!(typeof f.disabled=="function"?f.disabled(v):f.disabled===!0)){t.preventDefault(),f.action(v);return}}}}switch(t.key){case"ArrowUp":t.preventDefault(),i>0&&z(this,i-1,r);break;case"ArrowDown":t.preventDefault(),i<s.length-1&&z(this,i+1,r);break;case"ArrowLeft":t.preventDefault(),r>0&&z(this,i,r-1);break;case"ArrowRight":t.preventDefault(),r<n.length-1&&z(this,i,r+1);break;case"Tab":if(t.preventDefault(),t.shiftKey){if(l>0){const c=a[l-1].index;z(this,i,c)}else if(i>0){const c=a[a.length-1].index;z(this,i-1,c)}}else if(l>=0&&l<a.length-1){const c=a[l+1].index;z(this,i,c)}else if(l===-1&&a.length>0)z(this,i,a[0].index);else if(i<s.length-1){const c=a[0].index;z(this,i+1,c)}break;case"Home":if(t.preventDefault(),t.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const c=this.grid.focusedCell;this.grid.setFocusedCell(0,0),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector('td[data-row="0"][data-col="0"]');h&&(h.focus({preventScroll:!0}),te(this,c,{rowIndex:0,colIndex:0}))}else z(this,0,0);else z(this,i,0);break;case"End":if(t.preventDefault(),t.ctrlKey){const c=s.length-1,h=n.length-1;if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(c,h),this.scrollToRowProgrammatically(c);const p=this.shadow.querySelector(`td[data-row="${c}"][data-col="${h}"]`);p&&(p.focus({preventScroll:!0}),te(this,f,{rowIndex:c,colIndex:h}))}else z(this,c,h)}else z(this,i,n.length-1);break;case"PageUp":if(t.preventDefault(),t.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const c=this.grid.focusedCell;this.grid.setFocusedCell(0,r),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),te(this,c,{rowIndex:0,colIndex:r}))}else z(this,0,r);else{const c=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(c,r),this.scrollToRowProgrammatically(c);const f=this.shadow.querySelector(`td[data-row="${c}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),te(this,h,{rowIndex:c,colIndex:r}))}else z(this,c,r)}break;case"PageDown":if(t.preventDefault(),t.ctrlKey){const c=s.length-1;if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(c,r),this.scrollToRowProgrammatically(c);const f=this.shadow.querySelector(`td[data-row="${c}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),te(this,h,{rowIndex:c,colIndex:r}))}else z(this,c,r)}else{const c=Math.min(s.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(c,r),this.scrollToRowProgrammatically(c);const f=this.shadow.querySelector(`td[data-row="${c}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),te(this,h,{rowIndex:c,colIndex:r}))}else z(this,c,r)}break;case"g":case"G":t.ctrlKey&&(t.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{t.preventDefault();const c=n[r];((c==null?void 0:c.editor)==="select"||(c==null?void 0:c.editor)==="combobox"||(c==null?void 0:c.editor)==="autocomplete")&&this.grid.getEffectiveOpenDropdownOnEnter(c)?(oe(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||ne(this)})):i<s.length-1&&z(this,i+1,r);break}case"F2":{t.preventDefault();const c=n[r],h=(c==null?void 0:c.editor)==="select"||(c==null?void 0:c.editor)==="combobox"||(c==null?void 0:c.editor)==="autocomplete",f=(c==null?void 0:c.editor)==="custom";oe(this,i,r),h?requestAnimationFrame(()=>{this.dropdownOpen||ne(this)}):f&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{t.preventDefault();const c=n[r],h=(c==null?void 0:c.editor)==="checkbox",f=(c==null?void 0:c.editor)==="select"||(c==null?void 0:c.editor)==="combobox"||(c==null?void 0:c.editor)==="autocomplete",p=(c==null?void 0:c.editor)==="date",v=(c==null?void 0:c.editor)==="custom";h?Ui(this,i,r):f?(oe(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||ne(this)})):p?(oe(this,i,r),requestAnimationFrame(()=>{var S;const m=(S=this.shadowRoot)==null?void 0:S.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),y=m==null?void 0:m.querySelector(".wg__date-input"),_=m==null?void 0:m.querySelector(".wg__editor--date");y&&_&&this.openDatePicker(y,_)})):v&&(oe(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(t.preventDefault(),this.grid.editingCell)G(this),this.grid.cancelEdit();else if(this.grid.selectedRows.length>0)this.grid.clearSelection();else{const c=this.grid.focusedCell;this.grid.clearFocusedCell(),te(this,c,null),(u=t.target)==null||u.blur()}break;case"Delete":{t.preventDefault();const c=n[r],h=s[i];if(t.ctrlKey){if(h){const f={rowIndex:i,row:h};this.grid.onrowdelete&&this.grid.onrowdelete(f),this.dispatchEvent(new CustomEvent("rowdelete",{detail:f}))}}else c&&this.grid.isCellEditable(c)&&(this.grid.commitEdit(i,String(c.field),null),this.render(),requestAnimationFrame(()=>{const f=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);f==null||f.focus()}));break}default:if(t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey){const c=n[r];if((c==null?void 0:c.editor)==="number"&&!/[\d.\-]/.test(t.key))return;oe(this,i,r,{initialSearchQuery:t.key}),t.preventDefault()}break}}handleEditorKeyDown(t,i){const r=parseInt(i.dataset.row||"0",10),n=i.dataset.field||"",s=this.grid.columns.find(g=>g.field===n),a=(s==null?void 0:s.editor)||"text",l=a==="select"||a==="combobox"||a==="autocomplete",d=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(l&&!this.dropdownOpen&&d.includes(t.key)){t.preventDefault(),t.stopPropagation();const g=this.grid.columns.findIndex(m=>m.field===n),u=this.grid.columns.map((m,y)=>({index:y,column:m})).filter(m=>m.column.editable!==!1),c=u.findIndex(m=>m.index===g),h=this.grid.displayItems;let f=r,p=g,v=!1;switch(t.key){case"ArrowUp":r>0&&(f=r-1,v=!0);break;case"ArrowDown":r<h.length-1&&(f=r+1,v=!0);break;case"ArrowLeft":c>0&&(p=u[c-1].index,v=!0);break;case"ArrowRight":c<u.length-1&&(p=u[c+1].index,v=!0);break;case"PageUp":f=Math.max(0,r-10),v=!0;break;case"PageDown":f=Math.min(h.length-1,r+10),v=!0;break;case"Home":t.ctrlKey&&(f=0),p=0,v=!0;break;case"End":t.ctrlKey?(f=h.length-1,p=this.grid.columns.length-1):p=this.grid.columns.length-1,v=!0;break}v&&(G(this),this.grid.cancelEdit(),queueMicrotask(()=>{z(this,f,p)}));return}switch(t.key){case"ArrowDown":if(this.dropdownOpen){t.preventDefault(),t.stopPropagation();const g=this.getCurrentEditorOptions();let u=this.highlightedIndex+1;for(;u<this.dropdownOptions.length&&Pe(this.dropdownOptions[u],g);)u++;u<this.dropdownOptions.length&&(this.highlightedIndex=u,ue(this),go(this))}break;case"ArrowUp":if(this.dropdownOpen){t.preventDefault(),t.stopPropagation();const g=this.getCurrentEditorOptions();let u=this.highlightedIndex-1;for(;u>=0&&Pe(this.dropdownOptions[u],g);)u--;u>=0&&(this.highlightedIndex=u,ue(this),go(this))}break;case"Enter":if(this.datepicker)return;t.preventDefault(),t.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?co(this,this.highlightedIndex):l&&!this.dropdownOpen?ne(this):(this.isCommittingFromKeyboard=!0,N(this),a==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):et(this,i),mt(this,r,n,"down"));break;case"Tab":if(this.datepicker)return;if(t.preventDefault(),t.stopPropagation(),this.isCommittingFromKeyboard=!0,this.dropdownOpen&&this.highlightedIndex>=0&&l){const g=this.dropdownOptions[this.highlightedIndex],u=this.getCurrentEditorOptions();if(g&&!Pe(g,u)){const c=Se(g,u);this.grid.commitEdit(r,n,c)}N(this)}else N(this),a==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):l||et(this,i);mt(this,r,n,t.shiftKey?"prev":"next");break;case"Escape":t.preventDefault(),t.stopPropagation(),this.dropdownOpen&&N(this),this.datepicker&&(this.datepicker.close(!0),this.datepicker=null),this.isCommittingFromKeyboard=!0,G(this),this.grid.cancelEdit(),Ki(this,r,n);break;case"F2":t.preventDefault(),t.stopPropagation(),l&&!this.dropdownOpen&&ne(this);break;case"Backspace":a==="select"&&(t.preventDefault(),t.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),ho(this,s.editorOptions||{})));break;default:a==="select"&&t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&(t.preventDefault(),t.stopPropagation(),this.filterText+=t.key,ho(this,s.editorOptions||{}));break}}attachEventListeners(){const t=this.shadow.querySelector(".wg__table");if(!t)return;t.addEventListener("focus",n=>{var a;const s=n.target;if(s.matches(".wg__cell")){const l=parseInt(s.dataset.row||"0",10),d=parseInt(s.dataset.col||"0",10);Ni(this,l,d),At(this)}if(s.matches(".wg__select-trigger, .wg__combobox-input, .wg__autocomplete-input")&&!this.justSelected&&!this.dropdownOpen){const l=s.dataset.field||"",d=this.grid.columns.find(c=>c.field===l),g=(d==null?void 0:d.editorOptions)||{};(((a=this.grid.editingCell)==null?void 0:a.initialSearchQuery)!==void 0||g.showOnFocus!==!1)&&ne(this)}},!0),t.addEventListener("keydown",n=>{const s=n.target;if(s.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(n,s);return}if(s.matches(".wg__cell")){const a=parseInt(s.dataset.row||"0",10),l=parseInt(s.dataset.col||"0",10);this.handleCellKeyDown(n,a,l)}}),t.addEventListener("focusout",n=>{Yi(this,n)}),t.addEventListener("dblclick",n=>{n.preventDefault();const a=n.target.closest(".wg__cell");if(a){const l=parseInt(a.dataset.row||"0",10),d=parseInt(a.dataset.col||"0",10),g=this.grid.columns[d];if(g){const u=g.editTrigger||this.grid.editTrigger;if(u==="dblclick"||u==="navigate"){const c=wt(n,a);oe(this,l,d,{cursorPosition:c??void 0});const h=g.editor;h==="select"||h==="combobox"||h==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||ne(this)}):h==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(l,d)})}}}}),t.addEventListener("click",n=>{const a=n.target.closest(".wg__cell");if(a&&!a.classList.contains("wg__cell--editing")){const l=parseInt(a.dataset.row||"0",10),d=parseInt(a.dataset.col||"0",10),g=this.grid.columns[d];if(g&&(g.editTrigger||this.grid.editTrigger)==="click"){n.preventDefault();const c=wt(n,a);oe(this,l,d,{cursorPosition:c??void 0});const h=g.editor;h==="select"||h==="combobox"||h==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||ne(this)}):h==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(l,d)})}}}),t.addEventListener("mousedown",n=>{const s=n.target;if(s.closest(".wg__date-trigger")){n.preventDefault(),n.stopPropagation();const l=s.closest(".wg__cell-date-display"),d=s.closest(".wg__editor--date");if(d){const g=d.querySelector(".wg__date-input");g&&this.openDatePicker(g,d)}else if(l){const g=parseInt(l.dataset.row||"0",10),u=l.dataset.field||"",c=this.grid.columns.findIndex(h=>String(h.field)===u);if(c>=0){if(this.isTransitioningCells=!0,this.grid.editingCell){const h=this.grid.editingCell,f=this.grid.columns.findIndex(p=>String(p.field)===h.field);N(this),G(this),this.grid.cancelEdit(),f>=0&&j(this,h.rowIndex,f)}oe(this,g,c),requestAnimationFrame(()=>{var v;this.isTransitioningCells=!1;const h=(v=this.shadowRoot)==null?void 0:v.querySelector(`.wg__cell[data-row="${g}"][data-field="${u}"]`),f=h==null?void 0:h.querySelector(".wg__date-input"),p=h==null?void 0:h.querySelector(".wg__editor--date");f&&p&&this.openDatePicker(f,p)})}}return}if(this.dropdownOpen||this.grid.editingCell){const l=s.closest(".wg__cell");if(l&&!s.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const d=parseInt(l.dataset.row||"0",10),g=parseInt(l.dataset.col||"0",10),u=this.grid.editingCell,c=s.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(u&&!c){const h=this.grid.columns.findIndex(f=>String(f.field)===u.field);if(d!==u.rowIndex||g!==h){n.preventDefault(),this.isTransitioningCells=!0;const f=u.rowIndex,p=h;N(this),G(this),this.grid.cancelEdit(),p>=0&&j(this,f,p);const v=this.grid.columns[g],m=(v==null?void 0:v.editTrigger)||this.grid.editTrigger,_=n.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,m==="click"&&v&&this.grid.isCellEditable(v)){const S=this.shadow.querySelector(`td[data-row="${d}"][data-col="${g}"]`),b=S?wt({clientX:_},S):void 0;oe(this,d,g,{cursorPosition:b??void 0})}else z(this,d,g)});return}}}}if(s.matches(".wg__combobox-toggle, .wg__select-toggle")){n.preventDefault(),n.stopPropagation();const l=s.closest(".wg__cell-dropdown-display");if(s.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete"))uo(this);else if(l){const g=parseInt(l.dataset.row||"0",10),u=l.dataset.field||"",c=this.grid.columns.findIndex(h=>String(h.field)===u);if(c>=0){this.isTransitioningCells=!0;const h=this.grid.editingCell,f=h?this.grid.columns.findIndex(p=>String(p.field)===h.field):-1;h&&(N(this),G(this),this.grid.cancelEdit(),f>=0&&j(this,h.rowIndex,f)),oe(this,g,c),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||ne(this)})}}}if(s.matches(".wg__cell-dropdown-display")){n.preventDefault(),n.stopPropagation();const l=s.closest(".wg__cell-dropdown-display");if(l){const d=parseInt(l.dataset.row||"0",10),g=l.dataset.field||"",u=this.grid.columns.findIndex(c=>String(c.field)===g);if(u>=0){this.isTransitioningCells=!0;const c=this.grid.editingCell,h=c?this.grid.columns.findIndex(f=>String(f.field)===c.field):-1;c&&(N(this),G(this),this.grid.cancelEdit(),h>=0&&j(this,c.rowIndex,h)),oe(this,d,u),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||ne(this)})}}}}),t.addEventListener("click",n=>{n.target.matches(".wg__select-trigger, .wg__select-value")&&(n.preventDefault(),n.stopPropagation(),uo(this))}),t.addEventListener("mousedown",n=>{const s=n.target,a=s.closest(".wg__resize-handle");if(a){n.preventDefault(),n.stopPropagation();const d=a.dataset.field;d&&sn(this,n,d);return}if(this.grid.allowColumnReorder){const d=s.closest(".wg__header");if(d&&!d.classList.contains("wg__header--frozen")&&!d.classList.contains("wg__row-number-header")){const g=d.dataset.field;g&&un(this,n,g)}}const l=s.closest(".wg__row-number[data-row-number]");if(l){const d=parseInt(l.dataset.rowNumber||"-1",10);d>=0&&En(this,d,n)}}),t.addEventListener("click",n=>{const s=n,a=s.target;if(a.closest(".wg__resize-handle")||gn())return;a.closest(".wg__header--sortable")&&(on(this,s),this.render())}),t.addEventListener("contextmenu",n=>{this.handleContextMenu(n)}),t.addEventListener("change",n=>{const s=n.target;s.matches(".wg__editor--checkbox")&&Bi(this,s)}),t.addEventListener("input",n=>{const s=n.target;s.matches(".wg__combobox-input")?wr(this,n):s.matches(".wg__autocomplete-input")&&pr(this,n)}),t.addEventListener("blur",n=>{const s=n.target;if(s.matches(".wg__editor--text, .wg__editor--number")&&ji(this,s),s.matches(".wg__date-input")&&!this.datepicker&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&this.commitDateEditor(s),s.matches(".wg__select-trigger")&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&!this.dropdownOpen&&!this.isOpeningDropdown&&(N(this),G(this),this.grid.cancelEdit()),s.matches(".wg__combobox-input, .wg__autocomplete-input")){if(this.isCommittingFromKeyboard||this.isTransitioningCells)return;if(N(this),this.grid.editingCell){const a=s,l=this.getCurrentEditingColumn();if(l){const d=l.editorOptions||{},u=(d.options||d.initialOptions||[]).find(c=>He(c,d).toLowerCase()===a.value.toLowerCase());u?this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,Se(u,d)):this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,a.value)}}}},!0);const i=this.shadow.querySelector(".wg");i&&(i.setAttribute("tabindex","-1"),i.addEventListener("keydown",n=>{const s=this.grid.selectedRows;if(s.length===0||n.target.matches('input, textarea, select, [contenteditable="true"]'))return;if(n.key==="Escape"){n.preventDefault(),this.grid.clearSelection();return}const l=this.grid.rangeShortcuts;if(l!=null&&l.length)for(const d of l){const g=Ne(d.key);if(Ye(n,g)){const u={rows:this.grid.getSelectedRowsData(),rowIndices:s};if(!(typeof d.disabled=="function"?d.disabled(u):d.disabled===!0)){n.preventDefault(),d.action(u);return}}}}),i.addEventListener("scroll",()=>{const n=i.scrollLeft>0;if(i.classList.toggle("wg--scrolled-horizontal",n),this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown){const s=this.grid.editingCell,a=s?this.grid.columns.findIndex(l=>String(l.field)===s.field):-1;N(this),G(this),this.grid.cancelEdit(),s&&a>=0&&j(this,s.rowIndex,a)}this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(i),this.grid.infiniteScroll&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(i),Ae()!==null&&(no(this,this.grid.displayItems),this.renderConnector()),At(this)})),this.wheelListenerAdded||(this.wheelListenerAdded=!0,window.addEventListener("scroll",()=>{if(this.dropdownOpen&&!this.isTransitioningCells){const n=this.grid.editingCell,s=n?this.grid.columns.findIndex(a=>String(a.field)===n.field):-1;N(this),G(this),this.grid.cancelEdit(),n&&s>=0&&j(this,n.rowIndex,s)}},{passive:!0,capture:!0})),t.addEventListener("mouseenter",n=>{const s=n.target,a=s.closest("[data-tooltip-html]");if(a){const d=a.getAttribute("data-tooltip-html");Et(this,a,d,this._tooltipShowDelay,!0);return}const l=s.closest("[data-tooltip]");if(l){const d=l.getAttribute("data-tooltip");Et(this,l,d,this._tooltipShowDelay,!1)}},!0),t.addEventListener("mouseleave",n=>{const s=n,a=s.target,l=s.relatedTarget,d=a.closest("[data-tooltip], [data-tooltip-html]");d&&(l==null?void 0:l.closest("[data-tooltip], [data-tooltip-html]"))===d||d&&fo(this,this._tooltipHideDelay)},!0),t.addEventListener("click",n=>{const a=n.target.closest(".wg__toolbar-trigger");if(a&&this.grid.toolbarTrigger==="button"){n.preventDefault(),n.stopPropagation();const l=parseInt(a.dataset.toolbarTrigger||"0",10),d=t.querySelector(`tr[data-row-index="${l}"]`);d&&(yt(l)?this.closeToolbarAndReset():this.showToolbarForRow(d,l))}}),t.addEventListener("click",n=>{if(this.grid.toolbarPosition!=="inline")return;const a=n.target.closest(".wg__inline-action-btn");if(a&&!a.disabled){n.preventDefault(),n.stopPropagation();const l=a.dataset.actionId,d=parseInt(a.dataset.row||"0",10);this.handleInlineActionClick(l,d)}}),t.addEventListener("mouseenter",n=>{const s=n,l=s.target.closest(".wg__row");if(l){const d=parseInt(l.dataset.rowIndex||"0",10);this.grid.setHoveredRow(d),this.grid.toolbarPosition==="inline"&&this.setupInlineShortcuts(),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline"&&(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),yt(d)||this.showToolbarForRow(l,d,s.clientX))}},!0),t.addEventListener("mouseleave",n=>{if(n.target.closest(".wg__row")&&(this.grid.toolbarPosition==="inline"&&setTimeout(()=>{t.matches(":hover")||(this.grid.setHoveredRow(null),this.removeInlineShortcuts())},50),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__toolbar-container"),g=d==null?void 0:d.matches(":hover"),u=t.matches(":hover");!g&&!u&&(this.grid.setHoveredRow(null),this.closeToolbarAndReset())},150)}},!0),t.addEventListener("click",n=>{if(this.grid.toolbarTrigger!=="click")return;const s=n,a=s.target,l=a.closest(".wg__row");if(l&&!a.closest(".wg__cell--editing")){const d=parseInt(l.dataset.rowIndex||"0",10);yt(d)?this.closeToolbarAndReset():this.showToolbarForRow(l,d,s.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",n=>{if(!ro(this.shadow))return;const s=n.composedPath(),a=s.some(g=>{var u;return(u=g.classList)==null?void 0:u.contains("wg__toolbar-container")}),l=s.some(g=>{var u;return(u=g.classList)==null?void 0:u.contains("wg__toolbar-trigger")});a||l||s.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||Ae()!==null&&this.closeToolbarAndReset()})),this.toolbarScrollListenerAdded||(this.toolbarScrollListenerAdded=!0,window.addEventListener("scroll",()=>{Ae()!==null&&this.closeToolbarAndReset()},!0)),this.shadow.querySelectorAll(".wg__pagination").forEach(n=>{n.addEventListener("click",a=>{rn(this,a)&&this.render()});const s=n.querySelector(".wg__pagination-select");s&&s.addEventListener("change",()=>{nn(this,s)&&this.render()})})}scrollToRowProgrammatically(t){const i=this.shadow.querySelector(".wg");if(!i)return;const{scrollTop:r,startIndex:n,endIndex:s}=en({targetRow:t,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,viewportHeight:i.clientHeight,scrollHeight:i.scrollHeight,clientHeight:i.clientHeight});(n!==this.virtualScrollStart||s!==this.virtualScrollEnd)&&(this.virtualScrollStart=n,this.virtualScrollEnd=s,this.renderVirtualRows(i)),this.isProgrammaticScroll=!0,i.scrollTop=r,queueMicrotask(()=>{this.isProgrammaticScroll=!1})}handleVirtualScroll(t){var n;if(this.isProgrammaticScroll)return;const{startIndex:i,endIndex:r}=Zr({scrollTop:t.scrollTop,viewportHeight:t.clientHeight,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,editingRowIndex:(n=this.grid.editingCell)==null?void 0:n.rowIndex});(i!==this.virtualScrollStart||r!==this.virtualScrollEnd)&&(this.virtualScrollStart=i,this.virtualScrollEnd=r,this.renderVirtualRows(t))}renderVirtualRows(t){const i=t.querySelector("tbody");if(!i)return;const r=this.grid.displayItems,n={startIndex:this.virtualScrollStart,endIndex:this.virtualScrollEnd,rowHeight:this.grid.virtualScrollRowHeight,totalItems:r.length},s=this.grid.focusedCell;if(i.innerHTML=ao(this,n),s){this.grid.setFocusedCell(s.rowIndex,s.colIndex);const a=i.querySelector(`td[data-row="${s.rowIndex}"][data-col="${s.colIndex}"]`);a&&(a.focus({preventScroll:!0}),te(this,null,s))}}handleInfiniteScroll(t){tn(t.scrollTop,t.scrollHeight,t.clientHeight,this.grid.infiniteScrollThreshold)&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}renderShortcutsHelpIcon(){var s,a,l;if(!this.grid.showShortcutsHelp||!((s=this.grid.rowShortcuts)!=null&&s.length))return"";const i=this.grid.shortcutsHelpPosition==="top-left"?"wg__shortcuts-help--left":"",r=this.grid.rowShortcuts.map(d=>`<div class="wg__shortcuts-help-item">
|
|
638
|
-
<span class="wg__shortcuts-help-key">${
|
|
641
|
+
`;let Do=!1;function Eo(){if(Do)return;const o=document.createElement("style");o.id="wg-context-menu-styles",o.textContent=on,document.head.appendChild(o),Do=!0}function rn(o,e){const t=o.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(e):r.visible);return t.length===0?"":`<div class="wg-context-menu">${t.map((r,n)=>{const s=typeof r.label=="function"?r.label(e):r.label,a=typeof r.icon=="function"?r.icon(e):r.icon,l=r.shortcut,d=typeof r.disabled=="function"?r.disabled(e):r.disabled,c=r.danger===!0,u=["wg-context-menu__item",d?"wg-context-menu__item--disabled":"",c?"wg-context-menu__item--danger":""].filter(Boolean).join(" "),g=r.dividerBefore&&n>0?'<div class="wg-context-menu__divider"></div>':"",h=a?`<span class="wg-context-menu__icon">${a}</span>`:"",f=l?`<span class="wg-context-menu__shortcut">${l}</span>`:"";return`${g}<div class="${u}" data-item-id="${r.id}" data-disabled="${d?"true":"false"}" data-shortcut="${l||""}">${h}<span class="wg-context-menu__label">${s}</span>${f}</div>`}).join("")}</div>`}function nn(o,e,t,i,r,n,s,a,l){Eo();const d=rn(n,s);if(!d)return null;const c=document.createElement("div");c.className="wg-context-menu-container",c.innerHTML=d,document.body.appendChild(c);const u=c.querySelector(".wg-context-menu"),g=e+i,h=t+r;Ie({getBoundingClientRect:()=>({width:0,height:0,x:g,y:h,top:h,left:g,right:g,bottom:h})},u,{placement:"bottom-start",middleware:[Te({fallbackPlacements:["top-start","bottom-end","top-end"]}),Qe({padding:8})]}).then(({x:m,y})=>{Object.assign(u.style,{left:`${m}px`,top:`${y}px`})}),c.addEventListener("click",m=>{const y=m.target.closest(".wg-context-menu__item");if(y&&y.dataset.disabled!=="true"){const _=y.dataset.itemId||"";a(_)}});const p=m=>{c.contains(m.target)||(Z(c,p,v),l())},v=m=>{if(m.key==="Escape"){m.preventDefault(),Z(c,p,v),l();return}const y=m.key.toLowerCase(),_=c.querySelectorAll(".wg-context-menu__item");for(const S of _){const b=S.dataset.shortcut;if(S.dataset.disabled==="true"||!b)continue;if(b.toLowerCase()===y||b===m.key){m.preventDefault();const k=S.dataset.itemId||"";a(k),Z(c,p,v),l();return}}};return setTimeout(()=>{document.addEventListener("mousedown",p),document.addEventListener("keydown",v)},0),c._cleanup={handleOutsideClick:p,handleKeyDown:v},c}function Z(o,e,t){e&&document.removeEventListener("mousedown",e),t&&document.removeEventListener("keydown",t);const i=o._cleanup;i&&(i.handleOutsideClick&&document.removeEventListener("mousedown",i.handleOutsideClick),i.handleKeyDown&&document.removeEventListener("keydown",i.handleKeyDown)),o.remove()}const sn={sortAsc:{icon:"↑",labelKey:"sortAsc"},sortDesc:{icon:"↓",labelKey:"sortDesc"},clearSort:{icon:"✕",labelKey:"clearSort"},hideColumn:{icon:"👁",labelKey:"hideColumn"},freezeColumn:{icon:"❄",labelKey:"freezeColumn"},unfreezeColumn:{icon:"☀",labelKey:"unfreezeColumn"},columnVisibility:{icon:"👁",labelKey:"columnVisibility",hasSubmenu:!0}};function Ro(o,e){const t=[];let i=!1;for(let r=0;r<o.length;r++){const n=o[r];if(typeof n=="string"){const s=sn[n];if(!s){console.warn(`Unknown predefined header menu action: ${n}`);continue}let a=!0;n==="sortAsc"||n==="sortDesc"?a=d=>d.column.isSortable!==!1:n==="clearSort"?a=d=>d.sortDirection!==null:n==="freezeColumn"?a=d=>!d.isFrozen:n==="unfreezeColumn"&&(a=d=>d.isFrozen);let l;n==="columnVisibility"&&(l=d=>{const u=[{id:"show-all-columns",icon:d.allColumns.every(g=>!g.isHidden)?"☑":"☐",label:d.labels.contextMenu.showAll,onclick:()=>{d.allColumns.forEach(g=>{g.isHidden=!1})}}];return d.allColumns.forEach(g=>{u.push({id:`toggle-col-${String(g.field)}`,icon:g.isHidden?"☐":"☑",label:g.title||String(g.field),onclick:()=>{g.isHidden=!g.isHidden}})}),u}),t.push({id:n,icon:s.icon,label:e.labels.contextMenu[s.labelKey],danger:s.danger,visible:a,dividerBefore:i,submenu:l}),i=!1}else n.dividerBefore&&!n.id&&!n.label?i=!0:(t.push({id:n.id||`header-menu-item-${r}`,...n,dividerBefore:i||n.dividerBefore}),i=!1)}return t}function $o(o,e,t,i=!1){var y,_;const r=typeof o.label=="function"?o.label(e):o.label,n=typeof o.icon=="function"?o.icon(e):o.icon,s=o.shortcut,a=typeof o.disabled=="function"?o.disabled(e):o.disabled,l=o.danger===!0,d=((y=o.children)==null?void 0:y.length)||o.submenu,c=o.children||(o.submenu?o.submenu(e):[]);let u="";d&&c.length>0&&(u=`<div class="wg-context-menu wg-context-menu--submenu">${c.map((b,C)=>$o(b,e,C,!0)).join("")}</div>`);const g=i&&((_=o.id)==null?void 0:_.startsWith("toggle-col-")),f=["wg-context-menu__item",a?"wg-context-menu__item--disabled":"",l?"wg-context-menu__item--danger":"",d?"wg-context-menu__item--has-submenu":"",g?"wg-context-menu__item--toggle":"",g&&n==="☑"?"wg-context-menu__item--checked":""].filter(Boolean).join(" "),p=o.dividerBefore&&t>0?'<div class="wg-context-menu__divider"></div>':"",v=n?`<span class="wg-context-menu__icon">${n}</span>`:"",m=s?`<span class="wg-context-menu__shortcut">${s}</span>`:"";return`${p}<div class="${f}" data-item-id="${o.id}" data-disabled="${a?"true":"false"}" data-shortcut="${s||""}">${v}<span class="wg-context-menu__label">${r}</span>${m}${u}</div>`}function Mo(o,e){const t=o.filter(r=>r.visible===void 0?!0:typeof r.visible=="function"?r.visible(e):r.visible);return t.length===0?"":`<div class="wg-context-menu">${t.map((r,n)=>$o(r,e,n)).join("")}</div>`}function ln(o,e,t,i=!1){const{field:r,columnIndex:n}=t;switch(e){case"sortAsc":case"sortDesc":{const s=e==="sortAsc"?"asc":"desc",a=[...o.grid.sort];if(i&&o.grid.sortMode==="multi"){const l=a.findIndex(d=>d.column===r);l>=0?a[l]={column:r,direction:s}:a.push({column:r,direction:s}),o.grid.sort=a}else o.grid.sort=[{column:r,direction:s}];break}case"clearSort":o.grid.sort=o.grid.sort.filter(s=>s.column!==r);break;case"hideColumn":{const s=o.grid.columns.find(a=>String(a.field)===r);s&&(s.isHidden=!0,o.grid.columns=[...o.grid.columns]);break}case"freezeColumn":o.grid.freezeColumns=n+1;break;case"unfreezeColumn":o.grid.freezeColumns=Math.max(0,n);break}}function To(o,e,t,i,r,n,s){Eo();const a=Mo(i,r);if(!a)return null;const l=document.createElement("div");l.className="wg-context-menu-container",l.innerHTML=a,document.body.appendChild(l);let d=l.querySelector(".wg-context-menu");Ie({getBoundingClientRect:()=>({width:0,height:0,x:e,y:t,top:t,left:e,right:e,bottom:t})},d,{placement:"bottom-start",middleware:[Te({fallbackPlacements:["top-start","bottom-end","top-end"]}),Qe({padding:8})]}).then(({x:p,y:v})=>{Object.assign(d.style,{left:`${p}px`,top:`${v}px`})}),l.addEventListener("click",p=>{const v=p.target.closest(".wg-context-menu__item");if(!v||v.dataset.disabled==="true")return;const m=v.dataset.itemId||"",y=p.ctrlKey;if(!v.classList.contains("wg-context-menu__item--has-submenu")){if(m.startsWith("toggle-col-")||m==="show-all-columns"){n(m,!0,y);const _=Mo(i,r),S=document.createElement("div");S.innerHTML=_;const b=S.querySelector(".wg-context-menu");if(b&&d.parentNode){b.style.left=d.style.left,b.style.top=d.style.top,d.parentNode.replaceChild(b,d),d=b;const C=b.querySelector(".wg-context-menu--submenu");C&&(C.style.display="block")}return}n(m,!1,y)}});const u=()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",f),window.removeEventListener("scroll",h,!0),l.remove()},g=p=>{l.contains(p.target)||(u(),s())},h=()=>{u(),s()},f=p=>{if(p.key==="Escape"){p.preventDefault(),u(),s();return}const v=p.key.toLowerCase(),m=l.querySelectorAll(".wg-context-menu__item");for(const y of m){const _=y.dataset.shortcut;if(y.dataset.disabled==="true"||!_)continue;if(_.toLowerCase()===v||_===p.key){p.preventDefault();const C=y.dataset.itemId||"";n(C),u(),s();return}}};return setTimeout(()=>{document.addEventListener("mousedown",g),document.addEventListener("keydown",f),window.addEventListener("scroll",h,!0)},0),l._cleanup=u,l}function qe(o){const e=o.split("+").map(i=>i.trim()),t={key:"",ctrl:!1,shift:!1,alt:!1,meta:!1};for(const i of e){const r=i.toLowerCase();r==="ctrl"||r==="control"?t.ctrl=!0:r==="shift"?t.shift=!0:r==="alt"?t.alt=!0:r==="meta"||r==="cmd"||r==="command"?t.meta=!0:t.key=i}return t}function Ne(o,e){if(e.ctrl!==o.ctrlKey||e.shift!==o.shiftKey||e.alt!==o.altKey||e.meta!==o.metaKey)return!1;const t=o.key.toLowerCase(),i=e.key.toLowerCase();return t===i}function an(o){return o.split("+").map(e=>{const t=e.trim();return["ctrl","control","shift","alt","meta","cmd","command"].includes(t.toLowerCase())?t.charAt(0).toUpperCase()+t.slice(1).toLowerCase():t}).join("+")}function dn(o){const{scrollTop:e,viewportHeight:t,rowHeight:i,buffer:r,totalItems:n,editingRowIndex:s}=o;let a=Math.max(0,Math.floor(e/i)-r);const l=Math.ceil(t/i)+r*2;let d=Math.min(n,a+l);return s!==void 0&&(s<a&&(a=s),s>=d&&(d=s+1)),{startIndex:a,endIndex:d}}function cn(o){const{targetRow:e,rowHeight:t,buffer:i,totalItems:r,viewportHeight:n,scrollHeight:s,clientHeight:a}=o,l=Math.max(0,(e-1)*t),d=Math.max(0,s-a),c=Math.min(l,d);let u=Math.max(0,Math.floor(c/t)-i);const g=Math.ceil(n/t)+i*2;let h=Math.min(r,u+g);return e<u&&(u=e),e>=h&&(h=e+1),{scrollTop:c,startIndex:u,endIndex:h}}function gn(o,e,t,i){return e-(o+t)<=i}function un(o,e){const i=e.target.closest(".wg__header--sortable");if(!i)return;const r=i.dataset.field;if(!r)return;const n=[...o.grid.sort],s=n.findIndex(l=>l.column===r);(e.ctrlKey||e.metaKey)&&o.grid.sortMode==="multi"?s>=0?n[s].direction==="asc"?n[s]={column:r,direction:"desc"}:n.splice(s,1):n.push({column:r,direction:"asc"}):s>=0&&n.length===1?n[0].direction==="asc"?n[0]={column:r,direction:"desc"}:n.length=0:(n.length=0,n.push({column:r,direction:"asc"})),o.grid.sort=n,o.grid.isPageable&&(o.grid.currentPage=1),o.grid.fireDataRequest("sort")}function hn(o,e){const i=e.target.closest(".wg__pagination-btn");if(!i||i.hasAttribute("disabled"))return!1;const r=i.dataset.action;let n=!1;return r==="first"&&o.grid.currentPage!==1?(o.grid.currentPage=1,n=!0):r==="prev"&&o.grid.currentPage>1?(o.grid.currentPage--,n=!0):r==="next"&&o.grid.currentPage<o.grid.totalPages?(o.grid.currentPage++,n=!0):r==="last"&&o.grid.currentPage!==o.grid.totalPages&&(o.grid.currentPage=o.grid.totalPages,n=!0),n&&o.grid.fireDataRequest("page"),n}function fn(o,e){const t=parseInt(e.value,10);return t!==o.grid.pageSize?(o.grid.pageSize=t,o.grid.currentPage=1,o.grid.fireDataRequest("pageSize"),!0):!1}let H={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},fe=null;function Io(o,e){if(!o)return e;const t=parseFloat(o);return isNaN(t)?e:t}function wn(o,e,t){const i=e.target,r=i.closest(".wg__header");if(!r)return;const n=o.grid.columns.find(l=>String(l.field)===t);if(!n||n.isResizable===!1)return;const s=r.getBoundingClientRect().width;H={isResizing:!0,startX:e.clientX,startWidth:s,field:t,headerCell:r,minWidth:Io(n.minWidth,30),maxWidth:n.maxWidth?Io(n.maxWidth,1/0):null},fe=o,n.minWidth?r.style.minWidth=n.minWidth:r.style.minWidth=`${H.minWidth}px`;const a=o.shadow.querySelector(".wg");a==null||a.classList.add("wg--resizing"),i.classList.add("wg__resize-handle--active"),document.addEventListener("mousemove",zo),document.addEventListener("mouseup",Lo),e.preventDefault()}function zo(o){if(!H.isResizing||!fe)return;const e=o.clientX-H.startX;let t=H.startWidth+e;t=Math.max(t,H.minWidth),H.maxWidth!==null&&(t=Math.min(t,H.maxWidth)),H.headerCell&&(H.headerCell.style.width=`${t}px`,H.headerCell.style.maxWidth=`${t}px`),pn(fe,H.field,`${t}px`),(fe.grid.freezeColumns>0||fe.grid.isStickyRowNumbers)&&bn(fe)}function Lo(o){if(!H.isResizing||!fe)return;const e=fe,t=H.field,i=`${H.startWidth}px`,r=o.clientX-H.startX;let n=H.startWidth+r;n=Math.max(n,H.minWidth),H.maxWidth!==null&&(n=Math.min(n,H.maxWidth));const s=`${n}px`;e.grid.setColumnWidth(t,s,!0);const a=e.shadow.querySelector(`col[data-field="${t}"]`);a&&(a.style.width=s);const l=e.shadow.querySelector(".wg");l==null||l.classList.remove("wg--resizing");const d=e.shadow.querySelector(".wg__resize-handle--active");d==null||d.classList.remove("wg__resize-handle--active"),e.grid.oncolumnresize&&e.grid.oncolumnresize({field:t,oldWidth:i,newWidth:s,allWidths:e.grid.getColumnWidthsState()}),e.grid.shouldPersistColumnWidths&&e.grid.gridName&&e.grid.savePersistedWidths(),document.removeEventListener("mousemove",zo),document.removeEventListener("mouseup",Lo),H={isResizing:!1,startX:0,startWidth:0,field:"",headerCell:null,minWidth:30,maxWidth:null},fe=null}function pn(o,e,t){o.shadow.querySelectorAll(`td[data-field="${e}"]`).forEach(r=>{r.style.width=t,r.style.maxWidth=t})}const mn=40;function bn(o){const e=o.grid.freezeColumns;let i=o.grid.isRowNumbersVisible&&o.grid.isStickyRowNumbers?mn:0;const r=o.grid.visualColumns;for(let n=0;n<e&&n<r.length;n++){const{column:s}=r[n],a=String(s.field),l=o.shadow.querySelector(`th[data-field="${a}"]`);l&&(l.style.left=`${i}px`,o.shadow.querySelectorAll(`td[data-field="${a}"]`).forEach(c=>{c.style.left=`${i}px`}),i+=l.getBoundingClientRect().width)}}const _n=5;let R={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},we=null,Ot=!1;function vn(){return Ot?(Ot=!1,!0):R.isReordering}function yn(o,e,t){const i=e.target,r=i.closest(".wg__header");if(!r||i.classList.contains("wg__resize-handle"))return;const n=o.grid.visualColumns,s=o.grid.totalFrozenColumns,a=n.findIndex(d=>String(d.column.field)===t);if(a<s)return;const l=a-s;R={isPending:!0,isReordering:!1,field:t,startX:e.clientX,startY:e.clientY,headerCell:r,ghost:null,dropIndicator:null,fromIndex:l,currentDropIndex:l},we=o,document.addEventListener("mousemove",Ao),document.addEventListener("mouseup",Oo),e.preventDefault()}function Cn(o,e,t){var r;const i=document.createElement("div");i.className="wg__reorder-ghost",i.textContent=((r=e.querySelector(".wg__header-title"))==null?void 0:r.textContent)||"",i.style.left=`${t.clientX+10}px`,i.style.top=`${t.clientY-10}px`,o.shadow.appendChild(i),R.ghost=i}function Sn(o){var t;const e=document.createElement("div");e.className="wg__drop-indicator",(t=o.shadow.querySelector(".wg"))==null||t.appendChild(e),R.dropIndicator=e}function xn(o,e){R.isPending=!1,R.isReordering=!0;const t=o.shadow.querySelector(".wg");t==null||t.classList.add("wg--reordering"),R.headerCell&&R.headerCell.classList.add("wg__header--dragging"),R.headerCell&&Cn(o,R.headerCell,e),Sn(o)}function Ao(o){if(!we)return;if(R.isPending){const i=o.clientX-R.startX,r=o.clientY-R.startY;Math.sqrt(i*i+r*r)>=_n&&xn(we,o);return}if(!R.isReordering||!we.shadow.querySelector(".wg"))return;R.ghost&&(R.ghost.style.left=`${o.clientX+10}px`,R.ghost.style.top=`${o.clientY-10}px`);const t=kn(we,o.clientX);t!==R.currentDropIndex&&(R.currentDropIndex=t,Dn(we,t))}function kn(o,e){const t=o.grid.visualColumns,i=o.grid.totalFrozenColumns,r=t.slice(i);if(r.length===0)return 0;const n=String(r[0].column.field),s=o.shadow.querySelector(`th[data-field="${n}"]`);if(s){const a=s.getBoundingClientRect();if(e<a.left)return 0}for(let a=0;a<r.length;a++){const l=String(r[a].column.field),d=o.shadow.querySelector(`th[data-field="${l}"]`);if(d){const c=d.getBoundingClientRect(),u=c.left+c.width/2;if(e<u)return a}}return r.length}function Dn(o,e){const t=R.dropIndicator;if(!t)return;const i=o.grid.visualColumns,r=o.grid.totalFrozenColumns,n=i.slice(r),s=o.shadow.querySelector(".wg"),a=s==null?void 0:s.getBoundingClientRect();if(!a||!s)return;let l;if(e>=n.length){const u=String(n[n.length-1].column.field),g=o.shadow.querySelector(`th[data-field="${u}"]`);if(g)l=g.getBoundingClientRect().right-a.left+s.scrollLeft;else return}else{const u=String(n[e].column.field),g=o.shadow.querySelector(`th[data-field="${u}"]`);if(g)l=g.getBoundingClientRect().left-a.left+s.scrollLeft;else return}const d=s.scrollTop,c=s.clientHeight;t.style.left=`${l}px`,t.style.top=`${d}px`,t.style.height=`${c}px`,t.style.display="block"}function Oo(o){if(!we)return;const e=we;if(R.isPending){Po(e);return}if(!R.isReordering)return;const t=R.field,i=R.fromIndex,r=R.currentDropIndex;if(i!==r&&r!==i+1){const n=r>i?r-1:r;e.grid.moveColumn(t,n),e.grid.oncolumnreorder&&e.grid.oncolumnreorder({field:t,fromIndex:i,toIndex:n,allOrder:e.grid.getColumnOrderState()}),e.grid.shouldPersistColumnOrder&&e.grid.gridName&&e.grid.savePersistedState()}Ot=!0,Po(e)}function Po(o){R.ghost&&R.ghost.remove(),R.dropIndicator&&R.dropIndicator.remove();const e=o.shadow.querySelector(".wg");e==null||e.classList.remove("wg--reordering"),R.headerCell&&R.headerCell.classList.remove("wg__header--dragging"),document.removeEventListener("mousemove",Ao),document.removeEventListener("mouseup",Oo),R={isPending:!1,isReordering:!1,field:"",startX:0,startY:0,headerCell:null,ghost:null,dropIndicator:null,fromIndex:-1,currentDropIndex:-1},we=null}const En=5;let se={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},_e=null;function Rn(o,e,t){if(t.preventDefault(),t.stopPropagation(),t.ctrlKey||t.metaKey){o.grid.selectRow(e,"toggle"),requestAnimationFrame(()=>{const i=o.shadow.querySelector(".wg");i==null||i.focus()});return}if(t.shiftKey){o.grid.selectRow(e,"range"),requestAnimationFrame(()=>{const i=o.shadow.querySelector(".wg");i==null||i.focus()});return}se={isPending:!0,isDragging:!1,startRowIndex:e,startX:t.clientX,startY:t.clientY,currentRowIndex:e},_e=o,o.grid.selectRow(e,"replace"),document.addEventListener("mousemove",Ho),document.addEventListener("mouseup",Vo)}function Ho(o){if(!_e)return;if(se.isPending){const t=o.clientX-se.startX,i=o.clientY-se.startY;Math.sqrt(t*t+i*i)>=En&&$n(_e);return}if(!se.isDragging)return;const e=Mn(_e,o.clientY);e!==null&&e!==se.currentRowIndex&&(se.currentRowIndex=e,_e.grid.selectRowRange(se.startRowIndex,e))}function $n(o){se.isPending=!1,se.isDragging=!0;const e=o.shadow.querySelector(".wg");e==null||e.classList.add("wg--selecting")}function Vo(){if(!_e)return;const o=_e,e=o.shadow.querySelector(".wg");e==null||e.classList.remove("wg--selecting"),requestAnimationFrame(()=>{const t=o.shadow.querySelector(".wg");t==null||t.focus()}),document.removeEventListener("mousemove",Ho),document.removeEventListener("mouseup",Vo),se={isPending:!1,isDragging:!1,startRowIndex:-1,startX:0,startY:0,currentRowIndex:-1},_e=null}function Mn(o,e){const t=o.shadow.querySelectorAll(".wg__row[data-row-index]");for(const i of t){const r=i.getBoundingClientRect();if(e>=r.top&&e<=r.bottom){const n=parseInt(i.dataset.rowIndex||"-1",10);if(n>=0)return n}}if(t.length>0){const i=t[0],r=t[t.length-1],n=i.getBoundingClientRect(),s=r.getBoundingClientRect();if(e<n.top)return parseInt(i.dataset.rowIndex||"0",10);if(e>s.bottom)return parseInt(r.dataset.rowIndex||"0",10)}return null}class Pt extends HTMLElement{constructor(){super();w(this,"grid");w(this,"shadow");w(this,"styleElement");w(this,"customStyleElement",null);w(this,"updatePending",!1);w(this,"isCommittingFromKeyboard",!1);w(this,"isTransitioningCells",!1);w(this,"wheelListenerAdded",!1);w(this,"toolbarOutsideClickAdded",!1);w(this,"toolbarScrollListenerAdded",!1);w(this,"toolbarMoveInProgress",!1);w(this,"toolbarHideTimeout",null);w(this,"toolbarHovered",!1);w(this,"toolbarShortcutHandler",null);w(this,"inlineShortcutHandler",null);w(this,"dropdownOpen",!1);w(this,"dropdownOptions",[]);w(this,"highlightedIndex",-1);w(this,"filterText","");w(this,"isUserFiltering",!1);w(this,"justSelected",!1);w(this,"isOpeningDropdown",!1);w(this,"isClosingViaToggle",!1);w(this,"isProgrammaticScroll",!1);w(this,"searchDebounceTimer",null);w(this,"searchAbortController",null);w(this,"isSearching",!1);w(this,"tooltipElement",null);w(this,"tooltipArrowElement",null);w(this,"tooltipAnchor",null);w(this,"tooltipShowTimer",null);w(this,"tooltipHideTimer",null);w(this,"_tooltipShowDelay",400);w(this,"_tooltipHideDelay",100);w(this,"datepicker",null);w(this,"contextMenuElement",null);w(this,"headerContextMenuElement",null);w(this,"virtualScrollStart",0);w(this,"virtualScrollEnd",0);w(this,"scrollListenerAdded",!1);w(this,"isLoadingMoreItems",!1);w(this,"handlePaste",t=>{var d;if(!this.grid.isNavigateMode||this.grid.editingCell||!this.grid.focusedCell)return;const{rowIndex:i,colIndex:r}=this.grid.focusedCell,n=this.grid.columns[r],s=this.grid.displayItems[i];if(!n||!s||!this.grid.isCellEditable(n))return;t.preventDefault();let a=((d=t.clipboardData)==null?void 0:d.getData("text"))||"";if(n.beforePasteCallback){const c=n.beforePasteCallback(a,s);a=c!=null?String(c):""}const l=String(n.field);this.grid.commitEdit(i,l,a),this.render()});this.shadow=this.attachShadow({mode:"open"}),this.grid=new co,this.styleElement=document.createElement("style"),this.styleElement.textContent=cr,this.shadow.appendChild(this.styleElement),this.grid.requestUpdate=()=>this.requestUpdate(),this.grid._onInteractionChange=(t,i)=>{t==="editingCell"&&i.current===null&&Y(this)}}get tooltipShowDelay(){return this._tooltipShowDelay}set tooltipShowDelay(t){this._tooltipShowDelay=t}get tooltipHideDelay(){return this._tooltipHideDelay}set tooltipHideDelay(t){this._tooltipHideDelay=t}connectedCallback(){this.grid.gridName&&this.grid.shouldPersistColumnWidths&&this.grid.loadPersistedWidths(),this.render(),this.addEventListener("paste",this.handlePaste)}disconnectedCallback(){this.removeEventListener("paste",this.handlePaste),this.datepicker&&(this.datepicker.destroy(),this.datepicker=null),this.contextMenuElement&&(Z(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(Z(this.headerContextMenuElement),this.headerContextMenuElement=null),tt(),this.removeInlineShortcuts()}get items(){return this.grid.items}set items(t){this.grid.items=t,this.isLoadingMoreItems=!1}get columns(){return this.grid.columns}set columns(t){this.grid.columns=t}get isFilterable(){return this.grid.isFilterable}set isFilterable(t){this.grid.isFilterable=t}get isPageable(){return this.grid.isPageable}set isPageable(t){this.grid.isPageable=t}get pageSize(){return this.grid.pageSize}set pageSize(t){this.grid.pageSize=t}get pageSizes(){return this.grid.pageSizes}set pageSizes(t){this.grid.pageSizes=t}get isStriped(){return this.grid.isStriped}set isStriped(t){this.grid.isStriped=t}get isHoverable(){return this.grid.isHoverable}set isHoverable(t){this.grid.isHoverable=t}get isEditable(){return this.grid.isEditable}set isEditable(t){this.grid.isEditable=t}get editTrigger(){return this.grid.editTrigger}set editTrigger(t){this.grid.editTrigger=t}get editStartSelection(){return this.grid.editStartSelection}set editStartSelection(t){this.grid.editStartSelection=t}get mode(){return this.grid.mode}set mode(t){this.grid.mode=t}get dropdownToggleVisibility(){return this.grid.dropdownToggleVisibility}set dropdownToggleVisibility(t){this.grid.dropdownToggleVisibility=t}get shouldShowDropdownOnFocus(){return this.grid.shouldShowDropdownOnFocus}set shouldShowDropdownOnFocus(t){this.grid.shouldShowDropdownOnFocus=t}get shouldOpenDropdownOnEnter(){return this.grid.shouldOpenDropdownOnEnter}set shouldOpenDropdownOnEnter(t){this.grid.shouldOpenDropdownOnEnter=t}get isCheckboxAlwaysEditable(){return this.grid.isCheckboxAlwaysEditable}set isCheckboxAlwaysEditable(t){this.grid.isCheckboxAlwaysEditable=t}get isRowNumbersVisible(){return this.grid.isRowNumbersVisible}set isRowNumbersVisible(t){this.grid.isRowNumbersVisible=t}get isStickyRowNumbers(){return this.grid.isStickyRowNumbers}set isStickyRowNumbers(t){this.grid.isStickyRowNumbers=t}get freezeColumns(){return this.grid.freezeColumns}set freezeColumns(t){this.grid.freezeColumns=t}get invalidCells(){return this.grid.invalidCells}set invalidCells(t){this.grid.invalidCells=t}get isRowToolbarVisible(){return this.grid.isRowToolbarVisible}set isRowToolbarVisible(t){this.grid.isRowToolbarVisible=t}get rowToolbar(){return this.grid.rowToolbar}set rowToolbar(t){this.grid.rowToolbar=t}get toolbarVerticalAlign(){return this.grid.toolbarVerticalAlign}set toolbarVerticalAlign(t){this.grid.toolbarVerticalAlign=t}get toolbarHorizontalAlign(){return this.grid.toolbarHorizontalAlign}set toolbarHorizontalAlign(t){this.grid.toolbarHorizontalAlign=t}get toolbarAlign(){return this.grid.toolbarVerticalAlign}set toolbarAlign(t){this.grid.toolbarVerticalAlign=t}get toolbarTopPosition(){return this.grid.toolbarHorizontalAlign}set toolbarTopPosition(t){this.grid.toolbarHorizontalAlign=t}get toolbarTrigger(){return this.grid.toolbarTrigger}set toolbarTrigger(t){this.grid.toolbarTrigger=t}get toolbarPosition(){return this.grid.toolbarPosition}set toolbarPosition(t){this.grid.toolbarPosition=t}get inlineActionsTitle(){return this.grid.inlineActionsTitle}set inlineActionsTitle(t){this.grid.inlineActionsTitle=t}get contextMenu(){return this.grid.contextMenu}set contextMenu(t){this.grid.contextMenu=t}get contextMenuXOffset(){return this.grid.contextMenuXOffset}set contextMenuXOffset(t){this.grid.contextMenuXOffset=t}get contextMenuYOffset(){return this.grid.contextMenuYOffset}set contextMenuYOffset(t){this.grid.contextMenuYOffset=t}get headerContextMenu(){return this.grid.headerContextMenu}set headerContextMenu(t){this.grid.headerContextMenu=t}set onheadercontextmenuopen(t){this.grid.onheadercontextmenuopen=t}get rowShortcuts(){return this.grid.rowShortcuts}set rowShortcuts(t){this.grid.rowShortcuts=t}get rangeShortcuts(){return this.grid.rangeShortcuts}set rangeShortcuts(t){this.grid.rangeShortcuts=t}get selectedRows(){return this.grid.selectedRows}selectRow(t,i="replace"){this.grid.selectRow(t,i)}selectRowRange(t,i){this.grid.selectRowRange(t,i)}clearSelection(){this.grid.clearSelection()}isRowSelected(t){return this.grid.isRowSelected(t)}getSelectedRowsData(){return this.grid.getSelectedRowsData()}get isShortcutsHelpVisible(){return this.grid.isShortcutsHelpVisible}set isShortcutsHelpVisible(t){this.grid.isShortcutsHelpVisible=t}get shortcutsHelpPosition(){return this.grid.shortcutsHelpPosition}set shortcutsHelpPosition(t){this.grid.shortcutsHelpPosition=t}get shortcutsHelpContentCallback(){return this.grid.shortcutsHelpContentCallback}set shortcutsHelpContentCallback(t){this.grid.shortcutsHelpContentCallback=t}set onrowchange(t){this.grid.onrowchange=t}set onroweditstart(t){this.grid.onroweditstart=t}set onroweditcancel(t){this.grid.onroweditcancel=t}set onvalidationerror(t){this.grid.onvalidationerror=t}get validationTooltipCallback(){return this.grid.validationTooltipCallback}set validationTooltipCallback(t){this.grid.validationTooltipCallback=t}set ontoolbarclick(t){this.grid.ontoolbarclick=t}set onrowaction(t){this.grid.onrowaction=t}set oncontextmenuopen(t){this.grid.oncontextmenuopen=t}get ondatarequest(){return this.grid.ondatarequest}set ondatarequest(t){this.grid.ondatarequest=t}get onrowdelete(){return this.grid.onrowdelete}set onrowdelete(t){this.grid.onrowdelete=t}get sort(){return this.grid.sort}set sort(t){this.grid.sort=t}get sortMode(){return this.grid.sortMode}set sortMode(t){this.grid.sortMode=t}get currentPage(){return this.grid.currentPage}set currentPage(t){this.grid.currentPage=t}get totalItems(){return this.grid.totalItems}set totalItems(t){this.grid.totalItems=t}get showPagination(){return this.grid.showPagination}set showPagination(t){this.grid.showPagination=t}get paginationPosition(){return this.grid.paginationPosition}set paginationPosition(t){this.grid.paginationPosition=t}get paginationLabelsCallback(){return this.grid.paginationLabelsCallback}set paginationLabelsCallback(t){this.grid.paginationLabelsCallback=t}get paginationLayout(){return this.grid.paginationLayout}set paginationLayout(t){this.grid.paginationLayout=t}get summaryPosition(){return this.grid.summaryPosition}set summaryPosition(t){this.grid.summaryPosition=t}get summaryContentCallback(){return this.grid.summaryContentCallback}set summaryContentCallback(t){this.grid.summaryContentCallback=t}get customStylesCallback(){return this.grid.customStylesCallback}set customStylesCallback(t){this.grid.customStylesCallback=t,this.updateCustomStyles()}get rowClassCallback(){return this.grid.rowClassCallback}set rowClassCallback(t){this.grid.rowClassCallback=t}get labels(){return this.grid.labels}set labels(t){this.grid.labels=t}get summaryMetadata(){return this.grid.summaryMetadata}set summaryMetadata(t){this.grid.summaryMetadata=t}get isSummaryInline(){return this.grid.isSummaryInline}set isSummaryInline(t){this.grid.isSummaryInline=t}get idValueMember(){return this.grid.idValueMember}set idValueMember(t){this.grid.idValueMember=t}get idValueCallback(){return this.grid.idValueCallback}set idValueCallback(t){this.grid.idValueCallback=t}get rowLocking(){return this.grid.rowLocking}set rowLocking(t){this.grid.rowLocking=t}get onrowlockchange(){return this.grid.onrowlockchange}set onrowlockchange(t){this.grid.onrowlockchange=t}get gridName(){return this.grid.gridName}set gridName(t){this.grid.gridName=t,this.tryLoadPersistedWidths()}get shouldPersistColumnWidths(){return this.grid.shouldPersistColumnWidths}set shouldPersistColumnWidths(t){this.grid.shouldPersistColumnWidths=t,this.tryLoadPersistedState()}get isColumnReorderAllowed(){return this.grid.isColumnReorderAllowed}set isColumnReorderAllowed(t){this.grid.isColumnReorderAllowed=t}get shouldPersistColumnOrder(){return this.grid.shouldPersistColumnOrder}set shouldPersistColumnOrder(t){this.grid.shouldPersistColumnOrder=t,this.tryLoadPersistedState()}tryLoadPersistedState(){this.grid.gridName&&(this.grid.shouldPersistColumnWidths||this.grid.shouldPersistColumnOrder)&&(this.grid.loadPersistedState(),this.isConnected&&this.render())}tryLoadPersistedWidths(){this.tryLoadPersistedState()}get oncolumnresize(){return this.grid.oncolumnresize}set oncolumnresize(t){this.grid.oncolumnresize=t}get oncolumnreorder(){return this.grid.oncolumnreorder}set oncolumnreorder(t){this.grid.oncolumnreorder=t}get fillDragCallback(){return this.grid.fillDragCallback}set fillDragCallback(t){this.grid.fillDragCallback=t}get isVirtualScrollEnabled(){return this.grid.isVirtualScrollEnabled}set isVirtualScrollEnabled(t){this.grid.isVirtualScrollEnabled=t}get virtualScrollThreshold(){return this.grid.virtualScrollThreshold}set virtualScrollThreshold(t){this.grid.virtualScrollThreshold=t}get virtualScrollRowHeight(){return this.grid.virtualScrollRowHeight}set virtualScrollRowHeight(t){this.grid.virtualScrollRowHeight=t}get virtualScrollBuffer(){return this.grid.virtualScrollBuffer}set virtualScrollBuffer(t){this.grid.virtualScrollBuffer=t}get isInfiniteScrollEnabled(){return this.grid.isInfiniteScrollEnabled}set isInfiniteScrollEnabled(t){this.grid.isInfiniteScrollEnabled=t}get infiniteScrollThreshold(){return this.grid.infiniteScrollThreshold}set infiniteScrollThreshold(t){this.grid.infiniteScrollThreshold=t}get hasMoreItems(){return this.grid.hasMoreItems}set hasMoreItems(t){this.grid.hasMoreItems=t}get displayItems(){return this.grid.displayItems}get totalPages(){return this.grid.totalPages}get isNavigateMode(){return this.grid.isNavigateMode}getRowDraft(t){return this.grid.getRowDraft(t)}hasRowDraft(t){return this.grid.hasRowDraft(t)}discardRowDraft(t){this.grid.discardRowDraft(t)}getDraftRowIndices(){return this.grid.getDraftRowIndices()}discardAllDrafts(){this.grid.discardAllDrafts()}isCellInvalid(t,i){return this.grid.isCellInvalid(t,i)}getCellValidationError(t,i){return this.grid.getCellValidationError(t,i)}getRowId(t){return this.grid.getRowId(t)}findRowById(t){return this.grid.findRowById(t)}isRowLocked(t){return this.grid.isRowLocked(t)}getRowLockInfo(t){return this.grid.getRowLockInfo(t)}lockRowById(t,i){return this.grid.lockRowById(t,i)}unlockRowById(t){return this.grid.unlockRowById(t)}getExternalLocks(){return this.grid.getExternalLocks()}clearExternalLocks(){this.grid.clearExternalLocks()}updateRowById(t,i){return this.grid.updateRowById(t,i)}replaceRowById(t,i){return this.grid.replaceRowById(t,i)}canEditCell(t,i){return this.grid.canEditCell(t,i)}setColumnWidth(t,i){this.grid.setColumnWidth(t,i)}setColumnWidths(t){this.grid.setColumnWidths(t)}getColumnWidthsState(){return this.grid.getColumnWidthsState()}setColumnOrder(t){this.grid.setColumnOrder(t)}getColumnOrderState(){return this.grid.getColumnOrderState()}focusCell(t,i){const r=this.grid.columns,n=this.grid.displayItems;t<0||t>=n.length||i<0||i>=r.length||(this.grid.setFocusedCell(t,i),requestAnimationFrame(()=>{z(this,t,i)}))}startEditing(t,i){const r=this.grid.columns;if(i<0||i>=r.length)return;const n=r[i],s=String(n.field);this.grid.startEdit(t,s);const a=this.shadow.querySelector(`td[data-row="${t}"][data-col="${i}"]`);a&&(a.classList.remove("wg__cell--focused"),a.classList.add("wg__cell--editing"),a.innerHTML=et(this,t,i,n))}escapeHtml(t){const i=document.createElement("div");return i.textContent=t,i.innerHTML}getCurrentEditingColumn(){const t=this.grid.editingCell;return t&&this.grid.columns.find(i=>String(i.field)===t.field)||null}getCurrentEditorOptions(){const t=this.getCurrentEditingColumn();return(t==null?void 0:t.editorOptions)||{}}moveFocusAfterCommit(t,i,r){Dt(this,t,i,r)}requestUpdate(){this.updatePending||(this.updatePending=!0,queueMicrotask(()=>{this.updatePending=!1,this.render()}))}updateCustomStyles(){const t=this.grid.customStylesCallback;if(t){const i=t();this.customStyleElement||(this.customStyleElement=document.createElement("style"),this.shadow.appendChild(this.customStyleElement)),this.customStyleElement.textContent=i}else this.customStyleElement&&(this.customStyleElement.remove(),this.customStyleElement=null)}handleCellKeyDown(t,i,r){var u;if(!this.grid.isNavigateMode)return;const n=this.grid.columns,s=this.grid.displayItems,a=this.grid.getEditableColumns(),l=a.findIndex(g=>g.index===r);if((t.ctrlKey||t.metaKey)&&t.key==="c"){const g=n[r],h=s[i];if(g&&h){let f=this.grid.getCellRawValue(h,i,String(g.field));g.beforeCopyCallback&&(f=g.beforeCopyCallback(f,h));const p=f!=null?String(f):"";navigator.clipboard.writeText(p)}return}const d=this.grid.selectedRows;if(d.length>0){const g=this.grid.rangeShortcuts;if(g&&g.length>0)for(const h of g){const f=qe(h.key);if(Ne(t,f)){const p={rows:this.grid.getSelectedRowsData(),rowIndices:d};if(!(typeof h.disabled=="function"?h.disabled(p):h.disabled===!0)){t.preventDefault(),h.action(p);return}}}}const c=this.grid.rowShortcuts;if(c&&c.length>0){const g=n[r],h=s[i];if(g&&h)for(const f of c){const p=qe(f.key);if(Ne(t,p)){const v={row:h,rowIndex:i,colIndex:r,column:g,cellValue:this.grid.getCellRawValue(h,i,String(g.field))};if(!(typeof f.disabled=="function"?f.disabled(v):f.disabled===!0)){t.preventDefault(),f.action(v);return}}}}switch(t.key){case"ArrowUp":t.preventDefault(),i>0&&z(this,i-1,r);break;case"ArrowDown":t.preventDefault(),i<s.length-1&&z(this,i+1,r);break;case"ArrowLeft":t.preventDefault(),r>0&&z(this,i,r-1);break;case"ArrowRight":t.preventDefault(),r<n.length-1&&z(this,i,r+1);break;case"Tab":if(t.preventDefault(),t.shiftKey){if(l>0){const g=a[l-1].index;z(this,i,g)}else if(i>0){const g=a[a.length-1].index;z(this,i-1,g)}}else if(l>=0&&l<a.length-1){const g=a[l+1].index;z(this,i,g)}else if(l===-1&&a.length>0)z(this,i,a[0].index);else if(i<s.length-1){const g=a[0].index;z(this,i+1,g)}break;case"Home":if(t.preventDefault(),t.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,0),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector('td[data-row="0"][data-col="0"]');h&&(h.focus({preventScroll:!0}),te(this,g,{rowIndex:0,colIndex:0}))}else z(this,0,0);else z(this,i,0);break;case"End":if(t.preventDefault(),t.ctrlKey){const g=s.length-1,h=n.length-1;if(this.grid.shouldUseVirtualScroll()){const f=this.grid.focusedCell;this.grid.setFocusedCell(g,h),this.scrollToRowProgrammatically(g);const p=this.shadow.querySelector(`td[data-row="${g}"][data-col="${h}"]`);p&&(p.focus({preventScroll:!0}),te(this,f,{rowIndex:g,colIndex:h}))}else z(this,g,h)}else z(this,i,n.length-1);break;case"PageUp":if(t.preventDefault(),t.ctrlKey)if(this.grid.shouldUseVirtualScroll()){const g=this.grid.focusedCell;this.grid.setFocusedCell(0,r),this.scrollToRowProgrammatically(0);const h=this.shadow.querySelector(`td[data-row="0"][data-col="${r}"]`);h&&(h.focus({preventScroll:!0}),te(this,g,{rowIndex:0,colIndex:r}))}else z(this,0,r);else{const g=Math.max(0,i-10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),te(this,h,{rowIndex:g,colIndex:r}))}else z(this,g,r)}break;case"PageDown":if(t.preventDefault(),t.ctrlKey){const g=s.length-1;if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),te(this,h,{rowIndex:g,colIndex:r}))}else z(this,g,r)}else{const g=Math.min(s.length-1,i+10);if(this.grid.shouldUseVirtualScroll()){const h=this.grid.focusedCell;this.grid.setFocusedCell(g,r),this.scrollToRowProgrammatically(g);const f=this.shadow.querySelector(`td[data-row="${g}"][data-col="${r}"]`);f&&(f.focus({preventScroll:!0}),te(this,h,{rowIndex:g,colIndex:r}))}else z(this,g,r)}break;case"g":case"G":t.ctrlKey&&(t.preventDefault(),this.showGoToRowDialog(r));break;case"Enter":{t.preventDefault();const g=n[r];((g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete")&&this.grid.getEffectiveShouldOpenDropdownOnEnter(g)?(oe(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||ne(this)})):i<s.length-1&&z(this,i+1,r);break}case"F2":{t.preventDefault();const g=n[r],h=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",f=(g==null?void 0:g.editor)==="custom";oe(this,i,r),h?requestAnimationFrame(()=>{this.dropdownOpen||ne(this)}):f&&requestAnimationFrame(()=>{this.openCustomEditor(i,r)});break}case" ":{t.preventDefault();const g=n[r],h=(g==null?void 0:g.editor)==="checkbox",f=(g==null?void 0:g.editor)==="select"||(g==null?void 0:g.editor)==="combobox"||(g==null?void 0:g.editor)==="autocomplete",p=(g==null?void 0:g.editor)==="date",v=(g==null?void 0:g.editor)==="custom";h?Mr(this,i,r):f?(oe(this,i,r),requestAnimationFrame(()=>{this.dropdownOpen||ne(this)})):p?(oe(this,i,r),requestAnimationFrame(()=>{var S;const m=(S=this.shadowRoot)==null?void 0:S.querySelector(`.wg__cell[data-row="${i}"][data-col="${r}"]`),y=m==null?void 0:m.querySelector(".wg__date-input"),_=m==null?void 0:m.querySelector(".wg__editor--date");y&&_&&this.openDatePicker(y,_)})):v&&(oe(this,i,r),requestAnimationFrame(()=>{this.openCustomEditor(i,r)}));break}case"Escape":if(t.preventDefault(),this.grid.editingCell)J(this),this.grid.cancelEdit();else if(this.grid.selectedRows.length>0)this.grid.clearSelection();else{const g=this.grid.focusedCell;this.grid.clearFocusedCell(),te(this,g,null),(u=t.target)==null||u.blur()}break;case"Delete":{t.preventDefault();const g=n[r],h=s[i];if(t.ctrlKey){if(h){const f={rowIndex:i,row:h};this.grid.onrowdelete&&this.grid.onrowdelete(f),this.dispatchEvent(new CustomEvent("rowdelete",{detail:f}))}}else g&&this.grid.isCellEditable(g)&&(this.grid.commitEdit(i,String(g.field),null),this.render(),requestAnimationFrame(()=>{const f=this.shadow.querySelector(`td[data-row="${i}"][data-col="${r}"]`);f==null||f.focus()}));break}default:if(t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey){const g=n[r];if((g==null?void 0:g.editor)==="number"&&!/[\d.\-]/.test(t.key))return;oe(this,i,r,{initialSearchQuery:t.key}),t.preventDefault()}break}}handleEditorKeyDown(t,i){const r=parseInt(i.dataset.row||"0",10),n=i.dataset.field||"",s=this.grid.columns.find(c=>c.field===n),a=(s==null?void 0:s.editor)||"text",l=a==="select"||a==="combobox"||a==="autocomplete",d=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"];if(l&&!this.dropdownOpen&&d.includes(t.key)){t.preventDefault(),t.stopPropagation();const c=this.grid.columns.findIndex(m=>m.field===n),u=this.grid.columns.map((m,y)=>({index:y,column:m})).filter(m=>m.column.isEditable!==!1),g=u.findIndex(m=>m.index===c),h=this.grid.displayItems;let f=r,p=c,v=!1;switch(t.key){case"ArrowUp":r>0&&(f=r-1,v=!0);break;case"ArrowDown":r<h.length-1&&(f=r+1,v=!0);break;case"ArrowLeft":g>0&&(p=u[g-1].index,v=!0);break;case"ArrowRight":g<u.length-1&&(p=u[g+1].index,v=!0);break;case"PageUp":f=Math.max(0,r-10),v=!0;break;case"PageDown":f=Math.min(h.length-1,r+10),v=!0;break;case"Home":t.ctrlKey&&(f=0),p=0,v=!0;break;case"End":t.ctrlKey?(f=h.length-1,p=this.grid.columns.length-1):p=this.grid.columns.length-1,v=!0;break}v&&(J(this),this.grid.cancelEdit(),queueMicrotask(()=>{z(this,f,p)}));return}switch(t.key){case"ArrowDown":if(this.dropdownOpen){t.preventDefault(),t.stopPropagation();const c=this.getCurrentEditorOptions();let u=this.highlightedIndex+1;for(;u<this.dropdownOptions.length&&Fe(this.dropdownOptions[u],c);)u++;u<this.dropdownOptions.length&&(this.highlightedIndex=u,he(this),Co(this))}break;case"ArrowUp":if(this.dropdownOpen){t.preventDefault(),t.stopPropagation();const c=this.getCurrentEditorOptions();let u=this.highlightedIndex-1;for(;u>=0&&Fe(this.dropdownOptions[u],c);)u--;u>=0&&(this.highlightedIndex=u,he(this),Co(this))}break;case"Enter":if(this.datepicker)return;t.preventDefault(),t.stopPropagation(),this.dropdownOpen&&this.highlightedIndex>=0?yo(this,this.highlightedIndex):l&&!this.dropdownOpen?ne(this):(this.isCommittingFromKeyboard=!0,Y(this),a==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):Ze(this,i),Dt(this,r,n,"down"));break;case"Tab":if(this.datepicker)return;if(t.preventDefault(),t.stopPropagation(),this.isCommittingFromKeyboard=!0,this.dropdownOpen&&this.highlightedIndex>=0&&l){const c=this.dropdownOptions[this.highlightedIndex],u=this.getCurrentEditorOptions();if(c&&!Fe(c,u)){const g=Ce(c,u);this.grid.commitEdit(r,n,g)}Y(this)}else Y(this),a==="date"&&i instanceof HTMLInputElement?this.commitDateEditor(i):l||Ze(this,i);Dt(this,r,n,t.shiftKey?"prev":"next");break;case"Escape":t.preventDefault(),t.stopPropagation(),this.dropdownOpen&&Y(this),this.datepicker&&(this.datepicker.close(!0),this.datepicker=null),this.isCommittingFromKeyboard=!0,J(this),this.grid.cancelEdit(),Ir(this,r,n);break;case"F2":t.preventDefault(),t.stopPropagation(),l&&!this.dropdownOpen&&ne(this);break;case"Backspace":a==="select"&&(t.preventDefault(),t.stopPropagation(),this.filterText.length>0&&(this.filterText=this.filterText.slice(0,-1),xo(this,s.editorOptions||{})));break;default:a==="select"&&t.key.length===1&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&(t.preventDefault(),t.stopPropagation(),this.filterText+=t.key,xo(this,s.editorOptions||{}));break}}attachEventListeners(){const t=this.shadow.querySelector(".wg__table");if(!t)return;t.addEventListener("focus",n=>{var a;const s=n.target;if(s.matches(".wg__cell")){const l=parseInt(s.dataset.row||"0",10),d=parseInt(s.dataset.col||"0",10);Dr(this,l,d),yt(this)}if(s.matches(".wg__select-trigger, .wg__combobox-input, .wg__autocomplete-input")&&!this.justSelected&&!this.dropdownOpen){const l=s.dataset.field||"",d=this.grid.columns.find(g=>g.field===l),c=(d==null?void 0:d.editorOptions)||{};(((a=this.grid.editingCell)==null?void 0:a.initialSearchQuery)!==void 0||c.showOnFocus!==!1)&&ne(this)}},!0),t.addEventListener("keydown",n=>{const s=n.target;if(s.matches(".wg__editor, .wg__combobox-input, .wg__autocomplete-input, .wg__date-input")){this.handleEditorKeyDown(n,s);return}if(s.matches(".wg__cell")){const a=parseInt(s.dataset.row||"0",10),l=parseInt(s.dataset.col||"0",10);this.handleCellKeyDown(n,a,l)}}),t.addEventListener("focusout",n=>{Er(this,n)}),t.addEventListener("dblclick",n=>{n.preventDefault();const a=n.target.closest(".wg__cell");if(a){const l=parseInt(a.dataset.row||"0",10),d=parseInt(a.dataset.col||"0",10),c=this.grid.columns[d];if(c){const u=c.editTrigger||this.grid.editTrigger;if(u==="dblclick"||u==="navigate"){const g=xt(n,a);oe(this,l,d,{cursorPosition:g??void 0});const h=c.editor;h==="select"||h==="combobox"||h==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||ne(this)}):h==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(l,d)})}}}}),t.addEventListener("click",n=>{const a=n.target.closest(".wg__cell");if(a&&!a.classList.contains("wg__cell--editing")){const l=parseInt(a.dataset.row||"0",10),d=parseInt(a.dataset.col||"0",10),c=this.grid.columns[d];if(c&&(c.editTrigger||this.grid.editTrigger)==="click"){n.preventDefault();const g=xt(n,a);oe(this,l,d,{cursorPosition:g??void 0});const h=c.editor;h==="select"||h==="combobox"||h==="autocomplete"?requestAnimationFrame(()=>{this.dropdownOpen||ne(this)}):h==="custom"&&requestAnimationFrame(()=>{this.openCustomEditor(l,d)})}}}),t.addEventListener("mousedown",n=>{const s=n.target;if(s.closest(".wg__date-trigger")){n.preventDefault(),n.stopPropagation();const l=s.closest(".wg__cell-date-display"),d=s.closest(".wg__editor--date");if(d){const c=d.querySelector(".wg__date-input");c&&this.openDatePicker(c,d)}else if(l){const c=parseInt(l.dataset.row||"0",10),u=l.dataset.field||"",g=this.grid.columns.findIndex(h=>String(h.field)===u);if(g>=0){if(this.isTransitioningCells=!0,this.grid.editingCell){const h=this.grid.editingCell,f=this.grid.columns.findIndex(p=>String(p.field)===h.field);Y(this),J(this),this.grid.cancelEdit(),f>=0&&W(this,h.rowIndex,f)}oe(this,c,g),requestAnimationFrame(()=>{var v;this.isTransitioningCells=!1;const h=(v=this.shadowRoot)==null?void 0:v.querySelector(`.wg__cell[data-row="${c}"][data-field="${u}"]`),f=h==null?void 0:h.querySelector(".wg__date-input"),p=h==null?void 0:h.querySelector(".wg__editor--date");f&&p&&this.openDatePicker(f,p)})}}return}if(this.dropdownOpen||this.grid.editingCell){const l=s.closest(".wg__cell");if(l&&!s.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete, .wg__editor--date")){const d=parseInt(l.dataset.row||"0",10),c=parseInt(l.dataset.col||"0",10),u=this.grid.editingCell,g=s.matches(".wg__combobox-toggle, .wg__select-toggle, .wg__date-trigger");if(u&&!g){const h=this.grid.columns.findIndex(f=>String(f.field)===u.field);if(d!==u.rowIndex||c!==h){n.preventDefault(),this.isTransitioningCells=!0;const f=u.rowIndex,p=h;Y(this),J(this),this.grid.cancelEdit(),p>=0&&W(this,f,p);const v=this.grid.columns[c],m=(v==null?void 0:v.editTrigger)||this.grid.editTrigger,_=n.clientX;requestAnimationFrame(()=>{if(this.isTransitioningCells=!1,m==="click"&&v&&this.grid.isCellEditable(v)){const S=this.shadow.querySelector(`td[data-row="${d}"][data-col="${c}"]`),b=S?xt({clientX:_},S):void 0;oe(this,d,c,{cursorPosition:b??void 0})}else z(this,d,c)});return}}}}if(s.matches(".wg__combobox-toggle, .wg__select-toggle")){n.preventDefault(),n.stopPropagation();const l=s.closest(".wg__cell-dropdown-display");if(s.closest(".wg__editor--select, .wg__editor--combobox, .wg__editor--autocomplete"))this.dropdownOpen&&(this.isClosingViaToggle=!0),So(this);else if(l){const c=parseInt(l.dataset.row||"0",10),u=l.dataset.field||"",g=this.grid.columns.findIndex(h=>String(h.field)===u);if(g>=0){this.isTransitioningCells=!0;const h=this.grid.editingCell,f=h?this.grid.columns.findIndex(p=>String(p.field)===h.field):-1;h&&(Y(this),J(this),this.grid.cancelEdit(),f>=0&&W(this,h.rowIndex,f)),oe(this,c,g),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||ne(this)})}}}if(s.matches(".wg__cell-dropdown-display")){n.preventDefault(),n.stopPropagation();const l=s.closest(".wg__cell-dropdown-display");if(l){const d=parseInt(l.dataset.row||"0",10),c=l.dataset.field||"",u=this.grid.columns.findIndex(g=>String(g.field)===c);if(u>=0){this.isTransitioningCells=!0;const g=this.grid.editingCell,h=g?this.grid.columns.findIndex(f=>String(f.field)===g.field):-1;g&&(Y(this),J(this),this.grid.cancelEdit(),h>=0&&W(this,g.rowIndex,h)),oe(this,d,u),requestAnimationFrame(()=>{this.isTransitioningCells=!1,this.dropdownOpen||ne(this)})}}}}),t.addEventListener("click",n=>{n.target.matches(".wg__select-trigger, .wg__select-value")&&(n.preventDefault(),n.stopPropagation(),So(this))}),t.addEventListener("mousedown",n=>{const s=n.target,a=s.closest(".wg__resize-handle");if(a){n.preventDefault(),n.stopPropagation();const d=a.dataset.field;d&&wn(this,n,d);return}if(this.grid.isColumnReorderAllowed){const d=s.closest(".wg__header");if(d&&!d.classList.contains("wg__header--frozen")&&!d.classList.contains("wg__row-number-header")){const c=d.dataset.field;c&&yn(this,n,c)}}const l=s.closest(".wg__row-number[data-row-number]");if(l){const d=parseInt(l.dataset.rowNumber||"-1",10);d>=0&&Rn(this,d,n)}}),t.addEventListener("click",n=>{const s=n,a=s.target;if(a.closest(".wg__resize-handle")||vn())return;a.closest(".wg__header--sortable")&&(un(this,s),this.render())}),t.addEventListener("contextmenu",n=>{this.handleContextMenu(n)}),t.addEventListener("change",n=>{const s=n.target;s.matches(".wg__editor--checkbox")&&$r(this,s)}),t.addEventListener("input",n=>{const s=n.target;s.matches(".wg__combobox-input")?Jr(this,n):s.matches(".wg__autocomplete-input")&&Zr(this,n)}),t.addEventListener("blur",n=>{const s=n.target;if(s.matches(".wg__editor--text, .wg__editor--number")&&Tr(this,s),s.matches(".wg__date-input")&&!this.datepicker&&!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&this.commitDateEditor(s),s.matches(".wg__select-trigger")){if(this.isClosingViaToggle){this.isClosingViaToggle=!1;return}if(!this.isCommittingFromKeyboard&&!this.isTransitioningCells&&!this.dropdownOpen&&!this.isOpeningDropdown){const a=this.grid.editingCell,l=a?this.grid.columns.findIndex(d=>String(d.field)===a.field):-1;Y(this),J(this),this.grid.cancelEdit(),a&&l>=0&&W(this,a.rowIndex,l)}}if(s.matches(".wg__combobox-input, .wg__autocomplete-input")){if(this.isClosingViaToggle){this.isClosingViaToggle=!1;return}if(this.isCommittingFromKeyboard||this.isTransitioningCells)return;if(Y(this),this.grid.editingCell){const a=s,l=this.getCurrentEditingColumn();if(l){const d=l.editorOptions||{},u=(d.options||d.initialOptions||[]).find(g=>Ve(g,d).toLowerCase()===a.value.toLowerCase());u?this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,Ce(u,d)):this.grid.commitEdit(this.grid.editingCell.rowIndex,this.grid.editingCell.field,a.value)}}}},!0);const i=this.shadow.querySelector(".wg");i&&(i.setAttribute("tabindex","-1"),i.addEventListener("keydown",n=>{const s=this.grid.selectedRows;if(s.length===0||n.target.matches('input, textarea, select, [contenteditable="true"]'))return;if(n.key==="Escape"){n.preventDefault(),this.grid.clearSelection();return}const l=this.grid.rangeShortcuts;if(l!=null&&l.length)for(const d of l){const c=qe(d.key);if(Ne(n,c)){const u={rows:this.grid.getSelectedRowsData(),rowIndices:s};if(!(typeof d.disabled=="function"?d.disabled(u):d.disabled===!0)){n.preventDefault(),d.action(u);return}}}}),i.addEventListener("scroll",()=>{const n=i.scrollLeft>0;if(i.classList.toggle("wg--scrolled-horizontal",n),this.dropdownOpen&&!this.isTransitioningCells&&!this.isOpeningDropdown){const s=this.grid.editingCell,a=s?this.grid.columns.findIndex(l=>String(l.field)===s.field):-1;Y(this),J(this),this.grid.cancelEdit(),s&&a>=0&&W(this,s.rowIndex,a)}this.grid.shouldUseVirtualScroll()&&this.handleVirtualScroll(i),this.grid.isInfiniteScrollEnabled&&this.grid.hasMoreItems&&!this.isLoadingMoreItems&&this.handleInfiniteScroll(i),Le()!==null&&(mo(this,this.grid.displayItems),this.renderConnector()),yt(this)})),this.wheelListenerAdded||(this.wheelListenerAdded=!0,window.addEventListener("scroll",()=>{if(this.dropdownOpen&&!this.isTransitioningCells){const n=this.grid.editingCell,s=n?this.grid.columns.findIndex(a=>String(a.field)===n.field):-1;Y(this),J(this),this.grid.cancelEdit(),n&&s>=0&&W(this,n.rowIndex,s)}},{passive:!0,capture:!0})),t.addEventListener("mouseenter",n=>{const s=n.target,a=s.closest("[data-tooltip-html]");if(a){const d=a.getAttribute("data-tooltip-html");At(this,a,d,this._tooltipShowDelay,!0);return}const l=s.closest("[data-tooltip]");if(l){const d=l.getAttribute("data-tooltip");At(this,l,d,this._tooltipShowDelay,!1)}},!0),t.addEventListener("mouseleave",n=>{const s=n,a=s.target,l=s.relatedTarget,d=a.closest("[data-tooltip], [data-tooltip-html]");d&&(l==null?void 0:l.closest("[data-tooltip], [data-tooltip-html]"))===d||d&&ko(this,this._tooltipHideDelay)},!0),t.addEventListener("click",n=>{const a=n.target.closest(".wg__toolbar-trigger");if(a&&this.grid.toolbarTrigger==="button"){n.preventDefault(),n.stopPropagation();const l=parseInt(a.dataset.toolbarTrigger||"0",10),d=t.querySelector(`tr[data-row-index="${l}"]`);d&&($t(l)?this.closeToolbarAndReset():this.showToolbarForRow(d,l))}}),t.addEventListener("click",n=>{if(this.grid.toolbarPosition!=="inline")return;const a=n.target.closest(".wg__inline-action-btn");if(a&&!a.disabled){n.preventDefault(),n.stopPropagation();const l=a.dataset.actionId,d=parseInt(a.dataset.row||"0",10);this.handleInlineActionClick(l,d)}}),t.addEventListener("mouseenter",n=>{const s=n,l=s.target.closest(".wg__row");if(l){const d=parseInt(l.dataset.rowIndex||"0",10);this.grid.setHoveredRow(d),this.grid.toolbarPosition==="inline"&&this.setupInlineShortcuts(),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline"&&(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),$t(d)||this.showToolbarForRow(l,d,s.clientX))}},!0),t.addEventListener("mouseleave",n=>{if(n.target.closest(".wg__row")&&(this.grid.toolbarPosition==="inline"&&setTimeout(()=>{t.matches(":hover")||(this.grid.setHoveredRow(null),this.removeInlineShortcuts())},50),this.grid.toolbarTrigger==="hover"&&this.grid.toolbarPosition!=="inline")){if(this.toolbarMoveInProgress)return;this.toolbarHideTimeout&&clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__toolbar-container"),c=d==null?void 0:d.matches(":hover"),u=t.matches(":hover");!c&&!u&&(this.grid.setHoveredRow(null),this.closeToolbarAndReset())},150)}},!0),t.addEventListener("click",n=>{if(this.grid.toolbarTrigger!=="click")return;const s=n,a=s.target,l=a.closest(".wg__row");if(l&&!a.closest(".wg__cell--editing")){const d=parseInt(l.dataset.rowIndex||"0",10);$t(d)?this.closeToolbarAndReset():this.showToolbarForRow(l,d,s.clientX)}}),this.toolbarOutsideClickAdded||(this.toolbarOutsideClickAdded=!0,document.addEventListener("click",n=>{if(!po(this.shadow))return;const s=n.composedPath(),a=s.some(c=>{var u;return(u=c.classList)==null?void 0:u.contains("wg__toolbar-container")}),l=s.some(c=>{var u;return(u=c.classList)==null?void 0:u.contains("wg__toolbar-trigger")});a||l||s.includes(this)&&(this.grid.toolbarTrigger==="hover"||this.grid.toolbarTrigger==="click")||Le()!==null&&this.closeToolbarAndReset()})),this.toolbarScrollListenerAdded||(this.toolbarScrollListenerAdded=!0,window.addEventListener("scroll",()=>{Le()!==null&&this.closeToolbarAndReset()},!0)),this.shadow.querySelectorAll(".wg__pagination").forEach(n=>{n.addEventListener("click",a=>{hn(this,a)&&this.render()});const s=n.querySelector(".wg__pagination-select");s&&s.addEventListener("change",()=>{fn(this,s)&&this.render()})})}scrollToRowProgrammatically(t){const i=this.shadow.querySelector(".wg");if(!i)return;const{scrollTop:r,startIndex:n,endIndex:s}=cn({targetRow:t,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,viewportHeight:i.clientHeight,scrollHeight:i.scrollHeight,clientHeight:i.clientHeight});(n!==this.virtualScrollStart||s!==this.virtualScrollEnd)&&(this.virtualScrollStart=n,this.virtualScrollEnd=s,this.renderVirtualRows(i)),this.isProgrammaticScroll=!0,i.scrollTop=r,queueMicrotask(()=>{this.isProgrammaticScroll=!1})}handleVirtualScroll(t){var n;if(this.isProgrammaticScroll)return;const{startIndex:i,endIndex:r}=dn({scrollTop:t.scrollTop,viewportHeight:t.clientHeight,rowHeight:this.grid.virtualScrollRowHeight,buffer:this.grid.virtualScrollBuffer,totalItems:this.grid.displayItems.length,editingRowIndex:(n=this.grid.editingCell)==null?void 0:n.rowIndex});(i!==this.virtualScrollStart||r!==this.virtualScrollEnd)&&(this.virtualScrollStart=i,this.virtualScrollEnd=r,this.renderVirtualRows(t))}renderVirtualRows(t){const i=t.querySelector("tbody");if(!i)return;const r=this.grid.displayItems,n={startIndex:this.virtualScrollStart,endIndex:this.virtualScrollEnd,rowHeight:this.grid.virtualScrollRowHeight,totalItems:r.length},s=this.grid.focusedCell;if(i.innerHTML=vo(this,n),s){this.grid.setFocusedCell(s.rowIndex,s.colIndex);const a=i.querySelector(`td[data-row="${s.rowIndex}"][data-col="${s.colIndex}"]`);a&&(a.focus({preventScroll:!0}),te(this,null,s))}}handleInfiniteScroll(t){gn(t.scrollTop,t.scrollHeight,t.clientHeight,this.grid.infiniteScrollThreshold)&&(this.isLoadingMoreItems=!0,this.grid.fireDataRequest("loadMore"))}renderShortcutsHelpIcon(){var s,a,l;if(!this.grid.isShortcutsHelpVisible||!((s=this.grid.rowShortcuts)!=null&&s.length))return"";const i=this.grid.shortcutsHelpPosition==="top-left"?"wg__shortcuts-help--left":"",r=this.grid.rowShortcuts.map(d=>`<div class="wg__shortcuts-help-item">
|
|
642
|
+
<span class="wg__shortcuts-help-key">${an(d.key)}</span>
|
|
639
643
|
<span class="wg__shortcuts-help-label">${d.label}</span>
|
|
640
644
|
</div>`).join(""),n=((l=(a=this.grid).shortcutsHelpContentCallback)==null?void 0:l.call(a))||"";return`
|
|
641
645
|
<div class="wg__shortcuts-help ${i}">
|
|
@@ -654,28 +658,28 @@
|
|
|
654
658
|
</div>
|
|
655
659
|
</div>
|
|
656
660
|
</div>
|
|
657
|
-
`}render(){var v;const t=this.shadow.querySelector(".wg"),i=(t==null?void 0:t.scrollTop)||0,r=(t==null?void 0:t.scrollLeft)||0,n=this.grid.focusedCell;t&&t.remove();const s=document.createElement("div");s.className=
|
|
658
|
-
${
|
|
659
|
-
${
|
|
660
|
-
</div>`:[...new Set([..._,...S])].map(k=>{const T=_.includes(k)
|
|
661
|
-
${
|
|
662
|
-
${
|
|
663
|
-
</div
|
|
661
|
+
`}render(){var v;const t=this.shadow.querySelector(".wg"),i=(t==null?void 0:t.scrollTop)||0,r=(t==null?void 0:t.scrollLeft)||0,n=this.grid.focusedCell;t&&t.remove();const s=document.createElement("div");s.className=Xr(this);const a=this.grid.paginationPosition.split("|").map(m=>m.trim()),l=this.grid.summaryPosition?this.grid.summaryPosition.split("|").map(m=>m.trim()):[],d=(m,y)=>{const _=a.filter(k=>y?k.startsWith("top-"):k.startsWith("bottom-")),S=l.filter(k=>y?k.startsWith("top-"):k.startsWith("bottom-")),b=_.length>0,C=S.length>0;return!b&&!C?"":C&&b&&this.grid.isSummaryInline?`<div class="wg__footer${y?" wg__footer--top":""}">
|
|
662
|
+
${zt(this,S[0])}
|
|
663
|
+
${It(this,_[0])}
|
|
664
|
+
</div>`:[...new Set([..._,...S])].map(k=>{const T=_.includes(k),$=S.includes(k);return $&&T?`<div class="wg__footer${y?" wg__footer--top":""}">
|
|
665
|
+
${zt(this,k)}
|
|
666
|
+
${It(this,k)}
|
|
667
|
+
</div>`:$?zt(this,k):It(this,k)}).join("")},c=d(a,!0),u=d(a,!1),g=this.grid.shouldUseVirtualScroll();let h;if(g){const m=this.grid.displayItems,y=this.grid.virtualScrollRowHeight,_=this.grid.virtualScrollBuffer,S=(t==null?void 0:t.clientHeight)||400,b=Math.max(0,Math.floor(i/y)-_),C=Math.ceil(S/y)+_*2,x=Math.min(m.length,b+C);this.virtualScrollStart=b,this.virtualScrollEnd=x;const k={startIndex:b,endIndex:x,rowHeight:y,totalItems:m.length};h=vo(this,k)}else h=Qr(this);g&&s.classList.add("wg--virtual-scroll");const p=`
|
|
664
668
|
${this.renderShortcutsHelpIcon()}
|
|
665
|
-
${
|
|
669
|
+
${c}
|
|
666
670
|
<table class="wg__table">
|
|
667
671
|
<thead>
|
|
668
|
-
${
|
|
672
|
+
${Gr(this)}
|
|
669
673
|
</thead>
|
|
670
674
|
<tbody>
|
|
671
675
|
${h}
|
|
672
676
|
</tbody>
|
|
673
677
|
</table>
|
|
674
678
|
${u}
|
|
675
|
-
`;if(s.innerHTML=p,this.shadow.appendChild(s),
|
|
679
|
+
`;if(s.innerHTML=p,this.shadow.appendChild(s),g){const m=Math.max(0,this.grid.displayItems.length*this.grid.virtualScrollRowHeight-s.clientHeight);s.scrollTop=Math.min(i,m)}else s.scrollTop=i;if(s.scrollLeft=r,this.attachEventListeners(),this.grid.editingCell){const{rowIndex:m,field:y}=this.grid.editingCell;let _=this.shadow.querySelector(`.wg__combobox-input[data-row="${m}"][data-field="${y}"],
|
|
676
680
|
.wg__autocomplete-input[data-row="${m}"][data-field="${y}"],
|
|
677
681
|
.wg__select-trigger[data-row="${m}"][data-field="${y}"],
|
|
678
|
-
.wg__date-input[data-row="${m}"][data-field="${y}"]`);if(_||(_=this.shadow.querySelector(`.wg__editor[data-row="${m}"][data-field="${y}"]`)),_&&(_.focus(),_ instanceof HTMLInputElement&&_.type==="text")){const S=this.grid.editingCell.cursorPosition,b=this.getCurrentEditingColumn(),C=((v=b==null?void 0:b.editorOptions)==null?void 0:v.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const x=_.value.length;_.setSelectionRange(x,x)}else switch(C){case"mousePosition":if(S!==void 0){const x=Math.min(S,_.value.length);_.setSelectionRange(x,x)}else _.setSelectionRange(_.value.length,_.value.length);break;case"cursorAtStart":_.setSelectionRange(0,0);break;case"cursorAtEnd":_.setSelectionRange(_.value.length,_.value.length);break;case"selectAll":default:_.select();break}}}else if(n&&!this.grid.editingCell){const m=s.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);m&&setTimeout(()=>m.focus(),0)}
|
|
682
|
+
.wg__date-input[data-row="${m}"][data-field="${y}"]`);if(_||(_=this.shadow.querySelector(`.wg__editor[data-row="${m}"][data-field="${y}"]`)),_&&(_.focus(),_ instanceof HTMLInputElement&&_.type==="text")){const S=this.grid.editingCell.cursorPosition,b=this.getCurrentEditingColumn(),C=((v=b==null?void 0:b.editorOptions)==null?void 0:v.editStartSelection)||this.grid.editStartSelection;if(this.grid.editingCell.initialSearchQuery!==void 0){const x=_.value.length;_.setSelectionRange(x,x)}else switch(C){case"mousePosition":if(S!==void 0){const x=Math.min(S,_.value.length);_.setSelectionRange(x,x)}else _.setSelectionRange(_.value.length,_.value.length);break;case"cursorAtStart":_.setSelectionRange(0,0);break;case"cursorAtEnd":_.setSelectionRange(_.value.length,_.value.length);break;case"selectAll":default:_.select();break}}}else if(n&&!this.grid.editingCell){const m=s.querySelector(`td[data-row="${n.rowIndex}"][data-col="${n.colIndex}"]`);m&&setTimeout(()=>m.focus(),0)}g&&requestAnimationFrame(()=>{s.style.pointerEvents="none",requestAnimationFrame(()=>{s.style.pointerEvents=""})}),this.renderConnector(),yt(this)}renderConnector(){const t=this.shadow.querySelector(".wg__connector");t&&t.remove();const i=Kr();if(!i.path||!i.arrowPos)return;const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","wg__connector"),r.setAttribute("style","position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 999;");const n=document.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d",i.path),n.setAttribute("stroke","var(--wg-accent-color, #0078d4)"),n.setAttribute("stroke-width","2"),n.setAttribute("fill","none"),r.appendChild(n);const s=document.createElementNS("http://www.w3.org/2000/svg","polygon"),a=i.arrowDir==="down"?"-4,0 4,0 0,8":i.arrowDir==="up"?"-4,0 4,0 0,-8":i.arrowDir==="left"?"0,-4 -8,0 0,4":"0,-4 8,0 0,4";s.setAttribute("points",a),s.setAttribute("fill","var(--wg-accent-color, #0078d4)"),s.setAttribute("transform",`translate(${i.arrowPos.x}, ${i.arrowPos.y})`),r.appendChild(s),this.shadow.appendChild(r)}openDatePicker(t,i){this.datepicker&&(this.datepicker.close(!0),this.datepicker=null);const r=t.dataset.dateFormat||"YYYY-MM-DD",n=t.dataset.minDate,s=t.dataset.maxDate,a=t.dataset.dateValue||"";this.datepicker=new bt({dateFormat:r,minDate:n||void 0,maxDate:s||void 0,onSelect:(l,d)=>{this.handleDatePickerSelect(t,l,d)},onClose:()=>{const l=this.grid.editingCell,d=l?this.grid.columns.findIndex(u=>String(u.field)===l.field):-1,c=(l==null?void 0:l.rowIndex)??-1;this.datepicker=null,J(this),this.grid.cancelEdit(),c>=0&&d>=0&&kr(this,c,d)}}),this.datepicker.open(i,a||null)}handleDatePickerSelect(t,i,r){const n=t.dataset.dateFormat||"YYYY-MM-DD",s=Je(n);t.value=ht(i,s),t.dataset.dateValue=ft(i),this.datepicker=null,this.isCommittingFromKeyboard=!0,this.commitDateEditor(t);const a=parseInt(t.dataset.row||"0",10),l=t.dataset.field||"";this.moveFocusAfterCommit(a,l,r||"down")}commitDateEditor(t){if(!this.grid.editingCell)return;const i=parseInt(t.dataset.row||"0",10),r=t.dataset.field||"",n=t.dataset.outputFormat||"iso",s=t.dataset.dateFormat||"YYYY-MM-DD",a=Je(s),l=t.value?this.parseDateInput(t.value,a):null;let d=null;if(l)switch(n){case"date":d=l;break;case"timestamp":d=l.getTime();break;case"iso":default:d=ft(l);break}this.grid.commitEdit(i,r,d)}parseDateInput(t,i){if(!t)return null;const r=t.split(i.separator);let n=null,s=null,a=null;if(r.forEach((d,c)=>{var g,h,f;if(!d)return;const u=parseInt(d,10);((g=i.parts.year)==null?void 0:g.index)===c?n=u<100?u+2e3:u:((h=i.parts.month)==null?void 0:h.index)===c?s=u:((f=i.parts.day)==null?void 0:f.index)===c&&(a=u)}),n===null||s===null||a===null)return null;const l=new Date(n,s-1,a);return l.getMonth()!==s-1||l.getDate()!==a?null:l}showGoToRowDialog(t){const i=this.grid.displayItems;if(i.length===0)return;const r=document.createElement("div");r.className="wg__goto-overlay",r.innerHTML=`
|
|
679
683
|
<div class="wg__goto-dialog">
|
|
680
684
|
<label class="wg__goto-label">Go to row (1-${i.length}):</label>
|
|
681
685
|
<input type="number" class="wg__goto-input" min="1" max="${i.length}" value="1" />
|
|
@@ -684,4 +688,4 @@
|
|
|
684
688
|
<button type="button" class="wg__goto-btn wg__goto-btn--go">Go</button>
|
|
685
689
|
</div>
|
|
686
690
|
</div>
|
|
687
|
-
`;const n=r.querySelector(".wg__goto-input"),s=r.querySelector(".wg__goto-btn--go"),a=r.querySelector(".wg__goto-btn--cancel"),l=()=>{r.remove()},d=()=>{const g=parseInt(n.value,10);if(isNaN(g)||g<1||g>i.length){n.focus(),n.select();return}l();const u=g-1,c=this.grid.focusedCell;if(this.grid.setFocusedCell(u,t),this.grid.shouldUseVirtualScroll())this.scrollToRowProgrammatically(u),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${t}"]`);h==null||h.focus()})});else{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${t}"]`);h&&(h.scrollIntoView({block:"nearest",behavior:"auto"}),h.focus(),te(this,c,{rowIndex:u,colIndex:t}))}};s.addEventListener("click",d),a.addEventListener("click",l),r.addEventListener("click",g=>{g.target===r&&l()}),n.addEventListener("keydown",g=>{g.key==="Enter"?(g.preventDefault(),d()):g.key==="Escape"&&(g.preventDefault(),l())}),this.shadow.appendChild(r),n.focus(),n.select()}openCustomEditor(t,i){const r=this.grid.columns[i];if(!r||r.editor!=="custom"||!r.cellEditCallback)return;const n=String(r.field),s=this.grid.displayItems[t];if(!s)return;const l={value:this.grid.getCellRawValue(s,t,n),row:s,rowIndex:t,field:n,commit:d=>{this.grid.commitEdit(t,n,d),G(this),requestAnimationFrame(()=>{z(this,t,i)})},cancel:()=>{G(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{z(this,t,i)})}};r.cellEditCallback(l)}handleContextMenu(t){const i=t.target,r=i.closest(".wg__header");if(r){this.handleHeaderContextMenu(t,r);return}if(i.closest("th.wg__filler")){this.handleFillerContextMenu(t);return}const s=this.grid.contextMenu;if(!s||s.length===0)return;const a=i.closest(".wg__cell");if(!a)return;t.preventDefault(),this.contextMenuElement&&(J(this.contextMenuElement),this.contextMenuElement=null);const l=parseInt(a.dataset.row||"0",10),d=parseInt(a.dataset.col||"0",10),g=this.grid.columns[d];if(!g)return;const u=this.grid.displayItems[l];if(!u)return;const c=String(g.field),h=this.grid.getCellRawValue(u,l,c),f={row:u,rowIndex:l,colIndex:d,column:g,cellValue:h};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(f);const p=Object.getOwnPropertyDescriptor(this,"contextMenuXOffset"),v=Object.getOwnPropertyDescriptor(this,"contextMenuYOffset");p&&"value"in p&&(this.grid.contextMenuXOffset=p.value,delete this.contextMenuXOffset),v&&"value"in v&&(this.grid.contextMenuYOffset=v.value,delete this.contextMenuYOffset),this.contextMenuElement=Xr(this,t.clientX,t.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,s,f,m=>{const y=s.find(_=>_.id===m);y!=null&&y.onclick&&y.onclick(f),this.contextMenuElement&&(J(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}handleHeaderContextMenu(t,i){const r=this.grid.headerContextMenu;if(!r||r.length===0)return;t.preventDefault(),this.contextMenuElement&&(J(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(J(this.headerContextMenuElement),this.headerContextMenuElement=null);const n=i.dataset.field;if(!n)return;const s=this.grid.columns.findIndex(f=>String(f.field)===n);if(s===-1)return;const a=this.grid.columns[s],l=this.grid.freezeColumns,d=s<l,g=this.grid.sort.find(f=>f.column===n),u=(g==null?void 0:g.direction)??null,c={column:a,field:n,columnIndex:s,sortDirection:u,isFrozen:d,allColumns:this.grid.columns,labels:this.grid.labels};this.grid.onheadercontextmenuopen&&this.grid.onheadercontextmenuopen(c);const h=Co(r,c);h.length!==0&&(this.headerContextMenuElement=ko(this,t.clientX,t.clientY,h,c,(f,p,v)=>{if(["sortAsc","sortDesc","clearSort","hideColumn","freezeColumn","unfreezeColumn"].includes(f)&&Qr(this,f,c,v),f==="show-all-columns"){this.grid.columns.forEach(_=>{_.hidden=!1}),this.grid.columns=[...this.grid.columns];return}if(f.startsWith("toggle-col-")){const _=f.replace("toggle-col-",""),S=this.grid.columns.find(b=>String(b.field)===_);S&&(S.hidden=!S.hidden,this.grid.columns=[...this.grid.columns]);return}const y=h.find(_=>_.id===f);y!=null&&y.onclick&&y.onclick(c),!p&&this.headerContextMenuElement&&(J(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}handleFillerContextMenu(t){const i=this.grid.headerContextMenu;if(!i||i.length===0)return;t.preventDefault(),this.contextMenuElement&&(J(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(J(this.headerContextMenuElement),this.headerContextMenuElement=null);const r=i.filter(a=>a==="columnVisibility"?!0:typeof a=="object"&&a.id?!(typeof a.label=="function"||typeof a.icon=="function"):(typeof a=="string"||typeof a=="object"&&a.dividerBefore&&!a.id&&!a.label,!1));if(r.length===0)return;const n={column:null,field:"",columnIndex:-1,sortDirection:null,isFrozen:!1,allColumns:this.grid.columns,labels:this.grid.labels},s=Co(r,n);s.length!==0&&(this.headerContextMenuElement=ko(this,t.clientX,t.clientY,s,n,(a,l,d)=>{if(a==="show-all-columns"){this.grid.columns.forEach(u=>{u.hidden=!1}),this.grid.columns=[...this.grid.columns];return}if(a.startsWith("toggle-col-")){const u=a.replace("toggle-col-",""),c=this.grid.columns.find(h=>String(h.field)===u);c&&(c.hidden=!c.hidden,this.grid.columns=[...this.grid.columns]);return}const g=s.find(u=>u.id===a);g!=null&&g.onclick&&g.onclick(n),!l&&this.headerContextMenuElement&&(J(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}setupToolbarShortcuts(){this.toolbarShortcutHandler&&document.removeEventListener("keydown",this.toolbarShortcutHandler);const t=this.grid.rowShortcuts;t!=null&&t.length&&(this.toolbarShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const n=Ae();if(n===null||!ro(this.shadow))return;const s=this.grid.displayItems[n];if(!s)return;const a=this.grid.columns;for(const l of t){const d=Ne(l.key);if(Ye(i,d)){const g={row:s,rowIndex:n,colIndex:0,column:a[0],cellValue:null};if(!(typeof l.disabled=="function"?l.disabled(g):l.disabled===!0)){i.preventDefault(),i.stopPropagation(),l.action(g);return}}}},document.addEventListener("keydown",this.toolbarShortcutHandler))}setupInlineShortcuts(){this.removeInlineShortcuts();const t=this.grid.rowShortcuts;!(t!=null&&t.length)||this.grid.hoveredRowIndex===null||(this.inlineShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const n=this.grid.hoveredRowIndex;if(n===null)return;const s=this.grid.displayItems[n];if(!s)return;const a=this.grid.columns;for(const l of t){const d=Ne(l.key);if(Ye(i,d)){const g={row:s,rowIndex:n,colIndex:0,column:a[0],cellValue:null};if(!(typeof l.disabled=="function"?l.disabled(g):l.disabled===!0)){i.preventDefault(),i.stopPropagation(),l.action(g);return}}}},document.addEventListener("keydown",this.inlineShortcutHandler))}removeInlineShortcuts(){this.inlineShortcutHandler&&(document.removeEventListener("keydown",this.inlineShortcutHandler),this.inlineShortcutHandler=null)}setupToolbarTooltips(t,i,r){const n=this.shadow.querySelector(".wg__toolbar-container");if(!n)return;n.querySelectorAll(".wg__toolbar-btn").forEach(a=>{var c;const l=a,d=l.dataset.toolbarItem,g=t.find(h=>h.id===d);if(!g)return;const u=(c=this.grid.rowShortcuts)==null?void 0:c.find(h=>h.id===g.id);l.addEventListener("mouseenter",()=>{const h=g.tooltipCallback?g.tooltipCallback(i,r):lr(g,u==null?void 0:u.key);Et(this,l,h,0,!0)}),l.addEventListener("mouseleave",()=>{fo(this)})})}showToolbarForRow(t,i,r){if(this.grid.toolbarPosition==="inline"||!this.grid.showRowToolbar||!this.grid.rowToolbar.length)return;const n=vt(this.grid.rowToolbar),s=this.grid.displayItems[i];if(!s)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),dr(this,t,i,n,s,l=>{this.handleToolbarItemClick(l,i,s)},r),this.setupToolbarShortcuts(),this.renderConnector(),this.setupToolbarTooltips(n,s,i),this.grid.toolbarTrigger==="hover"){const l=this.shadow.querySelector(".wg__toolbar-container");l&&(l.addEventListener("mouseenter",()=>{this.toolbarHovered=!0,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null)}),l.addEventListener("mouseleave",()=>{this.toolbarHovered=!1,!this.toolbarMoveInProgress&&(this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__table"),g=d==null?void 0:d.matches(":hover"),u=l.matches(":hover");!g&&!u&&this.closeToolbarAndReset()},150))}))}const a=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);a&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(l=>{l.classList.remove("wg__toolbar-trigger--active")}),a.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.toolbarShortcutHandler&&(document.removeEventListener("keydown",this.toolbarShortcutHandler),this.toolbarShortcutHandler=null),ot()}handleToolbarItemClick(t,i,r){const n=this.grid.displayItems.findIndex(a=>a===r);if(n===-1){this.closeToolbarAndReset();return}const s=t.id==="moveUp"||t.id==="moveDown";if(s&&(this.toolbarMoveInProgress=!0),t.onclick&&t.onclick({row:r,rowIndex:n}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:t,rowIndex:n,row:r}),t.id==="delete"){this.closeToolbarAndReset();return}s?(this.render(),no(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(t,i){if(!t)return;const n=vt(this.grid.rowToolbar).find(a=>a.id===t),s=this.grid.displayItems[i];!n||!s||(n.onclick&&n.onclick({row:s,rowIndex:i}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:n,rowIndex:i,row:s}),this.render())}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",Ot),B.GridElement=Ot,B.WebGrid=Ce,B.default=Ot,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
691
|
+
`;const n=r.querySelector(".wg__goto-input"),s=r.querySelector(".wg__goto-btn--go"),a=r.querySelector(".wg__goto-btn--cancel"),l=()=>{r.remove()},d=()=>{const c=parseInt(n.value,10);if(isNaN(c)||c<1||c>i.length){n.focus(),n.select();return}l();const u=c-1,g=this.grid.focusedCell;if(this.grid.setFocusedCell(u,t),this.grid.shouldUseVirtualScroll())this.scrollToRowProgrammatically(u),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${t}"]`);h==null||h.focus()})});else{const h=this.shadow.querySelector(`td[data-row="${u}"][data-col="${t}"]`);h&&(h.scrollIntoView({block:"nearest",behavior:"auto"}),h.focus(),te(this,g,{rowIndex:u,colIndex:t}))}};s.addEventListener("click",d),a.addEventListener("click",l),r.addEventListener("click",c=>{c.target===r&&l()}),n.addEventListener("keydown",c=>{c.key==="Enter"?(c.preventDefault(),d()):c.key==="Escape"&&(c.preventDefault(),l())}),this.shadow.appendChild(r),n.focus(),n.select()}openCustomEditor(t,i){const r=this.grid.columns[i];if(!r||r.editor!=="custom"||!r.cellEditCallback)return;const n=String(r.field),s=this.grid.displayItems[t];if(!s)return;const l={value:this.grid.getCellRawValue(s,t,n),row:s,rowIndex:t,field:n,commit:d=>{this.grid.commitEdit(t,n,d),J(this),requestAnimationFrame(()=>{z(this,t,i)})},cancel:()=>{J(this),this.grid.cancelEdit(),requestAnimationFrame(()=>{z(this,t,i)})}};r.cellEditCallback(l)}handleContextMenu(t){const i=t.target,r=i.closest(".wg__header");if(r){this.handleHeaderContextMenu(t,r);return}if(i.closest("th.wg__filler")){this.handleFillerContextMenu(t);return}const s=this.grid.contextMenu;if(!s||s.length===0)return;const a=i.closest(".wg__cell");if(!a)return;t.preventDefault(),this.contextMenuElement&&(Z(this.contextMenuElement),this.contextMenuElement=null);const l=parseInt(a.dataset.row||"0",10),d=parseInt(a.dataset.col||"0",10),c=this.grid.columns[d];if(!c)return;const u=this.grid.displayItems[l];if(!u)return;const g=String(c.field),h=this.grid.getCellRawValue(u,l,g),f={row:u,rowIndex:l,colIndex:d,column:c,cellValue:h};this.grid.oncontextmenuopen&&this.grid.oncontextmenuopen(f);const p=Object.getOwnPropertyDescriptor(this,"contextMenuXOffset"),v=Object.getOwnPropertyDescriptor(this,"contextMenuYOffset");p&&"value"in p&&(this.grid.contextMenuXOffset=p.value,delete this.contextMenuXOffset),v&&"value"in v&&(this.grid.contextMenuYOffset=v.value,delete this.contextMenuYOffset),this.contextMenuElement=nn(this,t.clientX,t.clientY,this.grid.contextMenuXOffset,this.grid.contextMenuYOffset,s,f,m=>{const y=s.find(_=>_.id===m);y!=null&&y.onclick&&y.onclick(f),this.contextMenuElement&&(Z(this.contextMenuElement),this.contextMenuElement=null)},()=>{this.contextMenuElement=null})}handleHeaderContextMenu(t,i){const r=this.grid.headerContextMenu;if(!r||r.length===0)return;t.preventDefault(),this.contextMenuElement&&(Z(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(Z(this.headerContextMenuElement),this.headerContextMenuElement=null);const n=i.dataset.field;if(!n)return;const s=this.grid.columns.findIndex(f=>String(f.field)===n);if(s===-1)return;const a=this.grid.columns[s],l=this.grid.freezeColumns,d=s<l,c=this.grid.sort.find(f=>f.column===n),u=(c==null?void 0:c.direction)??null,g={column:a,field:n,columnIndex:s,sortDirection:u,isFrozen:d,allColumns:this.grid.columns,labels:this.grid.labels};this.grid.onheadercontextmenuopen&&this.grid.onheadercontextmenuopen(g);const h=Ro(r,g);h.length!==0&&(this.headerContextMenuElement=To(this,t.clientX,t.clientY,h,g,(f,p,v)=>{if(["sortAsc","sortDesc","clearSort","hideColumn","freezeColumn","unfreezeColumn"].includes(f)&&ln(this,f,g,v),f==="show-all-columns"){this.grid.columns.forEach(_=>{_.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(f.startsWith("toggle-col-")){const _=f.replace("toggle-col-",""),S=this.grid.columns.find(b=>String(b.field)===_);S&&(S.isHidden=!S.isHidden,this.grid.columns=[...this.grid.columns]);return}const y=h.find(_=>_.id===f);y!=null&&y.onclick&&y.onclick(g),!p&&this.headerContextMenuElement&&(Z(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}handleFillerContextMenu(t){const i=this.grid.headerContextMenu;if(!i||i.length===0)return;t.preventDefault(),this.contextMenuElement&&(Z(this.contextMenuElement),this.contextMenuElement=null),this.headerContextMenuElement&&(Z(this.headerContextMenuElement),this.headerContextMenuElement=null);const r=i.filter(a=>a==="columnVisibility"?!0:typeof a=="object"&&a.id?!(typeof a.label=="function"||typeof a.icon=="function"):(typeof a=="string"||typeof a=="object"&&a.dividerBefore&&!a.id&&!a.label,!1));if(r.length===0)return;const n={column:null,field:"",columnIndex:-1,sortDirection:null,isFrozen:!1,allColumns:this.grid.columns,labels:this.grid.labels},s=Ro(r,n);s.length!==0&&(this.headerContextMenuElement=To(this,t.clientX,t.clientY,s,n,(a,l,d)=>{if(a==="show-all-columns"){this.grid.columns.forEach(u=>{u.isHidden=!1}),this.grid.columns=[...this.grid.columns];return}if(a.startsWith("toggle-col-")){const u=a.replace("toggle-col-",""),g=this.grid.columns.find(h=>String(h.field)===u);g&&(g.isHidden=!g.isHidden,this.grid.columns=[...this.grid.columns]);return}const c=s.find(u=>u.id===a);c!=null&&c.onclick&&c.onclick(n),!l&&this.headerContextMenuElement&&(Z(this.headerContextMenuElement),this.headerContextMenuElement=null)},()=>{this.headerContextMenuElement=null}))}setupToolbarShortcuts(){this.toolbarShortcutHandler&&document.removeEventListener("keydown",this.toolbarShortcutHandler);const t=this.grid.rowShortcuts;t!=null&&t.length&&(this.toolbarShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const n=Le();if(n===null||!po(this.shadow))return;const s=this.grid.displayItems[n];if(!s)return;const a=this.grid.columns;for(const l of t){const d=qe(l.key);if(Ne(i,d)){const c={row:s,rowIndex:n,colIndex:0,column:a[0],cellValue:null};if(!(typeof l.disabled=="function"?l.disabled(c):l.disabled===!0)){i.preventDefault(),i.stopPropagation(),l.action(c);return}}}},document.addEventListener("keydown",this.toolbarShortcutHandler))}setupInlineShortcuts(){this.removeInlineShortcuts();const t=this.grid.rowShortcuts;!(t!=null&&t.length)||this.grid.hoveredRowIndex===null||(this.inlineShortcutHandler=i=>{if(i.target.matches('input, textarea, select, [contenteditable="true"]'))return;const n=this.grid.hoveredRowIndex;if(n===null)return;const s=this.grid.displayItems[n];if(!s)return;const a=this.grid.columns;for(const l of t){const d=qe(l.key);if(Ne(i,d)){const c={row:s,rowIndex:n,colIndex:0,column:a[0],cellValue:null};if(!(typeof l.disabled=="function"?l.disabled(c):l.disabled===!0)){i.preventDefault(),i.stopPropagation(),l.action(c);return}}}},document.addEventListener("keydown",this.inlineShortcutHandler))}removeInlineShortcuts(){this.inlineShortcutHandler&&(document.removeEventListener("keydown",this.inlineShortcutHandler),this.inlineShortcutHandler=null)}setupToolbarTooltips(t,i,r){const n=this.shadow.querySelector(".wg__toolbar-container");if(!n)return;n.querySelectorAll(".wg__toolbar-btn").forEach(a=>{var g;const l=a,d=l.dataset.toolbarItem,c=t.find(h=>h.id===d);if(!c)return;const u=(g=this.grid.rowShortcuts)==null?void 0:g.find(h=>h.id===c.id);l.addEventListener("mouseenter",()=>{const h=c.tooltipCallback?c.tooltipCallback(i,r):Br(c,u==null?void 0:u.key);At(this,l,h,0,!0)}),l.addEventListener("mouseleave",()=>{ko(this)})})}showToolbarForRow(t,i,r){if(this.grid.toolbarPosition==="inline"||!this.grid.isRowToolbarVisible||!this.grid.rowToolbar.length)return;const n=Rt(this.grid.rowToolbar),s=this.grid.displayItems[i];if(!s)return;if(this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),jr(this,t,i,n,s,l=>{this.handleToolbarItemClick(l,i,s)},r),this.setupToolbarShortcuts(),this.renderConnector(),this.setupToolbarTooltips(n,s,i),this.grid.toolbarTrigger==="hover"){const l=this.shadow.querySelector(".wg__toolbar-container");l&&(l.addEventListener("mouseenter",()=>{this.toolbarHovered=!0,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null)}),l.addEventListener("mouseleave",()=>{this.toolbarHovered=!1,!this.toolbarMoveInProgress&&(this.toolbarHideTimeout=setTimeout(()=>{const d=this.shadow.querySelector(".wg__table"),c=d==null?void 0:d.matches(":hover"),u=l.matches(":hover");!c&&!u&&this.closeToolbarAndReset()},150))}))}const a=this.shadow.querySelector(`[data-toolbar-trigger="${i}"]`);a&&(this.shadow.querySelectorAll(".wg__toolbar-trigger--active").forEach(l=>{l.classList.remove("wg__toolbar-trigger--active")}),a.classList.add("wg__toolbar-trigger--active"))}closeToolbarAndReset(){this.toolbarMoveInProgress=!1,this.toolbarHovered=!1,this.toolbarHideTimeout&&(clearTimeout(this.toolbarHideTimeout),this.toolbarHideTimeout=null),this.toolbarShortcutHandler&&(document.removeEventListener("keydown",this.toolbarShortcutHandler),this.toolbarShortcutHandler=null),tt()}handleToolbarItemClick(t,i,r){const n=this.grid.displayItems.findIndex(a=>a===r);if(n===-1){this.closeToolbarAndReset();return}const s=t.id==="moveUp"||t.id==="moveDown";if(s&&(this.toolbarMoveInProgress=!0),t.onclick&&t.onclick({row:r,rowIndex:n}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:t,rowIndex:n,row:r}),t.id==="delete"){this.closeToolbarAndReset();return}s?(this.render(),mo(this,this.grid.displayItems),this.renderConnector()):this.render()}handleInlineActionClick(t,i){if(!t)return;const n=Rt(this.grid.rowToolbar).find(a=>a.id===t),s=this.grid.displayItems[i];!n||!s||(n.onclick&&n.onclick({row:s,rowIndex:i}),this.grid.ontoolbarclick&&this.grid.ontoolbarclick({item:n,rowIndex:i,row:s}),this.render())}}typeof customElements<"u"&&!customElements.get("web-grid")&&customElements.define("web-grid",Pt),K.GridElement=Pt,K.WebGrid=co,K.default=Pt,Object.defineProperties(K,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|