@ezuikit/player-theme 1.0.0-beta.1 → 1.0.0
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 +38 -17
- package/dist/index.mjs +38 -17
- package/dist/index.umd.js +620 -183
- package/dist/style.css +1 -1
- package/dist/style.js +2 -2
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -3
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @ezuikit/player-theme v1.0.0
|
|
3
|
-
* Copyright (c) 2025-
|
|
2
|
+
* @ezuikit/player-theme v1.0.0
|
|
3
|
+
* Copyright (c) 2025-11-03 Ezviz-OpenBiz
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
@@ -534,6 +534,7 @@
|
|
|
534
534
|
/** 日期改变 */ dateChange: 'Control.dateChange',
|
|
535
535
|
/** 日期销毁 */ dateDestroy: 'Control.datePanelDestroy',
|
|
536
536
|
/** 时间轴拖动结束 */ timeLineChange: 'Control.timeLineChange',
|
|
537
|
+
/** 时间轴图片列表面板 */ timeLinePanelOpenChange: 'Control.timeLinePanelOpenChange',
|
|
537
538
|
/** 时间轴控件销毁 */ timeLineDestroy: 'Control.timeLineDestroy',
|
|
538
539
|
/** 主题控件挂载前 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ beforeMountControls: 'Control.beforeMountControls',
|
|
539
540
|
/** 主题控件挂载完成, 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ mountedControls: 'Control.mountedControls',
|
|
@@ -980,7 +981,7 @@
|
|
|
980
981
|
return Poster;
|
|
981
982
|
}(Control);
|
|
982
983
|
|
|
983
|
-
var Icons
|
|
984
|
+
var Icons = {
|
|
984
985
|
/** 播放 */ play: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" focusable="false" aria-hidden="true" data-icon="play">\n <rect x="6.5" y="5.5" rx="1.25" width="2.5" height="13"/>\n <rect x="15" y="5.5" rx="1.25" width="2.5" height="13"/>\n </svg>',
|
|
985
986
|
/** 暂停 */ pause: '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="currentColor" focusable="false" aria-hidden="true" data-icon="pause"> <path d="M17.5 13.66L9.1 19.26C7.78 20.14 6 19.19 6 17.59L6 6.4C6 4.8 7.78 3.85 9.1 4.73L17.5 10.33C18.69 11.12 18.69 12.87 17.5 13.66Z" /></svg>',
|
|
986
987
|
/** 音量 */ volume: function(prefix) {
|
|
@@ -1046,131 +1047,131 @@
|
|
|
1046
1047
|
var IconComponents = {
|
|
1047
1048
|
/** 播放 */ play: function(attr) {
|
|
1048
1049
|
if (attr === void 0) attr = {};
|
|
1049
|
-
return createIcon(Icons
|
|
1050
|
+
return createIcon(Icons.play, 'play', attr);
|
|
1050
1051
|
},
|
|
1051
1052
|
/** 暂停 */ pause: function(attr) {
|
|
1052
1053
|
if (attr === void 0) attr = {};
|
|
1053
|
-
return createIcon(Icons
|
|
1054
|
+
return createIcon(Icons.pause, 'pause', attr);
|
|
1054
1055
|
},
|
|
1055
1056
|
volume: function(attr) {
|
|
1056
1057
|
if (attr === void 0) attr = {};
|
|
1057
|
-
return createIcon(Icons
|
|
1058
|
+
return createIcon(Icons.volume(PREFIX_CLASS), 'volume', attr);
|
|
1058
1059
|
},
|
|
1059
1060
|
mobileFullscreen: function(attr) {
|
|
1060
1061
|
if (attr === void 0) attr = {};
|
|
1061
|
-
return createIcon(Icons
|
|
1062
|
+
return createIcon(Icons.mobileFullscreen, 'mobile-fullscreen', attr);
|
|
1062
1063
|
},
|
|
1063
1064
|
exitFullscreen: function(attr) {
|
|
1064
1065
|
if (attr === void 0) attr = {};
|
|
1065
|
-
return createIcon(Icons
|
|
1066
|
+
return createIcon(Icons.exitFullscreen, 'exit-fullscreen', attr);
|
|
1066
1067
|
},
|
|
1067
1068
|
fullscreen: function(attr) {
|
|
1068
1069
|
if (attr === void 0) attr = {};
|
|
1069
|
-
return createIcon(Icons
|
|
1070
|
+
return createIcon(Icons.fullscreen, 'fullscreen', attr);
|
|
1070
1071
|
},
|
|
1071
1072
|
exitGlobalFullscreen: function(attr) {
|
|
1072
1073
|
if (attr === void 0) attr = {};
|
|
1073
|
-
return createIcon(Icons
|
|
1074
|
+
return createIcon(Icons.exitGlobalFullscreen, 'exit-global-fullscreen', attr);
|
|
1074
1075
|
},
|
|
1075
1076
|
globalFullscreen: function(attr) {
|
|
1076
1077
|
if (attr === void 0) attr = {};
|
|
1077
|
-
return createIcon(Icons
|
|
1078
|
+
return createIcon(Icons.globalFullscreen, 'global-fullscreen', attr);
|
|
1078
1079
|
},
|
|
1079
1080
|
capturePicture: function(attr) {
|
|
1080
1081
|
if (attr === void 0) attr = {};
|
|
1081
|
-
return createIcon(Icons
|
|
1082
|
+
return createIcon(Icons.capturePicture, 'capture-picture', attr);
|
|
1082
1083
|
},
|
|
1083
1084
|
ptz: function(attr) {
|
|
1084
1085
|
if (attr === void 0) attr = {};
|
|
1085
|
-
return createIcon(Icons
|
|
1086
|
+
return createIcon(Icons.ptz, 'ptz', attr);
|
|
1086
1087
|
},
|
|
1087
1088
|
record: function(attr) {
|
|
1088
1089
|
if (attr === void 0) attr = {};
|
|
1089
|
-
return createIcon(Icons
|
|
1090
|
+
return createIcon(Icons.record, 'record', attr);
|
|
1090
1091
|
},
|
|
1091
1092
|
recordCircle: function(attr) {
|
|
1092
1093
|
if (attr === void 0) attr = {};
|
|
1093
|
-
return createIcon(Icons
|
|
1094
|
+
return createIcon(Icons.recordCircle, 'record-circle', attr);
|
|
1094
1095
|
},
|
|
1095
1096
|
talk: function(attr) {
|
|
1096
1097
|
if (attr === void 0) attr = {};
|
|
1097
|
-
return createIcon(Icons
|
|
1098
|
+
return createIcon(Icons.talk, 'talk', attr);
|
|
1098
1099
|
},
|
|
1099
1100
|
talkGrowth: function(attr) {
|
|
1100
1101
|
if (attr === void 0) attr = {};
|
|
1101
|
-
return createIcon(Icons
|
|
1102
|
+
return createIcon(Icons.talkGrowth(PREFIX_CLASS), 'talk-growth', attr);
|
|
1102
1103
|
},
|
|
1103
1104
|
zoom: function(attr) {
|
|
1104
1105
|
if (attr === void 0) attr = {};
|
|
1105
|
-
return createIcon(Icons
|
|
1106
|
+
return createIcon(Icons.zoom, 'zoom', attr);
|
|
1106
1107
|
},
|
|
1107
1108
|
more: function(attr) {
|
|
1108
1109
|
if (attr === void 0) attr = {};
|
|
1109
|
-
return createIcon(Icons
|
|
1110
|
+
return createIcon(Icons.more, 'more', attr);
|
|
1110
1111
|
},
|
|
1111
1112
|
moreDot: function(attr) {
|
|
1112
1113
|
if (attr === void 0) attr = {};
|
|
1113
|
-
return createIcon(Icons
|
|
1114
|
+
return createIcon(Icons.moreDot, 'more-dot', attr);
|
|
1114
1115
|
},
|
|
1115
1116
|
minusCircle: function(attr) {
|
|
1116
1117
|
if (attr === void 0) attr = {};
|
|
1117
|
-
return createIcon(Icons
|
|
1118
|
+
return createIcon(Icons.minusCircle, 'minus-circle', attr);
|
|
1118
1119
|
},
|
|
1119
1120
|
plusCircle: function(attr) {
|
|
1120
1121
|
if (attr === void 0) attr = {};
|
|
1121
|
-
return createIcon(Icons
|
|
1122
|
+
return createIcon(Icons.plusCircle, 'plus-circle', attr);
|
|
1122
1123
|
},
|
|
1123
1124
|
sdk: function(attr) {
|
|
1124
1125
|
if (attr === void 0) attr = {};
|
|
1125
|
-
return createIcon(Icons
|
|
1126
|
+
return createIcon(Icons.sdk, 'sdk', attr);
|
|
1126
1127
|
},
|
|
1127
1128
|
cloudRec: function(attr) {
|
|
1128
1129
|
if (attr === void 0) attr = {};
|
|
1129
|
-
return createIcon(Icons
|
|
1130
|
+
return createIcon(Icons.cloudRec, 'cloud-rec', attr);
|
|
1130
1131
|
},
|
|
1131
1132
|
cloudRecord: function(attr) {
|
|
1132
1133
|
if (attr === void 0) attr = {};
|
|
1133
|
-
return createIcon(Icons
|
|
1134
|
+
return createIcon(Icons.cloudRecord, 'cloud-record', attr);
|
|
1134
1135
|
},
|
|
1135
1136
|
error: function(attr) {
|
|
1136
1137
|
if (attr === void 0) attr = {};
|
|
1137
|
-
return createIcon(Icons
|
|
1138
|
+
return createIcon(Icons.error, 'error', attr);
|
|
1138
1139
|
},
|
|
1139
1140
|
info: function(attr) {
|
|
1140
1141
|
if (attr === void 0) attr = {};
|
|
1141
|
-
return createIcon(Icons
|
|
1142
|
+
return createIcon(Icons.info, 'info', attr);
|
|
1142
1143
|
},
|
|
1143
1144
|
close: function(attr) {
|
|
1144
1145
|
if (attr === void 0) attr = {};
|
|
1145
|
-
return createIcon(Icons
|
|
1146
|
+
return createIcon(Icons.close, 'close', attr);
|
|
1146
1147
|
},
|
|
1147
1148
|
closeCircleOutLined: function(attr) {
|
|
1148
1149
|
if (attr === void 0) attr = {};
|
|
1149
|
-
return createIcon(Icons
|
|
1150
|
+
return createIcon(Icons.closeCircleOutLined, 'close-circle', attr);
|
|
1150
1151
|
},
|
|
1151
1152
|
warnCircleOutLined: function(attr) {
|
|
1152
1153
|
if (attr === void 0) attr = {};
|
|
1153
|
-
return createIcon(Icons
|
|
1154
|
+
return createIcon(Icons.warnCircleOutLined, 'warn-circle', attr);
|
|
1154
1155
|
},
|
|
1155
1156
|
infoCircleOutLined: function(attr) {
|
|
1156
1157
|
if (attr === void 0) attr = {};
|
|
1157
|
-
return createIcon(Icons
|
|
1158
|
+
return createIcon(Icons.infoCircleOutLined, 'info-circle', attr);
|
|
1158
1159
|
},
|
|
1159
1160
|
date: function(attr) {
|
|
1160
1161
|
if (attr === void 0) attr = {};
|
|
1161
|
-
return createIcon(Icons
|
|
1162
|
+
return createIcon(Icons.date, 'date', attr);
|
|
1162
1163
|
},
|
|
1163
1164
|
filter: function(attr) {
|
|
1164
1165
|
if (attr === void 0) attr = {};
|
|
1165
|
-
return createIcon(Icons
|
|
1166
|
+
return createIcon(Icons.filter, 'filter', attr);
|
|
1166
1167
|
},
|
|
1167
1168
|
add: function(attr) {
|
|
1168
1169
|
if (attr === void 0) attr = {};
|
|
1169
|
-
return createIcon(Icons
|
|
1170
|
+
return createIcon(Icons.add, 'add', attr);
|
|
1170
1171
|
},
|
|
1171
1172
|
reduce: function(attr) {
|
|
1172
1173
|
if (attr === void 0) attr = {};
|
|
1173
|
-
return createIcon(Icons
|
|
1174
|
+
return createIcon(Icons.reduce, 'reduce', attr);
|
|
1174
1175
|
}
|
|
1175
1176
|
};
|
|
1176
1177
|
|
|
@@ -1463,23 +1464,32 @@
|
|
|
1463
1464
|
}(Control);
|
|
1464
1465
|
|
|
1465
1466
|
/*
|
|
1466
|
-
* @skax/picker v1.0.
|
|
1467
|
-
* Copyright (c) 2025-10-
|
|
1467
|
+
* @skax/picker v1.0.3
|
|
1468
|
+
* Copyright (c) 2025-10-28 ShineShao <xiaoshaoqq@gmail.com>
|
|
1468
1469
|
* Released under the MIT License.
|
|
1469
1470
|
*/
|
|
1470
|
-
/**
|
|
1471
|
-
* PickerProvider
|
|
1471
|
+
/**
|
|
1472
|
+
* PickerProvider 单例类
|
|
1472
1473
|
*/ class PickerProvider {
|
|
1473
|
-
|
|
1474
|
+
/**
|
|
1475
|
+
* 获取单例实例
|
|
1476
|
+
* @returns Picker 实例
|
|
1477
|
+
*/ static getInstance() {
|
|
1474
1478
|
if (!PickerProvider.instance) {
|
|
1475
1479
|
PickerProvider.instance = new PickerProvider();
|
|
1476
1480
|
}
|
|
1477
1481
|
return PickerProvider.instance;
|
|
1478
1482
|
}
|
|
1479
|
-
|
|
1483
|
+
/**
|
|
1484
|
+
* 添加picker
|
|
1485
|
+
* @param picker Picker 实例
|
|
1486
|
+
*/ add(picker) {
|
|
1480
1487
|
this.pickers.push(picker);
|
|
1481
1488
|
}
|
|
1482
|
-
|
|
1489
|
+
/**
|
|
1490
|
+
* 移除picker
|
|
1491
|
+
* @param picker Picker 实例
|
|
1492
|
+
*/ remove(picker) {
|
|
1483
1493
|
const index = this.pickers.indexOf(picker);
|
|
1484
1494
|
if (index > -1) {
|
|
1485
1495
|
this.pickers.splice(index, 1);
|
|
@@ -1487,7 +1497,10 @@
|
|
|
1487
1497
|
console.warn("Picker not found in the provider.");
|
|
1488
1498
|
}
|
|
1489
1499
|
}
|
|
1490
|
-
|
|
1500
|
+
/**
|
|
1501
|
+
* 关闭其他picker
|
|
1502
|
+
* @param e 事件
|
|
1503
|
+
*/ closeOther(e) {
|
|
1491
1504
|
for (const p of this.pickers){
|
|
1492
1505
|
var _p_$container_contains, _p_$container, _p_$wrapperContent_contains, _p_$wrapperContent;
|
|
1493
1506
|
if (p && !(e.target === p.$container || ((_p_$container = p.$container) == null ? void 0 : (_p_$container_contains = _p_$container.contains) == null ? void 0 : _p_$container_contains.call(_p_$container, e.target)) || e.target === p.$wrapperContent || ((_p_$wrapperContent = p.$wrapperContent) == null ? void 0 : (_p_$wrapperContent_contains = _p_$wrapperContent.contains) == null ? void 0 : _p_$wrapperContent_contains.call(_p_$wrapperContent, e.target)))) {
|
|
@@ -1504,6 +1517,11 @@
|
|
|
1504
1517
|
|
|
1505
1518
|
/**
|
|
1506
1519
|
* picker 位置
|
|
1520
|
+
*
|
|
1521
|
+
* | top | tl | tr | bottom | bl | br |
|
|
1522
|
+
* |:--------:|:---------:|:---------:|:----------:|:----------:|:----------:|
|
|
1523
|
+
* | 顶部中间 | 顶部左侧 | 顶部右侧 | 底部中间 | 底部左侧 | 底部右侧 |
|
|
1524
|
+
*
|
|
1507
1525
|
* @public
|
|
1508
1526
|
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1509
1527
|
const PICKER_PLACEMENT = [
|
|
@@ -1519,7 +1537,8 @@
|
|
|
1519
1537
|
*/ const PICKER_PREFIX_CLS = "epicker";
|
|
1520
1538
|
/**
|
|
1521
1539
|
* Picker 默认值
|
|
1522
|
-
*/
|
|
1540
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1541
|
+
const __PICKER_DEFAULT_OPTIONS__ = {
|
|
1523
1542
|
getPopupContainer: ()=>document.body,
|
|
1524
1543
|
wrapClassName: "",
|
|
1525
1544
|
open: false,
|
|
@@ -1560,6 +1579,10 @@
|
|
|
1560
1579
|
*/ class Picker {
|
|
1561
1580
|
/**
|
|
1562
1581
|
* picker 内容挂载节点
|
|
1582
|
+
* @example
|
|
1583
|
+
* ```ts
|
|
1584
|
+
* console.log(picker.$popupContainer); // 获取挂载节点
|
|
1585
|
+
* ```
|
|
1563
1586
|
*/ get $popupContainer() {
|
|
1564
1587
|
// prettier-ignore
|
|
1565
1588
|
if (typeof this._options.getPopupContainer === "function") {
|
|
@@ -1667,7 +1690,7 @@
|
|
|
1667
1690
|
this._disabled = disabled;
|
|
1668
1691
|
}
|
|
1669
1692
|
/**
|
|
1670
|
-
* 设置弹出位置
|
|
1693
|
+
* 设置弹出位置(移动端不生效)
|
|
1671
1694
|
* @param placement - 弹出位置
|
|
1672
1695
|
* @example
|
|
1673
1696
|
* ```ts
|
|
@@ -1733,22 +1756,22 @@
|
|
|
1733
1756
|
/**
|
|
1734
1757
|
* 移除html
|
|
1735
1758
|
*/ _removeHtml() {
|
|
1736
|
-
var
|
|
1737
|
-
|
|
1738
|
-
this.$wrapperContent.removeEventListener("click", this._onContentClick);
|
|
1759
|
+
var // eslint-disable-next-line @typescript-eslint/unbound-method
|
|
1760
|
+
_this_$wrapperContent, _this_$container_removeEventListener, _this_$container;
|
|
1761
|
+
(_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.removeEventListener("click", this._onContentClick);
|
|
1739
1762
|
(_this_$container = this.$container) == null ? void 0 : (_this_$container_removeEventListener = _this_$container.removeEventListener) == null ? void 0 : _this_$container_removeEventListener.call(_this_$container, "click", this._onContentClick);
|
|
1740
1763
|
if (this._options.trigger === "click") {
|
|
1741
1764
|
var _this_$container_removeEventListener1, _this_$container1;
|
|
1742
1765
|
(_this_$container1 = this.$container) == null ? void 0 : (_this_$container_removeEventListener1 = _this_$container1.removeEventListener) == null ? void 0 : _this_$container_removeEventListener1.call(_this_$container1, "click", this._onShow);
|
|
1743
1766
|
}
|
|
1744
1767
|
if (this._options.trigger === "hover") {
|
|
1745
|
-
var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4
|
|
1768
|
+
var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4, // prettier-ignore
|
|
1769
|
+
_this_$wrapperContent1, _this_$wrapperContent2;
|
|
1746
1770
|
(_this_$container2 = this.$container) == null ? void 0 : (_this_$container_removeEventListener2 = _this_$container2.removeEventListener) == null ? void 0 : _this_$container_removeEventListener2.call(_this_$container2, "mouseenter", this._onShow);
|
|
1747
1771
|
(_this_$container3 = this.$container) == null ? void 0 : (_this_$container_removeEventListener3 = _this_$container3.removeEventListener) == null ? void 0 : _this_$container_removeEventListener3.call(_this_$container3, "mouseover", this._onShow);
|
|
1748
1772
|
(_this_$container4 = this.$container) == null ? void 0 : (_this_$container_removeEventListener4 = _this_$container4.removeEventListener) == null ? void 0 : _this_$container_removeEventListener4.call(_this_$container4, "mouseleave", this._onHide);
|
|
1749
|
-
|
|
1750
|
-
this.$wrapperContent.removeEventListener("
|
|
1751
|
-
this.$wrapperContent.removeEventListener("mouseleave", this._onHide);
|
|
1773
|
+
(_this_$wrapperContent1 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent1.removeEventListener("mouseenter", this._onWrapperShow);
|
|
1774
|
+
(_this_$wrapperContent2 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent2.removeEventListener("mouseleave", this._onHide);
|
|
1752
1775
|
}
|
|
1753
1776
|
if (!this._options.isMobile) {
|
|
1754
1777
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
@@ -1761,13 +1784,22 @@
|
|
|
1761
1784
|
document.removeEventListener("click", this._onDocumentClick);
|
|
1762
1785
|
}
|
|
1763
1786
|
if (this._$mask) {
|
|
1764
|
-
var _this_$wrapperContent;
|
|
1765
1787
|
this._$mask.removeEventListener("click", this._onHide);
|
|
1766
|
-
|
|
1788
|
+
try {
|
|
1789
|
+
var _this_$wrapperContent3;
|
|
1790
|
+
(_this_$wrapperContent3 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent3.removeChild(this._$mask);
|
|
1791
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1792
|
+
this._$mask = null;
|
|
1793
|
+
} catch (error) {}
|
|
1767
1794
|
}
|
|
1768
1795
|
if (this._options.isMobile) document.body.classList.remove(`${PICKER_PREFIX_CLS}-body-noscroll`);
|
|
1769
|
-
|
|
1770
|
-
|
|
1796
|
+
try {
|
|
1797
|
+
var _this_$popupContainer;
|
|
1798
|
+
(_this_$popupContainer = this.$popupContainer) == null ? void 0 : _this_$popupContainer.removeChild(this.$wrapperContent);
|
|
1799
|
+
this.$wrapperContent.innerHTML = "";
|
|
1800
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1801
|
+
this.$wrapperContent = null;
|
|
1802
|
+
} catch (error) {}
|
|
1771
1803
|
}
|
|
1772
1804
|
/**
|
|
1773
1805
|
* 现实位置
|
|
@@ -1825,17 +1857,18 @@
|
|
|
1825
1857
|
right = containerRight;
|
|
1826
1858
|
break;
|
|
1827
1859
|
}
|
|
1828
|
-
this.$wrapperContent.style.cssText += `
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1860
|
+
if (this.$wrapperContent) this.$wrapperContent.style.cssText += `
|
|
1861
|
+
${right !== undefined ? `right: ${right + (((_this__options_offset3 = this._options.offset) == null ? void 0 : _this__options_offset3[0]) || 0)}px;` : ""}
|
|
1862
|
+
${left !== undefined ? `left: ${left + (((_this__options_offset4 = this._options.offset) == null ? void 0 : _this__options_offset4[0]) || 0)}px;` : ""}
|
|
1863
|
+
top: ${bottom + (((_this__options_offset5 = this._options.offset) == null ? void 0 : _this__options_offset5[1]) || 0)}px;
|
|
1864
|
+
z-index:${this._options.zIndex};
|
|
1865
|
+
`;
|
|
1834
1866
|
}
|
|
1835
1867
|
}
|
|
1836
1868
|
/**
|
|
1837
1869
|
* 初始化内容样式
|
|
1838
1870
|
*/ _initContentStyle() {
|
|
1871
|
+
if (!this.$wrapperContent) return;
|
|
1839
1872
|
// prettier-ignore
|
|
1840
1873
|
this.$wrapperContent.classList.add(`${PICKER_PREFIX_CLS}`, `${PICKER_PREFIX_CLS}-wrapper`, `${PICKER_PREFIX_CLS}-${this._options.placement}`);
|
|
1841
1874
|
// 提升优先级
|
|
@@ -1943,7 +1976,7 @@
|
|
|
1943
1976
|
this._disabled = false;
|
|
1944
1977
|
this._timer = null;
|
|
1945
1978
|
// prettier-ignore
|
|
1946
|
-
this._options = Object.assign({},
|
|
1979
|
+
this._options = Object.assign({}, __PICKER_DEFAULT_OPTIONS__, options || {});
|
|
1947
1980
|
// 移动端模式强制使用 click 触发
|
|
1948
1981
|
if (this._options.isMobile) {
|
|
1949
1982
|
this._options.trigger = "click";
|
|
@@ -1969,7 +2002,7 @@
|
|
|
1969
2002
|
* ```ts
|
|
1970
2003
|
* Picker.VERSION; // 输出版本号
|
|
1971
2004
|
* ```
|
|
1972
|
-
*/ Picker.VERSION = "1.0.
|
|
2005
|
+
*/ Picker.VERSION = "1.0.3";
|
|
1973
2006
|
|
|
1974
2007
|
/*
|
|
1975
2008
|
* delegate.js v3.2.0
|
|
@@ -3950,7 +3983,7 @@
|
|
|
3950
3983
|
*/
|
|
3951
3984
|
const LoggerStyle={info:"",log:"background: #4096ff; color: #FFF;",warn:"background: yellow; color: #FFF;",error:"background: red; color: #FFF;"};class LoggerCls{setOptions(options){var _this__options_level;this._options=Object.assign({},this._options,options),this._levelNum=this._matchLevel(null!=(_this__options_level=this._options.level)?_this__options_level:"INFO"),this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0);}_matchLevel(level){let logLevel=3;switch(level){case "INFO":logLevel=3;break;case "LOG":logLevel=2;break;case "WARN":logLevel=1;break;case "ERROR":logLevel=0;}return logLevel}_loggerFactory(type,bool){const fn=console[type];if(bool&&fn){const args0=this._options.name?`%c[${this._options.name}]%c %c[${type.toUpperCase()}]`:`%c[${type.toUpperCase()}]`,color=[this._options.name?"background: green;color: #fff":null,this._options.name?"":null,LoggerStyle[type]].filter((color=>null!=color));return fn.bind(console,args0,...color)}return LoggerCls.noop}getOptions(){return this._options}getVersion(){return "1.1.0"}constructor(){let options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._options={level:"INFO",showTime:false},this._levelNum=3,this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0),this.setOptions(options);}}function fillTen(num){return (num=+num)<10&&(num=`0${num}`),num+""}LoggerCls.noop=()=>{},LoggerCls.VERSION="1.1.0";const list=["info","log","warn","error"];function Logger(options){const logger=new LoggerCls(options);return new Proxy(logger,{get(target,prop){if(list.includes(prop)){var _target__options;if(null==(_target__options=target._options)?void 0:_target__options.showTime){const time=function(){const now=new Date(Date.now()),year=now.getFullYear(),month=now.getMonth()+1,day=now.getDate(),hour=now.getHours(),min=now.getMinutes(),sec=now.getSeconds(),ms=now.getMilliseconds();return `${year}/${fillTen(month)}/${fillTen(day)} ${fillTen(hour)}:${fillTen(min)}:${fillTen(sec)}:${ms}`}();return target[prop].bind(console,`[${time}]`)}return target[prop].bind(console)}return Reflect.get(target,prop)}})}
|
|
3952
3985
|
|
|
3953
|
-
var zh
|
|
3986
|
+
var zh = {
|
|
3954
3987
|
391001: '取流地址或端口非法',
|
|
3955
3988
|
395000: '服务内部异常,请稍后重试',
|
|
3956
3989
|
395400: '预览取流参数异常',
|
|
@@ -4220,7 +4253,7 @@
|
|
|
4220
4253
|
};
|
|
4221
4254
|
|
|
4222
4255
|
// 不要出现多层的的数据, 数据铺平
|
|
4223
|
-
var en
|
|
4256
|
+
var en = {
|
|
4224
4257
|
391001: 'Illegal streaming address or port',
|
|
4225
4258
|
395000: 'Internal service exception, please try again later',
|
|
4226
4259
|
395400: 'Preview streaming parameter exception',
|
|
@@ -5581,6 +5614,14 @@
|
|
|
5581
5614
|
theme.controls.timeLineControl.on(EVENTS.control.timeLineChange, function(date) {
|
|
5582
5615
|
theme.emit(EVENTS.control.timeLineChange, date);
|
|
5583
5616
|
});
|
|
5617
|
+
theme.controls.timeLineControl.on(EVENTS.control.timeLinePanelOpenChange, function(open) {
|
|
5618
|
+
var _theme_controls_dateControl;
|
|
5619
|
+
if ((_theme_controls_dateControl = theme.controls.dateControl) == null ? void 0 : _theme_controls_dateControl.dataPickerUtil) {
|
|
5620
|
+
var _theme_controls_dateControl_dataPickerUtil, _theme_controls_dateControl1;
|
|
5621
|
+
(_theme_controls_dateControl1 = theme.controls.dateControl) == null ? void 0 : (_theme_controls_dateControl_dataPickerUtil = _theme_controls_dateControl1.dataPickerUtil) == null ? void 0 : _theme_controls_dateControl_dataPickerUtil.hide();
|
|
5622
|
+
}
|
|
5623
|
+
theme.emit(EVENTS.control.timeLinePanelOpenChange, open);
|
|
5624
|
+
});
|
|
5584
5625
|
theme.controls.timeLineControl.on(EVENTS.control.timeLineDestroy, function() {
|
|
5585
5626
|
theme.emit(EVENTS.control.timeLineDestroy);
|
|
5586
5627
|
});
|
|
@@ -9681,7 +9722,7 @@
|
|
|
9681
9722
|
};
|
|
9682
9723
|
/**
|
|
9683
9724
|
* 日期选择器
|
|
9684
|
-
*/
|
|
9725
|
+
*/ class DatePicker {
|
|
9685
9726
|
_init() {
|
|
9686
9727
|
// 因为挂载在行内,需要父标签设置 position: relative;
|
|
9687
9728
|
this.$container.style.cssText += `;position: relative;`;
|
|
@@ -9809,7 +9850,7 @@
|
|
|
9809
9850
|
}
|
|
9810
9851
|
});
|
|
9811
9852
|
}
|
|
9812
|
-
}
|
|
9853
|
+
}
|
|
9813
9854
|
|
|
9814
9855
|
/**
|
|
9815
9856
|
* @description 时间操作
|
|
@@ -9995,9 +10036,9 @@
|
|
|
9995
10036
|
/**
|
|
9996
10037
|
* 日历选择器控件
|
|
9997
10038
|
* @category Control
|
|
9998
|
-
*/ var
|
|
9999
|
-
_inherits$6(
|
|
10000
|
-
function
|
|
10039
|
+
*/ var DatePickerControl = /*#__PURE__*/ function(Control) {
|
|
10040
|
+
_inherits$6(DatePickerControl, Control);
|
|
10041
|
+
function DatePickerControl(options) {
|
|
10001
10042
|
var _this;
|
|
10002
10043
|
var _this_options_props_urlInfo_searchParams, _this_options_props_urlInfo, _this_options_props;
|
|
10003
10044
|
_this = Control.call(this, _extends$6({}, options, {
|
|
@@ -10010,7 +10051,7 @@
|
|
|
10010
10051
|
_this._render();
|
|
10011
10052
|
return _this;
|
|
10012
10053
|
}
|
|
10013
|
-
var _proto =
|
|
10054
|
+
var _proto = DatePickerControl.prototype;
|
|
10014
10055
|
_proto._render = function _render() {
|
|
10015
10056
|
var _this = this;
|
|
10016
10057
|
if (isMobile$1()) {
|
|
@@ -10022,7 +10063,7 @@
|
|
|
10022
10063
|
title: (_this_locale1 = this.locale) == null ? void 0 : _this_locale1.BTN_CALENDAR
|
|
10023
10064
|
});
|
|
10024
10065
|
}
|
|
10025
|
-
this.dataPickerUtil = new DatePicker
|
|
10066
|
+
this.dataPickerUtil = new DatePicker(this.$container, {
|
|
10026
10067
|
staticPath: this.options.staticPath,
|
|
10027
10068
|
language: this.options.language === 'zh' ? 'zh-CN' : 'en-US',
|
|
10028
10069
|
current: new Date(this._value + ' 00:00:00'),
|
|
@@ -10082,15 +10123,407 @@
|
|
|
10082
10123
|
*/ _proto._onControlClick = function _onControlClick(e) {
|
|
10083
10124
|
Control.prototype._onControlClick.call(this, e);
|
|
10084
10125
|
};
|
|
10085
|
-
return
|
|
10126
|
+
return DatePickerControl;
|
|
10086
10127
|
}(Control);
|
|
10087
10128
|
|
|
10129
|
+
/**
|
|
10130
|
+
* drag scroll support move and touch
|
|
10131
|
+
*
|
|
10132
|
+
* @skax/drag-scroll v1.0.0
|
|
10133
|
+
* Copyright (c) 2025-11-03 ShineShao <xiaoshaoqq@gmail.com>
|
|
10134
|
+
*
|
|
10135
|
+
* This source code is licensed under the MIT license found in the
|
|
10136
|
+
* LICENSE file in the root directory of this source tree.
|
|
10137
|
+
*/
|
|
10138
|
+
/**
|
|
10139
|
+
* 拖拽滚动状态
|
|
10140
|
+
*/ /**
|
|
10141
|
+
* 默认参数
|
|
10142
|
+
*/ const _$DRAG_SCROLL_DEFAULT_OPTIONS$_ = {
|
|
10143
|
+
content: '',
|
|
10144
|
+
height: '400px',
|
|
10145
|
+
readonly: false,
|
|
10146
|
+
hideScrollbar: false
|
|
10147
|
+
};
|
|
10148
|
+
/**
|
|
10149
|
+
* 前缀类名
|
|
10150
|
+
*/ const _$DRAG_SCROLL_PREFIX_CLASSNAME$_ = 'drag-scroll';
|
|
10151
|
+
/**
|
|
10152
|
+
* 拖拽滚动(使用 PointerEvent 统一处理鼠标和触摸事件)
|
|
10153
|
+
* @class DragScroll
|
|
10154
|
+
* @example
|
|
10155
|
+
* ```ts
|
|
10156
|
+
* const container = document.getElementById('scrollContainer');
|
|
10157
|
+
* const dragScroll = new DragScroll(container, {
|
|
10158
|
+
* width: '300px',
|
|
10159
|
+
* height: '500px',
|
|
10160
|
+
* content: '<div>...</div>',
|
|
10161
|
+
* });
|
|
10162
|
+
* ```
|
|
10163
|
+
*/ class DragScroll {
|
|
10164
|
+
/**
|
|
10165
|
+
* 获取容器宽度
|
|
10166
|
+
* @example
|
|
10167
|
+
* ```ts
|
|
10168
|
+
* const width = dragScroll.width;
|
|
10169
|
+
* ```
|
|
10170
|
+
* @return {number}
|
|
10171
|
+
*/ get width() {
|
|
10172
|
+
return this.$container.clientWidth;
|
|
10173
|
+
}
|
|
10174
|
+
/**
|
|
10175
|
+
* 获取容器高度
|
|
10176
|
+
* @example
|
|
10177
|
+
* ```ts
|
|
10178
|
+
* const height = dragScroll.height;
|
|
10179
|
+
* ```
|
|
10180
|
+
* @return {number}
|
|
10181
|
+
*/ get height() {
|
|
10182
|
+
return this.$container.clientHeight;
|
|
10183
|
+
}
|
|
10184
|
+
/**
|
|
10185
|
+
* 只读属性
|
|
10186
|
+
*/ get readonly() {
|
|
10187
|
+
return this._readonly;
|
|
10188
|
+
}
|
|
10189
|
+
set readonly(value) {
|
|
10190
|
+
if (this._readonly !== value) {
|
|
10191
|
+
this.$container.style.cursor = value ? 'not-allowed' : 'grab';
|
|
10192
|
+
this._readonly = value;
|
|
10193
|
+
}
|
|
10194
|
+
this.$container.removeEventListener('touchmove', this._onTouchMove);
|
|
10195
|
+
if (!value) {
|
|
10196
|
+
// 当非只读时,添加 touchmove 事件监听, 阻止透传到body默认滚动行为
|
|
10197
|
+
this.$container.addEventListener('touchmove', this._onTouchMove, {
|
|
10198
|
+
passive: false
|
|
10199
|
+
}); //
|
|
10200
|
+
}
|
|
10201
|
+
}
|
|
10202
|
+
/**
|
|
10203
|
+
* 内容是否可滚动
|
|
10204
|
+
*/ get canDrag() {
|
|
10205
|
+
const clientHeight = this.$content.clientHeight;
|
|
10206
|
+
return !this.readonly && clientHeight > this.$container.clientHeight;
|
|
10207
|
+
}
|
|
10208
|
+
/**
|
|
10209
|
+
* 设置容器尺寸
|
|
10210
|
+
* @param width 容器宽度
|
|
10211
|
+
* @param height 容器高度
|
|
10212
|
+
* @example
|
|
10213
|
+
* ```ts
|
|
10214
|
+
* dragScroll.resize(500, '400px');
|
|
10215
|
+
* dragScroll.resize('80%', '600px');
|
|
10216
|
+
* ```
|
|
10217
|
+
*/ resize(width, height) {
|
|
10218
|
+
let css = ``;
|
|
10219
|
+
if (/^\d+(\.\d+)?$/.test(width + '')) {
|
|
10220
|
+
css = `width: ${width}px;`;
|
|
10221
|
+
} else if (typeof width === 'string') {
|
|
10222
|
+
css = `width: ${width};`;
|
|
10223
|
+
}
|
|
10224
|
+
if (/^\d+(\.\d+)?$/.test(height + '')) {
|
|
10225
|
+
css += `height: ${height}px;`;
|
|
10226
|
+
} else if (typeof height === 'string') {
|
|
10227
|
+
css += `height: ${height};`;
|
|
10228
|
+
}
|
|
10229
|
+
this.$container.style.cssText += css;
|
|
10230
|
+
this._applyTransform();
|
|
10231
|
+
}
|
|
10232
|
+
/**
|
|
10233
|
+
* 设置 HTML 内容
|
|
10234
|
+
* @param html HTML 字符串或返回 HTML 字符串的函数
|
|
10235
|
+
* @example
|
|
10236
|
+
* ```ts
|
|
10237
|
+
* dragScroll.innerHtml('<div>New Content</div>');
|
|
10238
|
+
* dragScroll.innerHtml(() => '<div>Dynamic Content</div>');
|
|
10239
|
+
* ```
|
|
10240
|
+
*/ innerHtml(html) {
|
|
10241
|
+
this.$content.innerHTML = typeof html === 'function' ? html() : html;
|
|
10242
|
+
this._applyTransform();
|
|
10243
|
+
}
|
|
10244
|
+
/**
|
|
10245
|
+
* Y轴滚动到指定位置
|
|
10246
|
+
* @param y Y轴平移值 (需正值不支持负值)
|
|
10247
|
+
* @example
|
|
10248
|
+
* ```ts
|
|
10249
|
+
* dragScroll.scrollToY(200);
|
|
10250
|
+
* dragScroll.scrollToY(0); // 平移到顶部
|
|
10251
|
+
* dragScroll.scrollToY(-2); // 无效
|
|
10252
|
+
* ```
|
|
10253
|
+
*/ scrollToY(y, triggerChange = true) {
|
|
10254
|
+
const maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
|
|
10255
|
+
// 边界检查
|
|
10256
|
+
if (y < 0 || y > maxScroll) return;
|
|
10257
|
+
this.currentY = y;
|
|
10258
|
+
this.velocity = 0;
|
|
10259
|
+
this._applyTransform();
|
|
10260
|
+
if (triggerChange) this._updateState();
|
|
10261
|
+
}
|
|
10262
|
+
/**
|
|
10263
|
+
* 销毁方法,用于清理资源
|
|
10264
|
+
* @example
|
|
10265
|
+
* ```ts
|
|
10266
|
+
* dragScroll.destroy();
|
|
10267
|
+
* dragScroll = null;
|
|
10268
|
+
* ```
|
|
10269
|
+
*/ destroy() {
|
|
10270
|
+
var _this__$scrollbarThumb, _this__$scrollbar, _this_$content;
|
|
10271
|
+
if (this._animationId) {
|
|
10272
|
+
cancelAnimationFrame(this._animationId);
|
|
10273
|
+
this._animationId = null;
|
|
10274
|
+
}
|
|
10275
|
+
if (this._indicatorTimeout) {
|
|
10276
|
+
clearTimeout(this._indicatorTimeout);
|
|
10277
|
+
this._indicatorTimeout = null;
|
|
10278
|
+
}
|
|
10279
|
+
(_this__$scrollbarThumb = this._$scrollbarThumb) == null ? void 0 : _this__$scrollbarThumb.remove();
|
|
10280
|
+
this._$scrollbarThumb = null;
|
|
10281
|
+
(_this__$scrollbar = this._$scrollbar) == null ? void 0 : _this__$scrollbar.remove();
|
|
10282
|
+
this._$scrollbar = null;
|
|
10283
|
+
(_this_$content = this.$content) == null ? void 0 : _this_$content.remove();
|
|
10284
|
+
this.$content = null;
|
|
10285
|
+
this._removeEventListeners();
|
|
10286
|
+
}
|
|
10287
|
+
// ---------------------------------------------------------------------- //
|
|
10288
|
+
// 私有方法
|
|
10289
|
+
// ---------------------------------------------------------------------- //
|
|
10290
|
+
_renderScrollbar() {
|
|
10291
|
+
this._$scrollbar = document.createElement('div');
|
|
10292
|
+
this._$scrollbar.className = `${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-scrollbar`;
|
|
10293
|
+
this._$scrollbarThumb = document.createElement('div');
|
|
10294
|
+
this._$scrollbarThumb.className = `${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-scrollbar-thumb`;
|
|
10295
|
+
this._$scrollbar.appendChild(this._$scrollbarThumb);
|
|
10296
|
+
this.$container.appendChild(this._$scrollbar);
|
|
10297
|
+
}
|
|
10298
|
+
// 初始化
|
|
10299
|
+
_init() {
|
|
10300
|
+
this.resize(this.options.width, this.options.height);
|
|
10301
|
+
this._addEventListeners();
|
|
10302
|
+
// 初始化滚动条
|
|
10303
|
+
this._updateScrollbar();
|
|
10304
|
+
// 初始化动画
|
|
10305
|
+
this._animate();
|
|
10306
|
+
}
|
|
10307
|
+
// ----------- 事件处理 ----------- //
|
|
10308
|
+
/**
|
|
10309
|
+
* 添加事件监听器
|
|
10310
|
+
*/ _addEventListeners() {
|
|
10311
|
+
// 添加事件监听器
|
|
10312
|
+
this.$container.addEventListener('pointerdown', this._onMouseDown);
|
|
10313
|
+
document.addEventListener('pointermove', this._onMouseMove);
|
|
10314
|
+
// 务必同时监听 pointerup 和 pointercancel,都要做收尾和状态清理,否则会出现“拖动卡死”问题
|
|
10315
|
+
document.addEventListener('pointerup', this._onMouseUp); // 指针正常抬起时
|
|
10316
|
+
document.addEventListener('pointercancel', this._onMouseUp); // 指针操作被系统/外部原因打断时
|
|
10317
|
+
}
|
|
10318
|
+
/**
|
|
10319
|
+
* 移除事件监听器
|
|
10320
|
+
*/ _removeEventListeners() {
|
|
10321
|
+
this.$container.removeEventListener('touchmove', this._onTouchMove);
|
|
10322
|
+
// 移除事件监听器
|
|
10323
|
+
this.$container.removeEventListener('pointerdown', this._onMouseDown);
|
|
10324
|
+
document.removeEventListener('pointermove', this._onMouseMove);
|
|
10325
|
+
document.removeEventListener('pointerup', this._onMouseUp);
|
|
10326
|
+
document.removeEventListener('pointercancel', this._onMouseUp);
|
|
10327
|
+
}
|
|
10328
|
+
/**
|
|
10329
|
+
* 鼠标按下
|
|
10330
|
+
* @param e 鼠标事件
|
|
10331
|
+
*/ _onMouseDown(e) {
|
|
10332
|
+
if (!this.canDrag) return;
|
|
10333
|
+
this._startDrag(e.clientY);
|
|
10334
|
+
this.options.onDragStart == null ? void 0 : this.options.onDragStart.call(this.options, e);
|
|
10335
|
+
}
|
|
10336
|
+
/**
|
|
10337
|
+
* 触摸移动
|
|
10338
|
+
* @param e 触摸移动事件
|
|
10339
|
+
*/ _onTouchMove(e) {
|
|
10340
|
+
e.preventDefault();
|
|
10341
|
+
}
|
|
10342
|
+
/**
|
|
10343
|
+
* 开始拖拽
|
|
10344
|
+
* @param clientY 鼠标或触摸的 Y 坐标
|
|
10345
|
+
*/ _startDrag(clientY) {
|
|
10346
|
+
var _this__$scrollbar_classList, _this__$scrollbar;
|
|
10347
|
+
if (!this.canDrag) return;
|
|
10348
|
+
this.isDragging = true;
|
|
10349
|
+
this._startY = clientY;
|
|
10350
|
+
this.velocity = 0;
|
|
10351
|
+
(_this__$scrollbar = this._$scrollbar) == null ? void 0 : (_this__$scrollbar_classList = _this__$scrollbar.classList) == null ? void 0 : _this__$scrollbar_classList.add(`${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-show`);
|
|
10352
|
+
// 更新光标样式
|
|
10353
|
+
this.$container.style.cursor = 'grabbing';
|
|
10354
|
+
}
|
|
10355
|
+
/**
|
|
10356
|
+
* 鼠标移动
|
|
10357
|
+
* @param e 鼠标事件
|
|
10358
|
+
*/ _onMouseMove(e) {
|
|
10359
|
+
// e.preventDefault();
|
|
10360
|
+
if (!this.canDrag) return;
|
|
10361
|
+
if (!this.isDragging) return;
|
|
10362
|
+
this._drag(e.clientY);
|
|
10363
|
+
this.options.onDragging == null ? void 0 : this.options.onDragging.call(this.options, 0, this.currentY);
|
|
10364
|
+
}
|
|
10365
|
+
/**
|
|
10366
|
+
* 拖动
|
|
10367
|
+
* @param clientY 鼠标或触摸的 Y 坐标
|
|
10368
|
+
*/ _drag(clientY) {
|
|
10369
|
+
if (!this.canDrag) return;
|
|
10370
|
+
const deltaY = this._startY - clientY;
|
|
10371
|
+
this._startY = clientY;
|
|
10372
|
+
// 更新位置
|
|
10373
|
+
this.currentY += deltaY;
|
|
10374
|
+
// 计算速度(用于惯性滚动)
|
|
10375
|
+
this.velocity = deltaY;
|
|
10376
|
+
// 限制速度
|
|
10377
|
+
this.velocity = Math.max(Math.min(this.velocity, this._maxVelocity), -this._maxVelocity);
|
|
10378
|
+
this._applyTransform();
|
|
10379
|
+
this._updateState();
|
|
10380
|
+
}
|
|
10381
|
+
/**
|
|
10382
|
+
* 鼠标释放
|
|
10383
|
+
*/ _onMouseUp(e) {
|
|
10384
|
+
if (!this.canDrag) return;
|
|
10385
|
+
if (!this.isDragging) return;
|
|
10386
|
+
this.isDragging = false; // 停止拖动, 放置在最后
|
|
10387
|
+
this._endDrag();
|
|
10388
|
+
this.options.onDragEnd == null ? void 0 : this.options.onDragEnd.call(this.options, e);
|
|
10389
|
+
}
|
|
10390
|
+
/**
|
|
10391
|
+
* 结束拖动
|
|
10392
|
+
*/ _endDrag() {
|
|
10393
|
+
// 恢复光标样式
|
|
10394
|
+
this.$container.style.cursor = 'grab';
|
|
10395
|
+
// 延迟隐藏滚动条
|
|
10396
|
+
setTimeout(()=>{
|
|
10397
|
+
var _this__$scrollbar;
|
|
10398
|
+
if (!this.isDragging) (_this__$scrollbar = this._$scrollbar) == null ? void 0 : _this__$scrollbar.classList.remove(`${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-show`);
|
|
10399
|
+
}, 1500);
|
|
10400
|
+
}
|
|
10401
|
+
/**
|
|
10402
|
+
* 平移内容
|
|
10403
|
+
*/ _applyTransform() {
|
|
10404
|
+
const clientHeight = this.$content.clientHeight;
|
|
10405
|
+
// 内容高度小于等于容器高度时,不进行滚动
|
|
10406
|
+
if (clientHeight <= this.$container.clientHeight) {
|
|
10407
|
+
this.$content.style.transform = `translate3d(0, 0, 0)`;
|
|
10408
|
+
return;
|
|
10409
|
+
}
|
|
10410
|
+
const maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
|
|
10411
|
+
// 边界检查与弹性效果
|
|
10412
|
+
if (this.currentY < 0) {
|
|
10413
|
+
// 超出顶部边界
|
|
10414
|
+
this.currentY = 0; // this.currentY * this._bounceDamping;
|
|
10415
|
+
this.velocity *= this._bounceDamping;
|
|
10416
|
+
} else if (this.currentY > maxScroll) {
|
|
10417
|
+
// 超出底部边界
|
|
10418
|
+
this.currentY = maxScroll; // maxScroll + (this.currentY - maxScroll) * this._bounceDamping;
|
|
10419
|
+
this.velocity *= this._bounceDamping;
|
|
10420
|
+
}
|
|
10421
|
+
// 应用 transform
|
|
10422
|
+
this.$content.style.transform = `translate3d(0, ${-this.currentY}px, 0)`;
|
|
10423
|
+
this._updateScrollbar();
|
|
10424
|
+
}
|
|
10425
|
+
/**
|
|
10426
|
+
* 动画
|
|
10427
|
+
* @param timestamp 时间戳
|
|
10428
|
+
*/ _animate(timestamp = 0) {
|
|
10429
|
+
const clientHeight = this.$content.clientHeight;
|
|
10430
|
+
// 内容高度小于等于容器高度时,不进行滚动
|
|
10431
|
+
if (clientHeight <= this.$container.clientHeight) {
|
|
10432
|
+
return;
|
|
10433
|
+
}
|
|
10434
|
+
if (!this._lastTimestamp) this._lastTimestamp = timestamp;
|
|
10435
|
+
const deltaTime = Math.min(timestamp - this._lastTimestamp, 100) / 16; // 限制最大时间增量
|
|
10436
|
+
this._lastTimestamp = timestamp;
|
|
10437
|
+
if (!this.isDragging) {
|
|
10438
|
+
// 惯性滚动
|
|
10439
|
+
this.velocity *= this._friction;
|
|
10440
|
+
this.currentY += this.velocity;
|
|
10441
|
+
// 弹性回弹
|
|
10442
|
+
const maxScroll = this.$content.scrollHeight - this.$container.clientHeight;
|
|
10443
|
+
if (this.currentY < 0) {
|
|
10444
|
+
// 顶部弹性
|
|
10445
|
+
this.velocity -= this.currentY * this._spring * deltaTime;
|
|
10446
|
+
} else if (this.currentY > maxScroll) {
|
|
10447
|
+
// 底部弹性
|
|
10448
|
+
this.velocity -= (this.currentY - maxScroll) * this._spring * deltaTime;
|
|
10449
|
+
}
|
|
10450
|
+
this._applyTransform();
|
|
10451
|
+
this._updateState();
|
|
10452
|
+
// 当速度足够小时停止动画
|
|
10453
|
+
if (Math.abs(this.velocity) < 0.1 && this.currentY >= 0 && this.currentY <= maxScroll) {
|
|
10454
|
+
this.velocity = 0;
|
|
10455
|
+
}
|
|
10456
|
+
}
|
|
10457
|
+
this._animationId = requestAnimationFrame(this._animate.bind(this));
|
|
10458
|
+
}
|
|
10459
|
+
/**
|
|
10460
|
+
* 更新滚动条
|
|
10461
|
+
*/ _updateScrollbar() {
|
|
10462
|
+
const containerHeight = this.$container.clientHeight;
|
|
10463
|
+
const contentHeight = this.$content.scrollHeight;
|
|
10464
|
+
const maxScroll = contentHeight - containerHeight;
|
|
10465
|
+
if (maxScroll <= 0) {
|
|
10466
|
+
if (this._$scrollbarThumb) this._$scrollbarThumb.style.height = '0';
|
|
10467
|
+
return;
|
|
10468
|
+
}
|
|
10469
|
+
// 计算滚动条高度和位置
|
|
10470
|
+
const thumbHeight = Math.max(containerHeight / contentHeight * containerHeight, 20);
|
|
10471
|
+
const thumbPosition = this.currentY / maxScroll * (containerHeight - thumbHeight);
|
|
10472
|
+
if (this._$scrollbarThumb) {
|
|
10473
|
+
this._$scrollbarThumb.style.height = `${thumbHeight}px`;
|
|
10474
|
+
this._$scrollbarThumb.style.transform = `translateY(${thumbPosition}px)`;
|
|
10475
|
+
}
|
|
10476
|
+
}
|
|
10477
|
+
/**
|
|
10478
|
+
* 更新统计信息
|
|
10479
|
+
*/ _updateState() {
|
|
10480
|
+
this.options.onChange == null ? void 0 : this.options.onChange.call(this.options, {
|
|
10481
|
+
x: 0,
|
|
10482
|
+
y: this.currentY,
|
|
10483
|
+
velocity: +this.velocity.toFixed(1)
|
|
10484
|
+
});
|
|
10485
|
+
}
|
|
10486
|
+
constructor(container, options = {}){
|
|
10487
|
+
this._indicatorTimeout = null;
|
|
10488
|
+
/** 滚动条元素 */ this._$scrollbar = null;
|
|
10489
|
+
/** 滚动条指示器元素 */ this._$scrollbarThumb = null;
|
|
10490
|
+
/** 是否只读 */ this._readonly = false;
|
|
10491
|
+
this.$container = container;
|
|
10492
|
+
this.options = Object.assign({}, _$DRAG_SCROLL_DEFAULT_OPTIONS$_, options);
|
|
10493
|
+
this.$container.classList.add(_$DRAG_SCROLL_PREFIX_CLASSNAME$_, `${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-container`);
|
|
10494
|
+
this.$content = document.createElement('div');
|
|
10495
|
+
this.$content.classList.add(`${_$DRAG_SCROLL_PREFIX_CLASSNAME$_}-content`);
|
|
10496
|
+
this.innerHtml(this.options.content);
|
|
10497
|
+
this.$container.appendChild(this.$content);
|
|
10498
|
+
this.isDragging = false;
|
|
10499
|
+
this._startY = 0;
|
|
10500
|
+
this.currentY = 0;
|
|
10501
|
+
this.velocity = 0;
|
|
10502
|
+
this._animationId = null;
|
|
10503
|
+
this._lastTimestamp = 0;
|
|
10504
|
+
// 物理参数
|
|
10505
|
+
this._spring = 0.25; // 弹性系数
|
|
10506
|
+
this._friction = 0.92; // 摩擦力
|
|
10507
|
+
this._bounceDamping = 0.6; // 边界反弹阻尼
|
|
10508
|
+
this._maxVelocity = 30; // 最大速度限制
|
|
10509
|
+
if (!this.options.hideScrollbar) {
|
|
10510
|
+
this._renderScrollbar();
|
|
10511
|
+
}
|
|
10512
|
+
this._onMouseDown = this._onMouseDown.bind(this);
|
|
10513
|
+
this._onTouchMove = this._onTouchMove.bind(this);
|
|
10514
|
+
this._onMouseMove = this._onMouseMove.bind(this);
|
|
10515
|
+
this._onMouseUp = this._onMouseUp.bind(this);
|
|
10516
|
+
this.readonly = this.options.readonly;
|
|
10517
|
+
this._init();
|
|
10518
|
+
}
|
|
10519
|
+
}
|
|
10520
|
+
|
|
10088
10521
|
/*
|
|
10089
|
-
* @ezuikit/control-time-line v1.0.0
|
|
10090
|
-
* Copyright (c) 2025-
|
|
10522
|
+
* @ezuikit/control-time-line v1.0.0
|
|
10523
|
+
* Copyright (c) 2025-11-03 Ezviz-OpenBiz
|
|
10091
10524
|
* Released under the MIT License.
|
|
10092
10525
|
*/
|
|
10093
|
-
var
|
|
10526
|
+
var _$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};const _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",
|
|
10094
10527
|
// --------------------只支持初始化时,不支持动态变更 (不做对象冻结)--------------------
|
|
10095
10528
|
timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",
|
|
10096
10529
|
onChange:()=>{},onDragStart:()=>{},onDragging:()=>{},onDragEnd:()=>{},onDestroy:()=>{}};
|
|
@@ -10109,7 +10542,7 @@
|
|
|
10109
10542
|
* 只读状态
|
|
10110
10543
|
*/get readOnly(){return this._readOnly}
|
|
10111
10544
|
/**
|
|
10112
|
-
*
|
|
10545
|
+
* 时间片段
|
|
10113
10546
|
*/get timeSections(){return this._timeSections}
|
|
10114
10547
|
/**
|
|
10115
10548
|
* 设置只读或取消只读, 推荐使用 timeLine.readOnly = false
|
|
@@ -10118,7 +10551,7 @@
|
|
|
10118
10551
|
*/setReadOnly(readOnly){this.readOnly=readOnly;}
|
|
10119
10552
|
/**
|
|
10120
10553
|
* 更新当前时间
|
|
10121
|
-
* @param
|
|
10554
|
+
* @param current 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
|
|
10122
10555
|
*/update(current){this._current=current;}
|
|
10123
10556
|
/**
|
|
10124
10557
|
* 更新时间片段
|
|
@@ -10146,9 +10579,10 @@
|
|
|
10146
10579
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10147
10580
|
this._current=null;this.options.onDestroy==null?void 0:this.options.onDestroy.call(this.options);this._timeSections=[];this._readOnly=false;this._destroyed=true;}constructor(container,options){this._current=new Date;
|
|
10148
10581
|
/** 只读 */this._readOnly=false;this._width=0;this._height=0;this._destroyed=false;this._timeWidth=0;
|
|
10149
|
-
/** 片段列表 */this._timeSections=[];this.$container=container;this.options=deepmerge(BASE_TIME_LINE_DEFAULT_OPTIONS,options,{clone:false});if(this.options.timeSections&&Array.isArray(this.options.timeSections))this._timeSections=this.options.timeSections;if(this.options.readOnly)this.readOnly=this.options.readOnly;if(this.options.className)this.$container.classList.add(this.options.className);if(this.options.current&&this.options.current instanceof Date)this._current=this.options.current||new Date;
|
|
10582
|
+
/** 片段列表 */this._timeSections=[];this.$container=container;this.options=deepmerge(_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false});if(this.options.timeSections&&Array.isArray(this.options.timeSections))this._timeSections=this.options.timeSections;if(this.options.readOnly)this.readOnly=this.options.readOnly;if(this.options.className)this.$container.classList.add(this.options.className);if(this.options.current&&this.options.current instanceof Date)this._current=this.options.current||new Date;
|
|
10150
10583
|
// prettier-ignore
|
|
10151
|
-
this.i18n=new I18n(deepmerge(
|
|
10584
|
+
this.i18n=new I18n(deepmerge(_$TIMELINE_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"});this._timeWidth=this.options.timeWidth||0;this._resize(this.options.width||"100%",this.options.height);}}
|
|
10585
|
+
/** 语言包 */BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;
|
|
10152
10586
|
/**
|
|
10153
10587
|
* 时间轴工具类
|
|
10154
10588
|
*/class TimeLineUtil{
|
|
@@ -10203,7 +10637,10 @@
|
|
|
10203
10637
|
* @param {number} b_start 另一个区间的开始
|
|
10204
10638
|
* @param {number} b_end 另一个区间的结束
|
|
10205
10639
|
* @returns {boolean}
|
|
10206
|
-
*/static isOverlap(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)}static tranTimeToString(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1;const secondNum=Math.floor(((_TimeLineUtil_toDate=TimeLineUtil.toDate(end))==null?void 0:_TimeLineUtil_toDate.getTime())-((_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))==null?void 0:_TimeLineUtil_toDate1.getTime()))/1e3;const second=secondNum%60;const minute=Math.floor(secondNum/60);return `${minute>0?TimeLineUtil.subTime(minute)+"'":""}${TimeLineUtil.subTime(second)}''`}}
|
|
10640
|
+
*/static isOverlap(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)}static tranTimeToString(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1;const secondNum=Math.floor(((_TimeLineUtil_toDate=TimeLineUtil.toDate(end))==null?void 0:_TimeLineUtil_toDate.getTime())-((_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))==null?void 0:_TimeLineUtil_toDate1.getTime()))/1e3;const second=secondNum%60;const minute=Math.floor(secondNum/60);return `${minute>0?TimeLineUtil.subTime(minute)+"'":"0'"}${TimeLineUtil.subTime(second)}''`}}
|
|
10641
|
+
/**
|
|
10642
|
+
* 时间轴图标集
|
|
10643
|
+
*/const _$TIMELINE_ICONS$_={tip:`<svg viewBox="0 0 57 24" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="tip">\n <path class="ez-time-line-icon-tip" fill-rule="evenodd" d="m4,0l44,0c2.2091,0 4,1.7909 4,4l0,3.8218l4.9399,3.3572c0.5839,0.3968 0.5839,1.2574 0,1.6542l-4.9399,3.3572l0,3.8096c0,2.2091 -1.7909,4 -4,4l-44,0c-2.2091,0 -4,-1.7909 -4,-4l0,-16c0,-2.2091 1.7909,-4 4,-4z"/>\n </svg>`,plus:`\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="plus">\n <path d="M0 0L10.6667 0" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5" transform="matrix(0,1,-1,0,8,2.66663)"/>\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n `,minus:`\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="minus">\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n `,close:`\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n `,pause:`<svg viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="pause">\n\t\t <path d="M9.43914 2.47881L13.4688 8.4912C14.3594 9.81998 13.4071 11.6047 11.8074 11.6047L3.74811 11.6047C2.14849 11.6047 1.19616 9.81998 2.08675 8.4912L6.11641 2.47881C6.90863 1.2968 8.64693 1.2968 9.43914 2.47881Z" fill-rule="evenodd" transform="matrix(0,1,-1,0,16.5781,2.22229)" />\n </svg>\n `,picture:`\n <svg viewBox="0 0 19.1613 19.4583" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="picture">\n <path xmlns="http://www.w3.org/2000/svg" id="形状结合" d="M15.3276 2.63477L3.83173 2.63477C2.70848 2.63477 1.79541 3.55027 1.79541 4.68419L1.79541 14.7737C1.79541 15.9076 2.70848 16.8231 3.83173 16.8231L15.3276 16.8231C16.4504 16.8231 17.364 15.9074 17.364 14.7737L17.364 4.68419C17.364 3.55027 16.4509 2.63477 15.3276 2.63477ZM3.83247 3.851L15.3284 3.851C15.7936 3.851 16.1671 4.22551 16.1671 4.68429L16.1671 14.7738C16.1671 15.2323 15.7932 15.6071 15.3284 15.6071L3.83247 15.6071C3.36725 15.6071 2.99373 15.2326 2.99373 14.7738L2.99373 12.2622L6.7356 9.56381L6.78139 9.53916C6.84532 9.51493 6.91856 9.52524 6.9742 9.56947L13.2644 14.5698L13.3381 14.62C13.5918 14.7666 13.9197 14.7063 14.105 14.4658C14.3089 14.2014 14.263 13.8192 14.0026 13.6122L7.71239 8.61184L7.60526 8.5346C7.12945 8.22451 6.51026 8.23473 6.04222 8.57224L2.99373 10.7706L2.99373 4.68429C2.99373 4.22551 3.36725 3.851 3.83247 3.851ZM10.5794 7.29679C10.5794 6.06542 11.5624 5.0672 12.7749 5.0672C13.9875 5.0672 14.9705 6.06542 14.9705 7.29679C14.9705 8.52817 13.9875 9.52639 12.7749 9.52639C11.5624 9.52639 10.5794 8.52817 10.5794 7.29679ZM13.7722 7.2967C13.7722 6.73699 13.3254 6.28325 12.7742 6.28325C12.223 6.28325 11.7762 6.73699 11.7762 7.2967C11.7762 7.85642 12.223 8.31015 12.7742 8.31015C13.3254 8.31015 13.7722 7.85642 13.7722 7.2967Z" fill-rule="evenodd"/>\n </svg>\n `};
|
|
10207
10644
|
/**
|
|
10208
10645
|
* 时间刻度宽度 [刻度间隔秒数s, 刻度间隔宽度px, 长刻度间隔短刻度个数, 说明]
|
|
10209
10646
|
* 需要满足 (24 * 60 * 60) % ([0] * [2]) = 0, 这样 0 点刻度才能正确显示
|
|
@@ -10223,23 +10660,16 @@
|
|
|
10223
10660
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable eqeqeq */ /* eslint-disable no-unneeded-ternary */ /* eslint-disable @typescript-eslint/no-this-alias */ /* eslint-disable @typescript-eslint/prefer-includes */function _extends$1$1(){_extends$1$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)if(Object.prototype.hasOwnProperty.call(source,key))target[key]=source[key];}return target};return _extends$1$1.apply(this,arguments)}
|
|
10224
10661
|
/**
|
|
10225
10662
|
* 时间轴样式类前缀
|
|
10226
|
-
*/const MOBILE_TIMELINE_PREFIX="ez-time-line";const MOBILE_TIME_LINE_DEFAULT_OPTIONS=Object.assign({},BASE_TIME_LINE_DEFAULT_OPTIONS,{height:400,width:"100%",timeWidth:0,readOnly:false,timePointColor:"#648FFC",timeTextColor:"#666666",timeScaleColor:"transparent",timeSectionColor:"#369FFF",timeAxisBgColor:"#BDCDFF",
|
|
10663
|
+
*/const _$MOBILE_TIMELINE_PREFIX$_="ez-time-line";const _$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_=Object.assign({},_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,{height:400,width:"100%",timeWidth:0,readOnly:false,timePointColor:"#648FFC",timeTextColor:"#666666",timeScaleColor:"transparent",timeSectionColor:"#369FFF",timeAxisBgColor:"#BDCDFF",
|
|
10227
10664
|
/** 当前时间背景颜色 */currentTimeBgColor:"#648FFC",
|
|
10228
|
-
/** 当前时间颜色 */currentTimeColor:"#FFFFFF",showTimeWidthBtn:true});
|
|
10229
|
-
|
|
10230
|
-
* 更新状态
|
|
10231
|
-
* @param obj
|
|
10232
|
-
*/
|
|
10233
|
-
setState(obj){
|
|
10234
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
10235
|
-
Object.keys(obj).forEach(key=>{this.state[key]=obj[key];if(key==="scrollTop"&&this._$itemList)
|
|
10236
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
10237
|
-
this._$itemContainer.scrollTo(0,obj[key]);if(key==="current"&&this._$currentTime&&obj[key]){var _this_timeSections_;this._$currentTime.querySelector(`.${MOBILE_TIMELINE_PREFIX}-current-value`).innerHTML=obj[key];console.log("current",obj[key]);this.current=new Date(TimeLineUtil.tranTime((_this_timeSections_=this.timeSections[0])==null?void 0:_this_timeSections_.endTime,"YYYY-MM-DD")+" "+obj[key]);}});}
|
|
10665
|
+
/** 当前时间颜色 */currentTimeColor:"#FFFFFF",showTimeWidthBtn:true});const _$DAY_TIME_SECOND$_=60*60*24;// 一天的秒数
|
|
10666
|
+
class MobileTimeLine extends BaseTimeLine{
|
|
10238
10667
|
/**
|
|
10239
10668
|
* 设置只读或取消只读
|
|
10240
10669
|
* @param readOnly - 只读或取消只读
|
|
10241
10670
|
* @returns
|
|
10242
|
-
*/
|
|
10671
|
+
*/
|
|
10672
|
+
setReadOnly(readOnly){super.setReadOnly(readOnly);if(this._dragScroll)this._dragScroll.readonly=readOnly;}
|
|
10243
10673
|
/**
|
|
10244
10674
|
* 改变时间轴刻度
|
|
10245
10675
|
* 0: 1分钟,
|
|
@@ -10257,15 +10687,21 @@
|
|
|
10257
10687
|
* @param timeSections
|
|
10258
10688
|
* @param defaultIndex
|
|
10259
10689
|
*/updateTimeSections(timeSections,defaultIndex){super.updateTimeSections(timeSections);const list=timeSections.map(record=>_extends$1$1({},record,{startTime:TimeLineUtil.formatDateToHHmmss(record.startTime),endTime:TimeLineUtil.formatDateToHHmmss(record.endTime)}));if(list.length>0){if(typeof defaultIndex==="undefined")defaultIndex=list.length-1;// 默认选中最后一个片段位置
|
|
10260
|
-
// 若current不为
|
|
10261
|
-
const{current:current}=this.state;this.
|
|
10690
|
+
// 若current不为 null,则不重置current,避免拖动后时间轴回弹
|
|
10691
|
+
const{current:current}=this.state;this._setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:current===null?list[defaultIndex].startTime:current});this._matchTimeDot();}else {this._setState({availTimeLine:[]});this._matchTimeDot();}}
|
|
10262
10692
|
/**
|
|
10263
10693
|
* 更新当前时间
|
|
10264
10694
|
* @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
|
|
10265
|
-
*/update(time){if(time&&!this.
|
|
10695
|
+
*/update(time){var _this__dragScroll;if(time&&!((_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.isDragging)){this._setState({current:TimeLineUtil.tranTime(time,"HH:mm:ss")});this._currentOffsetH();}}
|
|
10266
10696
|
/**
|
|
10267
10697
|
* 销毁
|
|
10268
|
-
*/destroy(){if(this._scrollTimer){clearInterval(this._scrollTimer);this._scrollTimer=null;}if(this._$currentTime){this.$container.removeChild(this._$currentTime);this._$currentTime=null;}if(this._$itemContainer&&this._$itemList){this._$itemContainer.removeChild(this._$itemList);this._$itemList=null;}if(this._$itemContainer){this.$container.removeChild(this._$itemContainer);this._$itemContainer=null;}if(this._$op){this.$container.removeChild(this._$op);this._$op=null;}if(this._picker){this._picker.destroy();this._picker=null;}this._removeEventListener();super.destroy();}
|
|
10698
|
+
*/destroy(){var _this__dragScroll;if(this._scrollTimer){clearInterval(this._scrollTimer);this._scrollTimer=null;}if(this._$currentTime)try{this.$container.removeChild(this._$currentTime);this._$currentTime=null;}catch(error){}if(this._$itemList)this._imageRemoveErrorEvent(this._$itemList.querySelectorAll(`img.${_$MOBILE_TIMELINE_PREFIX$_}-img`)||[]);if(this._$itemContainer&&this._$itemList)try{this._$itemContainer.removeChild(this._$itemList);this._$itemList=null;}catch(error){}if(this._$itemContainer)try{this.$container.removeChild(this._$itemContainer);this._$itemContainer=null;}catch(error){}if(this._$op)try{this.$container.removeChild(this._$op);this._$op=null;}catch(error){}if(this._picker){var _this__picker_$body_querySelectorAll,_this__picker_$body;this._imageRemoveErrorEvent(((_this__picker_$body=this._picker.$body)==null?void 0:(_this__picker_$body_querySelectorAll=_this__picker_$body.querySelectorAll)==null?void 0:_this__picker_$body_querySelectorAll.call(_this__picker_$body,"img"))||[]);this._picker.destroy();this._picker=null;}this._removeEventListener();(_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.destroy();this._dragScroll=null;super.destroy();}
|
|
10699
|
+
/**
|
|
10700
|
+
* 更新状态
|
|
10701
|
+
* @param obj
|
|
10702
|
+
*/_setState(obj){
|
|
10703
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
10704
|
+
Object.keys(obj).forEach(key=>{if(key==="current"&&obj[key]){var _this__dragScroll;this._setCurrentDOM(obj[key]);if(this.state.current!==obj[key]&&!((_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.isDragging)){var _this_timeSections_;this.state[key]=obj[key];this.current=new Date(TimeLineUtil.tranTime((_this_timeSections_=this.timeSections[0])==null?void 0:_this_timeSections_.endTime,"YYYY-MM-DD")+" "+obj[key]);this.options.onChange==null?void 0:this.options.onChange.call(this.options,this.current);}}else this.state[key]=obj[key];});}_setCurrentDOM(time){if(this._$currentTime)this._$currentTime.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-current-value`).innerHTML=time;}
|
|
10269
10705
|
/**
|
|
10270
10706
|
* 渲染时间轴刻度数组
|
|
10271
10707
|
*/_matchTimeDot(){const scaleWidth=this._scaleWidth;// 时间单位 分钟
|
|
@@ -10273,79 +10709,66 @@
|
|
|
10273
10709
|
// 时间转分钟
|
|
10274
10710
|
let minute=TimeLineUtil.timeToMinute("24:00:00");minute=Math.floor(minute/scaleWidth)*scaleWidth;for(let i=minute;i>=0;){let marginTop=0;let marginBottom=0;
|
|
10275
10711
|
// 视频片段
|
|
10276
|
-
if(i==minute)marginTop=70;if(i==0)marginBottom=this.$container.clientHeight-70;const time=TimeLineUtil.minuteToTime(i);
|
|
10712
|
+
if(i==minute)marginTop=70;if(i==0)marginBottom=this.$container.clientHeight-70;const time=TimeLineUtil.minuteToTime(i);timeArr.push({id:i,current:time,label:"a"+i,marginTop:marginTop,marginBottom:marginBottom,recArr:[],coverArr:this._filterTimeSectionsByTime(time)});i-=scaleWidth;}this._setState({timeArr:timeArr});this._matchRecTimeDot();}_matchRecTimeDot(){const{availTimeLine:availTimeLine,timeArr:timeArr}=this.state;const scaleWidth=this._scaleWidth;const len=availTimeLine.length;if(len===0)for(let j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(let k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(let i=0;i<len;i++){const temp=availTimeLine[i];const st=TimeLineUtil.timeToSecond(temp.startTime);// "00:01:00" -> 60 // 秒
|
|
10277
10713
|
const et=TimeLineUtil.timeToSecond(temp.endTime);let stAvailPercent=0;let etAvailPercent=0;const stMinute=Math.floor(st/(scaleWidth*60))*scaleWidth;stAvailPercent=(st-stMinute*60)/scaleWidth;const etMinute=Math.floor(et/(scaleWidth*60))*scaleWidth;etAvailPercent=(et-etMinute*60)/scaleWidth;for(let j=0;j<timeArr.length;j++)if(timeArr[j].id==stMinute&&timeArr[j].id==etMinute){const height=etAvailPercent-stAvailPercent;const top=60-etAvailPercent;
|
|
10278
10714
|
// prettier-ignore
|
|
10279
|
-
timeArr[j].recArr.push({height:height,top:top});}else if(timeArr[j].id==stMinute)timeArr[j].recArr.push({height:60-stAvailPercent,top:0});else if(timeArr[j].id==etMinute)timeArr[j].recArr.push({height:etAvailPercent,top:60-etAvailPercent});else if(timeArr[j].id>stMinute&&timeArr[j].id<etMinute)timeArr[j].recArr.push({height:60,top:0});}}this.
|
|
10715
|
+
timeArr[j].recArr.push({height:height,top:top});}else if(timeArr[j].id==stMinute)timeArr[j].recArr.push({height:60-stAvailPercent,top:0});else if(timeArr[j].id==etMinute)timeArr[j].recArr.push({height:etAvailPercent,top:60-etAvailPercent});else if(timeArr[j].id>stMinute&&timeArr[j].id<etMinute)timeArr[j].recArr.push({height:60,top:0});}}this._setState({timeArr:timeArr});this._renderDateLine();}_renderDateLine(){const{timeArr:timeArr}=this.state;const container=this._$itemList;
|
|
10716
|
+
// 清理上一次的error 事件
|
|
10717
|
+
this._imageRemoveErrorEvent(container.querySelectorAll(`img.${_$MOBILE_TIMELINE_PREFIX$_}-img`)||[]);container.innerHTML="";timeArr.forEach((item,index)=>{const timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class",_$MOBILE_TIMELINE_PREFIX$_+"-time-scale-area");if(item.marginTop)timeItemDOM.style.cssText+=`margin-top: ${item.marginTop}px;`;if(item.marginBottom)timeItemDOM.style.cssText+=`margin-bottom: ${item.marginBottom}px;`;timeItemDOM.style.cssText+=`border-right-color: ${this.options.timeAxisBgColor||"rgba(189, 205, 255, 1)"};`;timeItemDOM.setAttribute("data-time",item.current);timeItemDOM.setAttribute("data-index",index+"");const scaleDOM=document.createElement("div");scaleDOM.setAttribute("class",_$MOBILE_TIMELINE_PREFIX$_+"-scale");let timeItemHtml=``;if(item.coverArr.length)timeItemHtml+=`\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold ${item.coverArr.length>1?`${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-multiple`:""}"\n data-start="${item.current}">\n ${item.coverArr.length>1?`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-cover-fold-placeholder" style="color: #FFF"></div>`:""}\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-img">\n <img src="${this._setImageScr(item.coverArr[0].coverPic)}" class="${_$MOBILE_TIMELINE_PREFIX$_}-img"/>\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-len">\n ${item.coverArr.length>1?this.i18n.t("foldTitle",{len:item.coverArr.length,unit:"videos"}):`${TimeLineUtil.tranTime(item.coverArr[0].startTime,"HH:mm")}`}\n </span>\n ${item.coverArr.length===1?`<span class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-time">${TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)}</span>`:""}\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold-pause">${_$TIMELINE_ICONS$_.pause}</span>\n </div>\n </div>`;
|
|
10280
10718
|
// 六个详细刻度
|
|
10281
|
-
// <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
|
|
10282
|
-
// <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
|
|
10283
|
-
// <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
|
|
10284
|
-
// <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
|
|
10285
|
-
// <div class="${MOBILE_TIMELINE_PREFIX}-time-scale"></div>
|
|
10286
|
-
// <div class="${MOBILE_TIMELINE_PREFIX}-time-scale" style="width:10px"></div>
|
|
10287
|
-
item.recArr.forEach(i=>{timeItemHtml+=`<div class="${MOBILE_TIMELINE_PREFIX}-time-unavail"\n style="height: ${i.height}px;background-color:${this.options.timeSectionColor||"#369FFF"}; top: ${i.top}px">\n </div>`;});timeItemHtml+=`<div id=${item.label} class="${MOBILE_TIMELINE_PREFIX}-time-label" style="color: ${this.options.timeTextColor||"#666"}">${item.current}</div>`;timeItemDOM.innerHTML=timeItemHtml;container.appendChild(timeItemDOM);});}
|
|
10288
|
-
|
|
10289
|
-
const startSecond=TimeLineUtil.timeToSecond(current===0?start:current);const offsetS=currentTime-startSecond;const offsetH=Math.ceil(offsetS/scaleWidth)+60;// offsetS / (scaleWidth * 60) * 60
|
|
10290
|
-
this.setState({scrollTop:offsetH});console.log("起始偏移量",offsetH);}_currentOffsetH(){const{current:current,timeArr:timeArr}=this.state;const scale=this._scaleWidth;const startItem=timeArr[0].current;const startSecond=TimeLineUtil.timeToSecond(startItem);const currentSecond=TimeLineUtil.timeToSecond(current);const offsetS=startSecond-currentSecond;const offsetH=Math.ceil(offsetS/scale)+60;// offsetS / (scale * 60) * 60
|
|
10291
|
-
this.setState({scrollTop:offsetH});}_rectTopToTime(reactTop){const scaleWidth=this._scaleWidth;
|
|
10292
|
-
// let rectTop = rect.top; // 获取当前元素距离父元素顶部的高度
|
|
10293
|
-
// let reactTop = 0 - rectTop; // 实际偏移高度
|
|
10294
|
-
const index=Math.floor(reactTop/60);// 以分钟为刻度时,每个元素初始高度为60px, 向下取整并除以时刻倍数得出偏移item;
|
|
10295
|
-
const offsetH=reactTop-index*60;// 偏移高度
|
|
10296
|
-
let current;let offsetSecond;
|
|
10297
|
-
// console.log('index:', index, 'offsetH:', offsetH);
|
|
10298
|
-
if(offsetH==0){var _this_state_timeArr_;current=(_this_state_timeArr_=this.state.timeArr[index-1])==null?void 0:_this_state_timeArr_.current;offsetSecond=0;}else {
|
|
10299
|
-
// 当scaleWidth==120, scaleWidth==60, scaleWidth==30, scaleWidth==10, scaleWidth==1
|
|
10300
|
-
const time=this.state.timeArr[index].current;const minute=TimeLineUtil.timeToMinute(time);
|
|
10301
|
-
// 相对于下一元素偏移
|
|
10302
|
-
const offsetY=60-offsetH;const offsetS=offsetY*scaleWidth;// offsetY / 60 * scaleWidth * 60
|
|
10303
|
-
const offsetM=Math.floor(offsetS/60)+minute;const second=Math.floor(offsetS/60)*60;offsetSecond=Math.ceil(offsetS-second);// 保留两位小数
|
|
10304
|
-
current=TimeLineUtil.minuteToTime(offsetM);}if(current===void 0||+current.split(":")[0]>=24&&(+current.split(":")[1]>0||offsetSecond>0)){
|
|
10305
|
-
// 超出 24h 后不允许
|
|
10306
|
-
this.update(new Date(`${(new Date).getFullYear()}-${TimeLineUtil.subTime((new Date).getMonth()+1)}-${TimeLineUtil.subTime((new Date).getDate())} 23:59:59`));return}this.setState({current:current+":"+(offsetSecond>9?offsetSecond:"0"+offsetSecond),scrollTop:reactTop});}_render(){this._$currentTime=document.createElement("div");this._$currentTime.classList.add(MOBILE_TIMELINE_PREFIX+"-current");this._$currentTime.innerHTML=`<div class="${MOBILE_TIMELINE_PREFIX}-current-content" style="color: ${this.options.currentTimeBgColor||"#648FFC"}">\n <span class="${MOBILE_TIMELINE_PREFIX}-current-tip">${Icons.tip}</span>\n <span class="${MOBILE_TIMELINE_PREFIX}-current-tip-line" style="background-color: ${this.options.timePointColor||"#648FFC"};"></span>\n <div class="${MOBILE_TIMELINE_PREFIX}-current-value" style="color: ${this.options.currentTimeColor||"#FFFFFF"}">00:00:00</div>\n </div>`;this.$container.appendChild(this._$currentTime);this._$itemContainer=document.createElement("div");this._$itemContainer.classList.add(MOBILE_TIMELINE_PREFIX+"-item-container");
|
|
10719
|
+
// <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
|
|
10720
|
+
// <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
|
|
10721
|
+
// <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
|
|
10722
|
+
// <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
|
|
10723
|
+
// <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
|
|
10724
|
+
// <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale" style="width:10px"></div>
|
|
10725
|
+
item.recArr.forEach(i=>{timeItemHtml+=`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-unavail"\n style="height: ${i.height}px;background-color:${this.options.timeSectionColor||"#369FFF"}; top: ${i.top}px">\n </div>`;});timeItemHtml+=`<div id=${item.label} class="${_$MOBILE_TIMELINE_PREFIX$_}-time-label" style="color: ${this.options.timeTextColor||"#666"}">${item.current}</div>`;timeItemDOM.innerHTML=timeItemHtml;container.appendChild(timeItemDOM);this._imageErrorEvent(container.querySelectorAll(`img.${_$MOBILE_TIMELINE_PREFIX$_}-img`)||[]);});this._currentOffsetH();}_currentOffsetH(){const{current:current}=this.state;if(current){var _this__dragScroll;const currentSecond=TimeLineUtil.timeToSecond(current);const daySecond=24*3600;// 一天的秒数
|
|
10726
|
+
const y=(daySecond-currentSecond||0)/this._scaleWidth;(_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.scrollToY(y+60,false);}}_render(){this._$currentTime=document.createElement("div");this._$currentTime.classList.add(_$MOBILE_TIMELINE_PREFIX$_+"-current");this._$currentTime.innerHTML=`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-current-content" style="color: ${this.options.currentTimeBgColor||"#648FFC"}">\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-current-tip">${_$TIMELINE_ICONS$_.tip}</span>\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-current-tip-line" style="background-color: ${this.options.timePointColor||"#648FFC"};"></span>\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-current-value" style="color: ${this.options.currentTimeColor||"#FFFFFF"}">00:00:00</div>\n </div>`;this.$container.appendChild(this._$currentTime);this._$itemContainer=document.createElement("div");this._$itemContainer.classList.add(_$MOBILE_TIMELINE_PREFIX$_+"-container");this.$container.appendChild(this._$itemContainer);this._dragScroll=new DragScroll(this._$itemContainer,{hideScrollbar:true,onChange:state=>{const result=this._offsetYToTime(state.y);if(result[1]!==this.state.current)this._setCurrentDOM(result[0]>=_$DAY_TIME_SECOND$_?"23:59:59":result[1]);},onDragStart:()=>{this.options.onDragStart==null?void 0:this.options.onDragStart.call(this.options,this.state.current);},onDragging:()=>{this.options.onDragging==null?void 0:this.options.onDragging.call(this.options,this.state.current);},onDragEnd:()=>{var _this__dragScroll;const result=this._offsetYToTime((_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.currentY);if(result[1]!==this.state.current)this._setState({current:result[0]>=_$DAY_TIME_SECOND$_?"23:59:59":result[1]});this.options.onDragEnd==null?void 0:this.options.onDragEnd.call(this.options,this.state.current);}});
|
|
10307
10727
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
10308
|
-
if(/\d/.test(this.options.height))this._$itemContainer.style.cssText+=`height: ${this.options.height}px`;else if(typeof this.options.height==="string")this._$itemContainer.style.cssText+=`height: ${this.options.height}`;else {const height=this.$container.clientHeight;this._$itemContainer.style.cssText+=`height: ${height}px`;}this._$itemList=document.createElement("div");this._$itemList.classList.add(MOBILE_TIMELINE_PREFIX+"-item");this.
|
|
10728
|
+
if(/\d/.test(this.options.height))this._$itemContainer.style.cssText+=`height: ${this.options.height}px`;else if(typeof this.options.height==="string")this._$itemContainer.style.cssText+=`height: ${this.options.height}`;else {const height=this.$container.clientHeight;this._$itemContainer.style.cssText+=`height: ${height}px`;}this._$itemList=document.createElement("div");this._$itemList.classList.add(_$MOBILE_TIMELINE_PREFIX$_+"-item");this._dragScroll.$content.appendChild(this._$itemList);if(this.options.showTimeWidthBtn){
|
|
10309
10729
|
// 加减
|
|
10310
|
-
this._$op=document.createElement("div");this._$op.classList.add(MOBILE_TIMELINE_PREFIX+"-op");this._$op.innerHTML=`<span class="${MOBILE_TIMELINE_PREFIX}-op-wrapper"
|
|
10311
|
-
|
|
10312
|
-
if(this._$itemContainer){
|
|
10313
|
-
// console.warn('=== TimeLine HAS_POINTER_EVENT ===', HAS_POINTER_EVENT);
|
|
10314
|
-
// 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
|
|
10315
|
-
this._$itemContainer.addEventListener("touchstart",this._touchstart,false);
|
|
10316
|
-
// 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
|
|
10317
|
-
this._$itemContainer.addEventListener("touchmove",this._touchmove,false);
|
|
10318
|
-
// 手动滚动停止,选定时刻自动播放
|
|
10319
|
-
this._$itemContainer.addEventListener("touchend",this._touchend,false);
|
|
10320
|
-
// prettier-ignore
|
|
10321
|
-
// this._$itemContainer.addEventListener('scroll', this._touchmove, false);
|
|
10322
|
-
}if(this.options.showTimeWidthBtn&&this._$op){var// this._$op.addEventListener('click', this._opClick, false);
|
|
10323
|
-
_this__$op_querySelector,_this__$op_querySelector1;(_this__$op_querySelector=this._$op.querySelector(`.${MOBILE_TIMELINE_PREFIX}-icon-plus`))==null?void 0:_this__$op_querySelector.addEventListener("click",this._plusClick,false);(_this__$op_querySelector1=this._$op.querySelector(`.${MOBILE_TIMELINE_PREFIX}-icon-minus`))==null?void 0:_this__$op_querySelector1.addEventListener("click",this._minusClick,false);}this._matchTimeDot();if(this._picker){this._delegatePickerClose=delegate(this._picker.$body,`.${MOBILE_TIMELINE_PREFIX}-picker-close`,"click",this._onPickerClose,false);this._delegateItemContent=delegate(this._picker.$body,`.${MOBILE_TIMELINE_PREFIX}-picker-item-content`,"click",this._onClickItem,false);this._delegateCoverFold=delegate(this.$container,`.${MOBILE_TIMELINE_PREFIX}-time-cover-fold`,"click",this._onClickCoverFold,false);}}_removeEventListener(){if(this._$itemContainer){
|
|
10324
|
-
// 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
|
|
10325
|
-
this._$itemContainer.removeEventListener("touchstart",this._touchstart);
|
|
10326
|
-
// 监听手动滚动时间轴时,停止时间轴滚动,时刻仍然变化
|
|
10327
|
-
this._$itemContainer.removeEventListener("touchmove",this._touchmove);
|
|
10328
|
-
// 手动滚动停止,选定时刻自动播放
|
|
10329
|
-
this._$itemContainer.removeEventListener("touchend",this._touchend);}if(this.options.showTimeWidthBtn&&this._$op){var _this__$op_querySelector,_this__$op_querySelector1;(_this__$op_querySelector=this._$op.querySelector(`.${MOBILE_TIMELINE_PREFIX}-icon-plus`))==null?void 0:_this__$op_querySelector.removeEventListener("click",this._plusClick);(_this__$op_querySelector1=this._$op.querySelector(`.${MOBILE_TIMELINE_PREFIX}-icon-minus`))==null?void 0:_this__$op_querySelector1.removeEventListener("click",this._minusClick);}if(this._picker){var _this__picker_$body_querySelector,_this__picker_$body;(_this__picker_$body=this._picker.$body)==null?void 0:(_this__picker_$body_querySelector=_this__picker_$body.querySelector(`.${MOBILE_TIMELINE_PREFIX}-picker-close`))==null?void 0:_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose);if(this._delegateItemContent){this._delegateItemContent.forEach(function(delegation){delegation.destroy();});this._delegateItemContent=null;}if(this._delegatePickerClose){this._delegatePickerClose.forEach(function(delegation){delegation.destroy();});this._delegatePickerClose=null;}if(this._delegateCoverFold){this._delegateCoverFold.forEach(function(delegation){delegation.destroy();});this._delegateCoverFold=null;}}}_plusClick(){const timeWidth=this.timeWidth+1;if(timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length)this.setTimeWidth(timeWidth);else console.warn("时间轴刻度宽度不能再加了");}_minusClick(){const timeWidth=this.timeWidth-1;if(timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length)this.setTimeWidth(Math.floor(timeWidth));else console.warn("时间轴刻度宽度不能再减了");}_touchstart(){var _this__$itemContainer;if(this.readOnly)return false;this._isTouchStart=true;this._touchstartTop=(_this__$itemContainer=this._$itemContainer)==null?void 0:_this__$itemContainer.scrollTop;this.options.onDragStart==null?void 0:this.options.onDragStart.call(this.options,this.state.current);}_touchmove(){var _this__$itemContainer;if(this.readOnly)return false;const reactTop=(_this__$itemContainer=this._$itemContainer)==null?void 0:_this__$itemContainer.scrollTop;// 实际偏移高度
|
|
10330
|
-
this._rectTopToTime(reactTop);this.options.onDragging==null?void 0:this.options.onDragging.call(this.options,this.state.current);}_touchend(){if(this.readOnly)return false;
|
|
10331
|
-
// 这里有问题, 滚动是利用滚动操作(overflow-y: scroll;)的
|
|
10332
|
-
new Promise(resolve=>{let preTop=-1;if(this._scrollTimer){clearInterval(this._scrollTimer);this._scrollTimer=null;}this._scrollTimer=setInterval(()=>{var _this__$itemContainer;
|
|
10333
|
-
// debugger
|
|
10334
|
-
const reactTop=(_this__$itemContainer=this._$itemContainer)==null?void 0:_this__$itemContainer.scrollTop;// 实际偏移高度
|
|
10335
|
-
if(reactTop!==preTop){console.log("scrolling",reactTop,preTop);preTop=reactTop;}else {console.log("scroll stop",reactTop,preTop);if(this._scrollTimer){clearInterval(this._scrollTimer);this._scrollTimer=null;}this._isTouchStart=false;resolve(reactTop);}},100);}).then(reactTop=>{var _this__$itemContainer;this._rectTopToTime(reactTop);console.log("页面滚动实际高度",reactTop,this.state.current);this.options.onDragEnd==null?void 0:this.options.onDragEnd.call(this.options,this.state.current);if(this._touchstartTop!==((_this__$itemContainer=this._$itemContainer)==null?void 0:_this__$itemContainer.scrollTop)){this.options.onChange==null?void 0:this.options.onChange.call(this.options,this.state.current);this._touchstartTop=0;}});}_timeSectionsToGroupsByHour(){const obj={};this.timeSections.forEach((item,index)=>{
|
|
10730
|
+
this._$op=document.createElement("div");this._$op.classList.add(_$MOBILE_TIMELINE_PREFIX$_+"-op");this._$op.innerHTML=`<span class="${_$MOBILE_TIMELINE_PREFIX$_}-op-wrapper"><span class="${_$MOBILE_TIMELINE_PREFIX$_}-icon-plus">${_$TIMELINE_ICONS$_.plus}</span> <span class="${_$MOBILE_TIMELINE_PREFIX$_}-icon-minus">${_$TIMELINE_ICONS$_.minus}</span></span>`;this.$container.appendChild(this._$op);}this._picker=new Picker(null,{isMobile:true,wrapClassName:`${_$MOBILE_TIMELINE_PREFIX$_}-picker`,onOpenChange:isOpen=>{var _this_options_onPickerOpenChange,_this_options;(_this_options=this.options)==null?void 0:(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)==null?void 0:_this_options_onPickerOpenChange.call(_this_options,isOpen);}});this._addEventListener();}_addEventListener(){if(this.options.showTimeWidthBtn&&this._$op){var// this._$op.addEventListener('click', this._opClick, false);
|
|
10731
|
+
_this__$op_querySelector,_this__$op_querySelector1;(_this__$op_querySelector=this._$op.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-icon-plus`))==null?void 0:_this__$op_querySelector.addEventListener("click",this._plusClick,false);(_this__$op_querySelector1=this._$op.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-icon-minus`))==null?void 0:_this__$op_querySelector1.addEventListener("click",this._minusClick,false);}this._matchTimeDot();if(this._picker){this._delegatePickerClose=delegate(this._picker.$body,`.${_$MOBILE_TIMELINE_PREFIX$_}-picker-close`,"click",this._onPickerClose,false);this._delegateItemContent=delegate(this._picker.$body,`.${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-content`,"click",this._onClickItem,false);this._delegateCoverFold=delegate(this._$itemList,`.${_$MOBILE_TIMELINE_PREFIX$_}-time-cover-fold`,"click",this._onClickCoverFold,false);}}_removeEventListener(){if(this.options.showTimeWidthBtn&&this._$op){var _this__$op_querySelector,_this__$op_querySelector1;(_this__$op_querySelector=this._$op.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-icon-plus`))==null?void 0:_this__$op_querySelector.removeEventListener("click",this._plusClick);(_this__$op_querySelector1=this._$op.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-icon-minus`))==null?void 0:_this__$op_querySelector1.removeEventListener("click",this._minusClick);}if(this._picker){var _this__picker_$body_querySelector,_this__picker_$body;(_this__picker_$body=this._picker.$body)==null?void 0:(_this__picker_$body_querySelector=_this__picker_$body.querySelector(`.${_$MOBILE_TIMELINE_PREFIX$_}-picker-close`))==null?void 0:_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose);if(this._delegateItemContent){this._delegateItemContent.forEach(function(delegation){delegation.destroy();});this._delegateItemContent=null;}if(this._delegatePickerClose){this._delegatePickerClose.forEach(function(delegation){delegation.destroy();});this._delegatePickerClose=null;}if(this._delegateCoverFold){this._delegateCoverFold.forEach(function(delegation){delegation.destroy();});this._delegateCoverFold=null;}}}_plusClick(){const timeWidth=this.timeWidth+1;if(timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length)this.setTimeWidth(timeWidth);else console.warn("时间轴刻度宽度不能再加了");}_minusClick(){const timeWidth=this.timeWidth-1;if(timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length)this.setTimeWidth(Math.floor(timeWidth));else console.warn("时间轴刻度宽度不能再减了");}_timeSectionsToGroupsByHour(list){const obj={};list.forEach((item,index)=>{
|
|
10336
10732
|
// 移动端仅支持一天
|
|
10337
10733
|
// if (TimeLineUtil.tranTime(item.startTime, 'YYYY-MM-DD') !== TimeLineUtil.tranTime(item.endTime, 'YYYY-MM-DD')) {
|
|
10338
|
-
// //
|
|
10339
10734
|
// }
|
|
10340
|
-
const hour=TimeLineUtil.tranTime(item.startTime,"HH");if(obj[+hour])
|
|
10735
|
+
const hour=TimeLineUtil.tranTime(item.startTime,"HH");if(obj[+hour])
|
|
10736
|
+
// prettier-ignore
|
|
10737
|
+
obj[+hour].push(_extends$1$1({},item,{_index:index}));else
|
|
10738
|
+
// prettier-ignore
|
|
10739
|
+
obj[+hour]=[_extends$1$1({},item,{_index:index})];});return obj}
|
|
10740
|
+
/**
|
|
10741
|
+
*
|
|
10742
|
+
* @param start 仅支持判断同一天的, 如果是多天的或出错
|
|
10743
|
+
*/_filterTimeSectionsByTime(start){if(!start)return [];const startSecond=TimeLineUtil.timeToSecond(start+":00");const endSecond=TimeLineUtil.timeToSecond(start+":00")+this._scaleWidth*60;return this.timeSections.filter(item=>{const start=TimeLineUtil.timeToSecond(TimeLineUtil.tranTime(item.startTime,"HH:mm:ss"));return start>=startSecond&&start<endSecond})}
|
|
10341
10744
|
/**
|
|
10342
10745
|
* 渲染选择器内容
|
|
10343
|
-
*/_renderPickerContent(){var _this__picker_innerHTML,_this__picker;const hourGroups=this._timeSectionsToGroupsByHour();(_this__picker=this._picker)==null?void 0:(_this__picker_innerHTML=_this__picker.innerHTML)==null?void 0:_this__picker_innerHTML.call(_this__picker,`<div class="${MOBILE_TIMELINE_PREFIX}-picker-container">\n <div class="${MOBILE_TIMELINE_PREFIX}-picker-header">\n <span class="${MOBILE_TIMELINE_PREFIX}-picker-close">${
|
|
10344
|
-
|
|
10345
|
-
|
|
10746
|
+
*/_renderPickerContent(start){var _this__picker_innerHTML,_this__picker,_this__picker1;const list=this._filterTimeSectionsByTime(start);const hourGroups=this._timeSectionsToGroupsByHour(list);(_this__picker=this._picker)==null?void 0:(_this__picker_innerHTML=_this__picker.innerHTML)==null?void 0:_this__picker_innerHTML.call(_this__picker,`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-container">\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-header">\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-close">${_$TIMELINE_ICONS$_.close}</span>\n ${this.i18n.t("title",{len:list.length,unit:list.length>1?"videos":"video"})}\n </div>\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-content">\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-list">\n ${Object.keys(hourGroups).reverse().map(key=>`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item">\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-title">${key}:00</div>\n <div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-list">\n ${hourGroups[key].reverse().map(item=>`<div class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-content"\n data-start="${TimeLineUtil.tranTime(item.startTime,"YYYYMMDDTHHmmssZ")}"\n data-end="${TimeLineUtil.tranTime(item.endTime,"YYYYMMDDTHHmmssZ")}"\n data-index="${item._index}">\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-time">${TimeLineUtil.tranTime(item.startTime,"HH:mm")}</span>\n <span class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-duration">\n ${TimeLineUtil.tranTimeToString(item.startTime,item.endTime)}\n </span>\n <img class="${_$MOBILE_TIMELINE_PREFIX$_}-picker-item-cover" src="${this._setImageScr(item.coverPic)}"/>\n </div>`).join("")}\n </div>\n </div>`).join("")}\n </div>\n </div>\n </div>\n </div>`);if((_this__picker1=this._picker)==null?void 0:_this__picker1.$body){var _this__picker2;this._imageErrorEvent(((_this__picker2=this._picker)==null?void 0:_this__picker2.$body.querySelectorAll("img"))||[]);}}
|
|
10747
|
+
/**
|
|
10748
|
+
* 图片加载失败事件监听
|
|
10749
|
+
* @param list
|
|
10750
|
+
*/_imageErrorEvent(list=[]){Array.from(list).forEach(img=>{
|
|
10751
|
+
// 避免重复添加事件
|
|
10752
|
+
if(!img.hasAttribute("data-error"))img.addEventListener("error",this._onImageError);});}
|
|
10753
|
+
/**
|
|
10754
|
+
* 图片加载失败移除
|
|
10755
|
+
* @param list
|
|
10756
|
+
*/_imageRemoveErrorEvent(list=[]){Array.from(list).forEach(img=>{
|
|
10757
|
+
// 避免重复添加事件
|
|
10758
|
+
img.removeEventListener("error",this._onImageError);});}
|
|
10759
|
+
/**
|
|
10760
|
+
* 图片加载失败
|
|
10761
|
+
* @param e
|
|
10762
|
+
*/_onImageError(e){const img=e.target;if(!img.hasAttribute("data-error")){var _img_parentNode;
|
|
10763
|
+
// 加密图片不能加载或没有图片
|
|
10764
|
+
const placeholder=document.createElement("div");placeholder.classList.add(`${_$MOBILE_TIMELINE_PREFIX$_}-item-cover-placeholder`);placeholder.innerHTML=`${_$TIMELINE_ICONS$_.picture}`;(_img_parentNode=img.parentNode)==null?void 0:_img_parentNode.appendChild(placeholder);img.remove();
|
|
10765
|
+
// img.setAttribute('data-error', 'true'); // 失败仅设置一次, 否则会死循环
|
|
10766
|
+
}}_onPickerClose(){if(this._picker)this._picker.open=false;}_onClickItem(e){var _e_delegateTarget_getAttribute,_e_delegateTarget;const index=(_e_delegateTarget=e.delegateTarget)==null?void 0:(_e_delegateTarget_getAttribute=_e_delegateTarget.getAttribute)==null?void 0:_e_delegateTarget_getAttribute.call(_e_delegateTarget,"data-index");if(this._picker)this._picker.open=false;this.options.onPickerSelect==null?void 0:this.options.onPickerSelect.call(this.options,this.timeSections[+index]);}_onClickCoverFold(e){var _e_delegateTarget_parentElement_getAttribute,_e_delegateTarget_parentElement,_e_delegateTarget;e.preventDefault();e.stopPropagation();const time=(_e_delegateTarget=e.delegateTarget)==null?void 0:(_e_delegateTarget_parentElement=_e_delegateTarget.parentElement)==null?void 0:(_e_delegateTarget_parentElement_getAttribute=_e_delegateTarget_parentElement.getAttribute)==null?void 0:_e_delegateTarget_parentElement_getAttribute.call(_e_delegateTarget_parentElement,"data-time");if(this._picker&&time){this._renderPickerContent(time);this._picker.open=true;}}_setImageScr(src){if(src){const query="x=1000&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""}_offsetYToTime(offsetY){let y=offsetY;if(offsetY<60){var _this__dragScroll;
|
|
10767
|
+
// 60 是下限
|
|
10768
|
+
y=60;(_this__dragScroll=this._dragScroll)==null?void 0:_this__dragScroll.scrollToY(y);}const second=_$DAY_TIME_SECOND$_-Math.floor((y-60)*this._scaleWidth);return [second,TimeLineUtil.subTime(Math.floor(second/3600))+":"+TimeLineUtil.subTime(Math.floor(second%3600/60))+":"+TimeLineUtil.subTime(second%60)]}constructor(container,options){super(container,deepmerge(_$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false})),this._isTouchStart=false,this._dragScroll=null,this.state={start:"00:00:00",end:"24:00:00",current:null,timeArr:[],availTimeLine:[],index:0};this._plusClick=this._plusClick.bind(this);this._minusClick=this._minusClick.bind(this);this._onPickerClose=this._onPickerClose.bind(this);this._onClickItem=this._onClickItem.bind(this);this._onClickCoverFold=this._onClickCoverFold.bind(this);this._onImageError=this._onImageError.bind(this);this._render();}}function _extends$5(){_extends$5=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)if(Object.prototype.hasOwnProperty.call(source,key))target[key]=source[key];}return target};return _extends$5.apply(this,arguments)}
|
|
10346
10769
|
/**
|
|
10347
10770
|
* 时间轴配置项
|
|
10348
|
-
*/const TIMELINE_DEFAULT_OPTIONS={height:36,dpr:window.devicePixelRatio||2,
|
|
10771
|
+
*/const _$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,
|
|
10349
10772
|
// wheelSpeed: 0.1,
|
|
10350
10773
|
scaleOffsetTop:4,showYearMonthDay:true};
|
|
10351
10774
|
/**
|
|
@@ -10382,17 +10805,15 @@
|
|
|
10382
10805
|
* 更新
|
|
10383
10806
|
* @param options - 更新参数
|
|
10384
10807
|
* @returns
|
|
10385
|
-
*/_update(options={}){if((options==null?void 0:options.current)&&options.current instanceof Date)this.current=options.current;if(options==null?void 0:options.timeSections)super.updateTimeSections(this._mergeTimeSections(options.timeSections));if(typeof(options==null?void 0:options.timeWidth)==="number"&&(options==null?void 0:options.timeWidth)<TIME_WIDTH.length){super.setTimeWidth(options.timeWidth);this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)];}if(typeof(options==null?void 0:options.timeWidth)==="number"&&this._timeWidthArray)if(this._timeWidthArray[3]){var _this__$canvas;(_this__$canvas=this._$canvas)==null?void 0:_this__$canvas.setAttribute("data-title",this._timeWidthArray[3]);}
|
|
10386
|
-
// 清空画布
|
|
10387
|
-
if(this._ctx){this._ctx.fillStyle=this.options.timeAxisBgColor;
|
|
10388
|
-
// prettier-ignore
|
|
10389
|
-
this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr);}this._draw();}
|
|
10808
|
+
*/_update(options={}){if((options==null?void 0:options.current)&&options.current instanceof Date)this.current=options.current;if(options==null?void 0:options.timeSections)super.updateTimeSections(this._mergeTimeSections(options.timeSections));if(typeof(options==null?void 0:options.timeWidth)==="number"&&(options==null?void 0:options.timeWidth)<TIME_WIDTH.length){super.setTimeWidth(options.timeWidth);this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)];}if(typeof(options==null?void 0:options.timeWidth)==="number"&&this._timeWidthArray)if(this._timeWidthArray[3]){var _this__$canvas;(_this__$canvas=this._$canvas)==null?void 0:_this__$canvas.setAttribute("data-title",this._timeWidthArray[3]);}this._draw();}setReadOnly(readOnly){super.setReadOnly(readOnly);if(this._$canvas)this._$canvas.style.cssText+=`cursor: ${readOnly?"not-allowed":"pointer"}`;}
|
|
10390
10809
|
/**
|
|
10391
10810
|
* 销毁
|
|
10392
10811
|
* @returns
|
|
10393
|
-
*/destroy(){this._removeEventListener();if(this._$canvas){this.$container.removeChild(this._$canvas);
|
|
10812
|
+
*/destroy(){this._removeEventListener();if(this._$canvas)try{this.$container.removeChild(this._$canvas);
|
|
10394
10813
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10395
|
-
this._$canvas=null;}
|
|
10814
|
+
this._$canvas=null;}catch(e){
|
|
10815
|
+
// console.error(e);
|
|
10816
|
+
}super.destroy();
|
|
10396
10817
|
// if (this._$tip) {
|
|
10397
10818
|
// this.$container.removeChild(this._$tip);
|
|
10398
10819
|
// // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -10410,7 +10831,11 @@
|
|
|
10410
10831
|
}
|
|
10411
10832
|
/**
|
|
10412
10833
|
* 绘制
|
|
10413
|
-
*/_draw(){
|
|
10834
|
+
*/_draw(){
|
|
10835
|
+
// 清空画布
|
|
10836
|
+
if(this._ctx){this._ctx.fillStyle=this.options.timeAxisBgColor;
|
|
10837
|
+
// prettier-ignore
|
|
10838
|
+
this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr);}this._drawSections();this._drawScale();}
|
|
10414
10839
|
/**
|
|
10415
10840
|
* 绘制刻度
|
|
10416
10841
|
*/_drawScale(){const lineWidth=1*this.options.dpr;
|
|
@@ -10656,7 +11081,7 @@
|
|
|
10656
11081
|
// fix点击引起mousemove的问题
|
|
10657
11082
|
if(mouseOffset===0)return;if(this._oldTime){
|
|
10658
11083
|
// prettier-ignore
|
|
10659
|
-
const currentTime=this._oldTime.getTime()+parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10)*1e3;this._update({current:new Date(currentTime)});this.options.onDragging==null?void 0:this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}constructor(container,options){super(container,deepmerge(TIMELINE_DEFAULT_OPTIONS,options,{clone:true})),this._$canvas=null,this._ctx=null,/** 时间刻度宽度 [刻度间隔秒数s, 刻度间隔宽度px, 长刻度间隔短刻度个数, 中文说明] */this._timeWidthArray=TIME_WIDTH[0],this._centerPositionX=0,// mouse
|
|
11084
|
+
const currentTime=this._oldTime.getTime()+parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10)*1e3;this._update({current:new Date(currentTime)});this.options.onDragging==null?void 0:this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}constructor(container,options){super(container,deepmerge(_$TIMELINE_DEFAULT_OPTIONS$_,options,{clone:true})),this._$canvas=null,this._ctx=null,/** 时间刻度宽度 [刻度间隔秒数s, 刻度间隔宽度px, 长刻度间隔短刻度个数, 中文说明] */this._timeWidthArray=TIME_WIDTH[0],this._centerPositionX=0,// mouse
|
|
10660
11085
|
this._isMouseDown=false,this._mousePosition=0,this._oldTime=null,this._isOver=false,this._moved=false,this._isCtrlKeyDown=false,this._lastTouchDist=0;this.$container=container;
|
|
10661
11086
|
// prettier-ignore
|
|
10662
11087
|
console.log("TimeLine dpr",JSON.stringify(this.options));this._mousemoveFun=this._mousemoveFun.bind(this);this._mouseoverFun=this._mouseoverFun.bind(this);this._mouseleaveFun=this._mouseleaveFun.bind(this);this._mousedownFun=this._mousedownFun.bind(this);this._mouseUpFun=this._mouseUpFun.bind(this);this._mousewheelFun=this._mousewheelFun.bind(this);this._touchstartFun=this._touchstartFun.bind(this);this._touchmoveFun=this._touchmoveFun.bind(this);this._touchendFun=this._touchendFun.bind(this);this._ctrlKeyDownFun=this._ctrlKeyDownFun.bind(this);this._ctrlKeyUpFun=this._ctrlKeyUpFun.bind(this);this._init();}}TimeLine.TIME_WIDTH=TIME_WIDTH;
|
|
@@ -10706,7 +11131,8 @@
|
|
|
10706
11131
|
tagName: 'div',
|
|
10707
11132
|
controlType: 'block',
|
|
10708
11133
|
classNameSuffix: 'time-line'
|
|
10709
|
-
})) || this, _this._$add = null, _this._$reduce = null, _this.records = [];
|
|
11134
|
+
})) || this, _this._$add = null, _this._$reduce = null, _this._currentTime = 0, _this.records = [];
|
|
11135
|
+
_this._currentTime = 0;
|
|
10710
11136
|
_this._options = options;
|
|
10711
11137
|
_this.records = ((_this__options = _this._options) == null ? void 0 : (_this__options_props = _this__options.props) == null ? void 0 : _this__options_props.recordList) || [];
|
|
10712
11138
|
_this._render();
|
|
@@ -10717,9 +11143,13 @@
|
|
|
10717
11143
|
(_this_timeLineUtil = _this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_updateTimeSections = _this_timeLineUtil.updateTimeSections) == null ? void 0 : _this_timeLineUtil_updateTimeSections.call(_this_timeLineUtil, records);
|
|
10718
11144
|
});
|
|
10719
11145
|
_this.on(EVENTS.getOSDTime, function(time) {
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
11146
|
+
if (time) {
|
|
11147
|
+
var // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
11148
|
+
_this_timeLineUtil_update, _this_timeLineUtil;
|
|
11149
|
+
var date = new Date(time * 1000);
|
|
11150
|
+
_this._currentTime = date.getTime();
|
|
11151
|
+
(_this_timeLineUtil = _this.timeLineUtil) == null ? void 0 : (_this_timeLineUtil_update = _this_timeLineUtil.update) == null ? void 0 : _this_timeLineUtil_update.call(_this_timeLineUtil, date);
|
|
11152
|
+
}
|
|
10723
11153
|
});
|
|
10724
11154
|
return _this;
|
|
10725
11155
|
}
|
|
@@ -10728,10 +11158,16 @@
|
|
|
10728
11158
|
var _this = this;
|
|
10729
11159
|
var _this_timeLineUtil_updateTimeSections, _this_timeLineUtil;
|
|
10730
11160
|
var _timeLineOptions = {
|
|
10731
|
-
|
|
11161
|
+
language: this._options.language || 'zh',
|
|
11162
|
+
coverQuery: this._options.coverQuery || '',
|
|
10732
11163
|
onChange: function(date) {
|
|
10733
|
-
_this.
|
|
10734
|
-
|
|
11164
|
+
if (_this._currentTime !== (date == null ? void 0 : date.getTime())) {
|
|
11165
|
+
_this._options.onChange == null ? void 0 : _this._options.onChange.call(_this._options, date);
|
|
11166
|
+
_this.emit(EVENTS.control.timeLineChange, date);
|
|
11167
|
+
}
|
|
11168
|
+
},
|
|
11169
|
+
onPickerOpenChange: function(open) {
|
|
11170
|
+
_this.emit(EVENTS.control.timeLinePanelOpenChange, open);
|
|
10735
11171
|
},
|
|
10736
11172
|
// 2025-10-27 仅移动端支持
|
|
10737
11173
|
onPickerSelect: function(item) {
|
|
@@ -10891,7 +11327,7 @@
|
|
|
10891
11327
|
globalFullscreen: GlobalFullscreen,
|
|
10892
11328
|
rec: Rec,
|
|
10893
11329
|
speed: Speed,
|
|
10894
|
-
date:
|
|
11330
|
+
date: DatePickerControl,
|
|
10895
11331
|
timeLine: TimeLineControl
|
|
10896
11332
|
};
|
|
10897
11333
|
|
|
@@ -11691,14 +12127,15 @@
|
|
|
11691
12127
|
var _renderTimeLine = function(theme, container, props) {
|
|
11692
12128
|
if (props === void 0) props = {};
|
|
11693
12129
|
if (!theme.controls.timeLineControl && theme.options.timeLineOptions !== null) {
|
|
11694
|
-
var _theme_options;
|
|
12130
|
+
var _theme_urlInfo, _theme_options;
|
|
11695
12131
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
11696
12132
|
theme.controls.timeLineControl = new Controls['timeLine'](_extends$1({
|
|
11697
12133
|
getPopupContainer: function() {
|
|
11698
12134
|
return container;
|
|
11699
12135
|
},
|
|
11700
12136
|
language: theme.options.language,
|
|
11701
|
-
locales: theme.i18n.translations
|
|
12137
|
+
locales: theme.i18n.translations,
|
|
12138
|
+
coverQuery: ((_theme_urlInfo = theme.urlInfo) == null ? void 0 : _theme_urlInfo.validateCode) ? "decodekey=" + theme.urlInfo.validateCode : ''
|
|
11702
12139
|
}, ((_theme_options = theme.options) == null ? void 0 : _theme_options["timeLineOptions"]) || {}, {
|
|
11703
12140
|
props: props
|
|
11704
12141
|
}));
|
|
@@ -12276,8 +12713,8 @@
|
|
|
12276
12713
|
this.logger.log(JSON.stringify(this.options));
|
|
12277
12714
|
var language = this.options.language || 'zh';
|
|
12278
12715
|
var locales = deepmerge({
|
|
12279
|
-
zh: zh
|
|
12280
|
-
en: en
|
|
12716
|
+
zh: zh,
|
|
12717
|
+
en: en
|
|
12281
12718
|
}, this.options.locales || {}, {
|
|
12282
12719
|
clone: false
|
|
12283
12720
|
});
|
|
@@ -13176,10 +13613,10 @@
|
|
|
13176
13613
|
/** 所有私有流的模板 @since 0.0.1 */ Theme.TEMPLATES = TEMPLATES;
|
|
13177
13614
|
/** 事件名称 @since 0.0.1 */ Theme.EVENTS = EVENTS;
|
|
13178
13615
|
/** 语言包 @since 0.0.1 */ Theme.LOCALES = {
|
|
13179
|
-
zh: zh
|
|
13180
|
-
en: en
|
|
13616
|
+
zh: zh,
|
|
13617
|
+
en: en
|
|
13181
13618
|
};
|
|
13182
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.0
|
|
13619
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '1.0.0';
|
|
13183
13620
|
|
|
13184
13621
|
// 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
|
|
13185
13622
|
|