@ezuikit/player-theme 2.0.2-beta.5 → 2.0.2-beta.7
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 +162 -637
- package/dist/index.mjs +163 -638
- package/dist/index.umd.js +183 -621
- package/dist/style.css +3 -2
- package/dist/style.js +2 -2
- package/dist/types/index.d.ts +68 -43
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @ezuikit/player-theme v2.0.2-beta.
|
|
3
|
-
* Copyright (c) 2025-12-
|
|
2
|
+
* @ezuikit/player-theme v2.0.2-beta.7
|
|
3
|
+
* Copyright (c) 2025-12-10 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, parseEzopenUrl } from '@ezuikit/utils-tools';
|
|
10
|
+
import require$$1, { isMobile, DateTime, 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';
|
|
14
15
|
import { MobileTimeLine, TimeLine } from '@ezuikit/control-time-line';
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -41,7 +42,8 @@ var THEME_PROPS = [
|
|
|
41
42
|
'speed',
|
|
42
43
|
'urlInfo',
|
|
43
44
|
'videoLevelList',
|
|
44
|
-
'videoLevel'
|
|
45
|
+
'videoLevel',
|
|
46
|
+
'recMonth'
|
|
45
47
|
];
|
|
46
48
|
/**
|
|
47
49
|
* 当移动端 picker 控件打开时需要关闭动画(定时器)
|
|
@@ -187,8 +189,9 @@ var EVENTS = {
|
|
|
187
189
|
/** 全局全屏控件销毁 */ globalFullscreenDestroy: 'Control.globalFullscreenDestroy',
|
|
188
190
|
/** 日期面板展示隐藏变换 */ datePanelOpenChange: 'Control.datePanelOpenChange',
|
|
189
191
|
/** 日期改变 */ dateChange: 'Control.dateChange',
|
|
192
|
+
/** 日期改变 */ dateMonthChange: 'Control.dateMonthChange',
|
|
190
193
|
/** 日期销毁 */ dateDestroy: 'Control.datePanelDestroy',
|
|
191
|
-
/**
|
|
194
|
+
/** 时间轴拖动结束 */ timeLineChange: 'Control.timeLineChange',
|
|
192
195
|
/** 时间轴图片列表面板 */ timeLinePanelOpenChange: 'Control.timeLinePanelOpenChange',
|
|
193
196
|
/** 时间轴控件销毁 */ timeLineDestroy: 'Control.timeLineDestroy',
|
|
194
197
|
/** 主题控件挂载前 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ beforeMountControls: 'Control.beforeMountControls',
|
|
@@ -199,7 +202,7 @@ var EVENTS = {
|
|
|
199
202
|
/** 加载控件销毁 */ loadingDestroy: 'Control.loadingDestroy',
|
|
200
203
|
/** 消息控件销毁 */ messageDestroy: 'Control.messageDestroy',
|
|
201
204
|
/** 播放器内容区域销毁 */ contentDestroy: 'Control.contentDestroy',
|
|
202
|
-
contentRerender: 'Control.contentRerender'
|
|
205
|
+
/** 播放器内容区域重新渲染 */ contentRerender: 'Control.contentRerender'
|
|
203
206
|
},
|
|
204
207
|
/**
|
|
205
208
|
* 主题控件相关
|
|
@@ -4060,11 +4063,11 @@ function debounce(func, wait) {
|
|
|
4060
4063
|
// 对讲
|
|
4061
4064
|
// =======================================================
|
|
4062
4065
|
theme.on(EVENTS.talkingChange, function(talking) {
|
|
4063
|
-
var _theme_controls_talkControl,
|
|
4066
|
+
var _theme_controls, _theme_controls_talkControl, _theme_controls1;
|
|
4064
4067
|
theme._talking = talking;
|
|
4065
|
-
if (talking !== ((
|
|
4066
|
-
var _theme_controls_talkControl1,
|
|
4067
|
-
(
|
|
4068
|
+
if (((_theme_controls = theme.controls) == null ? void 0 : _theme_controls.talkControl) && talking !== ((_theme_controls1 = theme.controls) == null ? void 0 : (_theme_controls_talkControl = _theme_controls1.talkControl) == null ? void 0 : _theme_controls_talkControl.active)) {
|
|
4069
|
+
var _theme_controls_talkControl1, _theme_controls2;
|
|
4070
|
+
(_theme_controls2 = theme.controls) == null ? void 0 : (_theme_controls_talkControl1 = _theme_controls2.talkControl) == null ? void 0 : _theme_controls_talkControl1.emit(EVENTS.talkingChange, talking);
|
|
4068
4071
|
}
|
|
4069
4072
|
});
|
|
4070
4073
|
theme.on(EVENTS.talkVolumeChange, function(value) {
|
|
@@ -4075,9 +4078,9 @@ function debounce(func, wait) {
|
|
|
4075
4078
|
// 录制
|
|
4076
4079
|
// =======================================================
|
|
4077
4080
|
theme.on(EVENTS.recordingChange, function(recording) {
|
|
4078
|
-
var _theme_controls_recordControl,
|
|
4081
|
+
var _theme_controls, _theme_controls_recordControl, _theme_controls1;
|
|
4079
4082
|
theme._recording = recording;
|
|
4080
|
-
if (recording !== ((
|
|
4083
|
+
if (((_theme_controls = theme.controls) == null ? void 0 : _theme_controls.recordControl) && recording !== ((_theme_controls1 = theme.controls) == null ? void 0 : (_theme_controls_recordControl = _theme_controls1.recordControl) == null ? void 0 : _theme_controls_recordControl.active)) theme.controls.recordControl.active = recording;
|
|
4081
4084
|
});
|
|
4082
4085
|
// =======================================================
|
|
4083
4086
|
// 清晰度
|
|
@@ -4094,14 +4097,14 @@ function debounce(func, wait) {
|
|
|
4094
4097
|
// 放大
|
|
4095
4098
|
// =======================================================
|
|
4096
4099
|
theme.on(EVENTS.zoomingChange, function(zooming) {
|
|
4097
|
-
var _theme_controls_zoomControl1,
|
|
4098
|
-
if (((_theme_controls1 = theme.controls) == null ? void 0 : (_theme_controls_zoomControl1 =
|
|
4100
|
+
var _theme_controls1, _theme_controls_zoomControl1, _theme_controls2;
|
|
4101
|
+
if (((_theme_controls1 = theme.controls) == null ? void 0 : _theme_controls1.zoomControl) && ((_theme_controls2 = theme.controls) == null ? void 0 : (_theme_controls_zoomControl1 = _theme_controls2.zoomControl) == null ? void 0 : _theme_controls_zoomControl1.active) !== zooming) {
|
|
4099
4102
|
theme.controls.zoomControl.active = zooming;
|
|
4100
4103
|
}
|
|
4101
4104
|
});
|
|
4102
4105
|
theme.on(EVENTS.zoomChange, function(zoom) {
|
|
4103
|
-
var _theme_controls_zoomControl,
|
|
4104
|
-
if (((_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_zoomControl =
|
|
4106
|
+
var _theme_controls, _theme_controls_zoomControl, _theme_controls1;
|
|
4107
|
+
if (((_theme_controls = theme.controls) == null ? void 0 : _theme_controls.zoomControl) && ((_theme_controls1 = theme.controls) == null ? void 0 : (_theme_controls_zoomControl = _theme_controls1.zoomControl) == null ? void 0 : _theme_controls_zoomControl.value) !== zoom) {
|
|
4105
4108
|
theme.controls.zoomControl.value = zoom;
|
|
4106
4109
|
}
|
|
4107
4110
|
});
|
|
@@ -4127,31 +4130,40 @@ function debounce(func, wait) {
|
|
|
4127
4130
|
// 全屏
|
|
4128
4131
|
// =======================================================
|
|
4129
4132
|
theme == null ? void 0 : theme.on(EVENTS.fullscreenChange, function(info) {
|
|
4130
|
-
if (
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4133
|
+
if (theme.zoomUtil) {
|
|
4134
|
+
if ([
|
|
4135
|
+
0,
|
|
4136
|
+
180
|
|
4137
|
+
].includes(theme.orientationAngle) && info.isMobile && info.isCurrentFullscreen) {
|
|
4138
|
+
var // 代表移动端播放内容节点被旋转了 90度
|
|
4139
|
+
_theme_zoomUtil_setTransform, _theme_zoomUtil;
|
|
4140
|
+
(_theme_zoomUtil = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform = _theme_zoomUtil.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform.call(_theme_zoomUtil, true);
|
|
4141
|
+
} else {
|
|
4142
|
+
var _theme_zoomUtil_setTransform1, _theme_zoomUtil1;
|
|
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
|
+
}
|
|
4140
4145
|
}
|
|
4141
4146
|
});
|
|
4142
4147
|
theme == null ? void 0 : theme.on(EVENTS.orientationChange, function(angle) {
|
|
4143
|
-
if (
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4148
|
+
if (theme.zoomUtil) {
|
|
4149
|
+
if ([
|
|
4150
|
+
0,
|
|
4151
|
+
180
|
|
4152
|
+
].includes(angle) && Utils.isMobile && theme.isCurrentFullscreen) {
|
|
4153
|
+
var // 代表移动端播放内容节点被旋转了 90度
|
|
4154
|
+
_theme_zoomUtil_setTransform, _theme_zoomUtil;
|
|
4155
|
+
(_theme_zoomUtil = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform = _theme_zoomUtil.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform.call(_theme_zoomUtil, true);
|
|
4156
|
+
} else {
|
|
4157
|
+
var _theme_zoomUtil_setTransform1, _theme_zoomUtil1;
|
|
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
|
+
}
|
|
4153
4160
|
}
|
|
4154
4161
|
});
|
|
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
|
+
});
|
|
4155
4167
|
}
|
|
4156
4168
|
/**
|
|
4157
4169
|
* 控件向主题发现通信消息 control.on -> theme.emit ,仅用来转发控件的事件
|
|
@@ -4353,10 +4365,10 @@ function debounce(func, wait) {
|
|
|
4353
4365
|
theme.emit(EVENTS.control.timeLineChange, date);
|
|
4354
4366
|
});
|
|
4355
4367
|
theme.controls.timeLineControl.on(EVENTS.control.timeLinePanelOpenChange, function(open) {
|
|
4356
|
-
var _theme_controls_dateControl;
|
|
4357
|
-
if ((
|
|
4358
|
-
var
|
|
4359
|
-
(
|
|
4368
|
+
var _theme_controls_dateControl, _theme_controls;
|
|
4369
|
+
if ((_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_dateControl = _theme_controls.dateControl) == null ? void 0 : _theme_controls_dateControl.datePicker) {
|
|
4370
|
+
var _theme_controls_dateControl_datePicker, _theme_controls_dateControl1, _theme_controls1;
|
|
4371
|
+
(_theme_controls1 = theme.controls) == null ? void 0 : (_theme_controls_dateControl1 = _theme_controls1.dateControl) == null ? void 0 : (_theme_controls_dateControl_datePicker = _theme_controls_dateControl1.datePicker) == null ? void 0 : _theme_controls_dateControl_datePicker.hide();
|
|
4360
4372
|
}
|
|
4361
4373
|
theme.emit(EVENTS.control.timeLinePanelOpenChange, open);
|
|
4362
4374
|
});
|
|
@@ -4649,12 +4661,12 @@ function getDefaultExportFromCjs (x) {
|
|
|
4649
4661
|
* Released under the MIT License.
|
|
4650
4662
|
*/
|
|
4651
4663
|
|
|
4652
|
-
var dist$
|
|
4653
|
-
var hasRequiredDist$
|
|
4664
|
+
var dist$1;
|
|
4665
|
+
var hasRequiredDist$1;
|
|
4654
4666
|
|
|
4655
|
-
function requireDist$
|
|
4656
|
-
if (hasRequiredDist$
|
|
4657
|
-
hasRequiredDist$
|
|
4667
|
+
function requireDist$1 () {
|
|
4668
|
+
if (hasRequiredDist$1) return dist$1;
|
|
4669
|
+
hasRequiredDist$1 = 1;
|
|
4658
4670
|
|
|
4659
4671
|
/**
|
|
4660
4672
|
* Zoom position
|
|
@@ -5361,12 +5373,12 @@ function requireDist$2 () {
|
|
|
5361
5373
|
}();
|
|
5362
5374
|
Zoom.VERSION = '0.0.2';
|
|
5363
5375
|
|
|
5364
|
-
dist$
|
|
5365
|
-
return dist$
|
|
5376
|
+
dist$1 = Zoom;
|
|
5377
|
+
return dist$1;
|
|
5366
5378
|
}
|
|
5367
5379
|
|
|
5368
|
-
var distExports$
|
|
5369
|
-
var Zoom = /*@__PURE__*/getDefaultExportFromCjs(distExports$
|
|
5380
|
+
var distExports$1 = requireDist$1();
|
|
5381
|
+
var Zoom = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
|
|
5370
5382
|
|
|
5371
5383
|
function _extends$h() {
|
|
5372
5384
|
_extends$h = Object.assign || function(target) {
|
|
@@ -6441,7 +6453,7 @@ function _set_prototype_of$d(o, p) {
|
|
|
6441
6453
|
return CapturePicture;
|
|
6442
6454
|
}(Control);
|
|
6443
6455
|
|
|
6444
|
-
var dist
|
|
6456
|
+
var dist = {};
|
|
6445
6457
|
|
|
6446
6458
|
/*
|
|
6447
6459
|
* @ezuikit/control-ptz v0.0.1
|
|
@@ -6449,11 +6461,11 @@ var dist$1 = {};
|
|
|
6449
6461
|
* Released under the MIT License.
|
|
6450
6462
|
*/
|
|
6451
6463
|
|
|
6452
|
-
var hasRequiredDist
|
|
6464
|
+
var hasRequiredDist;
|
|
6453
6465
|
|
|
6454
|
-
function requireDist
|
|
6455
|
-
if (hasRequiredDist
|
|
6456
|
-
hasRequiredDist
|
|
6466
|
+
function requireDist () {
|
|
6467
|
+
if (hasRequiredDist) return dist;
|
|
6468
|
+
hasRequiredDist = 1;
|
|
6457
6469
|
|
|
6458
6470
|
var deepmerge$1 = deepmerge;
|
|
6459
6471
|
var utilsTools = require$$1;
|
|
@@ -7376,13 +7388,13 @@ function requireDist$1 () {
|
|
|
7376
7388
|
return Ptz;
|
|
7377
7389
|
}(BasePtz);
|
|
7378
7390
|
|
|
7379
|
-
dist
|
|
7380
|
-
dist
|
|
7381
|
-
dist
|
|
7382
|
-
return dist
|
|
7391
|
+
dist.BasePtz = BasePtz;
|
|
7392
|
+
dist.MobilePtz = MobilePtz;
|
|
7393
|
+
dist.Ptz = Ptz;
|
|
7394
|
+
return dist;
|
|
7383
7395
|
}
|
|
7384
7396
|
|
|
7385
|
-
var distExports
|
|
7397
|
+
var distExports = requireDist();
|
|
7386
7398
|
|
|
7387
7399
|
function _defineProperties$4(target, props) {
|
|
7388
7400
|
for(var i = 0; i < props.length; i++){
|
|
@@ -7481,7 +7493,7 @@ function _set_prototype_of$c(o, p) {
|
|
|
7481
7493
|
this.$turntable.classList.add("" + PREFIX_CLASS + "-ptz-turntable");
|
|
7482
7494
|
this.$panel.appendChild(this.$turntable);
|
|
7483
7495
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7484
|
-
this._ptzControl = new distExports
|
|
7496
|
+
this._ptzControl = new distExports.Ptz(this.$turntable, _extends$b({}, this._options, {
|
|
7485
7497
|
onSpeedChange: this._onSpeedChange.bind(this),
|
|
7486
7498
|
onDirection: this._onDirection.bind(this)
|
|
7487
7499
|
}));
|
|
@@ -7490,7 +7502,7 @@ function _set_prototype_of$c(o, p) {
|
|
|
7490
7502
|
};
|
|
7491
7503
|
_proto.renderMobileExtend = function renderMobileExtend($container) {
|
|
7492
7504
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7493
|
-
if (!this._ptzControl1) this._ptzControl1 = new distExports
|
|
7505
|
+
if (!this._ptzControl1) this._ptzControl1 = new distExports.MobilePtz($container, _extends$b({}, this._options, {
|
|
7494
7506
|
onSpeedChange: this._onSpeedChange.bind(this),
|
|
7495
7507
|
onDirection: this._onDirection.bind(this)
|
|
7496
7508
|
}));
|
|
@@ -8582,27 +8594,35 @@ var SPEED_DEFAULT_OPTIONS = {
|
|
|
8582
8594
|
_assert_this_initialized(_this).emit(EVENTS.control.speedPanelOpenChange, open, value, item);
|
|
8583
8595
|
}
|
|
8584
8596
|
})) || this;
|
|
8597
|
+
_this._filterSpeedList(options.list, options.props.recType);
|
|
8585
8598
|
_this.on(EVENTS.speedChange, function(speed) {
|
|
8586
8599
|
if (_this.value !== speed + '') _this.value = speed + '';
|
|
8587
8600
|
});
|
|
8588
8601
|
_this.on(EVENTS.control.recTypeChange, function(type) {
|
|
8589
|
-
|
|
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
|
+
_this._filterSpeedList(options.list, type);
|
|
8602
8603
|
});
|
|
8603
8604
|
return _this;
|
|
8604
8605
|
}
|
|
8605
8606
|
var _proto = Speed.prototype;
|
|
8607
|
+
/**
|
|
8608
|
+
* 滤掉本地回放不支持的倍速
|
|
8609
|
+
* @param optionsList 初始化配置倍速列表
|
|
8610
|
+
* @param type 回放类型
|
|
8611
|
+
*/ _proto._filterSpeedList = function _filterSpeedList(optionsList, type) {
|
|
8612
|
+
if (!optionsList) {
|
|
8613
|
+
// 非用户自定义
|
|
8614
|
+
if (type === 'rec') {
|
|
8615
|
+
// 本地回放 不支持 8 16 32 倍速
|
|
8616
|
+
var list = this.list.filter(function(item) {
|
|
8617
|
+
return (item == null ? void 0 : item.value) && +item.value < 8;
|
|
8618
|
+
});
|
|
8619
|
+
this.updateOptions(list);
|
|
8620
|
+
} else {
|
|
8621
|
+
// 云端回放 支持 8 16 32 倍速
|
|
8622
|
+
this.updateOptions(SPEED_DEFAULT_OPTIONS.list);
|
|
8623
|
+
}
|
|
8624
|
+
}
|
|
8625
|
+
};
|
|
8606
8626
|
_proto.reset = function reset(hide) {
|
|
8607
8627
|
this.value = 1 + '';
|
|
8608
8628
|
Select.prototype.reset.call(this, hide);
|
|
@@ -8610,541 +8630,6 @@ var SPEED_DEFAULT_OPTIONS = {
|
|
|
8610
8630
|
return Speed;
|
|
8611
8631
|
}(Select);
|
|
8612
8632
|
|
|
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
|
-
|
|
9148
8633
|
function _extends$5() {
|
|
9149
8634
|
_extends$5 = Object.assign || function(target) {
|
|
9150
8635
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -9187,20 +8672,29 @@ function _set_prototype_of$6(o, p) {
|
|
|
9187
8672
|
function DatePickerControl(options) {
|
|
9188
8673
|
var _this;
|
|
9189
8674
|
var _this_options_props_urlInfo_searchParams, _this_options_props_urlInfo, _this_options_props;
|
|
9190
|
-
_this = Control.call(this, _extends$5({
|
|
8675
|
+
_this = Control.call(this, _extends$5({
|
|
8676
|
+
maxDate: new Date()
|
|
8677
|
+
}, options, {
|
|
9191
8678
|
tagName: 'span',
|
|
9192
8679
|
controlType: 'button',
|
|
9193
8680
|
classNameSuffix: 'date'
|
|
9194
8681
|
})) || this;
|
|
9195
8682
|
_this.options = options;
|
|
9196
|
-
_this._value = DateTime.
|
|
8683
|
+
_this._value = DateTime.format(((_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');
|
|
9197
8684
|
_this._render();
|
|
8685
|
+
// 日期上的点
|
|
8686
|
+
_this.on(EVENTS.control.dateMonthChange, function(dates) {
|
|
8687
|
+
var _this_datePicker_updateBadges, _this_datePicker;
|
|
8688
|
+
(_this_datePicker = _this.datePicker) == null ? void 0 : (_this_datePicker_updateBadges = _this_datePicker.updateBadges) == null ? void 0 : _this_datePicker_updateBadges.call(_this_datePicker, dates);
|
|
8689
|
+
});
|
|
9198
8690
|
return _this;
|
|
9199
8691
|
}
|
|
9200
8692
|
var _proto = DatePickerControl.prototype;
|
|
9201
8693
|
_proto._render = function _render() {
|
|
9202
8694
|
var _this = this;
|
|
9203
|
-
|
|
8695
|
+
var _this_options_props;
|
|
8696
|
+
var isMobile1 = isMobile();
|
|
8697
|
+
if (isMobile1) {
|
|
9204
8698
|
var _this_locale;
|
|
9205
8699
|
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>";
|
|
9206
8700
|
} else {
|
|
@@ -9209,25 +8703,45 @@ function _set_prototype_of$6(o, p) {
|
|
|
9209
8703
|
title: (_this_locale1 = this.locale) == null ? void 0 : _this_locale1.BTN_CALENDAR
|
|
9210
8704
|
});
|
|
9211
8705
|
}
|
|
9212
|
-
this.
|
|
9213
|
-
|
|
9214
|
-
|
|
8706
|
+
this.datePicker = new DatePicker(this.$container, {
|
|
8707
|
+
isMobile: isMobile1,
|
|
8708
|
+
getPopupContainer: function() {
|
|
8709
|
+
return _this.$container;
|
|
8710
|
+
},
|
|
8711
|
+
mode: 'date',
|
|
8712
|
+
offset: [
|
|
8713
|
+
0,
|
|
8714
|
+
-10
|
|
8715
|
+
],
|
|
8716
|
+
badges: ((_this_options_props = this.options.props) == null ? void 0 : _this_options_props.recMonth) || [],
|
|
8717
|
+
language: this.options.language === 'zh' ? 'zh' : 'en',
|
|
9215
8718
|
current: new Date(this._value + ' 00:00:00'),
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
8719
|
+
placement: 'tr',
|
|
8720
|
+
triggerClose: true,
|
|
8721
|
+
disabledDate: function(date) {
|
|
8722
|
+
return date.getTime() > (_this.options.maxDate || new Date()).getTime();
|
|
8723
|
+
},
|
|
8724
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8725
|
+
onOk: function(date, _mode) {
|
|
8726
|
+
if (date && _this._value !== DateTime.format(date, 'YYYY-MM-DD') && isMobile1) {
|
|
8727
|
+
_this._value = DateTime.format(date, 'YYYY-MM-DD');
|
|
8728
|
+
_this.options.onOk == null ? void 0 : _this.options.onOk.call(_this.options, date);
|
|
9222
8729
|
_this.emit(EVENTS.control.dateChange, date);
|
|
9223
8730
|
if (date && _this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
9224
8731
|
_this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value").innerHTML = _this._getDateStr();
|
|
9225
8732
|
}
|
|
9226
8733
|
}
|
|
9227
8734
|
},
|
|
9228
|
-
|
|
9229
|
-
_this.
|
|
9230
|
-
|
|
8735
|
+
onChange: function(date, mode) {
|
|
8736
|
+
if (date && _this._value !== DateTime.format(date, 'YYYY-MM-DD') && !isMobile1 && mode === 'date') {
|
|
8737
|
+
_this._value = DateTime.format(date, 'YYYY-MM-DD');
|
|
8738
|
+
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, date);
|
|
8739
|
+
_this.emit(EVENTS.control.dateChange, date);
|
|
8740
|
+
}
|
|
8741
|
+
},
|
|
8742
|
+
onOpenChange: function(open) {
|
|
8743
|
+
_this.options.onPanelChange == null ? void 0 : _this.options.onPanelChange.call(_this.options, open, _this.datePicker.current);
|
|
8744
|
+
_this.emit(EVENTS.control.datePanelOpenChange, open, _this.datePicker.current);
|
|
9231
8745
|
}
|
|
9232
8746
|
});
|
|
9233
8747
|
};
|
|
@@ -9237,28 +8751,27 @@ function _set_prototype_of$6(o, p) {
|
|
|
9237
8751
|
* @param change 是否触发 onChange 事件
|
|
9238
8752
|
*/ _proto.setDate = function setDate(date, change) {
|
|
9239
8753
|
if (change === void 0) change = true;
|
|
9240
|
-
var
|
|
9241
|
-
(
|
|
9242
|
-
if (date && !change && this._value !== DateTime.
|
|
9243
|
-
this._value = DateTime.
|
|
8754
|
+
var _this_datePicker;
|
|
8755
|
+
(_this_datePicker = this.datePicker) == null ? void 0 : _this_datePicker.setCurrent(date, change);
|
|
8756
|
+
if (date && !change && this._value !== DateTime.format(date, 'YYYY-MM-DD')) {
|
|
8757
|
+
this._value = DateTime.format(date, 'YYYY-MM-DD');
|
|
9244
8758
|
if (date && this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
9245
8759
|
this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value").innerHTML = this._getDateStr();
|
|
9246
8760
|
}
|
|
9247
8761
|
}
|
|
9248
8762
|
};
|
|
9249
8763
|
_proto.reset = function reset() {
|
|
9250
|
-
|
|
9251
|
-
(_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.hide();
|
|
8764
|
+
if (this.datePicker) this.datePicker.open = false;
|
|
9252
8765
|
Control.prototype.reset.call(this);
|
|
9253
8766
|
};
|
|
9254
8767
|
/**
|
|
9255
8768
|
* 销毁控件
|
|
9256
8769
|
* @override
|
|
9257
8770
|
*/ _proto.destroy = function destroy() {
|
|
9258
|
-
if (this.
|
|
9259
|
-
this.
|
|
8771
|
+
if (this.datePicker) {
|
|
8772
|
+
this.datePicker.destroy();
|
|
9260
8773
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9261
|
-
this.
|
|
8774
|
+
this.datePicker = null;
|
|
9262
8775
|
}
|
|
9263
8776
|
Control.prototype.destroy.call(this);
|
|
9264
8777
|
};
|
|
@@ -9268,6 +8781,7 @@ function _set_prototype_of$6(o, p) {
|
|
|
9268
8781
|
};
|
|
9269
8782
|
/**
|
|
9270
8783
|
* 点击 Control 会触发
|
|
8784
|
+
* @overload super._onControlClick(e: Event)
|
|
9271
8785
|
*/ _proto._onControlClick = function _onControlClick(e) {
|
|
9272
8786
|
Control.prototype._onControlClick.call(this, e);
|
|
9273
8787
|
};
|
|
@@ -10340,8 +9854,7 @@ var _renderDatePicker = function(theme, container, props) {
|
|
|
10340
9854
|
return container;
|
|
10341
9855
|
},
|
|
10342
9856
|
language: theme.options.language,
|
|
10343
|
-
locales: theme.i18n.translations
|
|
10344
|
-
staticPath: theme.options.staticPath
|
|
9857
|
+
locales: theme.i18n.translations
|
|
10345
9858
|
}, ((_theme_options = theme.options) == null ? void 0 : _theme_options["dateOptions"]) || {}, {
|
|
10346
9859
|
props: props
|
|
10347
9860
|
}));
|
|
@@ -10640,7 +10153,18 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10640
10153
|
*/ _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, /**
|
|
10641
10154
|
* 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
|
|
10642
10155
|
* @private
|
|
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,
|
|
10156
|
+
*/ _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, // /**
|
|
10157
|
+
// * 记录回放的月份
|
|
10158
|
+
// *
|
|
10159
|
+
// * key: {序列号}_{通道号}_{rec | cloud | cloudRecord} 比如:BC7799091_1_rec BC7799091_1_cloud BC7799091_1_cloudRecord
|
|
10160
|
+
// *
|
|
10161
|
+
// * value: 月份列表 比如 ["2025-12-01", "2025-12-02"]
|
|
10162
|
+
// * @private
|
|
10163
|
+
// */
|
|
10164
|
+
// _recMonthObj: Record<string, string[]> = {};
|
|
10165
|
+
/**
|
|
10166
|
+
* 录像回放的月份列表 @private
|
|
10167
|
+
*/ _this.recMonth = [], /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null, _this.scaleMode = 0;
|
|
10644
10168
|
_this._initOptions(options);
|
|
10645
10169
|
if (_this.options.type === 'ezopen') {
|
|
10646
10170
|
var _this_urlInfo_searchParams, _this_urlInfo;
|
|
@@ -10650,7 +10174,7 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10650
10174
|
}
|
|
10651
10175
|
if (_this.urlInfo.type === 'rec') {
|
|
10652
10176
|
var _this_urlInfo_searchParams1, _this_urlInfo1, _this_urlInfo_searchParams2, _this_urlInfo2;
|
|
10653
|
-
_this._seekDate = ((_this_urlInfo1 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams1 = _this_urlInfo1.searchParams) == null ? void 0 : _this_urlInfo_searchParams1.begin) ? DateTime.
|
|
10177
|
+
_this._seekDate = ((_this_urlInfo1 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams1 = _this_urlInfo1.searchParams) == null ? void 0 : _this_urlInfo_searchParams1.begin) ? DateTime.toDate((_this_urlInfo2 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams2 = _this_urlInfo2.searchParams) == null ? void 0 : _this_urlInfo_searchParams2.begin) : DateTime.toDate(DateTime.format(new Date(), 'YYYY/MM/DD') + ' 00:00:00');
|
|
10654
10178
|
}
|
|
10655
10179
|
}
|
|
10656
10180
|
_this._getRecType(_this.options.url);
|
|
@@ -10897,6 +10421,7 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10897
10421
|
this._themeData = null;
|
|
10898
10422
|
if (this.i18n) this.i18n = null;
|
|
10899
10423
|
this.recType = '';
|
|
10424
|
+
this.recMonth = []; // 清空数据
|
|
10900
10425
|
this.emit(EVENTS.theme.destroyed);
|
|
10901
10426
|
this.removeAllListeners();
|
|
10902
10427
|
if (this.logger) this.logger = null;
|
|
@@ -11862,6 +11387,6 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
11862
11387
|
zh: zh,
|
|
11863
11388
|
en: en
|
|
11864
11389
|
};
|
|
11865
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.2-beta.
|
|
11390
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.2-beta.7';
|
|
11866
11391
|
|
|
11867
11392
|
export { Control, Fullscreen, Loading, Message, Play, Poster, Rec, Theme, Utils, Volume };
|