@ezuikit/player-theme 2.0.0-beta.1 → 2.0.0-beta.4

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.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- * @ezuikit/player-theme v2.0.0-beta.1
3
- * Copyright (c) 2025-11-12 Ezviz-OpenBiz
2
+ * @ezuikit/player-theme v2.0.0-beta.4
3
+ * Copyright (c) 2025-11-17 Ezviz-OpenBiz
4
4
  * Released under the MIT License.
5
5
  */
6
6
  (function (global, factory) {
@@ -548,7 +548,8 @@
548
548
  /** 封面控件销毁 */ posterDestroy: 'Control.posterDestroy',
549
549
  /** 加载控件销毁 */ loadingDestroy: 'Control.loadingDestroy',
550
550
  /** 消息控件销毁 */ messageDestroy: 'Control.messageDestroy',
551
- /** 播放器内容区域销毁 */ contentDestroy: 'Control.contentDestroy'
551
+ /** 播放器内容区域销毁 */ contentDestroy: 'Control.contentDestroy',
552
+ contentRerender: 'Control.contentRerender'
552
553
  },
553
554
  /**
554
555
  * 主题控件相关
@@ -1468,11 +1469,15 @@
1468
1469
  return Play;
1469
1470
  }(Control);
1470
1471
 
1471
- /*
1472
- * @skax/picker v1.1.2
1473
- * Copyright (c) 2025-11-09 ShineShao <xiaoshaoqq@gmail.com>
1474
- * Released under the MIT License.
1475
- */
1472
+ /**
1473
+ * picker component for js framework, support mobile and pc
1474
+ *
1475
+ * @skax/picker v1.1.5
1476
+ * Copyright (c) 2025-11-15 ShineShao <xiaoshaoqq@gmail.com>
1477
+ *
1478
+ * This source code is licensed under the MIT license found in the
1479
+ * LICENSE file in the root directory of this source tree.
1480
+ */
1476
1481
 
1477
1482
  var dist$a;
1478
1483
  var hasRequiredDist$a;
@@ -1482,97 +1487,105 @@
1482
1487
  hasRequiredDist$a = 1;
1483
1488
 
1484
1489
  function _array_like_to_array(arr, len) {
1485
- if (len == null || len > arr.length) len = arr.length;
1486
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1487
- return arr2;
1490
+ if (len == null || len > arr.length) len = arr.length;
1491
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
1492
+ return arr2;
1488
1493
  }
1489
1494
  function _unsupported_iterable_to_array(o, minLen) {
1490
- if (!o) return;
1491
- if (typeof o === "string") return _array_like_to_array(o, minLen);
1492
- var n = Object.prototype.toString.call(o).slice(8, -1);
1493
- if (n === "Object" && o.constructor) n = o.constructor.name;
1494
- if (n === "Map" || n === "Set") return Array.from(n);
1495
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1495
+ if (!o) return;
1496
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
1497
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1498
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1499
+ if (n === "Map" || n === "Set") return Array.from(n);
1500
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1496
1501
  }
1497
1502
  function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1498
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1499
- if (it) return (it = it.call(o)).next.bind(it);
1500
- if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike) {
1501
- if (it) o = it;
1502
- var i = 0;
1503
- return function() {
1504
- if (i >= o.length) {
1505
- return {
1506
- done: true
1507
- };
1508
- }
1509
- return {
1510
- done: false,
1511
- value: o[i++]
1512
- };
1503
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1504
+ if (it) return (it = it.call(o)).next.bind(it);
1505
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike) {
1506
+ if (it) o = it;
1507
+ var i = 0;
1508
+ return function () {
1509
+ if (i >= o.length) {
1510
+ return {
1511
+ done: true
1513
1512
  };
1514
- }
1515
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1513
+ }
1514
+ return {
1515
+ done: false,
1516
+ value: o[i++]
1517
+ };
1518
+ };
1519
+ }
1520
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1516
1521
  }
1517
1522
  /**
1518
1523
  * PickerProvider 单例类
1519
- */ var PickerProvider = /*#__PURE__*/ function() {
1520
- function PickerProvider() {
1521
- this.pickers = [];
1524
+ */
1525
+ var PickerProvider = /*#__PURE__*/function () {
1526
+
1527
+ function PickerProvider() {
1528
+ this.pickers = [];
1529
+ }
1530
+ var _proto = PickerProvider.prototype;
1531
+ /**
1532
+ * 添加picker
1533
+ * @param picker Picker 实例
1534
+ */
1535
+ _proto.add = function add(picker) {
1536
+ this.pickers.push(picker);
1537
+ };
1538
+ /**
1539
+ * 移除picker
1540
+ * @param picker Picker 实例
1541
+ */
1542
+ _proto.remove = function remove(picker) {
1543
+ var index = this.pickers.indexOf(picker);
1544
+ if (index > -1) {
1545
+ this.pickers.splice(index, 1);
1546
+ } else {
1547
+ console.warn('Picker not found in the provider.');
1522
1548
  }
1523
- var _proto = PickerProvider.prototype;
1524
- /**
1525
- * 添加picker
1526
- * @param picker Picker 实例
1527
- */ _proto.add = function add(picker) {
1528
- this.pickers.push(picker);
1529
- };
1530
- /**
1531
- * 移除picker
1532
- * @param picker Picker 实例
1533
- */ _proto.remove = function remove(picker) {
1534
- var index = this.pickers.indexOf(picker);
1535
- if (index > -1) {
1536
- this.pickers.splice(index, 1);
1537
- }
1538
- };
1539
- /**
1540
- * 关闭其他picker
1541
- * @param e 事件
1542
- */ _proto.closeOther = function closeOther(e) {
1543
- for(var _iterator = _create_for_of_iterator_helper_loose(this.pickers), _step; !(_step = _iterator()).done;){
1544
- var p = _step.value;
1545
- var _p_$container_contains, _p_$container, _p_$wrapperContent_contains, _p_$wrapperContent;
1546
- 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)))) {
1547
- p.open = false;
1548
- }
1549
- }
1550
- };
1551
- /**
1552
- * 获取单例实例
1553
- * @returns Picker 实例
1554
- */ PickerProvider.getInstance = function getInstance() {
1555
- if (!PickerProvider.instance) {
1556
- PickerProvider.instance = new PickerProvider();
1557
- }
1558
- return PickerProvider.instance;
1559
- };
1560
- return PickerProvider;
1549
+ };
1550
+ /**
1551
+ * 关闭其他picker
1552
+ * @param e 事件
1553
+ */
1554
+ _proto.closeOther = function closeOther(e) {
1555
+ for (var _iterator = _create_for_of_iterator_helper_loose(this.pickers), _step; !(_step = _iterator()).done;) {
1556
+ var p = _step.value;
1557
+ var _p_$container_contains, _p_$container, _p_$wrapperContent_contains, _p_$wrapperContent;
1558
+ 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)))) {
1559
+ p.open = false;
1560
+ }
1561
+ }
1562
+ };
1563
+ /**
1564
+ * 获取单例实例
1565
+ * @returns Picker 实例
1566
+ */
1567
+ PickerProvider.getInstance = function getInstance() {
1568
+ if (!PickerProvider.instance) {
1569
+ PickerProvider.instance = new PickerProvider();
1570
+ }
1571
+ return PickerProvider.instance;
1572
+ };
1573
+ return PickerProvider;
1561
1574
  }();
1562
1575
  var pickerProvider = PickerProvider.getInstance();
1563
1576
 
1564
1577
  function _defineProperties(target, props) {
1565
- for(var i = 0; i < props.length; i++){
1566
- var descriptor = props[i];
1567
- descriptor.enumerable = descriptor.enumerable || false;
1568
- descriptor.configurable = true;
1569
- if ("value" in descriptor) descriptor.writable = true;
1570
- Object.defineProperty(target, descriptor.key, descriptor);
1571
- }
1578
+ for (var i = 0; i < props.length; i++) {
1579
+ var descriptor = props[i];
1580
+ descriptor.enumerable = descriptor.enumerable || false;
1581
+ descriptor.configurable = true;
1582
+ if ("value" in descriptor) descriptor.writable = true;
1583
+ Object.defineProperty(target, descriptor.key, descriptor);
1584
+ }
1572
1585
  }
1573
1586
  function _create_class(Constructor, protoProps, staticProps) {
1574
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1575
- return Constructor;
1587
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1588
+ return Constructor;
1576
1589
  }
1577
1590
  /**
1578
1591
  * picker 位置
@@ -1582,38 +1595,29 @@
1582
1595
  * | 顶部中间 | 顶部左侧 | 顶部右侧 | 底部中间 | 底部左侧 | 底部右侧 |
1583
1596
  *
1584
1597
  * @public
1585
- */ // eslint-disable-next-line @typescript-eslint/naming-convention
1586
- var _$PICKER_PLACEMENT$_ = [
1587
- "top",
1588
- "tl",
1589
- "tr",
1590
- "bottom",
1591
- "bl",
1592
- "br"
1593
- ];
1598
+ */
1599
+ var _$PICKER_PLACEMENT$_ = ['top', 'tl', 'tr', 'bottom', 'bl', 'br'];
1594
1600
  /**
1595
1601
  * 默认样式前缀
1596
- */ var _$PICKER_PREFIX_CLS$_ = "epicker";
1602
+ */
1603
+ var _$PICKER_PREFIX_CLS$_ = 'epicker';
1597
1604
  /**
1598
1605
  * Picker 默认值
1599
- */ // eslint-disable-next-line @typescript-eslint/naming-convention
1606
+ */
1600
1607
  var __$PICKER_DEFAULT_OPTIONS$__ = {
1601
- getPopupContainer: function() {
1602
- return document.body;
1603
- },
1604
- wrapClassName: "",
1605
- open: false,
1606
- placement: "br",
1607
- offset: [
1608
- 0,
1609
- 0
1610
- ],
1611
- zIndex: 1000,
1612
- content: "",
1613
- trigger: "click",
1614
- mouseLeaveDelay: 0.1,
1615
- mouseEnterDelay: 0.1,
1616
- isMobile: false
1608
+ getPopupContainer: function () {
1609
+ return document.body;
1610
+ },
1611
+ wrapClassName: '',
1612
+ open: false,
1613
+ placement: 'br',
1614
+ offset: [0, 0],
1615
+ zIndex: 1000,
1616
+ content: '',
1617
+ trigger: 'click',
1618
+ mouseLeaveDelay: 0.1,
1619
+ mouseEnterDelay: 0.1,
1620
+ isMobile: false
1617
1621
  };
1618
1622
  /**
1619
1623
  * Picker 弹窗, 支持 PC 和移动端
@@ -1637,389 +1641,397 @@
1637
1641
  * picker.innerHTML('<div>新内容</div>'); // 设置弹窗内容(会覆盖之前的内容)
1638
1642
  * picker.destroy(); // 销毁弹窗
1639
1643
  * ```
1640
- */ var Picker = /*#__PURE__*/ function() {
1641
- function Picker(container, options) {
1642
- var _this__$popupContainer, _this__$popupContainer1;
1643
- /** 是否打开 */ this._open = false;
1644
- this._OpenChange = false;
1645
- this._animationTimer = null;
1646
- this._disabled = false;
1647
- this._timer = null;
1648
- // prettier-ignore
1649
- this._options = Object.assign({}, __$PICKER_DEFAULT_OPTIONS$__, options || {});
1650
- // 移动端模式强制使用 click 触发
1651
- if (this._options.isMobile) this._options.trigger = "click";
1652
- pickerProvider.add(this);
1653
- if (typeof container === "function") this.$container = container();
1654
- else this.$container = container;
1655
- this.$wrapperContent = document.createElement("div");
1656
- this._initContentStyle();
1657
- if (typeof this._options.getPopupContainer === "function") {
1658
- this._$popupContainer = this._options.getPopupContainer();
1659
- } else {
1660
- this._$popupContainer = document.body;
1661
- }
1662
- if ([
1663
- "INPUT",
1664
- "CANVAS",
1665
- "VIDEO",
1666
- "IMG"
1667
- ].includes((_this__$popupContainer = this._$popupContainer) == null ? void 0 : _this__$popupContainer.tagName)) {
1668
- this._$popupContainer = document.body;
1669
- }
1670
- if (this._$popupContainer !== document.body) this._$popupContainer.style.position = "relative";
1671
- (_this__$popupContainer1 = this._$popupContainer) == null ? void 0 : _this__$popupContainer1.appendChild(this.$wrapperContent);
1672
- this._onContentClick = this._onContentClick.bind(this);
1673
- this._onShow = this._onShow.bind(this);
1674
- this._onWrapperShow = this._onWrapperShow.bind(this);
1675
- this._onHide = this._onHide.bind(this);
1676
- this._onDocumentClick = this._onDocumentClick.bind(this);
1677
- this._eventListener();
1678
- this.open = !!this._options.open;
1644
+ */
1645
+ var Picker = /*#__PURE__*/function () {
1646
+
1647
+ function Picker(container, options) {
1648
+ var _this__$popupContainer, _this__$popupContainer1;
1649
+ /** 是否打开 */
1650
+ this._open = false;
1651
+ this._OpenChange = false;
1652
+ this._animationTimer = null;
1653
+ this._disabled = false;
1654
+ this._timer = null;
1655
+ // prettier-ignore
1656
+ this._options = Object.assign({}, __$PICKER_DEFAULT_OPTIONS$__, options || {});
1657
+ // 移动端模式强制使用 click 触发
1658
+ if (this._options.isMobile) this._options.trigger = "click";
1659
+ pickerProvider.add(this);
1660
+ if (typeof container === "function") this.$container = container();else this.$container = container;
1661
+ this.$wrapperContent = document.createElement("div");
1662
+ this._initContentStyle();
1663
+ if (typeof this._options.getPopupContainer === "function") {
1664
+ this._$popupContainer = this._options.getPopupContainer();
1665
+ } else {
1666
+ this._$popupContainer = document.body;
1679
1667
  }
1680
- var _proto = Picker.prototype;
1681
- /**
1682
- * 设置弹出位置(移动端不生效)
1683
- * @param placement - 弹出位置
1684
- * @example
1685
- * ```ts
1686
- * picker.setPlacement("top");
1687
- * picker.setPlacement("tl");
1688
- * picker.setPlacement("tr");
1689
- * picker.setPlacement("bottom");
1690
- * picker.setPlacement("bl");
1691
- * picker.setPlacement("br");
1692
- * ```
1693
- */ _proto.setPlacement = function setPlacement(placement) {
1694
- if (this._disabled) return;
1695
- if (_$PICKER_PLACEMENT$_.includes(placement)) {
1696
- this._options.placement = placement;
1697
- }
1698
- this._setPlacement();
1699
- };
1700
- /**
1701
- * 销毁
1702
- * @example
1703
- * ```ts
1704
- * picker.destroy();
1705
- * ```
1706
- */ _proto.destroy = function destroy() {
1707
- this._animationTimerClear();
1708
- this._removeHtml();
1709
- pickerProvider.remove(this);
1668
+ if (["INPUT", "CANVAS", "VIDEO", "IMG"].includes((_this__$popupContainer = this._$popupContainer) == null ? void 0 : _this__$popupContainer.tagName)) {
1669
+ console.warn("popup container node does not support child elements, default body!");
1670
+ this._$popupContainer = document.body;
1671
+ }
1672
+ if (this._$popupContainer !== document.body) this._$popupContainer.style.position = "relative";
1673
+ (_this__$popupContainer1 = this._$popupContainer) == null ? void 0 : _this__$popupContainer1.appendChild(this.$wrapperContent);
1674
+ this._onContentClick = this._onContentClick.bind(this);
1675
+ this._onShow = this._onShow.bind(this);
1676
+ this._onWrapperShow = this._onWrapperShow.bind(this);
1677
+ this._onHide = this._onHide.bind(this);
1678
+ this._onDocumentClick = this._onDocumentClick.bind(this);
1679
+ this._eventListener();
1680
+ this.open = !!this._options.open;
1681
+ }
1682
+ var _proto = Picker.prototype;
1683
+ /**
1684
+ * 设置弹出位置(移动端不生效)
1685
+ * @param placement - 弹出位置
1686
+ * @example
1687
+ * ```ts
1688
+ * picker.setPlacement("top");
1689
+ * picker.setPlacement("tl");
1690
+ * picker.setPlacement("tr");
1691
+ * picker.setPlacement("bottom");
1692
+ * picker.setPlacement("bl");
1693
+ * picker.setPlacement("br");
1694
+ * ```
1695
+ */
1696
+ _proto.setPlacement = function setPlacement(placement) {
1697
+ if (this._disabled) return;
1698
+ if (_$PICKER_PLACEMENT$_.includes(placement)) {
1699
+ this._options.placement = placement;
1700
+ } else {
1701
+ console.warn("" + placement + " is not a valid placement");
1702
+ }
1703
+ this._setPlacement();
1704
+ };
1705
+ /**
1706
+ * 销毁
1707
+ * @example
1708
+ * ```ts
1709
+ * picker.destroy();
1710
+ * ```
1711
+ */
1712
+ _proto.destroy = function destroy() {
1713
+ this._animationTimerClear();
1714
+ this._removeHtml();
1715
+ pickerProvider.remove(this);
1710
1716
  // this._$popupContainer 的 position 样式不会被移除
1711
- };
1712
- /**
1713
- * 设置内容(会覆盖之前内容)
1714
- * @param html - html 字符串内容
1715
- * @example
1716
- * ```ts
1717
- * picker.innerHTML('<div>内容</div>');
1718
- * ```
1719
- */ _proto.innerHTML = function innerHTML(html) {
1720
- if (this.$body) {
1721
- this.$body.innerHTML = html || "";
1722
- this._setPlacement();
1723
- }
1724
- };
1725
- // --------------------------------------------------------------------------
1726
- // Private methods
1727
- // --------------------------------------------------------------------------
1728
- /**
1729
- * picker 面板展开或关闭变化时触发
1730
- * @param open - true: 展开, false:关闭
1731
- */ _proto._onOpenChange = function _onOpenChange(open) {
1732
- this._options.onOpenChange == null ? void 0 : this._options.onOpenChange.call(this._options, !!open);
1733
- };
1734
- /**
1735
- * 移除动画定时器
1736
- */ _proto._animationTimerClear = function _animationTimerClear() {
1737
- if (this._animationTimer) {
1738
- clearTimeout(this._animationTimer);
1739
- this._animationTimer = null;
1740
- }
1741
- };
1742
- /**
1743
- * 移除html
1744
- */ _proto._removeHtml = function _removeHtml() {
1745
- var // eslint-disable-next-line @typescript-eslint/unbound-method
1746
- _this_$wrapperContent, _this_$container_removeEventListener, _this_$container, _this_$container_removeEventListener1, _this_$container1;
1747
- (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.removeEventListener("click", this._onContentClick);
1748
- (_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);
1749
- if (this._options.trigger === "click") (_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);
1750
- if (this._options.trigger === "hover") {
1751
- var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4, // prettier-ignore
1752
- _this_$wrapperContent1, _this_$wrapperContent2;
1753
- (_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);
1754
- (_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);
1755
- (_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);
1756
- (_this_$wrapperContent1 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent1.removeEventListener("mouseenter", this._onWrapperShow);
1757
- (_this_$wrapperContent2 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent2.removeEventListener("mouseleave", this._onHide);
1758
- }
1759
- if (!this._options.isMobile) {
1760
- // eslint-disable-next-line @typescript-eslint/unbound-method
1761
- window.removeEventListener("blur", this._onHide);
1762
- // eslint-disable-next-line @typescript-eslint/unbound-method
1763
- document.removeEventListener("visibilitychange", this._onHide);
1764
- // eslint-disable-next-line @typescript-eslint/unbound-method
1765
- window.removeEventListener("resize", this._onHide);
1766
- // eslint-disable-next-line @typescript-eslint/unbound-method
1767
- document.removeEventListener("click", this._onDocumentClick);
1768
- }
1769
- if (this._$mask) {
1770
- this._$mask.removeEventListener("click", this._onHide);
1771
- this._$mask.remove();
1772
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1773
- this._$mask = null;
1774
- }
1775
- if (this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1776
- if (this.$wrapperContent) {
1777
- this.$wrapperContent.remove();
1778
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1779
- this.$wrapperContent = null;
1780
- }
1781
- };
1782
- /**
1783
- * 现实位置
1784
- */ _proto._setPlacement = function _setPlacement() {
1785
- var _this_$container_getBoundingClientRect, _this_$container;
1786
- if (!this._open || this._options.isMobile || !this.$container) return;
1787
- var $containerRect = (_this_$container = this.$container) == null ? void 0 : (_this_$container_getBoundingClientRect = _this_$container.getBoundingClientRect) == null ? void 0 : _this_$container_getBoundingClientRect.call(_this_$container);
1788
- var $wrapperContentRect = this.$wrapperContent.getBoundingClientRect();
1789
- var $popupContainerRect = this._$popupContainer.getBoundingClientRect();
1790
- // 容器的坐标 - 挂载的容器的坐标差
1791
- // prettier-ignore
1792
- var containerLeft = $containerRect.left - $popupContainerRect.left;
1793
- var containerRight = -($containerRect.right - $popupContainerRect.right);
1717
+ };
1718
+ /**
1719
+ * 设置内容(会覆盖之前内容)
1720
+ * @param html - html 字符串内容
1721
+ * @example
1722
+ * ```ts
1723
+ * picker.innerHTML('<div>内容</div>');
1724
+ * ```
1725
+ */
1726
+ _proto.innerHTML = function innerHTML(html) {
1727
+ if (this.$body) {
1728
+ this.$body.innerHTML = html || '';
1729
+ this._setPlacement();
1730
+ }
1731
+ };
1732
+ // --------------------------------------------------------------------------
1733
+ // Private methods
1734
+ // --------------------------------------------------------------------------
1735
+ /**
1736
+ * picker 面板展开或关闭变化时触发
1737
+ * @param open - true: 展开, false:关闭
1738
+ */
1739
+ _proto._onOpenChange = function _onOpenChange(open) {
1740
+ this._options.onOpenChange == null ? void 0 : this._options.onOpenChange.call(this._options, !!open);
1741
+ };
1742
+ /**
1743
+ * 移除动画定时器
1744
+ */
1745
+ _proto._animationTimerClear = function _animationTimerClear() {
1746
+ if (this._animationTimer) {
1747
+ clearTimeout(this._animationTimer);
1748
+ this._animationTimer = null;
1749
+ }
1750
+ };
1751
+ /**
1752
+ * 移除html
1753
+ */
1754
+ _proto._removeHtml = function _removeHtml() {
1755
+ var _this_$wrapperContent, _this_$container_removeEventListener, _this_$container, _this_$container_removeEventListener1, _this_$container1;
1756
+ (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.removeEventListener('click', this._onContentClick);
1757
+ (_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);
1758
+ if (this._options.trigger === 'click') (_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);
1759
+ if (this._options.trigger === 'hover') {
1760
+ var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4,
1794
1761
  // prettier-ignore
1795
- var containerTop = $containerRect.y - $popupContainerRect.y;
1796
- var left = containerLeft + ($containerRect.width - $wrapperContentRect.width) / 2;
1797
- var right;
1798
- var top = containerTop - $wrapperContentRect.height;
1799
- var bottom = containerTop + $containerRect.height;
1800
- if (/^t/.test(this._options.placement)) {
1801
- var _this__options_offset, _this__options_offset1, _this__options_offset2;
1802
- switch(this._options.placement){
1803
- case "top":
1804
- right = undefined;
1805
- break;
1806
- case "tl":
1807
- right = undefined;
1808
- left = containerLeft;
1809
- break;
1810
- case "tr":
1811
- left = undefined;
1812
- right = containerRight;
1813
- break;
1814
- }
1815
- this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset = this._options.offset) == null ? void 0 : _this__options_offset[0]) || 0)) + "px;" : "") + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset1 = this._options.offset) == null ? void 0 : _this__options_offset1[0]) || 0)) + "px;" : "") + "\n top: " + (top + (((_this__options_offset2 = this._options.offset) == null ? void 0 : _this__options_offset2[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
1816
- } else if (/^b/.test(this._options.placement)) {
1817
- var _this__options_offset3, _this__options_offset4, _this__options_offset5;
1818
- switch(this._options.placement){
1819
- case "bottom":
1820
- right = undefined;
1821
- break;
1822
- case "bl":
1823
- right = undefined;
1824
- left = containerLeft;
1825
- break;
1826
- case "br":
1827
- left = undefined;
1828
- right = containerRight;
1829
- break;
1830
- }
1831
- if (this.$wrapperContent) this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset3 = this._options.offset) == null ? void 0 : _this__options_offset3[0]) || 0)) + "px;" : "") + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset4 = this._options.offset) == null ? void 0 : _this__options_offset4[0]) || 0)) + "px;" : "") + "\n top: " + (bottom + (((_this__options_offset5 = this._options.offset) == null ? void 0 : _this__options_offset5[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
1832
- }
1833
- };
1762
+ _this_$wrapperContent1, _this_$wrapperContent2;
1763
+ (_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);
1764
+ (_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);
1765
+ (_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);
1766
+ (_this_$wrapperContent1 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent1.removeEventListener("mouseenter", this._onWrapperShow);
1767
+ (_this_$wrapperContent2 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent2.removeEventListener('mouseleave', this._onHide);
1768
+ }
1769
+ if (!this._options.isMobile) {
1770
+ window.removeEventListener('blur', this._onHide);
1771
+ document.removeEventListener('visibilitychange', this._onHide);
1772
+ window.removeEventListener('resize', this._onHide);
1773
+ document.removeEventListener('click', this._onDocumentClick);
1774
+ }
1775
+ if (this._$mask) {
1776
+ this._$mask.removeEventListener('click', this._onHide);
1777
+ this._$mask.remove();
1778
+ this._$mask = null;
1779
+ }
1780
+ if (this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1781
+ if (this.$wrapperContent) {
1782
+ this.$wrapperContent.remove();
1783
+ this.$wrapperContent = null;
1784
+ }
1785
+ };
1786
+ /**
1787
+ * 现实位置
1788
+ */
1789
+ _proto._setPlacement = function _setPlacement() {
1790
+ var _this_$container_getBoundingClientRect, _this_$container;
1791
+ if (!this._open || this._options.isMobile || !this.$container) return;
1792
+ var $containerRect = (_this_$container = this.$container) == null ? void 0 : (_this_$container_getBoundingClientRect = _this_$container.getBoundingClientRect) == null ? void 0 : _this_$container_getBoundingClientRect.call(_this_$container);
1793
+ var $wrapperContentRect = this.$wrapperContent.getBoundingClientRect();
1794
+ var $popupContainerRect = this._$popupContainer.getBoundingClientRect();
1795
+ // 容器的坐标 - 挂载的容器的坐标差
1796
+ // prettier-ignore
1797
+ var containerLeft = $containerRect.left - $popupContainerRect.left;
1798
+ var containerRight = -($containerRect.right - $popupContainerRect.right);
1799
+ // prettier-ignore
1800
+ var containerTop = $containerRect.y - $popupContainerRect.y;
1801
+ var left = containerLeft + ($containerRect.width - $wrapperContentRect.width) / 2;
1802
+ var right;
1803
+ var top = containerTop - $wrapperContentRect.height;
1804
+ var bottom = containerTop + $containerRect.height;
1805
+ if (/^t/.test(this._options.placement)) {
1806
+ var _this__options_offset, _this__options_offset1, _this__options_offset2;
1807
+ switch (this._options.placement) {
1808
+ case 'top':
1809
+ right = undefined;
1810
+ break;
1811
+ case 'tl':
1812
+ right = undefined;
1813
+ left = containerLeft;
1814
+ break;
1815
+ case 'tr':
1816
+ left = undefined;
1817
+ right = containerRight;
1818
+ break;
1819
+ }
1820
+ this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset = this._options.offset) == null ? void 0 : _this__options_offset[0]) || 0)) + "px;" : '') + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset1 = this._options.offset) == null ? void 0 : _this__options_offset1[0]) || 0)) + "px;" : '') + "\n top: " + (top + (((_this__options_offset2 = this._options.offset) == null ? void 0 : _this__options_offset2[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
1821
+ } else if (/^b/.test(this._options.placement)) {
1822
+ var _this__options_offset3, _this__options_offset4, _this__options_offset5;
1823
+ switch (this._options.placement) {
1824
+ case 'bottom':
1825
+ right = undefined;
1826
+ break;
1827
+ case 'bl':
1828
+ right = undefined;
1829
+ left = containerLeft;
1830
+ break;
1831
+ case 'br':
1832
+ left = undefined;
1833
+ right = containerRight;
1834
+ break;
1835
+ }
1836
+ if (this.$wrapperContent) this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset3 = this._options.offset) == null ? void 0 : _this__options_offset3[0]) || 0)) + "px;" : '') + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset4 = this._options.offset) == null ? void 0 : _this__options_offset4[0]) || 0)) + "px;" : '') + "\n top: " + (bottom + (((_this__options_offset5 = this._options.offset) == null ? void 0 : _this__options_offset5[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
1837
+ }
1838
+ };
1839
+ /**
1840
+ * 初始化内容样式
1841
+ */
1842
+ _proto._initContentStyle = function _initContentStyle() {
1843
+ if (!this.$wrapperContent) return;
1844
+ // prettier-ignore
1845
+ this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_, "" + _$PICKER_PREFIX_CLS$_ + "-wrapper", _$PICKER_PREFIX_CLS$_ + "-" + this._options.placement);
1846
+ // 提升优先级
1847
+ this.$wrapperContent.style.display = 'none';
1848
+ if (this._options.isMobile) {
1849
+ this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mobile");
1850
+ this._$mask = document.createElement('div');
1851
+ this._$mask.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mask");
1852
+ this.$wrapperContent.appendChild(this._$mask);
1853
+ }
1854
+ this.$body = document.createElement('div');
1855
+ this.$body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body");
1856
+ this.$wrapperContent.appendChild(this.$body);
1857
+ if (typeof this._options.content === 'string') {
1858
+ this.innerHTML(this._options.content);
1859
+ } else if (typeof this._options.content === 'function') {
1860
+ this.innerHTML(this._options.content == null ? void 0 : this._options.content.call(this._options));
1861
+ }
1862
+ if (typeof this._options.wrapClassName === 'string') {
1863
+ try {
1864
+ var _this_$wrapperContent_classList;
1865
+ var _this_$wrapperContent;
1866
+ (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : (_this_$wrapperContent_classList = _this_$wrapperContent.classList).add.apply(_this_$wrapperContent_classList, [].concat(this._options.wrapClassName.split(' ')));
1867
+ } catch (_error) {
1868
+ //
1869
+ }
1870
+ }
1871
+ };
1872
+ /**
1873
+ * 绑定事件
1874
+ */
1875
+ _proto._eventListener = function _eventListener() {
1876
+ var _this_$container_addEventListener, _this_$container, _this_$container_addEventListener1, _this_$container1;
1877
+ this.$wrapperContent.addEventListener('click', this._onContentClick);
1878
+ (_this_$container = this.$container) == null ? void 0 : (_this_$container_addEventListener = _this_$container.addEventListener) == null ? void 0 : _this_$container_addEventListener.call(_this_$container, 'click', this._onContentClick);
1879
+ //
1880
+ if (this._options.trigger === 'click') (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_addEventListener1 = _this_$container1.addEventListener) == null ? void 0 : _this_$container_addEventListener1.call(_this_$container1, 'click', this._onShow);
1881
+ if (this._options.trigger === 'hover') {
1882
+ var _this_$container_addEventListener2, _this_$container2, _this_$container_addEventListener3, _this_$container3, _this_$container_addEventListener4, _this_$container4;
1883
+ (_this_$container2 = this.$container) == null ? void 0 : (_this_$container_addEventListener2 = _this_$container2.addEventListener) == null ? void 0 : _this_$container_addEventListener2.call(_this_$container2, 'mouseenter', this._onShow);
1884
+ (_this_$container3 = this.$container) == null ? void 0 : (_this_$container_addEventListener3 = _this_$container3.addEventListener) == null ? void 0 : _this_$container_addEventListener3.call(_this_$container3, 'mouseover', this._onShow);
1885
+ (_this_$container4 = this.$container) == null ? void 0 : (_this_$container_addEventListener4 = _this_$container4.addEventListener) == null ? void 0 : _this_$container_addEventListener4.call(_this_$container4, 'mouseleave', this._onHide);
1886
+ this.$wrapperContent.addEventListener('mouseenter', this._onWrapperShow);
1887
+ this.$wrapperContent.addEventListener('mouseleave', this._onHide);
1888
+ }
1889
+ if (this._$mask) this._$mask.addEventListener('click', this._onHide);
1890
+ if (!this._options.isMobile) {
1891
+ window.addEventListener('blur', this._onHide);
1892
+ document.addEventListener('visibilitychange', this._onHide);
1893
+ window.addEventListener('resize', this._onHide);
1894
+ document.addEventListener('click', this._onDocumentClick);
1895
+ }
1896
+ };
1897
+ /**
1898
+ * $wrapperContent click event
1899
+ * @param e - 内容点击事件
1900
+ */
1901
+ _proto._onContentClick = function _onContentClick(e) {
1902
+ pickerProvider.closeOther(e);
1903
+ };
1904
+ /**
1905
+ * 显示事件
1906
+ */
1907
+ _proto._onShow = function _onShow() {
1908
+ if (this._disabled) return;
1909
+ this.open = true;
1910
+ };
1911
+ /**
1912
+ * $wrapperContent 显示事件(输入进入前 为 false 阻止设置为 true)
1913
+ */
1914
+ _proto._onWrapperShow = function _onWrapperShow() {
1915
+ if (this._disabled) return;
1916
+ this._onShow();
1917
+ };
1918
+ /**
1919
+ * 隐藏事件
1920
+ */
1921
+ _proto._onHide = function _onHide(e) {
1922
+ if (!this._open || this._disabled) return;
1923
+ if ((e == null ? void 0 : e.target) === this._$mask) e == null ? void 0 : e.stopPropagation();
1924
+ this.open = false;
1925
+ };
1926
+ /**
1927
+ * document 点击事件
1928
+ * @param event - 鼠标点击事件
1929
+ */
1930
+ _proto._onDocumentClick = function _onDocumentClick(event) {
1931
+ var _this_$container;
1932
+ if (!(this.$wrapperContent.contains(event.target) || this.$wrapperContent === event.target || ((_this_$container = this.$container) == null ? void 0 : _this_$container.contains(event.target)) || this.$container === event.target)) {
1933
+ if (this._disabled) return;
1934
+ this._onHide();
1935
+ }
1936
+ };
1937
+ _create_class(Picker, [{
1938
+ key: "open",
1939
+ get:
1834
1940
  /**
1835
- * 初始化内容样式
1836
- */ _proto._initContentStyle = function _initContentStyle() {
1837
- if (!this.$wrapperContent) return;
1838
- // prettier-ignore
1839
- this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_, "" + _$PICKER_PREFIX_CLS$_ + "-wrapper", _$PICKER_PREFIX_CLS$_ + "-" + this._options.placement);
1840
- // 提升优先级
1841
- this.$wrapperContent.style.display = "none";
1842
- if (this._options.isMobile) {
1843
- this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mobile");
1844
- this._$mask = document.createElement("div");
1845
- this._$mask.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mask");
1846
- this.$wrapperContent.appendChild(this._$mask);
1847
- }
1848
- this.$body = document.createElement("div");
1849
- this.$body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body");
1850
- this.$wrapperContent.appendChild(this.$body);
1851
- if (typeof this._options.content === "string") {
1852
- this.innerHTML(this._options.content);
1853
- } else if (typeof this._options.content === "function") {
1854
- this.innerHTML(this._options.content == null ? void 0 : this._options.content.call(this._options));
1855
- }
1856
- if (typeof this._options.wrapClassName === "string") {
1857
- try {
1858
- var _this_$wrapperContent_classList;
1859
- var _this_$wrapperContent;
1860
- (_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : (_this_$wrapperContent_classList = _this_$wrapperContent.classList).add.apply(_this_$wrapperContent_classList, [].concat(this._options.wrapClassName.split(" ")));
1861
- } catch (error) {}
1941
+ * 获取当前打开状态
1942
+ * @example
1943
+ * ```ts
1944
+ * console.log(picker.open); // 获取当前打开状态
1945
+ * picker.open = true; // 打开
1946
+ * picker.open = false; // 关闭
1947
+ * ```
1948
+ */
1949
+ function get() {
1950
+ return this._open;
1951
+ },
1952
+ set: function set(open) {
1953
+ var _this = this;
1954
+ if (this._disabled) return;
1955
+ if (this._open !== !!open) {
1956
+ this._animationTimerClear();
1957
+ if (this._timer) {
1958
+ clearTimeout(this._timer);
1959
+ this._timer = null;
1862
1960
  }
1863
- };
1864
- /**
1865
- * 绑定事件
1866
- */ _proto._eventListener = function _eventListener() {
1867
- var _this_$container_addEventListener, _this_$container, _this_$container_addEventListener1, _this_$container1;
1868
- // eslint-disable-next-line @typescript-eslint/unbound-method
1869
- this.$wrapperContent.addEventListener("click", this._onContentClick);
1870
- (_this_$container = this.$container) == null ? void 0 : (_this_$container_addEventListener = _this_$container.addEventListener) == null ? void 0 : _this_$container_addEventListener.call(_this_$container, "click", this._onContentClick);
1871
- //
1872
- if (this._options.trigger === "click") (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_addEventListener1 = _this_$container1.addEventListener) == null ? void 0 : _this_$container_addEventListener1.call(_this_$container1, "click", this._onShow);
1873
- if (this._options.trigger === "hover") {
1874
- var _this_$container_addEventListener2, _this_$container2, _this_$container_addEventListener3, _this_$container3, _this_$container_addEventListener4, _this_$container4;
1875
- (_this_$container2 = this.$container) == null ? void 0 : (_this_$container_addEventListener2 = _this_$container2.addEventListener) == null ? void 0 : _this_$container_addEventListener2.call(_this_$container2, "mouseenter", this._onShow);
1876
- (_this_$container3 = this.$container) == null ? void 0 : (_this_$container_addEventListener3 = _this_$container3.addEventListener) == null ? void 0 : _this_$container_addEventListener3.call(_this_$container3, "mouseover", this._onShow);
1877
- (_this_$container4 = this.$container) == null ? void 0 : (_this_$container_addEventListener4 = _this_$container4.addEventListener) == null ? void 0 : _this_$container_addEventListener4.call(_this_$container4, "mouseleave", this._onHide);
1878
- this.$wrapperContent.addEventListener("mouseenter", this._onWrapperShow);
1879
- this.$wrapperContent.addEventListener("mouseleave", this._onHide);
1961
+ if (open) {
1962
+ // prettier-ignore
1963
+ this._timer = setTimeout(function () {
1964
+ if (!_this.$wrapperContent) return;
1965
+ _this.$wrapperContent.style.display = "inline-flex";
1966
+ _this.$wrapperContent.style.pointerEvents = "";
1967
+ // prettier-ignore
1968
+ if (_this._options.isMobile) document.body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1969
+ _this._animationTimer = setTimeout(function () {
1970
+ _this._animationTimerClear();
1971
+ _this.$wrapperContent.style.opacity = "1";
1972
+ }, 0);
1973
+ requestAnimationFrame(function () {
1974
+ _this._setPlacement();
1975
+ });
1976
+ _this._OpenChange = open;
1977
+ _this._onOpenChange(open);
1978
+ },
1979
+ // prettier-ignore
1980
+ (this._options.mouseEnterDelay < 0 ? 0 : this._options.mouseEnterDelay) * 1000);
1981
+ } else {
1982
+ // prettier-ignore
1983
+ this._timer = setTimeout(function () {
1984
+ if (!_this.$wrapperContent) return;
1985
+ _this.$wrapperContent.style.opacity = "0";
1986
+ _this.$wrapperContent.style.pointerEvents = "none";
1987
+ // prettier-ignore
1988
+ if (_this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1989
+ _this._animationTimer = setTimeout(function () {
1990
+ _this._animationTimerClear();
1991
+ _this.$wrapperContent.style.display = "none";
1992
+ }, 301); // css 动画是 300ms
1993
+ _this._OpenChange = open;
1994
+ _this._onOpenChange(open);
1995
+ },
1996
+ // prettier-ignore
1997
+ (this._options.mouseLeaveDelay < 0 ? 0 : this._options.mouseLeaveDelay) * 1000);
1880
1998
  }
1881
- if (this._$mask) this._$mask.addEventListener("click", this._onHide);
1882
- if (!this._options.isMobile) {
1883
- // eslint-disable-next-line @typescript-eslint/unbound-method
1884
- window.addEventListener("blur", this._onHide);
1885
- // eslint-disable-next-line @typescript-eslint/unbound-method
1886
- document.addEventListener("visibilitychange", this._onHide);
1887
- // eslint-disable-next-line @typescript-eslint/unbound-method
1888
- window.addEventListener("resize", this._onHide);
1889
- // eslint-disable-next-line @typescript-eslint/unbound-method
1890
- document.addEventListener("click", this._onDocumentClick);
1999
+ if (this._OpenChange === open) {
2000
+ if (this._timer) {
2001
+ clearTimeout(this._timer);
2002
+ this._timer = null;
2003
+ }
1891
2004
  }
1892
- };
1893
- /**
1894
- * $wrapperContent click event
1895
- * @param e - 内容点击事件
1896
- */ _proto._onContentClick = function _onContentClick(e) {
1897
- pickerProvider.closeOther(e);
1898
- };
1899
- /**
1900
- * 显示事件
1901
- */ _proto._onShow = function _onShow() {
1902
- if (this._disabled) return;
1903
- this.open = true;
1904
- };
1905
- /**
1906
- * $wrapperContent 显示事件(输入进入前 为 false 阻止设置为 true)
1907
- */ _proto._onWrapperShow = function _onWrapperShow() {
1908
- if (this._disabled) return;
1909
- this._onShow();
1910
- };
1911
- /**
1912
- * 隐藏事件
1913
- */ _proto._onHide = function _onHide(e) {
1914
- if (!this._open || this._disabled) return;
1915
- if ((e == null ? void 0 : e.target) === this._$mask) e == null ? void 0 : e.stopPropagation();
1916
- this.open = false;
1917
- };
2005
+ this._open = !!open;
2006
+ }
2007
+ }
2008
+ }, {
2009
+ key: "disabled",
2010
+ get:
1918
2011
  /**
1919
- * document 点击事件
1920
- * @param event - 鼠标点击事件
1921
- */ _proto._onDocumentClick = function _onDocumentClick(event) {
1922
- var _this_$container;
1923
- if (!(this.$wrapperContent.contains(event.target) || this.$wrapperContent === event.target || ((_this_$container = this.$container) == null ? void 0 : _this_$container.contains(event.target)) || this.$container === event.target)) {
1924
- if (this._disabled) return;
1925
- this._onHide();
1926
- }
1927
- };
1928
- _create_class(Picker, [
1929
- {
1930
- key: "open",
1931
- get: /**
1932
- * 获取当前打开状态
1933
- * @example
1934
- * ```ts
1935
- * console.log(picker.open); // 获取当前打开状态
1936
- * picker.open = true; // 打开
1937
- * picker.open = false; // 关闭
1938
- * ```
1939
- */ function get() {
1940
- return this._open;
1941
- },
1942
- set: function set(open) {
1943
- var _this = this;
1944
- if (this._disabled) return;
1945
- if (this._open !== !!open) {
1946
- this._animationTimerClear();
1947
- if (this._timer) {
1948
- clearTimeout(this._timer);
1949
- this._timer = null;
1950
- }
1951
- if (open) {
1952
- // prettier-ignore
1953
- this._timer = setTimeout(function() {
1954
- if (!_this.$wrapperContent) return;
1955
- _this.$wrapperContent.style.display = "inline-flex";
1956
- _this.$wrapperContent.style.pointerEvents = "";
1957
- // prettier-ignore
1958
- if (_this._options.isMobile) document.body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1959
- _this._animationTimer = setTimeout(function() {
1960
- _this._animationTimerClear();
1961
- _this.$wrapperContent.style.opacity = "1";
1962
- }, 0);
1963
- requestAnimationFrame(function() {
1964
- _this._setPlacement();
1965
- });
1966
- _this._OpenChange = open;
1967
- _this._onOpenChange(open);
1968
- }, // prettier-ignore
1969
- (this._options.mouseEnterDelay < 0 ? 0 : this._options.mouseEnterDelay) * 1000);
1970
- } else {
1971
- // prettier-ignore
1972
- this._timer = setTimeout(function() {
1973
- if (!_this.$wrapperContent) return;
1974
- _this.$wrapperContent.style.opacity = "0";
1975
- _this.$wrapperContent.style.pointerEvents = "none";
1976
- // prettier-ignore
1977
- if (_this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
1978
- _this._animationTimer = setTimeout(function() {
1979
- _this._animationTimerClear();
1980
- _this.$wrapperContent.style.display = "none";
1981
- }, 301); // css 动画是 300ms
1982
- _this._OpenChange = open;
1983
- _this._onOpenChange(open);
1984
- }, // prettier-ignore
1985
- (this._options.mouseLeaveDelay < 0 ? 0 : this._options.mouseLeaveDelay) * 1000);
1986
- }
1987
- if (this._OpenChange === open) {
1988
- if (this._timer) {
1989
- clearTimeout(this._timer);
1990
- this._timer = null;
1991
- }
1992
- }
1993
- this._open = !!open;
1994
- }
1995
- }
1996
- },
1997
- {
1998
- key: "disabled",
1999
- get: /**
2000
- * 获取或设置禁用状态
2001
- * @example
2002
- * ```ts
2003
- * picker.disabled = true; // 禁用
2004
- * picker.disabled = false; // 启用
2005
- * console.log(picker.disabled); // 获取禁用状态
2006
- * ```
2007
- */ function get() {
2008
- return this._disabled;
2009
- },
2010
- set: function set(disabled) {
2011
- if (disabled) {
2012
- var _this_$container_classList_add, _this_$container_classList, _this_$container;
2013
- (_this_$container = this.$container) == null ? void 0 : (_this_$container_classList = _this_$container.classList) == null ? void 0 : (_this_$container_classList_add = _this_$container_classList.add) == null ? void 0 : _this_$container_classList_add.call(_this_$container_classList, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
2014
- } else {
2015
- var _this_$container_classList_remove, _this_$container_classList1, _this_$container1;
2016
- (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_classList1 = _this_$container1.classList) == null ? void 0 : (_this_$container_classList_remove = _this_$container_classList1.remove) == null ? void 0 : _this_$container_classList_remove.call(_this_$container_classList1, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
2017
- }
2018
- this._disabled = disabled;
2019
- }
2020
- }
2021
- ]);
2022
- return Picker;
2012
+ * 获取或设置禁用状态
2013
+ * @example
2014
+ * ```ts
2015
+ * picker.disabled = true; // 禁用
2016
+ * picker.disabled = false; // 启用
2017
+ * console.log(picker.disabled); // 获取禁用状态
2018
+ * ```
2019
+ */
2020
+ function get() {
2021
+ return this._disabled;
2022
+ },
2023
+ set: function set(disabled) {
2024
+ if (disabled) {
2025
+ var _this_$container_classList_add, _this_$container_classList, _this_$container;
2026
+ (_this_$container = this.$container) == null ? void 0 : (_this_$container_classList = _this_$container.classList) == null ? void 0 : (_this_$container_classList_add = _this_$container_classList.add) == null ? void 0 : _this_$container_classList_add.call(_this_$container_classList, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
2027
+ } else {
2028
+ var _this_$container_classList_remove, _this_$container_classList1, _this_$container1;
2029
+ (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_classList1 = _this_$container1.classList) == null ? void 0 : (_this_$container_classList_remove = _this_$container_classList1.remove) == null ? void 0 : _this_$container_classList_remove.call(_this_$container_classList1, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
2030
+ }
2031
+ this._disabled = disabled;
2032
+ }
2033
+ }]);
2034
+ return Picker;
2023
2035
  }();
2024
2036
  /**
2025
2037
  * 版本号
@@ -2027,7 +2039,8 @@
2027
2039
  * ```ts
2028
2040
  * Picker.VERSION; // 输出版本号
2029
2041
  * ```
2030
- */ Picker.VERSION = "1.1.2";
2042
+ */
2043
+ Picker.VERSION = '1.1.5';
2031
2044
 
2032
2045
  dist$a = Picker;
2033
2046
  return dist$a;
@@ -2313,92 +2326,19 @@
2313
2326
 
2314
2327
  var dist$8 = {};
2315
2328
 
2329
+ /*
2330
+ * @ezuikit/utils-tools v2.0.1-beta.1
2331
+ * tools utils
2332
+ * Copyright (c) 2025-11-16 Ezviz-OpenBiz
2333
+ * Released under the MIT License.
2334
+ */
2335
+
2316
2336
  var hasRequiredDist$8;
2317
2337
 
2318
2338
  function requireDist$8 () {
2319
2339
  if (hasRequiredDist$8) return dist$8;
2320
2340
  hasRequiredDist$8 = 1;
2321
-
2322
- var getQuery = function(url) {
2323
- var query = url.split("?")[1], obj = {};
2324
- if (query) for (var vars = query.split("&"), i = 0; i < vars.length; i++) {
2325
- var pair = vars[i].split("=");
2326
- obj[pair[0]] = decodeURIComponent(pair[1]);
2327
- }
2328
- return obj;
2329
- };
2330
-
2331
- function parseEzopenUrl(url) {
2332
- var obj = {};
2333
- if (/^ezopen:\/\//.test(url)) {
2334
- if (url.includes("@")) {
2335
- var endIndex = url.indexOf("@"), startIndex = url.indexOf("//");
2336
- obj.validateCode = url.substring(startIndex + 2, endIndex), url = url.replace(obj.validateCode + "@", "");
2337
- }
2338
- obj.protocol = url.split("//")[0], obj.search = url.split("?")[1] ? "?" + url.split("?")[1] : "",
2339
- obj.hostname = url.split("/")[2], obj.origin = obj.protocol + "//" + obj.hostname,
2340
- obj.pathname = url.split("?")[0].replace(obj.origin, ""), obj.href = url;
2341
- var pathnames = obj.pathname.split("/"), lastPath = pathnames[2].split(".");
2342
- return obj.deviceSerial = pathnames[1], obj.channelNo = lastPath[0], obj.type = lastPath[lastPath.length - 1],
2343
- "live" === obj.type && (obj.definition = lastPath.length > 2 ? lastPath[1] : "sd"),
2344
- "rec" === obj.type && pathnames[2] && (obj.recType = pathnames[2].includes(".cloud.") ? "cloud" : ""),
2345
- obj.searchParams = getQuery(url), obj;
2346
- }
2347
- return {};
2348
- }
2349
-
2350
- var __$codec$__ = {
2351
- h264: 1,
2352
- h265: 2,
2353
- h266: 4,
2354
- vp8: 8,
2355
- vp9: 16,
2356
- av1: 32
2357
- };
2358
-
2359
- dist$8.addVc = function(url, codecs) {
2360
- void 0 === codecs && (codecs = [ "h264" ]);
2361
- var vc = (codecs || [ "h264" ]).reduce(function(acc, key) {
2362
- return key = key.toLowerCase(), acc + (__$codec$__[key] || 0);
2363
- }, 0), host = url.split("?")[0], query = url.split("?")[1];
2364
- return query = (query || "").split("&").filter(function(item) {
2365
- return !/^vc=\d?/.test(item);
2366
- }).join("&"), host + "?" + (query += (query ? "&" : "") + "vc=" + vc);
2367
- }, dist$8.getQuery = getQuery, dist$8.getStaticPath = function(path, base) {
2368
- void 0 === base && (base = "");
2369
- var protocolReg = /^(https?:\/\/|^\/\/)/;
2370
- if ("" === path || void 0 === path) return "";
2371
- if (protocolReg.test(path)) return path;
2372
- path = path.replace(/\/+/g, "/"), base = protocolReg.test(base || "") ? base : window.location.href;
2373
- try {
2374
- return new URL(path, base).href;
2375
- } catch (error) {
2376
- return path;
2377
- }
2378
- }, dist$8.isHttp = function(url) {
2379
- return /^http[s]?:\/\//.test(url);
2380
- }, dist$8.isMobile = function(agent) {
2381
- var _navigator, _navigator1, _navigator2, _window;
2382
- return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null != agent ? agent : null == (_navigator = navigator) ? void 0 : _navigator.userAgent) || /Macintosh/i.test(null == (_navigator1 = navigator) ? void 0 : _navigator1.userAgent) && (null == (_navigator2 = navigator) ? void 0 : _navigator2.maxTouchPoints) > 1 || (null == (_window = window) ? void 0 : _window.__IS_MOBILE_SIMULATOR__);
2383
- }, dist$8.parseEzopenUrl = parseEzopenUrl, dist$8.pick = function(obj, keys) {
2384
- return Object.entries(obj).reduce(function(acc, param) {
2385
- var key = param[0], value = param[1];
2386
- return keys.includes(key) && (acc[key] = value), acc;
2387
- }, {});
2388
- }, dist$8.switchEzopenUrl = function(url, options) {
2389
- var _ref = null != options ? options : {}, type = _ref.type, recType = _ref.recType, search = _ref.search, definition = _ref.definition, channelNo = _ref.channelNo, deviceSerial = _ref.deviceSerial, validateCode = _ref.validateCode, obj = parseEzopenUrl(url);
2390
- if (search) {
2391
- var ns = Object.assign({}, obj.searchParams, getQuery("?" + search.replace("?", "")));
2392
- search = Object.entries(ns).reduce(function(acc, param) {
2393
- var key = param[0], value = param[1];
2394
- return "" === value ? acc : acc += key + "=" + encodeURIComponent(value) + "&";
2395
- }, "?").replace(/&$/, "");
2396
- } else search = obj.search;
2397
- return type = type || obj.type, recType = null != recType ? recType : obj.recType,
2398
- definition = null != definition ? definition : obj.definition, channelNo = channelNo || obj.channelNo,
2399
- deviceSerial = deviceSerial || obj.deviceSerial, validateCode = null != validateCode ? validateCode : obj.validateCode,
2400
- obj.protocol + "//" + (validateCode ? validateCode + "@" : "") + obj.hostname + "/" + deviceSerial + "/" + channelNo + ("rec" === type && recType ? "." + recType : "") + ("live" === type && "hd" === definition ? "." + definition : "") + "." + type + search;
2401
- };
2341
+ var getQuery=function(url){var query=url.split("?")[1],obj={};if(query)for(var vars=query.split("&"),i=0;i<vars.length;i++){var pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1]);}return obj};function parseEzopenUrl(url){var obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){var endIndex=url.indexOf("@"),startIndex=url.indexOf("//");obj.validateCode=url.substring(startIndex+2,endIndex),url=url.replace(obj.validateCode+"@","");}obj.protocol=url.split("//")[0],obj.search=url.split("?")[1]?"?"+url.split("?")[1]:"",obj.hostname=url.split("/")[2],obj.origin=obj.protocol+"//"+obj.hostname,obj.pathname=url.split("?")[0].replace(obj.origin,""),obj.href=url;var pathnames=obj.pathname.split("/"),lastPath=pathnames[2].split(".");return obj.deviceSerial=pathnames[1],obj.channelNo=lastPath[0],obj.type=lastPath[lastPath.length-1],"live"===obj.type&&(obj.definition=lastPath.length>2?lastPath[1]:"sd"),"rec"===obj.type&&pathnames[2]&&(obj.recType=pathnames[2].includes(".cloud.")?"cloud":""),obj.searchParams=getQuery(url),obj}return {}}var codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};dist$8.addVc=function(url,codecs){ void 0===codecs&&(codecs=["h264"]);var vc=(codecs||["h264"]).reduce((function(acc,key){return key=key.toLowerCase(),acc+(codec[key]||0)}),0),host=url.split("?")[0],query=url.split("?")[1];return query=(query||"").split("&").filter((function(item){return !/^vc=\d?/.test(item)})).join("&"),host+"?"+(query+=(query?"&":"")+"vc="+vc)},dist$8.getQuery=getQuery,dist$8.getStaticPath=function(path,base){ void 0===base&&(base="");var protocolReg=/^(https?:\/\/|^\/\/)/;if(""===path||void 0===path)return "";if(protocolReg.test(path))return path;path=path.replace(/\/+/g,"/"),base=protocolReg.test(base||"")?base:window.location.href;try{return new URL(path,base).href}catch(error){return path}},dist$8.isHttp=function(url){return /^http[s]?:\/\//.test(url)},dist$8.isMobile=function(agent){var _navigator,_navigator1,_navigator2,_window;return /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone|Opera Mini)/i.test(null!=agent?agent:null==(_navigator=navigator)?void 0:_navigator.userAgent)||/Macintosh/i.test(agent||(null==(_navigator1=navigator)?void 0:_navigator1.userAgent))&&(null==(_navigator2=navigator)?void 0:_navigator2.maxTouchPoints)>1||!!(null==(_window=window)?void 0:_window.__IS_MOBILE_SIMULATOR__)},dist$8.parseEzopenUrl=parseEzopenUrl,dist$8.pick=function(obj,keys){return Object.entries(obj).reduce((function(acc,param){var key=param[0],value=param[1];return keys.includes(key)&&(acc[key]=value),acc}),{})},dist$8.switchEzopenUrl=function(url,options){var _ref=null!=options?options:{},type=_ref.type,recType=_ref.recType,search=_ref.search,definition=_ref.definition,channelNo=_ref.channelNo,deviceSerial=_ref.deviceSerial,validateCode=_ref.validateCode,obj=parseEzopenUrl(url);if(search){var ns=Object.assign({},obj.searchParams,getQuery("?"+search.replace("?","")));search=Object.entries(ns).reduce((function(acc,param){var key=param[0],value=param[1];return ""===value?acc:acc+=key+"="+encodeURIComponent(value)+"&"}),"?").replace(/&$/,"");}else search=obj.search;return type=type||obj.type,recType=null!=recType?recType:obj.recType,definition=null!=definition?definition:obj.definition,channelNo=channelNo||obj.channelNo,deviceSerial=deviceSerial||obj.deviceSerial,validateCode=null!=validateCode?validateCode:obj.validateCode,obj.protocol+"//"+(validateCode?validateCode+"@":"")+obj.hostname+"/"+deviceSerial+"/"+channelNo+("rec"===type&&recType?"."+recType:"")+("live"===type&&"hd"===definition?"."+definition:"")+"."+type+search};
2402
2342
  return dist$8;
2403
2343
  }
2404
2344
 
@@ -4172,7 +4112,7 @@
4172
4112
  }, _proto.getCurrentTranslation = function() {
4173
4113
  return this._translations[this._locale];
4174
4114
  }, _proto.getVersion = function() {
4175
- return "2.0.0-beta.4";
4115
+ return "2.0.0";
4176
4116
  }, _proto._onChange = function() {
4177
4117
  return null == this.options.onChange ? void 0 : this.options.onChange.call(this.options, this);
4178
4118
  }, _proto._findChainValue = function(obj, path) {
@@ -4194,7 +4134,7 @@
4194
4134
  } ]), I18n;
4195
4135
  }();
4196
4136
 
4197
- I18n.VERSION = "2.0.0-beta.4", dist$7.exports = I18n;
4137
+ I18n.VERSION = "2.0.0", dist$7.exports = I18n;
4198
4138
  return dist$7.exports;
4199
4139
  }
4200
4140
 
@@ -4259,7 +4199,7 @@
4259
4199
  }, _proto.getOptions = function() {
4260
4200
  return this._options;
4261
4201
  }, _proto.getVersion = function() {
4262
- return "2.0.0-beta.1";
4202
+ return "2.0.0";
4263
4203
  }, LoggerCls;
4264
4204
  }();
4265
4205
 
@@ -4267,7 +4207,7 @@
4267
4207
  return (num = +num) < 10 && (num = "0" + num), num + "";
4268
4208
  }
4269
4209
 
4270
- LoggerCls.noop = function() {}, LoggerCls.VERSION = "2.0.0-beta.1";
4210
+ LoggerCls.noop = function() {}, LoggerCls.VERSION = "2.0.0";
4271
4211
 
4272
4212
  var __$list$__ = [ "info", "log", "warn", "error" ];
4273
4213
 
@@ -5396,7 +5336,7 @@
5396
5336
  _inherits$j(Content, EventEmitter);
5397
5337
  function Content(options) {
5398
5338
  var _this;
5399
- _this = EventEmitter.call(this) || this, _this._scaleMode = 0, _this._originWidth = 0, _this._originHeight = 0;
5339
+ _this = EventEmitter.call(this) || this, _this._scaleMode = 0, _this._originWidth = 0, _this._originHeight = 0, _this._width = 0, _this._height = 0;
5400
5340
  _this.options = options;
5401
5341
  _this._scaleMode = options.scaleMode || 0;
5402
5342
  _this.$wrapper = document.createElement('div');
@@ -5430,6 +5370,10 @@
5430
5370
  if (originHeight === void 0) originHeight = 0;
5431
5371
  var width = this.$wrapper.clientWidth;
5432
5372
  var height = this.$wrapper.clientHeight;
5373
+ // 防止多次渲染
5374
+ if (this._width === width && this._height === height && this._originWidth === originWidth && this._originHeight === originHeight) return;
5375
+ this._width = width;
5376
+ this._height = height;
5433
5377
  if (originWidth > 0 && originHeight > 0) {
5434
5378
  this._originWidth = originWidth;
5435
5379
  this._originHeight = originHeight;
@@ -5462,6 +5406,13 @@
5462
5406
  scale = wScale > hScale ? wScale : hScale;
5463
5407
  }
5464
5408
  this.$video.style.cssText += "\n width: " + this._originWidth + "px;\n height: " + this._originHeight + "px;\n position: absolute;\n object-fit:" + objectFill + ";\n left: " + left + "px;\n top: " + top + "px;\n transform-origin: 50% 50%;\n transform: scale(" + scale + ");\n ";
5409
+ this.emit(EVENTS.control.contentRerender, {
5410
+ scaleMode: this._scaleMode,
5411
+ objectFill: objectFill,
5412
+ scale: scale,
5413
+ width: this._originWidth,
5414
+ height: this._originHeight
5415
+ });
5465
5416
  }
5466
5417
  };
5467
5418
  _proto.setScaleMode = function setScaleMode(scaleMode) {
@@ -5678,7 +5629,7 @@
5678
5629
  });
5679
5630
  theme == null ? void 0 : theme.on(EVENTS.videoInfo, function(info) {
5680
5631
  // 排除流信息回调触发的事件
5681
- if (!!info && info.from !== "setStreamInfoCallBack") {
5632
+ if (info) {
5682
5633
  var // rerender 画面
5683
5634
  _theme_contentControl_emit, _theme_contentControl;
5684
5635
  (_theme_contentControl = theme.contentControl) == null ? void 0 : (_theme_contentControl_emit = _theme_contentControl.emit) == null ? void 0 : _theme_contentControl_emit.call(_theme_contentControl, EVENTS.videoInfo, info.width, info.height);
@@ -6026,6 +5977,12 @@
6026
5977
  theme.emit(EVENTS.control.recDestroy);
6027
5978
  });
6028
5979
  }
5980
+ // content
5981
+ if (theme.contentControl) {
5982
+ theme.contentControl.on(EVENTS.control.contentRerender, function(info) {
5983
+ theme.emit(EVENTS.control.contentRerender, info);
5984
+ });
5985
+ }
6029
5986
  }
6030
5987
  var ignoreList = [
6031
5988
  EVENTS.getOSDTime,
@@ -10878,7 +10835,8 @@
10878
10835
  * @param change 是否触发 onChange 事件
10879
10836
  */ _proto.setDate = function setDate(date, change) {
10880
10837
  if (change === void 0) change = true;
10881
- this.dataPickerUtil.setDate(date, change);
10838
+ var _this_dataPickerUtil;
10839
+ (_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.setDate(date, change);
10882
10840
  if (date && !change && this._value !== DateTime.formate(date, 'YYYY-MM-DD')) {
10883
10841
  this._value = DateTime.formate(date, 'YYYY-MM-DD');
10884
10842
  if (date && this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
@@ -10887,7 +10845,8 @@
10887
10845
  }
10888
10846
  };
10889
10847
  _proto.reset = function reset() {
10890
- this.dataPickerUtil.hide();
10848
+ var _this_dataPickerUtil;
10849
+ (_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.hide();
10891
10850
  Control.prototype.reset.call(this);
10892
10851
  };
10893
10852
  /**
@@ -10913,13 +10872,13 @@
10913
10872
  return DatePickerControl;
10914
10873
  }(Control);
10915
10874
 
10916
- var dist$1 = {exports: {}};
10875
+ var dist$1 = {};
10917
10876
 
10918
10877
  /**
10919
10878
  * drag scroll support move and touch
10920
10879
  *
10921
- * @skax/drag-scroll v1.1.0
10922
- * Copyright (c) 2025-11-08 ShineShao <xiaoshaoqq@gmail.com>
10880
+ * @skax/drag-scroll v1.1.1
10881
+ * Copyright (c) 2025-11-16 ShineShao <xiaoshaoqq@gmail.com>
10923
10882
  *
10924
10883
  * This source code is licensed under the MIT license found in the
10925
10884
  * LICENSE file in the root directory of this source tree.
@@ -10951,6 +10910,7 @@
10951
10910
  * 默认参数
10952
10911
  */ var _$DRAG_SCROLL_DEFAULT_OPTIONS$_ = {
10953
10912
  content: '',
10913
+ width: '100%',
10954
10914
  height: '400px',
10955
10915
  readonly: false,
10956
10916
  hideScrollbar: false
@@ -10977,6 +10937,18 @@
10977
10937
  /** 滚动条元素 */ this._$scrollbar = null;
10978
10938
  /** 滚动条指示器元素 */ this._$scrollbarThumb = null;
10979
10939
  /** 是否只读 */ this._readonly = false;
10940
+ if (!container) {
10941
+ throw new Error('container is required');
10942
+ }
10943
+ if ([
10944
+ 'VIDEO',
10945
+ 'CANVAS',
10946
+ 'IMG',
10947
+ 'TEXTAREA',
10948
+ 'INPUT'
10949
+ ].includes(container.tagName)) {
10950
+ throw new Error("container cannot be 'VIDEO', 'CANVAS', 'IMG', 'TEXTAREA', 'INPUT' element");
10951
+ }
10980
10952
  this.$container = container;
10981
10953
  this.options = Object.assign({}, _$DRAG_SCROLL_DEFAULT_OPTIONS$_, options);
10982
10954
  this.$container.classList.add(_$DRAG_SCROLL_PREFIX_CLASSNAME$_, "" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-container");
@@ -11078,6 +11050,7 @@
11078
11050
  clearTimeout(this._indicatorTimeout);
11079
11051
  this._indicatorTimeout = null;
11080
11052
  }
11053
+ if (this.$container) this.$container.style.cursor = 'default';
11081
11054
  (_this__$scrollbarThumb = this._$scrollbarThumb) == null ? void 0 : _this__$scrollbarThumb.remove();
11082
11055
  this._$scrollbarThumb = null;
11083
11056
  (_this__$scrollbar = this._$scrollbar) == null ? void 0 : _this__$scrollbar.remove();
@@ -11104,7 +11077,7 @@
11104
11077
  // 初始化滚动条
11105
11078
  this._updateScrollbar();
11106
11079
  // 初始化动画
11107
- this._animate();
11080
+ this._animationId = requestAnimationFrame(this._animate.bind(this));
11108
11081
  };
11109
11082
  // ----------- 事件处理 ----------- //
11110
11083
  /**
@@ -11204,9 +11177,9 @@
11204
11177
  /**
11205
11178
  * 平移内容
11206
11179
  */ _proto._applyTransform = function _applyTransform() {
11207
- var clientHeight = this.$content.clientHeight;
11180
+ var offsetHeight = this.$content.offsetHeight;
11208
11181
  // 内容高度小于等于容器高度时,不进行滚动
11209
- if (clientHeight <= this.$container.clientHeight) {
11182
+ if (offsetHeight <= this.$container.clientHeight) {
11210
11183
  this.$content.style.transform = "translate3d(0, 0, 0)";
11211
11184
  return;
11212
11185
  }
@@ -11230,7 +11203,11 @@
11230
11203
  * @param timestamp 时间戳
11231
11204
  */ _proto._animate = function _animate(timestamp) {
11232
11205
  if (timestamp === void 0) timestamp = 0;
11233
- var clientHeight = this.$content.clientHeight;
11206
+ if (this._animationId) {
11207
+ cancelAnimationFrame(this._animationId);
11208
+ this._animationId = null;
11209
+ }
11210
+ var clientHeight = this.$content.offsetHeight;
11234
11211
  // 内容高度小于等于容器高度时,不进行滚动
11235
11212
  if (clientHeight <= this.$container.clientHeight) {
11236
11213
  return;
@@ -11258,7 +11235,6 @@
11258
11235
  this.velocity = 0;
11259
11236
  }
11260
11237
  }
11261
- this._animationId = requestAnimationFrame(this._animate.bind(this));
11262
11238
  };
11263
11239
  /**
11264
11240
  * 更新滚动条
@@ -11340,8 +11316,8 @@
11340
11316
  get: /**
11341
11317
  * 内容是否可滚动
11342
11318
  */ function get() {
11343
- var clientHeight = this.$content.clientHeight;
11344
- return !this.readonly && clientHeight > this.$container.clientHeight;
11319
+ var offsetHeight = this.$content.offsetHeight;
11320
+ return !this.readonly && offsetHeight > this.$container.clientHeight;
11345
11321
  }
11346
11322
  }
11347
11323
  ]);
@@ -11353,560 +11329,18 @@
11353
11329
  }
11354
11330
 
11355
11331
  /*
11356
- * @ezuikit/control-time-line v1.0.1-beta.14
11357
- * Copyright (c) 2025-11-11 Ezviz-OpenBiz
11332
+ * @ezuikit/control-time-line v1.0.2
11333
+ * Copyright (c) 2025-11-16 Ezviz-OpenBiz
11358
11334
  * Released under the MIT License.
11359
11335
  */
11360
11336
 
11361
11337
  var hasRequiredDist;
11362
11338
 
11363
11339
  function requireDist () {
11364
- if (hasRequiredDist) return dist$1.exports;
11340
+ if (hasRequiredDist) return dist$1;
11365
11341
  hasRequiredDist = 1;
11366
- (function (module, exports) {
11367
- Object.defineProperty(exports,"__esModule",{value:true});var deepmerge=requireCjs(),I18n=requireDist$7(),Picker=requireDist$a(),DragScroll=requireDist$1(),delegate=requireDist$9(),_$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};function _create_class$2(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}var _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",
11368
- // --------------------只支持初始化时,不支持动态变更 (不做对象冻结)--------------------
11369
- timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",
11370
- onChange:function(){},onDragStart:function(){},onDragging:function(){},onDragEnd:function(){},onDestroy:function(){}},BaseTimeLine=function(){function BaseTimeLine(container,options){if(this._current=new Date,
11371
- /** 只读 */this._readOnly=false,this._width=0,this._height=0,this._destroyed=false,this._timeWidth=0,
11372
- /** 片段列表 */this._timeSections=[],this.$container=container,!container)throw new Error("container is required");var left,right;this.options=deepmerge(_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}),this.options.timeSections&&Array.isArray(this.options.timeSections)&&(this._timeSections=this.options.timeSections),this.options.readOnly&&(this.readOnly=this.options.readOnly),this.options.className&&this.$container.classList.add(this.options.className),this.$container.style.position="relative",this.options.current&&(left=this.options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?this._current=this.options.current||new Date:this._current=new Date,
11373
- // prettier-ignore
11374
- 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);}var _proto=BaseTimeLine.prototype;
11375
- /**
11376
- * 设置只读或取消只读, 推荐使用 timeLine.readOnly = false
11377
- * @param readOnly - 只读或取消只读
11378
- * @returns
11379
- */return _proto.setReadOnly=function(readOnly){this.readOnly=readOnly;},
11380
- /**
11381
- * 更新当前时间
11382
- * @param current 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11383
- */
11384
- _proto.update=function(current){this._current=current;},
11385
- /**
11386
- * 更新时间片段
11387
- * @param timeSections 片段数据
11388
- */
11389
- _proto.updateTimeSections=function(timeSections){timeSections&&Array.isArray(timeSections)&&(this._timeSections=timeSections);},
11390
- /**
11391
- * 重置尺寸
11392
- */
11393
- _proto.resize=function(width,height){this._resize(width,height);},_proto._resize=function(width,height){var cssText="";/^\d+(\.\d+)?$/.test(width+"")?cssText+="width: "+width+"px;":width&&(cssText+="width: "+width+";"),/^\d+(\.\d+)?$/.test(height+"")?cssText+="height: "+height+"px;":height&&(cssText+="height: "+height+";"),this.$container&&(this.$container.style.cssText+=cssText),this._width=Math.floor(this.$container.clientWidth),this._height=Math.floor(this.$container.clientHeight);},
11394
- /**
11395
- * 改变时间轴刻度
11396
- * 移动端间距: 0:1分钟,1:10分钟,2:半小时,3:1小时,4:2小时, 5:4小时
11397
- * PC间距:
11398
- * @param timeWidth 时间轴刻度
11399
- */
11400
- _proto.setTimeWidth=function(timeWidth){[0,1,2,3,4,5].includes(timeWidth)&&(this._timeWidth=timeWidth);},
11401
- /**
11402
- * 销毁
11403
- */
11404
- _proto.destroy=function(){
11405
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11406
- this._current=null,null==this.options.onDestroy||this.options.onDestroy.call(this.options),this._timeSections=[],this._readOnly=false,this._destroyed=true;},_create_class$2(BaseTimeLine,[{key:"current",get:
11407
- /**
11408
- * 当前时间
11409
- */
11410
- function(){return this._current},set:
11411
- /**
11412
- * 当前时间
11413
- */
11414
- function(current){this._current=current;}},{key:"readOnly",get:
11415
- /**
11416
- * 只读状态
11417
- */
11418
- function(){return this._readOnly},set:function(readOnly){this._readOnly!==readOnly&&(this._readOnly=readOnly,this.$container.style.cursor=readOnly?"not-allowed":"pointer");}},{key:"timeSections",get:
11419
- /**
11420
- * 时间片段
11421
- */
11422
- function(){return this._timeSections}},{key:"width",get:
11423
- /**
11424
- * 获取 TimeLine 的宽度
11425
- * @returns
11426
- */
11427
- function(){return this._width}},{key:"height",get:
11428
- /**
11429
- * 获取 TimeLine 的高度
11430
- */
11431
- function(){return this._height}},{key:"timeWidth",get:function(){return this._timeWidth}}]),BaseTimeLine}();
11432
- /**
11433
- * 时间轴基类
11434
- * @internal
11435
- */
11436
- /** 语言包 */BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;var TimeLineUtil=function(){function TimeLineUtil(){}
11437
- /**
11438
- * 时间转成日期
11439
- * @param time 时间 (秒, 毫秒, 日期字符串, Date)
11440
- * @returns 日期
11441
- */return TimeLineUtil.toDate=function(time){var left,right,date=null;return "string"==typeof time&&time.includes(":")?date=new Date(time):"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||10!==(time+"").length?"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||13!==(time+"").length?(left=time,(null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(date=time)):date=new Date(+time):date=new Date(1e3*+time),date},
11442
- /**
11443
- * 时间转成 HH:mm:ss
11444
- * @param time 时间
11445
- * @returns
11446
- */
11447
- TimeLineUtil.formatDateToHHmmss=function(time){var date=TimeLineUtil.toDate(time);if(date){var h=date.getHours(),m=date.getMinutes(),s=date.getSeconds();// 返回日期中的小时数(0到23)
11448
- // 返回日期中的秒数(0到59)
11449
- return (h>9?h:"0"+h)+":"+(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)}return "00:00:00"},
11450
- /**
11451
- * 十位补充 0
11452
- * @param m 数字
11453
- * @returns 十位补充 0后的结果字符串
11454
- */
11455
- TimeLineUtil.subTime=function(m){return +m>9?m+"":"0"+m},
11456
- /**
11457
- * 格式化时间, 支持 'YYYY-MM-DD','YYYY-MM-DD HH:mm:ss', 'HH:mm:ss'
11458
- * @param time 时间
11459
- * @param fmt 时间格式
11460
- * @returns
11461
- */
11462
- TimeLineUtil.tranTime=function(time,fmt){ void 0===fmt&&(fmt="YYYY-MM-DD HH:mm:ss");var newDate=TimeLineUtil.toDate(time);return newDate?"YYYY-MM-DD"===fmt?newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate()):"HH:mm:ss"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH"===fmt?TimeLineUtil.subTime(newDate.getHours()):"mm:ss"===fmt?TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH:mm"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes()):"YYYYMMDDTHHmmssZ"===fmt?newDate.getFullYear()+""+TimeLineUtil.subTime(newDate.getMonth()+1)+TimeLineUtil.subTime(newDate.getDate())+"T"+TimeLineUtil.subTime(newDate.getHours())+TimeLineUtil.subTime(newDate.getMinutes())+TimeLineUtil.subTime(newDate.getSeconds())+"Z":newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate())+" "+TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):""},
11463
- /**
11464
- * 时间转成秒
11465
- * @param time
11466
- * @returns
11467
- */
11468
- TimeLineUtil.timeToSecond=function(time){var e=time.split(":");return 60*Number(e[0])*60+60*Number(e[1])+(Number(e[2])||0)},
11469
- /**
11470
- * 分钟转成 HH:mm
11471
- * @param minute
11472
- * @returns
11473
- */
11474
- TimeLineUtil.minuteToTime=function(minute){var hour=Math.floor(minute/60),m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)},
11475
- /**
11476
- * 时间转成分钟
11477
- * @param time
11478
- * @returns
11479
- */
11480
- TimeLineUtil.timeToMinute=function(time){var e=time.split(":");
11481
- // const s = Number(e[2]);
11482
- return 60*Number(e[0])+Number(e[1])},
11483
- /**
11484
- * @description 判读两个区间是否重叠
11485
- * @param {number} a_start 一个区间的开始
11486
- * @param {number} a_end 一个区间的结束
11487
- * @param {number} b_start 另一个区间的开始
11488
- * @param {number} b_end 另一个区间的结束
11489
- * @returns {boolean}
11490
- */
11491
- TimeLineUtil.isOverlap=function(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)},TimeLineUtil.tranTimeToString=function(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1,secondNum=Math.floor((null==(_TimeLineUtil_toDate=TimeLineUtil.toDate(end))?void 0:_TimeLineUtil_toDate.getTime())-(null==(_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))?void 0:_TimeLineUtil_toDate1.getTime()))/1e3,second=secondNum%60,minute=Math.floor(secondNum/60);return (minute>0?TimeLineUtil.subTime(minute)+"'":"0'")+TimeLineUtil.subTime(second)+"''"},TimeLineUtil}(),_$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>',_$TIMELINE_ICONS$__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 ',_$TIMELINE_ICONS$__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 ',_$TIMELINE_ICONS$__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 ',_$TIMELINE_ICONS$__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 ',_$TIMELINE_ICONS$__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 ',TIME_WIDTH=[[1,10,10,"单位 1秒"],[60,20,5,"单位 1分钟"],[600,20,6,"单位 10分钟"],[3600,30,6,"单位 1小时"],[14400,40,2,"单位 4小时"],[43200,80,2,"单位 12小时"]],MOBILE_TIME_WIDTH=[[1,10,10,"单位 1分钟"],[10,20,5,"单位 10分钟"],[30,20,6,"单位 30分钟"],[60,30,6,"单位 1小时"],[120,40,2,"单位 2小时"],[240,80,2,"单位 4小时"]];
11492
- /**
11493
- * 时间轴图标集
11494
- */function _create_class$1(Constructor,protoProps,staticProps){return protoProps&&
11495
- /* 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(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$1(){return _extends$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$1.apply(this,arguments)}function _set_prototype_of$1(o,p){return _set_prototype_of$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1(o,p)}
11496
- /**
11497
- * 时间轴样式类前缀
11498
- */var _$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",
11499
- /** 当前时间背景颜色 */currentTimeBgColor:"#648FFC",
11500
- /** 当前时间颜色 */currentTimeColor:"#FFFFFF",showTimeWidthBtn:true}),MobileTimeLine=function(BaseTimeLine){function MobileTimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}))||this)._isTouchStart=false,_this._dragScroll=null,_this._moveStartX=0,_this._moveStartY=0,_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(),_this.options.timeSections&&Array.isArray(_this.options.timeSections)&&_this.updateTimeSections(_this.options.timeSections),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1(subClass,superClass);}(MobileTimeLine,BaseTimeLine);var _proto=MobileTimeLine.prototype;
11501
- /**
11502
- * 设置只读或取消只读
11503
- * @param readOnly - 只读或取消只读
11504
- * @returns
11505
- */return _proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._dragScroll&&(this._dragScroll.readonly=readOnly);},
11506
- /**
11507
- * 改变时间轴刻度
11508
- * 0: 1分钟,
11509
- * 1: 10分钟
11510
- * 2: 半小时
11511
- * 3: 1小时
11512
- * 4: 2小时
11513
- * @param timeWidth // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
11514
- */
11515
- _proto.setTimeWidth=function(timeWidth){MOBILE_TIME_WIDTH[timeWidth]&&(BaseTimeLine.prototype.setTimeWidth.call(this,timeWidth),this._matchTimeDot());},
11516
- /**
11517
- * 更新片段数组
11518
- * @param timeSections
11519
- * @param defaultIndex
11520
- */
11521
- _proto.updateTimeSections=function(timeSections,defaultIndex){BaseTimeLine.prototype.updateTimeSections.call(this,timeSections);var list=timeSections.map(function(record){return _extends$1({},record,{startTime:TimeLineUtil.formatDateToHHmmss(record.startTime),endTime:TimeLineUtil.formatDateToHHmmss(record.endTime)})});if(list.length>0){ void 0===defaultIndex&&(defaultIndex=list.length-1);
11522
- // 若current不为 null,则不重置current,避免拖动后时间轴回弹
11523
- var current=this.state.current;this._setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:null===current?list[defaultIndex].startTime:current}),this._matchTimeDot();}else this._setState({availTimeLine:[],current:TimeLineUtil.formatDateToHHmmss(this.current||(new Date).getTime())}),this._matchTimeDot();},
11524
- /**
11525
- * 更新当前时间
11526
- * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11527
- */
11528
- _proto.update=function(time){var _this__dragScroll;time&&!(null==(_this__dragScroll=this._dragScroll)?void 0:_this__dragScroll.isDragging)&&(this._setState({current:TimeLineUtil.tranTime(time,"HH:mm:ss")}),this._currentOffsetH());},
11529
- /**
11530
- * 销毁
11531
- */
11532
- _proto.destroy=function(){var _this__dragScroll,_this__picker_$body_querySelectorAll,_this__picker_$body;if(this._scrollTimer&&(clearInterval(this._scrollTimer),this._scrollTimer=null),this._$currentTime)try{this.$container.removeChild(this._$currentTime),this._$currentTime=null;}catch(error){}if(this._$itemList&&this._imageRemoveErrorEvent(this._$itemList.querySelectorAll("img.ez-time-line-img")||[]),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){}this._picker&&(this._imageRemoveErrorEvent((null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelectorAll=_this__picker_$body.querySelectorAll)?void 0:_this__picker_$body_querySelectorAll.call(_this__picker_$body,"img"))||[]),this._picker.destroy(),this._picker=null);this._removeEventListener(),null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.destroy(),this._dragScroll=null,BaseTimeLine.prototype.destroy.call(this);},
11533
- /**
11534
- * 更新状态
11535
- * @param obj
11536
- */
11537
- _proto._setState=function(obj){var _this=this;
11538
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11539
- Object.keys(obj).forEach(function(key){var _this__dragScroll,_this_timeSections_;"current"===key&&obj[key]?(_this._setCurrentDOM(obj[key]),_this.state.current===obj[key]||(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.isDragging)||(_this.state[key]=obj[key],_this.current=new Date(TimeLineUtil.tranTime(null==(_this_timeSections_=_this.timeSections[0])?void 0:_this_timeSections_.endTime,"YYYY-MM-DD")+" "+obj[key]),null==_this.options.onChange||_this.options.onChange.call(_this.options,_this.current))):_this.state[key]=obj[key];});},_proto._setCurrentDOM=function(time){this._$currentTime&&(this._$currentTime.querySelector(".ez-time-line-current-value").innerHTML=time);},
11540
- /**
11541
- * 渲染时间轴刻度数组
11542
- */
11543
- _proto._matchTimeDot=function(){for(var scaleWidth=this._scaleWidth,timeArr=[],minute=TimeLineUtil.timeToMinute("24:00:00"),i=minute=Math.floor(minute/scaleWidth)*scaleWidth// 时间单位 分钟
11544
- ;i>=0;){var marginTop=0,marginBottom=0;
11545
- // 视频片段
11546
- i==minute&&(marginTop=70),0==i&&(marginBottom=this.$container.clientHeight-70);var 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();},_proto._matchRecTimeDot=function(){var _this_state=this.state,availTimeLine=_this_state.availTimeLine,timeArr=_this_state.timeArr,scaleWidth=this._scaleWidth,len=availTimeLine.length;if(0===len)for(var j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(var k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(var i=0;i<len;i++){var stAvailPercent,etAvailPercent,temp=availTimeLine[i],st=TimeLineUtil.timeToSecond(temp.startTime),et=TimeLineUtil.timeToSecond(temp.endTime),stMinute=Math.floor(st/(60*scaleWidth))*scaleWidth;stAvailPercent=(st-60*stMinute)/scaleWidth;var etMinute=Math.floor(et/(60*scaleWidth))*scaleWidth;etAvailPercent=(et-60*etMinute)/scaleWidth;for(var j1=0;j1<timeArr.length;j1++)if(timeArr[j1].id==stMinute&&timeArr[j1].id==etMinute){var height=etAvailPercent-stAvailPercent,top=60-etAvailPercent;
11547
- // prettier-ignore
11548
- timeArr[j1].recArr.push({height:height,top:top});}else timeArr[j1].id==stMinute?timeArr[j1].recArr.push({height:60-stAvailPercent,top:0}):timeArr[j1].id==etMinute?timeArr[j1].recArr.push({height:etAvailPercent,top:60-etAvailPercent}):timeArr[j1].id>stMinute&&timeArr[j1].id<etMinute&&timeArr[j1].recArr.push({height:60,top:0});}}this._setState({timeArr:timeArr}),this._renderDateLine();},_proto._renderDateLine=function(){var _this=this,timeArr=this.state.timeArr,container=this._$itemList;
11549
- // 清理上一次的error 事件
11550
- this._imageRemoveErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]),container.innerHTML="",timeArr.forEach(function(item,index){var timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class","ez-time-line-time-scale-area"),item.marginTop&&(timeItemDOM.style.cssText+="margin-top: "+item.marginTop+"px;"),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+""),document.createElement("div").setAttribute("class","ez-time-line-scale");var timeItemHtml="";item.coverArr.length&&(timeItemHtml+='\n <div class="ez-time-line-time-cover-fold '+(item.coverArr.length>1?"ez-time-line-time-cover-fold-multiple":"")+'"\n data-start="'+item.current+'">\n '+(item.coverArr.length>1?'<div class="ez-time-line-cover-fold-placeholder" style="color: #FFF"></div>':"")+'\n <div class="ez-time-line-time-cover-fold-img">\n <img src="'+_this._setImageScr(item.coverArr[0].coverPic)+'" class="ez-time-line-img"/>\n <span class="ez-time-line-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 "+(1===item.coverArr.length?'<span class="ez-time-line-time-cover-fold-time">'+TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)+"</span>":"")+'\n <span class="ez-time-line-time-cover-fold-pause">'+_$TIMELINE_ICONS$__pause+"</span>\n </div>\n </div>"),
11551
- // 六个详细刻度
11552
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11553
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11554
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11555
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11556
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11557
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale" style="width:10px"></div>
11558
- item.recArr.forEach(function(i){timeItemHtml+='<div class="ez-time-line-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="ez-time-line-time-label" style="color: '+(_this.options.timeTextColor||"#666")+'">'+item.current+"</div>",timeItemDOM.innerHTML=timeItemHtml,container.appendChild(timeItemDOM),_this._imageErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]);}),this._currentOffsetH();},_proto._currentOffsetH=function(){var current=this.state.current;if(current){var _this__dragScroll,y=(86400-TimeLineUtil.timeToSecond(current)||0)/this._scaleWidth;null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y+60,false);}},_proto._render=function(){var _this=this;
11559
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11560
- if(this._$currentTime=document.createElement("div"),this._$currentTime.classList.add("ez-time-line-current"),this._$currentTime.innerHTML='<div class="ez-time-line-current-content" style="color: '+(this.options.currentTimeBgColor||"#648FFC")+'">\n <span class="ez-time-line-current-tip">'+_$TIMELINE_ICONS$__tip+'</span>\n <span class="ez-time-line-current-tip-line" style="background-color: '+(this.options.timePointColor||"#648FFC")+';"></span>\n <div class="ez-time-line-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("ez-time-line-container"),this.$container.appendChild(this._$itemContainer),this._dragScroll=new DragScroll(this._$itemContainer,{hideScrollbar:true,onChange:function(state){var result=_this._offsetYToTime(state.y);result[1]!==_this.state.current&&_this._setCurrentDOM(result[0]>=86400?"23:59:59":result[1]);},onDragStart:function(e){_this._moveStartX=e.clientX,_this._moveStartY=e.clientY,null==_this.options.onDragStart||_this.options.onDragStart.call(_this.options,_this.state.current);},onDragging:function(){null==_this.options.onDragging||_this.options.onDragging.call(_this.options,_this.state.current);},onDragEnd:function(){var _this__dragScroll,result=_this._offsetYToTime(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.currentY);result[1]!==_this.state.current&&_this._setState({current:result[0]>=86400?"23:59:59":result[1]}),null==_this.options.onDragEnd||_this.options.onDragEnd.call(_this.options,_this.state.current);}}),/\d/.test(this.options.height))this._$itemContainer.style.cssText+="height: "+this.options.height+"px";else if("string"==typeof this.options.height)this._$itemContainer.style.cssText+="height: "+this.options.height;else {var height=this.$container.clientHeight;this._$itemContainer.style.cssText+="height: "+height+"px";}this._$itemList=document.createElement("div"),this._$itemList.classList.add("ez-time-line-item"),this._dragScroll.$content.appendChild(this._$itemList),this.options.showTimeWidthBtn&&(
11561
- // 加减
11562
- this._$op=document.createElement("div"),this._$op.classList.add("ez-time-line-op"),this._$op.innerHTML='<span class="ez-time-line-op-wrapper"><span class="ez-time-line-icon-plus">'+_$TIMELINE_ICONS$__plus+'</span> <span class="ez-time-line-icon-minus">'+_$TIMELINE_ICONS$__minus+"</span></span>",this.$container.appendChild(this._$op)),this._picker=new Picker(null,{isMobile:true,wrapClassName:"ez-time-line-picker",onOpenChange:function(isOpen){var _this_options_onPickerOpenChange,_this_options;null==(_this_options=_this.options)||null==(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)||_this_options_onPickerOpenChange.call(_this_options,isOpen);}}),this._addEventListener();},_proto._addEventListener=function(){var// this._$op.addEventListener('click', this._opClick, false);
11563
- _this__$op_querySelector,_this__$op_querySelector1;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.addEventListener("click",this._plusClick,false),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.addEventListener("click",this._minusClick,false));this._matchTimeDot(),this._picker&&(this._delegatePickerClose=delegate(this._picker.$body,".ez-time-line-picker-close","click",this._onPickerClose,false),this._delegateItemContent=delegate(this._picker.$body,".ez-time-line-picker-item-content","click",this._onClickItem,false),this._delegateCoverFold=delegate(this._$itemList,".ez-time-line-time-cover-fold","click",this._onClickCoverFold,false));},_proto._removeEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1,_this__picker_$body_querySelector,_this__picker_$body;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.removeEventListener("click",this._plusClick),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.removeEventListener("click",this._minusClick));this._picker&&(null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelector=_this__picker_$body.querySelector(".ez-time-line-picker-close"))||_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose),this._delegateItemContent&&(this._delegateItemContent.forEach(function(delegation){delegation.destroy();}),this._delegateItemContent=null),this._delegatePickerClose&&(this._delegatePickerClose.forEach(function(delegation){delegation.destroy();}),this._delegatePickerClose=null),this._delegateCoverFold&&(this._delegateCoverFold.forEach(function(delegation){delegation.destroy();}),this._delegateCoverFold=null));},_proto._plusClick=function(){var timeWidth=this.timeWidth+1;timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(timeWidth);},_proto._minusClick=function(){var timeWidth=this.timeWidth-1;timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(Math.floor(timeWidth));},_proto._timeSectionsToGroupsByHour=function(list){var obj={};return list.forEach(function(item,index){
11564
- // 移动端仅支持一天
11565
- // if (TimeLineUtil.tranTime(item.startTime, 'YYYY-MM-DD') !== TimeLineUtil.tranTime(item.endTime, 'YYYY-MM-DD')) {
11566
- // }
11567
- var hour=TimeLineUtil.tranTime(item.startTime,"HH");obj[+hour]?
11568
- // prettier-ignore
11569
- obj[+hour].push(_extends$1({},item,{_index:index})):
11570
- // prettier-ignore
11571
- obj[+hour]=[_extends$1({},item,{_index:index})];}),obj},
11572
- /**
11573
- *
11574
- * @param start 仅支持判断同一天的, 如果是多天的或出错
11575
- */
11576
- _proto._filterTimeSectionsByTime=function(start){if(!start)return [];var startSecond=TimeLineUtil.timeToSecond(start+":00"),endSecond=TimeLineUtil.timeToSecond(start+":00")+60*this._scaleWidth;return this.timeSections.filter(function(item){var _$start=TimeLineUtil.timeToSecond(TimeLineUtil.tranTime(item.startTime,"HH:mm:ss"));return _$start>=startSecond&&_$start<endSecond})},
11577
- /**
11578
- * 渲染选择器内容
11579
- */
11580
- _proto._renderPickerContent=function(start){var _this__picker_innerHTML,_this__picker,_this__picker1,_this__picker2,_this=this,list=this._filterTimeSectionsByTime(start),hourGroups=this._timeSectionsToGroupsByHour(list);(null==(_this__picker=this._picker)||null==(_this__picker_innerHTML=_this__picker.innerHTML)||_this__picker_innerHTML.call(_this__picker,'<div class="ez-time-line-picker-container">\n <div class="ez-time-line-picker-header">\n <span class="ez-time-line-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="ez-time-line-picker-content">\n <div class="ez-time-line-picker-list">\n '+Object.keys(hourGroups).reverse().map(function(key){return '<div class="ez-time-line-picker-item">\n <div class="ez-time-line-picker-item-title">'+key+':00</div>\n <div class="ez-time-line-picker-item-list">\n '+hourGroups[key].reverse().map(function(item){return '<div class="ez-time-line-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="ez-time-line-picker-item-time">'+TimeLineUtil.tranTime(item.startTime,"HH:mm")+'</span>\n <span class="ez-time-line-picker-item-duration">\n '+TimeLineUtil.tranTimeToString(item.startTime,item.endTime)+'\n </span>\n <img class="ez-time-line-picker-item-cover" src="'+_this._setImageScr(item.coverPic)+'"/>\n </div>'}).join("")+"\n </div>\n </div>"}).join("")+"\n </div>\n </div>\n </div>\n </div>"),null==(_this__picker1=this._picker)?void 0:_this__picker1.$body)&&this._imageErrorEvent((null==(_this__picker2=this._picker)?void 0:_this__picker2.$body.querySelectorAll("img"))||[]);},
11581
- /**
11582
- * 图片加载失败事件监听
11583
- * @param list
11584
- */
11585
- _proto._imageErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){
11586
- // 避免重复添加事件
11587
- img.hasAttribute("data-error")||img.addEventListener("error",_this._onImageError);});},
11588
- /**
11589
- * 图片加载失败移除
11590
- * @param list
11591
- */
11592
- _proto._imageRemoveErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){
11593
- // 避免重复添加事件
11594
- img.removeEventListener("error",_this._onImageError);});},
11595
- /**
11596
- * 图片加载失败
11597
- * @param e
11598
- */
11599
- _proto._onImageError=function(e){var img=e.target;if(!img.hasAttribute("data-error")){var _img_parentNode,placeholder=document.createElement("div");
11600
- // 加密图片不能加载或没有图片
11601
- placeholder.classList.add("ez-time-line-item-cover-placeholder"),placeholder.innerHTML=""+_$TIMELINE_ICONS$__picture,null==(_img_parentNode=img.parentNode)||_img_parentNode.appendChild(placeholder),img.remove();}},_proto._onPickerClose=function(){this._picker&&(this._picker.open=false);},_proto._onClickItem=function(e){var _e_delegateTarget_getAttribute,_e_delegateTarget,index=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_getAttribute=_e_delegateTarget.getAttribute)?void 0:_e_delegateTarget_getAttribute.call(_e_delegateTarget,"data-index");this._picker&&(this._picker.open=false),null==this.options.onPickerSelect||this.options.onPickerSelect.call(this.options,this.timeSections[+index]);},_proto._onClickCoverFold=function(e){var _e_delegateTarget_parentElement_getAttribute,_e_delegateTarget_parentElement,_e_delegateTarget;e.preventDefault();var time=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_parentElement=_e_delegateTarget.parentElement)||null==(_e_delegateTarget_parentElement_getAttribute=_e_delegateTarget_parentElement.getAttribute)?void 0:_e_delegateTarget_parentElement_getAttribute.call(_e_delegateTarget_parentElement,"data-time"),moveX=Math.abs(this._moveStartX-e.clientX),moveY=Math.abs(this._moveStartY-e.clientY);
11602
- // moveX >= 1 || moveY >= 1 用于判断是否移动
11603
- this._picker&&time&&!(moveX>=1||moveY>=1)&&(this._renderPickerContent(time),this._picker.open=true);},_proto._setImageScr=function(src){if(src){var query="x=1000&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""},_proto._offsetYToTime=function(offsetY){var _this__dragScroll,y=offsetY;offsetY<60&&(
11604
- // 60 是下限
11605
- y=60,null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y));var second=86400-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)]},_create_class$1(MobileTimeLine,[{key:"_scaleWidth",get:
11606
- /**
11607
- * 获取真实时间刻度(时间单位 分钟)
11608
- */
11609
- function(){return (MOBILE_TIME_WIDTH[this.timeWidth]||MOBILE_TIME_WIDTH[0])[0]}}]),MobileTimeLine}(BaseTimeLine);function _create_class(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends.apply(this,arguments)}function _set_prototype_of(o,p){return _set_prototype_of=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of(o,p)}
11610
- /**
11611
- * 时间轴配置项
11612
- */var _$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,
11613
- // wheelSpeed: 0.1,
11614
- scaleOffsetTop:4,showYearMonthDay:true},TimeLine=function(BaseTimeLine){function TimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,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
11615
- _this._isMouseDown=false,_this._mousePosition=0,_this._oldTime=null,_this._isOver=false,_this._moved=false,_this._isCtrlKeyDown=false,_this._lastTouchDist=0,_this.$container=container,
11616
- // prettier-ignore
11617
- _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(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of(subClass,superClass);}(TimeLine,BaseTimeLine);var _proto=TimeLine.prototype;
11618
- /**
11619
- * 初始化 (canvas)
11620
- */return _proto._init=function(){this._$canvas=document.createElement("canvas"),this._ctx=this._$canvas.getContext("2d"),this.readOnly||(this._$canvas.style.cssText+="cursor: pointer;"),this.$container.appendChild(this._$canvas),this.resize(this.width,this.height),this._update({current:this.current,timeWidth:this.timeWidth,timeSections:this.timeSections}),this._addEventListener();},
11621
- /**
11622
- * 重置尺寸
11623
- */
11624
- _proto.resize=function(width,height){BaseTimeLine.prototype.resize.call(this,width,height),this._$canvas&&width&&(this._$canvas.width=this.width*this.options.dpr,this._$canvas.style.cssText+="width: "+this.width+"px;"),this._$canvas&&height&&(this._$canvas.height=this.height*this.options.dpr,this._$canvas.style.cssText+="height: "+this.height+"px;"),this._draw();},
11625
- /**
11626
- * 设置时间轴刻度宽度
11627
- * @param timeWidth - 时间轴刻度宽度 [0, TIME_WIDTH.length - 1]
11628
- * @returns
11629
- */
11630
- _proto.setTimeWidth=function(timeWidth){this._update({timeWidth:timeWidth});},
11631
- /**
11632
- * 设置片段数组
11633
- * @param timeSections - 片段数组
11634
- * @returns
11635
- */
11636
- _proto.updateTimeSections=function(timeSections){this._update({timeSections:timeSections});},
11637
- /**
11638
- * 更新当前时间
11639
- * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11640
- */
11641
- _proto.update=function(time){time&&!this._isMouseDown&&this._update({current:new Date(TimeLineUtil.tranTime(time,"YYYY-MM-DD HH:mm:ss"))});},
11642
- /**
11643
- * 更新
11644
- * @param options - 更新参数
11645
- * @returns
11646
- */
11647
- _proto._update=function(options){var left,right,_this__$canvas;(void 0===options&&(options={}),(null==options?void 0:options.current)&&(left=options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(this.current=options.current),(null==options?void 0:options.timeSections)&&BaseTimeLine.prototype.updateTimeSections.call(this,this._mergeTimeSections(options.timeSections)),"number"==typeof(null==options?void 0:options.timeWidth)&&(null==options?void 0:options.timeWidth)<TIME_WIDTH.length&&(BaseTimeLine.prototype.setTimeWidth.call(this,options.timeWidth),this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)]),"number"==typeof(null==options?void 0:options.timeWidth)&&this._timeWidthArray)&&(this._timeWidthArray[3]&&(null==(_this__$canvas=this._$canvas)||_this__$canvas.setAttribute("data-title",this._timeWidthArray[3])));this._draw();},_proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._$canvas&&(this._$canvas.style.cssText+="cursor: "+(readOnly?"not-allowed":"pointer"));},
11648
- /**
11649
- * 销毁
11650
- * @returns
11651
- */
11652
- _proto.destroy=function(){if(this._removeEventListener(),this._$canvas)try{this.$container.removeChild(this._$canvas),
11653
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11654
- this._$canvas=null;}catch(e){
11655
- // console.error(e);
11656
- }BaseTimeLine.prototype.destroy.call(this);},
11657
- /**
11658
- * 绘制
11659
- */
11660
- _proto._draw=function(){
11661
- // 清空画布
11662
- this._ctx&&(this._ctx.fillStyle=this.options.timeAxisBgColor,
11663
- // prettier-ignore
11664
- this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr)),this._drawSections(),this._drawScale();},
11665
- /**
11666
- * 绘制刻度
11667
- */
11668
- _proto._drawScale=function(){var lineWidth=1*this.options.dpr;
11669
- /** 中心位置 */this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");
11670
- // 左扩展刻度
11671
- for(var centerPosition={x:this.width*this.options.dpr/2,y:this.height*this.options.dpr},curScaleTime=Math.floor(this.current.getTime()/1e3),offsetSecond=(curScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*curScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%this._timeWidthArray[0],padding=this.height*this.options.dpr/20,spacing=this._curScaleSpacing*this.options.dpr,rightLastScaleTimeX=Math.floor(this._centerPositionX+(this._timeWidthArray[0]-offsetSecond)/this._timeWidthArray[0]*spacing),leftLastScaleTime=curScaleTime-offsetSecond,rightLastScaleTime=leftLastScaleTime+this._timeWidthArray[0],x=rightLastScaleTimeX-spacing;x>0;x-=spacing){0===(leftLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(
11672
- // prettier-ignore
11673
- this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),
11674
- // prettier-ignore
11675
- this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),leftLastScaleTime-=this._timeWidthArray[0];}
11676
- // 右扩展刻度
11677
- // prettier-ignore
11678
- for(var x1=rightLastScaleTimeX;x1<=this.width*this.options.dpr;x1+=spacing){0===(rightLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(
11679
- // prettier-ignore
11680
- this._drawSolidLine(x1,padding,x1,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),
11681
- // prettier-ignore
11682
- this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime)),x1,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x1,padding,x1,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),rightLastScaleTime+=this._timeWidthArray[0];}
11683
- // 当前中心位置(当前时间 current)
11684
- // prettier-ignore
11685
- this._drawSolidLine(centerPosition.x,0,centerPosition.x,centerPosition.y,lineWidth,this.options.timePointColor);},
11686
- /**
11687
- * 绘制线
11688
- * @param startX - 线起点 x 坐标
11689
- * @param startY - 线起点 y 坐标
11690
- * @param endX - 线终点 x 坐标
11691
- * @param endY - 线终点 y 坐标
11692
- * @param lineWidth - 线宽度
11693
- * @param color - 线颜色
11694
- *
11695
- */
11696
- // prettier-ignore
11697
- _proto._drawSolidLine=function(startX,startY,endX,endY,lineWidth,color){this._ctx&&(this._ctx.save(),this._ctx.strokeStyle=null!=color?color:this.options.timeScaleColor,this._ctx.lineWidth=lineWidth,this._ctx.beginPath(),this._ctx.moveTo(startX,startY),this._ctx.lineTo(endX,endY),this._ctx.stroke(),this._ctx.restore());},
11698
- /**
11699
- * 绘制刻度文字
11700
- * @param text - 文本
11701
- * @param x - X
11702
- * @param y - Y
11703
- * @param align - 文本对齐方式
11704
- */
11705
- _proto._drawTextString=function(text,x,y,align){if(this._ctx){var timeTexts=text.split(" ");this._ctx.font=12*this.options.dpr*1+"px serif",this._ctx.fillStyle=this.options.timeTextColor,this._ctx.textAlign=align||"left",this._timeWidthArray[0]%60==0&&(
11706
- // 仅展示 hh:mm
11707
- timeTexts[1]=timeTexts[1].replace(/:00$/,"")),this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr),
11708
- // prettier-ignore
11709
- !this.options.showYearMonthDay||"00:00:00"!==timeTexts[1]&&"00:00"!==timeTexts[1]&&this._timeWidthArray[0]*this._timeWidthArray[2]!==86400||(
11710
- // 展示年月日
11711
- this._ctx.textAlign=align||"left",this._ctx.fillText(timeTexts[0],x,y+18*this.options.dpr));}},
11712
- /**
11713
- * 画录像区间
11714
- */
11715
- _proto._drawSections=function(){
11716
- // 根据时间查找当前位置
11717
- for(
11718
- // 绘制蓝色区域
11719
- var timeArr=this.timeSections||[],i=0;i<timeArr.length;i++){var position=this._findPosition(timeArr[i]);
11720
- // 判断一下绘制区域是否在画布区域, 不在可以不用绘制
11721
- // prettier-ignore
11722
- this._ctx&&TimeLineUtil.isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)&&(this._ctx.fillStyle=this.options.timeSectionColor,
11723
- // prettier-ignore
11724
- this._ctx.fillRect(position.x1,0,position.x2-position.x1,this.height*this.options.dpr));}},
11725
- /**
11726
- * 获取时间片段在时间轴中的x1 ,x2坐标 (已做 dpr 处理)
11727
- * @param item - 时间片段
11728
- * @returns {void}
11729
- */
11730
- _proto._findPosition=function(item){
11731
- // 中间的当前时间 current 为基准, 然后计算时间片段的 x 坐标和 y 坐标
11732
- // prettier-ignore
11733
- var x1=(parseInt((item.startTime-this.current.getTime())/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing+this.width/2)*this.options.dpr;return {x1:x1,x2:x1+parseInt((item.endTime-item.startTime)/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing*this.options.dpr}},
11734
- /**
11735
- * 合并相邻两个时间区间
11736
- * @param timeSections - 时间区间数组
11737
- *
11738
- * @returns 合并后的时间区间
11739
- */
11740
- _proto._mergeTimeSections=function(timeSections){if(0===timeSections.length)return timeSections;for(var merged=[(timeSections=timeSections.map(function(item){
11741
- // 处理秒
11742
- return 10===(item.startTime+"").length&&(item.startTime=1e3*item.startTime),10===(item.endTime+"").length&&(item.endTime=1e3*item.endTime),_extends({},item,{startTime:item.startTime,endTime:item.endTime})}))[0]],i=1;i<timeSections.length;i++){var prev=merged[merged.length-1],curr=timeSections[i];
11743
- // 如果当前区间与上一个区间重叠或相邻(即 prev.end >= curr.start)
11744
- prev.endTime>=curr.startTime?
11745
- // 合并区间
11746
- prev.endTime=Math.max(prev.endTime,curr.endTime):merged.push(curr);}return merged},
11747
- // -------------------------------------
11748
- // mouse event
11749
- // -------------------------------------
11750
- /**
11751
- * 添加事件监听
11752
- * @returns
11753
- */
11754
- _proto._addEventListener=function(){this._$canvas&&(
11755
- // 事件监听
11756
- this._$canvas.addEventListener("mousemove",this._mousemoveFun),
11757
- // prettier-ignore
11758
- this._$canvas.addEventListener("mouseover",this._mouseoverFun),
11759
- // prettier-ignore
11760
- this._$canvas.addEventListener("mouseleave",this._mouseleaveFun),
11761
- // prettier-ignore
11762
- this._$canvas.addEventListener("mousedown",this._mousedownFun),
11763
- // prettier-ignore
11764
- this._$canvas.addEventListener("mouseup",this._mouseUpFun),this._$canvas.addEventListener("wheel",this._mousewheelFun),
11765
- // prettier-ignore
11766
- this.$container.addEventListener("wheel",function(e){e.preventDefault();},{passive:false}),this._$canvas.addEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.addEventListener("keyup",this._ctrlKeyUpFun),
11767
- // ctrl 键事件
11768
- document.addEventListener("keydown",this._ctrlKeyDownFun,false),document.addEventListener("keyup",this._ctrlKeyUpFun,false),this._$canvas.addEventListener("touchstart",this._touchstartFun,{passive:false}),this._$canvas.addEventListener("touchmove",this._touchmoveFun,{passive:false}),this._$canvas.addEventListener("touchend",this._touchendFun,{passive:false}));},
11769
- /**
11770
- * 移除事件监听
11771
- * @returns
11772
- */
11773
- _proto._removeEventListener=function(){this._$canvas&&(
11774
- // 事件监听
11775
- this._$canvas.removeEventListener("mousemove",this._mousemoveFun),
11776
- // prettier-ignore
11777
- this._$canvas.removeEventListener("mouseover",this._mouseoverFun),
11778
- // prettier-ignore
11779
- this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun),
11780
- // prettier-ignore
11781
- this._$canvas.removeEventListener("mousedown",this._mousedownFun),
11782
- // prettier-ignore
11783
- this._$canvas.removeEventListener("mouseup",this._mouseUpFun),this._$canvas.removeEventListener("wheel",this._mousewheelFun),this._$canvas.removeEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.removeEventListener("keyup",this._ctrlKeyUpFun),
11784
- // ctrl 键事件
11785
- document.removeEventListener("keydown",this._ctrlKeyDownFun),document.removeEventListener("keyup",this._ctrlKeyUpFun),
11786
- // touch
11787
- this._$canvas.removeEventListener("touchstart",this._touchstartFun),this._$canvas.removeEventListener("touchmove",this._touchmoveFun),this._$canvas.removeEventListener("touchend",this._touchendFun));},
11788
- /**
11789
- * 鼠标按下事件监听
11790
- * @param e - 鼠标事件
11791
- * @returns
11792
- */
11793
- _proto._mousedownFun=function(e){this.readOnly||(this._isMouseDown=true,this._mousePosition=e.pageX,this._oldTime=this.current,null==this.options.onDragStart||this.options.onDragStart.call(this.options,this.current));},
11794
- /**
11795
- * 鼠标移入事件监听
11796
- * @returns
11797
- */
11798
- _proto._mouseoverFun=function(){this.readOnly||(this._isOver=true);},
11799
- /**
11800
- * 鼠标离开事件监听
11801
- * @returns
11802
- */
11803
- _proto._mouseleaveFun=function(e){this.readOnly||(this._isOver=false,this._moveEndOrTouchEndFun(e));},
11804
- /**
11805
- * 鼠标抬起事件监听
11806
- * @returns
11807
- */
11808
- _proto._mouseUpFun=function(e){this._moveEndOrTouchEndFun(e);},
11809
- /**
11810
- * 鼠标移动事件监听
11811
- * @param e - 鼠标事件
11812
- * @returns
11813
- */
11814
- _proto._mousemoveFun=function(e){if(!this.readOnly)if(this._isMouseDown&&this._isOver)
11815
- // 鼠标按下位置和移动位置的偏移量
11816
- this._moveUpdateFun(e.pageX);else {var left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left,this._update();}
11817
- // const time = new Date(
11818
- // // prettier-ignore
11819
- // this.current.getTime() + parseInt(((e.pageX - this.width / 2) / this._curScaleSpacing ) * this._timeWidthArray[0] + "", 10) * 1000,
11820
- // );
11821
- },
11822
- /**
11823
- * 鼠标滚轮滚动
11824
- * @param e - 鼠标滚轮滚动事件
11825
- * @returns
11826
- */
11827
- _proto._mousewheelFun=function(e){e.preventDefault(),this.readOnly;},
11828
- /**
11829
- * ctrl键按下事件
11830
- * @param e - 键盘按下事件
11831
- */
11832
- _proto._ctrlKeyDownFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=true);},
11833
- /**
11834
- * ctrl键抬起事件
11835
- * @param e - 键盘按下事件
11836
- */
11837
- _proto._ctrlKeyUpFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=false);},
11838
- // ----------------------------------------------------------------------
11839
- // touch
11840
- // ----------------------------------------------------------------------
11841
- /**
11842
- * 触摸距离
11843
- * @param touches - 两指触摸点
11844
- * @returns
11845
- */
11846
- _proto._getTouchDistance=function(touches){var touch1=touches[0],touch2=touches[1],dx=touch2.clientX-touch1.clientX,dy=touch2.clientY-touch1.clientY;return Math.sqrt(dx*dx+dy*dy)},
11847
- /**
11848
- * 触摸开始
11849
- * @param e - 触摸事件
11850
- * @returns
11851
- */
11852
- _proto._touchstartFun=function(e){if(!this.readOnly)if(this._oldTime=this.current,this._isOver=true,1===e.touches.length){
11853
- // 单指
11854
- var touch=e.touches[0];this._isMouseDown=true,this._mousePosition=touch.clientX;}else 2===e.touches.length&&(
11855
- // 双指
11856
- this._lastTouchDist=this._getTouchDistance(e.touches));},
11857
- /**
11858
- * 触摸移动
11859
- * @param e - 触摸事件
11860
- * @returns
11861
- */
11862
- _proto._touchmoveFun=function(e){if(e.preventDefault(),// 防止页面缩放
11863
- e.stopPropagation(),!this.readOnly)if(1===e.touches.length){
11864
- // 单指
11865
- var touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else if(2===e.touches.length){
11866
- // 双指
11867
- this._getTouchDistance(e.touches);this._lastTouchDist;}},
11868
- /**
11869
- * 触摸结束
11870
- * @param e - 触摸事件
11871
- * @returns
11872
- */
11873
- _proto._touchendFun=function(e){this.readOnly||this._moveEndOrTouchEndFun(e);},
11874
- /**
11875
- * 拖动结束
11876
- * @returns
11877
- */
11878
- _proto._moveEndOrTouchEndFun=function(e){e.preventDefault(),this.readOnly||this._isMouseDown&&(this._isMouseDown=false,this._moved&&(this._moved=false,this._update({current:this.current}),this._oldTime=this.current,null==this.options.onDragEnd||this.options.onDragEnd.call(this.options,this.current,this._isOver)),this._isOver&&Math.abs(this._mousePosition-(e.pageX||0))>5&&(null==this.options.onChange||this.options.onChange.call(this.options,this.current)),this._mousePosition=0,this._lastTouchDist=0);},
11879
- /**
11880
- * 移动更新时间
11881
- * @param x - 移动的x坐标
11882
- * @returns
11883
- */
11884
- _proto._moveUpdateFun=function(x){
11885
- // 鼠标按下位置和移动位置的偏移量
11886
- var mouseOffset=this._mousePosition-x;
11887
- // fix点击引起mousemove的问题
11888
- if(0!==mouseOffset){if(this._oldTime){
11889
- // prettier-ignore
11890
- var currentTime=this._oldTime.getTime()+1e3*parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10);this._update({current:new Date(currentTime)}),null==this.options.onDragging||this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}},_create_class(TimeLine,[{key:"_curScaleSpacing",get:// -----------------------------------------------------------------------------------------
11891
- // private
11892
- // -----------------------------------------------------------------------------------------
11893
- /**
11894
- * 缩放时间轴 动态减少间距 (没处理 dpr)
11895
- * @returns 刻度间距
11896
- */
11897
- function(){var _this__timeWidthArray,_this__timeWidthArray1;return Math.floor((null==(_this__timeWidthArray=this._timeWidthArray)?void 0:_this__timeWidthArray[1])-(null==(_this__timeWidthArray1=this._timeWidthArray)?void 0:_this__timeWidthArray1[1])*+(this.timeWidth%1/2).toFixed(2));// 刻度间距
11898
- }}]),TimeLine}(BaseTimeLine);
11899
- /**
11900
- * 时间轴控件类, 支持PC/Mobile 拖动和缩放
11901
- * @beta
11902
- * @example
11903
- * ```ts
11904
- * import TimeLine from './TimeLine';
11905
- * const timeLine = new TimeLine(document.getElementById('container'), {})
11906
- * ```
11907
- */TimeLine.TIME_WIDTH=TIME_WIDTH;var index={MobileTimeLine:MobileTimeLine,TimeLine:TimeLine,BaseTimeLine:BaseTimeLine};exports.BaseTimeLine=BaseTimeLine,exports.MobileTimeLine=MobileTimeLine,exports.TimeLine=TimeLine,module.exports=index;
11908
- } (dist$1, dist$1.exports));
11909
- return dist$1.exports;
11342
+ var deepmerge=requireCjs(),I18n=requireDist$7(),Picker=requireDist$a(),DragScroll=requireDist$1(),delegate=requireDist$9(),_$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};function _create_class$2(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}var _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",onChange:function(){},onDragStart:function(){},onDragging:function(){},onDragEnd:function(){},onDestroy:function(){}},BaseTimeLine=function(){function BaseTimeLine(container,options){if(this._current=new Date,this._readOnly=false,this._width=0,this._height=0,this._destroyed=false,this._timeWidth=0,this._timeSections=[],this.$container=container,!container)throw new Error("container is required");var left,right;this.options=deepmerge(_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}),this.options.timeSections&&Array.isArray(this.options.timeSections)&&(this._timeSections=this.options.timeSections),this.options.readOnly&&(this.readOnly=this.options.readOnly),this.options.className&&this.$container.classList.add(this.options.className),this.$container.style.position="relative",this.options.current&&(left=this.options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?this._current=this.options.current||new Date:this._current=new Date,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);}var _proto=BaseTimeLine.prototype;return _proto.setReadOnly=function(readOnly){this.readOnly=readOnly;},_proto.update=function(current){this._current=current;},_proto.updateTimeSections=function(timeSections){timeSections&&Array.isArray(timeSections)&&(this._timeSections=timeSections);},_proto.resize=function(width,height){this._resize(width,height);},_proto._resize=function(width,height){var cssText="";/^\d+(\.\d+)?$/.test(width+"")?cssText+="width: "+width+"px;":width&&(cssText+="width: "+width+";"),/^\d+(\.\d+)?$/.test(height+"")?cssText+="height: "+height+"px;":height&&(cssText+="height: "+height+";"),this.$container&&(this.$container.style.cssText+=cssText),this._width=Math.floor(this.$container.clientWidth),this._height=Math.floor(this.$container.clientHeight);},_proto.setTimeWidth=function(timeWidth){[0,1,2,3,4,5].includes(timeWidth)&&(this._timeWidth=timeWidth);},_proto.destroy=function(){this._current=null,null==this.options.onDestroy||this.options.onDestroy.call(this.options),this._timeSections=[],this._readOnly=false,this._destroyed=true;},_create_class$2(BaseTimeLine,[{key:"current",get:function(){return this._current},set:function(current){this._current=current;}},{key:"readOnly",get:function(){return this._readOnly},set:function(readOnly){this._readOnly!==readOnly&&(this._readOnly=readOnly,this.$container.style.cursor=readOnly?"not-allowed":"pointer");}},{key:"timeSections",get:function(){return this._timeSections}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"timeWidth",get:function(){return this._timeWidth}}]),BaseTimeLine}();BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;var TimeLineUtil=function(){function TimeLineUtil(){}return TimeLineUtil.toDate=function(time){var left,right,date=null;return "string"==typeof time&&time.includes(":")?date=new Date(time):"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||10!==(time+"").length?"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||13!==(time+"").length?(left=time,date=(null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?time:new Date):date=new Date(+time):date=new Date(1e3*+time),date},TimeLineUtil.formatDateToHHmmss=function(time){var date=TimeLineUtil.toDate(time);if(date){var h=date.getHours(),m=date.getMinutes(),s=date.getSeconds();return (h>9?h:"0"+h)+":"+(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)}return "00:00:00"},TimeLineUtil.subTime=function(m){return +m>9?m+"":"0"+m},TimeLineUtil.tranTime=function(time,fmt){ void 0===fmt&&(fmt="YYYY-MM-DD HH:mm:ss");var newDate=TimeLineUtil.toDate(time);return newDate?"YYYY-MM-DD"===fmt?newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate()):"HH:mm:ss"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH"===fmt?TimeLineUtil.subTime(newDate.getHours()):"mm:ss"===fmt?TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH:mm"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes()):"YYYYMMDDTHHmmssZ"===fmt?newDate.getFullYear()+""+TimeLineUtil.subTime(newDate.getMonth()+1)+TimeLineUtil.subTime(newDate.getDate())+"T"+TimeLineUtil.subTime(newDate.getHours())+TimeLineUtil.subTime(newDate.getMinutes())+TimeLineUtil.subTime(newDate.getSeconds())+"Z":newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate())+" "+TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):""},TimeLineUtil.timeToSecond=function(time){var e=time.split(":");return 60*Number(e[0])*60+60*Number(e[1])+(Number(e[2])||0)},TimeLineUtil.minuteToTime=function(minute){var hour=Math.floor(minute/60),m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)},TimeLineUtil.timeToMinute=function(time){var e=time.split(":");return 60*Number(e[0])+Number(e[1])},TimeLineUtil.isOverlap=function(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)},TimeLineUtil.tranTimeToString=function(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1,secondNum=Math.floor((null==(_TimeLineUtil_toDate=TimeLineUtil.toDate(end))?void 0:_TimeLineUtil_toDate.getTime())-(null==(_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))?void 0:_TimeLineUtil_toDate1.getTime()))/1e3,second=secondNum%60,minute=Math.floor(secondNum/60);return (minute>0?TimeLineUtil.subTime(minute)+"'":"0'")+TimeLineUtil.subTime(second)+"''"},TimeLineUtil}(),_$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>',_$TIMELINE_ICONS$__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 ',_$TIMELINE_ICONS$__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 ',_$TIMELINE_ICONS$__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 ',_$TIMELINE_ICONS$__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 ',_$TIMELINE_ICONS$__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 ',TIME_WIDTH=[[1,10,10,"单位 1秒"],[60,20,5,"单位 1分钟"],[600,20,6,"单位 10分钟"],[3600,30,6,"单位 1小时"],[14400,40,2,"单位 4小时"],[43200,80,2,"单位 12小时"]],MOBILE_TIME_WIDTH=[[1,10,10,"单位 1分钟"],[10,20,5,"单位 10分钟"],[30,20,6,"单位 30分钟"],[60,30,6,"单位 1小时"],[120,40,2,"单位 2小时"],[240,80,2,"单位 4小时"]];function _create_class$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$1(){return _extends$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$1.apply(this,arguments)}function _set_prototype_of$1(o,p){return _set_prototype_of$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1(o,p)}var _$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",currentTimeBgColor:"#648FFC",currentTimeColor:"#FFFFFF",showTimeWidthBtn:true}),MobileTimeLine=function(BaseTimeLine){function MobileTimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}))||this)._isTouchStart=false,_this._dragScroll=null,_this._moveStartX=0,_this._moveStartY=0,_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(),_this.options.timeSections&&Array.isArray(_this.options.timeSections)&&_this.updateTimeSections(_this.options.timeSections),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1(subClass,superClass);}(MobileTimeLine,BaseTimeLine);var _proto=MobileTimeLine.prototype;return _proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._dragScroll&&(this._dragScroll.readonly=readOnly);},_proto.setTimeWidth=function(timeWidth){MOBILE_TIME_WIDTH[timeWidth]&&(BaseTimeLine.prototype.setTimeWidth.call(this,timeWidth),this._matchTimeDot());},_proto.updateTimeSections=function(timeSections,defaultIndex){BaseTimeLine.prototype.updateTimeSections.call(this,timeSections);var list=timeSections.map(function(record){return _extends$1({},record,{startTime:TimeLineUtil.formatDateToHHmmss(record.startTime),endTime:TimeLineUtil.formatDateToHHmmss(record.endTime)})});if(list.length>0){ void 0===defaultIndex&&(defaultIndex=list.length-1);var current=this.state.current;this._setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:null===current?list[defaultIndex].startTime:current}),this._matchTimeDot();}else this._setState({availTimeLine:[],current:TimeLineUtil.formatDateToHHmmss(this.current||(new Date).getTime())}),this._matchTimeDot();},_proto.update=function(time){var _this__dragScroll;time&&!(null==(_this__dragScroll=this._dragScroll)?void 0:_this__dragScroll.isDragging)&&(this._setState({current:TimeLineUtil.tranTime(time,"HH:mm:ss")}),this._currentOffsetH());},_proto.destroy=function(){var _this__dragScroll,_this__picker_$body_querySelectorAll,_this__picker_$body;if(this._scrollTimer&&(clearInterval(this._scrollTimer),this._scrollTimer=null),this._$currentTime)try{this.$container.removeChild(this._$currentTime),this._$currentTime=null;}catch(error){}if(this._$itemList&&this._imageRemoveErrorEvent(this._$itemList.querySelectorAll("img.ez-time-line-img")||[]),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){}this._picker&&(this._imageRemoveErrorEvent((null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelectorAll=_this__picker_$body.querySelectorAll)?void 0:_this__picker_$body_querySelectorAll.call(_this__picker_$body,"img"))||[]),this._picker.destroy(),this._picker=null);this._removeEventListener(),null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.destroy(),this._dragScroll=null,BaseTimeLine.prototype.destroy.call(this);},_proto._setState=function(obj){var _this=this;Object.keys(obj).forEach(function(key){var _this__dragScroll,_this_timeSections_;"current"===key&&obj[key]?(_this._setCurrentDOM(obj[key]),_this.state.current===obj[key]||(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.isDragging)||(_this.state[key]=obj[key],_this.current=new Date(TimeLineUtil.tranTime((null==(_this_timeSections_=_this.timeSections[0])?void 0:_this_timeSections_.endTime)||(new Date).getTime(),"YYYY-MM-DD")+" "+obj[key]),null==_this.options.onChange||_this.options.onChange.call(_this.options,_this.current))):_this.state[key]=obj[key];});},_proto._setCurrentDOM=function(time){this._$currentTime&&(this._$currentTime.querySelector(".ez-time-line-current-value").innerHTML=time);},_proto._matchTimeDot=function(){for(var scaleWidth=this._scaleWidth,timeArr=[],minute=TimeLineUtil.timeToMinute("24:00:00"),i=minute=Math.floor(minute/scaleWidth)*scaleWidth;i>=0;){var marginTop=0,marginBottom=0;i==minute&&(marginTop=70),0==i&&(marginBottom=this.$container.clientHeight-70);var 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();},_proto._matchRecTimeDot=function(){var _this_state=this.state,availTimeLine=_this_state.availTimeLine,timeArr=_this_state.timeArr,scaleWidth=this._scaleWidth,len=availTimeLine.length;if(0===len)for(var j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(var k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(var i=0;i<len;i++){var stAvailPercent,etAvailPercent,temp=availTimeLine[i],st=TimeLineUtil.timeToSecond(temp.startTime),et=TimeLineUtil.timeToSecond(temp.endTime),stMinute=Math.floor(st/(60*scaleWidth))*scaleWidth;stAvailPercent=(st-60*stMinute)/scaleWidth;var etMinute=Math.floor(et/(60*scaleWidth))*scaleWidth;etAvailPercent=(et-60*etMinute)/scaleWidth;for(var j1=0;j1<timeArr.length;j1++)if(timeArr[j1].id==stMinute&&timeArr[j1].id==etMinute){var height=etAvailPercent-stAvailPercent,top=60-etAvailPercent;timeArr[j1].recArr.push({height:height,top:top});}else timeArr[j1].id==stMinute?timeArr[j1].recArr.push({height:60-stAvailPercent,top:0}):timeArr[j1].id==etMinute?timeArr[j1].recArr.push({height:etAvailPercent,top:60-etAvailPercent}):timeArr[j1].id>stMinute&&timeArr[j1].id<etMinute&&timeArr[j1].recArr.push({height:60,top:0});}}this._setState({timeArr:timeArr}),this._renderDateLine();},_proto._renderDateLine=function(){var _this=this,timeArr=this.state.timeArr,container=this._$itemList;this._imageRemoveErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]),container.innerHTML="",timeArr.forEach(function(item,index){var timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class","ez-time-line-time-scale-area"),item.marginTop&&(timeItemDOM.style.cssText+="margin-top: "+item.marginTop+"px;"),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+""),document.createElement("div").setAttribute("class","ez-time-line-scale");var timeItemHtml="";item.coverArr.length&&(timeItemHtml+='\n <div class="ez-time-line-time-cover-fold '+(item.coverArr.length>1?"ez-time-line-time-cover-fold-multiple":"")+'"\n data-start="'+item.current+'">\n '+(item.coverArr.length>1?'<div class="ez-time-line-cover-fold-placeholder" style="color: #FFF"></div>':"")+'\n <div class="ez-time-line-time-cover-fold-img">\n <img src="'+_this._setImageScr(item.coverArr[0].coverPic)+'" class="ez-time-line-img"/>\n <span class="ez-time-line-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 "+(1===item.coverArr.length?'<span class="ez-time-line-time-cover-fold-time">'+TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)+"</span>":"")+'\n <span class="ez-time-line-time-cover-fold-pause">'+_$TIMELINE_ICONS$__pause+"</span>\n </div>\n </div>"),item.recArr.forEach(function(i){timeItemHtml+='<div class="ez-time-line-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="ez-time-line-time-label" style="color: '+(_this.options.timeTextColor||"#666")+'">'+item.current+"</div>",timeItemDOM.innerHTML=timeItemHtml,container.appendChild(timeItemDOM),_this._imageErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]);}),this._currentOffsetH();},_proto._currentOffsetH=function(){var current=this.state.current;if(current){var _this__dragScroll,y=(86400-TimeLineUtil.timeToSecond(current)||0)/this._scaleWidth;null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y+60,false);}},_proto._render=function(){var _this=this;if(this._$currentTime=document.createElement("div"),this._$currentTime.classList.add("ez-time-line-current"),this._$currentTime.innerHTML='<div class="ez-time-line-current-content" style="color: '+(this.options.currentTimeBgColor||"#648FFC")+'">\n <span class="ez-time-line-current-tip">'+_$TIMELINE_ICONS$__tip+'</span>\n <span class="ez-time-line-current-tip-line" style="background-color: '+(this.options.timePointColor||"#648FFC")+';"></span>\n <div class="ez-time-line-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("ez-time-line-container"),this.$container.appendChild(this._$itemContainer),this._dragScroll=new DragScroll(this._$itemContainer,{hideScrollbar:true,onChange:function(state){var result=_this._offsetYToTime(state.y);result[1]!==_this.state.current&&_this._setCurrentDOM(result[0]>=86400?"23:59:59":result[1]);},onDragStart:function(e){_this._moveStartX=e.clientX,_this._moveStartY=e.clientY,null==_this.options.onDragStart||_this.options.onDragStart.call(_this.options,_this.state.current);},onDragging:function(){null==_this.options.onDragging||_this.options.onDragging.call(_this.options,_this.state.current);},onDragEnd:function(){var _this__dragScroll,result=_this._offsetYToTime(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.currentY);result[1]!==_this.state.current&&_this._setState({current:result[0]>=86400?"23:59:59":result[1]}),null==_this.options.onDragEnd||_this.options.onDragEnd.call(_this.options,_this.state.current);}}),/\d/.test(this.options.height))this._$itemContainer.style.cssText+="height: "+this.options.height+"px";else if("string"==typeof this.options.height)this._$itemContainer.style.cssText+="height: "+this.options.height;else {var height=this.$container.clientHeight;this._$itemContainer.style.cssText+="height: "+height+"px";}this._$itemList=document.createElement("div"),this._$itemList.classList.add("ez-time-line-item"),this._dragScroll.$content.appendChild(this._$itemList),this.options.showTimeWidthBtn&&(this._$op=document.createElement("div"),this._$op.classList.add("ez-time-line-op"),this._$op.innerHTML='<span class="ez-time-line-op-wrapper"><span class="ez-time-line-icon-plus">'+_$TIMELINE_ICONS$__plus+'</span> <span class="ez-time-line-icon-minus">'+_$TIMELINE_ICONS$__minus+"</span></span>",this.$container.appendChild(this._$op)),this._picker=new Picker(null,{isMobile:true,wrapClassName:"ez-time-line-picker",onOpenChange:function(isOpen){var _this_options_onPickerOpenChange,_this_options;null==(_this_options=_this.options)||null==(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)||_this_options_onPickerOpenChange.call(_this_options,isOpen);}}),this._addEventListener();},_proto._addEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.addEventListener("click",this._plusClick,false),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.addEventListener("click",this._minusClick,false));this._matchTimeDot(),this._picker&&(this._delegatePickerClose=delegate(this._picker.$body,".ez-time-line-picker-close","click",this._onPickerClose,false),this._delegateItemContent=delegate(this._picker.$body,".ez-time-line-picker-item-content","click",this._onClickItem,false),this._delegateCoverFold=delegate(this._$itemList,".ez-time-line-time-cover-fold","click",this._onClickCoverFold,false));},_proto._removeEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1,_this__picker_$body_querySelector,_this__picker_$body;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.removeEventListener("click",this._plusClick),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.removeEventListener("click",this._minusClick));this._picker&&(null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelector=_this__picker_$body.querySelector(".ez-time-line-picker-close"))||_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose),this._delegateItemContent&&(this._delegateItemContent.forEach(function(delegation){delegation.destroy();}),this._delegateItemContent=null),this._delegatePickerClose&&(this._delegatePickerClose.forEach(function(delegation){delegation.destroy();}),this._delegatePickerClose=null),this._delegateCoverFold&&(this._delegateCoverFold.forEach(function(delegation){delegation.destroy();}),this._delegateCoverFold=null));},_proto._plusClick=function(){var timeWidth=this.timeWidth+1;timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(timeWidth);},_proto._minusClick=function(){var timeWidth=this.timeWidth-1;timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(Math.floor(timeWidth));},_proto._timeSectionsToGroupsByHour=function(list){var obj={};return list.forEach(function(item,index){var hour=TimeLineUtil.tranTime(item.startTime,"HH");obj[+hour]?obj[+hour].push(_extends$1({},item,{_index:index})):obj[+hour]=[_extends$1({},item,{_index:index})];}),obj},_proto._filterTimeSectionsByTime=function(start){if(!start)return [];var startSecond=TimeLineUtil.timeToSecond(start+":00"),endSecond=TimeLineUtil.timeToSecond(start+":00")+60*this._scaleWidth;return this.timeSections.filter(function(item){var _$start=TimeLineUtil.timeToSecond(TimeLineUtil.tranTime(item.startTime,"HH:mm:ss"));return _$start>=startSecond&&_$start<endSecond})},_proto._renderPickerContent=function(start){var _this__picker_innerHTML,_this__picker,_this__picker1,_this__picker2,_this=this,list=this._filterTimeSectionsByTime(start),hourGroups=this._timeSectionsToGroupsByHour(list);(null==(_this__picker=this._picker)||null==(_this__picker_innerHTML=_this__picker.innerHTML)||_this__picker_innerHTML.call(_this__picker,'<div class="ez-time-line-picker-container">\n <div class="ez-time-line-picker-header">\n <span class="ez-time-line-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="ez-time-line-picker-content">\n <div class="ez-time-line-picker-list">\n '+Object.keys(hourGroups).reverse().map(function(key){return '<div class="ez-time-line-picker-item">\n <div class="ez-time-line-picker-item-title">'+key+':00</div>\n <div class="ez-time-line-picker-item-list">\n '+hourGroups[key].reverse().map(function(item){return '<div class="ez-time-line-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="ez-time-line-picker-item-time">'+TimeLineUtil.tranTime(item.startTime,"HH:mm")+'</span>\n <span class="ez-time-line-picker-item-duration">\n '+TimeLineUtil.tranTimeToString(item.startTime,item.endTime)+'\n </span>\n <img class="ez-time-line-picker-item-cover" src="'+_this._setImageScr(item.coverPic)+'"/>\n </div>'}).join("")+"\n </div>\n </div>"}).join("")+"\n </div>\n </div>\n </div>\n </div>"),null==(_this__picker1=this._picker)?void 0:_this__picker1.$body)&&this._imageErrorEvent((null==(_this__picker2=this._picker)?void 0:_this__picker2.$body.querySelectorAll("img"))||[]);},_proto._imageErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){img.hasAttribute("data-error")||img.addEventListener("error",_this._onImageError);});},_proto._imageRemoveErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){img.removeEventListener("error",_this._onImageError);});},_proto._onImageError=function(e){var img=e.target;if(!img.hasAttribute("data-error")){var _img_parentNode,placeholder=document.createElement("div");placeholder.classList.add("ez-time-line-item-cover-placeholder"),placeholder.innerHTML=""+_$TIMELINE_ICONS$__picture,null==(_img_parentNode=img.parentNode)||_img_parentNode.appendChild(placeholder),img.remove();}},_proto._onPickerClose=function(){this._picker&&(this._picker.open=false);},_proto._onClickItem=function(e){var _e_delegateTarget_getAttribute,_e_delegateTarget,index=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_getAttribute=_e_delegateTarget.getAttribute)?void 0:_e_delegateTarget_getAttribute.call(_e_delegateTarget,"data-index");this._picker&&(this._picker.open=false),null==this.options.onPickerSelect||this.options.onPickerSelect.call(this.options,this.timeSections[+index]);},_proto._onClickCoverFold=function(e){var _e_delegateTarget_parentElement_getAttribute,_e_delegateTarget_parentElement,_e_delegateTarget;e.preventDefault();var time=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_parentElement=_e_delegateTarget.parentElement)||null==(_e_delegateTarget_parentElement_getAttribute=_e_delegateTarget_parentElement.getAttribute)?void 0:_e_delegateTarget_parentElement_getAttribute.call(_e_delegateTarget_parentElement,"data-time"),moveX=Math.abs(this._moveStartX-e.clientX),moveY=Math.abs(this._moveStartY-e.clientY);this._picker&&time&&!(moveX>=1||moveY>=1)&&(this._renderPickerContent(time),this._picker.open=true);},_proto._setImageScr=function(src){if(src){var query="x=200&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""},_proto._offsetYToTime=function(offsetY){var _this__dragScroll,y=offsetY;offsetY<60&&(y=60,null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y));var second=86400-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)]},_create_class$1(MobileTimeLine,[{key:"_scaleWidth",get:function(){return (MOBILE_TIME_WIDTH[this.timeWidth]||MOBILE_TIME_WIDTH[0])[0]}}]),MobileTimeLine}(BaseTimeLine);function _create_class(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends.apply(this,arguments)}function _set_prototype_of(o,p){return _set_prototype_of=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of(o,p)}var _$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,scaleOffsetTop:4,showYearMonthDay:true},TimeLine=function(BaseTimeLine){function TimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$TIMELINE_DEFAULT_OPTIONS$_,options,{clone:true}))||this)._$canvas=null,_this._ctx=null,_this._timeWidthArray=TIME_WIDTH[0],_this._centerPositionX=0,_this._isMouseDown=false,_this._mousePosition=0,_this._oldTime=null,_this._isOver=false,_this._moved=false,_this._isCtrlKeyDown=false,_this._lastTouchDist=0,_this.$container=container,_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(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of(subClass,superClass);}(TimeLine,BaseTimeLine);var _proto=TimeLine.prototype;return _proto._init=function(){this._$canvas=document.createElement("canvas"),this._ctx=this._$canvas.getContext("2d"),this.readOnly||(this._$canvas.style.cssText+="cursor: pointer;"),this.$container.appendChild(this._$canvas),this.resize(this.width,this.height),this._update({current:this.current,timeWidth:this.timeWidth,timeSections:this.timeSections}),this._addEventListener();},_proto.resize=function(width,height){BaseTimeLine.prototype.resize.call(this,width,height),this._$canvas&&width&&(this._$canvas.width=this.width*this.options.dpr,this._$canvas.style.cssText+="width: "+this.width+"px;"),this._$canvas&&height&&(this._$canvas.height=this.height*this.options.dpr,this._$canvas.style.cssText+="height: "+this.height+"px;"),this._draw();},_proto.setTimeWidth=function(timeWidth){this._update({timeWidth:timeWidth});},_proto.updateTimeSections=function(timeSections){this._update({timeSections:timeSections});},_proto.update=function(time){time&&!this._isMouseDown&&this._update({current:new Date(TimeLineUtil.tranTime(time,"YYYY-MM-DD HH:mm:ss"))});},_proto._update=function(options){var left,right,_this__$canvas;(void 0===options&&(options={}),(null==options?void 0:options.current)&&(left=options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(this.current=options.current),(null==options?void 0:options.timeSections)&&BaseTimeLine.prototype.updateTimeSections.call(this,this._mergeTimeSections(options.timeSections)),"number"==typeof(null==options?void 0:options.timeWidth)&&(null==options?void 0:options.timeWidth)<TIME_WIDTH.length&&(BaseTimeLine.prototype.setTimeWidth.call(this,options.timeWidth),this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)]),"number"==typeof(null==options?void 0:options.timeWidth)&&this._timeWidthArray)&&(this._timeWidthArray[3]&&(null==(_this__$canvas=this._$canvas)||_this__$canvas.setAttribute("data-title",this._timeWidthArray[3])));this._draw();},_proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._$canvas&&(this._$canvas.style.cssText+="cursor: "+(readOnly?"not-allowed":"pointer"));},_proto.destroy=function(){if(this._removeEventListener(),this._$canvas)try{this.$container.removeChild(this._$canvas),this._$canvas=null;}catch(e){}BaseTimeLine.prototype.destroy.call(this);},_proto._draw=function(){this._ctx&&(this._ctx.fillStyle=this.options.timeAxisBgColor,this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr)),this._drawSections(),this._drawScale();},_proto._drawScale=function(){var lineWidth=1*this.options.dpr;this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");for(var centerPosition={x:this.width*this.options.dpr/2,y:this.height*this.options.dpr},curScaleTime=Math.floor(this.current.getTime()/1e3),offsetSecond=(curScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*curScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%this._timeWidthArray[0],padding=this.height*this.options.dpr/20,spacing=this._curScaleSpacing*this.options.dpr,rightLastScaleTimeX=Math.floor(this._centerPositionX+(this._timeWidthArray[0]-offsetSecond)/this._timeWidthArray[0]*spacing),leftLastScaleTime=curScaleTime-offsetSecond,rightLastScaleTime=leftLastScaleTime+this._timeWidthArray[0],x=rightLastScaleTimeX-spacing;x>0;x-=spacing){0===(leftLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),leftLastScaleTime-=this._timeWidthArray[0];}for(var x1=rightLastScaleTimeX;x1<=this.width*this.options.dpr;x1+=spacing){0===(rightLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(this._drawSolidLine(x1,padding,x1,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime)),x1,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x1,padding,x1,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),rightLastScaleTime+=this._timeWidthArray[0];}this._drawSolidLine(centerPosition.x,0,centerPosition.x,centerPosition.y,lineWidth,this.options.timePointColor);},_proto._drawSolidLine=function(startX,startY,endX,endY,lineWidth,color){this._ctx&&(this._ctx.save(),this._ctx.strokeStyle=null!=color?color:this.options.timeScaleColor,this._ctx.lineWidth=lineWidth,this._ctx.beginPath(),this._ctx.moveTo(startX,startY),this._ctx.lineTo(endX,endY),this._ctx.stroke(),this._ctx.restore());},_proto._drawTextString=function(text,x,y,align){if(this._ctx){var timeTexts=text.split(" ");this._ctx.font=12*this.options.dpr*1+"px serif",this._ctx.fillStyle=this.options.timeTextColor,this._ctx.textAlign=align||"left",this._timeWidthArray[0]%60==0&&(timeTexts[1]=timeTexts[1].replace(/:00$/,"")),this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr),!this.options.showYearMonthDay||"00:00:00"!==timeTexts[1]&&"00:00"!==timeTexts[1]&&this._timeWidthArray[0]*this._timeWidthArray[2]!==86400||(this._ctx.textAlign=align||"left",this._ctx.fillText(timeTexts[0],x,y+18*this.options.dpr));}},_proto._drawSections=function(){for(var timeArr=this.timeSections||[],i=0;i<timeArr.length;i++){var position=this._findPosition(timeArr[i]);this._ctx&&TimeLineUtil.isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)&&(this._ctx.fillStyle=this.options.timeSectionColor,this._ctx.fillRect(position.x1,0,position.x2-position.x1,this.height*this.options.dpr));}},_proto._findPosition=function(item){var x1=(parseInt((item.startTime-this.current.getTime())/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing+this.width/2)*this.options.dpr;return {x1:x1,x2:x1+parseInt((item.endTime-item.startTime)/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing*this.options.dpr}},_proto._mergeTimeSections=function(timeSections){if(0===timeSections.length)return timeSections;for(var merged=[(timeSections=timeSections.map(function(item){return 10===(item.startTime+"").length&&(item.startTime=1e3*item.startTime),10===(item.endTime+"").length&&(item.endTime=1e3*item.endTime),_extends({},item,{startTime:item.startTime,endTime:item.endTime})}))[0]],i=1;i<timeSections.length;i++){var prev=merged[merged.length-1],curr=timeSections[i];prev.endTime>=curr.startTime?prev.endTime=Math.max(prev.endTime,curr.endTime):merged.push(curr);}return merged},_proto._addEventListener=function(){this._$canvas&&(this._$canvas.addEventListener("mousemove",this._mousemoveFun),this._$canvas.addEventListener("mouseover",this._mouseoverFun),this._$canvas.addEventListener("mouseleave",this._mouseleaveFun),this._$canvas.addEventListener("mousedown",this._mousedownFun),this._$canvas.addEventListener("mouseup",this._mouseUpFun),this._$canvas.addEventListener("wheel",this._mousewheelFun),this.$container.addEventListener("wheel",function(e){e.preventDefault();},{passive:false}),this._$canvas.addEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.addEventListener("keyup",this._ctrlKeyUpFun),document.addEventListener("keydown",this._ctrlKeyDownFun,false),document.addEventListener("keyup",this._ctrlKeyUpFun,false),this._$canvas.addEventListener("touchstart",this._touchstartFun,{passive:false}),this._$canvas.addEventListener("touchmove",this._touchmoveFun,{passive:false}),this._$canvas.addEventListener("touchend",this._touchendFun,{passive:false}));},_proto._removeEventListener=function(){this._$canvas&&(this._$canvas.removeEventListener("mousemove",this._mousemoveFun),this._$canvas.removeEventListener("mouseover",this._mouseoverFun),this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun),this._$canvas.removeEventListener("mousedown",this._mousedownFun),this._$canvas.removeEventListener("mouseup",this._mouseUpFun),this._$canvas.removeEventListener("wheel",this._mousewheelFun),this._$canvas.removeEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.removeEventListener("keyup",this._ctrlKeyUpFun),document.removeEventListener("keydown",this._ctrlKeyDownFun),document.removeEventListener("keyup",this._ctrlKeyUpFun),this._$canvas.removeEventListener("touchstart",this._touchstartFun),this._$canvas.removeEventListener("touchmove",this._touchmoveFun),this._$canvas.removeEventListener("touchend",this._touchendFun));},_proto._mousedownFun=function(e){this.readOnly||(this._isMouseDown=true,this._mousePosition=e.pageX,this._oldTime=this.current,null==this.options.onDragStart||this.options.onDragStart.call(this.options,this.current));},_proto._mouseoverFun=function(){this.readOnly||(this._isOver=true);},_proto._mouseleaveFun=function(e){this.readOnly||(this._isOver=false,this._moveEndOrTouchEndFun(e));},_proto._mouseUpFun=function(e){this._moveEndOrTouchEndFun(e);},_proto._mousemoveFun=function(e){if(!this.readOnly)if(this._isMouseDown&&this._isOver)this._moveUpdateFun(e.pageX);else {var left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left,this._update();}},_proto._mousewheelFun=function(e){e.preventDefault(),this.readOnly;},_proto._ctrlKeyDownFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=true);},_proto._ctrlKeyUpFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=false);},_proto._getTouchDistance=function(touches){var touch1=touches[0],touch2=touches[1],dx=touch2.clientX-touch1.clientX,dy=touch2.clientY-touch1.clientY;return Math.sqrt(dx*dx+dy*dy)},_proto._touchstartFun=function(e){if(!this.readOnly)if(this._oldTime=this.current,this._isOver=true,1===e.touches.length){var touch=e.touches[0];this._isMouseDown=true,this._mousePosition=touch.clientX;}else 2===e.touches.length&&(this._lastTouchDist=this._getTouchDistance(e.touches));},_proto._touchmoveFun=function(e){if(e.preventDefault(),e.stopPropagation(),!this.readOnly)if(1===e.touches.length){var touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else if(2===e.touches.length){this._getTouchDistance(e.touches);this._lastTouchDist;}},_proto._touchendFun=function(e){this.readOnly||this._moveEndOrTouchEndFun(e);},_proto._moveEndOrTouchEndFun=function(e){e.preventDefault(),this.readOnly||this._isMouseDown&&(this._isMouseDown=false,this._moved&&(this._moved=false,this._update({current:this.current}),this._oldTime=this.current,null==this.options.onDragEnd||this.options.onDragEnd.call(this.options,this.current,this._isOver)),this._isOver&&Math.abs(this._mousePosition-(e.pageX||0))>5&&(null==this.options.onChange||this.options.onChange.call(this.options,this.current)),this._mousePosition=0,this._lastTouchDist=0);},_proto._moveUpdateFun=function(x){var mouseOffset=this._mousePosition-x;if(0!==mouseOffset){if(this._oldTime){var currentTime=this._oldTime.getTime()+1e3*parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10);this._update({current:new Date(currentTime)}),null==this.options.onDragging||this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}},_create_class(TimeLine,[{key:"_curScaleSpacing",get:function(){var _this__timeWidthArray,_this__timeWidthArray1;return Math.floor((null==(_this__timeWidthArray=this._timeWidthArray)?void 0:_this__timeWidthArray[1])-(null==(_this__timeWidthArray1=this._timeWidthArray)?void 0:_this__timeWidthArray1[1])*+(this.timeWidth%1/2).toFixed(2))}}]),TimeLine}(BaseTimeLine);TimeLine.TIME_WIDTH=TIME_WIDTH,dist$1.BaseTimeLine=BaseTimeLine,dist$1.MobileTimeLine=MobileTimeLine,dist$1.TimeLine=TimeLine;
11343
+ return dist$1;
11910
11344
  }
11911
11345
 
11912
11346
  var distExports = requireDist();
@@ -12358,6 +11792,7 @@
12358
11792
  */ _proto.show = function show(playing, always) {
12359
11793
  var _this = this;
12360
11794
  var _this_$container_classList, _this_$container;
11795
+ if (!this.$container) return;
12361
11796
  if (!this._firstFlag) {
12362
11797
  this._firstFlag = true;
12363
11798
  } else {
@@ -13675,7 +13110,8 @@
13675
13110
  }));
13676
13111
  _this._isRotated();
13677
13112
  if (Utils.isMobile && !_this._isCurrentFullscreen) {
13678
- if (_this.controls.ptzControl) _this.controls.ptzControl.reset();
13113
+ var _this_controls;
13114
+ if ((_this_controls = _this.controls) == null ? void 0 : _this_controls.ptzControl) _this.controls.ptzControl.reset();
13679
13115
  }
13680
13116
  }
13681
13117
  });
@@ -13807,8 +13243,9 @@
13807
13243
  // 如果 header more 存在,则偏移量量宽度为 150,否则为 100, 因为隐藏多个控件时 right 会变短
13808
13244
  var showHeaderMore = leftWidth + rightWidth + 30 > this._width;
13809
13245
  if (showHeaderMore) {
13810
- if (!this._headerMoreControl && this.controls.recControl) {
13811
- var _this_controls_recControl;
13246
+ var _this_controls;
13247
+ if (!this._headerMoreControl && ((_this_controls = this.controls) == null ? void 0 : _this_controls.recControl)) {
13248
+ var _this_controls_recControl, _this_controls1;
13812
13249
  this._headerMoreControl = new More({
13813
13250
  language: this.options.language,
13814
13251
  locales: this.i18n.translations,
@@ -13829,14 +13266,15 @@
13829
13266
  _this.emit(EVENTS.control.headerMorePanelOpenChange, open);
13830
13267
  }
13831
13268
  });
13832
- (_this_controls_recControl = this.controls.recControl) == null ? void 0 : _this_controls_recControl.resetPopupContainer(this._headerMoreControl.$panel);
13269
+ (_this_controls1 = this.controls) == null ? void 0 : (_this_controls_recControl = _this_controls1.recControl) == null ? void 0 : _this_controls_recControl.resetPopupContainer(this._headerMoreControl.$panel);
13833
13270
  }
13834
13271
  this.emit(Theme.EVENTS.control.headerMoreShowControlsChange, showHeaderMore);
13835
13272
  } else if (this._width - leftWidth - rightWidth > 100) {
13273
+ var _this_controls2;
13836
13274
  //
13837
- if (this._headerMoreControl && this.controls.recControl) {
13838
- var _this__header2, _this_controls_recControl1, _this__headerMoreControl;
13839
- (_this_controls_recControl1 = this.controls.recControl) == null ? void 0 : _this_controls_recControl1.resetPopupContainer((_this__header2 = this._header) == null ? void 0 : _this__header2.$right);
13275
+ if (this._headerMoreControl && ((_this_controls2 = this.controls) == null ? void 0 : _this_controls2.recControl)) {
13276
+ var _this__header2, _this_controls_recControl1, _this_controls3, _this__headerMoreControl;
13277
+ (_this_controls3 = this.controls) == null ? void 0 : (_this_controls_recControl1 = _this_controls3.recControl) == null ? void 0 : _this_controls_recControl1.resetPopupContainer((_this__header2 = this._header) == null ? void 0 : _this__header2.$right);
13840
13278
  (_this__headerMoreControl = this._headerMoreControl) == null ? void 0 : _this__headerMoreControl.destroy();
13841
13279
  this._headerMoreControl = null;
13842
13280
  this.emit(Theme.EVENTS.control.headerMoreShowControlsChange, false);
@@ -13886,7 +13324,8 @@
13886
13324
  var list = (((_this__themeData = _this._themeData) == null ? void 0 : (_this__themeData_footer = _this__themeData.footer) == null ? void 0 : _this__themeData_footer.btnList) || []).filter(function(item) {
13887
13325
  var _this__footerMoreControl;
13888
13326
  var index = (((_this__footerMoreControl = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl.list) || []).findIndex(function(item1) {
13889
- return item1.control === _this.controls["" + item.iconId + "Control"];
13327
+ var _this_controls;
13328
+ return item1.control === ((_this_controls = _this.controls) == null ? void 0 : _this_controls["" + item.iconId + "Control"]);
13890
13329
  });
13891
13330
  return index === -1;
13892
13331
  });
@@ -13902,19 +13341,19 @@
13902
13341
  for(var _iterator = _create_for_of_iterator_helper_loose(popList), _step; !(_step = _iterator()).done;){
13903
13342
  var item = _step.value;
13904
13343
  if (item) {
13905
- var _this_controls_key_resetPopupContainer, _this_controls_key, _this__footerMoreControl2;
13344
+ var _this_controls_key_resetPopupContainer, _this_controls_key, _this_controls, _this_controls1, _this__footerMoreControl2;
13906
13345
  var key = "" + item.iconId + "Control";
13907
- (_this_controls_key = _this.controls[key]) == null ? void 0 : (_this_controls_key_resetPopupContainer = _this_controls_key.resetPopupContainer) == null ? void 0 : _this_controls_key_resetPopupContainer.call(_this_controls_key, _this._footerMoreControl.$panel, 'prepend');
13908
- (_this__footerMoreControl2 = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl2.add(key, item.part, _this.controls[key]);
13346
+ (_this_controls = _this.controls) == null ? void 0 : (_this_controls_key = _this_controls[key]) == null ? void 0 : (_this_controls_key_resetPopupContainer = _this_controls_key.resetPopupContainer) == null ? void 0 : _this_controls_key_resetPopupContainer.call(_this_controls_key, _this._footerMoreControl.$panel, 'prepend');
13347
+ (_this__footerMoreControl2 = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl2.add(key, item.part, (_this_controls1 = _this.controls) == null ? void 0 : _this_controls1[key]);
13909
13348
  }
13910
13349
  }
13911
13350
  } else if (_this._footerMoreControl) {
13912
13351
  var item1 = list.pop();
13913
13352
  if (item1) {
13914
- var _this_controls_key_resetPopupContainer1, _this_controls_key1, _this__footerMoreControl3;
13353
+ var _this_controls_key_resetPopupContainer1, _this_controls_key1, _this_controls2, _this_controls3, _this__footerMoreControl3;
13915
13354
  var key1 = "" + item1.iconId + "Control";
13916
- (_this_controls_key1 = _this.controls[key1]) == null ? void 0 : (_this_controls_key_resetPopupContainer1 = _this_controls_key1.resetPopupContainer) == null ? void 0 : _this_controls_key_resetPopupContainer1.call(_this_controls_key1, _this._footerMoreControl.$panel, 'prepend');
13917
- (_this__footerMoreControl3 = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl3.add(key1, item1.part, _this.controls[key1]);
13355
+ (_this_controls2 = _this.controls) == null ? void 0 : (_this_controls_key1 = _this_controls2[key1]) == null ? void 0 : (_this_controls_key_resetPopupContainer1 = _this_controls_key1.resetPopupContainer) == null ? void 0 : _this_controls_key_resetPopupContainer1.call(_this_controls_key1, _this._footerMoreControl.$panel, 'prepend');
13356
+ (_this__footerMoreControl3 = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl3.add(key1, item1.part, (_this_controls3 = _this.controls) == null ? void 0 : _this_controls3[key1]);
13918
13357
  } else {
13919
13358
  return;
13920
13359
  }
@@ -14016,7 +13455,8 @@
14016
13455
  var _this = this;
14017
13456
  if (disabled === void 0) disabled = true;
14018
13457
  PAUSE_DISABLED_BTN.forEach(function(btn) {
14019
- if (_this.controls["" + btn + "Control"]) {
13458
+ var _this_controls;
13459
+ if ((_this_controls = _this.controls) == null ? void 0 : _this_controls["" + btn + "Control"]) {
14020
13460
  _this.controls["" + btn + "Control"].disabled = disabled;
14021
13461
  }
14022
13462
  });
@@ -14059,7 +13499,8 @@
14059
13499
  'record',
14060
13500
  'speed'
14061
13501
  ].forEach(function(key) {
14062
- if (_this.controls["" + key + "Control"]) {
13502
+ var _this_controls;
13503
+ if ((_this_controls = _this.controls) == null ? void 0 : _this_controls["" + key + "Control"]) {
14063
13504
  _this.controls["" + key + "Control"].reset();
14064
13505
  }
14065
13506
  });
@@ -14072,12 +13513,14 @@
14072
13513
  0,
14073
13514
  180
14074
13515
  ].includes(this._orientationAngle)) {
13516
+ var _this_controls, _this_controls1;
14075
13517
  // 全屏后 dom 节点旋转了 90度
14076
- if (this.controls.ptzControl) this.controls.ptzControl.isRotated = true;
14077
- if (this.controls.zoomControl) this.controls.zoomControl.isRotated = true;
13518
+ if ((_this_controls = this.controls) == null ? void 0 : _this_controls.ptzControl) this.controls.ptzControl.isRotated = true;
13519
+ if ((_this_controls1 = this.controls) == null ? void 0 : _this_controls1.zoomControl) this.controls.zoomControl.isRotated = true;
14078
13520
  } else {
14079
- if (this.controls.ptzControl) this.controls.ptzControl.isRotated = false;
14080
- if (this.controls.zoomControl) this.controls.zoomControl.isRotated = false;
13521
+ var _this_controls2, _this_controls3;
13522
+ if ((_this_controls2 = this.controls) == null ? void 0 : _this_controls2.ptzControl) this.controls.ptzControl.isRotated = false;
13523
+ if ((_this_controls3 = this.controls) == null ? void 0 : _this_controls3.zoomControl) this.controls.zoomControl.isRotated = false;
14081
13524
  }
14082
13525
  }
14083
13526
  };
@@ -14132,7 +13575,8 @@
14132
13575
  'talk',
14133
13576
  'record'
14134
13577
  ].forEach(function(key) {
14135
- if (_this.controls["" + key + "Control"]) {
13578
+ var _this_controls;
13579
+ if ((_this_controls = _this.controls) == null ? void 0 : _this_controls["" + key + "Control"]) {
14136
13580
  _this.controls["" + key + "Control"].reset();
14137
13581
  }
14138
13582
  });
@@ -14489,7 +13933,7 @@
14489
13933
  zh: zh,
14490
13934
  en: en
14491
13935
  };
14492
- /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.0-beta.1';
13936
+ /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.0-beta.4';
14493
13937
 
14494
13938
  // 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
14495
13939