@web-utils/form-ui 1.0.0-beta5 → 1.0.0-beta51

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.
Files changed (208) hide show
  1. package/api/index.d.ts +60 -0
  2. package/api/index.mjs +42 -0
  3. package/awesome-button/index.d.ts +60 -0
  4. package/awesome-button/index.mjs +49 -0
  5. package/base.css +1 -1
  6. package/chunks/6yfBZFOB.mjs +56 -0
  7. package/chunks/B1IPSTA6.mjs +198 -0
  8. package/chunks/B9gA65rt2.mjs +38 -0
  9. package/chunks/BBERmTup.mjs +83 -0
  10. package/chunks/BG8z3V9d2.mjs +643 -0
  11. package/chunks/BQk3-Ppb2.mjs +146 -0
  12. package/chunks/BQyL45PF2.mjs +207 -0
  13. package/chunks/BWh6u1O0.mjs +660 -0
  14. package/chunks/BbSPWDDZ.mjs +100 -0
  15. package/chunks/BfxDxIg0.mjs +106 -0
  16. package/chunks/BqWvBF14.mjs +35 -0
  17. package/chunks/BsZgAJX_2.mjs +81 -0
  18. package/chunks/BtcjAHE6.mjs +317 -0
  19. package/chunks/Bwbtu2cp.mjs +194 -0
  20. package/chunks/ByHz4mmh.mjs +87 -0
  21. package/chunks/C2zgFLYO.mjs +185 -0
  22. package/chunks/C7G-cAoI.mjs +1361 -0
  23. package/chunks/CAd1zK9Q.mjs +25 -0
  24. package/chunks/CJdkjadi.mjs +17 -0
  25. package/chunks/CXsoKP22.mjs +86 -0
  26. package/chunks/CabldOLo.mjs +157 -0
  27. package/chunks/CkOD-_VV.mjs +8 -0
  28. package/chunks/CqVd8D222.mjs +89 -0
  29. package/chunks/CuAoMR3n.mjs +105 -0
  30. package/chunks/DA7oGHSX.mjs +141 -0
  31. package/chunks/DKwp6AMl.mjs +168 -0
  32. package/chunks/DOP3aBxf.mjs +93 -0
  33. package/chunks/DOZRzqlo.mjs +37 -0
  34. package/chunks/D_Fs3bkZ.mjs +57 -0
  35. package/chunks/D_qiRmiE.mjs +230 -0
  36. package/chunks/DcTVYqeJ.mjs +113 -0
  37. package/chunks/Dt3lfDnL.mjs +166 -0
  38. package/chunks/GI8krYU82.mjs +478 -0
  39. package/chunks/V2p-PCpL.mjs +176 -0
  40. package/chunks/YFiU0ngn.mjs +622 -0
  41. package/chunks/bFbPPcdq.mjs +25 -0
  42. package/chunks/eae6huQB.mjs +25 -0
  43. package/chunks/gCeDFHo1.mjs +32 -0
  44. package/chunks/gLPy4Sus.mjs +164 -0
  45. package/chunks/hlha6Bhc.mjs +107 -0
  46. package/chunks/pIzhYsBe.mjs +93 -0
  47. package/chunks/wDS9KBFw.mjs +67 -0
  48. package/chunks/wXeqV-_7.mjs +89 -0
  49. package/confirm-button/index.d.ts +122 -0
  50. package/confirm-button/index.mjs +35 -0
  51. package/confirmable/index.d.ts +93 -0
  52. package/confirmable/index.mjs +8 -0
  53. package/constants/index.d.ts +54 -0
  54. package/constants/index.mjs +4 -0
  55. package/dict-render/index.d.ts +28 -0
  56. package/dict-render/index.mjs +2 -0
  57. package/editable-tree/index.d.ts +254 -0
  58. package/editable-tree/index.mjs +2 -0
  59. package/editable-tree/style.css +1 -0
  60. package/element-dialog/index.d.ts +337 -16
  61. package/element-dialog/index.mjs +2 -91
  62. package/element-resize-observer/index.d.ts +8 -0
  63. package/element-resize-observer/index.mjs +40 -0
  64. package/element-resize-observer/style.css +1 -0
  65. package/empty-view/index.d.ts +2 -2
  66. package/empty-view/index.mjs +1 -1
  67. package/flex-scroll-area/index.d.ts +1 -1
  68. package/flex-scroll-area/index.mjs +1 -1
  69. package/form-advice/index.mjs +13 -12
  70. package/form-button/index.d.ts +123 -0
  71. package/form-button/index.mjs +36 -0
  72. package/form-card/index.d.ts +14 -0
  73. package/form-card/index.mjs +18 -0
  74. package/form-cascader/index.d.ts +472 -0
  75. package/form-cascader/index.mjs +2 -0
  76. package/form-checkbox/index.d.ts +236 -16
  77. package/form-checkbox/index.mjs +1 -1
  78. package/form-checkbox-group/index.d.ts +364 -0
  79. package/form-checkbox-group/index.mjs +2 -0
  80. package/form-checkbox-group/style.css +1 -0
  81. package/form-date-picker/index.d.ts +390 -19
  82. package/form-date-picker/index.mjs +1 -1
  83. package/form-holder/index.d.ts +87 -20
  84. package/form-holder/index.mjs +1 -1
  85. package/form-holder/style.css +1 -1
  86. package/form-image/index.d.ts +145 -13
  87. package/form-image/index.mjs +1 -1
  88. package/form-input/index.d.ts +301 -20
  89. package/form-input/index.mjs +1 -1
  90. package/form-input/style.css +1 -0
  91. package/form-input-cron-expression/index.d.ts +217 -0
  92. package/form-input-cron-expression/index.mjs +2 -0
  93. package/form-input-cron-expression/style.css +1 -0
  94. package/form-input-email/index.d.ts +307 -16
  95. package/form-input-email/index.mjs +1 -1
  96. package/form-input-id-card/index.d.ts +307 -16
  97. package/form-input-id-card/index.mjs +1 -1
  98. package/form-input-number/index.d.ts +246 -18
  99. package/form-input-number/index.mjs +1 -1
  100. package/form-input-phone-number/index.d.ts +307 -16
  101. package/form-input-phone-number/index.mjs +1 -1
  102. package/form-input-tag/index.d.ts +263 -1
  103. package/form-input-tag/index.mjs +1 -3
  104. package/form-input-time/index.d.ts +434 -1
  105. package/form-input-time/index.mjs +1 -3
  106. package/form-item-config-provider/index.d.ts +22 -0
  107. package/form-item-config-provider/index.mjs +24 -0
  108. package/form-item-group/index.d.ts +91 -17
  109. package/form-item-group/index.mjs +2 -78
  110. package/form-item-group/style.css +1 -1
  111. package/form-item-x/index.d.ts +141 -11
  112. package/form-item-x/index.mjs +1 -1
  113. package/form-item-x/style.css +1 -0
  114. package/form-radio-group/index.d.ts +303 -16
  115. package/form-radio-group/index.mjs +1 -1
  116. package/form-rate/index.d.ts +254 -14
  117. package/form-rate/index.mjs +1 -1
  118. package/form-red-table/index.mjs +27 -26
  119. package/form-row/index.d.ts +2 -2
  120. package/form-row/index.mjs +1 -1
  121. package/form-select/index.d.ts +537 -18
  122. package/form-select/index.mjs +1 -1
  123. package/form-slider/index.d.ts +283 -16
  124. package/form-slider/index.mjs +1 -1
  125. package/form-switch/index.d.ts +272 -14
  126. package/form-switch/index.mjs +1 -1
  127. package/form-table/index.d.ts +269 -0
  128. package/form-table/index.mjs +2 -0
  129. package/form-table-plus/index.d.ts +266 -0
  130. package/form-table-plus/index.mjs +2 -0
  131. package/form-text/index.d.ts +165 -13
  132. package/form-text/index.mjs +1 -1
  133. package/form-textarea/index.d.ts +351 -0
  134. package/form-textarea/index.mjs +2 -0
  135. package/form-time-select/index.d.ts +319 -0
  136. package/form-time-select/index.mjs +2 -0
  137. package/form-view/index.mjs +1 -1
  138. package/helper/dictionary.d.ts +15 -0
  139. package/helper/dictionary.mjs +97 -0
  140. package/hook/useDictionary.d.ts +60 -0
  141. package/hook/useDictionary.mjs +15 -0
  142. package/hook/useVisibilityChange.d.ts +4 -0
  143. package/hook/useVisibilityChange.mjs +14 -0
  144. package/iframe-window/index.d.ts +9 -0
  145. package/iframe-window/index.mjs +37 -0
  146. package/iframe-window/style.css +1 -0
  147. package/index.css +2 -0
  148. package/index.d.ts +57 -36
  149. package/index.mjs +59 -61
  150. package/package.json +10 -5
  151. package/pageable-table/index.d.ts +400 -0
  152. package/pageable-table/index.mjs +2 -0
  153. package/pageable-table/style.css +1 -0
  154. package/resolver/index.mjs +29 -0
  155. package/sub-table/index.d.ts +100 -0
  156. package/sub-table/index.mjs +537 -0
  157. package/sub-table/style.css +1 -0
  158. package/sub-table-plus/index.d.ts +100 -0
  159. package/sub-table-plus/index.mjs +2 -0
  160. package/sub-table-plus/style.css +1 -0
  161. package/table-column/index.d.ts +160 -0
  162. package/table-column/index.mjs +2 -0
  163. package/table-column/style.css +1 -0
  164. package/table-column-def/index.d.ts +95 -0
  165. package/table-column-def/index.mjs +11 -0
  166. package/table-view/index.d.ts +341 -1
  167. package/table-view/index.mjs +457 -6
  168. package/table-view/style.css +1 -0
  169. package/toolbar/index.d.ts +128 -1
  170. package/toolbar/index.mjs +1 -8
  171. package/toolbar/style.css +1 -0
  172. package/toolbar-button/index.d.ts +188 -1
  173. package/toolbar-button/index.mjs +1 -8
  174. package/vue-cron/index.d.ts +191 -0
  175. package/vue-cron/index.mjs +2 -0
  176. package/vue-cron/style.css +1 -0
  177. package/web-types.json +1 -1
  178. package/x-input-tag/index.d.ts +2 -0
  179. package/x-input-tag/index.mjs +228 -0
  180. package/x-input-tag/style.css +1 -0
  181. package/year-calendar/index.d.ts +99 -0
  182. package/year-calendar/index.mjs +2 -0
  183. package/year-calendar/style.css +1 -0
  184. package/chunks/B4M_TFeR.mjs +0 -152
  185. package/chunks/B5BIQCcK.mjs +0 -149
  186. package/chunks/BHNKrW1j.mjs +0 -61
  187. package/chunks/BO9jWhBl.mjs +0 -46
  188. package/chunks/BZ8aOa78.mjs +0 -35
  189. package/chunks/Bsz7y4Xp.mjs +0 -73
  190. package/chunks/Bxj372sF.mjs +0 -53
  191. package/chunks/C33EmJN8.mjs +0 -32
  192. package/chunks/C6Li3-l7.mjs +0 -28
  193. package/chunks/CBcdalMX.mjs +0 -35
  194. package/chunks/CdRsyF0n.mjs +0 -43
  195. package/chunks/ClNahmiU.mjs +0 -23
  196. package/chunks/CstztYMu.mjs +0 -28
  197. package/chunks/DC9b53M6.mjs +0 -32
  198. package/chunks/DDVAgRED.mjs +0 -36
  199. package/chunks/DpJQABVD.mjs +0 -91
  200. package/chunks/ZsLNWI9x.mjs +0 -46
  201. package/chunks/jn_iQrVZ.mjs +0 -28
  202. package/constants.d.ts +0 -1
  203. package/constants.mjs +0 -4
  204. package/form-check-box-group/index.d.ts +0 -93
  205. package/form-check-box-group/index.mjs +0 -2
  206. package/input/style.css +0 -1
  207. package/resolver.mjs +0 -79
  208. /package/{resolver.d.ts → resolver/index.d.ts} +0 -0
@@ -0,0 +1,168 @@
1
+ import { i as e, n as t } from "./D_qiRmiE.mjs";
2
+ import { n, t as r } from "./CJdkjadi.mjs";
3
+ import { createVNode as i, mergeProps as a } from "vue";
4
+ import { ElTimePicker as o } from "element-plus/es";
5
+ //#region src/components/form/props/time.ts
6
+ var s = {
7
+ ...n,
8
+ ...r,
9
+ modelValue: [
10
+ Number,
11
+ String,
12
+ Object
13
+ ],
14
+ readonly: {
15
+ type: Boolean,
16
+ default: !1
17
+ },
18
+ editable: {
19
+ type: Boolean,
20
+ default: !0
21
+ },
22
+ clearable: {
23
+ type: Boolean,
24
+ default: !0
25
+ },
26
+ size: String,
27
+ placeholder: {
28
+ type: String,
29
+ default: ""
30
+ },
31
+ startPlaceholder: {
32
+ type: String,
33
+ default: "开始时间"
34
+ },
35
+ endPlaceholder: {
36
+ type: String,
37
+ default: "结束时间"
38
+ },
39
+ isRange: {
40
+ type: Boolean,
41
+ default: !1
42
+ },
43
+ arrowControl: {
44
+ type: Boolean,
45
+ default: !1
46
+ },
47
+ popperClass: {
48
+ type: String,
49
+ default: ""
50
+ },
51
+ popperStyle: [String, Object],
52
+ popperOptions: Object,
53
+ fallbackPlacements: {
54
+ type: Array,
55
+ default: () => [
56
+ "bottom",
57
+ "top",
58
+ "right",
59
+ "left"
60
+ ]
61
+ },
62
+ placement: {
63
+ type: String,
64
+ default: "bottom-start"
65
+ },
66
+ rangeSeparator: {
67
+ type: String,
68
+ default: "-"
69
+ },
70
+ format: {
71
+ type: String,
72
+ default: "HH:mm:ss"
73
+ },
74
+ defaultValue: [Date, Array],
75
+ valueFormat: String,
76
+ id: [String, Array],
77
+ name: {
78
+ type: String,
79
+ default: ""
80
+ },
81
+ ariaLabel: String,
82
+ prefixIcon: [String, Object],
83
+ clearIcon: [String, Object],
84
+ disabledHours: Function,
85
+ disabledMinutes: Function,
86
+ disabledSeconds: Function,
87
+ teleported: {
88
+ type: Boolean,
89
+ default: !0
90
+ },
91
+ tabindex: [String, Number],
92
+ emptyValues: Array,
93
+ valueOnClear: [
94
+ String,
95
+ Number,
96
+ Boolean,
97
+ Function
98
+ ],
99
+ saveOnBlur: {
100
+ type: Boolean,
101
+ default: !0
102
+ },
103
+ range: Boolean,
104
+ start: {
105
+ type: String,
106
+ default: "09:00"
107
+ },
108
+ end: {
109
+ type: String,
110
+ default: "18:00"
111
+ },
112
+ step: {
113
+ type: String,
114
+ default: "00:30"
115
+ },
116
+ minTime: {
117
+ type: String,
118
+ default: "00:00"
119
+ },
120
+ maxTime: {
121
+ type: String,
122
+ default: ""
123
+ },
124
+ selectableRange: String
125
+ }, c = {
126
+ disabled: !0,
127
+ modelValue: !0,
128
+ isRange: !0,
129
+ range: !0,
130
+ placement: !0,
131
+ popperOptions: !0,
132
+ start: !0,
133
+ end: !0,
134
+ step: !0,
135
+ minTime: !0,
136
+ maxTime: !0,
137
+ selectableRange: !0
138
+ }, l = (e) => n[e] === void 0 && c[e] !== !0, u = {
139
+ name: "FormInputTime",
140
+ inheritAttrs: !1,
141
+ props: { ...s },
142
+ emits: { ...t },
143
+ setup(t, { emit: n, slots: r, attrs: s }) {
144
+ let { emitInput: c, render: u, placeholder: d, disabled: f, listeners: p, inputProps: m } = e(t, {
145
+ emit: n,
146
+ slots: r,
147
+ attrs: s,
148
+ predicate: l
149
+ }), h = { modifiers: [{
150
+ name: "arrow",
151
+ options: { padding: ({ popper: e, reference: t, placement: n }) => e.width / 2 }
152
+ }] };
153
+ return () => u({ vNodes: i(o, a(p.value, m.value, {
154
+ "popper-options": t.popperOptions || h,
155
+ style: "width: 100%",
156
+ placement: t.placement || "left",
157
+ "is-range": t.isRange || t.range,
158
+ format: t.format,
159
+ "value-format": t.valueFormat || t.format,
160
+ modelValue: t.modelValue,
161
+ disabled: f.value,
162
+ "onUpdate:modelValue": c,
163
+ placeholder: d.value
164
+ }), null) });
165
+ }
166
+ };
167
+ //#endregion
168
+ export { u as t };
@@ -0,0 +1,93 @@
1
+ import { columnSizeContextKey as e, setColumnSizeContextKey as t } from "../constants/index.mjs";
2
+ import n from "../form-cell/index.mjs";
3
+ import { camelize as r, isDef as i, isString as a } from "@web-utils/core";
4
+ import { Comment as o, Fragment as s, Text as c, createVNode as l, inject as u, isVNode as d } from "vue";
5
+ import { ElTooltip as f } from "element-plus/es";
6
+ //#region src/components/red-form/FormRow.vue?vue&type=script&lang.jsx
7
+ function p(e) {
8
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !d(e);
9
+ }
10
+ var m = (e) => {
11
+ let t = Object.keys({});
12
+ for (let n in e) t[r(n)] = e[n];
13
+ return t;
14
+ }, h = (e, { columnSize: t }) => {
15
+ if (!e || !e.length) return null;
16
+ e = e.filter((e) => e.type !== o);
17
+ let n = [], r = e.length === 1;
18
+ for (let o = 0; o < e.length; o++) {
19
+ let v = e[o], { name: y } = v.type;
20
+ if (v.type === c) n.push({
21
+ tag: y,
22
+ type: "text",
23
+ content: v,
24
+ colspan: r ? t : 0
25
+ });
26
+ else if (v.type === s) n.push(...h(v.children, { columnSize: t }));
27
+ else if (a(v.type) && v.type === "td") n.push({
28
+ tag: v.type,
29
+ type: "td",
30
+ content: v
31
+ });
32
+ else if (y === "FormCell") n.push({
33
+ tag: y,
34
+ type: "FormCell",
35
+ content: v
36
+ });
37
+ else if (typeof v.type == "object") {
38
+ var u, d;
39
+ let { label: e, hideLabel: a, labelColspan: o, inputColspan: s, labelRowspan: c, inputRowspan: h, tipsAfterLabel: b, tips: x } = m(v.props);
40
+ if (!i(a)) {
41
+ var p, g, _;
42
+ let t = (p = v.children) == null ? void 0 : p.tips, r = t || x ? l(f, {
43
+ effect: "light",
44
+ content: x,
45
+ offset: 4
46
+ }, {
47
+ default: () => l("i", { class: "el-icon-info form-item-input-info" }, null),
48
+ content: t || null
49
+ }) : null;
50
+ n.push({
51
+ tag: y,
52
+ type: "label",
53
+ colspan: o,
54
+ rowspan: c,
55
+ content: [((g = v.children) == null || (_ = g.label) == null ? void 0 : _.call(g)) || e, b === "" ? r : null]
56
+ });
57
+ }
58
+ let S;
59
+ S = r && i(a) ? t : i(s) ? s : r ? t - 1 : 0, n.push({
60
+ tag: y,
61
+ type: "input",
62
+ colspan: S,
63
+ rowspan: h,
64
+ content: [v, (u = v.children) == null || (d = u.below) == null ? void 0 : d.call(u)]
65
+ });
66
+ } else console.error("未知节点");
67
+ }
68
+ return n;
69
+ }, g = {
70
+ name: "FormRow",
71
+ props: {
72
+ isLabel: Boolean,
73
+ alignCenter: Boolean
74
+ },
75
+ setup(r, { slots: i }) {
76
+ let a = u(t, null), o = u(e, null);
77
+ return () => {
78
+ var e;
79
+ let t = (e = i.default) == null ? void 0 : e.call(i), s = [];
80
+ return s.push(...h(t, { columnSize: (o == null ? void 0 : o.value) ?? 0 })), ((o == null ? void 0 : o.value) ?? 0) < s.length && (a == null || a(s.length)), l("tr", null, [s.map(({ tag: e, type: t, colspan: i, rowspan: a, content: o }) => e === "td" || t === "FormCell" ? o : t === "text" ? l(n, {
81
+ isLabel: r.isLabel,
82
+ alignCenter: r.alignCenter,
83
+ colspan: i
84
+ }, p(o) ? o : { default: () => [o] }) : l("td", {
85
+ class: t,
86
+ colspan: i,
87
+ rowspan: a
88
+ }, [o]))]);
89
+ };
90
+ }
91
+ };
92
+ //#endregion
93
+ export { g as t };
@@ -0,0 +1,37 @@
1
+ import { getDictLabel as e } from "../helper/dictionary.mjs";
2
+ import { computed as t, createVNode as n, ref as r, watchEffect as i } from "vue";
3
+ //#endregion
4
+ //#region src/components/table/DictRender.vue
5
+ var a = {
6
+ name: "DictRender",
7
+ inheritAttrs: !1,
8
+ props: {
9
+ row: Object,
10
+ column: Object,
11
+ dictType: String,
12
+ options: Array,
13
+ treeDict: Boolean,
14
+ idAsValue: {
15
+ type: Boolean,
16
+ default: !0
17
+ },
18
+ labelAsValue: Boolean
19
+ },
20
+ setup(a, { attrs: o }) {
21
+ let s = r(null), c = t(() => a.row[a.column.property]);
22
+ return i(async () => {
23
+ if (a.dictType) s.value = await e(a.dictType, c.value, !0, {
24
+ options: !0,
25
+ treeDict: a.treeDict,
26
+ idAsValue: a.idAsValue,
27
+ labelAsValue: a.labelAsValue
28
+ });
29
+ else {
30
+ var t;
31
+ s.value = ((t = a.options) == null || (t = t.find((e) => `${e.modelValue}` == `${e.value}`)) == null ? void 0 : t.label) ?? `${c.value}`;
32
+ }
33
+ }), () => n("span", o, [s.value]);
34
+ }
35
+ };
36
+ //#endregion
37
+ export { a as t };
@@ -0,0 +1,57 @@
1
+ import { i as e, n as t } from "./D_qiRmiE.mjs";
2
+ import { n, t as r } from "./CJdkjadi.mjs";
3
+ import { t as i } from "./C7G-cAoI.mjs";
4
+ import { createVNode as a, mergeProps as o, ref as s } from "vue";
5
+ import { ElInput as c, ElPopover as l } from "element-plus/es";
6
+ //#region src/components/form/props/input-cron.ts
7
+ var u = {
8
+ ...n,
9
+ ...r,
10
+ modelValue: [String, Number]
11
+ }, d = {
12
+ readonly: !0,
13
+ placeholder: !0,
14
+ disabled: !0,
15
+ modelValue: !0,
16
+ prefix: !0,
17
+ suffix: !0
18
+ }, f = (e) => n[e] === void 0 && d[e] !== !0, p = {
19
+ name: "FormInputCronExpression",
20
+ props: { ...u },
21
+ emits: { ...t },
22
+ setup(t, { emit: n, slots: r, attrs: u }) {
23
+ let d = s(!1), { emitInput: p, render: m, placeholder: h, disabled: g, listeners: _, inputProps: v } = e(t, {
24
+ emit: n,
25
+ slots: r,
26
+ attrs: u,
27
+ predicate: f
28
+ }), y = () => {
29
+ d.value = !0;
30
+ }, b = () => {
31
+ d.value = !1;
32
+ };
33
+ return () => m({ vNodes: a("div", { class: "cron" }, [a(l, {
34
+ placement: "bottom-start",
35
+ disabled: g.value,
36
+ visible: d.value,
37
+ "onUpdate:visible": (e) => d.value = e,
38
+ "popper-class": "cron-popover"
39
+ }, {
40
+ default: () => a(i, o(_.value, v.value, {
41
+ i18n: "cn",
42
+ expression: t.modelValue,
43
+ onChange: p,
44
+ onClose: b
45
+ }), null),
46
+ reference: () => a(c, {
47
+ modelValue: t.modelValue,
48
+ readonly: !0,
49
+ disabled: g.value,
50
+ placeholder: h.value,
51
+ onClick: y
52
+ }, null)
53
+ })]) });
54
+ }
55
+ };
56
+ //#endregion
57
+ export { p as t };
@@ -0,0 +1,230 @@
1
+ import { f as e, o as t, p as n } from "./DcTVYqeJ.mjs";
2
+ import { formHolderContextKey as r, formItemConfigProviderContextKey as i, formItemGroupContextKey as a } from "../constants/index.mjs";
3
+ import { isArray as o, isPlainObject as s, isString as c } from "@web-utils/core";
4
+ import { computed as l, createVNode as u, h as d, inject as f, mergeProps as p, nextTick as m, unref as h, useTemplateRef as g } from "vue";
5
+ import { ElCol as _, rowContextKey as v } from "element-plus";
6
+ import { ElCol as y, ElFormItem as b, ElTooltip as x } from "element-plus/es";
7
+ //#region src/components/form/props/form-item.ts
8
+ var S = {
9
+ prop: [String, Array],
10
+ label: String,
11
+ labelPosition: {
12
+ type: String,
13
+ default: ""
14
+ },
15
+ labelWidth: [String, Number],
16
+ required: {
17
+ type: Boolean,
18
+ default: !1
19
+ },
20
+ rules: Object,
21
+ error: String,
22
+ showMessage: {
23
+ type: Boolean,
24
+ default: !0
25
+ },
26
+ inlineMessage: {
27
+ type: Boolean,
28
+ default: !1
29
+ },
30
+ size: String,
31
+ for: String,
32
+ validateStatus: String,
33
+ messagePrefix: String,
34
+ message: String,
35
+ wrapCol: {
36
+ type: Boolean,
37
+ default: !0
38
+ },
39
+ fixedSpan: Number,
40
+ block: Boolean,
41
+ unwrap: Boolean,
42
+ half: Boolean,
43
+ formItemClass: String,
44
+ hideLabel: Boolean,
45
+ tips: { type: String },
46
+ tipsAfterLabel: {
47
+ type: Boolean,
48
+ default: !1
49
+ },
50
+ labelColspan: [Number, String],
51
+ inputColspan: [Number, String],
52
+ labelRowspan: [Number, String],
53
+ inputRowspan: [Number, String]
54
+ }, C = {
55
+ required: !0,
56
+ rules: !0,
57
+ messagePrefix: !0,
58
+ message: !0,
59
+ wrapCol: !0,
60
+ fixedSpan: !0,
61
+ block: !0,
62
+ unwrap: !0,
63
+ half: !0,
64
+ formItemClass: !0,
65
+ hideLabel: !0,
66
+ tips: !0,
67
+ tipsAfterLabel: !0,
68
+ labelColspan: !0,
69
+ inputColspan: !0,
70
+ labelRowspan: !0,
71
+ inputRowspan: !0
72
+ }, w = (e) => S[e] !== void 0 && C[e] !== !0, T = (e, { emit: n, events: r, predicate: i }) => l(() => t(e, i, r, n)), E = {
73
+ span: {
74
+ type: Number,
75
+ default: 12
76
+ },
77
+ offset: {
78
+ type: Number,
79
+ default: 0
80
+ },
81
+ push: {
82
+ type: Number,
83
+ default: 0
84
+ },
85
+ pull: {
86
+ type: Number,
87
+ default: 0
88
+ },
89
+ xs: { type: [Number, Object] },
90
+ sm: { type: [Number, Object] },
91
+ md: { type: [Number, Object] },
92
+ lg: { type: [Number, Object] },
93
+ xl: { type: [Number, Object] },
94
+ tag: {
95
+ type: String,
96
+ default: "div"
97
+ }
98
+ }, D = { span: !0 }, O = (e) => E[e] !== void 0 && D[e] !== !0, k = (e, { emit: n, events: r, predicate: i }) => l(() => t(e, i, r, n)), A = (e) => {
99
+ let t = f(r, null);
100
+ return l(() => e.required === !0 ? !0 : (t == null ? void 0 : t.requiredFieldsMap[e.prop]) === !0);
101
+ }, j = (e, t) => {
102
+ c(t) ? e.push(t) : o(t) ? e.push(...t) : s(t) && e.push(t);
103
+ }, M = (e, { rules: t, attrs: n, messagePrefix: r, message: i, ...a } = {}) => {
104
+ let o = A(e);
105
+ return l(() => {
106
+ let s = { message: i }, c = h(t);
107
+ Object.keys({
108
+ ...S,
109
+ ...E
110
+ }).forEach((t) => {
111
+ t === "rules" ? e[t] && c ? s[t] = [...e[t], ...c] : e[t] ? s[t] = e[t] : c && (s[t] = c) : t === "messagePrefix" ? s[t] = e.messagePrefix || r : s[t] = e[t];
112
+ });
113
+ let l = [];
114
+ return j(l, h(n == null ? void 0 : n.class)), j(l, h(a == null ? void 0 : a.class)), s.required = o.value, s.class = l, s.style = n == null ? void 0 : n.style, s;
115
+ });
116
+ }, N = {
117
+ name: "FormItemX",
118
+ inheritAttrs: !1,
119
+ props: {
120
+ ...S,
121
+ ...E
122
+ },
123
+ setup(e, { attrs: t, slots: n, expose: a }) {
124
+ let o = f(v, null), s = f(i, null), c = f(r, null), d = t.embed ? l(() => t.disabled) : F(e), h = T(e, { predicate: w }), _ = k(e, { predicate: O }), S = l(() => (s == null ? void 0 : s.reactive) === !0 && s.block === !1 && e.fixedSpan === void 0 && !e.half), C = A(e), E = g("formItem"), D = l(() => (s == null ? void 0 : s.wrapCol) === !1 ? !1 : !!o && e.wrapCol), j = l(() => c != null && c.tableForm ? "" : s != null && s.block ? "100%" : e.half && D.value ? `calc(50% - ${o.gutter.value / 2}px)` : ""), M = l(() => (s == null ? void 0 : s.block) === !0 || e.block || e.half ? 24 : e.span), N = l(() => {
125
+ if (d.value) return [];
126
+ if (C.value) {
127
+ let t = {
128
+ required: !0,
129
+ message: e.message || `${e.messagePrefix || "请输入"}${e.label}`
130
+ };
131
+ return e.rules ? [...e.rules, t] : [t];
132
+ }
133
+ return e.rules;
134
+ });
135
+ return a({
136
+ clearValidate: async () => {
137
+ var e;
138
+ await m(), (e = E.value) == null || e.clearValidate();
139
+ },
140
+ validate: async () => {
141
+ var e;
142
+ await m(), (e = E.value) == null || e.validate();
143
+ }
144
+ }), () => {
145
+ var r;
146
+ let i = n.tips || e.tips, a = i ? u(x, {
147
+ effect: "light",
148
+ content: e.tips,
149
+ offset: 4
150
+ }, {
151
+ default: () => u("i", { class: "el-icon-info form-item-input-info" }, null),
152
+ content: n.tips ? n.tips : null
153
+ }) : null, o = u(b, p(h.value, t, {
154
+ ref: "formItem",
155
+ style: { width: j.value },
156
+ class: [
157
+ "form-item",
158
+ e.formItemClass,
159
+ {
160
+ "form-item-hide-label": e.hideLabel,
161
+ "with-tips": !e.tipsAfterLabel && i,
162
+ required: d.value === !1 && C.value
163
+ }
164
+ ],
165
+ rules: N.value
166
+ }), {
167
+ ...n,
168
+ default: () => {
169
+ var t;
170
+ return [(t = n.default) == null ? void 0 : t.call(n, {
171
+ disabled: d.value,
172
+ required: C.value
173
+ }), i && !e.tipsAfterLabel ? a : null];
174
+ },
175
+ label: () => [n.label ? n.label() : e.label, e.tipsAfterLabel ? a : null]
176
+ }), s = [o, (r = n.below) == null ? void 0 : r.call(n)];
177
+ return e.unwrap ? s : D.value ? u(y, p(_.value, S.value ? {
178
+ xs: 24,
179
+ sm: 12,
180
+ md: 12,
181
+ lg: 8,
182
+ xl: 6
183
+ } : {}, { span: M.value }), { default: () => s }) : o;
184
+ };
185
+ }
186
+ }, P = "update:modelValue", F = (e) => {
187
+ let t = f(r, null), n = f(a, null);
188
+ return l(() => {
189
+ if (e.disabled !== void 0) return e.disabled;
190
+ if (t) {
191
+ if (t.requiredFieldsMap[e.prop] === !0 || t.enabledFieldsMap[e.prop] === !0) return !1;
192
+ if (t.disabledFieldsMap[e.prop] === !0) return !0;
193
+ }
194
+ return (n == null ? void 0 : n.enabled) === !0 ? !1 : (n == null ? void 0 : n.disabled) === !0 ? !0 : (t == null ? void 0 : t.disabled) === !0;
195
+ });
196
+ }, I = { [P]: null }, L = (e, t) => e(P, t), R = (e, { vNodes: t, formItemProps: n, slots: r, disabled: i }) => e.wrapFormItem ? d(N, {
197
+ ...n.value,
198
+ embed: !0,
199
+ disabled: i == null ? void 0 : i.value
200
+ }, {
201
+ default: () => t,
202
+ label: r.label,
203
+ error: r.error,
204
+ tips: r.tips,
205
+ below: r.below
206
+ }) : t, z = (r, { emit: i, slots: a, attrs: o, rules: s, events: c, predicate: u, messagePrefix: f = "请输入", removeOn: p = !1, ...m }) => {
207
+ let h = F(r), g = l(() => h.value ? "" : `${f}${r.label}`), v = M(r, {
208
+ rules: s,
209
+ attrs: o,
210
+ message: g.value,
211
+ ...m
212
+ }), y = (e) => L(i, e), b = (e) => r.col ? d(_, { span: r.block ? 24 : r.span }, { default: () => e }) : e, x = ({ vNodes: e }) => R(r, {
213
+ vNodes: b(e),
214
+ formItemProps: v,
215
+ slots: a,
216
+ disabled: h
217
+ }), S = l(() => t(r, u, c, i)), C = n({ removeOn: p });
218
+ return {
219
+ emitInput: y,
220
+ render: x,
221
+ placeholder: g,
222
+ disabled: h,
223
+ formItemProps: v,
224
+ autoBind: S,
225
+ inputProps: e(r, u),
226
+ listeners: C
227
+ };
228
+ }, B = (e) => e.icon ? d("i", { class: e.icon }) : null;
229
+ //#endregion
230
+ export { N as a, S as c, z as i, I as n, M as o, R as r, E as s, B as t };
@@ -0,0 +1,113 @@
1
+ import { camelize as e, capitalize as t, copy as n, hyphenate as r, isArray as i, isFunction as a, isString as o, uncapitalize as s } from "@web-utils/core";
2
+ import { Comment as c, Fragment as l, computed as u, useAttrs as d } from "vue";
3
+ import { ElMessage as f } from "element-plus";
4
+ //#region src/utils/index.ts
5
+ var p = (e, n, r, i, a = !0) => {
6
+ let o = {};
7
+ if (n) for (let t in e) n(t) && (o[t] = e[t]);
8
+ return a && r && r.forEach((e) => {
9
+ o[`on${t(e)}`] = (...t) => i(e, ...t);
10
+ }), o;
11
+ }, m = (e, t) => u(() => {
12
+ let n = {};
13
+ if (t) for (let r in e) t(r) && (n[r] = e[r]);
14
+ return n;
15
+ }), h = ({ removeOn: t = !1, include: n, exclude: r } = {}) => {
16
+ let i = d();
17
+ return u(() => {
18
+ let a = {}, o = {}, c = {}, l = !1;
19
+ (n || r) && (l = !0), n == null || n.forEach((t) => {
20
+ o[e(t)] = !0;
21
+ }), r == null || r.forEach((t) => {
22
+ c[e(t)] = !0;
23
+ });
24
+ for (let e in i) if (e.startsWith("on")) {
25
+ let u = s(e.replace(/^on/, ""));
26
+ if (l && (n && o[u] !== !0 || r && c[u] === !0)) continue;
27
+ t ? a[u] = i[e] : a[e] = i[e];
28
+ }
29
+ return a;
30
+ });
31
+ }, g = (e, { predicate: t, removeOn: n }) => ({
32
+ listeners: h({ removeOn: n }),
33
+ autoBindProps: m(e, t)
34
+ }), _ = (e, { withOn: t = !1 } = {}) => {
35
+ let n = {};
36
+ for (let r in e) r.startsWith("on") && (t ? n[r] = e[r] : n[s(r.replace(/^on/, ""))] = e[r]);
37
+ return n;
38
+ }, v = (e, t = "id", n = "label") => {
39
+ let r = [];
40
+ function i(e, a) {
41
+ if (!e) return;
42
+ let o = [...a, {
43
+ [t]: e[t],
44
+ [n]: e[n]
45
+ }];
46
+ if (!e.children || e.children.length === 0) {
47
+ r.push(o);
48
+ return;
49
+ }
50
+ e.children.forEach((e) => {
51
+ i(e, o);
52
+ });
53
+ }
54
+ return e.forEach((e) => i(e, [])), r;
55
+ }, y = (e, t = "id", n = "label") => {
56
+ let r = [];
57
+ return v(e).forEach((e) => {
58
+ let i = [], a = [];
59
+ for (let r = 0; r < e.length; r++) i.push(e[r][t]), a.push(e[r][n]);
60
+ r.push({
61
+ value: i.join("/"),
62
+ label: a.join("/")
63
+ });
64
+ }), r;
65
+ }, b = (e, t = "id", n = "label") => {
66
+ let r = {};
67
+ return v(e).forEach((e) => {
68
+ let i = [], a = [];
69
+ for (let r = 0; r < e.length; r++) i.push(e[r][t]), a.push(e[r][n]);
70
+ r[i.join("/")] = {
71
+ value: i.join("/"),
72
+ label: a.join("/")
73
+ };
74
+ }), r;
75
+ };
76
+ function x(e) {
77
+ n(e, () => f.success({
78
+ duration: 1e3,
79
+ message: "复制成功!",
80
+ type: "success"
81
+ }), () => f.error({
82
+ duration: 1e3,
83
+ message: "复制失败!",
84
+ type: "error"
85
+ }));
86
+ }
87
+ var S = (e) => {
88
+ let t = [];
89
+ return e && (i(e) ? e.forEach((e) => {
90
+ i(e) ? t.push(...S(e)) : e && t.push(e);
91
+ }) : e && t.push(e)), t;
92
+ }, C = (e = "", t = {}) => {
93
+ let n = t || {};
94
+ return (e || "").replace(/{(.*?)}/g, (e, t) => {
95
+ if (t.indexOf(":")) {
96
+ let [e, r] = t.split(":");
97
+ return n[e] ? n[e] : r;
98
+ } else return n[t] || "";
99
+ });
100
+ }, w = (e, t) => a(e) ? C(e(t), t) : o(e) ? C(e, t) : null, T = (e) => {
101
+ let t = {};
102
+ for (let n in e) t[r(n)] = e[n];
103
+ return t;
104
+ }, E = (e, t) => {
105
+ for (let n in t) e[n] = t[n];
106
+ return e;
107
+ }, D = (e) => {
108
+ let t = [];
109
+ for (let n of e) n.type === c || (n.type === l ? n.children && t.push(...D(n.children)) : t.push(n));
110
+ return t;
111
+ };
112
+ //#endregion
113
+ export { S as a, b as c, g as d, m as f, w as i, T as l, x as n, p as o, h as p, D as r, _ as s, E as t, y as u };