@blueking/date-picker 2.0.0-beta.8 → 3.0.0-beta.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/README.md +15 -10
- package/package.json +14 -81
- package/typings/components/baseline-select.vue.d.ts +12 -0
- package/typings/components/common-submit.vue.d.ts +10 -19
- package/typings/components/common-tab.vue.d.ts +10 -14
- package/typings/components/date-list.vue.d.ts +15 -0
- package/typings/components/date-panel.vue.d.ts +9 -28
- package/typings/components/date-picker.vue.d.ts +8 -15
- package/typings/components/date-title.vue.d.ts +6 -0
- package/typings/components/natural-picker.vue.d.ts +6 -13
- package/typings/components/panel-wrapper.vue.d.ts +12 -21
- package/typings/components/recent-picker.vue.d.ts +10 -28
- package/typings/components/timezone-picker.vue.d.ts +14 -19
- package/typings/date-picker.vue.d.ts +21 -44
- package/typings/hooks/use-keydown-enter.d.ts +1 -0
- package/typings/hooks/use-validate.d.ts +17 -0
- package/typings/lang/lang.d.ts +14 -4
- package/typings/utils/constant.d.ts +8 -5
- package/typings/utils/cookie.d.ts +4 -0
- package/typings/utils/date.d.ts +38 -15
- package/typings/utils/duration.d.ts +5 -0
- package/typings/utils/index.d.ts +4 -3
- package/typings/utils/provider.d.ts +20 -0
- package/typings/utils/store.d.ts +1 -1
- package/typings/utils/timezone.d.ts +4 -4
- package/typings/utils/types.d.ts +22 -14
- package/typings/vue2.d.ts +20 -2
- package/typings/vue3.d.ts +7 -2
- package/vue2/config.json +1 -1
- package/vue2/index.es.min.js +25195 -18806
- package/vue2/index.iife.min.js +36661 -76
- package/vue2/index.umd.min.js +29072 -57
- package/vue2/vue2.css +3520 -1
- package/vue3/config.json +1 -1
- package/vue3/index.es.min.js +2957 -1717
- package/vue3/index.iife.min.js +29559 -57
- package/vue3/index.umd.min.js +4551 -2
- package/vue3/vue3.css +796 -1
- package/typings/utils/utils.d.ts +0 -15
package/vue3/index.es.min.js
CHANGED
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import { default as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import { Tab
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import "
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import dayjs from "dayjs";
|
|
5
|
+
import { default as default2 } from "dayjs";
|
|
6
|
+
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
7
|
+
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
8
|
+
import tz from "dayjs/plugin/timezone";
|
|
9
|
+
import utc from "dayjs/plugin/utc";
|
|
10
|
+
import { defineComponent, useAttrs, useSlots, openBlock, createBlock, resolveDynamicComponent, h, renderSlot, effectScope, getCurrentScope, onScopeDispose, provide, inject, createElementBlock, createVNode, unref, withCtx, Fragment, renderList, ref, customRef, normalizeClass, toDisplayString, createElementVNode, createTextVNode, createCommentVNode, shallowRef, watch, withModifiers, computed, onActivated, normalizeStyle, withDirectives, withKeys, onMounted, vShow, nextTick, KeepAlive, onBeforeUnmount } from "vue";
|
|
11
|
+
import { Select, Tab, Exception, $bkPopover, Popover, Button, Checkbox, clickoutside, PopConfirm, Input, provideGlobalConfig } from "bkui-vue";
|
|
12
|
+
import { AngleDoubleLeft, AngleLeft, AngleRight, AngleDoubleRight, Close, Transfer, Del } from "bkui-vue/lib/icon";
|
|
13
|
+
import en from "dayjs/locale/en";
|
|
14
|
+
import cn from "dayjs/locale/zh-cn";
|
|
15
|
+
const getCookieByName = (name) => {
|
|
16
|
+
const match = document.cookie.match(new RegExp(`(^| )${name}=([^;]*)(;|$)`));
|
|
17
|
+
if (match) {
|
|
18
|
+
return match[2];
|
|
19
|
+
}
|
|
20
|
+
return "";
|
|
21
|
+
};
|
|
22
|
+
const naturalDateLangData = {
|
|
23
|
+
"N 天前": "N days ago",
|
|
21
24
|
上周: "Last week",
|
|
22
25
|
上月: "Last month",
|
|
23
26
|
今天: "Today",
|
|
24
27
|
今年: "This year",
|
|
28
|
+
具体时间: "Specific time",
|
|
25
29
|
"前 N 周": "Previous N weeks",
|
|
26
30
|
"前 N 天": "Previous N days",
|
|
27
31
|
前天: "The day before yesterday",
|
|
28
32
|
前年: "The year before last",
|
|
29
33
|
去年: "Last year",
|
|
34
|
+
基于: "Based on",
|
|
35
|
+
天前: "days ago",
|
|
30
36
|
昨天: "Yesterday",
|
|
31
37
|
本周: "This week",
|
|
32
38
|
本月: "This month"
|
|
33
|
-
}
|
|
39
|
+
};
|
|
40
|
+
const timeUnitLangData = {
|
|
34
41
|
分钟: "minute",
|
|
35
42
|
周: "week",
|
|
36
43
|
天: "day",
|
|
@@ -39,7 +46,8 @@ const De = (l) => {
|
|
|
39
46
|
月: "month",
|
|
40
47
|
毫秒: "millisecond",
|
|
41
48
|
秒: "second"
|
|
42
|
-
}
|
|
49
|
+
};
|
|
50
|
+
const shortTimeUnitLangData = {
|
|
43
51
|
M: "月",
|
|
44
52
|
d: "天",
|
|
45
53
|
h: "小时",
|
|
@@ -48,7 +56,8 @@ const De = (l) => {
|
|
|
48
56
|
s: "秒",
|
|
49
57
|
w: "周",
|
|
50
58
|
y: "年"
|
|
51
|
-
}
|
|
59
|
+
};
|
|
60
|
+
const langData = {
|
|
52
61
|
前: "Previous",
|
|
53
62
|
取消: "Cancel",
|
|
54
63
|
将来: "Future",
|
|
@@ -73,6 +82,7 @@ const De = (l) => {
|
|
|
73
82
|
格式: "Format",
|
|
74
83
|
此刻: "now",
|
|
75
84
|
浏览器时区: "Browser timezone",
|
|
85
|
+
的最近: "Last",
|
|
76
86
|
确定: "Confirm",
|
|
77
87
|
示例: "Example",
|
|
78
88
|
结束时间: "End Time",
|
|
@@ -80,205 +90,29 @@ const De = (l) => {
|
|
|
80
90
|
至今: "so far",
|
|
81
91
|
请输入: "Please enter",
|
|
82
92
|
"请输入搜索(国家,城市,简称)": "Please enter search (country, city, abbreviation)",
|
|
93
|
+
超出可选范围: "Out of range",
|
|
83
94
|
近: "Last",
|
|
84
|
-
"(至今)": " so far"
|
|
95
|
+
"(至今)": " so far",
|
|
96
|
+
",无法选择": ", cannot be selected",
|
|
97
|
+
时间范围不能小于: "Time range cannot be less than",
|
|
98
|
+
时间范围不能大于: "Time range cannot be greater than",
|
|
99
|
+
时间格式转换: "Time format conversion"
|
|
85
100
|
};
|
|
86
|
-
Object.keys(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
id: "s",
|
|
92
|
-
name: r("秒")
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: "m",
|
|
96
|
-
name: r("分钟")
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
id: "h",
|
|
100
|
-
name: r("小时")
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: "d",
|
|
104
|
-
name: r("天")
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
id: "w",
|
|
108
|
-
name: r("周")
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
id: "M",
|
|
112
|
-
name: r("月")
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: "y",
|
|
116
|
-
name: r("年")
|
|
117
|
-
}
|
|
118
|
-
], ua = Xa.map((l) => l.id).join("");
|
|
119
|
-
var ia = /* @__PURE__ */ ((l) => (l.custom = "custom", l.default = "default", l.edit = "edit", l))(ia || {});
|
|
120
|
-
const xa = [
|
|
121
|
-
{
|
|
122
|
-
id: "now/d",
|
|
123
|
-
name: r("今天"),
|
|
124
|
-
type: "default"
|
|
125
|
-
/* default */
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
id: "now-1d/d",
|
|
129
|
-
name: r("昨天"),
|
|
130
|
-
type: "default"
|
|
131
|
-
/* default */
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
id: "now-2d/d",
|
|
135
|
-
name: r("前天"),
|
|
136
|
-
type: "default"
|
|
137
|
-
/* default */
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
id: "now/w",
|
|
141
|
-
name: r("本周"),
|
|
142
|
-
type: "default"
|
|
143
|
-
/* default */
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
id: "now-1w/w",
|
|
147
|
-
name: r("上周"),
|
|
148
|
-
type: "default"
|
|
149
|
-
/* default */
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
id: "now/M",
|
|
153
|
-
name: r("本月"),
|
|
154
|
-
type: "default"
|
|
155
|
-
/* default */
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
id: "now-1M/M",
|
|
159
|
-
name: r("上月"),
|
|
160
|
-
type: "default"
|
|
161
|
-
/* default */
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
id: "now-nd/d",
|
|
165
|
-
name: r("前 N 天"),
|
|
166
|
-
prefix: r("前"),
|
|
167
|
-
suffix: r("天"),
|
|
168
|
-
type: "edit",
|
|
169
|
-
unit: "d"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
id: "now-nw/w",
|
|
173
|
-
name: r("前 N 周"),
|
|
174
|
-
prefix: r("前"),
|
|
175
|
-
suffix: r("周"),
|
|
176
|
-
type: "edit",
|
|
177
|
-
unit: "w"
|
|
178
|
-
}
|
|
179
|
-
];
|
|
180
|
-
var ba = /* @__PURE__ */ ((l) => (l.ALL = "all", l.NOW = "now", l))(ba || {});
|
|
181
|
-
const Ra = [
|
|
182
|
-
{
|
|
183
|
-
id: "all",
|
|
184
|
-
name: r("整")
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
id: "now",
|
|
188
|
-
name: r("至今")
|
|
189
|
-
}
|
|
190
|
-
], Ee = [
|
|
191
|
-
{
|
|
192
|
-
id: "common",
|
|
193
|
-
name: r("常用时间")
|
|
101
|
+
Object.keys(langData).reduce(
|
|
102
|
+
(pre, cur) => {
|
|
103
|
+
pre[langData[cur]] = cur;
|
|
104
|
+
return pre;
|
|
194
105
|
},
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
id: I.FUTURE,
|
|
206
|
-
name: r("未来")
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
id: I.NATURAL,
|
|
210
|
-
name: r("自然日期")
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
id: I.Date,
|
|
214
|
-
name: r("日期选择")
|
|
215
|
-
}
|
|
216
|
-
], Ce = "BK_DATE_PICKER_STORE", Pe = "BK_DATE_PICKER_STORE_TAB", Te = "blueking_timezone", Ia = (l = 1) => `${Ce}_${l}`, La = (l = 1) => `${Pe}_${l}`, Ve = [
|
|
217
|
-
"YYYY-MM-DD HH:mm:ss",
|
|
218
|
-
"YYYY-MM-DD HH:mm:ss,SSS",
|
|
219
|
-
"YYYY-MM-DD HH:mm:ss.SSS",
|
|
220
|
-
"YYYY-MM-DD+HH:mm:ss",
|
|
221
|
-
"MM/DD/YYYY HH:mm:ss",
|
|
222
|
-
"YYYYMMDDHHmmss",
|
|
223
|
-
"YYYYMMDD HHmmss",
|
|
224
|
-
"YYYYMMDD HHmmss.SSS",
|
|
225
|
-
"DD/MMM/YYYY:HH:mm:ss",
|
|
226
|
-
"DD/MMM/YYYY:HH:mm:ssZ",
|
|
227
|
-
"DD/MMM/YYYY:HH:mm:ss Z",
|
|
228
|
-
"DD/MMM/YYYY:HH:mm:ssZZ",
|
|
229
|
-
"DD/MMM/YYYY:HH:mm:ss ZZ",
|
|
230
|
-
"YYYY-MM-DDTHH:mm:ss",
|
|
231
|
-
"YYYY-MM-DDTHH:mm:ss.SSS",
|
|
232
|
-
"YYYYMMDDTHHmmssZ",
|
|
233
|
-
"YYYYMMDDTHHmmss.SSSSSSZ",
|
|
234
|
-
"YYYY-MM-DDTHH:mm:ss.SSSZ",
|
|
235
|
-
"YYYY-MM-DDTHH:mm:ssZ",
|
|
236
|
-
"YYYY-MM-DDTHH:mm:ss.SSSSSSZ"
|
|
237
|
-
], Ne = {
|
|
238
|
-
"now/M~now/M": r("本月"),
|
|
239
|
-
"now/d~now/d": r("今天"),
|
|
240
|
-
"now/w~now/w": r("本周"),
|
|
241
|
-
"now/y~now/y": r("今年"),
|
|
242
|
-
"now-1M/M~now-1M/M": r("上月"),
|
|
243
|
-
"now-1d/d~now-1d/d": r("昨天"),
|
|
244
|
-
"now-1w/w~now-1w/w": r("上周"),
|
|
245
|
-
"now-1y/y~now-1y/y": r("去年"),
|
|
246
|
-
"now-2d/d~now-2d/d": r("前天"),
|
|
247
|
-
"now-2y/y~now-2y/y": r("前年")
|
|
248
|
-
}, ka = [
|
|
249
|
-
["now-5m", "now"],
|
|
250
|
-
["now-15m", "now"],
|
|
251
|
-
["now-30m", "now"],
|
|
252
|
-
["now-1h", "now"],
|
|
253
|
-
["now-6h", "now"],
|
|
254
|
-
["now-12h", "now"],
|
|
255
|
-
["now-24h", "now"],
|
|
256
|
-
["now-7d", "now"],
|
|
257
|
-
["now-30d", "now"],
|
|
258
|
-
["now/d", "now/d"],
|
|
259
|
-
["now/d", "now"],
|
|
260
|
-
["now-1d/d", "now-1d/d"],
|
|
261
|
-
["now-2d/d", "now-2d/d"],
|
|
262
|
-
["now/w", "now/w"],
|
|
263
|
-
["now/w", "now"],
|
|
264
|
-
["now-1w/w", "now-1w/w"],
|
|
265
|
-
["now/M", "now/M"],
|
|
266
|
-
["now/M", "now"],
|
|
267
|
-
["now-1M/M", "now-1M/M"],
|
|
268
|
-
["now-1M/M", "now"]
|
|
269
|
-
], C = "now", $e = /^(\d{4})[-/](\d+)[-/](\d+)[Tt\s]*(\d+)?:(\d+)?:(\d+)?[.:]?(\d*)$/, Xt = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, ae = Symbol("DATE_PICKER_PROVIDER_KEY"), je = (l) => {
|
|
270
|
-
oe(ae, l);
|
|
271
|
-
}, ee = () => de(ae);
|
|
272
|
-
d.extend(Fa);
|
|
273
|
-
d.extend(qa);
|
|
274
|
-
const Ye = [
|
|
275
|
-
// {
|
|
276
|
-
// label: '',
|
|
277
|
-
// options: [
|
|
278
|
-
// { label: 'Browser Time', searchIndex: 'browser time|cst|utc+08:00|china|cn', value: 'browser' },
|
|
279
|
-
// // { label: 'Coordinated Universal Time', searchIndex: 'coordinated universal time|utc, gmt|utc', value: 'utc' },
|
|
280
|
-
// ],
|
|
281
|
-
// },
|
|
106
|
+
{}
|
|
107
|
+
);
|
|
108
|
+
const lang = getCookieByName("blueking_language") || "zh-cn";
|
|
109
|
+
const t = (key) => {
|
|
110
|
+
if (lang !== "en") return shortTimeUnitLangData[key] || key;
|
|
111
|
+
return shortTimeUnitLangData[key] || timeUnitLangData[key] || naturalDateLangData[key] || langData[key] || key;
|
|
112
|
+
};
|
|
113
|
+
dayjs.extend(utc);
|
|
114
|
+
dayjs.extend(tz);
|
|
115
|
+
const timezoneData = [
|
|
282
116
|
{
|
|
283
117
|
label: "Africa",
|
|
284
118
|
options: [
|
|
@@ -1115,7 +949,7 @@ const Ye = [
|
|
|
1115
949
|
searchIndex: "asia/srednekolymsk||utc+11:00|russian federation|ru",
|
|
1116
950
|
value: "Asia/Srednekolymsk"
|
|
1117
951
|
},
|
|
1118
|
-
{ label: "Asia/Taipei", searchIndex: "asia/taipei|cst|utc+08:00|
|
|
952
|
+
{ label: "Asia/Taipei", searchIndex: "asia/taipei|cst|utc+08:00|china|cn", value: "Asia/Taipei" },
|
|
1119
953
|
{ label: "Asia/Tashkent", searchIndex: "asia/tashkent||utc+05:00|uzbekistan|uz", value: "Asia/Tashkent" },
|
|
1120
954
|
{ label: "Asia/Tbilisi", searchIndex: "asia/tbilisi||utc+04:00|georgia|ge", value: "Asia/Tbilisi" },
|
|
1121
955
|
{
|
|
@@ -1614,315 +1448,1079 @@ const Ye = [
|
|
|
1614
1448
|
}
|
|
1615
1449
|
]
|
|
1616
1450
|
}
|
|
1617
|
-
]
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1451
|
+
];
|
|
1452
|
+
const getTimezoneDetails = () => {
|
|
1453
|
+
const browserTimeZone = dayjs.tz.guess();
|
|
1454
|
+
const defaultTimezoneList = [];
|
|
1455
|
+
const list = timezoneData.map((group) => {
|
|
1456
|
+
return {
|
|
1457
|
+
label: group.label,
|
|
1458
|
+
options: group.options.map((option) => {
|
|
1459
|
+
const info = {
|
|
1460
|
+
...option,
|
|
1461
|
+
...getTimezoneInfo(option.searchIndex)
|
|
1462
|
+
};
|
|
1463
|
+
if (option.value === browserTimeZone) {
|
|
1464
|
+
defaultTimezoneList.push({
|
|
1465
|
+
...option,
|
|
1466
|
+
...info,
|
|
1467
|
+
label: info.label
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
return info;
|
|
1471
|
+
})
|
|
1472
|
+
};
|
|
1473
|
+
});
|
|
1474
|
+
list.unshift({
|
|
1633
1475
|
label: "",
|
|
1634
|
-
options:
|
|
1635
|
-
})
|
|
1636
|
-
|
|
1637
|
-
|
|
1476
|
+
options: defaultTimezoneList
|
|
1477
|
+
});
|
|
1478
|
+
return list;
|
|
1479
|
+
};
|
|
1480
|
+
const getTimezoneInfo = (searchIndex) => {
|
|
1481
|
+
const list = searchIndex.split("|");
|
|
1638
1482
|
return {
|
|
1639
|
-
abbreviation:
|
|
1640
|
-
country: (
|
|
1641
|
-
countryCode:
|
|
1642
|
-
utc:
|
|
1483
|
+
abbreviation: list[1].toLocaleUpperCase(),
|
|
1484
|
+
country: (list[3] || "").replace(/(\b\w)/g, (v) => v.toLocaleUpperCase()),
|
|
1485
|
+
countryCode: list[4] || "",
|
|
1486
|
+
utc: list[2].toLocaleUpperCase()
|
|
1643
1487
|
};
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
break;
|
|
1672
|
-
case I.NATURAL:
|
|
1673
|
-
a = this.endDate.diff(this.startDate);
|
|
1674
|
-
const n = 24 * 60 * 60 * 1e3;
|
|
1675
|
-
a % n === n - 1 && (a += 1);
|
|
1676
|
-
break;
|
|
1677
|
-
default:
|
|
1678
|
-
case I.Date:
|
|
1679
|
-
a = this.endDate.diff(this.startDate);
|
|
1680
|
-
break;
|
|
1681
|
-
}
|
|
1682
|
-
const e = a % i;
|
|
1683
|
-
return e === i - 1 ? a += 1 : e === i - 1e3 && (a += 1e3), a;
|
|
1684
|
-
}
|
|
1685
|
-
toDisplayString() {
|
|
1686
|
-
var b, h, m;
|
|
1687
|
-
if (!this.startDate || !this.endDate || !this.isValidate)
|
|
1688
|
-
return ((b = this.dateValue) == null ? void 0 : b.join(" ~ ")) || "";
|
|
1689
|
-
if (this.dateMode === I.RECENT)
|
|
1690
|
-
return `${r("近")} ${Math.abs(this.startNum)} ${r(
|
|
1691
|
-
la[this.startUnit]
|
|
1692
|
-
)}`;
|
|
1693
|
-
if (this.dateMode === I.FUTURE)
|
|
1694
|
-
return `${r("未来")} ${Math.abs(this.endNum)} ${r(
|
|
1695
|
-
la[this.endUnit]
|
|
1696
|
-
)}`;
|
|
1697
|
-
const [a, i] = this.dateValue;
|
|
1698
|
-
if (this.dateMode === I.NATURAL) {
|
|
1699
|
-
const c = i !== C ? "" : r("(至今)"), s = xa.find((o) => o.id === a);
|
|
1700
|
-
return s ? r(s.name) + c : `${`${r("前")} ${this.startNum} ${r(
|
|
1701
|
-
la[this.startUnit]
|
|
1702
|
-
)}`}${c}`;
|
|
1703
|
-
}
|
|
1704
|
-
let e = this.format;
|
|
1705
|
-
if (a === C)
|
|
1706
|
-
return `${r("此刻")} ~ ${(h = this.endDate) == null ? void 0 : h.format(this.format)}`;
|
|
1707
|
-
if (i === C)
|
|
1708
|
-
return `${(m = this.startDate) == null ? void 0 : m.format(this.format)} ~ ${r("此刻")}`;
|
|
1709
|
-
const n = ["Y", "M", "D", "H", "m", "s"].reduce(
|
|
1710
|
-
(c, s, o, y) => (o < 1 || (this.format.indexOf(s) > this.format.indexOf(y[o - 1]) ? c.push(s) : c = []), c),
|
|
1711
|
-
["Y"]
|
|
1712
|
-
);
|
|
1713
|
-
if (n.length > 1 && n.includes("D") && this.startDate.isSame(this.endDate, "year")) {
|
|
1714
|
-
const [, c] = this.format.match(/(Y+)/) || [];
|
|
1715
|
-
let s = this.format.replace(c, this.startDate.format(c));
|
|
1716
|
-
if (e = e.replace(/Y+[^\w\s]*/, ""), this.startDate.isSame(this.endDate, "day") && this.startDate.isSame(this.endDate, "month")) {
|
|
1717
|
-
const [, y] = this.format.match(/(M+)/) || [];
|
|
1718
|
-
if (s = s.replace(y, this.startDate.format(y)), e = e.replace(/M+[^\w\s]*/, ""), this.startDate.isSame(this.endDate, "day")) {
|
|
1719
|
-
const [, S] = this.format.match(/(d+|D+)/) || [];
|
|
1720
|
-
s = s.replace(S, this.startDate.format(S)), e = e.replace(/(d|D)+[^\w\s]*/, "");
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
const o = s.replace(e, "").slice(-1);
|
|
1724
|
-
return s.length <= e.length ? `${this.startDate.format(this.format)} ~ ${this.endDate.format(this.format)}` : s.replace(
|
|
1725
|
-
`${o.match(/([^\w\s]{1})/) ? o : ""}${e}`,
|
|
1726
|
-
` ( ${this.startDate.format(e)} ~ ${this.endDate.format(e)} )`
|
|
1727
|
-
);
|
|
1728
|
-
}
|
|
1729
|
-
return `${this.startDate.format(this.format)} ~ ${this.endDate.format(this.format)}`;
|
|
1730
|
-
}
|
|
1731
|
-
toEmitValue() {
|
|
1732
|
-
var a, i, e, n;
|
|
1733
|
-
return [
|
|
1734
|
-
this.dateMode === I.Date ? [
|
|
1735
|
-
this.dateValue[0] === C ? C : (a = this.startDate) == null ? void 0 : a.valueOf(),
|
|
1736
|
-
this.dateValue[1] === C ? C : (i = this.endDate) == null ? void 0 : i.valueOf()
|
|
1737
|
-
] : [...this.dateValue],
|
|
1738
|
-
[
|
|
1488
|
+
};
|
|
1489
|
+
const timezoneDetails = getTimezoneDetails();
|
|
1490
|
+
const getTimezoneInfoByValue = (value) => {
|
|
1491
|
+
return timezoneDetails.reduce((pre, group) => {
|
|
1492
|
+
if ((pre == null ? void 0 : pre.label) === value) return pre;
|
|
1493
|
+
return group.options.find((option) => option.label === value);
|
|
1494
|
+
}, void 0);
|
|
1495
|
+
};
|
|
1496
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
1497
|
+
...{
|
|
1498
|
+
name: "TimezonePicker",
|
|
1499
|
+
inheritAttrs: false
|
|
1500
|
+
},
|
|
1501
|
+
__name: "timezone-picker",
|
|
1502
|
+
props: {
|
|
1503
|
+
timezoneOptions: { default: () => timezoneDetails },
|
|
1504
|
+
value: {}
|
|
1505
|
+
},
|
|
1506
|
+
emits: ["update:value"],
|
|
1507
|
+
setup(__props, { emit: __emit }) {
|
|
1508
|
+
const emits = __emit;
|
|
1509
|
+
const $attrs = useAttrs();
|
|
1510
|
+
const props = __props;
|
|
1511
|
+
const slots = useSlots();
|
|
1512
|
+
const TimezonePicker = () => {
|
|
1513
|
+
return h(
|
|
1514
|
+
Select,
|
|
1739
1515
|
{
|
|
1740
|
-
|
|
1741
|
-
|
|
1516
|
+
class: $attrs.class + " bk-timezone-picker",
|
|
1517
|
+
clearable: $attrs.clearable ?? false,
|
|
1518
|
+
filterOption: handleSearch,
|
|
1519
|
+
filterable: true,
|
|
1520
|
+
inputSearch: false,
|
|
1521
|
+
modelValue: props.value,
|
|
1522
|
+
noMatchText: t("无匹配数据"),
|
|
1523
|
+
placeholder: t("请输入搜索(国家,城市,简称)"),
|
|
1524
|
+
popoverOptions: {
|
|
1525
|
+
"ext-cls": "__bk-date-picker-popover__ __bk-timezone-picker-popover__ ",
|
|
1526
|
+
minWidth: 1600
|
|
1527
|
+
},
|
|
1528
|
+
searchPlaceholder: t("请输入搜索(国家,城市,简称)"),
|
|
1529
|
+
onChange: handleChange,
|
|
1530
|
+
...$attrs
|
|
1742
1531
|
},
|
|
1743
1532
|
{
|
|
1744
|
-
|
|
1745
|
-
|
|
1533
|
+
default: () => [
|
|
1534
|
+
renderSlot(slots, "default", { options: props.timezoneOptions }, () => {
|
|
1535
|
+
return props.timezoneOptions.map((group) => {
|
|
1536
|
+
if (group.label.length < 1) {
|
|
1537
|
+
return group.options.map((item) => {
|
|
1538
|
+
return renderSlot(slots, "option", { option: item }, () => [
|
|
1539
|
+
h(
|
|
1540
|
+
Select.Option,
|
|
1541
|
+
{
|
|
1542
|
+
...item,
|
|
1543
|
+
id: item.label,
|
|
1544
|
+
key: item.label,
|
|
1545
|
+
name: item.label
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
default: () => [
|
|
1549
|
+
h(
|
|
1550
|
+
"div",
|
|
1551
|
+
{
|
|
1552
|
+
class: {
|
|
1553
|
+
"bk-timezone-picker-option": true,
|
|
1554
|
+
"is-selected": item.label === props.value
|
|
1555
|
+
}
|
|
1556
|
+
},
|
|
1557
|
+
[
|
|
1558
|
+
h("span", { class: "option-name" }, `${t("浏览器时区")} ${item.label}`),
|
|
1559
|
+
h("span", { class: "option-country" }, `${item.country}, ${item.abbreviation}`),
|
|
1560
|
+
h("span", { class: "option-utc" }, item.utc)
|
|
1561
|
+
]
|
|
1562
|
+
)
|
|
1563
|
+
]
|
|
1564
|
+
}
|
|
1565
|
+
)
|
|
1566
|
+
]);
|
|
1567
|
+
});
|
|
1568
|
+
} else {
|
|
1569
|
+
if (!group.options.length) return null;
|
|
1570
|
+
return h(
|
|
1571
|
+
Select.Group,
|
|
1572
|
+
{
|
|
1573
|
+
key: group.label,
|
|
1574
|
+
label: group.label
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
default: () => group.options.map((item) => {
|
|
1578
|
+
return renderSlot(slots, "option", { option: item }, () => [
|
|
1579
|
+
h(
|
|
1580
|
+
Select.Option,
|
|
1581
|
+
{
|
|
1582
|
+
...item,
|
|
1583
|
+
id: item.label,
|
|
1584
|
+
key: item.label,
|
|
1585
|
+
name: item.label
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
default: () => [
|
|
1589
|
+
h(
|
|
1590
|
+
"div",
|
|
1591
|
+
{
|
|
1592
|
+
class: {
|
|
1593
|
+
"bk-timezone-picker-option": true,
|
|
1594
|
+
"is-selected": item.label === props.value
|
|
1595
|
+
}
|
|
1596
|
+
},
|
|
1597
|
+
[
|
|
1598
|
+
h("span", { class: "option-name" }, item.label),
|
|
1599
|
+
h("span", { class: "option-country" }, `${item.country}, ${item.abbreviation}`),
|
|
1600
|
+
h("span", { class: "option-utc" }, item.utc)
|
|
1601
|
+
]
|
|
1602
|
+
)
|
|
1603
|
+
]
|
|
1604
|
+
}
|
|
1605
|
+
)
|
|
1606
|
+
]);
|
|
1607
|
+
})
|
|
1608
|
+
}
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
})
|
|
1613
|
+
]
|
|
1746
1614
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
const [e, n] = a;
|
|
1761
|
-
i && (this.timezome = i), this.startDate = e ? this.transformValue2Dayjs(e) : null, this.endDate = n ? this.transformValue2Dayjs(n, "end") : null;
|
|
1762
|
-
}
|
|
1763
|
-
updateFormat(a) {
|
|
1764
|
-
this.format = a;
|
|
1615
|
+
);
|
|
1616
|
+
};
|
|
1617
|
+
const handleChange = (val) => {
|
|
1618
|
+
const info = getTimezoneInfoByValue(val);
|
|
1619
|
+
emits("update:value", val, info);
|
|
1620
|
+
};
|
|
1621
|
+
const handleSearch = (keyword, timezone) => {
|
|
1622
|
+
var _a, _b, _c, _d;
|
|
1623
|
+
return ((_a = timezone.label) == null ? void 0 : _a.toLowerCase().includes(keyword.toLowerCase())) || ((_b = timezone.country) == null ? void 0 : _b.toLowerCase().includes(keyword.toLowerCase())) || ((_c = timezone.abbreviation) == null ? void 0 : _c.toLowerCase().includes(keyword.toLowerCase())) || ((_d = timezone.utc) == null ? void 0 : _d.toLowerCase().includes(keyword.toLowerCase()));
|
|
1624
|
+
};
|
|
1625
|
+
return (_ctx, _cache) => {
|
|
1626
|
+
return openBlock(), createBlock(resolveDynamicComponent(TimezonePicker));
|
|
1627
|
+
};
|
|
1765
1628
|
}
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
if (
|
|
1771
|
-
|
|
1772
|
-
if (i === C && Le.test(a))
|
|
1773
|
-
return I.RECENT;
|
|
1774
|
-
if (Ne[this.dateValue.join("~")])
|
|
1775
|
-
return I.NATURAL;
|
|
1776
|
-
if (ya.test(a) && (ya.test(i) || i === C)) {
|
|
1777
|
-
const [, e, n, b] = a.match(oa) || [], [, h, m, c] = i.match(oa) || [];
|
|
1778
|
-
if (b && (i === C || e && +h == -1 && n === b && m === c && n === m))
|
|
1779
|
-
return I.NATURAL;
|
|
1629
|
+
});
|
|
1630
|
+
function useKeydownEnter(callback) {
|
|
1631
|
+
const scope = effectScope();
|
|
1632
|
+
const handleKeydown = (event) => {
|
|
1633
|
+
if (event.key === "Enter") {
|
|
1634
|
+
callback(event);
|
|
1780
1635
|
}
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
get recentOrFuturedateNum() {
|
|
1792
|
-
if (this.dateMode === I.RECENT)
|
|
1793
|
-
return this.startNum;
|
|
1794
|
-
if (this.dateMode === I.FUTURE)
|
|
1795
|
-
return this.endNum;
|
|
1796
|
-
}
|
|
1797
|
-
get recentOrFuturedateUnit() {
|
|
1798
|
-
return this.dateMode === I.RECENT ? this.startUnit : this.dateMode === I.FUTURE ? this.endUnit : "m";
|
|
1799
|
-
}
|
|
1800
|
-
get startDisplayText() {
|
|
1801
|
-
var a;
|
|
1802
|
-
return d.tz(((a = this.startDate) == null ? void 0 : a.valueOf()) || void 0, this.timezome).format(this.format);
|
|
1636
|
+
};
|
|
1637
|
+
scope.run(() => {
|
|
1638
|
+
window.addEventListener("keydown", handleKeydown);
|
|
1639
|
+
});
|
|
1640
|
+
const stop = () => {
|
|
1641
|
+
scope.stop();
|
|
1642
|
+
window.removeEventListener("keydown", handleKeydown);
|
|
1643
|
+
};
|
|
1644
|
+
if (getCurrentScope()) {
|
|
1645
|
+
onScopeDispose(stop);
|
|
1803
1646
|
}
|
|
1647
|
+
return stop;
|
|
1804
1648
|
}
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
return [n, b];
|
|
1817
|
-
}, ne = (l, a = "local") => {
|
|
1818
|
-
const e = (a === "local" ? localStorage : sessionStorage).getItem(l);
|
|
1819
|
-
let n = [];
|
|
1820
|
-
if (e)
|
|
1821
|
-
try {
|
|
1822
|
-
n = JSON.parse(e);
|
|
1823
|
-
} catch {
|
|
1824
|
-
n = [];
|
|
1825
|
-
}
|
|
1826
|
-
return Array.isArray(n) || (n = []), n;
|
|
1827
|
-
}, re = (l, a, i = "local") => {
|
|
1828
|
-
let e = [];
|
|
1829
|
-
const n = i === "local" ? localStorage : sessionStorage, b = n.getItem(a);
|
|
1830
|
-
if (b)
|
|
1831
|
-
try {
|
|
1832
|
-
e = JSON.parse(b);
|
|
1833
|
-
} catch {
|
|
1834
|
-
e = [];
|
|
1835
|
-
}
|
|
1836
|
-
Array.isArray(e) || (e = []), !e.some((h) => h[0] === l[0] && h[1] === l[1]) && (e.unshift(l), n.setItem(a, JSON.stringify(e.slice(0, 10))));
|
|
1837
|
-
}, He = { class: "common-panel-tab" }, Ua = /* @__PURE__ */ X({
|
|
1838
|
-
__name: "common-tab",
|
|
1839
|
-
props: {
|
|
1840
|
-
/** modelValue 选中的tab */
|
|
1841
|
-
modelValue: {
|
|
1842
|
-
required: !0,
|
|
1843
|
-
type: String
|
|
1844
|
-
},
|
|
1845
|
-
/** panels */
|
|
1846
|
-
panels: {
|
|
1847
|
-
required: !0,
|
|
1848
|
-
type: Array
|
|
1849
|
-
},
|
|
1850
|
-
showDeleteAll: {
|
|
1851
|
-
default: !1,
|
|
1852
|
-
type: Boolean
|
|
1853
|
-
}
|
|
1649
|
+
var DateMode = /* @__PURE__ */ ((DateMode2) => {
|
|
1650
|
+
DateMode2["Date"] = "date";
|
|
1651
|
+
DateMode2["FUTURE"] = "now+";
|
|
1652
|
+
DateMode2["NATURAL"] = "natural";
|
|
1653
|
+
DateMode2["RECENT"] = "now-";
|
|
1654
|
+
return DateMode2;
|
|
1655
|
+
})(DateMode || {});
|
|
1656
|
+
const DateUnitList = [
|
|
1657
|
+
{
|
|
1658
|
+
id: "s",
|
|
1659
|
+
name: t("秒")
|
|
1854
1660
|
},
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
l.showDeleteAll ? (p(), K(t(fe), {
|
|
1879
|
-
key: 0,
|
|
1880
|
-
"cancel-text": t(r)("取消"),
|
|
1881
|
-
"confirm-text": t(r)("确定"),
|
|
1882
|
-
content: t(r)("是否清空最近使用?"),
|
|
1883
|
-
trigger: "click",
|
|
1884
|
-
width: 189,
|
|
1885
|
-
onConfirm: i[1] || (i[1] = (e) => a.$emit("confirm")),
|
|
1886
|
-
"ext-cls": "__bk-date-picker-popover__ __bk-date-picker-popover-delete__"
|
|
1887
|
-
}, {
|
|
1888
|
-
default: j(() => [
|
|
1889
|
-
E(t(xe), { class: "delete-all" })
|
|
1890
|
-
]),
|
|
1891
|
-
_: 1
|
|
1892
|
-
/* STABLE */
|
|
1893
|
-
}, 8, ["cancel-text", "confirm-text", "content"])) : sa("v-if", !0)
|
|
1894
|
-
]));
|
|
1661
|
+
{
|
|
1662
|
+
id: "m",
|
|
1663
|
+
name: t("分钟")
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
id: "h",
|
|
1667
|
+
name: t("小时")
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
id: "d",
|
|
1671
|
+
name: t("天")
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
id: "w",
|
|
1675
|
+
name: t("周")
|
|
1676
|
+
},
|
|
1677
|
+
{
|
|
1678
|
+
id: "M",
|
|
1679
|
+
name: t("月")
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
id: "y",
|
|
1683
|
+
name: t("年")
|
|
1895
1684
|
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1685
|
+
];
|
|
1686
|
+
const dateUnit = DateUnitList.map((item) => item.id).join("");
|
|
1687
|
+
var NaturalOptionType = /* @__PURE__ */ ((NaturalOptionType2) => {
|
|
1688
|
+
NaturalOptionType2["custom"] = "custom";
|
|
1689
|
+
NaturalOptionType2["default"] = "default";
|
|
1690
|
+
NaturalOptionType2["edit"] = "edit";
|
|
1691
|
+
NaturalOptionType2["specific"] = "specific";
|
|
1692
|
+
return NaturalOptionType2;
|
|
1693
|
+
})(NaturalOptionType || {});
|
|
1694
|
+
const CommonNaturalOptions = [
|
|
1695
|
+
{
|
|
1696
|
+
id: "now/d",
|
|
1697
|
+
name: t("今天"),
|
|
1698
|
+
type: "default"
|
|
1699
|
+
/* default */
|
|
1901
1700
|
},
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1701
|
+
{
|
|
1702
|
+
id: "now-1d/d",
|
|
1703
|
+
name: t("昨天"),
|
|
1704
|
+
type: "default"
|
|
1705
|
+
/* default */
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
id: "now-2d/d",
|
|
1709
|
+
name: t("前天"),
|
|
1710
|
+
type: "default"
|
|
1711
|
+
/* default */
|
|
1712
|
+
},
|
|
1713
|
+
{
|
|
1714
|
+
id: "now/w",
|
|
1715
|
+
name: t("本周"),
|
|
1716
|
+
type: "default"
|
|
1717
|
+
/* default */
|
|
1718
|
+
},
|
|
1719
|
+
{
|
|
1720
|
+
id: "now-1w/w",
|
|
1721
|
+
name: t("上周"),
|
|
1722
|
+
type: "default"
|
|
1723
|
+
/* default */
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
id: "now/M",
|
|
1727
|
+
name: t("本月"),
|
|
1728
|
+
type: "default"
|
|
1729
|
+
/* default */
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
id: "now-1M/M",
|
|
1733
|
+
name: t("上月"),
|
|
1734
|
+
type: "default"
|
|
1735
|
+
/* default */
|
|
1736
|
+
},
|
|
1737
|
+
{
|
|
1738
|
+
id: "now-nd/d",
|
|
1739
|
+
name: t("前 N 天"),
|
|
1740
|
+
prefix: t("前"),
|
|
1741
|
+
suffix: t("天"),
|
|
1742
|
+
type: "edit",
|
|
1743
|
+
unit: "d"
|
|
1744
|
+
},
|
|
1745
|
+
{
|
|
1746
|
+
id: "now-nw/w",
|
|
1747
|
+
name: t("前 N 周"),
|
|
1748
|
+
prefix: t("前"),
|
|
1749
|
+
suffix: t("周"),
|
|
1750
|
+
type: "edit",
|
|
1751
|
+
unit: "w"
|
|
1752
|
+
}
|
|
1753
|
+
];
|
|
1754
|
+
var NaturalUnit = /* @__PURE__ */ ((NaturalUnit2) => {
|
|
1755
|
+
NaturalUnit2["ALL"] = "all";
|
|
1756
|
+
NaturalUnit2["NOW"] = "now";
|
|
1757
|
+
return NaturalUnit2;
|
|
1758
|
+
})(NaturalUnit || {});
|
|
1759
|
+
const naturalUnitOptions = [
|
|
1760
|
+
{
|
|
1761
|
+
id: "all",
|
|
1762
|
+
name: t("整")
|
|
1763
|
+
},
|
|
1764
|
+
{
|
|
1765
|
+
id: "now",
|
|
1766
|
+
name: t("至今")
|
|
1767
|
+
}
|
|
1768
|
+
];
|
|
1769
|
+
const panels = [
|
|
1770
|
+
{
|
|
1771
|
+
id: "common",
|
|
1772
|
+
name: t("常用时间")
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
id: "recent",
|
|
1776
|
+
name: t("最近使用")
|
|
1777
|
+
}
|
|
1778
|
+
];
|
|
1779
|
+
const datePickTabList = [
|
|
1780
|
+
{
|
|
1781
|
+
id: DateMode.Date,
|
|
1782
|
+
name: t("日期选择")
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
id: DateMode.RECENT,
|
|
1786
|
+
name: t("最近")
|
|
1787
|
+
},
|
|
1788
|
+
{
|
|
1789
|
+
id: DateMode.FUTURE,
|
|
1790
|
+
name: t("未来")
|
|
1791
|
+
},
|
|
1792
|
+
{
|
|
1793
|
+
id: DateMode.NATURAL,
|
|
1794
|
+
name: t("自然日期")
|
|
1795
|
+
}
|
|
1796
|
+
];
|
|
1797
|
+
const storeKey = "BK_DATE_PICKER_STORE";
|
|
1798
|
+
const storeTabKey = "BK_DATE_PICKER_STORE_TAB";
|
|
1799
|
+
const timezoneStoreKey = "blueking_timezone";
|
|
1800
|
+
const getStoreKey = (key = 1) => `${storeKey}_${key}`;
|
|
1801
|
+
const getStoreTabKey = (key = 1) => `${storeTabKey}_${key}`;
|
|
1802
|
+
const dateFormatList = [
|
|
1803
|
+
"YYYY-MM-DD HH:mm:ss",
|
|
1804
|
+
"YYYY-MM-DD HH:mm:ss.SSS",
|
|
1805
|
+
"YYYY-MM-DD+HH:mm:ss",
|
|
1806
|
+
"MM/DD/YYYY HH:mm:ss",
|
|
1807
|
+
"YYYYMMDDHHmmss",
|
|
1808
|
+
"YYYYMMDD HHmmss",
|
|
1809
|
+
"YYYYMMDD HHmmss.SSS",
|
|
1810
|
+
"DD/MMM/YYYY:HH:mm:ss",
|
|
1811
|
+
"DD/MMM/YYYY:HH:mm:ssZ",
|
|
1812
|
+
"DD/MMM/YYYY:HH:mm:ss Z",
|
|
1813
|
+
"DD/MMM/YYYY:HH:mm:ssZZ",
|
|
1814
|
+
"DD/MMM/YYYY:HH:mm:ss ZZ",
|
|
1815
|
+
"YYYY-MM-DDTHH:mm:ss",
|
|
1816
|
+
"YYYY-MM-DDTHH:mm:ss.SSS",
|
|
1817
|
+
"YYYYMMDDTHHmmssZ",
|
|
1818
|
+
"YYYYMMDDTHHmmss.SSSSSSZ",
|
|
1819
|
+
"YYYY-MM-DDTHH:mm:ss.SSSZ",
|
|
1820
|
+
"YYYY-MM-DDTHH:mm:ssZ",
|
|
1821
|
+
"YYYY-MM-DDTHH:mm:ss.SSSSSSZ"
|
|
1822
|
+
];
|
|
1823
|
+
const naturalDateShortcutMap = {
|
|
1824
|
+
"now/M~now/M": t("本月"),
|
|
1825
|
+
"now/d~now/d": t("今天"),
|
|
1826
|
+
"now/w~now/w": t("本周"),
|
|
1827
|
+
"now/y~now/y": t("今年"),
|
|
1828
|
+
"now-1M/M~now-1M/M": t("上月"),
|
|
1829
|
+
"now-1d/d~now-1d/d": t("昨天"),
|
|
1830
|
+
"now-1w/w~now-1w/w": t("上周"),
|
|
1831
|
+
"now-1y/y~now-1y/y": t("去年"),
|
|
1832
|
+
"now-2d/d~now-2d/d": t("前天"),
|
|
1833
|
+
"now-2y/y~now-2y/y": t("前年")
|
|
1834
|
+
};
|
|
1835
|
+
const commonDateList = [
|
|
1836
|
+
["now-5m", "now"],
|
|
1837
|
+
["now-15m", "now"],
|
|
1838
|
+
["now-30m", "now"],
|
|
1839
|
+
["now-1h", "now"],
|
|
1840
|
+
["now-6h", "now"],
|
|
1841
|
+
["now-12h", "now"],
|
|
1842
|
+
["now-24h", "now"],
|
|
1843
|
+
["now-7d", "now"],
|
|
1844
|
+
["now-30d", "now"],
|
|
1845
|
+
["now/d", "now/d"],
|
|
1846
|
+
["now/d", "now"],
|
|
1847
|
+
["now-1d/d", "now-1d/d"],
|
|
1848
|
+
["now-2d/d", "now-2d/d"],
|
|
1849
|
+
["now/w", "now/w"],
|
|
1850
|
+
["now/w", "now"],
|
|
1851
|
+
["now-1w/w", "now-1w/w"],
|
|
1852
|
+
["now/M", "now/M"],
|
|
1853
|
+
["now/M", "now"],
|
|
1854
|
+
["now-1M/M", "now-1M/M"],
|
|
1855
|
+
["now-1M/M", "now"]
|
|
1856
|
+
];
|
|
1857
|
+
const NowConstant = "now";
|
|
1858
|
+
const DATE_REGEX_PARSE = /^(\d{4})[-/](\d+)[-/](\d+)[Tt\s]*(\d+)?:(\d+)?:(\d+)?[.:]?(\d*)$/;
|
|
1859
|
+
const DATE_REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;
|
|
1860
|
+
const DEFAULT_TIMEZONE = "Asia/Shanghai";
|
|
1861
|
+
const MAX_NUMBER_VALUE = 1e4;
|
|
1862
|
+
const baselineDateRegexp = new RegExp(`(\\(.+\\)|now)([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
1863
|
+
const commonDateRegexp = new RegExp(`now([+-]?\\d*)([${dateUnit}]?)\\/?([${dateUnit}]?)`);
|
|
1864
|
+
const recentDateRegexp = new RegExp(`now[-](\\d+)([${dateUnit}]{1})$`);
|
|
1865
|
+
const futureDateRegexp = new RegExp(`now[+](\\d+)([${dateUnit}]{1})$`);
|
|
1866
|
+
const naturalDateRegexp = new RegExp(`now([+-]?\\d*)([${dateUnit}]?)\\/([${dateUnit}])$`);
|
|
1867
|
+
class DateRange {
|
|
1868
|
+
constructor(dateValue = ["", ""], format = "YYYY-MM-DD HH:mm:ss", timezone = dayjs.tz.guess()) {
|
|
1869
|
+
__publicField(this, "endBaselineNum");
|
|
1870
|
+
__publicField(this, "endBaselineTime");
|
|
1871
|
+
__publicField(this, "endBaselineUnit");
|
|
1872
|
+
__publicField(this, "endDate");
|
|
1873
|
+
__publicField(this, "endNum");
|
|
1874
|
+
__publicField(this, "endUnit");
|
|
1875
|
+
__publicField(this, "startBaselineNum");
|
|
1876
|
+
__publicField(this, "startBaselineTime");
|
|
1877
|
+
__publicField(this, "startBaselineUnit");
|
|
1878
|
+
__publicField(this, "startDate");
|
|
1879
|
+
__publicField(this, "startNum");
|
|
1880
|
+
__publicField(this, "startUnit");
|
|
1881
|
+
__publicField(this, "userDisplayName");
|
|
1882
|
+
this.dateValue = dateValue;
|
|
1883
|
+
this.format = format;
|
|
1884
|
+
this.timezone = timezone;
|
|
1885
|
+
const [start, end] = dateValue;
|
|
1886
|
+
this.startDate = start ? this.transformValue2Dayjs(start) : null;
|
|
1887
|
+
this.endDate = end ? this.transformValue2Dayjs(end, "end") : null;
|
|
1888
|
+
}
|
|
1889
|
+
get dateMode() {
|
|
1890
|
+
const [start, end] = this.dateValue;
|
|
1891
|
+
if (typeof start === "number" || typeof end === "number") return DateMode.Date;
|
|
1892
|
+
if (dayjs.isDayjs(start) || dayjs.isDayjs(end)) return DateMode.Date;
|
|
1893
|
+
if (dayjs(start).isValid() || dayjs(end).isValid()) return DateMode.Date;
|
|
1894
|
+
if (start === NowConstant && futureDateRegexp.test(end)) return DateMode.FUTURE;
|
|
1895
|
+
if (end === NowConstant && recentDateRegexp.test(start) || start.includes("(") && end.includes("("))
|
|
1896
|
+
return DateMode.RECENT;
|
|
1897
|
+
if (naturalDateShortcutMap[this.dateValue.join("~")]) {
|
|
1898
|
+
return DateMode.NATURAL;
|
|
1899
|
+
}
|
|
1900
|
+
if (naturalDateRegexp.test(start) && (naturalDateRegexp.test(end) || end === NowConstant)) {
|
|
1901
|
+
const [, startNum, startUnit, startDiffUnit] = start.match(commonDateRegexp) || [];
|
|
1902
|
+
const [, endNum, endUnit, endDiffUnit] = end.match(commonDateRegexp) || [];
|
|
1903
|
+
if (startDiffUnit) {
|
|
1904
|
+
if (end === NowConstant) return DateMode.NATURAL;
|
|
1905
|
+
if (startNum && +endNum == -1) {
|
|
1906
|
+
if (startUnit === startDiffUnit && endUnit === endDiffUnit && startUnit === endUnit) return DateMode.NATURAL;
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
return DateMode.Date;
|
|
1911
|
+
}
|
|
1912
|
+
get endDisplayText() {
|
|
1913
|
+
var _a;
|
|
1914
|
+
return dayjs.tz(((_a = this.endDate) == null ? void 0 : _a.valueOf()) || void 0, this.timezone).format(this.format);
|
|
1915
|
+
}
|
|
1916
|
+
get isValidate() {
|
|
1917
|
+
var _a, _b;
|
|
1918
|
+
return ((_a = this.startDate) == null ? void 0 : _a.isValid()) && ((_b = this.endDate) == null ? void 0 : _b.isValid());
|
|
1919
|
+
}
|
|
1920
|
+
get recentOrFutureDateNum() {
|
|
1921
|
+
if (this.dateMode === DateMode.RECENT) {
|
|
1922
|
+
return this.startNum;
|
|
1923
|
+
}
|
|
1924
|
+
if (this.dateMode === DateMode.FUTURE) {
|
|
1925
|
+
return this.endNum;
|
|
1926
|
+
}
|
|
1927
|
+
return void 0;
|
|
1928
|
+
}
|
|
1929
|
+
get recentOrFutureDateUnit() {
|
|
1930
|
+
if (this.dateMode === DateMode.RECENT) {
|
|
1931
|
+
return this.startUnit;
|
|
1932
|
+
}
|
|
1933
|
+
if (this.dateMode === DateMode.FUTURE) {
|
|
1934
|
+
return this.endUnit;
|
|
1935
|
+
}
|
|
1936
|
+
return "m";
|
|
1937
|
+
}
|
|
1938
|
+
get startDisplayText() {
|
|
1939
|
+
var _a;
|
|
1940
|
+
return dayjs.tz(((_a = this.startDate) == null ? void 0 : _a.valueOf()) || void 0, this.timezone).format(this.format);
|
|
1941
|
+
}
|
|
1942
|
+
dateDuration(unit) {
|
|
1943
|
+
if (!this.startDate || !this.endDate || !this.isValidate) return;
|
|
1944
|
+
let durations = this.endDate.diff(this.startDate);
|
|
1945
|
+
const dayDuration = 24 * 60 * 60 * 1e3;
|
|
1946
|
+
switch (this.dateMode) {
|
|
1947
|
+
case DateMode.RECENT:
|
|
1948
|
+
durations = dayjs().add(this.startNum, this.startUnit).diff(dayjs(), unit);
|
|
1949
|
+
break;
|
|
1950
|
+
case DateMode.FUTURE:
|
|
1951
|
+
durations = dayjs().diff(
|
|
1952
|
+
dayjs().add(this.endNum, this.endUnit),
|
|
1953
|
+
unit || this.endUnit
|
|
1954
|
+
);
|
|
1955
|
+
break;
|
|
1956
|
+
case DateMode.NATURAL: {
|
|
1957
|
+
durations = this.endDate.diff(this.startDate, unit);
|
|
1958
|
+
const dayDuration2 = 24 * 60 * 60 * 1e3;
|
|
1959
|
+
if (durations % dayDuration2 === dayDuration2 - 1) {
|
|
1960
|
+
durations += 1;
|
|
1961
|
+
}
|
|
1962
|
+
break;
|
|
1963
|
+
}
|
|
1964
|
+
default:
|
|
1965
|
+
case DateMode.Date:
|
|
1966
|
+
durations = this.endDate.diff(this.startDate, unit);
|
|
1967
|
+
break;
|
|
1968
|
+
}
|
|
1969
|
+
const durationMod = durations % dayDuration;
|
|
1970
|
+
if (durationMod === dayDuration - 1) {
|
|
1971
|
+
durations += 1;
|
|
1972
|
+
} else if (durationMod === dayDuration - 1e3) {
|
|
1973
|
+
durations += 1e3;
|
|
1974
|
+
}
|
|
1975
|
+
return durations;
|
|
1976
|
+
}
|
|
1977
|
+
isInValidDateRange(date) {
|
|
1978
|
+
if (!this.startDate || !this.endDate) return false;
|
|
1979
|
+
return (this.startDate.isSame(date.startDate, "ms") || this.startDate.isBefore(date.startDate)) && (this.endDate.isSame(date.endDate, "ms") || this.endDate.isAfter(date.endDate));
|
|
1980
|
+
}
|
|
1981
|
+
isInValidDuration(minDuration = 0, maxDuration = Number.MAX_SAFE_INTEGER) {
|
|
1982
|
+
if (!this.startDate || !this.endDate) return false;
|
|
1983
|
+
const durations = this.dateDuration();
|
|
1984
|
+
if (durations === void 0) return false;
|
|
1985
|
+
return durations >= minDuration && durations <= maxDuration;
|
|
1986
|
+
}
|
|
1987
|
+
setUserDisplayName(v) {
|
|
1988
|
+
this.userDisplayName = v;
|
|
1989
|
+
}
|
|
1990
|
+
toDisplayString() {
|
|
1991
|
+
var _a, _b;
|
|
1992
|
+
const {
|
|
1993
|
+
dateMode,
|
|
1994
|
+
endDate,
|
|
1995
|
+
endNum,
|
|
1996
|
+
format,
|
|
1997
|
+
isValidate,
|
|
1998
|
+
startBaselineNum,
|
|
1999
|
+
startBaselineTime,
|
|
2000
|
+
startDate,
|
|
2001
|
+
startNum,
|
|
2002
|
+
startUnit
|
|
2003
|
+
} = this;
|
|
2004
|
+
if (this.userDisplayName) return this.userDisplayName;
|
|
2005
|
+
if (!startDate || !endDate || !isValidate) {
|
|
2006
|
+
return ((_a = this.dateValue) == null ? void 0 : _a.join(" ~ ")) || "";
|
|
2007
|
+
}
|
|
2008
|
+
if (this.dateMode === DateMode.RECENT) {
|
|
2009
|
+
let displayStr = startBaselineTime ? `${t("基于")} ` : "";
|
|
2010
|
+
const item = CommonNaturalOptions.find((option) => option.id === startBaselineTime);
|
|
2011
|
+
if (item == null ? void 0 : item.name) {
|
|
2012
|
+
displayStr += `${t(item.name)} `;
|
|
2013
|
+
} else if (startBaselineNum) {
|
|
2014
|
+
displayStr += `${startBaselineNum} ${t("天前")} `;
|
|
2015
|
+
} else if (startBaselineTime) {
|
|
2016
|
+
displayStr += `${startBaselineTime} `;
|
|
2017
|
+
}
|
|
2018
|
+
return `${displayStr}${t(startBaselineTime ? "的最近" : "近")} ${Math.abs(startNum)} ${t(
|
|
2019
|
+
shortTimeUnitLangData[startUnit]
|
|
2020
|
+
)}`;
|
|
2021
|
+
}
|
|
2022
|
+
if (dateMode === DateMode.FUTURE) {
|
|
2023
|
+
return `${t("未来")} ${Math.abs(endNum)} ${t(
|
|
2024
|
+
shortTimeUnitLangData[this.endUnit]
|
|
2025
|
+
)}`;
|
|
2026
|
+
}
|
|
2027
|
+
const [start, end] = this.dateValue;
|
|
2028
|
+
if (this.dateMode === DateMode.NATURAL) {
|
|
2029
|
+
const suffix = end !== NowConstant ? "" : t("(至今)");
|
|
2030
|
+
const item = CommonNaturalOptions.find((option) => option.id === start);
|
|
2031
|
+
if (item) {
|
|
2032
|
+
return t(item.name) + suffix;
|
|
2033
|
+
}
|
|
2034
|
+
return naturalDateShortcutMap[this.dateValue.join("~")] || `${`${t("前")} ${this.startNum} ${t(
|
|
2035
|
+
shortTimeUnitLangData[this.startUnit]
|
|
2036
|
+
)}`}${suffix}`;
|
|
2037
|
+
}
|
|
2038
|
+
if (start === NowConstant) {
|
|
2039
|
+
return `${t("此刻")} ~ ${(_b = this.endDate) == null ? void 0 : _b.format(format)}`;
|
|
2040
|
+
}
|
|
2041
|
+
if (end === NowConstant) {
|
|
2042
|
+
return `${startDate == null ? void 0 : startDate.format(format)} ~ ${t("此刻")}`;
|
|
2043
|
+
}
|
|
2044
|
+
const dateUnits = [
|
|
2045
|
+
{ regex: /Y{2,4}|y{2,4}/, unit: "year" },
|
|
2046
|
+
// { regex: /M{1,2}/, unit: 'month' },
|
|
2047
|
+
{ regex: /D{1,2}|d{1,2}/, unit: "day" }
|
|
2048
|
+
// { regex: /H{1,2}|h{1,2}/, unit: 'hour' },
|
|
2049
|
+
// { regex: /m{1,2}/, unit: 'minute' },
|
|
2050
|
+
// { regex: /s{1,2}/, unit: 'second' },
|
|
2051
|
+
];
|
|
2052
|
+
let remainingFormat = format;
|
|
2053
|
+
let commonFormat = "";
|
|
2054
|
+
let lastEndIndex = 0;
|
|
2055
|
+
for (const { regex, unit } of dateUnits) {
|
|
2056
|
+
if (startDate.isSame(endDate, unit)) {
|
|
2057
|
+
const match = regex.exec(format.slice(lastEndIndex));
|
|
2058
|
+
if (match) {
|
|
2059
|
+
commonFormat += format.slice(lastEndIndex, lastEndIndex + match.index + match[0].length);
|
|
2060
|
+
lastEndIndex += match.index + match[0].length;
|
|
2061
|
+
}
|
|
2062
|
+
} else {
|
|
2063
|
+
break;
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
remainingFormat = format.slice(lastEndIndex).trim().replace(/^[:\-\\/]/, "");
|
|
2067
|
+
const commonPrefix = startDate.format(commonFormat.trim());
|
|
2068
|
+
if (!remainingFormat || remainingFormat == format) {
|
|
2069
|
+
return `${startDate.format(format)} ~ ${endDate.format(format)}`;
|
|
2070
|
+
}
|
|
2071
|
+
const formattedStart = startDate.format(remainingFormat);
|
|
2072
|
+
const formattedEnd = endDate.format(remainingFormat);
|
|
2073
|
+
return `${commonPrefix.trim()} (${formattedStart} ~ ${formattedEnd})`;
|
|
2074
|
+
}
|
|
2075
|
+
toEmitValue() {
|
|
2076
|
+
var _a, _b;
|
|
2077
|
+
return [
|
|
2078
|
+
this.dateMode === DateMode.Date ? [
|
|
2079
|
+
this.dateValue[0] === NowConstant ? NowConstant : this.startDate.valueOf(),
|
|
2080
|
+
this.dateValue[1] === NowConstant ? NowConstant : this.endDate.valueOf()
|
|
2081
|
+
] : [...this.dateValue],
|
|
2082
|
+
[
|
|
2083
|
+
{
|
|
2084
|
+
dayjs: this.startDate,
|
|
2085
|
+
formatText: ((_a = this.startDate) == null ? void 0 : _a.format(this.format)) || null
|
|
2086
|
+
},
|
|
2087
|
+
{
|
|
2088
|
+
dayjs: this.endDate,
|
|
2089
|
+
formatText: ((_b = this.endDate) == null ? void 0 : _b.format(this.format)) || null
|
|
2090
|
+
}
|
|
2091
|
+
]
|
|
2092
|
+
];
|
|
2093
|
+
}
|
|
2094
|
+
transformValue2Dayjs(val, type = "start") {
|
|
2095
|
+
const value = isNaN(val) ? val : +val;
|
|
2096
|
+
let date = dayjs(value);
|
|
2097
|
+
if (typeof value === "number" || dayjs.isDayjs(value) || date.isValid())
|
|
2098
|
+
return dayjs.tz(date.valueOf(), this.timezone);
|
|
2099
|
+
const [, baselineTimeStr, num, unit, diffUnit] = value.match(baselineDateRegexp) || [];
|
|
2100
|
+
const baselineTime = baselineTimeStr.replace(/[()]/g, "");
|
|
2101
|
+
let baselineDayjs = dayjs();
|
|
2102
|
+
if (baselineTime && baselineTime !== NowConstant) {
|
|
2103
|
+
baselineDayjs = dayjs(baselineTime);
|
|
2104
|
+
if (baselineDayjs.isValid()) {
|
|
2105
|
+
date = baselineDayjs.add(-1, "ms").endOf("ms");
|
|
2106
|
+
} else {
|
|
2107
|
+
const [, , baseNum, baseUnit, baseDiffUnit] = baselineTime.match(baselineDateRegexp) || [];
|
|
2108
|
+
this[`${type}BaselineNum`] = Math.abs(+baseNum);
|
|
2109
|
+
this[`${type}BaselineUnit`] = baseUnit || baseDiffUnit;
|
|
2110
|
+
baselineDayjs = transformValue2Dayjs(baselineTime, "start") || dayjs();
|
|
2111
|
+
if (baselineTimeStr === value && baselineTimeStr.includes(NowConstant)) {
|
|
2112
|
+
date = baselineDayjs.add(-1, "d").endOf("d");
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
this[`${type}BaselineTime`] = baselineTime;
|
|
2116
|
+
}
|
|
2117
|
+
if (type === "start") {
|
|
2118
|
+
this.startNum = Math.abs(+num);
|
|
2119
|
+
this.startUnit = unit || diffUnit;
|
|
2120
|
+
} else if (type === "end") {
|
|
2121
|
+
this.endNum = Math.abs(+num);
|
|
2122
|
+
this.endUnit = unit || diffUnit;
|
|
2123
|
+
}
|
|
2124
|
+
if (num) {
|
|
2125
|
+
date = baselineDayjs.add(+num, unit || diffUnit);
|
|
2126
|
+
} else if (value === NowConstant) {
|
|
2127
|
+
date = baselineDayjs;
|
|
2128
|
+
}
|
|
2129
|
+
if (diffUnit) {
|
|
2130
|
+
date = type === "start" ? dayjs(date.isValid() ? date : baselineDayjs.valueOf()) : dayjs(date.isValid() ? date : baselineDayjs);
|
|
2131
|
+
return type === "start" ? dayjs.tz(date.valueOf(), this.timezone).startOf(diffUnit) : dayjs.tz(date.valueOf(), this.timezone).endOf(diffUnit);
|
|
2132
|
+
}
|
|
2133
|
+
return dayjs.tz(date.valueOf(), this.timezone);
|
|
2134
|
+
}
|
|
2135
|
+
updateDateValue(dateValue, timezone) {
|
|
2136
|
+
this.dateValue = dateValue;
|
|
2137
|
+
const [start, end] = dateValue;
|
|
2138
|
+
if (timezone) this.timezone = timezone;
|
|
2139
|
+
this.startDate = start ? this.transformValue2Dayjs(start) : null;
|
|
2140
|
+
this.endDate = end ? this.transformValue2Dayjs(end, "end") : null;
|
|
2141
|
+
}
|
|
2142
|
+
updateFormat(format) {
|
|
2143
|
+
this.format = format;
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
const transformValue2Dayjs = (val, type = "start", timezone) => {
|
|
2147
|
+
const value = isNaN(val) ? val : +val;
|
|
2148
|
+
let date = dayjs(value);
|
|
2149
|
+
if (typeof value === "number" || dayjs.isDayjs(value) || date.isValid())
|
|
2150
|
+
return dayjs.tz(date.valueOf(), timezone || dayjs.tz.guess());
|
|
2151
|
+
const [, baselineTimeStr, num, unit, diffUnit] = value.match(baselineDateRegexp) || [];
|
|
2152
|
+
const baselineTime = baselineTimeStr.replace(/[()]/g, "");
|
|
2153
|
+
let baselineDayjs = dayjs();
|
|
2154
|
+
if (baselineTime && baselineTime !== NowConstant) {
|
|
2155
|
+
baselineDayjs = transformValue2Dayjs(baselineTime, "start") || dayjs();
|
|
2156
|
+
if (baselineTimeStr === value) {
|
|
2157
|
+
date = baselineDayjs;
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
if (num) {
|
|
2161
|
+
date = dayjs().add(+num, unit || diffUnit || "d");
|
|
2162
|
+
} else if (value === NowConstant) {
|
|
2163
|
+
date = dayjs();
|
|
2164
|
+
}
|
|
2165
|
+
if (diffUnit) {
|
|
2166
|
+
date = type === "start" ? dayjs.tz(dayjs(date.isValid() ? date : void 0).valueOf(), timezone).startOf(diffUnit) : dayjs.tz(dayjs(date.isValid() ? date : void 0), timezone).endOf(diffUnit);
|
|
2167
|
+
return (date == null ? void 0 : date.isValid()) ? date : void 0;
|
|
2168
|
+
}
|
|
2169
|
+
return date.isValid() ? dayjs.tz(date.valueOf(), timezone || dayjs.tz.guess()) : void 0;
|
|
2170
|
+
};
|
|
2171
|
+
const transformDateRange2Dayjs = (dateValue, timezone) => {
|
|
2172
|
+
if (!Array.isArray(dateValue) || dateValue.length < 1) return [];
|
|
2173
|
+
const [start, end] = dateValue || [];
|
|
2174
|
+
const startDate = transformValue2Dayjs(start, "start", timezone);
|
|
2175
|
+
const endDate = transformValue2Dayjs(end, "end", timezone);
|
|
2176
|
+
return [startDate, endDate];
|
|
2177
|
+
};
|
|
2178
|
+
const inputVal2Dayjs = (val, format, defaultDate) => {
|
|
2179
|
+
let date;
|
|
2180
|
+
if (commonDateRegexp.test(val)) {
|
|
2181
|
+
date = transformValue2Dayjs(val);
|
|
2182
|
+
}
|
|
2183
|
+
if (!date && !/Z$/i.test(val) && "YYYY-MM-DD HH:mm:ss".includes(format)) {
|
|
2184
|
+
const d = val.match(DATE_REGEX_PARSE) || [];
|
|
2185
|
+
if (d.length) {
|
|
2186
|
+
let validate = true;
|
|
2187
|
+
const ms = (d[7] || "0").substring(0, 3);
|
|
2188
|
+
const s = d[6] || 0;
|
|
2189
|
+
validate = +s < 60;
|
|
2190
|
+
const m = d[5] || 0;
|
|
2191
|
+
validate = validate && +m < 60;
|
|
2192
|
+
const h2 = d[4] || 0;
|
|
2193
|
+
validate = validate && +h2 < 24;
|
|
2194
|
+
const day = d[3] || 1;
|
|
2195
|
+
validate = validate && +day < 32;
|
|
2196
|
+
const M = +d[2] - 1 || 0;
|
|
2197
|
+
validate = validate && M < 12;
|
|
2198
|
+
const y = d[1];
|
|
2199
|
+
validate = validate && y.length < 5;
|
|
2200
|
+
date = validate ? dayjs(new Date(+y, M, +day, +h2, +m, +s, +ms)) : defaultDate;
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
if (!date) {
|
|
2204
|
+
date = dayjs(val);
|
|
2205
|
+
}
|
|
2206
|
+
return date;
|
|
2207
|
+
};
|
|
2208
|
+
function getTimezoneOffset(timezone) {
|
|
2209
|
+
const localTime = dayjs().tz(timezone);
|
|
2210
|
+
const offset = localTime.utcOffset() / 60;
|
|
2211
|
+
return offset;
|
|
2212
|
+
}
|
|
2213
|
+
const isValidTimeZone = (timeZone) => {
|
|
2214
|
+
try {
|
|
2215
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
2216
|
+
return true;
|
|
2217
|
+
} catch (e) {
|
|
2218
|
+
return false;
|
|
2219
|
+
}
|
|
2220
|
+
};
|
|
2221
|
+
const timeUnits = {
|
|
2222
|
+
天: 24 * 60 * 60 * 1e3,
|
|
2223
|
+
小时: 60 * 60 * 1e3,
|
|
2224
|
+
分钟: 60 * 1e3,
|
|
2225
|
+
秒: 1e3
|
|
2226
|
+
};
|
|
2227
|
+
const formatDuration = (milliseconds) => {
|
|
2228
|
+
let remainingTime = milliseconds;
|
|
2229
|
+
let result = "";
|
|
2230
|
+
for (const [unit, value] of Object.entries(timeUnits)) {
|
|
2231
|
+
const amount = Math.floor(remainingTime / value);
|
|
2232
|
+
if (amount > 0) {
|
|
2233
|
+
result += `${amount} ${t(unit)} `;
|
|
2234
|
+
remainingTime %= value;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
return result.trim();
|
|
2238
|
+
};
|
|
2239
|
+
const DATE_PICKER_PROVIDER_KEY = Symbol("DATE_PICKER_PROVIDER_KEY");
|
|
2240
|
+
const useDatePickerProvider = (data) => {
|
|
2241
|
+
provide(DATE_PICKER_PROVIDER_KEY, data);
|
|
2242
|
+
};
|
|
2243
|
+
const useDatePickerInject = () => inject(DATE_PICKER_PROVIDER_KEY);
|
|
2244
|
+
const getStoreDateList = (storeKey2, type = "local") => {
|
|
2245
|
+
const store = type === "local" ? localStorage : sessionStorage;
|
|
2246
|
+
const storeListStr = store.getItem(storeKey2);
|
|
2247
|
+
let list = [];
|
|
2248
|
+
if (storeListStr) {
|
|
2249
|
+
try {
|
|
2250
|
+
list = JSON.parse(storeListStr);
|
|
2251
|
+
} catch {
|
|
2252
|
+
list = [];
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
if (!Array.isArray(list)) {
|
|
2256
|
+
list = [];
|
|
2257
|
+
}
|
|
2258
|
+
return list;
|
|
2259
|
+
};
|
|
2260
|
+
const setStoreDateList = (val, storeKey2, type = "local") => {
|
|
2261
|
+
let list = [];
|
|
2262
|
+
const store = type === "local" ? localStorage : sessionStorage;
|
|
2263
|
+
const storeListStr = store.getItem(storeKey2);
|
|
2264
|
+
if (storeListStr) {
|
|
2265
|
+
try {
|
|
2266
|
+
list = JSON.parse(storeListStr);
|
|
2267
|
+
} catch {
|
|
2268
|
+
list = [];
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
if (!Array.isArray(list)) {
|
|
2272
|
+
list = [];
|
|
2273
|
+
}
|
|
2274
|
+
if (list.some((item) => item[0] === val[0] && item[1] === val[1])) return;
|
|
2275
|
+
list.unshift(val);
|
|
2276
|
+
store.setItem(storeKey2, JSON.stringify(list.slice(0, 10)));
|
|
2277
|
+
};
|
|
2278
|
+
const _hoisted_1$9 = { class: "common-panel-tab" };
|
|
2279
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
2280
|
+
__name: "common-tab",
|
|
2281
|
+
props: {
|
|
2282
|
+
/** modelValue 选中的tab */
|
|
2283
|
+
modelValue: {
|
|
2284
|
+
required: true,
|
|
2285
|
+
type: String
|
|
2286
|
+
},
|
|
2287
|
+
/** panels */
|
|
2288
|
+
panels: {
|
|
2289
|
+
required: true,
|
|
2290
|
+
type: Array
|
|
2291
|
+
}
|
|
2292
|
+
},
|
|
2293
|
+
emits: ["confirm", "update:modelValue"],
|
|
2294
|
+
setup(__props) {
|
|
2295
|
+
return (_ctx, _cache) => {
|
|
2296
|
+
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
2297
|
+
createVNode(unref(Tab), {
|
|
2298
|
+
active: __props.modelValue,
|
|
2299
|
+
type: "unborder-card",
|
|
2300
|
+
"onUpdate:active": _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", $event))
|
|
2301
|
+
}, {
|
|
2302
|
+
default: withCtx(() => [
|
|
2303
|
+
(openBlock(true), createElementBlock(
|
|
2304
|
+
Fragment,
|
|
2305
|
+
null,
|
|
2306
|
+
renderList(__props.panels, (item) => {
|
|
2307
|
+
return openBlock(), createBlock(unref(Tab).TabPanel, {
|
|
2308
|
+
key: item.id,
|
|
2309
|
+
label: item.name,
|
|
2310
|
+
name: item.id
|
|
2311
|
+
}, null, 8, ["label", "name"]);
|
|
2312
|
+
}),
|
|
2313
|
+
128
|
|
2314
|
+
/* KEYED_FRAGMENT */
|
|
2315
|
+
))
|
|
2316
|
+
]),
|
|
2317
|
+
_: 1
|
|
2318
|
+
/* STABLE */
|
|
2319
|
+
}, 8, ["active"])
|
|
2320
|
+
]);
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
});
|
|
2324
|
+
const useValidate = () => {
|
|
2325
|
+
var _a;
|
|
2326
|
+
const { format, timezoneInfo, validateTimeRange, minDuration, maxDuration } = useDatePickerInject();
|
|
2327
|
+
const validMsg = ref("");
|
|
2328
|
+
const validDateRange = customRef((track) => {
|
|
2329
|
+
const date = new DateRange(validateTimeRange.value, format.value, timezoneInfo.value.label);
|
|
2330
|
+
return {
|
|
2331
|
+
get() {
|
|
2332
|
+
var _a2;
|
|
2333
|
+
track();
|
|
2334
|
+
if (((_a2 = validateTimeRange.value) == null ? void 0 : _a2.length) !== 2) return void 0;
|
|
2335
|
+
if (validateTimeRange.value.some((v) => typeof v === "string" && v.includes("now")))
|
|
2336
|
+
return new DateRange(validateTimeRange.value, format.value, timezoneInfo.value.label);
|
|
2337
|
+
return date;
|
|
2338
|
+
},
|
|
2339
|
+
set() {
|
|
2340
|
+
}
|
|
2341
|
+
};
|
|
2342
|
+
});
|
|
2343
|
+
const rangeMsg = t("超出可选范围") + " (" + ((_a = validDateRange.value) == null ? void 0 : _a.toDisplayString()) + ") " + t(",无法选择");
|
|
2344
|
+
const validDuration = (validDate) => {
|
|
2345
|
+
let date;
|
|
2346
|
+
if (validDate instanceof DateRange) {
|
|
2347
|
+
date = validDate;
|
|
2348
|
+
} else {
|
|
2349
|
+
date = new DateRange(validDate, format.value, timezoneInfo.value.label);
|
|
2350
|
+
}
|
|
2351
|
+
const durations = Math.abs(date.dateDuration("ms") || 0);
|
|
2352
|
+
let message = "";
|
|
2353
|
+
if (minDuration.value && durations < minDuration.value) {
|
|
2354
|
+
message = t("时间范围不能小于") + " " + formatDuration(minDuration.value);
|
|
2355
|
+
}
|
|
2356
|
+
if (!message && maxDuration.value && durations > maxDuration.value) {
|
|
2357
|
+
message = t("时间范围不能大于") + " " + formatDuration(maxDuration.value);
|
|
2358
|
+
}
|
|
2359
|
+
return message;
|
|
2360
|
+
};
|
|
2361
|
+
const commonValidateFn = (date) => {
|
|
2362
|
+
var _a2;
|
|
2363
|
+
const isValid = ((_a2 = validDateRange.value) == null ? void 0 : _a2.isInValidDateRange(date)) ?? true;
|
|
2364
|
+
if (!isValid) {
|
|
2365
|
+
validMsg.value = rangeMsg;
|
|
2366
|
+
return isValid;
|
|
2367
|
+
}
|
|
2368
|
+
const message = validDuration(date);
|
|
2369
|
+
validMsg.value = message;
|
|
2370
|
+
return !message;
|
|
2371
|
+
};
|
|
2372
|
+
const validateDateValue = (validDate) => {
|
|
2373
|
+
if (!(validDate == null ? void 0 : validDate.length)) return false;
|
|
2374
|
+
const date = new DateRange(validDate, format.value, timezoneInfo.value.label);
|
|
2375
|
+
return commonValidateFn(date);
|
|
2376
|
+
};
|
|
2377
|
+
const validateDateRange = (validDate) => {
|
|
2378
|
+
if (!validDate.isValidate) return false;
|
|
2379
|
+
return commonValidateFn(validDate);
|
|
2380
|
+
};
|
|
2381
|
+
const validateDayjs = (validDate) => {
|
|
2382
|
+
var _a2;
|
|
2383
|
+
validMsg.value = "";
|
|
2384
|
+
if (!validDate.isValid()) return false;
|
|
2385
|
+
const date = new DateRange([validDate.startOf("d"), validDate.endOf("d")], format.value, timezoneInfo.value.label);
|
|
2386
|
+
const isValid = ((_a2 = validDateRange.value) == null ? void 0 : _a2.isInValidDateRange(date)) ?? true;
|
|
2387
|
+
if (!isValid) {
|
|
2388
|
+
validMsg.value = rangeMsg;
|
|
2389
|
+
}
|
|
2390
|
+
return isValid;
|
|
2391
|
+
};
|
|
2392
|
+
return {
|
|
2393
|
+
validDateRange,
|
|
2394
|
+
validMsg,
|
|
2395
|
+
validateDateRange,
|
|
2396
|
+
validateDateValue,
|
|
2397
|
+
validateDayjs
|
|
2398
|
+
};
|
|
2399
|
+
};
|
|
2400
|
+
const _hoisted_1$8 = {
|
|
2401
|
+
key: 0,
|
|
2402
|
+
class: "common-date-list"
|
|
2403
|
+
};
|
|
2404
|
+
const _hoisted_2$6 = ["onClick", "onMouseenter"];
|
|
2405
|
+
const _hoisted_3$5 = {
|
|
2406
|
+
key: 1,
|
|
2407
|
+
class: "common-wrapper"
|
|
2408
|
+
};
|
|
2409
|
+
const _hoisted_4$4 = { class: "empty-tips" };
|
|
2410
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
2411
|
+
__name: "date-list",
|
|
2412
|
+
props: {
|
|
2413
|
+
dateList: {},
|
|
2414
|
+
defaultDate: {},
|
|
2415
|
+
isRecent: { type: Boolean }
|
|
2416
|
+
},
|
|
2417
|
+
emits: ["change"],
|
|
2418
|
+
setup(__props, { emit: __emit }) {
|
|
2419
|
+
const emits = __emit;
|
|
2420
|
+
let popoverInstance = null;
|
|
2421
|
+
const { validMsg, validateDateRange } = useValidate();
|
|
2422
|
+
const isSameDateRange = (date1, date2) => {
|
|
2423
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2424
|
+
if (!date1 || !date2) return false;
|
|
2425
|
+
if (((_b = (_a = date1.dateValue) == null ? void 0 : _a.join) == null ? void 0 : _b.call(_a, "~")) === ((_d = (_c = date2 == null ? void 0 : date2.dateValue) == null ? void 0 : _c.join) == null ? void 0 : _d.call(_c, "~"))) return true;
|
|
2426
|
+
if (((_e = date1 == null ? void 0 : date1.toDisplayString) == null ? void 0 : _e.call(date1)) === ((_f = date2 == null ? void 0 : date2.toDisplayString) == null ? void 0 : _f.call(date2))) return true;
|
|
2427
|
+
return false;
|
|
2428
|
+
};
|
|
2429
|
+
const handleChange = (date) => {
|
|
2430
|
+
emits("change", date);
|
|
2431
|
+
};
|
|
2432
|
+
const handleShowDisableMsg = (e, date) => {
|
|
2433
|
+
if (validateDateRange(date)) return;
|
|
2434
|
+
popoverInstance = $bkPopover({
|
|
2435
|
+
content: validMsg.value,
|
|
2436
|
+
immediate: false,
|
|
2437
|
+
isShow: true,
|
|
2438
|
+
popoverDelay: 0,
|
|
2439
|
+
target: e.target,
|
|
2440
|
+
trigger: "manual"
|
|
2441
|
+
});
|
|
2442
|
+
popoverInstance == null ? void 0 : popoverInstance.show(e.target);
|
|
2443
|
+
};
|
|
2444
|
+
const handleHideDisableMsg = () => {
|
|
2445
|
+
popoverInstance == null ? void 0 : popoverInstance.hide();
|
|
2446
|
+
};
|
|
2447
|
+
return (_ctx, _cache) => {
|
|
2448
|
+
return _ctx.dateList.length ? (openBlock(), createElementBlock("ul", _hoisted_1$8, [
|
|
2449
|
+
(openBlock(true), createElementBlock(
|
|
2450
|
+
Fragment,
|
|
2451
|
+
null,
|
|
2452
|
+
renderList(_ctx.dateList, (date, index) => {
|
|
2453
|
+
return openBlock(), createElementBlock("li", {
|
|
2454
|
+
key: index,
|
|
2455
|
+
class: normalizeClass({
|
|
2456
|
+
"list-item": true,
|
|
2457
|
+
"is-recent-item": _ctx.isRecent,
|
|
2458
|
+
"is-selected": isSameDateRange(date, _ctx.defaultDate),
|
|
2459
|
+
"is-disabled": !unref(validateDateRange)(date)
|
|
2460
|
+
}),
|
|
2461
|
+
onClick: ($event) => unref(validateDateRange)(date) && handleChange(date.dateValue),
|
|
2462
|
+
onMouseenter: (e) => handleShowDisableMsg(e, date),
|
|
2463
|
+
onMouseleave: handleHideDisableMsg
|
|
2464
|
+
}, toDisplayString(date.toDisplayString()), 43, _hoisted_2$6);
|
|
2465
|
+
}),
|
|
2466
|
+
128
|
|
2467
|
+
/* KEYED_FRAGMENT */
|
|
2468
|
+
))
|
|
2469
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_3$5, [
|
|
2470
|
+
createVNode(unref(Exception), {
|
|
2471
|
+
class: "empty-content",
|
|
2472
|
+
scene: "part",
|
|
2473
|
+
type: "empty"
|
|
2474
|
+
}),
|
|
2475
|
+
createElementVNode(
|
|
2476
|
+
"div",
|
|
2477
|
+
_hoisted_4$4,
|
|
2478
|
+
toDisplayString(_ctx.isRecent ? unref(t)("暂无最近使用记录") : unref(t)("暂无常用时间")),
|
|
2479
|
+
1
|
|
2480
|
+
/* TEXT */
|
|
2481
|
+
)
|
|
2482
|
+
]));
|
|
2483
|
+
};
|
|
2484
|
+
}
|
|
2485
|
+
});
|
|
2486
|
+
const _export_sfc = (sfc, props) => {
|
|
2487
|
+
const target = sfc.__vccOpts || sfc;
|
|
2488
|
+
for (const [key, val] of props) {
|
|
2489
|
+
target[key] = val;
|
|
2490
|
+
}
|
|
2491
|
+
return target;
|
|
2492
|
+
};
|
|
2493
|
+
const DateList = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-ed496942"]]);
|
|
2494
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
2495
|
+
__name: "common-submit",
|
|
2496
|
+
props: {
|
|
2497
|
+
disabled: { type: Boolean },
|
|
2498
|
+
disableTips: {}
|
|
2499
|
+
},
|
|
2500
|
+
emits: ["submit"],
|
|
2501
|
+
setup(__props) {
|
|
2502
|
+
return (_ctx, _cache) => {
|
|
2503
|
+
var _a;
|
|
2504
|
+
return openBlock(), createElementBlock(
|
|
2505
|
+
Fragment,
|
|
2506
|
+
null,
|
|
2507
|
+
[
|
|
2508
|
+
createVNode(unref(Popover), {
|
|
2509
|
+
content: _ctx.disableTips,
|
|
2510
|
+
disabled: !_ctx.disabled || !((_a = _ctx.disableTips) == null ? void 0 : _a.length)
|
|
2511
|
+
}, {
|
|
2512
|
+
default: withCtx(() => [
|
|
2513
|
+
createVNode(unref(Button), {
|
|
2514
|
+
class: "common-submit",
|
|
2515
|
+
disabled: _ctx.disabled,
|
|
2516
|
+
outline: true,
|
|
2517
|
+
theme: "primary",
|
|
2518
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("submit"))
|
|
2519
|
+
}, {
|
|
2520
|
+
default: withCtx(() => [
|
|
2521
|
+
createTextVNode(
|
|
2522
|
+
toDisplayString(unref(t)("确定")),
|
|
2523
|
+
1
|
|
1926
2524
|
/* TEXT */
|
|
1927
2525
|
)
|
|
1928
2526
|
]),
|
|
@@ -1933,480 +2531,650 @@ const _a = (l, a = "start", i) => {
|
|
|
1933
2531
|
_: 1
|
|
1934
2532
|
/* STABLE */
|
|
1935
2533
|
}, 8, ["content", "disabled"]),
|
|
1936
|
-
|
|
2534
|
+
createCommentVNode("v-if", true)
|
|
1937
2535
|
],
|
|
1938
2536
|
64
|
|
1939
2537
|
/* STABLE_FRAGMENT */
|
|
1940
2538
|
);
|
|
1941
2539
|
};
|
|
1942
2540
|
}
|
|
1943
|
-
})
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
const
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
class: "date-grid-item not-click"
|
|
2063
|
-
},
|
|
2064
|
-
k(Y),
|
|
2541
|
+
});
|
|
2542
|
+
const _hoisted_1$7 = { class: "date-panel" };
|
|
2543
|
+
const _hoisted_2$5 = {
|
|
2544
|
+
key: 0,
|
|
2545
|
+
class: "date-panel-title"
|
|
2546
|
+
};
|
|
2547
|
+
const _hoisted_3$4 = { class: "date-panel-main" };
|
|
2548
|
+
const _hoisted_4$3 = { class: "date-header" };
|
|
2549
|
+
const _hoisted_5$2 = { class: "date-header-left" };
|
|
2550
|
+
const _hoisted_6$2 = { class: "date-header-center" };
|
|
2551
|
+
const _hoisted_7$2 = { class: "date-header-right" };
|
|
2552
|
+
const _hoisted_8$1 = { class: "date-content" };
|
|
2553
|
+
const _hoisted_9 = { class: "date-grid" };
|
|
2554
|
+
const _hoisted_10 = ["onClick"];
|
|
2555
|
+
const panelRowCount = 6;
|
|
2556
|
+
const weekItemCount = 7;
|
|
2557
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
2558
|
+
__name: "date-panel",
|
|
2559
|
+
props: {
|
|
2560
|
+
disableNow: { type: Boolean },
|
|
2561
|
+
format: { default: "YYYY-MM-DD HH:mm:ss" },
|
|
2562
|
+
isNow: { type: Boolean },
|
|
2563
|
+
minDate: {},
|
|
2564
|
+
modelValue: {},
|
|
2565
|
+
showTitle: { type: Boolean, default: true },
|
|
2566
|
+
title: {}
|
|
2567
|
+
},
|
|
2568
|
+
emits: ["update:isNow", "update:modelValue"],
|
|
2569
|
+
setup(__props, { emit: __emit }) {
|
|
2570
|
+
const props = __props;
|
|
2571
|
+
const emits = __emit;
|
|
2572
|
+
const weekList = lang === "en" ? ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] : ["日", "一", "二", "三", "四", "五", "六"];
|
|
2573
|
+
const panelDateList = shallowRef([]);
|
|
2574
|
+
const today = dayjs();
|
|
2575
|
+
const curPanelDate = shallowRef(props.modelValue || today);
|
|
2576
|
+
const { validateDayjs } = useValidate();
|
|
2577
|
+
watch(
|
|
2578
|
+
curPanelDate,
|
|
2579
|
+
() => {
|
|
2580
|
+
const firstDay = curPanelDate.value.startOf("month").startOf("week").add(-1, "day");
|
|
2581
|
+
const list = [];
|
|
2582
|
+
for (let i = 0; i < panelRowCount * weekItemCount; i++) {
|
|
2583
|
+
list.push(firstDay.add(i, "day"));
|
|
2584
|
+
}
|
|
2585
|
+
panelDateList.value = list;
|
|
2586
|
+
},
|
|
2587
|
+
{
|
|
2588
|
+
immediate: true
|
|
2589
|
+
}
|
|
2590
|
+
);
|
|
2591
|
+
const nextMonth = (number) => {
|
|
2592
|
+
curPanelDate.value = curPanelDate.value.add(number, "month");
|
|
2593
|
+
};
|
|
2594
|
+
const nextYear = (number) => {
|
|
2595
|
+
curPanelDate.value = curPanelDate.value.add(number, "year");
|
|
2596
|
+
};
|
|
2597
|
+
const handleDateChange = (date) => {
|
|
2598
|
+
if (!validateDayjs(date) || props.minDate && date.isBefore(props.minDate, "day")) {
|
|
2599
|
+
return;
|
|
2600
|
+
}
|
|
2601
|
+
emits("update:modelValue", date);
|
|
2602
|
+
};
|
|
2603
|
+
let timeout;
|
|
2604
|
+
const handleMouseDown = (e) => {
|
|
2605
|
+
e.preventDefault();
|
|
2606
|
+
if (props.disableNow) return;
|
|
2607
|
+
if (timeout) return;
|
|
2608
|
+
emits("update:isNow", !props.isNow);
|
|
2609
|
+
timeout = setTimeout(() => {
|
|
2610
|
+
clearTimeout(timeout);
|
|
2611
|
+
timeout = null;
|
|
2612
|
+
}, 500);
|
|
2613
|
+
};
|
|
2614
|
+
return (_ctx, _cache) => {
|
|
2615
|
+
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
2616
|
+
_ctx.showTitle ? (openBlock(), createElementBlock("div", _hoisted_2$5, [
|
|
2617
|
+
createTextVNode(
|
|
2618
|
+
toDisplayString(_ctx.title) + " ",
|
|
2619
|
+
1
|
|
2620
|
+
/* TEXT */
|
|
2621
|
+
),
|
|
2622
|
+
createElementVNode(
|
|
2623
|
+
"span",
|
|
2624
|
+
{
|
|
2625
|
+
class: "title-check",
|
|
2626
|
+
onMousedown: handleMouseDown
|
|
2627
|
+
},
|
|
2628
|
+
[
|
|
2629
|
+
createVNode(unref(Checkbox), {
|
|
2630
|
+
disabled: _ctx.disableNow,
|
|
2631
|
+
"model-value": _ctx.isNow,
|
|
2632
|
+
size: "small"
|
|
2633
|
+
}, {
|
|
2634
|
+
default: withCtx(() => _cache[4] || (_cache[4] = [
|
|
2635
|
+
createTextVNode(" now ")
|
|
2636
|
+
])),
|
|
2637
|
+
_: 1
|
|
2638
|
+
/* STABLE */
|
|
2639
|
+
}, 8, ["disabled", "model-value"])
|
|
2640
|
+
],
|
|
2641
|
+
32
|
|
2642
|
+
/* NEED_HYDRATION */
|
|
2643
|
+
)
|
|
2644
|
+
])) : createCommentVNode("v-if", true),
|
|
2645
|
+
createElementVNode("div", _hoisted_3$4, [
|
|
2646
|
+
createElementVNode("div", _hoisted_4$3, [
|
|
2647
|
+
createElementVNode("div", _hoisted_5$2, [
|
|
2648
|
+
createVNode(unref(AngleDoubleLeft), {
|
|
2649
|
+
class: "hand-icon",
|
|
2650
|
+
onClick: _cache[0] || (_cache[0] = ($event) => nextYear(-1))
|
|
2651
|
+
}),
|
|
2652
|
+
createVNode(unref(AngleLeft), {
|
|
2653
|
+
class: "hand-icon",
|
|
2654
|
+
onClick: _cache[1] || (_cache[1] = ($event) => nextMonth(-1))
|
|
2655
|
+
})
|
|
2656
|
+
]),
|
|
2657
|
+
createElementVNode("div", _hoisted_6$2, [
|
|
2658
|
+
createTextVNode(
|
|
2659
|
+
toDisplayString(curPanelDate.value.year()),
|
|
2065
2660
|
1
|
|
2066
2661
|
/* TEXT */
|
|
2067
|
-
)
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2662
|
+
),
|
|
2663
|
+
_cache[5] || (_cache[5] = createElementVNode(
|
|
2664
|
+
"span",
|
|
2665
|
+
{ class: "date-split" },
|
|
2666
|
+
null,
|
|
2667
|
+
-1
|
|
2668
|
+
/* HOISTED */
|
|
2669
|
+
)),
|
|
2670
|
+
createTextVNode(
|
|
2671
|
+
toDisplayString(curPanelDate.value.month() + 1),
|
|
2672
|
+
1
|
|
2673
|
+
/* TEXT */
|
|
2674
|
+
)
|
|
2675
|
+
]),
|
|
2676
|
+
createElementVNode("div", _hoisted_7$2, [
|
|
2677
|
+
createVNode(unref(AngleRight), {
|
|
2678
|
+
class: "hand-icon",
|
|
2679
|
+
onClick: _cache[2] || (_cache[2] = ($event) => nextMonth(1))
|
|
2680
|
+
}),
|
|
2681
|
+
createVNode(unref(AngleDoubleRight), {
|
|
2682
|
+
class: "hand-icon",
|
|
2683
|
+
onClick: _cache[3] || (_cache[3] = ($event) => nextYear(1))
|
|
2684
|
+
})
|
|
2685
|
+
])
|
|
2071
2686
|
]),
|
|
2072
|
-
(
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
key: Y,
|
|
2077
|
-
class: "date-grid"
|
|
2078
|
-
}, [
|
|
2079
|
-
(p(!0), z(
|
|
2080
|
-
U,
|
|
2687
|
+
createElementVNode("div", _hoisted_8$1, [
|
|
2688
|
+
createElementVNode("ul", _hoisted_9, [
|
|
2689
|
+
(openBlock(true), createElementBlock(
|
|
2690
|
+
Fragment,
|
|
2081
2691
|
null,
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
"
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2692
|
+
renderList(unref(weekList), (day, index) => {
|
|
2693
|
+
return openBlock(), createElementBlock(
|
|
2694
|
+
"li",
|
|
2695
|
+
{
|
|
2696
|
+
key: index,
|
|
2697
|
+
class: "date-grid-item not-click"
|
|
2698
|
+
},
|
|
2699
|
+
toDisplayString(day),
|
|
2700
|
+
1
|
|
2701
|
+
/* TEXT */
|
|
2702
|
+
);
|
|
2703
|
+
}),
|
|
2093
2704
|
128
|
|
2094
2705
|
/* KEYED_FRAGMENT */
|
|
2095
2706
|
))
|
|
2096
|
-
])
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2707
|
+
]),
|
|
2708
|
+
(openBlock(), createElementBlock(
|
|
2709
|
+
Fragment,
|
|
2710
|
+
null,
|
|
2711
|
+
renderList(panelRowCount, (row) => {
|
|
2712
|
+
return createElementVNode("ul", {
|
|
2713
|
+
key: row,
|
|
2714
|
+
class: "date-grid"
|
|
2715
|
+
}, [
|
|
2716
|
+
(openBlock(true), createElementBlock(
|
|
2717
|
+
Fragment,
|
|
2718
|
+
null,
|
|
2719
|
+
renderList(panelDateList.value.slice((row - 1) * weekItemCount, (row - 1) * weekItemCount + weekItemCount), (date) => {
|
|
2720
|
+
return openBlock(), createElementBlock("li", {
|
|
2721
|
+
key: date.unix(),
|
|
2722
|
+
class: normalizeClass(["date-grid-item", {
|
|
2723
|
+
"is-last-month": date.isBefore(curPanelDate.value, "month"),
|
|
2724
|
+
"is-next-month": date.isAfter(curPanelDate.value, "month"),
|
|
2725
|
+
"is-today": date.isSame(unref(today), "day"),
|
|
2726
|
+
"is-disabled": !unref(validateDayjs)(date) || _ctx.minDate && date.isBefore(_ctx.minDate, "day"),
|
|
2727
|
+
"is-selected": props.modelValue && date.isSame(props.modelValue, "day")
|
|
2728
|
+
}]),
|
|
2729
|
+
onClick: withModifiers(($event) => handleDateChange(date), ["prevent"])
|
|
2730
|
+
}, toDisplayString(date.date()), 11, _hoisted_10);
|
|
2731
|
+
}),
|
|
2732
|
+
128
|
|
2733
|
+
/* KEYED_FRAGMENT */
|
|
2734
|
+
))
|
|
2735
|
+
]);
|
|
2736
|
+
}),
|
|
2737
|
+
64
|
|
2738
|
+
/* STABLE_FRAGMENT */
|
|
2739
|
+
))
|
|
2740
|
+
])
|
|
2100
2741
|
])
|
|
2101
|
-
])
|
|
2102
|
-
|
|
2742
|
+
]);
|
|
2743
|
+
};
|
|
2103
2744
|
}
|
|
2104
|
-
})
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
d: "M558.933 465.067h-93.866v93.866h93.866v-93.866z m0 162.133h-93.866v93.867h93.866V627.2z m371.2-533.333h-93.866V21.333c0-12.8-8.534-21.333-21.334-21.333S793.6 8.533 793.6 21.333V89.6H234.667V21.333c0-12.8-12.8-21.333-25.6-21.333s-21.334 8.533-21.334 21.333V89.6H93.867C42.667 93.867 0 136.533 0 187.733V934.4c0 46.933 42.667 89.6 93.867 89.6h836.266c51.2 0 93.867-42.667 93.867-93.867v-742.4c0-51.2-42.667-93.866-93.867-93.866z m46.934 836.266c0 25.6-21.334 46.934-46.934 46.934H93.867c-25.6 0-46.934-21.334-46.934-46.934V371.2h930.134v558.933z m0-605.866H46.933V187.733c0-25.6 21.334-46.933 46.934-46.933h93.866v68.267c0 12.8 8.534 21.333 21.334 21.333s21.333-8.533 21.333-21.333V140.8h558.933v68.267c0 12.8 8.534 21.333 21.334 21.333S832 221.867 832 209.067V140.8h93.867c25.6 0 46.933 21.333 46.933 46.933v136.534h4.267zM789.333 627.2h-93.866v93.867h93.866V627.2z m0-162.133h-93.866v93.866h93.866v-93.866z m-230.4 324.266h-93.866V883.2h93.866v-93.867z m-234.666 0h-89.6V883.2h93.866v-93.867h-4.266z m0-324.266h-89.6v93.866h93.866v-93.866h-4.266z m0 162.133h-89.6v93.867h93.866V627.2h-4.266z",
|
|
2119
|
-
fill: "#C4C6CC",
|
|
2120
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
2121
|
-
})
|
|
2122
|
-
])
|
|
2123
|
-
],
|
|
2124
|
-
-1
|
|
2125
|
-
/* HOISTED */
|
|
2126
|
-
), nt = ["placeholder", "value"], rt = /* @__PURE__ */ v(
|
|
2127
|
-
"span",
|
|
2128
|
-
{ class: "date-picker-split" },
|
|
2129
|
-
"~",
|
|
2130
|
-
-1
|
|
2131
|
-
/* HOISTED */
|
|
2132
|
-
), lt = ["placeholder", "value"], st = { class: "show-format" }, ct = { class: "date-format-wrapper" }, ut = { class: "content-title" }, ot = { class: "content-table" }, dt = /* @__PURE__ */ X({
|
|
2745
|
+
});
|
|
2746
|
+
const _hoisted_1$6 = { class: "date-wrapper" };
|
|
2747
|
+
const _hoisted_2$4 = { class: "date-input" };
|
|
2748
|
+
const _hoisted_3$3 = ["placeholder", "value"];
|
|
2749
|
+
const _hoisted_4$2 = ["placeholder", "value"];
|
|
2750
|
+
const _hoisted_5$1 = {
|
|
2751
|
+
key: 0,
|
|
2752
|
+
style: { "margin": "-8px 0 8px", "color": "#ea3636" }
|
|
2753
|
+
};
|
|
2754
|
+
const _hoisted_6$1 = { class: "show-format" };
|
|
2755
|
+
const _hoisted_7$1 = { class: "content-table" };
|
|
2756
|
+
const _hoisted_8 = ["onClick"];
|
|
2757
|
+
const DefaultCommitFormat = "YYYY-MM-DD HH:mm:ss";
|
|
2758
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
2133
2759
|
__name: "date-picker",
|
|
2134
2760
|
props: {
|
|
2135
2761
|
value: {}
|
|
2136
2762
|
},
|
|
2137
2763
|
emits: ["change"],
|
|
2138
|
-
setup(
|
|
2139
|
-
|
|
2140
|
-
const
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2764
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2765
|
+
dayjs.extend(customParseFormat);
|
|
2766
|
+
const props = __props;
|
|
2767
|
+
const emits = __emit;
|
|
2768
|
+
const startInput = ref(null);
|
|
2769
|
+
const endInput = ref(null);
|
|
2770
|
+
const showStartPanel = ref(false);
|
|
2771
|
+
const showEndPanel = ref(false);
|
|
2772
|
+
const startDate = shallowRef();
|
|
2773
|
+
const endDate = shallowRef();
|
|
2774
|
+
const isStartNow = ref(false);
|
|
2775
|
+
const isEndNow = ref(false);
|
|
2776
|
+
const { format, timezoneInfo, formatChange, enableFormatClick } = useDatePickerInject();
|
|
2777
|
+
const today = dayjs();
|
|
2778
|
+
const isValidate = ref(true);
|
|
2779
|
+
const { validMsg, validateDateValue } = useValidate();
|
|
2780
|
+
const curTimezoneInfo = ref(timezoneInfo.value || dayjs.tz.guess());
|
|
2781
|
+
const canConfirm = computed(() => {
|
|
2782
|
+
if (!startDate.value || !endDate.value) return false;
|
|
2783
|
+
if (!startDate.value.isValid() || !endDate.value.isValid()) return false;
|
|
2784
|
+
if (startDate.value.isSame(endDate.value, "ms")) return false;
|
|
2785
|
+
if (startDate.value.format(format.value) === endDate.value.format(format.value)) return false;
|
|
2786
|
+
if (startDate.value.isAfter(endDate.value)) return false;
|
|
2787
|
+
return true;
|
|
2788
|
+
});
|
|
2789
|
+
const handleFormatChange = (f) => {
|
|
2790
|
+
formatChange(f);
|
|
2791
|
+
};
|
|
2792
|
+
watch(
|
|
2793
|
+
() => props.value,
|
|
2794
|
+
(date) => {
|
|
2795
|
+
const { dateValue, endDate: dateEnd, startDate: dateStart } = date;
|
|
2796
|
+
startDate.value = dateStart;
|
|
2797
|
+
endDate.value = dateEnd;
|
|
2798
|
+
isStartNow.value = dateValue[0] === NowConstant;
|
|
2799
|
+
isEndNow.value = dateValue[1] === NowConstant;
|
|
2146
2800
|
},
|
|
2147
2801
|
{
|
|
2148
|
-
immediate:
|
|
2802
|
+
immediate: true
|
|
2149
2803
|
}
|
|
2150
2804
|
);
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
if (
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2805
|
+
watch(
|
|
2806
|
+
() => timezoneInfo,
|
|
2807
|
+
(newTimezone) => {
|
|
2808
|
+
if (!timezoneInfo.value) return;
|
|
2809
|
+
if (newTimezone.value.label === curTimezoneInfo.value.label) return;
|
|
2810
|
+
if (newTimezone.value.utc === curTimezoneInfo.value.utc) return;
|
|
2811
|
+
curTimezoneInfo.value = newTimezone.value || dayjs.tz.guess();
|
|
2812
|
+
if (startDate.value) {
|
|
2813
|
+
startDate.value = dayjs.tz(startDate.value, curTimezoneInfo.value.label);
|
|
2814
|
+
startInput.value.value = startDate.value.format(format.value);
|
|
2160
2815
|
}
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2816
|
+
if (endDate.value) {
|
|
2817
|
+
endDate.value = dayjs.tz(endDate.value, curTimezoneInfo.value.label);
|
|
2818
|
+
endInput.value.value = endDate.value.format(format.value);
|
|
2819
|
+
}
|
|
2820
|
+
},
|
|
2821
|
+
{
|
|
2822
|
+
deep: true
|
|
2823
|
+
}
|
|
2824
|
+
);
|
|
2825
|
+
onActivated(() => {
|
|
2826
|
+
setTimeout(() => {
|
|
2827
|
+
var _a;
|
|
2828
|
+
(_a = startInput.value) == null ? void 0 : _a.focus();
|
|
2829
|
+
handleFocusStart();
|
|
2830
|
+
}, 200);
|
|
2831
|
+
});
|
|
2832
|
+
const handleInputEnter = async (_, type) => {
|
|
2833
|
+
var _a, _b, _c;
|
|
2834
|
+
const target = type === "start" ? startInput.value : endInput.value;
|
|
2835
|
+
const val = (_a = target == null ? void 0 : target.value) == null ? void 0 : _a.toString().trim();
|
|
2836
|
+
const editDate = type === "start" ? startDate.value : endDate.value;
|
|
2837
|
+
const curNow = type === "start" ? isStartNow : isEndNow;
|
|
2838
|
+
const otherNow = type === "start" ? isEndNow : isStartNow;
|
|
2839
|
+
const formatValue = editDate == null ? void 0 : editDate.format(format.value);
|
|
2840
|
+
if (val === formatValue) return;
|
|
2841
|
+
if (!val || val === NowConstant && curNow.value) return;
|
|
2842
|
+
if (val === NowConstant && !curNow.value && !otherNow.value) {
|
|
2843
|
+
handleIsNowChange(type);
|
|
2844
|
+
return;
|
|
2845
|
+
}
|
|
2846
|
+
let date = inputVal2Dayjs(val, format.value, editDate);
|
|
2847
|
+
if (date.isValid()) {
|
|
2848
|
+
if (!(editDate == null ? void 0 : editDate.isSame(date))) {
|
|
2849
|
+
curNow.value = val === NowConstant;
|
|
2850
|
+
if (type === "start") {
|
|
2851
|
+
handleStartTimeChange(!startDate.value ? date.startOf("d") : date);
|
|
2852
|
+
} else {
|
|
2853
|
+
handleEndTimeChange(!endDate.value ? date.endOf("d") : date);
|
|
2178
2854
|
}
|
|
2179
2855
|
}
|
|
2180
|
-
F || (F = d(w)), F.isValid() && (R != null && R.isSame(F) || (ea.value = w === C, u === "start" ? P(c ? F : F.startOf("d")) : B(s ? F : F.endOf("d")))), M.value = u === "start" ? ((Ea = c.value) == null ? void 0 : Ea.format(S.value)) || "" : ((Sa = s.value) == null ? void 0 : Sa.format(S.value)) || "";
|
|
2181
|
-
}, 16);
|
|
2182
|
-
}, H = () => {
|
|
2183
|
-
h.value = !0, g();
|
|
2184
|
-
}, _ = () => {
|
|
2185
|
-
m.value = !0, A();
|
|
2186
|
-
}, A = (f = 32) => {
|
|
2187
|
-
setTimeout(() => h.value = !1, f);
|
|
2188
|
-
}, g = (f = 32) => {
|
|
2189
|
-
setTimeout(() => m.value = !1, f);
|
|
2190
|
-
}, P = (f) => {
|
|
2191
|
-
var u, M;
|
|
2192
|
-
(u = c.value) != null && u.isSame(f) || (c.value = f, o.value = !1), s.value || ((M = b.value) == null || M.focus(), _()), A();
|
|
2193
|
-
}, B = (f) => {
|
|
2194
|
-
var u, M;
|
|
2195
|
-
(u = s.value) != null && u.isSame(f) || (s.value = f, y.value = !1), c.value || ((M = n.value) == null || M.focus(), H()), g();
|
|
2196
|
-
}, x = (f) => {
|
|
2197
|
-
f === "start" ? (o.value = !o.value, y.value = !1, c.value = d(), s.value ? o.value && A() : (setTimeout(() => {
|
|
2198
|
-
var u;
|
|
2199
|
-
(u = b.value) == null || u.focus(), _();
|
|
2200
|
-
}, 200), A())) : (y.value = !y.value, o.value = !1, s.value = d(), c.value ? y.value && g() : (setTimeout(() => {
|
|
2201
|
-
var u;
|
|
2202
|
-
(u = n.value) == null || u.focus(), H();
|
|
2203
|
-
}, 200), g()));
|
|
2204
|
-
}, T = () => {
|
|
2205
|
-
c.value = void 0, s.value = void 0, o.value = !1, y.value = !1, A(), g();
|
|
2206
|
-
}, V = () => {
|
|
2207
|
-
if (c.value && s.value) {
|
|
2208
|
-
const f = o.value ? C : c.value.tz(D.value.label, !0).valueOf(), u = y.value ? C : s.value.tz(D.value.label, !0).valueOf();
|
|
2209
|
-
e("change", [f || "", u || ""]);
|
|
2210
2856
|
}
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
};
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2857
|
+
target.value = type === "start" ? ((_b = startDate.value) == null ? void 0 : _b.format(format.value)) || "" : ((_c = endDate.value) == null ? void 0 : _c.format(format.value)) || "";
|
|
2858
|
+
};
|
|
2859
|
+
const handleFocusStart = () => {
|
|
2860
|
+
showStartPanel.value = true;
|
|
2861
|
+
isValidate.value = true;
|
|
2862
|
+
hiddenEndPanel();
|
|
2863
|
+
};
|
|
2864
|
+
const handleFocusEnd = () => {
|
|
2865
|
+
showEndPanel.value = true;
|
|
2866
|
+
isValidate.value = true;
|
|
2867
|
+
hiddenStartPanel();
|
|
2868
|
+
};
|
|
2869
|
+
const hiddenStartPanel = (interval = 32) => {
|
|
2870
|
+
setTimeout(() => showStartPanel.value = false, interval);
|
|
2871
|
+
};
|
|
2872
|
+
const hiddenEndPanel = (interval = 32) => {
|
|
2873
|
+
setTimeout(() => showEndPanel.value = false, interval);
|
|
2874
|
+
};
|
|
2875
|
+
const handleStartTimeChange = (date) => {
|
|
2876
|
+
var _a, _b;
|
|
2877
|
+
if (!((_a = startDate.value) == null ? void 0 : _a.isSame(date))) {
|
|
2878
|
+
startDate.value = date;
|
|
2879
|
+
isStartNow.value = false;
|
|
2880
|
+
}
|
|
2881
|
+
(_b = endInput.value) == null ? void 0 : _b.focus();
|
|
2882
|
+
handleFocusEnd();
|
|
2883
|
+
hiddenStartPanel();
|
|
2884
|
+
};
|
|
2885
|
+
const handleEndTimeChange = (date) => {
|
|
2886
|
+
var _a, _b;
|
|
2887
|
+
if (!((_a = endDate.value) == null ? void 0 : _a.isSame(date))) {
|
|
2888
|
+
endDate.value = date;
|
|
2889
|
+
isEndNow.value = false;
|
|
2890
|
+
}
|
|
2891
|
+
if (!startDate.value) {
|
|
2892
|
+
(_b = startInput.value) == null ? void 0 : _b.focus();
|
|
2893
|
+
handleFocusStart();
|
|
2894
|
+
}
|
|
2895
|
+
hiddenEndPanel();
|
|
2896
|
+
};
|
|
2897
|
+
const handleIsNowChange = (type) => {
|
|
2898
|
+
if (type === "start") {
|
|
2899
|
+
isStartNow.value = !isStartNow.value;
|
|
2900
|
+
isEndNow.value = false;
|
|
2901
|
+
startDate.value = dayjs();
|
|
2902
|
+
if (!endDate.value) {
|
|
2903
|
+
setTimeout(() => {
|
|
2904
|
+
var _a;
|
|
2905
|
+
(_a = endInput.value) == null ? void 0 : _a.focus();
|
|
2906
|
+
handleFocusEnd();
|
|
2907
|
+
}, 200);
|
|
2908
|
+
hiddenStartPanel();
|
|
2909
|
+
} else if (isStartNow.value) {
|
|
2910
|
+
hiddenStartPanel();
|
|
2911
|
+
}
|
|
2912
|
+
} else {
|
|
2913
|
+
isEndNow.value = !isEndNow.value;
|
|
2914
|
+
isStartNow.value = false;
|
|
2915
|
+
endDate.value = dayjs();
|
|
2916
|
+
if (!startDate.value) {
|
|
2917
|
+
setTimeout(() => {
|
|
2918
|
+
var _a;
|
|
2919
|
+
(_a = startInput.value) == null ? void 0 : _a.focus();
|
|
2920
|
+
handleFocusStart();
|
|
2921
|
+
}, 200);
|
|
2922
|
+
hiddenEndPanel();
|
|
2923
|
+
} else if (isEndNow.value) {
|
|
2924
|
+
hiddenEndPanel();
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
};
|
|
2928
|
+
const handleClear = () => {
|
|
2929
|
+
startDate.value = void 0;
|
|
2930
|
+
endDate.value = void 0;
|
|
2931
|
+
isStartNow.value = false;
|
|
2932
|
+
isEndNow.value = false;
|
|
2933
|
+
hiddenStartPanel();
|
|
2934
|
+
hiddenEndPanel();
|
|
2935
|
+
};
|
|
2936
|
+
const handleSubmit = () => {
|
|
2937
|
+
if (startDate.value && endDate.value && canConfirm.value) {
|
|
2938
|
+
const startValue = isStartNow.value ? NowConstant : dayjs.tz(startDate.value.format(format.value ?? DefaultCommitFormat), timezoneInfo.value.label).valueOf();
|
|
2939
|
+
const endValue = isEndNow.value ? NowConstant : dayjs.tz(endDate.value.format(format.value ?? DefaultCommitFormat), timezoneInfo.value.label).valueOf();
|
|
2940
|
+
isValidate.value = validateDateValue([startValue || "", endValue || ""]);
|
|
2941
|
+
if (!isValidate.value) return;
|
|
2942
|
+
emits("change", [startValue || "", endValue || ""]);
|
|
2943
|
+
}
|
|
2944
|
+
};
|
|
2945
|
+
const handleClickoutsideStart = (e) => {
|
|
2946
|
+
var _a;
|
|
2947
|
+
if (!showStartPanel.value) return;
|
|
2948
|
+
if (!((_a = document.querySelector(".__date-picker-popover-start__")) == null ? void 0 : _a.contains(e.target))) {
|
|
2949
|
+
hiddenStartPanel();
|
|
2950
|
+
}
|
|
2951
|
+
};
|
|
2952
|
+
const handleClickoutsideEnd = (e) => {
|
|
2953
|
+
var _a;
|
|
2954
|
+
if (!showEndPanel.value) return;
|
|
2955
|
+
if (!((_a = document.querySelector(".__date-picker-popover-end__")) == null ? void 0 : _a.contains(e.target))) {
|
|
2956
|
+
hiddenEndPanel();
|
|
2957
|
+
}
|
|
2958
|
+
};
|
|
2959
|
+
__expose({
|
|
2960
|
+
handleSubmit
|
|
2961
|
+
});
|
|
2962
|
+
return (_ctx, _cache) => {
|
|
2963
|
+
var _a;
|
|
2964
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
2965
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
2966
|
+
createElementVNode(
|
|
2223
2967
|
"div",
|
|
2224
2968
|
{
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2969
|
+
class: "date-picker",
|
|
2970
|
+
style: normalizeStyle({
|
|
2971
|
+
"border-color": !isValidate.value ? "#ea3636" : showStartPanel.value || showEndPanel.value ? "#3A84FF" : "#C4C6CC"
|
|
2972
|
+
})
|
|
2229
2973
|
},
|
|
2230
2974
|
[
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2975
|
+
_cache[8] || (_cache[8] = createElementVNode(
|
|
2976
|
+
"span",
|
|
2977
|
+
{ class: "date-picker-icon" },
|
|
2978
|
+
[
|
|
2979
|
+
createElementVNode("svg", {
|
|
2980
|
+
class: "date-content-icon",
|
|
2981
|
+
height: "14",
|
|
2982
|
+
version: "1.1",
|
|
2983
|
+
viewBox: "0 0 1024 1024",
|
|
2984
|
+
width: "14",
|
|
2985
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2986
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
2987
|
+
}, [
|
|
2988
|
+
createElementVNode("path", {
|
|
2989
|
+
d: "M558.933 465.067h-93.866v93.866h93.866v-93.866z m0 162.133h-93.866v93.867h93.866V627.2z m371.2-533.333h-93.866V21.333c0-12.8-8.534-21.333-21.334-21.333S793.6 8.533 793.6 21.333V89.6H234.667V21.333c0-12.8-12.8-21.333-25.6-21.333s-21.334 8.533-21.334 21.333V89.6H93.867C42.667 93.867 0 136.533 0 187.733V934.4c0 46.933 42.667 89.6 93.867 89.6h836.266c51.2 0 93.867-42.667 93.867-93.867v-742.4c0-51.2-42.667-93.866-93.867-93.866z m46.934 836.266c0 25.6-21.334 46.934-46.934 46.934H93.867c-25.6 0-46.934-21.334-46.934-46.934V371.2h930.134v558.933z m0-605.866H46.933V187.733c0-25.6 21.334-46.933 46.934-46.933h93.866v68.267c0 12.8 8.534 21.333 21.334 21.333s21.333-8.533 21.333-21.333V140.8h558.933v68.267c0 12.8 8.534 21.333 21.334 21.333S832 221.867 832 209.067V140.8h93.867c25.6 0 46.933 21.333 46.933 46.933v136.534h4.267zM789.333 627.2h-93.866v93.867h93.866V627.2z m0-162.133h-93.866v93.866h93.866v-93.866z m-230.4 324.266h-93.866V883.2h93.866v-93.867z m-234.666 0h-89.6V883.2h93.866v-93.867h-4.266z m0-324.266h-89.6v93.866h93.866v-93.866h-4.266z m0 162.133h-89.6v93.867h93.866V627.2h-4.266z",
|
|
2990
|
+
fill: "#C4C6CC",
|
|
2991
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2992
|
+
})
|
|
2993
|
+
])
|
|
2994
|
+
],
|
|
2995
|
+
-1
|
|
2996
|
+
/* HOISTED */
|
|
2997
|
+
)),
|
|
2998
|
+
createVNode(unref(Popover), {
|
|
2999
|
+
arrow: false,
|
|
2235
3000
|
boundary: "parent",
|
|
2236
3001
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-start__",
|
|
3002
|
+
"is-show": showStartPanel.value,
|
|
2237
3003
|
placement: "bottom-start",
|
|
2238
3004
|
theme: "light",
|
|
2239
3005
|
trigger: "manual"
|
|
2240
3006
|
}, {
|
|
2241
|
-
content:
|
|
2242
|
-
|
|
2243
|
-
"
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
"
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
"onUpdate:
|
|
2250
|
-
|
|
2251
|
-
}, null, 8, ["
|
|
3007
|
+
content: withCtx(() => [
|
|
3008
|
+
createVNode(_sfc_main$7, {
|
|
3009
|
+
key: "start",
|
|
3010
|
+
"disable-now": isEndNow.value,
|
|
3011
|
+
format: unref(format),
|
|
3012
|
+
"is-now": isStartNow.value,
|
|
3013
|
+
"model-value": startDate.value,
|
|
3014
|
+
title: unref(t)("开始时间"),
|
|
3015
|
+
"onUpdate:isNow": _cache[2] || (_cache[2] = () => handleIsNowChange("start")),
|
|
3016
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = (date) => handleStartTimeChange(date.startOf("d")))
|
|
3017
|
+
}, null, 8, ["disable-now", "format", "is-now", "model-value", "title"])
|
|
2252
3018
|
]),
|
|
2253
|
-
default:
|
|
2254
|
-
var
|
|
3019
|
+
default: withCtx(() => {
|
|
3020
|
+
var _a2;
|
|
2255
3021
|
return [
|
|
2256
|
-
|
|
2257
|
-
placeholder: t(r)("开始时间"),
|
|
2258
|
-
value: o.value ? t(C) : (w = c.value) == null ? void 0 : w.format(t(S)),
|
|
2259
|
-
onBlur: u[0] || (u[0] = (R) => $(R, "start")),
|
|
2260
|
-
onClick: H,
|
|
2261
|
-
onKeypress: u[1] || (u[1] = ja((R) => $(R, "start"), ["enter"])),
|
|
2262
|
-
class: "date-picker-start",
|
|
3022
|
+
withDirectives(createElementVNode("input", {
|
|
2263
3023
|
ref_key: "startInput",
|
|
2264
|
-
ref:
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
3024
|
+
ref: startInput,
|
|
3025
|
+
class: "date-picker-start",
|
|
3026
|
+
placeholder: unref(t)("开始时间"),
|
|
3027
|
+
spellcheck: "false",
|
|
3028
|
+
value: isStartNow.value ? unref(NowConstant) : (_a2 = startDate.value) == null ? void 0 : _a2.format(unref(format)),
|
|
3029
|
+
onBlur: _cache[0] || (_cache[0] = (e) => handleInputEnter(e, "start")),
|
|
3030
|
+
onClick: handleFocusStart,
|
|
3031
|
+
onKeypress: _cache[1] || (_cache[1] = withKeys((e) => handleInputEnter(e, "start"), ["enter"]))
|
|
3032
|
+
}, null, 40, _hoisted_3$3), [
|
|
3033
|
+
[unref(clickoutside), handleClickoutsideStart]
|
|
2268
3034
|
])
|
|
2269
3035
|
];
|
|
2270
3036
|
}),
|
|
2271
3037
|
_: 1
|
|
2272
3038
|
/* STABLE */
|
|
2273
3039
|
}, 8, ["is-show"]),
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
"
|
|
3040
|
+
_cache[9] || (_cache[9] = createElementVNode(
|
|
3041
|
+
"span",
|
|
3042
|
+
{ class: "date-picker-split" },
|
|
3043
|
+
"~",
|
|
3044
|
+
-1
|
|
3045
|
+
/* HOISTED */
|
|
3046
|
+
)),
|
|
3047
|
+
createVNode(unref(Popover), {
|
|
3048
|
+
arrow: false,
|
|
2278
3049
|
boundary: "parent",
|
|
2279
3050
|
"ext-cls": "__bk-date-picker-popover__ __date-picker-popover-end__",
|
|
3051
|
+
"is-show": showEndPanel.value,
|
|
2280
3052
|
placement: "bottom-start",
|
|
2281
3053
|
theme: "light",
|
|
2282
3054
|
trigger: "manual"
|
|
2283
3055
|
}, {
|
|
2284
|
-
content:
|
|
2285
|
-
|
|
2286
|
-
"
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
"
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
"onUpdate:
|
|
2293
|
-
|
|
2294
|
-
}, null, 8, ["
|
|
3056
|
+
content: withCtx(() => [
|
|
3057
|
+
createVNode(_sfc_main$7, {
|
|
3058
|
+
key: "end",
|
|
3059
|
+
"disable-now": isStartNow.value,
|
|
3060
|
+
format: unref(format),
|
|
3061
|
+
"is-now": isEndNow.value,
|
|
3062
|
+
"model-value": endDate.value,
|
|
3063
|
+
title: unref(t)("结束时间"),
|
|
3064
|
+
"onUpdate:isNow": _cache[6] || (_cache[6] = () => handleIsNowChange("end")),
|
|
3065
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = (date) => handleEndTimeChange(date.endOf("d")))
|
|
3066
|
+
}, null, 8, ["disable-now", "format", "is-now", "model-value", "title"])
|
|
2295
3067
|
]),
|
|
2296
|
-
default:
|
|
2297
|
-
var
|
|
3068
|
+
default: withCtx(() => {
|
|
3069
|
+
var _a2;
|
|
2298
3070
|
return [
|
|
2299
|
-
|
|
2300
|
-
placeholder: t(r)("结束时间"),
|
|
2301
|
-
value: y.value ? t(C) : (w = s.value) == null ? void 0 : w.format(t(S)),
|
|
2302
|
-
onBlur: u[3] || (u[3] = (R) => $(R, "end")),
|
|
2303
|
-
onClick: _,
|
|
2304
|
-
onKeypress: u[4] || (u[4] = ja((R) => $(R, "end"), ["enter"])),
|
|
2305
|
-
class: "date-picker-end",
|
|
3071
|
+
withDirectives(createElementVNode("input", {
|
|
2306
3072
|
ref_key: "endInput",
|
|
2307
|
-
ref:
|
|
2308
|
-
|
|
2309
|
-
|
|
3073
|
+
ref: endInput,
|
|
3074
|
+
class: "date-picker-end",
|
|
3075
|
+
placeholder: unref(t)("结束时间"),
|
|
3076
|
+
value: isEndNow.value ? unref(NowConstant) : (_a2 = endDate.value) == null ? void 0 : _a2.format(unref(format)),
|
|
3077
|
+
onBlur: _cache[4] || (_cache[4] = (e) => handleInputEnter(e, "end")),
|
|
3078
|
+
onClick: handleFocusEnd,
|
|
3079
|
+
onKeypress: _cache[5] || (_cache[5] = withKeys((e) => handleInputEnter(e, "end"), ["enter"]))
|
|
3080
|
+
}, null, 40, _hoisted_4$2), [
|
|
3081
|
+
[unref(clickoutside), handleClickoutsideEnd]
|
|
2310
3082
|
])
|
|
2311
3083
|
];
|
|
2312
3084
|
}),
|
|
2313
3085
|
_: 1
|
|
2314
3086
|
/* STABLE */
|
|
2315
3087
|
}, 8, ["is-show"]),
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
3088
|
+
createVNode(unref(Close), {
|
|
3089
|
+
class: "date-picker-clear",
|
|
3090
|
+
style: normalizeStyle({
|
|
3091
|
+
visibility: startDate.value || endDate.value ? "visible" : "hidden"
|
|
3092
|
+
}),
|
|
3093
|
+
onClick: handleClear
|
|
3094
|
+
}, null, 8, ["style"])
|
|
2321
3095
|
],
|
|
2322
3096
|
4
|
|
2323
3097
|
/* STYLE */
|
|
2324
3098
|
),
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
3099
|
+
createElementVNode("div", null, [
|
|
3100
|
+
createVNode(_sfc_main$8, {
|
|
3101
|
+
ref: "submit",
|
|
3102
|
+
"disable-tips": ((_a = startDate.value) == null ? void 0 : _a.isAfter(endDate.value)) ? unref(t)("开始时间不能大于结束时间") : "",
|
|
3103
|
+
disabled: !canConfirm.value,
|
|
3104
|
+
onSubmit: handleSubmit
|
|
3105
|
+
}, null, 8, ["disable-tips", "disabled"])
|
|
3106
|
+
])
|
|
2330
3107
|
]),
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
3108
|
+
!isValidate.value ? (openBlock(), createElementBlock(
|
|
3109
|
+
"div",
|
|
3110
|
+
_hoisted_5$1,
|
|
3111
|
+
toDisplayString(unref(validMsg)),
|
|
3112
|
+
1
|
|
3113
|
+
/* TEXT */
|
|
3114
|
+
)) : createCommentVNode("v-if", true),
|
|
3115
|
+
createElementVNode("div", _hoisted_6$1, [
|
|
3116
|
+
createCommentVNode(" {{ t('支持多种时间格式自动转换') }} "),
|
|
3117
|
+
createVNode(unref(Popover), {
|
|
3118
|
+
arrow: false,
|
|
2339
3119
|
"ext-cls": "__bk-date-picker-popover__",
|
|
2340
|
-
placement: "bottom",
|
|
2341
|
-
theme: "light"
|
|
3120
|
+
placement: "bottom-start",
|
|
3121
|
+
theme: "light",
|
|
3122
|
+
trigger: "click"
|
|
2342
3123
|
}, {
|
|
2343
|
-
content:
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
k(t(r)("格式")),
|
|
2359
|
-
1
|
|
2360
|
-
/* TEXT */
|
|
2361
|
-
),
|
|
2362
|
-
v(
|
|
2363
|
-
"th",
|
|
3124
|
+
content: withCtx(() => [
|
|
3125
|
+
createElementVNode(
|
|
3126
|
+
"div",
|
|
3127
|
+
{
|
|
3128
|
+
class: normalizeClass(["date-format-wrapper", { "enable-format-click": unref(enableFormatClick) }])
|
|
3129
|
+
},
|
|
3130
|
+
[
|
|
3131
|
+
createCommentVNode(` <div class="content-title">
|
|
3132
|
+
{{ t('时间格式支持') }}
|
|
3133
|
+
</div> `),
|
|
3134
|
+
createElementVNode("table", _hoisted_7$1, [
|
|
3135
|
+
createCommentVNode(" <thead>\n <tr>\n <th>{{ t('格式') }}</th>\n <th>{{ t('示例') }}</th>\n </tr>\n </thead> "),
|
|
3136
|
+
createElementVNode("tbody", null, [
|
|
3137
|
+
(openBlock(true), createElementBlock(
|
|
3138
|
+
Fragment,
|
|
2364
3139
|
null,
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
3140
|
+
renderList(unref(dateFormatList), (f) => {
|
|
3141
|
+
return openBlock(), createElementBlock("tr", { key: f }, [
|
|
3142
|
+
createElementVNode("td", {
|
|
3143
|
+
class: "cell-format-value",
|
|
3144
|
+
onClick: () => handleFormatChange(f)
|
|
3145
|
+
}, toDisplayString(f), 9, _hoisted_8),
|
|
3146
|
+
createElementVNode(
|
|
3147
|
+
"td",
|
|
3148
|
+
null,
|
|
3149
|
+
toDisplayString(unref(today).format(f)),
|
|
3150
|
+
1
|
|
3151
|
+
/* TEXT */
|
|
3152
|
+
)
|
|
3153
|
+
]);
|
|
3154
|
+
}),
|
|
3155
|
+
128
|
|
3156
|
+
/* KEYED_FRAGMENT */
|
|
3157
|
+
))
|
|
2369
3158
|
])
|
|
2370
|
-
]),
|
|
2371
|
-
v("tbody", null, [
|
|
2372
|
-
(p(!0), z(
|
|
2373
|
-
U,
|
|
2374
|
-
null,
|
|
2375
|
-
q(t(Ve), (w) => (p(), z("tr", { key: w }, [
|
|
2376
|
-
v(
|
|
2377
|
-
"td",
|
|
2378
|
-
null,
|
|
2379
|
-
k(w),
|
|
2380
|
-
1
|
|
2381
|
-
/* TEXT */
|
|
2382
|
-
),
|
|
2383
|
-
v(
|
|
2384
|
-
"td",
|
|
2385
|
-
null,
|
|
2386
|
-
k(t(N).format(w)),
|
|
2387
|
-
1
|
|
2388
|
-
/* TEXT */
|
|
2389
|
-
)
|
|
2390
|
-
]))),
|
|
2391
|
-
128
|
|
2392
|
-
/* KEYED_FRAGMENT */
|
|
2393
|
-
))
|
|
2394
3159
|
])
|
|
2395
|
-
]
|
|
2396
|
-
|
|
3160
|
+
],
|
|
3161
|
+
2
|
|
3162
|
+
/* CLASS */
|
|
3163
|
+
)
|
|
2397
3164
|
]),
|
|
2398
|
-
default:
|
|
2399
|
-
|
|
3165
|
+
default: withCtx(() => [
|
|
3166
|
+
createVNode(unref(Button), {
|
|
2400
3167
|
class: "format-button",
|
|
2401
3168
|
text: "",
|
|
2402
3169
|
theme: "primary"
|
|
2403
3170
|
}, {
|
|
2404
|
-
default:
|
|
2405
|
-
|
|
2406
|
-
|
|
3171
|
+
default: withCtx(() => [
|
|
3172
|
+
createTextVNode(
|
|
3173
|
+
toDisplayString(unref(t)("时间格式转换")) + " ",
|
|
2407
3174
|
1
|
|
2408
3175
|
/* TEXT */
|
|
2409
|
-
)
|
|
3176
|
+
),
|
|
3177
|
+
createVNode(unref(Transfer))
|
|
2410
3178
|
]),
|
|
2411
3179
|
_: 1
|
|
2412
3180
|
/* STABLE */
|
|
@@ -2419,434 +3187,774 @@ const _a = (l, a = "start", i) => {
|
|
|
2419
3187
|
]);
|
|
2420
3188
|
};
|
|
2421
3189
|
}
|
|
2422
|
-
})
|
|
3190
|
+
});
|
|
3191
|
+
const _hoisted_1$5 = { class: "date-title" };
|
|
3192
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
3193
|
+
__name: "date-title",
|
|
3194
|
+
emits: ["confirm"],
|
|
3195
|
+
setup(__props) {
|
|
3196
|
+
return (_ctx, _cache) => {
|
|
3197
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
3198
|
+
(openBlock(true), createElementBlock(
|
|
3199
|
+
Fragment,
|
|
3200
|
+
null,
|
|
3201
|
+
renderList(unref(panels), (item) => {
|
|
3202
|
+
return openBlock(), createElementBlock("div", {
|
|
3203
|
+
key: item.id,
|
|
3204
|
+
class: "date-title-item"
|
|
3205
|
+
}, [
|
|
3206
|
+
createTextVNode(
|
|
3207
|
+
toDisplayString(item.name) + " ",
|
|
3208
|
+
1
|
|
3209
|
+
/* TEXT */
|
|
3210
|
+
),
|
|
3211
|
+
item.id === "recent" ? (openBlock(), createBlock(unref(PopConfirm), {
|
|
3212
|
+
key: 0,
|
|
3213
|
+
"cancel-text": unref(t)("取消"),
|
|
3214
|
+
"confirm-text": unref(t)("确定"),
|
|
3215
|
+
content: unref(t)("是否清空最近使用?"),
|
|
3216
|
+
"ext-cls": "__bk-date-picker-popover__ __bk-date-picker-popover-delete__",
|
|
3217
|
+
trigger: "click",
|
|
3218
|
+
width: 189,
|
|
3219
|
+
onConfirm: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("confirm"))
|
|
3220
|
+
}, {
|
|
3221
|
+
default: withCtx(() => [
|
|
3222
|
+
createVNode(unref(Del), { class: "delete-all" })
|
|
3223
|
+
]),
|
|
3224
|
+
_: 1
|
|
3225
|
+
/* STABLE */
|
|
3226
|
+
}, 8, ["cancel-text", "confirm-text", "content"])) : createCommentVNode("v-if", true)
|
|
3227
|
+
]);
|
|
3228
|
+
}),
|
|
3229
|
+
128
|
|
3230
|
+
/* KEYED_FRAGMENT */
|
|
3231
|
+
))
|
|
3232
|
+
]);
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
3236
|
+
const DateTitle = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-03d5d182"]]);
|
|
3237
|
+
const _hoisted_1$4 = ["onClick"];
|
|
3238
|
+
const _hoisted_2$3 = {
|
|
3239
|
+
key: 0,
|
|
3240
|
+
style: { "margin": "-8px 0 4px", "color": "#ea3636" }
|
|
3241
|
+
};
|
|
3242
|
+
const splitDate = "__";
|
|
3243
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2423
3244
|
__name: "natural-picker",
|
|
2424
3245
|
props: {
|
|
2425
3246
|
value: {}
|
|
2426
3247
|
},
|
|
2427
3248
|
emits: ["change"],
|
|
2428
|
-
setup(
|
|
2429
|
-
const
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
3249
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3250
|
+
const emits = __emit;
|
|
3251
|
+
const props = __props;
|
|
3252
|
+
const inputRef = ref();
|
|
3253
|
+
const naturalSelectRef = ref();
|
|
3254
|
+
const naturalOptions = shallowRef(CommonNaturalOptions.slice());
|
|
3255
|
+
const naturalUnitValue = ref(naturalUnitOptions[0].id);
|
|
3256
|
+
const canEditNaturalId = ref("");
|
|
3257
|
+
const inputValue = ref();
|
|
3258
|
+
const naturalValue = ref(naturalOptions.value[0]);
|
|
3259
|
+
const isValidate = ref(true);
|
|
3260
|
+
const { validMsg, validateDateValue } = useValidate();
|
|
3261
|
+
getStoreDateList(getStoreKey(), "session").forEach((item) => {
|
|
3262
|
+
const [start, end] = item;
|
|
3263
|
+
if (dayjs.isDayjs(start) || dayjs.isDayjs(end)) return;
|
|
3264
|
+
const date = new DateRange(item);
|
|
3265
|
+
const { startNum, startUnit } = date;
|
|
3266
|
+
const specialDate = naturalOptions.value.find((item2) => item2.id === start);
|
|
3267
|
+
if (!specialDate) {
|
|
3268
|
+
const name = `${`${t("前")} ${startNum} ${t(
|
|
3269
|
+
shortTimeUnitLangData[startUnit]
|
|
2438
3270
|
)}`}`;
|
|
2439
|
-
|
|
2440
|
-
id:
|
|
2441
|
-
name
|
|
2442
|
-
type:
|
|
3271
|
+
naturalOptions.value.unshift({
|
|
3272
|
+
id: start,
|
|
3273
|
+
name,
|
|
3274
|
+
type: NaturalOptionType.custom
|
|
2443
3275
|
});
|
|
2444
3276
|
}
|
|
2445
|
-
})
|
|
2446
|
-
|
|
2447
|
-
(
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
const { startNum
|
|
2454
|
-
|
|
2455
|
-
const
|
|
2456
|
-
if (
|
|
2457
|
-
|
|
3277
|
+
});
|
|
3278
|
+
watch(
|
|
3279
|
+
() => props.value,
|
|
3280
|
+
(date) => {
|
|
3281
|
+
if (!date) return;
|
|
3282
|
+
if (date.dateMode !== DateMode.NATURAL) return;
|
|
3283
|
+
const [start, end] = date.dateValue;
|
|
3284
|
+
if (dayjs.isDayjs(start) || dayjs.isDayjs(end)) return;
|
|
3285
|
+
const { startNum, startUnit } = date;
|
|
3286
|
+
naturalUnitValue.value = end === NowConstant ? NaturalUnit.NOW : NaturalUnit.ALL;
|
|
3287
|
+
const customDate = naturalOptions.value.find((item) => item.id === start && item.type === NaturalOptionType.custom);
|
|
3288
|
+
if (customDate) {
|
|
3289
|
+
naturalValue.value = customDate;
|
|
2458
3290
|
return;
|
|
2459
3291
|
}
|
|
2460
|
-
const
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
3292
|
+
const specialDate = CommonNaturalOptions.find(
|
|
3293
|
+
(item) => item.id === start && item.type === NaturalOptionType.default
|
|
3294
|
+
);
|
|
3295
|
+
if (end !== NowConstant && start !== end && specialDate || !specialDate) {
|
|
3296
|
+
const name = `${`${t("前")} ${startNum} ${t(
|
|
3297
|
+
shortTimeUnitLangData[startUnit]
|
|
2464
3298
|
)}`}`;
|
|
2465
|
-
|
|
2466
|
-
id:
|
|
2467
|
-
name
|
|
2468
|
-
type:
|
|
2469
|
-
})
|
|
3299
|
+
naturalOptions.value.unshift({
|
|
3300
|
+
id: start,
|
|
3301
|
+
name,
|
|
3302
|
+
type: NaturalOptionType.custom
|
|
3303
|
+
});
|
|
3304
|
+
[naturalValue.value] = naturalOptions.value;
|
|
2470
3305
|
return;
|
|
2471
3306
|
}
|
|
2472
|
-
|
|
3307
|
+
specialDate && (naturalValue.value = specialDate);
|
|
2473
3308
|
},
|
|
2474
3309
|
{
|
|
2475
|
-
immediate:
|
|
3310
|
+
immediate: true
|
|
2476
3311
|
}
|
|
2477
3312
|
);
|
|
2478
|
-
const
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
3313
|
+
const getNaturalOptionId = (date) => {
|
|
3314
|
+
return `${date.id}${splitDate}${date.type}`;
|
|
3315
|
+
};
|
|
3316
|
+
const getNaturalDateValue = (date) => {
|
|
3317
|
+
const value = date.id;
|
|
3318
|
+
if (naturalUnitValue.value === NaturalUnit.ALL) {
|
|
3319
|
+
const [, num, unit, dateUnit2] = value.match(naturalDateRegexp) || [];
|
|
3320
|
+
if (Math.abs(+num) > 1) {
|
|
3321
|
+
if (Math.abs(+num) === 2 && unit === "d") return [value, value];
|
|
3322
|
+
return [value, `now-1${unit}/${dateUnit2}`];
|
|
3323
|
+
}
|
|
3324
|
+
return [value, value];
|
|
2483
3325
|
}
|
|
2484
|
-
return [
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
3326
|
+
return [value, NowConstant];
|
|
3327
|
+
};
|
|
3328
|
+
const handleClickItem = (item) => {
|
|
3329
|
+
var _a;
|
|
3330
|
+
if (item.type === NaturalOptionType.edit) {
|
|
3331
|
+
inputValue.value = 1;
|
|
3332
|
+
canEditNaturalId.value = item.id;
|
|
3333
|
+
setTimeout(() => {
|
|
3334
|
+
var _a2, _b, _c;
|
|
3335
|
+
(_c = (_b = (_a2 = inputRef.value) == null ? void 0 : _a2[0]) == null ? void 0 : _b.focus) == null ? void 0 : _c.call(_b);
|
|
2491
3336
|
}, 20);
|
|
2492
3337
|
return;
|
|
2493
3338
|
}
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
}
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
3339
|
+
naturalValue.value = item;
|
|
3340
|
+
canEditNaturalId.value = "";
|
|
3341
|
+
(_a = naturalSelectRef.value) == null ? void 0 : _a.hidePopover();
|
|
3342
|
+
};
|
|
3343
|
+
const handleUnitChange = (value) => {
|
|
3344
|
+
naturalUnitValue.value = value;
|
|
3345
|
+
};
|
|
3346
|
+
const customNaturalOptions = (v, item) => {
|
|
3347
|
+
var _a, _b;
|
|
3348
|
+
canEditNaturalId.value = "";
|
|
3349
|
+
const value = `now-${+v}${item.unit}/${item.unit}`;
|
|
3350
|
+
const date = naturalOptions.value.find((item2) => item2.id === value);
|
|
3351
|
+
if (date) {
|
|
3352
|
+
naturalValue.value = date;
|
|
3353
|
+
(_a = naturalSelectRef.value) == null ? void 0 : _a.hidePopover();
|
|
2503
3354
|
return;
|
|
2504
3355
|
}
|
|
2505
|
-
|
|
2506
|
-
id:
|
|
2507
|
-
name:
|
|
2508
|
-
type:
|
|
2509
|
-
})
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
}
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
"
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
3356
|
+
naturalOptions.value.unshift({
|
|
3357
|
+
id: value,
|
|
3358
|
+
name: item.name.replace("N", v.toString()),
|
|
3359
|
+
type: NaturalOptionType.custom
|
|
3360
|
+
});
|
|
3361
|
+
[naturalValue.value] = naturalOptions.value;
|
|
3362
|
+
(_b = naturalSelectRef.value) == null ? void 0 : _b.hidePopover();
|
|
3363
|
+
};
|
|
3364
|
+
const handleInputKeyPress = (e, v, item) => {
|
|
3365
|
+
if (!v || +v < 1) return;
|
|
3366
|
+
if (e.key !== "Enter" || !canEditNaturalId.value) return;
|
|
3367
|
+
customNaturalOptions(Math.min(Math.ceil(v), MAX_NUMBER_VALUE), item);
|
|
3368
|
+
};
|
|
3369
|
+
const handleSubmit = () => {
|
|
3370
|
+
const value = getNaturalDateValue(naturalValue.value);
|
|
3371
|
+
isValidate.value = validateDateValue(value);
|
|
3372
|
+
if (!isValidate.value) return;
|
|
3373
|
+
naturalOptions.value.filter((item) => item.type === NaturalOptionType.custom).forEach((item) => {
|
|
3374
|
+
setStoreDateList(getNaturalDateValue(item), getStoreKey(), "session");
|
|
3375
|
+
});
|
|
3376
|
+
emits("change", value);
|
|
3377
|
+
};
|
|
3378
|
+
__expose({
|
|
3379
|
+
handleSubmit
|
|
3380
|
+
});
|
|
3381
|
+
return (_ctx, _cache) => {
|
|
3382
|
+
return openBlock(), createElementBlock(
|
|
3383
|
+
Fragment,
|
|
3384
|
+
null,
|
|
3385
|
+
[
|
|
3386
|
+
createElementVNode(
|
|
3387
|
+
"div",
|
|
3388
|
+
{
|
|
3389
|
+
class: normalizeClass(["natural-picker", {
|
|
3390
|
+
"is-invalid": !isValidate.value
|
|
3391
|
+
}])
|
|
3392
|
+
},
|
|
3393
|
+
[
|
|
3394
|
+
createVNode(unref(Select), {
|
|
3395
|
+
ref_key: "naturalSelectRef",
|
|
3396
|
+
ref: naturalSelectRef,
|
|
3397
|
+
class: "natural-date",
|
|
3398
|
+
clearable: false,
|
|
3399
|
+
filterable: "",
|
|
3400
|
+
"input-search": false,
|
|
3401
|
+
"model-value": getNaturalOptionId(naturalValue.value),
|
|
3402
|
+
"no-match-text": unref(t)("无匹配数据"),
|
|
3403
|
+
"popover-min-width": 130,
|
|
3404
|
+
"popover-options": { boundary: "parent", extCls: "__bk-date-picker-popover__" },
|
|
3405
|
+
prefix: unref(t)("自然日期"),
|
|
3406
|
+
"search-placeholder": unref(t)("请输入"),
|
|
3407
|
+
onClick: _cache[2] || (_cache[2] = ($event) => isValidate.value = true)
|
|
3408
|
+
}, {
|
|
3409
|
+
default: withCtx(() => [
|
|
3410
|
+
(openBlock(true), createElementBlock(
|
|
3411
|
+
Fragment,
|
|
3412
|
+
null,
|
|
3413
|
+
renderList(naturalOptions.value, (item) => {
|
|
3414
|
+
return openBlock(), createBlock(unref(Select).Option, {
|
|
3415
|
+
id: getNaturalOptionId(item),
|
|
3416
|
+
key: getNaturalOptionId(item),
|
|
3417
|
+
name: item.name
|
|
3418
|
+
}, {
|
|
3419
|
+
default: withCtx(() => [
|
|
3420
|
+
createElementVNode("div", {
|
|
3421
|
+
class: "natural-custom-option",
|
|
3422
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
3423
|
+
}, ["prevent", "stop"]))
|
|
3424
|
+
}, [
|
|
3425
|
+
canEditNaturalId.value === item.id ? (openBlock(), createBlock(unref(Input), {
|
|
3426
|
+
key: 0,
|
|
3427
|
+
ref_for: true,
|
|
3428
|
+
ref_key: "inputRef",
|
|
3429
|
+
ref: inputRef,
|
|
3430
|
+
modelValue: inputValue.value,
|
|
3431
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
|
|
3432
|
+
autofocus: "true",
|
|
3433
|
+
clearable: false,
|
|
3434
|
+
max: unref(MAX_NUMBER_VALUE),
|
|
3435
|
+
min: 1,
|
|
3436
|
+
placeholder: unref(t)("请输入"),
|
|
3437
|
+
precision: 0,
|
|
3438
|
+
prefix: item.prefix,
|
|
3439
|
+
"show-control": true,
|
|
3440
|
+
size: "small",
|
|
3441
|
+
style: { "width": "150px" },
|
|
3442
|
+
suffix: item.suffix,
|
|
3443
|
+
type: "number",
|
|
3444
|
+
onKeypress: (v, e) => handleInputKeyPress(e, v, item)
|
|
3445
|
+
}, null, 8, ["modelValue", "max", "placeholder", "prefix", "suffix", "onKeypress"])) : (openBlock(), createElementBlock("div", {
|
|
3446
|
+
key: 1,
|
|
3447
|
+
style: { "width": "100%" },
|
|
3448
|
+
onClick: ($event) => handleClickItem(item)
|
|
3449
|
+
}, toDisplayString(item.name), 9, _hoisted_1$4))
|
|
3450
|
+
])
|
|
3451
|
+
]),
|
|
3452
|
+
_: 2
|
|
3453
|
+
/* DYNAMIC */
|
|
3454
|
+
}, 1032, ["id", "name"]);
|
|
3455
|
+
}),
|
|
3456
|
+
128
|
|
3457
|
+
/* KEYED_FRAGMENT */
|
|
3458
|
+
))
|
|
3459
|
+
]),
|
|
3460
|
+
_: 1
|
|
3461
|
+
/* STABLE */
|
|
3462
|
+
}, 8, ["model-value", "no-match-text", "prefix", "search-placeholder"]),
|
|
3463
|
+
createVNode(unref(Select), {
|
|
3464
|
+
class: "natural-unit",
|
|
3465
|
+
clearable: false,
|
|
3466
|
+
"model-value": naturalUnitValue.value,
|
|
3467
|
+
"popover-options": { boundary: "parent" },
|
|
3468
|
+
onChange: handleUnitChange,
|
|
3469
|
+
onClick: _cache[3] || (_cache[3] = ($event) => isValidate.value = true)
|
|
3470
|
+
}, {
|
|
3471
|
+
default: withCtx(() => [
|
|
3472
|
+
(openBlock(true), createElementBlock(
|
|
3473
|
+
Fragment,
|
|
3474
|
+
null,
|
|
3475
|
+
renderList(unref(naturalUnitOptions), (item) => {
|
|
3476
|
+
return openBlock(), createBlock(unref(Select).Option, {
|
|
3477
|
+
id: item.id,
|
|
3478
|
+
key: item.id,
|
|
3479
|
+
name: item.name
|
|
3480
|
+
}, null, 8, ["id", "name"]);
|
|
3481
|
+
}),
|
|
3482
|
+
128
|
|
3483
|
+
/* KEYED_FRAGMENT */
|
|
3484
|
+
))
|
|
3485
|
+
]),
|
|
3486
|
+
_: 1
|
|
3487
|
+
/* STABLE */
|
|
3488
|
+
}, 8, ["model-value"]),
|
|
3489
|
+
createVNode(_sfc_main$8, { onSubmit: handleSubmit })
|
|
3490
|
+
],
|
|
3491
|
+
2
|
|
3492
|
+
/* CLASS */
|
|
3493
|
+
),
|
|
3494
|
+
!isValidate.value ? (openBlock(), createElementBlock(
|
|
3495
|
+
"div",
|
|
3496
|
+
_hoisted_2$3,
|
|
3497
|
+
toDisplayString(unref(validMsg)),
|
|
3498
|
+
1
|
|
3499
|
+
/* TEXT */
|
|
3500
|
+
)) : createCommentVNode("v-if", true)
|
|
3501
|
+
],
|
|
3502
|
+
64
|
|
3503
|
+
/* STABLE_FRAGMENT */
|
|
3504
|
+
);
|
|
3505
|
+
};
|
|
3506
|
+
}
|
|
3507
|
+
});
|
|
3508
|
+
const _hoisted_1$3 = { class: "baseline-picker" };
|
|
3509
|
+
const _hoisted_2$2 = {
|
|
3510
|
+
key: 0,
|
|
3511
|
+
class: "specific-date"
|
|
3512
|
+
};
|
|
3513
|
+
const _hoisted_3$2 = ["placeholder", "value", "onKeydown"];
|
|
3514
|
+
const _hoisted_4$1 = ["onClick"];
|
|
3515
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3516
|
+
__name: "baseline-select",
|
|
3517
|
+
props: {
|
|
3518
|
+
modelValue: { default: "now" }
|
|
3519
|
+
},
|
|
3520
|
+
emits: ["update:modelValue"],
|
|
3521
|
+
setup(__props, { emit: __emit }) {
|
|
3522
|
+
const props = __props;
|
|
3523
|
+
const emits = __emit;
|
|
3524
|
+
const { format } = useDatePickerInject();
|
|
3525
|
+
const inputRef = ref();
|
|
3526
|
+
const specificInput = ref();
|
|
3527
|
+
const baselineSelectRef = ref();
|
|
3528
|
+
const inputValue = ref();
|
|
3529
|
+
const specificDate = ref();
|
|
3530
|
+
const canEditNaturalId = ref("");
|
|
3531
|
+
const baselineValue = customRef((track, trigger) => {
|
|
3532
|
+
return {
|
|
3533
|
+
get() {
|
|
3534
|
+
track();
|
|
3535
|
+
return props.modelValue;
|
|
3536
|
+
},
|
|
3537
|
+
set(value) {
|
|
3538
|
+
if (props.modelValue !== value) {
|
|
3539
|
+
emits("update:modelValue", value);
|
|
3540
|
+
trigger();
|
|
3541
|
+
}
|
|
3542
|
+
}
|
|
3543
|
+
};
|
|
3544
|
+
});
|
|
3545
|
+
const showSpecificPanel = ref(false);
|
|
3546
|
+
const baselineOptions = shallowRef([
|
|
3547
|
+
{
|
|
3548
|
+
id: "now",
|
|
3549
|
+
name: t("此刻")
|
|
3550
|
+
},
|
|
3551
|
+
{
|
|
3552
|
+
id: "now/d",
|
|
3553
|
+
name: t("今天")
|
|
3554
|
+
},
|
|
3555
|
+
{
|
|
3556
|
+
id: "now-1d/d",
|
|
3557
|
+
name: t("昨天")
|
|
3558
|
+
},
|
|
3559
|
+
{
|
|
3560
|
+
id: "now-2d/d",
|
|
3561
|
+
name: t("前天")
|
|
3562
|
+
},
|
|
3563
|
+
{
|
|
3564
|
+
id: "now-nd/d",
|
|
3565
|
+
name: t("N 天前"),
|
|
3566
|
+
suffix: t("天前"),
|
|
3567
|
+
type: NaturalOptionType.edit
|
|
3568
|
+
},
|
|
3569
|
+
{
|
|
3570
|
+
id: "date",
|
|
3571
|
+
name: t("具体时间"),
|
|
3572
|
+
type: NaturalOptionType.specific
|
|
3573
|
+
}
|
|
3574
|
+
]);
|
|
3575
|
+
onMounted(() => {
|
|
3576
|
+
const item = baselineOptions.value.find((item2) => item2.id === props.modelValue);
|
|
3577
|
+
if (!item) {
|
|
3578
|
+
baselineOptions.value.unshift({
|
|
3579
|
+
id: props.modelValue,
|
|
3580
|
+
name: props.modelValue.includes(NowConstant) ? t("N 天前").replace("N", props.modelValue.replace("now-", "").replace("d/d", "")) : props.modelValue,
|
|
3581
|
+
type: NaturalOptionType.custom
|
|
3582
|
+
});
|
|
3583
|
+
}
|
|
3584
|
+
});
|
|
3585
|
+
const handleClickItem = (item) => {
|
|
3586
|
+
var _a;
|
|
3587
|
+
if (item.type === NaturalOptionType.specific) {
|
|
3588
|
+
canEditNaturalId.value = item.id;
|
|
3589
|
+
specificDate.value = void 0;
|
|
3590
|
+
nextTick(() => {
|
|
3591
|
+
var _a2, _b;
|
|
3592
|
+
showSpecificPanel.value = true;
|
|
3593
|
+
(_b = (_a2 = specificInput.value) == null ? void 0 : _a2[0]) == null ? void 0 : _b.focus();
|
|
3594
|
+
});
|
|
3595
|
+
return;
|
|
3596
|
+
}
|
|
3597
|
+
if (item.type === NaturalOptionType.edit) {
|
|
3598
|
+
inputValue.value = 1;
|
|
3599
|
+
canEditNaturalId.value = item.id;
|
|
3600
|
+
setTimeout(() => {
|
|
3601
|
+
var _a2, _b, _c;
|
|
3602
|
+
(_c = (_b = (_a2 = inputRef.value) == null ? void 0 : _a2[0]) == null ? void 0 : _b.focus) == null ? void 0 : _c.call(_b);
|
|
3603
|
+
}, 20);
|
|
3604
|
+
return;
|
|
3605
|
+
}
|
|
3606
|
+
baselineValue.value = item.id;
|
|
3607
|
+
canEditNaturalId.value = "";
|
|
3608
|
+
(_a = baselineSelectRef.value) == null ? void 0 : _a.hidePopover();
|
|
3609
|
+
specificDate.value = void 0;
|
|
3610
|
+
inputValue.value = 1;
|
|
3611
|
+
emits("update:modelValue", item.id);
|
|
3612
|
+
};
|
|
3613
|
+
const handleInputKeyPress = (e, v, item) => {
|
|
3614
|
+
if (!v || +v < 1) return;
|
|
3615
|
+
if (e.key !== "Enter" || !canEditNaturalId.value) return;
|
|
3616
|
+
customNaturalOptions(Math.ceil(v), item);
|
|
3617
|
+
};
|
|
3618
|
+
const customNaturalOptions = (v, item) => {
|
|
3619
|
+
var _a, _b;
|
|
3620
|
+
canEditNaturalId.value = "";
|
|
3621
|
+
const value = `now-${+v}d/d`;
|
|
3622
|
+
const date = baselineOptions.value.find((item2) => item2.id === value);
|
|
3623
|
+
if (date) {
|
|
3624
|
+
baselineValue.value = date.id;
|
|
3625
|
+
(_a = baselineSelectRef.value) == null ? void 0 : _a.hidePopover();
|
|
3626
|
+
return;
|
|
3627
|
+
}
|
|
3628
|
+
baselineOptions.value.unshift({
|
|
3629
|
+
id: value,
|
|
3630
|
+
name: item.name.replace("N", v.toString()),
|
|
3631
|
+
type: NaturalOptionType.custom
|
|
3632
|
+
});
|
|
3633
|
+
baselineValue.value = value;
|
|
3634
|
+
(_b = baselineSelectRef.value) == null ? void 0 : _b.hidePopover();
|
|
3635
|
+
};
|
|
3636
|
+
const handleInputEnter = () => {
|
|
3637
|
+
var _a, _b, _c, _d;
|
|
3638
|
+
const target = (_a = specificInput.value) == null ? void 0 : _a[0];
|
|
3639
|
+
const val = (_b = target == null ? void 0 : target.value) == null ? void 0 : _b.toString().trim();
|
|
3640
|
+
if (!val) {
|
|
3641
|
+
return;
|
|
3642
|
+
}
|
|
3643
|
+
let date = inputVal2Dayjs(val, format.value, specificDate == null ? void 0 : specificDate.value);
|
|
3644
|
+
if (date == null ? void 0 : date.isValid()) {
|
|
3645
|
+
canEditNaturalId.value = "";
|
|
3646
|
+
const formatValue = date.format(format.value);
|
|
3647
|
+
const item = baselineOptions.value.find((item2) => item2.id === formatValue);
|
|
3648
|
+
if (item) {
|
|
3649
|
+
baselineValue.value = item.id;
|
|
3650
|
+
(_c = baselineSelectRef.value) == null ? void 0 : _c.hidePopover();
|
|
3651
|
+
specificDate.value = void 0;
|
|
3652
|
+
return;
|
|
3653
|
+
}
|
|
3654
|
+
baselineOptions.value.unshift({
|
|
3655
|
+
id: formatValue,
|
|
3656
|
+
name: formatValue,
|
|
3657
|
+
type: NaturalOptionType.custom
|
|
3658
|
+
});
|
|
3659
|
+
baselineValue.value = formatValue;
|
|
3660
|
+
(_d = baselineSelectRef.value) == null ? void 0 : _d.hidePopover();
|
|
3661
|
+
specificDate.value = void 0;
|
|
3662
|
+
target.value = (date == null ? void 0 : date.format(format.value)) || "";
|
|
3663
|
+
}
|
|
3664
|
+
};
|
|
3665
|
+
const handleInputFocus = () => {
|
|
3666
|
+
showSpecificPanel.value = true;
|
|
3667
|
+
};
|
|
3668
|
+
const handleSpecificTimeChange = (date) => {
|
|
3669
|
+
var _a, _b, _c;
|
|
3670
|
+
if (!((_a = specificDate.value) == null ? void 0 : _a.isSame(date))) {
|
|
3671
|
+
specificDate.value = date;
|
|
3672
|
+
}
|
|
3673
|
+
showSpecificPanel.value = false;
|
|
3674
|
+
(_c = (_b = specificInput.value) == null ? void 0 : _b[0]) == null ? void 0 : _c.focus();
|
|
3675
|
+
};
|
|
3676
|
+
return (_ctx, _cache) => {
|
|
3677
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
3678
|
+
createVNode(unref(Select), {
|
|
3679
|
+
ref_key: "baselineSelectRef",
|
|
3680
|
+
ref: baselineSelectRef,
|
|
3681
|
+
class: "baseline-picker-select",
|
|
3682
|
+
clearable: false,
|
|
3683
|
+
filterable: "",
|
|
3684
|
+
"input-search": false,
|
|
3685
|
+
"model-value": baselineValue.value,
|
|
3686
|
+
"no-match-text": unref(t)("无匹配数据"),
|
|
3687
|
+
"popover-min-width": 130,
|
|
3688
|
+
"popover-options": {
|
|
3689
|
+
boundary: "parent",
|
|
3690
|
+
extCls: "__bk-date-picker-popover__ __bk-date-picker-baseline-popover__"
|
|
3691
|
+
},
|
|
3692
|
+
prefix: unref(t)("基于"),
|
|
3693
|
+
"search-placeholder": unref(t)("请输入")
|
|
3694
|
+
}, {
|
|
3695
|
+
default: withCtx(() => [
|
|
3696
|
+
(openBlock(true), createElementBlock(
|
|
3697
|
+
Fragment,
|
|
3698
|
+
null,
|
|
3699
|
+
renderList(baselineOptions.value, (item) => {
|
|
3700
|
+
return openBlock(), createBlock(unref(Select).Option, {
|
|
3701
|
+
id: item.id,
|
|
3702
|
+
key: item.id,
|
|
3703
|
+
name: item.name,
|
|
3704
|
+
style: { "overflow": "inherit" }
|
|
3705
|
+
}, {
|
|
3706
|
+
default: withCtx(() => {
|
|
3707
|
+
var _a;
|
|
3708
|
+
return [
|
|
3709
|
+
createElementVNode("div", {
|
|
3710
|
+
class: "baseline-custom-option",
|
|
3711
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
3712
|
+
}, ["prevent", "stop"]))
|
|
3713
|
+
}, [
|
|
3714
|
+
canEditNaturalId.value === item.id ? (openBlock(), createElementBlock(
|
|
3715
|
+
Fragment,
|
|
3716
|
+
{ key: 0 },
|
|
3717
|
+
[
|
|
3718
|
+
item.type === unref(NaturalOptionType).specific ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
3719
|
+
_cache[3] || (_cache[3] = createElementVNode(
|
|
3720
|
+
"span",
|
|
3721
|
+
{ class: "specific-date-icon" },
|
|
3722
|
+
[
|
|
3723
|
+
createElementVNode("svg", {
|
|
3724
|
+
class: "date-content-icon",
|
|
3725
|
+
height: "14",
|
|
3726
|
+
version: "1.1",
|
|
3727
|
+
viewBox: "0 0 1024 1024",
|
|
3728
|
+
width: "14",
|
|
3729
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3730
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3731
|
+
}, [
|
|
3732
|
+
createElementVNode("path", {
|
|
3733
|
+
d: "M558.933 465.067h-93.866v93.866h93.866v-93.866z m0 162.133h-93.866v93.867h93.866V627.2z m371.2-533.333h-93.866V21.333c0-12.8-8.534-21.333-21.334-21.333S793.6 8.533 793.6 21.333V89.6H234.667V21.333c0-12.8-12.8-21.333-25.6-21.333s-21.334 8.533-21.334 21.333V89.6H93.867C42.667 93.867 0 136.533 0 187.733V934.4c0 46.933 42.667 89.6 93.867 89.6h836.266c51.2 0 93.867-42.667 93.867-93.867v-742.4c0-51.2-42.667-93.866-93.867-93.866z m46.934 836.266c0 25.6-21.334 46.934-46.934 46.934H93.867c-25.6 0-46.934-21.334-46.934-46.934V371.2h930.134v558.933z m0-605.866H46.933V187.733c0-25.6 21.334-46.933 46.934-46.933h93.866v68.267c0 12.8 8.534 21.333 21.334 21.333s21.333-8.533 21.333-21.333V140.8h558.933v68.267c0 12.8 8.534 21.333 21.334 21.333S832 221.867 832 209.067V140.8h93.867c25.6 0 46.933 21.333 46.933 46.933v136.534h4.267zM789.333 627.2h-93.866v93.867h93.866V627.2z m0-162.133h-93.866v93.866h93.866v-93.866z m-230.4 324.266h-93.866V883.2h93.866v-93.867z m-234.666 0h-89.6V883.2h93.866v-93.867h-4.266z m0-324.266h-89.6v93.866h93.866v-93.866h-4.266z m0 162.133h-89.6v93.867h93.866V627.2h-4.266z",
|
|
3734
|
+
fill: "#C4C6CC",
|
|
3735
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
3736
|
+
})
|
|
3737
|
+
])
|
|
3738
|
+
],
|
|
3739
|
+
-1
|
|
3740
|
+
/* HOISTED */
|
|
3741
|
+
)),
|
|
3742
|
+
createElementVNode("input", {
|
|
3743
|
+
ref_for: true,
|
|
3744
|
+
ref_key: "specificInput",
|
|
3745
|
+
ref: specificInput,
|
|
3746
|
+
class: "specific-date-input",
|
|
3747
|
+
placeholder: unref(t)("具体时间"),
|
|
3748
|
+
spellcheck: "false",
|
|
3749
|
+
value: (_a = specificDate.value) == null ? void 0 : _a.format(unref(format)),
|
|
3750
|
+
onClick: handleInputFocus,
|
|
3751
|
+
onKeydown: withKeys(withModifiers(handleInputEnter, ["stop"]), ["enter"])
|
|
3752
|
+
}, null, 40, _hoisted_3$2),
|
|
3753
|
+
withDirectives(createVNode(_sfc_main$7, {
|
|
3754
|
+
key: "specific",
|
|
3755
|
+
class: "specific-date-panel",
|
|
3756
|
+
format: unref(format),
|
|
3757
|
+
"model-value": specificDate.value,
|
|
3758
|
+
"show-title": false,
|
|
3759
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
3760
|
+
}, ["prevent", "stop"])),
|
|
3761
|
+
"onUpdate:modelValue": handleSpecificTimeChange
|
|
3762
|
+
}, null, 8, ["format", "model-value"]), [
|
|
3763
|
+
[vShow, showSpecificPanel.value]
|
|
3764
|
+
])
|
|
3765
|
+
])) : (openBlock(), createBlock(unref(Input), {
|
|
3766
|
+
key: 1,
|
|
3767
|
+
ref_for: true,
|
|
3768
|
+
ref_key: "inputRef",
|
|
3769
|
+
ref: inputRef,
|
|
3770
|
+
modelValue: inputValue.value,
|
|
3771
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event),
|
|
3772
|
+
autofocus: "true",
|
|
3773
|
+
clearable: false,
|
|
3774
|
+
min: 1,
|
|
3775
|
+
placeholder: unref(t)("请输入"),
|
|
3776
|
+
precision: 0,
|
|
3777
|
+
"show-control": true,
|
|
3778
|
+
size: "small",
|
|
3779
|
+
style: { "width": "174px" },
|
|
3780
|
+
suffix: item.suffix,
|
|
3781
|
+
type: "number",
|
|
3782
|
+
onKeypress: (v, e) => handleInputKeyPress(e, v, item)
|
|
3783
|
+
}, null, 8, ["modelValue", "placeholder", "suffix", "onKeypress"]))
|
|
3784
|
+
],
|
|
3785
|
+
64
|
|
3786
|
+
/* STABLE_FRAGMENT */
|
|
3787
|
+
)) : (openBlock(), createElementBlock("div", {
|
|
3788
|
+
key: 1,
|
|
3789
|
+
style: { "width": "100%" },
|
|
3790
|
+
onClick: ($event) => handleClickItem(item)
|
|
3791
|
+
}, toDisplayString(item.name), 9, _hoisted_4$1))
|
|
3792
|
+
])
|
|
3793
|
+
];
|
|
3794
|
+
}),
|
|
3795
|
+
_: 2
|
|
3796
|
+
/* DYNAMIC */
|
|
3797
|
+
}, 1032, ["id", "name"]);
|
|
3798
|
+
}),
|
|
3799
|
+
128
|
|
3800
|
+
/* KEYED_FRAGMENT */
|
|
3801
|
+
))
|
|
3802
|
+
]),
|
|
3803
|
+
_: 1
|
|
3804
|
+
/* STABLE */
|
|
3805
|
+
}, 8, ["model-value", "no-match-text", "prefix", "search-placeholder"])
|
|
3806
|
+
]);
|
|
3807
|
+
};
|
|
2608
3808
|
}
|
|
2609
|
-
})
|
|
3809
|
+
});
|
|
3810
|
+
const _hoisted_1$2 = {
|
|
3811
|
+
key: 0,
|
|
3812
|
+
style: { "margin": "-8px 0 4px", "color": "#ea3636" }
|
|
3813
|
+
};
|
|
3814
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2610
3815
|
__name: "recent-picker",
|
|
2611
3816
|
props: {
|
|
2612
|
-
|
|
3817
|
+
baselineTime: {},
|
|
3818
|
+
type: { default: DateMode.RECENT },
|
|
2613
3819
|
value: {}
|
|
2614
3820
|
},
|
|
2615
3821
|
emits: ["change"],
|
|
2616
|
-
setup(
|
|
2617
|
-
const
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
3822
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3823
|
+
const emits = __emit;
|
|
3824
|
+
const props = __props;
|
|
3825
|
+
const recentUnit = ref("m");
|
|
3826
|
+
const dateValue = ref();
|
|
3827
|
+
const canSubmit = computed(() => !!dateValue.value && !!recentUnit.value);
|
|
3828
|
+
const isValidate = ref(true);
|
|
3829
|
+
const recentBaselineTime = ref();
|
|
3830
|
+
const { validMsg, validateDateValue } = useValidate();
|
|
3831
|
+
watch(
|
|
3832
|
+
() => props.value,
|
|
3833
|
+
(val) => {
|
|
3834
|
+
if (!val) return;
|
|
3835
|
+
if (props.type !== val.dateMode) return;
|
|
3836
|
+
recentUnit.value = val.recentOrFutureDateUnit;
|
|
3837
|
+
dateValue.value = val.recentOrFutureDateNum || void 0;
|
|
3838
|
+
recentBaselineTime.value = val == null ? void 0 : val.startBaselineTime;
|
|
3839
|
+
},
|
|
3840
|
+
{
|
|
3841
|
+
immediate: true
|
|
2625
3842
|
}
|
|
2626
3843
|
);
|
|
2627
|
-
const
|
|
2628
|
-
if (
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
3844
|
+
const handleSubmit = () => {
|
|
3845
|
+
if (!dateValue.value || !canSubmit.value) return;
|
|
3846
|
+
const emitDate = props.type === DateMode.FUTURE ? [NowConstant, `${DateMode.FUTURE}${dateValue.value}${recentUnit.value}`] : [`${DateMode.RECENT}${dateValue.value}${recentUnit.value}`, NowConstant].map(
|
|
3847
|
+
(v) => recentBaselineTime.value && recentBaselineTime.value !== NowConstant ? v.replace(NowConstant, `(${recentBaselineTime.value})`) : v
|
|
3848
|
+
);
|
|
3849
|
+
isValidate.value = !!validateDateValue(emitDate);
|
|
3850
|
+
if (!isValidate.value) return;
|
|
3851
|
+
if (props.type === DateMode.FUTURE) {
|
|
3852
|
+
emits("change", emitDate);
|
|
3853
|
+
return;
|
|
2634
3854
|
}
|
|
3855
|
+
emits("change", emitDate);
|
|
2635
3856
|
};
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
filterable: "",
|
|
2652
|
-
modelValue: n.value,
|
|
2653
|
-
"onUpdate:modelValue": s[1] || (s[1] = (o) => n.value = o)
|
|
2654
|
-
}, {
|
|
2655
|
-
default: j(() => [
|
|
2656
|
-
(p(!0), z(
|
|
2657
|
-
U,
|
|
2658
|
-
null,
|
|
2659
|
-
q(t(Xa), (o) => (p(), K(t(Z).Option, {
|
|
2660
|
-
id: o.id,
|
|
2661
|
-
key: o.id,
|
|
2662
|
-
name: o.name
|
|
2663
|
-
}, null, 8, ["id", "name"]))),
|
|
2664
|
-
128
|
|
2665
|
-
/* KEYED_FRAGMENT */
|
|
2666
|
-
))
|
|
2667
|
-
]),
|
|
2668
|
-
_: 1
|
|
2669
|
-
/* STABLE */
|
|
2670
|
-
}, 8, ["modelValue"]),
|
|
2671
|
-
E(Da, {
|
|
2672
|
-
disabled: !h.value,
|
|
2673
|
-
onSubmit: m
|
|
2674
|
-
}, null, 8, ["disabled"])
|
|
2675
|
-
]));
|
|
2676
|
-
}
|
|
2677
|
-
}), At = { class: "option-name" }, gt = { class: "option-country" }, xt = { class: "option-utc" }, It = { class: "option-name" }, kt = { class: "option-country" }, yt = { class: "option-utc" }, _t = /* @__PURE__ */ X({
|
|
2678
|
-
__name: "timezone-picker",
|
|
2679
|
-
props: {
|
|
2680
|
-
value: {}
|
|
2681
|
-
},
|
|
2682
|
-
emits: ["change"],
|
|
2683
|
-
setup(l, { emit: a }) {
|
|
2684
|
-
const i = a, e = Q(te), n = (h) => {
|
|
2685
|
-
const m = ie(h);
|
|
2686
|
-
i("change", h, m);
|
|
2687
|
-
}, b = (h, m) => {
|
|
2688
|
-
var c, s, o, y;
|
|
2689
|
-
return ((c = m.label) == null ? void 0 : c.toLowerCase().includes(h.toLowerCase())) || ((s = m.country) == null ? void 0 : s.toLowerCase().includes(h.toLowerCase())) || ((o = m.abbreviation) == null ? void 0 : o.toLowerCase().includes(h.toLowerCase())) || ((y = m.utc) == null ? void 0 : y.toLowerCase().includes(h.toLowerCase()));
|
|
2690
|
-
};
|
|
2691
|
-
return (h, m) => (p(), K(t(Z), {
|
|
2692
|
-
clearable: !1,
|
|
2693
|
-
"filter-option": b,
|
|
2694
|
-
"input-search": !1,
|
|
2695
|
-
"model-value": h.value,
|
|
2696
|
-
"no-match-text": t(r)("无匹配数据"),
|
|
2697
|
-
placeholder: t(r)("请输入搜索(国家,城市,简称)"),
|
|
2698
|
-
"popover-options": { "ext-cls": "__bk-date-picker-popover__" },
|
|
2699
|
-
"search-placeholder": t(r)("请输入搜索(国家,城市,简称)"),
|
|
2700
|
-
onChange: n,
|
|
2701
|
-
class: "timezone-picker",
|
|
2702
|
-
filterable: ""
|
|
2703
|
-
}, {
|
|
2704
|
-
default: j(() => [
|
|
2705
|
-
(p(!0), z(
|
|
2706
|
-
U,
|
|
2707
|
-
null,
|
|
2708
|
-
q(e.value, (c) => (p(), z(
|
|
2709
|
-
U,
|
|
2710
|
-
null,
|
|
3857
|
+
__expose({
|
|
3858
|
+
handleSubmit
|
|
3859
|
+
});
|
|
3860
|
+
return (_ctx, _cache) => {
|
|
3861
|
+
return openBlock(), createElementBlock(
|
|
3862
|
+
Fragment,
|
|
3863
|
+
null,
|
|
3864
|
+
[
|
|
3865
|
+
createElementVNode(
|
|
3866
|
+
"div",
|
|
3867
|
+
{
|
|
3868
|
+
class: normalizeClass(["recent-picker", {
|
|
3869
|
+
"is-invalid": !isValidate.value
|
|
3870
|
+
}])
|
|
3871
|
+
},
|
|
2711
3872
|
[
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
U,
|
|
2763
|
-
{ key: 1 },
|
|
2764
|
-
[
|
|
2765
|
-
c.options.length ? (p(), K(t(Z).Group, {
|
|
2766
|
-
key: c.label,
|
|
2767
|
-
label: c.label
|
|
2768
|
-
}, {
|
|
2769
|
-
default: j(() => [
|
|
2770
|
-
(p(!0), z(
|
|
2771
|
-
U,
|
|
2772
|
-
null,
|
|
2773
|
-
q(c.options, (s) => (p(), K(t(Z).Option, Ya(s, {
|
|
2774
|
-
id: s.label,
|
|
2775
|
-
key: s.label,
|
|
2776
|
-
name: s.label
|
|
2777
|
-
}), {
|
|
2778
|
-
default: j(() => [
|
|
2779
|
-
v(
|
|
2780
|
-
"div",
|
|
2781
|
-
{
|
|
2782
|
-
class: da({
|
|
2783
|
-
"timezone-picker-option": !0,
|
|
2784
|
-
"is-selected": s.label === h.value
|
|
2785
|
-
})
|
|
2786
|
-
},
|
|
2787
|
-
[
|
|
2788
|
-
v(
|
|
2789
|
-
"span",
|
|
2790
|
-
It,
|
|
2791
|
-
k(s.label),
|
|
2792
|
-
1
|
|
2793
|
-
/* TEXT */
|
|
2794
|
-
),
|
|
2795
|
-
v(
|
|
2796
|
-
"span",
|
|
2797
|
-
kt,
|
|
2798
|
-
k(s.country) + ", " + k(s.abbreviation),
|
|
2799
|
-
1
|
|
2800
|
-
/* TEXT */
|
|
2801
|
-
),
|
|
2802
|
-
v(
|
|
2803
|
-
"span",
|
|
2804
|
-
yt,
|
|
2805
|
-
k(s.utc),
|
|
2806
|
-
1
|
|
2807
|
-
/* TEXT */
|
|
2808
|
-
)
|
|
2809
|
-
],
|
|
2810
|
-
2
|
|
2811
|
-
/* CLASS */
|
|
2812
|
-
)
|
|
2813
|
-
]),
|
|
2814
|
-
_: 2
|
|
2815
|
-
/* DYNAMIC */
|
|
2816
|
-
}, 1040, ["id", "name"]))),
|
|
2817
|
-
128
|
|
2818
|
-
/* KEYED_FRAGMENT */
|
|
2819
|
-
))
|
|
2820
|
-
]),
|
|
2821
|
-
_: 2
|
|
2822
|
-
/* DYNAMIC */
|
|
2823
|
-
}, 1032, ["label"])) : sa("v-if", !0)
|
|
2824
|
-
],
|
|
2825
|
-
64
|
|
2826
|
-
/* STABLE_FRAGMENT */
|
|
2827
|
-
))
|
|
3873
|
+
_ctx.type === unref(DateMode).RECENT ? (openBlock(), createBlock(_sfc_main$3, {
|
|
3874
|
+
key: 0,
|
|
3875
|
+
modelValue: recentBaselineTime.value,
|
|
3876
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => recentBaselineTime.value = $event)
|
|
3877
|
+
}, null, 8, ["modelValue"])) : createCommentVNode("v-if", true),
|
|
3878
|
+
createVNode(unref(Input), {
|
|
3879
|
+
modelValue: dateValue.value,
|
|
3880
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dateValue.value = $event),
|
|
3881
|
+
class: "recent-input",
|
|
3882
|
+
max: unref(MAX_NUMBER_VALUE),
|
|
3883
|
+
min: 1,
|
|
3884
|
+
placeholder: unref(t)("请输入"),
|
|
3885
|
+
precision: 0,
|
|
3886
|
+
prefix: _ctx.type === unref(DateMode).RECENT ? unref(t)("的最近") : unref(t)("未来"),
|
|
3887
|
+
"stop-propagation": false,
|
|
3888
|
+
type: "number",
|
|
3889
|
+
onClick: _cache[2] || (_cache[2] = ($event) => isValidate.value = true)
|
|
3890
|
+
}, null, 8, ["modelValue", "max", "placeholder", "prefix"]),
|
|
3891
|
+
createVNode(unref(Select), {
|
|
3892
|
+
modelValue: recentUnit.value,
|
|
3893
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => recentUnit.value = $event),
|
|
3894
|
+
class: "recent-unit",
|
|
3895
|
+
clearable: false,
|
|
3896
|
+
filterable: "",
|
|
3897
|
+
"popover-min-width": 130,
|
|
3898
|
+
"popover-options": { boundary: "parent" },
|
|
3899
|
+
onClick: _cache[4] || (_cache[4] = ($event) => isValidate.value = true)
|
|
3900
|
+
}, {
|
|
3901
|
+
default: withCtx(() => [
|
|
3902
|
+
(openBlock(true), createElementBlock(
|
|
3903
|
+
Fragment,
|
|
3904
|
+
null,
|
|
3905
|
+
renderList(unref(DateUnitList), (item) => {
|
|
3906
|
+
return openBlock(), createBlock(unref(Select).Option, {
|
|
3907
|
+
id: item.id,
|
|
3908
|
+
key: item.id,
|
|
3909
|
+
name: item.name
|
|
3910
|
+
}, null, 8, ["id", "name"]);
|
|
3911
|
+
}),
|
|
3912
|
+
128
|
|
3913
|
+
/* KEYED_FRAGMENT */
|
|
3914
|
+
))
|
|
3915
|
+
]),
|
|
3916
|
+
_: 1
|
|
3917
|
+
/* STABLE */
|
|
3918
|
+
}, 8, ["modelValue"]),
|
|
3919
|
+
createVNode(_sfc_main$8, {
|
|
3920
|
+
disabled: !canSubmit.value,
|
|
3921
|
+
onSubmit: handleSubmit
|
|
3922
|
+
}, null, 8, ["disabled"])
|
|
2828
3923
|
],
|
|
2829
|
-
|
|
2830
|
-
/*
|
|
2831
|
-
)
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
3924
|
+
2
|
|
3925
|
+
/* CLASS */
|
|
3926
|
+
),
|
|
3927
|
+
!isValidate.value ? (openBlock(), createElementBlock(
|
|
3928
|
+
"div",
|
|
3929
|
+
_hoisted_1$2,
|
|
3930
|
+
toDisplayString(unref(validMsg)),
|
|
3931
|
+
1
|
|
3932
|
+
/* TEXT */
|
|
3933
|
+
)) : createCommentVNode("v-if", true)
|
|
3934
|
+
],
|
|
3935
|
+
64
|
|
3936
|
+
/* STABLE_FRAGMENT */
|
|
3937
|
+
);
|
|
3938
|
+
};
|
|
2839
3939
|
}
|
|
2840
|
-
})
|
|
3940
|
+
});
|
|
3941
|
+
const _hoisted_1$1 = { class: "panel-wrapper" };
|
|
3942
|
+
const _hoisted_2$1 = { class: "date-list-wrapper" };
|
|
3943
|
+
const _hoisted_3$1 = {
|
|
2841
3944
|
key: 0,
|
|
2842
|
-
class: "common-date-list"
|
|
2843
|
-
}, Mt = ["onClick"], zt = {
|
|
2844
|
-
key: 1,
|
|
2845
|
-
class: "common-wrapper"
|
|
2846
|
-
}, Et = { class: "empty-tips" }, St = {
|
|
2847
|
-
key: 2,
|
|
2848
3945
|
class: "time-zone-panel"
|
|
2849
|
-
}
|
|
3946
|
+
};
|
|
3947
|
+
const _hoisted_4 = { class: "time-zone" };
|
|
3948
|
+
const _hoisted_5 = {
|
|
3949
|
+
key: 0,
|
|
3950
|
+
class: "time-zone-area"
|
|
3951
|
+
};
|
|
3952
|
+
const _hoisted_6 = {
|
|
3953
|
+
key: 0,
|
|
3954
|
+
class: "time-zone-tag"
|
|
3955
|
+
};
|
|
3956
|
+
const _hoisted_7 = { class: "time-zone-picker" };
|
|
3957
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2850
3958
|
__name: "panel-wrapper",
|
|
2851
3959
|
props: {
|
|
2852
3960
|
defaultDate: {},
|
|
@@ -2854,462 +3962,594 @@ const _a = (l, a = "start", i) => {
|
|
|
2854
3962
|
timezone: {}
|
|
2855
3963
|
},
|
|
2856
3964
|
emits: ["change", "update:timezone"],
|
|
2857
|
-
setup(
|
|
2858
|
-
const
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
)
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
3965
|
+
setup(__props, { emit: __emit }) {
|
|
3966
|
+
const { commonUseList, format, storeKey: storeKey2, timezoneInfo, version } = useDatePickerInject();
|
|
3967
|
+
const props = __props;
|
|
3968
|
+
const emits = __emit;
|
|
3969
|
+
const timezoneSet = ref(false);
|
|
3970
|
+
const component = ref();
|
|
3971
|
+
const defaultTabKey = computed(() => {
|
|
3972
|
+
const tab = localStorage.getItem(getStoreTabKey(version.value));
|
|
3973
|
+
if (!tab) return DateMode.Date;
|
|
3974
|
+
if (Object.values(DateMode).includes(tab)) {
|
|
3975
|
+
return tab;
|
|
3976
|
+
}
|
|
3977
|
+
return null;
|
|
3978
|
+
});
|
|
3979
|
+
const activeDatePickTab = ref(props.defaultDate.dateMode || defaultTabKey.value);
|
|
3980
|
+
const browserTimezone = dayjs.tz.guess();
|
|
3981
|
+
const recentUseList = shallowRef(getStoreDateList(storeKey2.value));
|
|
3982
|
+
const commonUseDateList = computed(() => {
|
|
3983
|
+
var _a;
|
|
3984
|
+
return (_a = commonUseList.value || commonDateList) == null ? void 0 : _a.map((date) => {
|
|
3985
|
+
if ((date == null ? void 0 : date.id) && date.name) {
|
|
3986
|
+
const dateRange = new DateRange(date.id, format.value, props.timezone);
|
|
3987
|
+
dateRange.setUserDisplayName(date.name);
|
|
3988
|
+
return dateRange;
|
|
3989
|
+
}
|
|
3990
|
+
return new DateRange(date, format.value, props.timezone);
|
|
3991
|
+
});
|
|
3992
|
+
});
|
|
3993
|
+
const recentUseDateList = computed(() => {
|
|
3994
|
+
var _a;
|
|
3995
|
+
return (_a = recentUseList.value) == null ? void 0 : _a.map((date) => {
|
|
3996
|
+
return new DateRange(date, format.value, props.timezone);
|
|
3997
|
+
});
|
|
3998
|
+
});
|
|
3999
|
+
useKeydownEnter(() => {
|
|
4000
|
+
let element = document == null ? void 0 : document.activeElement;
|
|
4001
|
+
element == null ? void 0 : element.blur();
|
|
4002
|
+
nextTick(() => {
|
|
4003
|
+
var _a;
|
|
4004
|
+
(_a = component.value) == null ? void 0 : _a.handleSubmit();
|
|
4005
|
+
});
|
|
4006
|
+
});
|
|
4007
|
+
const handleChange = (date) => {
|
|
4008
|
+
emits("change", date);
|
|
4009
|
+
};
|
|
4010
|
+
const getComponent = () => {
|
|
4011
|
+
switch (activeDatePickTab.value) {
|
|
4012
|
+
case DateMode.RECENT:
|
|
4013
|
+
case DateMode.FUTURE:
|
|
4014
|
+
return _sfc_main$2;
|
|
4015
|
+
case DateMode.NATURAL:
|
|
4016
|
+
return _sfc_main$4;
|
|
4017
|
+
case DateMode.Date:
|
|
2875
4018
|
default:
|
|
2876
|
-
return
|
|
4019
|
+
return _sfc_main$6;
|
|
2877
4020
|
}
|
|
2878
|
-
}
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
}
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
"
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
4021
|
+
};
|
|
4022
|
+
const handleToggleTimezoneSet = () => {
|
|
4023
|
+
timezoneSet.value = !timezoneSet.value;
|
|
4024
|
+
};
|
|
4025
|
+
const handleTimezoneChange = (v, info) => {
|
|
4026
|
+
emits("update:timezone", v, info);
|
|
4027
|
+
};
|
|
4028
|
+
const handleDateTabChange = (v) => {
|
|
4029
|
+
activeDatePickTab.value = v;
|
|
4030
|
+
localStorage.setItem(getStoreTabKey(version.value), v);
|
|
4031
|
+
};
|
|
4032
|
+
const handleDeleteConfirm = () => {
|
|
4033
|
+
recentUseList.value = [];
|
|
4034
|
+
localStorage.removeItem(storeKey2.value);
|
|
4035
|
+
};
|
|
4036
|
+
return (_ctx, _cache) => {
|
|
4037
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
4038
|
+
createVNode(DateTitle, { onConfirm: handleDeleteConfirm }),
|
|
4039
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
4040
|
+
createVNode(DateList, {
|
|
4041
|
+
"date-list": commonUseDateList.value,
|
|
4042
|
+
"default-date": _ctx.defaultDate,
|
|
4043
|
+
"is-recent": false,
|
|
4044
|
+
onChange: handleChange
|
|
4045
|
+
}, null, 8, ["date-list", "default-date"]),
|
|
4046
|
+
createVNode(DateList, {
|
|
4047
|
+
"date-list": recentUseDateList.value,
|
|
4048
|
+
"default-date": _ctx.defaultDate,
|
|
4049
|
+
"is-recent": true,
|
|
4050
|
+
onChange: handleChange
|
|
4051
|
+
}, null, 8, ["date-list", "default-date"])
|
|
4052
|
+
]),
|
|
4053
|
+
createVNode(_sfc_main$a, {
|
|
4054
|
+
class: "date-pick-tab",
|
|
4055
|
+
"model-value": activeDatePickTab.value,
|
|
4056
|
+
panels: unref(datePickTabList),
|
|
4057
|
+
"onUpdate:modelValue": handleDateTabChange
|
|
4058
|
+
}, null, 8, ["model-value", "panels"]),
|
|
4059
|
+
(openBlock(), createBlock(
|
|
4060
|
+
KeepAlive,
|
|
2901
4061
|
null,
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
type: "empty"
|
|
2919
|
-
}),
|
|
2920
|
-
v(
|
|
2921
|
-
"div",
|
|
2922
|
-
Et,
|
|
2923
|
-
k(o.value === "recent" ? t(r)("暂无最近使用记录") : t(r)("暂无常用时间")),
|
|
2924
|
-
1
|
|
2925
|
-
/* TEXT */
|
|
2926
|
-
)
|
|
2927
|
-
])),
|
|
2928
|
-
E(Ua, {
|
|
2929
|
-
"model-value": S.value,
|
|
2930
|
-
panels: t(Se),
|
|
2931
|
-
"onUpdate:modelValue": g,
|
|
2932
|
-
class: "date-pick-tab"
|
|
2933
|
-
}, null, 8, ["model-value", "panels"]),
|
|
2934
|
-
(p(), K(
|
|
2935
|
-
me,
|
|
2936
|
-
null,
|
|
2937
|
-
[
|
|
2938
|
-
(p(), K(he(H()), {
|
|
2939
|
-
key: S.value,
|
|
2940
|
-
type: S.value,
|
|
2941
|
-
value: x.defaultDate,
|
|
2942
|
-
onChange: $
|
|
2943
|
-
}, null, 40, ["type", "value"]))
|
|
2944
|
-
],
|
|
2945
|
-
1024
|
|
2946
|
-
/* DYNAMIC_SLOTS */
|
|
2947
|
-
)),
|
|
2948
|
-
x.needTimezone ? (p(), z("div", St, [
|
|
2949
|
-
G(
|
|
2950
|
-
k(t(h).label === t(D) ? t(r)("浏览器时区") : "") + " ",
|
|
2951
|
-
1
|
|
2952
|
-
/* TEXT */
|
|
2953
|
-
),
|
|
2954
|
-
v("span", Ct, [
|
|
2955
|
-
G(
|
|
2956
|
-
k(t(h).label) + " ",
|
|
4062
|
+
[
|
|
4063
|
+
(openBlock(), createBlock(resolveDynamicComponent(getComponent()), {
|
|
4064
|
+
key: activeDatePickTab.value,
|
|
4065
|
+
ref_key: "component",
|
|
4066
|
+
ref: component,
|
|
4067
|
+
type: activeDatePickTab.value,
|
|
4068
|
+
value: _ctx.defaultDate,
|
|
4069
|
+
onChange: handleChange
|
|
4070
|
+
}, null, 40, ["type", "value"]))
|
|
4071
|
+
],
|
|
4072
|
+
1024
|
|
4073
|
+
/* DYNAMIC_SLOTS */
|
|
4074
|
+
)),
|
|
4075
|
+
_ctx.needTimezone ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
4076
|
+
createTextVNode(
|
|
4077
|
+
toDisplayString(unref(timezoneInfo).label === unref(browserTimezone) ? unref(t)("浏览器时区") : "") + " ",
|
|
2957
4078
|
1
|
|
2958
4079
|
/* TEXT */
|
|
2959
4080
|
),
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
k(t(h).country) + ", " + k(t(h).abbreviation),
|
|
2964
|
-
1
|
|
2965
|
-
/* TEXT */
|
|
2966
|
-
)
|
|
2967
|
-
]),
|
|
2968
|
-
v(
|
|
2969
|
-
"span",
|
|
2970
|
-
Tt,
|
|
2971
|
-
k(t(h).utc),
|
|
2972
|
-
1
|
|
2973
|
-
/* TEXT */
|
|
2974
|
-
),
|
|
2975
|
-
E(t(wa), {
|
|
2976
|
-
onClick: _,
|
|
2977
|
-
class: "time-zone-btn",
|
|
2978
|
-
size: "small"
|
|
2979
|
-
}, {
|
|
2980
|
-
default: j(() => [
|
|
2981
|
-
G(
|
|
2982
|
-
k(t(r)("时区设置")),
|
|
4081
|
+
createElementVNode("span", _hoisted_4, [
|
|
4082
|
+
createTextVNode(
|
|
4083
|
+
toDisplayString(unref(timezoneInfo).label) + " ",
|
|
2983
4084
|
1
|
|
2984
4085
|
/* TEXT */
|
|
2985
|
-
)
|
|
4086
|
+
),
|
|
4087
|
+
unref(timezoneInfo).country ? (openBlock(), createElementBlock(
|
|
4088
|
+
"span",
|
|
4089
|
+
_hoisted_5,
|
|
4090
|
+
toDisplayString(unref(timezoneInfo).country) + ", " + toDisplayString(unref(timezoneInfo).abbreviation),
|
|
4091
|
+
1
|
|
4092
|
+
/* TEXT */
|
|
4093
|
+
)) : createCommentVNode("v-if", true)
|
|
2986
4094
|
]),
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
},
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
4095
|
+
typeof unref(timezoneInfo).utc !== "undefined" ? (openBlock(), createElementBlock(
|
|
4096
|
+
"span",
|
|
4097
|
+
_hoisted_6,
|
|
4098
|
+
toDisplayString(unref(timezoneInfo).utc),
|
|
4099
|
+
1
|
|
4100
|
+
/* TEXT */
|
|
4101
|
+
)) : createCommentVNode("v-if", true),
|
|
4102
|
+
createVNode(unref(Button), {
|
|
4103
|
+
class: "time-zone-btn",
|
|
4104
|
+
size: "small",
|
|
4105
|
+
onClick: handleToggleTimezoneSet
|
|
4106
|
+
}, {
|
|
4107
|
+
default: withCtx(() => [
|
|
4108
|
+
createTextVNode(
|
|
4109
|
+
toDisplayString(unref(t)("时区设置")),
|
|
4110
|
+
1
|
|
4111
|
+
/* TEXT */
|
|
4112
|
+
)
|
|
4113
|
+
]),
|
|
4114
|
+
_: 1
|
|
4115
|
+
/* STABLE */
|
|
4116
|
+
})
|
|
4117
|
+
])) : createCommentVNode("v-if", true),
|
|
4118
|
+
withDirectives(createElementVNode(
|
|
4119
|
+
"div",
|
|
4120
|
+
_hoisted_7,
|
|
4121
|
+
[
|
|
4122
|
+
createVNode(_sfc_main$b, {
|
|
4123
|
+
value: _ctx.timezone || unref(browserTimezone),
|
|
4124
|
+
"onUpdate:value": handleTimezoneChange
|
|
4125
|
+
}, null, 8, ["value"])
|
|
4126
|
+
],
|
|
4127
|
+
512
|
|
4128
|
+
/* NEED_PATCH */
|
|
4129
|
+
), [
|
|
4130
|
+
[vShow, timezoneSet.value]
|
|
4131
|
+
])
|
|
4132
|
+
]);
|
|
4133
|
+
};
|
|
3006
4134
|
}
|
|
3007
|
-
})
|
|
3008
|
-
|
|
3009
|
-
{
|
|
3010
|
-
class: "date-content-icon",
|
|
3011
|
-
height: "14",
|
|
3012
|
-
version: "1.1",
|
|
3013
|
-
viewBox: "0 0 1024 1024",
|
|
3014
|
-
width: "14",
|
|
3015
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3016
|
-
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
3017
|
-
},
|
|
3018
|
-
[
|
|
3019
|
-
/* @__PURE__ */ v("path", {
|
|
3020
|
-
d: "M486.656 997.312c-268.288 0-486.656-218.304-486.656-486.656 0-268.288 218.304-486.656 486.656-486.656 268.352 0 486.656 218.304 486.656 486.656C973.376 779.008 755.008 997.312 486.656 997.312zM486.656 88c-233.088 0-422.656 189.568-422.656 422.656 0 233.088 189.568 422.656 422.656 422.656s422.656-189.632 422.656-422.656C909.376 277.568 719.744 88 486.656 88z",
|
|
3021
|
-
fill: "#979BA5"
|
|
3022
|
-
}),
|
|
3023
|
-
/* @__PURE__ */ v("path", {
|
|
3024
|
-
d: "M816.064 544 432.064 544 432.064 160 496.064 160 496.064 480 816.064 480Z",
|
|
3025
|
-
fill: "#979BA5"
|
|
3026
|
-
})
|
|
3027
|
-
],
|
|
3028
|
-
-1
|
|
3029
|
-
/* HOISTED */
|
|
3030
|
-
), jt = {
|
|
4135
|
+
});
|
|
4136
|
+
const _hoisted_1 = {
|
|
3031
4137
|
key: 0,
|
|
3032
4138
|
class: "date-content-utc"
|
|
3033
|
-
}
|
|
4139
|
+
};
|
|
4140
|
+
const _hoisted_2 = { class: "date-tooltips-timezone" };
|
|
4141
|
+
const _hoisted_3 = {
|
|
3034
4142
|
key: 0,
|
|
3035
4143
|
class: "date-tooltips-diff"
|
|
3036
|
-
}
|
|
3037
|
-
|
|
4144
|
+
};
|
|
4145
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4146
|
+
...{
|
|
4147
|
+
name: "DatePicker"
|
|
4148
|
+
},
|
|
3038
4149
|
__name: "date-picker",
|
|
3039
4150
|
props: {
|
|
3040
4151
|
behavior: { default: "normal" },
|
|
3041
|
-
commonUseList: { default: ka },
|
|
3042
4152
|
disabled: { type: Boolean },
|
|
4153
|
+
enableFormatClick: { type: Boolean, default: true },
|
|
3043
4154
|
format: { default: "YYYY-MM-DD HH:mm:ss" },
|
|
4155
|
+
id: { default: "key" },
|
|
4156
|
+
maxDuration: {},
|
|
4157
|
+
minDuration: {},
|
|
3044
4158
|
modelValue: {},
|
|
3045
|
-
needTimezone: { type: Boolean, default:
|
|
4159
|
+
needTimezone: { type: Boolean, default: true },
|
|
3046
4160
|
timezone: {},
|
|
3047
|
-
|
|
4161
|
+
validDateRange: {},
|
|
4162
|
+
version: { default: "1.0" },
|
|
4163
|
+
commonUseList: { default: () => commonDateList }
|
|
3048
4164
|
},
|
|
3049
|
-
emits: ["update:modelValue", "update:timezone"],
|
|
3050
|
-
setup(
|
|
3051
|
-
|
|
3052
|
-
...
|
|
4165
|
+
emits: ["update:modelValue", "update:timezone", "update:format"],
|
|
4166
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4167
|
+
dayjs.locale({
|
|
4168
|
+
...lang === "en" ? en : cn,
|
|
3053
4169
|
weekStart: 1
|
|
3054
|
-
})
|
|
4170
|
+
});
|
|
4171
|
+
provideGlobalConfig({
|
|
3055
4172
|
prefix: "bk"
|
|
3056
4173
|
});
|
|
3057
|
-
const
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
4174
|
+
const props = __props;
|
|
4175
|
+
const emits = __emit;
|
|
4176
|
+
const dateTooltipsRef = ref();
|
|
4177
|
+
const dateContentRef = ref();
|
|
4178
|
+
const format = ref(props.format);
|
|
4179
|
+
const timezoneInfo = computed(() => {
|
|
4180
|
+
let timezone = props.timezone || dayjs.tz.guess();
|
|
4181
|
+
if (!isValidTimeZone(timezone)) {
|
|
4182
|
+
console.error(`invalid timezone: ${props.timezone} datepicker will use ${DEFAULT_TIMEZONE} as default`);
|
|
4183
|
+
timezone = DEFAULT_TIMEZONE;
|
|
4184
|
+
}
|
|
4185
|
+
return getTimezoneInfoByValue(timezone) || { label: props.timezone, value: props.timezone };
|
|
4186
|
+
});
|
|
4187
|
+
const diffTimezone = computed(() => {
|
|
4188
|
+
const timezone = timezoneInfo.value.label;
|
|
4189
|
+
if (!timezone || props.timezone === dayjs.tz.guess()) return 0;
|
|
4190
|
+
const a = dayjs().utcOffset();
|
|
4191
|
+
const b = dayjs.tz(dayjs(), timezone).utcOffset();
|
|
4192
|
+
return (b - a) / 60;
|
|
4193
|
+
});
|
|
4194
|
+
const dateDetail = shallowRef(new DateRange(props.modelValue, props.format));
|
|
4195
|
+
const tooltipsDetail = shallowRef();
|
|
4196
|
+
const storeKey2 = computed(() => getStoreKey(props.version));
|
|
4197
|
+
const datePanelShow = ref(false);
|
|
4198
|
+
const tooltipsShow = ref(false);
|
|
4199
|
+
let enterTimer;
|
|
4200
|
+
let leaveTimer;
|
|
4201
|
+
const commonDateUseList = computed(() => {
|
|
4202
|
+
var _a;
|
|
4203
|
+
return ((_a = props.commonUseList) == null ? void 0 : _a.length) ? props.commonUseList : commonDateList;
|
|
4204
|
+
});
|
|
4205
|
+
const dateDetailDisplayString = computed(() => {
|
|
4206
|
+
var _a;
|
|
4207
|
+
const commonDate = commonDateUseList.value.find((item) => {
|
|
4208
|
+
var _a2, _b, _c, _d;
|
|
4209
|
+
return Array.isArray(item.id) && ((_b = (_a2 = item.id).join) == null ? void 0 : _b.call(_a2, "_")) === ((_d = (_c = dateDetail.value) == null ? void 0 : _c.dateValue) == null ? void 0 : _d.join("_"));
|
|
4210
|
+
});
|
|
4211
|
+
if (commonDate) {
|
|
4212
|
+
return commonDate.name;
|
|
4213
|
+
}
|
|
4214
|
+
return (_a = dateDetail.value) == null ? void 0 : _a.toDisplayString();
|
|
4215
|
+
});
|
|
4216
|
+
watch(
|
|
4217
|
+
() => props.format,
|
|
4218
|
+
() => {
|
|
4219
|
+
format.value = props.format;
|
|
4220
|
+
}
|
|
4221
|
+
);
|
|
4222
|
+
watch(
|
|
4223
|
+
() => props.modelValue,
|
|
4224
|
+
(v) => {
|
|
4225
|
+
var _a, _b;
|
|
4226
|
+
if (((_b = (_a = dateDetail.value) == null ? void 0 : _a.dateValue) == null ? void 0 : _b.length) && dateDetail.value.dateValue.every((item, index) => item === (v == null ? void 0 : v[index])))
|
|
4227
|
+
return;
|
|
4228
|
+
dateDetail.value = new DateRange(v, format.value, timezoneInfo.value.label);
|
|
4229
|
+
},
|
|
4230
|
+
{
|
|
4231
|
+
immediate: true
|
|
3072
4232
|
}
|
|
3073
4233
|
);
|
|
3074
|
-
const
|
|
3075
|
-
|
|
3076
|
-
|
|
4234
|
+
const formatChange = (f) => {
|
|
4235
|
+
if (props.enableFormatClick) {
|
|
4236
|
+
emits("update:format", f);
|
|
4237
|
+
format.value = f;
|
|
4238
|
+
}
|
|
4239
|
+
};
|
|
4240
|
+
useDatePickerProvider({
|
|
4241
|
+
formatChange,
|
|
4242
|
+
commonUseList: commonDateUseList,
|
|
4243
|
+
format,
|
|
4244
|
+
storeKey: storeKey2,
|
|
4245
|
+
t,
|
|
4246
|
+
timezoneInfo,
|
|
4247
|
+
enableFormatClick: props.enableFormatClick,
|
|
4248
|
+
version: computed(() => props.version),
|
|
4249
|
+
validateTimeRange: computed(() => props.validDateRange),
|
|
4250
|
+
minDuration: computed(() => props.minDuration),
|
|
4251
|
+
maxDuration: computed(() => props.maxDuration)
|
|
3077
4252
|
});
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
storeKey: S,
|
|
3082
|
-
t: r,
|
|
3083
|
-
timezoneInfo: c,
|
|
3084
|
-
version: J(() => e.version)
|
|
3085
|
-
}), be(() => {
|
|
3086
|
-
N.value = !1, D.value = !1;
|
|
4253
|
+
onBeforeUnmount(() => {
|
|
4254
|
+
tooltipsShow.value = false;
|
|
4255
|
+
datePanelShow.value = false;
|
|
3087
4256
|
});
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
4257
|
+
function handleDateMouseenter() {
|
|
4258
|
+
if (enterTimer) return;
|
|
4259
|
+
enterTimer = setTimeout(() => {
|
|
4260
|
+
tooltipsShow.value = true;
|
|
4261
|
+
tooltipsDetail.value = new DateRange(dateDetail.value.dateValue, format.value, timezoneInfo.value.label);
|
|
4262
|
+
enterTimer = null;
|
|
4263
|
+
}, 100);
|
|
3093
4264
|
}
|
|
3094
|
-
function
|
|
3095
|
-
|
|
3096
|
-
|
|
4265
|
+
function handleDateMouseleave() {
|
|
4266
|
+
if (leaveTimer) clearTimeout(leaveTimer);
|
|
4267
|
+
leaveTimer = setTimeout(() => {
|
|
4268
|
+
tooltipsShow.value = false;
|
|
4269
|
+
leaveTimer = null;
|
|
3097
4270
|
}, 301);
|
|
3098
4271
|
}
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3101
|
-
const [
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
const
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
4272
|
+
const handleChange = (val) => {
|
|
4273
|
+
datePanelShow.value = false;
|
|
4274
|
+
const [start, end] = val;
|
|
4275
|
+
const [oldStart, oldEnd] = props.modelValue || [];
|
|
4276
|
+
if (start && end && start === oldStart && end === oldEnd) return;
|
|
4277
|
+
dateDetail.value = new DateRange(val, format.value, timezoneInfo.value.label);
|
|
4278
|
+
const emitValue = dateDetail.value.toEmitValue();
|
|
4279
|
+
emits("update:modelValue", ...emitValue, [...val]);
|
|
4280
|
+
const canStore = commonDateUseList.value.some((item) => {
|
|
4281
|
+
const startDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[0] : item[0];
|
|
4282
|
+
const endDate = Array.isArray(item == null ? void 0 : item.id) ? item.id[1] : item[1];
|
|
4283
|
+
return startDate === start && endDate === end;
|
|
4284
|
+
});
|
|
4285
|
+
if (canStore && dateDetail.value.isValidate) {
|
|
4286
|
+
setStoreDateList(val, storeKey2.value);
|
|
4287
|
+
}
|
|
4288
|
+
};
|
|
4289
|
+
const handleTimezoneChange = (val, info) => {
|
|
4290
|
+
dateDetail.value = new DateRange(props.modelValue, format.value, val);
|
|
4291
|
+
emits("update:timezone", val, { ...info });
|
|
4292
|
+
sessionStorage.setItem(timezoneStoreKey, val);
|
|
4293
|
+
};
|
|
4294
|
+
const handleHidden = () => {
|
|
4295
|
+
datePanelShow.value = false;
|
|
4296
|
+
};
|
|
4297
|
+
const diffDateDuration = (type) => {
|
|
4298
|
+
var _a, _b;
|
|
4299
|
+
if (((_a = dateDetail.value.dateValue) == null ? void 0 : _a.length) < 2) return;
|
|
4300
|
+
const { endDate, startDate } = dateDetail.value;
|
|
4301
|
+
const durations = dateDetail.value.dateDuration();
|
|
4302
|
+
const val = type === "left" ? [startDate.subtract(durations), endDate.subtract(durations)] : [startDate.add(durations), endDate.add(durations)];
|
|
4303
|
+
if ((_b = props.validDateRange) == null ? void 0 : _b.length) {
|
|
4304
|
+
const validDateRange = new DateRange(props.validDateRange, props.format);
|
|
4305
|
+
if (!validDateRange.isInValidDateRange(new DateRange(val, props.format))) return;
|
|
4306
|
+
}
|
|
4307
|
+
handleChange(val);
|
|
4308
|
+
};
|
|
4309
|
+
const handleClickLeft = () => {
|
|
4310
|
+
diffDateDuration("left");
|
|
4311
|
+
};
|
|
4312
|
+
const handleClickRight = () => {
|
|
4313
|
+
diffDateDuration("right");
|
|
4314
|
+
};
|
|
4315
|
+
const handleClickoutside = (e) => {
|
|
4316
|
+
if (!datePanelShow.value) return;
|
|
4317
|
+
if (!Array.from(document.querySelectorAll(".__bk-date-picker-popover__")).some(
|
|
4318
|
+
(item) => item.contains(e.target)
|
|
4319
|
+
)) {
|
|
4320
|
+
handleHidden();
|
|
4321
|
+
}
|
|
4322
|
+
};
|
|
4323
|
+
const handleClickDate = () => {
|
|
4324
|
+
datePanelShow.value = !datePanelShow.value;
|
|
4325
|
+
if (datePanelShow.value) {
|
|
4326
|
+
tooltipsShow.value = false;
|
|
4327
|
+
}
|
|
4328
|
+
};
|
|
4329
|
+
__expose({
|
|
3129
4330
|
handleHidePanel: () => {
|
|
3130
|
-
|
|
4331
|
+
datePanelShow.value = false;
|
|
3131
4332
|
},
|
|
3132
4333
|
handleShowPanel: () => {
|
|
3133
|
-
|
|
4334
|
+
datePanelShow.value = true;
|
|
3134
4335
|
}
|
|
3135
|
-
})
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
arrow: !1,
|
|
3153
|
-
"is-show": D.value,
|
|
3154
|
-
offset: { mainAxis: 10, crossAxis: 10, alignmentAxis: -32 },
|
|
3155
|
-
onAfterHidden: B,
|
|
3156
|
-
"ext-cls": "bk-date-picker-popover __bk-date-picker-popover__",
|
|
3157
|
-
placement: "bottom-start",
|
|
3158
|
-
theme: "light",
|
|
3159
|
-
trigger: "manual"
|
|
3160
|
-
}, {
|
|
3161
|
-
content: j(() => [
|
|
3162
|
-
E(Nt, {
|
|
3163
|
-
"default-date": o.value,
|
|
3164
|
-
"need-timezone": f.needTimezone,
|
|
3165
|
-
timezone: f.timezone,
|
|
3166
|
-
onChange: g,
|
|
3167
|
-
"onUpdate:timezone": P
|
|
3168
|
-
}, null, 8, ["default-date", "need-timezone", "timezone"])
|
|
4336
|
+
});
|
|
4337
|
+
return (_ctx, _cache) => {
|
|
4338
|
+
return openBlock(), createElementBlock(
|
|
4339
|
+
"div",
|
|
4340
|
+
{
|
|
4341
|
+
class: normalizeClass({
|
|
4342
|
+
__bk_date_picker__: true,
|
|
4343
|
+
"is-simplicity": _ctx.behavior === "simplicity",
|
|
4344
|
+
"is-disabled": _ctx.disabled
|
|
4345
|
+
})
|
|
4346
|
+
},
|
|
4347
|
+
[
|
|
4348
|
+
createElementVNode("span", {
|
|
4349
|
+
class: "date-icon",
|
|
4350
|
+
onClick: handleClickLeft
|
|
4351
|
+
}, [
|
|
4352
|
+
createVNode(unref(AngleLeft), { class: "date-icon-left" })
|
|
3169
4353
|
]),
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
{
|
|
3230
|
-
style: Ja({ maxWidth: t(pa) === "en" ? "210px" : "156px" }),
|
|
3231
|
-
class: "__date-tooltips__",
|
|
3232
|
-
ref_key: "dateTooltipsRef",
|
|
3233
|
-
ref: b
|
|
3234
|
-
},
|
|
3235
|
-
[
|
|
3236
|
-
v(
|
|
3237
|
-
"div",
|
|
3238
|
-
null,
|
|
3239
|
-
k((M = y.value) == null ? void 0 : M.startDisplayText),
|
|
3240
|
-
1
|
|
3241
|
-
/* TEXT */
|
|
3242
|
-
),
|
|
3243
|
-
G(" to "),
|
|
3244
|
-
v(
|
|
3245
|
-
"div",
|
|
3246
|
-
null,
|
|
3247
|
-
k((w = y.value) == null ? void 0 : w.endDisplayText),
|
|
3248
|
-
1
|
|
3249
|
-
/* TEXT */
|
|
3250
|
-
),
|
|
3251
|
-
v(
|
|
3252
|
-
"div",
|
|
3253
|
-
Yt,
|
|
3254
|
-
k(c.value.label === t(d).tz.guess() ? `${t(r)("浏览器时区")} (${c.value.label})` : c.value.label),
|
|
3255
|
-
1
|
|
3256
|
-
/* TEXT */
|
|
3257
|
-
),
|
|
3258
|
-
s.value ? (p(), z(
|
|
3259
|
-
"div",
|
|
3260
|
-
Bt,
|
|
3261
|
-
k(t(r)(s.value < 0 ? "时差:晚 $n 小时" : "时差:早 $n 小时").replace(
|
|
3262
|
-
"$n",
|
|
3263
|
-
Math.abs(s.value).toString()
|
|
4354
|
+
createVNode(unref(Popover), {
|
|
4355
|
+
arrow: false,
|
|
4356
|
+
"ext-cls": `bk-date-picker-popover __bk-date-picker-popover__ __bk-date-picker-popover__${_ctx.id}`,
|
|
4357
|
+
"is-show": datePanelShow.value,
|
|
4358
|
+
offset: { mainAxis: 10, crossAxis: 10, alignmentAxis: -32 },
|
|
4359
|
+
placement: "bottom-start",
|
|
4360
|
+
theme: "light",
|
|
4361
|
+
trigger: "manual",
|
|
4362
|
+
onAfterHidden: handleHidden
|
|
4363
|
+
}, {
|
|
4364
|
+
content: withCtx(() => [
|
|
4365
|
+
createVNode(_sfc_main$1, {
|
|
4366
|
+
"default-date": dateDetail.value,
|
|
4367
|
+
"max-duration": _ctx.maxDuration,
|
|
4368
|
+
"min-duration": _ctx.minDuration,
|
|
4369
|
+
"need-timezone": _ctx.needTimezone,
|
|
4370
|
+
timezone: timezoneInfo.value.label,
|
|
4371
|
+
onChange: handleChange,
|
|
4372
|
+
"onUpdate:timezone": handleTimezoneChange
|
|
4373
|
+
}, null, 8, ["default-date", "max-duration", "min-duration", "need-timezone", "timezone"])
|
|
4374
|
+
]),
|
|
4375
|
+
default: withCtx(() => {
|
|
4376
|
+
var _a, _b, _c, _d;
|
|
4377
|
+
return [
|
|
4378
|
+
withDirectives((openBlock(), createElementBlock(
|
|
4379
|
+
"span",
|
|
4380
|
+
{
|
|
4381
|
+
ref_key: "dateContentRef",
|
|
4382
|
+
ref: dateContentRef,
|
|
4383
|
+
class: "date-content",
|
|
4384
|
+
popoverDelay: [100, 10],
|
|
4385
|
+
onClick: handleClickDate,
|
|
4386
|
+
onMouseenter: handleDateMouseenter,
|
|
4387
|
+
onMouseleave: handleDateMouseleave
|
|
4388
|
+
},
|
|
4389
|
+
[
|
|
4390
|
+
_cache[0] || (_cache[0] = createElementVNode(
|
|
4391
|
+
"svg",
|
|
4392
|
+
{
|
|
4393
|
+
class: "date-content-icon",
|
|
4394
|
+
height: "14",
|
|
4395
|
+
version: "1.1",
|
|
4396
|
+
viewBox: "0 0 1024 1024",
|
|
4397
|
+
width: "14",
|
|
4398
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4399
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
4400
|
+
},
|
|
4401
|
+
[
|
|
4402
|
+
createElementVNode("path", {
|
|
4403
|
+
d: "M486.656 997.312c-268.288 0-486.656-218.304-486.656-486.656 0-268.288 218.304-486.656 486.656-486.656 268.352 0 486.656 218.304 486.656 486.656C973.376 779.008 755.008 997.312 486.656 997.312zM486.656 88c-233.088 0-422.656 189.568-422.656 422.656 0 233.088 189.568 422.656 422.656 422.656s422.656-189.632 422.656-422.656C909.376 277.568 719.744 88 486.656 88z",
|
|
4404
|
+
fill: "#979BA5"
|
|
4405
|
+
}),
|
|
4406
|
+
createElementVNode("path", {
|
|
4407
|
+
d: "M816.064 544 432.064 544 432.064 160 496.064 160 496.064 480 816.064 480Z",
|
|
4408
|
+
fill: "#979BA5"
|
|
4409
|
+
})
|
|
4410
|
+
],
|
|
4411
|
+
-1
|
|
4412
|
+
/* HOISTED */
|
|
3264
4413
|
)),
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
4414
|
+
createElementVNode(
|
|
4415
|
+
"span",
|
|
4416
|
+
null,
|
|
4417
|
+
toDisplayString(dateDetailDisplayString.value),
|
|
4418
|
+
1
|
|
4419
|
+
/* TEXT */
|
|
4420
|
+
),
|
|
4421
|
+
_ctx.needTimezone && ((_a = timezoneInfo.value) == null ? void 0 : _a.label) !== unref(dayjs).tz.guess() ? (openBlock(), createElementBlock(
|
|
4422
|
+
"span",
|
|
4423
|
+
_hoisted_1,
|
|
4424
|
+
toDisplayString(((_b = timezoneInfo.value) == null ? void 0 : _b.abbreviation) || ((_d = (_c = timezoneInfo.value) == null ? void 0 : _c.utc) == null ? void 0 : _d.replace("UTC", "").replace(":00", ""))),
|
|
4425
|
+
1
|
|
4426
|
+
/* TEXT */
|
|
4427
|
+
)) : createCommentVNode("v-if", true)
|
|
4428
|
+
],
|
|
4429
|
+
32
|
|
4430
|
+
/* NEED_HYDRATION */
|
|
4431
|
+
)), [
|
|
4432
|
+
[unref(clickoutside), handleClickoutside]
|
|
4433
|
+
])
|
|
4434
|
+
];
|
|
4435
|
+
}),
|
|
4436
|
+
_: 1
|
|
4437
|
+
/* STABLE */
|
|
4438
|
+
}, 8, ["ext-cls", "is-show"]),
|
|
4439
|
+
createElementVNode("span", {
|
|
4440
|
+
class: "date-icon",
|
|
4441
|
+
onClick: handleClickRight
|
|
4442
|
+
}, [
|
|
4443
|
+
createVNode(unref(AngleRight), { class: "date-icon-right" })
|
|
4444
|
+
]),
|
|
4445
|
+
createVNode(unref(Popover), {
|
|
4446
|
+
"is-show": tooltipsShow.value,
|
|
4447
|
+
offset: 12,
|
|
4448
|
+
placement: "top",
|
|
4449
|
+
target: dateContentRef.value,
|
|
4450
|
+
trigger: "manual"
|
|
4451
|
+
}, {
|
|
4452
|
+
content: withCtx(() => {
|
|
4453
|
+
var _a, _b, _c, _d, _e;
|
|
4454
|
+
return [
|
|
4455
|
+
createElementVNode(
|
|
4456
|
+
"div",
|
|
4457
|
+
{
|
|
4458
|
+
ref_key: "dateTooltipsRef",
|
|
4459
|
+
ref: dateTooltipsRef,
|
|
4460
|
+
class: "__date-tooltips__",
|
|
4461
|
+
style: normalizeStyle({ maxWidth: unref(lang) === "en" ? "210px" : "156px" })
|
|
4462
|
+
},
|
|
4463
|
+
[
|
|
4464
|
+
createElementVNode(
|
|
4465
|
+
"div",
|
|
4466
|
+
null,
|
|
4467
|
+
toDisplayString((_a = tooltipsDetail.value) == null ? void 0 : _a.startDisplayText),
|
|
4468
|
+
1
|
|
4469
|
+
/* TEXT */
|
|
4470
|
+
),
|
|
4471
|
+
_cache[1] || (_cache[1] = createTextVNode(" to ")),
|
|
4472
|
+
createElementVNode(
|
|
4473
|
+
"div",
|
|
4474
|
+
null,
|
|
4475
|
+
toDisplayString((_b = tooltipsDetail.value) == null ? void 0 : _b.endDisplayText),
|
|
4476
|
+
1
|
|
4477
|
+
/* TEXT */
|
|
4478
|
+
),
|
|
4479
|
+
createElementVNode(
|
|
4480
|
+
"div",
|
|
4481
|
+
_hoisted_2,
|
|
4482
|
+
toDisplayString(((_c = timezoneInfo.value) == null ? void 0 : _c.label) === unref(dayjs).tz.guess() ? `${unref(t)("浏览器时区")} (${(_d = timezoneInfo.value) == null ? void 0 : _d.label})` : (_e = timezoneInfo.value) == null ? void 0 : _e.label),
|
|
4483
|
+
1
|
|
4484
|
+
/* TEXT */
|
|
4485
|
+
),
|
|
4486
|
+
diffTimezone.value ? (openBlock(), createElementBlock(
|
|
4487
|
+
"div",
|
|
4488
|
+
_hoisted_3,
|
|
4489
|
+
toDisplayString(unref(t)(diffTimezone.value < 0 ? "时差:晚 $n 小时" : "时差:早 $n 小时").replace(
|
|
4490
|
+
"$n",
|
|
4491
|
+
Math.abs(diffTimezone.value).toString()
|
|
4492
|
+
)),
|
|
4493
|
+
1
|
|
4494
|
+
/* TEXT */
|
|
4495
|
+
)) : createCommentVNode("v-if", true)
|
|
4496
|
+
],
|
|
4497
|
+
4
|
|
4498
|
+
/* STYLE */
|
|
4499
|
+
)
|
|
4500
|
+
];
|
|
4501
|
+
}),
|
|
4502
|
+
_: 1
|
|
4503
|
+
/* STABLE */
|
|
4504
|
+
}, 8, ["is-show", "target"])
|
|
4505
|
+
],
|
|
4506
|
+
2
|
|
4507
|
+
/* CLASS */
|
|
4508
|
+
);
|
|
4509
|
+
};
|
|
3281
4510
|
}
|
|
3282
4511
|
});
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
4512
|
+
dayjs.extend(customParseFormat);
|
|
4513
|
+
dayjs.extend(localizedFormat);
|
|
4514
|
+
dayjs.extend(tz);
|
|
4515
|
+
dayjs.extend(utc);
|
|
3287
4516
|
export {
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
4517
|
+
CommonNaturalOptions,
|
|
4518
|
+
DATE_REGEX_FORMAT,
|
|
4519
|
+
DATE_REGEX_PARSE,
|
|
4520
|
+
DEFAULT_TIMEZONE,
|
|
4521
|
+
_sfc_main as DatePicker,
|
|
4522
|
+
DateRange,
|
|
4523
|
+
DateUnitList,
|
|
4524
|
+
MAX_NUMBER_VALUE,
|
|
4525
|
+
NaturalOptionType,
|
|
4526
|
+
NaturalUnit,
|
|
4527
|
+
NowConstant,
|
|
4528
|
+
_sfc_main$b as TimezonePicker,
|
|
4529
|
+
baselineDateRegexp,
|
|
4530
|
+
commonDateList,
|
|
4531
|
+
commonDateRegexp,
|
|
4532
|
+
dateFormatList,
|
|
4533
|
+
datePickTabList,
|
|
4534
|
+
dateUnit,
|
|
4535
|
+
default2 as dayjs,
|
|
4536
|
+
_sfc_main as default,
|
|
4537
|
+
futureDateRegexp,
|
|
4538
|
+
getStoreKey,
|
|
4539
|
+
getStoreTabKey,
|
|
4540
|
+
getTimezoneDetails,
|
|
4541
|
+
getTimezoneInfo,
|
|
4542
|
+
getTimezoneInfoByValue,
|
|
4543
|
+
getTimezoneOffset,
|
|
4544
|
+
inputVal2Dayjs,
|
|
4545
|
+
isValidTimeZone,
|
|
4546
|
+
naturalDateRegexp,
|
|
4547
|
+
naturalDateShortcutMap,
|
|
4548
|
+
naturalUnitOptions,
|
|
4549
|
+
panels,
|
|
4550
|
+
recentDateRegexp,
|
|
4551
|
+
timezoneDetails,
|
|
4552
|
+
timezoneStoreKey,
|
|
4553
|
+
transformDateRange2Dayjs,
|
|
4554
|
+
transformValue2Dayjs
|
|
3315
4555
|
};
|