@vrojs/element-plus 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js +106 -0
- package/dist/vro-el-schema-form/useVroElSchemaForm.js +1 -1
- package/dist/vro-el-schema-form/vro-el-schema-form.vue.js +1 -1
- package/dist/vro-el-schema-form-dialog/useVroElSchemaFormDialog.js +1 -1
- package/dist/vro-el-schema-form-drawer/useVroElSchemaFormDrawer.js +1 -1
- package/dist/vro-el-table/createUseVroElTable.d.ts +3 -0
- package/dist/vro-el-table/useVroElTable.d.ts +3 -3
- package/dist/vro-el-table/useVroElTable.js +18 -18
- package/package.json +4 -4
- package/dist/node_modules/.pnpm/@ajuanjs_banana@0.0.2/node_modules/@ajuanjs/banana/dist/index.js +0 -97
package/dist/node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
var O = (r) => Object.prototype.toString.call(r) === "[object Object]", h = (r) => typeof r == "function", g = (r) => typeof r > "u";
|
|
2
|
+
function A(r) {
|
|
3
|
+
return g(r) || r === null || r === "" || Number.isNaN(r) || Array.isArray(r) && r.length === 0 || O(r) && Object.keys(r).length === 0;
|
|
4
|
+
}
|
|
5
|
+
function d(r) {
|
|
6
|
+
return Array.isArray(r) ? r.map((e) => ({
|
|
7
|
+
field: e,
|
|
8
|
+
key: e.key
|
|
9
|
+
})) : Object.entries(r).map(([e, t]) => ({
|
|
10
|
+
field: t,
|
|
11
|
+
key: t.key ?? e
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
function b(r, e) {
|
|
15
|
+
const t = r[e.childrenField ?? "children"];
|
|
16
|
+
if (Array.isArray(t) || t && typeof t == "object")
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
async function v(r, e, t, l) {
|
|
20
|
+
const y = d(e), { recursive: w = !1, parallel: u = !1 } = t, n = async ({ field: c, key: s }) => {
|
|
21
|
+
try {
|
|
22
|
+
let { set: o } = c;
|
|
23
|
+
const i = b(c, t);
|
|
24
|
+
if (w && i && await v(r, i, t, l), !s)
|
|
25
|
+
return;
|
|
26
|
+
const f = r[s];
|
|
27
|
+
h(o) ? await o(r, c, e) : g(f) || (c.value = f);
|
|
28
|
+
} catch (o) {
|
|
29
|
+
l.push({ key: s, field: c, error: o });
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
if (u)
|
|
33
|
+
await Promise.allSettled(y.map(n));
|
|
34
|
+
else
|
|
35
|
+
for (const c of y)
|
|
36
|
+
await n(c);
|
|
37
|
+
}
|
|
38
|
+
async function x(r, e, t = {}) {
|
|
39
|
+
const l = [];
|
|
40
|
+
if (await v(r, e, t, l), l.length > 0)
|
|
41
|
+
throw new AggregateError(l, "One or more fields failed to assign");
|
|
42
|
+
}
|
|
43
|
+
async function j(r, e = {}) {
|
|
44
|
+
const t = {}, l = d(r), { recursive: y = !1, parallel: w = !1 } = e, u = async ({ field: n, key: c }) => {
|
|
45
|
+
const s = {};
|
|
46
|
+
let { get: o, value: i, defaultValue: f, hidden: a } = n;
|
|
47
|
+
const p = b(n, e);
|
|
48
|
+
return y && p && Object.assign(s, await j(p, e)), h(a) && (a = a(i, n, r)), a && (i = h(f) ? f(i, n, r) : f), g(i) || !c || (h(o) ? (i = await o(i, n, r), O(i) ? Object.assign(s, i) : s[c] = i) : s[c] = i), s;
|
|
49
|
+
};
|
|
50
|
+
if (w) {
|
|
51
|
+
const n = await Promise.all(l.map(u));
|
|
52
|
+
Object.assign(t, ...n);
|
|
53
|
+
} else
|
|
54
|
+
for (const n of l)
|
|
55
|
+
Object.assign(t, await u(n));
|
|
56
|
+
return t;
|
|
57
|
+
}
|
|
58
|
+
async function m(r, e = {}) {
|
|
59
|
+
const t = d(r), { recursive: l = !1, parallel: y = !1, extract: w = !0 } = e, u = async ({ field: n, key: c }) => {
|
|
60
|
+
let { value: s, rules: o, hidden: i } = n;
|
|
61
|
+
const f = b(n, e);
|
|
62
|
+
if (l && f && await m(f, {
|
|
63
|
+
...e,
|
|
64
|
+
extract: !1
|
|
65
|
+
}), h(i) && (i = i(s, n, r)), !(i || !o || !o.length))
|
|
66
|
+
try {
|
|
67
|
+
for (const a of o) {
|
|
68
|
+
if (h(a)) {
|
|
69
|
+
await a(s, n, r);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (a.required && A(s))
|
|
73
|
+
throw new Error(a.message ?? "This field is required");
|
|
74
|
+
a.validator && await a.validator(s, n, r);
|
|
75
|
+
}
|
|
76
|
+
} catch (a) {
|
|
77
|
+
if (!e.onError)
|
|
78
|
+
throw a;
|
|
79
|
+
e.onError({
|
|
80
|
+
error: a,
|
|
81
|
+
field: n,
|
|
82
|
+
key: c,
|
|
83
|
+
metadata: r
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
if (y)
|
|
88
|
+
e.onError ? await Promise.allSettled(t.map(u)) : await Promise.all(t.map(u));
|
|
89
|
+
else
|
|
90
|
+
for (const n of t)
|
|
91
|
+
await u(n);
|
|
92
|
+
if (w)
|
|
93
|
+
return j(r, e);
|
|
94
|
+
}
|
|
95
|
+
var E = {
|
|
96
|
+
extract: j,
|
|
97
|
+
validate: m,
|
|
98
|
+
assign: x
|
|
99
|
+
}, F = E;
|
|
100
|
+
export {
|
|
101
|
+
x as assign,
|
|
102
|
+
E as banana,
|
|
103
|
+
F as default,
|
|
104
|
+
j as extract,
|
|
105
|
+
m as validate
|
|
106
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import d from "../node_modules/.pnpm/@ajuanjs_banana@0.0.
|
|
1
|
+
import d from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
|
|
2
2
|
import { isFunction as p } from "@daysnap/utils";
|
|
3
3
|
import { useAsyncTask as v } from "@vrojs/use";
|
|
4
4
|
import { reactive as g, ref as y, onBeforeMount as h } from "vue";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as q, computed as C, ref as F, watchEffect as z, useTemplateRef as S, createBlock as P, openBlock as g, unref as m, mergeProps as u, withCtx as i, createVNode as I, createElementBlock as A, renderSlot as E, Fragment as G, renderList as _, createSlots as O, resolveDynamicComponent as H } from "vue";
|
|
2
|
-
import J from "../node_modules/.pnpm/@ajuanjs_banana@0.0.
|
|
2
|
+
import J from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
|
|
3
3
|
import { isFunction as d, isString as Q, filterEmptyValue as W } from "@daysnap/utils";
|
|
4
4
|
import { getSlotEntries as j } from "@vrojs/base";
|
|
5
5
|
import { ElForm as X, ElRow as Y, ElCol as Z, ElFormItem as k } from "element-plus";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import m from "../node_modules/.pnpm/@ajuanjs_banana@0.0.
|
|
1
|
+
import m from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
|
|
2
2
|
import { ref as f, getCurrentInstance as p } from "vue";
|
|
3
3
|
import { showVroElSchemaFormDialog as v } from "./function-call.js";
|
|
4
4
|
function S(o, a, n = {}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import l from "../node_modules/.pnpm/@ajuanjs_banana@0.0.
|
|
1
|
+
import l from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
|
|
2
2
|
import { ref as f, getCurrentInstance as w } from "vue";
|
|
3
3
|
import { showVroElSchemaFormDrawer as p } from "./function-call.js";
|
|
4
4
|
function d(a, n, o = {}) {
|
|
@@ -4,4 +4,7 @@ import { UseVroElTableOptions, UseVroElTableRawColumns, useVroElTable } from './
|
|
|
4
4
|
export interface CreateUseVroElTable<Row extends Record<string, any> = any> {
|
|
5
5
|
<R extends VroElSchemaFormSchema>(rowSchema: (() => R) | R, rawColumns: UseVroElTableRawColumns<Row>, request: VroElTableRequest<Row>, options?: UseVroElTableOptions<Row>): ReturnType<typeof useVroElTable<Row, R>>;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* 类型辅助器,现在 typescript 升级了之后,应该用不到了
|
|
9
|
+
*/
|
|
7
10
|
export declare function createUseVroElTable<Row extends Record<string, any> = any>(): CreateUseVroElTable<Row>;
|
|
@@ -16,7 +16,7 @@ export type UseVroElTableRawColumns<T extends Record<string, any> = any> = (() =
|
|
|
16
16
|
export type UseVroElTableSchema<T extends VroElSchemaFormSchema> = {
|
|
17
17
|
[P in keyof T]: VroElSchemaFormSchemaFieldBase;
|
|
18
18
|
};
|
|
19
|
-
export declare function useVroElTable<Row extends Record<string, any> = any, R extends VroElSchemaFormSchema = VroElSchemaFormSchema>(rowSchema: (() => R) | R, rawColumns: UseVroElTableRawColumns<Row>, request: VroElTableRequest<Row>, options?: UseVroElTableOptions<Row>):
|
|
19
|
+
export declare function useVroElTable<Row extends Record<string, any> = any, R extends VroElSchemaFormSchema = VroElSchemaFormSchema>(rowSchema: (() => R) | R, rawColumns: UseVroElTableRawColumns<Row>, request: VroElTableRequest<Row>, options?: UseVroElTableOptions<Row>): {
|
|
20
20
|
tableProps: import('vue').ComputedRef<{
|
|
21
21
|
filterProps: {
|
|
22
22
|
schema: import('vue').Reactive<UseVroElTableSchema<R>>;
|
|
@@ -30,7 +30,7 @@ export declare function useVroElTable<Row extends Record<string, any> = any, R e
|
|
|
30
30
|
total: number;
|
|
31
31
|
};
|
|
32
32
|
}>;
|
|
33
|
-
query: Ref<Record<string, any
|
|
33
|
+
query: Ref<Record<string, any> | undefined, Record<string, any> | undefined>;
|
|
34
34
|
schema: import('vue').Reactive<UseVroElTableSchema<R>>;
|
|
35
35
|
columns: import('vue').Reactive<VroElTableColumnGroupColumns<Row>>;
|
|
36
36
|
trigger: (params?: UseVroElTableAsyncTaskParams) => Promise<Row[]>;
|
|
@@ -41,4 +41,4 @@ export declare function useVroElTable<Row extends Record<string, any> = any, R e
|
|
|
41
41
|
pageSize: number;
|
|
42
42
|
total: number;
|
|
43
43
|
};
|
|
44
|
-
}
|
|
44
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import q from "../node_modules/.pnpm/@ajuanjs_banana@0.0.
|
|
2
|
-
import { isFunction as p,
|
|
1
|
+
import q from "../node_modules/.pnpm/@ajuanjs_banana@0.0.3/node_modules/@ajuanjs/banana/dist/index.js";
|
|
2
|
+
import { isFunction as p, isNumber as x, filterEmptyValue as z } from "@daysnap/utils";
|
|
3
3
|
import { useAsyncTask as E } from "@vrojs/use";
|
|
4
|
-
import { reactive as
|
|
4
|
+
import { reactive as n, ref as T, computed as V } from "vue";
|
|
5
5
|
import "../vro-el-table-column-group/index.js";
|
|
6
|
-
|
|
7
|
-
const { query: d, ...P } = y,
|
|
8
|
-
p(
|
|
9
|
-
), u =
|
|
6
|
+
function Q(i, o, f, y = {}) {
|
|
7
|
+
const { query: d, ...P } = y, a = n(
|
|
8
|
+
p(i) ? i() : i
|
|
9
|
+
), u = n(p(o) ? o() : o), r = d ?? T(), t = n({
|
|
10
10
|
currentPage: 1,
|
|
11
11
|
pageSize: 10,
|
|
12
12
|
total: 0
|
|
13
|
-
}), { trigger: m, data: c, loading:
|
|
13
|
+
}), { trigger: m, data: c, loading: l } = E(
|
|
14
14
|
async (e) => {
|
|
15
|
-
|
|
16
|
-
const { currentPage:
|
|
17
|
-
e?.query && (
|
|
18
|
-
const [
|
|
19
|
-
return t.total =
|
|
15
|
+
x(e) && (e = { currentPage: e });
|
|
16
|
+
const { currentPage: s, pageSize: g } = Object.assign({}, t, e);
|
|
17
|
+
e?.query && (r.value = e?.query), r.value || (r.value = z(await q.extract(a), !0)), t.currentPage = s, t.pageSize = g;
|
|
18
|
+
const [v, b] = await f([s, g], r.value);
|
|
19
|
+
return t.total = b, v || [];
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
immediate: !0,
|
|
@@ -28,19 +28,19 @@ async function Q(r, i, f, y = {}) {
|
|
|
28
28
|
return {
|
|
29
29
|
tableProps: V(() => ({
|
|
30
30
|
filterProps: {
|
|
31
|
-
schema:
|
|
31
|
+
schema: a
|
|
32
32
|
},
|
|
33
|
-
loading:
|
|
33
|
+
loading: l.value,
|
|
34
34
|
columns: u,
|
|
35
35
|
data: c.value,
|
|
36
36
|
paginationProps: t
|
|
37
37
|
})),
|
|
38
|
-
query:
|
|
39
|
-
schema:
|
|
38
|
+
query: r,
|
|
39
|
+
schema: a,
|
|
40
40
|
columns: u,
|
|
41
41
|
trigger: m,
|
|
42
42
|
data: c,
|
|
43
|
-
loading:
|
|
43
|
+
loading: l,
|
|
44
44
|
pagination: t
|
|
45
45
|
};
|
|
46
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vrojs/element-plus",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "vrojs ui",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"vue": ">=3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@ajuanjs/banana": "^0.0.
|
|
46
|
+
"@ajuanjs/banana": "^0.0.3",
|
|
47
47
|
"@daysnap/utils": "^0.1.36",
|
|
48
48
|
"@element-plus/icons-vue": "^2.3.2",
|
|
49
49
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"vite": "^7.1.12",
|
|
54
54
|
"vite-plugin-dts": "^4.5.4",
|
|
55
55
|
"vue": "^3.5.22",
|
|
56
|
-
"@vrojs/
|
|
57
|
-
"@vrojs/
|
|
56
|
+
"@vrojs/use": "0.0.5",
|
|
57
|
+
"@vrojs/base": "0.0.11"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "npm run clean && vite build",
|
package/dist/node_modules/.pnpm/@ajuanjs_banana@0.0.2/node_modules/@ajuanjs/banana/dist/index.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
var v = (r) => Object.prototype.toString.call(r) === "[object Object]", y = (r) => typeof r == "function", b = (r) => typeof r > "u";
|
|
2
|
-
function A(r) {
|
|
3
|
-
return b(r) || r === null || r === "" || Number.isNaN(r) || Array.isArray(r) && r.length === 0 || v(r) && Object.keys(r).length === 0;
|
|
4
|
-
}
|
|
5
|
-
function g(r) {
|
|
6
|
-
return Array.isArray(r) ? r.map((t) => ({
|
|
7
|
-
field: t,
|
|
8
|
-
key: t.key
|
|
9
|
-
})) : Object.entries(r).map(([t, n]) => ({
|
|
10
|
-
field: n,
|
|
11
|
-
key: n.key ?? t
|
|
12
|
-
}));
|
|
13
|
-
}
|
|
14
|
-
function d(r, t) {
|
|
15
|
-
const n = r[t.childrenField ?? "children"];
|
|
16
|
-
if (Array.isArray(n) || n && typeof n == "object")
|
|
17
|
-
return n;
|
|
18
|
-
}
|
|
19
|
-
async function O(r, t, n = {}) {
|
|
20
|
-
const f = g(t), { recursive: h = !1, parallel: w = !1 } = n, l = async ({ field: e, key: o }) => {
|
|
21
|
-
let { set: s } = e;
|
|
22
|
-
const a = d(e, n);
|
|
23
|
-
if (h && a && await O(r, a, n), !o)
|
|
24
|
-
return;
|
|
25
|
-
const i = r[o];
|
|
26
|
-
y(s) ? await s(r, e, t) : b(i) || (e.value = i);
|
|
27
|
-
};
|
|
28
|
-
if (w)
|
|
29
|
-
await Promise.all(f.map(l));
|
|
30
|
-
else
|
|
31
|
-
for (const e of f)
|
|
32
|
-
await l(e);
|
|
33
|
-
}
|
|
34
|
-
async function j(r, t = {}) {
|
|
35
|
-
const n = {}, f = g(r), { recursive: h = !1, parallel: w = !1 } = t, l = async ({ field: e, key: o }) => {
|
|
36
|
-
const s = {};
|
|
37
|
-
let { get: a, value: i, defaultValue: u, hidden: c } = e;
|
|
38
|
-
const p = d(e, t);
|
|
39
|
-
return h && p && Object.assign(s, await j(p, t)), y(c) && (c = c(i, e, r)), c && (i = y(u) ? u(i, e, r) : u), b(i) || !o || (y(a) ? (i = await a(i, e, r), v(i) ? Object.assign(s, i) : s[o] = i) : s[o] = i), s;
|
|
40
|
-
};
|
|
41
|
-
if (w) {
|
|
42
|
-
const e = await Promise.all(f.map(l));
|
|
43
|
-
Object.assign(n, ...e);
|
|
44
|
-
} else
|
|
45
|
-
for (const e of f)
|
|
46
|
-
Object.assign(n, await l(e));
|
|
47
|
-
return n;
|
|
48
|
-
}
|
|
49
|
-
async function x(r, t = {}) {
|
|
50
|
-
const n = g(r), { recursive: f = !1, parallel: h = !1, extract: w = !0 } = t, l = async ({ field: e, key: o }) => {
|
|
51
|
-
let { value: s, rules: a, hidden: i } = e;
|
|
52
|
-
const u = d(e, t);
|
|
53
|
-
if (f && u && await x(u, {
|
|
54
|
-
...t,
|
|
55
|
-
extract: !1
|
|
56
|
-
}), y(i) && (i = i(s, e, r)), !(i || !a || !a.length))
|
|
57
|
-
try {
|
|
58
|
-
for (const c of a) {
|
|
59
|
-
if (y(c)) {
|
|
60
|
-
await c(s, e, r);
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
if (c.required && A(s))
|
|
64
|
-
throw new Error(c.message ?? "This field is required");
|
|
65
|
-
c.validator && await c.validator(s, e, r);
|
|
66
|
-
}
|
|
67
|
-
} catch (c) {
|
|
68
|
-
if (!t.onError)
|
|
69
|
-
throw c;
|
|
70
|
-
t.onError({
|
|
71
|
-
error: c,
|
|
72
|
-
field: e,
|
|
73
|
-
key: o,
|
|
74
|
-
metadata: r
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
if (h)
|
|
79
|
-
await Promise.all(n.map(l));
|
|
80
|
-
else
|
|
81
|
-
for (const e of n)
|
|
82
|
-
await l(e);
|
|
83
|
-
if (w)
|
|
84
|
-
return j(r, t);
|
|
85
|
-
}
|
|
86
|
-
var F = {
|
|
87
|
-
extract: j,
|
|
88
|
-
validate: x,
|
|
89
|
-
assign: O
|
|
90
|
-
}, m = F;
|
|
91
|
-
export {
|
|
92
|
-
O as assign,
|
|
93
|
-
F as banana,
|
|
94
|
-
m as default,
|
|
95
|
-
j as extract,
|
|
96
|
-
x as validate
|
|
97
|
-
};
|