@aspire-ui/element-component-pro 1.0.2 → 1.0.4

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/README.md CHANGED
@@ -310,6 +310,7 @@ const handleSubmit = (values) => {
310
310
  - **ifShow** / **show**: 动态显示(ifShow 不渲染 DOM)
311
311
  - **dynamicDisabled**: 动态禁用
312
312
  - **dynamicRules**: 动态校验规则
313
+ - **labelWidth**: 支持字段级标签宽度,覆盖表单级 `labelWidth`
313
314
  - **componentProps**: 支持函数,可获取 formModel、formActionType
314
315
 
315
316
  ## 示例与文档
@@ -0,0 +1,67 @@
1
+ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ value?: unknown;
3
+ /** 拉取选项的接口,返回 Promise<Array<{ label, value }>> 或 { list: [] };可接收当前 params 作为参数 */
4
+ api?: (params?: Record<string, unknown>) => Promise<unknown>;
5
+ /** 请求参数,变化时会重新拉取 options */
6
+ params?: Record<string, unknown>;
7
+ /** 是否懒加载:为 true 时在展开下拉时再请求数据,不在挂载时请求 */
8
+ lazy?: boolean;
9
+ /** 接口返回列表中「标签」字段名,默认 'label' */
10
+ labelField?: string;
11
+ /** 接口返回列表中「值」字段名,默认 'value' */
12
+ valueField?: string;
13
+ placeholder?: string;
14
+ disabled?: boolean;
15
+ clearable?: boolean;
16
+ filterable?: boolean;
17
+ multiple?: boolean;
18
+ }>, {
19
+ labelField: string;
20
+ valueField: string;
21
+ lazy: boolean;
22
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
23
+ input: (value: unknown) => void;
24
+ }, string, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
25
+ value?: unknown;
26
+ /** 拉取选项的接口,返回 Promise<Array<{ label, value }>> 或 { list: [] };可接收当前 params 作为参数 */
27
+ api?: (params?: Record<string, unknown>) => Promise<unknown>;
28
+ /** 请求参数,变化时会重新拉取 options */
29
+ params?: Record<string, unknown>;
30
+ /** 是否懒加载:为 true 时在展开下拉时再请求数据,不在挂载时请求 */
31
+ lazy?: boolean;
32
+ /** 接口返回列表中「标签」字段名,默认 'label' */
33
+ labelField?: string;
34
+ /** 接口返回列表中「值」字段名,默认 'value' */
35
+ valueField?: string;
36
+ placeholder?: string;
37
+ disabled?: boolean;
38
+ clearable?: boolean;
39
+ filterable?: boolean;
40
+ multiple?: boolean;
41
+ }>, {
42
+ labelField: string;
43
+ valueField: string;
44
+ lazy: boolean;
45
+ }>>>, {
46
+ lazy: boolean;
47
+ labelField: string;
48
+ valueField: string;
49
+ }>;
50
+ export default _default;
51
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
52
+ type __VLS_TypePropsToRuntimeProps<T> = {
53
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
54
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
55
+ } : {
56
+ type: import('vue').PropType<T[K]>;
57
+ required: true;
58
+ };
59
+ };
60
+ type __VLS_WithDefaults<P, D> = {
61
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
62
+ default: D[K];
63
+ }> : P[K];
64
+ };
65
+ type __VLS_Prettify<T> = {
66
+ [K in keyof T]: T[K];
67
+ } & {};
@@ -5,7 +5,8 @@ declare function __VLS_template(): Partial<Record<string, (_: {
5
5
  schema: {
6
6
  field: string;
7
7
  label: string;
8
- component?: "input" | "select" | "date-picker" | "date-range" | "input-number" | "switch" | "cascader" | "checkbox" | "radio" | undefined;
8
+ labelWidth?: string | undefined;
9
+ component?: (import('..').ProFormBuiltInComponent | import('..').ProFormCustomComponent) | undefined;
9
10
  componentProps?: (Record<string, unknown> | ((params: import('..').RenderCallbackParams & {
10
11
  formActionType?: FormActionType;
11
12
  }) => Record<string, unknown>)) | undefined;
@@ -72,6 +73,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<
72
73
  resetFunc?: () => Promise<void>;
73
74
  submitOnReset?: boolean;
74
75
  formListeners?: FormListeners;
76
+ /** 自定义组件映射(组件名 -> 组件),供 schema.component 使用 */
77
+ components?: Record<string, unknown>;
75
78
  }>, {
76
79
  labelWidth: string;
77
80
  labelPosition: string;
@@ -146,6 +149,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<
146
149
  resetFunc?: () => Promise<void>;
147
150
  submitOnReset?: boolean;
148
151
  formListeners?: FormListeners;
152
+ /** 自定义组件映射(组件名 -> 组件),供 schema.component 使用 */
153
+ components?: Record<string, unknown>;
149
154
  }>, {
150
155
  labelWidth: string;
151
156
  labelPosition: string;
@@ -14,12 +14,16 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_TypePropsToRu
14
14
  formDisabled?: boolean;
15
15
  autoPlaceholder?: boolean;
16
16
  formActionType?: import('../types').FormActionType;
17
+ /** 自定义组件映射(由 ProForm 传入) */
18
+ customComponents?: Record<string, unknown>;
17
19
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
18
20
  schema: ProFormSchema;
19
21
  formModel: Record<string, unknown>;
20
22
  formDisabled?: boolean;
21
23
  autoPlaceholder?: boolean;
22
24
  formActionType?: import('../types').FormActionType;
25
+ /** 自定义组件映射(由 ProForm 传入) */
26
+ customComponents?: Record<string, unknown>;
23
27
  }>>>, {}>;
24
28
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
25
29
  export default _default;
@@ -0,0 +1,64 @@
1
+ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ value?: unknown;
3
+ /** 树数据,直接传入时优先使用,不请求 api */
4
+ treeData?: unknown[];
5
+ api?: (params?: Record<string, unknown>) => Promise<unknown>;
6
+ params?: Record<string, unknown>;
7
+ lazy?: boolean;
8
+ labelField?: string;
9
+ valueField?: string;
10
+ childrenField?: string;
11
+ filterable?: boolean;
12
+ placeholder?: string;
13
+ disabled?: boolean;
14
+ clearable?: boolean;
15
+ }>, {
16
+ labelField: string;
17
+ valueField: string;
18
+ childrenField: string;
19
+ lazy: boolean;
20
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
+ input: (value: unknown) => void;
22
+ }, string, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
23
+ value?: unknown;
24
+ /** 树数据,直接传入时优先使用,不请求 api */
25
+ treeData?: unknown[];
26
+ api?: (params?: Record<string, unknown>) => Promise<unknown>;
27
+ params?: Record<string, unknown>;
28
+ lazy?: boolean;
29
+ labelField?: string;
30
+ valueField?: string;
31
+ childrenField?: string;
32
+ filterable?: boolean;
33
+ placeholder?: string;
34
+ disabled?: boolean;
35
+ clearable?: boolean;
36
+ }>, {
37
+ labelField: string;
38
+ valueField: string;
39
+ childrenField: string;
40
+ lazy: boolean;
41
+ }>>>, {
42
+ lazy: boolean;
43
+ labelField: string;
44
+ valueField: string;
45
+ childrenField: string;
46
+ }>;
47
+ export default _default;
48
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
49
+ type __VLS_TypePropsToRuntimeProps<T> = {
50
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
51
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
52
+ } : {
53
+ type: import('vue').PropType<T[K]>;
54
+ required: true;
55
+ };
56
+ };
57
+ type __VLS_WithDefaults<P, D> = {
58
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
59
+ default: D[K];
60
+ }> : P[K];
61
+ };
62
+ type __VLS_Prettify<T> = {
63
+ [K in keyof T]: T[K];
64
+ } & {};
@@ -372,11 +372,11 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_WithDefaults<
372
372
  };
373
373
  immediate: boolean;
374
374
  }>>>, {
375
+ loading: boolean;
375
376
  size: "medium" | "small" | "large";
376
377
  rowKey: string;
377
378
  bordered: boolean;
378
379
  striped: boolean;
379
- loading: boolean;
380
380
  ellipsis: boolean;
381
381
  showIndexColumn: boolean;
382
382
  clearSelectOnPageChange: boolean;
@@ -3,6 +3,6 @@ import { default as TableAction } from './TableAction.vue';
3
3
  import { useProTable } from './useProTable';
4
4
 
5
5
  export { ProTable, useProTable, TableAction };
6
- export type { UseProTableReturn } from './useProTable';
6
+ export type { UseProTableReturn, UseProTablePropsReactive } from './useProTable';
7
7
  export type { ProColumn, ProTableProps, TableActionType, FetchSetting, FetchParams, ProTableToolBarConfig, SpanMethodParams, SpanMethodResult, TreeProps, TableActionItem, TableActionProps, } from './types';
8
8
  export default ProTable;
@@ -5,8 +5,10 @@ export type UseProTableReturn = [
5
5
  (instance: TableActionType) => void,
6
6
  TableActionType
7
7
  ];
8
+ /** 支持 ref/computed 的 props */
9
+ export type UseProTablePropsReactive = ProTableProps | Ref<ProTableProps | undefined>;
8
10
  /**
9
11
  * 用于 ProTable 的 useProTable,支持通过 ref 调用表格方法
10
- * @param props ProTable 的 props 配置
12
+ * @param props ProTable 的 props 配置,传入后会通过 setProps 同步到表格(支持 ref/computed 响应式更新)
11
13
  */
12
- export declare function useProTable(props?: ProTableProps | Ref<ProTableProps | undefined>): UseProTableReturn;
14
+ export declare function useProTable(props?: UseProTablePropsReactive): UseProTableReturn;