@web-utils/form-ui 1.0.0-beta4 → 1.0.0-beta41
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/api/index.d.ts +60 -0
- package/api/index.mjs +42 -0
- package/awesome-button/index.d.ts +60 -0
- package/awesome-button/index.mjs +49 -0
- package/base.css +1 -0
- package/chunks/4GMuTlFS.mjs +25 -0
- package/chunks/B-YO6Py8.mjs +145 -0
- package/chunks/B1MSrc6f.mjs +8 -0
- package/chunks/B40JZqF5.mjs +60 -0
- package/chunks/BLNpMvUQ.mjs +95 -0
- package/chunks/BNQD6fKI.mjs +40 -0
- package/chunks/BROfNO6c.mjs +17 -0
- package/chunks/BiF8cEVB.mjs +102 -0
- package/chunks/Bm5eiSmT.mjs +79 -0
- package/chunks/C5BjmbyR.mjs +91 -0
- package/chunks/CBHZpxPE.mjs +108 -0
- package/chunks/CD2WYSl1.mjs +188 -0
- package/chunks/CE0MejA6.mjs +200 -0
- package/chunks/CSf0Lu3w.mjs +102 -0
- package/chunks/CXSIP67a.mjs +234 -0
- package/chunks/ChmDDqoZ2.mjs +478 -0
- package/chunks/ClpNoMQe.mjs +37 -0
- package/chunks/Csa9EgOO.mjs +152 -0
- package/chunks/CuBH-6_y.mjs +25 -0
- package/chunks/CybmpSN8.mjs +664 -0
- package/chunks/CzvmkGvn.mjs +89 -0
- package/chunks/DASUt7ot.mjs +166 -0
- package/chunks/DBNqhkDl.mjs +174 -0
- package/chunks/DMcUruCK2.mjs +207 -0
- package/chunks/DUjgfS7g.mjs +95 -0
- package/chunks/DWLv8UUC.mjs +612 -0
- package/chunks/Ds_Tpa_M.mjs +83 -0
- package/chunks/MeM8FGzA.mjs +200 -0
- package/chunks/_90XRi0U.mjs +105 -0
- package/chunks/_Uzl3uMy.mjs +109 -0
- package/chunks/b5HOxD60.mjs +1369 -0
- package/chunks/cmuHpsX6.mjs +109 -0
- package/chunks/ePSxkHli.mjs +95 -0
- package/chunks/jHrYQI1Q.mjs +320 -0
- package/chunks/kKoMKOYH.mjs +180 -0
- package/chunks/lPLJkGiz.mjs +25 -0
- package/chunks/mbLUSXcZ.mjs +56 -0
- package/chunks/y-DmM31a.mjs +168 -0
- package/confirm-button/index.d.ts +113 -0
- package/confirm-button/index.mjs +35 -0
- package/confirmable/index.d.ts +84 -0
- package/confirmable/index.mjs +8 -0
- package/constants/index.d.ts +53 -0
- package/constants/index.mjs +4 -0
- package/editable-tree/index.d.ts +254 -0
- package/editable-tree/index.mjs +2 -0
- package/editable-tree/style.css +1 -0
- package/element-dialog/index.d.ts +337 -16
- package/element-dialog/index.mjs +2 -91
- package/empty-view/index.d.ts +2 -2
- package/empty-view/index.mjs +1 -1
- package/flex-scroll-area/index.d.ts +1 -1
- package/flex-scroll-area/index.mjs +1 -1
- package/form-advice/index.mjs +13 -12
- package/form-button/index.d.ts +114 -0
- package/form-button/index.mjs +36 -0
- package/form-card/index.d.ts +14 -0
- package/form-card/index.mjs +18 -0
- package/form-cascader/index.d.ts +472 -0
- package/form-cascader/index.mjs +2 -0
- package/form-check-box-group/index.d.ts +289 -18
- package/form-check-box-group/index.mjs +1 -1
- package/form-check-box-group/style.css +1 -0
- package/form-checkbox/index.d.ts +236 -16
- package/form-checkbox/index.mjs +1 -1
- package/form-date-picker/index.d.ts +390 -19
- package/form-date-picker/index.mjs +1 -1
- package/form-holder/index.d.ts +87 -20
- package/form-holder/index.mjs +1 -1
- package/form-holder/style.css +1 -1
- package/form-image/index.d.ts +145 -13
- package/form-image/index.mjs +1 -1
- package/form-input/index.d.ts +301 -20
- package/form-input/index.mjs +1 -1
- package/form-input/style.css +1 -0
- package/form-input-cron-expression/index.d.ts +217 -0
- package/form-input-cron-expression/index.mjs +2 -0
- package/form-input-cron-expression/style.css +1 -0
- package/form-input-email/index.d.ts +307 -16
- package/form-input-email/index.mjs +1 -1
- package/form-input-id-card/index.d.ts +307 -16
- package/form-input-id-card/index.mjs +1 -1
- package/form-input-number/index.d.ts +246 -18
- package/form-input-number/index.mjs +1 -1
- package/form-input-phone-number/index.d.ts +307 -16
- package/form-input-phone-number/index.mjs +1 -1
- package/form-input-tag/index.d.ts +263 -1
- package/form-input-tag/index.mjs +1 -3
- package/form-input-time/index.d.ts +434 -1
- package/form-input-time/index.mjs +1 -3
- package/form-item-config-provider/index.d.ts +22 -0
- package/form-item-config-provider/index.mjs +24 -0
- package/form-item-group/index.d.ts +91 -17
- package/form-item-group/index.mjs +2 -78
- package/form-item-group/style.css +1 -1
- package/form-item-x/index.d.ts +141 -11
- package/form-item-x/index.mjs +1 -1
- package/form-item-x/style.css +1 -0
- package/form-radio-group/index.d.ts +303 -16
- package/form-radio-group/index.mjs +1 -1
- package/form-rate/index.d.ts +254 -14
- package/form-rate/index.mjs +1 -1
- package/form-red-table/index.mjs +27 -26
- package/form-row/index.d.ts +2 -2
- package/form-row/index.mjs +1 -1
- package/form-select/index.d.ts +537 -18
- package/form-select/index.mjs +1 -1
- package/form-slider/index.d.ts +283 -16
- package/form-slider/index.mjs +1 -1
- package/form-switch/index.d.ts +272 -14
- package/form-switch/index.mjs +1 -1
- package/form-text/index.d.ts +165 -13
- package/form-text/index.mjs +1 -1
- package/form-textarea/index.d.ts +351 -0
- package/form-textarea/index.mjs +2 -0
- package/form-time-select/index.d.ts +319 -0
- package/form-time-select/index.mjs +2 -0
- package/form-view/index.mjs +1 -1
- package/helper/dictionary.d.ts +15 -0
- package/helper/dictionary.mjs +97 -0
- package/hook/useDictionary.d.ts +60 -0
- package/hook/useDictionary.mjs +15 -0
- package/hook/useVisibilityChange.d.ts +4 -0
- package/hook/useVisibilityChange.mjs +14 -0
- package/iframe-window/index.d.ts +9 -0
- package/iframe-window/index.mjs +37 -0
- package/iframe-window/style.css +1 -0
- package/index.d.ts +52 -36
- package/index.mjs +54 -61
- package/package.json +10 -5
- package/pageable-table/index.d.ts +398 -0
- package/pageable-table/index.mjs +2 -0
- package/pageable-table/style.css +1 -0
- package/resize-observer/index.d.ts +8 -0
- package/resize-observer/index.mjs +40 -0
- package/resize-observer/style.css +1 -0
- package/resolver/index.mjs +29 -0
- package/table-column/index.d.ts +160 -0
- package/table-column/index.mjs +2 -0
- package/table-column/style.css +1 -0
- package/table-column-def/index.d.ts +85 -0
- package/table-column-def/index.mjs +11 -0
- package/table-view/index.d.ts +340 -1
- package/table-view/index.mjs +459 -6
- package/table-view/style.css +1 -0
- package/toolbar/index.d.ts +128 -1
- package/toolbar/index.mjs +1 -8
- package/toolbar/style.css +1 -0
- package/toolbar-button/index.d.ts +188 -1
- package/toolbar-button/index.mjs +1 -8
- package/vue-cron/index.d.ts +191 -0
- package/vue-cron/index.mjs +2 -0
- package/vue-cron/style.css +1 -0
- package/web-types.json +1 -1
- package/x-input-tag/index.d.ts +2 -0
- package/x-input-tag/index.mjs +232 -0
- package/x-input-tag/style.css +1 -0
- package/year-calendar/index.d.ts +99 -0
- package/year-calendar/index.mjs +2 -0
- package/year-calendar/style.css +1 -0
- package/chunks/B4M_TFeR.mjs +0 -152
- package/chunks/B5BIQCcK.mjs +0 -149
- package/chunks/BHNKrW1j.mjs +0 -61
- package/chunks/BO9jWhBl.mjs +0 -46
- package/chunks/BZ8aOa78.mjs +0 -35
- package/chunks/Bsz7y4Xp.mjs +0 -73
- package/chunks/Bxj372sF.mjs +0 -53
- package/chunks/C33EmJN8.mjs +0 -32
- package/chunks/C6Li3-l7.mjs +0 -28
- package/chunks/CBcdalMX.mjs +0 -35
- package/chunks/CdRsyF0n.mjs +0 -43
- package/chunks/ClNahmiU.mjs +0 -23
- package/chunks/CstztYMu.mjs +0 -28
- package/chunks/DC9b53M6.mjs +0 -32
- package/chunks/DDVAgRED.mjs +0 -36
- package/chunks/DpJQABVD.mjs +0 -91
- package/chunks/ZsLNWI9x.mjs +0 -46
- package/chunks/jn_iQrVZ.mjs +0 -28
- package/constants.d.ts +0 -1
- package/constants.mjs +0 -4
- package/input/style.css +0 -1
- package/resolver.mjs +0 -79
- package/utils/style.css +0 -1
- /package/{resolver.d.ts → resolver/index.d.ts} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { i as e } from "./cmuHpsX6.mjs";
|
|
2
|
+
import { getDictLabel as t } from "../helper/dictionary.mjs";
|
|
3
|
+
import { tableViewContextKey as n } from "../constants/index.mjs";
|
|
4
|
+
import { t as r } from "./Ds_Tpa_M.mjs";
|
|
5
|
+
import { computed as i, createVNode as a, inject as o, mergeProps as s, ref as c, watchEffect as l } from "vue";
|
|
6
|
+
import { ElTableColumn as u } from "element-plus/es";
|
|
7
|
+
import "element-plus/es/components/base/style/css";
|
|
8
|
+
import "element-plus/es/components/table-column/style/css";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region src/components/table/components/DictRender.vue
|
|
11
|
+
var d = {
|
|
12
|
+
name: "DictRender",
|
|
13
|
+
inheritAttrs: !1,
|
|
14
|
+
props: {
|
|
15
|
+
row: Object,
|
|
16
|
+
column: Object,
|
|
17
|
+
dictType: String,
|
|
18
|
+
options: Array,
|
|
19
|
+
treeDict: Boolean,
|
|
20
|
+
idAsValue: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: !0
|
|
23
|
+
},
|
|
24
|
+
labelAsValue: Boolean
|
|
25
|
+
},
|
|
26
|
+
setup(e, { attrs: n }) {
|
|
27
|
+
let r = c(null), o = i(() => e.row[e.column.property]);
|
|
28
|
+
return l(async () => {
|
|
29
|
+
if (e.dictType) r.value = await t(e.dictType, o.value, !0, {
|
|
30
|
+
options: !0,
|
|
31
|
+
treeDict: e.treeDict,
|
|
32
|
+
idAsValue: e.idAsValue,
|
|
33
|
+
labelAsValue: e.labelAsValue
|
|
34
|
+
});
|
|
35
|
+
else {
|
|
36
|
+
var n;
|
|
37
|
+
r.value = ((n = e.options) == null || (n = n.find((e) => `${e.modelValue}` == `${e.value}`)) == null ? void 0 : n.label) ?? `${o.value}`;
|
|
38
|
+
}
|
|
39
|
+
}), () => a("span", n, [r.value]);
|
|
40
|
+
}
|
|
41
|
+
}, f = {
|
|
42
|
+
selection: !0,
|
|
43
|
+
"single-selection": !0,
|
|
44
|
+
index: !0,
|
|
45
|
+
expand: !0
|
|
46
|
+
}, p = (e, t, n, r, i) => {
|
|
47
|
+
var a;
|
|
48
|
+
let o = (e == null || (a = e.$parent) == null ? void 0 : a.rowDbClick) || (e == null ? void 0 : e.rowDbClick);
|
|
49
|
+
o == null || o(t, n, r, i);
|
|
50
|
+
}, m = (e) => {
|
|
51
|
+
let t = e.target;
|
|
52
|
+
for (; t && t.tagName.toUpperCase() !== "HTML";) {
|
|
53
|
+
if (t.tagName.toUpperCase() === "TD") return t;
|
|
54
|
+
t = t.parentNode;
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}, h = () => {}, g = (t) => !e(t).length, _ = {
|
|
58
|
+
name: "TableColumn",
|
|
59
|
+
props: { ...r },
|
|
60
|
+
setup(e, { slots: t, attrs: r }) {
|
|
61
|
+
let i = o(n, null);
|
|
62
|
+
return () => {
|
|
63
|
+
let { clickable: n, cellClick: o, ...c } = e, l, _ = f[e.type];
|
|
64
|
+
if (!_) {
|
|
65
|
+
let s = n || r.onClick || o;
|
|
66
|
+
(s || e.dictType || e.options) && (l = (n) => {
|
|
67
|
+
var c;
|
|
68
|
+
let { row: l, column: u } = n, f = s ? (e) => {
|
|
69
|
+
let t = m(e);
|
|
70
|
+
if (r.onClick || o) {
|
|
71
|
+
var n;
|
|
72
|
+
(n = r.onClick) == null || n.call(r, l, u, l, u, t, e), o == null || o(l, u, l, u, t, e);
|
|
73
|
+
} else p(i, l, u, t, e);
|
|
74
|
+
} : h, _ = t == null || (c = t.default) == null ? void 0 : c.call(t, n);
|
|
75
|
+
return g(_) && (_ = null), (e.dictType || e.options) && !_ ? a(d, {
|
|
76
|
+
class: { "is-clickable": s },
|
|
77
|
+
onClick: f,
|
|
78
|
+
row: l,
|
|
79
|
+
column: u,
|
|
80
|
+
dictType: e.dictType,
|
|
81
|
+
treeDict: e.treeDict,
|
|
82
|
+
idAsValue: e.idAsValue,
|
|
83
|
+
labelAsValue: e.labelAsValue,
|
|
84
|
+
options: e.options
|
|
85
|
+
}, null) : s ? a("span", {
|
|
86
|
+
class: "is-clickable",
|
|
87
|
+
onClick: f
|
|
88
|
+
}, [_ || (l == null ? void 0 : l[u == null ? void 0 : u.property])]) : _;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return a(u, s(c, {
|
|
92
|
+
key: r.filterable,
|
|
93
|
+
showOverflowTooltip: _ ? !1 : c.showOverflowTooltip
|
|
94
|
+
}), {
|
|
95
|
+
...t,
|
|
96
|
+
default: l || t.default
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
export { _ as t };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { isFunction as e } from "@web-utils/core";
|
|
2
|
+
import { defineComponent as t, h as n, resolveComponent as r } from "vue";
|
|
3
|
+
import { ElLoading as i, ElMessageBox as a } from "element-plus";
|
|
4
|
+
//#region src/components/button/confirmable-mixin.ts
|
|
5
|
+
async function o(t, n, r) {
|
|
6
|
+
let { stop: o, prevent: s, message: c, loadable: l, loadingText: u, confirmable: d, confirmType: f, confirmText: p, confirmTitle: m } = n;
|
|
7
|
+
o && t.stopPropagation(), s && t.preventDefault();
|
|
8
|
+
let { onBefore: h, onClick: g, onCancel: _, onAfter: v } = r;
|
|
9
|
+
if (e(g)) try {
|
|
10
|
+
let n = !0;
|
|
11
|
+
if (e(h) && (n = await h(t)), !n) return;
|
|
12
|
+
d && await a.confirm(c || p, {
|
|
13
|
+
type: f,
|
|
14
|
+
title: m
|
|
15
|
+
});
|
|
16
|
+
let r;
|
|
17
|
+
l && (r = i.service({
|
|
18
|
+
background: "rgba(0,0,0,0.3)",
|
|
19
|
+
text: u
|
|
20
|
+
}));
|
|
21
|
+
let o;
|
|
22
|
+
try {
|
|
23
|
+
o = await g(t);
|
|
24
|
+
} catch {}
|
|
25
|
+
l && (r == null || r.close()), e(v) && await v(t, o);
|
|
26
|
+
} catch (t) {
|
|
27
|
+
e(_) && await _(t);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var s = t({
|
|
31
|
+
inheritAttrs: !1,
|
|
32
|
+
props: {
|
|
33
|
+
stop: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: !0
|
|
36
|
+
},
|
|
37
|
+
prevent: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: !0
|
|
40
|
+
},
|
|
41
|
+
text: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: ""
|
|
44
|
+
},
|
|
45
|
+
message: String,
|
|
46
|
+
confirmable: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !0
|
|
49
|
+
},
|
|
50
|
+
confirmText: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "你确定要删除该记录吗?"
|
|
53
|
+
},
|
|
54
|
+
confirmType: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: "warning"
|
|
57
|
+
},
|
|
58
|
+
confirmTitle: String,
|
|
59
|
+
loadable: Boolean,
|
|
60
|
+
loadingText: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "正在处理中请稍候..."
|
|
63
|
+
},
|
|
64
|
+
tag: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "i"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
render() {
|
|
70
|
+
let e = r(this.tag), { text: t, ...i } = this.$props, { onClick: a, ...s } = this.$attrs;
|
|
71
|
+
return n(e, {
|
|
72
|
+
...s,
|
|
73
|
+
...i,
|
|
74
|
+
onClick: (e) => o(e, this.$props, this.$attrs)
|
|
75
|
+
}, { default: this.$slots.default || (() => t) });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
//#endregion
|
|
79
|
+
export { s as t };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { i as e, n as t } from "./CXSIP67a.mjs";
|
|
2
|
+
import { n } from "./BROfNO6c.mjs";
|
|
3
|
+
import { createVNode as r, mergeProps as i, useModel as a } from "vue";
|
|
4
|
+
import { ElCheckbox as o } from "element-plus/es";
|
|
5
|
+
import "element-plus/es/components/base/style/css";
|
|
6
|
+
import "element-plus/es/components/checkbox/style/css";
|
|
7
|
+
//#region src/components/form/props/checkbox.ts
|
|
8
|
+
var s = {
|
|
9
|
+
...n,
|
|
10
|
+
modelValue: [
|
|
11
|
+
String,
|
|
12
|
+
Number,
|
|
13
|
+
Boolean
|
|
14
|
+
],
|
|
15
|
+
value: [
|
|
16
|
+
String,
|
|
17
|
+
Number,
|
|
18
|
+
Boolean,
|
|
19
|
+
Object
|
|
20
|
+
],
|
|
21
|
+
labelValue: [
|
|
22
|
+
String,
|
|
23
|
+
Number,
|
|
24
|
+
Boolean,
|
|
25
|
+
Object
|
|
26
|
+
],
|
|
27
|
+
trueValue: {
|
|
28
|
+
type: [String, Number],
|
|
29
|
+
default: "1"
|
|
30
|
+
},
|
|
31
|
+
falseValue: {
|
|
32
|
+
type: [String, Number],
|
|
33
|
+
default: "0"
|
|
34
|
+
},
|
|
35
|
+
border: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: !1
|
|
38
|
+
},
|
|
39
|
+
size: String,
|
|
40
|
+
name: String,
|
|
41
|
+
checked: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
},
|
|
45
|
+
indeterminate: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !1
|
|
48
|
+
},
|
|
49
|
+
validateEvent: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: !0
|
|
52
|
+
},
|
|
53
|
+
tabindex: [String, Number],
|
|
54
|
+
id: String,
|
|
55
|
+
ariaControls: String,
|
|
56
|
+
ariaLabel: String,
|
|
57
|
+
trueLabel: {
|
|
58
|
+
type: [String, Number],
|
|
59
|
+
default: "1"
|
|
60
|
+
},
|
|
61
|
+
falseLabel: {
|
|
62
|
+
type: [String, Number],
|
|
63
|
+
default: "0"
|
|
64
|
+
},
|
|
65
|
+
controls: String
|
|
66
|
+
}, c = {
|
|
67
|
+
modelValue: !0,
|
|
68
|
+
disabled: !0,
|
|
69
|
+
labelValue: !0
|
|
70
|
+
}, l = (e) => n[e] === void 0 && c[e] !== !0, u = {
|
|
71
|
+
name: "FormCheckbox",
|
|
72
|
+
inheritAttrs: !1,
|
|
73
|
+
props: { ...s },
|
|
74
|
+
emits: { ...t },
|
|
75
|
+
setup(t, { emit: n, slots: s, attrs: c }) {
|
|
76
|
+
let u = a(t, "modelValue"), { render: d, disabled: f, listeners: p, inputProps: m } = e(t, {
|
|
77
|
+
emit: n,
|
|
78
|
+
slots: s,
|
|
79
|
+
attrs: c,
|
|
80
|
+
predicate: l
|
|
81
|
+
});
|
|
82
|
+
return () => d({ vNodes: r(o, i(m.value, p.value, {
|
|
83
|
+
label: t.labelValue,
|
|
84
|
+
modelValue: u.value,
|
|
85
|
+
"onUpdate:modelValue": (e) => u.value = e,
|
|
86
|
+
disabled: f.value
|
|
87
|
+
}), { default: s.default }) });
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
//#endregion
|
|
91
|
+
export { u as t };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { i as e, n as t } from "./CXSIP67a.mjs";
|
|
2
|
+
import { n } from "./BROfNO6c.mjs";
|
|
3
|
+
import { createVNode as r, mergeProps as i, useModel as a } from "vue";
|
|
4
|
+
import { ElSwitch as o } from "element-plus/es";
|
|
5
|
+
import "element-plus/es/components/base/style/css";
|
|
6
|
+
import "element-plus/es/components/switch/style/css";
|
|
7
|
+
//#region src/components/form/props/switch.ts
|
|
8
|
+
var s = {
|
|
9
|
+
...n,
|
|
10
|
+
modelValue: [
|
|
11
|
+
Boolean,
|
|
12
|
+
String,
|
|
13
|
+
Number
|
|
14
|
+
],
|
|
15
|
+
loading: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: !1
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
},
|
|
23
|
+
width: [Number, String],
|
|
24
|
+
inlinePrompt: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: !1
|
|
27
|
+
},
|
|
28
|
+
activeIcon: [String, Object],
|
|
29
|
+
inactiveIcon: [String, Object],
|
|
30
|
+
activeActionIcon: [String, Object],
|
|
31
|
+
inactiveActionIcon: [String, Object],
|
|
32
|
+
activeText: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: ""
|
|
35
|
+
},
|
|
36
|
+
inactiveText: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ""
|
|
39
|
+
},
|
|
40
|
+
activeValue: {
|
|
41
|
+
type: [
|
|
42
|
+
Boolean,
|
|
43
|
+
String,
|
|
44
|
+
Number
|
|
45
|
+
],
|
|
46
|
+
default: "Y"
|
|
47
|
+
},
|
|
48
|
+
inactiveValue: {
|
|
49
|
+
type: [
|
|
50
|
+
Boolean,
|
|
51
|
+
String,
|
|
52
|
+
Number
|
|
53
|
+
],
|
|
54
|
+
default: "N"
|
|
55
|
+
},
|
|
56
|
+
name: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ""
|
|
59
|
+
},
|
|
60
|
+
validateEvent: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: !0
|
|
63
|
+
},
|
|
64
|
+
beforeChange: Function,
|
|
65
|
+
id: String,
|
|
66
|
+
tabindex: [String, Number],
|
|
67
|
+
ariaLabel: String,
|
|
68
|
+
activeColor: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: ""
|
|
71
|
+
},
|
|
72
|
+
inactiveColor: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: ""
|
|
75
|
+
},
|
|
76
|
+
borderColor: {
|
|
77
|
+
type: String,
|
|
78
|
+
default: ""
|
|
79
|
+
}
|
|
80
|
+
}, c = {
|
|
81
|
+
disabled: !0,
|
|
82
|
+
modelValue: !0
|
|
83
|
+
}, l = (e) => n[e] === void 0 && c[e] !== !0, u = {
|
|
84
|
+
name: "FormSwitch",
|
|
85
|
+
inheritAttrs: !1,
|
|
86
|
+
props: { ...s },
|
|
87
|
+
emits: { ...t },
|
|
88
|
+
setup(t, { emit: n, slots: s, attrs: c }) {
|
|
89
|
+
let u = a(t, "modelValue"), { render: d, disabled: f, listeners: p, inputProps: m } = e(t, {
|
|
90
|
+
emit: n,
|
|
91
|
+
attrs: c,
|
|
92
|
+
slots: s,
|
|
93
|
+
predicate: l
|
|
94
|
+
});
|
|
95
|
+
return () => d({ vNodes: r(o, i(p.value, m.value, {
|
|
96
|
+
modelValue: u.value,
|
|
97
|
+
"onUpdate:modelValue": (e) => u.value = e,
|
|
98
|
+
disabled: f.value
|
|
99
|
+
}), {
|
|
100
|
+
"active-action": s["active-action"],
|
|
101
|
+
"inactive-action": s["inactive-action"],
|
|
102
|
+
active: s.active,
|
|
103
|
+
inactive: s.inactive
|
|
104
|
+
}) });
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
108
|
+
export { u as t };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { u as e } from "./cmuHpsX6.mjs";
|
|
2
|
+
import { formHolderContextKey as t, formViewContextKey as n } from "../constants/index.mjs";
|
|
3
|
+
import r from "../form-advice/index.mjs";
|
|
4
|
+
import i from "../form-red-table/index.mjs";
|
|
5
|
+
import { animate as a } from "@web-utils/core";
|
|
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 { ElForm as h, ElRow as g } from "element-plus/es";
|
|
8
|
+
import "element-plus/es/components/base/style/css";
|
|
9
|
+
import "element-plus/es/components/row/style/css";
|
|
10
|
+
import "element-plus/es/components/form/style/css";
|
|
11
|
+
//#region src/components/form/props/form.ts
|
|
12
|
+
var _ = {
|
|
13
|
+
model: Object,
|
|
14
|
+
rules: Object,
|
|
15
|
+
inline: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: !1
|
|
18
|
+
},
|
|
19
|
+
labelPosition: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "right"
|
|
22
|
+
},
|
|
23
|
+
labelWidth: {
|
|
24
|
+
type: [String, Number],
|
|
25
|
+
default: "auto"
|
|
26
|
+
},
|
|
27
|
+
labelSuffix: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ""
|
|
30
|
+
},
|
|
31
|
+
hideRequiredAsterisk: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: !1
|
|
34
|
+
},
|
|
35
|
+
requireAsteriskPosition: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: "left"
|
|
38
|
+
},
|
|
39
|
+
showMessage: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: !0
|
|
42
|
+
},
|
|
43
|
+
inlineMessage: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: !1
|
|
46
|
+
},
|
|
47
|
+
statusIcon: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: !1
|
|
50
|
+
},
|
|
51
|
+
validateOnRuleChange: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: !0
|
|
54
|
+
},
|
|
55
|
+
size: String,
|
|
56
|
+
disabled: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: void 0
|
|
59
|
+
},
|
|
60
|
+
scrollToError: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: !1
|
|
63
|
+
},
|
|
64
|
+
scrollIntoViewOptions: [Object, Boolean],
|
|
65
|
+
requiredFields: Array,
|
|
66
|
+
disabledFields: Array,
|
|
67
|
+
enabledFields: Array,
|
|
68
|
+
showAdvice: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: !0
|
|
71
|
+
},
|
|
72
|
+
columns: [Array, Object],
|
|
73
|
+
colCount: Number,
|
|
74
|
+
notTableForm: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: void 0
|
|
77
|
+
},
|
|
78
|
+
commentValueColspan: Number,
|
|
79
|
+
commentLabelColspan: Number,
|
|
80
|
+
wrapRow: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !0
|
|
83
|
+
}
|
|
84
|
+
}, v = {
|
|
85
|
+
showMessage: !0,
|
|
86
|
+
required: !0,
|
|
87
|
+
requiredFields: !0,
|
|
88
|
+
disabledFields: !0,
|
|
89
|
+
enabledFields: !0,
|
|
90
|
+
showAdvice: !0,
|
|
91
|
+
columns: !0,
|
|
92
|
+
colCount: !0,
|
|
93
|
+
notTableForm: !0,
|
|
94
|
+
commentValueColspan: !0,
|
|
95
|
+
commentLabelColspan: !0,
|
|
96
|
+
wrapRow: !0
|
|
97
|
+
}, y = (e) => v[e] !== !0, b = {
|
|
98
|
+
name: "FormHolder",
|
|
99
|
+
inheritAttrs: !1,
|
|
100
|
+
props: { ..._ },
|
|
101
|
+
emits: {},
|
|
102
|
+
setup(_, { slots: v, expose: b }) {
|
|
103
|
+
let { autoBindProps: x, listeners: S } = e(_, { predicate: y }), C = c(n, null), w = m("form"), T = o(() => _.notTableForm === void 0 ? (C == null ? void 0 : C.tableForm) === void 0 ? !1 : C == null ? void 0 : C.tableForm : !_.notTableForm), E = o(() => T.value ? !1 : _.showMessage), D = o(() => {
|
|
104
|
+
let e = {};
|
|
105
|
+
return _.disabledFields && _.disabledFields.forEach((t) => {
|
|
106
|
+
e[t] = !0;
|
|
107
|
+
}), e;
|
|
108
|
+
}), O = o(() => {
|
|
109
|
+
let e = {};
|
|
110
|
+
return _.enabledFields && _.enabledFields.length && _.enabledFields.forEach((t) => {
|
|
111
|
+
e[t] = !0;
|
|
112
|
+
}), e;
|
|
113
|
+
}), k = o(() => {
|
|
114
|
+
let e = {};
|
|
115
|
+
return _.requiredFields && _.requiredFields.length && _.requiredFields.forEach((t) => {
|
|
116
|
+
e[t] = !0;
|
|
117
|
+
}), e;
|
|
118
|
+
}), A = o(() => _.disabled === !0 ? !0 : _.disabled), j = p(() => _.enabledFields), M = p(() => _.requiredFields), N = p(() => _.disabledFields), P = async () => {
|
|
119
|
+
await u();
|
|
120
|
+
let e = w.value.$el.querySelector(".el-form-item.is-error");
|
|
121
|
+
e && e.scrollIntoView({
|
|
122
|
+
block: "center",
|
|
123
|
+
inline: "center",
|
|
124
|
+
behavior: "smooth"
|
|
125
|
+
});
|
|
126
|
+
}, F = f({
|
|
127
|
+
tableForm: T,
|
|
128
|
+
disabled: A,
|
|
129
|
+
enabledFields: j,
|
|
130
|
+
requiredFields: M,
|
|
131
|
+
enabledFieldsMap: O,
|
|
132
|
+
disabledFieldsMap: D,
|
|
133
|
+
requiredFieldsMap: k,
|
|
134
|
+
disabledFields: N,
|
|
135
|
+
scrollIntoRequiredField: P,
|
|
136
|
+
formRef: w,
|
|
137
|
+
validate: async () => {
|
|
138
|
+
try {
|
|
139
|
+
return await w.value.validate();
|
|
140
|
+
} catch {
|
|
141
|
+
throw await P(), w.value.$el.querySelectorAll(".el-form-item.is-error .el-form-item__content > :first-child").forEach((e) => {
|
|
142
|
+
a(e, "breathe-animation");
|
|
143
|
+
}), Error("表单验证不通过!");
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
validateField: (e) => w.value.validateField(e),
|
|
147
|
+
resetFields: (e) => w.value.resetFields(e),
|
|
148
|
+
scrollToField: (e) => w.value.scrollToField(e),
|
|
149
|
+
clearValidate: (e) => w.value.clearValidate(e),
|
|
150
|
+
getField: () => w.value.getField(),
|
|
151
|
+
setInitialValues: (e) => w.value.setInitialValues(e),
|
|
152
|
+
getFields: () => w.value.fields
|
|
153
|
+
});
|
|
154
|
+
return d(t, F), b(F), () => s(h, l(S.value, x.value, {
|
|
155
|
+
ref: "form",
|
|
156
|
+
class: "form-holder",
|
|
157
|
+
"show-message": E.value
|
|
158
|
+
}), { default: () => {
|
|
159
|
+
if (T.value) {
|
|
160
|
+
var e, t, n;
|
|
161
|
+
return [
|
|
162
|
+
(e = v.top) == null ? void 0 : e.call(v),
|
|
163
|
+
s(i, {
|
|
164
|
+
class: { "hide-error-message": T.value },
|
|
165
|
+
columns: _.columns,
|
|
166
|
+
"col-count": _.colCount
|
|
167
|
+
}, { default: () => {
|
|
168
|
+
var e;
|
|
169
|
+
return [(e = v.default) == null ? void 0 : e.call(v), _.showAdvice ? s(r, {
|
|
170
|
+
"label-colspan": _.commentLabelColspan,
|
|
171
|
+
"value-colspan": _.commentValueColspan
|
|
172
|
+
}, null) : null];
|
|
173
|
+
} }),
|
|
174
|
+
(t = v.bottom) == null ? void 0 : t.call(v),
|
|
175
|
+
s("div", { class: "red-form-footer" }, [(n = v.footer) == null ? void 0 : n.call(v)])
|
|
176
|
+
];
|
|
177
|
+
} else {
|
|
178
|
+
var a;
|
|
179
|
+
return _.wrapRow ? s(g, null, { default: () => {
|
|
180
|
+
var e;
|
|
181
|
+
return [(e = v.default) == null ? void 0 : e.call(v)];
|
|
182
|
+
} }) : (a = v.default) == null ? void 0 : a.call(v);
|
|
183
|
+
}
|
|
184
|
+
} });
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
//#endregion
|
|
188
|
+
export { b as t };
|