vue-devui 1.0.0-beta.18 → 1.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +200 -187
- package/accordion/index.es.js +221 -6
- package/accordion/index.umd.js +1 -1
- package/alert/index.es.js +28 -30
- package/alert/index.umd.js +1 -1
- package/auto-complete/index.es.js +131 -269
- package/auto-complete/index.umd.js +1 -1
- package/auto-complete/style.css +1 -1
- package/back-top/index.es.js +4 -2
- package/badge/index.es.js +13 -19
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/breadcrumb/index.es.js +2 -1
- package/button/index.es.js +39 -40
- package/button/index.umd.js +1 -1
- package/carousel/index.es.js +38 -53
- package/carousel/index.umd.js +1 -1
- package/cascader/index.es.js +16 -8
- package/cascader/style.css +1 -1
- package/color-picker/index.es.js +97 -89
- package/color-picker/index.umd.js +7 -7
- package/countdown/index.es.js +2 -1
- package/date-picker/index.es.js +40 -57
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/drawer/index.es.js +162 -5741
- package/drawer/index.umd.js +1 -27
- package/drawer/style.css +1 -1
- package/dropdown/index.es.js +459 -301
- package/dropdown/index.umd.js +1 -1
- package/dropdown/style.css +1 -1
- package/editable-select/index.es.js +6 -3
- package/form/index.es.js +1953 -1550
- package/form/index.umd.js +18 -18
- package/form/style.css +1 -1
- package/fullscreen/index.es.js +112 -133
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/icon/index.es.js +39 -57
- package/icon/index.umd.js +1 -1
- package/image-preview/index.es.js +2 -1
- package/input/style.css +1 -1
- package/input-icon/index.es.js +38 -37
- package/input-icon/index.umd.js +1 -1
- package/input-icon/style.css +1 -1
- package/input-number/index.es.js +46 -57
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/{time-axis → list}/index.d.ts +0 -0
- package/list/index.es.js +39 -0
- package/list/index.umd.js +1 -0
- package/{toast → list}/package.json +1 -1
- package/list/style.css +1 -0
- package/modal/index.es.js +300 -934
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/{toast → notification}/index.d.ts +0 -0
- package/notification/index.es.js +284 -0
- package/notification/index.umd.js +1 -0
- package/notification/package.json +7 -0
- package/notification/style.css +1 -0
- package/nuxt/components/DropdownMenu.js +3 -0
- package/nuxt/components/IFileOptions.js +3 -0
- package/nuxt/components/IUploadOptions.js +3 -0
- package/nuxt/components/List.js +3 -0
- package/nuxt/components/ListItem.js +3 -0
- package/nuxt/components/Notification.js +3 -0
- package/nuxt/components/NotificationService.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/UploadStatus.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/badgeProps.js +3 -0
- package/nuxt/components/dropdownMenuProps.js +3 -0
- package/nuxt/components/fixedOverlayProps.js +3 -0
- package/nuxt/components/flexibleOverlayProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +2 -0
- package/nuxt/components/notificationProps.js +3 -0
- package/nuxt/components/overlayEmits.js +3 -0
- package/nuxt/components/overlayProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/popoverProps.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/tooltipProps.js +3 -0
- package/nuxt/components/uploadProps.js +3 -0
- package/overlay/index.es.js +152 -198
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +40 -87
- package/pagination/index.es.js +10 -12
- package/pagination/index.umd.js +1 -1
- package/panel/index.es.js +45 -32
- package/panel/index.umd.js +1 -1
- package/popover/index.es.js +5954 -201
- package/popover/index.umd.js +27 -1
- package/popover/style.css +1 -1
- package/read-tip/index.es.js +6 -3
- package/result/index.es.js +38 -53
- package/result/index.umd.js +1 -1
- package/ripple/index.es.js +9 -5
- package/search/index.es.js +19 -29
- package/search/index.umd.js +6 -6
- package/search/style.css +1 -1
- package/select/index.es.js +42 -42
- package/select/index.umd.js +1 -1
- package/select/style.css +1 -1
- package/skeleton/index.es.js +17 -17
- package/skeleton/index.umd.js +1 -1
- package/slider/index.es.js +2 -1
- package/splitter/index.es.js +5814 -98
- package/splitter/index.umd.js +27 -1
- package/splitter/style.css +1 -1
- package/status/index.es.js +1 -4
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps-guide/index.es.js +6 -3
- package/style.css +1 -1
- package/table/index.es.js +456 -299
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.es.js +3 -4
- package/tabs/index.umd.js +1 -1
- package/tag/index.es.js +2 -1
- package/tag-input/index.es.js +4 -2
- package/textarea/style.css +1 -1
- package/time-picker/index.es.js +43 -42
- package/time-picker/index.umd.js +1 -1
- package/timeline/index.d.ts +7 -0
- package/{time-axis → timeline}/index.es.js +65 -78
- package/timeline/index.umd.js +1 -0
- package/{time-axis → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/tooltip/index.es.js +5804 -94
- package/tooltip/index.umd.js +27 -1
- package/tooltip/style.css +1 -1
- package/transfer/index.es.js +440 -165
- package/transfer/index.umd.js +17 -17
- package/transfer/style.css +1 -1
- package/tree/index.es.js +12 -7
- package/tree/index.umd.js +10 -10
- package/tree-select/index.es.js +10 -6
- package/tree-select/index.umd.js +1 -1
- package/upload/index.es.js +335 -6068
- package/upload/index.umd.js +1 -27
- package/upload/style.css +1 -1
- package/vue-devui.es.js +2555 -2799
- package/vue-devui.umd.js +16 -16
- package/nuxt/components/TimeAxis.js +0 -3
- package/nuxt/components/TimeAxisItem.js +0 -3
- package/nuxt/components/Toast.js +0 -3
- package/nuxt/components/ToastService.js +0 -3
- package/time-axis/index.umd.js +0 -1
- package/time-axis/style.css +0 -1
- package/toast/index.es.js +0 -5918
- package/toast/index.umd.js +0 -27
- package/toast/style.css +0 -1
package/form/index.es.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -14,7 +16,9 @@ var __spreadValues = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
17
|
-
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { defineComponent, provide, createVNode, toRefs, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref, unref, nextTick, mergeProps, Fragment, reactive, inject, onBeforeUnmount, withDirectives, resolveDirective } from "vue";
|
|
21
|
+
import { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
|
|
18
22
|
function mitt(n) {
|
|
19
23
|
return { all: n = n || /* @__PURE__ */ new Map(), on: function(t, e) {
|
|
20
24
|
var i = n.get(t);
|
|
@@ -116,8 +120,9 @@ function isObject(obj) {
|
|
|
116
120
|
return Object.prototype.toString.call(obj).slice(8, -1) === "Object";
|
|
117
121
|
}
|
|
118
122
|
function hasKey(obj, key) {
|
|
119
|
-
if (!isObject(obj))
|
|
123
|
+
if (!isObject(obj)) {
|
|
120
124
|
return false;
|
|
125
|
+
}
|
|
121
126
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
122
127
|
}
|
|
123
128
|
function getElOffset(curEl) {
|
|
@@ -191,1411 +196,381 @@ var Form = defineComponent({
|
|
|
191
196
|
} = this;
|
|
192
197
|
return createVNode("form", {
|
|
193
198
|
"onSubmit": onSubmit,
|
|
194
|
-
"class": "
|
|
199
|
+
"class": "devui-form"
|
|
195
200
|
}, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]);
|
|
196
201
|
}
|
|
197
202
|
});
|
|
203
|
+
const iconProps = {
|
|
204
|
+
name: {
|
|
205
|
+
type: String,
|
|
206
|
+
default: "",
|
|
207
|
+
required: true
|
|
208
|
+
},
|
|
209
|
+
size: {
|
|
210
|
+
type: String,
|
|
211
|
+
default: "inherit"
|
|
212
|
+
},
|
|
213
|
+
color: {
|
|
214
|
+
type: String,
|
|
215
|
+
default: "inherit"
|
|
216
|
+
},
|
|
217
|
+
classPrefix: {
|
|
218
|
+
type: String,
|
|
219
|
+
default: "icon"
|
|
220
|
+
}
|
|
221
|
+
};
|
|
198
222
|
var Icon = defineComponent({
|
|
199
223
|
name: "DIcon",
|
|
200
|
-
props:
|
|
201
|
-
name: {
|
|
202
|
-
type: String,
|
|
203
|
-
required: true
|
|
204
|
-
},
|
|
205
|
-
size: {
|
|
206
|
-
type: String,
|
|
207
|
-
default: "inherit"
|
|
208
|
-
},
|
|
209
|
-
color: {
|
|
210
|
-
type: String,
|
|
211
|
-
default: "inherit"
|
|
212
|
-
},
|
|
213
|
-
classPrefix: {
|
|
214
|
-
type: String,
|
|
215
|
-
default: "icon"
|
|
216
|
-
}
|
|
217
|
-
},
|
|
224
|
+
props: iconProps,
|
|
218
225
|
setup(props) {
|
|
219
|
-
return __spreadValues({}, props);
|
|
220
|
-
},
|
|
221
|
-
render() {
|
|
222
226
|
const {
|
|
223
227
|
name,
|
|
224
228
|
size,
|
|
225
229
|
color,
|
|
226
230
|
classPrefix
|
|
227
|
-
} =
|
|
228
|
-
return
|
|
229
|
-
"
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
"
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
231
|
+
} = toRefs(props);
|
|
232
|
+
return () => {
|
|
233
|
+
return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
|
|
234
|
+
"src": name.value,
|
|
235
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
236
|
+
"style": {
|
|
237
|
+
width: size.value,
|
|
238
|
+
verticalAlign: "text-bottom"
|
|
239
|
+
}
|
|
240
|
+
}, null) : createVNode("i", {
|
|
241
|
+
"class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
|
|
242
|
+
"style": {
|
|
243
|
+
fontSize: size.value,
|
|
244
|
+
color: color.value
|
|
245
|
+
}
|
|
246
|
+
}, null);
|
|
247
|
+
};
|
|
242
248
|
}
|
|
243
249
|
});
|
|
244
|
-
var
|
|
245
|
-
|
|
246
|
-
return ()
|
|
247
|
-
time && clearTimeout(time);
|
|
248
|
-
time = setTimeout(() => {
|
|
249
|
-
callBack == null ? void 0 : callBack();
|
|
250
|
-
}, wait);
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
const inBrowser = typeof window !== "undefined";
|
|
254
|
-
function on(element, eventName, handler) {
|
|
255
|
-
if (document.addEventListener) {
|
|
256
|
-
if (element && eventName && handler) {
|
|
257
|
-
element.addEventListener(eventName, handler, false);
|
|
258
|
-
}
|
|
259
|
-
} else {
|
|
260
|
-
if (element && eventName && handler) {
|
|
261
|
-
element.attachEvent("on" + eventName, handler);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
const ctx = Symbol("@@clickoutside");
|
|
266
|
-
const nodeList = /* @__PURE__ */ new Map();
|
|
267
|
-
let startClick;
|
|
268
|
-
let nid = 0;
|
|
269
|
-
let isFirst = true;
|
|
270
|
-
function createDocumentHandler(el, binding, vnode) {
|
|
271
|
-
if (inBrowser && isFirst) {
|
|
272
|
-
isFirst = false;
|
|
273
|
-
on(document, "mousedown", (e) => {
|
|
274
|
-
startClick = e;
|
|
275
|
-
});
|
|
276
|
-
on(document, "mouseup", (e) => {
|
|
277
|
-
for (const [id, node] of nodeList) {
|
|
278
|
-
node[ctx].documentHandler(e, startClick);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
return function(mouseup, mousedown) {
|
|
283
|
-
if (!vnode || !binding.instance || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target) {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
el[ctx].bindingFn && el[ctx].bindingFn();
|
|
287
|
-
};
|
|
250
|
+
var baseOverlay = "";
|
|
251
|
+
function _isSlot(s) {
|
|
252
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
288
253
|
}
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
254
|
+
const CommonOverlay = defineComponent({
|
|
255
|
+
setup(props, ctx2) {
|
|
256
|
+
return () => {
|
|
257
|
+
let _slot;
|
|
258
|
+
return createVNode(Teleport, {
|
|
259
|
+
"to": "#d-overlay-anchor"
|
|
260
|
+
}, {
|
|
261
|
+
default: () => [createVNode(Transition, {
|
|
262
|
+
"name": "devui-overlay-fade"
|
|
263
|
+
}, _isSlot(_slot = renderSlot(ctx2.slots, "default")) ? _slot : {
|
|
264
|
+
default: () => [_slot]
|
|
265
|
+
})]
|
|
266
|
+
});
|
|
297
267
|
};
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
const overlayProps = {
|
|
271
|
+
visible: {
|
|
272
|
+
type: Boolean
|
|
298
273
|
},
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
274
|
+
backgroundBlock: {
|
|
275
|
+
type: Boolean,
|
|
276
|
+
default: false
|
|
302
277
|
},
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
var popover = "";
|
|
309
|
-
const popTypeClass = {
|
|
310
|
-
success: {
|
|
311
|
-
name: "right-o",
|
|
312
|
-
color: "rgb(61, 204, 166)"
|
|
278
|
+
backgroundClass: {
|
|
279
|
+
type: String,
|
|
280
|
+
default: ""
|
|
313
281
|
},
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
color: "rgb(249, 95, 91)"
|
|
282
|
+
backgroundStyle: {
|
|
283
|
+
type: [String, Object]
|
|
317
284
|
},
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
color: "rgb(81, 112, 255)"
|
|
285
|
+
onBackdropClick: {
|
|
286
|
+
type: Function
|
|
321
287
|
},
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
288
|
+
backdropClose: {
|
|
289
|
+
type: Boolean,
|
|
290
|
+
default: true
|
|
325
291
|
},
|
|
326
|
-
|
|
292
|
+
hasBackdrop: {
|
|
293
|
+
type: Boolean,
|
|
294
|
+
default: true
|
|
295
|
+
}
|
|
327
296
|
};
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
default: 1060
|
|
353
|
-
},
|
|
354
|
-
controlled: {
|
|
355
|
-
type: Boolean,
|
|
356
|
-
default: false
|
|
357
|
-
},
|
|
358
|
-
popType: {
|
|
359
|
-
type: String,
|
|
360
|
-
default: "default"
|
|
361
|
-
},
|
|
362
|
-
showAnimation: {
|
|
363
|
-
type: Boolean,
|
|
364
|
-
default: true
|
|
365
|
-
},
|
|
366
|
-
mouseEnterDelay: {
|
|
367
|
-
type: Number,
|
|
368
|
-
default: 150
|
|
369
|
-
},
|
|
370
|
-
mouseLeaveDelay: {
|
|
371
|
-
type: Number,
|
|
372
|
-
default: 100
|
|
373
|
-
},
|
|
374
|
-
popMaxWidth: {
|
|
375
|
-
type: Number,
|
|
376
|
-
default: void 0
|
|
377
|
-
},
|
|
378
|
-
popoverStyle: {
|
|
379
|
-
type: Object,
|
|
380
|
-
default: () => ({})
|
|
297
|
+
const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
|
|
298
|
+
overlayStyle: {
|
|
299
|
+
type: [String, Object],
|
|
300
|
+
default: void 0
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
const overlayEmits = ["update:visible", "backdropClick"];
|
|
304
|
+
function useOverlayLogic(props, ctx2) {
|
|
305
|
+
const backgroundClass = computed(() => {
|
|
306
|
+
return [
|
|
307
|
+
"devui-overlay-background",
|
|
308
|
+
props.backgroundClass,
|
|
309
|
+
!props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
|
|
310
|
+
];
|
|
311
|
+
});
|
|
312
|
+
const overlayClass = computed(() => {
|
|
313
|
+
return "devui-overlay";
|
|
314
|
+
});
|
|
315
|
+
const handleBackdropClick = (event) => {
|
|
316
|
+
var _a;
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
(_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
|
|
319
|
+
if (props.backdropClose) {
|
|
320
|
+
ctx2.emit("update:visible", false);
|
|
381
321
|
}
|
|
382
|
-
}
|
|
322
|
+
};
|
|
323
|
+
const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
|
|
324
|
+
onMounted(() => {
|
|
325
|
+
const body = document.body;
|
|
326
|
+
const originOverflow = body.style.overflow;
|
|
327
|
+
const originPosition = body.style.position;
|
|
328
|
+
watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
|
|
329
|
+
if (backgroundBlock) {
|
|
330
|
+
const top = body.getBoundingClientRect().y;
|
|
331
|
+
if (visible) {
|
|
332
|
+
body.style.overflowY = "scroll";
|
|
333
|
+
body.style.position = visible ? "fixed" : "";
|
|
334
|
+
body.style.top = `${top}px`;
|
|
335
|
+
} else {
|
|
336
|
+
body.style.overflowY = originOverflow;
|
|
337
|
+
body.style.position = originPosition;
|
|
338
|
+
body.style.top = "";
|
|
339
|
+
window.scrollTo(0, -top);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
onUnmounted(() => {
|
|
344
|
+
document.body.style.overflow = originOverflow;
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
return {
|
|
348
|
+
backgroundClass,
|
|
349
|
+
overlayClass,
|
|
350
|
+
handleBackdropClick,
|
|
351
|
+
handleOverlayBubbleCancel
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
var fixedOverlay = "";
|
|
355
|
+
defineComponent({
|
|
356
|
+
name: "DFixedOverlay",
|
|
357
|
+
props: fixedOverlayProps,
|
|
358
|
+
emits: overlayEmits,
|
|
383
359
|
setup(props, ctx2) {
|
|
384
360
|
const {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
} = toRefs(props);
|
|
401
|
-
const style2 = __spreadValues({
|
|
402
|
-
zIndex: zIndex.value
|
|
403
|
-
}, popoverStyle.value);
|
|
404
|
-
const isClick = trigger.value === "click";
|
|
405
|
-
const iconType = reactive(popTypeClass[popType.value]);
|
|
406
|
-
const event = function() {
|
|
407
|
-
if (visible.value) {
|
|
408
|
-
visible.value = false;
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
visible.value = true;
|
|
412
|
-
};
|
|
413
|
-
const onClick = isClick && controlled.value ? event : null;
|
|
414
|
-
const enter = debounce(() => {
|
|
415
|
-
visible.value = true;
|
|
416
|
-
}, mouseEnterDelay.value);
|
|
417
|
-
const leave = debounce(() => {
|
|
418
|
-
visible.value = false;
|
|
419
|
-
}, mouseLeaveDelay.value);
|
|
420
|
-
const onMouseenter = !isClick && controlled.value ? enter : null;
|
|
421
|
-
const onMouseleave = !isClick && controlled.value ? leave : null;
|
|
422
|
-
const hiddenContext = () => {
|
|
423
|
-
if (!controlled.value)
|
|
424
|
-
return;
|
|
425
|
-
visible.value = false;
|
|
426
|
-
};
|
|
427
|
-
popMaxWidth.value && (style2.maxWidth = `${popMaxWidth.value}px`);
|
|
428
|
-
watch(() => props.visible, (newVal) => {
|
|
429
|
-
if (controlled.value)
|
|
430
|
-
return;
|
|
431
|
-
visible.value = newVal;
|
|
361
|
+
backgroundClass,
|
|
362
|
+
overlayClass,
|
|
363
|
+
handleBackdropClick,
|
|
364
|
+
handleOverlayBubbleCancel
|
|
365
|
+
} = useOverlayLogic(props, ctx2);
|
|
366
|
+
return () => createVNode(CommonOverlay, null, {
|
|
367
|
+
default: () => [props.visible && createVNode("div", {
|
|
368
|
+
"class": backgroundClass.value,
|
|
369
|
+
"style": props.backgroundStyle,
|
|
370
|
+
"onClick": handleBackdropClick
|
|
371
|
+
}, [createVNode("div", {
|
|
372
|
+
"class": overlayClass.value,
|
|
373
|
+
"style": props.overlayStyle,
|
|
374
|
+
"onClick": handleOverlayBubbleCancel
|
|
375
|
+
}, [renderSlot(ctx2.slots, "default")])])]
|
|
432
376
|
});
|
|
433
|
-
return () => {
|
|
434
|
-
var _a, _b;
|
|
435
|
-
return createVNode("div", {
|
|
436
|
-
"class": ["devui-popover", position.value, {
|
|
437
|
-
"devui-popover-animation": showAnimation.value,
|
|
438
|
-
"devui-popover-isVisible": visible.value
|
|
439
|
-
}]
|
|
440
|
-
}, [withDirectives(createVNode("div", {
|
|
441
|
-
"class": "devui-popover-reference",
|
|
442
|
-
"onMouseenter": onMouseenter,
|
|
443
|
-
"onMouseleave": onMouseleave,
|
|
444
|
-
"onClick": onClick
|
|
445
|
-
}, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), [[resolveDirective("clickoutside"), hiddenContext]]), createVNode("div", {
|
|
446
|
-
"class": ["devui-popover-content", iconType.name ? "is-icon" : ""],
|
|
447
|
-
"style": style2
|
|
448
|
-
}, [iconType.name && createVNode(resolveComponent("d-icon"), {
|
|
449
|
-
"name": iconType.name,
|
|
450
|
-
"color": iconType.color,
|
|
451
|
-
"class": "devui-popover-icon",
|
|
452
|
-
"size": "16px"
|
|
453
|
-
}, null), ((_b = slots.content) == null ? void 0 : _b.call(slots)) || createVNode("span", null, [content.value]), createVNode("span", {
|
|
454
|
-
"class": "after",
|
|
455
|
-
"style": style2
|
|
456
|
-
}, null)])]);
|
|
457
|
-
};
|
|
458
377
|
}
|
|
459
378
|
});
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
"trigger": "hover"
|
|
489
|
-
}, {
|
|
490
|
-
reference: () => createVNode("span", {
|
|
491
|
-
"class": "form-label-help"
|
|
492
|
-
}, [createVNode(Icon, {
|
|
493
|
-
"name": "helping",
|
|
494
|
-
"color": "#252b3a"
|
|
495
|
-
}, null)])
|
|
496
|
-
})])]);
|
|
497
|
-
};
|
|
379
|
+
const flexibleOverlayProps = {
|
|
380
|
+
modelValue: {
|
|
381
|
+
type: Boolean,
|
|
382
|
+
default: false
|
|
383
|
+
},
|
|
384
|
+
origin: {
|
|
385
|
+
type: Object,
|
|
386
|
+
require: true
|
|
387
|
+
},
|
|
388
|
+
position: {
|
|
389
|
+
type: Array,
|
|
390
|
+
default: ["bottom"]
|
|
391
|
+
},
|
|
392
|
+
offset: {
|
|
393
|
+
type: [Number, Object],
|
|
394
|
+
default: 8
|
|
395
|
+
},
|
|
396
|
+
align: {
|
|
397
|
+
type: String,
|
|
398
|
+
default: null
|
|
399
|
+
},
|
|
400
|
+
showArrow: {
|
|
401
|
+
type: Boolean,
|
|
402
|
+
default: false
|
|
403
|
+
},
|
|
404
|
+
isArrowCenter: {
|
|
405
|
+
type: Boolean,
|
|
406
|
+
default: true
|
|
498
407
|
}
|
|
499
|
-
}
|
|
500
|
-
function
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
target[key] = source[key];
|
|
507
|
-
}
|
|
508
|
-
}
|
|
408
|
+
};
|
|
409
|
+
function getScrollParent(element) {
|
|
410
|
+
const overflowRegex = /(auto|scroll|hidden)/;
|
|
411
|
+
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
412
|
+
const style2 = window.getComputedStyle(parent);
|
|
413
|
+
if (overflowRegex.test(style2.overflow + style2.overflowX + style2.overflowY)) {
|
|
414
|
+
return parent;
|
|
509
415
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
return _extends.apply(this, arguments);
|
|
416
|
+
}
|
|
417
|
+
return window;
|
|
513
418
|
}
|
|
514
|
-
function
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
419
|
+
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
420
|
+
let { x, y } = point;
|
|
421
|
+
if (!isArrowCenter) {
|
|
422
|
+
const { width, height } = originRect;
|
|
423
|
+
if (x && placement.includes("start")) {
|
|
424
|
+
x = 12;
|
|
425
|
+
}
|
|
426
|
+
if (x && placement.includes("end")) {
|
|
427
|
+
x = Math.round(width - 24);
|
|
428
|
+
}
|
|
429
|
+
if (y && placement.includes("start")) {
|
|
430
|
+
y = 10;
|
|
431
|
+
}
|
|
432
|
+
if (y && placement.includes("end")) {
|
|
433
|
+
y = height - 14;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return { x, y };
|
|
518
437
|
}
|
|
519
|
-
function
|
|
520
|
-
|
|
521
|
-
|
|
438
|
+
function useOverlay(props, emit) {
|
|
439
|
+
const overlayRef = ref();
|
|
440
|
+
const arrowRef = ref();
|
|
441
|
+
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
442
|
+
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
443
|
+
const staticSide = {
|
|
444
|
+
top: "bottom",
|
|
445
|
+
right: "left",
|
|
446
|
+
bottom: "top",
|
|
447
|
+
left: "right"
|
|
448
|
+
}[placement.split("-")[0]];
|
|
449
|
+
Object.assign(arrowEl.style, {
|
|
450
|
+
left: x ? `${x}px` : "",
|
|
451
|
+
top: y ? `${y}px` : "",
|
|
452
|
+
right: "",
|
|
453
|
+
bottom: "",
|
|
454
|
+
[staticSide]: "-4px"
|
|
455
|
+
});
|
|
522
456
|
};
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
457
|
+
const updatePosition = async () => {
|
|
458
|
+
const hostEl = props.origin;
|
|
459
|
+
const overlayEl = unref(overlayRef.value);
|
|
460
|
+
const arrowEl = unref(arrowRef.value);
|
|
461
|
+
const middleware = [
|
|
462
|
+
shift(),
|
|
463
|
+
offset(props.offset),
|
|
464
|
+
autoPlacement({
|
|
465
|
+
alignment: props.align,
|
|
466
|
+
allowedPlacements: props.position
|
|
467
|
+
})
|
|
468
|
+
];
|
|
469
|
+
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
470
|
+
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
471
|
+
strategy: "fixed",
|
|
472
|
+
middleware
|
|
473
|
+
});
|
|
474
|
+
emit("positionChange", placement);
|
|
475
|
+
Object.assign(overlayEl.style, { top: `${y}px`, left: `${x}px` });
|
|
476
|
+
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
529
477
|
};
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
478
|
+
watch(() => props.modelValue, () => {
|
|
479
|
+
const originParent = getScrollParent(props.origin);
|
|
480
|
+
if (props.modelValue && props.origin) {
|
|
481
|
+
nextTick(updatePosition);
|
|
482
|
+
originParent.addEventListener("scroll", updatePosition);
|
|
483
|
+
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
484
|
+
window.addEventListener("resize", updatePosition);
|
|
485
|
+
} else {
|
|
486
|
+
originParent.removeEventListener("scroll", updatePosition);
|
|
487
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
488
|
+
window.removeEventListener("resize", updatePosition);
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
onUnmounted(() => {
|
|
492
|
+
const originParent = getScrollParent(props.origin);
|
|
493
|
+
originParent.removeEventListener("scroll", updatePosition);
|
|
494
|
+
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
495
|
+
window.removeEventListener("resize", updatePosition);
|
|
496
|
+
});
|
|
497
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
546
498
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
function _wrapNativeSuper(Class) {
|
|
567
|
-
var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
568
|
-
_wrapNativeSuper = function _wrapNativeSuper2(Class2) {
|
|
569
|
-
if (Class2 === null || !_isNativeFunction(Class2))
|
|
570
|
-
return Class2;
|
|
571
|
-
if (typeof Class2 !== "function") {
|
|
572
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
573
|
-
}
|
|
574
|
-
if (typeof _cache !== "undefined") {
|
|
575
|
-
if (_cache.has(Class2))
|
|
576
|
-
return _cache.get(Class2);
|
|
577
|
-
_cache.set(Class2, Wrapper);
|
|
578
|
-
}
|
|
579
|
-
function Wrapper() {
|
|
580
|
-
return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
|
|
581
|
-
}
|
|
582
|
-
Wrapper.prototype = Object.create(Class2.prototype, {
|
|
583
|
-
constructor: {
|
|
584
|
-
value: Wrapper,
|
|
585
|
-
enumerable: false,
|
|
586
|
-
writable: true,
|
|
587
|
-
configurable: true
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
return _setPrototypeOf(Wrapper, Class2);
|
|
591
|
-
};
|
|
592
|
-
return _wrapNativeSuper(Class);
|
|
593
|
-
}
|
|
594
|
-
var formatRegExp = /%[sdj%]/g;
|
|
595
|
-
var warning = function warning2() {
|
|
596
|
-
};
|
|
597
|
-
if (typeof process !== "undefined" && process.env && false) {
|
|
598
|
-
warning = function warning3(type4, errors) {
|
|
599
|
-
if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
|
|
600
|
-
if (errors.every(function(e) {
|
|
601
|
-
return typeof e === "string";
|
|
602
|
-
})) {
|
|
603
|
-
console.warn(type4, errors);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
function convertFieldsError(errors) {
|
|
609
|
-
if (!errors || !errors.length)
|
|
610
|
-
return null;
|
|
611
|
-
var fields = {};
|
|
612
|
-
errors.forEach(function(error) {
|
|
613
|
-
var field = error.field;
|
|
614
|
-
fields[field] = fields[field] || [];
|
|
615
|
-
fields[field].push(error);
|
|
616
|
-
});
|
|
617
|
-
return fields;
|
|
618
|
-
}
|
|
619
|
-
function format(template) {
|
|
620
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
621
|
-
args[_key - 1] = arguments[_key];
|
|
622
|
-
}
|
|
623
|
-
var i = 0;
|
|
624
|
-
var len = args.length;
|
|
625
|
-
if (typeof template === "function") {
|
|
626
|
-
return template.apply(null, args);
|
|
627
|
-
}
|
|
628
|
-
if (typeof template === "string") {
|
|
629
|
-
var str = template.replace(formatRegExp, function(x) {
|
|
630
|
-
if (x === "%%") {
|
|
631
|
-
return "%";
|
|
632
|
-
}
|
|
633
|
-
if (i >= len) {
|
|
634
|
-
return x;
|
|
635
|
-
}
|
|
636
|
-
switch (x) {
|
|
637
|
-
case "%s":
|
|
638
|
-
return String(args[i++]);
|
|
639
|
-
case "%d":
|
|
640
|
-
return Number(args[i++]);
|
|
641
|
-
case "%j":
|
|
642
|
-
try {
|
|
643
|
-
return JSON.stringify(args[i++]);
|
|
644
|
-
} catch (_) {
|
|
645
|
-
return "[Circular]";
|
|
646
|
-
}
|
|
647
|
-
break;
|
|
648
|
-
default:
|
|
649
|
-
return x;
|
|
650
|
-
}
|
|
651
|
-
});
|
|
652
|
-
return str;
|
|
653
|
-
}
|
|
654
|
-
return template;
|
|
655
|
-
}
|
|
656
|
-
function isNativeStringType(type4) {
|
|
657
|
-
return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
|
|
658
|
-
}
|
|
659
|
-
function isEmptyValue(value, type4) {
|
|
660
|
-
if (value === void 0 || value === null) {
|
|
661
|
-
return true;
|
|
662
|
-
}
|
|
663
|
-
if (type4 === "array" && Array.isArray(value) && !value.length) {
|
|
664
|
-
return true;
|
|
665
|
-
}
|
|
666
|
-
if (isNativeStringType(type4) && typeof value === "string" && !value) {
|
|
667
|
-
return true;
|
|
668
|
-
}
|
|
669
|
-
return false;
|
|
670
|
-
}
|
|
671
|
-
function asyncParallelArray(arr, func, callback) {
|
|
672
|
-
var results = [];
|
|
673
|
-
var total = 0;
|
|
674
|
-
var arrLength = arr.length;
|
|
675
|
-
function count(errors) {
|
|
676
|
-
results.push.apply(results, errors || []);
|
|
677
|
-
total++;
|
|
678
|
-
if (total === arrLength) {
|
|
679
|
-
callback(results);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
arr.forEach(function(a) {
|
|
683
|
-
func(a, count);
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
function asyncSerialArray(arr, func, callback) {
|
|
687
|
-
var index2 = 0;
|
|
688
|
-
var arrLength = arr.length;
|
|
689
|
-
function next(errors) {
|
|
690
|
-
if (errors && errors.length) {
|
|
691
|
-
callback(errors);
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
694
|
-
var original = index2;
|
|
695
|
-
index2 = index2 + 1;
|
|
696
|
-
if (original < arrLength) {
|
|
697
|
-
func(arr[original], next);
|
|
698
|
-
} else {
|
|
699
|
-
callback([]);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
next([]);
|
|
703
|
-
}
|
|
704
|
-
function flattenObjArr(objArr) {
|
|
705
|
-
var ret = [];
|
|
706
|
-
Object.keys(objArr).forEach(function(k) {
|
|
707
|
-
ret.push.apply(ret, objArr[k] || []);
|
|
708
|
-
});
|
|
709
|
-
return ret;
|
|
710
|
-
}
|
|
711
|
-
var AsyncValidationError = /* @__PURE__ */ function(_Error) {
|
|
712
|
-
_inheritsLoose(AsyncValidationError2, _Error);
|
|
713
|
-
function AsyncValidationError2(errors, fields) {
|
|
714
|
-
var _this;
|
|
715
|
-
_this = _Error.call(this, "Async Validation Error") || this;
|
|
716
|
-
_this.errors = errors;
|
|
717
|
-
_this.fields = fields;
|
|
718
|
-
return _this;
|
|
719
|
-
}
|
|
720
|
-
return AsyncValidationError2;
|
|
721
|
-
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
722
|
-
function asyncMap(objArr, option, func, callback, source) {
|
|
723
|
-
if (option.first) {
|
|
724
|
-
var _pending = new Promise(function(resolve, reject) {
|
|
725
|
-
var next = function next2(errors) {
|
|
726
|
-
callback(errors);
|
|
727
|
-
return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
|
|
728
|
-
};
|
|
729
|
-
var flattenArr = flattenObjArr(objArr);
|
|
730
|
-
asyncSerialArray(flattenArr, func, next);
|
|
731
|
-
});
|
|
732
|
-
_pending["catch"](function(e) {
|
|
733
|
-
return e;
|
|
499
|
+
var flexibleOverlay = "";
|
|
500
|
+
const FlexibleOverlay = defineComponent({
|
|
501
|
+
name: "DFlexibleOverlay",
|
|
502
|
+
inheritAttrs: false,
|
|
503
|
+
props: flexibleOverlayProps,
|
|
504
|
+
emits: ["update:modelValue", "positionChange"],
|
|
505
|
+
setup(props, {
|
|
506
|
+
slots,
|
|
507
|
+
attrs,
|
|
508
|
+
emit,
|
|
509
|
+
expose
|
|
510
|
+
}) {
|
|
511
|
+
const {
|
|
512
|
+
arrowRef,
|
|
513
|
+
overlayRef,
|
|
514
|
+
updatePosition
|
|
515
|
+
} = useOverlay(props, emit);
|
|
516
|
+
expose({
|
|
517
|
+
updatePosition
|
|
734
518
|
});
|
|
735
|
-
return
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
results.push.apply(results, errors);
|
|
745
|
-
total++;
|
|
746
|
-
if (total === objArrLength) {
|
|
747
|
-
callback(results);
|
|
748
|
-
return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
|
|
749
|
-
}
|
|
519
|
+
return () => {
|
|
520
|
+
var _a;
|
|
521
|
+
return props.modelValue && createVNode("div", mergeProps({
|
|
522
|
+
"ref": overlayRef,
|
|
523
|
+
"class": "devui-flexible-overlay"
|
|
524
|
+
}, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
|
|
525
|
+
"ref": arrowRef,
|
|
526
|
+
"class": "devui-flexible-overlay-arrow"
|
|
527
|
+
}, null)]);
|
|
750
528
|
};
|
|
751
|
-
if (!objArrKeys.length) {
|
|
752
|
-
callback(results);
|
|
753
|
-
resolve(source);
|
|
754
|
-
}
|
|
755
|
-
objArrKeys.forEach(function(key) {
|
|
756
|
-
var arr = objArr[key];
|
|
757
|
-
if (firstFields.indexOf(key) !== -1) {
|
|
758
|
-
asyncSerialArray(arr, func, next);
|
|
759
|
-
} else {
|
|
760
|
-
asyncParallelArray(arr, func, next);
|
|
761
|
-
}
|
|
762
|
-
});
|
|
763
|
-
});
|
|
764
|
-
pending["catch"](function(e) {
|
|
765
|
-
return e;
|
|
766
|
-
});
|
|
767
|
-
return pending;
|
|
768
|
-
}
|
|
769
|
-
function isErrorObj(obj) {
|
|
770
|
-
return !!(obj && obj.message !== void 0);
|
|
771
|
-
}
|
|
772
|
-
function getValue(value, path) {
|
|
773
|
-
var v = value;
|
|
774
|
-
for (var i = 0; i < path.length; i++) {
|
|
775
|
-
if (v == void 0) {
|
|
776
|
-
return v;
|
|
777
|
-
}
|
|
778
|
-
v = v[path[i]];
|
|
779
529
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
fieldValue = getValue(source, rule.fullFields);
|
|
787
|
-
} else {
|
|
788
|
-
fieldValue = source[oe.field || rule.fullField];
|
|
789
|
-
}
|
|
790
|
-
if (isErrorObj(oe)) {
|
|
791
|
-
oe.field = oe.field || rule.fullField;
|
|
792
|
-
oe.fieldValue = fieldValue;
|
|
793
|
-
return oe;
|
|
794
|
-
}
|
|
795
|
-
return {
|
|
796
|
-
message: typeof oe === "function" ? oe() : oe,
|
|
797
|
-
fieldValue,
|
|
798
|
-
field: oe.field || rule.fullField
|
|
799
|
-
};
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
function deepMerge(target, source) {
|
|
803
|
-
if (source) {
|
|
804
|
-
for (var s in source) {
|
|
805
|
-
if (source.hasOwnProperty(s)) {
|
|
806
|
-
var value = source[s];
|
|
807
|
-
if (typeof value === "object" && typeof target[s] === "object") {
|
|
808
|
-
target[s] = _extends({}, target[s], value);
|
|
809
|
-
} else {
|
|
810
|
-
target[s] = value;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
return target;
|
|
816
|
-
}
|
|
817
|
-
var required$1 = function required(rule, value, source, errors, options, type4) {
|
|
818
|
-
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
|
|
819
|
-
errors.push(format(options.messages.required, rule.fullField));
|
|
820
|
-
}
|
|
821
|
-
};
|
|
822
|
-
var whitespace = function whitespace2(rule, value, source, errors, options) {
|
|
823
|
-
if (/^\s+$/.test(value) || value === "") {
|
|
824
|
-
errors.push(format(options.messages.whitespace, rule.fullField));
|
|
825
|
-
}
|
|
826
|
-
};
|
|
827
|
-
var pattern$2 = {
|
|
828
|
-
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,}))$/,
|
|
829
|
-
url: new RegExp("^(?!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]*)?$", "i"),
|
|
830
|
-
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
|
831
|
-
};
|
|
832
|
-
var types = {
|
|
833
|
-
integer: function integer(value) {
|
|
834
|
-
return types.number(value) && parseInt(value, 10) === value;
|
|
835
|
-
},
|
|
836
|
-
"float": function float(value) {
|
|
837
|
-
return types.number(value) && !types.integer(value);
|
|
530
|
+
});
|
|
531
|
+
const inBrowser = typeof window !== "undefined";
|
|
532
|
+
const popoverProps = {
|
|
533
|
+
isOpen: {
|
|
534
|
+
type: Boolean,
|
|
535
|
+
default: false
|
|
838
536
|
},
|
|
839
|
-
|
|
840
|
-
|
|
537
|
+
position: {
|
|
538
|
+
type: Array,
|
|
539
|
+
default: ["bottom"]
|
|
841
540
|
},
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}
|
|
846
|
-
try {
|
|
847
|
-
return !!new RegExp(value);
|
|
848
|
-
} catch (e) {
|
|
849
|
-
return false;
|
|
850
|
-
}
|
|
541
|
+
align: {
|
|
542
|
+
type: String,
|
|
543
|
+
default: null
|
|
851
544
|
},
|
|
852
|
-
|
|
853
|
-
|
|
545
|
+
offset: {
|
|
546
|
+
type: [Number, Object],
|
|
547
|
+
default: 8
|
|
854
548
|
},
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
}
|
|
859
|
-
return typeof value === "number";
|
|
549
|
+
content: {
|
|
550
|
+
type: String,
|
|
551
|
+
default: ""
|
|
860
552
|
},
|
|
861
|
-
|
|
862
|
-
|
|
553
|
+
trigger: {
|
|
554
|
+
type: String,
|
|
555
|
+
default: "click"
|
|
863
556
|
},
|
|
864
|
-
|
|
865
|
-
|
|
557
|
+
popType: {
|
|
558
|
+
type: String,
|
|
559
|
+
default: "default"
|
|
866
560
|
},
|
|
867
|
-
|
|
868
|
-
|
|
561
|
+
showAnimation: {
|
|
562
|
+
type: Boolean,
|
|
563
|
+
default: true
|
|
869
564
|
},
|
|
870
|
-
|
|
871
|
-
|
|
565
|
+
mouseEnterDelay: {
|
|
566
|
+
type: Number,
|
|
567
|
+
default: 150
|
|
872
568
|
},
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
};
|
|
877
|
-
var type$1 = function type(rule, value, source, errors, options) {
|
|
878
|
-
if (rule.required && value === void 0) {
|
|
879
|
-
required$1(rule, value, source, errors, options);
|
|
880
|
-
return;
|
|
881
|
-
}
|
|
882
|
-
var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
|
|
883
|
-
var ruleType = rule.type;
|
|
884
|
-
if (custom.indexOf(ruleType) > -1) {
|
|
885
|
-
if (!types[ruleType](value)) {
|
|
886
|
-
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
|
|
887
|
-
}
|
|
888
|
-
} else if (ruleType && typeof value !== rule.type) {
|
|
889
|
-
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
|
|
890
|
-
}
|
|
891
|
-
};
|
|
892
|
-
var range = function range2(rule, value, source, errors, options) {
|
|
893
|
-
var len = typeof rule.len === "number";
|
|
894
|
-
var min = typeof rule.min === "number";
|
|
895
|
-
var max = typeof rule.max === "number";
|
|
896
|
-
var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
897
|
-
var val = value;
|
|
898
|
-
var key = null;
|
|
899
|
-
var num = typeof value === "number";
|
|
900
|
-
var str = typeof value === "string";
|
|
901
|
-
var arr = Array.isArray(value);
|
|
902
|
-
if (num) {
|
|
903
|
-
key = "number";
|
|
904
|
-
} else if (str) {
|
|
905
|
-
key = "string";
|
|
906
|
-
} else if (arr) {
|
|
907
|
-
key = "array";
|
|
908
|
-
}
|
|
909
|
-
if (!key) {
|
|
910
|
-
return false;
|
|
911
|
-
}
|
|
912
|
-
if (arr) {
|
|
913
|
-
val = value.length;
|
|
914
|
-
}
|
|
915
|
-
if (str) {
|
|
916
|
-
val = value.replace(spRegexp, "_").length;
|
|
917
|
-
}
|
|
918
|
-
if (len) {
|
|
919
|
-
if (val !== rule.len) {
|
|
920
|
-
errors.push(format(options.messages[key].len, rule.fullField, rule.len));
|
|
921
|
-
}
|
|
922
|
-
} else if (min && !max && val < rule.min) {
|
|
923
|
-
errors.push(format(options.messages[key].min, rule.fullField, rule.min));
|
|
924
|
-
} else if (max && !min && val > rule.max) {
|
|
925
|
-
errors.push(format(options.messages[key].max, rule.fullField, rule.max));
|
|
926
|
-
} else if (min && max && (val < rule.min || val > rule.max)) {
|
|
927
|
-
errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
|
|
928
|
-
}
|
|
929
|
-
};
|
|
930
|
-
var ENUM$1 = "enum";
|
|
931
|
-
var enumerable$1 = function enumerable(rule, value, source, errors, options) {
|
|
932
|
-
rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
|
|
933
|
-
if (rule[ENUM$1].indexOf(value) === -1) {
|
|
934
|
-
errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
|
|
935
|
-
}
|
|
936
|
-
};
|
|
937
|
-
var pattern$1 = function pattern(rule, value, source, errors, options) {
|
|
938
|
-
if (rule.pattern) {
|
|
939
|
-
if (rule.pattern instanceof RegExp) {
|
|
940
|
-
rule.pattern.lastIndex = 0;
|
|
941
|
-
if (!rule.pattern.test(value)) {
|
|
942
|
-
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
943
|
-
}
|
|
944
|
-
} else if (typeof rule.pattern === "string") {
|
|
945
|
-
var _pattern = new RegExp(rule.pattern);
|
|
946
|
-
if (!_pattern.test(value)) {
|
|
947
|
-
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
};
|
|
952
|
-
var rules = {
|
|
953
|
-
required: required$1,
|
|
954
|
-
whitespace,
|
|
955
|
-
type: type$1,
|
|
956
|
-
range,
|
|
957
|
-
"enum": enumerable$1,
|
|
958
|
-
pattern: pattern$1
|
|
959
|
-
};
|
|
960
|
-
var string = function string2(rule, value, callback, source, options) {
|
|
961
|
-
var errors = [];
|
|
962
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
963
|
-
if (validate) {
|
|
964
|
-
if (isEmptyValue(value, "string") && !rule.required) {
|
|
965
|
-
return callback();
|
|
966
|
-
}
|
|
967
|
-
rules.required(rule, value, source, errors, options, "string");
|
|
968
|
-
if (!isEmptyValue(value, "string")) {
|
|
969
|
-
rules.type(rule, value, source, errors, options);
|
|
970
|
-
rules.range(rule, value, source, errors, options);
|
|
971
|
-
rules.pattern(rule, value, source, errors, options);
|
|
972
|
-
if (rule.whitespace === true) {
|
|
973
|
-
rules.whitespace(rule, value, source, errors, options);
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
callback(errors);
|
|
978
|
-
};
|
|
979
|
-
var method2 = function method3(rule, value, callback, source, options) {
|
|
980
|
-
var errors = [];
|
|
981
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
982
|
-
if (validate) {
|
|
983
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
984
|
-
return callback();
|
|
985
|
-
}
|
|
986
|
-
rules.required(rule, value, source, errors, options);
|
|
987
|
-
if (value !== void 0) {
|
|
988
|
-
rules.type(rule, value, source, errors, options);
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
callback(errors);
|
|
992
|
-
};
|
|
993
|
-
var number2 = function number3(rule, value, callback, source, options) {
|
|
994
|
-
var errors = [];
|
|
995
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
996
|
-
if (validate) {
|
|
997
|
-
if (value === "") {
|
|
998
|
-
value = void 0;
|
|
999
|
-
}
|
|
1000
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
1001
|
-
return callback();
|
|
1002
|
-
}
|
|
1003
|
-
rules.required(rule, value, source, errors, options);
|
|
1004
|
-
if (value !== void 0) {
|
|
1005
|
-
rules.type(rule, value, source, errors, options);
|
|
1006
|
-
rules.range(rule, value, source, errors, options);
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
callback(errors);
|
|
1010
|
-
};
|
|
1011
|
-
var _boolean = function _boolean2(rule, value, callback, source, options) {
|
|
1012
|
-
var errors = [];
|
|
1013
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1014
|
-
if (validate) {
|
|
1015
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
1016
|
-
return callback();
|
|
1017
|
-
}
|
|
1018
|
-
rules.required(rule, value, source, errors, options);
|
|
1019
|
-
if (value !== void 0) {
|
|
1020
|
-
rules.type(rule, value, source, errors, options);
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
callback(errors);
|
|
1024
|
-
};
|
|
1025
|
-
var regexp2 = function regexp3(rule, value, callback, source, options) {
|
|
1026
|
-
var errors = [];
|
|
1027
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1028
|
-
if (validate) {
|
|
1029
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
1030
|
-
return callback();
|
|
1031
|
-
}
|
|
1032
|
-
rules.required(rule, value, source, errors, options);
|
|
1033
|
-
if (!isEmptyValue(value)) {
|
|
1034
|
-
rules.type(rule, value, source, errors, options);
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
callback(errors);
|
|
1038
|
-
};
|
|
1039
|
-
var integer2 = function integer3(rule, value, callback, source, options) {
|
|
1040
|
-
var errors = [];
|
|
1041
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1042
|
-
if (validate) {
|
|
1043
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
1044
|
-
return callback();
|
|
1045
|
-
}
|
|
1046
|
-
rules.required(rule, value, source, errors, options);
|
|
1047
|
-
if (value !== void 0) {
|
|
1048
|
-
rules.type(rule, value, source, errors, options);
|
|
1049
|
-
rules.range(rule, value, source, errors, options);
|
|
1050
|
-
}
|
|
569
|
+
mouseLeaveDelay: {
|
|
570
|
+
type: Number,
|
|
571
|
+
default: 100
|
|
1051
572
|
}
|
|
1052
|
-
callback(errors);
|
|
1053
573
|
};
|
|
1054
|
-
var floatFn = function floatFn2(rule, value, callback, source, options) {
|
|
1055
|
-
var errors = [];
|
|
1056
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1057
|
-
if (validate) {
|
|
1058
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
1059
|
-
return callback();
|
|
1060
|
-
}
|
|
1061
|
-
rules.required(rule, value, source, errors, options);
|
|
1062
|
-
if (value !== void 0) {
|
|
1063
|
-
rules.type(rule, value, source, errors, options);
|
|
1064
|
-
rules.range(rule, value, source, errors, options);
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
callback(errors);
|
|
1068
|
-
};
|
|
1069
|
-
var array2 = function array3(rule, value, callback, source, options) {
|
|
1070
|
-
var errors = [];
|
|
1071
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1072
|
-
if (validate) {
|
|
1073
|
-
if ((value === void 0 || value === null) && !rule.required) {
|
|
1074
|
-
return callback();
|
|
1075
|
-
}
|
|
1076
|
-
rules.required(rule, value, source, errors, options, "array");
|
|
1077
|
-
if (value !== void 0 && value !== null) {
|
|
1078
|
-
rules.type(rule, value, source, errors, options);
|
|
1079
|
-
rules.range(rule, value, source, errors, options);
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
callback(errors);
|
|
1083
|
-
};
|
|
1084
|
-
var object2 = function object3(rule, value, callback, source, options) {
|
|
1085
|
-
var errors = [];
|
|
1086
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1087
|
-
if (validate) {
|
|
1088
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
1089
|
-
return callback();
|
|
1090
|
-
}
|
|
1091
|
-
rules.required(rule, value, source, errors, options);
|
|
1092
|
-
if (value !== void 0) {
|
|
1093
|
-
rules.type(rule, value, source, errors, options);
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
callback(errors);
|
|
1097
|
-
};
|
|
1098
|
-
var ENUM = "enum";
|
|
1099
|
-
var enumerable2 = function enumerable3(rule, value, callback, source, options) {
|
|
1100
|
-
var errors = [];
|
|
1101
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1102
|
-
if (validate) {
|
|
1103
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
1104
|
-
return callback();
|
|
1105
|
-
}
|
|
1106
|
-
rules.required(rule, value, source, errors, options);
|
|
1107
|
-
if (value !== void 0) {
|
|
1108
|
-
rules[ENUM](rule, value, source, errors, options);
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
callback(errors);
|
|
1112
|
-
};
|
|
1113
|
-
var pattern2 = function pattern3(rule, value, callback, source, options) {
|
|
1114
|
-
var errors = [];
|
|
1115
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1116
|
-
if (validate) {
|
|
1117
|
-
if (isEmptyValue(value, "string") && !rule.required) {
|
|
1118
|
-
return callback();
|
|
1119
|
-
}
|
|
1120
|
-
rules.required(rule, value, source, errors, options);
|
|
1121
|
-
if (!isEmptyValue(value, "string")) {
|
|
1122
|
-
rules.pattern(rule, value, source, errors, options);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1125
|
-
callback(errors);
|
|
1126
|
-
};
|
|
1127
|
-
var date2 = function date3(rule, value, callback, source, options) {
|
|
1128
|
-
var errors = [];
|
|
1129
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1130
|
-
if (validate) {
|
|
1131
|
-
if (isEmptyValue(value, "date") && !rule.required) {
|
|
1132
|
-
return callback();
|
|
1133
|
-
}
|
|
1134
|
-
rules.required(rule, value, source, errors, options);
|
|
1135
|
-
if (!isEmptyValue(value, "date")) {
|
|
1136
|
-
var dateObject;
|
|
1137
|
-
if (value instanceof Date) {
|
|
1138
|
-
dateObject = value;
|
|
1139
|
-
} else {
|
|
1140
|
-
dateObject = new Date(value);
|
|
1141
|
-
}
|
|
1142
|
-
rules.type(rule, dateObject, source, errors, options);
|
|
1143
|
-
if (dateObject) {
|
|
1144
|
-
rules.range(rule, dateObject.getTime(), source, errors, options);
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
callback(errors);
|
|
1149
|
-
};
|
|
1150
|
-
var required2 = function required3(rule, value, callback, source, options) {
|
|
1151
|
-
var errors = [];
|
|
1152
|
-
var type4 = Array.isArray(value) ? "array" : typeof value;
|
|
1153
|
-
rules.required(rule, value, source, errors, options, type4);
|
|
1154
|
-
callback(errors);
|
|
1155
|
-
};
|
|
1156
|
-
var type2 = function type3(rule, value, callback, source, options) {
|
|
1157
|
-
var ruleType = rule.type;
|
|
1158
|
-
var errors = [];
|
|
1159
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1160
|
-
if (validate) {
|
|
1161
|
-
if (isEmptyValue(value, ruleType) && !rule.required) {
|
|
1162
|
-
return callback();
|
|
1163
|
-
}
|
|
1164
|
-
rules.required(rule, value, source, errors, options, ruleType);
|
|
1165
|
-
if (!isEmptyValue(value, ruleType)) {
|
|
1166
|
-
rules.type(rule, value, source, errors, options);
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
callback(errors);
|
|
1170
|
-
};
|
|
1171
|
-
var any = function any2(rule, value, callback, source, options) {
|
|
1172
|
-
var errors = [];
|
|
1173
|
-
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
1174
|
-
if (validate) {
|
|
1175
|
-
if (isEmptyValue(value) && !rule.required) {
|
|
1176
|
-
return callback();
|
|
1177
|
-
}
|
|
1178
|
-
rules.required(rule, value, source, errors, options);
|
|
1179
|
-
}
|
|
1180
|
-
callback(errors);
|
|
1181
|
-
};
|
|
1182
|
-
var validators = {
|
|
1183
|
-
string,
|
|
1184
|
-
method: method2,
|
|
1185
|
-
number: number2,
|
|
1186
|
-
"boolean": _boolean,
|
|
1187
|
-
regexp: regexp2,
|
|
1188
|
-
integer: integer2,
|
|
1189
|
-
"float": floatFn,
|
|
1190
|
-
array: array2,
|
|
1191
|
-
object: object2,
|
|
1192
|
-
"enum": enumerable2,
|
|
1193
|
-
pattern: pattern2,
|
|
1194
|
-
date: date2,
|
|
1195
|
-
url: type2,
|
|
1196
|
-
hex: type2,
|
|
1197
|
-
email: type2,
|
|
1198
|
-
required: required2,
|
|
1199
|
-
any
|
|
1200
|
-
};
|
|
1201
|
-
function newMessages() {
|
|
1202
|
-
return {
|
|
1203
|
-
"default": "Validation error on field %s",
|
|
1204
|
-
required: "%s is required",
|
|
1205
|
-
"enum": "%s must be one of %s",
|
|
1206
|
-
whitespace: "%s cannot be empty",
|
|
1207
|
-
date: {
|
|
1208
|
-
format: "%s date %s is invalid for format %s",
|
|
1209
|
-
parse: "%s date could not be parsed, %s is invalid ",
|
|
1210
|
-
invalid: "%s date %s is invalid"
|
|
1211
|
-
},
|
|
1212
|
-
types: {
|
|
1213
|
-
string: "%s is not a %s",
|
|
1214
|
-
method: "%s is not a %s (function)",
|
|
1215
|
-
array: "%s is not an %s",
|
|
1216
|
-
object: "%s is not an %s",
|
|
1217
|
-
number: "%s is not a %s",
|
|
1218
|
-
date: "%s is not a %s",
|
|
1219
|
-
"boolean": "%s is not a %s",
|
|
1220
|
-
integer: "%s is not an %s",
|
|
1221
|
-
"float": "%s is not a %s",
|
|
1222
|
-
regexp: "%s is not a valid %s",
|
|
1223
|
-
email: "%s is not a valid %s",
|
|
1224
|
-
url: "%s is not a valid %s",
|
|
1225
|
-
hex: "%s is not a valid %s"
|
|
1226
|
-
},
|
|
1227
|
-
string: {
|
|
1228
|
-
len: "%s must be exactly %s characters",
|
|
1229
|
-
min: "%s must be at least %s characters",
|
|
1230
|
-
max: "%s cannot be longer than %s characters",
|
|
1231
|
-
range: "%s must be between %s and %s characters"
|
|
1232
|
-
},
|
|
1233
|
-
number: {
|
|
1234
|
-
len: "%s must equal %s",
|
|
1235
|
-
min: "%s cannot be less than %s",
|
|
1236
|
-
max: "%s cannot be greater than %s",
|
|
1237
|
-
range: "%s must be between %s and %s"
|
|
1238
|
-
},
|
|
1239
|
-
array: {
|
|
1240
|
-
len: "%s must be exactly %s in length",
|
|
1241
|
-
min: "%s cannot be less than %s in length",
|
|
1242
|
-
max: "%s cannot be greater than %s in length",
|
|
1243
|
-
range: "%s must be between %s and %s in length"
|
|
1244
|
-
},
|
|
1245
|
-
pattern: {
|
|
1246
|
-
mismatch: "%s value %s does not match pattern %s"
|
|
1247
|
-
},
|
|
1248
|
-
clone: function clone() {
|
|
1249
|
-
var cloned = JSON.parse(JSON.stringify(this));
|
|
1250
|
-
cloned.clone = this.clone;
|
|
1251
|
-
return cloned;
|
|
1252
|
-
}
|
|
1253
|
-
};
|
|
1254
|
-
}
|
|
1255
|
-
var messages = newMessages();
|
|
1256
|
-
var Schema = /* @__PURE__ */ function() {
|
|
1257
|
-
function Schema2(descriptor) {
|
|
1258
|
-
this.rules = null;
|
|
1259
|
-
this._messages = messages;
|
|
1260
|
-
this.define(descriptor);
|
|
1261
|
-
}
|
|
1262
|
-
var _proto = Schema2.prototype;
|
|
1263
|
-
_proto.define = function define(rules2) {
|
|
1264
|
-
var _this = this;
|
|
1265
|
-
if (!rules2) {
|
|
1266
|
-
throw new Error("Cannot configure a schema with no rules");
|
|
1267
|
-
}
|
|
1268
|
-
if (typeof rules2 !== "object" || Array.isArray(rules2)) {
|
|
1269
|
-
throw new Error("Rules must be an object");
|
|
1270
|
-
}
|
|
1271
|
-
this.rules = {};
|
|
1272
|
-
Object.keys(rules2).forEach(function(name) {
|
|
1273
|
-
var item = rules2[name];
|
|
1274
|
-
_this.rules[name] = Array.isArray(item) ? item : [item];
|
|
1275
|
-
});
|
|
1276
|
-
};
|
|
1277
|
-
_proto.messages = function messages2(_messages) {
|
|
1278
|
-
if (_messages) {
|
|
1279
|
-
this._messages = deepMerge(newMessages(), _messages);
|
|
1280
|
-
}
|
|
1281
|
-
return this._messages;
|
|
1282
|
-
};
|
|
1283
|
-
_proto.validate = function validate(source_, o, oc) {
|
|
1284
|
-
var _this2 = this;
|
|
1285
|
-
if (o === void 0) {
|
|
1286
|
-
o = {};
|
|
1287
|
-
}
|
|
1288
|
-
if (oc === void 0) {
|
|
1289
|
-
oc = function oc2() {
|
|
1290
|
-
};
|
|
1291
|
-
}
|
|
1292
|
-
var source = source_;
|
|
1293
|
-
var options = o;
|
|
1294
|
-
var callback = oc;
|
|
1295
|
-
if (typeof options === "function") {
|
|
1296
|
-
callback = options;
|
|
1297
|
-
options = {};
|
|
1298
|
-
}
|
|
1299
|
-
if (!this.rules || Object.keys(this.rules).length === 0) {
|
|
1300
|
-
if (callback) {
|
|
1301
|
-
callback(null, source);
|
|
1302
|
-
}
|
|
1303
|
-
return Promise.resolve(source);
|
|
1304
|
-
}
|
|
1305
|
-
function complete(results) {
|
|
1306
|
-
var errors = [];
|
|
1307
|
-
var fields = {};
|
|
1308
|
-
function add(e) {
|
|
1309
|
-
if (Array.isArray(e)) {
|
|
1310
|
-
var _errors;
|
|
1311
|
-
errors = (_errors = errors).concat.apply(_errors, e);
|
|
1312
|
-
} else {
|
|
1313
|
-
errors.push(e);
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
for (var i = 0; i < results.length; i++) {
|
|
1317
|
-
add(results[i]);
|
|
1318
|
-
}
|
|
1319
|
-
if (!errors.length) {
|
|
1320
|
-
callback(null, source);
|
|
1321
|
-
} else {
|
|
1322
|
-
fields = convertFieldsError(errors);
|
|
1323
|
-
callback(errors, fields);
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
if (options.messages) {
|
|
1327
|
-
var messages$1 = this.messages();
|
|
1328
|
-
if (messages$1 === messages) {
|
|
1329
|
-
messages$1 = newMessages();
|
|
1330
|
-
}
|
|
1331
|
-
deepMerge(messages$1, options.messages);
|
|
1332
|
-
options.messages = messages$1;
|
|
1333
|
-
} else {
|
|
1334
|
-
options.messages = this.messages();
|
|
1335
|
-
}
|
|
1336
|
-
var series = {};
|
|
1337
|
-
var keys = options.keys || Object.keys(this.rules);
|
|
1338
|
-
keys.forEach(function(z) {
|
|
1339
|
-
var arr = _this2.rules[z];
|
|
1340
|
-
var value = source[z];
|
|
1341
|
-
arr.forEach(function(r) {
|
|
1342
|
-
var rule = r;
|
|
1343
|
-
if (typeof rule.transform === "function") {
|
|
1344
|
-
if (source === source_) {
|
|
1345
|
-
source = _extends({}, source);
|
|
1346
|
-
}
|
|
1347
|
-
value = source[z] = rule.transform(value);
|
|
1348
|
-
}
|
|
1349
|
-
if (typeof rule === "function") {
|
|
1350
|
-
rule = {
|
|
1351
|
-
validator: rule
|
|
1352
|
-
};
|
|
1353
|
-
} else {
|
|
1354
|
-
rule = _extends({}, rule);
|
|
1355
|
-
}
|
|
1356
|
-
rule.validator = _this2.getValidationMethod(rule);
|
|
1357
|
-
if (!rule.validator) {
|
|
1358
|
-
return;
|
|
1359
|
-
}
|
|
1360
|
-
rule.field = z;
|
|
1361
|
-
rule.fullField = rule.fullField || z;
|
|
1362
|
-
rule.type = _this2.getType(rule);
|
|
1363
|
-
series[z] = series[z] || [];
|
|
1364
|
-
series[z].push({
|
|
1365
|
-
rule,
|
|
1366
|
-
value,
|
|
1367
|
-
source,
|
|
1368
|
-
field: z
|
|
1369
|
-
});
|
|
1370
|
-
});
|
|
1371
|
-
});
|
|
1372
|
-
var errorFields = {};
|
|
1373
|
-
return asyncMap(series, options, function(data, doIt) {
|
|
1374
|
-
var rule = data.rule;
|
|
1375
|
-
var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
|
|
1376
|
-
deep = deep && (rule.required || !rule.required && data.value);
|
|
1377
|
-
rule.field = data.field;
|
|
1378
|
-
function addFullField(key, schema) {
|
|
1379
|
-
return _extends({}, schema, {
|
|
1380
|
-
fullField: rule.fullField + "." + key,
|
|
1381
|
-
fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
|
|
1382
|
-
});
|
|
1383
|
-
}
|
|
1384
|
-
function cb(e) {
|
|
1385
|
-
if (e === void 0) {
|
|
1386
|
-
e = [];
|
|
1387
|
-
}
|
|
1388
|
-
var errorList = Array.isArray(e) ? e : [e];
|
|
1389
|
-
if (!options.suppressWarning && errorList.length) {
|
|
1390
|
-
Schema2.warning("async-validator:", errorList);
|
|
1391
|
-
}
|
|
1392
|
-
if (errorList.length && rule.message !== void 0) {
|
|
1393
|
-
errorList = [].concat(rule.message);
|
|
1394
|
-
}
|
|
1395
|
-
var filledErrors = errorList.map(complementError(rule, source));
|
|
1396
|
-
if (options.first && filledErrors.length) {
|
|
1397
|
-
errorFields[rule.field] = 1;
|
|
1398
|
-
return doIt(filledErrors);
|
|
1399
|
-
}
|
|
1400
|
-
if (!deep) {
|
|
1401
|
-
doIt(filledErrors);
|
|
1402
|
-
} else {
|
|
1403
|
-
if (rule.required && !data.value) {
|
|
1404
|
-
if (rule.message !== void 0) {
|
|
1405
|
-
filledErrors = [].concat(rule.message).map(complementError(rule, source));
|
|
1406
|
-
} else if (options.error) {
|
|
1407
|
-
filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
|
|
1408
|
-
}
|
|
1409
|
-
return doIt(filledErrors);
|
|
1410
|
-
}
|
|
1411
|
-
var fieldsSchema = {};
|
|
1412
|
-
if (rule.defaultField) {
|
|
1413
|
-
Object.keys(data.value).map(function(key) {
|
|
1414
|
-
fieldsSchema[key] = rule.defaultField;
|
|
1415
|
-
});
|
|
1416
|
-
}
|
|
1417
|
-
fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
|
|
1418
|
-
var paredFieldsSchema = {};
|
|
1419
|
-
Object.keys(fieldsSchema).forEach(function(field) {
|
|
1420
|
-
var fieldSchema = fieldsSchema[field];
|
|
1421
|
-
var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
|
|
1422
|
-
paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
|
|
1423
|
-
});
|
|
1424
|
-
var schema = new Schema2(paredFieldsSchema);
|
|
1425
|
-
schema.messages(options.messages);
|
|
1426
|
-
if (data.rule.options) {
|
|
1427
|
-
data.rule.options.messages = options.messages;
|
|
1428
|
-
data.rule.options.error = options.error;
|
|
1429
|
-
}
|
|
1430
|
-
schema.validate(data.value, data.rule.options || options, function(errs) {
|
|
1431
|
-
var finalErrors = [];
|
|
1432
|
-
if (filledErrors && filledErrors.length) {
|
|
1433
|
-
finalErrors.push.apply(finalErrors, filledErrors);
|
|
1434
|
-
}
|
|
1435
|
-
if (errs && errs.length) {
|
|
1436
|
-
finalErrors.push.apply(finalErrors, errs);
|
|
1437
|
-
}
|
|
1438
|
-
doIt(finalErrors.length ? finalErrors : null);
|
|
1439
|
-
});
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
var res;
|
|
1443
|
-
if (rule.asyncValidator) {
|
|
1444
|
-
res = rule.asyncValidator(rule, data.value, cb, data.source, options);
|
|
1445
|
-
} else if (rule.validator) {
|
|
1446
|
-
res = rule.validator(rule, data.value, cb, data.source, options);
|
|
1447
|
-
if (res === true) {
|
|
1448
|
-
cb();
|
|
1449
|
-
} else if (res === false) {
|
|
1450
|
-
cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
|
|
1451
|
-
} else if (res instanceof Array) {
|
|
1452
|
-
cb(res);
|
|
1453
|
-
} else if (res instanceof Error) {
|
|
1454
|
-
cb(res.message);
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
if (res && res.then) {
|
|
1458
|
-
res.then(function() {
|
|
1459
|
-
return cb();
|
|
1460
|
-
}, function(e) {
|
|
1461
|
-
return cb(e);
|
|
1462
|
-
});
|
|
1463
|
-
}
|
|
1464
|
-
}, function(results) {
|
|
1465
|
-
complete(results);
|
|
1466
|
-
}, source);
|
|
1467
|
-
};
|
|
1468
|
-
_proto.getType = function getType(rule) {
|
|
1469
|
-
if (rule.type === void 0 && rule.pattern instanceof RegExp) {
|
|
1470
|
-
rule.type = "pattern";
|
|
1471
|
-
}
|
|
1472
|
-
if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
|
|
1473
|
-
throw new Error(format("Unknown rule type %s", rule.type));
|
|
1474
|
-
}
|
|
1475
|
-
return rule.type || "string";
|
|
1476
|
-
};
|
|
1477
|
-
_proto.getValidationMethod = function getValidationMethod(rule) {
|
|
1478
|
-
if (typeof rule.validator === "function") {
|
|
1479
|
-
return rule.validator;
|
|
1480
|
-
}
|
|
1481
|
-
var keys = Object.keys(rule);
|
|
1482
|
-
var messageIndex = keys.indexOf("message");
|
|
1483
|
-
if (messageIndex !== -1) {
|
|
1484
|
-
keys.splice(messageIndex, 1);
|
|
1485
|
-
}
|
|
1486
|
-
if (keys.length === 1 && keys[0] === "required") {
|
|
1487
|
-
return validators.required;
|
|
1488
|
-
}
|
|
1489
|
-
return validators[this.getType(rule)] || void 0;
|
|
1490
|
-
};
|
|
1491
|
-
return Schema2;
|
|
1492
|
-
}();
|
|
1493
|
-
Schema.register = function register(type4, validator) {
|
|
1494
|
-
if (typeof validator !== "function") {
|
|
1495
|
-
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
1496
|
-
}
|
|
1497
|
-
validators[type4] = validator;
|
|
1498
|
-
};
|
|
1499
|
-
Schema.warning = warning;
|
|
1500
|
-
Schema.messages = messages;
|
|
1501
|
-
Schema.validators = validators;
|
|
1502
|
-
var formItem = "";
|
|
1503
|
-
var FormItem = defineComponent({
|
|
1504
|
-
name: "DFormItem",
|
|
1505
|
-
props: formItemProps,
|
|
1506
|
-
setup(props, ctx2) {
|
|
1507
|
-
const formItemMitt = mitt();
|
|
1508
|
-
const dForm = reactive(inject(formInjectionKey, {}));
|
|
1509
|
-
const formData = reactive(dForm.formData);
|
|
1510
|
-
const columnsClass = ref(dForm.columnsClass);
|
|
1511
|
-
const initFormItemData = formData[props.prop];
|
|
1512
|
-
const labelData = reactive(dForm.labelData);
|
|
1513
|
-
const rules2 = reactive(dForm.rules);
|
|
1514
|
-
const resetField = () => {
|
|
1515
|
-
if (Array.isArray(initFormItemData)) {
|
|
1516
|
-
formData[props.prop] = [...initFormItemData];
|
|
1517
|
-
} else {
|
|
1518
|
-
formData[props.prop] = initFormItemData;
|
|
1519
|
-
}
|
|
1520
|
-
};
|
|
1521
|
-
const formItem2 = reactive({
|
|
1522
|
-
dHasFeedback: props.dHasFeedback,
|
|
1523
|
-
prop: props.prop,
|
|
1524
|
-
formItemMitt,
|
|
1525
|
-
resetField
|
|
1526
|
-
});
|
|
1527
|
-
provide(formItemInjectionKey, formItem2);
|
|
1528
|
-
const isHorizontal = labelData.layout === "horizontal";
|
|
1529
|
-
const isVertical = labelData.layout === "vertical";
|
|
1530
|
-
const isColumns = labelData.layout === "columns";
|
|
1531
|
-
const showMessage = ref(false);
|
|
1532
|
-
const tipMessage = ref("");
|
|
1533
|
-
const validate = (trigger) => {
|
|
1534
|
-
const ruleKey = props.prop;
|
|
1535
|
-
const ruleItem = rules2[ruleKey];
|
|
1536
|
-
const descriptor = {};
|
|
1537
|
-
descriptor[ruleKey] = ruleItem;
|
|
1538
|
-
const validator = new Schema(descriptor);
|
|
1539
|
-
validator.validate({
|
|
1540
|
-
[ruleKey]: formData[ruleKey]
|
|
1541
|
-
}).then(() => {
|
|
1542
|
-
showMessage.value = false;
|
|
1543
|
-
tipMessage.value = "";
|
|
1544
|
-
}).catch(({
|
|
1545
|
-
errors
|
|
1546
|
-
}) => {
|
|
1547
|
-
showMessage.value = true;
|
|
1548
|
-
tipMessage.value = errors[0].message;
|
|
1549
|
-
});
|
|
1550
|
-
};
|
|
1551
|
-
const validateEvents = [];
|
|
1552
|
-
const addValidateEvents = () => {
|
|
1553
|
-
if (rules2 && rules2[props.prop]) {
|
|
1554
|
-
const ruleItem = rules2[props.prop];
|
|
1555
|
-
let eventName = ruleItem["trigger"];
|
|
1556
|
-
if (Array.isArray(ruleItem)) {
|
|
1557
|
-
ruleItem.forEach((item) => {
|
|
1558
|
-
eventName = item["trigger"];
|
|
1559
|
-
const cb = () => validate();
|
|
1560
|
-
validateEvents.push({
|
|
1561
|
-
eventName: cb
|
|
1562
|
-
});
|
|
1563
|
-
formItem2.formItemMitt.on(dFormItemEvents[eventName], cb);
|
|
1564
|
-
});
|
|
1565
|
-
} else {
|
|
1566
|
-
const cb = () => validate();
|
|
1567
|
-
validateEvents.push({
|
|
1568
|
-
eventName: cb
|
|
1569
|
-
});
|
|
1570
|
-
ruleItem && formItem2.formItemMitt.on(dFormItemEvents[eventName], cb);
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
};
|
|
1574
|
-
const removeValidateEvents = () => {
|
|
1575
|
-
if (rules2 && rules2[props.prop] && validateEvents.length > 0) {
|
|
1576
|
-
validateEvents.forEach((item) => {
|
|
1577
|
-
formItem2.formItemMitt.off(item.eventName, item.cb);
|
|
1578
|
-
});
|
|
1579
|
-
}
|
|
1580
|
-
};
|
|
1581
|
-
onMounted(() => {
|
|
1582
|
-
dForm.formMitt.emit(dFormEvents.addField, formItem2);
|
|
1583
|
-
addValidateEvents();
|
|
1584
|
-
});
|
|
1585
|
-
onBeforeUnmount(() => {
|
|
1586
|
-
dForm.formMitt.emit(dFormEvents.removeField, formItem2);
|
|
1587
|
-
removeValidateEvents();
|
|
1588
|
-
});
|
|
1589
|
-
return () => {
|
|
1590
|
-
var _a, _b;
|
|
1591
|
-
return createVNode("div", {
|
|
1592
|
-
"class": `form-item${isHorizontal ? "" : isVertical ? " form-item-vertical" : " form-item-columns"}${isColumns ? " column-item " + columnsClass.value : ""}`
|
|
1593
|
-
}, [(_b = (_a = ctx2.slots).default) == null ? void 0 : _b.call(_a), createVNode("div", {
|
|
1594
|
-
"class": `d-validate-tip${isHorizontal ? " d-validate-tip-horizontal" : ""}`
|
|
1595
|
-
}, [showMessage.value && tipMessage.value])]);
|
|
1596
|
-
};
|
|
1597
|
-
}
|
|
1598
|
-
});
|
|
1599
574
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1600
575
|
var lodash = { exports: {} };
|
|
1601
576
|
/**
|
|
@@ -2026,9 +1001,9 @@ var lodash = { exports: {} };
|
|
|
2026
1001
|
return result;
|
|
2027
1002
|
}
|
|
2028
1003
|
function arrayPush(array4, values) {
|
|
2029
|
-
var index2 = -1, length = values.length,
|
|
1004
|
+
var index2 = -1, length = values.length, offset2 = array4.length;
|
|
2030
1005
|
while (++index2 < length) {
|
|
2031
|
-
array4[
|
|
1006
|
+
array4[offset2 + index2] = values[index2];
|
|
2032
1007
|
}
|
|
2033
1008
|
return array4;
|
|
2034
1009
|
}
|
|
@@ -2776,7 +1751,7 @@ var lodash = { exports: {} };
|
|
|
2776
1751
|
if (typeof func != "function") {
|
|
2777
1752
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
2778
1753
|
}
|
|
2779
|
-
return
|
|
1754
|
+
return setTimeout(function() {
|
|
2780
1755
|
func.apply(undefined$1, args);
|
|
2781
1756
|
}, wait);
|
|
2782
1757
|
}
|
|
@@ -3556,7 +2531,7 @@ var lodash = { exports: {} };
|
|
|
3556
2531
|
end = end === undefined$1 ? length : end;
|
|
3557
2532
|
return !start && end >= length ? array4 : baseSlice(array4, start, end);
|
|
3558
2533
|
}
|
|
3559
|
-
var
|
|
2534
|
+
var clearTimeout = ctxClearTimeout || function(id) {
|
|
3560
2535
|
return root.clearTimeout(id);
|
|
3561
2536
|
};
|
|
3562
2537
|
function cloneBuffer(buffer, isDeep) {
|
|
@@ -3635,13 +2610,13 @@ var lodash = { exports: {} };
|
|
|
3635
2610
|
while (++argsIndex < rangeLength) {
|
|
3636
2611
|
result2[argsIndex] = args[argsIndex];
|
|
3637
2612
|
}
|
|
3638
|
-
var
|
|
2613
|
+
var offset2 = argsIndex;
|
|
3639
2614
|
while (++rightIndex < rightLength) {
|
|
3640
|
-
result2[
|
|
2615
|
+
result2[offset2 + rightIndex] = partials[rightIndex];
|
|
3641
2616
|
}
|
|
3642
2617
|
while (++holdersIndex < holdersLength) {
|
|
3643
2618
|
if (isUncurried || argsIndex < argsLength) {
|
|
3644
|
-
result2[
|
|
2619
|
+
result2[offset2 + holders[holdersIndex]] = args[argsIndex++];
|
|
3645
2620
|
}
|
|
3646
2621
|
}
|
|
3647
2622
|
return result2;
|
|
@@ -4585,7 +3560,7 @@ var lodash = { exports: {} };
|
|
|
4585
3560
|
return object4[key];
|
|
4586
3561
|
}
|
|
4587
3562
|
var setData = shortOut(baseSetData);
|
|
4588
|
-
var
|
|
3563
|
+
var setTimeout = ctxSetTimeout || function(func, wait) {
|
|
4589
3564
|
return root.setTimeout(func, wait);
|
|
4590
3565
|
};
|
|
4591
3566
|
var setToString = shortOut(baseSetToString);
|
|
@@ -5356,7 +4331,7 @@ var lodash = { exports: {} };
|
|
|
5356
4331
|
result2.placeholder = curryRight.placeholder;
|
|
5357
4332
|
return result2;
|
|
5358
4333
|
}
|
|
5359
|
-
function
|
|
4334
|
+
function debounce(func, wait, options) {
|
|
5360
4335
|
var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
5361
4336
|
if (typeof func != "function") {
|
|
5362
4337
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
|
@@ -5377,7 +4352,7 @@ var lodash = { exports: {} };
|
|
|
5377
4352
|
}
|
|
5378
4353
|
function leadingEdge(time) {
|
|
5379
4354
|
lastInvokeTime = time;
|
|
5380
|
-
timerId =
|
|
4355
|
+
timerId = setTimeout(timerExpired, wait);
|
|
5381
4356
|
return leading ? invokeFunc(time) : result2;
|
|
5382
4357
|
}
|
|
5383
4358
|
function remainingWait(time) {
|
|
@@ -5393,7 +4368,7 @@ var lodash = { exports: {} };
|
|
|
5393
4368
|
if (shouldInvoke(time)) {
|
|
5394
4369
|
return trailingEdge(time);
|
|
5395
4370
|
}
|
|
5396
|
-
timerId =
|
|
4371
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
5397
4372
|
}
|
|
5398
4373
|
function trailingEdge(time) {
|
|
5399
4374
|
timerId = undefined$1;
|
|
@@ -5405,7 +4380,7 @@ var lodash = { exports: {} };
|
|
|
5405
4380
|
}
|
|
5406
4381
|
function cancel() {
|
|
5407
4382
|
if (timerId !== undefined$1) {
|
|
5408
|
-
|
|
4383
|
+
clearTimeout(timerId);
|
|
5409
4384
|
}
|
|
5410
4385
|
lastInvokeTime = 0;
|
|
5411
4386
|
lastArgs = lastCallTime = lastThis = timerId = undefined$1;
|
|
@@ -5423,13 +4398,13 @@ var lodash = { exports: {} };
|
|
|
5423
4398
|
return leadingEdge(lastCallTime);
|
|
5424
4399
|
}
|
|
5425
4400
|
if (maxing) {
|
|
5426
|
-
|
|
5427
|
-
timerId =
|
|
4401
|
+
clearTimeout(timerId);
|
|
4402
|
+
timerId = setTimeout(timerExpired, wait);
|
|
5428
4403
|
return invokeFunc(lastCallTime);
|
|
5429
4404
|
}
|
|
5430
4405
|
}
|
|
5431
4406
|
if (timerId === undefined$1) {
|
|
5432
|
-
timerId =
|
|
4407
|
+
timerId = setTimeout(timerExpired, wait);
|
|
5433
4408
|
}
|
|
5434
4409
|
return result2;
|
|
5435
4410
|
}
|
|
@@ -5536,7 +4511,7 @@ var lodash = { exports: {} };
|
|
|
5536
4511
|
leading = "leading" in options ? !!options.leading : leading;
|
|
5537
4512
|
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
5538
4513
|
}
|
|
5539
|
-
return
|
|
4514
|
+
return debounce(func, wait, {
|
|
5540
4515
|
"leading": leading,
|
|
5541
4516
|
"maxWait": wait,
|
|
5542
4517
|
"trailing": trailing
|
|
@@ -6188,9 +5163,9 @@ var lodash = { exports: {} };
|
|
|
6188
5163
|
var isEscaping, isEvaluating, index2 = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
|
|
6189
5164
|
var reDelimiters = RegExp2((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
|
|
6190
5165
|
var sourceURL = "//# sourceURL=" + (hasOwnProperty.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
|
|
6191
|
-
string3.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue,
|
|
5166
|
+
string3.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) {
|
|
6192
5167
|
interpolateValue || (interpolateValue = esTemplateValue);
|
|
6193
|
-
source += string3.slice(index2,
|
|
5168
|
+
source += string3.slice(index2, offset2).replace(reUnescapedString, escapeStringChar);
|
|
6194
5169
|
if (escapeValue) {
|
|
6195
5170
|
isEscaping = true;
|
|
6196
5171
|
source += "' +\n__e(" + escapeValue + ") +\n'";
|
|
@@ -6202,7 +5177,7 @@ var lodash = { exports: {} };
|
|
|
6202
5177
|
if (interpolateValue) {
|
|
6203
5178
|
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
|
|
6204
5179
|
}
|
|
6205
|
-
index2 =
|
|
5180
|
+
index2 = offset2 + match.length;
|
|
6206
5181
|
return match;
|
|
6207
5182
|
});
|
|
6208
5183
|
source += "';\n";
|
|
@@ -6547,7 +5522,7 @@ var lodash = { exports: {} };
|
|
|
6547
5522
|
lodash2.create = create;
|
|
6548
5523
|
lodash2.curry = curry;
|
|
6549
5524
|
lodash2.curryRight = curryRight;
|
|
6550
|
-
lodash2.debounce =
|
|
5525
|
+
lodash2.debounce = debounce;
|
|
6551
5526
|
lodash2.defaults = defaults;
|
|
6552
5527
|
lodash2.defaultsDeep = defaultsDeep;
|
|
6553
5528
|
lodash2.defer = defer;
|
|
@@ -6837,177 +5812,1603 @@ var lodash = { exports: {} };
|
|
|
6837
5812
|
source[methodName] = func;
|
|
6838
5813
|
}
|
|
6839
5814
|
});
|
|
6840
|
-
return source;
|
|
6841
|
-
}(), { "chain": false });
|
|
6842
|
-
lodash2.VERSION = VERSION;
|
|
6843
|
-
arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
|
|
6844
|
-
lodash2[methodName].placeholder = lodash2;
|
|
5815
|
+
return source;
|
|
5816
|
+
}(), { "chain": false });
|
|
5817
|
+
lodash2.VERSION = VERSION;
|
|
5818
|
+
arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
|
|
5819
|
+
lodash2[methodName].placeholder = lodash2;
|
|
5820
|
+
});
|
|
5821
|
+
arrayEach(["drop", "take"], function(methodName, index2) {
|
|
5822
|
+
LazyWrapper.prototype[methodName] = function(n) {
|
|
5823
|
+
n = n === undefined$1 ? 1 : nativeMax(toInteger(n), 0);
|
|
5824
|
+
var result2 = this.__filtered__ && !index2 ? new LazyWrapper(this) : this.clone();
|
|
5825
|
+
if (result2.__filtered__) {
|
|
5826
|
+
result2.__takeCount__ = nativeMin(n, result2.__takeCount__);
|
|
5827
|
+
} else {
|
|
5828
|
+
result2.__views__.push({
|
|
5829
|
+
"size": nativeMin(n, MAX_ARRAY_LENGTH),
|
|
5830
|
+
"type": methodName + (result2.__dir__ < 0 ? "Right" : "")
|
|
5831
|
+
});
|
|
5832
|
+
}
|
|
5833
|
+
return result2;
|
|
5834
|
+
};
|
|
5835
|
+
LazyWrapper.prototype[methodName + "Right"] = function(n) {
|
|
5836
|
+
return this.reverse()[methodName](n).reverse();
|
|
5837
|
+
};
|
|
5838
|
+
});
|
|
5839
|
+
arrayEach(["filter", "map", "takeWhile"], function(methodName, index2) {
|
|
5840
|
+
var type4 = index2 + 1, isFilter = type4 == LAZY_FILTER_FLAG || type4 == LAZY_WHILE_FLAG;
|
|
5841
|
+
LazyWrapper.prototype[methodName] = function(iteratee2) {
|
|
5842
|
+
var result2 = this.clone();
|
|
5843
|
+
result2.__iteratees__.push({
|
|
5844
|
+
"iteratee": getIteratee(iteratee2, 3),
|
|
5845
|
+
"type": type4
|
|
5846
|
+
});
|
|
5847
|
+
result2.__filtered__ = result2.__filtered__ || isFilter;
|
|
5848
|
+
return result2;
|
|
5849
|
+
};
|
|
5850
|
+
});
|
|
5851
|
+
arrayEach(["head", "last"], function(methodName, index2) {
|
|
5852
|
+
var takeName = "take" + (index2 ? "Right" : "");
|
|
5853
|
+
LazyWrapper.prototype[methodName] = function() {
|
|
5854
|
+
return this[takeName](1).value()[0];
|
|
5855
|
+
};
|
|
5856
|
+
});
|
|
5857
|
+
arrayEach(["initial", "tail"], function(methodName, index2) {
|
|
5858
|
+
var dropName = "drop" + (index2 ? "" : "Right");
|
|
5859
|
+
LazyWrapper.prototype[methodName] = function() {
|
|
5860
|
+
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
|
|
5861
|
+
};
|
|
5862
|
+
});
|
|
5863
|
+
LazyWrapper.prototype.compact = function() {
|
|
5864
|
+
return this.filter(identity);
|
|
5865
|
+
};
|
|
5866
|
+
LazyWrapper.prototype.find = function(predicate) {
|
|
5867
|
+
return this.filter(predicate).head();
|
|
5868
|
+
};
|
|
5869
|
+
LazyWrapper.prototype.findLast = function(predicate) {
|
|
5870
|
+
return this.reverse().find(predicate);
|
|
5871
|
+
};
|
|
5872
|
+
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
|
|
5873
|
+
if (typeof path == "function") {
|
|
5874
|
+
return new LazyWrapper(this);
|
|
5875
|
+
}
|
|
5876
|
+
return this.map(function(value) {
|
|
5877
|
+
return baseInvoke(value, path, args);
|
|
5878
|
+
});
|
|
5879
|
+
});
|
|
5880
|
+
LazyWrapper.prototype.reject = function(predicate) {
|
|
5881
|
+
return this.filter(negate(getIteratee(predicate)));
|
|
5882
|
+
};
|
|
5883
|
+
LazyWrapper.prototype.slice = function(start, end) {
|
|
5884
|
+
start = toInteger(start);
|
|
5885
|
+
var result2 = this;
|
|
5886
|
+
if (result2.__filtered__ && (start > 0 || end < 0)) {
|
|
5887
|
+
return new LazyWrapper(result2);
|
|
5888
|
+
}
|
|
5889
|
+
if (start < 0) {
|
|
5890
|
+
result2 = result2.takeRight(-start);
|
|
5891
|
+
} else if (start) {
|
|
5892
|
+
result2 = result2.drop(start);
|
|
5893
|
+
}
|
|
5894
|
+
if (end !== undefined$1) {
|
|
5895
|
+
end = toInteger(end);
|
|
5896
|
+
result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
|
|
5897
|
+
}
|
|
5898
|
+
return result2;
|
|
5899
|
+
};
|
|
5900
|
+
LazyWrapper.prototype.takeRightWhile = function(predicate) {
|
|
5901
|
+
return this.reverse().takeWhile(predicate).reverse();
|
|
5902
|
+
};
|
|
5903
|
+
LazyWrapper.prototype.toArray = function() {
|
|
5904
|
+
return this.take(MAX_ARRAY_LENGTH);
|
|
5905
|
+
};
|
|
5906
|
+
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|
5907
|
+
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash2[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
|
|
5908
|
+
if (!lodashFunc) {
|
|
5909
|
+
return;
|
|
5910
|
+
}
|
|
5911
|
+
lodash2.prototype[methodName] = function() {
|
|
5912
|
+
var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value);
|
|
5913
|
+
var interceptor = function(value2) {
|
|
5914
|
+
var result3 = lodashFunc.apply(lodash2, arrayPush([value2], args));
|
|
5915
|
+
return isTaker && chainAll ? result3[0] : result3;
|
|
5916
|
+
};
|
|
5917
|
+
if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
|
|
5918
|
+
isLazy = useLazy = false;
|
|
5919
|
+
}
|
|
5920
|
+
var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
|
|
5921
|
+
if (!retUnwrapped && useLazy) {
|
|
5922
|
+
value = onlyLazy ? value : new LazyWrapper(this);
|
|
5923
|
+
var result2 = func.apply(value, args);
|
|
5924
|
+
result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined$1 });
|
|
5925
|
+
return new LodashWrapper(result2, chainAll);
|
|
5926
|
+
}
|
|
5927
|
+
if (isUnwrapped && onlyLazy) {
|
|
5928
|
+
return func.apply(this, args);
|
|
5929
|
+
}
|
|
5930
|
+
result2 = this.thru(interceptor);
|
|
5931
|
+
return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
|
|
5932
|
+
};
|
|
5933
|
+
});
|
|
5934
|
+
arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
|
|
5935
|
+
var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
|
|
5936
|
+
lodash2.prototype[methodName] = function() {
|
|
5937
|
+
var args = arguments;
|
|
5938
|
+
if (retUnwrapped && !this.__chain__) {
|
|
5939
|
+
var value = this.value();
|
|
5940
|
+
return func.apply(isArray(value) ? value : [], args);
|
|
5941
|
+
}
|
|
5942
|
+
return this[chainName](function(value2) {
|
|
5943
|
+
return func.apply(isArray(value2) ? value2 : [], args);
|
|
5944
|
+
});
|
|
5945
|
+
};
|
|
5946
|
+
});
|
|
5947
|
+
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|
5948
|
+
var lodashFunc = lodash2[methodName];
|
|
5949
|
+
if (lodashFunc) {
|
|
5950
|
+
var key = lodashFunc.name + "";
|
|
5951
|
+
if (!hasOwnProperty.call(realNames, key)) {
|
|
5952
|
+
realNames[key] = [];
|
|
5953
|
+
}
|
|
5954
|
+
realNames[key].push({ "name": methodName, "func": lodashFunc });
|
|
5955
|
+
}
|
|
5956
|
+
});
|
|
5957
|
+
realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{
|
|
5958
|
+
"name": "wrapper",
|
|
5959
|
+
"func": undefined$1
|
|
5960
|
+
}];
|
|
5961
|
+
LazyWrapper.prototype.clone = lazyClone;
|
|
5962
|
+
LazyWrapper.prototype.reverse = lazyReverse;
|
|
5963
|
+
LazyWrapper.prototype.value = lazyValue;
|
|
5964
|
+
lodash2.prototype.at = wrapperAt;
|
|
5965
|
+
lodash2.prototype.chain = wrapperChain;
|
|
5966
|
+
lodash2.prototype.commit = wrapperCommit;
|
|
5967
|
+
lodash2.prototype.next = wrapperNext;
|
|
5968
|
+
lodash2.prototype.plant = wrapperPlant;
|
|
5969
|
+
lodash2.prototype.reverse = wrapperReverse;
|
|
5970
|
+
lodash2.prototype.toJSON = lodash2.prototype.valueOf = lodash2.prototype.value = wrapperValue;
|
|
5971
|
+
lodash2.prototype.first = lodash2.prototype.head;
|
|
5972
|
+
if (symIterator) {
|
|
5973
|
+
lodash2.prototype[symIterator] = wrapperToIterator;
|
|
5974
|
+
}
|
|
5975
|
+
return lodash2;
|
|
5976
|
+
};
|
|
5977
|
+
var _ = runInContext();
|
|
5978
|
+
if (freeModule) {
|
|
5979
|
+
(freeModule.exports = _)._ = _;
|
|
5980
|
+
freeExports._ = _;
|
|
5981
|
+
} else {
|
|
5982
|
+
root._ = _;
|
|
5983
|
+
}
|
|
5984
|
+
}).call(commonjsGlobal);
|
|
5985
|
+
})(lodash, lodash.exports);
|
|
5986
|
+
const TransformOriginMap = {
|
|
5987
|
+
top: "50% calc(100% + 8px)",
|
|
5988
|
+
bottom: "50% -8px",
|
|
5989
|
+
left: "calc(100% + 8px)",
|
|
5990
|
+
right: "-8px 50%"
|
|
5991
|
+
};
|
|
5992
|
+
function usePopover(props, visible, placement, origin, popoverRef) {
|
|
5993
|
+
const { trigger, isOpen } = toRefs(props);
|
|
5994
|
+
const overlayStyles = computed(() => ({
|
|
5995
|
+
zIndex: 1060,
|
|
5996
|
+
transformOrigin: TransformOriginMap[placement.value]
|
|
5997
|
+
}));
|
|
5998
|
+
const onDocumentClick = (e) => {
|
|
5999
|
+
var _a;
|
|
6000
|
+
if (!origin.value.contains(e.target) && !((_a = popoverRef.value.$el) == null ? void 0 : _a.contains(e.target))) {
|
|
6001
|
+
visible.value = false;
|
|
6002
|
+
}
|
|
6003
|
+
};
|
|
6004
|
+
watch(isOpen, (isOpenVal) => {
|
|
6005
|
+
visible.value = isOpenVal;
|
|
6006
|
+
});
|
|
6007
|
+
watch(visible, () => {
|
|
6008
|
+
if (visible.value && trigger.value !== "manually") {
|
|
6009
|
+
document.addEventListener("click", onDocumentClick);
|
|
6010
|
+
} else {
|
|
6011
|
+
document.removeEventListener("click", onDocumentClick);
|
|
6012
|
+
}
|
|
6013
|
+
});
|
|
6014
|
+
onUnmounted(() => {
|
|
6015
|
+
document.removeEventListener("click", onDocumentClick);
|
|
6016
|
+
});
|
|
6017
|
+
return { overlayStyles };
|
|
6018
|
+
}
|
|
6019
|
+
function usePopoverEvent(props, visible, origin) {
|
|
6020
|
+
const { trigger, position, mouseEnterDelay, mouseLeaveDelay } = toRefs(props);
|
|
6021
|
+
const isClick = computed(() => trigger.value === "click");
|
|
6022
|
+
const placement = ref(position.value[0].split("-")[0]);
|
|
6023
|
+
const isEnter = ref(false);
|
|
6024
|
+
const onClick = () => isClick.value && (visible.value = !visible.value);
|
|
6025
|
+
const enter = lodash.exports.debounce(() => {
|
|
6026
|
+
isEnter.value && (visible.value = true);
|
|
6027
|
+
}, mouseEnterDelay.value);
|
|
6028
|
+
const leave = lodash.exports.debounce(() => {
|
|
6029
|
+
!isEnter.value && (visible.value = false);
|
|
6030
|
+
}, mouseLeaveDelay.value);
|
|
6031
|
+
const onMouseenter = () => {
|
|
6032
|
+
if (!isClick.value) {
|
|
6033
|
+
isEnter.value = true;
|
|
6034
|
+
enter();
|
|
6035
|
+
}
|
|
6036
|
+
};
|
|
6037
|
+
const onMouseleave = () => {
|
|
6038
|
+
if (!isClick.value) {
|
|
6039
|
+
isEnter.value = false;
|
|
6040
|
+
leave();
|
|
6041
|
+
}
|
|
6042
|
+
};
|
|
6043
|
+
const handlePositionChange = (pos) => {
|
|
6044
|
+
placement.value = pos.split("-")[0];
|
|
6045
|
+
};
|
|
6046
|
+
onMounted(() => {
|
|
6047
|
+
if (trigger.value === "click") {
|
|
6048
|
+
origin.value.addEventListener("click", onClick);
|
|
6049
|
+
} else if (trigger.value === "hover") {
|
|
6050
|
+
origin.value.addEventListener("mouseenter", onMouseenter);
|
|
6051
|
+
origin.value.addEventListener("mouseleave", onMouseleave);
|
|
6052
|
+
}
|
|
6053
|
+
});
|
|
6054
|
+
return { placement, handlePositionChange };
|
|
6055
|
+
}
|
|
6056
|
+
function SuccessIcon() {
|
|
6057
|
+
return createVNode("svg", {
|
|
6058
|
+
"class": "devui-icon devui-icon-success",
|
|
6059
|
+
"viewBox": "0 0 16 16",
|
|
6060
|
+
"version": "1.1",
|
|
6061
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
6062
|
+
}, [createVNode("g", {
|
|
6063
|
+
"stroke": "none",
|
|
6064
|
+
"stroke-width": "1",
|
|
6065
|
+
"fill": "none",
|
|
6066
|
+
"fill-rule": "evenodd"
|
|
6067
|
+
}, [createVNode("circle", {
|
|
6068
|
+
"cx": "8",
|
|
6069
|
+
"cy": "8",
|
|
6070
|
+
"r": "7"
|
|
6071
|
+
}, null), createVNode("path", {
|
|
6072
|
+
"d": "M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z",
|
|
6073
|
+
"fill-rule": "nonzero"
|
|
6074
|
+
}, null), createVNode("polygon", {
|
|
6075
|
+
"stroke-width": "0.4",
|
|
6076
|
+
"fill-rule": "nonzero",
|
|
6077
|
+
"points": "8.16 10.48 7.32 11.32 6.48 10.48 6.48 10.48 3.6 7.68 4.44 6.84 7.28 9.68 11.52 5.44 12.36 6.28"
|
|
6078
|
+
}, null)])]);
|
|
6079
|
+
}
|
|
6080
|
+
function WarningIcon() {
|
|
6081
|
+
return createVNode("svg", {
|
|
6082
|
+
"class": "devui-icon devui-icon-warning",
|
|
6083
|
+
"viewBox": "0 0 16 16",
|
|
6084
|
+
"version": "1.1",
|
|
6085
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
6086
|
+
}, [createVNode("g", {
|
|
6087
|
+
"stroke": "none",
|
|
6088
|
+
"stroke-width": "1",
|
|
6089
|
+
"fill": "none",
|
|
6090
|
+
"fill-rule": "evenodd"
|
|
6091
|
+
}, [createVNode("polygon", {
|
|
6092
|
+
"points": "7.5 1.74501946 1.39184847 13.5954649 7.08947368 14.2207621 13.9973698 13.5954649 10.9383683 5.61273879 8.40084114 1.27624313"
|
|
6093
|
+
}, null), createVNode("path", {
|
|
6094
|
+
"d": "M8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 Z M8.87894737,11.2105263 L7.08947368,11.2105263 L7.08947368,13 L8.87894737,13 L8.87894737,11.2105263 Z M8.96842105,4.5 L7,4.5 L7.08947368,9.86842105 L8.87894737,9.86842105 L8.96842105,4.5 Z"
|
|
6095
|
+
}, null)])]);
|
|
6096
|
+
}
|
|
6097
|
+
function InfoIcon() {
|
|
6098
|
+
return createVNode("svg", {
|
|
6099
|
+
"class": "devui-icon devui-icon-info",
|
|
6100
|
+
"viewBox": "0 0 16 16",
|
|
6101
|
+
"version": "1.1",
|
|
6102
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
6103
|
+
}, [createVNode("g", {
|
|
6104
|
+
"stroke": "none",
|
|
6105
|
+
"stroke-width": "1",
|
|
6106
|
+
"fill": "none",
|
|
6107
|
+
"fill-rule": "evenodd"
|
|
6108
|
+
}, [createVNode("circle", {
|
|
6109
|
+
"cx": "8",
|
|
6110
|
+
"cy": "8",
|
|
6111
|
+
"r": "7"
|
|
6112
|
+
}, null), createVNode("g", {
|
|
6113
|
+
"stroke-width": "1"
|
|
6114
|
+
}, [createVNode("path", {
|
|
6115
|
+
"d": "M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,5 L7,5 L7,3 L9,3 L9,5 Z M9,12.6 L7,12.6 L7,6.6 L9,6.6 L9,12.6 Z"
|
|
6116
|
+
}, null)])])]);
|
|
6117
|
+
}
|
|
6118
|
+
function ErrorIcon() {
|
|
6119
|
+
return createVNode("svg", {
|
|
6120
|
+
"class": "devui-icon devui-icon-error",
|
|
6121
|
+
"width": "16px",
|
|
6122
|
+
"height": "16px",
|
|
6123
|
+
"viewBox": "0 0 16 16",
|
|
6124
|
+
"version": "1.1",
|
|
6125
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
6126
|
+
}, [createVNode("g", {
|
|
6127
|
+
"stroke": "none",
|
|
6128
|
+
"stroke-width": "1",
|
|
6129
|
+
"fill": "none",
|
|
6130
|
+
"fill-rule": "evenodd"
|
|
6131
|
+
}, [createVNode("circle", {
|
|
6132
|
+
"cx": "8",
|
|
6133
|
+
"cy": "8",
|
|
6134
|
+
"r": "7"
|
|
6135
|
+
}, null), createVNode("path", {
|
|
6136
|
+
"d": "M8,0 C3.6,0 0,3.6 0,8 C0,12.4 3.6,16 8,16 C12.4,16 16,12.4 16,8 C16,3.6 12.4,0 8,0 Z M9,12.6 L7,12.6 L7,10.6 L9,10.6 L9,12.6 Z M9,9.1 L7,9.1 L6.9,3.1 L9.1,3.1 L9,9.1 Z",
|
|
6137
|
+
"fill-rule": "nonzero"
|
|
6138
|
+
}, null)])]);
|
|
6139
|
+
}
|
|
6140
|
+
var popoverIcon = "";
|
|
6141
|
+
var PopoverIcon = defineComponent({
|
|
6142
|
+
props: {
|
|
6143
|
+
type: {
|
|
6144
|
+
type: String,
|
|
6145
|
+
default: "default"
|
|
6146
|
+
}
|
|
6147
|
+
},
|
|
6148
|
+
setup(props) {
|
|
6149
|
+
return () => props.type && props.type !== "default" && createVNode("span", {
|
|
6150
|
+
"class": "devui-popover-icon"
|
|
6151
|
+
}, [props.type === "success" && createVNode(SuccessIcon, null, null), props.type === "warning" && createVNode(WarningIcon, null, null), props.type === "info" && createVNode(InfoIcon, null, null), props.type === "error" && createVNode(ErrorIcon, null, null)]);
|
|
6152
|
+
}
|
|
6153
|
+
});
|
|
6154
|
+
var popover = "";
|
|
6155
|
+
var Popover = defineComponent({
|
|
6156
|
+
name: "DPopover",
|
|
6157
|
+
inheritAttrs: false,
|
|
6158
|
+
props: popoverProps,
|
|
6159
|
+
setup(props, {
|
|
6160
|
+
slots,
|
|
6161
|
+
attrs
|
|
6162
|
+
}) {
|
|
6163
|
+
const {
|
|
6164
|
+
content,
|
|
6165
|
+
popType,
|
|
6166
|
+
position,
|
|
6167
|
+
align,
|
|
6168
|
+
offset: offset2,
|
|
6169
|
+
showAnimation
|
|
6170
|
+
} = toRefs(props);
|
|
6171
|
+
const origin = ref();
|
|
6172
|
+
const popoverRef = ref();
|
|
6173
|
+
const visible = ref(false);
|
|
6174
|
+
const {
|
|
6175
|
+
placement,
|
|
6176
|
+
handlePositionChange
|
|
6177
|
+
} = usePopoverEvent(props, visible, origin);
|
|
6178
|
+
const {
|
|
6179
|
+
overlayStyles
|
|
6180
|
+
} = usePopover(props, visible, placement, origin, popoverRef);
|
|
6181
|
+
return () => {
|
|
6182
|
+
var _a;
|
|
6183
|
+
return createVNode(Fragment, null, [createVNode("div", {
|
|
6184
|
+
"ref": origin,
|
|
6185
|
+
"class": "devui-popover-reference"
|
|
6186
|
+
}, [(_a = slots.reference) == null ? void 0 : _a.call(slots)]), createVNode(Teleport, {
|
|
6187
|
+
"to": "body"
|
|
6188
|
+
}, {
|
|
6189
|
+
default: () => [createVNode(Transition, {
|
|
6190
|
+
"name": showAnimation.value ? `devui-popover-fade-${placement.value}` : ""
|
|
6191
|
+
}, {
|
|
6192
|
+
default: () => [createVNode(FlexibleOverlay, mergeProps({
|
|
6193
|
+
"modelValue": visible.value,
|
|
6194
|
+
"onUpdate:modelValue": ($event) => visible.value = $event,
|
|
6195
|
+
"ref": popoverRef,
|
|
6196
|
+
"origin": origin.value,
|
|
6197
|
+
"position": position.value,
|
|
6198
|
+
"align": align.value,
|
|
6199
|
+
"offset": offset2.value,
|
|
6200
|
+
"class": ["devui-popover-content", popType.value !== "default" ? "is-icon" : ""],
|
|
6201
|
+
"show-arrow": true,
|
|
6202
|
+
"is-arrow-center": false,
|
|
6203
|
+
"style": overlayStyles.value
|
|
6204
|
+
}, attrs, {
|
|
6205
|
+
"onPositionChange": handlePositionChange
|
|
6206
|
+
}), {
|
|
6207
|
+
default: () => {
|
|
6208
|
+
var _a2;
|
|
6209
|
+
return [createVNode(PopoverIcon, {
|
|
6210
|
+
"type": popType.value
|
|
6211
|
+
}, null), ((_a2 = slots.content) == null ? void 0 : _a2.call(slots)) || createVNode("span", null, [content.value])];
|
|
6212
|
+
}
|
|
6213
|
+
})]
|
|
6214
|
+
})]
|
|
6215
|
+
})]);
|
|
6216
|
+
};
|
|
6217
|
+
}
|
|
6218
|
+
});
|
|
6219
|
+
var formLabel = "";
|
|
6220
|
+
var FormLabel = defineComponent({
|
|
6221
|
+
name: "DFormLabel",
|
|
6222
|
+
props: formLabelProps,
|
|
6223
|
+
setup(props, ctx2) {
|
|
6224
|
+
const dForm = reactive(inject(formInjectionKey, {}));
|
|
6225
|
+
const labelData = reactive(dForm.labelData);
|
|
6226
|
+
const isHorizontal = computed(() => labelData.layout === "horizontal").value;
|
|
6227
|
+
const isLg = computed(() => labelData.labelSize === "lg").value;
|
|
6228
|
+
const isSm = computed(() => labelData.labelSize === "sm").value;
|
|
6229
|
+
const isCenter = computed(() => labelData.labelAlign === "center").value;
|
|
6230
|
+
const isEnd = computed(() => labelData.labelAlign === "end").value;
|
|
6231
|
+
const wrapperCls = `devui-form-label${isHorizontal ? isSm ? " devui-form-label_sm" : isLg ? " devui-form-label_lg" : " devui-form-label_sd" : ""}${isCenter ? " devui-form-label_center" : isEnd ? " devui-form-label_end" : ""}`;
|
|
6232
|
+
const className = `${props.required ? " devui-required" : ""}`;
|
|
6233
|
+
const style2 = {
|
|
6234
|
+
display: isHorizontal ? "inline" : "inline-block"
|
|
6235
|
+
};
|
|
6236
|
+
return () => {
|
|
6237
|
+
var _a, _b;
|
|
6238
|
+
return createVNode("span", {
|
|
6239
|
+
"class": wrapperCls,
|
|
6240
|
+
"style": style2
|
|
6241
|
+
}, [createVNode("span", {
|
|
6242
|
+
"class": className
|
|
6243
|
+
}, [(_b = (_a = ctx2.slots).default) == null ? void 0 : _b.call(_a), props.hasHelp && props.helpTips && createVNode(Popover, {
|
|
6244
|
+
"content": props.helpTips,
|
|
6245
|
+
"showAnimation": false,
|
|
6246
|
+
"position": "top",
|
|
6247
|
+
"trigger": "hover"
|
|
6248
|
+
}, {
|
|
6249
|
+
reference: () => createVNode("span", {
|
|
6250
|
+
"class": "devui-form-label-help"
|
|
6251
|
+
}, [createVNode(Icon, {
|
|
6252
|
+
"name": "helping",
|
|
6253
|
+
"color": "#252b3a"
|
|
6254
|
+
}, null)])
|
|
6255
|
+
})])]);
|
|
6256
|
+
};
|
|
6257
|
+
}
|
|
6258
|
+
});
|
|
6259
|
+
function _extends() {
|
|
6260
|
+
_extends = Object.assign || function(target) {
|
|
6261
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6262
|
+
var source = arguments[i];
|
|
6263
|
+
for (var key in source) {
|
|
6264
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
6265
|
+
target[key] = source[key];
|
|
6266
|
+
}
|
|
6267
|
+
}
|
|
6268
|
+
}
|
|
6269
|
+
return target;
|
|
6270
|
+
};
|
|
6271
|
+
return _extends.apply(this, arguments);
|
|
6272
|
+
}
|
|
6273
|
+
function _inheritsLoose(subClass, superClass) {
|
|
6274
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
6275
|
+
subClass.prototype.constructor = subClass;
|
|
6276
|
+
_setPrototypeOf(subClass, superClass);
|
|
6277
|
+
}
|
|
6278
|
+
function _getPrototypeOf(o) {
|
|
6279
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
|
|
6280
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
6281
|
+
};
|
|
6282
|
+
return _getPrototypeOf(o);
|
|
6283
|
+
}
|
|
6284
|
+
function _setPrototypeOf(o, p) {
|
|
6285
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
6286
|
+
o2.__proto__ = p2;
|
|
6287
|
+
return o2;
|
|
6288
|
+
};
|
|
6289
|
+
return _setPrototypeOf(o, p);
|
|
6290
|
+
}
|
|
6291
|
+
function _isNativeReflectConstruct() {
|
|
6292
|
+
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
6293
|
+
return false;
|
|
6294
|
+
if (Reflect.construct.sham)
|
|
6295
|
+
return false;
|
|
6296
|
+
if (typeof Proxy === "function")
|
|
6297
|
+
return true;
|
|
6298
|
+
try {
|
|
6299
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
6300
|
+
}));
|
|
6301
|
+
return true;
|
|
6302
|
+
} catch (e) {
|
|
6303
|
+
return false;
|
|
6304
|
+
}
|
|
6305
|
+
}
|
|
6306
|
+
function _construct(Parent, args, Class) {
|
|
6307
|
+
if (_isNativeReflectConstruct()) {
|
|
6308
|
+
_construct = Reflect.construct;
|
|
6309
|
+
} else {
|
|
6310
|
+
_construct = function _construct2(Parent2, args2, Class2) {
|
|
6311
|
+
var a = [null];
|
|
6312
|
+
a.push.apply(a, args2);
|
|
6313
|
+
var Constructor = Function.bind.apply(Parent2, a);
|
|
6314
|
+
var instance = new Constructor();
|
|
6315
|
+
if (Class2)
|
|
6316
|
+
_setPrototypeOf(instance, Class2.prototype);
|
|
6317
|
+
return instance;
|
|
6318
|
+
};
|
|
6319
|
+
}
|
|
6320
|
+
return _construct.apply(null, arguments);
|
|
6321
|
+
}
|
|
6322
|
+
function _isNativeFunction(fn) {
|
|
6323
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
6324
|
+
}
|
|
6325
|
+
function _wrapNativeSuper(Class) {
|
|
6326
|
+
var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
6327
|
+
_wrapNativeSuper = function _wrapNativeSuper2(Class2) {
|
|
6328
|
+
if (Class2 === null || !_isNativeFunction(Class2))
|
|
6329
|
+
return Class2;
|
|
6330
|
+
if (typeof Class2 !== "function") {
|
|
6331
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
6332
|
+
}
|
|
6333
|
+
if (typeof _cache !== "undefined") {
|
|
6334
|
+
if (_cache.has(Class2))
|
|
6335
|
+
return _cache.get(Class2);
|
|
6336
|
+
_cache.set(Class2, Wrapper);
|
|
6337
|
+
}
|
|
6338
|
+
function Wrapper() {
|
|
6339
|
+
return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
|
|
6340
|
+
}
|
|
6341
|
+
Wrapper.prototype = Object.create(Class2.prototype, {
|
|
6342
|
+
constructor: {
|
|
6343
|
+
value: Wrapper,
|
|
6344
|
+
enumerable: false,
|
|
6345
|
+
writable: true,
|
|
6346
|
+
configurable: true
|
|
6347
|
+
}
|
|
6348
|
+
});
|
|
6349
|
+
return _setPrototypeOf(Wrapper, Class2);
|
|
6350
|
+
};
|
|
6351
|
+
return _wrapNativeSuper(Class);
|
|
6352
|
+
}
|
|
6353
|
+
var formatRegExp = /%[sdj%]/g;
|
|
6354
|
+
var warning = function warning2() {
|
|
6355
|
+
};
|
|
6356
|
+
if (typeof process !== "undefined" && process.env && false) {
|
|
6357
|
+
warning = function warning3(type4, errors) {
|
|
6358
|
+
if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
|
|
6359
|
+
if (errors.every(function(e) {
|
|
6360
|
+
return typeof e === "string";
|
|
6361
|
+
})) {
|
|
6362
|
+
console.warn(type4, errors);
|
|
6363
|
+
}
|
|
6364
|
+
}
|
|
6365
|
+
};
|
|
6366
|
+
}
|
|
6367
|
+
function convertFieldsError(errors) {
|
|
6368
|
+
if (!errors || !errors.length)
|
|
6369
|
+
return null;
|
|
6370
|
+
var fields = {};
|
|
6371
|
+
errors.forEach(function(error) {
|
|
6372
|
+
var field = error.field;
|
|
6373
|
+
fields[field] = fields[field] || [];
|
|
6374
|
+
fields[field].push(error);
|
|
6375
|
+
});
|
|
6376
|
+
return fields;
|
|
6377
|
+
}
|
|
6378
|
+
function format(template) {
|
|
6379
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
6380
|
+
args[_key - 1] = arguments[_key];
|
|
6381
|
+
}
|
|
6382
|
+
var i = 0;
|
|
6383
|
+
var len = args.length;
|
|
6384
|
+
if (typeof template === "function") {
|
|
6385
|
+
return template.apply(null, args);
|
|
6386
|
+
}
|
|
6387
|
+
if (typeof template === "string") {
|
|
6388
|
+
var str = template.replace(formatRegExp, function(x) {
|
|
6389
|
+
if (x === "%%") {
|
|
6390
|
+
return "%";
|
|
6391
|
+
}
|
|
6392
|
+
if (i >= len) {
|
|
6393
|
+
return x;
|
|
6394
|
+
}
|
|
6395
|
+
switch (x) {
|
|
6396
|
+
case "%s":
|
|
6397
|
+
return String(args[i++]);
|
|
6398
|
+
case "%d":
|
|
6399
|
+
return Number(args[i++]);
|
|
6400
|
+
case "%j":
|
|
6401
|
+
try {
|
|
6402
|
+
return JSON.stringify(args[i++]);
|
|
6403
|
+
} catch (_) {
|
|
6404
|
+
return "[Circular]";
|
|
6405
|
+
}
|
|
6406
|
+
break;
|
|
6407
|
+
default:
|
|
6408
|
+
return x;
|
|
6409
|
+
}
|
|
6410
|
+
});
|
|
6411
|
+
return str;
|
|
6412
|
+
}
|
|
6413
|
+
return template;
|
|
6414
|
+
}
|
|
6415
|
+
function isNativeStringType(type4) {
|
|
6416
|
+
return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
|
|
6417
|
+
}
|
|
6418
|
+
function isEmptyValue(value, type4) {
|
|
6419
|
+
if (value === void 0 || value === null) {
|
|
6420
|
+
return true;
|
|
6421
|
+
}
|
|
6422
|
+
if (type4 === "array" && Array.isArray(value) && !value.length) {
|
|
6423
|
+
return true;
|
|
6424
|
+
}
|
|
6425
|
+
if (isNativeStringType(type4) && typeof value === "string" && !value) {
|
|
6426
|
+
return true;
|
|
6427
|
+
}
|
|
6428
|
+
return false;
|
|
6429
|
+
}
|
|
6430
|
+
function asyncParallelArray(arr, func, callback) {
|
|
6431
|
+
var results = [];
|
|
6432
|
+
var total = 0;
|
|
6433
|
+
var arrLength = arr.length;
|
|
6434
|
+
function count(errors) {
|
|
6435
|
+
results.push.apply(results, errors || []);
|
|
6436
|
+
total++;
|
|
6437
|
+
if (total === arrLength) {
|
|
6438
|
+
callback(results);
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6441
|
+
arr.forEach(function(a) {
|
|
6442
|
+
func(a, count);
|
|
6443
|
+
});
|
|
6444
|
+
}
|
|
6445
|
+
function asyncSerialArray(arr, func, callback) {
|
|
6446
|
+
var index2 = 0;
|
|
6447
|
+
var arrLength = arr.length;
|
|
6448
|
+
function next(errors) {
|
|
6449
|
+
if (errors && errors.length) {
|
|
6450
|
+
callback(errors);
|
|
6451
|
+
return;
|
|
6452
|
+
}
|
|
6453
|
+
var original = index2;
|
|
6454
|
+
index2 = index2 + 1;
|
|
6455
|
+
if (original < arrLength) {
|
|
6456
|
+
func(arr[original], next);
|
|
6457
|
+
} else {
|
|
6458
|
+
callback([]);
|
|
6459
|
+
}
|
|
6460
|
+
}
|
|
6461
|
+
next([]);
|
|
6462
|
+
}
|
|
6463
|
+
function flattenObjArr(objArr) {
|
|
6464
|
+
var ret = [];
|
|
6465
|
+
Object.keys(objArr).forEach(function(k) {
|
|
6466
|
+
ret.push.apply(ret, objArr[k] || []);
|
|
6467
|
+
});
|
|
6468
|
+
return ret;
|
|
6469
|
+
}
|
|
6470
|
+
var AsyncValidationError = /* @__PURE__ */ function(_Error) {
|
|
6471
|
+
_inheritsLoose(AsyncValidationError2, _Error);
|
|
6472
|
+
function AsyncValidationError2(errors, fields) {
|
|
6473
|
+
var _this;
|
|
6474
|
+
_this = _Error.call(this, "Async Validation Error") || this;
|
|
6475
|
+
_this.errors = errors;
|
|
6476
|
+
_this.fields = fields;
|
|
6477
|
+
return _this;
|
|
6478
|
+
}
|
|
6479
|
+
return AsyncValidationError2;
|
|
6480
|
+
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
6481
|
+
function asyncMap(objArr, option, func, callback, source) {
|
|
6482
|
+
if (option.first) {
|
|
6483
|
+
var _pending = new Promise(function(resolve, reject) {
|
|
6484
|
+
var next = function next2(errors) {
|
|
6485
|
+
callback(errors);
|
|
6486
|
+
return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
|
|
6487
|
+
};
|
|
6488
|
+
var flattenArr = flattenObjArr(objArr);
|
|
6489
|
+
asyncSerialArray(flattenArr, func, next);
|
|
6490
|
+
});
|
|
6491
|
+
_pending["catch"](function(e) {
|
|
6492
|
+
return e;
|
|
6493
|
+
});
|
|
6494
|
+
return _pending;
|
|
6495
|
+
}
|
|
6496
|
+
var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
|
|
6497
|
+
var objArrKeys = Object.keys(objArr);
|
|
6498
|
+
var objArrLength = objArrKeys.length;
|
|
6499
|
+
var total = 0;
|
|
6500
|
+
var results = [];
|
|
6501
|
+
var pending = new Promise(function(resolve, reject) {
|
|
6502
|
+
var next = function next2(errors) {
|
|
6503
|
+
results.push.apply(results, errors);
|
|
6504
|
+
total++;
|
|
6505
|
+
if (total === objArrLength) {
|
|
6506
|
+
callback(results);
|
|
6507
|
+
return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
|
|
6508
|
+
}
|
|
6509
|
+
};
|
|
6510
|
+
if (!objArrKeys.length) {
|
|
6511
|
+
callback(results);
|
|
6512
|
+
resolve(source);
|
|
6513
|
+
}
|
|
6514
|
+
objArrKeys.forEach(function(key) {
|
|
6515
|
+
var arr = objArr[key];
|
|
6516
|
+
if (firstFields.indexOf(key) !== -1) {
|
|
6517
|
+
asyncSerialArray(arr, func, next);
|
|
6518
|
+
} else {
|
|
6519
|
+
asyncParallelArray(arr, func, next);
|
|
6520
|
+
}
|
|
6521
|
+
});
|
|
6522
|
+
});
|
|
6523
|
+
pending["catch"](function(e) {
|
|
6524
|
+
return e;
|
|
6525
|
+
});
|
|
6526
|
+
return pending;
|
|
6527
|
+
}
|
|
6528
|
+
function isErrorObj(obj) {
|
|
6529
|
+
return !!(obj && obj.message !== void 0);
|
|
6530
|
+
}
|
|
6531
|
+
function getValue(value, path) {
|
|
6532
|
+
var v = value;
|
|
6533
|
+
for (var i = 0; i < path.length; i++) {
|
|
6534
|
+
if (v == void 0) {
|
|
6535
|
+
return v;
|
|
6536
|
+
}
|
|
6537
|
+
v = v[path[i]];
|
|
6538
|
+
}
|
|
6539
|
+
return v;
|
|
6540
|
+
}
|
|
6541
|
+
function complementError(rule, source) {
|
|
6542
|
+
return function(oe) {
|
|
6543
|
+
var fieldValue;
|
|
6544
|
+
if (rule.fullFields) {
|
|
6545
|
+
fieldValue = getValue(source, rule.fullFields);
|
|
6546
|
+
} else {
|
|
6547
|
+
fieldValue = source[oe.field || rule.fullField];
|
|
6548
|
+
}
|
|
6549
|
+
if (isErrorObj(oe)) {
|
|
6550
|
+
oe.field = oe.field || rule.fullField;
|
|
6551
|
+
oe.fieldValue = fieldValue;
|
|
6552
|
+
return oe;
|
|
6553
|
+
}
|
|
6554
|
+
return {
|
|
6555
|
+
message: typeof oe === "function" ? oe() : oe,
|
|
6556
|
+
fieldValue,
|
|
6557
|
+
field: oe.field || rule.fullField
|
|
6558
|
+
};
|
|
6559
|
+
};
|
|
6560
|
+
}
|
|
6561
|
+
function deepMerge(target, source) {
|
|
6562
|
+
if (source) {
|
|
6563
|
+
for (var s in source) {
|
|
6564
|
+
if (source.hasOwnProperty(s)) {
|
|
6565
|
+
var value = source[s];
|
|
6566
|
+
if (typeof value === "object" && typeof target[s] === "object") {
|
|
6567
|
+
target[s] = _extends({}, target[s], value);
|
|
6568
|
+
} else {
|
|
6569
|
+
target[s] = value;
|
|
6570
|
+
}
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
}
|
|
6574
|
+
return target;
|
|
6575
|
+
}
|
|
6576
|
+
var required$1 = function required(rule, value, source, errors, options, type4) {
|
|
6577
|
+
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
|
|
6578
|
+
errors.push(format(options.messages.required, rule.fullField));
|
|
6579
|
+
}
|
|
6580
|
+
};
|
|
6581
|
+
var whitespace = function whitespace2(rule, value, source, errors, options) {
|
|
6582
|
+
if (/^\s+$/.test(value) || value === "") {
|
|
6583
|
+
errors.push(format(options.messages.whitespace, rule.fullField));
|
|
6584
|
+
}
|
|
6585
|
+
};
|
|
6586
|
+
var pattern$2 = {
|
|
6587
|
+
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,}))$/,
|
|
6588
|
+
url: new RegExp("^(?!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]*)?$", "i"),
|
|
6589
|
+
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
|
6590
|
+
};
|
|
6591
|
+
var types = {
|
|
6592
|
+
integer: function integer(value) {
|
|
6593
|
+
return types.number(value) && parseInt(value, 10) === value;
|
|
6594
|
+
},
|
|
6595
|
+
"float": function float(value) {
|
|
6596
|
+
return types.number(value) && !types.integer(value);
|
|
6597
|
+
},
|
|
6598
|
+
array: function array(value) {
|
|
6599
|
+
return Array.isArray(value);
|
|
6600
|
+
},
|
|
6601
|
+
regexp: function regexp(value) {
|
|
6602
|
+
if (value instanceof RegExp) {
|
|
6603
|
+
return true;
|
|
6604
|
+
}
|
|
6605
|
+
try {
|
|
6606
|
+
return !!new RegExp(value);
|
|
6607
|
+
} catch (e) {
|
|
6608
|
+
return false;
|
|
6609
|
+
}
|
|
6610
|
+
},
|
|
6611
|
+
date: function date(value) {
|
|
6612
|
+
return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
|
|
6613
|
+
},
|
|
6614
|
+
number: function number(value) {
|
|
6615
|
+
if (isNaN(value)) {
|
|
6616
|
+
return false;
|
|
6617
|
+
}
|
|
6618
|
+
return typeof value === "number";
|
|
6619
|
+
},
|
|
6620
|
+
object: function object(value) {
|
|
6621
|
+
return typeof value === "object" && !types.array(value);
|
|
6622
|
+
},
|
|
6623
|
+
method: function method(value) {
|
|
6624
|
+
return typeof value === "function";
|
|
6625
|
+
},
|
|
6626
|
+
email: function email(value) {
|
|
6627
|
+
return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
|
|
6628
|
+
},
|
|
6629
|
+
url: function url(value) {
|
|
6630
|
+
return typeof value === "string" && value.length <= 2048 && !!value.match(pattern$2.url);
|
|
6631
|
+
},
|
|
6632
|
+
hex: function hex(value) {
|
|
6633
|
+
return typeof value === "string" && !!value.match(pattern$2.hex);
|
|
6634
|
+
}
|
|
6635
|
+
};
|
|
6636
|
+
var type$1 = function type(rule, value, source, errors, options) {
|
|
6637
|
+
if (rule.required && value === void 0) {
|
|
6638
|
+
required$1(rule, value, source, errors, options);
|
|
6639
|
+
return;
|
|
6640
|
+
}
|
|
6641
|
+
var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
|
|
6642
|
+
var ruleType = rule.type;
|
|
6643
|
+
if (custom.indexOf(ruleType) > -1) {
|
|
6644
|
+
if (!types[ruleType](value)) {
|
|
6645
|
+
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
|
|
6646
|
+
}
|
|
6647
|
+
} else if (ruleType && typeof value !== rule.type) {
|
|
6648
|
+
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
|
|
6649
|
+
}
|
|
6650
|
+
};
|
|
6651
|
+
var range = function range2(rule, value, source, errors, options) {
|
|
6652
|
+
var len = typeof rule.len === "number";
|
|
6653
|
+
var min = typeof rule.min === "number";
|
|
6654
|
+
var max = typeof rule.max === "number";
|
|
6655
|
+
var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
6656
|
+
var val = value;
|
|
6657
|
+
var key = null;
|
|
6658
|
+
var num = typeof value === "number";
|
|
6659
|
+
var str = typeof value === "string";
|
|
6660
|
+
var arr = Array.isArray(value);
|
|
6661
|
+
if (num) {
|
|
6662
|
+
key = "number";
|
|
6663
|
+
} else if (str) {
|
|
6664
|
+
key = "string";
|
|
6665
|
+
} else if (arr) {
|
|
6666
|
+
key = "array";
|
|
6667
|
+
}
|
|
6668
|
+
if (!key) {
|
|
6669
|
+
return false;
|
|
6670
|
+
}
|
|
6671
|
+
if (arr) {
|
|
6672
|
+
val = value.length;
|
|
6673
|
+
}
|
|
6674
|
+
if (str) {
|
|
6675
|
+
val = value.replace(spRegexp, "_").length;
|
|
6676
|
+
}
|
|
6677
|
+
if (len) {
|
|
6678
|
+
if (val !== rule.len) {
|
|
6679
|
+
errors.push(format(options.messages[key].len, rule.fullField, rule.len));
|
|
6680
|
+
}
|
|
6681
|
+
} else if (min && !max && val < rule.min) {
|
|
6682
|
+
errors.push(format(options.messages[key].min, rule.fullField, rule.min));
|
|
6683
|
+
} else if (max && !min && val > rule.max) {
|
|
6684
|
+
errors.push(format(options.messages[key].max, rule.fullField, rule.max));
|
|
6685
|
+
} else if (min && max && (val < rule.min || val > rule.max)) {
|
|
6686
|
+
errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
|
|
6687
|
+
}
|
|
6688
|
+
};
|
|
6689
|
+
var ENUM$1 = "enum";
|
|
6690
|
+
var enumerable$1 = function enumerable(rule, value, source, errors, options) {
|
|
6691
|
+
rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
|
|
6692
|
+
if (rule[ENUM$1].indexOf(value) === -1) {
|
|
6693
|
+
errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
|
|
6694
|
+
}
|
|
6695
|
+
};
|
|
6696
|
+
var pattern$1 = function pattern(rule, value, source, errors, options) {
|
|
6697
|
+
if (rule.pattern) {
|
|
6698
|
+
if (rule.pattern instanceof RegExp) {
|
|
6699
|
+
rule.pattern.lastIndex = 0;
|
|
6700
|
+
if (!rule.pattern.test(value)) {
|
|
6701
|
+
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
6702
|
+
}
|
|
6703
|
+
} else if (typeof rule.pattern === "string") {
|
|
6704
|
+
var _pattern = new RegExp(rule.pattern);
|
|
6705
|
+
if (!_pattern.test(value)) {
|
|
6706
|
+
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
}
|
|
6710
|
+
};
|
|
6711
|
+
var rules = {
|
|
6712
|
+
required: required$1,
|
|
6713
|
+
whitespace,
|
|
6714
|
+
type: type$1,
|
|
6715
|
+
range,
|
|
6716
|
+
"enum": enumerable$1,
|
|
6717
|
+
pattern: pattern$1
|
|
6718
|
+
};
|
|
6719
|
+
var string = function string2(rule, value, callback, source, options) {
|
|
6720
|
+
var errors = [];
|
|
6721
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6722
|
+
if (validate) {
|
|
6723
|
+
if (isEmptyValue(value, "string") && !rule.required) {
|
|
6724
|
+
return callback();
|
|
6725
|
+
}
|
|
6726
|
+
rules.required(rule, value, source, errors, options, "string");
|
|
6727
|
+
if (!isEmptyValue(value, "string")) {
|
|
6728
|
+
rules.type(rule, value, source, errors, options);
|
|
6729
|
+
rules.range(rule, value, source, errors, options);
|
|
6730
|
+
rules.pattern(rule, value, source, errors, options);
|
|
6731
|
+
if (rule.whitespace === true) {
|
|
6732
|
+
rules.whitespace(rule, value, source, errors, options);
|
|
6733
|
+
}
|
|
6734
|
+
}
|
|
6735
|
+
}
|
|
6736
|
+
callback(errors);
|
|
6737
|
+
};
|
|
6738
|
+
var method2 = function method3(rule, value, callback, source, options) {
|
|
6739
|
+
var errors = [];
|
|
6740
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6741
|
+
if (validate) {
|
|
6742
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
6743
|
+
return callback();
|
|
6744
|
+
}
|
|
6745
|
+
rules.required(rule, value, source, errors, options);
|
|
6746
|
+
if (value !== void 0) {
|
|
6747
|
+
rules.type(rule, value, source, errors, options);
|
|
6748
|
+
}
|
|
6749
|
+
}
|
|
6750
|
+
callback(errors);
|
|
6751
|
+
};
|
|
6752
|
+
var number2 = function number3(rule, value, callback, source, options) {
|
|
6753
|
+
var errors = [];
|
|
6754
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6755
|
+
if (validate) {
|
|
6756
|
+
if (value === "") {
|
|
6757
|
+
value = void 0;
|
|
6758
|
+
}
|
|
6759
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
6760
|
+
return callback();
|
|
6761
|
+
}
|
|
6762
|
+
rules.required(rule, value, source, errors, options);
|
|
6763
|
+
if (value !== void 0) {
|
|
6764
|
+
rules.type(rule, value, source, errors, options);
|
|
6765
|
+
rules.range(rule, value, source, errors, options);
|
|
6766
|
+
}
|
|
6767
|
+
}
|
|
6768
|
+
callback(errors);
|
|
6769
|
+
};
|
|
6770
|
+
var _boolean = function _boolean2(rule, value, callback, source, options) {
|
|
6771
|
+
var errors = [];
|
|
6772
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6773
|
+
if (validate) {
|
|
6774
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
6775
|
+
return callback();
|
|
6776
|
+
}
|
|
6777
|
+
rules.required(rule, value, source, errors, options);
|
|
6778
|
+
if (value !== void 0) {
|
|
6779
|
+
rules.type(rule, value, source, errors, options);
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
callback(errors);
|
|
6783
|
+
};
|
|
6784
|
+
var regexp2 = function regexp3(rule, value, callback, source, options) {
|
|
6785
|
+
var errors = [];
|
|
6786
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6787
|
+
if (validate) {
|
|
6788
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
6789
|
+
return callback();
|
|
6790
|
+
}
|
|
6791
|
+
rules.required(rule, value, source, errors, options);
|
|
6792
|
+
if (!isEmptyValue(value)) {
|
|
6793
|
+
rules.type(rule, value, source, errors, options);
|
|
6794
|
+
}
|
|
6795
|
+
}
|
|
6796
|
+
callback(errors);
|
|
6797
|
+
};
|
|
6798
|
+
var integer2 = function integer3(rule, value, callback, source, options) {
|
|
6799
|
+
var errors = [];
|
|
6800
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6801
|
+
if (validate) {
|
|
6802
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
6803
|
+
return callback();
|
|
6804
|
+
}
|
|
6805
|
+
rules.required(rule, value, source, errors, options);
|
|
6806
|
+
if (value !== void 0) {
|
|
6807
|
+
rules.type(rule, value, source, errors, options);
|
|
6808
|
+
rules.range(rule, value, source, errors, options);
|
|
6809
|
+
}
|
|
6810
|
+
}
|
|
6811
|
+
callback(errors);
|
|
6812
|
+
};
|
|
6813
|
+
var floatFn = function floatFn2(rule, value, callback, source, options) {
|
|
6814
|
+
var errors = [];
|
|
6815
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6816
|
+
if (validate) {
|
|
6817
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
6818
|
+
return callback();
|
|
6819
|
+
}
|
|
6820
|
+
rules.required(rule, value, source, errors, options);
|
|
6821
|
+
if (value !== void 0) {
|
|
6822
|
+
rules.type(rule, value, source, errors, options);
|
|
6823
|
+
rules.range(rule, value, source, errors, options);
|
|
6824
|
+
}
|
|
6825
|
+
}
|
|
6826
|
+
callback(errors);
|
|
6827
|
+
};
|
|
6828
|
+
var array2 = function array3(rule, value, callback, source, options) {
|
|
6829
|
+
var errors = [];
|
|
6830
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6831
|
+
if (validate) {
|
|
6832
|
+
if ((value === void 0 || value === null) && !rule.required) {
|
|
6833
|
+
return callback();
|
|
6834
|
+
}
|
|
6835
|
+
rules.required(rule, value, source, errors, options, "array");
|
|
6836
|
+
if (value !== void 0 && value !== null) {
|
|
6837
|
+
rules.type(rule, value, source, errors, options);
|
|
6838
|
+
rules.range(rule, value, source, errors, options);
|
|
6839
|
+
}
|
|
6840
|
+
}
|
|
6841
|
+
callback(errors);
|
|
6842
|
+
};
|
|
6843
|
+
var object2 = function object3(rule, value, callback, source, options) {
|
|
6844
|
+
var errors = [];
|
|
6845
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6846
|
+
if (validate) {
|
|
6847
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
6848
|
+
return callback();
|
|
6849
|
+
}
|
|
6850
|
+
rules.required(rule, value, source, errors, options);
|
|
6851
|
+
if (value !== void 0) {
|
|
6852
|
+
rules.type(rule, value, source, errors, options);
|
|
6853
|
+
}
|
|
6854
|
+
}
|
|
6855
|
+
callback(errors);
|
|
6856
|
+
};
|
|
6857
|
+
var ENUM = "enum";
|
|
6858
|
+
var enumerable2 = function enumerable3(rule, value, callback, source, options) {
|
|
6859
|
+
var errors = [];
|
|
6860
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6861
|
+
if (validate) {
|
|
6862
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
6863
|
+
return callback();
|
|
6864
|
+
}
|
|
6865
|
+
rules.required(rule, value, source, errors, options);
|
|
6866
|
+
if (value !== void 0) {
|
|
6867
|
+
rules[ENUM](rule, value, source, errors, options);
|
|
6868
|
+
}
|
|
6869
|
+
}
|
|
6870
|
+
callback(errors);
|
|
6871
|
+
};
|
|
6872
|
+
var pattern2 = function pattern3(rule, value, callback, source, options) {
|
|
6873
|
+
var errors = [];
|
|
6874
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6875
|
+
if (validate) {
|
|
6876
|
+
if (isEmptyValue(value, "string") && !rule.required) {
|
|
6877
|
+
return callback();
|
|
6878
|
+
}
|
|
6879
|
+
rules.required(rule, value, source, errors, options);
|
|
6880
|
+
if (!isEmptyValue(value, "string")) {
|
|
6881
|
+
rules.pattern(rule, value, source, errors, options);
|
|
6882
|
+
}
|
|
6883
|
+
}
|
|
6884
|
+
callback(errors);
|
|
6885
|
+
};
|
|
6886
|
+
var date2 = function date3(rule, value, callback, source, options) {
|
|
6887
|
+
var errors = [];
|
|
6888
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6889
|
+
if (validate) {
|
|
6890
|
+
if (isEmptyValue(value, "date") && !rule.required) {
|
|
6891
|
+
return callback();
|
|
6892
|
+
}
|
|
6893
|
+
rules.required(rule, value, source, errors, options);
|
|
6894
|
+
if (!isEmptyValue(value, "date")) {
|
|
6895
|
+
var dateObject;
|
|
6896
|
+
if (value instanceof Date) {
|
|
6897
|
+
dateObject = value;
|
|
6898
|
+
} else {
|
|
6899
|
+
dateObject = new Date(value);
|
|
6900
|
+
}
|
|
6901
|
+
rules.type(rule, dateObject, source, errors, options);
|
|
6902
|
+
if (dateObject) {
|
|
6903
|
+
rules.range(rule, dateObject.getTime(), source, errors, options);
|
|
6904
|
+
}
|
|
6905
|
+
}
|
|
6906
|
+
}
|
|
6907
|
+
callback(errors);
|
|
6908
|
+
};
|
|
6909
|
+
var required2 = function required3(rule, value, callback, source, options) {
|
|
6910
|
+
var errors = [];
|
|
6911
|
+
var type4 = Array.isArray(value) ? "array" : typeof value;
|
|
6912
|
+
rules.required(rule, value, source, errors, options, type4);
|
|
6913
|
+
callback(errors);
|
|
6914
|
+
};
|
|
6915
|
+
var type2 = function type3(rule, value, callback, source, options) {
|
|
6916
|
+
var ruleType = rule.type;
|
|
6917
|
+
var errors = [];
|
|
6918
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6919
|
+
if (validate) {
|
|
6920
|
+
if (isEmptyValue(value, ruleType) && !rule.required) {
|
|
6921
|
+
return callback();
|
|
6922
|
+
}
|
|
6923
|
+
rules.required(rule, value, source, errors, options, ruleType);
|
|
6924
|
+
if (!isEmptyValue(value, ruleType)) {
|
|
6925
|
+
rules.type(rule, value, source, errors, options);
|
|
6926
|
+
}
|
|
6927
|
+
}
|
|
6928
|
+
callback(errors);
|
|
6929
|
+
};
|
|
6930
|
+
var any = function any2(rule, value, callback, source, options) {
|
|
6931
|
+
var errors = [];
|
|
6932
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
6933
|
+
if (validate) {
|
|
6934
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
6935
|
+
return callback();
|
|
6936
|
+
}
|
|
6937
|
+
rules.required(rule, value, source, errors, options);
|
|
6938
|
+
}
|
|
6939
|
+
callback(errors);
|
|
6940
|
+
};
|
|
6941
|
+
var validators = {
|
|
6942
|
+
string,
|
|
6943
|
+
method: method2,
|
|
6944
|
+
number: number2,
|
|
6945
|
+
"boolean": _boolean,
|
|
6946
|
+
regexp: regexp2,
|
|
6947
|
+
integer: integer2,
|
|
6948
|
+
"float": floatFn,
|
|
6949
|
+
array: array2,
|
|
6950
|
+
object: object2,
|
|
6951
|
+
"enum": enumerable2,
|
|
6952
|
+
pattern: pattern2,
|
|
6953
|
+
date: date2,
|
|
6954
|
+
url: type2,
|
|
6955
|
+
hex: type2,
|
|
6956
|
+
email: type2,
|
|
6957
|
+
required: required2,
|
|
6958
|
+
any
|
|
6959
|
+
};
|
|
6960
|
+
function newMessages() {
|
|
6961
|
+
return {
|
|
6962
|
+
"default": "Validation error on field %s",
|
|
6963
|
+
required: "%s is required",
|
|
6964
|
+
"enum": "%s must be one of %s",
|
|
6965
|
+
whitespace: "%s cannot be empty",
|
|
6966
|
+
date: {
|
|
6967
|
+
format: "%s date %s is invalid for format %s",
|
|
6968
|
+
parse: "%s date could not be parsed, %s is invalid ",
|
|
6969
|
+
invalid: "%s date %s is invalid"
|
|
6970
|
+
},
|
|
6971
|
+
types: {
|
|
6972
|
+
string: "%s is not a %s",
|
|
6973
|
+
method: "%s is not a %s (function)",
|
|
6974
|
+
array: "%s is not an %s",
|
|
6975
|
+
object: "%s is not an %s",
|
|
6976
|
+
number: "%s is not a %s",
|
|
6977
|
+
date: "%s is not a %s",
|
|
6978
|
+
"boolean": "%s is not a %s",
|
|
6979
|
+
integer: "%s is not an %s",
|
|
6980
|
+
"float": "%s is not a %s",
|
|
6981
|
+
regexp: "%s is not a valid %s",
|
|
6982
|
+
email: "%s is not a valid %s",
|
|
6983
|
+
url: "%s is not a valid %s",
|
|
6984
|
+
hex: "%s is not a valid %s"
|
|
6985
|
+
},
|
|
6986
|
+
string: {
|
|
6987
|
+
len: "%s must be exactly %s characters",
|
|
6988
|
+
min: "%s must be at least %s characters",
|
|
6989
|
+
max: "%s cannot be longer than %s characters",
|
|
6990
|
+
range: "%s must be between %s and %s characters"
|
|
6991
|
+
},
|
|
6992
|
+
number: {
|
|
6993
|
+
len: "%s must equal %s",
|
|
6994
|
+
min: "%s cannot be less than %s",
|
|
6995
|
+
max: "%s cannot be greater than %s",
|
|
6996
|
+
range: "%s must be between %s and %s"
|
|
6997
|
+
},
|
|
6998
|
+
array: {
|
|
6999
|
+
len: "%s must be exactly %s in length",
|
|
7000
|
+
min: "%s cannot be less than %s in length",
|
|
7001
|
+
max: "%s cannot be greater than %s in length",
|
|
7002
|
+
range: "%s must be between %s and %s in length"
|
|
7003
|
+
},
|
|
7004
|
+
pattern: {
|
|
7005
|
+
mismatch: "%s value %s does not match pattern %s"
|
|
7006
|
+
},
|
|
7007
|
+
clone: function clone() {
|
|
7008
|
+
var cloned = JSON.parse(JSON.stringify(this));
|
|
7009
|
+
cloned.clone = this.clone;
|
|
7010
|
+
return cloned;
|
|
7011
|
+
}
|
|
7012
|
+
};
|
|
7013
|
+
}
|
|
7014
|
+
var messages = newMessages();
|
|
7015
|
+
var Schema = /* @__PURE__ */ function() {
|
|
7016
|
+
function Schema2(descriptor) {
|
|
7017
|
+
this.rules = null;
|
|
7018
|
+
this._messages = messages;
|
|
7019
|
+
this.define(descriptor);
|
|
7020
|
+
}
|
|
7021
|
+
var _proto = Schema2.prototype;
|
|
7022
|
+
_proto.define = function define(rules2) {
|
|
7023
|
+
var _this = this;
|
|
7024
|
+
if (!rules2) {
|
|
7025
|
+
throw new Error("Cannot configure a schema with no rules");
|
|
7026
|
+
}
|
|
7027
|
+
if (typeof rules2 !== "object" || Array.isArray(rules2)) {
|
|
7028
|
+
throw new Error("Rules must be an object");
|
|
7029
|
+
}
|
|
7030
|
+
this.rules = {};
|
|
7031
|
+
Object.keys(rules2).forEach(function(name) {
|
|
7032
|
+
var item = rules2[name];
|
|
7033
|
+
_this.rules[name] = Array.isArray(item) ? item : [item];
|
|
7034
|
+
});
|
|
7035
|
+
};
|
|
7036
|
+
_proto.messages = function messages2(_messages) {
|
|
7037
|
+
if (_messages) {
|
|
7038
|
+
this._messages = deepMerge(newMessages(), _messages);
|
|
7039
|
+
}
|
|
7040
|
+
return this._messages;
|
|
7041
|
+
};
|
|
7042
|
+
_proto.validate = function validate(source_, o, oc) {
|
|
7043
|
+
var _this2 = this;
|
|
7044
|
+
if (o === void 0) {
|
|
7045
|
+
o = {};
|
|
7046
|
+
}
|
|
7047
|
+
if (oc === void 0) {
|
|
7048
|
+
oc = function oc2() {
|
|
7049
|
+
};
|
|
7050
|
+
}
|
|
7051
|
+
var source = source_;
|
|
7052
|
+
var options = o;
|
|
7053
|
+
var callback = oc;
|
|
7054
|
+
if (typeof options === "function") {
|
|
7055
|
+
callback = options;
|
|
7056
|
+
options = {};
|
|
7057
|
+
}
|
|
7058
|
+
if (!this.rules || Object.keys(this.rules).length === 0) {
|
|
7059
|
+
if (callback) {
|
|
7060
|
+
callback(null, source);
|
|
7061
|
+
}
|
|
7062
|
+
return Promise.resolve(source);
|
|
7063
|
+
}
|
|
7064
|
+
function complete(results) {
|
|
7065
|
+
var errors = [];
|
|
7066
|
+
var fields = {};
|
|
7067
|
+
function add(e) {
|
|
7068
|
+
if (Array.isArray(e)) {
|
|
7069
|
+
var _errors;
|
|
7070
|
+
errors = (_errors = errors).concat.apply(_errors, e);
|
|
7071
|
+
} else {
|
|
7072
|
+
errors.push(e);
|
|
7073
|
+
}
|
|
7074
|
+
}
|
|
7075
|
+
for (var i = 0; i < results.length; i++) {
|
|
7076
|
+
add(results[i]);
|
|
7077
|
+
}
|
|
7078
|
+
if (!errors.length) {
|
|
7079
|
+
callback(null, source);
|
|
7080
|
+
} else {
|
|
7081
|
+
fields = convertFieldsError(errors);
|
|
7082
|
+
callback(errors, fields);
|
|
7083
|
+
}
|
|
7084
|
+
}
|
|
7085
|
+
if (options.messages) {
|
|
7086
|
+
var messages$1 = this.messages();
|
|
7087
|
+
if (messages$1 === messages) {
|
|
7088
|
+
messages$1 = newMessages();
|
|
7089
|
+
}
|
|
7090
|
+
deepMerge(messages$1, options.messages);
|
|
7091
|
+
options.messages = messages$1;
|
|
7092
|
+
} else {
|
|
7093
|
+
options.messages = this.messages();
|
|
7094
|
+
}
|
|
7095
|
+
var series = {};
|
|
7096
|
+
var keys = options.keys || Object.keys(this.rules);
|
|
7097
|
+
keys.forEach(function(z) {
|
|
7098
|
+
var arr = _this2.rules[z];
|
|
7099
|
+
var value = source[z];
|
|
7100
|
+
arr.forEach(function(r) {
|
|
7101
|
+
var rule = r;
|
|
7102
|
+
if (typeof rule.transform === "function") {
|
|
7103
|
+
if (source === source_) {
|
|
7104
|
+
source = _extends({}, source);
|
|
7105
|
+
}
|
|
7106
|
+
value = source[z] = rule.transform(value);
|
|
7107
|
+
}
|
|
7108
|
+
if (typeof rule === "function") {
|
|
7109
|
+
rule = {
|
|
7110
|
+
validator: rule
|
|
7111
|
+
};
|
|
7112
|
+
} else {
|
|
7113
|
+
rule = _extends({}, rule);
|
|
7114
|
+
}
|
|
7115
|
+
rule.validator = _this2.getValidationMethod(rule);
|
|
7116
|
+
if (!rule.validator) {
|
|
7117
|
+
return;
|
|
7118
|
+
}
|
|
7119
|
+
rule.field = z;
|
|
7120
|
+
rule.fullField = rule.fullField || z;
|
|
7121
|
+
rule.type = _this2.getType(rule);
|
|
7122
|
+
series[z] = series[z] || [];
|
|
7123
|
+
series[z].push({
|
|
7124
|
+
rule,
|
|
7125
|
+
value,
|
|
7126
|
+
source,
|
|
7127
|
+
field: z
|
|
7128
|
+
});
|
|
7129
|
+
});
|
|
7130
|
+
});
|
|
7131
|
+
var errorFields = {};
|
|
7132
|
+
return asyncMap(series, options, function(data, doIt) {
|
|
7133
|
+
var rule = data.rule;
|
|
7134
|
+
var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
|
|
7135
|
+
deep = deep && (rule.required || !rule.required && data.value);
|
|
7136
|
+
rule.field = data.field;
|
|
7137
|
+
function addFullField(key, schema) {
|
|
7138
|
+
return _extends({}, schema, {
|
|
7139
|
+
fullField: rule.fullField + "." + key,
|
|
7140
|
+
fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
|
|
7141
|
+
});
|
|
7142
|
+
}
|
|
7143
|
+
function cb(e) {
|
|
7144
|
+
if (e === void 0) {
|
|
7145
|
+
e = [];
|
|
7146
|
+
}
|
|
7147
|
+
var errorList = Array.isArray(e) ? e : [e];
|
|
7148
|
+
if (!options.suppressWarning && errorList.length) {
|
|
7149
|
+
Schema2.warning("async-validator:", errorList);
|
|
7150
|
+
}
|
|
7151
|
+
if (errorList.length && rule.message !== void 0) {
|
|
7152
|
+
errorList = [].concat(rule.message);
|
|
7153
|
+
}
|
|
7154
|
+
var filledErrors = errorList.map(complementError(rule, source));
|
|
7155
|
+
if (options.first && filledErrors.length) {
|
|
7156
|
+
errorFields[rule.field] = 1;
|
|
7157
|
+
return doIt(filledErrors);
|
|
7158
|
+
}
|
|
7159
|
+
if (!deep) {
|
|
7160
|
+
doIt(filledErrors);
|
|
7161
|
+
} else {
|
|
7162
|
+
if (rule.required && !data.value) {
|
|
7163
|
+
if (rule.message !== void 0) {
|
|
7164
|
+
filledErrors = [].concat(rule.message).map(complementError(rule, source));
|
|
7165
|
+
} else if (options.error) {
|
|
7166
|
+
filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
|
|
7167
|
+
}
|
|
7168
|
+
return doIt(filledErrors);
|
|
7169
|
+
}
|
|
7170
|
+
var fieldsSchema = {};
|
|
7171
|
+
if (rule.defaultField) {
|
|
7172
|
+
Object.keys(data.value).map(function(key) {
|
|
7173
|
+
fieldsSchema[key] = rule.defaultField;
|
|
7174
|
+
});
|
|
7175
|
+
}
|
|
7176
|
+
fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
|
|
7177
|
+
var paredFieldsSchema = {};
|
|
7178
|
+
Object.keys(fieldsSchema).forEach(function(field) {
|
|
7179
|
+
var fieldSchema = fieldsSchema[field];
|
|
7180
|
+
var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
|
|
7181
|
+
paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
|
|
7182
|
+
});
|
|
7183
|
+
var schema = new Schema2(paredFieldsSchema);
|
|
7184
|
+
schema.messages(options.messages);
|
|
7185
|
+
if (data.rule.options) {
|
|
7186
|
+
data.rule.options.messages = options.messages;
|
|
7187
|
+
data.rule.options.error = options.error;
|
|
7188
|
+
}
|
|
7189
|
+
schema.validate(data.value, data.rule.options || options, function(errs) {
|
|
7190
|
+
var finalErrors = [];
|
|
7191
|
+
if (filledErrors && filledErrors.length) {
|
|
7192
|
+
finalErrors.push.apply(finalErrors, filledErrors);
|
|
7193
|
+
}
|
|
7194
|
+
if (errs && errs.length) {
|
|
7195
|
+
finalErrors.push.apply(finalErrors, errs);
|
|
7196
|
+
}
|
|
7197
|
+
doIt(finalErrors.length ? finalErrors : null);
|
|
7198
|
+
});
|
|
7199
|
+
}
|
|
7200
|
+
}
|
|
7201
|
+
var res;
|
|
7202
|
+
if (rule.asyncValidator) {
|
|
7203
|
+
res = rule.asyncValidator(rule, data.value, cb, data.source, options);
|
|
7204
|
+
} else if (rule.validator) {
|
|
7205
|
+
res = rule.validator(rule, data.value, cb, data.source, options);
|
|
7206
|
+
if (res === true) {
|
|
7207
|
+
cb();
|
|
7208
|
+
} else if (res === false) {
|
|
7209
|
+
cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
|
|
7210
|
+
} else if (res instanceof Array) {
|
|
7211
|
+
cb(res);
|
|
7212
|
+
} else if (res instanceof Error) {
|
|
7213
|
+
cb(res.message);
|
|
7214
|
+
}
|
|
7215
|
+
}
|
|
7216
|
+
if (res && res.then) {
|
|
7217
|
+
res.then(function() {
|
|
7218
|
+
return cb();
|
|
7219
|
+
}, function(e) {
|
|
7220
|
+
return cb(e);
|
|
7221
|
+
});
|
|
7222
|
+
}
|
|
7223
|
+
}, function(results) {
|
|
7224
|
+
complete(results);
|
|
7225
|
+
}, source);
|
|
7226
|
+
};
|
|
7227
|
+
_proto.getType = function getType(rule) {
|
|
7228
|
+
if (rule.type === void 0 && rule.pattern instanceof RegExp) {
|
|
7229
|
+
rule.type = "pattern";
|
|
7230
|
+
}
|
|
7231
|
+
if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
|
|
7232
|
+
throw new Error(format("Unknown rule type %s", rule.type));
|
|
7233
|
+
}
|
|
7234
|
+
return rule.type || "string";
|
|
7235
|
+
};
|
|
7236
|
+
_proto.getValidationMethod = function getValidationMethod(rule) {
|
|
7237
|
+
if (typeof rule.validator === "function") {
|
|
7238
|
+
return rule.validator;
|
|
7239
|
+
}
|
|
7240
|
+
var keys = Object.keys(rule);
|
|
7241
|
+
var messageIndex = keys.indexOf("message");
|
|
7242
|
+
if (messageIndex !== -1) {
|
|
7243
|
+
keys.splice(messageIndex, 1);
|
|
7244
|
+
}
|
|
7245
|
+
if (keys.length === 1 && keys[0] === "required") {
|
|
7246
|
+
return validators.required;
|
|
7247
|
+
}
|
|
7248
|
+
return validators[this.getType(rule)] || void 0;
|
|
7249
|
+
};
|
|
7250
|
+
return Schema2;
|
|
7251
|
+
}();
|
|
7252
|
+
Schema.register = function register(type4, validator) {
|
|
7253
|
+
if (typeof validator !== "function") {
|
|
7254
|
+
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
7255
|
+
}
|
|
7256
|
+
validators[type4] = validator;
|
|
7257
|
+
};
|
|
7258
|
+
Schema.warning = warning;
|
|
7259
|
+
Schema.messages = messages;
|
|
7260
|
+
Schema.validators = validators;
|
|
7261
|
+
var formItem = "";
|
|
7262
|
+
var FormItem = defineComponent({
|
|
7263
|
+
name: "DFormItem",
|
|
7264
|
+
props: formItemProps,
|
|
7265
|
+
setup(props, ctx2) {
|
|
7266
|
+
const formItemMitt = mitt();
|
|
7267
|
+
const dForm = reactive(inject(formInjectionKey, {}));
|
|
7268
|
+
const formData = reactive(dForm.formData);
|
|
7269
|
+
const columnsClass = ref(dForm.columnsClass);
|
|
7270
|
+
const initFormItemData = formData[props.prop];
|
|
7271
|
+
const labelData = reactive(dForm.labelData);
|
|
7272
|
+
const rules2 = reactive(dForm.rules);
|
|
7273
|
+
const resetField = () => {
|
|
7274
|
+
if (Array.isArray(initFormItemData)) {
|
|
7275
|
+
formData[props.prop] = [...initFormItemData];
|
|
7276
|
+
} else {
|
|
7277
|
+
formData[props.prop] = initFormItemData;
|
|
7278
|
+
}
|
|
7279
|
+
};
|
|
7280
|
+
const formItem2 = reactive({
|
|
7281
|
+
dHasFeedback: props.dHasFeedback,
|
|
7282
|
+
prop: props.prop,
|
|
7283
|
+
formItemMitt,
|
|
7284
|
+
resetField
|
|
7285
|
+
});
|
|
7286
|
+
provide(formItemInjectionKey, formItem2);
|
|
7287
|
+
const isHorizontal = labelData.layout === "horizontal";
|
|
7288
|
+
const isVertical = labelData.layout === "vertical";
|
|
7289
|
+
const isColumns = labelData.layout === "columns";
|
|
7290
|
+
const showMessage = ref(false);
|
|
7291
|
+
const tipMessage = ref("");
|
|
7292
|
+
const validate = (trigger) => {
|
|
7293
|
+
const ruleKey = props.prop;
|
|
7294
|
+
const ruleItem = rules2[ruleKey];
|
|
7295
|
+
const descriptor = {};
|
|
7296
|
+
descriptor[ruleKey] = ruleItem;
|
|
7297
|
+
const validator = new Schema(descriptor);
|
|
7298
|
+
validator.validate({
|
|
7299
|
+
[ruleKey]: formData[ruleKey]
|
|
7300
|
+
}).then(() => {
|
|
7301
|
+
showMessage.value = false;
|
|
7302
|
+
tipMessage.value = "";
|
|
7303
|
+
}).catch(({
|
|
7304
|
+
errors
|
|
7305
|
+
}) => {
|
|
7306
|
+
showMessage.value = true;
|
|
7307
|
+
tipMessage.value = errors[0].message;
|
|
6845
7308
|
});
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
7309
|
+
};
|
|
7310
|
+
const validateEvents = [];
|
|
7311
|
+
const addValidateEvents = () => {
|
|
7312
|
+
if (rules2 && rules2[props.prop]) {
|
|
7313
|
+
const ruleItem = rules2[props.prop];
|
|
7314
|
+
let eventName = ruleItem["trigger"];
|
|
7315
|
+
if (Array.isArray(ruleItem)) {
|
|
7316
|
+
ruleItem.forEach((item) => {
|
|
7317
|
+
eventName = item["trigger"];
|
|
7318
|
+
const cb = () => validate();
|
|
7319
|
+
validateEvents.push({
|
|
7320
|
+
eventName: cb
|
|
6856
7321
|
});
|
|
6857
|
-
|
|
6858
|
-
return result2;
|
|
6859
|
-
};
|
|
6860
|
-
LazyWrapper.prototype[methodName + "Right"] = function(n) {
|
|
6861
|
-
return this.reverse()[methodName](n).reverse();
|
|
6862
|
-
};
|
|
6863
|
-
});
|
|
6864
|
-
arrayEach(["filter", "map", "takeWhile"], function(methodName, index2) {
|
|
6865
|
-
var type4 = index2 + 1, isFilter = type4 == LAZY_FILTER_FLAG || type4 == LAZY_WHILE_FLAG;
|
|
6866
|
-
LazyWrapper.prototype[methodName] = function(iteratee2) {
|
|
6867
|
-
var result2 = this.clone();
|
|
6868
|
-
result2.__iteratees__.push({
|
|
6869
|
-
"iteratee": getIteratee(iteratee2, 3),
|
|
6870
|
-
"type": type4
|
|
7322
|
+
formItem2.formItemMitt.on(dFormItemEvents[eventName], cb);
|
|
6871
7323
|
});
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
arrayEach(["head", "last"], function(methodName, index2) {
|
|
6877
|
-
var takeName = "take" + (index2 ? "Right" : "");
|
|
6878
|
-
LazyWrapper.prototype[methodName] = function() {
|
|
6879
|
-
return this[takeName](1).value()[0];
|
|
6880
|
-
};
|
|
6881
|
-
});
|
|
6882
|
-
arrayEach(["initial", "tail"], function(methodName, index2) {
|
|
6883
|
-
var dropName = "drop" + (index2 ? "" : "Right");
|
|
6884
|
-
LazyWrapper.prototype[methodName] = function() {
|
|
6885
|
-
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
|
|
6886
|
-
};
|
|
6887
|
-
});
|
|
6888
|
-
LazyWrapper.prototype.compact = function() {
|
|
6889
|
-
return this.filter(identity);
|
|
6890
|
-
};
|
|
6891
|
-
LazyWrapper.prototype.find = function(predicate) {
|
|
6892
|
-
return this.filter(predicate).head();
|
|
6893
|
-
};
|
|
6894
|
-
LazyWrapper.prototype.findLast = function(predicate) {
|
|
6895
|
-
return this.reverse().find(predicate);
|
|
6896
|
-
};
|
|
6897
|
-
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
|
|
6898
|
-
if (typeof path == "function") {
|
|
6899
|
-
return new LazyWrapper(this);
|
|
6900
|
-
}
|
|
6901
|
-
return this.map(function(value) {
|
|
6902
|
-
return baseInvoke(value, path, args);
|
|
6903
|
-
});
|
|
6904
|
-
});
|
|
6905
|
-
LazyWrapper.prototype.reject = function(predicate) {
|
|
6906
|
-
return this.filter(negate(getIteratee(predicate)));
|
|
6907
|
-
};
|
|
6908
|
-
LazyWrapper.prototype.slice = function(start, end) {
|
|
6909
|
-
start = toInteger(start);
|
|
6910
|
-
var result2 = this;
|
|
6911
|
-
if (result2.__filtered__ && (start > 0 || end < 0)) {
|
|
6912
|
-
return new LazyWrapper(result2);
|
|
6913
|
-
}
|
|
6914
|
-
if (start < 0) {
|
|
6915
|
-
result2 = result2.takeRight(-start);
|
|
6916
|
-
} else if (start) {
|
|
6917
|
-
result2 = result2.drop(start);
|
|
6918
|
-
}
|
|
6919
|
-
if (end !== undefined$1) {
|
|
6920
|
-
end = toInteger(end);
|
|
6921
|
-
result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
|
|
6922
|
-
}
|
|
6923
|
-
return result2;
|
|
6924
|
-
};
|
|
6925
|
-
LazyWrapper.prototype.takeRightWhile = function(predicate) {
|
|
6926
|
-
return this.reverse().takeWhile(predicate).reverse();
|
|
6927
|
-
};
|
|
6928
|
-
LazyWrapper.prototype.toArray = function() {
|
|
6929
|
-
return this.take(MAX_ARRAY_LENGTH);
|
|
6930
|
-
};
|
|
6931
|
-
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|
6932
|
-
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash2[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
|
|
6933
|
-
if (!lodashFunc) {
|
|
6934
|
-
return;
|
|
6935
|
-
}
|
|
6936
|
-
lodash2.prototype[methodName] = function() {
|
|
6937
|
-
var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray(value);
|
|
6938
|
-
var interceptor = function(value2) {
|
|
6939
|
-
var result3 = lodashFunc.apply(lodash2, arrayPush([value2], args));
|
|
6940
|
-
return isTaker && chainAll ? result3[0] : result3;
|
|
6941
|
-
};
|
|
6942
|
-
if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
|
|
6943
|
-
isLazy = useLazy = false;
|
|
6944
|
-
}
|
|
6945
|
-
var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
|
|
6946
|
-
if (!retUnwrapped && useLazy) {
|
|
6947
|
-
value = onlyLazy ? value : new LazyWrapper(this);
|
|
6948
|
-
var result2 = func.apply(value, args);
|
|
6949
|
-
result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined$1 });
|
|
6950
|
-
return new LodashWrapper(result2, chainAll);
|
|
6951
|
-
}
|
|
6952
|
-
if (isUnwrapped && onlyLazy) {
|
|
6953
|
-
return func.apply(this, args);
|
|
6954
|
-
}
|
|
6955
|
-
result2 = this.thru(interceptor);
|
|
6956
|
-
return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
|
|
6957
|
-
};
|
|
6958
|
-
});
|
|
6959
|
-
arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
|
|
6960
|
-
var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
|
|
6961
|
-
lodash2.prototype[methodName] = function() {
|
|
6962
|
-
var args = arguments;
|
|
6963
|
-
if (retUnwrapped && !this.__chain__) {
|
|
6964
|
-
var value = this.value();
|
|
6965
|
-
return func.apply(isArray(value) ? value : [], args);
|
|
6966
|
-
}
|
|
6967
|
-
return this[chainName](function(value2) {
|
|
6968
|
-
return func.apply(isArray(value2) ? value2 : [], args);
|
|
7324
|
+
} else {
|
|
7325
|
+
const cb = () => validate();
|
|
7326
|
+
validateEvents.push({
|
|
7327
|
+
eventName: cb
|
|
6969
7328
|
});
|
|
6970
|
-
|
|
6971
|
-
});
|
|
6972
|
-
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|
6973
|
-
var lodashFunc = lodash2[methodName];
|
|
6974
|
-
if (lodashFunc) {
|
|
6975
|
-
var key = lodashFunc.name + "";
|
|
6976
|
-
if (!hasOwnProperty.call(realNames, key)) {
|
|
6977
|
-
realNames[key] = [];
|
|
6978
|
-
}
|
|
6979
|
-
realNames[key].push({ "name": methodName, "func": lodashFunc });
|
|
7329
|
+
ruleItem && formItem2.formItemMitt.on(dFormItemEvents[eventName], cb);
|
|
6980
7330
|
}
|
|
6981
|
-
});
|
|
6982
|
-
realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{
|
|
6983
|
-
"name": "wrapper",
|
|
6984
|
-
"func": undefined$1
|
|
6985
|
-
}];
|
|
6986
|
-
LazyWrapper.prototype.clone = lazyClone;
|
|
6987
|
-
LazyWrapper.prototype.reverse = lazyReverse;
|
|
6988
|
-
LazyWrapper.prototype.value = lazyValue;
|
|
6989
|
-
lodash2.prototype.at = wrapperAt;
|
|
6990
|
-
lodash2.prototype.chain = wrapperChain;
|
|
6991
|
-
lodash2.prototype.commit = wrapperCommit;
|
|
6992
|
-
lodash2.prototype.next = wrapperNext;
|
|
6993
|
-
lodash2.prototype.plant = wrapperPlant;
|
|
6994
|
-
lodash2.prototype.reverse = wrapperReverse;
|
|
6995
|
-
lodash2.prototype.toJSON = lodash2.prototype.valueOf = lodash2.prototype.value = wrapperValue;
|
|
6996
|
-
lodash2.prototype.first = lodash2.prototype.head;
|
|
6997
|
-
if (symIterator) {
|
|
6998
|
-
lodash2.prototype[symIterator] = wrapperToIterator;
|
|
6999
7331
|
}
|
|
7000
|
-
return lodash2;
|
|
7001
7332
|
};
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7333
|
+
const removeValidateEvents = () => {
|
|
7334
|
+
if (rules2 && rules2[props.prop] && validateEvents.length > 0) {
|
|
7335
|
+
validateEvents.forEach((item) => {
|
|
7336
|
+
formItem2.formItemMitt.off(item.eventName, item.cb);
|
|
7337
|
+
});
|
|
7338
|
+
}
|
|
7339
|
+
};
|
|
7340
|
+
onMounted(() => {
|
|
7341
|
+
dForm.formMitt.emit(dFormEvents.addField, formItem2);
|
|
7342
|
+
addValidateEvents();
|
|
7343
|
+
});
|
|
7344
|
+
onBeforeUnmount(() => {
|
|
7345
|
+
dForm.formMitt.emit(dFormEvents.removeField, formItem2);
|
|
7346
|
+
removeValidateEvents();
|
|
7347
|
+
});
|
|
7348
|
+
return () => {
|
|
7349
|
+
var _a, _b;
|
|
7350
|
+
return createVNode("div", {
|
|
7351
|
+
"class": `devui-form-item${isHorizontal ? "" : isVertical ? " devui-form-item-vertical" : " devui-form-item-columns"}${isColumns ? " devui-column-item " + columnsClass.value : ""}`
|
|
7352
|
+
}, [(_b = (_a = ctx2.slots).default) == null ? void 0 : _b.call(_a), createVNode("div", {
|
|
7353
|
+
"class": `devui-validate-tip${isHorizontal ? " devui-validate-tip-horizontal" : ""}`
|
|
7354
|
+
}, [showMessage.value && tipMessage.value])]);
|
|
7355
|
+
};
|
|
7356
|
+
}
|
|
7357
|
+
});
|
|
7358
|
+
function on(element, eventName, handler) {
|
|
7359
|
+
if (document.addEventListener) {
|
|
7360
|
+
if (element && eventName && handler) {
|
|
7361
|
+
element.addEventListener(eventName, handler, false);
|
|
7008
7362
|
}
|
|
7009
|
-
}
|
|
7010
|
-
|
|
7363
|
+
} else {
|
|
7364
|
+
if (element && eventName && handler) {
|
|
7365
|
+
element.attachEvent("on" + eventName, handler);
|
|
7366
|
+
}
|
|
7367
|
+
}
|
|
7368
|
+
}
|
|
7369
|
+
const ctx = Symbol("@@clickoutside");
|
|
7370
|
+
const nodeList = /* @__PURE__ */ new Map();
|
|
7371
|
+
let startClick;
|
|
7372
|
+
let nid = 0;
|
|
7373
|
+
let isFirst = true;
|
|
7374
|
+
function createDocumentHandler(el, binding, vnode) {
|
|
7375
|
+
if (inBrowser && isFirst) {
|
|
7376
|
+
isFirst = false;
|
|
7377
|
+
on(document, "mousedown", (e) => {
|
|
7378
|
+
startClick = e;
|
|
7379
|
+
});
|
|
7380
|
+
on(document, "mouseup", (e) => {
|
|
7381
|
+
for (const [id, node] of nodeList) {
|
|
7382
|
+
node[ctx].documentHandler(e, startClick);
|
|
7383
|
+
}
|
|
7384
|
+
});
|
|
7385
|
+
}
|
|
7386
|
+
return function(mouseup, mousedown) {
|
|
7387
|
+
if (!vnode || !binding.instance || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target) {
|
|
7388
|
+
return;
|
|
7389
|
+
}
|
|
7390
|
+
el[ctx].bindingFn && el[ctx].bindingFn();
|
|
7391
|
+
};
|
|
7392
|
+
}
|
|
7393
|
+
const clickoutsideDirective = {
|
|
7394
|
+
beforeMount: function(el, binding, vnode) {
|
|
7395
|
+
nid++;
|
|
7396
|
+
nodeList.set(nid, el);
|
|
7397
|
+
el[ctx] = {
|
|
7398
|
+
nid,
|
|
7399
|
+
documentHandler: createDocumentHandler(el, binding, vnode),
|
|
7400
|
+
bindingFn: binding.value
|
|
7401
|
+
};
|
|
7402
|
+
},
|
|
7403
|
+
updated: function(el, binding, vnode) {
|
|
7404
|
+
el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
|
|
7405
|
+
el[ctx].bindingFn = binding.value;
|
|
7406
|
+
},
|
|
7407
|
+
unmounted: function(el) {
|
|
7408
|
+
nodeList.delete(el[ctx].nid);
|
|
7409
|
+
delete el[ctx];
|
|
7410
|
+
}
|
|
7411
|
+
};
|
|
7011
7412
|
var formControl = "";
|
|
7012
7413
|
var FormControl = defineComponent({
|
|
7013
7414
|
name: "DFormControl",
|
|
@@ -7087,7 +7488,7 @@ var FormControl = defineComponent({
|
|
|
7087
7488
|
extraInfo
|
|
7088
7489
|
} = props;
|
|
7089
7490
|
return withDirectives(createVNode("div", {
|
|
7090
|
-
"class": "form-control",
|
|
7491
|
+
"class": "devui-form-control",
|
|
7091
7492
|
"ref": formControl2,
|
|
7092
7493
|
"data-uid": uid
|
|
7093
7494
|
}, [showPopover.value && createVNode(Teleport, {
|
|
@@ -7109,12 +7510,12 @@ var FormControl = defineComponent({
|
|
|
7109
7510
|
"position": popPosition.value
|
|
7110
7511
|
}, null)])]
|
|
7111
7512
|
}), createVNode("div", {
|
|
7112
|
-
"class": `devui-form-control-container${isHorizontal ? " devui-form-control-container-horizontal" : ""}${feedbackStatus ? " has-feedback" : ""}${feedbackStatus === "error" ? " feedback-error" : ""}`
|
|
7513
|
+
"class": `devui-form-control-container${isHorizontal ? " devui-form-control-container-horizontal" : ""}${feedbackStatus ? " devui-has-feedback" : ""}${feedbackStatus === "error" ? " devui-feedback-error" : ""}`
|
|
7113
7514
|
}, [createVNode("div", {
|
|
7114
7515
|
"class": "devui-control-content-wrapper",
|
|
7115
7516
|
"id": uid
|
|
7116
7517
|
}, [(_b = (_a = ctx2.slots).default) == null ? void 0 : _b.call(_a)]), (feedbackStatus || ((_d = (_c = ctx2.slots).suffixTemplate) == null ? void 0 : _d.call(_c))) && createVNode("span", {
|
|
7117
|
-
"class": "feedback-status"
|
|
7518
|
+
"class": "devui-feedback-status"
|
|
7118
7519
|
}, [((_f = (_e = ctx2.slots).suffixTemplate) == null ? void 0 : _f.call(_e)) ? (_h = (_g = ctx2.slots).suffixTemplate) == null ? void 0 : _h.call(_g) : createVNode(Icon, {
|
|
7119
7520
|
"name": iconData.value.name,
|
|
7120
7521
|
"color": iconData.value.color
|
|
@@ -7132,7 +7533,7 @@ var FormOperation = defineComponent({
|
|
|
7132
7533
|
return () => {
|
|
7133
7534
|
var _a, _b;
|
|
7134
7535
|
return createVNode("div", {
|
|
7135
|
-
"class": "form-operation"
|
|
7536
|
+
"class": "devui-form-operation"
|
|
7136
7537
|
}, [(_b = (_a = ctx2.slots).default) == null ? void 0 : _b.call(_a)]);
|
|
7137
7538
|
};
|
|
7138
7539
|
}
|
|
@@ -7260,18 +7661,19 @@ function getKeyValueOfObjectList(obj) {
|
|
|
7260
7661
|
}
|
|
7261
7662
|
function handleErrorStrategy(el) {
|
|
7262
7663
|
const classList = [...el.classList];
|
|
7263
|
-
classList.push("
|
|
7664
|
+
classList.push("devui-validate-rules-error-pristine");
|
|
7264
7665
|
el.setAttribute("class", classList.join(" "));
|
|
7265
7666
|
}
|
|
7266
7667
|
function handleErrorStrategyPass(el) {
|
|
7267
7668
|
const classList = [...el.classList];
|
|
7268
|
-
const index2 = classList.indexOf("
|
|
7669
|
+
const index2 = classList.indexOf("devui-validate-rules-error-pristine");
|
|
7269
7670
|
index2 !== -1 && classList.splice(index2, 1);
|
|
7270
7671
|
el.setAttribute("class", classList.join(" "));
|
|
7271
7672
|
}
|
|
7272
7673
|
function getFormControlUID(el) {
|
|
7273
|
-
if (el.tagName.toLocaleLowerCase() === "body")
|
|
7674
|
+
if (el.tagName.toLocaleLowerCase() === "body") {
|
|
7274
7675
|
return "";
|
|
7676
|
+
}
|
|
7275
7677
|
if (el.parentElement.id.startsWith("dfc-")) {
|
|
7276
7678
|
return el.parentElement.id;
|
|
7277
7679
|
} else {
|
|
@@ -7292,7 +7694,7 @@ function handleValidateError({ el, tipEl, message = "", isFormTag, messageShowTy
|
|
|
7292
7694
|
}
|
|
7293
7695
|
tipEl.innerText = "" + message;
|
|
7294
7696
|
tipEl.style.display = "inline-flex";
|
|
7295
|
-
tipEl.setAttribute("class", "
|
|
7697
|
+
tipEl.setAttribute("class", "devui-validate-tip");
|
|
7296
7698
|
handleErrorStrategy(el);
|
|
7297
7699
|
}
|
|
7298
7700
|
function handleValidatePass(el, tipEl) {
|
|
@@ -7314,8 +7716,9 @@ function validateFn({ validator, modelValue, el, tipEl, isFormTag, messageShowTy
|
|
|
7314
7716
|
handleValidatePass(el, tipEl);
|
|
7315
7717
|
}).catch((err) => {
|
|
7316
7718
|
const { errors } = err;
|
|
7317
|
-
if (!errors || errors.length === 0)
|
|
7719
|
+
if (!errors || errors.length === 0) {
|
|
7318
7720
|
return;
|
|
7721
|
+
}
|
|
7319
7722
|
let msg = "";
|
|
7320
7723
|
if (typeof errors[0].message === "object") {
|
|
7321
7724
|
msg = errors[0].message.default;
|