@ezuikit/player-theme 2.0.1-beta.3 → 2.0.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +596 -106
- package/dist/index.mjs +597 -107
- package/dist/index.umd.js +575 -239
- package/dist/style.css +0 -1
- package/dist/style.js +2 -2
- package/dist/types/index.d.ts +43 -67
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @ezuikit/player-theme v2.0.
|
|
3
|
-
* Copyright (c) 2025-12-
|
|
2
|
+
* @ezuikit/player-theme v2.0.2-beta.1
|
|
3
|
+
* Copyright (c) 2025-12-05 Ezviz-OpenBiz
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
@@ -391,8 +391,7 @@
|
|
|
391
391
|
'speed',
|
|
392
392
|
'urlInfo',
|
|
393
393
|
'videoLevelList',
|
|
394
|
-
'videoLevel'
|
|
395
|
-
'recMonth'
|
|
394
|
+
'videoLevel'
|
|
396
395
|
];
|
|
397
396
|
/**
|
|
398
397
|
* 当移动端 picker 控件打开时需要关闭动画(定时器)
|
|
@@ -538,9 +537,8 @@
|
|
|
538
537
|
/** 全局全屏控件销毁 */ globalFullscreenDestroy: 'Control.globalFullscreenDestroy',
|
|
539
538
|
/** 日期面板展示隐藏变换 */ datePanelOpenChange: 'Control.datePanelOpenChange',
|
|
540
539
|
/** 日期改变 */ dateChange: 'Control.dateChange',
|
|
541
|
-
/** 日期改变 */ dateMonthChange: 'Control.dateMonthChange',
|
|
542
540
|
/** 日期销毁 */ dateDestroy: 'Control.datePanelDestroy',
|
|
543
|
-
/**
|
|
541
|
+
/** 时间轴拖动结束 */ timeLineChange: 'Control.timeLineChange',
|
|
544
542
|
/** 时间轴图片列表面板 */ timeLinePanelOpenChange: 'Control.timeLinePanelOpenChange',
|
|
545
543
|
/** 时间轴控件销毁 */ timeLineDestroy: 'Control.timeLineDestroy',
|
|
546
544
|
/** 主题控件挂载前 切换新的主题也会触发,如果想首次获取需要在 onInitializing 回调中进行监听 */ beforeMountControls: 'Control.beforeMountControls',
|
|
@@ -551,7 +549,7 @@
|
|
|
551
549
|
/** 加载控件销毁 */ loadingDestroy: 'Control.loadingDestroy',
|
|
552
550
|
/** 消息控件销毁 */ messageDestroy: 'Control.messageDestroy',
|
|
553
551
|
/** 播放器内容区域销毁 */ contentDestroy: 'Control.contentDestroy',
|
|
554
|
-
|
|
552
|
+
contentRerender: 'Control.contentRerender'
|
|
555
553
|
},
|
|
556
554
|
/**
|
|
557
555
|
* 主题控件相关
|
|
@@ -2180,7 +2178,7 @@
|
|
|
2180
2178
|
}
|
|
2181
2179
|
|
|
2182
2180
|
var distExports$7 = requireDist$9();
|
|
2183
|
-
var delegate
|
|
2181
|
+
var delegate = /*@__PURE__*/getDefaultExportFromCjs(distExports$7);
|
|
2184
2182
|
|
|
2185
2183
|
var cjs;
|
|
2186
2184
|
var hasRequiredCjs;
|
|
@@ -2329,9 +2327,9 @@
|
|
|
2329
2327
|
var dist$8 = {};
|
|
2330
2328
|
|
|
2331
2329
|
/*
|
|
2332
|
-
* @ezuikit/utils-tools v2.0.1
|
|
2330
|
+
* @ezuikit/utils-tools v2.0.1-beta.1
|
|
2333
2331
|
* tools utils
|
|
2334
|
-
* Copyright (c) 2025-
|
|
2332
|
+
* Copyright (c) 2025-11-16 Ezviz-OpenBiz
|
|
2335
2333
|
* Released under the MIT License.
|
|
2336
2334
|
*/
|
|
2337
2335
|
|
|
@@ -2340,7 +2338,7 @@
|
|
|
2340
2338
|
function requireDist$8 () {
|
|
2341
2339
|
if (hasRequiredDist$8) return dist$8;
|
|
2342
2340
|
hasRequiredDist$8 = 1;
|
|
2343
|
-
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};
|
|
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};
|
|
2344
2342
|
return dist$8;
|
|
2345
2343
|
}
|
|
2346
2344
|
|
|
@@ -2741,7 +2739,7 @@
|
|
|
2741
2739
|
var _this = this;
|
|
2742
2740
|
var mousedownName = window.PointerEvent ? 'pointerdown' : 'mousedown';
|
|
2743
2741
|
// prettier-ignore
|
|
2744
|
-
this._delegateSliderMouseDown = delegate
|
|
2742
|
+
this._delegateSliderMouseDown = delegate(this.$content, "." + PREFIX_CLASS + "-progress-slider", mousedownName, function(e) {
|
|
2745
2743
|
var // 垂直方向Y轴是反的,所以用高度减去点击位置
|
|
2746
2744
|
_this_options_onProgressClick, _this_options;
|
|
2747
2745
|
e.stopPropagation();
|
|
@@ -2766,7 +2764,7 @@
|
|
|
2766
2764
|
_this.percent = percent;
|
|
2767
2765
|
});
|
|
2768
2766
|
// prettier-ignore
|
|
2769
|
-
this._delegateSliderHandleMouseDown = delegate
|
|
2767
|
+
this._delegateSliderHandleMouseDown = delegate(this.$content, "." + PREFIX_CLASS + "-progress-slider-handle", mousedownName, function(e) {
|
|
2770
2768
|
e.stopPropagation();
|
|
2771
2769
|
if (!_this.options.draggable) {
|
|
2772
2770
|
return;
|
|
@@ -2806,7 +2804,7 @@
|
|
|
2806
2804
|
// plug
|
|
2807
2805
|
if (this.options.showPlus) {
|
|
2808
2806
|
var clickName = window.PointerEvent ? 'pointerdown' : 'click';
|
|
2809
|
-
this._delegatePlusClick = delegate
|
|
2807
|
+
this._delegatePlusClick = delegate(this.$content, "." + PREFIX_CLASS + "-progress-plus", clickName, function(e) {
|
|
2810
2808
|
e.stopPropagation();
|
|
2811
2809
|
if (e.delegateTarget.classList.contains("" + PREFIX_CLASS + "-disabled") || _this._disabled) {
|
|
2812
2810
|
return;
|
|
@@ -2824,7 +2822,7 @@
|
|
|
2824
2822
|
if (this.options.showMinus) {
|
|
2825
2823
|
var clickName1 = window.PointerEvent ? 'pointerdown' : 'click';
|
|
2826
2824
|
// prettier-ignore
|
|
2827
|
-
this._delegateMinusClick = delegate
|
|
2825
|
+
this._delegateMinusClick = delegate(this.$content, "." + PREFIX_CLASS + "-progress-minus", clickName1, function(e) {
|
|
2828
2826
|
e.stopPropagation();
|
|
2829
2827
|
if (e.delegateTarget.classList.contains("" + PREFIX_CLASS + "-disabled") || _this._disabled) {
|
|
2830
2828
|
return;
|
|
@@ -2844,7 +2842,7 @@
|
|
|
2844
2842
|
'touchmove',
|
|
2845
2843
|
'dblclick'
|
|
2846
2844
|
].forEach(function(name) {
|
|
2847
|
-
delegate
|
|
2845
|
+
delegate(_this.$container, "." + PREFIX_CLASS + "-progress", name, function(e) {
|
|
2848
2846
|
e.stopPropagation();
|
|
2849
2847
|
e.preventDefault(); // 阻止默认的触摸行为
|
|
2850
2848
|
});
|
|
@@ -3096,7 +3094,7 @@
|
|
|
3096
3094
|
var _this = this;
|
|
3097
3095
|
// 这里不要用 click 事件,因为拖动音量大小时鼠标移动到图标上会触发 click
|
|
3098
3096
|
// prettier-ignore
|
|
3099
|
-
delegate
|
|
3097
|
+
delegate(this.$container, "." + PREFIX_CLASS + "-control-volume", "mousedown", function() {
|
|
3100
3098
|
if (!_this.$container.classList.contains("" + PREFIX_CLASS + "-disabled")) {
|
|
3101
3099
|
_this._toggleMute();
|
|
3102
3100
|
}
|
|
@@ -4039,7 +4037,7 @@
|
|
|
4039
4037
|
};
|
|
4040
4038
|
_proto._onClickIcon = function _onClickIcon() {
|
|
4041
4039
|
var _this = this;
|
|
4042
|
-
this._delegation = delegate
|
|
4040
|
+
this._delegation = delegate(this.$container, "." + PREFIX_CLASS + "-icon", 'click', function(e) {
|
|
4043
4041
|
var target = e.delegateTarget;
|
|
4044
4042
|
if (!target.classList.contains("" + PREFIX_CLASS + "-disabled")) {
|
|
4045
4043
|
var type = target.getAttribute('data-type');
|
|
@@ -5758,11 +5756,6 @@
|
|
|
5758
5756
|
(_theme_zoomUtil1 = theme.zoomUtil) == null ? void 0 : (_theme_zoomUtil_setTransform1 = _theme_zoomUtil1.setTransform) == null ? void 0 : _theme_zoomUtil_setTransform1.call(_theme_zoomUtil1, false);
|
|
5759
5757
|
}
|
|
5760
5758
|
});
|
|
5761
|
-
// 日期选择器
|
|
5762
|
-
theme == null ? void 0 : theme.on(EVENTS.control.dateMonthChange, function(dates) {
|
|
5763
|
-
var _theme_controls_dateControl_emit, _theme_controls_dateControl, _theme_controls;
|
|
5764
|
-
(_theme_controls = theme.controls) == null ? void 0 : (_theme_controls_dateControl = _theme_controls.dateControl) == null ? void 0 : (_theme_controls_dateControl_emit = _theme_controls_dateControl.emit) == null ? void 0 : _theme_controls_dateControl_emit.call(_theme_controls_dateControl, EVENTS.control.dateMonthChange, dates);
|
|
5765
|
-
});
|
|
5766
5759
|
}
|
|
5767
5760
|
/**
|
|
5768
5761
|
* 控件向主题发现通信消息 control.on -> theme.emit ,仅用来转发控件的事件
|
|
@@ -5961,10 +5954,10 @@
|
|
|
5961
5954
|
theme.emit(EVENTS.control.timeLineChange, date);
|
|
5962
5955
|
});
|
|
5963
5956
|
theme.controls.timeLineControl.on(EVENTS.control.timeLinePanelOpenChange, function(open) {
|
|
5964
|
-
var _theme_controls_dateControl
|
|
5965
|
-
if ((
|
|
5966
|
-
var
|
|
5967
|
-
(
|
|
5957
|
+
var _theme_controls_dateControl;
|
|
5958
|
+
if ((_theme_controls_dateControl = theme.controls.dateControl) == null ? void 0 : _theme_controls_dateControl.dataPickerUtil) {
|
|
5959
|
+
var _theme_controls_dateControl_dataPickerUtil, _theme_controls_dateControl1;
|
|
5960
|
+
(_theme_controls_dateControl1 = theme.controls.dateControl) == null ? void 0 : (_theme_controls_dateControl_dataPickerUtil = _theme_controls_dateControl1.dataPickerUtil) == null ? void 0 : _theme_controls_dateControl_dataPickerUtil.hide();
|
|
5968
5961
|
}
|
|
5969
5962
|
theme.emit(EVENTS.control.timeLinePanelOpenChange, open);
|
|
5970
5963
|
});
|
|
@@ -9866,7 +9859,7 @@
|
|
|
9866
9859
|
var _this__options_fieldNames;
|
|
9867
9860
|
var _this__options_fieldNames_value;
|
|
9868
9861
|
var valueKey = (_this__options_fieldNames_value = (_this__options_fieldNames = this._options.fieldNames) == null ? void 0 : _this__options_fieldNames.value) != null ? _this__options_fieldNames_value : 'value';
|
|
9869
|
-
this._delegationOption = delegate
|
|
9862
|
+
this._delegationOption = delegate(this._picker.$body, "." + PREFIX_CLASS + "-select-option", 'click', function(e) {
|
|
9870
9863
|
var target = e.delegateTarget;
|
|
9871
9864
|
e.stopPropagation();
|
|
9872
9865
|
if (!target.classList.contains("" + PREFIX_CLASS + "-disabled")) {
|
|
@@ -9881,11 +9874,11 @@
|
|
|
9881
9874
|
}
|
|
9882
9875
|
}
|
|
9883
9876
|
});
|
|
9884
|
-
this._delegationClose = delegate
|
|
9877
|
+
this._delegationClose = delegate(this._picker.$body, "." + PREFIX_CLASS + "-select-close", 'click', function(e) {
|
|
9885
9878
|
e.stopPropagation();
|
|
9886
9879
|
_this._picker.open = false;
|
|
9887
9880
|
});
|
|
9888
|
-
this._delegationCancel = delegate
|
|
9881
|
+
this._delegationCancel = delegate(this._picker.$body, "." + PREFIX_CLASS + "-select-cancel", 'click', function(e) {
|
|
9889
9882
|
e.stopPropagation();
|
|
9890
9883
|
_this._picker.open = false;
|
|
9891
9884
|
});
|
|
@@ -10155,7 +10148,9 @@
|
|
|
10155
10148
|
0.5,
|
|
10156
10149
|
1,
|
|
10157
10150
|
2,
|
|
10158
|
-
4
|
|
10151
|
+
4,
|
|
10152
|
+
8,
|
|
10153
|
+
16
|
|
10159
10154
|
]; // 8, 16
|
|
10160
10155
|
var SPEED_DEFAULT_OPTIONS = {
|
|
10161
10156
|
/**
|
|
@@ -10215,160 +10210,540 @@
|
|
|
10215
10210
|
return Speed;
|
|
10216
10211
|
}(Select);
|
|
10217
10212
|
|
|
10218
|
-
var dist$2 = {};
|
|
10219
|
-
|
|
10220
|
-
var delegate$1 = {exports: {}};
|
|
10221
|
-
|
|
10222
10213
|
/*
|
|
10223
|
-
*
|
|
10224
|
-
* Copyright (c) 2025-11-
|
|
10225
|
-
* Released under the MIT License.
|
|
10226
|
-
*/
|
|
10227
|
-
var delegate = delegate$1.exports;
|
|
10228
|
-
|
|
10229
|
-
var hasRequiredDelegate;
|
|
10230
|
-
|
|
10231
|
-
function requireDelegate () {
|
|
10232
|
-
if (hasRequiredDelegate) return delegate$1.exports;
|
|
10233
|
-
hasRequiredDelegate = 1;
|
|
10234
|
-
(function (module, exports) {
|
|
10235
|
-
(function (global, factory) {
|
|
10236
|
-
module.exports = factory() ;
|
|
10237
|
-
})(delegate, (function () {
|
|
10238
|
-
var DOCUMENT_NODE_TYPE = 9;
|
|
10239
|
-
/**
|
|
10240
|
-
* A polyfill for Element.matches()
|
|
10241
|
-
*/ if (typeof Element !== "undefined" && !Element.prototype.matches) {
|
|
10242
|
-
var proto = Element.prototype;
|
|
10243
|
-
proto.matches = (proto == null ? void 0 : proto.matchesSelector) || (proto == null ? void 0 : proto.mozMatchesSelector) || (proto == null ? void 0 : proto.msMatchesSelector) || (proto == null ? void 0 : proto.oMatchesSelector) || (proto == null ? void 0 : proto.webkitMatchesSelector);
|
|
10244
|
-
}
|
|
10245
|
-
/**
|
|
10246
|
-
* Finds the closest parent that matches a selector.
|
|
10247
|
-
*
|
|
10248
|
-
* @param {Element} element
|
|
10249
|
-
* @param {string} selector
|
|
10250
|
-
* @return {Element}
|
|
10251
|
-
*/ function closest(element, selector) {
|
|
10252
|
-
while(element && element.nodeType !== DOCUMENT_NODE_TYPE){
|
|
10253
|
-
if (typeof element.matches === "function" && element.matches(selector)) {
|
|
10254
|
-
return element;
|
|
10255
|
-
}
|
|
10256
|
-
element = element.parentNode;
|
|
10257
|
-
}
|
|
10258
|
-
return null;
|
|
10259
|
-
}
|
|
10260
|
-
/**
|
|
10261
|
-
* Finds the closest parent that matches a selector.
|
|
10262
|
-
*
|
|
10263
|
-
* @param {Element} element
|
|
10264
|
-
* @param {string} selector
|
|
10265
|
-
* @return {Element}
|
|
10266
|
-
*/ function closestNative(element, selector) {
|
|
10267
|
-
return element && element.closest(selector);
|
|
10268
|
-
}
|
|
10269
|
-
var closest$1 = typeof Element.prototype.closest === "function" ? closestNative : closest;
|
|
10270
|
-
|
|
10271
|
-
/**
|
|
10272
|
-
* Delegates event to a selector.
|
|
10273
|
-
*
|
|
10274
|
-
* @param {Element} element
|
|
10275
|
-
* @param {string} selector
|
|
10276
|
-
* @param {string} type
|
|
10277
|
-
* @param {Function} callback
|
|
10278
|
-
* @param {boolean} useCapture
|
|
10279
|
-
* @return {Object}
|
|
10280
|
-
*/ // prettier-ignore
|
|
10281
|
-
function _delegate(element, selector, type, callback, useCapture) {
|
|
10282
|
-
// prettier-ignore
|
|
10283
|
-
var listenerFn = listener.apply(this, arguments);
|
|
10284
|
-
element.addEventListener(type, listenerFn, useCapture);
|
|
10285
|
-
return {
|
|
10286
|
-
destroy: function destroy() {
|
|
10287
|
-
element.removeEventListener(type, listenerFn, useCapture);
|
|
10288
|
-
}
|
|
10289
|
-
};
|
|
10290
|
-
}
|
|
10291
|
-
/**
|
|
10292
|
-
* Delegates event to a selector.
|
|
10293
|
-
*
|
|
10294
|
-
* @param {Element|string|Array} [elements]
|
|
10295
|
-
* @param {string | Element} selector
|
|
10296
|
-
* @param {string} type
|
|
10297
|
-
* @param {Function} callback
|
|
10298
|
-
* @param {boolean} useCapture
|
|
10299
|
-
* @return {Object}
|
|
10300
|
-
* @example
|
|
10301
|
-
* ```ts
|
|
10302
|
-
* const delegation = delegate(document.body, 'a', 'click', function (e) {})
|
|
10303
|
-
* // destroy (removeEventListener)
|
|
10304
|
-
* delegation.destroy();
|
|
10305
|
-
*
|
|
10306
|
-
* const delegation1 = delegate(".btn", "click", function (e) { console.log(e.delegateTarget)},false);
|
|
10307
|
-
* // destroy (removeEventListener)
|
|
10308
|
-
* delegation1.destroy();
|
|
10309
|
-
* ```
|
|
10310
|
-
*/ // prettier-ignore
|
|
10311
|
-
function delegate(elements, selector, type, callback, useCapture) {
|
|
10312
|
-
// Handle the regular Element usage
|
|
10313
|
-
if (typeof elements.addEventListener === "function") {
|
|
10314
|
-
return _delegate.apply(null, arguments);
|
|
10315
|
-
}
|
|
10316
|
-
// Handle Element-less usage, it defaults to global delegation
|
|
10317
|
-
if (typeof type === "function") {
|
|
10318
|
-
// Use `document` as the first parameter, then apply arguments
|
|
10319
|
-
// This is a short way to .unshift `arguments` without running into deoptimizations
|
|
10320
|
-
return _delegate.bind(null, document).apply(null, arguments);
|
|
10321
|
-
}
|
|
10322
|
-
// Handle Selector-based usage
|
|
10323
|
-
if (typeof elements === "string") {
|
|
10324
|
-
elements = document.querySelectorAll(elements);
|
|
10325
|
-
}
|
|
10326
|
-
// Handle Array-like based usage
|
|
10327
|
-
return Array.prototype.map.call(elements, function(element) {
|
|
10328
|
-
return _delegate(element, selector, type, callback, useCapture);
|
|
10329
|
-
});
|
|
10330
|
-
}
|
|
10331
|
-
/**
|
|
10332
|
-
* Finds closest match and invokes callback.
|
|
10333
|
-
*
|
|
10334
|
-
* @param {Element} element
|
|
10335
|
-
* @param {string} selector
|
|
10336
|
-
* @param {string} type
|
|
10337
|
-
* @param {Function} callback
|
|
10338
|
-
* @return {Function}
|
|
10339
|
-
*/ // prettier-ignore
|
|
10340
|
-
function listener(element, selector, type, callback) {
|
|
10341
|
-
return function(e) {
|
|
10342
|
-
e.delegateTarget = closest$1(e.target, selector);
|
|
10343
|
-
if (e.delegateTarget) {
|
|
10344
|
-
callback.call(element, e);
|
|
10345
|
-
}
|
|
10346
|
-
};
|
|
10347
|
-
}
|
|
10348
|
-
|
|
10349
|
-
return delegate;
|
|
10350
|
-
|
|
10351
|
-
}));
|
|
10352
|
-
} (delegate$1));
|
|
10353
|
-
return delegate$1.exports;
|
|
10354
|
-
}
|
|
10355
|
-
|
|
10356
|
-
/*
|
|
10357
|
-
* @ezuikit/control-date-picker v1.0.0-beta.8
|
|
10358
|
-
* Copyright (c) 2025-12-04 Ezviz-OpenBiz
|
|
10214
|
+
* @ezuikit/control-date-picker v0.0.1-alpha.2
|
|
10215
|
+
* Copyright (c) 2025-11-12 Ezviz-OpenBiz
|
|
10359
10216
|
* Released under the MIT License.
|
|
10360
10217
|
*/
|
|
10361
10218
|
|
|
10219
|
+
var dist$2;
|
|
10362
10220
|
var hasRequiredDist$2;
|
|
10363
10221
|
|
|
10364
10222
|
function requireDist$2 () {
|
|
10365
10223
|
if (hasRequiredDist$2) return dist$2;
|
|
10366
10224
|
hasRequiredDist$2 = 1;
|
|
10367
|
-
var delegate=requireDelegate(),utilsTools=requireDist$8(),deepmerge=requireCjs(),Picker=requireDist$a(),Util=function(){function Util(){}return Util.fillZero=function(num,len){return void 0===len&&(len=2),num.toString().padStart(len,"0")},Util.chunkBySize=function(arr,size){return Array.from({length:Math.ceil(arr.length/size)}).map(function(_,index){return arr.slice(index*size,(index+1)*size)})},Util.generateYears=function(year){for(var years=[],i=year%10+1;i>=0;i--)years.push(year-i);for(var i1=1;years.length<12;i1++)years.push(year+i1);return years},Util.getDaysInMonth=function(year,month){return new Date(year,month+1,0).getDate()},Util.getFirstDayOfMonth=function(year,month,startOfWeek){return void 0===startOfWeek&&(startOfWeek=0),(new Date(year,month).getDay()-startOfWeek+7)%7},Util.generateWeeksByYearMonth=function(year,month,startOfWeek){ void 0===startOfWeek&&(startOfWeek=0),month-=1;for(var daysInMonth=Util.getDaysInMonth(year,month),firstDay=Util.getFirstDayOfMonth(year,month,startOfWeek),weeks=[],i=1;i<=firstDay+daysInMonth;i++){var day=i-firstDay;day<1?weeks.push((0===month?year-1:year)+"-"+Util.fillZero((month+12-1)%12+1)+"-"+Util.fillZero(Util.getDaysInMonth(year,month-1)+day)):day>daysInMonth?weeks.push((11===month?year+1:year)+"-"+Util.fillZero((month+1)%12+1)+"-"+(day-daysInMonth)):weeks.push(year+"-"+Util.fillZero(month+1)+"-"+Util.fillZero(day));}for(var nextDay=1;weeks.length<42;)weeks.push((11===month?year+1:year)+"-"+Util.fillZero((month+1)%12+1)+"-"+Util.fillZero(nextDay++));return weeks},Util.generateHours=function(){for(var hours=[],i=0;i<24;i++)hours.push(Util.fillZero(i));return hours},Util.generateMinutesOrSeconds=function(){for(var hours=[],i=0;i<=59;i++)hours.push(Util.fillZero(i));return hours},Util}(),__$CALENDAR_LOCALES$__={en:{year:"",month:"",weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],today:"Today",ok:"OK",months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},zh:{year:"年",month:"月",weeks:["日","一","二","三","四","五","六"],today:"今天",ok:"确定",months:["01","02","03","04","05","06","07","08","09","10","11","12"]}},__DEFAULT_COMPONENTS_OPTIONS__={showSuperPrevIcon:false,showSuperNextIcon:false,showPrevIcon:false,showNextIcon:false,showHeaderClose:false,showHeaderOk:false,renderSuperPrevIcon:'<span class="edate-super-prev-icon"></span>',renderSuperNextIcon:'<span class="edate-super-next-icon"></span>',renderPrevIcon:'<span class="edate-prev-icon"></span>',renderNextIcon:'<span class="edate-next-icon"></span>',renderHeaderCloseIcon:'<span class="edate-close-icon">\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 </span>',renderHeaderOkIcon:function(locale){return '<span class="edate-btn-text">'+((null==locale?void 0:locale.ok)||"确定")+"</span>"}},Header=function(){function Header(options){this.$header=null,this.options=deepmerge.all([{},__DEFAULT_COMPONENTS_OPTIONS__,options],{clone:false}),this.$header=document.createElement("div"),this.$header.classList.add("edate-header",options.prefixCls+"-header"),options.className&&this.$header.classList.add(options.className),this._render(),this._eventListeners();}var _proto=Header.prototype;return _proto._render=function(){var _this__getStrOrFunToStr,_this__getStrOrFunToStr1,_this__getStrOrFunToStr2,_this__getStrOrFunToStr3,_this__getStrOrFunToStr4,_this__getStrOrFunToStr5;this.$header&&(this.$header.innerHTML="\n "+(this.options.showHeaderClose?'<div class="edate-close-btn">\n '+(null!=(_this__getStrOrFunToStr=this._getStrOrFunToStr(this.options.renderHeaderCloseIcon))?_this__getStrOrFunToStr:__DEFAULT_COMPONENTS_OPTIONS__.renderHeaderCloseIcon)+"\n </div>":this.options.showHeaderOk?"<span></span>":"")+"\n "+(this.options.showSuperPrevIcon||this.options.showPrevIcon?'\n <div class="edate-prev-btns">\n '+(this.options.showSuperPrevIcon?'<div class="edate-super-prev-btn '+this.options.prefixCls+'-super-prev-btn">\n '+(null!=(_this__getStrOrFunToStr1=this._getStrOrFunToStr(this.options.renderSuperPrevIcon))?_this__getStrOrFunToStr1:__DEFAULT_COMPONENTS_OPTIONS__.renderSuperPrevIcon)+"\n </div>":"")+"\n "+(this.options.showPrevIcon?'<div class="edate-prev-btn '+this.options.prefixCls+'-prev-btn">\n '+(null!=(_this__getStrOrFunToStr2=this._getStrOrFunToStr(this.options.renderPrevIcon))?_this__getStrOrFunToStr2:__DEFAULT_COMPONENTS_OPTIONS__.renderPrevIcon)+"\n </div>":"")+"\n </div>\n ":"")+'\n\n <div class="edate-header-view '+this.options.prefixCls+'-header-view"></div>\n\n '+(this.options.showNextIcon||this.options.showSuperNextIcon?'\n <div class="edate-next-btns">\n '+(this.options.showNextIcon?'<div class="edate-next-btn '+this.options.prefixCls+'-next-btn">\n '+(null!=(_this__getStrOrFunToStr3=this._getStrOrFunToStr(this.options.renderNextIcon))?_this__getStrOrFunToStr3:__DEFAULT_COMPONENTS_OPTIONS__.renderNextIcon)+"\n </div>":"")+"\n "+(this.options.showSuperNextIcon?'<div class="edate-super-next-btn '+this.options.prefixCls+'-super-next-btn">\n '+(null!=(_this__getStrOrFunToStr4=this._getStrOrFunToStr(this.options.renderSuperNextIcon))?_this__getStrOrFunToStr4:__DEFAULT_COMPONENTS_OPTIONS__.renderSuperNextIcon)+"\n </div>":"")+"\n </div>\n ":"")+"\n "+(this.options.showHeaderOk?'<div class="edate-ok-btn">\n '+(null!=(_this__getStrOrFunToStr5=this._getStrOrFunToStr(this.options.renderHeaderOkIcon))?_this__getStrOrFunToStr5:__DEFAULT_COMPONENTS_OPTIONS__.renderHeaderOkIcon)+"\n </div>":this.options.showHeaderClose?"<span></span>":""));},_proto._getStrOrFunToStr=function(value){if(null!=value){var _this_options;if("function"==typeof value)return this._getStrOrFunToStr(null==value?void 0:value(null==(_this_options=this.options)?void 0:_this_options.locale));if("string"==typeof value)return value}},_proto.renderContent=function(html){if(this.$header){var _$content=this.$header.querySelector(".edate-header-view");if(!_$content)return;_$content.innerHTML=html;}},_proto.destroy=function(){this.$header&&this.$header.remove();},_proto._eventListeners=function(){var _this=this;_this.$header&&(delegate(_this.$header,".edate-super-prev-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onSuperPrev||_this.options.onSuperPrev.call(_this.options);}),delegate(_this.$header,".edate-prev-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onPrev||_this.options.onPrev.call(_this.options);}),delegate(_this.$header,".edate-next-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onNext||_this.options.onNext.call(_this.options);}),delegate(_this.$header,".edate-super-next-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||null==_this.options.onSuperNext||_this.options.onSuperNext.call(_this.options);}),delegate(_this.$header,".edate-close-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==_this.options.onClose||_this.options.onClose.call(_this.options),event.stopPropagation(),event.preventDefault());}),delegate(_this.$header,".edate-ok-btn","click",function(event){event.delegateTarget.classList.contains("edate-disabled")||(null==_this.options.onOk||_this.options.onOk.call(_this.options),event.stopPropagation(),event.preventDefault());}));},Header}();function _extends$2(){return _extends$2=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$2.apply(this,arguments)}var _CONTAINER_DEFAULT_OPTIONS_={prefixCls:"edate",locales:__$CALENDAR_LOCALES$__,showHeader:true},Container=function(){function Container(popupContainer,options){this.$panel=document.createElement("div"),this.$body=document.createElement("div"),this.$container=document.createElement("div"),this.language="zh",this.header=null,this.locale=__$CALENDAR_LOCALES$__.zh,this.options=deepmerge.all([{},_CONTAINER_DEFAULT_OPTIONS_,options],{clone:false}),this.$popupContainer=popupContainer?"function"==typeof popupContainer?popupContainer():popupContainer:document.body,this._setLocale(),this.$container.classList.add("edate-container",(this.options.prefixCls||"edate")+"-container"),options.isMobile&&this.$container.classList.add("edate-mobile",this.options.prefixCls+"-mobile"),this.options.wrapClassName&&this.$container.classList.add(this.options.wrapClassName),this.$panel.classList.add("edate-panel",(this.options.prefixCls||"edate")+"-panel"),this.options.showHeader&&(this.header=new Header(_extends$2({},this.options,{locale:this.locale,onPrev:this._onPrev.bind(this),onNext:this._onNext.bind(this),onSuperPrev:this._onSuperPrev.bind(this),onSuperNext:this._onSuperNext.bind(this),onClose:this._onClose.bind(this),onOk:this._onOk.bind(this)})),this.$panel.appendChild(this.header.$header)),this.$body.classList.add("edate-body",(this.options.prefixCls||"edate")+"-body"),this.$container.appendChild(this.$panel),this.$popupContainer.appendChild(this.$container);}var _proto=Container.prototype;return _proto._setLocale=function(){if(this.options.locales)if("string"==typeof this.options.language){var language=this.options.language||navigator.language;this.options.locales[language]?this.locale=this.options.locales[language]:this.locale=this.options.locales.zh;}else this.locale=this.options.locales.zh;},_proto.destroy=function(){var _this_$container;(null==(_this_$container=this.$container)?void 0:_this_$container.parentNode)&&this.$container.parentNode.removeChild(this.$container),this.header=null,this.$container=null;},_proto.setLocale=function(locale){"string"==typeof locale?this._setLocale():this.locale=locale;},_proto._onSuperPrev=function(){},_proto._onSuperNext=function(){},_proto._onPrev=function(){},_proto._onNext=function(){},_proto._onClose=function(){},_proto._onOk=function(){},Container}();function _create_class$3(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$3(o,p){return _set_prototype_of$3=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$3(o,p)}var _CALENDAR_DEFAULT_OPTIONS_={startOfWeek:0,showHeader:true,showSuperPrevIcon:true,showSuperNextIcon:true,showPrevIcon:true,showNextIcon:true,language:"zh",renderBadge:'<span class="ecalendar-badge"></span>',badges:[]},Calendar=function(Container){function Calendar(container,options){var _this,_this_options_badges,_this_options,_this_options1,_this_options2;return (_this=Container.call(this,container,_extends$1({},_CALENDAR_DEFAULT_OPTIONS_,options,{prefixCls:"ecalendar"}))||this).badges=[],(null==(_this_options_badges=_this.options.badges)?void 0:_this_options_badges.length)&&_this._updateBadges(_this.options.badges,false),(null==(_this_options=_this.options)?void 0:_this_options.startOfWeek)&&((null==(_this_options1=_this.options)?void 0:_this_options1.startOfWeek)>6||(null==(_this_options2=_this.options)?void 0:_this_options2.startOfWeek)<0)&&(_this.options.startOfWeek=0),_this._render(),_this.setCurrent(_this.options.current,false),_this._onHeader(),_this._onCell(),_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$3(subClass,superClass);}(Calendar,Container);var _proto=Calendar.prototype;return _proto.setCurrent=function(date,change){if(void 0===change&&(change=true),"string"==typeof date||(left=date,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right))try{if(date="string"==typeof date?utilsTools.DateTime.toDate(date):date,(!this._current||utilsTools.DateTime.format(date,"YYYY-MM-DD")!==utilsTools.DateTime.format(this._current,"YYYY-MM-DD"))&&(this._current=date,change&&(null==this.options.onChange||this.options.onChange.call(this.options,date,utilsTools.DateTime.format(date,"YYYY-MM-DD"))),this.$body)){var _this_$body_querySelector,_this_$body_querySelector1;null==(_this_$body_querySelector=this.$body.querySelector(".ecalendar-cell-selected"))||_this_$body_querySelector.classList.remove("ecalendar-cell-selected");var title=utilsTools.DateTime.format(this._current,"YYYY-MM-DD");null==(_this_$body_querySelector1=this.$body.querySelector(".ecalendar-cell-in-view[title='"+title+"']"))||_this_$body_querySelector1.classList.add("ecalendar-cell-selected");}this._setRenderCurrent(this._current);}catch(error){this._setRenderCurrent(new Date);}else this._setRenderCurrent(new Date);var left,right;},_proto.updateBadges=function(badges){this._updateBadges(badges);},_proto._updateBadges=function(badges,rerender){ void 0===rerender&&(rerender=true),(null==badges?void 0:badges.length)&&(this.badges=badges.map(function(date){return utilsTools.DateTime.format(date,"YYYY-MM-DD")}),rerender&&this._renderDate());},_proto._setRenderCurrent=function(date){(!this._renderCurrent||date&&utilsTools.DateTime.format(this._renderCurrent,"YYYY-MM")!==utilsTools.DateTime.format(date,"YYYY-MM"))&&(this._renderCurrent=date||new Date,this._renderDate());},_proto._onCell=function(){var _this=this;delegate(this.$body,".ecalendar-cell","click",function(event){var date=new Date(event.delegateTarget.getAttribute("title").replace(/\//gi,"/")),disabled=event.delegateTarget.classList.contains("edate-disabled");disabled||_this.setCurrent(date),null==_this.options.onCell||_this.options.onCell.call(_this.options,date,utilsTools.DateTime.format(_this._renderCurrent,"YYYY-MM-DD"),disabled),event.stopPropagation(),event.preventDefault();});},_proto._onSuperPrev=function(){var date=new Date(this._renderCurrent);date.setFullYear(date.getFullYear()-1,date.getMonth(),date.getDate()),this._setRenderCurrent(date),null==this.options.onPrevMonth||this.options.onPrevMonth.call(this.options,this._current,this._renderCurrent);},_proto._onSuperNext=function(){var date=new Date(this._renderCurrent);date.setFullYear(date.getFullYear()+1,date.getMonth(),date.getDate()),this._setRenderCurrent(date),null==this.options.onNextMonth||this.options.onNextMonth.call(this.options,this._current,this._renderCurrent);},_proto._onPrev=function(){var date=new Date(this._renderCurrent);date.setMonth(date.getMonth()-1,date.getDate()),this._setRenderCurrent(date),null==this.options.onPrevMonth||this.options.onPrevMonth.call(this.options,this._current,this._renderCurrent);},_proto._onNext=function(){var date=new Date(this._renderCurrent);date.setMonth(date.getMonth()+1,date.getDate()),this._setRenderCurrent(date),null==this.options.onNextMonth||this.options.onNextMonth.call(this.options,this._current,this._renderCurrent);},_proto._onHeader=function(){var _this=this;delegate(this.$panel,".ecalendar-header-month-btn","click",function(){null==_this.options.onMonth||_this.options.onMonth.call(_this.options,_this._current,_this._renderCurrent);}),delegate(this.$panel,".ecalendar-header-year-btn","click",function(){null==_this.options.onYear||_this.options.onYear.call(_this.options,_this._current,_this._renderCurrent);});},_proto._onOk=function(){null==this.options.onOk||this.options.onOk.call(this.options,this.current);},_proto._onClose=function(){null==this.options.onClose||this.options.onClose.call(this.options,this.current);},_proto._render=function(){var _this_locale,_this_locale1,shiftedCustomDays=[].concat(((null==(_this_locale=this.locale)?void 0:_this_locale.weeks)||[]).slice(this.options.startOfWeek),((null==(_this_locale1=this.locale)?void 0:_this_locale1.weeks)||[]).slice(0,this.options.startOfWeek));this.$body.innerHTML='<table class="ecalendar-content">\n <thead><tr>'+shiftedCustomDays.map(function(day){return "<th>"+day+"</th>"}).join("")+"</tr></thead>\n <tbody></tbody>\n </table>",this.$panel.appendChild(this.$body);},_proto._renderDate=function(){var _this_header,_this_$body_querySelector,_this=this;if(this.$body){var _this_locale_months,_this_locale,_this_locale1,_this_locale2,_this_locale3,_this_locale_months1,_this_locale4,_this_locale5,_this_$body_querySelector1,todayStr=utilsTools.DateTime.format(new Date,"YYYY-MM-DD"),year=this._renderCurrent.getFullYear(),month=this._renderCurrent.getMonth()+1,dayGroupArray=Util.chunkBySize(Util.generateWeeksByYearMonth(year,month,this.options.startOfWeek),7),allowMonthClick="function"==typeof this.options.onMonth,allowYearClick="function"==typeof this.options.onYear;if(null==(_this_header=this.header)?void 0:_this_header.$header)this.header.renderContent("\n "+("zh"!==this.options.language?'<span class="ecalendar-header-month-btn '+(allowMonthClick?"edate-header-title-hover":"")+'">'+(null==(_this_locale=this.locale)||null==(_this_locale_months=_this_locale.months)?void 0:_this_locale_months[+(month-1)])+((null==(_this_locale1=this.locale)?void 0:_this_locale1.month)||"")+'</span> <span class="ecalendar-header-year-btn '+(allowYearClick?"edate-header-title-hover":"")+'">'+year+((null==(_this_locale2=this.locale)?void 0:_this_locale2.year)||"")+"</span>":'<span class="ecalendar-header-year-btn '+(allowYearClick?"edate-header-title-hover":"")+'">'+year+((null==(_this_locale3=this.locale)?void 0:_this_locale3.year)||"")+'</span> <span class="ecalendar-header-month-btn '+(allowMonthClick?"edate-header-title-hover":"")+'">'+(null==(_this_locale4=this.locale)||null==(_this_locale_months1=_this_locale4.months)?void 0:_this_locale_months1[+(month-1)])+((null==(_this_locale5=this.locale)?void 0:_this_locale5.month)||"")+"</span>"));if(null==(_this_$body_querySelector=this.$body.querySelector(".ecalendar-content"))?void 0:_this_$body_querySelector.querySelector("tbody"))(null==(_this_$body_querySelector1=this.$body.querySelector(".ecalendar-content"))?void 0:_this_$body_querySelector1.querySelector("tbody")).innerHTML="\n "+dayGroupArray.slice(0,7).map(function(dates){return "<tr>\n "+dates.map(function(dateStr){var _this_options,_dateStr_split=dateStr.split("-"),y=_dateStr_split[0],m=_dateStr_split[1],d=_dateStr_split[2],date=new Date(+y,+m,+d),classNames=[month===+m?"ecalendar-cell-in-view":"",todayStr===dateStr?"ecalendar-cell-today":"",_this._current&&utilsTools.DateTime.format(_this._current,"YYYY-MM-DD")===dateStr?"ecalendar-cell-selected":"","function"==typeof(null==(_this_options=_this.options)?void 0:_this_options.disabledDate)&&_this.options.disabledDate(utilsTools.DateTime.toDate(dateStr),dateStr)?"edate-disabled":""].filter(Boolean),badgeHtml=_this._renderBadge(date,dateStr);return '<td title="'+dateStr+'" class="ecalendar-cell '+classNames.join(" ")+'">\n '+("function"==typeof _this.options.renderDate?_this.options.renderDate(date,dateStr):'<span class="ecalendar-cell-inner">'+Util.fillZero(+d)+"</span>")+"\n "+badgeHtml+"\n </td>"}).join("")+"\n </tr>"}).join("");}},_proto._renderBadge=function(date,dateStr){var badgeHtml="";badgeHtml="function"==typeof this.options.renderBadge?this.options.renderBadge(date,dateStr):"string"==typeof this.options.renderBadge?this.options.renderBadge:"";var showBadge="function"==typeof this.options.showBadge&&this.options.showBadge(date,dateStr);return this.badges.includes(dateStr)||showBadge||(badgeHtml=""),badgeHtml},_create_class$3(Calendar,[{key:"current",get:function(){return this._current}}]),Calendar}(Container);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}function _set_prototype_of$2(o,p){return _set_prototype_of$2=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$2(o,p)}Calendar.DateTime=utilsTools.DateTime;var _Month_DEFAULT_OPTIONS_={showHeader:true,showSuperPrevIcon:true,showSuperNextIcon:true,language:"zh"},Month=function(Container){function Month(popupContainer,options){var _this;return (_this=Container.call(this,popupContainer,deepmerge.all([{},_Month_DEFAULT_OPTIONS_,options||{},{showPrevIcon:false,showNextIcon:false,prefixCls:"emonth"}],{clone:false}))||this)._render(),_this.setCurrent(_this.options.current,false),_this._onHeaderTitle(),_this._onCell(),_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$2(subClass,superClass);}(Month,Container);var _proto=Month.prototype;return _proto.setCurrent=function(date,change){ void 0===change&&(change=true),this._setCurrent(date,change);},_proto._setCurrent=function(date,change){if("string"==typeof date||(left=date,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right))try{var d=date;"string"==typeof d&&(d=utilsTools.DateTime.toDate(d));var current=d;this._current&&utilsTools.DateTime.format(current,"YYYY-MM-DD")===utilsTools.DateTime.format(this._current,"YYYY-MM-DD")||(this._current=current,"function"==typeof this.options.onChange&&change&&(null==this.options.onChange||this.options.onChange.call(this.options,current,utilsTools.DateTime.format(current,"YYYY-MM")))),this._setRenderCurrent(current);}catch(error){this._setRenderCurrent(new Date);}else this._setRenderCurrent(new Date);var left,right;},_proto._setRenderCurrent=function(date){if((!this._renderCurrent||this._renderCurrent&&utilsTools.DateTime.format(date,"YYYY")!==utilsTools.DateTime.format(this._renderCurrent,"YYYY"))&&(this._renderCurrent=date,this._renderMonths(date.getFullYear())),this._current){var _this_$body_querySelector,_this_$body_querySelector1;null==(_this_$body_querySelector=this.$body.querySelector(".emonth-cell-selected"))||_this_$body_querySelector.classList.remove("emonth-cell-selected");var selectedTitle=utilsTools.DateTime.format(this._current,"YYYY-MM");null==(_this_$body_querySelector1=this.$body.querySelector(".emonth-cell-in-view[title='"+selectedTitle+"']"))||_this_$body_querySelector1.classList.add("emonth-cell-selected");}this._setHeader();},_proto._onOk=function(){null==this.options.onOk||this.options.onOk.call(this.options,this.current);},_proto._onClose=function(){null==this.options.onClose||this.options.onClose.call(this.options,this.current);},_proto._onCell=function(){var _this=this;delegate(this.$body,".emonth-cell","click",function(e){e.stopPropagation(),e.preventDefault();var month=+e.delegateTarget.getAttribute("data-month"),newDate=utilsTools.DateTime.toDate(utilsTools.DateTime.format(_this._current,"yyyy-MM-dd HH:mm:ss"));newDate.setMonth(month-1);var disabled=e.delegateTarget.classList.contains("edate-disabled");disabled||_this.setCurrent(newDate),null==_this.options.onCell||_this.options.onCell.call(_this.options,newDate,utilsTools.DateTime.format(newDate,"YYYY-MM"),disabled);});},_proto._onSuperPrev=function(){var year=this._renderCurrent.getFullYear()-1,date=utilsTools.DateTime.toDate(year+utilsTools.DateTime.format(this._renderCurrent,"-MM-DDTHH:mm:ss"));this._setRenderCurrent(date),null==this.options.onSuperPrev||this.options.onSuperPrev.call(this.options,this._current,this._renderCurrent);},_proto._onSuperNext=function(){var year=this._renderCurrent.getFullYear()+1,date=utilsTools.DateTime.toDate(year+utilsTools.DateTime.format(this._renderCurrent,"-MM-DDTHH:mm:ss"));this._setRenderCurrent(date),null==this.options.onSuperNext||this.options.onSuperNext.call(this.options,this._current,this._renderCurrent);},_proto._onHeaderTitle=function(){var _this=this;delegate(this.$panel,".edate-header-title-hover","click",function(){null==_this.options.onYear||_this.options.onYear.call(_this.options,_this._current,_this._renderCurrent);});},_proto._setHeader=function(){if(this.$panel.querySelector(".emonth-header-view")){var allowClick="function"==typeof this.options.onYear;this.$panel.querySelector(".emonth-header-view").innerHTML='<span class="'+(allowClick?"edate-header-title-hover":"")+'">'+this._renderCurrent.getFullYear()+this.locale.year+"</span>";}},_proto._setDisabled=function(){for(var year=this._renderCurrent.getFullYear(),i=0;i<12;i++){var $cell=this.$body.querySelector(".emonth-cell[title='"+year+"-"+Util.fillZero(i+1)+"']");if($cell){var date=utilsTools.DateTime.toDate(year+"-"+Util.fillZero(i+1)+"-"+utilsTools.DateTime.format(this._renderCurrent,"DDTHH:mm:ss"));"function"==typeof this.options.disabledMonth&&this.options.disabledMonth(date,utilsTools.DateTime.format(date,"YYYY-MM"))?$cell.classList.add("edate-disabled"):$cell.classList.remove("edate-disabled");}}},_proto._render=function(){this.$body.innerHTML='<table class="emonth-content"></table>',this.$panel.appendChild(this.$body);},_proto._renderMonths=function(year){var _this=this;this.$body.querySelector(".emonth-content")&&(this.$body.querySelector(".emonth-content").innerHTML="\n <tbody>\n "+Util.chunkBySize(this.locale.months,3).slice(0,4).map(function(month,index){return "<tr>\n "+month.map(function(m,i){return '<td title="'+year+"-"+Util.fillZero(3*index+i+1)+'" data-month="'+Util.fillZero(3*index+i+1)+'" class="emonth-cell emonth-cell-in-view">\n <span class="emonth-cell-inner">'+(_this.options.monthRender&&"function"==typeof _this.options.monthRender?_this.options.monthRender(utilsTools.DateTime.toDate(year+"-"+Util.fillZero(3*index+i+1)),year+"-"+Util.fillZero(3*index+i+1))||"":m)+"</span>\n </td>"}).join("")+"\n </tr>"}).join("")+"\n </tbody>"),this._setDisabled();},_create_class$2(Month,[{key:"current",get:function(){return this._current}}]),Month}(Container);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 _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 _YEAR_DEFAULT_OPTIONS_={showHeader:true,showSuperPrevIcon:true,showSuperNextIcon:true,language:"zh",prefixCls:"eyear"},Year=function(Container){function Year(popupContainer,options){var _this;return (_this=Container.call(this,popupContainer,deepmerge.all([{},_YEAR_DEFAULT_OPTIONS_,options||{},{showPrevIcon:false,showNextIcon:false,renderPrevIcon:"",renderNextIcon:""}],{clone:false}))||this)._render(),_this._setCurrent(_this.options.current,false),_this._onCell(),_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);}(Year,Container);var _proto=Year.prototype;return _proto.setCurrent=function(year,change){ void 0===change&&(change=true),this._setCurrent(year,change);},_proto._setCurrent=function(year,change){ void 0===change&&(change=true);var left,right,_year="number"==typeof year?utilsTools.DateTime.toDate(year):(left=year,(null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?year:new Date);this._current&&utilsTools.DateTime.format(_year,"YYYY-MM-DD")===utilsTools.DateTime.format(this._current,"YYYY-MM-DD")||(this._current=_year,"function"==typeof this.options.onChange&&change&&this.options.onChange(_year)),this._renderTenYear=(this._current||new Date).getFullYear(),this._renderYearList();},_proto._onOk=function(){null==this.options.onOk||this.options.onOk.call(this.options,this.current);},_proto._onClose=function(){null==this.options.onClose||this.options.onClose.call(this.options,this.current);},_proto._onCell=function(){var _this=this;delegate(this.$body,".eyear-cell","click",function(e){var yearStr=+e.delegateTarget.getAttribute("title"),newDate=utilsTools.DateTime.toDate(utilsTools.DateTime.format(_this._current,"yyyy-MM-dd HH:mm:ss"));newDate.setFullYear(yearStr);var disabled=e.delegateTarget.classList.contains("edate-disabled");disabled||_this._setCurrent(newDate),null==_this.options.onCell||_this.options.onCell.call(_this.options,newDate,utilsTools.DateTime.format(newDate,"YYYY"),disabled),e.stopPropagation(),e.preventDefault();});},_proto._onSuperPrev=function(){this._renderTenYear=this._renderTenYear-10,null==this.options.onPrevYear||this.options.onPrevYear.call(this.options,this._current,Util.generateYears(this._renderTenYear)),this._renderYearList();},_proto._onSuperNext=function(){this._renderTenYear=this._renderTenYear+10,null==this.options.onNextYear||this.options.onNextYear.call(this.options,this._current,Util.generateYears(this._renderTenYear)),this._renderYearList();},_proto._render=function(){this.$body.innerHTML='<table class="eyear-content"></table>',this.$panel.appendChild(this.$body);},_proto._renderYearList=function(){var _this_header,_this=this,list=Util.generateYears(this._renderTenYear);null==(_this_header=this.header)||_this_header.renderContent(list[1]+" - "+list[list.length-2]),this.$body.querySelector(".eyear-content")&&(this.$body.querySelector(".eyear-content").innerHTML="\n <tbody>\n "+Util.chunkBySize(list,3).slice(0,4).map(function(years,i){return "<tr>\n "+years.map(function(y,j){var classNames=0===i&&0===j||3===i&&2===j?"eyear-cell":"eyear-cell eyear-cell-in-view";return +y===+_this._current.getFullYear()&&(classNames+=" eyear-cell-selected"),"function"==typeof _this.options.disabledYear&&_this.options.disabledYear(utilsTools.DateTime.toDate(y),y)&&(classNames+=" edate-disabled"),'<td title="'+y+'" class="'+classNames+'">\n '+(_this.options.yearRender&&"function"==typeof _this.options.yearRender?_this.options.yearRender(utilsTools.DateTime.toDate(y),y):'<span class="eyear-cell-inner">'+ +y+"</span>")+"\n </td>"}).join("")+"\n </tr>"}).join("")+"\n </tbody>\n ");},_create_class$1(Year,[{key:"current",get:function(){return this._current}}]),Year}(Container);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 _DATEPICKER_MODE_ARRAY=["date","month","year"],_DATEPICKER_DEFAULT_OPTIONS_={getPopupContainer:function(){return document.body},language:"zh",isMobile:false,mode:_DATEPICKER_MODE_ARRAY[0]},DatePicker=function(Picker){function DatePicker(container,options){var _this;return (_this=Picker.call(this,container,deepmerge.all([{},_DATEPICKER_DEFAULT_OPTIONS_,options||{},{wrapClassName:("edate-picker-container "+((null==options?void 0:options.wrapClassName)||"")).trim()}],{clone:false}))||this).current=null,_this._current=null,_this._calendar=null,_this._month=null,_this._year=null,_this._currentMode="date",_this.options=deepmerge.all([{},_DATEPICKER_DEFAULT_OPTIONS_,options||{}],{clone:false}),_this.options.current&&(_this.current=_this.options.current,_this._current=_this.options.current),_this._currentMode=_this.options.mode,_this._switchMode(),_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);}(DatePicker,Picker);var _proto=DatePicker.prototype;return _proto.setCurrent=function(date,change){ void 0===change&&(change=true),this._setCurrent(date,change);},_proto.updateBadges=function(badges){var _this__calendar;(null==badges?void 0:badges.length)&&(null==(_this__calendar=this._calendar)||_this__calendar.updateBadges(badges));},_proto.destroy=function(){var _this__calendar,_this__month,_this__year;null==(_this__calendar=this._calendar)||_this__calendar.destroy(),this._calendar=null,null==(_this__month=this._month)||_this__month.destroy(),this._month=null,null==(_this__year=this._year)||_this__year.destroy(),this._year=null,Picker.prototype.destroy.call(this);},_proto._setCurrent=function(date,change){var _this__calendar,_this__month,_this__year;void 0===change&&(change=true),this._current=date,null==(_this__calendar=this._calendar)||_this__calendar.setCurrent(date,change),null==(_this__month=this._month)||_this__month.setCurrent(date,change),null==(_this__year=this._year)||_this__year.setCurrent(date,change);},_proto._switchMode=function(){this.$body.classList.add("edate-picker-"+this._currentMode),"date"===this._currentMode?this._initCalendar():"month"===this._currentMode?this._initMonth():"year"===this._currentMode&&this._initYear(),this.setPlacement(this.options.placement||"top");},_proto.hide=function(){this.open=false;},_proto._onOpenChange=function(open){Picker.prototype._onOpenChange.call(this,open),open&&(this._removeCurrentTypeClass(),this._currentMode=this.options.mode||"date",this._switchMode(),this._setCurrent(this.current,false)),open||null==this.options.onClose||this.options.onClose.call(this.options,this.current,this._currentMode);},_proto._initCalendar=function(){var _this=this;this._calendar||(this._calendar=new Calendar(this.$body,_extends({},this.options,{current:this._current||new Date,onCell:this._onCell.bind(this),showHeaderOk:this.options.isMobile,showHeaderClose:this.options.isMobile,onOk:this._onOk.bind(this),onClose:this._onClose.bind(this),onMonth:this._onMonth.bind(this),onYear:this._onYear.bind(this),onChange:function(date){var _this__calendar;_this._current&&utilsTools.DateTime.format(_this._current,"YYYY-MM-DD")===utilsTools.DateTime.format(date,"YYYY-MM-DD")||_this._onChange(date,null==(_this__calendar=_this._calendar)?void 0:_this__calendar.options.showHeaderOk);}})));},_proto._initMonth=function(){var _this=this;this._month||(this._month=new Month(this.$body,_extends({},this.options,{current:this._current||new Date,onCell:this._onCell.bind(this),onOk:this._onOk.bind(this),onClose:this._onClose.bind(this),showHeaderOk:this.options.isMobile,showHeaderClose:this.options.isMobile,onChange:function(date){var _this__month;_this._current&&utilsTools.DateTime.format(_this._current,"YYYY-MM")===utilsTools.DateTime.format(date,"YYYY-MM")||_this._onChange(date,null==(_this__month=_this._month)?void 0:_this__month.options.showHeaderOk);},onYear:this._onYear.bind(this)})));},_proto._initYear=function(){var _this=this;this._year||(this._year=new Year(this.$body,_extends({},this.options,{current:this._current||new Date,onCell:this._onCell.bind(this),onOk:this._onOk.bind(this),onClose:this._onClose.bind(this),showHeaderOk:this.options.isMobile,showHeaderClose:this.options.isMobile,onChange:function(date){var _this__year;_this._current&&utilsTools.DateTime.format(_this._current,"YYYY")===utilsTools.DateTime.format(date,"YYYY")||_this._onChange(date,null==(_this__year=_this._year)?void 0:_this__year.options.showHeaderOk);}})));},_proto._onOk=function(date){this.current=date||this._current,this._setCurrent(date||this._current),null==this.options.onOk||this.options.onOk.call(this.options,this.current,this._currentMode),this.hide();},_proto._onClose=function(){this.hide();},_proto._onChange=function(date,_showHeaderOk){this._setCurrent(date,true);},_proto._onCell=function(date,_renderDate,disabled){null==this.options.onCell||this.options.onCell.call(this.options,date,this._currentMode),this.options.isMobile||this._currentMode!==this.options.mode||disabled||this._current&&utilsTools.DateTime.format(date,"YYYY-MM-DD")!==utilsTools.DateTime.format(this._current,"YYYY-MM-DD")||(this.current=date,null==this.options.onChange||this.options.onChange.call(this.options,date,this._currentMode)),disabled||this._prvMode();},_proto._prvMode=function(){this._currentMode!==this.options.mode||this.options.isMobile||this.hide();var index=_DATEPICKER_MODE_ARRAY.indexOf(this._currentMode);index>=1&&(index--,this._removeCurrentTypeClass(),this._currentMode=_DATEPICKER_MODE_ARRAY[index],this._switchMode());},_proto._onYear=function(){this._removeCurrentTypeClass(),this._currentMode="year",this._switchMode();},_proto._onMonth=function(){this._removeCurrentTypeClass(),this._currentMode="month",this._switchMode();},_proto._removeCurrentTypeClass=function(){this.$body.classList.remove("edate-picker-"+this._currentMode);},_create_class(DatePicker,[{key:"_minModeIndex",get:function(){return _DATEPICKER_MODE_ARRAY.indexOf(this.options.mode)}}]),DatePicker}(Picker);dist$2.Calendar=Calendar,dist$2.DatePicker=DatePicker,dist$2.Header=Header,dist$2.Month=Month,dist$2.Year=Year;
|
|
10225
|
+
|
|
10226
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10227
|
+
try {
|
|
10228
|
+
var info = gen[key](arg);
|
|
10229
|
+
var value = info.value;
|
|
10230
|
+
} catch (error) {
|
|
10231
|
+
reject(error);
|
|
10232
|
+
return;
|
|
10233
|
+
}
|
|
10234
|
+
if (info.done) {
|
|
10235
|
+
resolve(value);
|
|
10236
|
+
} else {
|
|
10237
|
+
Promise.resolve(value).then(_next, _throw);
|
|
10238
|
+
}
|
|
10239
|
+
}
|
|
10240
|
+
function _async_to_generator(fn) {
|
|
10241
|
+
return function() {
|
|
10242
|
+
var self = this, args = arguments;
|
|
10243
|
+
return new Promise(function(resolve, reject) {
|
|
10244
|
+
var gen = fn.apply(self, args);
|
|
10245
|
+
function _next(value) {
|
|
10246
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
10247
|
+
}
|
|
10248
|
+
function _throw(err) {
|
|
10249
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
10250
|
+
}
|
|
10251
|
+
_next(undefined);
|
|
10252
|
+
});
|
|
10253
|
+
};
|
|
10254
|
+
}
|
|
10255
|
+
function _ts_generator(thisArg, body) {
|
|
10256
|
+
var f, y, t, _ = {
|
|
10257
|
+
label: 0,
|
|
10258
|
+
sent: function() {
|
|
10259
|
+
if (t[0] & 1) throw t[1];
|
|
10260
|
+
return t[1];
|
|
10261
|
+
},
|
|
10262
|
+
trys: [],
|
|
10263
|
+
ops: []
|
|
10264
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
10265
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
10266
|
+
return this;
|
|
10267
|
+
}), g;
|
|
10268
|
+
function verb(n) {
|
|
10269
|
+
return function(v) {
|
|
10270
|
+
return step([
|
|
10271
|
+
n,
|
|
10272
|
+
v
|
|
10273
|
+
]);
|
|
10274
|
+
};
|
|
10275
|
+
}
|
|
10276
|
+
function step(op) {
|
|
10277
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
10278
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
10279
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
10280
|
+
if (y = 0, t) op = [
|
|
10281
|
+
op[0] & 2,
|
|
10282
|
+
t.value
|
|
10283
|
+
];
|
|
10284
|
+
switch(op[0]){
|
|
10285
|
+
case 0:
|
|
10286
|
+
case 1:
|
|
10287
|
+
t = op;
|
|
10288
|
+
break;
|
|
10289
|
+
case 4:
|
|
10290
|
+
_.label++;
|
|
10291
|
+
return {
|
|
10292
|
+
value: op[1],
|
|
10293
|
+
done: false
|
|
10294
|
+
};
|
|
10295
|
+
case 5:
|
|
10296
|
+
_.label++;
|
|
10297
|
+
y = op[1];
|
|
10298
|
+
op = [
|
|
10299
|
+
0
|
|
10300
|
+
];
|
|
10301
|
+
continue;
|
|
10302
|
+
case 7:
|
|
10303
|
+
op = _.ops.pop();
|
|
10304
|
+
_.trys.pop();
|
|
10305
|
+
continue;
|
|
10306
|
+
default:
|
|
10307
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
10308
|
+
_ = 0;
|
|
10309
|
+
continue;
|
|
10310
|
+
}
|
|
10311
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
10312
|
+
_.label = op[1];
|
|
10313
|
+
break;
|
|
10314
|
+
}
|
|
10315
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
10316
|
+
_.label = t[1];
|
|
10317
|
+
t = op;
|
|
10318
|
+
break;
|
|
10319
|
+
}
|
|
10320
|
+
if (t && _.label < t[2]) {
|
|
10321
|
+
_.label = t[2];
|
|
10322
|
+
_.ops.push(op);
|
|
10323
|
+
break;
|
|
10324
|
+
}
|
|
10325
|
+
if (t[2]) _.ops.pop();
|
|
10326
|
+
_.trys.pop();
|
|
10327
|
+
continue;
|
|
10328
|
+
}
|
|
10329
|
+
op = body.call(thisArg, _);
|
|
10330
|
+
} catch (e) {
|
|
10331
|
+
op = [
|
|
10332
|
+
6,
|
|
10333
|
+
e
|
|
10334
|
+
];
|
|
10335
|
+
y = 0;
|
|
10336
|
+
} finally{
|
|
10337
|
+
f = t = 0;
|
|
10338
|
+
}
|
|
10339
|
+
if (op[0] & 5) throw op[1];
|
|
10340
|
+
return {
|
|
10341
|
+
value: op[0] ? op[1] : void 0,
|
|
10342
|
+
done: true
|
|
10343
|
+
};
|
|
10344
|
+
}
|
|
10345
|
+
}
|
|
10346
|
+
var AppendJS = /*#__PURE__*/ function() {
|
|
10347
|
+
function AppendJS() {}
|
|
10348
|
+
AppendJS.loadScript = function loadScript(src) {
|
|
10349
|
+
return _async_to_generator(function() {
|
|
10350
|
+
return _ts_generator(this, function(_state) {
|
|
10351
|
+
switch(_state.label){
|
|
10352
|
+
case 0:
|
|
10353
|
+
return [
|
|
10354
|
+
4,
|
|
10355
|
+
new Promise(function(resolve, reject) {
|
|
10356
|
+
if (AppendJS.LoadedScr.includes(src)) {
|
|
10357
|
+
return resolve(src);
|
|
10358
|
+
}
|
|
10359
|
+
if (AppendJS.LoadingScrQueue[src]) {
|
|
10360
|
+
return AppendJS.LoadingScrQueue[src].push(resolve);
|
|
10361
|
+
} else {
|
|
10362
|
+
AppendJS.LoadingScrQueue[src] = [
|
|
10363
|
+
resolve
|
|
10364
|
+
];
|
|
10365
|
+
}
|
|
10366
|
+
var link;
|
|
10367
|
+
if (src.includes('.js')) {
|
|
10368
|
+
link = document.createElement('script');
|
|
10369
|
+
link.src = src;
|
|
10370
|
+
link.async = true;
|
|
10371
|
+
} else if (src.includes('.css')) {
|
|
10372
|
+
link = document.createElement('link');
|
|
10373
|
+
link.rel = 'stylesheet';
|
|
10374
|
+
link.href = src;
|
|
10375
|
+
}
|
|
10376
|
+
link.onload = function() {
|
|
10377
|
+
AppendJS.LoadedScr.push(src);
|
|
10378
|
+
AppendJS.LoadingScrQueue[src].forEach(function(resolve) {
|
|
10379
|
+
return resolve(src);
|
|
10380
|
+
});
|
|
10381
|
+
AppendJS.LoadingScrQueue[src] = [];
|
|
10382
|
+
};
|
|
10383
|
+
link.onerror = function() {
|
|
10384
|
+
return reject(new Error('Failed to load ' + src));
|
|
10385
|
+
};
|
|
10386
|
+
document.head.appendChild(link);
|
|
10387
|
+
})
|
|
10388
|
+
];
|
|
10389
|
+
case 1:
|
|
10390
|
+
return [
|
|
10391
|
+
2,
|
|
10392
|
+
_state.sent()
|
|
10393
|
+
];
|
|
10394
|
+
}
|
|
10395
|
+
});
|
|
10396
|
+
})();
|
|
10397
|
+
};
|
|
10398
|
+
AppendJS.loadScriptsBatch = function loadScriptsBatch(srcArr) {
|
|
10399
|
+
return _async_to_generator(function() {
|
|
10400
|
+
return _ts_generator(this, function(_state) {
|
|
10401
|
+
switch(_state.label){
|
|
10402
|
+
case 0:
|
|
10403
|
+
return [
|
|
10404
|
+
4,
|
|
10405
|
+
Promise.all(srcArr.map(AppendJS.loadScript))
|
|
10406
|
+
];
|
|
10407
|
+
case 1:
|
|
10408
|
+
return [
|
|
10409
|
+
2,
|
|
10410
|
+
_state.sent()
|
|
10411
|
+
];
|
|
10412
|
+
}
|
|
10413
|
+
});
|
|
10414
|
+
})();
|
|
10415
|
+
};
|
|
10416
|
+
AppendJS.remove = function remove(src) {
|
|
10417
|
+
src.forEach(function(item) {
|
|
10418
|
+
var link = document.querySelector('script[src="' + item + '"]') || document.querySelector('link[href="' + item + '"]');
|
|
10419
|
+
if (link) {
|
|
10420
|
+
link.remove();
|
|
10421
|
+
}
|
|
10422
|
+
});
|
|
10423
|
+
};
|
|
10424
|
+
AppendJS.clear = function clear() {
|
|
10425
|
+
AppendJS.remove(AppendJS.LoadedScr);
|
|
10426
|
+
};
|
|
10427
|
+
return AppendJS;
|
|
10428
|
+
}();
|
|
10429
|
+
/** 已经加载完的js/css */ AppendJS.LoadedScr = [];
|
|
10430
|
+
/** 正在加载的js/css */ AppendJS.LoadingScrQueue = {};
|
|
10431
|
+
|
|
10432
|
+
function _defineProperties(target, props) {
|
|
10433
|
+
for(var i = 0; i < props.length; i++){
|
|
10434
|
+
var descriptor = props[i];
|
|
10435
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10436
|
+
descriptor.configurable = true;
|
|
10437
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
10438
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
10439
|
+
}
|
|
10440
|
+
}
|
|
10441
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
10442
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
10443
|
+
return Constructor;
|
|
10444
|
+
}
|
|
10445
|
+
var DEFAULT_OPTIONS = {
|
|
10446
|
+
staticPath: '.',
|
|
10447
|
+
place: 'top-right',
|
|
10448
|
+
language: 'zh-CN',
|
|
10449
|
+
current: new Date(),
|
|
10450
|
+
maxDate: new Date()
|
|
10451
|
+
};
|
|
10452
|
+
/**
|
|
10453
|
+
* 日期选择器
|
|
10454
|
+
*/ var DatePicker = /*#__PURE__*/ function() {
|
|
10455
|
+
function DatePicker(container, options) {
|
|
10456
|
+
var _this = this;
|
|
10457
|
+
this._open = false;
|
|
10458
|
+
this._change = true;
|
|
10459
|
+
this.$container = container;
|
|
10460
|
+
this.options = Object.assign({}, DEFAULT_OPTIONS, options);
|
|
10461
|
+
this.options.staticPath = (this.options.staticPath || '').replace(/\/$/, '');
|
|
10462
|
+
if (this.options.current) {
|
|
10463
|
+
this._date = this.options.current;
|
|
10464
|
+
}
|
|
10465
|
+
this._init();
|
|
10466
|
+
this.$container.addEventListener('click', function() {
|
|
10467
|
+
if (_this._open) _this.hide();
|
|
10468
|
+
else _this.show();
|
|
10469
|
+
});
|
|
10470
|
+
document.body.addEventListener('click', function(e) {
|
|
10471
|
+
if (!_this.$container.contains(e.target)) {
|
|
10472
|
+
_this.hide();
|
|
10473
|
+
}
|
|
10474
|
+
});
|
|
10475
|
+
}
|
|
10476
|
+
var _proto = DatePicker.prototype;
|
|
10477
|
+
_proto._init = function _init() {
|
|
10478
|
+
var _this = this;
|
|
10479
|
+
// 因为挂载在行内,需要父标签设置 position: relative;
|
|
10480
|
+
this.$container.style.cssText += ";position: relative;";
|
|
10481
|
+
this.$container.classList.add("datepicker-inline-" + this.options.place);
|
|
10482
|
+
AppendJS.loadScriptsBatch([
|
|
10483
|
+
"" + this.options.staticPath + "/rec/jquery.min.js",
|
|
10484
|
+
"" + this.options.staticPath + "/rec/datepicker.min.css"
|
|
10485
|
+
]).then(function() {
|
|
10486
|
+
AppendJS.loadScriptsBatch([
|
|
10487
|
+
"" + _this.options.staticPath + "/rec/datepicker.js"
|
|
10488
|
+
]).then(function() {
|
|
10489
|
+
AppendJS.loadScriptsBatch([
|
|
10490
|
+
"" + _this.options.staticPath + "/rec/datepicker.zh-CN.js",
|
|
10491
|
+
"" + _this.options.staticPath + "/rec/datepicker.en-US.js"
|
|
10492
|
+
]).then(function() {
|
|
10493
|
+
window.$(_this.$container).datepicker({
|
|
10494
|
+
date: _this.options.current,
|
|
10495
|
+
language: _this.options.language,
|
|
10496
|
+
endDate: _this.options.maxDate,
|
|
10497
|
+
inline: true
|
|
10498
|
+
});
|
|
10499
|
+
_this.hide();
|
|
10500
|
+
window.$(_this.$container).on('pick.datepicker', function(e) {
|
|
10501
|
+
var _this__date, _this__date1, _this__date2, _this__date3, _this__date4, _this__date5;
|
|
10502
|
+
if (e.view === 'year' && ((_this__date = _this._date) == null ? void 0 : _this__date.getFullYear()) !== e.date.getFullYear()) {
|
|
10503
|
+
_this.options.onYearChange == null ? void 0 : _this.options.onYearChange.call(_this.options, e.date);
|
|
10504
|
+
} else if (e.view === 'month' && (((_this__date1 = _this._date) == null ? void 0 : _this__date1.getMonth()) !== e.date.getMonth() || ((_this__date2 = _this._date) == null ? void 0 : _this__date2.getFullYear()) !== e.date.getFullYear())) {
|
|
10505
|
+
_this.options.onMonthChange == null ? void 0 : _this.options.onMonthChange.call(_this.options, e.date);
|
|
10506
|
+
} else if ([
|
|
10507
|
+
'day',
|
|
10508
|
+
'pick'
|
|
10509
|
+
].includes(e.view || e.type) && (((_this__date3 = _this._date) == null ? void 0 : _this__date3.getDate()) !== e.date.getDate() || ((_this__date4 = _this._date) == null ? void 0 : _this__date4.getMonth()) !== e.date.getMonth() || ((_this__date5 = _this._date) == null ? void 0 : _this__date5.getFullYear()) !== e.date.getFullYear())) {
|
|
10510
|
+
if (_this._change) {
|
|
10511
|
+
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, e.date);
|
|
10512
|
+
}
|
|
10513
|
+
_this._date = new Date(e.date.getTime());
|
|
10514
|
+
}
|
|
10515
|
+
if (e.view === 'day') _this.hide();
|
|
10516
|
+
_this._change = true;
|
|
10517
|
+
});
|
|
10518
|
+
});
|
|
10519
|
+
});
|
|
10520
|
+
});
|
|
10521
|
+
};
|
|
10522
|
+
/**
|
|
10523
|
+
* 设置日期, change = true 时触发 onChange 事件
|
|
10524
|
+
*
|
|
10525
|
+
* @param date 设置的日期
|
|
10526
|
+
* @param change 是否触发 onChange 事件
|
|
10527
|
+
*/ _proto.setDate = function setDate(date, change) {
|
|
10528
|
+
if (change === void 0) change = true;
|
|
10529
|
+
var $datepicker = this.$container.querySelector(".datepicker-inline");
|
|
10530
|
+
if ($datepicker) {
|
|
10531
|
+
this._change = change;
|
|
10532
|
+
window.$(this.$container).datepicker('setDate', date);
|
|
10533
|
+
}
|
|
10534
|
+
};
|
|
10535
|
+
/**
|
|
10536
|
+
* 隐藏面板, 会触发 onPanelChange 事件
|
|
10537
|
+
*/ _proto.hide = function hide() {
|
|
10538
|
+
var $datepicker = this.$container.querySelector(".datepicker-inline");
|
|
10539
|
+
if ($datepicker) {
|
|
10540
|
+
if (this._open) {
|
|
10541
|
+
this._open = false;
|
|
10542
|
+
this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, false, this._date);
|
|
10543
|
+
}
|
|
10544
|
+
$datepicker.classList.add('datepicker-hide');
|
|
10545
|
+
}
|
|
10546
|
+
};
|
|
10547
|
+
/**
|
|
10548
|
+
* 显示面板, 会触发 onPanelChange 事件
|
|
10549
|
+
*/ _proto.show = function show() {
|
|
10550
|
+
var $datepicker = this.$container.querySelector(".datepicker-inline");
|
|
10551
|
+
if ($datepicker) {
|
|
10552
|
+
var _window_$_datepicker, _window_$;
|
|
10553
|
+
if (!this._open) {
|
|
10554
|
+
this._open = true;
|
|
10555
|
+
this.options.onPanelChange == null ? void 0 : this.options.onPanelChange.call(this.options, true, this._date);
|
|
10556
|
+
}
|
|
10557
|
+
if (this._date) this.setDate(this._date, false);
|
|
10558
|
+
(_window_$_datepicker = (_window_$ = window.$(this.$container)).datepicker) == null ? void 0 : _window_$_datepicker.call(_window_$, 'showView');
|
|
10559
|
+
if (this.options.place === 'bottom-left') {
|
|
10560
|
+
$datepicker.style.cssText += "top: " + (this.$container.clientHeight + 10) + "px; bottom: auto; right: auto; left: 0px";
|
|
10561
|
+
} else {
|
|
10562
|
+
$datepicker.style.cssText += "bottom: " + (this.$container.clientHeight + 10) + "px; top: auto";
|
|
10563
|
+
}
|
|
10564
|
+
$datepicker.classList.remove('datepicker-hide');
|
|
10565
|
+
}
|
|
10566
|
+
};
|
|
10567
|
+
/**
|
|
10568
|
+
* 销毁
|
|
10569
|
+
*/ _proto.destroy = function destroy() {
|
|
10570
|
+
this.hide();
|
|
10571
|
+
this._date = undefined;
|
|
10572
|
+
window.$(this.$container).datepicker('destroy');
|
|
10573
|
+
// AppendJS.remove([
|
|
10574
|
+
// `${this.options.staticPath}/rec/jquery.min.js`,
|
|
10575
|
+
// `${this.options.staticPath}/rec/datepicker.min.css`,
|
|
10576
|
+
// `${this.options.staticPath}/rec/datepicker.js`,
|
|
10577
|
+
// `${this.options.staticPath}/rec/datepicker.zh-CN.js`,
|
|
10578
|
+
// `${this.options.staticPath}/rec/datepicker.en-US.js`,
|
|
10579
|
+
// ]);
|
|
10580
|
+
};
|
|
10581
|
+
_create_class(DatePicker, [
|
|
10582
|
+
{
|
|
10583
|
+
key: "date",
|
|
10584
|
+
get: /**
|
|
10585
|
+
* 获取日期
|
|
10586
|
+
*/ function get() {
|
|
10587
|
+
return this._date;
|
|
10588
|
+
}
|
|
10589
|
+
}
|
|
10590
|
+
]);
|
|
10591
|
+
return DatePicker;
|
|
10592
|
+
}();
|
|
10593
|
+
|
|
10594
|
+
dist$2 = DatePicker;
|
|
10368
10595
|
return dist$2;
|
|
10369
10596
|
}
|
|
10370
10597
|
|
|
10371
10598
|
var distExports$1 = requireDist$2();
|
|
10599
|
+
var DatePickerUtil = /*@__PURE__*/getDefaultExportFromCjs(distExports$1);
|
|
10600
|
+
|
|
10601
|
+
/**
|
|
10602
|
+
* @description 时间操作
|
|
10603
|
+
*/ var DateTime = /*#__PURE__*/ function() {
|
|
10604
|
+
function DateTime() {}
|
|
10605
|
+
/**
|
|
10606
|
+
* @description 时间格式化
|
|
10607
|
+
* @param {Date | number | string} date
|
|
10608
|
+
* @param {string} formatType 格式 'YYYY-MM-DD hh:mm:ss' 或 'YYYYMMDDhhmmss' 或 'YYYY/MM/DD hh:mm:ss' 或 'hh:mm:ss' 或 'YYYYMMDDThhmmssZ'
|
|
10609
|
+
* @param {number} timeZone 时区偏移量 默认 0
|
|
10610
|
+
*/ DateTime.formate = function formate(date, formatType, timeZone) {
|
|
10611
|
+
if (timeZone === void 0) timeZone = 0;
|
|
10612
|
+
var dateTime = date;
|
|
10613
|
+
if (typeof date === 'string') {
|
|
10614
|
+
dateTime = DateTime.strToDate(date);
|
|
10615
|
+
} else if (typeof date === 'number') {
|
|
10616
|
+
dateTime = new Date(date);
|
|
10617
|
+
}
|
|
10618
|
+
dateTime = new Date(dateTime.getTime() - timeZone * 3600 * 1000);
|
|
10619
|
+
var year = dateTime.getFullYear();
|
|
10620
|
+
var month = String(dateTime.getMonth() + 1).padStart(2, '0');
|
|
10621
|
+
var day = String(dateTime.getDate()).padStart(2, '0');
|
|
10622
|
+
var hours = String(dateTime.getHours()).padStart(2, '0');
|
|
10623
|
+
var minutes = String(dateTime.getMinutes()).padStart(2, '0');
|
|
10624
|
+
var seconds = String(dateTime.getSeconds()).padStart(2, '0');
|
|
10625
|
+
switch(formatType){
|
|
10626
|
+
case 'YYYY-MM-DD hh:mm:ss':
|
|
10627
|
+
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
|
|
10628
|
+
case 'YYYYMMDDhhmmss':
|
|
10629
|
+
return "" + year + month + day + hours + minutes + seconds;
|
|
10630
|
+
case 'YYYY/MM/DD hh:mm:ss':
|
|
10631
|
+
return year + "/" + month + "/" + day + " " + hours + ":" + minutes + ":" + seconds;
|
|
10632
|
+
case 'YYYYMMDDThhmmssZ':
|
|
10633
|
+
return "" + year + month + day + "T" + hours + minutes + seconds + "Z";
|
|
10634
|
+
case 'YYYY/MM/DD':
|
|
10635
|
+
return year + "/" + month + "/" + day;
|
|
10636
|
+
case 'YYYYMMDD':
|
|
10637
|
+
return "" + year + month + day;
|
|
10638
|
+
case 'YYYY-MM-DD':
|
|
10639
|
+
return year + "-" + month + "-" + day;
|
|
10640
|
+
case 'YYYY':
|
|
10641
|
+
return "" + year;
|
|
10642
|
+
case 'MM':
|
|
10643
|
+
return "" + month;
|
|
10644
|
+
case 'DD':
|
|
10645
|
+
return "" + day;
|
|
10646
|
+
case 'hh:mm:ss':
|
|
10647
|
+
return hours + ":" + minutes + ":" + seconds;
|
|
10648
|
+
case 'hh':
|
|
10649
|
+
return "" + hours;
|
|
10650
|
+
case 'mm':
|
|
10651
|
+
return "" + minutes;
|
|
10652
|
+
case 'ss':
|
|
10653
|
+
return "" + seconds;
|
|
10654
|
+
default:
|
|
10655
|
+
throw new Error('Unsupported format type');
|
|
10656
|
+
}
|
|
10657
|
+
};
|
|
10658
|
+
/**
|
|
10659
|
+
* @description 对比两个时间的差值
|
|
10660
|
+
* @param {Date | string | number} date1
|
|
10661
|
+
* @param {Date | string | number} date2
|
|
10662
|
+
* @param {"year" | "month" | "day" | "hour" | "minute" | "second"} diffType
|
|
10663
|
+
*/ DateTime.diff = function diff(date1, date2, diffType) {
|
|
10664
|
+
/** @type {Date} */ var dateTime1 = date1;
|
|
10665
|
+
if (typeof date1 === 'string') {
|
|
10666
|
+
dateTime1 = DateTime.strToDate(date1);
|
|
10667
|
+
} else if (typeof date1 === 'number') {
|
|
10668
|
+
dateTime1 = new Date(date1);
|
|
10669
|
+
}
|
|
10670
|
+
/** @type {Date} */ var dateTime2 = date2;
|
|
10671
|
+
if (typeof date2 === 'string') {
|
|
10672
|
+
dateTime1 = DateTime.strToDate(date2);
|
|
10673
|
+
} else if (typeof date2 === 'number') {
|
|
10674
|
+
dateTime1 = new Date(date2);
|
|
10675
|
+
}
|
|
10676
|
+
var diffSecond = dateTime1.getTime() - dateTime2.getTime();
|
|
10677
|
+
// diff
|
|
10678
|
+
switch(diffType){
|
|
10679
|
+
case 'year':
|
|
10680
|
+
return dateTime1.getFullYear() - dateTime2.getFullYear();
|
|
10681
|
+
case 'month':
|
|
10682
|
+
// 计算总月份差
|
|
10683
|
+
// eslint-disable-next-line no-case-declarations
|
|
10684
|
+
var months = (dateTime1.getFullYear() - dateTime2.getFullYear()) * 12 + (dateTime1.getMonth() - dateTime2.getMonth());
|
|
10685
|
+
// 如果结束日的日期小于开始日的日期,则减去一个月
|
|
10686
|
+
if (dateTime1.getDate() < dateTime2.getDate()) {
|
|
10687
|
+
months--;
|
|
10688
|
+
}
|
|
10689
|
+
return months;
|
|
10690
|
+
case 'day':
|
|
10691
|
+
return diffSecond / 60 / 60 / 24;
|
|
10692
|
+
case 'hour':
|
|
10693
|
+
return diffSecond / 60 / 60;
|
|
10694
|
+
case 'minute':
|
|
10695
|
+
return diffSecond / 60;
|
|
10696
|
+
case 'second':
|
|
10697
|
+
return diffSecond;
|
|
10698
|
+
default:
|
|
10699
|
+
throw new Error('Unsupported diff type');
|
|
10700
|
+
}
|
|
10701
|
+
};
|
|
10702
|
+
DateTime.now = function now() {
|
|
10703
|
+
return Date.now();
|
|
10704
|
+
};
|
|
10705
|
+
/**
|
|
10706
|
+
*
|
|
10707
|
+
* @param {string} str 日期, 2025-04-10 10:10:10 或 2025/04/10 10:10:10 或 20250410101010 或 20250410T101010Z 或 秒 或 毫秒
|
|
10708
|
+
* @example
|
|
10709
|
+
* DateTime.strToDate("2025/04/10 10:10:10") // Date
|
|
10710
|
+
* DateTime.strToDate("2025-04-10 10:10:10") // Date
|
|
10711
|
+
* DateTime.strToDate("20250410101010") // Date
|
|
10712
|
+
* DateTime.strToDate("20250410T101010Z") // Date
|
|
10713
|
+
*/ DateTime.strToDate = function strToDate(str) {
|
|
10714
|
+
var time = (str + '').replace(/-/gi, '').replace(/:/gi, '').replace(/\//gi, '').replace(/ /gi, '').replace(/T|Z/gi, '');
|
|
10715
|
+
// 兼容
|
|
10716
|
+
if ((str + '').length === 10) {
|
|
10717
|
+
// 时间戳 秒
|
|
10718
|
+
return new Date(+str);
|
|
10719
|
+
} else if ((str + '').length === 13) {
|
|
10720
|
+
// 时间戳 毫秒
|
|
10721
|
+
return new Date(+str);
|
|
10722
|
+
}
|
|
10723
|
+
var year = time.slice(0, 4);
|
|
10724
|
+
var month = time.slice(4, 6);
|
|
10725
|
+
var day = time.slice(6, 8);
|
|
10726
|
+
var hour = time.slice(8, 10);
|
|
10727
|
+
var minute = time.slice(10, 12);
|
|
10728
|
+
var second = time.slice(12, 14);
|
|
10729
|
+
return new Date(year + '/' + month + '/' + day + ' ' + hour + ':' + minute + ':' + second);
|
|
10730
|
+
};
|
|
10731
|
+
/**
|
|
10732
|
+
* @description 补充十位
|
|
10733
|
+
* @param {number} num
|
|
10734
|
+
* @returns {string}
|
|
10735
|
+
* @example
|
|
10736
|
+
* DateTime.padStart(1) // "01"
|
|
10737
|
+
* DateTime.padStart(33) // "33"
|
|
10738
|
+
*/ DateTime.padStart = function padStart(num) {
|
|
10739
|
+
if (num < 10) {
|
|
10740
|
+
return '0' + num;
|
|
10741
|
+
} else {
|
|
10742
|
+
return num + '';
|
|
10743
|
+
}
|
|
10744
|
+
};
|
|
10745
|
+
return DateTime;
|
|
10746
|
+
}();
|
|
10372
10747
|
|
|
10373
10748
|
function _extends$5() {
|
|
10374
10749
|
_extends$5 = Object.assign || function(target) {
|
|
@@ -10412,29 +10787,20 @@
|
|
|
10412
10787
|
function DatePickerControl(options) {
|
|
10413
10788
|
var _this;
|
|
10414
10789
|
var _this_options_props_urlInfo_searchParams, _this_options_props_urlInfo, _this_options_props;
|
|
10415
|
-
_this = Control.call(this, _extends$5({
|
|
10416
|
-
maxDate: new Date()
|
|
10417
|
-
}, options, {
|
|
10790
|
+
_this = Control.call(this, _extends$5({}, options, {
|
|
10418
10791
|
tagName: 'span',
|
|
10419
10792
|
controlType: 'button',
|
|
10420
10793
|
classNameSuffix: 'date'
|
|
10421
10794
|
})) || this;
|
|
10422
10795
|
_this.options = options;
|
|
10423
|
-
_this._value =
|
|
10796
|
+
_this._value = DateTime.formate(((_this_options_props = _this.options.props) == null ? void 0 : (_this_options_props_urlInfo = _this_options_props.urlInfo) == null ? void 0 : (_this_options_props_urlInfo_searchParams = _this_options_props_urlInfo.searchParams) == null ? void 0 : _this_options_props_urlInfo_searchParams.begin) || new Date(), 'YYYY-MM-DD');
|
|
10424
10797
|
_this._render();
|
|
10425
|
-
// 日期上的点
|
|
10426
|
-
_this.on(EVENTS.control.dateMonthChange, function(dates) {
|
|
10427
|
-
var _this_datePicker_updateBadges, _this_datePicker;
|
|
10428
|
-
(_this_datePicker = _this.datePicker) == null ? void 0 : (_this_datePicker_updateBadges = _this_datePicker.updateBadges) == null ? void 0 : _this_datePicker_updateBadges.call(_this_datePicker, dates);
|
|
10429
|
-
});
|
|
10430
10798
|
return _this;
|
|
10431
10799
|
}
|
|
10432
10800
|
var _proto = DatePickerControl.prototype;
|
|
10433
10801
|
_proto._render = function _render() {
|
|
10434
10802
|
var _this = this;
|
|
10435
|
-
|
|
10436
|
-
var isMobile1 = distExports$6.isMobile();
|
|
10437
|
-
if (isMobile1) {
|
|
10803
|
+
if (distExports$6.isMobile()) {
|
|
10438
10804
|
var _this_locale;
|
|
10439
10805
|
this.$container.innerHTML = '\n <span class="' + PREFIX_CLASS + '-mobile-date-filter" title="' + (((_this_locale = this.locale) == null ? void 0 : _this_locale.BTN_CALENDAR) || '') + '">\n <span class="' + PREFIX_CLASS + '-mobile-date-filter-value">' + this._getDateStr() + "</span>\n " + IconComponents.filter() + "\n <span>";
|
|
10440
10806
|
} else {
|
|
@@ -10443,26 +10809,15 @@
|
|
|
10443
10809
|
title: (_this_locale1 = this.locale) == null ? void 0 : _this_locale1.BTN_CALENDAR
|
|
10444
10810
|
});
|
|
10445
10811
|
}
|
|
10446
|
-
this.
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
return _this.$container;
|
|
10450
|
-
},
|
|
10451
|
-
mode: 'date',
|
|
10452
|
-
offset: [
|
|
10453
|
-
0,
|
|
10454
|
-
-10
|
|
10455
|
-
],
|
|
10456
|
-
badges: ((_this_options_props = this.options.props) == null ? void 0 : _this_options_props.recMonth) || [],
|
|
10457
|
-
language: this.options.language === 'zh' ? 'zh' : 'en',
|
|
10812
|
+
this.dataPickerUtil = new DatePickerUtil(this.$container, {
|
|
10813
|
+
staticPath: this.options.staticPath,
|
|
10814
|
+
language: this.options.language === 'zh' ? 'zh-CN' : 'en-US',
|
|
10458
10815
|
current: new Date(this._value + ' 00:00:00'),
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
if (date && _this._value !== distExports$6.DateTime.format(date, 'YYYY-MM-DD') && isMobile1) {
|
|
10465
|
-
_this._value = distExports$6.DateTime.format(date, 'YYYY-MM-DD');
|
|
10816
|
+
maxDate: this.options.maxDate || new Date(),
|
|
10817
|
+
place: distExports$6.isMobile() ? 'bottom-left' : 'top-right',
|
|
10818
|
+
onChange: function(date) {
|
|
10819
|
+
if (date && _this._value !== DateTime.formate(date, 'YYYY-MM-DD')) {
|
|
10820
|
+
_this._value = DateTime.formate(date, 'YYYY-MM-DD');
|
|
10466
10821
|
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, date);
|
|
10467
10822
|
_this.emit(EVENTS.control.dateChange, date);
|
|
10468
10823
|
if (date && _this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
@@ -10470,16 +10825,9 @@
|
|
|
10470
10825
|
}
|
|
10471
10826
|
}
|
|
10472
10827
|
},
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, date);
|
|
10477
|
-
_this.emit(EVENTS.control.dateChange, date);
|
|
10478
|
-
}
|
|
10479
|
-
},
|
|
10480
|
-
onOpenChange: function(open) {
|
|
10481
|
-
_this.options.onPanelChange == null ? void 0 : _this.options.onPanelChange.call(_this.options, open, _this.datePicker.current);
|
|
10482
|
-
_this.emit(EVENTS.control.datePanelOpenChange, open, _this.datePicker.current);
|
|
10828
|
+
onPanelChange: function(open, date) {
|
|
10829
|
+
_this.options.onPanelChange == null ? void 0 : _this.options.onPanelChange.call(_this.options, open, date);
|
|
10830
|
+
_this.emit(EVENTS.control.datePanelOpenChange, open, date);
|
|
10483
10831
|
}
|
|
10484
10832
|
});
|
|
10485
10833
|
};
|
|
@@ -10489,27 +10837,28 @@
|
|
|
10489
10837
|
* @param change 是否触发 onChange 事件
|
|
10490
10838
|
*/ _proto.setDate = function setDate(date, change) {
|
|
10491
10839
|
if (change === void 0) change = true;
|
|
10492
|
-
var
|
|
10493
|
-
(
|
|
10494
|
-
if (date && !change && this._value !==
|
|
10495
|
-
this._value =
|
|
10840
|
+
var _this_dataPickerUtil;
|
|
10841
|
+
(_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.setDate(date, change);
|
|
10842
|
+
if (date && !change && this._value !== DateTime.formate(date, 'YYYY-MM-DD')) {
|
|
10843
|
+
this._value = DateTime.formate(date, 'YYYY-MM-DD');
|
|
10496
10844
|
if (date && this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
10497
10845
|
this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value").innerHTML = this._getDateStr();
|
|
10498
10846
|
}
|
|
10499
10847
|
}
|
|
10500
10848
|
};
|
|
10501
10849
|
_proto.reset = function reset() {
|
|
10502
|
-
|
|
10850
|
+
var _this_dataPickerUtil;
|
|
10851
|
+
(_this_dataPickerUtil = this.dataPickerUtil) == null ? void 0 : _this_dataPickerUtil.hide();
|
|
10503
10852
|
Control.prototype.reset.call(this);
|
|
10504
10853
|
};
|
|
10505
10854
|
/**
|
|
10506
10855
|
* 销毁控件
|
|
10507
10856
|
* @override
|
|
10508
10857
|
*/ _proto.destroy = function destroy() {
|
|
10509
|
-
if (this.
|
|
10510
|
-
this.
|
|
10858
|
+
if (this.dataPickerUtil) {
|
|
10859
|
+
this.dataPickerUtil.destroy();
|
|
10511
10860
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10512
|
-
this.
|
|
10861
|
+
this.dataPickerUtil = null;
|
|
10513
10862
|
}
|
|
10514
10863
|
Control.prototype.destroy.call(this);
|
|
10515
10864
|
};
|
|
@@ -10519,7 +10868,6 @@
|
|
|
10519
10868
|
};
|
|
10520
10869
|
/**
|
|
10521
10870
|
* 点击 Control 会触发
|
|
10522
|
-
* @overload super._onControlClick(e: Event)
|
|
10523
10871
|
*/ _proto._onControlClick = function _onControlClick(e) {
|
|
10524
10872
|
Control.prototype._onControlClick.call(this, e);
|
|
10525
10873
|
};
|
|
@@ -12065,7 +12413,8 @@
|
|
|
12065
12413
|
return container;
|
|
12066
12414
|
},
|
|
12067
12415
|
language: theme.options.language,
|
|
12068
|
-
locales: theme.i18n.translations
|
|
12416
|
+
locales: theme.i18n.translations,
|
|
12417
|
+
staticPath: theme.options.staticPath
|
|
12069
12418
|
}, ((_theme_options = theme.options) == null ? void 0 : _theme_options["dateOptions"]) || {}, {
|
|
12070
12419
|
props: props
|
|
12071
12420
|
}));
|
|
@@ -12364,20 +12713,7 @@
|
|
|
12364
12713
|
*/ _this._footerMoreControl = null, /** 头部控件 @since 0.0.1 @private */ _this._header = null, /** 低部控件 @since 0.0.1 @private */ _this._footer = null, /** 回放底部时间轴 @since 0.0.1 @private */ _this._recFooter = null, /**
|
|
12365
12714
|
* 移动端扩展容器, 扩展的控件渲染在指定容器以外, 仅只用端适用, 为了可以放置大的控件和方便开发接入
|
|
12366
12715
|
* @private
|
|
12367
|
-
*/ _this._mobileExtend = null, /** @since 0.0.1 @private */ _this._interactiveResult = null, /** @since 0.0.1 @private */ _this._themeData = null, _this._fullscreen = null, _this.zoomUtil = null, /** 清除屏幕旋转 */ _this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ _this._cleanUpResizeObserver = null, /** 容器的宽 */ _this._width = 0, /** 容器的高 */ _this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ _this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ _this._orientationAngle = 0, /** 是否播放中 @private */ _this._playing = false, /** 加载中 */ _this._loading = false, /** 音量 */ _this._volume = 0, /** 静音 */ _this._muted = false, /** 电子放大倍数 @private */ _this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ _this._zooming = false, /** 录制中 @private */ _this._recording = false, /** 对讲中 @private */ _this._talking = false, /** 倍速 @private */ _this._speed = 1, /** 自定清晰度 @private */ _this._videoLevelAuto = false, /** 清晰度列表 */ _this.videoLevelList = [], /** 回放片段列表 */ _this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ _this._resizeOverflowTimer = null,
|
|
12368
|
-
// * 记录回放的月份
|
|
12369
|
-
// *
|
|
12370
|
-
// * key: {序列号}_{通道号}_{rec | cloud | cloudRecord} 比如:BC7799091_1_rec BC7799091_1_cloud BC7799091_1_cloudRecord
|
|
12371
|
-
// *
|
|
12372
|
-
// * value: 月份列表 比如 ["2025-12-01", "2025-12-02"]
|
|
12373
|
-
// * @private
|
|
12374
|
-
// */
|
|
12375
|
-
// _recMonthObj: Record<string, string[]> = {};
|
|
12376
|
-
/**
|
|
12377
|
-
* 录像回放的月份列表 @private
|
|
12378
|
-
*/ _this.recMonth = [
|
|
12379
|
-
'2025-12-01'
|
|
12380
|
-
], /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null, _this.scaleMode = 0;
|
|
12716
|
+
*/ _this._mobileExtend = null, /** @since 0.0.1 @private */ _this._interactiveResult = null, /** @since 0.0.1 @private */ _this._themeData = null, _this._fullscreen = null, _this.zoomUtil = null, /** 清除屏幕旋转 */ _this._cleanupOrientation = null, /** resizeObserver 监听销毁 */ _this._cleanUpResizeObserver = null, /** 容器的宽 */ _this._width = 0, /** 容器的高 */ _this._height = 0, /** 当前容器的全屏状态 true: 全屏, false: 非全屏 */ _this._isCurrentFullscreen = false, /** 屏幕旋转角度 0 | 90 | 180 | 270 */ _this._orientationAngle = 0, /** 是否播放中 @private */ _this._playing = false, /** 加载中 */ _this._loading = false, /** 音量 */ _this._volume = 0, /** 静音 */ _this._muted = false, /** 电子放大倍数 @private */ _this._zoom = 1, /** 放大中 true: 可缩放状态,false: 禁止缩放状态(不能缩放) @private */ _this._zooming = false, /** 录制中 @private */ _this._recording = false, /** 对讲中 @private */ _this._talking = false, /** 倍速 @private */ _this._speed = 1, /** 自定清晰度 @private */ _this._videoLevelAuto = false, /** 清晰度列表 */ _this.videoLevelList = [], /** 回放片段列表 */ _this.recordList = [], /** 窗口尺寸变化时,设置窗口超出隐藏,防止出现滚动条 */ _this._resizeOverflowTimer = null, /** 清理 header/footer 动画 定时器 @private */ _this._onPauseTimingFunc = null, /** 销毁标识 @readonly */ _this.destroyed = false, /** 播放地址信息 */ _this.urlInfo = null, _this.scaleMode = 0;
|
|
12381
12717
|
_this._initOptions(options);
|
|
12382
12718
|
if (_this.options.type === 'ezopen') {
|
|
12383
12719
|
var _this_urlInfo_searchParams, _this_urlInfo;
|
|
@@ -12387,7 +12723,7 @@
|
|
|
12387
12723
|
}
|
|
12388
12724
|
if (_this.urlInfo.type === 'rec') {
|
|
12389
12725
|
var _this_urlInfo_searchParams1, _this_urlInfo1, _this_urlInfo_searchParams2, _this_urlInfo2;
|
|
12390
|
-
_this._seekDate = ((_this_urlInfo1 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams1 = _this_urlInfo1.searchParams) == null ? void 0 : _this_urlInfo_searchParams1.begin) ?
|
|
12726
|
+
_this._seekDate = ((_this_urlInfo1 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams1 = _this_urlInfo1.searchParams) == null ? void 0 : _this_urlInfo_searchParams1.begin) ? DateTime.strToDate((_this_urlInfo2 = _this.urlInfo) == null ? void 0 : (_this_urlInfo_searchParams2 = _this_urlInfo2.searchParams) == null ? void 0 : _this_urlInfo_searchParams2.begin) : DateTime.strToDate(DateTime.formate(new Date(), 'YYYY/MM/DD') + ' 00:00:00');
|
|
12391
12727
|
}
|
|
12392
12728
|
}
|
|
12393
12729
|
_this._getRecType(_this.options.url);
|
|
@@ -13599,7 +13935,7 @@
|
|
|
13599
13935
|
zh: zh,
|
|
13600
13936
|
en: en
|
|
13601
13937
|
};
|
|
13602
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.
|
|
13938
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.2-beta.1';
|
|
13603
13939
|
|
|
13604
13940
|
// 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
|
|
13605
13941
|
|