fly-el-form 0.0.28 → 0.0.30
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/lib/fly-el-form.es.js +7 -7
- package/lib/fly-el-form.umd.js +2948 -4
- package/lib/style.css +123 -1
- package/package.json +15 -1
package/lib/fly-el-form.umd.js
CHANGED
|
@@ -1,8 +1,2952 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
(function(global2, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.FlyElForm = {}, global2.Vue));
|
|
3
|
+
})(this, function(exports2, vue) {
|
|
4
|
+
"use strict";
|
|
5
|
+
const requireTypes = {
|
|
6
|
+
"el-input": "string",
|
|
7
|
+
"el-input-number": "number",
|
|
8
|
+
"el-radio": "boolean",
|
|
9
|
+
"el-radio-group": "string",
|
|
10
|
+
"el-checkbox": "boolean",
|
|
11
|
+
"el-checkbox-group": "array",
|
|
12
|
+
"el-switch": "boolean",
|
|
13
|
+
"el-select": "string",
|
|
14
|
+
// 默认
|
|
15
|
+
"el-time-select": "string",
|
|
16
|
+
"el-date-picker": "date",
|
|
17
|
+
// 默认
|
|
18
|
+
"el-cascader": "array",
|
|
19
|
+
"el-rate": "number",
|
|
20
|
+
"el-slider": "number",
|
|
21
|
+
"el-color-picker": "string"
|
|
22
|
+
};
|
|
23
|
+
const hasOwnPropertySafely = (obj, key) => {
|
|
24
|
+
if (!obj || !key) return false;
|
|
25
|
+
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
26
|
+
};
|
|
27
|
+
var _a;
|
|
28
|
+
const isClient = typeof window !== "undefined";
|
|
29
|
+
const isString$1 = (val) => typeof val === "string";
|
|
30
|
+
const noop = () => {
|
|
31
|
+
};
|
|
32
|
+
isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
33
|
+
function resolveUnref(r) {
|
|
34
|
+
return typeof r === "function" ? r() : vue.unref(r);
|
|
35
|
+
}
|
|
36
|
+
function identity(arg) {
|
|
37
|
+
return arg;
|
|
38
|
+
}
|
|
39
|
+
function tryOnScopeDispose(fn) {
|
|
40
|
+
if (vue.getCurrentScope()) {
|
|
41
|
+
vue.onScopeDispose(fn);
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
function tryOnMounted(fn, sync = true) {
|
|
47
|
+
if (vue.getCurrentInstance())
|
|
48
|
+
vue.onMounted(fn);
|
|
49
|
+
else if (sync)
|
|
50
|
+
fn();
|
|
51
|
+
else
|
|
52
|
+
vue.nextTick(fn);
|
|
53
|
+
}
|
|
54
|
+
function useTimeoutFn(cb, interval, options = {}) {
|
|
55
|
+
const {
|
|
56
|
+
immediate = true
|
|
57
|
+
} = options;
|
|
58
|
+
const isPending = vue.ref(false);
|
|
59
|
+
let timer = null;
|
|
60
|
+
function clear() {
|
|
61
|
+
if (timer) {
|
|
62
|
+
clearTimeout(timer);
|
|
63
|
+
timer = null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function stop() {
|
|
67
|
+
isPending.value = false;
|
|
68
|
+
clear();
|
|
69
|
+
}
|
|
70
|
+
function start(...args) {
|
|
71
|
+
clear();
|
|
72
|
+
isPending.value = true;
|
|
73
|
+
timer = setTimeout(() => {
|
|
74
|
+
isPending.value = false;
|
|
75
|
+
timer = null;
|
|
76
|
+
cb(...args);
|
|
77
|
+
}, resolveUnref(interval));
|
|
78
|
+
}
|
|
79
|
+
if (immediate) {
|
|
80
|
+
isPending.value = true;
|
|
81
|
+
if (isClient)
|
|
82
|
+
start();
|
|
83
|
+
}
|
|
84
|
+
tryOnScopeDispose(stop);
|
|
85
|
+
return {
|
|
86
|
+
isPending: vue.readonly(isPending),
|
|
87
|
+
start,
|
|
88
|
+
stop
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function unrefElement(elRef) {
|
|
92
|
+
var _a2;
|
|
93
|
+
const plain = resolveUnref(elRef);
|
|
94
|
+
return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
|
|
95
|
+
}
|
|
96
|
+
const defaultWindow = isClient ? window : void 0;
|
|
97
|
+
function useEventListener(...args) {
|
|
98
|
+
let target;
|
|
99
|
+
let events;
|
|
100
|
+
let listeners;
|
|
101
|
+
let options;
|
|
102
|
+
if (isString$1(args[0]) || Array.isArray(args[0])) {
|
|
103
|
+
[events, listeners, options] = args;
|
|
104
|
+
target = defaultWindow;
|
|
105
|
+
} else {
|
|
106
|
+
[target, events, listeners, options] = args;
|
|
107
|
+
}
|
|
108
|
+
if (!target)
|
|
109
|
+
return noop;
|
|
110
|
+
if (!Array.isArray(events))
|
|
111
|
+
events = [events];
|
|
112
|
+
if (!Array.isArray(listeners))
|
|
113
|
+
listeners = [listeners];
|
|
114
|
+
const cleanups = [];
|
|
115
|
+
const cleanup = () => {
|
|
116
|
+
cleanups.forEach((fn) => fn());
|
|
117
|
+
cleanups.length = 0;
|
|
118
|
+
};
|
|
119
|
+
const register = (el, event, listener, options2) => {
|
|
120
|
+
el.addEventListener(event, listener, options2);
|
|
121
|
+
return () => el.removeEventListener(event, listener, options2);
|
|
122
|
+
};
|
|
123
|
+
const stopWatch = vue.watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
|
|
124
|
+
cleanup();
|
|
125
|
+
if (!el)
|
|
126
|
+
return;
|
|
127
|
+
cleanups.push(...events.flatMap((event) => {
|
|
128
|
+
return listeners.map((listener) => register(el, event, listener, options2));
|
|
129
|
+
}));
|
|
130
|
+
}, { immediate: true, flush: "post" });
|
|
131
|
+
const stop = () => {
|
|
132
|
+
stopWatch();
|
|
133
|
+
cleanup();
|
|
134
|
+
};
|
|
135
|
+
tryOnScopeDispose(stop);
|
|
136
|
+
return stop;
|
|
137
|
+
}
|
|
138
|
+
function useSupported(callback, sync = false) {
|
|
139
|
+
const isSupported = vue.ref();
|
|
140
|
+
const update = () => isSupported.value = Boolean(callback());
|
|
141
|
+
update();
|
|
142
|
+
tryOnMounted(update, sync);
|
|
143
|
+
return isSupported;
|
|
144
|
+
}
|
|
145
|
+
const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
146
|
+
const globalKey = "__vueuse_ssr_handlers__";
|
|
147
|
+
_global[globalKey] = _global[globalKey] || {};
|
|
148
|
+
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
149
|
+
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
150
|
+
var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
|
|
151
|
+
var __objRest$2 = (source, exclude) => {
|
|
152
|
+
var target = {};
|
|
153
|
+
for (var prop in source)
|
|
154
|
+
if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
155
|
+
target[prop] = source[prop];
|
|
156
|
+
if (source != null && __getOwnPropSymbols$g)
|
|
157
|
+
for (var prop of __getOwnPropSymbols$g(source)) {
|
|
158
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
|
|
159
|
+
target[prop] = source[prop];
|
|
160
|
+
}
|
|
161
|
+
return target;
|
|
162
|
+
};
|
|
163
|
+
function useResizeObserver(target, callback, options = {}) {
|
|
164
|
+
const _a2 = options, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
|
|
165
|
+
let observer;
|
|
166
|
+
const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
|
|
167
|
+
const cleanup = () => {
|
|
168
|
+
if (observer) {
|
|
169
|
+
observer.disconnect();
|
|
170
|
+
observer = void 0;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const stopWatch = vue.watch(() => unrefElement(target), (el) => {
|
|
174
|
+
cleanup();
|
|
175
|
+
if (isSupported.value && window2 && el) {
|
|
176
|
+
observer = new ResizeObserver(callback);
|
|
177
|
+
observer.observe(el, observerOptions);
|
|
178
|
+
}
|
|
179
|
+
}, { immediate: true, flush: "post" });
|
|
180
|
+
const stop = () => {
|
|
181
|
+
cleanup();
|
|
182
|
+
stopWatch();
|
|
183
|
+
};
|
|
184
|
+
tryOnScopeDispose(stop);
|
|
185
|
+
return {
|
|
186
|
+
isSupported,
|
|
187
|
+
stop
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
var SwipeDirection;
|
|
191
|
+
(function(SwipeDirection2) {
|
|
192
|
+
SwipeDirection2["UP"] = "UP";
|
|
193
|
+
SwipeDirection2["RIGHT"] = "RIGHT";
|
|
194
|
+
SwipeDirection2["DOWN"] = "DOWN";
|
|
195
|
+
SwipeDirection2["LEFT"] = "LEFT";
|
|
196
|
+
SwipeDirection2["NONE"] = "NONE";
|
|
197
|
+
})(SwipeDirection || (SwipeDirection = {}));
|
|
198
|
+
var __defProp = Object.defineProperty;
|
|
199
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
200
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
201
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
202
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
203
|
+
var __spreadValues = (a, b) => {
|
|
204
|
+
for (var prop in b || (b = {}))
|
|
205
|
+
if (__hasOwnProp.call(b, prop))
|
|
206
|
+
__defNormalProp(a, prop, b[prop]);
|
|
207
|
+
if (__getOwnPropSymbols)
|
|
208
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
209
|
+
if (__propIsEnum.call(b, prop))
|
|
210
|
+
__defNormalProp(a, prop, b[prop]);
|
|
211
|
+
}
|
|
212
|
+
return a;
|
|
213
|
+
};
|
|
214
|
+
const _TransitionPresets = {
|
|
215
|
+
easeInSine: [0.12, 0, 0.39, 0],
|
|
216
|
+
easeOutSine: [0.61, 1, 0.88, 1],
|
|
217
|
+
easeInOutSine: [0.37, 0, 0.63, 1],
|
|
218
|
+
easeInQuad: [0.11, 0, 0.5, 0],
|
|
219
|
+
easeOutQuad: [0.5, 1, 0.89, 1],
|
|
220
|
+
easeInOutQuad: [0.45, 0, 0.55, 1],
|
|
221
|
+
easeInCubic: [0.32, 0, 0.67, 0],
|
|
222
|
+
easeOutCubic: [0.33, 1, 0.68, 1],
|
|
223
|
+
easeInOutCubic: [0.65, 0, 0.35, 1],
|
|
224
|
+
easeInQuart: [0.5, 0, 0.75, 0],
|
|
225
|
+
easeOutQuart: [0.25, 1, 0.5, 1],
|
|
226
|
+
easeInOutQuart: [0.76, 0, 0.24, 1],
|
|
227
|
+
easeInQuint: [0.64, 0, 0.78, 0],
|
|
228
|
+
easeOutQuint: [0.22, 1, 0.36, 1],
|
|
229
|
+
easeInOutQuint: [0.83, 0, 0.17, 1],
|
|
230
|
+
easeInExpo: [0.7, 0, 0.84, 0],
|
|
231
|
+
easeOutExpo: [0.16, 1, 0.3, 1],
|
|
232
|
+
easeInOutExpo: [0.87, 0, 0.13, 1],
|
|
233
|
+
easeInCirc: [0.55, 0, 1, 0.45],
|
|
234
|
+
easeOutCirc: [0, 0.55, 0.45, 1],
|
|
235
|
+
easeInOutCirc: [0.85, 0, 0.15, 1],
|
|
236
|
+
easeInBack: [0.36, 0, 0.66, -0.56],
|
|
237
|
+
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
238
|
+
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
239
|
+
};
|
|
240
|
+
__spreadValues({
|
|
241
|
+
linear: identity
|
|
242
|
+
}, _TransitionPresets);
|
|
243
|
+
/**
|
|
3
244
|
* @vue/shared v3.5.13
|
|
4
245
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
246
|
* @license MIT
|
|
6
247
|
**/
|
|
7
|
-
|
|
8
|
-
/*! Element Plus Icons Vue v2.3.1 */var $e=t.defineComponent({name:"CircleCloseFilled",__name:"circle-close-filled",setup:e=>(e,o)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"})]))}),Te=t.defineComponent({name:"Close",__name:"close",setup:e=>(e,o)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})]))}),Be=t.defineComponent({name:"InfoFilled",__name:"info-filled",setup:e=>(e,o)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"})]))}),Ae=t.defineComponent({name:"SuccessFilled",__name:"success-filled",setup:e=>(e,o)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"})]))}),Ie=t.defineComponent({name:"WarningFilled",__name:"warning-filled",setup:e=>(e,o)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"})]))});const De="__epPropKey",ze=(e,o)=>{if(!j(e)||j(n=e)&&n[De])return e;var n;const{values:r,required:a,default:l,type:s,validator:u}=e,i=r||u?n=>{let a=!1,s=[];if(r&&(s=Array.from(r),x(e,"default")&&s.push(l),a||(a=s.includes(n))),u&&(a||(a=u(n))),!a&&s.length>0){const e=[...new Set(s)].map((e=>JSON.stringify(e))).join(", ");t.warn(`Invalid prop: validation failed${o?` for prop "${o}"`:""}. Expected one of [${e}], got value ${JSON.stringify(n)}.`)}return a}:void 0,c={type:s,required:!!a,validator:i,[De]:!0};return x(e,"default")&&(c.default=l),c},Re=e=>function(e){for(var t=-1,o=null==e?0:e.length,n={};++t<o;){var r=e[t];n[r[0]]=r[1]}return n}(Object.entries(e).map((([e,t])=>[e,ze(t,e)]))),Le=[String,Object,Function],Me={Close:Te,SuccessFilled:Ae,InfoFilled:Be,WarningFilled:Ie,CircleCloseFilled:$e},Ke={success:Ae,warning:Ie,error:$e,info:Be},qe=(e,t)=>(e.install=t=>{for(const o of[e,...Object.values({})])t.component(o.name,o)},e),Ue="Escape";var He={name:"en",el:{breadcrumb:{label:"Breadcrumb"},colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color.",alphaLabel:"pick alpha value"},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",week:"week",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},mention:{loading:"Loading"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},tour:{next:"Next",previous:"Previous",finish:"Finish"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"},carousel:{leftArrow:"Carousel arrow left",rightArrow:"Carousel arrow right",indicator:"Carousel switch to index {index}"}}};const Qe=e=>(o,n)=>We(o,n,t.unref(e)),We=(e,t,o)=>xe(o,e,e).replace(/\{(\w+)\}/g,((e,o)=>{var n;return`${null!=(n=null==t?void 0:t[o])?n:`{${o}}`}`})),Ze=Symbol("localeContextKey"),Je=e=>{const o=e||t.inject(Ze,t.ref());return(e=>({lang:t.computed((()=>t.unref(e).name)),locale:t.isRef(e)?e:t.ref(e),t:Qe(e)}))(t.computed((()=>o.value||He)))},Ge="el",Ye=(e,t,o,n,r)=>{let a=`${e}-${t}`;return o&&(a+=`-${o}`),n&&(a+=`__${n}`),r&&(a+=`--${r}`),a},Xe=Symbol("namespaceContextKey"),et=(e,o)=>{const n=(e=>{const o=e||(t.getCurrentInstance()?t.inject(Xe,t.ref(Ge)):t.ref(Ge));return t.computed((()=>t.unref(o)||Ge))})(o);return{namespace:n,b:(t="")=>Ye(n.value,e,t,"",""),e:t=>t?Ye(n.value,e,"",t,""):"",m:t=>t?Ye(n.value,e,"","",t):"",be:(t,o)=>t&&o?Ye(n.value,e,t,o,""):"",em:(t,o)=>t&&o?Ye(n.value,e,"",t,o):"",bm:(t,o)=>t&&o?Ye(n.value,e,t,"",o):"",bem:(t,o,r)=>t&&o&&r?Ye(n.value,e,t,o,r):"",is:(e,...t)=>{const o=!(t.length>=1)||t[0];return e&&o?`is-${e}`:""},cssVar:e=>{const t={};for(const o in e)e[o]&&(t[`--${n.value}-${o}`]=e[o]);return t},cssVarName:e=>`--${n.value}-${e}`,cssVarBlock:t=>{const o={};for(const r in t)t[r]&&(o[`--${n.value}-${e}-${r}`]=t[r]);return o},cssVarBlockName:t=>`--${n.value}-${e}-${t}`}},tt={current:0},ot=t.ref(0),nt=Symbol("elZIndexContextKey"),rt=Symbol("zIndexContextKey"),at=ze({type:String,values:["","default","small","large"],required:!1}),lt=Symbol("size"),st=Symbol("emptyValuesContextKey"),ut=Re({emptyValues:Array,valueOnClear:{type:[String,Number,Boolean,Function],default:void 0,validator:e=>E(e)?!e():!e}}),it=Symbol(),ct=t.ref();function pt(e,o=void 0){return t.getCurrentInstance()?t.inject(it,ct):ct}function dt(e,o){const n=pt(),r=et(e,t.computed((()=>{var e;return(null==(e=n.value)?void 0:e.namespace)||Ge}))),l=Je(t.computed((()=>{var e;return null==(e=n.value)?void 0:e.locale}))),s=(e=>{const o=t.getCurrentInstance()?t.inject(nt,tt):tt,n=e||(t.getCurrentInstance()?t.inject(rt,void 0):void 0),r=t.computed((()=>{const e=t.unref(n);return Ne(e)?e:2e3})),l=t.computed((()=>r.value+ot.value));return a||t.inject(nt)||Pe("ZIndexInjection","Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed\nusage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })"),{initialZIndex:r,currentZIndex:l,nextZIndex:()=>(o.current++,ot.value=o.current,l.value)}})(t.computed((()=>{var e;return(null==(e=n.value)?void 0:e.zIndex)||2e3}))),u=t.computed((()=>{var e;return t.unref(o)||(null==(e=n.value)?void 0:e.size)||""}));return ft(t.computed((()=>t.unref(n)||{}))),{ns:r,locale:l,zIndex:s,size:u}}const ft=(e,o,n=!1)=>{const r=!!t.getCurrentInstance(),a=r?pt():void 0,l=null!=void 0?undefined:r?t.provide:void 0;if(!l)return void Pe("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");const s=t.computed((()=>{const o=t.unref(e);return(null==a?void 0:a.value)?mt(a.value,o):o}));return l(it,s),l(Ze,t.computed((()=>s.value.locale))),l(Xe,t.computed((()=>s.value.namespace))),l(rt,t.computed((()=>s.value.zIndex))),l(lt,{size:t.computed((()=>s.value.size||""))}),l(st,t.computed((()=>({emptyValues:s.value.emptyValues,valueOnClear:s.value.valueOnClear})))),!n&&ct.value||(ct.value=s.value),s},mt=(e,t)=>{const o=[...new Set([...je(e),...je(t)])],n={};for(const r of o)n[r]=void 0!==t[r]?t[r]:e[r];return n},yt=Re({a11y:{type:Boolean,default:!0},locale:{type:Object},size:at,button:{type:Object},experimentalFeatures:{type:Object},keyboardNavigation:{type:Boolean,default:!0},message:{type:Object},zIndex:Number,namespace:{type:String,default:"el"},...ut}),ht={};t.defineComponent({name:"ElConfigProvider",props:yt,setup(e,{slots:o}){t.watch((()=>e.message),(e=>{Object.assign(ht,null!=e?e:{})}),{immediate:!0,deep:!0});const n=ft(e);return()=>t.renderSlot(o,"default",{config:null==n?void 0:n.value})}});var vt=(e,t)=>{const o=e.__vccOpts||e;for(const[n,r]of t)o[n]=r;return o};const gt=Re({size:{type:[Number,String]},color:{type:String}}),bt=t.defineComponent({name:"ElIcon",inheritAttrs:!1});const wt=qe(vt(t.defineComponent({...bt,props:gt,setup(e){const o=e,n=et("icon"),r=t.computed((()=>{const{size:e,color:t}=o;return e||t?{fontSize:(n=e,void 0===n?void 0:Fe(e)),"--color":t}:{};var n}));return(e,o)=>(t.openBlock(),t.createElementBlock("i",t.mergeProps({class:t.unref(n).b(),style:t.unref(r)},e.$attrs),[t.renderSlot(e.$slots,"default")],16))}}),[["__file","icon.vue"]])),Ct=Re({value:{type:[String,Number],default:""},max:{type:Number,default:99},isDot:Boolean,hidden:Boolean,type:{type:String,values:["primary","success","warning","info","danger"],default:"danger"},showZero:{type:Boolean,default:!0},color:String,badgeStyle:{type:[String,Object,Array]},offset:{type:Array,default:[0,0]},badgeClass:{type:String}}),kt=t.defineComponent({name:"ElBadge"});const St=qe(vt(t.defineComponent({...kt,props:Ct,setup(e,{expose:o}){const n=e,r=et("badge"),a=t.computed((()=>n.isDot?"":Ne(n.value)&&Ne(n.max)&&n.max<n.value?`${n.max}+`:`${n.value}`)),l=t.computed((()=>{var e,t,o,r,a;return[{backgroundColor:n.color,marginRight:Fe(-(null!=(t=null==(e=n.offset)?void 0:e[0])?t:0)),marginTop:Fe(null!=(r=null==(o=n.offset)?void 0:o[1])?r:0)},null!=(a=n.badgeStyle)?a:{}]}));return o({content:a}),(e,o)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(t.unref(r).b())},[t.renderSlot(e.$slots,"default"),t.createVNode(t.Transition,{name:`${t.unref(r).namespace.value}-zoom-in-center`,persisted:""},{default:t.withCtx((()=>[t.withDirectives(t.createElementVNode("sup",{class:t.normalizeClass([t.unref(r).e("content"),t.unref(r).em("content",e.type),t.unref(r).is("fixed",!!e.$slots.default),t.unref(r).is("dot",e.isDot),t.unref(r).is("hide-zero",!e.showZero&&0===n.value),e.badgeClass]),style:t.normalizeStyle(t.unref(l)),textContent:t.toDisplayString(t.unref(a))},null,14,["textContent"]),[[t.vShow,!e.hidden&&(t.unref(a)||e.isDot)]])])),_:1},8,["name"])],2))}}),[["__file","badge.vue"]])),_t=["success","info","warning","error"],Ot={customClass:"",center:!1,dangerouslyUseHTMLString:!1,duration:3e3,icon:void 0,id:"",message:"",onClose:void 0,showClose:!1,type:"info",plain:!1,offset:16,zIndex:0,grouping:!1,repeatNum:1,appendTo:a?document.body:void 0},xt=Re({customClass:{type:String,default:Ot.customClass},center:{type:Boolean,default:Ot.center},dangerouslyUseHTMLString:{type:Boolean,default:Ot.dangerouslyUseHTMLString},duration:{type:Number,default:Ot.duration},icon:{type:Le,default:Ot.icon},id:{type:String,default:Ot.id},message:{type:[String,Object,Function],default:Ot.message},onClose:{type:Function,default:Ot.onClose},showClose:{type:Boolean,default:Ot.showClose},type:{type:String,values:_t,default:Ot.type},plain:{type:Boolean,default:Ot.plain},offset:{type:Number,default:Ot.offset},zIndex:{type:Number,default:Ot.zIndex},grouping:{type:Boolean,default:Ot.grouping},repeatNum:{type:Number,default:Ot.repeatNum}}),Et=t.shallowReactive([]),Nt=e=>{const{prev:t}=(e=>{const t=Et.findIndex((t=>t.id===e)),o=Et[t];let n;return t>0&&(n=Et[t-1]),{current:o,prev:n}})(e);return t?t.vm.exposed.bottom.value:0},jt=t.defineComponent({name:"ElMessage"}),Vt=t.defineComponent({...jt,props:xt,emits:{destroy:()=>!0},setup(e,{expose:o}){const n=e,{Close:r}=Me,{ns:p,zIndex:d}=dt("message"),{currentZIndex:f,nextZIndex:m}=d,y=t.ref(),h=t.ref(!1),v=t.ref(0);let g;const w=t.computed((()=>n.type?"error"===n.type?"danger":n.type:"info")),C=t.computed((()=>{const e=n.type;return{[p.bm("icon",e)]:e&&Ke[e]}})),k=t.computed((()=>n.icon||Ke[n.type]||"")),S=t.computed((()=>Nt(n.id))),_=t.computed((()=>((e,t)=>Et.findIndex((t=>t.id===e))>0?16:t)(n.id,n.offset)+S.value)),O=t.computed((()=>v.value+_.value)),x=t.computed((()=>({top:`${_.value}px`,zIndex:f.value})));function E(){0!==n.duration&&({stop:g}=function(e,o,n={}){const{immediate:r=!0}=n,l=t.ref(!1);let i=null;function c(){i&&(clearTimeout(i),i=null)}function p(){l.value=!1,c()}function d(...t){c(),l.value=!0,i=setTimeout((()=>{l.value=!1,i=null,e(...t)}),s(o))}return r&&(l.value=!0,a&&d()),u(p),{isPending:t.readonly(l),start:d,stop:p}}((()=>{j()}),n.duration))}function N(){null==g||g()}function j(){h.value=!1}return t.onMounted((()=>{E(),m(),h.value=!0})),t.watch((()=>n.repeatNum),(()=>{N(),E()})),function(...e){let o,n,r,a;if("string"==typeof e[0]||Array.isArray(e[0])?([n,r,a]=e,o=c):[o,n,r,a]=e,!o)return l;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const p=[],d=()=>{p.forEach((e=>e())),p.length=0},f=t.watch((()=>[i(o),s(a)]),(([e,t])=>{d(),e&&p.push(...n.flatMap((o=>r.map((n=>((e,t,o,n)=>(e.addEventListener(t,o,n),()=>e.removeEventListener(t,o,n)))(e,o,n,t))))))}),{immediate:!0,flush:"post"}),m=()=>{f(),d()};u(m)}(document,"keydown",(function({code:e}){e===Ue&&j()})),b(y,(()=>{v.value=y.value.getBoundingClientRect().height})),o({visible:h,bottom:O,close:j}),(e,o)=>(t.openBlock(),t.createBlock(t.Transition,{name:t.unref(p).b("fade"),onBeforeLeave:e.onClose,onAfterLeave:t=>e.$emit("destroy"),persisted:""},{default:t.withCtx((()=>[t.withDirectives(t.createElementVNode("div",{id:e.id,ref_key:"messageRef",ref:y,class:t.normalizeClass([t.unref(p).b(),{[t.unref(p).m(e.type)]:e.type},t.unref(p).is("center",e.center),t.unref(p).is("closable",e.showClose),t.unref(p).is("plain",e.plain),e.customClass]),style:t.normalizeStyle(t.unref(x)),role:"alert",onMouseenter:N,onMouseleave:E},[e.repeatNum>1?(t.openBlock(),t.createBlock(t.unref(St),{key:0,value:e.repeatNum,type:t.unref(w),class:t.normalizeClass(t.unref(p).e("badge"))},null,8,["value","type","class"])):t.createCommentVNode("v-if",!0),t.unref(k)?(t.openBlock(),t.createBlock(t.unref(wt),{key:1,class:t.normalizeClass([t.unref(p).e("icon"),t.unref(C)])},{default:t.withCtx((()=>[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(k))))])),_:1},8,["class"])):t.createCommentVNode("v-if",!0),t.renderSlot(e.$slots,"default",{},(()=>[e.dangerouslyUseHTMLString?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),t.createElementVNode("p",{class:t.normalizeClass(t.unref(p).e("content")),innerHTML:e.message},null,10,["innerHTML"])],2112)):(t.openBlock(),t.createElementBlock("p",{key:0,class:t.normalizeClass(t.unref(p).e("content"))},t.toDisplayString(e.message),3))])),e.showClose?(t.openBlock(),t.createBlock(t.unref(wt),{key:2,class:t.normalizeClass(t.unref(p).e("closeBtn")),onClick:t.withModifiers(j,["stop"])},{default:t.withCtx((()=>[t.createVNode(t.unref(r))])),_:1},8,["class","onClick"])):t.createCommentVNode("v-if",!0)],46,["id"]),[[t.vShow,h.value]])])),_:3},8,["name","onBeforeLeave","onAfterLeave"]))}});var Pt=vt(Vt,[["__file","message.vue"]]);let Ft=1;const $t=e=>{const o=!e||N(e)||t.isVNode(e)||E(e)?{message:e}:e,n={...Ot,...o};if(n.appendTo){if(N(n.appendTo)){let e=document.querySelector(n.appendTo);r=e,"undefined"!=typeof Element&&r instanceof Element||(Pe("ElMessage","the appendTo option is not an HTMLElement. Falling back to document.body."),e=document.body),n.appendTo=e}}else n.appendTo=document.body;var r;return Ee(ht.grouping)&&!n.grouping&&(n.grouping=ht.grouping),Ne(ht.duration)&&3e3===n.duration&&(n.duration=ht.duration),Ne(ht.offset)&&16===n.offset&&(n.offset=ht.offset),Ee(ht.showClose)&&!n.showClose&&(n.showClose=ht.showClose),n},Tt=({appendTo:e,...o},n)=>{const r="message_"+Ft++,a=o.onClose,l=document.createElement("div"),s={...o,id:r,onClose:()=>{null==a||a(),(e=>{const t=Et.indexOf(e);if(-1===t)return;Et.splice(t,1);const{handler:o}=e;o.close()})(p)},onDestroy:()=>{t.render(null,l)}},u=t.createVNode(Pt,s,E(s.message)||t.isVNode(s.message)?{default:E(s.message)?s.message:()=>s.message}:null);u.appContext=n||Bt._context,t.render(u,l),e.appendChild(l.firstElementChild);const i=u.component,c={close:()=>{i.exposed.visible.value=!1}},p={id:r,vnode:u,vm:i,handler:c,props:u.component.props};return p},Bt=(e={},t)=>{if(!a)return{close:()=>{}};const o=$t(e);if(o.grouping&&Et.length){const e=Et.find((({vnode:e})=>{var t;return(null==(t=e.props)?void 0:t.message)===o.message}));if(e)return e.props.repeatNum+=1,e.props.type=o.type,e.handler}if(Ne(ht.max)&&Et.length>=ht.max)return{close:()=>{}};const n=Tt(o,t);return Et.push(n),n.handler};_t.forEach((e=>{Bt[e]=(t={},o)=>{const n=$t(t);return Bt({...n,type:e},o)}})),Bt.closeAll=function(e){for(const t of Et)e&&e!==t.props.type||t.handler.close()},Bt._context=null;const At=(Dt="$message",(It=Bt).install=e=>{It._context=e._context,e.config.globalProperties[Dt]=It},It);var It,Dt;const zt=Symbol("formValues"),Rt=t.defineComponent({name:"FlyElForm",props:{model:{type:String,default:"form"},singleStepErrorTip:{type:Boolean,default:!1},inlineBlock:{type:Boolean,default:!1},form:{type:Object,require:!0},status:{type:String,default:"create"},formProps:{type:Object,default:()=>({})},formEvents:{type:Object,default:()=>({})},formItemProps:{type:Object,default:()=>({})},formRowProps:{type:Object,default:()=>({gutter:10})},formColProps:{type:Object,default:()=>({xs:24,sm:12,md:12,lg:6})},showFooter:{type:Boolean,default:!0},footerRowProps:{type:Object,default:()=>({})},action:{type:Array,default:()=>["submit","reset"]},actionProps:{type:Object,default:()=>({})},strict:{type:Boolean,default:!1}},setup(e,r){const a=t.ref(!0),l=t.ref({}),s=t.ref({}),u=t.ref({}),i=t.ref({}),c=t.ref({}),p=t.ref({}),d=t.reactive({}),f=t.ref(null),m=t.ref({}),y=t.ref([]),h=t.ref(null),v=t.ref({}),g=(e,t)=>{if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const r of o)if(!g(e[r],t[r]))return!1;return!0},b=()=>{m.value&&(Object.keys(m.value).forEach((e=>{n(c.value,e)&&(c.value[e]=m.value[e])})),m.value={})},w=async e=>{const o=C(e),r=o.rules;Object.keys(u.value).forEach((e=>{n(r,e)||delete u.value[e]}));for(const t in r)n(r,t)&&(n(u.value,t)&&g(u.value[t],r[t])||(u.value[t]=r[t]));const i=o.requests;Object.keys(s.value).forEach((e=>{n(i,e)||delete s.value[e]}));for(const t in i)n(i,t)&&s.value[t]!==i[t]&&(s.value[t]=i[t]);const f=o.formKeyAndName||{};Object.keys(d).forEach((e=>{n(f,e)||delete d[e]}));for(const t in f)n(f,t)&&d[t]!==f[t]&&(d[t]=f[t]);if(l.value=o.formContent,a.value){const e=Object.keys(o.requests).map((e=>o.requests[e]()));p.value=Object.assign({},o.formData),e&&e.length>0&&await Promise.allSettled(e).catch((e=>{})),c.value=Object.assign({},o.formData),m.value&&(b(m.value),m.value={}),t.nextTick((()=>{a.value=!1}))}},C=(e=[])=>{const t={formContent:[],formData:{},rules:{},requests:{},formKeyAndName:{}},r=["el-input","el-input-number"];return e.forEach((e=>{if(!n(e,"type")&&!n(e,"hidden"))throw new Error("form item type is required.");if(n(e,"key")){if(n(t.formKeyAndName,e.key))throw new Error(`form item key "${e.key}" is duplicated in the current form definition. Please use another key.`);t.formKeyAndName[e.key]=e.name,"el-input-number"===e.type?t.formData[e.key]=n(e,"value")?e.value:null:"el-checkbox-group"===e.type?t.formData[e.key]=n(e,"value")?e.value:[]:n(e,"type")&&"el-row"!==e.type&&"title"!==e.type&&(t.formData[e.key]=n(e,"value")?e.value:void 0)}if(n(e,"rules")&&e.rules.length>0&&(t.rules[e.key]=e.rules),e.required){const a=n(e,"requiredType")?e.requiredType:o[e.type]||"string",l={required:!0,message:`${r.includes(e.type)?"请填写":"请选择"}${e.name}`,trigger:"change",type:a};n(t.rules,e.key)&&t.rules[e.key].length>0?t.rules[e.key]=[l,...t.rules[e.key]]:t.rules[e.key]=[l]}n(e,"source")&&n(e.source,"requestFunction")?t.requests[e.key]=k(e):n(e,"source")&&n(e.source,"data")&&e.source?(i.value[e.key]=e.source.data,e.source.returnSource&&y.value.push(e.key)):!n(i.value,e.key)&&(i.value[e.key]=[]),e.placeholder||(e.placeholder=(r.includes(e.type)?"请填写":"请选择")+e.name);const a={...e};if(n(a,"source")&&delete a.source,"el-row"===e.type&&n(e,"children")&&e.children.length>0){const o=C(e.children);t.rules={...t.rules,...o.rules},t.formData={...t.formData,...o.formData},t.requests={...t.requests,...o.requests},t.formKeyAndName={...t.formKeyAndName,...o.formKeyAndName},a.children=o.formContent}t.formContent.push(a)})),t},k=e=>{const t=e.source;return async function(){try{const{requestFunction:o,params:n,handle:r,effectKeys:a,effectKeysHandle:l}=t;let s=n||{};if(a&&a.length>0){const e={};for(let t=0;t<a.length;t++)e[a[t]]=c.value[a[t]];s={...s,...e},l&&"function"==typeof l&&(s=l({params:s,formValues:c.value,sourceData:i.value,effectKeys:a}))}const u=await o(s);return i.value[e.key]=r?r(u,s,c.value||p.value):u,u}catch(o){return{error:o}}}};return w(e.form),t.watch(e.form,(async(e,t)=>{await w(e)}),{deep:!0}),t.watch((()=>u.value),(e=>{f.value&&f.value.clearValidate()}),{deep:!0}),t.provide(zt,c),{isFirstInit:a,formContent:l,requests:s,rules:u,sourceData:i,formInitValues:p,formKeyAndName:d,formValues:c,FlyFormRef:f,needOverWriteForm:m,overWrite:b,needReturnSourceKeys:y,updateTimeout:h,componentRefs:v,setComponentRef:e=>t=>{t&&(v.value[e]=t)},getComponentRefByKey:e=>e&&"string"==typeof e?v.value[e]:null}},methods:{async submit(){const e=this.$refs.FlyFormRef;await e.validate(((e,t)=>{let o={valid:e,formValues:this.formValues};if(this.needReturnSourceKeys&&this.needReturnSourceKeys.length>0){let e={};this.needReturnSourceKeys.forEach((t=>{e[t]=this.sourceData[t]})),o.sourceData=e}if(this.$emit("submit",o),!e&&"search"===this.$props.model){const e=[],o=[];Object.keys(t).forEach((n=>{const r=t[n][0];e.push(r.message),o.push(this.formKeyAndName[n])})),this.$props.singleStepErrorTip?At.error(e[0]):At.error(`请完善${o.length>0?o.join("、"):"查询条件"}`)}}))},getFormRef(){try{return this.$refs.FlyFormRef}catch(e){}},getComponentRefByKey(e){if(!e||"string"!=typeof e)return!1;try{return this.$refs[e]}catch(t){}},reset(){this.$refs.FlyFormRef.resetFields(),this.$emit("reset")},setFormValues(e){const o=this.$refs.FlyFormRef;e&&t.nextTick((async()=>{try{o&&(await o.resetFields(),this.isFirstInit?this.needOverWriteForm=e:Object.keys(e).forEach((t=>{n(this.formValues,t)&&(this.formValues[t]=e[t])})))}catch(t){}}))},async updateSource(e){if(!e)return;let t=[];if(Array.isArray(e)){for(let o=0;o<e.length;o++){let r=e[o];n(r,"key")&&(n(r,"value")?this.sourceData[r.key]=r.value:t.push(r.key))}t.length>0?await this.updateRequestSource(t):this.$forceUpdate()}},async updateRequestSource(e){if(!e)return;let t=[];if(Array.isArray(e))for(let o=0;o<e.length;o++)t.push(this.requests[e[o]]());else t=[this.requests[e]()];0!==t.length&&(await Promise.allSettled(t).catch((e=>{})),this.$forceUpdate())},setKeyValue(e,t){n(this.formValues,e)&&(this.formValues[e]=t)},getFormValues(){return this.formValues},clearValidate(e){const t=this.$refs.FlyFormRef;e?window.requestAnimationFrame((()=>{t.clearValidate(e)})):this.$nextTick((()=>{window.requestAnimationFrame((()=>{t.clearValidate()}))}))}},render(e){const r=()=>{const o={reset:t.h(t.resolveComponent("el-button"),{type:"default",onClick:()=>{this.reset()}},{default:()=>"重置"}),submit:t.h(t.resolveComponent("el-button"),{type:"primary",onClick:()=>{this.submit()}},{default:()=>"search"===e.model?"搜索":"create"===e.status?"保存":"修改"})};if(e.action)return e.action.map((r=>n(e.actionProps,r)?t.h(t.resolveComponent("el-button"),{type:"default",...e.actionProps[r].componentProps,onClick:()=>{["submit","reset"].includes(r)&&this[r]()},...e.actionProps[r].componentEvents},{default:()=>e.actionProps[r].text||""}):o[r]))},a=()=>{if(e.showFooter)return t.h(t.resolveComponent("el-row"),{...e.formRowProps,class:"fly-form-footer",justify:"end",...e.footerRowProps},{default:()=>r()})},l=o=>{const r=[];return o.children&&o.children.length>0&&o.children.forEach((t=>{if(n(t,"visitable")&&t.visitable&&t.visitable(e.status,this.formValues)||!n(t,"visitable")&&n(t,"type")){const e=s(t);r.push(e)}})),t.h(t.resolveComponent("el-row"),{...e.formRowProps,...o.componentProps,class:`fly-form-row ${o.class?o.class:""}`,style:{...o.style}},{default:()=>r})},s=o=>{const r=o.colProps?o.colProps:{};if(n(o,"hidden")&&o.hidden)return null;return t.h(t.resolveComponent("el-col"),{...e.formColProps,...r,key:o.key},{default:()=>p(o)})},u=e=>{const o=e.componentProps?e.componentProps:{};return t.h(t.resolveComponent("el-row"),{...o},[t.h("h3",{class:`fly-form-title ${e.class?e.class:""}`,style:{...e.style}},{default:()=>e.slot?e.slot:e.name})])},i=e=>{if(!n(e,"hidden"))return p(e)},c=e=>{if(!n(e,"hidden"))return t.h(t.resolveComponent("el-row"),{class:"fly-form-row"},{default:()=>p(e)})},p=e=>{const o=e.tips?{label:()=>S(e),default:()=>d(e)}:{default:()=>d(e)};return t.h(t.resolveComponent("el-form-item"),{key:e.key,prop:e.key,label:e.name,class:`fly-form-item ${e.class?e.class:""}`,...e.formItemProps},o)},d=e=>{switch(e.type){case"el-select":case"el-select-v2":return b(e);case"el-radio-group":return y(e);case"el-checkbox-group":return v(e);case"el-upload":return O(e);default:return f(e)}},f=r=>e.strict&&n(o,r.type)||!e.strict?r.slot?t.h(t.resolveComponent(r.type),{ref:this.setComponentRef(r.key),...k(r),...m(r),...r.componentProps,attrs:{placeholder:r.placeholder},..._(r),...r.componentEvents},{default:()=>r.slot(t.h)}):t.h(t.resolveComponent(r.type),{ref:this.setComponentRef(r.key),...k(r),...m(r),...r.componentProps,attrs:{placeholder:r.placeholder},..._(r),...r.componentEvents}):t.h("span",{style:{color:"red"}},`Unaccepted component types '${r.type}'`),m=e=>{const t={};return["AutoComplete","el-transfer"].includes(e.type)&&n(this.sourceData,e.key)?t.data=this.sourceData[e.key]:"el-cascader"==e.type&&n(this.sourceData,e.key)?t.options=this.sourceData[e.key]:t.data=[],t},y=e=>t.h(t.resolveComponent("el-radio-group"),{ref:this.setComponentRef(e.key),modelValue:this.formValues[e.key],"onUpdate:modelValue":t=>{this.formValues[e.key]=t},...e.componentProps,...e.componentEvents},{default:()=>h(e,this.sourceData[e.key])}),h=(e,o)=>{const n=o&&o.length>0?o:e.options||[],r=[],{optionProps:a}=e;for(let l=0;l<n.length;l++){const o=n[l],s=t.h(t.resolveComponent("el-radio"),{value:e.showValue&&o[e.showValue]||o.value,...a},{default:()=>o[e.showName||"label"]});r.push(s)}return r},v=e=>t.h(t.resolveComponent("el-checkbox-group"),{ref:this.setComponentRef(e.key),modelValue:this.formValues[e.key],"onUpdate:modelValue":t=>{this.formValues[e.key]=t},...e.componentProps,...e.componentEvents},{default:()=>g(e,this.sourceData[e.key])}),g=(e,o)=>{const n=o&&o.length>0?o:e.options||[],r=[],{optionProps:a}=e;for(let l=0;l<n.length;l++){const o=n[l],s=t.h(t.resolveComponent("el-checkbox"),{value:e.showValue&&o[e.showValue]||o.value,...a,key:e.showValue&&o[e.showValue]||o.value},{default:()=>o[e.showName||"label"]});r.push(s)}return r},b=e=>{var o;const n=this,r=e.options||this.sourceData[e.key]||[];let a={"onUpdate:modelValue":t=>{this.formValues[e.key]=t}};e.effectKeys&&e.effectKeys.length>0&&(a={"onUpdate:modelValue":o=>{this.formValues[e.key]=o,t.nextTick((()=>{this.updateTimeout||(this.updateTimeout=setTimeout((()=>{n.updateRequestSource(e.effectKeys),this.updateTimeout=null}),100))}))}});const l={ref:this.setComponentRef(e.key),modelValue:this.formValues[e.key],placeholder:e.placeholder,...a,...e.componentProps,...e.componentEvents};(null==(o=e.custom)?void 0:o.returnObject)&&(l["value-key"]=e.showValue||"value"),"el-select-v2"===e.type&&(l.options=Array.isArray(r)?r:[],l.key=`${e.key}-${Date.now()}`),"el-select-v2"===e.type&&e.optionSlot;let s={default:()=>null};return"el-select-v2"===e.type?s.default=o=>e.optionSlot?e.optionSlot(o,t.h):null:"el-select"===e.type&&(s.default=()=>{var t;return(null==(t=e.custom)?void 0:t.group)?w(e,r):C(e,Array.isArray(r)?r:[])}),t.h(t.resolveComponent(e.type),l,s)},w=(e,o={})=>{const n=[],r=t.resolveComponent("el-option-group");for(const a in o){const l=t.h(r,{label:a},{default:()=>C(e,o[a])});n.push(l)}return n},C=(e,o=[])=>{var n;return Array.isArray(o)||(null==(n=e.custom)?void 0:n.group)?o.map((o=>{var n;const r=(null==(n=e.custom)?void 0:n.returnObject)?o:o[e.showValue||"value"];o[e.showName||"label"];const a={value:r,key:o[e.showValue||"value"],label:o[e.showName||"label"],disabled:o.disabled,...e.optionProps},l=e.optionSlot&&"function"==typeof e.optionSlot?{default:()=>e.optionSlot(o,t.h)}:{default:()=>o[e.showName||"label"]};return t.h(t.resolveComponent("el-option"),a,l)})):[]},k=e=>({modelValue:this.formValues[e.key],"onUpdate:modelValue":t=>{this.formValues[e.key]=t},placeholder:e.placeholder}),S=e=>t.h("span",{class:"fly-form-item-tips"},[e.name,t.h(t.resolveComponent("el-popover"),{placement:"top-start",title:"提示",width:200,trigger:"hover",...e.tipLabelProps},{reference:()=>t.h(t.resolveComponent("el-icon"),{class:"fly-form-item-tips-icon"},{default:()=>t.h(t.resolveComponent("QuestionFilled"))}),default:()=>e.tips||""})]),_=e=>["el-date-picker"].includes(e.type)?{"on-change":t=>{var o,n;this.formValues[e.key]=t,e.effectKeys&&e.effectKeys.length>0&&this.updateRequestSource(e.effectKeys),null==(n=null==(o=e.componentEvents)?void 0:o["on-change"])||n.call(o,t)}}:{"onUpdate:modelValue":t=>{var o,n;this.formValues[e.key]=t,e.effectKeys&&e.effectKeys.length>0&&this.updateRequestSource(e.effectKeys),null==(n=null==(o=e.componentEvents)?void 0:o["onUpdate:modelValue"])||n.call(o,t)}},O=e=>{const o={};e.uploadSlots&&(e.uploadSlots.default&&(o.default=()=>e.uploadSlots.default(t.h)),e.uploadSlots.trigger&&(o.trigger=()=>e.uploadSlots.trigger(t.h)),e.uploadSlots.tip&&(o.tip=()=>e.uploadSlots.tip(t.h)),e.uploadSlots.file&&(o.file=o=>e.uploadSlots.file(o,t.h)),e.uploadSlots.fileList&&(o.fileList=o=>e.uploadSlots.fileList(o,t.h))),o.default||o.trigger||(o.default=()=>t.h(t.resolveComponent("el-button"),{type:"primary"},{default:()=>"点击上传"}));const n=t.ref((r=this.formValues[e.key])&&Array.isArray(r)?r.map((e=>"string"==typeof e?{name:e,url:e,uid:Date.now()+Math.random()}:e)):[]);var r;return t.h(t.resolveComponent("el-upload"),{ref:this.setComponentRef(e.key),"file-list":n.value,"onUpdate:file-list":t=>{n.value=t,this.formValues[e.key]=t},...e.componentProps,...e.componentEvents,"on-success":(t,o,r)=>{var a,l;Array.isArray(r)?(n.value=r,this.formValues[e.key]=r):(Array.isArray(n.value)||(n.value=[]),n.value.push(o),this.formValues[e.key]=n.value),null==(l=null==(a=e.componentEvents)?void 0:a["on-success"])||l.call(a,t,o,r)}},o)},x=(t=>{if(!t)return[];const o=[];for(let r=0;r<t.length;r++){const a=t[r];if(["el-row","Title"].includes(a.type))switch(a.type){case"el-row":o.push(l(a));break;case"Title":case"title":o.push(u(a))}else if(n(a,"visitable")&&a.visitable(e.status,this.formValues)||!n(a,"visitable")){const t=e.inlineBlock||"search"==e.model?i(a):c(a);o.push(t)}}return o})(this.formContent),E=e.formProps||{};"search"==e.model&&(E.inline=!0);const N=t.h(t.resolveComponent("ElForm"),{ref:"FlyFormRef",model:this.formValues,rules:this.rules,...E,labelPosition:E.hideLabel?"top":E.labelPosition,...e.formEvents},{default:()=>[...x,"form"==e.model?a():r()]});return t.h("div",{class:`fly-form ${e.formProps&&e.formProps.hideLabel?"fly-form-hide-label":""} ${e.formProps&&e.formProps.class||""} ${"search"==e.model?"fly-search":""}`},N)}});Rt.install=e=>{e.component(Rt.name,Rt)},e.default=Rt,e.useFormValues=function(){const e=t.inject(zt);if(!e)throw new Error("useFormValues must be used within FlyElForm");return e},Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
248
|
+
!!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
249
|
+
!!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
|
|
250
|
+
const hasOwnProperty$4 = Object.prototype.hasOwnProperty;
|
|
251
|
+
const hasOwn = (val, key) => hasOwnProperty$4.call(val, key);
|
|
252
|
+
const isFunction$1 = (val) => typeof val === "function";
|
|
253
|
+
const isString = (val) => typeof val === "string";
|
|
254
|
+
const isObject$1 = (val) => val !== null && typeof val === "object";
|
|
255
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
256
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
257
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
|
258
|
+
var Symbol$1 = root.Symbol;
|
|
259
|
+
var objectProto$4 = Object.prototype;
|
|
260
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
261
|
+
var nativeObjectToString$1 = objectProto$4.toString;
|
|
262
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
263
|
+
function getRawTag(value) {
|
|
264
|
+
var isOwn = hasOwnProperty$3.call(value, symToStringTag$1), tag = value[symToStringTag$1];
|
|
265
|
+
try {
|
|
266
|
+
value[symToStringTag$1] = void 0;
|
|
267
|
+
var unmasked = true;
|
|
268
|
+
} catch (e) {
|
|
269
|
+
}
|
|
270
|
+
var result = nativeObjectToString$1.call(value);
|
|
271
|
+
if (unmasked) {
|
|
272
|
+
if (isOwn) {
|
|
273
|
+
value[symToStringTag$1] = tag;
|
|
274
|
+
} else {
|
|
275
|
+
delete value[symToStringTag$1];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return result;
|
|
279
|
+
}
|
|
280
|
+
var objectProto$3 = Object.prototype;
|
|
281
|
+
var nativeObjectToString = objectProto$3.toString;
|
|
282
|
+
function objectToString(value) {
|
|
283
|
+
return nativeObjectToString.call(value);
|
|
284
|
+
}
|
|
285
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
286
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
287
|
+
function baseGetTag(value) {
|
|
288
|
+
if (value == null) {
|
|
289
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
290
|
+
}
|
|
291
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
292
|
+
}
|
|
293
|
+
function isObjectLike(value) {
|
|
294
|
+
return value != null && typeof value == "object";
|
|
295
|
+
}
|
|
296
|
+
var symbolTag = "[object Symbol]";
|
|
297
|
+
function isSymbol(value) {
|
|
298
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
299
|
+
}
|
|
300
|
+
function arrayMap(array, iteratee) {
|
|
301
|
+
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
|
|
302
|
+
while (++index < length) {
|
|
303
|
+
result[index] = iteratee(array[index], index, array);
|
|
304
|
+
}
|
|
305
|
+
return result;
|
|
306
|
+
}
|
|
307
|
+
var isArray = Array.isArray;
|
|
308
|
+
var INFINITY$1 = 1 / 0;
|
|
309
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
310
|
+
function baseToString(value) {
|
|
311
|
+
if (typeof value == "string") {
|
|
312
|
+
return value;
|
|
313
|
+
}
|
|
314
|
+
if (isArray(value)) {
|
|
315
|
+
return arrayMap(value, baseToString) + "";
|
|
316
|
+
}
|
|
317
|
+
if (isSymbol(value)) {
|
|
318
|
+
return symbolToString ? symbolToString.call(value) : "";
|
|
319
|
+
}
|
|
320
|
+
var result = value + "";
|
|
321
|
+
return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
|
|
322
|
+
}
|
|
323
|
+
function isObject(value) {
|
|
324
|
+
var type = typeof value;
|
|
325
|
+
return value != null && (type == "object" || type == "function");
|
|
326
|
+
}
|
|
327
|
+
var asyncTag = "[object AsyncFunction]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
|
|
328
|
+
function isFunction(value) {
|
|
329
|
+
if (!isObject(value)) {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
var tag = baseGetTag(value);
|
|
333
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
334
|
+
}
|
|
335
|
+
var coreJsData = root["__core-js_shared__"];
|
|
336
|
+
var maskSrcKey = function() {
|
|
337
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
338
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
|
339
|
+
}();
|
|
340
|
+
function isMasked(func) {
|
|
341
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
342
|
+
}
|
|
343
|
+
var funcProto$1 = Function.prototype;
|
|
344
|
+
var funcToString$1 = funcProto$1.toString;
|
|
345
|
+
function toSource(func) {
|
|
346
|
+
if (func != null) {
|
|
347
|
+
try {
|
|
348
|
+
return funcToString$1.call(func);
|
|
349
|
+
} catch (e) {
|
|
350
|
+
}
|
|
351
|
+
try {
|
|
352
|
+
return func + "";
|
|
353
|
+
} catch (e) {
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return "";
|
|
357
|
+
}
|
|
358
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
359
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
360
|
+
var funcProto = Function.prototype, objectProto$2 = Object.prototype;
|
|
361
|
+
var funcToString = funcProto.toString;
|
|
362
|
+
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
363
|
+
var reIsNative = RegExp(
|
|
364
|
+
"^" + funcToString.call(hasOwnProperty$2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
365
|
+
);
|
|
366
|
+
function baseIsNative(value) {
|
|
367
|
+
if (!isObject(value) || isMasked(value)) {
|
|
368
|
+
return false;
|
|
369
|
+
}
|
|
370
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
371
|
+
return pattern.test(toSource(value));
|
|
372
|
+
}
|
|
373
|
+
function getValue(object, key) {
|
|
374
|
+
return object == null ? void 0 : object[key];
|
|
375
|
+
}
|
|
376
|
+
function getNative(object, key) {
|
|
377
|
+
var value = getValue(object, key);
|
|
378
|
+
return baseIsNative(value) ? value : void 0;
|
|
379
|
+
}
|
|
380
|
+
function eq(value, other) {
|
|
381
|
+
return value === other || value !== value && other !== other;
|
|
382
|
+
}
|
|
383
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
|
|
384
|
+
function isKey(value, object) {
|
|
385
|
+
if (isArray(value)) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
var type = typeof value;
|
|
389
|
+
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
|
|
393
|
+
}
|
|
394
|
+
var nativeCreate = getNative(Object, "create");
|
|
395
|
+
function hashClear() {
|
|
396
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
397
|
+
this.size = 0;
|
|
398
|
+
}
|
|
399
|
+
function hashDelete(key) {
|
|
400
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
401
|
+
this.size -= result ? 1 : 0;
|
|
402
|
+
return result;
|
|
403
|
+
}
|
|
404
|
+
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
|
|
405
|
+
var objectProto$1 = Object.prototype;
|
|
406
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
407
|
+
function hashGet(key) {
|
|
408
|
+
var data = this.__data__;
|
|
409
|
+
if (nativeCreate) {
|
|
410
|
+
var result = data[key];
|
|
411
|
+
return result === HASH_UNDEFINED$1 ? void 0 : result;
|
|
412
|
+
}
|
|
413
|
+
return hasOwnProperty$1.call(data, key) ? data[key] : void 0;
|
|
414
|
+
}
|
|
415
|
+
var objectProto = Object.prototype;
|
|
416
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
417
|
+
function hashHas(key) {
|
|
418
|
+
var data = this.__data__;
|
|
419
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
|
|
420
|
+
}
|
|
421
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
422
|
+
function hashSet(key, value) {
|
|
423
|
+
var data = this.__data__;
|
|
424
|
+
this.size += this.has(key) ? 0 : 1;
|
|
425
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
426
|
+
return this;
|
|
427
|
+
}
|
|
428
|
+
function Hash(entries) {
|
|
429
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
430
|
+
this.clear();
|
|
431
|
+
while (++index < length) {
|
|
432
|
+
var entry = entries[index];
|
|
433
|
+
this.set(entry[0], entry[1]);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
Hash.prototype.clear = hashClear;
|
|
437
|
+
Hash.prototype["delete"] = hashDelete;
|
|
438
|
+
Hash.prototype.get = hashGet;
|
|
439
|
+
Hash.prototype.has = hashHas;
|
|
440
|
+
Hash.prototype.set = hashSet;
|
|
441
|
+
function listCacheClear() {
|
|
442
|
+
this.__data__ = [];
|
|
443
|
+
this.size = 0;
|
|
444
|
+
}
|
|
445
|
+
function assocIndexOf(array, key) {
|
|
446
|
+
var length = array.length;
|
|
447
|
+
while (length--) {
|
|
448
|
+
if (eq(array[length][0], key)) {
|
|
449
|
+
return length;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return -1;
|
|
453
|
+
}
|
|
454
|
+
var arrayProto = Array.prototype;
|
|
455
|
+
var splice = arrayProto.splice;
|
|
456
|
+
function listCacheDelete(key) {
|
|
457
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
458
|
+
if (index < 0) {
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
var lastIndex = data.length - 1;
|
|
462
|
+
if (index == lastIndex) {
|
|
463
|
+
data.pop();
|
|
464
|
+
} else {
|
|
465
|
+
splice.call(data, index, 1);
|
|
466
|
+
}
|
|
467
|
+
--this.size;
|
|
468
|
+
return true;
|
|
469
|
+
}
|
|
470
|
+
function listCacheGet(key) {
|
|
471
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
472
|
+
return index < 0 ? void 0 : data[index][1];
|
|
473
|
+
}
|
|
474
|
+
function listCacheHas(key) {
|
|
475
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
476
|
+
}
|
|
477
|
+
function listCacheSet(key, value) {
|
|
478
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
479
|
+
if (index < 0) {
|
|
480
|
+
++this.size;
|
|
481
|
+
data.push([key, value]);
|
|
482
|
+
} else {
|
|
483
|
+
data[index][1] = value;
|
|
484
|
+
}
|
|
485
|
+
return this;
|
|
486
|
+
}
|
|
487
|
+
function ListCache(entries) {
|
|
488
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
489
|
+
this.clear();
|
|
490
|
+
while (++index < length) {
|
|
491
|
+
var entry = entries[index];
|
|
492
|
+
this.set(entry[0], entry[1]);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
ListCache.prototype.clear = listCacheClear;
|
|
496
|
+
ListCache.prototype["delete"] = listCacheDelete;
|
|
497
|
+
ListCache.prototype.get = listCacheGet;
|
|
498
|
+
ListCache.prototype.has = listCacheHas;
|
|
499
|
+
ListCache.prototype.set = listCacheSet;
|
|
500
|
+
var Map = getNative(root, "Map");
|
|
501
|
+
function mapCacheClear() {
|
|
502
|
+
this.size = 0;
|
|
503
|
+
this.__data__ = {
|
|
504
|
+
"hash": new Hash(),
|
|
505
|
+
"map": new (Map || ListCache)(),
|
|
506
|
+
"string": new Hash()
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
function isKeyable(value) {
|
|
510
|
+
var type = typeof value;
|
|
511
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
512
|
+
}
|
|
513
|
+
function getMapData(map, key) {
|
|
514
|
+
var data = map.__data__;
|
|
515
|
+
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
516
|
+
}
|
|
517
|
+
function mapCacheDelete(key) {
|
|
518
|
+
var result = getMapData(this, key)["delete"](key);
|
|
519
|
+
this.size -= result ? 1 : 0;
|
|
520
|
+
return result;
|
|
521
|
+
}
|
|
522
|
+
function mapCacheGet(key) {
|
|
523
|
+
return getMapData(this, key).get(key);
|
|
524
|
+
}
|
|
525
|
+
function mapCacheHas(key) {
|
|
526
|
+
return getMapData(this, key).has(key);
|
|
527
|
+
}
|
|
528
|
+
function mapCacheSet(key, value) {
|
|
529
|
+
var data = getMapData(this, key), size = data.size;
|
|
530
|
+
data.set(key, value);
|
|
531
|
+
this.size += data.size == size ? 0 : 1;
|
|
532
|
+
return this;
|
|
533
|
+
}
|
|
534
|
+
function MapCache(entries) {
|
|
535
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
536
|
+
this.clear();
|
|
537
|
+
while (++index < length) {
|
|
538
|
+
var entry = entries[index];
|
|
539
|
+
this.set(entry[0], entry[1]);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
543
|
+
MapCache.prototype["delete"] = mapCacheDelete;
|
|
544
|
+
MapCache.prototype.get = mapCacheGet;
|
|
545
|
+
MapCache.prototype.has = mapCacheHas;
|
|
546
|
+
MapCache.prototype.set = mapCacheSet;
|
|
547
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
548
|
+
function memoize(func, resolver) {
|
|
549
|
+
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
|
550
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
551
|
+
}
|
|
552
|
+
var memoized = function() {
|
|
553
|
+
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
|
|
554
|
+
if (cache.has(key)) {
|
|
555
|
+
return cache.get(key);
|
|
556
|
+
}
|
|
557
|
+
var result = func.apply(this, args);
|
|
558
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
559
|
+
return result;
|
|
560
|
+
};
|
|
561
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
|
562
|
+
return memoized;
|
|
563
|
+
}
|
|
564
|
+
memoize.Cache = MapCache;
|
|
565
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
566
|
+
function memoizeCapped(func) {
|
|
567
|
+
var result = memoize(func, function(key) {
|
|
568
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
569
|
+
cache.clear();
|
|
570
|
+
}
|
|
571
|
+
return key;
|
|
572
|
+
});
|
|
573
|
+
var cache = result.cache;
|
|
574
|
+
return result;
|
|
575
|
+
}
|
|
576
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
577
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
578
|
+
var stringToPath = memoizeCapped(function(string) {
|
|
579
|
+
var result = [];
|
|
580
|
+
if (string.charCodeAt(0) === 46) {
|
|
581
|
+
result.push("");
|
|
582
|
+
}
|
|
583
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
584
|
+
result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
|
|
585
|
+
});
|
|
586
|
+
return result;
|
|
587
|
+
});
|
|
588
|
+
function toString(value) {
|
|
589
|
+
return value == null ? "" : baseToString(value);
|
|
590
|
+
}
|
|
591
|
+
function castPath(value, object) {
|
|
592
|
+
if (isArray(value)) {
|
|
593
|
+
return value;
|
|
594
|
+
}
|
|
595
|
+
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
596
|
+
}
|
|
597
|
+
var INFINITY = 1 / 0;
|
|
598
|
+
function toKey(value) {
|
|
599
|
+
if (typeof value == "string" || isSymbol(value)) {
|
|
600
|
+
return value;
|
|
601
|
+
}
|
|
602
|
+
var result = value + "";
|
|
603
|
+
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
604
|
+
}
|
|
605
|
+
function baseGet(object, path) {
|
|
606
|
+
path = castPath(path, object);
|
|
607
|
+
var index = 0, length = path.length;
|
|
608
|
+
while (object != null && index < length) {
|
|
609
|
+
object = object[toKey(path[index++])];
|
|
610
|
+
}
|
|
611
|
+
return index && index == length ? object : void 0;
|
|
612
|
+
}
|
|
613
|
+
function get(object, path, defaultValue) {
|
|
614
|
+
var result = object == null ? void 0 : baseGet(object, path);
|
|
615
|
+
return result === void 0 ? defaultValue : result;
|
|
616
|
+
}
|
|
617
|
+
function fromPairs(pairs) {
|
|
618
|
+
var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
|
|
619
|
+
while (++index < length) {
|
|
620
|
+
var pair = pairs[index];
|
|
621
|
+
result[pair[0]] = pair[1];
|
|
622
|
+
}
|
|
623
|
+
return result;
|
|
624
|
+
}
|
|
625
|
+
const isUndefined = (val) => val === void 0;
|
|
626
|
+
const isBoolean = (val) => typeof val === "boolean";
|
|
627
|
+
const isNumber = (val) => typeof val === "number";
|
|
628
|
+
const isElement = (e) => {
|
|
629
|
+
if (typeof Element === "undefined")
|
|
630
|
+
return false;
|
|
631
|
+
return e instanceof Element;
|
|
632
|
+
};
|
|
633
|
+
const isStringNumber = (val) => {
|
|
634
|
+
if (!isString(val)) {
|
|
635
|
+
return false;
|
|
636
|
+
}
|
|
637
|
+
return !Number.isNaN(Number(val));
|
|
638
|
+
};
|
|
639
|
+
const keysOf = (arr) => Object.keys(arr);
|
|
640
|
+
class ElementPlusError extends Error {
|
|
641
|
+
constructor(m) {
|
|
642
|
+
super(m);
|
|
643
|
+
this.name = "ElementPlusError";
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
function debugWarn(scope, message2) {
|
|
647
|
+
if (process.env.NODE_ENV !== "production") {
|
|
648
|
+
const error = isString(scope) ? new ElementPlusError(`[${scope}] ${message2}`) : scope;
|
|
649
|
+
console.warn(error);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
const SCOPE = "utils/dom/style";
|
|
653
|
+
function addUnit(value, defaultUnit = "px") {
|
|
654
|
+
if (!value)
|
|
655
|
+
return "";
|
|
656
|
+
if (isNumber(value) || isStringNumber(value)) {
|
|
657
|
+
return `${value}${defaultUnit}`;
|
|
658
|
+
} else if (isString(value)) {
|
|
659
|
+
return value;
|
|
660
|
+
}
|
|
661
|
+
debugWarn(SCOPE, "binding value must be a string or number");
|
|
662
|
+
}
|
|
663
|
+
/*! Element Plus Icons Vue v2.3.1 */
|
|
664
|
+
var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
|
|
665
|
+
name: "CircleCloseFilled",
|
|
666
|
+
__name: "circle-close-filled",
|
|
667
|
+
setup(__props) {
|
|
668
|
+
return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
|
|
669
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
670
|
+
viewBox: "0 0 1024 1024"
|
|
671
|
+
}, [
|
|
672
|
+
vue.createElementVNode("path", {
|
|
673
|
+
fill: "currentColor",
|
|
674
|
+
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
|
|
675
|
+
})
|
|
676
|
+
]));
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
|
|
680
|
+
var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
|
|
681
|
+
name: "Close",
|
|
682
|
+
__name: "close",
|
|
683
|
+
setup(__props) {
|
|
684
|
+
return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
|
|
685
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
686
|
+
viewBox: "0 0 1024 1024"
|
|
687
|
+
}, [
|
|
688
|
+
vue.createElementVNode("path", {
|
|
689
|
+
fill: "currentColor",
|
|
690
|
+
d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
|
|
691
|
+
})
|
|
692
|
+
]));
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
var close_default = close_vue_vue_type_script_setup_true_lang_default;
|
|
696
|
+
var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
|
|
697
|
+
name: "InfoFilled",
|
|
698
|
+
__name: "info-filled",
|
|
699
|
+
setup(__props) {
|
|
700
|
+
return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
|
|
701
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
702
|
+
viewBox: "0 0 1024 1024"
|
|
703
|
+
}, [
|
|
704
|
+
vue.createElementVNode("path", {
|
|
705
|
+
fill: "currentColor",
|
|
706
|
+
d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
|
|
707
|
+
})
|
|
708
|
+
]));
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
|
|
712
|
+
var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
|
|
713
|
+
name: "SuccessFilled",
|
|
714
|
+
__name: "success-filled",
|
|
715
|
+
setup(__props) {
|
|
716
|
+
return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
|
|
717
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
718
|
+
viewBox: "0 0 1024 1024"
|
|
719
|
+
}, [
|
|
720
|
+
vue.createElementVNode("path", {
|
|
721
|
+
fill: "currentColor",
|
|
722
|
+
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
|
|
723
|
+
})
|
|
724
|
+
]));
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
|
|
728
|
+
var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
|
|
729
|
+
name: "WarningFilled",
|
|
730
|
+
__name: "warning-filled",
|
|
731
|
+
setup(__props) {
|
|
732
|
+
return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
|
|
733
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
734
|
+
viewBox: "0 0 1024 1024"
|
|
735
|
+
}, [
|
|
736
|
+
vue.createElementVNode("path", {
|
|
737
|
+
fill: "currentColor",
|
|
738
|
+
d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
|
|
739
|
+
})
|
|
740
|
+
]));
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
|
|
744
|
+
const epPropKey = "__epPropKey";
|
|
745
|
+
const definePropType = (val) => val;
|
|
746
|
+
const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
|
|
747
|
+
const buildProp = (prop, key) => {
|
|
748
|
+
if (!isObject$1(prop) || isEpProp(prop))
|
|
749
|
+
return prop;
|
|
750
|
+
const { values, required, default: defaultValue, type, validator } = prop;
|
|
751
|
+
const _validator = values || validator ? (val) => {
|
|
752
|
+
let valid = false;
|
|
753
|
+
let allowedValues = [];
|
|
754
|
+
if (values) {
|
|
755
|
+
allowedValues = Array.from(values);
|
|
756
|
+
if (hasOwn(prop, "default")) {
|
|
757
|
+
allowedValues.push(defaultValue);
|
|
758
|
+
}
|
|
759
|
+
valid || (valid = allowedValues.includes(val));
|
|
760
|
+
}
|
|
761
|
+
if (validator)
|
|
762
|
+
valid || (valid = validator(val));
|
|
763
|
+
if (!valid && allowedValues.length > 0) {
|
|
764
|
+
const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
|
|
765
|
+
vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
|
|
766
|
+
}
|
|
767
|
+
return valid;
|
|
768
|
+
} : void 0;
|
|
769
|
+
const epProp = {
|
|
770
|
+
type,
|
|
771
|
+
required: !!required,
|
|
772
|
+
validator: _validator,
|
|
773
|
+
[epPropKey]: true
|
|
774
|
+
};
|
|
775
|
+
if (hasOwn(prop, "default"))
|
|
776
|
+
epProp.default = defaultValue;
|
|
777
|
+
return epProp;
|
|
778
|
+
};
|
|
779
|
+
const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
|
|
780
|
+
key,
|
|
781
|
+
buildProp(option, key)
|
|
782
|
+
]));
|
|
783
|
+
const iconPropType = definePropType([
|
|
784
|
+
String,
|
|
785
|
+
Object,
|
|
786
|
+
Function
|
|
787
|
+
]);
|
|
788
|
+
const TypeComponents = {
|
|
789
|
+
Close: close_default,
|
|
790
|
+
SuccessFilled: success_filled_default,
|
|
791
|
+
InfoFilled: info_filled_default,
|
|
792
|
+
WarningFilled: warning_filled_default,
|
|
793
|
+
CircleCloseFilled: circle_close_filled_default
|
|
794
|
+
};
|
|
795
|
+
const TypeComponentsMap = {
|
|
796
|
+
success: success_filled_default,
|
|
797
|
+
warning: warning_filled_default,
|
|
798
|
+
error: circle_close_filled_default,
|
|
799
|
+
info: info_filled_default
|
|
800
|
+
};
|
|
801
|
+
const withInstall = (main, extra) => {
|
|
802
|
+
main.install = (app) => {
|
|
803
|
+
for (const comp of [main, ...Object.values({})]) {
|
|
804
|
+
app.component(comp.name, comp);
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
return main;
|
|
808
|
+
};
|
|
809
|
+
const withInstallFunction = (fn, name) => {
|
|
810
|
+
fn.install = (app) => {
|
|
811
|
+
fn._context = app._context;
|
|
812
|
+
app.config.globalProperties[name] = fn;
|
|
813
|
+
};
|
|
814
|
+
return fn;
|
|
815
|
+
};
|
|
816
|
+
const EVENT_CODE = {
|
|
817
|
+
tab: "Tab",
|
|
818
|
+
enter: "Enter",
|
|
819
|
+
space: "Space",
|
|
820
|
+
left: "ArrowLeft",
|
|
821
|
+
up: "ArrowUp",
|
|
822
|
+
right: "ArrowRight",
|
|
823
|
+
down: "ArrowDown",
|
|
824
|
+
esc: "Escape",
|
|
825
|
+
delete: "Delete",
|
|
826
|
+
backspace: "Backspace",
|
|
827
|
+
numpadEnter: "NumpadEnter",
|
|
828
|
+
pageUp: "PageUp",
|
|
829
|
+
pageDown: "PageDown",
|
|
830
|
+
home: "Home",
|
|
831
|
+
end: "End"
|
|
832
|
+
};
|
|
833
|
+
const componentSizes = ["", "default", "small", "large"];
|
|
834
|
+
const mutable = (val) => val;
|
|
835
|
+
var English = {
|
|
836
|
+
name: "en",
|
|
837
|
+
el: {
|
|
838
|
+
breadcrumb: {
|
|
839
|
+
label: "Breadcrumb"
|
|
840
|
+
},
|
|
841
|
+
colorpicker: {
|
|
842
|
+
confirm: "OK",
|
|
843
|
+
clear: "Clear",
|
|
844
|
+
defaultLabel: "color picker",
|
|
845
|
+
description: "current color is {color}. press enter to select a new color.",
|
|
846
|
+
alphaLabel: "pick alpha value"
|
|
847
|
+
},
|
|
848
|
+
datepicker: {
|
|
849
|
+
now: "Now",
|
|
850
|
+
today: "Today",
|
|
851
|
+
cancel: "Cancel",
|
|
852
|
+
clear: "Clear",
|
|
853
|
+
confirm: "OK",
|
|
854
|
+
dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
|
|
855
|
+
monthTablePrompt: "Use the arrow keys and enter to select the month",
|
|
856
|
+
yearTablePrompt: "Use the arrow keys and enter to select the year",
|
|
857
|
+
selectedDate: "Selected date",
|
|
858
|
+
selectDate: "Select date",
|
|
859
|
+
selectTime: "Select time",
|
|
860
|
+
startDate: "Start Date",
|
|
861
|
+
startTime: "Start Time",
|
|
862
|
+
endDate: "End Date",
|
|
863
|
+
endTime: "End Time",
|
|
864
|
+
prevYear: "Previous Year",
|
|
865
|
+
nextYear: "Next Year",
|
|
866
|
+
prevMonth: "Previous Month",
|
|
867
|
+
nextMonth: "Next Month",
|
|
868
|
+
year: "",
|
|
869
|
+
month1: "January",
|
|
870
|
+
month2: "February",
|
|
871
|
+
month3: "March",
|
|
872
|
+
month4: "April",
|
|
873
|
+
month5: "May",
|
|
874
|
+
month6: "June",
|
|
875
|
+
month7: "July",
|
|
876
|
+
month8: "August",
|
|
877
|
+
month9: "September",
|
|
878
|
+
month10: "October",
|
|
879
|
+
month11: "November",
|
|
880
|
+
month12: "December",
|
|
881
|
+
week: "week",
|
|
882
|
+
weeks: {
|
|
883
|
+
sun: "Sun",
|
|
884
|
+
mon: "Mon",
|
|
885
|
+
tue: "Tue",
|
|
886
|
+
wed: "Wed",
|
|
887
|
+
thu: "Thu",
|
|
888
|
+
fri: "Fri",
|
|
889
|
+
sat: "Sat"
|
|
890
|
+
},
|
|
891
|
+
weeksFull: {
|
|
892
|
+
sun: "Sunday",
|
|
893
|
+
mon: "Monday",
|
|
894
|
+
tue: "Tuesday",
|
|
895
|
+
wed: "Wednesday",
|
|
896
|
+
thu: "Thursday",
|
|
897
|
+
fri: "Friday",
|
|
898
|
+
sat: "Saturday"
|
|
899
|
+
},
|
|
900
|
+
months: {
|
|
901
|
+
jan: "Jan",
|
|
902
|
+
feb: "Feb",
|
|
903
|
+
mar: "Mar",
|
|
904
|
+
apr: "Apr",
|
|
905
|
+
may: "May",
|
|
906
|
+
jun: "Jun",
|
|
907
|
+
jul: "Jul",
|
|
908
|
+
aug: "Aug",
|
|
909
|
+
sep: "Sep",
|
|
910
|
+
oct: "Oct",
|
|
911
|
+
nov: "Nov",
|
|
912
|
+
dec: "Dec"
|
|
913
|
+
}
|
|
914
|
+
},
|
|
915
|
+
inputNumber: {
|
|
916
|
+
decrease: "decrease number",
|
|
917
|
+
increase: "increase number"
|
|
918
|
+
},
|
|
919
|
+
select: {
|
|
920
|
+
loading: "Loading",
|
|
921
|
+
noMatch: "No matching data",
|
|
922
|
+
noData: "No data",
|
|
923
|
+
placeholder: "Select"
|
|
924
|
+
},
|
|
925
|
+
mention: {
|
|
926
|
+
loading: "Loading"
|
|
927
|
+
},
|
|
928
|
+
dropdown: {
|
|
929
|
+
toggleDropdown: "Toggle Dropdown"
|
|
930
|
+
},
|
|
931
|
+
cascader: {
|
|
932
|
+
noMatch: "No matching data",
|
|
933
|
+
loading: "Loading",
|
|
934
|
+
placeholder: "Select",
|
|
935
|
+
noData: "No data"
|
|
936
|
+
},
|
|
937
|
+
pagination: {
|
|
938
|
+
goto: "Go to",
|
|
939
|
+
pagesize: "/page",
|
|
940
|
+
total: "Total {total}",
|
|
941
|
+
pageClassifier: "",
|
|
942
|
+
page: "Page",
|
|
943
|
+
prev: "Go to previous page",
|
|
944
|
+
next: "Go to next page",
|
|
945
|
+
currentPage: "page {pager}",
|
|
946
|
+
prevPages: "Previous {pager} pages",
|
|
947
|
+
nextPages: "Next {pager} pages",
|
|
948
|
+
deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
|
|
949
|
+
},
|
|
950
|
+
dialog: {
|
|
951
|
+
close: "Close this dialog"
|
|
952
|
+
},
|
|
953
|
+
drawer: {
|
|
954
|
+
close: "Close this dialog"
|
|
955
|
+
},
|
|
956
|
+
messagebox: {
|
|
957
|
+
title: "Message",
|
|
958
|
+
confirm: "OK",
|
|
959
|
+
cancel: "Cancel",
|
|
960
|
+
error: "Illegal input",
|
|
961
|
+
close: "Close this dialog"
|
|
962
|
+
},
|
|
963
|
+
upload: {
|
|
964
|
+
deleteTip: "press delete to remove",
|
|
965
|
+
delete: "Delete",
|
|
966
|
+
preview: "Preview",
|
|
967
|
+
continue: "Continue"
|
|
968
|
+
},
|
|
969
|
+
slider: {
|
|
970
|
+
defaultLabel: "slider between {min} and {max}",
|
|
971
|
+
defaultRangeStartLabel: "pick start value",
|
|
972
|
+
defaultRangeEndLabel: "pick end value"
|
|
973
|
+
},
|
|
974
|
+
table: {
|
|
975
|
+
emptyText: "No Data",
|
|
976
|
+
confirmFilter: "Confirm",
|
|
977
|
+
resetFilter: "Reset",
|
|
978
|
+
clearFilter: "All",
|
|
979
|
+
sumText: "Sum"
|
|
980
|
+
},
|
|
981
|
+
tour: {
|
|
982
|
+
next: "Next",
|
|
983
|
+
previous: "Previous",
|
|
984
|
+
finish: "Finish"
|
|
985
|
+
},
|
|
986
|
+
tree: {
|
|
987
|
+
emptyText: "No Data"
|
|
988
|
+
},
|
|
989
|
+
transfer: {
|
|
990
|
+
noMatch: "No matching data",
|
|
991
|
+
noData: "No data",
|
|
992
|
+
titles: ["List 1", "List 2"],
|
|
993
|
+
filterPlaceholder: "Enter keyword",
|
|
994
|
+
noCheckedFormat: "{total} items",
|
|
995
|
+
hasCheckedFormat: "{checked}/{total} checked"
|
|
996
|
+
},
|
|
997
|
+
image: {
|
|
998
|
+
error: "FAILED"
|
|
999
|
+
},
|
|
1000
|
+
pageHeader: {
|
|
1001
|
+
title: "Back"
|
|
1002
|
+
},
|
|
1003
|
+
popconfirm: {
|
|
1004
|
+
confirmButtonText: "Yes",
|
|
1005
|
+
cancelButtonText: "No"
|
|
1006
|
+
},
|
|
1007
|
+
carousel: {
|
|
1008
|
+
leftArrow: "Carousel arrow left",
|
|
1009
|
+
rightArrow: "Carousel arrow right",
|
|
1010
|
+
indicator: "Carousel switch to index {index}"
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
|
|
1015
|
+
const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
|
|
1016
|
+
var _a2;
|
|
1017
|
+
return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
|
|
1018
|
+
});
|
|
1019
|
+
const buildLocaleContext = (locale) => {
|
|
1020
|
+
const lang = vue.computed(() => vue.unref(locale).name);
|
|
1021
|
+
const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
|
|
1022
|
+
return {
|
|
1023
|
+
lang,
|
|
1024
|
+
locale: localeRef,
|
|
1025
|
+
t: buildTranslator(locale)
|
|
1026
|
+
};
|
|
1027
|
+
};
|
|
1028
|
+
const localeContextKey = Symbol("localeContextKey");
|
|
1029
|
+
const useLocale = (localeOverrides) => {
|
|
1030
|
+
const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
|
|
1031
|
+
return buildLocaleContext(vue.computed(() => locale.value || English));
|
|
1032
|
+
};
|
|
1033
|
+
const defaultNamespace = "el";
|
|
1034
|
+
const statePrefix = "is-";
|
|
1035
|
+
const _bem = (namespace, block, blockSuffix, element, modifier) => {
|
|
1036
|
+
let cls = `${namespace}-${block}`;
|
|
1037
|
+
if (blockSuffix) {
|
|
1038
|
+
cls += `-${blockSuffix}`;
|
|
1039
|
+
}
|
|
1040
|
+
if (element) {
|
|
1041
|
+
cls += `__${element}`;
|
|
1042
|
+
}
|
|
1043
|
+
if (modifier) {
|
|
1044
|
+
cls += `--${modifier}`;
|
|
1045
|
+
}
|
|
1046
|
+
return cls;
|
|
1047
|
+
};
|
|
1048
|
+
const namespaceContextKey = Symbol("namespaceContextKey");
|
|
1049
|
+
const useGetDerivedNamespace = (namespaceOverrides) => {
|
|
1050
|
+
const derivedNamespace = namespaceOverrides || (vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref(defaultNamespace)) : vue.ref(defaultNamespace));
|
|
1051
|
+
const namespace = vue.computed(() => {
|
|
1052
|
+
return vue.unref(derivedNamespace) || defaultNamespace;
|
|
1053
|
+
});
|
|
1054
|
+
return namespace;
|
|
1055
|
+
};
|
|
1056
|
+
const useNamespace = (block, namespaceOverrides) => {
|
|
1057
|
+
const namespace = useGetDerivedNamespace(namespaceOverrides);
|
|
1058
|
+
const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
|
|
1059
|
+
const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
|
|
1060
|
+
const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
|
|
1061
|
+
const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
|
|
1062
|
+
const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
|
|
1063
|
+
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
|
|
1064
|
+
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
|
|
1065
|
+
const is = (name, ...args) => {
|
|
1066
|
+
const state = args.length >= 1 ? args[0] : true;
|
|
1067
|
+
return name && state ? `${statePrefix}${name}` : "";
|
|
1068
|
+
};
|
|
1069
|
+
const cssVar = (object) => {
|
|
1070
|
+
const styles = {};
|
|
1071
|
+
for (const key in object) {
|
|
1072
|
+
if (object[key]) {
|
|
1073
|
+
styles[`--${namespace.value}-${key}`] = object[key];
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
return styles;
|
|
1077
|
+
};
|
|
1078
|
+
const cssVarBlock = (object) => {
|
|
1079
|
+
const styles = {};
|
|
1080
|
+
for (const key in object) {
|
|
1081
|
+
if (object[key]) {
|
|
1082
|
+
styles[`--${namespace.value}-${block}-${key}`] = object[key];
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
return styles;
|
|
1086
|
+
};
|
|
1087
|
+
const cssVarName = (name) => `--${namespace.value}-${name}`;
|
|
1088
|
+
const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
|
|
1089
|
+
return {
|
|
1090
|
+
namespace,
|
|
1091
|
+
b,
|
|
1092
|
+
e,
|
|
1093
|
+
m,
|
|
1094
|
+
be,
|
|
1095
|
+
em,
|
|
1096
|
+
bm,
|
|
1097
|
+
bem,
|
|
1098
|
+
is,
|
|
1099
|
+
cssVar,
|
|
1100
|
+
cssVarName,
|
|
1101
|
+
cssVarBlock,
|
|
1102
|
+
cssVarBlockName
|
|
1103
|
+
};
|
|
1104
|
+
};
|
|
1105
|
+
const initial = {
|
|
1106
|
+
current: 0
|
|
1107
|
+
};
|
|
1108
|
+
const zIndex = vue.ref(0);
|
|
1109
|
+
const defaultInitialZIndex = 2e3;
|
|
1110
|
+
const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
|
|
1111
|
+
const zIndexContextKey = Symbol("zIndexContextKey");
|
|
1112
|
+
const useZIndex = (zIndexOverrides) => {
|
|
1113
|
+
const increasingInjection = vue.getCurrentInstance() ? vue.inject(ZINDEX_INJECTION_KEY, initial) : initial;
|
|
1114
|
+
const zIndexInjection = zIndexOverrides || (vue.getCurrentInstance() ? vue.inject(zIndexContextKey, void 0) : void 0);
|
|
1115
|
+
const initialZIndex = vue.computed(() => {
|
|
1116
|
+
const zIndexFromInjection = vue.unref(zIndexInjection);
|
|
1117
|
+
return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
|
|
1118
|
+
});
|
|
1119
|
+
const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
|
|
1120
|
+
const nextZIndex = () => {
|
|
1121
|
+
increasingInjection.current++;
|
|
1122
|
+
zIndex.value = increasingInjection.current;
|
|
1123
|
+
return currentZIndex.value;
|
|
1124
|
+
};
|
|
1125
|
+
if (!isClient && !vue.inject(ZINDEX_INJECTION_KEY)) {
|
|
1126
|
+
debugWarn("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
|
|
1127
|
+
usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`);
|
|
1128
|
+
}
|
|
1129
|
+
return {
|
|
1130
|
+
initialZIndex,
|
|
1131
|
+
currentZIndex,
|
|
1132
|
+
nextZIndex
|
|
1133
|
+
};
|
|
1134
|
+
};
|
|
1135
|
+
const useSizeProp = buildProp({
|
|
1136
|
+
type: String,
|
|
1137
|
+
values: componentSizes,
|
|
1138
|
+
required: false
|
|
1139
|
+
});
|
|
1140
|
+
const SIZE_INJECTION_KEY = Symbol("size");
|
|
1141
|
+
const emptyValuesContextKey = Symbol("emptyValuesContextKey");
|
|
1142
|
+
const useEmptyValuesProps = buildProps({
|
|
1143
|
+
emptyValues: Array,
|
|
1144
|
+
valueOnClear: {
|
|
1145
|
+
type: [String, Number, Boolean, Function],
|
|
1146
|
+
default: void 0,
|
|
1147
|
+
validator: (val) => isFunction$1(val) ? !val() : !val
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
const configProviderContextKey = Symbol();
|
|
1151
|
+
const globalConfig = vue.ref();
|
|
1152
|
+
function useGlobalConfig(key, defaultValue = void 0) {
|
|
1153
|
+
const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
|
|
1154
|
+
{
|
|
1155
|
+
return config;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
function useGlobalComponentSettings(block, sizeFallback) {
|
|
1159
|
+
const config = useGlobalConfig();
|
|
1160
|
+
const ns = useNamespace(block, vue.computed(() => {
|
|
1161
|
+
var _a2;
|
|
1162
|
+
return ((_a2 = config.value) == null ? void 0 : _a2.namespace) || defaultNamespace;
|
|
1163
|
+
}));
|
|
1164
|
+
const locale = useLocale(vue.computed(() => {
|
|
1165
|
+
var _a2;
|
|
1166
|
+
return (_a2 = config.value) == null ? void 0 : _a2.locale;
|
|
1167
|
+
}));
|
|
1168
|
+
const zIndex2 = useZIndex(vue.computed(() => {
|
|
1169
|
+
var _a2;
|
|
1170
|
+
return ((_a2 = config.value) == null ? void 0 : _a2.zIndex) || defaultInitialZIndex;
|
|
1171
|
+
}));
|
|
1172
|
+
const size = vue.computed(() => {
|
|
1173
|
+
var _a2;
|
|
1174
|
+
return vue.unref(sizeFallback) || ((_a2 = config.value) == null ? void 0 : _a2.size) || "";
|
|
1175
|
+
});
|
|
1176
|
+
provideGlobalConfig(vue.computed(() => vue.unref(config) || {}));
|
|
1177
|
+
return {
|
|
1178
|
+
ns,
|
|
1179
|
+
locale,
|
|
1180
|
+
zIndex: zIndex2,
|
|
1181
|
+
size
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
const provideGlobalConfig = (config, app, global2 = false) => {
|
|
1185
|
+
var _a2;
|
|
1186
|
+
const inSetup = !!vue.getCurrentInstance();
|
|
1187
|
+
const oldConfig = inSetup ? useGlobalConfig() : void 0;
|
|
1188
|
+
const provideFn = (_a2 = void 0) != null ? _a2 : inSetup ? vue.provide : void 0;
|
|
1189
|
+
if (!provideFn) {
|
|
1190
|
+
debugWarn("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
const context = vue.computed(() => {
|
|
1194
|
+
const cfg = vue.unref(config);
|
|
1195
|
+
if (!(oldConfig == null ? void 0 : oldConfig.value))
|
|
1196
|
+
return cfg;
|
|
1197
|
+
return mergeConfig(oldConfig.value, cfg);
|
|
1198
|
+
});
|
|
1199
|
+
provideFn(configProviderContextKey, context);
|
|
1200
|
+
provideFn(localeContextKey, vue.computed(() => context.value.locale));
|
|
1201
|
+
provideFn(namespaceContextKey, vue.computed(() => context.value.namespace));
|
|
1202
|
+
provideFn(zIndexContextKey, vue.computed(() => context.value.zIndex));
|
|
1203
|
+
provideFn(SIZE_INJECTION_KEY, {
|
|
1204
|
+
size: vue.computed(() => context.value.size || "")
|
|
1205
|
+
});
|
|
1206
|
+
provideFn(emptyValuesContextKey, vue.computed(() => ({
|
|
1207
|
+
emptyValues: context.value.emptyValues,
|
|
1208
|
+
valueOnClear: context.value.valueOnClear
|
|
1209
|
+
})));
|
|
1210
|
+
if (global2 || !globalConfig.value) {
|
|
1211
|
+
globalConfig.value = context.value;
|
|
1212
|
+
}
|
|
1213
|
+
return context;
|
|
1214
|
+
};
|
|
1215
|
+
const mergeConfig = (a, b) => {
|
|
1216
|
+
const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
|
|
1217
|
+
const obj = {};
|
|
1218
|
+
for (const key of keys) {
|
|
1219
|
+
obj[key] = b[key] !== void 0 ? b[key] : a[key];
|
|
1220
|
+
}
|
|
1221
|
+
return obj;
|
|
1222
|
+
};
|
|
1223
|
+
const configProviderProps = buildProps({
|
|
1224
|
+
a11y: {
|
|
1225
|
+
type: Boolean,
|
|
1226
|
+
default: true
|
|
1227
|
+
},
|
|
1228
|
+
locale: {
|
|
1229
|
+
type: definePropType(Object)
|
|
1230
|
+
},
|
|
1231
|
+
size: useSizeProp,
|
|
1232
|
+
button: {
|
|
1233
|
+
type: definePropType(Object)
|
|
1234
|
+
},
|
|
1235
|
+
experimentalFeatures: {
|
|
1236
|
+
type: definePropType(Object)
|
|
1237
|
+
},
|
|
1238
|
+
keyboardNavigation: {
|
|
1239
|
+
type: Boolean,
|
|
1240
|
+
default: true
|
|
1241
|
+
},
|
|
1242
|
+
message: {
|
|
1243
|
+
type: definePropType(Object)
|
|
1244
|
+
},
|
|
1245
|
+
zIndex: Number,
|
|
1246
|
+
namespace: {
|
|
1247
|
+
type: String,
|
|
1248
|
+
default: "el"
|
|
1249
|
+
},
|
|
1250
|
+
...useEmptyValuesProps
|
|
1251
|
+
});
|
|
1252
|
+
const messageConfig = {};
|
|
1253
|
+
vue.defineComponent({
|
|
1254
|
+
name: "ElConfigProvider",
|
|
1255
|
+
props: configProviderProps,
|
|
1256
|
+
setup(props, { slots }) {
|
|
1257
|
+
vue.watch(() => props.message, (val) => {
|
|
1258
|
+
Object.assign(messageConfig, val != null ? val : {});
|
|
1259
|
+
}, { immediate: true, deep: true });
|
|
1260
|
+
const config = provideGlobalConfig(props);
|
|
1261
|
+
return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
|
|
1262
|
+
}
|
|
1263
|
+
});
|
|
1264
|
+
var _export_sfc = (sfc, props) => {
|
|
1265
|
+
const target = sfc.__vccOpts || sfc;
|
|
1266
|
+
for (const [key, val] of props) {
|
|
1267
|
+
target[key] = val;
|
|
1268
|
+
}
|
|
1269
|
+
return target;
|
|
1270
|
+
};
|
|
1271
|
+
const iconProps = buildProps({
|
|
1272
|
+
size: {
|
|
1273
|
+
type: definePropType([Number, String])
|
|
1274
|
+
},
|
|
1275
|
+
color: {
|
|
1276
|
+
type: String
|
|
1277
|
+
}
|
|
1278
|
+
});
|
|
1279
|
+
const __default__$2 = vue.defineComponent({
|
|
1280
|
+
name: "ElIcon",
|
|
1281
|
+
inheritAttrs: false
|
|
1282
|
+
});
|
|
1283
|
+
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
1284
|
+
...__default__$2,
|
|
1285
|
+
props: iconProps,
|
|
1286
|
+
setup(__props) {
|
|
1287
|
+
const props = __props;
|
|
1288
|
+
const ns = useNamespace("icon");
|
|
1289
|
+
const style = vue.computed(() => {
|
|
1290
|
+
const { size, color } = props;
|
|
1291
|
+
if (!size && !color)
|
|
1292
|
+
return {};
|
|
1293
|
+
return {
|
|
1294
|
+
fontSize: isUndefined(size) ? void 0 : addUnit(size),
|
|
1295
|
+
"--color": color
|
|
1296
|
+
};
|
|
1297
|
+
});
|
|
1298
|
+
return (_ctx, _cache) => {
|
|
1299
|
+
return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
|
|
1300
|
+
class: vue.unref(ns).b(),
|
|
1301
|
+
style: vue.unref(style)
|
|
1302
|
+
}, _ctx.$attrs), [
|
|
1303
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
1304
|
+
], 16);
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "icon.vue"]]);
|
|
1309
|
+
const ElIcon = withInstall(Icon);
|
|
1310
|
+
const badgeProps = buildProps({
|
|
1311
|
+
value: {
|
|
1312
|
+
type: [String, Number],
|
|
1313
|
+
default: ""
|
|
1314
|
+
},
|
|
1315
|
+
max: {
|
|
1316
|
+
type: Number,
|
|
1317
|
+
default: 99
|
|
1318
|
+
},
|
|
1319
|
+
isDot: Boolean,
|
|
1320
|
+
hidden: Boolean,
|
|
1321
|
+
type: {
|
|
1322
|
+
type: String,
|
|
1323
|
+
values: ["primary", "success", "warning", "info", "danger"],
|
|
1324
|
+
default: "danger"
|
|
1325
|
+
},
|
|
1326
|
+
showZero: {
|
|
1327
|
+
type: Boolean,
|
|
1328
|
+
default: true
|
|
1329
|
+
},
|
|
1330
|
+
color: String,
|
|
1331
|
+
badgeStyle: {
|
|
1332
|
+
type: definePropType([String, Object, Array])
|
|
1333
|
+
},
|
|
1334
|
+
offset: {
|
|
1335
|
+
type: definePropType(Array),
|
|
1336
|
+
default: [0, 0]
|
|
1337
|
+
},
|
|
1338
|
+
badgeClass: {
|
|
1339
|
+
type: String
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
const __default__$1 = vue.defineComponent({
|
|
1343
|
+
name: "ElBadge"
|
|
1344
|
+
});
|
|
1345
|
+
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
1346
|
+
...__default__$1,
|
|
1347
|
+
props: badgeProps,
|
|
1348
|
+
setup(__props, { expose }) {
|
|
1349
|
+
const props = __props;
|
|
1350
|
+
const ns = useNamespace("badge");
|
|
1351
|
+
const content = vue.computed(() => {
|
|
1352
|
+
if (props.isDot)
|
|
1353
|
+
return "";
|
|
1354
|
+
if (isNumber(props.value) && isNumber(props.max)) {
|
|
1355
|
+
return props.max < props.value ? `${props.max}+` : `${props.value}`;
|
|
1356
|
+
}
|
|
1357
|
+
return `${props.value}`;
|
|
1358
|
+
});
|
|
1359
|
+
const style = vue.computed(() => {
|
|
1360
|
+
var _a2, _b, _c, _d, _e;
|
|
1361
|
+
return [
|
|
1362
|
+
{
|
|
1363
|
+
backgroundColor: props.color,
|
|
1364
|
+
marginRight: addUnit(-((_b = (_a2 = props.offset) == null ? void 0 : _a2[0]) != null ? _b : 0)),
|
|
1365
|
+
marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
|
|
1366
|
+
},
|
|
1367
|
+
(_e = props.badgeStyle) != null ? _e : {}
|
|
1368
|
+
];
|
|
1369
|
+
});
|
|
1370
|
+
expose({
|
|
1371
|
+
content
|
|
1372
|
+
});
|
|
1373
|
+
return (_ctx, _cache) => {
|
|
1374
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
1375
|
+
class: vue.normalizeClass(vue.unref(ns).b())
|
|
1376
|
+
}, [
|
|
1377
|
+
vue.renderSlot(_ctx.$slots, "default"),
|
|
1378
|
+
vue.createVNode(vue.Transition, {
|
|
1379
|
+
name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
|
|
1380
|
+
persisted: ""
|
|
1381
|
+
}, {
|
|
1382
|
+
default: vue.withCtx(() => [
|
|
1383
|
+
vue.withDirectives(vue.createElementVNode("sup", {
|
|
1384
|
+
class: vue.normalizeClass([
|
|
1385
|
+
vue.unref(ns).e("content"),
|
|
1386
|
+
vue.unref(ns).em("content", _ctx.type),
|
|
1387
|
+
vue.unref(ns).is("fixed", !!_ctx.$slots.default),
|
|
1388
|
+
vue.unref(ns).is("dot", _ctx.isDot),
|
|
1389
|
+
vue.unref(ns).is("hide-zero", !_ctx.showZero && props.value === 0),
|
|
1390
|
+
_ctx.badgeClass
|
|
1391
|
+
]),
|
|
1392
|
+
style: vue.normalizeStyle(vue.unref(style)),
|
|
1393
|
+
textContent: vue.toDisplayString(vue.unref(content))
|
|
1394
|
+
}, null, 14, ["textContent"]), [
|
|
1395
|
+
[vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot)]
|
|
1396
|
+
])
|
|
1397
|
+
]),
|
|
1398
|
+
_: 1
|
|
1399
|
+
}, 8, ["name"])
|
|
1400
|
+
], 2);
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
});
|
|
1404
|
+
var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "badge.vue"]]);
|
|
1405
|
+
const ElBadge = withInstall(Badge);
|
|
1406
|
+
const messageTypes = ["success", "info", "warning", "error"];
|
|
1407
|
+
const messageDefaults = mutable({
|
|
1408
|
+
customClass: "",
|
|
1409
|
+
center: false,
|
|
1410
|
+
dangerouslyUseHTMLString: false,
|
|
1411
|
+
duration: 3e3,
|
|
1412
|
+
icon: void 0,
|
|
1413
|
+
id: "",
|
|
1414
|
+
message: "",
|
|
1415
|
+
onClose: void 0,
|
|
1416
|
+
showClose: false,
|
|
1417
|
+
type: "info",
|
|
1418
|
+
plain: false,
|
|
1419
|
+
offset: 16,
|
|
1420
|
+
zIndex: 0,
|
|
1421
|
+
grouping: false,
|
|
1422
|
+
repeatNum: 1,
|
|
1423
|
+
appendTo: isClient ? document.body : void 0
|
|
1424
|
+
});
|
|
1425
|
+
const messageProps = buildProps({
|
|
1426
|
+
customClass: {
|
|
1427
|
+
type: String,
|
|
1428
|
+
default: messageDefaults.customClass
|
|
1429
|
+
},
|
|
1430
|
+
center: {
|
|
1431
|
+
type: Boolean,
|
|
1432
|
+
default: messageDefaults.center
|
|
1433
|
+
},
|
|
1434
|
+
dangerouslyUseHTMLString: {
|
|
1435
|
+
type: Boolean,
|
|
1436
|
+
default: messageDefaults.dangerouslyUseHTMLString
|
|
1437
|
+
},
|
|
1438
|
+
duration: {
|
|
1439
|
+
type: Number,
|
|
1440
|
+
default: messageDefaults.duration
|
|
1441
|
+
},
|
|
1442
|
+
icon: {
|
|
1443
|
+
type: iconPropType,
|
|
1444
|
+
default: messageDefaults.icon
|
|
1445
|
+
},
|
|
1446
|
+
id: {
|
|
1447
|
+
type: String,
|
|
1448
|
+
default: messageDefaults.id
|
|
1449
|
+
},
|
|
1450
|
+
message: {
|
|
1451
|
+
type: definePropType([
|
|
1452
|
+
String,
|
|
1453
|
+
Object,
|
|
1454
|
+
Function
|
|
1455
|
+
]),
|
|
1456
|
+
default: messageDefaults.message
|
|
1457
|
+
},
|
|
1458
|
+
onClose: {
|
|
1459
|
+
type: definePropType(Function),
|
|
1460
|
+
default: messageDefaults.onClose
|
|
1461
|
+
},
|
|
1462
|
+
showClose: {
|
|
1463
|
+
type: Boolean,
|
|
1464
|
+
default: messageDefaults.showClose
|
|
1465
|
+
},
|
|
1466
|
+
type: {
|
|
1467
|
+
type: String,
|
|
1468
|
+
values: messageTypes,
|
|
1469
|
+
default: messageDefaults.type
|
|
1470
|
+
},
|
|
1471
|
+
plain: {
|
|
1472
|
+
type: Boolean,
|
|
1473
|
+
default: messageDefaults.plain
|
|
1474
|
+
},
|
|
1475
|
+
offset: {
|
|
1476
|
+
type: Number,
|
|
1477
|
+
default: messageDefaults.offset
|
|
1478
|
+
},
|
|
1479
|
+
zIndex: {
|
|
1480
|
+
type: Number,
|
|
1481
|
+
default: messageDefaults.zIndex
|
|
1482
|
+
},
|
|
1483
|
+
grouping: {
|
|
1484
|
+
type: Boolean,
|
|
1485
|
+
default: messageDefaults.grouping
|
|
1486
|
+
},
|
|
1487
|
+
repeatNum: {
|
|
1488
|
+
type: Number,
|
|
1489
|
+
default: messageDefaults.repeatNum
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
const messageEmits = {
|
|
1493
|
+
destroy: () => true
|
|
1494
|
+
};
|
|
1495
|
+
const instances = vue.shallowReactive([]);
|
|
1496
|
+
const getInstance = (id) => {
|
|
1497
|
+
const idx = instances.findIndex((instance) => instance.id === id);
|
|
1498
|
+
const current = instances[idx];
|
|
1499
|
+
let prev;
|
|
1500
|
+
if (idx > 0) {
|
|
1501
|
+
prev = instances[idx - 1];
|
|
1502
|
+
}
|
|
1503
|
+
return { current, prev };
|
|
1504
|
+
};
|
|
1505
|
+
const getLastOffset = (id) => {
|
|
1506
|
+
const { prev } = getInstance(id);
|
|
1507
|
+
if (!prev)
|
|
1508
|
+
return 0;
|
|
1509
|
+
return prev.vm.exposed.bottom.value;
|
|
1510
|
+
};
|
|
1511
|
+
const getOffsetOrSpace = (id, offset) => {
|
|
1512
|
+
const idx = instances.findIndex((instance) => instance.id === id);
|
|
1513
|
+
return idx > 0 ? 16 : offset;
|
|
1514
|
+
};
|
|
1515
|
+
const __default__ = vue.defineComponent({
|
|
1516
|
+
name: "ElMessage"
|
|
1517
|
+
});
|
|
1518
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
1519
|
+
...__default__,
|
|
1520
|
+
props: messageProps,
|
|
1521
|
+
emits: messageEmits,
|
|
1522
|
+
setup(__props, { expose }) {
|
|
1523
|
+
const props = __props;
|
|
1524
|
+
const { Close } = TypeComponents;
|
|
1525
|
+
const { ns, zIndex: zIndex2 } = useGlobalComponentSettings("message");
|
|
1526
|
+
const { currentZIndex, nextZIndex } = zIndex2;
|
|
1527
|
+
const messageRef = vue.ref();
|
|
1528
|
+
const visible = vue.ref(false);
|
|
1529
|
+
const height = vue.ref(0);
|
|
1530
|
+
let stopTimer = void 0;
|
|
1531
|
+
const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
|
|
1532
|
+
const typeClass = vue.computed(() => {
|
|
1533
|
+
const type = props.type;
|
|
1534
|
+
return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
|
|
1535
|
+
});
|
|
1536
|
+
const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
|
|
1537
|
+
const lastOffset = vue.computed(() => getLastOffset(props.id));
|
|
1538
|
+
const offset = vue.computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
|
|
1539
|
+
const bottom = vue.computed(() => height.value + offset.value);
|
|
1540
|
+
const customStyle = vue.computed(() => ({
|
|
1541
|
+
top: `${offset.value}px`,
|
|
1542
|
+
zIndex: currentZIndex.value
|
|
1543
|
+
}));
|
|
1544
|
+
function startTimer() {
|
|
1545
|
+
if (props.duration === 0)
|
|
1546
|
+
return;
|
|
1547
|
+
({ stop: stopTimer } = useTimeoutFn(() => {
|
|
1548
|
+
close();
|
|
1549
|
+
}, props.duration));
|
|
1550
|
+
}
|
|
1551
|
+
function clearTimer() {
|
|
1552
|
+
stopTimer == null ? void 0 : stopTimer();
|
|
1553
|
+
}
|
|
1554
|
+
function close() {
|
|
1555
|
+
visible.value = false;
|
|
1556
|
+
}
|
|
1557
|
+
function keydown({ code }) {
|
|
1558
|
+
if (code === EVENT_CODE.esc) {
|
|
1559
|
+
close();
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
vue.onMounted(() => {
|
|
1563
|
+
startTimer();
|
|
1564
|
+
nextZIndex();
|
|
1565
|
+
visible.value = true;
|
|
1566
|
+
});
|
|
1567
|
+
vue.watch(() => props.repeatNum, () => {
|
|
1568
|
+
clearTimer();
|
|
1569
|
+
startTimer();
|
|
1570
|
+
});
|
|
1571
|
+
useEventListener(document, "keydown", keydown);
|
|
1572
|
+
useResizeObserver(messageRef, () => {
|
|
1573
|
+
height.value = messageRef.value.getBoundingClientRect().height;
|
|
1574
|
+
});
|
|
1575
|
+
expose({
|
|
1576
|
+
visible,
|
|
1577
|
+
bottom,
|
|
1578
|
+
close
|
|
1579
|
+
});
|
|
1580
|
+
return (_ctx, _cache) => {
|
|
1581
|
+
return vue.openBlock(), vue.createBlock(vue.Transition, {
|
|
1582
|
+
name: vue.unref(ns).b("fade"),
|
|
1583
|
+
onBeforeLeave: _ctx.onClose,
|
|
1584
|
+
onAfterLeave: ($event) => _ctx.$emit("destroy"),
|
|
1585
|
+
persisted: ""
|
|
1586
|
+
}, {
|
|
1587
|
+
default: vue.withCtx(() => [
|
|
1588
|
+
vue.withDirectives(vue.createElementVNode("div", {
|
|
1589
|
+
id: _ctx.id,
|
|
1590
|
+
ref_key: "messageRef",
|
|
1591
|
+
ref: messageRef,
|
|
1592
|
+
class: vue.normalizeClass([
|
|
1593
|
+
vue.unref(ns).b(),
|
|
1594
|
+
{ [vue.unref(ns).m(_ctx.type)]: _ctx.type },
|
|
1595
|
+
vue.unref(ns).is("center", _ctx.center),
|
|
1596
|
+
vue.unref(ns).is("closable", _ctx.showClose),
|
|
1597
|
+
vue.unref(ns).is("plain", _ctx.plain),
|
|
1598
|
+
_ctx.customClass
|
|
1599
|
+
]),
|
|
1600
|
+
style: vue.normalizeStyle(vue.unref(customStyle)),
|
|
1601
|
+
role: "alert",
|
|
1602
|
+
onMouseenter: clearTimer,
|
|
1603
|
+
onMouseleave: startTimer
|
|
1604
|
+
}, [
|
|
1605
|
+
_ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
|
|
1606
|
+
key: 0,
|
|
1607
|
+
value: _ctx.repeatNum,
|
|
1608
|
+
type: vue.unref(badgeType),
|
|
1609
|
+
class: vue.normalizeClass(vue.unref(ns).e("badge"))
|
|
1610
|
+
}, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
|
|
1611
|
+
vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
|
|
1612
|
+
key: 1,
|
|
1613
|
+
class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
|
|
1614
|
+
}, {
|
|
1615
|
+
default: vue.withCtx(() => [
|
|
1616
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
|
|
1617
|
+
]),
|
|
1618
|
+
_: 1
|
|
1619
|
+
}, 8, ["class"])) : vue.createCommentVNode("v-if", true),
|
|
1620
|
+
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
|
1621
|
+
!_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
|
|
1622
|
+
key: 0,
|
|
1623
|
+
class: vue.normalizeClass(vue.unref(ns).e("content"))
|
|
1624
|
+
}, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
1625
|
+
vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
|
|
1626
|
+
vue.createElementVNode("p", {
|
|
1627
|
+
class: vue.normalizeClass(vue.unref(ns).e("content")),
|
|
1628
|
+
innerHTML: _ctx.message
|
|
1629
|
+
}, null, 10, ["innerHTML"])
|
|
1630
|
+
], 2112))
|
|
1631
|
+
]),
|
|
1632
|
+
_ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
|
|
1633
|
+
key: 2,
|
|
1634
|
+
class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
|
|
1635
|
+
onClick: vue.withModifiers(close, ["stop"])
|
|
1636
|
+
}, {
|
|
1637
|
+
default: vue.withCtx(() => [
|
|
1638
|
+
vue.createVNode(vue.unref(Close))
|
|
1639
|
+
]),
|
|
1640
|
+
_: 1
|
|
1641
|
+
}, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
|
|
1642
|
+
], 46, ["id"]), [
|
|
1643
|
+
[vue.vShow, visible.value]
|
|
1644
|
+
])
|
|
1645
|
+
]),
|
|
1646
|
+
_: 3
|
|
1647
|
+
}, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "message.vue"]]);
|
|
1652
|
+
let seed = 1;
|
|
1653
|
+
const normalizeOptions = (params) => {
|
|
1654
|
+
const options = !params || isString(params) || vue.isVNode(params) || isFunction$1(params) ? { message: params } : params;
|
|
1655
|
+
const normalized = {
|
|
1656
|
+
...messageDefaults,
|
|
1657
|
+
...options
|
|
1658
|
+
};
|
|
1659
|
+
if (!normalized.appendTo) {
|
|
1660
|
+
normalized.appendTo = document.body;
|
|
1661
|
+
} else if (isString(normalized.appendTo)) {
|
|
1662
|
+
let appendTo = document.querySelector(normalized.appendTo);
|
|
1663
|
+
if (!isElement(appendTo)) {
|
|
1664
|
+
debugWarn("ElMessage", "the appendTo option is not an HTMLElement. Falling back to document.body.");
|
|
1665
|
+
appendTo = document.body;
|
|
1666
|
+
}
|
|
1667
|
+
normalized.appendTo = appendTo;
|
|
1668
|
+
}
|
|
1669
|
+
if (isBoolean(messageConfig.grouping) && !normalized.grouping) {
|
|
1670
|
+
normalized.grouping = messageConfig.grouping;
|
|
1671
|
+
}
|
|
1672
|
+
if (isNumber(messageConfig.duration) && normalized.duration === 3e3) {
|
|
1673
|
+
normalized.duration = messageConfig.duration;
|
|
1674
|
+
}
|
|
1675
|
+
if (isNumber(messageConfig.offset) && normalized.offset === 16) {
|
|
1676
|
+
normalized.offset = messageConfig.offset;
|
|
1677
|
+
}
|
|
1678
|
+
if (isBoolean(messageConfig.showClose) && !normalized.showClose) {
|
|
1679
|
+
normalized.showClose = messageConfig.showClose;
|
|
1680
|
+
}
|
|
1681
|
+
return normalized;
|
|
1682
|
+
};
|
|
1683
|
+
const closeMessage = (instance) => {
|
|
1684
|
+
const idx = instances.indexOf(instance);
|
|
1685
|
+
if (idx === -1)
|
|
1686
|
+
return;
|
|
1687
|
+
instances.splice(idx, 1);
|
|
1688
|
+
const { handler } = instance;
|
|
1689
|
+
handler.close();
|
|
1690
|
+
};
|
|
1691
|
+
const createMessage = ({ appendTo, ...options }, context) => {
|
|
1692
|
+
const id = `message_${seed++}`;
|
|
1693
|
+
const userOnClose = options.onClose;
|
|
1694
|
+
const container = document.createElement("div");
|
|
1695
|
+
const props = {
|
|
1696
|
+
...options,
|
|
1697
|
+
id,
|
|
1698
|
+
onClose: () => {
|
|
1699
|
+
userOnClose == null ? void 0 : userOnClose();
|
|
1700
|
+
closeMessage(instance);
|
|
1701
|
+
},
|
|
1702
|
+
onDestroy: () => {
|
|
1703
|
+
vue.render(null, container);
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
const vnode = vue.createVNode(MessageConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
|
|
1707
|
+
default: isFunction$1(props.message) ? props.message : () => props.message
|
|
1708
|
+
} : null);
|
|
1709
|
+
vnode.appContext = context || message._context;
|
|
1710
|
+
vue.render(vnode, container);
|
|
1711
|
+
appendTo.appendChild(container.firstElementChild);
|
|
1712
|
+
const vm = vnode.component;
|
|
1713
|
+
const handler = {
|
|
1714
|
+
close: () => {
|
|
1715
|
+
vm.exposed.visible.value = false;
|
|
1716
|
+
}
|
|
1717
|
+
};
|
|
1718
|
+
const instance = {
|
|
1719
|
+
id,
|
|
1720
|
+
vnode,
|
|
1721
|
+
vm,
|
|
1722
|
+
handler,
|
|
1723
|
+
props: vnode.component.props
|
|
1724
|
+
};
|
|
1725
|
+
return instance;
|
|
1726
|
+
};
|
|
1727
|
+
const message = (options = {}, context) => {
|
|
1728
|
+
if (!isClient)
|
|
1729
|
+
return { close: () => void 0 };
|
|
1730
|
+
const normalized = normalizeOptions(options);
|
|
1731
|
+
if (normalized.grouping && instances.length) {
|
|
1732
|
+
const instance2 = instances.find(({ vnode: vm }) => {
|
|
1733
|
+
var _a2;
|
|
1734
|
+
return ((_a2 = vm.props) == null ? void 0 : _a2.message) === normalized.message;
|
|
1735
|
+
});
|
|
1736
|
+
if (instance2) {
|
|
1737
|
+
instance2.props.repeatNum += 1;
|
|
1738
|
+
instance2.props.type = normalized.type;
|
|
1739
|
+
return instance2.handler;
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
|
|
1743
|
+
return { close: () => void 0 };
|
|
1744
|
+
}
|
|
1745
|
+
const instance = createMessage(normalized, context);
|
|
1746
|
+
instances.push(instance);
|
|
1747
|
+
return instance.handler;
|
|
1748
|
+
};
|
|
1749
|
+
messageTypes.forEach((type) => {
|
|
1750
|
+
message[type] = (options = {}, appContext) => {
|
|
1751
|
+
const normalized = normalizeOptions(options);
|
|
1752
|
+
return message({ ...normalized, type }, appContext);
|
|
1753
|
+
};
|
|
1754
|
+
});
|
|
1755
|
+
function closeAll(type) {
|
|
1756
|
+
for (const instance of instances) {
|
|
1757
|
+
if (!type || type === instance.props.type) {
|
|
1758
|
+
instance.handler.close();
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
message.closeAll = closeAll;
|
|
1763
|
+
message._context = null;
|
|
1764
|
+
const ElMessage = withInstallFunction(message, "$message");
|
|
1765
|
+
const FormValuesSymbol = Symbol("formValues");
|
|
1766
|
+
function useFormValues() {
|
|
1767
|
+
const formValues = vue.inject(FormValuesSymbol);
|
|
1768
|
+
if (!formValues) {
|
|
1769
|
+
throw new Error("useFormValues must be used within FlyElForm");
|
|
1770
|
+
}
|
|
1771
|
+
return formValues;
|
|
1772
|
+
}
|
|
1773
|
+
const FlyElForm = vue.defineComponent({
|
|
1774
|
+
name: "FlyElForm",
|
|
1775
|
+
props: {
|
|
1776
|
+
// 模式 默认form表单模式 search为搜索条模式
|
|
1777
|
+
model: {
|
|
1778
|
+
type: String,
|
|
1779
|
+
default: "form"
|
|
1780
|
+
},
|
|
1781
|
+
// 是否启用单步错误提示 如果有多个未通过的表单项,只会依次提示第一个未通过的表单项
|
|
1782
|
+
singleStepErrorTip: {
|
|
1783
|
+
type: Boolean,
|
|
1784
|
+
default: false
|
|
1785
|
+
},
|
|
1786
|
+
// 行内换行模式
|
|
1787
|
+
inlineBlock: {
|
|
1788
|
+
type: Boolean,
|
|
1789
|
+
default: false
|
|
1790
|
+
},
|
|
1791
|
+
/**
|
|
1792
|
+
* 表单数据
|
|
1793
|
+
*/
|
|
1794
|
+
form: {
|
|
1795
|
+
type: Object,
|
|
1796
|
+
require: true
|
|
1797
|
+
},
|
|
1798
|
+
/**
|
|
1799
|
+
* 表单状态
|
|
1800
|
+
*/
|
|
1801
|
+
status: {
|
|
1802
|
+
type: String,
|
|
1803
|
+
default: "create"
|
|
1804
|
+
},
|
|
1805
|
+
/**
|
|
1806
|
+
* 表单配置
|
|
1807
|
+
*/
|
|
1808
|
+
formProps: {
|
|
1809
|
+
type: Object,
|
|
1810
|
+
default: () => {
|
|
1811
|
+
return {};
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
/**
|
|
1815
|
+
* 表单事件
|
|
1816
|
+
*/
|
|
1817
|
+
formEvents: {
|
|
1818
|
+
type: Object,
|
|
1819
|
+
default: () => {
|
|
1820
|
+
return {};
|
|
1821
|
+
}
|
|
1822
|
+
},
|
|
1823
|
+
/**表单项配置 */
|
|
1824
|
+
formItemProps: {
|
|
1825
|
+
type: Object,
|
|
1826
|
+
default: () => {
|
|
1827
|
+
return {};
|
|
1828
|
+
}
|
|
1829
|
+
},
|
|
1830
|
+
/**表单row配置 */
|
|
1831
|
+
formRowProps: {
|
|
1832
|
+
type: Object,
|
|
1833
|
+
default: () => {
|
|
1834
|
+
return {
|
|
1835
|
+
gutter: 10
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
},
|
|
1839
|
+
/**表单col配置 */
|
|
1840
|
+
formColProps: {
|
|
1841
|
+
type: Object,
|
|
1842
|
+
default: () => {
|
|
1843
|
+
return {
|
|
1844
|
+
xs: 24,
|
|
1845
|
+
sm: 12,
|
|
1846
|
+
md: 12,
|
|
1847
|
+
lg: 6
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1850
|
+
},
|
|
1851
|
+
// 是否展示表单底部
|
|
1852
|
+
showFooter: {
|
|
1853
|
+
type: Boolean,
|
|
1854
|
+
default: true
|
|
1855
|
+
},
|
|
1856
|
+
footerRowProps: {
|
|
1857
|
+
type: Object,
|
|
1858
|
+
default: () => {
|
|
1859
|
+
return {};
|
|
1860
|
+
}
|
|
1861
|
+
},
|
|
1862
|
+
// 表单操作按钮
|
|
1863
|
+
action: {
|
|
1864
|
+
type: Array,
|
|
1865
|
+
default: () => {
|
|
1866
|
+
return ["submit", "reset"];
|
|
1867
|
+
}
|
|
1868
|
+
},
|
|
1869
|
+
// 表单操作按钮配置
|
|
1870
|
+
actionProps: {
|
|
1871
|
+
type: Object,
|
|
1872
|
+
default: () => {
|
|
1873
|
+
return {};
|
|
1874
|
+
}
|
|
1875
|
+
},
|
|
1876
|
+
// 严格模式只接受内置的表单项
|
|
1877
|
+
strict: {
|
|
1878
|
+
type: Boolean,
|
|
1879
|
+
default: false
|
|
1880
|
+
}
|
|
1881
|
+
},
|
|
1882
|
+
setup(props, context) {
|
|
1883
|
+
const isFirstInit = vue.ref(true);
|
|
1884
|
+
const formContent = vue.ref({});
|
|
1885
|
+
const requests = vue.ref({});
|
|
1886
|
+
const rules = vue.ref({});
|
|
1887
|
+
const sourceData = vue.ref({});
|
|
1888
|
+
const formValues = vue.ref({});
|
|
1889
|
+
const formInitValues = vue.ref({});
|
|
1890
|
+
const formKeyAndName = vue.reactive({});
|
|
1891
|
+
const FlyFormRef = vue.ref(null);
|
|
1892
|
+
const needOverWriteForm = vue.ref({});
|
|
1893
|
+
const needReturnSourceKeys = vue.ref([]);
|
|
1894
|
+
const updateTimeout = vue.ref(null);
|
|
1895
|
+
const componentRefs = vue.ref({});
|
|
1896
|
+
const setComponentRef = (key) => (el) => {
|
|
1897
|
+
if (el) {
|
|
1898
|
+
componentRefs.value[key] = el;
|
|
1899
|
+
}
|
|
1900
|
+
};
|
|
1901
|
+
const getComponentRefByKey = (key) => {
|
|
1902
|
+
if (key && typeof key === "string") {
|
|
1903
|
+
return componentRefs.value[key];
|
|
1904
|
+
} else {
|
|
1905
|
+
console.error("请传入正确的key");
|
|
1906
|
+
return null;
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
const isEqual = (a, b) => {
|
|
1910
|
+
if (a === b) return true;
|
|
1911
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
1912
|
+
return false;
|
|
1913
|
+
const keysA = Object.keys(a);
|
|
1914
|
+
const keysB = Object.keys(b);
|
|
1915
|
+
if (keysA.length !== keysB.length) return false;
|
|
1916
|
+
for (const key of keysA) {
|
|
1917
|
+
if (!isEqual(a[key], b[key])) return false;
|
|
1918
|
+
}
|
|
1919
|
+
return true;
|
|
1920
|
+
};
|
|
1921
|
+
const overWrite = () => {
|
|
1922
|
+
if (needOverWriteForm.value) {
|
|
1923
|
+
Object.keys(needOverWriteForm.value).forEach((key) => {
|
|
1924
|
+
if (hasOwnPropertySafely(formValues.value, key)) {
|
|
1925
|
+
formValues.value[key] = needOverWriteForm.value[key];
|
|
1926
|
+
}
|
|
1927
|
+
});
|
|
1928
|
+
needOverWriteForm.value = {};
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
const generatorRluesAndRequests = async (form) => {
|
|
1932
|
+
const res = collectFormContent(form);
|
|
1933
|
+
const newRules = res.rules;
|
|
1934
|
+
const oldRulesKeys = Object.keys(rules.value);
|
|
1935
|
+
oldRulesKeys.forEach((key) => {
|
|
1936
|
+
if (!hasOwnPropertySafely(newRules, key)) {
|
|
1937
|
+
delete rules.value[key];
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
for (const key in newRules) {
|
|
1941
|
+
if (hasOwnPropertySafely(newRules, key)) {
|
|
1942
|
+
if (!hasOwnPropertySafely(rules.value, key) || !isEqual(rules.value[key], newRules[key])) {
|
|
1943
|
+
console.log(key, newRules[key]);
|
|
1944
|
+
rules.value[key] = newRules[key];
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
const newRequests = res.requests;
|
|
1949
|
+
const oldRequestsKeys = Object.keys(requests.value);
|
|
1950
|
+
oldRequestsKeys.forEach((key) => {
|
|
1951
|
+
if (!hasOwnPropertySafely(newRequests, key)) {
|
|
1952
|
+
delete requests.value[key];
|
|
1953
|
+
}
|
|
1954
|
+
});
|
|
1955
|
+
for (const key in newRequests) {
|
|
1956
|
+
if (hasOwnPropertySafely(newRequests, key)) {
|
|
1957
|
+
if (requests.value[key] !== newRequests[key]) {
|
|
1958
|
+
requests.value[key] = newRequests[key];
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
const newFormKeyAndName = res.formKeyAndName || {};
|
|
1963
|
+
const oldFormKeyAndNameKeys = Object.keys(formKeyAndName);
|
|
1964
|
+
oldFormKeyAndNameKeys.forEach((key) => {
|
|
1965
|
+
if (!hasOwnPropertySafely(newFormKeyAndName, key)) {
|
|
1966
|
+
delete formKeyAndName[key];
|
|
1967
|
+
}
|
|
1968
|
+
});
|
|
1969
|
+
for (const key in newFormKeyAndName) {
|
|
1970
|
+
if (hasOwnPropertySafely(newFormKeyAndName, key)) {
|
|
1971
|
+
if (formKeyAndName[key] !== newFormKeyAndName[key]) {
|
|
1972
|
+
formKeyAndName[key] = newFormKeyAndName[key];
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
formContent.value = res.formContent;
|
|
1977
|
+
if (isFirstInit.value) {
|
|
1978
|
+
const requests2 = Object.keys(res.requests).map((key) => {
|
|
1979
|
+
return res.requests[key]();
|
|
1980
|
+
});
|
|
1981
|
+
formInitValues.value = Object.assign({}, res.formData);
|
|
1982
|
+
if (requests2 && requests2.length > 0) {
|
|
1983
|
+
await Promise.allSettled(requests2).catch((err) => {
|
|
1984
|
+
console.warn(err);
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
formValues.value = Object.assign({}, res.formData);
|
|
1988
|
+
if (needOverWriteForm.value) {
|
|
1989
|
+
overWrite(needOverWriteForm.value);
|
|
1990
|
+
needOverWriteForm.value = {};
|
|
1991
|
+
}
|
|
1992
|
+
vue.nextTick(() => {
|
|
1993
|
+
isFirstInit.value = false;
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
};
|
|
1997
|
+
const collectFormContent = (data = []) => {
|
|
1998
|
+
const res = {
|
|
1999
|
+
formContent: [],
|
|
2000
|
+
formData: {},
|
|
2001
|
+
rules: {},
|
|
2002
|
+
requests: {},
|
|
2003
|
+
formKeyAndName: {}
|
|
2004
|
+
};
|
|
2005
|
+
const inputTips = ["el-input", "el-input-number"];
|
|
2006
|
+
data.forEach((item) => {
|
|
2007
|
+
if (!hasOwnPropertySafely(item, "type") && !hasOwnPropertySafely(item, "hidden")) {
|
|
2008
|
+
throw new Error(`form item type is required.`);
|
|
2009
|
+
}
|
|
2010
|
+
if (hasOwnPropertySafely(item, "key")) {
|
|
2011
|
+
if (hasOwnPropertySafely(res.formKeyAndName, item.key)) {
|
|
2012
|
+
throw new Error(
|
|
2013
|
+
`form item key "${item.key}" is duplicated in the current form definition. Please use another key.`
|
|
2014
|
+
);
|
|
2015
|
+
} else {
|
|
2016
|
+
res.formKeyAndName[item.key] = item.name;
|
|
2017
|
+
}
|
|
2018
|
+
if (item.type === "el-input-number") {
|
|
2019
|
+
res.formData[item.key] = hasOwnPropertySafely(item, "value") ? item.value : null;
|
|
2020
|
+
} else if (item.type === "el-checkbox-group") {
|
|
2021
|
+
res.formData[item.key] = hasOwnPropertySafely(item, "value") ? item.value : [];
|
|
2022
|
+
} else {
|
|
2023
|
+
if (hasOwnPropertySafely(item, "type") && item.type !== "el-row" && item.type !== "title") {
|
|
2024
|
+
res.formData[item.key] = hasOwnPropertySafely(item, "value") ? item.value : void 0;
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
if (hasOwnPropertySafely(item, "rules") && item.rules.length > 0) {
|
|
2029
|
+
res.rules[item.key] = item.rules;
|
|
2030
|
+
}
|
|
2031
|
+
if (item.required) {
|
|
2032
|
+
const requiredType = hasOwnPropertySafely(item, "requiredType") ? item.requiredType : requireTypes[item.type] || "string";
|
|
2033
|
+
const tips = {
|
|
2034
|
+
required: true,
|
|
2035
|
+
message: `${inputTips.includes(item.type) ? "请填写" : "请选择"}${item.name}`,
|
|
2036
|
+
trigger: "change",
|
|
2037
|
+
type: requiredType
|
|
2038
|
+
};
|
|
2039
|
+
if (hasOwnPropertySafely(res.rules, item.key) && res.rules[item.key].length > 0) {
|
|
2040
|
+
res.rules[item.key] = [tips, ...res.rules[item.key]];
|
|
2041
|
+
} else {
|
|
2042
|
+
res.rules[item.key] = [tips];
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
if (hasOwnPropertySafely(item, "source") && hasOwnPropertySafely(item.source, "requestFunction")) {
|
|
2046
|
+
res.requests[item.key] = generatorRequestFunction(item);
|
|
2047
|
+
} else if (hasOwnPropertySafely(item, "source") && hasOwnPropertySafely(item.source, "data") && item.source) {
|
|
2048
|
+
sourceData.value[item.key] = item.source.data;
|
|
2049
|
+
if (item.source.returnSource) {
|
|
2050
|
+
needReturnSourceKeys.value.push(item.key);
|
|
2051
|
+
}
|
|
2052
|
+
} else {
|
|
2053
|
+
!hasOwnPropertySafely(sourceData.value, item.key) && (sourceData.value[item.key] = []);
|
|
2054
|
+
}
|
|
2055
|
+
if (!item.placeholder) {
|
|
2056
|
+
item.placeholder = (inputTips.includes(item.type) ? "请填写" : "请选择") + item.name;
|
|
2057
|
+
}
|
|
2058
|
+
const mItem = { ...item };
|
|
2059
|
+
if (hasOwnPropertySafely(mItem, "source")) {
|
|
2060
|
+
delete mItem.source;
|
|
2061
|
+
}
|
|
2062
|
+
if (item.type === "el-row" && hasOwnPropertySafely(item, "children") && item.children.length > 0) {
|
|
2063
|
+
const cRes = collectFormContent(item.children);
|
|
2064
|
+
res.rules = { ...res.rules, ...cRes.rules };
|
|
2065
|
+
res.formData = { ...res.formData, ...cRes.formData };
|
|
2066
|
+
res.requests = { ...res.requests, ...cRes.requests };
|
|
2067
|
+
res.formKeyAndName = { ...res.formKeyAndName, ...cRes.formKeyAndName };
|
|
2068
|
+
mItem.children = cRes.formContent;
|
|
2069
|
+
}
|
|
2070
|
+
res.formContent.push(mItem);
|
|
2071
|
+
});
|
|
2072
|
+
return res;
|
|
2073
|
+
};
|
|
2074
|
+
const generatorRequestFunction = (item) => {
|
|
2075
|
+
const source = item.source;
|
|
2076
|
+
return async function() {
|
|
2077
|
+
try {
|
|
2078
|
+
const {
|
|
2079
|
+
requestFunction,
|
|
2080
|
+
params,
|
|
2081
|
+
handle,
|
|
2082
|
+
effectKeys,
|
|
2083
|
+
effectKeysHandle
|
|
2084
|
+
} = source;
|
|
2085
|
+
let requestParams = params || {};
|
|
2086
|
+
if (effectKeys && effectKeys.length > 0) {
|
|
2087
|
+
const effectKeysFormValues = {};
|
|
2088
|
+
for (let i = 0; i < effectKeys.length; i++) {
|
|
2089
|
+
effectKeysFormValues[effectKeys[i]] = formValues.value[effectKeys[i]];
|
|
2090
|
+
}
|
|
2091
|
+
requestParams = { ...requestParams, ...effectKeysFormValues };
|
|
2092
|
+
if (effectKeysHandle && typeof effectKeysHandle === "function") {
|
|
2093
|
+
requestParams = effectKeysHandle({
|
|
2094
|
+
params: requestParams,
|
|
2095
|
+
formValues: formValues.value,
|
|
2096
|
+
sourceData: sourceData.value,
|
|
2097
|
+
effectKeys
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
const res = await requestFunction(requestParams);
|
|
2102
|
+
sourceData.value[item.key] = handle ? handle(
|
|
2103
|
+
res,
|
|
2104
|
+
requestParams,
|
|
2105
|
+
formValues.value || formInitValues.value
|
|
2106
|
+
) : res;
|
|
2107
|
+
return res;
|
|
2108
|
+
} catch (err) {
|
|
2109
|
+
console.error(err);
|
|
2110
|
+
return { error: err };
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
};
|
|
2114
|
+
generatorRluesAndRequests(props.form);
|
|
2115
|
+
vue.watch(
|
|
2116
|
+
// @ts-ignore
|
|
2117
|
+
props.form,
|
|
2118
|
+
async (newVal, oldVal) => {
|
|
2119
|
+
await generatorRluesAndRequests(newVal);
|
|
2120
|
+
},
|
|
2121
|
+
{
|
|
2122
|
+
deep: true
|
|
2123
|
+
}
|
|
2124
|
+
);
|
|
2125
|
+
vue.watch(
|
|
2126
|
+
() => rules.value,
|
|
2127
|
+
(newRules) => {
|
|
2128
|
+
if (FlyFormRef.value) {
|
|
2129
|
+
FlyFormRef.value.clearValidate();
|
|
2130
|
+
}
|
|
2131
|
+
},
|
|
2132
|
+
{ deep: true }
|
|
2133
|
+
);
|
|
2134
|
+
vue.provide(FormValuesSymbol, formValues);
|
|
2135
|
+
return {
|
|
2136
|
+
isFirstInit,
|
|
2137
|
+
formContent,
|
|
2138
|
+
requests,
|
|
2139
|
+
rules,
|
|
2140
|
+
sourceData,
|
|
2141
|
+
formInitValues,
|
|
2142
|
+
formKeyAndName,
|
|
2143
|
+
formValues,
|
|
2144
|
+
FlyFormRef,
|
|
2145
|
+
needOverWriteForm,
|
|
2146
|
+
overWrite,
|
|
2147
|
+
needReturnSourceKeys,
|
|
2148
|
+
updateTimeout,
|
|
2149
|
+
componentRefs,
|
|
2150
|
+
setComponentRef,
|
|
2151
|
+
getComponentRefByKey
|
|
2152
|
+
};
|
|
2153
|
+
},
|
|
2154
|
+
methods: {
|
|
2155
|
+
async submit() {
|
|
2156
|
+
const formRef = this.$refs.FlyFormRef;
|
|
2157
|
+
await formRef.validate((valid, errors) => {
|
|
2158
|
+
let returnData = {
|
|
2159
|
+
valid,
|
|
2160
|
+
formValues: this.formValues
|
|
2161
|
+
};
|
|
2162
|
+
console.log(this.needReturnSourceKeys);
|
|
2163
|
+
if (this.needReturnSourceKeys && this.needReturnSourceKeys.length > 0) {
|
|
2164
|
+
let templateSourceData = {};
|
|
2165
|
+
this.needReturnSourceKeys.forEach((key) => {
|
|
2166
|
+
templateSourceData[key] = this.sourceData[key];
|
|
2167
|
+
});
|
|
2168
|
+
returnData.sourceData = templateSourceData;
|
|
2169
|
+
}
|
|
2170
|
+
this.$emit("submit", returnData);
|
|
2171
|
+
if (!valid && this.$props.model === "search") {
|
|
2172
|
+
const errorMsg = [];
|
|
2173
|
+
const errorNames = [];
|
|
2174
|
+
Object.keys(errors).forEach((key) => {
|
|
2175
|
+
const item = errors[key][0];
|
|
2176
|
+
errorMsg.push(item.message);
|
|
2177
|
+
errorNames.push(this.formKeyAndName[key]);
|
|
2178
|
+
});
|
|
2179
|
+
if (this.$props.singleStepErrorTip) {
|
|
2180
|
+
ElMessage.error(errorMsg[0]);
|
|
2181
|
+
} else {
|
|
2182
|
+
ElMessage.error(
|
|
2183
|
+
`请完善${errorNames.length > 0 ? errorNames.join("、") : "查询条件"}`
|
|
2184
|
+
);
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
});
|
|
2188
|
+
},
|
|
2189
|
+
/**
|
|
2190
|
+
* 获取组件实例
|
|
2191
|
+
* @param key 生成component的key 同时会填入ref 通过this.$refs[key]调用
|
|
2192
|
+
*/
|
|
2193
|
+
getFormRef() {
|
|
2194
|
+
try {
|
|
2195
|
+
const formRef = this.$refs.FlyFormRef;
|
|
2196
|
+
return formRef;
|
|
2197
|
+
} catch (error) {
|
|
2198
|
+
console.error(error);
|
|
2199
|
+
}
|
|
2200
|
+
},
|
|
2201
|
+
getComponentRefByKey(key) {
|
|
2202
|
+
console.log(key);
|
|
2203
|
+
if (key && typeof key === "string") {
|
|
2204
|
+
try {
|
|
2205
|
+
return this.$refs[key];
|
|
2206
|
+
} catch (error) {
|
|
2207
|
+
console.error(error);
|
|
2208
|
+
}
|
|
2209
|
+
} else {
|
|
2210
|
+
console.error("请传入正确的key");
|
|
2211
|
+
return false;
|
|
2212
|
+
}
|
|
2213
|
+
},
|
|
2214
|
+
reset() {
|
|
2215
|
+
const formRef = this.$refs.FlyFormRef;
|
|
2216
|
+
formRef.resetFields();
|
|
2217
|
+
this.$emit("reset");
|
|
2218
|
+
},
|
|
2219
|
+
// overWrite(data: any) {
|
|
2220
|
+
// const $this = this
|
|
2221
|
+
// Object.keys(data).forEach((key) => {
|
|
2222
|
+
// if (hasOwnPropertySafely($this.formValues, key)) {
|
|
2223
|
+
// $this.formValues[key] = data[key]
|
|
2224
|
+
// }
|
|
2225
|
+
// })
|
|
2226
|
+
// },
|
|
2227
|
+
setFormValues(data) {
|
|
2228
|
+
const formRef = this.$refs.FlyFormRef;
|
|
2229
|
+
if (!data) return console.error("setFormValues error: 请传入正确的数据");
|
|
2230
|
+
vue.nextTick(async () => {
|
|
2231
|
+
try {
|
|
2232
|
+
if (formRef) {
|
|
2233
|
+
await formRef.resetFields();
|
|
2234
|
+
if (!this.isFirstInit) {
|
|
2235
|
+
Object.keys(data).forEach((key) => {
|
|
2236
|
+
if (hasOwnPropertySafely(this.formValues, key)) {
|
|
2237
|
+
this.formValues[key] = data[key];
|
|
2238
|
+
}
|
|
2239
|
+
});
|
|
2240
|
+
} else {
|
|
2241
|
+
this.needOverWriteForm = data;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
} catch (err) {
|
|
2245
|
+
console.error("setFormValues error:", err);
|
|
2246
|
+
}
|
|
2247
|
+
});
|
|
2248
|
+
},
|
|
2249
|
+
/**
|
|
2250
|
+
* 更新数据源
|
|
2251
|
+
* @param keys
|
|
2252
|
+
*/
|
|
2253
|
+
async updateSource(updateArray) {
|
|
2254
|
+
if (!updateArray) return console.error("请传入正确的更新数据");
|
|
2255
|
+
let keys = [];
|
|
2256
|
+
if (Array.isArray(updateArray)) {
|
|
2257
|
+
for (let i = 0; i < updateArray.length; i++) {
|
|
2258
|
+
let item = updateArray[i];
|
|
2259
|
+
if (hasOwnPropertySafely(item, "key")) {
|
|
2260
|
+
if (hasOwnPropertySafely(item, "value")) {
|
|
2261
|
+
this.sourceData[item.key] = item.value;
|
|
2262
|
+
} else {
|
|
2263
|
+
keys.push(item.key);
|
|
2264
|
+
}
|
|
2265
|
+
} else {
|
|
2266
|
+
console.error("请传入正确的更新数据,错误的数据:", item);
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
if (keys.length > 0) {
|
|
2270
|
+
await this.updateRequestSource(keys);
|
|
2271
|
+
} else {
|
|
2272
|
+
this.$forceUpdate();
|
|
2273
|
+
}
|
|
2274
|
+
} else {
|
|
2275
|
+
console.error("请传入正确的更新数据");
|
|
2276
|
+
}
|
|
2277
|
+
},
|
|
2278
|
+
/**
|
|
2279
|
+
* 更新数据源
|
|
2280
|
+
* @param keys
|
|
2281
|
+
*/
|
|
2282
|
+
async updateRequestSource(keys) {
|
|
2283
|
+
if (!keys) return;
|
|
2284
|
+
let updateRequests = [];
|
|
2285
|
+
if (Array.isArray(keys)) {
|
|
2286
|
+
for (let i = 0; i < keys.length; i++) {
|
|
2287
|
+
updateRequests.push(this.requests[keys[i]]());
|
|
2288
|
+
}
|
|
2289
|
+
} else {
|
|
2290
|
+
updateRequests = [this.requests[keys]()];
|
|
2291
|
+
}
|
|
2292
|
+
if (updateRequests.length === 0) {
|
|
2293
|
+
return console.warn("请传入正确的keys");
|
|
2294
|
+
}
|
|
2295
|
+
await Promise.allSettled(updateRequests).catch((err) => {
|
|
2296
|
+
console.warn(err);
|
|
2297
|
+
});
|
|
2298
|
+
this.$forceUpdate();
|
|
2299
|
+
},
|
|
2300
|
+
/**
|
|
2301
|
+
* 设置表单值
|
|
2302
|
+
*/
|
|
2303
|
+
setKeyValue(key, value) {
|
|
2304
|
+
if (hasOwnPropertySafely(this.formValues, key)) {
|
|
2305
|
+
this.formValues[key] = value;
|
|
2306
|
+
} else {
|
|
2307
|
+
console.error("表单中不存在" + key + "属性");
|
|
2308
|
+
}
|
|
2309
|
+
},
|
|
2310
|
+
getFormValues() {
|
|
2311
|
+
return this.formValues;
|
|
2312
|
+
},
|
|
2313
|
+
clearValidate(data) {
|
|
2314
|
+
const formRef = this.$refs.FlyFormRef;
|
|
2315
|
+
if (data) {
|
|
2316
|
+
window.requestAnimationFrame(() => {
|
|
2317
|
+
formRef.clearValidate(data);
|
|
2318
|
+
});
|
|
2319
|
+
} else {
|
|
2320
|
+
this.$nextTick(() => {
|
|
2321
|
+
window.requestAnimationFrame(() => {
|
|
2322
|
+
formRef.clearValidate();
|
|
2323
|
+
});
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
},
|
|
2328
|
+
render(props) {
|
|
2329
|
+
const generatorFooterButton = () => {
|
|
2330
|
+
const btns = {
|
|
2331
|
+
reset: vue.h(
|
|
2332
|
+
vue.resolveComponent("el-button"),
|
|
2333
|
+
{
|
|
2334
|
+
type: "default",
|
|
2335
|
+
onClick: () => {
|
|
2336
|
+
this.reset();
|
|
2337
|
+
}
|
|
2338
|
+
},
|
|
2339
|
+
{
|
|
2340
|
+
default: () => "重置"
|
|
2341
|
+
// 改为函数形式插槽
|
|
2342
|
+
}
|
|
2343
|
+
),
|
|
2344
|
+
submit: vue.h(
|
|
2345
|
+
vue.resolveComponent("el-button"),
|
|
2346
|
+
{
|
|
2347
|
+
type: "primary",
|
|
2348
|
+
onClick: () => {
|
|
2349
|
+
this.submit();
|
|
2350
|
+
}
|
|
2351
|
+
},
|
|
2352
|
+
{
|
|
2353
|
+
default: () => props.model === "search" ? "搜索" : props.status === "create" ? "保存" : "修改"
|
|
2354
|
+
}
|
|
2355
|
+
)
|
|
2356
|
+
};
|
|
2357
|
+
if (props.action) {
|
|
2358
|
+
return props.action.map((btn) => {
|
|
2359
|
+
if (hasOwnPropertySafely(props.actionProps, btn)) {
|
|
2360
|
+
return vue.h(
|
|
2361
|
+
vue.resolveComponent("el-button"),
|
|
2362
|
+
{
|
|
2363
|
+
type: "default",
|
|
2364
|
+
...props.actionProps[btn].componentProps,
|
|
2365
|
+
onClick: () => {
|
|
2366
|
+
if (["submit", "reset"].includes(btn)) {
|
|
2367
|
+
this[btn]();
|
|
2368
|
+
}
|
|
2369
|
+
},
|
|
2370
|
+
...props.actionProps[btn].componentEvents
|
|
2371
|
+
},
|
|
2372
|
+
{
|
|
2373
|
+
default: () => props.actionProps[btn].text || ""
|
|
2374
|
+
// 确保插槽是函数形式
|
|
2375
|
+
}
|
|
2376
|
+
);
|
|
2377
|
+
} else {
|
|
2378
|
+
return btns[btn];
|
|
2379
|
+
}
|
|
2380
|
+
});
|
|
2381
|
+
}
|
|
2382
|
+
};
|
|
2383
|
+
const generatorFooter = () => {
|
|
2384
|
+
if (!props.showFooter) return;
|
|
2385
|
+
return vue.h(
|
|
2386
|
+
// @ts-ignore
|
|
2387
|
+
vue.resolveComponent("el-row"),
|
|
2388
|
+
{
|
|
2389
|
+
...props.formRowProps,
|
|
2390
|
+
class: "fly-form-footer",
|
|
2391
|
+
justify: "end",
|
|
2392
|
+
...props.footerRowProps
|
|
2393
|
+
},
|
|
2394
|
+
{ default: () => generatorFooterButton() }
|
|
2395
|
+
);
|
|
2396
|
+
};
|
|
2397
|
+
const generatorRow = (item) => {
|
|
2398
|
+
const itemNodes2 = [];
|
|
2399
|
+
if (item.children && item.children.length > 0) {
|
|
2400
|
+
item.children.forEach((it) => {
|
|
2401
|
+
if (hasOwnPropertySafely(it, "visitable") && it.visitable && it.visitable(props.status, this.formValues) || !hasOwnPropertySafely(it, "visitable") && hasOwnPropertySafely(it, "type")) {
|
|
2402
|
+
const formit = generatorCol(it);
|
|
2403
|
+
itemNodes2.push(formit);
|
|
2404
|
+
}
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2407
|
+
return vue.h(
|
|
2408
|
+
// @ts-ignore
|
|
2409
|
+
vue.resolveComponent("el-row"),
|
|
2410
|
+
{
|
|
2411
|
+
...props.formRowProps,
|
|
2412
|
+
...item.componentProps,
|
|
2413
|
+
class: `fly-form-row ${item.class ? item.class : ""}`,
|
|
2414
|
+
style: {
|
|
2415
|
+
...item.style
|
|
2416
|
+
}
|
|
2417
|
+
},
|
|
2418
|
+
{ default: () => itemNodes2 }
|
|
2419
|
+
);
|
|
2420
|
+
};
|
|
2421
|
+
const generatorCol = (item) => {
|
|
2422
|
+
const colProps = item.colProps ? item.colProps : {};
|
|
2423
|
+
if (hasOwnPropertySafely(item, "hidden") && item.hidden) {
|
|
2424
|
+
return null;
|
|
2425
|
+
}
|
|
2426
|
+
const layout = vue.h(
|
|
2427
|
+
// @ts-ignore
|
|
2428
|
+
vue.resolveComponent("el-col"),
|
|
2429
|
+
{
|
|
2430
|
+
...props.formColProps,
|
|
2431
|
+
...colProps,
|
|
2432
|
+
key: item.key
|
|
2433
|
+
},
|
|
2434
|
+
{ default: () => generatorFormItem(item) }
|
|
2435
|
+
);
|
|
2436
|
+
return layout;
|
|
2437
|
+
};
|
|
2438
|
+
const generatorTitle = (item) => {
|
|
2439
|
+
const props2 = item.componentProps ? item.componentProps : {};
|
|
2440
|
+
return vue.h(
|
|
2441
|
+
vue.resolveComponent("el-row"),
|
|
2442
|
+
{
|
|
2443
|
+
...props2
|
|
2444
|
+
},
|
|
2445
|
+
[
|
|
2446
|
+
vue.h(
|
|
2447
|
+
"h3",
|
|
2448
|
+
{
|
|
2449
|
+
class: `fly-form-title ${item.class ? item.class : ""}`,
|
|
2450
|
+
style: {
|
|
2451
|
+
...item.style
|
|
2452
|
+
}
|
|
2453
|
+
},
|
|
2454
|
+
{
|
|
2455
|
+
default: () => item.slot ? item.slot : item.name
|
|
2456
|
+
}
|
|
2457
|
+
)
|
|
2458
|
+
]
|
|
2459
|
+
);
|
|
2460
|
+
};
|
|
2461
|
+
const generatorForm = (data) => {
|
|
2462
|
+
if (!data) return [];
|
|
2463
|
+
const res = [];
|
|
2464
|
+
for (let i = 0; i < data.length; i++) {
|
|
2465
|
+
const item = data[i];
|
|
2466
|
+
if (["el-row", "Title"].includes(item.type)) {
|
|
2467
|
+
switch (item.type) {
|
|
2468
|
+
case "el-row":
|
|
2469
|
+
res.push(generatorRow(item));
|
|
2470
|
+
break;
|
|
2471
|
+
case "Title":
|
|
2472
|
+
res.push(generatorTitle(item));
|
|
2473
|
+
break;
|
|
2474
|
+
case "title":
|
|
2475
|
+
res.push(generatorTitle(item));
|
|
2476
|
+
break;
|
|
2477
|
+
}
|
|
2478
|
+
} else {
|
|
2479
|
+
if (hasOwnPropertySafely(item, "visitable") && item.visitable(props.status, this.formValues) || !hasOwnPropertySafely(item, "visitable")) {
|
|
2480
|
+
const formItem = props.inlineBlock || props.model == "search" ? generatorInlineBlock(item) : generatorBlock(item);
|
|
2481
|
+
res.push(formItem);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
return res;
|
|
2486
|
+
};
|
|
2487
|
+
const generatorInlineBlock = (item) => {
|
|
2488
|
+
if (!hasOwnPropertySafely(item, "hidden")) {
|
|
2489
|
+
return generatorFormItem(item);
|
|
2490
|
+
}
|
|
2491
|
+
};
|
|
2492
|
+
const generatorBlock = (item) => {
|
|
2493
|
+
if (!hasOwnPropertySafely(item, "hidden")) {
|
|
2494
|
+
return vue.h(
|
|
2495
|
+
// @ts-ignore
|
|
2496
|
+
vue.resolveComponent("el-row"),
|
|
2497
|
+
{
|
|
2498
|
+
class: `fly-form-row`
|
|
2499
|
+
},
|
|
2500
|
+
{ default: () => generatorFormItem(item) }
|
|
2501
|
+
);
|
|
2502
|
+
}
|
|
2503
|
+
};
|
|
2504
|
+
const generatorFormItem = (item) => {
|
|
2505
|
+
const slotRender = item.tips ? {
|
|
2506
|
+
label: () => generatorTipsLabel(item),
|
|
2507
|
+
default: () => generatorItem(item)
|
|
2508
|
+
} : { default: () => generatorItem(item) };
|
|
2509
|
+
return vue.h(
|
|
2510
|
+
// @ts-ignore
|
|
2511
|
+
vue.resolveComponent("el-form-item"),
|
|
2512
|
+
{
|
|
2513
|
+
key: item.key,
|
|
2514
|
+
prop: item.key,
|
|
2515
|
+
label: item.name,
|
|
2516
|
+
class: `fly-form-item ${item.class ? item.class : ""}`,
|
|
2517
|
+
...item.formItemProps
|
|
2518
|
+
},
|
|
2519
|
+
slotRender
|
|
2520
|
+
);
|
|
2521
|
+
};
|
|
2522
|
+
const generatorItem = (item) => {
|
|
2523
|
+
switch (item.type) {
|
|
2524
|
+
case "el-select":
|
|
2525
|
+
case "el-select-v2":
|
|
2526
|
+
return generatorSelect(item);
|
|
2527
|
+
case "el-radio-group":
|
|
2528
|
+
return generatorRadioGroup(item);
|
|
2529
|
+
case "el-checkbox-group":
|
|
2530
|
+
return generatorCheckboxGroup(item);
|
|
2531
|
+
case "el-upload":
|
|
2532
|
+
return generatorUpload(item);
|
|
2533
|
+
default:
|
|
2534
|
+
return generatorComponents(item);
|
|
2535
|
+
}
|
|
2536
|
+
};
|
|
2537
|
+
const generatorComponents = (item) => {
|
|
2538
|
+
if (props.strict && hasOwnPropertySafely(requireTypes, item.type) || !props.strict) {
|
|
2539
|
+
if (item.slot) {
|
|
2540
|
+
return vue.h(
|
|
2541
|
+
// @ts-ignore
|
|
2542
|
+
vue.resolveComponent(item.type),
|
|
2543
|
+
{
|
|
2544
|
+
ref: this.setComponentRef(item.key),
|
|
2545
|
+
// 使用 ref 绑定
|
|
2546
|
+
...generatorDefaultProps(item),
|
|
2547
|
+
...generatorSourceData(item),
|
|
2548
|
+
...item.componentProps,
|
|
2549
|
+
attrs: { placeholder: item.placeholder },
|
|
2550
|
+
...generatorDefaultEvents(item),
|
|
2551
|
+
...item.componentEvents
|
|
2552
|
+
},
|
|
2553
|
+
{
|
|
2554
|
+
default: () => item.slot(vue.h)
|
|
2555
|
+
// 确保 slot 是函数形式
|
|
2556
|
+
}
|
|
2557
|
+
);
|
|
2558
|
+
} else {
|
|
2559
|
+
return vue.h(vue.resolveComponent(item.type), {
|
|
2560
|
+
ref: this.setComponentRef(item.key),
|
|
2561
|
+
// 使用 ref 绑定
|
|
2562
|
+
...generatorDefaultProps(item),
|
|
2563
|
+
...generatorSourceData(item),
|
|
2564
|
+
...item.componentProps,
|
|
2565
|
+
attrs: { placeholder: item.placeholder },
|
|
2566
|
+
...generatorDefaultEvents(item),
|
|
2567
|
+
...item.componentEvents
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
} else {
|
|
2571
|
+
return vue.h(
|
|
2572
|
+
"span",
|
|
2573
|
+
{
|
|
2574
|
+
style: {
|
|
2575
|
+
color: "red"
|
|
2576
|
+
}
|
|
2577
|
+
},
|
|
2578
|
+
`Unaccepted component types '${item.type}'`
|
|
2579
|
+
);
|
|
2580
|
+
}
|
|
2581
|
+
};
|
|
2582
|
+
const generatorSourceData = (item) => {
|
|
2583
|
+
const res = {};
|
|
2584
|
+
const types = ["AutoComplete", "el-transfer"];
|
|
2585
|
+
if (types.includes(item.type) && hasOwnPropertySafely(this.sourceData, item.key)) {
|
|
2586
|
+
res["data"] = this.sourceData[item.key];
|
|
2587
|
+
} else if (item.type == "el-cascader" && hasOwnPropertySafely(this.sourceData, item.key)) {
|
|
2588
|
+
res["options"] = this.sourceData[item.key];
|
|
2589
|
+
} else {
|
|
2590
|
+
res["data"] = [];
|
|
2591
|
+
}
|
|
2592
|
+
return res;
|
|
2593
|
+
};
|
|
2594
|
+
const generatorRadioGroup = (item) => {
|
|
2595
|
+
return vue.h(
|
|
2596
|
+
// @ts-ignore
|
|
2597
|
+
vue.resolveComponent("el-radio-group"),
|
|
2598
|
+
{
|
|
2599
|
+
ref: this.setComponentRef(item.key),
|
|
2600
|
+
// 使用 ref 绑定
|
|
2601
|
+
modelValue: this.formValues[item.key],
|
|
2602
|
+
"onUpdate:modelValue": (val) => {
|
|
2603
|
+
this.formValues[item.key] = val;
|
|
2604
|
+
},
|
|
2605
|
+
...item.componentProps,
|
|
2606
|
+
...item.componentEvents
|
|
2607
|
+
},
|
|
2608
|
+
{ default: () => generatorRadio(item, this.sourceData[item.key]) }
|
|
2609
|
+
);
|
|
2610
|
+
};
|
|
2611
|
+
const generatorRadio = (propItem, data) => {
|
|
2612
|
+
const radios = data && data.length > 0 ? data : propItem.options || [];
|
|
2613
|
+
const res = [];
|
|
2614
|
+
const { optionProps } = propItem;
|
|
2615
|
+
for (let i = 0; i < radios.length; i++) {
|
|
2616
|
+
const item = radios[i];
|
|
2617
|
+
const option = vue.h(
|
|
2618
|
+
// @ts-ignore
|
|
2619
|
+
vue.resolveComponent("el-radio"),
|
|
2620
|
+
{
|
|
2621
|
+
value: propItem.showValue && item[propItem.showValue] || item.value,
|
|
2622
|
+
...optionProps
|
|
2623
|
+
},
|
|
2624
|
+
{ default: () => item[propItem.showName || "label"] }
|
|
2625
|
+
);
|
|
2626
|
+
res.push(option);
|
|
2627
|
+
}
|
|
2628
|
+
return res;
|
|
2629
|
+
};
|
|
2630
|
+
const generatorCheckboxGroup = (item) => {
|
|
2631
|
+
return vue.h(
|
|
2632
|
+
// @ts-ignore
|
|
2633
|
+
vue.resolveComponent("el-checkbox-group"),
|
|
2634
|
+
{
|
|
2635
|
+
ref: this.setComponentRef(item.key),
|
|
2636
|
+
// 使用 ref 绑定
|
|
2637
|
+
modelValue: this.formValues[item.key],
|
|
2638
|
+
"onUpdate:modelValue": (val) => {
|
|
2639
|
+
this.formValues[item.key] = val;
|
|
2640
|
+
},
|
|
2641
|
+
...item.componentProps,
|
|
2642
|
+
...item.componentEvents
|
|
2643
|
+
},
|
|
2644
|
+
{
|
|
2645
|
+
default: () => generatorCheckbox(item, this.sourceData[item.key])
|
|
2646
|
+
}
|
|
2647
|
+
);
|
|
2648
|
+
};
|
|
2649
|
+
const generatorCheckbox = (propItem, data) => {
|
|
2650
|
+
const checkboxs = data && data.length > 0 ? data : propItem.options || [];
|
|
2651
|
+
const res = [];
|
|
2652
|
+
const { optionProps } = propItem;
|
|
2653
|
+
for (let i = 0; i < checkboxs.length; i++) {
|
|
2654
|
+
const item = checkboxs[i];
|
|
2655
|
+
const option = vue.h(
|
|
2656
|
+
// @ts-ignore
|
|
2657
|
+
vue.resolveComponent("el-checkbox"),
|
|
2658
|
+
{
|
|
2659
|
+
value: propItem.showValue && item[propItem.showValue] || item.value,
|
|
2660
|
+
...optionProps,
|
|
2661
|
+
key: propItem.showValue && item[propItem.showValue] || item.value
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
default: () => item[propItem.showName || "label"]
|
|
2665
|
+
}
|
|
2666
|
+
);
|
|
2667
|
+
res.push(option);
|
|
2668
|
+
}
|
|
2669
|
+
return res;
|
|
2670
|
+
};
|
|
2671
|
+
const generatorSelect = (item) => {
|
|
2672
|
+
var _a2;
|
|
2673
|
+
const formRef = this;
|
|
2674
|
+
const sourceData = item.options || this.sourceData[item.key] || [];
|
|
2675
|
+
let defaultEvent = {
|
|
2676
|
+
"onUpdate:modelValue": (val) => {
|
|
2677
|
+
this.formValues[item.key] = val;
|
|
2678
|
+
}
|
|
2679
|
+
};
|
|
2680
|
+
if (item.effectKeys && item.effectKeys.length > 0) {
|
|
2681
|
+
defaultEvent = {
|
|
2682
|
+
"onUpdate:modelValue": (val) => {
|
|
2683
|
+
this.formValues[item.key] = val;
|
|
2684
|
+
vue.nextTick(() => {
|
|
2685
|
+
if (!this.updateTimeout) {
|
|
2686
|
+
this.updateTimeout = setTimeout(() => {
|
|
2687
|
+
formRef.updateRequestSource(item.effectKeys);
|
|
2688
|
+
this.updateTimeout = null;
|
|
2689
|
+
}, 100);
|
|
2690
|
+
}
|
|
2691
|
+
});
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2695
|
+
const selectProps = {
|
|
2696
|
+
ref: this.setComponentRef(item.key),
|
|
2697
|
+
// 使用 ref 绑定
|
|
2698
|
+
modelValue: this.formValues[item.key],
|
|
2699
|
+
placeholder: item.placeholder,
|
|
2700
|
+
...defaultEvent,
|
|
2701
|
+
...item.componentProps,
|
|
2702
|
+
...item.componentEvents
|
|
2703
|
+
};
|
|
2704
|
+
if ((_a2 = item.custom) == null ? void 0 : _a2.returnObject) {
|
|
2705
|
+
selectProps["value-key"] = item.showValue || "value";
|
|
2706
|
+
}
|
|
2707
|
+
if (item.type === "el-select-v2") {
|
|
2708
|
+
selectProps["options"] = Array.isArray(sourceData) ? sourceData : [];
|
|
2709
|
+
selectProps["key"] = `${item.key}-${Date.now()}`;
|
|
2710
|
+
}
|
|
2711
|
+
if (item.type === "el-select-v2" && item.optionSlot) ;
|
|
2712
|
+
let defaultProps = {
|
|
2713
|
+
default: () => null
|
|
2714
|
+
};
|
|
2715
|
+
if (item.type === "el-select-v2") {
|
|
2716
|
+
defaultProps.default = (optionItem) => item.optionSlot ? item.optionSlot(optionItem, vue.h) : null;
|
|
2717
|
+
} else if (item.type === "el-select") {
|
|
2718
|
+
defaultProps.default = () => {
|
|
2719
|
+
var _a3;
|
|
2720
|
+
return ((_a3 = item.custom) == null ? void 0 : _a3.group) ? generatorOptionsGroup(item, sourceData) : generatorOptions(
|
|
2721
|
+
item,
|
|
2722
|
+
Array.isArray(sourceData) ? sourceData : []
|
|
2723
|
+
);
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
return vue.h(vue.resolveComponent(item.type), selectProps, defaultProps);
|
|
2727
|
+
};
|
|
2728
|
+
const generatorOptionsGroup = (propItem, data = {}) => {
|
|
2729
|
+
const res = [];
|
|
2730
|
+
const ElOpGroupComponents = vue.resolveComponent("el-option-group");
|
|
2731
|
+
for (const key in data) {
|
|
2732
|
+
const optionGroup = vue.h(
|
|
2733
|
+
// @ts-ignore
|
|
2734
|
+
ElOpGroupComponents,
|
|
2735
|
+
{
|
|
2736
|
+
label: key
|
|
2737
|
+
},
|
|
2738
|
+
{ default: () => generatorOptions(propItem, data[key]) }
|
|
2739
|
+
);
|
|
2740
|
+
res.push(optionGroup);
|
|
2741
|
+
}
|
|
2742
|
+
return res;
|
|
2743
|
+
};
|
|
2744
|
+
const generatorOptions = (propItem, data = []) => {
|
|
2745
|
+
var _a2;
|
|
2746
|
+
if (!Array.isArray(data) && !((_a2 = propItem.custom) == null ? void 0 : _a2.group)) {
|
|
2747
|
+
console.warn(
|
|
2748
|
+
`Select options data for key "${propItem.key}" is not an array:`,
|
|
2749
|
+
data
|
|
2750
|
+
);
|
|
2751
|
+
return [];
|
|
2752
|
+
}
|
|
2753
|
+
return data.map((item) => {
|
|
2754
|
+
var _a3;
|
|
2755
|
+
const value = ((_a3 = propItem.custom) == null ? void 0 : _a3.returnObject) ? item : item[propItem.showValue || "value"];
|
|
2756
|
+
item[propItem.showName || "label"];
|
|
2757
|
+
if (value === void 0) {
|
|
2758
|
+
console.warn(
|
|
2759
|
+
`Option value is undefined for key "${propItem.key}":`,
|
|
2760
|
+
item
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2763
|
+
const optionProps = {
|
|
2764
|
+
value,
|
|
2765
|
+
key: item[propItem.showValue || "value"],
|
|
2766
|
+
label: item[propItem.showName || "label"],
|
|
2767
|
+
disabled: item.disabled,
|
|
2768
|
+
...propItem.optionProps
|
|
2769
|
+
};
|
|
2770
|
+
const slots = propItem.optionSlot && typeof propItem.optionSlot === "function" ? { default: () => propItem.optionSlot(item, vue.h) } : { default: () => item[propItem.showName || "label"] };
|
|
2771
|
+
return vue.h(vue.resolveComponent("el-option"), optionProps, slots);
|
|
2772
|
+
});
|
|
2773
|
+
};
|
|
2774
|
+
const generatorDefaultProps = (item) => {
|
|
2775
|
+
return {
|
|
2776
|
+
modelValue: this.formValues[item.key],
|
|
2777
|
+
"onUpdate:modelValue": (val) => {
|
|
2778
|
+
this.formValues[item.key] = val;
|
|
2779
|
+
},
|
|
2780
|
+
placeholder: item.placeholder
|
|
2781
|
+
};
|
|
2782
|
+
};
|
|
2783
|
+
const generatorTipsLabel = (item) => {
|
|
2784
|
+
return vue.h(
|
|
2785
|
+
"span",
|
|
2786
|
+
{
|
|
2787
|
+
class: "fly-form-item-tips"
|
|
2788
|
+
},
|
|
2789
|
+
[
|
|
2790
|
+
item.name,
|
|
2791
|
+
vue.h(
|
|
2792
|
+
// @ts-ignore
|
|
2793
|
+
vue.resolveComponent("el-popover"),
|
|
2794
|
+
{
|
|
2795
|
+
placement: "top-start",
|
|
2796
|
+
title: "提示",
|
|
2797
|
+
width: 200,
|
|
2798
|
+
trigger: "hover",
|
|
2799
|
+
...item.tipLabelProps
|
|
2800
|
+
},
|
|
2801
|
+
{
|
|
2802
|
+
reference: () => vue.h(
|
|
2803
|
+
// @ts-ignore
|
|
2804
|
+
vue.resolveComponent("el-icon"),
|
|
2805
|
+
{
|
|
2806
|
+
class: "fly-form-item-tips-icon"
|
|
2807
|
+
},
|
|
2808
|
+
// @ts-ignore
|
|
2809
|
+
{ default: () => vue.h(vue.resolveComponent("QuestionFilled")) }
|
|
2810
|
+
),
|
|
2811
|
+
default: () => item.tips || ""
|
|
2812
|
+
}
|
|
2813
|
+
)
|
|
2814
|
+
]
|
|
2815
|
+
);
|
|
2816
|
+
};
|
|
2817
|
+
const generatorDefaultEvents = (item) => {
|
|
2818
|
+
if (["el-date-picker"].includes(item.type)) {
|
|
2819
|
+
return {
|
|
2820
|
+
"on-change": (val) => {
|
|
2821
|
+
var _a2, _b;
|
|
2822
|
+
this.formValues[item.key] = val;
|
|
2823
|
+
if (item.effectKeys && item.effectKeys.length > 0) {
|
|
2824
|
+
this.updateRequestSource(item.effectKeys);
|
|
2825
|
+
}
|
|
2826
|
+
(_b = (_a2 = item.componentEvents) == null ? void 0 : _a2["on-change"]) == null ? void 0 : _b.call(_a2, val);
|
|
2827
|
+
}
|
|
2828
|
+
};
|
|
2829
|
+
} else {
|
|
2830
|
+
return {
|
|
2831
|
+
"onUpdate:modelValue": (val) => {
|
|
2832
|
+
var _a2, _b;
|
|
2833
|
+
this.formValues[item.key] = val;
|
|
2834
|
+
if (item.effectKeys && item.effectKeys.length > 0) {
|
|
2835
|
+
this.updateRequestSource(item.effectKeys);
|
|
2836
|
+
}
|
|
2837
|
+
(_b = (_a2 = item.componentEvents) == null ? void 0 : _a2["onUpdate:modelValue"]) == null ? void 0 : _b.call(_a2, val);
|
|
2838
|
+
}
|
|
2839
|
+
};
|
|
2840
|
+
}
|
|
2841
|
+
};
|
|
2842
|
+
const generatorUpload = (item) => {
|
|
2843
|
+
const slots = {};
|
|
2844
|
+
if (item.uploadSlots) {
|
|
2845
|
+
if (item.uploadSlots.default) {
|
|
2846
|
+
slots.default = () => item.uploadSlots.default(vue.h);
|
|
2847
|
+
}
|
|
2848
|
+
if (item.uploadSlots.trigger) {
|
|
2849
|
+
slots.trigger = () => item.uploadSlots.trigger(vue.h);
|
|
2850
|
+
}
|
|
2851
|
+
if (item.uploadSlots.tip) {
|
|
2852
|
+
slots.tip = () => item.uploadSlots.tip(vue.h);
|
|
2853
|
+
}
|
|
2854
|
+
if (item.uploadSlots.file) {
|
|
2855
|
+
slots.file = (props2) => item.uploadSlots.file(props2, vue.h);
|
|
2856
|
+
}
|
|
2857
|
+
if (item.uploadSlots.fileList) {
|
|
2858
|
+
slots.fileList = (props2) => item.uploadSlots.fileList(props2, vue.h);
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
if (!slots.default && !slots.trigger) {
|
|
2862
|
+
slots.default = () => vue.h(
|
|
2863
|
+
vue.resolveComponent("el-button"),
|
|
2864
|
+
{ type: "primary" },
|
|
2865
|
+
{ default: () => "点击上传" }
|
|
2866
|
+
);
|
|
2867
|
+
}
|
|
2868
|
+
const formatFileList = (list) => {
|
|
2869
|
+
if (!list) return [];
|
|
2870
|
+
if (!Array.isArray(list)) return [];
|
|
2871
|
+
return list.map((file) => {
|
|
2872
|
+
if (typeof file === "string") {
|
|
2873
|
+
return {
|
|
2874
|
+
name: file,
|
|
2875
|
+
url: file,
|
|
2876
|
+
uid: Date.now() + Math.random()
|
|
2877
|
+
};
|
|
2878
|
+
}
|
|
2879
|
+
return file;
|
|
2880
|
+
});
|
|
2881
|
+
};
|
|
2882
|
+
const currentFileList = vue.ref(formatFileList(this.formValues[item.key]));
|
|
2883
|
+
return vue.h(
|
|
2884
|
+
vue.resolveComponent("el-upload"),
|
|
2885
|
+
{
|
|
2886
|
+
ref: this.setComponentRef(item.key),
|
|
2887
|
+
// 使用 ref 绑定
|
|
2888
|
+
"file-list": currentFileList.value,
|
|
2889
|
+
"onUpdate:file-list": (val) => {
|
|
2890
|
+
currentFileList.value = val;
|
|
2891
|
+
this.formValues[item.key] = val;
|
|
2892
|
+
},
|
|
2893
|
+
...item.componentProps,
|
|
2894
|
+
...item.componentEvents,
|
|
2895
|
+
"on-success": (response, file, fileList) => {
|
|
2896
|
+
var _a2, _b;
|
|
2897
|
+
if (Array.isArray(fileList)) {
|
|
2898
|
+
currentFileList.value = fileList;
|
|
2899
|
+
this.formValues[item.key] = fileList;
|
|
2900
|
+
} else {
|
|
2901
|
+
if (!Array.isArray(currentFileList.value)) {
|
|
2902
|
+
currentFileList.value = [];
|
|
2903
|
+
}
|
|
2904
|
+
currentFileList.value.push(file);
|
|
2905
|
+
this.formValues[item.key] = currentFileList.value;
|
|
2906
|
+
}
|
|
2907
|
+
(_b = (_a2 = item.componentEvents) == null ? void 0 : _a2["on-success"]) == null ? void 0 : _b.call(_a2, response, file, fileList);
|
|
2908
|
+
}
|
|
2909
|
+
},
|
|
2910
|
+
slots
|
|
2911
|
+
);
|
|
2912
|
+
};
|
|
2913
|
+
const itemNodes = generatorForm(this.formContent);
|
|
2914
|
+
const $formProps = props.formProps || {};
|
|
2915
|
+
if (props.model == "search") {
|
|
2916
|
+
$formProps.inline = true;
|
|
2917
|
+
}
|
|
2918
|
+
const FormNode = vue.h(
|
|
2919
|
+
// @ts-ignore
|
|
2920
|
+
vue.resolveComponent("ElForm"),
|
|
2921
|
+
{
|
|
2922
|
+
ref: "FlyFormRef",
|
|
2923
|
+
model: this.formValues,
|
|
2924
|
+
rules: this.rules,
|
|
2925
|
+
...$formProps,
|
|
2926
|
+
// 隐藏标签时默认标签位置为顶部
|
|
2927
|
+
labelPosition: $formProps.hideLabel ? "top" : $formProps.labelPosition,
|
|
2928
|
+
...props.formEvents
|
|
2929
|
+
},
|
|
2930
|
+
{
|
|
2931
|
+
default: () => [
|
|
2932
|
+
...itemNodes,
|
|
2933
|
+
props.model == "form" ? generatorFooter() : generatorFooterButton()
|
|
2934
|
+
]
|
|
2935
|
+
}
|
|
2936
|
+
);
|
|
2937
|
+
return vue.h(
|
|
2938
|
+
"div",
|
|
2939
|
+
{
|
|
2940
|
+
class: `fly-form ${props.formProps && props.formProps.hideLabel ? "fly-form-hide-label" : ""} ${props.formProps && props.formProps.class || ""} ${props.model == "search" ? "fly-search" : ""}`
|
|
2941
|
+
},
|
|
2942
|
+
FormNode
|
|
2943
|
+
);
|
|
2944
|
+
}
|
|
2945
|
+
});
|
|
2946
|
+
FlyElForm.install = (app) => {
|
|
2947
|
+
app.component(FlyElForm.name, FlyElForm);
|
|
2948
|
+
};
|
|
2949
|
+
exports2.default = FlyElForm;
|
|
2950
|
+
exports2.useFormValues = useFormValues;
|
|
2951
|
+
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
2952
|
+
});
|