@ezuikit/player-theme 2.0.0-beta.2 → 2.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- * @ezuikit/player-theme v2.0.0-beta.2
3
- * Copyright (c) 2025-11-12 Ezviz-OpenBiz
2
+ * @ezuikit/player-theme v2.0.0-beta.4
3
+ * Copyright (c) 2025-11-18 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
 
@@ -5466,6 +5406,13 @@
5466
5406
  scale = wScale > hScale ? wScale : hScale;
5467
5407
  }
5468
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
+ });
5469
5416
  }
5470
5417
  };
5471
5418
  _proto.setScaleMode = function setScaleMode(scaleMode) {
@@ -6030,6 +5977,12 @@
6030
5977
  theme.emit(EVENTS.control.recDestroy);
6031
5978
  });
6032
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
+ }
6033
5986
  }
6034
5987
  var ignoreList = [
6035
5988
  EVENTS.getOSDTime,
@@ -10029,10 +9982,6 @@
10029
9982
  };
10030
9983
  return _set_prototype_of$8(o, p);
10031
9984
  }
10032
- function _type_of(obj) {
10033
- "@swc/helpers - typeof";
10034
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
10035
- }
10036
9985
  var DEFINITION_LEVELS_LOCALE = [
10037
9986
  'VIDEO_LEVEL_FLUENT',
10038
9987
  'VIDEO_LEVEL_STANDARD',
@@ -10126,7 +10075,7 @@
10126
10075
  Select.prototype.updateOptions.call(_assert_this_initialized$1(_this), __filter(list, _this.locale));
10127
10076
  });
10128
10077
  _this.on(EVENTS.currentVideoLevel, function(item, realLevel) {
10129
- var l = (typeof item === "undefined" ? "undefined" : _type_of(item)) === 'object' ? item.level : item;
10078
+ var l = typeof item === 'object' ? item.level : item;
10130
10079
  _this._level = realLevel + '';
10131
10080
  if (l === 'auto') {
10132
10081
  var _options_locales_options_language;
@@ -10882,7 +10831,8 @@
10882
10831
  * @param change 是否触发 onChange 事件
10883
10832
  */ _proto.setDate = function setDate(date, change) {
10884
10833
  if (change === void 0) change = true;
10885
- this.dataPickerUtil.setDate(date, change);
10834
+ var _this_dataPickerUtil;
10835
+ (_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.setDate(date, change);
10886
10836
  if (date && !change && this._value !== DateTime.formate(date, 'YYYY-MM-DD')) {
10887
10837
  this._value = DateTime.formate(date, 'YYYY-MM-DD');
10888
10838
  if (date && this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
@@ -10891,7 +10841,8 @@
10891
10841
  }
10892
10842
  };
10893
10843
  _proto.reset = function reset() {
10894
- this.dataPickerUtil.hide();
10844
+ var _this_dataPickerUtil;
10845
+ (_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.hide();
10895
10846
  Control.prototype.reset.call(this);
10896
10847
  };
10897
10848
  /**
@@ -10917,13 +10868,13 @@
10917
10868
  return DatePickerControl;
10918
10869
  }(Control);
10919
10870
 
10920
- var dist$1 = {exports: {}};
10871
+ var dist$1 = {};
10921
10872
 
10922
10873
  /**
10923
10874
  * drag scroll support move and touch
10924
10875
  *
10925
- * @skax/drag-scroll v1.1.0
10926
- * Copyright (c) 2025-11-08 ShineShao <xiaoshaoqq@gmail.com>
10876
+ * @skax/drag-scroll v1.1.1
10877
+ * Copyright (c) 2025-11-16 ShineShao <xiaoshaoqq@gmail.com>
10927
10878
  *
10928
10879
  * This source code is licensed under the MIT license found in the
10929
10880
  * LICENSE file in the root directory of this source tree.
@@ -10955,6 +10906,7 @@
10955
10906
  * 默认参数
10956
10907
  */ var _$DRAG_SCROLL_DEFAULT_OPTIONS$_ = {
10957
10908
  content: '',
10909
+ width: '100%',
10958
10910
  height: '400px',
10959
10911
  readonly: false,
10960
10912
  hideScrollbar: false
@@ -10981,6 +10933,18 @@
10981
10933
  /** 滚动条元素 */ this._$scrollbar = null;
10982
10934
  /** 滚动条指示器元素 */ this._$scrollbarThumb = null;
10983
10935
  /** 是否只读 */ this._readonly = false;
10936
+ if (!container) {
10937
+ throw new Error('container is required');
10938
+ }
10939
+ if ([
10940
+ 'VIDEO',
10941
+ 'CANVAS',
10942
+ 'IMG',
10943
+ 'TEXTAREA',
10944
+ 'INPUT'
10945
+ ].includes(container.tagName)) {
10946
+ throw new Error("container cannot be 'VIDEO', 'CANVAS', 'IMG', 'TEXTAREA', 'INPUT' element");
10947
+ }
10984
10948
  this.$container = container;
10985
10949
  this.options = Object.assign({}, _$DRAG_SCROLL_DEFAULT_OPTIONS$_, options);
10986
10950
  this.$container.classList.add(_$DRAG_SCROLL_PREFIX_CLASSNAME$_, "" + _$DRAG_SCROLL_PREFIX_CLASSNAME$_ + "-container");
@@ -11082,6 +11046,7 @@
11082
11046
  clearTimeout(this._indicatorTimeout);
11083
11047
  this._indicatorTimeout = null;
11084
11048
  }
11049
+ if (this.$container) this.$container.style.cursor = 'default';
11085
11050
  (_this__$scrollbarThumb = this._$scrollbarThumb) == null ? void 0 : _this__$scrollbarThumb.remove();
11086
11051
  this._$scrollbarThumb = null;
11087
11052
  (_this__$scrollbar = this._$scrollbar) == null ? void 0 : _this__$scrollbar.remove();
@@ -11108,7 +11073,7 @@
11108
11073
  // 初始化滚动条
11109
11074
  this._updateScrollbar();
11110
11075
  // 初始化动画
11111
- this._animate();
11076
+ this._animationId = requestAnimationFrame(this._animate.bind(this));
11112
11077
  };
11113
11078
  // ----------- 事件处理 ----------- //
11114
11079
  /**
@@ -11208,9 +11173,9 @@
11208
11173
  /**
11209
11174
  * 平移内容
11210
11175
  */ _proto._applyTransform = function _applyTransform() {
11211
- var clientHeight = this.$content.clientHeight;
11176
+ var offsetHeight = this.$content.offsetHeight;
11212
11177
  // 内容高度小于等于容器高度时,不进行滚动
11213
- if (clientHeight <= this.$container.clientHeight) {
11178
+ if (offsetHeight <= this.$container.clientHeight) {
11214
11179
  this.$content.style.transform = "translate3d(0, 0, 0)";
11215
11180
  return;
11216
11181
  }
@@ -11234,7 +11199,11 @@
11234
11199
  * @param timestamp 时间戳
11235
11200
  */ _proto._animate = function _animate(timestamp) {
11236
11201
  if (timestamp === void 0) timestamp = 0;
11237
- var clientHeight = this.$content.clientHeight;
11202
+ if (this._animationId) {
11203
+ cancelAnimationFrame(this._animationId);
11204
+ this._animationId = null;
11205
+ }
11206
+ var clientHeight = this.$content.offsetHeight;
11238
11207
  // 内容高度小于等于容器高度时,不进行滚动
11239
11208
  if (clientHeight <= this.$container.clientHeight) {
11240
11209
  return;
@@ -11262,7 +11231,6 @@
11262
11231
  this.velocity = 0;
11263
11232
  }
11264
11233
  }
11265
- this._animationId = requestAnimationFrame(this._animate.bind(this));
11266
11234
  };
11267
11235
  /**
11268
11236
  * 更新滚动条
@@ -11344,8 +11312,8 @@
11344
11312
  get: /**
11345
11313
  * 内容是否可滚动
11346
11314
  */ function get() {
11347
- var clientHeight = this.$content.clientHeight;
11348
- return !this.readonly && clientHeight > this.$container.clientHeight;
11315
+ var offsetHeight = this.$content.offsetHeight;
11316
+ return !this.readonly && offsetHeight > this.$container.clientHeight;
11349
11317
  }
11350
11318
  }
11351
11319
  ]);
@@ -11357,560 +11325,18 @@
11357
11325
  }
11358
11326
 
11359
11327
  /*
11360
- * @ezuikit/control-time-line v1.0.1-beta.14
11361
- * Copyright (c) 2025-11-11 Ezviz-OpenBiz
11328
+ * @ezuikit/control-time-line v1.0.2
11329
+ * Copyright (c) 2025-11-16 Ezviz-OpenBiz
11362
11330
  * Released under the MIT License.
11363
11331
  */
11364
11332
 
11365
11333
  var hasRequiredDist;
11366
11334
 
11367
11335
  function requireDist () {
11368
- if (hasRequiredDist) return dist$1.exports;
11336
+ if (hasRequiredDist) return dist$1;
11369
11337
  hasRequiredDist = 1;
11370
- (function (module, exports) {
11371
- 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%",
11372
- // --------------------只支持初始化时,不支持动态变更 (不做对象冻结)--------------------
11373
- timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",
11374
- onChange:function(){},onDragStart:function(){},onDragging:function(){},onDragEnd:function(){},onDestroy:function(){}},BaseTimeLine=function(){function BaseTimeLine(container,options){if(this._current=new Date,
11375
- /** 只读 */this._readOnly=false,this._width=0,this._height=0,this._destroyed=false,this._timeWidth=0,
11376
- /** 片段列表 */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,
11377
- // prettier-ignore
11378
- 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;
11379
- /**
11380
- * 设置只读或取消只读, 推荐使用 timeLine.readOnly = false
11381
- * @param readOnly - 只读或取消只读
11382
- * @returns
11383
- */return _proto.setReadOnly=function(readOnly){this.readOnly=readOnly;},
11384
- /**
11385
- * 更新当前时间
11386
- * @param current 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11387
- */
11388
- _proto.update=function(current){this._current=current;},
11389
- /**
11390
- * 更新时间片段
11391
- * @param timeSections 片段数据
11392
- */
11393
- _proto.updateTimeSections=function(timeSections){timeSections&&Array.isArray(timeSections)&&(this._timeSections=timeSections);},
11394
- /**
11395
- * 重置尺寸
11396
- */
11397
- _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);},
11398
- /**
11399
- * 改变时间轴刻度
11400
- * 移动端间距: 0:1分钟,1:10分钟,2:半小时,3:1小时,4:2小时, 5:4小时
11401
- * PC间距:
11402
- * @param timeWidth 时间轴刻度
11403
- */
11404
- _proto.setTimeWidth=function(timeWidth){[0,1,2,3,4,5].includes(timeWidth)&&(this._timeWidth=timeWidth);},
11405
- /**
11406
- * 销毁
11407
- */
11408
- _proto.destroy=function(){
11409
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11410
- 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:
11411
- /**
11412
- * 当前时间
11413
- */
11414
- function(){return this._current},set:
11415
- /**
11416
- * 当前时间
11417
- */
11418
- function(current){this._current=current;}},{key:"readOnly",get:
11419
- /**
11420
- * 只读状态
11421
- */
11422
- function(){return this._readOnly},set:function(readOnly){this._readOnly!==readOnly&&(this._readOnly=readOnly,this.$container.style.cursor=readOnly?"not-allowed":"pointer");}},{key:"timeSections",get:
11423
- /**
11424
- * 时间片段
11425
- */
11426
- function(){return this._timeSections}},{key:"width",get:
11427
- /**
11428
- * 获取 TimeLine 的宽度
11429
- * @returns
11430
- */
11431
- function(){return this._width}},{key:"height",get:
11432
- /**
11433
- * 获取 TimeLine 的高度
11434
- */
11435
- function(){return this._height}},{key:"timeWidth",get:function(){return this._timeWidth}}]),BaseTimeLine}();
11436
- /**
11437
- * 时间轴基类
11438
- * @internal
11439
- */
11440
- /** 语言包 */BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;var TimeLineUtil=function(){function TimeLineUtil(){}
11441
- /**
11442
- * 时间转成日期
11443
- * @param time 时间 (秒, 毫秒, 日期字符串, Date)
11444
- * @returns 日期
11445
- */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},
11446
- /**
11447
- * 时间转成 HH:mm:ss
11448
- * @param time 时间
11449
- * @returns
11450
- */
11451
- TimeLineUtil.formatDateToHHmmss=function(time){var date=TimeLineUtil.toDate(time);if(date){var h=date.getHours(),m=date.getMinutes(),s=date.getSeconds();// 返回日期中的小时数(0到23)
11452
- // 返回日期中的秒数(0到59)
11453
- return (h>9?h:"0"+h)+":"+(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)}return "00:00:00"},
11454
- /**
11455
- * 十位补充 0
11456
- * @param m 数字
11457
- * @returns 十位补充 0后的结果字符串
11458
- */
11459
- TimeLineUtil.subTime=function(m){return +m>9?m+"":"0"+m},
11460
- /**
11461
- * 格式化时间, 支持 'YYYY-MM-DD','YYYY-MM-DD HH:mm:ss', 'HH:mm:ss'
11462
- * @param time 时间
11463
- * @param fmt 时间格式
11464
- * @returns
11465
- */
11466
- 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()):""},
11467
- /**
11468
- * 时间转成秒
11469
- * @param time
11470
- * @returns
11471
- */
11472
- TimeLineUtil.timeToSecond=function(time){var e=time.split(":");return 60*Number(e[0])*60+60*Number(e[1])+(Number(e[2])||0)},
11473
- /**
11474
- * 分钟转成 HH:mm
11475
- * @param minute
11476
- * @returns
11477
- */
11478
- TimeLineUtil.minuteToTime=function(minute){var hour=Math.floor(minute/60),m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)},
11479
- /**
11480
- * 时间转成分钟
11481
- * @param time
11482
- * @returns
11483
- */
11484
- TimeLineUtil.timeToMinute=function(time){var e=time.split(":");
11485
- // const s = Number(e[2]);
11486
- return 60*Number(e[0])+Number(e[1])},
11487
- /**
11488
- * @description 判读两个区间是否重叠
11489
- * @param {number} a_start 一个区间的开始
11490
- * @param {number} a_end 一个区间的结束
11491
- * @param {number} b_start 另一个区间的开始
11492
- * @param {number} b_end 另一个区间的结束
11493
- * @returns {boolean}
11494
- */
11495
- 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小时"]];
11496
- /**
11497
- * 时间轴图标集
11498
- */function _create_class$1(Constructor,protoProps,staticProps){return protoProps&&
11499
- /* 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)}
11500
- /**
11501
- * 时间轴样式类前缀
11502
- */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",
11503
- /** 当前时间背景颜色 */currentTimeBgColor:"#648FFC",
11504
- /** 当前时间颜色 */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;
11505
- /**
11506
- * 设置只读或取消只读
11507
- * @param readOnly - 只读或取消只读
11508
- * @returns
11509
- */return _proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._dragScroll&&(this._dragScroll.readonly=readOnly);},
11510
- /**
11511
- * 改变时间轴刻度
11512
- * 0: 1分钟,
11513
- * 1: 10分钟
11514
- * 2: 半小时
11515
- * 3: 1小时
11516
- * 4: 2小时
11517
- * @param timeWidth // 120: 2小时, 60:1小时, 30:半小时,10:10分钟,1:1分钟
11518
- */
11519
- _proto.setTimeWidth=function(timeWidth){MOBILE_TIME_WIDTH[timeWidth]&&(BaseTimeLine.prototype.setTimeWidth.call(this,timeWidth),this._matchTimeDot());},
11520
- /**
11521
- * 更新片段数组
11522
- * @param timeSections
11523
- * @param defaultIndex
11524
- */
11525
- _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);
11526
- // 若current不为 null,则不重置current,避免拖动后时间轴回弹
11527
- 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();},
11528
- /**
11529
- * 更新当前时间
11530
- * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11531
- */
11532
- _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());},
11533
- /**
11534
- * 销毁
11535
- */
11536
- _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);},
11537
- /**
11538
- * 更新状态
11539
- * @param obj
11540
- */
11541
- _proto._setState=function(obj){var _this=this;
11542
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11543
- 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);},
11544
- /**
11545
- * 渲染时间轴刻度数组
11546
- */
11547
- _proto._matchTimeDot=function(){for(var scaleWidth=this._scaleWidth,timeArr=[],minute=TimeLineUtil.timeToMinute("24:00:00"),i=minute=Math.floor(minute/scaleWidth)*scaleWidth// 时间单位 分钟
11548
- ;i>=0;){var marginTop=0,marginBottom=0;
11549
- // 视频片段
11550
- 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;
11551
- // prettier-ignore
11552
- 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;
11553
- // 清理上一次的error 事件
11554
- 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>"),
11555
- // 六个详细刻度
11556
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11557
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11558
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11559
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11560
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale"></div>
11561
- // <div class="${_$MOBILE_TIMELINE_PREFIX$_}-time-scale" style="width:10px"></div>
11562
- 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;
11563
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
11564
- 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&&(
11565
- // 加减
11566
- 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);
11567
- _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){
11568
- // 移动端仅支持一天
11569
- // if (TimeLineUtil.tranTime(item.startTime, 'YYYY-MM-DD') !== TimeLineUtil.tranTime(item.endTime, 'YYYY-MM-DD')) {
11570
- // }
11571
- var hour=TimeLineUtil.tranTime(item.startTime,"HH");obj[+hour]?
11572
- // prettier-ignore
11573
- obj[+hour].push(_extends$1({},item,{_index:index})):
11574
- // prettier-ignore
11575
- obj[+hour]=[_extends$1({},item,{_index:index})];}),obj},
11576
- /**
11577
- *
11578
- * @param start 仅支持判断同一天的, 如果是多天的或出错
11579
- */
11580
- _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})},
11581
- /**
11582
- * 渲染选择器内容
11583
- */
11584
- _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"))||[]);},
11585
- /**
11586
- * 图片加载失败事件监听
11587
- * @param list
11588
- */
11589
- _proto._imageErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){
11590
- // 避免重复添加事件
11591
- img.hasAttribute("data-error")||img.addEventListener("error",_this._onImageError);});},
11592
- /**
11593
- * 图片加载失败移除
11594
- * @param list
11595
- */
11596
- _proto._imageRemoveErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){
11597
- // 避免重复添加事件
11598
- img.removeEventListener("error",_this._onImageError);});},
11599
- /**
11600
- * 图片加载失败
11601
- * @param e
11602
- */
11603
- _proto._onImageError=function(e){var img=e.target;if(!img.hasAttribute("data-error")){var _img_parentNode,placeholder=document.createElement("div");
11604
- // 加密图片不能加载或没有图片
11605
- 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);
11606
- // moveX >= 1 || moveY >= 1 用于判断是否移动
11607
- 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&&(
11608
- // 60 是下限
11609
- 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:
11610
- /**
11611
- * 获取真实时间刻度(时间单位 分钟)
11612
- */
11613
- 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)}
11614
- /**
11615
- * 时间轴配置项
11616
- */var _$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,
11617
- // wheelSpeed: 0.1,
11618
- 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
11619
- _this._isMouseDown=false,_this._mousePosition=0,_this._oldTime=null,_this._isOver=false,_this._moved=false,_this._isCtrlKeyDown=false,_this._lastTouchDist=0,_this.$container=container,
11620
- // prettier-ignore
11621
- _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;
11622
- /**
11623
- * 初始化 (canvas)
11624
- */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();},
11625
- /**
11626
- * 重置尺寸
11627
- */
11628
- _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();},
11629
- /**
11630
- * 设置时间轴刻度宽度
11631
- * @param timeWidth - 时间轴刻度宽度 [0, TIME_WIDTH.length - 1]
11632
- * @returns
11633
- */
11634
- _proto.setTimeWidth=function(timeWidth){this._update({timeWidth:timeWidth});},
11635
- /**
11636
- * 设置片段数组
11637
- * @param timeSections - 片段数组
11638
- * @returns
11639
- */
11640
- _proto.updateTimeSections=function(timeSections){this._update({timeSections:timeSections});},
11641
- /**
11642
- * 更新当前时间
11643
- * @param time 能转成时间的值, 如 时间对象 Date, 时间戳,时间戳字符串
11644
- */
11645
- _proto.update=function(time){time&&!this._isMouseDown&&this._update({current:new Date(TimeLineUtil.tranTime(time,"YYYY-MM-DD HH:mm:ss"))});},
11646
- /**
11647
- * 更新
11648
- * @param options - 更新参数
11649
- * @returns
11650
- */
11651
- _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"));},
11652
- /**
11653
- * 销毁
11654
- * @returns
11655
- */
11656
- _proto.destroy=function(){if(this._removeEventListener(),this._$canvas)try{this.$container.removeChild(this._$canvas),
11657
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
11658
- this._$canvas=null;}catch(e){
11659
- // console.error(e);
11660
- }BaseTimeLine.prototype.destroy.call(this);},
11661
- /**
11662
- * 绘制
11663
- */
11664
- _proto._draw=function(){
11665
- // 清空画布
11666
- this._ctx&&(this._ctx.fillStyle=this.options.timeAxisBgColor,
11667
- // prettier-ignore
11668
- this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr)),this._drawSections(),this._drawScale();},
11669
- /**
11670
- * 绘制刻度
11671
- */
11672
- _proto._drawScale=function(){var lineWidth=1*this.options.dpr;
11673
- /** 中心位置 */this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");
11674
- // 左扩展刻度
11675
- 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])?(
11676
- // prettier-ignore
11677
- this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),
11678
- // prettier-ignore
11679
- 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];}
11680
- // 右扩展刻度
11681
- // prettier-ignore
11682
- 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])?(
11683
- // prettier-ignore
11684
- this._drawSolidLine(x1,padding,x1,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),
11685
- // prettier-ignore
11686
- 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];}
11687
- // 当前中心位置(当前时间 current)
11688
- // prettier-ignore
11689
- this._drawSolidLine(centerPosition.x,0,centerPosition.x,centerPosition.y,lineWidth,this.options.timePointColor);},
11690
- /**
11691
- * 绘制线
11692
- * @param startX - 线起点 x 坐标
11693
- * @param startY - 线起点 y 坐标
11694
- * @param endX - 线终点 x 坐标
11695
- * @param endY - 线终点 y 坐标
11696
- * @param lineWidth - 线宽度
11697
- * @param color - 线颜色
11698
- *
11699
- */
11700
- // prettier-ignore
11701
- _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());},
11702
- /**
11703
- * 绘制刻度文字
11704
- * @param text - 文本
11705
- * @param x - X
11706
- * @param y - Y
11707
- * @param align - 文本对齐方式
11708
- */
11709
- _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&&(
11710
- // 仅展示 hh:mm
11711
- timeTexts[1]=timeTexts[1].replace(/:00$/,"")),this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr),
11712
- // prettier-ignore
11713
- !this.options.showYearMonthDay||"00:00:00"!==timeTexts[1]&&"00:00"!==timeTexts[1]&&this._timeWidthArray[0]*this._timeWidthArray[2]!==86400||(
11714
- // 展示年月日
11715
- this._ctx.textAlign=align||"left",this._ctx.fillText(timeTexts[0],x,y+18*this.options.dpr));}},
11716
- /**
11717
- * 画录像区间
11718
- */
11719
- _proto._drawSections=function(){
11720
- // 根据时间查找当前位置
11721
- for(
11722
- // 绘制蓝色区域
11723
- var timeArr=this.timeSections||[],i=0;i<timeArr.length;i++){var position=this._findPosition(timeArr[i]);
11724
- // 判断一下绘制区域是否在画布区域, 不在可以不用绘制
11725
- // prettier-ignore
11726
- this._ctx&&TimeLineUtil.isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)&&(this._ctx.fillStyle=this.options.timeSectionColor,
11727
- // prettier-ignore
11728
- this._ctx.fillRect(position.x1,0,position.x2-position.x1,this.height*this.options.dpr));}},
11729
- /**
11730
- * 获取时间片段在时间轴中的x1 ,x2坐标 (已做 dpr 处理)
11731
- * @param item - 时间片段
11732
- * @returns {void}
11733
- */
11734
- _proto._findPosition=function(item){
11735
- // 中间的当前时间 current 为基准, 然后计算时间片段的 x 坐标和 y 坐标
11736
- // prettier-ignore
11737
- 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}},
11738
- /**
11739
- * 合并相邻两个时间区间
11740
- * @param timeSections - 时间区间数组
11741
- *
11742
- * @returns 合并后的时间区间
11743
- */
11744
- _proto._mergeTimeSections=function(timeSections){if(0===timeSections.length)return timeSections;for(var merged=[(timeSections=timeSections.map(function(item){
11745
- // 处理秒
11746
- 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];
11747
- // 如果当前区间与上一个区间重叠或相邻(即 prev.end >= curr.start)
11748
- prev.endTime>=curr.startTime?
11749
- // 合并区间
11750
- prev.endTime=Math.max(prev.endTime,curr.endTime):merged.push(curr);}return merged},
11751
- // -------------------------------------
11752
- // mouse event
11753
- // -------------------------------------
11754
- /**
11755
- * 添加事件监听
11756
- * @returns
11757
- */
11758
- _proto._addEventListener=function(){this._$canvas&&(
11759
- // 事件监听
11760
- this._$canvas.addEventListener("mousemove",this._mousemoveFun),
11761
- // prettier-ignore
11762
- this._$canvas.addEventListener("mouseover",this._mouseoverFun),
11763
- // prettier-ignore
11764
- this._$canvas.addEventListener("mouseleave",this._mouseleaveFun),
11765
- // prettier-ignore
11766
- this._$canvas.addEventListener("mousedown",this._mousedownFun),
11767
- // prettier-ignore
11768
- this._$canvas.addEventListener("mouseup",this._mouseUpFun),this._$canvas.addEventListener("wheel",this._mousewheelFun),
11769
- // prettier-ignore
11770
- this.$container.addEventListener("wheel",function(e){e.preventDefault();},{passive:false}),this._$canvas.addEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.addEventListener("keyup",this._ctrlKeyUpFun),
11771
- // ctrl 键事件
11772
- 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}));},
11773
- /**
11774
- * 移除事件监听
11775
- * @returns
11776
- */
11777
- _proto._removeEventListener=function(){this._$canvas&&(
11778
- // 事件监听
11779
- this._$canvas.removeEventListener("mousemove",this._mousemoveFun),
11780
- // prettier-ignore
11781
- this._$canvas.removeEventListener("mouseover",this._mouseoverFun),
11782
- // prettier-ignore
11783
- this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun),
11784
- // prettier-ignore
11785
- this._$canvas.removeEventListener("mousedown",this._mousedownFun),
11786
- // prettier-ignore
11787
- this._$canvas.removeEventListener("mouseup",this._mouseUpFun),this._$canvas.removeEventListener("wheel",this._mousewheelFun),this._$canvas.removeEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.removeEventListener("keyup",this._ctrlKeyUpFun),
11788
- // ctrl 键事件
11789
- document.removeEventListener("keydown",this._ctrlKeyDownFun),document.removeEventListener("keyup",this._ctrlKeyUpFun),
11790
- // touch
11791
- this._$canvas.removeEventListener("touchstart",this._touchstartFun),this._$canvas.removeEventListener("touchmove",this._touchmoveFun),this._$canvas.removeEventListener("touchend",this._touchendFun));},
11792
- /**
11793
- * 鼠标按下事件监听
11794
- * @param e - 鼠标事件
11795
- * @returns
11796
- */
11797
- _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));},
11798
- /**
11799
- * 鼠标移入事件监听
11800
- * @returns
11801
- */
11802
- _proto._mouseoverFun=function(){this.readOnly||(this._isOver=true);},
11803
- /**
11804
- * 鼠标离开事件监听
11805
- * @returns
11806
- */
11807
- _proto._mouseleaveFun=function(e){this.readOnly||(this._isOver=false,this._moveEndOrTouchEndFun(e));},
11808
- /**
11809
- * 鼠标抬起事件监听
11810
- * @returns
11811
- */
11812
- _proto._mouseUpFun=function(e){this._moveEndOrTouchEndFun(e);},
11813
- /**
11814
- * 鼠标移动事件监听
11815
- * @param e - 鼠标事件
11816
- * @returns
11817
- */
11818
- _proto._mousemoveFun=function(e){if(!this.readOnly)if(this._isMouseDown&&this._isOver)
11819
- // 鼠标按下位置和移动位置的偏移量
11820
- this._moveUpdateFun(e.pageX);else {var left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left,this._update();}
11821
- // const time = new Date(
11822
- // // prettier-ignore
11823
- // this.current.getTime() + parseInt(((e.pageX - this.width / 2) / this._curScaleSpacing ) * this._timeWidthArray[0] + "", 10) * 1000,
11824
- // );
11825
- },
11826
- /**
11827
- * 鼠标滚轮滚动
11828
- * @param e - 鼠标滚轮滚动事件
11829
- * @returns
11830
- */
11831
- _proto._mousewheelFun=function(e){e.preventDefault(),this.readOnly;},
11832
- /**
11833
- * ctrl键按下事件
11834
- * @param e - 键盘按下事件
11835
- */
11836
- _proto._ctrlKeyDownFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=true);},
11837
- /**
11838
- * ctrl键抬起事件
11839
- * @param e - 键盘按下事件
11840
- */
11841
- _proto._ctrlKeyUpFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=false);},
11842
- // ----------------------------------------------------------------------
11843
- // touch
11844
- // ----------------------------------------------------------------------
11845
- /**
11846
- * 触摸距离
11847
- * @param touches - 两指触摸点
11848
- * @returns
11849
- */
11850
- _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)},
11851
- /**
11852
- * 触摸开始
11853
- * @param e - 触摸事件
11854
- * @returns
11855
- */
11856
- _proto._touchstartFun=function(e){if(!this.readOnly)if(this._oldTime=this.current,this._isOver=true,1===e.touches.length){
11857
- // 单指
11858
- var touch=e.touches[0];this._isMouseDown=true,this._mousePosition=touch.clientX;}else 2===e.touches.length&&(
11859
- // 双指
11860
- this._lastTouchDist=this._getTouchDistance(e.touches));},
11861
- /**
11862
- * 触摸移动
11863
- * @param e - 触摸事件
11864
- * @returns
11865
- */
11866
- _proto._touchmoveFun=function(e){if(e.preventDefault(),// 防止页面缩放
11867
- e.stopPropagation(),!this.readOnly)if(1===e.touches.length){
11868
- // 单指
11869
- var touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else if(2===e.touches.length){
11870
- // 双指
11871
- this._getTouchDistance(e.touches);this._lastTouchDist;}},
11872
- /**
11873
- * 触摸结束
11874
- * @param e - 触摸事件
11875
- * @returns
11876
- */
11877
- _proto._touchendFun=function(e){this.readOnly||this._moveEndOrTouchEndFun(e);},
11878
- /**
11879
- * 拖动结束
11880
- * @returns
11881
- */
11882
- _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);},
11883
- /**
11884
- * 移动更新时间
11885
- * @param x - 移动的x坐标
11886
- * @returns
11887
- */
11888
- _proto._moveUpdateFun=function(x){
11889
- // 鼠标按下位置和移动位置的偏移量
11890
- var mouseOffset=this._mousePosition-x;
11891
- // fix点击引起mousemove的问题
11892
- if(0!==mouseOffset){if(this._oldTime){
11893
- // prettier-ignore
11894
- 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:// -----------------------------------------------------------------------------------------
11895
- // private
11896
- // -----------------------------------------------------------------------------------------
11897
- /**
11898
- * 缩放时间轴 动态减少间距 (没处理 dpr)
11899
- * @returns 刻度间距
11900
- */
11901
- 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));// 刻度间距
11902
- }}]),TimeLine}(BaseTimeLine);
11903
- /**
11904
- * 时间轴控件类, 支持PC/Mobile 拖动和缩放
11905
- * @beta
11906
- * @example
11907
- * ```ts
11908
- * import TimeLine from './TimeLine';
11909
- * const timeLine = new TimeLine(document.getElementById('container'), {})
11910
- * ```
11911
- */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;
11912
- } (dist$1, dist$1.exports));
11913
- return dist$1.exports;
11338
+ 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;
11339
+ return dist$1;
11914
11340
  }
11915
11341
 
11916
11342
  var distExports = requireDist();
@@ -12362,6 +11788,7 @@
12362
11788
  */ _proto.show = function show(playing, always) {
12363
11789
  var _this = this;
12364
11790
  var _this_$container_classList, _this_$container;
11791
+ if (!this.$container) return;
12365
11792
  if (!this._firstFlag) {
12366
11793
  this._firstFlag = true;
12367
11794
  } else {
@@ -13679,7 +13106,8 @@
13679
13106
  }));
13680
13107
  _this._isRotated();
13681
13108
  if (Utils.isMobile && !_this._isCurrentFullscreen) {
13682
- if (_this.controls.ptzControl) _this.controls.ptzControl.reset();
13109
+ var _this_controls;
13110
+ if ((_this_controls = _this.controls) == null ? void 0 : _this_controls.ptzControl) _this.controls.ptzControl.reset();
13683
13111
  }
13684
13112
  }
13685
13113
  });
@@ -13811,8 +13239,9 @@
13811
13239
  // 如果 header more 存在,则偏移量量宽度为 150,否则为 100, 因为隐藏多个控件时 right 会变短
13812
13240
  var showHeaderMore = leftWidth + rightWidth + 30 > this._width;
13813
13241
  if (showHeaderMore) {
13814
- if (!this._headerMoreControl && this.controls.recControl) {
13815
- var _this_controls_recControl;
13242
+ var _this_controls;
13243
+ if (!this._headerMoreControl && ((_this_controls = this.controls) == null ? void 0 : _this_controls.recControl)) {
13244
+ var _this_controls_recControl, _this_controls1;
13816
13245
  this._headerMoreControl = new More({
13817
13246
  language: this.options.language,
13818
13247
  locales: this.i18n.translations,
@@ -13833,14 +13262,15 @@
13833
13262
  _this.emit(EVENTS.control.headerMorePanelOpenChange, open);
13834
13263
  }
13835
13264
  });
13836
- (_this_controls_recControl = this.controls.recControl) == null ? void 0 : _this_controls_recControl.resetPopupContainer(this._headerMoreControl.$panel);
13265
+ (_this_controls1 = this.controls) == null ? void 0 : (_this_controls_recControl = _this_controls1.recControl) == null ? void 0 : _this_controls_recControl.resetPopupContainer(this._headerMoreControl.$panel);
13837
13266
  }
13838
13267
  this.emit(Theme.EVENTS.control.headerMoreShowControlsChange, showHeaderMore);
13839
13268
  } else if (this._width - leftWidth - rightWidth > 100) {
13269
+ var _this_controls2;
13840
13270
  //
13841
- if (this._headerMoreControl && this.controls.recControl) {
13842
- var _this__header2, _this_controls_recControl1, _this__headerMoreControl;
13843
- (_this_controls_recControl1 = this.controls.recControl) == null ? void 0 : _this_controls_recControl1.resetPopupContainer((_this__header2 = this._header) == null ? void 0 : _this__header2.$right);
13271
+ if (this._headerMoreControl && ((_this_controls2 = this.controls) == null ? void 0 : _this_controls2.recControl)) {
13272
+ var _this__header2, _this_controls_recControl1, _this_controls3, _this__headerMoreControl;
13273
+ (_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);
13844
13274
  (_this__headerMoreControl = this._headerMoreControl) == null ? void 0 : _this__headerMoreControl.destroy();
13845
13275
  this._headerMoreControl = null;
13846
13276
  this.emit(Theme.EVENTS.control.headerMoreShowControlsChange, false);
@@ -13890,7 +13320,8 @@
13890
13320
  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) {
13891
13321
  var _this__footerMoreControl;
13892
13322
  var index = (((_this__footerMoreControl = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl.list) || []).findIndex(function(item1) {
13893
- return item1.control === _this.controls["" + item.iconId + "Control"];
13323
+ var _this_controls;
13324
+ return item1.control === ((_this_controls = _this.controls) == null ? void 0 : _this_controls["" + item.iconId + "Control"]);
13894
13325
  });
13895
13326
  return index === -1;
13896
13327
  });
@@ -13906,19 +13337,19 @@
13906
13337
  for(var _iterator = _create_for_of_iterator_helper_loose(popList), _step; !(_step = _iterator()).done;){
13907
13338
  var item = _step.value;
13908
13339
  if (item) {
13909
- var _this_controls_key_resetPopupContainer, _this_controls_key, _this__footerMoreControl2;
13340
+ var _this_controls_key_resetPopupContainer, _this_controls_key, _this_controls, _this_controls1, _this__footerMoreControl2;
13910
13341
  var key = "" + item.iconId + "Control";
13911
- (_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');
13912
- (_this__footerMoreControl2 = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl2.add(key, item.part, _this.controls[key]);
13342
+ (_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');
13343
+ (_this__footerMoreControl2 = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl2.add(key, item.part, (_this_controls1 = _this.controls) == null ? void 0 : _this_controls1[key]);
13913
13344
  }
13914
13345
  }
13915
13346
  } else if (_this._footerMoreControl) {
13916
13347
  var item1 = list.pop();
13917
13348
  if (item1) {
13918
- var _this_controls_key_resetPopupContainer1, _this_controls_key1, _this__footerMoreControl3;
13349
+ var _this_controls_key_resetPopupContainer1, _this_controls_key1, _this_controls2, _this_controls3, _this__footerMoreControl3;
13919
13350
  var key1 = "" + item1.iconId + "Control";
13920
- (_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');
13921
- (_this__footerMoreControl3 = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl3.add(key1, item1.part, _this.controls[key1]);
13351
+ (_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');
13352
+ (_this__footerMoreControl3 = _this._footerMoreControl) == null ? void 0 : _this__footerMoreControl3.add(key1, item1.part, (_this_controls3 = _this.controls) == null ? void 0 : _this_controls3[key1]);
13922
13353
  } else {
13923
13354
  return;
13924
13355
  }
@@ -14020,7 +13451,8 @@
14020
13451
  var _this = this;
14021
13452
  if (disabled === void 0) disabled = true;
14022
13453
  PAUSE_DISABLED_BTN.forEach(function(btn) {
14023
- if (_this.controls["" + btn + "Control"]) {
13454
+ var _this_controls;
13455
+ if ((_this_controls = _this.controls) == null ? void 0 : _this_controls["" + btn + "Control"]) {
14024
13456
  _this.controls["" + btn + "Control"].disabled = disabled;
14025
13457
  }
14026
13458
  });
@@ -14063,7 +13495,8 @@
14063
13495
  'record',
14064
13496
  'speed'
14065
13497
  ].forEach(function(key) {
14066
- if (_this.controls["" + key + "Control"]) {
13498
+ var _this_controls;
13499
+ if ((_this_controls = _this.controls) == null ? void 0 : _this_controls["" + key + "Control"]) {
14067
13500
  _this.controls["" + key + "Control"].reset();
14068
13501
  }
14069
13502
  });
@@ -14076,12 +13509,14 @@
14076
13509
  0,
14077
13510
  180
14078
13511
  ].includes(this._orientationAngle)) {
13512
+ var _this_controls, _this_controls1;
14079
13513
  // 全屏后 dom 节点旋转了 90度
14080
- if (this.controls.ptzControl) this.controls.ptzControl.isRotated = true;
14081
- if (this.controls.zoomControl) this.controls.zoomControl.isRotated = true;
13514
+ if ((_this_controls = this.controls) == null ? void 0 : _this_controls.ptzControl) this.controls.ptzControl.isRotated = true;
13515
+ if ((_this_controls1 = this.controls) == null ? void 0 : _this_controls1.zoomControl) this.controls.zoomControl.isRotated = true;
14082
13516
  } else {
14083
- if (this.controls.ptzControl) this.controls.ptzControl.isRotated = false;
14084
- if (this.controls.zoomControl) this.controls.zoomControl.isRotated = false;
13517
+ var _this_controls2, _this_controls3;
13518
+ if ((_this_controls2 = this.controls) == null ? void 0 : _this_controls2.ptzControl) this.controls.ptzControl.isRotated = false;
13519
+ if ((_this_controls3 = this.controls) == null ? void 0 : _this_controls3.zoomControl) this.controls.zoomControl.isRotated = false;
14085
13520
  }
14086
13521
  }
14087
13522
  };
@@ -14136,7 +13571,8 @@
14136
13571
  'talk',
14137
13572
  'record'
14138
13573
  ].forEach(function(key) {
14139
- if (_this.controls["" + key + "Control"]) {
13574
+ var _this_controls;
13575
+ if ((_this_controls = _this.controls) == null ? void 0 : _this_controls["" + key + "Control"]) {
14140
13576
  _this.controls["" + key + "Control"].reset();
14141
13577
  }
14142
13578
  });
@@ -14493,7 +13929,7 @@
14493
13929
  zh: zh,
14494
13930
  en: en
14495
13931
  };
14496
- /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.0-beta.2';
13932
+ /** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.0-beta.4';
14497
13933
 
14498
13934
  // 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
14499
13935