@ezuikit/player-theme 2.0.1-beta.1 → 2.0.1-beta.2
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 +4 -7
- package/dist/index.mjs +4 -7
- package/dist/index.umd.js +91 -2432
- package/dist/style.css +1 -1
- package/dist/style.js +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @ezuikit/player-theme v2.0.1-beta.
|
|
2
|
+
* @ezuikit/player-theme v2.0.1-beta.2
|
|
3
3
|
* Copyright (c) 2025-12-03 Ezviz-OpenBiz
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -1479,12 +1479,12 @@
|
|
|
1479
1479
|
* LICENSE file in the root directory of this source tree.
|
|
1480
1480
|
*/
|
|
1481
1481
|
|
|
1482
|
-
var dist$
|
|
1483
|
-
var hasRequiredDist$
|
|
1482
|
+
var dist$a;
|
|
1483
|
+
var hasRequiredDist$a;
|
|
1484
1484
|
|
|
1485
|
-
function requireDist$
|
|
1486
|
-
if (hasRequiredDist$
|
|
1487
|
-
hasRequiredDist$
|
|
1485
|
+
function requireDist$a () {
|
|
1486
|
+
if (hasRequiredDist$a) return dist$a;
|
|
1487
|
+
hasRequiredDist$a = 1;
|
|
1488
1488
|
|
|
1489
1489
|
function _array_like_to_array(arr, len) {
|
|
1490
1490
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -2042,11 +2042,11 @@
|
|
|
2042
2042
|
*/
|
|
2043
2043
|
Picker.VERSION = '1.1.5';
|
|
2044
2044
|
|
|
2045
|
-
dist$
|
|
2046
|
-
return dist$
|
|
2045
|
+
dist$a = Picker;
|
|
2046
|
+
return dist$a;
|
|
2047
2047
|
}
|
|
2048
2048
|
|
|
2049
|
-
var distExports$8 = requireDist$
|
|
2049
|
+
var distExports$8 = requireDist$a();
|
|
2050
2050
|
var Picker = /*@__PURE__*/getDefaultExportFromCjs(distExports$8);
|
|
2051
2051
|
|
|
2052
2052
|
/*
|
|
@@ -2055,12 +2055,12 @@
|
|
|
2055
2055
|
* Released under the MIT License.
|
|
2056
2056
|
*/
|
|
2057
2057
|
|
|
2058
|
-
var dist$
|
|
2059
|
-
var hasRequiredDist$
|
|
2058
|
+
var dist$9;
|
|
2059
|
+
var hasRequiredDist$9;
|
|
2060
2060
|
|
|
2061
|
-
function requireDist$
|
|
2062
|
-
if (hasRequiredDist$
|
|
2063
|
-
hasRequiredDist$
|
|
2061
|
+
function requireDist$9 () {
|
|
2062
|
+
if (hasRequiredDist$9) return dist$9;
|
|
2063
|
+
hasRequiredDist$9 = 1;
|
|
2064
2064
|
|
|
2065
2065
|
const DOCUMENT_NODE_TYPE = 9;
|
|
2066
2066
|
/**
|
|
@@ -2173,19 +2173,19 @@
|
|
|
2173
2173
|
};
|
|
2174
2174
|
}
|
|
2175
2175
|
|
|
2176
|
-
dist$
|
|
2177
|
-
return dist$
|
|
2176
|
+
dist$9 = delegate;
|
|
2177
|
+
return dist$9;
|
|
2178
2178
|
}
|
|
2179
2179
|
|
|
2180
|
-
var distExports$7 = requireDist$
|
|
2180
|
+
var distExports$7 = requireDist$9();
|
|
2181
2181
|
var delegate$2 = /*@__PURE__*/getDefaultExportFromCjs(distExports$7);
|
|
2182
2182
|
|
|
2183
|
-
var cjs
|
|
2184
|
-
var hasRequiredCjs
|
|
2183
|
+
var cjs;
|
|
2184
|
+
var hasRequiredCjs;
|
|
2185
2185
|
|
|
2186
|
-
function requireCjs
|
|
2187
|
-
if (hasRequiredCjs
|
|
2188
|
-
hasRequiredCjs
|
|
2186
|
+
function requireCjs () {
|
|
2187
|
+
if (hasRequiredCjs) return cjs;
|
|
2188
|
+
hasRequiredCjs = 1;
|
|
2189
2189
|
|
|
2190
2190
|
var isMergeableObject = function isMergeableObject(value) {
|
|
2191
2191
|
return isNonNullObject(value)
|
|
@@ -2317,14 +2317,14 @@
|
|
|
2317
2317
|
|
|
2318
2318
|
var deepmerge_1 = deepmerge;
|
|
2319
2319
|
|
|
2320
|
-
cjs
|
|
2321
|
-
return cjs
|
|
2320
|
+
cjs = deepmerge_1;
|
|
2321
|
+
return cjs;
|
|
2322
2322
|
}
|
|
2323
2323
|
|
|
2324
|
-
var cjsExports = requireCjs
|
|
2324
|
+
var cjsExports = requireCjs();
|
|
2325
2325
|
var deepmerge = /*@__PURE__*/getDefaultExportFromCjs(cjsExports);
|
|
2326
2326
|
|
|
2327
|
-
var dist$
|
|
2327
|
+
var dist$8 = {};
|
|
2328
2328
|
|
|
2329
2329
|
/*
|
|
2330
2330
|
* @ezuikit/utils-tools v2.0.1
|
|
@@ -2333,16 +2333,16 @@
|
|
|
2333
2333
|
* Released under the MIT License.
|
|
2334
2334
|
*/
|
|
2335
2335
|
|
|
2336
|
-
var hasRequiredDist$
|
|
2336
|
+
var hasRequiredDist$8;
|
|
2337
2337
|
|
|
2338
|
-
function requireDist$
|
|
2339
|
-
if (hasRequiredDist$
|
|
2340
|
-
hasRequiredDist$
|
|
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};function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _instanceof(left,right){return null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right}function _create_for_of_iterator_helper_loose(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return "Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(o,minLen):void 0}}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:true}:{done:false,value:o[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var DateTime=function(){function DateTime(){}return DateTime.fillZero=function(num,len){return void 0===len&&(len=2),num.toString().padStart(len,"0")},DateTime.format=function(input,format){var date;if(_instanceof(input,Date))date=input;else {if("number"!=typeof input&&"string"!=typeof input)throw new Error("Invalid date input");date=DateTime.toDate(input+"");}for(var _step,result=format,_iterator=_create_for_of_iterator_helper_loose([[/(yyyy|YYYY)/g,function(){return DateTime.fillZero(date.getFullYear(),4)}],[/(yy|YY)/g,function(){return DateTime.fillZero(date.getFullYear()%100,2)}],[/(MM)/g,function(){return DateTime.fillZero(date.getMonth()+1,2)}],[/(M)/g,function(){return (date.getMonth()+1).toString()}],[/(dd|DD)/g,function(){return DateTime.fillZero(date.getDate(),2)}],[/(d|D)/g,function(){return date.getDate().toString()}],[/(HH|hh)/g,function(){return DateTime.fillZero(date.getHours(),2)}],[/(H|h)/g,function(){return date.getHours().toString()}],[/(mm)/g,function(){return DateTime.fillZero(date.getMinutes(),2)}],[/(m)/g,function(){return date.getMinutes().toString()}],[/(ss|SS)/g,function(){return DateTime.fillZero(date.getSeconds(),2)}],[/(s|S)/g,function(){return date.getSeconds().toString()}],[/(fff)/g,function(){return DateTime.fillZero(date.getMilliseconds(),3)}]]);!(_step=_iterator()).done;){var _step_value=_step.value,regexp=_step_value[0],fn=_step_value[1];result=result.replace(regexp,fn);}return result},DateTime.toDate=function(str){if(_instanceof(str,Date))return str;str=(str+"").trim().replace(/\/|\./gi,"-"),/^\d{4}$/.test(str)&&(str+="-01"),/^\d{4}-\d{2}$/.test(str)&&(str+="-01");try{return /^\d{4}-\d{2}-\d{2}$/.test(str)?new Date(str+"T00:00:00"):/^\d{8}$/.test(str)?(str+="",new Date(str.slice(0,4)+"-"+str.slice(4,6)+"-"+str.slice(6,8)+"T00:00:00")):/^\d{14}$/.test(str)?(str+="",new Date(str.slice(0,4)+"-"+str.slice(4,6)+"-"+str.slice(6,8)+"T"+str.slice(8,10)+":"+str.slice(10,12)+":"+str.slice(12,14))):/^\d{13}$/.test(str)?new Date(Number(str)):/^\d{10}$/.test(str)?new Date(1e3*Number(str)):new Date(str)}catch(error){throw new Error("Invalid date string")}},DateTime.diff=function(date1,date2,type){ void 0===type&&(type="second");var d1=DateTime.toDate(date1),d2=DateTime.toDate(date2);return "second"===type?Math.floor((d1.getTime()-d2.getTime())/1e3):"minute"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60):"hour"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60):"day"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60/24):Math.abs(d1.getTime()-d2.getTime())},DateTime}();dist$
|
|
2342
|
-
return dist$
|
|
2338
|
+
function requireDist$8 () {
|
|
2339
|
+
if (hasRequiredDist$8) return dist$8;
|
|
2340
|
+
hasRequiredDist$8 = 1;
|
|
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};function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _instanceof(left,right){return null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right}function _create_for_of_iterator_helper_loose(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return "Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(o,minLen):void 0}}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:true}:{done:false,value:o[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var DateTime=function(){function DateTime(){}return DateTime.fillZero=function(num,len){return void 0===len&&(len=2),num.toString().padStart(len,"0")},DateTime.format=function(input,format){var date;if(_instanceof(input,Date))date=input;else {if("number"!=typeof input&&"string"!=typeof input)throw new Error("Invalid date input");date=DateTime.toDate(input+"");}for(var _step,result=format,_iterator=_create_for_of_iterator_helper_loose([[/(yyyy|YYYY)/g,function(){return DateTime.fillZero(date.getFullYear(),4)}],[/(yy|YY)/g,function(){return DateTime.fillZero(date.getFullYear()%100,2)}],[/(MM)/g,function(){return DateTime.fillZero(date.getMonth()+1,2)}],[/(M)/g,function(){return (date.getMonth()+1).toString()}],[/(dd|DD)/g,function(){return DateTime.fillZero(date.getDate(),2)}],[/(d|D)/g,function(){return date.getDate().toString()}],[/(HH|hh)/g,function(){return DateTime.fillZero(date.getHours(),2)}],[/(H|h)/g,function(){return date.getHours().toString()}],[/(mm)/g,function(){return DateTime.fillZero(date.getMinutes(),2)}],[/(m)/g,function(){return date.getMinutes().toString()}],[/(ss|SS)/g,function(){return DateTime.fillZero(date.getSeconds(),2)}],[/(s|S)/g,function(){return date.getSeconds().toString()}],[/(fff)/g,function(){return DateTime.fillZero(date.getMilliseconds(),3)}]]);!(_step=_iterator()).done;){var _step_value=_step.value,regexp=_step_value[0],fn=_step_value[1];result=result.replace(regexp,fn);}return result},DateTime.toDate=function(str){if(_instanceof(str,Date))return str;str=(str+"").trim().replace(/\/|\./gi,"-"),/^\d{4}$/.test(str)&&(str+="-01"),/^\d{4}-\d{2}$/.test(str)&&(str+="-01");try{return /^\d{4}-\d{2}-\d{2}$/.test(str)?new Date(str+"T00:00:00"):/^\d{8}$/.test(str)?(str+="",new Date(str.slice(0,4)+"-"+str.slice(4,6)+"-"+str.slice(6,8)+"T00:00:00")):/^\d{14}$/.test(str)?(str+="",new Date(str.slice(0,4)+"-"+str.slice(4,6)+"-"+str.slice(6,8)+"T"+str.slice(8,10)+":"+str.slice(10,12)+":"+str.slice(12,14))):/^\d{13}$/.test(str)?new Date(Number(str)):/^\d{10}$/.test(str)?new Date(1e3*Number(str)):new Date(str)}catch(error){throw new Error("Invalid date string")}},DateTime.diff=function(date1,date2,type){ void 0===type&&(type="second");var d1=DateTime.toDate(date1),d2=DateTime.toDate(date2);return "second"===type?Math.floor((d1.getTime()-d2.getTime())/1e3):"minute"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60):"hour"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60):"day"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60/24):Math.abs(d1.getTime()-d2.getTime())},DateTime}();dist$8.DateTime=DateTime,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};
|
|
2342
|
+
return dist$8;
|
|
2343
2343
|
}
|
|
2344
2344
|
|
|
2345
|
-
var distExports$6 = requireDist$
|
|
2345
|
+
var distExports$6 = requireDist$8();
|
|
2346
2346
|
|
|
2347
2347
|
/**
|
|
2348
2348
|
* 节流函数
|
|
@@ -4056,15 +4056,15 @@
|
|
|
4056
4056
|
return Rec;
|
|
4057
4057
|
}(Control);
|
|
4058
4058
|
|
|
4059
|
-
var dist$
|
|
4059
|
+
var dist$7 = {exports: {}};
|
|
4060
4060
|
|
|
4061
|
-
var hasRequiredDist$
|
|
4061
|
+
var hasRequiredDist$7;
|
|
4062
4062
|
|
|
4063
|
-
function requireDist$
|
|
4064
|
-
if (hasRequiredDist$
|
|
4065
|
-
hasRequiredDist$
|
|
4063
|
+
function requireDist$7 () {
|
|
4064
|
+
if (hasRequiredDist$7) return dist$7.exports;
|
|
4065
|
+
hasRequiredDist$7 = 1;
|
|
4066
4066
|
|
|
4067
|
-
var deepmerge = requireCjs
|
|
4067
|
+
var deepmerge = requireCjs();
|
|
4068
4068
|
|
|
4069
4069
|
function _create_class(Constructor, protoProps, staticProps) {
|
|
4070
4070
|
return protoProps && function(target, props) {
|
|
@@ -4134,19 +4134,19 @@
|
|
|
4134
4134
|
} ]), I18n;
|
|
4135
4135
|
}();
|
|
4136
4136
|
|
|
4137
|
-
I18n.VERSION = "2.0.0", dist$
|
|
4138
|
-
return dist$
|
|
4137
|
+
I18n.VERSION = "2.0.0", dist$7.exports = I18n;
|
|
4138
|
+
return dist$7.exports;
|
|
4139
4139
|
}
|
|
4140
4140
|
|
|
4141
|
-
var distExports$5 = requireDist$
|
|
4141
|
+
var distExports$5 = requireDist$7();
|
|
4142
4142
|
var I18n = /*@__PURE__*/getDefaultExportFromCjs(distExports$5);
|
|
4143
4143
|
|
|
4144
|
-
var dist$
|
|
4145
|
-
var hasRequiredDist$
|
|
4144
|
+
var dist$6;
|
|
4145
|
+
var hasRequiredDist$6;
|
|
4146
4146
|
|
|
4147
|
-
function requireDist$
|
|
4148
|
-
if (hasRequiredDist$
|
|
4149
|
-
hasRequiredDist$
|
|
4147
|
+
function requireDist$6 () {
|
|
4148
|
+
if (hasRequiredDist$6) return dist$6;
|
|
4149
|
+
hasRequiredDist$6 = 1;
|
|
4150
4150
|
|
|
4151
4151
|
var _$LoggerStyle$_ = {
|
|
4152
4152
|
info: "",
|
|
@@ -4211,7 +4211,7 @@
|
|
|
4211
4211
|
|
|
4212
4212
|
var __$list$__ = [ "info", "log", "warn", "error" ];
|
|
4213
4213
|
|
|
4214
|
-
dist$
|
|
4214
|
+
dist$6 = function(options) {
|
|
4215
4215
|
var logger = new LoggerCls(options);
|
|
4216
4216
|
return new Proxy(logger, {
|
|
4217
4217
|
get: function(target, prop) {
|
|
@@ -4230,10 +4230,10 @@
|
|
|
4230
4230
|
}
|
|
4231
4231
|
});
|
|
4232
4232
|
};
|
|
4233
|
-
return dist$
|
|
4233
|
+
return dist$6;
|
|
4234
4234
|
}
|
|
4235
4235
|
|
|
4236
|
-
var distExports$4 = requireDist$
|
|
4236
|
+
var distExports$4 = requireDist$6();
|
|
4237
4237
|
var Logger = /*@__PURE__*/getDefaultExportFromCjs(distExports$4);
|
|
4238
4238
|
|
|
4239
4239
|
var zh = {
|
|
@@ -6246,12 +6246,12 @@
|
|
|
6246
6246
|
* Released under the MIT License.
|
|
6247
6247
|
*/
|
|
6248
6248
|
|
|
6249
|
-
var dist$
|
|
6250
|
-
var hasRequiredDist$
|
|
6249
|
+
var dist$5;
|
|
6250
|
+
var hasRequiredDist$5;
|
|
6251
6251
|
|
|
6252
|
-
function requireDist$
|
|
6253
|
-
if (hasRequiredDist$
|
|
6254
|
-
hasRequiredDist$
|
|
6252
|
+
function requireDist$5 () {
|
|
6253
|
+
if (hasRequiredDist$5) return dist$5;
|
|
6254
|
+
hasRequiredDist$5 = 1;
|
|
6255
6255
|
|
|
6256
6256
|
/**
|
|
6257
6257
|
* Zoom position
|
|
@@ -6958,11 +6958,11 @@
|
|
|
6958
6958
|
}();
|
|
6959
6959
|
Zoom.VERSION = '0.0.2';
|
|
6960
6960
|
|
|
6961
|
-
dist$
|
|
6962
|
-
return dist$
|
|
6961
|
+
dist$5 = Zoom;
|
|
6962
|
+
return dist$5;
|
|
6963
6963
|
}
|
|
6964
6964
|
|
|
6965
|
-
var distExports$3 = requireDist$
|
|
6965
|
+
var distExports$3 = requireDist$5();
|
|
6966
6966
|
var Zoom = /*@__PURE__*/getDefaultExportFromCjs(distExports$3);
|
|
6967
6967
|
|
|
6968
6968
|
function _extends$h() {
|
|
@@ -8038,9 +8038,9 @@
|
|
|
8038
8038
|
return CapturePicture;
|
|
8039
8039
|
}(Control);
|
|
8040
8040
|
|
|
8041
|
-
var dist$
|
|
8041
|
+
var dist$4 = {};
|
|
8042
8042
|
|
|
8043
|
-
var dist$
|
|
8043
|
+
var dist$3 = {};
|
|
8044
8044
|
|
|
8045
8045
|
/*
|
|
8046
8046
|
* @ezuikit/utils-tools v1.1.1-beta.1
|
|
@@ -8049,13 +8049,13 @@
|
|
|
8049
8049
|
* Released under the MIT License.
|
|
8050
8050
|
*/
|
|
8051
8051
|
|
|
8052
|
-
var hasRequiredDist$
|
|
8052
|
+
var hasRequiredDist$4;
|
|
8053
8053
|
|
|
8054
|
-
function requireDist$
|
|
8055
|
-
if (hasRequiredDist$
|
|
8056
|
-
hasRequiredDist$
|
|
8057
|
-
const getQuery=url=>{const query=url.split("?")[1],obj={};if(query){const vars=query.split("&");for(let i=0;i<vars.length;i++){const pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1]);}}return obj};function parseEzopenUrl(url){const obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){const 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;const 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 {}}const codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};dist$
|
|
8058
|
-
return dist$
|
|
8054
|
+
function requireDist$4 () {
|
|
8055
|
+
if (hasRequiredDist$4) return dist$3;
|
|
8056
|
+
hasRequiredDist$4 = 1;
|
|
8057
|
+
const getQuery=url=>{const query=url.split("?")[1],obj={};if(query){const vars=query.split("&");for(let i=0;i<vars.length;i++){const pair=vars[i].split("=");obj[pair[0]]=decodeURIComponent(pair[1]);}}return obj};function parseEzopenUrl(url){const obj={};if(/^ezopen:\/\//.test(url)){if(url.includes("@")){const 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;const 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 {}}const codec={h264:1,h265:2,h266:4,vp8:8,vp9:16,av1:32};dist$3.addVc=function(url){const vc=((arguments.length>1&&void 0!==arguments[1]?arguments[1]:["h264"])||["h264"]).reduce(((acc,key)=>(key=key.toLowerCase(),acc+(codec[key]||0))),0),host=url.split("?")[0];let query=url.split("?")[1];return query=(query||"").split("&").filter((item=>!/^vc=\d?/.test(item))).join("&"),query+=`${query?"&":""}vc=${vc}`,host+"?"+query},dist$3.getQuery=getQuery,dist$3.getStaticPath=function(path){let base=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const 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$3.isHttp=function(url){return /^http[s]?:\/\//.test(url)},dist$3.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(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$3.parseEzopenUrl=parseEzopenUrl,dist$3.pick=function(obj,keys){return Object.entries(obj).reduce(((acc,_ref)=>{let[key,value]=_ref;return keys.includes(key)&&(acc[key]=value),acc}),{})},dist$3.switchEzopenUrl=function(url,options){let{type:type,recType:recType,search:search,definition:definition,channelNo:channelNo,deviceSerial:deviceSerial,validateCode:validateCode}=null!=options?options:{};const obj=parseEzopenUrl(url);if(search){const ns=Object.assign({},obj.searchParams,getQuery("?"+search.replace("?","")));search=Object.entries(ns).reduce(((acc,_ref)=>{let[key,value]=_ref;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}`};
|
|
8058
|
+
return dist$3;
|
|
8059
8059
|
}
|
|
8060
8060
|
|
|
8061
8061
|
/*
|
|
@@ -8064,14 +8064,14 @@
|
|
|
8064
8064
|
* Released under the MIT License.
|
|
8065
8065
|
*/
|
|
8066
8066
|
|
|
8067
|
-
var hasRequiredDist$
|
|
8067
|
+
var hasRequiredDist$3;
|
|
8068
8068
|
|
|
8069
|
-
function requireDist$
|
|
8070
|
-
if (hasRequiredDist$
|
|
8071
|
-
hasRequiredDist$
|
|
8069
|
+
function requireDist$3 () {
|
|
8070
|
+
if (hasRequiredDist$3) return dist$4;
|
|
8071
|
+
hasRequiredDist$3 = 1;
|
|
8072
8072
|
|
|
8073
|
-
var deepmerge = requireCjs
|
|
8074
|
-
var utilsTools = requireDist$
|
|
8073
|
+
var deepmerge = requireCjs();
|
|
8074
|
+
var utilsTools = requireDist$4();
|
|
8075
8075
|
|
|
8076
8076
|
var en_US = {
|
|
8077
8077
|
GET_PTZ_STATUS: 'Get current PTZ status',
|
|
@@ -8991,13 +8991,13 @@
|
|
|
8991
8991
|
return Ptz;
|
|
8992
8992
|
}(BasePtz);
|
|
8993
8993
|
|
|
8994
|
-
dist$
|
|
8995
|
-
dist$
|
|
8996
|
-
dist$
|
|
8997
|
-
return dist$
|
|
8994
|
+
dist$4.BasePtz = BasePtz;
|
|
8995
|
+
dist$4.MobilePtz = MobilePtz;
|
|
8996
|
+
dist$4.Ptz = Ptz;
|
|
8997
|
+
return dist$4;
|
|
8998
8998
|
}
|
|
8999
8999
|
|
|
9000
|
-
var distExports$2 = requireDist$
|
|
9000
|
+
var distExports$2 = requireDist$3();
|
|
9001
9001
|
|
|
9002
9002
|
function _defineProperties$4(target, props) {
|
|
9003
9003
|
for(var i = 0; i < props.length; i++){
|
|
@@ -10208,7 +10208,7 @@
|
|
|
10208
10208
|
return Speed;
|
|
10209
10209
|
}(Select);
|
|
10210
10210
|
|
|
10211
|
-
var dist$
|
|
10211
|
+
var dist$2 = {};
|
|
10212
10212
|
|
|
10213
10213
|
var delegate$1 = {exports: {}};
|
|
10214
10214
|
|
|
@@ -10346,2360 +10346,22 @@
|
|
|
10346
10346
|
return delegate$1.exports;
|
|
10347
10347
|
}
|
|
10348
10348
|
|
|
10349
|
-
var dist$3 = {};
|
|
10350
|
-
|
|
10351
10349
|
/*
|
|
10352
|
-
* @ezuikit/
|
|
10353
|
-
*
|
|
10354
|
-
* Copyright (c) 2025-12-02 Ezviz-OpenBiz
|
|
10350
|
+
* @ezuikit/control-date-picker v1.0.0-beta.6
|
|
10351
|
+
* Copyright (c) 2025-12-03 Ezviz-OpenBiz
|
|
10355
10352
|
* Released under the MIT License.
|
|
10356
10353
|
*/
|
|
10357
10354
|
|
|
10358
|
-
var hasRequiredDist$
|
|
10355
|
+
var hasRequiredDist$2;
|
|
10359
10356
|
|
|
10360
|
-
function requireDist$
|
|
10361
|
-
if (hasRequiredDist$
|
|
10362
|
-
hasRequiredDist$
|
|
10363
|
-
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};function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _instanceof(left,right){return null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right}function _create_for_of_iterator_helper_loose(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return (it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return "Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(o,minLen):void 0}}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:true}:{done:false,value:o[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var DateTime=function(){function DateTime(){}return DateTime.fillZero=function(num,len){return void 0===len&&(len=2),num.toString().padStart(len,"0")},DateTime.format=function(input,format){var date;if(_instanceof(input,Date))date=input;else {if("number"!=typeof input&&"string"!=typeof input)throw new Error("Invalid date input");date=DateTime.toDate(input+"");}for(var _step,result=format,_iterator=_create_for_of_iterator_helper_loose([[/(yyyy|YYYY)/g,function(){return DateTime.fillZero(date.getFullYear(),4)}],[/(yy|YY)/g,function(){return DateTime.fillZero(date.getFullYear()%100,2)}],[/(MM)/g,function(){return DateTime.fillZero(date.getMonth()+1,2)}],[/(M)/g,function(){return (date.getMonth()+1).toString()}],[/(dd|DD)/g,function(){return DateTime.fillZero(date.getDate(),2)}],[/(d|D)/g,function(){return date.getDate().toString()}],[/(HH|hh)/g,function(){return DateTime.fillZero(date.getHours(),2)}],[/(H|h)/g,function(){return date.getHours().toString()}],[/(mm)/g,function(){return DateTime.fillZero(date.getMinutes(),2)}],[/(m)/g,function(){return date.getMinutes().toString()}],[/(ss|SS)/g,function(){return DateTime.fillZero(date.getSeconds(),2)}],[/(s|S)/g,function(){return date.getSeconds().toString()}],[/(fff)/g,function(){return DateTime.fillZero(date.getMilliseconds(),3)}]]);!(_step=_iterator()).done;){var _step_value=_step.value,regexp=_step_value[0],fn=_step_value[1];result=result.replace(regexp,fn);}return result},DateTime.toDate=function(str){if(_instanceof(str,Date))return str;str=(str+"").trim().replace(/\/|\./gi,"-"),/^\d{4}$/.test(str)&&(str+="-01"),/^\d{4}-\d{2}$/.test(str)&&(str+="-01");try{return /^\d{4}-\d{2}-\d{2}$/.test(str)?new Date(str+"T00:00:00"):/^\d{8}$/.test(str)?(str+="",new Date(str.slice(0,4)+"-"+str.slice(4,6)+"-"+str.slice(6,8)+"T00:00:00")):/^\d{14}$/.test(str)?(str+="",new Date(str.slice(0,4)+"-"+str.slice(4,6)+"-"+str.slice(6,8)+"T"+str.slice(8,10)+":"+str.slice(10,12)+":"+str.slice(12,14))):/^\d{13}$/.test(str)?new Date(Number(str)):/^\d{10}$/.test(str)?new Date(1e3*Number(str)):new Date(str)}catch(error){throw new Error("Invalid date string")}},DateTime.diff=function(date1,date2,type){ void 0===type&&(type="second");var d1=DateTime.toDate(date1),d2=DateTime.toDate(date2);return "second"===type?Math.floor((d1.getTime()-d2.getTime())/1e3):"minute"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60):"hour"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60):"day"===type?Math.floor((d1.getTime()-d2.getTime())/1e3/60/60/24):Math.abs(d1.getTime()-d2.getTime())},DateTime}();dist$3.DateTime=DateTime,dist$3.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$3.getQuery=getQuery,dist$3.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$3.isHttp=function(url){return /^http[s]?:\/\//.test(url)},dist$3.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$3.parseEzopenUrl=parseEzopenUrl,dist$3.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$3.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};
|
|
10364
|
-
return dist$
|
|
10357
|
+
function requireDist$2 () {
|
|
10358
|
+
if (hasRequiredDist$2) return dist$2;
|
|
10359
|
+
hasRequiredDist$2 = 1;
|
|
10360
|
+
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);}),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);}));},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,"/"));null==_this.options.onCell||_this.options.onCell.call(_this.options,date,_this._renderCurrent),event.delegateTarget.classList.contains("edate-disabled")||(_this.setCurrent(date),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&¤t||utilsTools.DateTime.format(current,"YYYY-MM")!==utilsTools.DateTime.format(this._current,"YYYY-MM"))&&(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("title"),date=utilsTools.DateTime.toDate(month+utilsTools.DateTime.format(_this._renderCurrent,"-DDTHH:mm:ss"));null==_this.options.onCell||_this.options.onCell.call(_this.options,date,utilsTools.DateTime.format(date,"YYYY-MM")),e.delegateTarget.classList.contains("edate-disabled")||_this.setCurrent(date);});},_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)+'" 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){var _this__current;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);_year.getFullYear()!==(null==(_this__current=this._current)?void 0:_this__current.getFullYear())&&(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),null==_this.options.onCell||_this.options.onCell.call(_this.options,newDate),e.delegateTarget.classList.contains("edate-disabled")||(_this._setCurrent(newDate),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()),open||(null==this.options.onClose||this.options.onClose.call(this.options,this.current,this._currentMode),this._setCurrent(this.current,false));},_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),_this._minModeIndex<1&&(_this._removeCurrentTypeClass(),_this._currentMode="date",_this._switchMode());},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),_this._minModeIndex<2&&(_this._removeCurrentTypeClass(),_this._currentMode="month",_this._switchMode());}})));},_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){var index=_DATEPICKER_MODE_ARRAY.indexOf(this._currentMode);showHeaderOk||this._minModeIndex!==index||this._hide(),null==this.options.onChange||this.options.onChange.call(this.options,date,this._currentMode),this._setCurrent(date);},_proto._onCell=function(date){null==this.options.onCell||this.options.onCell.call(this.options,date,this._currentMode);},_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;
|
|
10361
|
+
return dist$2;
|
|
10365
10362
|
}
|
|
10366
10363
|
|
|
10367
|
-
var
|
|
10368
|
-
var hasRequiredCjs;
|
|
10369
|
-
|
|
10370
|
-
function requireCjs () {
|
|
10371
|
-
if (hasRequiredCjs) return cjs;
|
|
10372
|
-
hasRequiredCjs = 1;
|
|
10373
|
-
|
|
10374
|
-
var isMergeableObject = function isMergeableObject(value) {
|
|
10375
|
-
return isNonNullObject(value)
|
|
10376
|
-
&& !isSpecial(value)
|
|
10377
|
-
};
|
|
10378
|
-
|
|
10379
|
-
function isNonNullObject(value) {
|
|
10380
|
-
return !!value && typeof value === 'object'
|
|
10381
|
-
}
|
|
10382
|
-
|
|
10383
|
-
function isSpecial(value) {
|
|
10384
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
10385
|
-
|
|
10386
|
-
return stringValue === '[object RegExp]'
|
|
10387
|
-
|| stringValue === '[object Date]'
|
|
10388
|
-
|| isReactElement(value)
|
|
10389
|
-
}
|
|
10390
|
-
|
|
10391
|
-
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
10392
|
-
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
10393
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
10394
|
-
|
|
10395
|
-
function isReactElement(value) {
|
|
10396
|
-
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
10397
|
-
}
|
|
10398
|
-
|
|
10399
|
-
function emptyTarget(val) {
|
|
10400
|
-
return Array.isArray(val) ? [] : {}
|
|
10401
|
-
}
|
|
10402
|
-
|
|
10403
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
10404
|
-
return (options.clone !== false && options.isMergeableObject(value))
|
|
10405
|
-
? deepmerge(emptyTarget(value), value, options)
|
|
10406
|
-
: value
|
|
10407
|
-
}
|
|
10408
|
-
|
|
10409
|
-
function defaultArrayMerge(target, source, options) {
|
|
10410
|
-
return target.concat(source).map(function(element) {
|
|
10411
|
-
return cloneUnlessOtherwiseSpecified(element, options)
|
|
10412
|
-
})
|
|
10413
|
-
}
|
|
10414
|
-
|
|
10415
|
-
function getMergeFunction(key, options) {
|
|
10416
|
-
if (!options.customMerge) {
|
|
10417
|
-
return deepmerge
|
|
10418
|
-
}
|
|
10419
|
-
var customMerge = options.customMerge(key);
|
|
10420
|
-
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
10421
|
-
}
|
|
10422
|
-
|
|
10423
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
10424
|
-
return Object.getOwnPropertySymbols
|
|
10425
|
-
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
10426
|
-
return Object.propertyIsEnumerable.call(target, symbol)
|
|
10427
|
-
})
|
|
10428
|
-
: []
|
|
10429
|
-
}
|
|
10430
|
-
|
|
10431
|
-
function getKeys(target) {
|
|
10432
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
10433
|
-
}
|
|
10434
|
-
|
|
10435
|
-
function propertyIsOnObject(object, property) {
|
|
10436
|
-
try {
|
|
10437
|
-
return property in object
|
|
10438
|
-
} catch(_) {
|
|
10439
|
-
return false
|
|
10440
|
-
}
|
|
10441
|
-
}
|
|
10442
|
-
|
|
10443
|
-
// Protects from prototype poisoning and unexpected merging up the prototype chain.
|
|
10444
|
-
function propertyIsUnsafe(target, key) {
|
|
10445
|
-
return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
|
|
10446
|
-
&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
|
|
10447
|
-
&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
|
|
10448
|
-
}
|
|
10449
|
-
|
|
10450
|
-
function mergeObject(target, source, options) {
|
|
10451
|
-
var destination = {};
|
|
10452
|
-
if (options.isMergeableObject(target)) {
|
|
10453
|
-
getKeys(target).forEach(function(key) {
|
|
10454
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
10455
|
-
});
|
|
10456
|
-
}
|
|
10457
|
-
getKeys(source).forEach(function(key) {
|
|
10458
|
-
if (propertyIsUnsafe(target, key)) {
|
|
10459
|
-
return
|
|
10460
|
-
}
|
|
10461
|
-
|
|
10462
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
10463
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
10464
|
-
} else {
|
|
10465
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
10466
|
-
}
|
|
10467
|
-
});
|
|
10468
|
-
return destination
|
|
10469
|
-
}
|
|
10470
|
-
|
|
10471
|
-
function deepmerge(target, source, options) {
|
|
10472
|
-
options = options || {};
|
|
10473
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
10474
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
10475
|
-
// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
|
|
10476
|
-
// implementations can use it. The caller may not replace it.
|
|
10477
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
10478
|
-
|
|
10479
|
-
var sourceIsArray = Array.isArray(source);
|
|
10480
|
-
var targetIsArray = Array.isArray(target);
|
|
10481
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
10482
|
-
|
|
10483
|
-
if (!sourceAndTargetTypesMatch) {
|
|
10484
|
-
return cloneUnlessOtherwiseSpecified(source, options)
|
|
10485
|
-
} else if (sourceIsArray) {
|
|
10486
|
-
return options.arrayMerge(target, source, options)
|
|
10487
|
-
} else {
|
|
10488
|
-
return mergeObject(target, source, options)
|
|
10489
|
-
}
|
|
10490
|
-
}
|
|
10491
|
-
|
|
10492
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
10493
|
-
if (!Array.isArray(array)) {
|
|
10494
|
-
throw new Error('first argument should be an array')
|
|
10495
|
-
}
|
|
10496
|
-
|
|
10497
|
-
return array.reduce(function(prev, next) {
|
|
10498
|
-
return deepmerge(prev, next, options)
|
|
10499
|
-
}, {})
|
|
10500
|
-
};
|
|
10501
|
-
|
|
10502
|
-
var deepmerge_1 = deepmerge;
|
|
10503
|
-
|
|
10504
|
-
cjs = deepmerge_1;
|
|
10505
|
-
return cjs;
|
|
10506
|
-
}
|
|
10507
|
-
|
|
10508
|
-
/**
|
|
10509
|
-
* picker component for js framework, support mobile and pc
|
|
10510
|
-
*
|
|
10511
|
-
* @skax/picker v1.1.5
|
|
10512
|
-
* Copyright (c) 2025-11-15 ShineShao <xiaoshaoqq@gmail.com>
|
|
10513
|
-
*
|
|
10514
|
-
* This source code is licensed under the MIT license found in the
|
|
10515
|
-
* LICENSE file in the root directory of this source tree.
|
|
10516
|
-
*/
|
|
10517
|
-
|
|
10518
|
-
var dist$2;
|
|
10519
|
-
var hasRequiredDist$3;
|
|
10520
|
-
|
|
10521
|
-
function requireDist$3 () {
|
|
10522
|
-
if (hasRequiredDist$3) return dist$2;
|
|
10523
|
-
hasRequiredDist$3 = 1;
|
|
10524
|
-
|
|
10525
|
-
function _array_like_to_array(arr, len) {
|
|
10526
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
10527
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
10528
|
-
return arr2;
|
|
10529
|
-
}
|
|
10530
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
10531
|
-
if (!o) return;
|
|
10532
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
10533
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
10534
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
10535
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
10536
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
10537
|
-
}
|
|
10538
|
-
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
10539
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
10540
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
10541
|
-
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike) {
|
|
10542
|
-
if (it) o = it;
|
|
10543
|
-
var i = 0;
|
|
10544
|
-
return function () {
|
|
10545
|
-
if (i >= o.length) {
|
|
10546
|
-
return {
|
|
10547
|
-
done: true
|
|
10548
|
-
};
|
|
10549
|
-
}
|
|
10550
|
-
return {
|
|
10551
|
-
done: false,
|
|
10552
|
-
value: o[i++]
|
|
10553
|
-
};
|
|
10554
|
-
};
|
|
10555
|
-
}
|
|
10556
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10557
|
-
}
|
|
10558
|
-
/**
|
|
10559
|
-
* PickerProvider 单例类
|
|
10560
|
-
*/
|
|
10561
|
-
var PickerProvider = /*#__PURE__*/function () {
|
|
10562
|
-
|
|
10563
|
-
function PickerProvider() {
|
|
10564
|
-
this.pickers = [];
|
|
10565
|
-
}
|
|
10566
|
-
var _proto = PickerProvider.prototype;
|
|
10567
|
-
/**
|
|
10568
|
-
* 添加picker
|
|
10569
|
-
* @param picker Picker 实例
|
|
10570
|
-
*/
|
|
10571
|
-
_proto.add = function add(picker) {
|
|
10572
|
-
this.pickers.push(picker);
|
|
10573
|
-
};
|
|
10574
|
-
/**
|
|
10575
|
-
* 移除picker
|
|
10576
|
-
* @param picker Picker 实例
|
|
10577
|
-
*/
|
|
10578
|
-
_proto.remove = function remove(picker) {
|
|
10579
|
-
var index = this.pickers.indexOf(picker);
|
|
10580
|
-
if (index > -1) {
|
|
10581
|
-
this.pickers.splice(index, 1);
|
|
10582
|
-
} else {
|
|
10583
|
-
console.warn('Picker not found in the provider.');
|
|
10584
|
-
}
|
|
10585
|
-
};
|
|
10586
|
-
/**
|
|
10587
|
-
* 关闭其他picker
|
|
10588
|
-
* @param e 事件
|
|
10589
|
-
*/
|
|
10590
|
-
_proto.closeOther = function closeOther(e) {
|
|
10591
|
-
for (var _iterator = _create_for_of_iterator_helper_loose(this.pickers), _step; !(_step = _iterator()).done;) {
|
|
10592
|
-
var p = _step.value;
|
|
10593
|
-
var _p_$container_contains, _p_$container, _p_$wrapperContent_contains, _p_$wrapperContent;
|
|
10594
|
-
if (p && !(e.target === p.$container || ((_p_$container = p.$container) == null ? void 0 : (_p_$container_contains = _p_$container.contains) == null ? void 0 : _p_$container_contains.call(_p_$container, e.target)) || e.target === p.$wrapperContent || ((_p_$wrapperContent = p.$wrapperContent) == null ? void 0 : (_p_$wrapperContent_contains = _p_$wrapperContent.contains) == null ? void 0 : _p_$wrapperContent_contains.call(_p_$wrapperContent, e.target)))) {
|
|
10595
|
-
p.open = false;
|
|
10596
|
-
}
|
|
10597
|
-
}
|
|
10598
|
-
};
|
|
10599
|
-
/**
|
|
10600
|
-
* 获取单例实例
|
|
10601
|
-
* @returns Picker 实例
|
|
10602
|
-
*/
|
|
10603
|
-
PickerProvider.getInstance = function getInstance() {
|
|
10604
|
-
if (!PickerProvider.instance) {
|
|
10605
|
-
PickerProvider.instance = new PickerProvider();
|
|
10606
|
-
}
|
|
10607
|
-
return PickerProvider.instance;
|
|
10608
|
-
};
|
|
10609
|
-
return PickerProvider;
|
|
10610
|
-
}();
|
|
10611
|
-
var pickerProvider = PickerProvider.getInstance();
|
|
10612
|
-
|
|
10613
|
-
function _defineProperties(target, props) {
|
|
10614
|
-
for (var i = 0; i < props.length; i++) {
|
|
10615
|
-
var descriptor = props[i];
|
|
10616
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
10617
|
-
descriptor.configurable = true;
|
|
10618
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
10619
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
10620
|
-
}
|
|
10621
|
-
}
|
|
10622
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
10623
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
10624
|
-
return Constructor;
|
|
10625
|
-
}
|
|
10626
|
-
/**
|
|
10627
|
-
* picker 位置
|
|
10628
|
-
*
|
|
10629
|
-
* | top | tl | tr | bottom | bl | br |
|
|
10630
|
-
* |:--------:|:---------:|:---------:|:----------:|:----------:|:----------:|
|
|
10631
|
-
* | 顶部中间 | 顶部左侧 | 顶部右侧 | 底部中间 | 底部左侧 | 底部右侧 |
|
|
10632
|
-
*
|
|
10633
|
-
* @public
|
|
10634
|
-
*/
|
|
10635
|
-
var _$PICKER_PLACEMENT$_ = ['top', 'tl', 'tr', 'bottom', 'bl', 'br'];
|
|
10636
|
-
/**
|
|
10637
|
-
* 默认样式前缀
|
|
10638
|
-
*/
|
|
10639
|
-
var _$PICKER_PREFIX_CLS$_ = 'epicker';
|
|
10640
|
-
/**
|
|
10641
|
-
* Picker 默认值
|
|
10642
|
-
*/
|
|
10643
|
-
var __$PICKER_DEFAULT_OPTIONS$__ = {
|
|
10644
|
-
getPopupContainer: function () {
|
|
10645
|
-
return document.body;
|
|
10646
|
-
},
|
|
10647
|
-
wrapClassName: '',
|
|
10648
|
-
open: false,
|
|
10649
|
-
placement: 'br',
|
|
10650
|
-
offset: [0, 0],
|
|
10651
|
-
zIndex: 1000,
|
|
10652
|
-
content: '',
|
|
10653
|
-
trigger: 'click',
|
|
10654
|
-
mouseLeaveDelay: 0.1,
|
|
10655
|
-
mouseEnterDelay: 0.1,
|
|
10656
|
-
isMobile: false
|
|
10657
|
-
};
|
|
10658
|
-
/**
|
|
10659
|
-
* Picker 弹窗, 支持 PC 和移动端
|
|
10660
|
-
* @remarks
|
|
10661
|
-
* Picker 是一个通用的弹窗组件,可以用于日期选择器、时间选择器等场景。
|
|
10662
|
-
* 它提供了丰富的配置选项,可以自定义弹窗的样式、位置、触发方式等。
|
|
10663
|
-
*
|
|
10664
|
-
* @example
|
|
10665
|
-
* ```ts
|
|
10666
|
-
* import "@skax/picker/dist/style/css";
|
|
10667
|
-
* import Picker from '@skax/picker';
|
|
10668
|
-
* const picker = new Picker(document.getElementById('picker-container'),
|
|
10669
|
-
* {
|
|
10670
|
-
* placement: 'bottom',
|
|
10671
|
-
* content: '<div>选择内容</div>', // or () => '<div>选择内容</div>'
|
|
10672
|
-
* trigger: 'click',
|
|
10673
|
-
* isMobile: false,
|
|
10674
|
-
* });
|
|
10675
|
-
* picker.open = true; // 打开弹窗
|
|
10676
|
-
* picker.setPlacement('top'); // 设置弹窗位置
|
|
10677
|
-
* picker.innerHTML('<div>新内容</div>'); // 设置弹窗内容(会覆盖之前的内容)
|
|
10678
|
-
* picker.destroy(); // 销毁弹窗
|
|
10679
|
-
* ```
|
|
10680
|
-
*/
|
|
10681
|
-
var Picker = /*#__PURE__*/function () {
|
|
10682
|
-
|
|
10683
|
-
function Picker(container, options) {
|
|
10684
|
-
var _this__$popupContainer, _this__$popupContainer1;
|
|
10685
|
-
/** 是否打开 */
|
|
10686
|
-
this._open = false;
|
|
10687
|
-
this._OpenChange = false;
|
|
10688
|
-
this._animationTimer = null;
|
|
10689
|
-
this._disabled = false;
|
|
10690
|
-
this._timer = null;
|
|
10691
|
-
// prettier-ignore
|
|
10692
|
-
this._options = Object.assign({}, __$PICKER_DEFAULT_OPTIONS$__, options || {});
|
|
10693
|
-
// 移动端模式强制使用 click 触发
|
|
10694
|
-
if (this._options.isMobile) this._options.trigger = "click";
|
|
10695
|
-
pickerProvider.add(this);
|
|
10696
|
-
if (typeof container === "function") this.$container = container();else this.$container = container;
|
|
10697
|
-
this.$wrapperContent = document.createElement("div");
|
|
10698
|
-
this._initContentStyle();
|
|
10699
|
-
if (typeof this._options.getPopupContainer === "function") {
|
|
10700
|
-
this._$popupContainer = this._options.getPopupContainer();
|
|
10701
|
-
} else {
|
|
10702
|
-
this._$popupContainer = document.body;
|
|
10703
|
-
}
|
|
10704
|
-
if (["INPUT", "CANVAS", "VIDEO", "IMG"].includes((_this__$popupContainer = this._$popupContainer) == null ? void 0 : _this__$popupContainer.tagName)) {
|
|
10705
|
-
console.warn("popup container node does not support child elements, default body!");
|
|
10706
|
-
this._$popupContainer = document.body;
|
|
10707
|
-
}
|
|
10708
|
-
if (this._$popupContainer !== document.body) this._$popupContainer.style.position = "relative";
|
|
10709
|
-
(_this__$popupContainer1 = this._$popupContainer) == null ? void 0 : _this__$popupContainer1.appendChild(this.$wrapperContent);
|
|
10710
|
-
this._onContentClick = this._onContentClick.bind(this);
|
|
10711
|
-
this._onShow = this._onShow.bind(this);
|
|
10712
|
-
this._onWrapperShow = this._onWrapperShow.bind(this);
|
|
10713
|
-
this._onHide = this._onHide.bind(this);
|
|
10714
|
-
this._onDocumentClick = this._onDocumentClick.bind(this);
|
|
10715
|
-
this._eventListener();
|
|
10716
|
-
this.open = !!this._options.open;
|
|
10717
|
-
}
|
|
10718
|
-
var _proto = Picker.prototype;
|
|
10719
|
-
/**
|
|
10720
|
-
* 设置弹出位置(移动端不生效)
|
|
10721
|
-
* @param placement - 弹出位置
|
|
10722
|
-
* @example
|
|
10723
|
-
* ```ts
|
|
10724
|
-
* picker.setPlacement("top");
|
|
10725
|
-
* picker.setPlacement("tl");
|
|
10726
|
-
* picker.setPlacement("tr");
|
|
10727
|
-
* picker.setPlacement("bottom");
|
|
10728
|
-
* picker.setPlacement("bl");
|
|
10729
|
-
* picker.setPlacement("br");
|
|
10730
|
-
* ```
|
|
10731
|
-
*/
|
|
10732
|
-
_proto.setPlacement = function setPlacement(placement) {
|
|
10733
|
-
if (this._disabled) return;
|
|
10734
|
-
if (_$PICKER_PLACEMENT$_.includes(placement)) {
|
|
10735
|
-
this._options.placement = placement;
|
|
10736
|
-
} else {
|
|
10737
|
-
console.warn("" + placement + " is not a valid placement");
|
|
10738
|
-
}
|
|
10739
|
-
this._setPlacement();
|
|
10740
|
-
};
|
|
10741
|
-
/**
|
|
10742
|
-
* 销毁
|
|
10743
|
-
* @example
|
|
10744
|
-
* ```ts
|
|
10745
|
-
* picker.destroy();
|
|
10746
|
-
* ```
|
|
10747
|
-
*/
|
|
10748
|
-
_proto.destroy = function destroy() {
|
|
10749
|
-
this._animationTimerClear();
|
|
10750
|
-
this._removeHtml();
|
|
10751
|
-
pickerProvider.remove(this);
|
|
10752
|
-
// this._$popupContainer 的 position 样式不会被移除
|
|
10753
|
-
};
|
|
10754
|
-
/**
|
|
10755
|
-
* 设置内容(会覆盖之前内容)
|
|
10756
|
-
* @param html - html 字符串内容
|
|
10757
|
-
* @example
|
|
10758
|
-
* ```ts
|
|
10759
|
-
* picker.innerHTML('<div>内容</div>');
|
|
10760
|
-
* ```
|
|
10761
|
-
*/
|
|
10762
|
-
_proto.innerHTML = function innerHTML(html) {
|
|
10763
|
-
if (this.$body) {
|
|
10764
|
-
this.$body.innerHTML = html || '';
|
|
10765
|
-
this._setPlacement();
|
|
10766
|
-
}
|
|
10767
|
-
};
|
|
10768
|
-
// --------------------------------------------------------------------------
|
|
10769
|
-
// Private methods
|
|
10770
|
-
// --------------------------------------------------------------------------
|
|
10771
|
-
/**
|
|
10772
|
-
* picker 面板展开或关闭变化时触发
|
|
10773
|
-
* @param open - true: 展开, false:关闭
|
|
10774
|
-
*/
|
|
10775
|
-
_proto._onOpenChange = function _onOpenChange(open) {
|
|
10776
|
-
this._options.onOpenChange == null ? void 0 : this._options.onOpenChange.call(this._options, !!open);
|
|
10777
|
-
};
|
|
10778
|
-
/**
|
|
10779
|
-
* 移除动画定时器
|
|
10780
|
-
*/
|
|
10781
|
-
_proto._animationTimerClear = function _animationTimerClear() {
|
|
10782
|
-
if (this._animationTimer) {
|
|
10783
|
-
clearTimeout(this._animationTimer);
|
|
10784
|
-
this._animationTimer = null;
|
|
10785
|
-
}
|
|
10786
|
-
};
|
|
10787
|
-
/**
|
|
10788
|
-
* 移除html
|
|
10789
|
-
*/
|
|
10790
|
-
_proto._removeHtml = function _removeHtml() {
|
|
10791
|
-
var _this_$wrapperContent, _this_$container_removeEventListener, _this_$container, _this_$container_removeEventListener1, _this_$container1;
|
|
10792
|
-
(_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent.removeEventListener('click', this._onContentClick);
|
|
10793
|
-
(_this_$container = this.$container) == null ? void 0 : (_this_$container_removeEventListener = _this_$container.removeEventListener) == null ? void 0 : _this_$container_removeEventListener.call(_this_$container, 'click', this._onContentClick);
|
|
10794
|
-
if (this._options.trigger === 'click') (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_removeEventListener1 = _this_$container1.removeEventListener) == null ? void 0 : _this_$container_removeEventListener1.call(_this_$container1, 'click', this._onShow);
|
|
10795
|
-
if (this._options.trigger === 'hover') {
|
|
10796
|
-
var _this_$container_removeEventListener2, _this_$container2, _this_$container_removeEventListener3, _this_$container3, _this_$container_removeEventListener4, _this_$container4,
|
|
10797
|
-
// prettier-ignore
|
|
10798
|
-
_this_$wrapperContent1, _this_$wrapperContent2;
|
|
10799
|
-
(_this_$container2 = this.$container) == null ? void 0 : (_this_$container_removeEventListener2 = _this_$container2.removeEventListener) == null ? void 0 : _this_$container_removeEventListener2.call(_this_$container2, 'mouseenter', this._onShow);
|
|
10800
|
-
(_this_$container3 = this.$container) == null ? void 0 : (_this_$container_removeEventListener3 = _this_$container3.removeEventListener) == null ? void 0 : _this_$container_removeEventListener3.call(_this_$container3, 'mouseover', this._onShow);
|
|
10801
|
-
(_this_$container4 = this.$container) == null ? void 0 : (_this_$container_removeEventListener4 = _this_$container4.removeEventListener) == null ? void 0 : _this_$container_removeEventListener4.call(_this_$container4, 'mouseleave', this._onHide);
|
|
10802
|
-
(_this_$wrapperContent1 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent1.removeEventListener("mouseenter", this._onWrapperShow);
|
|
10803
|
-
(_this_$wrapperContent2 = this.$wrapperContent) == null ? void 0 : _this_$wrapperContent2.removeEventListener('mouseleave', this._onHide);
|
|
10804
|
-
}
|
|
10805
|
-
if (!this._options.isMobile) {
|
|
10806
|
-
window.removeEventListener('blur', this._onHide);
|
|
10807
|
-
document.removeEventListener('visibilitychange', this._onHide);
|
|
10808
|
-
window.removeEventListener('resize', this._onHide);
|
|
10809
|
-
document.removeEventListener('click', this._onDocumentClick);
|
|
10810
|
-
}
|
|
10811
|
-
if (this._$mask) {
|
|
10812
|
-
this._$mask.removeEventListener('click', this._onHide);
|
|
10813
|
-
this._$mask.remove();
|
|
10814
|
-
this._$mask = null;
|
|
10815
|
-
}
|
|
10816
|
-
if (this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
|
|
10817
|
-
if (this.$wrapperContent) {
|
|
10818
|
-
this.$wrapperContent.remove();
|
|
10819
|
-
this.$wrapperContent = null;
|
|
10820
|
-
}
|
|
10821
|
-
};
|
|
10822
|
-
/**
|
|
10823
|
-
* 现实位置
|
|
10824
|
-
*/
|
|
10825
|
-
_proto._setPlacement = function _setPlacement() {
|
|
10826
|
-
var _this_$container_getBoundingClientRect, _this_$container;
|
|
10827
|
-
if (!this._open || this._options.isMobile || !this.$container) return;
|
|
10828
|
-
var $containerRect = (_this_$container = this.$container) == null ? void 0 : (_this_$container_getBoundingClientRect = _this_$container.getBoundingClientRect) == null ? void 0 : _this_$container_getBoundingClientRect.call(_this_$container);
|
|
10829
|
-
var $wrapperContentRect = this.$wrapperContent.getBoundingClientRect();
|
|
10830
|
-
var $popupContainerRect = this._$popupContainer.getBoundingClientRect();
|
|
10831
|
-
// 容器的坐标 - 挂载的容器的坐标差
|
|
10832
|
-
// prettier-ignore
|
|
10833
|
-
var containerLeft = $containerRect.left - $popupContainerRect.left;
|
|
10834
|
-
var containerRight = -($containerRect.right - $popupContainerRect.right);
|
|
10835
|
-
// prettier-ignore
|
|
10836
|
-
var containerTop = $containerRect.y - $popupContainerRect.y;
|
|
10837
|
-
var left = containerLeft + ($containerRect.width - $wrapperContentRect.width) / 2;
|
|
10838
|
-
var right;
|
|
10839
|
-
var top = containerTop - $wrapperContentRect.height;
|
|
10840
|
-
var bottom = containerTop + $containerRect.height;
|
|
10841
|
-
if (/^t/.test(this._options.placement)) {
|
|
10842
|
-
var _this__options_offset, _this__options_offset1, _this__options_offset2;
|
|
10843
|
-
switch (this._options.placement) {
|
|
10844
|
-
case 'top':
|
|
10845
|
-
right = undefined;
|
|
10846
|
-
break;
|
|
10847
|
-
case 'tl':
|
|
10848
|
-
right = undefined;
|
|
10849
|
-
left = containerLeft;
|
|
10850
|
-
break;
|
|
10851
|
-
case 'tr':
|
|
10852
|
-
left = undefined;
|
|
10853
|
-
right = containerRight;
|
|
10854
|
-
break;
|
|
10855
|
-
}
|
|
10856
|
-
this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset = this._options.offset) == null ? void 0 : _this__options_offset[0]) || 0)) + "px;" : '') + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset1 = this._options.offset) == null ? void 0 : _this__options_offset1[0]) || 0)) + "px;" : '') + "\n top: " + (top + (((_this__options_offset2 = this._options.offset) == null ? void 0 : _this__options_offset2[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
|
|
10857
|
-
} else if (/^b/.test(this._options.placement)) {
|
|
10858
|
-
var _this__options_offset3, _this__options_offset4, _this__options_offset5;
|
|
10859
|
-
switch (this._options.placement) {
|
|
10860
|
-
case 'bottom':
|
|
10861
|
-
right = undefined;
|
|
10862
|
-
break;
|
|
10863
|
-
case 'bl':
|
|
10864
|
-
right = undefined;
|
|
10865
|
-
left = containerLeft;
|
|
10866
|
-
break;
|
|
10867
|
-
case 'br':
|
|
10868
|
-
left = undefined;
|
|
10869
|
-
right = containerRight;
|
|
10870
|
-
break;
|
|
10871
|
-
}
|
|
10872
|
-
if (this.$wrapperContent) this.$wrapperContent.style.cssText += "\n " + (right !== undefined ? "right: " + (right + (((_this__options_offset3 = this._options.offset) == null ? void 0 : _this__options_offset3[0]) || 0)) + "px;" : '') + "\n " + (left !== undefined ? "left: " + (left + (((_this__options_offset4 = this._options.offset) == null ? void 0 : _this__options_offset4[0]) || 0)) + "px;" : '') + "\n top: " + (bottom + (((_this__options_offset5 = this._options.offset) == null ? void 0 : _this__options_offset5[1]) || 0)) + "px;\n z-index:" + this._options.zIndex + ";\n ";
|
|
10873
|
-
}
|
|
10874
|
-
};
|
|
10875
|
-
/**
|
|
10876
|
-
* 初始化内容样式
|
|
10877
|
-
*/
|
|
10878
|
-
_proto._initContentStyle = function _initContentStyle() {
|
|
10879
|
-
if (!this.$wrapperContent) return;
|
|
10880
|
-
// prettier-ignore
|
|
10881
|
-
this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_, "" + _$PICKER_PREFIX_CLS$_ + "-wrapper", _$PICKER_PREFIX_CLS$_ + "-" + this._options.placement);
|
|
10882
|
-
// 提升优先级
|
|
10883
|
-
this.$wrapperContent.style.display = 'none';
|
|
10884
|
-
if (this._options.isMobile) {
|
|
10885
|
-
this.$wrapperContent.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mobile");
|
|
10886
|
-
this._$mask = document.createElement('div');
|
|
10887
|
-
this._$mask.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-mask");
|
|
10888
|
-
this.$wrapperContent.appendChild(this._$mask);
|
|
10889
|
-
}
|
|
10890
|
-
this.$body = document.createElement('div');
|
|
10891
|
-
this.$body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body");
|
|
10892
|
-
this.$wrapperContent.appendChild(this.$body);
|
|
10893
|
-
if (typeof this._options.content === 'string') {
|
|
10894
|
-
this.innerHTML(this._options.content);
|
|
10895
|
-
} else if (typeof this._options.content === 'function') {
|
|
10896
|
-
this.innerHTML(this._options.content == null ? void 0 : this._options.content.call(this._options));
|
|
10897
|
-
}
|
|
10898
|
-
if (typeof this._options.wrapClassName === 'string') {
|
|
10899
|
-
try {
|
|
10900
|
-
var _this_$wrapperContent_classList;
|
|
10901
|
-
var _this_$wrapperContent;
|
|
10902
|
-
(_this_$wrapperContent = this.$wrapperContent) == null ? void 0 : (_this_$wrapperContent_classList = _this_$wrapperContent.classList).add.apply(_this_$wrapperContent_classList, [].concat(this._options.wrapClassName.split(' ')));
|
|
10903
|
-
} catch (_error) {
|
|
10904
|
-
//
|
|
10905
|
-
}
|
|
10906
|
-
}
|
|
10907
|
-
};
|
|
10908
|
-
/**
|
|
10909
|
-
* 绑定事件
|
|
10910
|
-
*/
|
|
10911
|
-
_proto._eventListener = function _eventListener() {
|
|
10912
|
-
var _this_$container_addEventListener, _this_$container, _this_$container_addEventListener1, _this_$container1;
|
|
10913
|
-
this.$wrapperContent.addEventListener('click', this._onContentClick);
|
|
10914
|
-
(_this_$container = this.$container) == null ? void 0 : (_this_$container_addEventListener = _this_$container.addEventListener) == null ? void 0 : _this_$container_addEventListener.call(_this_$container, 'click', this._onContentClick);
|
|
10915
|
-
//
|
|
10916
|
-
if (this._options.trigger === 'click') (_this_$container1 = this.$container) == null ? void 0 : (_this_$container_addEventListener1 = _this_$container1.addEventListener) == null ? void 0 : _this_$container_addEventListener1.call(_this_$container1, 'click', this._onShow);
|
|
10917
|
-
if (this._options.trigger === 'hover') {
|
|
10918
|
-
var _this_$container_addEventListener2, _this_$container2, _this_$container_addEventListener3, _this_$container3, _this_$container_addEventListener4, _this_$container4;
|
|
10919
|
-
(_this_$container2 = this.$container) == null ? void 0 : (_this_$container_addEventListener2 = _this_$container2.addEventListener) == null ? void 0 : _this_$container_addEventListener2.call(_this_$container2, 'mouseenter', this._onShow);
|
|
10920
|
-
(_this_$container3 = this.$container) == null ? void 0 : (_this_$container_addEventListener3 = _this_$container3.addEventListener) == null ? void 0 : _this_$container_addEventListener3.call(_this_$container3, 'mouseover', this._onShow);
|
|
10921
|
-
(_this_$container4 = this.$container) == null ? void 0 : (_this_$container_addEventListener4 = _this_$container4.addEventListener) == null ? void 0 : _this_$container_addEventListener4.call(_this_$container4, 'mouseleave', this._onHide);
|
|
10922
|
-
this.$wrapperContent.addEventListener('mouseenter', this._onWrapperShow);
|
|
10923
|
-
this.$wrapperContent.addEventListener('mouseleave', this._onHide);
|
|
10924
|
-
}
|
|
10925
|
-
if (this._$mask) this._$mask.addEventListener('click', this._onHide);
|
|
10926
|
-
if (!this._options.isMobile) {
|
|
10927
|
-
window.addEventListener('blur', this._onHide);
|
|
10928
|
-
document.addEventListener('visibilitychange', this._onHide);
|
|
10929
|
-
window.addEventListener('resize', this._onHide);
|
|
10930
|
-
document.addEventListener('click', this._onDocumentClick);
|
|
10931
|
-
}
|
|
10932
|
-
};
|
|
10933
|
-
/**
|
|
10934
|
-
* $wrapperContent click event
|
|
10935
|
-
* @param e - 内容点击事件
|
|
10936
|
-
*/
|
|
10937
|
-
_proto._onContentClick = function _onContentClick(e) {
|
|
10938
|
-
pickerProvider.closeOther(e);
|
|
10939
|
-
};
|
|
10940
|
-
/**
|
|
10941
|
-
* 显示事件
|
|
10942
|
-
*/
|
|
10943
|
-
_proto._onShow = function _onShow() {
|
|
10944
|
-
if (this._disabled) return;
|
|
10945
|
-
this.open = true;
|
|
10946
|
-
};
|
|
10947
|
-
/**
|
|
10948
|
-
* $wrapperContent 显示事件(输入进入前 为 false 阻止设置为 true)
|
|
10949
|
-
*/
|
|
10950
|
-
_proto._onWrapperShow = function _onWrapperShow() {
|
|
10951
|
-
if (this._disabled) return;
|
|
10952
|
-
this._onShow();
|
|
10953
|
-
};
|
|
10954
|
-
/**
|
|
10955
|
-
* 隐藏事件
|
|
10956
|
-
*/
|
|
10957
|
-
_proto._onHide = function _onHide(e) {
|
|
10958
|
-
if (!this._open || this._disabled) return;
|
|
10959
|
-
if ((e == null ? void 0 : e.target) === this._$mask) e == null ? void 0 : e.stopPropagation();
|
|
10960
|
-
this.open = false;
|
|
10961
|
-
};
|
|
10962
|
-
/**
|
|
10963
|
-
* document 点击事件
|
|
10964
|
-
* @param event - 鼠标点击事件
|
|
10965
|
-
*/
|
|
10966
|
-
_proto._onDocumentClick = function _onDocumentClick(event) {
|
|
10967
|
-
var _this_$container;
|
|
10968
|
-
if (!(this.$wrapperContent.contains(event.target) || this.$wrapperContent === event.target || ((_this_$container = this.$container) == null ? void 0 : _this_$container.contains(event.target)) || this.$container === event.target)) {
|
|
10969
|
-
if (this._disabled) return;
|
|
10970
|
-
this._onHide();
|
|
10971
|
-
}
|
|
10972
|
-
};
|
|
10973
|
-
_create_class(Picker, [{
|
|
10974
|
-
key: "open",
|
|
10975
|
-
get:
|
|
10976
|
-
/**
|
|
10977
|
-
* 获取当前打开状态
|
|
10978
|
-
* @example
|
|
10979
|
-
* ```ts
|
|
10980
|
-
* console.log(picker.open); // 获取当前打开状态
|
|
10981
|
-
* picker.open = true; // 打开
|
|
10982
|
-
* picker.open = false; // 关闭
|
|
10983
|
-
* ```
|
|
10984
|
-
*/
|
|
10985
|
-
function get() {
|
|
10986
|
-
return this._open;
|
|
10987
|
-
},
|
|
10988
|
-
set: function set(open) {
|
|
10989
|
-
var _this = this;
|
|
10990
|
-
if (this._disabled) return;
|
|
10991
|
-
if (this._open !== !!open) {
|
|
10992
|
-
this._animationTimerClear();
|
|
10993
|
-
if (this._timer) {
|
|
10994
|
-
clearTimeout(this._timer);
|
|
10995
|
-
this._timer = null;
|
|
10996
|
-
}
|
|
10997
|
-
if (open) {
|
|
10998
|
-
// prettier-ignore
|
|
10999
|
-
this._timer = setTimeout(function () {
|
|
11000
|
-
if (!_this.$wrapperContent) return;
|
|
11001
|
-
_this.$wrapperContent.style.display = "inline-flex";
|
|
11002
|
-
_this.$wrapperContent.style.pointerEvents = "";
|
|
11003
|
-
// prettier-ignore
|
|
11004
|
-
if (_this._options.isMobile) document.body.classList.add("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
|
|
11005
|
-
_this._animationTimer = setTimeout(function () {
|
|
11006
|
-
_this._animationTimerClear();
|
|
11007
|
-
_this.$wrapperContent.style.opacity = "1";
|
|
11008
|
-
}, 0);
|
|
11009
|
-
requestAnimationFrame(function () {
|
|
11010
|
-
_this._setPlacement();
|
|
11011
|
-
});
|
|
11012
|
-
_this._OpenChange = open;
|
|
11013
|
-
_this._onOpenChange(open);
|
|
11014
|
-
},
|
|
11015
|
-
// prettier-ignore
|
|
11016
|
-
(this._options.mouseEnterDelay < 0 ? 0 : this._options.mouseEnterDelay) * 1000);
|
|
11017
|
-
} else {
|
|
11018
|
-
// prettier-ignore
|
|
11019
|
-
this._timer = setTimeout(function () {
|
|
11020
|
-
if (!_this.$wrapperContent) return;
|
|
11021
|
-
_this.$wrapperContent.style.opacity = "0";
|
|
11022
|
-
_this.$wrapperContent.style.pointerEvents = "none";
|
|
11023
|
-
// prettier-ignore
|
|
11024
|
-
if (_this._options.isMobile) document.body.classList.remove("" + _$PICKER_PREFIX_CLS$_ + "-body-noscroll");
|
|
11025
|
-
_this._animationTimer = setTimeout(function () {
|
|
11026
|
-
_this._animationTimerClear();
|
|
11027
|
-
_this.$wrapperContent.style.display = "none";
|
|
11028
|
-
}, 301); // css 动画是 300ms
|
|
11029
|
-
_this._OpenChange = open;
|
|
11030
|
-
_this._onOpenChange(open);
|
|
11031
|
-
},
|
|
11032
|
-
// prettier-ignore
|
|
11033
|
-
(this._options.mouseLeaveDelay < 0 ? 0 : this._options.mouseLeaveDelay) * 1000);
|
|
11034
|
-
}
|
|
11035
|
-
if (this._OpenChange === open) {
|
|
11036
|
-
if (this._timer) {
|
|
11037
|
-
clearTimeout(this._timer);
|
|
11038
|
-
this._timer = null;
|
|
11039
|
-
}
|
|
11040
|
-
}
|
|
11041
|
-
this._open = !!open;
|
|
11042
|
-
}
|
|
11043
|
-
}
|
|
11044
|
-
}, {
|
|
11045
|
-
key: "disabled",
|
|
11046
|
-
get:
|
|
11047
|
-
/**
|
|
11048
|
-
* 获取或设置禁用状态
|
|
11049
|
-
* @example
|
|
11050
|
-
* ```ts
|
|
11051
|
-
* picker.disabled = true; // 禁用
|
|
11052
|
-
* picker.disabled = false; // 启用
|
|
11053
|
-
* console.log(picker.disabled); // 获取禁用状态
|
|
11054
|
-
* ```
|
|
11055
|
-
*/
|
|
11056
|
-
function get() {
|
|
11057
|
-
return this._disabled;
|
|
11058
|
-
},
|
|
11059
|
-
set: function set(disabled) {
|
|
11060
|
-
if (disabled) {
|
|
11061
|
-
var _this_$container_classList_add, _this_$container_classList, _this_$container;
|
|
11062
|
-
(_this_$container = this.$container) == null ? void 0 : (_this_$container_classList = _this_$container.classList) == null ? void 0 : (_this_$container_classList_add = _this_$container_classList.add) == null ? void 0 : _this_$container_classList_add.call(_this_$container_classList, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
|
|
11063
|
-
} else {
|
|
11064
|
-
var _this_$container_classList_remove, _this_$container_classList1, _this_$container1;
|
|
11065
|
-
(_this_$container1 = this.$container) == null ? void 0 : (_this_$container_classList1 = _this_$container1.classList) == null ? void 0 : (_this_$container_classList_remove = _this_$container_classList1.remove) == null ? void 0 : _this_$container_classList_remove.call(_this_$container_classList1, "" + _$PICKER_PREFIX_CLS$_ + "-disabled");
|
|
11066
|
-
}
|
|
11067
|
-
this._disabled = disabled;
|
|
11068
|
-
}
|
|
11069
|
-
}]);
|
|
11070
|
-
return Picker;
|
|
11071
|
-
}();
|
|
11072
|
-
/**
|
|
11073
|
-
* 版本号
|
|
11074
|
-
* @example
|
|
11075
|
-
* ```ts
|
|
11076
|
-
* Picker.VERSION; // 输出版本号
|
|
11077
|
-
* ```
|
|
11078
|
-
*/
|
|
11079
|
-
Picker.VERSION = '1.1.5';
|
|
11080
|
-
|
|
11081
|
-
dist$2 = Picker;
|
|
11082
|
-
return dist$2;
|
|
11083
|
-
}
|
|
11084
|
-
|
|
11085
|
-
/*
|
|
11086
|
-
* @ezuikit/control-date-picker v1.0.0-beta.6
|
|
11087
|
-
* Copyright (c) 2025-12-03 Ezviz-OpenBiz
|
|
11088
|
-
* Released under the MIT License.
|
|
11089
|
-
*/
|
|
11090
|
-
|
|
11091
|
-
var hasRequiredDist$2;
|
|
11092
|
-
|
|
11093
|
-
function requireDist$2 () {
|
|
11094
|
-
if (hasRequiredDist$2) return dist$4;
|
|
11095
|
-
hasRequiredDist$2 = 1;
|
|
11096
|
-
|
|
11097
|
-
var delegate = requireDelegate();
|
|
11098
|
-
var utilsTools = requireDist$4();
|
|
11099
|
-
var deepmerge = requireCjs();
|
|
11100
|
-
var Picker = requireDist$3();
|
|
11101
|
-
|
|
11102
|
-
/**
|
|
11103
|
-
* 工具类
|
|
11104
|
-
*/ var Util = /*#__PURE__*/ function() {
|
|
11105
|
-
function Util() {}
|
|
11106
|
-
/**
|
|
11107
|
-
* 数字格式化 十位补0
|
|
11108
|
-
* @param {number | string} num
|
|
11109
|
-
* @returns {string}
|
|
11110
|
-
*
|
|
11111
|
-
* @example
|
|
11112
|
-
* ```js
|
|
11113
|
-
* fillZero(0) // "00"
|
|
11114
|
-
* fillZero(9) // "09"
|
|
11115
|
-
* fillZero(23) // "23"
|
|
11116
|
-
* ```
|
|
11117
|
-
*/ Util.fillZero = function fillZero(num, len) {
|
|
11118
|
-
if (len === void 0) len = 2;
|
|
11119
|
-
return num.toString().padStart(len, '0');
|
|
11120
|
-
};
|
|
11121
|
-
/**
|
|
11122
|
-
* 按照size 对数组 arr 进行分组
|
|
11123
|
-
* @param {Array<string | number>} arr
|
|
11124
|
-
* @param {number} size 每组的个数
|
|
11125
|
-
* @returns {T[][]}
|
|
11126
|
-
*/ Util.chunkBySize = function chunkBySize(arr, size) {
|
|
11127
|
-
return Array.from({
|
|
11128
|
-
length: Math.ceil(arr.length / size)
|
|
11129
|
-
}).map(function(_, index) {
|
|
11130
|
-
return arr.slice(index * size, (index + 1) * size);
|
|
11131
|
-
});
|
|
11132
|
-
};
|
|
11133
|
-
/**
|
|
11134
|
-
* 根据year 生成年份列表 (12年份列表)
|
|
11135
|
-
* @param {number} year 年份
|
|
11136
|
-
* @returns {number[]} 年份列表
|
|
11137
|
-
* @example
|
|
11138
|
-
* generateYearsList(2025) // [2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030]
|
|
11139
|
-
*/ Util.generateYears = function generateYears(year) {
|
|
11140
|
-
var years = [];
|
|
11141
|
-
var index = year % 10 + 1;
|
|
11142
|
-
for(var i = index; i >= 0; i--){
|
|
11143
|
-
years.push(year - i);
|
|
11144
|
-
}
|
|
11145
|
-
for(var i1 = 1; years.length < 12; i1++){
|
|
11146
|
-
years.push(year + i1);
|
|
11147
|
-
}
|
|
11148
|
-
return years;
|
|
11149
|
-
};
|
|
11150
|
-
/**
|
|
11151
|
-
* 返回给定年份和月份的总天数
|
|
11152
|
-
* @param {number} year 年
|
|
11153
|
-
* @param {number} month 月 (从0开始)
|
|
11154
|
-
* @returns {number}
|
|
11155
|
-
*/ Util.getDaysInMonth = function getDaysInMonth(year, month) {
|
|
11156
|
-
return new Date(year, month + 1, 0).getDate();
|
|
11157
|
-
};
|
|
11158
|
-
/**
|
|
11159
|
-
* 计算出给定月份(month)的第一天是星期几
|
|
11160
|
-
* @param {number} year 年
|
|
11161
|
-
* @param {number} month 月 (从0开始)
|
|
11162
|
-
* @param {number} startOfWeek 开始周,[0-6]: 0 为周日,1为周一,以此类推 默认从周日开始
|
|
11163
|
-
* @returns
|
|
11164
|
-
*/ // prettier-ignore
|
|
11165
|
-
Util.getFirstDayOfMonth = function getFirstDayOfMonth(year, month, startOfWeek) {
|
|
11166
|
-
if (startOfWeek === void 0) startOfWeek = 0;
|
|
11167
|
-
var firstDayInMonth = new Date(year, month).getDay();
|
|
11168
|
-
return (firstDayInMonth - startOfWeek + 7) % 7;
|
|
11169
|
-
};
|
|
11170
|
-
/**
|
|
11171
|
-
* 获取六行一个月份中日期的数据
|
|
11172
|
-
* @param {number} year 年
|
|
11173
|
-
* @param {number} month 月 (从1开始)
|
|
11174
|
-
* @param {number} startOfWeek 开始周,[0-6]: 0 为周日,1为周一,以此类推 默认从周日开始
|
|
11175
|
-
* @returns {string[]}
|
|
11176
|
-
* @example
|
|
11177
|
-
* generateWeeksByYearMonth(2025, 5, 0)
|
|
11178
|
-
* // ["2025-04-28", "2025-04-29", "2025-04-30", "2025-05-01", "2025-05-02", "2025-05-03", "2025-05-04",
|
|
11179
|
-
* // "2025-05-05", "2025-05-06", "2025-05-07", "2025-05-08", "2025-05-09", "2025-05-10", "2025-05-11",
|
|
11180
|
-
* // "2025-05-12", "2025-05-13", "2025-05-14", "2025-05-15", "2025-05-16", "2025-05-17", "2025-05-18",
|
|
11181
|
-
* // "2025-05-19", "2025-05-20", "2025-05-21", "2025-05-22", "2025-05-23", "2025-05-24", "2025-05-25",
|
|
11182
|
-
* // "2025-05-26", "2025-05-27", "2025-05-28", "2025-05-29", "2025-05-30", "2025-05-31", "2025-06-01",
|
|
11183
|
-
* // "2025-06-02", "2025-06-03", "2025-06-04", "2025-06-05", "2025-06-06", "2025-06-07", "2025-06-08"]
|
|
11184
|
-
*
|
|
11185
|
-
*/ // prettier-ignore
|
|
11186
|
-
Util.generateWeeksByYearMonth = function generateWeeksByYearMonth(year, month, startOfWeek) {
|
|
11187
|
-
if (startOfWeek === void 0) startOfWeek = 0;
|
|
11188
|
-
month = month - 1;
|
|
11189
|
-
var daysInMonth = Util.getDaysInMonth(year, month);
|
|
11190
|
-
var firstDay = Util.getFirstDayOfMonth(year, month, startOfWeek);
|
|
11191
|
-
var weeks = [];
|
|
11192
|
-
for(var i = 1; i <= firstDay + daysInMonth; i++){
|
|
11193
|
-
var day = i - firstDay;
|
|
11194
|
-
if (day < 1) {
|
|
11195
|
-
// prettier-ignore
|
|
11196
|
-
weeks.push((month === 0 ? year - 1 : year) + "-" + Util.fillZero((month + 12 - 1) % 12 + 1) + "-" + Util.fillZero(Util.getDaysInMonth(year, month - 1) + day));
|
|
11197
|
-
} else if (day > daysInMonth) {
|
|
11198
|
-
// prettier-ignore
|
|
11199
|
-
weeks.push((month === 11 ? year + 1 : year) + "-" + Util.fillZero((month + 1) % 12 + 1) + "-" + (day - daysInMonth));
|
|
11200
|
-
} else {
|
|
11201
|
-
// prettier-ignore
|
|
11202
|
-
weeks.push(year + "-" + Util.fillZero(month + 1) + "-" + Util.fillZero(day));
|
|
11203
|
-
}
|
|
11204
|
-
}
|
|
11205
|
-
// Fill remaining places if data array is less than 42
|
|
11206
|
-
var nextDay = 1;
|
|
11207
|
-
while(weeks.length < 42){
|
|
11208
|
-
// prettier-ignore
|
|
11209
|
-
weeks.push((month === 11 ? year + 1 : year) + "-" + Util.fillZero((month + 1) % 12 + 1) + "-" + Util.fillZero(nextDay++));
|
|
11210
|
-
}
|
|
11211
|
-
return weeks;
|
|
11212
|
-
};
|
|
11213
|
-
/**
|
|
11214
|
-
* 生成小时数组
|
|
11215
|
-
* @returns {string[]} 24小时数组
|
|
11216
|
-
* @example
|
|
11217
|
-
* generateHours() // ['00', '01', '02', ..., '23']
|
|
11218
|
-
*/ Util.generateHours = function generateHours() {
|
|
11219
|
-
var hours = [];
|
|
11220
|
-
for(var i = 0; i < 24; i++){
|
|
11221
|
-
hours.push(Util.fillZero(i));
|
|
11222
|
-
}
|
|
11223
|
-
return hours;
|
|
11224
|
-
};
|
|
11225
|
-
/**
|
|
11226
|
-
* 生成分钟或秒数组
|
|
11227
|
-
* @returns {string[]} 分钟或秒数组
|
|
11228
|
-
* @example
|
|
11229
|
-
* generateMinutesOrSeconds() // ['00', '01', '02', ..., '59']
|
|
11230
|
-
*/ Util.generateMinutesOrSeconds = function generateMinutesOrSeconds() {
|
|
11231
|
-
var hours = [];
|
|
11232
|
-
for(var i = 0; i <= 59; i++){
|
|
11233
|
-
hours.push(Util.fillZero(i));
|
|
11234
|
-
}
|
|
11235
|
-
return hours;
|
|
11236
|
-
};
|
|
11237
|
-
return Util;
|
|
11238
|
-
}();
|
|
11239
|
-
|
|
11240
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11241
|
-
var _CONTAINER_PREFIX_CLASSNAME_ = 'edate';
|
|
11242
|
-
var _DATE_DISABLED_$1 = "" + _CONTAINER_PREFIX_CLASSNAME_ + "-disabled";
|
|
11243
|
-
var _PREFIX_CLS_HEADER_HOVER_$1 = "" + _CONTAINER_PREFIX_CLASSNAME_ + "-header-title-hover";
|
|
11244
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11245
|
-
var __$CALENDAR_LOCALES$__ = {
|
|
11246
|
-
en: {
|
|
11247
|
-
year: '',
|
|
11248
|
-
month: '',
|
|
11249
|
-
weeks: [
|
|
11250
|
-
'Su',
|
|
11251
|
-
'Mo',
|
|
11252
|
-
'Tu',
|
|
11253
|
-
'We',
|
|
11254
|
-
'Th',
|
|
11255
|
-
'Fr',
|
|
11256
|
-
'Sa'
|
|
11257
|
-
],
|
|
11258
|
-
today: 'Today',
|
|
11259
|
-
ok: 'OK',
|
|
11260
|
-
months: [
|
|
11261
|
-
'Jan',
|
|
11262
|
-
'Feb',
|
|
11263
|
-
'Mar',
|
|
11264
|
-
'Apr',
|
|
11265
|
-
'May',
|
|
11266
|
-
'Jun',
|
|
11267
|
-
'Jul',
|
|
11268
|
-
'Aug',
|
|
11269
|
-
'Sep',
|
|
11270
|
-
'Oct',
|
|
11271
|
-
'Nov',
|
|
11272
|
-
'Dec'
|
|
11273
|
-
]
|
|
11274
|
-
},
|
|
11275
|
-
zh: {
|
|
11276
|
-
year: '年',
|
|
11277
|
-
month: '月',
|
|
11278
|
-
weeks: [
|
|
11279
|
-
'日',
|
|
11280
|
-
'一',
|
|
11281
|
-
'二',
|
|
11282
|
-
'三',
|
|
11283
|
-
'四',
|
|
11284
|
-
'五',
|
|
11285
|
-
'六'
|
|
11286
|
-
],
|
|
11287
|
-
today: '今天',
|
|
11288
|
-
ok: '确定',
|
|
11289
|
-
months: [
|
|
11290
|
-
'01',
|
|
11291
|
-
'02',
|
|
11292
|
-
'03',
|
|
11293
|
-
'04',
|
|
11294
|
-
'05',
|
|
11295
|
-
'06',
|
|
11296
|
-
'07',
|
|
11297
|
-
'08',
|
|
11298
|
-
'09',
|
|
11299
|
-
'10',
|
|
11300
|
-
'11',
|
|
11301
|
-
'12'
|
|
11302
|
-
]
|
|
11303
|
-
}
|
|
11304
|
-
};
|
|
11305
|
-
|
|
11306
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11307
|
-
var __DEFAULT_COMPONENTS_OPTIONS__ = {
|
|
11308
|
-
showSuperPrevIcon: false,
|
|
11309
|
-
showSuperNextIcon: false,
|
|
11310
|
-
showPrevIcon: false,
|
|
11311
|
-
showNextIcon: false,
|
|
11312
|
-
showHeaderClose: false,
|
|
11313
|
-
showHeaderOk: false,
|
|
11314
|
-
renderSuperPrevIcon: '<span class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-super-prev-icon"></span>',
|
|
11315
|
-
renderSuperNextIcon: '<span class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-super-next-icon"></span>',
|
|
11316
|
-
renderPrevIcon: '<span class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-prev-icon"></span>',
|
|
11317
|
-
renderNextIcon: '<span class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-next-icon"></span>',
|
|
11318
|
-
renderHeaderCloseIcon: '<span class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-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 <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 <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>',
|
|
11319
|
-
renderHeaderOkIcon: function(locale) {
|
|
11320
|
-
return '<span class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-btn-text">' + ((locale == null ? void 0 : locale.ok) || '确定') + "</span>";
|
|
11321
|
-
}
|
|
11322
|
-
};
|
|
11323
|
-
/**
|
|
11324
|
-
* 公共头部组件
|
|
11325
|
-
* @param options - Options for the header component.
|
|
11326
|
-
* @param {string} options.className - Optional class name to be added to the header element for custom styling.
|
|
11327
|
-
* @param {string | (() => string)} options.content - The content to be rendered in the header.
|
|
11328
|
-
* It can be a string or a function that returns a string.
|
|
11329
|
-
* This function creates a header element with the specified class name and content.
|
|
11330
|
-
* It returns a string representing the HTML structure of the header.
|
|
11331
|
-
* @example
|
|
11332
|
-
* ```ts
|
|
11333
|
-
* import Header from "./header";
|
|
11334
|
-
* const header = new Header({
|
|
11335
|
-
* className: "custom-header",
|
|
11336
|
-
* prefixCls: "prefix",
|
|
11337
|
-
* content: () => "<h1>Header Content</h1>"
|
|
11338
|
-
* })
|
|
11339
|
-
* @returns {string} The HTML string representing the header element.
|
|
11340
|
-
*
|
|
11341
|
-
*/ var Header = /*#__PURE__*/ function() {
|
|
11342
|
-
function Header(options) {
|
|
11343
|
-
this.$header = null;
|
|
11344
|
-
// prettier-ignore
|
|
11345
|
-
this.options = deepmerge.all([
|
|
11346
|
-
{},
|
|
11347
|
-
__DEFAULT_COMPONENTS_OPTIONS__,
|
|
11348
|
-
options
|
|
11349
|
-
], {
|
|
11350
|
-
clone: false
|
|
11351
|
-
});
|
|
11352
|
-
this.$header = document.createElement('div');
|
|
11353
|
-
// prettier-ignore
|
|
11354
|
-
this.$header.classList.add("" + _CONTAINER_PREFIX_CLASSNAME_ + "-header", "" + options.prefixCls + "-header");
|
|
11355
|
-
if (options.className) {
|
|
11356
|
-
this.$header.classList.add(options.className);
|
|
11357
|
-
}
|
|
11358
|
-
this._render();
|
|
11359
|
-
this._eventListeners();
|
|
11360
|
-
}
|
|
11361
|
-
var _proto = Header.prototype;
|
|
11362
|
-
_proto._render = function _render() {
|
|
11363
|
-
if (this.$header) {
|
|
11364
|
-
var _this__getStrOrFunToStr, _this__getStrOrFunToStr1, _this__getStrOrFunToStr2, _this__getStrOrFunToStr3, _this__getStrOrFunToStr4, _this__getStrOrFunToStr5;
|
|
11365
|
-
this.$header.innerHTML = "\n " + (this.options.showHeaderClose ? '<div class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-close-btn">\n ' + ((_this__getStrOrFunToStr = this._getStrOrFunToStr(this.options.renderHeaderCloseIcon)) != null ? _this__getStrOrFunToStr : __DEFAULT_COMPONENTS_OPTIONS__.renderHeaderCloseIcon) + "\n </div>" : this.options.showHeaderOk ? "<span></span>" : '') + "\n " + (this.options.showSuperPrevIcon || this.options.showPrevIcon ? '\n <div class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-prev-btns">\n ' + (this.options.showSuperPrevIcon ? '<div class="' + _CONTAINER_PREFIX_CLASSNAME_ + "-super-prev-btn " + this.options.prefixCls + '-super-prev-btn">\n ' + ((_this__getStrOrFunToStr1 = this._getStrOrFunToStr(this.options.renderSuperPrevIcon)) != null ? _this__getStrOrFunToStr1 : __DEFAULT_COMPONENTS_OPTIONS__.renderSuperPrevIcon) + "\n </div>" : '') + "\n " + (this.options.showPrevIcon ? '<div class="' + _CONTAINER_PREFIX_CLASSNAME_ + "-prev-btn " + this.options.prefixCls + '-prev-btn">\n ' + ((_this__getStrOrFunToStr2 = this._getStrOrFunToStr(this.options.renderPrevIcon)) != null ? _this__getStrOrFunToStr2 : __DEFAULT_COMPONENTS_OPTIONS__.renderPrevIcon) + "\n </div>" : '') + "\n </div>\n " : '') + '\n\n <div class="' + _CONTAINER_PREFIX_CLASSNAME_ + "-header-view " + this.options.prefixCls + '-header-view"></div>\n\n ' + (this.options.showNextIcon || this.options.showSuperNextIcon ? '\n <div class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-next-btns">\n ' + (this.options.showNextIcon ? '<div class="' + _CONTAINER_PREFIX_CLASSNAME_ + "-next-btn " + this.options.prefixCls + '-next-btn">\n ' + ((_this__getStrOrFunToStr3 = this._getStrOrFunToStr(this.options.renderNextIcon)) != null ? _this__getStrOrFunToStr3 : __DEFAULT_COMPONENTS_OPTIONS__.renderNextIcon) + "\n </div>" : '') + "\n " + (this.options.showSuperNextIcon ? '<div class="' + _CONTAINER_PREFIX_CLASSNAME_ + "-super-next-btn " + this.options.prefixCls + '-super-next-btn">\n ' + ((_this__getStrOrFunToStr4 = this._getStrOrFunToStr(this.options.renderSuperNextIcon)) != null ? _this__getStrOrFunToStr4 : __DEFAULT_COMPONENTS_OPTIONS__.renderSuperNextIcon) + "\n </div>" : '') + "\n </div>\n " : '') + "\n " + (this.options.showHeaderOk ? '<div class="' + _CONTAINER_PREFIX_CLASSNAME_ + '-ok-btn">\n ' + ((_this__getStrOrFunToStr5 = this._getStrOrFunToStr(this.options.renderHeaderOkIcon)) != null ? _this__getStrOrFunToStr5 : __DEFAULT_COMPONENTS_OPTIONS__.renderHeaderOkIcon) + "\n </div>" : this.options.showHeaderClose ? "<span></span>" : '');
|
|
11366
|
-
}
|
|
11367
|
-
};
|
|
11368
|
-
_proto._getStrOrFunToStr = function _getStrOrFunToStr(value) {
|
|
11369
|
-
if (value === undefined || value === null) {
|
|
11370
|
-
return undefined;
|
|
11371
|
-
}
|
|
11372
|
-
if (typeof value === 'function') {
|
|
11373
|
-
var _this_options;
|
|
11374
|
-
return this._getStrOrFunToStr(value == null ? void 0 : value((_this_options = this.options) == null ? void 0 : _this_options.locale));
|
|
11375
|
-
}
|
|
11376
|
-
if (typeof value !== 'string') {
|
|
11377
|
-
return undefined;
|
|
11378
|
-
}
|
|
11379
|
-
return value;
|
|
11380
|
-
};
|
|
11381
|
-
/**
|
|
11382
|
-
* 渲染内容
|
|
11383
|
-
* @param html 内容
|
|
11384
|
-
* @returns
|
|
11385
|
-
*/ _proto.renderContent = function renderContent(html) {
|
|
11386
|
-
if (this.$header) {
|
|
11387
|
-
// prettier-ignore
|
|
11388
|
-
var _$content = this.$header.querySelector("." + _CONTAINER_PREFIX_CLASSNAME_ + "-header-view");
|
|
11389
|
-
if (!_$content) return;
|
|
11390
|
-
_$content.innerHTML = html;
|
|
11391
|
-
}
|
|
11392
|
-
};
|
|
11393
|
-
_proto.destroy = function destroy() {
|
|
11394
|
-
if (this.$header) {
|
|
11395
|
-
this.$header.remove();
|
|
11396
|
-
}
|
|
11397
|
-
};
|
|
11398
|
-
_proto._eventListeners = function _eventListeners() {
|
|
11399
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
11400
|
-
var _this = this;
|
|
11401
|
-
if (_this.$header) {
|
|
11402
|
-
// prettier-ignore
|
|
11403
|
-
delegate(_this.$header, "." + _CONTAINER_PREFIX_CLASSNAME_ + "-super-prev-btn", "click", function(event) {
|
|
11404
|
-
if (event.delegateTarget.classList.contains(_DATE_DISABLED_$1)) return;
|
|
11405
|
-
_this.options.onSuperPrev == null ? void 0 : _this.options.onSuperPrev.call(_this.options);
|
|
11406
|
-
});
|
|
11407
|
-
// prettier-ignore
|
|
11408
|
-
delegate(_this.$header, "." + _CONTAINER_PREFIX_CLASSNAME_ + "-prev-btn", "click", function(event) {
|
|
11409
|
-
if (event.delegateTarget.classList.contains(_DATE_DISABLED_$1)) return;
|
|
11410
|
-
_this.options.onPrev == null ? void 0 : _this.options.onPrev.call(_this.options);
|
|
11411
|
-
});
|
|
11412
|
-
// prettier-ignore
|
|
11413
|
-
delegate(_this.$header, "." + _CONTAINER_PREFIX_CLASSNAME_ + "-next-btn", "click", function(event) {
|
|
11414
|
-
if (event.delegateTarget.classList.contains(_DATE_DISABLED_$1)) return;
|
|
11415
|
-
_this.options.onNext == null ? void 0 : _this.options.onNext.call(_this.options);
|
|
11416
|
-
});
|
|
11417
|
-
// prettier-ignore
|
|
11418
|
-
delegate(_this.$header, "." + _CONTAINER_PREFIX_CLASSNAME_ + "-super-next-btn", "click", function(event) {
|
|
11419
|
-
if (event.delegateTarget.classList.contains(_DATE_DISABLED_$1)) return;
|
|
11420
|
-
_this.options.onSuperNext == null ? void 0 : _this.options.onSuperNext.call(_this.options);
|
|
11421
|
-
});
|
|
11422
|
-
// prettier-ignore
|
|
11423
|
-
delegate(_this.$header, "." + _CONTAINER_PREFIX_CLASSNAME_ + "-close-btn", "click", function(event) {
|
|
11424
|
-
if (event.delegateTarget.classList.contains(_DATE_DISABLED_$1)) return;
|
|
11425
|
-
_this.options.onClose == null ? void 0 : _this.options.onClose.call(_this.options);
|
|
11426
|
-
});
|
|
11427
|
-
// prettier-ignore
|
|
11428
|
-
delegate(_this.$header, "." + _CONTAINER_PREFIX_CLASSNAME_ + "-ok-btn", "click", function(event) {
|
|
11429
|
-
if (event.delegateTarget.classList.contains(_DATE_DISABLED_$1)) return;
|
|
11430
|
-
_this.options.onOk == null ? void 0 : _this.options.onOk.call(_this.options);
|
|
11431
|
-
});
|
|
11432
|
-
}
|
|
11433
|
-
};
|
|
11434
|
-
return Header;
|
|
11435
|
-
}();
|
|
11436
|
-
|
|
11437
|
-
function _extends$2() {
|
|
11438
|
-
_extends$2 = Object.assign || function(target) {
|
|
11439
|
-
for(var i = 1; i < arguments.length; i++){
|
|
11440
|
-
var source = arguments[i];
|
|
11441
|
-
for(var key in source){
|
|
11442
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
11443
|
-
target[key] = source[key];
|
|
11444
|
-
}
|
|
11445
|
-
}
|
|
11446
|
-
}
|
|
11447
|
-
return target;
|
|
11448
|
-
};
|
|
11449
|
-
return _extends$2.apply(this, arguments);
|
|
11450
|
-
}
|
|
11451
|
-
/**
|
|
11452
|
-
* Default options for the Container class.
|
|
11453
|
-
*/ var _CONTAINER_DEFAULT_OPTIONS_ = {
|
|
11454
|
-
prefixCls: _CONTAINER_PREFIX_CLASSNAME_,
|
|
11455
|
-
locales: __$CALENDAR_LOCALES$__,
|
|
11456
|
-
showHeader: true
|
|
11457
|
-
};
|
|
11458
|
-
/**
|
|
11459
|
-
* Container class for creating a content container with options for locale and styling.
|
|
11460
|
-
* @example
|
|
11461
|
-
* ```ts
|
|
11462
|
-
* import Container from "./Container";
|
|
11463
|
-
* const container = new Container({
|
|
11464
|
-
* getContainer: document.body,
|
|
11465
|
-
* wrapClassName: "custom-wrap",
|
|
11466
|
-
* prefixCls: "custom-prefix",
|
|
11467
|
-
* language: "zh-CN",
|
|
11468
|
-
* locales: {
|
|
11469
|
-
* "en-US": { today: "Today", cancel: "Cancel" },
|
|
11470
|
-
* "zh-CN": { today: "今天", cancel: "取消" },
|
|
11471
|
-
* },
|
|
11472
|
-
* });
|
|
11473
|
-
*/ var Container = /*#__PURE__*/ function() {
|
|
11474
|
-
function Container(popupContainer, options) {
|
|
11475
|
-
/**
|
|
11476
|
-
* panel element node.
|
|
11477
|
-
*/ this.$panel = document.createElement('div');
|
|
11478
|
-
/**
|
|
11479
|
-
* body element node.
|
|
11480
|
-
*/ this.$body = document.createElement('div');
|
|
11481
|
-
/**
|
|
11482
|
-
* The container element where the container's content will be appended.
|
|
11483
|
-
*/ this.$container = document.createElement('div');
|
|
11484
|
-
/**
|
|
11485
|
-
* The language used for localization.
|
|
11486
|
-
*/ this.language = 'zh';
|
|
11487
|
-
/**
|
|
11488
|
-
* header.
|
|
11489
|
-
*/ this.header = null;
|
|
11490
|
-
/**
|
|
11491
|
-
* The locale object for the current language.
|
|
11492
|
-
*/ this.locale = __$CALENDAR_LOCALES$__['zh'];
|
|
11493
|
-
this.options = deepmerge.all([
|
|
11494
|
-
{},
|
|
11495
|
-
_CONTAINER_DEFAULT_OPTIONS_,
|
|
11496
|
-
options
|
|
11497
|
-
], {
|
|
11498
|
-
clone: false
|
|
11499
|
-
});
|
|
11500
|
-
if (popupContainer) {
|
|
11501
|
-
// prettier-ignore
|
|
11502
|
-
this.$popupContainer = typeof popupContainer === "function" ? popupContainer() : popupContainer;
|
|
11503
|
-
} else {
|
|
11504
|
-
this.$popupContainer = document.body;
|
|
11505
|
-
}
|
|
11506
|
-
this._setLocale();
|
|
11507
|
-
// prettier-ignore
|
|
11508
|
-
this.$container.classList.add("" + _CONTAINER_PREFIX_CLASSNAME_ + "-container", (this.options.prefixCls || _CONTAINER_PREFIX_CLASSNAME_) + "-container");
|
|
11509
|
-
// prettier-ignore
|
|
11510
|
-
if (options.isMobile) this.$container.classList.add("" + _CONTAINER_PREFIX_CLASSNAME_ + "-mobile", "" + this.options.prefixCls + "-mobile");
|
|
11511
|
-
// prettier-ignore
|
|
11512
|
-
if (this.options.wrapClassName) this.$container.classList.add(this.options.wrapClassName);
|
|
11513
|
-
// prettier-ignore
|
|
11514
|
-
this.$panel.classList.add("" + _CONTAINER_PREFIX_CLASSNAME_ + "-panel", (this.options.prefixCls || _CONTAINER_PREFIX_CLASSNAME_) + "-panel");
|
|
11515
|
-
if (this.options.showHeader) {
|
|
11516
|
-
this.header = new Header(_extends$2({}, this.options, {
|
|
11517
|
-
locale: this.locale,
|
|
11518
|
-
onPrev: this._onPrev.bind(this),
|
|
11519
|
-
onNext: this._onNext.bind(this),
|
|
11520
|
-
onSuperPrev: this._onSuperPrev.bind(this),
|
|
11521
|
-
onSuperNext: this._onSuperNext.bind(this),
|
|
11522
|
-
onClose: this._onClose.bind(this),
|
|
11523
|
-
onOk: this._onOk.bind(this)
|
|
11524
|
-
}));
|
|
11525
|
-
this.$panel.appendChild(this.header.$header);
|
|
11526
|
-
}
|
|
11527
|
-
// prettier-ignore
|
|
11528
|
-
this.$body.classList.add("" + _CONTAINER_PREFIX_CLASSNAME_ + "-body", (this.options.prefixCls || _CONTAINER_PREFIX_CLASSNAME_) + "-body");
|
|
11529
|
-
this.$container.appendChild(this.$panel);
|
|
11530
|
-
this.$popupContainer.appendChild(this.$container);
|
|
11531
|
-
}
|
|
11532
|
-
var _proto = Container.prototype;
|
|
11533
|
-
/**
|
|
11534
|
-
* set locale
|
|
11535
|
-
* @private
|
|
11536
|
-
* @returns {void}
|
|
11537
|
-
*/ _proto._setLocale = function _setLocale() {
|
|
11538
|
-
if (this.options.locales) {
|
|
11539
|
-
if (typeof this.options.language === 'string') {
|
|
11540
|
-
var language = this.options.language || navigator.language;
|
|
11541
|
-
if (this.options.locales[language]) {
|
|
11542
|
-
this.locale = this.options.locales[language];
|
|
11543
|
-
} else {
|
|
11544
|
-
this.locale = this.options.locales['zh'];
|
|
11545
|
-
}
|
|
11546
|
-
} else {
|
|
11547
|
-
this.locale = this.options.locales['zh'];
|
|
11548
|
-
}
|
|
11549
|
-
}
|
|
11550
|
-
};
|
|
11551
|
-
/**
|
|
11552
|
-
* destroy content node
|
|
11553
|
-
* @example
|
|
11554
|
-
* ```ts
|
|
11555
|
-
* container.destroy();
|
|
11556
|
-
* ```
|
|
11557
|
-
* @returns {void}
|
|
11558
|
-
*/ _proto.destroy = function destroy() {
|
|
11559
|
-
var _this_$container;
|
|
11560
|
-
if ((_this_$container = this.$container) == null ? void 0 : _this_$container.parentNode) {
|
|
11561
|
-
this.$container.parentNode.removeChild(this.$container);
|
|
11562
|
-
}
|
|
11563
|
-
this.header = null;
|
|
11564
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11565
|
-
this.$container = null;
|
|
11566
|
-
// this.locale = {}; // Reset locale
|
|
11567
|
-
};
|
|
11568
|
-
/**
|
|
11569
|
-
* set locale
|
|
11570
|
-
* @param {"en-US" | "zh-CN" | L} locale locale
|
|
11571
|
-
* @example
|
|
11572
|
-
* ```ts
|
|
11573
|
-
* container.setLocale("zh-CN");
|
|
11574
|
-
* container.setLocale({ today: "今天" });
|
|
11575
|
-
* ```
|
|
11576
|
-
* @returns {void}
|
|
11577
|
-
*/ _proto.setLocale = function setLocale(locale) {
|
|
11578
|
-
if (typeof locale === 'string') {
|
|
11579
|
-
this._setLocale();
|
|
11580
|
-
} else {
|
|
11581
|
-
this.locale = locale;
|
|
11582
|
-
}
|
|
11583
|
-
};
|
|
11584
|
-
_proto._onSuperPrev = function _onSuperPrev() {
|
|
11585
|
-
// throw new Error('Method not implemented.');
|
|
11586
|
-
};
|
|
11587
|
-
_proto._onSuperNext = function _onSuperNext() {
|
|
11588
|
-
// throw new Error('Method not implemented.');
|
|
11589
|
-
};
|
|
11590
|
-
_proto._onPrev = function _onPrev() {
|
|
11591
|
-
// throw new Error('Method not implemented.');
|
|
11592
|
-
};
|
|
11593
|
-
_proto._onNext = function _onNext() {
|
|
11594
|
-
// throw new Error('Method not implemented.');
|
|
11595
|
-
};
|
|
11596
|
-
_proto._onClose = function _onClose() {
|
|
11597
|
-
// throw new Error('Method not implemented.');
|
|
11598
|
-
};
|
|
11599
|
-
_proto._onOk = function _onOk() {
|
|
11600
|
-
// throw new Error('Method not implemented.');
|
|
11601
|
-
};
|
|
11602
|
-
return Container;
|
|
11603
|
-
}();
|
|
11604
|
-
|
|
11605
|
-
function _defineProperties$3(target, props) {
|
|
11606
|
-
for(var i = 0; i < props.length; i++){
|
|
11607
|
-
var descriptor = props[i];
|
|
11608
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
11609
|
-
descriptor.configurable = true;
|
|
11610
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
11611
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
11612
|
-
}
|
|
11613
|
-
}
|
|
11614
|
-
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
11615
|
-
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
11616
|
-
return Constructor;
|
|
11617
|
-
}
|
|
11618
|
-
function _extends$1() {
|
|
11619
|
-
_extends$1 = Object.assign || function(target) {
|
|
11620
|
-
for(var i = 1; i < arguments.length; i++){
|
|
11621
|
-
var source = arguments[i];
|
|
11622
|
-
for(var key in source){
|
|
11623
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
11624
|
-
target[key] = source[key];
|
|
11625
|
-
}
|
|
11626
|
-
}
|
|
11627
|
-
}
|
|
11628
|
-
return target;
|
|
11629
|
-
};
|
|
11630
|
-
return _extends$1.apply(this, arguments);
|
|
11631
|
-
}
|
|
11632
|
-
function _inherits$3(subClass, superClass) {
|
|
11633
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
11634
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
11635
|
-
}
|
|
11636
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
11637
|
-
constructor: {
|
|
11638
|
-
value: subClass,
|
|
11639
|
-
writable: true,
|
|
11640
|
-
configurable: true
|
|
11641
|
-
}
|
|
11642
|
-
});
|
|
11643
|
-
if (superClass) _set_prototype_of$3(subClass, superClass);
|
|
11644
|
-
}
|
|
11645
|
-
function _instanceof$2(left, right) {
|
|
11646
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
11647
|
-
return !!right[Symbol.hasInstance](left);
|
|
11648
|
-
} else {
|
|
11649
|
-
return left instanceof right;
|
|
11650
|
-
}
|
|
11651
|
-
}
|
|
11652
|
-
function _set_prototype_of$3(o, p) {
|
|
11653
|
-
_set_prototype_of$3 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
11654
|
-
o.__proto__ = p;
|
|
11655
|
-
return o;
|
|
11656
|
-
};
|
|
11657
|
-
return _set_prototype_of$3(o, p);
|
|
11658
|
-
}
|
|
11659
|
-
var _CALENDAR_PREFIX_CLS_ = 'ecalendar';
|
|
11660
|
-
var _DATE_CELL_SELECTED_ = "" + _CALENDAR_PREFIX_CLS_ + "-cell-selected";
|
|
11661
|
-
var _DATE_DISABLED_ = "" + _CONTAINER_PREFIX_CLASSNAME_ + "-disabled";
|
|
11662
|
-
/** YYYY-MM-DD */ var _ECALENDAR_FORMAT_ = 'YYYY-MM-DD';
|
|
11663
|
-
var _CALENDAR_DEFAULT_OPTIONS_ = {
|
|
11664
|
-
startOfWeek: 0,
|
|
11665
|
-
showHeader: true,
|
|
11666
|
-
showSuperPrevIcon: true,
|
|
11667
|
-
showSuperNextIcon: true,
|
|
11668
|
-
showPrevIcon: true,
|
|
11669
|
-
showNextIcon: true,
|
|
11670
|
-
language: 'zh',
|
|
11671
|
-
renderBadge: '<span class="' + _CALENDAR_PREFIX_CLS_ + '-badge"></span>',
|
|
11672
|
-
badges: []
|
|
11673
|
-
};
|
|
11674
|
-
/**
|
|
11675
|
-
* 日历
|
|
11676
|
-
* @param {CalendarOptions} options
|
|
11677
|
-
* @example
|
|
11678
|
-
* ```ts
|
|
11679
|
-
* const calendar = new Calendar(document.getElementById('container'), {
|
|
11680
|
-
* startOfWeek: 0,
|
|
11681
|
-
* language: 'en',
|
|
11682
|
-
* })
|
|
11683
|
-
*
|
|
11684
|
-
* calendar.setCurrent(new Date());
|
|
11685
|
-
* calendar.setCurrent(new Date('2025-01-01'));
|
|
11686
|
-
* ```
|
|
11687
|
-
*/ var Calendar = /*#__PURE__*/ function(Container) {
|
|
11688
|
-
_inherits$3(Calendar, Container);
|
|
11689
|
-
function Calendar(container, options) {
|
|
11690
|
-
var _this;
|
|
11691
|
-
var _this_options_badges, _this_options, _this_options1, _this_options2;
|
|
11692
|
-
_this = Container.call(this, container, _extends$1({}, _CALENDAR_DEFAULT_OPTIONS_, options, {
|
|
11693
|
-
prefixCls: _CALENDAR_PREFIX_CLS_
|
|
11694
|
-
})) || this, _this.badges = [];
|
|
11695
|
-
if ((_this_options_badges = _this.options.badges) == null ? void 0 : _this_options_badges.length) {
|
|
11696
|
-
_this._updateBadges(_this.options.badges, false);
|
|
11697
|
-
}
|
|
11698
|
-
// prettier-ignore
|
|
11699
|
-
if (((_this_options = _this.options) == null ? void 0 : _this_options.startOfWeek) && (((_this_options1 = _this.options) == null ? void 0 : _this_options1.startOfWeek) > 6 || ((_this_options2 = _this.options) == null ? void 0 : _this_options2.startOfWeek) < 0)) {
|
|
11700
|
-
_this.options.startOfWeek = 0;
|
|
11701
|
-
}
|
|
11702
|
-
_this._render();
|
|
11703
|
-
_this.setCurrent(_this.options.current, false);
|
|
11704
|
-
_this._onHeader();
|
|
11705
|
-
_this._onCell();
|
|
11706
|
-
return _this;
|
|
11707
|
-
}
|
|
11708
|
-
var _proto = Calendar.prototype;
|
|
11709
|
-
/**
|
|
11710
|
-
* 设置当前设置的日期
|
|
11711
|
-
* @param {Date | string} date 当前选择的日期
|
|
11712
|
-
* @param {boolean} change 是否触发 onChange, 默认 true
|
|
11713
|
-
* @returns {void}
|
|
11714
|
-
* @example
|
|
11715
|
-
* ```ts
|
|
11716
|
-
* calendar.setCurrent(new Date()); // 设置当前选择的日期 支持多种时间格式
|
|
11717
|
-
* ```
|
|
11718
|
-
*/ _proto.setCurrent = function setCurrent(date, change) {
|
|
11719
|
-
if (change === void 0) change = true;
|
|
11720
|
-
if (typeof date === 'string' || _instanceof$2(date, Date)) {
|
|
11721
|
-
try {
|
|
11722
|
-
date = typeof date === 'string' ? utilsTools.DateTime.toDate(date) : date;
|
|
11723
|
-
// prettier-ignore
|
|
11724
|
-
if (!this._current || utilsTools.DateTime.format(date, _ECALENDAR_FORMAT_) !== utilsTools.DateTime.format(this._current, _ECALENDAR_FORMAT_)) {
|
|
11725
|
-
this._current = date;
|
|
11726
|
-
if (change) {
|
|
11727
|
-
// prettier-ignore
|
|
11728
|
-
this.options.onChange == null ? void 0 : this.options.onChange.call(this.options, date, utilsTools.DateTime.format(date, _ECALENDAR_FORMAT_));
|
|
11729
|
-
}
|
|
11730
|
-
if (this.$body) {
|
|
11731
|
-
var // prettier-ignore
|
|
11732
|
-
_this_$body_querySelector, // prettier-ignore
|
|
11733
|
-
_this_$body_querySelector1;
|
|
11734
|
-
(_this_$body_querySelector = this.$body.querySelector("." + _DATE_CELL_SELECTED_)) == null ? void 0 : _this_$body_querySelector.classList.remove(_DATE_CELL_SELECTED_);
|
|
11735
|
-
var title = utilsTools.DateTime.format(this._current, "YYYY-MM-DD");
|
|
11736
|
-
(_this_$body_querySelector1 = this.$body.querySelector("." + _CALENDAR_PREFIX_CLS_ + "-cell-in-view[title='" + title + "']")) == null ? void 0 : _this_$body_querySelector1.classList.add(_DATE_CELL_SELECTED_);
|
|
11737
|
-
}
|
|
11738
|
-
}
|
|
11739
|
-
this._setRenderCurrent(this._current);
|
|
11740
|
-
} catch (error) {
|
|
11741
|
-
this._setRenderCurrent(new Date());
|
|
11742
|
-
}
|
|
11743
|
-
} else {
|
|
11744
|
-
this._setRenderCurrent(new Date());
|
|
11745
|
-
}
|
|
11746
|
-
};
|
|
11747
|
-
/**
|
|
11748
|
-
* 更新徽章点
|
|
11749
|
-
* @param {Array<string | Date>} badges 徽章点列表
|
|
11750
|
-
* @returns {void}
|
|
11751
|
-
* @example
|
|
11752
|
-
* ```ts
|
|
11753
|
-
* calendar.updateBadges([new Date(), new Date('2025-01-01')]);
|
|
11754
|
-
* ```
|
|
11755
|
-
*/ _proto.updateBadges = function updateBadges(badges) {
|
|
11756
|
-
this._updateBadges(badges);
|
|
11757
|
-
};
|
|
11758
|
-
/**
|
|
11759
|
-
* 更新徽章点
|
|
11760
|
-
* @param {Array<string | Date>} badges 徽章点列表
|
|
11761
|
-
* @returns {void}
|
|
11762
|
-
* @example
|
|
11763
|
-
* ```ts
|
|
11764
|
-
* calendar.updateBadges([new Date(), new Date('2025-01-01')]);
|
|
11765
|
-
* ```
|
|
11766
|
-
*/ _proto._updateBadges = function _updateBadges(badges, rerender) {
|
|
11767
|
-
if (rerender === void 0) rerender = true;
|
|
11768
|
-
if (badges == null ? void 0 : badges.length) {
|
|
11769
|
-
this.badges = badges.map(function(date) {
|
|
11770
|
-
var dateStr = utilsTools.DateTime.format(date, _ECALENDAR_FORMAT_);
|
|
11771
|
-
return dateStr;
|
|
11772
|
-
});
|
|
11773
|
-
if (rerender) this._renderDate(); // 重新渲染节点
|
|
11774
|
-
}
|
|
11775
|
-
};
|
|
11776
|
-
_proto._setRenderCurrent = function _setRenderCurrent(date) {
|
|
11777
|
-
// prettier-ignore
|
|
11778
|
-
if (!this._renderCurrent || date && utilsTools.DateTime.format(this._renderCurrent, "YYYY-MM") !== utilsTools.DateTime.format(date, "YYYY-MM")) {
|
|
11779
|
-
this._renderCurrent = date || new Date();
|
|
11780
|
-
this._renderDate();
|
|
11781
|
-
}
|
|
11782
|
-
};
|
|
11783
|
-
_proto._onCell = function _onCell() {
|
|
11784
|
-
var _this = this;
|
|
11785
|
-
// 点击日期
|
|
11786
|
-
// prettier-ignore
|
|
11787
|
-
delegate(this.$body, "." + _CALENDAR_PREFIX_CLS_ + "-cell", "click", function(event) {
|
|
11788
|
-
var date = new Date(event.delegateTarget.getAttribute('title').replace(/\//ig, "/"));
|
|
11789
|
-
_this.options.onCell == null ? void 0 : _this.options.onCell.call(_this.options, date, _this._renderCurrent);
|
|
11790
|
-
// disabled
|
|
11791
|
-
if (event.delegateTarget.classList.contains(_DATE_DISABLED_)) return;
|
|
11792
|
-
_this.setCurrent(date);
|
|
11793
|
-
event.stopPropagation();
|
|
11794
|
-
event.preventDefault();
|
|
11795
|
-
});
|
|
11796
|
-
};
|
|
11797
|
-
/**
|
|
11798
|
-
* 上一年
|
|
11799
|
-
* @override 重写 Container 的 _onSuperPrev
|
|
11800
|
-
*/ _proto._onSuperPrev = function _onSuperPrev() {
|
|
11801
|
-
var date = new Date(this._renderCurrent);
|
|
11802
|
-
date.setFullYear(date.getFullYear() - 1, date.getMonth(), date.getDate());
|
|
11803
|
-
this._setRenderCurrent(date);
|
|
11804
|
-
this.options.onPrevMonth == null ? void 0 : this.options.onPrevMonth.call(this.options, this._current, this._renderCurrent);
|
|
11805
|
-
};
|
|
11806
|
-
/**
|
|
11807
|
-
* 下一年
|
|
11808
|
-
* @override 重写 Container 的 _onSuperNext
|
|
11809
|
-
*/ _proto._onSuperNext = function _onSuperNext() {
|
|
11810
|
-
var date = new Date(this._renderCurrent);
|
|
11811
|
-
date.setFullYear(date.getFullYear() + 1, date.getMonth(), date.getDate());
|
|
11812
|
-
this._setRenderCurrent(date);
|
|
11813
|
-
this.options.onNextMonth == null ? void 0 : this.options.onNextMonth.call(this.options, this._current, this._renderCurrent);
|
|
11814
|
-
};
|
|
11815
|
-
/**
|
|
11816
|
-
* 上一月
|
|
11817
|
-
* @override 重写 Container 的 _onPrev
|
|
11818
|
-
*/ _proto._onPrev = function _onPrev() {
|
|
11819
|
-
var date = new Date(this._renderCurrent);
|
|
11820
|
-
date.setMonth(date.getMonth() - 1, date.getDate());
|
|
11821
|
-
this._setRenderCurrent(date);
|
|
11822
|
-
this.options.onPrevMonth == null ? void 0 : this.options.onPrevMonth.call(this.options, this._current, this._renderCurrent);
|
|
11823
|
-
};
|
|
11824
|
-
/**
|
|
11825
|
-
* 下一月
|
|
11826
|
-
* @override 重写 Container 的 _onNext
|
|
11827
|
-
*/ _proto._onNext = function _onNext() {
|
|
11828
|
-
var date = new Date(this._renderCurrent);
|
|
11829
|
-
date.setMonth(date.getMonth() + 1, date.getDate());
|
|
11830
|
-
this._setRenderCurrent(date);
|
|
11831
|
-
this.options.onNextMonth == null ? void 0 : this.options.onNextMonth.call(this.options, this._current, this._renderCurrent);
|
|
11832
|
-
};
|
|
11833
|
-
/**
|
|
11834
|
-
* 头部点击事件
|
|
11835
|
-
*/ _proto._onHeader = function _onHeader() {
|
|
11836
|
-
var _this = this;
|
|
11837
|
-
// prettier-ignore
|
|
11838
|
-
delegate(this.$panel, "." + _CALENDAR_PREFIX_CLS_ + "-header-month-btn", "click", function() {
|
|
11839
|
-
_this.options.onMonth == null ? void 0 : _this.options.onMonth.call(_this.options, _this._current, _this._renderCurrent);
|
|
11840
|
-
});
|
|
11841
|
-
// prettier-ignore
|
|
11842
|
-
delegate(this.$panel, "." + _CALENDAR_PREFIX_CLS_ + "-header-year-btn", "click", function() {
|
|
11843
|
-
_this.options.onYear == null ? void 0 : _this.options.onYear.call(_this.options, _this._current, _this._renderCurrent);
|
|
11844
|
-
});
|
|
11845
|
-
};
|
|
11846
|
-
/**
|
|
11847
|
-
* 点击确定
|
|
11848
|
-
* @override 覆盖Container的 _onOk
|
|
11849
|
-
*/ _proto._onOk = function _onOk() {
|
|
11850
|
-
this.options.onOk == null ? void 0 : this.options.onOk.call(this.options, this.current);
|
|
11851
|
-
};
|
|
11852
|
-
/**
|
|
11853
|
-
* 点击关闭
|
|
11854
|
-
* @override 覆盖Container的 _onClose
|
|
11855
|
-
*/ _proto._onClose = function _onClose() {
|
|
11856
|
-
this.options.onClose == null ? void 0 : this.options.onClose.call(this.options, this.current);
|
|
11857
|
-
};
|
|
11858
|
-
/**
|
|
11859
|
-
* 渲染
|
|
11860
|
-
*/ _proto._render = function _render() {
|
|
11861
|
-
var _this_locale, _this_locale1;
|
|
11862
|
-
var shiftedCustomDays = [].concat((((_this_locale = this.locale) == null ? void 0 : _this_locale.weeks) || []).slice(this.options.startOfWeek), (((_this_locale1 = this.locale) == null ? void 0 : _this_locale1.weeks) || []).slice(0, this.options.startOfWeek));
|
|
11863
|
-
this.$body.innerHTML = '<table class="' + _CALENDAR_PREFIX_CLS_ + '-content">\n <thead><tr>' + shiftedCustomDays.map(function(day) {
|
|
11864
|
-
return "<th>" + day + "</th>";
|
|
11865
|
-
}).join('') + "</tr></thead>\n <tbody></tbody>\n </table>";
|
|
11866
|
-
this.$panel.appendChild(this.$body);
|
|
11867
|
-
};
|
|
11868
|
-
/**
|
|
11869
|
-
* 渲染日期
|
|
11870
|
-
*/ _proto._renderDate = function _renderDate() {
|
|
11871
|
-
var _this = this;
|
|
11872
|
-
var _this_header, _this_$body_querySelector;
|
|
11873
|
-
if (!this.$body) {
|
|
11874
|
-
return;
|
|
11875
|
-
}
|
|
11876
|
-
var todayStr = utilsTools.DateTime.format(new Date(), _ECALENDAR_FORMAT_);
|
|
11877
|
-
var year = this._renderCurrent.getFullYear();
|
|
11878
|
-
var month = this._renderCurrent.getMonth() + 1;
|
|
11879
|
-
// prettier-ignore
|
|
11880
|
-
var dayGroupArray = Util.chunkBySize(Util.generateWeeksByYearMonth(year, month, this.options.startOfWeek), 7);
|
|
11881
|
-
var allowMonthClick = typeof this.options.onMonth === 'function';
|
|
11882
|
-
var allowYearClick = typeof this.options.onYear === 'function';
|
|
11883
|
-
if ((_this_header = this.header) == null ? void 0 : _this_header.$header) {
|
|
11884
|
-
var _this_locale_months, _this_locale, _this_locale1, _this_locale2, _this_locale3, _this_locale_months1, _this_locale4, _this_locale5;
|
|
11885
|
-
this.header.renderContent("\n " + (this.options.language !== 'zh' ? '<span class="' + _CALENDAR_PREFIX_CLS_ + "-header-month-btn " + (allowMonthClick ? _PREFIX_CLS_HEADER_HOVER_$1 : '') + '">' + ((_this_locale = this.locale) == null ? void 0 : (_this_locale_months = _this_locale.months) == null ? void 0 : _this_locale_months[+(month - 1)]) + (((_this_locale1 = this.locale) == null ? void 0 : _this_locale1.month) || '') + '</span> <span class="' + _CALENDAR_PREFIX_CLS_ + "-header-year-btn " + (allowYearClick ? _PREFIX_CLS_HEADER_HOVER_$1 : '') + '">' + year + (((_this_locale2 = this.locale) == null ? void 0 : _this_locale2.year) || '') + "</span>" : '<span class="' + _CALENDAR_PREFIX_CLS_ + "-header-year-btn " + (allowYearClick ? _PREFIX_CLS_HEADER_HOVER_$1 : '') + '">' + year + (((_this_locale3 = this.locale) == null ? void 0 : _this_locale3.year) || '') + '</span> <span class="' + _CALENDAR_PREFIX_CLS_ + "-header-month-btn " + (allowMonthClick ? _PREFIX_CLS_HEADER_HOVER_$1 : '') + '">' + ((_this_locale4 = this.locale) == null ? void 0 : (_this_locale_months1 = _this_locale4.months) == null ? void 0 : _this_locale_months1[+(month - 1)]) + (((_this_locale5 = this.locale) == null ? void 0 : _this_locale5.month) || '') + "</span>"));
|
|
11886
|
-
}
|
|
11887
|
-
// prettier-ignore
|
|
11888
|
-
if ((_this_$body_querySelector = this.$body.querySelector("." + _CALENDAR_PREFIX_CLS_ + "-content")) == null ? void 0 : _this_$body_querySelector.querySelector("tbody")) {
|
|
11889
|
-
var // prettier-ignore
|
|
11890
|
-
_this_$body_querySelector1;
|
|
11891
|
-
((_this_$body_querySelector1 = this.$body.querySelector("." + _CALENDAR_PREFIX_CLS_ + "-content")) == null ? void 0 : _this_$body_querySelector1.querySelector("tbody")).innerHTML = "\n " + dayGroupArray.slice(0, 7).map(function(dates) {
|
|
11892
|
-
return "<tr>\n " + dates.map(function(dateStr) {
|
|
11893
|
-
var _this_options;
|
|
11894
|
-
var _dateStr_split = dateStr.split('-'), y = _dateStr_split[0], m = _dateStr_split[1], d = _dateStr_split[2];
|
|
11895
|
-
var date = new Date(+y, +m, +d);
|
|
11896
|
-
var classNames = [
|
|
11897
|
-
month === +m ? "" + _CALENDAR_PREFIX_CLS_ + "-cell-in-view" : '',
|
|
11898
|
-
todayStr === dateStr ? "" + _CALENDAR_PREFIX_CLS_ + "-cell-today" : '',
|
|
11899
|
-
_this._current && utilsTools.DateTime.format(_this._current, _ECALENDAR_FORMAT_) === dateStr ? _DATE_CELL_SELECTED_ : "",
|
|
11900
|
-
typeof ((_this_options = _this.options) == null ? void 0 : _this_options.disabledDate) === 'function' && _this.options.disabledDate(utilsTools.DateTime.toDate(dateStr), dateStr) ? _DATE_DISABLED_ : ""
|
|
11901
|
-
].filter(Boolean);
|
|
11902
|
-
var badgeHtml = _this._renderBadge(date, dateStr);
|
|
11903
|
-
return '<td title="' + dateStr + '" class="' + _CALENDAR_PREFIX_CLS_ + "-cell " + classNames.join(" ") + '">\n ' + (typeof _this.options.renderDate === 'function' ? _this.options.renderDate(date, dateStr) : '<span class="' + _CALENDAR_PREFIX_CLS_ + '-cell-inner">' + Util.fillZero(+d) + "</span>") + "\n " + badgeHtml + "\n </td>";
|
|
11904
|
-
}).join('') + "\n </tr>";
|
|
11905
|
-
}).join('');
|
|
11906
|
-
}
|
|
11907
|
-
};
|
|
11908
|
-
/**
|
|
11909
|
-
* 渲染徽章
|
|
11910
|
-
* @param date
|
|
11911
|
-
* @param dateStr
|
|
11912
|
-
* @returns
|
|
11913
|
-
*/ _proto._renderBadge = function _renderBadge(date, dateStr) {
|
|
11914
|
-
var badgeHtml = '';
|
|
11915
|
-
if (typeof this.options.renderBadge === 'function') {
|
|
11916
|
-
badgeHtml = this.options.renderBadge(date, dateStr);
|
|
11917
|
-
} else if (typeof this.options.renderBadge === 'string') {
|
|
11918
|
-
badgeHtml = this.options.renderBadge;
|
|
11919
|
-
} else {
|
|
11920
|
-
badgeHtml = '';
|
|
11921
|
-
}
|
|
11922
|
-
var showBadge = typeof this.options.showBadge === 'function' ? this.options.showBadge(date, dateStr) : false;
|
|
11923
|
-
// 数组 和 showBadge 共同判断
|
|
11924
|
-
if (!(this.badges.includes(dateStr) || showBadge)) {
|
|
11925
|
-
badgeHtml = '';
|
|
11926
|
-
}
|
|
11927
|
-
return badgeHtml;
|
|
11928
|
-
};
|
|
11929
|
-
_create_class$3(Calendar, [
|
|
11930
|
-
{
|
|
11931
|
-
key: "current",
|
|
11932
|
-
get: /**
|
|
11933
|
-
* 当前选择的日期
|
|
11934
|
-
*/ function get() {
|
|
11935
|
-
return this._current;
|
|
11936
|
-
}
|
|
11937
|
-
}
|
|
11938
|
-
]);
|
|
11939
|
-
return Calendar;
|
|
11940
|
-
}(Container);
|
|
11941
|
-
Calendar.DateTime = utilsTools.DateTime;
|
|
11942
|
-
|
|
11943
|
-
function _defineProperties$2(target, props) {
|
|
11944
|
-
for(var i = 0; i < props.length; i++){
|
|
11945
|
-
var descriptor = props[i];
|
|
11946
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
11947
|
-
descriptor.configurable = true;
|
|
11948
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
11949
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
11950
|
-
}
|
|
11951
|
-
}
|
|
11952
|
-
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
11953
|
-
if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
|
|
11954
|
-
return Constructor;
|
|
11955
|
-
}
|
|
11956
|
-
function _inherits$2(subClass, superClass) {
|
|
11957
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
11958
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
11959
|
-
}
|
|
11960
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
11961
|
-
constructor: {
|
|
11962
|
-
value: subClass,
|
|
11963
|
-
writable: true,
|
|
11964
|
-
configurable: true
|
|
11965
|
-
}
|
|
11966
|
-
});
|
|
11967
|
-
if (superClass) _set_prototype_of$2(subClass, superClass);
|
|
11968
|
-
}
|
|
11969
|
-
function _instanceof$1(left, right) {
|
|
11970
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
11971
|
-
return !!right[Symbol.hasInstance](left);
|
|
11972
|
-
} else {
|
|
11973
|
-
return left instanceof right;
|
|
11974
|
-
}
|
|
11975
|
-
}
|
|
11976
|
-
function _set_prototype_of$2(o, p) {
|
|
11977
|
-
_set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
11978
|
-
o.__proto__ = p;
|
|
11979
|
-
return o;
|
|
11980
|
-
};
|
|
11981
|
-
return _set_prototype_of$2(o, p);
|
|
11982
|
-
}
|
|
11983
|
-
var _MONTH_PREFIX_CLS_ = 'emonth';
|
|
11984
|
-
var _PREFIX_CLS_SELECTED_ = "" + _MONTH_PREFIX_CLS_ + "-cell-selected";
|
|
11985
|
-
var _PREFIX_CLS_HEADER_HOVER_ = "" + _CONTAINER_PREFIX_CLASSNAME_ + "-header-title-hover";
|
|
11986
|
-
var _PREFIX_CLS_DISABLED_ = "" + _CONTAINER_PREFIX_CLASSNAME_ + "-disabled";
|
|
11987
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11988
|
-
var _Month_DEFAULT_OPTIONS_ = {
|
|
11989
|
-
showHeader: true,
|
|
11990
|
-
showSuperPrevIcon: true,
|
|
11991
|
-
showSuperNextIcon: true,
|
|
11992
|
-
language: 'zh'
|
|
11993
|
-
};
|
|
11994
|
-
/**
|
|
11995
|
-
* 月历 (12 月)
|
|
11996
|
-
* @param popupContainer
|
|
11997
|
-
* @param options
|
|
11998
|
-
* @returns
|
|
11999
|
-
* @example
|
|
12000
|
-
* ```ts
|
|
12001
|
-
* const month = new Month(document.body, {
|
|
12002
|
-
* onChange: (date: Date) => {}
|
|
12003
|
-
* })
|
|
12004
|
-
* month.setCurrent("2025-01")
|
|
12005
|
-
* ```
|
|
12006
|
-
*/ var Month = /*#__PURE__*/ function(Container) {
|
|
12007
|
-
_inherits$2(Month, Container);
|
|
12008
|
-
function Month(popupContainer, options) {
|
|
12009
|
-
var _this;
|
|
12010
|
-
_this = Container.call(this, popupContainer, deepmerge.all([
|
|
12011
|
-
{},
|
|
12012
|
-
_Month_DEFAULT_OPTIONS_,
|
|
12013
|
-
options || {},
|
|
12014
|
-
{
|
|
12015
|
-
showPrevIcon: false,
|
|
12016
|
-
showNextIcon: false,
|
|
12017
|
-
prefixCls: _MONTH_PREFIX_CLS_
|
|
12018
|
-
}
|
|
12019
|
-
], {
|
|
12020
|
-
clone: false
|
|
12021
|
-
})) || this;
|
|
12022
|
-
_this._render();
|
|
12023
|
-
_this.setCurrent(_this.options.current, false);
|
|
12024
|
-
_this._onHeaderTitle();
|
|
12025
|
-
_this._onCell();
|
|
12026
|
-
return _this;
|
|
12027
|
-
}
|
|
12028
|
-
var _proto = Month.prototype;
|
|
12029
|
-
/**
|
|
12030
|
-
* 设置选中月份
|
|
12031
|
-
* @param date 日期
|
|
12032
|
-
* @param {boolean} change 是否触发 onChange 事件
|
|
12033
|
-
* @example
|
|
12034
|
-
* ```ts
|
|
12035
|
-
* month.setCurrent("2025-01")
|
|
12036
|
-
* ```
|
|
12037
|
-
*/ _proto.setCurrent = function setCurrent(date, change) {
|
|
12038
|
-
if (change === void 0) change = true;
|
|
12039
|
-
this._setCurrent(date, change);
|
|
12040
|
-
};
|
|
12041
|
-
/**
|
|
12042
|
-
* 设置选中月份
|
|
12043
|
-
* @param date 日期
|
|
12044
|
-
* @param {boolean} change 是否触发 onChange 事件
|
|
12045
|
-
*/ _proto._setCurrent = function _setCurrent(date, change) {
|
|
12046
|
-
if (typeof date === 'string' || _instanceof$1(date, Date)) {
|
|
12047
|
-
try {
|
|
12048
|
-
var d = date;
|
|
12049
|
-
if (typeof d === 'string') {
|
|
12050
|
-
d = utilsTools.DateTime.toDate(d);
|
|
12051
|
-
}
|
|
12052
|
-
var current = d;
|
|
12053
|
-
if (!this._current && current || utilsTools.DateTime.format(current, 'YYYY-MM') !== utilsTools.DateTime.format(this._current, 'YYYY-MM')) {
|
|
12054
|
-
this._current = current;
|
|
12055
|
-
if (typeof this.options.onChange === 'function' && change) {
|
|
12056
|
-
this.options.onChange == null ? void 0 : this.options.onChange.call(this.options, current, utilsTools.DateTime.format(current, 'YYYY-MM'));
|
|
12057
|
-
}
|
|
12058
|
-
}
|
|
12059
|
-
this._setRenderCurrent(current);
|
|
12060
|
-
} catch (error) {
|
|
12061
|
-
this._setRenderCurrent(new Date());
|
|
12062
|
-
console.warn('Invalid date!', error);
|
|
12063
|
-
}
|
|
12064
|
-
} else {
|
|
12065
|
-
this._setRenderCurrent(new Date());
|
|
12066
|
-
}
|
|
12067
|
-
};
|
|
12068
|
-
_proto._setRenderCurrent = function _setRenderCurrent(date) {
|
|
12069
|
-
// 判断的年份是否变换
|
|
12070
|
-
// prettier-ignore
|
|
12071
|
-
if (!this._renderCurrent || this._renderCurrent && utilsTools.DateTime.format(date, "YYYY") !== utilsTools.DateTime.format(this._renderCurrent, "YYYY")) {
|
|
12072
|
-
this._renderCurrent = date;
|
|
12073
|
-
this._renderMonths(date.getFullYear());
|
|
12074
|
-
}
|
|
12075
|
-
if (this._current) {
|
|
12076
|
-
var // prettier-ignore
|
|
12077
|
-
_this_$body_querySelector, // prettier-ignore
|
|
12078
|
-
_this_$body_querySelector1;
|
|
12079
|
-
(_this_$body_querySelector = this.$body.querySelector("." + _PREFIX_CLS_SELECTED_)) == null ? void 0 : _this_$body_querySelector.classList.remove(_PREFIX_CLS_SELECTED_);
|
|
12080
|
-
var selectedTitle = utilsTools.DateTime.format(this._current, 'YYYY-MM');
|
|
12081
|
-
(_this_$body_querySelector1 = this.$body.querySelector("." + _MONTH_PREFIX_CLS_ + "-cell-in-view[title='" + selectedTitle + "']")) == null ? void 0 : _this_$body_querySelector1.classList.add(_PREFIX_CLS_SELECTED_);
|
|
12082
|
-
}
|
|
12083
|
-
this._setHeader();
|
|
12084
|
-
};
|
|
12085
|
-
/**
|
|
12086
|
-
* 点击确定
|
|
12087
|
-
* @override 重写 Container 的 _onOk
|
|
12088
|
-
*/ _proto._onOk = function _onOk() {
|
|
12089
|
-
this.options.onOk == null ? void 0 : this.options.onOk.call(this.options, this.current);
|
|
12090
|
-
};
|
|
12091
|
-
/**
|
|
12092
|
-
* 点击关闭
|
|
12093
|
-
* @override 重写 Container 的 _onClose
|
|
12094
|
-
*/ _proto._onClose = function _onClose() {
|
|
12095
|
-
this.options.onClose == null ? void 0 : this.options.onClose.call(this.options, this.current);
|
|
12096
|
-
};
|
|
12097
|
-
/**
|
|
12098
|
-
* 点击月份
|
|
12099
|
-
*/ _proto._onCell = function _onCell() {
|
|
12100
|
-
var _this = this;
|
|
12101
|
-
// 点击月份
|
|
12102
|
-
// prettier-ignore
|
|
12103
|
-
delegate(this.$body, "." + _MONTH_PREFIX_CLS_ + "-cell", "click", function(e) {
|
|
12104
|
-
e.stopPropagation();
|
|
12105
|
-
e.preventDefault();
|
|
12106
|
-
var month = e.delegateTarget.getAttribute('title');
|
|
12107
|
-
var date = utilsTools.DateTime.toDate(month + utilsTools.DateTime.format(_this._renderCurrent, "-DDTHH:mm:ss")) // new Date(month.replace(/-/g, "/") + `/${this.current?.getDate() || "01"}`);
|
|
12108
|
-
;
|
|
12109
|
-
_this.options.onCell == null ? void 0 : _this.options.onCell.call(_this.options, date, utilsTools.DateTime.format(date, "YYYY-MM"));
|
|
12110
|
-
if (e.delegateTarget.classList.contains(_PREFIX_CLS_DISABLED_)) return;
|
|
12111
|
-
_this.setCurrent(date);
|
|
12112
|
-
});
|
|
12113
|
-
};
|
|
12114
|
-
/**
|
|
12115
|
-
* 上一年
|
|
12116
|
-
* @override 重写 Container 的 _onSuperPrev
|
|
12117
|
-
*/ _proto._onSuperPrev = function _onSuperPrev() {
|
|
12118
|
-
var year = this._renderCurrent.getFullYear() - 1;
|
|
12119
|
-
var date = utilsTools.DateTime.toDate(year + utilsTools.DateTime.format(this._renderCurrent, '-MM-DDTHH:mm:ss'));
|
|
12120
|
-
this._setRenderCurrent(date);
|
|
12121
|
-
this.options.onSuperPrev == null ? void 0 : this.options.onSuperPrev.call(this.options, this._current, this._renderCurrent);
|
|
12122
|
-
};
|
|
12123
|
-
/**
|
|
12124
|
-
* 下一年
|
|
12125
|
-
* @override 重写 Container 的 _onSuperNext
|
|
12126
|
-
*/ _proto._onSuperNext = function _onSuperNext() {
|
|
12127
|
-
var year = this._renderCurrent.getFullYear() + 1;
|
|
12128
|
-
var date = utilsTools.DateTime.toDate(year + utilsTools.DateTime.format(this._renderCurrent, '-MM-DDTHH:mm:ss'));
|
|
12129
|
-
this._setRenderCurrent(date);
|
|
12130
|
-
this.options.onSuperNext == null ? void 0 : this.options.onSuperNext.call(this.options, this._current, this._renderCurrent);
|
|
12131
|
-
};
|
|
12132
|
-
/**
|
|
12133
|
-
* 点击头部标题
|
|
12134
|
-
*/ _proto._onHeaderTitle = function _onHeaderTitle() {
|
|
12135
|
-
var _this = this;
|
|
12136
|
-
// prettier-ignore
|
|
12137
|
-
delegate(this.$panel, "." + _PREFIX_CLS_HEADER_HOVER_, "click", function() {
|
|
12138
|
-
_this.options.onYear == null ? void 0 : _this.options.onYear.call(_this.options, _this._current, _this._renderCurrent);
|
|
12139
|
-
});
|
|
12140
|
-
};
|
|
12141
|
-
_proto._setHeader = function _setHeader() {
|
|
12142
|
-
if (this.$panel.querySelector("." + _MONTH_PREFIX_CLS_ + "-header-view")) {
|
|
12143
|
-
var allowClick = typeof this.options.onYear === 'function';
|
|
12144
|
-
// prettier-ignore
|
|
12145
|
-
this.$panel.querySelector("." + _MONTH_PREFIX_CLS_ + "-header-view").innerHTML = '<span class="' + (allowClick ? _PREFIX_CLS_HEADER_HOVER_ : "") + '">' + this._renderCurrent.getFullYear() + this.locale.year + "</span>";
|
|
12146
|
-
}
|
|
12147
|
-
};
|
|
12148
|
-
_proto._setDisabled = function _setDisabled() {
|
|
12149
|
-
var year = this._renderCurrent.getFullYear();
|
|
12150
|
-
for(var i = 0; i < 12; i++){
|
|
12151
|
-
// prettier-ignore
|
|
12152
|
-
var $cell = this.$body.querySelector("." + _MONTH_PREFIX_CLS_ + "-cell[title='" + year + "-" + Util.fillZero(i + 1) + "']");
|
|
12153
|
-
if ($cell) {
|
|
12154
|
-
var date = utilsTools.DateTime.toDate(year + "-" + Util.fillZero(i + 1) + "-" + utilsTools.DateTime.format(this._renderCurrent, 'DDTHH:mm:ss'));
|
|
12155
|
-
// prettier-ignore
|
|
12156
|
-
var disable = typeof this.options.disabledMonth === "function" ? this.options.disabledMonth(date, utilsTools.DateTime.format(date, "YYYY-MM")) : false;
|
|
12157
|
-
if (disable) {
|
|
12158
|
-
$cell.classList.add(_PREFIX_CLS_DISABLED_);
|
|
12159
|
-
} else {
|
|
12160
|
-
$cell.classList.remove(_PREFIX_CLS_DISABLED_);
|
|
12161
|
-
}
|
|
12162
|
-
}
|
|
12163
|
-
}
|
|
12164
|
-
};
|
|
12165
|
-
_proto._render = function _render() {
|
|
12166
|
-
this.$body.innerHTML = '<table class="' + _MONTH_PREFIX_CLS_ + '-content"></table>';
|
|
12167
|
-
this.$panel.appendChild(this.$body);
|
|
12168
|
-
};
|
|
12169
|
-
_proto._renderMonths = function _renderMonths(year) {
|
|
12170
|
-
var _this = this;
|
|
12171
|
-
if (this.$body.querySelector("." + _MONTH_PREFIX_CLS_ + "-content")) {
|
|
12172
|
-
// prettier-ignore
|
|
12173
|
-
this.$body.querySelector("." + _MONTH_PREFIX_CLS_ + "-content").innerHTML = "\n <tbody>\n " + Util.chunkBySize(this.locale.months, 3).slice(0, 4).map(function(month, index) {
|
|
12174
|
-
return "<tr>\n " + month.map(function(m, i) {
|
|
12175
|
-
var classNames = _MONTH_PREFIX_CLS_ + "-cell " + _MONTH_PREFIX_CLS_ + "-cell-in-view";
|
|
12176
|
-
return '<td title="' + year + "-" + Util.fillZero(index * 3 + i + 1) + '" class="' + classNames + '">\n <span class="' + _MONTH_PREFIX_CLS_ + '-cell-inner">' + (_this.options.monthRender && typeof _this.options.monthRender === "function" ? _this.options.monthRender(utilsTools.DateTime.toDate(year + "-" + Util.fillZero(index * 3 + i + 1)), year + "-" + Util.fillZero(index * 3 + i + 1)) || '' : m) + "</span>\n </td>";
|
|
12177
|
-
}).join("") + "\n </tr>";
|
|
12178
|
-
}).join("") + "\n </tbody>";
|
|
12179
|
-
}
|
|
12180
|
-
this._setDisabled();
|
|
12181
|
-
};
|
|
12182
|
-
_create_class$2(Month, [
|
|
12183
|
-
{
|
|
12184
|
-
key: "current",
|
|
12185
|
-
get: /**
|
|
12186
|
-
* 当前选中的月份日期
|
|
12187
|
-
* @example
|
|
12188
|
-
* ```ts
|
|
12189
|
-
* month.current
|
|
12190
|
-
* ```
|
|
12191
|
-
* @returns {Date}
|
|
12192
|
-
*/ function get() {
|
|
12193
|
-
return this._current;
|
|
12194
|
-
}
|
|
12195
|
-
}
|
|
12196
|
-
]);
|
|
12197
|
-
return Month;
|
|
12198
|
-
}(Container);
|
|
12199
|
-
|
|
12200
|
-
function _defineProperties$1(target, props) {
|
|
12201
|
-
for(var i = 0; i < props.length; i++){
|
|
12202
|
-
var descriptor = props[i];
|
|
12203
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
12204
|
-
descriptor.configurable = true;
|
|
12205
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
12206
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
12207
|
-
}
|
|
12208
|
-
}
|
|
12209
|
-
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
12210
|
-
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
12211
|
-
return Constructor;
|
|
12212
|
-
}
|
|
12213
|
-
function _inherits$1(subClass, superClass) {
|
|
12214
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
12215
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
12216
|
-
}
|
|
12217
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
12218
|
-
constructor: {
|
|
12219
|
-
value: subClass,
|
|
12220
|
-
writable: true,
|
|
12221
|
-
configurable: true
|
|
12222
|
-
}
|
|
12223
|
-
});
|
|
12224
|
-
if (superClass) _set_prototype_of$1(subClass, superClass);
|
|
12225
|
-
}
|
|
12226
|
-
function _instanceof(left, right) {
|
|
12227
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
12228
|
-
return !!right[Symbol.hasInstance](left);
|
|
12229
|
-
} else {
|
|
12230
|
-
return left instanceof right;
|
|
12231
|
-
}
|
|
12232
|
-
}
|
|
12233
|
-
function _set_prototype_of$1(o, p) {
|
|
12234
|
-
_set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
12235
|
-
o.__proto__ = p;
|
|
12236
|
-
return o;
|
|
12237
|
-
};
|
|
12238
|
-
return _set_prototype_of$1(o, p);
|
|
12239
|
-
}
|
|
12240
|
-
var _YEAR_PREFIX_CLS_ = 'eyear';
|
|
12241
|
-
var _PREFIX_CLS_DATE_SELECTED_ = "" + _YEAR_PREFIX_CLS_ + "-cell-selected";
|
|
12242
|
-
var _DISABLED_CLASS_ = "" + _CONTAINER_PREFIX_CLASSNAME_ + "-disabled";
|
|
12243
|
-
var _YEAR_DEFAULT_OPTIONS_ = {
|
|
12244
|
-
showHeader: true,
|
|
12245
|
-
showSuperPrevIcon: true,
|
|
12246
|
-
showSuperNextIcon: true,
|
|
12247
|
-
language: 'zh',
|
|
12248
|
-
prefixCls: _YEAR_PREFIX_CLS_
|
|
12249
|
-
};
|
|
12250
|
-
/**
|
|
12251
|
-
* 年历 (12 年)
|
|
12252
|
-
* @example
|
|
12253
|
-
* ```ts
|
|
12254
|
-
* const year = new Year(document.body, {
|
|
12255
|
-
* onChange: (date: Date) => {}
|
|
12256
|
-
* })
|
|
12257
|
-
* year.setCurrent(2023)
|
|
12258
|
-
* ```
|
|
12259
|
-
*/ var Year = /*#__PURE__*/ function(Container) {
|
|
12260
|
-
_inherits$1(Year, Container);
|
|
12261
|
-
function Year(popupContainer, options) {
|
|
12262
|
-
var _this;
|
|
12263
|
-
_this = Container.call(this, popupContainer, deepmerge.all([
|
|
12264
|
-
{},
|
|
12265
|
-
_YEAR_DEFAULT_OPTIONS_,
|
|
12266
|
-
options || {},
|
|
12267
|
-
{
|
|
12268
|
-
showPrevIcon: false,
|
|
12269
|
-
showNextIcon: false,
|
|
12270
|
-
renderPrevIcon: '',
|
|
12271
|
-
renderNextIcon: ''
|
|
12272
|
-
}
|
|
12273
|
-
], {
|
|
12274
|
-
clone: false
|
|
12275
|
-
})) || this;
|
|
12276
|
-
_this._render();
|
|
12277
|
-
_this._setCurrent(_this.options.current, false);
|
|
12278
|
-
_this._onCell();
|
|
12279
|
-
return _this;
|
|
12280
|
-
}
|
|
12281
|
-
var _proto = Year.prototype;
|
|
12282
|
-
/**
|
|
12283
|
-
* 设置当前年份
|
|
12284
|
-
* @param year
|
|
12285
|
-
* @param change 是否触发 onChange 事件
|
|
12286
|
-
* @returns
|
|
12287
|
-
* @example
|
|
12288
|
-
* ```ts
|
|
12289
|
-
* year.setCurrent(2023)
|
|
12290
|
-
* ```
|
|
12291
|
-
*/ _proto.setCurrent = function setCurrent(year, change) {
|
|
12292
|
-
if (change === void 0) change = true;
|
|
12293
|
-
console.log('year setCurrent', year);
|
|
12294
|
-
this._setCurrent(year, change);
|
|
12295
|
-
};
|
|
12296
|
-
_proto._setCurrent = function _setCurrent(year, change) {
|
|
12297
|
-
if (change === void 0) change = true;
|
|
12298
|
-
var _this__current;
|
|
12299
|
-
var _year = typeof year === 'number' ? utilsTools.DateTime.toDate(year) : _instanceof(year, Date) ? year : new Date();
|
|
12300
|
-
if (_year.getFullYear() !== ((_this__current = this._current) == null ? void 0 : _this__current.getFullYear())) {
|
|
12301
|
-
this._current = _year;
|
|
12302
|
-
if (typeof this.options.onChange === 'function' && change) {
|
|
12303
|
-
this.options.onChange(_year);
|
|
12304
|
-
}
|
|
12305
|
-
}
|
|
12306
|
-
this._renderTenYear = (this._current || new Date()).getFullYear();
|
|
12307
|
-
this._renderYearList();
|
|
12308
|
-
};
|
|
12309
|
-
/**
|
|
12310
|
-
* 点击确定
|
|
12311
|
-
* @override 重写 Container 的 _onOk
|
|
12312
|
-
*/ _proto._onOk = function _onOk() {
|
|
12313
|
-
this.options.onOk == null ? void 0 : this.options.onOk.call(this.options, this.current);
|
|
12314
|
-
};
|
|
12315
|
-
/**
|
|
12316
|
-
* 点击关闭
|
|
12317
|
-
* @override 重写 Container 的 _onClose
|
|
12318
|
-
*/ _proto._onClose = function _onClose() {
|
|
12319
|
-
this.options.onClose == null ? void 0 : this.options.onClose.call(this.options, this.current);
|
|
12320
|
-
};
|
|
12321
|
-
/**
|
|
12322
|
-
* 点击年份
|
|
12323
|
-
*/ _proto._onCell = function _onCell() {
|
|
12324
|
-
var _this = this;
|
|
12325
|
-
// 点击年
|
|
12326
|
-
// prettier-ignore
|
|
12327
|
-
delegate(this.$body, "." + _YEAR_PREFIX_CLS_ + "-cell", "click", function(e) {
|
|
12328
|
-
var yearStr = +e.delegateTarget.getAttribute('title');
|
|
12329
|
-
// WARN: this._current 是一个对象, 不能直接改变年,否则 _setCurrent 中判断会有问题
|
|
12330
|
-
var newDate = utilsTools.DateTime.toDate(utilsTools.DateTime.format(_this._current, "yyyy-MM-dd HH:mm:ss"));
|
|
12331
|
-
newDate.setFullYear(yearStr);
|
|
12332
|
-
_this.options.onCell == null ? void 0 : _this.options.onCell.call(_this.options, newDate);
|
|
12333
|
-
if (e.delegateTarget.classList.contains(_DISABLED_CLASS_)) return;
|
|
12334
|
-
_this._setCurrent(newDate);
|
|
12335
|
-
e.stopPropagation();
|
|
12336
|
-
e.preventDefault();
|
|
12337
|
-
});
|
|
12338
|
-
};
|
|
12339
|
-
/**
|
|
12340
|
-
* 上十年
|
|
12341
|
-
* @override 重写 Container 的 _onSuperPrev
|
|
12342
|
-
*/ _proto._onSuperPrev = function _onSuperPrev() {
|
|
12343
|
-
this._renderTenYear = this._renderTenYear - 10;
|
|
12344
|
-
this.options.onPrevYear == null ? void 0 : this.options.onPrevYear.call(this.options, this._current, Util.generateYears(this._renderTenYear));
|
|
12345
|
-
this._renderYearList();
|
|
12346
|
-
};
|
|
12347
|
-
/**
|
|
12348
|
-
* 下十年
|
|
12349
|
-
* @override 重写 Container 的 _onSuperNext
|
|
12350
|
-
*/ _proto._onSuperNext = function _onSuperNext() {
|
|
12351
|
-
this._renderTenYear = this._renderTenYear + 10;
|
|
12352
|
-
this.options.onNextYear == null ? void 0 : this.options.onNextYear.call(this.options, this._current, Util.generateYears(this._renderTenYear));
|
|
12353
|
-
this._renderYearList();
|
|
12354
|
-
};
|
|
12355
|
-
_proto._render = function _render() {
|
|
12356
|
-
this.$body.innerHTML = '<table class="' + _YEAR_PREFIX_CLS_ + '-content"></table>';
|
|
12357
|
-
this.$panel.appendChild(this.$body);
|
|
12358
|
-
};
|
|
12359
|
-
_proto._renderYearList = function _renderYearList() {
|
|
12360
|
-
var _this = this;
|
|
12361
|
-
var _this_header;
|
|
12362
|
-
var list = Util.generateYears(this._renderTenYear);
|
|
12363
|
-
(_this_header = this.header) == null ? void 0 : _this_header.renderContent(list[1] + " - " + list[list.length - 2]);
|
|
12364
|
-
if (this.$body.querySelector("." + _YEAR_PREFIX_CLS_ + "-content")) {
|
|
12365
|
-
// prettier-ignore
|
|
12366
|
-
this.$body.querySelector("." + _YEAR_PREFIX_CLS_ + "-content").innerHTML = "\n <tbody>\n " + Util.chunkBySize(list, 3).slice(0, 4).map(function(years, i) {
|
|
12367
|
-
return "<tr>\n " + years.map(function(y, j) {
|
|
12368
|
-
// prettier-ignore
|
|
12369
|
-
var classNames = i === 0 && j === 0 || i === 3 && j === 2 ? "" + _YEAR_PREFIX_CLS_ + "-cell" : _YEAR_PREFIX_CLS_ + "-cell " + _YEAR_PREFIX_CLS_ + "-cell-in-view";
|
|
12370
|
-
// prettier-ignore
|
|
12371
|
-
if (+y === +_this._current.getFullYear()) classNames = classNames + " " + _PREFIX_CLS_DATE_SELECTED_;
|
|
12372
|
-
// prettier-ignore
|
|
12373
|
-
var disable = typeof _this.options.disabledYear === "function" ? _this.options.disabledYear(utilsTools.DateTime.toDate(y), y) : false;
|
|
12374
|
-
if (disable) classNames = classNames + " " + _DISABLED_CLASS_;
|
|
12375
|
-
return '<td title="' + y + '" class="' + classNames + '">\n ' + (_this.options.yearRender && typeof _this.options.yearRender === "function" ? _this.options.yearRender(utilsTools.DateTime.toDate(y), y) : '<span class="' + _YEAR_PREFIX_CLS_ + '-cell-inner">' + +y + "</span>") + "\n </td>";
|
|
12376
|
-
}).join("") + "\n </tr>";
|
|
12377
|
-
}).join("") + "\n </tbody>\n ";
|
|
12378
|
-
}
|
|
12379
|
-
};
|
|
12380
|
-
_create_class$1(Year, [
|
|
12381
|
-
{
|
|
12382
|
-
key: "current",
|
|
12383
|
-
get: /**
|
|
12384
|
-
* 当前年份
|
|
12385
|
-
* @example
|
|
12386
|
-
* ```ts
|
|
12387
|
-
* year.current
|
|
12388
|
-
* ```
|
|
12389
|
-
*/ function get() {
|
|
12390
|
-
return this._current;
|
|
12391
|
-
}
|
|
12392
|
-
}
|
|
12393
|
-
]);
|
|
12394
|
-
return Year;
|
|
12395
|
-
}(Container);
|
|
12396
|
-
|
|
12397
|
-
function _defineProperties(target, props) {
|
|
12398
|
-
for(var i = 0; i < props.length; i++){
|
|
12399
|
-
var descriptor = props[i];
|
|
12400
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
12401
|
-
descriptor.configurable = true;
|
|
12402
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
12403
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
12404
|
-
}
|
|
12405
|
-
}
|
|
12406
|
-
function _create_class(Constructor, protoProps, staticProps) {
|
|
12407
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
12408
|
-
return Constructor;
|
|
12409
|
-
}
|
|
12410
|
-
function _extends() {
|
|
12411
|
-
_extends = Object.assign || function(target) {
|
|
12412
|
-
for(var i = 1; i < arguments.length; i++){
|
|
12413
|
-
var source = arguments[i];
|
|
12414
|
-
for(var key in source){
|
|
12415
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12416
|
-
target[key] = source[key];
|
|
12417
|
-
}
|
|
12418
|
-
}
|
|
12419
|
-
}
|
|
12420
|
-
return target;
|
|
12421
|
-
};
|
|
12422
|
-
return _extends.apply(this, arguments);
|
|
12423
|
-
}
|
|
12424
|
-
function _inherits(subClass, superClass) {
|
|
12425
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
12426
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
12427
|
-
}
|
|
12428
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
12429
|
-
constructor: {
|
|
12430
|
-
value: subClass,
|
|
12431
|
-
writable: true,
|
|
12432
|
-
configurable: true
|
|
12433
|
-
}
|
|
12434
|
-
});
|
|
12435
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
12436
|
-
}
|
|
12437
|
-
function _set_prototype_of(o, p) {
|
|
12438
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
12439
|
-
o.__proto__ = p;
|
|
12440
|
-
return o;
|
|
12441
|
-
};
|
|
12442
|
-
return _set_prototype_of(o, p);
|
|
12443
|
-
}
|
|
12444
|
-
var _DATEPICKER_MODE_ARRAY = [
|
|
12445
|
-
'date',
|
|
12446
|
-
'month',
|
|
12447
|
-
'year'
|
|
12448
|
-
];
|
|
12449
|
-
var _DATEPICKER_DEFAULT_OPTIONS_ = {
|
|
12450
|
-
getPopupContainer: function() {
|
|
12451
|
-
return document.body;
|
|
12452
|
-
},
|
|
12453
|
-
language: 'zh',
|
|
12454
|
-
isMobile: false,
|
|
12455
|
-
mode: _DATEPICKER_MODE_ARRAY[0]
|
|
12456
|
-
};
|
|
12457
|
-
/**
|
|
12458
|
-
* date picker
|
|
12459
|
-
* @example
|
|
12460
|
-
* ```ts
|
|
12461
|
-
* const datePicker = new DatePicker(document.getElementById('picker'), {
|
|
12462
|
-
* onChange: (date) => {}
|
|
12463
|
-
* })
|
|
12464
|
-
* datePicker.setCurrent(new Date())
|
|
12465
|
-
* ```
|
|
12466
|
-
*/ var DatePicker = /*#__PURE__*/ function(Picker) {
|
|
12467
|
-
_inherits(DatePicker, Picker);
|
|
12468
|
-
function DatePicker(container, options) {
|
|
12469
|
-
var _this;
|
|
12470
|
-
_this = Picker.call(this, container, deepmerge.all([
|
|
12471
|
-
{},
|
|
12472
|
-
_DATEPICKER_DEFAULT_OPTIONS_,
|
|
12473
|
-
options || {},
|
|
12474
|
-
{
|
|
12475
|
-
wrapClassName: (_CONTAINER_PREFIX_CLASSNAME_ + "-picker-container " + ((options == null ? void 0 : options.wrapClassName) || '')).trim()
|
|
12476
|
-
}
|
|
12477
|
-
], {
|
|
12478
|
-
clone: false
|
|
12479
|
-
})) || this, _this.current = null, _this._current = null, _this._calendar = null, _this._month = null, _this._year = null, _this._currentMode = 'date';
|
|
12480
|
-
_this.options = deepmerge.all([
|
|
12481
|
-
{},
|
|
12482
|
-
_DATEPICKER_DEFAULT_OPTIONS_,
|
|
12483
|
-
options || {}
|
|
12484
|
-
], {
|
|
12485
|
-
clone: false
|
|
12486
|
-
});
|
|
12487
|
-
if (_this.options.current) {
|
|
12488
|
-
_this.current = _this.options.current;
|
|
12489
|
-
_this._current = _this.options.current;
|
|
12490
|
-
}
|
|
12491
|
-
_this._currentMode = _this.options.mode;
|
|
12492
|
-
_this._switchMode();
|
|
12493
|
-
return _this;
|
|
12494
|
-
}
|
|
12495
|
-
var _proto = DatePicker.prototype;
|
|
12496
|
-
/**
|
|
12497
|
-
* 设置选中日期
|
|
12498
|
-
* @param date 日期
|
|
12499
|
-
* @param {boolean} change 是否触发 onChange 事件
|
|
12500
|
-
* @example
|
|
12501
|
-
* ```ts
|
|
12502
|
-
* datePicker.setCurrent(2025)
|
|
12503
|
-
* datePicker.setCurrent(new Date())
|
|
12504
|
-
* datePicker.setCurrent(new Date(), false)
|
|
12505
|
-
* ```
|
|
12506
|
-
*/ _proto.setCurrent = function setCurrent(date, change) {
|
|
12507
|
-
if (change === void 0) change = true;
|
|
12508
|
-
this._setCurrent(date, change);
|
|
12509
|
-
};
|
|
12510
|
-
/**
|
|
12511
|
-
* 更新徽章点
|
|
12512
|
-
* @param {Array<string | Date>} badges 徽章点列表
|
|
12513
|
-
* @example
|
|
12514
|
-
* ```ts
|
|
12515
|
-
* datePicker.updateBadges([new Date(), "2025-01-01"])
|
|
12516
|
-
* ```
|
|
12517
|
-
*/ _proto.updateBadges = function updateBadges(badges) {
|
|
12518
|
-
if (badges == null ? void 0 : badges.length) {
|
|
12519
|
-
var _this__calendar;
|
|
12520
|
-
(_this__calendar = this._calendar) == null ? void 0 : _this__calendar.updateBadges(badges);
|
|
12521
|
-
}
|
|
12522
|
-
};
|
|
12523
|
-
/**
|
|
12524
|
-
* 销毁
|
|
12525
|
-
* @example
|
|
12526
|
-
* ```ts
|
|
12527
|
-
* datePicker.destroy()
|
|
12528
|
-
* ```
|
|
12529
|
-
*/ _proto.destroy = function destroy() {
|
|
12530
|
-
var _this__calendar, _this__month, _this__year;
|
|
12531
|
-
(_this__calendar = this._calendar) == null ? void 0 : _this__calendar.destroy();
|
|
12532
|
-
this._calendar = null;
|
|
12533
|
-
(_this__month = this._month) == null ? void 0 : _this__month.destroy();
|
|
12534
|
-
this._month = null;
|
|
12535
|
-
(_this__year = this._year) == null ? void 0 : _this__year.destroy();
|
|
12536
|
-
this._year = null;
|
|
12537
|
-
Picker.prototype.destroy.call(this);
|
|
12538
|
-
};
|
|
12539
|
-
/**
|
|
12540
|
-
* 设置选中日期
|
|
12541
|
-
* @param date 日期
|
|
12542
|
-
* @param {boolean} change 是否触发 onChange 事件
|
|
12543
|
-
*/ _proto._setCurrent = function _setCurrent(date, change) {
|
|
12544
|
-
if (change === void 0) change = true;
|
|
12545
|
-
var _this__calendar, _this__month, _this__year;
|
|
12546
|
-
this._current = date;
|
|
12547
|
-
(_this__calendar = this._calendar) == null ? void 0 : _this__calendar.setCurrent(date, change);
|
|
12548
|
-
(_this__month = this._month) == null ? void 0 : _this__month.setCurrent(date, change);
|
|
12549
|
-
(_this__year = this._year) == null ? void 0 : _this__year.setCurrent(date, change);
|
|
12550
|
-
};
|
|
12551
|
-
_proto._switchMode = function _switchMode() {
|
|
12552
|
-
this.$body.classList.add(_CONTAINER_PREFIX_CLASSNAME_ + "-picker-" + this._currentMode);
|
|
12553
|
-
if (this._currentMode === 'date') {
|
|
12554
|
-
this._initCalendar();
|
|
12555
|
-
} else if (this._currentMode === 'month') {
|
|
12556
|
-
this._initMonth();
|
|
12557
|
-
} else if (this._currentMode === 'year') {
|
|
12558
|
-
this._initYear();
|
|
12559
|
-
}
|
|
12560
|
-
// 内容尺寸会变化
|
|
12561
|
-
this.setPlacement(this.options.placement || 'top');
|
|
12562
|
-
};
|
|
12563
|
-
_proto._hide = function _hide() {
|
|
12564
|
-
this.open = false;
|
|
12565
|
-
};
|
|
12566
|
-
/**
|
|
12567
|
-
* @overload 重置
|
|
12568
|
-
* @param open
|
|
12569
|
-
*/ _proto._onOpenChange = function _onOpenChange(open) {
|
|
12570
|
-
Picker.prototype._onOpenChange.call(this, open);
|
|
12571
|
-
if (open) {
|
|
12572
|
-
this._removeCurrentTypeClass();
|
|
12573
|
-
this._currentMode = this.options.mode || 'date';
|
|
12574
|
-
this._switchMode();
|
|
12575
|
-
}
|
|
12576
|
-
if (!open) {
|
|
12577
|
-
this.options.onClose == null ? void 0 : this.options.onClose.call(this.options, this.current, this._currentMode);
|
|
12578
|
-
this._setCurrent(this.current, false);
|
|
12579
|
-
}
|
|
12580
|
-
};
|
|
12581
|
-
_proto._initCalendar = function _initCalendar() {
|
|
12582
|
-
var _this = this;
|
|
12583
|
-
if (!this._calendar) {
|
|
12584
|
-
this._calendar = new Calendar(this.$body, _extends({}, this.options, {
|
|
12585
|
-
current: this._current || new Date(),
|
|
12586
|
-
onCell: this._onCell.bind(this),
|
|
12587
|
-
showHeaderOk: this.options.isMobile,
|
|
12588
|
-
showHeaderClose: this.options.isMobile,
|
|
12589
|
-
onOk: this._onOk.bind(this),
|
|
12590
|
-
onClose: this._onClose.bind(this),
|
|
12591
|
-
onMonth: this._onMonth.bind(this),
|
|
12592
|
-
onYear: this._onYear.bind(this),
|
|
12593
|
-
onChange: function(date) {
|
|
12594
|
-
var _this__calendar;
|
|
12595
|
-
if (!_this._current || utilsTools.DateTime.format(_this._current, 'YYYY-MM-DD') !== utilsTools.DateTime.format(date, 'YYYY-MM-DD')) _this._onChange(date, (_this__calendar = _this._calendar) == null ? void 0 : _this__calendar.options.showHeaderOk);
|
|
12596
|
-
}
|
|
12597
|
-
}));
|
|
12598
|
-
}
|
|
12599
|
-
};
|
|
12600
|
-
_proto._initMonth = function _initMonth() {
|
|
12601
|
-
var _this = this;
|
|
12602
|
-
if (!this._month) {
|
|
12603
|
-
this._month = new Month(this.$body, _extends({}, this.options, {
|
|
12604
|
-
current: this._current || new Date(),
|
|
12605
|
-
onCell: this._onCell.bind(this),
|
|
12606
|
-
onOk: this._onOk.bind(this),
|
|
12607
|
-
onClose: this._onClose.bind(this),
|
|
12608
|
-
showHeaderOk: this.options.isMobile,
|
|
12609
|
-
showHeaderClose: this.options.isMobile,
|
|
12610
|
-
onChange: function(date) {
|
|
12611
|
-
var _this__month;
|
|
12612
|
-
if (!_this._current || utilsTools.DateTime.format(_this._current, 'YYYY-MM') !== utilsTools.DateTime.format(date, 'YYYY-MM')) _this._onChange(date, (_this__month = _this._month) == null ? void 0 : _this__month.options.showHeaderOk);
|
|
12613
|
-
if (_this._minModeIndex < 1) {
|
|
12614
|
-
// 返回日期
|
|
12615
|
-
_this._removeCurrentTypeClass();
|
|
12616
|
-
_this._currentMode = 'date';
|
|
12617
|
-
_this._switchMode();
|
|
12618
|
-
}
|
|
12619
|
-
},
|
|
12620
|
-
onYear: this._onYear.bind(this)
|
|
12621
|
-
}));
|
|
12622
|
-
}
|
|
12623
|
-
};
|
|
12624
|
-
_proto._initYear = function _initYear() {
|
|
12625
|
-
var _this = this;
|
|
12626
|
-
if (!this._year) {
|
|
12627
|
-
this._year = new Year(this.$body, _extends({}, this.options, {
|
|
12628
|
-
current: this._current || new Date(),
|
|
12629
|
-
onCell: this._onCell.bind(this),
|
|
12630
|
-
onOk: this._onOk.bind(this),
|
|
12631
|
-
onClose: this._onClose.bind(this),
|
|
12632
|
-
showHeaderOk: this.options.isMobile,
|
|
12633
|
-
showHeaderClose: this.options.isMobile,
|
|
12634
|
-
onChange: function(date) {
|
|
12635
|
-
var _this__year;
|
|
12636
|
-
if (!_this._current || utilsTools.DateTime.format(_this._current, 'YYYY') !== utilsTools.DateTime.format(date, 'YYYY')) _this._onChange(date, (_this__year = _this._year) == null ? void 0 : _this__year.options.showHeaderOk);
|
|
12637
|
-
if (_this._minModeIndex < 2) {
|
|
12638
|
-
// 返回月
|
|
12639
|
-
_this._removeCurrentTypeClass();
|
|
12640
|
-
_this._currentMode = 'month';
|
|
12641
|
-
_this._switchMode();
|
|
12642
|
-
}
|
|
12643
|
-
}
|
|
12644
|
-
}));
|
|
12645
|
-
}
|
|
12646
|
-
};
|
|
12647
|
-
_proto._onOk = function _onOk(date) {
|
|
12648
|
-
this.current = date || this._current;
|
|
12649
|
-
this._setCurrent(date || this._current);
|
|
12650
|
-
this.options.onOk == null ? void 0 : this.options.onOk.call(this.options, this.current, this._currentMode);
|
|
12651
|
-
this._hide();
|
|
12652
|
-
};
|
|
12653
|
-
_proto._onClose = function _onClose() {
|
|
12654
|
-
this._hide();
|
|
12655
|
-
};
|
|
12656
|
-
_proto._onChange = function _onChange(date, showHeaderOk) {
|
|
12657
|
-
var index = _DATEPICKER_MODE_ARRAY.indexOf(this._currentMode);
|
|
12658
|
-
if (!showHeaderOk && this._minModeIndex === index) {
|
|
12659
|
-
this._hide();
|
|
12660
|
-
}
|
|
12661
|
-
this.options.onChange == null ? void 0 : this.options.onChange.call(this.options, date, this._currentMode);
|
|
12662
|
-
this._setCurrent(date);
|
|
12663
|
-
};
|
|
12664
|
-
_proto._onCell = function _onCell(date) {
|
|
12665
|
-
this.options.onCell == null ? void 0 : this.options.onCell.call(this.options, date, this._currentMode);
|
|
12666
|
-
};
|
|
12667
|
-
_proto._onYear = function _onYear() {
|
|
12668
|
-
this._removeCurrentTypeClass();
|
|
12669
|
-
this._currentMode = 'year';
|
|
12670
|
-
this._switchMode();
|
|
12671
|
-
};
|
|
12672
|
-
_proto._onMonth = function _onMonth() {
|
|
12673
|
-
this._removeCurrentTypeClass();
|
|
12674
|
-
this._currentMode = 'month';
|
|
12675
|
-
this._switchMode();
|
|
12676
|
-
};
|
|
12677
|
-
_proto._removeCurrentTypeClass = function _removeCurrentTypeClass() {
|
|
12678
|
-
this.$body.classList.remove(_CONTAINER_PREFIX_CLASSNAME_ + "-picker-" + this._currentMode);
|
|
12679
|
-
};
|
|
12680
|
-
_create_class(DatePicker, [
|
|
12681
|
-
{
|
|
12682
|
-
key: "_minModeIndex",
|
|
12683
|
-
get: /**
|
|
12684
|
-
* 当前最小模式索引, 当模式下标是最小的, 不可以再小
|
|
12685
|
-
*/ function get() {
|
|
12686
|
-
return _DATEPICKER_MODE_ARRAY.indexOf(this.options.mode);
|
|
12687
|
-
}
|
|
12688
|
-
}
|
|
12689
|
-
]);
|
|
12690
|
-
return DatePicker;
|
|
12691
|
-
}(Picker);
|
|
12692
|
-
|
|
12693
|
-
dist$4.Calendar = Calendar;
|
|
12694
|
-
dist$4.DatePicker = DatePicker;
|
|
12695
|
-
dist$4.Header = Header;
|
|
12696
|
-
dist$4.Month = Month;
|
|
12697
|
-
dist$4.Year = Year;
|
|
12698
|
-
|
|
12699
|
-
return dist$4;
|
|
12700
|
-
}
|
|
12701
|
-
|
|
12702
|
-
var distExports$1 = requireDist$2();
|
|
10364
|
+
var distExports$1 = requireDist$2();
|
|
12703
10365
|
|
|
12704
10366
|
/**
|
|
12705
10367
|
* @description 时间操作
|
|
@@ -12942,14 +10604,11 @@
|
|
|
12942
10604
|
}
|
|
12943
10605
|
}
|
|
12944
10606
|
},
|
|
12945
|
-
onChange: function(date) {
|
|
12946
|
-
if (date && _this._value !== DateTime.formate(date, 'YYYY-MM-DD') && !isMobile1) {
|
|
10607
|
+
onChange: function(date, mode) {
|
|
10608
|
+
if (date && _this._value !== DateTime.formate(date, 'YYYY-MM-DD') && !isMobile1 && mode === 'date') {
|
|
12947
10609
|
_this._value = DateTime.formate(date, 'YYYY-MM-DD');
|
|
12948
10610
|
_this.options.onChange == null ? void 0 : _this.options.onChange.call(_this.options, date);
|
|
12949
10611
|
_this.emit(EVENTS.control.dateChange, date);
|
|
12950
|
-
if (date && _this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value")) {
|
|
12951
|
-
_this.$container.querySelector("." + PREFIX_CLASS + "-mobile-date-filter-value").innerHTML = _this._getDateStr();
|
|
12952
|
-
}
|
|
12953
10612
|
}
|
|
12954
10613
|
},
|
|
12955
10614
|
onOpenChange: function(open) {
|
|
@@ -13468,7 +11127,7 @@
|
|
|
13468
11127
|
function requireDist () {
|
|
13469
11128
|
if (hasRequiredDist) return dist$1;
|
|
13470
11129
|
hasRequiredDist = 1;
|
|
13471
|
-
var deepmerge=requireCjs$1(),I18n=requireDist$9(),Picker=requireDist$c(),DragScroll=requireDist$1(),delegate=requireDist$b(),_$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};function _create_class$2(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}var _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",onChange:function(){},onDragStart:function(){},onDragging:function(){},onDragEnd:function(){},onDestroy:function(){}},BaseTimeLine=function(){function BaseTimeLine(container,options){if(this._current=new Date,this._readOnly=false,this._width=0,this._height=0,this._destroyed=false,this._timeWidth=0,this._timeSections=[],this.$container=container,!container)throw new Error("container is required");var left,right;this.options=deepmerge(_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}),this.options.timeSections&&Array.isArray(this.options.timeSections)&&(this._timeSections=this.options.timeSections),this.options.readOnly&&(this.readOnly=this.options.readOnly),this.options.className&&this.$container.classList.add(this.options.className),this.$container.style.position="relative",this.options.current&&(left=this.options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?this._current=this.options.current||new Date:this._current=new Date,this.i18n=new I18n(deepmerge(_$TIMELINE_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"}),this._timeWidth=this.options.timeWidth||0,this._resize(this.options.width||"100%",this.options.height);}var _proto=BaseTimeLine.prototype;return _proto.setReadOnly=function(readOnly){this.readOnly=readOnly;},_proto.update=function(current){this._current=current;},_proto.updateTimeSections=function(timeSections){timeSections&&Array.isArray(timeSections)&&(this._timeSections=timeSections);},_proto.resize=function(width,height){this._resize(width,height);},_proto._resize=function(width,height){var cssText="";/^\d+(\.\d+)?$/.test(width+"")?cssText+="width: "+width+"px;":width&&(cssText+="width: "+width+";"),/^\d+(\.\d+)?$/.test(height+"")?cssText+="height: "+height+"px;":height&&(cssText+="height: "+height+";"),this.$container&&(this.$container.style.cssText+=cssText),this._width=Math.floor(this.$container.clientWidth),this._height=Math.floor(this.$container.clientHeight);},_proto.setTimeWidth=function(timeWidth){[0,1,2,3,4,5].includes(timeWidth)&&(this._timeWidth=timeWidth);},_proto.destroy=function(){this._current=null,null==this.options.onDestroy||this.options.onDestroy.call(this.options),this._timeSections=[],this._readOnly=false,this._destroyed=true;},_create_class$2(BaseTimeLine,[{key:"current",get:function(){return this._current},set:function(current){this._current=current;}},{key:"readOnly",get:function(){return this._readOnly},set:function(readOnly){this._readOnly!==readOnly&&(this._readOnly=readOnly,this.$container.style.cursor=readOnly?"not-allowed":"pointer");}},{key:"timeSections",get:function(){return this._timeSections}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"timeWidth",get:function(){return this._timeWidth}}]),BaseTimeLine}();BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;var TimeLineUtil=function(){function TimeLineUtil(){}return TimeLineUtil.toDate=function(time){var left,right,date=null;return "string"==typeof time&&time.includes(":")?date=new Date(time):"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||10!==(time+"").length?"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||13!==(time+"").length?(left=time,date=(null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?time:new Date):date=new Date(+time):date=new Date(1e3*+time),date},TimeLineUtil.formatDateToHHmmss=function(time){var date=TimeLineUtil.toDate(time);if(date){var h=date.getHours(),m=date.getMinutes(),s=date.getSeconds();return (h>9?h:"0"+h)+":"+(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)}return "00:00:00"},TimeLineUtil.subTime=function(m){return +m>9?m+"":"0"+m},TimeLineUtil.tranTime=function(time,fmt){ void 0===fmt&&(fmt="YYYY-MM-DD HH:mm:ss");var newDate=TimeLineUtil.toDate(time);return newDate?"YYYY-MM-DD"===fmt?newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate()):"HH:mm:ss"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH"===fmt?TimeLineUtil.subTime(newDate.getHours()):"mm:ss"===fmt?TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH:mm"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes()):"YYYYMMDDTHHmmssZ"===fmt?newDate.getFullYear()+""+TimeLineUtil.subTime(newDate.getMonth()+1)+TimeLineUtil.subTime(newDate.getDate())+"T"+TimeLineUtil.subTime(newDate.getHours())+TimeLineUtil.subTime(newDate.getMinutes())+TimeLineUtil.subTime(newDate.getSeconds())+"Z":newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate())+" "+TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):""},TimeLineUtil.timeToSecond=function(time){var e=time.split(":");return 60*Number(e[0])*60+60*Number(e[1])+(Number(e[2])||0)},TimeLineUtil.minuteToTime=function(minute){var hour=Math.floor(minute/60),m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)},TimeLineUtil.timeToMinute=function(time){var e=time.split(":");return 60*Number(e[0])+Number(e[1])},TimeLineUtil.isOverlap=function(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)},TimeLineUtil.tranTimeToString=function(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1,secondNum=Math.floor((null==(_TimeLineUtil_toDate=TimeLineUtil.toDate(end))?void 0:_TimeLineUtil_toDate.getTime())-(null==(_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))?void 0:_TimeLineUtil_toDate1.getTime()))/1e3,second=secondNum%60,minute=Math.floor(secondNum/60);return (minute>0?TimeLineUtil.subTime(minute)+"'":"0'")+TimeLineUtil.subTime(second)+"''"},TimeLineUtil}(),_$TIMELINE_ICONS$__tip='<svg viewBox="0 0 57 24" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="tip">\n <path class="ez-time-line-icon-tip" fill-rule="evenodd" d="m4,0l44,0c2.2091,0 4,1.7909 4,4l0,3.8218l4.9399,3.3572c0.5839,0.3968 0.5839,1.2574 0,1.6542l-4.9399,3.3572l0,3.8096c0,2.2091 -1.7909,4 -4,4l-44,0c-2.2091,0 -4,-1.7909 -4,-4l0,-16c0,-2.2091 1.7909,-4 4,-4z"/>\n </svg>',_$TIMELINE_ICONS$__plus='\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="plus">\n <path d="M0 0L10.6667 0" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5" transform="matrix(0,1,-1,0,8,2.66663)"/>\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__minus='\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="minus">\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__close='\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n ',_$TIMELINE_ICONS$__pause='<svg viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="pause">\n\t\t <path d="M9.43914 2.47881L13.4688 8.4912C14.3594 9.81998 13.4071 11.6047 11.8074 11.6047L3.74811 11.6047C2.14849 11.6047 1.19616 9.81998 2.08675 8.4912L6.11641 2.47881C6.90863 1.2968 8.64693 1.2968 9.43914 2.47881Z" fill-rule="evenodd" transform="matrix(0,1,-1,0,16.5781,2.22229)" />\n </svg>\n ',_$TIMELINE_ICONS$__picture='\n <svg viewBox="0 0 19.1613 19.4583" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="picture">\n <path xmlns="http://www.w3.org/2000/svg" id="形状结合" d="M15.3276 2.63477L3.83173 2.63477C2.70848 2.63477 1.79541 3.55027 1.79541 4.68419L1.79541 14.7737C1.79541 15.9076 2.70848 16.8231 3.83173 16.8231L15.3276 16.8231C16.4504 16.8231 17.364 15.9074 17.364 14.7737L17.364 4.68419C17.364 3.55027 16.4509 2.63477 15.3276 2.63477ZM3.83247 3.851L15.3284 3.851C15.7936 3.851 16.1671 4.22551 16.1671 4.68429L16.1671 14.7738C16.1671 15.2323 15.7932 15.6071 15.3284 15.6071L3.83247 15.6071C3.36725 15.6071 2.99373 15.2326 2.99373 14.7738L2.99373 12.2622L6.7356 9.56381L6.78139 9.53916C6.84532 9.51493 6.91856 9.52524 6.9742 9.56947L13.2644 14.5698L13.3381 14.62C13.5918 14.7666 13.9197 14.7063 14.105 14.4658C14.3089 14.2014 14.263 13.8192 14.0026 13.6122L7.71239 8.61184L7.60526 8.5346C7.12945 8.22451 6.51026 8.23473 6.04222 8.57224L2.99373 10.7706L2.99373 4.68429C2.99373 4.22551 3.36725 3.851 3.83247 3.851ZM10.5794 7.29679C10.5794 6.06542 11.5624 5.0672 12.7749 5.0672C13.9875 5.0672 14.9705 6.06542 14.9705 7.29679C14.9705 8.52817 13.9875 9.52639 12.7749 9.52639C11.5624 9.52639 10.5794 8.52817 10.5794 7.29679ZM13.7722 7.2967C13.7722 6.73699 13.3254 6.28325 12.7742 6.28325C12.223 6.28325 11.7762 6.73699 11.7762 7.2967C11.7762 7.85642 12.223 8.31015 12.7742 8.31015C13.3254 8.31015 13.7722 7.85642 13.7722 7.2967Z" fill-rule="evenodd"/>\n </svg>\n ',TIME_WIDTH=[[1,10,10,"单位 1秒"],[60,20,5,"单位 1分钟"],[600,20,6,"单位 10分钟"],[3600,30,6,"单位 1小时"],[14400,40,2,"单位 4小时"],[43200,80,2,"单位 12小时"]],MOBILE_TIME_WIDTH=[[1,10,10,"单位 1分钟"],[10,20,5,"单位 10分钟"],[30,20,6,"单位 30分钟"],[60,30,6,"单位 1小时"],[120,40,2,"单位 2小时"],[240,80,2,"单位 4小时"]];function _create_class$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$1(){return _extends$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$1.apply(this,arguments)}function _set_prototype_of$1(o,p){return _set_prototype_of$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1(o,p)}var _$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_=Object.assign({},_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,{height:400,width:"100%",timeWidth:0,readOnly:false,timePointColor:"#648FFC",timeTextColor:"#666666",timeScaleColor:"transparent",timeSectionColor:"#369FFF",timeAxisBgColor:"#BDCDFF",currentTimeBgColor:"#648FFC",currentTimeColor:"#FFFFFF",showTimeWidthBtn:true}),MobileTimeLine=function(BaseTimeLine){function MobileTimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}))||this)._isTouchStart=false,_this._dragScroll=null,_this._moveStartX=0,_this._moveStartY=0,_this.state={start:"00:00:00",end:"24:00:00",current:null,timeArr:[],availTimeLine:[],index:0},_this._plusClick=_this._plusClick.bind(_this),_this._minusClick=_this._minusClick.bind(_this),_this._onPickerClose=_this._onPickerClose.bind(_this),_this._onClickItem=_this._onClickItem.bind(_this),_this._onClickCoverFold=_this._onClickCoverFold.bind(_this),_this._onImageError=_this._onImageError.bind(_this),_this._render(),_this.options.timeSections&&Array.isArray(_this.options.timeSections)&&_this.updateTimeSections(_this.options.timeSections),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1(subClass,superClass);}(MobileTimeLine,BaseTimeLine);var _proto=MobileTimeLine.prototype;return _proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._dragScroll&&(this._dragScroll.readonly=readOnly);},_proto.setTimeWidth=function(timeWidth){MOBILE_TIME_WIDTH[timeWidth]&&(BaseTimeLine.prototype.setTimeWidth.call(this,timeWidth),this._matchTimeDot());},_proto.updateTimeSections=function(timeSections,defaultIndex){BaseTimeLine.prototype.updateTimeSections.call(this,timeSections);var list=timeSections.map(function(record){return _extends$1({},record,{startTime:TimeLineUtil.formatDateToHHmmss(record.startTime),endTime:TimeLineUtil.formatDateToHHmmss(record.endTime)})});if(list.length>0){ void 0===defaultIndex&&(defaultIndex=list.length-1);var current=this.state.current;this._setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:null===current?list[defaultIndex].startTime:current}),this._matchTimeDot();}else this._setState({availTimeLine:[],current:TimeLineUtil.formatDateToHHmmss(this.current||(new Date).getTime())}),this._matchTimeDot();},_proto.update=function(time){var _this__dragScroll;time&&!(null==(_this__dragScroll=this._dragScroll)?void 0:_this__dragScroll.isDragging)&&(this._setState({current:TimeLineUtil.tranTime(time,"HH:mm:ss")}),this._currentOffsetH());},_proto.destroy=function(){var _this__dragScroll,_this__picker_$body_querySelectorAll,_this__picker_$body;if(this._scrollTimer&&(clearInterval(this._scrollTimer),this._scrollTimer=null),this._$currentTime)try{this.$container.removeChild(this._$currentTime),this._$currentTime=null;}catch(error){}if(this._$itemList&&this._imageRemoveErrorEvent(this._$itemList.querySelectorAll("img.ez-time-line-img")||[]),this._$itemContainer&&this._$itemList)try{this._$itemContainer.removeChild(this._$itemList),this._$itemList=null;}catch(error){}if(this._$itemContainer)try{this.$container.removeChild(this._$itemContainer),this._$itemContainer=null;}catch(error){}if(this._$op)try{this.$container.removeChild(this._$op),this._$op=null;}catch(error){}this._picker&&(this._imageRemoveErrorEvent((null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelectorAll=_this__picker_$body.querySelectorAll)?void 0:_this__picker_$body_querySelectorAll.call(_this__picker_$body,"img"))||[]),this._picker.destroy(),this._picker=null);this._removeEventListener(),null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.destroy(),this._dragScroll=null,BaseTimeLine.prototype.destroy.call(this);},_proto._setState=function(obj){var _this=this;Object.keys(obj).forEach(function(key){var _this__dragScroll,_this_timeSections_;"current"===key&&obj[key]?(_this._setCurrentDOM(obj[key]),_this.state.current===obj[key]||(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.isDragging)||(_this.state[key]=obj[key],_this.current=new Date(TimeLineUtil.tranTime((null==(_this_timeSections_=_this.timeSections[0])?void 0:_this_timeSections_.endTime)||(new Date).getTime(),"YYYY-MM-DD")+" "+obj[key]),null==_this.options.onChange||_this.options.onChange.call(_this.options,_this.current))):_this.state[key]=obj[key];});},_proto._setCurrentDOM=function(time){this._$currentTime&&(this._$currentTime.querySelector(".ez-time-line-current-value").innerHTML=time);},_proto._matchTimeDot=function(){for(var scaleWidth=this._scaleWidth,timeArr=[],minute=TimeLineUtil.timeToMinute("24:00:00"),i=minute=Math.floor(minute/scaleWidth)*scaleWidth;i>=0;){var marginTop=0,marginBottom=0;i==minute&&(marginTop=70),0==i&&(marginBottom=this.$container.clientHeight-70);var time=TimeLineUtil.minuteToTime(i);timeArr.push({id:i,current:time,label:"a"+i,marginTop:marginTop,marginBottom:marginBottom,recArr:[],coverArr:this._filterTimeSectionsByTime(time)}),i-=scaleWidth;}this._setState({timeArr:timeArr}),this._matchRecTimeDot();},_proto._matchRecTimeDot=function(){var _this_state=this.state,availTimeLine=_this_state.availTimeLine,timeArr=_this_state.timeArr,scaleWidth=this._scaleWidth,len=availTimeLine.length;if(0===len)for(var j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(var k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(var i=0;i<len;i++){var stAvailPercent,etAvailPercent,temp=availTimeLine[i],st=TimeLineUtil.timeToSecond(temp.startTime),et=TimeLineUtil.timeToSecond(temp.endTime),stMinute=Math.floor(st/(60*scaleWidth))*scaleWidth;stAvailPercent=(st-60*stMinute)/scaleWidth;var etMinute=Math.floor(et/(60*scaleWidth))*scaleWidth;etAvailPercent=(et-60*etMinute)/scaleWidth;for(var j1=0;j1<timeArr.length;j1++)if(timeArr[j1].id==stMinute&&timeArr[j1].id==etMinute){var height=etAvailPercent-stAvailPercent,top=60-etAvailPercent;timeArr[j1].recArr.push({height:height,top:top});}else timeArr[j1].id==stMinute?timeArr[j1].recArr.push({height:60-stAvailPercent,top:0}):timeArr[j1].id==etMinute?timeArr[j1].recArr.push({height:etAvailPercent,top:60-etAvailPercent}):timeArr[j1].id>stMinute&&timeArr[j1].id<etMinute&&timeArr[j1].recArr.push({height:60,top:0});}}this._setState({timeArr:timeArr}),this._renderDateLine();},_proto._renderDateLine=function(){var _this=this,timeArr=this.state.timeArr,container=this._$itemList;this._imageRemoveErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]),container.innerHTML="",timeArr.forEach(function(item,index){var timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class","ez-time-line-time-scale-area"),item.marginTop&&(timeItemDOM.style.cssText+="margin-top: "+item.marginTop+"px;"),item.marginBottom&&(timeItemDOM.style.cssText+="margin-bottom: "+item.marginBottom+"px;"),timeItemDOM.style.cssText+="border-right-color: "+(_this.options.timeAxisBgColor||"rgba(189, 205, 255, 1)")+";",timeItemDOM.setAttribute("data-time",item.current),timeItemDOM.setAttribute("data-index",index+""),document.createElement("div").setAttribute("class","ez-time-line-scale");var timeItemHtml="";item.coverArr.length&&(timeItemHtml+='\n <div class="ez-time-line-time-cover-fold '+(item.coverArr.length>1?"ez-time-line-time-cover-fold-multiple":"")+'"\n data-start="'+item.current+'">\n '+(item.coverArr.length>1?'<div class="ez-time-line-cover-fold-placeholder" style="color: #FFF"></div>':"")+'\n <div class="ez-time-line-time-cover-fold-img">\n <img src="'+_this._setImageScr(item.coverArr[0].coverPic)+'" class="ez-time-line-img"/>\n <span class="ez-time-line-time-cover-fold-len">\n '+(item.coverArr.length>1?_this.i18n.t("foldTitle",{len:item.coverArr.length,unit:"videos"}):""+TimeLineUtil.tranTime(item.coverArr[0].startTime,"HH:mm"))+"\n </span>\n "+(1===item.coverArr.length?'<span class="ez-time-line-time-cover-fold-time">'+TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)+"</span>":"")+'\n <span class="ez-time-line-time-cover-fold-pause">'+_$TIMELINE_ICONS$__pause+"</span>\n </div>\n </div>"),item.recArr.forEach(function(i){timeItemHtml+='<div class="ez-time-line-time-unavail"\n style="height: '+i.height+"px;background-color:"+(_this.options.timeSectionColor||"#369FFF")+"; top: "+i.top+'px">\n </div>';}),timeItemHtml+="<div id="+item.label+' class="ez-time-line-time-label" style="color: '+(_this.options.timeTextColor||"#666")+'">'+item.current+"</div>",timeItemDOM.innerHTML=timeItemHtml,container.appendChild(timeItemDOM),_this._imageErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]);}),this._currentOffsetH();},_proto._currentOffsetH=function(){var current=this.state.current;if(current){var _this__dragScroll,y=(86400-TimeLineUtil.timeToSecond(current)||0)/this._scaleWidth;null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y+60,false);}},_proto._render=function(){var _this=this;if(this._$currentTime=document.createElement("div"),this._$currentTime.classList.add("ez-time-line-current"),this._$currentTime.innerHTML='<div class="ez-time-line-current-content" style="color: '+(this.options.currentTimeBgColor||"#648FFC")+'">\n <span class="ez-time-line-current-tip">'+_$TIMELINE_ICONS$__tip+'</span>\n <span class="ez-time-line-current-tip-line" style="background-color: '+(this.options.timePointColor||"#648FFC")+';"></span>\n <div class="ez-time-line-current-value" style="color: '+(this.options.currentTimeColor||"#FFFFFF")+'">00:00:00</div>\n </div>',this.$container.appendChild(this._$currentTime),this._$itemContainer=document.createElement("div"),this._$itemContainer.classList.add("ez-time-line-container"),this.$container.appendChild(this._$itemContainer),this._dragScroll=new DragScroll(this._$itemContainer,{hideScrollbar:true,onChange:function(state){var result=_this._offsetYToTime(state.y);result[1]!==_this.state.current&&_this._setCurrentDOM(result[0]>=86400?"23:59:59":result[1]);},onDragStart:function(e){_this._moveStartX=e.clientX,_this._moveStartY=e.clientY,null==_this.options.onDragStart||_this.options.onDragStart.call(_this.options,_this.state.current);},onDragging:function(){null==_this.options.onDragging||_this.options.onDragging.call(_this.options,_this.state.current);},onDragEnd:function(){var _this__dragScroll,result=_this._offsetYToTime(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.currentY);result[1]!==_this.state.current&&_this._setState({current:result[0]>=86400?"23:59:59":result[1]}),null==_this.options.onDragEnd||_this.options.onDragEnd.call(_this.options,_this.state.current);}}),/\d/.test(this.options.height))this._$itemContainer.style.cssText+="height: "+this.options.height+"px";else if("string"==typeof this.options.height)this._$itemContainer.style.cssText+="height: "+this.options.height;else {var height=this.$container.clientHeight;this._$itemContainer.style.cssText+="height: "+height+"px";}this._$itemList=document.createElement("div"),this._$itemList.classList.add("ez-time-line-item"),this._dragScroll.$content.appendChild(this._$itemList),this.options.showTimeWidthBtn&&(this._$op=document.createElement("div"),this._$op.classList.add("ez-time-line-op"),this._$op.innerHTML='<span class="ez-time-line-op-wrapper"><span class="ez-time-line-icon-plus">'+_$TIMELINE_ICONS$__plus+'</span> <span class="ez-time-line-icon-minus">'+_$TIMELINE_ICONS$__minus+"</span></span>",this.$container.appendChild(this._$op)),this._picker=new Picker(null,{isMobile:true,wrapClassName:"ez-time-line-picker",onOpenChange:function(isOpen){var _this_options_onPickerOpenChange,_this_options;null==(_this_options=_this.options)||null==(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)||_this_options_onPickerOpenChange.call(_this_options,isOpen);}}),this._addEventListener();},_proto._addEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.addEventListener("click",this._plusClick,false),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.addEventListener("click",this._minusClick,false));this._matchTimeDot(),this._picker&&(this._delegatePickerClose=delegate(this._picker.$body,".ez-time-line-picker-close","click",this._onPickerClose,false),this._delegateItemContent=delegate(this._picker.$body,".ez-time-line-picker-item-content","click",this._onClickItem,false),this._delegateCoverFold=delegate(this._$itemList,".ez-time-line-time-cover-fold","click",this._onClickCoverFold,false));},_proto._removeEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1,_this__picker_$body_querySelector,_this__picker_$body;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.removeEventListener("click",this._plusClick),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.removeEventListener("click",this._minusClick));this._picker&&(null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelector=_this__picker_$body.querySelector(".ez-time-line-picker-close"))||_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose),this._delegateItemContent&&(this._delegateItemContent.forEach(function(delegation){delegation.destroy();}),this._delegateItemContent=null),this._delegatePickerClose&&(this._delegatePickerClose.forEach(function(delegation){delegation.destroy();}),this._delegatePickerClose=null),this._delegateCoverFold&&(this._delegateCoverFold.forEach(function(delegation){delegation.destroy();}),this._delegateCoverFold=null));},_proto._plusClick=function(){var timeWidth=this.timeWidth+1;timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(timeWidth);},_proto._minusClick=function(){var timeWidth=this.timeWidth-1;timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(Math.floor(timeWidth));},_proto._timeSectionsToGroupsByHour=function(list){var obj={};return list.forEach(function(item,index){var hour=TimeLineUtil.tranTime(item.startTime,"HH");obj[+hour]?obj[+hour].push(_extends$1({},item,{_index:index})):obj[+hour]=[_extends$1({},item,{_index:index})];}),obj},_proto._filterTimeSectionsByTime=function(start){if(!start)return [];var startSecond=TimeLineUtil.timeToSecond(start+":00"),endSecond=TimeLineUtil.timeToSecond(start+":00")+60*this._scaleWidth;return this.timeSections.filter(function(item){var _$start=TimeLineUtil.timeToSecond(TimeLineUtil.tranTime(item.startTime,"HH:mm:ss"));return _$start>=startSecond&&_$start<endSecond})},_proto._renderPickerContent=function(start){var _this__picker_innerHTML,_this__picker,_this__picker1,_this__picker2,_this=this,list=this._filterTimeSectionsByTime(start),hourGroups=this._timeSectionsToGroupsByHour(list);(null==(_this__picker=this._picker)||null==(_this__picker_innerHTML=_this__picker.innerHTML)||_this__picker_innerHTML.call(_this__picker,'<div class="ez-time-line-picker-container">\n <div class="ez-time-line-picker-header">\n <span class="ez-time-line-picker-close">'+_$TIMELINE_ICONS$__close+"</span>\n "+this.i18n.t("title",{len:list.length,unit:list.length>1?"videos":"video"})+'\n </div>\n <div class="ez-time-line-picker-content">\n <div class="ez-time-line-picker-list">\n '+Object.keys(hourGroups).reverse().map(function(key){return '<div class="ez-time-line-picker-item">\n <div class="ez-time-line-picker-item-title">'+key+':00</div>\n <div class="ez-time-line-picker-item-list">\n '+hourGroups[key].reverse().map(function(item){return '<div class="ez-time-line-picker-item-content"\n data-start="'+TimeLineUtil.tranTime(item.startTime,"YYYYMMDDTHHmmssZ")+'"\n data-end="'+TimeLineUtil.tranTime(item.endTime,"YYYYMMDDTHHmmssZ")+'"\n data-index="'+item._index+'">\n <span class="ez-time-line-picker-item-time">'+TimeLineUtil.tranTime(item.startTime,"HH:mm")+'</span>\n <span class="ez-time-line-picker-item-duration">\n '+TimeLineUtil.tranTimeToString(item.startTime,item.endTime)+'\n </span>\n <img class="ez-time-line-picker-item-cover" src="'+_this._setImageScr(item.coverPic)+'"/>\n </div>'}).join("")+"\n </div>\n </div>"}).join("")+"\n </div>\n </div>\n </div>\n </div>"),null==(_this__picker1=this._picker)?void 0:_this__picker1.$body)&&this._imageErrorEvent((null==(_this__picker2=this._picker)?void 0:_this__picker2.$body.querySelectorAll("img"))||[]);},_proto._imageErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){img.hasAttribute("data-error")||img.addEventListener("error",_this._onImageError);});},_proto._imageRemoveErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){img.removeEventListener("error",_this._onImageError);});},_proto._onImageError=function(e){var img=e.target;if(!img.hasAttribute("data-error")){var _img_parentNode,placeholder=document.createElement("div");placeholder.classList.add("ez-time-line-item-cover-placeholder"),placeholder.innerHTML=""+_$TIMELINE_ICONS$__picture,null==(_img_parentNode=img.parentNode)||_img_parentNode.appendChild(placeholder),img.remove();}},_proto._onPickerClose=function(){this._picker&&(this._picker.open=false);},_proto._onClickItem=function(e){var _e_delegateTarget_getAttribute,_e_delegateTarget,index=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_getAttribute=_e_delegateTarget.getAttribute)?void 0:_e_delegateTarget_getAttribute.call(_e_delegateTarget,"data-index");this._picker&&(this._picker.open=false),null==this.options.onPickerSelect||this.options.onPickerSelect.call(this.options,this.timeSections[+index]);},_proto._onClickCoverFold=function(e){var _e_delegateTarget_parentElement_getAttribute,_e_delegateTarget_parentElement,_e_delegateTarget;e.preventDefault();var time=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_parentElement=_e_delegateTarget.parentElement)||null==(_e_delegateTarget_parentElement_getAttribute=_e_delegateTarget_parentElement.getAttribute)?void 0:_e_delegateTarget_parentElement_getAttribute.call(_e_delegateTarget_parentElement,"data-time"),moveX=Math.abs(this._moveStartX-e.clientX),moveY=Math.abs(this._moveStartY-e.clientY);this._picker&&time&&!(moveX>=1||moveY>=1)&&(this._renderPickerContent(time),this._picker.open=true);},_proto._setImageScr=function(src){if(src){var query="x=200&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""},_proto._offsetYToTime=function(offsetY){var _this__dragScroll,y=offsetY;offsetY<60&&(y=60,null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y));var second=86400-Math.floor((y-60)*this._scaleWidth);return [second,TimeLineUtil.subTime(Math.floor(second/3600))+":"+TimeLineUtil.subTime(Math.floor(second%3600/60))+":"+TimeLineUtil.subTime(second%60)]},_create_class$1(MobileTimeLine,[{key:"_scaleWidth",get:function(){return (MOBILE_TIME_WIDTH[this.timeWidth]||MOBILE_TIME_WIDTH[0])[0]}}]),MobileTimeLine}(BaseTimeLine);function _create_class(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends.apply(this,arguments)}function _set_prototype_of(o,p){return _set_prototype_of=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of(o,p)}var _$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,scaleOffsetTop:4,showYearMonthDay:true},TimeLine=function(BaseTimeLine){function TimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$TIMELINE_DEFAULT_OPTIONS$_,options,{clone:true}))||this)._$canvas=null,_this._ctx=null,_this._timeWidthArray=TIME_WIDTH[0],_this._centerPositionX=0,_this._isMouseDown=false,_this._mousePosition=0,_this._oldTime=null,_this._isOver=false,_this._moved=false,_this._isCtrlKeyDown=false,_this._lastTouchDist=0,_this.$container=container,_this._mousemoveFun=_this._mousemoveFun.bind(_this),_this._mouseoverFun=_this._mouseoverFun.bind(_this),_this._mouseleaveFun=_this._mouseleaveFun.bind(_this),_this._mousedownFun=_this._mousedownFun.bind(_this),_this._mouseUpFun=_this._mouseUpFun.bind(_this),_this._mousewheelFun=_this._mousewheelFun.bind(_this),_this._touchstartFun=_this._touchstartFun.bind(_this),_this._touchmoveFun=_this._touchmoveFun.bind(_this),_this._touchendFun=_this._touchendFun.bind(_this),_this._ctrlKeyDownFun=_this._ctrlKeyDownFun.bind(_this),_this._ctrlKeyUpFun=_this._ctrlKeyUpFun.bind(_this),_this._init(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of(subClass,superClass);}(TimeLine,BaseTimeLine);var _proto=TimeLine.prototype;return _proto._init=function(){this._$canvas=document.createElement("canvas"),this._ctx=this._$canvas.getContext("2d"),this.readOnly||(this._$canvas.style.cssText+="cursor: pointer;"),this.$container.appendChild(this._$canvas),this.resize(this.width,this.height),this._update({current:this.current,timeWidth:this.timeWidth,timeSections:this.timeSections}),this._addEventListener();},_proto.resize=function(width,height){BaseTimeLine.prototype.resize.call(this,width,height),this._$canvas&&width&&(this._$canvas.width=this.width*this.options.dpr,this._$canvas.style.cssText+="width: "+this.width+"px;"),this._$canvas&&height&&(this._$canvas.height=this.height*this.options.dpr,this._$canvas.style.cssText+="height: "+this.height+"px;"),this._draw();},_proto.setTimeWidth=function(timeWidth){this._update({timeWidth:timeWidth});},_proto.updateTimeSections=function(timeSections){this._update({timeSections:timeSections});},_proto.update=function(time){time&&!this._isMouseDown&&this._update({current:new Date(TimeLineUtil.tranTime(time,"YYYY-MM-DD HH:mm:ss"))});},_proto._update=function(options){var left,right,_this__$canvas;(void 0===options&&(options={}),(null==options?void 0:options.current)&&(left=options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(this.current=options.current),(null==options?void 0:options.timeSections)&&BaseTimeLine.prototype.updateTimeSections.call(this,this._mergeTimeSections(options.timeSections)),"number"==typeof(null==options?void 0:options.timeWidth)&&(null==options?void 0:options.timeWidth)<TIME_WIDTH.length&&(BaseTimeLine.prototype.setTimeWidth.call(this,options.timeWidth),this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)]),"number"==typeof(null==options?void 0:options.timeWidth)&&this._timeWidthArray)&&(this._timeWidthArray[3]&&(null==(_this__$canvas=this._$canvas)||_this__$canvas.setAttribute("data-title",this._timeWidthArray[3])));this._draw();},_proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._$canvas&&(this._$canvas.style.cssText+="cursor: "+(readOnly?"not-allowed":"pointer"));},_proto.destroy=function(){if(this._removeEventListener(),this._$canvas)try{this.$container.removeChild(this._$canvas),this._$canvas=null;}catch(e){}BaseTimeLine.prototype.destroy.call(this);},_proto._draw=function(){this._ctx&&(this._ctx.fillStyle=this.options.timeAxisBgColor,this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr)),this._drawSections(),this._drawScale();},_proto._drawScale=function(){var lineWidth=1*this.options.dpr;this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");for(var centerPosition={x:this.width*this.options.dpr/2,y:this.height*this.options.dpr},curScaleTime=Math.floor(this.current.getTime()/1e3),offsetSecond=(curScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*curScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%this._timeWidthArray[0],padding=this.height*this.options.dpr/20,spacing=this._curScaleSpacing*this.options.dpr,rightLastScaleTimeX=Math.floor(this._centerPositionX+(this._timeWidthArray[0]-offsetSecond)/this._timeWidthArray[0]*spacing),leftLastScaleTime=curScaleTime-offsetSecond,rightLastScaleTime=leftLastScaleTime+this._timeWidthArray[0],x=rightLastScaleTimeX-spacing;x>0;x-=spacing){0===(leftLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),leftLastScaleTime-=this._timeWidthArray[0];}for(var x1=rightLastScaleTimeX;x1<=this.width*this.options.dpr;x1+=spacing){0===(rightLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(this._drawSolidLine(x1,padding,x1,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime)),x1,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x1,padding,x1,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),rightLastScaleTime+=this._timeWidthArray[0];}this._drawSolidLine(centerPosition.x,0,centerPosition.x,centerPosition.y,lineWidth,this.options.timePointColor);},_proto._drawSolidLine=function(startX,startY,endX,endY,lineWidth,color){this._ctx&&(this._ctx.save(),this._ctx.strokeStyle=null!=color?color:this.options.timeScaleColor,this._ctx.lineWidth=lineWidth,this._ctx.beginPath(),this._ctx.moveTo(startX,startY),this._ctx.lineTo(endX,endY),this._ctx.stroke(),this._ctx.restore());},_proto._drawTextString=function(text,x,y,align){if(this._ctx){var timeTexts=text.split(" ");this._ctx.font=12*this.options.dpr*1+"px serif",this._ctx.fillStyle=this.options.timeTextColor,this._ctx.textAlign=align||"left",this._timeWidthArray[0]%60==0&&(timeTexts[1]=timeTexts[1].replace(/:00$/,"")),this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr),!this.options.showYearMonthDay||"00:00:00"!==timeTexts[1]&&"00:00"!==timeTexts[1]&&this._timeWidthArray[0]*this._timeWidthArray[2]!==86400||(this._ctx.textAlign=align||"left",this._ctx.fillText(timeTexts[0],x,y+18*this.options.dpr));}},_proto._drawSections=function(){for(var timeArr=this.timeSections||[],i=0;i<timeArr.length;i++){var position=this._findPosition(timeArr[i]);this._ctx&&TimeLineUtil.isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)&&(this._ctx.fillStyle=this.options.timeSectionColor,this._ctx.fillRect(position.x1,0,position.x2-position.x1,this.height*this.options.dpr));}},_proto._findPosition=function(item){var x1=(parseInt((item.startTime-this.current.getTime())/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing+this.width/2)*this.options.dpr;return {x1:x1,x2:x1+parseInt((item.endTime-item.startTime)/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing*this.options.dpr}},_proto._mergeTimeSections=function(timeSections){if(0===timeSections.length)return timeSections;for(var merged=[(timeSections=timeSections.map(function(item){return 10===(item.startTime+"").length&&(item.startTime=1e3*item.startTime),10===(item.endTime+"").length&&(item.endTime=1e3*item.endTime),_extends({},item,{startTime:item.startTime,endTime:item.endTime})}))[0]],i=1;i<timeSections.length;i++){var prev=merged[merged.length-1],curr=timeSections[i];prev.endTime>=curr.startTime?prev.endTime=Math.max(prev.endTime,curr.endTime):merged.push(curr);}return merged},_proto._addEventListener=function(){this._$canvas&&(this._$canvas.addEventListener("mousemove",this._mousemoveFun),this._$canvas.addEventListener("mouseover",this._mouseoverFun),this._$canvas.addEventListener("mouseleave",this._mouseleaveFun),this._$canvas.addEventListener("mousedown",this._mousedownFun),this._$canvas.addEventListener("mouseup",this._mouseUpFun),this._$canvas.addEventListener("wheel",this._mousewheelFun),this.$container.addEventListener("wheel",function(e){e.preventDefault();},{passive:false}),this._$canvas.addEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.addEventListener("keyup",this._ctrlKeyUpFun),document.addEventListener("keydown",this._ctrlKeyDownFun,false),document.addEventListener("keyup",this._ctrlKeyUpFun,false),this._$canvas.addEventListener("touchstart",this._touchstartFun,{passive:false}),this._$canvas.addEventListener("touchmove",this._touchmoveFun,{passive:false}),this._$canvas.addEventListener("touchend",this._touchendFun,{passive:false}));},_proto._removeEventListener=function(){this._$canvas&&(this._$canvas.removeEventListener("mousemove",this._mousemoveFun),this._$canvas.removeEventListener("mouseover",this._mouseoverFun),this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun),this._$canvas.removeEventListener("mousedown",this._mousedownFun),this._$canvas.removeEventListener("mouseup",this._mouseUpFun),this._$canvas.removeEventListener("wheel",this._mousewheelFun),this._$canvas.removeEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.removeEventListener("keyup",this._ctrlKeyUpFun),document.removeEventListener("keydown",this._ctrlKeyDownFun),document.removeEventListener("keyup",this._ctrlKeyUpFun),this._$canvas.removeEventListener("touchstart",this._touchstartFun),this._$canvas.removeEventListener("touchmove",this._touchmoveFun),this._$canvas.removeEventListener("touchend",this._touchendFun));},_proto._mousedownFun=function(e){this.readOnly||(this._isMouseDown=true,this._mousePosition=e.pageX,this._oldTime=this.current,null==this.options.onDragStart||this.options.onDragStart.call(this.options,this.current));},_proto._mouseoverFun=function(){this.readOnly||(this._isOver=true);},_proto._mouseleaveFun=function(e){this.readOnly||(this._isOver=false,this._moveEndOrTouchEndFun(e));},_proto._mouseUpFun=function(e){this._moveEndOrTouchEndFun(e);},_proto._mousemoveFun=function(e){if(!this.readOnly)if(this._isMouseDown&&this._isOver)this._moveUpdateFun(e.pageX);else {var left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left,this._update();}},_proto._mousewheelFun=function(e){e.preventDefault(),this.readOnly;},_proto._ctrlKeyDownFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=true);},_proto._ctrlKeyUpFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=false);},_proto._getTouchDistance=function(touches){var touch1=touches[0],touch2=touches[1],dx=touch2.clientX-touch1.clientX,dy=touch2.clientY-touch1.clientY;return Math.sqrt(dx*dx+dy*dy)},_proto._touchstartFun=function(e){if(!this.readOnly)if(this._oldTime=this.current,this._isOver=true,1===e.touches.length){var touch=e.touches[0];this._isMouseDown=true,this._mousePosition=touch.clientX;}else 2===e.touches.length&&(this._lastTouchDist=this._getTouchDistance(e.touches));},_proto._touchmoveFun=function(e){if(e.preventDefault(),e.stopPropagation(),!this.readOnly)if(1===e.touches.length){var touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else if(2===e.touches.length){this._getTouchDistance(e.touches);this._lastTouchDist;}},_proto._touchendFun=function(e){this.readOnly||this._moveEndOrTouchEndFun(e);},_proto._moveEndOrTouchEndFun=function(e){e.preventDefault(),this.readOnly||this._isMouseDown&&(this._isMouseDown=false,this._moved&&(this._moved=false,this._update({current:this.current}),this._oldTime=this.current,null==this.options.onDragEnd||this.options.onDragEnd.call(this.options,this.current,this._isOver)),this._isOver&&Math.abs(this._mousePosition-(e.pageX||0))>5&&(null==this.options.onChange||this.options.onChange.call(this.options,this.current)),this._mousePosition=0,this._lastTouchDist=0);},_proto._moveUpdateFun=function(x){var mouseOffset=this._mousePosition-x;if(0!==mouseOffset){if(this._oldTime){var currentTime=this._oldTime.getTime()+1e3*parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10);this._update({current:new Date(currentTime)}),null==this.options.onDragging||this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}},_create_class(TimeLine,[{key:"_curScaleSpacing",get:function(){var _this__timeWidthArray,_this__timeWidthArray1;return Math.floor((null==(_this__timeWidthArray=this._timeWidthArray)?void 0:_this__timeWidthArray[1])-(null==(_this__timeWidthArray1=this._timeWidthArray)?void 0:_this__timeWidthArray1[1])*+(this.timeWidth%1/2).toFixed(2))}}]),TimeLine}(BaseTimeLine);TimeLine.TIME_WIDTH=TIME_WIDTH,dist$1.BaseTimeLine=BaseTimeLine,dist$1.MobileTimeLine=MobileTimeLine,dist$1.TimeLine=TimeLine;
|
|
11130
|
+
var deepmerge=requireCjs(),I18n=requireDist$7(),Picker=requireDist$a(),DragScroll=requireDist$1(),delegate=requireDist$9(),_$TIMELINE_LOCALES$_={zh:{title:"包含{{len}}段录像",foldTitle:"{{len}}个录像"},en:{title:"Includes {{len}} {{unit}}",foldTitle:"{{len}} {{unit}}"}};function _create_class$2(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}var _$BASE_TIME_LINE_DEFAULT_OPTIONS$_={current:new Date,language:"zh",timeSections:[],readOnly:false,className:"",timeWidth:0,width:"100%",timePointColor:"#1890ff",timeTextColor:"#FFF",timeScaleColor:"#FFF",timeSectionColor:"rgba(24, 144, 255, 0.5)",timeAxisBgColor:"#000",onChange:function(){},onDragStart:function(){},onDragging:function(){},onDragEnd:function(){},onDestroy:function(){}},BaseTimeLine=function(){function BaseTimeLine(container,options){if(this._current=new Date,this._readOnly=false,this._width=0,this._height=0,this._destroyed=false,this._timeWidth=0,this._timeSections=[],this.$container=container,!container)throw new Error("container is required");var left,right;this.options=deepmerge(_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}),this.options.timeSections&&Array.isArray(this.options.timeSections)&&(this._timeSections=this.options.timeSections),this.options.readOnly&&(this.readOnly=this.options.readOnly),this.options.className&&this.$container.classList.add(this.options.className),this.$container.style.position="relative",this.options.current&&(left=this.options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?this._current=this.options.current||new Date:this._current=new Date,this.i18n=new I18n(deepmerge(_$TIMELINE_LOCALES$_,this.options.locales||{},{clone:false}),{defaultLocale:this.options.language||"zh"}),this._timeWidth=this.options.timeWidth||0,this._resize(this.options.width||"100%",this.options.height);}var _proto=BaseTimeLine.prototype;return _proto.setReadOnly=function(readOnly){this.readOnly=readOnly;},_proto.update=function(current){this._current=current;},_proto.updateTimeSections=function(timeSections){timeSections&&Array.isArray(timeSections)&&(this._timeSections=timeSections);},_proto.resize=function(width,height){this._resize(width,height);},_proto._resize=function(width,height){var cssText="";/^\d+(\.\d+)?$/.test(width+"")?cssText+="width: "+width+"px;":width&&(cssText+="width: "+width+";"),/^\d+(\.\d+)?$/.test(height+"")?cssText+="height: "+height+"px;":height&&(cssText+="height: "+height+";"),this.$container&&(this.$container.style.cssText+=cssText),this._width=Math.floor(this.$container.clientWidth),this._height=Math.floor(this.$container.clientHeight);},_proto.setTimeWidth=function(timeWidth){[0,1,2,3,4,5].includes(timeWidth)&&(this._timeWidth=timeWidth);},_proto.destroy=function(){this._current=null,null==this.options.onDestroy||this.options.onDestroy.call(this.options),this._timeSections=[],this._readOnly=false,this._destroyed=true;},_create_class$2(BaseTimeLine,[{key:"current",get:function(){return this._current},set:function(current){this._current=current;}},{key:"readOnly",get:function(){return this._readOnly},set:function(readOnly){this._readOnly!==readOnly&&(this._readOnly=readOnly,this.$container.style.cursor=readOnly?"not-allowed":"pointer");}},{key:"timeSections",get:function(){return this._timeSections}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"timeWidth",get:function(){return this._timeWidth}}]),BaseTimeLine}();BaseTimeLine.LOCALES=_$TIMELINE_LOCALES$_;var TimeLineUtil=function(){function TimeLineUtil(){}return TimeLineUtil.toDate=function(time){var left,right,date=null;return "string"==typeof time&&time.includes(":")?date=new Date(time):"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||10!==(time+"").length?"string"!=typeof time&&"number"!=typeof time||!/\d/.test(time+"")||13!==(time+"").length?(left=time,date=(null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)?time:new Date):date=new Date(+time):date=new Date(1e3*+time),date},TimeLineUtil.formatDateToHHmmss=function(time){var date=TimeLineUtil.toDate(time);if(date){var h=date.getHours(),m=date.getMinutes(),s=date.getSeconds();return (h>9?h:"0"+h)+":"+(m>9?m:"0"+m)+":"+(s>9?s:"0"+s)}return "00:00:00"},TimeLineUtil.subTime=function(m){return +m>9?m+"":"0"+m},TimeLineUtil.tranTime=function(time,fmt){ void 0===fmt&&(fmt="YYYY-MM-DD HH:mm:ss");var newDate=TimeLineUtil.toDate(time);return newDate?"YYYY-MM-DD"===fmt?newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate()):"HH:mm:ss"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH"===fmt?TimeLineUtil.subTime(newDate.getHours()):"mm:ss"===fmt?TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):"HH:mm"===fmt?TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes()):"YYYYMMDDTHHmmssZ"===fmt?newDate.getFullYear()+""+TimeLineUtil.subTime(newDate.getMonth()+1)+TimeLineUtil.subTime(newDate.getDate())+"T"+TimeLineUtil.subTime(newDate.getHours())+TimeLineUtil.subTime(newDate.getMinutes())+TimeLineUtil.subTime(newDate.getSeconds())+"Z":newDate.getFullYear()+"-"+TimeLineUtil.subTime(newDate.getMonth()+1)+"-"+TimeLineUtil.subTime(newDate.getDate())+" "+TimeLineUtil.subTime(newDate.getHours())+":"+TimeLineUtil.subTime(newDate.getMinutes())+":"+TimeLineUtil.subTime(newDate.getSeconds()):""},TimeLineUtil.timeToSecond=function(time){var e=time.split(":");return 60*Number(e[0])*60+60*Number(e[1])+(Number(e[2])||0)},TimeLineUtil.minuteToTime=function(minute){var hour=Math.floor(minute/60),m=minute%60;return (hour>9?hour:"0"+hour)+":"+(m>9?m:"0"+m)},TimeLineUtil.timeToMinute=function(time){var e=time.split(":");return 60*Number(e[0])+Number(e[1])},TimeLineUtil.isOverlap=function(a_start,a_end,b_start,b_end){return Math.max(a_start,b_start)<=Math.min(a_end,b_end)},TimeLineUtil.tranTimeToString=function(start,end){var _TimeLineUtil_toDate,_TimeLineUtil_toDate1,secondNum=Math.floor((null==(_TimeLineUtil_toDate=TimeLineUtil.toDate(end))?void 0:_TimeLineUtil_toDate.getTime())-(null==(_TimeLineUtil_toDate1=TimeLineUtil.toDate(start))?void 0:_TimeLineUtil_toDate1.getTime()))/1e3,second=secondNum%60,minute=Math.floor(secondNum/60);return (minute>0?TimeLineUtil.subTime(minute)+"'":"0'")+TimeLineUtil.subTime(second)+"''"},TimeLineUtil}(),_$TIMELINE_ICONS$__tip='<svg viewBox="0 0 57 24" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="tip">\n <path class="ez-time-line-icon-tip" fill-rule="evenodd" d="m4,0l44,0c2.2091,0 4,1.7909 4,4l0,3.8218l4.9399,3.3572c0.5839,0.3968 0.5839,1.2574 0,1.6542l-4.9399,3.3572l0,3.8096c0,2.2091 -1.7909,4 -4,4l-44,0c-2.2091,0 -4,-1.7909 -4,-4l0,-16c0,-2.2091 1.7909,-4 4,-4z"/>\n </svg>',_$TIMELINE_ICONS$__plus='\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="plus">\n <path d="M0 0L10.6667 0" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5" transform="matrix(0,1,-1,0,8,2.66663)"/>\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__minus='\n <svg viewBox="0 0 16 16" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="minus">\n <path d="M2.66669 8L13.3334 8" stroke="rgb(44,44,44)" stroke-linecap="round" stroke-width="1.5"/>\n </svg>\n ',_$TIMELINE_ICONS$__close='\n <svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true" data-icon="close">\n\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n\t\t <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n </svg>\n ',_$TIMELINE_ICONS$__pause='<svg viewBox="0 0 20 20" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="pause">\n\t\t <path d="M9.43914 2.47881L13.4688 8.4912C14.3594 9.81998 13.4071 11.6047 11.8074 11.6047L3.74811 11.6047C2.14849 11.6047 1.19616 9.81998 2.08675 8.4912L6.11641 2.47881C6.90863 1.2968 8.64693 1.2968 9.43914 2.47881Z" fill-rule="evenodd" transform="matrix(0,1,-1,0,16.5781,2.22229)" />\n </svg>\n ',_$TIMELINE_ICONS$__picture='\n <svg viewBox="0 0 19.1613 19.4583" fill="currentColor" width="1em" height="1em" focusable="false" aria-hidden="true" data-icon="picture">\n <path xmlns="http://www.w3.org/2000/svg" id="形状结合" d="M15.3276 2.63477L3.83173 2.63477C2.70848 2.63477 1.79541 3.55027 1.79541 4.68419L1.79541 14.7737C1.79541 15.9076 2.70848 16.8231 3.83173 16.8231L15.3276 16.8231C16.4504 16.8231 17.364 15.9074 17.364 14.7737L17.364 4.68419C17.364 3.55027 16.4509 2.63477 15.3276 2.63477ZM3.83247 3.851L15.3284 3.851C15.7936 3.851 16.1671 4.22551 16.1671 4.68429L16.1671 14.7738C16.1671 15.2323 15.7932 15.6071 15.3284 15.6071L3.83247 15.6071C3.36725 15.6071 2.99373 15.2326 2.99373 14.7738L2.99373 12.2622L6.7356 9.56381L6.78139 9.53916C6.84532 9.51493 6.91856 9.52524 6.9742 9.56947L13.2644 14.5698L13.3381 14.62C13.5918 14.7666 13.9197 14.7063 14.105 14.4658C14.3089 14.2014 14.263 13.8192 14.0026 13.6122L7.71239 8.61184L7.60526 8.5346C7.12945 8.22451 6.51026 8.23473 6.04222 8.57224L2.99373 10.7706L2.99373 4.68429C2.99373 4.22551 3.36725 3.851 3.83247 3.851ZM10.5794 7.29679C10.5794 6.06542 11.5624 5.0672 12.7749 5.0672C13.9875 5.0672 14.9705 6.06542 14.9705 7.29679C14.9705 8.52817 13.9875 9.52639 12.7749 9.52639C11.5624 9.52639 10.5794 8.52817 10.5794 7.29679ZM13.7722 7.2967C13.7722 6.73699 13.3254 6.28325 12.7742 6.28325C12.223 6.28325 11.7762 6.73699 11.7762 7.2967C11.7762 7.85642 12.223 8.31015 12.7742 8.31015C13.3254 8.31015 13.7722 7.85642 13.7722 7.2967Z" fill-rule="evenodd"/>\n </svg>\n ',TIME_WIDTH=[[1,10,10,"单位 1秒"],[60,20,5,"单位 1分钟"],[600,20,6,"单位 10分钟"],[3600,30,6,"单位 1小时"],[14400,40,2,"单位 4小时"],[43200,80,2,"单位 12小时"]],MOBILE_TIME_WIDTH=[[1,10,10,"单位 1分钟"],[10,20,5,"单位 10分钟"],[30,20,6,"单位 30分钟"],[60,30,6,"单位 1小时"],[120,40,2,"单位 2小时"],[240,80,2,"单位 4小时"]];function _create_class$1(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends$1(){return _extends$1=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends$1.apply(this,arguments)}function _set_prototype_of$1(o,p){return _set_prototype_of$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1(o,p)}var _$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_=Object.assign({},_$BASE_TIME_LINE_DEFAULT_OPTIONS$_,{height:400,width:"100%",timeWidth:0,readOnly:false,timePointColor:"#648FFC",timeTextColor:"#666666",timeScaleColor:"transparent",timeSectionColor:"#369FFF",timeAxisBgColor:"#BDCDFF",currentTimeBgColor:"#648FFC",currentTimeColor:"#FFFFFF",showTimeWidthBtn:true}),MobileTimeLine=function(BaseTimeLine){function MobileTimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$MOBILE_TIME_LINE_DEFAULT_OPTIONS$_,options,{clone:false}))||this)._isTouchStart=false,_this._dragScroll=null,_this._moveStartX=0,_this._moveStartY=0,_this.state={start:"00:00:00",end:"24:00:00",current:null,timeArr:[],availTimeLine:[],index:0},_this._plusClick=_this._plusClick.bind(_this),_this._minusClick=_this._minusClick.bind(_this),_this._onPickerClose=_this._onPickerClose.bind(_this),_this._onClickItem=_this._onClickItem.bind(_this),_this._onClickCoverFold=_this._onClickCoverFold.bind(_this),_this._onImageError=_this._onImageError.bind(_this),_this._render(),_this.options.timeSections&&Array.isArray(_this.options.timeSections)&&_this.updateTimeSections(_this.options.timeSections),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of$1(subClass,superClass);}(MobileTimeLine,BaseTimeLine);var _proto=MobileTimeLine.prototype;return _proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._dragScroll&&(this._dragScroll.readonly=readOnly);},_proto.setTimeWidth=function(timeWidth){MOBILE_TIME_WIDTH[timeWidth]&&(BaseTimeLine.prototype.setTimeWidth.call(this,timeWidth),this._matchTimeDot());},_proto.updateTimeSections=function(timeSections,defaultIndex){BaseTimeLine.prototype.updateTimeSections.call(this,timeSections);var list=timeSections.map(function(record){return _extends$1({},record,{startTime:TimeLineUtil.formatDateToHHmmss(record.startTime),endTime:TimeLineUtil.formatDateToHHmmss(record.endTime)})});if(list.length>0){ void 0===defaultIndex&&(defaultIndex=list.length-1);var current=this.state.current;this._setState({availTimeLine:list,start:list[defaultIndex].startTime,end:list[defaultIndex].endTime,current:null===current?list[defaultIndex].startTime:current}),this._matchTimeDot();}else this._setState({availTimeLine:[],current:TimeLineUtil.formatDateToHHmmss(this.current||(new Date).getTime())}),this._matchTimeDot();},_proto.update=function(time){var _this__dragScroll;time&&!(null==(_this__dragScroll=this._dragScroll)?void 0:_this__dragScroll.isDragging)&&(this._setState({current:TimeLineUtil.tranTime(time,"HH:mm:ss")}),this._currentOffsetH());},_proto.destroy=function(){var _this__dragScroll,_this__picker_$body_querySelectorAll,_this__picker_$body;if(this._scrollTimer&&(clearInterval(this._scrollTimer),this._scrollTimer=null),this._$currentTime)try{this.$container.removeChild(this._$currentTime),this._$currentTime=null;}catch(error){}if(this._$itemList&&this._imageRemoveErrorEvent(this._$itemList.querySelectorAll("img.ez-time-line-img")||[]),this._$itemContainer&&this._$itemList)try{this._$itemContainer.removeChild(this._$itemList),this._$itemList=null;}catch(error){}if(this._$itemContainer)try{this.$container.removeChild(this._$itemContainer),this._$itemContainer=null;}catch(error){}if(this._$op)try{this.$container.removeChild(this._$op),this._$op=null;}catch(error){}this._picker&&(this._imageRemoveErrorEvent((null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelectorAll=_this__picker_$body.querySelectorAll)?void 0:_this__picker_$body_querySelectorAll.call(_this__picker_$body,"img"))||[]),this._picker.destroy(),this._picker=null);this._removeEventListener(),null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.destroy(),this._dragScroll=null,BaseTimeLine.prototype.destroy.call(this);},_proto._setState=function(obj){var _this=this;Object.keys(obj).forEach(function(key){var _this__dragScroll,_this_timeSections_;"current"===key&&obj[key]?(_this._setCurrentDOM(obj[key]),_this.state.current===obj[key]||(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.isDragging)||(_this.state[key]=obj[key],_this.current=new Date(TimeLineUtil.tranTime((null==(_this_timeSections_=_this.timeSections[0])?void 0:_this_timeSections_.endTime)||(new Date).getTime(),"YYYY-MM-DD")+" "+obj[key]),null==_this.options.onChange||_this.options.onChange.call(_this.options,_this.current))):_this.state[key]=obj[key];});},_proto._setCurrentDOM=function(time){this._$currentTime&&(this._$currentTime.querySelector(".ez-time-line-current-value").innerHTML=time);},_proto._matchTimeDot=function(){for(var scaleWidth=this._scaleWidth,timeArr=[],minute=TimeLineUtil.timeToMinute("24:00:00"),i=minute=Math.floor(minute/scaleWidth)*scaleWidth;i>=0;){var marginTop=0,marginBottom=0;i==minute&&(marginTop=70),0==i&&(marginBottom=this.$container.clientHeight-70);var time=TimeLineUtil.minuteToTime(i);timeArr.push({id:i,current:time,label:"a"+i,marginTop:marginTop,marginBottom:marginBottom,recArr:[],coverArr:this._filterTimeSectionsByTime(time)}),i-=scaleWidth;}this._setState({timeArr:timeArr}),this._matchRecTimeDot();},_proto._matchRecTimeDot=function(){var _this_state=this.state,availTimeLine=_this_state.availTimeLine,timeArr=_this_state.timeArr,scaleWidth=this._scaleWidth,len=availTimeLine.length;if(0===len)for(var j=0;j<timeArr.length;j++)timeArr[j].recArr=[];else {for(var k=0;k<timeArr.length;k++)timeArr[k].recArr=[];for(var i=0;i<len;i++){var stAvailPercent,etAvailPercent,temp=availTimeLine[i],st=TimeLineUtil.timeToSecond(temp.startTime),et=TimeLineUtil.timeToSecond(temp.endTime),stMinute=Math.floor(st/(60*scaleWidth))*scaleWidth;stAvailPercent=(st-60*stMinute)/scaleWidth;var etMinute=Math.floor(et/(60*scaleWidth))*scaleWidth;etAvailPercent=(et-60*etMinute)/scaleWidth;for(var j1=0;j1<timeArr.length;j1++)if(timeArr[j1].id==stMinute&&timeArr[j1].id==etMinute){var height=etAvailPercent-stAvailPercent,top=60-etAvailPercent;timeArr[j1].recArr.push({height:height,top:top});}else timeArr[j1].id==stMinute?timeArr[j1].recArr.push({height:60-stAvailPercent,top:0}):timeArr[j1].id==etMinute?timeArr[j1].recArr.push({height:etAvailPercent,top:60-etAvailPercent}):timeArr[j1].id>stMinute&&timeArr[j1].id<etMinute&&timeArr[j1].recArr.push({height:60,top:0});}}this._setState({timeArr:timeArr}),this._renderDateLine();},_proto._renderDateLine=function(){var _this=this,timeArr=this.state.timeArr,container=this._$itemList;this._imageRemoveErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]),container.innerHTML="",timeArr.forEach(function(item,index){var timeItemDOM=document.createElement("div");timeItemDOM.setAttribute("class","ez-time-line-time-scale-area"),item.marginTop&&(timeItemDOM.style.cssText+="margin-top: "+item.marginTop+"px;"),item.marginBottom&&(timeItemDOM.style.cssText+="margin-bottom: "+item.marginBottom+"px;"),timeItemDOM.style.cssText+="border-right-color: "+(_this.options.timeAxisBgColor||"rgba(189, 205, 255, 1)")+";",timeItemDOM.setAttribute("data-time",item.current),timeItemDOM.setAttribute("data-index",index+""),document.createElement("div").setAttribute("class","ez-time-line-scale");var timeItemHtml="";item.coverArr.length&&(timeItemHtml+='\n <div class="ez-time-line-time-cover-fold '+(item.coverArr.length>1?"ez-time-line-time-cover-fold-multiple":"")+'"\n data-start="'+item.current+'">\n '+(item.coverArr.length>1?'<div class="ez-time-line-cover-fold-placeholder" style="color: #FFF"></div>':"")+'\n <div class="ez-time-line-time-cover-fold-img">\n <img src="'+_this._setImageScr(item.coverArr[0].coverPic)+'" class="ez-time-line-img"/>\n <span class="ez-time-line-time-cover-fold-len">\n '+(item.coverArr.length>1?_this.i18n.t("foldTitle",{len:item.coverArr.length,unit:"videos"}):""+TimeLineUtil.tranTime(item.coverArr[0].startTime,"HH:mm"))+"\n </span>\n "+(1===item.coverArr.length?'<span class="ez-time-line-time-cover-fold-time">'+TimeLineUtil.tranTimeToString(item.coverArr[0].startTime,item.coverArr[0].endTime)+"</span>":"")+'\n <span class="ez-time-line-time-cover-fold-pause">'+_$TIMELINE_ICONS$__pause+"</span>\n </div>\n </div>"),item.recArr.forEach(function(i){timeItemHtml+='<div class="ez-time-line-time-unavail"\n style="height: '+i.height+"px;background-color:"+(_this.options.timeSectionColor||"#369FFF")+"; top: "+i.top+'px">\n </div>';}),timeItemHtml+="<div id="+item.label+' class="ez-time-line-time-label" style="color: '+(_this.options.timeTextColor||"#666")+'">'+item.current+"</div>",timeItemDOM.innerHTML=timeItemHtml,container.appendChild(timeItemDOM),_this._imageErrorEvent(container.querySelectorAll("img.ez-time-line-img")||[]);}),this._currentOffsetH();},_proto._currentOffsetH=function(){var current=this.state.current;if(current){var _this__dragScroll,y=(86400-TimeLineUtil.timeToSecond(current)||0)/this._scaleWidth;null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y+60,false);}},_proto._render=function(){var _this=this;if(this._$currentTime=document.createElement("div"),this._$currentTime.classList.add("ez-time-line-current"),this._$currentTime.innerHTML='<div class="ez-time-line-current-content" style="color: '+(this.options.currentTimeBgColor||"#648FFC")+'">\n <span class="ez-time-line-current-tip">'+_$TIMELINE_ICONS$__tip+'</span>\n <span class="ez-time-line-current-tip-line" style="background-color: '+(this.options.timePointColor||"#648FFC")+';"></span>\n <div class="ez-time-line-current-value" style="color: '+(this.options.currentTimeColor||"#FFFFFF")+'">00:00:00</div>\n </div>',this.$container.appendChild(this._$currentTime),this._$itemContainer=document.createElement("div"),this._$itemContainer.classList.add("ez-time-line-container"),this.$container.appendChild(this._$itemContainer),this._dragScroll=new DragScroll(this._$itemContainer,{hideScrollbar:true,onChange:function(state){var result=_this._offsetYToTime(state.y);result[1]!==_this.state.current&&_this._setCurrentDOM(result[0]>=86400?"23:59:59":result[1]);},onDragStart:function(e){_this._moveStartX=e.clientX,_this._moveStartY=e.clientY,null==_this.options.onDragStart||_this.options.onDragStart.call(_this.options,_this.state.current);},onDragging:function(){null==_this.options.onDragging||_this.options.onDragging.call(_this.options,_this.state.current);},onDragEnd:function(){var _this__dragScroll,result=_this._offsetYToTime(null==(_this__dragScroll=_this._dragScroll)?void 0:_this__dragScroll.currentY);result[1]!==_this.state.current&&_this._setState({current:result[0]>=86400?"23:59:59":result[1]}),null==_this.options.onDragEnd||_this.options.onDragEnd.call(_this.options,_this.state.current);}}),/\d/.test(this.options.height))this._$itemContainer.style.cssText+="height: "+this.options.height+"px";else if("string"==typeof this.options.height)this._$itemContainer.style.cssText+="height: "+this.options.height;else {var height=this.$container.clientHeight;this._$itemContainer.style.cssText+="height: "+height+"px";}this._$itemList=document.createElement("div"),this._$itemList.classList.add("ez-time-line-item"),this._dragScroll.$content.appendChild(this._$itemList),this.options.showTimeWidthBtn&&(this._$op=document.createElement("div"),this._$op.classList.add("ez-time-line-op"),this._$op.innerHTML='<span class="ez-time-line-op-wrapper"><span class="ez-time-line-icon-plus">'+_$TIMELINE_ICONS$__plus+'</span> <span class="ez-time-line-icon-minus">'+_$TIMELINE_ICONS$__minus+"</span></span>",this.$container.appendChild(this._$op)),this._picker=new Picker(null,{isMobile:true,wrapClassName:"ez-time-line-picker",onOpenChange:function(isOpen){var _this_options_onPickerOpenChange,_this_options;null==(_this_options=_this.options)||null==(_this_options_onPickerOpenChange=_this_options.onPickerOpenChange)||_this_options_onPickerOpenChange.call(_this_options,isOpen);}}),this._addEventListener();},_proto._addEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.addEventListener("click",this._plusClick,false),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.addEventListener("click",this._minusClick,false));this._matchTimeDot(),this._picker&&(this._delegatePickerClose=delegate(this._picker.$body,".ez-time-line-picker-close","click",this._onPickerClose,false),this._delegateItemContent=delegate(this._picker.$body,".ez-time-line-picker-item-content","click",this._onClickItem,false),this._delegateCoverFold=delegate(this._$itemList,".ez-time-line-time-cover-fold","click",this._onClickCoverFold,false));},_proto._removeEventListener=function(){var _this__$op_querySelector,_this__$op_querySelector1,_this__picker_$body_querySelector,_this__picker_$body;this.options.showTimeWidthBtn&&this._$op&&(null==(_this__$op_querySelector=this._$op.querySelector(".ez-time-line-icon-plus"))||_this__$op_querySelector.removeEventListener("click",this._plusClick),null==(_this__$op_querySelector1=this._$op.querySelector(".ez-time-line-icon-minus"))||_this__$op_querySelector1.removeEventListener("click",this._minusClick));this._picker&&(null==(_this__picker_$body=this._picker.$body)||null==(_this__picker_$body_querySelector=_this__picker_$body.querySelector(".ez-time-line-picker-close"))||_this__picker_$body_querySelector.removeEventListener("click",this._onPickerClose),this._delegateItemContent&&(this._delegateItemContent.forEach(function(delegation){delegation.destroy();}),this._delegateItemContent=null),this._delegatePickerClose&&(this._delegatePickerClose.forEach(function(delegation){delegation.destroy();}),this._delegatePickerClose=null),this._delegateCoverFold&&(this._delegateCoverFold.forEach(function(delegation){delegation.destroy();}),this._delegateCoverFold=null));},_proto._plusClick=function(){var timeWidth=this.timeWidth+1;timeWidth>0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(timeWidth);},_proto._minusClick=function(){var timeWidth=this.timeWidth-1;timeWidth>=0&&timeWidth<MOBILE_TIME_WIDTH.length&&this.setTimeWidth(Math.floor(timeWidth));},_proto._timeSectionsToGroupsByHour=function(list){var obj={};return list.forEach(function(item,index){var hour=TimeLineUtil.tranTime(item.startTime,"HH");obj[+hour]?obj[+hour].push(_extends$1({},item,{_index:index})):obj[+hour]=[_extends$1({},item,{_index:index})];}),obj},_proto._filterTimeSectionsByTime=function(start){if(!start)return [];var startSecond=TimeLineUtil.timeToSecond(start+":00"),endSecond=TimeLineUtil.timeToSecond(start+":00")+60*this._scaleWidth;return this.timeSections.filter(function(item){var _$start=TimeLineUtil.timeToSecond(TimeLineUtil.tranTime(item.startTime,"HH:mm:ss"));return _$start>=startSecond&&_$start<endSecond})},_proto._renderPickerContent=function(start){var _this__picker_innerHTML,_this__picker,_this__picker1,_this__picker2,_this=this,list=this._filterTimeSectionsByTime(start),hourGroups=this._timeSectionsToGroupsByHour(list);(null==(_this__picker=this._picker)||null==(_this__picker_innerHTML=_this__picker.innerHTML)||_this__picker_innerHTML.call(_this__picker,'<div class="ez-time-line-picker-container">\n <div class="ez-time-line-picker-header">\n <span class="ez-time-line-picker-close">'+_$TIMELINE_ICONS$__close+"</span>\n "+this.i18n.t("title",{len:list.length,unit:list.length>1?"videos":"video"})+'\n </div>\n <div class="ez-time-line-picker-content">\n <div class="ez-time-line-picker-list">\n '+Object.keys(hourGroups).reverse().map(function(key){return '<div class="ez-time-line-picker-item">\n <div class="ez-time-line-picker-item-title">'+key+':00</div>\n <div class="ez-time-line-picker-item-list">\n '+hourGroups[key].reverse().map(function(item){return '<div class="ez-time-line-picker-item-content"\n data-start="'+TimeLineUtil.tranTime(item.startTime,"YYYYMMDDTHHmmssZ")+'"\n data-end="'+TimeLineUtil.tranTime(item.endTime,"YYYYMMDDTHHmmssZ")+'"\n data-index="'+item._index+'">\n <span class="ez-time-line-picker-item-time">'+TimeLineUtil.tranTime(item.startTime,"HH:mm")+'</span>\n <span class="ez-time-line-picker-item-duration">\n '+TimeLineUtil.tranTimeToString(item.startTime,item.endTime)+'\n </span>\n <img class="ez-time-line-picker-item-cover" src="'+_this._setImageScr(item.coverPic)+'"/>\n </div>'}).join("")+"\n </div>\n </div>"}).join("")+"\n </div>\n </div>\n </div>\n </div>"),null==(_this__picker1=this._picker)?void 0:_this__picker1.$body)&&this._imageErrorEvent((null==(_this__picker2=this._picker)?void 0:_this__picker2.$body.querySelectorAll("img"))||[]);},_proto._imageErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){img.hasAttribute("data-error")||img.addEventListener("error",_this._onImageError);});},_proto._imageRemoveErrorEvent=function(list){var _this=this;void 0===list&&(list=[]),Array.from(list).forEach(function(img){img.removeEventListener("error",_this._onImageError);});},_proto._onImageError=function(e){var img=e.target;if(!img.hasAttribute("data-error")){var _img_parentNode,placeholder=document.createElement("div");placeholder.classList.add("ez-time-line-item-cover-placeholder"),placeholder.innerHTML=""+_$TIMELINE_ICONS$__picture,null==(_img_parentNode=img.parentNode)||_img_parentNode.appendChild(placeholder),img.remove();}},_proto._onPickerClose=function(){this._picker&&(this._picker.open=false);},_proto._onClickItem=function(e){var _e_delegateTarget_getAttribute,_e_delegateTarget,index=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_getAttribute=_e_delegateTarget.getAttribute)?void 0:_e_delegateTarget_getAttribute.call(_e_delegateTarget,"data-index");this._picker&&(this._picker.open=false),null==this.options.onPickerSelect||this.options.onPickerSelect.call(this.options,this.timeSections[+index]);},_proto._onClickCoverFold=function(e){var _e_delegateTarget_parentElement_getAttribute,_e_delegateTarget_parentElement,_e_delegateTarget;e.preventDefault();var time=null==(_e_delegateTarget=e.delegateTarget)||null==(_e_delegateTarget_parentElement=_e_delegateTarget.parentElement)||null==(_e_delegateTarget_parentElement_getAttribute=_e_delegateTarget_parentElement.getAttribute)?void 0:_e_delegateTarget_parentElement_getAttribute.call(_e_delegateTarget_parentElement,"data-time"),moveX=Math.abs(this._moveStartX-e.clientX),moveY=Math.abs(this._moveStartY-e.clientY);this._picker&&time&&!(moveX>=1||moveY>=1)&&(this._renderPickerContent(time),this._picker.open=true);},_proto._setImageScr=function(src){if(src){var query="x=200&"+(this.options.coverQuery||"");return src+(src.includes("?")?"&":"?")+query}return ""},_proto._offsetYToTime=function(offsetY){var _this__dragScroll,y=offsetY;offsetY<60&&(y=60,null==(_this__dragScroll=this._dragScroll)||_this__dragScroll.scrollToY(y));var second=86400-Math.floor((y-60)*this._scaleWidth);return [second,TimeLineUtil.subTime(Math.floor(second/3600))+":"+TimeLineUtil.subTime(Math.floor(second%3600/60))+":"+TimeLineUtil.subTime(second%60)]},_create_class$1(MobileTimeLine,[{key:"_scaleWidth",get:function(){return (MOBILE_TIME_WIDTH[this.timeWidth]||MOBILE_TIME_WIDTH[0])[0]}}]),MobileTimeLine}(BaseTimeLine);function _create_class(Constructor,protoProps,staticProps){return protoProps&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false,descriptor.configurable=true,"value"in descriptor&&(descriptor.writable=true),Object.defineProperty(target,descriptor.key,descriptor);}}(Constructor.prototype,protoProps),Constructor}function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);}return target},_extends.apply(this,arguments)}function _set_prototype_of(o,p){return _set_prototype_of=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of(o,p)}var _$TIMELINE_DEFAULT_OPTIONS$_={height:36,dpr:window.devicePixelRatio||2,scaleOffsetTop:4,showYearMonthDay:true},TimeLine=function(BaseTimeLine){function TimeLine(container,options){var _this;return (_this=BaseTimeLine.call(this,container,deepmerge(_$TIMELINE_DEFAULT_OPTIONS$_,options,{clone:true}))||this)._$canvas=null,_this._ctx=null,_this._timeWidthArray=TIME_WIDTH[0],_this._centerPositionX=0,_this._isMouseDown=false,_this._mousePosition=0,_this._oldTime=null,_this._isOver=false,_this._moved=false,_this._isCtrlKeyDown=false,_this._lastTouchDist=0,_this.$container=container,_this._mousemoveFun=_this._mousemoveFun.bind(_this),_this._mouseoverFun=_this._mouseoverFun.bind(_this),_this._mouseleaveFun=_this._mouseleaveFun.bind(_this),_this._mousedownFun=_this._mousedownFun.bind(_this),_this._mouseUpFun=_this._mouseUpFun.bind(_this),_this._mousewheelFun=_this._mousewheelFun.bind(_this),_this._touchstartFun=_this._touchstartFun.bind(_this),_this._touchmoveFun=_this._touchmoveFun.bind(_this),_this._touchendFun=_this._touchendFun.bind(_this),_this._ctrlKeyDownFun=_this._ctrlKeyDownFun.bind(_this),_this._ctrlKeyUpFun=_this._ctrlKeyUpFun.bind(_this),_this._init(),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}}),superClass&&_set_prototype_of(subClass,superClass);}(TimeLine,BaseTimeLine);var _proto=TimeLine.prototype;return _proto._init=function(){this._$canvas=document.createElement("canvas"),this._ctx=this._$canvas.getContext("2d"),this.readOnly||(this._$canvas.style.cssText+="cursor: pointer;"),this.$container.appendChild(this._$canvas),this.resize(this.width,this.height),this._update({current:this.current,timeWidth:this.timeWidth,timeSections:this.timeSections}),this._addEventListener();},_proto.resize=function(width,height){BaseTimeLine.prototype.resize.call(this,width,height),this._$canvas&&width&&(this._$canvas.width=this.width*this.options.dpr,this._$canvas.style.cssText+="width: "+this.width+"px;"),this._$canvas&&height&&(this._$canvas.height=this.height*this.options.dpr,this._$canvas.style.cssText+="height: "+this.height+"px;"),this._draw();},_proto.setTimeWidth=function(timeWidth){this._update({timeWidth:timeWidth});},_proto.updateTimeSections=function(timeSections){this._update({timeSections:timeSections});},_proto.update=function(time){time&&!this._isMouseDown&&this._update({current:new Date(TimeLineUtil.tranTime(time,"YYYY-MM-DD HH:mm:ss"))});},_proto._update=function(options){var left,right,_this__$canvas;(void 0===options&&(options={}),(null==options?void 0:options.current)&&(left=options.current,null!=(right=Date)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](left):left instanceof right)&&(this.current=options.current),(null==options?void 0:options.timeSections)&&BaseTimeLine.prototype.updateTimeSections.call(this,this._mergeTimeSections(options.timeSections)),"number"==typeof(null==options?void 0:options.timeWidth)&&(null==options?void 0:options.timeWidth)<TIME_WIDTH.length&&(BaseTimeLine.prototype.setTimeWidth.call(this,options.timeWidth),this._timeWidthArray=TIME_WIDTH[Math.floor(this.timeWidth)]),"number"==typeof(null==options?void 0:options.timeWidth)&&this._timeWidthArray)&&(this._timeWidthArray[3]&&(null==(_this__$canvas=this._$canvas)||_this__$canvas.setAttribute("data-title",this._timeWidthArray[3])));this._draw();},_proto.setReadOnly=function(readOnly){BaseTimeLine.prototype.setReadOnly.call(this,readOnly),this._$canvas&&(this._$canvas.style.cssText+="cursor: "+(readOnly?"not-allowed":"pointer"));},_proto.destroy=function(){if(this._removeEventListener(),this._$canvas)try{this.$container.removeChild(this._$canvas),this._$canvas=null;}catch(e){}BaseTimeLine.prototype.destroy.call(this);},_proto._draw=function(){this._ctx&&(this._ctx.fillStyle=this.options.timeAxisBgColor,this._ctx.fillRect(0,0,this.width*this.options.dpr,this.height*this.options.dpr)),this._drawSections(),this._drawScale();},_proto._drawScale=function(){var lineWidth=1*this.options.dpr;this._centerPositionX=parseInt(this.width*this.options.dpr/2+"");for(var centerPosition={x:this.width*this.options.dpr/2,y:this.height*this.options.dpr},curScaleTime=Math.floor(this.current.getTime()/1e3),offsetSecond=(curScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*curScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%this._timeWidthArray[0],padding=this.height*this.options.dpr/20,spacing=this._curScaleSpacing*this.options.dpr,rightLastScaleTimeX=Math.floor(this._centerPositionX+(this._timeWidthArray[0]-offsetSecond)/this._timeWidthArray[0]*spacing),leftLastScaleTime=curScaleTime-offsetSecond,rightLastScaleTime=leftLastScaleTime+this._timeWidthArray[0],x=rightLastScaleTimeX-spacing;x>0;x-=spacing){0===(leftLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(this._drawSolidLine(x,padding,x,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*leftLastScaleTime)),x,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x,padding,x,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),leftLastScaleTime-=this._timeWidthArray[0];}for(var x1=rightLastScaleTimeX;x1<=this.width*this.options.dpr;x1+=spacing){0===(rightLastScaleTime-Math.floor(new Date(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime),"YYYY-MM-DD")+" 00:00:00").getTime()/1e3))%(this._timeWidthArray[0]*this._timeWidthArray[2])?(this._drawSolidLine(x1,padding,x1,padding+(this.options.scaleOffsetTop+4)*this.options.dpr,lineWidth),this._drawTextString(TimeLineUtil.tranTime(new Date(1e3*rightLastScaleTime)),x1,padding+(this.options.scaleOffsetTop+4+4)*this.options.dpr,"center")):this._drawSolidLine(x1,padding,x1,padding+this.options.scaleOffsetTop*this.options.dpr,lineWidth),rightLastScaleTime+=this._timeWidthArray[0];}this._drawSolidLine(centerPosition.x,0,centerPosition.x,centerPosition.y,lineWidth,this.options.timePointColor);},_proto._drawSolidLine=function(startX,startY,endX,endY,lineWidth,color){this._ctx&&(this._ctx.save(),this._ctx.strokeStyle=null!=color?color:this.options.timeScaleColor,this._ctx.lineWidth=lineWidth,this._ctx.beginPath(),this._ctx.moveTo(startX,startY),this._ctx.lineTo(endX,endY),this._ctx.stroke(),this._ctx.restore());},_proto._drawTextString=function(text,x,y,align){if(this._ctx){var timeTexts=text.split(" ");this._ctx.font=12*this.options.dpr*1+"px serif",this._ctx.fillStyle=this.options.timeTextColor,this._ctx.textAlign=align||"left",this._timeWidthArray[0]%60==0&&(timeTexts[1]=timeTexts[1].replace(/:00$/,"")),this._ctx.fillText(timeTexts[1],x,y+8*this.options.dpr),!this.options.showYearMonthDay||"00:00:00"!==timeTexts[1]&&"00:00"!==timeTexts[1]&&this._timeWidthArray[0]*this._timeWidthArray[2]!==86400||(this._ctx.textAlign=align||"left",this._ctx.fillText(timeTexts[0],x,y+18*this.options.dpr));}},_proto._drawSections=function(){for(var timeArr=this.timeSections||[],i=0;i<timeArr.length;i++){var position=this._findPosition(timeArr[i]);this._ctx&&TimeLineUtil.isOverlap(0,this.width*this.options.dpr,position.x1,position.x2)&&(this._ctx.fillStyle=this.options.timeSectionColor,this._ctx.fillRect(position.x1,0,position.x2-position.x1,this.height*this.options.dpr));}},_proto._findPosition=function(item){var x1=(parseInt((item.startTime-this.current.getTime())/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing+this.width/2)*this.options.dpr;return {x1:x1,x2:x1+parseInt((item.endTime-item.startTime)/1e3+"",10)/this._timeWidthArray[0]*this._curScaleSpacing*this.options.dpr}},_proto._mergeTimeSections=function(timeSections){if(0===timeSections.length)return timeSections;for(var merged=[(timeSections=timeSections.map(function(item){return 10===(item.startTime+"").length&&(item.startTime=1e3*item.startTime),10===(item.endTime+"").length&&(item.endTime=1e3*item.endTime),_extends({},item,{startTime:item.startTime,endTime:item.endTime})}))[0]],i=1;i<timeSections.length;i++){var prev=merged[merged.length-1],curr=timeSections[i];prev.endTime>=curr.startTime?prev.endTime=Math.max(prev.endTime,curr.endTime):merged.push(curr);}return merged},_proto._addEventListener=function(){this._$canvas&&(this._$canvas.addEventListener("mousemove",this._mousemoveFun),this._$canvas.addEventListener("mouseover",this._mouseoverFun),this._$canvas.addEventListener("mouseleave",this._mouseleaveFun),this._$canvas.addEventListener("mousedown",this._mousedownFun),this._$canvas.addEventListener("mouseup",this._mouseUpFun),this._$canvas.addEventListener("wheel",this._mousewheelFun),this.$container.addEventListener("wheel",function(e){e.preventDefault();},{passive:false}),this._$canvas.addEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.addEventListener("keyup",this._ctrlKeyUpFun),document.addEventListener("keydown",this._ctrlKeyDownFun,false),document.addEventListener("keyup",this._ctrlKeyUpFun,false),this._$canvas.addEventListener("touchstart",this._touchstartFun,{passive:false}),this._$canvas.addEventListener("touchmove",this._touchmoveFun,{passive:false}),this._$canvas.addEventListener("touchend",this._touchendFun,{passive:false}));},_proto._removeEventListener=function(){this._$canvas&&(this._$canvas.removeEventListener("mousemove",this._mousemoveFun),this._$canvas.removeEventListener("mouseover",this._mouseoverFun),this._$canvas.removeEventListener("mouseleave",this._mouseleaveFun),this._$canvas.removeEventListener("mousedown",this._mousedownFun),this._$canvas.removeEventListener("mouseup",this._mouseUpFun),this._$canvas.removeEventListener("wheel",this._mousewheelFun),this._$canvas.removeEventListener("keydown",this._ctrlKeyDownFun),this._$canvas.removeEventListener("keyup",this._ctrlKeyUpFun),document.removeEventListener("keydown",this._ctrlKeyDownFun),document.removeEventListener("keyup",this._ctrlKeyUpFun),this._$canvas.removeEventListener("touchstart",this._touchstartFun),this._$canvas.removeEventListener("touchmove",this._touchmoveFun),this._$canvas.removeEventListener("touchend",this._touchendFun));},_proto._mousedownFun=function(e){this.readOnly||(this._isMouseDown=true,this._mousePosition=e.pageX,this._oldTime=this.current,null==this.options.onDragStart||this.options.onDragStart.call(this.options,this.current));},_proto._mouseoverFun=function(){this.readOnly||(this._isOver=true);},_proto._mouseleaveFun=function(e){this.readOnly||(this._isOver=false,this._moveEndOrTouchEndFun(e));},_proto._mouseUpFun=function(e){this._moveEndOrTouchEndFun(e);},_proto._mousemoveFun=function(e){if(!this.readOnly)if(this._isMouseDown&&this._isOver)this._moveUpdateFun(e.pageX);else {var left=parseInt(this.$container.offsetLeft+"",10);this._mousePosition=e.pageX-left,this._update();}},_proto._mousewheelFun=function(e){e.preventDefault(),this.readOnly;},_proto._ctrlKeyDownFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=true);},_proto._ctrlKeyUpFun=function(e){(e.ctrlKey||"Control"===e.key)&&(this._isCtrlKeyDown=false);},_proto._getTouchDistance=function(touches){var touch1=touches[0],touch2=touches[1],dx=touch2.clientX-touch1.clientX,dy=touch2.clientY-touch1.clientY;return Math.sqrt(dx*dx+dy*dy)},_proto._touchstartFun=function(e){if(!this.readOnly)if(this._oldTime=this.current,this._isOver=true,1===e.touches.length){var touch=e.touches[0];this._isMouseDown=true,this._mousePosition=touch.clientX;}else 2===e.touches.length&&(this._lastTouchDist=this._getTouchDistance(e.touches));},_proto._touchmoveFun=function(e){if(e.preventDefault(),e.stopPropagation(),!this.readOnly)if(1===e.touches.length){var touch=e.touches[0];this._moveUpdateFun(touch.clientX);}else if(2===e.touches.length){this._getTouchDistance(e.touches);this._lastTouchDist;}},_proto._touchendFun=function(e){this.readOnly||this._moveEndOrTouchEndFun(e);},_proto._moveEndOrTouchEndFun=function(e){e.preventDefault(),this.readOnly||this._isMouseDown&&(this._isMouseDown=false,this._moved&&(this._moved=false,this._update({current:this.current}),this._oldTime=this.current,null==this.options.onDragEnd||this.options.onDragEnd.call(this.options,this.current,this._isOver)),this._isOver&&Math.abs(this._mousePosition-(e.pageX||0))>5&&(null==this.options.onChange||this.options.onChange.call(this.options,this.current)),this._mousePosition=0,this._lastTouchDist=0);},_proto._moveUpdateFun=function(x){var mouseOffset=this._mousePosition-x;if(0!==mouseOffset){if(this._oldTime){var currentTime=this._oldTime.getTime()+1e3*parseInt(mouseOffset/this._curScaleSpacing*this._timeWidthArray[0]+"",10);this._update({current:new Date(currentTime)}),null==this.options.onDragging||this.options.onDragging.call(this.options,new Date(currentTime));}this._moved=true;}},_create_class(TimeLine,[{key:"_curScaleSpacing",get:function(){var _this__timeWidthArray,_this__timeWidthArray1;return Math.floor((null==(_this__timeWidthArray=this._timeWidthArray)?void 0:_this__timeWidthArray[1])-(null==(_this__timeWidthArray1=this._timeWidthArray)?void 0:_this__timeWidthArray1[1])*+(this.timeWidth%1/2).toFixed(2))}}]),TimeLine}(BaseTimeLine);TimeLine.TIME_WIDTH=TIME_WIDTH,dist$1.BaseTimeLine=BaseTimeLine,dist$1.MobileTimeLine=MobileTimeLine,dist$1.TimeLine=TimeLine;
|
|
13472
11131
|
return dist$1;
|
|
13473
11132
|
}
|
|
13474
11133
|
|
|
@@ -16062,7 +13721,7 @@
|
|
|
16062
13721
|
zh: zh,
|
|
16063
13722
|
en: en
|
|
16064
13723
|
};
|
|
16065
|
-
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.1-beta.
|
|
13724
|
+
/** 版本号 @since 0.0.1 */ Theme.THEME_VERSION = '2.0.1-beta.2';
|
|
16066
13725
|
|
|
16067
13726
|
// 不要动这里的代码, 这个出口是为了编译成 umd 规范的文件
|
|
16068
13727
|
|