@qin-ui/antdv-next-pro 1.1.0 → 1.1.2

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.
@@ -138,6 +138,20 @@ const INJECT_CONFIG = {
138
138
  }
139
139
  };
140
140
  const INJECT_COMPONENTS = Symbol("INJECT_COMPONENTS");
141
+ const DYNAMIC_INJECT_CONFIG = /* @__PURE__ */ Object.create(null);
142
+ const getInjectConfig = (key) => {
143
+ return INJECT_CONFIG[key] || DYNAMIC_INJECT_CONFIG[key];
144
+ };
145
+ const ensureInjectConfig = (key) => {
146
+ const existing = getInjectConfig(key);
147
+ if (existing) return existing;
148
+ const created = {
149
+ injectionKey: Symbol(`dynamic:${key}`),
150
+ default: {}
151
+ };
152
+ DYNAMIC_INJECT_CONFIG[key] = created;
153
+ return created;
154
+ };
141
155
  const _sfc_main = /* @__PURE__ */ defineComponent({
142
156
  ...{
143
157
  inheritAttrs: false
@@ -151,8 +165,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
151
165
  const props = __props;
152
166
  if (props.componentVars) {
153
167
  Object.entries(props.componentVars).forEach(([key, val]) => {
154
- const config = INJECT_CONFIG[key];
155
- if (!config) return;
168
+ const config = ensureInjectConfig(key);
156
169
  provide(config.injectionKey, { ...config.default, ...getObject(val) });
157
170
  });
158
171
  }
@@ -167,5 +180,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
167
180
  export {
168
181
  INJECT_COMPONENTS,
169
182
  INJECT_CONFIG,
170
- _sfc_main as default
183
+ _sfc_main as default,
184
+ ensureInjectConfig,
185
+ getInjectConfig
171
186
  };
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, provide, computed, inject, useSlots, watchEffect, createBlock, openBlock, unref, mergeProps, withCtx, createVNode, renderSlot, toValue, normalizeProps, guardReactiveProps, resolveComponent, createElementBlock, Fragment, renderList, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, isVNode, createTextVNode, toDisplayString } from "vue";
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
- import { INJECT_CONFIG, INJECT_COMPONENTS } from "../component-provider/index.js";
4
+ import { INJECT_CONFIG, getInjectConfig, INJECT_COMPONENTS } from "../component-provider/index.js";
5
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";
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 || {};
@@ -285,13 +285,12 @@ const useForm = useForm$1;
285
285
  const getInitProps = (field) => {
286
286
  const { component } = field;
287
287
  const picker = component === "date-picker" ? "" : field.picker;
288
- if (typeof component === "string" && componentMap[component]) {
288
+ if (typeof component === "string") {
289
289
  const k = [component, picker].filter(Boolean).join(".");
290
- if (INJECT_CONFIG[k]) {
291
- const config = INJECT_CONFIG[k];
292
- const injectProps = inject(config.injectionKey, config.default);
293
- return injectProps;
294
- }
290
+ const config = getInjectConfig(k);
291
+ if (!config) return {};
292
+ const injectProps = inject(config.injectionKey, config.default);
293
+ return injectProps;
295
294
  }
296
295
  return {};
297
296
  };
package/es/form/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c, _, b, a, F, d, T, e, _ as _2, h, f, u, g } from "./index-DmAaZ_i3.js";
1
+ import { c, _, b, a, F, d, T, e, _ as _2, h, f, u, g } from "./index-CHL8J75J.js";
2
2
  import { I, a as a2, e as e2 } from "../core/index-BrBzu6aj.js";
3
3
  export {
4
4
  c as BaseField,
package/es/index.d.ts CHANGED
@@ -426,6 +426,8 @@ declare const _default_2: <T extends Table<any> = Table>(__VLS_props: NonNullabl
426
426
  __ctx?: Awaited<typeof __VLS_setup>;
427
427
  };
428
428
 
429
+ export declare const ensureInjectConfig: (key: string) => InjectConfigEntry;
430
+
429
431
  declare type Expand = {
430
432
  minExpandRows?: number;
431
433
  expandStatus?: boolean;
@@ -497,6 +499,8 @@ export declare type GetComponentType<K extends ComponentName> = K extends keyof
497
499
 
498
500
  export declare const getInitProps: (field: Field) => Record<string, any>;
499
501
 
502
+ export declare const getInjectConfig: (key: string) => InjectConfigEntry | undefined;
503
+
500
504
  export declare type Grid = boolean | (RowProps & {});
501
505
 
502
506
  export declare const INJECT_COMPONENTS: InjectionKey<Partial<Record<string, Component>>>;
@@ -508,6 +512,11 @@ export declare const INJECT_CONFIG: {
508
512
  };
509
513
  };
510
514
 
515
+ export declare type InjectConfigEntry<T = any> = {
516
+ injectionKey: InjectionKey<T>;
517
+ default: T;
518
+ };
519
+
511
520
  export declare const InjectionFormKey: InjectionKey<any>;
512
521
 
513
522
  export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
@@ -561,7 +570,7 @@ declare type PP<T extends Record<string, any>> = Partial<T & AllowedComponentPro
561
570
  export declare const ProComponentProvider: SFCWithInstall<{
562
571
  new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<{
563
572
  componentVars?: ComponentVars;
564
- componentMap?: Partial<Record<KeyExpandString<ComponentName>, Component>>;
573
+ componentMap?: Partial<Record<ComponentName, any>>;
565
574
  }> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, any, ComponentProvideOptions, {
566
575
  P: {};
567
576
  B: {};
@@ -571,14 +580,14 @@ export declare const ProComponentProvider: SFCWithInstall<{
571
580
  Defaults: {};
572
581
  }, Readonly<{
573
582
  componentVars?: ComponentVars;
574
- componentMap?: Partial<Record<KeyExpandString<ComponentName>, Component>>;
583
+ componentMap?: Partial<Record<ComponentName, any>>;
575
584
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
576
585
  __isFragment?: never;
577
586
  __isTeleport?: never;
578
587
  __isSuspense?: never;
579
588
  } & ComponentOptionsBase<Readonly<{
580
589
  componentVars?: ComponentVars;
581
- componentMap?: Partial<Record<KeyExpandString<ComponentName>, Component>>;
590
+ componentMap?: Partial<Record<ComponentName, any>>;
582
591
  }> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
583
592
  $slots: {
584
593
  default?(_: {}): any;
package/es/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "./antdv-next-pro.css";
2
- import { _ as _sfc_main } from "./form/index-DmAaZ_i3.js";
3
- import { c, b, a, F, d, T, e, h, f, u, g } from "./form/index-DmAaZ_i3.js";
2
+ import { _ as _sfc_main } from "./form/index-CHL8J75J.js";
3
+ import { c, b, a, F, d, T, e, h, f, u, g } from "./form/index-CHL8J75J.js";
4
4
  import { I, a as a2, e as e2 } from "./core/index-BrBzu6aj.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";
8
- import { INJECT_COMPONENTS, INJECT_CONFIG } from "./component-provider/index.js";
8
+ import { INJECT_COMPONENTS, INJECT_CONFIG, ensureInjectConfig, getInjectConfig } from "./component-provider/index.js";
9
9
  const withInstall = (comp) => {
10
10
  comp.install = (app) => {
11
11
  app.component(comp.name, comp);
@@ -40,7 +40,9 @@ export {
40
40
  T as TeleportComponentNamePrefix,
41
41
  e as componentMap,
42
42
  index as default,
43
+ ensureInjectConfig,
43
44
  h as getInitProps,
45
+ getInjectConfig,
44
46
  f as useFields,
45
47
  u as useForm,
46
48
  e2 as useFormData,
package/es/table/index.js CHANGED
@@ -1,7 +1,7 @@
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-DmAaZ_i3.js";
4
+ import { _ as _sfc_main$9, t as tableProps, a as _sfc_main$a } from "../form/index-CHL8J75J.js";
5
5
  import { INJECT_CONFIG } from "../component-provider/index.js";
6
6
  import { g as getObject, c as camelizeProperties, f as useTable$1 } from "../core/index-BrBzu6aj.js";
7
7
  import { p as pick } from "../vendor/utils/lodash-es-p6jau26B.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qin-ui/antdv-next-pro",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "基于 antdv-next 的二次封装组件",
5
5
  "type": "module",
6
6
  "module": "es/index.js",
@@ -32,13 +32,15 @@
32
32
  "antdv-next": "^1.1.0",
33
33
  "vue": "^3.5.0"
34
34
  },
35
+ "dependencies": {
36
+ "vue-component-type-helpers": "^3.2.5"
37
+ },
35
38
  "devDependencies": {
36
39
  "@qin-ui/core": "workspace:^",
37
40
  "@types/lodash-es": "^4.17.12",
38
41
  "antdv-next": "^1.1.0",
39
42
  "lodash-es": "^4.17.21",
40
- "vue": "^3.5.29",
41
- "vue-component-type-helpers": "^3.2.5"
43
+ "vue": "^3.5.29"
42
44
  },
43
45
  "publishConfig": {
44
46
  "access": "public",