@ql-web/view-report 1.0.3 → 1.0.4
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/package.json +1 -1
- package/view-report.es.js +174 -69
- package/view-report.umd.js +175 -71
package/package.json
CHANGED
package/view-report.es.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, watch, onMounted, onUnmounted, isVue2 } from "vue-demi";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
options._compiled = true;
|
|
2
|
+
import { createElementBlock, openBlock, normalizeStyle, renderSlot, createTextVNode, toDisplayString, createElementVNode, withDirectives, createCommentVNode, vShow, createStaticVNode, Fragment, renderList, normalizeClass } from "vue";
|
|
3
|
+
const _export_sfc = (sfc, props) => {
|
|
4
|
+
const target = sfc.__vccOpts || sfc;
|
|
5
|
+
for (const [key, val] of props) {
|
|
6
|
+
target[key] = val;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
exports: scriptExports,
|
|
14
|
-
options
|
|
15
|
-
};
|
|
16
|
-
}
|
|
8
|
+
return target;
|
|
9
|
+
};
|
|
17
10
|
const _sfc_main$1 = defineComponent({
|
|
18
11
|
name: "MyButton",
|
|
19
12
|
// 必须声明 name,用于全局注册
|
|
@@ -34,23 +27,18 @@ const _sfc_main$1 = defineComponent({
|
|
|
34
27
|
return { handleClick };
|
|
35
28
|
}
|
|
36
29
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
false,
|
|
50
|
-
null,
|
|
51
|
-
"d19bd5c3"
|
|
52
|
-
);
|
|
53
|
-
const MyButton = __component__$1.exports;
|
|
30
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
31
|
+
return openBlock(), createElementBlock("button", {
|
|
32
|
+
class: "my-button",
|
|
33
|
+
style: normalizeStyle({ background: _ctx.color }),
|
|
34
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
35
|
+
}, [
|
|
36
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
37
|
+
createTextVNode(toDisplayString(_ctx.text), 1)
|
|
38
|
+
], true)
|
|
39
|
+
], 4);
|
|
40
|
+
}
|
|
41
|
+
const MyButton = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-d19bd5c3"]]);
|
|
54
42
|
class DateUtils {
|
|
55
43
|
/**
|
|
56
44
|
* 格式化日期为 YYYY-MM-DD 格式
|
|
@@ -414,45 +402,162 @@ const _sfc_main = defineComponent({
|
|
|
414
402
|
};
|
|
415
403
|
}
|
|
416
404
|
});
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
return _c("div", { ref: "pickerWrapper", staticClass: "view-date-picker-wrapper" }, [_c("div", { staticClass: "native-input-wrapper" }, [_c("input", { ref: "dateInput", staticClass: "native-input", attrs: { "type": "text", "placeholder": "请选择日期", "readonly": "" }, domProps: { "value": _vm.displayDate }, on: { "input": _vm.handleInput, "click": _vm.togglePanel } }), _c("span", { staticClass: "date-icon", on: { "click": _vm.togglePanel } }, [_vm._v("📅")])]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.panelVisible, expression: "panelVisible" }], ref: "datePanel", staticClass: "date-picker-dropdown", style: _vm.panelStyle }, [_c("div", { staticClass: "date-picker-panel" }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.panelType == "date", expression: "panelType == 'date'" }], staticClass: "picker-header" }, [_c("button", { staticClass: "toggle-btn year-btn prev-year", on: { "click": _vm.switchToPrevYear } }, [_vm._v("«")]), _c("button", { staticClass: "toggle-btn month-btn prev-month", on: { "click": _vm.switchToPrevMonth } }, [_vm._v(" < ")]), _c("div", { staticClass: "current-month" }, [_c("span", { staticClass: "clickable-year", on: { "click": _vm.openYearPanel } }, [_vm._v(_vm._s(_vm.currentYear) + "年")]), _c("span", { staticClass: "clickable-month", on: { "click": _vm.openMonthPanel } }, [_vm._v(_vm._s(_vm.currentMonth) + "月")])]), _c("button", { staticClass: "toggle-btn month-btn next-month", on: { "click": _vm.switchToNextMonth } }, [_vm._v(">")]), _c("button", { staticClass: "toggle-btn year-btn next-year", on: { "click": _vm.switchToNextYear } }, [_vm._v("»")])]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.panelType == "year", expression: "panelType == 'year'" }], staticClass: "picker-header" }, [_c("button", { staticClass: "toggle-btn month-btn prev-month", on: { "click": _vm.switchToPrevTenYears } }, [_vm._v(" < ")]), _c("div", { staticClass: "current-month" }, [_c("span", { staticClass: "clickable-year" }, [_vm._v(_vm._s(_vm.getDecadeStartAndEnd) + "年")])]), _c("button", { staticClass: "toggle-btn month-btn next-month", on: { "click": _vm.switchToNextTenYears } }, [_vm._v(">")])]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.panelType == "month", expression: "panelType == 'month'" }], staticClass: "picker-header" }, [_c("button", { staticClass: "toggle-btn month-btn prev-month", on: { "click": _vm.switchToPrevYear } }, [_vm._v(" < ")]), _c("div", { staticClass: "current-month" }, [_c("span", { staticClass: "clickable-year" }, [_vm._v(_vm._s(_vm.currentYear) + "年")])]), _c("button", { staticClass: "toggle-btn month-btn next-month", on: { "click": _vm.switchToNextYear } }, [_vm._v(">")])]), _vm.panelType === "date" ? _c("div", { staticClass: "bod-mb" }, [_vm._m(0), _c("div", { staticClass: "picker-panel" }, _vm._l(_vm.panelDates, function(item, index2) {
|
|
421
|
-
return _c("div", { key: index2, staticClass: "date-item", class: {
|
|
422
|
-
"not-current-month": !item.isCurrentMonth,
|
|
423
|
-
"selected": item.formatDate === _vm.displayDate,
|
|
424
|
-
"hover": _vm.hoverDate === item.formatDate && item.formatDate !== _vm.displayDate
|
|
425
|
-
}, on: { "click": function($event) {
|
|
426
|
-
return _vm.selectDate(item);
|
|
427
|
-
}, "mouseenter": function($event) {
|
|
428
|
-
_vm.hoverDate = item.formatDate;
|
|
429
|
-
}, "mouseleave": function($event) {
|
|
430
|
-
_vm.hoverDate = "";
|
|
431
|
-
} } }, [_vm._v(" " + _vm._s(item.date.getDate()) + " ")]);
|
|
432
|
-
}), 0)]) : _vm.panelType === "year" ? _c("div", { staticClass: "bod-mb" }, _vm._l(_vm.decadeYears, function(year) {
|
|
433
|
-
return _c("div", { key: year, staticClass: "year-item", class: { "selected": year === _vm.currentYear }, on: { "click": function($event) {
|
|
434
|
-
return _vm.selectDecadeYear(year);
|
|
435
|
-
} } }, [_vm._v(" " + _vm._s(year) + "年 ")]);
|
|
436
|
-
}), 0) : _vm.panelType === "month" ? _c("div", { staticClass: "bod-mb" }, _vm._l(12, function(month) {
|
|
437
|
-
return _c("div", { key: month, staticClass: "month-item", class: { "selected": month === _vm.currentMonth }, on: { "click": function($event) {
|
|
438
|
-
return _vm.selectTargetMonth(month);
|
|
439
|
-
} } }, [_vm._v(" " + _vm._s(month) + "月 ")]);
|
|
440
|
-
}), 0) : _vm._e()])])]);
|
|
405
|
+
const _hoisted_1 = {
|
|
406
|
+
class: "view-date-picker-wrapper",
|
|
407
|
+
ref: "pickerWrapper"
|
|
441
408
|
};
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
409
|
+
const _hoisted_2 = { class: "native-input-wrapper" };
|
|
410
|
+
const _hoisted_3 = ["value"];
|
|
411
|
+
const _hoisted_4 = { class: "date-picker-panel" };
|
|
412
|
+
const _hoisted_5 = { class: "picker-header" };
|
|
413
|
+
const _hoisted_6 = { class: "current-month" };
|
|
414
|
+
const _hoisted_7 = { class: "picker-header" };
|
|
415
|
+
const _hoisted_8 = { class: "current-month" };
|
|
416
|
+
const _hoisted_9 = { class: "clickable-year" };
|
|
417
|
+
const _hoisted_10 = { class: "picker-header" };
|
|
418
|
+
const _hoisted_11 = { class: "current-month" };
|
|
419
|
+
const _hoisted_12 = { class: "clickable-year" };
|
|
420
|
+
const _hoisted_13 = {
|
|
421
|
+
key: 0,
|
|
422
|
+
class: "bod-mb"
|
|
423
|
+
};
|
|
424
|
+
const _hoisted_14 = { class: "picker-panel" };
|
|
425
|
+
const _hoisted_15 = ["onClick", "onMouseenter"];
|
|
426
|
+
const _hoisted_16 = {
|
|
427
|
+
key: 1,
|
|
428
|
+
class: "bod-mb"
|
|
429
|
+
};
|
|
430
|
+
const _hoisted_17 = ["onClick"];
|
|
431
|
+
const _hoisted_18 = {
|
|
432
|
+
key: 2,
|
|
433
|
+
class: "bod-mb"
|
|
434
|
+
};
|
|
435
|
+
const _hoisted_19 = ["onClick"];
|
|
436
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
437
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
438
|
+
createElementVNode("div", _hoisted_2, [
|
|
439
|
+
createElementVNode("input", {
|
|
440
|
+
ref: "dateInput",
|
|
441
|
+
type: "text",
|
|
442
|
+
value: _ctx.displayDate,
|
|
443
|
+
onInput: _cache[0] || (_cache[0] = (...args) => _ctx.handleInput && _ctx.handleInput(...args)),
|
|
444
|
+
placeholder: "请选择日期",
|
|
445
|
+
readonly: "",
|
|
446
|
+
class: "native-input",
|
|
447
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.togglePanel && _ctx.togglePanel(...args))
|
|
448
|
+
}, null, 40, _hoisted_3),
|
|
449
|
+
createElementVNode("span", {
|
|
450
|
+
class: "date-icon",
|
|
451
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.togglePanel && _ctx.togglePanel(...args))
|
|
452
|
+
}, "📅")
|
|
453
|
+
]),
|
|
454
|
+
withDirectives(createElementVNode("div", {
|
|
455
|
+
ref: "datePanel",
|
|
456
|
+
class: "date-picker-dropdown",
|
|
457
|
+
style: normalizeStyle(_ctx.panelStyle)
|
|
458
|
+
}, [
|
|
459
|
+
createElementVNode("div", _hoisted_4, [
|
|
460
|
+
withDirectives(createElementVNode("div", _hoisted_5, [
|
|
461
|
+
createElementVNode("button", {
|
|
462
|
+
class: "toggle-btn year-btn prev-year",
|
|
463
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.switchToPrevYear && _ctx.switchToPrevYear(...args))
|
|
464
|
+
}, "«"),
|
|
465
|
+
createElementVNode("button", {
|
|
466
|
+
class: "toggle-btn month-btn prev-month",
|
|
467
|
+
onClick: _cache[4] || (_cache[4] = (...args) => _ctx.switchToPrevMonth && _ctx.switchToPrevMonth(...args))
|
|
468
|
+
}, " < "),
|
|
469
|
+
createElementVNode("div", _hoisted_6, [
|
|
470
|
+
createElementVNode("span", {
|
|
471
|
+
onClick: _cache[5] || (_cache[5] = (...args) => _ctx.openYearPanel && _ctx.openYearPanel(...args)),
|
|
472
|
+
class: "clickable-year"
|
|
473
|
+
}, toDisplayString(_ctx.currentYear) + "年", 1),
|
|
474
|
+
createElementVNode("span", {
|
|
475
|
+
onClick: _cache[6] || (_cache[6] = (...args) => _ctx.openMonthPanel && _ctx.openMonthPanel(...args)),
|
|
476
|
+
class: "clickable-month"
|
|
477
|
+
}, toDisplayString(_ctx.currentMonth) + "月", 1)
|
|
478
|
+
]),
|
|
479
|
+
createElementVNode("button", {
|
|
480
|
+
class: "toggle-btn month-btn next-month",
|
|
481
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.switchToNextMonth && _ctx.switchToNextMonth(...args))
|
|
482
|
+
}, ">"),
|
|
483
|
+
createElementVNode("button", {
|
|
484
|
+
class: "toggle-btn year-btn next-year",
|
|
485
|
+
onClick: _cache[8] || (_cache[8] = (...args) => _ctx.switchToNextYear && _ctx.switchToNextYear(...args))
|
|
486
|
+
}, "»")
|
|
487
|
+
], 512), [
|
|
488
|
+
[vShow, _ctx.panelType == "date"]
|
|
489
|
+
]),
|
|
490
|
+
withDirectives(createElementVNode("div", _hoisted_7, [
|
|
491
|
+
createElementVNode("button", {
|
|
492
|
+
class: "toggle-btn month-btn prev-month",
|
|
493
|
+
onClick: _cache[9] || (_cache[9] = (...args) => _ctx.switchToPrevTenYears && _ctx.switchToPrevTenYears(...args))
|
|
494
|
+
}, " < "),
|
|
495
|
+
createElementVNode("div", _hoisted_8, [
|
|
496
|
+
createElementVNode("span", _hoisted_9, toDisplayString(_ctx.getDecadeStartAndEnd) + "年", 1)
|
|
497
|
+
]),
|
|
498
|
+
createElementVNode("button", {
|
|
499
|
+
class: "toggle-btn month-btn next-month",
|
|
500
|
+
onClick: _cache[10] || (_cache[10] = (...args) => _ctx.switchToNextTenYears && _ctx.switchToNextTenYears(...args))
|
|
501
|
+
}, ">")
|
|
502
|
+
], 512), [
|
|
503
|
+
[vShow, _ctx.panelType == "year"]
|
|
504
|
+
]),
|
|
505
|
+
withDirectives(createElementVNode("div", _hoisted_10, [
|
|
506
|
+
createElementVNode("button", {
|
|
507
|
+
class: "toggle-btn month-btn prev-month",
|
|
508
|
+
onClick: _cache[11] || (_cache[11] = (...args) => _ctx.switchToPrevYear && _ctx.switchToPrevYear(...args))
|
|
509
|
+
}, " < "),
|
|
510
|
+
createElementVNode("div", _hoisted_11, [
|
|
511
|
+
createElementVNode("span", _hoisted_12, toDisplayString(_ctx.currentYear) + "年", 1)
|
|
512
|
+
]),
|
|
513
|
+
createElementVNode("button", {
|
|
514
|
+
class: "toggle-btn month-btn next-month",
|
|
515
|
+
onClick: _cache[12] || (_cache[12] = (...args) => _ctx.switchToNextYear && _ctx.switchToNextYear(...args))
|
|
516
|
+
}, ">")
|
|
517
|
+
], 512), [
|
|
518
|
+
[vShow, _ctx.panelType == "month"]
|
|
519
|
+
]),
|
|
520
|
+
_ctx.panelType === "date" ? (openBlock(), createElementBlock("div", _hoisted_13, [
|
|
521
|
+
_cache[14] || (_cache[14] = createStaticVNode('<div class="picker-week-header" data-v-e6885493><div class="week-item" data-v-e6885493>日</div><div class="week-item" data-v-e6885493>一</div><div class="week-item" data-v-e6885493>二</div><div class="week-item" data-v-e6885493>三</div><div class="week-item" data-v-e6885493>四</div><div class="week-item" data-v-e6885493>五</div><div class="week-item" data-v-e6885493>六</div></div>', 1)),
|
|
522
|
+
createElementVNode("div", _hoisted_14, [
|
|
523
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.panelDates, (item, index2) => {
|
|
524
|
+
return openBlock(), createElementBlock("div", {
|
|
525
|
+
class: normalizeClass(["date-item", {
|
|
526
|
+
"not-current-month": !item.isCurrentMonth,
|
|
527
|
+
"selected": item.formatDate === _ctx.displayDate,
|
|
528
|
+
"hover": _ctx.hoverDate === item.formatDate && item.formatDate !== _ctx.displayDate
|
|
529
|
+
}]),
|
|
530
|
+
key: index2,
|
|
531
|
+
onClick: ($event) => _ctx.selectDate(item),
|
|
532
|
+
onMouseenter: ($event) => _ctx.hoverDate = item.formatDate,
|
|
533
|
+
onMouseleave: _cache[13] || (_cache[13] = ($event) => _ctx.hoverDate = "")
|
|
534
|
+
}, toDisplayString(item.date.getDate()), 43, _hoisted_15);
|
|
535
|
+
}), 128))
|
|
536
|
+
])
|
|
537
|
+
])) : _ctx.panelType === "year" ? (openBlock(), createElementBlock("div", _hoisted_16, [
|
|
538
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.decadeYears, (year) => {
|
|
539
|
+
return openBlock(), createElementBlock("div", {
|
|
540
|
+
class: normalizeClass(["year-item", { "selected": year === _ctx.currentYear }]),
|
|
541
|
+
key: year,
|
|
542
|
+
onClick: ($event) => _ctx.selectDecadeYear(year)
|
|
543
|
+
}, toDisplayString(year) + "年 ", 11, _hoisted_17);
|
|
544
|
+
}), 128))
|
|
545
|
+
])) : _ctx.panelType === "month" ? (openBlock(), createElementBlock("div", _hoisted_18, [
|
|
546
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(12, (month) => {
|
|
547
|
+
return createElementVNode("div", {
|
|
548
|
+
class: normalizeClass(["month-item", { "selected": month === _ctx.currentMonth }]),
|
|
549
|
+
key: month,
|
|
550
|
+
onClick: ($event) => _ctx.selectTargetMonth(month)
|
|
551
|
+
}, toDisplayString(month) + "月 ", 11, _hoisted_19);
|
|
552
|
+
}), 64))
|
|
553
|
+
])) : createCommentVNode("", true)
|
|
554
|
+
])
|
|
555
|
+
], 4), [
|
|
556
|
+
[vShow, _ctx.panelVisible]
|
|
557
|
+
])
|
|
558
|
+
], 512);
|
|
559
|
+
}
|
|
560
|
+
const ViewDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e6885493"]]);
|
|
456
561
|
const components = [MyButton, ViewDatePicker];
|
|
457
562
|
const install = (app) => {
|
|
458
563
|
components.forEach((component) => {
|
package/view-report.umd.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue-demi")) : typeof define === "function" && define.amd ? define(["exports", "vue-demi"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["view-report"] = {}, global.VueDemi));
|
|
3
|
-
})(this, (function(exports2, vueDemi) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue-demi"), require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue-demi", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["view-report"] = {}, global.VueDemi, global.Vue));
|
|
3
|
+
})(this, (function(exports2, vueDemi, vue) {
|
|
4
4
|
"use strict";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
options.staticRenderFns = staticRenderFns;
|
|
10
|
-
options._compiled = true;
|
|
5
|
+
const _export_sfc = (sfc, props) => {
|
|
6
|
+
const target = sfc.__vccOpts || sfc;
|
|
7
|
+
for (const [key, val] of props) {
|
|
8
|
+
target[key] = val;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
exports: scriptExports,
|
|
17
|
-
options
|
|
18
|
-
};
|
|
19
|
-
}
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
20
12
|
const _sfc_main$1 = vueDemi.defineComponent({
|
|
21
13
|
name: "MyButton",
|
|
22
14
|
// 必须声明 name,用于全局注册
|
|
@@ -37,23 +29,18 @@
|
|
|
37
29
|
return { handleClick };
|
|
38
30
|
}
|
|
39
31
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
false,
|
|
53
|
-
null,
|
|
54
|
-
"d19bd5c3"
|
|
55
|
-
);
|
|
56
|
-
const MyButton = __component__$1.exports;
|
|
32
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
33
|
+
return vue.openBlock(), vue.createElementBlock("button", {
|
|
34
|
+
class: "my-button",
|
|
35
|
+
style: vue.normalizeStyle({ background: _ctx.color }),
|
|
36
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
37
|
+
}, [
|
|
38
|
+
vue.renderSlot(_ctx.$slots, "default", {}, () => [
|
|
39
|
+
vue.createTextVNode(vue.toDisplayString(_ctx.text), 1)
|
|
40
|
+
], true)
|
|
41
|
+
], 4);
|
|
42
|
+
}
|
|
43
|
+
const MyButton = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-d19bd5c3"]]);
|
|
57
44
|
class DateUtils {
|
|
58
45
|
/**
|
|
59
46
|
* 格式化日期为 YYYY-MM-DD 格式
|
|
@@ -417,45 +404,162 @@
|
|
|
417
404
|
};
|
|
418
405
|
}
|
|
419
406
|
});
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return _c("div", { ref: "pickerWrapper", staticClass: "view-date-picker-wrapper" }, [_c("div", { staticClass: "native-input-wrapper" }, [_c("input", { ref: "dateInput", staticClass: "native-input", attrs: { "type": "text", "placeholder": "请选择日期", "readonly": "" }, domProps: { "value": _vm.displayDate }, on: { "input": _vm.handleInput, "click": _vm.togglePanel } }), _c("span", { staticClass: "date-icon", on: { "click": _vm.togglePanel } }, [_vm._v("📅")])]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.panelVisible, expression: "panelVisible" }], ref: "datePanel", staticClass: "date-picker-dropdown", style: _vm.panelStyle }, [_c("div", { staticClass: "date-picker-panel" }, [_c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.panelType == "date", expression: "panelType == 'date'" }], staticClass: "picker-header" }, [_c("button", { staticClass: "toggle-btn year-btn prev-year", on: { "click": _vm.switchToPrevYear } }, [_vm._v("«")]), _c("button", { staticClass: "toggle-btn month-btn prev-month", on: { "click": _vm.switchToPrevMonth } }, [_vm._v(" < ")]), _c("div", { staticClass: "current-month" }, [_c("span", { staticClass: "clickable-year", on: { "click": _vm.openYearPanel } }, [_vm._v(_vm._s(_vm.currentYear) + "年")]), _c("span", { staticClass: "clickable-month", on: { "click": _vm.openMonthPanel } }, [_vm._v(_vm._s(_vm.currentMonth) + "月")])]), _c("button", { staticClass: "toggle-btn month-btn next-month", on: { "click": _vm.switchToNextMonth } }, [_vm._v(">")]), _c("button", { staticClass: "toggle-btn year-btn next-year", on: { "click": _vm.switchToNextYear } }, [_vm._v("»")])]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.panelType == "year", expression: "panelType == 'year'" }], staticClass: "picker-header" }, [_c("button", { staticClass: "toggle-btn month-btn prev-month", on: { "click": _vm.switchToPrevTenYears } }, [_vm._v(" < ")]), _c("div", { staticClass: "current-month" }, [_c("span", { staticClass: "clickable-year" }, [_vm._v(_vm._s(_vm.getDecadeStartAndEnd) + "年")])]), _c("button", { staticClass: "toggle-btn month-btn next-month", on: { "click": _vm.switchToNextTenYears } }, [_vm._v(">")])]), _c("div", { directives: [{ name: "show", rawName: "v-show", value: _vm.panelType == "month", expression: "panelType == 'month'" }], staticClass: "picker-header" }, [_c("button", { staticClass: "toggle-btn month-btn prev-month", on: { "click": _vm.switchToPrevYear } }, [_vm._v(" < ")]), _c("div", { staticClass: "current-month" }, [_c("span", { staticClass: "clickable-year" }, [_vm._v(_vm._s(_vm.currentYear) + "年")])]), _c("button", { staticClass: "toggle-btn month-btn next-month", on: { "click": _vm.switchToNextYear } }, [_vm._v(">")])]), _vm.panelType === "date" ? _c("div", { staticClass: "bod-mb" }, [_vm._m(0), _c("div", { staticClass: "picker-panel" }, _vm._l(_vm.panelDates, function(item, index2) {
|
|
424
|
-
return _c("div", { key: index2, staticClass: "date-item", class: {
|
|
425
|
-
"not-current-month": !item.isCurrentMonth,
|
|
426
|
-
"selected": item.formatDate === _vm.displayDate,
|
|
427
|
-
"hover": _vm.hoverDate === item.formatDate && item.formatDate !== _vm.displayDate
|
|
428
|
-
}, on: { "click": function($event) {
|
|
429
|
-
return _vm.selectDate(item);
|
|
430
|
-
}, "mouseenter": function($event) {
|
|
431
|
-
_vm.hoverDate = item.formatDate;
|
|
432
|
-
}, "mouseleave": function($event) {
|
|
433
|
-
_vm.hoverDate = "";
|
|
434
|
-
} } }, [_vm._v(" " + _vm._s(item.date.getDate()) + " ")]);
|
|
435
|
-
}), 0)]) : _vm.panelType === "year" ? _c("div", { staticClass: "bod-mb" }, _vm._l(_vm.decadeYears, function(year) {
|
|
436
|
-
return _c("div", { key: year, staticClass: "year-item", class: { "selected": year === _vm.currentYear }, on: { "click": function($event) {
|
|
437
|
-
return _vm.selectDecadeYear(year);
|
|
438
|
-
} } }, [_vm._v(" " + _vm._s(year) + "年 ")]);
|
|
439
|
-
}), 0) : _vm.panelType === "month" ? _c("div", { staticClass: "bod-mb" }, _vm._l(12, function(month) {
|
|
440
|
-
return _c("div", { key: month, staticClass: "month-item", class: { "selected": month === _vm.currentMonth }, on: { "click": function($event) {
|
|
441
|
-
return _vm.selectTargetMonth(month);
|
|
442
|
-
} } }, [_vm._v(" " + _vm._s(month) + "月 ")]);
|
|
443
|
-
}), 0) : _vm._e()])])]);
|
|
407
|
+
const _hoisted_1 = {
|
|
408
|
+
class: "view-date-picker-wrapper",
|
|
409
|
+
ref: "pickerWrapper"
|
|
444
410
|
};
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
411
|
+
const _hoisted_2 = { class: "native-input-wrapper" };
|
|
412
|
+
const _hoisted_3 = ["value"];
|
|
413
|
+
const _hoisted_4 = { class: "date-picker-panel" };
|
|
414
|
+
const _hoisted_5 = { class: "picker-header" };
|
|
415
|
+
const _hoisted_6 = { class: "current-month" };
|
|
416
|
+
const _hoisted_7 = { class: "picker-header" };
|
|
417
|
+
const _hoisted_8 = { class: "current-month" };
|
|
418
|
+
const _hoisted_9 = { class: "clickable-year" };
|
|
419
|
+
const _hoisted_10 = { class: "picker-header" };
|
|
420
|
+
const _hoisted_11 = { class: "current-month" };
|
|
421
|
+
const _hoisted_12 = { class: "clickable-year" };
|
|
422
|
+
const _hoisted_13 = {
|
|
423
|
+
key: 0,
|
|
424
|
+
class: "bod-mb"
|
|
425
|
+
};
|
|
426
|
+
const _hoisted_14 = { class: "picker-panel" };
|
|
427
|
+
const _hoisted_15 = ["onClick", "onMouseenter"];
|
|
428
|
+
const _hoisted_16 = {
|
|
429
|
+
key: 1,
|
|
430
|
+
class: "bod-mb"
|
|
431
|
+
};
|
|
432
|
+
const _hoisted_17 = ["onClick"];
|
|
433
|
+
const _hoisted_18 = {
|
|
434
|
+
key: 2,
|
|
435
|
+
class: "bod-mb"
|
|
436
|
+
};
|
|
437
|
+
const _hoisted_19 = ["onClick"];
|
|
438
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
439
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
440
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
441
|
+
vue.createElementVNode("input", {
|
|
442
|
+
ref: "dateInput",
|
|
443
|
+
type: "text",
|
|
444
|
+
value: _ctx.displayDate,
|
|
445
|
+
onInput: _cache[0] || (_cache[0] = (...args) => _ctx.handleInput && _ctx.handleInput(...args)),
|
|
446
|
+
placeholder: "请选择日期",
|
|
447
|
+
readonly: "",
|
|
448
|
+
class: "native-input",
|
|
449
|
+
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.togglePanel && _ctx.togglePanel(...args))
|
|
450
|
+
}, null, 40, _hoisted_3),
|
|
451
|
+
vue.createElementVNode("span", {
|
|
452
|
+
class: "date-icon",
|
|
453
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.togglePanel && _ctx.togglePanel(...args))
|
|
454
|
+
}, "📅")
|
|
455
|
+
]),
|
|
456
|
+
vue.withDirectives(vue.createElementVNode("div", {
|
|
457
|
+
ref: "datePanel",
|
|
458
|
+
class: "date-picker-dropdown",
|
|
459
|
+
style: vue.normalizeStyle(_ctx.panelStyle)
|
|
460
|
+
}, [
|
|
461
|
+
vue.createElementVNode("div", _hoisted_4, [
|
|
462
|
+
vue.withDirectives(vue.createElementVNode("div", _hoisted_5, [
|
|
463
|
+
vue.createElementVNode("button", {
|
|
464
|
+
class: "toggle-btn year-btn prev-year",
|
|
465
|
+
onClick: _cache[3] || (_cache[3] = (...args) => _ctx.switchToPrevYear && _ctx.switchToPrevYear(...args))
|
|
466
|
+
}, "«"),
|
|
467
|
+
vue.createElementVNode("button", {
|
|
468
|
+
class: "toggle-btn month-btn prev-month",
|
|
469
|
+
onClick: _cache[4] || (_cache[4] = (...args) => _ctx.switchToPrevMonth && _ctx.switchToPrevMonth(...args))
|
|
470
|
+
}, " < "),
|
|
471
|
+
vue.createElementVNode("div", _hoisted_6, [
|
|
472
|
+
vue.createElementVNode("span", {
|
|
473
|
+
onClick: _cache[5] || (_cache[5] = (...args) => _ctx.openYearPanel && _ctx.openYearPanel(...args)),
|
|
474
|
+
class: "clickable-year"
|
|
475
|
+
}, vue.toDisplayString(_ctx.currentYear) + "年", 1),
|
|
476
|
+
vue.createElementVNode("span", {
|
|
477
|
+
onClick: _cache[6] || (_cache[6] = (...args) => _ctx.openMonthPanel && _ctx.openMonthPanel(...args)),
|
|
478
|
+
class: "clickable-month"
|
|
479
|
+
}, vue.toDisplayString(_ctx.currentMonth) + "月", 1)
|
|
480
|
+
]),
|
|
481
|
+
vue.createElementVNode("button", {
|
|
482
|
+
class: "toggle-btn month-btn next-month",
|
|
483
|
+
onClick: _cache[7] || (_cache[7] = (...args) => _ctx.switchToNextMonth && _ctx.switchToNextMonth(...args))
|
|
484
|
+
}, ">"),
|
|
485
|
+
vue.createElementVNode("button", {
|
|
486
|
+
class: "toggle-btn year-btn next-year",
|
|
487
|
+
onClick: _cache[8] || (_cache[8] = (...args) => _ctx.switchToNextYear && _ctx.switchToNextYear(...args))
|
|
488
|
+
}, "»")
|
|
489
|
+
], 512), [
|
|
490
|
+
[vue.vShow, _ctx.panelType == "date"]
|
|
491
|
+
]),
|
|
492
|
+
vue.withDirectives(vue.createElementVNode("div", _hoisted_7, [
|
|
493
|
+
vue.createElementVNode("button", {
|
|
494
|
+
class: "toggle-btn month-btn prev-month",
|
|
495
|
+
onClick: _cache[9] || (_cache[9] = (...args) => _ctx.switchToPrevTenYears && _ctx.switchToPrevTenYears(...args))
|
|
496
|
+
}, " < "),
|
|
497
|
+
vue.createElementVNode("div", _hoisted_8, [
|
|
498
|
+
vue.createElementVNode("span", _hoisted_9, vue.toDisplayString(_ctx.getDecadeStartAndEnd) + "年", 1)
|
|
499
|
+
]),
|
|
500
|
+
vue.createElementVNode("button", {
|
|
501
|
+
class: "toggle-btn month-btn next-month",
|
|
502
|
+
onClick: _cache[10] || (_cache[10] = (...args) => _ctx.switchToNextTenYears && _ctx.switchToNextTenYears(...args))
|
|
503
|
+
}, ">")
|
|
504
|
+
], 512), [
|
|
505
|
+
[vue.vShow, _ctx.panelType == "year"]
|
|
506
|
+
]),
|
|
507
|
+
vue.withDirectives(vue.createElementVNode("div", _hoisted_10, [
|
|
508
|
+
vue.createElementVNode("button", {
|
|
509
|
+
class: "toggle-btn month-btn prev-month",
|
|
510
|
+
onClick: _cache[11] || (_cache[11] = (...args) => _ctx.switchToPrevYear && _ctx.switchToPrevYear(...args))
|
|
511
|
+
}, " < "),
|
|
512
|
+
vue.createElementVNode("div", _hoisted_11, [
|
|
513
|
+
vue.createElementVNode("span", _hoisted_12, vue.toDisplayString(_ctx.currentYear) + "年", 1)
|
|
514
|
+
]),
|
|
515
|
+
vue.createElementVNode("button", {
|
|
516
|
+
class: "toggle-btn month-btn next-month",
|
|
517
|
+
onClick: _cache[12] || (_cache[12] = (...args) => _ctx.switchToNextYear && _ctx.switchToNextYear(...args))
|
|
518
|
+
}, ">")
|
|
519
|
+
], 512), [
|
|
520
|
+
[vue.vShow, _ctx.panelType == "month"]
|
|
521
|
+
]),
|
|
522
|
+
_ctx.panelType === "date" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13, [
|
|
523
|
+
_cache[14] || (_cache[14] = vue.createStaticVNode('<div class="picker-week-header" data-v-e6885493><div class="week-item" data-v-e6885493>日</div><div class="week-item" data-v-e6885493>一</div><div class="week-item" data-v-e6885493>二</div><div class="week-item" data-v-e6885493>三</div><div class="week-item" data-v-e6885493>四</div><div class="week-item" data-v-e6885493>五</div><div class="week-item" data-v-e6885493>六</div></div>', 1)),
|
|
524
|
+
vue.createElementVNode("div", _hoisted_14, [
|
|
525
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.panelDates, (item, index2) => {
|
|
526
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
527
|
+
class: vue.normalizeClass(["date-item", {
|
|
528
|
+
"not-current-month": !item.isCurrentMonth,
|
|
529
|
+
"selected": item.formatDate === _ctx.displayDate,
|
|
530
|
+
"hover": _ctx.hoverDate === item.formatDate && item.formatDate !== _ctx.displayDate
|
|
531
|
+
}]),
|
|
532
|
+
key: index2,
|
|
533
|
+
onClick: ($event) => _ctx.selectDate(item),
|
|
534
|
+
onMouseenter: ($event) => _ctx.hoverDate = item.formatDate,
|
|
535
|
+
onMouseleave: _cache[13] || (_cache[13] = ($event) => _ctx.hoverDate = "")
|
|
536
|
+
}, vue.toDisplayString(item.date.getDate()), 43, _hoisted_15);
|
|
537
|
+
}), 128))
|
|
538
|
+
])
|
|
539
|
+
])) : _ctx.panelType === "year" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_16, [
|
|
540
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.decadeYears, (year) => {
|
|
541
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
542
|
+
class: vue.normalizeClass(["year-item", { "selected": year === _ctx.currentYear }]),
|
|
543
|
+
key: year,
|
|
544
|
+
onClick: ($event) => _ctx.selectDecadeYear(year)
|
|
545
|
+
}, vue.toDisplayString(year) + "年 ", 11, _hoisted_17);
|
|
546
|
+
}), 128))
|
|
547
|
+
])) : _ctx.panelType === "month" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_18, [
|
|
548
|
+
(vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(12, (month) => {
|
|
549
|
+
return vue.createElementVNode("div", {
|
|
550
|
+
class: vue.normalizeClass(["month-item", { "selected": month === _ctx.currentMonth }]),
|
|
551
|
+
key: month,
|
|
552
|
+
onClick: ($event) => _ctx.selectTargetMonth(month)
|
|
553
|
+
}, vue.toDisplayString(month) + "月 ", 11, _hoisted_19);
|
|
554
|
+
}), 64))
|
|
555
|
+
])) : vue.createCommentVNode("", true)
|
|
556
|
+
])
|
|
557
|
+
], 4), [
|
|
558
|
+
[vue.vShow, _ctx.panelVisible]
|
|
559
|
+
])
|
|
560
|
+
], 512);
|
|
561
|
+
}
|
|
562
|
+
const ViewDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e6885493"]]);
|
|
459
563
|
const components = [MyButton, ViewDatePicker];
|
|
460
564
|
const install = (app) => {
|
|
461
565
|
components.forEach((component) => {
|