@94ai/nf-double-week 3.1.13
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/.eslintrc.cjs +49 -0
- package/README.md +16 -0
- package/components.d.ts +8 -0
- package/lib/index.d.ts +326 -0
- package/lib/nf-double-week.cjs.js +3679 -0
- package/lib/nf-double-week.esm-bundler.js +3679 -0
- package/lib/nf-double-week.vue.d.ts +157 -0
- package/lib/picker.vue.d.ts +151 -0
- package/lib/style/css.d.ts +1 -0
- package/lib/style/css.js +1 -0
- package/lib/style/index.d.ts +1 -0
- package/lib/style/index.js +1 -0
- package/lib/week-range.vue.d.ts +42 -0
- package/lib/week-table.vue.d.ts +11 -0
- package/package/index.ts +8 -0
- package/package/nf-double-week.vue +35 -0
- package/package/picker.vue +779 -0
- package/package/popper.js +1276 -0
- package/package/style/css.ts +1 -0
- package/package/style/index.ts +1 -0
- package/package/week-range.vue +436 -0
- package/package/week-table.vue +296 -0
- package/package.json +34 -0
- package/postcss.config.js +8 -0
|
@@ -0,0 +1,3679 @@
|
|
|
1
|
+
import Vue from "vue";
|
|
2
|
+
import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
for (var i = 0; i < m.length; i++) {
|
|
5
|
+
const e = m[i];
|
|
6
|
+
if (typeof e !== "string" && !Array.isArray(e)) {
|
|
7
|
+
for (const k in e) {
|
|
8
|
+
if (k !== "default" && !(k in n)) {
|
|
9
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
10
|
+
if (d) {
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
|
|
21
|
+
}
|
|
22
|
+
const isServer = Vue.prototype.$isServer;
|
|
23
|
+
const trim = function(string) {
|
|
24
|
+
return (string || "").replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
|
|
25
|
+
};
|
|
26
|
+
const on = function() {
|
|
27
|
+
if (!isServer && document.addEventListener) {
|
|
28
|
+
return function(element, event, handler) {
|
|
29
|
+
if (element && event && handler) {
|
|
30
|
+
element.addEventListener(event, handler, false);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
} else {
|
|
34
|
+
return function(element, event, handler) {
|
|
35
|
+
if (element && event && handler) {
|
|
36
|
+
element.attachEvent("on" + event, handler);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}();
|
|
41
|
+
function hasClass(el, cls) {
|
|
42
|
+
if (!el || !cls)
|
|
43
|
+
return false;
|
|
44
|
+
if (cls.indexOf(" ") !== -1)
|
|
45
|
+
throw new Error("className should not contain space.");
|
|
46
|
+
if (el.classList) {
|
|
47
|
+
return el.classList.contains(cls);
|
|
48
|
+
} else {
|
|
49
|
+
return (" " + el.className + " ").indexOf(" " + cls + " ") > -1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function addClass(el, cls) {
|
|
53
|
+
if (!el)
|
|
54
|
+
return;
|
|
55
|
+
var curClass = el.className;
|
|
56
|
+
var classes = (cls || "").split(" ");
|
|
57
|
+
for (var i = 0, j = classes.length; i < j; i++) {
|
|
58
|
+
var clsName = classes[i];
|
|
59
|
+
if (!clsName)
|
|
60
|
+
continue;
|
|
61
|
+
if (el.classList) {
|
|
62
|
+
el.classList.add(clsName);
|
|
63
|
+
} else if (!hasClass(el, clsName)) {
|
|
64
|
+
curClass += " " + clsName;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!el.classList) {
|
|
68
|
+
el.className = curClass;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function removeClass(el, cls) {
|
|
72
|
+
if (!el || !cls)
|
|
73
|
+
return;
|
|
74
|
+
var classes = cls.split(" ");
|
|
75
|
+
var curClass = " " + el.className + " ";
|
|
76
|
+
for (var i = 0, j = classes.length; i < j; i++) {
|
|
77
|
+
var clsName = classes[i];
|
|
78
|
+
if (!clsName)
|
|
79
|
+
continue;
|
|
80
|
+
if (el.classList) {
|
|
81
|
+
el.classList.remove(clsName);
|
|
82
|
+
} else if (hasClass(el, clsName)) {
|
|
83
|
+
curClass = curClass.replace(" " + clsName + " ", " ");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!el.classList) {
|
|
87
|
+
el.className = trim(curClass);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const nodeList = [];
|
|
91
|
+
const ctx = "@@clickoutsideContext";
|
|
92
|
+
let startClick;
|
|
93
|
+
let seed = 0;
|
|
94
|
+
!Vue.prototype.$isServer && on(document, "mousedown", (e) => startClick = e);
|
|
95
|
+
!Vue.prototype.$isServer && on(document, "mouseup", (e) => {
|
|
96
|
+
nodeList.forEach((node) => node[ctx].documentHandler(e, startClick));
|
|
97
|
+
});
|
|
98
|
+
function createDocumentHandler(el, binding, vnode) {
|
|
99
|
+
return function(mouseup = {}, mousedown = {}) {
|
|
100
|
+
if (!vnode || !vnode.context || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target || vnode.context.popperElm && (vnode.context.popperElm.contains(mouseup.target) || vnode.context.popperElm.contains(mousedown.target)))
|
|
101
|
+
return;
|
|
102
|
+
if (binding.expression && el[ctx].methodName && vnode.context[el[ctx].methodName]) {
|
|
103
|
+
vnode.context[el[ctx].methodName]();
|
|
104
|
+
} else {
|
|
105
|
+
el[ctx].bindingFn && el[ctx].bindingFn();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const Clickoutside = {
|
|
110
|
+
bind(el, binding, vnode) {
|
|
111
|
+
nodeList.push(el);
|
|
112
|
+
const id = seed++;
|
|
113
|
+
el[ctx] = {
|
|
114
|
+
id,
|
|
115
|
+
documentHandler: createDocumentHandler(el, binding, vnode),
|
|
116
|
+
methodName: binding.expression,
|
|
117
|
+
bindingFn: binding.value
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
update(el, binding, vnode) {
|
|
121
|
+
el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
|
|
122
|
+
el[ctx].methodName = binding.expression;
|
|
123
|
+
el[ctx].bindingFn = binding.value;
|
|
124
|
+
},
|
|
125
|
+
unbind(el) {
|
|
126
|
+
let len = nodeList.length;
|
|
127
|
+
for (let i = 0; i < len; i++) {
|
|
128
|
+
if (nodeList[i][ctx].id === el[ctx].id) {
|
|
129
|
+
nodeList.splice(i, 1);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
delete el[ctx];
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
137
|
+
function getDefaultExportFromCjs(x) {
|
|
138
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
139
|
+
}
|
|
140
|
+
var date = { exports: {} };
|
|
141
|
+
(function(module) {
|
|
142
|
+
(function(main) {
|
|
143
|
+
var fecha2 = {};
|
|
144
|
+
var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
|
|
145
|
+
var twoDigits = "\\d\\d?";
|
|
146
|
+
var threeDigits = "\\d{3}";
|
|
147
|
+
var fourDigits = "\\d{4}";
|
|
148
|
+
var word = "[^\\s]+";
|
|
149
|
+
var literal = /\[([^]*?)\]/gm;
|
|
150
|
+
var noop = function() {
|
|
151
|
+
};
|
|
152
|
+
function regexEscape(str) {
|
|
153
|
+
return str.replace(/[|\\{()[^$+*?.-]/g, "\\$&");
|
|
154
|
+
}
|
|
155
|
+
function shorten(arr, sLen) {
|
|
156
|
+
var newArr = [];
|
|
157
|
+
for (var i = 0, len = arr.length; i < len; i++) {
|
|
158
|
+
newArr.push(arr[i].substr(0, sLen));
|
|
159
|
+
}
|
|
160
|
+
return newArr;
|
|
161
|
+
}
|
|
162
|
+
function monthUpdate(arrName) {
|
|
163
|
+
return function(d, v, i18n) {
|
|
164
|
+
var index = i18n[arrName].indexOf(v.charAt(0).toUpperCase() + v.substr(1).toLowerCase());
|
|
165
|
+
if (~index) {
|
|
166
|
+
d.month = index;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function pad(val, len) {
|
|
171
|
+
val = String(val);
|
|
172
|
+
len = len || 2;
|
|
173
|
+
while (val.length < len) {
|
|
174
|
+
val = "0" + val;
|
|
175
|
+
}
|
|
176
|
+
return val;
|
|
177
|
+
}
|
|
178
|
+
var dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
179
|
+
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
180
|
+
var monthNamesShort = shorten(monthNames, 3);
|
|
181
|
+
var dayNamesShort = shorten(dayNames, 3);
|
|
182
|
+
fecha2.i18n = {
|
|
183
|
+
dayNamesShort,
|
|
184
|
+
dayNames,
|
|
185
|
+
monthNamesShort,
|
|
186
|
+
monthNames,
|
|
187
|
+
amPm: ["am", "pm"],
|
|
188
|
+
DoFn: function DoFn(D) {
|
|
189
|
+
return D + ["th", "st", "nd", "rd"][D % 10 > 3 ? 0 : (D - D % 10 !== 10) * D % 10];
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var formatFlags = {
|
|
193
|
+
D: function(dateObj) {
|
|
194
|
+
return dateObj.getDay();
|
|
195
|
+
},
|
|
196
|
+
DD: function(dateObj) {
|
|
197
|
+
return pad(dateObj.getDay());
|
|
198
|
+
},
|
|
199
|
+
Do: function(dateObj, i18n) {
|
|
200
|
+
return i18n.DoFn(dateObj.getDate());
|
|
201
|
+
},
|
|
202
|
+
d: function(dateObj) {
|
|
203
|
+
return dateObj.getDate();
|
|
204
|
+
},
|
|
205
|
+
dd: function(dateObj) {
|
|
206
|
+
return pad(dateObj.getDate());
|
|
207
|
+
},
|
|
208
|
+
ddd: function(dateObj, i18n) {
|
|
209
|
+
return i18n.dayNamesShort[dateObj.getDay()];
|
|
210
|
+
},
|
|
211
|
+
dddd: function(dateObj, i18n) {
|
|
212
|
+
return i18n.dayNames[dateObj.getDay()];
|
|
213
|
+
},
|
|
214
|
+
M: function(dateObj) {
|
|
215
|
+
return dateObj.getMonth() + 1;
|
|
216
|
+
},
|
|
217
|
+
MM: function(dateObj) {
|
|
218
|
+
return pad(dateObj.getMonth() + 1);
|
|
219
|
+
},
|
|
220
|
+
MMM: function(dateObj, i18n) {
|
|
221
|
+
return i18n.monthNamesShort[dateObj.getMonth()];
|
|
222
|
+
},
|
|
223
|
+
MMMM: function(dateObj, i18n) {
|
|
224
|
+
return i18n.monthNames[dateObj.getMonth()];
|
|
225
|
+
},
|
|
226
|
+
yy: function(dateObj) {
|
|
227
|
+
return pad(String(dateObj.getFullYear()), 4).substr(2);
|
|
228
|
+
},
|
|
229
|
+
yyyy: function(dateObj) {
|
|
230
|
+
return pad(dateObj.getFullYear(), 4);
|
|
231
|
+
},
|
|
232
|
+
h: function(dateObj) {
|
|
233
|
+
return dateObj.getHours() % 12 || 12;
|
|
234
|
+
},
|
|
235
|
+
hh: function(dateObj) {
|
|
236
|
+
return pad(dateObj.getHours() % 12 || 12);
|
|
237
|
+
},
|
|
238
|
+
H: function(dateObj) {
|
|
239
|
+
return dateObj.getHours();
|
|
240
|
+
},
|
|
241
|
+
HH: function(dateObj) {
|
|
242
|
+
return pad(dateObj.getHours());
|
|
243
|
+
},
|
|
244
|
+
m: function(dateObj) {
|
|
245
|
+
return dateObj.getMinutes();
|
|
246
|
+
},
|
|
247
|
+
mm: function(dateObj) {
|
|
248
|
+
return pad(dateObj.getMinutes());
|
|
249
|
+
},
|
|
250
|
+
s: function(dateObj) {
|
|
251
|
+
return dateObj.getSeconds();
|
|
252
|
+
},
|
|
253
|
+
ss: function(dateObj) {
|
|
254
|
+
return pad(dateObj.getSeconds());
|
|
255
|
+
},
|
|
256
|
+
S: function(dateObj) {
|
|
257
|
+
return Math.round(dateObj.getMilliseconds() / 100);
|
|
258
|
+
},
|
|
259
|
+
SS: function(dateObj) {
|
|
260
|
+
return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
|
|
261
|
+
},
|
|
262
|
+
SSS: function(dateObj) {
|
|
263
|
+
return pad(dateObj.getMilliseconds(), 3);
|
|
264
|
+
},
|
|
265
|
+
a: function(dateObj, i18n) {
|
|
266
|
+
return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1];
|
|
267
|
+
},
|
|
268
|
+
A: function(dateObj, i18n) {
|
|
269
|
+
return dateObj.getHours() < 12 ? i18n.amPm[0].toUpperCase() : i18n.amPm[1].toUpperCase();
|
|
270
|
+
},
|
|
271
|
+
ZZ: function(dateObj) {
|
|
272
|
+
var o = dateObj.getTimezoneOffset();
|
|
273
|
+
return (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
var parseFlags = {
|
|
277
|
+
d: [twoDigits, function(d, v) {
|
|
278
|
+
d.day = v;
|
|
279
|
+
}],
|
|
280
|
+
Do: [twoDigits + word, function(d, v) {
|
|
281
|
+
d.day = parseInt(v, 10);
|
|
282
|
+
}],
|
|
283
|
+
M: [twoDigits, function(d, v) {
|
|
284
|
+
d.month = v - 1;
|
|
285
|
+
}],
|
|
286
|
+
yy: [twoDigits, function(d, v) {
|
|
287
|
+
var da = /* @__PURE__ */ new Date(), cent = +("" + da.getFullYear()).substr(0, 2);
|
|
288
|
+
d.year = "" + (v > 68 ? cent - 1 : cent) + v;
|
|
289
|
+
}],
|
|
290
|
+
h: [twoDigits, function(d, v) {
|
|
291
|
+
d.hour = v;
|
|
292
|
+
}],
|
|
293
|
+
m: [twoDigits, function(d, v) {
|
|
294
|
+
d.minute = v;
|
|
295
|
+
}],
|
|
296
|
+
s: [twoDigits, function(d, v) {
|
|
297
|
+
d.second = v;
|
|
298
|
+
}],
|
|
299
|
+
yyyy: [fourDigits, function(d, v) {
|
|
300
|
+
d.year = v;
|
|
301
|
+
}],
|
|
302
|
+
S: ["\\d", function(d, v) {
|
|
303
|
+
d.millisecond = v * 100;
|
|
304
|
+
}],
|
|
305
|
+
SS: ["\\d{2}", function(d, v) {
|
|
306
|
+
d.millisecond = v * 10;
|
|
307
|
+
}],
|
|
308
|
+
SSS: [threeDigits, function(d, v) {
|
|
309
|
+
d.millisecond = v;
|
|
310
|
+
}],
|
|
311
|
+
D: [twoDigits, noop],
|
|
312
|
+
ddd: [word, noop],
|
|
313
|
+
MMM: [word, monthUpdate("monthNamesShort")],
|
|
314
|
+
MMMM: [word, monthUpdate("monthNames")],
|
|
315
|
+
a: [word, function(d, v, i18n) {
|
|
316
|
+
var val = v.toLowerCase();
|
|
317
|
+
if (val === i18n.amPm[0]) {
|
|
318
|
+
d.isPm = false;
|
|
319
|
+
} else if (val === i18n.amPm[1]) {
|
|
320
|
+
d.isPm = true;
|
|
321
|
+
}
|
|
322
|
+
}],
|
|
323
|
+
ZZ: ["[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z", function(d, v) {
|
|
324
|
+
var parts = (v + "").match(/([+-]|\d\d)/gi), minutes;
|
|
325
|
+
if (parts) {
|
|
326
|
+
minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
|
|
327
|
+
d.timezoneOffset = parts[0] === "+" ? minutes : -minutes;
|
|
328
|
+
}
|
|
329
|
+
}]
|
|
330
|
+
};
|
|
331
|
+
parseFlags.dd = parseFlags.d;
|
|
332
|
+
parseFlags.dddd = parseFlags.ddd;
|
|
333
|
+
parseFlags.DD = parseFlags.D;
|
|
334
|
+
parseFlags.mm = parseFlags.m;
|
|
335
|
+
parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
|
|
336
|
+
parseFlags.MM = parseFlags.M;
|
|
337
|
+
parseFlags.ss = parseFlags.s;
|
|
338
|
+
parseFlags.A = parseFlags.a;
|
|
339
|
+
fecha2.masks = {
|
|
340
|
+
default: "ddd MMM dd yyyy HH:mm:ss",
|
|
341
|
+
shortDate: "M/D/yy",
|
|
342
|
+
mediumDate: "MMM d, yyyy",
|
|
343
|
+
longDate: "MMMM d, yyyy",
|
|
344
|
+
fullDate: "dddd, MMMM d, yyyy",
|
|
345
|
+
shortTime: "HH:mm",
|
|
346
|
+
mediumTime: "HH:mm:ss",
|
|
347
|
+
longTime: "HH:mm:ss.SSS"
|
|
348
|
+
};
|
|
349
|
+
fecha2.format = function(dateObj, mask, i18nSettings) {
|
|
350
|
+
var i18n = i18nSettings || fecha2.i18n;
|
|
351
|
+
if (typeof dateObj === "number") {
|
|
352
|
+
dateObj = new Date(dateObj);
|
|
353
|
+
}
|
|
354
|
+
if (Object.prototype.toString.call(dateObj) !== "[object Date]" || isNaN(dateObj.getTime())) {
|
|
355
|
+
throw new Error("Invalid Date in fecha.format");
|
|
356
|
+
}
|
|
357
|
+
mask = fecha2.masks[mask] || mask || fecha2.masks["default"];
|
|
358
|
+
var literals = [];
|
|
359
|
+
mask = mask.replace(literal, function($0, $1) {
|
|
360
|
+
literals.push($1);
|
|
361
|
+
return "@@@";
|
|
362
|
+
});
|
|
363
|
+
mask = mask.replace(token, function($0) {
|
|
364
|
+
return $0 in formatFlags ? formatFlags[$0](dateObj, i18n) : $0.slice(1, $0.length - 1);
|
|
365
|
+
});
|
|
366
|
+
return mask.replace(/@@@/g, function() {
|
|
367
|
+
return literals.shift();
|
|
368
|
+
});
|
|
369
|
+
};
|
|
370
|
+
fecha2.parse = function(dateStr, format2, i18nSettings) {
|
|
371
|
+
var i18n = i18nSettings || fecha2.i18n;
|
|
372
|
+
if (typeof format2 !== "string") {
|
|
373
|
+
throw new Error("Invalid format in fecha.parse");
|
|
374
|
+
}
|
|
375
|
+
format2 = fecha2.masks[format2] || format2;
|
|
376
|
+
if (dateStr.length > 1e3) {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
var dateInfo = {};
|
|
380
|
+
var parseInfo = [];
|
|
381
|
+
var literals = [];
|
|
382
|
+
format2 = format2.replace(literal, function($0, $1) {
|
|
383
|
+
literals.push($1);
|
|
384
|
+
return "@@@";
|
|
385
|
+
});
|
|
386
|
+
var newFormat = regexEscape(format2).replace(token, function($0) {
|
|
387
|
+
if (parseFlags[$0]) {
|
|
388
|
+
var info = parseFlags[$0];
|
|
389
|
+
parseInfo.push(info[1]);
|
|
390
|
+
return "(" + info[0] + ")";
|
|
391
|
+
}
|
|
392
|
+
return $0;
|
|
393
|
+
});
|
|
394
|
+
newFormat = newFormat.replace(/@@@/g, function() {
|
|
395
|
+
return literals.shift();
|
|
396
|
+
});
|
|
397
|
+
var matches = dateStr.match(new RegExp(newFormat, "i"));
|
|
398
|
+
if (!matches) {
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
for (var i = 1; i < matches.length; i++) {
|
|
402
|
+
parseInfo[i - 1](dateInfo, matches[i], i18n);
|
|
403
|
+
}
|
|
404
|
+
var today = /* @__PURE__ */ new Date();
|
|
405
|
+
if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
|
|
406
|
+
dateInfo.hour = +dateInfo.hour + 12;
|
|
407
|
+
} else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
|
|
408
|
+
dateInfo.hour = 0;
|
|
409
|
+
}
|
|
410
|
+
var date2;
|
|
411
|
+
if (dateInfo.timezoneOffset != null) {
|
|
412
|
+
dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
|
|
413
|
+
date2 = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
|
|
414
|
+
} else {
|
|
415
|
+
date2 = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
|
|
416
|
+
}
|
|
417
|
+
return date2;
|
|
418
|
+
};
|
|
419
|
+
if (module.exports) {
|
|
420
|
+
module.exports = fecha2;
|
|
421
|
+
} else {
|
|
422
|
+
main.fecha = fecha2;
|
|
423
|
+
}
|
|
424
|
+
})(commonjsGlobal);
|
|
425
|
+
})(date);
|
|
426
|
+
var dateExports = date.exports;
|
|
427
|
+
const fecha = /* @__PURE__ */ getDefaultExportFromCjs(dateExports);
|
|
428
|
+
const defaultLang = {
|
|
429
|
+
el: {
|
|
430
|
+
colorpicker: {
|
|
431
|
+
confirm: "确定",
|
|
432
|
+
clear: "清空"
|
|
433
|
+
},
|
|
434
|
+
datepicker: {
|
|
435
|
+
now: "此刻",
|
|
436
|
+
today: "今天",
|
|
437
|
+
cancel: "取消",
|
|
438
|
+
clear: "清空",
|
|
439
|
+
confirm: "确定",
|
|
440
|
+
selectDate: "选择日期",
|
|
441
|
+
selectTime: "选择时间",
|
|
442
|
+
startDate: "开始日期",
|
|
443
|
+
startTime: "开始时间",
|
|
444
|
+
endDate: "结束日期",
|
|
445
|
+
endTime: "结束时间",
|
|
446
|
+
prevYear: "前一年",
|
|
447
|
+
nextYear: "后一年",
|
|
448
|
+
prevMonth: "上个月",
|
|
449
|
+
nextMonth: "下个月",
|
|
450
|
+
year: "年",
|
|
451
|
+
month1: "1 月",
|
|
452
|
+
month2: "2 月",
|
|
453
|
+
month3: "3 月",
|
|
454
|
+
month4: "4 月",
|
|
455
|
+
month5: "5 月",
|
|
456
|
+
month6: "6 月",
|
|
457
|
+
month7: "7 月",
|
|
458
|
+
month8: "8 月",
|
|
459
|
+
month9: "9 月",
|
|
460
|
+
month10: "10 月",
|
|
461
|
+
month11: "11 月",
|
|
462
|
+
month12: "12 月",
|
|
463
|
+
// week: '周次',
|
|
464
|
+
weeks: {
|
|
465
|
+
sun: "日",
|
|
466
|
+
mon: "一",
|
|
467
|
+
tue: "二",
|
|
468
|
+
wed: "三",
|
|
469
|
+
thu: "四",
|
|
470
|
+
fri: "五",
|
|
471
|
+
sat: "六"
|
|
472
|
+
},
|
|
473
|
+
months: {
|
|
474
|
+
jan: "一月",
|
|
475
|
+
feb: "二月",
|
|
476
|
+
mar: "三月",
|
|
477
|
+
apr: "四月",
|
|
478
|
+
may: "五月",
|
|
479
|
+
jun: "六月",
|
|
480
|
+
jul: "七月",
|
|
481
|
+
aug: "八月",
|
|
482
|
+
sep: "九月",
|
|
483
|
+
oct: "十月",
|
|
484
|
+
nov: "十一月",
|
|
485
|
+
dec: "十二月"
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
select: {
|
|
489
|
+
loading: "加载中",
|
|
490
|
+
noMatch: "无匹配数据",
|
|
491
|
+
noData: "无数据",
|
|
492
|
+
placeholder: "请选择"
|
|
493
|
+
},
|
|
494
|
+
cascader: {
|
|
495
|
+
noMatch: "无匹配数据",
|
|
496
|
+
loading: "加载中",
|
|
497
|
+
placeholder: "请选择",
|
|
498
|
+
noData: "暂无数据"
|
|
499
|
+
},
|
|
500
|
+
pagination: {
|
|
501
|
+
goto: "前往",
|
|
502
|
+
pagesize: "条/页",
|
|
503
|
+
total: "共 {total} 条",
|
|
504
|
+
pageClassifier: "页"
|
|
505
|
+
},
|
|
506
|
+
messagebox: {
|
|
507
|
+
title: "提示",
|
|
508
|
+
confirm: "确定",
|
|
509
|
+
cancel: "取消",
|
|
510
|
+
error: "输入的数据不合法!"
|
|
511
|
+
},
|
|
512
|
+
upload: {
|
|
513
|
+
deleteTip: "按 delete 键可删除",
|
|
514
|
+
delete: "删除",
|
|
515
|
+
preview: "查看图片",
|
|
516
|
+
continue: "继续上传"
|
|
517
|
+
},
|
|
518
|
+
table: {
|
|
519
|
+
emptyText: "暂无数据",
|
|
520
|
+
confirmFilter: "筛选",
|
|
521
|
+
resetFilter: "重置",
|
|
522
|
+
clearFilter: "全部",
|
|
523
|
+
sumText: "合计"
|
|
524
|
+
},
|
|
525
|
+
tree: {
|
|
526
|
+
emptyText: "暂无数据"
|
|
527
|
+
},
|
|
528
|
+
transfer: {
|
|
529
|
+
noMatch: "无匹配数据",
|
|
530
|
+
noData: "无数据",
|
|
531
|
+
titles: ["列表 1", "列表 2"],
|
|
532
|
+
filterPlaceholder: "请输入搜索内容",
|
|
533
|
+
noCheckedFormat: "共 {total} 项",
|
|
534
|
+
hasCheckedFormat: "已选 {checked}/{total} 项"
|
|
535
|
+
},
|
|
536
|
+
image: {
|
|
537
|
+
error: "加载失败"
|
|
538
|
+
},
|
|
539
|
+
pageHeader: {
|
|
540
|
+
title: "返回"
|
|
541
|
+
},
|
|
542
|
+
popconfirm: {
|
|
543
|
+
confirmButtonText: "确定",
|
|
544
|
+
cancelButtonText: "取消"
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
var isMergeableObject = function isMergeableObject2(value) {
|
|
549
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
550
|
+
};
|
|
551
|
+
function isNonNullObject(value) {
|
|
552
|
+
return !!value && typeof value === "object";
|
|
553
|
+
}
|
|
554
|
+
function isSpecial(value) {
|
|
555
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
556
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
557
|
+
}
|
|
558
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
559
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
560
|
+
function isReactElement(value) {
|
|
561
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
562
|
+
}
|
|
563
|
+
function emptyTarget(val) {
|
|
564
|
+
return Array.isArray(val) ? [] : {};
|
|
565
|
+
}
|
|
566
|
+
function cloneIfNecessary(value, optionsArgument) {
|
|
567
|
+
var clone = optionsArgument && optionsArgument.clone === true;
|
|
568
|
+
return clone && isMergeableObject(value) ? deepmerge(emptyTarget(value), value, optionsArgument) : value;
|
|
569
|
+
}
|
|
570
|
+
function defaultArrayMerge(target, source, optionsArgument) {
|
|
571
|
+
var destination = target.slice();
|
|
572
|
+
source.forEach(function(e, i) {
|
|
573
|
+
if (typeof destination[i] === "undefined") {
|
|
574
|
+
destination[i] = cloneIfNecessary(e, optionsArgument);
|
|
575
|
+
} else if (isMergeableObject(e)) {
|
|
576
|
+
destination[i] = deepmerge(target[i], e, optionsArgument);
|
|
577
|
+
} else if (target.indexOf(e) === -1) {
|
|
578
|
+
destination.push(cloneIfNecessary(e, optionsArgument));
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
return destination;
|
|
582
|
+
}
|
|
583
|
+
function mergeObject(target, source, optionsArgument) {
|
|
584
|
+
var destination = {};
|
|
585
|
+
if (isMergeableObject(target)) {
|
|
586
|
+
Object.keys(target).forEach(function(key) {
|
|
587
|
+
destination[key] = cloneIfNecessary(target[key], optionsArgument);
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
Object.keys(source).forEach(function(key) {
|
|
591
|
+
if (!isMergeableObject(source[key]) || !target[key]) {
|
|
592
|
+
destination[key] = cloneIfNecessary(source[key], optionsArgument);
|
|
593
|
+
} else {
|
|
594
|
+
destination[key] = deepmerge(target[key], source[key], optionsArgument);
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
return destination;
|
|
598
|
+
}
|
|
599
|
+
function deepmerge(target, source, optionsArgument) {
|
|
600
|
+
var sourceIsArray = Array.isArray(source);
|
|
601
|
+
var targetIsArray = Array.isArray(target);
|
|
602
|
+
var options = optionsArgument || {
|
|
603
|
+
arrayMerge: defaultArrayMerge
|
|
604
|
+
};
|
|
605
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
606
|
+
if (!sourceAndTargetTypesMatch) {
|
|
607
|
+
return cloneIfNecessary(source, optionsArgument);
|
|
608
|
+
} else if (sourceIsArray) {
|
|
609
|
+
var arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
610
|
+
return arrayMerge(target, source, optionsArgument);
|
|
611
|
+
} else {
|
|
612
|
+
return mergeObject(target, source, optionsArgument);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
deepmerge.all = function deepmergeAll(array, optionsArgument) {
|
|
616
|
+
if (!Array.isArray(array) || array.length < 2) {
|
|
617
|
+
throw new Error("first argument should be an array with at least two elements");
|
|
618
|
+
}
|
|
619
|
+
return array.reduce(function(prev, next) {
|
|
620
|
+
return deepmerge(prev, next, optionsArgument);
|
|
621
|
+
});
|
|
622
|
+
};
|
|
623
|
+
var deepmerge_1 = deepmerge;
|
|
624
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
625
|
+
function hasOwn(obj, key) {
|
|
626
|
+
return hasOwnProperty.call(obj, key);
|
|
627
|
+
}
|
|
628
|
+
const arrayFindIndex = function(arr, pred) {
|
|
629
|
+
for (let i = 0; i !== arr.length; ++i) {
|
|
630
|
+
if (pred(arr[i])) {
|
|
631
|
+
return i;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
return -1;
|
|
635
|
+
};
|
|
636
|
+
const arrayFind = function(arr, pred) {
|
|
637
|
+
const idx = arrayFindIndex(arr, pred);
|
|
638
|
+
return idx !== -1 ? arr[idx] : void 0;
|
|
639
|
+
};
|
|
640
|
+
const coerceTruthyValueToArray = function(val) {
|
|
641
|
+
if (Array.isArray(val)) {
|
|
642
|
+
return val;
|
|
643
|
+
} else if (val) {
|
|
644
|
+
return [val];
|
|
645
|
+
} else {
|
|
646
|
+
return [];
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
const RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g;
|
|
650
|
+
function Format(Vue2) {
|
|
651
|
+
function template(string, ...args) {
|
|
652
|
+
if (args.length === 1 && typeof args[0] === "object") {
|
|
653
|
+
args = args[0];
|
|
654
|
+
}
|
|
655
|
+
if (!args || !args.hasOwnProperty) {
|
|
656
|
+
args = {};
|
|
657
|
+
}
|
|
658
|
+
return string.replace(RE_NARGS, (match, prefix, i, index) => {
|
|
659
|
+
let result;
|
|
660
|
+
if (string[index - 1] === "{" && string[index + match.length] === "}") {
|
|
661
|
+
return i;
|
|
662
|
+
} else {
|
|
663
|
+
result = hasOwn(args, i) ? args[i] : null;
|
|
664
|
+
if (result === null || result === void 0) {
|
|
665
|
+
return "";
|
|
666
|
+
}
|
|
667
|
+
return result;
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
return template;
|
|
672
|
+
}
|
|
673
|
+
const format = Format();
|
|
674
|
+
let lang = defaultLang;
|
|
675
|
+
let merged = false;
|
|
676
|
+
let i18nHandler = function() {
|
|
677
|
+
const vuei18n = Object.getPrototypeOf(this || Vue).$t;
|
|
678
|
+
if (typeof vuei18n === "function" && !!Vue.locale) {
|
|
679
|
+
if (!merged) {
|
|
680
|
+
merged = true;
|
|
681
|
+
Vue.locale(Vue.config.lang, deepmerge_1(lang, Vue.locale(Vue.config.lang) || {}, {
|
|
682
|
+
clone: true
|
|
683
|
+
}));
|
|
684
|
+
}
|
|
685
|
+
return vuei18n.apply(this, arguments);
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
const t = function(path, options) {
|
|
689
|
+
let value = i18nHandler.apply(this, arguments);
|
|
690
|
+
if (value !== null && value !== void 0)
|
|
691
|
+
return value;
|
|
692
|
+
const array = path.split(".");
|
|
693
|
+
let current = lang;
|
|
694
|
+
for (let i = 0, j = array.length; i < j; i++) {
|
|
695
|
+
const property = array[i];
|
|
696
|
+
value = current[property];
|
|
697
|
+
if (i === j - 1)
|
|
698
|
+
return format(value, options);
|
|
699
|
+
if (!value)
|
|
700
|
+
return "";
|
|
701
|
+
current = value;
|
|
702
|
+
}
|
|
703
|
+
return "";
|
|
704
|
+
};
|
|
705
|
+
const weeks = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
706
|
+
const months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
|
|
707
|
+
const getI18nSettings = () => {
|
|
708
|
+
return {
|
|
709
|
+
dayNamesShort: weeks.map((week) => t(`el.datepicker.weeks.${week}`)),
|
|
710
|
+
dayNames: weeks.map((week) => t(`el.datepicker.weeks.${week}`)),
|
|
711
|
+
monthNamesShort: months.map((month) => t(`el.datepicker.months.${month}`)),
|
|
712
|
+
monthNames: months.map((month, index) => t(`el.datepicker.month${index + 1}`)),
|
|
713
|
+
amPm: ["am", "pm"]
|
|
714
|
+
};
|
|
715
|
+
};
|
|
716
|
+
const toDate = function(date2) {
|
|
717
|
+
return isDate(date2) ? new Date(date2) : null;
|
|
718
|
+
};
|
|
719
|
+
const isDate = function(date2) {
|
|
720
|
+
if (date2 === null || date2 === void 0)
|
|
721
|
+
return false;
|
|
722
|
+
if (isNaN(new Date(date2).getTime()))
|
|
723
|
+
return false;
|
|
724
|
+
if (Array.isArray(date2))
|
|
725
|
+
return false;
|
|
726
|
+
return true;
|
|
727
|
+
};
|
|
728
|
+
const isDateObject = function(val) {
|
|
729
|
+
return val instanceof Date;
|
|
730
|
+
};
|
|
731
|
+
const formatDate = function(date2, format2) {
|
|
732
|
+
date2 = toDate(date2);
|
|
733
|
+
if (!date2)
|
|
734
|
+
return "";
|
|
735
|
+
return fecha.format(date2, format2 || "yyyy-MM-dd", getI18nSettings());
|
|
736
|
+
};
|
|
737
|
+
const parseDate = function(string, format2) {
|
|
738
|
+
return fecha.parse(string, format2 || "yyyy-MM-dd", getI18nSettings());
|
|
739
|
+
};
|
|
740
|
+
const getDayCountOfMonth = function(year, month) {
|
|
741
|
+
if (month === 3 || month === 5 || month === 8 || month === 10) {
|
|
742
|
+
return 30;
|
|
743
|
+
}
|
|
744
|
+
if (month === 1) {
|
|
745
|
+
if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
|
|
746
|
+
return 29;
|
|
747
|
+
} else {
|
|
748
|
+
return 28;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return 31;
|
|
752
|
+
};
|
|
753
|
+
const getFirstDayOfMonth = function(date2) {
|
|
754
|
+
const temp = new Date(date2.getTime());
|
|
755
|
+
temp.setDate(1);
|
|
756
|
+
return temp.getDay();
|
|
757
|
+
};
|
|
758
|
+
const prevDate = function(date2, amount = 1) {
|
|
759
|
+
return new Date(date2.getFullYear(), date2.getMonth(), date2.getDate() - amount);
|
|
760
|
+
};
|
|
761
|
+
const nextDate = function(date2, amount = 1) {
|
|
762
|
+
return new Date(date2.getFullYear(), date2.getMonth(), date2.getDate() + amount);
|
|
763
|
+
};
|
|
764
|
+
const getStartDateOfMonth = function(year, month) {
|
|
765
|
+
const result = new Date(year, month, 1);
|
|
766
|
+
const day = result.getDay();
|
|
767
|
+
if (day === 0) {
|
|
768
|
+
return prevDate(result, 7);
|
|
769
|
+
} else {
|
|
770
|
+
return prevDate(result, day);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
const getWeekNumber = function(src) {
|
|
774
|
+
if (!isDate(src))
|
|
775
|
+
return null;
|
|
776
|
+
const date2 = new Date(src.getTime());
|
|
777
|
+
date2.setHours(0, 0, 0, 0);
|
|
778
|
+
date2.setDate(date2.getDate() + 3 - (date2.getDay() + 6) % 7);
|
|
779
|
+
const week1 = new Date(date2.getFullYear(), 0, 4);
|
|
780
|
+
return 1 + Math.round(((date2.getTime() - week1.getTime()) / 864e5 - 3 + (week1.getDay() + 6) % 7) / 7);
|
|
781
|
+
};
|
|
782
|
+
const modifyDate = function(date2, y, m, d) {
|
|
783
|
+
return new Date(y, m, d, date2.getHours(), date2.getMinutes(), date2.getSeconds(), date2.getMilliseconds());
|
|
784
|
+
};
|
|
785
|
+
const modifyTime = function(date2, h, m, s) {
|
|
786
|
+
return new Date(date2.getFullYear(), date2.getMonth(), date2.getDate(), h, m, s, date2.getMilliseconds());
|
|
787
|
+
};
|
|
788
|
+
const modifyWithTimeString = (date2, time) => {
|
|
789
|
+
if (date2 == null || !time) {
|
|
790
|
+
return date2;
|
|
791
|
+
}
|
|
792
|
+
time = parseDate(time, "HH:mm:ss");
|
|
793
|
+
return modifyTime(date2, time.getHours(), time.getMinutes(), time.getSeconds());
|
|
794
|
+
};
|
|
795
|
+
const clearTime = function(date2) {
|
|
796
|
+
return new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
|
|
797
|
+
};
|
|
798
|
+
const changeYearMonthAndClampDate = function(date2, year, month) {
|
|
799
|
+
const monthDate = Math.min(date2.getDate(), getDayCountOfMonth(year, month));
|
|
800
|
+
return modifyDate(date2, year, month, monthDate);
|
|
801
|
+
};
|
|
802
|
+
const prevMonth = function(date2) {
|
|
803
|
+
const year = date2.getFullYear();
|
|
804
|
+
const month = date2.getMonth();
|
|
805
|
+
return month === 0 ? changeYearMonthAndClampDate(date2, year - 1, 11) : changeYearMonthAndClampDate(date2, year, month - 1);
|
|
806
|
+
};
|
|
807
|
+
const nextMonth = function(date2) {
|
|
808
|
+
const year = date2.getFullYear();
|
|
809
|
+
const month = date2.getMonth();
|
|
810
|
+
return month === 11 ? changeYearMonthAndClampDate(date2, year + 1, 0) : changeYearMonthAndClampDate(date2, year, month + 1);
|
|
811
|
+
};
|
|
812
|
+
const prevYear = function(date2, amount = 1) {
|
|
813
|
+
const year = date2.getFullYear();
|
|
814
|
+
const month = date2.getMonth();
|
|
815
|
+
return changeYearMonthAndClampDate(date2, year - amount, month);
|
|
816
|
+
};
|
|
817
|
+
const nextYear = function(date2, amount = 1) {
|
|
818
|
+
const year = date2.getFullYear();
|
|
819
|
+
const month = date2.getMonth();
|
|
820
|
+
return changeYearMonthAndClampDate(date2, year + amount, month);
|
|
821
|
+
};
|
|
822
|
+
function merge(target) {
|
|
823
|
+
for (let i = 1, j = arguments.length; i < j; i++) {
|
|
824
|
+
let source = arguments[i] || {};
|
|
825
|
+
for (let prop in source) {
|
|
826
|
+
if (source.hasOwnProperty(prop)) {
|
|
827
|
+
let value = source[prop];
|
|
828
|
+
if (value !== void 0) {
|
|
829
|
+
target[prop] = value;
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
return target;
|
|
835
|
+
}
|
|
836
|
+
let hasModal = false;
|
|
837
|
+
let hasInitZIndex = false;
|
|
838
|
+
let zIndex;
|
|
839
|
+
const getModal = function() {
|
|
840
|
+
if (Vue.prototype.$isServer)
|
|
841
|
+
return;
|
|
842
|
+
let modalDom = PopupManager.modalDom;
|
|
843
|
+
if (modalDom) {
|
|
844
|
+
hasModal = true;
|
|
845
|
+
} else {
|
|
846
|
+
hasModal = false;
|
|
847
|
+
modalDom = document.createElement("div");
|
|
848
|
+
PopupManager.modalDom = modalDom;
|
|
849
|
+
modalDom.addEventListener("touchmove", function(event) {
|
|
850
|
+
event.preventDefault();
|
|
851
|
+
event.stopPropagation();
|
|
852
|
+
});
|
|
853
|
+
modalDom.addEventListener("click", function() {
|
|
854
|
+
PopupManager.doOnModalClick && PopupManager.doOnModalClick();
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
return modalDom;
|
|
858
|
+
};
|
|
859
|
+
const instances = {};
|
|
860
|
+
const PopupManager = {
|
|
861
|
+
modalFade: true,
|
|
862
|
+
getInstance: function(id) {
|
|
863
|
+
return instances[id];
|
|
864
|
+
},
|
|
865
|
+
register: function(id, instance) {
|
|
866
|
+
if (id && instance) {
|
|
867
|
+
instances[id] = instance;
|
|
868
|
+
}
|
|
869
|
+
},
|
|
870
|
+
deregister: function(id) {
|
|
871
|
+
if (id) {
|
|
872
|
+
instances[id] = null;
|
|
873
|
+
delete instances[id];
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
nextZIndex: function() {
|
|
877
|
+
return PopupManager.zIndex++;
|
|
878
|
+
},
|
|
879
|
+
modalStack: [],
|
|
880
|
+
doOnModalClick: function() {
|
|
881
|
+
const topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
|
|
882
|
+
if (!topItem)
|
|
883
|
+
return;
|
|
884
|
+
const instance = PopupManager.getInstance(topItem.id);
|
|
885
|
+
if (instance && instance.closeOnClickModal) {
|
|
886
|
+
instance.close();
|
|
887
|
+
}
|
|
888
|
+
},
|
|
889
|
+
openModal: function(id, zIndex2, dom, modalClass, modalFade) {
|
|
890
|
+
if (Vue.prototype.$isServer)
|
|
891
|
+
return;
|
|
892
|
+
if (!id || zIndex2 === void 0)
|
|
893
|
+
return;
|
|
894
|
+
this.modalFade = modalFade;
|
|
895
|
+
const modalStack = this.modalStack;
|
|
896
|
+
for (let i = 0, j = modalStack.length; i < j; i++) {
|
|
897
|
+
const item = modalStack[i];
|
|
898
|
+
if (item.id === id) {
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
const modalDom = getModal();
|
|
903
|
+
addClass(modalDom, "v-modal");
|
|
904
|
+
if (this.modalFade && !hasModal) {
|
|
905
|
+
addClass(modalDom, "v-modal-enter");
|
|
906
|
+
}
|
|
907
|
+
if (modalClass) {
|
|
908
|
+
let classArr = modalClass.trim().split(/\s+/);
|
|
909
|
+
classArr.forEach((item) => addClass(modalDom, item));
|
|
910
|
+
}
|
|
911
|
+
setTimeout(() => {
|
|
912
|
+
removeClass(modalDom, "v-modal-enter");
|
|
913
|
+
}, 200);
|
|
914
|
+
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
|
|
915
|
+
dom.parentNode.appendChild(modalDom);
|
|
916
|
+
} else {
|
|
917
|
+
document.body.appendChild(modalDom);
|
|
918
|
+
}
|
|
919
|
+
if (zIndex2) {
|
|
920
|
+
modalDom.style.zIndex = zIndex2;
|
|
921
|
+
}
|
|
922
|
+
modalDom.tabIndex = 0;
|
|
923
|
+
modalDom.style.display = "";
|
|
924
|
+
this.modalStack.push({
|
|
925
|
+
id,
|
|
926
|
+
zIndex: zIndex2,
|
|
927
|
+
modalClass
|
|
928
|
+
});
|
|
929
|
+
},
|
|
930
|
+
closeModal: function(id) {
|
|
931
|
+
const modalStack = this.modalStack;
|
|
932
|
+
const modalDom = getModal();
|
|
933
|
+
if (modalStack.length > 0) {
|
|
934
|
+
const topItem = modalStack[modalStack.length - 1];
|
|
935
|
+
if (topItem.id === id) {
|
|
936
|
+
if (topItem.modalClass) {
|
|
937
|
+
let classArr = topItem.modalClass.trim().split(/\s+/);
|
|
938
|
+
classArr.forEach((item) => removeClass(modalDom, item));
|
|
939
|
+
}
|
|
940
|
+
modalStack.pop();
|
|
941
|
+
if (modalStack.length > 0) {
|
|
942
|
+
modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
|
|
943
|
+
}
|
|
944
|
+
} else {
|
|
945
|
+
for (let i = modalStack.length - 1; i >= 0; i--) {
|
|
946
|
+
if (modalStack[i].id === id) {
|
|
947
|
+
modalStack.splice(i, 1);
|
|
948
|
+
break;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
if (modalStack.length === 0) {
|
|
954
|
+
if (this.modalFade) {
|
|
955
|
+
addClass(modalDom, "v-modal-leave");
|
|
956
|
+
}
|
|
957
|
+
setTimeout(() => {
|
|
958
|
+
if (modalStack.length === 0) {
|
|
959
|
+
if (modalDom.parentNode)
|
|
960
|
+
modalDom.parentNode.removeChild(modalDom);
|
|
961
|
+
modalDom.style.display = "none";
|
|
962
|
+
PopupManager.modalDom = void 0;
|
|
963
|
+
}
|
|
964
|
+
removeClass(modalDom, "v-modal-leave");
|
|
965
|
+
}, 200);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
Object.defineProperty(PopupManager, "zIndex", {
|
|
970
|
+
configurable: true,
|
|
971
|
+
get() {
|
|
972
|
+
if (!hasInitZIndex) {
|
|
973
|
+
zIndex = zIndex || (Vue.prototype.$ELEMENT || {}).zIndex || 2e3;
|
|
974
|
+
hasInitZIndex = true;
|
|
975
|
+
}
|
|
976
|
+
return zIndex;
|
|
977
|
+
},
|
|
978
|
+
set(value) {
|
|
979
|
+
zIndex = value;
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
const getTopPopup = function() {
|
|
983
|
+
if (Vue.prototype.$isServer)
|
|
984
|
+
return;
|
|
985
|
+
if (PopupManager.modalStack.length > 0) {
|
|
986
|
+
const topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
|
|
987
|
+
if (!topPopup)
|
|
988
|
+
return;
|
|
989
|
+
const instance = PopupManager.getInstance(topPopup.id);
|
|
990
|
+
return instance;
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
if (!Vue.prototype.$isServer) {
|
|
994
|
+
window.addEventListener("keydown", function(event) {
|
|
995
|
+
if (event.keyCode === 27) {
|
|
996
|
+
const topPopup = getTopPopup();
|
|
997
|
+
if (topPopup && topPopup.closeOnPressEscape) {
|
|
998
|
+
topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction("cancel") : topPopup.close();
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
var popper$1 = { exports: {} };
|
|
1004
|
+
/**
|
|
1005
|
+
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
|
1006
|
+
* @version {{version}}
|
|
1007
|
+
* @license
|
|
1008
|
+
* Copyright (c) 2016 Federico Zivolo and contributors
|
|
1009
|
+
*
|
|
1010
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1011
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1012
|
+
* in the Software without restriction, including without limitation the rights
|
|
1013
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1014
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1015
|
+
* furnished to do so, subject to the following conditions:
|
|
1016
|
+
*
|
|
1017
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
1018
|
+
* copies or substantial portions of the Software.
|
|
1019
|
+
*
|
|
1020
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1021
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1022
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1023
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1024
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1025
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1026
|
+
* SOFTWARE.
|
|
1027
|
+
*/
|
|
1028
|
+
(function(module) {
|
|
1029
|
+
(function(root, factory) {
|
|
1030
|
+
if (module.exports) {
|
|
1031
|
+
module.exports = factory();
|
|
1032
|
+
} else {
|
|
1033
|
+
root.Popper = factory();
|
|
1034
|
+
}
|
|
1035
|
+
})(commonjsGlobal, function() {
|
|
1036
|
+
var root = window;
|
|
1037
|
+
var DEFAULTS = {
|
|
1038
|
+
// placement of the popper
|
|
1039
|
+
placement: "bottom",
|
|
1040
|
+
gpuAcceleration: true,
|
|
1041
|
+
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
1042
|
+
offset: 0,
|
|
1043
|
+
// the element which will act as boundary of the popper
|
|
1044
|
+
boundariesElement: "viewport",
|
|
1045
|
+
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
1046
|
+
boundariesPadding: 5,
|
|
1047
|
+
// popper will try to prevent overflow following this order,
|
|
1048
|
+
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
1049
|
+
preventOverflowOrder: ["left", "right", "top", "bottom"],
|
|
1050
|
+
// the behavior used by flip to change the placement of the popper
|
|
1051
|
+
flipBehavior: "flip",
|
|
1052
|
+
arrowElement: "[x-arrow]",
|
|
1053
|
+
arrowOffset: 0,
|
|
1054
|
+
// list of functions used to modify the offsets before they are applied to the popper
|
|
1055
|
+
modifiers: ["shift", "offset", "preventOverflow", "keepTogether", "arrow", "flip", "applyStyle"],
|
|
1056
|
+
modifiersIgnored: [],
|
|
1057
|
+
forceAbsolute: false
|
|
1058
|
+
};
|
|
1059
|
+
function Popper2(reference, popper2, options) {
|
|
1060
|
+
this._reference = reference.jquery ? reference[0] : reference;
|
|
1061
|
+
this.state = {};
|
|
1062
|
+
var isNotDefined = typeof popper2 === "undefined" || popper2 === null;
|
|
1063
|
+
var isConfig = popper2 && Object.prototype.toString.call(popper2) === "[object Object]";
|
|
1064
|
+
if (isNotDefined || isConfig) {
|
|
1065
|
+
this._popper = this.parse(isConfig ? popper2 : {});
|
|
1066
|
+
} else {
|
|
1067
|
+
this._popper = popper2.jquery ? popper2[0] : popper2;
|
|
1068
|
+
}
|
|
1069
|
+
this._options = Object.assign({}, DEFAULTS, options);
|
|
1070
|
+
this._options.modifiers = this._options.modifiers.map((function(modifier) {
|
|
1071
|
+
if (this._options.modifiersIgnored.indexOf(modifier) !== -1)
|
|
1072
|
+
return;
|
|
1073
|
+
if (modifier === "applyStyle") {
|
|
1074
|
+
this._popper.setAttribute("x-placement", this._options.placement);
|
|
1075
|
+
}
|
|
1076
|
+
return this.modifiers[modifier] || modifier;
|
|
1077
|
+
}).bind(this));
|
|
1078
|
+
this.state.position = this._getPosition(this._popper, this._reference);
|
|
1079
|
+
setStyle(this._popper, {
|
|
1080
|
+
position: this.state.position,
|
|
1081
|
+
top: 0
|
|
1082
|
+
});
|
|
1083
|
+
this.update();
|
|
1084
|
+
this._setupEventListeners();
|
|
1085
|
+
return this;
|
|
1086
|
+
}
|
|
1087
|
+
Popper2.prototype.destroy = function() {
|
|
1088
|
+
this._popper.removeAttribute("x-placement");
|
|
1089
|
+
this._popper.style.left = "";
|
|
1090
|
+
this._popper.style.position = "";
|
|
1091
|
+
this._popper.style.top = "";
|
|
1092
|
+
this._popper.style[getSupportedPropertyName("transform")] = "";
|
|
1093
|
+
this._removeEventListeners();
|
|
1094
|
+
if (this._options.removeOnDestroy) {
|
|
1095
|
+
this._popper.remove();
|
|
1096
|
+
}
|
|
1097
|
+
return this;
|
|
1098
|
+
};
|
|
1099
|
+
Popper2.prototype.update = function() {
|
|
1100
|
+
var data = {
|
|
1101
|
+
instance: this,
|
|
1102
|
+
styles: {}
|
|
1103
|
+
};
|
|
1104
|
+
data.placement = this._options.placement;
|
|
1105
|
+
data._originalPlacement = this._options.placement;
|
|
1106
|
+
data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
|
|
1107
|
+
data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
|
|
1108
|
+
data = this.runModifiers(data, this._options.modifiers);
|
|
1109
|
+
if (typeof this.state.updateCallback === "function") {
|
|
1110
|
+
this.state.updateCallback(data);
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
Popper2.prototype.onCreate = function(callback) {
|
|
1114
|
+
callback(this);
|
|
1115
|
+
return this;
|
|
1116
|
+
};
|
|
1117
|
+
Popper2.prototype.onUpdate = function(callback) {
|
|
1118
|
+
this.state.updateCallback = callback;
|
|
1119
|
+
return this;
|
|
1120
|
+
};
|
|
1121
|
+
Popper2.prototype.parse = function(config) {
|
|
1122
|
+
var defaultConfig = {
|
|
1123
|
+
tagName: "div",
|
|
1124
|
+
classNames: ["popper"],
|
|
1125
|
+
attributes: [],
|
|
1126
|
+
parent: root.document.body,
|
|
1127
|
+
content: "",
|
|
1128
|
+
contentType: "text",
|
|
1129
|
+
arrowTagName: "div",
|
|
1130
|
+
arrowClassNames: ["popper__arrow"],
|
|
1131
|
+
arrowAttributes: ["x-arrow"]
|
|
1132
|
+
};
|
|
1133
|
+
config = Object.assign({}, defaultConfig, config);
|
|
1134
|
+
var d = root.document;
|
|
1135
|
+
var popper2 = d.createElement(config.tagName);
|
|
1136
|
+
addClassNames(popper2, config.classNames);
|
|
1137
|
+
addAttributes(popper2, config.attributes);
|
|
1138
|
+
if (config.contentType === "node") {
|
|
1139
|
+
popper2.appendChild(config.content.jquery ? config.content[0] : config.content);
|
|
1140
|
+
} else if (config.contentType === "html") {
|
|
1141
|
+
popper2.innerHTML = config.content;
|
|
1142
|
+
} else {
|
|
1143
|
+
popper2.textContent = config.content;
|
|
1144
|
+
}
|
|
1145
|
+
if (config.arrowTagName) {
|
|
1146
|
+
var arrow = d.createElement(config.arrowTagName);
|
|
1147
|
+
addClassNames(arrow, config.arrowClassNames);
|
|
1148
|
+
addAttributes(arrow, config.arrowAttributes);
|
|
1149
|
+
popper2.appendChild(arrow);
|
|
1150
|
+
}
|
|
1151
|
+
var parent = config.parent.jquery ? config.parent[0] : config.parent;
|
|
1152
|
+
if (typeof parent === "string") {
|
|
1153
|
+
parent = d.querySelectorAll(config.parent);
|
|
1154
|
+
if (parent.length > 1) {
|
|
1155
|
+
console.warn("WARNING: the given `parent` query(" + config.parent + ") matched more than one element, the first one will be used");
|
|
1156
|
+
}
|
|
1157
|
+
if (parent.length === 0) {
|
|
1158
|
+
throw "ERROR: the given `parent` doesn't exists!";
|
|
1159
|
+
}
|
|
1160
|
+
parent = parent[0];
|
|
1161
|
+
}
|
|
1162
|
+
if (parent.length > 1 && parent instanceof Element === false) {
|
|
1163
|
+
console.warn("WARNING: you have passed as parent a list of elements, the first one will be used");
|
|
1164
|
+
parent = parent[0];
|
|
1165
|
+
}
|
|
1166
|
+
parent.appendChild(popper2);
|
|
1167
|
+
return popper2;
|
|
1168
|
+
function addClassNames(element, classNames) {
|
|
1169
|
+
classNames.forEach(function(className) {
|
|
1170
|
+
element.classList.add(className);
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
function addAttributes(element, attributes) {
|
|
1174
|
+
attributes.forEach(function(attribute) {
|
|
1175
|
+
element.setAttribute(attribute.split(":")[0], attribute.split(":")[1] || "");
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
Popper2.prototype._getPosition = function(popper2, reference) {
|
|
1180
|
+
getOffsetParent(reference);
|
|
1181
|
+
if (this._options.forceAbsolute) {
|
|
1182
|
+
return "absolute";
|
|
1183
|
+
}
|
|
1184
|
+
var isParentFixed = isFixed(reference);
|
|
1185
|
+
return isParentFixed ? "fixed" : "absolute";
|
|
1186
|
+
};
|
|
1187
|
+
Popper2.prototype._getOffsets = function(popper2, reference, placement) {
|
|
1188
|
+
placement = placement.split("-")[0];
|
|
1189
|
+
var popperOffsets = {};
|
|
1190
|
+
popperOffsets.position = this.state.position;
|
|
1191
|
+
var isParentFixed = popperOffsets.position === "fixed";
|
|
1192
|
+
var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper2), isParentFixed);
|
|
1193
|
+
var popperRect = getOuterSizes(popper2);
|
|
1194
|
+
if (["right", "left"].indexOf(placement) !== -1) {
|
|
1195
|
+
popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
|
|
1196
|
+
if (placement === "left") {
|
|
1197
|
+
popperOffsets.left = referenceOffsets.left - popperRect.width;
|
|
1198
|
+
} else {
|
|
1199
|
+
popperOffsets.left = referenceOffsets.right;
|
|
1200
|
+
}
|
|
1201
|
+
} else {
|
|
1202
|
+
popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
|
|
1203
|
+
if (placement === "top") {
|
|
1204
|
+
popperOffsets.top = referenceOffsets.top - popperRect.height;
|
|
1205
|
+
} else {
|
|
1206
|
+
popperOffsets.top = referenceOffsets.bottom;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
popperOffsets.width = popperRect.width;
|
|
1210
|
+
popperOffsets.height = popperRect.height;
|
|
1211
|
+
return {
|
|
1212
|
+
popper: popperOffsets,
|
|
1213
|
+
reference: referenceOffsets
|
|
1214
|
+
};
|
|
1215
|
+
};
|
|
1216
|
+
Popper2.prototype._setupEventListeners = function() {
|
|
1217
|
+
this.state.updateBound = this.update.bind(this);
|
|
1218
|
+
root.addEventListener("resize", this.state.updateBound);
|
|
1219
|
+
if (this._options.boundariesElement !== "window") {
|
|
1220
|
+
var target = getScrollParent(this._reference);
|
|
1221
|
+
if (target === root.document.body || target === root.document.documentElement) {
|
|
1222
|
+
target = root;
|
|
1223
|
+
}
|
|
1224
|
+
target.addEventListener("scroll", this.state.updateBound);
|
|
1225
|
+
this.state.scrollTarget = target;
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
Popper2.prototype._removeEventListeners = function() {
|
|
1229
|
+
root.removeEventListener("resize", this.state.updateBound);
|
|
1230
|
+
if (this._options.boundariesElement !== "window" && this.state.scrollTarget) {
|
|
1231
|
+
this.state.scrollTarget.removeEventListener("scroll", this.state.updateBound);
|
|
1232
|
+
this.state.scrollTarget = null;
|
|
1233
|
+
}
|
|
1234
|
+
this.state.updateBound = null;
|
|
1235
|
+
};
|
|
1236
|
+
Popper2.prototype._getBoundaries = function(data, padding, boundariesElement) {
|
|
1237
|
+
var boundaries = {};
|
|
1238
|
+
var width, height;
|
|
1239
|
+
if (boundariesElement === "window") {
|
|
1240
|
+
var body = root.document.body, html = root.document.documentElement;
|
|
1241
|
+
height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
|
|
1242
|
+
width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
|
|
1243
|
+
boundaries = {
|
|
1244
|
+
top: 0,
|
|
1245
|
+
right: width,
|
|
1246
|
+
bottom: height,
|
|
1247
|
+
left: 0
|
|
1248
|
+
};
|
|
1249
|
+
} else if (boundariesElement === "viewport") {
|
|
1250
|
+
var offsetParent = getOffsetParent(this._popper);
|
|
1251
|
+
var scrollParent = getScrollParent(this._popper);
|
|
1252
|
+
var offsetParentRect = getOffsetRect(offsetParent);
|
|
1253
|
+
var getScrollTopValue = function(element) {
|
|
1254
|
+
return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
|
|
1255
|
+
};
|
|
1256
|
+
var getScrollLeftValue = function(element) {
|
|
1257
|
+
return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
|
|
1258
|
+
};
|
|
1259
|
+
var scrollTop = data.offsets.popper.position === "fixed" ? 0 : getScrollTopValue(scrollParent);
|
|
1260
|
+
var scrollLeft = data.offsets.popper.position === "fixed" ? 0 : getScrollLeftValue(scrollParent);
|
|
1261
|
+
boundaries = {
|
|
1262
|
+
top: 0 - (offsetParentRect.top - scrollTop),
|
|
1263
|
+
right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
|
|
1264
|
+
bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
|
|
1265
|
+
left: 0 - (offsetParentRect.left - scrollLeft)
|
|
1266
|
+
};
|
|
1267
|
+
} else {
|
|
1268
|
+
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
1269
|
+
boundaries = {
|
|
1270
|
+
top: 0,
|
|
1271
|
+
left: 0,
|
|
1272
|
+
right: boundariesElement.clientWidth,
|
|
1273
|
+
bottom: boundariesElement.clientHeight
|
|
1274
|
+
};
|
|
1275
|
+
} else {
|
|
1276
|
+
boundaries = getOffsetRect(boundariesElement);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
boundaries.left += padding;
|
|
1280
|
+
boundaries.right -= padding;
|
|
1281
|
+
boundaries.top = boundaries.top + padding;
|
|
1282
|
+
boundaries.bottom = boundaries.bottom - padding;
|
|
1283
|
+
return boundaries;
|
|
1284
|
+
};
|
|
1285
|
+
Popper2.prototype.runModifiers = function(data, modifiers, ends) {
|
|
1286
|
+
var modifiersToRun = modifiers.slice();
|
|
1287
|
+
if (ends !== void 0) {
|
|
1288
|
+
modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
|
|
1289
|
+
}
|
|
1290
|
+
modifiersToRun.forEach((function(modifier) {
|
|
1291
|
+
if (isFunction(modifier)) {
|
|
1292
|
+
data = modifier.call(this, data);
|
|
1293
|
+
}
|
|
1294
|
+
}).bind(this));
|
|
1295
|
+
return data;
|
|
1296
|
+
};
|
|
1297
|
+
Popper2.prototype.isModifierRequired = function(requesting, requested) {
|
|
1298
|
+
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
1299
|
+
return !!this._options.modifiers.slice(0, index).filter(function(modifier) {
|
|
1300
|
+
return modifier === requested;
|
|
1301
|
+
}).length;
|
|
1302
|
+
};
|
|
1303
|
+
Popper2.prototype.modifiers = {};
|
|
1304
|
+
Popper2.prototype.modifiers.applyStyle = function(data) {
|
|
1305
|
+
var styles = {
|
|
1306
|
+
position: data.offsets.popper.position
|
|
1307
|
+
};
|
|
1308
|
+
var left = Math.round(data.offsets.popper.left);
|
|
1309
|
+
var top = Math.round(data.offsets.popper.top);
|
|
1310
|
+
var prefixedProperty;
|
|
1311
|
+
if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName("transform"))) {
|
|
1312
|
+
styles[prefixedProperty] = "translate3d(" + left + "px, " + top + "px, 0)";
|
|
1313
|
+
styles.top = 0;
|
|
1314
|
+
styles.left = 0;
|
|
1315
|
+
} else {
|
|
1316
|
+
styles.left = left;
|
|
1317
|
+
styles.top = top;
|
|
1318
|
+
}
|
|
1319
|
+
Object.assign(styles, data.styles);
|
|
1320
|
+
setStyle(this._popper, styles);
|
|
1321
|
+
this._popper.setAttribute("x-placement", data.placement);
|
|
1322
|
+
if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
|
|
1323
|
+
setStyle(data.arrowElement, data.offsets.arrow);
|
|
1324
|
+
}
|
|
1325
|
+
return data;
|
|
1326
|
+
};
|
|
1327
|
+
Popper2.prototype.modifiers.shift = function(data) {
|
|
1328
|
+
var placement = data.placement;
|
|
1329
|
+
var basePlacement = placement.split("-")[0];
|
|
1330
|
+
var shiftVariation = placement.split("-")[1];
|
|
1331
|
+
if (shiftVariation) {
|
|
1332
|
+
var reference = data.offsets.reference;
|
|
1333
|
+
var popper2 = getPopperClientRect(data.offsets.popper);
|
|
1334
|
+
var shiftOffsets = {
|
|
1335
|
+
y: {
|
|
1336
|
+
start: {
|
|
1337
|
+
top: reference.top
|
|
1338
|
+
},
|
|
1339
|
+
end: {
|
|
1340
|
+
top: reference.top + reference.height - popper2.height
|
|
1341
|
+
}
|
|
1342
|
+
},
|
|
1343
|
+
x: {
|
|
1344
|
+
start: {
|
|
1345
|
+
left: reference.left
|
|
1346
|
+
},
|
|
1347
|
+
end: {
|
|
1348
|
+
left: reference.left + reference.width - popper2.width
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
};
|
|
1352
|
+
var axis = ["bottom", "top"].indexOf(basePlacement) !== -1 ? "x" : "y";
|
|
1353
|
+
data.offsets.popper = Object.assign(popper2, shiftOffsets[axis][shiftVariation]);
|
|
1354
|
+
}
|
|
1355
|
+
return data;
|
|
1356
|
+
};
|
|
1357
|
+
Popper2.prototype.modifiers.preventOverflow = function(data) {
|
|
1358
|
+
var order = this._options.preventOverflowOrder;
|
|
1359
|
+
var popper2 = getPopperClientRect(data.offsets.popper);
|
|
1360
|
+
var check = {
|
|
1361
|
+
left: function() {
|
|
1362
|
+
var left = popper2.left;
|
|
1363
|
+
if (popper2.left < data.boundaries.left) {
|
|
1364
|
+
left = Math.max(popper2.left, data.boundaries.left);
|
|
1365
|
+
}
|
|
1366
|
+
return {
|
|
1367
|
+
left
|
|
1368
|
+
};
|
|
1369
|
+
},
|
|
1370
|
+
right: function() {
|
|
1371
|
+
var left = popper2.left;
|
|
1372
|
+
if (popper2.right > data.boundaries.right) {
|
|
1373
|
+
left = Math.min(popper2.left, data.boundaries.right - popper2.width);
|
|
1374
|
+
}
|
|
1375
|
+
return {
|
|
1376
|
+
left
|
|
1377
|
+
};
|
|
1378
|
+
},
|
|
1379
|
+
top: function() {
|
|
1380
|
+
var top = popper2.top;
|
|
1381
|
+
if (popper2.top < data.boundaries.top) {
|
|
1382
|
+
top = Math.max(popper2.top, data.boundaries.top);
|
|
1383
|
+
}
|
|
1384
|
+
return {
|
|
1385
|
+
top
|
|
1386
|
+
};
|
|
1387
|
+
},
|
|
1388
|
+
bottom: function() {
|
|
1389
|
+
var top = popper2.top;
|
|
1390
|
+
if (popper2.bottom > data.boundaries.bottom) {
|
|
1391
|
+
top = Math.min(popper2.top, data.boundaries.bottom - popper2.height);
|
|
1392
|
+
}
|
|
1393
|
+
return {
|
|
1394
|
+
top
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
};
|
|
1398
|
+
order.forEach(function(direction) {
|
|
1399
|
+
data.offsets.popper = Object.assign(popper2, check[direction]());
|
|
1400
|
+
});
|
|
1401
|
+
return data;
|
|
1402
|
+
};
|
|
1403
|
+
Popper2.prototype.modifiers.keepTogether = function(data) {
|
|
1404
|
+
var popper2 = getPopperClientRect(data.offsets.popper);
|
|
1405
|
+
var reference = data.offsets.reference;
|
|
1406
|
+
var f = Math.floor;
|
|
1407
|
+
if (popper2.right < f(reference.left)) {
|
|
1408
|
+
data.offsets.popper.left = f(reference.left) - popper2.width;
|
|
1409
|
+
}
|
|
1410
|
+
if (popper2.left > f(reference.right)) {
|
|
1411
|
+
data.offsets.popper.left = f(reference.right);
|
|
1412
|
+
}
|
|
1413
|
+
if (popper2.bottom < f(reference.top)) {
|
|
1414
|
+
data.offsets.popper.top = f(reference.top) - popper2.height;
|
|
1415
|
+
}
|
|
1416
|
+
if (popper2.top > f(reference.bottom)) {
|
|
1417
|
+
data.offsets.popper.top = f(reference.bottom);
|
|
1418
|
+
}
|
|
1419
|
+
return data;
|
|
1420
|
+
};
|
|
1421
|
+
Popper2.prototype.modifiers.flip = function(data) {
|
|
1422
|
+
if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
|
|
1423
|
+
console.warn("WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!");
|
|
1424
|
+
return data;
|
|
1425
|
+
}
|
|
1426
|
+
if (data.flipped && data.placement === data._originalPlacement) {
|
|
1427
|
+
return data;
|
|
1428
|
+
}
|
|
1429
|
+
var placement = data.placement.split("-")[0];
|
|
1430
|
+
var placementOpposite = getOppositePlacement(placement);
|
|
1431
|
+
var variation = data.placement.split("-")[1] || "";
|
|
1432
|
+
var flipOrder = [];
|
|
1433
|
+
if (this._options.flipBehavior === "flip") {
|
|
1434
|
+
flipOrder = [placement, placementOpposite];
|
|
1435
|
+
} else {
|
|
1436
|
+
flipOrder = this._options.flipBehavior;
|
|
1437
|
+
}
|
|
1438
|
+
flipOrder.forEach((function(step, index) {
|
|
1439
|
+
if (placement !== step || flipOrder.length === index + 1) {
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
placement = data.placement.split("-")[0];
|
|
1443
|
+
placementOpposite = getOppositePlacement(placement);
|
|
1444
|
+
var popperOffsets = getPopperClientRect(data.offsets.popper);
|
|
1445
|
+
var a = ["right", "bottom"].indexOf(placement) !== -1;
|
|
1446
|
+
if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
|
|
1447
|
+
data.flipped = true;
|
|
1448
|
+
data.placement = flipOrder[index + 1];
|
|
1449
|
+
if (variation) {
|
|
1450
|
+
data.placement += "-" + variation;
|
|
1451
|
+
}
|
|
1452
|
+
data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
|
|
1453
|
+
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
1454
|
+
}
|
|
1455
|
+
}).bind(this));
|
|
1456
|
+
return data;
|
|
1457
|
+
};
|
|
1458
|
+
Popper2.prototype.modifiers.offset = function(data) {
|
|
1459
|
+
var offset = this._options.offset;
|
|
1460
|
+
var popper2 = data.offsets.popper;
|
|
1461
|
+
if (data.placement.indexOf("left") !== -1) {
|
|
1462
|
+
popper2.top -= offset;
|
|
1463
|
+
} else if (data.placement.indexOf("right") !== -1) {
|
|
1464
|
+
popper2.top += offset;
|
|
1465
|
+
} else if (data.placement.indexOf("top") !== -1) {
|
|
1466
|
+
popper2.left -= offset;
|
|
1467
|
+
} else if (data.placement.indexOf("bottom") !== -1) {
|
|
1468
|
+
popper2.left += offset;
|
|
1469
|
+
}
|
|
1470
|
+
return data;
|
|
1471
|
+
};
|
|
1472
|
+
Popper2.prototype.modifiers.arrow = function(data) {
|
|
1473
|
+
var arrow = this._options.arrowElement;
|
|
1474
|
+
var arrowOffset = this._options.arrowOffset;
|
|
1475
|
+
if (typeof arrow === "string") {
|
|
1476
|
+
arrow = this._popper.querySelector(arrow);
|
|
1477
|
+
}
|
|
1478
|
+
if (!arrow) {
|
|
1479
|
+
return data;
|
|
1480
|
+
}
|
|
1481
|
+
if (!this._popper.contains(arrow)) {
|
|
1482
|
+
console.warn("WARNING: `arrowElement` must be child of its popper element!");
|
|
1483
|
+
return data;
|
|
1484
|
+
}
|
|
1485
|
+
if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
|
|
1486
|
+
console.warn("WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!");
|
|
1487
|
+
return data;
|
|
1488
|
+
}
|
|
1489
|
+
var arrowStyle = {};
|
|
1490
|
+
var placement = data.placement.split("-")[0];
|
|
1491
|
+
var popper2 = getPopperClientRect(data.offsets.popper);
|
|
1492
|
+
var reference = data.offsets.reference;
|
|
1493
|
+
var isVertical = ["left", "right"].indexOf(placement) !== -1;
|
|
1494
|
+
var len = isVertical ? "height" : "width";
|
|
1495
|
+
var side = isVertical ? "top" : "left";
|
|
1496
|
+
var altSide = isVertical ? "left" : "top";
|
|
1497
|
+
var opSide = isVertical ? "bottom" : "right";
|
|
1498
|
+
var arrowSize = getOuterSizes(arrow)[len];
|
|
1499
|
+
if (reference[opSide] - arrowSize < popper2[side]) {
|
|
1500
|
+
data.offsets.popper[side] -= popper2[side] - (reference[opSide] - arrowSize);
|
|
1501
|
+
}
|
|
1502
|
+
if (reference[side] + arrowSize > popper2[opSide]) {
|
|
1503
|
+
data.offsets.popper[side] += reference[side] + arrowSize - popper2[opSide];
|
|
1504
|
+
}
|
|
1505
|
+
var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
|
|
1506
|
+
var sideValue = center - popper2[side];
|
|
1507
|
+
sideValue = Math.max(Math.min(popper2[len] - arrowSize - 8, sideValue), 8);
|
|
1508
|
+
arrowStyle[side] = sideValue;
|
|
1509
|
+
arrowStyle[altSide] = "";
|
|
1510
|
+
data.offsets.arrow = arrowStyle;
|
|
1511
|
+
data.arrowElement = arrow;
|
|
1512
|
+
return data;
|
|
1513
|
+
};
|
|
1514
|
+
function getOuterSizes(element) {
|
|
1515
|
+
var _display = element.style.display, _visibility = element.style.visibility;
|
|
1516
|
+
element.style.display = "block";
|
|
1517
|
+
element.style.visibility = "hidden";
|
|
1518
|
+
element.offsetWidth;
|
|
1519
|
+
var styles = root.getComputedStyle(element);
|
|
1520
|
+
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
1521
|
+
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
1522
|
+
var result = {
|
|
1523
|
+
width: element.offsetWidth + y,
|
|
1524
|
+
height: element.offsetHeight + x
|
|
1525
|
+
};
|
|
1526
|
+
element.style.display = _display;
|
|
1527
|
+
element.style.visibility = _visibility;
|
|
1528
|
+
return result;
|
|
1529
|
+
}
|
|
1530
|
+
function getOppositePlacement(placement) {
|
|
1531
|
+
var hash = {
|
|
1532
|
+
left: "right",
|
|
1533
|
+
right: "left",
|
|
1534
|
+
bottom: "top",
|
|
1535
|
+
top: "bottom"
|
|
1536
|
+
};
|
|
1537
|
+
return placement.replace(/left|right|bottom|top/g, function(matched) {
|
|
1538
|
+
return hash[matched];
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
function getPopperClientRect(popperOffsets) {
|
|
1542
|
+
var offsets = Object.assign({}, popperOffsets);
|
|
1543
|
+
offsets.right = offsets.left + offsets.width;
|
|
1544
|
+
offsets.bottom = offsets.top + offsets.height;
|
|
1545
|
+
return offsets;
|
|
1546
|
+
}
|
|
1547
|
+
function getArrayKeyIndex(arr, keyToFind) {
|
|
1548
|
+
var i = 0, key;
|
|
1549
|
+
for (key in arr) {
|
|
1550
|
+
if (arr[key] === keyToFind) {
|
|
1551
|
+
return i;
|
|
1552
|
+
}
|
|
1553
|
+
i++;
|
|
1554
|
+
}
|
|
1555
|
+
return null;
|
|
1556
|
+
}
|
|
1557
|
+
function getStyleComputedProperty(element, property) {
|
|
1558
|
+
var css = root.getComputedStyle(element, null);
|
|
1559
|
+
return css[property];
|
|
1560
|
+
}
|
|
1561
|
+
function getOffsetParent(element) {
|
|
1562
|
+
var offsetParent = element.offsetParent;
|
|
1563
|
+
return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
|
|
1564
|
+
}
|
|
1565
|
+
function getScrollParent(element) {
|
|
1566
|
+
var parent = element.parentNode;
|
|
1567
|
+
if (!parent) {
|
|
1568
|
+
return element;
|
|
1569
|
+
}
|
|
1570
|
+
if (parent === root.document) {
|
|
1571
|
+
if (root.document.body.scrollTop || root.document.body.scrollLeft) {
|
|
1572
|
+
return root.document.body;
|
|
1573
|
+
} else {
|
|
1574
|
+
return root.document.documentElement;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
if (["scroll", "auto"].indexOf(getStyleComputedProperty(parent, "overflow")) !== -1 || ["scroll", "auto"].indexOf(getStyleComputedProperty(parent, "overflow-x")) !== -1 || ["scroll", "auto"].indexOf(getStyleComputedProperty(parent, "overflow-y")) !== -1) {
|
|
1578
|
+
return parent;
|
|
1579
|
+
}
|
|
1580
|
+
return getScrollParent(element.parentNode);
|
|
1581
|
+
}
|
|
1582
|
+
function isFixed(element) {
|
|
1583
|
+
if (element === root.document.body) {
|
|
1584
|
+
return false;
|
|
1585
|
+
}
|
|
1586
|
+
if (getStyleComputedProperty(element, "position") === "fixed") {
|
|
1587
|
+
return true;
|
|
1588
|
+
}
|
|
1589
|
+
return element.parentNode ? isFixed(element.parentNode) : element;
|
|
1590
|
+
}
|
|
1591
|
+
function setStyle(element, styles) {
|
|
1592
|
+
function is_numeric(n) {
|
|
1593
|
+
return n !== "" && !isNaN(parseFloat(n)) && isFinite(n);
|
|
1594
|
+
}
|
|
1595
|
+
Object.keys(styles).forEach(function(prop) {
|
|
1596
|
+
var unit = "";
|
|
1597
|
+
if (["width", "height", "top", "right", "bottom", "left"].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
|
|
1598
|
+
unit = "px";
|
|
1599
|
+
}
|
|
1600
|
+
element.style[prop] = styles[prop] + unit;
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
function isFunction(functionToCheck) {
|
|
1604
|
+
var getType = {};
|
|
1605
|
+
return functionToCheck && getType.toString.call(functionToCheck) === "[object Function]";
|
|
1606
|
+
}
|
|
1607
|
+
function getOffsetRect(element) {
|
|
1608
|
+
var elementRect = {
|
|
1609
|
+
width: element.offsetWidth,
|
|
1610
|
+
height: element.offsetHeight,
|
|
1611
|
+
left: element.offsetLeft,
|
|
1612
|
+
top: element.offsetTop
|
|
1613
|
+
};
|
|
1614
|
+
elementRect.right = elementRect.left + elementRect.width;
|
|
1615
|
+
elementRect.bottom = elementRect.top + elementRect.height;
|
|
1616
|
+
return elementRect;
|
|
1617
|
+
}
|
|
1618
|
+
function getBoundingClientRect(element) {
|
|
1619
|
+
var rect = element.getBoundingClientRect();
|
|
1620
|
+
var isIE = navigator.userAgent.indexOf("MSIE") != -1;
|
|
1621
|
+
var rectTop = isIE && element.tagName === "HTML" ? -element.scrollTop : rect.top;
|
|
1622
|
+
return {
|
|
1623
|
+
left: rect.left,
|
|
1624
|
+
top: rectTop,
|
|
1625
|
+
right: rect.right,
|
|
1626
|
+
bottom: rect.bottom,
|
|
1627
|
+
width: rect.right - rect.left,
|
|
1628
|
+
height: rect.bottom - rectTop
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
1632
|
+
var elementRect = getBoundingClientRect(element);
|
|
1633
|
+
var parentRect = getBoundingClientRect(parent);
|
|
1634
|
+
if (fixed) {
|
|
1635
|
+
var scrollParent = getScrollParent(parent);
|
|
1636
|
+
parentRect.top += scrollParent.scrollTop;
|
|
1637
|
+
parentRect.bottom += scrollParent.scrollTop;
|
|
1638
|
+
parentRect.left += scrollParent.scrollLeft;
|
|
1639
|
+
parentRect.right += scrollParent.scrollLeft;
|
|
1640
|
+
}
|
|
1641
|
+
var rect = {
|
|
1642
|
+
top: elementRect.top - parentRect.top,
|
|
1643
|
+
left: elementRect.left - parentRect.left,
|
|
1644
|
+
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
1645
|
+
right: elementRect.left - parentRect.left + elementRect.width,
|
|
1646
|
+
width: elementRect.width,
|
|
1647
|
+
height: elementRect.height
|
|
1648
|
+
};
|
|
1649
|
+
return rect;
|
|
1650
|
+
}
|
|
1651
|
+
function getSupportedPropertyName(property) {
|
|
1652
|
+
var prefixes = ["", "ms", "webkit", "moz", "o"];
|
|
1653
|
+
for (var i = 0; i < prefixes.length; i++) {
|
|
1654
|
+
var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
|
|
1655
|
+
if (typeof root.document.body.style[toCheck] !== "undefined") {
|
|
1656
|
+
return toCheck;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
return null;
|
|
1660
|
+
}
|
|
1661
|
+
if (!Object.assign) {
|
|
1662
|
+
Object.defineProperty(Object, "assign", {
|
|
1663
|
+
enumerable: false,
|
|
1664
|
+
configurable: true,
|
|
1665
|
+
writable: true,
|
|
1666
|
+
value: function(target) {
|
|
1667
|
+
if (target === void 0 || target === null) {
|
|
1668
|
+
throw new TypeError("Cannot convert first argument to object");
|
|
1669
|
+
}
|
|
1670
|
+
var to = Object(target);
|
|
1671
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1672
|
+
var nextSource = arguments[i];
|
|
1673
|
+
if (nextSource === void 0 || nextSource === null) {
|
|
1674
|
+
continue;
|
|
1675
|
+
}
|
|
1676
|
+
nextSource = Object(nextSource);
|
|
1677
|
+
var keysArray = Object.keys(nextSource);
|
|
1678
|
+
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
|
|
1679
|
+
var nextKey = keysArray[nextIndex];
|
|
1680
|
+
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
1681
|
+
if (desc !== void 0 && desc.enumerable) {
|
|
1682
|
+
to[nextKey] = nextSource[nextKey];
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
return to;
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
return Popper2;
|
|
1691
|
+
});
|
|
1692
|
+
})(popper$1);
|
|
1693
|
+
var popperExports = popper$1.exports;
|
|
1694
|
+
const popper = /* @__PURE__ */ getDefaultExportFromCjs(popperExports);
|
|
1695
|
+
const _vite_plugin_require_transform_popper_0 = /* @__PURE__ */ _mergeNamespaces({
|
|
1696
|
+
__proto__: null,
|
|
1697
|
+
default: popper
|
|
1698
|
+
}, [popperExports]);
|
|
1699
|
+
const PopperJS = Vue.prototype.$isServer ? function() {
|
|
1700
|
+
} : popper || _vite_plugin_require_transform_popper_0;
|
|
1701
|
+
const stop = (e) => e.stopPropagation();
|
|
1702
|
+
const Popper = {
|
|
1703
|
+
props: {
|
|
1704
|
+
transformOrigin: {
|
|
1705
|
+
type: [Boolean, String],
|
|
1706
|
+
default: true
|
|
1707
|
+
},
|
|
1708
|
+
placement: {
|
|
1709
|
+
type: String,
|
|
1710
|
+
default: "bottom"
|
|
1711
|
+
},
|
|
1712
|
+
boundariesPadding: {
|
|
1713
|
+
type: Number,
|
|
1714
|
+
default: 5
|
|
1715
|
+
},
|
|
1716
|
+
reference: {},
|
|
1717
|
+
popper: {},
|
|
1718
|
+
offset: {
|
|
1719
|
+
default: 0
|
|
1720
|
+
},
|
|
1721
|
+
value: Boolean,
|
|
1722
|
+
visibleArrow: Boolean,
|
|
1723
|
+
arrowOffset: {
|
|
1724
|
+
type: Number,
|
|
1725
|
+
default: 35
|
|
1726
|
+
},
|
|
1727
|
+
appendToBody: {
|
|
1728
|
+
type: Boolean,
|
|
1729
|
+
default: true
|
|
1730
|
+
},
|
|
1731
|
+
popperOptions: {
|
|
1732
|
+
type: Object,
|
|
1733
|
+
default() {
|
|
1734
|
+
return {
|
|
1735
|
+
gpuAcceleration: false
|
|
1736
|
+
};
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
},
|
|
1740
|
+
data() {
|
|
1741
|
+
return {
|
|
1742
|
+
showPopper: false,
|
|
1743
|
+
currentPlacement: ""
|
|
1744
|
+
};
|
|
1745
|
+
},
|
|
1746
|
+
watch: {
|
|
1747
|
+
value: {
|
|
1748
|
+
immediate: true,
|
|
1749
|
+
handler(val) {
|
|
1750
|
+
this.showPopper = val;
|
|
1751
|
+
this.$emit("input", val);
|
|
1752
|
+
}
|
|
1753
|
+
},
|
|
1754
|
+
showPopper(val) {
|
|
1755
|
+
if (this.disabled)
|
|
1756
|
+
return;
|
|
1757
|
+
val ? this.updatePopper() : this.destroyPopper();
|
|
1758
|
+
this.$emit("input", val);
|
|
1759
|
+
}
|
|
1760
|
+
},
|
|
1761
|
+
methods: {
|
|
1762
|
+
createPopper() {
|
|
1763
|
+
if (this.$isServer)
|
|
1764
|
+
return;
|
|
1765
|
+
this.currentPlacement = this.currentPlacement || this.placement;
|
|
1766
|
+
if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
|
|
1767
|
+
return;
|
|
1768
|
+
}
|
|
1769
|
+
const options = this.popperOptions;
|
|
1770
|
+
const popper2 = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
|
|
1771
|
+
let reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
|
|
1772
|
+
if (!reference && this.$slots.reference && this.$slots.reference[0]) {
|
|
1773
|
+
reference = this.referenceElm = this.$slots.reference[0].elm;
|
|
1774
|
+
}
|
|
1775
|
+
if (!popper2 || !reference)
|
|
1776
|
+
return;
|
|
1777
|
+
if (this.visibleArrow)
|
|
1778
|
+
this.appendArrow(popper2);
|
|
1779
|
+
if (this.appendToBody)
|
|
1780
|
+
document.body.appendChild(this.popperElm);
|
|
1781
|
+
if (this.popperJS && this.popperJS.destroy) {
|
|
1782
|
+
this.popperJS.destroy();
|
|
1783
|
+
}
|
|
1784
|
+
options.placement = this.currentPlacement;
|
|
1785
|
+
options.offset = this.offset;
|
|
1786
|
+
options.arrowOffset = this.arrowOffset;
|
|
1787
|
+
this.popperJS = new PopperJS(reference, popper2, options);
|
|
1788
|
+
this.popperJS.onCreate((_) => {
|
|
1789
|
+
this.$emit("created", this);
|
|
1790
|
+
this.resetTransformOrigin();
|
|
1791
|
+
this.$nextTick(this.updatePopper);
|
|
1792
|
+
});
|
|
1793
|
+
if (typeof options.onUpdate === "function") {
|
|
1794
|
+
this.popperJS.onUpdate(options.onUpdate);
|
|
1795
|
+
}
|
|
1796
|
+
this.popperJS._popper.style.zIndex = PopupManager.nextZIndex();
|
|
1797
|
+
this.popperElm.addEventListener("click", stop);
|
|
1798
|
+
},
|
|
1799
|
+
updatePopper() {
|
|
1800
|
+
const popperJS = this.popperJS;
|
|
1801
|
+
if (popperJS) {
|
|
1802
|
+
popperJS.update();
|
|
1803
|
+
if (popperJS._popper) {
|
|
1804
|
+
popperJS._popper.style.zIndex = PopupManager.nextZIndex();
|
|
1805
|
+
}
|
|
1806
|
+
} else {
|
|
1807
|
+
this.createPopper();
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
doDestroy(forceDestroy) {
|
|
1811
|
+
if (!this.popperJS || this.showPopper && !forceDestroy)
|
|
1812
|
+
return;
|
|
1813
|
+
this.popperJS.destroy();
|
|
1814
|
+
this.popperJS = null;
|
|
1815
|
+
},
|
|
1816
|
+
destroyPopper() {
|
|
1817
|
+
if (this.popperJS) {
|
|
1818
|
+
this.resetTransformOrigin();
|
|
1819
|
+
}
|
|
1820
|
+
},
|
|
1821
|
+
resetTransformOrigin() {
|
|
1822
|
+
if (!this.transformOrigin)
|
|
1823
|
+
return;
|
|
1824
|
+
let placementMap = {
|
|
1825
|
+
top: "bottom",
|
|
1826
|
+
bottom: "top",
|
|
1827
|
+
left: "right",
|
|
1828
|
+
right: "left"
|
|
1829
|
+
};
|
|
1830
|
+
let placement = this.popperJS._popper.getAttribute("x-placement").split("-")[0];
|
|
1831
|
+
let origin = placementMap[placement];
|
|
1832
|
+
this.popperJS._popper.style.transformOrigin = typeof this.transformOrigin === "string" ? this.transformOrigin : ["top", "bottom"].indexOf(placement) > -1 ? `center ${origin}` : `${origin} center`;
|
|
1833
|
+
},
|
|
1834
|
+
appendArrow(element) {
|
|
1835
|
+
let hash;
|
|
1836
|
+
if (this.appended) {
|
|
1837
|
+
return;
|
|
1838
|
+
}
|
|
1839
|
+
this.appended = true;
|
|
1840
|
+
for (let item in element.attributes) {
|
|
1841
|
+
if (/^_v-/.test(element.attributes[item].name)) {
|
|
1842
|
+
hash = element.attributes[item].name;
|
|
1843
|
+
break;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
const arrow = document.createElement("div");
|
|
1847
|
+
if (hash) {
|
|
1848
|
+
arrow.setAttribute(hash, "");
|
|
1849
|
+
}
|
|
1850
|
+
arrow.setAttribute("x-arrow", "");
|
|
1851
|
+
arrow.className = "popper__arrow";
|
|
1852
|
+
element.appendChild(arrow);
|
|
1853
|
+
}
|
|
1854
|
+
},
|
|
1855
|
+
beforeDestroy() {
|
|
1856
|
+
this.doDestroy(true);
|
|
1857
|
+
if (this.popperElm && this.popperElm.parentNode === document.body) {
|
|
1858
|
+
this.popperElm.removeEventListener("click", stop);
|
|
1859
|
+
document.body.removeChild(this.popperElm);
|
|
1860
|
+
}
|
|
1861
|
+
},
|
|
1862
|
+
// call destroy in keep-alive mode
|
|
1863
|
+
deactivated() {
|
|
1864
|
+
this.$options.beforeDestroy[0].call(this);
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1867
|
+
function broadcast(componentName, eventName, params) {
|
|
1868
|
+
this.$children.forEach((child) => {
|
|
1869
|
+
var name = child.$options.componentName;
|
|
1870
|
+
if (name === componentName) {
|
|
1871
|
+
child.$emit.apply(child, [eventName].concat(params));
|
|
1872
|
+
} else {
|
|
1873
|
+
broadcast.apply(child, [componentName, eventName].concat([params]));
|
|
1874
|
+
}
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
const Emitter = {
|
|
1878
|
+
methods: {
|
|
1879
|
+
dispatch(componentName, eventName, params) {
|
|
1880
|
+
var parent = this.$parent || this.$root;
|
|
1881
|
+
var name = parent.$options.componentName;
|
|
1882
|
+
while (parent && (!name || name !== componentName)) {
|
|
1883
|
+
parent = parent.$parent;
|
|
1884
|
+
if (parent) {
|
|
1885
|
+
name = parent.$options.componentName;
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
if (parent) {
|
|
1889
|
+
parent.$emit.apply(parent, [eventName].concat(params));
|
|
1890
|
+
}
|
|
1891
|
+
},
|
|
1892
|
+
broadcast(componentName, eventName, params) {
|
|
1893
|
+
broadcast.call(this, componentName, eventName, params);
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
};
|
|
1897
|
+
const NewPopper = {
|
|
1898
|
+
props: {
|
|
1899
|
+
appendToBody: Popper.props.appendToBody,
|
|
1900
|
+
offset: Popper.props.offset,
|
|
1901
|
+
boundariesPadding: Popper.props.boundariesPadding,
|
|
1902
|
+
arrowOffset: Popper.props.arrowOffset
|
|
1903
|
+
},
|
|
1904
|
+
methods: Popper.methods,
|
|
1905
|
+
data() {
|
|
1906
|
+
return merge({
|
|
1907
|
+
visibleArrow: true,
|
|
1908
|
+
type: "weekrange"
|
|
1909
|
+
}, Popper.data);
|
|
1910
|
+
},
|
|
1911
|
+
beforeDestroy: Popper.beforeDestroy
|
|
1912
|
+
};
|
|
1913
|
+
const DEFAULT_FORMATS = {
|
|
1914
|
+
weekrange: "WW周(yyyy年)"
|
|
1915
|
+
};
|
|
1916
|
+
const DATE_PARSER = function(text, format2) {
|
|
1917
|
+
if (format2 === "timestamp")
|
|
1918
|
+
return new Date(Number(text));
|
|
1919
|
+
return parseDate(text, format2);
|
|
1920
|
+
};
|
|
1921
|
+
const RANGE_PARSER = function(array, format2) {
|
|
1922
|
+
if (array.length === 2) {
|
|
1923
|
+
const range1 = array[0];
|
|
1924
|
+
const range2 = array[1];
|
|
1925
|
+
return [DATE_PARSER(range1, format2), DATE_PARSER(range2, format2)];
|
|
1926
|
+
}
|
|
1927
|
+
return [];
|
|
1928
|
+
};
|
|
1929
|
+
const TYPE_VALUE_RESOLVER_MAP = {
|
|
1930
|
+
default: {
|
|
1931
|
+
formatter(value) {
|
|
1932
|
+
if (!value)
|
|
1933
|
+
return "";
|
|
1934
|
+
return "" + value;
|
|
1935
|
+
},
|
|
1936
|
+
parser(text) {
|
|
1937
|
+
if (text === void 0 || text === "")
|
|
1938
|
+
return null;
|
|
1939
|
+
return text;
|
|
1940
|
+
}
|
|
1941
|
+
},
|
|
1942
|
+
weekrange: {
|
|
1943
|
+
formatter(value, format2) {
|
|
1944
|
+
function getDate(value2) {
|
|
1945
|
+
function isLeapYear(year) {
|
|
1946
|
+
return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
|
|
1947
|
+
}
|
|
1948
|
+
function getDays(date3) {
|
|
1949
|
+
const year = date3.getFullYear();
|
|
1950
|
+
const month2 = date3.getMonth() + 1;
|
|
1951
|
+
const day = date3.getDate();
|
|
1952
|
+
let days2 = day;
|
|
1953
|
+
const monthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
1954
|
+
for (let i = 0; i < month2 - 1; i++) {
|
|
1955
|
+
days2 += monthDays[i];
|
|
1956
|
+
}
|
|
1957
|
+
if (isLeapYear(year) && month2 > 2) {
|
|
1958
|
+
days2++;
|
|
1959
|
+
}
|
|
1960
|
+
return days2++;
|
|
1961
|
+
}
|
|
1962
|
+
if (!value2) {
|
|
1963
|
+
return;
|
|
1964
|
+
}
|
|
1965
|
+
const y = value2.getFullYear();
|
|
1966
|
+
const yearOneDateSun = (/* @__PURE__ */ new Date(y + "-01-01")).getDay() || 7;
|
|
1967
|
+
const days = getDays(value2);
|
|
1968
|
+
const week = getWeekNumber(value2);
|
|
1969
|
+
const month = value2.getMonth();
|
|
1970
|
+
const trueDate = new Date(value2);
|
|
1971
|
+
if (week === 1 && month === 11) {
|
|
1972
|
+
trueDate.setHours(0, 0, 0, 0);
|
|
1973
|
+
trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
|
|
1974
|
+
}
|
|
1975
|
+
let date2 = formatDate(trueDate, format2);
|
|
1976
|
+
if (7 - yearOneDateSun < 4 && 7 - yearOneDateSun >= days) {
|
|
1977
|
+
date2 = date2.replace(new RegExp(y, "ig"), y - 1);
|
|
1978
|
+
}
|
|
1979
|
+
date2 = /WW/.test(date2) ? date2.replace(/WW/, week < 10 ? "0" + week : week) : date2.replace(/W/, week);
|
|
1980
|
+
return date2;
|
|
1981
|
+
}
|
|
1982
|
+
if (!Array.isArray(value)) {
|
|
1983
|
+
return getDate(value);
|
|
1984
|
+
}
|
|
1985
|
+
const dateList = [];
|
|
1986
|
+
for (const val of value) {
|
|
1987
|
+
dateList.push(getDate(val));
|
|
1988
|
+
}
|
|
1989
|
+
return dateList;
|
|
1990
|
+
},
|
|
1991
|
+
parser: RANGE_PARSER
|
|
1992
|
+
}
|
|
1993
|
+
};
|
|
1994
|
+
const PLACEMENT_MAP = {
|
|
1995
|
+
left: "bottom-start",
|
|
1996
|
+
center: "bottom",
|
|
1997
|
+
right: "bottom-end"
|
|
1998
|
+
};
|
|
1999
|
+
const parseAsFormatAndType = (value, customFormat, type) => {
|
|
2000
|
+
if (!value)
|
|
2001
|
+
return null;
|
|
2002
|
+
const parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP["default"]).parser;
|
|
2003
|
+
const format2 = customFormat || DEFAULT_FORMATS[type];
|
|
2004
|
+
return parser(value, format2);
|
|
2005
|
+
};
|
|
2006
|
+
const formatAsFormatAndType = (value, customFormat, type = "weekrange") => {
|
|
2007
|
+
if (!value)
|
|
2008
|
+
return null;
|
|
2009
|
+
const formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP["default"]).formatter;
|
|
2010
|
+
const format2 = customFormat || DEFAULT_FORMATS[type];
|
|
2011
|
+
return formatter(value, format2);
|
|
2012
|
+
};
|
|
2013
|
+
const valueEquals = function(a, b) {
|
|
2014
|
+
const dateEquals = function(a2, b2) {
|
|
2015
|
+
const aIsDate = a2 instanceof Date;
|
|
2016
|
+
const bIsDate = b2 instanceof Date;
|
|
2017
|
+
if (aIsDate && bIsDate) {
|
|
2018
|
+
return a2.getTime() === b2.getTime();
|
|
2019
|
+
}
|
|
2020
|
+
if (!aIsDate && !bIsDate) {
|
|
2021
|
+
return a2 === b2;
|
|
2022
|
+
}
|
|
2023
|
+
return false;
|
|
2024
|
+
};
|
|
2025
|
+
const aIsArray = a instanceof Array;
|
|
2026
|
+
const bIsArray = b instanceof Array;
|
|
2027
|
+
if (aIsArray && bIsArray) {
|
|
2028
|
+
if (a.length !== b.length) {
|
|
2029
|
+
return false;
|
|
2030
|
+
}
|
|
2031
|
+
return a.every((item, index) => dateEquals(item, b[index]));
|
|
2032
|
+
}
|
|
2033
|
+
if (!aIsArray && !bIsArray) {
|
|
2034
|
+
return dateEquals(a, b);
|
|
2035
|
+
}
|
|
2036
|
+
return false;
|
|
2037
|
+
};
|
|
2038
|
+
const isString = function(val) {
|
|
2039
|
+
return typeof val === "string" || val instanceof String;
|
|
2040
|
+
};
|
|
2041
|
+
const validator = function(val) {
|
|
2042
|
+
return val === null || val === void 0 || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
|
|
2043
|
+
};
|
|
2044
|
+
const _sfc_main$4 = {
|
|
2045
|
+
directives: {
|
|
2046
|
+
Clickoutside
|
|
2047
|
+
},
|
|
2048
|
+
mixins: [Emitter, NewPopper],
|
|
2049
|
+
inject: {
|
|
2050
|
+
elForm: {
|
|
2051
|
+
default: ""
|
|
2052
|
+
},
|
|
2053
|
+
elFormItem: {
|
|
2054
|
+
default: ""
|
|
2055
|
+
}
|
|
2056
|
+
},
|
|
2057
|
+
props: {
|
|
2058
|
+
size: {
|
|
2059
|
+
type: String,
|
|
2060
|
+
default: void 0
|
|
2061
|
+
},
|
|
2062
|
+
format: String,
|
|
2063
|
+
valueFormat: String,
|
|
2064
|
+
readonly: Boolean,
|
|
2065
|
+
startPlaceholder: {
|
|
2066
|
+
type: String,
|
|
2067
|
+
default: "开始周"
|
|
2068
|
+
},
|
|
2069
|
+
endPlaceholder: {
|
|
2070
|
+
type: String,
|
|
2071
|
+
default: "结束周"
|
|
2072
|
+
},
|
|
2073
|
+
prefixIcon: String,
|
|
2074
|
+
clearIcon: {
|
|
2075
|
+
type: String,
|
|
2076
|
+
default: "el-icon-circle-close"
|
|
2077
|
+
},
|
|
2078
|
+
name: {
|
|
2079
|
+
default: "",
|
|
2080
|
+
validator
|
|
2081
|
+
},
|
|
2082
|
+
disabled: Boolean,
|
|
2083
|
+
clearable: {
|
|
2084
|
+
type: Boolean,
|
|
2085
|
+
default: true
|
|
2086
|
+
},
|
|
2087
|
+
id: {
|
|
2088
|
+
default: "",
|
|
2089
|
+
validator
|
|
2090
|
+
},
|
|
2091
|
+
popperClass: String,
|
|
2092
|
+
editable: {
|
|
2093
|
+
type: Boolean,
|
|
2094
|
+
default: true
|
|
2095
|
+
},
|
|
2096
|
+
align: {
|
|
2097
|
+
type: String,
|
|
2098
|
+
default: "left"
|
|
2099
|
+
},
|
|
2100
|
+
value: {},
|
|
2101
|
+
defaultValue: {},
|
|
2102
|
+
defaultTime: {},
|
|
2103
|
+
rangeSeparator: {
|
|
2104
|
+
default: "-"
|
|
2105
|
+
},
|
|
2106
|
+
pickerOptions: {},
|
|
2107
|
+
unlinkPanels: Boolean,
|
|
2108
|
+
validateEvent: {
|
|
2109
|
+
type: Boolean,
|
|
2110
|
+
default: true
|
|
2111
|
+
}
|
|
2112
|
+
},
|
|
2113
|
+
data() {
|
|
2114
|
+
return {
|
|
2115
|
+
pickerVisible: false,
|
|
2116
|
+
showClose: false,
|
|
2117
|
+
userInput: null,
|
|
2118
|
+
valueOnOpen: null,
|
|
2119
|
+
// value when picker opens, used to determine whether to emit change
|
|
2120
|
+
unwatchPickerOptions: null,
|
|
2121
|
+
dateList: []
|
|
2122
|
+
};
|
|
2123
|
+
},
|
|
2124
|
+
computed: {
|
|
2125
|
+
reference() {
|
|
2126
|
+
const reference = this.$refs.reference;
|
|
2127
|
+
return reference.$el || reference;
|
|
2128
|
+
},
|
|
2129
|
+
refInput() {
|
|
2130
|
+
if (this.reference) {
|
|
2131
|
+
return [].slice.call(this.reference.querySelectorAll("input"));
|
|
2132
|
+
}
|
|
2133
|
+
return [];
|
|
2134
|
+
},
|
|
2135
|
+
valueIsEmpty() {
|
|
2136
|
+
const val = this.value;
|
|
2137
|
+
if (Array.isArray(val)) {
|
|
2138
|
+
for (let i = 0, len = val.length; i < len; i++) {
|
|
2139
|
+
if (val[i]) {
|
|
2140
|
+
return false;
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
} else {
|
|
2144
|
+
if (val) {
|
|
2145
|
+
return false;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
return true;
|
|
2149
|
+
},
|
|
2150
|
+
triggerClass() {
|
|
2151
|
+
return this.prefixIcon || "el-icon-date";
|
|
2152
|
+
},
|
|
2153
|
+
haveTrigger() {
|
|
2154
|
+
if (typeof this.showTrigger !== "undefined") {
|
|
2155
|
+
return this.showTrigger;
|
|
2156
|
+
}
|
|
2157
|
+
return true;
|
|
2158
|
+
},
|
|
2159
|
+
displayValue() {
|
|
2160
|
+
const formattedValue = formatAsFormatAndType(this.parsedValue, this.format);
|
|
2161
|
+
if (Array.isArray(this.userInput)) {
|
|
2162
|
+
return [this.userInput[0] || formattedValue && formattedValue[0] || "", this.userInput[1] || formattedValue && formattedValue[1] || ""];
|
|
2163
|
+
} else if (this.userInput !== null) {
|
|
2164
|
+
return this.userInput;
|
|
2165
|
+
} else if (formattedValue && !Array.isArray(formattedValue) || Array.isArray(formattedValue) && formattedValue.length >= 2) {
|
|
2166
|
+
return formattedValue;
|
|
2167
|
+
} else {
|
|
2168
|
+
return "";
|
|
2169
|
+
}
|
|
2170
|
+
},
|
|
2171
|
+
parsedValue() {
|
|
2172
|
+
var _a;
|
|
2173
|
+
if (!this.value)
|
|
2174
|
+
return this.value;
|
|
2175
|
+
const valueIsDateObject = isDateObject(this.value) || Array.isArray(this.value) && this.value.every(isDateObject);
|
|
2176
|
+
if (valueIsDateObject) {
|
|
2177
|
+
return this.value;
|
|
2178
|
+
}
|
|
2179
|
+
if (this.valueFormat) {
|
|
2180
|
+
if ((_a = this.dateList) == null ? void 0 : _a.length) {
|
|
2181
|
+
return this.dateList;
|
|
2182
|
+
} else {
|
|
2183
|
+
if (Array.isArray(this.value)) {
|
|
2184
|
+
this.value.forEach((v) => {
|
|
2185
|
+
this.dateList.push(new Date(v));
|
|
2186
|
+
});
|
|
2187
|
+
} else {
|
|
2188
|
+
this.dateList = this.value || [];
|
|
2189
|
+
}
|
|
2190
|
+
return this.dateList;
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
return Array.isArray(this.value) ? this.value.map((val) => new Date(val)) : new Date(this.value);
|
|
2194
|
+
},
|
|
2195
|
+
_elFormItemSize() {
|
|
2196
|
+
return (this.elFormItem || {}).elFormItemSize;
|
|
2197
|
+
},
|
|
2198
|
+
pickerSize() {
|
|
2199
|
+
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
|
2200
|
+
},
|
|
2201
|
+
pickerDisabled() {
|
|
2202
|
+
return this.disabled || (this.elForm || {}).disabled;
|
|
2203
|
+
},
|
|
2204
|
+
firstInputId() {
|
|
2205
|
+
const obj = {};
|
|
2206
|
+
const id = this.id && this.id[0];
|
|
2207
|
+
if (id)
|
|
2208
|
+
obj.id = id;
|
|
2209
|
+
return obj;
|
|
2210
|
+
},
|
|
2211
|
+
secondInputId() {
|
|
2212
|
+
const obj = {};
|
|
2213
|
+
const id = this.id && this.id[1];
|
|
2214
|
+
if (id)
|
|
2215
|
+
obj.id = id;
|
|
2216
|
+
return obj;
|
|
2217
|
+
}
|
|
2218
|
+
},
|
|
2219
|
+
watch: {
|
|
2220
|
+
pickerVisible(val) {
|
|
2221
|
+
if (this.readonly || this.pickerDisabled)
|
|
2222
|
+
return;
|
|
2223
|
+
if (val) {
|
|
2224
|
+
this.showPicker();
|
|
2225
|
+
this.valueOnOpen = Array.isArray(this.value) ? [...this.value] : this.value;
|
|
2226
|
+
} else {
|
|
2227
|
+
this.hidePicker();
|
|
2228
|
+
this.emitChange(this.value);
|
|
2229
|
+
this.userInput = null;
|
|
2230
|
+
if (this.validateEvent) {
|
|
2231
|
+
this.dispatch("ElFormItem", "el.form.blur");
|
|
2232
|
+
}
|
|
2233
|
+
this.$emit("blur", this);
|
|
2234
|
+
this.blur();
|
|
2235
|
+
}
|
|
2236
|
+
},
|
|
2237
|
+
parsedValue: {
|
|
2238
|
+
immediate: true,
|
|
2239
|
+
handler(val) {
|
|
2240
|
+
if (this.picker) {
|
|
2241
|
+
this.picker.value = val;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
},
|
|
2245
|
+
defaultValue(val) {
|
|
2246
|
+
if (this.picker) {
|
|
2247
|
+
this.picker.defaultValue = val;
|
|
2248
|
+
}
|
|
2249
|
+
},
|
|
2250
|
+
value(val, oldVal) {
|
|
2251
|
+
if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
|
|
2252
|
+
this.dispatch("ElFormItem", "el.form.change", val);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
},
|
|
2256
|
+
created() {
|
|
2257
|
+
this.popperOptions = {
|
|
2258
|
+
boundariesPadding: 0,
|
|
2259
|
+
gpuAcceleration: false
|
|
2260
|
+
};
|
|
2261
|
+
this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
|
|
2262
|
+
this.$on("fieldReset", this.handleFieldReset);
|
|
2263
|
+
},
|
|
2264
|
+
methods: {
|
|
2265
|
+
focus() {
|
|
2266
|
+
this.handleFocus();
|
|
2267
|
+
},
|
|
2268
|
+
blur() {
|
|
2269
|
+
this.refInput.forEach((input) => input.blur());
|
|
2270
|
+
},
|
|
2271
|
+
// {parse, formatTo} Value deals maps component value with internal Date
|
|
2272
|
+
parseValue(value) {
|
|
2273
|
+
const isParsed = isDateObject(value) || Array.isArray(value) && value.every(isDateObject);
|
|
2274
|
+
if (this.valueFormat && !isParsed) {
|
|
2275
|
+
return parseAsFormatAndType(value, this.valueFormat, this.type) || value;
|
|
2276
|
+
} else {
|
|
2277
|
+
return value;
|
|
2278
|
+
}
|
|
2279
|
+
},
|
|
2280
|
+
formatToValue(date2) {
|
|
2281
|
+
const isFormattable = isDateObject(date2) || Array.isArray(date2) && date2.every(isDateObject);
|
|
2282
|
+
if (this.valueFormat && isFormattable) {
|
|
2283
|
+
return formatAsFormatAndType(date2, this.valueFormat);
|
|
2284
|
+
} else {
|
|
2285
|
+
return date2;
|
|
2286
|
+
}
|
|
2287
|
+
},
|
|
2288
|
+
// {parse, formatTo} String deals with user input
|
|
2289
|
+
parseString(value) {
|
|
2290
|
+
return parseAsFormatAndType(value, this.format, this.type);
|
|
2291
|
+
},
|
|
2292
|
+
formatToString(value) {
|
|
2293
|
+
return formatAsFormatAndType(value, this.format);
|
|
2294
|
+
},
|
|
2295
|
+
handleMouseEnter() {
|
|
2296
|
+
if (this.readonly || this.pickerDisabled)
|
|
2297
|
+
return;
|
|
2298
|
+
if (!this.valueIsEmpty && this.clearable) {
|
|
2299
|
+
this.showClose = true;
|
|
2300
|
+
}
|
|
2301
|
+
},
|
|
2302
|
+
handleChange() {
|
|
2303
|
+
if (this.userInput) {
|
|
2304
|
+
const value = this.parseString(this.displayValue);
|
|
2305
|
+
if (value) {
|
|
2306
|
+
this.picker.value = value;
|
|
2307
|
+
if (this.isValidValue(value)) {
|
|
2308
|
+
this.emitInput(value);
|
|
2309
|
+
this.userInput = null;
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
if (this.userInput === "") {
|
|
2314
|
+
this.emitInput(null);
|
|
2315
|
+
this.emitChange(null);
|
|
2316
|
+
this.userInput = null;
|
|
2317
|
+
}
|
|
2318
|
+
},
|
|
2319
|
+
handleClickIcon(event) {
|
|
2320
|
+
if (this.readonly || this.pickerDisabled)
|
|
2321
|
+
return;
|
|
2322
|
+
if (this.showClose) {
|
|
2323
|
+
this.valueOnOpen = this.value;
|
|
2324
|
+
event.stopPropagation();
|
|
2325
|
+
this.emitInput(null);
|
|
2326
|
+
this.emitChange(null);
|
|
2327
|
+
this.showClose = false;
|
|
2328
|
+
if (this.picker && typeof this.picker.handleClear === "function") {
|
|
2329
|
+
this.picker.handleClear();
|
|
2330
|
+
}
|
|
2331
|
+
} else {
|
|
2332
|
+
this.pickerVisible = !this.pickerVisible;
|
|
2333
|
+
}
|
|
2334
|
+
},
|
|
2335
|
+
handleClose() {
|
|
2336
|
+
if (!this.pickerVisible)
|
|
2337
|
+
return;
|
|
2338
|
+
this.pickerVisible = false;
|
|
2339
|
+
},
|
|
2340
|
+
handleFieldReset(initialValue) {
|
|
2341
|
+
this.userInput = initialValue === "" ? null : initialValue;
|
|
2342
|
+
},
|
|
2343
|
+
handleFocus() {
|
|
2344
|
+
if (!this.pickerVisible) {
|
|
2345
|
+
this.pickerVisible = true;
|
|
2346
|
+
}
|
|
2347
|
+
this.$emit("focus", this);
|
|
2348
|
+
},
|
|
2349
|
+
handleKeydown(event) {
|
|
2350
|
+
const keyCode = event.keyCode;
|
|
2351
|
+
if (keyCode === 27) {
|
|
2352
|
+
this.pickerVisible = false;
|
|
2353
|
+
event.stopPropagation();
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
if (keyCode === 9) {
|
|
2357
|
+
let timer = setTimeout(() => {
|
|
2358
|
+
if (this.refInput.indexOf(document.activeElement) === -1) {
|
|
2359
|
+
this.pickerVisible = false;
|
|
2360
|
+
this.blur();
|
|
2361
|
+
event.stopPropagation();
|
|
2362
|
+
}
|
|
2363
|
+
clearTimeout(timer);
|
|
2364
|
+
timer = null;
|
|
2365
|
+
}, 0);
|
|
2366
|
+
return;
|
|
2367
|
+
}
|
|
2368
|
+
if (keyCode === 13) {
|
|
2369
|
+
if (this.userInput === "" || this.isValidValue(this.parseString(this.displayValue))) {
|
|
2370
|
+
this.handleChange();
|
|
2371
|
+
this.pickerVisible = this.picker.visible = false;
|
|
2372
|
+
this.blur();
|
|
2373
|
+
}
|
|
2374
|
+
event.stopPropagation();
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
if (this.userInput) {
|
|
2378
|
+
event.stopPropagation();
|
|
2379
|
+
return;
|
|
2380
|
+
}
|
|
2381
|
+
if (this.picker && this.picker.handleKeydown) {
|
|
2382
|
+
this.picker.handleKeydown(event);
|
|
2383
|
+
}
|
|
2384
|
+
},
|
|
2385
|
+
handleRangeClick() {
|
|
2386
|
+
if (!this.pickerVisible) {
|
|
2387
|
+
this.pickerVisible = true;
|
|
2388
|
+
}
|
|
2389
|
+
this.$emit("focus", this);
|
|
2390
|
+
},
|
|
2391
|
+
hidePicker() {
|
|
2392
|
+
if (this.picker) {
|
|
2393
|
+
let timer = setTimeout(() => {
|
|
2394
|
+
this.picker.resetView && this.picker.resetView();
|
|
2395
|
+
}, 100);
|
|
2396
|
+
this.pickerVisible = this.picker.visible = false;
|
|
2397
|
+
this.destroyPopper();
|
|
2398
|
+
clearTimeout(timer);
|
|
2399
|
+
timer = null;
|
|
2400
|
+
}
|
|
2401
|
+
},
|
|
2402
|
+
showPicker() {
|
|
2403
|
+
if (this.$isServer)
|
|
2404
|
+
return;
|
|
2405
|
+
if (!this.picker) {
|
|
2406
|
+
this.mountPicker();
|
|
2407
|
+
}
|
|
2408
|
+
this.pickerVisible = this.picker.visible = true;
|
|
2409
|
+
this.updatePopper();
|
|
2410
|
+
this.picker.value = this.parsedValue;
|
|
2411
|
+
this.picker.resetView && this.picker.resetView();
|
|
2412
|
+
this.$nextTick(() => {
|
|
2413
|
+
this.picker.adjustSpinners && this.picker.adjustSpinners();
|
|
2414
|
+
});
|
|
2415
|
+
},
|
|
2416
|
+
mountPicker() {
|
|
2417
|
+
this.picker = new Vue(this.panel).$mount();
|
|
2418
|
+
this.picker.defaultValue = this.defaultValue;
|
|
2419
|
+
this.picker.defaultTime = this.defaultTime;
|
|
2420
|
+
this.picker.popperClass = this.popperClass;
|
|
2421
|
+
this.popperElm = this.picker.$el;
|
|
2422
|
+
this.picker.width = this.reference.getBoundingClientRect().width;
|
|
2423
|
+
this.picker.showTime = false;
|
|
2424
|
+
this.picker.unlinkPanels = this.unlinkPanels;
|
|
2425
|
+
this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
|
|
2426
|
+
this.$watch("format", (format2) => {
|
|
2427
|
+
this.picker.format = format2;
|
|
2428
|
+
});
|
|
2429
|
+
const updateOptions = () => {
|
|
2430
|
+
const options = this.pickerOptions;
|
|
2431
|
+
if (options && options.selectableRange) {
|
|
2432
|
+
let ranges = options.selectableRange;
|
|
2433
|
+
const parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
|
|
2434
|
+
const format2 = DEFAULT_FORMATS.timerange;
|
|
2435
|
+
ranges = Array.isArray(ranges) ? ranges : [ranges];
|
|
2436
|
+
this.picker.selectableRange = ranges.map((range) => parser(range, format2, this.rangeSeparator));
|
|
2437
|
+
}
|
|
2438
|
+
for (const option in options) {
|
|
2439
|
+
if (Object.hasOwnProperty.call(options, option) && // 忽略 time-picker 的该配置项
|
|
2440
|
+
option !== "selectableRange") {
|
|
2441
|
+
this.picker[option] = options[option];
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
if (this.format) {
|
|
2445
|
+
this.picker.format = this.format;
|
|
2446
|
+
}
|
|
2447
|
+
};
|
|
2448
|
+
updateOptions();
|
|
2449
|
+
this.unwatchPickerOptions = this.$watch("pickerOptions", () => updateOptions(), {
|
|
2450
|
+
deep: true
|
|
2451
|
+
});
|
|
2452
|
+
this.$el.appendChild(this.picker.$el);
|
|
2453
|
+
this.picker.resetView && this.picker.resetView();
|
|
2454
|
+
this.picker.$on("dodestroy", this.doDestroy);
|
|
2455
|
+
this.picker.$on("pick", (date2 = "", visible = false) => {
|
|
2456
|
+
this.userInput = null;
|
|
2457
|
+
this.pickerVisible = this.picker.visible = visible;
|
|
2458
|
+
this.emitInput(date2);
|
|
2459
|
+
this.picker.resetView && this.picker.resetView();
|
|
2460
|
+
});
|
|
2461
|
+
this.picker.$on("select-range", (start, end, pos) => {
|
|
2462
|
+
if (this.refInput.length === 0)
|
|
2463
|
+
return;
|
|
2464
|
+
if (!pos || pos === "min") {
|
|
2465
|
+
this.refInput[0].setSelectionRange(start, end);
|
|
2466
|
+
this.refInput[0].focus();
|
|
2467
|
+
} else if (pos === "max") {
|
|
2468
|
+
this.refInput[1].setSelectionRange(start, end);
|
|
2469
|
+
this.refInput[1].focus();
|
|
2470
|
+
}
|
|
2471
|
+
});
|
|
2472
|
+
},
|
|
2473
|
+
unmountPicker() {
|
|
2474
|
+
if (this.picker) {
|
|
2475
|
+
this.picker.$destroy();
|
|
2476
|
+
this.picker.$off();
|
|
2477
|
+
if (typeof this.unwatchPickerOptions === "function") {
|
|
2478
|
+
this.unwatchPickerOptions();
|
|
2479
|
+
}
|
|
2480
|
+
this.picker.$el.parentNode.removeChild(this.picker.$el);
|
|
2481
|
+
}
|
|
2482
|
+
},
|
|
2483
|
+
emitChange(val) {
|
|
2484
|
+
if (!valueEquals(val, this.valueOnOpen)) {
|
|
2485
|
+
this.$emit("change", val);
|
|
2486
|
+
this.$emit("update:value", val);
|
|
2487
|
+
this.valueOnOpen = val;
|
|
2488
|
+
if (this.validateEvent) {
|
|
2489
|
+
this.dispatch("ElFormItem", "el.form.change", val);
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
},
|
|
2493
|
+
emitInput(val) {
|
|
2494
|
+
this.dateList = val;
|
|
2495
|
+
const formatted = this.formatToValue(val);
|
|
2496
|
+
if (!valueEquals(this.value, formatted)) {
|
|
2497
|
+
this.$emit("input", formatted);
|
|
2498
|
+
this.$emit("update:value", formatted);
|
|
2499
|
+
}
|
|
2500
|
+
},
|
|
2501
|
+
isValidValue(value) {
|
|
2502
|
+
if (!this.picker) {
|
|
2503
|
+
this.mountPicker();
|
|
2504
|
+
}
|
|
2505
|
+
if (this.picker.isValidValue) {
|
|
2506
|
+
return value && this.picker.isValidValue(value);
|
|
2507
|
+
} else {
|
|
2508
|
+
return true;
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
};
|
|
2513
|
+
var _sfc_render$4 = function render() {
|
|
2514
|
+
var _vm = this, _c = _vm._self._c;
|
|
2515
|
+
return _c("div", {
|
|
2516
|
+
directives: [{
|
|
2517
|
+
name: "clickoutside",
|
|
2518
|
+
rawName: "v-clickoutside",
|
|
2519
|
+
value: _vm.handleClose,
|
|
2520
|
+
expression: "handleClose"
|
|
2521
|
+
}],
|
|
2522
|
+
ref: "reference",
|
|
2523
|
+
staticClass: "el-date-editor nf-double-week el-range-editor el-input__inner nf-double-week-picker",
|
|
2524
|
+
class: ["el-date-editor--daterange", _vm.pickerSize ? `el-range-editor--${_vm.pickerSize}` : "", _vm.pickerDisabled ? "is-disabled" : "", _vm.pickerVisible ? "is-active" : ""],
|
|
2525
|
+
on: {
|
|
2526
|
+
"click": _vm.handleRangeClick,
|
|
2527
|
+
"mouseenter": _vm.handleMouseEnter,
|
|
2528
|
+
"mouseleave": function($event) {
|
|
2529
|
+
_vm.showClose = false;
|
|
2530
|
+
},
|
|
2531
|
+
"keydown": _vm.handleKeydown
|
|
2532
|
+
}
|
|
2533
|
+
}, [_c("i", {
|
|
2534
|
+
class: ["el-input__icon", "el-range__icon", _vm.triggerClass]
|
|
2535
|
+
}), _c("input", _vm._b({
|
|
2536
|
+
staticClass: "el-range-input",
|
|
2537
|
+
attrs: {
|
|
2538
|
+
"readonly": !_vm.editable || _vm.readonly,
|
|
2539
|
+
"autocomplete": "off",
|
|
2540
|
+
"placeholder": _vm.startPlaceholder,
|
|
2541
|
+
"disabled": _vm.pickerDisabled,
|
|
2542
|
+
"name": _vm.name && _vm.name[0],
|
|
2543
|
+
"size": _vm.pickerSize
|
|
2544
|
+
},
|
|
2545
|
+
domProps: {
|
|
2546
|
+
"value": _vm.displayValue && _vm.displayValue[0]
|
|
2547
|
+
}
|
|
2548
|
+
}, "input", _vm.firstInputId, false)), _vm._t("range-separator", function() {
|
|
2549
|
+
return [_c("span", {
|
|
2550
|
+
staticClass: "el-range-separator"
|
|
2551
|
+
}, [_vm._v(_vm._s(_vm.rangeSeparator))])];
|
|
2552
|
+
}), _c("input", _vm._b({
|
|
2553
|
+
staticClass: "el-range-input",
|
|
2554
|
+
attrs: {
|
|
2555
|
+
"autocomplete": "off",
|
|
2556
|
+
"placeholder": _vm.endPlaceholder,
|
|
2557
|
+
"disabled": _vm.pickerDisabled,
|
|
2558
|
+
"size": _vm.pickerSize,
|
|
2559
|
+
"name": _vm.name && _vm.name[1],
|
|
2560
|
+
"readonly": !_vm.editable || _vm.readonly
|
|
2561
|
+
},
|
|
2562
|
+
domProps: {
|
|
2563
|
+
"value": _vm.displayValue && _vm.displayValue[1]
|
|
2564
|
+
}
|
|
2565
|
+
}, "input", _vm.secondInputId, false)), _vm.haveTrigger ? _c("i", {
|
|
2566
|
+
staticClass: "el-input__icon el-range__close-icon",
|
|
2567
|
+
class: [_vm.showClose ? "" + _vm.clearIcon : ""],
|
|
2568
|
+
on: {
|
|
2569
|
+
"click": _vm.handleClickIcon
|
|
2570
|
+
}
|
|
2571
|
+
}) : _vm._e()], 2);
|
|
2572
|
+
};
|
|
2573
|
+
var _sfc_staticRenderFns$4 = [];
|
|
2574
|
+
var __component__$4 = /* @__PURE__ */ normalizeComponent(_sfc_main$4, _sfc_render$4, _sfc_staticRenderFns$4, false, null, null, null, null);
|
|
2575
|
+
const Picker = __component__$4.exports;
|
|
2576
|
+
const Locale = {
|
|
2577
|
+
methods: {
|
|
2578
|
+
t(...args) {
|
|
2579
|
+
return t.apply(this, args);
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
};
|
|
2583
|
+
const WEEKS = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
|
|
2584
|
+
const getDateTimestamp$1 = function(time) {
|
|
2585
|
+
if (typeof time === "number" || typeof time === "string") {
|
|
2586
|
+
return clearTime(new Date(time)).getTime();
|
|
2587
|
+
} else if (time instanceof Date) {
|
|
2588
|
+
return clearTime(time).getTime();
|
|
2589
|
+
} else {
|
|
2590
|
+
return NaN;
|
|
2591
|
+
}
|
|
2592
|
+
};
|
|
2593
|
+
const removeFromArray = function(arr, pred) {
|
|
2594
|
+
const idx = typeof pred === "function" ? arrayFindIndex(arr, pred) : arr.indexOf(pred);
|
|
2595
|
+
return idx >= 0 ? [...arr.slice(0, idx), ...arr.slice(idx + 1)] : arr;
|
|
2596
|
+
};
|
|
2597
|
+
const _sfc_main$3 = {
|
|
2598
|
+
mixins: [Locale],
|
|
2599
|
+
props: {
|
|
2600
|
+
firstDayOfWeek: {
|
|
2601
|
+
default: 7,
|
|
2602
|
+
type: Number,
|
|
2603
|
+
validator: (val) => val >= 1 && val <= 7
|
|
2604
|
+
},
|
|
2605
|
+
value: {},
|
|
2606
|
+
defaultValue: {
|
|
2607
|
+
validator(val) {
|
|
2608
|
+
return val === null || isDate(val) || Array.isArray(val) && val.every(isDate);
|
|
2609
|
+
}
|
|
2610
|
+
},
|
|
2611
|
+
date: {},
|
|
2612
|
+
selectionMode: {
|
|
2613
|
+
default: "day"
|
|
2614
|
+
},
|
|
2615
|
+
showWeekNumber: {
|
|
2616
|
+
type: Boolean,
|
|
2617
|
+
default: false
|
|
2618
|
+
},
|
|
2619
|
+
disabledDate: {},
|
|
2620
|
+
cellClassName: {},
|
|
2621
|
+
minDate: {},
|
|
2622
|
+
maxDate: {},
|
|
2623
|
+
rangeState: {
|
|
2624
|
+
default() {
|
|
2625
|
+
return {
|
|
2626
|
+
endDate: null,
|
|
2627
|
+
selecting: false
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
},
|
|
2632
|
+
computed: {
|
|
2633
|
+
offsetDay() {
|
|
2634
|
+
const week = this.firstDayOfWeek;
|
|
2635
|
+
return week > 3 ? 7 - week : -week;
|
|
2636
|
+
},
|
|
2637
|
+
WEEKS() {
|
|
2638
|
+
const week = this.firstDayOfWeek;
|
|
2639
|
+
return WEEKS.concat(WEEKS).slice(week, week + 7);
|
|
2640
|
+
},
|
|
2641
|
+
year() {
|
|
2642
|
+
return this.date.getFullYear();
|
|
2643
|
+
},
|
|
2644
|
+
month() {
|
|
2645
|
+
return this.date.getMonth();
|
|
2646
|
+
},
|
|
2647
|
+
startDate() {
|
|
2648
|
+
return getStartDateOfMonth(this.year, this.month);
|
|
2649
|
+
},
|
|
2650
|
+
rows() {
|
|
2651
|
+
const date2 = new Date(this.year, this.month, 1);
|
|
2652
|
+
let day = getFirstDayOfMonth(date2);
|
|
2653
|
+
const dateCountOfMonth = getDayCountOfMonth(date2.getFullYear(), date2.getMonth());
|
|
2654
|
+
const dateCountOfLastMonth = getDayCountOfMonth(date2.getFullYear(), date2.getMonth() === 0 ? 11 : date2.getMonth() - 1);
|
|
2655
|
+
day = day === 0 ? 7 : day;
|
|
2656
|
+
const offset = this.offsetDay;
|
|
2657
|
+
const rows = this.tableRows;
|
|
2658
|
+
let count = 1;
|
|
2659
|
+
const startDate = this.startDate;
|
|
2660
|
+
const disabledDate = this.disabledDate;
|
|
2661
|
+
const cellClassName = this.cellClassName;
|
|
2662
|
+
const selectedDate = this.selectionMode === "dates" ? coerceTruthyValueToArray(this.value) : [];
|
|
2663
|
+
const now = getDateTimestamp$1(/* @__PURE__ */ new Date());
|
|
2664
|
+
for (let i = 0; i < 6; i++) {
|
|
2665
|
+
const row = rows[i];
|
|
2666
|
+
if (this.showWeekNumber) {
|
|
2667
|
+
if (!row[0]) {
|
|
2668
|
+
row[0] = {
|
|
2669
|
+
type: "week",
|
|
2670
|
+
text: getWeekNumber(nextDate(startDate, i * 7 + 1))
|
|
2671
|
+
};
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
for (let j = 0; j < 7; j++) {
|
|
2675
|
+
let cell = row[this.showWeekNumber ? j + 1 : j];
|
|
2676
|
+
if (!cell) {
|
|
2677
|
+
cell = {
|
|
2678
|
+
row: i,
|
|
2679
|
+
column: j,
|
|
2680
|
+
type: "normal",
|
|
2681
|
+
inRange: false,
|
|
2682
|
+
start: false,
|
|
2683
|
+
end: false
|
|
2684
|
+
};
|
|
2685
|
+
}
|
|
2686
|
+
cell.type = "normal";
|
|
2687
|
+
const index = i * 7 + j;
|
|
2688
|
+
const time = nextDate(startDate, index - offset).getTime();
|
|
2689
|
+
cell.inRange = time >= getDateTimestamp$1(this.minDate) && time <= getDateTimestamp$1(this.maxDate);
|
|
2690
|
+
cell.start = this.minDate && time === getDateTimestamp$1(this.minDate);
|
|
2691
|
+
cell.end = this.maxDate && time === getDateTimestamp$1(this.maxDate);
|
|
2692
|
+
const isToday = time === now;
|
|
2693
|
+
if (isToday) {
|
|
2694
|
+
cell.type = "today";
|
|
2695
|
+
}
|
|
2696
|
+
if (i >= 0 && i <= 1) {
|
|
2697
|
+
const numberOfDaysFromPreviousMonth = day + offset < 0 ? 7 + day + offset : day + offset;
|
|
2698
|
+
if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
|
|
2699
|
+
cell.text = count++;
|
|
2700
|
+
} else {
|
|
2701
|
+
cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
|
|
2702
|
+
cell.type = "prev-month";
|
|
2703
|
+
}
|
|
2704
|
+
} else {
|
|
2705
|
+
if (count <= dateCountOfMonth) {
|
|
2706
|
+
cell.text = count++;
|
|
2707
|
+
} else {
|
|
2708
|
+
cell.text = count++ - dateCountOfMonth;
|
|
2709
|
+
cell.type = "next-month";
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
let cellDate = new Date(time);
|
|
2713
|
+
cell.disabled = typeof disabledDate === "function" && disabledDate(cellDate);
|
|
2714
|
+
cell.selected = arrayFind(selectedDate, (date3) => date3.getTime() === cellDate.getTime());
|
|
2715
|
+
cell.customClass = typeof cellClassName === "function" && cellClassName(cellDate);
|
|
2716
|
+
this.$set(row, this.showWeekNumber ? j + 1 : j, cell);
|
|
2717
|
+
}
|
|
2718
|
+
if (this.selectionMode === "week") {
|
|
2719
|
+
const start = this.showWeekNumber ? 1 : 0;
|
|
2720
|
+
const end = this.showWeekNumber ? 7 : 6;
|
|
2721
|
+
const isWeekActive = this.isWeekActive(row[start + 1]);
|
|
2722
|
+
row[start].inRange = isWeekActive;
|
|
2723
|
+
row[start].start = isWeekActive;
|
|
2724
|
+
row[end].inRange = isWeekActive;
|
|
2725
|
+
row[end].end = isWeekActive;
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
return rows;
|
|
2729
|
+
}
|
|
2730
|
+
},
|
|
2731
|
+
watch: {
|
|
2732
|
+
"rangeState.endDate"(newVal) {
|
|
2733
|
+
this.markRange(this.minDate, newVal);
|
|
2734
|
+
},
|
|
2735
|
+
minDate(newVal, oldVal) {
|
|
2736
|
+
if (getDateTimestamp$1(newVal) !== getDateTimestamp$1(oldVal)) {
|
|
2737
|
+
this.markRange(this.minDate, this.maxDate);
|
|
2738
|
+
}
|
|
2739
|
+
},
|
|
2740
|
+
maxDate(newVal, oldVal) {
|
|
2741
|
+
if (getDateTimestamp$1(newVal) !== getDateTimestamp$1(oldVal)) {
|
|
2742
|
+
this.markRange(this.minDate, this.maxDate);
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
},
|
|
2746
|
+
data() {
|
|
2747
|
+
return {
|
|
2748
|
+
tableRows: [[], [], [], [], [], []],
|
|
2749
|
+
lastRow: null,
|
|
2750
|
+
lastColumn: null
|
|
2751
|
+
};
|
|
2752
|
+
},
|
|
2753
|
+
methods: {
|
|
2754
|
+
cellMatchesDate(cell, date2) {
|
|
2755
|
+
const value = new Date(date2);
|
|
2756
|
+
return this.year === value.getFullYear() && this.month === value.getMonth() && Number(cell.text) === value.getDate();
|
|
2757
|
+
},
|
|
2758
|
+
getCellClasses(cell) {
|
|
2759
|
+
const selectionMode = this.selectionMode;
|
|
2760
|
+
const defaultValue = this.defaultValue ? Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue] : [];
|
|
2761
|
+
let classes = [];
|
|
2762
|
+
if ((cell.type === "normal" || cell.type === "today") && !cell.disabled) {
|
|
2763
|
+
classes.push("available");
|
|
2764
|
+
if (cell.type === "today") {
|
|
2765
|
+
classes.push("today");
|
|
2766
|
+
}
|
|
2767
|
+
} else {
|
|
2768
|
+
classes.push(cell.type);
|
|
2769
|
+
}
|
|
2770
|
+
if (cell.type === "normal" && defaultValue.some((date2) => this.cellMatchesDate(cell, date2))) {
|
|
2771
|
+
classes.push("default");
|
|
2772
|
+
}
|
|
2773
|
+
if (selectionMode === "day" && (cell.type === "normal" || cell.type === "today") && this.cellMatchesDate(cell, this.value)) {
|
|
2774
|
+
classes.push("current");
|
|
2775
|
+
}
|
|
2776
|
+
if (cell.inRange && (cell.type === "normal" || cell.type === "today" || this.selectionMode === "week")) {
|
|
2777
|
+
classes.push("in-range");
|
|
2778
|
+
if (cell.start) {
|
|
2779
|
+
classes.push("start-date");
|
|
2780
|
+
}
|
|
2781
|
+
if (cell.end) {
|
|
2782
|
+
classes.push("end-date");
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
if (cell.disabled) {
|
|
2786
|
+
classes.push("disabled");
|
|
2787
|
+
}
|
|
2788
|
+
if (cell.selected) {
|
|
2789
|
+
classes.push("selected");
|
|
2790
|
+
}
|
|
2791
|
+
if (cell.customClass) {
|
|
2792
|
+
classes.push(cell.customClass);
|
|
2793
|
+
}
|
|
2794
|
+
return classes.join(" ");
|
|
2795
|
+
},
|
|
2796
|
+
getDateOfCell(row, column) {
|
|
2797
|
+
const offsetFromStart = row * 7 + (column - (this.showWeekNumber ? 1 : 0)) - this.offsetDay;
|
|
2798
|
+
return nextDate(this.startDate, offsetFromStart);
|
|
2799
|
+
},
|
|
2800
|
+
isWeekActive(cell) {
|
|
2801
|
+
if (this.selectionMode !== "week")
|
|
2802
|
+
return false;
|
|
2803
|
+
const newDate = new Date(this.year, this.month, 1);
|
|
2804
|
+
const year = newDate.getFullYear();
|
|
2805
|
+
const month = newDate.getMonth();
|
|
2806
|
+
if (cell.type === "prev-month") {
|
|
2807
|
+
newDate.setMonth(month === 0 ? 11 : month - 1);
|
|
2808
|
+
newDate.setFullYear(month === 0 ? year - 1 : year);
|
|
2809
|
+
}
|
|
2810
|
+
if (cell.type === "next-month") {
|
|
2811
|
+
newDate.setMonth(month === 11 ? 0 : month + 1);
|
|
2812
|
+
newDate.setFullYear(month === 11 ? year + 1 : year);
|
|
2813
|
+
}
|
|
2814
|
+
newDate.setDate(parseInt(cell.text, 10));
|
|
2815
|
+
if (isDate(this.value)) {
|
|
2816
|
+
const dayOffset = (this.value.getDay() - this.firstDayOfWeek + 7) % 7 - 1;
|
|
2817
|
+
const weekDate = prevDate(this.value, dayOffset);
|
|
2818
|
+
return weekDate.getTime() === newDate.getTime();
|
|
2819
|
+
}
|
|
2820
|
+
return false;
|
|
2821
|
+
},
|
|
2822
|
+
markRange(minDate, maxDate) {
|
|
2823
|
+
minDate = getDateTimestamp$1(minDate);
|
|
2824
|
+
maxDate = getDateTimestamp$1(maxDate) || minDate;
|
|
2825
|
+
[minDate, maxDate] = [Math.min(minDate, maxDate), Math.max(minDate, maxDate)];
|
|
2826
|
+
const startDate = this.startDate;
|
|
2827
|
+
const rows = this.rows;
|
|
2828
|
+
for (let i = 0, k = rows.length; i < k; i++) {
|
|
2829
|
+
const row = rows[i];
|
|
2830
|
+
for (let j = 0, l = row.length; j < l; j++) {
|
|
2831
|
+
if (this.showWeekNumber && j === 0)
|
|
2832
|
+
continue;
|
|
2833
|
+
const cell = row[j];
|
|
2834
|
+
const index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
|
|
2835
|
+
const time = nextDate(startDate, index - this.offsetDay).getTime();
|
|
2836
|
+
cell.inRange = minDate && time >= minDate && time <= maxDate;
|
|
2837
|
+
cell.start = minDate && time === minDate;
|
|
2838
|
+
cell.end = maxDate && time === maxDate;
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
},
|
|
2842
|
+
handleMouseMove(event) {
|
|
2843
|
+
if (!this.rangeState.selecting)
|
|
2844
|
+
return;
|
|
2845
|
+
let target = event.target;
|
|
2846
|
+
if (target.tagName === "SPAN") {
|
|
2847
|
+
target = target.parentNode.parentNode;
|
|
2848
|
+
}
|
|
2849
|
+
if (target.tagName === "DIV") {
|
|
2850
|
+
target = target.parentNode;
|
|
2851
|
+
}
|
|
2852
|
+
if (target.tagName !== "TD")
|
|
2853
|
+
return;
|
|
2854
|
+
const row = target.parentNode.rowIndex - 1;
|
|
2855
|
+
const column = target.cellIndex;
|
|
2856
|
+
if (this.rows[row][column].disabled)
|
|
2857
|
+
return;
|
|
2858
|
+
if (row !== this.lastRow || column !== this.lastColumn) {
|
|
2859
|
+
this.lastRow = row;
|
|
2860
|
+
this.lastColumn = column;
|
|
2861
|
+
this.$emit("changerange", {
|
|
2862
|
+
minDate: this.minDate,
|
|
2863
|
+
maxDate: this.maxDate,
|
|
2864
|
+
rangeState: {
|
|
2865
|
+
selecting: true,
|
|
2866
|
+
endDate: this.getDateOfCell(row, column)
|
|
2867
|
+
}
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
},
|
|
2871
|
+
handleClick(event) {
|
|
2872
|
+
let target = event.target;
|
|
2873
|
+
if (target.tagName === "SPAN") {
|
|
2874
|
+
target = target.parentNode.parentNode;
|
|
2875
|
+
}
|
|
2876
|
+
if (target.tagName === "DIV") {
|
|
2877
|
+
target = target.parentNode;
|
|
2878
|
+
}
|
|
2879
|
+
if (target.tagName !== "TD")
|
|
2880
|
+
return;
|
|
2881
|
+
const row = target.parentNode.rowIndex - 1;
|
|
2882
|
+
const column = this.selectionMode === "week" ? 1 : target.cellIndex;
|
|
2883
|
+
const cell = this.rows[row][column];
|
|
2884
|
+
if (cell.disabled || cell.type === "week")
|
|
2885
|
+
return;
|
|
2886
|
+
const newDate = this.getDateOfCell(row, column);
|
|
2887
|
+
if (this.selectionMode === "range") {
|
|
2888
|
+
if (!this.rangeState.selecting) {
|
|
2889
|
+
this.$emit("pick", {
|
|
2890
|
+
minDate: newDate,
|
|
2891
|
+
maxDate: null
|
|
2892
|
+
});
|
|
2893
|
+
this.rangeState.selecting = true;
|
|
2894
|
+
} else {
|
|
2895
|
+
if (newDate >= this.minDate) {
|
|
2896
|
+
this.$emit("pick", {
|
|
2897
|
+
minDate: this.minDate,
|
|
2898
|
+
maxDate: newDate
|
|
2899
|
+
});
|
|
2900
|
+
} else {
|
|
2901
|
+
this.$emit("pick", {
|
|
2902
|
+
minDate: newDate,
|
|
2903
|
+
maxDate: this.minDate
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2906
|
+
this.rangeState.selecting = false;
|
|
2907
|
+
}
|
|
2908
|
+
} else if (this.selectionMode === "day") {
|
|
2909
|
+
this.$emit("pick", newDate);
|
|
2910
|
+
} else if (this.selectionMode === "week") {
|
|
2911
|
+
const weekNumber = getWeekNumber(newDate);
|
|
2912
|
+
const value = newDate.getFullYear() + "w" + weekNumber;
|
|
2913
|
+
this.$emit("pick", {
|
|
2914
|
+
year: newDate.getFullYear(),
|
|
2915
|
+
week: weekNumber,
|
|
2916
|
+
value,
|
|
2917
|
+
date: newDate
|
|
2918
|
+
});
|
|
2919
|
+
} else if (this.selectionMode === "dates") {
|
|
2920
|
+
const value = this.value || [];
|
|
2921
|
+
const newValue = cell.selected ? removeFromArray(value, (date2) => date2.getTime() === newDate.getTime()) : [...value, newDate];
|
|
2922
|
+
this.$emit("pick", newValue);
|
|
2923
|
+
}
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
};
|
|
2927
|
+
var _sfc_render$3 = function render2() {
|
|
2928
|
+
var _vm = this, _c = _vm._self._c;
|
|
2929
|
+
return _c("table", {
|
|
2930
|
+
staticClass: "el-date-table",
|
|
2931
|
+
class: {
|
|
2932
|
+
"is-week-mode": _vm.selectionMode === "week"
|
|
2933
|
+
},
|
|
2934
|
+
attrs: {
|
|
2935
|
+
"cellspacing": "0",
|
|
2936
|
+
"cellpadding": "0"
|
|
2937
|
+
},
|
|
2938
|
+
on: {
|
|
2939
|
+
"click": _vm.handleClick,
|
|
2940
|
+
"mousemove": _vm.handleMouseMove
|
|
2941
|
+
}
|
|
2942
|
+
}, [_c("tbody", [_c("tr", [_vm.showWeekNumber ? _c("th", [_vm._v(_vm._s(_vm.t("el.datepicker.week")))]) : _vm._e(), _vm._l(_vm.WEEKS, function(week, key) {
|
|
2943
|
+
return _c("th", {
|
|
2944
|
+
key
|
|
2945
|
+
}, [_vm._v(_vm._s(_vm.t("el.datepicker.weeks." + week)))]);
|
|
2946
|
+
})], 2), _vm._l(_vm.rows, function(row, key) {
|
|
2947
|
+
return _c("tr", {
|
|
2948
|
+
key,
|
|
2949
|
+
staticClass: "el-date-table__row",
|
|
2950
|
+
class: {
|
|
2951
|
+
current: _vm.isWeekActive(row[1])
|
|
2952
|
+
}
|
|
2953
|
+
}, _vm._l(row, function(cell, key2) {
|
|
2954
|
+
return _c("td", {
|
|
2955
|
+
key: key2,
|
|
2956
|
+
class: _vm.getCellClasses(cell)
|
|
2957
|
+
}, [_c("div", [_c("span", [_vm._v(" " + _vm._s(cell.text) + " ")])])]);
|
|
2958
|
+
}), 0);
|
|
2959
|
+
})], 2)]);
|
|
2960
|
+
};
|
|
2961
|
+
var _sfc_staticRenderFns$3 = [];
|
|
2962
|
+
var __component__$3 = /* @__PURE__ */ normalizeComponent(_sfc_main$3, _sfc_render$3, _sfc_staticRenderFns$3, false, null, null, null, null);
|
|
2963
|
+
const DateTable = __component__$3.exports;
|
|
2964
|
+
const getDateTimestamp = function(time) {
|
|
2965
|
+
if (typeof time === "number" || typeof time === "string") {
|
|
2966
|
+
return clearTime(new Date(time)).getTime();
|
|
2967
|
+
} else if (time instanceof Date) {
|
|
2968
|
+
return clearTime(time).getTime();
|
|
2969
|
+
} else {
|
|
2970
|
+
return NaN;
|
|
2971
|
+
}
|
|
2972
|
+
};
|
|
2973
|
+
const _sfc_main$2 = {
|
|
2974
|
+
mixins: [DateTable],
|
|
2975
|
+
computed: {
|
|
2976
|
+
minDateTimestamp() {
|
|
2977
|
+
return getDateTimestamp(this.minDate);
|
|
2978
|
+
},
|
|
2979
|
+
maxDateTimestamp() {
|
|
2980
|
+
return getDateTimestamp(this.maxDate);
|
|
2981
|
+
},
|
|
2982
|
+
rows() {
|
|
2983
|
+
const date2 = new Date(this.year, this.month, 1);
|
|
2984
|
+
let day = getFirstDayOfMonth(date2);
|
|
2985
|
+
const dateCountOfMonth = getDayCountOfMonth(date2.getFullYear(), date2.getMonth());
|
|
2986
|
+
const dateCountOfLastMonth = getDayCountOfMonth(date2.getFullYear(), date2.getMonth() === 0 ? 11 : date2.getMonth() - 1);
|
|
2987
|
+
day = day === 0 ? 7 : day;
|
|
2988
|
+
const offset = this.offsetDay;
|
|
2989
|
+
const rows = this.tableRows;
|
|
2990
|
+
let count = 1;
|
|
2991
|
+
const startDate = this.startDate;
|
|
2992
|
+
const disabledDate = this.disabledDate;
|
|
2993
|
+
const cellClassName = this.cellClassName;
|
|
2994
|
+
const selectedDate = [];
|
|
2995
|
+
const now = getDateTimestamp(/* @__PURE__ */ new Date());
|
|
2996
|
+
for (let i = 0; i < 6; i++) {
|
|
2997
|
+
const row = rows[i];
|
|
2998
|
+
if (this.showWeekNumber) {
|
|
2999
|
+
if (!row[0]) {
|
|
3000
|
+
row[0] = {
|
|
3001
|
+
type: "week",
|
|
3002
|
+
text: getWeekNumber(nextDate(startDate, i * 7 + 1))
|
|
3003
|
+
};
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
for (let j = 0; j < 7; j++) {
|
|
3007
|
+
let cell = row[this.showWeekNumber ? j + 1 : j];
|
|
3008
|
+
if (!cell) {
|
|
3009
|
+
cell = {
|
|
3010
|
+
row: i,
|
|
3011
|
+
column: j,
|
|
3012
|
+
type: "normal",
|
|
3013
|
+
inRange: false,
|
|
3014
|
+
start: false,
|
|
3015
|
+
end: false
|
|
3016
|
+
};
|
|
3017
|
+
}
|
|
3018
|
+
cell.type = "normal";
|
|
3019
|
+
const index = i * 7 + j;
|
|
3020
|
+
const time = nextDate(startDate, index - offset).getTime();
|
|
3021
|
+
cell.inRange = time >= this.minDateTimestamp && time <= this.maxDateTimestamp;
|
|
3022
|
+
cell.start = this.minDate && time === this.minDateTimestamp;
|
|
3023
|
+
cell.end = this.maxDate && time === this.maxDateTimestamp;
|
|
3024
|
+
const isToday = time === now;
|
|
3025
|
+
if (isToday) {
|
|
3026
|
+
cell.type = "today";
|
|
3027
|
+
}
|
|
3028
|
+
if (i >= 0 && i <= 1) {
|
|
3029
|
+
const numberOfDaysFromPreviousMonth = day + offset < 0 ? 7 + day + offset : day + offset;
|
|
3030
|
+
if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
|
|
3031
|
+
cell.text = count++;
|
|
3032
|
+
} else {
|
|
3033
|
+
cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
|
|
3034
|
+
cell.type = "prev-month";
|
|
3035
|
+
}
|
|
3036
|
+
} else {
|
|
3037
|
+
if (count <= dateCountOfMonth) {
|
|
3038
|
+
cell.text = count++;
|
|
3039
|
+
} else {
|
|
3040
|
+
cell.text = count++ - dateCountOfMonth;
|
|
3041
|
+
cell.type = "next-month";
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
const cellDate = new Date(time);
|
|
3045
|
+
cell.disabled = typeof disabledDate === "function" && disabledDate(cellDate);
|
|
3046
|
+
cell.selected = arrayFind(selectedDate, (date3) => date3.getTime() === cellDate.getTime());
|
|
3047
|
+
cell.customClass = typeof cellClassName === "function" && cellClassName(cellDate);
|
|
3048
|
+
this.$set(row, this.showWeekNumber ? j + 1 : j, cell);
|
|
3049
|
+
}
|
|
3050
|
+
}
|
|
3051
|
+
return rows;
|
|
3052
|
+
}
|
|
3053
|
+
},
|
|
3054
|
+
methods: {
|
|
3055
|
+
getCellClasses(cell) {
|
|
3056
|
+
const defaultValue = this.defaultValue ? Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue] : [];
|
|
3057
|
+
const classes = [];
|
|
3058
|
+
if ((cell.type === "normal" || cell.type === "today") && !cell.disabled) {
|
|
3059
|
+
classes.push("available");
|
|
3060
|
+
if (cell.type === "today") {
|
|
3061
|
+
classes.push("today");
|
|
3062
|
+
}
|
|
3063
|
+
} else {
|
|
3064
|
+
classes.push(cell.type);
|
|
3065
|
+
}
|
|
3066
|
+
if (cell.type === "normal" && defaultValue.some((date2) => this.cellMatchesDate(cell, date2))) {
|
|
3067
|
+
classes.push("default");
|
|
3068
|
+
}
|
|
3069
|
+
if (cell.inRange && (cell.type === "normal" || cell.type === "today")) {
|
|
3070
|
+
if (isDate(this.minDate) && isDate(this.maxDate) || this.rangeState.selecting) {
|
|
3071
|
+
classes.push("in-range");
|
|
3072
|
+
}
|
|
3073
|
+
if (cell.start) {
|
|
3074
|
+
classes.push("start-date");
|
|
3075
|
+
} else if (cell.end) {
|
|
3076
|
+
classes.push("end-date");
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
if (cell.disabled) {
|
|
3080
|
+
classes.push("disabled");
|
|
3081
|
+
}
|
|
3082
|
+
if (cell.selected) {
|
|
3083
|
+
classes.push("selected");
|
|
3084
|
+
}
|
|
3085
|
+
if (cell.customClass) {
|
|
3086
|
+
classes.push(cell.customClass);
|
|
3087
|
+
}
|
|
3088
|
+
return classes.join(" ");
|
|
3089
|
+
},
|
|
3090
|
+
isWeekActive(cell) {
|
|
3091
|
+
const newDate = new Date(this.year, this.month, 1);
|
|
3092
|
+
const year = newDate.getFullYear();
|
|
3093
|
+
const month = newDate.getMonth();
|
|
3094
|
+
if (cell.type === "prev-month") {
|
|
3095
|
+
newDate.setMonth(month === 0 ? 11 : month - 1);
|
|
3096
|
+
newDate.setFullYear(month === 0 ? year - 1 : year);
|
|
3097
|
+
}
|
|
3098
|
+
if (cell.type === "next-month") {
|
|
3099
|
+
newDate.setMonth(month === 11 ? 0 : month + 1);
|
|
3100
|
+
newDate.setFullYear(month === 11 ? year + 1 : year);
|
|
3101
|
+
}
|
|
3102
|
+
newDate.setDate(parseInt(cell.text, 10));
|
|
3103
|
+
if (isDate(this.value)) {
|
|
3104
|
+
const dayOffset = (this.value.getDay() - this.firstDayOfWeek + 7) % 7 - 1;
|
|
3105
|
+
const weekDate = prevDate(this.value, dayOffset);
|
|
3106
|
+
return weekDate.getTime() === newDate.getTime();
|
|
3107
|
+
}
|
|
3108
|
+
return false;
|
|
3109
|
+
},
|
|
3110
|
+
handleMouseMove(event, isManual) {
|
|
3111
|
+
var _a, _b;
|
|
3112
|
+
if (!this.rangeState.selecting)
|
|
3113
|
+
return;
|
|
3114
|
+
let target = event.target;
|
|
3115
|
+
if (target.tagName === "SPAN") {
|
|
3116
|
+
target = target.parentNode.parentNode;
|
|
3117
|
+
}
|
|
3118
|
+
if (target.tagName === "DIV") {
|
|
3119
|
+
target = target.parentNode;
|
|
3120
|
+
}
|
|
3121
|
+
if (target.tagName !== "TD")
|
|
3122
|
+
return;
|
|
3123
|
+
const row = target.parentNode.rowIndex - 1;
|
|
3124
|
+
const isMinGreatMax = +new Date(this.rangeState.startDate) >= +new Date(this.getDateOfCell(row, 6));
|
|
3125
|
+
let column = isMinGreatMax ? 0 : 6;
|
|
3126
|
+
const findIndex = this.rows[row].findIndex((item) => !item.disabled);
|
|
3127
|
+
const isExistDis = this.rows[row].some((item) => item.disabled);
|
|
3128
|
+
if (isExistDis && findIndex >= 0) {
|
|
3129
|
+
column = findIndex;
|
|
3130
|
+
}
|
|
3131
|
+
if (this.rows[row][column].disabled)
|
|
3132
|
+
return;
|
|
3133
|
+
if (row !== this.lastRow || column !== this.lastColumn) {
|
|
3134
|
+
const minDateList = this.rangeState.minDateList;
|
|
3135
|
+
const endDate = this.getDateOfCell(row, column);
|
|
3136
|
+
if (!isManual) {
|
|
3137
|
+
if (isMinGreatMax && !this.isMinGreatMax && minDateList.length === 2 || ((_a = this.minDate) == null ? void 0 : _a.getTime()) > (endDate == null ? void 0 : endDate.getTime())) {
|
|
3138
|
+
this.$emit("pick", {
|
|
3139
|
+
minDate: minDateList[1],
|
|
3140
|
+
maxDate: null
|
|
3141
|
+
});
|
|
3142
|
+
this.isMinGreatMax = true;
|
|
3143
|
+
} else if (this.isMinGreatMax && !isMinGreatMax || ((_b = this.minDate) == null ? void 0 : _b.getTime()) < (endDate == null ? void 0 : endDate.getTime())) {
|
|
3144
|
+
this.$emit("pick", {
|
|
3145
|
+
minDate: minDateList[0],
|
|
3146
|
+
maxDate: null
|
|
3147
|
+
});
|
|
3148
|
+
this.isMinGreatMax = false;
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
this.$nextTick(() => {
|
|
3152
|
+
this.$emit("changerange", {
|
|
3153
|
+
minDate: this.minDate,
|
|
3154
|
+
maxDate: this.maxDate,
|
|
3155
|
+
rangeState: {
|
|
3156
|
+
selecting: true,
|
|
3157
|
+
endDate,
|
|
3158
|
+
startDate: this.rangeState.startDate,
|
|
3159
|
+
minDateList: this.rangeState.minDateList
|
|
3160
|
+
}
|
|
3161
|
+
});
|
|
3162
|
+
this.lastRow = row;
|
|
3163
|
+
this.lastColumn = target.cellIndex;
|
|
3164
|
+
});
|
|
3165
|
+
}
|
|
3166
|
+
},
|
|
3167
|
+
handleClick(event) {
|
|
3168
|
+
let target = event.target;
|
|
3169
|
+
if (target.tagName === "SPAN") {
|
|
3170
|
+
target = target.parentNode.parentNode;
|
|
3171
|
+
}
|
|
3172
|
+
if (target.tagName === "DIV") {
|
|
3173
|
+
target = target.parentNode;
|
|
3174
|
+
}
|
|
3175
|
+
if (target.tagName !== "TD")
|
|
3176
|
+
return;
|
|
3177
|
+
const row = target.parentNode.rowIndex - 1;
|
|
3178
|
+
let column = this.rangeState.selecting ? 6 : 0;
|
|
3179
|
+
const findIndex = this.rows[row].findIndex((item) => !item.disabled);
|
|
3180
|
+
const isExistDis = this.rows[row].some((item) => item.disabled);
|
|
3181
|
+
if (this.rangeState.startDate && this.rangeState.selecting) {
|
|
3182
|
+
column = +new Date(this.rangeState.startDate) >= +new Date(this.getDateOfCell(row, 6)) ? 0 : 6;
|
|
3183
|
+
}
|
|
3184
|
+
if (isExistDis && findIndex >= 0) {
|
|
3185
|
+
column = findIndex;
|
|
3186
|
+
}
|
|
3187
|
+
const cell = this.rows[row][column];
|
|
3188
|
+
if (cell.disabled || cell.type === "week")
|
|
3189
|
+
return;
|
|
3190
|
+
const newDate = this.getDateOfCell(row, column);
|
|
3191
|
+
if (!this.rangeState.selecting) {
|
|
3192
|
+
this.rangeState.startDate = newDate;
|
|
3193
|
+
this.rangeState.minDateList = [this.getDateOfCell(row, 0), this.getDateOfCell(row, 6)];
|
|
3194
|
+
this.$emit("pick", {
|
|
3195
|
+
minDate: newDate,
|
|
3196
|
+
maxDate: null
|
|
3197
|
+
});
|
|
3198
|
+
this.rangeState.selecting = true;
|
|
3199
|
+
this.$nextTick(() => {
|
|
3200
|
+
this.handleMouseMove({
|
|
3201
|
+
target: {
|
|
3202
|
+
tagName: "TD",
|
|
3203
|
+
parentNode: {
|
|
3204
|
+
rowIndex: row + 1,
|
|
3205
|
+
cellIndex: column
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
}, true);
|
|
3209
|
+
});
|
|
3210
|
+
} else {
|
|
3211
|
+
if (newDate >= this.minDate) {
|
|
3212
|
+
this.$emit("pick", {
|
|
3213
|
+
minDate: this.minDate,
|
|
3214
|
+
maxDate: newDate
|
|
3215
|
+
});
|
|
3216
|
+
} else {
|
|
3217
|
+
this.$emit("pick", {
|
|
3218
|
+
minDate: newDate,
|
|
3219
|
+
maxDate: this.minDate
|
|
3220
|
+
});
|
|
3221
|
+
}
|
|
3222
|
+
this.rangeState.selecting = false;
|
|
3223
|
+
}
|
|
3224
|
+
this.handleMouseMove(event);
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
};
|
|
3228
|
+
const _sfc_render$2 = null;
|
|
3229
|
+
const _sfc_staticRenderFns$2 = null;
|
|
3230
|
+
var __component__$2 = /* @__PURE__ */ normalizeComponent(_sfc_main$2, _sfc_render$2, _sfc_staticRenderFns$2, false, null, null, null, null);
|
|
3231
|
+
const WeekTable = __component__$2.exports;
|
|
3232
|
+
const calcDefaultValue = (defaultValue) => {
|
|
3233
|
+
if (Array.isArray(defaultValue)) {
|
|
3234
|
+
return [new Date(defaultValue[0]), new Date(defaultValue[1])];
|
|
3235
|
+
} else if (defaultValue) {
|
|
3236
|
+
return [new Date(defaultValue), nextDate(new Date(defaultValue), 1)];
|
|
3237
|
+
} else {
|
|
3238
|
+
return [/* @__PURE__ */ new Date(), nextDate(/* @__PURE__ */ new Date(), 1)];
|
|
3239
|
+
}
|
|
3240
|
+
};
|
|
3241
|
+
const _sfc_main$1 = {
|
|
3242
|
+
directives: {
|
|
3243
|
+
Clickoutside
|
|
3244
|
+
},
|
|
3245
|
+
components: {
|
|
3246
|
+
WeekTable
|
|
3247
|
+
},
|
|
3248
|
+
mixins: [Locale],
|
|
3249
|
+
data() {
|
|
3250
|
+
return {
|
|
3251
|
+
popperClass: "",
|
|
3252
|
+
value: [],
|
|
3253
|
+
defaultValue: null,
|
|
3254
|
+
defaultTime: null,
|
|
3255
|
+
minDate: "",
|
|
3256
|
+
maxDate: "",
|
|
3257
|
+
leftDate: /* @__PURE__ */ new Date(),
|
|
3258
|
+
rightDate: nextMonth(/* @__PURE__ */ new Date()),
|
|
3259
|
+
rangeState: {
|
|
3260
|
+
endDate: null,
|
|
3261
|
+
selecting: false,
|
|
3262
|
+
row: null,
|
|
3263
|
+
column: null
|
|
3264
|
+
},
|
|
3265
|
+
shortcuts: "",
|
|
3266
|
+
visible: "",
|
|
3267
|
+
disabledDate: "",
|
|
3268
|
+
cellClassName: "",
|
|
3269
|
+
firstDayOfWeek: 7,
|
|
3270
|
+
format: "",
|
|
3271
|
+
arrowControl: false,
|
|
3272
|
+
unlinkPanels: false,
|
|
3273
|
+
dateUserInput: {
|
|
3274
|
+
min: null,
|
|
3275
|
+
max: null
|
|
3276
|
+
},
|
|
3277
|
+
timeUserInput: {
|
|
3278
|
+
min: null,
|
|
3279
|
+
max: null
|
|
3280
|
+
}
|
|
3281
|
+
};
|
|
3282
|
+
},
|
|
3283
|
+
computed: {
|
|
3284
|
+
leftLabel() {
|
|
3285
|
+
return this.leftDate.getFullYear() + " " + this.t("el.datepicker.year") + " " + this.t(`el.datepicker.month${this.leftDate.getMonth() + 1}`);
|
|
3286
|
+
},
|
|
3287
|
+
rightLabel() {
|
|
3288
|
+
return this.rightDate.getFullYear() + " " + this.t("el.datepicker.year") + " " + this.t(`el.datepicker.month${this.rightDate.getMonth() + 1}`);
|
|
3289
|
+
},
|
|
3290
|
+
leftYear() {
|
|
3291
|
+
return this.leftDate.getFullYear();
|
|
3292
|
+
},
|
|
3293
|
+
leftMonth() {
|
|
3294
|
+
return this.leftDate.getMonth();
|
|
3295
|
+
},
|
|
3296
|
+
rightYear() {
|
|
3297
|
+
return this.rightDate.getFullYear();
|
|
3298
|
+
},
|
|
3299
|
+
rightMonth() {
|
|
3300
|
+
return this.rightDate.getMonth();
|
|
3301
|
+
},
|
|
3302
|
+
enableMonthArrow() {
|
|
3303
|
+
const nextMonth2 = (this.leftMonth + 1) % 12;
|
|
3304
|
+
const yearOffset = this.leftMonth + 1 >= 12 ? 1 : 0;
|
|
3305
|
+
return this.unlinkPanels && new Date(this.leftYear + yearOffset, nextMonth2) < new Date(this.rightYear, this.rightMonth);
|
|
3306
|
+
},
|
|
3307
|
+
enableYearArrow() {
|
|
3308
|
+
return this.unlinkPanels && this.rightYear * 12 + this.rightMonth - (this.leftYear * 12 + this.leftMonth + 1) >= 12;
|
|
3309
|
+
}
|
|
3310
|
+
},
|
|
3311
|
+
watch: {
|
|
3312
|
+
minDate() {
|
|
3313
|
+
this.dateUserInput.min = null;
|
|
3314
|
+
this.timeUserInput.min = null;
|
|
3315
|
+
this.$nextTick(() => {
|
|
3316
|
+
if (this.$refs.maxTimePicker && this.maxDate && this.maxDate < this.minDate) {
|
|
3317
|
+
const format2 = "HH:mm:ss";
|
|
3318
|
+
this.$refs.maxTimePicker.selectableRange = [[parseDate(formatDate(this.minDate, format2), format2), parseDate("23:59:59", format2)]];
|
|
3319
|
+
}
|
|
3320
|
+
});
|
|
3321
|
+
},
|
|
3322
|
+
maxDate(val) {
|
|
3323
|
+
this.dateUserInput.max = null;
|
|
3324
|
+
this.timeUserInput.max = null;
|
|
3325
|
+
if (val && this.$refs.maxTimePicker) {
|
|
3326
|
+
this.$refs.maxTimePicker.date = val;
|
|
3327
|
+
this.$refs.maxTimePicker.value = val;
|
|
3328
|
+
}
|
|
3329
|
+
},
|
|
3330
|
+
value(newVal) {
|
|
3331
|
+
if (!newVal) {
|
|
3332
|
+
this.minDate = null;
|
|
3333
|
+
this.maxDate = null;
|
|
3334
|
+
} else if (Array.isArray(newVal)) {
|
|
3335
|
+
if ((newVal == null ? void 0 : newVal.length) < 2) {
|
|
3336
|
+
return;
|
|
3337
|
+
}
|
|
3338
|
+
this.minDate = isDate(newVal[0]) ? new Date(newVal[0]) : null;
|
|
3339
|
+
this.maxDate = isDate(newVal[1]) ? new Date(newVal[1]) : null;
|
|
3340
|
+
if (this.minDate && this.maxDate) {
|
|
3341
|
+
if (this.minDate.getTime() > this.maxDate.getTime()) {
|
|
3342
|
+
const maxDate = this.minDate;
|
|
3343
|
+
this.minDate = this.maxDate;
|
|
3344
|
+
this.maxDate = maxDate;
|
|
3345
|
+
}
|
|
3346
|
+
const prevWeekDay = Math.abs(7 - this.firstDayOfWeek + this.minDate.getDay()) % 7;
|
|
3347
|
+
this.minDate = new Date(this.minDate.getTime() - prevWeekDay * 60 * 60 * 24 * 1e3);
|
|
3348
|
+
const nextWeekDay = Math.abs(this.firstDayOfWeek - 1 - this.maxDate.getDay()) % 7;
|
|
3349
|
+
this.maxDate = new Date(this.maxDate.getTime() + nextWeekDay * 60 * 60 * 24 * 1e3);
|
|
3350
|
+
}
|
|
3351
|
+
this.handleMinMaxDateWeek();
|
|
3352
|
+
if (this.minDate) {
|
|
3353
|
+
this.leftDate = this.minDate;
|
|
3354
|
+
if (this.unlinkPanels && this.maxDate) {
|
|
3355
|
+
const minDateYear = this.minDate.getFullYear();
|
|
3356
|
+
const minDateMonth = this.minDate.getMonth();
|
|
3357
|
+
const maxDateYear = this.maxDate.getFullYear();
|
|
3358
|
+
const maxDateMonth = this.maxDate.getMonth();
|
|
3359
|
+
this.rightDate = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? nextMonth(this.maxDate) : this.maxDate;
|
|
3360
|
+
} else {
|
|
3361
|
+
this.rightDate = nextMonth(this.leftDate);
|
|
3362
|
+
}
|
|
3363
|
+
} else {
|
|
3364
|
+
this.leftDate = calcDefaultValue(this.defaultValue)[0];
|
|
3365
|
+
this.rightDate = nextMonth(this.leftDate);
|
|
3366
|
+
}
|
|
3367
|
+
}
|
|
3368
|
+
},
|
|
3369
|
+
defaultValue(val) {
|
|
3370
|
+
if (!Array.isArray(this.value)) {
|
|
3371
|
+
const [left, right] = calcDefaultValue(val);
|
|
3372
|
+
this.leftDate = left;
|
|
3373
|
+
this.rightDate = val && val[1] && this.unlinkPanels ? right : nextMonth(this.leftDate);
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
},
|
|
3377
|
+
methods: {
|
|
3378
|
+
handleMinMaxDateWeek() {
|
|
3379
|
+
if (this.minDate && this.maxDate) {
|
|
3380
|
+
if (this.minDate.getTime() > this.maxDate.getTime()) {
|
|
3381
|
+
const maxDate = this.minDate;
|
|
3382
|
+
this.minDate = this.maxDate;
|
|
3383
|
+
this.maxDate = maxDate;
|
|
3384
|
+
}
|
|
3385
|
+
const prevWeekDay = Math.abs(7 - this.firstDayOfWeek + this.minDate.getDay()) % 7;
|
|
3386
|
+
this.minDate = new Date(this.minDate.getTime() - prevWeekDay * 60 * 60 * 24 * 1e3);
|
|
3387
|
+
const nextWeekDay = Math.abs(this.firstDayOfWeek - 1 - this.maxDate.getDay()) % 7;
|
|
3388
|
+
this.maxDate = new Date(this.maxDate.getTime() + nextWeekDay * 60 * 60 * 24 * 1e3);
|
|
3389
|
+
}
|
|
3390
|
+
},
|
|
3391
|
+
handleChangeRange(val) {
|
|
3392
|
+
this.minDate = val.minDate;
|
|
3393
|
+
this.maxDate = val.maxDate;
|
|
3394
|
+
this.rangeState = val.rangeState;
|
|
3395
|
+
},
|
|
3396
|
+
handleRangePick(val, close = true) {
|
|
3397
|
+
const defaultTime = this.defaultTime || [];
|
|
3398
|
+
const minDate = modifyWithTimeString(val.minDate, defaultTime[0]);
|
|
3399
|
+
const maxDate = modifyWithTimeString(val.maxDate, defaultTime[1]);
|
|
3400
|
+
if (this.maxDate === maxDate && this.minDate === minDate) {
|
|
3401
|
+
return;
|
|
3402
|
+
}
|
|
3403
|
+
this.onPick && this.onPick(val);
|
|
3404
|
+
this.maxDate = maxDate;
|
|
3405
|
+
this.minDate = minDate;
|
|
3406
|
+
let timer = setTimeout(() => {
|
|
3407
|
+
this.maxDate = maxDate;
|
|
3408
|
+
this.minDate = minDate;
|
|
3409
|
+
clearTimeout(timer);
|
|
3410
|
+
timer = null;
|
|
3411
|
+
}, 10);
|
|
3412
|
+
if (!close)
|
|
3413
|
+
return;
|
|
3414
|
+
this.handleConfirm();
|
|
3415
|
+
},
|
|
3416
|
+
handleShortcutClick(shortcut) {
|
|
3417
|
+
if (shortcut.onClick) {
|
|
3418
|
+
shortcut.onClick(this);
|
|
3419
|
+
}
|
|
3420
|
+
},
|
|
3421
|
+
// leftPrev*, rightNext* need to take care of `unlinkPanels`
|
|
3422
|
+
leftPrevYear() {
|
|
3423
|
+
this.leftDate = prevYear(this.leftDate);
|
|
3424
|
+
if (!this.unlinkPanels) {
|
|
3425
|
+
this.rightDate = nextMonth(this.leftDate);
|
|
3426
|
+
}
|
|
3427
|
+
},
|
|
3428
|
+
leftPrevMonth() {
|
|
3429
|
+
this.leftDate = prevMonth(this.leftDate);
|
|
3430
|
+
if (!this.unlinkPanels) {
|
|
3431
|
+
this.rightDate = nextMonth(this.leftDate);
|
|
3432
|
+
}
|
|
3433
|
+
},
|
|
3434
|
+
rightNextYear() {
|
|
3435
|
+
if (!this.unlinkPanels) {
|
|
3436
|
+
this.leftDate = nextYear(this.leftDate);
|
|
3437
|
+
this.rightDate = nextMonth(this.leftDate);
|
|
3438
|
+
} else {
|
|
3439
|
+
this.rightDate = nextYear(this.rightDate);
|
|
3440
|
+
}
|
|
3441
|
+
},
|
|
3442
|
+
rightNextMonth() {
|
|
3443
|
+
if (!this.unlinkPanels) {
|
|
3444
|
+
this.leftDate = nextMonth(this.leftDate);
|
|
3445
|
+
this.rightDate = nextMonth(this.leftDate);
|
|
3446
|
+
} else {
|
|
3447
|
+
this.rightDate = nextMonth(this.rightDate);
|
|
3448
|
+
}
|
|
3449
|
+
},
|
|
3450
|
+
// leftNext*, rightPrev* are called when `unlinkPanels` is true
|
|
3451
|
+
leftNextYear() {
|
|
3452
|
+
this.leftDate = nextYear(this.leftDate);
|
|
3453
|
+
},
|
|
3454
|
+
leftNextMonth() {
|
|
3455
|
+
this.leftDate = nextMonth(this.leftDate);
|
|
3456
|
+
},
|
|
3457
|
+
rightPrevYear() {
|
|
3458
|
+
this.rightDate = prevYear(this.rightDate);
|
|
3459
|
+
},
|
|
3460
|
+
rightPrevMonth() {
|
|
3461
|
+
this.rightDate = prevMonth(this.rightDate);
|
|
3462
|
+
},
|
|
3463
|
+
handleConfirm(visible = false) {
|
|
3464
|
+
if (this.isValidValue([this.minDate, this.maxDate])) {
|
|
3465
|
+
this.$emit("pick", [this.minDate, this.maxDate], visible);
|
|
3466
|
+
}
|
|
3467
|
+
},
|
|
3468
|
+
isValidValue(value) {
|
|
3469
|
+
return Array.isArray(value) && value && value[0] && value[1] && isDate(value[0]) && isDate(value[1]) && value[0].getTime() <= value[1].getTime() && (typeof this.disabledDate === "function" ? !this.disabledDate(value[0]) && !this.disabledDate(value[1]) : true);
|
|
3470
|
+
},
|
|
3471
|
+
resetView() {
|
|
3472
|
+
if (this.minDate && this.maxDate == null)
|
|
3473
|
+
this.rangeState.selecting = false;
|
|
3474
|
+
this.minDate = this.value && isDate(this.value[0]) ? new Date(this.value[0]) : null;
|
|
3475
|
+
this.maxDate = this.value && isDate(this.value[0]) ? new Date(this.value[1]) : null;
|
|
3476
|
+
this.handleMinMaxDateWeek();
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3479
|
+
};
|
|
3480
|
+
var _sfc_render$1 = function render3() {
|
|
3481
|
+
var _vm = this, _c = _vm._self._c;
|
|
3482
|
+
return _c("transition", {
|
|
3483
|
+
attrs: {
|
|
3484
|
+
"name": "el-zoom-in-top"
|
|
3485
|
+
},
|
|
3486
|
+
on: {
|
|
3487
|
+
"after-leave": function($event) {
|
|
3488
|
+
return _vm.$emit("dodestroy");
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
}, [_c("div", {
|
|
3492
|
+
directives: [{
|
|
3493
|
+
name: "show",
|
|
3494
|
+
rawName: "v-show",
|
|
3495
|
+
value: _vm.visible,
|
|
3496
|
+
expression: "visible"
|
|
3497
|
+
}],
|
|
3498
|
+
staticClass: "el-picker-panel el-date-range-picker el-popper nf-double-week nf-double-week-week-range",
|
|
3499
|
+
class: [{
|
|
3500
|
+
"has-sidebar": _vm.$slots.sidebar || _vm.shortcuts
|
|
3501
|
+
}, _vm.popperClass]
|
|
3502
|
+
}, [_c("div", {
|
|
3503
|
+
staticClass: "el-picker-panel__body-wrapper"
|
|
3504
|
+
}, [_vm._t("sidebar"), _vm.shortcuts ? _c("div", {
|
|
3505
|
+
staticClass: "el-picker-panel__sidebar"
|
|
3506
|
+
}, _vm._l(_vm.shortcuts, function(shortcut, key) {
|
|
3507
|
+
return _c("button", {
|
|
3508
|
+
key,
|
|
3509
|
+
staticClass: "el-picker-panel__shortcut",
|
|
3510
|
+
attrs: {
|
|
3511
|
+
"type": "button"
|
|
3512
|
+
},
|
|
3513
|
+
on: {
|
|
3514
|
+
"click": function($event) {
|
|
3515
|
+
return _vm.handleShortcutClick(shortcut);
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
}, [_vm._v(_vm._s(shortcut.text))]);
|
|
3519
|
+
}), 0) : _vm._e(), _c("div", {
|
|
3520
|
+
staticClass: "el-picker-panel__body"
|
|
3521
|
+
}, [_c("div", {
|
|
3522
|
+
staticClass: "el-picker-panel__content el-date-range-picker__content is-left"
|
|
3523
|
+
}, [_c("div", {
|
|
3524
|
+
staticClass: "el-date-range-picker__header"
|
|
3525
|
+
}, [_c("button", {
|
|
3526
|
+
staticClass: "el-picker-panel__icon-btn el-icon-d-arrow-left",
|
|
3527
|
+
attrs: {
|
|
3528
|
+
"type": "button"
|
|
3529
|
+
},
|
|
3530
|
+
on: {
|
|
3531
|
+
"click": _vm.leftPrevYear
|
|
3532
|
+
}
|
|
3533
|
+
}), _c("button", {
|
|
3534
|
+
staticClass: "el-picker-panel__icon-btn el-icon-arrow-left",
|
|
3535
|
+
attrs: {
|
|
3536
|
+
"type": "button"
|
|
3537
|
+
},
|
|
3538
|
+
on: {
|
|
3539
|
+
"click": _vm.leftPrevMonth
|
|
3540
|
+
}
|
|
3541
|
+
}), _vm.unlinkPanels ? _c("button", {
|
|
3542
|
+
staticClass: "el-picker-panel__icon-btn el-icon-d-arrow-right",
|
|
3543
|
+
class: {
|
|
3544
|
+
"is-disabled": !_vm.enableYearArrow
|
|
3545
|
+
},
|
|
3546
|
+
attrs: {
|
|
3547
|
+
"type": "button",
|
|
3548
|
+
"disabled": !_vm.enableYearArrow
|
|
3549
|
+
},
|
|
3550
|
+
on: {
|
|
3551
|
+
"click": _vm.leftNextYear
|
|
3552
|
+
}
|
|
3553
|
+
}) : _vm._e(), _vm.unlinkPanels ? _c("button", {
|
|
3554
|
+
staticClass: "el-picker-panel__icon-btn el-icon-arrow-right",
|
|
3555
|
+
class: {
|
|
3556
|
+
"is-disabled": !_vm.enableMonthArrow
|
|
3557
|
+
},
|
|
3558
|
+
attrs: {
|
|
3559
|
+
"type": "button",
|
|
3560
|
+
"disabled": !_vm.enableMonthArrow
|
|
3561
|
+
},
|
|
3562
|
+
on: {
|
|
3563
|
+
"click": _vm.leftNextMonth
|
|
3564
|
+
}
|
|
3565
|
+
}) : _vm._e(), _c("div", [_vm._v(_vm._s(_vm.leftLabel))])]), _c("week-table", {
|
|
3566
|
+
attrs: {
|
|
3567
|
+
"selection-mode": "weekrange",
|
|
3568
|
+
"date": _vm.leftDate,
|
|
3569
|
+
"default-value": _vm.defaultValue,
|
|
3570
|
+
"min-date": _vm.minDate,
|
|
3571
|
+
"max-date": _vm.maxDate,
|
|
3572
|
+
"range-state": _vm.rangeState,
|
|
3573
|
+
"disabled-date": _vm.disabledDate,
|
|
3574
|
+
"cell-class-name": _vm.cellClassName,
|
|
3575
|
+
"first-day-of-week": _vm.firstDayOfWeek
|
|
3576
|
+
},
|
|
3577
|
+
on: {
|
|
3578
|
+
"changerange": _vm.handleChangeRange,
|
|
3579
|
+
"pick": _vm.handleRangePick
|
|
3580
|
+
}
|
|
3581
|
+
})], 1), _c("div", {
|
|
3582
|
+
staticClass: "el-picker-panel__content el-date-range-picker__content is-right"
|
|
3583
|
+
}, [_c("div", {
|
|
3584
|
+
staticClass: "el-date-range-picker__header"
|
|
3585
|
+
}, [_vm.unlinkPanels ? _c("button", {
|
|
3586
|
+
staticClass: "el-picker-panel__icon-btn el-icon-d-arrow-left",
|
|
3587
|
+
class: {
|
|
3588
|
+
"is-disabled": !_vm.enableYearArrow
|
|
3589
|
+
},
|
|
3590
|
+
attrs: {
|
|
3591
|
+
"type": "button",
|
|
3592
|
+
"disabled": !_vm.enableYearArrow
|
|
3593
|
+
},
|
|
3594
|
+
on: {
|
|
3595
|
+
"click": _vm.rightPrevYear
|
|
3596
|
+
}
|
|
3597
|
+
}) : _vm._e(), _vm.unlinkPanels ? _c("button", {
|
|
3598
|
+
staticClass: "el-picker-panel__icon-btn el-icon-arrow-left",
|
|
3599
|
+
class: {
|
|
3600
|
+
"is-disabled": !_vm.enableMonthArrow
|
|
3601
|
+
},
|
|
3602
|
+
attrs: {
|
|
3603
|
+
"type": "button",
|
|
3604
|
+
"disabled": !_vm.enableMonthArrow
|
|
3605
|
+
},
|
|
3606
|
+
on: {
|
|
3607
|
+
"click": _vm.rightPrevMonth
|
|
3608
|
+
}
|
|
3609
|
+
}) : _vm._e(), _c("button", {
|
|
3610
|
+
staticClass: "el-picker-panel__icon-btn el-icon-d-arrow-right",
|
|
3611
|
+
attrs: {
|
|
3612
|
+
"type": "button"
|
|
3613
|
+
},
|
|
3614
|
+
on: {
|
|
3615
|
+
"click": _vm.rightNextYear
|
|
3616
|
+
}
|
|
3617
|
+
}), _c("button", {
|
|
3618
|
+
staticClass: "el-picker-panel__icon-btn el-icon-arrow-right",
|
|
3619
|
+
attrs: {
|
|
3620
|
+
"type": "button"
|
|
3621
|
+
},
|
|
3622
|
+
on: {
|
|
3623
|
+
"click": _vm.rightNextMonth
|
|
3624
|
+
}
|
|
3625
|
+
}), _c("div", [_vm._v(_vm._s(_vm.rightLabel))])]), _c("week-table", {
|
|
3626
|
+
attrs: {
|
|
3627
|
+
"selection-mode": "weekrange",
|
|
3628
|
+
"date": _vm.rightDate,
|
|
3629
|
+
"default-value": _vm.defaultValue,
|
|
3630
|
+
"min-date": _vm.minDate,
|
|
3631
|
+
"max-date": _vm.maxDate,
|
|
3632
|
+
"range-state": _vm.rangeState,
|
|
3633
|
+
"disabled-date": _vm.disabledDate,
|
|
3634
|
+
"cell-class-name": _vm.cellClassName,
|
|
3635
|
+
"first-day-of-week": _vm.firstDayOfWeek
|
|
3636
|
+
},
|
|
3637
|
+
on: {
|
|
3638
|
+
"changerange": _vm.handleChangeRange,
|
|
3639
|
+
"pick": _vm.handleRangePick
|
|
3640
|
+
}
|
|
3641
|
+
})], 1)])], 2)])]);
|
|
3642
|
+
};
|
|
3643
|
+
var _sfc_staticRenderFns$1 = [];
|
|
3644
|
+
var __component__$1 = /* @__PURE__ */ normalizeComponent(_sfc_main$1, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
3645
|
+
const WeekRangePanel = __component__$1.exports;
|
|
3646
|
+
const getPanel = function() {
|
|
3647
|
+
return WeekRangePanel;
|
|
3648
|
+
};
|
|
3649
|
+
const _sfc_main = {
|
|
3650
|
+
mixins: [Picker],
|
|
3651
|
+
name: "NfDoubleWeek",
|
|
3652
|
+
props: {
|
|
3653
|
+
timeArrowControl: Boolean
|
|
3654
|
+
},
|
|
3655
|
+
watch: {
|
|
3656
|
+
type(type) {
|
|
3657
|
+
if (this.picker) {
|
|
3658
|
+
this.unmountPicker();
|
|
3659
|
+
this.panel = getPanel();
|
|
3660
|
+
this.mountPicker();
|
|
3661
|
+
} else {
|
|
3662
|
+
this.panel = getPanel();
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
},
|
|
3666
|
+
created() {
|
|
3667
|
+
this.panel = getPanel(this.type);
|
|
3668
|
+
}
|
|
3669
|
+
};
|
|
3670
|
+
const _sfc_render = null;
|
|
3671
|
+
const _sfc_staticRenderFns = null;
|
|
3672
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|
|
3673
|
+
const NfDoubleWeek = __component__.exports;
|
|
3674
|
+
NfDoubleWeek.install = (app) => {
|
|
3675
|
+
app.component("nf-double-week", NfDoubleWeek);
|
|
3676
|
+
};
|
|
3677
|
+
export {
|
|
3678
|
+
NfDoubleWeek as default
|
|
3679
|
+
};
|