1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287 |
- !(function(e) {
- var t = {};
- function a(n) {
- if (t[n]) return t[n].exports;
- var s = (t[n] = { i: n, l: !1, exports: {} });
- return e[n].call(s.exports, s, s.exports, a), (s.l = !0), s.exports;
- }
- (a.m = e),
- (a.c = t),
- (a.d = function(e, t, n) {
- a.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: n });
- }),
- (a.r = function(e) {
- 'undefined' != typeof Symbol &&
- Symbol.toStringTag &&
- Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
- Object.defineProperty(e, '__esModule', { value: !0 });
- }),
- (a.t = function(e, t) {
- if ((1 & t && (e = a(e)), 8 & t)) return e;
- if (4 & t && 'object' == typeof e && e && e.__esModule) return e;
- var n = Object.create(null);
- if (
- (a.r(n),
- Object.defineProperty(n, 'default', { enumerable: !0, value: e }),
- 2 & t && 'string' != typeof e)
- )
- for (var s in e)
- a.d(
- n,
- s,
- function(t) {
- return e[t];
- }.bind(null, s)
- );
- return n;
- }),
- (a.n = function(e) {
- var t =
- e && e.__esModule
- ? function() {
- return e.default;
- }
- : function() {
- return e;
- };
- return a.d(t, 'a', t), t;
- }),
- (a.o = function(e, t) {
- return Object.prototype.hasOwnProperty.call(e, t);
- }),
- (a.p = ''),
- a((a.s = 7));
- })([
- function(e, t, a) {
- 'use strict';
- let n;
- function s() {
- return n || (n = wx.getSystemInfoSync());
- }
- Object.defineProperty(t, '__esModule', { value: !0 }),
- (t.getSystemInfo = s),
- (t.isComponent = function(e) {
- return (
- e &&
- void 0 !== e.__wxExparserNodeId__ &&
- 'function' == typeof e.setData
- );
- }),
- (t.isIos = c),
- (t.getCurrentPage = l),
- (t.getComponent = function(e) {
- const t = new r();
- let a = l() || {};
- if (a.selectComponent && 'function' == typeof a.selectComponent) {
- if (e) return a.selectComponent(e);
- t.warn('请传入组件ID');
- } else t.warn('该基础库暂不支持多个小程序日历组件');
- }),
- (t.uniqueArrayByDate = function(e = []) {
- let t = {},
- a = [];
- e.forEach(e => {
- t[`${e.year}-${e.month}-${e.day}`] = e;
- });
- for (let e in t) a.push(t[e]);
- return a;
- }),
- (t.delRepeatedEnableDay = function(e = [], t = []) {
- let a, n;
- if (2 === t.length) {
- const { startTimestamp: e, endTimestamp: s } = b(t);
- (a = e), (n = s);
- }
- return d(e).filter(e => e < a || e > n);
- }),
- (t.convertEnableAreaToTimestamp = b),
- (t.converEnableDaysToTimestamp = d),
- (t.initialTasks = t.GetDate = t.Slide = t.Logger = void 0);
- class r {
- info(e) {
- console.log(
- '%cInfo: %c' + e,
- 'color:#FF0080;font-weight:bold',
- 'color: #FF509B'
- );
- }
- warn(e) {
- console.log(
- '%cWarn: %c' + e,
- 'color:#FF6600;font-weight:bold',
- 'color: #FF9933'
- );
- }
- tips(e) {
- console.log(
- '%cTips: %c' + e,
- 'color:#00B200;font-weight:bold',
- 'color: #00CC33'
- );
- }
- }
- t.Logger = r;
- t.Slide = class {
- isUp(e = {}, t = {}) {
- const { startX: a, startY: n } = e,
- s = t.clientX - a;
- return (
- t.clientY - n < -60 &&
- s < 20 &&
- s > -20 &&
- ((this.slideLock = !1), !0)
- );
- }
- isDown(e = {}, t = {}) {
- const { startX: a, startY: n } = e,
- s = t.clientX - a;
- return t.clientY - n > 60 && s < 20 && s > -20;
- }
- isLeft(e = {}, t = {}) {
- const { startX: a, startY: n } = e,
- s = t.clientX - a,
- r = t.clientY - n;
- return s < -60 && r < 20 && r > -20;
- }
- isRight(e = {}, t = {}) {
- const { startX: a, startY: n } = e,
- s = t.clientX - a,
- r = t.clientY - n;
- return s > 60 && r < 20 && r > -20;
- }
- };
- class o {
- newDate(e, t, a) {
- let n = `${+e}-${+t}-${+a}`;
- return c() && (n = `${+e}/${+t}/${+a}`), new Date(n);
- }
- thisMonthDays(e, t) {
- return new Date(Date.UTC(e, t, 0)).getUTCDate();
- }
- firstDayOfWeek(e, t) {
- return new Date(Date.UTC(e, t - 1, 1)).getUTCDay();
- }
- dayOfWeek(e, t, a) {
- return new Date(Date.UTC(e, t - 1, a)).getUTCDay();
- }
- todayDate() {
- const e = new Date();
- return {
- year: e.getFullYear(),
- month: e.getMonth() + 1,
- date: e.getDate()
- };
- }
- todayTimestamp() {
- const { year: e, month: t, date: a } = this.todayDate();
- return this.newDate(e, t, a).getTime();
- }
- }
- function c() {
- const e = s();
- return /iphone|ios/i.test(e.platform);
- }
- function l() {
- const e = getCurrentPages();
- return e[e.length - 1];
- }
- function b(e = []) {
- const t = new o(),
- a = e[0].split('-'),
- n = e[1].split('-'),
- s = new r();
- return 3 !== a.length || 3 !== n.length
- ? (s.warn('enableArea() 参数格式为: ["2018-2-1", "2018-3-1"]'), {})
- : {
- start: a,
- end: n,
- startTimestamp: t.newDate(a[0], a[1], a[2]).getTime(),
- endTimestamp: t.newDate(n[0], n[1], n[2]).getTime()
- };
- }
- function d(e = []) {
- const t = new r(),
- a = new o(),
- n = [];
- return (
- e.forEach(e => {
- if ('string' != typeof e)
- return t.warn('enableDays()入参日期格式错误');
- const s = e.split('-');
- if (3 !== s.length) return t.warn('enableDays()入参日期格式错误');
- const r = a.newDate(s[0], s[1], s[2]).getTime();
- n.push(r);
- }),
- n
- );
- }
- t.GetDate = o;
- t.initialTasks = { flag: 'finished', tasks: [] };
- },
- function(e, t, a) {
- 'use strict';
- Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
- var n = class {
- constructor(e) {
- this.Component = e;
- }
- getData(e) {
- const t = this.Component.data;
- if (!e) return t;
- if (e.includes('.')) {
- return e.split('.').reduce((e, t) => e[t], t);
- }
- return this.Component.data[e];
- }
- setData(e, t = () => {}) {
- e && 'object' == typeof e && this.Component.setData(e, t);
- }
- };
- t.default = n;
- },
- function(e, t, a) {
- 'use strict';
- Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
- const n = {
- lunarInfo: [
- 19416,
- 19168,
- 42352,
- 21717,
- 53856,
- 55632,
- 91476,
- 22176,
- 39632,
- 21970,
- 19168,
- 42422,
- 42192,
- 53840,
- 119381,
- 46400,
- 54944,
- 44450,
- 38320,
- 84343,
- 18800,
- 42160,
- 46261,
- 27216,
- 27968,
- 109396,
- 11104,
- 38256,
- 21234,
- 18800,
- 25958,
- 54432,
- 59984,
- 28309,
- 23248,
- 11104,
- 100067,
- 37600,
- 116951,
- 51536,
- 54432,
- 120998,
- 46416,
- 22176,
- 107956,
- 9680,
- 37584,
- 53938,
- 43344,
- 46423,
- 27808,
- 46416,
- 86869,
- 19872,
- 42416,
- 83315,
- 21168,
- 43432,
- 59728,
- 27296,
- 44710,
- 43856,
- 19296,
- 43748,
- 42352,
- 21088,
- 62051,
- 55632,
- 23383,
- 22176,
- 38608,
- 19925,
- 19152,
- 42192,
- 54484,
- 53840,
- 54616,
- 46400,
- 46752,
- 103846,
- 38320,
- 18864,
- 43380,
- 42160,
- 45690,
- 27216,
- 27968,
- 44870,
- 43872,
- 38256,
- 19189,
- 18800,
- 25776,
- 29859,
- 59984,
- 27480,
- 21952,
- 43872,
- 38613,
- 37600,
- 51552,
- 55636,
- 54432,
- 55888,
- 30034,
- 22176,
- 43959,
- 9680,
- 37584,
- 51893,
- 43344,
- 46240,
- 47780,
- 44368,
- 21977,
- 19360,
- 42416,
- 86390,
- 21168,
- 43312,
- 31060,
- 27296,
- 44368,
- 23378,
- 19296,
- 42726,
- 42208,
- 53856,
- 60005,
- 54576,
- 23200,
- 30371,
- 38608,
- 19195,
- 19152,
- 42192,
- 118966,
- 53840,
- 54560,
- 56645,
- 46496,
- 22224,
- 21938,
- 18864,
- 42359,
- 42160,
- 43600,
- 111189,
- 27936,
- 44448,
- 84835,
- 37744,
- 18936,
- 18800,
- 25776,
- 92326,
- 59984,
- 27424,
- 108228,
- 43744,
- 41696,
- 53987,
- 51552,
- 54615,
- 54432,
- 55888,
- 23893,
- 22176,
- 42704,
- 21972,
- 21200,
- 43448,
- 43344,
- 46240,
- 46758,
- 44368,
- 21920,
- 43940,
- 42416,
- 21168,
- 45683,
- 26928,
- 29495,
- 27296,
- 44368,
- 84821,
- 19296,
- 42352,
- 21732,
- 53600,
- 59752,
- 54560,
- 55968,
- 92838,
- 22224,
- 19168,
- 43476,
- 41680,
- 53584,
- 62034,
- 54560
- ],
- solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
- Gan: ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'],
- Zhi: [
- '子',
- '丑',
- '寅',
- '卯',
- '辰',
- '巳',
- '午',
- '未',
- '申',
- '酉',
- '戌',
- '亥'
- ],
- Animals: [
- '鼠',
- '牛',
- '虎',
- '兔',
- '龙',
- '蛇',
- '马',
- '羊',
- '猴',
- '鸡',
- '狗',
- '猪'
- ],
- solarTerm: [
- '小寒',
- '大寒',
- '立春',
- '雨水',
- '惊蛰',
- '春分',
- '清明',
- '谷雨',
- '立夏',
- '小满',
- '芒种',
- '夏至',
- '小暑',
- '大暑',
- '立秋',
- '处暑',
- '白露',
- '秋分',
- '寒露',
- '霜降',
- '立冬',
- '小雪',
- '大雪',
- '冬至'
- ],
- sTermInfo: [
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf97c3598082c95f8c965cc920f',
- '97bd0b06bdb0722c965ce1cfcc920f',
- 'b027097bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf97c359801ec95f8c965cc920f',
- '97bd0b06bdb0722c965ce1cfcc920f',
- 'b027097bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf97c359801ec95f8c965cc920f',
- '97bd0b06bdb0722c965ce1cfcc920f',
- 'b027097bd097c36b0b6fc9274c91aa',
- '9778397bd19801ec9210c965cc920e',
- '97b6b97bd19801ec95f8c965cc920f',
- '97bd09801d98082c95f8e1cfcc920f',
- '97bd097bd097c36b0b6fc9210c8dc2',
- '9778397bd197c36c9210c9274c91aa',
- '97b6b97bd19801ec95f8c965cc920e',
- '97bd09801d98082c95f8e1cfcc920f',
- '97bd097bd097c36b0b6fc9210c8dc2',
- '9778397bd097c36c9210c9274c91aa',
- '97b6b97bd19801ec95f8c965cc920e',
- '97bcf97c3598082c95f8e1cfcc920f',
- '97bd097bd097c36b0b6fc9210c8dc2',
- '9778397bd097c36c9210c9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf97c3598082c95f8c965cc920f',
- '97bd097bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf97c3598082c95f8c965cc920f',
- '97bd097bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf97c359801ec95f8c965cc920f',
- '97bd097bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf97c359801ec95f8c965cc920f',
- '97bd097bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf97c359801ec95f8c965cc920f',
- '97bd097bd07f595b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9210c8dc2',
- '9778397bd19801ec9210c9274c920e',
- '97b6b97bd19801ec95f8c965cc920f',
- '97bd07f5307f595b0b0bc920fb0722',
- '7f0e397bd097c36b0b6fc9210c8dc2',
- '9778397bd097c36c9210c9274c920e',
- '97b6b97bd19801ec95f8c965cc920f',
- '97bd07f5307f595b0b0bc920fb0722',
- '7f0e397bd097c36b0b6fc9210c8dc2',
- '9778397bd097c36c9210c9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bd07f1487f595b0b0bc920fb0722',
- '7f0e397bd097c36b0b6fc9210c8dc2',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf7f1487f595b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf7f1487f595b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf7f1487f531b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c965cc920e',
- '97bcf7f1487f531b0b0bb0b6fb0722',
- '7f0e397bd07f595b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b97bd19801ec9210c9274c920e',
- '97bcf7f0e47f531b0b0bb0b6fb0722',
- '7f0e397bd07f595b0b0bc920fb0722',
- '9778397bd097c36b0b6fc9210c91aa',
- '97b6b97bd197c36c9210c9274c920e',
- '97bcf7f0e47f531b0b0bb0b6fb0722',
- '7f0e397bd07f595b0b0bc920fb0722',
- '9778397bd097c36b0b6fc9210c8dc2',
- '9778397bd097c36c9210c9274c920e',
- '97b6b7f0e47f531b0723b0b6fb0722',
- '7f0e37f5307f595b0b0bc920fb0722',
- '7f0e397bd097c36b0b6fc9210c8dc2',
- '9778397bd097c36b0b70c9274c91aa',
- '97b6b7f0e47f531b0723b0b6fb0721',
- '7f0e37f1487f595b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc9210c8dc2',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f595b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e397bd07f595b0b0bc920fb0722',
- '9778397bd097c36b0b6fc9274c91aa',
- '97b6b7f0e47f531b0723b0787b0721',
- '7f0e27f0e47f531b0b0bb0b6fb0722',
- '7f0e397bd07f595b0b0bc920fb0722',
- '9778397bd097c36b0b6fc9210c91aa',
- '97b6b7f0e47f149b0723b0787b0721',
- '7f0e27f0e47f531b0723b0b6fb0722',
- '7f0e397bd07f595b0b0bc920fb0722',
- '9778397bd097c36b0b6fc9210c8dc2',
- '977837f0e37f149b0723b0787b0721',
- '7f07e7f0e47f531b0723b0b6fb0722',
- '7f0e37f5307f595b0b0bc920fb0722',
- '7f0e397bd097c35b0b6fc9210c8dc2',
- '977837f0e37f14998082b0787b0721',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e37f1487f595b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc9210c8dc2',
- '977837f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc920fb0722',
- '977837f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e397bd097c35b0b6fc920fb0722',
- '977837f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e397bd07f595b0b0bc920fb0722',
- '977837f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e397bd07f595b0b0bc920fb0722',
- '977837f0e37f14998082b0787b06bd',
- '7f07e7f0e47f149b0723b0787b0721',
- '7f0e27f0e47f531b0b0bb0b6fb0722',
- '7f0e397bd07f595b0b0bc920fb0722',
- '977837f0e37f14998082b0723b06bd',
- '7f07e7f0e37f149b0723b0787b0721',
- '7f0e27f0e47f531b0723b0b6fb0722',
- '7f0e397bd07f595b0b0bc920fb0722',
- '977837f0e37f14898082b0723b02d5',
- '7ec967f0e37f14998082b0787b0721',
- '7f07e7f0e47f531b0723b0b6fb0722',
- '7f0e37f1487f595b0b0bb0b6fb0722',
- '7f0e37f0e37f14898082b0723b02d5',
- '7ec967f0e37f14998082b0787b0721',
- '7f07e7f0e47f531b0723b0b6fb0722',
- '7f0e37f1487f531b0b0bb0b6fb0722',
- '7f0e37f0e37f14898082b0723b02d5',
- '7ec967f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e37f1487f531b0b0bb0b6fb0722',
- '7f0e37f0e37f14898082b072297c35',
- '7ec967f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e37f0e37f14898082b072297c35',
- '7ec967f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e37f0e366aa89801eb072297c35',
- '7ec967f0e37f14998082b0787b06bd',
- '7f07e7f0e47f149b0723b0787b0721',
- '7f0e27f1487f531b0b0bb0b6fb0722',
- '7f0e37f0e366aa89801eb072297c35',
- '7ec967f0e37f14998082b0723b06bd',
- '7f07e7f0e47f149b0723b0787b0721',
- '7f0e27f0e47f531b0723b0b6fb0722',
- '7f0e37f0e366aa89801eb072297c35',
- '7ec967f0e37f14998082b0723b06bd',
- '7f07e7f0e37f14998083b0787b0721',
- '7f0e27f0e47f531b0723b0b6fb0722',
- '7f0e37f0e366aa89801eb072297c35',
- '7ec967f0e37f14898082b0723b02d5',
- '7f07e7f0e37f14998082b0787b0721',
- '7f07e7f0e47f531b0723b0b6fb0722',
- '7f0e36665b66aa89801e9808297c35',
- '665f67f0e37f14898082b0723b02d5',
- '7ec967f0e37f14998082b0787b0721',
- '7f07e7f0e47f531b0723b0b6fb0722',
- '7f0e36665b66a449801e9808297c35',
- '665f67f0e37f14898082b0723b02d5',
- '7ec967f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e36665b66a449801e9808297c35',
- '665f67f0e37f14898082b072297c35',
- '7ec967f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e26665b66a449801e9808297c35',
- '665f67f0e37f1489801eb072297c35',
- '7ec967f0e37f14998082b0787b06bd',
- '7f07e7f0e47f531b0723b0b6fb0721',
- '7f0e27f1487f531b0b0bb0b6fb0722'
- ],
- nStr1: [
- '日',
- '一',
- '二',
- '三',
- '四',
- '五',
- '六',
- '七',
- '八',
- '九',
- '十'
- ],
- nStr2: ['初', '十', '廿', '卅'],
- nStr3: [
- '正',
- '二',
- '三',
- '四',
- '五',
- '六',
- '七',
- '八',
- '九',
- '十',
- '冬',
- '腊'
- ],
- lYearDays: function(e) {
- let t,
- a = 348;
- for (t = 32768; t > 8; t >>= 1)
- a += n.lunarInfo[e - 1900] & t ? 1 : 0;
- return a + n.leapDays(e);
- },
- leapMonth: function(e) {
- return 15 & n.lunarInfo[e - 1900];
- },
- leapDays: function(e) {
- return n.leapMonth(e) ? (65536 & n.lunarInfo[e - 1900] ? 30 : 29) : 0;
- },
- monthDays: function(e, t) {
- return t > 12 || t < 1
- ? -1
- : n.lunarInfo[e - 1900] & (65536 >> t)
- ? 30
- : 29;
- },
- solarDays: function(e, t) {
- if (t > 12 || t < 1) return -1;
- const a = t - 1;
- return 1 == +a
- ? (e % 4 == 0 && e % 100 != 0) || e % 400 == 0
- ? 29
- : 28
- : n.solarMonth[a];
- },
- toGanZhiYear: function(e) {
- let t = (e - 3) % 10,
- a = (e - 3) % 12;
- return (
- 0 == +t && (t = 10),
- 0 == +a && (a = 12),
- n.Gan[t - 1] + n.Zhi[a - 1]
- );
- },
- toAstro: function(e, t) {
- return (
- '魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯'.substr(
- 2 * e -
- (t < [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22][e - 1]
- ? 2
- : 0),
- 2
- ) + '座'
- );
- },
- toGanZhi: function(e) {
- return n.Gan[e % 10] + n.Zhi[e % 12];
- },
- getTerm: function(e, t) {
- if (e < 1900 || e > 2100) return -1;
- if (t < 1 || t > 24) return -1;
- const a = n.sTermInfo[e - 1900],
- s = [
- parseInt('0x' + a.substr(0, 5)).toString(),
- parseInt('0x' + a.substr(5, 5)).toString(),
- parseInt('0x' + a.substr(10, 5)).toString(),
- parseInt('0x' + a.substr(15, 5)).toString(),
- parseInt('0x' + a.substr(20, 5)).toString(),
- parseInt('0x' + a.substr(25, 5)).toString()
- ],
- r = [
- s[0].substr(0, 1),
- s[0].substr(1, 2),
- s[0].substr(3, 1),
- s[0].substr(4, 2),
- s[1].substr(0, 1),
- s[1].substr(1, 2),
- s[1].substr(3, 1),
- s[1].substr(4, 2),
- s[2].substr(0, 1),
- s[2].substr(1, 2),
- s[2].substr(3, 1),
- s[2].substr(4, 2),
- s[3].substr(0, 1),
- s[3].substr(1, 2),
- s[3].substr(3, 1),
- s[3].substr(4, 2),
- s[4].substr(0, 1),
- s[4].substr(1, 2),
- s[4].substr(3, 1),
- s[4].substr(4, 2),
- s[5].substr(0, 1),
- s[5].substr(1, 2),
- s[5].substr(3, 1),
- s[5].substr(4, 2)
- ];
- return parseInt(r[t - 1]);
- },
- toChinaMonth: function(e) {
- if (e > 12 || e < 1) return -1;
- let t = n.nStr3[e - 1];
- return (t += '月');
- },
- toChinaDay: function(e) {
- let t;
- switch (e) {
- case 10:
- t = '初十';
- break;
- case 20:
- t = '二十';
- break;
- case 30:
- t = '三十';
- break;
- default:
- (t = n.nStr2[Math.floor(e / 10)]), (t += n.nStr1[e % 10]);
- }
- return t;
- },
- getAnimal: function(e) {
- return n.Animals[(e - 4) % 12];
- },
- solar2lunar: function(e, t, a) {
- if (e < 1900 || e > 2100) return -1;
- if (1900 == +e && 1 == +t && +a < 31) return -1;
- let s,
- r,
- o = 0,
- c = 0;
- (e = (s = e
- ? new Date(e, parseInt(t) - 1, a)
- : new Date()).getFullYear()),
- (t = s.getMonth() + 1),
- (a = s.getDate());
- let l =
- (Date.UTC(s.getFullYear(), s.getMonth(), s.getDate()) -
- Date.UTC(1900, 0, 31)) /
- 864e5;
- for (r = 1900; r < 2101 && l > 0; r++) l -= c = n.lYearDays(r);
- l < 0 && ((l += c), r--);
- const b = new Date();
- let d = !1;
- b.getFullYear() === +e &&
- b.getMonth() + 1 === +t &&
- b.getDate() === +a &&
- (d = !0);
- let f = s.getDay();
- const i = n.nStr1[f];
- 0 == +f && (f = 7);
- const h = r;
- o = n.leapMonth(r);
- let u = !1;
- for (r = 1; r < 13 && l > 0; r++)
- o > 0 && r === o + 1 && !1 === u
- ? (--r, (u = !0), (c = n.leapDays(h)))
- : (c = n.monthDays(h, r)),
- !0 === u && r === o + 1 && (u = !1),
- (l -= c);
- 0 === l && o > 0 && r === o + 1 && (u ? (u = !1) : ((u = !0), --r)),
- l < 0 && ((l += c), --r);
- const y = r,
- m = l + 1,
- D = t - 1,
- g = n.toGanZhiYear(h),
- p = n.getTerm(e, 2 * t - 1),
- w = n.getTerm(e, 2 * t);
- let C = n.toGanZhi(12 * (e - 1900) + t + 11);
- a >= p && (C = n.toGanZhi(12 * (e - 1900) + t + 12));
- let T = !1,
- M = null;
- +p === a && ((T = !0), (M = n.solarTerm[2 * t - 2])),
- +w === a && ((T = !0), (M = n.solarTerm[2 * t - 1]));
- const k = Date.UTC(e, D, 1, 0, 0, 0, 0) / 864e5 + 25567 + 10,
- _ = n.toGanZhi(k + a - 1),
- L = n.toAstro(t, a);
- return {
- lYear: h,
- lMonth: y,
- lDay: m,
- Animal: n.getAnimal(h),
- IMonthCn: (u ? '闰' : '') + n.toChinaMonth(y),
- IDayCn: n.toChinaDay(m),
- cYear: e,
- cMonth: t,
- cDay: a,
- gzYear: g,
- gzMonth: C,
- gzDay: _,
- isToday: d,
- isLeap: u,
- nWeek: f,
- ncWeek: '星期' + i,
- isTerm: T,
- Term: M,
- astro: L
- };
- },
- lunar2solar: function(e, t, a, s) {
- s = !!s;
- const r = n.leapMonth(e);
- if (s && r !== t) return -1;
- if (
- (2100 == +e && 12 == +t && +a > 1) ||
- (1900 == +e && 1 == +t && +a < 31)
- )
- return -1;
- const o = n.monthDays(e, t);
- let c = o;
- if ((s && (c = n.leapDays(e, t)), e < 1900 || e > 2100 || a > c))
- return -1;
- let l = 0;
- for (let t = 1900; t < e; t++) l += n.lYearDays(t);
- let b = 0,
- d = !1;
- for (let a = 1; a < t; a++)
- (b = n.leapMonth(e)),
- d || (b <= a && b > 0 && ((l += n.leapDays(e)), (d = !0))),
- (l += n.monthDays(e, a));
- s && (l += o);
- const f = Date.UTC(1900, 1, 30, 0, 0, 0),
- i = new Date(864e5 * (l + a - 31) + f),
- h = i.getUTCFullYear(),
- u = i.getUTCMonth() + 1,
- y = i.getUTCDate();
- return n.solar2lunar(h, u, y);
- }
- },
- {
- Gan: s,
- Zhi: r,
- nStr1: o,
- nStr2: c,
- nStr3: l,
- Animals: b,
- solarTerm: d,
- lunarInfo: f,
- sTermInfo: i,
- solarMonth: h,
- ...u
- } = n;
- var y = u;
- t.default = y;
- },
- function(e, t, a) {
- 'use strict';
- Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
- class n {
- constructor(e) {
- this.Component = e;
- }
- getCalendarConfig() {
- return this.Component && this.Component.config
- ? this.Component.config
- : {};
- }
- setCalendarConfig(e, t) {
- this.Component &&
- this.Component.config &&
- (this.Component.config[e] = t);
- }
- }
- t.default = e => new n(e);
- },
- function(e, t, a) {
- 'use strict';
- Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
- var n = l(a(1)),
- s = l(a(5)),
- r = l(a(3)),
- o = l(a(2)),
- c = a(0);
- function l(e) {
- return e && e.__esModule ? e : { default: e };
- }
- const b = new c.GetDate(),
- d = new c.Logger();
- class f extends n.default {
- constructor(e) {
- super(e),
- (this.Component = e),
- (this.getCalendarConfig = (0, r.default)(
- this.Component
- ).getCalendarConfig);
- }
- switchWeek(e, t) {
- return new Promise((a, n) => {
- if ((0, r.default)(this.Component).getCalendarConfig().multi)
- return d.warn('多选模式不能切换周月视图');
- const { selectedDay: o = [], curYear: c, curMonth: l } = this.getData(
- 'calendar'
- );
- if (!o.length) return this.__tipsWhenCanNotSwtich();
- const b = o[0];
- if ('week' === e) {
- if (this.Component.weekMode) return;
- const e = t || b,
- { year: s, month: r } = e;
- if (c !== s || l !== r) return this.__tipsWhenCanNotSwtich();
- (this.Component.weekMode = !0),
- this.setData({ 'calendar.weekMode': !0 }),
- this.jump(e)
- .then(a)
- .catch(n);
- } else
- (this.Component.weekMode = !1),
- this.setData({ 'calendar.weekMode': !1 }),
- (0, s.default)(this.Component)
- .renderCalendar(c, l, t)
- .then(a)
- .catch(n);
- });
- }
- updateCurrYearAndMonth(e) {
- let { days: t, curYear: a, curMonth: n } = this.getData('calendar');
- const { month: s } = t[0],
- { month: r } = t[t.length - 1],
- o = b.thisMonthDays(a, n),
- c = t[t.length - 1],
- l = t[0];
- return (
- (c.day + 7 > o || (n === s && s !== r)) && 'next' === e
- ? (n += 1) > 12 && ((a += 1), (n = 1))
- : (+l.day <= 7 || (n === r && s !== r)) &&
- 'prev' === e &&
- (n -= 1) <= 0 &&
- ((a -= 1), (n = 12)),
- { Uyear: a, Umonth: n }
- );
- }
- calculateLastDay() {
- const { days: e, curYear: t, curMonth: a } = this.getData('calendar');
- return {
- lastDayInThisWeek: e[e.length - 1].day,
- lastDayInThisMonth: b.thisMonthDays(t, a)
- };
- }
- calculateFirstDay() {
- const { days: e } = this.getData('calendar');
- return { firstDayInThisWeek: e[0].day };
- }
- firstWeekInMonth(e, t, a) {
- let n = b.dayOfWeek(e, t, 1);
- const [, r] = [0, 7 - n];
- let o = this.getData('calendar.days') || [];
- return (
- this.Component.weekMode &&
- (o = (0, s.default)(this.Component).buildDate(e, t)),
- o.slice(0, a ? r + 1 : r)
- );
- }
- lastWeekInMonth(e, t, a) {
- const n = b.thisMonthDays(e, t),
- r = b.dayOfWeek(e, t, n),
- [o, c] = [n - r, n];
- let l = this.getData('calendar.days') || [];
- return (
- this.Component.weekMode &&
- (l = (0, s.default)(this.Component).buildDate(e, t)),
- l.slice(a ? o : o - 1, c)
- );
- }
- initSelectedDay(e) {
- const t = [...e],
- {
- selectedDay: a = [],
- todoLabels: n = [],
- showLabelAlways: s
- } = this.getData('calendar'),
- r = a.map(e => `${+e.year}-${+e.month}-${+e.day}`),
- c = n.map(e => `${+e.year}-${+e.month}-${+e.day}`),
- l = this.getCalendarConfig();
- return (
- t.forEach(e => {
- r.includes(`${+e.year}-${+e.month}-${+e.day}`)
- ? (e.choosed = !0)
- : (e.choosed = !1);
- const t = c.indexOf(`${+e.year}-${+e.month}-${+e.day}`);
- if (-1 !== t) {
- e.showTodoLabel = !!s || !e.choosed;
- const a = n[t] || {};
- e.showTodoLabel && a.todoText && (e.todoText = a.todoText);
- }
- if (
- (l.showLunar &&
- (e.lunar = o.default.solar2lunar(+e.year, +e.month, +e.day)),
- l.highlightToday)
- ) {
- const t = b.todayDate(),
- a =
- +t.year == +e.year &&
- +t.month == +e.month &&
- +e.day == +t.date;
- e.isToday = a;
- }
- }),
- t
- );
- }
- setEnableAreaOnWeekMode(e) {
- let {
- todayTimestamp: t,
- enableAreaTimestamp: a = [],
- enableDaysTimestamp: n = []
- } = this.getData('calendar');
- e.forEach(e => {
- const s = b.newDate(e.year, e.month, e.day).getTime();
- let o = !1;
- a.length
- ? (+a[0] > +s || +s > +a[1]) && !n.includes(+s) && (o = !0)
- : n.length && !n.includes(+s) && (o = !0),
- o && ((e.disable = !0), (e.choosed = !1));
- const { disablePastDay: c } =
- (0, r.default)(this.Component).getCalendarConfig() || {};
- c && s - t < 0 && !e.disable && (e.disable = !0);
- });
- }
- calculateNextWeekDays() {
- let {
- lastDayInThisWeek: e,
- lastDayInThisMonth: t
- } = this.calculateLastDay(),
- { curYear: a, curMonth: n } = this.getData('calendar'),
- s = [];
- if (t - e >= 7) {
- const { Uyear: t, Umonth: r } = this.updateCurrYearAndMonth('next');
- (a = t), (n = r);
- for (let t = e + 1; t <= e + 7; t++)
- s.push({ year: a, month: n, day: t, week: b.dayOfWeek(a, n, t) });
- } else {
- for (let r = e + 1; r <= t; r++)
- s.push({ year: a, month: n, day: r, week: b.dayOfWeek(a, n, r) });
- const { Uyear: r, Umonth: o } = this.updateCurrYearAndMonth('next');
- (a = r), (n = o);
- for (let r = 1; r <= 7 - (t - e); r++)
- s.push({ year: a, month: n, day: r, week: b.dayOfWeek(a, n, r) });
- }
- (s = this.initSelectedDay(s)),
- this.setEnableAreaOnWeekMode(s),
- this.setData({
- 'calendar.curYear': a,
- 'calendar.curMonth': n,
- 'calendar.days': s
- });
- }
- calculatePrevWeekDays() {
- let { firstDayInThisWeek: e } = this.calculateFirstDay(),
- { curYear: t, curMonth: a } = this.getData('calendar'),
- n = [];
- if (e - 7 > 0) {
- const { Uyear: s, Umonth: r } = this.updateCurrYearAndMonth('prev');
- (t = s), (a = r);
- for (let s = e - 7; s < e; s++)
- n.push({ year: t, month: a, day: s, week: b.dayOfWeek(t, a, s) });
- } else {
- let s = [];
- for (let n = 1; n < e; n++)
- s.push({ year: t, month: a, day: n, week: b.dayOfWeek(t, a, n) });
- const { Uyear: r, Umonth: o } = this.updateCurrYearAndMonth('prev');
- (t = r), (a = o);
- const c = b.thisMonthDays(t, a);
- for (let s = c - Math.abs(e - 7); s <= c; s++)
- n.push({ year: t, month: a, day: s, week: b.dayOfWeek(t, a, s) });
- n = n.concat(s);
- }
- (n = this.initSelectedDay(n)),
- this.setEnableAreaOnWeekMode(n),
- this.setData({
- 'calendar.curYear': t,
- 'calendar.curMonth': a,
- 'calendar.days': n
- });
- }
- calculateDatesWhenJump(
- { year: e, month: t, day: a },
- { firstWeekDays: n, lastWeekDays: s },
- r
- ) {
- const o = this.__dateIsInWeek({ year: e, month: t, day: a }, n),
- c = this.__dateIsInWeek({ year: e, month: t, day: a }, s);
- let l = [];
- return (l = o
- ? this.__calculateDatesWhenInFirstWeek(n, r)
- : c
- ? this.__calculateDatesWhenInLastWeek(s, r)
- : this.__calculateDates({ year: e, month: t, day: a }));
- }
- jump({ year: e, month: t, day: a }) {
- return new Promise(n => {
- if (!a) return;
- const s = 'Mon' === this.getCalendarConfig().firstDayOfWeek,
- r = this.firstWeekInMonth(e, t, s);
- let o = this.lastWeekInMonth(e, t, s);
- const c = this.calculateDatesWhenJump(
- { year: e, month: t, day: a },
- { firstWeekDays: r, lastWeekDays: o },
- s
- );
- c.map(n => {
- +n.year == +e && +n.month == +t && +n.day == +a && (n.choosed = !0);
- }),
- this.initSelectedDay(c),
- this.setEnableAreaOnWeekMode(c),
- this.setData(
- {
- 'calendar.days': c,
- 'calendar.curYear': e,
- 'calendar.curMonth': t,
- 'calendar.empytGrids': [],
- 'calendar.lastEmptyGrids': []
- },
- n
- );
- });
- }
- __calculateDatesWhenInFirstWeek(e, t) {
- const a = [...e];
- if (a.length < 7) {
- let e,
- { year: t, month: n } = a[0],
- s = 7 - a.length;
- for (
- n > 1
- ? ((n -= 1), (e = b.thisMonthDays(t, n)))
- : ((n = 12), (t -= 1), (e = b.thisMonthDays(t, n)));
- s;
- )
- a.unshift({
- year: t,
- month: n,
- day: e,
- week: b.dayOfWeek(t, n, e)
- }),
- (e -= 1),
- (s -= 1);
- }
- return a;
- }
- __calculateDatesWhenInLastWeek(e, t) {
- const a = [...e];
- if (t && a.length < 7) {
- let { year: e, month: t } = a[0],
- n = 7 - a.length,
- s = 1;
- for (t > 11 ? ((t = 1), (e += 1)) : (t += 1); n; )
- a.push({ year: e, month: t, day: s, week: b.dayOfWeek(e, t, s) }),
- (s += 1),
- (n -= 1);
- }
- return a;
- }
- __calculateDates({ year: e, month: t, day: a }, n) {
- const r = b.dayOfWeek(e, t, a);
- let o = [a - r, a + (6 - r)];
- return (
- n && (o = [a + 1 - r, a + (7 - r)]),
- (0, s.default)(this.Component)
- .buildDate(e, t)
- .slice(o[0] - 1, o[1])
- );
- }
- __dateIsInWeek(e, t) {
- return t.find(
- t => +t.year == +e.year && +t.month == +e.month && +t.day == +e.day
- );
- }
- __tipsWhenCanNotSwtich() {
- d.info(
- '当前月份未选中日期下切换为周视图,不能明确该展示哪一周的日期,故此情况不允许切换'
- );
- }
- }
- t.default = e => new f(e);
- },
- function(e, t, a) {
- 'use strict';
- Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
- var n = c(a(6)),
- s = c(a(1)),
- r = c(a(2)),
- o = a(0);
- function c(e) {
- return e && e.__esModule ? e : { default: e };
- }
- const l = new o.GetDate();
- class b extends s.default {
- constructor(e) {
- super(e), (this.Component = e);
- }
- getCalendarConfig() {
- return this.Component.config;
- }
- renderCalendar(e, t, a) {
- return new Promise(s => {
- this.calculateEmptyGrids(e, t), this.calculateDays(e, t, a);
- const { todoLabels: r } = this.getData('calendar') || {};
- r &&
- r instanceof Array &&
- r.find(e => +e.month == +t) &&
- (0, n.default)(this.Component).setTodoLabels(),
- this.Component.firstRender || s();
- });
- }
- calculateEmptyGrids(e, t) {
- this.calculatePrevMonthGrids(e, t), this.calculateNextMonthGrids(e, t);
- }
- calculatePrevMonthGrids(e, t) {
- let a = [];
- const n = l.thisMonthDays(e, t - 1);
- let s = l.firstDayOfWeek(e, t);
- const o = this.getCalendarConfig() || {};
- if (
- ('Mon' === o.firstDayOfWeek && (0 === s ? (s = 6) : (s -= 1)), s > 0)
- ) {
- const c = n - s,
- { onlyShowCurrentMonth: l } = o,
- { showLunar: b } = this.getCalendarConfig();
- for (let s = n; s > c; s--)
- l
- ? a.push('')
- : a.push({
- day: s,
- lunar: b ? r.default.solar2lunar(e, t - 1, s) : null
- });
- this.setData({ 'calendar.empytGrids': a.reverse() });
- } else this.setData({ 'calendar.empytGrids': null });
- }
- calculateExtraEmptyDate(e, t, a) {
- let n = 0;
- if (2 == +t) {
- n += 7;
- let s = l.dayOfWeek(e, t, 1);
- 'Mon' === a.firstDayOfWeek
- ? 1 == +s && (n += 7)
- : 0 == +s && (n += 7);
- } else {
- let s = l.dayOfWeek(e, t, 1);
- 'Mon' === a.firstDayOfWeek
- ? 0 !== s && s < 6 && (n += 7)
- : s < 6 && (n += 7);
- }
- return n;
- }
- calculateNextMonthGrids(e, t) {
- let a = [];
- const n = l.thisMonthDays(e, t);
- let s = l.dayOfWeek(e, t, n);
- const o = this.getCalendarConfig() || {};
- 'Mon' === o.firstDayOfWeek && (0 === s ? (s = 6) : (s -= 1));
- let c = 7 - (s + 1);
- const { onlyShowCurrentMonth: b, showLunar: d } = o;
- b || (c += this.calculateExtraEmptyDate(e, t, o));
- for (let n = 1; n <= c; n++)
- b
- ? a.push('')
- : a.push({
- day: n,
- lunar: d ? r.default.solar2lunar(e, t + 1, n) : null
- });
- this.setData({ 'calendar.lastEmptyGrids': a });
- }
- setSelectedDay(e, t, a) {
- let n = [];
- const s = this.getCalendarConfig();
- if (s.noDefault) (n = []), (s.noDefault = !1);
- else {
- const s = this.getData('calendar') || {},
- { showLunar: o } = this.getCalendarConfig();
- n = a
- ? [
- {
- year: e,
- month: t,
- day: a,
- choosed: !0,
- week: l.dayOfWeek(e, t, a),
- lunar: o ? r.default.solar2lunar(e, t, a) : null
- }
- ]
- : s.selectedDay;
- }
- return n;
- }
- buildDate(e, t) {
- const a = l.todayDate(),
- n = l.thisMonthDays(e, t),
- s = [];
- for (let r = 1; r <= n; r++) {
- const n = +a.year == +e && +a.month == +t && r === +a.date,
- o = this.getCalendarConfig();
- s.push({
- year: e,
- month: t,
- day: r,
- choosed: !1,
- week: l.dayOfWeek(e, t, r),
- isToday: n && o.highlightToday
- });
- }
- return s;
- }
- calculateDays(e, t, a) {
- let n = [];
- const { todayTimestamp: s, disableDays: o = [] } = this.getData(
- 'calendar'
- );
- n = this.buildDate(e, t);
- const c = this.setSelectedDay(e, t, a),
- b = c.map(e => `${+e.year}-${+e.month}-${+e.day}`),
- d = o.map(e => `${+e.year}-${+e.month}-${+e.day}`);
- n.forEach(e => {
- const t = `${+e.year}-${+e.month}-${+e.day}`;
- b.includes(t) && (e.choosed = !0), d.includes(t) && (e.disable = !0);
- const a = l.newDate(e.year, e.month, e.day).getTime(),
- {
- showLunar: n,
- disablePastDay: o,
- disableLaterDay: c
- } = this.getCalendarConfig();
- n && (e.lunar = r.default.solar2lunar(+e.year, +e.month, +e.day));
- let f = !1;
- o
- ? (f = o && a - s < 0 && !e.disable)
- : c && (f = c && a - s > 0 && !e.disable),
- (f || this.__isDisable(a)) && ((e.disable = !0), (e.choosed = !1));
- }),
- this.setData({ 'calendar.days': n, 'calendar.selectedDay': c || [] });
- }
- __isDisable(e) {
- const {
- enableArea: t = [],
- enableDays: a = [],
- enableAreaTimestamp: n = []
- } = this.getData('calendar');
- let s = !1,
- r = (0, o.converEnableDaysToTimestamp)(a);
- return (
- t.length && (r = (0, o.delRepeatedEnableDay)(a, t)),
- n.length
- ? (+n[0] > +e || +e > +n[1]) && !r.includes(+e) && (s = !0)
- : r.length && !r.includes(+e) && (s = !0),
- s
- );
- }
- }
- t.default = e => new b(e);
- },
- function(e, t, a) {
- 'use strict';
- Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
- var n,
- s = (n = a(1)) && n.__esModule ? n : { default: n },
- r = a(0);
- const o = new r.Logger();
- class c extends s.default {
- constructor(e) {
- super(e), (this.Component = e);
- }
- setTodoLabels(e) {
- e && (this.Component.todoConfig = e);
- const t = this.getData('calendar');
- if (!t || !t.days) return o.warn('请等待日历初始化完成后再调用该方法');
- const a = [...t.days],
- { curYear: n, curMonth: s } = t,
- {
- circle: c,
- dotColor: l = '',
- pos: b = 'bottom',
- showLabelAlways: d,
- days: f = []
- } = e || this.Component.todoConfig || {},
- { todoLabels: i = [], todoLabelPos: h, todoLabelColor: u } = t,
- y = this.getTodoLabels({ year: n, month: s });
- let m = f.filter(e => +e.year == +n && +e.month == +s);
- this.Component.weekMode && (m = f);
- const D = y.concat(m);
- for (let e of D) {
- let t;
- (t = this.Component.weekMode
- ? a.find(
- t =>
- +e.year == +t.year && +e.month == +t.month && +e.day == +t.day
- )
- : a[e.day - 1]) &&
- ((t.showTodoLabel = !!d || !t.choosed),
- t.showTodoLabel && e.todoText && (t.todoText = e.todoText));
- }
- const g = {
- 'calendar.days': a,
- 'calendar.todoLabels': (0, r.uniqueArrayByDate)(f.concat(i))
- };
- c ||
- (b && b !== h && (g['calendar.todoLabelPos'] = b),
- l && l !== u && (g['calendar.todoLabelColor'] = l)),
- (g['calendar.todoLabelCircle'] = c || !1),
- (g['calendar.showLabelAlways'] = d || !1),
- this.setData(g);
- }
- deleteTodoLabels(e) {
- if (!(e instanceof Array && e.length)) return;
- const t = this.filterTodos(e),
- { days: a, curYear: n, curMonth: s } = this.getData('calendar'),
- r = t.filter(e => n === +e.year && s === +e.month);
- a.forEach(e => {
- e.showTodoLabel = !1;
- }),
- r.forEach(e => {
- a[e.day - 1].showTodoLabel = !a[e.day - 1].choosed;
- }),
- this.setData({ 'calendar.days': a, 'calendar.todoLabels': t });
- }
- clearTodoLabels() {
- const { days: e = [] } = this.getData('calendar'),
- t = [].concat(e);
- t.forEach(e => {
- e.showTodoLabel = !1;
- }),
- this.setData({ 'calendar.days': t, 'calendar.todoLabels': [] });
- }
- getTodoLabels(e) {
- const { todoLabels: t = [] } = this.getData('calendar');
- if (e) {
- const { year: a, month: n } = e;
- return t.filter(e => +e.year == +a && +e.month == +n);
- }
- return t;
- }
- filterTodos(e) {
- const t = this.getData('calendar.todoLabels') || [],
- a = e.map(e => `${e.year}-${e.month}-${e.day}`);
- return t.filter(e => !a.includes(`${e.year}-${e.month}-${e.day}`));
- }
- showTodoLabels(e, t, a) {
- e.forEach(e => {
- if (this.Component.weekMode)
- t.forEach((n, s) => {
- if (+n.day == +e.day) {
- const n = t[s];
- (n.hasTodo = !0),
- (n.todoText = e.todoText),
- a &&
- a.length &&
- +a[0].day == +e.day &&
- (n.showTodoLabel = !0);
- }
- });
- else {
- const n = t[e.day - 1];
- if (!n) return;
- (n.hasTodo = !0),
- (n.todoText = e.todoText),
- a &&
- a.length &&
- +a[0].day == +e.day &&
- (t[a[0].day - 1].showTodoLabel = !0);
- }
- });
- }
- }
- t.default = e => new c(e);
- },
- function(e, t, a) {
- 'use strict';
- var n,
- s = (n = a(4)) && n.__esModule ? n : { default: n },
- r = a(0),
- o = (function(e) {
- if (e && e.__esModule) return e;
- var t = {};
- if (null != e)
- for (var a in e)
- if (Object.prototype.hasOwnProperty.call(e, a)) {
- var n =
- Object.defineProperty && Object.getOwnPropertyDescriptor
- ? Object.getOwnPropertyDescriptor(e, a)
- : {};
- n.get || n.set ? Object.defineProperty(t, a, n) : (t[a] = e[a]);
- }
- return (t.default = e), t;
- })(a(8));
- const c = new r.Slide(),
- l = new r.Logger();
- Component({
- options: { multipleSlots: !0 },
- properties: { calendarConfig: { type: Object, value: {} } },
- data: {
- handleMap: {
- prev_year: 'chooseYear',
- prev_month: 'chooseMonth',
- next_month: 'chooseMonth',
- next_year: 'chooseYear'
- }
- },
- lifetimes: {
- attached: function() {
- this.initComp();
- }
- },
- attached: function() {
- this.initComp();
- },
- methods: {
- initComp() {
- const e = this.properties.calendarConfig || {};
- this.setTheme(e.theme), (0, o.default)(this, e);
- },
- setTheme(e) {
- this.setData({ 'calendarConfig.theme': e || 'default' });
- },
- chooseDate(e) {
- const { type: t } = e.currentTarget.dataset;
- t && this[this.data.handleMap[t]](t);
- },
- chooseYear(e) {
- const { curYear: t, curMonth: a } = this.data.calendar;
- if (!t || !a) return l.warn('异常:未获取到当前年月');
- if (this.weekMode) return console.warn('周视图下不支持点击切换年月');
- let n = +t,
- s = +a;
- 'prev_year' === e ? (n -= 1) : 'next_year' === e && (n += 1),
- this.render(t, a, n, s);
- },
- chooseMonth(e) {
- const { curYear: t, curMonth: a } = this.data.calendar;
- if (!t || !a) return l.warn('异常:未获取到当前年月');
- if (this.weekMode) return console.warn('周视图下不支持点击切换年月');
- let n = +t,
- s = +a;
- 'prev_month' === e
- ? (s -= 1) < 1 && ((n -= 1), (s = 12))
- : 'next_month' === e && (s += 1) > 12 && ((n += 1), (s = 1)),
- this.render(t, a, n, s);
- },
- render(e, t, a, n) {
- o.whenChangeDate.call(this, {
- curYear: e,
- curMonth: t,
- newYear: a,
- newMonth: n
- }),
- this.setData({ 'calendar.curYear': a, 'calendar.curMonth': n }),
- o.renderCalendar.call(this, a, n);
- },
- tapDayItem(e) {
- const { idx: t, disable: a } = e.currentTarget.dataset;
- if (a) return;
- const n = this.config || {},
- { multi: s } = n;
- s
- ? o.whenMulitSelect.call(this, t)
- : o.whenSingleSelect.call(this, t);
- },
- doubleClickToToday() {
- if (!this.config.multi && !this.weekMode)
- if (
- (void 0 === this.count ? (this.count = 1) : (this.count += 1),
- this.lastClick)
- ) {
- new Date().getTime() - this.lastClick < 500 &&
- this.count >= 2 &&
- o.jump.call(this),
- (this.count = void 0),
- (this.lastClick = void 0);
- } else this.lastClick = new Date().getTime();
- },
- calendarTouchstart(e) {
- const t = e.touches[0],
- a = t.clientX,
- n = t.clientY;
- (this.slideLock = !0),
- this.setData({ 'gesture.startX': a, 'gesture.startY': n });
- },
- calendarTouchmove(e) {
- const { gesture: t } = this.data;
- if (this.slideLock) {
- if (c.isLeft(t, e.touches[0])) {
- if ((this.setData({ 'calendar.leftSwipe': 1 }), this.weekMode))
- return (
- (this.slideLock = !1),
- (this.currentDates = (0, o.getCalendarDates)()),
- (this.currentYM = (0, o.getCurrentYM)()),
- (0, s.default)(this).calculateNextWeekDays(),
- this.onSwipeCalendar('next_week'),
- void this.onWeekChange('next_week')
- );
- this.chooseMonth('next_month'),
- this.onSwipeCalendar('next_month'),
- (this.slideLock = !1);
- }
- if (c.isRight(t, e.touches[0])) {
- if ((this.setData({ 'calendar.rightSwipe': 1 }), this.weekMode))
- return (
- (this.slideLock = !1),
- (this.currentDates = (0, o.getCalendarDates)()),
- (this.currentYM = (0, o.getCurrentYM)()),
- (0, s.default)(this).calculatePrevWeekDays(),
- this.onSwipeCalendar('prev_week'),
- void this.onWeekChange('prev_week')
- );
- this.chooseMonth('prev_month'),
- this.onSwipeCalendar('prev_month'),
- (this.slideLock = !1);
- }
- }
- },
- calendarTouchend(e) {
- this.setData({ 'calendar.leftSwipe': 0, 'calendar.rightSwipe': 0 });
- },
- onSwipeCalendar(e) {
- this.triggerEvent('onSwipe', { directionType: e });
- },
- onWeekChange(e) {
- this.triggerEvent('whenChangeWeek', {
- current: {
- currentYM: this.currentYM,
- dates: [...this.currentDates]
- },
- next: {
- currentYM: (0, o.getCurrentYM)(),
- dates: (0, o.getCalendarDates)()
- },
- directionType: e
- }),
- (this.currentDates = null),
- (this.currentYM = null);
- }
- }
- });
- },
- function(e, t, a) {
- 'use strict';
- Object.defineProperty(t, '__esModule', { value: !0 }),
- (t.getCurrentYM = L),
- (t.getSelectedDay = v),
- (t.cancelAllSelectedDay = W),
- (t.jump = S),
- (t.setTodoLabels = $),
- (t.deleteTodoLabels = Y),
- (t.clearTodoLabels = O),
- (t.getTodoLabels = x),
- (t.disableDay = A),
- (t.enableArea = E),
- (t.enableDays = I),
- (t.setSelectedDays = P),
- (t.getCalendarConfig = j),
- (t.setCalendarConfig = G),
- (t.getCalendarDates = U),
- (t.switchView = F),
- (t.default = t.calculateNextWeekDays = t.calculatePrevWeekDays = t.whenMulitSelect = t.whenSingleSelect = t.renderCalendar = t.whenChangeDate = void 0);
- var n = f(a(9)),
- s = f(a(4)),
- r = f(a(6)),
- o = f(a(1)),
- c = f(a(5)),
- l = f(a(3)),
- b = f(a(2)),
- d = a(0);
- function f(e) {
- return e && e.__esModule ? e : { default: e };
- }
- let i = {},
- h = new d.Logger(),
- u = new d.GetDate(),
- y = null;
- function m(e) {
- e && (i = (0, d.getComponent)(e));
- }
- function D(e, t) {
- return m(t), (y = new o.default(i)).getData(e);
- }
- function g(e, t = () => {}) {
- return new o.default(i).setData(e, t);
- }
- const p = {
- renderCalendar(e, t, a) {
- return (
- (0, d.isComponent)(this) && (i = this),
- new Promise((n, s) => {
- (0, c.default)(i)
- .renderCalendar(e, t, a)
- .then(() => {
- !(function(e) {
- e.calendar = {
- jump: S,
- switchView: F,
- disableDay: A,
- enableArea: E,
- enableDays: I,
- getCurrentYM: L,
- getSelectedDay: v,
- cancelAllSelectedDay: W,
- setTodoLabels: $,
- getTodoLabels: x,
- deleteTodoLabels: Y,
- clearTodoLabels: O,
- setSelectedDays: P,
- getCalendarConfig: j,
- setCalendarConfig: G,
- getCalendarDates: U
- };
- })((0, d.getCurrentPage)()),
- i.triggerEvent('afterCalendarRender', i),
- (i.firstRender = !0),
- (d.initialTasks.flag = 'finished'),
- d.initialTasks.tasks.length &&
- d.initialTasks.tasks.shift()(),
- n();
- });
- })
- );
- },
- whenChangeDate({ curYear: e, curMonth: t, newYear: a, newMonth: n }) {
- i.triggerEvent('whenChangeMonth', {
- current: { year: e, month: t },
- next: { year: a, month: n }
- });
- },
- whenMulitSelect(e) {
- (0, d.isComponent)(this) && (i = this);
- const { calendar: t = {} } = D(),
- { days: a, todoLabels: n } = t;
- let { selectedDay: s = [] } = t;
- const r = a[e];
- if (r) {
- if (((r.choosed = !r.choosed), r.choosed)) {
- r.cancel = !1;
- const { showLabelAlways: e } = D('calendar');
- e && r.showTodoLabel
- ? (r.showTodoLabel = !0)
- : (r.showTodoLabel = !1),
- s.push(r);
- } else {
- r.cancel = !0;
- const e = `${r.year}-${r.month}-${r.day}`;
- (s = s.filter(t => e !== `${t.year}-${t.month}-${t.day}`)),
- n &&
- n.forEach(t => {
- e === `${t.year}-${t.month}-${t.day}` &&
- (r.showTodoLabel = !0);
- });
- }
- if ((0, l.default)(i).getCalendarConfig().takeoverTap)
- return i.triggerEvent('onTapDay', r);
- g({ 'calendar.days': a, 'calendar.selectedDay': s }),
- p.afterTapDay(r, s);
- }
- },
- whenSingleSelect(e) {
- (0, d.isComponent)(this) && (i = this);
- const { calendar: t = {} } = D(),
- { days: a, selectedDay: n = [], todoLabels: s } = t;
- let o = [];
- const c = a[e];
- if (!c) return;
- const b = (n[0] || {}).day,
- f = (b && a[b - 1]) || {},
- { month: h, year: u } = a[0] || {},
- y = (0, l.default)(i).getCalendarConfig();
- if (y.takeoverTap) return i.triggerEvent('onTapDay', c);
- if ((p.afterTapDay(c), !y.inverse && f.day === c.day)) return;
- i.weekMode &&
- a.forEach((e, t) => {
- e.day === b && (a[t].choosed = !1);
- }),
- s && (o = s.filter(e => +e.year === u && +e.month === h)),
- (0, r.default)(i).showTodoLabels(o, a, n);
- const m = { 'calendar.days': a };
- f.day !== c.day
- ? ((f.choosed = !1),
- (c.choosed = !0),
- (t.showLabelAlways && c.showTodoLabel) || (c.showTodoLabel = !1),
- (m['calendar.selectedDay'] = [c]))
- : y.inverse &&
- ((c.choosed = !c.choosed),
- c.choosed &&
- (c.showTodoLabel && t.showLabelAlways
- ? (c.showTodoLabel = !0)
- : (c.showTodoLabel = !1)),
- (m['calendar.selectedDay'] = [])),
- g(m);
- },
- afterTapDay(e, t) {
- const a = (0, l.default)(i).getCalendarConfig(),
- { multi: n } = a;
- n
- ? i.triggerEvent('afterTapDay', {
- currentSelected: e,
- selectedDays: t
- })
- : i.triggerEvent('afterTapDay', e);
- },
- jumpToToday() {
- const { year: e, month: t, date: a } = u.todayDate(),
- n = u.todayTimestamp();
- g({
- 'calendar.curYear': e,
- 'calendar.curMonth': t,
- 'calendar.selectedDay': [
- {
- year: e,
- day: a,
- month: t,
- choosed: !0,
- lunar: (0, l.default)(i).getCalendarConfig().showLunar
- ? b.default.solar2lunar(e, t, a)
- : null
- }
- ],
- 'calendar.todayTimestamp': n
- }),
- p.renderCalendar(e, t, a);
- }
- },
- w = p.whenChangeDate;
- t.whenChangeDate = w;
- const C = p.renderCalendar;
- t.renderCalendar = C;
- const T = p.whenSingleSelect;
- t.whenSingleSelect = T;
- const M = p.whenMulitSelect;
- t.whenMulitSelect = M;
- const k = p.calculatePrevWeekDays;
- t.calculatePrevWeekDays = k;
- const _ = p.calculateNextWeekDays;
- function L(e) {
- return (
- m(e), { year: D('calendar.curYear'), month: D('calendar.curMonth') }
- );
- }
- function v(e) {
- return m(e), D('calendar.selectedDay');
- }
- function W(e) {
- m(e);
- const t = [...D('calendar.days')];
- t.map(e => {
- e.choosed = !1;
- }),
- g({ 'calendar.days': t, 'calendar.selectedDay': [] });
- }
- function S(e, t, a, n) {
- m(n);
- const { selectedDay: r = [], weekMode: o } = D('calendar') || {},
- { year: c, month: l, day: b } = r[0] || {};
- if (+c != +e || +l != +t || +b != +a) {
- if (o) return (0, s.default)(i).jump({ year: e, month: t, day: a });
- if (e && t) {
- if ('number' != typeof +e || 'number' != typeof +t)
- return h.warn('jump 函数年月日参数必须为数字');
- const n = u.todayTimestamp();
- g(
- {
- 'calendar.curYear': e,
- 'calendar.curMonth': t,
- 'calendar.todayTimestamp': n
- },
- () => {
- if ('number' == typeof +a) return p.renderCalendar(e, t, a);
- p.renderCalendar(e, t);
- }
- );
- } else p.jumpToToday();
- }
- }
- function $(e, t) {
- m(t), (0, r.default)(i).setTodoLabels(e);
- }
- function Y(e, t) {
- m(t), (0, r.default)(i).deleteTodoLabels(e);
- }
- function O(e) {
- m(e), (0, r.default)(i).clearTodoLabels();
- }
- function x(e) {
- return m(e), (0, r.default)(i).getTodoLabels();
- }
- function A(e = [], t) {
- m(t), (0, n.default)(i).disableDays(e);
- }
- function E(e = [], t) {
- m(t), (0, n.default)(i).enableArea(e);
- }
- function I(e = [], t) {
- m(t), (0, n.default)(i).enableDays(e);
- }
- function P(e, t) {
- m(t), (0, n.default)(i).setSelectedDays(e);
- }
- function j(e) {
- m(e), (0, l.default)(i).getCalendarConfig();
- }
- function G(e, t, a) {
- m(a), (0, l.default)(i).setCalendarConfig(e, t);
- }
- function U(e) {
- return m(e), D('calendar.days', e);
- }
- function F(...e) {
- return new Promise((t, a) => {
- const n = e[0];
- if (!e[1])
- return (0, s.default)(i)
- .switchWeek(n)
- .then(t)
- .catch(a);
- 'string' == typeof e[1]
- ? (m(e[1]),
- (0, s.default)(i)
- .switchWeek(n, e[2])
- .then(t)
- .catch(a))
- : 'object' == typeof e[1] &&
- ('string' == typeof e[2] && m(e[1]),
- (0, s.default)(i)
- .switchWeek(n, e[1])
- .then(t)
- .catch(a));
- });
- }
- function N(e, t) {
- (d.initialTasks.flag = 'process'),
- ((i = e).config = t),
- (function(e) {
- let t = ['日', '一', '二', '三', '四', '五', '六'];
- 'Mon' === e && (t = ['一', '二', '三', '四', '五', '六', '日']),
- g({ 'calendar.weeksCh': t });
- })(t.firstDayOfWeek),
- (function(e) {
- if (e && 'string' == typeof e) {
- const t = e.split('-');
- if (t.length < 3)
- return h.warn('配置 jumpTo 格式应为: 2018-4-2 或 2018-04-02');
- S(+t[0], +t[1], +t[2]);
- } else e ? S() : ((i.config.noDefault = !0), S());
- })(t.defaultDay),
- h.tips(
- '使用中若遇问题请反馈至 https://github.com/treadpit/wx_calendar/issues ✍️'
- );
- }
- t.calculateNextWeekDays = _;
- t.default = (e, t = {}) => {
- if ('process' === d.initialTasks.flag)
- return d.initialTasks.tasks.push(function() {
- N(e, t);
- });
- N(e, t);
- };
- },
- function(e, t, a) {
- 'use strict';
- Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
- var n = o(a(1)),
- s = o(a(3)),
- r = a(0);
- function o(e) {
- return e && e.__esModule ? e : { default: e };
- }
- const c = new r.Logger(),
- l = new r.GetDate();
- class b extends n.default {
- constructor(e) {
- super(e), (this.Component = e);
- }
- enableArea(e = []) {
- if (2 === e.length) {
- const { start: t, end: a, startTimestamp: n, endTimestamp: s } = (0,
- r.convertEnableAreaToTimestamp)(e);
- if (!t || !a) return;
- const o = l.thisMonthDays(t[0], t[1]),
- c = l.thisMonthDays(a[0], a[1]);
- if (
- this.__judgeParam({
- start: t,
- end: a,
- startMonthDays: o,
- endMonthDays: c,
- startTimestamp: n,
- endTimestamp: s
- })
- ) {
- let { days: t = [], selectedDay: a = [] } = this.getData(
- 'calendar'
- );
- const r = this.__handleEnableArea(
- { area: e, days: t, startTimestamp: n, endTimestamp: s },
- a
- );
- this.setData({
- 'calendar.enableArea': e,
- 'calendar.days': r.dates,
- 'calendar.selectedDay': r.selectedDay,
- 'calendar.enableAreaTimestamp': [n, s]
- });
- }
- } else
- c.warn(
- 'enableArea()参数需为时间范围数组,形如:["2018-8-4" , "2018-8-24"]'
- );
- }
- enableDays(e = []) {
- const { enableArea: t = [] } = this.getData('calendar');
- let a = [];
- a = t.length
- ? (0, r.delRepeatedEnableDay)(e, t)
- : (0, r.converEnableDaysToTimestamp)(e);
- let { days: n = [], selectedDay: s = [] } = this.getData('calendar');
- const o = this.__handleEnableDays(
- { days: n, expectEnableDaysTimestamp: a },
- s
- );
- this.setData({
- 'calendar.days': o.dates,
- 'calendar.selectedDay': o.selectedDay,
- 'calendar.enableDays': e,
- 'calendar.enableDaysTimestamp': a
- });
- }
- setSelectedDays(e) {
- if (!(0, s.default)(this.Component).getCalendarConfig().multi)
- return c.warn('单选模式下不能设置多日期选中,请配置 multi');
- let { days: t } = this.getData('calendar'),
- a = [];
- if (e) {
- if (e && e.length) {
- const { dates: n, selectedDates: s } = this.__handleSelectedDays(
- t,
- a,
- e
- );
- (t = n), (a = s);
- }
- } else
- t.map(e => {
- (e.choosed = !0), (e.showTodoLabel = !1);
- }),
- (a = t);
- (0, s.default)(this.Component).setCalendarConfig('multi', !0),
- this.setData({ 'calendar.days': t, 'calendar.selectedDay': a });
- }
- disableDays(e) {
- const { disableDays: t = [], days: a } = this.getData('calendar');
- if ('[object Array]' !== Object.prototype.toString.call(e))
- return c.warn('disableDays 参数为数组');
- let n = [];
- if (e.length) {
- const s = (n = (0, r.uniqueArrayByDate)(e.concat(t))).map(
- e => `${e.year}-${e.month}-${e.day}`
- );
- a.forEach(e => {
- const t = `${e.year}-${e.month}-${e.day}`;
- s.includes(t) && (e.disable = !0);
- });
- } else
- a.forEach(e => {
- e.disable = !1;
- });
- this.setData({ 'calendar.days': a, 'calendar.disableDays': n });
- }
- __judgeParam(e) {
- const {
- start: t,
- end: a,
- startMonthDays: n,
- endMonthDays: s,
- startTimestamp: r,
- endTimestamp: o
- } = e;
- return t[2] > n || t[2] < 1
- ? (c.warn(
- 'enableArea() 开始日期错误,指定日期不在当前月份天数范围内'
- ),
- !1)
- : t[1] > 12 || t[1] < 1
- ? (c.warn('enableArea() 开始日期错误,月份超出1-12月份'), !1)
- : a[2] > s || a[2] < 1
- ? (c.warn(
- 'enableArea() 截止日期错误,指定日期不在当前月份天数范围内'
- ),
- !1)
- : a[1] > 12 || a[1] < 1
- ? (c.warn('enableArea() 截止日期错误,月份超出1-12月份'), !1)
- : !(r > o) || (c.warn('enableArea()参数最小日期大于了最大日期'), !1);
- }
- __handleEnableArea(e = {}, t = []) {
- const { area: a, days: n, startTimestamp: s, endTimestamp: o } = e,
- c = this.getData('calendar.enableDays') || [];
- let b = [];
- c.length && (b = (0, r.delRepeatedEnableDay)(c, a));
- const d = [...n];
- return (
- d.forEach(e => {
- const a = l.newDate(e.year, e.month, e.day).getTime();
- (+s > +a || +a > +o) && !b.includes(+a)
- ? ((e.disable = !0),
- e.choosed &&
- ((e.choosed = !1),
- (t = t.filter(
- t =>
- `${e.year}-${e.month}-${e.day}` !==
- `${t.year}-${t.month}-${t.day}`
- ))))
- : e.disable && (e.disable = !1);
- }),
- { dates: d, selectedDay: t }
- );
- }
- __handleEnableDays(e = {}, t = []) {
- const { days: a, expectEnableDaysTimestamp: n } = e,
- { enableAreaTimestamp: s = [] } = this.getData('calendar'),
- r = [...a];
- return (
- r.forEach(e => {
- const a = l.newDate(e.year, e.month, e.day).getTime();
- let r = !1;
- s.length
- ? (+s[0] > +a || +a > +s[1]) && !n.includes(+a) && (r = !0)
- : n.includes(+a) || (r = !0),
- r
- ? ((e.disable = !0),
- e.choosed &&
- ((e.choosed = !1),
- (t = t.filter(
- t =>
- `${e.year}-${e.month}-${e.day}` !==
- `${t.year}-${t.month}-${t.day}`
- ))))
- : (e.disable = !1);
- }),
- { dates: r, selectedDay: t }
- );
- }
- __handleSelectedDays(e = [], t = [], a) {
- const { selectedDay: n, showLabelAlways: s } = this.getData('calendar');
- t = n && n.length ? (0, r.uniqueArrayByDate)(n.concat(a)) : a;
- const { year: o, month: c } = e[0],
- l = [];
- return (
- t.forEach(e => {
- +e.year == +o &&
- +e.month == +c &&
- l.push(`${e.year}-${e.month}-${e.day}`);
- }),
- [...e].map(e => {
- l.includes(`${e.year}-${e.month}-${e.day}`) &&
- ((e.choosed = !0),
- s && e.showTodoLabel
- ? (e.showTodoLabel = !0)
- : (e.showTodoLabel = !1));
- }),
- { dates: e, selectedDates: t }
- );
- }
- }
- t.default = e => new b(e);
- }
- ]);
|