@dazhicheng/ui 1.5.213 → 1.5.216
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/components/tt-form/src/config.js +44 -42
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +67 -70
- package/dist/components/tt-form/src/form-render/FormFieldContact.d.ts +9 -0
- package/dist/components/tt-form/src/form-render/FormFieldContact.js +28 -25
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -0
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +20 -18
- package/dist/components/tt-form/src/form-render/array-register/props.d.ts +4 -0
- package/dist/components/tt-form/src/form-render/array-register/props.js +1 -0
- package/dist/components/tt-form/src/form-render/array-register/types.d.ts +4 -0
- package/dist/components/tt-form/src/form-render/dependencies.d.ts +5 -0
- package/dist/components/tt-form/src/form-render/dependencies.js +77 -39
- package/dist/components/tt-form/src/group-form/GroupForm.vue.d.ts +15 -7
- package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +120 -104
- package/dist/components/tt-form/src/group-form/GroupSection.vue.d.ts +1 -0
- package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +68 -64
- package/dist/components/tt-form/src/group-form/LazyFormField.vue.d.ts +1 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +131 -101
- package/dist/components/tt-form/src/group-form/groupFormApi.d.ts +110 -46
- package/dist/components/tt-form/src/group-form/groupFormApi.js +465 -314
- package/dist/components/tt-form/src/group-form/lazyContext.d.ts +15 -13
- package/dist/components/tt-form/src/group-form/lazyContext.js +42 -26
- package/dist/components/tt-form/src/group-form/types.d.ts +13 -3
- package/dist/components/tt-form/src/group-form/useGroupForm.js +47 -50
- package/dist/components/tt-form/src/hooks/useFieldArray.js +101 -93
- package/dist/components/tt-form/src/hooks/useSelectCollapse.js +47 -47
- package/dist/components/tt-form/src/types.d.ts +3 -5
- package/dist/components/tt-modal-form/index.vue.js +12 -11
- package/dist/components/tt-radio-group/index.d.ts +5 -1
- package/dist/components/tt-radio-group/index.vue.d.ts +8 -1
- package/dist/components/tt-radio-group/index.vue.js +31 -33
- package/dist/components/tt-table/src/TableForm.vue.js +3 -2
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -22,7 +22,7 @@ import { getMergedDisabled as me, resolveArrayItemState as x } from "./utils.js"
|
|
|
22
22
|
function de(r) {
|
|
23
23
|
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !U(r);
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const se = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rules", "formItemClass", "wrapperClass", "defaultValue", "hide", "disabled", "dependencies"], ue = /* @__PURE__ */ M({
|
|
26
26
|
name: "FormArrayRegister",
|
|
27
27
|
props: le,
|
|
28
28
|
setup(r, {
|
|
@@ -53,7 +53,7 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
|
|
|
53
53
|
isDisabled: R,
|
|
54
54
|
isIf: H,
|
|
55
55
|
isShow: L
|
|
56
|
-
} = ie(() => r.dependencies), w = h(() => Q(D,
|
|
56
|
+
} = ie(() => r.dependencies), w = h(() => Q(D, se)), g = h(() => I(r.fieldName)), A = h(() => {
|
|
57
57
|
var e;
|
|
58
58
|
return (e = v.value) == null ? void 0 : e.at(g.value);
|
|
59
59
|
});
|
|
@@ -65,12 +65,12 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
|
|
|
65
65
|
const {
|
|
66
66
|
entry: a,
|
|
67
67
|
index: t,
|
|
68
|
-
itemFieldName:
|
|
68
|
+
itemFieldName: u,
|
|
69
69
|
parentItemPath: m
|
|
70
70
|
} = e;
|
|
71
71
|
return te({
|
|
72
72
|
arrayPath: g.value,
|
|
73
|
-
itemPath: I(
|
|
73
|
+
itemPath: I(u),
|
|
74
74
|
index: t,
|
|
75
75
|
row: a.value,
|
|
76
76
|
arrayLength: ((n = b(l.fields)) == null ? void 0 : n.length) ?? 0,
|
|
@@ -83,7 +83,7 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
|
|
|
83
83
|
function k(e, a) {
|
|
84
84
|
const {
|
|
85
85
|
entry: t,
|
|
86
|
-
index:
|
|
86
|
+
index: u,
|
|
87
87
|
itemFieldName: m,
|
|
88
88
|
parentItemPath: n
|
|
89
89
|
} = a, d = `${m}.${e.fieldName}`;
|
|
@@ -92,7 +92,7 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
|
|
|
92
92
|
dynamicRules: F.value,
|
|
93
93
|
dynamicDisabled: R.value,
|
|
94
94
|
props: r
|
|
95
|
-
}),
|
|
95
|
+
}), s = {
|
|
96
96
|
...w.value,
|
|
97
97
|
...e,
|
|
98
98
|
fieldName: d,
|
|
@@ -100,11 +100,12 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
|
|
|
100
100
|
disabled: i.disabled,
|
|
101
101
|
formItemClass: i.formItemClass,
|
|
102
102
|
virtual: r.virtual,
|
|
103
|
+
progressive: r.progressive,
|
|
103
104
|
arraySchema: e.arraySchema
|
|
104
105
|
};
|
|
105
|
-
return P(
|
|
106
|
+
return P(ue, G({
|
|
106
107
|
key: d
|
|
107
|
-
},
|
|
108
|
+
}, s), de(o) ? o : {
|
|
108
109
|
default: () => [o]
|
|
109
110
|
});
|
|
110
111
|
}
|
|
@@ -124,32 +125,33 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
|
|
|
124
125
|
key: `${t.key}-${d}`,
|
|
125
126
|
fieldConfig: S,
|
|
126
127
|
rules: S.rules,
|
|
127
|
-
virtual: r.virtual
|
|
128
|
+
virtual: r.virtual,
|
|
129
|
+
progressive: r.progressive
|
|
128
130
|
}, {
|
|
129
131
|
default: (i) => {
|
|
130
|
-
var
|
|
132
|
+
var s, f;
|
|
131
133
|
return (f = o[e.fieldName]) == null ? void 0 : f.call(o, {
|
|
132
134
|
...i,
|
|
133
135
|
action: l,
|
|
134
136
|
entry: t,
|
|
135
|
-
index:
|
|
137
|
+
index: u,
|
|
136
138
|
fieldName: m,
|
|
137
139
|
form: p,
|
|
138
140
|
arrayPath: g.value,
|
|
139
141
|
arrayHandle: A.value,
|
|
140
142
|
arrayAction: v.value,
|
|
141
143
|
parentItemPath: n,
|
|
142
|
-
arrayLength: ((
|
|
144
|
+
arrayLength: ((s = b(l.fields)) == null ? void 0 : s.length) ?? 0
|
|
143
145
|
});
|
|
144
146
|
}
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
function E(e, a) {
|
|
148
|
-
var
|
|
149
|
-
const t = `${r.fieldName}[${a}]`,
|
|
150
|
-
if (
|
|
150
|
+
var s;
|
|
151
|
+
const t = `${r.fieldName}[${a}]`, u = o[r.fieldName], m = r.fieldName.lastIndexOf("."), n = m !== -1 ? r.fieldName.slice(0, m) : void 0;
|
|
152
|
+
if (u) {
|
|
151
153
|
const f = me(R.value, void 0, r.disabled);
|
|
152
|
-
return
|
|
154
|
+
return u({
|
|
153
155
|
action: l,
|
|
154
156
|
entry: e,
|
|
155
157
|
index: a,
|
|
@@ -160,7 +162,7 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
|
|
|
160
162
|
arrayHandle: A.value,
|
|
161
163
|
arrayAction: v.value,
|
|
162
164
|
parentItemPath: n,
|
|
163
|
-
arrayLength: ((
|
|
165
|
+
arrayLength: ((s = b(l.fields)) == null ? void 0 : s.length) ?? 0
|
|
164
166
|
});
|
|
165
167
|
}
|
|
166
168
|
const d = {
|
|
@@ -199,5 +201,5 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
|
|
|
199
201
|
}
|
|
200
202
|
});
|
|
201
203
|
export {
|
|
202
|
-
|
|
204
|
+
ue as FormArrayRegister
|
|
203
205
|
};
|
|
@@ -44,6 +44,10 @@ export declare const formArrayRegisterProps: {
|
|
|
44
44
|
readonly type: BooleanConstructor;
|
|
45
45
|
readonly default: false;
|
|
46
46
|
};
|
|
47
|
+
readonly progressive: {
|
|
48
|
+
readonly type: BooleanConstructor;
|
|
49
|
+
readonly default: false;
|
|
50
|
+
};
|
|
47
51
|
/** useArraySchema 时:数组整体最外层容器 class(边框、间距等) */
|
|
48
52
|
readonly wrapperClass: {
|
|
49
53
|
readonly type: PropType<NonNullable<FormSchema["wrapperClass"]>>;
|
|
@@ -6,6 +6,10 @@ export type ArrayRegisterProps = Pick<ArrayRegisterSchema, "fieldName" | "arrayS
|
|
|
6
6
|
* 虚拟滚动/懒渲染开关(来自渲染层,不属于 FormSchema)
|
|
7
7
|
*/
|
|
8
8
|
virtual?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 渐进式挂载开关(来自渲染层,不属于 FormSchema)
|
|
11
|
+
*/
|
|
12
|
+
progressive?: boolean;
|
|
9
13
|
};
|
|
10
14
|
export type { ArrayRegisterDependencies };
|
|
11
15
|
export type RowRenderCtx = {
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { FormItemDependencies, FormSchemaRuleType, MaybeComponentProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @param component - 字段 schema 的 component 配置,或 FormField.vue 解析后的组件对象
|
|
4
|
+
* @returns {"required" | "selectRequired"} 必填规则名
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveRequiredRuleName(component: unknown): "required" | "selectRequired";
|
|
2
7
|
/**
|
|
3
8
|
* 解析Nested Objects对应的字段值
|
|
4
9
|
* @param values 表单值
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as n, computed as V, watch as N } from "vue";
|
|
2
2
|
import "axios";
|
|
3
3
|
import "element-plus";
|
|
4
|
-
import { isFunction as o, isBoolean as
|
|
4
|
+
import { isFunction as o, isBoolean as F, isString as S } from "../../../../packages/utils/src/is.js";
|
|
5
5
|
import "xe-utils";
|
|
6
6
|
import "dayjs";
|
|
7
7
|
import "dayjs/plugin/utc";
|
|
@@ -12,52 +12,90 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
|
|
|
12
12
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
13
13
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
14
|
import "lodash-es";
|
|
15
|
-
import { get as
|
|
16
|
-
import { useFormValues as
|
|
17
|
-
import { injectRenderFormProps as
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
import { get as k } from "es-toolkit/compat";
|
|
16
|
+
import { useFormValues as B } from "vee-validate";
|
|
17
|
+
import { injectRenderFormProps as C } from "./context.js";
|
|
18
|
+
const K = /* @__PURE__ */ new Set(["ElInput", "FormElInput", "ElInputNumber", "ElInputTag", "ElMention"]);
|
|
19
|
+
function er(r) {
|
|
20
|
+
const e = S(r) ? r : (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.__name);
|
|
21
|
+
return S(e) && K.has(e) ? "required" : "selectRequired";
|
|
22
|
+
}
|
|
23
|
+
function M(r, e) {
|
|
24
|
+
if (e.startsWith("[") && e.endsWith("]")) {
|
|
25
|
+
const E = e.slice(1, -1);
|
|
26
|
+
return r[E];
|
|
22
27
|
}
|
|
23
|
-
return
|
|
28
|
+
return k(r, e);
|
|
24
29
|
}
|
|
25
|
-
function
|
|
26
|
-
var
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
30
|
+
function tr(r) {
|
|
31
|
+
var R;
|
|
32
|
+
const e = B(), s = C().form;
|
|
33
|
+
if (!e)
|
|
29
34
|
throw new Error("useDependencies should be used within <TtForm>");
|
|
30
|
-
const
|
|
31
|
-
var
|
|
32
|
-
return (((
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
[b,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!t || !((V = t == null ? void 0 : t.triggerFields) != null && V.length))
|
|
35
|
+
const l = n(!0), f = n(!1), m = n(!0), w = n(!1), g = n({}), d = n(), _ = V(() => {
|
|
36
|
+
var i;
|
|
37
|
+
return (((i = r()) == null ? void 0 : i.triggerFields) ?? []).map((h) => M(e.value, h));
|
|
38
|
+
});
|
|
39
|
+
let I = 0;
|
|
40
|
+
return N(
|
|
41
|
+
[_, r],
|
|
42
|
+
async ([b, i]) => {
|
|
43
|
+
var q;
|
|
44
|
+
if (!i || !((q = i == null ? void 0 : i.triggerFields) != null && q.length))
|
|
41
45
|
return;
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
const h = ++I, u = () => h !== I, { componentProps: x, disabled: v, if: c, required: P, rules: y, show: p, trigger: T } = i, a = e.value;
|
|
47
|
+
if (o(c)) {
|
|
48
|
+
const t = !!await c(a, s);
|
|
49
|
+
if (u() || (l.value = t, !l.value)) return;
|
|
50
|
+
} else if (F(c)) {
|
|
51
|
+
if (l.value = c, !l.value) return;
|
|
52
|
+
} else
|
|
53
|
+
l.value = !0;
|
|
44
54
|
if (o(p)) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
const t = !!await p(a, s);
|
|
56
|
+
if (u()) return;
|
|
57
|
+
m.value = t;
|
|
58
|
+
} else F(p) ? m.value = p : m.value = !0;
|
|
59
|
+
if (o(x)) {
|
|
60
|
+
const t = await x(a, s);
|
|
61
|
+
if (u()) return;
|
|
62
|
+
g.value = t;
|
|
63
|
+
} else
|
|
64
|
+
g.value = {};
|
|
65
|
+
if (o(y)) {
|
|
66
|
+
const t = await y(a, s);
|
|
67
|
+
if (u()) return;
|
|
68
|
+
d.value = t;
|
|
69
|
+
} else
|
|
70
|
+
d.value = void 0;
|
|
71
|
+
if (o(v)) {
|
|
72
|
+
const t = !!await v(a, s);
|
|
73
|
+
if (u()) return;
|
|
74
|
+
f.value = t;
|
|
75
|
+
} else F(v) ? f.value = v : f.value = !1;
|
|
76
|
+
if (o(P)) {
|
|
77
|
+
const t = !!await P(a, s);
|
|
78
|
+
if (u()) return;
|
|
79
|
+
w.value = t;
|
|
80
|
+
} else
|
|
81
|
+
w.value = !1;
|
|
82
|
+
if (o(T)) {
|
|
83
|
+
if (u()) return;
|
|
84
|
+
await T(a, s);
|
|
85
|
+
}
|
|
49
86
|
},
|
|
50
|
-
{ deep: !0, immediate: ((
|
|
87
|
+
{ deep: !0, immediate: ((R = r()) == null ? void 0 : R.immediate) ?? !0 }
|
|
51
88
|
), {
|
|
52
|
-
dynamicComponentProps:
|
|
53
|
-
dynamicRules:
|
|
54
|
-
isDisabled:
|
|
55
|
-
isIf:
|
|
56
|
-
isRequired:
|
|
89
|
+
dynamicComponentProps: g,
|
|
90
|
+
dynamicRules: d,
|
|
91
|
+
isDisabled: f,
|
|
92
|
+
isIf: l,
|
|
93
|
+
isRequired: w,
|
|
57
94
|
isShow: m
|
|
58
95
|
};
|
|
59
96
|
}
|
|
60
97
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
98
|
+
tr as default,
|
|
99
|
+
er as resolveRequiredRuleName,
|
|
100
|
+
M as resolveValueByFieldName
|
|
63
101
|
};
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { NavAnchorItem } from '../../../tt-nav-anchor';
|
|
2
2
|
import { GroupFormSectionProps } from './types';
|
|
3
|
+
declare function scrollToGroup(key: string): void;
|
|
3
4
|
/**
|
|
4
|
-
* @description
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* 在字段渲染导致高度变化时自动校正位置,高度稳定后停止。
|
|
9
|
-
* @param {string} key 分组 key
|
|
5
|
+
* @description 滚动到指定字段(通过 LazyFormField 容器上的 data-field-anchor 定位)。
|
|
6
|
+
* 该锚点在字段未挂载(虚拟懒渲染仅骨架/占位)时也存在于 DOM,因此可用于滚动到
|
|
7
|
+
* 「无分组、且尚未挂载」的字段——这类字段没有分组锚点可用。
|
|
8
|
+
* @param {string} fieldName 字段名(完整路径)
|
|
10
9
|
*/
|
|
11
|
-
declare function
|
|
10
|
+
declare function scrollToField(fieldName: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* @description 等待渐进式挂载完成:调度器基于「挂载计数」精确判定所有字段真实 DOM 已就绪
|
|
13
|
+
* (由 FormField 的 vue:mounted 抵消 trackMount 计数),再等一帧绘制。
|
|
14
|
+
* 用于需要操作全量 DOM 的场景(截图、导出、爬虫等)前调用。
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
17
|
+
declare function whenAllRendered(): Promise<void>;
|
|
12
18
|
declare function __VLS_template(): {
|
|
13
19
|
attrs: Partial<{}>;
|
|
14
20
|
slots: Partial<Record<NonNullable<string | number>, (_: {
|
|
@@ -22,6 +28,8 @@ declare function __VLS_template(): {
|
|
|
22
28
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
23
29
|
declare const __VLS_component: import('vue').DefineComponent<GroupFormSectionProps, {
|
|
24
30
|
scrollToGroup: typeof scrollToGroup;
|
|
31
|
+
scrollToField: typeof scrollToField;
|
|
32
|
+
whenAllRendered: typeof whenAllRendered;
|
|
25
33
|
navItems: import('vue').ComputedRef<NavAnchorItem[]>;
|
|
26
34
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<GroupFormSectionProps> & Readonly<{}>, {
|
|
27
35
|
commonConfig: import('../types').FormCommonConfig;
|