@qin-ui/antdv-next-pro 1.1.6 → 1.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_CONFIG = {
5
5
  "pro-table": {
@@ -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
  }
@@ -2,7 +2,7 @@ import { defineComponent, provide, computed, inject, useSlots, watchEffect, crea
2
2
  import { FormItem, Col, Table, Form, Transfer, TreeSelect, Slider, Switch, RadioGroup, CheckboxGroup, TimeRangePicker, TimePicker, DateRangePicker, DatePicker, Cascader, Select, AutoComplete, InputOTP, InputNumber, InputPassword, InputSearch, TextArea, Input, Row } from "antdv-next";
3
3
  import { useDisabledContextProvider, useDisabledContext } from "antdv-next/dist/config-provider/DisabledContext";
4
4
  import { INJECT_CONFIG, getInjectConfig, INJECT_COMPONENTS } from "../component-provider/index.js";
5
- 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";
5
+ 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";
6
6
  import { i as isPlainObject, t as toPath, o as omit, c as cloneDeep } from "../vendor/utils/lodash-es-p6jau26B.js";
7
7
  const tableProps = () => Table.props || {};
8
8
  const gridItemProps = () => Col.props || {};
@@ -238,7 +238,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
238
238
  key: 0,
239
239
  grid: field.grid ?? __props.grid,
240
240
  fields: field.fields,
241
- disabled: field.disabled
241
+ disabled: toValue(field.disabled)
242
242
  }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$2), mergeProps({
243
243
  key: 1,
244
244
  ref_for: true,
@@ -335,7 +335,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
335
335
  const groupedAttrs = computed(() => {
336
336
  const initProps = getInitProps({
337
337
  component: __props.component,
338
- type: attrs.type
338
+ picker: attrs.picker
339
339
  });
340
340
  const modelPropName = attrs.modelProp ?? initProps.modelProp ?? "value";
341
341
  const mergedProps = mergeProps(
package/es/form/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { c, _, b, a, F, d, T, e, _ as _2, h, f, u, g } from "./index-Br8U5Kva.js";
2
- import { I, a as a2, e as e2 } from "../core/index-BrBzu6aj.js";
1
+ import { c, _, b, a, F, d, T, e, _ as _2, h, f, u, g } from "./index-CdBauDf0.js";
2
+ import { I, a as a2, e as e2 } from "../core/index-BWMfavD1.js";
3
3
  export {
4
4
  c as BaseField,
5
5
  _ as BaseForm,
package/es/index.d.ts CHANGED
@@ -128,7 +128,16 @@ declare type AllowStringKey<T, Prefix extends string = ''> = {
128
128
  /**
129
129
  * @type {Object} Base - 基础公共字段类型
130
130
  */
131
- export declare interface Base<D extends Data = Data> {
131
+ export declare type Base<D extends Data = Data> = BaseWithFields<D> | BaseWithoutFields<D>;
132
+
133
+ declare interface BaseColumn<D extends Data = Data> {
134
+ key?: Path<D>;
135
+ dataIndex?: Path<D> | Path<D>[];
136
+ children?: BaseColumn<D>[];
137
+ [key: string]: any;
138
+ }
139
+
140
+ declare type BaseCommon<D extends Data = Data> = {
132
141
  /**
133
142
  * @description 字段标识namePath, 同name
134
143
  * @example 'name' | 'age' | 'sex' | ...
@@ -138,6 +147,10 @@ export declare interface Base<D extends Data = Data> {
138
147
  * @description 字段是否隐藏
139
148
  */
140
149
  hidden?: boolean;
150
+ /**
151
+ * @description 字段是否禁用
152
+ */
153
+ disabled?: boolean;
141
154
  /**
142
155
  * @description 字段中文名称,支持字符串或组件
143
156
  * @example '姓名' | '年龄' | '性别' | () => h('span', '自定义标签')
@@ -155,16 +168,6 @@ export declare interface Base<D extends Data = Data> {
155
168
  * ```
156
169
  */
157
170
  slots?: Partial<ComponentSlots<typeof FormItem>>;
158
- /**
159
- * @description 嵌套子字段配置
160
- * @example [{ key: 'firstName', label: '名' }, { key: 'lastName', label: '姓' }]
161
- */
162
- fields?: Fields<D>;
163
- /**
164
- * @description 网格布局属性,true表示使用默认网格布局,针对具有嵌套字段的字段
165
- * @example boolean | { gutter: 24 }
166
- */
167
- grid?: Grid;
168
171
  /**
169
172
  * @description 字段formItem样式属性
170
173
  * @example { marginBottom: '8px', padding: '12px' }
@@ -185,48 +188,12 @@ export declare interface Base<D extends Data = Data> {
185
188
  * @example { 'data-form-item-test': 'test-value', 'aria-label': 'name' }
186
189
  */
187
190
  formItemDataAttrs?: Record<string, string>;
188
- /**
189
- * @description 字段component样式属性
190
- * @example { width: '100%', borderColor: '#d9d9d9' }
191
- */
192
- componentStyle?: CSSProperties;
193
- /**
194
- * @description 字段component样式类名
195
- * @example 'custom-input' | 'error-input'
196
- */
197
- componentClass?: string;
198
- /**
199
- * @description 字段component容器包裹组件
200
- * @example (props, ctx) => h('div', { class: 'input-wrapper' }, ctx.slots.default?.())
201
- */
202
- componentContainer?: ContainerComponent;
203
- /**
204
- * @description 将属性附加到表单组件的 DOM 节点
205
- * @example { 'data-test': 'input-value', 'aria-label': 'name' }
206
- */
207
- componentDataAttrs?: Record<string, string>;
208
- /**
209
- * @description 字段值处理函数,在onUpdateValue前执行,函数返回值将作为更新值,也可设置get和set函数,用于处理字段值
210
- * @example (val) => val?.trim()
211
- */
212
- valueFormatter?: ValueFormatter;
213
- /**
214
- * @description 组件v-model双向绑定更新属性名,默认'value'
215
- */
216
- modelProp?: string;
217
191
  /**
218
192
  * @description 额外的自定义属性,不会被当作组件参数,仅用做给字段添加标识属性等功能
219
193
  * @example { group: 'group-1' }
220
194
  */
221
195
  extraProps?: Record<string, any>;
222
- }
223
-
224
- declare interface BaseColumn<D extends Data = Data> {
225
- key?: Path<D>;
226
- dataIndex?: Path<D> | Path<D>[];
227
- children?: BaseColumn<D>[];
228
- [key: string]: any;
229
- }
196
+ };
230
197
 
231
198
  export declare type BaseComponentMap = {
232
199
  'input': typeof Input;
@@ -293,6 +260,83 @@ export declare const BaseForm: <F extends Form<any> = Form>(__VLS_props: NonNull
293
260
 
294
261
  export declare const BaseFormItem: DefineComponent<Props_4, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props_4> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
295
262
 
263
+ declare type BaseWithFields<D extends Data = Data> = BaseCommon<D> & {
264
+ /**
265
+ * @description 嵌套子字段配置
266
+ * @example [{ key: 'firstName', label: '名' }, { key: 'lastName', label: '姓' }]
267
+ */
268
+ fields: Fields<D>;
269
+ /**
270
+ * @description 网格布局属性,true表示使用默认网格布局,针对具有嵌套字段的字段
271
+ * @example boolean | { gutter: 24 }
272
+ */
273
+ grid?: Grid;
274
+ component?: never;
275
+ /**
276
+ * @description 字段component样式属性
277
+ * @example { width: '100%', borderColor: '#d9d9d9' }
278
+ */
279
+ componentStyle?: never;
280
+ /**
281
+ * @description 字段component样式类名
282
+ * @example 'custom-input' | 'error-input'
283
+ */
284
+ componentClass?: never;
285
+ /**
286
+ * @description 字段component容器包裹组件
287
+ * @example (props, ctx) => h('div', { class: 'input-wrapper' }, ctx.slots.default?.())
288
+ */
289
+ componentContainer?: never;
290
+ /**
291
+ * @description 将属性附加到表单组件的 DOM 节点
292
+ * @example { 'data-test': 'input-value', 'aria-label': 'name' }
293
+ */
294
+ componentDataAttrs?: never;
295
+ /**
296
+ * @description 字段值处理函数,在onUpdateValue前执行,函数返回值将作为更新值,也可设置get和set函数,用于处理字段值
297
+ * @example (val) => val?.trim()
298
+ */
299
+ valueFormatter?: never;
300
+ /**
301
+ * @description 组件v-model双向绑定更新属性名,默认'value'
302
+ */
303
+ modelProp?: never;
304
+ };
305
+
306
+ declare type BaseWithoutFields<D extends Data = Data> = BaseCommon<D> & {
307
+ fields?: undefined;
308
+ grid?: never;
309
+ /**
310
+ * @description 字段component样式属性
311
+ * @example { width: '100%', borderColor: '#d9d9d9' }
312
+ */
313
+ componentStyle?: CSSProperties;
314
+ /**
315
+ * @description 字段component样式类名
316
+ * @example 'custom-input' | 'error-input'
317
+ */
318
+ componentClass?: string;
319
+ /**
320
+ * @description 字段component容器包裹组件
321
+ * @example (props, ctx) => h('div', { class: 'input-wrapper' }, ctx.slots.default?.())
322
+ */
323
+ componentContainer?: ContainerComponent;
324
+ /**
325
+ * @description 将属性附加到表单组件的 DOM 节点
326
+ * @example { 'data-test': 'input-value', 'aria-label': 'name' }
327
+ */
328
+ componentDataAttrs?: Record<string, string>;
329
+ /**
330
+ * @description 字段值处理函数,在onUpdateValue前执行,函数返回值将作为更新值,也可设置get和set函数,用于处理字段值
331
+ * @example (val) => val?.trim()
332
+ */
333
+ valueFormatter?: ValueFormatter;
334
+ /**
335
+ * @description 组件v-model双向绑定更新属性名,默认'value'
336
+ */
337
+ modelProp?: string;
338
+ };
339
+
296
340
  declare type ButtonProps = {
297
341
  onClick: () => void;
298
342
  };
@@ -474,9 +518,9 @@ declare type ExtendWithAny<D> = {
474
518
  * @description 字段配置类型,包含所有字段属性和响应式支持
475
519
  * @template D - 数据对象类型
476
520
  */
477
- export declare type Field<C extends ComponentName = ComponentName, D extends Data = Data> = FieldTypeMap<D>[C] & {
521
+ export declare type Field<C extends ComponentName = ComponentName, D extends Data = Data> = (FieldTypeMap<D>[C] & {
478
522
  component?: C extends 'custom' ? FieldTypeMap<D>[C]['component'] : C;
479
- };
523
+ }) | WithFields<D>;
480
524
 
481
525
  declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<D>> = (field: Readonly<F>) => boolean;
482
526
 
@@ -915,7 +959,9 @@ export declare type VModelProps<T = any> = {
915
959
  'onUpdate:value'?: (val: T) => void;
916
960
  };
917
961
 
918
- declare type WithCommon<T, D extends Data = Data> = WithRef<T & Omit<FormItemProps, 'label'> & ColProps & Base<D>>;
962
+ declare type WithCommon<T, D extends Data = Data> = WithRef<WithCommonBase<T> & BaseWithoutFields<D>>;
963
+
964
+ declare type WithCommonBase<T = unknown> = T & Omit<FormItemProps, 'label'> & ColProps;
919
965
 
920
966
  /**
921
967
  * @description 自动从 Vue 组件提取 Props 和 Slots,并加上公共表单字段属性
@@ -926,6 +972,8 @@ declare type WithComponent<T extends abstract new (...args: any) => any, D exten
926
972
  slots?: ComponentSlots<T>;
927
973
  } & Omit<ComponentProps<T>, keyof VNodeProps>, D>;
928
974
 
975
+ declare type WithFields<D extends Data = Data> = WithRef<WithCommonBase & BaseWithFields<D>>;
976
+
929
977
  /**
930
978
  * @description 为对象属性添加响应式支持的类型
931
979
  * @template T - 原始类型
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./antdv-next-pro.css";
2
- import { _ as _sfc_main } from "./form/index-Br8U5Kva.js";
3
- import { c, b, a, F, d, T, e, h, f, u, g } from "./form/index-Br8U5Kva.js";
4
- import { I, a as a2, e as e2 } from "./core/index-BrBzu6aj.js";
2
+ import { _ as _sfc_main } from "./form/index-CdBauDf0.js";
3
+ import { c, b, a, F, d, T, e, h, f, u, g } from "./form/index-CdBauDf0.js";
4
+ import { I, a as a2, e as e2 } from "./core/index-BWMfavD1.js";
5
5
  import BaseTable from "./table/index.js";
6
6
  import { useTable } from "./table/index.js";
7
7
  import _sfc_main$1 from "./component-provider/index.js";
package/es/table/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { createElementBlock, openBlock, createElementVNode, defineComponent, ref, computed, watch, watchEffect, createBlock, unref, mergeProps, withCtx, createVNode, renderSlot, resolveDynamicComponent, createTextVNode, createCommentVNode, Fragment, toDisplayString, normalizeStyle, useModel, h, mergeModels, inject, useAttrs, useSlots, onMounted, normalizeClass, createSlots, renderList, normalizeProps, guardReactiveProps, nextTick } from "vue";
2
2
  import { Space, Button, theme, useConfig, Dropdown, Menu, Checkbox, Table } from "antdv-next";
3
3
  import "antdv-next/dist/config-provider/DisabledContext";
4
- import { _ as _sfc_main$9, t as tableProps, a as _sfc_main$a } from "../form/index-Br8U5Kva.js";
4
+ import { _ as _sfc_main$9, t as tableProps, a as _sfc_main$a } from "../form/index-CdBauDf0.js";
5
5
  import { INJECT_CONFIG } from "../component-provider/index.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 { p as pick } from "../vendor/utils/lodash-es-p6jau26B.js";
8
8
  const _export_sfc = (sfc, props) => {
9
9
  const target = sfc.__vccOpts || sfc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antdv-next-pro",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "基于 antdv-next 的二次封装组件",
5
5
  "type": "module",
6
6
  "module": "es/index.js",