@dazhicheng/ui 1.5.110 → 1.5.111

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.
@@ -19,7 +19,7 @@ export type DataType = "platformId" | "shopId" | "purchasePlaceId" | "businessTy
19
19
  */
20
20
  export type FormScene = "list" | "action";
21
21
  type FieldComponentProps = Recordable | ((values: Recordable, actions: any, options: SelectOption[]) => Recordable);
22
- type FieldSchemaConfig = Partial<TtFormSchema> | ((schema: TtFormSchema, dataType: DataType) => TtFormSchema);
22
+ type FieldSchemaConfig = Partial<TtFormSchema> & UseFormSchemasLinkFieldConfig;
23
23
  /**
24
24
  * 字段 onChange 回调上下文。
25
25
  *
@@ -47,23 +47,13 @@ export interface FieldOnChangeContext {
47
47
  * 组件 props、校验规则、依赖关系和追加 onChange 行为。
48
48
  */
49
49
  export interface UseFormSchemasLinkFieldConfig {
50
- /** 业务中实际需要绑定的字段名称 */
51
- fieldName?: string;
52
- /** 业务中实际需要绑定的label名称 */
53
- label?: string;
54
- /** 是否多选 默认多选 */
55
50
  multiple?: boolean;
56
- /** 多选时是否折叠 tag,默认 true */
57
- collapseTags?: boolean;
58
51
  /** 透传给 ElSelectV2 的 props;传函数时会在渲染时接收表单值、操作对象和当前选项 */
59
52
  componentProps?: FieldComponentProps;
60
53
  /** 追加或覆盖 TtFormSchema.dependencies */
61
54
  dependencies?: TtFormSchema["dependencies"];
62
55
  /** 字段值变化后的追加回调。默认联动逻辑会先执行,再执行该回调。 */
63
56
  onChange?: (values: unknown, context: FieldOnChangeContext) => void;
64
- /** 字段校验规则 */
65
- rules?: TtFormSchema["rules"];
66
- /** 是否在当前字段选项前追加“全部”,默认 true */
67
57
  showAll?: boolean;
68
58
  }
69
59
  /**
@@ -77,7 +67,7 @@ export interface UseFormSchemasLinkOptions {
77
67
  /** 外部数据源。未传时会按 codes 调用 queryDataPermissionDetailDataTypeContext。 */
78
68
  dataSource?: MaybeRef<IamAPI.DataPermissionDetailDTO[] | undefined>;
79
69
  /** 字段级配置,key 为 DataType */
80
- fieldConfigs?: Partial<Record<DataType, UseFormSchemasLinkFieldConfig>>;
70
+ fieldConfigs?: Partial<Record<DataType, FieldSchemaConfig>>;
81
71
  /** Schema 级覆盖。传函数时可基于默认 schema 做增量修改。 */
82
72
  schemas?: Partial<Record<DataType, FieldSchemaConfig>>;
83
73
  }
@@ -112,12 +102,7 @@ type FormSchemasLinkBuilder = {
112
102
  /** 使用外部数据源,跳过内部接口请求 */
113
103
  dataSource(dataSource: MaybeRef<IamAPI.DataPermissionDetailDTO[] | undefined>): FormSchemasLinkBuilder;
114
104
  /** 覆盖单个字段配置 */
115
- field(dataType: DataType, config: UseFormSchemasLinkFieldConfig): FormSchemasLinkBuilder;
116
- /** 覆盖单个字段的完整 schema 或基于默认 schema 做增量修改 */
117
- schema(dataType: DataType, schema: FieldSchemaConfig): FormSchemasLinkBuilder;
118
- /** 批量合并配置 */
119
- fromOptions(options: UseFormSchemasLinkOptions): FormSchemasLinkBuilder;
120
- /** 生成最终 schema 和数据源 */
105
+ field(dataType: DataType, config: FieldSchemaConfig): FormSchemasLinkBuilder;
121
106
  build(): UseFormSchemasLinkResult;
122
107
  };
123
108
  /**