@carefrees/form-utils-vue 0.0.11 → 0.0.13
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 +104 -2
- package/assets/index.css +23 -12
- package/esm/component.js +3 -0
- package/esm/form/form.js +161 -0
- package/esm/form/form.vue.d.ts +10 -7
- package/esm/form/index.d.ts +12 -12
- package/esm/form/index.js +4 -0
- package/esm/formItem/form.Item.base.js +157 -0
- package/esm/formItem/form.Item.base.vue.d.ts +7 -8
- package/esm/formItem/form.hide.item.js +122 -0
- package/esm/formItem/form.hide.item.vue.d.ts +7 -8
- package/esm/formItem/formItem.js +151 -0
- package/esm/formItem/formItem.vue.d.ts +6 -9
- package/esm/formItem/index.d.ts +26 -37
- package/esm/formItem/index.js +8 -0
- package/esm/index.d.ts +2 -2
- package/esm/index.js +13 -0
- package/esm/interface/index.d.ts +6 -11
- package/esm/interface/index.js +0 -0
- package/esm/interface/layout.d.ts +1 -1
- package/esm/interface/layout.formItem.d.ts +1 -1
- package/esm/interface/layout.formItem.js +0 -0
- package/esm/interface/layout.js +0 -0
- package/esm/layout/index.d.ts +24 -33
- package/esm/layout/index.js +8 -0
- package/esm/layout/layout.form.rows.js +21 -0
- package/esm/layout/layout.form.rows.vue.d.ts +8 -5
- package/esm/layout/layout.formItem.js +195 -0
- package/esm/layout/layout.formItem.vue.d.ts +6 -9
- package/esm/layout/layout.js +160 -0
- package/esm/layout/layout.vue.d.ts +6 -8
- package/esm/utils/index.js +1 -0
- package/esm/utils/withInstall.d.ts +2 -2
- package/esm/utils/withInstall.js +15 -0
- package/package.json +7 -8
- package/src/form/form.vue +21 -7
- package/src/formItem/form.Item.base.vue +5 -5
- package/src/formItem/form.hide.item.vue +3 -1
- package/src/formItem/formItem.vue +2 -1
- package/src/index.ts +1 -1
- package/src/interface/index.ts +6 -13
- package/src/interface/layout.formItem.ts +1 -2
- package/src/interface/layout.ts +2 -1
- package/src/layout/layout.formItem.vue +2 -1
- package/src/layout/layout.vue +2 -1
- package/esm/component.mjs +0 -12
- package/esm/form/form.vue.mjs +0 -110
- package/esm/form/form.vue2.mjs +0 -4
- package/esm/form/index.mjs +0 -6
- package/esm/formItem/form.Item.base.vue.mjs +0 -114
- package/esm/formItem/form.Item.base.vue2.mjs +0 -4
- package/esm/formItem/form.hide.item.vue.mjs +0 -78
- package/esm/formItem/form.hide.item.vue2.mjs +0 -4
- package/esm/formItem/formItem.vue.mjs +0 -102
- package/esm/formItem/formItem.vue2.mjs +0 -4
- package/esm/formItem/index.mjs +0 -12
- package/esm/hooks/attr/attr.FormItem.d.ts +0 -97
- package/esm/hooks/attr/attr.FormItem.mjs +0 -120
- package/esm/hooks/index.d.ts +0 -13
- package/esm/hooks/register/register.FormHideItem.d.ts +0 -9
- package/esm/hooks/register/register.FormHideItem.mjs +0 -38
- package/esm/hooks/register/register.FormItem.d.ts +0 -23
- package/esm/hooks/register/register.FormItem.mjs +0 -55
- package/esm/hooks/register/register.FormList.d.ts +0 -9
- package/esm/hooks/register/register.FormList.mjs +0 -43
- package/esm/hooks/register/register.form.d.ts +0 -3
- package/esm/hooks/register/register.form.mjs +0 -12
- package/esm/hooks/useAttrs.d.ts +0 -24
- package/esm/hooks/useAttrs.mjs +0 -43
- package/esm/hooks/useEffect.d.ts +0 -2
- package/esm/hooks/useEffect.mjs +0 -14
- package/esm/hooks/useForm.d.ts +0 -8
- package/esm/hooks/useForm.mjs +0 -26
- package/esm/hooks/useFormItem.d.ts +0 -7
- package/esm/hooks/useFormItem.mjs +0 -26
- package/esm/hooks/useFormItemParentName.d.ts +0 -18
- package/esm/hooks/useFormItemParentName.mjs +0 -37
- package/esm/hooks/useFormList.d.ts +0 -7
- package/esm/hooks/useFormList.mjs +0 -26
- package/esm/hooks/useHtmlFor.d.ts +0 -2
- package/esm/hooks/useHtmlFor.mjs +0 -11
- package/esm/hooks/useMultipleForm.d.ts +0 -7
- package/esm/hooks/useMultipleForm.mjs +0 -27
- package/esm/index.mjs +0 -59
- package/esm/instance/ruleIntsnace.d.ts +0 -49
- package/esm/instance/ruleIntsnace.mjs +0 -73
- package/esm/layout/index.mjs +0 -12
- package/esm/layout/layout.form.rows.vue.mjs +0 -31
- package/esm/layout/layout.form.rows.vue2.mjs +0 -4
- package/esm/layout/layout.formItem.vue.mjs +0 -216
- package/esm/layout/layout.formItem.vue2.mjs +0 -4
- package/esm/layout/layout.vue.mjs +0 -166
- package/esm/layout/layout.vue2.mjs +0 -4
- package/esm/utils/withInstall.mjs +0 -22
- package/lib/component.d.ts +0 -3
- package/lib/component.js +0 -12
- package/lib/form/form.vue.d.ts +0 -19
- package/lib/form/form.vue.js +0 -110
- package/lib/form/form.vue2.js +0 -4
- package/lib/form/index.d.ts +0 -37
- package/lib/form/index.js +0 -6
- package/lib/formItem/form.Item.base.vue.d.ts +0 -16
- package/lib/formItem/form.Item.base.vue.js +0 -114
- package/lib/formItem/form.Item.base.vue2.js +0 -4
- package/lib/formItem/form.hide.item.vue.d.ts +0 -16
- package/lib/formItem/form.hide.item.vue.js +0 -78
- package/lib/formItem/form.hide.item.vue2.js +0 -4
- package/lib/formItem/formItem.vue.d.ts +0 -18
- package/lib/formItem/formItem.vue.js +0 -102
- package/lib/formItem/formItem.vue2.js +0 -4
- package/lib/formItem/index.d.ts +0 -71
- package/lib/formItem/index.js +0 -12
- package/lib/hooks/attr/attr.FormItem.d.ts +0 -97
- package/lib/hooks/attr/attr.FormItem.js +0 -120
- package/lib/hooks/index.d.ts +0 -13
- package/lib/hooks/register/register.FormHideItem.d.ts +0 -9
- package/lib/hooks/register/register.FormHideItem.js +0 -38
- package/lib/hooks/register/register.FormItem.d.ts +0 -23
- package/lib/hooks/register/register.FormItem.js +0 -55
- package/lib/hooks/register/register.FormList.d.ts +0 -9
- package/lib/hooks/register/register.FormList.js +0 -43
- package/lib/hooks/register/register.form.d.ts +0 -3
- package/lib/hooks/register/register.form.js +0 -12
- package/lib/hooks/useAttrs.d.ts +0 -24
- package/lib/hooks/useAttrs.js +0 -43
- package/lib/hooks/useEffect.d.ts +0 -2
- package/lib/hooks/useEffect.js +0 -14
- package/lib/hooks/useForm.d.ts +0 -8
- package/lib/hooks/useForm.js +0 -26
- package/lib/hooks/useFormItem.d.ts +0 -7
- package/lib/hooks/useFormItem.js +0 -26
- package/lib/hooks/useFormItemParentName.d.ts +0 -18
- package/lib/hooks/useFormItemParentName.js +0 -37
- package/lib/hooks/useFormList.d.ts +0 -7
- package/lib/hooks/useFormList.js +0 -26
- package/lib/hooks/useHtmlFor.d.ts +0 -2
- package/lib/hooks/useHtmlFor.js +0 -11
- package/lib/hooks/useMultipleForm.d.ts +0 -7
- package/lib/hooks/useMultipleForm.js +0 -27
- package/lib/index.d.ts +0 -11
- package/lib/index.js +0 -59
- package/lib/instance/ruleIntsnace.d.ts +0 -49
- package/lib/instance/ruleIntsnace.js +0 -73
- package/lib/interface/index.d.ts +0 -36
- package/lib/interface/layout.d.ts +0 -28
- package/lib/interface/layout.formItem.d.ts +0 -39
- package/lib/layout/index.d.ts +0 -65
- package/lib/layout/index.js +0 -12
- package/lib/layout/layout.form.rows.vue.d.ts +0 -10
- package/lib/layout/layout.form.rows.vue.js +0 -31
- package/lib/layout/layout.form.rows.vue2.js +0 -4
- package/lib/layout/layout.formItem.vue.d.ts +0 -18
- package/lib/layout/layout.formItem.vue.js +0 -216
- package/lib/layout/layout.formItem.vue2.js +0 -4
- package/lib/layout/layout.vue.d.ts +0 -16
- package/lib/layout/layout.vue.js +0 -166
- package/lib/layout/layout.vue2.js +0 -4
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/withInstall.d.ts +0 -3
- package/lib/utils/withInstall.js +0 -22
- package/src/hooks/attr/attr.FormItem.tsx +0 -174
- package/src/hooks/index.ts +0 -13
- package/src/hooks/register/register.FormHideItem.ts +0 -45
- package/src/hooks/register/register.FormItem.ts +0 -80
- package/src/hooks/register/register.FormList.ts +0 -49
- package/src/hooks/register/register.form.ts +0 -12
- package/src/hooks/useAttrs.ts +0 -64
- package/src/hooks/useEffect.ts +0 -13
- package/src/hooks/useForm.ts +0 -28
- package/src/hooks/useFormItem.ts +0 -28
- package/src/hooks/useFormItemParentName.ts +0 -49
- package/src/hooks/useFormList.ts +0 -28
- package/src/hooks/useHtmlFor.ts +0 -9
- package/src/hooks/useMultipleForm.ts +0 -29
- package/src/instance/ruleIntsnace.ts +0 -105
- package/src/vite-env.d.ts +0 -1
package/src/interface/index.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FormItemAttrOptions } from '../hooks/attr/attr.FormItem';
|
|
1
|
+
import { Component, StyleValue, UnwrapNestedRefs } from 'vue';
|
|
3
2
|
import { LayoutFormItemProps } from './layout.formItem';
|
|
4
3
|
import { FormLayoutProps } from './layout';
|
|
5
|
-
import { FormInstanceBase, ValidateErrorEntity } from '@carefrees/form-utils';
|
|
6
|
-
|
|
7
|
-
export type ComputedRefBase<T> = ComputedRef<T> | Ref<T>;
|
|
8
|
-
|
|
9
|
-
export type PartialComputedRefs<T> = {
|
|
10
|
-
[K in keyof T]: ComputedRefBase<T[K]>;
|
|
11
|
-
};
|
|
4
|
+
import type { FormInstanceBase, ValidateErrorEntity, FormItemAttrOptions } from '@carefrees/form-utils-vue-hooks';
|
|
12
5
|
|
|
13
6
|
export interface FormItemProps extends FormItemAttrOptions, LayoutFormItemProps {
|
|
14
7
|
/**不进行样式渲染*/
|
|
@@ -18,13 +11,13 @@ export interface FormItemProps extends FormItemAttrOptions, LayoutFormItemProps
|
|
|
18
11
|
}
|
|
19
12
|
|
|
20
13
|
export interface FormProps<T = any> extends FormLayoutProps {
|
|
21
|
-
form?: FormInstanceBase
|
|
14
|
+
form?: FormInstanceBase<T>;
|
|
22
15
|
style?: StyleValue;
|
|
23
16
|
class?: string;
|
|
24
17
|
layoutClass?: string;
|
|
25
18
|
layoutStyle?: StyleValue;
|
|
26
19
|
/**表单数据*/
|
|
27
|
-
formData?:
|
|
20
|
+
formData?: Object;
|
|
28
21
|
/**值更新触发*/
|
|
29
22
|
onValuesChange?: (changedValues: Partial<T>, values: UnwrapNestedRefs<T>) => void;
|
|
30
23
|
/**提交保存 验证成功*/
|
|
@@ -35,6 +28,6 @@ export interface FormProps<T = any> extends FormLayoutProps {
|
|
|
35
28
|
hideData?: Record<string, boolean>;
|
|
36
29
|
/**表单名称*/
|
|
37
30
|
name?: string;
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
/**背景颜色*/
|
|
32
|
+
bgcolor?: string;
|
|
40
33
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { VNodeChild, StyleValue } from 'vue';
|
|
2
|
-
import { ComputedRefBase } from '
|
|
3
|
-
|
|
2
|
+
import type { ComputedRefBase } from '@carefrees/form-utils-vue-hooks';
|
|
4
3
|
export interface LayoutFormItemProps {
|
|
5
4
|
/**规则校验失败错误提示位置*/
|
|
6
5
|
errorLayout?: 'left-bottom' | 'right-bottom' | 'top-right' | 'top-left';
|
package/src/interface/layout.ts
CHANGED
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
import clx from 'classnames';
|
|
50
50
|
import { defineProps, withDefaults, toValue, computed, StyleValue } from "vue"
|
|
51
51
|
import type { LayoutFormItemProps } from "../interface/layout.formItem"
|
|
52
|
-
import { useAttrsInject } from "
|
|
52
|
+
import { useAttrsInject } from "@carefrees/form-utils-vue-hooks"
|
|
53
|
+
|
|
53
54
|
const preCls = 'carefrees-form-item';
|
|
54
55
|
defineOptions({
|
|
55
56
|
name: 'LayoutFormItem',
|
package/src/layout/layout.vue
CHANGED
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
import clx from 'classnames';
|
|
31
31
|
import { defineProps, withDefaults, toValue, computed, StyleValue } from "vue"
|
|
32
32
|
import type { FormLayoutProps } from "../interface/layout"
|
|
33
|
-
import { useAttrsInject, useAttrsProvide } from "
|
|
33
|
+
import { useAttrsInject, useAttrsProvide } from "@carefrees/form-utils-vue-hooks"
|
|
34
|
+
|
|
34
35
|
const preCls = 'carefrees-form-layout';
|
|
35
36
|
|
|
36
37
|
const attrs = useAttrsInject();
|
package/esm/component.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Form } from "./form/index.mjs";
|
|
2
|
-
import { FormHideItem, FormItem, FormItemBase } from "./formItem/index.mjs";
|
|
3
|
-
import { FormLayoutRows, Layout, LayoutFormItem } from "./layout/index.mjs";
|
|
4
|
-
export {
|
|
5
|
-
Form,
|
|
6
|
-
FormHideItem,
|
|
7
|
-
FormItem,
|
|
8
|
-
FormItemBase,
|
|
9
|
-
FormLayoutRows,
|
|
10
|
-
Layout,
|
|
11
|
-
LayoutFormItem
|
|
12
|
-
};
|
package/esm/form/form.vue.mjs
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { defineComponent, computed, reactive, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createVNode, mergeProps, withCtx, renderSlot } from "vue";
|
|
2
|
-
import { useRegisterForm } from "../hooks/register/register.form.mjs";
|
|
3
|
-
import { useForm, useFormProvide } from "../hooks/useForm.mjs";
|
|
4
|
-
import _sfc_main$1 from "../layout/layout.vue.mjs";
|
|
5
|
-
import clx from "classnames";
|
|
6
|
-
const __default__ = defineComponent({
|
|
7
|
-
name: "Form",
|
|
8
|
-
inheritAttrs: false
|
|
9
|
-
// 可选,防止属性自动应用到根元素
|
|
10
|
-
});
|
|
11
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
-
...__default__,
|
|
13
|
-
props: {
|
|
14
|
-
form: {},
|
|
15
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
16
|
-
class: {},
|
|
17
|
-
layoutClass: {},
|
|
18
|
-
layoutStyle: { type: [Boolean, null, String, Object, Array] },
|
|
19
|
-
formData: {},
|
|
20
|
-
onValuesChange: {},
|
|
21
|
-
onFinish: {},
|
|
22
|
-
onFinishFailed: {},
|
|
23
|
-
hideData: {},
|
|
24
|
-
name: {},
|
|
25
|
-
hideRuleData: {},
|
|
26
|
-
title: { type: [Object, String, Number, Boolean, null, Array] },
|
|
27
|
-
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
28
|
-
isAllColSpan: { type: Boolean },
|
|
29
|
-
headerClass: {},
|
|
30
|
-
bodyClass: {},
|
|
31
|
-
headerStyle: { type: [Boolean, null, String, Object, Array] },
|
|
32
|
-
bodyStyle: { type: [Boolean, null, String, Object, Array] },
|
|
33
|
-
bordered: { type: Boolean },
|
|
34
|
-
colCount: {},
|
|
35
|
-
gap: {},
|
|
36
|
-
errorLayout: {},
|
|
37
|
-
labelMode: {},
|
|
38
|
-
showColon: {},
|
|
39
|
-
formItemClass: {},
|
|
40
|
-
formItemStyle: {},
|
|
41
|
-
formItemLabelClass: {},
|
|
42
|
-
formItemLabelStyle: {}
|
|
43
|
-
},
|
|
44
|
-
emits: ["finish", "valuesChange", "finishFailed"],
|
|
45
|
-
setup(__props, { emit: __emit }) {
|
|
46
|
-
const props = __props;
|
|
47
|
-
const {
|
|
48
|
-
form,
|
|
49
|
-
style,
|
|
50
|
-
formData,
|
|
51
|
-
hideData,
|
|
52
|
-
hideRuleData,
|
|
53
|
-
name,
|
|
54
|
-
onFinish,
|
|
55
|
-
onFinishFailed,
|
|
56
|
-
onValuesChange,
|
|
57
|
-
layoutStyle,
|
|
58
|
-
layoutClass,
|
|
59
|
-
...rest
|
|
60
|
-
} = props;
|
|
61
|
-
const cls = computed(() => clx("carefrees-form", props.class));
|
|
62
|
-
const formInstance = useForm(props.form);
|
|
63
|
-
formInstance.value.ctor(reactive(props.formData || {}), reactive(props.hideData || {}), reactive(props.hideRuleData || {}));
|
|
64
|
-
const emits = __emit;
|
|
65
|
-
formInstance.value.onFinish = (...rest2) => {
|
|
66
|
-
emits("finish", ...rest2);
|
|
67
|
-
};
|
|
68
|
-
formInstance.value.onValuesChange = (...rest2) => {
|
|
69
|
-
emits("valuesChange", ...rest2);
|
|
70
|
-
};
|
|
71
|
-
formInstance.value.onFinishFailed = (...rest2) => {
|
|
72
|
-
emits("finishFailed", ...rest2);
|
|
73
|
-
};
|
|
74
|
-
useRegisterForm(formInstance.value, props.name);
|
|
75
|
-
const onSubmit = (event) => {
|
|
76
|
-
var _a, _b, _c, _d;
|
|
77
|
-
(_a = event == null ? void 0 : event.preventDefault) == null ? void 0 : _a.call(event);
|
|
78
|
-
(_b = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _b.call(event);
|
|
79
|
-
(_d = (_c = formInstance.value).submit) == null ? void 0 : _d.call(_c);
|
|
80
|
-
};
|
|
81
|
-
useFormProvide(formInstance.value);
|
|
82
|
-
return (_ctx, _cache) => {
|
|
83
|
-
return openBlock(), createElementBlock(
|
|
84
|
-
"form",
|
|
85
|
-
{
|
|
86
|
-
class: normalizeClass(cls.value),
|
|
87
|
-
style: normalizeStyle(unref(style)),
|
|
88
|
-
onSubmit
|
|
89
|
-
},
|
|
90
|
-
[
|
|
91
|
-
createVNode(_sfc_main$1, mergeProps(rest, {
|
|
92
|
-
class: unref(layoutClass),
|
|
93
|
-
style: unref(layoutStyle)
|
|
94
|
-
}), {
|
|
95
|
-
default: withCtx(() => [
|
|
96
|
-
renderSlot(_ctx.$slots, "default")
|
|
97
|
-
]),
|
|
98
|
-
_: 3
|
|
99
|
-
/* FORWARDED */
|
|
100
|
-
}, 16, ["class", "style"])
|
|
101
|
-
],
|
|
102
|
-
38
|
|
103
|
-
/* CLASS, STYLE, NEED_HYDRATION */
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
export {
|
|
109
|
-
_sfc_main as default
|
|
110
|
-
};
|
package/esm/form/form.vue2.mjs
DELETED
package/esm/form/index.mjs
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { defineComponent, useSlots, computed, toValue, createBlock, openBlock, resolveDynamicComponent, normalizeProps, mergeProps, unref, normalizeClass, normalizeStyle, createSlots, withCtx, guardReactiveProps, renderList, renderSlot } from "vue";
|
|
2
|
-
import { useFormItemAttr } from "../hooks/attr/attr.FormItem.mjs";
|
|
3
|
-
import _sfc_main$1 from "../layout/layout.formItem.vue.mjs";
|
|
4
|
-
import { useFormItemParentNameProvide } from "../hooks/useFormItemParentName.mjs";
|
|
5
|
-
const __default__ = defineComponent({
|
|
6
|
-
name: "FormItemBase",
|
|
7
|
-
inheritAttrs: false
|
|
8
|
-
// 可选,防止属性自动应用到根元素
|
|
9
|
-
});
|
|
10
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
-
...__default__,
|
|
12
|
-
props: {
|
|
13
|
-
noStyle: { type: Boolean },
|
|
14
|
-
input: {},
|
|
15
|
-
dependencies: {},
|
|
16
|
-
noticeOnlyRuleDataField: {},
|
|
17
|
-
isNoticeParentField: { type: Boolean },
|
|
18
|
-
noticeWatchField: {},
|
|
19
|
-
preserve: { type: Boolean },
|
|
20
|
-
useRules: {},
|
|
21
|
-
useAttrs: {},
|
|
22
|
-
inputAttrs: {},
|
|
23
|
-
valuePropName: {},
|
|
24
|
-
getValuePath: {},
|
|
25
|
-
getValueFromEvent: {},
|
|
26
|
-
formatValue: {},
|
|
27
|
-
onAfterUpdate: {},
|
|
28
|
-
trigger: {},
|
|
29
|
-
name: {},
|
|
30
|
-
rules: {},
|
|
31
|
-
sort: {},
|
|
32
|
-
isJoinParentField: { type: Boolean },
|
|
33
|
-
errorLayout: {},
|
|
34
|
-
required: { type: Boolean },
|
|
35
|
-
labelMode: {},
|
|
36
|
-
onlyRuleStyle: { type: Boolean },
|
|
37
|
-
label: { type: [Object, String, Number, Boolean, null, Array] },
|
|
38
|
-
helpText: { type: [Object, String, Number, Boolean, null, Array] },
|
|
39
|
-
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
40
|
-
showColon: { type: Boolean },
|
|
41
|
-
colSpan: {},
|
|
42
|
-
rowSpan: {},
|
|
43
|
-
htmlFor: {},
|
|
44
|
-
validateResult: {},
|
|
45
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
46
|
-
class: {},
|
|
47
|
-
labelStyle: { type: [Boolean, null, String, Object, Array] },
|
|
48
|
-
labelClass: {}
|
|
49
|
-
},
|
|
50
|
-
setup(__props) {
|
|
51
|
-
const props = __props;
|
|
52
|
-
const formAttrs = useFormItemAttr(props);
|
|
53
|
-
useFormItemParentNameProvide({
|
|
54
|
-
name: formAttrs.newName,
|
|
55
|
-
sort: formAttrs.newSort
|
|
56
|
-
});
|
|
57
|
-
const slots = useSlots();
|
|
58
|
-
const isRequired = computed(() => {
|
|
59
|
-
var _a, _b, _c;
|
|
60
|
-
return !!props.required || !!((_c = toValue((_b = (_a = formAttrs.ruleInstance) == null ? void 0 : _a.value) == null ? void 0 : _b.rules) || []) == null ? void 0 : _c.find((item) => {
|
|
61
|
-
return item.required;
|
|
62
|
-
}));
|
|
63
|
-
});
|
|
64
|
-
return (_ctx, _cache) => {
|
|
65
|
-
return props.noStyle ? (openBlock(), createBlock(
|
|
66
|
-
resolveDynamicComponent(props.input),
|
|
67
|
-
normalizeProps(mergeProps({ key: 0 }, toValue(unref(formAttrs).attrsLastData))),
|
|
68
|
-
null,
|
|
69
|
-
16
|
|
70
|
-
/* FULL_PROPS */
|
|
71
|
-
)) : (openBlock(), createBlock(_sfc_main$1, {
|
|
72
|
-
key: 1,
|
|
73
|
-
label: props.label,
|
|
74
|
-
required: isRequired.value,
|
|
75
|
-
"error-layout": props.errorLayout,
|
|
76
|
-
"label-mode": props.labelMode,
|
|
77
|
-
"only-rule-style": props.onlyRuleStyle,
|
|
78
|
-
"show-colon": props.showColon,
|
|
79
|
-
"col-span": props.colSpan,
|
|
80
|
-
"row-span": props.rowSpan,
|
|
81
|
-
"html-for": unref(formAttrs).htmlFor,
|
|
82
|
-
style: normalizeStyle(props.style),
|
|
83
|
-
class: normalizeClass(props.class),
|
|
84
|
-
"label-style": props.labelStyle,
|
|
85
|
-
"label-class": props.labelClass,
|
|
86
|
-
"validate-result": unref(formAttrs).validateResult
|
|
87
|
-
}, createSlots({
|
|
88
|
-
default: withCtx(() => [
|
|
89
|
-
(openBlock(), createBlock(
|
|
90
|
-
resolveDynamicComponent(props.input),
|
|
91
|
-
normalizeProps(guardReactiveProps(toValue(unref(formAttrs).attrsLastData))),
|
|
92
|
-
null,
|
|
93
|
-
16
|
|
94
|
-
/* FULL_PROPS */
|
|
95
|
-
))
|
|
96
|
-
]),
|
|
97
|
-
_: 2
|
|
98
|
-
/* DYNAMIC */
|
|
99
|
-
}, [
|
|
100
|
-
renderList(slots, (item, name) => {
|
|
101
|
-
return {
|
|
102
|
-
name,
|
|
103
|
-
fn: withCtx((slotProps) => [
|
|
104
|
-
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
|
|
105
|
-
])
|
|
106
|
-
};
|
|
107
|
-
})
|
|
108
|
-
]), 1032, ["label", "required", "error-layout", "label-mode", "only-rule-style", "show-colon", "col-span", "row-span", "html-for", "style", "class", "label-style", "label-class", "validate-result"]));
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
export {
|
|
113
|
-
_sfc_main as default
|
|
114
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { defineComponent, useSlots, createBlock, createCommentVNode, unref, openBlock, normalizeProps, mergeProps, createSlots, renderList, withCtx, renderSlot, guardReactiveProps } from "vue";
|
|
2
|
-
import _sfc_main$1 from "./form.Item.base.vue.mjs";
|
|
3
|
-
import { useRegisterFormHideItem } from "../hooks/register/register.FormHideItem.mjs";
|
|
4
|
-
const __default__ = defineComponent({
|
|
5
|
-
name: "FormHideItem",
|
|
6
|
-
inheritAttrs: false
|
|
7
|
-
// 可选,防止属性自动应用到根元素
|
|
8
|
-
});
|
|
9
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
-
...__default__,
|
|
11
|
-
props: {
|
|
12
|
-
noStyle: { type: Boolean },
|
|
13
|
-
input: {},
|
|
14
|
-
dependencies: {},
|
|
15
|
-
noticeOnlyRuleDataField: {},
|
|
16
|
-
isNoticeParentField: { type: Boolean },
|
|
17
|
-
noticeWatchField: {},
|
|
18
|
-
preserve: { type: Boolean },
|
|
19
|
-
useRules: {},
|
|
20
|
-
useAttrs: {},
|
|
21
|
-
inputAttrs: {},
|
|
22
|
-
valuePropName: {},
|
|
23
|
-
getValuePath: {},
|
|
24
|
-
getValueFromEvent: {},
|
|
25
|
-
formatValue: {},
|
|
26
|
-
onAfterUpdate: {},
|
|
27
|
-
trigger: {},
|
|
28
|
-
name: {},
|
|
29
|
-
rules: {},
|
|
30
|
-
sort: {},
|
|
31
|
-
isJoinParentField: { type: Boolean },
|
|
32
|
-
errorLayout: {},
|
|
33
|
-
required: { type: Boolean },
|
|
34
|
-
labelMode: {},
|
|
35
|
-
onlyRuleStyle: { type: Boolean },
|
|
36
|
-
label: { type: [Object, String, Number, Boolean, null, Array] },
|
|
37
|
-
helpText: { type: [Object, String, Number, Boolean, null, Array] },
|
|
38
|
-
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
39
|
-
showColon: { type: Boolean },
|
|
40
|
-
colSpan: {},
|
|
41
|
-
rowSpan: {},
|
|
42
|
-
htmlFor: {},
|
|
43
|
-
validateResult: {},
|
|
44
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
45
|
-
class: {},
|
|
46
|
-
labelStyle: { type: [Boolean, null, String, Object, Array] },
|
|
47
|
-
labelClass: {}
|
|
48
|
-
},
|
|
49
|
-
setup(__props) {
|
|
50
|
-
const props = __props;
|
|
51
|
-
const slots = useSlots();
|
|
52
|
-
const { isHide } = useRegisterFormHideItem({ name: props.name, sort: props.sort, isJoinParentField: props.isJoinParentField });
|
|
53
|
-
return (_ctx, _cache) => {
|
|
54
|
-
return !unref(isHide) ? (openBlock(), createBlock(
|
|
55
|
-
_sfc_main$1,
|
|
56
|
-
normalizeProps(mergeProps({ key: 0 }, props)),
|
|
57
|
-
createSlots({
|
|
58
|
-
_: 2
|
|
59
|
-
/* DYNAMIC */
|
|
60
|
-
}, [
|
|
61
|
-
renderList(slots, (item, name) => {
|
|
62
|
-
return {
|
|
63
|
-
name,
|
|
64
|
-
fn: withCtx((slotProps) => [
|
|
65
|
-
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
|
|
66
|
-
])
|
|
67
|
-
};
|
|
68
|
-
})
|
|
69
|
-
]),
|
|
70
|
-
1040
|
|
71
|
-
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
72
|
-
)) : createCommentVNode("v-if", true);
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
export {
|
|
77
|
-
_sfc_main as default
|
|
78
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { defineComponent, useSlots, createBlock, openBlock, normalizeProps, mergeProps, createSlots, renderList, withCtx, renderSlot, guardReactiveProps, normalizeClass, normalizeStyle } from "vue";
|
|
2
|
-
import _sfc_main$2 from "../layout/layout.formItem.vue.mjs";
|
|
3
|
-
import _sfc_main$1 from "./form.Item.base.vue.mjs";
|
|
4
|
-
const __default__ = defineComponent({
|
|
5
|
-
name: "FormItem",
|
|
6
|
-
inheritAttrs: false
|
|
7
|
-
// 可选,防止属性自动应用到根元素
|
|
8
|
-
});
|
|
9
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
-
...__default__,
|
|
11
|
-
props: {
|
|
12
|
-
noStyle: { type: Boolean },
|
|
13
|
-
input: {},
|
|
14
|
-
dependencies: {},
|
|
15
|
-
noticeOnlyRuleDataField: {},
|
|
16
|
-
isNoticeParentField: { type: Boolean },
|
|
17
|
-
noticeWatchField: {},
|
|
18
|
-
preserve: { type: Boolean },
|
|
19
|
-
useRules: {},
|
|
20
|
-
useAttrs: {},
|
|
21
|
-
inputAttrs: {},
|
|
22
|
-
valuePropName: {},
|
|
23
|
-
getValuePath: {},
|
|
24
|
-
getValueFromEvent: {},
|
|
25
|
-
formatValue: {},
|
|
26
|
-
onAfterUpdate: {},
|
|
27
|
-
trigger: {},
|
|
28
|
-
name: {},
|
|
29
|
-
rules: {},
|
|
30
|
-
sort: {},
|
|
31
|
-
isJoinParentField: { type: Boolean },
|
|
32
|
-
errorLayout: {},
|
|
33
|
-
required: { type: Boolean },
|
|
34
|
-
labelMode: {},
|
|
35
|
-
onlyRuleStyle: { type: Boolean },
|
|
36
|
-
label: { type: [Object, String, Number, Boolean, null, Array] },
|
|
37
|
-
helpText: { type: [Object, String, Number, Boolean, null, Array] },
|
|
38
|
-
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
39
|
-
showColon: { type: Boolean },
|
|
40
|
-
colSpan: {},
|
|
41
|
-
rowSpan: {},
|
|
42
|
-
htmlFor: {},
|
|
43
|
-
validateResult: {},
|
|
44
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
45
|
-
class: {},
|
|
46
|
-
labelStyle: { type: [Boolean, null, String, Object, Array] },
|
|
47
|
-
labelClass: {}
|
|
48
|
-
},
|
|
49
|
-
setup(__props) {
|
|
50
|
-
const props = __props;
|
|
51
|
-
const slots = useSlots();
|
|
52
|
-
return (_ctx, _cache) => {
|
|
53
|
-
return props.name ? (openBlock(), createBlock(
|
|
54
|
-
_sfc_main$1,
|
|
55
|
-
normalizeProps(mergeProps({ key: 0 }, props)),
|
|
56
|
-
createSlots({
|
|
57
|
-
_: 2
|
|
58
|
-
/* DYNAMIC */
|
|
59
|
-
}, [
|
|
60
|
-
renderList(slots, (_, name) => {
|
|
61
|
-
return {
|
|
62
|
-
name,
|
|
63
|
-
fn: withCtx((slotProps) => [
|
|
64
|
-
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
|
|
65
|
-
])
|
|
66
|
-
};
|
|
67
|
-
})
|
|
68
|
-
]),
|
|
69
|
-
1040
|
|
70
|
-
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
71
|
-
)) : (openBlock(), createBlock(_sfc_main$2, {
|
|
72
|
-
key: 1,
|
|
73
|
-
label: props.label,
|
|
74
|
-
errorLayout: props.errorLayout,
|
|
75
|
-
labelMode: props.labelMode,
|
|
76
|
-
onlyRuleStyle: props.onlyRuleStyle,
|
|
77
|
-
showColon: props.showColon,
|
|
78
|
-
colSpan: props.colSpan,
|
|
79
|
-
rowSpan: props.rowSpan,
|
|
80
|
-
style: normalizeStyle(props.style),
|
|
81
|
-
class: normalizeClass(props.class),
|
|
82
|
-
labelStyle: props.labelStyle,
|
|
83
|
-
labelClass: props.labelClass
|
|
84
|
-
}, createSlots({
|
|
85
|
-
_: 2
|
|
86
|
-
/* DYNAMIC */
|
|
87
|
-
}, [
|
|
88
|
-
renderList(slots, (_, name) => {
|
|
89
|
-
return {
|
|
90
|
-
name,
|
|
91
|
-
fn: withCtx((slotProps) => [
|
|
92
|
-
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
|
|
93
|
-
])
|
|
94
|
-
};
|
|
95
|
-
})
|
|
96
|
-
]), 1032, ["label", "errorLayout", "labelMode", "onlyRuleStyle", "showColon", "colSpan", "rowSpan", "style", "class", "labelStyle", "labelClass"]));
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
export {
|
|
101
|
-
_sfc_main as default
|
|
102
|
-
};
|
package/esm/formItem/index.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import _sfc_main from "./form.Item.base.vue.mjs";
|
|
2
|
-
import _sfc_main$1 from "./formItem.vue.mjs";
|
|
3
|
-
import _sfc_main$2 from "./form.hide.item.vue.mjs";
|
|
4
|
-
import { withInstall } from "../utils/withInstall.mjs";
|
|
5
|
-
const FormItemBase = withInstall(_sfc_main);
|
|
6
|
-
const FormItem = withInstall(_sfc_main$1);
|
|
7
|
-
const FormHideItem = withInstall(_sfc_main$2);
|
|
8
|
-
export {
|
|
9
|
-
FormHideItem,
|
|
10
|
-
FormItem,
|
|
11
|
-
FormItemBase
|
|
12
|
-
};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { FormInstanceBase, FormItemInstanceBase } from '@carefrees/form-utils';
|
|
2
|
-
import { RegisterFormItemOptions } from './../register/register.FormItem';
|
|
3
|
-
import { Ref } from 'vue';
|
|
4
|
-
import { RuleInstanceBase2 } from '../../instance/ruleIntsnace';
|
|
5
|
-
export interface FormItemAttrOptions extends RegisterFormItemOptions {
|
|
6
|
-
/**依赖更新项*/
|
|
7
|
-
dependencies?: string[];
|
|
8
|
-
/**通知 只用于校验规则提示 字段 */
|
|
9
|
-
noticeOnlyRuleDataField?: string[];
|
|
10
|
-
/**通知父级字段监听方法更新*/
|
|
11
|
-
isNoticeParentField?: boolean;
|
|
12
|
-
/**通知watch监听方法更新*/
|
|
13
|
-
noticeWatchField?: string[];
|
|
14
|
-
/**是否保护值(不进行表单项组件卸载重置初始值)*/
|
|
15
|
-
preserve?: boolean;
|
|
16
|
-
/**重写规则*/
|
|
17
|
-
useRules?: (ruleInstance: Ref<RuleInstanceBase2>, form: FormInstanceBase, formItemInstance: FormItemInstanceBase) => void;
|
|
18
|
-
/**输入框属性重写*/
|
|
19
|
-
useAttrs?: (attrs: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase) => any;
|
|
20
|
-
/**输入框属性*/
|
|
21
|
-
inputAttrs?: Object;
|
|
22
|
-
/**传递组件字段*/
|
|
23
|
-
valuePropName?: string;
|
|
24
|
-
/**取值字段(默认和valuePropName值相同)*/
|
|
25
|
-
getValuePath?: string;
|
|
26
|
-
/**自定义获取值*/
|
|
27
|
-
getValueFromEvent?: (event: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase) => any;
|
|
28
|
-
/**值格式化*/
|
|
29
|
-
formatValue?: (value: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase, event: any) => any;
|
|
30
|
-
/**触发数据更新之后触发(用于数据联动之类的)*/
|
|
31
|
-
onAfterUpdate?: (value: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase, event: any) => void;
|
|
32
|
-
/**事件名称*/
|
|
33
|
-
trigger?: string;
|
|
34
|
-
}
|
|
35
|
-
/**表单项参数*/
|
|
36
|
-
export declare const useFormItemAttr: (options: FormItemAttrOptions) => {
|
|
37
|
-
valuePropName: string;
|
|
38
|
-
htmlFor: import('vue').ComputedRef<string>;
|
|
39
|
-
onChange: (event: any) => void;
|
|
40
|
-
formItemInstance: FormItemInstanceBase;
|
|
41
|
-
form: FormInstanceBase<any>;
|
|
42
|
-
ruleInstance: Ref<RuleInstanceBase2, RuleInstanceBase2>;
|
|
43
|
-
newAttrs: import('vue').ComputedRef<{
|
|
44
|
-
name: string;
|
|
45
|
-
id: string;
|
|
46
|
-
constructor: Function;
|
|
47
|
-
toString(): string;
|
|
48
|
-
toLocaleString(): string;
|
|
49
|
-
valueOf(): Object;
|
|
50
|
-
hasOwnProperty(v: PropertyKey): boolean;
|
|
51
|
-
isPrototypeOf(v: Object): boolean;
|
|
52
|
-
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
53
|
-
}>;
|
|
54
|
-
attrsLastData: Ref<{
|
|
55
|
-
name: string;
|
|
56
|
-
id: string;
|
|
57
|
-
constructor: Function;
|
|
58
|
-
toString: () => string;
|
|
59
|
-
toLocaleString: () => string;
|
|
60
|
-
valueOf: () => Object;
|
|
61
|
-
hasOwnProperty: (v: PropertyKey) => boolean;
|
|
62
|
-
isPrototypeOf: (v: Object) => boolean;
|
|
63
|
-
propertyIsEnumerable: (v: PropertyKey) => boolean;
|
|
64
|
-
}, {
|
|
65
|
-
name: string;
|
|
66
|
-
id: string;
|
|
67
|
-
constructor: Function;
|
|
68
|
-
toString(): string;
|
|
69
|
-
toLocaleString(): string;
|
|
70
|
-
valueOf(): Object;
|
|
71
|
-
hasOwnProperty(v: PropertyKey): boolean;
|
|
72
|
-
isPrototypeOf(v: Object): boolean;
|
|
73
|
-
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
74
|
-
} | {
|
|
75
|
-
name: string;
|
|
76
|
-
id: string;
|
|
77
|
-
constructor: Function;
|
|
78
|
-
toString: () => string;
|
|
79
|
-
toLocaleString: () => string;
|
|
80
|
-
valueOf: () => Object;
|
|
81
|
-
hasOwnProperty: (v: PropertyKey) => boolean;
|
|
82
|
-
isPrototypeOf: (v: Object) => boolean;
|
|
83
|
-
propertyIsEnumerable: (v: PropertyKey) => boolean;
|
|
84
|
-
}>;
|
|
85
|
-
validateResult: Ref<{
|
|
86
|
-
tip: string | (string | undefined)[];
|
|
87
|
-
isInvalid: boolean;
|
|
88
|
-
}, {
|
|
89
|
-
tip: string | (string | undefined)[];
|
|
90
|
-
isInvalid: boolean;
|
|
91
|
-
} | {
|
|
92
|
-
tip: string | (string | undefined)[];
|
|
93
|
-
isInvalid: boolean;
|
|
94
|
-
}>;
|
|
95
|
-
newSort: import('vue').ComputedRef<string>;
|
|
96
|
-
newName: import('vue').ComputedRef<string>;
|
|
97
|
-
};
|