@carefrees/form-utils-vue 0.0.13 → 0.0.14
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/README.md +1 -4
- package/esm/form/form.js +2 -6
- package/esm/interface/index.d.ts +1 -3
- package/package.json +3 -3
- package/src/form/form.vue +2 -6
- package/src/interface/index.ts +1 -3
package/README.md
CHANGED
|
@@ -61,12 +61,9 @@ const onUpdateRules = () => {
|
|
|
61
61
|
rules2.value = [{ required: false, message: "不必填" }]
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
const onValuesChange = (...rest: any[]) => {
|
|
65
|
-
console.log(rest)
|
|
66
|
-
}
|
|
67
64
|
</script>
|
|
68
65
|
<template>
|
|
69
|
-
<Form
|
|
66
|
+
<Form :formData='formData' :form='form'>
|
|
70
67
|
<FormItem label='内容' input='input' name='a' :rules='rules1' />
|
|
71
68
|
<FormItem :input='Input' name='b' :rules='rules2'>
|
|
72
69
|
<template #label>
|
package/esm/form/form.js
CHANGED
|
@@ -29,7 +29,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
31
|
formData: {},
|
|
32
|
-
onValuesChange: {},
|
|
33
32
|
onFinish: {},
|
|
34
33
|
onFinishFailed: {},
|
|
35
34
|
hideData: {},
|
|
@@ -98,7 +97,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
98
97
|
],
|
|
99
98
|
setup (__props, { emit: __emit }) {
|
|
100
99
|
const props = __props;
|
|
101
|
-
const { form, style, formData, hideData, name, onFinish, onFinishFailed,
|
|
100
|
+
const { form, style, formData, hideData, name, onFinish, onFinishFailed, layoutStyle, layoutClass, bgcolor, ...rest } = props;
|
|
102
101
|
const cls = computed(()=>classnames("carefrees-form", props.class));
|
|
103
102
|
const formStyle = computed(()=>{
|
|
104
103
|
if (bgcolor) return [
|
|
@@ -124,9 +123,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
124
123
|
formInstance.value.onFinish = (...rest2)=>{
|
|
125
124
|
emits("finish", ...rest2);
|
|
126
125
|
};
|
|
127
|
-
formInstance.value.onValuesChange = (...rest2)=>{
|
|
128
|
-
emits("valuesChange", ...rest2);
|
|
129
|
-
};
|
|
130
126
|
formInstance.value.onFinishFailed = (...rest2)=>{
|
|
131
127
|
emits("finishFailed", ...rest2);
|
|
132
128
|
};
|
|
@@ -136,7 +132,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
136
132
|
event?.stopPropagation?.();
|
|
137
133
|
formInstance.value.submit?.();
|
|
138
134
|
};
|
|
139
|
-
useFormProvide(formInstance
|
|
135
|
+
useFormProvide(formInstance);
|
|
140
136
|
return (_ctx, _cache)=>(openBlock(), createElementBlock("form", {
|
|
141
137
|
class: normalizeClass(cls.value),
|
|
142
138
|
style: normalizeStyle(formStyle.value),
|
package/esm/interface/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, StyleValue
|
|
1
|
+
import { Component, StyleValue } from 'vue';
|
|
2
2
|
import { LayoutFormItemProps } from './layout.formItem';
|
|
3
3
|
import { FormLayoutProps } from './layout';
|
|
4
4
|
import type { FormInstanceBase, ValidateErrorEntity, FormItemAttrOptions } from '@carefrees/form-utils-vue-hooks';
|
|
@@ -16,8 +16,6 @@ export interface FormProps<T = any> extends FormLayoutProps {
|
|
|
16
16
|
layoutStyle?: StyleValue;
|
|
17
17
|
/**表单数据*/
|
|
18
18
|
formData?: Object;
|
|
19
|
-
/**值更新触发*/
|
|
20
|
-
onValuesChange?: (changedValues: Partial<T>, values: UnwrapNestedRefs<T>) => void;
|
|
21
19
|
/**提交保存 验证成功*/
|
|
22
20
|
onFinish?: (values: T) => void;
|
|
23
21
|
/**提交保存 验证失败*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carefrees/form-utils-vue",
|
|
3
3
|
"author": "SunLxy <1011771396@qq.com>",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.14",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "esm/index.js",
|
|
7
7
|
"module": "esm/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"vue": "^3.5.13"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@carefrees/form-utils": "^0.0.
|
|
28
|
-
"@carefrees/form-utils-vue-hooks": "^0.0.
|
|
27
|
+
"@carefrees/form-utils": "^0.0.14",
|
|
28
|
+
"@carefrees/form-utils-vue-hooks": "^0.0.14",
|
|
29
29
|
"async-validator": "~4.2.5",
|
|
30
30
|
"classnames": "2.5.1"
|
|
31
31
|
}
|
package/src/form/form.vue
CHANGED
|
@@ -29,7 +29,6 @@ const {
|
|
|
29
29
|
name,
|
|
30
30
|
onFinish,
|
|
31
31
|
onFinishFailed,
|
|
32
|
-
onValuesChange,
|
|
33
32
|
layoutStyle,
|
|
34
33
|
layoutClass,
|
|
35
34
|
bgcolor,
|
|
@@ -61,20 +60,17 @@ const emits = defineEmits(["finish", 'valuesChange', 'finishFailed'])
|
|
|
61
60
|
formInstance.value.onFinish = (...rest) => {
|
|
62
61
|
emits("finish", ...rest)
|
|
63
62
|
};
|
|
64
|
-
|
|
65
|
-
emits("valuesChange", ...rest)
|
|
66
|
-
};
|
|
63
|
+
|
|
67
64
|
formInstance.value.onFinishFailed = (...rest) => {
|
|
68
65
|
emits("finishFailed", ...rest)
|
|
69
66
|
};
|
|
70
67
|
useRegisterForm(formInstance, props.name)
|
|
71
|
-
|
|
72
68
|
const onSubmit = (event: Event) => {
|
|
73
69
|
event?.preventDefault?.();
|
|
74
70
|
event?.stopPropagation?.();
|
|
75
71
|
formInstance.value.submit?.();
|
|
76
72
|
}
|
|
77
73
|
|
|
78
|
-
useFormProvide(formInstance
|
|
74
|
+
useFormProvide(formInstance);
|
|
79
75
|
|
|
80
76
|
</script>
|
package/src/interface/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, StyleValue
|
|
1
|
+
import { Component, StyleValue } from 'vue';
|
|
2
2
|
import { LayoutFormItemProps } from './layout.formItem';
|
|
3
3
|
import { FormLayoutProps } from './layout';
|
|
4
4
|
import type { FormInstanceBase, ValidateErrorEntity, FormItemAttrOptions } from '@carefrees/form-utils-vue-hooks';
|
|
@@ -18,8 +18,6 @@ export interface FormProps<T = any> extends FormLayoutProps {
|
|
|
18
18
|
layoutStyle?: StyleValue;
|
|
19
19
|
/**表单数据*/
|
|
20
20
|
formData?: Object;
|
|
21
|
-
/**值更新触发*/
|
|
22
|
-
onValuesChange?: (changedValues: Partial<T>, values: UnwrapNestedRefs<T>) => void;
|
|
23
21
|
/**提交保存 验证成功*/
|
|
24
22
|
onFinish?: (values: T) => void;
|
|
25
23
|
/**提交保存 验证失败*/
|