@qin-ui/antdv-next-pro 1.1.1 → 1.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.
|
@@ -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 =
|
|
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"
|
|
288
|
+
if (typeof component === "string") {
|
|
289
289
|
const k = [component, picker].filter(Boolean).join(".");
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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
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;
|
|
@@ -457,8 +459,6 @@ declare type FieldFindBy<D extends Data, F extends BaseField_2<D> = BaseField_2<
|
|
|
457
459
|
*/
|
|
458
460
|
export declare type Fields<D extends Data = Data> = Array<Field<D>>;
|
|
459
461
|
|
|
460
|
-
declare type Fields_2<D extends Data = Data, F extends BaseField_2<D> = BaseField_2<D>> = F[];
|
|
461
|
-
|
|
462
462
|
/**
|
|
463
463
|
* @type {FieldTypeMap} 字段类型集合
|
|
464
464
|
*/
|
|
@@ -497,6 +497,8 @@ export declare type GetComponentType<K extends ComponentName> = K extends keyof
|
|
|
497
497
|
|
|
498
498
|
export declare const getInitProps: (field: Field) => Record<string, any>;
|
|
499
499
|
|
|
500
|
+
export declare const getInjectConfig: (key: string) => InjectConfigEntry | undefined;
|
|
501
|
+
|
|
500
502
|
export declare type Grid = boolean | (RowProps & {});
|
|
501
503
|
|
|
502
504
|
export declare const INJECT_COMPONENTS: InjectionKey<Partial<Record<string, Component>>>;
|
|
@@ -508,6 +510,11 @@ export declare const INJECT_CONFIG: {
|
|
|
508
510
|
};
|
|
509
511
|
};
|
|
510
512
|
|
|
513
|
+
export declare type InjectConfigEntry<T = any> = {
|
|
514
|
+
injectionKey: InjectionKey<T>;
|
|
515
|
+
default: T;
|
|
516
|
+
};
|
|
517
|
+
|
|
511
518
|
export declare const InjectionFormKey: InjectionKey<any>;
|
|
512
519
|
|
|
513
520
|
export declare const InjectionPathKey: InjectionKey<ComputedRef<string | undefined>>;
|
|
@@ -561,7 +568,7 @@ declare type PP<T extends Record<string, any>> = Partial<T & AllowedComponentPro
|
|
|
561
568
|
export declare const ProComponentProvider: SFCWithInstall<{
|
|
562
569
|
new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
563
570
|
componentVars?: ComponentVars;
|
|
564
|
-
componentMap?: Partial<Record<
|
|
571
|
+
componentMap?: Partial<Record<ComponentName, any>>;
|
|
565
572
|
}> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, PublicProps, {}, false, {}, {}, GlobalComponents, GlobalDirectives, string, {}, any, ComponentProvideOptions, {
|
|
566
573
|
P: {};
|
|
567
574
|
B: {};
|
|
@@ -571,14 +578,14 @@ export declare const ProComponentProvider: SFCWithInstall<{
|
|
|
571
578
|
Defaults: {};
|
|
572
579
|
}, Readonly<{
|
|
573
580
|
componentVars?: ComponentVars;
|
|
574
|
-
componentMap?: Partial<Record<
|
|
581
|
+
componentMap?: Partial<Record<ComponentName, any>>;
|
|
575
582
|
}> & Readonly<{}>, {}, {}, {}, {}, {}>;
|
|
576
583
|
__isFragment?: never;
|
|
577
584
|
__isTeleport?: never;
|
|
578
585
|
__isSuspense?: never;
|
|
579
586
|
} & ComponentOptionsBase<Readonly<{
|
|
580
587
|
componentVars?: ComponentVars;
|
|
581
|
-
componentMap?: Partial<Record<
|
|
588
|
+
componentMap?: Partial<Record<ComponentName, any>>;
|
|
582
589
|
}> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
|
|
583
590
|
$slots: {
|
|
584
591
|
default?(_: {}): any;
|
|
@@ -866,7 +873,7 @@ export declare const useTable: <D extends Data = Data, T extends object = Extend
|
|
|
866
873
|
dataSource?: T[];
|
|
867
874
|
pageParam?: PageParam;
|
|
868
875
|
searchParam?: ExtendWithAny<DeepPartial<D>>;
|
|
869
|
-
searchFields?:
|
|
876
|
+
searchFields?: Fields<D>;
|
|
870
877
|
}) => Table<D, T>;
|
|
871
878
|
|
|
872
879
|
export declare type ValueFormatter = {
|
package/es/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./antdv-next-pro.css";
|
|
2
|
-
import { _ as _sfc_main } from "./form/index-
|
|
3
|
-
import { c, b, a, F, d, T, e, h, f, u, g } from "./form/index-
|
|
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-
|
|
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";
|