@qin-ui/antd-vue-pro 2.1.1 → 2.1.3

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.
@@ -126,6 +126,20 @@ const INJECT_CONFIG = {
126
126
  default: {}
127
127
  }
128
128
  };
129
+ const DYNAMIC_INJECT_CONFIG = /* @__PURE__ */ Object.create(null);
130
+ const getInjectConfig = (key) => {
131
+ return INJECT_CONFIG[key] || DYNAMIC_INJECT_CONFIG[key];
132
+ };
133
+ const ensureInjectConfig = (key) => {
134
+ const existing = getInjectConfig(key);
135
+ if (existing) return existing;
136
+ const created = {
137
+ injectionKey: Symbol(`dynamic:${key}`),
138
+ default: {}
139
+ };
140
+ DYNAMIC_INJECT_CONFIG[key] = created;
141
+ return created;
142
+ };
129
143
  const _sfc_main = /* @__PURE__ */ defineComponent({
130
144
  ...{
131
145
  inheritAttrs: false
@@ -142,8 +156,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
142
156
  }
143
157
  if (props.componentVars) {
144
158
  Object.entries(props.componentVars).forEach(([key, val]) => {
145
- const config = INJECT_CONFIG[key];
146
- if (!config) return;
159
+ const config = ensureInjectConfig(key);
147
160
  provide(config.injectionKey, { ...config.default, ...getObject(val) });
148
161
  });
149
162
  }
@@ -155,5 +168,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
155
168
  export {
156
169
  INJECT_COMPONENTS,
157
170
  INJECT_CONFIG,
158
- _sfc_main as default
171
+ _sfc_main as default,
172
+ ensureInjectConfig,
173
+ getInjectConfig
159
174
  };
package/es/form/index.js CHANGED
@@ -5,7 +5,7 @@ import { useProviderDisabled, useInjectDisabled } from "ant-design-vue/es/config
5
5
  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
- import { INJECT_CONFIG, INJECT_COMPONENTS } from "../component-provider/index.js";
8
+ import { INJECT_CONFIG, getInjectConfig, INJECT_COMPONENTS } from "../component-provider/index.js";
9
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
10
  import { e } from "../core/index-BrBzu6aj.js";
11
11
  import { i as isPlainObject, t as toPath, o as omit, c as cloneDeep } from "../vendor/utils/lodash-es-p6jau26B.js";
@@ -288,13 +288,12 @@ const useForm = useForm$1;
288
288
  const getInitProps = (field) => {
289
289
  const { component } = field;
290
290
  const picker = component === "date-picker" ? "" : field.picker;
291
- if (typeof component === "string" && component in componentMap) {
291
+ if (typeof component === "string") {
292
292
  const k = [component, picker].filter(Boolean).join(".");
293
- if (INJECT_CONFIG[k]) {
294
- const config = INJECT_CONFIG[k];
295
- const injectProps = inject(config.injectionKey, config.default);
296
- return injectProps;
297
- }
293
+ const config = getInjectConfig(k);
294
+ if (!config) return {};
295
+ const injectProps = inject(config.injectionKey, config.default);
296
+ return injectProps;
298
297
  }
299
298
  return {};
300
299
  };
package/es/index.d.ts CHANGED
@@ -401,6 +401,8 @@ declare const _default_2: <T extends Table<any> = Table>(__VLS_props: NonNullabl
401
401
  __ctx?: Awaited<typeof __VLS_setup>;
402
402
  };
403
403
 
404
+ export declare const ensureInjectConfig: (key: string) => InjectConfigEntry;
405
+
404
406
  declare type Expand = {
405
407
  minExpandRows?: number;
406
408
  expandStatus?: boolean;
@@ -432,8 +434,6 @@ declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<
432
434
  */
433
435
  export declare type Fields<D extends Data = Data> = Array<Field<D>>;
434
436
 
435
- declare type Fields_2<D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>> = F[];
436
-
437
437
  /**
438
438
  * @type {FieldTypeMap} 字段类型集合
439
439
  */
@@ -474,6 +474,8 @@ export declare type GetComponentType<K extends ComponentName> = K extends keyof
474
474
 
475
475
  export declare const getInitProps: (field: Field) => Record<string, any>;
476
476
 
477
+ export declare const getInjectConfig: (key: string) => InjectConfigEntry | undefined;
478
+
477
479
  export declare type Grid = boolean | (RowProps & {});
478
480
 
479
481
  export declare const INJECT_COMPONENTS: InjectionKey<Partial<Record<string, Component>>>;
@@ -485,6 +487,11 @@ export declare const INJECT_CONFIG: {
485
487
  };
486
488
  };
487
489
 
490
+ export declare type InjectConfigEntry<T = any> = {
491
+ injectionKey: InjectionKey<T>;
492
+ default: T;
493
+ };
494
+
488
495
  export declare const InjectionFormKey: InjectionKey<any>;
489
496
 
490
497
  export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
@@ -538,7 +545,7 @@ declare type PP<T extends Record<string, any>> = Partial<T & AllowedComponentPro
538
545
  export declare const ProComponentProvider: SFCWithInstall<{
539
546
  new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<{
540
547
  componentVars?: ComponentVars;
541
- componentMap?: Partial<Record<KeyExpandString<ComponentName>, Component>>;
548
+ componentMap?: Partial<Record<ComponentName, any>>;
542
549
  }> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, any, ComponentProvideOptions, {
543
550
  P: {};
544
551
  B: {};
@@ -548,14 +555,14 @@ export declare const ProComponentProvider: SFCWithInstall<{
548
555
  Defaults: {};
549
556
  }, Readonly<{
550
557
  componentVars?: ComponentVars;
551
- componentMap?: Partial<Record<KeyExpandString<ComponentName>, Component>>;
558
+ componentMap?: Partial<Record<ComponentName, any>>;
552
559
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
553
560
  __isFragment?: never;
554
561
  __isTeleport?: never;
555
562
  __isSuspense?: never;
556
563
  } & ComponentOptionsBase<Readonly<{
557
564
  componentVars?: ComponentVars;
558
- componentMap?: Partial<Record<KeyExpandString<ComponentName>, Component>>;
565
+ componentMap?: Partial<Record<ComponentName, any>>;
559
566
  }> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
560
567
  $slots: {
561
568
  default?(_: {}): any;
@@ -903,7 +910,7 @@ export declare const useTable: <D extends Data = Data, T extends object = Extend
903
910
  dataSource?: T[];
904
911
  pageParam?: PageParam;
905
912
  searchParam?: ExtendWithAny<DeepPartial<D>>;
906
- searchFields?: Fields_2<D>;
913
+ searchFields?: Fields<D>;
907
914
  }) => Table<D, T>;
908
915
 
909
916
  export declare type ValueFormatter = {
package/es/index.js CHANGED
@@ -4,7 +4,7 @@ import { BaseField, BaseFormItem, ContainerFragment, FORM_ITEM_SLOT_KEYS, SlotCo
4
4
  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
- import { INJECT_COMPONENTS, INJECT_CONFIG } from "./component-provider/index.js";
7
+ import { INJECT_COMPONENTS, INJECT_CONFIG, ensureInjectConfig, getInjectConfig } from "./component-provider/index.js";
8
8
  import { I, a, e } from "./core/index-BrBzu6aj.js";
9
9
  const withInstall = (comp) => {
10
10
  comp.install = (app) => {
@@ -40,7 +40,9 @@ export {
40
40
  TeleportComponentNamePrefix,
41
41
  componentMap,
42
42
  index as default,
43
+ ensureInjectConfig,
43
44
  getInitProps,
45
+ getInjectConfig,
44
46
  useFields,
45
47
  useForm,
46
48
  e as useFormData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antd-vue-pro",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "二次封装antd vue组件",
5
5
  "type": "module",
6
6
  "module": "es/index.js",