@dazhicheng/ui 1.5.121 → 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.
@@ -1,6 +1,7 @@
1
1
  import { PropType } from 'vue';
2
2
  import { FieldEntry } from '../types/forms';
3
3
  import { FormSchema } from '../types';
4
+ import { Recordable } from '../../../../../../utils/src';
4
5
  declare const FormArrayRegister: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
5
6
  fieldName: {
6
7
  type: PropType<string>;
@@ -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 { PanelContainerProps } from '../../tt-panel-select';
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: PanelContainerProps;
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, currentIndex: number) => FormSchema[]);
249
+ arraySchema?: FormSchema[] | ((entry: FieldEntry<Recordable>, currentIndex: number) => FormSchema[]);
249
250
  }
250
251
  /** 插槽 scope 参数,传递给渲染函数或具名插槽 */
251
252
  export interface FormSlotScope {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 拼接数组子路径
3
+ * @param parentPath 父数组路径
4
+ * @param index 父数组索引
5
+ * @param childField 子数组字段名
6
+ * @returns 嵌套数组完整路径
7
+ */
8
+ export declare function childArrayPath(parentPath: string, index: number, childField: string): string;
@@ -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
  *
@@ -77,17 +68,6 @@ export interface UseFormSchemasLinkOptions {
77
68
  /** Schema 级覆盖。传函数时可基于默认 schema 做增量修改。 */
78
69
  schemas?: Partial<Record<DataType, FieldSchemaConfig>>;
79
70
  }
80
- /**
81
- * ElSelectV2 消费的统一选项结构。
82
- */
83
- export type SelectOption = Recordable & {
84
- /** 展示文案 */
85
- label: string;
86
- /** 选项值 */
87
- value: string | number;
88
- /** 店铺所属平台 id,用于平台和店铺联动过滤 */
89
- platformId?: string | number;
90
- };
91
71
  /**
92
72
  * 构建后的表单 schema 集合。
93
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
  * 表单组件适配器