x-next 1.18.0 → 1.18.1
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/AI_USAGE/catalog.md +1 -1
- package/AI_USAGE/components/alert-api.md +1 -1
- package/AI_USAGE/components/alert.md +1 -1
- package/AI_USAGE/components/bar-chart-api.md +1 -1
- package/AI_USAGE/components/bar-chart.md +1 -1
- package/AI_USAGE/components/boxicons.md +1 -1
- package/AI_USAGE/components/button-api.md +1 -1
- package/AI_USAGE/components/button.md +4 -4
- package/AI_USAGE/components/charts.md +1 -1
- package/AI_USAGE/components/checkbox-api.md +1 -1
- package/AI_USAGE/components/checkbox.md +1 -1
- package/AI_USAGE/components/color-picker-api.md +1 -1
- package/AI_USAGE/components/color-picker.md +1 -1
- package/AI_USAGE/components/config-provider-api.md +1 -1
- package/AI_USAGE/components/config-provider.md +1 -1
- package/AI_USAGE/components/date-picker-api.md +44 -26
- package/AI_USAGE/components/date-picker.md +78 -3
- package/AI_USAGE/components/dialog-api.md +2 -2
- package/AI_USAGE/components/dialog.md +5 -1
- package/AI_USAGE/components/draggable-api.md +1 -1
- package/AI_USAGE/components/draggable.md +1 -1
- package/AI_USAGE/components/drawer-api.md +1 -1
- package/AI_USAGE/components/drawer.md +1 -1
- package/AI_USAGE/components/dropdown-api.md +6 -1
- package/AI_USAGE/components/dropdown.md +2 -2
- package/AI_USAGE/components/empty-api.md +1 -1
- package/AI_USAGE/components/empty.md +1 -1
- package/AI_USAGE/components/finicon.md +1 -1
- package/AI_USAGE/components/form-api.md +1 -1
- package/AI_USAGE/components/form.md +1 -1
- package/AI_USAGE/components/grid-api.md +1 -1
- package/AI_USAGE/components/grid.md +1 -1
- package/AI_USAGE/components/heatmap-api.md +1 -1
- package/AI_USAGE/components/heatmap.md +1 -1
- package/AI_USAGE/components/icon-api.md +1 -1
- package/AI_USAGE/components/icon.md +1 -1
- package/AI_USAGE/components/image-api.md +1 -1
- package/AI_USAGE/components/image.md +1 -1
- package/AI_USAGE/components/input-api.md +1 -1
- package/AI_USAGE/components/input-number-api.md +1 -1
- package/AI_USAGE/components/input-number.md +1 -1
- package/AI_USAGE/components/input-tag-api.md +1 -1
- package/AI_USAGE/components/input-tag.md +1 -1
- package/AI_USAGE/components/input.md +1 -1
- package/AI_USAGE/components/layout-api.md +1 -1
- package/AI_USAGE/components/layout.md +1 -1
- package/AI_USAGE/components/line-chart-api.md +1 -1
- package/AI_USAGE/components/line-chart.md +1 -1
- package/AI_USAGE/components/link-api.md +1 -1
- package/AI_USAGE/components/link.md +1 -1
- package/AI_USAGE/components/menu-api.md +1 -1
- package/AI_USAGE/components/menu.md +1 -1
- package/AI_USAGE/components/message-api.md +1 -1
- package/AI_USAGE/components/message-box-api.md +1 -1
- package/AI_USAGE/components/message-box.md +1 -1
- package/AI_USAGE/components/message.md +1 -1
- package/AI_USAGE/components/network-api.md +1 -1
- package/AI_USAGE/components/network.md +1 -1
- package/AI_USAGE/components/notification-api.md +1 -1
- package/AI_USAGE/components/notification.md +1 -1
- package/AI_USAGE/components/pagination-api.md +1 -1
- package/AI_USAGE/components/pagination.md +1 -1
- package/AI_USAGE/components/pie-chart-api.md +1 -1
- package/AI_USAGE/components/pie-chart.md +1 -1
- package/AI_USAGE/components/popconfirm-api.md +1 -1
- package/AI_USAGE/components/popconfirm.md +1 -1
- package/AI_USAGE/components/popover-api.md +1 -1
- package/AI_USAGE/components/popover.md +3 -1
- package/AI_USAGE/components/popup-api.md +1 -1
- package/AI_USAGE/components/popup.md +1 -1
- package/AI_USAGE/components/progress-api.md +1 -1
- package/AI_USAGE/components/progress.md +1 -1
- package/AI_USAGE/components/radio-api.md +1 -1
- package/AI_USAGE/components/radio.md +1 -1
- package/AI_USAGE/components/rate-api.md +1 -1
- package/AI_USAGE/components/rate.md +1 -1
- package/AI_USAGE/components/resize-box-api.md +1 -1
- package/AI_USAGE/components/resize-box.md +1 -1
- package/AI_USAGE/components/scrollbar-api.md +1 -1
- package/AI_USAGE/components/scrollbar.md +1 -1
- package/AI_USAGE/components/select-api.md +1 -1
- package/AI_USAGE/components/select.md +1 -1
- package/AI_USAGE/components/skeleton-api.md +1 -1
- package/AI_USAGE/components/skeleton.md +1 -1
- package/AI_USAGE/components/slider-api.md +1 -1
- package/AI_USAGE/components/slider.md +1 -1
- package/AI_USAGE/components/space-api.md +1 -1
- package/AI_USAGE/components/space.md +1 -1
- package/AI_USAGE/components/spin-api.md +1 -1
- package/AI_USAGE/components/spin.md +1 -1
- package/AI_USAGE/components/steps-api.md +1 -1
- package/AI_USAGE/components/steps.md +1 -1
- package/AI_USAGE/components/switch-api.md +1 -1
- package/AI_USAGE/components/switch.md +1 -1
- package/AI_USAGE/components/table-api.md +1 -1
- package/AI_USAGE/components/table.md +1 -1
- package/AI_USAGE/components/tabs-api.md +1 -1
- package/AI_USAGE/components/tabs.md +1 -1
- package/AI_USAGE/components/tag-api.md +1 -1
- package/AI_USAGE/components/tag.md +1 -1
- package/AI_USAGE/components/textarea-api.md +1 -1
- package/AI_USAGE/components/textarea.md +1 -1
- package/AI_USAGE/components/time-picker-api.md +1 -1
- package/AI_USAGE/components/time-picker.md +1 -1
- package/AI_USAGE/components/time-range-selector-api.md +1 -1
- package/AI_USAGE/components/time-range-selector.md +1 -1
- package/AI_USAGE/components/timeline-api.md +1 -1
- package/AI_USAGE/components/timeline.md +1 -1
- package/AI_USAGE/components/tooltip-api.md +1 -1
- package/AI_USAGE/components/tooltip.md +1 -1
- package/AI_USAGE/components/transfer-api.md +1 -1
- package/AI_USAGE/components/transfer.md +1 -1
- package/AI_USAGE/components/tree-select-api.md +1 -1
- package/AI_USAGE/components/tree-select.md +1 -1
- package/AI_USAGE/components/trend-chart-api.md +1 -1
- package/AI_USAGE/components/trend-chart.md +1 -1
- package/AI_USAGE/components/trigger-api.md +1 -1
- package/AI_USAGE/components/trigger.md +1 -1
- package/AI_USAGE/components/upload-api.md +1 -1
- package/AI_USAGE/components/upload.md +1 -1
- package/AI_USAGE/components/watermark-api.md +1 -1
- package/AI_USAGE/components/watermark.md +1 -1
- package/AI_USAGE/core.md +1 -1
- package/AI_USAGE/index.md +1 -1
- package/AI_USAGE/recipes/form-on-demand.md +1 -1
- package/AI_USAGE.md +138 -34
- package/CHANGELOG.md +16 -0
- package/dist/_container/render-function.d.ts +2 -2
- package/dist/components/_components/picker/input-range.vue.d.ts +1 -1
- package/dist/components/date-picker/DatePanel.vue.d.ts +10 -1
- package/dist/components/date-picker/DatePicker.vue.d.ts +22 -10
- package/dist/components/date-picker/index.d.ts +156 -54
- package/dist/components/date-picker/utils.d.ts +4 -4
- package/dist/components/dropdown/Dropdown.vue.d.ts +1 -0
- package/dist/components/dropdown/DropdownButton.vue.d.ts +1 -0
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +1 -0
- package/dist/components/dropdown/context.d.ts +1 -0
- package/dist/components/dropdown/index.d.ts +8 -0
- package/dist/components/dropdown/use-keyboard.d.ts +1 -0
- package/dist/components/menu/MenuItem.d.ts +2 -2
- package/dist/components/menu/context.d.ts +3 -3
- package/dist/components/menu/index.d.ts +6 -6
- package/dist/components/menu/sub-menu-pop.vue.d.ts +2 -2
- package/dist/components/time-picker/TimePicker.vue.d.ts +1 -1
- package/dist/components/time-picker/index.d.ts +2 -2
- package/dist/es/components/_components/picker/input-range.vue.js +12 -12
- package/dist/es/components/_components/picker/input-range.vue2.js +45 -45
- package/dist/es/components/_components/picker/input.vue2.js +24 -24
- package/dist/es/components/date-picker/DatePanel.vue.js +47 -47
- package/dist/es/components/date-picker/DatePanel.vue2.js +68 -59
- package/dist/es/components/date-picker/DatePicker.vue.js +65 -59
- package/dist/es/components/date-picker/DatePicker.vue2.js +387 -284
- package/dist/es/components/date-picker/index.js +57 -36
- package/dist/es/components/date-picker/utils.js +132 -122
- package/dist/es/components/dialog/Dialog.js +43 -40
- package/dist/es/components/dialog/props.js +1 -1
- package/dist/es/components/dropdown/Dropdown.vue2.js +66 -50
- package/dist/es/components/dropdown/dropdown-panel.vue2.js +48 -43
- package/dist/es/components/dropdown/use-keyboard.js +36 -28
- package/dist/es/components/popover/Popover.js +72 -32
- package/dist/es/style.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.umd.js +3 -3
- package/dist/style/button.css +1 -1
- package/dist/style/date-picker.css +1 -1
- package/dist/style/dialog.css +1 -1
- package/dist/style/message-box.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -1
|
@@ -1,57 +1,78 @@
|
|
|
1
1
|
import n from "./DatePicker.vue.js";
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { generateComponent as
|
|
4
|
-
import { getComponentPrefix as
|
|
5
|
-
import { getRangePickerType as
|
|
6
|
-
import { inheritComponentType as
|
|
7
|
-
const R =
|
|
8
|
-
name:
|
|
2
|
+
import { defineComponent as k, h as s } from "vue";
|
|
3
|
+
import { generateComponent as t } from "../../_utils/vue-eco.js";
|
|
4
|
+
import { getComponentPrefix as i } from "../../_utils/config.js";
|
|
5
|
+
import { getRangePickerType as f } from "./utils.js";
|
|
6
|
+
import { inheritComponentType as a } from "../../_utils/inherit-component-type.js";
|
|
7
|
+
const R = t(i("DatePicker"), n), o = (e, c) => a(k({
|
|
8
|
+
name: e,
|
|
9
9
|
inheritAttrs: !1,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
methods: {
|
|
11
|
+
focus() {
|
|
12
|
+
var r;
|
|
13
|
+
(r = this.$refs.picker) == null || r.focus();
|
|
14
|
+
},
|
|
15
|
+
blur() {
|
|
16
|
+
var r;
|
|
17
|
+
(r = this.$refs.picker) == null || r.blur();
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
setup(r, { attrs: p, slots: m }) {
|
|
21
|
+
return () => s(n, { ...p, type: c, ref: "picker" }, m);
|
|
12
22
|
}
|
|
13
|
-
})),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
),
|
|
23
|
+
})), b = t(
|
|
24
|
+
i("MonthPicker"),
|
|
25
|
+
o("MonthPicker", "month")
|
|
26
|
+
), C = t(
|
|
27
|
+
i("YearPicker"),
|
|
28
|
+
o("YearPicker", "year")
|
|
29
|
+
), $ = t(
|
|
30
|
+
i("QuarterPicker"),
|
|
31
|
+
o("QuarterPicker", "quarter")
|
|
32
|
+
), D = t(
|
|
33
|
+
i("WeekPicker"),
|
|
34
|
+
o("WeekPicker", "week")
|
|
35
|
+
), P = k({
|
|
26
36
|
name: "RangePicker",
|
|
27
37
|
inheritAttrs: !1,
|
|
28
38
|
props: {
|
|
29
39
|
mode: {
|
|
30
40
|
type: String,
|
|
31
41
|
default: "date",
|
|
32
|
-
validator: (
|
|
42
|
+
validator: (e) => ["date", "month", "year", "quarter", "week"].includes(e)
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
focus() {
|
|
47
|
+
var e;
|
|
48
|
+
(e = this.$refs.picker) == null || e.focus();
|
|
49
|
+
},
|
|
50
|
+
blur() {
|
|
51
|
+
var e;
|
|
52
|
+
(e = this.$refs.picker) == null || e.blur();
|
|
33
53
|
}
|
|
34
54
|
},
|
|
35
|
-
setup(
|
|
36
|
-
return () =>
|
|
55
|
+
setup(e, { attrs: c, slots: r }) {
|
|
56
|
+
return () => s(
|
|
37
57
|
n,
|
|
38
58
|
{
|
|
39
|
-
...
|
|
40
|
-
|
|
59
|
+
...c,
|
|
60
|
+
ref: "picker",
|
|
61
|
+
type: f(e.mode)
|
|
41
62
|
},
|
|
42
|
-
|
|
63
|
+
r
|
|
43
64
|
);
|
|
44
65
|
}
|
|
45
|
-
}),
|
|
46
|
-
|
|
47
|
-
P
|
|
66
|
+
}), M = t(
|
|
67
|
+
i("RangePicker"),
|
|
68
|
+
a(P)
|
|
48
69
|
);
|
|
49
70
|
export {
|
|
50
71
|
R as DatePicker,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
72
|
+
b as MonthPicker,
|
|
73
|
+
$ as QuarterPicker,
|
|
74
|
+
M as RangePicker,
|
|
75
|
+
D as WeekPicker,
|
|
76
|
+
C as YearPicker,
|
|
56
77
|
R as default
|
|
57
78
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { dayjs as
|
|
2
|
-
import { isArray as
|
|
3
|
-
import { formatMessage as
|
|
4
|
-
import { getLunarInfo as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { dayjs as C, getDayjsValue as K } from "../../_utils/date.js";
|
|
2
|
+
import { isArray as p } from "../../_utils/is.js";
|
|
3
|
+
import { formatMessage as U } from "../../locale/index.js";
|
|
4
|
+
import { getLunarInfo as X } from "./lunar/index.js";
|
|
5
|
+
import B from "../../locale/zh-CN.js";
|
|
6
|
+
const Z = {
|
|
7
7
|
date: "date",
|
|
8
8
|
month: "month",
|
|
9
9
|
year: "year",
|
|
@@ -14,110 +14,113 @@ const K = {
|
|
|
14
14
|
"year-range": "year",
|
|
15
15
|
"quarter-range": "quarter",
|
|
16
16
|
"week-range": "week"
|
|
17
|
-
},
|
|
17
|
+
}, W = /* @__PURE__ */ new Set([
|
|
18
18
|
"date-range",
|
|
19
19
|
"month-range",
|
|
20
20
|
"year-range",
|
|
21
21
|
"quarter-range",
|
|
22
22
|
"week-range"
|
|
23
|
-
]),
|
|
23
|
+
]), v = {
|
|
24
24
|
date: "date-range",
|
|
25
25
|
month: "month-range",
|
|
26
26
|
year: "year-range",
|
|
27
27
|
quarter: "quarter-range",
|
|
28
28
|
week: "week-range"
|
|
29
|
-
},
|
|
29
|
+
}, F = {
|
|
30
30
|
date: "YYYY-MM-DD",
|
|
31
31
|
month: "YYYY-MM",
|
|
32
32
|
year: "YYYY",
|
|
33
33
|
quarter: "YYYY-[Q]Q",
|
|
34
34
|
week: "YYYY-wo"
|
|
35
|
-
},
|
|
36
|
-
var
|
|
35
|
+
}, ge = (e) => Z[e] ?? "date", de = (e) => W.has(e), we = (e, t = !1) => e === "date" && t ? "YYYY-MM-DD HH:mm:ss" : F[e], Ye = (e = "date") => v[e] ?? "date-range", z = (e) => e === "quarter" ? "quarter" : e === "week" ? "week" : e, H = (e, t, r = 0) => {
|
|
36
|
+
var a, f;
|
|
37
37
|
if (e == null || e === "") return;
|
|
38
|
-
if (typeof e == "string" &&
|
|
39
|
-
const
|
|
40
|
-
return (
|
|
38
|
+
if (typeof e == "string" && _(t)) {
|
|
39
|
+
const u = G(e, r);
|
|
40
|
+
return (a = u == null ? void 0 : u.isValid) != null && a.call(u) ? u : void 0;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
43
|
-
return (
|
|
44
|
-
},
|
|
42
|
+
const n = K(e, t);
|
|
43
|
+
return (f = n == null ? void 0 : n.isValid) != null && f.call(n) ? n : void 0;
|
|
44
|
+
}, ee = (e, t, r, n = 0) => {
|
|
45
45
|
if (r) {
|
|
46
|
-
const
|
|
47
|
-
return [
|
|
46
|
+
const a = p(e) ? e : [];
|
|
47
|
+
return [
|
|
48
|
+
H(a[0], t, n),
|
|
49
|
+
H(a[1], t, n)
|
|
50
|
+
];
|
|
48
51
|
}
|
|
49
|
-
return
|
|
50
|
-
},
|
|
52
|
+
return p(e) ? void 0 : H(e, t, n);
|
|
53
|
+
}, O = (e, t, r) => {
|
|
51
54
|
if (e)
|
|
52
|
-
return r === "timestamp" ? e.valueOf() : r === "Date" ? e.toDate() :
|
|
53
|
-
},
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
},
|
|
55
|
+
return r === "timestamp" ? e.valueOf() : r === "Date" ? e.toDate() : _(r || t) ? oe(e, r || t) : e.format(r || t);
|
|
56
|
+
}, me = (e, t, r) => p(e) ? e.map((n) => O(n, t, r)) : O(e, t, r), ke = (e) => p(e) ? e.map((t) => t == null ? void 0 : t.toDate()) : e == null ? void 0 : e.toDate(), le = (e, t, r, n = !1) => {
|
|
57
|
+
const a = z(r), f = (u, m) => !u && !m ? !0 : !u || !m ? !1 : n ? u.valueOf() === m.valueOf() : u.isSame(m, a);
|
|
58
|
+
return p(e) && p(t) ? f(e[0], t[0]) && f(e[1], t[1]) : !p(e) && !p(t) ? f(e, t) : !1;
|
|
59
|
+
}, te = (e) => {
|
|
57
60
|
const [t, r] = e;
|
|
58
61
|
return t && r && t.isAfter(r) ? [r, t] : [t, r];
|
|
59
|
-
},
|
|
62
|
+
}, A = (e, t, r = 0) => {
|
|
60
63
|
if (t === "week") {
|
|
61
|
-
const
|
|
62
|
-
return e.subtract(
|
|
64
|
+
const a = (e.day() - r + 7) % 7;
|
|
65
|
+
return e.subtract(a, "day").startOf("day");
|
|
63
66
|
}
|
|
64
|
-
const n =
|
|
67
|
+
const n = z(t);
|
|
65
68
|
return e.startOf(n);
|
|
66
|
-
}, ye = (e, t, r) => {
|
|
67
|
-
const
|
|
68
|
-
return
|
|
69
|
-
},
|
|
69
|
+
}, ye = (e, t, r, n = 0) => {
|
|
70
|
+
const a = typeof e.value == "function" ? e.value() : e.value, f = e.format || t;
|
|
71
|
+
return ee(a, f, r, n);
|
|
72
|
+
}, he = (e, t) => {
|
|
70
73
|
if (t === "year") {
|
|
71
74
|
const r = Math.floor(e.year() / 12) * 12;
|
|
72
75
|
return `${r} - ${r + 11}`;
|
|
73
76
|
}
|
|
74
77
|
return t === "date" || t === "week" ? e.format("YYYY-MM") : e.format("YYYY");
|
|
75
|
-
},
|
|
78
|
+
}, Q = (e, t = B.datePicker) => U(t.weekLabel, { week: e.week() }), re = (e, t, r = B.datePicker) => t === "quarter" ? e.format("YYYY [Q]Q") : t === "week" ? `${e.format("YYYY-MM-DD")} ${Q(e, r)}` : e.format(F[t]), Me = ({
|
|
76
79
|
mode: e,
|
|
77
80
|
viewDate: t,
|
|
78
81
|
selectedValue: r,
|
|
79
82
|
rangeValue: n,
|
|
80
|
-
previewRangeValue:
|
|
81
|
-
dayStartOfWeek:
|
|
82
|
-
hideNotInViewDates:
|
|
83
|
-
disabledDate:
|
|
84
|
-
showLunar:
|
|
85
|
-
locale:
|
|
83
|
+
previewRangeValue: a,
|
|
84
|
+
dayStartOfWeek: f,
|
|
85
|
+
hideNotInViewDates: u,
|
|
86
|
+
disabledDate: m,
|
|
87
|
+
showLunar: s,
|
|
88
|
+
locale: d = B.datePicker
|
|
86
89
|
}) => {
|
|
87
|
-
const
|
|
88
|
-
const
|
|
90
|
+
const i = z(e), P = C(), k = r && A(r, e, f), N = (w) => te(w).map((g) => g && A(g, e, f)), [l, y] = N(n ?? []), [h, M] = N(a ?? []), b = (w, g = !0) => {
|
|
91
|
+
const Y = A(w, e, f), L = !g, c = g, D = c && !!(k != null && k.isSame(Y, i)), R = c && !!(l != null && l.isSame(Y, i)), o = c && !!(y != null && y.isSame(Y, i)), S = !!(c && l && y && Y.isAfter(l, i) && Y.isBefore(y, i)), V = c && !!(h != null && h.isSame(Y, i)), q = c && !!(M != null && M.isSame(Y, i)), T = !!(c && h && M && Y.isAfter(h, i) && Y.isBefore(M, i));
|
|
89
92
|
return {
|
|
90
|
-
value:
|
|
91
|
-
label:
|
|
92
|
-
title:
|
|
93
|
-
inView:
|
|
94
|
-
outView:
|
|
95
|
-
selected:
|
|
96
|
-
rangeStart:
|
|
97
|
-
rangeEnd:
|
|
98
|
-
inRange:
|
|
99
|
-
previewRangeStart:
|
|
100
|
-
previewRangeEnd:
|
|
101
|
-
inPreviewRange:
|
|
102
|
-
today:
|
|
103
|
-
disabled: !!(
|
|
104
|
-
lunar: e === "date" ?
|
|
93
|
+
value: w,
|
|
94
|
+
label: ne(w, e, d),
|
|
95
|
+
title: re(w, e, d),
|
|
96
|
+
inView: u ? g : !0,
|
|
97
|
+
outView: L,
|
|
98
|
+
selected: D,
|
|
99
|
+
rangeStart: R,
|
|
100
|
+
rangeEnd: o,
|
|
101
|
+
inRange: S,
|
|
102
|
+
previewRangeStart: V,
|
|
103
|
+
previewRangeEnd: q,
|
|
104
|
+
inPreviewRange: T,
|
|
105
|
+
today: P.isSame(Y, i),
|
|
106
|
+
disabled: !!(m != null && m(Y.toDate())),
|
|
107
|
+
lunar: e === "date" ? X(w, s) : void 0
|
|
105
108
|
};
|
|
106
109
|
};
|
|
107
110
|
if (e === "date" || e === "week") {
|
|
108
|
-
const
|
|
109
|
-
const
|
|
111
|
+
const w = t.startOf("month"), g = (w.day() - f + 7) % 7, Y = w.subtract(g, "day"), L = Array.from({ length: 42 }, (c, D) => {
|
|
112
|
+
const R = Y.add(D, "day"), o = b(R, R.month() === t.month());
|
|
110
113
|
if (e === "week") {
|
|
111
|
-
const
|
|
112
|
-
|
|
114
|
+
const S = D % 7 === 0, V = A(R, e, f), q = o.inView, T = q && !!(k != null && k.isSame(V, i)), E = q && !!(l != null && l.isSame(V, i)), j = q && !!(y != null && y.isSame(V, i)), x = q && !!(h != null && h.isSame(V, i)), I = q && !!(M != null && M.isSame(V, i)), $ = T || E || j;
|
|
115
|
+
o.selected = $, o.rangeStart = E && S, o.rangeEnd = j && S, o.previewRangeStart = x && S, o.previewRangeEnd = I && S, o.inRange = $ || o.inRange, o.inPreviewRange = x || I || o.inPreviewRange, o.today = P.isSame(R, "day"), o.weekStart = S, o.weekEnd = D % 7 === 6, o.weekSelected = $, o.weekLabel = S ? Q(R, d) : void 0;
|
|
113
116
|
}
|
|
114
|
-
return
|
|
117
|
+
return o;
|
|
115
118
|
});
|
|
116
|
-
return e === "week" ?
|
|
119
|
+
return e === "week" ? L.flatMap((c, D) => D % 7 !== 0 ? [c] : [
|
|
117
120
|
{
|
|
118
|
-
...
|
|
119
|
-
label:
|
|
120
|
-
title:
|
|
121
|
+
...c,
|
|
122
|
+
label: c.weekLabel || Q(c.value, d),
|
|
123
|
+
title: c.weekLabel || Q(c.value, d),
|
|
121
124
|
isWeekLabel: !0,
|
|
122
125
|
selected: !1,
|
|
123
126
|
rangeStart: !1,
|
|
@@ -126,75 +129,82 @@ const K = {
|
|
|
126
129
|
previewRangeEnd: !1,
|
|
127
130
|
today: !1,
|
|
128
131
|
disabled: !0,
|
|
129
|
-
weekSelected:
|
|
132
|
+
weekSelected: c.weekSelected
|
|
130
133
|
},
|
|
131
|
-
|
|
132
|
-
]) :
|
|
134
|
+
c
|
|
135
|
+
]) : L;
|
|
133
136
|
}
|
|
134
137
|
if (e === "month")
|
|
135
|
-
return Array.from({ length: 12 }, (
|
|
138
|
+
return Array.from({ length: 12 }, (w, g) => b(t.month(g), !0));
|
|
136
139
|
if (e === "quarter")
|
|
137
|
-
return Array.from({ length: 4 }, (
|
|
138
|
-
const
|
|
139
|
-
return Array.from({ length: 12 }, (
|
|
140
|
-
},
|
|
140
|
+
return Array.from({ length: 4 }, (w, g) => b(t.quarter(g + 1), !0));
|
|
141
|
+
const J = Math.floor(t.year() / 12) * 12;
|
|
142
|
+
return Array.from({ length: 12 }, (w, g) => b(t.year(J + g), !0));
|
|
143
|
+
}, ne = (e, t, r = B.datePicker) => t === "date" || t === "week" ? String(e.date()) : t === "month" ? U(r.monthLabel, {
|
|
141
144
|
month: e.format("M"),
|
|
142
145
|
monthName: e.format("MMM")
|
|
143
|
-
}) : t === "quarter" ? `Q${e.quarter()}` : e.format("YYYY"),
|
|
144
|
-
const r =
|
|
145
|
-
return Array.from({ length: 7 }, (n,
|
|
146
|
-
},
|
|
147
|
-
const n = e ||
|
|
146
|
+
}) : t === "quarter" ? `Q${e.quarter()}` : e.format("YYYY"), ae = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"], Se = (e, t = B.datePicker) => {
|
|
147
|
+
const r = ae.map((n) => t.weekdays[n]);
|
|
148
|
+
return Array.from({ length: 7 }, (n, a) => r[(a + e) % 7]);
|
|
149
|
+
}, pe = (e, t, r, n = !1) => t === "date" || t === "week" ? e.add(r, n ? "year" : "month") : t === "month" || t === "quarter" ? e.add(r, "year") : e.add(r * 12, "year"), De = (e, t, r = 1) => {
|
|
150
|
+
const n = e || C();
|
|
148
151
|
return t === "date" || t === "week" ? n.add(r, "month") : t === "month" || t === "quarter" ? n.add(r, "year") : n.add(r * 12, "year");
|
|
149
|
-
}, Re = (e, t) => {
|
|
150
|
-
var
|
|
152
|
+
}, Re = (e, t, r = 0) => {
|
|
153
|
+
var u, m;
|
|
151
154
|
if (!e) return;
|
|
152
|
-
if (
|
|
153
|
-
const
|
|
154
|
-
return (
|
|
155
|
+
if (_(t)) {
|
|
156
|
+
const s = G(e, r);
|
|
157
|
+
return (u = s == null ? void 0 : s.isValid) != null && u.call(s) ? s : void 0;
|
|
155
158
|
}
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
159
|
+
const n = e.trim();
|
|
160
|
+
if ((m = t.match(/\[[^\]]*]|Q/g)) != null && m.includes("Q")) {
|
|
161
|
+
const s = H(n, t);
|
|
162
|
+
return (s == null ? void 0 : s.format(t)) === n ? s : void 0;
|
|
163
|
+
}
|
|
164
|
+
const f = (t.match(/\[[^\]]*]|MMMM|MMM|DDDD|DDD|MM|DD|HH|hh|mm|ss|./g) ?? []).reduce((s, d) => {
|
|
165
|
+
const i = ["MM", "DD", "HH", "hh", "mm", "ss"].includes(d) ? [d, d[0]] : [d];
|
|
166
|
+
return s.flatMap((P) => i.map((k) => P + k));
|
|
167
|
+
}, [""]);
|
|
168
|
+
for (const s of f) {
|
|
169
|
+
const d = C(n, s, !0);
|
|
170
|
+
if (d.isValid()) return d;
|
|
171
|
+
}
|
|
172
|
+
}, _ = (e) => /w|W/.test(e), G = (e, t = 0) => {
|
|
173
|
+
const r = /^(\d{4})\D+(\d{1,2})(?:st|nd|rd|th|周)?$/i.exec(e.trim());
|
|
174
|
+
if (!r) return;
|
|
175
|
+
const n = Number(r[1]), a = Number(r[2]);
|
|
176
|
+
if (!(a < 1 || a > 53))
|
|
177
|
+
return C().year(n).week(a).startOf("week").add(t, "day");
|
|
178
|
+
}, oe = (e, t) => {
|
|
169
179
|
const r = e.format("wo");
|
|
170
180
|
return t.includes("gggg") ? t.replace("gggg", String(e.weekYear())).replace("wo", r).replace("w", String(e.week())) : t.replace("YYYY", String(e.weekYear())).replace("wo", r).replace("w", String(e.week()));
|
|
171
181
|
};
|
|
172
182
|
export {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
Me as createDateCells,
|
|
184
|
+
F as defaultFormatMap,
|
|
185
|
+
O as formatDateValue,
|
|
186
|
+
me as formatPanelValue,
|
|
187
|
+
ne as getCellLabel,
|
|
188
|
+
re as getCellTitle,
|
|
189
|
+
ge as getDatePickerMode,
|
|
190
|
+
ke as getDateValueFromPanel,
|
|
191
|
+
we as getDefaultFormat,
|
|
192
|
+
he as getHeaderLabel,
|
|
193
|
+
z as getModeUnit,
|
|
194
|
+
Ye as getRangePickerType,
|
|
195
|
+
De as getRangeViewDate,
|
|
186
196
|
ye as getShortcutValue,
|
|
187
|
-
|
|
188
|
-
|
|
197
|
+
te as getSortedRange,
|
|
198
|
+
Q as getWeekLabel,
|
|
189
199
|
Se as getWeekdayLabels,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
200
|
+
de as isRangeType,
|
|
201
|
+
le as isSameDateValue,
|
|
202
|
+
Z as modeMap,
|
|
203
|
+
pe as moveViewDate,
|
|
204
|
+
A as normalizePanelValue,
|
|
205
|
+
ee as parseDateModelValue,
|
|
206
|
+
H as parseDateValue,
|
|
197
207
|
Re as parseInputValue,
|
|
198
|
-
|
|
199
|
-
|
|
208
|
+
v as rangeTypeMap,
|
|
209
|
+
W as rangeTypes
|
|
200
210
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as oe, computed as s, ref as C, onBeforeUnmount as le, watch as P, createVNode as
|
|
1
|
+
import { defineComponent as oe, computed as s, ref as C, onBeforeUnmount as le, watch as P, createVNode as o, Teleport as ne, withDirectives as ae, mergeProps as ie, Transition as L, vShow as se } from "vue";
|
|
2
2
|
import { useLocale as de } from "../../locale/index.js";
|
|
3
3
|
import { getComponentPrefix as re, getClassNameMixin as S } from "../../_utils/config.js";
|
|
4
4
|
import { addUnit as _ } from "../../_utils/helpers.js";
|
|
@@ -10,13 +10,14 @@ import { useDialogFocus as be } from "../../_hooks/use-dialog-focus.js";
|
|
|
10
10
|
import { usePopupTheme as ge } from "../../_hooks/use-popup-theme.js";
|
|
11
11
|
import { KEYBOARD_KEY as ve } from "../../_utils/keyboard.js";
|
|
12
12
|
import { getElement as ye, on as he, off as Ce } from "../../_utils/dom.js";
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
import we from "../../icons/default/close.js";
|
|
14
|
+
import { dialogProps as xe } from "./props.js";
|
|
15
|
+
const ke = ["width", "minWidth", "height", "minHeight"];
|
|
16
|
+
let Te = 0;
|
|
17
|
+
const Me = /* @__PURE__ */ oe({
|
|
17
18
|
name: re("Dialog"),
|
|
18
19
|
inheritAttrs: !1,
|
|
19
|
-
props:
|
|
20
|
+
props: xe,
|
|
20
21
|
slots: Object,
|
|
21
22
|
emits: ["closed", "close", "open", "opened", "update:modelValue"],
|
|
22
23
|
setup(e, {
|
|
@@ -27,28 +28,28 @@ const Ie = /* @__PURE__ */ oe({
|
|
|
27
28
|
const i = S("dialog"), {
|
|
28
29
|
t: V
|
|
29
30
|
} = de(), A = i.block, {
|
|
30
|
-
popupThemeStyle:
|
|
31
|
-
popupThemeName:
|
|
32
|
-
} = ge(), c = S("message-box"), m = `x-dialog-title-${++
|
|
31
|
+
popupThemeStyle: I,
|
|
32
|
+
popupThemeName: N
|
|
33
|
+
} = ge(), c = S("message-box"), m = `x-dialog-title-${++Te}`, R = () => [A, e.messageBox && "is-message-box", e.messageBox && c.block, e.popupClass && e.popupClass, d.class], j = () => {
|
|
33
34
|
const {
|
|
34
35
|
class: t,
|
|
35
|
-
style:
|
|
36
|
+
style: l,
|
|
36
37
|
id: O,
|
|
37
|
-
"aria-label":
|
|
38
|
-
"aria-labelledby":
|
|
39
|
-
"aria-describedby":
|
|
38
|
+
"aria-label": Be,
|
|
39
|
+
"aria-labelledby": De,
|
|
40
|
+
"aria-describedby": Ee,
|
|
40
41
|
...te
|
|
41
42
|
} = d;
|
|
42
43
|
return te;
|
|
43
44
|
}, f = s(() => {
|
|
44
45
|
if (!(typeof document > "u"))
|
|
45
46
|
return ye(e.renderTo) || document.body;
|
|
46
|
-
}), b = C(), w = C(),
|
|
47
|
+
}), b = C(), w = C(), z = s(() => e.disabled || !f.value), F = s(() => [I.value, {
|
|
47
48
|
zIndex: U.value
|
|
48
|
-
}, d.style]),
|
|
49
|
+
}, d.style]), M = s(() => {
|
|
49
50
|
const t = {};
|
|
50
|
-
return e.fullscreen || (!e.center && e.top && (t.top = _(e.top)),
|
|
51
|
-
e[
|
|
51
|
+
return e.fullscreen || (!e.center && e.top && (t.top = _(e.top)), ke.forEach((l) => {
|
|
52
|
+
e[l] && (t[l] = _(e[l]));
|
|
52
53
|
})), t;
|
|
53
54
|
}), g = C(!1), n = s(() => e.modelValue), x = s(() => n.value || g.value), G = s(() => !e.destroyOnClosed || x.value), H = s(() => x.value), {
|
|
54
55
|
zIndex: U,
|
|
@@ -59,8 +60,8 @@ const Ie = /* @__PURE__ */ oe({
|
|
|
59
60
|
}), {
|
|
60
61
|
setOverflowHidden: q,
|
|
61
62
|
resetOverflow: T
|
|
62
|
-
} = me(f, b), W = (t,
|
|
63
|
-
r("update:modelValue", !1), r("close", t,
|
|
63
|
+
} = me(f, b), W = (t, l) => {
|
|
64
|
+
r("update:modelValue", !1), r("close", t, l);
|
|
64
65
|
};
|
|
65
66
|
let v = !1;
|
|
66
67
|
const {
|
|
@@ -76,8 +77,8 @@ const Ie = /* @__PURE__ */ oe({
|
|
|
76
77
|
requestClose: u
|
|
77
78
|
} = fe(n, (t) => {
|
|
78
79
|
if (!ce(e.onBeforeCancel)) return !0;
|
|
79
|
-
const
|
|
80
|
-
return
|
|
80
|
+
const l = e.onBeforeCancel(t);
|
|
81
|
+
return l && typeof l == "object" && "then" in l ? Promise.resolve(l).then((O) => !!O) : !!l;
|
|
81
82
|
}, W), Z = () => {
|
|
82
83
|
e.maskToClose && e.mask && u("cancel");
|
|
83
84
|
}, p = (t) => {
|
|
@@ -101,40 +102,40 @@ const Ie = /* @__PURE__ */ oe({
|
|
|
101
102
|
immediate: !0
|
|
102
103
|
}), P(() => e.escToClose, (t) => {
|
|
103
104
|
n.value && (t ? K() : h());
|
|
104
|
-
}), () =>
|
|
105
|
+
}), () => o(ne, {
|
|
105
106
|
to: f.value,
|
|
106
|
-
disabled:
|
|
107
|
+
disabled: z.value
|
|
107
108
|
}, {
|
|
108
|
-
default: () => [G.value && ae(
|
|
109
|
+
default: () => [G.value && ae(o("div", ie({
|
|
109
110
|
ref: b,
|
|
110
|
-
"data-theme":
|
|
111
|
-
class:
|
|
112
|
-
style:
|
|
111
|
+
"data-theme": N.value,
|
|
112
|
+
class: R(),
|
|
113
|
+
style: F.value,
|
|
113
114
|
id: d.id
|
|
114
|
-
},
|
|
115
|
+
}, j()), [o(L, {
|
|
115
116
|
name: "x-fade-in-standard",
|
|
116
117
|
appear: !0
|
|
117
118
|
}, {
|
|
118
|
-
default: () => [e.mask && n.value &&
|
|
119
|
+
default: () => [e.mask && n.value && o("div", {
|
|
119
120
|
class: i.element("mask")
|
|
120
121
|
}, null)]
|
|
121
|
-
}),
|
|
122
|
+
}), o("div", {
|
|
122
123
|
class: [i.element("wrapper"), {
|
|
123
124
|
"is-center": e.center
|
|
124
125
|
}],
|
|
125
126
|
onClick: (t) => t.target === t.currentTarget && Z()
|
|
126
|
-
}, [
|
|
127
|
+
}, [o(L, {
|
|
127
128
|
name: "x-zoom-in",
|
|
128
129
|
appear: !0,
|
|
129
130
|
onAfterEnter: X,
|
|
130
131
|
onAfterLeave: Q
|
|
131
132
|
}, {
|
|
132
|
-
default: () => [n.value &&
|
|
133
|
+
default: () => [n.value && o("div", {
|
|
133
134
|
ref: w,
|
|
134
135
|
class: [i.element("container"), {
|
|
135
136
|
"is-fullscreen": e.fullscreen
|
|
136
137
|
}],
|
|
137
|
-
style:
|
|
138
|
+
style: M.value,
|
|
138
139
|
role: "dialog",
|
|
139
140
|
"aria-modal": e.mask ? "true" : void 0,
|
|
140
141
|
"aria-label": e.title || a.title ? void 0 : d["aria-label"],
|
|
@@ -142,33 +143,35 @@ const Ie = /* @__PURE__ */ oe({
|
|
|
142
143
|
"aria-describedby": d["aria-describedby"],
|
|
143
144
|
tabindex: -1,
|
|
144
145
|
onKeydown: J
|
|
145
|
-
}, [
|
|
146
|
+
}, [o("div", {
|
|
146
147
|
class: [e.messageBox ? c.element("header") : i.element("header"), e.showHeaderBottomLine && "is-bottom-line"],
|
|
147
148
|
id: a.title ? m : void 0
|
|
148
|
-
}, [a.title ? a.title() :
|
|
149
|
+
}, [a.title ? a.title() : o("div", {
|
|
149
150
|
id: e.title ? m : void 0,
|
|
150
151
|
class: [i.element("header-title")]
|
|
151
|
-
}, [e.title])]),
|
|
152
|
+
}, [e.title])]), o("div", {
|
|
152
153
|
class: [e.messageBox ? c.element("body") : i.element("body")]
|
|
153
|
-
}, [a.default && a.default()]), !e.hideFooter && a.footer &&
|
|
154
|
+
}, [a.default && a.default()]), !e.hideFooter && a.footer && o("div", {
|
|
154
155
|
class: [e.messageBox ? c.element("footer") : i.element("footer")]
|
|
155
156
|
}, [a.footer({
|
|
156
157
|
cancel: p,
|
|
157
158
|
ok: ee,
|
|
158
159
|
loadingObj: D,
|
|
159
160
|
"loading-obj": D
|
|
160
|
-
})]), e.showClose &&
|
|
161
|
+
})]), e.showClose && o("button", {
|
|
161
162
|
type: "button",
|
|
162
163
|
class: [i.element("close-icon"), e.messageBox && c.element("close-icon")],
|
|
163
164
|
"aria-label": V("common.closeTarget", {
|
|
164
165
|
target: "对话框"
|
|
165
166
|
}),
|
|
166
167
|
onClick: (t) => u("cancel", t)
|
|
167
|
-
},
|
|
168
|
+
}, [o(we, {
|
|
169
|
+
size: "18px"
|
|
170
|
+
}, null)])])]
|
|
168
171
|
})])]), [[se, H.value]])]
|
|
169
172
|
});
|
|
170
173
|
}
|
|
171
174
|
});
|
|
172
175
|
export {
|
|
173
|
-
|
|
176
|
+
Me as default
|
|
174
177
|
};
|