@dazhicheng/ui 1.6.29 → 1.6.31
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/assets/svg/exportSvg.svg.js +2 -2
- package/dist/components/tt-table/src/components/TableToolbarTools.vue.js +1 -1
- package/dist/components/tt-upload/src/TtUpload.vue.js +21 -21
- package/dist/hooks/useFormSchemasLink.d.ts +28 -31
- package/dist/hooks/useFormSchemasLink.js +176 -165
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e = '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><!-- Icon from Remix Icon by Remix Design - https://github.com/Remix-Design/RemixIcon/blob/master/License --><path fill="#888888" d="M1 14.5a6.5 6.5 0 0 1 3.064-5.519a8.001 8.001 0 0 1 15.872 0a6.5 6.5 0 0 1-2.936 12L7 21c-3.356-.274-6-3.078-6-6.5m15.848 4.487a4.5 4.5 0 0 0 2.03-8.309l-.807-.503l-.12-.942a6.001 6.001 0 0 0-11.903 0l-.12.942l-.805.503a4.5 4.5 0 0 0 2.029 8.309l.173.013h9.35zM13 12h3l-4 5l-4-5h3V8h2z"/></svg>';
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
e as default
|
|
4
4
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as fe, mergeModels as B, useModel as me, useSlots as we, ref as
|
|
1
|
+
import { defineComponent as fe, mergeModels as B, useModel as me, useSlots as we, ref as $, computed as m, createBlock as ve, openBlock as _e, createVNode as n, mergeProps as ye, createTextVNode as w } from "vue";
|
|
2
2
|
import ge from "../../../assets/svg/exportSvg.svg.js";
|
|
3
3
|
import M from "../../../assets/svg/fileSvg.svg.js";
|
|
4
|
-
import { TtButton as
|
|
4
|
+
import { TtButton as k } from "../../tt-button/index.js";
|
|
5
5
|
import { TtIcon as b } from "../../tt-icon/index.js";
|
|
6
6
|
import "../../tt-modal/index.js";
|
|
7
7
|
import "../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
|
|
8
8
|
import { useDesign as he } from "../../../packages/hooks/src/useDesign.js";
|
|
9
9
|
import "axios";
|
|
10
|
-
import { ElMessage as f, ElImageViewer as
|
|
11
|
-
import { isString as
|
|
10
|
+
import { ElMessage as f, ElImageViewer as Ue, ElUpload as $e } from "element-plus";
|
|
11
|
+
import { isString as ke, isNumber as be } from "../../../packages/utils/src/is.js";
|
|
12
12
|
import "dayjs";
|
|
13
13
|
import "numeral";
|
|
14
14
|
import "xe-utils";
|
|
@@ -41,13 +41,13 @@ const ao = /* @__PURE__ */ fe({
|
|
|
41
41
|
expose: P,
|
|
42
42
|
emit: V
|
|
43
43
|
}) {
|
|
44
|
-
const N = ["modal", "modelValue", "ossType", "uploadOssApi", "uploadTip", "maxSize", "showFileList", "showUploadArea", "showTemplateDownload", "templateText", "showPreview", "showDownload", "showDelete", "gridThreshold", "gridColumns", "showCount", "uploadOssViewApi", "beforeUpload", "onError"],
|
|
45
|
-
function
|
|
44
|
+
const N = ["modal", "modelValue", "ossType", "uploadOssApi", "uploadTip", "maxSize", "showFileList", "showUploadArea", "showTemplateDownload", "templateText", "showPreview", "showDownload", "showDelete", "gridThreshold", "gridColumns", "showCount", "uploadOssViewApi", "beforeUpload", "onError"], D = /* @__PURE__ */ new Set(["jpg", "jpeg", "png", "gif", "webp", "bmp", "svg"]);
|
|
45
|
+
function I(e) {
|
|
46
46
|
var t;
|
|
47
47
|
const o = ((t = e.split(".").pop()) == null ? void 0 : t.toLowerCase()) || "";
|
|
48
|
-
return
|
|
48
|
+
return D.has(o);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function K(e, o, t) {
|
|
51
51
|
var r;
|
|
52
52
|
if (!(t != null && t.trim())) return !0;
|
|
53
53
|
const l = e.includes(".") ? ((r = e.split(".").pop()) == null ? void 0 : r.toLowerCase()) ?? "" : "";
|
|
@@ -55,7 +55,7 @@ const ao = /* @__PURE__ */ fe({
|
|
|
55
55
|
}
|
|
56
56
|
const a = S, p = V, u = me(S, "modelValue"), d = we(), {
|
|
57
57
|
prefixCls: i
|
|
58
|
-
} = he("upload"), C =
|
|
58
|
+
} = he("upload"), C = $(), h = $(!1), x = $([]), [j, v] = xe({
|
|
59
59
|
onOk() {
|
|
60
60
|
p("ok", u.value);
|
|
61
61
|
},
|
|
@@ -74,7 +74,7 @@ const ao = /* @__PURE__ */ fe({
|
|
|
74
74
|
closeModal: v.closeModal,
|
|
75
75
|
getFileList: W
|
|
76
76
|
});
|
|
77
|
-
const
|
|
77
|
+
const U = m(() => u.value.length > a.gridThreshold), _ = m(() => a.limit ?? 0), y = m(() => a.uploadOssApi ?? T.uploadOssApi), G = m(() => a.uploadOssViewApi ?? T.uploadOssViewApi ?? Ce);
|
|
78
78
|
async function q(e, o) {
|
|
79
79
|
const l = (a.ossDir || o.dir || "notice").replace(/\/+$/, ""), s = l ? `${l}/${Date.now()}_${e.name}` : `${Date.now()}_${e.name}`, r = new FormData();
|
|
80
80
|
r.append("key", s), r.append("policy", o.policy), r.append("x-oss-signature-version", o.version), r.append("x-oss-signature", o.signature), r.append("x-oss-credential", o.x_oss_credential), r.append("x-oss-date", o.x_oss_date), r.append("x-oss-security-token", o.security_token), o.callback && r.append("callback", o.callback), r.append("success_action_status", "200"), r.append("file", e);
|
|
@@ -88,7 +88,7 @@ const ao = /* @__PURE__ */ fe({
|
|
|
88
88
|
}
|
|
89
89
|
async function H(e, o) {
|
|
90
90
|
const l = (a.ossDir || o.dir || "notice").replace(/\/+$/, ""), s = l ? `${l}/${Date.now()}_${e.name}` : `${Date.now()}_${e.name}`, r = new FormData();
|
|
91
|
-
r.append("key", s), r.append("policy", o.policy), r.append("AccessKeyId", o.accessKeyId), r.append("signature", o.signature), o.security_token && r.append("x-obs-security-token", o.security_token), o.callbackUrl && r.append("callbackUrl", o.callbackUrl), o.callbackBody && r.append("callbackBody", o.callbackBody), o.callbackBodyType && r.append("callbackBodyType", o.callbackBodyType),
|
|
91
|
+
r.append("key", s), r.append("policy", o.policy), r.append("AccessKeyId", o.accessKeyId), r.append("signature", o.signature), o.security_token && r.append("x-obs-security-token", o.security_token), o.callbackUrl && r.append("callbackUrl", o.callbackUrl), o.callbackBody && r.append("callbackBody", o.callbackBody), o.callbackBodyType && r.append("callbackBodyType", o.callbackBodyType), r.append("success_action_status", "200"), r.append("file", e);
|
|
92
92
|
const c = await fetch(o.host, {
|
|
93
93
|
method: "POST",
|
|
94
94
|
body: r
|
|
@@ -160,9 +160,9 @@ const ao = /* @__PURE__ */ fe({
|
|
|
160
160
|
httpRequest: y.value ? Q : J
|
|
161
161
|
}));
|
|
162
162
|
function oe(e) {
|
|
163
|
-
if (!
|
|
163
|
+
if (!K(e.name, e.type, a.accept))
|
|
164
164
|
return f.warning(`文件格式不支持,仅支持:${a.accept}`), !1;
|
|
165
|
-
const o = u.value.map((t) =>
|
|
165
|
+
const o = u.value.map((t) => ke(t.fileSize) || be(t.fileSize) ? +t.fileSize : 0).reduce((t, l) => t + l, 0);
|
|
166
166
|
return a.maxSize && (e.size + o) / 1024 / 1024 > a.maxSize ? (f.warning(`文件大小不能超过 ${a.maxSize}MB`), !1) : _.value > 0 && u.value.length >= _.value ? (f.warning("已超过上传数量"), !1) : z(a.beforeUpload) ? a.beforeUpload(e) : !0;
|
|
167
167
|
}
|
|
168
168
|
function te() {
|
|
@@ -200,7 +200,7 @@ const ao = /* @__PURE__ */ fe({
|
|
|
200
200
|
async function re(e) {
|
|
201
201
|
p("preview", e);
|
|
202
202
|
let o = await E(e);
|
|
203
|
-
y.value || (o = URL.createObjectURL(e.file)), o && (
|
|
203
|
+
y.value || (o = URL.createObjectURL(e.file)), o && (I(e.fileName) ? (x.value = [o], h.value = !0) : window.open(o, "_blank"));
|
|
204
204
|
}
|
|
205
205
|
async function ne(e) {
|
|
206
206
|
let o = !1;
|
|
@@ -213,7 +213,7 @@ const ao = /* @__PURE__ */ fe({
|
|
|
213
213
|
}
|
|
214
214
|
const ie = () => a.showUploadArea ? n("div", {
|
|
215
215
|
class: `${i}-area`
|
|
216
|
-
}, [n(
|
|
216
|
+
}, [n($e, ye({
|
|
217
217
|
ref: C
|
|
218
218
|
}, ee.value), {
|
|
219
219
|
default: () => {
|
|
@@ -240,19 +240,19 @@ const ao = /* @__PURE__ */ fe({
|
|
|
240
240
|
index: o
|
|
241
241
|
}) : n("div", {
|
|
242
242
|
class: `${i}-file__actions`
|
|
243
|
-
}, [a.showPreview && n(
|
|
243
|
+
}, [a.showPreview && n(k, {
|
|
244
244
|
type: "primary",
|
|
245
245
|
link: !0,
|
|
246
246
|
onClick: () => re(e)
|
|
247
247
|
}, {
|
|
248
248
|
default: () => [w("查看")]
|
|
249
|
-
}), a.showDownload && n(
|
|
249
|
+
}), a.showDownload && n(k, {
|
|
250
250
|
type: "primary",
|
|
251
251
|
link: !0,
|
|
252
252
|
onClick: () => ne(e)
|
|
253
253
|
}, {
|
|
254
254
|
default: () => [w("下载")]
|
|
255
|
-
}), a.showDelete && !a.disabled && n(
|
|
255
|
+
}), a.showDelete && !a.disabled && n(k, {
|
|
256
256
|
type: "danger",
|
|
257
257
|
link: !0,
|
|
258
258
|
onClick: () => le(e)
|
|
@@ -297,9 +297,9 @@ const ao = /* @__PURE__ */ fe({
|
|
|
297
297
|
}, [A(e, o)])]), ue = (e, o) => d.fileItem ? d.fileItem({
|
|
298
298
|
file: e,
|
|
299
299
|
index: o
|
|
300
|
-
}) :
|
|
300
|
+
}) : U.value ? se(e, o) : ce(e, o), de = () => {
|
|
301
301
|
if (!a.showFileList || u.value.length === 0) return null;
|
|
302
|
-
const e = u.value.map((l, s) => ue(l, s)), o =
|
|
302
|
+
const e = u.value.map((l, s) => ue(l, s)), o = U.value ? `${i}-filelist__grid` : `${i}-filelist__list`, t = U.value ? {
|
|
303
303
|
gridTemplateColumns: `repeat(${a.gridColumns}, 1fr)`
|
|
304
304
|
} : void 0;
|
|
305
305
|
return n("div", {
|
|
@@ -318,7 +318,7 @@ const ao = /* @__PURE__ */ fe({
|
|
|
318
318
|
var e;
|
|
319
319
|
return n("div", {
|
|
320
320
|
class: i
|
|
321
|
-
}, [ie(), de(), (e = d.footer) == null ? void 0 : e.call(d), h.value && n(
|
|
321
|
+
}, [ie(), de(), (e = d.footer) == null ? void 0 : e.call(d), h.value && n(Ue, {
|
|
322
322
|
urlList: x.value,
|
|
323
323
|
hideOnClickModal: !0,
|
|
324
324
|
teleported: !0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TtFormSchema } from '../components/tt-form';
|
|
1
|
+
import { TtExtendedFormApi, TtFormSchema } from '../components/tt-form';
|
|
2
2
|
import { Recordable } from '../../../utils/src';
|
|
3
3
|
import { MaybeRef, Ref } from 'vue';
|
|
4
4
|
import { BusinessDataType, DataPermissionOptionsMap } from './useDataPermissionOptions';
|
|
@@ -18,22 +18,19 @@ export type FormScene = "list" | "action";
|
|
|
18
18
|
/**
|
|
19
19
|
* 透传给字段组件的 props 类型,支持静态对象或根据当前表单状态计算的函数。
|
|
20
20
|
*/
|
|
21
|
-
type FieldComponentProps = Recordable | ((values:
|
|
22
|
-
|
|
23
|
-
* 针对单个数据类型字段的 schema 覆盖与扩展配置。
|
|
24
|
-
*/
|
|
25
|
-
type FieldSchemaConfig = Partial<TtFormSchema> & UseFormSchemasLinkFieldConfig;
|
|
21
|
+
type FieldComponentProps<TValues extends Recordable = Recordable> = Recordable | ((values: TValues, actions: TtExtendedFormApi<TValues>, options: SelectOption[]) => Recordable);
|
|
22
|
+
export type FieldSchemaConfig<TValues extends Recordable = Recordable> = Omit<Partial<TtFormSchema<TValues>>, "componentProps" | "dependencies"> & UseFormSchemasLinkFieldConfig<TValues>;
|
|
26
23
|
/**
|
|
27
24
|
* 字段 onChange 回调上下文。
|
|
28
25
|
*
|
|
29
26
|
* 业务侧通过 field(dataType, { onChange }) 追加字段变更逻辑时,
|
|
30
27
|
* 可以从这里拿到当前表单值、表单操作对象、字段名、原始选项和当前选中项。
|
|
31
28
|
*/
|
|
32
|
-
export interface FieldOnChangeContext {
|
|
29
|
+
export interface FieldOnChangeContext<TValues extends Recordable = Recordable> {
|
|
33
30
|
/** 当前表单值对象 */
|
|
34
|
-
values:
|
|
31
|
+
values: TValues;
|
|
35
32
|
/** 表单渲染器透出的操作对象 */
|
|
36
|
-
actions:
|
|
33
|
+
actions: TtExtendedFormApi<TValues>;
|
|
37
34
|
/** 当前字段最终绑定的字段名,已合并 fieldName 自定义配置 */
|
|
38
35
|
fieldName: string;
|
|
39
36
|
/** 当前触发变更的数据类型 */
|
|
@@ -49,17 +46,17 @@ export interface FieldOnChangeContext {
|
|
|
49
46
|
* 该配置通过 builder.field(dataType, config) 传入,用于覆盖默认字段名、标签、
|
|
50
47
|
* 组件 props、校验规则、依赖关系和追加 onChange 行为。
|
|
51
48
|
*/
|
|
52
|
-
export interface UseFormSchemasLinkFieldConfig {
|
|
49
|
+
export interface UseFormSchemasLinkFieldConfig<TValues extends Recordable = Recordable> {
|
|
53
50
|
/** 字段组件,默认使用 TtApiComponent 包装 ElSelectV2 或 TtPanelSelect */
|
|
54
|
-
component?: TtFormSchema["component"];
|
|
51
|
+
component?: TtFormSchema<TValues>["component"];
|
|
55
52
|
/** 是否支持多选,默认为 true */
|
|
56
53
|
multiple?: boolean;
|
|
57
54
|
/** 透传给字段组件的 props;传函数时会在渲染时接收表单值、操作对象和当前选项 */
|
|
58
|
-
componentProps?: FieldComponentProps
|
|
55
|
+
componentProps?: FieldComponentProps<TValues>;
|
|
59
56
|
/** 追加或覆盖 TtFormSchema.dependencies */
|
|
60
|
-
dependencies?: TtFormSchema["dependencies"];
|
|
57
|
+
dependencies?: TtFormSchema<TValues>["dependencies"];
|
|
61
58
|
/** 字段值变化后的追加回调。默认联动逻辑会先执行,再执行该回调。 */
|
|
62
|
-
onChange?: (values: unknown, context: FieldOnChangeContext) => void;
|
|
59
|
+
onChange?: (values: unknown, context: FieldOnChangeContext<TValues>) => void;
|
|
63
60
|
/** 是否展示全部选项 */
|
|
64
61
|
showAll?: boolean;
|
|
65
62
|
/** “全部”选项的值,默认为 "all"。用于自定义“全部”选项对应的 value,与 TtPanelSelect 的 showAllField 对齐 */
|
|
@@ -70,13 +67,13 @@ export interface UseFormSchemasLinkFieldConfig {
|
|
|
70
67
|
* @param options - 完整的下拉数据源
|
|
71
68
|
* @returns 过滤后的下拉数据源
|
|
72
69
|
*/
|
|
73
|
-
customOptions?: (values:
|
|
70
|
+
customOptions?: (values: TValues, options: SelectOption[]) => SelectOption[];
|
|
74
71
|
}
|
|
75
72
|
/**
|
|
76
73
|
* useFormSchemasLink 的批量配置选项。
|
|
77
74
|
* 可以通过 fromOptions(options) 一次性传入,也可以使用 builder 链式方法逐项配置。
|
|
78
75
|
*/
|
|
79
|
-
export interface UseFormSchemasLinkOptions {
|
|
76
|
+
export interface UseFormSchemasLinkOptions<TValues extends Recordable = Recordable> {
|
|
80
77
|
/** 表单场景,默认 list */
|
|
81
78
|
scene?: FormScene;
|
|
82
79
|
/** 字段路径前缀,用于嵌套对象或数组行(如 "condition" 或 "tableData[0]") */
|
|
@@ -84,9 +81,9 @@ export interface UseFormSchemasLinkOptions {
|
|
|
84
81
|
/** 外部数据源。未传时会按 codes 调用 queryDataPermissionDetailDataTypeContext。 */
|
|
85
82
|
dataSource?: MaybeRef<DataPermissionOptionsMap | undefined>;
|
|
86
83
|
/** 字段级配置,key 为 DataType */
|
|
87
|
-
fieldConfigs?: Partial<Record<DataType, FieldSchemaConfig
|
|
84
|
+
fieldConfigs?: Partial<Record<DataType, FieldSchemaConfig<TValues>>>;
|
|
88
85
|
/** Schema 级覆盖。传函数时可基于默认 schema 做增量修改。 */
|
|
89
|
-
schemas?: Partial<Record<DataType, FieldSchemaConfig
|
|
86
|
+
schemas?: Partial<Record<DataType, FieldSchemaConfig<TValues>>>;
|
|
90
87
|
}
|
|
91
88
|
/**
|
|
92
89
|
* 下拉组件消费的统一选项结构。
|
|
@@ -102,7 +99,7 @@ export type SelectOption = Recordable & {
|
|
|
102
99
|
/**
|
|
103
100
|
* useFormSchemasLink 构建结果,包含各数据维度的 TtFormSchema、归一化数据源及数组行 schema 工厂函数。
|
|
104
101
|
*/
|
|
105
|
-
type UseFormSchemasLinkResult = Record<DataType, TtFormSchema
|
|
102
|
+
export type UseFormSchemasLinkResult<TValues extends Recordable = Recordable> = Record<DataType, TtFormSchema<TValues>> & {
|
|
106
103
|
/** 响应式数据源对象 */
|
|
107
104
|
dataSource: Ref<Record<BusinessDataType, SelectOption[]>>;
|
|
108
105
|
/**
|
|
@@ -111,35 +108,35 @@ type UseFormSchemasLinkResult = Record<DataType, TtFormSchema> & {
|
|
|
111
108
|
* @param rowFieldConfigs - 可选,针对当前行的字段覆盖配置
|
|
112
109
|
* @returns 对应行的字段 schema 映射
|
|
113
110
|
*/
|
|
114
|
-
createRowSchemas: (itemPath: string, rowFieldConfigs?: Partial<Record<DataType, FieldSchemaConfig
|
|
111
|
+
createRowSchemas: (itemPath: string, rowFieldConfigs?: Partial<Record<DataType, FieldSchemaConfig<TValues>>>) => Record<DataType, TtFormSchema<TValues>>;
|
|
115
112
|
};
|
|
116
113
|
/**
|
|
117
114
|
* useFormSchemasLink 的链式配置构建器。
|
|
118
115
|
*/
|
|
119
|
-
type FormSchemasLinkBuilder = {
|
|
116
|
+
export type FormSchemasLinkBuilder<TValues extends Recordable = Recordable> = {
|
|
120
117
|
/** 设置为查询筛选场景 */
|
|
121
|
-
list(): FormSchemasLinkBuilder
|
|
118
|
+
list(): FormSchemasLinkBuilder<TValues>;
|
|
122
119
|
/** 设置为新增、编辑等操作场景 */
|
|
123
|
-
action(): FormSchemasLinkBuilder
|
|
120
|
+
action(): FormSchemasLinkBuilder<TValues>;
|
|
124
121
|
/** 设置表单场景 */
|
|
125
|
-
scene(scene: FormScene): FormSchemasLinkBuilder
|
|
122
|
+
scene(scene: FormScene): FormSchemasLinkBuilder<TValues>;
|
|
126
123
|
/** 设置路径前缀,支持嵌套对象或数组行路径(如 "items[0]" 或 "query") */
|
|
127
|
-
basePath(basePath: string): FormSchemasLinkBuilder
|
|
124
|
+
basePath(basePath: string): FormSchemasLinkBuilder<TValues>;
|
|
128
125
|
/** 指定需要请求和构建的字段类型,默认包含全部 DataType */
|
|
129
|
-
codes(codes: BusinessDataType[]): FormSchemasLinkBuilder
|
|
126
|
+
codes(codes: BusinessDataType[]): FormSchemasLinkBuilder<TValues>;
|
|
130
127
|
/** 使用外部数据源,跳过内部接口请求 */
|
|
131
|
-
dataSource(dataSource: MaybeRef<DataPermissionOptionsMap | undefined>): FormSchemasLinkBuilder
|
|
128
|
+
dataSource(dataSource: MaybeRef<DataPermissionOptionsMap | undefined>): FormSchemasLinkBuilder<TValues>;
|
|
132
129
|
/** 覆盖单个字段配置 */
|
|
133
|
-
field(dataType: DataType, config: FieldSchemaConfig): FormSchemasLinkBuilder
|
|
130
|
+
field(dataType: DataType, config: FieldSchemaConfig<TValues>): FormSchemasLinkBuilder<TValues>;
|
|
134
131
|
/** 构建顶层 schemas 与数据源 */
|
|
135
|
-
build(): UseFormSchemasLinkResult
|
|
132
|
+
build(): UseFormSchemasLinkResult<TValues>;
|
|
136
133
|
/**
|
|
137
134
|
* 为数组子行或嵌套路径生成 schemas,复用当前数据源与配置
|
|
138
135
|
* @param itemPath - 行或嵌套路径,例如 "tableData[0]"
|
|
139
136
|
* @param rowFieldConfigs - 可选,针对当前行的字段覆盖配置
|
|
140
137
|
* @returns 对应行的字段 schema 映射
|
|
141
138
|
*/
|
|
142
|
-
createRowSchemas(itemPath: string, rowFieldConfigs?: Partial<Record<DataType, FieldSchemaConfig
|
|
139
|
+
createRowSchemas(itemPath: string, rowFieldConfigs?: Partial<Record<DataType, FieldSchemaConfig<TValues>>>): Record<DataType, TtFormSchema<TValues>>;
|
|
143
140
|
};
|
|
144
141
|
/**
|
|
145
142
|
* 构建数据权限相关的表单联动 schema。
|
|
@@ -172,5 +169,5 @@ type FormSchemasLinkBuilder = {
|
|
|
172
169
|
*
|
|
173
170
|
* @returns FormSchemasLinkBuilder 链式构建器
|
|
174
171
|
*/
|
|
175
|
-
export declare function useFormSchemasLink(): FormSchemasLinkBuilder
|
|
172
|
+
export declare function useFormSchemasLink<TValues extends Recordable = Recordable>(): FormSchemasLinkBuilder<TValues>;
|
|
176
173
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useDataPermissionOptions as
|
|
1
|
+
import { useDataPermissionOptions as te } from "./useDataPermissionOptions.js";
|
|
2
2
|
import "axios";
|
|
3
|
-
import { ElSelectV2 as
|
|
4
|
-
import { isArray as
|
|
3
|
+
import { ElSelectV2 as oe } from "element-plus";
|
|
4
|
+
import { isArray as C, isFunction as q, isString as re } from "../packages/utils/src/is.js";
|
|
5
5
|
import "vue";
|
|
6
6
|
import "dayjs";
|
|
7
7
|
import "numeral";
|
|
@@ -13,101 +13,104 @@ import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
|
13
13
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
14
14
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
15
15
|
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
16
|
-
import { get as
|
|
17
|
-
const
|
|
16
|
+
import { get as h, set as S, omit as se } from "lodash-es";
|
|
17
|
+
const z = "all", le = { label: "全部", value: z }, W = [
|
|
18
18
|
"platformId",
|
|
19
19
|
"shopId",
|
|
20
20
|
"purchasePlaceId",
|
|
21
21
|
"businessType",
|
|
22
22
|
"lockUserId",
|
|
23
23
|
"userId"
|
|
24
|
-
],
|
|
24
|
+
], ie = {
|
|
25
25
|
platformId: "platformIds",
|
|
26
26
|
shopId: "shopIds",
|
|
27
27
|
purchasePlaceId: "purchasePlaceId",
|
|
28
28
|
businessType: "businessType",
|
|
29
29
|
lockUserId: "lockUserId"
|
|
30
|
-
},
|
|
30
|
+
}, ce = {
|
|
31
31
|
platformId: "平台",
|
|
32
32
|
shopId: "店铺",
|
|
33
33
|
purchasePlaceId: "采购地",
|
|
34
34
|
businessType: "业务线",
|
|
35
35
|
lockUserId: "锁单人"
|
|
36
36
|
};
|
|
37
|
-
function
|
|
37
|
+
function ue(r, i) {
|
|
38
38
|
return i ? r ? `${r}.${i}` : i : "";
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return
|
|
40
|
+
function $(r) {
|
|
41
|
+
return re(r) && r.toLowerCase() === z.toLowerCase();
|
|
42
42
|
}
|
|
43
43
|
function V(r) {
|
|
44
|
-
return
|
|
44
|
+
return C(r) ? r : r == null || r === "" ? [] : [r];
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return [
|
|
46
|
+
function fe(r = []) {
|
|
47
|
+
return [le].concat(r);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
return r ?
|
|
49
|
+
function de(r, i, f, I) {
|
|
50
|
+
return r ? q(r) ? r(i, f, I) : r : {};
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function Q(r, i, f, I) {
|
|
53
53
|
i == null || i(r);
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const F = I(), N = h(F.values, F.fieldName);
|
|
55
|
+
f == null || f(N, F);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
57
|
+
function X(r = {}, i = W, f) {
|
|
58
|
+
const I = r.scene || "list", F = i.reduce(
|
|
59
59
|
(e, t) => {
|
|
60
60
|
if (t === "userId") return e;
|
|
61
|
-
const n =
|
|
61
|
+
const n = P(t), o = O(t) === "TtPanelSelect";
|
|
62
62
|
return e[t] = o ? !1 : n.showAll ?? !1, e;
|
|
63
63
|
},
|
|
64
64
|
{}
|
|
65
|
-
), { dataSource: N } =
|
|
65
|
+
), { dataSource: N } = f ? { dataSource: f } : te({
|
|
66
66
|
codes: i,
|
|
67
67
|
dataSource: r.dataSource,
|
|
68
|
-
showAll:
|
|
68
|
+
showAll: F
|
|
69
69
|
});
|
|
70
|
-
function
|
|
71
|
-
const n =
|
|
72
|
-
return
|
|
70
|
+
function a(e, t = r.basePath) {
|
|
71
|
+
const n = P(e).fieldName || ie[e];
|
|
72
|
+
return ue(t, n);
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
return
|
|
74
|
+
function R(e) {
|
|
75
|
+
return P(e).rules;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
77
|
+
function D(e) {
|
|
78
|
+
return P(e).label || ce[e];
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function P(e) {
|
|
81
81
|
var t;
|
|
82
82
|
return ((t = r.fieldConfigs) == null ? void 0 : t[e]) || {};
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
return
|
|
84
|
+
function A(e) {
|
|
85
|
+
return P(e).showAllField ?? z;
|
|
86
|
+
}
|
|
87
|
+
function U(e, t, n) {
|
|
88
|
+
return q(e) ? e(t, n) : e;
|
|
86
89
|
}
|
|
87
|
-
function
|
|
88
|
-
const n =
|
|
90
|
+
function B(e, t) {
|
|
91
|
+
const n = P(e).dependencies;
|
|
89
92
|
if (!t) return n;
|
|
90
93
|
if (!n) return t;
|
|
91
94
|
const o = {
|
|
92
95
|
...t,
|
|
93
96
|
...n
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return o;
|
|
97
|
+
}, l = t.triggerFields || [], s = n.triggerFields || [];
|
|
98
|
+
(l.length || s.length) && (o.triggerFields = Array.from(/* @__PURE__ */ new Set([...l, ...s])));
|
|
99
|
+
const c = t.disabled, u = n.disabled;
|
|
100
|
+
c !== void 0 && u !== void 0 && (o.disabled = (d, p) => U(c, d, p) ? !0 : U(u, d, p));
|
|
101
|
+
const m = t.rules, g = n.rules;
|
|
102
|
+
return m !== void 0 && g !== void 0 && (o.rules = (d, p) => c !== void 0 && U(c, d, p) ? null : U(g ?? m, d, p)), o;
|
|
100
103
|
}
|
|
101
104
|
function O(e) {
|
|
102
|
-
return
|
|
105
|
+
return P(e).component || (e === "platformId" || e === "shopId" || e === "purchasePlaceId" ? "TtPanelSelect" : "TtApiComponent");
|
|
103
106
|
}
|
|
104
107
|
function M(e) {
|
|
105
|
-
return
|
|
108
|
+
return P(e).multiple ?? !0;
|
|
106
109
|
}
|
|
107
|
-
function
|
|
110
|
+
function _(e) {
|
|
108
111
|
return N.value[e] || [];
|
|
109
112
|
}
|
|
110
|
-
function
|
|
113
|
+
function Y(e) {
|
|
111
114
|
const t = /* @__PURE__ */ new Map();
|
|
112
115
|
return e.forEach((n) => {
|
|
113
116
|
const o = n.purchaseInfo, l = (o == null ? void 0 : o.supplierSubType) ?? "其他";
|
|
@@ -119,7 +122,7 @@ function W(r = {}, i = Q, c) {
|
|
|
119
122
|
}, t.set(l, s)), s.children.push(n);
|
|
120
123
|
}), Array.from(t.values());
|
|
121
124
|
}
|
|
122
|
-
function
|
|
125
|
+
function Z(e) {
|
|
123
126
|
const t = /* @__PURE__ */ new Map();
|
|
124
127
|
return e.forEach((n) => {
|
|
125
128
|
const o = n.platformId;
|
|
@@ -132,37 +135,37 @@ function W(r = {}, i = Q, c) {
|
|
|
132
135
|
}, t.set(o, l)), l.children.push(n);
|
|
133
136
|
}), Array.from(t.values());
|
|
134
137
|
}
|
|
135
|
-
function
|
|
138
|
+
function G(e) {
|
|
136
139
|
return e.flatMap((t) => {
|
|
137
140
|
const n = t.children;
|
|
138
|
-
return n != null && n.length ?
|
|
141
|
+
return n != null && n.length ? G(n) : [t];
|
|
139
142
|
});
|
|
140
143
|
}
|
|
141
|
-
function
|
|
142
|
-
return V(e).some((n) => n === t ||
|
|
144
|
+
function v(e, t) {
|
|
145
|
+
return V(e).some((n) => n === t || $(n));
|
|
143
146
|
}
|
|
144
147
|
function H(e, t) {
|
|
145
|
-
const n =
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
+
const n = a("shopId"), o = M("shopId"), l = A("shopId");
|
|
149
|
+
if (I === "action" && L(t)) {
|
|
150
|
+
S(e, n, o ? [l] : l);
|
|
148
151
|
return;
|
|
149
152
|
}
|
|
150
|
-
|
|
153
|
+
S(e, n, o ? [] : void 0);
|
|
151
154
|
}
|
|
152
155
|
function L(e) {
|
|
153
|
-
const t =
|
|
154
|
-
return
|
|
156
|
+
const t = v(e, A("platformId")), n = C(e) ? e.length > 1 : !1;
|
|
157
|
+
return I === "action" && (t || n);
|
|
155
158
|
}
|
|
156
|
-
function
|
|
157
|
-
const t =
|
|
159
|
+
function T(e) {
|
|
160
|
+
const t = _("shopId"), n = V(e);
|
|
158
161
|
if (!n.length)
|
|
159
|
-
return
|
|
162
|
+
return I === "action" ? [] : t;
|
|
160
163
|
if (L(e)) return [];
|
|
161
164
|
const o = t.filter((s) => n.includes(s.platformId));
|
|
162
|
-
return !o.some((s) => s.value ===
|
|
165
|
+
return !o.some((s) => s.value === A("shopId") || $(s.value)) || o.length <= 1 ? o : fe(o.filter((s) => s.value !== A("shopId") && !$(s.value)));
|
|
163
166
|
}
|
|
164
|
-
function
|
|
165
|
-
const s =
|
|
167
|
+
function J(e, t, n, o, l) {
|
|
168
|
+
const s = a(e), c = h(t, s), u = l ? o.filter((m) => C(c) && c.includes(m.value)) : o.find((m) => m.value === c);
|
|
166
169
|
return {
|
|
167
170
|
values: t,
|
|
168
171
|
actions: n,
|
|
@@ -172,153 +175,158 @@ function W(r = {}, i = Q, c) {
|
|
|
172
175
|
currentOption: u
|
|
173
176
|
};
|
|
174
177
|
}
|
|
175
|
-
function
|
|
176
|
-
const s =
|
|
177
|
-
return
|
|
178
|
+
function x(e, t, n, o, l) {
|
|
179
|
+
const s = P(e), c = de(s.componentProps, t, n, o), u = M(e), { onChange: m, ...g } = c, d = q(s.customOptions) ? s.customOptions(t, o) : o, p = O(e) === "TtPanelSelect", b = p && e === "shopId" ? Z(d) : p && e === "purchasePlaceId" ? Y(d) : d, w = p ? G(b) : d;
|
|
180
|
+
return p ? {
|
|
178
181
|
multiple: u,
|
|
179
|
-
showAll: s.showAll ?? (e === "shopId" &&
|
|
180
|
-
showAllField:
|
|
182
|
+
showAll: s.showAll ?? (e === "shopId" && I === "action" ? V(h(t, a("platformId"))).length > 0 : !0),
|
|
183
|
+
showAllField: A(e),
|
|
181
184
|
showNav: e !== "platformId" && e !== "purchasePlaceId",
|
|
182
185
|
showOriginMode: e === "platformId",
|
|
183
186
|
showPinyinMode: e !== "shopId" && e !== "purchasePlaceId",
|
|
184
|
-
...
|
|
185
|
-
options:
|
|
186
|
-
onChange(
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
...g,
|
|
188
|
+
options: b,
|
|
189
|
+
onChange(E) {
|
|
190
|
+
const K = E !== void 0 ? E : h(t, a(e));
|
|
191
|
+
S(t, a(e), K), Q(
|
|
192
|
+
K,
|
|
190
193
|
l,
|
|
191
194
|
s.onChange,
|
|
192
|
-
() =>
|
|
195
|
+
() => J(e, t, n, w, u)
|
|
193
196
|
);
|
|
194
197
|
}
|
|
195
198
|
} : {
|
|
196
199
|
multiple: u,
|
|
197
|
-
component:
|
|
200
|
+
component: oe,
|
|
198
201
|
showOriginMode: !1,
|
|
199
202
|
showPinyinMode: !0,
|
|
200
|
-
...
|
|
201
|
-
options:
|
|
202
|
-
onChange(
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
...g,
|
|
204
|
+
options: d,
|
|
205
|
+
onChange(E) {
|
|
206
|
+
Q(
|
|
207
|
+
E,
|
|
205
208
|
l,
|
|
206
209
|
s.onChange,
|
|
207
|
-
() =>
|
|
210
|
+
() => J(e, t, n, w, u)
|
|
208
211
|
);
|
|
209
212
|
}
|
|
210
213
|
};
|
|
211
214
|
}
|
|
212
|
-
function
|
|
213
|
-
const t =
|
|
215
|
+
function j(e) {
|
|
216
|
+
const t = a(e);
|
|
214
217
|
return {
|
|
215
218
|
component: O(e),
|
|
216
219
|
fieldName: t,
|
|
217
|
-
label:
|
|
218
|
-
rules:
|
|
219
|
-
dependencies:
|
|
220
|
+
label: D(e),
|
|
221
|
+
rules: R(e),
|
|
222
|
+
dependencies: B(e),
|
|
220
223
|
componentProps: (n, o) => {
|
|
221
|
-
const l =
|
|
222
|
-
return
|
|
224
|
+
const l = _(e), s = a(e), c = M(e), u = A(e), m = h(n, s), g = C(m) ? m.at(-1) !== u : !0;
|
|
225
|
+
return x(e, n, o, l, (d) => {
|
|
223
226
|
if (O(e) !== "TtPanelSelect") {
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
if (
|
|
227
|
-
|
|
227
|
+
const p = h(n, s);
|
|
228
|
+
if (c)
|
|
229
|
+
if (g && V(d).at(-1) === u)
|
|
230
|
+
S(n, s, [u]);
|
|
228
231
|
else {
|
|
229
|
-
const
|
|
230
|
-
|
|
232
|
+
const b = C(p) ? p.filter((w) => w !== u) : [];
|
|
233
|
+
S(n, s, b);
|
|
231
234
|
}
|
|
232
235
|
}
|
|
233
236
|
});
|
|
234
237
|
}
|
|
235
238
|
};
|
|
236
239
|
}
|
|
237
|
-
const
|
|
240
|
+
const y = {
|
|
238
241
|
// 平台
|
|
239
242
|
platformId: {
|
|
240
243
|
component: O("platformId"),
|
|
241
|
-
fieldName:
|
|
242
|
-
label:
|
|
243
|
-
rules:
|
|
244
|
+
fieldName: a("platformId"),
|
|
245
|
+
label: D("platformId"),
|
|
246
|
+
rules: R("platformId"),
|
|
247
|
+
dependencies: B("platformId"),
|
|
244
248
|
componentProps: (e, t) => {
|
|
245
|
-
const n = "platformId", o =
|
|
246
|
-
return
|
|
249
|
+
const n = "platformId", o = a(n), l = M(n), s = _(n), c = A(n), u = h(e, o), m = C(u) ? u.at(-1) !== c : !0;
|
|
250
|
+
return x(n, e, t, s, (g) => {
|
|
247
251
|
if (O(n) !== "TtPanelSelect") {
|
|
248
|
-
const
|
|
252
|
+
const d = h(e, o);
|
|
249
253
|
if (l)
|
|
250
|
-
if (
|
|
251
|
-
|
|
254
|
+
if (m && V(g).at(-1) === c)
|
|
255
|
+
S(e, o, [c]);
|
|
252
256
|
else {
|
|
253
|
-
const
|
|
254
|
-
|
|
257
|
+
const p = C(d) ? d.filter((b) => b !== c) : [];
|
|
258
|
+
S(e, o, p);
|
|
255
259
|
}
|
|
256
260
|
}
|
|
257
|
-
H(e,
|
|
261
|
+
H(e, h(e, o));
|
|
258
262
|
});
|
|
259
263
|
}
|
|
260
264
|
},
|
|
261
265
|
// 店铺
|
|
262
266
|
shopId: {
|
|
263
267
|
component: O("shopId"),
|
|
264
|
-
fieldName:
|
|
265
|
-
label:
|
|
268
|
+
fieldName: a("shopId"),
|
|
269
|
+
label: D("shopId"),
|
|
266
270
|
componentProps: (e, t) => {
|
|
267
|
-
const n = "shopId", o =
|
|
268
|
-
return
|
|
271
|
+
const n = "shopId", o = a(n), l = h(e, a("platformId")), s = T(l), c = M(n), u = A(n), m = h(e, o), g = C(m) ? m.at(-1) !== u : !0;
|
|
272
|
+
return x(n, e, t, s, (d) => {
|
|
269
273
|
if (O(n) !== "TtPanelSelect") {
|
|
270
|
-
const
|
|
271
|
-
if (
|
|
272
|
-
if (
|
|
273
|
-
|
|
274
|
+
const p = h(e, o);
|
|
275
|
+
if (c)
|
|
276
|
+
if (g && V(d).at(-1) === u)
|
|
277
|
+
S(e, o, [u]);
|
|
274
278
|
else {
|
|
275
|
-
const
|
|
276
|
-
|
|
279
|
+
const b = C(p) ? p.filter((w) => w !== u) : [];
|
|
280
|
+
S(e, o, b);
|
|
277
281
|
}
|
|
278
282
|
}
|
|
279
283
|
});
|
|
280
284
|
},
|
|
281
|
-
dependencies:
|
|
282
|
-
triggerFields: [
|
|
285
|
+
dependencies: B("shopId", {
|
|
286
|
+
triggerFields: [a("platformId")],
|
|
283
287
|
disabled(e) {
|
|
284
|
-
return L(
|
|
288
|
+
return L(h(e, a("platformId")));
|
|
285
289
|
},
|
|
286
290
|
rules(e) {
|
|
287
|
-
return L(
|
|
291
|
+
return L(h(e, a("platformId"))) ? null : R("shopId") || null;
|
|
288
292
|
}
|
|
289
293
|
})
|
|
290
294
|
},
|
|
291
|
-
purchasePlaceId:
|
|
292
|
-
businessType:
|
|
293
|
-
lockUserId:
|
|
295
|
+
purchasePlaceId: j("purchasePlaceId"),
|
|
296
|
+
businessType: j("businessType"),
|
|
297
|
+
lockUserId: j("lockUserId")
|
|
294
298
|
};
|
|
295
|
-
function
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
fieldName: n.fieldName
|
|
304
|
-
}, e;
|
|
305
|
-
},
|
|
306
|
-
{}
|
|
307
|
-
);
|
|
299
|
+
function k(e) {
|
|
300
|
+
var o;
|
|
301
|
+
const t = y[e], n = (o = r.fieldConfigs) == null ? void 0 : o[e];
|
|
302
|
+
return {
|
|
303
|
+
...t,
|
|
304
|
+
...se(n, ["componentProps", "rules", "fieldName", "dependencies"]),
|
|
305
|
+
fieldName: t.fieldName
|
|
306
|
+
};
|
|
308
307
|
}
|
|
309
|
-
function
|
|
308
|
+
function ee() {
|
|
309
|
+
return {
|
|
310
|
+
platformId: k("platformId"),
|
|
311
|
+
shopId: k("shopId"),
|
|
312
|
+
purchasePlaceId: k("purchasePlaceId"),
|
|
313
|
+
businessType: k("businessType"),
|
|
314
|
+
lockUserId: k("lockUserId")
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function ne(e, t) {
|
|
310
318
|
const n = t ? {
|
|
311
319
|
...r.fieldConfigs,
|
|
312
320
|
...Object.fromEntries(
|
|
313
321
|
Object.entries(t).map(([l, s]) => {
|
|
314
|
-
var
|
|
322
|
+
var c;
|
|
315
323
|
return [
|
|
316
324
|
l,
|
|
317
|
-
{ ...((
|
|
325
|
+
{ ...((c = r.fieldConfigs) == null ? void 0 : c[l]) || {}, ...s }
|
|
318
326
|
];
|
|
319
327
|
})
|
|
320
328
|
)
|
|
321
|
-
} : r.fieldConfigs, o =
|
|
329
|
+
} : r.fieldConfigs, o = X(
|
|
322
330
|
{
|
|
323
331
|
...r,
|
|
324
332
|
basePath: e,
|
|
@@ -327,21 +335,24 @@ function W(r = {}, i = Q, c) {
|
|
|
327
335
|
i,
|
|
328
336
|
N
|
|
329
337
|
);
|
|
330
|
-
return
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
338
|
+
return {
|
|
339
|
+
platformId: o.platformId,
|
|
340
|
+
shopId: o.shopId,
|
|
341
|
+
purchasePlaceId: o.purchasePlaceId,
|
|
342
|
+
businessType: o.businessType,
|
|
343
|
+
lockUserId: o.lockUserId
|
|
344
|
+
};
|
|
334
345
|
}
|
|
335
346
|
return {
|
|
336
|
-
...
|
|
347
|
+
...ee(),
|
|
337
348
|
dataSource: N,
|
|
338
|
-
createRowSchemas:
|
|
349
|
+
createRowSchemas: ne
|
|
339
350
|
};
|
|
340
351
|
}
|
|
341
|
-
function
|
|
352
|
+
function Me() {
|
|
342
353
|
const r = {
|
|
343
354
|
options: {},
|
|
344
|
-
codes: [...
|
|
355
|
+
codes: [...W]
|
|
345
356
|
}, i = {
|
|
346
357
|
/**
|
|
347
358
|
* @description 渲染查询场景
|
|
@@ -359,42 +370,42 @@ function Ve() {
|
|
|
359
370
|
* @param scene - 场景值,list 为查询筛选,action 为新增编辑等操作
|
|
360
371
|
* @returns FormSchemasLinkBuilder
|
|
361
372
|
*/
|
|
362
|
-
scene(
|
|
363
|
-
return r.options.scene =
|
|
373
|
+
scene(f) {
|
|
374
|
+
return r.options.scene = f, i;
|
|
364
375
|
},
|
|
365
376
|
/**
|
|
366
377
|
* @param basePath - 字段路径前缀,例如 "items[0]" 或 "condition"
|
|
367
378
|
* @returns FormSchemasLinkBuilder
|
|
368
379
|
*/
|
|
369
|
-
basePath(
|
|
370
|
-
return r.options.basePath =
|
|
380
|
+
basePath(f) {
|
|
381
|
+
return r.options.basePath = f, i;
|
|
371
382
|
},
|
|
372
383
|
/**
|
|
373
384
|
* @param codes - 接口请求所需要的数据权限维度 code 列表
|
|
374
385
|
* @returns FormSchemasLinkBuilder
|
|
375
386
|
*/
|
|
376
|
-
codes(
|
|
377
|
-
return r.codes = [...
|
|
387
|
+
codes(f) {
|
|
388
|
+
return r.codes = [...f], i;
|
|
378
389
|
},
|
|
379
390
|
/**
|
|
380
391
|
* @param dataSource - 外部自定义数据源
|
|
381
392
|
* @returns FormSchemasLinkBuilder
|
|
382
393
|
*/
|
|
383
|
-
dataSource(
|
|
384
|
-
return r.options.dataSource =
|
|
394
|
+
dataSource(f) {
|
|
395
|
+
return r.options.dataSource = f, i;
|
|
385
396
|
},
|
|
386
397
|
/**
|
|
387
398
|
* @param dataType - 待配置的数据类型维度
|
|
388
399
|
* @param config - 字段自定义配置
|
|
389
400
|
* @returns FormSchemasLinkBuilder
|
|
390
401
|
*/
|
|
391
|
-
field(
|
|
392
|
-
var
|
|
402
|
+
field(f, I) {
|
|
403
|
+
var F;
|
|
393
404
|
return r.options.fieldConfigs = {
|
|
394
405
|
...r.options.fieldConfigs,
|
|
395
|
-
[
|
|
396
|
-
...((
|
|
397
|
-
...
|
|
406
|
+
[f]: {
|
|
407
|
+
...((F = r.options.fieldConfigs) == null ? void 0 : F[f]) || {},
|
|
408
|
+
...I
|
|
398
409
|
}
|
|
399
410
|
}, i;
|
|
400
411
|
},
|
|
@@ -403,19 +414,19 @@ function Ve() {
|
|
|
403
414
|
* @returns UseFormSchemasLinkResult
|
|
404
415
|
*/
|
|
405
416
|
build() {
|
|
406
|
-
return
|
|
417
|
+
return X(r.options, r.codes);
|
|
407
418
|
},
|
|
408
419
|
/**
|
|
409
420
|
* @param itemPath - 数组行路径(如 "tableData[0]")
|
|
410
421
|
* @param rowFieldConfigs - 可选,针对当前行的字段覆盖配置
|
|
411
422
|
* @returns 该行对应的表单 schema 映射
|
|
412
423
|
*/
|
|
413
|
-
createRowSchemas(
|
|
414
|
-
return i.build().createRowSchemas(
|
|
424
|
+
createRowSchemas(f, I) {
|
|
425
|
+
return i.build().createRowSchemas(f, I);
|
|
415
426
|
}
|
|
416
427
|
};
|
|
417
428
|
return i;
|
|
418
429
|
}
|
|
419
430
|
export {
|
|
420
|
-
|
|
431
|
+
Me as useFormSchemasLink
|
|
421
432
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export * from './components/tt-api-component';
|
|
|
23
23
|
export * from './components/tt-log';
|
|
24
24
|
export * from './components/tt-panel-select';
|
|
25
25
|
export * from './components/tt-radio-group';
|
|
26
|
-
export { useFormSchemasLink } from './hooks/useFormSchemasLink';
|
|
26
|
+
export { useFormSchemasLink, type FieldOnChangeContext, type FieldSchemaConfig, type FormScene, type FormSchemasLinkBuilder, type SelectOption, type UseFormSchemasLinkFieldConfig, type UseFormSchemasLinkOptions, type UseFormSchemasLinkResult, } from './hooks/useFormSchemasLink';
|
|
27
27
|
export { useDataPermissionOptions } from './hooks/useDataPermissionOptions';
|
|
28
28
|
export { useBasicDataOptions } from './hooks/useBasicDataOptions';
|
|
29
29
|
export { usePanelSelectSchemas, type PanelSelectFieldConfig, type PanelSelectExcludeConfig, } from './hooks/usePanelSelectSchemas';
|