@qin-ui/antd-vue-pro 2.1.1 → 2.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.
- package/es/component-provider/index.js +18 -3
- package/es/form/index.js +6 -7
- package/es/index.d.ts +12 -3
- package/es/index.js +3 -1
- package/package.json +1 -1
|
@@ -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 =
|
|
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"
|
|
291
|
+
if (typeof component === "string") {
|
|
292
292
|
const k = [component, picker].filter(Boolean).join(".");
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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;
|
|
@@ -474,6 +476,8 @@ export declare type GetComponentType<K extends ComponentName> = K extends keyof
|
|
|
474
476
|
|
|
475
477
|
export declare const getInitProps: (field: Field) => Record<string, any>;
|
|
476
478
|
|
|
479
|
+
export declare const getInjectConfig: (key: string) => InjectConfigEntry | undefined;
|
|
480
|
+
|
|
477
481
|
export declare type Grid = boolean | (RowProps & {});
|
|
478
482
|
|
|
479
483
|
export declare const INJECT_COMPONENTS: InjectionKey<Partial<Record<string, Component>>>;
|
|
@@ -485,6 +489,11 @@ export declare const INJECT_CONFIG: {
|
|
|
485
489
|
};
|
|
486
490
|
};
|
|
487
491
|
|
|
492
|
+
export declare type InjectConfigEntry<T = any> = {
|
|
493
|
+
injectionKey: InjectionKey<T>;
|
|
494
|
+
default: T;
|
|
495
|
+
};
|
|
496
|
+
|
|
488
497
|
export declare const InjectionFormKey: InjectionKey<any>;
|
|
489
498
|
|
|
490
499
|
export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
|
|
@@ -538,7 +547,7 @@ declare type PP<T extends Record<string, any>> = Partial<T & AllowedComponentPro
|
|
|
538
547
|
export declare const ProComponentProvider: SFCWithInstall<{
|
|
539
548
|
new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
540
549
|
componentVars?: ComponentVars;
|
|
541
|
-
componentMap?: Partial<Record<
|
|
550
|
+
componentMap?: Partial<Record<ComponentName, any>>;
|
|
542
551
|
}> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, any, ComponentProvideOptions, {
|
|
543
552
|
P: {};
|
|
544
553
|
B: {};
|
|
@@ -548,14 +557,14 @@ export declare const ProComponentProvider: SFCWithInstall<{
|
|
|
548
557
|
Defaults: {};
|
|
549
558
|
}, Readonly<{
|
|
550
559
|
componentVars?: ComponentVars;
|
|
551
|
-
componentMap?: Partial<Record<
|
|
560
|
+
componentMap?: Partial<Record<ComponentName, any>>;
|
|
552
561
|
}> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
553
562
|
__isFragment?: never;
|
|
554
563
|
__isTeleport?: never;
|
|
555
564
|
__isSuspense?: never;
|
|
556
565
|
} & ComponentOptionsBase<Readonly<{
|
|
557
566
|
componentVars?: ComponentVars;
|
|
558
|
-
componentMap?: Partial<Record<
|
|
567
|
+
componentMap?: Partial<Record<ComponentName, any>>;
|
|
559
568
|
}> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
|
|
560
569
|
$slots: {
|
|
561
570
|
default?(_: {}): any;
|
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,
|