@agile-team/mach-table 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # @agile-team/mach-table
6
6
 
7
- MachTable 0.30.0 的框架无关 TypeScript Core:零运行时依赖,提供行列双虚拟化、领域化 API、单元格/整行编辑、树与分组、随机访问远程数据、区段隔离状态持久化和可诊断扩展系统。本版增加可选服务端导出请求快照,不改变现有网格行为。
7
+ MachTable 0.31.0 的框架无关 TypeScript Core:零运行时依赖,提供行列双虚拟化、领域化 API、单元格/整行编辑、树与分组、随机访问远程数据、区段隔离状态持久化和可诊断扩展系统。本版增加可配置整行颜色、完善主题化行拖拽与键盘排序,并修正树交互与列宽拖动反馈。
8
8
 
9
9
  ```bash
10
10
  pnpm add @agile-team/mach-table
@@ -59,6 +59,25 @@ Vue/React 项目请只安装对应适配包,它会自动安装并重导出 Cor
59
59
  - [@agile-team/mach-table-vue](https://www.npmjs.com/package/@agile-team/mach-table-vue)
60
60
  - [@agile-team/mach-table-react](https://www.npmjs.com/package/@agile-team/mach-table-react)
61
61
 
62
+ ## 行拖拽与条件整行颜色
63
+
64
+ ```ts
65
+ import { dragColumn, type GridOptions } from "@agile-team/mach-table";
66
+
67
+ interface Plan { id: string; name: string; status: string }
68
+ const options: GridOptions<Plan> = {
69
+ rowKey: "id",
70
+ columnDefs: [dragColumn(), { field: "name" }, { field: "status" }],
71
+ rowStyleRules: [
72
+ { when: ({ data }) => data.status === "pending", tone: "warning" },
73
+ { when: ({ data }) => data.status === "failed", tone: "danger" },
74
+ { when: ({ data }) => data.status === "done", tone: "success" }
75
+ ]
76
+ };
77
+ ```
78
+
79
+ 状态码由应用定义,包内不识别业务状态。颜色规则取第一条命中结果,未命中时沿用默认样式;支持自定义背景/文字颜色、固定列、明暗主题、选择和虚拟行复用。拖拽提供主题手柄、落点线、位置浮层、边缘滚动、Esc 取消和 Alt + ↑/↓ 移动。扁平外部数据设置 `applyRowDrag: false`,由 `onRowDragEnd` 处理持久化;自动模式先完成移动再发出事件,使用 `targetIndex` 读取最终下标。树、分组及排序等自动模式限制见[完整配方](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/recipes/row-presentation.md)。
80
+
62
81
  文档:[快速开始](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/getting-started.md) · [企业接入](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/enterprise-integration.md) · [API](https://github.com/ChenyCHENYU/MachTable/tree/main/docs/api)
63
82
 
64
83
  Source-available © ChenyCHENYU (Agile Team). 任何使用均须事先取得书面授权。详见 [LICENSE](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSE) 与[授权流程](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSING.md)。
package/dist/adapter.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var x=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var ee=Object.prototype.hasOwnProperty;var te=(e,t)=>{for(var n in t)x(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X(t))!ee.call(e,i)&&i!==n&&x(e,i,{get:()=>t[i],enumerable:!(o=Q(t,i))||o.enumerable});return e};var oe=e=>ne(x({},"__esModule",{value:!0}),e);var me={};te(me,{GRID_OPTION_KEYS:()=>R,GRID_OPTION_META:()=>M,createSelectControl:()=>Y,mergeMachTableConfig:()=>_,normalizeMachTableConfig:()=>L,resolveMachTableGridOptions:()=>W});module.exports=oe(me);var M={columnDefs:{kind:"array",update:"columnDefs"},rowData:{kind:"array",update:"rowData"},defaultColDef:{kind:"object",update:"options"},columnTypes:{kind:"object",update:"options"},rowKey:{kind:"unknown",update:"options"},rowHeight:{kind:"number",update:"options"},headerHeight:{kind:"number",update:"options"},rowBuffer:{kind:"number",update:"options"},columnLayout:{kind:"string",update:"options"},enableColumnResize:{kind:"boolean",update:"options"},domLayout:{kind:"string",update:"options"},rowSelection:{kind:"string",update:"options"},multiSort:{kind:"boolean",update:"options"},size:{kind:"string",update:"options"},stripedRows:{kind:"boolean",update:"options"},showCellBorders:{kind:"boolean",update:"options"},theme:{kind:"string",update:"options"},quickFilterText:{kind:"string",update:"quickFilter"},advancedFilterModel:{kind:"object",update:"options"},masterDetail:{kind:"boolean",update:"options"},detailRowHeight:{kind:"number",update:"options"},detailRowRenderer:{kind:"function",update:"options"},isRowExpandable:{kind:"function",update:"options"},detailToggleColumn:{kind:"boolean",update:"options"},columnMenu:{kind:"boolean",update:"options"},aggFuncs:{kind:"object",update:"options"},components:{kind:"object",update:"options"},actionPolicy:{kind:"object",update:"options"},features:{kind:"array",update:"options"},initialState:{kind:"object",update:"options"},persistence:{kind:"boolean-object",update:"options"},locale:{kind:"object",update:"options"},editType:{kind:"string",update:"options"},editableIndicator:{kind:"string",update:"options"},rowEditValidator:{kind:"function",update:"options"},singleClickEdit:{kind:"boolean",update:"options"},manualSorting:{kind:"boolean",update:"options"},manualFiltering:{kind:"boolean",update:"options"},showSummary:{kind:"boolean",update:"options"},summaryMethod:{kind:"function",update:"options"},treeData:{kind:"boolean",update:"options"},childrenKey:{kind:"string",update:"options"},isTreeRowExpandable:{kind:"function",update:"options"},loadTreeChildren:{kind:"function",update:"options"},autoCheckedChildren:{kind:"boolean",update:"options"},defaultExpandAll:{kind:"boolean",update:"options"},indexOffset:{kind:"number",update:"options"},applyRowDrag:{kind:"boolean",update:"options"},undoStackSize:{kind:"number",update:"options"},asyncTransactionWaitMillis:{kind:"number",update:"options"},getRowHeight:{kind:"function",update:"options"},pinnedTopRowData:{kind:"array",update:"options"},pinnedBottomRowData:{kind:"array",update:"options"},pagination:{kind:"boolean-object",update:"options"},watermark:{kind:"boolean-object",update:"options"},suppressWarnings:{kind:"boolean",update:"options"},enableRangeSelection:{kind:"boolean",update:"options"},suppressClipboard:{kind:"boolean",update:"options"},contextMenu:{kind:"boolean",update:"options"},getContextMenuItems:{kind:"function",update:"options"},tooltipComponent:{kind:"function",update:"options"},tooltipShowDelay:{kind:"number",update:"options"},flashCells:{kind:"boolean",update:"options"},fillHandle:{kind:"boolean",update:"options"},statusBar:{kind:"boolean-object",update:"options"},datasource:{kind:"object",update:"options"},datasourceMode:{kind:"string",update:"options"},blockSize:{kind:"number",update:"options"},infiniteBufferRows:{kind:"number",update:"options"},maxBlocksInCache:{kind:"number",update:"options"},datasourceMaxConcurrentRequests:{kind:"number",update:"options"},blockPrefetch:{kind:"number",update:"options"},datasourceRowCount:{kind:"number",update:"options"},dataProcessor:{kind:"object",update:"options"},dataProcessorMinRows:{kind:"number",update:"options"},datasourceRetryCount:{kind:"number",update:"options"},datasourceRetryDelay:{kind:"number",update:"options"},datasourceRetryJitter:{kind:"number",update:"options"},suppressCellFocus:{kind:"boolean",update:"options"},suppressRowHoverHighlight:{kind:"boolean",update:"options"},suppressNoRowsOverlay:{kind:"boolean",update:"options"},suppressHeaderFocus:{kind:"boolean",update:"options"},ariaLabel:{kind:"string",update:"options"},ariaLabelledBy:{kind:"string",update:"options"},ariaDescribedBy:{kind:"string",update:"options"},loading:{kind:"boolean",update:"options"},error:{kind:"unknown",update:"options"},overlayNoRowsTemplate:{kind:"unknown",update:"options"},overlayLoadingTemplate:{kind:"unknown",update:"options"},overlayErrorTemplate:{kind:"unknown",update:"options"},allowUnsafeOverlayHtml:{kind:"boolean",update:"options"},className:{kind:"string",update:"options"}},R=Object.freeze(Object.keys(M)),ge=Object.freeze(R.filter(e=>M[e].update==="options"));function P(e,t){return t===void 0?e:typeof t!="object"||t===null||typeof e!="object"||e===null?t:{...e,...t}}function ae(e,t){return typeof e!="function"?t:typeof t!="function"?e:(...n)=>{let o;try{e(...n)}catch(i){o=i}try{t(...n)}catch(i){o??(o=i)}if(o!==void 0)throw o}}function ie(e,t){if(!(!e.components&&!t.components))return{cellRenderers:{...e.components?.cellRenderers,...t.components?.cellRenderers},cellEditors:{...e.components?.cellEditors,...t.components?.cellEditors}}}function re(e,t){if(!e.columnTypes&&!t.columnTypes)return;let n={},o=new Set([...Object.keys(e.columnTypes??{}),...Object.keys(t.columnTypes??{})]);for(let i of o)n[i]={...e.columnTypes?.[i],...t.columnTypes?.[i]};return n}function se(e,t,n){for(let o of new Set([...Object.keys(t),...Object.keys(n)])){if(!/^on[A-Z]/.test(o))continue;let i=t[o],p=n[o];typeof i!="function"||typeof p!="function"||(e[o]=ae(i,p))}}function le(e,t){let n={...e,...t,features:t.features??e.features};(e.defaultColDef||t.defaultColDef)&&(n.defaultColDef={...e.defaultColDef,...t.defaultColDef}),(e.locale||t.locale)&&(n.locale={...e.locale,...t.locale});let o=ie(e,t);o&&(n.components=o);let i=re(e,t);return i&&(n.columnTypes=i),(e.aggFuncs||t.aggFuncs)&&(n.aggFuncs={...e.aggFuncs,...t.aggFuncs}),n.pagination=P(e.pagination,t.pagination),n.statusBar=P(e.statusBar,t.statusBar),n.watermark=P(e.watermark,t.watermark),se(n,e,t),n}function C(...e){return e.reduce(le,{})}function de(e){return e?(Array.isArray(e)?e:[e]).filter(t=>typeof t=="string"&&t.trim().length>0):[]}var ce=new Set(["rowData","columnDefs","datasource","loading","error","initialState","persistence","components","columnTypes","stateKey","stateStore","stateSaveDebounceMs","columnStateKey","columnStateStore"]);function H(e,t,n){if(!t||typeof t!="object"||Array.isArray(t))return{};let o={};for(let[i,p]of Object.entries(t)){if(!ce.has(i)){o[i]=p;continue}let r={code:n==="defaults"?"INVALID_DEFAULT_OPTION":"INVALID_PRESET_OPTION",option:i,layer:n,message:`[MachTable] "${i}" is instance-only and cannot be declared in config ${n}.`};if(e.onConfigWarning?.(r),e.strict!==!1)throw new TypeError(r.message)}return o}function L(e={}){let t=H(e,e.defaults,"defaults");return{defaults:C({columnTypes:e.columnTypes,components:e.components},t),presets:Object.fromEntries(Object.entries(e.presets??{}).map(([n,o])=>[n,C(H(e,o,`preset:${n}`))])),defaultPreset:e.defaultPreset??!1,strict:e.strict!==!1,...e.onConfigWarning?{onConfigWarning:e.onConfigWarning}:{}}}function _(e,t){let n=L({...t,strict:t.strict??e.strict,onConfigWarning:t.onConfigWarning??e.onConfigWarning}),o={...e.presets};for(let[i,p]of Object.entries(n.presets))o[i]=C(e.presets[i]??{},p);return{defaults:C(e.defaults,n.defaults),presets:o,defaultPreset:t.defaultPreset===void 0?e.defaultPreset:t.defaultPreset,strict:t.strict??e.strict,...t.onConfigWarning??e.onConfigWarning?{onConfigWarning:t.onConfigWarning??e.onConfigWarning}:{}}}function W(e,t,n,o){let i=t===void 0?e.defaultPreset:t,p=[{name:"application defaults",options:e.defaults}];for(let s of de(i)){let f=e.presets[s];if(!f){let d={code:"UNKNOWN_PRESET",preset:s,message:`[MachTable] Unknown preset "${s}". Register it in mach-table.config.ts or remove the preset.`};o?o(d):e.onConfigWarning?e.onConfigWarning(d):console.warn(d.message);continue}p.push({name:`preset:${s}`,options:f})}p.push({name:"table props",options:n});let r=C(...p.map(s=>s.options));return{options:r,explain(s){let f=p.filter(b=>Object.prototype.hasOwnProperty.call(b.options,s)).map(b=>({name:b.name,value:b.options[s]})),d=f[f.length-1];return{key:s,value:r[s],source:d?.name??"MachTable built-in",layers:f}}}}function y(e,t,n){let o=document.createElement(e);if(t&&(o.className=t),n)for(let i of Object.keys(n))o.setAttribute(i,n[i]);return o}var pe=["--mach-font-family","--mach-font-size","--mach-font-size-sm","--mach-header-font-weight","--mach-cell-padding","--mach-header-h","--mach-primary","--mach-primary-weak","--mach-success","--mach-warning","--mach-danger","--mach-info","--mach-border-color","--mach-border-width","--mach-header-bg","--mach-header-fg","--mach-body-bg","--mach-body-fg","--mach-row-hover-bg","--mach-radius-sm","--mach-radius","--mach-radius-lg","--mach-shadow-sm","--mach-shadow","--mach-transition","--mach-z-popup","--mach-z-menu"];function K(e,t){if(e.classList.add("mach-portal"),!t)return;let n=window.getComputedStyle(t);for(let o of pe){let i=n.getPropertyValue(o).trim();i&&e.style.setProperty(o,i)}e.style.colorScheme=n.colorScheme}function z(e,t,n){return e<t?t:e>n?n:e}var B=0;function F(e="rg"){return B++,`${e}-${B}`}var m=null;function $(e){let t=e.target;m?.contains(t)||m?.close()}function S(){m?.reposition()}function U(e){e.key!=="Escape"||!m||(e.preventDefault(),e.stopImmediatePropagation(),m.close(!0))}function ue(e){m?.close!==e.close&&m?.close(),!m&&(m=e,document.addEventListener("mousedown",$,!0),document.addEventListener("keydown",U,!0),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0))}function fe(e){m?.close===e&&(m=null,document.removeEventListener("mousedown",$,!0),document.removeEventListener("keydown",U,!0),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0))}function k(e,t){return t?`${e} ${t}`:e}function E(e){let t=[];return e.forEach((n,o)=>{n.disabled||t.push(o)}),t}function V(e,t,n){let o=E(e);if(o.length===0)return-1;let i=o.indexOf(t);return i<0?n>0?o[0]:o[o.length-1]:o[Math.max(0,Math.min(o.length-1,i+n))]}function D(e,t){return e.findIndex(n=>n.value===t&&!n.disabled)}function Y(e){let t=y("div",k("mach-select-control",e.classNames?.root)),n=y("select",k("mach-select-native",e.classNames?.native));n.hidden=!0,n.tabIndex=-1,n.setAttribute("aria-hidden","true");let o=y("button",k("mach-select-trigger",e.classNames?.trigger));o.type="button",o.setAttribute("role","combobox"),o.setAttribute("aria-haspopup","listbox"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-label",e.ariaLabel);let i=y("span",k("mach-select-value",e.classNames?.value)),p=y("span",k("mach-select-caret",e.classNames?.caret));p.setAttribute("aria-hidden","true"),o.append(i,p);let r=y("div",k("mach-select-listbox",e.classNames?.listbox));r.id=F("mach-select-listbox"),r.setAttribute("role","listbox"),r.setAttribute("aria-hidden","true"),o.setAttribute("aria-controls",r.id),t.append(n,o);let s=[...e.options],f=[],d=-1,b=!1,q=()=>e.themeSource??t.closest(".mach-root")??t,v=()=>{let a=s.find(l=>l.value===n.value);i.textContent=a?.label??n.value,f.forEach((l,g)=>{let c=s[g]?.value===n.value;l.setAttribute("aria-selected",c?"true":"false"),l.classList.toggle("mach-select-option--selected",c),l.classList.toggle("mach-select-option--active",g===d)}),o.setAttribute("aria-activedescendant",d>=0?f[d]?.id??"":"")},G=()=>{let a=o.getBoundingClientRect(),l=r.getBoundingClientRect(),g=Math.max(a.width,l.width),c=z(a.left,8,Math.max(8,window.innerWidth-g-8)),O=window.innerHeight-a.bottom-8,T=O<Math.min(l.height,240)&&a.top>O,u=T?Math.max(8,a.top-l.height-5):Math.min(window.innerHeight-l.height-8,a.bottom+5);r.style.minWidth=`${a.width}px`,r.style.left=`${c}px`,r.style.top=`${Math.max(8,u)}px`,r.classList.toggle("mach-select-listbox--above",T)},h=(a=!1)=>r.classList.contains("mach-select-listbox--open")?(r.classList.remove("mach-select-listbox--open","mach-select-listbox--above"),r.setAttribute("aria-hidden","true"),o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant"),r.remove(),fe(h),a&&!b&&o.focus({preventScroll:!0}),!0):!1,J=(a,l=!0)=>{!s[a]||s[a].disabled||(d=a,v(),l&&f[a]?.scrollIntoView?.({block:"nearest"}))},w=()=>{b||o.disabled||r.classList.contains("mach-select-listbox--open")||(ue({close:h,contains:a=>t.contains(a)||r.contains(a),reposition:G}),d=D(s,n.value),d<0&&(d=E(s)[0]??-1),K(r,q()),document.body.appendChild(r),r.classList.add("mach-select-listbox--open"),r.setAttribute("aria-hidden","false"),o.setAttribute("aria-expanded","true"),G(),v(),f[d]?.scrollIntoView?.({block:"nearest"}))},N=a=>{let l=s[a];!l||l.disabled||(n.value=l.value,d=a,v(),h(!0),n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})))},A=(a,l)=>{s=[...a],n.replaceChildren(),r.replaceChildren(),f=s.map((c,O)=>{let T=document.createElement("option");T.value=c.value,T.textContent=c.label,T.disabled=c.disabled===!0,n.appendChild(T);let u=y("button",k("mach-select-option",e.classNames?.option));return u.id=`${r.id}-option-${O}`,u.type="button",u.tabIndex=-1,u.dataset.value=c.value,u.disabled=c.disabled===!0,u.setAttribute("role","option"),u.textContent=c.label,u.addEventListener("mousedown",Z=>Z.preventDefault()),u.addEventListener("click",()=>N(O)),r.appendChild(u),u});let g=s.find(c=>!c.disabled)?.value??"";n.value=l!=null&&s.some(c=>c.value===l)?l:g,d=D(s,n.value),v()},I=a=>{if(a.key==="Tab"){h();return}if(a.key==="Escape"){if(!h(!0))return;a.preventDefault(),a.stopPropagation();return}if(a.key==="Enter"||a.key===" "){a.preventDefault(),a.stopPropagation(),r.classList.contains("mach-select-listbox--open")?N(d):w();return}let l=d;if(a.key==="ArrowDown")l=V(s,d,1);else if(a.key==="ArrowUp")l=V(s,d,-1);else if(a.key==="Home")l=E(s)[0]??-1;else if(a.key==="End"){let g=E(s);l=g[g.length-1]??-1}else return;a.preventDefault(),a.stopPropagation(),r.classList.contains("mach-select-listbox--open")||w(),J(l)},j=()=>{d=D(s,n.value),v(),e.onChange?.(n.value)};return o.addEventListener("click",()=>{h()||w()}),o.addEventListener("keydown",I),n.addEventListener("change",j),A(s,e.value),{el:t,native:n,trigger:o,listbox:r,contains:a=>t.contains(a)||r.contains(a),isOpen:()=>r.classList.contains("mach-select-listbox--open"),open:w,close:h,focus:()=>o.focus({preventScroll:!0}),getValue:()=>n.value,setValue:a=>{n.value=a,d=D(s,a),v()},setOptions:A,destroy:()=>{b||(b=!0,h(),o.removeEventListener("keydown",I),n.removeEventListener("change",j),t.remove())}}}0&&(module.exports={GRID_OPTION_KEYS,GRID_OPTION_META,createSelectControl,mergeMachTableConfig,normalizeMachTableConfig,resolveMachTableGridOptions});
1
+ "use strict";var x=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var ee=Object.prototype.hasOwnProperty;var te=(e,t)=>{for(var n in t)x(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X(t))!ee.call(e,i)&&i!==n&&x(e,i,{get:()=>t[i],enumerable:!(o=Q(t,i))||o.enumerable});return e};var oe=e=>ne(x({},"__esModule",{value:!0}),e);var me={};te(me,{GRID_OPTION_KEYS:()=>R,GRID_OPTION_META:()=>M,createSelectControl:()=>Y,mergeMachTableConfig:()=>_,normalizeMachTableConfig:()=>L,resolveMachTableGridOptions:()=>W});module.exports=oe(me);var M={columnDefs:{kind:"array",update:"columnDefs"},rowData:{kind:"array",update:"rowData"},defaultColDef:{kind:"object",update:"options"},columnTypes:{kind:"object",update:"options"},rowKey:{kind:"unknown",update:"options"},rowHeight:{kind:"number",update:"options"},headerHeight:{kind:"number",update:"options"},rowBuffer:{kind:"number",update:"options"},columnLayout:{kind:"string",update:"options"},enableColumnResize:{kind:"boolean",update:"options"},domLayout:{kind:"string",update:"options"},rowSelection:{kind:"string",update:"options"},multiSort:{kind:"boolean",update:"options"},size:{kind:"string",update:"options"},stripedRows:{kind:"boolean",update:"options"},rowStyleRules:{kind:"array",update:"options"},showCellBorders:{kind:"boolean",update:"options"},theme:{kind:"string",update:"options"},quickFilterText:{kind:"string",update:"quickFilter"},advancedFilterModel:{kind:"object",update:"options"},masterDetail:{kind:"boolean",update:"options"},detailRowHeight:{kind:"number",update:"options"},detailRowRenderer:{kind:"function",update:"options"},isRowExpandable:{kind:"function",update:"options"},detailToggleColumn:{kind:"boolean",update:"options"},columnMenu:{kind:"boolean",update:"options"},aggFuncs:{kind:"object",update:"options"},components:{kind:"object",update:"options"},actionPolicy:{kind:"object",update:"options"},features:{kind:"array",update:"options"},initialState:{kind:"object",update:"options"},persistence:{kind:"boolean-object",update:"options"},locale:{kind:"object",update:"options"},editType:{kind:"string",update:"options"},editableIndicator:{kind:"string",update:"options"},rowEditValidator:{kind:"function",update:"options"},singleClickEdit:{kind:"boolean",update:"options"},manualSorting:{kind:"boolean",update:"options"},manualFiltering:{kind:"boolean",update:"options"},showSummary:{kind:"boolean",update:"options"},summaryMethod:{kind:"function",update:"options"},treeData:{kind:"boolean",update:"options"},childrenKey:{kind:"string",update:"options"},isTreeRowExpandable:{kind:"function",update:"options"},loadTreeChildren:{kind:"function",update:"options"},autoCheckedChildren:{kind:"boolean",update:"options"},defaultExpandAll:{kind:"boolean",update:"options"},indexOffset:{kind:"number",update:"options"},applyRowDrag:{kind:"boolean",update:"options"},undoStackSize:{kind:"number",update:"options"},asyncTransactionWaitMillis:{kind:"number",update:"options"},getRowHeight:{kind:"function",update:"options"},pinnedTopRowData:{kind:"array",update:"options"},pinnedBottomRowData:{kind:"array",update:"options"},pagination:{kind:"boolean-object",update:"options"},watermark:{kind:"boolean-object",update:"options"},suppressWarnings:{kind:"boolean",update:"options"},enableRangeSelection:{kind:"boolean",update:"options"},suppressClipboard:{kind:"boolean",update:"options"},contextMenu:{kind:"boolean",update:"options"},getContextMenuItems:{kind:"function",update:"options"},tooltipComponent:{kind:"function",update:"options"},tooltipShowDelay:{kind:"number",update:"options"},flashCells:{kind:"boolean",update:"options"},fillHandle:{kind:"boolean",update:"options"},statusBar:{kind:"boolean-object",update:"options"},datasource:{kind:"object",update:"options"},datasourceMode:{kind:"string",update:"options"},blockSize:{kind:"number",update:"options"},infiniteBufferRows:{kind:"number",update:"options"},maxBlocksInCache:{kind:"number",update:"options"},datasourceMaxConcurrentRequests:{kind:"number",update:"options"},blockPrefetch:{kind:"number",update:"options"},datasourceRowCount:{kind:"number",update:"options"},dataProcessor:{kind:"object",update:"options"},dataProcessorMinRows:{kind:"number",update:"options"},datasourceRetryCount:{kind:"number",update:"options"},datasourceRetryDelay:{kind:"number",update:"options"},datasourceRetryJitter:{kind:"number",update:"options"},suppressCellFocus:{kind:"boolean",update:"options"},suppressRowHoverHighlight:{kind:"boolean",update:"options"},suppressNoRowsOverlay:{kind:"boolean",update:"options"},suppressHeaderFocus:{kind:"boolean",update:"options"},ariaLabel:{kind:"string",update:"options"},ariaLabelledBy:{kind:"string",update:"options"},ariaDescribedBy:{kind:"string",update:"options"},loading:{kind:"boolean",update:"options"},error:{kind:"unknown",update:"options"},overlayNoRowsTemplate:{kind:"unknown",update:"options"},overlayLoadingTemplate:{kind:"unknown",update:"options"},overlayErrorTemplate:{kind:"unknown",update:"options"},allowUnsafeOverlayHtml:{kind:"boolean",update:"options"},className:{kind:"string",update:"options"}},R=Object.freeze(Object.keys(M)),ge=Object.freeze(R.filter(e=>M[e].update==="options"));function P(e,t){return t===void 0?e:typeof t!="object"||t===null||typeof e!="object"||e===null?t:{...e,...t}}function ae(e,t){return typeof e!="function"?t:typeof t!="function"?e:(...n)=>{let o;try{e(...n)}catch(i){o=i}try{t(...n)}catch(i){o??(o=i)}if(o!==void 0)throw o}}function ie(e,t){if(!(!e.components&&!t.components))return{cellRenderers:{...e.components?.cellRenderers,...t.components?.cellRenderers},cellEditors:{...e.components?.cellEditors,...t.components?.cellEditors}}}function re(e,t){if(!e.columnTypes&&!t.columnTypes)return;let n={},o=new Set([...Object.keys(e.columnTypes??{}),...Object.keys(t.columnTypes??{})]);for(let i of o)n[i]={...e.columnTypes?.[i],...t.columnTypes?.[i]};return n}function se(e,t,n){for(let o of new Set([...Object.keys(t),...Object.keys(n)])){if(!/^on[A-Z]/.test(o))continue;let i=t[o],p=n[o];typeof i!="function"||typeof p!="function"||(e[o]=ae(i,p))}}function le(e,t){let n={...e,...t,features:t.features??e.features};(e.defaultColDef||t.defaultColDef)&&(n.defaultColDef={...e.defaultColDef,...t.defaultColDef}),(e.locale||t.locale)&&(n.locale={...e.locale,...t.locale});let o=ie(e,t);o&&(n.components=o);let i=re(e,t);return i&&(n.columnTypes=i),(e.aggFuncs||t.aggFuncs)&&(n.aggFuncs={...e.aggFuncs,...t.aggFuncs}),n.pagination=P(e.pagination,t.pagination),n.statusBar=P(e.statusBar,t.statusBar),n.watermark=P(e.watermark,t.watermark),se(n,e,t),n}function C(...e){return e.reduce(le,{})}function de(e){return e?(Array.isArray(e)?e:[e]).filter(t=>typeof t=="string"&&t.trim().length>0):[]}var ce=new Set(["rowData","columnDefs","datasource","loading","error","initialState","persistence","components","columnTypes","stateKey","stateStore","stateSaveDebounceMs","columnStateKey","columnStateStore"]);function H(e,t,n){if(!t||typeof t!="object"||Array.isArray(t))return{};let o={};for(let[i,p]of Object.entries(t)){if(!ce.has(i)){o[i]=p;continue}let r={code:n==="defaults"?"INVALID_DEFAULT_OPTION":"INVALID_PRESET_OPTION",option:i,layer:n,message:`[MachTable] "${i}" is instance-only and cannot be declared in config ${n}.`};if(e.onConfigWarning?.(r),e.strict!==!1)throw new TypeError(r.message)}return o}function L(e={}){let t=H(e,e.defaults,"defaults");return{defaults:C({columnTypes:e.columnTypes,components:e.components},t),presets:Object.fromEntries(Object.entries(e.presets??{}).map(([n,o])=>[n,C(H(e,o,`preset:${n}`))])),defaultPreset:e.defaultPreset??!1,strict:e.strict!==!1,...e.onConfigWarning?{onConfigWarning:e.onConfigWarning}:{}}}function _(e,t){let n=L({...t,strict:t.strict??e.strict,onConfigWarning:t.onConfigWarning??e.onConfigWarning}),o={...e.presets};for(let[i,p]of Object.entries(n.presets))o[i]=C(e.presets[i]??{},p);return{defaults:C(e.defaults,n.defaults),presets:o,defaultPreset:t.defaultPreset===void 0?e.defaultPreset:t.defaultPreset,strict:t.strict??e.strict,...t.onConfigWarning??e.onConfigWarning?{onConfigWarning:t.onConfigWarning??e.onConfigWarning}:{}}}function W(e,t,n,o){let i=t===void 0?e.defaultPreset:t,p=[{name:"application defaults",options:e.defaults}];for(let s of de(i)){let f=e.presets[s];if(!f){let d={code:"UNKNOWN_PRESET",preset:s,message:`[MachTable] Unknown preset "${s}". Register it in mach-table.config.ts or remove the preset.`};o?o(d):e.onConfigWarning?e.onConfigWarning(d):console.warn(d.message);continue}p.push({name:`preset:${s}`,options:f})}p.push({name:"table props",options:n});let r=C(...p.map(s=>s.options));return{options:r,explain(s){let f=p.filter(b=>Object.prototype.hasOwnProperty.call(b.options,s)).map(b=>({name:b.name,value:b.options[s]})),d=f[f.length-1];return{key:s,value:r[s],source:d?.name??"MachTable built-in",layers:f}}}}function y(e,t,n){let o=document.createElement(e);if(t&&(o.className=t),n)for(let i of Object.keys(n))o.setAttribute(i,n[i]);return o}var pe=["--mach-font-family","--mach-font-size","--mach-font-size-sm","--mach-header-font-weight","--mach-cell-padding","--mach-header-h","--mach-primary","--mach-primary-weak","--mach-success","--mach-warning","--mach-danger","--mach-info","--mach-border-color","--mach-border-width","--mach-header-bg","--mach-header-fg","--mach-body-bg","--mach-body-fg","--mach-row-hover-bg","--mach-radius-sm","--mach-radius","--mach-radius-lg","--mach-shadow-sm","--mach-shadow","--mach-transition","--mach-z-popup","--mach-z-menu"];function K(e,t){if(e.classList.add("mach-portal"),!t)return;let n=window.getComputedStyle(t);for(let o of pe){let i=n.getPropertyValue(o).trim();i&&e.style.setProperty(o,i)}e.style.colorScheme=n.colorScheme}function z(e,t,n){return e<t?t:e>n?n:e}var B=0;function F(e="rg"){return B++,`${e}-${B}`}var m=null;function $(e){let t=e.target;m?.contains(t)||m?.close()}function S(){m?.reposition()}function U(e){e.key!=="Escape"||!m||(e.preventDefault(),e.stopImmediatePropagation(),m.close(!0))}function ue(e){m?.close!==e.close&&m?.close(),!m&&(m=e,document.addEventListener("mousedown",$,!0),document.addEventListener("keydown",U,!0),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0))}function fe(e){m?.close===e&&(m=null,document.removeEventListener("mousedown",$,!0),document.removeEventListener("keydown",U,!0),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0))}function k(e,t){return t?`${e} ${t}`:e}function E(e){let t=[];return e.forEach((n,o)=>{n.disabled||t.push(o)}),t}function V(e,t,n){let o=E(e);if(o.length===0)return-1;let i=o.indexOf(t);return i<0?n>0?o[0]:o[o.length-1]:o[Math.max(0,Math.min(o.length-1,i+n))]}function D(e,t){return e.findIndex(n=>n.value===t&&!n.disabled)}function Y(e){let t=y("div",k("mach-select-control",e.classNames?.root)),n=y("select",k("mach-select-native",e.classNames?.native));n.hidden=!0,n.tabIndex=-1,n.setAttribute("aria-hidden","true");let o=y("button",k("mach-select-trigger",e.classNames?.trigger));o.type="button",o.setAttribute("role","combobox"),o.setAttribute("aria-haspopup","listbox"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-label",e.ariaLabel);let i=y("span",k("mach-select-value",e.classNames?.value)),p=y("span",k("mach-select-caret",e.classNames?.caret));p.setAttribute("aria-hidden","true"),o.append(i,p);let r=y("div",k("mach-select-listbox",e.classNames?.listbox));r.id=F("mach-select-listbox"),r.setAttribute("role","listbox"),r.setAttribute("aria-hidden","true"),o.setAttribute("aria-controls",r.id),t.append(n,o);let s=[...e.options],f=[],d=-1,b=!1,q=()=>e.themeSource??t.closest(".mach-root")??t,v=()=>{let a=s.find(l=>l.value===n.value);i.textContent=a?.label??n.value,f.forEach((l,g)=>{let c=s[g]?.value===n.value;l.setAttribute("aria-selected",c?"true":"false"),l.classList.toggle("mach-select-option--selected",c),l.classList.toggle("mach-select-option--active",g===d)}),o.setAttribute("aria-activedescendant",d>=0?f[d]?.id??"":"")},G=()=>{let a=o.getBoundingClientRect(),l=r.getBoundingClientRect(),g=Math.max(a.width,l.width),c=z(a.left,8,Math.max(8,window.innerWidth-g-8)),w=window.innerHeight-a.bottom-8,T=w<Math.min(l.height,240)&&a.top>w,u=T?Math.max(8,a.top-l.height-5):Math.min(window.innerHeight-l.height-8,a.bottom+5);r.style.minWidth=`${a.width}px`,r.style.left=`${c}px`,r.style.top=`${Math.max(8,u)}px`,r.classList.toggle("mach-select-listbox--above",T)},h=(a=!1)=>r.classList.contains("mach-select-listbox--open")?(r.classList.remove("mach-select-listbox--open","mach-select-listbox--above"),r.setAttribute("aria-hidden","true"),o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant"),r.remove(),fe(h),a&&!b&&o.focus({preventScroll:!0}),!0):!1,J=(a,l=!0)=>{!s[a]||s[a].disabled||(d=a,v(),l&&f[a]?.scrollIntoView?.({block:"nearest"}))},O=()=>{b||o.disabled||r.classList.contains("mach-select-listbox--open")||(ue({close:h,contains:a=>t.contains(a)||r.contains(a),reposition:G}),d=D(s,n.value),d<0&&(d=E(s)[0]??-1),K(r,q()),document.body.appendChild(r),r.classList.add("mach-select-listbox--open"),r.setAttribute("aria-hidden","false"),o.setAttribute("aria-expanded","true"),G(),v(),f[d]?.scrollIntoView?.({block:"nearest"}))},N=a=>{let l=s[a];!l||l.disabled||(n.value=l.value,d=a,v(),h(!0),n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})))},A=(a,l)=>{s=[...a],n.replaceChildren(),r.replaceChildren(),f=s.map((c,w)=>{let T=document.createElement("option");T.value=c.value,T.textContent=c.label,T.disabled=c.disabled===!0,n.appendChild(T);let u=y("button",k("mach-select-option",e.classNames?.option));return u.id=`${r.id}-option-${w}`,u.type="button",u.tabIndex=-1,u.dataset.value=c.value,u.disabled=c.disabled===!0,u.setAttribute("role","option"),u.textContent=c.label,u.addEventListener("mousedown",Z=>Z.preventDefault()),u.addEventListener("click",()=>N(w)),r.appendChild(u),u});let g=s.find(c=>!c.disabled)?.value??"";n.value=l!=null&&s.some(c=>c.value===l)?l:g,d=D(s,n.value),v()},I=a=>{if(a.key==="Tab"){h();return}if(a.key==="Escape"){if(!h(!0))return;a.preventDefault(),a.stopPropagation();return}if(a.key==="Enter"||a.key===" "){a.preventDefault(),a.stopPropagation(),r.classList.contains("mach-select-listbox--open")?N(d):O();return}let l=d;if(a.key==="ArrowDown")l=V(s,d,1);else if(a.key==="ArrowUp")l=V(s,d,-1);else if(a.key==="Home")l=E(s)[0]??-1;else if(a.key==="End"){let g=E(s);l=g[g.length-1]??-1}else return;a.preventDefault(),a.stopPropagation(),r.classList.contains("mach-select-listbox--open")||O(),J(l)},j=()=>{d=D(s,n.value),v(),e.onChange?.(n.value)};return o.addEventListener("click",()=>{h()||O()}),o.addEventListener("keydown",I),n.addEventListener("change",j),A(s,e.value),{el:t,native:n,trigger:o,listbox:r,contains:a=>t.contains(a)||r.contains(a),isOpen:()=>r.classList.contains("mach-select-listbox--open"),open:O,close:h,focus:()=>o.focus({preventScroll:!0}),getValue:()=>n.value,setValue:a=>{n.value=a,d=D(s,a),v()},setOptions:A,destroy:()=>{b||(b=!0,h(),o.removeEventListener("keydown",I),n.removeEventListener("change",j),t.remove())}}}0&&(module.exports={GRID_OPTION_KEYS,GRID_OPTION_META,createSelectControl,mergeMachTableConfig,normalizeMachTableConfig,resolveMachTableGridOptions});
@@ -1,5 +1,5 @@
1
- import { G as GridOptions, b as GridEventType } from './options-Cc31xFVh.cjs';
2
- export { M as MachTableOptionExplanation, R as ResolvedMachTableConfig, a as ResolvedMachTableGridOptions, m as mergeMachTableConfig, n as normalizeMachTableConfig, r as resolveMachTableGridOptions } from './configuration-DJ5waD96.cjs';
1
+ import { G as GridOptions, b as GridEventType } from './options-Bi_m5kXL.cjs';
2
+ export { M as MachTableOptionExplanation, R as ResolvedMachTableConfig, a as ResolvedMachTableGridOptions, m as mergeMachTableConfig, n as normalizeMachTableConfig, r as resolveMachTableGridOptions } from './configuration-Bj_JwdTd.cjs';
3
3
 
4
4
  type EventOptionKey = `on${Capitalize<GridEventType>}`;
5
5
  type GridOptionKey = Exclude<keyof GridOptions<any>, EventOptionKey>;
@@ -70,6 +70,10 @@ declare const GRID_OPTION_META: {
70
70
  readonly kind: "boolean";
71
71
  readonly update: "options";
72
72
  };
73
+ readonly rowStyleRules: {
74
+ readonly kind: "array";
75
+ readonly update: "options";
76
+ };
73
77
  readonly showCellBorders: {
74
78
  readonly kind: "boolean";
75
79
  readonly update: "options";
package/dist/adapter.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { G as GridOptions, b as GridEventType } from './options-Cc31xFVh.js';
2
- export { M as MachTableOptionExplanation, R as ResolvedMachTableConfig, a as ResolvedMachTableGridOptions, m as mergeMachTableConfig, n as normalizeMachTableConfig, r as resolveMachTableGridOptions } from './configuration-Y9frPvJi.js';
1
+ import { G as GridOptions, b as GridEventType } from './options-Bi_m5kXL.js';
2
+ export { M as MachTableOptionExplanation, R as ResolvedMachTableConfig, a as ResolvedMachTableGridOptions, m as mergeMachTableConfig, n as normalizeMachTableConfig, r as resolveMachTableGridOptions } from './configuration-C9KYeIy1.js';
3
3
 
4
4
  type EventOptionKey = `on${Capitalize<GridEventType>}`;
5
5
  type GridOptionKey = Exclude<keyof GridOptions<any>, EventOptionKey>;
@@ -70,6 +70,10 @@ declare const GRID_OPTION_META: {
70
70
  readonly kind: "boolean";
71
71
  readonly update: "options";
72
72
  };
73
+ readonly rowStyleRules: {
74
+ readonly kind: "array";
75
+ readonly update: "options";
76
+ };
73
77
  readonly showCellBorders: {
74
78
  readonly kind: "boolean";
75
79
  readonly update: "options";
package/dist/adapter.js CHANGED
@@ -1 +1 @@
1
- var S={columnDefs:{kind:"array",update:"columnDefs"},rowData:{kind:"array",update:"rowData"},defaultColDef:{kind:"object",update:"options"},columnTypes:{kind:"object",update:"options"},rowKey:{kind:"unknown",update:"options"},rowHeight:{kind:"number",update:"options"},headerHeight:{kind:"number",update:"options"},rowBuffer:{kind:"number",update:"options"},columnLayout:{kind:"string",update:"options"},enableColumnResize:{kind:"boolean",update:"options"},domLayout:{kind:"string",update:"options"},rowSelection:{kind:"string",update:"options"},multiSort:{kind:"boolean",update:"options"},size:{kind:"string",update:"options"},stripedRows:{kind:"boolean",update:"options"},showCellBorders:{kind:"boolean",update:"options"},theme:{kind:"string",update:"options"},quickFilterText:{kind:"string",update:"quickFilter"},advancedFilterModel:{kind:"object",update:"options"},masterDetail:{kind:"boolean",update:"options"},detailRowHeight:{kind:"number",update:"options"},detailRowRenderer:{kind:"function",update:"options"},isRowExpandable:{kind:"function",update:"options"},detailToggleColumn:{kind:"boolean",update:"options"},columnMenu:{kind:"boolean",update:"options"},aggFuncs:{kind:"object",update:"options"},components:{kind:"object",update:"options"},actionPolicy:{kind:"object",update:"options"},features:{kind:"array",update:"options"},initialState:{kind:"object",update:"options"},persistence:{kind:"boolean-object",update:"options"},locale:{kind:"object",update:"options"},editType:{kind:"string",update:"options"},editableIndicator:{kind:"string",update:"options"},rowEditValidator:{kind:"function",update:"options"},singleClickEdit:{kind:"boolean",update:"options"},manualSorting:{kind:"boolean",update:"options"},manualFiltering:{kind:"boolean",update:"options"},showSummary:{kind:"boolean",update:"options"},summaryMethod:{kind:"function",update:"options"},treeData:{kind:"boolean",update:"options"},childrenKey:{kind:"string",update:"options"},isTreeRowExpandable:{kind:"function",update:"options"},loadTreeChildren:{kind:"function",update:"options"},autoCheckedChildren:{kind:"boolean",update:"options"},defaultExpandAll:{kind:"boolean",update:"options"},indexOffset:{kind:"number",update:"options"},applyRowDrag:{kind:"boolean",update:"options"},undoStackSize:{kind:"number",update:"options"},asyncTransactionWaitMillis:{kind:"number",update:"options"},getRowHeight:{kind:"function",update:"options"},pinnedTopRowData:{kind:"array",update:"options"},pinnedBottomRowData:{kind:"array",update:"options"},pagination:{kind:"boolean-object",update:"options"},watermark:{kind:"boolean-object",update:"options"},suppressWarnings:{kind:"boolean",update:"options"},enableRangeSelection:{kind:"boolean",update:"options"},suppressClipboard:{kind:"boolean",update:"options"},contextMenu:{kind:"boolean",update:"options"},getContextMenuItems:{kind:"function",update:"options"},tooltipComponent:{kind:"function",update:"options"},tooltipShowDelay:{kind:"number",update:"options"},flashCells:{kind:"boolean",update:"options"},fillHandle:{kind:"boolean",update:"options"},statusBar:{kind:"boolean-object",update:"options"},datasource:{kind:"object",update:"options"},datasourceMode:{kind:"string",update:"options"},blockSize:{kind:"number",update:"options"},infiniteBufferRows:{kind:"number",update:"options"},maxBlocksInCache:{kind:"number",update:"options"},datasourceMaxConcurrentRequests:{kind:"number",update:"options"},blockPrefetch:{kind:"number",update:"options"},datasourceRowCount:{kind:"number",update:"options"},dataProcessor:{kind:"object",update:"options"},dataProcessorMinRows:{kind:"number",update:"options"},datasourceRetryCount:{kind:"number",update:"options"},datasourceRetryDelay:{kind:"number",update:"options"},datasourceRetryJitter:{kind:"number",update:"options"},suppressCellFocus:{kind:"boolean",update:"options"},suppressRowHoverHighlight:{kind:"boolean",update:"options"},suppressNoRowsOverlay:{kind:"boolean",update:"options"},suppressHeaderFocus:{kind:"boolean",update:"options"},ariaLabel:{kind:"string",update:"options"},ariaLabelledBy:{kind:"string",update:"options"},ariaDescribedBy:{kind:"string",update:"options"},loading:{kind:"boolean",update:"options"},error:{kind:"unknown",update:"options"},overlayNoRowsTemplate:{kind:"unknown",update:"options"},overlayLoadingTemplate:{kind:"unknown",update:"options"},overlayErrorTemplate:{kind:"unknown",update:"options"},allowUnsafeOverlayHtml:{kind:"boolean",update:"options"},className:{kind:"string",update:"options"}},A=Object.freeze(Object.keys(S)),se=Object.freeze(A.filter(e=>S[e].update==="options"));function x(e,t){return t===void 0?e:typeof t!="object"||t===null||typeof e!="object"||e===null?t:{...e,...t}}function Y(e,t){return typeof e!="function"?t:typeof t!="function"?e:(...n)=>{let o;try{e(...n)}catch(i){o=i}try{t(...n)}catch(i){o??(o=i)}if(o!==void 0)throw o}}function q(e,t){if(!(!e.components&&!t.components))return{cellRenderers:{...e.components?.cellRenderers,...t.components?.cellRenderers},cellEditors:{...e.components?.cellEditors,...t.components?.cellEditors}}}function J(e,t){if(!e.columnTypes&&!t.columnTypes)return;let n={},o=new Set([...Object.keys(e.columnTypes??{}),...Object.keys(t.columnTypes??{})]);for(let i of o)n[i]={...e.columnTypes?.[i],...t.columnTypes?.[i]};return n}function Z(e,t,n){for(let o of new Set([...Object.keys(t),...Object.keys(n)])){if(!/^on[A-Z]/.test(o))continue;let i=t[o],p=n[o];typeof i!="function"||typeof p!="function"||(e[o]=Y(i,p))}}function Q(e,t){let n={...e,...t,features:t.features??e.features};(e.defaultColDef||t.defaultColDef)&&(n.defaultColDef={...e.defaultColDef,...t.defaultColDef}),(e.locale||t.locale)&&(n.locale={...e.locale,...t.locale});let o=q(e,t);o&&(n.components=o);let i=J(e,t);return i&&(n.columnTypes=i),(e.aggFuncs||t.aggFuncs)&&(n.aggFuncs={...e.aggFuncs,...t.aggFuncs}),n.pagination=x(e.pagination,t.pagination),n.statusBar=x(e.statusBar,t.statusBar),n.watermark=x(e.watermark,t.watermark),Z(n,e,t),n}function C(...e){return e.reduce(Q,{})}function X(e){return e?(Array.isArray(e)?e:[e]).filter(t=>typeof t=="string"&&t.trim().length>0):[]}var ee=new Set(["rowData","columnDefs","datasource","loading","error","initialState","persistence","components","columnTypes","stateKey","stateStore","stateSaveDebounceMs","columnStateKey","columnStateStore"]);function I(e,t,n){if(!t||typeof t!="object"||Array.isArray(t))return{};let o={};for(let[i,p]of Object.entries(t)){if(!ee.has(i)){o[i]=p;continue}let r={code:n==="defaults"?"INVALID_DEFAULT_OPTION":"INVALID_PRESET_OPTION",option:i,layer:n,message:`[MachTable] "${i}" is instance-only and cannot be declared in config ${n}.`};if(e.onConfigWarning?.(r),e.strict!==!1)throw new TypeError(r.message)}return o}function j(e={}){let t=I(e,e.defaults,"defaults");return{defaults:C({columnTypes:e.columnTypes,components:e.components},t),presets:Object.fromEntries(Object.entries(e.presets??{}).map(([n,o])=>[n,C(I(e,o,`preset:${n}`))])),defaultPreset:e.defaultPreset??!1,strict:e.strict!==!1,...e.onConfigWarning?{onConfigWarning:e.onConfigWarning}:{}}}function te(e,t){let n=j({...t,strict:t.strict??e.strict,onConfigWarning:t.onConfigWarning??e.onConfigWarning}),o={...e.presets};for(let[i,p]of Object.entries(n.presets))o[i]=C(e.presets[i]??{},p);return{defaults:C(e.defaults,n.defaults),presets:o,defaultPreset:t.defaultPreset===void 0?e.defaultPreset:t.defaultPreset,strict:t.strict??e.strict,...t.onConfigWarning??e.onConfigWarning?{onConfigWarning:t.onConfigWarning??e.onConfigWarning}:{}}}function ne(e,t,n,o){let i=t===void 0?e.defaultPreset:t,p=[{name:"application defaults",options:e.defaults}];for(let s of X(i)){let f=e.presets[s];if(!f){let d={code:"UNKNOWN_PRESET",preset:s,message:`[MachTable] Unknown preset "${s}". Register it in mach-table.config.ts or remove the preset.`};o?o(d):e.onConfigWarning?e.onConfigWarning(d):console.warn(d.message);continue}p.push({name:`preset:${s}`,options:f})}p.push({name:"table props",options:n});let r=C(...p.map(s=>s.options));return{options:r,explain(s){let f=p.filter(b=>Object.prototype.hasOwnProperty.call(b.options,s)).map(b=>({name:b.name,value:b.options[s]})),d=f[f.length-1];return{key:s,value:r[s],source:d?.name??"MachTable built-in",layers:f}}}}function y(e,t,n){let o=document.createElement(e);if(t&&(o.className=t),n)for(let i of Object.keys(n))o.setAttribute(i,n[i]);return o}var oe=["--mach-font-family","--mach-font-size","--mach-font-size-sm","--mach-header-font-weight","--mach-cell-padding","--mach-header-h","--mach-primary","--mach-primary-weak","--mach-success","--mach-warning","--mach-danger","--mach-info","--mach-border-color","--mach-border-width","--mach-header-bg","--mach-header-fg","--mach-body-bg","--mach-body-fg","--mach-row-hover-bg","--mach-radius-sm","--mach-radius","--mach-radius-lg","--mach-shadow-sm","--mach-shadow","--mach-transition","--mach-z-popup","--mach-z-menu"];function _(e,t){if(e.classList.add("mach-portal"),!t)return;let n=window.getComputedStyle(t);for(let o of oe){let i=n.getPropertyValue(o).trim();i&&e.style.setProperty(o,i)}e.style.colorScheme=n.colorScheme}function W(e,t,n){return e<t?t:e>n?n:e}var H=0;function B(e="rg"){return H++,`${e}-${H}`}var m=null;function z(e){let t=e.target;m?.contains(t)||m?.close()}function E(){m?.reposition()}function F(e){e.key!=="Escape"||!m||(e.preventDefault(),e.stopImmediatePropagation(),m.close(!0))}function ae(e){m?.close!==e.close&&m?.close(),!m&&(m=e,document.addEventListener("mousedown",z,!0),document.addEventListener("keydown",F,!0),window.addEventListener("resize",E),window.addEventListener("scroll",E,!0))}function ie(e){m?.close===e&&(m=null,document.removeEventListener("mousedown",z,!0),document.removeEventListener("keydown",F,!0),window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0))}function k(e,t){return t?`${e} ${t}`:e}function D(e){let t=[];return e.forEach((n,o)=>{n.disabled||t.push(o)}),t}function K(e,t,n){let o=D(e);if(o.length===0)return-1;let i=o.indexOf(t);return i<0?n>0?o[0]:o[o.length-1]:o[Math.max(0,Math.min(o.length-1,i+n))]}function M(e,t){return e.findIndex(n=>n.value===t&&!n.disabled)}function re(e){let t=y("div",k("mach-select-control",e.classNames?.root)),n=y("select",k("mach-select-native",e.classNames?.native));n.hidden=!0,n.tabIndex=-1,n.setAttribute("aria-hidden","true");let o=y("button",k("mach-select-trigger",e.classNames?.trigger));o.type="button",o.setAttribute("role","combobox"),o.setAttribute("aria-haspopup","listbox"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-label",e.ariaLabel);let i=y("span",k("mach-select-value",e.classNames?.value)),p=y("span",k("mach-select-caret",e.classNames?.caret));p.setAttribute("aria-hidden","true"),o.append(i,p);let r=y("div",k("mach-select-listbox",e.classNames?.listbox));r.id=B("mach-select-listbox"),r.setAttribute("role","listbox"),r.setAttribute("aria-hidden","true"),o.setAttribute("aria-controls",r.id),t.append(n,o);let s=[...e.options],f=[],d=-1,b=!1,V=()=>e.themeSource??t.closest(".mach-root")??t,v=()=>{let a=s.find(l=>l.value===n.value);i.textContent=a?.label??n.value,f.forEach((l,g)=>{let c=s[g]?.value===n.value;l.setAttribute("aria-selected",c?"true":"false"),l.classList.toggle("mach-select-option--selected",c),l.classList.toggle("mach-select-option--active",g===d)}),o.setAttribute("aria-activedescendant",d>=0?f[d]?.id??"":"")},R=()=>{let a=o.getBoundingClientRect(),l=r.getBoundingClientRect(),g=Math.max(a.width,l.width),c=W(a.left,8,Math.max(8,window.innerWidth-g-8)),O=window.innerHeight-a.bottom-8,T=O<Math.min(l.height,240)&&a.top>O,u=T?Math.max(8,a.top-l.height-5):Math.min(window.innerHeight-l.height-8,a.bottom+5);r.style.minWidth=`${a.width}px`,r.style.left=`${c}px`,r.style.top=`${Math.max(8,u)}px`,r.classList.toggle("mach-select-listbox--above",T)},h=(a=!1)=>r.classList.contains("mach-select-listbox--open")?(r.classList.remove("mach-select-listbox--open","mach-select-listbox--above"),r.setAttribute("aria-hidden","true"),o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant"),r.remove(),ie(h),a&&!b&&o.focus({preventScroll:!0}),!0):!1,$=(a,l=!0)=>{!s[a]||s[a].disabled||(d=a,v(),l&&f[a]?.scrollIntoView?.({block:"nearest"}))},w=()=>{b||o.disabled||r.classList.contains("mach-select-listbox--open")||(ae({close:h,contains:a=>t.contains(a)||r.contains(a),reposition:R}),d=M(s,n.value),d<0&&(d=D(s)[0]??-1),_(r,V()),document.body.appendChild(r),r.classList.add("mach-select-listbox--open"),r.setAttribute("aria-hidden","false"),o.setAttribute("aria-expanded","true"),R(),v(),f[d]?.scrollIntoView?.({block:"nearest"}))},P=a=>{let l=s[a];!l||l.disabled||(n.value=l.value,d=a,v(),h(!0),n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})))},L=(a,l)=>{s=[...a],n.replaceChildren(),r.replaceChildren(),f=s.map((c,O)=>{let T=document.createElement("option");T.value=c.value,T.textContent=c.label,T.disabled=c.disabled===!0,n.appendChild(T);let u=y("button",k("mach-select-option",e.classNames?.option));return u.id=`${r.id}-option-${O}`,u.type="button",u.tabIndex=-1,u.dataset.value=c.value,u.disabled=c.disabled===!0,u.setAttribute("role","option"),u.textContent=c.label,u.addEventListener("mousedown",U=>U.preventDefault()),u.addEventListener("click",()=>P(O)),r.appendChild(u),u});let g=s.find(c=>!c.disabled)?.value??"";n.value=l!=null&&s.some(c=>c.value===l)?l:g,d=M(s,n.value),v()},G=a=>{if(a.key==="Tab"){h();return}if(a.key==="Escape"){if(!h(!0))return;a.preventDefault(),a.stopPropagation();return}if(a.key==="Enter"||a.key===" "){a.preventDefault(),a.stopPropagation(),r.classList.contains("mach-select-listbox--open")?P(d):w();return}let l=d;if(a.key==="ArrowDown")l=K(s,d,1);else if(a.key==="ArrowUp")l=K(s,d,-1);else if(a.key==="Home")l=D(s)[0]??-1;else if(a.key==="End"){let g=D(s);l=g[g.length-1]??-1}else return;a.preventDefault(),a.stopPropagation(),r.classList.contains("mach-select-listbox--open")||w(),$(l)},N=()=>{d=M(s,n.value),v(),e.onChange?.(n.value)};return o.addEventListener("click",()=>{h()||w()}),o.addEventListener("keydown",G),n.addEventListener("change",N),L(s,e.value),{el:t,native:n,trigger:o,listbox:r,contains:a=>t.contains(a)||r.contains(a),isOpen:()=>r.classList.contains("mach-select-listbox--open"),open:w,close:h,focus:()=>o.focus({preventScroll:!0}),getValue:()=>n.value,setValue:a=>{n.value=a,d=M(s,a),v()},setOptions:L,destroy:()=>{b||(b=!0,h(),o.removeEventListener("keydown",G),n.removeEventListener("change",N),t.remove())}}}export{A as GRID_OPTION_KEYS,S as GRID_OPTION_META,re as createSelectControl,te as mergeMachTableConfig,j as normalizeMachTableConfig,ne as resolveMachTableGridOptions};
1
+ var S={columnDefs:{kind:"array",update:"columnDefs"},rowData:{kind:"array",update:"rowData"},defaultColDef:{kind:"object",update:"options"},columnTypes:{kind:"object",update:"options"},rowKey:{kind:"unknown",update:"options"},rowHeight:{kind:"number",update:"options"},headerHeight:{kind:"number",update:"options"},rowBuffer:{kind:"number",update:"options"},columnLayout:{kind:"string",update:"options"},enableColumnResize:{kind:"boolean",update:"options"},domLayout:{kind:"string",update:"options"},rowSelection:{kind:"string",update:"options"},multiSort:{kind:"boolean",update:"options"},size:{kind:"string",update:"options"},stripedRows:{kind:"boolean",update:"options"},rowStyleRules:{kind:"array",update:"options"},showCellBorders:{kind:"boolean",update:"options"},theme:{kind:"string",update:"options"},quickFilterText:{kind:"string",update:"quickFilter"},advancedFilterModel:{kind:"object",update:"options"},masterDetail:{kind:"boolean",update:"options"},detailRowHeight:{kind:"number",update:"options"},detailRowRenderer:{kind:"function",update:"options"},isRowExpandable:{kind:"function",update:"options"},detailToggleColumn:{kind:"boolean",update:"options"},columnMenu:{kind:"boolean",update:"options"},aggFuncs:{kind:"object",update:"options"},components:{kind:"object",update:"options"},actionPolicy:{kind:"object",update:"options"},features:{kind:"array",update:"options"},initialState:{kind:"object",update:"options"},persistence:{kind:"boolean-object",update:"options"},locale:{kind:"object",update:"options"},editType:{kind:"string",update:"options"},editableIndicator:{kind:"string",update:"options"},rowEditValidator:{kind:"function",update:"options"},singleClickEdit:{kind:"boolean",update:"options"},manualSorting:{kind:"boolean",update:"options"},manualFiltering:{kind:"boolean",update:"options"},showSummary:{kind:"boolean",update:"options"},summaryMethod:{kind:"function",update:"options"},treeData:{kind:"boolean",update:"options"},childrenKey:{kind:"string",update:"options"},isTreeRowExpandable:{kind:"function",update:"options"},loadTreeChildren:{kind:"function",update:"options"},autoCheckedChildren:{kind:"boolean",update:"options"},defaultExpandAll:{kind:"boolean",update:"options"},indexOffset:{kind:"number",update:"options"},applyRowDrag:{kind:"boolean",update:"options"},undoStackSize:{kind:"number",update:"options"},asyncTransactionWaitMillis:{kind:"number",update:"options"},getRowHeight:{kind:"function",update:"options"},pinnedTopRowData:{kind:"array",update:"options"},pinnedBottomRowData:{kind:"array",update:"options"},pagination:{kind:"boolean-object",update:"options"},watermark:{kind:"boolean-object",update:"options"},suppressWarnings:{kind:"boolean",update:"options"},enableRangeSelection:{kind:"boolean",update:"options"},suppressClipboard:{kind:"boolean",update:"options"},contextMenu:{kind:"boolean",update:"options"},getContextMenuItems:{kind:"function",update:"options"},tooltipComponent:{kind:"function",update:"options"},tooltipShowDelay:{kind:"number",update:"options"},flashCells:{kind:"boolean",update:"options"},fillHandle:{kind:"boolean",update:"options"},statusBar:{kind:"boolean-object",update:"options"},datasource:{kind:"object",update:"options"},datasourceMode:{kind:"string",update:"options"},blockSize:{kind:"number",update:"options"},infiniteBufferRows:{kind:"number",update:"options"},maxBlocksInCache:{kind:"number",update:"options"},datasourceMaxConcurrentRequests:{kind:"number",update:"options"},blockPrefetch:{kind:"number",update:"options"},datasourceRowCount:{kind:"number",update:"options"},dataProcessor:{kind:"object",update:"options"},dataProcessorMinRows:{kind:"number",update:"options"},datasourceRetryCount:{kind:"number",update:"options"},datasourceRetryDelay:{kind:"number",update:"options"},datasourceRetryJitter:{kind:"number",update:"options"},suppressCellFocus:{kind:"boolean",update:"options"},suppressRowHoverHighlight:{kind:"boolean",update:"options"},suppressNoRowsOverlay:{kind:"boolean",update:"options"},suppressHeaderFocus:{kind:"boolean",update:"options"},ariaLabel:{kind:"string",update:"options"},ariaLabelledBy:{kind:"string",update:"options"},ariaDescribedBy:{kind:"string",update:"options"},loading:{kind:"boolean",update:"options"},error:{kind:"unknown",update:"options"},overlayNoRowsTemplate:{kind:"unknown",update:"options"},overlayLoadingTemplate:{kind:"unknown",update:"options"},overlayErrorTemplate:{kind:"unknown",update:"options"},allowUnsafeOverlayHtml:{kind:"boolean",update:"options"},className:{kind:"string",update:"options"}},A=Object.freeze(Object.keys(S)),se=Object.freeze(A.filter(e=>S[e].update==="options"));function x(e,t){return t===void 0?e:typeof t!="object"||t===null||typeof e!="object"||e===null?t:{...e,...t}}function Y(e,t){return typeof e!="function"?t:typeof t!="function"?e:(...n)=>{let o;try{e(...n)}catch(i){o=i}try{t(...n)}catch(i){o??(o=i)}if(o!==void 0)throw o}}function q(e,t){if(!(!e.components&&!t.components))return{cellRenderers:{...e.components?.cellRenderers,...t.components?.cellRenderers},cellEditors:{...e.components?.cellEditors,...t.components?.cellEditors}}}function J(e,t){if(!e.columnTypes&&!t.columnTypes)return;let n={},o=new Set([...Object.keys(e.columnTypes??{}),...Object.keys(t.columnTypes??{})]);for(let i of o)n[i]={...e.columnTypes?.[i],...t.columnTypes?.[i]};return n}function Z(e,t,n){for(let o of new Set([...Object.keys(t),...Object.keys(n)])){if(!/^on[A-Z]/.test(o))continue;let i=t[o],p=n[o];typeof i!="function"||typeof p!="function"||(e[o]=Y(i,p))}}function Q(e,t){let n={...e,...t,features:t.features??e.features};(e.defaultColDef||t.defaultColDef)&&(n.defaultColDef={...e.defaultColDef,...t.defaultColDef}),(e.locale||t.locale)&&(n.locale={...e.locale,...t.locale});let o=q(e,t);o&&(n.components=o);let i=J(e,t);return i&&(n.columnTypes=i),(e.aggFuncs||t.aggFuncs)&&(n.aggFuncs={...e.aggFuncs,...t.aggFuncs}),n.pagination=x(e.pagination,t.pagination),n.statusBar=x(e.statusBar,t.statusBar),n.watermark=x(e.watermark,t.watermark),Z(n,e,t),n}function C(...e){return e.reduce(Q,{})}function X(e){return e?(Array.isArray(e)?e:[e]).filter(t=>typeof t=="string"&&t.trim().length>0):[]}var ee=new Set(["rowData","columnDefs","datasource","loading","error","initialState","persistence","components","columnTypes","stateKey","stateStore","stateSaveDebounceMs","columnStateKey","columnStateStore"]);function I(e,t,n){if(!t||typeof t!="object"||Array.isArray(t))return{};let o={};for(let[i,p]of Object.entries(t)){if(!ee.has(i)){o[i]=p;continue}let r={code:n==="defaults"?"INVALID_DEFAULT_OPTION":"INVALID_PRESET_OPTION",option:i,layer:n,message:`[MachTable] "${i}" is instance-only and cannot be declared in config ${n}.`};if(e.onConfigWarning?.(r),e.strict!==!1)throw new TypeError(r.message)}return o}function j(e={}){let t=I(e,e.defaults,"defaults");return{defaults:C({columnTypes:e.columnTypes,components:e.components},t),presets:Object.fromEntries(Object.entries(e.presets??{}).map(([n,o])=>[n,C(I(e,o,`preset:${n}`))])),defaultPreset:e.defaultPreset??!1,strict:e.strict!==!1,...e.onConfigWarning?{onConfigWarning:e.onConfigWarning}:{}}}function te(e,t){let n=j({...t,strict:t.strict??e.strict,onConfigWarning:t.onConfigWarning??e.onConfigWarning}),o={...e.presets};for(let[i,p]of Object.entries(n.presets))o[i]=C(e.presets[i]??{},p);return{defaults:C(e.defaults,n.defaults),presets:o,defaultPreset:t.defaultPreset===void 0?e.defaultPreset:t.defaultPreset,strict:t.strict??e.strict,...t.onConfigWarning??e.onConfigWarning?{onConfigWarning:t.onConfigWarning??e.onConfigWarning}:{}}}function ne(e,t,n,o){let i=t===void 0?e.defaultPreset:t,p=[{name:"application defaults",options:e.defaults}];for(let s of X(i)){let f=e.presets[s];if(!f){let d={code:"UNKNOWN_PRESET",preset:s,message:`[MachTable] Unknown preset "${s}". Register it in mach-table.config.ts or remove the preset.`};o?o(d):e.onConfigWarning?e.onConfigWarning(d):console.warn(d.message);continue}p.push({name:`preset:${s}`,options:f})}p.push({name:"table props",options:n});let r=C(...p.map(s=>s.options));return{options:r,explain(s){let f=p.filter(b=>Object.prototype.hasOwnProperty.call(b.options,s)).map(b=>({name:b.name,value:b.options[s]})),d=f[f.length-1];return{key:s,value:r[s],source:d?.name??"MachTable built-in",layers:f}}}}function y(e,t,n){let o=document.createElement(e);if(t&&(o.className=t),n)for(let i of Object.keys(n))o.setAttribute(i,n[i]);return o}var oe=["--mach-font-family","--mach-font-size","--mach-font-size-sm","--mach-header-font-weight","--mach-cell-padding","--mach-header-h","--mach-primary","--mach-primary-weak","--mach-success","--mach-warning","--mach-danger","--mach-info","--mach-border-color","--mach-border-width","--mach-header-bg","--mach-header-fg","--mach-body-bg","--mach-body-fg","--mach-row-hover-bg","--mach-radius-sm","--mach-radius","--mach-radius-lg","--mach-shadow-sm","--mach-shadow","--mach-transition","--mach-z-popup","--mach-z-menu"];function _(e,t){if(e.classList.add("mach-portal"),!t)return;let n=window.getComputedStyle(t);for(let o of oe){let i=n.getPropertyValue(o).trim();i&&e.style.setProperty(o,i)}e.style.colorScheme=n.colorScheme}function W(e,t,n){return e<t?t:e>n?n:e}var H=0;function B(e="rg"){return H++,`${e}-${H}`}var m=null;function z(e){let t=e.target;m?.contains(t)||m?.close()}function E(){m?.reposition()}function F(e){e.key!=="Escape"||!m||(e.preventDefault(),e.stopImmediatePropagation(),m.close(!0))}function ae(e){m?.close!==e.close&&m?.close(),!m&&(m=e,document.addEventListener("mousedown",z,!0),document.addEventListener("keydown",F,!0),window.addEventListener("resize",E),window.addEventListener("scroll",E,!0))}function ie(e){m?.close===e&&(m=null,document.removeEventListener("mousedown",z,!0),document.removeEventListener("keydown",F,!0),window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0))}function k(e,t){return t?`${e} ${t}`:e}function D(e){let t=[];return e.forEach((n,o)=>{n.disabled||t.push(o)}),t}function K(e,t,n){let o=D(e);if(o.length===0)return-1;let i=o.indexOf(t);return i<0?n>0?o[0]:o[o.length-1]:o[Math.max(0,Math.min(o.length-1,i+n))]}function M(e,t){return e.findIndex(n=>n.value===t&&!n.disabled)}function re(e){let t=y("div",k("mach-select-control",e.classNames?.root)),n=y("select",k("mach-select-native",e.classNames?.native));n.hidden=!0,n.tabIndex=-1,n.setAttribute("aria-hidden","true");let o=y("button",k("mach-select-trigger",e.classNames?.trigger));o.type="button",o.setAttribute("role","combobox"),o.setAttribute("aria-haspopup","listbox"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-label",e.ariaLabel);let i=y("span",k("mach-select-value",e.classNames?.value)),p=y("span",k("mach-select-caret",e.classNames?.caret));p.setAttribute("aria-hidden","true"),o.append(i,p);let r=y("div",k("mach-select-listbox",e.classNames?.listbox));r.id=B("mach-select-listbox"),r.setAttribute("role","listbox"),r.setAttribute("aria-hidden","true"),o.setAttribute("aria-controls",r.id),t.append(n,o);let s=[...e.options],f=[],d=-1,b=!1,V=()=>e.themeSource??t.closest(".mach-root")??t,v=()=>{let a=s.find(l=>l.value===n.value);i.textContent=a?.label??n.value,f.forEach((l,g)=>{let c=s[g]?.value===n.value;l.setAttribute("aria-selected",c?"true":"false"),l.classList.toggle("mach-select-option--selected",c),l.classList.toggle("mach-select-option--active",g===d)}),o.setAttribute("aria-activedescendant",d>=0?f[d]?.id??"":"")},R=()=>{let a=o.getBoundingClientRect(),l=r.getBoundingClientRect(),g=Math.max(a.width,l.width),c=W(a.left,8,Math.max(8,window.innerWidth-g-8)),w=window.innerHeight-a.bottom-8,T=w<Math.min(l.height,240)&&a.top>w,u=T?Math.max(8,a.top-l.height-5):Math.min(window.innerHeight-l.height-8,a.bottom+5);r.style.minWidth=`${a.width}px`,r.style.left=`${c}px`,r.style.top=`${Math.max(8,u)}px`,r.classList.toggle("mach-select-listbox--above",T)},h=(a=!1)=>r.classList.contains("mach-select-listbox--open")?(r.classList.remove("mach-select-listbox--open","mach-select-listbox--above"),r.setAttribute("aria-hidden","true"),o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant"),r.remove(),ie(h),a&&!b&&o.focus({preventScroll:!0}),!0):!1,$=(a,l=!0)=>{!s[a]||s[a].disabled||(d=a,v(),l&&f[a]?.scrollIntoView?.({block:"nearest"}))},O=()=>{b||o.disabled||r.classList.contains("mach-select-listbox--open")||(ae({close:h,contains:a=>t.contains(a)||r.contains(a),reposition:R}),d=M(s,n.value),d<0&&(d=D(s)[0]??-1),_(r,V()),document.body.appendChild(r),r.classList.add("mach-select-listbox--open"),r.setAttribute("aria-hidden","false"),o.setAttribute("aria-expanded","true"),R(),v(),f[d]?.scrollIntoView?.({block:"nearest"}))},P=a=>{let l=s[a];!l||l.disabled||(n.value=l.value,d=a,v(),h(!0),n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})))},L=(a,l)=>{s=[...a],n.replaceChildren(),r.replaceChildren(),f=s.map((c,w)=>{let T=document.createElement("option");T.value=c.value,T.textContent=c.label,T.disabled=c.disabled===!0,n.appendChild(T);let u=y("button",k("mach-select-option",e.classNames?.option));return u.id=`${r.id}-option-${w}`,u.type="button",u.tabIndex=-1,u.dataset.value=c.value,u.disabled=c.disabled===!0,u.setAttribute("role","option"),u.textContent=c.label,u.addEventListener("mousedown",U=>U.preventDefault()),u.addEventListener("click",()=>P(w)),r.appendChild(u),u});let g=s.find(c=>!c.disabled)?.value??"";n.value=l!=null&&s.some(c=>c.value===l)?l:g,d=M(s,n.value),v()},G=a=>{if(a.key==="Tab"){h();return}if(a.key==="Escape"){if(!h(!0))return;a.preventDefault(),a.stopPropagation();return}if(a.key==="Enter"||a.key===" "){a.preventDefault(),a.stopPropagation(),r.classList.contains("mach-select-listbox--open")?P(d):O();return}let l=d;if(a.key==="ArrowDown")l=K(s,d,1);else if(a.key==="ArrowUp")l=K(s,d,-1);else if(a.key==="Home")l=D(s)[0]??-1;else if(a.key==="End"){let g=D(s);l=g[g.length-1]??-1}else return;a.preventDefault(),a.stopPropagation(),r.classList.contains("mach-select-listbox--open")||O(),$(l)},N=()=>{d=M(s,n.value),v(),e.onChange?.(n.value)};return o.addEventListener("click",()=>{h()||O()}),o.addEventListener("keydown",G),n.addEventListener("change",N),L(s,e.value),{el:t,native:n,trigger:o,listbox:r,contains:a=>t.contains(a)||r.contains(a),isOpen:()=>r.classList.contains("mach-select-listbox--open"),open:O,close:h,focus:()=>o.focus({preventScroll:!0}),getValue:()=>n.value,setValue:a=>{n.value=a,d=M(s,a),v()},setOptions:L,destroy:()=>{b||(b=!0,h(),o.removeEventListener("keydown",G),n.removeEventListener("change",N),t.remove())}}}export{A as GRID_OPTION_KEYS,S as GRID_OPTION_META,re as createSelectControl,te as mergeMachTableConfig,j as normalizeMachTableConfig,ne as resolveMachTableGridOptions};
@@ -1,4 +1,4 @@
1
- import { G as GridOptions, C as ColDef, a as GridComponents } from './options-Cc31xFVh.cjs';
1
+ import { G as GridOptions, C as ColDef, a as GridComponents } from './options-Bi_m5kXL.cjs';
2
2
 
3
3
  type MachTablePresetSelection = string | readonly string[] | false;
4
4
  type MachTableInstanceOptionKey = "rowData" | "columnDefs" | "datasource" | "loading" | "error" | "initialState" | "persistence" | "components" | "columnTypes";
@@ -1,4 +1,4 @@
1
- import { G as GridOptions, C as ColDef, a as GridComponents } from './options-Cc31xFVh.js';
1
+ import { G as GridOptions, C as ColDef, a as GridComponents } from './options-Bi_m5kXL.js';
2
2
 
3
3
  type MachTablePresetSelection = string | readonly string[] | false;
4
4
  type MachTableInstanceOptionKey = "rowData" | "columnDefs" | "datasource" | "loading" | "error" | "initialState" | "persistence" | "components" | "columnTypes";