@dazhicheng/ui 1.6.27 → 1.6.28
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/api/oss.d.ts +10 -0
- package/dist/api/oss.js +26 -0
- package/dist/components/tt-upload/index.d.ts +38 -23
- package/dist/components/tt-upload/src/TtUpload.vue.d.ts +19 -10
- package/dist/components/tt-upload/src/TtUpload.vue.js +185 -169
- package/dist/components/tt-upload/src/typing.d.ts +33 -2
- package/dist/components/tt-upload/src/typing.js +5 -0
- package/dist/components/types.d.ts +6 -4
- package/dist/hooks/useFormSchemasLink.d.ts +44 -8
- package/dist/hooks/useFormSchemasLink.js +258 -200
- package/dist/hooks/useScreenshotOss.d.ts +5 -3
- package/dist/hooks/useScreenshotOss.js +57 -48
- package/dist/hooks/useSetup.js +16 -13
- package/dist/index.d.ts +1 -0
- package/dist/index.js +102 -98
- package/package.json +1 -1
|
@@ -2,6 +2,10 @@ import { 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';
|
|
5
|
+
/**
|
|
6
|
+
* 参与表单联动的业务数据类型(平台、店铺、采购地、业务线、锁单人)。
|
|
7
|
+
* 排除 userId(用户数据独立拉取,不参与通用联动构建)。
|
|
8
|
+
*/
|
|
5
9
|
type DataType = Exclude<BusinessDataType, "userId">;
|
|
6
10
|
/**
|
|
7
11
|
* 表单使用场景。
|
|
@@ -11,7 +15,13 @@ type DataType = Exclude<BusinessDataType, "userId">;
|
|
|
11
15
|
* 且店铺默认值设为 showAllField ?? 'all'。
|
|
12
16
|
*/
|
|
13
17
|
export type FormScene = "list" | "action";
|
|
18
|
+
/**
|
|
19
|
+
* 透传给字段组件的 props 类型,支持静态对象或根据当前表单状态计算的函数。
|
|
20
|
+
*/
|
|
14
21
|
type FieldComponentProps = Recordable | ((values: Recordable, actions: any, options: SelectOption[]) => Recordable);
|
|
22
|
+
/**
|
|
23
|
+
* 针对单个数据类型字段的 schema 覆盖与扩展配置。
|
|
24
|
+
*/
|
|
15
25
|
type FieldSchemaConfig = Partial<TtFormSchema> & UseFormSchemasLinkFieldConfig;
|
|
16
26
|
/**
|
|
17
27
|
* 字段 onChange 回调上下文。
|
|
@@ -40,8 +50,9 @@ export interface FieldOnChangeContext {
|
|
|
40
50
|
* 组件 props、校验规则、依赖关系和追加 onChange 行为。
|
|
41
51
|
*/
|
|
42
52
|
export interface UseFormSchemasLinkFieldConfig {
|
|
43
|
-
/** 字段组件,默认使用 TtApiComponent 包装 ElSelectV2 */
|
|
53
|
+
/** 字段组件,默认使用 TtApiComponent 包装 ElSelectV2 或 TtPanelSelect */
|
|
44
54
|
component?: TtFormSchema["component"];
|
|
55
|
+
/** 是否支持多选,默认为 true */
|
|
45
56
|
multiple?: boolean;
|
|
46
57
|
/** 透传给字段组件的 props;传函数时会在渲染时接收表单值、操作对象和当前选项 */
|
|
47
58
|
componentProps?: FieldComponentProps;
|
|
@@ -54,19 +65,22 @@ export interface UseFormSchemasLinkFieldConfig {
|
|
|
54
65
|
/** “全部”选项的值,默认为 "all"。用于自定义“全部”选项对应的 value,与 TtPanelSelect 的 showAllField 对齐 */
|
|
55
66
|
showAllField?: string | number;
|
|
56
67
|
/**
|
|
57
|
-
*
|
|
58
|
-
* @param values
|
|
59
|
-
* @param options
|
|
68
|
+
* 自定义过滤数据源
|
|
69
|
+
* @param values - 当前表单值对象
|
|
70
|
+
* @param options - 完整的下拉数据源
|
|
71
|
+
* @returns 过滤后的下拉数据源
|
|
60
72
|
*/
|
|
61
73
|
customOptions?: (values: Recordable, options: SelectOption[]) => SelectOption[];
|
|
62
74
|
}
|
|
63
75
|
/**
|
|
64
|
-
* useFormSchemasLink
|
|
76
|
+
* useFormSchemasLink 的批量配置选项。
|
|
65
77
|
* 可以通过 fromOptions(options) 一次性传入,也可以使用 builder 链式方法逐项配置。
|
|
66
78
|
*/
|
|
67
79
|
export interface UseFormSchemasLinkOptions {
|
|
68
80
|
/** 表单场景,默认 list */
|
|
69
81
|
scene?: FormScene;
|
|
82
|
+
/** 字段路径前缀,用于嵌套对象或数组行(如 "condition" 或 "tableData[0]") */
|
|
83
|
+
basePath?: string;
|
|
70
84
|
/** 外部数据源。未传时会按 codes 调用 queryDataPermissionDetailDataTypeContext。 */
|
|
71
85
|
dataSource?: MaybeRef<DataPermissionOptionsMap | undefined>;
|
|
72
86
|
/** 字段级配置,key 为 DataType */
|
|
@@ -75,7 +89,7 @@ export interface UseFormSchemasLinkOptions {
|
|
|
75
89
|
schemas?: Partial<Record<DataType, FieldSchemaConfig>>;
|
|
76
90
|
}
|
|
77
91
|
/**
|
|
78
|
-
*
|
|
92
|
+
* 下拉组件消费的统一选项结构。
|
|
79
93
|
*/
|
|
80
94
|
export type SelectOption = Recordable & {
|
|
81
95
|
/** 展示文案 */
|
|
@@ -86,11 +100,21 @@ export type SelectOption = Recordable & {
|
|
|
86
100
|
platformId?: string | number;
|
|
87
101
|
};
|
|
88
102
|
/**
|
|
89
|
-
*
|
|
103
|
+
* useFormSchemasLink 构建结果,包含各数据维度的 TtFormSchema、归一化数据源及数组行 schema 工厂函数。
|
|
90
104
|
*/
|
|
91
105
|
type UseFormSchemasLinkResult = Record<DataType, TtFormSchema> & {
|
|
106
|
+
/** 响应式数据源对象 */
|
|
92
107
|
dataSource: Ref<Record<BusinessDataType, SelectOption[]>>;
|
|
108
|
+
/**
|
|
109
|
+
* 为指定行路径(如 tableData[0])生成对应行 schema 映射,共享同一个数据源与配置
|
|
110
|
+
* @param itemPath - 行路径或嵌套前缀
|
|
111
|
+
* @returns 对应行的字段 schema 映射
|
|
112
|
+
*/
|
|
113
|
+
createRowSchemas: (itemPath: string) => Record<DataType, TtFormSchema>;
|
|
93
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* useFormSchemasLink 的链式配置构建器。
|
|
117
|
+
*/
|
|
94
118
|
type FormSchemasLinkBuilder = {
|
|
95
119
|
/** 设置为查询筛选场景 */
|
|
96
120
|
list(): FormSchemasLinkBuilder;
|
|
@@ -98,13 +122,22 @@ type FormSchemasLinkBuilder = {
|
|
|
98
122
|
action(): FormSchemasLinkBuilder;
|
|
99
123
|
/** 设置表单场景 */
|
|
100
124
|
scene(scene: FormScene): FormSchemasLinkBuilder;
|
|
125
|
+
/** 设置路径前缀,支持嵌套对象或数组行路径(如 "items[0]" 或 "query") */
|
|
126
|
+
basePath(basePath: string): FormSchemasLinkBuilder;
|
|
101
127
|
/** 指定需要请求和构建的字段类型,默认包含全部 DataType */
|
|
102
128
|
codes(codes: BusinessDataType[]): FormSchemasLinkBuilder;
|
|
103
129
|
/** 使用外部数据源,跳过内部接口请求 */
|
|
104
130
|
dataSource(dataSource: MaybeRef<DataPermissionOptionsMap | undefined>): FormSchemasLinkBuilder;
|
|
105
131
|
/** 覆盖单个字段配置 */
|
|
106
132
|
field(dataType: DataType, config: FieldSchemaConfig): FormSchemasLinkBuilder;
|
|
133
|
+
/** 构建顶层 schemas 与数据源 */
|
|
107
134
|
build(): UseFormSchemasLinkResult;
|
|
135
|
+
/**
|
|
136
|
+
* 为数组子行或嵌套路径生成 schemas,复用当前数据源与配置
|
|
137
|
+
* @param itemPath - 行或嵌套路径,例如 "tableData[0]"
|
|
138
|
+
* @returns 对应行的字段 schema 映射
|
|
139
|
+
*/
|
|
140
|
+
createRowSchemas(itemPath: string): Record<DataType, TtFormSchema>;
|
|
108
141
|
};
|
|
109
142
|
/**
|
|
110
143
|
* 构建数据权限相关的表单联动 schema。
|
|
@@ -116,10 +149,11 @@ type FormSchemasLinkBuilder = {
|
|
|
116
149
|
* - 平台变更时清空店铺值,并按平台过滤店铺选项
|
|
117
150
|
* - 多选字段支持“全部”互斥选择逻辑
|
|
118
151
|
* - action 场景下平台为“全部”或多平台时禁用店铺并取消必填
|
|
152
|
+
* - 支持深层嵌套字段(如 a.b.c)与数组行(arraySchema)
|
|
119
153
|
*
|
|
120
154
|
* @example
|
|
121
155
|
* ```ts
|
|
122
|
-
* const { platformId, shopId, businessType } = useFormSchemasLink()
|
|
156
|
+
* const { platformId, shopId, businessType, createRowSchemas } = useFormSchemasLink()
|
|
123
157
|
* .list()
|
|
124
158
|
* .codes(["platformId", "shopId", "businessType"])
|
|
125
159
|
* .field("platformId", {
|
|
@@ -133,6 +167,8 @@ type FormSchemasLinkBuilder = {
|
|
|
133
167
|
*
|
|
134
168
|
* const schemas = [platformId, shopId, businessType];
|
|
135
169
|
* ```
|
|
170
|
+
*
|
|
171
|
+
* @returns FormSchemasLinkBuilder 链式构建器
|
|
136
172
|
*/
|
|
137
173
|
export declare function useFormSchemasLink(): FormSchemasLinkBuilder;
|
|
138
174
|
export {};
|