@qin-ui/antd-vue-pro 2.3.3 → 2.3.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/api.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-08-19T03:08:37.658Z",
2
+ "generatedAt": "2026-08-20T09:57:07.045Z",
3
3
  "name": "@qin-ui/antd-vue-pro",
4
4
  "api": [
5
5
  {
@@ -1 +1 @@
1
- {"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/BaseFormItem/index.vue"],"names":[],"mappings":"AAyMA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAQhD,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;AA0QF,wBAMG"}
1
+ {"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/components/BaseFormItem/index.vue"],"names":[],"mappings":"AAsLA,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAOhD,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;AAmOF,wBAMG"}
@@ -69,5 +69,5 @@ export type GetComponentType<K extends ComponentName> = K extends keyof Componen
69
69
  * 组件名称到 Ant Design Vue 组件的映射
70
70
  */
71
71
  export declare const componentMap: BaseComponentMap;
72
- export { InjectionFormKey, InjectionPathKey, InjectionFormSlotsKey, } from '../../../shared/core';
72
+ export { InjectionFormKey, InjectionFormSlotsKey } from '../../../shared/core';
73
73
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d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AAM,YAAY,GACxB,YAAY,CAAC,CAAC,CAAC,GACf,CAAC,SAAS,MAAM,gBAAgB,GAC9B,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;AAEd;;GAEG;AAEH,eAAO,MAAM,YAAY,EAAE,gBAiB1B,CAAA;AAGD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,aAAa,EACb,UAAU,EACV,KAAK,EACL,WAAW,EACX,aAAa,EACb,WAAW,EACX,UAAU,EACV,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gDAKtB,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,YAAY;CAAG;AAEhC;;;GAGG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,KAAK,CAAC;IACtB,UAAU,EAAE,OAAO,QAAQ,CAAC;IAC5B,cAAc,EAAE,OAAO,WAAW,CAAC;IACnC,gBAAgB,EAAE,OAAO,aAAa,CAAC;IACvC,cAAc,EAAE,OAAO,WAAW,CAAC;IACnC,QAAQ,EAAE,OAAO,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,QAAQ,CAAC;IAC5B,aAAa,EAAE,OAAO,UAAU,CAAC;IACjC,cAAc,EAAE,OAAO,WAAW,CAAC;IACnC,aAAa,EAAE,OAAO,UAAU,CAAC;IACjC,gBAAgB,EAAE,OAAO,aAAa,CAAC;IACvC,aAAa,EAAE,OAAO,UAAU,CAAC;IACjC,QAAQ,EAAE,OAAO,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,MAAM,CAAC;IACxB,aAAa,EAAE,OAAO,UAAU,CAAC;IACjC,UAAU,EAAE,OAAO,QAAQ,CAAC;CAC7B,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,aAAa,GACrB,MAAM,gBAAgB,GACtB,MAAM,YAAY,GAClB,QAAQ,CAAC;AAEb;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,aAAa,IAClD,CAAC,SAAS,MAAM,YAAY,GACxB,YAAY,CAAC,CAAC,CAAC,GACf,CAAC,SAAS,MAAM,gBAAgB,GAC9B,gBAAgB,CAAC,CAAC,CAAC,GACnB,KAAK,CAAC;AAEd;;GAEG;AAEH,eAAO,MAAM,YAAY,EAAE,gBAiB1B,CAAA;AAGD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { FormItemProps, GridItemProps } from '../../../shared/ui';
3
+ import { FORM_ITEM_SLOT_KEYS } from '../constants';
4
+ import { Base, Field } from '../types';
5
+ export interface GroupedField {
6
+ path: string;
7
+ gridItemProps: GridItemProps;
8
+ formItemProps: FormItemProps;
9
+ formItemSlots: Record<(typeof FORM_ITEM_SLOT_KEYS)[number], any>;
10
+ componentProps: Record<string, any>;
11
+ formItemContainer?: Base['formItemContainer'];
12
+ rawField: Field;
13
+ }
14
+ /**
15
+ * 将 fields 配置数组逐个拆分为 grid / formItem / component / slots 分组。
16
+ */
17
+ export declare function useGroupFieldAttrs(validFields: ComputedRef<Field[]>): ComputedRef<GroupedField[]>;
18
+ //# sourceMappingURL=useGroupFieldAttrs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGroupFieldAttrs.d.ts","sourceRoot":"","sources":["../../../../src/components/form/hooks/useGroupFieldAttrs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAC9E,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAO5C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC;IACjE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,iBAAiB,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC9C,QAAQ,EAAE,KAAK,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,+BAyFnE"}
package/es/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import "./antd-vue-pro.css";
2
- import { defineComponent, computed, provide, renderSlot, inject, mergeProps, toValue, normalizeProps, guardReactiveProps, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString, useSlots, reactive, createElementVNode, onBeforeUnmount, watch, watchEffect, normalizeStyle, nextTick, useModel, onMounted, mergeModels, normalizeClass } from "vue";
3
- import { InjectionPathKey, isPlainObject, getObject, toPath, useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, omit, InjectionFormSlotsKey, cloneDeep, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, pick, useTable as useTable$1 } from "@qin-ui/pro-components-core";
4
- import { enUS as enUS2, useFormData, zhCN as zhCN2, zhTW as zhTW2 } from "@qin-ui/pro-components-core";
2
+ import { inject, computed, mergeProps, toValue, defineComponent, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, renderSlot, normalizeProps, isVNode, createTextVNode, toDisplayString, provide, useSlots, reactive, createElementVNode, onBeforeUnmount, watch, watchEffect, normalizeStyle, nextTick, useModel, onMounted, mergeModels, normalizeClass, guardReactiveProps } from "vue";
5
3
  import { Transfer, TreeSelect, Slider, Switch, RadioGroup, CheckboxGroup, TimePicker, RangePicker, DatePicker, Cascader, Select, InputNumber, InputPassword, InputSearch, Textarea, Input, Row, Col, FormItem, Form, Space, Button, theme, Dropdown, Menu, MenuItem, Checkbox, MenuDivider, Table } from "ant-design-vue";
6
- import { formItemProps, useInjectFormItemContext } from "ant-design-vue/es/form";
4
+ import { isPlainObject, getObject, toPath, useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, omit, InjectionFormSlotsKey, cloneDeep, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, pick, useTable as useTable$1 } from "@qin-ui/pro-components-core";
5
+ import { enUS as enUS2, useFormData, zhCN as zhCN2, zhTW as zhTW2 } from "@qin-ui/pro-components-core";
7
6
  import { colProps } from "ant-design-vue/es/grid/Col";
7
+ import { formItemProps, useInjectFormItemContext } from "ant-design-vue/es/form";
8
8
  import { useConfigContextInject } from "ant-design-vue/es/config-provider/context";
9
9
  import { useProviderDisabled, useInjectDisabled } from "ant-design-vue/es/config-provider/DisabledContext";
10
10
  import { tableProps } from "ant-design-vue/es/table";
@@ -169,42 +169,21 @@ const componentMap = {
169
169
  "tree-select": TreeSelect,
170
170
  "transfer": Transfer
171
171
  };
172
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
173
- __name: "index",
174
- props: {
175
- path: {}
176
- },
177
- setup(__props) {
178
- const props = __props;
179
- const namePath = computed(() => {
180
- return Array.isArray(props.path) ? props.path.join(".") : props.path;
181
- });
182
- provide(InjectionPathKey, namePath);
183
- return (_ctx, _cache) => {
184
- return renderSlot(_ctx.$slots, "default", { path: namePath.value });
185
- };
186
- }
187
- });
188
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
189
- __name: "index",
190
- props: {
191
- field: {}
192
- },
193
- setup(__props) {
194
- const formItemPropKeys = Object.keys(formItemProps()).concat([
195
- "formItemContainer"
196
- ]);
197
- const gridItemPropKeys = Object.keys(colProps());
198
- const props = __props;
199
- const config = INJECT_CONFIG["pro-form-item"];
200
- const injectFormItemProps = inject(config.injectionKey, config.default);
201
- const groupedAttributes = computed(() => {
172
+ const formItemPropKeys = Object.keys(formItemProps()).concat([
173
+ "formItemContainer"
174
+ ]);
175
+ const gridItemPropKeys = Object.keys(colProps());
176
+ function useGroupFieldAttrs(validFields) {
177
+ const config = INJECT_CONFIG["pro-form-item"];
178
+ const injectFormItemProps = inject(config.injectionKey, config.default);
179
+ return computed(() => {
180
+ return validFields.value.map((field) => {
202
181
  let gridItemProps2 = {};
203
182
  let formItemProps2 = {};
204
183
  const componentProps = { slots: {} };
205
184
  const formItemSlots = {};
206
- if (isPlainObject(props.field)) {
207
- const { path, name, fields, formItemClass, formItemStyle, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, ...rest } = props.field;
185
+ if (isPlainObject(field)) {
186
+ const { path, name, fields, formItemClass, formItemStyle, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, formItemContainer, ...rest } = field;
208
187
  const {
209
188
  class: injectClassName,
210
189
  style: injectStyle,
@@ -239,17 +218,32 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
239
218
  if (FORM_ITEM_SLOT_KEYS.includes(k)) {
240
219
  formItemSlots[k] = slots[k];
241
220
  } else {
242
- componentProps["slots"][k] = slots[k];
221
+ componentProps.slots[k] = slots[k];
243
222
  }
244
223
  });
224
+ const raw2 = toValue(name) ?? toValue(path);
225
+ return {
226
+ path: Array.isArray(raw2) ? raw2.join(".") : raw2 || "",
227
+ gridItemProps: gridItemProps2,
228
+ formItemProps: formItemProps2,
229
+ formItemSlots,
230
+ componentProps,
231
+ formItemContainer,
232
+ rawField: field
233
+ };
245
234
  }
246
- return { gridItemProps: gridItemProps2, formItemProps: formItemProps2, componentProps, formItemSlots };
235
+ const raw = toValue(field == null ? void 0 : field.name) ?? toValue(field == null ? void 0 : field.path);
236
+ return {
237
+ path: Array.isArray(raw) ? raw.join(".") : raw || "",
238
+ gridItemProps: gridItemProps2,
239
+ formItemProps: formItemProps2,
240
+ formItemSlots,
241
+ componentProps,
242
+ rawField: field
243
+ };
247
244
  });
248
- return (_ctx, _cache) => {
249
- return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(groupedAttributes.value)));
250
- };
251
- }
252
- });
245
+ });
246
+ }
253
247
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
254
248
  ...{ name: "BaseFormItem", inheritAttrs: false },
255
249
  __name: "index",
@@ -295,81 +289,66 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
295
289
  }
296
290
  });
297
291
  };
292
+ const groupedFields = useGroupFieldAttrs(validFields);
298
293
  return (_ctx, _cache) => {
299
294
  const _component_BaseFormItem = resolveComponent("BaseFormItem");
300
295
  return openBlock(), createBlock(unref(_sfc_main$c), mergeProps({
301
296
  component: enableGrid.value ? unref(Row) : void 0
302
297
  }, computedGridProps.value), {
303
298
  default: withCtx(() => [
304
- (openBlock(true), createElementBlock(Fragment, null, renderList(validFields.value, ({ path: _path, name: _name, ...field }, index2) => {
305
- return openBlock(), createBlock(_sfc_main$g, mergeProps({
306
- key: unref(toPath)(toValue(_name ?? _path)).join(".") || index2
307
- }, { ref_for: true }, { path: _name ?? _path }), {
308
- default: withCtx(({ path }) => [
309
- createVNode(_sfc_main$f, { field }, {
310
- default: withCtx(({
311
- gridItemProps,
312
- formItemProps: { formItemContainer, ...formItemProps2 },
313
- componentProps,
314
- formItemSlots
315
- }) => [
316
- createVNode(unref(_sfc_main$c), mergeProps({
317
- component: enableGrid.value ? unref(Col) : void 0
318
- }, { ref_for: true }, gridItemProps), {
299
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(groupedFields), (item, index2) => {
300
+ return openBlock(), createBlock(unref(_sfc_main$c), mergeProps({
301
+ key: item.path || index2,
302
+ component: enableGrid.value ? unref(Col) : void 0
303
+ }, { ref_for: true }, item.gridItemProps), {
304
+ default: withCtx(() => [
305
+ createVNode(unref(_sfc_main$c), {
306
+ component: item.formItemContainer,
307
+ path: item.path
308
+ }, {
309
+ default: withCtx(() => [
310
+ createVNode(unref(FormItem), mergeProps({ ref_for: true }, item.formItemProps, {
311
+ ref_for: true,
312
+ ref: (el) => formItemRefs[index2] = el,
313
+ name: unref(toPath)(item.path),
314
+ path: item.path,
315
+ onVnodeMounted: ($event) => onFormItemMounted(index2, item.formItemProps)
316
+ }), createSlots({
319
317
  default: withCtx(() => [
320
- createVNode(unref(_sfc_main$c), {
321
- component: formItemContainer,
322
- path
323
- }, {
324
- default: withCtx(() => [
325
- createVNode(unref(FormItem), mergeProps({ ref_for: true }, formItemProps2, {
326
- ref_for: true,
327
- ref: (el) => formItemRefs[index2] = el,
328
- name: unref(toPath)(path),
329
- path,
330
- onVnodeMounted: ($event) => onFormItemMounted(index2, formItemProps2)
331
- }), createSlots({
332
- default: withCtx(() => [
333
- field.fields ? (openBlock(), createBlock(_component_BaseFormItem, {
334
- key: 0,
335
- grid: field.grid ?? __props.grid,
336
- fields: field.fields,
337
- disabled: toValue(field.disabled)
338
- }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
339
- key: 1,
340
- ref_for: true,
341
- ref: (el) => componentRefs[index2] = el
342
- }, { ref_for: true }, componentProps, {
343
- path,
344
- onVnodeMounted: ($event) => onComponentMounted(index2)
345
- }), null, 16, ["path", "onVnodeMounted"]))
346
- ]),
347
- _: 2
348
- }, [
349
- renderList(formItemSlots, (slot, name) => {
350
- return {
351
- name,
352
- fn: withCtx((scoped) => [
353
- createVNode(unref(_sfc_main$b), mergeProps({
354
- path,
355
- component: slot
356
- }, { ref_for: true }, scoped), null, 16, ["path", "component"])
357
- ])
358
- };
359
- })
360
- ]), 1040, ["name", "path", "onVnodeMounted"])
361
- ]),
362
- _: 2
363
- }, 1032, ["component", "path"])
318
+ item.rawField.fields ? (openBlock(), createBlock(_component_BaseFormItem, {
319
+ key: 0,
320
+ grid: item.rawField.grid ?? __props.grid,
321
+ fields: item.rawField.fields,
322
+ disabled: toValue(item.rawField.disabled)
323
+ }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
324
+ key: 1,
325
+ ref_for: true,
326
+ ref: (el) => componentRefs[index2] = el
327
+ }, { ref_for: true }, item.componentProps, {
328
+ path: item.path,
329
+ onVnodeMounted: ($event) => onComponentMounted(index2)
330
+ }), null, 16, ["path", "onVnodeMounted"]))
364
331
  ]),
365
332
  _: 2
366
- }, 1040, ["component"])
333
+ }, [
334
+ renderList(item.formItemSlots, (slot, name) => {
335
+ return {
336
+ name,
337
+ fn: withCtx((scoped) => [
338
+ createVNode(unref(_sfc_main$b), mergeProps({
339
+ path: item.path,
340
+ component: slot
341
+ }, { ref_for: true }, scoped), null, 16, ["path", "component"])
342
+ ])
343
+ };
344
+ })
345
+ ]), 1040, ["name", "path", "onVnodeMounted"])
367
346
  ]),
368
347
  _: 2
369
- }, 1032, ["field"])
348
+ }, 1032, ["component", "path"])
370
349
  ]),
371
350
  _: 2
372
- }, 1040);
351
+ }, 1040, ["component"]);
373
352
  }), 128))
374
353
  ]),
375
354
  _: 1