@qin-ui/antd-vue-pro 2.1.6 → 2.1.7

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,5 +1,5 @@
1
1
  import { defineComponent, provide, renderSlot } from "vue";
2
- import { g as getObject } from "../core/index-BrBzu6aj.js";
2
+ import { g as getObject } from "../core/index-BWMfavD1.js";
3
3
  const getPopupContainer = (triggerNode) => triggerNode.closest("form[class*='-form']");
4
4
  const INJECT_COMPONENTS = Symbol("INJECT_COMPONENTS");
5
5
  const INJECT_CONFIG = {
@@ -210,7 +210,7 @@ function useForm(...args) {
210
210
  if (args.length === 1) {
211
211
  root = args[0];
212
212
  } else if (args.length >= 2) {
213
- initFormData = args[0];
213
+ initFormData = args[0] ?? {};
214
214
  initFields = args[1];
215
215
  root = args[2] ?? root;
216
216
  }
package/es/form/index.js CHANGED
@@ -6,8 +6,8 @@ import { colProps } from "ant-design-vue/es/grid/Col";
6
6
  import { formItemProps, useInjectFormItemContext } from "ant-design-vue/es/form";
7
7
  import { defineComponent, provide, inject, useSlots, watchEffect, createBlock, openBlock, unref, mergeProps, withCtx, createVNode, renderSlot, computed, toValue, normalizeProps, guardReactiveProps, resolveComponent, createElementBlock, Fragment, renderList, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString } from "vue";
8
8
  import { INJECT_CONFIG, getInjectConfig, INJECT_COMPONENTS } from "../component-provider/index.js";
9
- import { I as InjectionFormKey, c as camelizeProperties, a as InjectionPathKey, g as getObject, u as useForm$1, b as useFields$1, d as useFormRef$1 } from "../core/index-BrBzu6aj.js";
10
- import { e } from "../core/index-BrBzu6aj.js";
9
+ import { I as InjectionFormKey, c as camelizeProperties, a as InjectionPathKey, g as getObject, u as useForm$1, b as useFields$1, d as useFormRef$1 } from "../core/index-BWMfavD1.js";
10
+ import { e } from "../core/index-BWMfavD1.js";
11
11
  import { i as isPlainObject, t as toPath, o as omit, c as cloneDeep } from "../vendor/utils/lodash-es-p6jau26B.js";
12
12
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
13
13
  ...{ name: "ProForm", inheritAttrs: false },
@@ -241,7 +241,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
241
241
  key: 0,
242
242
  grid: field.grid ?? __props.grid,
243
243
  fields: field.fields,
244
- disabled: field.disabled
244
+ disabled: toValue(field.disabled)
245
245
  }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
246
246
  key: 1,
247
247
  ref_for: true,
@@ -343,7 +343,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
343
343
  const groupedAttrs = computed(() => {
344
344
  const initProps = getInitProps({
345
345
  component: __props.component,
346
- type: attrs.type
346
+ picker: attrs.picker
347
347
  });
348
348
  const mergedProps = mergeProps(
349
349
  initProps,
package/es/index.d.ts CHANGED
@@ -124,7 +124,16 @@ declare type AllowStringKey<T, Prefix extends string = ''> = {
124
124
  /**
125
125
  * @type {Object} Base - 基础公共字段类型
126
126
  */
127
- export declare interface Base<D extends Data = Data> {
127
+ export declare type Base<D extends Data = Data> = BaseWithFields<D> | BaseWithoutFields<D>;
128
+
129
+ declare interface BaseColumn<D extends Data = Data> {
130
+ key?: Path<D>;
131
+ dataIndex?: Path<D> | Path<D>[];
132
+ children?: BaseColumn<D>[];
133
+ [key: string]: any;
134
+ }
135
+
136
+ declare type BaseCommon<D extends Data = Data> = {
128
137
  /**
129
138
  * @description 字段标识namePath, 同name
130
139
  * @example 'name' | 'age' | 'sex' | ...
@@ -134,6 +143,10 @@ export declare interface Base<D extends Data = Data> {
134
143
  * @description 字段是否隐藏
135
144
  */
136
145
  hidden?: boolean;
146
+ /**
147
+ * @description 字段是否禁用
148
+ */
149
+ disabled?: boolean;
137
150
  /**
138
151
  * @description 字段中文名称,支持字符串或组件
139
152
  * @example '姓名' | '年龄' | '性别' | () => h('span', '自定义标签')
@@ -161,16 +174,6 @@ export declare interface Base<D extends Data = Data> {
161
174
  * @example 'custom-form-item' | 'required-field'
162
175
  */
163
176
  formItemClass?: string;
164
- /**
165
- * @description 嵌套子字段配置
166
- * @example [{ key: 'firstName', label: '名' }, { key: 'lastName', label: '姓' }]
167
- */
168
- fields?: Fields<D>;
169
- /**
170
- * @description 网格布局属性,true表示使用默认网格布局,针对具有嵌套字段的字段
171
- * @example boolean | { gutter: 24 }
172
- */
173
- grid?: Grid;
174
177
  /**
175
178
  * @description 字段formItem容器包裹组件
176
179
  * @example (props, ctx) => h('div', { class: 'custom-container' }, ctx.slots.default?.())
@@ -181,48 +184,12 @@ export declare interface Base<D extends Data = Data> {
181
184
  * @example { 'data-form-item-test': 'test-value', 'aria-label': 'name' }
182
185
  */
183
186
  formItemDataAttrs?: Record<string, string>;
184
- /**
185
- * @description 字段component样式属性
186
- * @example { width: '100%', borderColor: '#d9d9d9' }
187
- */
188
- componentStyle?: CSSProperties;
189
- /**
190
- * @description 字段component样式类名
191
- * @example 'custom-input' | 'error-input'
192
- */
193
- componentClass?: string;
194
- /**
195
- * @description 字段component容器包裹组件
196
- * @example (props, ctx) => h('div', { class: 'input-wrapper' }, ctx.slots.default?.())
197
- */
198
- componentContainer?: ContainerComponent;
199
- /**
200
- * @description 字段值处理函数,在onUpdateValue前执行,函数返回值将作为更新值,也可设置get和set函数,用于处理字段值
201
- * @example (val) => val?.trim()
202
- */
203
- valueFormatter?: ValueFormatter;
204
- /**
205
- * @description 组件v-model双向绑定更新属性名,默认'value'
206
- */
207
- modelProp?: string;
208
- /**
209
- * @description 将属性附加到表单组件的 DOM 节点
210
- * @example { 'data-test': 'input-value', 'aria-label': 'name' }
211
- */
212
- componentDataAttrs?: Record<string, string>;
213
187
  /**
214
188
  * @description 额外的自定义属性,不会被当作组件参数,仅用做给字段添加标识属性等功能
215
189
  * @example { group: 'group-1' }
216
190
  */
217
191
  extraProps?: Record<string, any>;
218
- }
219
-
220
- declare interface BaseColumn<D extends Data = Data> {
221
- key?: Path<D>;
222
- dataIndex?: Path<D> | Path<D>[];
223
- children?: BaseColumn<D>[];
224
- [key: string]: any;
225
- }
192
+ };
226
193
 
227
194
  export declare type BaseComponentMap = {
228
195
  'input': typeof Input;
@@ -286,6 +253,60 @@ export declare const BaseForm: <F extends Form<any> = Form>(__VLS_props: NonNull
286
253
 
287
254
  export declare const BaseFormItem: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
288
255
 
256
+ declare type BaseWithFields<D extends Data = Data> = BaseCommon<D> & {
257
+ /**
258
+ * @description 嵌套子字段配置
259
+ * @example [{ key: 'firstName', label: '名' }, { key: 'lastName', label: '姓' }]
260
+ */
261
+ fields: Fields<D>;
262
+ /**
263
+ * @description 网格布局属性,true表示使用默认网格布局,针对具有嵌套字段的字段
264
+ * @example boolean | { gutter: 24 }
265
+ */
266
+ grid?: Grid;
267
+ component?: never;
268
+ componentStyle?: never;
269
+ componentClass?: never;
270
+ componentContainer?: never;
271
+ valueFormatter?: never;
272
+ modelProp?: never;
273
+ componentDataAttrs?: never;
274
+ };
275
+
276
+ declare type BaseWithoutFields<D extends Data = Data> = BaseCommon<D> & {
277
+ fields?: undefined;
278
+ grid?: never;
279
+ /**
280
+ * @description 字段component样式属性
281
+ * @example { width: '100%', borderColor: '#d9d9d9' }
282
+ */
283
+ componentStyle?: CSSProperties;
284
+ /**
285
+ * @description 字段component样式类名
286
+ * @example 'custom-input' | 'error-input'
287
+ */
288
+ componentClass?: string;
289
+ /**
290
+ * @description 字段component容器包裹组件
291
+ * @example (props, ctx) => h('div', { class: 'input-wrapper' }, ctx.slots.default?.())
292
+ */
293
+ componentContainer?: ContainerComponent;
294
+ /**
295
+ * @description 字段值处理函数,在onUpdateValue前执行,函数返回值将作为更新值,也可设置get和set函数,用于处理字段值
296
+ * @example (val) => val?.trim()
297
+ */
298
+ valueFormatter?: ValueFormatter;
299
+ /**
300
+ * @description 组件v-model双向绑定更新属性名,默认'value'
301
+ */
302
+ modelProp?: string;
303
+ /**
304
+ * @description 将属性附加到表单组件的 DOM 节点
305
+ * @example { 'data-test': 'input-value', 'aria-label': 'name' }
306
+ */
307
+ componentDataAttrs?: Record<string, string>;
308
+ };
309
+
289
310
  declare type ButtonProps = {
290
311
  onClick: () => void;
291
312
  };
@@ -449,7 +470,7 @@ declare type ExtendWithAny<D> = {
449
470
  * @description 字段配置类型,包含所有字段属性和响应式支持
450
471
  * @template D - 数据对象类型
451
472
  */
452
- export declare type Field<C extends ComponentName = ComponentName, D extends Data = Data> = FieldTypeMap<D>[C];
473
+ export declare type Field<C extends ComponentName = ComponentName, D extends Data = Data> = FieldTypeMap<D>[C] | WithFields<D>;
453
474
 
454
475
  declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<D>> = (field: Readonly<F>) => boolean;
455
476
 
@@ -948,7 +969,9 @@ export declare type VModelProps<T = any> = {
948
969
  'onUpdate:value'?: (val: T) => void;
949
970
  };
950
971
 
951
- declare type WithCommon<T, D extends Data = Data> = WithRef<T & Omit<FormItemProps, 'label'> & ColProps & Base<D>>;
972
+ declare type WithCommon<T, D extends Data = Data> = WithRef<WithCommonBase<T> & BaseWithoutFields<D>>;
973
+
974
+ declare type WithCommonBase<T = unknown> = T & Omit<FormItemProps, 'label'> & ColProps;
952
975
 
953
976
  /**
954
977
  * @description 自动从 Vue 组件提取 Props 和 Slots,并加上公共表单字段属性
@@ -959,6 +982,8 @@ declare type WithComponent<T extends abstract new (...args: any) => any, D exten
959
982
  slots?: ComponentSlots<T>;
960
983
  } & Omit<ComponentProps<T>, keyof VNodeProps>, D>;
961
984
 
985
+ declare type WithFields<D extends Data = Data> = WithRef<WithCommonBase & BaseWithFields<D>>;
986
+
962
987
  /**
963
988
  * @description 为对象属性添加响应式支持的类型
964
989
  * @template T - 原始类型
package/es/index.js CHANGED
@@ -5,7 +5,7 @@ import BaseTable from "./table/index.js";
5
5
  import { useTable } from "./table/index.js";
6
6
  import _sfc_main$1 from "./component-provider/index.js";
7
7
  import { INJECT_COMPONENTS, INJECT_CONFIG, ensureInjectConfig, getInjectConfig } from "./component-provider/index.js";
8
- import { I, a, e } from "./core/index-BrBzu6aj.js";
8
+ import { I, a, e } from "./core/index-BWMfavD1.js";
9
9
  const withInstall = (comp) => {
10
10
  comp.install = (app) => {
11
11
  app.component(comp.name, comp);
package/es/table/index.js CHANGED
@@ -3,7 +3,7 @@ import { INJECT_CONFIG } from "../component-provider/index.js";
3
3
  import _sfc_main$9, { ContainerFragment as _sfc_main$a } from "../form/index.js";
4
4
  import { Space, Button, theme, Dropdown, Menu, MenuItem, Checkbox, MenuDivider, Table } from "ant-design-vue";
5
5
  import { p as pick } from "../vendor/utils/lodash-es-p6jau26B.js";
6
- import { g as getObject, c as camelizeProperties, f as useTable$1 } from "../core/index-BrBzu6aj.js";
6
+ import { g as getObject, c as camelizeProperties, f as useTable$1 } from "../core/index-BWMfavD1.js";
7
7
  import { useConfigContextInject } from "ant-design-vue/es/config-provider/context";
8
8
  import { tableProps } from "ant-design-vue/es/table";
9
9
  const _export_sfc = (sfc, props) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antd-vue-pro",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "description": "二次封装antd vue组件",
5
5
  "type": "module",
6
6
  "module": "es/index.js",