st-comp 0.0.279 → 0.0.280
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/es/ChartLayout.cjs +1 -1
- package/es/ChartLayout.js +13 -14
- package/es/CustomFunction.cjs +2 -2
- package/es/CustomFunction.js +342 -547
- package/es/FactorWarning.cjs +1 -1
- package/es/FactorWarning.js +294 -294
- package/es/Kline.cjs +1 -1
- package/es/Kline.js +19 -19
- package/es/KlineBasic.cjs +1 -1
- package/es/KlineBasic.js +253 -253
- package/es/KlineConfig.cjs +1 -1
- package/es/KlineConfig.js +579 -553
- package/es/KlineNew.cjs +1 -1
- package/es/KlineNew.js +17 -17
- package/es/KlinePlus.cjs +2 -2
- package/es/KlinePlus.js +23 -24
- package/es/MonacoEditor.cjs +1 -1
- package/es/MonacoEditor.js +30 -29
- package/es/Pagination.cjs +1 -1
- package/es/Pagination.js +517 -425
- package/es/PasswordPrompt.cjs +1 -1
- package/es/PasswordPrompt.js +3 -3
- package/es/Table.cjs +1 -1
- package/es/Table.js +46 -46
- package/es/User.cjs +1 -1
- package/es/User.js +898 -866
- package/es/VarSelectDialog.cjs +3 -3
- package/es/VarSelectDialog.js +110 -109
- package/es/VarietyAiHelper.cjs +7 -7
- package/es/VarietyAiHelper.js +605 -443
- package/es/VarietyAutoComplete.cjs +1 -1
- package/es/VarietyAutoComplete.js +11 -11
- package/es/VarietySearch.cjs +18 -18
- package/es/VarietySearch.js +3079 -2913
- package/es/{VarietySelect-d58eee29.cjs → VarietySelect-aa082a9c.cjs} +1 -1
- package/es/{VarietySelect-41daac7b.js → VarietySelect-c402bade.js} +5 -5
- package/es/VarietyTextCopy.cjs +3 -3
- package/es/VarietyTextCopy.js +51 -51
- package/es/VirtualTable.cjs +13 -1
- package/es/VirtualTable.js +1929 -2261
- package/es/_baseClone-10bdb989.cjs +1 -0
- package/es/_baseClone-98af8b33.js +210 -0
- package/es/base-d987e5c9.cjs +5 -0
- package/es/base-dd156b8e.js +790 -0
- package/es/{castArray-7741a212.js → castArray-18eb6a41.js} +1 -1
- package/es/{castArray-35947698.cjs → castArray-d9ffe84a.cjs} +1 -1
- package/es/clamp-17c4d8aa.cjs +1 -0
- package/es/clamp-c7512966.js +10 -0
- package/es/config-provider-33a127c4.cjs +1 -0
- package/es/config-provider-563023c9.js +86 -0
- package/es/debounce-0a98a9c6.js +57 -0
- package/es/debounce-37b17615.cjs +1 -0
- package/es/dropdown-ce7496c7.cjs +1 -0
- package/es/dropdown-feea8702.js +178 -0
- package/es/el-autocomplete-d9253bba.cjs +1 -0
- package/es/el-autocomplete-eac54f9f.js +434 -0
- package/es/el-button-8259594b.cjs +1 -0
- package/es/el-button-8a9721f8.js +343 -0
- package/es/el-checkbox-6303fc92.cjs +1 -0
- package/es/el-checkbox-c328b097.js +566 -0
- package/es/el-dialog-67536fac.js +252 -0
- package/es/el-dialog-8788bcc1.cjs +1 -0
- package/es/el-divider-3f0320be.cjs +1 -0
- package/es/el-divider-c5d72961.js +51 -0
- package/es/el-empty-552baf04.js +159 -0
- package/es/el-empty-58bc2a10.cjs +1 -0
- package/es/el-form-item-8efcf2c3.js +1265 -0
- package/es/el-form-item-95e68669.cjs +12 -0
- package/es/el-input-c8a9bb71.cjs +1 -0
- package/es/el-input-e66500b7.js +761 -0
- package/es/el-input-number-68ee0d65.js +390 -0
- package/es/el-input-number-d7a81922.cjs +1 -0
- package/es/el-loading-62132db2.cjs +1 -0
- package/es/el-loading-db4c6d13.js +190 -0
- package/es/el-menu-item-4b8e7794.cjs +1 -0
- package/es/el-menu-item-c2523d82.js +824 -0
- package/es/el-message-box-7c13546c.js +481 -0
- package/es/el-message-box-fed174f0.cjs +1 -0
- package/es/el-overlay-17299785.cjs +1 -0
- package/es/el-overlay-36f223e9.js +444 -0
- package/es/el-popconfirm-520b2928.cjs +1 -0
- package/es/el-popconfirm-a857c54a.js +190 -0
- package/es/el-popper-852446fd.js +2235 -0
- package/es/el-popper-f824c63b.cjs +1 -0
- package/es/{el-scrollbar-323542e7.js → el-scrollbar-0a42c1d0.js} +4 -9
- package/es/{el-scrollbar-bc3f790d.cjs → el-scrollbar-225c6c9e.cjs} +1 -1
- package/es/el-segmented-45dcc036.cjs +1 -0
- package/es/el-segmented-bf08279f.js +168 -0
- package/es/el-select-a34348e1.js +1535 -0
- package/es/el-select-d2958ae8.cjs +1 -0
- package/es/el-table-column-ad70ee0e.cjs +14 -0
- package/es/el-table-column-e2be313e.js +3651 -0
- package/es/el-tag-527f06f0.cjs +1 -0
- package/es/el-tag-9bcfae32.js +77 -0
- package/es/el-text-f9379288.js +84 -0
- package/es/el-text-fc345ffd.cjs +1 -0
- package/es/index-2419d69a.js +468 -0
- package/es/index-3806160e.js +710 -0
- package/es/index-3a0a7c36.cjs +1 -0
- package/es/index-3e7d5ffb.cjs +1 -0
- package/es/index-3ed0c678.cjs +1 -0
- package/es/index-47d30a52.js +372 -0
- package/es/index-5dec535a.cjs +1 -0
- package/es/index-5e76a22d.cjs +1 -0
- package/es/{index-eb96e074.js → index-60900c6c.js} +223 -254
- package/es/{index-a33b2fb8.js → index-69d2353a.js} +5090 -5090
- package/es/index-71ba4c28.cjs +1 -0
- package/es/index-7711aa69.cjs +1 -0
- package/es/index-7c4d8f5d.js +47 -0
- package/es/index-86678b72.js +131 -0
- package/es/index-99bb359f.cjs +1 -0
- package/es/index-99d4335d.cjs +1 -0
- package/es/index-a0522466.js +413 -0
- package/es/index-a181f161.js +429 -0
- package/es/index-b9a26e7f.js +141 -0
- package/es/{index-a9246d17.cjs → index-bb0bc131.cjs} +109 -109
- package/es/index-d372e68f.cjs +5 -0
- package/es/index-de9ad85c.js +12 -0
- package/es/{index-44a382a5.js → index-dfb34e00.js} +12 -12
- package/es/index-f5474dcc.cjs +3 -0
- package/es/{python-8a1664e6.js → python-6eafa04b.js} +32 -31
- package/es/{python-a3db9620.cjs → python-922eca89.cjs} +1 -1
- package/es/{raf-8249652f.cjs → raf-735cc598.cjs} +1 -1
- package/es/{raf-80ef0c0a.js → raf-b4fd1e12.js} +1 -1
- package/es/scroll-07bade1e.cjs +1 -0
- package/es/scroll-70271cb1.js +35 -0
- package/es/style.css +1 -1
- package/es/toNumber-b47ceb68.cjs +1 -0
- package/es/toNumber-f077c66a.js +31 -0
- package/es/use-form-item-0a831287.cjs +2 -0
- package/es/use-form-item-187cd7db.js +422 -0
- package/es/use-global-config-17dafd40.js +71 -0
- package/es/use-global-config-c90c91f7.cjs +1 -0
- package/es/{validator-c60a8956.js → validator-800ed2ba.js} +1 -1
- package/es/validator-ee5bc3eb.cjs +1 -0
- package/es/vnode-6f7b84f0.cjs +1 -0
- package/es/vnode-8ee9bf4e.js +12 -0
- package/es/{zh-cn-b59a0910.js → zh-cn-26cc7233.js} +36 -33
- package/es/zh-cn-a22a6792.cjs +1 -0
- package/lib/bundle.js +1 -1
- package/lib/bundle.umd.cjs +271 -252
- package/lib/{index-62fa175a.js → index-74ed48c6.js} +54107 -52151
- package/lib/{python-4a48fa39.js → python-7aaa84e4.js} +1 -1
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/es/_initCloneObject-5e73c9c8.js +0 -81
- package/es/_initCloneObject-a5832933.cjs +0 -1
- package/es/base-a5af3db3.js +0 -288
- package/es/base-ef747d02.cjs +0 -5
- package/es/config-provider-06ea6b42.cjs +0 -1
- package/es/config-provider-88b637a8.js +0 -59
- package/es/dayjs.min-2c20abe6.cjs +0 -1
- package/es/dayjs.min-8313b006.js +0 -299
- package/es/debounce-62f5b6e8.cjs +0 -1
- package/es/debounce-8d53f4dd.js +0 -83
- package/es/dropdown-4ce4c3e2.cjs +0 -1
- package/es/dropdown-72fbc15d.js +0 -178
- package/es/el-autocomplete-6cafcdf1.js +0 -329
- package/es/el-autocomplete-e0857c5b.cjs +0 -1
- package/es/el-button-613e0bb2.cjs +0 -1
- package/es/el-button-94d3de38.js +0 -272
- package/es/el-checkbox-6d4cb393.js +0 -459
- package/es/el-checkbox-e90762df.cjs +0 -1
- package/es/el-dialog-02942e22.cjs +0 -1
- package/es/el-dialog-5e30161f.js +0 -276
- package/es/el-divider-4713d74c.cjs +0 -1
- package/es/el-divider-4e059794.js +0 -45
- package/es/el-empty-1697ded8.cjs +0 -1
- package/es/el-empty-33cb66f1.js +0 -183
- package/es/el-form-item-44f060d8.cjs +0 -12
- package/es/el-form-item-9e8969ea.js +0 -1269
- package/es/el-input-342b2def.js +0 -531
- package/es/el-input-9a9a7f7f.cjs +0 -1
- package/es/el-input-number-65c847d6.cjs +0 -1
- package/es/el-input-number-c22b803a.js +0 -311
- package/es/el-loading-8179b497.cjs +0 -1
- package/es/el-loading-bcc51e3d.js +0 -203
- package/es/el-menu-item-339baf6d.js +0 -768
- package/es/el-menu-item-83186444.cjs +0 -1
- package/es/el-message-box-035b699c.js +0 -489
- package/es/el-message-box-c62d3217.cjs +0 -1
- package/es/el-overlay-3e17604b.js +0 -324
- package/es/el-overlay-8f1da9e8.cjs +0 -1
- package/es/el-popconfirm-4e32ec1b.cjs +0 -1
- package/es/el-popconfirm-f8a86e2c.js +0 -162
- package/es/el-popper-a4f3ae4d.cjs +0 -1
- package/es/el-popper-fbd0dcea.js +0 -2094
- package/es/el-segmented-56bd58a8.js +0 -142
- package/es/el-segmented-833ac177.cjs +0 -1
- package/es/el-select-44fa547d.js +0 -1256
- package/es/el-select-70806166.cjs +0 -1
- package/es/el-table-column-3e2cdfca.cjs +0 -14
- package/es/el-table-column-b74a857d.js +0 -3432
- package/es/el-tag-66c83156.js +0 -117
- package/es/el-tag-9c2f329f.cjs +0 -1
- package/es/el-text-034bd3f4.js +0 -67
- package/es/el-text-6b2374bb.cjs +0 -1
- package/es/index-00f6ca75.cjs +0 -1
- package/es/index-185792a7.cjs +0 -1
- package/es/index-1e2a38ab.js +0 -113
- package/es/index-2e331d74.js +0 -10
- package/es/index-3153c1db.cjs +0 -1
- package/es/index-5216d5f5.js +0 -406
- package/es/index-5c0dd943.cjs +0 -1
- package/es/index-657047bb.js +0 -513
- package/es/index-870b6c9d.cjs +0 -1
- package/es/index-8c2d7e05.js +0 -368
- package/es/index-960806da.js +0 -314
- package/es/index-9780a537.cjs +0 -1
- package/es/index-9d16cea8.cjs +0 -1
- package/es/index-ac8dc53d.cjs +0 -1
- package/es/index-bb833443.cjs +0 -1
- package/es/index-c5f2d372.js +0 -326
- package/es/index-c6584658.js +0 -163
- package/es/index-d77a7336.js +0 -204
- package/es/index-eea0bcb3.cjs +0 -1
- package/es/index-f034b910.js +0 -60
- package/es/index-f1c702f6.cjs +0 -1
- package/es/index-f58b2920.cjs +0 -1
- package/es/scroll-679bd6bf.js +0 -35
- package/es/scroll-b108dabd.cjs +0 -1
- package/es/use-form-common-props-ac666630.cjs +0 -1
- package/es/use-form-common-props-ed72e914.js +0 -364
- package/es/use-global-config-23472471.cjs +0 -1
- package/es/use-global-config-ee406d58.js +0 -72
- package/es/validator-366dbf39.cjs +0 -1
- package/es/vnode-5ddb7ed1.js +0 -14
- package/es/vnode-b906ae6d.cjs +0 -1
- package/es/zh-cn-c21d12d8.cjs +0 -1
|
@@ -0,0 +1,1265 @@
|
|
|
1
|
+
import { b as Ee, c as fe, m as ee, a as xe, q as Ue, v as K, u as _e, N as lt, B as Ge, t as dt, M as ct, p as Ne, w as pt, n as vt } from "./base-dd156b8e.js";
|
|
2
|
+
import { g as Z } from "./use-global-config-17dafd40.js";
|
|
3
|
+
import { k as Je, e as Ke, p as Se, q as me, u as gt } from "./use-form-item-187cd7db.js";
|
|
4
|
+
import { ref as B, computed as A, defineComponent as Pe, reactive as he, watch as k, provide as Ye, toRefs as Ze, openBlock as ye, createElementBlock as He, normalizeClass as Q, renderSlot as se, inject as ue, onMounted as Qe, onBeforeUnmount as Xe, onUpdated as mt, createVNode as le, Fragment as ht, nextTick as ke, useSlots as yt, unref as T, withCtx as ve, createBlock as bt, resolveDynamicComponent as wt, normalizeStyle as Re, createTextVNode as Ft, toDisplayString as Ie, createCommentVNode as Me, createElementVNode as Le, TransitionGroup as qt } from "vue";
|
|
5
|
+
import { c as de } from "./castArray-18eb6a41.js";
|
|
6
|
+
import { e as Ot } from "./_baseClone-98af8b33.js";
|
|
7
|
+
import { a as Et } from "./index-a181f161.js";
|
|
8
|
+
var _t = 1, St = 4;
|
|
9
|
+
function Y(i) {
|
|
10
|
+
return Ot(i, _t | St);
|
|
11
|
+
}
|
|
12
|
+
const Pt = Ee({
|
|
13
|
+
/**
|
|
14
|
+
* @description Control the size of components in this form.
|
|
15
|
+
*/
|
|
16
|
+
size: {
|
|
17
|
+
type: String,
|
|
18
|
+
values: Je
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* @description Whether to disable all components in this form. If set to `true`, it will override the `disabled` prop of the inner component.
|
|
22
|
+
*/
|
|
23
|
+
disabled: Boolean
|
|
24
|
+
}), At = Ee({
|
|
25
|
+
...Pt,
|
|
26
|
+
/**
|
|
27
|
+
* @description Data of form component.
|
|
28
|
+
*/
|
|
29
|
+
model: Object,
|
|
30
|
+
/**
|
|
31
|
+
* @description Validation rules of form.
|
|
32
|
+
*/
|
|
33
|
+
rules: { type: fe(Object) },
|
|
34
|
+
/**
|
|
35
|
+
* @description Position of label. If set to `'left'` or `'right'`, `label-width` prop is also required.
|
|
36
|
+
*/
|
|
37
|
+
labelPosition: {
|
|
38
|
+
type: String,
|
|
39
|
+
values: [
|
|
40
|
+
"left",
|
|
41
|
+
"right",
|
|
42
|
+
"top"
|
|
43
|
+
],
|
|
44
|
+
default: "right"
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* @description Position of asterisk.
|
|
48
|
+
*/
|
|
49
|
+
requireAsteriskPosition: {
|
|
50
|
+
type: String,
|
|
51
|
+
values: ["left", "right"],
|
|
52
|
+
default: "left"
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* @description Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported.
|
|
56
|
+
*/
|
|
57
|
+
labelWidth: {
|
|
58
|
+
type: [String, Number],
|
|
59
|
+
default: ""
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* @description Suffix of the label.
|
|
63
|
+
*/
|
|
64
|
+
labelSuffix: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: ""
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* @description Whether the form is inline.
|
|
70
|
+
*/
|
|
71
|
+
inline: Boolean,
|
|
72
|
+
/**
|
|
73
|
+
* @description Whether to display the error message inline with the form item.
|
|
74
|
+
*/
|
|
75
|
+
inlineMessage: Boolean,
|
|
76
|
+
/**
|
|
77
|
+
* @description Whether to display an icon indicating the validation result.
|
|
78
|
+
*/
|
|
79
|
+
statusIcon: Boolean,
|
|
80
|
+
/**
|
|
81
|
+
* @description Whether to show the error message.
|
|
82
|
+
*/
|
|
83
|
+
showMessage: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: !0
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* @description Whether to trigger validation when the `rules` prop is changed.
|
|
89
|
+
*/
|
|
90
|
+
validateOnRuleChange: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: !0
|
|
93
|
+
},
|
|
94
|
+
/**
|
|
95
|
+
* @description Whether to hide required fields should have a red asterisk (star) beside their labels.
|
|
96
|
+
*/
|
|
97
|
+
hideRequiredAsterisk: Boolean,
|
|
98
|
+
/**
|
|
99
|
+
* @description When validation fails, scroll to the first error form entry.
|
|
100
|
+
*/
|
|
101
|
+
scrollToError: Boolean,
|
|
102
|
+
/**
|
|
103
|
+
* @description When validation fails, it scrolls to the first error item based on the scrollIntoView option.
|
|
104
|
+
*/
|
|
105
|
+
scrollIntoViewOptions: {
|
|
106
|
+
type: fe([Object, Boolean]),
|
|
107
|
+
default: !0
|
|
108
|
+
}
|
|
109
|
+
}), Vt = { validate: (i, e, t) => (ee(i) || xe(i)) && Ue(e) && xe(t) }, jt = [
|
|
110
|
+
"",
|
|
111
|
+
"error",
|
|
112
|
+
"validating",
|
|
113
|
+
"success"
|
|
114
|
+
], xt = Ee({
|
|
115
|
+
/**
|
|
116
|
+
* @description Label text.
|
|
117
|
+
*/
|
|
118
|
+
label: String,
|
|
119
|
+
/**
|
|
120
|
+
* @description Width of label, e.g. `'50px'`. `'auto'` is supported.
|
|
121
|
+
*/
|
|
122
|
+
labelWidth: { type: [String, Number] },
|
|
123
|
+
/**
|
|
124
|
+
* @description Position of label. If set to `'left'` or `'right'`, `label-width` prop is also required. The default is extend from `form label-position`.
|
|
125
|
+
*/
|
|
126
|
+
labelPosition: {
|
|
127
|
+
type: String,
|
|
128
|
+
values: [
|
|
129
|
+
"left",
|
|
130
|
+
"right",
|
|
131
|
+
"top",
|
|
132
|
+
""
|
|
133
|
+
],
|
|
134
|
+
default: ""
|
|
135
|
+
},
|
|
136
|
+
/**
|
|
137
|
+
* @description A key of `model`. It could be an array of property paths (e.g `['a', 'b', '0']`). In the use of `validate` and `resetFields` method, the attribute is required.
|
|
138
|
+
*/
|
|
139
|
+
prop: { type: fe([String, Array]) },
|
|
140
|
+
/**
|
|
141
|
+
* @description Whether the field is required or not, will be determined by validation rules if omitted.
|
|
142
|
+
*/
|
|
143
|
+
required: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
default: void 0
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* @description Validation rules of form, see the [following table](#formitemrule), more advanced usage at [async-validator](https://github.com/yiminghe/async-validator).
|
|
149
|
+
*/
|
|
150
|
+
rules: { type: fe([Object, Array]) },
|
|
151
|
+
/**
|
|
152
|
+
* @description Field error message, set its value and the field will validate error and show this message immediately.
|
|
153
|
+
*/
|
|
154
|
+
error: String,
|
|
155
|
+
/**
|
|
156
|
+
* @description Validation state of formItem.
|
|
157
|
+
*/
|
|
158
|
+
validateStatus: {
|
|
159
|
+
type: String,
|
|
160
|
+
values: jt
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* @description Same as for in native label.
|
|
164
|
+
*/
|
|
165
|
+
for: String,
|
|
166
|
+
/**
|
|
167
|
+
* @description Inline style validate message.
|
|
168
|
+
*/
|
|
169
|
+
inlineMessage: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
default: void 0
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* @description Whether to show the error message.
|
|
175
|
+
*/
|
|
176
|
+
showMessage: {
|
|
177
|
+
type: Boolean,
|
|
178
|
+
default: !0
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* @description Control the size of components in this form-item.
|
|
182
|
+
*/
|
|
183
|
+
size: {
|
|
184
|
+
type: String,
|
|
185
|
+
values: Je
|
|
186
|
+
}
|
|
187
|
+
}), Nt = "ElForm";
|
|
188
|
+
function Rt() {
|
|
189
|
+
const i = B([]), e = A(() => {
|
|
190
|
+
if (!i.value.length)
|
|
191
|
+
return "0";
|
|
192
|
+
const s = Math.max(...i.value);
|
|
193
|
+
return s ? `${s}px` : "";
|
|
194
|
+
});
|
|
195
|
+
function t(s) {
|
|
196
|
+
const a = i.value.indexOf(s);
|
|
197
|
+
return a === -1 && e.value === "0" && K(Nt, `unexpected width ${s}`), a;
|
|
198
|
+
}
|
|
199
|
+
function n(s, a) {
|
|
200
|
+
if (s && a) {
|
|
201
|
+
const o = t(a);
|
|
202
|
+
i.value.splice(o, 1, s);
|
|
203
|
+
} else
|
|
204
|
+
s && i.value.push(s);
|
|
205
|
+
}
|
|
206
|
+
function r(s) {
|
|
207
|
+
const a = t(s);
|
|
208
|
+
a > -1 && i.value.splice(a, 1);
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
autoLabelWidth: e,
|
|
212
|
+
registerLabelWidth: n,
|
|
213
|
+
deregisterLabelWidth: r
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const ie = (i, e) => {
|
|
217
|
+
const t = de(e).map((n) => ee(n) ? n.join(".") : n);
|
|
218
|
+
return t.length > 0 ? i.filter((n) => n.propString && t.includes(n.propString)) : i;
|
|
219
|
+
}, G = "ElForm";
|
|
220
|
+
var It = /* @__PURE__ */ Pe({
|
|
221
|
+
name: G,
|
|
222
|
+
__name: "form",
|
|
223
|
+
props: At,
|
|
224
|
+
emits: Vt,
|
|
225
|
+
setup(i, { expose: e, emit: t }) {
|
|
226
|
+
const n = i, r = t, s = B(), a = he([]), o = /* @__PURE__ */ new Map(), l = Ke(), y = _e("form"), g = A(() => {
|
|
227
|
+
const { labelPosition: u, inline: c } = n;
|
|
228
|
+
return [
|
|
229
|
+
y.b(),
|
|
230
|
+
y.m(l.value || "default"),
|
|
231
|
+
{
|
|
232
|
+
[y.m(`label-${u}`)]: u,
|
|
233
|
+
[y.m("inline")]: c
|
|
234
|
+
}
|
|
235
|
+
];
|
|
236
|
+
}), w = (u) => ie(a, [u])[0], F = (u) => {
|
|
237
|
+
a.includes(u) || a.push(u), u.propString && (o.has(u.propString) ? u.setInitialValue(o.get(u.propString)) : o.set(u.propString, Y(u.fieldValue)));
|
|
238
|
+
}, V = (u, c) => {
|
|
239
|
+
if (c) {
|
|
240
|
+
o.delete(c);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
const q = a.indexOf(u);
|
|
244
|
+
q > -1 && (a.splice(q, 1), u.propString && o.set(u.propString, Y(u.getInitialValue())));
|
|
245
|
+
}, S = (u) => {
|
|
246
|
+
if (!n.model) {
|
|
247
|
+
K(G, "model is required for setInitialValues to work.");
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (!u) {
|
|
251
|
+
K(G, "initModel is required for setInitialValues to work.");
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
for (const c of o.keys())
|
|
255
|
+
o.set(c, Y(Z(u, c).value));
|
|
256
|
+
a.forEach((c) => {
|
|
257
|
+
c.prop && c.setInitialValue(Z(u, c.prop).value);
|
|
258
|
+
});
|
|
259
|
+
}, d = (u = []) => {
|
|
260
|
+
if (!n.model) {
|
|
261
|
+
K(G, "model is required for resetFields to work.");
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
ie(a, u).forEach((E) => E.resetField());
|
|
265
|
+
const c = new Set(a.map((E) => E.propString).filter(Boolean)), q = u.length > 0 ? de(u).map((E) => ee(E) ? E.join(".") : E) : [...o.keys()];
|
|
266
|
+
for (const E of q)
|
|
267
|
+
!c.has(E) && o.has(E) && (Z(n.model, E).value = Y(o.get(E)));
|
|
268
|
+
}, b = (u = []) => {
|
|
269
|
+
ie(a, u).forEach((c) => c.clearValidate());
|
|
270
|
+
}, f = A(() => {
|
|
271
|
+
const u = !!n.model;
|
|
272
|
+
return u || K(G, "model is required for validate to work."), u;
|
|
273
|
+
}), I = (u) => {
|
|
274
|
+
if (a.length === 0)
|
|
275
|
+
return [];
|
|
276
|
+
const c = ie(a, u);
|
|
277
|
+
return c.length ? c : (K(G, "please pass correct props!"), []);
|
|
278
|
+
}, m = async (u) => P(void 0, u), O = async (u = []) => {
|
|
279
|
+
if (!f.value)
|
|
280
|
+
return !1;
|
|
281
|
+
const c = I(u);
|
|
282
|
+
if (c.length === 0)
|
|
283
|
+
return !0;
|
|
284
|
+
let q = {};
|
|
285
|
+
for (const E of c)
|
|
286
|
+
try {
|
|
287
|
+
await E.validate(""), E.validateState === "error" && !E.error && E.resetField();
|
|
288
|
+
} catch (L) {
|
|
289
|
+
q = {
|
|
290
|
+
...q,
|
|
291
|
+
...L
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
return Object.keys(q).length === 0 ? !0 : Promise.reject(q);
|
|
295
|
+
}, P = async (u = [], c) => {
|
|
296
|
+
var L;
|
|
297
|
+
let q = !1;
|
|
298
|
+
const E = !Ge(c);
|
|
299
|
+
try {
|
|
300
|
+
return q = await O(u), q === !0 && await (c == null ? void 0 : c(q)), q;
|
|
301
|
+
} catch (x) {
|
|
302
|
+
if (x instanceof Error)
|
|
303
|
+
throw x;
|
|
304
|
+
const N = x;
|
|
305
|
+
return n.scrollToError && s.value && ((L = s.value.querySelector(`.${y.b()}-item.is-error`)) == null || L.scrollIntoView(n.scrollIntoViewOptions)), !q && await (c == null ? void 0 : c(!1, N)), E && Promise.reject(N);
|
|
306
|
+
}
|
|
307
|
+
}, _ = (u) => {
|
|
308
|
+
var q;
|
|
309
|
+
const c = w(u);
|
|
310
|
+
c && ((q = c.$el) == null || q.scrollIntoView(n.scrollIntoViewOptions));
|
|
311
|
+
};
|
|
312
|
+
return k(() => n.rules, () => {
|
|
313
|
+
n.validateOnRuleChange && m().catch(lt);
|
|
314
|
+
}, {
|
|
315
|
+
deep: !0,
|
|
316
|
+
flush: "post"
|
|
317
|
+
}), Ye(Se, he({
|
|
318
|
+
...Ze(n),
|
|
319
|
+
emit: r,
|
|
320
|
+
resetFields: d,
|
|
321
|
+
clearValidate: b,
|
|
322
|
+
validateField: P,
|
|
323
|
+
getField: w,
|
|
324
|
+
addField: F,
|
|
325
|
+
removeField: V,
|
|
326
|
+
setInitialValues: S,
|
|
327
|
+
...Rt()
|
|
328
|
+
})), e({
|
|
329
|
+
/**
|
|
330
|
+
* @description Validate the whole form. Receives a callback or returns `Promise`.
|
|
331
|
+
*/
|
|
332
|
+
validate: m,
|
|
333
|
+
/**
|
|
334
|
+
* @description Validate specified fields.
|
|
335
|
+
*/
|
|
336
|
+
validateField: P,
|
|
337
|
+
/**
|
|
338
|
+
* @description Reset specified fields and remove validation result.
|
|
339
|
+
*/
|
|
340
|
+
resetFields: d,
|
|
341
|
+
/**
|
|
342
|
+
* @description Clear validation message for specified fields.
|
|
343
|
+
*/
|
|
344
|
+
clearValidate: b,
|
|
345
|
+
/**
|
|
346
|
+
* @description Scroll to the specified fields.
|
|
347
|
+
*/
|
|
348
|
+
scrollToField: _,
|
|
349
|
+
/**
|
|
350
|
+
* @description Get a field context.
|
|
351
|
+
*/
|
|
352
|
+
getField: w,
|
|
353
|
+
/**
|
|
354
|
+
* @description All fields context.
|
|
355
|
+
*/
|
|
356
|
+
fields: a,
|
|
357
|
+
/**
|
|
358
|
+
* @description Set initial values for form fields. When `resetFields` is called, fields will reset to these values.
|
|
359
|
+
*/
|
|
360
|
+
setInitialValues: S
|
|
361
|
+
}), (u, c) => (ye(), He("form", {
|
|
362
|
+
ref_key: "formRef",
|
|
363
|
+
ref: s,
|
|
364
|
+
class: Q(g.value)
|
|
365
|
+
}, [se(u.$slots, "default")], 2));
|
|
366
|
+
}
|
|
367
|
+
}), Mt = It;
|
|
368
|
+
const We = "ElLabelWrap";
|
|
369
|
+
var Lt = /* @__PURE__ */ Pe({
|
|
370
|
+
name: We,
|
|
371
|
+
props: {
|
|
372
|
+
isAutoWidth: Boolean,
|
|
373
|
+
updateAll: Boolean
|
|
374
|
+
},
|
|
375
|
+
setup(i, { slots: e }) {
|
|
376
|
+
const t = ue(Se, void 0), n = ue(me);
|
|
377
|
+
n || dt(We, "usage: <el-form-item><label-wrap /></el-form-item>");
|
|
378
|
+
const r = _e("form"), s = B(), a = B(0), o = () => {
|
|
379
|
+
var g;
|
|
380
|
+
if ((g = s.value) != null && g.firstElementChild) {
|
|
381
|
+
const w = window.getComputedStyle(s.value.firstElementChild).width;
|
|
382
|
+
return Math.ceil(Number.parseFloat(w));
|
|
383
|
+
} else
|
|
384
|
+
return 0;
|
|
385
|
+
}, l = (g = "update") => {
|
|
386
|
+
ke(() => {
|
|
387
|
+
e.default && i.isAutoWidth && (g === "update" ? a.value = o() : g === "remove" && (t == null || t.deregisterLabelWidth(a.value)));
|
|
388
|
+
});
|
|
389
|
+
}, y = () => l("update");
|
|
390
|
+
return Qe(() => {
|
|
391
|
+
y();
|
|
392
|
+
}), Xe(() => {
|
|
393
|
+
l("remove");
|
|
394
|
+
}), mt(() => y()), k(a, (g, w) => {
|
|
395
|
+
i.updateAll && (t == null || t.registerLabelWidth(g, w));
|
|
396
|
+
}), gt(A(() => {
|
|
397
|
+
var g;
|
|
398
|
+
return ((g = s.value) == null ? void 0 : g.firstElementChild) ?? null;
|
|
399
|
+
}), y), () => {
|
|
400
|
+
var w, F;
|
|
401
|
+
if (!e)
|
|
402
|
+
return null;
|
|
403
|
+
const { isAutoWidth: g } = i;
|
|
404
|
+
if (g) {
|
|
405
|
+
const V = t == null ? void 0 : t.autoLabelWidth, S = n == null ? void 0 : n.hasLabel, d = {};
|
|
406
|
+
if (S && V && V !== "auto") {
|
|
407
|
+
const b = Math.max(0, Number.parseInt(V, 10) - a.value), f = (n.labelPosition || t.labelPosition) === "left" ? "marginRight" : "marginLeft";
|
|
408
|
+
b && (d[f] = `${b}px`);
|
|
409
|
+
}
|
|
410
|
+
return le("div", {
|
|
411
|
+
ref: s,
|
|
412
|
+
class: [r.be("item", "label-wrap")],
|
|
413
|
+
style: d
|
|
414
|
+
}, [(w = e.default) == null ? void 0 : w.call(e)]);
|
|
415
|
+
} else
|
|
416
|
+
return le(ht, { ref: s }, [(F = e.default) == null ? void 0 : F.call(e)]);
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
function D() {
|
|
421
|
+
return D = Object.assign ? Object.assign.bind() : function(i) {
|
|
422
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
423
|
+
var t = arguments[e];
|
|
424
|
+
for (var n in t)
|
|
425
|
+
Object.prototype.hasOwnProperty.call(t, n) && (i[n] = t[n]);
|
|
426
|
+
}
|
|
427
|
+
return i;
|
|
428
|
+
}, D.apply(this, arguments);
|
|
429
|
+
}
|
|
430
|
+
function Wt(i, e) {
|
|
431
|
+
i.prototype = Object.create(e.prototype), i.prototype.constructor = i, te(i, e);
|
|
432
|
+
}
|
|
433
|
+
function be(i) {
|
|
434
|
+
return be = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t) {
|
|
435
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
436
|
+
}, be(i);
|
|
437
|
+
}
|
|
438
|
+
function te(i, e) {
|
|
439
|
+
return te = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
|
|
440
|
+
return n.__proto__ = r, n;
|
|
441
|
+
}, te(i, e);
|
|
442
|
+
}
|
|
443
|
+
function $t() {
|
|
444
|
+
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
|
|
445
|
+
return !1;
|
|
446
|
+
if (typeof Proxy == "function")
|
|
447
|
+
return !0;
|
|
448
|
+
try {
|
|
449
|
+
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
450
|
+
})), !0;
|
|
451
|
+
} catch {
|
|
452
|
+
return !1;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
function oe(i, e, t) {
|
|
456
|
+
return $t() ? oe = Reflect.construct.bind() : oe = function(r, s, a) {
|
|
457
|
+
var o = [null];
|
|
458
|
+
o.push.apply(o, s);
|
|
459
|
+
var l = Function.bind.apply(r, o), y = new l();
|
|
460
|
+
return a && te(y, a.prototype), y;
|
|
461
|
+
}, oe.apply(null, arguments);
|
|
462
|
+
}
|
|
463
|
+
function Bt(i) {
|
|
464
|
+
return Function.toString.call(i).indexOf("[native code]") !== -1;
|
|
465
|
+
}
|
|
466
|
+
function we(i) {
|
|
467
|
+
var e = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
468
|
+
return we = function(n) {
|
|
469
|
+
if (n === null || !Bt(n))
|
|
470
|
+
return n;
|
|
471
|
+
if (typeof n != "function")
|
|
472
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
473
|
+
if (typeof e < "u") {
|
|
474
|
+
if (e.has(n))
|
|
475
|
+
return e.get(n);
|
|
476
|
+
e.set(n, r);
|
|
477
|
+
}
|
|
478
|
+
function r() {
|
|
479
|
+
return oe(n, arguments, be(this).constructor);
|
|
480
|
+
}
|
|
481
|
+
return r.prototype = Object.create(n.prototype, {
|
|
482
|
+
constructor: {
|
|
483
|
+
value: r,
|
|
484
|
+
enumerable: !1,
|
|
485
|
+
writable: !0,
|
|
486
|
+
configurable: !0
|
|
487
|
+
}
|
|
488
|
+
}), te(r, n);
|
|
489
|
+
}, we(i);
|
|
490
|
+
}
|
|
491
|
+
var Tt = /%[sdj%]/g, Ce = function() {
|
|
492
|
+
};
|
|
493
|
+
typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (Ce = function(e, t) {
|
|
494
|
+
typeof console < "u" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING > "u" && t.every(function(n) {
|
|
495
|
+
return typeof n == "string";
|
|
496
|
+
}) && console.warn(e, t);
|
|
497
|
+
});
|
|
498
|
+
function Fe(i) {
|
|
499
|
+
if (!i || !i.length)
|
|
500
|
+
return null;
|
|
501
|
+
var e = {};
|
|
502
|
+
return i.forEach(function(t) {
|
|
503
|
+
var n = t.field;
|
|
504
|
+
e[n] = e[n] || [], e[n].push(t);
|
|
505
|
+
}), e;
|
|
506
|
+
}
|
|
507
|
+
function M(i) {
|
|
508
|
+
for (var e = arguments.length, t = new Array(e > 1 ? e - 1 : 0), n = 1; n < e; n++)
|
|
509
|
+
t[n - 1] = arguments[n];
|
|
510
|
+
var r = 0, s = t.length;
|
|
511
|
+
if (typeof i == "function")
|
|
512
|
+
return i.apply(null, t);
|
|
513
|
+
if (typeof i == "string") {
|
|
514
|
+
var a = i.replace(Tt, function(o) {
|
|
515
|
+
if (o === "%%")
|
|
516
|
+
return "%";
|
|
517
|
+
if (r >= s)
|
|
518
|
+
return o;
|
|
519
|
+
switch (o) {
|
|
520
|
+
case "%s":
|
|
521
|
+
return String(t[r++]);
|
|
522
|
+
case "%d":
|
|
523
|
+
return Number(t[r++]);
|
|
524
|
+
case "%j":
|
|
525
|
+
try {
|
|
526
|
+
return JSON.stringify(t[r++]);
|
|
527
|
+
} catch {
|
|
528
|
+
return "[Circular]";
|
|
529
|
+
}
|
|
530
|
+
break;
|
|
531
|
+
default:
|
|
532
|
+
return o;
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
return a;
|
|
536
|
+
}
|
|
537
|
+
return i;
|
|
538
|
+
}
|
|
539
|
+
function Dt(i) {
|
|
540
|
+
return i === "string" || i === "url" || i === "hex" || i === "email" || i === "date" || i === "pattern";
|
|
541
|
+
}
|
|
542
|
+
function j(i, e) {
|
|
543
|
+
return !!(i == null || e === "array" && Array.isArray(i) && !i.length || Dt(e) && typeof i == "string" && !i);
|
|
544
|
+
}
|
|
545
|
+
function zt(i, e, t) {
|
|
546
|
+
var n = [], r = 0, s = i.length;
|
|
547
|
+
function a(o) {
|
|
548
|
+
n.push.apply(n, o || []), r++, r === s && t(n);
|
|
549
|
+
}
|
|
550
|
+
i.forEach(function(o) {
|
|
551
|
+
e(o, a);
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
function $e(i, e, t) {
|
|
555
|
+
var n = 0, r = i.length;
|
|
556
|
+
function s(a) {
|
|
557
|
+
if (a && a.length) {
|
|
558
|
+
t(a);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
var o = n;
|
|
562
|
+
n = n + 1, o < r ? e(i[o], s) : t([]);
|
|
563
|
+
}
|
|
564
|
+
s([]);
|
|
565
|
+
}
|
|
566
|
+
function Ut(i) {
|
|
567
|
+
var e = [];
|
|
568
|
+
return Object.keys(i).forEach(function(t) {
|
|
569
|
+
e.push.apply(e, i[t] || []);
|
|
570
|
+
}), e;
|
|
571
|
+
}
|
|
572
|
+
var Be = /* @__PURE__ */ function(i) {
|
|
573
|
+
Wt(e, i);
|
|
574
|
+
function e(t, n) {
|
|
575
|
+
var r;
|
|
576
|
+
return r = i.call(this, "Async Validation Error") || this, r.errors = t, r.fields = n, r;
|
|
577
|
+
}
|
|
578
|
+
return e;
|
|
579
|
+
}(/* @__PURE__ */ we(Error));
|
|
580
|
+
function Gt(i, e, t, n, r) {
|
|
581
|
+
if (e.first) {
|
|
582
|
+
var s = new Promise(function(F, V) {
|
|
583
|
+
var S = function(f) {
|
|
584
|
+
return n(f), f.length ? V(new Be(f, Fe(f))) : F(r);
|
|
585
|
+
}, d = Ut(i);
|
|
586
|
+
$e(d, t, S);
|
|
587
|
+
});
|
|
588
|
+
return s.catch(function(F) {
|
|
589
|
+
return F;
|
|
590
|
+
}), s;
|
|
591
|
+
}
|
|
592
|
+
var a = e.firstFields === !0 ? Object.keys(i) : e.firstFields || [], o = Object.keys(i), l = o.length, y = 0, g = [], w = new Promise(function(F, V) {
|
|
593
|
+
var S = function(b) {
|
|
594
|
+
if (g.push.apply(g, b), y++, y === l)
|
|
595
|
+
return n(g), g.length ? V(new Be(g, Fe(g))) : F(r);
|
|
596
|
+
};
|
|
597
|
+
o.length || (n(g), F(r)), o.forEach(function(d) {
|
|
598
|
+
var b = i[d];
|
|
599
|
+
a.indexOf(d) !== -1 ? $e(b, t, S) : zt(b, t, S);
|
|
600
|
+
});
|
|
601
|
+
});
|
|
602
|
+
return w.catch(function(F) {
|
|
603
|
+
return F;
|
|
604
|
+
}), w;
|
|
605
|
+
}
|
|
606
|
+
function Jt(i) {
|
|
607
|
+
return !!(i && i.message !== void 0);
|
|
608
|
+
}
|
|
609
|
+
function Kt(i, e) {
|
|
610
|
+
for (var t = i, n = 0; n < e.length; n++) {
|
|
611
|
+
if (t == null)
|
|
612
|
+
return t;
|
|
613
|
+
t = t[e[n]];
|
|
614
|
+
}
|
|
615
|
+
return t;
|
|
616
|
+
}
|
|
617
|
+
function Te(i, e) {
|
|
618
|
+
return function(t) {
|
|
619
|
+
var n;
|
|
620
|
+
return i.fullFields ? n = Kt(e, i.fullFields) : n = e[t.field || i.fullField], Jt(t) ? (t.field = t.field || i.fullField, t.fieldValue = n, t) : {
|
|
621
|
+
message: typeof t == "function" ? t() : t,
|
|
622
|
+
fieldValue: n,
|
|
623
|
+
field: t.field || i.fullField
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
function De(i, e) {
|
|
628
|
+
if (e) {
|
|
629
|
+
for (var t in e)
|
|
630
|
+
if (e.hasOwnProperty(t)) {
|
|
631
|
+
var n = e[t];
|
|
632
|
+
typeof n == "object" && typeof i[t] == "object" ? i[t] = D({}, i[t], n) : i[t] = n;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return i;
|
|
636
|
+
}
|
|
637
|
+
var et = function(e, t, n, r, s, a) {
|
|
638
|
+
e.required && (!n.hasOwnProperty(e.field) || j(t, a || e.type)) && r.push(M(s.messages.required, e.fullField));
|
|
639
|
+
}, Yt = function(e, t, n, r, s) {
|
|
640
|
+
(/^\s+$/.test(t) || t === "") && r.push(M(s.messages.whitespace, e.fullField));
|
|
641
|
+
}, ae, Zt = function() {
|
|
642
|
+
if (ae)
|
|
643
|
+
return ae;
|
|
644
|
+
var i = "[a-fA-F\\d:]", e = function(O) {
|
|
645
|
+
return O && O.includeBoundaries ? "(?:(?<=\\s|^)(?=" + i + ")|(?<=" + i + ")(?=\\s|$))" : "";
|
|
646
|
+
}, t = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", n = "[a-fA-F\\d]{1,4}", r = (`
|
|
647
|
+
(?:
|
|
648
|
+
(?:` + n + ":){7}(?:" + n + `|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
649
|
+
(?:` + n + ":){6}(?:" + t + "|:" + n + `|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
650
|
+
(?:` + n + ":){5}(?::" + t + "|(?::" + n + `){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
651
|
+
(?:` + n + ":){4}(?:(?::" + n + "){0,1}:" + t + "|(?::" + n + `){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
652
|
+
(?:` + n + ":){3}(?:(?::" + n + "){0,2}:" + t + "|(?::" + n + `){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
653
|
+
(?:` + n + ":){2}(?:(?::" + n + "){0,3}:" + t + "|(?::" + n + `){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
654
|
+
(?:` + n + ":){1}(?:(?::" + n + "){0,4}:" + t + "|(?::" + n + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
655
|
+
(?::(?:(?::` + n + "){0,5}:" + t + "|(?::" + n + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
656
|
+
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
657
|
+
`).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), s = new RegExp("(?:^" + t + "$)|(?:^" + r + "$)"), a = new RegExp("^" + t + "$"), o = new RegExp("^" + r + "$"), l = function(O) {
|
|
658
|
+
return O && O.exact ? s : new RegExp("(?:" + e(O) + t + e(O) + ")|(?:" + e(O) + r + e(O) + ")", "g");
|
|
659
|
+
};
|
|
660
|
+
l.v4 = function(m) {
|
|
661
|
+
return m && m.exact ? a : new RegExp("" + e(m) + t + e(m), "g");
|
|
662
|
+
}, l.v6 = function(m) {
|
|
663
|
+
return m && m.exact ? o : new RegExp("" + e(m) + r + e(m), "g");
|
|
664
|
+
};
|
|
665
|
+
var y = "(?:(?:[a-z]+:)?//)", g = "(?:\\S+(?::\\S*)?@)?", w = l.v4().source, F = l.v6().source, V = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", S = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", d = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", b = "(?::\\d{2,5})?", f = '(?:[/?#][^\\s"]*)?', I = "(?:" + y + "|www\\.)" + g + "(?:localhost|" + w + "|" + F + "|" + V + S + d + ")" + b + f;
|
|
666
|
+
return ae = new RegExp("(?:^" + I + "$)", "i"), ae;
|
|
667
|
+
}, ze = {
|
|
668
|
+
// http://emailregex.com/
|
|
669
|
+
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
670
|
+
// url: new RegExp(
|
|
671
|
+
// '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
|
|
672
|
+
// 'i',
|
|
673
|
+
// ),
|
|
674
|
+
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
|
675
|
+
}, X = {
|
|
676
|
+
integer: function(e) {
|
|
677
|
+
return X.number(e) && parseInt(e, 10) === e;
|
|
678
|
+
},
|
|
679
|
+
float: function(e) {
|
|
680
|
+
return X.number(e) && !X.integer(e);
|
|
681
|
+
},
|
|
682
|
+
array: function(e) {
|
|
683
|
+
return Array.isArray(e);
|
|
684
|
+
},
|
|
685
|
+
regexp: function(e) {
|
|
686
|
+
if (e instanceof RegExp)
|
|
687
|
+
return !0;
|
|
688
|
+
try {
|
|
689
|
+
return !!new RegExp(e);
|
|
690
|
+
} catch {
|
|
691
|
+
return !1;
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
date: function(e) {
|
|
695
|
+
return typeof e.getTime == "function" && typeof e.getMonth == "function" && typeof e.getYear == "function" && !isNaN(e.getTime());
|
|
696
|
+
},
|
|
697
|
+
number: function(e) {
|
|
698
|
+
return isNaN(e) ? !1 : typeof e == "number";
|
|
699
|
+
},
|
|
700
|
+
object: function(e) {
|
|
701
|
+
return typeof e == "object" && !X.array(e);
|
|
702
|
+
},
|
|
703
|
+
method: function(e) {
|
|
704
|
+
return typeof e == "function";
|
|
705
|
+
},
|
|
706
|
+
email: function(e) {
|
|
707
|
+
return typeof e == "string" && e.length <= 320 && !!e.match(ze.email);
|
|
708
|
+
},
|
|
709
|
+
url: function(e) {
|
|
710
|
+
return typeof e == "string" && e.length <= 2048 && !!e.match(Zt());
|
|
711
|
+
},
|
|
712
|
+
hex: function(e) {
|
|
713
|
+
return typeof e == "string" && !!e.match(ze.hex);
|
|
714
|
+
}
|
|
715
|
+
}, Ht = function(e, t, n, r, s) {
|
|
716
|
+
if (e.required && t === void 0) {
|
|
717
|
+
et(e, t, n, r, s);
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
var a = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], o = e.type;
|
|
721
|
+
a.indexOf(o) > -1 ? X[o](t) || r.push(M(s.messages.types[o], e.fullField, e.type)) : o && typeof t !== e.type && r.push(M(s.messages.types[o], e.fullField, e.type));
|
|
722
|
+
}, Qt = function(e, t, n, r, s) {
|
|
723
|
+
var a = typeof e.len == "number", o = typeof e.min == "number", l = typeof e.max == "number", y = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, g = t, w = null, F = typeof t == "number", V = typeof t == "string", S = Array.isArray(t);
|
|
724
|
+
if (F ? w = "number" : V ? w = "string" : S && (w = "array"), !w)
|
|
725
|
+
return !1;
|
|
726
|
+
S && (g = t.length), V && (g = t.replace(y, "_").length), a ? g !== e.len && r.push(M(s.messages[w].len, e.fullField, e.len)) : o && !l && g < e.min ? r.push(M(s.messages[w].min, e.fullField, e.min)) : l && !o && g > e.max ? r.push(M(s.messages[w].max, e.fullField, e.max)) : o && l && (g < e.min || g > e.max) && r.push(M(s.messages[w].range, e.fullField, e.min, e.max));
|
|
727
|
+
}, J = "enum", Xt = function(e, t, n, r, s) {
|
|
728
|
+
e[J] = Array.isArray(e[J]) ? e[J] : [], e[J].indexOf(t) === -1 && r.push(M(s.messages[J], e.fullField, e[J].join(", ")));
|
|
729
|
+
}, kt = function(e, t, n, r, s) {
|
|
730
|
+
if (e.pattern) {
|
|
731
|
+
if (e.pattern instanceof RegExp)
|
|
732
|
+
e.pattern.lastIndex = 0, e.pattern.test(t) || r.push(M(s.messages.pattern.mismatch, e.fullField, t, e.pattern));
|
|
733
|
+
else if (typeof e.pattern == "string") {
|
|
734
|
+
var a = new RegExp(e.pattern);
|
|
735
|
+
a.test(t) || r.push(M(s.messages.pattern.mismatch, e.fullField, t, e.pattern));
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}, h = {
|
|
739
|
+
required: et,
|
|
740
|
+
whitespace: Yt,
|
|
741
|
+
type: Ht,
|
|
742
|
+
range: Qt,
|
|
743
|
+
enum: Xt,
|
|
744
|
+
pattern: kt
|
|
745
|
+
}, Ct = function(e, t, n, r, s) {
|
|
746
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
747
|
+
if (o) {
|
|
748
|
+
if (j(t, "string") && !e.required)
|
|
749
|
+
return n();
|
|
750
|
+
h.required(e, t, r, a, s, "string"), j(t, "string") || (h.type(e, t, r, a, s), h.range(e, t, r, a, s), h.pattern(e, t, r, a, s), e.whitespace === !0 && h.whitespace(e, t, r, a, s));
|
|
751
|
+
}
|
|
752
|
+
n(a);
|
|
753
|
+
}, er = function(e, t, n, r, s) {
|
|
754
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
755
|
+
if (o) {
|
|
756
|
+
if (j(t) && !e.required)
|
|
757
|
+
return n();
|
|
758
|
+
h.required(e, t, r, a, s), t !== void 0 && h.type(e, t, r, a, s);
|
|
759
|
+
}
|
|
760
|
+
n(a);
|
|
761
|
+
}, tr = function(e, t, n, r, s) {
|
|
762
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
763
|
+
if (o) {
|
|
764
|
+
if (t === "" && (t = void 0), j(t) && !e.required)
|
|
765
|
+
return n();
|
|
766
|
+
h.required(e, t, r, a, s), t !== void 0 && (h.type(e, t, r, a, s), h.range(e, t, r, a, s));
|
|
767
|
+
}
|
|
768
|
+
n(a);
|
|
769
|
+
}, rr = function(e, t, n, r, s) {
|
|
770
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
771
|
+
if (o) {
|
|
772
|
+
if (j(t) && !e.required)
|
|
773
|
+
return n();
|
|
774
|
+
h.required(e, t, r, a, s), t !== void 0 && h.type(e, t, r, a, s);
|
|
775
|
+
}
|
|
776
|
+
n(a);
|
|
777
|
+
}, nr = function(e, t, n, r, s) {
|
|
778
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
779
|
+
if (o) {
|
|
780
|
+
if (j(t) && !e.required)
|
|
781
|
+
return n();
|
|
782
|
+
h.required(e, t, r, a, s), j(t) || h.type(e, t, r, a, s);
|
|
783
|
+
}
|
|
784
|
+
n(a);
|
|
785
|
+
}, ir = function(e, t, n, r, s) {
|
|
786
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
787
|
+
if (o) {
|
|
788
|
+
if (j(t) && !e.required)
|
|
789
|
+
return n();
|
|
790
|
+
h.required(e, t, r, a, s), t !== void 0 && (h.type(e, t, r, a, s), h.range(e, t, r, a, s));
|
|
791
|
+
}
|
|
792
|
+
n(a);
|
|
793
|
+
}, ar = function(e, t, n, r, s) {
|
|
794
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
795
|
+
if (o) {
|
|
796
|
+
if (j(t) && !e.required)
|
|
797
|
+
return n();
|
|
798
|
+
h.required(e, t, r, a, s), t !== void 0 && (h.type(e, t, r, a, s), h.range(e, t, r, a, s));
|
|
799
|
+
}
|
|
800
|
+
n(a);
|
|
801
|
+
}, sr = function(e, t, n, r, s) {
|
|
802
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
803
|
+
if (o) {
|
|
804
|
+
if (t == null && !e.required)
|
|
805
|
+
return n();
|
|
806
|
+
h.required(e, t, r, a, s, "array"), t != null && (h.type(e, t, r, a, s), h.range(e, t, r, a, s));
|
|
807
|
+
}
|
|
808
|
+
n(a);
|
|
809
|
+
}, or = function(e, t, n, r, s) {
|
|
810
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
811
|
+
if (o) {
|
|
812
|
+
if (j(t) && !e.required)
|
|
813
|
+
return n();
|
|
814
|
+
h.required(e, t, r, a, s), t !== void 0 && h.type(e, t, r, a, s);
|
|
815
|
+
}
|
|
816
|
+
n(a);
|
|
817
|
+
}, fr = "enum", ur = function(e, t, n, r, s) {
|
|
818
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
819
|
+
if (o) {
|
|
820
|
+
if (j(t) && !e.required)
|
|
821
|
+
return n();
|
|
822
|
+
h.required(e, t, r, a, s), t !== void 0 && h[fr](e, t, r, a, s);
|
|
823
|
+
}
|
|
824
|
+
n(a);
|
|
825
|
+
}, lr = function(e, t, n, r, s) {
|
|
826
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
827
|
+
if (o) {
|
|
828
|
+
if (j(t, "string") && !e.required)
|
|
829
|
+
return n();
|
|
830
|
+
h.required(e, t, r, a, s), j(t, "string") || h.pattern(e, t, r, a, s);
|
|
831
|
+
}
|
|
832
|
+
n(a);
|
|
833
|
+
}, dr = function(e, t, n, r, s) {
|
|
834
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
835
|
+
if (o) {
|
|
836
|
+
if (j(t, "date") && !e.required)
|
|
837
|
+
return n();
|
|
838
|
+
if (h.required(e, t, r, a, s), !j(t, "date")) {
|
|
839
|
+
var l;
|
|
840
|
+
t instanceof Date ? l = t : l = new Date(t), h.type(e, l, r, a, s), l && h.range(e, l.getTime(), r, a, s);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
n(a);
|
|
844
|
+
}, cr = function(e, t, n, r, s) {
|
|
845
|
+
var a = [], o = Array.isArray(t) ? "array" : typeof t;
|
|
846
|
+
h.required(e, t, r, a, s, o), n(a);
|
|
847
|
+
}, ge = function(e, t, n, r, s) {
|
|
848
|
+
var a = e.type, o = [], l = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
849
|
+
if (l) {
|
|
850
|
+
if (j(t, a) && !e.required)
|
|
851
|
+
return n();
|
|
852
|
+
h.required(e, t, r, o, s, a), j(t, a) || h.type(e, t, r, o, s);
|
|
853
|
+
}
|
|
854
|
+
n(o);
|
|
855
|
+
}, pr = function(e, t, n, r, s) {
|
|
856
|
+
var a = [], o = e.required || !e.required && r.hasOwnProperty(e.field);
|
|
857
|
+
if (o) {
|
|
858
|
+
if (j(t) && !e.required)
|
|
859
|
+
return n();
|
|
860
|
+
h.required(e, t, r, a, s);
|
|
861
|
+
}
|
|
862
|
+
n(a);
|
|
863
|
+
}, C = {
|
|
864
|
+
string: Ct,
|
|
865
|
+
method: er,
|
|
866
|
+
number: tr,
|
|
867
|
+
boolean: rr,
|
|
868
|
+
regexp: nr,
|
|
869
|
+
integer: ir,
|
|
870
|
+
float: ar,
|
|
871
|
+
array: sr,
|
|
872
|
+
object: or,
|
|
873
|
+
enum: ur,
|
|
874
|
+
pattern: lr,
|
|
875
|
+
date: dr,
|
|
876
|
+
url: ge,
|
|
877
|
+
hex: ge,
|
|
878
|
+
email: ge,
|
|
879
|
+
required: cr,
|
|
880
|
+
any: pr
|
|
881
|
+
};
|
|
882
|
+
function qe() {
|
|
883
|
+
return {
|
|
884
|
+
default: "Validation error on field %s",
|
|
885
|
+
required: "%s is required",
|
|
886
|
+
enum: "%s must be one of %s",
|
|
887
|
+
whitespace: "%s cannot be empty",
|
|
888
|
+
date: {
|
|
889
|
+
format: "%s date %s is invalid for format %s",
|
|
890
|
+
parse: "%s date could not be parsed, %s is invalid ",
|
|
891
|
+
invalid: "%s date %s is invalid"
|
|
892
|
+
},
|
|
893
|
+
types: {
|
|
894
|
+
string: "%s is not a %s",
|
|
895
|
+
method: "%s is not a %s (function)",
|
|
896
|
+
array: "%s is not an %s",
|
|
897
|
+
object: "%s is not an %s",
|
|
898
|
+
number: "%s is not a %s",
|
|
899
|
+
date: "%s is not a %s",
|
|
900
|
+
boolean: "%s is not a %s",
|
|
901
|
+
integer: "%s is not an %s",
|
|
902
|
+
float: "%s is not a %s",
|
|
903
|
+
regexp: "%s is not a valid %s",
|
|
904
|
+
email: "%s is not a valid %s",
|
|
905
|
+
url: "%s is not a valid %s",
|
|
906
|
+
hex: "%s is not a valid %s"
|
|
907
|
+
},
|
|
908
|
+
string: {
|
|
909
|
+
len: "%s must be exactly %s characters",
|
|
910
|
+
min: "%s must be at least %s characters",
|
|
911
|
+
max: "%s cannot be longer than %s characters",
|
|
912
|
+
range: "%s must be between %s and %s characters"
|
|
913
|
+
},
|
|
914
|
+
number: {
|
|
915
|
+
len: "%s must equal %s",
|
|
916
|
+
min: "%s cannot be less than %s",
|
|
917
|
+
max: "%s cannot be greater than %s",
|
|
918
|
+
range: "%s must be between %s and %s"
|
|
919
|
+
},
|
|
920
|
+
array: {
|
|
921
|
+
len: "%s must be exactly %s in length",
|
|
922
|
+
min: "%s cannot be less than %s in length",
|
|
923
|
+
max: "%s cannot be greater than %s in length",
|
|
924
|
+
range: "%s must be between %s and %s in length"
|
|
925
|
+
},
|
|
926
|
+
pattern: {
|
|
927
|
+
mismatch: "%s value %s does not match pattern %s"
|
|
928
|
+
},
|
|
929
|
+
clone: function() {
|
|
930
|
+
var e = JSON.parse(JSON.stringify(this));
|
|
931
|
+
return e.clone = this.clone, e;
|
|
932
|
+
}
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
var Oe = qe(), re = /* @__PURE__ */ function() {
|
|
936
|
+
function i(t) {
|
|
937
|
+
this.rules = null, this._messages = Oe, this.define(t);
|
|
938
|
+
}
|
|
939
|
+
var e = i.prototype;
|
|
940
|
+
return e.define = function(n) {
|
|
941
|
+
var r = this;
|
|
942
|
+
if (!n)
|
|
943
|
+
throw new Error("Cannot configure a schema with no rules");
|
|
944
|
+
if (typeof n != "object" || Array.isArray(n))
|
|
945
|
+
throw new Error("Rules must be an object");
|
|
946
|
+
this.rules = {}, Object.keys(n).forEach(function(s) {
|
|
947
|
+
var a = n[s];
|
|
948
|
+
r.rules[s] = Array.isArray(a) ? a : [a];
|
|
949
|
+
});
|
|
950
|
+
}, e.messages = function(n) {
|
|
951
|
+
return n && (this._messages = De(qe(), n)), this._messages;
|
|
952
|
+
}, e.validate = function(n, r, s) {
|
|
953
|
+
var a = this;
|
|
954
|
+
r === void 0 && (r = {}), s === void 0 && (s = function() {
|
|
955
|
+
});
|
|
956
|
+
var o = n, l = r, y = s;
|
|
957
|
+
if (typeof l == "function" && (y = l, l = {}), !this.rules || Object.keys(this.rules).length === 0)
|
|
958
|
+
return y && y(null, o), Promise.resolve(o);
|
|
959
|
+
function g(d) {
|
|
960
|
+
var b = [], f = {};
|
|
961
|
+
function I(O) {
|
|
962
|
+
if (Array.isArray(O)) {
|
|
963
|
+
var P;
|
|
964
|
+
b = (P = b).concat.apply(P, O);
|
|
965
|
+
} else
|
|
966
|
+
b.push(O);
|
|
967
|
+
}
|
|
968
|
+
for (var m = 0; m < d.length; m++)
|
|
969
|
+
I(d[m]);
|
|
970
|
+
b.length ? (f = Fe(b), y(b, f)) : y(null, o);
|
|
971
|
+
}
|
|
972
|
+
if (l.messages) {
|
|
973
|
+
var w = this.messages();
|
|
974
|
+
w === Oe && (w = qe()), De(w, l.messages), l.messages = w;
|
|
975
|
+
} else
|
|
976
|
+
l.messages = this.messages();
|
|
977
|
+
var F = {}, V = l.keys || Object.keys(this.rules);
|
|
978
|
+
V.forEach(function(d) {
|
|
979
|
+
var b = a.rules[d], f = o[d];
|
|
980
|
+
b.forEach(function(I) {
|
|
981
|
+
var m = I;
|
|
982
|
+
typeof m.transform == "function" && (o === n && (o = D({}, o)), f = o[d] = m.transform(f)), typeof m == "function" ? m = {
|
|
983
|
+
validator: m
|
|
984
|
+
} : m = D({}, m), m.validator = a.getValidationMethod(m), m.validator && (m.field = d, m.fullField = m.fullField || d, m.type = a.getType(m), F[d] = F[d] || [], F[d].push({
|
|
985
|
+
rule: m,
|
|
986
|
+
value: f,
|
|
987
|
+
source: o,
|
|
988
|
+
field: d
|
|
989
|
+
}));
|
|
990
|
+
});
|
|
991
|
+
});
|
|
992
|
+
var S = {};
|
|
993
|
+
return Gt(F, l, function(d, b) {
|
|
994
|
+
var f = d.rule, I = (f.type === "object" || f.type === "array") && (typeof f.fields == "object" || typeof f.defaultField == "object");
|
|
995
|
+
I = I && (f.required || !f.required && d.value), f.field = d.field;
|
|
996
|
+
function m(_, u) {
|
|
997
|
+
return D({}, u, {
|
|
998
|
+
fullField: f.fullField + "." + _,
|
|
999
|
+
fullFields: f.fullFields ? [].concat(f.fullFields, [_]) : [_]
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
function O(_) {
|
|
1003
|
+
_ === void 0 && (_ = []);
|
|
1004
|
+
var u = Array.isArray(_) ? _ : [_];
|
|
1005
|
+
!l.suppressWarning && u.length && i.warning("async-validator:", u), u.length && f.message !== void 0 && (u = [].concat(f.message));
|
|
1006
|
+
var c = u.map(Te(f, o));
|
|
1007
|
+
if (l.first && c.length)
|
|
1008
|
+
return S[f.field] = 1, b(c);
|
|
1009
|
+
if (!I)
|
|
1010
|
+
b(c);
|
|
1011
|
+
else {
|
|
1012
|
+
if (f.required && !d.value)
|
|
1013
|
+
return f.message !== void 0 ? c = [].concat(f.message).map(Te(f, o)) : l.error && (c = [l.error(f, M(l.messages.required, f.field))]), b(c);
|
|
1014
|
+
var q = {};
|
|
1015
|
+
f.defaultField && Object.keys(d.value).map(function(x) {
|
|
1016
|
+
q[x] = f.defaultField;
|
|
1017
|
+
}), q = D({}, q, d.rule.fields);
|
|
1018
|
+
var E = {};
|
|
1019
|
+
Object.keys(q).forEach(function(x) {
|
|
1020
|
+
var N = q[x], ce = Array.isArray(N) ? N : [N];
|
|
1021
|
+
E[x] = ce.map(m.bind(null, x));
|
|
1022
|
+
});
|
|
1023
|
+
var L = new i(E);
|
|
1024
|
+
L.messages(l.messages), d.rule.options && (d.rule.options.messages = l.messages, d.rule.options.error = l.error), L.validate(d.value, d.rule.options || l, function(x) {
|
|
1025
|
+
var N = [];
|
|
1026
|
+
c && c.length && N.push.apply(N, c), x && x.length && N.push.apply(N, x), b(N.length ? N : null);
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
var P;
|
|
1031
|
+
if (f.asyncValidator)
|
|
1032
|
+
P = f.asyncValidator(f, d.value, O, d.source, l);
|
|
1033
|
+
else if (f.validator) {
|
|
1034
|
+
try {
|
|
1035
|
+
P = f.validator(f, d.value, O, d.source, l);
|
|
1036
|
+
} catch (_) {
|
|
1037
|
+
console.error == null || console.error(_), l.suppressValidatorError || setTimeout(function() {
|
|
1038
|
+
throw _;
|
|
1039
|
+
}, 0), O(_.message);
|
|
1040
|
+
}
|
|
1041
|
+
P === !0 ? O() : P === !1 ? O(typeof f.message == "function" ? f.message(f.fullField || f.field) : f.message || (f.fullField || f.field) + " fails") : P instanceof Array ? O(P) : P instanceof Error && O(P.message);
|
|
1042
|
+
}
|
|
1043
|
+
P && P.then && P.then(function() {
|
|
1044
|
+
return O();
|
|
1045
|
+
}, function(_) {
|
|
1046
|
+
return O(_);
|
|
1047
|
+
});
|
|
1048
|
+
}, function(d) {
|
|
1049
|
+
g(d);
|
|
1050
|
+
}, o);
|
|
1051
|
+
}, e.getType = function(n) {
|
|
1052
|
+
if (n.type === void 0 && n.pattern instanceof RegExp && (n.type = "pattern"), typeof n.validator != "function" && n.type && !C.hasOwnProperty(n.type))
|
|
1053
|
+
throw new Error(M("Unknown rule type %s", n.type));
|
|
1054
|
+
return n.type || "string";
|
|
1055
|
+
}, e.getValidationMethod = function(n) {
|
|
1056
|
+
if (typeof n.validator == "function")
|
|
1057
|
+
return n.validator;
|
|
1058
|
+
var r = Object.keys(n), s = r.indexOf("message");
|
|
1059
|
+
return s !== -1 && r.splice(s, 1), r.length === 1 && r[0] === "required" ? C.required : C[this.getType(n)] || void 0;
|
|
1060
|
+
}, i;
|
|
1061
|
+
}();
|
|
1062
|
+
re.register = function(e, t) {
|
|
1063
|
+
if (typeof t != "function")
|
|
1064
|
+
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
1065
|
+
C[e] = t;
|
|
1066
|
+
};
|
|
1067
|
+
re.warning = Ce;
|
|
1068
|
+
re.messages = Oe;
|
|
1069
|
+
re.validators = C;
|
|
1070
|
+
const vr = ["role", "aria-labelledby"];
|
|
1071
|
+
var gr = /* @__PURE__ */ Pe({
|
|
1072
|
+
name: "ElFormItem",
|
|
1073
|
+
__name: "form-item",
|
|
1074
|
+
props: xt,
|
|
1075
|
+
setup(i, { expose: e }) {
|
|
1076
|
+
const t = i, n = yt(), r = ue(Se, void 0), s = ue(me, void 0), a = Ke(void 0, { formItem: !1 }), o = _e("form-item"), l = Et().value, y = B([]), g = B(""), w = ct(g, 100), F = B(""), V = B();
|
|
1077
|
+
let S, d = !1;
|
|
1078
|
+
const b = A(() => t.labelPosition || (r == null ? void 0 : r.labelPosition)), f = A(() => b.value === "top" ? {} : { width: Ne(t.labelWidth ?? (r == null ? void 0 : r.labelWidth)) }), I = A(() => {
|
|
1079
|
+
if (b.value === "top" || r != null && r.inline)
|
|
1080
|
+
return {};
|
|
1081
|
+
if (!t.label && !t.labelWidth && E)
|
|
1082
|
+
return {};
|
|
1083
|
+
const p = Ne(t.labelWidth ?? (r == null ? void 0 : r.labelWidth));
|
|
1084
|
+
return !t.label && !n.label ? { marginLeft: p } : {};
|
|
1085
|
+
}), m = A(() => [
|
|
1086
|
+
o.b(),
|
|
1087
|
+
o.m(a.value),
|
|
1088
|
+
o.is("error", g.value === "error"),
|
|
1089
|
+
o.is("validating", g.value === "validating"),
|
|
1090
|
+
o.is("success", g.value === "success"),
|
|
1091
|
+
o.is("required", rt.value || t.required),
|
|
1092
|
+
o.is("no-asterisk", r == null ? void 0 : r.hideRequiredAsterisk),
|
|
1093
|
+
(r == null ? void 0 : r.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
|
|
1094
|
+
{
|
|
1095
|
+
[o.m("feedback")]: r == null ? void 0 : r.statusIcon,
|
|
1096
|
+
[o.m(`label-${b.value}`)]: b.value
|
|
1097
|
+
}
|
|
1098
|
+
]), O = A(() => Ue(t.inlineMessage) ? t.inlineMessage : (r == null ? void 0 : r.inlineMessage) || !1), P = A(() => [o.e("error"), { [o.em("error", "inline")]: O.value }]), _ = A(() => t.prop ? ee(t.prop) ? t.prop.join(".") : t.prop : ""), u = A(() => !!(t.label || n.label)), c = A(() => t.for ?? (y.value.length === 1 ? y.value[0] : void 0)), q = A(() => !c.value && u.value), E = !!s, L = A(() => {
|
|
1099
|
+
const p = r == null ? void 0 : r.model;
|
|
1100
|
+
if (!(!p || !t.prop))
|
|
1101
|
+
return Z(p, t.prop).value;
|
|
1102
|
+
}), x = A(() => {
|
|
1103
|
+
const { required: p } = t, v = [];
|
|
1104
|
+
t.rules && v.push(...de(t.rules));
|
|
1105
|
+
const R = r == null ? void 0 : r.rules;
|
|
1106
|
+
if (R && t.prop) {
|
|
1107
|
+
const W = Z(R, t.prop).value;
|
|
1108
|
+
W && v.push(...de(W));
|
|
1109
|
+
}
|
|
1110
|
+
if (p !== void 0) {
|
|
1111
|
+
const W = v.map(($, U) => [$, U]).filter(([$]) => "required" in $);
|
|
1112
|
+
if (W.length > 0)
|
|
1113
|
+
for (const [$, U] of W)
|
|
1114
|
+
$.required !== p && (v[U] = {
|
|
1115
|
+
...$,
|
|
1116
|
+
required: p
|
|
1117
|
+
});
|
|
1118
|
+
else
|
|
1119
|
+
v.push({ required: p });
|
|
1120
|
+
}
|
|
1121
|
+
return v;
|
|
1122
|
+
}), N = A(() => x.value.length > 0), ce = (p) => x.value.filter((v) => !v.trigger || !p ? !0 : ee(v.trigger) ? v.trigger.includes(p) : v.trigger === p).map(({ trigger: v, ...R }) => R), rt = A(() => x.value.some((p) => p.required)), nt = A(() => w.value === "error" && t.showMessage && ((r == null ? void 0 : r.showMessage) ?? !0)), Ae = A(() => `${t.label || ""}${(r == null ? void 0 : r.labelSuffix) || ""}`), z = (p) => {
|
|
1123
|
+
g.value = p;
|
|
1124
|
+
}, it = (p) => {
|
|
1125
|
+
var W;
|
|
1126
|
+
const { errors: v, fields: R } = p;
|
|
1127
|
+
(!v || !R) && console.error(p), z("error"), F.value = v ? ((W = v == null ? void 0 : v[0]) == null ? void 0 : W.message) ?? `${t.prop} is required` : "", r == null || r.emit("validate", t.prop, !1, F.value);
|
|
1128
|
+
}, at = () => {
|
|
1129
|
+
z("success"), r == null || r.emit("validate", t.prop, !0, "");
|
|
1130
|
+
}, st = async (p) => {
|
|
1131
|
+
const v = _.value;
|
|
1132
|
+
return new re({ [v]: p }).validate({ [v]: L.value }, { firstFields: !0 }).then(() => (at(), !0)).catch((R) => (it(R), Promise.reject(R)));
|
|
1133
|
+
}, Ve = async (p, v) => {
|
|
1134
|
+
if (d || !t.prop)
|
|
1135
|
+
return !1;
|
|
1136
|
+
const R = Ge(v);
|
|
1137
|
+
if (!N.value)
|
|
1138
|
+
return v == null || v(!1), !1;
|
|
1139
|
+
const W = ce(p);
|
|
1140
|
+
return W.length === 0 ? (v == null || v(!0), !0) : (z("validating"), st(W).then(() => (v == null || v(!0), !0)).catch(($) => {
|
|
1141
|
+
const { fields: U } = $;
|
|
1142
|
+
return v == null || v(!1, U), R ? !1 : Promise.reject(U);
|
|
1143
|
+
}));
|
|
1144
|
+
}, pe = () => {
|
|
1145
|
+
z(""), F.value = "", d = !1;
|
|
1146
|
+
}, je = async () => {
|
|
1147
|
+
const p = r == null ? void 0 : r.model;
|
|
1148
|
+
if (!p || !t.prop)
|
|
1149
|
+
return;
|
|
1150
|
+
const v = Z(p, t.prop);
|
|
1151
|
+
d = !0, v.value = Y(S), await ke(), pe(), d = !1;
|
|
1152
|
+
}, ot = (p) => {
|
|
1153
|
+
y.value.includes(p) || y.value.push(p);
|
|
1154
|
+
}, ft = (p) => {
|
|
1155
|
+
y.value = y.value.filter((v) => v !== p);
|
|
1156
|
+
}, ne = (p) => {
|
|
1157
|
+
S = Y(p);
|
|
1158
|
+
}, ut = () => S;
|
|
1159
|
+
k(() => t.error, (p) => {
|
|
1160
|
+
F.value = p || "", z(p ? "error" : "");
|
|
1161
|
+
}, { immediate: !0 }), k(() => t.validateStatus, (p) => z(p || ""));
|
|
1162
|
+
const H = he({
|
|
1163
|
+
...Ze(t),
|
|
1164
|
+
$el: V,
|
|
1165
|
+
size: a,
|
|
1166
|
+
validateMessage: F,
|
|
1167
|
+
validateState: g,
|
|
1168
|
+
labelId: l,
|
|
1169
|
+
inputIds: y,
|
|
1170
|
+
isGroup: q,
|
|
1171
|
+
hasLabel: u,
|
|
1172
|
+
fieldValue: L,
|
|
1173
|
+
addInputId: ot,
|
|
1174
|
+
removeInputId: ft,
|
|
1175
|
+
resetField: je,
|
|
1176
|
+
clearValidate: pe,
|
|
1177
|
+
validate: Ve,
|
|
1178
|
+
propString: _,
|
|
1179
|
+
setInitialValue: ne,
|
|
1180
|
+
getInitialValue: ut
|
|
1181
|
+
});
|
|
1182
|
+
return Ye(me, H), k(_, (p, v) => {
|
|
1183
|
+
!r || !v || (r.removeField(H, v), p && (ne(L.value), r.addField(H)));
|
|
1184
|
+
}), Qe(() => {
|
|
1185
|
+
t.prop && (ne(L.value), r == null || r.addField(H));
|
|
1186
|
+
}), Xe(() => {
|
|
1187
|
+
r == null || r.removeField(H);
|
|
1188
|
+
}), e({
|
|
1189
|
+
/**
|
|
1190
|
+
* @description Form item size.
|
|
1191
|
+
*/
|
|
1192
|
+
size: a,
|
|
1193
|
+
/**
|
|
1194
|
+
* @description Validation message.
|
|
1195
|
+
*/
|
|
1196
|
+
validateMessage: F,
|
|
1197
|
+
/**
|
|
1198
|
+
* @description Validation state.
|
|
1199
|
+
*/
|
|
1200
|
+
validateState: g,
|
|
1201
|
+
/**
|
|
1202
|
+
* @description Validate form item.
|
|
1203
|
+
*/
|
|
1204
|
+
validate: Ve,
|
|
1205
|
+
/**
|
|
1206
|
+
* @description Remove validation status of the field.
|
|
1207
|
+
*/
|
|
1208
|
+
clearValidate: pe,
|
|
1209
|
+
/**
|
|
1210
|
+
* @description Reset current field and remove validation result.
|
|
1211
|
+
*/
|
|
1212
|
+
resetField: je,
|
|
1213
|
+
/**
|
|
1214
|
+
* @description Set initial value for this field. When `resetField` is called, the field will reset to this value.
|
|
1215
|
+
*/
|
|
1216
|
+
setInitialValue: ne
|
|
1217
|
+
}), (p, v) => {
|
|
1218
|
+
var R;
|
|
1219
|
+
return ye(), He("div", {
|
|
1220
|
+
ref_key: "formItemRef",
|
|
1221
|
+
ref: V,
|
|
1222
|
+
class: Q(m.value),
|
|
1223
|
+
role: q.value ? "group" : void 0,
|
|
1224
|
+
"aria-labelledby": q.value ? T(l) : void 0
|
|
1225
|
+
}, [le(T(Lt), {
|
|
1226
|
+
"is-auto-width": f.value.width === "auto",
|
|
1227
|
+
"update-all": ((R = T(r)) == null ? void 0 : R.labelWidth) === "auto"
|
|
1228
|
+
}, {
|
|
1229
|
+
default: ve(() => [i.label || p.$slots.label ? (ye(), bt(wt(c.value ? "label" : "div"), {
|
|
1230
|
+
key: 0,
|
|
1231
|
+
id: T(l),
|
|
1232
|
+
for: c.value,
|
|
1233
|
+
class: Q(T(o).e("label")),
|
|
1234
|
+
style: Re(f.value)
|
|
1235
|
+
}, {
|
|
1236
|
+
default: ve(() => [se(p.$slots, "label", { label: Ae.value }, () => [Ft(Ie(Ae.value), 1)])]),
|
|
1237
|
+
_: 3
|
|
1238
|
+
}, 8, [
|
|
1239
|
+
"id",
|
|
1240
|
+
"for",
|
|
1241
|
+
"class",
|
|
1242
|
+
"style"
|
|
1243
|
+
])) : Me("v-if", !0)]),
|
|
1244
|
+
_: 3
|
|
1245
|
+
}, 8, ["is-auto-width", "update-all"]), Le("div", {
|
|
1246
|
+
class: Q(T(o).e("content")),
|
|
1247
|
+
style: Re(I.value)
|
|
1248
|
+
}, [se(p.$slots, "default"), le(qt, { name: `${T(o).namespace.value}-zoom-in-top` }, {
|
|
1249
|
+
default: ve(() => [nt.value ? se(p.$slots, "error", {
|
|
1250
|
+
key: 0,
|
|
1251
|
+
error: F.value
|
|
1252
|
+
}, () => [Le("div", {
|
|
1253
|
+
class: Q(P.value),
|
|
1254
|
+
role: "alert"
|
|
1255
|
+
}, Ie(F.value), 3)]) : Me("v-if", !0)]),
|
|
1256
|
+
_: 3
|
|
1257
|
+
}, 8, ["name"])], 6)], 10, vr);
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
}), tt = gr;
|
|
1261
|
+
const Or = pt(Mt, { FormItem: tt }), Er = vt(tt);
|
|
1262
|
+
export {
|
|
1263
|
+
Or as E,
|
|
1264
|
+
Er as a
|
|
1265
|
+
};
|