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