@ezuikit/player-theme 2.0.2-beta.3 → 2.0.2-beta.5
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/dist/index.js +646 -143
- package/dist/index.mjs +647 -144
- package/dist/index.umd.js +630 -164
- package/dist/style.css +2 -3
- package/dist/style.js +2 -2
- package/dist/types/index.d.ts +43 -67
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @ezuikit/player-theme v2.0.2-beta.
|
|
3
|
-
* Copyright (c) 2025-12-
|
|
2
|
+
* @ezuikit/player-theme v2.0.2-beta.5
|
|
3
|
+
* Copyright (c) 2025-12-09 Ezviz-OpenBiz
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
import EventEmitter from 'eventemitter3';
|
|
7
7
|
import Picker from '@skax/picker';
|
|
8
8
|
import delegate from '@skax/delegate';
|
|
9
9
|
import deepmerge from 'deepmerge';
|
|
10
|
-
import require$$1, { isMobile,
|
|
10
|
+
import require$$1, { isMobile, parseEzopenUrl } from '@ezuikit/utils-tools';
|
|
11
11
|
import screenfull from 'screenfull';
|
|
12
12
|
import I18n from '@ezuikit/utils-i18n';
|
|
13
13
|
import Logger from '@ezuikit/utils-logger';
|
|
14
|
-
import { DatePicker } from '@ezuikit/control-date-picker';
|
|
15
14
|
import { MobileTimeLine, TimeLine } from '@ezuikit/control-time-line';
|
|
16
15
|
|
|
17
16
|
/**
|
|
@@ -42,8 +41,7 @@ var THEME_PROPS = [
|
|
|
42
41
|
'speed',
|
|
43
42
|
'urlInfo',
|
|
44
43
|
'videoLevelList',
|
|
45
|
-
'videoLevel'
|
|
46
|
-
'recMonth'
|
|
44
|
+
'videoLevel'
|
|
47
45
|
];
|
|
48
46
|
/**
|
|
49
47
|
* 当移动端 picker 控件打开时需要关闭动画(定时器)
|
|
@@ -189,9 +187,8 @@ var EVENTS = {
|
|
|
189
187
|
/** 全局全屏控件销毁 */ globalFullscreenDestroy: 'Control.globalFullscreenDestroy',
|
|
190
188
|
/** 日期面板展示隐藏变换 */ datePanelOpenChange: 'Control.datePanelOpenChange',
|
|
191
189
|
/** 日期改变 */ dateChange: 'Control.dateChange',
|
|
192
|
-
/** 日期改变 */ dateMonthChange: 'Control.dateMonthChange',
|
|
193
190
|
/** 日期销毁 */ dateDestroy: 'Control.datePanelDestroy',
|
|
194
|
-
/**
|
|
191
|
+
/** 时间轴拖动结束 */ timeLineChange: 'Control.timeLineChange',
|
|
195
192
|
/** 时间轴图片列表面板 */ timeLinePanelOpenChange: 'Control.timeLinePanelOpenChange',
|
|
196
193
|
/** 时间轴控件销毁 */ timeLineDestroy: 'Control.timeLineDestroy',
|
|
197
194
|
/** 主题控件挂载前 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ beforeMountControls: 'Control.beforeMountControls',
|
|
@@ -202,7 +199,7 @@ var EVENTS = {
|
|
|
202
199
|
/** 加载控件销毁 */ loadingDestroy: 'Control.loadingDestroy',
|
|
203
200
|
/** 消息控件销毁 */ messageDestroy: 'Control.messageDestroy',
|
|
204
201
|
/** 播放器内容区域销毁 */ contentDestroy: 'Control.contentDestroy',
|
|
205
|
-
|
|
202
|
+
contentRerender: 'Control.contentRerender'
|
|
206
203
|
},
|
|
207
204
|
/**
|
|
208
205
|
* 主题控件相关
|
|
@@ -4063,11 +4060,11 @@ function debounce(func, wait) {
|
|
|
4063
4060
|
// 对讲
|
|
4064
4061
|
// =======================================================
|
|
4065
4062
|
theme.on(EVENTS.talkingChange, function(talking) {
|
|
4066
|
-
var
|
|
4063
|
+
var _theme_controls_talkControl, _theme_controls;
|
|
4067
4064
|
theme._talking = talking;
|
|
4068
|
-
if (
|
|
4069
|
-
var _theme_controls_talkControl1,
|
|
4070
|
-
(
|
|
4065
|
+
if (talking !== ((_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_talkControl = _theme_controls.talkControl) == null ? void 0 : _theme_controls_talkControl.active)) {
|
|
4066
|
+
var _theme_controls_talkControl1, _theme_controls1;
|
|
4067
|
+
(_theme_controls1 = theme.controls) == null ? void 0 : (_theme_controls_talkControl1 = _theme_controls1.talkControl) == null ? void 0 : _theme_controls_talkControl1.emit(EVENTS.talkingChange, talking);
|
|
4071
4068
|
}
|
|
4072
4069
|
});
|
|
4073
4070
|
theme.on(EVENTS.talkVolumeChange, function(value) {
|
|
@@ -4078,9 +4075,9 @@ function debounce(func, wait) {
|
|
|
4078
4075
|
// 录制
|
|
4079
4076
|
// =======================================================
|
|
4080
4077
|
theme.on(EVENTS.recordingChange, function(recording) {
|
|
4081
|
-
var
|
|
4078
|
+
var _theme_controls_recordControl, _theme_controls;
|
|
4082
4079
|
theme._recording = recording;
|
|
4083
|
-
if (
|
|
4080
|
+
if (recording !== ((_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_recordControl = _theme_controls.recordControl) == null ? void 0 : _theme_controls_recordControl.active)) theme.controls.recordControl.active = recording;
|
|
4084
4081
|
});
|
|
4085
4082
|
// =======================================================
|
|
4086
4083
|
// 清晰度
|
|
@@ -4097,14 +4094,14 @@ function debounce(func, wait) {
|
|
|
4097
4094
|
// 放大
|
|
4098
4095
|
// =======================================================
|
|
4099
4096
|
theme.on(EVENTS.zoomingChange, function(zooming) {
|
|
4100
|
-
var
|
|
4101
|
-
if (((_theme_controls1 = theme.controls) == null ? void 0 :
|
|
4097
|
+
var _theme_controls_zoomControl1, _theme_controls1;
|
|
4098
|
+
if (((_theme_controls1 = theme.controls) == null ? void 0 : (_theme_controls_zoomControl1 = _theme_controls1.zoomControl) == null ? void 0 : _theme_controls_zoomControl1.active) !== zooming) {
|
|
4102
4099
|
theme.controls.zoomControl.active = zooming;
|
|
4103
4100
|
}
|
|
4104
4101
|
});
|
|
4105
4102
|
theme.on(EVENTS.zoomChange, function(zoom) {
|
|
4106
|
-
var
|
|
4107
|
-
if (((_theme_controls = theme.controls) == null ? void 0 :
|
|
4103
|
+
var _theme_controls_zoomControl, _theme_controls;
|
|
4104
|
+
if (((_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_zoomControl = _theme_controls.zoomControl) == null ? void 0 : _theme_controls_zoomControl.value) !== zoom) {
|
|
4108
4105
|
theme.controls.zoomControl.value = zoom;
|
|
4109
4106
|
}
|
|
4110
4107
|
});
|
|
@@ -4130,40 +4127,31 @@ function debounce(func, wait) {
|
|
|
4130
4127
|
// 全屏
|
|
4131
4128
|
// =======================================================
|
|
4132
4129
|
theme == null ? void 0 : theme.on(EVENTS.fullscreenChange, function(info) {
|
|
4133
|
-
if (
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
(_theme_zoomUtil1 = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform1 = _theme_zoomUtil1.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform1.call(_theme_zoomUtil1, false);
|
|
4144
|
-
}
|
|
4130
|
+
if ([
|
|
4131
|
+
0,
|
|
4132
|
+
180
|
|
4133
|
+
].includes(theme.orientationAngle) && info.isMobile && info.isCurrentFullscreen) {
|
|
4134
|
+
var // 代表移动端播放内容节点被旋转了 90度
|
|
4135
|
+
_theme_zoomUtil_setTransform, _theme_zoomUtil;
|
|
4136
|
+
(_theme_zoomUtil = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform = _theme_zoomUtil.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform.call(_theme_zoomUtil, true);
|
|
4137
|
+
} else {
|
|
4138
|
+
var _theme_zoomUtil_setTransform1, _theme_zoomUtil1;
|
|
4139
|
+
(_theme_zoomUtil1 = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform1 = _theme_zoomUtil1.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform1.call(_theme_zoomUtil1, false);
|
|
4145
4140
|
}
|
|
4146
4141
|
});
|
|
4147
4142
|
theme == null ? void 0 : theme.on(EVENTS.orientationChange, function(angle) {
|
|
4148
|
-
if (
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
(_theme_zoomUtil1 = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform1 = _theme_zoomUtil1.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform1.call(_theme_zoomUtil1, false);
|
|
4159
|
-
}
|
|
4143
|
+
if ([
|
|
4144
|
+
0,
|
|
4145
|
+
180
|
|
4146
|
+
].includes(angle) && Utils.isMobile && theme.isCurrentFullscreen) {
|
|
4147
|
+
var // 代表移动端播放内容节点被旋转了 90度
|
|
4148
|
+
_theme_zoomUtil_setTransform, _theme_zoomUtil;
|
|
4149
|
+
(_theme_zoomUtil = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform = _theme_zoomUtil.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform.call(_theme_zoomUtil, true);
|
|
4150
|
+
} else {
|
|
4151
|
+
var _theme_zoomUtil_setTransform1, _theme_zoomUtil1;
|
|
4152
|
+
(_theme_zoomUtil1 = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform1 = _theme_zoomUtil1.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform1.call(_theme_zoomUtil1, false);
|
|
4160
4153
|
}
|
|
4161
4154
|
});
|
|
4162
|
-
// 日期选择器
|
|
4163
|
-
theme == null ? void 0 : theme.on(EVENTS.control.dateMonthChange, function(dates) {
|
|
4164
|
-
var _theme_controls_dateControl_emit, _theme_controls_dateControl, _theme_controls;
|
|
4165
|
-
(_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_dateControl = _theme_controls.dateControl) == null ? void 0 : (_theme_controls_dateControl_emit = _theme_controls_dateControl.emit) == null ? void 0 : _theme_controls_dateControl_emit.call(_theme_controls_dateControl, EVENTS.control.dateMonthChange, dates);
|
|
4166
|
-
});
|
|
4167
4155
|
}
|
|
4168
4156
|
/**
|
|
4169
4157
|
* 控件向主题发现通信消息 control.on -> theme.emit ,仅用来转发控件的事件
|
|
@@ -4343,13 +4331,16 @@ function debounce(func, wait) {
|
|
|
4343
4331
|
// prettier-ignore
|
|
4344
4332
|
theme.controls.recControl.on(EVENTS.control.recTypeChange, function(type) {
|
|
4345
4333
|
if (theme.recType !== type) {
|
|
4346
|
-
var _theme__headerMoreControl;
|
|
4334
|
+
var _theme__headerMoreControl, _theme_controls;
|
|
4347
4335
|
theme.recType = type;
|
|
4348
4336
|
theme.emit(EVENTS.control.recTypeChange, type);
|
|
4349
4337
|
// theme.emit(EVENTS.recTypeChange, type);
|
|
4350
4338
|
if ((_theme__headerMoreControl = theme._headerMoreControl) == null ? void 0 : _theme__headerMoreControl.picker) {
|
|
4351
4339
|
theme._headerMoreControl.picker.open = false;
|
|
4352
4340
|
}
|
|
4341
|
+
if ((_theme_controls = theme.controls) == null ? void 0 : _theme_controls.speedControl) {
|
|
4342
|
+
theme.controls.speedControl.emit(EVENTS.control.recTypeChange, type);
|
|
4343
|
+
}
|
|
4353
4344
|
}
|
|
4354
4345
|
});
|
|
4355
4346
|
theme.controls.recControl.on(EVENTS.control.recDestroy, function() {
|
|
@@ -4362,10 +4353,10 @@ function debounce(func, wait) {
|
|
|
4362
4353
|
theme.emit(EVENTS.control.timeLineChange, date);
|
|
4363
4354
|
});
|
|
4364
4355
|
theme.controls.timeLineControl.on(EVENTS.control.timeLinePanelOpenChange, function(open) {
|
|
4365
|
-
var _theme_controls_dateControl
|
|
4366
|
-
if ((
|
|
4367
|
-
var
|
|
4368
|
-
(
|
|
4356
|
+
var _theme_controls_dateControl;
|
|
4357
|
+
if ((_theme_controls_dateControl = theme.controls.dateControl) == null ? void 0 : _theme_controls_dateControl.dataPickerUtil) {
|
|
4358
|
+
var _theme_controls_dateControl_dataPickerUtil, _theme_controls_dateControl1;
|
|
4359
|
+
(_theme_controls_dateControl1 = theme.controls.dateControl) == null ? void 0 : (_theme_controls_dateControl_dataPickerUtil = _theme_controls_dateControl1.dataPickerUtil) == null ? void 0 : _theme_controls_dateControl_dataPickerUtil.hide();
|
|
4369
4360
|
}
|
|
4370
4361
|
theme.emit(EVENTS.control.timeLinePanelOpenChange, open);
|
|
4371
4362
|
});
|
|
@@ -4658,12 +4649,12 @@ function getDefaultExportFromCjs (x) {
|
|
|
4658
4649
|
* Released under the MIT License.
|
|
4659
4650
|
*/
|
|
4660
4651
|
|
|
4661
|
-
var dist$
|
|
4662
|
-
var hasRequiredDist$
|
|
4652
|
+
var dist$2;
|
|
4653
|
+
var hasRequiredDist$2;
|
|
4663
4654
|
|
|
4664
|
-
function requireDist$
|
|
4665
|
-
if (hasRequiredDist$
|
|
4666
|
-
hasRequiredDist$
|
|
4655
|
+
function requireDist$2 () {
|
|
4656
|
+
if (hasRequiredDist$2) return dist$2;
|
|
4657
|
+
hasRequiredDist$2 = 1;
|
|
4667
4658
|
|
|
4668
4659
|
/**
|
|
4669
4660
|
* Zoom position
|
|
@@ -5370,12 +5361,12 @@ function requireDist$1 () {
|
|
|
5370
5361
|
}();
|
|
5371
5362
|
Zoom.VERSION = '0.0.2';
|
|
5372
5363
|
|
|
5373
|
-
dist$
|
|
5374
|
-
return dist$
|
|
5364
|
+
dist$2 = Zoom;
|
|
5365
|
+
return dist$2;
|
|
5375
5366
|
}
|
|
5376
5367
|
|
|
5377
|
-
var distExports$
|
|
5378
|
-
var Zoom = /*@__PURE__*/getDefaultExportFromCjs(distExports$
|
|
5368
|
+
var distExports$2 = requireDist$2();
|
|
5369
|
+
var Zoom = /*@__PURE__*/getDefaultExportFromCjs(distExports$2);
|
|
5379
5370
|
|
|
5380
5371
|
function _extends$h() {
|
|
5381
5372
|
_extends$h = Object.assign || function(target) {
|
|
@@ -6450,7 +6441,7 @@ function _set_prototype_of$d(o, p) {
|
|
|
6450
6441
|
return CapturePicture;
|
|
6451
6442
|
}(Control);
|
|
6452
6443
|
|
|
6453
|
-
var dist = {};
|
|
6444
|
+
var dist$1 = {};
|
|
6454
6445
|
|
|
6455
6446
|
/*
|
|
6456
6447
|
* @ezuikit/control-ptz v0.0.1
|
|
@@ -6458,11 +6449,11 @@ var dist = {};
|
|
|
6458
6449
|
* Released under the MIT License.
|
|
6459
6450
|
*/
|
|
6460
6451
|
|
|
6461
|
-
var hasRequiredDist;
|
|
6452
|
+
var hasRequiredDist$1;
|
|
6462
6453
|
|
|
6463
|
-
function requireDist () {
|
|
6464
|
-
if (hasRequiredDist) return dist;
|
|
6465
|
-
hasRequiredDist = 1;
|
|
6454
|
+
function requireDist$1 () {
|
|
6455
|
+
if (hasRequiredDist$1) return dist$1;
|
|
6456
|
+
hasRequiredDist$1 = 1;
|
|
6466
6457
|
|
|
6467
6458
|
var deepmerge$1 = deepmerge;
|
|
6468
6459
|
var utilsTools = require$$1;
|
|
@@ -7385,13 +7376,13 @@ function requireDist () {
|
|
|
7385
7376
|
return Ptz;
|
|
7386
7377
|
}(BasePtz);
|
|
7387
7378
|
|
|
7388
|
-
dist.BasePtz = BasePtz;
|
|
7389
|
-
dist.MobilePtz = MobilePtz;
|
|
7390
|
-
dist.Ptz = Ptz;
|
|
7391
|
-
return dist;
|
|
7379
|
+
dist$1.BasePtz = BasePtz;
|
|
7380
|
+
dist$1.MobilePtz = MobilePtz;
|
|
7381
|
+
dist$1.Ptz = Ptz;
|
|
7382
|
+
return dist$1;
|
|
7392
7383
|
}
|
|
7393
7384
|
|
|
7394
|
-
var distExports = requireDist();
|
|
7385
|
+
var distExports$1 = requireDist$1();
|
|
7395
7386
|
|
|
7396
7387
|
function _defineProperties$4(target, props) {
|
|
7397
7388
|
for(var i = 0; i < props.length; i++){
|
|
@@ -7490,7 +7481,7 @@ function _set_prototype_of$c(o, p) {
|
|
|
7490
7481
|
this.$turntable.classList.add("" + PREFIX_CLASS + "-ptz-turntable");
|
|
7491
7482
|
this.$panel.appendChild(this.$turntable);
|
|
7492
7483
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7493
|
-
this._ptzControl = new distExports.Ptz(this.$turntable, _extends$b({}, this._options, {
|
|
7484
|
+
this._ptzControl = new distExports$1.Ptz(this.$turntable, _extends$b({}, this._options, {
|
|
7494
7485
|
onSpeedChange: this._onSpeedChange.bind(this),
|
|
7495
7486
|
onDirection: this._onDirection.bind(this)
|
|
7496
7487
|
}));
|
|
@@ -7499,7 +7490,7 @@ function _set_prototype_of$c(o, p) {
|
|
|
7499
7490
|
};
|
|
7500
7491
|
_proto.renderMobileExtend = function renderMobileExtend($container) {
|
|
7501
7492
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7502
|
-
if (!this._ptzControl1) this._ptzControl1 = new distExports.MobilePtz($container, _extends$b({}, this._options, {
|
|
7493
|
+
if (!this._ptzControl1) this._ptzControl1 = new distExports$1.MobilePtz($container, _extends$b({}, this._options, {
|
|
7503
7494
|
onSpeedChange: this._onSpeedChange.bind(this),
|
|
7504
7495
|
onDirection: this._onDirection.bind(this)
|
|
7505
7496
|
}));
|
|
@@ -8542,7 +8533,9 @@ var SUPPORT_SPEED = [
|
|
|
8542
8533
|
0.5,
|
|
8543
8534
|
1,
|
|
8544
8535
|
2,
|
|
8545
|
-
4
|
|
8536
|
+
4,
|
|
8537
|
+
8,
|
|
8538
|
+
16
|
|
8546
8539
|
]; // 8, 16
|
|
8547
8540
|
var SPEED_DEFAULT_OPTIONS = {
|
|
8548
8541
|
/**
|
|
@@ -8592,6 +8585,21 @@ var SPEED_DEFAULT_OPTIONS = {
|
|
|
8592
8585
|
_this.on(EVENTS.speedChange, function(speed) {
|
|
8593
8586
|
if (_this.value !== speed + '') _this.value = speed + '';
|
|
8594
8587
|
});
|
|
8588
|
+
_this.on(EVENTS.control.recTypeChange, function(type) {
|
|
8589
|
+
if (!(options == null ? void 0 : options.list)) {
|
|
8590
|
+
// 非用户自定义
|
|
8591
|
+
if (type === 'rec') {
|
|
8592
|
+
// 本地回放 不支持 8 16 32 倍速
|
|
8593
|
+
var list = _this.list.filter(function(item) {
|
|
8594
|
+
return (item == null ? void 0 : item.value) && +item.value < 8;
|
|
8595
|
+
});
|
|
8596
|
+
_this.updateOptions(list);
|
|
8597
|
+
} else {
|
|
8598
|
+
// 云端回放 支持 8 16 32 倍速
|
|
8599
|
+
_this.updateOptions(SPEED_DEFAULT_OPTIONS.list);
|
|
8600
|
+
}
|
|
8601
|
+
}
|
|
8602
|
+
});
|
|
8595
8603
|
return _this;
|
|
8596
8604
|
}
|
|
8597
8605
|
var _proto = Speed.prototype;
|
|
@@ -8602,6 +8610,541 @@ var SPEED_DEFAULT_OPTIONS = {
|
|
|
8602
8610
|
return Speed;
|
|
8603
8611
|
}(Select);
|
|
8604
8612
|
|
|
8613
|
+
/*
|
|
8614
|
+
* @ezuikit/control-date-picker v0.0.1-alpha.2
|
|
8615
|
+
* Copyright (c) 2025-11-12 Ezviz-OpenBiz
|
|
8616
|
+
* Released under the MIT License.
|
|
8617
|
+
*/
|
|
8618
|
+
|
|
8619
|
+
var dist;
|
|
8620
|
+
var hasRequiredDist;
|
|
8621
|
+
|
|
8622
|
+
function requireDist () {
|
|
8623
|
+
if (hasRequiredDist) return dist;
|
|
8624
|
+
hasRequiredDist = 1;
|
|
8625
|
+
|
|
8626
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
8627
|
+
try {
|
|
8628
|
+
var info = gen[key](arg);
|
|
8629
|
+
var value = info.value;
|
|
8630
|
+
} catch (error) {
|
|
8631
|
+
reject(error);
|
|
8632
|
+
return;
|
|
8633
|
+
}
|
|
8634
|
+
if (info.done) {
|
|
8635
|
+
resolve(value);
|
|
8636
|
+
} else {
|
|
8637
|
+
Promise.resolve(value).then(_next, _throw);
|
|
8638
|
+
}
|
|
8639
|
+
}
|
|
8640
|
+
function _async_to_generator(fn) {
|
|
8641
|
+
return function() {
|
|
8642
|
+
var self = this, args = arguments;
|
|
8643
|
+
return new Promise(function(resolve, reject) {
|
|
8644
|
+
var gen = fn.apply(self, args);
|
|
8645
|
+
function _next(value) {
|
|
8646
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
8647
|
+
}
|
|
8648
|
+
function _throw(err) {
|
|
8649
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
8650
|
+
}
|
|
8651
|
+
_next(undefined);
|
|
8652
|
+
});
|
|
8653
|
+
};
|
|
8654
|
+
}
|
|
8655
|
+
function _ts_generator(thisArg, body) {
|
|
8656
|
+
var f, y, t, _ = {
|
|
8657
|
+
label: 0,
|
|
8658
|
+
sent: function() {
|
|
8659
|
+
if (t[0] & 1) throw t[1];
|
|
8660
|
+
return t[1];
|
|
8661
|
+
},
|
|
8662
|
+
trys: [],
|
|
8663
|
+
ops: []
|
|
8664
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
8665
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
8666
|
+
return this;
|
|
8667
|
+
}), g;
|
|
8668
|
+
function verb(n) {
|
|
8669
|
+
return function(v) {
|
|
8670
|
+
return step([
|
|
8671
|
+
n,
|
|
8672
|
+
v
|
|
8673
|
+
]);
|
|
8674
|
+
};
|
|
8675
|
+
}
|
|
8676
|
+
function step(op) {
|
|
8677
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
8678
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
8679
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
8680
|
+
if (y = 0, t) op = [
|
|
8681
|
+
op[0] & 2,
|
|
8682
|
+
t.value
|
|
8683
|
+
];
|
|
8684
|
+
switch(op[0]){
|
|
8685
|
+
case 0:
|
|
8686
|
+
case 1:
|
|
8687
|
+
t = op;
|
|
8688
|
+
break;
|
|
8689
|
+
case 4:
|
|
8690
|
+
_.label++;
|
|
8691
|
+
return {
|
|
8692
|
+
value: op[1],
|
|
8693
|
+
done: false
|
|
8694
|
+
};
|
|
8695
|
+
case 5:
|
|
8696
|
+
_.label++;
|
|
8697
|
+
y = op[1];
|
|
8698
|
+
op = [
|
|
8699
|
+
0
|
|
8700
|
+
];
|
|
8701
|
+
continue;
|
|
8702
|
+
case 7:
|
|
8703
|
+
op = _.ops.pop();
|
|
8704
|
+
_.trys.pop();
|
|
8705
|
+
continue;
|
|
8706
|
+
default:
|
|
8707
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
8708
|
+
_ = 0;
|
|
8709
|
+
continue;
|
|
8710
|
+
}
|
|
8711
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
8712
|
+
_.label = op[1];
|
|
8713
|
+
break;
|
|
8714
|
+
}
|
|
8715
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
8716
|
+
_.label = t[1];
|
|
8717
|
+
t = op;
|
|
8718
|
+
break;
|
|
8719
|
+
}
|
|
8720
|
+
if (t && _.label < t[2]) {
|
|
8721
|
+
_.label = t[2];
|
|
8722
|
+
_.ops.push(op);
|
|
8723
|
+
break;
|
|
8724
|
+
}
|
|
8725
|
+
if (t[2]) _.ops.pop();
|
|
8726
|
+
_.trys.pop();
|
|
8727
|
+
continue;
|
|
8728
|
+
}
|
|
8729
|
+
op = body.call(thisArg, _);
|
|
8730
|
+
} catch (e) {
|
|
8731
|
+
op = [
|
|
8732
|
+
6,
|
|
8733
|
+
e
|
|
8734
|
+
];
|
|
8735
|
+
y = 0;
|
|
8736
|
+
} finally{
|
|
8737
|
+
f = t = 0;
|
|
8738
|
+
}
|
|
8739
|
+
if (op[0] & 5) throw op[1];
|
|
8740
|
+
return {
|
|
8741
|
+
value: op[0] ? op[1] : void 0,
|
|
8742
|
+
done: true
|
|
8743
|
+
};
|
|
8744
|
+
}
|
|
8745
|
+
}
|
|
8746
|
+
var AppendJS = /*#__PURE__*/ function() {
|
|
8747
|
+
function AppendJS() {}
|
|
8748
|
+
AppendJS.loadScript = function loadScript(src) {
|
|
8749
|
+
return _async_to_generator(function() {
|
|
8750
|
+
return _ts_generator(this, function(_state) {
|
|
8751
|
+
switch(_state.label){
|
|
8752
|
+
case 0:
|
|
8753
|
+
return [
|
|
8754
|
+
4,
|
|
8755
|
+
new Promise(function(resolve, reject) {
|
|
8756
|
+
if (AppendJS.LoadedScr.includes(src)) {
|
|
8757
|
+
return resolve(src);
|
|
8758
|
+
}
|
|
8759
|
+
if (AppendJS.LoadingScrQueue[src]) {
|
|
8760
|
+
return AppendJS.LoadingScrQueue[src].push(resolve);
|
|
8761
|
+
} else {
|
|
8762
|
+
AppendJS.LoadingScrQueue[src] = [
|
|
8763
|
+
resolve
|
|
8764
|
+
];
|
|
8765
|
+
}
|
|
8766
|
+
var link;
|
|
8767
|
+
if (src.includes('.js')) {
|
|
8768
|
+
link = document.createElement('script');
|
|
8769
|
+
link.src = src;
|
|
8770
|
+
link.async = true;
|
|
8771
|
+
} else if (src.includes('.css')) {
|
|
8772
|
+
link = document.createElement('link');
|
|
8773
|
+
link.rel = 'stylesheet';
|
|
8774
|
+
link.href = src;
|
|
8775
|
+
}
|
|
8776
|
+
link.onload = function() {
|
|
8777
|
+
AppendJS.LoadedScr.push(src);
|
|
8778
|
+
AppendJS.LoadingScrQueue[src].forEach(function(resolve) {
|
|
8779
|
+
return resolve(src);
|
|
8780
|
+
});
|
|
8781
|
+
AppendJS.LoadingScrQueue[src] = [];
|
|
8782
|
+
};
|
|
8783
|
+
link.onerror = function() {
|
|
8784
|
+
return reject(new Error('Failed to load ' + src));
|
|
8785
|
+
};
|
|
8786
|
+
document.head.appendChild(link);
|
|
8787
|
+
})
|
|
8788
|
+
];
|
|
8789
|
+
case 1:
|
|
8790
|
+
return [
|
|
8791
|
+
2,
|
|
8792
|
+
_state.sent()
|
|
8793
|
+
];
|
|
8794
|
+
}
|
|
8795
|
+
});
|
|
8796
|
+
})();
|
|
8797
|
+
};
|
|
8798
|
+
AppendJS.loadScriptsBatch = function loadScriptsBatch(srcArr) {
|
|
8799
|
+
return _async_to_generator(function() {
|
|
8800
|
+
return _ts_generator(this, function(_state) {
|
|
8801
|
+
switch(_state.label){
|
|
8802
|
+
case 0:
|
|
8803
|
+
return [
|
|
8804
|
+
4,
|
|
8805
|
+
Promise.all(srcArr.map(AppendJS.loadScript))
|
|
8806
|
+
];
|
|
8807
|
+
case 1:
|
|
8808
|
+
return [
|
|
8809
|
+
2,
|
|
8810
|
+
_state.sent()
|
|
8811
|
+
];
|
|
8812
|
+
}
|
|
8813
|
+
});
|
|
8814
|
+
})();
|
|
8815
|
+
};
|
|
8816
|
+
AppendJS.remove = function remove(src) {
|
|
8817
|
+
src.forEach(function(item) {
|
|
8818
|
+
var link = document.querySelector('script[src="' + item + '"]') || document.querySelector('link[href="' + item + '"]');
|
|
8819
|
+
if (link) {
|
|
8820
|
+
link.remove();
|
|
8821
|
+
}
|
|
8822
|
+
});
|
|
8823
|
+
};
|
|
8824
|
+
AppendJS.clear = function clear() {
|
|
8825
|
+
AppendJS.remove(AppendJS.LoadedScr);
|
|
8826
|
+
};
|
|
8827
|
+
return AppendJS;
|
|
8828
|
+
}();
|
|
8829
|
+
/** 已经加载完的js/css */ AppendJS.LoadedScr = [];
|
|
8830
|
+
/** 正在加载的js/css */ AppendJS.LoadingScrQueue = {};
|
|
8831
|
+
|
|
8832
|
+
function _defineProperties(target, props) {
|
|
8833
|
+
for(var i = 0; i < props.length; i++){
|
|
8834
|
+
var descriptor = props[i];
|
|
8835
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
8836
|
+
descriptor.configurable = true;
|
|
8837
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
8838
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
8839
|
+
}
|
|
8840
|
+
}
|
|
8841
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
8842
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
8843
|
+
return Constructor;
|
|
8844
|
+
}
|
|
8845
|
+
var DEFAULT_OPTIONS = {
|
|
8846
|
+
staticPath: '.',
|
|
8847
|
+
place: 'top-right',
|
|
8848
|
+
language: 'zh-CN',
|
|
8849
|
+
current: new Date(),
|
|
8850
|
+
maxDate: new Date()
|
|
8851
|
+
};
|
|
8852
|
+
/**
|
|
8853
|
+
* 日期选择器
|
|
8854
|
+
*/ var DatePicker = /*#__PURE__*/ function() {
|
|
8855
|
+
function DatePicker(container, options) {
|
|
8856
|
+
var _this = this;
|
|
8857
|
+
this._open = false;
|
|
8858
|
+
this._change = true;
|
|
8859
|
+
this.$container = container;
|
|
8860
|
+
this.options = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
8861
|
+
this.options.staticPath = (this.options.staticPath || '').replace(/\/$/, '');
|
|
8862
|
+
if (this.options.current) {
|
|
8863
|
+
this._date = this.options.current;
|
|
8864
|
+
}
|
|
8865
|
+
this._init();
|
|
8866
|
+
this.$container.addEventListener('click', function() {
|
|
8867
|
+
if (_this._open) _this.hide();
|
|
8868
|
+
else _this.show();
|
|
8869
|
+
});
|
|
8870
|
+
document.body.addEventListener('click', function(e) {
|
|
8871
|
+
if (!_this.$container.contains(e.target)) {
|
|
8872
|
+
_this.hide();
|
|
8873
|
+
}
|
|
8874
|
+
});
|
|
8875
|
+
}
|
|
8876
|
+
var _proto = DatePicker.prototype;
|
|
8877
|
+
_proto._init = function _init() {
|
|
8878
|
+
var _this = this;
|
|
8879
|
+
// 因为挂载在行内,需要父标签设置 position: relative;
|
|
8880
|
+
this.$container.style.cssText += ";position: relative;";
|
|
8881
|
+
this.$container.classList.add("datepicker-inline-" + this.options.place);
|
|
8882
|
+
AppendJS.loadScriptsBatch([
|
|
8883
|
+
"" + this.options.staticPath + "/rec/jquery.min.js",
|
|
8884
|
+
"" + this.options.staticPath + "/rec/datepicker.min.css"
|
|
8885
|
+
]).then(function() {
|
|
8886
|
+
AppendJS.loadScriptsBatch([
|
|
8887
|
+
"" + _this.options.staticPath + "/rec/datepicker.js"
|
|
8888
|
+
]).then(function() {
|
|
8889
|
+
AppendJS.loadScriptsBatch([
|
|
8890
|
+
"" + _this.options.staticPath + "/rec/datepicker.zh-CN.js",
|
|
8891
|
+
"" + _this.options.staticPath + "/rec/datepicker.en-US.js"
|
|
8892
|
+
]).then(function() {
|
|
8893
|
+
window.$(_this.$container).datepicker({
|
|
8894
|
+
date: _this.options.current,
|
|
8895
|
+
language: _this.options.language,
|
|
8896
|
+
endDate: _this.options.maxDate,
|
|
8897
|
+
inline: true
|
|
8898
|
+
});
|
|
8899
|
+
_this.hide();
|
|
8900
|
+
window.$(_this.$container).on('pick.datepicker', function(e) {
|
|
8901
|
+
var _this__date, _this__date1, _this__date2, _this__date3, _this__date4, _this__date5;
|
|
8902
|
+
if (e.view === 'year' && ((_this__date = _this._date) == null ? void 0 : _this__date.getFullYear()) !== e.date.getFullYear()) {
|
|
8903
|
+
_this.options.onYearChange == null ? void 0 : _this.options.onYearChange.call(_this.options, e.date);
|
|
8904
|
+
} else if (e.view === 'month' && (((_this__date1 = _this._date) == null ? void 0 : _this__date1.getMonth()) !== e.date.getMonth() || ((_this__date2 = _this._date) == null ? void 0 : _this__date2.getFullYear()) !== e.date.getFullYear())) {
|
|
8905
|
+
_this.options.onMonthChange == null ? void 0 : _this.options.onMonthChange.call(_this.options, e.date);
|
|
8906
|
+
} else if ([
|
|
8907
|
+
'day',
|
|
8908
|
+
'pick'
|
|
8909
|
+
].includes(e.view || e.type) && (((_this__date3 = _this._date) == null ? void 0 : _this__date3.getDate()) !== e.date.getDate() || ((_this__date4 = _this._date) == null ? void 0 : _this__date4.getMonth()) !== e.date.getMonth() || ((_this__date5 = _this._date) == null ? void 0 : _this__date5.getFullYear()) !== e.date.getFullYear())) {
|
|
8910
|
+
if (_this._change) {
|
|
8911
|
+
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, e.date);
|
|
8912
|
+
}
|
|
8913
|
+
_this._date = new Date(e.date.getTime());
|
|
8914
|
+
}
|
|
8915
|
+
if (e.view === 'day') _this.hide();
|
|
8916
|
+
_this._change = true;
|
|
8917
|
+
});
|
|
8918
|
+
});
|
|
8919
|
+
});
|
|
8920
|
+
});
|
|
8921
|
+
};
|
|
8922
|
+
/**
|
|
8923
|
+
* 设置日期, change = true 时触发 onChange 事件
|
|
8924
|
+
*
|
|
8925
|
+
* @param date 设置的日期
|
|
8926
|
+
* @param change 是否触发 onChange 事件
|
|
8927
|
+
*/ _proto.setDate = function setDate(date, change) {
|
|
8928
|
+
if (change === void 0) change = true;
|
|
8929
|
+
var $datepicker = this.$container.querySelector(".datepicker-inline");
|
|
8930
|
+
if ($datepicker) {
|
|
8931
|
+
this._change = change;
|
|
8932
|
+
window.$(this.$container).datepicker('setDate', date);
|
|
8933
|
+
}
|
|
8934
|
+
};
|
|
8935
|
+
/**
|
|
8936
|
+
* 隐藏面板, 会触发 onPanelChange 事件
|
|
8937
|
+
*/ _proto.hide = function hide() {
|
|
8938
|
+
var $datepicker = this.$container.querySelector(".datepicker-inline");
|
|
8939
|
+
if ($datepicker) {
|
|
8940
|
+
if (this._open) {
|
|
8941
|
+
this._open = false;
|
|
8942
|
+
this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, false, this._date);
|
|
8943
|
+
}
|
|
8944
|
+
$datepicker.classList.add('datepicker-hide');
|
|
8945
|
+
}
|
|
8946
|
+
};
|
|
8947
|
+
/**
|
|
8948
|
+
* 显示面板, 会触发 onPanelChange 事件
|
|
8949
|
+
*/ _proto.show = function show() {
|
|
8950
|
+
var $datepicker = this.$container.querySelector(".datepicker-inline");
|
|
8951
|
+
if ($datepicker) {
|
|
8952
|
+
var _window_$_datepicker, _window_$;
|
|
8953
|
+
if (!this._open) {
|
|
8954
|
+
this._open = true;
|
|
8955
|
+
this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, true, this._date);
|
|
8956
|
+
}
|
|
8957
|
+
if (this._date) this.setDate(this._date, false);
|
|
8958
|
+
(_window_$_datepicker = (_window_$ = window.$(this.$container)).datepicker) == null ? void 0 : _window_$_datepicker.call(_window_$, 'showView');
|
|
8959
|
+
if (this.options.place === 'bottom-left') {
|
|
8960
|
+
$datepicker.style.cssText += "top: " + (this.$container.clientHeight + 10) + "px; bottom: auto; right: auto; left: 0px";
|
|
8961
|
+
} else {
|
|
8962
|
+
$datepicker.style.cssText += "bottom: " + (this.$container.clientHeight + 10) + "px; top: auto";
|
|
8963
|
+
}
|
|
8964
|
+
$datepicker.classList.remove('datepicker-hide');
|
|
8965
|
+
}
|
|
8966
|
+
};
|
|
8967
|
+
/**
|
|
8968
|
+
* 销毁
|
|
8969
|
+
*/ _proto.destroy = function destroy() {
|
|
8970
|
+
this.hide();
|
|
8971
|
+
this._date = undefined;
|
|
8972
|
+
window.$(this.$container).datepicker('destroy');
|
|
8973
|
+
// AppendJS.remove([
|
|
8974
|
+
// `${this.options.staticPath}/rec/jquery.min.js`,
|
|
8975
|
+
// `${this.options.staticPath}/rec/datepicker.min.css`,
|
|
8976
|
+
// `${this.options.staticPath}/rec/datepicker.js`,
|
|
8977
|
+
// `${this.options.staticPath}/rec/datepicker.zh-CN.js`,
|
|
8978
|
+
// `${this.options.staticPath}/rec/datepicker.en-US.js`,
|
|
8979
|
+
// ]);
|
|
8980
|
+
};
|
|
8981
|
+
_create_class(DatePicker, [
|
|
8982
|
+
{
|
|
8983
|
+
key: "date",
|
|
8984
|
+
get: /**
|
|
8985
|
+
* 获取日期
|
|
8986
|
+
*/ function get() {
|
|
8987
|
+
return this._date;
|
|
8988
|
+
}
|
|
8989
|
+
}
|
|
8990
|
+
]);
|
|
8991
|
+
return DatePicker;
|
|
8992
|
+
}();
|
|
8993
|
+
|
|
8994
|
+
dist = DatePicker;
|
|
8995
|
+
return dist;
|
|
8996
|
+
}
|
|
8997
|
+
|
|
8998
|
+
var distExports = requireDist();
|
|
8999
|
+
var DatePickerUtil = /*@__PURE__*/getDefaultExportFromCjs(distExports);
|
|
9000
|
+
|
|
9001
|
+
/**
|
|
9002
|
+
* @description 时间操作
|
|
9003
|
+
*/ var DateTime = /*#__PURE__*/ function() {
|
|
9004
|
+
function DateTime() {}
|
|
9005
|
+
/**
|
|
9006
|
+
* @description 时间格式化
|
|
9007
|
+
* @param {Date | number | string} date
|
|
9008
|
+
* @param {string} formatType 格式 'YYYY-MM-DD hh:mm:ss' 或 'YYYYMMDDhhmmss' 或 'YYYY/MM/DD hh:mm:ss' 或 'hh:mm:ss' 或 'YYYYMMDDThhmmssZ'
|
|
9009
|
+
* @param {number} timeZone 时区偏移量 默认 0
|
|
9010
|
+
*/ DateTime.formate = function formate(date, formatType, timeZone) {
|
|
9011
|
+
if (timeZone === void 0) timeZone = 0;
|
|
9012
|
+
var dateTime = date;
|
|
9013
|
+
if (typeof date === 'string') {
|
|
9014
|
+
dateTime = DateTime.strToDate(date);
|
|
9015
|
+
} else if (typeof date === 'number') {
|
|
9016
|
+
dateTime = new Date(date);
|
|
9017
|
+
}
|
|
9018
|
+
dateTime = new Date(dateTime.getTime() - timeZone * 3600 * 1000);
|
|
9019
|
+
var year = dateTime.getFullYear();
|
|
9020
|
+
var month = String(dateTime.getMonth() + 1).padStart(2, '0');
|
|
9021
|
+
var day = String(dateTime.getDate()).padStart(2, '0');
|
|
9022
|
+
var hours = String(dateTime.getHours()).padStart(2, '0');
|
|
9023
|
+
var minutes = String(dateTime.getMinutes()).padStart(2, '0');
|
|
9024
|
+
var seconds = String(dateTime.getSeconds()).padStart(2, '0');
|
|
9025
|
+
switch(formatType){
|
|
9026
|
+
case 'YYYY-MM-DD hh:mm:ss':
|
|
9027
|
+
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
|
9028
|
+
case 'YYYYMMDDhhmmss':
|
|
9029
|
+
return "" + year + month + day + hours + minutes + seconds;
|
|
9030
|
+
case 'YYYY/MM/DD hh:mm:ss':
|
|
9031
|
+
return year + "/" + month + "/" + day + " " + hours + ":" + minutes + ":" + seconds;
|
|
9032
|
+
case 'YYYYMMDDThhmmssZ':
|
|
9033
|
+
return "" + year + month + day + "T" + hours + minutes + seconds + "Z";
|
|
9034
|
+
case 'YYYY/MM/DD':
|
|
9035
|
+
return year + "/" + month + "/" + day;
|
|
9036
|
+
case 'YYYYMMDD':
|
|
9037
|
+
return "" + year + month + day;
|
|
9038
|
+
case 'YYYY-MM-DD':
|
|
9039
|
+
return year + "-" + month + "-" + day;
|
|
9040
|
+
case 'YYYY':
|
|
9041
|
+
return "" + year;
|
|
9042
|
+
case 'MM':
|
|
9043
|
+
return "" + month;
|
|
9044
|
+
case 'DD':
|
|
9045
|
+
return "" + day;
|
|
9046
|
+
case 'hh:mm:ss':
|
|
9047
|
+
return hours + ":" + minutes + ":" + seconds;
|
|
9048
|
+
case 'hh':
|
|
9049
|
+
return "" + hours;
|
|
9050
|
+
case 'mm':
|
|
9051
|
+
return "" + minutes;
|
|
9052
|
+
case 'ss':
|
|
9053
|
+
return "" + seconds;
|
|
9054
|
+
default:
|
|
9055
|
+
throw new Error('Unsupported format type');
|
|
9056
|
+
}
|
|
9057
|
+
};
|
|
9058
|
+
/**
|
|
9059
|
+
* @description 对比两个时间的差值
|
|
9060
|
+
* @param {Date | string | number} date1
|
|
9061
|
+
* @param {Date | string | number} date2
|
|
9062
|
+
* @param {"year" | "month" | "day" | "hour" | "minute" | "second"} diffType
|
|
9063
|
+
*/ DateTime.diff = function diff(date1, date2, diffType) {
|
|
9064
|
+
/** @type {Date} */ var dateTime1 = date1;
|
|
9065
|
+
if (typeof date1 === 'string') {
|
|
9066
|
+
dateTime1 = DateTime.strToDate(date1);
|
|
9067
|
+
} else if (typeof date1 === 'number') {
|
|
9068
|
+
dateTime1 = new Date(date1);
|
|
9069
|
+
}
|
|
9070
|
+
/** @type {Date} */ var dateTime2 = date2;
|
|
9071
|
+
if (typeof date2 === 'string') {
|
|
9072
|
+
dateTime1 = DateTime.strToDate(date2);
|
|
9073
|
+
} else if (typeof date2 === 'number') {
|
|
9074
|
+
dateTime1 = new Date(date2);
|
|
9075
|
+
}
|
|
9076
|
+
var diffSecond = dateTime1.getTime() - dateTime2.getTime();
|
|
9077
|
+
// diff
|
|
9078
|
+
switch(diffType){
|
|
9079
|
+
case 'year':
|
|
9080
|
+
return dateTime1.getFullYear() - dateTime2.getFullYear();
|
|
9081
|
+
case 'month':
|
|
9082
|
+
// 计算总月份差
|
|
9083
|
+
// eslint-disable-next-line no-case-declarations
|
|
9084
|
+
var months = (dateTime1.getFullYear() - dateTime2.getFullYear()) * 12 + (dateTime1.getMonth() - dateTime2.getMonth());
|
|
9085
|
+
// 如果结束日的日期小于开始日的日期,则减去一个月
|
|
9086
|
+
if (dateTime1.getDate() < dateTime2.getDate()) {
|
|
9087
|
+
months--;
|
|
9088
|
+
}
|
|
9089
|
+
return months;
|
|
9090
|
+
case 'day':
|
|
9091
|
+
return diffSecond / 60 / 60 / 24;
|
|
9092
|
+
case 'hour':
|
|
9093
|
+
return diffSecond / 60 / 60;
|
|
9094
|
+
case 'minute':
|
|
9095
|
+
return diffSecond / 60;
|
|
9096
|
+
case 'second':
|
|
9097
|
+
return diffSecond;
|
|
9098
|
+
default:
|
|
9099
|
+
throw new Error('Unsupported diff type');
|
|
9100
|
+
}
|
|
9101
|
+
};
|
|
9102
|
+
DateTime.now = function now() {
|
|
9103
|
+
return Date.now();
|
|
9104
|
+
};
|
|
9105
|
+
/**
|
|
9106
|
+
*
|
|
9107
|
+
* @param {string} str 日期, 2025-04-10 10:10:10 或 2025/04/10 10:10:10 或 20250410101010 或 20250410T101010Z 或 秒 或 毫秒
|
|
9108
|
+
* @example
|
|
9109
|
+
* DateTime.strToDate("2025/04/10 10:10:10") // Date
|
|
9110
|
+
* DateTime.strToDate("2025-04-10 10:10:10") // Date
|
|
9111
|
+
* DateTime.strToDate("20250410101010") // Date
|
|
9112
|
+
* DateTime.strToDate("20250410T101010Z") // Date
|
|
9113
|
+
*/ DateTime.strToDate = function strToDate(str) {
|
|
9114
|
+
var time = (str + '').replace(/-/gi, '').replace(/:/gi, '').replace(/\//gi, '').replace(/ /gi, '').replace(/T|Z/gi, '');
|
|
9115
|
+
// 兼容
|
|
9116
|
+
if ((str + '').length === 10) {
|
|
9117
|
+
// 时间戳 秒
|
|
9118
|
+
return new Date(+str);
|
|
9119
|
+
} else if ((str + '').length === 13) {
|
|
9120
|
+
// 时间戳 毫秒
|
|
9121
|
+
return new Date(+str);
|
|
9122
|
+
}
|
|
9123
|
+
var year = time.slice(0, 4);
|
|
9124
|
+
var month = time.slice(4, 6);
|
|
9125
|
+
var day = time.slice(6, 8);
|
|
9126
|
+
var hour = time.slice(8, 10);
|
|
9127
|
+
var minute = time.slice(10, 12);
|
|
9128
|
+
var second = time.slice(12, 14);
|
|
9129
|
+
return new Date(year + '/' + month + '/' + day + ' ' + hour + ':' + minute + ':' + second);
|
|
9130
|
+
};
|
|
9131
|
+
/**
|
|
9132
|
+
* @description 补充十位
|
|
9133
|
+
* @param {number} num
|
|
9134
|
+
* @returns {string}
|
|
9135
|
+
* @example
|
|
9136
|
+
* DateTime.padStart(1) // "01"
|
|
9137
|
+
* DateTime.padStart(33) // "33"
|
|
9138
|
+
*/ DateTime.padStart = function padStart(num) {
|
|
9139
|
+
if (num < 10) {
|
|
9140
|
+
return '0' + num;
|
|
9141
|
+
} else {
|
|
9142
|
+
return num + '';
|
|
9143
|
+
}
|
|
9144
|
+
};
|
|
9145
|
+
return DateTime;
|
|
9146
|
+
}();
|
|
9147
|
+
|
|
8605
9148
|
function _extends$5() {
|
|
8606
9149
|
_extends$5 = Object.assign || function(target) {
|
|
8607
9150
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -8644,29 +9187,20 @@ function _set_prototype_of$6(o, p) {
|
|
|
8644
9187
|
function DatePickerControl(options) {
|
|
8645
9188
|
var _this;
|
|
8646
9189
|
var _this_options_props_urlInfo_searchParams, _this_options_props_urlInfo, _this_options_props;
|
|
8647
|
-
_this = Control.call(this, _extends$5({
|
|
8648
|
-
maxDate: new Date()
|
|
8649
|
-
}, options, {
|
|
9190
|
+
_this = Control.call(this, _extends$5({}, options, {
|
|
8650
9191
|
tagName: 'span',
|
|
8651
9192
|
controlType: 'button',
|
|
8652
9193
|
classNameSuffix: 'date'
|
|
8653
9194
|
})) || this;
|
|
8654
9195
|
_this.options = options;
|
|
8655
|
-
_this._value = DateTime.
|
|
9196
|
+
_this._value = DateTime.formate(((_this_options_props = _this.options.props) == null ? void 0 : (_this_options_props_urlInfo = _this_options_props.urlInfo) == null ? void 0 : (_this_options_props_urlInfo_searchParams = _this_options_props_urlInfo.searchParams) == null ? void 0 : _this_options_props_urlInfo_searchParams.begin) || new Date(), 'YYYY-MM-DD');
|
|
8656
9197
|
_this._render();
|
|
8657
|
-
// 日期上的点
|
|
8658
|
-
_this.on(EVENTS.control.dateMonthChange, function(dates) {
|
|
8659
|
-
var _this_datePicker_updateBadges, _this_datePicker;
|
|
8660
|
-
(_this_datePicker = _this.datePicker) == null ? void 0 : (_this_datePicker_updateBadges = _this_datePicker.updateBadges) == null ? void 0 : _this_datePicker_updateBadges.call(_this_datePicker, dates);
|
|
8661
|
-
});
|
|
8662
9198
|
return _this;
|
|
8663
9199
|
}
|
|
8664
9200
|
var _proto = DatePickerControl.prototype;
|
|
8665
9201
|
_proto._render = function _render() {
|
|
8666
9202
|
var _this = this;
|
|
8667
|
-
|
|
8668
|
-
var isMobile1 = isMobile();
|
|
8669
|
-
if (isMobile1) {
|
|
9203
|
+
if (isMobile()) {
|
|
8670
9204
|
var _this_locale;
|
|
8671
9205
|
this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS + '-mobile-date-filter" title="' + (((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_CALENDAR) || '') + '">\n <span class="' + PREFIX_CLASS + '-mobile-date-filter-value">' + this._getDateStr() + "</span>\n " + IconComponents.filter() + "\n <span>";
|
|
8672
9206
|
} else {
|
|
@@ -8675,45 +9209,25 @@ function _set_prototype_of$6(o, p) {
|
|
|
8675
9209
|
title: (_this_locale1 = this.locale) == null ? void 0 : _this_locale1.BTN_CALENDAR
|
|
8676
9210
|
});
|
|
8677
9211
|
}
|
|
8678
|
-
this.
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
return _this.$container;
|
|
8682
|
-
},
|
|
8683
|
-
mode: 'date',
|
|
8684
|
-
offset: [
|
|
8685
|
-
0,
|
|
8686
|
-
-10
|
|
8687
|
-
],
|
|
8688
|
-
badges: ((_this_options_props = this.options.props) == null ? void 0 : _this_options_props.recMonth) || [],
|
|
8689
|
-
language: this.options.language === 'zh' ? 'zh' : 'en',
|
|
9212
|
+
this.dataPickerUtil = new DatePickerUtil(this.$container, {
|
|
9213
|
+
staticPath: this.options.staticPath,
|
|
9214
|
+
language: this.options.language === 'zh' ? 'zh-CN' : 'en-US',
|
|
8690
9215
|
current: new Date(this._value + ' 00:00:00'),
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
onOk: function(date, _mode) {
|
|
8698
|
-
if (date && _this._value !== DateTime.format(date, 'YYYY-MM-DD') && isMobile1) {
|
|
8699
|
-
_this._value = DateTime.format(date, 'YYYY-MM-DD');
|
|
8700
|
-
_this.options.onOk == null ? void 0 : _this.options.onOk.call(_this.options, date);
|
|
9216
|
+
maxDate: this.options.maxDate || new Date(),
|
|
9217
|
+
place: isMobile() ? 'bottom-left' : 'top-right',
|
|
9218
|
+
onChange: function(date) {
|
|
9219
|
+
if (date && _this._value !== DateTime.formate(date, 'YYYY-MM-DD')) {
|
|
9220
|
+
_this._value = DateTime.formate(date, 'YYYY-MM-DD');
|
|
9221
|
+
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, date);
|
|
8701
9222
|
_this.emit(EVENTS.control.dateChange, date);
|
|
8702
9223
|
if (date && _this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
8703
9224
|
_this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value").innerHTML = _this._getDateStr();
|
|
8704
9225
|
}
|
|
8705
9226
|
}
|
|
8706
9227
|
},
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, date);
|
|
8711
|
-
_this.emit(EVENTS.control.dateChange, date);
|
|
8712
|
-
}
|
|
8713
|
-
},
|
|
8714
|
-
onOpenChange: function(open) {
|
|
8715
|
-
_this.options.onPanelChange == null ? void 0 : _this.options.onPanelChange.call(_this.options, open, _this.datePicker.current);
|
|
8716
|
-
_this.emit(EVENTS.control.datePanelOpenChange, open, _this.datePicker.current);
|
|
9228
|
+
onPanelChange: function(open, date) {
|
|
9229
|
+
_this.options.onPanelChange == null ? void 0 : _this.options.onPanelChange.call(_this.options, open, date);
|
|
9230
|
+
_this.emit(EVENTS.control.datePanelOpenChange, open, date);
|
|
8717
9231
|
}
|
|
8718
9232
|
});
|
|
8719
9233
|
};
|
|
@@ -8723,27 +9237,28 @@ function _set_prototype_of$6(o, p) {
|
|
|
8723
9237
|
* @param change 是否触发 onChange 事件
|
|
8724
9238
|
*/ _proto.setDate = function setDate(date, change) {
|
|
8725
9239
|
if (change === void 0) change = true;
|
|
8726
|
-
var
|
|
8727
|
-
(
|
|
8728
|
-
if (date && !change && this._value !== DateTime.
|
|
8729
|
-
this._value = DateTime.
|
|
9240
|
+
var _this_dataPickerUtil;
|
|
9241
|
+
(_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.setDate(date, change);
|
|
9242
|
+
if (date && !change && this._value !== DateTime.formate(date, 'YYYY-MM-DD')) {
|
|
9243
|
+
this._value = DateTime.formate(date, 'YYYY-MM-DD');
|
|
8730
9244
|
if (date && this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
8731
9245
|
this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value").innerHTML = this._getDateStr();
|
|
8732
9246
|
}
|
|
8733
9247
|
}
|
|
8734
9248
|
};
|
|
8735
9249
|
_proto.reset = function reset() {
|
|
8736
|
-
|
|
9250
|
+
var _this_dataPickerUtil;
|
|
9251
|
+
(_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.hide();
|
|
8737
9252
|
Control.prototype.reset.call(this);
|
|
8738
9253
|
};
|
|
8739
9254
|
/**
|
|
8740
9255
|
* 销毁控件
|
|
8741
9256
|
* @override
|
|
8742
9257
|
*/ _proto.destroy = function destroy() {
|
|
8743
|
-
if (this.
|
|
8744
|
-
this.
|
|
9258
|
+
if (this.dataPickerUtil) {
|
|
9259
|
+
this.dataPickerUtil.destroy();
|
|
8745
9260
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8746
|
-
this.
|
|
9261
|
+
this.dataPickerUtil = null;
|
|
8747
9262
|
}
|
|
8748
9263
|
Control.prototype.destroy.call(this);
|
|
8749
9264
|
};
|
|
@@ -8753,7 +9268,6 @@ function _set_prototype_of$6(o, p) {
|
|
|
8753
9268
|
};
|
|
8754
9269
|
/**
|
|
8755
9270
|
* 点击 Control 会触发
|
|
8756
|
-
* @overload super._onControlClick(e: Event)
|
|
8757
9271
|
*/ _proto._onControlClick = function _onControlClick(e) {
|
|
8758
9272
|
Control.prototype._onControlClick.call(this, e);
|
|
8759
9273
|
};
|
|
@@ -9826,7 +10340,8 @@ var _renderDatePicker = function(theme, container, props) {
|
|
|
9826
10340
|
return container;
|
|
9827
10341
|
},
|
|
9828
10342
|
language: theme.options.language,
|
|
9829
|
-
locales: theme.i18n.translations
|
|
10343
|
+
locales: theme.i18n.translations,
|
|
10344
|
+
staticPath: theme.options.staticPath
|
|
9830
10345
|
}, ((_theme_options = theme.options) == null ? void 0 : _theme_options["dateOptions"]) || {}, {
|
|
9831
10346
|
props: props
|
|
9832
10347
|
}));
|
|
@@ -10125,18 +10640,7 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10125
10640
|
*/ _this._footerMoreControl = null, /** 头部控件 @since 0.0.1 @private */ _this._header = null, /** 低部控件 @since 0.0.1 @private */ _this._footer = null, /** 回放底部时间轴 @since 0.0.1 @private */ _this._recFooter = null, /**
|
|
10126
10641
|
* 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
|
|
10127
10642
|
* @private
|
|
10128
|
-
*/ _this._mobileExtend = null, /** @since 0.0.1 @private */ _this._interactiveResult = null, /** @since 0.0.1 @private */ _this._themeData = null, _this._fullscreen = null, _this.zoomUtil = null, /** 清除屏幕旋转 */ _this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ _this._cleanUpResizeObserver = null, /** 容器的宽 */ _this._width = 0, /** 容器的高 */ _this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ _this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ _this._orientationAngle = 0, /** 是否播放中 @private */ _this._playing = false, /** 加载中 */ _this._loading = false, /** 音量 */ _this._volume = 0, /** 静音 */ _this._muted = false, /** 电子放大倍数 @private */ _this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ _this._zooming = false, /** 录制中 @private */ _this._recording = false, /** 对讲中 @private */ _this._talking = false, /** 倍速 @private */ _this._speed = 1, /** 自定清晰度 @private */ _this._videoLevelAuto = false, /** 清晰度列表 */ _this.videoLevelList = [], /** 回放片段列表 */ _this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ _this._resizeOverflowTimer = null,
|
|
10129
|
-
// * 记录回放的月份
|
|
10130
|
-
// *
|
|
10131
|
-
// * key: {序列号}_{通道号}_{rec | cloud | cloudRecord} 比如:BC7799091_1_rec BC7799091_1_cloud BC7799091_1_cloudRecord
|
|
10132
|
-
// *
|
|
10133
|
-
// * value: 月份列表 比如 ["2025-12-01", "2025-12-02"]
|
|
10134
|
-
// * @private
|
|
10135
|
-
// */
|
|
10136
|
-
// _recMonthObj: Record<string, string[]> = {};
|
|
10137
|
-
/**
|
|
10138
|
-
* 录像回放的月份列表 @private
|
|
10139
|
-
*/ _this.recMonth = [], /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null, _this.scaleMode = 0;
|
|
10643
|
+
*/ _this._mobileExtend = null, /** @since 0.0.1 @private */ _this._interactiveResult = null, /** @since 0.0.1 @private */ _this._themeData = null, _this._fullscreen = null, _this.zoomUtil = null, /** 清除屏幕旋转 */ _this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ _this._cleanUpResizeObserver = null, /** 容器的宽 */ _this._width = 0, /** 容器的高 */ _this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ _this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ _this._orientationAngle = 0, /** 是否播放中 @private */ _this._playing = false, /** 加载中 */ _this._loading = false, /** 音量 */ _this._volume = 0, /** 静音 */ _this._muted = false, /** 电子放大倍数 @private */ _this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ _this._zooming = false, /** 录制中 @private */ _this._recording = false, /** 对讲中 @private */ _this._talking = false, /** 倍速 @private */ _this._speed = 1, /** 自定清晰度 @private */ _this._videoLevelAuto = false, /** 清晰度列表 */ _this.videoLevelList = [], /** 回放片段列表 */ _this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ _this._resizeOverflowTimer = null, /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null, _this.scaleMode = 0;
|
|
10140
10644
|
_this._initOptions(options);
|
|
10141
10645
|
if (_this.options.type === 'ezopen') {
|
|
10142
10646
|
var _this_urlInfo_searchParams, _this_urlInfo;
|
|
@@ -10146,7 +10650,7 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10146
10650
|
}
|
|
10147
10651
|
if (_this.urlInfo.type === 'rec') {
|
|
10148
10652
|
var _this_urlInfo_searchParams1, _this_urlInfo1, _this_urlInfo_searchParams2, _this_urlInfo2;
|
|
10149
|
-
_this._seekDate = ((_this_urlInfo1 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams1 = _this_urlInfo1.searchParams) == null ? void 0 : _this_urlInfo_searchParams1.begin) ? DateTime.
|
|
10653
|
+
_this._seekDate = ((_this_urlInfo1 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams1 = _this_urlInfo1.searchParams) == null ? void 0 : _this_urlInfo_searchParams1.begin) ? DateTime.strToDate((_this_urlInfo2 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams2 = _this_urlInfo2.searchParams) == null ? void 0 : _this_urlInfo_searchParams2.begin) : DateTime.strToDate(DateTime.formate(new Date(), 'YYYY/MM/DD') + ' 00:00:00');
|
|
10150
10654
|
}
|
|
10151
10655
|
}
|
|
10152
10656
|
_this._getRecType(_this.options.url);
|
|
@@ -10393,7 +10897,6 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10393
10897
|
this._themeData = null;
|
|
10394
10898
|
if (this.i18n) this.i18n = null;
|
|
10395
10899
|
this.recType = '';
|
|
10396
|
-
this.recMonth = []; // 清空数据
|
|
10397
10900
|
this.emit(EVENTS.theme.destroyed);
|
|
10398
10901
|
this.removeAllListeners();
|
|
10399
10902
|
if (this.logger) this.logger = null;
|
|
@@ -11359,6 +11862,6 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
11359
11862
|
zh: zh,
|
|
11360
11863
|
en: en
|
|
11361
11864
|
};
|
|
11362
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.2-beta.
|
|
11865
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.2-beta.5';
|
|
11363
11866
|
|
|
11364
11867
|
export { Control, Fullscreen, Loading, Message, Play, Poster, Rec, Theme, Utils, Volume };
|