@carefrees/form-utils-vue 0.0.11 → 0.0.12
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 +56 -2
- package/assets/index.css +23 -12
- package/esm/component.js +3 -0
- package/esm/form/form.js +156 -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 +162 -0
- package/esm/formItem/form.Item.base.vue.d.ts +6 -8
- package/esm/formItem/form.hide.item.js +126 -0
- package/esm/formItem/form.hide.item.vue.d.ts +6 -8
- package/esm/formItem/formItem.js +155 -0
- package/esm/formItem/formItem.vue.d.ts +6 -9
- package/esm/formItem/index.d.ts +24 -37
- package/esm/formItem/index.js +8 -0
- package/esm/hooks/attr/attr.FormItem.d.ts +5 -5
- package/esm/hooks/attr/attr.FormItem.js +97 -0
- package/esm/hooks/index.js +13 -0
- package/esm/hooks/register/register.FormHideItem.d.ts +2 -2
- package/esm/hooks/register/register.FormHideItem.js +42 -0
- package/esm/hooks/register/register.FormItem.d.ts +9 -6
- package/esm/hooks/register/register.FormItem.js +67 -0
- package/esm/hooks/register/register.FormList.d.ts +3 -3
- package/esm/hooks/register/register.FormList.js +42 -0
- package/esm/hooks/register/register.form.d.ts +1 -1
- package/esm/hooks/register/register.form.js +10 -0
- package/esm/hooks/useAttrs.d.ts +1 -0
- package/esm/hooks/useAttrs.js +26 -0
- package/esm/hooks/useEffect.js +12 -0
- package/esm/hooks/useForm.d.ts +1 -1
- package/esm/hooks/useForm.js +17 -0
- package/esm/hooks/useFormItem.js +17 -0
- package/esm/hooks/useFormItemParentName.js +47 -0
- package/esm/hooks/useFormList.js +17 -0
- package/esm/hooks/useHtmlFor.d.ts +1 -1
- package/esm/hooks/useHtmlFor.js +7 -0
- package/esm/hooks/useMultipleForm.d.ts +1 -1
- package/esm/hooks/useMultipleForm.js +18 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +13 -0
- package/esm/instance/ruleIntsnace.d.ts +1 -1
- package/esm/instance/ruleIntsnace.js +65 -0
- package/esm/interface/index.d.ts +2 -0
- package/esm/interface/index.js +0 -0
- 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 +6 -8
- package/src/form/form.vue +8 -1
- package/src/interface/index.ts +2 -0
- 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.mjs +0 -120
- package/esm/hooks/register/register.FormHideItem.mjs +0 -38
- package/esm/hooks/register/register.FormItem.mjs +0 -55
- package/esm/hooks/register/register.FormList.mjs +0 -43
- package/esm/hooks/register/register.form.mjs +0 -12
- package/esm/hooks/useAttrs.mjs +0 -43
- package/esm/hooks/useEffect.mjs +0 -14
- package/esm/hooks/useForm.mjs +0 -26
- package/esm/hooks/useFormItem.mjs +0 -26
- package/esm/hooks/useFormItemParentName.mjs +0 -37
- package/esm/hooks/useFormList.mjs +0 -26
- package/esm/hooks/useHtmlFor.mjs +0 -11
- package/esm/hooks/useMultipleForm.mjs +0 -27
- package/esm/index.mjs +0 -59
- 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/vite-env.d.ts +0 -1
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { defineComponent, useSlots, computed, toValue, createElementBlock, openBlock, normalizeClass, normalizeStyle, createCommentVNode, createElementVNode, renderSlot, Fragment, createTextVNode, toDisplayString } from "vue";
|
|
2
|
-
import clx from "classnames";
|
|
3
|
-
import { useAttrsInject, useAttrsProvide } from "../hooks/useAttrs.mjs";
|
|
4
|
-
const __default__ = defineComponent({
|
|
5
|
-
name: "Layout",
|
|
6
|
-
inheritAttrs: false
|
|
7
|
-
// 可选,防止属性自动应用到根元素
|
|
8
|
-
});
|
|
9
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
-
...__default__,
|
|
11
|
-
props: {
|
|
12
|
-
title: { type: [Object, String, Number, Boolean, null, Array] },
|
|
13
|
-
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
14
|
-
isAllColSpan: { type: Boolean },
|
|
15
|
-
class: {},
|
|
16
|
-
headerClass: {},
|
|
17
|
-
bodyClass: {},
|
|
18
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
19
|
-
headerStyle: { type: [Boolean, null, String, Object, Array] },
|
|
20
|
-
bodyStyle: { type: [Boolean, null, String, Object, Array] },
|
|
21
|
-
bordered: { type: Boolean },
|
|
22
|
-
colCount: {},
|
|
23
|
-
gap: {},
|
|
24
|
-
errorLayout: {},
|
|
25
|
-
labelMode: {},
|
|
26
|
-
showColon: {},
|
|
27
|
-
formItemClass: {},
|
|
28
|
-
formItemStyle: {},
|
|
29
|
-
formItemLabelClass: {},
|
|
30
|
-
formItemLabelStyle: {}
|
|
31
|
-
},
|
|
32
|
-
setup(__props) {
|
|
33
|
-
const preCls = "carefrees-form-layout";
|
|
34
|
-
const attrs = useAttrsInject();
|
|
35
|
-
const props = __props;
|
|
36
|
-
const solts = useSlots();
|
|
37
|
-
const colCount = computed(() => toValue(props.colCount) ?? toValue(attrs.value.colCount));
|
|
38
|
-
const errorLayout = computed(() => toValue(props.errorLayout) ?? toValue(attrs.value.errorLayout));
|
|
39
|
-
const labelMode = computed(() => toValue(props.labelMode) ?? toValue(attrs.value.labelMode));
|
|
40
|
-
const showColon = computed(() => toValue(props.showColon) ?? toValue(attrs.value.showColon));
|
|
41
|
-
const formItemClass = computed(() => toValue(props.formItemClass) ?? toValue(attrs.value.formItemClass));
|
|
42
|
-
const formItemStyle = computed(() => toValue(props.formItemStyle) ?? toValue(attrs.value.formItemStyle));
|
|
43
|
-
const formItemLabelClass = computed(() => toValue(props.formItemLabelClass) ?? toValue(attrs.value.formItemLabelClass));
|
|
44
|
-
const formItemLabelStyle = computed(() => toValue(props.formItemLabelStyle) ?? toValue(attrs.value.formItemLabelStyle));
|
|
45
|
-
useAttrsProvide({
|
|
46
|
-
colCount,
|
|
47
|
-
errorLayout,
|
|
48
|
-
labelMode,
|
|
49
|
-
showColon,
|
|
50
|
-
formItemClass,
|
|
51
|
-
formItemStyle,
|
|
52
|
-
formItemLabelClass,
|
|
53
|
-
formItemLabelStyle
|
|
54
|
-
});
|
|
55
|
-
const cls = computed(() => clx(preCls, props.class, { "all-colspan": props.isAllColSpan, bordered: props.bordered }));
|
|
56
|
-
const bodyCls = computed(() => clx(`${preCls}-body`, props.bodyClass));
|
|
57
|
-
const headerCls = computed(() => clx(`${preCls}-header`, props.headerClass));
|
|
58
|
-
const headerTitleCls = computed(() => clx(`${preCls}-header-title`));
|
|
59
|
-
const headerExtraCls = computed(() => clx(`${preCls}-header-extra`));
|
|
60
|
-
const bodyStyle = computed(() => {
|
|
61
|
-
const css = {};
|
|
62
|
-
if (typeof props.gap === "string") {
|
|
63
|
-
css.gap = props.gap;
|
|
64
|
-
}
|
|
65
|
-
if (typeof props.gap === "number") {
|
|
66
|
-
css.gap = `${props.gap}px`;
|
|
67
|
-
}
|
|
68
|
-
if (colCount.value) {
|
|
69
|
-
css.gridTemplateColumns = `repeat(${colCount.value}, auto)`;
|
|
70
|
-
}
|
|
71
|
-
return [css, props.bodyStyle];
|
|
72
|
-
});
|
|
73
|
-
const isTitle = computed(() => {
|
|
74
|
-
return !!props.title || solts.title;
|
|
75
|
-
});
|
|
76
|
-
const isExtra = computed(() => {
|
|
77
|
-
return !!props.extra || solts.extra;
|
|
78
|
-
});
|
|
79
|
-
return (_ctx, _cache) => {
|
|
80
|
-
return openBlock(), createElementBlock(
|
|
81
|
-
"div",
|
|
82
|
-
{
|
|
83
|
-
style: normalizeStyle(props.style),
|
|
84
|
-
class: normalizeClass(cls.value)
|
|
85
|
-
},
|
|
86
|
-
[
|
|
87
|
-
isExtra.value || isTitle.value ? (openBlock(), createElementBlock(
|
|
88
|
-
"div",
|
|
89
|
-
{
|
|
90
|
-
key: 0,
|
|
91
|
-
style: normalizeStyle(_ctx.headerStyle),
|
|
92
|
-
class: normalizeClass(headerCls.value)
|
|
93
|
-
},
|
|
94
|
-
[
|
|
95
|
-
createElementVNode(
|
|
96
|
-
"div",
|
|
97
|
-
{
|
|
98
|
-
class: normalizeClass(headerTitleCls.value)
|
|
99
|
-
},
|
|
100
|
-
[
|
|
101
|
-
props.title ? (openBlock(), createElementBlock(
|
|
102
|
-
Fragment,
|
|
103
|
-
{ key: 0 },
|
|
104
|
-
[
|
|
105
|
-
createTextVNode(
|
|
106
|
-
toDisplayString(props.title),
|
|
107
|
-
1
|
|
108
|
-
/* TEXT */
|
|
109
|
-
)
|
|
110
|
-
],
|
|
111
|
-
64
|
|
112
|
-
/* STABLE_FRAGMENT */
|
|
113
|
-
)) : renderSlot(_ctx.$slots, "title", { key: 1 })
|
|
114
|
-
],
|
|
115
|
-
2
|
|
116
|
-
/* CLASS */
|
|
117
|
-
),
|
|
118
|
-
createElementVNode(
|
|
119
|
-
"div",
|
|
120
|
-
{
|
|
121
|
-
class: normalizeClass(headerExtraCls.value)
|
|
122
|
-
},
|
|
123
|
-
[
|
|
124
|
-
props.extra ? (openBlock(), createElementBlock(
|
|
125
|
-
Fragment,
|
|
126
|
-
{ key: 0 },
|
|
127
|
-
[
|
|
128
|
-
createTextVNode(
|
|
129
|
-
toDisplayString(props.extra),
|
|
130
|
-
1
|
|
131
|
-
/* TEXT */
|
|
132
|
-
)
|
|
133
|
-
],
|
|
134
|
-
64
|
|
135
|
-
/* STABLE_FRAGMENT */
|
|
136
|
-
)) : renderSlot(_ctx.$slots, "extra", { key: 1 })
|
|
137
|
-
],
|
|
138
|
-
2
|
|
139
|
-
/* CLASS */
|
|
140
|
-
)
|
|
141
|
-
],
|
|
142
|
-
6
|
|
143
|
-
/* CLASS, STYLE */
|
|
144
|
-
)) : createCommentVNode("v-if", true),
|
|
145
|
-
createElementVNode(
|
|
146
|
-
"div",
|
|
147
|
-
{
|
|
148
|
-
style: normalizeStyle(bodyStyle.value),
|
|
149
|
-
class: normalizeClass(bodyCls.value)
|
|
150
|
-
},
|
|
151
|
-
[
|
|
152
|
-
renderSlot(_ctx.$slots, "default")
|
|
153
|
-
],
|
|
154
|
-
6
|
|
155
|
-
/* CLASS, STYLE */
|
|
156
|
-
)
|
|
157
|
-
],
|
|
158
|
-
6
|
|
159
|
-
/* CLASS, STYLE */
|
|
160
|
-
);
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
export {
|
|
165
|
-
_sfc_main as default
|
|
166
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const withInstall = (main, extra, childComponents) => {
|
|
2
|
-
main.install = (app) => {
|
|
3
|
-
for (const comp of [main, ...Object.values(childComponents ?? {})]) {
|
|
4
|
-
const name = comp.name || comp.__name;
|
|
5
|
-
app.component(name, comp);
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
if (childComponents) {
|
|
9
|
-
for (const [key, comp] of Object.entries(childComponents)) {
|
|
10
|
-
main[key] = comp;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
if (extra) {
|
|
14
|
-
for (const [key, comp] of Object.entries(extra)) {
|
|
15
|
-
main[key] = comp;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return main;
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
withInstall
|
|
22
|
-
};
|
package/lib/component.d.ts
DELETED
package/lib/component.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./form/index.js");
|
|
4
|
-
const index$1 = require("./formItem/index.js");
|
|
5
|
-
const index$2 = require("./layout/index.js");
|
|
6
|
-
exports.Form = index.Form;
|
|
7
|
-
exports.FormHideItem = index$1.FormHideItem;
|
|
8
|
-
exports.FormItem = index$1.FormItem;
|
|
9
|
-
exports.FormItemBase = index$1.FormItemBase;
|
|
10
|
-
exports.FormLayoutRows = index$2.FormLayoutRows;
|
|
11
|
-
exports.Layout = index$2.Layout;
|
|
12
|
-
exports.LayoutFormItem = index$2.LayoutFormItem;
|
package/lib/form/form.vue.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { FormProps } from '../interface/index';
|
|
2
|
-
type __VLS_Props = FormProps;
|
|
3
|
-
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
4
|
-
finish: (...args: any[]) => void;
|
|
5
|
-
valuesChange: (...args: any[]) => void;
|
|
6
|
-
finishFailed: (...args: any[]) => void;
|
|
7
|
-
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
8
|
-
onFinish?: ((...args: any[]) => any) | undefined;
|
|
9
|
-
onValuesChange?: ((...args: any[]) => any) | undefined;
|
|
10
|
-
onFinishFailed?: ((...args: any[]) => any) | undefined;
|
|
11
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
12
|
-
default?(_: {}): any;
|
|
13
|
-
}>;
|
|
14
|
-
export default _default;
|
|
15
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
16
|
-
new (): {
|
|
17
|
-
$slots: S;
|
|
18
|
-
};
|
|
19
|
-
};
|
package/lib/form/form.vue.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const vue = require("vue");
|
|
4
|
-
const register_form = require("../hooks/register/register.form.js");
|
|
5
|
-
const useForm = require("../hooks/useForm.js");
|
|
6
|
-
const layout_vue_vue_type_script_setup_true_lang = require("../layout/layout.vue.js");
|
|
7
|
-
const clx = require("classnames");
|
|
8
|
-
const __default__ = vue.defineComponent({
|
|
9
|
-
name: "Form",
|
|
10
|
-
inheritAttrs: false
|
|
11
|
-
// 可选,防止属性自动应用到根元素
|
|
12
|
-
});
|
|
13
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
14
|
-
...__default__,
|
|
15
|
-
props: {
|
|
16
|
-
form: {},
|
|
17
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
18
|
-
class: {},
|
|
19
|
-
layoutClass: {},
|
|
20
|
-
layoutStyle: { type: [Boolean, null, String, Object, Array] },
|
|
21
|
-
formData: {},
|
|
22
|
-
onValuesChange: {},
|
|
23
|
-
onFinish: {},
|
|
24
|
-
onFinishFailed: {},
|
|
25
|
-
hideData: {},
|
|
26
|
-
name: {},
|
|
27
|
-
hideRuleData: {},
|
|
28
|
-
title: { type: [Object, String, Number, Boolean, null, Array] },
|
|
29
|
-
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
30
|
-
isAllColSpan: { type: Boolean },
|
|
31
|
-
headerClass: {},
|
|
32
|
-
bodyClass: {},
|
|
33
|
-
headerStyle: { type: [Boolean, null, String, Object, Array] },
|
|
34
|
-
bodyStyle: { type: [Boolean, null, String, Object, Array] },
|
|
35
|
-
bordered: { type: Boolean },
|
|
36
|
-
colCount: {},
|
|
37
|
-
gap: {},
|
|
38
|
-
errorLayout: {},
|
|
39
|
-
labelMode: {},
|
|
40
|
-
showColon: {},
|
|
41
|
-
formItemClass: {},
|
|
42
|
-
formItemStyle: {},
|
|
43
|
-
formItemLabelClass: {},
|
|
44
|
-
formItemLabelStyle: {}
|
|
45
|
-
},
|
|
46
|
-
emits: ["finish", "valuesChange", "finishFailed"],
|
|
47
|
-
setup(__props, { emit: __emit }) {
|
|
48
|
-
const props = __props;
|
|
49
|
-
const {
|
|
50
|
-
form,
|
|
51
|
-
style,
|
|
52
|
-
formData,
|
|
53
|
-
hideData,
|
|
54
|
-
hideRuleData,
|
|
55
|
-
name,
|
|
56
|
-
onFinish,
|
|
57
|
-
onFinishFailed,
|
|
58
|
-
onValuesChange,
|
|
59
|
-
layoutStyle,
|
|
60
|
-
layoutClass,
|
|
61
|
-
...rest
|
|
62
|
-
} = props;
|
|
63
|
-
const cls = vue.computed(() => clx("carefrees-form", props.class));
|
|
64
|
-
const formInstance = useForm.useForm(props.form);
|
|
65
|
-
formInstance.value.ctor(vue.reactive(props.formData || {}), vue.reactive(props.hideData || {}), vue.reactive(props.hideRuleData || {}));
|
|
66
|
-
const emits = __emit;
|
|
67
|
-
formInstance.value.onFinish = (...rest2) => {
|
|
68
|
-
emits("finish", ...rest2);
|
|
69
|
-
};
|
|
70
|
-
formInstance.value.onValuesChange = (...rest2) => {
|
|
71
|
-
emits("valuesChange", ...rest2);
|
|
72
|
-
};
|
|
73
|
-
formInstance.value.onFinishFailed = (...rest2) => {
|
|
74
|
-
emits("finishFailed", ...rest2);
|
|
75
|
-
};
|
|
76
|
-
register_form.useRegisterForm(formInstance.value, props.name);
|
|
77
|
-
const onSubmit = (event) => {
|
|
78
|
-
var _a, _b, _c, _d;
|
|
79
|
-
(_a = event == null ? void 0 : event.preventDefault) == null ? void 0 : _a.call(event);
|
|
80
|
-
(_b = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _b.call(event);
|
|
81
|
-
(_d = (_c = formInstance.value).submit) == null ? void 0 : _d.call(_c);
|
|
82
|
-
};
|
|
83
|
-
useForm.useFormProvide(formInstance.value);
|
|
84
|
-
return (_ctx, _cache) => {
|
|
85
|
-
return vue.openBlock(), vue.createElementBlock(
|
|
86
|
-
"form",
|
|
87
|
-
{
|
|
88
|
-
class: vue.normalizeClass(cls.value),
|
|
89
|
-
style: vue.normalizeStyle(vue.unref(style)),
|
|
90
|
-
onSubmit
|
|
91
|
-
},
|
|
92
|
-
[
|
|
93
|
-
vue.createVNode(layout_vue_vue_type_script_setup_true_lang.default, vue.mergeProps(rest, {
|
|
94
|
-
class: vue.unref(layoutClass),
|
|
95
|
-
style: vue.unref(layoutStyle)
|
|
96
|
-
}), {
|
|
97
|
-
default: vue.withCtx(() => [
|
|
98
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
99
|
-
]),
|
|
100
|
-
_: 3
|
|
101
|
-
/* FORWARDED */
|
|
102
|
-
}, 16, ["class", "style"])
|
|
103
|
-
],
|
|
104
|
-
38
|
|
105
|
-
/* CLASS, STYLE, NEED_HYDRATION */
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
exports.default = _sfc_main;
|
package/lib/form/form.vue2.js
DELETED
package/lib/form/index.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export declare const Form: import('../utils').SFCWithInstall<{
|
|
2
|
-
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('..').FormProps<any>> & Readonly<{
|
|
3
|
-
onFinish?: ((...args: any[]) => any) | undefined;
|
|
4
|
-
onValuesChange?: ((...args: any[]) => any) | undefined;
|
|
5
|
-
onFinishFailed?: ((...args: any[]) => any) | undefined;
|
|
6
|
-
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
7
|
-
finish: (...args: any[]) => void;
|
|
8
|
-
valuesChange: (...args: any[]) => void;
|
|
9
|
-
finishFailed: (...args: any[]) => void;
|
|
10
|
-
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
11
|
-
P: {};
|
|
12
|
-
B: {};
|
|
13
|
-
D: {};
|
|
14
|
-
C: {};
|
|
15
|
-
M: {};
|
|
16
|
-
Defaults: {};
|
|
17
|
-
}, Readonly<import('..').FormProps<any>> & Readonly<{
|
|
18
|
-
onFinish?: ((...args: any[]) => any) | undefined;
|
|
19
|
-
onValuesChange?: ((...args: any[]) => any) | undefined;
|
|
20
|
-
onFinishFailed?: ((...args: any[]) => any) | undefined;
|
|
21
|
-
}>, {}, {}, {}, {}, {}>;
|
|
22
|
-
__isFragment?: undefined;
|
|
23
|
-
__isTeleport?: undefined;
|
|
24
|
-
__isSuspense?: undefined;
|
|
25
|
-
} & import('vue').ComponentOptionsBase<Readonly<import('..').FormProps<any>> & Readonly<{
|
|
26
|
-
onFinish?: ((...args: any[]) => any) | undefined;
|
|
27
|
-
onValuesChange?: ((...args: any[]) => any) | undefined;
|
|
28
|
-
onFinishFailed?: ((...args: any[]) => any) | undefined;
|
|
29
|
-
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
30
|
-
finish: (...args: any[]) => void;
|
|
31
|
-
valuesChange: (...args: any[]) => void;
|
|
32
|
-
finishFailed: (...args: any[]) => void;
|
|
33
|
-
}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
34
|
-
$slots: {
|
|
35
|
-
default?(_: {}): any;
|
|
36
|
-
};
|
|
37
|
-
})> & Record<string, any>;
|
package/lib/form/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const form_vue_vue_type_script_setup_true_lang = require("./form.vue.js");
|
|
4
|
-
const withInstall = require("../utils/withInstall.js");
|
|
5
|
-
const Form = withInstall.withInstall(form_vue_vue_type_script_setup_true_lang.default);
|
|
6
|
-
exports.Form = Form;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { FormItemProps } from '../interface/index';
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<FormItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FormItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
|
|
3
|
-
label: (params: any) => any;
|
|
4
|
-
helpText: (params: any) => any;
|
|
5
|
-
extra: (params: any) => any;
|
|
6
|
-
}> & {
|
|
7
|
-
label: (params: any) => any;
|
|
8
|
-
helpText: (params: any) => any;
|
|
9
|
-
extra: (params: any) => any;
|
|
10
|
-
}>;
|
|
11
|
-
export default _default;
|
|
12
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
13
|
-
new (): {
|
|
14
|
-
$slots: S;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const vue = require("vue");
|
|
4
|
-
const attr_FormItem = require("../hooks/attr/attr.FormItem.js");
|
|
5
|
-
const layout_formItem_vue_vue_type_script_setup_true_lang = require("../layout/layout.formItem.vue.js");
|
|
6
|
-
const useFormItemParentName = require("../hooks/useFormItemParentName.js");
|
|
7
|
-
const __default__ = vue.defineComponent({
|
|
8
|
-
name: "FormItemBase",
|
|
9
|
-
inheritAttrs: false
|
|
10
|
-
// 可选,防止属性自动应用到根元素
|
|
11
|
-
});
|
|
12
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
13
|
-
...__default__,
|
|
14
|
-
props: {
|
|
15
|
-
noStyle: { type: Boolean },
|
|
16
|
-
input: {},
|
|
17
|
-
dependencies: {},
|
|
18
|
-
noticeOnlyRuleDataField: {},
|
|
19
|
-
isNoticeParentField: { type: Boolean },
|
|
20
|
-
noticeWatchField: {},
|
|
21
|
-
preserve: { type: Boolean },
|
|
22
|
-
useRules: {},
|
|
23
|
-
useAttrs: {},
|
|
24
|
-
inputAttrs: {},
|
|
25
|
-
valuePropName: {},
|
|
26
|
-
getValuePath: {},
|
|
27
|
-
getValueFromEvent: {},
|
|
28
|
-
formatValue: {},
|
|
29
|
-
onAfterUpdate: {},
|
|
30
|
-
trigger: {},
|
|
31
|
-
name: {},
|
|
32
|
-
rules: {},
|
|
33
|
-
sort: {},
|
|
34
|
-
isJoinParentField: { type: Boolean },
|
|
35
|
-
errorLayout: {},
|
|
36
|
-
required: { type: Boolean },
|
|
37
|
-
labelMode: {},
|
|
38
|
-
onlyRuleStyle: { type: Boolean },
|
|
39
|
-
label: { type: [Object, String, Number, Boolean, null, Array] },
|
|
40
|
-
helpText: { type: [Object, String, Number, Boolean, null, Array] },
|
|
41
|
-
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
42
|
-
showColon: { type: Boolean },
|
|
43
|
-
colSpan: {},
|
|
44
|
-
rowSpan: {},
|
|
45
|
-
htmlFor: {},
|
|
46
|
-
validateResult: {},
|
|
47
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
48
|
-
class: {},
|
|
49
|
-
labelStyle: { type: [Boolean, null, String, Object, Array] },
|
|
50
|
-
labelClass: {}
|
|
51
|
-
},
|
|
52
|
-
setup(__props) {
|
|
53
|
-
const props = __props;
|
|
54
|
-
const formAttrs = attr_FormItem.useFormItemAttr(props);
|
|
55
|
-
useFormItemParentName.useFormItemParentNameProvide({
|
|
56
|
-
name: formAttrs.newName,
|
|
57
|
-
sort: formAttrs.newSort
|
|
58
|
-
});
|
|
59
|
-
const slots = vue.useSlots();
|
|
60
|
-
const isRequired = vue.computed(() => {
|
|
61
|
-
var _a, _b, _c;
|
|
62
|
-
return !!props.required || !!((_c = vue.toValue((_b = (_a = formAttrs.ruleInstance) == null ? void 0 : _a.value) == null ? void 0 : _b.rules) || []) == null ? void 0 : _c.find((item) => {
|
|
63
|
-
return item.required;
|
|
64
|
-
}));
|
|
65
|
-
});
|
|
66
|
-
return (_ctx, _cache) => {
|
|
67
|
-
return props.noStyle ? (vue.openBlock(), vue.createBlock(
|
|
68
|
-
vue.resolveDynamicComponent(props.input),
|
|
69
|
-
vue.normalizeProps(vue.mergeProps({ key: 0 }, vue.toValue(vue.unref(formAttrs).attrsLastData))),
|
|
70
|
-
null,
|
|
71
|
-
16
|
|
72
|
-
/* FULL_PROPS */
|
|
73
|
-
)) : (vue.openBlock(), vue.createBlock(layout_formItem_vue_vue_type_script_setup_true_lang.default, {
|
|
74
|
-
key: 1,
|
|
75
|
-
label: props.label,
|
|
76
|
-
required: isRequired.value,
|
|
77
|
-
"error-layout": props.errorLayout,
|
|
78
|
-
"label-mode": props.labelMode,
|
|
79
|
-
"only-rule-style": props.onlyRuleStyle,
|
|
80
|
-
"show-colon": props.showColon,
|
|
81
|
-
"col-span": props.colSpan,
|
|
82
|
-
"row-span": props.rowSpan,
|
|
83
|
-
"html-for": vue.unref(formAttrs).htmlFor,
|
|
84
|
-
style: vue.normalizeStyle(props.style),
|
|
85
|
-
class: vue.normalizeClass(props.class),
|
|
86
|
-
"label-style": props.labelStyle,
|
|
87
|
-
"label-class": props.labelClass,
|
|
88
|
-
"validate-result": vue.unref(formAttrs).validateResult
|
|
89
|
-
}, vue.createSlots({
|
|
90
|
-
default: vue.withCtx(() => [
|
|
91
|
-
(vue.openBlock(), vue.createBlock(
|
|
92
|
-
vue.resolveDynamicComponent(props.input),
|
|
93
|
-
vue.normalizeProps(vue.guardReactiveProps(vue.toValue(vue.unref(formAttrs).attrsLastData))),
|
|
94
|
-
null,
|
|
95
|
-
16
|
|
96
|
-
/* FULL_PROPS */
|
|
97
|
-
))
|
|
98
|
-
]),
|
|
99
|
-
_: 2
|
|
100
|
-
/* DYNAMIC */
|
|
101
|
-
}, [
|
|
102
|
-
vue.renderList(slots, (item, name) => {
|
|
103
|
-
return {
|
|
104
|
-
name,
|
|
105
|
-
fn: vue.withCtx((slotProps) => [
|
|
106
|
-
vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
|
|
107
|
-
])
|
|
108
|
-
};
|
|
109
|
-
})
|
|
110
|
-
]), 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"]));
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
exports.default = _sfc_main;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const form_Item_base_vue_vue_type_script_setup_true_lang = require("./form.Item.base.vue.js");
|
|
4
|
-
exports.default = form_Item_base_vue_vue_type_script_setup_true_lang.default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { FormItemProps } from '../interface/index';
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<FormItemProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FormItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
|
|
3
|
-
label: (params: any) => any;
|
|
4
|
-
helpText: (params: any) => any;
|
|
5
|
-
extra: (params: any) => any;
|
|
6
|
-
}> & {
|
|
7
|
-
label: (params: any) => any;
|
|
8
|
-
helpText: (params: any) => any;
|
|
9
|
-
extra: (params: any) => any;
|
|
10
|
-
}>;
|
|
11
|
-
export default _default;
|
|
12
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
13
|
-
new (): {
|
|
14
|
-
$slots: S;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const vue = require("vue");
|
|
4
|
-
const form_Item_base_vue_vue_type_script_setup_true_lang = require("./form.Item.base.vue.js");
|
|
5
|
-
const register_FormHideItem = require("../hooks/register/register.FormHideItem.js");
|
|
6
|
-
const __default__ = vue.defineComponent({
|
|
7
|
-
name: "FormHideItem",
|
|
8
|
-
inheritAttrs: false
|
|
9
|
-
// 可选,防止属性自动应用到根元素
|
|
10
|
-
});
|
|
11
|
-
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
12
|
-
...__default__,
|
|
13
|
-
props: {
|
|
14
|
-
noStyle: { type: Boolean },
|
|
15
|
-
input: {},
|
|
16
|
-
dependencies: {},
|
|
17
|
-
noticeOnlyRuleDataField: {},
|
|
18
|
-
isNoticeParentField: { type: Boolean },
|
|
19
|
-
noticeWatchField: {},
|
|
20
|
-
preserve: { type: Boolean },
|
|
21
|
-
useRules: {},
|
|
22
|
-
useAttrs: {},
|
|
23
|
-
inputAttrs: {},
|
|
24
|
-
valuePropName: {},
|
|
25
|
-
getValuePath: {},
|
|
26
|
-
getValueFromEvent: {},
|
|
27
|
-
formatValue: {},
|
|
28
|
-
onAfterUpdate: {},
|
|
29
|
-
trigger: {},
|
|
30
|
-
name: {},
|
|
31
|
-
rules: {},
|
|
32
|
-
sort: {},
|
|
33
|
-
isJoinParentField: { type: Boolean },
|
|
34
|
-
errorLayout: {},
|
|
35
|
-
required: { type: Boolean },
|
|
36
|
-
labelMode: {},
|
|
37
|
-
onlyRuleStyle: { type: Boolean },
|
|
38
|
-
label: { type: [Object, String, Number, Boolean, null, Array] },
|
|
39
|
-
helpText: { type: [Object, String, Number, Boolean, null, Array] },
|
|
40
|
-
extra: { type: [Object, String, Number, Boolean, null, Array] },
|
|
41
|
-
showColon: { type: Boolean },
|
|
42
|
-
colSpan: {},
|
|
43
|
-
rowSpan: {},
|
|
44
|
-
htmlFor: {},
|
|
45
|
-
validateResult: {},
|
|
46
|
-
style: { type: [Boolean, null, String, Object, Array] },
|
|
47
|
-
class: {},
|
|
48
|
-
labelStyle: { type: [Boolean, null, String, Object, Array] },
|
|
49
|
-
labelClass: {}
|
|
50
|
-
},
|
|
51
|
-
setup(__props) {
|
|
52
|
-
const props = __props;
|
|
53
|
-
const slots = vue.useSlots();
|
|
54
|
-
const { isHide } = register_FormHideItem.useRegisterFormHideItem({ name: props.name, sort: props.sort, isJoinParentField: props.isJoinParentField });
|
|
55
|
-
return (_ctx, _cache) => {
|
|
56
|
-
return !vue.unref(isHide) ? (vue.openBlock(), vue.createBlock(
|
|
57
|
-
form_Item_base_vue_vue_type_script_setup_true_lang.default,
|
|
58
|
-
vue.normalizeProps(vue.mergeProps({ key: 0 }, props)),
|
|
59
|
-
vue.createSlots({
|
|
60
|
-
_: 2
|
|
61
|
-
/* DYNAMIC */
|
|
62
|
-
}, [
|
|
63
|
-
vue.renderList(slots, (item, name) => {
|
|
64
|
-
return {
|
|
65
|
-
name,
|
|
66
|
-
fn: vue.withCtx((slotProps) => [
|
|
67
|
-
vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
|
|
68
|
-
])
|
|
69
|
-
};
|
|
70
|
-
})
|
|
71
|
-
]),
|
|
72
|
-
1040
|
|
73
|
-
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
74
|
-
)) : vue.createCommentVNode("v-if", true);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
exports.default = _sfc_main;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const form_hide_item_vue_vue_type_script_setup_true_lang = require("./form.hide.item.vue.js");
|
|
4
|
-
exports.default = form_hide_item_vue_vue_type_script_setup_true_lang.default;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FormItemProps } from '../interface/index';
|
|
2
|
-
declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<Partial<FormItemProps>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Partial<FormItemProps>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<{
|
|
3
|
-
default: (params: any) => any;
|
|
4
|
-
label: (params: any) => any;
|
|
5
|
-
helpText: (params: any) => any;
|
|
6
|
-
extra: (params: any) => any;
|
|
7
|
-
}> & {
|
|
8
|
-
default: (params: any) => any;
|
|
9
|
-
label: (params: any) => any;
|
|
10
|
-
helpText: (params: any) => any;
|
|
11
|
-
extra: (params: any) => any;
|
|
12
|
-
}>;
|
|
13
|
-
export default _default;
|
|
14
|
-
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
|
-
new (): {
|
|
16
|
-
$slots: S;
|
|
17
|
-
};
|
|
18
|
-
};
|