@dazhicheng/ui 1.5.120 → 1.5.122
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/form-render/FormArrayRegister.d.ts +5 -3
- package/dist/components/tt-form/src/formApi.d.ts +18 -0
- package/dist/components/tt-form/src/group-form/groupFormApi.d.ts +19 -0
- package/dist/components/tt-form/src/types.d.ts +4 -3
- package/dist/components/tt-form/src/utils/array-path.d.ts +8 -0
- package/dist/hooks/useBudinessData.d.ts +21 -0
- package/dist/hooks/useElementScreenshot.d.ts +27 -0
- package/dist/hooks/useFormSchemasLink.d.ts +9 -23
- package/dist/index.d.ts +1 -0
- package/dist/index.js +11479 -10929
- package/package.json +2 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
+
import { FieldEntry } from '../types/forms';
|
|
2
3
|
import { FormSchema } from '../types';
|
|
4
|
+
import { Recordable } from '../../../../../../utils/src';
|
|
3
5
|
declare const FormArrayRegister: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
6
|
fieldName: {
|
|
5
7
|
type: PropType<string>;
|
|
6
8
|
required: true;
|
|
7
9
|
};
|
|
8
10
|
arraySchema: {
|
|
9
|
-
type: PropType<FormSchema[]>;
|
|
11
|
+
type: PropType<FormSchema[] | ((entry: FieldEntry<Recordable>, currentIndex: number) => FormSchema[])>;
|
|
10
12
|
default: () => FormSchema[];
|
|
11
13
|
};
|
|
12
14
|
formItemClass: {
|
|
@@ -29,7 +31,7 @@ declare const FormArrayRegister: import('vue').DefineComponent<import('vue').Ext
|
|
|
29
31
|
required: true;
|
|
30
32
|
};
|
|
31
33
|
arraySchema: {
|
|
32
|
-
type: PropType<FormSchema[]>;
|
|
34
|
+
type: PropType<FormSchema[] | ((entry: FieldEntry<Recordable>, currentIndex: number) => FormSchema[])>;
|
|
33
35
|
default: () => FormSchema[];
|
|
34
36
|
};
|
|
35
37
|
formItemClass: {
|
|
@@ -46,7 +48,7 @@ declare const FormArrayRegister: import('vue').DefineComponent<import('vue').Ext
|
|
|
46
48
|
};
|
|
47
49
|
}>> & Readonly<{}>, {
|
|
48
50
|
rules: import('../types').FormSchemaRuleType | undefined;
|
|
49
|
-
arraySchema: FormSchema<keyof import('../types').BaseFormComponentMap>[];
|
|
51
|
+
arraySchema: FormSchema<keyof import('../types').BaseFormComponentMap>[] | ((entry: FieldEntry<Recordable>, currentIndex: number) => FormSchema[]);
|
|
50
52
|
formItemClass: NonNullable<string | (() => string) | undefined>;
|
|
51
53
|
virtual: boolean;
|
|
52
54
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -206,6 +206,24 @@ export declare class FormApi {
|
|
|
206
206
|
* @param indexB 第二个索引位置
|
|
207
207
|
*/
|
|
208
208
|
swap: (name: string, indexA: number, indexB: number) => void | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* @description 获取嵌套数组路径下的操作器
|
|
211
|
+
* @param parentPath 父数组路径(如 actions.data)
|
|
212
|
+
* @param index 父数组索引
|
|
213
|
+
* @param childField 子数组字段名(如 skills)
|
|
214
|
+
*/
|
|
215
|
+
at: <TValue = unknown>(parentPath: string, index: number, childField: string) => {
|
|
216
|
+
path: string;
|
|
217
|
+
get: () => Readonly<FieldArrayContext<TValue>> | undefined;
|
|
218
|
+
push: (value: TValue) => void | undefined;
|
|
219
|
+
remove: (idx: number) => void | undefined;
|
|
220
|
+
replace: (values: TValue[]) => void | undefined;
|
|
221
|
+
update: (idx: number, value: TValue) => void | undefined;
|
|
222
|
+
insert: (idx: number, value: TValue) => void | undefined;
|
|
223
|
+
prepend: (value: TValue) => void | undefined;
|
|
224
|
+
move: (oldIdx: number, newIdx: number) => void | undefined;
|
|
225
|
+
swap: (indexA: number, indexB: number) => void | undefined;
|
|
226
|
+
};
|
|
209
227
|
};
|
|
210
228
|
private _getArrayFieldActions;
|
|
211
229
|
}
|
|
@@ -280,6 +280,25 @@ export declare class GroupFormApi extends FormApi {
|
|
|
280
280
|
prepend: <TValue = unknown>(name: string, value: TValue) => void;
|
|
281
281
|
move: (name: string, oldIdx: number, newIdx: number) => void;
|
|
282
282
|
swap: (name: string, indexA: number, indexB: number) => void;
|
|
283
|
+
/**
|
|
284
|
+
* @description 获取嵌套数组路径下的操作器
|
|
285
|
+
* @param parentPath 父数组路径
|
|
286
|
+
* @param index 父数组索引
|
|
287
|
+
* @param childField 子数组字段名
|
|
288
|
+
* @returns 嵌套数组操作器
|
|
289
|
+
*/
|
|
290
|
+
at: <TValue = unknown>(parentPath: string, index: number, childField: string) => {
|
|
291
|
+
path: string;
|
|
292
|
+
get: () => Readonly<import('../types').FieldArrayContext<TValue>> | undefined;
|
|
293
|
+
push: (value: TValue) => void;
|
|
294
|
+
remove: (idx: number) => void;
|
|
295
|
+
replace: (values: TValue[]) => void;
|
|
296
|
+
update: (idx: number, value: TValue) => void;
|
|
297
|
+
insert: (idx: number, value: TValue) => void;
|
|
298
|
+
prepend: (value: TValue) => void;
|
|
299
|
+
move: (oldIdx: number, newIdx: number) => void;
|
|
300
|
+
swap: (indexA: number, indexB: number) => void;
|
|
301
|
+
};
|
|
283
302
|
};
|
|
284
303
|
unmount(): void;
|
|
285
304
|
}
|
|
@@ -6,8 +6,9 @@ import { TtTextProps } from '../../tt-text';
|
|
|
6
6
|
import { TtSelectProp } from '../../tt-select';
|
|
7
7
|
import { TtUploadProps } from '../../tt-upload';
|
|
8
8
|
import { Props as TtApiComponentProps } from '../../tt-api-component';
|
|
9
|
+
import { Recordable } from '../../../../../utils/src';
|
|
9
10
|
import { FieldEntry, FieldArrayContext } from './types/forms';
|
|
10
|
-
import {
|
|
11
|
+
import { TtPanelSelectProps } from '../../tt-panel-select';
|
|
11
12
|
import { FormApi } from './formApi';
|
|
12
13
|
export type FormLayout = "horizontal" | "inline" | "vertical";
|
|
13
14
|
export interface BaseFormComponentMap {
|
|
@@ -30,7 +31,7 @@ export interface BaseFormComponentMap {
|
|
|
30
31
|
TtUpload: TtUploadProps;
|
|
31
32
|
ElColorPicker: ColorPickerProps;
|
|
32
33
|
TtApiComponent: TtApiComponentProps<Component>;
|
|
33
|
-
TtPanelSelect:
|
|
34
|
+
TtPanelSelect: TtPanelSelectProps;
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* 表单组件类型字符串联合类型
|
|
@@ -245,7 +246,7 @@ export interface FormSchema<T extends BaseFormComponentType = BaseFormComponentT
|
|
|
245
246
|
* @example arraySchema: []
|
|
246
247
|
* @example arraySchema: (entry, index) => []
|
|
247
248
|
*/
|
|
248
|
-
arraySchema?: FormSchema[] | ((entry: FieldEntry
|
|
249
|
+
arraySchema?: FormSchema[] | ((entry: FieldEntry<Recordable>, currentIndex: number) => FormSchema[]);
|
|
249
250
|
}
|
|
250
251
|
/** 插槽 scope 参数,传递给渲染函数或具名插槽 */
|
|
251
252
|
export interface FormSlotScope {
|
|
@@ -1 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 数据权限接口支持的联动数据类型。
|
|
3
|
+
*
|
|
4
|
+
* - platformId:平台
|
|
5
|
+
* - shopId:店铺,默认会跟随平台值联动过滤
|
|
6
|
+
* - purchasePlaceId:采购地
|
|
7
|
+
* - businessType:业务线
|
|
8
|
+
* - lockUserId:锁单人
|
|
9
|
+
*/
|
|
10
|
+
export type DataType = "platformId" | "shopId" | "purchasePlaceId" | "businessType" | "lockUserId";
|
|
11
|
+
/**
|
|
12
|
+
* ElSelectV2 消费的统一选项结构。
|
|
13
|
+
*/
|
|
14
|
+
export type SelectOption = Recordable & {
|
|
15
|
+
/** 展示文案 */
|
|
16
|
+
label: string;
|
|
17
|
+
/** 选项值 */
|
|
18
|
+
value: string | number;
|
|
19
|
+
/** 店铺所属平台 id,用于平台和店铺联动过滤 */
|
|
20
|
+
platformId?: string | number;
|
|
21
|
+
};
|
|
1
22
|
export declare function useBudinessData(): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
type ScreenshotTarget = HTMLElement | null | undefined;
|
|
3
|
+
export interface ElementScreenshotOptions {
|
|
4
|
+
/** 输出格式,默认 png */
|
|
5
|
+
format?: "png" | "jpeg";
|
|
6
|
+
/** 图片质量,默认 1 */
|
|
7
|
+
quality?: number;
|
|
8
|
+
/** 渲染像素比,默认取设备像素比并限制到 3 */
|
|
9
|
+
pixelRatio?: number;
|
|
10
|
+
/** 背景色,默认白色 */
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
/** 是否为资源追加防缓存参数,默认 true */
|
|
13
|
+
cacheBust?: boolean;
|
|
14
|
+
/** 是否跳过字体加载等待,默认 false */
|
|
15
|
+
skipFontsReady?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* DOM 截图 Hook:支持导出 Blob 或 DataURL
|
|
19
|
+
*/
|
|
20
|
+
export declare function useElementScreenshot(): {
|
|
21
|
+
captureToBlob: (target: MaybeRefOrGetter<ScreenshotTarget>, options?: ElementScreenshotOptions) => Promise<Blob>;
|
|
22
|
+
captureToDataUrl: (target: MaybeRefOrGetter<ScreenshotTarget>, options?: ElementScreenshotOptions) => Promise<string>;
|
|
23
|
+
isCapturing: import('vue').Ref<boolean, boolean>;
|
|
24
|
+
lastError: import('vue').Ref<Error | null, Error | null>;
|
|
25
|
+
resetError: () => void;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { TtFormSchema } from '../components/tt-form';
|
|
2
2
|
import { Recordable } from '../../../utils/src';
|
|
3
3
|
import { MaybeRef, Ref } from 'vue';
|
|
4
|
-
|
|
5
|
-
* 数据权限接口支持的联动数据类型。
|
|
6
|
-
*
|
|
7
|
-
* - platformId:平台
|
|
8
|
-
* - shopId:店铺,默认会跟随平台值联动过滤
|
|
9
|
-
* - purchasePlaceId:采购地
|
|
10
|
-
* - businessType:业务线
|
|
11
|
-
* - lockUserId:锁单人
|
|
12
|
-
*/
|
|
13
|
-
export type DataType = "platformId" | "shopId" | "purchasePlaceId" | "businessType" | "lockUserId";
|
|
4
|
+
import { DataType, SelectOption } from './useBudinessData';
|
|
14
5
|
/**
|
|
15
6
|
* 表单使用场景。
|
|
16
7
|
*
|
|
@@ -54,11 +45,17 @@ export interface UseFormSchemasLinkFieldConfig {
|
|
|
54
45
|
dependencies?: TtFormSchema["dependencies"];
|
|
55
46
|
/** 字段值变化后的追加回调。默认联动逻辑会先执行,再执行该回调。 */
|
|
56
47
|
onChange?: (values: unknown, context: FieldOnChangeContext) => void;
|
|
48
|
+
/** 是否展示全部选项 */
|
|
57
49
|
showAll?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* @description 自定义过滤数据源
|
|
52
|
+
* @param values 表单对象
|
|
53
|
+
* @param options 下拉数据源(完整的)
|
|
54
|
+
*/
|
|
55
|
+
customOptions?: (values: Recordable, options: SelectOption[]) => SelectOption[];
|
|
58
56
|
}
|
|
59
57
|
/**
|
|
60
|
-
* useFormSchemasLink
|
|
61
|
-
*
|
|
58
|
+
* useFormSchemasLink 的批量配置
|
|
62
59
|
* 可以通过 fromOptions(options) 一次性传入,也可以使用 builder 链式方法逐项配置。
|
|
63
60
|
*/
|
|
64
61
|
export interface UseFormSchemasLinkOptions {
|
|
@@ -71,17 +68,6 @@ export interface UseFormSchemasLinkOptions {
|
|
|
71
68
|
/** Schema 级覆盖。传函数时可基于默认 schema 做增量修改。 */
|
|
72
69
|
schemas?: Partial<Record<DataType, FieldSchemaConfig>>;
|
|
73
70
|
}
|
|
74
|
-
/**
|
|
75
|
-
* ElSelectV2 消费的统一选项结构。
|
|
76
|
-
*/
|
|
77
|
-
export type SelectOption = Recordable & {
|
|
78
|
-
/** 展示文案 */
|
|
79
|
-
label: string;
|
|
80
|
-
/** 选项值 */
|
|
81
|
-
value: string | number;
|
|
82
|
-
/** 店铺所属平台 id,用于平台和店铺联动过滤 */
|
|
83
|
-
platformId?: string | number;
|
|
84
|
-
};
|
|
85
71
|
/**
|
|
86
72
|
* 构建后的表单 schema 集合。
|
|
87
73
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from './components/tt-panel-select';
|
|
|
25
25
|
export { useFormSchemasLink } from './hooks/useFormSchemasLink';
|
|
26
26
|
export { useFormat } from './hooks/useFormat';
|
|
27
27
|
export { useLoading } from './hooks/useLoading';
|
|
28
|
+
export { useElementScreenshot } from './hooks/useElementScreenshot';
|
|
28
29
|
export { setXHR };
|
|
29
30
|
/**
|
|
30
31
|
* 表单组件适配器
|