@dazhicheng/ui 1.6.17 → 1.6.19
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-area/TtArea.vue.js +1 -1
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue.js +2 -2
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +165 -159
- package/dist/components/tt-form/src/form-render/dependencies.d.ts +1 -1
- package/dist/components/tt-form/src/form-render/dependencies.js +53 -53
- package/dist/components/tt-form/src/form-render/form.vue2.js +68 -67
- package/dist/components/tt-form/src/form-render/helper.js +20 -16
- package/dist/components/tt-form/src/group-form/groupFormApi.js +46 -45
- package/dist/components/tt-icon/index.vue.js +2 -2
- package/dist/components/tt-loading/src/loading.vue.js +2 -2
- package/dist/components/tt-table/src/TableForm.vue.d.ts +9 -0
- package/dist/components/tt-table/src/TableForm.vue.js +190 -179
- package/dist/components/tt-table/src/props.d.ts +6 -1
- package/dist/components/tt-table/src/props.js +9 -4
- package/dist/components/tt-table/src/types/tableForm.d.ts +19 -0
- package/dist/hooks/useBasicDataOptions.js +27 -26
- package/dist/hooks/useDataPermissionOptions.js +75 -92
- package/dist/hooks/userListCache.d.ts +12 -0
- package/dist/hooks/userListCache.js +17 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var l = (
|
|
1
|
+
var V = Object.defineProperty;
|
|
2
|
+
var b = (f, h, e) => h in f ? V(f, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[h] = e;
|
|
3
|
+
var l = (f, h, e) => b(f, typeof h != "symbol" ? h + "" : h, e);
|
|
4
4
|
import "axios";
|
|
5
5
|
import "element-plus";
|
|
6
|
-
import { isString as F, isFunction as v, isBoolean as
|
|
7
|
-
import { ref as
|
|
6
|
+
import { isString as F, isFunction as v, isBoolean as R } from "../../../../packages/utils/src/is.js";
|
|
7
|
+
import { ref as T, reactive as A, computed as K, nextTick as E, toRaw as C } from "vue";
|
|
8
8
|
import "dayjs";
|
|
9
9
|
import "numeral";
|
|
10
10
|
import "xe-utils";
|
|
@@ -15,24 +15,25 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ae
|
|
|
15
15
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
16
16
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
17
17
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
18
|
-
import { isPlainObject as S, get as N, cloneDeep as
|
|
19
|
-
import { validate as
|
|
20
|
-
import { toTypedSchema as
|
|
21
|
-
import { FormApi as
|
|
22
|
-
import { resolveRequiredRuleName as
|
|
23
|
-
import { resolveArraySchemasForRuntime as
|
|
24
|
-
import { normalizeArrayFieldPath as _, childArrayPath as
|
|
25
|
-
import { extractFlatSchemas as g, collectDefaultCollapseStates as M, getGroupValues as
|
|
26
|
-
function
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
import { isPlainObject as S, get as N, cloneDeep as H, isEqual as k } from "lodash-es";
|
|
19
|
+
import { validate as O } from "vee-validate";
|
|
20
|
+
import { toTypedSchema as x } from "@vee-validate/zod";
|
|
21
|
+
import { FormApi as j } from "../formApi.js";
|
|
22
|
+
import { resolveRequiredRuleName as W, resolveValueByFieldName as P } from "../form-render/dependencies.js";
|
|
23
|
+
import { resolveArraySchemasForRuntime as $, resolveSchemaFieldInitialValue as I } from "../useFormContext.js";
|
|
24
|
+
import { normalizeArrayFieldPath as _, childArrayPath as q } from "../utils/array-path.js";
|
|
25
|
+
import { extractFlatSchemas as g, collectDefaultCollapseStates as M, getGroupValues as D, cloneSchemaTree as y, insertFieldsByPosition as B, removeFieldsFromGroup as L, removeGroupsFromGroup as z, isGroupSchema as X, isRowSchema as Y } from "./utils.js";
|
|
26
|
+
function J(f) {
|
|
27
|
+
if (!f)
|
|
28
|
+
return;
|
|
29
|
+
const h = C(f);
|
|
30
|
+
if (F(h))
|
|
31
|
+
return h;
|
|
32
|
+
if (v(h.safeParse))
|
|
33
|
+
return x(h);
|
|
33
34
|
}
|
|
34
|
-
const
|
|
35
|
-
class
|
|
35
|
+
const Q = 20;
|
|
36
|
+
class ye extends j {
|
|
36
37
|
/**
|
|
37
38
|
* @param {TtFormProps} formProps - 底层表单配置(已展平的 schema、layout 等)
|
|
38
39
|
* @param {GroupFormApiOptions} groupOptions - 分组场景专属配置
|
|
@@ -94,7 +95,7 @@ class ge extends x {
|
|
|
94
95
|
/** 本轮回环告警是否已输出,避免刷屏 */
|
|
95
96
|
l(this, "_navSyncLoopWarned", !1);
|
|
96
97
|
/** VirtualGroupForm 组件实例引用,由 useGroupForm 的 h() 渲染时赋值 */
|
|
97
|
-
l(this, "groupFormRef",
|
|
98
|
+
l(this, "groupFormRef", T(null));
|
|
98
99
|
/**
|
|
99
100
|
* @description 响应式读取 store 状态,由 useGroupForm 在运行时注入实现
|
|
100
101
|
* @param {Function} [selector] - 可选的状态选择器
|
|
@@ -112,7 +113,7 @@ class ge extends x {
|
|
|
112
113
|
estimateFieldHeight: c = 52,
|
|
113
114
|
scrollOffset: p = 0
|
|
114
115
|
} = t;
|
|
115
|
-
this.progressive = i, this.virtual = i ? !1 : r, this._defaultNavAnchorProps = { show: !0, ...o }, this._scrollToFirstError = a, this._containerHeight = n, this._rootMargin = u, this._estimateFieldHeight = c, this._scrollOffset = p, this._initialGroupSchema = s, this._initialFlatSchema = g(s), this.collapseStates = A({}), M(s, this.collapseStates), this.hiddenGroupKeys = A(/* @__PURE__ */ new Set()), this.hiddenFieldNames = A(/* @__PURE__ */ new Set()), this._navErrorCountsRef =
|
|
116
|
+
this.progressive = i, this.virtual = i ? !1 : r, this._defaultNavAnchorProps = { show: !0, ...o }, this._scrollToFirstError = a, this._containerHeight = n, this._rootMargin = u, this._estimateFieldHeight = c, this._scrollOffset = p, this._initialGroupSchema = s, this._initialFlatSchema = g(s), this.collapseStates = A({}), M(s, this.collapseStates), this.hiddenGroupKeys = A(/* @__PURE__ */ new Set()), this.hiddenFieldNames = A(/* @__PURE__ */ new Set()), this._navErrorCountsRef = K(() => this._computeNavErrorCounts()), this.navErrorCounts = new Proxy({}, {
|
|
116
117
|
get: (m, d) => {
|
|
117
118
|
if (F(d))
|
|
118
119
|
return this._navErrorCountsRef.value[d] ?? 0;
|
|
@@ -216,10 +217,10 @@ class ge extends x {
|
|
|
216
217
|
async _runFieldValidations(e, t) {
|
|
217
218
|
const s = await Promise.all(
|
|
218
219
|
e.map(async (i) => {
|
|
219
|
-
const o =
|
|
220
|
+
const o = J(i.rules);
|
|
220
221
|
if (!o)
|
|
221
222
|
return { name: i.name, error: void 0 };
|
|
222
|
-
const { valid: a, errors: n } = await
|
|
223
|
+
const { valid: a, errors: n } = await O(i.value, o, {
|
|
223
224
|
name: i.name,
|
|
224
225
|
label: i.label,
|
|
225
226
|
values: t
|
|
@@ -294,7 +295,7 @@ class ge extends x {
|
|
|
294
295
|
const t = await super.getValues();
|
|
295
296
|
if (e) {
|
|
296
297
|
const s = this.store.state.groupSchema ?? this._initialGroupSchema;
|
|
297
|
-
return
|
|
298
|
+
return D(s, t);
|
|
298
299
|
}
|
|
299
300
|
return t;
|
|
300
301
|
}
|
|
@@ -358,7 +359,7 @@ class ge extends x {
|
|
|
358
359
|
return;
|
|
359
360
|
}
|
|
360
361
|
const r = this.getGroupFieldNames(e);
|
|
361
|
-
t ? (this.hiddenGroupKeys.delete(e), this._setFieldsHidden(r, !1)) : (this._setFieldsHidden(r, !0), this._clearHiddenFieldValues(r), this.hiddenGroupKeys.add(e)),
|
|
362
|
+
t ? (this.hiddenGroupKeys.delete(e), this._setFieldsHidden(r, !1)) : (this._setFieldsHidden(r, !0), this._clearHiddenFieldValues(r), this.hiddenGroupKeys.add(e)), E(() => {
|
|
362
363
|
this.syncNavErrorCountsFromForm();
|
|
363
364
|
});
|
|
364
365
|
}
|
|
@@ -368,7 +369,7 @@ class ge extends x {
|
|
|
368
369
|
* @param {boolean} visible - 是否可见
|
|
369
370
|
*/
|
|
370
371
|
setFieldsVisible(e, t) {
|
|
371
|
-
t ? this._setFieldsHidden(e, !1) : (this._setFieldsHidden(e, !0), this._clearHiddenFieldValues(e)),
|
|
372
|
+
t ? this._setFieldsHidden(e, !1) : (this._setFieldsHidden(e, !0), this._clearHiddenFieldValues(e)), E(() => {
|
|
372
373
|
this.syncNavErrorCountsFromForm();
|
|
373
374
|
});
|
|
374
375
|
}
|
|
@@ -425,7 +426,7 @@ class ge extends x {
|
|
|
425
426
|
*/
|
|
426
427
|
appendFields(e, t) {
|
|
427
428
|
const s = this.store.state.groupSchema ?? [], r = y(s);
|
|
428
|
-
t && (t.before || t.after) ?
|
|
429
|
+
t && (t.before || t.after) ? B(r, e, t) || r.push(...e) : r.push(...e), this._applyGroupSchema(r), this.seedDefaultsForAppendedFields(g(e));
|
|
429
430
|
}
|
|
430
431
|
/**
|
|
431
432
|
* @description 按标识从 groupSchema 树中移除节点,无需全量重建 schema。
|
|
@@ -436,7 +437,7 @@ class ge extends x {
|
|
|
436
437
|
*/
|
|
437
438
|
removeFields(e) {
|
|
438
439
|
if (!e.length) return;
|
|
439
|
-
const t = this.store.state.groupSchema ?? [], s =
|
|
440
|
+
const t = this.store.state.groupSchema ?? [], s = L(y(t), new Set(e));
|
|
440
441
|
this._applyGroupSchema(s);
|
|
441
442
|
}
|
|
442
443
|
/**
|
|
@@ -462,7 +463,7 @@ class ge extends x {
|
|
|
462
463
|
const t = Array.isArray(e) ? e : [e], s = this._collectGroupKeysWithDescendants(t);
|
|
463
464
|
if (!s.length)
|
|
464
465
|
return;
|
|
465
|
-
const r = [...new Set(s.flatMap((a) => this.getGroupFieldNames(a, !0)))], i = this.store.state.groupSchema ?? [], o =
|
|
466
|
+
const r = [...new Set(s.flatMap((a) => this.getGroupFieldNames(a, !0)))], i = this.store.state.groupSchema ?? [], o = z(y(i), new Set(s));
|
|
466
467
|
this._applyGroupSchema(o), r.length && this.onRemovedSchemaFields(r), this._purgeRemovedGroupState(s), this.navAnchorProps.show && this.syncNavErrorCountsFromForm();
|
|
467
468
|
}
|
|
468
469
|
/**
|
|
@@ -494,7 +495,7 @@ class ge extends x {
|
|
|
494
495
|
const e = this.form;
|
|
495
496
|
if (!(e != null && e.values))
|
|
496
497
|
return;
|
|
497
|
-
if (this._navSyncPassCount >=
|
|
498
|
+
if (this._navSyncPassCount >= Q) {
|
|
498
499
|
this._navSyncLoopWarned || (this._navSyncLoopWarned = !0);
|
|
499
500
|
return;
|
|
500
501
|
}
|
|
@@ -563,13 +564,13 @@ class ge extends x {
|
|
|
563
564
|
void 0,
|
|
564
565
|
`${e.fieldName}.dependencies.rules`
|
|
565
566
|
));
|
|
566
|
-
const i = r || e.rules;
|
|
567
|
+
const i = C(r || e.rules);
|
|
567
568
|
let o = !1;
|
|
568
569
|
return s && v(s.required) && (o = !!await this._safeInvoke(
|
|
569
570
|
() => s.required(t, this),
|
|
570
571
|
!1,
|
|
571
572
|
`${e.fieldName}.dependencies.required`
|
|
572
|
-
)), i ? F(i) ? i : o ? ((a = i == null ? void 0 : i.unwrap) == null ? void 0 : a.call(i)) ?? i : i : o ?
|
|
573
|
+
)), i ? F(i) ? i : o ? ((a = i == null ? void 0 : i.unwrap) == null ? void 0 : a.call(i)) ?? i : i : o ? W(e.component) : void 0;
|
|
573
574
|
}
|
|
574
575
|
/**
|
|
575
576
|
* @description 检查字段的 dependencies 条件,判断字段在当前值下是否应该被校验。
|
|
@@ -584,10 +585,10 @@ class ge extends x {
|
|
|
584
585
|
const i = e.dependencies;
|
|
585
586
|
if (!i) return !0;
|
|
586
587
|
const o = i.if;
|
|
587
|
-
if (o != null && (
|
|
588
|
+
if (o != null && (R(o) && !o || v(o) && !await this._safeInvoke(() => o(t, this), !0, `${r}.dependencies.if`)))
|
|
588
589
|
return !1;
|
|
589
590
|
const a = i.show;
|
|
590
|
-
return !(a != null && (
|
|
591
|
+
return !(a != null && (R(a) && !a || v(a) && !await this._safeInvoke(() => a(t, this), !0, `${r}.dependencies.show`)));
|
|
591
592
|
}
|
|
592
593
|
/**
|
|
593
594
|
* @description 收集当前需要校验的全部可见字段(顶层字段 + 数组行递归展开的行内字段)。
|
|
@@ -630,7 +631,7 @@ class ge extends x {
|
|
|
630
631
|
const m = _(`${o}[${p}]`);
|
|
631
632
|
let d;
|
|
632
633
|
try {
|
|
633
|
-
d =
|
|
634
|
+
d = $({
|
|
634
635
|
item: e,
|
|
635
636
|
arrayPath: o,
|
|
636
637
|
itemPath: m,
|
|
@@ -687,13 +688,13 @@ class ge extends x {
|
|
|
687
688
|
var s;
|
|
688
689
|
t || (this._groupFieldMap = {}, this._groupChildrenMap = {}, this._fieldToGroupKey = {}, this._groupParentMap = {}, this._fieldSchemaMap = {}, this._groupKeySet.clear());
|
|
689
690
|
for (const r of e)
|
|
690
|
-
if (
|
|
691
|
+
if (X(r)) {
|
|
691
692
|
if (this._groupKeySet.has(r.key))
|
|
692
693
|
throw new Error(
|
|
693
694
|
`[GroupFormApi] duplicate group key detected: "${r.key}". Group key must be unique in groupSchema tree.`
|
|
694
695
|
);
|
|
695
696
|
this._groupKeySet.add(r.key), this._groupFieldMap[r.key] = [], this._groupChildrenMap[r.key] = [], t && (this._groupParentMap[r.key] = t, (s = this._groupChildrenMap)[t] ?? (s[t] = []), this._groupChildrenMap[t].push(r.key)), this._buildGroupFieldMap(r.children, r.key);
|
|
696
|
-
} else
|
|
697
|
+
} else Y(r) ? this._buildGroupFieldMap(r.children, t) : t && "fieldName" in r && r.fieldName ? (this._groupFieldMap[t].push(r.fieldName), this._fieldToGroupKey[r.fieldName] = t, this._fieldSchemaMap[r.fieldName] = r) : "fieldName" in r && r.fieldName && (this._fieldSchemaMap[r.fieldName] = r);
|
|
697
698
|
}
|
|
698
699
|
/**
|
|
699
700
|
* @description 根据错误映射更新导航各分组的错误计数
|
|
@@ -795,7 +796,7 @@ class ge extends x {
|
|
|
795
796
|
if (e === void 0 && (Array.isArray(t) || S(t)))
|
|
796
797
|
return this._clearValueKeepStructure(t, t);
|
|
797
798
|
if (t !== void 0 && !Array.isArray(t) && !S(t))
|
|
798
|
-
return
|
|
799
|
+
return H(t);
|
|
799
800
|
}
|
|
800
801
|
/**
|
|
801
802
|
* @description 清空隐藏字段的值、校验状态和虚拟错误缓存,数组和对象保留结构
|
|
@@ -805,8 +806,8 @@ class ge extends x {
|
|
|
805
806
|
var t, s, r, i, o, a, n;
|
|
806
807
|
if (e.length)
|
|
807
808
|
for (const u of e) {
|
|
808
|
-
const c = N((t = this.form) == null ? void 0 : t.values, u), p = this._fieldSchemaMap[u] ?
|
|
809
|
-
|
|
809
|
+
const c = N((t = this.form) == null ? void 0 : t.values, u), p = this._fieldSchemaMap[u] ? I(this._fieldSchemaMap[u]) : void 0, m = this._clearValueKeepStructure(c, p);
|
|
810
|
+
k(c, m) || (r = (s = this.form) == null ? void 0 : s.setFieldValue) == null || r.call(s, u, m, !1), (o = (i = this.form) == null ? void 0 : i.setFieldError) == null || o.call(i, u, void 0), (n = (a = this.form) == null ? void 0 : a.setFieldTouched) == null || n.call(a, u, !1);
|
|
810
811
|
}
|
|
811
812
|
}
|
|
812
813
|
/**
|
|
@@ -849,7 +850,7 @@ class ge extends x {
|
|
|
849
850
|
* @param childField 子数组字段名
|
|
850
851
|
*/
|
|
851
852
|
at: (r, i, o) => {
|
|
852
|
-
const a = e.at(
|
|
853
|
+
const a = e.at(q(s(r), i, o));
|
|
853
854
|
return this._wrapNestedArrayHandle(a, t);
|
|
854
855
|
}
|
|
855
856
|
};
|
|
@@ -859,5 +860,5 @@ class ge extends x {
|
|
|
859
860
|
}
|
|
860
861
|
}
|
|
861
862
|
export {
|
|
862
|
-
|
|
863
|
+
ye as GroupFormApi
|
|
863
864
|
};
|
|
@@ -2,7 +2,7 @@ import o from "./index.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const
|
|
5
|
+
const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d731bb93"]]);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
a as default
|
|
8
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./loading.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-7e6228e4"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
r as default
|
|
7
7
|
};
|
|
@@ -352,6 +352,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
352
352
|
type: import('vue').PropType<Fn>;
|
|
353
353
|
default: null;
|
|
354
354
|
};
|
|
355
|
+
tableSearchBefore: {
|
|
356
|
+
type: import('vue').PropType<NonNullable<TtTableFormProps["tableSearchBefore"]>>;
|
|
357
|
+
default: null;
|
|
358
|
+
};
|
|
355
359
|
toolConfig: {
|
|
356
360
|
type: import('vue').PropType<import('../../../index').TtTableToolsProps>;
|
|
357
361
|
default: null;
|
|
@@ -575,6 +579,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
575
579
|
type: import('vue').PropType<Fn>;
|
|
576
580
|
default: null;
|
|
577
581
|
};
|
|
582
|
+
tableSearchBefore: {
|
|
583
|
+
type: import('vue').PropType<NonNullable<TtTableFormProps["tableSearchBefore"]>>;
|
|
584
|
+
default: null;
|
|
585
|
+
};
|
|
578
586
|
toolConfig: {
|
|
579
587
|
type: import('vue').PropType<import('../../../index').TtTableToolsProps>;
|
|
580
588
|
default: null;
|
|
@@ -594,6 +602,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
594
602
|
handleSearchInfoFn: Fn<any, any>;
|
|
595
603
|
toolConfig: import('../../../index').TtTableToolsProps;
|
|
596
604
|
tableRefreshBefore: Fn<any, any>;
|
|
605
|
+
tableSearchBefore: (values: Recordable) => import('../../../index').TtTableSearchBeforeResult | Promise<import('../../../index').TtTableSearchBeforeResult>;
|
|
597
606
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
598
607
|
columnModalRef: ({
|
|
599
608
|
$: import('vue').ComponentInternalInstance;
|