@qin-ui/antd-vue-pro 1.0.9 → 1.0.10
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/form/index.js +4 -1
- package/es/index.d.ts +2 -0
- package/package.json +1 -1
package/es/form/index.js
CHANGED
|
@@ -16002,18 +16002,21 @@ const useFields = (initFields) => {
|
|
|
16002
16002
|
};
|
|
16003
16003
|
const useFormData = (initFormData) => {
|
|
16004
16004
|
const formData = ref(initFormData);
|
|
16005
|
+
const activePath = ref(null);
|
|
16005
16006
|
const getFormData = (path) => {
|
|
16006
16007
|
return get$1(formData.value, path);
|
|
16007
16008
|
};
|
|
16008
16009
|
const setFormData = (path, value) => {
|
|
16009
16010
|
let newValue = value;
|
|
16010
16011
|
if (path) {
|
|
16012
|
+
activePath.value = path;
|
|
16011
16013
|
if (typeof value === "function") {
|
|
16012
16014
|
const preValue = getFormData(path);
|
|
16013
16015
|
newValue = value(preValue);
|
|
16014
16016
|
}
|
|
16015
16017
|
set$1(formData.value, path, newValue);
|
|
16016
16018
|
} else {
|
|
16019
|
+
activePath.value = null;
|
|
16017
16020
|
if (typeof value === "function") {
|
|
16018
16021
|
const preValue = formData.value;
|
|
16019
16022
|
newValue = value(preValue);
|
|
@@ -16021,7 +16024,7 @@ const useFormData = (initFormData) => {
|
|
|
16021
16024
|
formData.value = newValue;
|
|
16022
16025
|
}
|
|
16023
16026
|
};
|
|
16024
|
-
return { formData, getFormData, setFormData };
|
|
16027
|
+
return { formData, getFormData, setFormData, activePath };
|
|
16025
16028
|
};
|
|
16026
16029
|
const useForm = (initFormData, initFields) => {
|
|
16027
16030
|
return {
|
package/es/index.d.ts
CHANGED
|
@@ -1845,6 +1845,8 @@ export declare type UseFormData = (initFormData: FormData_2) => {
|
|
|
1845
1845
|
getFormData: GetFormData;
|
|
1846
1846
|
/** 设置指定字段数据路径的值 */
|
|
1847
1847
|
setFormData: SetFormData;
|
|
1848
|
+
/** 当前正在编辑的字段path */
|
|
1849
|
+
activePath: Ref<string | null>;
|
|
1848
1850
|
};
|
|
1849
1851
|
|
|
1850
1852
|
export declare const useFormData: UseFormData;
|