@agile-team/mach-table-vue 0.24.0 → 0.28.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-vue
6
6
 
7
- MachTable 0.24 的官方 Vue 3 适配包。一个依赖即可获得 Core、泛型 `<MachTable>`、原生 slots、应用/路由配置、按需工作流、异步组件边界和自动生命周期清理。
7
+ MachTable 0.28 的官方 Vue 3 适配包。一个依赖即可获得 Core、泛型 `<MachTable>`、原生 slots、应用/路由配置、按需工作流、异步组件边界和自动生命周期清理。
8
8
 
9
9
  ```bash
10
10
  pnpm add @agile-team/mach-table-vue
@@ -97,8 +97,8 @@ import { createElementPlusEditors } from "@agile-team/mach-table-vue/editors";
97
97
  import { createWorkerDataProcessor } from "@agile-team/mach-table-vue/worker";
98
98
  ```
99
99
 
100
- - `/workflows`:请求取消、防过期覆盖、服务端分页、跨页选择、脏数据和冲突保存。
101
- - `/ui`:可选标准工具栏;需要全局组件时另行 `app.use(MachTableUiPlugin)`。
100
+ - `/workflows`:请求取消、防过期覆盖、服务端分页、跨页选择、脏数据和冲突保存;`reset()` 清空全部表格过滤且只请求一次。
101
+ - `/ui`:可选标准工具栏;需要全局组件时另行 `app.use(MachTableUiPlugin)`,其全局组件类型也只在导入该子入口后生效。
102
102
  - `/adapters`:自定义 Vue renderer/editor/detail/overlay 桥接。
103
103
  - `/editors`:可选 Element Plus 编辑器,Element Plus 由宿主注入。
104
104
  - `/worker`:大型本地过滤/排序的独立 Worker 能力。
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-2ANGCJOO.js";import"./chunk-7MRR4IDI.js";import"./chunk-SQVY5G55.js";export{a as MachTable};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3LIWCBSPcjs = require('./chunk-3LIWCBSP.cjs');require('./chunk-7LXDVLDD.cjs');require('./chunk-XECIDGIZ.cjs');exports.MachTable = _chunk3LIWCBSPcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ3SALTBKcjs = require('./chunk-J3SALTBK.cjs');require('./chunk-7LXDVLDD.cjs');require('./chunk-XECIDGIZ.cjs');exports.MachTable = _chunkJ3SALTBKcjs.a;
package/dist/async.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkOFITMI6Jcjs = require('./chunk-OFITMI6J.cjs');require('./chunk-7LXDVLDD.cjs');var _vue = require('vue');var p=()=>Promise.resolve().then(() => _interopRequireWildcard(require("./MachTable-AXAVVKW5.cjs"))).then(({MachTable:e})=>e);function t(e={}){return _vue.defineAsyncComponent.call(void 0, {loader:p,...e})}var c=t(),i= exports.AsyncMachTablePlugin =Object.freeze({install(e,n={}){let a=n.asyncComponentOptions?t(n.asyncComponentOptions):c;_chunkOFITMI6Jcjs.a.call(void 0, e,a,n)}}),b= exports.default =i;exports.AsyncMachTable = c; exports.AsyncMachTablePlugin = i; exports.createAsyncMachTable = t; exports.default = b; exports.preloadMachTable = p;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunkYQIRPQHTcjs = require('./chunk-YQIRPQHT.cjs');require('./chunk-7LXDVLDD.cjs');var _vue = require('vue');var p=()=>Promise.resolve().then(() => _interopRequireWildcard(require("./MachTable-EL36L7JW.cjs"))).then(({MachTable:e})=>e);function t(e={}){return _vue.defineAsyncComponent.call(void 0, {loader:p,...e})}var c=t(),i= exports.AsyncMachTablePlugin =Object.freeze({install(e,n={}){let a=n.asyncComponentOptions?t(n.asyncComponentOptions):c;_chunkYQIRPQHTcjs.a.call(void 0, e,a,n)}}),b= exports.default =i;exports.AsyncMachTable = c; exports.AsyncMachTablePlugin = i; exports.createAsyncMachTable = t; exports.default = b; exports.preloadMachTable = p;
package/dist/async.d.cts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { M as MachTableVueComponent } from './MachTable-jS92BIXm.cjs';
2
2
  import { Component, App } from 'vue';
3
- import { M as MachTablePluginOptions } from './globalRegistration-oxdZVSgD.cjs';
3
+ import { M as MachTablePluginOptions } from './globalRegistration-CRo5XbUX.cjs';
4
4
  import '@agile-team/mach-table';
5
5
  import '@agile-team/mach-table/adapter';
6
- import './MachTableToolbar-BUFcnsF4.cjs';
7
6
 
8
7
  /**
9
8
  * Starts loading the Vue adapter ahead of first render. The browser and bundler
package/dist/async.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { M as MachTableVueComponent } from './MachTable-jS92BIXm.js';
2
2
  import { Component, App } from 'vue';
3
- import { M as MachTablePluginOptions } from './globalRegistration-bUvkfBzA.js';
3
+ import { M as MachTablePluginOptions } from './globalRegistration-Bsdv9yBs.js';
4
4
  import '@agile-team/mach-table';
5
5
  import '@agile-team/mach-table/adapter';
6
- import './MachTableToolbar-BUFcnsF4.js';
7
6
 
8
7
  /**
9
8
  * Starts loading the Vue adapter ahead of first render. The browser and bundler
package/dist/async.js CHANGED
@@ -1 +1 @@
1
- import{a as o}from"./chunk-CVSAWAOZ.js";import"./chunk-7MRR4IDI.js";import{defineAsyncComponent as r}from"vue";var p=()=>import("./MachTable-PX2BHIPK.js").then(({MachTable:e})=>e);function t(e={}){return r({loader:p,...e})}var c=t(),i=Object.freeze({install(e,n={}){let a=n.asyncComponentOptions?t(n.asyncComponentOptions):c;o(e,a,n)}}),b=i;export{c as AsyncMachTable,i as AsyncMachTablePlugin,t as createAsyncMachTable,b as default,p as preloadMachTable};
1
+ import{a as o}from"./chunk-Y4S6TCE5.js";import"./chunk-7MRR4IDI.js";import{defineAsyncComponent as r}from"vue";var p=()=>import("./MachTable-6IGIPSES.js").then(({MachTable:e})=>e);function t(e={}){return r({loader:p,...e})}var c=t(),i=Object.freeze({install(e,n={}){let a=n.asyncComponentOptions?t(n.asyncComponentOptions):c;o(e,a,n)}}),b=i;export{c as AsyncMachTable,i as AsyncMachTablePlugin,t as createAsyncMachTable,b as default,p as preloadMachTable};
@@ -1 +1 @@
1
- import{a as g,e as h}from"./chunk-7MRR4IDI.js";import{i as O}from"./chunk-SQVY5G55.js";import{defineComponent as B,getCurrentInstance as C,h as N,onBeforeUnmount as v,onMounted as S,ref as E,watch as L}from"vue";import{createGrid as R,EVENT_TYPES as T}from"@agile-team/mach-table";import{GRID_OPTION_KEYS as b,GRID_OPTION_META as k}from"@agile-team/mach-table/adapter";var A=b.filter(r=>!["className","ariaLabel","ariaLabelledBy","ariaDescribedBy"].includes(r)),l={};for(let r of A){let s=k[r].kind,c=s==="boolean"?Boolean:s==="number"?Number:s==="array"?Array:s==="function"?Function:s==="boolean-object"?[Boolean,Object]:s==="object"?Object:s==="string"?String:void 0;l[r]={type:c,default:void 0}}l.className={type:String,default:void 0};l.gridClassName={type:String,default:void 0};l.gridAriaLabel={type:String,default:void 0};l.gridAriaLabelledBy={type:String,default:void 0};l.gridAriaDescribedBy={type:String,default:void 0};l.preset={type:[String,Array,Boolean],default:void 0};function P(r){return"on"+r.charAt(0).toUpperCase()+r.slice(1)}var V=B({name:"MachTable",inheritAttrs:!1,props:l,emits:[...T],setup(r,{expose:s,attrs:c,emit:D,slots:M}){let a=r,f=E(null),d=null,p=h(),G=O(M,C()?.appContext),u=null,m=new Set,y=()=>{let n={};for(let e of A){let o=a[e];o!==void 0&&(n[e]=o)}a.gridClassName!==void 0&&(n.className=a.gridClassName),a.gridAriaLabel!==void 0&&(n.ariaLabel=a.gridAriaLabel),a.gridAriaLabelledBy!==void 0&&(n.ariaLabelledBy=a.gridAriaLabelledBy),a.gridAriaDescribedBy!==void 0&&(n.ariaDescribedBy=a.gridAriaDescribedBy);let t=g(p.value,a.preset,n,e=>{let o=`${e.code}:${e.preset??""}`;m.has(o)||(m.add(o),p.value.onConfigWarning?p.value.onConfigWarning(e):console.warn(e.message))}),i=G(t.options);return u={options:i,explain:e=>e==="columnDefs"&&i.columnDefs!==t.options.columnDefs?{key:e,value:i.columnDefs,source:"Vue slots",layers:[...t.explain(e).layers,{name:"Vue slots",value:i.columnDefs}]}:t.explain(e)},u.options};return S(()=>{if(!f.value)return;let n=y();for(let t of T){let i=P(t),e=n[i];n[i]=o=>{typeof e=="function"&&e(o),D(t,o)}}d=R(f.value,n)}),v(()=>{d?.destroy(),d=null}),L(()=>{let n=y();return[...b.map(t=>n[t])]},(n,t)=>{if(!d)return;let i={};n.forEach((e,o)=>{if(Object.is(e,t[o]))return;let x=b[o];i[x]=e}),Object.keys(i).length>0&&d.updateOptions(i)}),s({getApi:()=>d,getResolvedConfig:()=>u?.options??y(),explainOption:n=>(u??g(p.value,a.preset,{})).explain(n)}),()=>N("div",{...c,ref:f,class:["mach-vue-host",a.className,c.class]})}}),Y=V;export{Y as a};
1
+ import{a as g,e as h}from"./chunk-7MRR4IDI.js";import{i as O}from"./chunk-SQVY5G55.js";import{defineComponent as B,getCurrentInstance as C,h as N,onBeforeUnmount as v,onMounted as R,ref as S,watch as k}from"vue";import{createGrid as E,EVENT_TYPES as T}from"@agile-team/mach-table";import{GRID_OPTION_KEYS as b,GRID_OPTION_META as L}from"@agile-team/mach-table/adapter";var A=b.filter(r=>!["className","ariaLabel","ariaLabelledBy","ariaDescribedBy"].includes(r)),l={};for(let r of A){let s=L[r].kind,p=s==="boolean"?Boolean:s==="number"?Number:s==="array"?Array:s==="function"?Function:s==="boolean-object"?[Boolean,Object]:s==="object"?Object:s==="string"?String:void 0;l[r]={type:p,default:void 0}}l.className={type:String,default:void 0};l.gridClassName={type:String,default:void 0};l.gridAriaLabel={type:String,default:void 0};l.gridAriaLabelledBy={type:String,default:void 0};l.gridAriaDescribedBy={type:String,default:void 0};l.preset={type:[String,Array,Boolean],default:void 0};function P(r){return"on"+r.charAt(0).toUpperCase()+r.slice(1)}var V=B({name:"MachTable",inheritAttrs:!1,props:l,emits:[...T],setup(r,{expose:s,attrs:p,emit:D,slots:M}){let a=r,f=S(null),d=null,u=h(),G=O(M,C()?.appContext),c=null,m=new Set,y=()=>{let n={};for(let e of A){let o=a[e];o!==void 0&&(n[e]=o)}a.gridClassName!==void 0&&(n.className=a.gridClassName),a.gridAriaLabel!==void 0&&(n.ariaLabel=a.gridAriaLabel),a.gridAriaLabelledBy!==void 0&&(n.ariaLabelledBy=a.gridAriaLabelledBy),a.gridAriaDescribedBy!==void 0&&(n.ariaDescribedBy=a.gridAriaDescribedBy);let t=g(u.value,a.preset,n,e=>{let o=`${e.code}:${e.preset??""}`;m.has(o)||(m.add(o),u.value.onConfigWarning?u.value.onConfigWarning(e):console.warn(e.message))}),i=G(t.options);return c={options:i,explain:e=>e==="columnDefs"&&i.columnDefs!==t.options.columnDefs?{key:e,value:i.columnDefs,source:"Vue slots",layers:[...t.explain(e).layers,{name:"Vue slots",value:i.columnDefs}]}:t.explain(e)},c.options};return R(()=>{if(!f.value)return;let n={...y()};for(let t of T){let i=P(t);n[i]=e=>{let o=c?.options?.[i];try{typeof o=="function"&&o(e)}finally{D(t,e)}}}d=E(f.value,n)}),v(()=>{d?.destroy(),d=null}),k(()=>{let n=y();return[...b.map(t=>n[t])]},(n,t)=>{if(!d)return;let i={};n.forEach((e,o)=>{if(Object.is(e,t[o]))return;let x=b[o];i[x]=e}),Object.keys(i).length>0&&d.updateOptions(i)}),s({getApi:()=>d,getResolvedConfig:()=>c?.options??y(),explainOption:n=>(c??g(u.value,a.preset,{})).explain(n)}),()=>N("div",{...p,ref:f,class:["mach-vue-host",a.className,p.class]})}}),Y=V;export{Y as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk7LXDVLDDcjs = require('./chunk-7LXDVLDD.cjs');var _chunkXECIDGIZcjs = require('./chunk-XECIDGIZ.cjs');var _vue = require('vue');var _machtable = require('@agile-team/mach-table');var _adapter = require('@agile-team/mach-table/adapter');var A=_adapter.GRID_OPTION_KEYS.filter(r=>!["className","ariaLabel","ariaLabelledBy","ariaDescribedBy"].includes(r)),l={};for(let r of A){let s=_adapter.GRID_OPTION_META[r].kind,c=s==="boolean"?Boolean:s==="number"?Number:s==="array"?Array:s==="function"?Function:s==="boolean-object"?[Boolean,Object]:s==="object"?Object:s==="string"?String:void 0;l[r]={type:c,default:void 0}}l.className={type:String,default:void 0};l.gridClassName={type:String,default:void 0};l.gridAriaLabel={type:String,default:void 0};l.gridAriaLabelledBy={type:String,default:void 0};l.gridAriaDescribedBy={type:String,default:void 0};l.preset={type:[String,Array,Boolean],default:void 0};function P(r){return"on"+r.charAt(0).toUpperCase()+r.slice(1)}var V=_vue.defineComponent.call(void 0, {name:"MachTable",inheritAttrs:!1,props:l,emits:[..._machtable.EVENT_TYPES],setup(r,{expose:s,attrs:c,emit:D,slots:M}){let a=r,f=_vue.ref.call(void 0, null),d=null,p=_chunk7LXDVLDDcjs.e.call(void 0, ),G=_chunkXECIDGIZcjs.i.call(void 0, M,_optionalChain([_vue.getCurrentInstance.call(void 0, ), 'optionalAccess', _ => _.appContext])),u=null,m=new Set,y=()=>{let n={};for(let e of A){let o=a[e];o!==void 0&&(n[e]=o)}a.gridClassName!==void 0&&(n.className=a.gridClassName),a.gridAriaLabel!==void 0&&(n.ariaLabel=a.gridAriaLabel),a.gridAriaLabelledBy!==void 0&&(n.ariaLabelledBy=a.gridAriaLabelledBy),a.gridAriaDescribedBy!==void 0&&(n.ariaDescribedBy=a.gridAriaDescribedBy);let t=_chunk7LXDVLDDcjs.a.call(void 0, p.value,a.preset,n,e=>{let o=`${e.code}:${_nullishCoalesce(e.preset, () => (""))}`;m.has(o)||(m.add(o),p.value.onConfigWarning?p.value.onConfigWarning(e):console.warn(e.message))}),i=G(t.options);return u={options:i,explain:e=>e==="columnDefs"&&i.columnDefs!==t.options.columnDefs?{key:e,value:i.columnDefs,source:"Vue slots",layers:[...t.explain(e).layers,{name:"Vue slots",value:i.columnDefs}]}:t.explain(e)},u.options};return _vue.onMounted.call(void 0, ()=>{if(!f.value)return;let n=y();for(let t of _machtable.EVENT_TYPES){let i=P(t),e=n[i];n[i]=o=>{typeof e=="function"&&e(o),D(t,o)}}d=_machtable.createGrid.call(void 0, f.value,n)}),_vue.onBeforeUnmount.call(void 0, ()=>{_optionalChain([d, 'optionalAccess', _2 => _2.destroy, 'call', _3 => _3()]),d=null}),_vue.watch.call(void 0, ()=>{let n=y();return[..._adapter.GRID_OPTION_KEYS.map(t=>n[t])]},(n,t)=>{if(!d)return;let i={};n.forEach((e,o)=>{if(Object.is(e,t[o]))return;let x=_adapter.GRID_OPTION_KEYS[o];i[x]=e}),Object.keys(i).length>0&&d.updateOptions(i)}),s({getApi:()=>d,getResolvedConfig:()=>_nullishCoalesce(_optionalChain([u, 'optionalAccess', _4 => _4.options]), () => (y())),explainOption:n=>(_nullishCoalesce(u, () => (_chunk7LXDVLDDcjs.a.call(void 0, p.value,a.preset,{})))).explain(n)}),()=>_vue.h.call(void 0, "div",{...c,ref:f,class:["mach-vue-host",a.className,c.class]})}}),Y= exports.a =V;exports.a = Y;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunk7LXDVLDDcjs = require('./chunk-7LXDVLDD.cjs');var _chunkXECIDGIZcjs = require('./chunk-XECIDGIZ.cjs');var _vue = require('vue');var _machtable = require('@agile-team/mach-table');var _adapter = require('@agile-team/mach-table/adapter');var A=_adapter.GRID_OPTION_KEYS.filter(r=>!["className","ariaLabel","ariaLabelledBy","ariaDescribedBy"].includes(r)),l={};for(let r of A){let s=_adapter.GRID_OPTION_META[r].kind,p=s==="boolean"?Boolean:s==="number"?Number:s==="array"?Array:s==="function"?Function:s==="boolean-object"?[Boolean,Object]:s==="object"?Object:s==="string"?String:void 0;l[r]={type:p,default:void 0}}l.className={type:String,default:void 0};l.gridClassName={type:String,default:void 0};l.gridAriaLabel={type:String,default:void 0};l.gridAriaLabelledBy={type:String,default:void 0};l.gridAriaDescribedBy={type:String,default:void 0};l.preset={type:[String,Array,Boolean],default:void 0};function P(r){return"on"+r.charAt(0).toUpperCase()+r.slice(1)}var V=_vue.defineComponent.call(void 0, {name:"MachTable",inheritAttrs:!1,props:l,emits:[..._machtable.EVENT_TYPES],setup(r,{expose:s,attrs:p,emit:D,slots:M}){let a=r,f=_vue.ref.call(void 0, null),d=null,u=_chunk7LXDVLDDcjs.e.call(void 0, ),G=_chunkXECIDGIZcjs.i.call(void 0, M,_optionalChain([_vue.getCurrentInstance.call(void 0, ), 'optionalAccess', _ => _.appContext])),c=null,m=new Set,y=()=>{let n={};for(let e of A){let o=a[e];o!==void 0&&(n[e]=o)}a.gridClassName!==void 0&&(n.className=a.gridClassName),a.gridAriaLabel!==void 0&&(n.ariaLabel=a.gridAriaLabel),a.gridAriaLabelledBy!==void 0&&(n.ariaLabelledBy=a.gridAriaLabelledBy),a.gridAriaDescribedBy!==void 0&&(n.ariaDescribedBy=a.gridAriaDescribedBy);let t=_chunk7LXDVLDDcjs.a.call(void 0, u.value,a.preset,n,e=>{let o=`${e.code}:${_nullishCoalesce(e.preset, () => (""))}`;m.has(o)||(m.add(o),u.value.onConfigWarning?u.value.onConfigWarning(e):console.warn(e.message))}),i=G(t.options);return c={options:i,explain:e=>e==="columnDefs"&&i.columnDefs!==t.options.columnDefs?{key:e,value:i.columnDefs,source:"Vue slots",layers:[...t.explain(e).layers,{name:"Vue slots",value:i.columnDefs}]}:t.explain(e)},c.options};return _vue.onMounted.call(void 0, ()=>{if(!f.value)return;let n={...y()};for(let t of _machtable.EVENT_TYPES){let i=P(t);n[i]=e=>{let o=_optionalChain([c, 'optionalAccess', _2 => _2.options, 'optionalAccess', _3 => _3[i]]);try{typeof o=="function"&&o(e)}finally{D(t,e)}}}d=_machtable.createGrid.call(void 0, f.value,n)}),_vue.onBeforeUnmount.call(void 0, ()=>{_optionalChain([d, 'optionalAccess', _4 => _4.destroy, 'call', _5 => _5()]),d=null}),_vue.watch.call(void 0, ()=>{let n=y();return[..._adapter.GRID_OPTION_KEYS.map(t=>n[t])]},(n,t)=>{if(!d)return;let i={};n.forEach((e,o)=>{if(Object.is(e,t[o]))return;let x=_adapter.GRID_OPTION_KEYS[o];i[x]=e}),Object.keys(i).length>0&&d.updateOptions(i)}),s({getApi:()=>d,getResolvedConfig:()=>_nullishCoalesce(_optionalChain([c, 'optionalAccess', _6 => _6.options]), () => (y())),explainOption:n=>(_nullishCoalesce(c, () => (_chunk7LXDVLDDcjs.a.call(void 0, u.value,a.preset,{})))).explain(n)}),()=>_vue.h.call(void 0, "div",{...p,ref:f,class:["mach-vue-host",a.className,p.class]})}}),Y= exports.a =V;exports.a = Y;
@@ -0,0 +1 @@
1
+ import{b as t,c as n}from"./chunk-7MRR4IDI.js";function r(e,a,i={}){let c=n(i);e.provide(t,c);let o=e.component("MachTable");if(o&&o!==a)throw new Error('[MachTable] Cannot register global component "MachTable" because that name is already in use.');o||e.component("MachTable",a)}export{r as a};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7LXDVLDDcjs = require('./chunk-7LXDVLDD.cjs');function i(e,a,n={}){let r=_chunk7LXDVLDDcjs.c.call(void 0, n);e.provide(_chunk7LXDVLDDcjs.b,r);let o=e.component("MachTable");if(o&&o!==a)throw new Error('[MachTable] Cannot register global component "MachTable" because that name is already in use.');o||e.component("MachTable",a)}exports.a = i;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7LXDVLDDcjs = require('./chunk-7LXDVLDD.cjs');function r(e,a,i={}){let c=_chunk7LXDVLDDcjs.c.call(void 0, i);e.provide(_chunk7LXDVLDDcjs.b,c);let o=e.component("MachTable");if(o&&o!==a)throw new Error('[MachTable] Cannot register global component "MachTable" because that name is already in use.');o||e.component("MachTable",a)}exports.a = r;
@@ -1,11 +1,9 @@
1
1
  import { a as MachTable } from './MachTable-jS92BIXm.js';
2
- import { M as MachTableToolbar } from './MachTableToolbar-BUFcnsF4.js';
3
2
  import { MachTableRuntimeConfig } from '@agile-team/mach-table';
4
3
 
5
4
  declare module "vue" {
6
5
  interface GlobalComponents {
7
6
  MachTable: typeof MachTable;
8
- MachTableToolbar: typeof MachTableToolbar;
9
7
  }
10
8
  }
11
9
  type MachTablePluginOptions = MachTableRuntimeConfig;
@@ -1,11 +1,9 @@
1
1
  import { a as MachTable } from './MachTable-jS92BIXm.cjs';
2
- import { M as MachTableToolbar } from './MachTableToolbar-BUFcnsF4.cjs';
3
2
  import { MachTableRuntimeConfig } from '@agile-team/mach-table';
4
3
 
5
4
  declare module "vue" {
6
5
  interface GlobalComponents {
7
6
  MachTable: typeof MachTable;
8
- MachTableToolbar: typeof MachTableToolbar;
9
7
  }
10
8
  }
11
9
  type MachTablePluginOptions = MachTableRuntimeConfig;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkOFITMI6Jcjs = require('./chunk-OFITMI6J.cjs');var _chunkEGEQGM3Dcjs = require('./chunk-EGEQGM3D.cjs');var _chunk3LIWCBSPcjs = require('./chunk-3LIWCBSP.cjs');var _chunk7LXDVLDDcjs = require('./chunk-7LXDVLDD.cjs');require('./chunk-XECIDGIZ.cjs');var o={install(r,p){_chunkOFITMI6Jcjs.a.call(void 0, r,_chunk3LIWCBSPcjs.a,p)}};var _machtable = require('@agile-team/mach-table'); _createStarExport(_machtable);var m=o;exports.MACH_TABLE_CONFIG_KEY = _chunk7LXDVLDDcjs.b; exports.MachTable = _chunk3LIWCBSPcjs.a; exports.MachTablePlugin = o; exports.default = m; exports.provideMachTableConfig = _chunk7LXDVLDDcjs.d; exports.useMachTable = _chunkEGEQGM3Dcjs.a; exports.useMachTableConfig = _chunk7LXDVLDDcjs.e;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _chunkYQIRPQHTcjs = require('./chunk-YQIRPQHT.cjs');var _chunkEGEQGM3Dcjs = require('./chunk-EGEQGM3D.cjs');var _chunkJ3SALTBKcjs = require('./chunk-J3SALTBK.cjs');var _chunk7LXDVLDDcjs = require('./chunk-7LXDVLDD.cjs');require('./chunk-XECIDGIZ.cjs');var o={install(r,p){_chunkYQIRPQHTcjs.a.call(void 0, r,_chunkJ3SALTBKcjs.a,p)}};var _machtable = require('@agile-team/mach-table'); _createStarExport(_machtable);var m=o;exports.MACH_TABLE_CONFIG_KEY = _chunk7LXDVLDDcjs.b; exports.MachTable = _chunkJ3SALTBKcjs.a; exports.MachTablePlugin = o; exports.default = m; exports.provideMachTableConfig = _chunk7LXDVLDDcjs.d; exports.useMachTable = _chunkEGEQGM3Dcjs.a; exports.useMachTableConfig = _chunk7LXDVLDDcjs.e;
package/dist/index.d.cts CHANGED
@@ -1,11 +1,10 @@
1
1
  export { a as MachTable, M as MachTableVueComponent, b as MachTableVueExposed, c as MachTableVueProps } from './MachTable-jS92BIXm.cjs';
2
2
  import { App, InjectionKey, Ref } from 'vue';
3
- import { M as MachTablePluginOptions } from './globalRegistration-oxdZVSgD.cjs';
3
+ import { M as MachTablePluginOptions } from './globalRegistration-CRo5XbUX.cjs';
4
4
  export { U as UseMachTableReturn, u as useMachTable } from './useMachTable-YH4Xj6dS.cjs';
5
5
  import { MachTableRuntimeConfig } from '@agile-team/mach-table';
6
6
  export * from '@agile-team/mach-table';
7
7
  import { ResolvedMachTableConfig } from '@agile-team/mach-table/adapter';
8
- import './MachTableToolbar-BUFcnsF4.cjs';
9
8
 
10
9
  declare const MachTablePlugin: {
11
10
  install(app: App, options?: MachTablePluginOptions): void;
package/dist/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  export { a as MachTable, M as MachTableVueComponent, b as MachTableVueExposed, c as MachTableVueProps } from './MachTable-jS92BIXm.js';
2
2
  import { App, InjectionKey, Ref } from 'vue';
3
- import { M as MachTablePluginOptions } from './globalRegistration-bUvkfBzA.js';
3
+ import { M as MachTablePluginOptions } from './globalRegistration-Bsdv9yBs.js';
4
4
  export { U as UseMachTableReturn, u as useMachTable } from './useMachTable-DXGZxgIJ.js';
5
5
  import { MachTableRuntimeConfig } from '@agile-team/mach-table';
6
6
  export * from '@agile-team/mach-table';
7
7
  import { ResolvedMachTableConfig } from '@agile-team/mach-table/adapter';
8
- import './MachTableToolbar-BUFcnsF4.js';
9
8
 
10
9
  declare const MachTablePlugin: {
11
10
  install(app: App, options?: MachTablePluginOptions): void;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-CVSAWAOZ.js";import{a as b}from"./chunk-YTEW56VQ.js";import{a as e}from"./chunk-IS6G3WLH.js";import{b as t,d as l,e as i}from"./chunk-7MRR4IDI.js";import"./chunk-SQVY5G55.js";var o={install(r,p){a(r,e,p)}};export*from"@agile-team/mach-table";var m=o;export{t as MACH_TABLE_CONFIG_KEY,e as MachTable,o as MachTablePlugin,m as default,l as provideMachTableConfig,b as useMachTable,i as useMachTableConfig};
1
+ import{a}from"./chunk-Y4S6TCE5.js";import{a as b}from"./chunk-YTEW56VQ.js";import{a as e}from"./chunk-2ANGCJOO.js";import{b as t,d as l,e as i}from"./chunk-7MRR4IDI.js";import"./chunk-SQVY5G55.js";var o={install(r,p){a(r,e,p)}};export*from"@agile-team/mach-table";var m=o;export{t as MACH_TABLE_CONFIG_KEY,e as MachTable,o as MachTablePlugin,m as default,l as provideMachTableConfig,b as useMachTable,i as useMachTableConfig};
package/dist/ui.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _vue = require('vue');var b={search:!0,refresh:!0,columns:!0,density:!0,export:!0,undoRedo:!1,fullscreen:!1},r= exports.MachTableToolbar =_vue.defineComponent.call(void 0, {name:"MachTableToolbar",props:{api:{type:Object,default:null},commands:{type:Object,default:null},modelValue:{type:String,default:""},loading:{type:Boolean,default:!1},selectedCount:{type:Number,default:0},searchPlaceholder:{type:String,default:"\u641C\u7D22\u5F53\u524D\u7ED3\u679C"},exportFilename:{type:String,default:"mach-table.csv"},features:{type:Object,default:()=>({})}},emits:["update:modelValue","refresh","clearSelection"],setup(e,{emit:d,slots:s}){let c=a=>_nullishCoalesce(e.features[a], () => (b[a])),t=(a,...o)=>{let l=e.commands?Reflect.get(e.commands,a):void 0;return typeof l=="function"&&e.commands?Reflect.apply(l,e.commands,o):void 0},i=(a,o,l,h=!1)=>_vue.h.call(void 0, "button",{type:"button",class:"mach-toolbar__button",title:a,"aria-label":a,disabled:h,onClick:l},o),u=()=>{let a=[..._nullishCoalesce(_optionalChain([s, 'access', _ => _.start, 'optionalCall', _2 => _2()]), () => ([]))];return c("search")&&a.push(_vue.h.call(void 0, "label",{class:"mach-toolbar__search"},[_vue.h.call(void 0, "span",{class:"mach-sr-only"},e.searchPlaceholder),_vue.h.call(void 0, "span",{"aria-hidden":"true"},"\u2315"),_vue.h.call(void 0, "input",{value:e.modelValue,type:"search",placeholder:e.searchPlaceholder,onInput:o=>{let l=o.target.value;d("update:modelValue",l),e.commands?t("search",l||null):_optionalChain([e, 'access', _3 => _3.api, 'optionalAccess', _4 => _4.filtering, 'access', _5 => _5.setQuickText, 'call', _6 => _6(l||null)])}})])),c("refresh")&&a.push(i("\u5237\u65B0",e.loading?"\u2026":"\u21BB",()=>{d("refresh"),e.commands?t("refresh"):_optionalChain([e, 'access', _7 => _7.api, 'optionalAccess', _8 => _8.rows, 'access', _9 => _9.isRemote, 'call', _10 => _10()])?e.api.rows.reload():_optionalChain([e, 'access', _11 => _11.api, 'optionalAccess', _12 => _12.view, 'access', _13 => _13.refreshCells, 'call', _14 => _14()])},e.loading)),c("columns")&&a.push(i("\u5217\u8BBE\u7F6E","\u2637",o=>{let l=o.currentTarget;l instanceof HTMLElement&&(e.commands?t("openColumns",l):_optionalChain([e, 'access', _15 => _15.api, 'optionalAccess', _16 => _16.columns, 'access', _17 => _17.openWorkbench, 'call', _18 => _18(l)]))})),c("density")&&a.push(_vue.h.call(void 0, "select",{class:"mach-toolbar__select",value:_nullishCoalesce(_optionalChain([e, 'access', _19 => _19.api, 'optionalAccess', _20 => _20.getOption, 'call', _21 => _21("size")]), () => ("normal")),"aria-label":"\u8868\u683C\u5BC6\u5EA6",onChange:o=>{let l=o.target.value;e.commands?t("setDensity",l):_optionalChain([e, 'access', _22 => _22.api, 'optionalAccess', _23 => _23.updateOptions, 'call', _24 => _24({size:l})])}},[_vue.h.call(void 0, "option",{value:"compact"},"\u7D27\u51D1"),_vue.h.call(void 0, "option",{value:"normal"},"\u6807\u51C6"),_vue.h.call(void 0, "option",{value:"large"},"\u5BBD\u677E")])),a.push(..._nullishCoalesce(_optionalChain([s, 'access', _25 => _25.default, 'optionalCall', _26 => _26()]), () => ([]))),_vue.h.call(void 0, "div",{class:"mach-toolbar__main"},a)},m=()=>{let a=[];return e.selectedCount>0&&a.push(_vue.h.call(void 0, "button",{type:"button",class:"mach-toolbar__selection",onClick:()=>d("clearSelection")},`\u5DF2\u9009 ${e.selectedCount} \u9879 \xD7`)),c("undoRedo")&&(a.push(i("\u64A4\u9500","\u21B6",()=>{e.commands?t("undo"):_optionalChain([e, 'access', _27 => _27.api, 'optionalAccess', _28 => _28.editing, 'access', _29 => _29.undo, 'call', _30 => _30()])},e.commands?!e.commands.canUndo():!_optionalChain([e, 'access', _31 => _31.api, 'optionalAccess', _32 => _32.editing, 'access', _33 => _33.canUndo, 'call', _34 => _34()]))),a.push(i("\u91CD\u505A","\u21B7",()=>{e.commands?t("redo"):_optionalChain([e, 'access', _35 => _35.api, 'optionalAccess', _36 => _36.editing, 'access', _37 => _37.redo, 'call', _38 => _38()])},e.commands?!e.commands.canRedo():!_optionalChain([e, 'access', _39 => _39.api, 'optionalAccess', _40 => _40.editing, 'access', _41 => _41.canRedo, 'call', _42 => _42()])))),c("export")&&a.push(i("\u5BFC\u51FA CSV","\u21E9",()=>{e.commands&&t("exportCsv",e.exportFilename)},!e.commands)),c("fullscreen")&&a.push(i("\u5168\u5C4F","\u26F6",()=>{t("toggleFullscreen")},!e.commands)),a.push(..._nullishCoalesce(_optionalChain([s, 'access', _43 => _43.end, 'optionalCall', _44 => _44()]), () => ([]))),_vue.h.call(void 0, "div",{class:"mach-toolbar__aside"},a)};return()=>_vue.h.call(void 0, "div",{class:"mach-toolbar",role:"toolbar","aria-label":"\u8868\u683C\u5DE5\u5177\u680F"},[u(),m()])}});var T={install(e){e.component("MachTableToolbar")||e.component("MachTableToolbar",r)}};var p=T;exports.MachTableToolbar = r; exports.MachTableUiPlugin = T; exports.default = p;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _vue = require('vue');var f={search:!0,refresh:!0,columns:!0,density:!0,export:!0,undoRedo:!1,fullscreen:!1},s= exports.MachTableToolbar =_vue.defineComponent.call(void 0, {name:"MachTableToolbar",props:{api:{type:Object,default:null},commands:{type:Object,default:null},modelValue:{type:String,default:""},loading:{type:Boolean,default:!1},selectedCount:{type:Number,default:0},searchPlaceholder:{type:String,default:"\u641C\u7D22\u5F53\u524D\u7ED3\u679C"},exportFilename:{type:String,default:"mach-table.csv"},features:{type:Object,default:()=>({})}},emits:["update:modelValue","refresh","clearSelection"],setup(e,{emit:d,slots:r}){let c=a=>_nullishCoalesce(e.features[a], () => (f[a])),t=(a,...n)=>{let l=e.commands?Reflect.get(e.commands,a):void 0;return typeof l=="function"&&e.commands?Reflect.apply(l,e.commands,n):void 0},i=(a,n,l,h=!1)=>_vue.h.call(void 0, "button",{type:"button",class:"mach-toolbar__button",title:a,"aria-label":a,disabled:h,onClick:l},n),u=()=>{let a=[..._nullishCoalesce(_optionalChain([r, 'access', _ => _.start, 'optionalCall', _2 => _2()]), () => ([]))];return c("search")&&a.push(_vue.h.call(void 0, "label",{class:"mach-toolbar__search"},[_vue.h.call(void 0, "span",{class:"mach-sr-only"},e.searchPlaceholder),_vue.h.call(void 0, "span",{"aria-hidden":"true"},"\u2315"),_vue.h.call(void 0, "input",{value:e.modelValue,type:"search",placeholder:e.searchPlaceholder,onInput:n=>{let l=n.target.value;d("update:modelValue",l),e.commands?t("search",l||null):_optionalChain([e, 'access', _3 => _3.api, 'optionalAccess', _4 => _4.filtering, 'access', _5 => _5.setQuickText, 'call', _6 => _6(l||null)])}})])),c("refresh")&&a.push(i("\u5237\u65B0",e.loading?"\u2026":"\u21BB",()=>{d("refresh"),e.commands?t("refresh"):_optionalChain([e, 'access', _7 => _7.api, 'optionalAccess', _8 => _8.rows, 'access', _9 => _9.isRemote, 'call', _10 => _10()])?e.api.rows.reload():_optionalChain([e, 'access', _11 => _11.api, 'optionalAccess', _12 => _12.view, 'access', _13 => _13.refreshCells, 'call', _14 => _14()])},e.loading)),c("columns")&&a.push(i("\u5217\u8BBE\u7F6E","\u2637",n=>{let l=n.currentTarget;l instanceof HTMLElement&&(e.commands?t("openColumns",l):_optionalChain([e, 'access', _15 => _15.api, 'optionalAccess', _16 => _16.columns, 'access', _17 => _17.openWorkbench, 'call', _18 => _18(l)]))})),c("density")&&a.push(_vue.h.call(void 0, "select",{class:"mach-toolbar__select",value:_nullishCoalesce(_optionalChain([e, 'access', _19 => _19.api, 'optionalAccess', _20 => _20.getOption, 'call', _21 => _21("size")]), () => ("normal")),"aria-label":"\u8868\u683C\u5BC6\u5EA6",onChange:n=>{let l=n.target.value;e.commands?t("setDensity",l):_optionalChain([e, 'access', _22 => _22.api, 'optionalAccess', _23 => _23.updateOptions, 'call', _24 => _24({size:l})])}},[_vue.h.call(void 0, "option",{value:"compact"},"\u7D27\u51D1"),_vue.h.call(void 0, "option",{value:"normal"},"\u6807\u51C6"),_vue.h.call(void 0, "option",{value:"large"},"\u5BBD\u677E")])),a.push(..._nullishCoalesce(_optionalChain([r, 'access', _25 => _25.default, 'optionalCall', _26 => _26()]), () => ([]))),_vue.h.call(void 0, "div",{class:"mach-toolbar__main"},a)},m=()=>{let a=[];return e.selectedCount>0&&a.push(_vue.h.call(void 0, "button",{type:"button",class:"mach-toolbar__selection",onClick:()=>d("clearSelection")},`\u5DF2\u9009 ${e.selectedCount} \u9879 \xD7`)),c("undoRedo")&&(a.push(i("\u64A4\u9500","\u21B6",()=>{e.commands?t("undo"):_optionalChain([e, 'access', _27 => _27.api, 'optionalAccess', _28 => _28.editing, 'access', _29 => _29.undo, 'call', _30 => _30()])},e.commands?!e.commands.canUndo():!_optionalChain([e, 'access', _31 => _31.api, 'optionalAccess', _32 => _32.editing, 'access', _33 => _33.canUndo, 'call', _34 => _34()]))),a.push(i("\u91CD\u505A","\u21B7",()=>{e.commands?t("redo"):_optionalChain([e, 'access', _35 => _35.api, 'optionalAccess', _36 => _36.editing, 'access', _37 => _37.redo, 'call', _38 => _38()])},e.commands?!e.commands.canRedo():!_optionalChain([e, 'access', _39 => _39.api, 'optionalAccess', _40 => _40.editing, 'access', _41 => _41.canRedo, 'call', _42 => _42()])))),c("export")&&a.push(i("\u5BFC\u51FA CSV","\u21E9",()=>{e.commands&&t("exportCsv",e.exportFilename)},!e.commands)),c("fullscreen")&&a.push(i("\u5168\u5C4F","\u26F6",()=>{t("toggleFullscreen")},!e.commands)),a.push(..._nullishCoalesce(_optionalChain([r, 'access', _43 => _43.end, 'optionalCall', _44 => _44()]), () => ([]))),_vue.h.call(void 0, "div",{class:"mach-toolbar__aside"},a)};return()=>_vue.h.call(void 0, "div",{class:"mach-toolbar",role:"toolbar","aria-label":"\u8868\u683C\u5DE5\u5177\u680F"},[u(),m()])}});var T={install(e){e.component("MachTableToolbar")||e.component("MachTableToolbar",s)}};var p=T;exports.MachTableToolbar = s; exports.MachTableUiPlugin = T; exports.default = p;
package/dist/ui.d.cts CHANGED
@@ -1,10 +1,107 @@
1
- import { App } from 'vue';
2
- export { M as MachTableToolbar, a as MachTableToolbarFeatures } from './MachTableToolbar-BUFcnsF4.cjs';
3
- import '@agile-team/mach-table';
1
+ import * as vue from 'vue';
2
+ import { PropType, App } from 'vue';
3
+ import { GridApi, MachTableCommands } from '@agile-team/mach-table';
4
4
 
5
+ interface MachTableToolbarFeatures {
6
+ search?: boolean;
7
+ refresh?: boolean;
8
+ columns?: boolean;
9
+ density?: boolean;
10
+ export?: boolean;
11
+ undoRedo?: boolean;
12
+ fullscreen?: boolean;
13
+ }
14
+ declare const MachTableToolbar: vue.DefineComponent<vue.ExtractPropTypes<{
15
+ api: {
16
+ type: PropType<GridApi<any> | null>;
17
+ default: null;
18
+ };
19
+ commands: {
20
+ type: PropType<MachTableCommands | null>;
21
+ default: null;
22
+ };
23
+ modelValue: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ loading: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ selectedCount: {
32
+ type: NumberConstructor;
33
+ default: number;
34
+ };
35
+ searchPlaceholder: {
36
+ type: StringConstructor;
37
+ default: string;
38
+ };
39
+ exportFilename: {
40
+ type: StringConstructor;
41
+ default: string;
42
+ };
43
+ features: {
44
+ type: PropType<MachTableToolbarFeatures>;
45
+ default: () => {};
46
+ };
47
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
48
+ [key: string]: any;
49
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("refresh" | "update:modelValue" | "clearSelection")[], "refresh" | "update:modelValue" | "clearSelection", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
50
+ api: {
51
+ type: PropType<GridApi<any> | null>;
52
+ default: null;
53
+ };
54
+ commands: {
55
+ type: PropType<MachTableCommands | null>;
56
+ default: null;
57
+ };
58
+ modelValue: {
59
+ type: StringConstructor;
60
+ default: string;
61
+ };
62
+ loading: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
66
+ selectedCount: {
67
+ type: NumberConstructor;
68
+ default: number;
69
+ };
70
+ searchPlaceholder: {
71
+ type: StringConstructor;
72
+ default: string;
73
+ };
74
+ exportFilename: {
75
+ type: StringConstructor;
76
+ default: string;
77
+ };
78
+ features: {
79
+ type: PropType<MachTableToolbarFeatures>;
80
+ default: () => {};
81
+ };
82
+ }>> & Readonly<{
83
+ onRefresh?: ((...args: any[]) => any) | undefined;
84
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
85
+ onClearSelection?: ((...args: any[]) => any) | undefined;
86
+ }>, {
87
+ loading: boolean;
88
+ features: MachTableToolbarFeatures;
89
+ selectedCount: number;
90
+ api: GridApi<any> | null;
91
+ commands: MachTableCommands | null;
92
+ modelValue: string;
93
+ searchPlaceholder: string;
94
+ exportFilename: string;
95
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
96
+
97
+ declare module "vue" {
98
+ interface GlobalComponents {
99
+ MachTableToolbar: typeof MachTableToolbar;
100
+ }
101
+ }
5
102
  /** Optional UI layer. Install once only when the standard toolbar is desired. */
6
103
  declare const MachTableUiPlugin: {
7
104
  install(app: App): void;
8
105
  };
9
106
 
10
- export { MachTableUiPlugin, MachTableUiPlugin as default };
107
+ export { MachTableToolbar, type MachTableToolbarFeatures, MachTableUiPlugin, MachTableUiPlugin as default };
package/dist/ui.d.ts CHANGED
@@ -1,10 +1,107 @@
1
- import { App } from 'vue';
2
- export { M as MachTableToolbar, a as MachTableToolbarFeatures } from './MachTableToolbar-BUFcnsF4.js';
3
- import '@agile-team/mach-table';
1
+ import * as vue from 'vue';
2
+ import { PropType, App } from 'vue';
3
+ import { GridApi, MachTableCommands } from '@agile-team/mach-table';
4
4
 
5
+ interface MachTableToolbarFeatures {
6
+ search?: boolean;
7
+ refresh?: boolean;
8
+ columns?: boolean;
9
+ density?: boolean;
10
+ export?: boolean;
11
+ undoRedo?: boolean;
12
+ fullscreen?: boolean;
13
+ }
14
+ declare const MachTableToolbar: vue.DefineComponent<vue.ExtractPropTypes<{
15
+ api: {
16
+ type: PropType<GridApi<any> | null>;
17
+ default: null;
18
+ };
19
+ commands: {
20
+ type: PropType<MachTableCommands | null>;
21
+ default: null;
22
+ };
23
+ modelValue: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ loading: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ selectedCount: {
32
+ type: NumberConstructor;
33
+ default: number;
34
+ };
35
+ searchPlaceholder: {
36
+ type: StringConstructor;
37
+ default: string;
38
+ };
39
+ exportFilename: {
40
+ type: StringConstructor;
41
+ default: string;
42
+ };
43
+ features: {
44
+ type: PropType<MachTableToolbarFeatures>;
45
+ default: () => {};
46
+ };
47
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
48
+ [key: string]: any;
49
+ }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("refresh" | "update:modelValue" | "clearSelection")[], "refresh" | "update:modelValue" | "clearSelection", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
50
+ api: {
51
+ type: PropType<GridApi<any> | null>;
52
+ default: null;
53
+ };
54
+ commands: {
55
+ type: PropType<MachTableCommands | null>;
56
+ default: null;
57
+ };
58
+ modelValue: {
59
+ type: StringConstructor;
60
+ default: string;
61
+ };
62
+ loading: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ };
66
+ selectedCount: {
67
+ type: NumberConstructor;
68
+ default: number;
69
+ };
70
+ searchPlaceholder: {
71
+ type: StringConstructor;
72
+ default: string;
73
+ };
74
+ exportFilename: {
75
+ type: StringConstructor;
76
+ default: string;
77
+ };
78
+ features: {
79
+ type: PropType<MachTableToolbarFeatures>;
80
+ default: () => {};
81
+ };
82
+ }>> & Readonly<{
83
+ onRefresh?: ((...args: any[]) => any) | undefined;
84
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
85
+ onClearSelection?: ((...args: any[]) => any) | undefined;
86
+ }>, {
87
+ loading: boolean;
88
+ features: MachTableToolbarFeatures;
89
+ selectedCount: number;
90
+ api: GridApi<any> | null;
91
+ commands: MachTableCommands | null;
92
+ modelValue: string;
93
+ searchPlaceholder: string;
94
+ exportFilename: string;
95
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
96
+
97
+ declare module "vue" {
98
+ interface GlobalComponents {
99
+ MachTableToolbar: typeof MachTableToolbar;
100
+ }
101
+ }
5
102
  /** Optional UI layer. Install once only when the standard toolbar is desired. */
6
103
  declare const MachTableUiPlugin: {
7
104
  install(app: App): void;
8
105
  };
9
106
 
10
- export { MachTableUiPlugin, MachTableUiPlugin as default };
107
+ export { MachTableToolbar, type MachTableToolbarFeatures, MachTableUiPlugin, MachTableUiPlugin as default };
package/dist/ui.js CHANGED
@@ -1 +1 @@
1
- import{defineComponent as f,h as n}from"vue";var b={search:!0,refresh:!0,columns:!0,density:!0,export:!0,undoRedo:!1,fullscreen:!1},r=f({name:"MachTableToolbar",props:{api:{type:Object,default:null},commands:{type:Object,default:null},modelValue:{type:String,default:""},loading:{type:Boolean,default:!1},selectedCount:{type:Number,default:0},searchPlaceholder:{type:String,default:"\u641C\u7D22\u5F53\u524D\u7ED3\u679C"},exportFilename:{type:String,default:"mach-table.csv"},features:{type:Object,default:()=>({})}},emits:["update:modelValue","refresh","clearSelection"],setup(e,{emit:d,slots:s}){let c=a=>e.features[a]??b[a],t=(a,...o)=>{let l=e.commands?Reflect.get(e.commands,a):void 0;return typeof l=="function"&&e.commands?Reflect.apply(l,e.commands,o):void 0},i=(a,o,l,h=!1)=>n("button",{type:"button",class:"mach-toolbar__button",title:a,"aria-label":a,disabled:h,onClick:l},o),u=()=>{let a=[...s.start?.()??[]];return c("search")&&a.push(n("label",{class:"mach-toolbar__search"},[n("span",{class:"mach-sr-only"},e.searchPlaceholder),n("span",{"aria-hidden":"true"},"\u2315"),n("input",{value:e.modelValue,type:"search",placeholder:e.searchPlaceholder,onInput:o=>{let l=o.target.value;d("update:modelValue",l),e.commands?t("search",l||null):e.api?.filtering.setQuickText(l||null)}})])),c("refresh")&&a.push(i("\u5237\u65B0",e.loading?"\u2026":"\u21BB",()=>{d("refresh"),e.commands?t("refresh"):e.api?.rows.isRemote()?e.api.rows.reload():e.api?.view.refreshCells()},e.loading)),c("columns")&&a.push(i("\u5217\u8BBE\u7F6E","\u2637",o=>{let l=o.currentTarget;l instanceof HTMLElement&&(e.commands?t("openColumns",l):e.api?.columns.openWorkbench(l))})),c("density")&&a.push(n("select",{class:"mach-toolbar__select",value:e.api?.getOption("size")??"normal","aria-label":"\u8868\u683C\u5BC6\u5EA6",onChange:o=>{let l=o.target.value;e.commands?t("setDensity",l):e.api?.updateOptions({size:l})}},[n("option",{value:"compact"},"\u7D27\u51D1"),n("option",{value:"normal"},"\u6807\u51C6"),n("option",{value:"large"},"\u5BBD\u677E")])),a.push(...s.default?.()??[]),n("div",{class:"mach-toolbar__main"},a)},m=()=>{let a=[];return e.selectedCount>0&&a.push(n("button",{type:"button",class:"mach-toolbar__selection",onClick:()=>d("clearSelection")},`\u5DF2\u9009 ${e.selectedCount} \u9879 \xD7`)),c("undoRedo")&&(a.push(i("\u64A4\u9500","\u21B6",()=>{e.commands?t("undo"):e.api?.editing.undo()},e.commands?!e.commands.canUndo():!e.api?.editing.canUndo())),a.push(i("\u91CD\u505A","\u21B7",()=>{e.commands?t("redo"):e.api?.editing.redo()},e.commands?!e.commands.canRedo():!e.api?.editing.canRedo()))),c("export")&&a.push(i("\u5BFC\u51FA CSV","\u21E9",()=>{e.commands&&t("exportCsv",e.exportFilename)},!e.commands)),c("fullscreen")&&a.push(i("\u5168\u5C4F","\u26F6",()=>{t("toggleFullscreen")},!e.commands)),a.push(...s.end?.()??[]),n("div",{class:"mach-toolbar__aside"},a)};return()=>n("div",{class:"mach-toolbar",role:"toolbar","aria-label":"\u8868\u683C\u5DE5\u5177\u680F"},[u(),m()])}});var T={install(e){e.component("MachTableToolbar")||e.component("MachTableToolbar",r)}};var p=T;export{r as MachTableToolbar,T as MachTableUiPlugin,p as default};
1
+ import{defineComponent as b,h as o}from"vue";var f={search:!0,refresh:!0,columns:!0,density:!0,export:!0,undoRedo:!1,fullscreen:!1},s=b({name:"MachTableToolbar",props:{api:{type:Object,default:null},commands:{type:Object,default:null},modelValue:{type:String,default:""},loading:{type:Boolean,default:!1},selectedCount:{type:Number,default:0},searchPlaceholder:{type:String,default:"\u641C\u7D22\u5F53\u524D\u7ED3\u679C"},exportFilename:{type:String,default:"mach-table.csv"},features:{type:Object,default:()=>({})}},emits:["update:modelValue","refresh","clearSelection"],setup(e,{emit:d,slots:r}){let c=a=>e.features[a]??f[a],t=(a,...n)=>{let l=e.commands?Reflect.get(e.commands,a):void 0;return typeof l=="function"&&e.commands?Reflect.apply(l,e.commands,n):void 0},i=(a,n,l,h=!1)=>o("button",{type:"button",class:"mach-toolbar__button",title:a,"aria-label":a,disabled:h,onClick:l},n),u=()=>{let a=[...r.start?.()??[]];return c("search")&&a.push(o("label",{class:"mach-toolbar__search"},[o("span",{class:"mach-sr-only"},e.searchPlaceholder),o("span",{"aria-hidden":"true"},"\u2315"),o("input",{value:e.modelValue,type:"search",placeholder:e.searchPlaceholder,onInput:n=>{let l=n.target.value;d("update:modelValue",l),e.commands?t("search",l||null):e.api?.filtering.setQuickText(l||null)}})])),c("refresh")&&a.push(i("\u5237\u65B0",e.loading?"\u2026":"\u21BB",()=>{d("refresh"),e.commands?t("refresh"):e.api?.rows.isRemote()?e.api.rows.reload():e.api?.view.refreshCells()},e.loading)),c("columns")&&a.push(i("\u5217\u8BBE\u7F6E","\u2637",n=>{let l=n.currentTarget;l instanceof HTMLElement&&(e.commands?t("openColumns",l):e.api?.columns.openWorkbench(l))})),c("density")&&a.push(o("select",{class:"mach-toolbar__select",value:e.api?.getOption("size")??"normal","aria-label":"\u8868\u683C\u5BC6\u5EA6",onChange:n=>{let l=n.target.value;e.commands?t("setDensity",l):e.api?.updateOptions({size:l})}},[o("option",{value:"compact"},"\u7D27\u51D1"),o("option",{value:"normal"},"\u6807\u51C6"),o("option",{value:"large"},"\u5BBD\u677E")])),a.push(...r.default?.()??[]),o("div",{class:"mach-toolbar__main"},a)},m=()=>{let a=[];return e.selectedCount>0&&a.push(o("button",{type:"button",class:"mach-toolbar__selection",onClick:()=>d("clearSelection")},`\u5DF2\u9009 ${e.selectedCount} \u9879 \xD7`)),c("undoRedo")&&(a.push(i("\u64A4\u9500","\u21B6",()=>{e.commands?t("undo"):e.api?.editing.undo()},e.commands?!e.commands.canUndo():!e.api?.editing.canUndo())),a.push(i("\u91CD\u505A","\u21B7",()=>{e.commands?t("redo"):e.api?.editing.redo()},e.commands?!e.commands.canRedo():!e.api?.editing.canRedo()))),c("export")&&a.push(i("\u5BFC\u51FA CSV","\u21E9",()=>{e.commands&&t("exportCsv",e.exportFilename)},!e.commands)),c("fullscreen")&&a.push(i("\u5168\u5C4F","\u26F6",()=>{t("toggleFullscreen")},!e.commands)),a.push(...r.end?.()??[]),o("div",{class:"mach-toolbar__aside"},a)};return()=>o("div",{class:"mach-toolbar",role:"toolbar","aria-label":"\u8868\u683C\u5DE5\u5177\u680F"},[u(),m()])}});var T={install(e){e.component("MachTableToolbar")||e.component("MachTableToolbar",s)}};var p=T;export{s as MachTableToolbar,T as MachTableUiPlugin,p as default};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkEGEQGM3Dcjs = require('./chunk-EGEQGM3D.cjs');var _vue = require('vue');var _machtable = require('@agile-team/mach-table');function j(a,n={}){let p=_vue.shallowRef.call(void 0, []),o=_vue.ref.call(void 0, []),d=_vue.ref.call(void 0, !1),h=_vue.shallowRef.call(void 0, null),f=_vue.shallowRef.call(void 0, null),b=_vue.computed.call(void 0, ()=>o.value.length>0),R=_vue.computed.call(void 0, ()=>[..._nullishCoalesce(_optionalChain([f, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.failures]), () => ([])),..._nullishCoalesce(_optionalChain([f, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.conflicts]), () => ([]))]),D=_vue.computed.call(void 0, ()=>[...new Set(R.value.map(r=>r.rowId))]),S=null,m=()=>{let r=a.api.value;if(!r||r.isDestroyed()){o.value=[],p.value=[];return}o.value=r.editing.getDirtyRowIds(),p.value=r.editing.getChanges()};_vue.watch.call(void 0, a.api,r=>{_optionalChain([S, 'optionalCall', _6 => _6()]),S=null,m(),!(!r||r.isDestroyed())&&(S=r.on("dirtyStateChanged",m))},{immediate:!0});let g=async(r,u)=>{let v=a.api.value;if(!v||v.isDestroyed())throw new Error("[MachTable] Cannot save before the grid is ready.");if(d.value)throw new Error("[MachTable] A save operation is already in progress.");d.value=!0,h.value=null,f.value=null;try{let c=await v.editing.save(r,u);return f.value=c,m(),_optionalChain([n, 'access', _7 => _7.onSaveSuccess, 'optionalCall', _8 => _8(c.saved)]),_optionalChain([n, 'access', _9 => _9.onSaveResult, 'optionalCall', _10 => _10(c)]),c}catch(c){throw h.value=c,_optionalChain([n, 'access', _11 => _11.onSaveError, 'optionalCall', _12 => _12(c)]),c}finally{d.value=!1}},T=async(r,u)=>(await g(r,u)).saved,l=()=>{f.value=null},O=(r,u)=>{let v=f.value,c=_optionalChain([v, 'optionalAccess', _13 => _13.conflicts, 'access', _14 => _14.find, 'call', _15 => _15(C=>C.rowId===r)]),y=a.api.value;return!v||!c||!y||!_machtable.resolveSaveConflict.call(void 0, y,c,u)?!1:(f.value={...v,failures:v.failures,conflicts:v.conflicts.filter(C=>C.rowId!==r)},m(),!0)},z=r=>{let u=_nullishCoalesce(_optionalChain([a, 'access', _16 => _16.api, 'access', _17 => _17.value, 'optionalAccess', _18 => _18.editing, 'access', _19 => _19.rollback, 'call', _20 => _20(r)]), () => (!1));return m(),u},x=r=>{_optionalChain([a, 'access', _21 => _21.api, 'access', _22 => _22.value, 'optionalAccess', _23 => _23.editing, 'access', _24 => _24.markSaved, 'call', _25 => _25(r)]),m()},w=(r,u,v=!1)=>{let c=a.api.value,y=_optionalChain([c, 'optionalAccess', _26 => _26.rows, 'access', _27 => _27.getById, 'call', _28 => _28(r)]);return!c||!y||y.rowIndex<0?!1:(c.view.scrollToRow(y.rowIndex,"middle"),u&&v?c.editing.startCell({rowIndex:y.rowIndex,colId:u}):!0)},I=r=>{if(!b.value)return;let u=_nullishCoalesce(n.beforeUnloadMessage, () => ("\u5B58\u5728\u672A\u4FDD\u5B58\u7684\u8868\u683C\u4FEE\u6539\u3002"));return r.preventDefault(),r.returnValue=u,u};return n.guardBeforeUnload&&typeof window<"u"&&window.addEventListener("beforeunload",I),_vue.onScopeDispose.call(void 0, ()=>{_optionalChain([S, 'optionalCall', _29 => _29()]),S=null,n.guardBeforeUnload&&typeof window<"u"&&window.removeEventListener("beforeunload",I)}),{changes:p,dirtyRowIds:o,dirty:b,saving:d,saveError:h,lastSaveResult:f,saveIssues:R,failedRowIds:D,save:T,saveDetailed:g,clearSaveIssues:l,resolveConflict:O,rollback:z,markSaved:x,reveal:w,refresh:m}}function re(a){return typeof a=="function"?a():_vue.isRef.call(void 0, a)?a.value:a}function J(a,n){return typeof a=="number"&&Number.isFinite(a)&&a>0?Math.floor(a):n}function De(a){return(a instanceof DOMException||typeof a=="object"&&a!=null&&"name"in a)&&a.name==="AbortError"}function W(a){let n=_vue.shallowRef.call(void 0, []),p=_vue.ref.call(void 0, !1),o=_vue.shallowRef.call(void 0, null),d=_vue.ref.call(void 0, J(a.initialPage,1)),h=_vue.ref.call(void 0, J(a.pageSize,20)),f=_vue.ref.call(void 0, 0),b=_vue.shallowRef.call(void 0, []),R=_vue.shallowRef.call(void 0, {}),D=_vue.shallowRef.call(void 0, null),S=_vue.ref.call(void 0, []),m=_vue.shallowRef.call(void 0, []),g=new Set,T=new Set,l=new Map,O=_nullishCoalesce(a.quickFilterText, () => (_vue.ref.call(void 0, null))),z=_nullishCoalesce(a.selectionScope, () => ("preserve")),x=a.mode!=="manual",w=_vue.ref.call(void 0, !1),I=_vue.ref.call(void 0, 0),r=[...new Set((_nullishCoalesce(a.pageSizeOptions, () => ([10,20,50,100]))).map(e=>J(e,0)).filter(Boolean))];r.includes(h.value)||r.push(h.value),r.sort((e,t)=>e-t);let u=null,v=null,c=0,y=null,C=!1,q=!1,B=!1,M=e=>{let t=typeof a.rowKey=="function"?a.rowKey(e):_machtable.getByPath.call(void 0, e,a.rowKey);if(t==null||String(t).length===0)throw new Error(`[MachTable] useMachTableQuery rowKey "${String(a.rowKey)}" returned an empty value.`);return String(t)},P=()=>{B=!0,S.value=w.value?[]:[...g],B=!1;let e=w.value?[...l.keys()]:[...g];m.value=e.flatMap(t=>{let i=l.get(t);return i===void 0||T.has(t)?[]:[i]}),I.value++},L=e=>w.value?!T.has(e):g.has(e),F=()=>{if(!u||u.isDestroyed())return;let e=n.value.filter(t=>L(M(t)));q=!0;try{u.selection.setRows(e,!0)}finally{q=!1}},Y=()=>{c++,_optionalChain([v, 'optionalAccess', _30 => _30.abort, 'call', _31 => _31()]),v=null,y!=null&&clearTimeout(y),y=null,p.value=!1},Z=(e,t)=>e.signal.aborted||t!==c,ne=e=>{if(!e||!Array.isArray(e.rows)||!Number.isFinite(e.total)||e.total<0)throw new TypeError("[MachTable] Remote request must resolve to { rows: TData[], total: non-negative number }.")},oe=async(e,t,i)=>{if(Z(t,i))return;ne(e);let s=[...e.rows];for(let U of s)M(U);n.value=s,f.value=Math.floor(e.total);for(let U of n.value){let H=M(U);L(H)?l.set(H,U):l.delete(H)}P(),_optionalChain([a, 'access', _32 => _32.onSuccess, 'optionalCall', _33 => _33(e)]),await _vue.nextTick.call(void 0, ),F()},ie=(e,t,i)=>{Z(t,i)||De(e)||(o.value=_nullishCoalesce(e, () => (new Error)),_optionalChain([a, 'access', _34 => _34.onError, 'optionalCall', _35 => _35(o.value)]))},Q=async()=>{y!=null&&clearTimeout(y),y=null,_optionalChain([v, 'optionalAccess', _36 => _36.abort, 'call', _37 => _37()]);let e=new AbortController;v=e;let t=++c;p.value=!0,o.value=null,a.keepPreviousData===!1&&(n.value=[]);try{let i=await a.request({page:d.value,pageSize:h.value,query:re(a.query),sortModel:b.value.map(s=>({...s})),filterModel:{...R.value},advancedFilterModel:_machtable.normalizeAdvancedFilterModel.call(void 0, D.value),quickFilterText:O.value,signal:e.signal});await oe(i,e,t)}catch(i){ie(i,e,t)}finally{t===c&&(p.value=!1,v===e&&(v=null))}},K=e=>{e&&(d.value=1),y!=null&&clearTimeout(y),v&&(c++,v.abort(),v=null,p.value=!1);let t=Math.max(0,_nullishCoalesce(a.debounceMs, () => (0)));if(t===0){Q();return}y=setTimeout(()=>{Q()},t)},se=e=>{u=e.api,_vue.nextTick.call(void 0, F)},ue=e=>{C||e.page===d.value&&e.pageSize===h.value||(d.value=e.page,h.value=e.pageSize,x&&Q())},ce=e=>{C||(b.value=e.sortModel.map(t=>({...t})),x?K(!0):d.value=1)},de=e=>{C||(R.value={...e.filterModel},D.value=_machtable.normalizeAdvancedFilterModel.call(void 0, e.advancedFilterModel),a.clearSelectionOnQueryChange!==!1&&A(),x?K(!0):d.value=1)},ve=e=>{if(q)return;let t=new Set(n.value.map(M)),i=new Set(e.selectedRows.map(M));if(w.value){for(let s of t)i.has(s)?T.delete(s):(T.add(s),l.delete(s));for(let s of e.selectedRows)l.set(M(s),s);P();return}if(z==="page")g.clear(),l.clear();else for(let s of t)g.delete(s),l.delete(s);for(let s of e.selectedRows){let U=M(s);g.add(U),l.set(U,s)}P()},fe=_vue.computed.call(void 0, ()=>({rowData:n.value,loading:p.value,rowKey:M,manualSorting:!0,manualFiltering:!0,advancedFilterModel:D.value,quickFilterText:O.value,error:o.value,overlayErrorTemplate:o.value?()=>_nullishCoalesce(_optionalChain([a, 'access', _38 => _38.errorOverlay, 'optionalCall', _39 => _39({error:o.value,retry:Q})]), () => ("Remote request failed. Please retry.")):void 0,overlayNoRowsTemplate:a.emptyOverlay,pagination:{mode:"server",page:d.value,pageSize:h.value,pageSizeOptions:r,total:f.value,showTotal:!0,showPageSizeSelector:!0},onGridReady:se,onPaginationChanged:ue,onSortChanged:ce,onFilterChanged:de,onSelectionChanged:ve})),ge=async(e={})=>{e.resetPage&&(d.value=1),await Q()},ye=async()=>{d.value=1,b.value=[],R.value={},D.value=null,A(),C=!0;try{_optionalChain([u, 'optionalAccess', _40 => _40.sorting, 'access', _41 => _41.setModel, 'call', _42 => _42(null)]),_optionalChain([u, 'optionalAccess', _43 => _43.filtering, 'access', _44 => _44.setModel, 'call', _45 => _45(null)]),_optionalChain([u, 'optionalAccess', _46 => _46.filtering, 'access', _47 => _47.setAdvancedModel, 'call', _48 => _48(null)])}finally{C=!1}await Q()},A=()=>{w.value=!1,g.clear(),T.clear(),l.clear(),P(),q=!0;try{_optionalChain([u, 'optionalAccess', _49 => _49.selection, 'access', _50 => _50.clear, 'call', _51 => _51()])}finally{q=!1}},he=()=>{w.value=!0,g.clear(),T.clear(),l.clear();for(let e of n.value)l.set(M(e),e);P(),F()},pe=e=>{g.clear(),T.clear(),l.clear(),w.value=e.mode==="allMatching";let t=e.mode==="allMatching"?e.excludedKeys:e.selectedKeys;for(let i of t.map(String))e.mode==="allMatching"?T.add(i):g.add(i);for(let i of n.value){let s=M(i);L(s)&&l.set(s,i)}P(),F()},Te=_vue.computed.call(void 0, ()=>(I.value,w.value?{mode:"allMatching",excludedKeys:[...T]}:{mode:"explicit",selectedKeys:[...g]}));return _vue.watch.call(void 0, ()=>re(a.query),()=>{a.clearSelectionOnQueryChange!==!1&&A(),x?K(!0):d.value=1},{deep:!0,immediate:x&&a.immediate!==!1}),_vue.watch.call(void 0, O,()=>{a.clearSelectionOnQueryChange!==!1&&A(),x?K(!0):d.value=1}),_vue.watch.call(void 0, S,e=>{if(B)return;w.value=!1,T.clear();let t=new Set(e.map(String));g.clear();for(let i of t)g.add(i);for(let i of[...l.keys()])t.has(i)||l.delete(i);for(let i of n.value){let s=M(i);t.has(s)&&l.set(s,i)}F(),P()},{deep:!0,flush:"sync"}),_vue.onScopeDispose.call(void 0, ()=>{Y(),u=null}),{rows:n,loading:p,error:o,page:d,pageSize:h,total:f,sortModel:b,filterModel:R,advancedFilterModel:D,selectedKeys:S,selectedRows:m,selectionState:Te,bindings:fe,reload:ge,retry:Q,reset:ye,abort:Y,clearSelection:A,selectAllMatching:he,applySelectionState:pe}}function Qe(a={}){let n=_chunkEGEQGM3Dcjs.a.call(void 0, ),p=_vue.ref.call(void 0, _nullishCoalesce(a.initialSearch, () => (""))),o=a.query?W({...a.query,quickFilterText:_nullishCoalesce(a.query.quickFilterText, () => (_vue.computed.call(void 0, ()=>p.value||null)))}):null,d=j(n,a.editing),h=_vue.shallowRef.call(void 0, []),f=null,b=()=>{h.value=_nullishCoalesce(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _52 => _52.selectedRows, 'access', _53 => _53.value]), () => (_optionalChain([n, 'access', _54 => _54.api, 'access', _55 => _55.value, 'optionalAccess', _56 => _56.selection, 'access', _57 => _57.getRows, 'call', _58 => _58()]))), () => ([]))};_vue.watch.call(void 0, n.api,l=>{_optionalChain([f, 'optionalCall', _59 => _59()]),f=null,l&&!l.isDestroyed()&&(f=l.on("selectionChanged",b)),b()},{immediate:!0}),o&&_vue.watch.call(void 0, o.selectedRows,b,{deep:!1});let R=async()=>{if(o)await o.reload();else{let l=n.api.value;_optionalChain([l, 'optionalAccess', _60 => _60.rows, 'access', _61 => _61.isRemote, 'call', _62 => _62()])?await l.rows.reload():_optionalChain([l, 'optionalAccess', _63 => _63.view, 'access', _64 => _64.refreshCells, 'call', _65 => _65()])}},D=_machtable.createMachTableCommands.call(void 0, {getApi:()=>n.api.value,reload:R}),S=_vue.computed.call(void 0, ()=>_nullishCoalesce(_optionalChain([o, 'optionalAccess', _66 => _66.bindings, 'access', _67 => _67.value]), () => ({}))),m=_vue.computed.call(void 0, ()=>{if(!o)return h.value.length;let l=o.selectionState.value;return l.mode==="allMatching"?Math.max(0,o.total.value-l.excludedKeys.length):l.selectedKeys.length}),g=_vue.computed.call(void 0, ()=>_optionalChain([o, 'optionalAccess', _68 => _68.loading, 'access', _69 => _69.value])===!0||d.saving.value),T=_vue.computed.call(void 0, ()=>_nullishCoalesce(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _70 => _70.error, 'access', _71 => _71.value]), () => (d.saveError.value)), () => (null)));return _vue.watch.call(void 0, p,l=>{o||D.search(l||null)}),_vue.onScopeDispose.call(void 0, ()=>{_optionalChain([f, 'optionalCall', _72 => _72()]),f=null}),{table:n,query:o,editing:d,bindings:S,search:p,selectedRows:h,selectedCount:m,busy:g,error:T,commands:D,reload:R}}exports.useMachTableController = Qe; exports.useMachTableEditing = j; exports.useMachTableQuery = W;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkEGEQGM3Dcjs = require('./chunk-EGEQGM3D.cjs');var _vue = require('vue');var _machtable = require('@agile-team/mach-table');function j(a,n={}){let p=_vue.shallowRef.call(void 0, []),o=_vue.ref.call(void 0, []),d=_vue.ref.call(void 0, !1),h=_vue.shallowRef.call(void 0, null),v=_vue.shallowRef.call(void 0, null),S=_vue.computed.call(void 0, ()=>o.value.length>0),D=_vue.computed.call(void 0, ()=>[..._nullishCoalesce(_optionalChain([v, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.failures]), () => ([])),..._nullishCoalesce(_optionalChain([v, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.conflicts]), () => ([]))]),C=_vue.computed.call(void 0, ()=>[...new Set(D.value.map(r=>r.rowId))]),w=null,m=()=>{let r=a.api.value;if(!r||r.isDestroyed()){o.value=[],p.value=[];return}o.value=r.editing.getDirtyRowIds(),p.value=r.editing.getChanges()};_vue.watch.call(void 0, a.api,r=>{_optionalChain([w, 'optionalCall', _6 => _6()]),w=null,m(),!(!r||r.isDestroyed())&&(w=r.on("dirtyStateChanged",m))},{immediate:!0});let g=async(r,s)=>{let f=a.api.value;if(!f||f.isDestroyed())throw new Error("[MachTable] Cannot save before the grid is ready.");if(d.value)throw new Error("[MachTable] A save operation is already in progress.");d.value=!0,h.value=null,v.value=null;try{let c=await f.editing.save(r,s);return v.value=c,m(),_optionalChain([n, 'access', _7 => _7.onSaveSuccess, 'optionalCall', _8 => _8(c.saved)]),_optionalChain([n, 'access', _9 => _9.onSaveResult, 'optionalCall', _10 => _10(c)]),c}catch(c){throw h.value=c,_optionalChain([n, 'access', _11 => _11.onSaveError, 'optionalCall', _12 => _12(c)]),c}finally{d.value=!1}},T=async(r,s)=>(await g(r,s)).saved,l=()=>{v.value=null},x=(r,s)=>{let f=v.value,c=_optionalChain([f, 'optionalAccess', _13 => _13.conflicts, 'access', _14 => _14.find, 'call', _15 => _15(b=>b.rowId===r)]),y=a.api.value;return!f||!c||!y||!_machtable.resolveSaveConflict.call(void 0, y,c,s)?!1:(v.value={...f,failures:f.failures,conflicts:f.conflicts.filter(b=>b.rowId!==r)},m(),!0)},z=r=>{let s=_nullishCoalesce(_optionalChain([a, 'access', _16 => _16.api, 'access', _17 => _17.value, 'optionalAccess', _18 => _18.editing, 'access', _19 => _19.rollback, 'call', _20 => _20(r)]), () => (!1));return m(),s},E=r=>{_optionalChain([a, 'access', _21 => _21.api, 'access', _22 => _22.value, 'optionalAccess', _23 => _23.editing, 'access', _24 => _24.markSaved, 'call', _25 => _25(r)]),m()},M=(r,s,f=!1)=>{let c=a.api.value,y=_optionalChain([c, 'optionalAccess', _26 => _26.rows, 'access', _27 => _27.getById, 'call', _28 => _28(r)]);return!c||!y||y.rowIndex<0?!1:(c.view.scrollToRow(y.rowIndex,"middle"),s&&f?c.editing.startCell({rowIndex:y.rowIndex,colId:s}):!0)},I=r=>{if(!S.value)return;let s=_nullishCoalesce(n.beforeUnloadMessage, () => ("\u5B58\u5728\u672A\u4FDD\u5B58\u7684\u8868\u683C\u4FEE\u6539\u3002"));return r.preventDefault(),r.returnValue=s,s};return n.guardBeforeUnload&&typeof window<"u"&&window.addEventListener("beforeunload",I),_vue.onScopeDispose.call(void 0, ()=>{_optionalChain([w, 'optionalCall', _29 => _29()]),w=null,n.guardBeforeUnload&&typeof window<"u"&&window.removeEventListener("beforeunload",I)}),{changes:p,dirtyRowIds:o,dirty:S,saving:d,saveError:h,lastSaveResult:v,saveIssues:D,failedRowIds:C,save:T,saveDetailed:g,clearSaveIssues:l,resolveConflict:x,rollback:z,markSaved:E,reveal:M,refresh:m}}function re(a){return typeof a=="function"?a():_vue.isRef.call(void 0, a)?a.value:a}function W(a,n){return typeof a=="number"&&Number.isFinite(a)&&a>0?Math.floor(a):n}function De(a){return(a instanceof DOMException||typeof a=="object"&&a!=null&&"name"in a)&&a.name==="AbortError"}function X(a){let n=_vue.shallowRef.call(void 0, []),p=_vue.ref.call(void 0, !1),o=_vue.shallowRef.call(void 0, null),d=_vue.ref.call(void 0, W(a.initialPage,1)),h=_vue.ref.call(void 0, W(a.pageSize,20)),v=_vue.ref.call(void 0, 0),S=_vue.shallowRef.call(void 0, []),D=_vue.shallowRef.call(void 0, {}),C=_vue.shallowRef.call(void 0, null),w=_vue.ref.call(void 0, []),m=_vue.shallowRef.call(void 0, []),g=new Set,T=new Set,l=new Map,x=_nullishCoalesce(a.quickFilterText, () => (_vue.ref.call(void 0, null))),z=_nullishCoalesce(a.selectionScope, () => ("preserve")),E=a.mode!=="manual",M=_vue.ref.call(void 0, !1),I=_vue.ref.call(void 0, 0),r=[...new Set((_nullishCoalesce(a.pageSizeOptions, () => ([10,20,50,100]))).map(e=>W(e,0)).filter(Boolean))];r.includes(h.value)||r.push(h.value),r.sort((e,t)=>e-t);let s=null,f=null,c=0,y=null,b=!1,q=!1,B=!1,R=e=>{let t=typeof a.rowKey=="function"?a.rowKey(e):_machtable.getByPath.call(void 0, e,a.rowKey);if(t==null||String(t).length===0)throw new Error(`[MachTable] useMachTableQuery rowKey "${String(a.rowKey)}" returned an empty value.`);return String(t)},P=()=>{B=!0,w.value=M.value?[]:[...g],B=!1;let e=M.value?[...l.keys()]:[...g];m.value=e.flatMap(t=>{let i=l.get(t);return i===void 0||T.has(t)?[]:[i]}),I.value++},L=e=>M.value?!T.has(e):g.has(e),F=()=>{if(!s||s.isDestroyed())return;let e=n.value.filter(t=>L(R(t)));q=!0;try{s.selection.setRows(e,!0)}finally{q=!1}},Z=()=>{c++,_optionalChain([f, 'optionalAccess', _30 => _30.abort, 'call', _31 => _31()]),f=null,y!=null&&clearTimeout(y),y=null,p.value=!1},_=(e,t)=>e.signal.aborted||t!==c,ne=e=>{if(!e||!Array.isArray(e.rows)||!Number.isFinite(e.total)||e.total<0)throw new TypeError("[MachTable] Remote request must resolve to { rows: TData[], total: non-negative number }.")},oe=async(e,t,i)=>{if(_(t,i))return;ne(e);let u=[...e.rows];for(let U of u)R(U);n.value=u,v.value=Math.floor(e.total);for(let U of n.value){let H=R(U);L(H)?l.set(H,U):l.delete(H)}P(),_optionalChain([a, 'access', _32 => _32.onSuccess, 'optionalCall', _33 => _33(e)]),await _vue.nextTick.call(void 0, ),F()},ie=(e,t,i)=>{_(t,i)||De(e)||(o.value=_nullishCoalesce(e, () => (new Error)),_optionalChain([a, 'access', _34 => _34.onError, 'optionalCall', _35 => _35(o.value)]))},k=async()=>{y!=null&&clearTimeout(y),y=null,_optionalChain([f, 'optionalAccess', _36 => _36.abort, 'call', _37 => _37()]);let e=new AbortController;f=e;let t=++c;p.value=!0,o.value=null,a.keepPreviousData===!1&&(n.value=[]);try{let i=await a.request({page:d.value,pageSize:h.value,query:re(a.query),sortModel:S.value.map(u=>({...u})),filterModel:{...D.value},advancedFilterModel:_machtable.normalizeAdvancedFilterModel.call(void 0, C.value),quickFilterText:x.value,signal:e.signal});await oe(i,e,t)}catch(i){ie(i,e,t)}finally{t===c&&(p.value=!1,f===e&&(f=null))}},K=e=>{e&&(d.value=1),y!=null&&clearTimeout(y),f&&(c++,f.abort(),f=null,p.value=!1);let t=Math.max(0,_nullishCoalesce(a.debounceMs, () => (0)));if(t===0){k();return}y=setTimeout(()=>{k()},t)},se=e=>{s=e.api,_vue.nextTick.call(void 0, F)},ue=e=>{b||e.page===d.value&&e.pageSize===h.value||(d.value=e.page,h.value=e.pageSize,E&&k())},ce=e=>{b||(S.value=e.sortModel.map(t=>({...t})),E?K(!0):d.value=1)},de=e=>{if(b)return;D.value={...e.filterModel},C.value=_machtable.normalizeAdvancedFilterModel.call(void 0, e.advancedFilterModel);let t=e.api.filtering.getQuickText();if(x.value!==t){b=!0;try{x.value=t}finally{b=!1}}a.clearSelectionOnQueryChange!==!1&&A(),E?K(!0):d.value=1},fe=e=>{if(q)return;let t=new Set(n.value.map(R)),i=new Set(e.selectedRows.map(R));if(M.value){for(let u of t)i.has(u)?T.delete(u):(T.add(u),l.delete(u));for(let u of e.selectedRows)l.set(R(u),u);P();return}if(z==="page")g.clear(),l.clear();else for(let u of t)g.delete(u),l.delete(u);for(let u of e.selectedRows){let U=R(u);g.add(U),l.set(U,u)}P()},ve=_vue.computed.call(void 0, ()=>({rowData:n.value,loading:p.value,rowKey:R,manualSorting:!0,manualFiltering:!0,advancedFilterModel:C.value,quickFilterText:x.value,error:o.value,overlayErrorTemplate:o.value?()=>_nullishCoalesce(_optionalChain([a, 'access', _38 => _38.errorOverlay, 'optionalCall', _39 => _39({error:o.value,retry:k})]), () => ("Remote request failed. Please retry.")):void 0,overlayNoRowsTemplate:a.emptyOverlay,pagination:{mode:"server",page:d.value,pageSize:h.value,pageSizeOptions:r,total:v.value,showTotal:!0,showPageSizeSelector:!0},onGridReady:se,onPaginationChanged:ue,onSortChanged:ce,onFilterChanged:de,onSelectionChanged:fe})),ge=async(e={})=>{e.resetPage&&(d.value=1),await k()},ye=async()=>{b=!0;try{d.value=1,S.value=[],D.value={},C.value=null,x.value=null,A(),_optionalChain([s, 'optionalAccess', _40 => _40.sorting, 'access', _41 => _41.setModel, 'call', _42 => _42(null)]),_optionalChain([s, 'optionalAccess', _43 => _43.filtering, 'access', _44 => _44.setModel, 'call', _45 => _45(null)]),_optionalChain([s, 'optionalAccess', _46 => _46.filtering, 'access', _47 => _47.setAdvancedModel, 'call', _48 => _48(null)]),_optionalChain([s, 'optionalAccess', _49 => _49.filtering, 'access', _50 => _50.setQuickText, 'call', _51 => _51(null)]),await _vue.nextTick.call(void 0, )}finally{b=!1}await k()},A=()=>{M.value=!1,g.clear(),T.clear(),l.clear(),P(),q=!0;try{_optionalChain([s, 'optionalAccess', _52 => _52.selection, 'access', _53 => _53.clear, 'call', _54 => _54()])}finally{q=!1}},he=()=>{M.value=!0,g.clear(),T.clear(),l.clear();for(let e of n.value)l.set(R(e),e);P(),F()},pe=e=>{g.clear(),T.clear(),l.clear(),M.value=e.mode==="allMatching";let t=e.mode==="allMatching"?e.excludedKeys:e.selectedKeys;for(let i of t.map(String))e.mode==="allMatching"?T.add(i):g.add(i);for(let i of n.value){let u=R(i);L(u)&&l.set(u,i)}P(),F()},Te=_vue.computed.call(void 0, ()=>(I.value,M.value?{mode:"allMatching",excludedKeys:[...T]}:{mode:"explicit",selectedKeys:[...g]}));return _vue.watch.call(void 0, ()=>re(a.query),()=>{a.clearSelectionOnQueryChange!==!1&&A(),E?K(!0):d.value=1},{deep:!0,immediate:E&&a.immediate!==!1}),_vue.watch.call(void 0, x,()=>{b||(a.clearSelectionOnQueryChange!==!1&&A(),E?K(!0):d.value=1)},{flush:"sync"}),_vue.watch.call(void 0, w,e=>{if(B)return;M.value=!1,T.clear();let t=new Set(e.map(String));g.clear();for(let i of t)g.add(i);for(let i of[...l.keys()])t.has(i)||l.delete(i);for(let i of n.value){let u=R(i);t.has(u)&&l.set(u,i)}F(),P()},{deep:!0,flush:"sync"}),_vue.onScopeDispose.call(void 0, ()=>{Z(),s=null}),{rows:n,loading:p,error:o,page:d,pageSize:h,total:v,sortModel:S,filterModel:D,advancedFilterModel:C,selectedKeys:w,selectedRows:m,selectionState:Te,bindings:ve,reload:ge,retry:k,reset:ye,abort:Z,clearSelection:A,selectAllMatching:he,applySelectionState:pe}}function Pe(a={}){let n=_chunkEGEQGM3Dcjs.a.call(void 0, ),p=_vue.ref.call(void 0, _nullishCoalesce(a.initialSearch, () => (""))),o=a.query?X({...a.query,quickFilterText:_nullishCoalesce(a.query.quickFilterText, () => (_vue.computed.call(void 0, ()=>p.value||null)))}):null,d=j(n,a.editing),h=_vue.shallowRef.call(void 0, []),v=null,S=()=>{h.value=_nullishCoalesce(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _55 => _55.selectedRows, 'access', _56 => _56.value]), () => (_optionalChain([n, 'access', _57 => _57.api, 'access', _58 => _58.value, 'optionalAccess', _59 => _59.selection, 'access', _60 => _60.getRows, 'call', _61 => _61()]))), () => ([]))};_vue.watch.call(void 0, n.api,l=>{_optionalChain([v, 'optionalCall', _62 => _62()]),v=null,l&&!l.isDestroyed()&&(v=l.on("selectionChanged",S)),S()},{immediate:!0}),o&&_vue.watch.call(void 0, o.selectedRows,S,{deep:!1});let D=async()=>{if(o)await o.reload();else{let l=n.api.value;_optionalChain([l, 'optionalAccess', _63 => _63.rows, 'access', _64 => _64.isRemote, 'call', _65 => _65()])?await l.rows.reload():_optionalChain([l, 'optionalAccess', _66 => _66.view, 'access', _67 => _67.refreshCells, 'call', _68 => _68()])}},C=_machtable.createMachTableCommands.call(void 0, {getApi:()=>n.api.value,reload:D}),w=_vue.computed.call(void 0, ()=>_nullishCoalesce(_optionalChain([o, 'optionalAccess', _69 => _69.bindings, 'access', _70 => _70.value]), () => ({}))),m=_vue.computed.call(void 0, ()=>{if(!o)return h.value.length;let l=o.selectionState.value;return l.mode==="allMatching"?Math.max(0,o.total.value-l.excludedKeys.length):l.selectedKeys.length}),g=_vue.computed.call(void 0, ()=>_optionalChain([o, 'optionalAccess', _71 => _71.loading, 'access', _72 => _72.value])===!0||d.saving.value),T=_vue.computed.call(void 0, ()=>_nullishCoalesce(_nullishCoalesce(_optionalChain([o, 'optionalAccess', _73 => _73.error, 'access', _74 => _74.value]), () => (d.saveError.value)), () => (null)));return _vue.watch.call(void 0, p,l=>{o||C.search(l||null)}),_vue.onScopeDispose.call(void 0, ()=>{_optionalChain([v, 'optionalCall', _75 => _75()]),v=null}),{table:n,query:o,editing:d,bindings:w,search:p,selectedRows:h,selectedCount:m,busy:g,error:T,commands:C,reload:D}}exports.useMachTableController = Pe; exports.useMachTableEditing = j; exports.useMachTableQuery = X;
package/dist/workflows.js CHANGED
@@ -1 +1 @@
1
- import{a as _}from"./chunk-YTEW56VQ.js";import{computed as N,onScopeDispose as me,ref as ee,shallowRef as V,watch as be}from"vue";import{resolveSaveConflict as Se}from"@agile-team/mach-table";function j(a,n={}){let p=V([]),o=ee([]),d=ee(!1),h=V(null),f=V(null),b=N(()=>o.value.length>0),R=N(()=>[...f.value?.failures??[],...f.value?.conflicts??[]]),D=N(()=>[...new Set(R.value.map(r=>r.rowId))]),S=null,m=()=>{let r=a.api.value;if(!r||r.isDestroyed()){o.value=[],p.value=[];return}o.value=r.editing.getDirtyRowIds(),p.value=r.editing.getChanges()};be(a.api,r=>{S?.(),S=null,m(),!(!r||r.isDestroyed())&&(S=r.on("dirtyStateChanged",m))},{immediate:!0});let g=async(r,u)=>{let v=a.api.value;if(!v||v.isDestroyed())throw new Error("[MachTable] Cannot save before the grid is ready.");if(d.value)throw new Error("[MachTable] A save operation is already in progress.");d.value=!0,h.value=null,f.value=null;try{let c=await v.editing.save(r,u);return f.value=c,m(),n.onSaveSuccess?.(c.saved),n.onSaveResult?.(c),c}catch(c){throw h.value=c,n.onSaveError?.(c),c}finally{d.value=!1}},T=async(r,u)=>(await g(r,u)).saved,l=()=>{f.value=null},O=(r,u)=>{let v=f.value,c=v?.conflicts.find(C=>C.rowId===r),y=a.api.value;return!v||!c||!y||!Se(y,c,u)?!1:(f.value={...v,failures:v.failures,conflicts:v.conflicts.filter(C=>C.rowId!==r)},m(),!0)},z=r=>{let u=a.api.value?.editing.rollback(r)??!1;return m(),u},x=r=>{a.api.value?.editing.markSaved(r),m()},w=(r,u,v=!1)=>{let c=a.api.value,y=c?.rows.getById(r);return!c||!y||y.rowIndex<0?!1:(c.view.scrollToRow(y.rowIndex,"middle"),u&&v?c.editing.startCell({rowIndex:y.rowIndex,colId:u}):!0)},I=r=>{if(!b.value)return;let u=n.beforeUnloadMessage??"\u5B58\u5728\u672A\u4FDD\u5B58\u7684\u8868\u683C\u4FEE\u6539\u3002";return r.preventDefault(),r.returnValue=u,u};return n.guardBeforeUnload&&typeof window<"u"&&window.addEventListener("beforeunload",I),me(()=>{S?.(),S=null,n.guardBeforeUnload&&typeof window<"u"&&window.removeEventListener("beforeunload",I)}),{changes:p,dirtyRowIds:o,dirty:b,saving:d,saveError:h,lastSaveResult:f,saveIssues:R,failedRowIds:D,save:T,saveDetailed:g,clearSaveIssues:l,resolveConflict:O,rollback:z,markSaved:x,reveal:w,refresh:m}}import{computed as ae,isRef as we,nextTick as te,onScopeDispose as Me,ref as E,shallowRef as k,watch as $}from"vue";import{getByPath as Re,normalizeAdvancedFilterModel as le}from"@agile-team/mach-table";function re(a){return typeof a=="function"?a():we(a)?a.value:a}function J(a,n){return typeof a=="number"&&Number.isFinite(a)&&a>0?Math.floor(a):n}function De(a){return(a instanceof DOMException||typeof a=="object"&&a!=null&&"name"in a)&&a.name==="AbortError"}function W(a){let n=k([]),p=E(!1),o=k(null),d=E(J(a.initialPage,1)),h=E(J(a.pageSize,20)),f=E(0),b=k([]),R=k({}),D=k(null),S=E([]),m=k([]),g=new Set,T=new Set,l=new Map,O=a.quickFilterText??E(null),z=a.selectionScope??"preserve",x=a.mode!=="manual",w=E(!1),I=E(0),r=[...new Set((a.pageSizeOptions??[10,20,50,100]).map(e=>J(e,0)).filter(Boolean))];r.includes(h.value)||r.push(h.value),r.sort((e,t)=>e-t);let u=null,v=null,c=0,y=null,C=!1,q=!1,B=!1,M=e=>{let t=typeof a.rowKey=="function"?a.rowKey(e):Re(e,a.rowKey);if(t==null||String(t).length===0)throw new Error(`[MachTable] useMachTableQuery rowKey "${String(a.rowKey)}" returned an empty value.`);return String(t)},P=()=>{B=!0,S.value=w.value?[]:[...g],B=!1;let e=w.value?[...l.keys()]:[...g];m.value=e.flatMap(t=>{let i=l.get(t);return i===void 0||T.has(t)?[]:[i]}),I.value++},L=e=>w.value?!T.has(e):g.has(e),F=()=>{if(!u||u.isDestroyed())return;let e=n.value.filter(t=>L(M(t)));q=!0;try{u.selection.setRows(e,!0)}finally{q=!1}},Y=()=>{c++,v?.abort(),v=null,y!=null&&clearTimeout(y),y=null,p.value=!1},Z=(e,t)=>e.signal.aborted||t!==c,ne=e=>{if(!e||!Array.isArray(e.rows)||!Number.isFinite(e.total)||e.total<0)throw new TypeError("[MachTable] Remote request must resolve to { rows: TData[], total: non-negative number }.")},oe=async(e,t,i)=>{if(Z(t,i))return;ne(e);let s=[...e.rows];for(let U of s)M(U);n.value=s,f.value=Math.floor(e.total);for(let U of n.value){let H=M(U);L(H)?l.set(H,U):l.delete(H)}P(),a.onSuccess?.(e),await te(),F()},ie=(e,t,i)=>{Z(t,i)||De(e)||(o.value=e??new Error,a.onError?.(o.value))},Q=async()=>{y!=null&&clearTimeout(y),y=null,v?.abort();let e=new AbortController;v=e;let t=++c;p.value=!0,o.value=null,a.keepPreviousData===!1&&(n.value=[]);try{let i=await a.request({page:d.value,pageSize:h.value,query:re(a.query),sortModel:b.value.map(s=>({...s})),filterModel:{...R.value},advancedFilterModel:le(D.value),quickFilterText:O.value,signal:e.signal});await oe(i,e,t)}catch(i){ie(i,e,t)}finally{t===c&&(p.value=!1,v===e&&(v=null))}},K=e=>{e&&(d.value=1),y!=null&&clearTimeout(y),v&&(c++,v.abort(),v=null,p.value=!1);let t=Math.max(0,a.debounceMs??0);if(t===0){Q();return}y=setTimeout(()=>{Q()},t)},se=e=>{u=e.api,te(F)},ue=e=>{C||e.page===d.value&&e.pageSize===h.value||(d.value=e.page,h.value=e.pageSize,x&&Q())},ce=e=>{C||(b.value=e.sortModel.map(t=>({...t})),x?K(!0):d.value=1)},de=e=>{C||(R.value={...e.filterModel},D.value=le(e.advancedFilterModel),a.clearSelectionOnQueryChange!==!1&&A(),x?K(!0):d.value=1)},ve=e=>{if(q)return;let t=new Set(n.value.map(M)),i=new Set(e.selectedRows.map(M));if(w.value){for(let s of t)i.has(s)?T.delete(s):(T.add(s),l.delete(s));for(let s of e.selectedRows)l.set(M(s),s);P();return}if(z==="page")g.clear(),l.clear();else for(let s of t)g.delete(s),l.delete(s);for(let s of e.selectedRows){let U=M(s);g.add(U),l.set(U,s)}P()},fe=ae(()=>({rowData:n.value,loading:p.value,rowKey:M,manualSorting:!0,manualFiltering:!0,advancedFilterModel:D.value,quickFilterText:O.value,error:o.value,overlayErrorTemplate:o.value?()=>a.errorOverlay?.({error:o.value,retry:Q})??"Remote request failed. Please retry.":void 0,overlayNoRowsTemplate:a.emptyOverlay,pagination:{mode:"server",page:d.value,pageSize:h.value,pageSizeOptions:r,total:f.value,showTotal:!0,showPageSizeSelector:!0},onGridReady:se,onPaginationChanged:ue,onSortChanged:ce,onFilterChanged:de,onSelectionChanged:ve})),ge=async(e={})=>{e.resetPage&&(d.value=1),await Q()},ye=async()=>{d.value=1,b.value=[],R.value={},D.value=null,A(),C=!0;try{u?.sorting.setModel(null),u?.filtering.setModel(null),u?.filtering.setAdvancedModel(null)}finally{C=!1}await Q()},A=()=>{w.value=!1,g.clear(),T.clear(),l.clear(),P(),q=!0;try{u?.selection.clear()}finally{q=!1}},he=()=>{w.value=!0,g.clear(),T.clear(),l.clear();for(let e of n.value)l.set(M(e),e);P(),F()},pe=e=>{g.clear(),T.clear(),l.clear(),w.value=e.mode==="allMatching";let t=e.mode==="allMatching"?e.excludedKeys:e.selectedKeys;for(let i of t.map(String))e.mode==="allMatching"?T.add(i):g.add(i);for(let i of n.value){let s=M(i);L(s)&&l.set(s,i)}P(),F()},Te=ae(()=>(I.value,w.value?{mode:"allMatching",excludedKeys:[...T]}:{mode:"explicit",selectedKeys:[...g]}));return $(()=>re(a.query),()=>{a.clearSelectionOnQueryChange!==!1&&A(),x?K(!0):d.value=1},{deep:!0,immediate:x&&a.immediate!==!1}),$(O,()=>{a.clearSelectionOnQueryChange!==!1&&A(),x?K(!0):d.value=1}),$(S,e=>{if(B)return;w.value=!1,T.clear();let t=new Set(e.map(String));g.clear();for(let i of t)g.add(i);for(let i of[...l.keys()])t.has(i)||l.delete(i);for(let i of n.value){let s=M(i);t.has(s)&&l.set(s,i)}F(),P()},{deep:!0,flush:"sync"}),Me(()=>{Y(),u=null}),{rows:n,loading:p,error:o,page:d,pageSize:h,total:f,sortModel:b,filterModel:R,advancedFilterModel:D,selectedKeys:S,selectedRows:m,selectionState:Te,bindings:fe,reload:ge,retry:Q,reset:ye,abort:Y,clearSelection:A,selectAllMatching:he,applySelectionState:pe}}import{computed as G,onScopeDispose as Ce,ref as xe,shallowRef as Ee,watch as X}from"vue";import{createMachTableCommands as Pe}from"@agile-team/mach-table";function Qe(a={}){let n=_(),p=xe(a.initialSearch??""),o=a.query?W({...a.query,quickFilterText:a.query.quickFilterText??G(()=>p.value||null)}):null,d=j(n,a.editing),h=Ee([]),f=null,b=()=>{h.value=o?.selectedRows.value??n.api.value?.selection.getRows()??[]};X(n.api,l=>{f?.(),f=null,l&&!l.isDestroyed()&&(f=l.on("selectionChanged",b)),b()},{immediate:!0}),o&&X(o.selectedRows,b,{deep:!1});let R=async()=>{if(o)await o.reload();else{let l=n.api.value;l?.rows.isRemote()?await l.rows.reload():l?.view.refreshCells()}},D=Pe({getApi:()=>n.api.value,reload:R}),S=G(()=>o?.bindings.value??{}),m=G(()=>{if(!o)return h.value.length;let l=o.selectionState.value;return l.mode==="allMatching"?Math.max(0,o.total.value-l.excludedKeys.length):l.selectedKeys.length}),g=G(()=>o?.loading.value===!0||d.saving.value),T=G(()=>o?.error.value??d.saveError.value??null);return X(p,l=>{o||D.search(l||null)}),Ce(()=>{f?.(),f=null}),{table:n,query:o,editing:d,bindings:S,search:p,selectedRows:h,selectedCount:m,busy:g,error:T,commands:D,reload:R}}export{Qe as useMachTableController,j as useMachTableEditing,W as useMachTableQuery};
1
+ import{a as ee}from"./chunk-YTEW56VQ.js";import{computed as N,onScopeDispose as me,ref as ae,shallowRef as V,watch as be}from"vue";import{resolveSaveConflict as Se}from"@agile-team/mach-table";function j(a,n={}){let p=V([]),o=ae([]),d=ae(!1),h=V(null),v=V(null),S=N(()=>o.value.length>0),D=N(()=>[...v.value?.failures??[],...v.value?.conflicts??[]]),C=N(()=>[...new Set(D.value.map(r=>r.rowId))]),w=null,m=()=>{let r=a.api.value;if(!r||r.isDestroyed()){o.value=[],p.value=[];return}o.value=r.editing.getDirtyRowIds(),p.value=r.editing.getChanges()};be(a.api,r=>{w?.(),w=null,m(),!(!r||r.isDestroyed())&&(w=r.on("dirtyStateChanged",m))},{immediate:!0});let g=async(r,s)=>{let f=a.api.value;if(!f||f.isDestroyed())throw new Error("[MachTable] Cannot save before the grid is ready.");if(d.value)throw new Error("[MachTable] A save operation is already in progress.");d.value=!0,h.value=null,v.value=null;try{let c=await f.editing.save(r,s);return v.value=c,m(),n.onSaveSuccess?.(c.saved),n.onSaveResult?.(c),c}catch(c){throw h.value=c,n.onSaveError?.(c),c}finally{d.value=!1}},T=async(r,s)=>(await g(r,s)).saved,l=()=>{v.value=null},x=(r,s)=>{let f=v.value,c=f?.conflicts.find(b=>b.rowId===r),y=a.api.value;return!f||!c||!y||!Se(y,c,s)?!1:(v.value={...f,failures:f.failures,conflicts:f.conflicts.filter(b=>b.rowId!==r)},m(),!0)},z=r=>{let s=a.api.value?.editing.rollback(r)??!1;return m(),s},E=r=>{a.api.value?.editing.markSaved(r),m()},M=(r,s,f=!1)=>{let c=a.api.value,y=c?.rows.getById(r);return!c||!y||y.rowIndex<0?!1:(c.view.scrollToRow(y.rowIndex,"middle"),s&&f?c.editing.startCell({rowIndex:y.rowIndex,colId:s}):!0)},I=r=>{if(!S.value)return;let s=n.beforeUnloadMessage??"\u5B58\u5728\u672A\u4FDD\u5B58\u7684\u8868\u683C\u4FEE\u6539\u3002";return r.preventDefault(),r.returnValue=s,s};return n.guardBeforeUnload&&typeof window<"u"&&window.addEventListener("beforeunload",I),me(()=>{w?.(),w=null,n.guardBeforeUnload&&typeof window<"u"&&window.removeEventListener("beforeunload",I)}),{changes:p,dirtyRowIds:o,dirty:S,saving:d,saveError:h,lastSaveResult:v,saveIssues:D,failedRowIds:C,save:T,saveDetailed:g,clearSaveIssues:l,resolveConflict:x,rollback:z,markSaved:E,reveal:M,refresh:m}}import{computed as te,isRef as we,nextTick as $,onScopeDispose as Me,ref as Q,shallowRef as O,watch as J}from"vue";import{getByPath as Re,normalizeAdvancedFilterModel as le}from"@agile-team/mach-table";function re(a){return typeof a=="function"?a():we(a)?a.value:a}function W(a,n){return typeof a=="number"&&Number.isFinite(a)&&a>0?Math.floor(a):n}function De(a){return(a instanceof DOMException||typeof a=="object"&&a!=null&&"name"in a)&&a.name==="AbortError"}function X(a){let n=O([]),p=Q(!1),o=O(null),d=Q(W(a.initialPage,1)),h=Q(W(a.pageSize,20)),v=Q(0),S=O([]),D=O({}),C=O(null),w=Q([]),m=O([]),g=new Set,T=new Set,l=new Map,x=a.quickFilterText??Q(null),z=a.selectionScope??"preserve",E=a.mode!=="manual",M=Q(!1),I=Q(0),r=[...new Set((a.pageSizeOptions??[10,20,50,100]).map(e=>W(e,0)).filter(Boolean))];r.includes(h.value)||r.push(h.value),r.sort((e,t)=>e-t);let s=null,f=null,c=0,y=null,b=!1,q=!1,B=!1,R=e=>{let t=typeof a.rowKey=="function"?a.rowKey(e):Re(e,a.rowKey);if(t==null||String(t).length===0)throw new Error(`[MachTable] useMachTableQuery rowKey "${String(a.rowKey)}" returned an empty value.`);return String(t)},P=()=>{B=!0,w.value=M.value?[]:[...g],B=!1;let e=M.value?[...l.keys()]:[...g];m.value=e.flatMap(t=>{let i=l.get(t);return i===void 0||T.has(t)?[]:[i]}),I.value++},L=e=>M.value?!T.has(e):g.has(e),F=()=>{if(!s||s.isDestroyed())return;let e=n.value.filter(t=>L(R(t)));q=!0;try{s.selection.setRows(e,!0)}finally{q=!1}},Z=()=>{c++,f?.abort(),f=null,y!=null&&clearTimeout(y),y=null,p.value=!1},_=(e,t)=>e.signal.aborted||t!==c,ne=e=>{if(!e||!Array.isArray(e.rows)||!Number.isFinite(e.total)||e.total<0)throw new TypeError("[MachTable] Remote request must resolve to { rows: TData[], total: non-negative number }.")},oe=async(e,t,i)=>{if(_(t,i))return;ne(e);let u=[...e.rows];for(let U of u)R(U);n.value=u,v.value=Math.floor(e.total);for(let U of n.value){let H=R(U);L(H)?l.set(H,U):l.delete(H)}P(),a.onSuccess?.(e),await $(),F()},ie=(e,t,i)=>{_(t,i)||De(e)||(o.value=e??new Error,a.onError?.(o.value))},k=async()=>{y!=null&&clearTimeout(y),y=null,f?.abort();let e=new AbortController;f=e;let t=++c;p.value=!0,o.value=null,a.keepPreviousData===!1&&(n.value=[]);try{let i=await a.request({page:d.value,pageSize:h.value,query:re(a.query),sortModel:S.value.map(u=>({...u})),filterModel:{...D.value},advancedFilterModel:le(C.value),quickFilterText:x.value,signal:e.signal});await oe(i,e,t)}catch(i){ie(i,e,t)}finally{t===c&&(p.value=!1,f===e&&(f=null))}},K=e=>{e&&(d.value=1),y!=null&&clearTimeout(y),f&&(c++,f.abort(),f=null,p.value=!1);let t=Math.max(0,a.debounceMs??0);if(t===0){k();return}y=setTimeout(()=>{k()},t)},se=e=>{s=e.api,$(F)},ue=e=>{b||e.page===d.value&&e.pageSize===h.value||(d.value=e.page,h.value=e.pageSize,E&&k())},ce=e=>{b||(S.value=e.sortModel.map(t=>({...t})),E?K(!0):d.value=1)},de=e=>{if(b)return;D.value={...e.filterModel},C.value=le(e.advancedFilterModel);let t=e.api.filtering.getQuickText();if(x.value!==t){b=!0;try{x.value=t}finally{b=!1}}a.clearSelectionOnQueryChange!==!1&&A(),E?K(!0):d.value=1},fe=e=>{if(q)return;let t=new Set(n.value.map(R)),i=new Set(e.selectedRows.map(R));if(M.value){for(let u of t)i.has(u)?T.delete(u):(T.add(u),l.delete(u));for(let u of e.selectedRows)l.set(R(u),u);P();return}if(z==="page")g.clear(),l.clear();else for(let u of t)g.delete(u),l.delete(u);for(let u of e.selectedRows){let U=R(u);g.add(U),l.set(U,u)}P()},ve=te(()=>({rowData:n.value,loading:p.value,rowKey:R,manualSorting:!0,manualFiltering:!0,advancedFilterModel:C.value,quickFilterText:x.value,error:o.value,overlayErrorTemplate:o.value?()=>a.errorOverlay?.({error:o.value,retry:k})??"Remote request failed. Please retry.":void 0,overlayNoRowsTemplate:a.emptyOverlay,pagination:{mode:"server",page:d.value,pageSize:h.value,pageSizeOptions:r,total:v.value,showTotal:!0,showPageSizeSelector:!0},onGridReady:se,onPaginationChanged:ue,onSortChanged:ce,onFilterChanged:de,onSelectionChanged:fe})),ge=async(e={})=>{e.resetPage&&(d.value=1),await k()},ye=async()=>{b=!0;try{d.value=1,S.value=[],D.value={},C.value=null,x.value=null,A(),s?.sorting.setModel(null),s?.filtering.setModel(null),s?.filtering.setAdvancedModel(null),s?.filtering.setQuickText(null),await $()}finally{b=!1}await k()},A=()=>{M.value=!1,g.clear(),T.clear(),l.clear(),P(),q=!0;try{s?.selection.clear()}finally{q=!1}},he=()=>{M.value=!0,g.clear(),T.clear(),l.clear();for(let e of n.value)l.set(R(e),e);P(),F()},pe=e=>{g.clear(),T.clear(),l.clear(),M.value=e.mode==="allMatching";let t=e.mode==="allMatching"?e.excludedKeys:e.selectedKeys;for(let i of t.map(String))e.mode==="allMatching"?T.add(i):g.add(i);for(let i of n.value){let u=R(i);L(u)&&l.set(u,i)}P(),F()},Te=te(()=>(I.value,M.value?{mode:"allMatching",excludedKeys:[...T]}:{mode:"explicit",selectedKeys:[...g]}));return J(()=>re(a.query),()=>{a.clearSelectionOnQueryChange!==!1&&A(),E?K(!0):d.value=1},{deep:!0,immediate:E&&a.immediate!==!1}),J(x,()=>{b||(a.clearSelectionOnQueryChange!==!1&&A(),E?K(!0):d.value=1)},{flush:"sync"}),J(w,e=>{if(B)return;M.value=!1,T.clear();let t=new Set(e.map(String));g.clear();for(let i of t)g.add(i);for(let i of[...l.keys()])t.has(i)||l.delete(i);for(let i of n.value){let u=R(i);t.has(u)&&l.set(u,i)}F(),P()},{deep:!0,flush:"sync"}),Me(()=>{Z(),s=null}),{rows:n,loading:p,error:o,page:d,pageSize:h,total:v,sortModel:S,filterModel:D,advancedFilterModel:C,selectedKeys:w,selectedRows:m,selectionState:Te,bindings:ve,reload:ge,retry:k,reset:ye,abort:Z,clearSelection:A,selectAllMatching:he,applySelectionState:pe}}import{computed as G,onScopeDispose as Ce,ref as xe,shallowRef as Ee,watch as Y}from"vue";import{createMachTableCommands as Qe}from"@agile-team/mach-table";function Pe(a={}){let n=ee(),p=xe(a.initialSearch??""),o=a.query?X({...a.query,quickFilterText:a.query.quickFilterText??G(()=>p.value||null)}):null,d=j(n,a.editing),h=Ee([]),v=null,S=()=>{h.value=o?.selectedRows.value??n.api.value?.selection.getRows()??[]};Y(n.api,l=>{v?.(),v=null,l&&!l.isDestroyed()&&(v=l.on("selectionChanged",S)),S()},{immediate:!0}),o&&Y(o.selectedRows,S,{deep:!1});let D=async()=>{if(o)await o.reload();else{let l=n.api.value;l?.rows.isRemote()?await l.rows.reload():l?.view.refreshCells()}},C=Qe({getApi:()=>n.api.value,reload:D}),w=G(()=>o?.bindings.value??{}),m=G(()=>{if(!o)return h.value.length;let l=o.selectionState.value;return l.mode==="allMatching"?Math.max(0,o.total.value-l.excludedKeys.length):l.selectedKeys.length}),g=G(()=>o?.loading.value===!0||d.saving.value),T=G(()=>o?.error.value??d.saveError.value??null);return Y(p,l=>{o||C.search(l||null)}),Ce(()=>{v?.(),v=null}),{table:n,query:o,editing:d,bindings:w,search:p,selectedRows:h,selectedCount:m,busy:g,error:T,commands:C,reload:D}}export{Pe as useMachTableController,j as useMachTableEditing,X as useMachTableQuery};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agile-team/mach-table-vue",
3
- "version": "0.24.0",
3
+ "version": "0.28.0",
4
4
  "description": "Official Vue 3 adapter for the MachTable enterprise data grid",
5
5
  "keywords": [
6
6
  "vue",
@@ -118,7 +118,7 @@
118
118
  "**/*.css"
119
119
  ],
120
120
  "dependencies": {
121
- "@agile-team/mach-table": "0.24.0"
121
+ "@agile-team/mach-table": "0.28.0"
122
122
  },
123
123
  "peerDependencies": {
124
124
  "vue": ">=3.2.0"
@@ -132,5 +132,5 @@
132
132
  "test": "vitest run",
133
133
  "test:coverage": "vitest run --coverage"
134
134
  },
135
- "readme": "<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ChenyCHENYU/MachTable/main/assets/mach-table-logo.svg\" alt=\"MachTable\" width=\"760\" />\n</p>\n\n# @agile-team/mach-table-vue\n\nMachTable 0.24 的官方 Vue 3 适配包。一个依赖即可获得 Core、泛型 `<MachTable>`、原生 slots、应用/路由配置、按需工作流、异步组件边界和自动生命周期清理。\n\n```bash\npnpm add @agile-team/mach-table-vue\n```\n\n应用入口只引入一次样式:\n\n```ts\nimport \"@agile-team/mach-table-vue/styles.css\";\n```\n\n## 局部接入\n\n```vue\n<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { MachTable, useMachTable, type ColDef } from \"@agile-team/mach-table-vue\";\n\ninterface Row { id: string; name: string }\nconst table = useMachTable<Row>();\nconst rows = ref<Row[]>([{ id: \"1\", name: \"MachTable\" }]);\nconst columns: ColDef<Row>[] = [{ field: \"name\", flex: 1, editable: true }];\n</script>\n\n<template>\n <div style=\"height: 520px\">\n <MachTable\n :ref=\"table.ref\"\n :row-data=\"rows\"\n :column-defs=\"columns\"\n row-key=\"id\"\n enable-column-resize\n :persistence=\"{ key: 'customers:list', sections: ['columns'] }\"\n />\n </div>\n</template>\n```\n\n## 全局接入\n\n表格页面较多时,全局注册一次,页面模板直接使用 `<MachTable>`:\n\n```ts\nimport { createApp } from \"vue\";\nimport { MachTablePlugin } from \"@agile-team/mach-table-vue\";\nimport machTableConfig from \"@/config/mach-table.config\";\n\ncreateApp(App).use(MachTablePlugin, machTableConfig).mount(\"#app\");\n```\n\n需要减少首屏代码时改用异步全局插件:\n\n```ts\nimport AsyncMachTablePlugin, { preloadMachTable } from \"@agile-team/mach-table-vue/async\";\n\napp.use(AsyncMachTablePlugin, machTableConfig);\nvoid preloadMachTable(); // 可选:路由 hover 时预取\n```\n\n推荐把约定集中到独立文件:\n\n```ts\n// src/config/mach-table.config.ts\nimport { defineMachTableConfig, defineMachTablePreset } from \"@agile-team/mach-table-vue\";\n\nexport default defineMachTableConfig({\n defaults: {\n size: \"compact\",\n columnLayout: \"fit\",\n enableColumnResize: true,\n defaultColDef: { sortable: true, filter: true, resizable: true }\n },\n defaultPreset: \"list\",\n presets: {\n list: defineMachTablePreset({ stripedRows: true }),\n crud: defineMachTablePreset({ rowSelection: \"multiple\", editType: \"fullRow\" })\n }\n});\n```\n\n布局或路由可用响应式 `provideMachTableConfig()` 叠加配置,表格 props 始终拥有最高优先级。\n\n## 按需子入口\n\n```ts\nimport { useMachTableQuery, useMachTableEditing } from \"@agile-team/mach-table-vue/workflows\";\nimport { MachTableToolbar } from \"@agile-team/mach-table-vue/ui\";\nimport { vueCellRenderer } from \"@agile-team/mach-table-vue/adapters\";\nimport { createElementPlusEditors } from \"@agile-team/mach-table-vue/editors\";\nimport { createWorkerDataProcessor } from \"@agile-team/mach-table-vue/worker\";\n```\n\n- `/workflows`:请求取消、防过期覆盖、服务端分页、跨页选择、脏数据和冲突保存。\n- `/ui`:可选标准工具栏;需要全局组件时另行 `app.use(MachTableUiPlugin)`。\n- `/adapters`:自定义 Vue renderer/editor/detail/overlay 桥接。\n- `/editors`:可选 Element Plus 编辑器,Element Plus 由宿主注入。\n- `/worker`:大型本地过滤/排序的独立 Worker 能力。\n\n该包自动依赖 `@agile-team/mach-table` 并重导出 Core 类型;宿主只需提供 `vue >= 3.2`。\n\n文档:[Vue 指南](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/vue.md) · [企业接入](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/enterprise-integration.md) · [配置中心](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/configuration.md)\n\nSource-available © ChenyCHENYU (Agile Team). 任何使用均须事先取得书面授权。详见 [LICENSE](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSE) 与[授权流程](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSING.md)。\n"
135
+ "readme": "<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ChenyCHENYU/MachTable/main/assets/mach-table-logo.svg\" alt=\"MachTable\" width=\"760\" />\n</p>\n\n# @agile-team/mach-table-vue\n\nMachTable 0.28 的官方 Vue 3 适配包。一个依赖即可获得 Core、泛型 `<MachTable>`、原生 slots、应用/路由配置、按需工作流、异步组件边界和自动生命周期清理。\n\n```bash\npnpm add @agile-team/mach-table-vue\n```\n\n应用入口只引入一次样式:\n\n```ts\nimport \"@agile-team/mach-table-vue/styles.css\";\n```\n\n## 局部接入\n\n```vue\n<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nimport { MachTable, useMachTable, type ColDef } from \"@agile-team/mach-table-vue\";\n\ninterface Row { id: string; name: string }\nconst table = useMachTable<Row>();\nconst rows = ref<Row[]>([{ id: \"1\", name: \"MachTable\" }]);\nconst columns: ColDef<Row>[] = [{ field: \"name\", flex: 1, editable: true }];\n</script>\n\n<template>\n <div style=\"height: 520px\">\n <MachTable\n :ref=\"table.ref\"\n :row-data=\"rows\"\n :column-defs=\"columns\"\n row-key=\"id\"\n enable-column-resize\n :persistence=\"{ key: 'customers:list', sections: ['columns'] }\"\n />\n </div>\n</template>\n```\n\n## 全局接入\n\n表格页面较多时,全局注册一次,页面模板直接使用 `<MachTable>`:\n\n```ts\nimport { createApp } from \"vue\";\nimport { MachTablePlugin } from \"@agile-team/mach-table-vue\";\nimport machTableConfig from \"@/config/mach-table.config\";\n\ncreateApp(App).use(MachTablePlugin, machTableConfig).mount(\"#app\");\n```\n\n需要减少首屏代码时改用异步全局插件:\n\n```ts\nimport AsyncMachTablePlugin, { preloadMachTable } from \"@agile-team/mach-table-vue/async\";\n\napp.use(AsyncMachTablePlugin, machTableConfig);\nvoid preloadMachTable(); // 可选:路由 hover 时预取\n```\n\n推荐把约定集中到独立文件:\n\n```ts\n// src/config/mach-table.config.ts\nimport { defineMachTableConfig, defineMachTablePreset } from \"@agile-team/mach-table-vue\";\n\nexport default defineMachTableConfig({\n defaults: {\n size: \"compact\",\n columnLayout: \"fit\",\n enableColumnResize: true,\n defaultColDef: { sortable: true, filter: true, resizable: true }\n },\n defaultPreset: \"list\",\n presets: {\n list: defineMachTablePreset({ stripedRows: true }),\n crud: defineMachTablePreset({ rowSelection: \"multiple\", editType: \"fullRow\" })\n }\n});\n```\n\n布局或路由可用响应式 `provideMachTableConfig()` 叠加配置,表格 props 始终拥有最高优先级。\n\n## 按需子入口\n\n```ts\nimport { useMachTableQuery, useMachTableEditing } from \"@agile-team/mach-table-vue/workflows\";\nimport { MachTableToolbar } from \"@agile-team/mach-table-vue/ui\";\nimport { vueCellRenderer } from \"@agile-team/mach-table-vue/adapters\";\nimport { createElementPlusEditors } from \"@agile-team/mach-table-vue/editors\";\nimport { createWorkerDataProcessor } from \"@agile-team/mach-table-vue/worker\";\n```\n\n- `/workflows`:请求取消、防过期覆盖、服务端分页、跨页选择、脏数据和冲突保存;`reset()` 清空全部表格过滤且只请求一次。\n- `/ui`:可选标准工具栏;需要全局组件时另行 `app.use(MachTableUiPlugin)`,其全局组件类型也只在导入该子入口后生效。\n- `/adapters`:自定义 Vue renderer/editor/detail/overlay 桥接。\n- `/editors`:可选 Element Plus 编辑器,Element Plus 由宿主注入。\n- `/worker`:大型本地过滤/排序的独立 Worker 能力。\n\n该包自动依赖 `@agile-team/mach-table` 并重导出 Core 类型;宿主只需提供 `vue >= 3.2`。\n\n文档:[Vue 指南](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/vue.md) · [企业接入](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/enterprise-integration.md) · [配置中心](https://github.com/ChenyCHENYU/MachTable/blob/main/docs/guide/configuration.md)\n\nSource-available © ChenyCHENYU (Agile Team). 任何使用均须事先取得书面授权。详见 [LICENSE](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSE) 与[授权流程](https://github.com/ChenyCHENYU/MachTable/blob/main/LICENSING.md)。\n"
136
136
  }
@@ -1 +0,0 @@
1
- import{a}from"./chunk-IS6G3WLH.js";import"./chunk-7MRR4IDI.js";import"./chunk-SQVY5G55.js";export{a as MachTable};
@@ -1,97 +0,0 @@
1
- import * as vue from 'vue';
2
- import { PropType } from 'vue';
3
- import { GridApi, MachTableCommands } from '@agile-team/mach-table';
4
-
5
- interface MachTableToolbarFeatures {
6
- search?: boolean;
7
- refresh?: boolean;
8
- columns?: boolean;
9
- density?: boolean;
10
- export?: boolean;
11
- undoRedo?: boolean;
12
- fullscreen?: boolean;
13
- }
14
- declare const MachTableToolbar: vue.DefineComponent<vue.ExtractPropTypes<{
15
- api: {
16
- type: PropType<GridApi<any> | null>;
17
- default: null;
18
- };
19
- commands: {
20
- type: PropType<MachTableCommands | null>;
21
- default: null;
22
- };
23
- modelValue: {
24
- type: StringConstructor;
25
- default: string;
26
- };
27
- loading: {
28
- type: BooleanConstructor;
29
- default: boolean;
30
- };
31
- selectedCount: {
32
- type: NumberConstructor;
33
- default: number;
34
- };
35
- searchPlaceholder: {
36
- type: StringConstructor;
37
- default: string;
38
- };
39
- exportFilename: {
40
- type: StringConstructor;
41
- default: string;
42
- };
43
- features: {
44
- type: PropType<MachTableToolbarFeatures>;
45
- default: () => {};
46
- };
47
- }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
48
- [key: string]: any;
49
- }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("refresh" | "update:modelValue" | "clearSelection")[], "refresh" | "update:modelValue" | "clearSelection", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
50
- api: {
51
- type: PropType<GridApi<any> | null>;
52
- default: null;
53
- };
54
- commands: {
55
- type: PropType<MachTableCommands | null>;
56
- default: null;
57
- };
58
- modelValue: {
59
- type: StringConstructor;
60
- default: string;
61
- };
62
- loading: {
63
- type: BooleanConstructor;
64
- default: boolean;
65
- };
66
- selectedCount: {
67
- type: NumberConstructor;
68
- default: number;
69
- };
70
- searchPlaceholder: {
71
- type: StringConstructor;
72
- default: string;
73
- };
74
- exportFilename: {
75
- type: StringConstructor;
76
- default: string;
77
- };
78
- features: {
79
- type: PropType<MachTableToolbarFeatures>;
80
- default: () => {};
81
- };
82
- }>> & Readonly<{
83
- onRefresh?: ((...args: any[]) => any) | undefined;
84
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
85
- onClearSelection?: ((...args: any[]) => any) | undefined;
86
- }>, {
87
- loading: boolean;
88
- features: MachTableToolbarFeatures;
89
- selectedCount: number;
90
- api: GridApi<any> | null;
91
- commands: MachTableCommands | null;
92
- modelValue: string;
93
- searchPlaceholder: string;
94
- exportFilename: string;
95
- }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
96
-
97
- export { MachTableToolbar as M, type MachTableToolbarFeatures as a };
@@ -1,97 +0,0 @@
1
- import * as vue from 'vue';
2
- import { PropType } from 'vue';
3
- import { GridApi, MachTableCommands } from '@agile-team/mach-table';
4
-
5
- interface MachTableToolbarFeatures {
6
- search?: boolean;
7
- refresh?: boolean;
8
- columns?: boolean;
9
- density?: boolean;
10
- export?: boolean;
11
- undoRedo?: boolean;
12
- fullscreen?: boolean;
13
- }
14
- declare const MachTableToolbar: vue.DefineComponent<vue.ExtractPropTypes<{
15
- api: {
16
- type: PropType<GridApi<any> | null>;
17
- default: null;
18
- };
19
- commands: {
20
- type: PropType<MachTableCommands | null>;
21
- default: null;
22
- };
23
- modelValue: {
24
- type: StringConstructor;
25
- default: string;
26
- };
27
- loading: {
28
- type: BooleanConstructor;
29
- default: boolean;
30
- };
31
- selectedCount: {
32
- type: NumberConstructor;
33
- default: number;
34
- };
35
- searchPlaceholder: {
36
- type: StringConstructor;
37
- default: string;
38
- };
39
- exportFilename: {
40
- type: StringConstructor;
41
- default: string;
42
- };
43
- features: {
44
- type: PropType<MachTableToolbarFeatures>;
45
- default: () => {};
46
- };
47
- }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
48
- [key: string]: any;
49
- }>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("refresh" | "update:modelValue" | "clearSelection")[], "refresh" | "update:modelValue" | "clearSelection", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
50
- api: {
51
- type: PropType<GridApi<any> | null>;
52
- default: null;
53
- };
54
- commands: {
55
- type: PropType<MachTableCommands | null>;
56
- default: null;
57
- };
58
- modelValue: {
59
- type: StringConstructor;
60
- default: string;
61
- };
62
- loading: {
63
- type: BooleanConstructor;
64
- default: boolean;
65
- };
66
- selectedCount: {
67
- type: NumberConstructor;
68
- default: number;
69
- };
70
- searchPlaceholder: {
71
- type: StringConstructor;
72
- default: string;
73
- };
74
- exportFilename: {
75
- type: StringConstructor;
76
- default: string;
77
- };
78
- features: {
79
- type: PropType<MachTableToolbarFeatures>;
80
- default: () => {};
81
- };
82
- }>> & Readonly<{
83
- onRefresh?: ((...args: any[]) => any) | undefined;
84
- "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
85
- onClearSelection?: ((...args: any[]) => any) | undefined;
86
- }>, {
87
- loading: boolean;
88
- features: MachTableToolbarFeatures;
89
- selectedCount: number;
90
- api: GridApi<any> | null;
91
- commands: MachTableCommands | null;
92
- modelValue: string;
93
- searchPlaceholder: string;
94
- exportFilename: string;
95
- }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
96
-
97
- export { MachTableToolbar as M, type MachTableToolbarFeatures as a };
@@ -1 +0,0 @@
1
- import{b as t,c as l}from"./chunk-7MRR4IDI.js";function i(e,a,n={}){let r=l(n);e.provide(t,r);let o=e.component("MachTable");if(o&&o!==a)throw new Error('[MachTable] Cannot register global component "MachTable" because that name is already in use.');o||e.component("MachTable",a)}export{i as a};