@qin-ui/antd-vue-pro 1.0.13 → 1.0.15
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/LICENSE +9 -0
- package/es/form/index.js +53 -18
- package/es/index.d.ts +82 -40
- package/es/index.js +2 -1
- package/es/style.css +1 -1
- package/package.json +5 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present pro-components
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/es/form/index.js
CHANGED
|
@@ -15703,6 +15703,9 @@ const UPDATE_FORM_DATA = Symbol(
|
|
|
15703
15703
|
);
|
|
15704
15704
|
const UPDATE_REFS = Symbol("updateRefs");
|
|
15705
15705
|
const COMMAND = Symbol("command");
|
|
15706
|
+
const UPDATE_ACTIVE_PATH = Symbol(
|
|
15707
|
+
"setActivePath"
|
|
15708
|
+
);
|
|
15706
15709
|
const RULE_TYPE_MAP = /* @__PURE__ */ new Map([
|
|
15707
15710
|
["value", "字段赋值"],
|
|
15708
15711
|
["hidden", "字段隐藏/显示"],
|
|
@@ -15868,7 +15871,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
15868
15871
|
ref: (el) => setFormItemRef(el, field),
|
|
15869
15872
|
class: field.className,
|
|
15870
15873
|
style: field.style,
|
|
15871
|
-
name:
|
|
15874
|
+
name: _ctx.path ? unref(toPath)(getPath(field.key)) : getPath(field.key),
|
|
15872
15875
|
path: getPath(field.key)
|
|
15873
15876
|
}), createSlots({
|
|
15874
15877
|
default: withCtx(() => [
|
|
@@ -15922,7 +15925,12 @@ const generateFieldMap = (fields, prePath = "", preFieldPath = "", fieldMap = {}
|
|
|
15922
15925
|
fieldMap[path] = { field, fieldPath };
|
|
15923
15926
|
}
|
|
15924
15927
|
if (field.fields) {
|
|
15925
|
-
generateFieldMap(
|
|
15928
|
+
generateFieldMap(
|
|
15929
|
+
field.fields,
|
|
15930
|
+
path,
|
|
15931
|
+
`${fieldPath}.fields`,
|
|
15932
|
+
fieldMap
|
|
15933
|
+
);
|
|
15926
15934
|
}
|
|
15927
15935
|
});
|
|
15928
15936
|
return fieldMap;
|
|
@@ -16008,21 +16016,24 @@ const useFields = (initFields) => {
|
|
|
16008
16016
|
};
|
|
16009
16017
|
const useFormData = (initFormData) => {
|
|
16010
16018
|
const formData = ref(initFormData);
|
|
16011
|
-
const activePath = ref(
|
|
16019
|
+
const activePath = ref();
|
|
16020
|
+
const setActivePath = (path) => {
|
|
16021
|
+
activePath.value = path;
|
|
16022
|
+
};
|
|
16012
16023
|
const getFormData = (path) => {
|
|
16024
|
+
if (!path)
|
|
16025
|
+
return void 0;
|
|
16013
16026
|
return get$1(formData.value, path);
|
|
16014
16027
|
};
|
|
16015
16028
|
const setFormData = (path, value) => {
|
|
16016
16029
|
let newValue = value;
|
|
16017
16030
|
if (path) {
|
|
16018
|
-
activePath.value = path;
|
|
16019
16031
|
if (typeof value === "function") {
|
|
16020
16032
|
const preValue = getFormData(path);
|
|
16021
16033
|
newValue = value(preValue);
|
|
16022
16034
|
}
|
|
16023
16035
|
set$1(formData.value, path, newValue);
|
|
16024
16036
|
} else {
|
|
16025
|
-
activePath.value = null;
|
|
16026
16037
|
if (typeof value === "function") {
|
|
16027
16038
|
const preValue = formData.value;
|
|
16028
16039
|
newValue = value(preValue);
|
|
@@ -16030,12 +16041,12 @@ const useFormData = (initFormData) => {
|
|
|
16030
16041
|
formData.value = newValue;
|
|
16031
16042
|
}
|
|
16032
16043
|
};
|
|
16033
|
-
return { formData, getFormData, setFormData, activePath };
|
|
16044
|
+
return { formData, getFormData, setFormData, activePath, setActivePath };
|
|
16034
16045
|
};
|
|
16035
|
-
const useForm = (initFormData, initFields) => {
|
|
16046
|
+
const useForm = (initFormData = {}, initFields = []) => {
|
|
16036
16047
|
return {
|
|
16037
|
-
...useFormData(initFormData
|
|
16038
|
-
...useFields(initFields
|
|
16048
|
+
...useFormData(initFormData),
|
|
16049
|
+
...useFields(initFields)
|
|
16039
16050
|
};
|
|
16040
16051
|
};
|
|
16041
16052
|
const isFunctionString = (param) => {
|
|
@@ -16362,6 +16373,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16362
16373
|
const updateFormData = inject(UPDATE_FORM_DATA);
|
|
16363
16374
|
const updateRefs = inject(UPDATE_REFS);
|
|
16364
16375
|
const command = inject(COMMAND);
|
|
16376
|
+
const updateActivePath = inject(UPDATE_ACTIVE_PATH);
|
|
16365
16377
|
const { getInitProps } = useInitProps();
|
|
16366
16378
|
const value = computed({
|
|
16367
16379
|
get() {
|
|
@@ -16397,6 +16409,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16397
16409
|
}
|
|
16398
16410
|
return {};
|
|
16399
16411
|
};
|
|
16412
|
+
const modelName = computed(() => {
|
|
16413
|
+
if (componentType.value === "switch") {
|
|
16414
|
+
return "checked";
|
|
16415
|
+
}
|
|
16416
|
+
return "value";
|
|
16417
|
+
});
|
|
16400
16418
|
const mergedAttrs = computed(() => {
|
|
16401
16419
|
const compType = componentType.value;
|
|
16402
16420
|
const initProps = getInitProps({
|
|
@@ -16412,7 +16430,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16412
16430
|
Object.assign(methods, rewriteMethod("onBlur"), rewriteMethod("onFocus"));
|
|
16413
16431
|
break;
|
|
16414
16432
|
}
|
|
16415
|
-
return { ...initProps, ...attrs, ...methods };
|
|
16433
|
+
return { ...initProps, ...attrs, ...methods, onFocus: void 0 };
|
|
16416
16434
|
});
|
|
16417
16435
|
const is = computed(() => {
|
|
16418
16436
|
return COMPONENT_MAP.get(props.component) ?? props.component;
|
|
@@ -16428,6 +16446,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16428
16446
|
(_c = command == null ? void 0 : command.value) == null ? void 0 : _c.run(props.path, "onInit");
|
|
16429
16447
|
}
|
|
16430
16448
|
});
|
|
16449
|
+
function handleFocus(...args) {
|
|
16450
|
+
var _a, _b;
|
|
16451
|
+
updateActivePath == null ? void 0 : updateActivePath(props.path);
|
|
16452
|
+
(_b = (_a = mergedAttrs.value).onFocus) == null ? void 0 : _b.call(_a, ...args);
|
|
16453
|
+
}
|
|
16431
16454
|
return (_ctx, _cache) => {
|
|
16432
16455
|
return openBlock(), createBlock(unref(_sfc_main$2), {
|
|
16433
16456
|
component: unref(attrs).componentContainer,
|
|
@@ -16436,11 +16459,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16436
16459
|
default: withCtx(() => [
|
|
16437
16460
|
(openBlock(), createBlock(resolveDynamicComponent(is.value), mergeProps({ key: forceUpdateKey.value }, mergedAttrs.value, {
|
|
16438
16461
|
ref: setComponentRef,
|
|
16439
|
-
value: value.value,
|
|
16440
|
-
"onUpdate:value
|
|
16462
|
+
[modelName.value]: value.value,
|
|
16463
|
+
["onUpdate:" + modelName.value]: _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
16441
16464
|
class: [unref(attrs).componentClassName, "field-component"],
|
|
16442
16465
|
style: unref(attrs).componentStyle,
|
|
16443
|
-
path: _ctx.path
|
|
16466
|
+
path: _ctx.path,
|
|
16467
|
+
onFocus: handleFocus
|
|
16444
16468
|
}), createSlots({ _: 2 }, [
|
|
16445
16469
|
renderList(unref(attrs).slots, (slot, name) => {
|
|
16446
16470
|
return {
|
|
@@ -16453,14 +16477,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16453
16477
|
])
|
|
16454
16478
|
};
|
|
16455
16479
|
})
|
|
16456
|
-
]), 1040, ["
|
|
16480
|
+
]), 1040, ["class", "style", "path"]))
|
|
16457
16481
|
]),
|
|
16458
16482
|
_: 1
|
|
16459
16483
|
}, 8, ["component", "path"]);
|
|
16460
16484
|
};
|
|
16461
16485
|
}
|
|
16462
16486
|
});
|
|
16463
|
-
const
|
|
16487
|
+
const index_vue_vue_type_style_index_0_scoped_cabd909c_lang = "";
|
|
16464
16488
|
const _export_sfc = (sfc, props) => {
|
|
16465
16489
|
const target = sfc.__vccOpts || sfc;
|
|
16466
16490
|
for (const [key, val] of props) {
|
|
@@ -16468,7 +16492,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
16468
16492
|
}
|
|
16469
16493
|
return target;
|
|
16470
16494
|
};
|
|
16471
|
-
const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
16495
|
+
const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-cabd909c"]]);
|
|
16472
16496
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
16473
16497
|
...{
|
|
16474
16498
|
name: "ContainerFragment",
|
|
@@ -16516,9 +16540,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16516
16540
|
formData: { default: () => ({}) },
|
|
16517
16541
|
fields: { default: () => [] },
|
|
16518
16542
|
grid: { type: [Boolean, Object], default: false },
|
|
16519
|
-
autoCommandDisabled: { type: Boolean, default: false }
|
|
16543
|
+
autoCommandDisabled: { type: Boolean, default: false },
|
|
16544
|
+
activePath: { default: void 0 }
|
|
16520
16545
|
},
|
|
16521
|
-
emits: ["update:formData"],
|
|
16546
|
+
emits: ["update:formData", "update:activePath"],
|
|
16522
16547
|
setup(__props, { expose: __expose, emit }) {
|
|
16523
16548
|
const props = __props;
|
|
16524
16549
|
const refs = {
|
|
@@ -16531,6 +16556,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16531
16556
|
refs[type4][path] = childRef;
|
|
16532
16557
|
};
|
|
16533
16558
|
const exposed = shallowReactive({ refs });
|
|
16559
|
+
const updateActivePath = (path) => {
|
|
16560
|
+
if (props.form) {
|
|
16561
|
+
props.form.setActivePath(path);
|
|
16562
|
+
} else {
|
|
16563
|
+
emit("update:activePath", path);
|
|
16564
|
+
}
|
|
16565
|
+
};
|
|
16534
16566
|
const _formData = computed(
|
|
16535
16567
|
() => props.form ? props.form.formData.value : props.formData
|
|
16536
16568
|
);
|
|
@@ -16554,6 +16586,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16554
16586
|
);
|
|
16555
16587
|
emit("update:formData", newFormData);
|
|
16556
16588
|
}
|
|
16589
|
+
updateActivePath(path);
|
|
16557
16590
|
};
|
|
16558
16591
|
const _fields = computed(
|
|
16559
16592
|
() => props.form ? props.form.fields.value : props.fields
|
|
@@ -16572,6 +16605,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16572
16605
|
provide(UPDATE_FORM_DATA, updateFormData);
|
|
16573
16606
|
provide(UPDATE_REFS, updateRefs);
|
|
16574
16607
|
provide(COMMAND, command);
|
|
16608
|
+
provide(UPDATE_ACTIVE_PATH, updateActivePath);
|
|
16575
16609
|
__expose(exposed);
|
|
16576
16610
|
return (_ctx, _cache) => {
|
|
16577
16611
|
return openBlock(), createBlock(unref(Form$2), {
|
|
@@ -16605,6 +16639,7 @@ export {
|
|
|
16605
16639
|
INJECT_COMPONENT_PROPS_KEYS,
|
|
16606
16640
|
RULE_TYPE_MAP,
|
|
16607
16641
|
_sfc_main$1 as SlotComponent,
|
|
16642
|
+
UPDATE_ACTIVE_PATH,
|
|
16608
16643
|
UPDATE_FORM_DATA,
|
|
16609
16644
|
UPDATE_REFS,
|
|
16610
16645
|
_sfc_main as default,
|
package/es/index.d.ts
CHANGED
|
@@ -20,7 +20,6 @@ import { ExtractPropTypes } from 'vue';
|
|
|
20
20
|
import { FieldData } from 'ant-design-vue/es/form/interface';
|
|
21
21
|
import type { FormItemProps } from 'ant-design-vue';
|
|
22
22
|
import { FormLabelAlign } from 'ant-design-vue/es/form/interface';
|
|
23
|
-
import type { FunctionalComponent } from 'vue';
|
|
24
23
|
import { HTMLAttributes } from 'vue';
|
|
25
24
|
import { InjectionKey } from 'vue';
|
|
26
25
|
import type { InputNumberProps } from 'ant-design-vue';
|
|
@@ -69,7 +68,7 @@ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
|
69
68
|
};
|
|
70
69
|
};
|
|
71
70
|
|
|
72
|
-
export declare type AppendField = (path: string, field: Field) => void;
|
|
71
|
+
export declare type AppendField = (path: string | undefined, field: Field) => void;
|
|
73
72
|
|
|
74
73
|
/**
|
|
75
74
|
* @description js箭头函数字符串正则
|
|
@@ -179,9 +178,9 @@ export declare type CommandTrigger = 'onInit' | 'onUpdateValue' | 'onBlur' | 'on
|
|
|
179
178
|
/**
|
|
180
179
|
* @type {Object} Common - 公共字段类型
|
|
181
180
|
*/
|
|
182
|
-
declare interface Common {
|
|
181
|
+
declare interface Common<D extends FormData_2 = FormData_2> {
|
|
183
182
|
/** 标识key */
|
|
184
|
-
key?: string;
|
|
183
|
+
key?: keyof D & string;
|
|
185
184
|
/** 中文名称 */
|
|
186
185
|
label?: SlotComponentType;
|
|
187
186
|
/** 插槽,可包含formItem插槽和component插槽 */
|
|
@@ -228,15 +227,15 @@ export declare type Condition = {
|
|
|
228
227
|
disabled?: boolean;
|
|
229
228
|
};
|
|
230
229
|
|
|
231
|
-
export declare type ContainerComponent =
|
|
230
|
+
export declare type ContainerComponent = Component<DefaultProps>;
|
|
232
231
|
|
|
233
232
|
export declare const ContainerFragment: __VLS_WithTemplateSlots_2<DefineComponent<{
|
|
234
233
|
component: {
|
|
235
|
-
type: PropType<
|
|
234
|
+
type: PropType<ContainerComponent>;
|
|
236
235
|
};
|
|
237
236
|
}, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
238
237
|
component: {
|
|
239
|
-
type: PropType<
|
|
238
|
+
type: PropType<ContainerComponent>;
|
|
240
239
|
};
|
|
241
240
|
}>>, {}, {}>, {
|
|
242
241
|
default?(_: {}): any;
|
|
@@ -257,7 +256,7 @@ declare const _default_2: __VLS_WithTemplateSlots<DefineComponent<{
|
|
|
257
256
|
type: PropType<string>;
|
|
258
257
|
};
|
|
259
258
|
size: {
|
|
260
|
-
type: PropType<"
|
|
259
|
+
type: PropType<"middle" | "small" | "large">;
|
|
261
260
|
};
|
|
262
261
|
disabled: {
|
|
263
262
|
type: PropType<boolean>;
|
|
@@ -410,6 +409,10 @@ declare const _default_2: __VLS_WithTemplateSlots<DefineComponent<{
|
|
|
410
409
|
type: PropType<boolean>;
|
|
411
410
|
default: boolean;
|
|
412
411
|
};
|
|
412
|
+
activePath: {
|
|
413
|
+
type: PropType<string>;
|
|
414
|
+
default: undefined;
|
|
415
|
+
};
|
|
413
416
|
}, {
|
|
414
417
|
refs: Refs;
|
|
415
418
|
resetFields: (name?: NamePath | undefined) => void;
|
|
@@ -426,6 +429,7 @@ declare const _default_2: __VLS_WithTemplateSlots<DefineComponent<{
|
|
|
426
429
|
scrollToField: (name: NamePath, options?: {} | undefined) => void;
|
|
427
430
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
428
431
|
"update:formData": (val: FormData_2) => void;
|
|
432
|
+
"update:activePath": (val: string | undefined) => void;
|
|
429
433
|
}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
430
434
|
prefixCls: {
|
|
431
435
|
type: PropType<string>;
|
|
@@ -434,7 +438,7 @@ declare const _default_2: __VLS_WithTemplateSlots<DefineComponent<{
|
|
|
434
438
|
type: PropType<string>;
|
|
435
439
|
};
|
|
436
440
|
size: {
|
|
437
|
-
type: PropType<"
|
|
441
|
+
type: PropType<"middle" | "small" | "large">;
|
|
438
442
|
};
|
|
439
443
|
disabled: {
|
|
440
444
|
type: PropType<boolean>;
|
|
@@ -587,32 +591,43 @@ declare const _default_2: __VLS_WithTemplateSlots<DefineComponent<{
|
|
|
587
591
|
type: PropType<boolean>;
|
|
588
592
|
default: boolean;
|
|
589
593
|
};
|
|
594
|
+
activePath: {
|
|
595
|
+
type: PropType<string>;
|
|
596
|
+
default: undefined;
|
|
597
|
+
};
|
|
590
598
|
}>> & {
|
|
591
599
|
"onUpdate:formData"?: ((val: FormData_2) => any) | undefined;
|
|
600
|
+
"onUpdate:activePath"?: ((val: string | undefined) => any) | undefined;
|
|
592
601
|
}, {
|
|
593
602
|
grid: Grid;
|
|
594
603
|
fields: Fields;
|
|
595
604
|
formData: FormData_2;
|
|
596
605
|
form: Form;
|
|
597
606
|
autoCommandDisabled: boolean;
|
|
607
|
+
activePath: string;
|
|
598
608
|
}, {}>, {
|
|
599
609
|
default?(_: {}): any;
|
|
600
610
|
}>;
|
|
601
611
|
|
|
602
|
-
|
|
612
|
+
declare type DefaultProps = {
|
|
613
|
+
path?: string;
|
|
614
|
+
[key: string]: any;
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
export declare type DeleteField = (path?: string) => void;
|
|
603
618
|
|
|
604
619
|
/**
|
|
605
620
|
* @type {string} Expression - 表达式字符串 需要是一个js表达式字符串或者一个函数字符串,表达式的执行结果或者函数的返回值将作为结果返回
|
|
606
621
|
*/
|
|
607
622
|
export declare type Expression = string;
|
|
608
623
|
|
|
609
|
-
export declare type Field = FieldType[keyof FieldType] & Omit<FormItemProps, 'label'> & ColProps & Common
|
|
624
|
+
export declare type Field<D extends FormData_2 = FormData_2> = FieldType[keyof FieldType] & Omit<FormItemProps, 'label'> & ColProps & Common<D>;
|
|
610
625
|
|
|
611
626
|
declare type FieldAttrsType = {
|
|
612
627
|
[key in keyof FieldType]: FieldType[key] & Pick<Common, 'slots' | 'componentStyle' | 'componentClassName' | 'componentContainer' | 'autoCommand'>;
|
|
613
628
|
};
|
|
614
629
|
|
|
615
|
-
export declare type Fields = Array<Field
|
|
630
|
+
export declare type Fields<D extends FormData_2 = FormData_2> = Array<Field<D>>;
|
|
616
631
|
|
|
617
632
|
declare type FieldSlot<T extends string> = Partial<Record<T, SlotComponentType>>;
|
|
618
633
|
|
|
@@ -703,13 +718,15 @@ export declare type FieldType = {
|
|
|
703
718
|
} & Record<string, any>;
|
|
704
719
|
};
|
|
705
720
|
|
|
706
|
-
export declare type Form = ReturnType<
|
|
721
|
+
export declare type Form<D extends FormData_2 = FormData_2> = ReturnType<UseFormData<D>> & ReturnType<UseFields>;
|
|
707
722
|
|
|
708
723
|
export declare const FORM_DATA: InjectionKey<Record<string, any>>;
|
|
709
724
|
|
|
710
725
|
export declare const FORM_ITEM_SLOT_KEYS: readonly ["label", "extra", "help"];
|
|
711
726
|
|
|
712
|
-
declare type FormData_2 =
|
|
727
|
+
declare type FormData_2 = {
|
|
728
|
+
[key: string]: any;
|
|
729
|
+
};
|
|
713
730
|
export { FormData_2 as FormData }
|
|
714
731
|
|
|
715
732
|
/**
|
|
@@ -717,13 +734,13 @@ export { FormData_2 as FormData }
|
|
|
717
734
|
*/
|
|
718
735
|
export declare const FunctionRegexp: RegExp;
|
|
719
736
|
|
|
720
|
-
export declare type GetField = (path
|
|
737
|
+
export declare type GetField = (path?: string) => Field | undefined;
|
|
721
738
|
|
|
722
|
-
export declare type GetFieldPath = (path
|
|
739
|
+
export declare type GetFieldPath = (path?: string) => string | undefined;
|
|
723
740
|
|
|
724
|
-
export declare type GetFormData = (path
|
|
741
|
+
export declare type GetFormData = (path?: string) => DeepReadonly<any>;
|
|
725
742
|
|
|
726
|
-
export declare type GetParentField = (path
|
|
743
|
+
export declare type GetParentField = (path?: string) => Field | undefined;
|
|
727
744
|
|
|
728
745
|
export declare type Grid = boolean | RowProps;
|
|
729
746
|
|
|
@@ -846,7 +863,7 @@ declare type Option_2 = {
|
|
|
846
863
|
|
|
847
864
|
export declare type Options = Array<Option_2>;
|
|
848
865
|
|
|
849
|
-
export declare type PrependField = (path: string, field: Field) => void;
|
|
866
|
+
export declare type PrependField = (path: string | undefined, field: Field) => void;
|
|
850
867
|
|
|
851
868
|
export declare const ProComponentProvider: SFCWithInstall<{
|
|
852
869
|
new (...args: any[]): {
|
|
@@ -967,9 +984,10 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
967
984
|
formData?: FormData_2 | undefined;
|
|
968
985
|
form?: Form | undefined;
|
|
969
986
|
autoCommandDisabled?: boolean | undefined;
|
|
987
|
+
activePath?: string | undefined;
|
|
970
988
|
readonly prefixCls?: string | undefined;
|
|
971
989
|
readonly name?: string | undefined;
|
|
972
|
-
readonly size?: "
|
|
990
|
+
readonly size?: "middle" | "small" | "large" | undefined;
|
|
973
991
|
readonly disabled?: boolean | undefined;
|
|
974
992
|
readonly labelCol?: (Partial<ExtractPropTypes<{
|
|
975
993
|
span: (StringConstructor | NumberConstructor)[];
|
|
@@ -1104,6 +1122,7 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1104
1122
|
readonly onFinishFailed?: ((errorInfo: ValidateErrorEntity<any>) => void) | undefined;
|
|
1105
1123
|
readonly onValidate?: ((name: string | number | string[] | number[], status: boolean, errors: string[]) => void) | undefined;
|
|
1106
1124
|
"onUpdate:formData"?: ((val: FormData_2) => any) | undefined;
|
|
1125
|
+
"onUpdate:activePath"?: ((val: string | undefined) => any) | undefined;
|
|
1107
1126
|
};
|
|
1108
1127
|
$attrs: {
|
|
1109
1128
|
[x: string]: unknown;
|
|
@@ -1116,7 +1135,7 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1116
1135
|
}>;
|
|
1117
1136
|
$root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
1118
1137
|
$parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
1119
|
-
$emit: (event: "update:formData", val: FormData_2) => void;
|
|
1138
|
+
$emit: ((event: "update:formData", val: FormData_2) => void) & ((event: "update:activePath", val: string | undefined) => void);
|
|
1120
1139
|
$el: any;
|
|
1121
1140
|
$options: ComponentOptionsBase<Readonly<ExtractPropTypes<{
|
|
1122
1141
|
prefixCls: {
|
|
@@ -1126,7 +1145,7 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1126
1145
|
type: PropType<string>;
|
|
1127
1146
|
};
|
|
1128
1147
|
size: {
|
|
1129
|
-
type: PropType<"
|
|
1148
|
+
type: PropType<"middle" | "small" | "large">;
|
|
1130
1149
|
};
|
|
1131
1150
|
disabled: {
|
|
1132
1151
|
type: PropType<boolean>;
|
|
@@ -1279,8 +1298,13 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1279
1298
|
type: PropType<boolean>;
|
|
1280
1299
|
default: boolean;
|
|
1281
1300
|
};
|
|
1301
|
+
activePath: {
|
|
1302
|
+
type: PropType<string>;
|
|
1303
|
+
default: undefined;
|
|
1304
|
+
};
|
|
1282
1305
|
}>> & {
|
|
1283
1306
|
"onUpdate:formData"?: ((val: FormData_2) => any) | undefined;
|
|
1307
|
+
"onUpdate:activePath"?: ((val: string | undefined) => any) | undefined;
|
|
1284
1308
|
}, {
|
|
1285
1309
|
refs: Refs;
|
|
1286
1310
|
resetFields: (name?: NamePath | undefined) => void;
|
|
@@ -1297,12 +1321,14 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1297
1321
|
scrollToField: (name: NamePath, options?: {} | undefined) => void;
|
|
1298
1322
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
1299
1323
|
"update:formData": (val: FormData_2) => void;
|
|
1324
|
+
"update:activePath": (val: string | undefined) => void;
|
|
1300
1325
|
}, string, {
|
|
1301
1326
|
grid: Grid;
|
|
1302
1327
|
fields: Fields;
|
|
1303
1328
|
formData: FormData_2;
|
|
1304
1329
|
form: Form;
|
|
1305
1330
|
autoCommandDisabled: boolean;
|
|
1331
|
+
activePath: string;
|
|
1306
1332
|
}, {}, string, {}> & {
|
|
1307
1333
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
1308
1334
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -1331,7 +1357,7 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1331
1357
|
type: PropType<string>;
|
|
1332
1358
|
};
|
|
1333
1359
|
size: {
|
|
1334
|
-
type: PropType<"
|
|
1360
|
+
type: PropType<"middle" | "small" | "large">;
|
|
1335
1361
|
};
|
|
1336
1362
|
disabled: {
|
|
1337
1363
|
type: PropType<boolean>;
|
|
@@ -1484,8 +1510,13 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1484
1510
|
type: PropType<boolean>;
|
|
1485
1511
|
default: boolean;
|
|
1486
1512
|
};
|
|
1513
|
+
activePath: {
|
|
1514
|
+
type: PropType<string>;
|
|
1515
|
+
default: undefined;
|
|
1516
|
+
};
|
|
1487
1517
|
}>> & {
|
|
1488
1518
|
"onUpdate:formData"?: ((val: FormData_2) => any) | undefined;
|
|
1519
|
+
"onUpdate:activePath"?: ((val: string | undefined) => any) | undefined;
|
|
1489
1520
|
} & ShallowUnwrapRef<{
|
|
1490
1521
|
refs: Refs;
|
|
1491
1522
|
resetFields: (name?: NamePath | undefined) => void;
|
|
@@ -1512,7 +1543,7 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1512
1543
|
type: PropType<string>;
|
|
1513
1544
|
};
|
|
1514
1545
|
size: {
|
|
1515
|
-
type: PropType<"
|
|
1546
|
+
type: PropType<"middle" | "small" | "large">;
|
|
1516
1547
|
};
|
|
1517
1548
|
disabled: {
|
|
1518
1549
|
type: PropType<boolean>;
|
|
@@ -1665,8 +1696,13 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1665
1696
|
type: PropType<boolean>;
|
|
1666
1697
|
default: boolean;
|
|
1667
1698
|
};
|
|
1699
|
+
activePath: {
|
|
1700
|
+
type: PropType<string>;
|
|
1701
|
+
default: undefined;
|
|
1702
|
+
};
|
|
1668
1703
|
}>> & {
|
|
1669
1704
|
"onUpdate:formData"?: ((val: FormData_2) => any) | undefined;
|
|
1705
|
+
"onUpdate:activePath"?: ((val: string | undefined) => any) | undefined;
|
|
1670
1706
|
}, {
|
|
1671
1707
|
refs: Refs;
|
|
1672
1708
|
resetFields: (name?: NamePath | undefined) => void;
|
|
@@ -1683,12 +1719,14 @@ export declare const ProForm: SFCWithInstall<{
|
|
|
1683
1719
|
scrollToField: (name: NamePath, options?: {} | undefined) => void;
|
|
1684
1720
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
1685
1721
|
"update:formData": (val: FormData_2) => void;
|
|
1722
|
+
"update:activePath": (val: string | undefined) => void;
|
|
1686
1723
|
}, string, {
|
|
1687
1724
|
grid: Grid;
|
|
1688
1725
|
fields: Fields;
|
|
1689
1726
|
formData: FormData_2;
|
|
1690
1727
|
form: Form;
|
|
1691
1728
|
autoCommandDisabled: boolean;
|
|
1729
|
+
activePath: string;
|
|
1692
1730
|
}, {}, string, {}> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
|
|
1693
1731
|
$slots: {
|
|
1694
1732
|
default?(_: {}): any;
|
|
@@ -1706,16 +1744,9 @@ export declare type Refs = {
|
|
|
1706
1744
|
|
|
1707
1745
|
/**
|
|
1708
1746
|
* @description 自定义组件
|
|
1709
|
-
* @example (
|
|
1747
|
+
* @example (p, ctx) => h('div', ctx.attrs)
|
|
1710
1748
|
*/
|
|
1711
|
-
export declare type RenderComponentType =
|
|
1712
|
-
|
|
1713
|
-
declare type RenderProps = {
|
|
1714
|
-
path: string;
|
|
1715
|
-
value: unknown;
|
|
1716
|
-
'onUpdate:value': (val: unknown) => void;
|
|
1717
|
-
[key: string]: any;
|
|
1718
|
-
};
|
|
1749
|
+
export declare type RenderComponentType = Component<VModelProps & DefaultProps>;
|
|
1719
1750
|
|
|
1720
1751
|
/**
|
|
1721
1752
|
* @type {object} Rule - 逻辑运行规则
|
|
@@ -1749,9 +1780,11 @@ export declare type RuleType = 'value' | 'hidden' | 'disabled' | 'options' | 'va
|
|
|
1749
1780
|
|
|
1750
1781
|
declare type SelectSlots = FieldSlot<keyof InstanceType<typeof Select>['$slots']>;
|
|
1751
1782
|
|
|
1752
|
-
export declare type
|
|
1783
|
+
export declare type SetActivePath = (path: string | undefined) => void;
|
|
1784
|
+
|
|
1785
|
+
export declare type SetField = (path: string | undefined, field: Field | ((preField: ReturnType<GetField>) => Field)) => void;
|
|
1753
1786
|
|
|
1754
|
-
export declare type SetFormData = (path: string, value: any | ((preValue: DeepReadonly<any>) => any)) => void;
|
|
1787
|
+
export declare type SetFormData = (path: string | undefined, value: any | ((preValue: DeepReadonly<any>) => any)) => void;
|
|
1755
1788
|
|
|
1756
1789
|
declare type SFCWithInstall<T> = T & Plugin_2;
|
|
1757
1790
|
|
|
@@ -1772,7 +1805,7 @@ export declare const SlotComponent: DefineComponent<{
|
|
|
1772
1805
|
};
|
|
1773
1806
|
}>>, {}, {}>;
|
|
1774
1807
|
|
|
1775
|
-
export declare type SlotComponentType = string |
|
|
1808
|
+
export declare type SlotComponentType = string | Component<DefaultProps>;
|
|
1776
1809
|
|
|
1777
1810
|
declare type SwitchSlots = FieldSlot<'checkedChildren' | 'unCheckedChildren'>;
|
|
1778
1811
|
|
|
@@ -1780,6 +1813,8 @@ declare type TimePickerSlots = FieldSlot<'clearIcon' | 'renderExtraFooter' | 'su
|
|
|
1780
1813
|
|
|
1781
1814
|
declare type TreeSelectSlots = FieldSlot<'maxTagPlaceholder' | 'notFoundContent' | 'placeholder' | 'searchPlaceholder' | 'suffixIcon' | 'tagRender' | 'title'>;
|
|
1782
1815
|
|
|
1816
|
+
export declare const UPDATE_ACTIVE_PATH: InjectionKey<SetActivePath>;
|
|
1817
|
+
|
|
1783
1818
|
export declare const UPDATE_FORM_DATA: InjectionKey<UpdateFormData>;
|
|
1784
1819
|
|
|
1785
1820
|
export declare const UPDATE_REFS: InjectionKey<UpdateRefs>;
|
|
@@ -1823,7 +1858,7 @@ export declare type UseFields = (initFields: Fields) => {
|
|
|
1823
1858
|
|
|
1824
1859
|
export declare const useFields: UseFields;
|
|
1825
1860
|
|
|
1826
|
-
export declare type UseForm = <
|
|
1861
|
+
export declare type UseForm<T extends FormData_2 = FormData_2> = <D extends T = T>(initFormData?: Partial<D>, initFields?: Fields<D>) => Form<D>;
|
|
1827
1862
|
|
|
1828
1863
|
export declare const useForm: UseForm;
|
|
1829
1864
|
|
|
@@ -1832,15 +1867,17 @@ export declare const useForm: UseForm;
|
|
|
1832
1867
|
* @param {array} initFormData - 初始化表单数据
|
|
1833
1868
|
* @returns {Object}
|
|
1834
1869
|
*/
|
|
1835
|
-
export declare type UseFormData = (initFormData:
|
|
1870
|
+
export declare type UseFormData<D extends FormData_2 = FormData_2> = (initFormData: Partial<D>) => {
|
|
1836
1871
|
/** 表单数据Ref */
|
|
1837
|
-
formData: Ref<FormData_2>;
|
|
1872
|
+
formData: Ref<D | FormData_2>;
|
|
1838
1873
|
/** 获取指定字段数据路径的值 */
|
|
1839
1874
|
getFormData: GetFormData;
|
|
1840
1875
|
/** 设置指定字段数据路径的值 */
|
|
1841
1876
|
setFormData: SetFormData;
|
|
1842
1877
|
/** 当前正在编辑的字段path */
|
|
1843
|
-
activePath: Ref<string |
|
|
1878
|
+
activePath: Ref<string | undefined>;
|
|
1879
|
+
/** 设置当前正在编辑的字段path */
|
|
1880
|
+
setActivePath: SetActivePath;
|
|
1844
1881
|
};
|
|
1845
1882
|
|
|
1846
1883
|
export declare const useFormData: UseFormData;
|
|
@@ -1849,4 +1886,9 @@ export declare const useInitProps: () => {
|
|
|
1849
1886
|
getInitProps: (field: Field) => Record<string, any>;
|
|
1850
1887
|
};
|
|
1851
1888
|
|
|
1889
|
+
declare type VModelProps = {
|
|
1890
|
+
value?: unknown;
|
|
1891
|
+
'onUpdate:value'?: (val: unknown) => void;
|
|
1892
|
+
};
|
|
1893
|
+
|
|
1852
1894
|
export { }
|
package/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
2
|
import _sfc_main from "./form/index.js";
|
|
3
|
-
import { ArrowFunctionRegexp, BaseField, BaseFormItem, COMMAND, COMPONENT_MAP, ContainerFragment, FORM_DATA, FORM_ITEM_SLOT_KEYS, FunctionRegexp, INIT_COMPONENT_PROPS_MAP, INJECT_COMPONENT_PROPS_KEYS, RULE_TYPE_MAP, SlotComponent, UPDATE_FORM_DATA, UPDATE_REFS, isFunctionString, jsonParseReviver, jsonStringifyReplacer, useCommand, useFields, useForm, useFormData, useInitProps } from "./form/index.js";
|
|
3
|
+
import { ArrowFunctionRegexp, BaseField, BaseFormItem, COMMAND, COMPONENT_MAP, ContainerFragment, FORM_DATA, FORM_ITEM_SLOT_KEYS, FunctionRegexp, INIT_COMPONENT_PROPS_MAP, INJECT_COMPONENT_PROPS_KEYS, RULE_TYPE_MAP, SlotComponent, UPDATE_ACTIVE_PATH, UPDATE_FORM_DATA, UPDATE_REFS, isFunctionString, jsonParseReviver, jsonStringifyReplacer, useCommand, useFields, useForm, useFormData, useInitProps } from "./form/index.js";
|
|
4
4
|
import _sfc_main$1 from "./component-provider/index.js";
|
|
5
5
|
import "vue";
|
|
6
6
|
import "ant-design-vue";
|
|
@@ -36,6 +36,7 @@ export {
|
|
|
36
36
|
ProForm,
|
|
37
37
|
RULE_TYPE_MAP,
|
|
38
38
|
SlotComponent,
|
|
39
|
+
UPDATE_ACTIVE_PATH,
|
|
39
40
|
UPDATE_FORM_DATA,
|
|
40
41
|
UPDATE_REFS,
|
|
41
42
|
index as default,
|
package/es/style.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qin-ui/antd-vue-pro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "二次封装antd vue组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "",
|
|
@@ -14,9 +14,6 @@
|
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git+https://github.com/dufan3715/pro-components.git"
|
|
16
16
|
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "vue-tsc && vite build"
|
|
19
|
-
},
|
|
20
17
|
"keywords": [
|
|
21
18
|
"vue",
|
|
22
19
|
"ant-design-vue",
|
|
@@ -32,5 +29,8 @@
|
|
|
32
29
|
},
|
|
33
30
|
"bugs": {
|
|
34
31
|
"url": "https://github.com/dufan3715/pro-components/issues"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "vue-tsc && vite build"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|