@qin-ui/antd-vue-pro 2.0.8 → 2.0.9

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/es/form/index.js CHANGED
@@ -15,7 +15,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
15
15
  },
16
16
  setup(__props) {
17
17
  const props = __props;
18
- provide(FORM, props.form);
18
+ provide(InjectionFormKey, props.form);
19
19
  const { formData, fields, setFormRef } = props.form;
20
20
  const config = INJECT_CONFIG["pro-form"];
21
21
  const { grid: _injectGrid, ...injectAttrs } = inject(
@@ -69,8 +69,8 @@ const COMPONENT_MAP = /* @__PURE__ */ new Map([
69
69
  ["transfer", Transfer]
70
70
  ]);
71
71
  const TeleportComponentNamePrefix = "TeleportComponent_";
72
- const FORM = Symbol("form");
73
- const PATH = Symbol("path");
72
+ const InjectionFormKey = Symbol("form");
73
+ const InjectionPathKey = Symbol("path");
74
74
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
75
75
  __name: "index",
76
76
  props: {
@@ -81,7 +81,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
81
81
  const namePath = computed(() => {
82
82
  return Array.isArray(props.path) ? props.path.join(".") : props.path;
83
83
  });
84
- provide(PATH, namePath);
84
+ provide(InjectionPathKey, namePath);
85
85
  return (_ctx, _cache) => {
86
86
  return renderSlot(_ctx.$slots, "default", { path: namePath.value });
87
87
  };
@@ -424,8 +424,13 @@ const useFields = (initFields) => {
424
424
  getParentField
425
425
  };
426
426
  };
427
- const useFormData = (initFormData = {}) => {
428
- const formData = reactive(initFormData);
427
+ const InjectionFormDataKey = Symbol("form-data");
428
+ const useFormData = (initFormData) => {
429
+ if (!initFormData) {
430
+ const injectFormDataStore = inject(InjectionFormDataKey, void 0);
431
+ if (injectFormDataStore) return injectFormDataStore;
432
+ }
433
+ const formData = reactive(initFormData ?? {});
429
434
  function getFormData(path) {
430
435
  if (!path) return void 0;
431
436
  return get(formData, path);
@@ -457,7 +462,9 @@ const useFormData = (initFormData = {}) => {
457
462
  Object.assign(formData, value);
458
463
  }
459
464
  }
460
- return { formData, getFormData, setFormData };
465
+ const formDataStore = { formData, getFormData, setFormData };
466
+ provide(InjectionFormDataKey, formDataStore);
467
+ return formDataStore;
461
468
  };
462
469
  const useFormRef = () => {
463
470
  const formRef = ref();
@@ -476,7 +483,7 @@ function useForm(...args) {
476
483
  root = args[2] ?? root;
477
484
  }
478
485
  if (!root) {
479
- const injectForm = inject(FORM);
486
+ const injectForm = inject(InjectionFormKey);
480
487
  if (injectForm) return injectForm;
481
488
  }
482
489
  return {
@@ -637,9 +644,9 @@ export {
637
644
  _sfc_main$3 as BaseFormItem,
638
645
  COMPONENT_MAP,
639
646
  _sfc_main$1 as ContainerFragment,
640
- FORM,
641
647
  FORM_ITEM_SLOT_KEYS,
642
- PATH,
648
+ InjectionFormKey,
649
+ InjectionPathKey,
643
650
  _sfc_main as SlotComponent,
644
651
  TeleportComponentNamePrefix,
645
652
  _sfc_main$6 as default,
package/es/index.d.ts CHANGED
@@ -455,8 +455,6 @@ declare type FindBy<D extends Data> = (field: Readonly<Field<D>>) => boolean;
455
455
 
456
456
  declare type FindBy_2<D extends Data> = (column: Readonly<Column<D>>) => boolean;
457
457
 
458
- export declare const FORM: InjectionKey<Form>;
459
-
460
458
  export declare type Form<D extends Data = Data> = ReturnType<typeof useFormData<D>> & ReturnType<typeof useFields<D>> & ReturnType<typeof useFormRef>;
461
459
 
462
460
  export declare const FORM_ITEM_SLOT_KEYS: readonly ["label", "extra", "help", "tooltip"];
@@ -480,6 +478,10 @@ export declare const INJECT_CONFIG: {
480
478
  };
481
479
  };
482
480
 
481
+ export declare const InjectionFormKey: InjectionKey<Form>;
482
+
483
+ export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
484
+
483
485
  declare type InputNumberSlots = CompSlot<'addonAfter' | 'addonBefore' | 'prefix' | 'upIcon' | 'downIcon'>;
484
486
 
485
487
  declare type InputSlots = CompSlot<'addonAfter' | 'addonBefore' | 'clearIcon' | 'prefix' | 'suffix'>;
@@ -515,8 +517,6 @@ declare type PageParam = Required<Pick<PaginationProps, (typeof pageParamPropert
515
517
 
516
518
  declare const pageParamProperty: readonly ["current", "pageSize", "total"];
517
519
 
518
- export declare const PATH: InjectionKey<ComputedRef<string | undefined>>;
519
-
520
520
  declare type Path<D extends Data = Data> = KeyPathString<D>;
521
521
 
522
522
  export declare type PathProps = {
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./antd-vue-pro.css";
2
2
  import _sfc_main from "./form/index.js";
3
- import { BaseField, BaseFormItem, COMPONENT_MAP, ContainerFragment, FORM, FORM_ITEM_SLOT_KEYS, PATH, SlotComponent, TeleportComponentNamePrefix, useFields, useForm, useFormData } from "./form/index.js";
3
+ import { BaseField, BaseFormItem, COMPONENT_MAP, ContainerFragment, FORM_ITEM_SLOT_KEYS, InjectionFormKey, InjectionPathKey, SlotComponent, TeleportComponentNamePrefix, useFields, useForm, useFormData } from "./form/index.js";
4
4
  import BaseTable from "./table/index.js";
5
5
  import { useTable } from "./table/index.js";
6
6
  import { _ as _sfc_main$1 } from "./component-provider/index-DXPHmG1H.js";
@@ -28,10 +28,10 @@ export {
28
28
  BaseFormItem,
29
29
  COMPONENT_MAP,
30
30
  ContainerFragment,
31
- FORM,
32
31
  FORM_ITEM_SLOT_KEYS,
33
32
  I as INJECT_CONFIG,
34
- PATH,
33
+ InjectionFormKey,
34
+ InjectionPathKey,
35
35
  ProComponentProvider,
36
36
  ProForm,
37
37
  ProTable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antd-vue-pro",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "二次封装antd vue组件",
5
5
  "type": "module",
6
6
  "module": "es/index.js",