@toolbox-web/grid 1.21.2 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -8
- package/all.js +1 -1
- package/all.js.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +53 -2
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +8 -2
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/types.d.ts +84 -2
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +5 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/column-virtualization/types.d.ts +5 -0
- package/lib/plugins/column-virtualization/types.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/context-menu/types.d.ts +5 -0
- package/lib/plugins/context-menu/types.d.ts.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +26 -0
- package/lib/plugins/editing/types.d.ts.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/export/types.d.ts +5 -0
- package/lib/plugins/export/types.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/filtering/types.d.ts +3 -0
- package/lib/plugins/filtering/types.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-columns/types.d.ts +3 -0
- package/lib/plugins/grouping-columns/types.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/grouping-rows/types.d.ts +5 -0
- package/lib/plugins/grouping-rows/types.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/master-detail/types.d.ts +5 -0
- package/lib/plugins/master-detail/types.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/multi-sort/types.d.ts +5 -0
- package/lib/plugins/multi-sort/types.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/types.d.ts +3 -0
- package/lib/plugins/pinned-columns/types.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pinned-rows/types.d.ts +5 -0
- package/lib/plugins/pinned-rows/types.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/pivot/types.d.ts +5 -0
- package/lib/plugins/pivot/types.d.ts.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/print/types.d.ts +3 -0
- package/lib/plugins/print/types.d.ts.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/reorder/types.d.ts +5 -0
- package/lib/plugins/reorder/types.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/responsive/types.d.ts +5 -0
- package/lib/plugins/responsive/types.d.ts.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/row-reorder/types.d.ts +5 -0
- package/lib/plugins/row-reorder/types.d.ts.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +3 -0
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/server-side/types.d.ts +5 -0
- package/lib/plugins/server-side/types.d.ts.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/tree/types.d.ts +5 -0
- package/lib/plugins/tree/types.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/undo-redo/types.d.ts +5 -0
- package/lib/plugins/undo-redo/types.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/lib/plugins/visibility/types.d.ts +5 -0
- package/lib/plugins/visibility/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +1 -1
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +1 -1
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
|
@@ -127,4 +127,9 @@ export interface ContextMenuState {
|
|
|
127
127
|
/** Reference to the menu DOM element */
|
|
128
128
|
menuElement: HTMLElement | null;
|
|
129
129
|
}
|
|
130
|
+
declare module '../../core/types' {
|
|
131
|
+
interface PluginNameMap {
|
|
132
|
+
contextMenu: import('./ContextMenuPlugin').ContextMenuPlugin;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
130
135
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/context-menu/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kJAAkJ;IAClJ,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC;IAC9D,qDAAqD;IACrD,MAAM,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,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MAAM,EAAE,OAAO,SAAK,GAAG,IAAI;IAU5D;;;;;OAKG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAWhD;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IASpC;;OAEG;IACH,eAAe,IAAI,IAAI;IAQvB;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAIpD;;;;;;OAMG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAInE;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAKvC;;;;;OAKG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAyCpD;;;;OAIG;IACH,gBAAgB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAexC;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAgBpD;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IA8CrC;;;OAGG;IACH,mBAAmB,IAAI,IAAI;IAM3B;;OAEG;IACH,mBAAmB,IAAI,IAAI;CAwzB5B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e='input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';document.createElement("template").innerHTML='<div class="cell" role="gridcell" part="cell"></div>';function t(t,i){if(t._virtualization?.enabled){const{rowHeight:e,container:i,viewportEl:n}=t._virtualization,o=i,r=n?.clientHeight??o?.clientHeight??0;if(o&&r>0){const i=t._focusRow*e;i<o.scrollTop?o.scrollTop=i:i+e>o.scrollTop+r&&(o.scrollTop=i-r+e)}}const n=void 0!==t._activeEditRows&&-1!==t._activeEditRows;var o;n||t.refreshVirtualWindow(!1),(o=t._bodyEl)&&o.querySelectorAll(".cell-focus").forEach(e=>e.classList.remove("cell-focus")),Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach(e=>{e.setAttribute("aria-selected","false")});const r=t._focusRow,s=t._virtualization.start??0,d=t._virtualization.end??t._rows.length;if(r>=s&&r<d){const o=t._bodyEl.querySelectorAll(".data-grid-row")[r-s];let d=o?.children[t._focusCol];if(d&&d.classList?.contains("cell")||(d=o?.querySelector(`.cell[data-col="${t._focusCol}"]`)??o?.querySelector(".cell[data-col]")),d){d.classList.add("cell-focus"),d.setAttribute("aria-selected","true");const r=t.querySelector(".tbw-scroll-area");if(r&&d&&(!n||i?.forceHorizontalScroll))if(i?.forceScrollLeft)r.scrollLeft=0;else if(i?.forceScrollRight)r.scrollLeft=r.scrollWidth-r.clientWidth;else{const e=t._getHorizontalScrollOffsets?.(o??void 0,d)??{left:0,right:0};if(!e.skipScroll){const t=d.getBoundingClientRect(),i=r.getBoundingClientRect(),n=t.left-i.left+r.scrollLeft,o=n+t.width,s=r.scrollLeft+e.left,l=r.scrollLeft+r.clientWidth-e.right;n<s?r.scrollLeft=n-e.left:o>l&&(r.scrollLeft=o-r.clientWidth+e.right)}}if(n&&d.classList.contains("editing")){const t=d.querySelector(e);if(t&&document.activeElement!==t)try{t.focus({preventScroll:!0})}catch{}}else if(n&&!d.contains(document.activeElement)){d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1");try{d.focus({preventScroll:!0})}catch{}}else if(!n){const e=t;document.activeElement!==e&&e.focus({preventScroll:!0})}}}}document.createElement("template").innerHTML='<div class="data-grid-row" role="row" part="row"></div>';const i='<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',n={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:i,filterActive:i,print:"🖨️"};class o{static dependencies;static manifest;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#e;get defaultConfig(){return{}}constructor(e={}){this.userConfig=e}attach(e){this.#e?.abort(),this.#e=new AbortController,this.grid=e,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#e?.abort(),this.#e=void 0}getPlugin(e){return this.grid?.getPlugin(e)}emit(e,t){this.grid?.dispatchEvent?.(new CustomEvent(e,{detail:t,bubbles:!0}))}emitCancelable(e,t){const i=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(i),i.defaultPrevented}on(e,t){this.grid?._pluginManager?.subscribe(this,e,t)}off(e){this.grid?._pluginManager?.unsubscribe(this,e)}emitPluginEvent(e,t){this.grid?._pluginManager?.emitPluginEvent(e,t)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}get rows(){return this.grid?.rows??[]}get sourceRows(){return this.grid?.sourceRows??[]}get columns(){return this.grid?.columns??[]}get visibleColumns(){return this.grid?._visibleColumns??[]}get gridElement(){return this.grid}get disconnectSignal(){return this.#e?.signal??this.grid?.disconnectSignal}get gridIcons(){const e=this.grid?.gridConfig?.icons??{};return{...n,...e}}get isAnimationEnabled(){const e=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===e||"off"===e)return!1;if(!0===e||"on"===e)return!0;const t=this.gridElement;if(t){return"0"!==getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const e=this.gridElement;if(e){const t=getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(),i=parseInt(t,10);if(!isNaN(i))return i}return 200}resolveIcon(e,t){return void 0!==t?t:this.gridIcons[e]}setIcon(e,t){"string"==typeof t?e.innerHTML=t:t instanceof HTMLElement&&(e.innerHTML="",e.appendChild(t.cloneNode(!0)))}warn(e){console.warn(`[tbw-grid:${this.name}] ${e}`)}}function r(e){switch(e.type){case"number":return function(e){return t=>{const i=e.editorParams,n=document.createElement("input");n.type="number",n.value=null!=t.value?String(t.value):"",void 0!==i?.min&&(n.min=String(i.min)),void 0!==i?.max&&(n.max=String(i.max)),void 0!==i?.step&&(n.step=String(i.step)),i?.placeholder&&(n.placeholder=i.placeholder);const o=()=>t.commit(""===n.value?null:Number(n.value));return n.addEventListener("blur",o),n.addEventListener("keydown",e=>{"Enter"===e.key&&o(),"Escape"===e.key&&t.cancel()}),n}}(e);case"boolean":return e=>{const t=document.createElement("input");return t.type="checkbox",t.checked=!!e.value,t.addEventListener("change",()=>e.commit(t.checked)),t};case"date":return function(e){return t=>{const i=e.editorParams,n=document.createElement("input");return n.type="date",t.value instanceof Date?n.valueAsDate=t.value:"string"==typeof t.value&&t.value&&(n.value=t.value.split("T")[0]),i?.min&&(n.min=i.min),i?.max&&(n.max=i.max),i?.placeholder&&(n.placeholder=i.placeholder),n.addEventListener("change",()=>{"string"==typeof t.value?t.commit(n.value):t.commit(n.valueAsDate)}),n.addEventListener("keydown",e=>{"Escape"===e.key&&t.cancel()}),n}}(e);case"select":return function(e){return t=>{const i=e.editorParams,n=document.createElement("select");if(e.multi&&(n.multiple=!0),i?.includeEmpty){const e=document.createElement("option");e.value="",e.textContent=i.emptyLabel??"",n.appendChild(e)}const o=function(e){const t=e.options;return t?"function"==typeof t?t():t:[]}(e);o.forEach(i=>{const o=document.createElement("option");o.value=String(i.value),o.textContent=i.label,e.multi&&Array.isArray(t.value)&&t.value.includes(i.value)?o.selected=!0:e.multi||t.value!==i.value||(o.selected=!0),n.appendChild(o)});const r=()=>{if(e.multi){const e=Array.from(n.selectedOptions).map(e=>e.value);t.commit(e)}else t.commit(n.value)};return n.addEventListener("change",r),n.addEventListener("blur",r),n.addEventListener("keydown",e=>{"Escape"===e.key&&t.cancel()}),n}}(e);default:return function(e){return t=>{const i=e.editorParams,n=document.createElement("input");n.type="text",n.value=null!=t.value?String(t.value):"",void 0!==i?.maxLength&&(n.maxLength=i.maxLength),i?.pattern&&(n.pattern=i.pattern),i?.placeholder&&(n.placeholder=i.placeholder);const o=()=>{const e=n.value;(null!==t.value&&void 0!==t.value||""!==e)&&("string"==typeof t.value&&e===t.value.replace(/[\n\r]/g,"")||("number"==typeof t.value&&""!==e?t.commit(Number(e)):t.commit(e)))};return n.addEventListener("blur",o),n.addEventListener("keydown",e=>{"Enter"===e.key&&o(),"Escape"===e.key&&t.cancel()}),n}}(e)}}function s(e){return"string"==typeof e&&("__proto__"!==e&&"constructor"!==e&&"prototype"!==e)}function d(e,t,i){return e instanceof HTMLInputElement?"checkbox"===e.type?e.checked:"number"===e.type?""===e.value?null:Number(e.value):"date"===e.type?"string"==typeof i?e.value:e.valueAsDate:"number"==typeof i?""===e.value?null:Number(e.value):null==i&&""===e.value||"string"==typeof i&&e.value===i.replace(/[\n\r]/g,"")?i:e.value:"number"===t?.type&&""!==e.value||"number"==typeof i&&""!==e.value?Number(e.value):null==i&&""===e.value?i:e.value}function l(e){}class c extends o{static manifest={ownedProperties:[{property:"editable",level:"column",description:'the "editable" column property',isUsed:e=>!0===e},{property:"editor",level:"column",description:'the "editor" column property'},{property:"editorParams",level:"column",description:'the "editorParams" column property'}],events:[{type:"cell-edit-committed",description:"Emitted when a cell edit is committed (for plugin-to-plugin coordination)"}],queries:[{type:"isEditing",description:"Returns whether any cell is currently being edited"}]};name="editing";styles="@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;--tbw-invalid-bg: light-dark(#fef2f2, #450a0a);--tbw-invalid-border-color: light-dark(#ef4444, #f87171)}tbw-grid:not(.tbw-grid-mode) .data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}tbw-grid .data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}tbw-grid .data-grid-row>.cell.editing input:not([type=checkbox]),tbw-grid .data-grid-row>.cell.editing select,tbw-grid .data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}tbw-grid .tbw-editor-host{display:contents}tbw-grid .data-grid-row>.cell[data-invalid=true]{background:var(--tbw-invalid-bg);outline:1px solid var(--tbw-invalid-border-color);outline-offset:-1px}}";get defaultConfig(){return{mode:"row",editOn:"click"}}get#t(){return"grid"===this.config.mode}#i=-1;#n;#o;#r=-1;#s=/* @__PURE__ */new Map;#d=/* @__PURE__ */new Set;#l=/* @__PURE__ */new Set;#c=/* @__PURE__ */new Map;#a=!1;#u=-1;#h=/* @__PURE__ */new Map;#f=!1;#g=!1;#w=!1;attach(t){super.attach(t);const i=this.disconnectSignal,n=t;n._activeEditRows=-1,n._rowEditSnapshots=/* @__PURE__ */new Map,Object.defineProperty(t,"changedRows",{get:()=>this.changedRows,configurable:!0}),Object.defineProperty(t,"changedRowIds",{get:()=>this.changedRowIds,configurable:!0}),t.resetChangedRows=e=>this.resetChangedRows(e),t.beginBulkEdit=(e,t)=>{t&&this.beginCellEdit(e,t)},document.addEventListener("keydown",e=>{if(!this.#t&&"Escape"===e.key&&-1!==this.#i){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}this.#v(this.#i,!0)}},{capture:!0,signal:i}),document.addEventListener("mousedown",e=>{if(this.#t)return;if(-1===this.#i)return;const t=n.findRenderedRowElement?.(this.#i);if(!t)return;if(!(e.composedPath&&e.composedPath()||[]).includes(t)){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}queueMicrotask(()=>{-1!==this.#i&&this.#v(this.#i,!1)})}},{signal:i}),this.gridElement.addEventListener("cell-change",e=>{const t=e.detail;if("user"===t.source)return;const i=`${t.rowIndex}:${t.field}`,n=this.#c.get(i);n&&n(t.newValue)},{signal:i}),this.#t&&(n._isGridEditMode=!0,this.gridElement.classList.add("tbw-grid-mode"),this.requestRender(),this.gridElement.addEventListener("focusin",t=>{const i=t.target;if(i.matches(e)){if(this.#g)return i.blur(),void this.gridElement.focus();this.#f=!0}},{signal:i}),this.gridElement.addEventListener("focusout",t=>{const i=t.relatedTarget;i&&this.gridElement.contains(i)&&i.matches(e)||(this.#f=!1)},{signal:i}),this.gridElement.addEventListener("keydown",e=>{if("Escape"===e.key&&this.#f){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}const t=document.activeElement;t&&this.gridElement.contains(t)&&(t.blur(),this.gridElement.focus()),this.#f=!1,this.#g=!0,e.preventDefault(),e.stopPropagation()}},{capture:!0,signal:i}),this.gridElement.addEventListener("mousedown",t=>{t.target.matches(e)&&(this.#g=!1)},{signal:i}))}detach(){this.gridElement._isGridEditMode=!1,this.gridElement.classList.remove("tbw-grid-mode"),this.#i=-1,this.#n=void 0,this.#o=void 0,this.#r=-1,this.#s.clear(),this.#d.clear(),this.#l.clear(),this.#c.clear(),this.#f=!1,this.#g=!1,this.#w=!1,super.detach()}handleQuery(e){if("isEditing"===e.type)return this.#t||-1!==this.#i}onCellClick(e){if(this.#t)return!1;const t=this.grid,i=this.config.editOn??t.effectiveConfig?.editOn;if(!1===i||"manual"===i)return!1;if("click"!==i&&"dblclick"!==i)return!1;const n="dblclick"===e.originalEvent.type;if("click"===i&&n)return!1;if("dblclick"===i&&!n)return!1;const{rowIndex:o}=e,r=t._columns?.some(e=>e.editable);return!!r&&(e.originalEvent.stopPropagation(),this.beginBulkEdit(o),!0)}onKeyDown(e){const i=this.grid;if("Escape"===e.key){if(this.#t&&this.#f){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return!0}const t=document.activeElement;return t&&this.gridElement.contains(t)&&t.blur(),this.#f=!1,this.requestAfterRender(),!0}if(-1!==this.#i&&!this.#t){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return!0}return this.#v(this.#i,!0),!0}}if(this.#t&&!this.#f&&("ArrowUp"===e.key||"ArrowDown"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key))return!1;if(this.#t&&this.#f&&("ArrowUp"===e.key||"ArrowDown"===e.key))return!0;if(("ArrowUp"===e.key||"ArrowDown"===e.key)&&-1!==this.#i&&!this.#t){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return!0}const n=i._rows.length-1,o=this.#i;return this.#v(o,!1),"ArrowDown"===e.key?i._focusRow=Math.min(n,i._focusRow+1):i._focusRow=Math.max(0,i._focusRow-1),e.preventDefault(),t(i),this.requestAfterRender(),!0}if("Tab"===e.key&&(-1!==this.#i||this.#t)){if(e.preventDefault(),this.#w)return this.#v(this.#i,!1),!0;const t=!e.shiftKey;return this.#p(t),!0}if(" "===e.key||"Spacebar"===e.key){if(-1!==this.#i)return!1;const t=i._focusRow,n=i._focusCol;if(t>=0&&n>=0){const o=i._visibleColumns[n],r=i._rows[t];if(o?.editable&&"boolean"===o.type&&r){const i=o.field;if(s(i)){const n=!r[i];return this.#m(t,o,n,r),e.preventDefault(),this.requestRender(),!0}}}return!1}if(!("Enter"!==e.key||e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)){if(this.#t&&!this.#f)return this.#E(),!0;if(-1!==this.#i){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return!0}return!1}const t=this.config.editOn??i.effectiveConfig?.editOn;if(!1===t||"manual"===t)return!1;const n=i._focusRow,o=i._focusCol;if(n>=0){const t=i._columns?.some(e=>e.editable);if(t){const t=i._visibleColumns[o],r=i._rows[n],s=t?.field??"",d=s&&r?r[s]:void 0,l=this.gridElement.querySelector(`[data-row="${n}"][data-col="${o}"]`),c=new CustomEvent("cell-activate",{cancelable:!0,bubbles:!0,detail:{rowIndex:n,colIndex:o,field:s,value:d,row:r,cellEl:l,trigger:"keyboard",originalEvent:e}});this.gridElement.dispatchEvent(c);const a=new CustomEvent("activate-cell",{cancelable:!0,bubbles:!0,detail:{row:n,col:o}});return this.gridElement.dispatchEvent(a),c.defaultPrevented||a.defaultPrevented?(e.preventDefault(),!0):(this.beginBulkEdit(n),!0)}}return!1}if("F2"===e.key){if(-1!==this.#i||this.#t)return!1;if(!1===(this.config.editOn??i.effectiveConfig?.editOn))return!1;const t=i._focusRow,n=i._focusCol;if(t>=0&&n>=0){const o=i._visibleColumns[n];if(o?.editable&&o.field)return e.preventDefault(),this.beginCellEdit(t,o.field),!0}return!1}return!1}processColumns(e){const t=this.grid,i=t.effectiveConfig?.typeDefaults,n=t.__frameworkAdapter;return i||n?.getTypeDefault?e.map(e=>{if(!e.type)return e;let t;if(i?.[e.type]?.editorParams&&(t=i[e.type].editorParams),!t&&n?.getTypeDefault){const i=n.getTypeDefault(e.type);i?.editorParams&&(t=i.editorParams)}return t?{...e,editorParams:{...t,...e.editorParams}}:e}):e}afterRender(){const e=this.grid;if(this.#a&&(this.#a=!1,this.#b(e)),-1!==this.#u){const t=this.#u;this.#u=-1,e.animateRow?.(t,"change")}if(!this.#t&&0!==this.#l.size)for(const t of this.#l){const[i,n]=t.split(":"),o=parseInt(i,10),r=parseInt(n,10),s=e.findRenderedRowElement?.(o);if(!s)continue;const d=s.querySelector(`.cell[data-col="${r}"]`);if(!d||d.classList.contains("editing"))continue;const l=e._rows[o],c=e._visibleColumns[r];l&&c&&this.#R(l,o,c,r,d,!0)}}afterCellRender(e){if(!this.#t)return;const{row:t,rowIndex:i,column:n,colIndex:o,cellElement:r}=e;n.editable&&(r.classList.contains("editing")||this.#R(t,i,n,o,r,!0))}onScrollRender(){this.afterRender()}get changedRows(){const e=[];for(const t of this.#d){const i=this.grid.getRow(t);i&&e.push(i)}return e}get changedRowIds(){return Array.from(this.#d)}get activeEditRow(){return this.#i}get activeEditCol(){return this.#r}isRowEditing(e){return this.#i===e}isCellEditing(e,t){return this.#l.has(`${e}:${t}`)}isRowChanged(e){const t=this.grid,i=t._rows[e];if(!i)return!1;try{const e=t.getRowId?.(i);return!!e&&this.#d.has(e)}catch{return!1}}isRowChangedById(e){return this.#d.has(e)}setInvalid(e,t,i=""){let n=this.#h.get(e);n||(n=/* @__PURE__ */new Map,this.#h.set(e,n)),n.set(t,i),this.#y(e,t,!0)}clearInvalid(e,t){const i=this.#h.get(e);i&&(i.delete(t),0===i.size&&this.#h.delete(e)),this.#y(e,t,!1)}clearRowInvalid(e){const t=this.#h.get(e);if(t){const i=Array.from(t.keys());this.#h.delete(e),i.forEach(t=>this.#y(e,t,!1))}}clearAllInvalid(){const e=Array.from(this.#h.entries());this.#h.clear(),e.forEach(([e,t])=>{t.forEach((t,i)=>this.#y(e,i,!1))})}isCellInvalid(e,t){return this.#h.get(e)?.has(t)??!1}getInvalidMessage(e,t){return this.#h.get(e)?.get(t)}hasInvalidCells(e){const t=this.#h.get(e);return!!t&&t.size>0}getInvalidFields(e){return new Map(this.#h.get(e)??[])}#y(e,t,i){const n=this.grid,o=n._visibleColumns?.findIndex(e=>e.field===t);if(-1===o||void 0===o)return;const r=n._rows,s=r?.findIndex(t=>{try{return n.getRowId?.(t)===e}catch{return!1}});if(-1===s||void 0===s)return;const d=n.findRenderedRowElement?.(s),l=d?.querySelector(`.cell[data-col="${o}"]`);if(l)if(i){l.setAttribute("data-invalid","true");const i=this.#h.get(e)?.get(t);i&&l.setAttribute("title",i)}else l.removeAttribute("data-invalid"),l.removeAttribute("title")}resetChangedRows(e){const t=this.changedRows,i=this.changedRowIds;this.#d.clear(),this.#C(),e||this.emit("changed-rows-reset",{rows:t,ids:i});const n=this.grid;n._rowPool?.forEach(e=>e.classList.remove("changed"))}beginCellEdit(e,t){const i=this.grid,n=i._visibleColumns.findIndex(e=>e.field===t);if(-1===n)return;const o=i._visibleColumns[n];if(!o?.editable)return;const r=i.findRenderedRowElement?.(e),s=r?.querySelector(`.cell[data-col="${n}"]`);s&&(this.#w=!0,this.#_(e,n,s))}beginBulkEdit(t){const i=this.grid;if(!1===(this.config.editOn??i.effectiveConfig?.editOn))return;const n=i._columns?.some(e=>e.editable);if(!n)return;const o=i.findRenderedRowElement?.(t);if(!o)return;this.#w=!1;const r=i._rows[t];this.#I(t,r),Array.from(o.children).forEach((e,n)=>{const o=i._visibleColumns[n];if(o?.editable){const i=e;i.classList.contains("editing")||this.#R(r,t,o,n,i,!0)}}),setTimeout(()=>{let t=o.querySelector(`.cell[data-col="${i._focusCol}"]`);if(t?.classList.contains("editing")||(t=o.querySelector(".cell.editing")),t?.classList.contains("editing")){const i=t.querySelector(e);try{i?.focus({preventScroll:!0})}catch{}}},0)}commitActiveRowEdit(){-1!==this.#i&&this.#v(this.#i,!1)}cancelActiveRowEdit(){-1!==this.#i&&this.#v(this.#i,!0)}#_(e,t,i){const n=this.grid,o=n._rows[e],r=n._visibleColumns[t];o&&r?.editable&&(i.classList.contains("editing")||(this.#i!==e&&this.#I(e,o),this.#r=t,this.#R(o,e,r,t,i,!1)))}#E(){const t=this.grid,i=t._focusRow,n=t._focusCol;if(i<0||n<0)return;const o=t.findRenderedRowElement?.(i),r=o?.querySelector(`.cell[data-col="${n}"]`);if(r?.classList.contains("editing")){const t=r.querySelector(e);t&&(this.#g=!1,t.focus(),this.#f=!0,t instanceof HTMLInputElement&&("text"===t.type||"number"===t.type)&&t.select())}}#p(i){const n=this.grid,o=n._rows,r=this.#t?n._focusRow:this.#i,s=n._visibleColumns.map((e,t)=>e.editable?t:-1).filter(e=>e>=0);if(0===s.length)return;const d=s.indexOf(n._focusCol)+(i?1:-1);if(d>=0&&d<s.length){n._focusCol=s[d];const i=n.findRenderedRowElement?.(r),o=i?.querySelector(`.cell[data-col="${s[d]}"]`);if(o?.classList.contains("editing")){const t=o.querySelector(e);t?.focus({preventScroll:!0})}return void t(n,{forceHorizontalScroll:!0})}const l=r+(i?1:-1);l>=0&&l<o.length&&(this.#t?(n._focusRow=l,n._focusCol=i?s[0]:s[s.length-1],t(n,{forceHorizontalScroll:!0}),this.requestAfterRender(),setTimeout(()=>{const t=n.findRenderedRowElement?.(l),i=t?.querySelector(`.cell[data-col="${n._focusCol}"]`);if(i?.classList.contains("editing")){const t=i.querySelector(e);t?.focus({preventScroll:!0})}},0)):(this.#v(r,!1),n._focusRow=l,n._focusCol=i?s[0]:s[s.length-1],this.beginBulkEdit(l),t(n,{forceHorizontalScroll:!0})))}#C(){const e=this.grid;e._activeEditRows=this.#i,e._rowEditSnapshots=this.#s}#I(e,t){if(this.#i!==e){this.#s.set(e,{...t}),this.#i=e,this.#o=t;const i=this.grid;try{this.#n=i.getRowId?.(t)??void 0}catch{this.#n=void 0}this.#C(),this.#t||this.emit("edit-open",{rowIndex:e,rowId:this.#n??"",row:t})}}#v(e,t){if(this.#i!==e)return;const i=this.grid,n=this.#s.get(e),o=i.findRenderedRowElement?.(e);let r=this.#n;const s=r?i._getRowEntry(r):void 0,l=s?.row??this.#o??i._rows[e];if(!r&&l)try{r=i.getRowId?.(l)}catch{}if(!t&&o&&l){o.querySelectorAll(".cell.editing").forEach(t=>{const n=Number(t.getAttribute("data-col"));if(isNaN(n))return;const o=i._visibleColumns[n];if(!o)return;if(t.hasAttribute("data-editor-managed"))return;const r=t.querySelector("input,textarea,select");if(r){const t=o.field,i=l[t],n=d(r,o,i);i!==n&&this.#m(e,o,n,l)}})}if(t||this.#t||!l||this.emit("before-edit-close",{rowIndex:e,rowId:r??"",row:l}),t&&n&&l)Object.keys(n).forEach(e=>{l[e]=n[e]}),r&&(this.#d.delete(r),this.clearRowInvalid(r));else if(!t&&l){const t=this.#k(n,l),i=r?this.#d.has(r):t,o=this.emitCancelable("row-commit",{rowIndex:e,rowId:r??"",row:l,oldValue:n,newValue:l,changed:i,changedRows:this.changedRows,changedRowIds:this.changedRowIds});o&&n?(Object.keys(n).forEach(e=>{l[e]=n[e]}),r&&(this.#d.delete(r),this.clearRowInvalid(r))):!o&&t&&this.isAnimationEnabled&&(this.#u=e)}this.#s.delete(e),this.#i=-1,this.#n=void 0,this.#o=void 0,this.#r=-1,this.#w=!1,this.#C();for(const d of this.#l)d.startsWith(`${e}:`)&&this.#l.delete(d);for(const d of this.#c.keys())d.startsWith(`${e}:`)&&this.#c.delete(d);this.#a=!0,o?(o.querySelectorAll(".cell.editing").forEach(e=>{e.classList.remove("editing"),function(e){e.__editingCellCount=0,e.removeAttribute("data-has-editing")}(e.parentElement)}),i.refreshVirtualWindow(!0)):(this.#b(i),this.#a=!1),!this.#t&&l&&this.emit("edit-close",{rowIndex:e,rowId:r??"",row:l,reverted:t})}#m(e,t,i,n){const o=t.field;if(!s(o))return;const r=n[o];if(r===i)return;const d=this.grid;let c;try{c=this.grid.getRowId(n)}catch{}const a=!c||!this.#d.has(c),u=c?e=>this.grid.updateRow(c,e,"cascade"):l;let h=!1;const f=c?e=>{h=!0,this.setInvalid(c,o,e??"")}:()=>{};if(this.emitCancelable("cell-commit",{row:n,rowId:c??"",field:o,oldValue:r,value:i,rowIndex:e,changedRows:this.changedRows,changedRowIds:this.changedRowIds,firstTimeForRow:a,updateRow:u,setInvalid:f}))return;c&&!h&&this.isCellInvalid(c,o)&&this.clearInvalid(c,o),n[o]=i,c&&this.#d.add(c),this.#C(),this.emitPluginEvent("cell-edit-committed",{rowIndex:e,field:o,oldValue:r,newValue:i});const g=d.findRenderedRowElement?.(e);g&&g.classList.add("changed")}#R(t,i,n,o,c,a){if(!n.editable)return;if(c.classList.contains("editing"))return;let u;try{u=this.grid.getRowId(t)}catch{}const h=u?e=>this.grid.updateRow(u,e,"cascade"):l,f=s(n.field)?t[n.field]:void 0;c.classList.add("editing"),this.#l.add(`${i}:${o}`);const g=c.parentElement;g&&function(e){const t=(e.__editingCellCount??0)+1;e.__editingCellCount=t,e.setAttribute("data-has-editing","")}(g);let w=!1;const v=e=>{if(w||!this.#t&&-1===this.#i)return;const o=this.grid,r=u?o._getRowEntry(u):void 0,s=r?.row??t,d=r?.index??i;this.#m(d,n,e,s)},p=()=>{if(w=!0,s(n.field)){const e=this.grid,i=u?e._getRowEntry(u):void 0;(i?.row??t)[n.field]=f}},m=document.createElement("div");m.className="tbw-editor-host",c.innerHTML="",c.appendChild(m),m.addEventListener("keydown",e=>{if("Enter"===e.key){if(this.#t){e.stopPropagation(),e.preventDefault();const t=m.querySelector("input,textarea,select");return void(t&&v(d(t,n,f)))}if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}e.stopPropagation(),e.preventDefault(),w=!0,this.#v(i,!1)}if("Escape"===e.key){if(this.#t)return e.stopPropagation(),void e.preventDefault();if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}e.stopPropagation(),e.preventDefault(),p(),this.#v(i,!0)}});const E=n,b=E.__editorTemplate,R=function(e,t){if(t.editor)return t.editor;if(t.__editorTemplate)return"template";if(!t.type)return;const i=e.effectiveConfig?.typeDefaults;if(i?.[t.type]?.editor)return i[t.type].editor;const n=e.__frameworkAdapter;if(n?.getTypeDefault){const e=n.getTypeDefault(t.type);if(e?.editor)return e.editor}}(this.grid,E)??r(n),y=f,C=`${i}:${n.field}`,_=[];this.#c.set(C,e=>{for(const t of _)t(e)});const I=e=>{_.push(e)};if("template"===R&&b)this.#S(m,E,t,f,v,p,a,i),I(e=>{const t=m.querySelector("input,textarea,select");t&&(t instanceof HTMLInputElement&&"checkbox"===t.type?t.checked=!!e:t.value=String(e??""))});else if("string"==typeof R){const t=document.createElement(R);t.value=y,t.addEventListener("change",()=>v(t.value)),I(e=>{t.value=e}),m.appendChild(t),a||queueMicrotask(()=>{const t=m.querySelector(e);t?.focus({preventScroll:!0})})}else if("function"==typeof R){const i=R({row:t,rowId:u??"",value:y,field:n.field,column:n,commit:v,cancel:p,updateRow:h,onValueChange:I});if("string"==typeof i)m.innerHTML=i,function(e,t,i,n){const o=e.querySelector("input,textarea,select");o&&(o.addEventListener("blur",()=>{i(d(o,t,n))}),o instanceof HTMLInputElement&&"checkbox"===o.type?o.addEventListener("change",()=>i(o.checked)):o instanceof HTMLSelectElement&&o.addEventListener("change",()=>i(d(o,t,n))))}(m,n,v,f),I(e=>{const t=m.querySelector("input,textarea,select");t&&(t instanceof HTMLInputElement&&"checkbox"===t.type?t.checked=!!e:t.value=String(e??""))});else if(i instanceof Node){m.appendChild(i);i instanceof HTMLInputElement||i instanceof HTMLSelectElement||i instanceof HTMLTextAreaElement?I(e=>{i instanceof HTMLInputElement&&"checkbox"===i.type?i.checked=!!e:i.value=String(e??"")}):c.setAttribute("data-editor-managed","")}a||queueMicrotask(()=>{const t=m.querySelector(e);t?.focus({preventScroll:!0})})}else if(R&&"object"==typeof R){const e=document.createElement("div");e.setAttribute("data-external-editor",""),e.setAttribute("data-field",n.field),m.appendChild(e),c.setAttribute("data-editor-managed","");const i={row:t,rowId:u??"",value:y,field:n.field,column:n,commit:v,cancel:p,updateRow:h,onValueChange:I};if(R.mount)try{R.mount({placeholder:e,context:i,spec:R})}catch(k){console.warn(`[tbw-grid] External editor mount error for column '${n.field}':`,k)}else this.grid.dispatchEvent(new CustomEvent("mount-external-editor",{detail:{placeholder:e,spec:R,context:i}}))}}#S(e,t,i,n,o,r,l,c){const a=t.__editorTemplate;if(!a)return;const u=a.cloneNode(!0),h=t.__compiledEditor;h?u.innerHTML=h({row:i,value:n,field:t.field,column:t,commit:o,cancel:r}):u.querySelectorAll("*").forEach(e=>{1===e.childNodes.length&&e.firstChild?.nodeType===Node.TEXT_NODE&&(e.textContent=e.textContent?.replace(/{{\s*value\s*}}/g,null==n?"":String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g,(e,t)=>{if(!s(t))return"";const n=i[t];return null==n?"":String(n)})||"")});const f=u.querySelector("input,textarea,select");if(f){f instanceof HTMLInputElement&&"checkbox"===f.type?f.checked=!!n:f.value=String(n??"");let e=!1;f.addEventListener("blur",()=>{e||o(d(f,t,n))}),f.addEventListener("keydown",i=>{const s=i;if("Enter"===s.key){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(s))return}s.stopPropagation(),s.preventDefault(),e=!0,o(d(f,t,n)),this.#v(c,!1)}if("Escape"===s.key){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(s))return}s.stopPropagation(),s.preventDefault(),r(),this.#v(c,!0)}}),f instanceof HTMLInputElement&&"checkbox"===f.type&&f.addEventListener("change",()=>o(f.checked)),l||setTimeout(()=>f.focus({preventScroll:!0}),0)}e.appendChild(u)}#k(e,t){if(!e)return!1;const i=e,n=t,o=/* @__PURE__ */new Set([...Object.keys(i),...Object.keys(n)]);for(const r of o)if(i[r]!==n[r])return!0;return!1}#b(e){queueMicrotask(()=>{try{const t=e._focusRow,i=e._focusCol,n=e.findRenderedRowElement?.(t);if(n){Array.from(e._bodyEl.querySelectorAll(".cell-focus")).forEach(e=>e.classList.remove("cell-focus"));const o=n.querySelector(`.cell[data-row="${t}"][data-col="${i}"]`);o&&(o.classList.add("cell-focus"),o.setAttribute("aria-selected","true"),o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}))}}catch{}})}}export{c as EditingPlugin,r as defaultEditorFor};
|
|
1
|
+
const e='input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';document.createElement("template").innerHTML='<div class="cell" role="gridcell" part="cell"></div>';function t(t,i){if(t._virtualization?.enabled){const{rowHeight:e,container:i,viewportEl:n}=t._virtualization,o=i,r=n?.clientHeight??o?.clientHeight??0;if(o&&r>0){const i=t._focusRow*e;i<o.scrollTop?o.scrollTop=i:i+e>o.scrollTop+r&&(o.scrollTop=i-r+e)}}const n=void 0!==t._activeEditRows&&-1!==t._activeEditRows;var o;n||t.refreshVirtualWindow(!1),(o=t._bodyEl)&&o.querySelectorAll(".cell-focus").forEach(e=>e.classList.remove("cell-focus")),Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach(e=>{e.setAttribute("aria-selected","false")});const r=t._focusRow,s=t._virtualization.start??0,d=t._virtualization.end??t._rows.length;if(r>=s&&r<d){const o=t._bodyEl.querySelectorAll(".data-grid-row")[r-s];let d=o?.children[t._focusCol];if(d&&d.classList?.contains("cell")||(d=o?.querySelector(`.cell[data-col="${t._focusCol}"]`)??o?.querySelector(".cell[data-col]")),d){d.classList.add("cell-focus"),d.setAttribute("aria-selected","true");const r=t.querySelector(".tbw-scroll-area");if(r&&d&&(!n||i?.forceHorizontalScroll))if(i?.forceScrollLeft)r.scrollLeft=0;else if(i?.forceScrollRight)r.scrollLeft=r.scrollWidth-r.clientWidth;else{const e=t._getHorizontalScrollOffsets?.(o??void 0,d)??{left:0,right:0};if(!e.skipScroll){const t=d.getBoundingClientRect(),i=r.getBoundingClientRect(),n=t.left-i.left+r.scrollLeft,o=n+t.width,s=r.scrollLeft+e.left,l=r.scrollLeft+r.clientWidth-e.right;n<s?r.scrollLeft=n-e.left:o>l&&(r.scrollLeft=o-r.clientWidth+e.right)}}if(n&&d.classList.contains("editing")){const t=d.querySelector(e);if(t&&document.activeElement!==t)try{t.focus({preventScroll:!0})}catch{}}else if(n&&!d.contains(document.activeElement)){d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1");try{d.focus({preventScroll:!0})}catch{}}else if(!n){const e=t;document.activeElement!==e&&e.focus({preventScroll:!0})}}}}document.createElement("template").innerHTML='<div class="data-grid-row" role="row" part="row"></div>';const i='<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>',n={expand:"▶",collapse:"▼",sortAsc:"▲",sortDesc:"▼",sortNone:"⇅",submenuArrow:"▶",dragHandle:"⋮⋮",toolPanel:"☰",filter:i,filterActive:i,print:"🖨️"};class o{static dependencies;static manifest;version="undefined"!=typeof __GRID_VERSION__?__GRID_VERSION__:"dev";styles;cellRenderers;headerRenderers;cellEditors;grid;config;userConfig;#e;get defaultConfig(){return{}}constructor(e={}){this.userConfig=e}attach(e){this.#e?.abort(),this.#e=new AbortController,this.grid=e,this.config={...this.defaultConfig,...this.userConfig}}detach(){this.#e?.abort(),this.#e=void 0}getPlugin(e){return this.grid?.getPlugin(e)}emit(e,t){this.grid?.dispatchEvent?.(new CustomEvent(e,{detail:t,bubbles:!0}))}emitCancelable(e,t){const i=new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0});return this.grid?.dispatchEvent?.(i),i.defaultPrevented}on(e,t){this.grid?._pluginManager?.subscribe(this,e,t)}off(e){this.grid?._pluginManager?.unsubscribe(this,e)}emitPluginEvent(e,t){this.grid?._pluginManager?.emitPluginEvent(e,t)}requestRender(){this.grid?.requestRender?.()}requestColumnsRender(){this.grid?.requestColumnsRender?.()}requestRenderWithFocus(){this.grid?.requestRenderWithFocus?.()}requestAfterRender(){this.grid?.requestAfterRender?.()}get rows(){return this.grid?.rows??[]}get sourceRows(){return this.grid?.sourceRows??[]}get columns(){return this.grid?.columns??[]}get visibleColumns(){return this.grid?._visibleColumns??[]}get gridElement(){return this.grid}get disconnectSignal(){return this.#e?.signal??this.grid?.disconnectSignal}get gridIcons(){const e=this.grid?.gridConfig?.icons??{};return{...n,...e}}get isAnimationEnabled(){const e=this.grid?.effectiveConfig?.animation?.mode??"reduced-motion";if(!1===e||"off"===e)return!1;if(!0===e||"on"===e)return!0;const t=this.gridElement;if(t){return"0"!==getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim()}return!0}get animationDuration(){const e=this.gridElement;if(e){const t=getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(),i=parseInt(t,10);if(!isNaN(i))return i}return 200}resolveIcon(e,t){return void 0!==t?t:this.gridIcons[e]}setIcon(e,t){"string"==typeof t?e.innerHTML=t:t instanceof HTMLElement&&(e.innerHTML="",e.appendChild(t.cloneNode(!0)))}warn(e){console.warn(`[tbw-grid:${this.name}] ${e}`)}}function r(e){switch(e.type){case"number":return function(e){return t=>{const i=e.editorParams,n=document.createElement("input");n.type="number",n.value=null!=t.value?String(t.value):"",void 0!==i?.min&&(n.min=String(i.min)),void 0!==i?.max&&(n.max=String(i.max)),void 0!==i?.step&&(n.step=String(i.step)),i?.placeholder&&(n.placeholder=i.placeholder);const o=()=>t.commit(""===n.value?null:Number(n.value));return n.addEventListener("blur",o),n.addEventListener("keydown",e=>{"Enter"===e.key&&o(),"Escape"===e.key&&t.cancel()}),n}}(e);case"boolean":return e=>{const t=document.createElement("input");return t.type="checkbox",t.checked=!!e.value,t.addEventListener("change",()=>e.commit(t.checked)),t};case"date":return function(e){return t=>{const i=e.editorParams,n=document.createElement("input");return n.type="date",t.value instanceof Date?n.valueAsDate=t.value:"string"==typeof t.value&&t.value&&(n.value=t.value.split("T")[0]),i?.min&&(n.min=i.min),i?.max&&(n.max=i.max),i?.placeholder&&(n.placeholder=i.placeholder),n.addEventListener("change",()=>{"string"==typeof t.value?t.commit(n.value):t.commit(n.valueAsDate)}),n.addEventListener("keydown",e=>{"Escape"===e.key&&t.cancel()}),n}}(e);case"select":return function(e){return t=>{const i=e.editorParams,n=document.createElement("select");if(e.multi&&(n.multiple=!0),i?.includeEmpty){const e=document.createElement("option");e.value="",e.textContent=i.emptyLabel??"",n.appendChild(e)}const o=function(e){const t=e.options;return t?"function"==typeof t?t():t:[]}(e);o.forEach(i=>{const o=document.createElement("option");o.value=String(i.value),o.textContent=i.label,e.multi&&Array.isArray(t.value)&&t.value.includes(i.value)?o.selected=!0:e.multi||t.value!==i.value||(o.selected=!0),n.appendChild(o)});const r=()=>{if(e.multi){const e=Array.from(n.selectedOptions).map(e=>e.value);t.commit(e)}else t.commit(n.value)};return n.addEventListener("change",r),n.addEventListener("blur",r),n.addEventListener("keydown",e=>{"Escape"===e.key&&t.cancel()}),n}}(e);default:return function(e){return t=>{const i=e.editorParams,n=document.createElement("input");n.type="text",n.value=null!=t.value?String(t.value):"",void 0!==i?.maxLength&&(n.maxLength=i.maxLength),i?.pattern&&(n.pattern=i.pattern),i?.placeholder&&(n.placeholder=i.placeholder);const o=()=>{const e=n.value;(null!==t.value&&void 0!==t.value||""!==e)&&("string"==typeof t.value&&e===t.value.replace(/[\n\r]/g,"")||("number"==typeof t.value&&""!==e?t.commit(Number(e)):t.commit(e)))};return n.addEventListener("blur",o),n.addEventListener("keydown",e=>{"Enter"===e.key&&o(),"Escape"===e.key&&t.cancel()}),n}}(e)}}function s(e){return"string"==typeof e&&("__proto__"!==e&&"constructor"!==e&&"prototype"!==e)}function d(e,t,i){return e instanceof HTMLInputElement?"checkbox"===e.type?e.checked:"number"===e.type?""===e.value?null:Number(e.value):"date"===e.type?"string"==typeof i?e.value:e.valueAsDate:"number"==typeof i?""===e.value?null:Number(e.value):null==i&&""===e.value||"string"==typeof i&&e.value===i.replace(/[\n\r]/g,"")?i:e.value:"number"===t?.type&&""!==e.value||"number"==typeof i&&""!==e.value?Number(e.value):null==i&&""===e.value?i:e.value}function l(e){}class c extends o{static manifest={ownedProperties:[{property:"editable",level:"column",description:'the "editable" column property',isUsed:e=>!0===e},{property:"editor",level:"column",description:'the "editor" column property'},{property:"editorParams",level:"column",description:'the "editorParams" column property'}],events:[{type:"cell-edit-committed",description:"Emitted when a cell edit is committed (for plugin-to-plugin coordination)"}],queries:[{type:"isEditing",description:"Returns whether any cell is currently being edited"}]};name="editing";styles="@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;--tbw-invalid-bg: light-dark(#fef2f2, #450a0a);--tbw-invalid-border-color: light-dark(#ef4444, #f87171)}tbw-grid:not(.tbw-grid-mode) .data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}tbw-grid .data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}tbw-grid .data-grid-row>.cell.editing input:not([type=checkbox]),tbw-grid .data-grid-row>.cell.editing select,tbw-grid .data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}tbw-grid .tbw-editor-host{display:contents}tbw-grid .data-grid-row>.cell[data-invalid=true]{background:var(--tbw-invalid-bg);outline:1px solid var(--tbw-invalid-border-color);outline-offset:-1px}}";get defaultConfig(){return{mode:"row",editOn:"click"}}get#t(){return"grid"===this.config.mode}#i=-1;#n;#o;#r=-1;#s=/* @__PURE__ */new Map;#d=/* @__PURE__ */new Set;#l=/* @__PURE__ */new Set;#c=/* @__PURE__ */new Map;#a=!1;#u=-1;#h=/* @__PURE__ */new Map;#f=!1;#g=!1;#w=!1;attach(t){super.attach(t);const i=this.disconnectSignal,n=t;n._activeEditRows=-1,n._rowEditSnapshots=/* @__PURE__ */new Map,Object.defineProperty(t,"changedRows",{get:()=>this.changedRows,configurable:!0}),Object.defineProperty(t,"changedRowIds",{get:()=>this.changedRowIds,configurable:!0}),t.resetChangedRows=e=>this.resetChangedRows(e),t.beginBulkEdit=(e,t)=>{t&&this.beginCellEdit(e,t)},document.addEventListener("keydown",e=>{if(!this.#t&&"Escape"===e.key&&-1!==this.#i){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}this.#v(this.#i,!0)}},{capture:!0,signal:i}),document.addEventListener("mousedown",e=>{if(this.#t)return;if(-1===this.#i)return;const t=n.findRenderedRowElement?.(this.#i);if(!t)return;if((e.composedPath&&e.composedPath()||[]).includes(t))return;const i=e.target;if(!i||!this.grid.containsFocus?.(i)){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}queueMicrotask(()=>{-1!==this.#i&&this.#v(this.#i,!1)})}},{signal:i}),this.config.focusTrap&&this.gridElement.addEventListener("focusout",e=>{if(this.#t)return;if(-1===this.#i)return;const t=e.relatedTarget;t&&this.grid.containsFocus?.(t)||t&&this.gridElement.contains(t)||queueMicrotask(()=>{-1!==this.#i&&this.#p()})},{signal:i}),this.gridElement.addEventListener("cell-change",e=>{const t=e.detail;if("user"===t.source)return;const i=`${t.rowIndex}:${t.field}`,n=this.#c.get(i);n&&n(t.newValue)},{signal:i}),this.#t&&(n._isGridEditMode=!0,this.gridElement.classList.add("tbw-grid-mode"),this.requestRender(),this.gridElement.addEventListener("focusin",t=>{const i=t.target;if(i.matches(e)){if(this.#g)return i.blur(),void this.gridElement.focus();this.#f=!0}},{signal:i}),this.gridElement.addEventListener("focusout",t=>{const i=t.relatedTarget;i&&(this.gridElement.contains(i)||this.grid.containsFocus?.(i))&&i.matches(e)||(this.#f=!1)},{signal:i}),this.gridElement.addEventListener("keydown",e=>{if("Escape"===e.key&&this.#f){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}const t=document.activeElement;t&&this.gridElement.contains(t)&&(t.blur(),this.gridElement.focus()),this.#f=!1,this.#g=!0,e.preventDefault(),e.stopPropagation()}},{capture:!0,signal:i}),this.gridElement.addEventListener("mousedown",t=>{t.target.matches(e)&&(this.#g=!1)},{signal:i}))}detach(){this.gridElement._isGridEditMode=!1,this.gridElement.classList.remove("tbw-grid-mode"),this.#i=-1,this.#n=void 0,this.#o=void 0,this.#r=-1,this.#s.clear(),this.#d.clear(),this.#l.clear(),this.#c.clear(),this.#f=!1,this.#g=!1,this.#w=!1,super.detach()}handleQuery(e){if("isEditing"===e.type)return this.#t||-1!==this.#i}onCellClick(e){if(this.#t)return!1;const t=this.grid,i=this.config.editOn??t.effectiveConfig?.editOn;if(!1===i||"manual"===i)return!1;if("click"!==i&&"dblclick"!==i)return!1;const n="dblclick"===e.originalEvent.type;if("click"===i&&n)return!1;if("dblclick"===i&&!n)return!1;const{rowIndex:o}=e,r=t._columns?.some(e=>e.editable);return!!r&&(e.originalEvent.stopPropagation(),this.beginBulkEdit(o),!0)}onKeyDown(e){const i=this.grid;if("Escape"===e.key){if(this.#t&&this.#f){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return!0}const t=document.activeElement;return t&&this.gridElement.contains(t)&&t.blur(),this.#f=!1,this.requestAfterRender(),!0}if(-1!==this.#i&&!this.#t){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return!0}return this.#v(this.#i,!0),!0}}if(this.#t&&!this.#f&&("ArrowUp"===e.key||"ArrowDown"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key))return!1;if(this.#t&&this.#f&&("ArrowUp"===e.key||"ArrowDown"===e.key))return!0;if(("ArrowUp"===e.key||"ArrowDown"===e.key)&&-1!==this.#i&&!this.#t){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return!0}const n=i._rows.length-1,o=this.#i;return this.#v(o,!1),"ArrowDown"===e.key?i._focusRow=Math.min(n,i._focusRow+1):i._focusRow=Math.max(0,i._focusRow-1),e.preventDefault(),t(i),this.requestAfterRender(),!0}if("Tab"===e.key&&(-1!==this.#i||this.#t)){if(e.preventDefault(),this.#w)return this.#v(this.#i,!1),!0;const t=!e.shiftKey;return this.#m(t),!0}if(" "===e.key||"Spacebar"===e.key){if(-1!==this.#i)return!1;const t=i._focusRow,n=i._focusCol;if(t>=0&&n>=0){const o=i._visibleColumns[n],r=i._rows[t];if(o?.editable&&"boolean"===o.type&&r){const i=o.field;if(s(i)){const n=!r[i];return this.#E(t,o,n,r),e.preventDefault(),this.requestRender(),!0}}}return!1}if(!("Enter"!==e.key||e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)){if(this.#t&&!this.#f)return this.#p(),!0;if(-1!==this.#i){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return!0}return!1}const t=this.config.editOn??i.effectiveConfig?.editOn;if(!1===t||"manual"===t)return!1;const n=i._focusRow,o=i._focusCol;if(n>=0){const t=i._columns?.some(e=>e.editable);if(t){const t=i._visibleColumns[o],r=i._rows[n],s=t?.field??"",d=s&&r?r[s]:void 0,l=this.gridElement.querySelector(`[data-row="${n}"][data-col="${o}"]`),c=new CustomEvent("cell-activate",{cancelable:!0,bubbles:!0,detail:{rowIndex:n,colIndex:o,field:s,value:d,row:r,cellEl:l,trigger:"keyboard",originalEvent:e}});this.gridElement.dispatchEvent(c);const a=new CustomEvent("activate-cell",{cancelable:!0,bubbles:!0,detail:{row:n,col:o}});return this.gridElement.dispatchEvent(a),c.defaultPrevented||a.defaultPrevented?(e.preventDefault(),!0):(this.beginBulkEdit(n),!0)}}return!1}if("F2"===e.key){if(-1!==this.#i||this.#t)return!1;if(!1===(this.config.editOn??i.effectiveConfig?.editOn))return!1;const t=i._focusRow,n=i._focusCol;if(t>=0&&n>=0){const o=i._visibleColumns[n];if(o?.editable&&o.field)return e.preventDefault(),this.beginCellEdit(t,o.field),!0}return!1}return!1}processColumns(e){const t=this.grid,i=t.effectiveConfig?.typeDefaults,n=t.__frameworkAdapter;return i||n?.getTypeDefault?e.map(e=>{if(!e.type)return e;let t;if(i?.[e.type]?.editorParams&&(t=i[e.type].editorParams),!t&&n?.getTypeDefault){const i=n.getTypeDefault(e.type);i?.editorParams&&(t=i.editorParams)}return t?{...e,editorParams:{...t,...e.editorParams}}:e}):e}afterRender(){const e=this.grid;if(this.#a&&(this.#a=!1,this.#b(e)),-1!==this.#u){const t=this.#u;this.#u=-1,e.animateRow?.(t,"change")}if(!this.#t&&0!==this.#l.size)for(const t of this.#l){const[i,n]=t.split(":"),o=parseInt(i,10),r=parseInt(n,10),s=e.findRenderedRowElement?.(o);if(!s)continue;const d=s.querySelector(`.cell[data-col="${r}"]`);if(!d||d.classList.contains("editing"))continue;const l=e._rows[o],c=e._visibleColumns[r];l&&c&&this.#R(l,o,c,r,d,!0)}}afterCellRender(e){if(!this.#t)return;const{row:t,rowIndex:i,column:n,colIndex:o,cellElement:r}=e;n.editable&&(r.classList.contains("editing")||this.#R(t,i,n,o,r,!0))}onScrollRender(){this.afterRender()}get changedRows(){const e=[];for(const t of this.#d){const i=this.grid.getRow(t);i&&e.push(i)}return e}get changedRowIds(){return Array.from(this.#d)}get activeEditRow(){return this.#i}get activeEditCol(){return this.#r}isRowEditing(e){return this.#i===e}isCellEditing(e,t){return this.#l.has(`${e}:${t}`)}isRowChanged(e){const t=this.grid,i=t._rows[e];if(!i)return!1;try{const e=t.getRowId?.(i);return!!e&&this.#d.has(e)}catch{return!1}}isRowChangedById(e){return this.#d.has(e)}setInvalid(e,t,i=""){let n=this.#h.get(e);n||(n=/* @__PURE__ */new Map,this.#h.set(e,n)),n.set(t,i),this.#y(e,t,!0)}clearInvalid(e,t){const i=this.#h.get(e);i&&(i.delete(t),0===i.size&&this.#h.delete(e)),this.#y(e,t,!1)}clearRowInvalid(e){const t=this.#h.get(e);if(t){const i=Array.from(t.keys());this.#h.delete(e),i.forEach(t=>this.#y(e,t,!1))}}clearAllInvalid(){const e=Array.from(this.#h.entries());this.#h.clear(),e.forEach(([e,t])=>{t.forEach((t,i)=>this.#y(e,i,!1))})}isCellInvalid(e,t){return this.#h.get(e)?.has(t)??!1}getInvalidMessage(e,t){return this.#h.get(e)?.get(t)}hasInvalidCells(e){const t=this.#h.get(e);return!!t&&t.size>0}getInvalidFields(e){return new Map(this.#h.get(e)??[])}#y(e,t,i){const n=this.grid,o=n._visibleColumns?.findIndex(e=>e.field===t);if(-1===o||void 0===o)return;const r=n._rows,s=r?.findIndex(t=>{try{return n.getRowId?.(t)===e}catch{return!1}});if(-1===s||void 0===s)return;const d=n.findRenderedRowElement?.(s),l=d?.querySelector(`.cell[data-col="${o}"]`);if(l)if(i){l.setAttribute("data-invalid","true");const i=this.#h.get(e)?.get(t);i&&l.setAttribute("title",i)}else l.removeAttribute("data-invalid"),l.removeAttribute("title")}resetChangedRows(e){const t=this.changedRows,i=this.changedRowIds;this.#d.clear(),this.#C(),e||this.emit("changed-rows-reset",{rows:t,ids:i});const n=this.grid;n._rowPool?.forEach(e=>e.classList.remove("changed"))}beginCellEdit(e,t){const i=this.grid,n=i._visibleColumns.findIndex(e=>e.field===t);if(-1===n)return;const o=i._visibleColumns[n];if(!o?.editable)return;const r=i.findRenderedRowElement?.(e),s=r?.querySelector(`.cell[data-col="${n}"]`);s&&(this.#w=!0,this.#_(e,n,s))}beginBulkEdit(t){const i=this.grid;if(!1===(this.config.editOn??i.effectiveConfig?.editOn))return;const n=i._columns?.some(e=>e.editable);if(!n)return;const o=i.findRenderedRowElement?.(t);if(!o)return;this.#w=!1;const r=i._rows[t];this.#I(t,r),Array.from(o.children).forEach((e,n)=>{const o=i._visibleColumns[n];if(o?.editable){const i=e;i.classList.contains("editing")||this.#R(r,t,o,n,i,!0)}}),setTimeout(()=>{let t=o.querySelector(`.cell[data-col="${i._focusCol}"]`);if(t?.classList.contains("editing")||(t=o.querySelector(".cell.editing")),t?.classList.contains("editing")){const i=t.querySelector(e);try{i?.focus({preventScroll:!0})}catch{}}},0)}commitActiveRowEdit(){-1!==this.#i&&this.#v(this.#i,!1)}cancelActiveRowEdit(){-1!==this.#i&&this.#v(this.#i,!0)}#_(e,t,i){const n=this.grid,o=n._rows[e],r=n._visibleColumns[t];o&&r?.editable&&(i.classList.contains("editing")||(this.#i!==e&&this.#I(e,o),this.#r=t,this.#R(o,e,r,t,i,!1)))}#p(){const t=this.grid,i=t._focusRow,n=t._focusCol;if(i<0||n<0)return;const o=t.findRenderedRowElement?.(i),r=o?.querySelector(`.cell[data-col="${n}"]`);if(r?.classList.contains("editing")){const t=r.querySelector(e);t&&(this.#g=!1,t.focus(),this.#f=!0,t instanceof HTMLInputElement&&("text"===t.type||"number"===t.type)&&t.select())}}#m(i){const n=this.grid,o=n._rows,r=this.#t?n._focusRow:this.#i,s=n._visibleColumns.map((e,t)=>e.editable?t:-1).filter(e=>e>=0);if(0===s.length)return;const d=s.indexOf(n._focusCol)+(i?1:-1);if(d>=0&&d<s.length){n._focusCol=s[d];const i=n.findRenderedRowElement?.(r),o=i?.querySelector(`.cell[data-col="${s[d]}"]`);if(o?.classList.contains("editing")){const t=o.querySelector(e);t?.focus({preventScroll:!0})}return void t(n,{forceHorizontalScroll:!0})}const l=r+(i?1:-1);l>=0&&l<o.length&&(this.#t?(n._focusRow=l,n._focusCol=i?s[0]:s[s.length-1],t(n,{forceHorizontalScroll:!0}),this.requestAfterRender(),setTimeout(()=>{const t=n.findRenderedRowElement?.(l),i=t?.querySelector(`.cell[data-col="${n._focusCol}"]`);if(i?.classList.contains("editing")){const t=i.querySelector(e);t?.focus({preventScroll:!0})}},0)):(this.#v(r,!1),n._focusRow=l,n._focusCol=i?s[0]:s[s.length-1],this.beginBulkEdit(l),t(n,{forceHorizontalScroll:!0})))}#C(){const e=this.grid;e._activeEditRows=this.#i,e._rowEditSnapshots=this.#s}#I(e,t){if(this.#i!==e){this.#s.set(e,{...t}),this.#i=e,this.#o=t;const i=this.grid;try{this.#n=i.getRowId?.(t)??void 0}catch{this.#n=void 0}this.#C(),this.#t||this.emit("edit-open",{rowIndex:e,rowId:this.#n??"",row:t})}}#v(e,t){if(this.#i!==e)return;const i=this.grid,n=this.#s.get(e),o=i.findRenderedRowElement?.(e);let r=this.#n;const s=r?i._getRowEntry(r):void 0,l=s?.row??this.#o??i._rows[e];if(!r&&l)try{r=i.getRowId?.(l)}catch{}if(!t&&o&&l){o.querySelectorAll(".cell.editing").forEach(t=>{const n=Number(t.getAttribute("data-col"));if(isNaN(n))return;const o=i._visibleColumns[n];if(!o)return;if(t.hasAttribute("data-editor-managed"))return;const r=t.querySelector("input,textarea,select");if(r){const t=o.field,i=l[t],n=d(r,o,i);i!==n&&this.#E(e,o,n,l)}})}if(t||this.#t||!l||this.emit("before-edit-close",{rowIndex:e,rowId:r??"",row:l}),t&&n&&l)Object.keys(n).forEach(e=>{l[e]=n[e]}),r&&(this.#d.delete(r),this.clearRowInvalid(r));else if(!t&&l){const t=this.#k(n,l),i=r?this.#d.has(r):t,o=this.emitCancelable("row-commit",{rowIndex:e,rowId:r??"",row:l,oldValue:n,newValue:l,changed:i,changedRows:this.changedRows,changedRowIds:this.changedRowIds});o&&n?(Object.keys(n).forEach(e=>{l[e]=n[e]}),r&&(this.#d.delete(r),this.clearRowInvalid(r))):!o&&t&&this.isAnimationEnabled&&(this.#u=e)}this.#s.delete(e),this.#i=-1,this.#n=void 0,this.#o=void 0,this.#r=-1,this.#w=!1,this.#C();for(const d of this.#l)d.startsWith(`${e}:`)&&this.#l.delete(d);for(const d of this.#c.keys())d.startsWith(`${e}:`)&&this.#c.delete(d);this.#a=!0,o?(o.querySelectorAll(".cell.editing").forEach(e=>{e.classList.remove("editing"),function(e){e.__editingCellCount=0,e.removeAttribute("data-has-editing")}(e.parentElement)}),i.refreshVirtualWindow(!0)):(this.#b(i),this.#a=!1),!this.#t&&l&&this.emit("edit-close",{rowIndex:e,rowId:r??"",row:l,reverted:t})}#E(e,t,i,n){const o=t.field;if(!s(o))return;const r=n[o];if(r===i)return;const d=this.grid;let c;try{c=this.grid.getRowId(n)}catch{}const a=!c||!this.#d.has(c),u=c?e=>this.grid.updateRow(c,e,"cascade"):l;let h=!1;const f=c?e=>{h=!0,this.setInvalid(c,o,e??"")}:()=>{};if(this.emitCancelable("cell-commit",{row:n,rowId:c??"",field:o,oldValue:r,value:i,rowIndex:e,changedRows:this.changedRows,changedRowIds:this.changedRowIds,firstTimeForRow:a,updateRow:u,setInvalid:f}))return;c&&!h&&this.isCellInvalid(c,o)&&this.clearInvalid(c,o),n[o]=i,c&&this.#d.add(c),this.#C(),this.emitPluginEvent("cell-edit-committed",{rowIndex:e,field:o,oldValue:r,newValue:i});const g=d.findRenderedRowElement?.(e);g&&g.classList.add("changed")}#R(t,i,n,o,c,a){if(!n.editable)return;if(c.classList.contains("editing"))return;let u;try{u=this.grid.getRowId(t)}catch{}const h=u?e=>this.grid.updateRow(u,e,"cascade"):l,f=s(n.field)?t[n.field]:void 0;c.classList.add("editing"),this.#l.add(`${i}:${o}`);const g=c.parentElement;g&&function(e){const t=(e.__editingCellCount??0)+1;e.__editingCellCount=t,e.setAttribute("data-has-editing","")}(g);let w=!1;const v=e=>{if(w||!this.#t&&-1===this.#i)return;const o=this.grid,r=u?o._getRowEntry(u):void 0,s=r?.row??t,d=r?.index??i;this.#E(d,n,e,s)},p=()=>{if(w=!0,s(n.field)){const e=this.grid,i=u?e._getRowEntry(u):void 0;(i?.row??t)[n.field]=f}},m=document.createElement("div");m.className="tbw-editor-host",c.innerHTML="",c.appendChild(m),m.addEventListener("keydown",e=>{if("Enter"===e.key){if(this.#t){e.stopPropagation(),e.preventDefault();const t=m.querySelector("input,textarea,select");return void(t&&v(d(t,n,f)))}if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}e.stopPropagation(),e.preventDefault(),w=!0,this.#v(i,!1)}if("Escape"===e.key){if(this.#t)return e.stopPropagation(),void e.preventDefault();if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(e))return}e.stopPropagation(),e.preventDefault(),p(),this.#v(i,!0)}});const E=n,b=E.__editorTemplate,R=function(e,t){if(t.editor)return t.editor;if(t.__editorTemplate)return"template";if(!t.type)return;const i=e.effectiveConfig?.typeDefaults;if(i?.[t.type]?.editor)return i[t.type].editor;const n=e.__frameworkAdapter;if(n?.getTypeDefault){const e=n.getTypeDefault(t.type);if(e?.editor)return e.editor}}(this.grid,E)??r(n),y=f,C=`${i}:${n.field}`,_=[];this.#c.set(C,e=>{for(const t of _)t(e)});const I=e=>{_.push(e)};if("template"===R&&b)this.#S(m,E,t,f,v,p,a,i),I(e=>{const t=m.querySelector("input,textarea,select");t&&(t instanceof HTMLInputElement&&"checkbox"===t.type?t.checked=!!e:t.value=String(e??""))});else if("string"==typeof R){const t=document.createElement(R);t.value=y,t.addEventListener("change",()=>v(t.value)),I(e=>{t.value=e}),m.appendChild(t),a||queueMicrotask(()=>{const t=m.querySelector(e);t?.focus({preventScroll:!0})})}else if("function"==typeof R){const i=R({row:t,rowId:u??"",value:y,field:n.field,column:n,commit:v,cancel:p,updateRow:h,onValueChange:I});if("string"==typeof i)m.innerHTML=i,function(e,t,i,n){const o=e.querySelector("input,textarea,select");o&&(o.addEventListener("blur",()=>{i(d(o,t,n))}),o instanceof HTMLInputElement&&"checkbox"===o.type?o.addEventListener("change",()=>i(o.checked)):o instanceof HTMLSelectElement&&o.addEventListener("change",()=>i(d(o,t,n))))}(m,n,v,f),I(e=>{const t=m.querySelector("input,textarea,select");t&&(t instanceof HTMLInputElement&&"checkbox"===t.type?t.checked=!!e:t.value=String(e??""))});else if(i instanceof Node){m.appendChild(i);i instanceof HTMLInputElement||i instanceof HTMLSelectElement||i instanceof HTMLTextAreaElement?I(e=>{i instanceof HTMLInputElement&&"checkbox"===i.type?i.checked=!!e:i.value=String(e??"")}):c.setAttribute("data-editor-managed","")}a||queueMicrotask(()=>{const t=m.querySelector(e);t?.focus({preventScroll:!0})})}else if(R&&"object"==typeof R){const e=document.createElement("div");e.setAttribute("data-external-editor",""),e.setAttribute("data-field",n.field),m.appendChild(e),c.setAttribute("data-editor-managed","");const i={row:t,rowId:u??"",value:y,field:n.field,column:n,commit:v,cancel:p,updateRow:h,onValueChange:I};if(R.mount)try{R.mount({placeholder:e,context:i,spec:R})}catch(k){console.warn(`[tbw-grid] External editor mount error for column '${n.field}':`,k)}else this.grid.dispatchEvent(new CustomEvent("mount-external-editor",{detail:{placeholder:e,spec:R,context:i}}))}}#S(e,t,i,n,o,r,l,c){const a=t.__editorTemplate;if(!a)return;const u=a.cloneNode(!0),h=t.__compiledEditor;h?u.innerHTML=h({row:i,value:n,field:t.field,column:t,commit:o,cancel:r}):u.querySelectorAll("*").forEach(e=>{1===e.childNodes.length&&e.firstChild?.nodeType===Node.TEXT_NODE&&(e.textContent=e.textContent?.replace(/{{\s*value\s*}}/g,null==n?"":String(n)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g,(e,t)=>{if(!s(t))return"";const n=i[t];return null==n?"":String(n)})||"")});const f=u.querySelector("input,textarea,select");if(f){f instanceof HTMLInputElement&&"checkbox"===f.type?f.checked=!!n:f.value=String(n??"");let e=!1;f.addEventListener("blur",()=>{e||o(d(f,t,n))}),f.addEventListener("keydown",i=>{const s=i;if("Enter"===s.key){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(s))return}s.stopPropagation(),s.preventDefault(),e=!0,o(d(f,t,n)),this.#v(c,!1)}if("Escape"===s.key){if(this.config.onBeforeEditClose){if(!1===this.config.onBeforeEditClose(s))return}s.stopPropagation(),s.preventDefault(),r(),this.#v(c,!0)}}),f instanceof HTMLInputElement&&"checkbox"===f.type&&f.addEventListener("change",()=>o(f.checked)),l||setTimeout(()=>f.focus({preventScroll:!0}),0)}e.appendChild(u)}#k(e,t){if(!e)return!1;const i=e,n=t,o=/* @__PURE__ */new Set([...Object.keys(i),...Object.keys(n)]);for(const r of o)if(i[r]!==n[r])return!0;return!1}#b(e){queueMicrotask(()=>{try{const t=e._focusRow,i=e._focusCol,n=e.findRenderedRowElement?.(t);if(n){Array.from(e._bodyEl.querySelectorAll(".cell-focus")).forEach(e=>e.classList.remove("cell-focus"));const o=n.querySelector(`.cell[data-row="${t}"][data-col="${i}"]`);o&&(o.classList.add("cell-focus"),o.setAttribute("aria-selected","true"),o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}))}}catch{}})}}export{c as EditingPlugin,r as defaultEditorFor};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|