index.js 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287
  1. !(function(e) {
  2. var t = {};
  3. function a(n) {
  4. if (t[n]) return t[n].exports;
  5. var s = (t[n] = { i: n, l: !1, exports: {} });
  6. return e[n].call(s.exports, s, s.exports, a), (s.l = !0), s.exports;
  7. }
  8. (a.m = e),
  9. (a.c = t),
  10. (a.d = function(e, t, n) {
  11. a.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: n });
  12. }),
  13. (a.r = function(e) {
  14. 'undefined' != typeof Symbol &&
  15. Symbol.toStringTag &&
  16. Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
  17. Object.defineProperty(e, '__esModule', { value: !0 });
  18. }),
  19. (a.t = function(e, t) {
  20. if ((1 & t && (e = a(e)), 8 & t)) return e;
  21. if (4 & t && 'object' == typeof e && e && e.__esModule) return e;
  22. var n = Object.create(null);
  23. if (
  24. (a.r(n),
  25. Object.defineProperty(n, 'default', { enumerable: !0, value: e }),
  26. 2 & t && 'string' != typeof e)
  27. )
  28. for (var s in e)
  29. a.d(
  30. n,
  31. s,
  32. function(t) {
  33. return e[t];
  34. }.bind(null, s)
  35. );
  36. return n;
  37. }),
  38. (a.n = function(e) {
  39. var t =
  40. e && e.__esModule
  41. ? function() {
  42. return e.default;
  43. }
  44. : function() {
  45. return e;
  46. };
  47. return a.d(t, 'a', t), t;
  48. }),
  49. (a.o = function(e, t) {
  50. return Object.prototype.hasOwnProperty.call(e, t);
  51. }),
  52. (a.p = ''),
  53. a((a.s = 7));
  54. })([
  55. function(e, t, a) {
  56. 'use strict';
  57. let n;
  58. function s() {
  59. return n || (n = wx.getSystemInfoSync());
  60. }
  61. Object.defineProperty(t, '__esModule', { value: !0 }),
  62. (t.getSystemInfo = s),
  63. (t.isComponent = function(e) {
  64. return (
  65. e &&
  66. void 0 !== e.__wxExparserNodeId__ &&
  67. 'function' == typeof e.setData
  68. );
  69. }),
  70. (t.isIos = c),
  71. (t.getCurrentPage = l),
  72. (t.getComponent = function(e) {
  73. const t = new r();
  74. let a = l() || {};
  75. if (a.selectComponent && 'function' == typeof a.selectComponent) {
  76. if (e) return a.selectComponent(e);
  77. t.warn('请传入组件ID');
  78. } else t.warn('该基础库暂不支持多个小程序日历组件');
  79. }),
  80. (t.uniqueArrayByDate = function(e = []) {
  81. let t = {},
  82. a = [];
  83. e.forEach(e => {
  84. t[`${e.year}-${e.month}-${e.day}`] = e;
  85. });
  86. for (let e in t) a.push(t[e]);
  87. return a;
  88. }),
  89. (t.delRepeatedEnableDay = function(e = [], t = []) {
  90. let a, n;
  91. if (2 === t.length) {
  92. const { startTimestamp: e, endTimestamp: s } = b(t);
  93. (a = e), (n = s);
  94. }
  95. return d(e).filter(e => e < a || e > n);
  96. }),
  97. (t.convertEnableAreaToTimestamp = b),
  98. (t.converEnableDaysToTimestamp = d),
  99. (t.initialTasks = t.GetDate = t.Slide = t.Logger = void 0);
  100. class r {
  101. info(e) {
  102. console.log(
  103. '%cInfo: %c' + e,
  104. 'color:#FF0080;font-weight:bold',
  105. 'color: #FF509B'
  106. );
  107. }
  108. warn(e) {
  109. console.log(
  110. '%cWarn: %c' + e,
  111. 'color:#FF6600;font-weight:bold',
  112. 'color: #FF9933'
  113. );
  114. }
  115. tips(e) {
  116. console.log(
  117. '%cTips: %c' + e,
  118. 'color:#00B200;font-weight:bold',
  119. 'color: #00CC33'
  120. );
  121. }
  122. }
  123. t.Logger = r;
  124. t.Slide = class {
  125. isUp(e = {}, t = {}) {
  126. const { startX: a, startY: n } = e,
  127. s = t.clientX - a;
  128. return (
  129. t.clientY - n < -60 &&
  130. s < 20 &&
  131. s > -20 &&
  132. ((this.slideLock = !1), !0)
  133. );
  134. }
  135. isDown(e = {}, t = {}) {
  136. const { startX: a, startY: n } = e,
  137. s = t.clientX - a;
  138. return t.clientY - n > 60 && s < 20 && s > -20;
  139. }
  140. isLeft(e = {}, t = {}) {
  141. const { startX: a, startY: n } = e,
  142. s = t.clientX - a,
  143. r = t.clientY - n;
  144. return s < -60 && r < 20 && r > -20;
  145. }
  146. isRight(e = {}, t = {}) {
  147. const { startX: a, startY: n } = e,
  148. s = t.clientX - a,
  149. r = t.clientY - n;
  150. return s > 60 && r < 20 && r > -20;
  151. }
  152. };
  153. class o {
  154. newDate(e, t, a) {
  155. let n = `${+e}-${+t}-${+a}`;
  156. return c() && (n = `${+e}/${+t}/${+a}`), new Date(n);
  157. }
  158. thisMonthDays(e, t) {
  159. return new Date(Date.UTC(e, t, 0)).getUTCDate();
  160. }
  161. firstDayOfWeek(e, t) {
  162. return new Date(Date.UTC(e, t - 1, 1)).getUTCDay();
  163. }
  164. dayOfWeek(e, t, a) {
  165. return new Date(Date.UTC(e, t - 1, a)).getUTCDay();
  166. }
  167. todayDate() {
  168. const e = new Date();
  169. return {
  170. year: e.getFullYear(),
  171. month: e.getMonth() + 1,
  172. date: e.getDate()
  173. };
  174. }
  175. todayTimestamp() {
  176. const { year: e, month: t, date: a } = this.todayDate();
  177. return this.newDate(e, t, a).getTime();
  178. }
  179. }
  180. function c() {
  181. const e = s();
  182. return /iphone|ios/i.test(e.platform);
  183. }
  184. function l() {
  185. const e = getCurrentPages();
  186. return e[e.length - 1];
  187. }
  188. function b(e = []) {
  189. const t = new o(),
  190. a = e[0].split('-'),
  191. n = e[1].split('-'),
  192. s = new r();
  193. return 3 !== a.length || 3 !== n.length
  194. ? (s.warn('enableArea() 参数格式为: ["2018-2-1", "2018-3-1"]'), {})
  195. : {
  196. start: a,
  197. end: n,
  198. startTimestamp: t.newDate(a[0], a[1], a[2]).getTime(),
  199. endTimestamp: t.newDate(n[0], n[1], n[2]).getTime()
  200. };
  201. }
  202. function d(e = []) {
  203. const t = new r(),
  204. a = new o(),
  205. n = [];
  206. return (
  207. e.forEach(e => {
  208. if ('string' != typeof e)
  209. return t.warn('enableDays()入参日期格式错误');
  210. const s = e.split('-');
  211. if (3 !== s.length) return t.warn('enableDays()入参日期格式错误');
  212. const r = a.newDate(s[0], s[1], s[2]).getTime();
  213. n.push(r);
  214. }),
  215. n
  216. );
  217. }
  218. t.GetDate = o;
  219. t.initialTasks = { flag: 'finished', tasks: [] };
  220. },
  221. function(e, t, a) {
  222. 'use strict';
  223. Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
  224. var n = class {
  225. constructor(e) {
  226. this.Component = e;
  227. }
  228. getData(e) {
  229. const t = this.Component.data;
  230. if (!e) return t;
  231. if (e.includes('.')) {
  232. return e.split('.').reduce((e, t) => e[t], t);
  233. }
  234. return this.Component.data[e];
  235. }
  236. setData(e, t = () => {}) {
  237. e && 'object' == typeof e && this.Component.setData(e, t);
  238. }
  239. };
  240. t.default = n;
  241. },
  242. function(e, t, a) {
  243. 'use strict';
  244. Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
  245. const n = {
  246. lunarInfo: [
  247. 19416,
  248. 19168,
  249. 42352,
  250. 21717,
  251. 53856,
  252. 55632,
  253. 91476,
  254. 22176,
  255. 39632,
  256. 21970,
  257. 19168,
  258. 42422,
  259. 42192,
  260. 53840,
  261. 119381,
  262. 46400,
  263. 54944,
  264. 44450,
  265. 38320,
  266. 84343,
  267. 18800,
  268. 42160,
  269. 46261,
  270. 27216,
  271. 27968,
  272. 109396,
  273. 11104,
  274. 38256,
  275. 21234,
  276. 18800,
  277. 25958,
  278. 54432,
  279. 59984,
  280. 28309,
  281. 23248,
  282. 11104,
  283. 100067,
  284. 37600,
  285. 116951,
  286. 51536,
  287. 54432,
  288. 120998,
  289. 46416,
  290. 22176,
  291. 107956,
  292. 9680,
  293. 37584,
  294. 53938,
  295. 43344,
  296. 46423,
  297. 27808,
  298. 46416,
  299. 86869,
  300. 19872,
  301. 42416,
  302. 83315,
  303. 21168,
  304. 43432,
  305. 59728,
  306. 27296,
  307. 44710,
  308. 43856,
  309. 19296,
  310. 43748,
  311. 42352,
  312. 21088,
  313. 62051,
  314. 55632,
  315. 23383,
  316. 22176,
  317. 38608,
  318. 19925,
  319. 19152,
  320. 42192,
  321. 54484,
  322. 53840,
  323. 54616,
  324. 46400,
  325. 46752,
  326. 103846,
  327. 38320,
  328. 18864,
  329. 43380,
  330. 42160,
  331. 45690,
  332. 27216,
  333. 27968,
  334. 44870,
  335. 43872,
  336. 38256,
  337. 19189,
  338. 18800,
  339. 25776,
  340. 29859,
  341. 59984,
  342. 27480,
  343. 21952,
  344. 43872,
  345. 38613,
  346. 37600,
  347. 51552,
  348. 55636,
  349. 54432,
  350. 55888,
  351. 30034,
  352. 22176,
  353. 43959,
  354. 9680,
  355. 37584,
  356. 51893,
  357. 43344,
  358. 46240,
  359. 47780,
  360. 44368,
  361. 21977,
  362. 19360,
  363. 42416,
  364. 86390,
  365. 21168,
  366. 43312,
  367. 31060,
  368. 27296,
  369. 44368,
  370. 23378,
  371. 19296,
  372. 42726,
  373. 42208,
  374. 53856,
  375. 60005,
  376. 54576,
  377. 23200,
  378. 30371,
  379. 38608,
  380. 19195,
  381. 19152,
  382. 42192,
  383. 118966,
  384. 53840,
  385. 54560,
  386. 56645,
  387. 46496,
  388. 22224,
  389. 21938,
  390. 18864,
  391. 42359,
  392. 42160,
  393. 43600,
  394. 111189,
  395. 27936,
  396. 44448,
  397. 84835,
  398. 37744,
  399. 18936,
  400. 18800,
  401. 25776,
  402. 92326,
  403. 59984,
  404. 27424,
  405. 108228,
  406. 43744,
  407. 41696,
  408. 53987,
  409. 51552,
  410. 54615,
  411. 54432,
  412. 55888,
  413. 23893,
  414. 22176,
  415. 42704,
  416. 21972,
  417. 21200,
  418. 43448,
  419. 43344,
  420. 46240,
  421. 46758,
  422. 44368,
  423. 21920,
  424. 43940,
  425. 42416,
  426. 21168,
  427. 45683,
  428. 26928,
  429. 29495,
  430. 27296,
  431. 44368,
  432. 84821,
  433. 19296,
  434. 42352,
  435. 21732,
  436. 53600,
  437. 59752,
  438. 54560,
  439. 55968,
  440. 92838,
  441. 22224,
  442. 19168,
  443. 43476,
  444. 41680,
  445. 53584,
  446. 62034,
  447. 54560
  448. ],
  449. solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
  450. Gan: ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'],
  451. Zhi: [
  452. '子',
  453. '丑',
  454. '寅',
  455. '卯',
  456. '辰',
  457. '巳',
  458. '午',
  459. '未',
  460. '申',
  461. '酉',
  462. '戌',
  463. '亥'
  464. ],
  465. Animals: [
  466. '鼠',
  467. '牛',
  468. '虎',
  469. '兔',
  470. '龙',
  471. '蛇',
  472. '马',
  473. '羊',
  474. '猴',
  475. '鸡',
  476. '狗',
  477. '猪'
  478. ],
  479. solarTerm: [
  480. '小寒',
  481. '大寒',
  482. '立春',
  483. '雨水',
  484. '惊蛰',
  485. '春分',
  486. '清明',
  487. '谷雨',
  488. '立夏',
  489. '小满',
  490. '芒种',
  491. '夏至',
  492. '小暑',
  493. '大暑',
  494. '立秋',
  495. '处暑',
  496. '白露',
  497. '秋分',
  498. '寒露',
  499. '霜降',
  500. '立冬',
  501. '小雪',
  502. '大雪',
  503. '冬至'
  504. ],
  505. sTermInfo: [
  506. '9778397bd097c36b0b6fc9274c91aa',
  507. '97b6b97bd19801ec9210c965cc920e',
  508. '97bcf97c3598082c95f8c965cc920f',
  509. '97bd0b06bdb0722c965ce1cfcc920f',
  510. 'b027097bd097c36b0b6fc9274c91aa',
  511. '97b6b97bd19801ec9210c965cc920e',
  512. '97bcf97c359801ec95f8c965cc920f',
  513. '97bd0b06bdb0722c965ce1cfcc920f',
  514. 'b027097bd097c36b0b6fc9274c91aa',
  515. '97b6b97bd19801ec9210c965cc920e',
  516. '97bcf97c359801ec95f8c965cc920f',
  517. '97bd0b06bdb0722c965ce1cfcc920f',
  518. 'b027097bd097c36b0b6fc9274c91aa',
  519. '9778397bd19801ec9210c965cc920e',
  520. '97b6b97bd19801ec95f8c965cc920f',
  521. '97bd09801d98082c95f8e1cfcc920f',
  522. '97bd097bd097c36b0b6fc9210c8dc2',
  523. '9778397bd197c36c9210c9274c91aa',
  524. '97b6b97bd19801ec95f8c965cc920e',
  525. '97bd09801d98082c95f8e1cfcc920f',
  526. '97bd097bd097c36b0b6fc9210c8dc2',
  527. '9778397bd097c36c9210c9274c91aa',
  528. '97b6b97bd19801ec95f8c965cc920e',
  529. '97bcf97c3598082c95f8e1cfcc920f',
  530. '97bd097bd097c36b0b6fc9210c8dc2',
  531. '9778397bd097c36c9210c9274c91aa',
  532. '97b6b97bd19801ec9210c965cc920e',
  533. '97bcf97c3598082c95f8c965cc920f',
  534. '97bd097bd097c35b0b6fc920fb0722',
  535. '9778397bd097c36b0b6fc9274c91aa',
  536. '97b6b97bd19801ec9210c965cc920e',
  537. '97bcf97c3598082c95f8c965cc920f',
  538. '97bd097bd097c35b0b6fc920fb0722',
  539. '9778397bd097c36b0b6fc9274c91aa',
  540. '97b6b97bd19801ec9210c965cc920e',
  541. '97bcf97c359801ec95f8c965cc920f',
  542. '97bd097bd097c35b0b6fc920fb0722',
  543. '9778397bd097c36b0b6fc9274c91aa',
  544. '97b6b97bd19801ec9210c965cc920e',
  545. '97bcf97c359801ec95f8c965cc920f',
  546. '97bd097bd097c35b0b6fc920fb0722',
  547. '9778397bd097c36b0b6fc9274c91aa',
  548. '97b6b97bd19801ec9210c965cc920e',
  549. '97bcf97c359801ec95f8c965cc920f',
  550. '97bd097bd07f595b0b6fc920fb0722',
  551. '9778397bd097c36b0b6fc9210c8dc2',
  552. '9778397bd19801ec9210c9274c920e',
  553. '97b6b97bd19801ec95f8c965cc920f',
  554. '97bd07f5307f595b0b0bc920fb0722',
  555. '7f0e397bd097c36b0b6fc9210c8dc2',
  556. '9778397bd097c36c9210c9274c920e',
  557. '97b6b97bd19801ec95f8c965cc920f',
  558. '97bd07f5307f595b0b0bc920fb0722',
  559. '7f0e397bd097c36b0b6fc9210c8dc2',
  560. '9778397bd097c36c9210c9274c91aa',
  561. '97b6b97bd19801ec9210c965cc920e',
  562. '97bd07f1487f595b0b0bc920fb0722',
  563. '7f0e397bd097c36b0b6fc9210c8dc2',
  564. '9778397bd097c36b0b6fc9274c91aa',
  565. '97b6b97bd19801ec9210c965cc920e',
  566. '97bcf7f1487f595b0b0bb0b6fb0722',
  567. '7f0e397bd097c35b0b6fc920fb0722',
  568. '9778397bd097c36b0b6fc9274c91aa',
  569. '97b6b97bd19801ec9210c965cc920e',
  570. '97bcf7f1487f595b0b0bb0b6fb0722',
  571. '7f0e397bd097c35b0b6fc920fb0722',
  572. '9778397bd097c36b0b6fc9274c91aa',
  573. '97b6b97bd19801ec9210c965cc920e',
  574. '97bcf7f1487f531b0b0bb0b6fb0722',
  575. '7f0e397bd097c35b0b6fc920fb0722',
  576. '9778397bd097c36b0b6fc9274c91aa',
  577. '97b6b97bd19801ec9210c965cc920e',
  578. '97bcf7f1487f531b0b0bb0b6fb0722',
  579. '7f0e397bd07f595b0b6fc920fb0722',
  580. '9778397bd097c36b0b6fc9274c91aa',
  581. '97b6b97bd19801ec9210c9274c920e',
  582. '97bcf7f0e47f531b0b0bb0b6fb0722',
  583. '7f0e397bd07f595b0b0bc920fb0722',
  584. '9778397bd097c36b0b6fc9210c91aa',
  585. '97b6b97bd197c36c9210c9274c920e',
  586. '97bcf7f0e47f531b0b0bb0b6fb0722',
  587. '7f0e397bd07f595b0b0bc920fb0722',
  588. '9778397bd097c36b0b6fc9210c8dc2',
  589. '9778397bd097c36c9210c9274c920e',
  590. '97b6b7f0e47f531b0723b0b6fb0722',
  591. '7f0e37f5307f595b0b0bc920fb0722',
  592. '7f0e397bd097c36b0b6fc9210c8dc2',
  593. '9778397bd097c36b0b70c9274c91aa',
  594. '97b6b7f0e47f531b0723b0b6fb0721',
  595. '7f0e37f1487f595b0b0bb0b6fb0722',
  596. '7f0e397bd097c35b0b6fc9210c8dc2',
  597. '9778397bd097c36b0b6fc9274c91aa',
  598. '97b6b7f0e47f531b0723b0b6fb0721',
  599. '7f0e27f1487f595b0b0bb0b6fb0722',
  600. '7f0e397bd097c35b0b6fc920fb0722',
  601. '9778397bd097c36b0b6fc9274c91aa',
  602. '97b6b7f0e47f531b0723b0b6fb0721',
  603. '7f0e27f1487f531b0b0bb0b6fb0722',
  604. '7f0e397bd097c35b0b6fc920fb0722',
  605. '9778397bd097c36b0b6fc9274c91aa',
  606. '97b6b7f0e47f531b0723b0b6fb0721',
  607. '7f0e27f1487f531b0b0bb0b6fb0722',
  608. '7f0e397bd097c35b0b6fc920fb0722',
  609. '9778397bd097c36b0b6fc9274c91aa',
  610. '97b6b7f0e47f531b0723b0b6fb0721',
  611. '7f0e27f1487f531b0b0bb0b6fb0722',
  612. '7f0e397bd07f595b0b0bc920fb0722',
  613. '9778397bd097c36b0b6fc9274c91aa',
  614. '97b6b7f0e47f531b0723b0787b0721',
  615. '7f0e27f0e47f531b0b0bb0b6fb0722',
  616. '7f0e397bd07f595b0b0bc920fb0722',
  617. '9778397bd097c36b0b6fc9210c91aa',
  618. '97b6b7f0e47f149b0723b0787b0721',
  619. '7f0e27f0e47f531b0723b0b6fb0722',
  620. '7f0e397bd07f595b0b0bc920fb0722',
  621. '9778397bd097c36b0b6fc9210c8dc2',
  622. '977837f0e37f149b0723b0787b0721',
  623. '7f07e7f0e47f531b0723b0b6fb0722',
  624. '7f0e37f5307f595b0b0bc920fb0722',
  625. '7f0e397bd097c35b0b6fc9210c8dc2',
  626. '977837f0e37f14998082b0787b0721',
  627. '7f07e7f0e47f531b0723b0b6fb0721',
  628. '7f0e37f1487f595b0b0bb0b6fb0722',
  629. '7f0e397bd097c35b0b6fc9210c8dc2',
  630. '977837f0e37f14998082b0787b06bd',
  631. '7f07e7f0e47f531b0723b0b6fb0721',
  632. '7f0e27f1487f531b0b0bb0b6fb0722',
  633. '7f0e397bd097c35b0b6fc920fb0722',
  634. '977837f0e37f14998082b0787b06bd',
  635. '7f07e7f0e47f531b0723b0b6fb0721',
  636. '7f0e27f1487f531b0b0bb0b6fb0722',
  637. '7f0e397bd097c35b0b6fc920fb0722',
  638. '977837f0e37f14998082b0787b06bd',
  639. '7f07e7f0e47f531b0723b0b6fb0721',
  640. '7f0e27f1487f531b0b0bb0b6fb0722',
  641. '7f0e397bd07f595b0b0bc920fb0722',
  642. '977837f0e37f14998082b0787b06bd',
  643. '7f07e7f0e47f531b0723b0b6fb0721',
  644. '7f0e27f1487f531b0b0bb0b6fb0722',
  645. '7f0e397bd07f595b0b0bc920fb0722',
  646. '977837f0e37f14998082b0787b06bd',
  647. '7f07e7f0e47f149b0723b0787b0721',
  648. '7f0e27f0e47f531b0b0bb0b6fb0722',
  649. '7f0e397bd07f595b0b0bc920fb0722',
  650. '977837f0e37f14998082b0723b06bd',
  651. '7f07e7f0e37f149b0723b0787b0721',
  652. '7f0e27f0e47f531b0723b0b6fb0722',
  653. '7f0e397bd07f595b0b0bc920fb0722',
  654. '977837f0e37f14898082b0723b02d5',
  655. '7ec967f0e37f14998082b0787b0721',
  656. '7f07e7f0e47f531b0723b0b6fb0722',
  657. '7f0e37f1487f595b0b0bb0b6fb0722',
  658. '7f0e37f0e37f14898082b0723b02d5',
  659. '7ec967f0e37f14998082b0787b0721',
  660. '7f07e7f0e47f531b0723b0b6fb0722',
  661. '7f0e37f1487f531b0b0bb0b6fb0722',
  662. '7f0e37f0e37f14898082b0723b02d5',
  663. '7ec967f0e37f14998082b0787b06bd',
  664. '7f07e7f0e47f531b0723b0b6fb0721',
  665. '7f0e37f1487f531b0b0bb0b6fb0722',
  666. '7f0e37f0e37f14898082b072297c35',
  667. '7ec967f0e37f14998082b0787b06bd',
  668. '7f07e7f0e47f531b0723b0b6fb0721',
  669. '7f0e27f1487f531b0b0bb0b6fb0722',
  670. '7f0e37f0e37f14898082b072297c35',
  671. '7ec967f0e37f14998082b0787b06bd',
  672. '7f07e7f0e47f531b0723b0b6fb0721',
  673. '7f0e27f1487f531b0b0bb0b6fb0722',
  674. '7f0e37f0e366aa89801eb072297c35',
  675. '7ec967f0e37f14998082b0787b06bd',
  676. '7f07e7f0e47f149b0723b0787b0721',
  677. '7f0e27f1487f531b0b0bb0b6fb0722',
  678. '7f0e37f0e366aa89801eb072297c35',
  679. '7ec967f0e37f14998082b0723b06bd',
  680. '7f07e7f0e47f149b0723b0787b0721',
  681. '7f0e27f0e47f531b0723b0b6fb0722',
  682. '7f0e37f0e366aa89801eb072297c35',
  683. '7ec967f0e37f14998082b0723b06bd',
  684. '7f07e7f0e37f14998083b0787b0721',
  685. '7f0e27f0e47f531b0723b0b6fb0722',
  686. '7f0e37f0e366aa89801eb072297c35',
  687. '7ec967f0e37f14898082b0723b02d5',
  688. '7f07e7f0e37f14998082b0787b0721',
  689. '7f07e7f0e47f531b0723b0b6fb0722',
  690. '7f0e36665b66aa89801e9808297c35',
  691. '665f67f0e37f14898082b0723b02d5',
  692. '7ec967f0e37f14998082b0787b0721',
  693. '7f07e7f0e47f531b0723b0b6fb0722',
  694. '7f0e36665b66a449801e9808297c35',
  695. '665f67f0e37f14898082b0723b02d5',
  696. '7ec967f0e37f14998082b0787b06bd',
  697. '7f07e7f0e47f531b0723b0b6fb0721',
  698. '7f0e36665b66a449801e9808297c35',
  699. '665f67f0e37f14898082b072297c35',
  700. '7ec967f0e37f14998082b0787b06bd',
  701. '7f07e7f0e47f531b0723b0b6fb0721',
  702. '7f0e26665b66a449801e9808297c35',
  703. '665f67f0e37f1489801eb072297c35',
  704. '7ec967f0e37f14998082b0787b06bd',
  705. '7f07e7f0e47f531b0723b0b6fb0721',
  706. '7f0e27f1487f531b0b0bb0b6fb0722'
  707. ],
  708. nStr1: [
  709. '日',
  710. '一',
  711. '二',
  712. '三',
  713. '四',
  714. '五',
  715. '六',
  716. '七',
  717. '八',
  718. '九',
  719. '十'
  720. ],
  721. nStr2: ['初', '十', '廿', '卅'],
  722. nStr3: [
  723. '正',
  724. '二',
  725. '三',
  726. '四',
  727. '五',
  728. '六',
  729. '七',
  730. '八',
  731. '九',
  732. '十',
  733. '冬',
  734. '腊'
  735. ],
  736. lYearDays: function(e) {
  737. let t,
  738. a = 348;
  739. for (t = 32768; t > 8; t >>= 1)
  740. a += n.lunarInfo[e - 1900] & t ? 1 : 0;
  741. return a + n.leapDays(e);
  742. },
  743. leapMonth: function(e) {
  744. return 15 & n.lunarInfo[e - 1900];
  745. },
  746. leapDays: function(e) {
  747. return n.leapMonth(e) ? (65536 & n.lunarInfo[e - 1900] ? 30 : 29) : 0;
  748. },
  749. monthDays: function(e, t) {
  750. return t > 12 || t < 1
  751. ? -1
  752. : n.lunarInfo[e - 1900] & (65536 >> t)
  753. ? 30
  754. : 29;
  755. },
  756. solarDays: function(e, t) {
  757. if (t > 12 || t < 1) return -1;
  758. const a = t - 1;
  759. return 1 == +a
  760. ? (e % 4 == 0 && e % 100 != 0) || e % 400 == 0
  761. ? 29
  762. : 28
  763. : n.solarMonth[a];
  764. },
  765. toGanZhiYear: function(e) {
  766. let t = (e - 3) % 10,
  767. a = (e - 3) % 12;
  768. return (
  769. 0 == +t && (t = 10),
  770. 0 == +a && (a = 12),
  771. n.Gan[t - 1] + n.Zhi[a - 1]
  772. );
  773. },
  774. toAstro: function(e, t) {
  775. return (
  776. '魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯'.substr(
  777. 2 * e -
  778. (t < [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22][e - 1]
  779. ? 2
  780. : 0),
  781. 2
  782. ) + '座'
  783. );
  784. },
  785. toGanZhi: function(e) {
  786. return n.Gan[e % 10] + n.Zhi[e % 12];
  787. },
  788. getTerm: function(e, t) {
  789. if (e < 1900 || e > 2100) return -1;
  790. if (t < 1 || t > 24) return -1;
  791. const a = n.sTermInfo[e - 1900],
  792. s = [
  793. parseInt('0x' + a.substr(0, 5)).toString(),
  794. parseInt('0x' + a.substr(5, 5)).toString(),
  795. parseInt('0x' + a.substr(10, 5)).toString(),
  796. parseInt('0x' + a.substr(15, 5)).toString(),
  797. parseInt('0x' + a.substr(20, 5)).toString(),
  798. parseInt('0x' + a.substr(25, 5)).toString()
  799. ],
  800. r = [
  801. s[0].substr(0, 1),
  802. s[0].substr(1, 2),
  803. s[0].substr(3, 1),
  804. s[0].substr(4, 2),
  805. s[1].substr(0, 1),
  806. s[1].substr(1, 2),
  807. s[1].substr(3, 1),
  808. s[1].substr(4, 2),
  809. s[2].substr(0, 1),
  810. s[2].substr(1, 2),
  811. s[2].substr(3, 1),
  812. s[2].substr(4, 2),
  813. s[3].substr(0, 1),
  814. s[3].substr(1, 2),
  815. s[3].substr(3, 1),
  816. s[3].substr(4, 2),
  817. s[4].substr(0, 1),
  818. s[4].substr(1, 2),
  819. s[4].substr(3, 1),
  820. s[4].substr(4, 2),
  821. s[5].substr(0, 1),
  822. s[5].substr(1, 2),
  823. s[5].substr(3, 1),
  824. s[5].substr(4, 2)
  825. ];
  826. return parseInt(r[t - 1]);
  827. },
  828. toChinaMonth: function(e) {
  829. if (e > 12 || e < 1) return -1;
  830. let t = n.nStr3[e - 1];
  831. return (t += '月');
  832. },
  833. toChinaDay: function(e) {
  834. let t;
  835. switch (e) {
  836. case 10:
  837. t = '初十';
  838. break;
  839. case 20:
  840. t = '二十';
  841. break;
  842. case 30:
  843. t = '三十';
  844. break;
  845. default:
  846. (t = n.nStr2[Math.floor(e / 10)]), (t += n.nStr1[e % 10]);
  847. }
  848. return t;
  849. },
  850. getAnimal: function(e) {
  851. return n.Animals[(e - 4) % 12];
  852. },
  853. solar2lunar: function(e, t, a) {
  854. if (e < 1900 || e > 2100) return -1;
  855. if (1900 == +e && 1 == +t && +a < 31) return -1;
  856. let s,
  857. r,
  858. o = 0,
  859. c = 0;
  860. (e = (s = e
  861. ? new Date(e, parseInt(t) - 1, a)
  862. : new Date()).getFullYear()),
  863. (t = s.getMonth() + 1),
  864. (a = s.getDate());
  865. let l =
  866. (Date.UTC(s.getFullYear(), s.getMonth(), s.getDate()) -
  867. Date.UTC(1900, 0, 31)) /
  868. 864e5;
  869. for (r = 1900; r < 2101 && l > 0; r++) l -= c = n.lYearDays(r);
  870. l < 0 && ((l += c), r--);
  871. const b = new Date();
  872. let d = !1;
  873. b.getFullYear() === +e &&
  874. b.getMonth() + 1 === +t &&
  875. b.getDate() === +a &&
  876. (d = !0);
  877. let f = s.getDay();
  878. const i = n.nStr1[f];
  879. 0 == +f && (f = 7);
  880. const h = r;
  881. o = n.leapMonth(r);
  882. let u = !1;
  883. for (r = 1; r < 13 && l > 0; r++)
  884. o > 0 && r === o + 1 && !1 === u
  885. ? (--r, (u = !0), (c = n.leapDays(h)))
  886. : (c = n.monthDays(h, r)),
  887. !0 === u && r === o + 1 && (u = !1),
  888. (l -= c);
  889. 0 === l && o > 0 && r === o + 1 && (u ? (u = !1) : ((u = !0), --r)),
  890. l < 0 && ((l += c), --r);
  891. const y = r,
  892. m = l + 1,
  893. D = t - 1,
  894. g = n.toGanZhiYear(h),
  895. p = n.getTerm(e, 2 * t - 1),
  896. w = n.getTerm(e, 2 * t);
  897. let C = n.toGanZhi(12 * (e - 1900) + t + 11);
  898. a >= p && (C = n.toGanZhi(12 * (e - 1900) + t + 12));
  899. let T = !1,
  900. M = null;
  901. +p === a && ((T = !0), (M = n.solarTerm[2 * t - 2])),
  902. +w === a && ((T = !0), (M = n.solarTerm[2 * t - 1]));
  903. const k = Date.UTC(e, D, 1, 0, 0, 0, 0) / 864e5 + 25567 + 10,
  904. _ = n.toGanZhi(k + a - 1),
  905. L = n.toAstro(t, a);
  906. return {
  907. lYear: h,
  908. lMonth: y,
  909. lDay: m,
  910. Animal: n.getAnimal(h),
  911. IMonthCn: (u ? '闰' : '') + n.toChinaMonth(y),
  912. IDayCn: n.toChinaDay(m),
  913. cYear: e,
  914. cMonth: t,
  915. cDay: a,
  916. gzYear: g,
  917. gzMonth: C,
  918. gzDay: _,
  919. isToday: d,
  920. isLeap: u,
  921. nWeek: f,
  922. ncWeek: '星期' + i,
  923. isTerm: T,
  924. Term: M,
  925. astro: L
  926. };
  927. },
  928. lunar2solar: function(e, t, a, s) {
  929. s = !!s;
  930. const r = n.leapMonth(e);
  931. if (s && r !== t) return -1;
  932. if (
  933. (2100 == +e && 12 == +t && +a > 1) ||
  934. (1900 == +e && 1 == +t && +a < 31)
  935. )
  936. return -1;
  937. const o = n.monthDays(e, t);
  938. let c = o;
  939. if ((s && (c = n.leapDays(e, t)), e < 1900 || e > 2100 || a > c))
  940. return -1;
  941. let l = 0;
  942. for (let t = 1900; t < e; t++) l += n.lYearDays(t);
  943. let b = 0,
  944. d = !1;
  945. for (let a = 1; a < t; a++)
  946. (b = n.leapMonth(e)),
  947. d || (b <= a && b > 0 && ((l += n.leapDays(e)), (d = !0))),
  948. (l += n.monthDays(e, a));
  949. s && (l += o);
  950. const f = Date.UTC(1900, 1, 30, 0, 0, 0),
  951. i = new Date(864e5 * (l + a - 31) + f),
  952. h = i.getUTCFullYear(),
  953. u = i.getUTCMonth() + 1,
  954. y = i.getUTCDate();
  955. return n.solar2lunar(h, u, y);
  956. }
  957. },
  958. {
  959. Gan: s,
  960. Zhi: r,
  961. nStr1: o,
  962. nStr2: c,
  963. nStr3: l,
  964. Animals: b,
  965. solarTerm: d,
  966. lunarInfo: f,
  967. sTermInfo: i,
  968. solarMonth: h,
  969. ...u
  970. } = n;
  971. var y = u;
  972. t.default = y;
  973. },
  974. function(e, t, a) {
  975. 'use strict';
  976. Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
  977. class n {
  978. constructor(e) {
  979. this.Component = e;
  980. }
  981. getCalendarConfig() {
  982. return this.Component && this.Component.config
  983. ? this.Component.config
  984. : {};
  985. }
  986. setCalendarConfig(e, t) {
  987. this.Component &&
  988. this.Component.config &&
  989. (this.Component.config[e] = t);
  990. }
  991. }
  992. t.default = e => new n(e);
  993. },
  994. function(e, t, a) {
  995. 'use strict';
  996. Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
  997. var n = l(a(1)),
  998. s = l(a(5)),
  999. r = l(a(3)),
  1000. o = l(a(2)),
  1001. c = a(0);
  1002. function l(e) {
  1003. return e && e.__esModule ? e : { default: e };
  1004. }
  1005. const b = new c.GetDate(),
  1006. d = new c.Logger();
  1007. class f extends n.default {
  1008. constructor(e) {
  1009. super(e),
  1010. (this.Component = e),
  1011. (this.getCalendarConfig = (0, r.default)(
  1012. this.Component
  1013. ).getCalendarConfig);
  1014. }
  1015. switchWeek(e, t) {
  1016. return new Promise((a, n) => {
  1017. if ((0, r.default)(this.Component).getCalendarConfig().multi)
  1018. return d.warn('多选模式不能切换周月视图');
  1019. const { selectedDay: o = [], curYear: c, curMonth: l } = this.getData(
  1020. 'calendar'
  1021. );
  1022. if (!o.length) return this.__tipsWhenCanNotSwtich();
  1023. const b = o[0];
  1024. if ('week' === e) {
  1025. if (this.Component.weekMode) return;
  1026. const e = t || b,
  1027. { year: s, month: r } = e;
  1028. if (c !== s || l !== r) return this.__tipsWhenCanNotSwtich();
  1029. (this.Component.weekMode = !0),
  1030. this.setData({ 'calendar.weekMode': !0 }),
  1031. this.jump(e)
  1032. .then(a)
  1033. .catch(n);
  1034. } else
  1035. (this.Component.weekMode = !1),
  1036. this.setData({ 'calendar.weekMode': !1 }),
  1037. (0, s.default)(this.Component)
  1038. .renderCalendar(c, l, t)
  1039. .then(a)
  1040. .catch(n);
  1041. });
  1042. }
  1043. updateCurrYearAndMonth(e) {
  1044. let { days: t, curYear: a, curMonth: n } = this.getData('calendar');
  1045. const { month: s } = t[0],
  1046. { month: r } = t[t.length - 1],
  1047. o = b.thisMonthDays(a, n),
  1048. c = t[t.length - 1],
  1049. l = t[0];
  1050. return (
  1051. (c.day + 7 > o || (n === s && s !== r)) && 'next' === e
  1052. ? (n += 1) > 12 && ((a += 1), (n = 1))
  1053. : (+l.day <= 7 || (n === r && s !== r)) &&
  1054. 'prev' === e &&
  1055. (n -= 1) <= 0 &&
  1056. ((a -= 1), (n = 12)),
  1057. { Uyear: a, Umonth: n }
  1058. );
  1059. }
  1060. calculateLastDay() {
  1061. const { days: e, curYear: t, curMonth: a } = this.getData('calendar');
  1062. return {
  1063. lastDayInThisWeek: e[e.length - 1].day,
  1064. lastDayInThisMonth: b.thisMonthDays(t, a)
  1065. };
  1066. }
  1067. calculateFirstDay() {
  1068. const { days: e } = this.getData('calendar');
  1069. return { firstDayInThisWeek: e[0].day };
  1070. }
  1071. firstWeekInMonth(e, t, a) {
  1072. let n = b.dayOfWeek(e, t, 1);
  1073. const [, r] = [0, 7 - n];
  1074. let o = this.getData('calendar.days') || [];
  1075. return (
  1076. this.Component.weekMode &&
  1077. (o = (0, s.default)(this.Component).buildDate(e, t)),
  1078. o.slice(0, a ? r + 1 : r)
  1079. );
  1080. }
  1081. lastWeekInMonth(e, t, a) {
  1082. const n = b.thisMonthDays(e, t),
  1083. r = b.dayOfWeek(e, t, n),
  1084. [o, c] = [n - r, n];
  1085. let l = this.getData('calendar.days') || [];
  1086. return (
  1087. this.Component.weekMode &&
  1088. (l = (0, s.default)(this.Component).buildDate(e, t)),
  1089. l.slice(a ? o : o - 1, c)
  1090. );
  1091. }
  1092. initSelectedDay(e) {
  1093. const t = [...e],
  1094. {
  1095. selectedDay: a = [],
  1096. todoLabels: n = [],
  1097. showLabelAlways: s
  1098. } = this.getData('calendar'),
  1099. r = a.map(e => `${+e.year}-${+e.month}-${+e.day}`),
  1100. c = n.map(e => `${+e.year}-${+e.month}-${+e.day}`),
  1101. l = this.getCalendarConfig();
  1102. return (
  1103. t.forEach(e => {
  1104. r.includes(`${+e.year}-${+e.month}-${+e.day}`)
  1105. ? (e.choosed = !0)
  1106. : (e.choosed = !1);
  1107. const t = c.indexOf(`${+e.year}-${+e.month}-${+e.day}`);
  1108. if (-1 !== t) {
  1109. e.showTodoLabel = !!s || !e.choosed;
  1110. const a = n[t] || {};
  1111. e.showTodoLabel && a.todoText && (e.todoText = a.todoText);
  1112. }
  1113. if (
  1114. (l.showLunar &&
  1115. (e.lunar = o.default.solar2lunar(+e.year, +e.month, +e.day)),
  1116. l.highlightToday)
  1117. ) {
  1118. const t = b.todayDate(),
  1119. a =
  1120. +t.year == +e.year &&
  1121. +t.month == +e.month &&
  1122. +e.day == +t.date;
  1123. e.isToday = a;
  1124. }
  1125. }),
  1126. t
  1127. );
  1128. }
  1129. setEnableAreaOnWeekMode(e) {
  1130. let {
  1131. todayTimestamp: t,
  1132. enableAreaTimestamp: a = [],
  1133. enableDaysTimestamp: n = []
  1134. } = this.getData('calendar');
  1135. e.forEach(e => {
  1136. const s = b.newDate(e.year, e.month, e.day).getTime();
  1137. let o = !1;
  1138. a.length
  1139. ? (+a[0] > +s || +s > +a[1]) && !n.includes(+s) && (o = !0)
  1140. : n.length && !n.includes(+s) && (o = !0),
  1141. o && ((e.disable = !0), (e.choosed = !1));
  1142. const { disablePastDay: c } =
  1143. (0, r.default)(this.Component).getCalendarConfig() || {};
  1144. c && s - t < 0 && !e.disable && (e.disable = !0);
  1145. });
  1146. }
  1147. calculateNextWeekDays() {
  1148. let {
  1149. lastDayInThisWeek: e,
  1150. lastDayInThisMonth: t
  1151. } = this.calculateLastDay(),
  1152. { curYear: a, curMonth: n } = this.getData('calendar'),
  1153. s = [];
  1154. if (t - e >= 7) {
  1155. const { Uyear: t, Umonth: r } = this.updateCurrYearAndMonth('next');
  1156. (a = t), (n = r);
  1157. for (let t = e + 1; t <= e + 7; t++)
  1158. s.push({ year: a, month: n, day: t, week: b.dayOfWeek(a, n, t) });
  1159. } else {
  1160. for (let r = e + 1; r <= t; r++)
  1161. s.push({ year: a, month: n, day: r, week: b.dayOfWeek(a, n, r) });
  1162. const { Uyear: r, Umonth: o } = this.updateCurrYearAndMonth('next');
  1163. (a = r), (n = o);
  1164. for (let r = 1; r <= 7 - (t - e); r++)
  1165. s.push({ year: a, month: n, day: r, week: b.dayOfWeek(a, n, r) });
  1166. }
  1167. (s = this.initSelectedDay(s)),
  1168. this.setEnableAreaOnWeekMode(s),
  1169. this.setData({
  1170. 'calendar.curYear': a,
  1171. 'calendar.curMonth': n,
  1172. 'calendar.days': s
  1173. });
  1174. }
  1175. calculatePrevWeekDays() {
  1176. let { firstDayInThisWeek: e } = this.calculateFirstDay(),
  1177. { curYear: t, curMonth: a } = this.getData('calendar'),
  1178. n = [];
  1179. if (e - 7 > 0) {
  1180. const { Uyear: s, Umonth: r } = this.updateCurrYearAndMonth('prev');
  1181. (t = s), (a = r);
  1182. for (let s = e - 7; s < e; s++)
  1183. n.push({ year: t, month: a, day: s, week: b.dayOfWeek(t, a, s) });
  1184. } else {
  1185. let s = [];
  1186. for (let n = 1; n < e; n++)
  1187. s.push({ year: t, month: a, day: n, week: b.dayOfWeek(t, a, n) });
  1188. const { Uyear: r, Umonth: o } = this.updateCurrYearAndMonth('prev');
  1189. (t = r), (a = o);
  1190. const c = b.thisMonthDays(t, a);
  1191. for (let s = c - Math.abs(e - 7); s <= c; s++)
  1192. n.push({ year: t, month: a, day: s, week: b.dayOfWeek(t, a, s) });
  1193. n = n.concat(s);
  1194. }
  1195. (n = this.initSelectedDay(n)),
  1196. this.setEnableAreaOnWeekMode(n),
  1197. this.setData({
  1198. 'calendar.curYear': t,
  1199. 'calendar.curMonth': a,
  1200. 'calendar.days': n
  1201. });
  1202. }
  1203. calculateDatesWhenJump(
  1204. { year: e, month: t, day: a },
  1205. { firstWeekDays: n, lastWeekDays: s },
  1206. r
  1207. ) {
  1208. const o = this.__dateIsInWeek({ year: e, month: t, day: a }, n),
  1209. c = this.__dateIsInWeek({ year: e, month: t, day: a }, s);
  1210. let l = [];
  1211. return (l = o
  1212. ? this.__calculateDatesWhenInFirstWeek(n, r)
  1213. : c
  1214. ? this.__calculateDatesWhenInLastWeek(s, r)
  1215. : this.__calculateDates({ year: e, month: t, day: a }));
  1216. }
  1217. jump({ year: e, month: t, day: a }) {
  1218. return new Promise(n => {
  1219. if (!a) return;
  1220. const s = 'Mon' === this.getCalendarConfig().firstDayOfWeek,
  1221. r = this.firstWeekInMonth(e, t, s);
  1222. let o = this.lastWeekInMonth(e, t, s);
  1223. const c = this.calculateDatesWhenJump(
  1224. { year: e, month: t, day: a },
  1225. { firstWeekDays: r, lastWeekDays: o },
  1226. s
  1227. );
  1228. c.map(n => {
  1229. +n.year == +e && +n.month == +t && +n.day == +a && (n.choosed = !0);
  1230. }),
  1231. this.initSelectedDay(c),
  1232. this.setEnableAreaOnWeekMode(c),
  1233. this.setData(
  1234. {
  1235. 'calendar.days': c,
  1236. 'calendar.curYear': e,
  1237. 'calendar.curMonth': t,
  1238. 'calendar.empytGrids': [],
  1239. 'calendar.lastEmptyGrids': []
  1240. },
  1241. n
  1242. );
  1243. });
  1244. }
  1245. __calculateDatesWhenInFirstWeek(e, t) {
  1246. const a = [...e];
  1247. if (a.length < 7) {
  1248. let e,
  1249. { year: t, month: n } = a[0],
  1250. s = 7 - a.length;
  1251. for (
  1252. n > 1
  1253. ? ((n -= 1), (e = b.thisMonthDays(t, n)))
  1254. : ((n = 12), (t -= 1), (e = b.thisMonthDays(t, n)));
  1255. s;
  1256. )
  1257. a.unshift({
  1258. year: t,
  1259. month: n,
  1260. day: e,
  1261. week: b.dayOfWeek(t, n, e)
  1262. }),
  1263. (e -= 1),
  1264. (s -= 1);
  1265. }
  1266. return a;
  1267. }
  1268. __calculateDatesWhenInLastWeek(e, t) {
  1269. const a = [...e];
  1270. if (t && a.length < 7) {
  1271. let { year: e, month: t } = a[0],
  1272. n = 7 - a.length,
  1273. s = 1;
  1274. for (t > 11 ? ((t = 1), (e += 1)) : (t += 1); n; )
  1275. a.push({ year: e, month: t, day: s, week: b.dayOfWeek(e, t, s) }),
  1276. (s += 1),
  1277. (n -= 1);
  1278. }
  1279. return a;
  1280. }
  1281. __calculateDates({ year: e, month: t, day: a }, n) {
  1282. const r = b.dayOfWeek(e, t, a);
  1283. let o = [a - r, a + (6 - r)];
  1284. return (
  1285. n && (o = [a + 1 - r, a + (7 - r)]),
  1286. (0, s.default)(this.Component)
  1287. .buildDate(e, t)
  1288. .slice(o[0] - 1, o[1])
  1289. );
  1290. }
  1291. __dateIsInWeek(e, t) {
  1292. return t.find(
  1293. t => +t.year == +e.year && +t.month == +e.month && +t.day == +e.day
  1294. );
  1295. }
  1296. __tipsWhenCanNotSwtich() {
  1297. d.info(
  1298. '当前月份未选中日期下切换为周视图,不能明确该展示哪一周的日期,故此情况不允许切换'
  1299. );
  1300. }
  1301. }
  1302. t.default = e => new f(e);
  1303. },
  1304. function(e, t, a) {
  1305. 'use strict';
  1306. Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
  1307. var n = c(a(6)),
  1308. s = c(a(1)),
  1309. r = c(a(2)),
  1310. o = a(0);
  1311. function c(e) {
  1312. return e && e.__esModule ? e : { default: e };
  1313. }
  1314. const l = new o.GetDate();
  1315. class b extends s.default {
  1316. constructor(e) {
  1317. super(e), (this.Component = e);
  1318. }
  1319. getCalendarConfig() {
  1320. return this.Component.config;
  1321. }
  1322. renderCalendar(e, t, a) {
  1323. return new Promise(s => {
  1324. this.calculateEmptyGrids(e, t), this.calculateDays(e, t, a);
  1325. const { todoLabels: r } = this.getData('calendar') || {};
  1326. r &&
  1327. r instanceof Array &&
  1328. r.find(e => +e.month == +t) &&
  1329. (0, n.default)(this.Component).setTodoLabels(),
  1330. this.Component.firstRender || s();
  1331. });
  1332. }
  1333. calculateEmptyGrids(e, t) {
  1334. this.calculatePrevMonthGrids(e, t), this.calculateNextMonthGrids(e, t);
  1335. }
  1336. calculatePrevMonthGrids(e, t) {
  1337. let a = [];
  1338. const n = l.thisMonthDays(e, t - 1);
  1339. let s = l.firstDayOfWeek(e, t);
  1340. const o = this.getCalendarConfig() || {};
  1341. if (
  1342. ('Mon' === o.firstDayOfWeek && (0 === s ? (s = 6) : (s -= 1)), s > 0)
  1343. ) {
  1344. const c = n - s,
  1345. { onlyShowCurrentMonth: l } = o,
  1346. { showLunar: b } = this.getCalendarConfig();
  1347. for (let s = n; s > c; s--)
  1348. l
  1349. ? a.push('')
  1350. : a.push({
  1351. day: s,
  1352. lunar: b ? r.default.solar2lunar(e, t - 1, s) : null
  1353. });
  1354. this.setData({ 'calendar.empytGrids': a.reverse() });
  1355. } else this.setData({ 'calendar.empytGrids': null });
  1356. }
  1357. calculateExtraEmptyDate(e, t, a) {
  1358. let n = 0;
  1359. if (2 == +t) {
  1360. n += 7;
  1361. let s = l.dayOfWeek(e, t, 1);
  1362. 'Mon' === a.firstDayOfWeek
  1363. ? 1 == +s && (n += 7)
  1364. : 0 == +s && (n += 7);
  1365. } else {
  1366. let s = l.dayOfWeek(e, t, 1);
  1367. 'Mon' === a.firstDayOfWeek
  1368. ? 0 !== s && s < 6 && (n += 7)
  1369. : s < 6 && (n += 7);
  1370. }
  1371. return n;
  1372. }
  1373. calculateNextMonthGrids(e, t) {
  1374. let a = [];
  1375. const n = l.thisMonthDays(e, t);
  1376. let s = l.dayOfWeek(e, t, n);
  1377. const o = this.getCalendarConfig() || {};
  1378. 'Mon' === o.firstDayOfWeek && (0 === s ? (s = 6) : (s -= 1));
  1379. let c = 7 - (s + 1);
  1380. const { onlyShowCurrentMonth: b, showLunar: d } = o;
  1381. b || (c += this.calculateExtraEmptyDate(e, t, o));
  1382. for (let n = 1; n <= c; n++)
  1383. b
  1384. ? a.push('')
  1385. : a.push({
  1386. day: n,
  1387. lunar: d ? r.default.solar2lunar(e, t + 1, n) : null
  1388. });
  1389. this.setData({ 'calendar.lastEmptyGrids': a });
  1390. }
  1391. setSelectedDay(e, t, a) {
  1392. let n = [];
  1393. const s = this.getCalendarConfig();
  1394. if (s.noDefault) (n = []), (s.noDefault = !1);
  1395. else {
  1396. const s = this.getData('calendar') || {},
  1397. { showLunar: o } = this.getCalendarConfig();
  1398. n = a
  1399. ? [
  1400. {
  1401. year: e,
  1402. month: t,
  1403. day: a,
  1404. choosed: !0,
  1405. week: l.dayOfWeek(e, t, a),
  1406. lunar: o ? r.default.solar2lunar(e, t, a) : null
  1407. }
  1408. ]
  1409. : s.selectedDay;
  1410. }
  1411. return n;
  1412. }
  1413. buildDate(e, t) {
  1414. const a = l.todayDate(),
  1415. n = l.thisMonthDays(e, t),
  1416. s = [];
  1417. for (let r = 1; r <= n; r++) {
  1418. const n = +a.year == +e && +a.month == +t && r === +a.date,
  1419. o = this.getCalendarConfig();
  1420. s.push({
  1421. year: e,
  1422. month: t,
  1423. day: r,
  1424. choosed: !1,
  1425. week: l.dayOfWeek(e, t, r),
  1426. isToday: n && o.highlightToday
  1427. });
  1428. }
  1429. return s;
  1430. }
  1431. calculateDays(e, t, a) {
  1432. let n = [];
  1433. const { todayTimestamp: s, disableDays: o = [] } = this.getData(
  1434. 'calendar'
  1435. );
  1436. n = this.buildDate(e, t);
  1437. const c = this.setSelectedDay(e, t, a),
  1438. b = c.map(e => `${+e.year}-${+e.month}-${+e.day}`),
  1439. d = o.map(e => `${+e.year}-${+e.month}-${+e.day}`);
  1440. n.forEach(e => {
  1441. const t = `${+e.year}-${+e.month}-${+e.day}`;
  1442. b.includes(t) && (e.choosed = !0), d.includes(t) && (e.disable = !0);
  1443. const a = l.newDate(e.year, e.month, e.day).getTime(),
  1444. {
  1445. showLunar: n,
  1446. disablePastDay: o,
  1447. disableLaterDay: c
  1448. } = this.getCalendarConfig();
  1449. n && (e.lunar = r.default.solar2lunar(+e.year, +e.month, +e.day));
  1450. let f = !1;
  1451. o
  1452. ? (f = o && a - s < 0 && !e.disable)
  1453. : c && (f = c && a - s > 0 && !e.disable),
  1454. (f || this.__isDisable(a)) && ((e.disable = !0), (e.choosed = !1));
  1455. }),
  1456. this.setData({ 'calendar.days': n, 'calendar.selectedDay': c || [] });
  1457. }
  1458. __isDisable(e) {
  1459. const {
  1460. enableArea: t = [],
  1461. enableDays: a = [],
  1462. enableAreaTimestamp: n = []
  1463. } = this.getData('calendar');
  1464. let s = !1,
  1465. r = (0, o.converEnableDaysToTimestamp)(a);
  1466. return (
  1467. t.length && (r = (0, o.delRepeatedEnableDay)(a, t)),
  1468. n.length
  1469. ? (+n[0] > +e || +e > +n[1]) && !r.includes(+e) && (s = !0)
  1470. : r.length && !r.includes(+e) && (s = !0),
  1471. s
  1472. );
  1473. }
  1474. }
  1475. t.default = e => new b(e);
  1476. },
  1477. function(e, t, a) {
  1478. 'use strict';
  1479. Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
  1480. var n,
  1481. s = (n = a(1)) && n.__esModule ? n : { default: n },
  1482. r = a(0);
  1483. const o = new r.Logger();
  1484. class c extends s.default {
  1485. constructor(e) {
  1486. super(e), (this.Component = e);
  1487. }
  1488. setTodoLabels(e) {
  1489. e && (this.Component.todoConfig = e);
  1490. const t = this.getData('calendar');
  1491. if (!t || !t.days) return o.warn('请等待日历初始化完成后再调用该方法');
  1492. const a = [...t.days],
  1493. { curYear: n, curMonth: s } = t,
  1494. {
  1495. circle: c,
  1496. dotColor: l = '',
  1497. pos: b = 'bottom',
  1498. showLabelAlways: d,
  1499. days: f = []
  1500. } = e || this.Component.todoConfig || {},
  1501. { todoLabels: i = [], todoLabelPos: h, todoLabelColor: u } = t,
  1502. y = this.getTodoLabels({ year: n, month: s });
  1503. let m = f.filter(e => +e.year == +n && +e.month == +s);
  1504. this.Component.weekMode && (m = f);
  1505. const D = y.concat(m);
  1506. for (let e of D) {
  1507. let t;
  1508. (t = this.Component.weekMode
  1509. ? a.find(
  1510. t =>
  1511. +e.year == +t.year && +e.month == +t.month && +e.day == +t.day
  1512. )
  1513. : a[e.day - 1]) &&
  1514. ((t.showTodoLabel = !!d || !t.choosed),
  1515. t.showTodoLabel && e.todoText && (t.todoText = e.todoText));
  1516. }
  1517. const g = {
  1518. 'calendar.days': a,
  1519. 'calendar.todoLabels': (0, r.uniqueArrayByDate)(f.concat(i))
  1520. };
  1521. c ||
  1522. (b && b !== h && (g['calendar.todoLabelPos'] = b),
  1523. l && l !== u && (g['calendar.todoLabelColor'] = l)),
  1524. (g['calendar.todoLabelCircle'] = c || !1),
  1525. (g['calendar.showLabelAlways'] = d || !1),
  1526. this.setData(g);
  1527. }
  1528. deleteTodoLabels(e) {
  1529. if (!(e instanceof Array && e.length)) return;
  1530. const t = this.filterTodos(e),
  1531. { days: a, curYear: n, curMonth: s } = this.getData('calendar'),
  1532. r = t.filter(e => n === +e.year && s === +e.month);
  1533. a.forEach(e => {
  1534. e.showTodoLabel = !1;
  1535. }),
  1536. r.forEach(e => {
  1537. a[e.day - 1].showTodoLabel = !a[e.day - 1].choosed;
  1538. }),
  1539. this.setData({ 'calendar.days': a, 'calendar.todoLabels': t });
  1540. }
  1541. clearTodoLabels() {
  1542. const { days: e = [] } = this.getData('calendar'),
  1543. t = [].concat(e);
  1544. t.forEach(e => {
  1545. e.showTodoLabel = !1;
  1546. }),
  1547. this.setData({ 'calendar.days': t, 'calendar.todoLabels': [] });
  1548. }
  1549. getTodoLabels(e) {
  1550. const { todoLabels: t = [] } = this.getData('calendar');
  1551. if (e) {
  1552. const { year: a, month: n } = e;
  1553. return t.filter(e => +e.year == +a && +e.month == +n);
  1554. }
  1555. return t;
  1556. }
  1557. filterTodos(e) {
  1558. const t = this.getData('calendar.todoLabels') || [],
  1559. a = e.map(e => `${e.year}-${e.month}-${e.day}`);
  1560. return t.filter(e => !a.includes(`${e.year}-${e.month}-${e.day}`));
  1561. }
  1562. showTodoLabels(e, t, a) {
  1563. e.forEach(e => {
  1564. if (this.Component.weekMode)
  1565. t.forEach((n, s) => {
  1566. if (+n.day == +e.day) {
  1567. const n = t[s];
  1568. (n.hasTodo = !0),
  1569. (n.todoText = e.todoText),
  1570. a &&
  1571. a.length &&
  1572. +a[0].day == +e.day &&
  1573. (n.showTodoLabel = !0);
  1574. }
  1575. });
  1576. else {
  1577. const n = t[e.day - 1];
  1578. if (!n) return;
  1579. (n.hasTodo = !0),
  1580. (n.todoText = e.todoText),
  1581. a &&
  1582. a.length &&
  1583. +a[0].day == +e.day &&
  1584. (t[a[0].day - 1].showTodoLabel = !0);
  1585. }
  1586. });
  1587. }
  1588. }
  1589. t.default = e => new c(e);
  1590. },
  1591. function(e, t, a) {
  1592. 'use strict';
  1593. var n,
  1594. s = (n = a(4)) && n.__esModule ? n : { default: n },
  1595. r = a(0),
  1596. o = (function(e) {
  1597. if (e && e.__esModule) return e;
  1598. var t = {};
  1599. if (null != e)
  1600. for (var a in e)
  1601. if (Object.prototype.hasOwnProperty.call(e, a)) {
  1602. var n =
  1603. Object.defineProperty && Object.getOwnPropertyDescriptor
  1604. ? Object.getOwnPropertyDescriptor(e, a)
  1605. : {};
  1606. n.get || n.set ? Object.defineProperty(t, a, n) : (t[a] = e[a]);
  1607. }
  1608. return (t.default = e), t;
  1609. })(a(8));
  1610. const c = new r.Slide(),
  1611. l = new r.Logger();
  1612. Component({
  1613. options: { multipleSlots: !0 },
  1614. properties: { calendarConfig: { type: Object, value: {} } },
  1615. data: {
  1616. handleMap: {
  1617. prev_year: 'chooseYear',
  1618. prev_month: 'chooseMonth',
  1619. next_month: 'chooseMonth',
  1620. next_year: 'chooseYear'
  1621. }
  1622. },
  1623. lifetimes: {
  1624. attached: function() {
  1625. this.initComp();
  1626. }
  1627. },
  1628. attached: function() {
  1629. this.initComp();
  1630. },
  1631. methods: {
  1632. initComp() {
  1633. const e = this.properties.calendarConfig || {};
  1634. this.setTheme(e.theme), (0, o.default)(this, e);
  1635. },
  1636. setTheme(e) {
  1637. this.setData({ 'calendarConfig.theme': e || 'default' });
  1638. },
  1639. chooseDate(e) {
  1640. const { type: t } = e.currentTarget.dataset;
  1641. t && this[this.data.handleMap[t]](t);
  1642. },
  1643. chooseYear(e) {
  1644. const { curYear: t, curMonth: a } = this.data.calendar;
  1645. if (!t || !a) return l.warn('异常:未获取到当前年月');
  1646. if (this.weekMode) return console.warn('周视图下不支持点击切换年月');
  1647. let n = +t,
  1648. s = +a;
  1649. 'prev_year' === e ? (n -= 1) : 'next_year' === e && (n += 1),
  1650. this.render(t, a, n, s);
  1651. },
  1652. chooseMonth(e) {
  1653. const { curYear: t, curMonth: a } = this.data.calendar;
  1654. if (!t || !a) return l.warn('异常:未获取到当前年月');
  1655. if (this.weekMode) return console.warn('周视图下不支持点击切换年月');
  1656. let n = +t,
  1657. s = +a;
  1658. 'prev_month' === e
  1659. ? (s -= 1) < 1 && ((n -= 1), (s = 12))
  1660. : 'next_month' === e && (s += 1) > 12 && ((n += 1), (s = 1)),
  1661. this.render(t, a, n, s);
  1662. },
  1663. render(e, t, a, n) {
  1664. o.whenChangeDate.call(this, {
  1665. curYear: e,
  1666. curMonth: t,
  1667. newYear: a,
  1668. newMonth: n
  1669. }),
  1670. this.setData({ 'calendar.curYear': a, 'calendar.curMonth': n }),
  1671. o.renderCalendar.call(this, a, n);
  1672. },
  1673. tapDayItem(e) {
  1674. const { idx: t, disable: a } = e.currentTarget.dataset;
  1675. if (a) return;
  1676. const n = this.config || {},
  1677. { multi: s } = n;
  1678. s
  1679. ? o.whenMulitSelect.call(this, t)
  1680. : o.whenSingleSelect.call(this, t);
  1681. },
  1682. doubleClickToToday() {
  1683. if (!this.config.multi && !this.weekMode)
  1684. if (
  1685. (void 0 === this.count ? (this.count = 1) : (this.count += 1),
  1686. this.lastClick)
  1687. ) {
  1688. new Date().getTime() - this.lastClick < 500 &&
  1689. this.count >= 2 &&
  1690. o.jump.call(this),
  1691. (this.count = void 0),
  1692. (this.lastClick = void 0);
  1693. } else this.lastClick = new Date().getTime();
  1694. },
  1695. calendarTouchstart(e) {
  1696. const t = e.touches[0],
  1697. a = t.clientX,
  1698. n = t.clientY;
  1699. (this.slideLock = !0),
  1700. this.setData({ 'gesture.startX': a, 'gesture.startY': n });
  1701. },
  1702. calendarTouchmove(e) {
  1703. const { gesture: t } = this.data;
  1704. if (this.slideLock) {
  1705. if (c.isLeft(t, e.touches[0])) {
  1706. if ((this.setData({ 'calendar.leftSwipe': 1 }), this.weekMode))
  1707. return (
  1708. (this.slideLock = !1),
  1709. (this.currentDates = (0, o.getCalendarDates)()),
  1710. (this.currentYM = (0, o.getCurrentYM)()),
  1711. (0, s.default)(this).calculateNextWeekDays(),
  1712. this.onSwipeCalendar('next_week'),
  1713. void this.onWeekChange('next_week')
  1714. );
  1715. this.chooseMonth('next_month'),
  1716. this.onSwipeCalendar('next_month'),
  1717. (this.slideLock = !1);
  1718. }
  1719. if (c.isRight(t, e.touches[0])) {
  1720. if ((this.setData({ 'calendar.rightSwipe': 1 }), this.weekMode))
  1721. return (
  1722. (this.slideLock = !1),
  1723. (this.currentDates = (0, o.getCalendarDates)()),
  1724. (this.currentYM = (0, o.getCurrentYM)()),
  1725. (0, s.default)(this).calculatePrevWeekDays(),
  1726. this.onSwipeCalendar('prev_week'),
  1727. void this.onWeekChange('prev_week')
  1728. );
  1729. this.chooseMonth('prev_month'),
  1730. this.onSwipeCalendar('prev_month'),
  1731. (this.slideLock = !1);
  1732. }
  1733. }
  1734. },
  1735. calendarTouchend(e) {
  1736. this.setData({ 'calendar.leftSwipe': 0, 'calendar.rightSwipe': 0 });
  1737. },
  1738. onSwipeCalendar(e) {
  1739. this.triggerEvent('onSwipe', { directionType: e });
  1740. },
  1741. onWeekChange(e) {
  1742. this.triggerEvent('whenChangeWeek', {
  1743. current: {
  1744. currentYM: this.currentYM,
  1745. dates: [...this.currentDates]
  1746. },
  1747. next: {
  1748. currentYM: (0, o.getCurrentYM)(),
  1749. dates: (0, o.getCalendarDates)()
  1750. },
  1751. directionType: e
  1752. }),
  1753. (this.currentDates = null),
  1754. (this.currentYM = null);
  1755. }
  1756. }
  1757. });
  1758. },
  1759. function(e, t, a) {
  1760. 'use strict';
  1761. Object.defineProperty(t, '__esModule', { value: !0 }),
  1762. (t.getCurrentYM = L),
  1763. (t.getSelectedDay = v),
  1764. (t.cancelAllSelectedDay = W),
  1765. (t.jump = S),
  1766. (t.setTodoLabels = $),
  1767. (t.deleteTodoLabels = Y),
  1768. (t.clearTodoLabels = O),
  1769. (t.getTodoLabels = x),
  1770. (t.disableDay = A),
  1771. (t.enableArea = E),
  1772. (t.enableDays = I),
  1773. (t.setSelectedDays = P),
  1774. (t.getCalendarConfig = j),
  1775. (t.setCalendarConfig = G),
  1776. (t.getCalendarDates = U),
  1777. (t.switchView = F),
  1778. (t.default = t.calculateNextWeekDays = t.calculatePrevWeekDays = t.whenMulitSelect = t.whenSingleSelect = t.renderCalendar = t.whenChangeDate = void 0);
  1779. var n = f(a(9)),
  1780. s = f(a(4)),
  1781. r = f(a(6)),
  1782. o = f(a(1)),
  1783. c = f(a(5)),
  1784. l = f(a(3)),
  1785. b = f(a(2)),
  1786. d = a(0);
  1787. function f(e) {
  1788. return e && e.__esModule ? e : { default: e };
  1789. }
  1790. let i = {},
  1791. h = new d.Logger(),
  1792. u = new d.GetDate(),
  1793. y = null;
  1794. function m(e) {
  1795. e && (i = (0, d.getComponent)(e));
  1796. }
  1797. function D(e, t) {
  1798. return m(t), (y = new o.default(i)).getData(e);
  1799. }
  1800. function g(e, t = () => {}) {
  1801. return new o.default(i).setData(e, t);
  1802. }
  1803. const p = {
  1804. renderCalendar(e, t, a) {
  1805. return (
  1806. (0, d.isComponent)(this) && (i = this),
  1807. new Promise((n, s) => {
  1808. (0, c.default)(i)
  1809. .renderCalendar(e, t, a)
  1810. .then(() => {
  1811. !(function(e) {
  1812. e.calendar = {
  1813. jump: S,
  1814. switchView: F,
  1815. disableDay: A,
  1816. enableArea: E,
  1817. enableDays: I,
  1818. getCurrentYM: L,
  1819. getSelectedDay: v,
  1820. cancelAllSelectedDay: W,
  1821. setTodoLabels: $,
  1822. getTodoLabels: x,
  1823. deleteTodoLabels: Y,
  1824. clearTodoLabels: O,
  1825. setSelectedDays: P,
  1826. getCalendarConfig: j,
  1827. setCalendarConfig: G,
  1828. getCalendarDates: U
  1829. };
  1830. })((0, d.getCurrentPage)()),
  1831. i.triggerEvent('afterCalendarRender', i),
  1832. (i.firstRender = !0),
  1833. (d.initialTasks.flag = 'finished'),
  1834. d.initialTasks.tasks.length &&
  1835. d.initialTasks.tasks.shift()(),
  1836. n();
  1837. });
  1838. })
  1839. );
  1840. },
  1841. whenChangeDate({ curYear: e, curMonth: t, newYear: a, newMonth: n }) {
  1842. i.triggerEvent('whenChangeMonth', {
  1843. current: { year: e, month: t },
  1844. next: { year: a, month: n }
  1845. });
  1846. },
  1847. whenMulitSelect(e) {
  1848. (0, d.isComponent)(this) && (i = this);
  1849. const { calendar: t = {} } = D(),
  1850. { days: a, todoLabels: n } = t;
  1851. let { selectedDay: s = [] } = t;
  1852. const r = a[e];
  1853. if (r) {
  1854. if (((r.choosed = !r.choosed), r.choosed)) {
  1855. r.cancel = !1;
  1856. const { showLabelAlways: e } = D('calendar');
  1857. e && r.showTodoLabel
  1858. ? (r.showTodoLabel = !0)
  1859. : (r.showTodoLabel = !1),
  1860. s.push(r);
  1861. } else {
  1862. r.cancel = !0;
  1863. const e = `${r.year}-${r.month}-${r.day}`;
  1864. (s = s.filter(t => e !== `${t.year}-${t.month}-${t.day}`)),
  1865. n &&
  1866. n.forEach(t => {
  1867. e === `${t.year}-${t.month}-${t.day}` &&
  1868. (r.showTodoLabel = !0);
  1869. });
  1870. }
  1871. if ((0, l.default)(i).getCalendarConfig().takeoverTap)
  1872. return i.triggerEvent('onTapDay', r);
  1873. g({ 'calendar.days': a, 'calendar.selectedDay': s }),
  1874. p.afterTapDay(r, s);
  1875. }
  1876. },
  1877. whenSingleSelect(e) {
  1878. (0, d.isComponent)(this) && (i = this);
  1879. const { calendar: t = {} } = D(),
  1880. { days: a, selectedDay: n = [], todoLabels: s } = t;
  1881. let o = [];
  1882. const c = a[e];
  1883. if (!c) return;
  1884. const b = (n[0] || {}).day,
  1885. f = (b && a[b - 1]) || {},
  1886. { month: h, year: u } = a[0] || {},
  1887. y = (0, l.default)(i).getCalendarConfig();
  1888. if (y.takeoverTap) return i.triggerEvent('onTapDay', c);
  1889. if ((p.afterTapDay(c), !y.inverse && f.day === c.day)) return;
  1890. i.weekMode &&
  1891. a.forEach((e, t) => {
  1892. e.day === b && (a[t].choosed = !1);
  1893. }),
  1894. s && (o = s.filter(e => +e.year === u && +e.month === h)),
  1895. (0, r.default)(i).showTodoLabels(o, a, n);
  1896. const m = { 'calendar.days': a };
  1897. f.day !== c.day
  1898. ? ((f.choosed = !1),
  1899. (c.choosed = !0),
  1900. (t.showLabelAlways && c.showTodoLabel) || (c.showTodoLabel = !1),
  1901. (m['calendar.selectedDay'] = [c]))
  1902. : y.inverse &&
  1903. ((c.choosed = !c.choosed),
  1904. c.choosed &&
  1905. (c.showTodoLabel && t.showLabelAlways
  1906. ? (c.showTodoLabel = !0)
  1907. : (c.showTodoLabel = !1)),
  1908. (m['calendar.selectedDay'] = [])),
  1909. g(m);
  1910. },
  1911. afterTapDay(e, t) {
  1912. const a = (0, l.default)(i).getCalendarConfig(),
  1913. { multi: n } = a;
  1914. n
  1915. ? i.triggerEvent('afterTapDay', {
  1916. currentSelected: e,
  1917. selectedDays: t
  1918. })
  1919. : i.triggerEvent('afterTapDay', e);
  1920. },
  1921. jumpToToday() {
  1922. const { year: e, month: t, date: a } = u.todayDate(),
  1923. n = u.todayTimestamp();
  1924. g({
  1925. 'calendar.curYear': e,
  1926. 'calendar.curMonth': t,
  1927. 'calendar.selectedDay': [
  1928. {
  1929. year: e,
  1930. day: a,
  1931. month: t,
  1932. choosed: !0,
  1933. lunar: (0, l.default)(i).getCalendarConfig().showLunar
  1934. ? b.default.solar2lunar(e, t, a)
  1935. : null
  1936. }
  1937. ],
  1938. 'calendar.todayTimestamp': n
  1939. }),
  1940. p.renderCalendar(e, t, a);
  1941. }
  1942. },
  1943. w = p.whenChangeDate;
  1944. t.whenChangeDate = w;
  1945. const C = p.renderCalendar;
  1946. t.renderCalendar = C;
  1947. const T = p.whenSingleSelect;
  1948. t.whenSingleSelect = T;
  1949. const M = p.whenMulitSelect;
  1950. t.whenMulitSelect = M;
  1951. const k = p.calculatePrevWeekDays;
  1952. t.calculatePrevWeekDays = k;
  1953. const _ = p.calculateNextWeekDays;
  1954. function L(e) {
  1955. return (
  1956. m(e), { year: D('calendar.curYear'), month: D('calendar.curMonth') }
  1957. );
  1958. }
  1959. function v(e) {
  1960. return m(e), D('calendar.selectedDay');
  1961. }
  1962. function W(e) {
  1963. m(e);
  1964. const t = [...D('calendar.days')];
  1965. t.map(e => {
  1966. e.choosed = !1;
  1967. }),
  1968. g({ 'calendar.days': t, 'calendar.selectedDay': [] });
  1969. }
  1970. function S(e, t, a, n) {
  1971. m(n);
  1972. const { selectedDay: r = [], weekMode: o } = D('calendar') || {},
  1973. { year: c, month: l, day: b } = r[0] || {};
  1974. if (+c != +e || +l != +t || +b != +a) {
  1975. if (o) return (0, s.default)(i).jump({ year: e, month: t, day: a });
  1976. if (e && t) {
  1977. if ('number' != typeof +e || 'number' != typeof +t)
  1978. return h.warn('jump 函数年月日参数必须为数字');
  1979. const n = u.todayTimestamp();
  1980. g(
  1981. {
  1982. 'calendar.curYear': e,
  1983. 'calendar.curMonth': t,
  1984. 'calendar.todayTimestamp': n
  1985. },
  1986. () => {
  1987. if ('number' == typeof +a) return p.renderCalendar(e, t, a);
  1988. p.renderCalendar(e, t);
  1989. }
  1990. );
  1991. } else p.jumpToToday();
  1992. }
  1993. }
  1994. function $(e, t) {
  1995. m(t), (0, r.default)(i).setTodoLabels(e);
  1996. }
  1997. function Y(e, t) {
  1998. m(t), (0, r.default)(i).deleteTodoLabels(e);
  1999. }
  2000. function O(e) {
  2001. m(e), (0, r.default)(i).clearTodoLabels();
  2002. }
  2003. function x(e) {
  2004. return m(e), (0, r.default)(i).getTodoLabels();
  2005. }
  2006. function A(e = [], t) {
  2007. m(t), (0, n.default)(i).disableDays(e);
  2008. }
  2009. function E(e = [], t) {
  2010. m(t), (0, n.default)(i).enableArea(e);
  2011. }
  2012. function I(e = [], t) {
  2013. m(t), (0, n.default)(i).enableDays(e);
  2014. }
  2015. function P(e, t) {
  2016. m(t), (0, n.default)(i).setSelectedDays(e);
  2017. }
  2018. function j(e) {
  2019. m(e), (0, l.default)(i).getCalendarConfig();
  2020. }
  2021. function G(e, t, a) {
  2022. m(a), (0, l.default)(i).setCalendarConfig(e, t);
  2023. }
  2024. function U(e) {
  2025. return m(e), D('calendar.days', e);
  2026. }
  2027. function F(...e) {
  2028. return new Promise((t, a) => {
  2029. const n = e[0];
  2030. if (!e[1])
  2031. return (0, s.default)(i)
  2032. .switchWeek(n)
  2033. .then(t)
  2034. .catch(a);
  2035. 'string' == typeof e[1]
  2036. ? (m(e[1]),
  2037. (0, s.default)(i)
  2038. .switchWeek(n, e[2])
  2039. .then(t)
  2040. .catch(a))
  2041. : 'object' == typeof e[1] &&
  2042. ('string' == typeof e[2] && m(e[1]),
  2043. (0, s.default)(i)
  2044. .switchWeek(n, e[1])
  2045. .then(t)
  2046. .catch(a));
  2047. });
  2048. }
  2049. function N(e, t) {
  2050. (d.initialTasks.flag = 'process'),
  2051. ((i = e).config = t),
  2052. (function(e) {
  2053. let t = ['日', '一', '二', '三', '四', '五', '六'];
  2054. 'Mon' === e && (t = ['一', '二', '三', '四', '五', '六', '日']),
  2055. g({ 'calendar.weeksCh': t });
  2056. })(t.firstDayOfWeek),
  2057. (function(e) {
  2058. if (e && 'string' == typeof e) {
  2059. const t = e.split('-');
  2060. if (t.length < 3)
  2061. return h.warn('配置 jumpTo 格式应为: 2018-4-2 或 2018-04-02');
  2062. S(+t[0], +t[1], +t[2]);
  2063. } else e ? S() : ((i.config.noDefault = !0), S());
  2064. })(t.defaultDay),
  2065. h.tips(
  2066. '使用中若遇问题请反馈至 https://github.com/treadpit/wx_calendar/issues ✍️'
  2067. );
  2068. }
  2069. t.calculateNextWeekDays = _;
  2070. t.default = (e, t = {}) => {
  2071. if ('process' === d.initialTasks.flag)
  2072. return d.initialTasks.tasks.push(function() {
  2073. N(e, t);
  2074. });
  2075. N(e, t);
  2076. };
  2077. },
  2078. function(e, t, a) {
  2079. 'use strict';
  2080. Object.defineProperty(t, '__esModule', { value: !0 }), (t.default = void 0);
  2081. var n = o(a(1)),
  2082. s = o(a(3)),
  2083. r = a(0);
  2084. function o(e) {
  2085. return e && e.__esModule ? e : { default: e };
  2086. }
  2087. const c = new r.Logger(),
  2088. l = new r.GetDate();
  2089. class b extends n.default {
  2090. constructor(e) {
  2091. super(e), (this.Component = e);
  2092. }
  2093. enableArea(e = []) {
  2094. if (2 === e.length) {
  2095. const { start: t, end: a, startTimestamp: n, endTimestamp: s } = (0,
  2096. r.convertEnableAreaToTimestamp)(e);
  2097. if (!t || !a) return;
  2098. const o = l.thisMonthDays(t[0], t[1]),
  2099. c = l.thisMonthDays(a[0], a[1]);
  2100. if (
  2101. this.__judgeParam({
  2102. start: t,
  2103. end: a,
  2104. startMonthDays: o,
  2105. endMonthDays: c,
  2106. startTimestamp: n,
  2107. endTimestamp: s
  2108. })
  2109. ) {
  2110. let { days: t = [], selectedDay: a = [] } = this.getData(
  2111. 'calendar'
  2112. );
  2113. const r = this.__handleEnableArea(
  2114. { area: e, days: t, startTimestamp: n, endTimestamp: s },
  2115. a
  2116. );
  2117. this.setData({
  2118. 'calendar.enableArea': e,
  2119. 'calendar.days': r.dates,
  2120. 'calendar.selectedDay': r.selectedDay,
  2121. 'calendar.enableAreaTimestamp': [n, s]
  2122. });
  2123. }
  2124. } else
  2125. c.warn(
  2126. 'enableArea()参数需为时间范围数组,形如:["2018-8-4" , "2018-8-24"]'
  2127. );
  2128. }
  2129. enableDays(e = []) {
  2130. const { enableArea: t = [] } = this.getData('calendar');
  2131. let a = [];
  2132. a = t.length
  2133. ? (0, r.delRepeatedEnableDay)(e, t)
  2134. : (0, r.converEnableDaysToTimestamp)(e);
  2135. let { days: n = [], selectedDay: s = [] } = this.getData('calendar');
  2136. const o = this.__handleEnableDays(
  2137. { days: n, expectEnableDaysTimestamp: a },
  2138. s
  2139. );
  2140. this.setData({
  2141. 'calendar.days': o.dates,
  2142. 'calendar.selectedDay': o.selectedDay,
  2143. 'calendar.enableDays': e,
  2144. 'calendar.enableDaysTimestamp': a
  2145. });
  2146. }
  2147. setSelectedDays(e) {
  2148. if (!(0, s.default)(this.Component).getCalendarConfig().multi)
  2149. return c.warn('单选模式下不能设置多日期选中,请配置 multi');
  2150. let { days: t } = this.getData('calendar'),
  2151. a = [];
  2152. if (e) {
  2153. if (e && e.length) {
  2154. const { dates: n, selectedDates: s } = this.__handleSelectedDays(
  2155. t,
  2156. a,
  2157. e
  2158. );
  2159. (t = n), (a = s);
  2160. }
  2161. } else
  2162. t.map(e => {
  2163. (e.choosed = !0), (e.showTodoLabel = !1);
  2164. }),
  2165. (a = t);
  2166. (0, s.default)(this.Component).setCalendarConfig('multi', !0),
  2167. this.setData({ 'calendar.days': t, 'calendar.selectedDay': a });
  2168. }
  2169. disableDays(e) {
  2170. const { disableDays: t = [], days: a } = this.getData('calendar');
  2171. if ('[object Array]' !== Object.prototype.toString.call(e))
  2172. return c.warn('disableDays 参数为数组');
  2173. let n = [];
  2174. if (e.length) {
  2175. const s = (n = (0, r.uniqueArrayByDate)(e.concat(t))).map(
  2176. e => `${e.year}-${e.month}-${e.day}`
  2177. );
  2178. a.forEach(e => {
  2179. const t = `${e.year}-${e.month}-${e.day}`;
  2180. s.includes(t) && (e.disable = !0);
  2181. });
  2182. } else
  2183. a.forEach(e => {
  2184. e.disable = !1;
  2185. });
  2186. this.setData({ 'calendar.days': a, 'calendar.disableDays': n });
  2187. }
  2188. __judgeParam(e) {
  2189. const {
  2190. start: t,
  2191. end: a,
  2192. startMonthDays: n,
  2193. endMonthDays: s,
  2194. startTimestamp: r,
  2195. endTimestamp: o
  2196. } = e;
  2197. return t[2] > n || t[2] < 1
  2198. ? (c.warn(
  2199. 'enableArea() 开始日期错误,指定日期不在当前月份天数范围内'
  2200. ),
  2201. !1)
  2202. : t[1] > 12 || t[1] < 1
  2203. ? (c.warn('enableArea() 开始日期错误,月份超出1-12月份'), !1)
  2204. : a[2] > s || a[2] < 1
  2205. ? (c.warn(
  2206. 'enableArea() 截止日期错误,指定日期不在当前月份天数范围内'
  2207. ),
  2208. !1)
  2209. : a[1] > 12 || a[1] < 1
  2210. ? (c.warn('enableArea() 截止日期错误,月份超出1-12月份'), !1)
  2211. : !(r > o) || (c.warn('enableArea()参数最小日期大于了最大日期'), !1);
  2212. }
  2213. __handleEnableArea(e = {}, t = []) {
  2214. const { area: a, days: n, startTimestamp: s, endTimestamp: o } = e,
  2215. c = this.getData('calendar.enableDays') || [];
  2216. let b = [];
  2217. c.length && (b = (0, r.delRepeatedEnableDay)(c, a));
  2218. const d = [...n];
  2219. return (
  2220. d.forEach(e => {
  2221. const a = l.newDate(e.year, e.month, e.day).getTime();
  2222. (+s > +a || +a > +o) && !b.includes(+a)
  2223. ? ((e.disable = !0),
  2224. e.choosed &&
  2225. ((e.choosed = !1),
  2226. (t = t.filter(
  2227. t =>
  2228. `${e.year}-${e.month}-${e.day}` !==
  2229. `${t.year}-${t.month}-${t.day}`
  2230. ))))
  2231. : e.disable && (e.disable = !1);
  2232. }),
  2233. { dates: d, selectedDay: t }
  2234. );
  2235. }
  2236. __handleEnableDays(e = {}, t = []) {
  2237. const { days: a, expectEnableDaysTimestamp: n } = e,
  2238. { enableAreaTimestamp: s = [] } = this.getData('calendar'),
  2239. r = [...a];
  2240. return (
  2241. r.forEach(e => {
  2242. const a = l.newDate(e.year, e.month, e.day).getTime();
  2243. let r = !1;
  2244. s.length
  2245. ? (+s[0] > +a || +a > +s[1]) && !n.includes(+a) && (r = !0)
  2246. : n.includes(+a) || (r = !0),
  2247. r
  2248. ? ((e.disable = !0),
  2249. e.choosed &&
  2250. ((e.choosed = !1),
  2251. (t = t.filter(
  2252. t =>
  2253. `${e.year}-${e.month}-${e.day}` !==
  2254. `${t.year}-${t.month}-${t.day}`
  2255. ))))
  2256. : (e.disable = !1);
  2257. }),
  2258. { dates: r, selectedDay: t }
  2259. );
  2260. }
  2261. __handleSelectedDays(e = [], t = [], a) {
  2262. const { selectedDay: n, showLabelAlways: s } = this.getData('calendar');
  2263. t = n && n.length ? (0, r.uniqueArrayByDate)(n.concat(a)) : a;
  2264. const { year: o, month: c } = e[0],
  2265. l = [];
  2266. return (
  2267. t.forEach(e => {
  2268. +e.year == +o &&
  2269. +e.month == +c &&
  2270. l.push(`${e.year}-${e.month}-${e.day}`);
  2271. }),
  2272. [...e].map(e => {
  2273. l.includes(`${e.year}-${e.month}-${e.day}`) &&
  2274. ((e.choosed = !0),
  2275. s && e.showTodoLabel
  2276. ? (e.showTodoLabel = !0)
  2277. : (e.showTodoLabel = !1));
  2278. }),
  2279. { dates: e, selectedDates: t }
  2280. );
  2281. }
  2282. }
  2283. t.default = e => new b(e);
  2284. }
  2285. ]);