pro-design-vue 1.0.0-rc.7 → 1.0.0-rc.9
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/dist/index.full.js +147 -46
- package/dist/index.full.min.js +8 -8
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +8 -8
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +147 -46
- package/es/components/form/src/base/BaseForm.mjs +11 -8
- package/es/components/form/src/base/BaseForm.mjs.map +1 -1
- package/es/components/form/src/hooks/useAction.d.ts +1 -0
- package/es/components/form/src/hooks/useAction.mjs +117 -11
- package/es/components/form/src/hooks/useAction.mjs.map +1 -1
- package/es/components/form/src/layouts/DrawerForm.mjs +8 -12
- package/es/components/form/src/layouts/DrawerForm.mjs.map +1 -1
- package/es/components/form/src/layouts/ModalForm.mjs +8 -12
- package/es/components/form/src/layouts/ModalForm.mjs.map +1 -1
- package/es/components/form/src/layouts/QueryFilter.mjs +2 -2
- package/es/components/form/src/layouts/QueryFilter.mjs.map +1 -1
- package/es/components/form/src/type.d.ts +5 -5
- package/es/components/table/src/components/Body/Body.vue.mjs.map +1 -1
- package/es/components/table/src/components/Body/Body.vue2.mjs +4 -5
- package/es/components/table/src/components/Body/Body.vue2.mjs.map +1 -1
- package/es/index.d.ts +5 -5
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/form/src/base/BaseForm.js +10 -7
- package/lib/components/form/src/base/BaseForm.js.map +1 -1
- package/lib/components/form/src/hooks/useAction.d.ts +1 -0
- package/lib/components/form/src/hooks/useAction.js +116 -9
- package/lib/components/form/src/hooks/useAction.js.map +1 -1
- package/lib/components/form/src/layouts/DrawerForm.js +8 -12
- package/lib/components/form/src/layouts/DrawerForm.js.map +1 -1
- package/lib/components/form/src/layouts/ModalForm.js +8 -12
- package/lib/components/form/src/layouts/ModalForm.js.map +1 -1
- package/lib/components/form/src/layouts/QueryFilter.js +2 -2
- package/lib/components/form/src/layouts/QueryFilter.js.map +1 -1
- package/lib/components/form/src/type.d.ts +5 -5
- package/lib/components/table/src/components/Body/Body.vue.js.map +1 -1
- package/lib/components/table/src/components/Body/Body.vue2.js +4 -5
- package/lib/components/table/src/components/Body/Body.vue2.js.map +1 -1
- package/lib/index.d.ts +5 -5
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
package/dist/index.full.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! Pro Design Vue v1.0.0-rc.
|
1
|
+
/*! Pro Design Vue v1.0.0-rc.9 */
|
2
2
|
|
3
3
|
(function (global, factory) {
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('ant-design-vue'), require('vue')) :
|
@@ -16,7 +16,7 @@
|
|
16
16
|
const SCROLL_FIXED_CLASS = `_scroll__fixed_`;
|
17
17
|
const DEFAULT_NAMESPACE = "pro";
|
18
18
|
|
19
|
-
const version$1 = "1.0.0-rc.
|
19
|
+
const version$1 = "1.0.0-rc.9";
|
20
20
|
|
21
21
|
const makeInstaller = (components = []) => {
|
22
22
|
const install = (app) => {
|
@@ -15754,10 +15754,115 @@
|
|
15754
15754
|
return isString$1(namePath) ? namePath.indexOf(".") > -1 ? namePath.split(".") : [namePath] : namePath;
|
15755
15755
|
};
|
15756
15756
|
|
15757
|
-
|
15758
|
-
|
15759
|
-
|
15760
|
-
return
|
15757
|
+
function isPlainObj(itemValue) {
|
15758
|
+
if (typeof itemValue !== "object") return false;
|
15759
|
+
if (itemValue === null) return true;
|
15760
|
+
if (isValidElement$1(itemValue)) return false;
|
15761
|
+
if (itemValue.constructor === RegExp) return false;
|
15762
|
+
if (itemValue instanceof Map) return false;
|
15763
|
+
if (itemValue instanceof Set) return false;
|
15764
|
+
if (itemValue instanceof HTMLElement) return false;
|
15765
|
+
if (itemValue instanceof Blob) return false;
|
15766
|
+
if (itemValue instanceof File) return false;
|
15767
|
+
if (Array.isArray(itemValue)) return false;
|
15768
|
+
return true;
|
15769
|
+
}
|
15770
|
+
const transformKeySubmitValue = (values, paramsOmitNil) => {
|
15771
|
+
if (Object.keys(values).length < 1) {
|
15772
|
+
return values;
|
15773
|
+
}
|
15774
|
+
if (typeof window === "undefined") return values;
|
15775
|
+
if (typeof values !== "object" || isNil(values) || values instanceof Blob) {
|
15776
|
+
return values;
|
15777
|
+
}
|
15778
|
+
let finalValues = Array.isArray(values) ? [] : {};
|
15779
|
+
const gen = (tempValues, parentsKey) => {
|
15780
|
+
const isArrayValues = Array.isArray(tempValues);
|
15781
|
+
let result = isArrayValues ? [] : {};
|
15782
|
+
if (tempValues == null || tempValues === void 0) {
|
15783
|
+
return result;
|
15784
|
+
}
|
15785
|
+
Object.keys(tempValues).forEach((entityKey) => {
|
15786
|
+
const transformForArray = (transformList, subItemValue) => {
|
15787
|
+
if (!Array.isArray(transformList)) return entityKey;
|
15788
|
+
transformList.forEach((transform2, idx) => {
|
15789
|
+
if (!transform2) return;
|
15790
|
+
const subTransformItem = subItemValue == null ? void 0 : subItemValue[idx];
|
15791
|
+
if (typeof transform2 === "function") {
|
15792
|
+
subItemValue[idx] = transform2(subItemValue, entityKey, tempValues);
|
15793
|
+
}
|
15794
|
+
if (typeof transform2 === "object" && !Array.isArray(transform2)) {
|
15795
|
+
Object.keys(transform2).forEach((transformArrayItem) => {
|
15796
|
+
const subTransformItemValue = subTransformItem == null ? void 0 : subTransformItem[transformArrayItem];
|
15797
|
+
if (typeof transform2[transformArrayItem] === "function" && subTransformItemValue) {
|
15798
|
+
const res = transform2[transformArrayItem](
|
15799
|
+
subTransformItem[transformArrayItem],
|
15800
|
+
entityKey,
|
15801
|
+
tempValues
|
15802
|
+
);
|
15803
|
+
subTransformItem[transformArrayItem] = typeof res === "object" ? res[transformArrayItem] : res;
|
15804
|
+
} else if (typeof transform2[transformArrayItem] === "object" && Array.isArray(transform2[transformArrayItem]) && subTransformItemValue) {
|
15805
|
+
transformForArray(transform2[transformArrayItem], subTransformItemValue);
|
15806
|
+
}
|
15807
|
+
});
|
15808
|
+
}
|
15809
|
+
if (typeof transform2 === "object" && Array.isArray(transform2) && subTransformItem) {
|
15810
|
+
transformForArray(transform2, subTransformItem);
|
15811
|
+
}
|
15812
|
+
});
|
15813
|
+
return entityKey;
|
15814
|
+
};
|
15815
|
+
const key = parentsKey ? [parentsKey, entityKey].flat(1) : [entityKey].flat(1);
|
15816
|
+
const itemValue = tempValues[entityKey];
|
15817
|
+
const transformFunction = get(values, key);
|
15818
|
+
const transform = () => {
|
15819
|
+
let tempKey, transformedResult, isTransformedResultPrimitive = false;
|
15820
|
+
if (typeof transformFunction === "function") {
|
15821
|
+
transformedResult = transformFunction == null ? void 0 : transformFunction(itemValue, entityKey, tempValues);
|
15822
|
+
const typeOfResult = typeof transformedResult;
|
15823
|
+
if (typeOfResult !== "object" && typeOfResult !== "undefined") {
|
15824
|
+
tempKey = entityKey;
|
15825
|
+
isTransformedResultPrimitive = true;
|
15826
|
+
} else {
|
15827
|
+
tempKey = transformedResult;
|
15828
|
+
}
|
15829
|
+
} else {
|
15830
|
+
tempKey = transformForArray(transformFunction, itemValue);
|
15831
|
+
}
|
15832
|
+
if (Array.isArray(tempKey)) {
|
15833
|
+
result = set(result, tempKey, itemValue);
|
15834
|
+
return;
|
15835
|
+
}
|
15836
|
+
if (typeof tempKey === "object" && !Array.isArray(finalValues)) {
|
15837
|
+
finalValues = merge(finalValues, tempKey);
|
15838
|
+
} else if (typeof tempKey === "object" && Array.isArray(finalValues)) {
|
15839
|
+
result = { ...result, ...tempKey };
|
15840
|
+
} else if (tempKey !== null || tempKey !== void 0) {
|
15841
|
+
result = set(
|
15842
|
+
result,
|
15843
|
+
[tempKey],
|
15844
|
+
isTransformedResultPrimitive ? transformedResult : itemValue
|
15845
|
+
);
|
15846
|
+
}
|
15847
|
+
};
|
15848
|
+
if (transformFunction && typeof transformFunction === "function") {
|
15849
|
+
transform();
|
15850
|
+
}
|
15851
|
+
if (typeof window === "undefined") return;
|
15852
|
+
if (isPlainObj(itemValue)) {
|
15853
|
+
const genValues = gen(itemValue, key);
|
15854
|
+
if (Object.keys(genValues).length < 1) {
|
15855
|
+
return;
|
15856
|
+
}
|
15857
|
+
result = set(result, [entityKey], genValues);
|
15858
|
+
return;
|
15859
|
+
}
|
15860
|
+
transform();
|
15861
|
+
});
|
15862
|
+
return paramsOmitNil ? result : tempValues;
|
15863
|
+
};
|
15864
|
+
finalValues = Array.isArray(values) && Array.isArray(finalValues) ? [...gen(values)] : merge({}, gen(values), finalValues);
|
15865
|
+
return finalValues;
|
15761
15866
|
};
|
15762
15867
|
function useAction({
|
15763
15868
|
props,
|
@@ -15793,20 +15898,20 @@
|
|
15793
15898
|
if (!namePath) throw new Error("name is require");
|
15794
15899
|
const value = get(formData.value, namePath);
|
15795
15900
|
const obj = set({}, namePath, value);
|
15796
|
-
return get(
|
15901
|
+
return get(transformKeySubmitValue(obj, props.omitNil), namePath);
|
15797
15902
|
};
|
15798
15903
|
const getFieldFormatValueObject = (name) => {
|
15799
15904
|
const namePath = covertFormName(name);
|
15800
15905
|
if (!namePath) throw new Error("name is require");
|
15801
15906
|
const value = get(formData.value, namePath);
|
15802
15907
|
const obj = set({}, namePath, value);
|
15803
|
-
return
|
15908
|
+
return transformKeySubmitValue(obj, props.omitNil);
|
15804
15909
|
};
|
15805
15910
|
const validateFieldsReturnFormatValue = async (nameList) => {
|
15806
15911
|
var _a;
|
15807
15912
|
if (!Array.isArray(nameList) && nameList) throw new Error("nameList must be array");
|
15808
15913
|
const values = await ((_a = formRef.value) == null ? void 0 : _a.validateFields(nameList));
|
15809
|
-
const transformedKey =
|
15914
|
+
const transformedKey = transformKeySubmitValue(values, props.omitNil);
|
15810
15915
|
return transformedKey != null ? transformedKey : {};
|
15811
15916
|
};
|
15812
15917
|
const setFieldValue = (name, value) => {
|
@@ -15835,7 +15940,7 @@
|
|
15835
15940
|
formData.value = cloneDeep(initialValues.value);
|
15836
15941
|
Promise.resolve().then(() => {
|
15837
15942
|
hasInitial.value = false;
|
15838
|
-
onReset == null ? void 0 : onReset(formData.value);
|
15943
|
+
onReset == null ? void 0 : onReset(transformKeySubmitValue(formData.value, props.omitNil));
|
15839
15944
|
});
|
15840
15945
|
};
|
15841
15946
|
const resetField = (name) => {
|
@@ -16292,21 +16397,21 @@
|
|
16292
16397
|
});
|
16293
16398
|
const onValuesChange = debounce(() => {
|
16294
16399
|
var _a;
|
16295
|
-
(_a = props.onValuesChange) == null ? void 0 : _a.call(props, cloneDeep(formData.value));
|
16400
|
+
(_a = props.onValuesChange) == null ? void 0 : _a.call(props, transformKeySubmitValue(cloneDeep(formData.value), props.omitNil));
|
16296
16401
|
}, 200);
|
16297
16402
|
const onFinish = async () => {
|
16298
16403
|
if (!props.onFinish) return;
|
16299
|
-
if (props.
|
16404
|
+
if (props.submitOnLoading) {
|
16300
16405
|
if (loading.value) return;
|
16301
16406
|
setloading(true);
|
16302
16407
|
}
|
16303
16408
|
try {
|
16304
|
-
const finalValues = cloneDeep(formData.value);
|
16409
|
+
const finalValues = transformKeySubmitValue(cloneDeep(formData.value), props.omitNil);
|
16305
16410
|
await props.onFinish(finalValues);
|
16306
16411
|
} catch (error) {
|
16307
16412
|
console.log("\u{1F680} ~ onFinish ~ error:", error);
|
16308
16413
|
} finally {
|
16309
|
-
if (props.
|
16414
|
+
if (props.submitOnLoading) {
|
16310
16415
|
setloading(false);
|
16311
16416
|
}
|
16312
16417
|
}
|
@@ -16372,8 +16477,11 @@
|
|
16372
16477
|
var _a, _b, _c;
|
16373
16478
|
mountedRef.value = true;
|
16374
16479
|
requestFormCacheId += 1;
|
16375
|
-
const finalValues = (_b = (_a = formRef.value) == null ? void 0 : _a.getFieldsValue) == null ? void 0 : _b.call(_a, true);
|
16376
|
-
(
|
16480
|
+
const finalValues = (_c = (_b = (_a = formRef.value) == null ? void 0 : _a.getFieldsValue) == null ? void 0 : _b.call(_a, true)) != null ? _c : {};
|
16481
|
+
Promise.resolve().then(() => {
|
16482
|
+
var _a2;
|
16483
|
+
(_a2 = props.onInit) == null ? void 0 : _a2.call(props, transformKeySubmitValue(finalValues, props.omitNil), action);
|
16484
|
+
});
|
16377
16485
|
});
|
16378
16486
|
useProvideForm({
|
16379
16487
|
...linkage,
|
@@ -16420,7 +16528,7 @@
|
|
16420
16528
|
"style": attrs.style
|
16421
16529
|
}), {
|
16422
16530
|
default: () => [vue.createVNode(antDesignVue.Spin, {
|
16423
|
-
"spinning": requestLoading.value ||
|
16531
|
+
"spinning": props.showLoading && (requestLoading.value || loading.value)
|
16424
16532
|
}, {
|
16425
16533
|
default: () => [vue.createVNode(FormRowWrapper, null, {
|
16426
16534
|
default: () => [vue.createVNode(FormItems, {
|
@@ -16454,8 +16562,7 @@
|
|
16454
16562
|
emits: ["update:open"],
|
16455
16563
|
setup(props, {
|
16456
16564
|
slots,
|
16457
|
-
emit
|
16458
|
-
expose
|
16565
|
+
emit
|
16459
16566
|
}) {
|
16460
16567
|
const _open = vue.ref(false);
|
16461
16568
|
const loading = vue.ref(false);
|
@@ -16463,7 +16570,6 @@
|
|
16463
16570
|
const intl = useIntl();
|
16464
16571
|
const formRef = vue.ref();
|
16465
16572
|
const footerRef = vue.ref(null);
|
16466
|
-
const formExpose = useFormExpose(formRef);
|
16467
16573
|
const open = vue.computed({
|
16468
16574
|
get: () => {
|
16469
16575
|
var _a;
|
@@ -16483,7 +16589,7 @@
|
|
16483
16589
|
});
|
16484
16590
|
const formProps = vue.computed(() => {
|
16485
16591
|
return {
|
16486
|
-
...omitUndefined(omit(props, ["onOpenChange", "closeOnFinish", "drawerProps", "title", "width", "confirmOnValuesChange", "submitTimeout", "onFinish", "submitter"])),
|
16592
|
+
...omitUndefined(omit(props, ["onOpenChange", "closeOnFinish", "drawerProps", "title", "width", "onInit", "confirmOnValuesChange", "submitTimeout", "onFinish", "submitter"])),
|
16487
16593
|
layout: "vertical"
|
16488
16594
|
};
|
16489
16595
|
});
|
@@ -16589,10 +16695,6 @@
|
|
16589
16695
|
}
|
16590
16696
|
return result;
|
16591
16697
|
};
|
16592
|
-
expose({
|
16593
|
-
formRef,
|
16594
|
-
...formExpose
|
16595
|
-
});
|
16596
16698
|
return () => vue.createVNode(vue.Fragment, null, [vue.createVNode(ProDrawer, vue.mergeProps(drawerProps.value, {
|
16597
16699
|
"open": open.value,
|
16598
16700
|
"onAfterOpenChange": (e) => {
|
@@ -16606,9 +16708,7 @@
|
|
16606
16708
|
closeConfirm(e);
|
16607
16709
|
}
|
16608
16710
|
}), {
|
16609
|
-
default: () => [vue.createVNode(BaseForm, vue.mergeProps({
|
16610
|
-
"ref": formRef
|
16611
|
-
}, formProps.value, {
|
16711
|
+
default: () => [vue.createVNode(BaseForm, vue.mergeProps(formProps.value, {
|
16612
16712
|
"submitter": submitterConfig.value,
|
16613
16713
|
"onFinish": async (values) => {
|
16614
16714
|
const result = await onFinishHandle(values);
|
@@ -16627,6 +16727,11 @@
|
|
16627
16727
|
valuesChanged.value = false;
|
16628
16728
|
}
|
16629
16729
|
(_a = props.onReset) == null ? void 0 : _a.call(props);
|
16730
|
+
},
|
16731
|
+
"onInit": (values, action) => {
|
16732
|
+
var _a;
|
16733
|
+
formRef.value = action;
|
16734
|
+
(_a = props.onInit) == null ? void 0 : _a.call(props, values, action);
|
16630
16735
|
}
|
16631
16736
|
}), formSlots.value)],
|
16632
16737
|
...drawerSlots.value,
|
@@ -16651,8 +16756,7 @@
|
|
16651
16756
|
emits: ["update:open"],
|
16652
16757
|
setup(props, {
|
16653
16758
|
slots,
|
16654
|
-
emit
|
16655
|
-
expose
|
16759
|
+
emit
|
16656
16760
|
}) {
|
16657
16761
|
const _open = vue.ref(false);
|
16658
16762
|
const loading = vue.ref(false);
|
@@ -16660,7 +16764,6 @@
|
|
16660
16764
|
const intl = useIntl();
|
16661
16765
|
const formRef = vue.ref();
|
16662
16766
|
const footerRef = vue.ref(null);
|
16663
|
-
const formExpose = useFormExpose(formRef);
|
16664
16767
|
const open = vue.computed({
|
16665
16768
|
get: () => {
|
16666
16769
|
var _a;
|
@@ -16681,7 +16784,7 @@
|
|
16681
16784
|
const formProps = vue.computed(() => {
|
16682
16785
|
var _a;
|
16683
16786
|
return {
|
16684
|
-
...omitUndefined(omit(props, ["onOpenChange", "closeOnFinish", "modalProps", "title", "width", "confirmOnValuesChange", "submitTimeout", "onFinish", "submitter"])),
|
16787
|
+
...omitUndefined(omit(props, ["onInit", "onOpenChange", "closeOnFinish", "modalProps", "title", "width", "confirmOnValuesChange", "submitTimeout", "onFinish", "submitter"])),
|
16685
16788
|
layout: (_a = props.layout) != null ? _a : "vertical"
|
16686
16789
|
};
|
16687
16790
|
});
|
@@ -16788,10 +16891,6 @@
|
|
16788
16891
|
}
|
16789
16892
|
return result;
|
16790
16893
|
};
|
16791
|
-
expose({
|
16792
|
-
formRef,
|
16793
|
-
...formExpose
|
16794
|
-
});
|
16795
16894
|
return () => vue.createVNode(vue.Fragment, null, [vue.createVNode(ProModal, vue.mergeProps(modalProps.value, {
|
16796
16895
|
"open": open.value,
|
16797
16896
|
"afterClose": () => {
|
@@ -16805,9 +16904,7 @@
|
|
16805
16904
|
closeConfirm(e);
|
16806
16905
|
}
|
16807
16906
|
}), {
|
16808
|
-
default: () => [vue.createVNode(BaseForm, vue.mergeProps({
|
16809
|
-
"ref": formRef
|
16810
|
-
}, formProps.value, {
|
16907
|
+
default: () => [vue.createVNode(BaseForm, vue.mergeProps(formProps.value, {
|
16811
16908
|
"submitter": submitterConfig.value,
|
16812
16909
|
"onFinish": async (values) => {
|
16813
16910
|
const result = await onFinishHandle(values);
|
@@ -16826,6 +16923,11 @@
|
|
16826
16923
|
valuesChanged.value = false;
|
16827
16924
|
}
|
16828
16925
|
(_a = props.onReset) == null ? void 0 : _a.call(props);
|
16926
|
+
},
|
16927
|
+
"onInit": (values, action) => {
|
16928
|
+
var _a;
|
16929
|
+
formRef.value = action;
|
16930
|
+
(_a = props.onInit) == null ? void 0 : _a.call(props, values, action);
|
16829
16931
|
}
|
16830
16932
|
}), formSlots.value)],
|
16831
16933
|
...modalSlots.value,
|
@@ -17046,7 +17148,7 @@
|
|
17046
17148
|
firstRowFull = colSpan === 24 && !item.hidden;
|
17047
17149
|
}
|
17048
17150
|
const hidden = item.hidden || // 如果收起了
|
17049
|
-
collapsed.value && (firstRowFull || // 如果 超过显示长度 且 总长度超过了 24
|
17151
|
+
props.submitter !== false && collapsed.value && (firstRowFull || // 如果 超过显示长度 且 总长度超过了 24
|
17050
17152
|
totalSize.value > showLength.value) && !!index;
|
17051
17153
|
if (hidden) {
|
17052
17154
|
if (!props.preserve) {
|
@@ -17104,7 +17206,7 @@
|
|
17104
17206
|
justify: "start",
|
17105
17207
|
class: `${prefixCls}-row`
|
17106
17208
|
},
|
17107
|
-
"
|
17209
|
+
"showLoading": false,
|
17108
17210
|
"submitter": submitterConfig.value,
|
17109
17211
|
"items": processedList.value,
|
17110
17212
|
"layout": spanSize.value.layout,
|
@@ -30612,11 +30714,10 @@
|
|
30612
30714
|
});
|
30613
30715
|
const emptyStyle = vue.computed(() => ({ width: `${props.bodyWidth}px` }));
|
30614
30716
|
useResizeObserver(measureDomRef, (entries) => {
|
30615
|
-
var _a
|
30616
|
-
|
30617
|
-
|
30618
|
-
emit("update:
|
30619
|
-
emit("update:bodyHeight", contentRect == null ? void 0 : contentRect.height);
|
30717
|
+
var _a;
|
30718
|
+
const contentRect = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
30719
|
+
emit("update:bodyWidth", (contentRect == null ? void 0 : contentRect.width) || 0);
|
30720
|
+
emit("update:bodyHeight", (contentRect == null ? void 0 : contentRect.height) || 0);
|
30620
30721
|
});
|
30621
30722
|
return {
|
30622
30723
|
bodyContainerStyle,
|