@lumal/vben-compat 0.0.2-beta → 0.0.3-beta
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/CHANGELOG.md +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +136 -130
- package/dist/src/grid/useVbenVxeGrid.d.ts.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @lumal/vben-compat
|
|
2
|
+
|
|
3
|
+
## 0.0.3-beta (2026-10-16)
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 兼容表格查询使用请求代数,旧查询不能覆盖新结果、错误或 loading。
|
|
8
|
+
- 作用域销毁后忽略在途查询,补齐逆序完成、失败和销毁回归。
|
|
9
|
+
- 同步 Core 依赖版本,继续保持迁移子集边界。
|
|
10
|
+
|
|
11
|
+
## 0.0.2-beta (2026-08-01)
|
|
12
|
+
|
|
13
|
+
- Version bump only, to stay in lockstep with the other @lumal packages.
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("vue");function t(e){let t=e?.replaceAll(`.`,``).replaceAll(`-`,``).toLowerCase()??`input`;return t.includes(`textarea`)?`textarea`:t.includes(`inputnumber`)?`number`:t.includes(`checkbox`)?`checkbox`:t.includes(`radio`)?`radio`:t.includes(`treeselect`)?`tree-select`:t.includes(`switch`)?`switch`:t.includes(`upload`)?`upload`:t.includes(`rangepicker`)?`daterange`:t.includes(`datepicker`)?`date`:t.includes(`select`)?`select`:t.includes(`hidden`)?`hidden`:`input`}function n(e={}){let{options:t,placeholder:n,...r}=e;return r}function r(e){let t=n(e.componentProps);return e.component?.toLowerCase()===`input.password`&&t.type===void 0&&(t.type=`password`),t}function i(e,t){if(t!==`date`)return t;let n=e.componentProps?.type?.toLowerCase();return n===`datetime`?`datetime`:n?.includes(`range`)?`daterange`:t}function a(e={}){return e.options?.map(e=>({disabled:e.disabled,label:e.label,value:e.value}))}function o(e){return!!(e.hidden||e.show===!1||e.ifShow===!1)}function s(e){return e.required??(e.rules?.some(e=>e.required)||void 0)}function c(e){let n=e.fieldName??e.field??``,c=e.componentProps??{};return{component:i(e,t(e.component)),defaultValue:e.defaultValue,field:n,hidden:o(e)||void 0,label:e.label,options:a(c),placeholder:c.placeholder,componentProps:r(e),required:s(e)}}function l(e=[]){return e.map(e=>c(e))}function u(e,t){let n={...t.model??{}};for(let t of e)!(t.field in n)&&t.defaultValue!==void 0&&(n[t.field]=t.defaultValue);return n}function d(e,t){for(let t of Object.keys(e))delete e[t];Object.assign(e,t)}function f(t={}){let n=(0,e.toRef)(t),r=(0,e.shallowRef)(),i=(0,e.reactive)({}),a=(0,e.computed)(()=>l(n.value.schemas));function o(){return{...i}}function s(e){Object.assign(i,e)}function c(e){d(i,e)}function f(){d(i,u(a.value,n.value))}function p(e=o()){n.value.submit?.(e)}function m(e){r.value=e}return(0,e.watch)(a,e=>{let t=u(e,n.value);for(let[e,n]of Object.entries(t))e in i||(i[e]=n)},{immediate:!0}),[m,{getFieldsValue:o,getFormInstance:()=>r.value,getLumalSchemas:()=>a.value,handleSubmit:p,handleUpdateModel:c,resetFields:f,schemaFormProps:(0,e.computed)(()=>({modelValue:o(),onSubmit:p,"onUpdate:modelValue":c,schemas:a.value,showActions:n.value.showActions,submitText:n.value.submitText})),setFieldsValue:s}]}function p(e={}){return{...e,...e.gridOptions??{},formOptions:{...e.formOptions,...e.gridOptions?.formOptions??{}}}}function m(e){return e.field??``}function h(e){return e.title??e.label??m(e)}function g(e){return{align:e.align,field:m(e),formatter:e.formatter,hidden:e.hidden??e.visible===!1,label:h(e),width:e.width}}function _(e=[]){return e.filter(e=>e.type!==`checkbox`&&e.type!==`radio`&&e.type!==`seq`).map(e=>g(e))}function v(e){return l(e.formOptions?.schemas)}function y(e,t){if(t)return t.split(`.`).reduce((e,t)=>{if(e&&typeof e==`object`)return e[t]},e)}function b(e){return Array.isArray(e)?e:void 0}function x(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e==`string`&&e.trim()){let t=Number(e);return Number.isFinite(t)?t:void 0}}function S(e,t){if(Array.isArray(e))return{rows:e,total:e.length};let n=e,r=t.proxyConfig?.props,i=y(n,r?.result)??n,a=y(i,r?.items)??y(i,r?.list)??b(i.items)??b(i.list)??b(i.records)??b(i.rows)??[];return{rows:a,total:x(y(i,r?.total))??x(i.total)??x(i.totalCount)??a.length}}function C(e,t){for(let t of Object.keys(e))delete e[t];Object.assign(e,t)}function w(t={}){let n=(0,e.toRef)(t),r=(0,e.shallowRef)(),i=(0,e.shallowRef)([]),a=(0,e.shallowRef)(0),o=(0,e.shallowRef)(!1),s=(0,e.shallowRef)(),c=(0,e.shallowRef)(1),l=(0,e.shallowRef)(10),u=(0,e.reactive)({}),d=(0,e.computed)(()=>p(n.value)),
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("vue");function t(e){let t=e?.replaceAll(`.`,``).replaceAll(`-`,``).toLowerCase()??`input`;return t.includes(`textarea`)?`textarea`:t.includes(`inputnumber`)?`number`:t.includes(`checkbox`)?`checkbox`:t.includes(`radio`)?`radio`:t.includes(`treeselect`)?`tree-select`:t.includes(`switch`)?`switch`:t.includes(`upload`)?`upload`:t.includes(`rangepicker`)?`daterange`:t.includes(`datepicker`)?`date`:t.includes(`select`)?`select`:t.includes(`hidden`)?`hidden`:`input`}function n(e={}){let{options:t,placeholder:n,...r}=e;return r}function r(e){let t=n(e.componentProps);return e.component?.toLowerCase()===`input.password`&&t.type===void 0&&(t.type=`password`),t}function i(e,t){if(t!==`date`)return t;let n=e.componentProps?.type?.toLowerCase();return n===`datetime`?`datetime`:n?.includes(`range`)?`daterange`:t}function a(e={}){return e.options?.map(e=>({disabled:e.disabled,label:e.label,value:e.value}))}function o(e){return!!(e.hidden||e.show===!1||e.ifShow===!1)}function s(e){return e.required??(e.rules?.some(e=>e.required)||void 0)}function c(e){let n=e.fieldName??e.field??``,c=e.componentProps??{};return{component:i(e,t(e.component)),defaultValue:e.defaultValue,field:n,hidden:o(e)||void 0,label:e.label,options:a(c),placeholder:c.placeholder,componentProps:r(e),required:s(e)}}function l(e=[]){return e.map(e=>c(e))}function u(e,t){let n={...t.model??{}};for(let t of e)!(t.field in n)&&t.defaultValue!==void 0&&(n[t.field]=t.defaultValue);return n}function d(e,t){for(let t of Object.keys(e))delete e[t];Object.assign(e,t)}function f(t={}){let n=(0,e.toRef)(t),r=(0,e.shallowRef)(),i=(0,e.reactive)({}),a=(0,e.computed)(()=>l(n.value.schemas));function o(){return{...i}}function s(e){Object.assign(i,e)}function c(e){d(i,e)}function f(){d(i,u(a.value,n.value))}function p(e=o()){n.value.submit?.(e)}function m(e){r.value=e}return(0,e.watch)(a,e=>{let t=u(e,n.value);for(let[e,n]of Object.entries(t))e in i||(i[e]=n)},{immediate:!0}),[m,{getFieldsValue:o,getFormInstance:()=>r.value,getLumalSchemas:()=>a.value,handleSubmit:p,handleUpdateModel:c,resetFields:f,schemaFormProps:(0,e.computed)(()=>({modelValue:o(),onSubmit:p,"onUpdate:modelValue":c,schemas:a.value,showActions:n.value.showActions,submitText:n.value.submitText})),setFieldsValue:s}]}function p(e={}){return{...e,...e.gridOptions??{},formOptions:{...e.formOptions,...e.gridOptions?.formOptions??{}}}}function m(e){return e.field??``}function h(e){return e.title??e.label??m(e)}function g(e){return{align:e.align,field:m(e),formatter:e.formatter,hidden:e.hidden??e.visible===!1,label:h(e),width:e.width}}function _(e=[]){return e.filter(e=>e.type!==`checkbox`&&e.type!==`radio`&&e.type!==`seq`).map(e=>g(e))}function v(e){return l(e.formOptions?.schemas)}function y(e,t){if(t)return t.split(`.`).reduce((e,t)=>{if(e&&typeof e==`object`)return e[t]},e)}function b(e){return Array.isArray(e)?e:void 0}function x(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e==`string`&&e.trim()){let t=Number(e);return Number.isFinite(t)?t:void 0}}function S(e,t){if(Array.isArray(e))return{rows:e,total:e.length};let n=e,r=t.proxyConfig?.props,i=y(n,r?.result)??n,a=y(i,r?.items)??y(i,r?.list)??b(i.items)??b(i.list)??b(i.records)??b(i.rows)??[];return{rows:a,total:x(y(i,r?.total))??x(i.total)??x(i.totalCount)??a.length}}function C(e,t){for(let t of Object.keys(e))delete e[t];Object.assign(e,t)}function w(t={}){let n=(0,e.toRef)(t),r=(0,e.shallowRef)(),i=(0,e.shallowRef)([]),a=(0,e.shallowRef)(0),o=(0,e.shallowRef)(!1),s=(0,e.shallowRef)(),c=(0,e.shallowRef)(1),l=(0,e.shallowRef)(10),u=(0,e.reactive)({}),d=0;(0,e.onScopeDispose)(()=>{d+=1},!0);let f=(0,e.computed)(()=>p(n.value)),m=(0,e.computed)(()=>_(f.value.columns)),h=(0,e.computed)(()=>v(f.value)),g=(0,e.computed)(()=>f.value.pagerConfig!==!1&&f.value.pagerConfig?.enabled!==!1),y=(0,e.computed)(()=>{let e=f.value.pagerConfig;return e===!1?void 0:e?.pageSizes});(0,e.watch)(()=>f.value.pagerConfig,e=>{e!==!1&&e?.pageSize&&(l.value=e.pageSize)},{immediate:!0});function b(e){r.value=e}function x(){return{...u}}function w(e){C(u,e)}function T(e,t=e.length){i.value=e,a.value=t}function E(e){o.value=e}function D(){s.value=void 0}async function O(){let e=++d,t=f.value.proxyConfig?.ajax?.query;if(!t)return D(),o.value=!1,!0;o.value=!0,D();try{let n=await t({...x(),page:c.value,pageSize:l.value});if(e!==d)return!1;let r=S(n,f.value);return T(r.rows,r.total),!0}catch(t){return e===d?(s.value=t,f.value.onError?.(t),!1):!1}finally{e===d&&(o.value=!1)}}function k(e=x()){return w(e),c.value=1,O()}function A(){return w({}),c.value=1,O()}function j(e=x()){return k(e)}function M(e={}){return w(e),c.value=1,O()}function N(e){return c.value=e.page,l.value=e.pageSize,O()}return[b,{crudTableProps:(0,e.computed)(()=>({columns:m.value,actions:f.value.actions,emptyText:s.value instanceof Error?s.value.message:s.value?String(s.value):f.value.emptyText,loading:o.value,onPageChange:N,onReset:M,onSearch:j,"onUpdate:page":e=>{c.value=e},"onUpdate:pageSize":e=>{l.value=e},"onUpdate:queryModel":w,page:c.value,pageSize:l.value,pageSizes:y.value,pagination:g.value,queryModel:x(),querySchemas:h.value,resetText:f.value.formOptions?.resetText??f.value.resetText,rowKey:f.value.rowKey,rows:i.value,searchText:f.value.formOptions?.submitText??f.value.searchText,title:f.value.title,toolbar:f.value.toolbarConfig,table:{...f.value.tableConfig,columns:m.value,rowKey:f.value.rowKey,selection:f.value.columns?.some(e=>e.type===`checkbox`)},total:a.value})),clearError:D,getError:()=>s.value,getGridInstance:()=>r.value,getLumalColumns:()=>m.value,getQueryModel:x,getRows:()=>i.value,getTotal:()=>a.value,handlePageChange:N,handleReset:M,handleSearch:j,reload:O,reset:A,search:k,setLoading:E,setQueryModel:w,setRows:T}]}exports.adaptVbenFormSchema=c,exports.adaptVbenFormSchemas=l,exports.adaptVbenGridColumn=g,exports.adaptVbenGridColumns=_,exports.adaptVbenGridProxyResult=S,exports.adaptVbenGridQuerySchemas=v,exports.resolveVbenGridOptions=p,exports.useVbenForm=f,exports.useVbenVxeGrid=w;
|
package/dist/index.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { computed as e,
|
|
1
|
+
import { computed as e, onScopeDispose as t, reactive as n, shallowRef as r, toRef as i, watch as a } from "vue";
|
|
2
2
|
//#region src/form/adapter.ts
|
|
3
|
-
function
|
|
3
|
+
function o(e) {
|
|
4
4
|
let t = e?.replaceAll(".", "").replaceAll("-", "").toLowerCase() ?? "input";
|
|
5
5
|
return t.includes("textarea") ? "textarea" : t.includes("inputnumber") ? "number" : t.includes("checkbox") ? "checkbox" : t.includes("radio") ? "radio" : t.includes("treeselect") ? "tree-select" : t.includes("switch") ? "switch" : t.includes("upload") ? "upload" : t.includes("rangepicker") ? "daterange" : t.includes("datepicker") ? "date" : t.includes("select") ? "select" : t.includes("hidden") ? "hidden" : "input";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function s(e = {}) {
|
|
8
8
|
let { options: t, placeholder: n, ...r } = e;
|
|
9
9
|
return r;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
let t =
|
|
11
|
+
function c(e) {
|
|
12
|
+
let t = s(e.componentProps);
|
|
13
13
|
return e.component?.toLowerCase() === "input.password" && t.type === void 0 && (t.type = "password"), t;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function l(e, t) {
|
|
16
16
|
if (t !== "date") return t;
|
|
17
17
|
let n = e.componentProps?.type?.toLowerCase();
|
|
18
18
|
return n === "datetime" ? "datetime" : n?.includes("range") ? "daterange" : t;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function u(e = {}) {
|
|
21
21
|
return e.options?.map((e) => ({
|
|
22
22
|
disabled: e.disabled,
|
|
23
23
|
label: e.label,
|
|
24
24
|
value: e.value
|
|
25
25
|
}));
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function d(e) {
|
|
28
28
|
return !!(e.hidden || e.show === !1 || e.ifShow === !1);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function f(e) {
|
|
31
31
|
return e.required ?? (e.rules?.some((e) => e.required) || void 0);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function p(e) {
|
|
34
34
|
let t = e.fieldName ?? e.field ?? "", n = e.componentProps ?? {};
|
|
35
35
|
return {
|
|
36
|
-
component:
|
|
36
|
+
component: l(e, o(e.component)),
|
|
37
37
|
defaultValue: e.defaultValue,
|
|
38
38
|
field: t,
|
|
39
|
-
hidden:
|
|
39
|
+
hidden: d(e) || void 0,
|
|
40
40
|
label: e.label,
|
|
41
|
-
options:
|
|
41
|
+
options: u(n),
|
|
42
42
|
placeholder: n.placeholder,
|
|
43
|
-
componentProps:
|
|
44
|
-
required:
|
|
43
|
+
componentProps: c(e),
|
|
44
|
+
required: f(e)
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return e.map((e) =>
|
|
47
|
+
function m(e = []) {
|
|
48
|
+
return e.map((e) => p(e));
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/form/useVbenForm.ts
|
|
52
|
-
function
|
|
52
|
+
function h(e, t) {
|
|
53
53
|
let n = { ...t.model ?? {} };
|
|
54
54
|
for (let t of e) !(t.field in n) && t.defaultValue !== void 0 && (n[t.field] = t.defaultValue);
|
|
55
55
|
return n;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function g(e, t) {
|
|
58
58
|
for (let t of Object.keys(e)) delete e[t];
|
|
59
59
|
Object.assign(e, t);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
let o =
|
|
61
|
+
function _(t = {}) {
|
|
62
|
+
let o = i(t), s = r(), c = n({}), l = e(() => m(o.value.schemas));
|
|
63
63
|
function u() {
|
|
64
64
|
return { ...c };
|
|
65
65
|
}
|
|
@@ -67,10 +67,10 @@ function g(a = {}) {
|
|
|
67
67
|
Object.assign(c, e);
|
|
68
68
|
}
|
|
69
69
|
function f(e) {
|
|
70
|
-
|
|
70
|
+
g(c, e);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
72
|
+
function p() {
|
|
73
|
+
g(c, h(l.value, o.value));
|
|
74
74
|
}
|
|
75
75
|
function _(e = u()) {
|
|
76
76
|
o.value.submit?.(e);
|
|
@@ -78,8 +78,8 @@ function g(a = {}) {
|
|
|
78
78
|
function v(e) {
|
|
79
79
|
s.value = e;
|
|
80
80
|
}
|
|
81
|
-
return
|
|
82
|
-
let t =
|
|
81
|
+
return a(l, (e) => {
|
|
82
|
+
let t = h(e, o.value);
|
|
83
83
|
for (let [e, n] of Object.entries(t)) e in c || (c[e] = n);
|
|
84
84
|
}, { immediate: !0 }), [v, {
|
|
85
85
|
getFieldsValue: u,
|
|
@@ -87,7 +87,7 @@ function g(a = {}) {
|
|
|
87
87
|
getLumalSchemas: () => l.value,
|
|
88
88
|
handleSubmit: _,
|
|
89
89
|
handleUpdateModel: f,
|
|
90
|
-
resetFields:
|
|
90
|
+
resetFields: p,
|
|
91
91
|
schemaFormProps: e(() => ({
|
|
92
92
|
modelValue: u(),
|
|
93
93
|
onSubmit: _,
|
|
@@ -101,7 +101,7 @@ function g(a = {}) {
|
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
103
|
//#region src/grid/adapter.ts
|
|
104
|
-
function
|
|
104
|
+
function v(e = {}) {
|
|
105
105
|
return {
|
|
106
106
|
...e,
|
|
107
107
|
...e.gridOptions ?? {},
|
|
@@ -111,171 +111,177 @@ function _(e = {}) {
|
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
function v(e) {
|
|
115
|
-
return e.field ?? "";
|
|
116
|
-
}
|
|
117
114
|
function y(e) {
|
|
118
|
-
return e.
|
|
115
|
+
return e.field ?? "";
|
|
119
116
|
}
|
|
120
117
|
function b(e) {
|
|
118
|
+
return e.title ?? e.label ?? y(e);
|
|
119
|
+
}
|
|
120
|
+
function x(e) {
|
|
121
121
|
return {
|
|
122
122
|
align: e.align,
|
|
123
|
-
field:
|
|
123
|
+
field: y(e),
|
|
124
124
|
formatter: e.formatter,
|
|
125
125
|
hidden: e.hidden ?? e.visible === !1,
|
|
126
|
-
label:
|
|
126
|
+
label: b(e),
|
|
127
127
|
width: e.width
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
return e.filter((e) => e.type !== "checkbox" && e.type !== "radio" && e.type !== "seq").map((e) =>
|
|
130
|
+
function S(e = []) {
|
|
131
|
+
return e.filter((e) => e.type !== "checkbox" && e.type !== "radio" && e.type !== "seq").map((e) => x(e));
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
return
|
|
133
|
+
function C(e) {
|
|
134
|
+
return m(e.formOptions?.schemas);
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function w(e, t) {
|
|
137
137
|
if (t) return t.split(".").reduce((e, t) => {
|
|
138
138
|
if (e && typeof e == "object") return e[t];
|
|
139
139
|
}, e);
|
|
140
140
|
}
|
|
141
|
-
function
|
|
141
|
+
function T(e) {
|
|
142
142
|
return Array.isArray(e) ? e : void 0;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function E(e) {
|
|
145
145
|
if (typeof e == "number") return Number.isFinite(e) ? e : void 0;
|
|
146
146
|
if (typeof e == "string" && e.trim()) {
|
|
147
147
|
let t = Number(e);
|
|
148
148
|
return Number.isFinite(t) ? t : void 0;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function D(e, t) {
|
|
152
152
|
if (Array.isArray(e)) return {
|
|
153
153
|
rows: e,
|
|
154
154
|
total: e.length
|
|
155
155
|
};
|
|
156
|
-
let n = e, r = t.proxyConfig?.props, i =
|
|
156
|
+
let n = e, r = t.proxyConfig?.props, i = w(n, r?.result) ?? n, a = w(i, r?.items) ?? w(i, r?.list) ?? T(i.items) ?? T(i.list) ?? T(i.records) ?? T(i.rows) ?? [];
|
|
157
157
|
return {
|
|
158
158
|
rows: a,
|
|
159
|
-
total:
|
|
159
|
+
total: E(w(i, r?.total)) ?? E(i.total) ?? E(i.totalCount) ?? a.length
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function O(e, t) {
|
|
163
163
|
for (let t of Object.keys(e)) delete e[t];
|
|
164
164
|
Object.assign(e, t);
|
|
165
165
|
}
|
|
166
166
|
//#endregion
|
|
167
167
|
//#region src/grid/useVbenVxeGrid.ts
|
|
168
|
-
function
|
|
169
|
-
let
|
|
170
|
-
|
|
168
|
+
function k(o = {}) {
|
|
169
|
+
let s = i(o), c = r(), l = r([]), u = r(0), d = r(!1), f = r(), p = r(1), m = r(10), h = n({}), g = 0;
|
|
170
|
+
t(() => {
|
|
171
|
+
g += 1;
|
|
172
|
+
}, !0);
|
|
173
|
+
let _ = e(() => v(s.value)), y = e(() => S(_.value.columns)), b = e(() => C(_.value)), x = e(() => _.value.pagerConfig !== !1 && _.value.pagerConfig?.enabled !== !1), w = e(() => {
|
|
174
|
+
let e = _.value.pagerConfig;
|
|
171
175
|
return e === !1 ? void 0 : e?.pageSizes;
|
|
172
176
|
});
|
|
173
|
-
|
|
174
|
-
e !== !1 && e?.pageSize && (
|
|
177
|
+
a(() => _.value.pagerConfig, (e) => {
|
|
178
|
+
e !== !1 && e?.pageSize && (m.value = e.pageSize);
|
|
175
179
|
}, { immediate: !0 });
|
|
176
|
-
function C(e) {
|
|
177
|
-
s.value = e;
|
|
178
|
-
}
|
|
179
|
-
function w() {
|
|
180
|
-
return { ...m };
|
|
181
|
-
}
|
|
182
180
|
function T(e) {
|
|
183
|
-
|
|
181
|
+
c.value = e;
|
|
184
182
|
}
|
|
185
|
-
function
|
|
186
|
-
|
|
183
|
+
function E() {
|
|
184
|
+
return { ...h };
|
|
187
185
|
}
|
|
188
186
|
function k(e) {
|
|
189
|
-
|
|
187
|
+
O(h, e);
|
|
188
|
+
}
|
|
189
|
+
function A(e, t = e.length) {
|
|
190
|
+
l.value = e, u.value = t;
|
|
191
|
+
}
|
|
192
|
+
function j(e) {
|
|
193
|
+
d.value = e;
|
|
190
194
|
}
|
|
191
|
-
function
|
|
192
|
-
|
|
195
|
+
function M() {
|
|
196
|
+
f.value = void 0;
|
|
193
197
|
}
|
|
194
|
-
async function
|
|
195
|
-
let e =
|
|
196
|
-
if (!
|
|
197
|
-
|
|
198
|
+
async function N() {
|
|
199
|
+
let e = ++g, t = _.value.proxyConfig?.ajax?.query;
|
|
200
|
+
if (!t) return M(), d.value = !1, !0;
|
|
201
|
+
d.value = !0, M();
|
|
198
202
|
try {
|
|
199
|
-
let
|
|
200
|
-
...
|
|
201
|
-
page:
|
|
202
|
-
pageSize:
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return
|
|
203
|
+
let n = await t({
|
|
204
|
+
...E(),
|
|
205
|
+
page: p.value,
|
|
206
|
+
pageSize: m.value
|
|
207
|
+
});
|
|
208
|
+
if (e !== g) return !1;
|
|
209
|
+
let r = D(n, _.value);
|
|
210
|
+
return A(r.rows, r.total), !0;
|
|
211
|
+
} catch (t) {
|
|
212
|
+
return e === g ? (f.value = t, _.value.onError?.(t), !1) : !1;
|
|
207
213
|
} finally {
|
|
208
|
-
|
|
214
|
+
e === g && (d.value = !1);
|
|
209
215
|
}
|
|
210
216
|
}
|
|
211
|
-
function
|
|
212
|
-
return
|
|
217
|
+
function P(e = E()) {
|
|
218
|
+
return k(e), p.value = 1, N();
|
|
213
219
|
}
|
|
214
|
-
function
|
|
215
|
-
return
|
|
220
|
+
function F() {
|
|
221
|
+
return k({}), p.value = 1, N();
|
|
216
222
|
}
|
|
217
|
-
function
|
|
218
|
-
return
|
|
223
|
+
function I(e = E()) {
|
|
224
|
+
return P(e);
|
|
219
225
|
}
|
|
220
|
-
function
|
|
221
|
-
return
|
|
226
|
+
function L(e = {}) {
|
|
227
|
+
return k(e), p.value = 1, N();
|
|
222
228
|
}
|
|
223
|
-
function
|
|
224
|
-
return
|
|
229
|
+
function R(e) {
|
|
230
|
+
return p.value = e.page, m.value = e.pageSize, N();
|
|
225
231
|
}
|
|
226
|
-
return [
|
|
232
|
+
return [T, {
|
|
227
233
|
crudTableProps: e(() => ({
|
|
228
|
-
columns:
|
|
229
|
-
actions:
|
|
230
|
-
emptyText:
|
|
231
|
-
loading:
|
|
232
|
-
onPageChange:
|
|
233
|
-
onReset:
|
|
234
|
-
onSearch:
|
|
234
|
+
columns: y.value,
|
|
235
|
+
actions: _.value.actions,
|
|
236
|
+
emptyText: f.value instanceof Error ? f.value.message : f.value ? String(f.value) : _.value.emptyText,
|
|
237
|
+
loading: d.value,
|
|
238
|
+
onPageChange: R,
|
|
239
|
+
onReset: L,
|
|
240
|
+
onSearch: I,
|
|
235
241
|
"onUpdate:page": (e) => {
|
|
236
|
-
|
|
242
|
+
p.value = e;
|
|
237
243
|
},
|
|
238
244
|
"onUpdate:pageSize": (e) => {
|
|
239
|
-
|
|
245
|
+
m.value = e;
|
|
240
246
|
},
|
|
241
|
-
"onUpdate:queryModel":
|
|
242
|
-
page:
|
|
243
|
-
pageSize:
|
|
244
|
-
pageSizes:
|
|
245
|
-
pagination:
|
|
246
|
-
queryModel:
|
|
247
|
-
querySchemas:
|
|
248
|
-
resetText:
|
|
249
|
-
rowKey:
|
|
250
|
-
rows:
|
|
251
|
-
searchText:
|
|
252
|
-
title:
|
|
253
|
-
toolbar:
|
|
247
|
+
"onUpdate:queryModel": k,
|
|
248
|
+
page: p.value,
|
|
249
|
+
pageSize: m.value,
|
|
250
|
+
pageSizes: w.value,
|
|
251
|
+
pagination: x.value,
|
|
252
|
+
queryModel: E(),
|
|
253
|
+
querySchemas: b.value,
|
|
254
|
+
resetText: _.value.formOptions?.resetText ?? _.value.resetText,
|
|
255
|
+
rowKey: _.value.rowKey,
|
|
256
|
+
rows: l.value,
|
|
257
|
+
searchText: _.value.formOptions?.submitText ?? _.value.searchText,
|
|
258
|
+
title: _.value.title,
|
|
259
|
+
toolbar: _.value.toolbarConfig,
|
|
254
260
|
table: {
|
|
255
|
-
...
|
|
256
|
-
columns:
|
|
257
|
-
rowKey:
|
|
258
|
-
selection:
|
|
261
|
+
..._.value.tableConfig,
|
|
262
|
+
columns: y.value,
|
|
263
|
+
rowKey: _.value.rowKey,
|
|
264
|
+
selection: _.value.columns?.some((e) => e.type === "checkbox")
|
|
259
265
|
},
|
|
260
|
-
total:
|
|
266
|
+
total: u.value
|
|
261
267
|
})),
|
|
262
|
-
clearError:
|
|
263
|
-
getError: () =>
|
|
264
|
-
getGridInstance: () =>
|
|
265
|
-
getLumalColumns: () =>
|
|
266
|
-
getQueryModel:
|
|
267
|
-
getRows: () =>
|
|
268
|
-
getTotal: () =>
|
|
269
|
-
handlePageChange:
|
|
270
|
-
handleReset:
|
|
271
|
-
handleSearch:
|
|
272
|
-
reload:
|
|
273
|
-
reset:
|
|
274
|
-
search:
|
|
275
|
-
setLoading:
|
|
276
|
-
setQueryModel:
|
|
277
|
-
setRows:
|
|
268
|
+
clearError: M,
|
|
269
|
+
getError: () => f.value,
|
|
270
|
+
getGridInstance: () => c.value,
|
|
271
|
+
getLumalColumns: () => y.value,
|
|
272
|
+
getQueryModel: E,
|
|
273
|
+
getRows: () => l.value,
|
|
274
|
+
getTotal: () => u.value,
|
|
275
|
+
handlePageChange: R,
|
|
276
|
+
handleReset: L,
|
|
277
|
+
handleSearch: I,
|
|
278
|
+
reload: N,
|
|
279
|
+
reset: F,
|
|
280
|
+
search: P,
|
|
281
|
+
setLoading: j,
|
|
282
|
+
setQueryModel: k,
|
|
283
|
+
setRows: A
|
|
278
284
|
}];
|
|
279
285
|
}
|
|
280
286
|
//#endregion
|
|
281
|
-
export {
|
|
287
|
+
export { p as adaptVbenFormSchema, m as adaptVbenFormSchemas, x as adaptVbenGridColumn, S as adaptVbenGridColumns, D as adaptVbenGridProxyResult, C as adaptVbenGridQuerySchemas, v as resolveVbenGridOptions, _ as useVbenForm, k as useVbenVxeGrid };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVbenVxeGrid.d.ts","sourceRoot":"","sources":["../../../src/grid/useVbenVxeGrid.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,UAAU,CAAA;AAUjB,oDAAoD;AACpD,wBAAgB,cAAc,CAAC,OAAO,GAAE,mBAAwB,GAAG,oBAAoB,
|
|
1
|
+
{"version":3,"file":"useVbenVxeGrid.d.ts","sourceRoot":"","sources":["../../../src/grid/useVbenVxeGrid.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,UAAU,CAAA;AAUjB,oDAAoD;AACpD,wBAAgB,cAAc,CAAC,OAAO,GAAE,mBAAwB,GAAG,oBAAoB,CA4LtF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumal/vben-compat",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3-beta",
|
|
5
5
|
"description": "Lumal compatibility adapters for common Vben Admin APIs.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"module": "./dist/index.js",
|
|
27
27
|
"types": "./dist/src/index.d.ts",
|
|
28
28
|
"files": [
|
|
29
|
+
"CHANGELOG.md",
|
|
29
30
|
"README.md",
|
|
30
31
|
"dist"
|
|
31
32
|
],
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
"vue": "^3.5.0"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
|
-
"@lumal/core": "0.0.
|
|
37
|
+
"@lumal/core": "0.0.3-beta"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
39
40
|
"build": "vite build --config vite.config.ts && vue-tsc -p tsconfig.json --emitDeclarationOnly --outDir dist && node ../../scripts/clean-package-dist.mjs dist",
|