@ezuikit/player-theme 2.0.2-beta.6 → 2.0.2-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -40
- package/dist/index.js +146 -637
- package/dist/index.mjs +147 -638
- package/dist/index.umd.js +167 -621
- package/dist/style.css +3 -2
- package/dist/style.js +2 -2
- package/dist/types/index.d.ts +68 -44
- package/package.json +4 -9
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.8
|
|
3
|
+
* Copyright (c) 2025-12-12 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
|
* 主题控件相关
|
|
@@ -266,9 +269,14 @@ function _set_prototype_of$r(o, p) {
|
|
|
266
269
|
function Control(options) {
|
|
267
270
|
var _this;
|
|
268
271
|
var _this___options;
|
|
269
|
-
_this = EventEmitter.call(this) || this, /** 具体语言对应的值 */ _this.locale = null, _this.__options = {}, _this._disabled = false, _this._active = false;
|
|
272
|
+
_this = EventEmitter.call(this) || this, /** 具体语言对应的值 */ _this.locale = null, _this.__options = {}, _this._disabled = false, _this._active = false, _this._camelCaseName = '';
|
|
270
273
|
_this.__options = options;
|
|
271
274
|
_this.locale = getLocale(_this.__options.locales, _this.__options.language);
|
|
275
|
+
_this._camelCaseName = _this.__options.classNameSuffix ? _this.__options.classNameSuffix.replace(/[-_\s]+(.)?/g, function(_, c) {
|
|
276
|
+
return c ? c.toUpperCase() : '';
|
|
277
|
+
}).replace(/^(.)/, function(first) {
|
|
278
|
+
return first.toLowerCase();
|
|
279
|
+
}) : '';
|
|
272
280
|
_this.$container = document.createElement(options.tagName || 'span');
|
|
273
281
|
_this.$container.classList.add("" + PREFIX_CLASS + "-control"); // 默认隐藏
|
|
274
282
|
if ((options == null ? void 0 : options.controlType) === 'text') {
|
|
@@ -427,19 +435,6 @@ function _set_prototype_of$r(o, p) {
|
|
|
427
435
|
this._disabled = disabled;
|
|
428
436
|
this._updateDisabledState(disabled);
|
|
429
437
|
}
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
key: "_camelCaseName",
|
|
433
|
-
get: function get() {
|
|
434
|
-
if (this.__options.classNameSuffix) {
|
|
435
|
-
return this.__options.classNameSuffix.replace(/[-_\s]+(.)?/g, function(_, c) {
|
|
436
|
-
return c ? c.toUpperCase() : '';
|
|
437
|
-
}).replace(/^(.)/, function(first) {
|
|
438
|
-
return first.toLowerCase();
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
return null;
|
|
442
|
-
}
|
|
443
438
|
}
|
|
444
439
|
]);
|
|
445
440
|
return Control;
|
|
@@ -4060,11 +4055,11 @@ function debounce(func, wait) {
|
|
|
4060
4055
|
// 对讲
|
|
4061
4056
|
// =======================================================
|
|
4062
4057
|
theme.on(EVENTS.talkingChange, function(talking) {
|
|
4063
|
-
var _theme_controls_talkControl,
|
|
4058
|
+
var _theme_controls, _theme_controls_talkControl, _theme_controls1;
|
|
4064
4059
|
theme._talking = talking;
|
|
4065
|
-
if (talking !== ((
|
|
4066
|
-
var _theme_controls_talkControl1,
|
|
4067
|
-
(
|
|
4060
|
+
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)) {
|
|
4061
|
+
var _theme_controls_talkControl1, _theme_controls2;
|
|
4062
|
+
(_theme_controls2 = theme.controls) == null ? void 0 : (_theme_controls_talkControl1 = _theme_controls2.talkControl) == null ? void 0 : _theme_controls_talkControl1.emit(EVENTS.talkingChange, talking);
|
|
4068
4063
|
}
|
|
4069
4064
|
});
|
|
4070
4065
|
theme.on(EVENTS.talkVolumeChange, function(value) {
|
|
@@ -4075,9 +4070,9 @@ function debounce(func, wait) {
|
|
|
4075
4070
|
// 录制
|
|
4076
4071
|
// =======================================================
|
|
4077
4072
|
theme.on(EVENTS.recordingChange, function(recording) {
|
|
4078
|
-
var _theme_controls_recordControl,
|
|
4073
|
+
var _theme_controls, _theme_controls_recordControl, _theme_controls1;
|
|
4079
4074
|
theme._recording = recording;
|
|
4080
|
-
if (recording !== ((
|
|
4075
|
+
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
4076
|
});
|
|
4082
4077
|
// =======================================================
|
|
4083
4078
|
// 清晰度
|
|
@@ -4094,14 +4089,14 @@ function debounce(func, wait) {
|
|
|
4094
4089
|
// 放大
|
|
4095
4090
|
// =======================================================
|
|
4096
4091
|
theme.on(EVENTS.zoomingChange, function(zooming) {
|
|
4097
|
-
var _theme_controls_zoomControl1,
|
|
4098
|
-
if (((_theme_controls1 = theme.controls) == null ? void 0 : (_theme_controls_zoomControl1 =
|
|
4092
|
+
var _theme_controls1, _theme_controls_zoomControl1, _theme_controls2;
|
|
4093
|
+
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
4094
|
theme.controls.zoomControl.active = zooming;
|
|
4100
4095
|
}
|
|
4101
4096
|
});
|
|
4102
4097
|
theme.on(EVENTS.zoomChange, function(zoom) {
|
|
4103
|
-
var _theme_controls_zoomControl,
|
|
4104
|
-
if (((_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_zoomControl =
|
|
4098
|
+
var _theme_controls, _theme_controls_zoomControl, _theme_controls1;
|
|
4099
|
+
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
4100
|
theme.controls.zoomControl.value = zoom;
|
|
4106
4101
|
}
|
|
4107
4102
|
});
|
|
@@ -4127,31 +4122,40 @@ function debounce(func, wait) {
|
|
|
4127
4122
|
// 全屏
|
|
4128
4123
|
// =======================================================
|
|
4129
4124
|
theme == null ? void 0 : theme.on(EVENTS.fullscreenChange, function(info) {
|
|
4130
|
-
if (
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4125
|
+
if (theme.zoomUtil) {
|
|
4126
|
+
if ([
|
|
4127
|
+
0,
|
|
4128
|
+
180
|
|
4129
|
+
].includes(theme.orientationAngle) && info.isMobile && info.isCurrentFullscreen) {
|
|
4130
|
+
var // 代表移动端播放内容节点被旋转了 90度
|
|
4131
|
+
_theme_zoomUtil_setTransform, _theme_zoomUtil;
|
|
4132
|
+
(_theme_zoomUtil = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform = _theme_zoomUtil.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform.call(_theme_zoomUtil, true);
|
|
4133
|
+
} else {
|
|
4134
|
+
var _theme_zoomUtil_setTransform1, _theme_zoomUtil1;
|
|
4135
|
+
(_theme_zoomUtil1 = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform1 = _theme_zoomUtil1.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform1.call(_theme_zoomUtil1, false);
|
|
4136
|
+
}
|
|
4140
4137
|
}
|
|
4141
4138
|
});
|
|
4142
4139
|
theme == null ? void 0 : theme.on(EVENTS.orientationChange, function(angle) {
|
|
4143
|
-
if (
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4140
|
+
if (theme.zoomUtil) {
|
|
4141
|
+
if ([
|
|
4142
|
+
0,
|
|
4143
|
+
180
|
|
4144
|
+
].includes(angle) && Utils.isMobile && theme.isCurrentFullscreen) {
|
|
4145
|
+
var // 代表移动端播放内容节点被旋转了 90度
|
|
4146
|
+
_theme_zoomUtil_setTransform, _theme_zoomUtil;
|
|
4147
|
+
(_theme_zoomUtil = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform = _theme_zoomUtil.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform.call(_theme_zoomUtil, true);
|
|
4148
|
+
} else {
|
|
4149
|
+
var _theme_zoomUtil_setTransform1, _theme_zoomUtil1;
|
|
4150
|
+
(_theme_zoomUtil1 = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform1 = _theme_zoomUtil1.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform1.call(_theme_zoomUtil1, false);
|
|
4151
|
+
}
|
|
4153
4152
|
}
|
|
4154
4153
|
});
|
|
4154
|
+
// 日期选择器
|
|
4155
|
+
theme == null ? void 0 : theme.on(EVENTS.control.dateMonthChange, function(dates) {
|
|
4156
|
+
var _theme_controls_dateControl_emit, _theme_controls_dateControl, _theme_controls;
|
|
4157
|
+
(_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);
|
|
4158
|
+
});
|
|
4155
4159
|
}
|
|
4156
4160
|
/**
|
|
4157
4161
|
* 控件向主题发现通信消息 control.on -> theme.emit ,仅用来转发控件的事件
|
|
@@ -4354,9 +4358,9 @@ function debounce(func, wait) {
|
|
|
4354
4358
|
});
|
|
4355
4359
|
theme.controls.timeLineControl.on(EVENTS.control.timeLinePanelOpenChange, function(open) {
|
|
4356
4360
|
var _theme_controls_dateControl, _theme_controls;
|
|
4357
|
-
if ((_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_dateControl = _theme_controls.dateControl) == null ? void 0 : _theme_controls_dateControl.
|
|
4358
|
-
var
|
|
4359
|
-
(_theme_controls1 = theme.controls) == null ? void 0 : (_theme_controls_dateControl1 = _theme_controls1.dateControl) == null ? void 0 : (
|
|
4361
|
+
if ((_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_dateControl = _theme_controls.dateControl) == null ? void 0 : _theme_controls_dateControl.datePicker) {
|
|
4362
|
+
var _theme_controls_dateControl_datePicker, _theme_controls_dateControl1, _theme_controls1;
|
|
4363
|
+
(_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
4364
|
}
|
|
4361
4365
|
theme.emit(EVENTS.control.timeLinePanelOpenChange, open);
|
|
4362
4366
|
});
|
|
@@ -4649,12 +4653,12 @@ function getDefaultExportFromCjs (x) {
|
|
|
4649
4653
|
* Released under the MIT License.
|
|
4650
4654
|
*/
|
|
4651
4655
|
|
|
4652
|
-
var dist$
|
|
4653
|
-
var hasRequiredDist$
|
|
4656
|
+
var dist$1;
|
|
4657
|
+
var hasRequiredDist$1;
|
|
4654
4658
|
|
|
4655
|
-
function requireDist$
|
|
4656
|
-
if (hasRequiredDist$
|
|
4657
|
-
hasRequiredDist$
|
|
4659
|
+
function requireDist$1 () {
|
|
4660
|
+
if (hasRequiredDist$1) return dist$1;
|
|
4661
|
+
hasRequiredDist$1 = 1;
|
|
4658
4662
|
|
|
4659
4663
|
/**
|
|
4660
4664
|
* Zoom position
|
|
@@ -5361,12 +5365,12 @@ function requireDist$2 () {
|
|
|
5361
5365
|
}();
|
|
5362
5366
|
Zoom.VERSION = '0.0.2';
|
|
5363
5367
|
|
|
5364
|
-
dist$
|
|
5365
|
-
return dist$
|
|
5368
|
+
dist$1 = Zoom;
|
|
5369
|
+
return dist$1;
|
|
5366
5370
|
}
|
|
5367
5371
|
|
|
5368
|
-
var distExports$
|
|
5369
|
-
var Zoom = /*@__PURE__*/getDefaultExportFromCjs(distExports$
|
|
5372
|
+
var distExports$1 = requireDist$1();
|
|
5373
|
+
var Zoom = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
|
|
5370
5374
|
|
|
5371
5375
|
function _extends$h() {
|
|
5372
5376
|
_extends$h = Object.assign || function(target) {
|
|
@@ -6441,7 +6445,7 @@ function _set_prototype_of$d(o, p) {
|
|
|
6441
6445
|
return CapturePicture;
|
|
6442
6446
|
}(Control);
|
|
6443
6447
|
|
|
6444
|
-
var dist
|
|
6448
|
+
var dist = {};
|
|
6445
6449
|
|
|
6446
6450
|
/*
|
|
6447
6451
|
* @ezuikit/control-ptz v0.0.1
|
|
@@ -6449,11 +6453,11 @@ var dist$1 = {};
|
|
|
6449
6453
|
* Released under the MIT License.
|
|
6450
6454
|
*/
|
|
6451
6455
|
|
|
6452
|
-
var hasRequiredDist
|
|
6456
|
+
var hasRequiredDist;
|
|
6453
6457
|
|
|
6454
|
-
function requireDist
|
|
6455
|
-
if (hasRequiredDist
|
|
6456
|
-
hasRequiredDist
|
|
6458
|
+
function requireDist () {
|
|
6459
|
+
if (hasRequiredDist) return dist;
|
|
6460
|
+
hasRequiredDist = 1;
|
|
6457
6461
|
|
|
6458
6462
|
var deepmerge$1 = deepmerge;
|
|
6459
6463
|
var utilsTools = require$$1;
|
|
@@ -7376,13 +7380,13 @@ function requireDist$1 () {
|
|
|
7376
7380
|
return Ptz;
|
|
7377
7381
|
}(BasePtz);
|
|
7378
7382
|
|
|
7379
|
-
dist
|
|
7380
|
-
dist
|
|
7381
|
-
dist
|
|
7382
|
-
return dist
|
|
7383
|
+
dist.BasePtz = BasePtz;
|
|
7384
|
+
dist.MobilePtz = MobilePtz;
|
|
7385
|
+
dist.Ptz = Ptz;
|
|
7386
|
+
return dist;
|
|
7383
7387
|
}
|
|
7384
7388
|
|
|
7385
|
-
var distExports
|
|
7389
|
+
var distExports = requireDist();
|
|
7386
7390
|
|
|
7387
7391
|
function _defineProperties$4(target, props) {
|
|
7388
7392
|
for(var i = 0; i < props.length; i++){
|
|
@@ -7481,7 +7485,7 @@ function _set_prototype_of$c(o, p) {
|
|
|
7481
7485
|
this.$turntable.classList.add("" + PREFIX_CLASS + "-ptz-turntable");
|
|
7482
7486
|
this.$panel.appendChild(this.$turntable);
|
|
7483
7487
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7484
|
-
this._ptzControl = new distExports
|
|
7488
|
+
this._ptzControl = new distExports.Ptz(this.$turntable, _extends$b({}, this._options, {
|
|
7485
7489
|
onSpeedChange: this._onSpeedChange.bind(this),
|
|
7486
7490
|
onDirection: this._onDirection.bind(this)
|
|
7487
7491
|
}));
|
|
@@ -7490,7 +7494,7 @@ function _set_prototype_of$c(o, p) {
|
|
|
7490
7494
|
};
|
|
7491
7495
|
_proto.renderMobileExtend = function renderMobileExtend($container) {
|
|
7492
7496
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
7493
|
-
if (!this._ptzControl1) this._ptzControl1 = new distExports
|
|
7497
|
+
if (!this._ptzControl1) this._ptzControl1 = new distExports.MobilePtz($container, _extends$b({}, this._options, {
|
|
7494
7498
|
onSpeedChange: this._onSpeedChange.bind(this),
|
|
7495
7499
|
onDirection: this._onDirection.bind(this)
|
|
7496
7500
|
}));
|
|
@@ -8618,541 +8622,6 @@ var SPEED_DEFAULT_OPTIONS = {
|
|
|
8618
8622
|
return Speed;
|
|
8619
8623
|
}(Select);
|
|
8620
8624
|
|
|
8621
|
-
/*
|
|
8622
|
-
* @ezuikit/control-date-picker v0.0.1-alpha.2
|
|
8623
|
-
* Copyright (c) 2025-11-12 Ezviz-OpenBiz
|
|
8624
|
-
* Released under the MIT License.
|
|
8625
|
-
*/
|
|
8626
|
-
|
|
8627
|
-
var dist;
|
|
8628
|
-
var hasRequiredDist;
|
|
8629
|
-
|
|
8630
|
-
function requireDist () {
|
|
8631
|
-
if (hasRequiredDist) return dist;
|
|
8632
|
-
hasRequiredDist = 1;
|
|
8633
|
-
|
|
8634
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
8635
|
-
try {
|
|
8636
|
-
var info = gen[key](arg);
|
|
8637
|
-
var value = info.value;
|
|
8638
|
-
} catch (error) {
|
|
8639
|
-
reject(error);
|
|
8640
|
-
return;
|
|
8641
|
-
}
|
|
8642
|
-
if (info.done) {
|
|
8643
|
-
resolve(value);
|
|
8644
|
-
} else {
|
|
8645
|
-
Promise.resolve(value).then(_next, _throw);
|
|
8646
|
-
}
|
|
8647
|
-
}
|
|
8648
|
-
function _async_to_generator(fn) {
|
|
8649
|
-
return function() {
|
|
8650
|
-
var self = this, args = arguments;
|
|
8651
|
-
return new Promise(function(resolve, reject) {
|
|
8652
|
-
var gen = fn.apply(self, args);
|
|
8653
|
-
function _next(value) {
|
|
8654
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
8655
|
-
}
|
|
8656
|
-
function _throw(err) {
|
|
8657
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
8658
|
-
}
|
|
8659
|
-
_next(undefined);
|
|
8660
|
-
});
|
|
8661
|
-
};
|
|
8662
|
-
}
|
|
8663
|
-
function _ts_generator(thisArg, body) {
|
|
8664
|
-
var f, y, t, _ = {
|
|
8665
|
-
label: 0,
|
|
8666
|
-
sent: function() {
|
|
8667
|
-
if (t[0] & 1) throw t[1];
|
|
8668
|
-
return t[1];
|
|
8669
|
-
},
|
|
8670
|
-
trys: [],
|
|
8671
|
-
ops: []
|
|
8672
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
8673
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
8674
|
-
return this;
|
|
8675
|
-
}), g;
|
|
8676
|
-
function verb(n) {
|
|
8677
|
-
return function(v) {
|
|
8678
|
-
return step([
|
|
8679
|
-
n,
|
|
8680
|
-
v
|
|
8681
|
-
]);
|
|
8682
|
-
};
|
|
8683
|
-
}
|
|
8684
|
-
function step(op) {
|
|
8685
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
8686
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
8687
|
-
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;
|
|
8688
|
-
if (y = 0, t) op = [
|
|
8689
|
-
op[0] & 2,
|
|
8690
|
-
t.value
|
|
8691
|
-
];
|
|
8692
|
-
switch(op[0]){
|
|
8693
|
-
case 0:
|
|
8694
|
-
case 1:
|
|
8695
|
-
t = op;
|
|
8696
|
-
break;
|
|
8697
|
-
case 4:
|
|
8698
|
-
_.label++;
|
|
8699
|
-
return {
|
|
8700
|
-
value: op[1],
|
|
8701
|
-
done: false
|
|
8702
|
-
};
|
|
8703
|
-
case 5:
|
|
8704
|
-
_.label++;
|
|
8705
|
-
y = op[1];
|
|
8706
|
-
op = [
|
|
8707
|
-
0
|
|
8708
|
-
];
|
|
8709
|
-
continue;
|
|
8710
|
-
case 7:
|
|
8711
|
-
op = _.ops.pop();
|
|
8712
|
-
_.trys.pop();
|
|
8713
|
-
continue;
|
|
8714
|
-
default:
|
|
8715
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
8716
|
-
_ = 0;
|
|
8717
|
-
continue;
|
|
8718
|
-
}
|
|
8719
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
8720
|
-
_.label = op[1];
|
|
8721
|
-
break;
|
|
8722
|
-
}
|
|
8723
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
8724
|
-
_.label = t[1];
|
|
8725
|
-
t = op;
|
|
8726
|
-
break;
|
|
8727
|
-
}
|
|
8728
|
-
if (t && _.label < t[2]) {
|
|
8729
|
-
_.label = t[2];
|
|
8730
|
-
_.ops.push(op);
|
|
8731
|
-
break;
|
|
8732
|
-
}
|
|
8733
|
-
if (t[2]) _.ops.pop();
|
|
8734
|
-
_.trys.pop();
|
|
8735
|
-
continue;
|
|
8736
|
-
}
|
|
8737
|
-
op = body.call(thisArg, _);
|
|
8738
|
-
} catch (e) {
|
|
8739
|
-
op = [
|
|
8740
|
-
6,
|
|
8741
|
-
e
|
|
8742
|
-
];
|
|
8743
|
-
y = 0;
|
|
8744
|
-
} finally{
|
|
8745
|
-
f = t = 0;
|
|
8746
|
-
}
|
|
8747
|
-
if (op[0] & 5) throw op[1];
|
|
8748
|
-
return {
|
|
8749
|
-
value: op[0] ? op[1] : void 0,
|
|
8750
|
-
done: true
|
|
8751
|
-
};
|
|
8752
|
-
}
|
|
8753
|
-
}
|
|
8754
|
-
var AppendJS = /*#__PURE__*/ function() {
|
|
8755
|
-
function AppendJS() {}
|
|
8756
|
-
AppendJS.loadScript = function loadScript(src) {
|
|
8757
|
-
return _async_to_generator(function() {
|
|
8758
|
-
return _ts_generator(this, function(_state) {
|
|
8759
|
-
switch(_state.label){
|
|
8760
|
-
case 0:
|
|
8761
|
-
return [
|
|
8762
|
-
4,
|
|
8763
|
-
new Promise(function(resolve, reject) {
|
|
8764
|
-
if (AppendJS.LoadedScr.includes(src)) {
|
|
8765
|
-
return resolve(src);
|
|
8766
|
-
}
|
|
8767
|
-
if (AppendJS.LoadingScrQueue[src]) {
|
|
8768
|
-
return AppendJS.LoadingScrQueue[src].push(resolve);
|
|
8769
|
-
} else {
|
|
8770
|
-
AppendJS.LoadingScrQueue[src] = [
|
|
8771
|
-
resolve
|
|
8772
|
-
];
|
|
8773
|
-
}
|
|
8774
|
-
var link;
|
|
8775
|
-
if (src.includes('.js')) {
|
|
8776
|
-
link = document.createElement('script');
|
|
8777
|
-
link.src = src;
|
|
8778
|
-
link.async = true;
|
|
8779
|
-
} else if (src.includes('.css')) {
|
|
8780
|
-
link = document.createElement('link');
|
|
8781
|
-
link.rel = 'stylesheet';
|
|
8782
|
-
link.href = src;
|
|
8783
|
-
}
|
|
8784
|
-
link.onload = function() {
|
|
8785
|
-
AppendJS.LoadedScr.push(src);
|
|
8786
|
-
AppendJS.LoadingScrQueue[src].forEach(function(resolve) {
|
|
8787
|
-
return resolve(src);
|
|
8788
|
-
});
|
|
8789
|
-
AppendJS.LoadingScrQueue[src] = [];
|
|
8790
|
-
};
|
|
8791
|
-
link.onerror = function() {
|
|
8792
|
-
return reject(new Error('Failed to load ' + src));
|
|
8793
|
-
};
|
|
8794
|
-
document.head.appendChild(link);
|
|
8795
|
-
})
|
|
8796
|
-
];
|
|
8797
|
-
case 1:
|
|
8798
|
-
return [
|
|
8799
|
-
2,
|
|
8800
|
-
_state.sent()
|
|
8801
|
-
];
|
|
8802
|
-
}
|
|
8803
|
-
});
|
|
8804
|
-
})();
|
|
8805
|
-
};
|
|
8806
|
-
AppendJS.loadScriptsBatch = function loadScriptsBatch(srcArr) {
|
|
8807
|
-
return _async_to_generator(function() {
|
|
8808
|
-
return _ts_generator(this, function(_state) {
|
|
8809
|
-
switch(_state.label){
|
|
8810
|
-
case 0:
|
|
8811
|
-
return [
|
|
8812
|
-
4,
|
|
8813
|
-
Promise.all(srcArr.map(AppendJS.loadScript))
|
|
8814
|
-
];
|
|
8815
|
-
case 1:
|
|
8816
|
-
return [
|
|
8817
|
-
2,
|
|
8818
|
-
_state.sent()
|
|
8819
|
-
];
|
|
8820
|
-
}
|
|
8821
|
-
});
|
|
8822
|
-
})();
|
|
8823
|
-
};
|
|
8824
|
-
AppendJS.remove = function remove(src) {
|
|
8825
|
-
src.forEach(function(item) {
|
|
8826
|
-
var link = document.querySelector('script[src="' + item + '"]') || document.querySelector('link[href="' + item + '"]');
|
|
8827
|
-
if (link) {
|
|
8828
|
-
link.remove();
|
|
8829
|
-
}
|
|
8830
|
-
});
|
|
8831
|
-
};
|
|
8832
|
-
AppendJS.clear = function clear() {
|
|
8833
|
-
AppendJS.remove(AppendJS.LoadedScr);
|
|
8834
|
-
};
|
|
8835
|
-
return AppendJS;
|
|
8836
|
-
}();
|
|
8837
|
-
/** 已经加载完的js/css */ AppendJS.LoadedScr = [];
|
|
8838
|
-
/** 正在加载的js/css */ AppendJS.LoadingScrQueue = {};
|
|
8839
|
-
|
|
8840
|
-
function _defineProperties(target, props) {
|
|
8841
|
-
for(var i = 0; i < props.length; i++){
|
|
8842
|
-
var descriptor = props[i];
|
|
8843
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
8844
|
-
descriptor.configurable = true;
|
|
8845
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
8846
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
8847
|
-
}
|
|
8848
|
-
}
|
|
8849
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
8850
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
8851
|
-
return Constructor;
|
|
8852
|
-
}
|
|
8853
|
-
var DEFAULT_OPTIONS = {
|
|
8854
|
-
staticPath: '.',
|
|
8855
|
-
place: 'top-right',
|
|
8856
|
-
language: 'zh-CN',
|
|
8857
|
-
current: new Date(),
|
|
8858
|
-
maxDate: new Date()
|
|
8859
|
-
};
|
|
8860
|
-
/**
|
|
8861
|
-
* 日期选择器
|
|
8862
|
-
*/ var DatePicker = /*#__PURE__*/ function() {
|
|
8863
|
-
function DatePicker(container, options) {
|
|
8864
|
-
var _this = this;
|
|
8865
|
-
this._open = false;
|
|
8866
|
-
this._change = true;
|
|
8867
|
-
this.$container = container;
|
|
8868
|
-
this.options = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
8869
|
-
this.options.staticPath = (this.options.staticPath || '').replace(/\/$/, '');
|
|
8870
|
-
if (this.options.current) {
|
|
8871
|
-
this._date = this.options.current;
|
|
8872
|
-
}
|
|
8873
|
-
this._init();
|
|
8874
|
-
this.$container.addEventListener('click', function() {
|
|
8875
|
-
if (_this._open) _this.hide();
|
|
8876
|
-
else _this.show();
|
|
8877
|
-
});
|
|
8878
|
-
document.body.addEventListener('click', function(e) {
|
|
8879
|
-
if (!_this.$container.contains(e.target)) {
|
|
8880
|
-
_this.hide();
|
|
8881
|
-
}
|
|
8882
|
-
});
|
|
8883
|
-
}
|
|
8884
|
-
var _proto = DatePicker.prototype;
|
|
8885
|
-
_proto._init = function _init() {
|
|
8886
|
-
var _this = this;
|
|
8887
|
-
// 因为挂载在行内,需要父标签设置 position: relative;
|
|
8888
|
-
this.$container.style.cssText += ";position: relative;";
|
|
8889
|
-
this.$container.classList.add("datepicker-inline-" + this.options.place);
|
|
8890
|
-
AppendJS.loadScriptsBatch([
|
|
8891
|
-
"" + this.options.staticPath + "/rec/jquery.min.js",
|
|
8892
|
-
"" + this.options.staticPath + "/rec/datepicker.min.css"
|
|
8893
|
-
]).then(function() {
|
|
8894
|
-
AppendJS.loadScriptsBatch([
|
|
8895
|
-
"" + _this.options.staticPath + "/rec/datepicker.js"
|
|
8896
|
-
]).then(function() {
|
|
8897
|
-
AppendJS.loadScriptsBatch([
|
|
8898
|
-
"" + _this.options.staticPath + "/rec/datepicker.zh-CN.js",
|
|
8899
|
-
"" + _this.options.staticPath + "/rec/datepicker.en-US.js"
|
|
8900
|
-
]).then(function() {
|
|
8901
|
-
window.$(_this.$container).datepicker({
|
|
8902
|
-
date: _this.options.current,
|
|
8903
|
-
language: _this.options.language,
|
|
8904
|
-
endDate: _this.options.maxDate,
|
|
8905
|
-
inline: true
|
|
8906
|
-
});
|
|
8907
|
-
_this.hide();
|
|
8908
|
-
window.$(_this.$container).on('pick.datepicker', function(e) {
|
|
8909
|
-
var _this__date, _this__date1, _this__date2, _this__date3, _this__date4, _this__date5;
|
|
8910
|
-
if (e.view === 'year' && ((_this__date = _this._date) == null ? void 0 : _this__date.getFullYear()) !== e.date.getFullYear()) {
|
|
8911
|
-
_this.options.onYearChange == null ? void 0 : _this.options.onYearChange.call(_this.options, e.date);
|
|
8912
|
-
} 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())) {
|
|
8913
|
-
_this.options.onMonthChange == null ? void 0 : _this.options.onMonthChange.call(_this.options, e.date);
|
|
8914
|
-
} else if ([
|
|
8915
|
-
'day',
|
|
8916
|
-
'pick'
|
|
8917
|
-
].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())) {
|
|
8918
|
-
if (_this._change) {
|
|
8919
|
-
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, e.date);
|
|
8920
|
-
}
|
|
8921
|
-
_this._date = new Date(e.date.getTime());
|
|
8922
|
-
}
|
|
8923
|
-
if (e.view === 'day') _this.hide();
|
|
8924
|
-
_this._change = true;
|
|
8925
|
-
});
|
|
8926
|
-
});
|
|
8927
|
-
});
|
|
8928
|
-
});
|
|
8929
|
-
};
|
|
8930
|
-
/**
|
|
8931
|
-
* 设置日期, change = true 时触发 onChange 事件
|
|
8932
|
-
*
|
|
8933
|
-
* @param date 设置的日期
|
|
8934
|
-
* @param change 是否触发 onChange 事件
|
|
8935
|
-
*/ _proto.setDate = function setDate(date, change) {
|
|
8936
|
-
if (change === void 0) change = true;
|
|
8937
|
-
var $datepicker = this.$container.querySelector(".datepicker-inline");
|
|
8938
|
-
if ($datepicker) {
|
|
8939
|
-
this._change = change;
|
|
8940
|
-
window.$(this.$container).datepicker('setDate', date);
|
|
8941
|
-
}
|
|
8942
|
-
};
|
|
8943
|
-
/**
|
|
8944
|
-
* 隐藏面板, 会触发 onPanelChange 事件
|
|
8945
|
-
*/ _proto.hide = function hide() {
|
|
8946
|
-
var $datepicker = this.$container.querySelector(".datepicker-inline");
|
|
8947
|
-
if ($datepicker) {
|
|
8948
|
-
if (this._open) {
|
|
8949
|
-
this._open = false;
|
|
8950
|
-
this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, false, this._date);
|
|
8951
|
-
}
|
|
8952
|
-
$datepicker.classList.add('datepicker-hide');
|
|
8953
|
-
}
|
|
8954
|
-
};
|
|
8955
|
-
/**
|
|
8956
|
-
* 显示面板, 会触发 onPanelChange 事件
|
|
8957
|
-
*/ _proto.show = function show() {
|
|
8958
|
-
var $datepicker = this.$container.querySelector(".datepicker-inline");
|
|
8959
|
-
if ($datepicker) {
|
|
8960
|
-
var _window_$_datepicker, _window_$;
|
|
8961
|
-
if (!this._open) {
|
|
8962
|
-
this._open = true;
|
|
8963
|
-
this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, true, this._date);
|
|
8964
|
-
}
|
|
8965
|
-
if (this._date) this.setDate(this._date, false);
|
|
8966
|
-
(_window_$_datepicker = (_window_$ = window.$(this.$container)).datepicker) == null ? void 0 : _window_$_datepicker.call(_window_$, 'showView');
|
|
8967
|
-
if (this.options.place === 'bottom-left') {
|
|
8968
|
-
$datepicker.style.cssText += "top: " + (this.$container.clientHeight + 10) + "px; bottom: auto; right: auto; left: 0px";
|
|
8969
|
-
} else {
|
|
8970
|
-
$datepicker.style.cssText += "bottom: " + (this.$container.clientHeight + 10) + "px; top: auto";
|
|
8971
|
-
}
|
|
8972
|
-
$datepicker.classList.remove('datepicker-hide');
|
|
8973
|
-
}
|
|
8974
|
-
};
|
|
8975
|
-
/**
|
|
8976
|
-
* 销毁
|
|
8977
|
-
*/ _proto.destroy = function destroy() {
|
|
8978
|
-
this.hide();
|
|
8979
|
-
this._date = undefined;
|
|
8980
|
-
window.$(this.$container).datepicker('destroy');
|
|
8981
|
-
// AppendJS.remove([
|
|
8982
|
-
// `${this.options.staticPath}/rec/jquery.min.js`,
|
|
8983
|
-
// `${this.options.staticPath}/rec/datepicker.min.css`,
|
|
8984
|
-
// `${this.options.staticPath}/rec/datepicker.js`,
|
|
8985
|
-
// `${this.options.staticPath}/rec/datepicker.zh-CN.js`,
|
|
8986
|
-
// `${this.options.staticPath}/rec/datepicker.en-US.js`,
|
|
8987
|
-
// ]);
|
|
8988
|
-
};
|
|
8989
|
-
_create_class(DatePicker, [
|
|
8990
|
-
{
|
|
8991
|
-
key: "date",
|
|
8992
|
-
get: /**
|
|
8993
|
-
* 获取日期
|
|
8994
|
-
*/ function get() {
|
|
8995
|
-
return this._date;
|
|
8996
|
-
}
|
|
8997
|
-
}
|
|
8998
|
-
]);
|
|
8999
|
-
return DatePicker;
|
|
9000
|
-
}();
|
|
9001
|
-
|
|
9002
|
-
dist = DatePicker;
|
|
9003
|
-
return dist;
|
|
9004
|
-
}
|
|
9005
|
-
|
|
9006
|
-
var distExports = requireDist();
|
|
9007
|
-
var DatePickerUtil = /*@__PURE__*/getDefaultExportFromCjs(distExports);
|
|
9008
|
-
|
|
9009
|
-
/**
|
|
9010
|
-
* @description 时间操作
|
|
9011
|
-
*/ var DateTime = /*#__PURE__*/ function() {
|
|
9012
|
-
function DateTime() {}
|
|
9013
|
-
/**
|
|
9014
|
-
* @description 时间格式化
|
|
9015
|
-
* @param {Date | number | string} date
|
|
9016
|
-
* @param {string} formatType 格式 'YYYY-MM-DD hh:mm:ss' 或 'YYYYMMDDhhmmss' 或 'YYYY/MM/DD hh:mm:ss' 或 'hh:mm:ss' 或 'YYYYMMDDThhmmssZ'
|
|
9017
|
-
* @param {number} timeZone 时区偏移量 默认 0
|
|
9018
|
-
*/ DateTime.formate = function formate(date, formatType, timeZone) {
|
|
9019
|
-
if (timeZone === void 0) timeZone = 0;
|
|
9020
|
-
var dateTime = date;
|
|
9021
|
-
if (typeof date === 'string') {
|
|
9022
|
-
dateTime = DateTime.strToDate(date);
|
|
9023
|
-
} else if (typeof date === 'number') {
|
|
9024
|
-
dateTime = new Date(date);
|
|
9025
|
-
}
|
|
9026
|
-
dateTime = new Date(dateTime.getTime() - timeZone * 3600 * 1000);
|
|
9027
|
-
var year = dateTime.getFullYear();
|
|
9028
|
-
var month = String(dateTime.getMonth() + 1).padStart(2, '0');
|
|
9029
|
-
var day = String(dateTime.getDate()).padStart(2, '0');
|
|
9030
|
-
var hours = String(dateTime.getHours()).padStart(2, '0');
|
|
9031
|
-
var minutes = String(dateTime.getMinutes()).padStart(2, '0');
|
|
9032
|
-
var seconds = String(dateTime.getSeconds()).padStart(2, '0');
|
|
9033
|
-
switch(formatType){
|
|
9034
|
-
case 'YYYY-MM-DD hh:mm:ss':
|
|
9035
|
-
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
|
9036
|
-
case 'YYYYMMDDhhmmss':
|
|
9037
|
-
return "" + year + month + day + hours + minutes + seconds;
|
|
9038
|
-
case 'YYYY/MM/DD hh:mm:ss':
|
|
9039
|
-
return year + "/" + month + "/" + day + " " + hours + ":" + minutes + ":" + seconds;
|
|
9040
|
-
case 'YYYYMMDDThhmmssZ':
|
|
9041
|
-
return "" + year + month + day + "T" + hours + minutes + seconds + "Z";
|
|
9042
|
-
case 'YYYY/MM/DD':
|
|
9043
|
-
return year + "/" + month + "/" + day;
|
|
9044
|
-
case 'YYYYMMDD':
|
|
9045
|
-
return "" + year + month + day;
|
|
9046
|
-
case 'YYYY-MM-DD':
|
|
9047
|
-
return year + "-" + month + "-" + day;
|
|
9048
|
-
case 'YYYY':
|
|
9049
|
-
return "" + year;
|
|
9050
|
-
case 'MM':
|
|
9051
|
-
return "" + month;
|
|
9052
|
-
case 'DD':
|
|
9053
|
-
return "" + day;
|
|
9054
|
-
case 'hh:mm:ss':
|
|
9055
|
-
return hours + ":" + minutes + ":" + seconds;
|
|
9056
|
-
case 'hh':
|
|
9057
|
-
return "" + hours;
|
|
9058
|
-
case 'mm':
|
|
9059
|
-
return "" + minutes;
|
|
9060
|
-
case 'ss':
|
|
9061
|
-
return "" + seconds;
|
|
9062
|
-
default:
|
|
9063
|
-
throw new Error('Unsupported format type');
|
|
9064
|
-
}
|
|
9065
|
-
};
|
|
9066
|
-
/**
|
|
9067
|
-
* @description 对比两个时间的差值
|
|
9068
|
-
* @param {Date | string | number} date1
|
|
9069
|
-
* @param {Date | string | number} date2
|
|
9070
|
-
* @param {"year" | "month" | "day" | "hour" | "minute" | "second"} diffType
|
|
9071
|
-
*/ DateTime.diff = function diff(date1, date2, diffType) {
|
|
9072
|
-
/** @type {Date} */ var dateTime1 = date1;
|
|
9073
|
-
if (typeof date1 === 'string') {
|
|
9074
|
-
dateTime1 = DateTime.strToDate(date1);
|
|
9075
|
-
} else if (typeof date1 === 'number') {
|
|
9076
|
-
dateTime1 = new Date(date1);
|
|
9077
|
-
}
|
|
9078
|
-
/** @type {Date} */ var dateTime2 = date2;
|
|
9079
|
-
if (typeof date2 === 'string') {
|
|
9080
|
-
dateTime1 = DateTime.strToDate(date2);
|
|
9081
|
-
} else if (typeof date2 === 'number') {
|
|
9082
|
-
dateTime1 = new Date(date2);
|
|
9083
|
-
}
|
|
9084
|
-
var diffSecond = dateTime1.getTime() - dateTime2.getTime();
|
|
9085
|
-
// diff
|
|
9086
|
-
switch(diffType){
|
|
9087
|
-
case 'year':
|
|
9088
|
-
return dateTime1.getFullYear() - dateTime2.getFullYear();
|
|
9089
|
-
case 'month':
|
|
9090
|
-
// 计算总月份差
|
|
9091
|
-
// eslint-disable-next-line no-case-declarations
|
|
9092
|
-
var months = (dateTime1.getFullYear() - dateTime2.getFullYear()) * 12 + (dateTime1.getMonth() - dateTime2.getMonth());
|
|
9093
|
-
// 如果结束日的日期小于开始日的日期,则减去一个月
|
|
9094
|
-
if (dateTime1.getDate() < dateTime2.getDate()) {
|
|
9095
|
-
months--;
|
|
9096
|
-
}
|
|
9097
|
-
return months;
|
|
9098
|
-
case 'day':
|
|
9099
|
-
return diffSecond / 60 / 60 / 24;
|
|
9100
|
-
case 'hour':
|
|
9101
|
-
return diffSecond / 60 / 60;
|
|
9102
|
-
case 'minute':
|
|
9103
|
-
return diffSecond / 60;
|
|
9104
|
-
case 'second':
|
|
9105
|
-
return diffSecond;
|
|
9106
|
-
default:
|
|
9107
|
-
throw new Error('Unsupported diff type');
|
|
9108
|
-
}
|
|
9109
|
-
};
|
|
9110
|
-
DateTime.now = function now() {
|
|
9111
|
-
return Date.now();
|
|
9112
|
-
};
|
|
9113
|
-
/**
|
|
9114
|
-
*
|
|
9115
|
-
* @param {string} str 日期, 2025-04-10 10:10:10 或 2025/04/10 10:10:10 或 20250410101010 或 20250410T101010Z 或 秒 或 毫秒
|
|
9116
|
-
* @example
|
|
9117
|
-
* DateTime.strToDate("2025/04/10 10:10:10") // Date
|
|
9118
|
-
* DateTime.strToDate("2025-04-10 10:10:10") // Date
|
|
9119
|
-
* DateTime.strToDate("20250410101010") // Date
|
|
9120
|
-
* DateTime.strToDate("20250410T101010Z") // Date
|
|
9121
|
-
*/ DateTime.strToDate = function strToDate(str) {
|
|
9122
|
-
var time = (str + '').replace(/-/gi, '').replace(/:/gi, '').replace(/\//gi, '').replace(/ /gi, '').replace(/T|Z/gi, '');
|
|
9123
|
-
// 兼容
|
|
9124
|
-
if ((str + '').length === 10) {
|
|
9125
|
-
// 时间戳 秒
|
|
9126
|
-
return new Date(+str);
|
|
9127
|
-
} else if ((str + '').length === 13) {
|
|
9128
|
-
// 时间戳 毫秒
|
|
9129
|
-
return new Date(+str);
|
|
9130
|
-
}
|
|
9131
|
-
var year = time.slice(0, 4);
|
|
9132
|
-
var month = time.slice(4, 6);
|
|
9133
|
-
var day = time.slice(6, 8);
|
|
9134
|
-
var hour = time.slice(8, 10);
|
|
9135
|
-
var minute = time.slice(10, 12);
|
|
9136
|
-
var second = time.slice(12, 14);
|
|
9137
|
-
return new Date(year + '/' + month + '/' + day + ' ' + hour + ':' + minute + ':' + second);
|
|
9138
|
-
};
|
|
9139
|
-
/**
|
|
9140
|
-
* @description 补充十位
|
|
9141
|
-
* @param {number} num
|
|
9142
|
-
* @returns {string}
|
|
9143
|
-
* @example
|
|
9144
|
-
* DateTime.padStart(1) // "01"
|
|
9145
|
-
* DateTime.padStart(33) // "33"
|
|
9146
|
-
*/ DateTime.padStart = function padStart(num) {
|
|
9147
|
-
if (num < 10) {
|
|
9148
|
-
return '0' + num;
|
|
9149
|
-
} else {
|
|
9150
|
-
return num + '';
|
|
9151
|
-
}
|
|
9152
|
-
};
|
|
9153
|
-
return DateTime;
|
|
9154
|
-
}();
|
|
9155
|
-
|
|
9156
8625
|
function _extends$5() {
|
|
9157
8626
|
_extends$5 = Object.assign || function(target) {
|
|
9158
8627
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -9195,20 +8664,29 @@ function _set_prototype_of$6(o, p) {
|
|
|
9195
8664
|
function DatePickerControl(options) {
|
|
9196
8665
|
var _this;
|
|
9197
8666
|
var _this_options_props_urlInfo_searchParams, _this_options_props_urlInfo, _this_options_props;
|
|
9198
|
-
_this = Control.call(this, _extends$5({
|
|
8667
|
+
_this = Control.call(this, _extends$5({
|
|
8668
|
+
maxDate: new Date()
|
|
8669
|
+
}, options, {
|
|
9199
8670
|
tagName: 'span',
|
|
9200
8671
|
controlType: 'button',
|
|
9201
8672
|
classNameSuffix: 'date'
|
|
9202
8673
|
})) || this;
|
|
9203
8674
|
_this.options = options;
|
|
9204
|
-
_this._value = DateTime.
|
|
8675
|
+
_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');
|
|
9205
8676
|
_this._render();
|
|
8677
|
+
// 日期上的点
|
|
8678
|
+
_this.on(EVENTS.control.dateMonthChange, function(dates) {
|
|
8679
|
+
var _this_datePicker_updateBadges, _this_datePicker;
|
|
8680
|
+
(_this_datePicker = _this.datePicker) == null ? void 0 : (_this_datePicker_updateBadges = _this_datePicker.updateBadges) == null ? void 0 : _this_datePicker_updateBadges.call(_this_datePicker, dates);
|
|
8681
|
+
});
|
|
9206
8682
|
return _this;
|
|
9207
8683
|
}
|
|
9208
8684
|
var _proto = DatePickerControl.prototype;
|
|
9209
8685
|
_proto._render = function _render() {
|
|
9210
8686
|
var _this = this;
|
|
9211
|
-
|
|
8687
|
+
var _this_options_props;
|
|
8688
|
+
var isMobile1 = isMobile();
|
|
8689
|
+
if (isMobile1) {
|
|
9212
8690
|
var _this_locale;
|
|
9213
8691
|
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>";
|
|
9214
8692
|
} else {
|
|
@@ -9217,25 +8695,45 @@ function _set_prototype_of$6(o, p) {
|
|
|
9217
8695
|
title: (_this_locale1 = this.locale) == null ? void 0 : _this_locale1.BTN_CALENDAR
|
|
9218
8696
|
});
|
|
9219
8697
|
}
|
|
9220
|
-
this.
|
|
9221
|
-
|
|
9222
|
-
|
|
8698
|
+
this.datePicker = new DatePicker(this.$container, {
|
|
8699
|
+
isMobile: isMobile1,
|
|
8700
|
+
getPopupContainer: function() {
|
|
8701
|
+
return _this.$container;
|
|
8702
|
+
},
|
|
8703
|
+
mode: 'date',
|
|
8704
|
+
offset: [
|
|
8705
|
+
0,
|
|
8706
|
+
-10
|
|
8707
|
+
],
|
|
8708
|
+
badges: ((_this_options_props = this.options.props) == null ? void 0 : _this_options_props.recMonth) || [],
|
|
8709
|
+
language: this.options.language === 'zh' ? 'zh' : 'en',
|
|
9223
8710
|
current: new Date(this._value + ' 00:00:00'),
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
8711
|
+
placement: 'tr',
|
|
8712
|
+
triggerClose: true,
|
|
8713
|
+
disabledDate: function(date) {
|
|
8714
|
+
return date.getTime() > (_this.options.maxDate || new Date()).getTime();
|
|
8715
|
+
},
|
|
8716
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8717
|
+
onOk: function(date, _mode) {
|
|
8718
|
+
if (date && _this._value !== DateTime.format(date, 'YYYY-MM-DD') && isMobile1) {
|
|
8719
|
+
_this._value = DateTime.format(date, 'YYYY-MM-DD');
|
|
8720
|
+
_this.options.onOk == null ? void 0 : _this.options.onOk.call(_this.options, date);
|
|
9230
8721
|
_this.emit(EVENTS.control.dateChange, date);
|
|
9231
8722
|
if (date && _this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
9232
8723
|
_this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value").innerHTML = _this._getDateStr();
|
|
9233
8724
|
}
|
|
9234
8725
|
}
|
|
9235
8726
|
},
|
|
9236
|
-
|
|
9237
|
-
_this.
|
|
9238
|
-
|
|
8727
|
+
onChange: function(date, mode) {
|
|
8728
|
+
if (date && _this._value !== DateTime.format(date, 'YYYY-MM-DD') && !isMobile1 && mode === 'date') {
|
|
8729
|
+
_this._value = DateTime.format(date, 'YYYY-MM-DD');
|
|
8730
|
+
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, date);
|
|
8731
|
+
_this.emit(EVENTS.control.dateChange, date);
|
|
8732
|
+
}
|
|
8733
|
+
},
|
|
8734
|
+
onOpenChange: function(open) {
|
|
8735
|
+
_this.options.onPanelChange == null ? void 0 : _this.options.onPanelChange.call(_this.options, open, _this.datePicker.current);
|
|
8736
|
+
_this.emit(EVENTS.control.datePanelOpenChange, open, _this.datePicker.current);
|
|
9239
8737
|
}
|
|
9240
8738
|
});
|
|
9241
8739
|
};
|
|
@@ -9245,28 +8743,27 @@ function _set_prototype_of$6(o, p) {
|
|
|
9245
8743
|
* @param change 是否触发 onChange 事件
|
|
9246
8744
|
*/ _proto.setDate = function setDate(date, change) {
|
|
9247
8745
|
if (change === void 0) change = true;
|
|
9248
|
-
var
|
|
9249
|
-
(
|
|
9250
|
-
if (date && !change && this._value !== DateTime.
|
|
9251
|
-
this._value = DateTime.
|
|
8746
|
+
var _this_datePicker;
|
|
8747
|
+
(_this_datePicker = this.datePicker) == null ? void 0 : _this_datePicker.setCurrent(date, change);
|
|
8748
|
+
if (date && !change && this._value !== DateTime.format(date, 'YYYY-MM-DD')) {
|
|
8749
|
+
this._value = DateTime.format(date, 'YYYY-MM-DD');
|
|
9252
8750
|
if (date && this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
9253
8751
|
this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value").innerHTML = this._getDateStr();
|
|
9254
8752
|
}
|
|
9255
8753
|
}
|
|
9256
8754
|
};
|
|
9257
8755
|
_proto.reset = function reset() {
|
|
9258
|
-
|
|
9259
|
-
(_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.hide();
|
|
8756
|
+
if (this.datePicker) this.datePicker.open = false;
|
|
9260
8757
|
Control.prototype.reset.call(this);
|
|
9261
8758
|
};
|
|
9262
8759
|
/**
|
|
9263
8760
|
* 销毁控件
|
|
9264
8761
|
* @override
|
|
9265
8762
|
*/ _proto.destroy = function destroy() {
|
|
9266
|
-
if (this.
|
|
9267
|
-
this.
|
|
8763
|
+
if (this.datePicker) {
|
|
8764
|
+
this.datePicker.destroy();
|
|
9268
8765
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9269
|
-
this.
|
|
8766
|
+
this.datePicker = null;
|
|
9270
8767
|
}
|
|
9271
8768
|
Control.prototype.destroy.call(this);
|
|
9272
8769
|
};
|
|
@@ -9276,6 +8773,7 @@ function _set_prototype_of$6(o, p) {
|
|
|
9276
8773
|
};
|
|
9277
8774
|
/**
|
|
9278
8775
|
* 点击 Control 会触发
|
|
8776
|
+
* @overload super._onControlClick(e: Event)
|
|
9279
8777
|
*/ _proto._onControlClick = function _onControlClick(e) {
|
|
9280
8778
|
Control.prototype._onControlClick.call(this, e);
|
|
9281
8779
|
};
|
|
@@ -10348,8 +9846,7 @@ var _renderDatePicker = function(theme, container, props) {
|
|
|
10348
9846
|
return container;
|
|
10349
9847
|
},
|
|
10350
9848
|
language: theme.options.language,
|
|
10351
|
-
locales: theme.i18n.translations
|
|
10352
|
-
staticPath: theme.options.staticPath
|
|
9849
|
+
locales: theme.i18n.translations
|
|
10353
9850
|
}, ((_theme_options = theme.options) == null ? void 0 : _theme_options["dateOptions"]) || {}, {
|
|
10354
9851
|
props: props
|
|
10355
9852
|
}));
|
|
@@ -10648,7 +10145,18 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10648
10145
|
*/ _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, /**
|
|
10649
10146
|
* 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
|
|
10650
10147
|
* @private
|
|
10651
|
-
*/ _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,
|
|
10148
|
+
*/ _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, // /**
|
|
10149
|
+
// * 记录回放的月份
|
|
10150
|
+
// *
|
|
10151
|
+
// * key: {序列号}_{通道号}_{rec | cloud | cloudRecord} 比如:BC7799091_1_rec BC7799091_1_cloud BC7799091_1_cloudRecord
|
|
10152
|
+
// *
|
|
10153
|
+
// * value: 月份列表 比如 ["2025-12-01", "2025-12-02"]
|
|
10154
|
+
// * @private
|
|
10155
|
+
// */
|
|
10156
|
+
// _recMonthObj: Record<string, string[]> = {};
|
|
10157
|
+
/**
|
|
10158
|
+
* 录像回放的月份列表 @private
|
|
10159
|
+
*/ _this.recMonth = [], /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null, _this.scaleMode = 0;
|
|
10652
10160
|
_this._initOptions(options);
|
|
10653
10161
|
if (_this.options.type === 'ezopen') {
|
|
10654
10162
|
var _this_urlInfo_searchParams, _this_urlInfo;
|
|
@@ -10658,7 +10166,7 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10658
10166
|
}
|
|
10659
10167
|
if (_this.urlInfo.type === 'rec') {
|
|
10660
10168
|
var _this_urlInfo_searchParams1, _this_urlInfo1, _this_urlInfo_searchParams2, _this_urlInfo2;
|
|
10661
|
-
_this._seekDate = ((_this_urlInfo1 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams1 = _this_urlInfo1.searchParams) == null ? void 0 : _this_urlInfo_searchParams1.begin) ? DateTime.
|
|
10169
|
+
_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');
|
|
10662
10170
|
}
|
|
10663
10171
|
}
|
|
10664
10172
|
_this._getRecType(_this.options.url);
|
|
@@ -10905,6 +10413,7 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
10905
10413
|
this._themeData = null;
|
|
10906
10414
|
if (this.i18n) this.i18n = null;
|
|
10907
10415
|
this.recType = '';
|
|
10416
|
+
this.recMonth = []; // 清空数据
|
|
10908
10417
|
this.emit(EVENTS.theme.destroyed);
|
|
10909
10418
|
this.removeAllListeners();
|
|
10910
10419
|
if (this.logger) this.logger = null;
|
|
@@ -11870,6 +11379,6 @@ var THEME_DEFAULT_OPTIONS = {
|
|
|
11870
11379
|
zh: zh,
|
|
11871
11380
|
en: en
|
|
11872
11381
|
};
|
|
11873
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.2-beta.
|
|
11382
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.2-beta.8';
|
|
11874
11383
|
|
|
11875
11384
|
export { Control, Fullscreen, Loading, Message, Play, Poster, Rec, Theme, Utils, Volume };
|