@web-utils/form-ui 1.0.0-beta19 → 1.0.0-beta20
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/chunks/BLpnMrum.mjs +189 -0
- package/chunks/Bb43eI1f.mjs +93 -0
- package/chunks/lTFu0zgR.mjs +106 -0
- package/constants.mjs +1 -1
- package/form-advice/index.mjs +13 -12
- package/form-holder/index.mjs +1 -1
- package/form-item-group/index.mjs +1 -1
- package/form-red-table/index.mjs +27 -26
- package/form-row/index.mjs +1 -1
- package/index.mjs +3 -3
- package/package.json +1 -1
- package/web-types.json +1 -1
- package/chunks/CNtf2MHr.mjs +0 -106
- package/chunks/DdDv8RSI.mjs +0 -92
- package/chunks/nJ1-P9vh.mjs +0 -189
package/chunks/CNtf2MHr.mjs
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { formItemGroupContextKey as e } from "../constants.mjs";
|
|
2
|
-
import t from "../empty-view/index.mjs";
|
|
3
|
-
import { ElRow as n } from "element-plus/es";
|
|
4
|
-
import { Fragment as r, computed as i, createTextVNode as a, createVNode as o, h as s, inject as c, isVNode as l, onBeforeUnmount as u, onMounted as d, provide as f, reactive as p, ref as m, toRef as h, vShow as g, watchEffect as _, withDirectives as v } from "vue";
|
|
5
|
-
import { ElCol as y, ElCollapseTransition as b } from "element-plus";
|
|
6
|
-
//#region src/components/form/FormItemGroup.vue?vue&type=script&lang.jsx
|
|
7
|
-
function x(e) {
|
|
8
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !l(e);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/components/form/FormItemGroup.vue
|
|
12
|
-
var S = {
|
|
13
|
-
name: "FormItemGroup",
|
|
14
|
-
props: {
|
|
15
|
-
blockTitle: String,
|
|
16
|
-
size: String,
|
|
17
|
-
tips: String,
|
|
18
|
-
active: Boolean,
|
|
19
|
-
enabled: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default: void 0
|
|
22
|
-
},
|
|
23
|
-
disabled: {
|
|
24
|
-
type: Boolean,
|
|
25
|
-
default: void 0
|
|
26
|
-
},
|
|
27
|
-
tag: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: "ElCol"
|
|
30
|
-
},
|
|
31
|
-
span: {
|
|
32
|
-
type: Number,
|
|
33
|
-
default: 24
|
|
34
|
-
},
|
|
35
|
-
block: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: !0
|
|
38
|
-
},
|
|
39
|
-
wrapRow: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: !0
|
|
42
|
-
},
|
|
43
|
-
gutter: {
|
|
44
|
-
type: Number,
|
|
45
|
-
default: 20
|
|
46
|
-
},
|
|
47
|
-
collapse: Boolean,
|
|
48
|
-
showTitle: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: !0
|
|
51
|
-
},
|
|
52
|
-
notDispatch: Boolean
|
|
53
|
-
},
|
|
54
|
-
setup(l, { expose: S, slots: C }) {
|
|
55
|
-
let w = c("formView", null), T = m(!0), E = h(() => l.enabled), D = h(() => l.disabled), O = i(() => l.enabled === !0 ? !1 : l.disabled === !0), k = () => T.value = !T.value, A = p({
|
|
56
|
-
disabled: D,
|
|
57
|
-
enabled: E,
|
|
58
|
-
isDisabled: O,
|
|
59
|
-
size: h(() => l.size)
|
|
60
|
-
});
|
|
61
|
-
return _(() => {
|
|
62
|
-
T.value = !l.collapse;
|
|
63
|
-
}), f(e, A), d(() => {
|
|
64
|
-
if (!l.notDispatch) {
|
|
65
|
-
var e;
|
|
66
|
-
w == null || (e = w.addGroup) == null || e.call(w, this);
|
|
67
|
-
}
|
|
68
|
-
}), u(() => {
|
|
69
|
-
if (!l.notDispatch) {
|
|
70
|
-
var e;
|
|
71
|
-
w == null || (e = w.removeGroup) == null || e.call(w, this);
|
|
72
|
-
}
|
|
73
|
-
}), S(A), () => {
|
|
74
|
-
let e = () => {
|
|
75
|
-
var e;
|
|
76
|
-
return o(r, null, [v(o("div", {
|
|
77
|
-
class: "form-item-group-title",
|
|
78
|
-
onClick: k
|
|
79
|
-
}, [o("span", {
|
|
80
|
-
class: "flex-item",
|
|
81
|
-
style: "flex: 1"
|
|
82
|
-
}, [
|
|
83
|
-
C.title ? C.title() : l.blockTitle,
|
|
84
|
-
C.tips || l.tips ? o("span", { style: "color: #ff0000; font-size: 14px" }, [
|
|
85
|
-
a("("),
|
|
86
|
-
C.tips ? C.tips() : l.tips,
|
|
87
|
-
a(")")
|
|
88
|
-
]) : null,
|
|
89
|
-
(e = C["title-right"]) == null ? void 0 : e.call(C)
|
|
90
|
-
]), o("i", { class: T.value ? "el-icon-arrow-down" : "el-icon-arrow-right" }, null)]), [[g, l.showTitle]]), o(b, null, { default: () => {
|
|
91
|
-
let e;
|
|
92
|
-
return C.default ? l.wrapRow ? v(o(n, { gutter: l.gutter }, x(e = C.default()) ? e : { default: () => [e] }), [[g, T.value]]) : v(o("div", null, [C.default()]), [[g, T.value]]) : v(o(t, {
|
|
93
|
-
"font-size": "14px",
|
|
94
|
-
"empty-tips": "暂无信息"
|
|
95
|
-
}, null), [[g, T.value]]);
|
|
96
|
-
} })]);
|
|
97
|
-
}, i = { class: ["form-item-group", {
|
|
98
|
-
"default-active": l.active,
|
|
99
|
-
"is-disabled": O.value
|
|
100
|
-
}] };
|
|
101
|
-
return l.tag !== "div" && (i.span = l.block ? 24 : l.span), s(l.tag === "div" ? "div" : y, i, e);
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
//#endregion
|
|
106
|
-
export { S as t };
|
package/chunks/DdDv8RSI.mjs
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import e from "../form-cell/index.mjs";
|
|
2
|
-
import { ElTooltip as t } from "element-plus/es";
|
|
3
|
-
import { Comment as n, Fragment as r, Text as i, createVNode as a, inject as o, isVNode as s } from "vue";
|
|
4
|
-
import { camelize as c, isDef as l, isString as u } from "@web-utils/core";
|
|
5
|
-
//#region src/components/red-form/FormRow.vue?vue&type=script&lang.jsx
|
|
6
|
-
function d(e) {
|
|
7
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !s(e);
|
|
8
|
-
}
|
|
9
|
-
var f = (e) => {
|
|
10
|
-
let t = Object.keys({});
|
|
11
|
-
for (let n in e) t[c(n)] = e[n];
|
|
12
|
-
return t;
|
|
13
|
-
}, p = (e, { columnSize: o }) => {
|
|
14
|
-
if (!e || !e.length) return null;
|
|
15
|
-
e = e.filter((e) => e.type !== n);
|
|
16
|
-
let s = [], c = e.length === 1;
|
|
17
|
-
for (let n = 0; n < e.length; n++) {
|
|
18
|
-
let v = e[n], { name: y } = v.type;
|
|
19
|
-
if (v.type === i) s.push({
|
|
20
|
-
tag: y,
|
|
21
|
-
type: "text",
|
|
22
|
-
content: v,
|
|
23
|
-
colspan: c ? o : 0
|
|
24
|
-
});
|
|
25
|
-
else if (v.type === r) s.push(...p(v.children, { columnSize: o }));
|
|
26
|
-
else if (u(v.type) && v.type === "td") s.push({
|
|
27
|
-
tag: v.type,
|
|
28
|
-
type: "td",
|
|
29
|
-
content: v
|
|
30
|
-
});
|
|
31
|
-
else if (y === "FormCell") s.push({
|
|
32
|
-
tag: y,
|
|
33
|
-
type: "FormCell",
|
|
34
|
-
content: v
|
|
35
|
-
});
|
|
36
|
-
else if (typeof v.type == "object") {
|
|
37
|
-
var d, m;
|
|
38
|
-
let { label: e, hideLabel: n, labelColspan: r, inputColspan: i, labelRowspan: u, inputRowspan: p, tipsAfterLabel: b, tips: x } = f(v.props);
|
|
39
|
-
if (!l(n)) {
|
|
40
|
-
var h, g, _;
|
|
41
|
-
let n = (h = v.children) == null ? void 0 : h.tips, i = n || x ? a(t, {
|
|
42
|
-
effect: "light",
|
|
43
|
-
content: x,
|
|
44
|
-
offset: 4
|
|
45
|
-
}, {
|
|
46
|
-
default: () => a("i", { class: "el-icon-info form-item-input-info" }, null),
|
|
47
|
-
content: n || null
|
|
48
|
-
}) : null;
|
|
49
|
-
s.push({
|
|
50
|
-
tag: y,
|
|
51
|
-
type: "label",
|
|
52
|
-
colspan: r,
|
|
53
|
-
rowspan: u,
|
|
54
|
-
content: [((g = v.children) == null || (_ = g.label) == null ? void 0 : _.call(g)) || e, b === "" ? i : null]
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
let S;
|
|
58
|
-
S = c && l(n) ? o : l(i) ? i : c ? o - 1 : 0, s.push({
|
|
59
|
-
tag: y,
|
|
60
|
-
type: "input",
|
|
61
|
-
colspan: S,
|
|
62
|
-
rowspan: p,
|
|
63
|
-
content: [v, (d = v.children) == null || (m = d.below) == null ? void 0 : m.call(d)]
|
|
64
|
-
});
|
|
65
|
-
} else console.error("未知节点");
|
|
66
|
-
}
|
|
67
|
-
return s;
|
|
68
|
-
}, m = {
|
|
69
|
-
name: "FormRow",
|
|
70
|
-
props: {
|
|
71
|
-
isLabel: Boolean,
|
|
72
|
-
alignCenter: Boolean
|
|
73
|
-
},
|
|
74
|
-
setup(t, { slots: n }) {
|
|
75
|
-
let r = o("setColumnSize", null), i = o("columnSize", null);
|
|
76
|
-
return () => {
|
|
77
|
-
var o;
|
|
78
|
-
let s = (o = n.default) == null ? void 0 : o.call(n), c = [];
|
|
79
|
-
return c.push(...p(s, { columnSize: (i == null ? void 0 : i.value) ?? 0 })), ((i == null ? void 0 : i.value) ?? 0) < c.length && (r == null || r(c.length)), a("tr", null, [c.map(({ tag: n, type: r, colspan: i, rowspan: o, content: s }) => n === "td" || r === "FormCell" ? s : r === "text" ? a(e, {
|
|
80
|
-
isLabel: t.isLabel,
|
|
81
|
-
alignCenter: t.alignCenter,
|
|
82
|
-
colspan: i
|
|
83
|
-
}, d(s) ? s : { default: () => [s] }) : a("td", {
|
|
84
|
-
class: r,
|
|
85
|
-
colspan: i,
|
|
86
|
-
rowspan: o
|
|
87
|
-
}, [s]))]);
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
//#endregion
|
|
92
|
-
export { m as t };
|
package/chunks/nJ1-P9vh.mjs
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { formHolderContextKey as e } from "../constants.mjs";
|
|
2
|
-
import { n as t } from "./Bh_CMUlo.mjs";
|
|
3
|
-
import n from "../form-advice/index.mjs";
|
|
4
|
-
import r from "../form-red-table/index.mjs";
|
|
5
|
-
import { ElForm as i, ElRow as a } from "element-plus/es";
|
|
6
|
-
import { computed as o, createVNode as s, inject as c, mergeProps as l, nextTick as u, provide as d, reactive as f, toRef as p, useTemplateRef as m } from "vue";
|
|
7
|
-
import { animate as h } from "@web-utils/core";
|
|
8
|
-
//#region src/components/form/props/form.js
|
|
9
|
-
var g = {
|
|
10
|
-
model: Object,
|
|
11
|
-
rules: Object,
|
|
12
|
-
inline: {
|
|
13
|
-
type: Boolean,
|
|
14
|
-
default: !1
|
|
15
|
-
},
|
|
16
|
-
labelPosition: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: "right"
|
|
19
|
-
},
|
|
20
|
-
labelWidth: {
|
|
21
|
-
type: [String, Number],
|
|
22
|
-
default: "auto"
|
|
23
|
-
},
|
|
24
|
-
labelSuffix: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: ""
|
|
27
|
-
},
|
|
28
|
-
hideRequiredAsterisk: {
|
|
29
|
-
type: Boolean,
|
|
30
|
-
default: !1
|
|
31
|
-
},
|
|
32
|
-
requireAsteriskPosition: {
|
|
33
|
-
type: String,
|
|
34
|
-
default: "left"
|
|
35
|
-
},
|
|
36
|
-
showMessage: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: !0
|
|
39
|
-
},
|
|
40
|
-
inlineMessage: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: !1
|
|
43
|
-
},
|
|
44
|
-
statusIcon: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: !1
|
|
47
|
-
},
|
|
48
|
-
validateOnRuleChange: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: !0
|
|
51
|
-
},
|
|
52
|
-
size: String,
|
|
53
|
-
disabled: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
default: void 0
|
|
56
|
-
},
|
|
57
|
-
scrollToError: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: !1
|
|
60
|
-
},
|
|
61
|
-
scrollIntoViewOptions: [Object, Boolean],
|
|
62
|
-
requiredFields: Array,
|
|
63
|
-
disabledFields: Array,
|
|
64
|
-
enabledFields: Array,
|
|
65
|
-
showAdvice: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
default: !0
|
|
68
|
-
},
|
|
69
|
-
columns: [Array, Object],
|
|
70
|
-
colCount: Number,
|
|
71
|
-
notTableForm: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
default: void 0
|
|
74
|
-
},
|
|
75
|
-
commentValueColspan: Number,
|
|
76
|
-
commentLabelColspan: Number,
|
|
77
|
-
wrapRow: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
default: !0
|
|
80
|
-
}
|
|
81
|
-
}, _ = {
|
|
82
|
-
showMessage: !0,
|
|
83
|
-
required: !0,
|
|
84
|
-
requiredFields: !0,
|
|
85
|
-
disabledFields: !0,
|
|
86
|
-
enabledFields: !0,
|
|
87
|
-
showAdvice: !0,
|
|
88
|
-
columns: !0,
|
|
89
|
-
colCount: !0,
|
|
90
|
-
notTableForm: !0,
|
|
91
|
-
commentValueColspan: !0,
|
|
92
|
-
commentLabelColspan: !0,
|
|
93
|
-
wrapRow: !0
|
|
94
|
-
}, v = ["validate"], y = (e) => _[e] !== !0, b = {
|
|
95
|
-
name: "FormHolder",
|
|
96
|
-
inheritAttrs: !1,
|
|
97
|
-
props: { ...g },
|
|
98
|
-
emits: { validate: null },
|
|
99
|
-
setup(g, { slots: _, expose: b, emit: x }) {
|
|
100
|
-
let S = t(g, {
|
|
101
|
-
emit: x,
|
|
102
|
-
events: v,
|
|
103
|
-
predicate: y
|
|
104
|
-
}), C = c("formView", null), w = m("form"), T = o(() => g.notTableForm === void 0 ? (C == null ? void 0 : C.tableForm) === void 0 ? !1 : C == null ? void 0 : C.tableForm : !g.notTableForm), E = o(() => T.value ? !1 : g.showMessage), D = o(() => {
|
|
105
|
-
let e = {};
|
|
106
|
-
return g.disabledFields && g.disabledFields.forEach((t) => {
|
|
107
|
-
e[t] = !0;
|
|
108
|
-
}), e;
|
|
109
|
-
}), O = o(() => {
|
|
110
|
-
let e = {};
|
|
111
|
-
return g.enabledFields && g.enabledFields.length && g.enabledFields.forEach((t) => {
|
|
112
|
-
e[t] = !0;
|
|
113
|
-
}), e;
|
|
114
|
-
}), k = o(() => {
|
|
115
|
-
let e = {};
|
|
116
|
-
return g.requiredFields && g.requiredFields.length && g.requiredFields.forEach((t) => {
|
|
117
|
-
e[t] = !0;
|
|
118
|
-
}), e;
|
|
119
|
-
}), A = o(() => g.disabled === !0 ? !0 : g.disabled), j = p(() => g.enabledFields), M = p(() => g.requiredFields), N = p(() => g.disabledFields), P = async () => {
|
|
120
|
-
await u();
|
|
121
|
-
let e = w.value.$el.querySelector(".el-form-item.is-error");
|
|
122
|
-
e && e.scrollIntoView({
|
|
123
|
-
block: "center",
|
|
124
|
-
inline: "center",
|
|
125
|
-
behavior: "smooth"
|
|
126
|
-
});
|
|
127
|
-
}, F = f({
|
|
128
|
-
tableForm: T,
|
|
129
|
-
disabled: A,
|
|
130
|
-
enabledFields: j,
|
|
131
|
-
requiredFields: M,
|
|
132
|
-
enabledFieldsMap: O,
|
|
133
|
-
disabledFieldsMap: D,
|
|
134
|
-
requiredFieldsMap: k,
|
|
135
|
-
disabledFields: N,
|
|
136
|
-
scrollIntoRequiredField: P,
|
|
137
|
-
formRef: w,
|
|
138
|
-
validate: async () => {
|
|
139
|
-
try {
|
|
140
|
-
return await w.value.validate();
|
|
141
|
-
} catch {
|
|
142
|
-
throw await P(), w.value.$el.querySelectorAll(".el-form-item.is-error .el-form-item__content > :first-child").forEach((e) => {
|
|
143
|
-
h(e, "breathe-animation");
|
|
144
|
-
}), Error("表单验证不通过!");
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
validateField: (e) => w.value.validateField(e),
|
|
148
|
-
resetFields: (e) => w.value.resetFields(e),
|
|
149
|
-
scrollToField: (e) => w.value.scrollToField(e),
|
|
150
|
-
clearValidate: (e) => w.value.clearValidate(e),
|
|
151
|
-
getField: () => w.value.getField(),
|
|
152
|
-
setInitialValues: (e) => w.value.setInitialValues(e),
|
|
153
|
-
getFields: () => w.value.fields
|
|
154
|
-
});
|
|
155
|
-
return d(e, F), b(F), () => s(i, l({
|
|
156
|
-
ref: "form",
|
|
157
|
-
class: "form-holder",
|
|
158
|
-
"show-message": E.value
|
|
159
|
-
}, S.value), { default: () => {
|
|
160
|
-
if (T.value) {
|
|
161
|
-
var e, t, i;
|
|
162
|
-
return [
|
|
163
|
-
(e = _.top) == null ? void 0 : e.call(_),
|
|
164
|
-
s(r, {
|
|
165
|
-
class: { "hide-error-message": T.value },
|
|
166
|
-
columns: g.columns,
|
|
167
|
-
"col-count": g.colCount
|
|
168
|
-
}, { default: () => {
|
|
169
|
-
var e;
|
|
170
|
-
return [(e = _.default) == null ? void 0 : e.call(_), g.showAdvice ? s(n, {
|
|
171
|
-
"label-colspan": g.commentLabelColspan,
|
|
172
|
-
"value-colspan": g.commentValueColspan
|
|
173
|
-
}, null) : null];
|
|
174
|
-
} }),
|
|
175
|
-
(t = _.bottom) == null ? void 0 : t.call(_),
|
|
176
|
-
s("div", { class: "red-form-footer" }, [(i = _.footer) == null ? void 0 : i.call(_)])
|
|
177
|
-
];
|
|
178
|
-
} else {
|
|
179
|
-
var o;
|
|
180
|
-
return g.wrapRow ? s(a, null, { default: () => {
|
|
181
|
-
var e;
|
|
182
|
-
return [(e = _.default) == null ? void 0 : e.call(_)];
|
|
183
|
-
} }) : (o = _.default) == null ? void 0 : o.call(_);
|
|
184
|
-
}
|
|
185
|
-
} });
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
//#endregion
|
|
189
|
-
export { b as t };
|