@worktango/ai-assistant 0.0.24 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Absenteeism-BlfJuY7Q.mjs → Absenteeism-DbIxHyQw.mjs} +12 -12
- package/dist/{ActivityFeed-CdbbvPCr.mjs → ActivityFeed-BRkS961e.mjs} +11 -11
- package/dist/{AddUser-Dm5tN1Cr.mjs → AddUser-D5w21xB7.mjs} +19 -22
- package/dist/{Admin-Cv5LVBbB.mjs → Admin-ByXBrdqC.mjs} +12 -12
- package/dist/Admin-YhydRW2u.mjs +70 -0
- package/dist/Anniversary-CT1cf6H5.mjs +35 -0
- package/dist/{Appreciation-CplBRYpa.mjs → Appreciation-iZsYD0QC.mjs} +13 -13
- package/dist/ArrowDown-DFSKlGr4.mjs +38 -0
- package/dist/ArrowLeft-DPuJx--j.mjs +12 -0
- package/dist/ArrowRight-VJNI-g2y.mjs +12 -0
- package/dist/ArrowUp-DcI8MdrO.mjs +31 -0
- package/dist/{Attachment-DEzcZHI7.mjs → Attachment-KmA75q1S.mjs} +7 -7
- package/dist/{BeQuickDontHurry-DoCKS3D0.mjs → BeQuickDontHurry-uOuPJpUy.mjs} +18 -18
- package/dist/Birthday-BTpQbBlc.mjs +66 -0
- package/dist/{BrandPromise-DT7BpKTq.mjs → BrandPromise-DJtzx6MU.mjs} +13 -13
- package/dist/{BrandVision-CsF5PHr9.mjs → BrandVision-C7sDSe3O.mjs} +18 -18
- package/dist/Calendar-DRRaOaMS.mjs +24 -0
- package/dist/CaretDn-Bozv_sbl.mjs +11 -0
- package/dist/CaretDown-C6kx7VAt.mjs +5 -0
- package/dist/CaretLeft-D0LG6rj4.mjs +11 -0
- package/dist/CaretRight-DwvLzE1w.mjs +11 -0
- package/dist/CaretUp-BmUqXg6f.mjs +11 -0
- package/dist/{ChallengeAccepted-BrB08i_g.mjs → ChallengeAccepted-ZwZ-utsp.mjs} +12 -12
- package/dist/CheckIn-D64WSSUj.mjs +34 -0
- package/dist/{CheckIns-BokF9D3N.mjs → CheckIns-D7LWyJqC.mjs} +10 -10
- package/dist/{CheckSeal-3RBoC7kt.mjs → CheckSeal-CZrIqtKF.mjs} +7 -10
- package/dist/{Checkmark-Cvb9TKPn.mjs → Checkmark-BsyXP1mq.mjs} +6 -9
- package/dist/{Clock-CRQ3vRb2.mjs → Clock-Dbsn4NyM.mjs} +9 -12
- package/dist/Close-BakZAUMS.mjs +12 -0
- package/dist/{CloudDownload-h8jFkmQV.mjs → CloudDownload-CuYldO5T.mjs} +7 -10
- package/dist/{Comment-CGL9Fj78.mjs → Comment-CEv68J37.mjs} +28 -31
- package/dist/{Comments-DnQeuBWu.mjs → Comments-DAja_DwU.mjs} +12 -12
- package/dist/{Connections-GHPqdXk3.mjs → Connections-B0xcAr-2.mjs} +12 -12
- package/dist/Copy-kiAE90DM.mjs +72 -0
- package/dist/{CustomQuestion-CYiCPJX8.mjs → CustomQuestion-Dlm7z-U3.mjs} +11 -11
- package/dist/{CustomerSuccess-FdMSyQLg.mjs → CustomerSuccess-DQhMrH_7.mjs} +12 -12
- package/dist/DatePicker-BKoSYYBY.mjs +2233 -0
- package/dist/Dot-DKK811Wp.mjs +12 -0
- package/dist/Download-JX0_AnOW.mjs +38 -0
- package/dist/Drag-BeaOeB0D.mjs +41 -0
- package/dist/Earn-C7x7hY1z.mjs +15 -0
- package/dist/Email-dNel_toZ.mjs +24 -0
- package/dist/{EmojiDisplay-D3d36Nrl.mjs → EmojiDisplay-GXF14_M4.mjs} +12719 -12719
- package/dist/{EmojiPicker-BzkYk2Yv.mjs → EmojiPicker-DrYJHsmo.mjs} +5311 -5311
- package/dist/{EnpsSurvey-wpqDe9Xq.mjs → EnpsSurvey-BtCxfMsV.mjs} +12 -12
- package/dist/Expired-FZ9Qs6aV.mjs +33 -0
- package/dist/Eye-BbSYTVj4.mjs +27 -0
- package/dist/{Feedback-DTwwTQN3.mjs → Feedback-BitWymFH.mjs} +12 -12
- package/dist/{Feedback-BQpvKfzY.mjs → Feedback-Dao-fdnk.mjs} +9 -12
- package/dist/Filter-BBUPDHmj.mjs +64 -0
- package/dist/Flag-D_mbjbc0.mjs +35 -0
- package/dist/{Giphy-CFMqJSYK.mjs → Giphy-EhReeuJi.mjs} +8 -8
- package/dist/GoalCount-byqMnHu8.mjs +10 -0
- package/dist/GoalPercent-CksAouyg.mjs +21 -0
- package/dist/{GoalTask-IZwR0ZSf.mjs → GoalTask-BR5qi0zp.mjs} +12 -12
- package/dist/GoalTask-BRO_abBD.mjs +20 -0
- package/dist/{Goals-COoucVqq.mjs → Goals-CUDz6Ygb.mjs} +14 -14
- package/dist/Goals-vWCCDyeK.mjs +79 -0
- package/dist/{Growth-D8A13g-Q.mjs → Growth-XOYZNJ9o.mjs} +19 -19
- package/dist/Hamburger-CnEGIF9h.mjs +9 -0
- package/dist/Help-BFLRhF0p.mjs +36 -0
- package/dist/{HighFive-kxxxx1a1.mjs → HighFive-CfnfuRqf.mjs} +10 -10
- package/dist/HighFive-D3n2d2uM.mjs +38 -0
- package/dist/{Home-Dzhzxm5B.mjs → Home-Bx_4F2LF.mjs} +6 -9
- package/dist/{Home-CE6c4US8.mjs → Home-hbTJOaaF.mjs} +9 -9
- package/dist/{HorizontalLine-Dyh1cfN-.mjs → HorizontalLine-BHCLWKsU.mjs} +6 -9
- package/dist/Hourglass-CBd0QCpO.mjs +53 -0
- package/dist/{Image-D8RpGjUr.mjs → Image-DY7MPZ_Z.mjs} +12 -12
- package/dist/ImageFile-DSoQ_ULA.mjs +60 -0
- package/dist/{InGoodCompany-F_ltthqt.mjs → InGoodCompany-CdeyMj6l.mjs} +10 -10
- package/dist/{Incentives-CFe-oLpH.mjs → Incentives-C-89M7JU.mjs} +26 -26
- package/dist/Info-CjHRpvMC.mjs +31 -0
- package/dist/Insights-BXcXbmlK.mjs +20 -0
- package/dist/{Insights-C0x9QzfX.mjs → Insights-DXKe6hG-.mjs} +11 -11
- package/dist/{Integrations-D4MNE3-i.mjs → Integrations-o1uhXAFC.mjs} +10 -10
- package/dist/KazooLogo-BqF19BMf.mjs +38 -0
- package/dist/{KnowYourAudience-D9qjKO2J.mjs → KnowYourAudience-CmSD_BLM.mjs} +18 -18
- package/dist/{Launch-xm296JGJ.mjs → Launch-BYma6AGg.mjs} +16 -16
- package/dist/Link-CZwyDrBe.mjs +25 -0
- package/dist/LinkArrow-Dk4E6w5w.mjs +12 -0
- package/dist/Loading-YnbFxymU.mjs +6 -0
- package/dist/Lock-DGuPygwV.mjs +31 -0
- package/dist/{Management-CSk1I3Vu.mjs → Management-D1sg9uFb.mjs} +17 -18
- package/dist/MeatballMenu-D6hKEmMm.mjs +9 -0
- package/dist/{Messages-CdHryWCZ.mjs → Messages-8AsLy3Ze.mjs} +35 -35
- package/dist/{Mobile-DIs7zF33.mjs → Mobile-DYAdIqRU.mjs} +9 -9
- package/dist/Nomination-B4eRF4RY.mjs +12 -0
- package/dist/{NominationsAndAwards-DUlt_REW.mjs → NominationsAndAwards-qrYeAqC0.mjs} +13 -13
- package/dist/Notification-Fyh_qT7l.mjs +28 -0
- package/dist/{Okrs-BVR2trfg.mjs → Okrs-BHZOV80J.mjs} +12 -12
- package/dist/{PeerToPeer-Dw7054su.mjs → PeerToPeer-in78HEZj.mjs} +14 -14
- package/dist/Pencil-CFOGq3tl.mjs +25 -0
- package/dist/People-BIEfre7y.mjs +43 -0
- package/dist/{PerformanceManagement-BO6JMhw0.mjs → PerformanceManagement-zr50Uo74.mjs} +13 -13
- package/dist/Pin-BlIj4jUO.mjs +24 -0
- package/dist/{PinnedIconAward-CfI7QvmM.mjs → PinnedIconAward-DGkfzaYq.mjs} +7 -7
- package/dist/{PinnedIconBrightIdea-C-jLsEme.mjs → PinnedIconBrightIdea-_PIGpRlT.mjs} +7 -7
- package/dist/{PinnedIconBullseye-DHzPwFNh.mjs → PinnedIconBullseye-BVA0IbuN.mjs} +12 -12
- package/dist/{PinnedIconChampagne-DqhhML6p.mjs → PinnedIconChampagne-B5VsP1uZ.mjs} +7 -7
- package/dist/{PinnedIconCheer-Dr-LynHf.mjs → PinnedIconCheer-BvVI9R1s.mjs} +7 -7
- package/dist/{PinnedIconCrown-BjZF_Us9.mjs → PinnedIconCrown-7c4v8OAE.mjs} +7 -7
- package/dist/{PinnedIconDiamond-mR8xcC_8.mjs → PinnedIconDiamond-KNFEMUbf.mjs} +7 -7
- package/dist/{PinnedIconHoleInOne-D0YlpLT_.mjs → PinnedIconHoleInOne-DS0iru38.mjs} +7 -7
- package/dist/{PinnedIconMedal-CsbWDOeO.mjs → PinnedIconMedal-DNYo7Q_4.mjs} +7 -7
- package/dist/{PinnedIconMetrics-FZwXRcdT.mjs → PinnedIconMetrics-DYVfMlTS.mjs} +7 -7
- package/dist/{PinnedIconPin-DQYaYwDa.mjs → PinnedIconPin-isLkYffs.mjs} +7 -7
- package/dist/{PinnedIconRockAndRoll-2pp2LlIt.mjs → PinnedIconRockAndRoll-cM3G61Zg.mjs} +9 -9
- package/dist/{PinnedIconRocket-BIrfZPOc.mjs → PinnedIconRocket-fW18WHsP.mjs} +7 -7
- package/dist/{PinnedIconStrength-B2Jlgh2J.mjs → PinnedIconStrength-DYAFCmJb.mjs} +7 -7
- package/dist/{PinnedIconTeddyBear-CywM8WU1.mjs → PinnedIconTeddyBear-D6Z-VmEr.mjs} +14 -14
- package/dist/{PlatformLogo-D2gEkUsw.mjs → PlatformLogo-Ba6fhYL-.mjs} +17 -17
- package/dist/{Plus-hKSiCxQa.mjs → Plus-BWNChy5f.mjs} +7 -10
- package/dist/Popper-BcjGnYbw.mjs +1118 -0
- package/dist/{PrivateEye-DOcfeBbQ.mjs → PrivateEye-CiAHgvVA.mjs} +28 -28
- package/dist/{PrivatePushPin-BORYdpxi.mjs → PrivatePushPin-Cbzq5HQp.mjs} +10 -10
- package/dist/{Processing-C_zBVZIK.mjs → Processing-BGyqn20L.mjs} +16 -16
- package/dist/{Productivity-CLljIpDf.mjs → Productivity-DX4Cdq0V.mjs} +11 -11
- package/dist/ProgressCircle-CzpaiCHO.mjs +12 -0
- package/dist/{PulseSurvey-BQdfWo9A.mjs → PulseSurvey-CODkpYga.mjs} +12 -12
- package/dist/{PushPin-DkTVqfKk.mjs → PushPin-IzUgOW3q.mjs} +6 -9
- package/dist/{Recognition-Dz_nZRDX.mjs → Recognition-A5zGTUDg.mjs} +16 -16
- package/dist/Recognition-B8J1HswY.mjs +38 -0
- package/dist/{Retention-ChOlEHZk.mjs → Retention-DJ6Hc6bu.mjs} +12 -12
- package/dist/Rewards-BLT8o19W.mjs +67 -0
- package/dist/{Rewards-CVe8-44F.mjs → Rewards-CyLmJfdo.mjs} +12 -12
- package/dist/{RewardsCatalog-BV1YY9Iq.mjs → RewardsCatalog-BxDRD8gn.mjs} +12 -12
- package/dist/Roadmap-x5gb_w-E.mjs +122 -0
- package/dist/Search-CtX49hQl.mjs +14 -0
- package/dist/{Security-DRtNtKPc.mjs → Security-4B1JEd6u.mjs} +10 -10
- package/dist/SendRecognition-Dvoc7JDy.mjs +5 -0
- package/dist/ShareLink-CsO9ji1S.mjs +27 -0
- package/dist/Skill-CJxY5Ect.mjs +23 -0
- package/dist/{Skills-DaQLD2Bb.mjs → Skills-DbmdzWXU.mjs} +14 -14
- package/dist/{Smiley-BmRWMKju.mjs → Smiley-B_8fqS3p.mjs} +16 -16
- package/dist/{Stop-jEo5XX0_.mjs → Stop-CRVDFxKZ.mjs} +29 -29
- package/dist/{Survey-D7Lx8jsj.mjs → Survey-Dc9QvEh_.mjs} +16 -16
- package/dist/{Surveys-Bnwc-nKF.mjs → Surveys-DzrcPmpP.mjs} +12 -12
- package/dist/{SyncUps-DRTsoQ40.mjs → SyncUps-Dj0iXLsY.mjs} +9 -9
- package/dist/Syncs-wLELtlXx.mjs +29 -0
- package/dist/{TalentReview-BCPucb1o.mjs → TalentReview-BFZJx1vL.mjs} +14 -17
- package/dist/{TalentReview-CnEteZI6.mjs → TalentReview-CfNUWsKq.mjs} +10 -10
- package/dist/TalentReviewInsights-BUf6RaW_.mjs +100 -0
- package/dist/TaskCompleted-B06T4kGc.mjs +97 -0
- package/dist/{Team-DG9N4ucC.mjs → Team-u706d96c.mjs} +13 -13
- package/dist/Teams-tv03lb-i.mjs +80 -0
- package/dist/{TextBold-JCoCqG2E.mjs → TextBold-CAuftAwA.mjs} +19 -19
- package/dist/{TextBulletList-wdvz7YF6.mjs → TextBulletList-BL4JCHXA.mjs} +31 -31
- package/dist/TextInput-pIiGhenH.mjs +121 -0
- package/dist/{TextItalic-DS-EVK3i.mjs → TextItalic-DUhF_PoH.mjs} +19 -19
- package/dist/{TextNumberList-DN5rq8Yj.mjs → TextNumberList-vSRXRVlj.mjs} +35 -35
- package/dist/{TextUnderline-BFQg7hSu.mjs → TextUnderline-CFqFuCuP.mjs} +23 -23
- package/dist/Toggle-CwjumJqn.mjs +76 -0
- package/dist/{Trash-CS1BAv8d.mjs → Trash-DCWrFXRz.mjs} +12 -15
- package/dist/TrendDown-DKVdhzB5.mjs +5 -0
- package/dist/TrendUp-BuHaGNF8.mjs +5 -0
- package/dist/{Unplugged-j7jw4iIL.mjs → Unplugged-CDA6UDKK.mjs} +32 -32
- package/dist/UpDownCaret-Wxd9Imbv.mjs +12 -0
- package/dist/{VerticalLine-DU1-BZfR.mjs → VerticalLine-DGcXIbTO.mjs} +13 -13
- package/dist/{Warning-C1kQzf8A.mjs → Warning-Dsuukwz8.mjs} +9 -9
- package/dist/{WarningNoOutline-CXC1MVzS.mjs → WarningNoOutline-De7nDvka.mjs} +10 -10
- package/dist/{YesAnd-C18ssrgG.mjs → YesAnd-D0FdeSxN.mjs} +9 -9
- package/dist/ai-assistant.css +1 -3144
- package/dist/emoji-BwyUr0K9.mjs +2240 -0
- package/dist/express.js +91 -0
- package/dist/react.es.js +4 -3
- package/dist/react.umd.js +234 -113808
- package/dist/reactComponent-Dehe_1Vr.mjs +22401 -0
- package/package.json +1 -1
- package/src/backend/express.ts +10 -3
- package/src/frontend/config.ts +54 -0
- package/src/frontend/reactComponent.ts +1 -0
- package/src/frontend/tools/generatedSdks.ts +3 -2
- package/src/frontend/tools/useAiAssistantSession.ts +2 -2
- package/types.d.ts +9 -0
- package/dist/Admin-GJZ14xCg.mjs +0 -73
- package/dist/Anniversary-CxsqeD8j.mjs +0 -38
- package/dist/ArrowDown-DCYs9jbi.mjs +0 -41
- package/dist/ArrowLeft-DlFDpsqu.mjs +0 -15
- package/dist/ArrowRight-CDqrZvCr.mjs +0 -15
- package/dist/ArrowUp-DtWnNyRL.mjs +0 -34
- package/dist/Birthday-COe-42mW.mjs +0 -69
- package/dist/Calendar-CbVaJVcV.mjs +0 -27
- package/dist/CaretDn-DfXkDzAH.mjs +0 -13
- package/dist/CaretDown-DKwSpoJj.mjs +0 -7
- package/dist/CaretLeft-DjIuIw4E.mjs +0 -13
- package/dist/CaretRight-Blv3CCWa.mjs +0 -13
- package/dist/CaretUp-CEfq2pon.mjs +0 -13
- package/dist/CheckIn-DHloFCTi.mjs +0 -37
- package/dist/Close-CgKO-GmV.mjs +0 -15
- package/dist/Copy-DSXLX28f.mjs +0 -75
- package/dist/DatePicker-0RNUxWxN.mjs +0 -3412
- package/dist/Dot-CRWfXlj2.mjs +0 -14
- package/dist/Download-Be5-WujX.mjs +0 -38
- package/dist/Drag-wZ_mXU-D.mjs +0 -44
- package/dist/Earn-06RGCgPA.mjs +0 -18
- package/dist/Email-8o3h5VSI.mjs +0 -27
- package/dist/Expired-DbhcQ39l.mjs +0 -36
- package/dist/Eye-Dceyvp5y.mjs +0 -30
- package/dist/Filter-CKJYpt6s.mjs +0 -67
- package/dist/Flag-Bex2EvDE.mjs +0 -35
- package/dist/GoalCount-Bi0NMucg.mjs +0 -12
- package/dist/GoalPercent-B-kxyps2.mjs +0 -23
- package/dist/GoalTask-Xjgp_Wo0.mjs +0 -22
- package/dist/Goals-BBGtKkJ1.mjs +0 -82
- package/dist/Hamburger-DInD_hK4.mjs +0 -11
- package/dist/Help-BcQznZaK.mjs +0 -36
- package/dist/HighFive-DqVD1Say.mjs +0 -41
- package/dist/Hourglass-CZ_gs0L5.mjs +0 -56
- package/dist/ImageFile-CpJ6rqlm.mjs +0 -62
- package/dist/Info-DNU4voqh.mjs +0 -34
- package/dist/Insights-D9LemXYM.mjs +0 -23
- package/dist/KazooLogo-DaVNTRlw.mjs +0 -38
- package/dist/Link-DUJoL5SM.mjs +0 -28
- package/dist/LinkArrow-C53WYuP9.mjs +0 -15
- package/dist/Loading-YoU3Ro5C.mjs +0 -8
- package/dist/Lock-Ig2rvmxz.mjs +0 -34
- package/dist/MeatballMenu-akus2Lt6.mjs +0 -11
- package/dist/Nomination-DtyERYRo.mjs +0 -14
- package/dist/Notification-yHY4Q-iO.mjs +0 -31
- package/dist/Pencil--PMTRUju.mjs +0 -28
- package/dist/People-01fveD3Z.mjs +0 -46
- package/dist/Pin-DrqWw6Ik.mjs +0 -27
- package/dist/Popper-D6_fRDiW.mjs +0 -1643
- package/dist/ProgressCircle-B9baqpgb.mjs +0 -14
- package/dist/Recognition-D3KBTtXQ.mjs +0 -41
- package/dist/Rewards-DU-Ho2dk.mjs +0 -70
- package/dist/Roadmap-zfvbEbqx.mjs +0 -125
- package/dist/Search-BhJp-JJi.mjs +0 -16
- package/dist/SendRecognition-Byajzteg.mjs +0 -7
- package/dist/ShareLink-D5S-TmIH.mjs +0 -30
- package/dist/Skill-CimhEzRw.mjs +0 -23
- package/dist/Syncs-CND3di67.mjs +0 -32
- package/dist/TalentReviewInsights-COIEM4Dx.mjs +0 -103
- package/dist/TaskCompleted-CVVIklMl.mjs +0 -100
- package/dist/Teams-BksxxA72.mjs +0 -80
- package/dist/TextInput-BOcHdYfi.mjs +0 -124
- package/dist/Toggle-CFvYpFN8.mjs +0 -76
- package/dist/TrendDown-C8RVuMbz.mjs +0 -7
- package/dist/TrendUp-eYJN1A6n.mjs +0 -7
- package/dist/UpDownCaret-DdXKQT69.mjs +0 -14
- package/dist/emoji-CJuut-ic.mjs +0 -3010
- package/dist/reactComponent-B4VA_e0q.mjs +0 -29485
- package/express.d.ts +0 -1
|
@@ -1,3412 +0,0 @@
|
|
|
1
|
-
import { r as requireReactIs, b as requireObjectAssign, g as getDefaultExportFromCjs, a as cx, e as dayjs, j as jsxRuntimeExports, C as ControlWrapper, I as Icon, P as PropTypes } from "./reactComponent-B4VA_e0q.mjs";
|
|
2
|
-
import React from "react";
|
|
3
|
-
const input$1 = "Input-module_input_Ns-MU";
|
|
4
|
-
const inputStyles = {
|
|
5
|
-
input: input$1,
|
|
6
|
-
"input--compact": "Input-module_input--compact_5qlqz",
|
|
7
|
-
"input--disabled": "Input-module_input--disabled_ID0-7",
|
|
8
|
-
"input--error": "Input-module_input--error_BsTcs"
|
|
9
|
-
};
|
|
10
|
-
var build = {};
|
|
11
|
-
var propTypes = { exports: {} };
|
|
12
|
-
var ReactPropTypesSecret_1;
|
|
13
|
-
var hasRequiredReactPropTypesSecret;
|
|
14
|
-
function requireReactPropTypesSecret() {
|
|
15
|
-
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
16
|
-
hasRequiredReactPropTypesSecret = 1;
|
|
17
|
-
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
18
|
-
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
19
|
-
return ReactPropTypesSecret_1;
|
|
20
|
-
}
|
|
21
|
-
var has;
|
|
22
|
-
var hasRequiredHas;
|
|
23
|
-
function requireHas() {
|
|
24
|
-
if (hasRequiredHas) return has;
|
|
25
|
-
hasRequiredHas = 1;
|
|
26
|
-
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
27
|
-
return has;
|
|
28
|
-
}
|
|
29
|
-
var checkPropTypes_1;
|
|
30
|
-
var hasRequiredCheckPropTypes;
|
|
31
|
-
function requireCheckPropTypes() {
|
|
32
|
-
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
33
|
-
hasRequiredCheckPropTypes = 1;
|
|
34
|
-
var printWarning = function() {
|
|
35
|
-
};
|
|
36
|
-
if (process.env.NODE_ENV !== "production") {
|
|
37
|
-
var ReactPropTypesSecret = /* @__PURE__ */ requireReactPropTypesSecret();
|
|
38
|
-
var loggedTypeFailures = {};
|
|
39
|
-
var has2 = /* @__PURE__ */ requireHas();
|
|
40
|
-
printWarning = function(text) {
|
|
41
|
-
var message = "Warning: " + text;
|
|
42
|
-
if (typeof console !== "undefined") {
|
|
43
|
-
console.error(message);
|
|
44
|
-
}
|
|
45
|
-
try {
|
|
46
|
-
throw new Error(message);
|
|
47
|
-
} catch (x) {
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
52
|
-
if (process.env.NODE_ENV !== "production") {
|
|
53
|
-
for (var typeSpecName in typeSpecs) {
|
|
54
|
-
if (has2(typeSpecs, typeSpecName)) {
|
|
55
|
-
var error;
|
|
56
|
-
try {
|
|
57
|
-
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
58
|
-
var err = Error(
|
|
59
|
-
(componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
|
|
60
|
-
);
|
|
61
|
-
err.name = "Invariant Violation";
|
|
62
|
-
throw err;
|
|
63
|
-
}
|
|
64
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
65
|
-
} catch (ex) {
|
|
66
|
-
error = ex;
|
|
67
|
-
}
|
|
68
|
-
if (error && !(error instanceof Error)) {
|
|
69
|
-
printWarning(
|
|
70
|
-
(componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
74
|
-
loggedTypeFailures[error.message] = true;
|
|
75
|
-
var stack = getStack ? getStack() : "";
|
|
76
|
-
printWarning(
|
|
77
|
-
"Failed " + location + " type: " + error.message + (stack != null ? stack : "")
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
checkPropTypes.resetWarningCache = function() {
|
|
85
|
-
if (process.env.NODE_ENV !== "production") {
|
|
86
|
-
loggedTypeFailures = {};
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
checkPropTypes_1 = checkPropTypes;
|
|
90
|
-
return checkPropTypes_1;
|
|
91
|
-
}
|
|
92
|
-
var factoryWithTypeCheckers;
|
|
93
|
-
var hasRequiredFactoryWithTypeCheckers;
|
|
94
|
-
function requireFactoryWithTypeCheckers() {
|
|
95
|
-
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
|
96
|
-
hasRequiredFactoryWithTypeCheckers = 1;
|
|
97
|
-
var ReactIs = requireReactIs();
|
|
98
|
-
var assign = requireObjectAssign();
|
|
99
|
-
var ReactPropTypesSecret = /* @__PURE__ */ requireReactPropTypesSecret();
|
|
100
|
-
var has2 = /* @__PURE__ */ requireHas();
|
|
101
|
-
var checkPropTypes = /* @__PURE__ */ requireCheckPropTypes();
|
|
102
|
-
var printWarning = function() {
|
|
103
|
-
};
|
|
104
|
-
if (process.env.NODE_ENV !== "production") {
|
|
105
|
-
printWarning = function(text) {
|
|
106
|
-
var message = "Warning: " + text;
|
|
107
|
-
if (typeof console !== "undefined") {
|
|
108
|
-
console.error(message);
|
|
109
|
-
}
|
|
110
|
-
try {
|
|
111
|
-
throw new Error(message);
|
|
112
|
-
} catch (x) {
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function emptyFunctionThatReturnsNull() {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
120
|
-
var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
|
|
121
|
-
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
122
|
-
function getIteratorFn(maybeIterable) {
|
|
123
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
124
|
-
if (typeof iteratorFn === "function") {
|
|
125
|
-
return iteratorFn;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
var ANONYMOUS = "<<anonymous>>";
|
|
129
|
-
var ReactPropTypes = {
|
|
130
|
-
array: createPrimitiveTypeChecker("array"),
|
|
131
|
-
bigint: createPrimitiveTypeChecker("bigint"),
|
|
132
|
-
bool: createPrimitiveTypeChecker("boolean"),
|
|
133
|
-
func: createPrimitiveTypeChecker("function"),
|
|
134
|
-
number: createPrimitiveTypeChecker("number"),
|
|
135
|
-
object: createPrimitiveTypeChecker("object"),
|
|
136
|
-
string: createPrimitiveTypeChecker("string"),
|
|
137
|
-
symbol: createPrimitiveTypeChecker("symbol"),
|
|
138
|
-
any: createAnyTypeChecker(),
|
|
139
|
-
arrayOf: createArrayOfTypeChecker,
|
|
140
|
-
element: createElementTypeChecker(),
|
|
141
|
-
elementType: createElementTypeTypeChecker(),
|
|
142
|
-
instanceOf: createInstanceTypeChecker,
|
|
143
|
-
node: createNodeChecker(),
|
|
144
|
-
objectOf: createObjectOfTypeChecker,
|
|
145
|
-
oneOf: createEnumTypeChecker,
|
|
146
|
-
oneOfType: createUnionTypeChecker,
|
|
147
|
-
shape: createShapeTypeChecker,
|
|
148
|
-
exact: createStrictShapeTypeChecker
|
|
149
|
-
};
|
|
150
|
-
function is(x, y) {
|
|
151
|
-
if (x === y) {
|
|
152
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
153
|
-
} else {
|
|
154
|
-
return x !== x && y !== y;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function PropTypeError(message, data) {
|
|
158
|
-
this.message = message;
|
|
159
|
-
this.data = data && typeof data === "object" ? data : {};
|
|
160
|
-
this.stack = "";
|
|
161
|
-
}
|
|
162
|
-
PropTypeError.prototype = Error.prototype;
|
|
163
|
-
function createChainableTypeChecker(validate) {
|
|
164
|
-
if (process.env.NODE_ENV !== "production") {
|
|
165
|
-
var manualPropTypeCallCache = {};
|
|
166
|
-
var manualPropTypeWarningCount = 0;
|
|
167
|
-
}
|
|
168
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
169
|
-
componentName = componentName || ANONYMOUS;
|
|
170
|
-
propFullName = propFullName || propName;
|
|
171
|
-
if (secret !== ReactPropTypesSecret) {
|
|
172
|
-
if (throwOnDirectAccess) {
|
|
173
|
-
var err = new Error(
|
|
174
|
-
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
|
|
175
|
-
);
|
|
176
|
-
err.name = "Invariant Violation";
|
|
177
|
-
throw err;
|
|
178
|
-
} else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
179
|
-
var cacheKey = componentName + ":" + propName;
|
|
180
|
-
if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
|
|
181
|
-
manualPropTypeWarningCount < 3) {
|
|
182
|
-
printWarning(
|
|
183
|
-
"You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
|
|
184
|
-
);
|
|
185
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
186
|
-
manualPropTypeWarningCount++;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (props[propName] == null) {
|
|
191
|
-
if (isRequired) {
|
|
192
|
-
if (props[propName] === null) {
|
|
193
|
-
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
|
|
194
|
-
}
|
|
195
|
-
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
|
|
196
|
-
}
|
|
197
|
-
return null;
|
|
198
|
-
} else {
|
|
199
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
203
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
204
|
-
return chainedCheckType;
|
|
205
|
-
}
|
|
206
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
207
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
208
|
-
var propValue = props[propName];
|
|
209
|
-
var propType = getPropType(propValue);
|
|
210
|
-
if (propType !== expectedType) {
|
|
211
|
-
var preciseType = getPreciseType(propValue);
|
|
212
|
-
return new PropTypeError(
|
|
213
|
-
"Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
|
|
214
|
-
{ expectedType }
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
return createChainableTypeChecker(validate);
|
|
220
|
-
}
|
|
221
|
-
function createAnyTypeChecker() {
|
|
222
|
-
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
223
|
-
}
|
|
224
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
225
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
226
|
-
if (typeof typeChecker !== "function") {
|
|
227
|
-
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
|
|
228
|
-
}
|
|
229
|
-
var propValue = props[propName];
|
|
230
|
-
if (!Array.isArray(propValue)) {
|
|
231
|
-
var propType = getPropType(propValue);
|
|
232
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
|
|
233
|
-
}
|
|
234
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
235
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
|
|
236
|
-
if (error instanceof Error) {
|
|
237
|
-
return error;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
return createChainableTypeChecker(validate);
|
|
243
|
-
}
|
|
244
|
-
function createElementTypeChecker() {
|
|
245
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
246
|
-
var propValue = props[propName];
|
|
247
|
-
if (!isValidElement(propValue)) {
|
|
248
|
-
var propType = getPropType(propValue);
|
|
249
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
|
|
250
|
-
}
|
|
251
|
-
return null;
|
|
252
|
-
}
|
|
253
|
-
return createChainableTypeChecker(validate);
|
|
254
|
-
}
|
|
255
|
-
function createElementTypeTypeChecker() {
|
|
256
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
257
|
-
var propValue = props[propName];
|
|
258
|
-
if (!ReactIs.isValidElementType(propValue)) {
|
|
259
|
-
var propType = getPropType(propValue);
|
|
260
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
|
|
261
|
-
}
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
return createChainableTypeChecker(validate);
|
|
265
|
-
}
|
|
266
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
267
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
268
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
269
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
270
|
-
var actualClassName = getClassName(props[propName]);
|
|
271
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
|
|
272
|
-
}
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
275
|
-
return createChainableTypeChecker(validate);
|
|
276
|
-
}
|
|
277
|
-
function createEnumTypeChecker(expectedValues) {
|
|
278
|
-
if (!Array.isArray(expectedValues)) {
|
|
279
|
-
if (process.env.NODE_ENV !== "production") {
|
|
280
|
-
if (arguments.length > 1) {
|
|
281
|
-
printWarning(
|
|
282
|
-
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
|
|
283
|
-
);
|
|
284
|
-
} else {
|
|
285
|
-
printWarning("Invalid argument supplied to oneOf, expected an array.");
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return emptyFunctionThatReturnsNull;
|
|
289
|
-
}
|
|
290
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
291
|
-
var propValue = props[propName];
|
|
292
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
293
|
-
if (is(propValue, expectedValues[i])) {
|
|
294
|
-
return null;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
298
|
-
var type = getPreciseType(value);
|
|
299
|
-
if (type === "symbol") {
|
|
300
|
-
return String(value);
|
|
301
|
-
}
|
|
302
|
-
return value;
|
|
303
|
-
});
|
|
304
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
|
|
305
|
-
}
|
|
306
|
-
return createChainableTypeChecker(validate);
|
|
307
|
-
}
|
|
308
|
-
function createObjectOfTypeChecker(typeChecker) {
|
|
309
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
310
|
-
if (typeof typeChecker !== "function") {
|
|
311
|
-
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
|
|
312
|
-
}
|
|
313
|
-
var propValue = props[propName];
|
|
314
|
-
var propType = getPropType(propValue);
|
|
315
|
-
if (propType !== "object") {
|
|
316
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
|
|
317
|
-
}
|
|
318
|
-
for (var key in propValue) {
|
|
319
|
-
if (has2(propValue, key)) {
|
|
320
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
321
|
-
if (error instanceof Error) {
|
|
322
|
-
return error;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
328
|
-
return createChainableTypeChecker(validate);
|
|
329
|
-
}
|
|
330
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
331
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
332
|
-
process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
|
|
333
|
-
return emptyFunctionThatReturnsNull;
|
|
334
|
-
}
|
|
335
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
336
|
-
var checker = arrayOfTypeCheckers[i];
|
|
337
|
-
if (typeof checker !== "function") {
|
|
338
|
-
printWarning(
|
|
339
|
-
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
|
|
340
|
-
);
|
|
341
|
-
return emptyFunctionThatReturnsNull;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
345
|
-
var expectedTypes = [];
|
|
346
|
-
for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
|
|
347
|
-
var checker2 = arrayOfTypeCheckers[i2];
|
|
348
|
-
var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
349
|
-
if (checkerResult == null) {
|
|
350
|
-
return null;
|
|
351
|
-
}
|
|
352
|
-
if (checkerResult.data && has2(checkerResult.data, "expectedType")) {
|
|
353
|
-
expectedTypes.push(checkerResult.data.expectedType);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
|
|
357
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
|
|
358
|
-
}
|
|
359
|
-
return createChainableTypeChecker(validate);
|
|
360
|
-
}
|
|
361
|
-
function createNodeChecker() {
|
|
362
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
363
|
-
if (!isNode(props[propName])) {
|
|
364
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
|
|
365
|
-
}
|
|
366
|
-
return null;
|
|
367
|
-
}
|
|
368
|
-
return createChainableTypeChecker(validate);
|
|
369
|
-
}
|
|
370
|
-
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
371
|
-
return new PropTypeError(
|
|
372
|
-
(componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
|
|
373
|
-
);
|
|
374
|
-
}
|
|
375
|
-
function createShapeTypeChecker(shapeTypes) {
|
|
376
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
377
|
-
var propValue = props[propName];
|
|
378
|
-
var propType = getPropType(propValue);
|
|
379
|
-
if (propType !== "object") {
|
|
380
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
381
|
-
}
|
|
382
|
-
for (var key in shapeTypes) {
|
|
383
|
-
var checker = shapeTypes[key];
|
|
384
|
-
if (typeof checker !== "function") {
|
|
385
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
386
|
-
}
|
|
387
|
-
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
388
|
-
if (error) {
|
|
389
|
-
return error;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
return null;
|
|
393
|
-
}
|
|
394
|
-
return createChainableTypeChecker(validate);
|
|
395
|
-
}
|
|
396
|
-
function createStrictShapeTypeChecker(shapeTypes) {
|
|
397
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
398
|
-
var propValue = props[propName];
|
|
399
|
-
var propType = getPropType(propValue);
|
|
400
|
-
if (propType !== "object") {
|
|
401
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
402
|
-
}
|
|
403
|
-
var allKeys = assign({}, props[propName], shapeTypes);
|
|
404
|
-
for (var key in allKeys) {
|
|
405
|
-
var checker = shapeTypes[key];
|
|
406
|
-
if (has2(shapeTypes, key) && typeof checker !== "function") {
|
|
407
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
408
|
-
}
|
|
409
|
-
if (!checker) {
|
|
410
|
-
return new PropTypeError(
|
|
411
|
-
"Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
415
|
-
if (error) {
|
|
416
|
-
return error;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
return createChainableTypeChecker(validate);
|
|
422
|
-
}
|
|
423
|
-
function isNode(propValue) {
|
|
424
|
-
switch (typeof propValue) {
|
|
425
|
-
case "number":
|
|
426
|
-
case "string":
|
|
427
|
-
case "undefined":
|
|
428
|
-
return true;
|
|
429
|
-
case "boolean":
|
|
430
|
-
return !propValue;
|
|
431
|
-
case "object":
|
|
432
|
-
if (Array.isArray(propValue)) {
|
|
433
|
-
return propValue.every(isNode);
|
|
434
|
-
}
|
|
435
|
-
if (propValue === null || isValidElement(propValue)) {
|
|
436
|
-
return true;
|
|
437
|
-
}
|
|
438
|
-
var iteratorFn = getIteratorFn(propValue);
|
|
439
|
-
if (iteratorFn) {
|
|
440
|
-
var iterator = iteratorFn.call(propValue);
|
|
441
|
-
var step;
|
|
442
|
-
if (iteratorFn !== propValue.entries) {
|
|
443
|
-
while (!(step = iterator.next()).done) {
|
|
444
|
-
if (!isNode(step.value)) {
|
|
445
|
-
return false;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
} else {
|
|
449
|
-
while (!(step = iterator.next()).done) {
|
|
450
|
-
var entry = step.value;
|
|
451
|
-
if (entry) {
|
|
452
|
-
if (!isNode(entry[1])) {
|
|
453
|
-
return false;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
} else {
|
|
459
|
-
return false;
|
|
460
|
-
}
|
|
461
|
-
return true;
|
|
462
|
-
default:
|
|
463
|
-
return false;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
function isSymbol(propType, propValue) {
|
|
467
|
-
if (propType === "symbol") {
|
|
468
|
-
return true;
|
|
469
|
-
}
|
|
470
|
-
if (!propValue) {
|
|
471
|
-
return false;
|
|
472
|
-
}
|
|
473
|
-
if (propValue["@@toStringTag"] === "Symbol") {
|
|
474
|
-
return true;
|
|
475
|
-
}
|
|
476
|
-
if (typeof Symbol === "function" && propValue instanceof Symbol) {
|
|
477
|
-
return true;
|
|
478
|
-
}
|
|
479
|
-
return false;
|
|
480
|
-
}
|
|
481
|
-
function getPropType(propValue) {
|
|
482
|
-
var propType = typeof propValue;
|
|
483
|
-
if (Array.isArray(propValue)) {
|
|
484
|
-
return "array";
|
|
485
|
-
}
|
|
486
|
-
if (propValue instanceof RegExp) {
|
|
487
|
-
return "object";
|
|
488
|
-
}
|
|
489
|
-
if (isSymbol(propType, propValue)) {
|
|
490
|
-
return "symbol";
|
|
491
|
-
}
|
|
492
|
-
return propType;
|
|
493
|
-
}
|
|
494
|
-
function getPreciseType(propValue) {
|
|
495
|
-
if (typeof propValue === "undefined" || propValue === null) {
|
|
496
|
-
return "" + propValue;
|
|
497
|
-
}
|
|
498
|
-
var propType = getPropType(propValue);
|
|
499
|
-
if (propType === "object") {
|
|
500
|
-
if (propValue instanceof Date) {
|
|
501
|
-
return "date";
|
|
502
|
-
} else if (propValue instanceof RegExp) {
|
|
503
|
-
return "regexp";
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return propType;
|
|
507
|
-
}
|
|
508
|
-
function getPostfixForTypeWarning(value) {
|
|
509
|
-
var type = getPreciseType(value);
|
|
510
|
-
switch (type) {
|
|
511
|
-
case "array":
|
|
512
|
-
case "object":
|
|
513
|
-
return "an " + type;
|
|
514
|
-
case "boolean":
|
|
515
|
-
case "date":
|
|
516
|
-
case "regexp":
|
|
517
|
-
return "a " + type;
|
|
518
|
-
default:
|
|
519
|
-
return type;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
function getClassName(propValue) {
|
|
523
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
|
524
|
-
return ANONYMOUS;
|
|
525
|
-
}
|
|
526
|
-
return propValue.constructor.name;
|
|
527
|
-
}
|
|
528
|
-
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
529
|
-
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
530
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
531
|
-
return ReactPropTypes;
|
|
532
|
-
};
|
|
533
|
-
return factoryWithTypeCheckers;
|
|
534
|
-
}
|
|
535
|
-
var factoryWithThrowingShims;
|
|
536
|
-
var hasRequiredFactoryWithThrowingShims;
|
|
537
|
-
function requireFactoryWithThrowingShims() {
|
|
538
|
-
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
539
|
-
hasRequiredFactoryWithThrowingShims = 1;
|
|
540
|
-
var ReactPropTypesSecret = /* @__PURE__ */ requireReactPropTypesSecret();
|
|
541
|
-
function emptyFunction() {
|
|
542
|
-
}
|
|
543
|
-
function emptyFunctionWithReset() {
|
|
544
|
-
}
|
|
545
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
546
|
-
factoryWithThrowingShims = function() {
|
|
547
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
548
|
-
if (secret === ReactPropTypesSecret) {
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
var err = new Error(
|
|
552
|
-
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
|
|
553
|
-
);
|
|
554
|
-
err.name = "Invariant Violation";
|
|
555
|
-
throw err;
|
|
556
|
-
}
|
|
557
|
-
shim.isRequired = shim;
|
|
558
|
-
function getShim() {
|
|
559
|
-
return shim;
|
|
560
|
-
}
|
|
561
|
-
var ReactPropTypes = {
|
|
562
|
-
array: shim,
|
|
563
|
-
bigint: shim,
|
|
564
|
-
bool: shim,
|
|
565
|
-
func: shim,
|
|
566
|
-
number: shim,
|
|
567
|
-
object: shim,
|
|
568
|
-
string: shim,
|
|
569
|
-
symbol: shim,
|
|
570
|
-
any: shim,
|
|
571
|
-
arrayOf: getShim,
|
|
572
|
-
element: shim,
|
|
573
|
-
elementType: shim,
|
|
574
|
-
instanceOf: getShim,
|
|
575
|
-
node: shim,
|
|
576
|
-
objectOf: getShim,
|
|
577
|
-
oneOf: getShim,
|
|
578
|
-
oneOfType: getShim,
|
|
579
|
-
shape: getShim,
|
|
580
|
-
exact: getShim,
|
|
581
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
582
|
-
resetWarningCache: emptyFunction
|
|
583
|
-
};
|
|
584
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
585
|
-
return ReactPropTypes;
|
|
586
|
-
};
|
|
587
|
-
return factoryWithThrowingShims;
|
|
588
|
-
}
|
|
589
|
-
var hasRequiredPropTypes;
|
|
590
|
-
function requirePropTypes() {
|
|
591
|
-
if (hasRequiredPropTypes) return propTypes.exports;
|
|
592
|
-
hasRequiredPropTypes = 1;
|
|
593
|
-
if (process.env.NODE_ENV !== "production") {
|
|
594
|
-
var ReactIs = requireReactIs();
|
|
595
|
-
var throwOnDirectAccess = true;
|
|
596
|
-
propTypes.exports = /* @__PURE__ */ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
597
|
-
} else {
|
|
598
|
-
propTypes.exports = /* @__PURE__ */ requireFactoryWithThrowingShims()();
|
|
599
|
-
}
|
|
600
|
-
return propTypes.exports;
|
|
601
|
-
}
|
|
602
|
-
var flatpickr$1 = { exports: {} };
|
|
603
|
-
/* flatpickr v4.6.2, @license MIT */
|
|
604
|
-
var flatpickr = flatpickr$1.exports;
|
|
605
|
-
var hasRequiredFlatpickr;
|
|
606
|
-
function requireFlatpickr() {
|
|
607
|
-
if (hasRequiredFlatpickr) return flatpickr$1.exports;
|
|
608
|
-
hasRequiredFlatpickr = 1;
|
|
609
|
-
(function(module, exports) {
|
|
610
|
-
(function(global, factory) {
|
|
611
|
-
module.exports = factory();
|
|
612
|
-
})(flatpickr, function() {
|
|
613
|
-
/*! *****************************************************************************
|
|
614
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
615
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
616
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
617
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
618
|
-
|
|
619
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
620
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
621
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
622
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
623
|
-
|
|
624
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
625
|
-
and limitations under the License.
|
|
626
|
-
***************************************************************************** */
|
|
627
|
-
var __assign = function() {
|
|
628
|
-
__assign = Object.assign || function __assign2(t) {
|
|
629
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
630
|
-
s = arguments[i];
|
|
631
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
632
|
-
}
|
|
633
|
-
return t;
|
|
634
|
-
};
|
|
635
|
-
return __assign.apply(this, arguments);
|
|
636
|
-
};
|
|
637
|
-
var HOOKS = [
|
|
638
|
-
"onChange",
|
|
639
|
-
"onClose",
|
|
640
|
-
"onDayCreate",
|
|
641
|
-
"onDestroy",
|
|
642
|
-
"onKeyDown",
|
|
643
|
-
"onMonthChange",
|
|
644
|
-
"onOpen",
|
|
645
|
-
"onParseConfig",
|
|
646
|
-
"onReady",
|
|
647
|
-
"onValueUpdate",
|
|
648
|
-
"onYearChange",
|
|
649
|
-
"onPreCalendarPosition"
|
|
650
|
-
];
|
|
651
|
-
var defaults = {
|
|
652
|
-
_disable: [],
|
|
653
|
-
_enable: [],
|
|
654
|
-
allowInput: false,
|
|
655
|
-
altFormat: "F j, Y",
|
|
656
|
-
altInput: false,
|
|
657
|
-
altInputClass: "form-control input",
|
|
658
|
-
animate: typeof window === "object" && window.navigator.userAgent.indexOf("MSIE") === -1,
|
|
659
|
-
ariaDateFormat: "F j, Y",
|
|
660
|
-
clickOpens: true,
|
|
661
|
-
closeOnSelect: true,
|
|
662
|
-
conjunction: ", ",
|
|
663
|
-
dateFormat: "Y-m-d",
|
|
664
|
-
defaultHour: 12,
|
|
665
|
-
defaultMinute: 0,
|
|
666
|
-
defaultSeconds: 0,
|
|
667
|
-
disable: [],
|
|
668
|
-
disableMobile: false,
|
|
669
|
-
enable: [],
|
|
670
|
-
enableSeconds: false,
|
|
671
|
-
enableTime: false,
|
|
672
|
-
errorHandler: function(err) {
|
|
673
|
-
return typeof console !== "undefined" && console.warn(err);
|
|
674
|
-
},
|
|
675
|
-
getWeek: function(givenDate) {
|
|
676
|
-
var date = new Date(givenDate.getTime());
|
|
677
|
-
date.setHours(0, 0, 0, 0);
|
|
678
|
-
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
|
|
679
|
-
var week1 = new Date(date.getFullYear(), 0, 4);
|
|
680
|
-
return 1 + Math.round(((date.getTime() - week1.getTime()) / 864e5 - 3 + (week1.getDay() + 6) % 7) / 7);
|
|
681
|
-
},
|
|
682
|
-
hourIncrement: 1,
|
|
683
|
-
ignoredFocusElements: [],
|
|
684
|
-
inline: false,
|
|
685
|
-
locale: "default",
|
|
686
|
-
minuteIncrement: 5,
|
|
687
|
-
mode: "single",
|
|
688
|
-
monthSelectorType: "dropdown",
|
|
689
|
-
nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",
|
|
690
|
-
noCalendar: false,
|
|
691
|
-
now: /* @__PURE__ */ new Date(),
|
|
692
|
-
onChange: [],
|
|
693
|
-
onClose: [],
|
|
694
|
-
onDayCreate: [],
|
|
695
|
-
onDestroy: [],
|
|
696
|
-
onKeyDown: [],
|
|
697
|
-
onMonthChange: [],
|
|
698
|
-
onOpen: [],
|
|
699
|
-
onParseConfig: [],
|
|
700
|
-
onReady: [],
|
|
701
|
-
onValueUpdate: [],
|
|
702
|
-
onYearChange: [],
|
|
703
|
-
onPreCalendarPosition: [],
|
|
704
|
-
plugins: [],
|
|
705
|
-
position: "auto",
|
|
706
|
-
positionElement: void 0,
|
|
707
|
-
prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",
|
|
708
|
-
shorthandCurrentMonth: false,
|
|
709
|
-
showMonths: 1,
|
|
710
|
-
static: false,
|
|
711
|
-
time_24hr: false,
|
|
712
|
-
weekNumbers: false,
|
|
713
|
-
wrap: false
|
|
714
|
-
};
|
|
715
|
-
var english = {
|
|
716
|
-
weekdays: {
|
|
717
|
-
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
718
|
-
longhand: [
|
|
719
|
-
"Sunday",
|
|
720
|
-
"Monday",
|
|
721
|
-
"Tuesday",
|
|
722
|
-
"Wednesday",
|
|
723
|
-
"Thursday",
|
|
724
|
-
"Friday",
|
|
725
|
-
"Saturday"
|
|
726
|
-
]
|
|
727
|
-
},
|
|
728
|
-
months: {
|
|
729
|
-
shorthand: [
|
|
730
|
-
"Jan",
|
|
731
|
-
"Feb",
|
|
732
|
-
"Mar",
|
|
733
|
-
"Apr",
|
|
734
|
-
"May",
|
|
735
|
-
"Jun",
|
|
736
|
-
"Jul",
|
|
737
|
-
"Aug",
|
|
738
|
-
"Sep",
|
|
739
|
-
"Oct",
|
|
740
|
-
"Nov",
|
|
741
|
-
"Dec"
|
|
742
|
-
],
|
|
743
|
-
longhand: [
|
|
744
|
-
"January",
|
|
745
|
-
"February",
|
|
746
|
-
"March",
|
|
747
|
-
"April",
|
|
748
|
-
"May",
|
|
749
|
-
"June",
|
|
750
|
-
"July",
|
|
751
|
-
"August",
|
|
752
|
-
"September",
|
|
753
|
-
"October",
|
|
754
|
-
"November",
|
|
755
|
-
"December"
|
|
756
|
-
]
|
|
757
|
-
},
|
|
758
|
-
daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
|
759
|
-
firstDayOfWeek: 0,
|
|
760
|
-
ordinal: function(nth) {
|
|
761
|
-
var s = nth % 100;
|
|
762
|
-
if (s > 3 && s < 21)
|
|
763
|
-
return "th";
|
|
764
|
-
switch (s % 10) {
|
|
765
|
-
case 1:
|
|
766
|
-
return "st";
|
|
767
|
-
case 2:
|
|
768
|
-
return "nd";
|
|
769
|
-
case 3:
|
|
770
|
-
return "rd";
|
|
771
|
-
default:
|
|
772
|
-
return "th";
|
|
773
|
-
}
|
|
774
|
-
},
|
|
775
|
-
rangeSeparator: " to ",
|
|
776
|
-
weekAbbreviation: "Wk",
|
|
777
|
-
scrollTitle: "Scroll to increment",
|
|
778
|
-
toggleTitle: "Click to toggle",
|
|
779
|
-
amPM: ["AM", "PM"],
|
|
780
|
-
yearAriaLabel: "Year",
|
|
781
|
-
hourAriaLabel: "Hour",
|
|
782
|
-
minuteAriaLabel: "Minute",
|
|
783
|
-
time_24hr: false
|
|
784
|
-
};
|
|
785
|
-
var pad = function(number) {
|
|
786
|
-
return ("0" + number).slice(-2);
|
|
787
|
-
};
|
|
788
|
-
var int = function(bool) {
|
|
789
|
-
return bool === true ? 1 : 0;
|
|
790
|
-
};
|
|
791
|
-
function debounce(func, wait, immediate) {
|
|
792
|
-
if (immediate === void 0) {
|
|
793
|
-
immediate = false;
|
|
794
|
-
}
|
|
795
|
-
var timeout;
|
|
796
|
-
return function() {
|
|
797
|
-
var context = this, args = arguments;
|
|
798
|
-
timeout !== null && clearTimeout(timeout);
|
|
799
|
-
timeout = window.setTimeout(function() {
|
|
800
|
-
timeout = null;
|
|
801
|
-
if (!immediate)
|
|
802
|
-
func.apply(context, args);
|
|
803
|
-
}, wait);
|
|
804
|
-
if (immediate && !timeout)
|
|
805
|
-
func.apply(context, args);
|
|
806
|
-
};
|
|
807
|
-
}
|
|
808
|
-
var arrayify = function(obj) {
|
|
809
|
-
return obj instanceof Array ? obj : [obj];
|
|
810
|
-
};
|
|
811
|
-
function toggleClass(elem, className, bool) {
|
|
812
|
-
if (bool === true)
|
|
813
|
-
return elem.classList.add(className);
|
|
814
|
-
elem.classList.remove(className);
|
|
815
|
-
}
|
|
816
|
-
function createElement(tag, className, content) {
|
|
817
|
-
var e = window.document.createElement(tag);
|
|
818
|
-
className = className || "";
|
|
819
|
-
content = content || "";
|
|
820
|
-
e.className = className;
|
|
821
|
-
if (content !== void 0)
|
|
822
|
-
e.textContent = content;
|
|
823
|
-
return e;
|
|
824
|
-
}
|
|
825
|
-
function clearNode(node) {
|
|
826
|
-
while (node.firstChild)
|
|
827
|
-
node.removeChild(node.firstChild);
|
|
828
|
-
}
|
|
829
|
-
function findParent(node, condition) {
|
|
830
|
-
if (condition(node))
|
|
831
|
-
return node;
|
|
832
|
-
else if (node.parentNode)
|
|
833
|
-
return findParent(node.parentNode, condition);
|
|
834
|
-
return void 0;
|
|
835
|
-
}
|
|
836
|
-
function createNumberInput(inputClassName, opts) {
|
|
837
|
-
var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown");
|
|
838
|
-
if (navigator.userAgent.indexOf("MSIE 9.0") === -1) {
|
|
839
|
-
numInput.type = "number";
|
|
840
|
-
} else {
|
|
841
|
-
numInput.type = "text";
|
|
842
|
-
numInput.pattern = "\\d*";
|
|
843
|
-
}
|
|
844
|
-
if (opts !== void 0)
|
|
845
|
-
for (var key in opts)
|
|
846
|
-
numInput.setAttribute(key, opts[key]);
|
|
847
|
-
wrapper.appendChild(numInput);
|
|
848
|
-
wrapper.appendChild(arrowUp);
|
|
849
|
-
wrapper.appendChild(arrowDown);
|
|
850
|
-
return wrapper;
|
|
851
|
-
}
|
|
852
|
-
function getEventTarget(event) {
|
|
853
|
-
if (typeof event.composedPath === "function") {
|
|
854
|
-
var path = event.composedPath();
|
|
855
|
-
return path[0];
|
|
856
|
-
}
|
|
857
|
-
return event.target;
|
|
858
|
-
}
|
|
859
|
-
var doNothing = function() {
|
|
860
|
-
return void 0;
|
|
861
|
-
};
|
|
862
|
-
var monthToStr = function(monthNumber, shorthand, locale) {
|
|
863
|
-
return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber];
|
|
864
|
-
};
|
|
865
|
-
var revFormat = {
|
|
866
|
-
D: doNothing,
|
|
867
|
-
F: function(dateObj, monthName, locale) {
|
|
868
|
-
dateObj.setMonth(locale.months.longhand.indexOf(monthName));
|
|
869
|
-
},
|
|
870
|
-
G: function(dateObj, hour) {
|
|
871
|
-
dateObj.setHours(parseFloat(hour));
|
|
872
|
-
},
|
|
873
|
-
H: function(dateObj, hour) {
|
|
874
|
-
dateObj.setHours(parseFloat(hour));
|
|
875
|
-
},
|
|
876
|
-
J: function(dateObj, day) {
|
|
877
|
-
dateObj.setDate(parseFloat(day));
|
|
878
|
-
},
|
|
879
|
-
K: function(dateObj, amPM, locale) {
|
|
880
|
-
dateObj.setHours(dateObj.getHours() % 12 + 12 * int(new RegExp(locale.amPM[1], "i").test(amPM)));
|
|
881
|
-
},
|
|
882
|
-
M: function(dateObj, shortMonth, locale) {
|
|
883
|
-
dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth));
|
|
884
|
-
},
|
|
885
|
-
S: function(dateObj, seconds) {
|
|
886
|
-
dateObj.setSeconds(parseFloat(seconds));
|
|
887
|
-
},
|
|
888
|
-
U: function(_, unixSeconds) {
|
|
889
|
-
return new Date(parseFloat(unixSeconds) * 1e3);
|
|
890
|
-
},
|
|
891
|
-
W: function(dateObj, weekNum, locale) {
|
|
892
|
-
var weekNumber = parseInt(weekNum);
|
|
893
|
-
var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0);
|
|
894
|
-
date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek);
|
|
895
|
-
return date;
|
|
896
|
-
},
|
|
897
|
-
Y: function(dateObj, year) {
|
|
898
|
-
dateObj.setFullYear(parseFloat(year));
|
|
899
|
-
},
|
|
900
|
-
Z: function(_, ISODate) {
|
|
901
|
-
return new Date(ISODate);
|
|
902
|
-
},
|
|
903
|
-
d: function(dateObj, day) {
|
|
904
|
-
dateObj.setDate(parseFloat(day));
|
|
905
|
-
},
|
|
906
|
-
h: function(dateObj, hour) {
|
|
907
|
-
dateObj.setHours(parseFloat(hour));
|
|
908
|
-
},
|
|
909
|
-
i: function(dateObj, minutes) {
|
|
910
|
-
dateObj.setMinutes(parseFloat(minutes));
|
|
911
|
-
},
|
|
912
|
-
j: function(dateObj, day) {
|
|
913
|
-
dateObj.setDate(parseFloat(day));
|
|
914
|
-
},
|
|
915
|
-
l: doNothing,
|
|
916
|
-
m: function(dateObj, month) {
|
|
917
|
-
dateObj.setMonth(parseFloat(month) - 1);
|
|
918
|
-
},
|
|
919
|
-
n: function(dateObj, month) {
|
|
920
|
-
dateObj.setMonth(parseFloat(month) - 1);
|
|
921
|
-
},
|
|
922
|
-
s: function(dateObj, seconds) {
|
|
923
|
-
dateObj.setSeconds(parseFloat(seconds));
|
|
924
|
-
},
|
|
925
|
-
u: function(_, unixMillSeconds) {
|
|
926
|
-
return new Date(parseFloat(unixMillSeconds));
|
|
927
|
-
},
|
|
928
|
-
w: doNothing,
|
|
929
|
-
y: function(dateObj, year) {
|
|
930
|
-
dateObj.setFullYear(2e3 + parseFloat(year));
|
|
931
|
-
}
|
|
932
|
-
};
|
|
933
|
-
var tokenRegex = {
|
|
934
|
-
D: "(\\w+)",
|
|
935
|
-
F: "(\\w+)",
|
|
936
|
-
G: "(\\d\\d|\\d)",
|
|
937
|
-
H: "(\\d\\d|\\d)",
|
|
938
|
-
J: "(\\d\\d|\\d)\\w+",
|
|
939
|
-
K: "",
|
|
940
|
-
M: "(\\w+)",
|
|
941
|
-
S: "(\\d\\d|\\d)",
|
|
942
|
-
U: "(.+)",
|
|
943
|
-
W: "(\\d\\d|\\d)",
|
|
944
|
-
Y: "(\\d{4})",
|
|
945
|
-
Z: "(.+)",
|
|
946
|
-
d: "(\\d\\d|\\d)",
|
|
947
|
-
h: "(\\d\\d|\\d)",
|
|
948
|
-
i: "(\\d\\d|\\d)",
|
|
949
|
-
j: "(\\d\\d|\\d)",
|
|
950
|
-
l: "(\\w+)",
|
|
951
|
-
m: "(\\d\\d|\\d)",
|
|
952
|
-
n: "(\\d\\d|\\d)",
|
|
953
|
-
s: "(\\d\\d|\\d)",
|
|
954
|
-
u: "(.+)",
|
|
955
|
-
w: "(\\d\\d|\\d)",
|
|
956
|
-
y: "(\\d{2})"
|
|
957
|
-
};
|
|
958
|
-
var formats = {
|
|
959
|
-
// get the date in UTC
|
|
960
|
-
Z: function(date) {
|
|
961
|
-
return date.toISOString();
|
|
962
|
-
},
|
|
963
|
-
// weekday name, short, e.g. Thu
|
|
964
|
-
D: function(date, locale, options) {
|
|
965
|
-
return locale.weekdays.shorthand[formats.w(date, locale, options)];
|
|
966
|
-
},
|
|
967
|
-
// full month name e.g. January
|
|
968
|
-
F: function(date, locale, options) {
|
|
969
|
-
return monthToStr(formats.n(date, locale, options) - 1, false, locale);
|
|
970
|
-
},
|
|
971
|
-
// padded hour 1-12
|
|
972
|
-
G: function(date, locale, options) {
|
|
973
|
-
return pad(formats.h(date, locale, options));
|
|
974
|
-
},
|
|
975
|
-
// hours with leading zero e.g. 03
|
|
976
|
-
H: function(date) {
|
|
977
|
-
return pad(date.getHours());
|
|
978
|
-
},
|
|
979
|
-
// day (1-30) with ordinal suffix e.g. 1st, 2nd
|
|
980
|
-
J: function(date, locale) {
|
|
981
|
-
return locale.ordinal !== void 0 ? date.getDate() + locale.ordinal(date.getDate()) : date.getDate();
|
|
982
|
-
},
|
|
983
|
-
// AM/PM
|
|
984
|
-
K: function(date, locale) {
|
|
985
|
-
return locale.amPM[int(date.getHours() > 11)];
|
|
986
|
-
},
|
|
987
|
-
// shorthand month e.g. Jan, Sep, Oct, etc
|
|
988
|
-
M: function(date, locale) {
|
|
989
|
-
return monthToStr(date.getMonth(), true, locale);
|
|
990
|
-
},
|
|
991
|
-
// seconds 00-59
|
|
992
|
-
S: function(date) {
|
|
993
|
-
return pad(date.getSeconds());
|
|
994
|
-
},
|
|
995
|
-
// unix timestamp
|
|
996
|
-
U: function(date) {
|
|
997
|
-
return date.getTime() / 1e3;
|
|
998
|
-
},
|
|
999
|
-
W: function(date, _, options) {
|
|
1000
|
-
return options.getWeek(date);
|
|
1001
|
-
},
|
|
1002
|
-
// full year e.g. 2016
|
|
1003
|
-
Y: function(date) {
|
|
1004
|
-
return date.getFullYear();
|
|
1005
|
-
},
|
|
1006
|
-
// day in month, padded (01-30)
|
|
1007
|
-
d: function(date) {
|
|
1008
|
-
return pad(date.getDate());
|
|
1009
|
-
},
|
|
1010
|
-
// hour from 1-12 (am/pm)
|
|
1011
|
-
h: function(date) {
|
|
1012
|
-
return date.getHours() % 12 ? date.getHours() % 12 : 12;
|
|
1013
|
-
},
|
|
1014
|
-
// minutes, padded with leading zero e.g. 09
|
|
1015
|
-
i: function(date) {
|
|
1016
|
-
return pad(date.getMinutes());
|
|
1017
|
-
},
|
|
1018
|
-
// day in month (1-30)
|
|
1019
|
-
j: function(date) {
|
|
1020
|
-
return date.getDate();
|
|
1021
|
-
},
|
|
1022
|
-
// weekday name, full, e.g. Thursday
|
|
1023
|
-
l: function(date, locale) {
|
|
1024
|
-
return locale.weekdays.longhand[date.getDay()];
|
|
1025
|
-
},
|
|
1026
|
-
// padded month number (01-12)
|
|
1027
|
-
m: function(date) {
|
|
1028
|
-
return pad(date.getMonth() + 1);
|
|
1029
|
-
},
|
|
1030
|
-
// the month number (1-12)
|
|
1031
|
-
n: function(date) {
|
|
1032
|
-
return date.getMonth() + 1;
|
|
1033
|
-
},
|
|
1034
|
-
// seconds 0-59
|
|
1035
|
-
s: function(date) {
|
|
1036
|
-
return date.getSeconds();
|
|
1037
|
-
},
|
|
1038
|
-
// Unix Milliseconds
|
|
1039
|
-
u: function(date) {
|
|
1040
|
-
return date.getTime();
|
|
1041
|
-
},
|
|
1042
|
-
// number of the day of the week
|
|
1043
|
-
w: function(date) {
|
|
1044
|
-
return date.getDay();
|
|
1045
|
-
},
|
|
1046
|
-
// last two digits of year e.g. 16 for 2016
|
|
1047
|
-
y: function(date) {
|
|
1048
|
-
return String(date.getFullYear()).substring(2);
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
var createDateFormatter = function(_a) {
|
|
1052
|
-
var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
|
|
1053
|
-
return function(dateObj, frmt, overrideLocale) {
|
|
1054
|
-
var locale = overrideLocale || l10n;
|
|
1055
|
-
if (config.formatDate !== void 0) {
|
|
1056
|
-
return config.formatDate(dateObj, frmt, locale);
|
|
1057
|
-
}
|
|
1058
|
-
return frmt.split("").map(function(c, i, arr) {
|
|
1059
|
-
return formats[c] && arr[i - 1] !== "\\" ? formats[c](dateObj, locale, config) : c !== "\\" ? c : "";
|
|
1060
|
-
}).join("");
|
|
1061
|
-
};
|
|
1062
|
-
};
|
|
1063
|
-
var createDateParser = function(_a) {
|
|
1064
|
-
var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c;
|
|
1065
|
-
return function(date, givenFormat, timeless, customLocale) {
|
|
1066
|
-
if (date !== 0 && !date)
|
|
1067
|
-
return void 0;
|
|
1068
|
-
var locale = customLocale || l10n;
|
|
1069
|
-
var parsedDate;
|
|
1070
|
-
var dateOrig = date;
|
|
1071
|
-
if (date instanceof Date)
|
|
1072
|
-
parsedDate = new Date(date.getTime());
|
|
1073
|
-
else if (typeof date !== "string" && date.toFixed !== void 0)
|
|
1074
|
-
parsedDate = new Date(date);
|
|
1075
|
-
else if (typeof date === "string") {
|
|
1076
|
-
var format = givenFormat || (config || defaults).dateFormat;
|
|
1077
|
-
var datestr = String(date).trim();
|
|
1078
|
-
if (datestr === "today") {
|
|
1079
|
-
parsedDate = /* @__PURE__ */ new Date();
|
|
1080
|
-
timeless = true;
|
|
1081
|
-
} else if (/Z$/.test(datestr) || /GMT$/.test(datestr))
|
|
1082
|
-
parsedDate = new Date(date);
|
|
1083
|
-
else if (config && config.parseDate)
|
|
1084
|
-
parsedDate = config.parseDate(date, format);
|
|
1085
|
-
else {
|
|
1086
|
-
parsedDate = !config || !config.noCalendar ? new Date((/* @__PURE__ */ new Date()).getFullYear(), 0, 1, 0, 0, 0, 0) : new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0));
|
|
1087
|
-
var matched = void 0, ops = [];
|
|
1088
|
-
for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
|
|
1089
|
-
var token_1 = format[i];
|
|
1090
|
-
var isBackSlash = token_1 === "\\";
|
|
1091
|
-
var escaped = format[i - 1] === "\\" || isBackSlash;
|
|
1092
|
-
if (tokenRegex[token_1] && !escaped) {
|
|
1093
|
-
regexStr += tokenRegex[token_1];
|
|
1094
|
-
var match = new RegExp(regexStr).exec(date);
|
|
1095
|
-
if (match && (matched = true)) {
|
|
1096
|
-
ops[token_1 !== "Y" ? "push" : "unshift"]({
|
|
1097
|
-
fn: revFormat[token_1],
|
|
1098
|
-
val: match[++matchIndex]
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
} else if (!isBackSlash)
|
|
1102
|
-
regexStr += ".";
|
|
1103
|
-
ops.forEach(function(_a2) {
|
|
1104
|
-
var fn = _a2.fn, val = _a2.val;
|
|
1105
|
-
return parsedDate = fn(parsedDate, val, locale) || parsedDate;
|
|
1106
|
-
});
|
|
1107
|
-
}
|
|
1108
|
-
parsedDate = matched ? parsedDate : void 0;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) {
|
|
1112
|
-
config.errorHandler(new Error("Invalid date provided: " + dateOrig));
|
|
1113
|
-
return void 0;
|
|
1114
|
-
}
|
|
1115
|
-
if (timeless === true)
|
|
1116
|
-
parsedDate.setHours(0, 0, 0, 0);
|
|
1117
|
-
return parsedDate;
|
|
1118
|
-
};
|
|
1119
|
-
};
|
|
1120
|
-
function compareDates(date1, date2, timeless) {
|
|
1121
|
-
if (timeless === void 0) {
|
|
1122
|
-
timeless = true;
|
|
1123
|
-
}
|
|
1124
|
-
if (timeless !== false) {
|
|
1125
|
-
return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0);
|
|
1126
|
-
}
|
|
1127
|
-
return date1.getTime() - date2.getTime();
|
|
1128
|
-
}
|
|
1129
|
-
var isBetween = function(ts, ts1, ts2) {
|
|
1130
|
-
return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
|
|
1131
|
-
};
|
|
1132
|
-
var duration = {
|
|
1133
|
-
DAY: 864e5
|
|
1134
|
-
};
|
|
1135
|
-
if (typeof Object.assign !== "function") {
|
|
1136
|
-
Object.assign = function(target) {
|
|
1137
|
-
var args = [];
|
|
1138
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1139
|
-
args[_i - 1] = arguments[_i];
|
|
1140
|
-
}
|
|
1141
|
-
if (!target) {
|
|
1142
|
-
throw TypeError("Cannot convert undefined or null to object");
|
|
1143
|
-
}
|
|
1144
|
-
var _loop_1 = function(source2) {
|
|
1145
|
-
if (source2) {
|
|
1146
|
-
Object.keys(source2).forEach(function(key) {
|
|
1147
|
-
return target[key] = source2[key];
|
|
1148
|
-
});
|
|
1149
|
-
}
|
|
1150
|
-
};
|
|
1151
|
-
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
|
|
1152
|
-
var source = args_1[_a];
|
|
1153
|
-
_loop_1(source);
|
|
1154
|
-
}
|
|
1155
|
-
return target;
|
|
1156
|
-
};
|
|
1157
|
-
}
|
|
1158
|
-
var DEBOUNCED_CHANGE_MS = 300;
|
|
1159
|
-
function FlatpickrInstance(element, instanceConfig) {
|
|
1160
|
-
var self = {
|
|
1161
|
-
config: __assign({}, defaults, flatpickr2.defaultConfig),
|
|
1162
|
-
l10n: english
|
|
1163
|
-
};
|
|
1164
|
-
self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
|
|
1165
|
-
self._handlers = [];
|
|
1166
|
-
self.pluginElements = [];
|
|
1167
|
-
self.loadedPlugins = [];
|
|
1168
|
-
self._bind = bind;
|
|
1169
|
-
self._setHoursFromDate = setHoursFromDate;
|
|
1170
|
-
self._positionCalendar = positionCalendar;
|
|
1171
|
-
self.changeMonth = changeMonth;
|
|
1172
|
-
self.changeYear = changeYear;
|
|
1173
|
-
self.clear = clear;
|
|
1174
|
-
self.close = close;
|
|
1175
|
-
self._createElement = createElement;
|
|
1176
|
-
self.destroy = destroy;
|
|
1177
|
-
self.isEnabled = isEnabled;
|
|
1178
|
-
self.jumpToDate = jumpToDate;
|
|
1179
|
-
self.open = open;
|
|
1180
|
-
self.redraw = redraw;
|
|
1181
|
-
self.set = set;
|
|
1182
|
-
self.setDate = setDate;
|
|
1183
|
-
self.toggle = toggle;
|
|
1184
|
-
function setupHelperFunctions() {
|
|
1185
|
-
self.utils = {
|
|
1186
|
-
getDaysInMonth: function(month, yr) {
|
|
1187
|
-
if (month === void 0) {
|
|
1188
|
-
month = self.currentMonth;
|
|
1189
|
-
}
|
|
1190
|
-
if (yr === void 0) {
|
|
1191
|
-
yr = self.currentYear;
|
|
1192
|
-
}
|
|
1193
|
-
if (month === 1 && (yr % 4 === 0 && yr % 100 !== 0 || yr % 400 === 0))
|
|
1194
|
-
return 29;
|
|
1195
|
-
return self.l10n.daysInMonth[month];
|
|
1196
|
-
}
|
|
1197
|
-
};
|
|
1198
|
-
}
|
|
1199
|
-
function init() {
|
|
1200
|
-
self.element = self.input = element;
|
|
1201
|
-
self.isOpen = false;
|
|
1202
|
-
parseConfig();
|
|
1203
|
-
setupLocale();
|
|
1204
|
-
setupInputs();
|
|
1205
|
-
setupDates();
|
|
1206
|
-
setupHelperFunctions();
|
|
1207
|
-
if (!self.isMobile)
|
|
1208
|
-
build2();
|
|
1209
|
-
bindEvents();
|
|
1210
|
-
if (self.selectedDates.length || self.config.noCalendar) {
|
|
1211
|
-
if (self.config.enableTime) {
|
|
1212
|
-
setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj || self.config.minDate : void 0);
|
|
1213
|
-
}
|
|
1214
|
-
updateValue(false);
|
|
1215
|
-
}
|
|
1216
|
-
setCalendarWidth();
|
|
1217
|
-
self.showTimeInput = self.selectedDates.length > 0 || self.config.noCalendar;
|
|
1218
|
-
var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
1219
|
-
if (!self.isMobile && isSafari) {
|
|
1220
|
-
positionCalendar();
|
|
1221
|
-
}
|
|
1222
|
-
triggerEvent("onReady");
|
|
1223
|
-
}
|
|
1224
|
-
function bindToInstance(fn) {
|
|
1225
|
-
return fn.bind(self);
|
|
1226
|
-
}
|
|
1227
|
-
function setCalendarWidth() {
|
|
1228
|
-
var config = self.config;
|
|
1229
|
-
if (config.weekNumbers === false && config.showMonths === 1)
|
|
1230
|
-
return;
|
|
1231
|
-
else if (config.noCalendar !== true) {
|
|
1232
|
-
window.requestAnimationFrame(function() {
|
|
1233
|
-
if (self.calendarContainer !== void 0) {
|
|
1234
|
-
self.calendarContainer.style.visibility = "hidden";
|
|
1235
|
-
self.calendarContainer.style.display = "block";
|
|
1236
|
-
}
|
|
1237
|
-
if (self.daysContainer !== void 0) {
|
|
1238
|
-
var daysWidth = (self.days.offsetWidth + 1) * config.showMonths;
|
|
1239
|
-
self.daysContainer.style.width = daysWidth + "px";
|
|
1240
|
-
self.calendarContainer.style.width = daysWidth + (self.weekWrapper !== void 0 ? self.weekWrapper.offsetWidth : 0) + "px";
|
|
1241
|
-
self.calendarContainer.style.removeProperty("visibility");
|
|
1242
|
-
self.calendarContainer.style.removeProperty("display");
|
|
1243
|
-
}
|
|
1244
|
-
});
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
function updateTime(e) {
|
|
1248
|
-
if (self.selectedDates.length === 0) {
|
|
1249
|
-
setDefaultTime();
|
|
1250
|
-
}
|
|
1251
|
-
if (e !== void 0 && e.type !== "blur") {
|
|
1252
|
-
timeWrapper(e);
|
|
1253
|
-
}
|
|
1254
|
-
var prevValue = self._input.value;
|
|
1255
|
-
setHoursFromInputs();
|
|
1256
|
-
updateValue();
|
|
1257
|
-
if (self._input.value !== prevValue) {
|
|
1258
|
-
self._debouncedChange();
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
function ampm2military(hour, amPM) {
|
|
1262
|
-
return hour % 12 + 12 * int(amPM === self.l10n.amPM[1]);
|
|
1263
|
-
}
|
|
1264
|
-
function military2ampm(hour) {
|
|
1265
|
-
switch (hour % 24) {
|
|
1266
|
-
case 0:
|
|
1267
|
-
case 12:
|
|
1268
|
-
return 12;
|
|
1269
|
-
default:
|
|
1270
|
-
return hour % 12;
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
function setHoursFromInputs() {
|
|
1274
|
-
if (self.hourElement === void 0 || self.minuteElement === void 0)
|
|
1275
|
-
return;
|
|
1276
|
-
var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== void 0 ? (parseInt(self.secondElement.value, 10) || 0) % 60 : 0;
|
|
1277
|
-
if (self.amPM !== void 0) {
|
|
1278
|
-
hours = ampm2military(hours, self.amPM.textContent);
|
|
1279
|
-
}
|
|
1280
|
-
var limitMinHours = self.config.minTime !== void 0 || self.config.minDate && self.minDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.minDate, true) === 0;
|
|
1281
|
-
var limitMaxHours = self.config.maxTime !== void 0 || self.config.maxDate && self.maxDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.maxDate, true) === 0;
|
|
1282
|
-
if (limitMaxHours) {
|
|
1283
|
-
var maxTime = self.config.maxTime !== void 0 ? self.config.maxTime : self.config.maxDate;
|
|
1284
|
-
hours = Math.min(hours, maxTime.getHours());
|
|
1285
|
-
if (hours === maxTime.getHours())
|
|
1286
|
-
minutes = Math.min(minutes, maxTime.getMinutes());
|
|
1287
|
-
if (minutes === maxTime.getMinutes())
|
|
1288
|
-
seconds = Math.min(seconds, maxTime.getSeconds());
|
|
1289
|
-
}
|
|
1290
|
-
if (limitMinHours) {
|
|
1291
|
-
var minTime = self.config.minTime !== void 0 ? self.config.minTime : self.config.minDate;
|
|
1292
|
-
hours = Math.max(hours, minTime.getHours());
|
|
1293
|
-
if (hours === minTime.getHours())
|
|
1294
|
-
minutes = Math.max(minutes, minTime.getMinutes());
|
|
1295
|
-
if (minutes === minTime.getMinutes())
|
|
1296
|
-
seconds = Math.max(seconds, minTime.getSeconds());
|
|
1297
|
-
}
|
|
1298
|
-
setHours(hours, minutes, seconds);
|
|
1299
|
-
}
|
|
1300
|
-
function setHoursFromDate(dateObj) {
|
|
1301
|
-
var date = dateObj || self.latestSelectedDateObj;
|
|
1302
|
-
if (date)
|
|
1303
|
-
setHours(date.getHours(), date.getMinutes(), date.getSeconds());
|
|
1304
|
-
}
|
|
1305
|
-
function setDefaultHours() {
|
|
1306
|
-
var hours = self.config.defaultHour;
|
|
1307
|
-
var minutes = self.config.defaultMinute;
|
|
1308
|
-
var seconds = self.config.defaultSeconds;
|
|
1309
|
-
if (self.config.minDate !== void 0) {
|
|
1310
|
-
var minHr = self.config.minDate.getHours();
|
|
1311
|
-
var minMinutes = self.config.minDate.getMinutes();
|
|
1312
|
-
hours = Math.max(hours, minHr);
|
|
1313
|
-
if (hours === minHr)
|
|
1314
|
-
minutes = Math.max(minMinutes, minutes);
|
|
1315
|
-
if (hours === minHr && minutes === minMinutes)
|
|
1316
|
-
seconds = self.config.minDate.getSeconds();
|
|
1317
|
-
}
|
|
1318
|
-
if (self.config.maxDate !== void 0) {
|
|
1319
|
-
var maxHr = self.config.maxDate.getHours();
|
|
1320
|
-
var maxMinutes = self.config.maxDate.getMinutes();
|
|
1321
|
-
hours = Math.min(hours, maxHr);
|
|
1322
|
-
if (hours === maxHr)
|
|
1323
|
-
minutes = Math.min(maxMinutes, minutes);
|
|
1324
|
-
if (hours === maxHr && minutes === maxMinutes)
|
|
1325
|
-
seconds = self.config.maxDate.getSeconds();
|
|
1326
|
-
}
|
|
1327
|
-
setHours(hours, minutes, seconds);
|
|
1328
|
-
}
|
|
1329
|
-
function setHours(hours, minutes, seconds) {
|
|
1330
|
-
if (self.latestSelectedDateObj !== void 0) {
|
|
1331
|
-
self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0);
|
|
1332
|
-
}
|
|
1333
|
-
if (!self.hourElement || !self.minuteElement || self.isMobile)
|
|
1334
|
-
return;
|
|
1335
|
-
self.hourElement.value = pad(!self.config.time_24hr ? (12 + hours) % 12 + 12 * int(hours % 12 === 0) : hours);
|
|
1336
|
-
self.minuteElement.value = pad(minutes);
|
|
1337
|
-
if (self.amPM !== void 0)
|
|
1338
|
-
self.amPM.textContent = self.l10n.amPM[int(hours >= 12)];
|
|
1339
|
-
if (self.secondElement !== void 0)
|
|
1340
|
-
self.secondElement.value = pad(seconds);
|
|
1341
|
-
}
|
|
1342
|
-
function onYearInput(event) {
|
|
1343
|
-
var year = parseInt(event.target.value) + (event.delta || 0);
|
|
1344
|
-
if (year / 1e3 > 1 || event.key === "Enter" && !/[^\d]/.test(year.toString())) {
|
|
1345
|
-
changeYear(year);
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
function bind(element2, event, handler, options) {
|
|
1349
|
-
if (event instanceof Array)
|
|
1350
|
-
return event.forEach(function(ev) {
|
|
1351
|
-
return bind(element2, ev, handler, options);
|
|
1352
|
-
});
|
|
1353
|
-
if (element2 instanceof Array)
|
|
1354
|
-
return element2.forEach(function(el) {
|
|
1355
|
-
return bind(el, event, handler, options);
|
|
1356
|
-
});
|
|
1357
|
-
element2.addEventListener(event, handler, options);
|
|
1358
|
-
self._handlers.push({
|
|
1359
|
-
element: element2,
|
|
1360
|
-
event,
|
|
1361
|
-
handler,
|
|
1362
|
-
options
|
|
1363
|
-
});
|
|
1364
|
-
}
|
|
1365
|
-
function onClick(handler) {
|
|
1366
|
-
return function(evt) {
|
|
1367
|
-
evt.which === 1 && handler(evt);
|
|
1368
|
-
};
|
|
1369
|
-
}
|
|
1370
|
-
function triggerChange() {
|
|
1371
|
-
triggerEvent("onChange");
|
|
1372
|
-
}
|
|
1373
|
-
function bindEvents() {
|
|
1374
|
-
if (self.config.wrap) {
|
|
1375
|
-
["open", "close", "toggle", "clear"].forEach(function(evt) {
|
|
1376
|
-
Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function(el) {
|
|
1377
|
-
return bind(el, "click", self[evt]);
|
|
1378
|
-
});
|
|
1379
|
-
});
|
|
1380
|
-
}
|
|
1381
|
-
if (self.isMobile) {
|
|
1382
|
-
setupMobile();
|
|
1383
|
-
return;
|
|
1384
|
-
}
|
|
1385
|
-
var debouncedResize = debounce(onResize, 50);
|
|
1386
|
-
self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS);
|
|
1387
|
-
if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent))
|
|
1388
|
-
bind(self.daysContainer, "mouseover", function(e) {
|
|
1389
|
-
if (self.config.mode === "range")
|
|
1390
|
-
onMouseOver(e.target);
|
|
1391
|
-
});
|
|
1392
|
-
bind(window.document.body, "keydown", onKeyDown);
|
|
1393
|
-
if (!self.config.inline && !self.config.static)
|
|
1394
|
-
bind(window, "resize", debouncedResize);
|
|
1395
|
-
if (window.ontouchstart !== void 0)
|
|
1396
|
-
bind(window.document, "touchstart", documentClick);
|
|
1397
|
-
else
|
|
1398
|
-
bind(window.document, "mousedown", onClick(documentClick));
|
|
1399
|
-
bind(window.document, "focus", documentClick, { capture: true });
|
|
1400
|
-
if (self.config.clickOpens === true) {
|
|
1401
|
-
bind(self._input, "focus", self.open);
|
|
1402
|
-
bind(self._input, "mousedown", onClick(self.open));
|
|
1403
|
-
}
|
|
1404
|
-
if (self.daysContainer !== void 0) {
|
|
1405
|
-
bind(self.monthNav, "mousedown", onClick(onMonthNavClick));
|
|
1406
|
-
bind(self.monthNav, ["keyup", "increment"], onYearInput);
|
|
1407
|
-
bind(self.daysContainer, "mousedown", onClick(selectDate));
|
|
1408
|
-
}
|
|
1409
|
-
if (self.timeContainer !== void 0 && self.minuteElement !== void 0 && self.hourElement !== void 0) {
|
|
1410
|
-
var selText = function(e) {
|
|
1411
|
-
return e.target.select();
|
|
1412
|
-
};
|
|
1413
|
-
bind(self.timeContainer, ["increment"], updateTime);
|
|
1414
|
-
bind(self.timeContainer, "blur", updateTime, { capture: true });
|
|
1415
|
-
bind(self.timeContainer, "mousedown", onClick(timeIncrement));
|
|
1416
|
-
bind([self.hourElement, self.minuteElement], ["focus", "click"], selText);
|
|
1417
|
-
if (self.secondElement !== void 0)
|
|
1418
|
-
bind(self.secondElement, "focus", function() {
|
|
1419
|
-
return self.secondElement && self.secondElement.select();
|
|
1420
|
-
});
|
|
1421
|
-
if (self.amPM !== void 0) {
|
|
1422
|
-
bind(self.amPM, "mousedown", onClick(function(e) {
|
|
1423
|
-
updateTime(e);
|
|
1424
|
-
triggerChange();
|
|
1425
|
-
}));
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
function jumpToDate(jumpDate, triggerChange2) {
|
|
1430
|
-
var jumpTo = jumpDate !== void 0 ? self.parseDate(jumpDate) : self.latestSelectedDateObj || (self.config.minDate && self.config.minDate > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate < self.now ? self.config.maxDate : self.now);
|
|
1431
|
-
var oldYear = self.currentYear;
|
|
1432
|
-
var oldMonth = self.currentMonth;
|
|
1433
|
-
try {
|
|
1434
|
-
if (jumpTo !== void 0) {
|
|
1435
|
-
self.currentYear = jumpTo.getFullYear();
|
|
1436
|
-
self.currentMonth = jumpTo.getMonth();
|
|
1437
|
-
}
|
|
1438
|
-
} catch (e) {
|
|
1439
|
-
e.message = "Invalid date supplied: " + jumpTo;
|
|
1440
|
-
self.config.errorHandler(e);
|
|
1441
|
-
}
|
|
1442
|
-
if (triggerChange2 && self.currentYear !== oldYear) {
|
|
1443
|
-
triggerEvent("onYearChange");
|
|
1444
|
-
buildMonthSwitch();
|
|
1445
|
-
}
|
|
1446
|
-
if (triggerChange2 && (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) {
|
|
1447
|
-
triggerEvent("onMonthChange");
|
|
1448
|
-
}
|
|
1449
|
-
self.redraw();
|
|
1450
|
-
}
|
|
1451
|
-
function timeIncrement(e) {
|
|
1452
|
-
if (~e.target.className.indexOf("arrow"))
|
|
1453
|
-
incrementNumInput(e, e.target.classList.contains("arrowUp") ? 1 : -1);
|
|
1454
|
-
}
|
|
1455
|
-
function incrementNumInput(e, delta, inputElem) {
|
|
1456
|
-
var target = e && e.target;
|
|
1457
|
-
var input2 = inputElem || target && target.parentNode && target.parentNode.firstChild;
|
|
1458
|
-
var event = createEvent("increment");
|
|
1459
|
-
event.delta = delta;
|
|
1460
|
-
input2 && input2.dispatchEvent(event);
|
|
1461
|
-
}
|
|
1462
|
-
function build2() {
|
|
1463
|
-
var fragment = window.document.createDocumentFragment();
|
|
1464
|
-
self.calendarContainer = createElement("div", "flatpickr-calendar");
|
|
1465
|
-
self.calendarContainer.tabIndex = -1;
|
|
1466
|
-
if (!self.config.noCalendar) {
|
|
1467
|
-
fragment.appendChild(buildMonthNav());
|
|
1468
|
-
self.innerContainer = createElement("div", "flatpickr-innerContainer");
|
|
1469
|
-
if (self.config.weekNumbers) {
|
|
1470
|
-
var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers;
|
|
1471
|
-
self.innerContainer.appendChild(weekWrapper);
|
|
1472
|
-
self.weekNumbers = weekNumbers;
|
|
1473
|
-
self.weekWrapper = weekWrapper;
|
|
1474
|
-
}
|
|
1475
|
-
self.rContainer = createElement("div", "flatpickr-rContainer");
|
|
1476
|
-
self.rContainer.appendChild(buildWeekdays());
|
|
1477
|
-
if (!self.daysContainer) {
|
|
1478
|
-
self.daysContainer = createElement("div", "flatpickr-days");
|
|
1479
|
-
self.daysContainer.tabIndex = -1;
|
|
1480
|
-
}
|
|
1481
|
-
buildDays();
|
|
1482
|
-
self.rContainer.appendChild(self.daysContainer);
|
|
1483
|
-
self.innerContainer.appendChild(self.rContainer);
|
|
1484
|
-
fragment.appendChild(self.innerContainer);
|
|
1485
|
-
}
|
|
1486
|
-
if (self.config.enableTime) {
|
|
1487
|
-
fragment.appendChild(buildTime());
|
|
1488
|
-
}
|
|
1489
|
-
toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range");
|
|
1490
|
-
toggleClass(self.calendarContainer, "animate", self.config.animate === true);
|
|
1491
|
-
toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1);
|
|
1492
|
-
self.calendarContainer.appendChild(fragment);
|
|
1493
|
-
var customAppend = self.config.appendTo !== void 0 && self.config.appendTo.nodeType !== void 0;
|
|
1494
|
-
if (self.config.inline || self.config.static) {
|
|
1495
|
-
self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
|
|
1496
|
-
if (self.config.inline) {
|
|
1497
|
-
if (!customAppend && self.element.parentNode)
|
|
1498
|
-
self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling);
|
|
1499
|
-
else if (self.config.appendTo !== void 0)
|
|
1500
|
-
self.config.appendTo.appendChild(self.calendarContainer);
|
|
1501
|
-
}
|
|
1502
|
-
if (self.config.static) {
|
|
1503
|
-
var wrapper = createElement("div", "flatpickr-wrapper");
|
|
1504
|
-
if (self.element.parentNode)
|
|
1505
|
-
self.element.parentNode.insertBefore(wrapper, self.element);
|
|
1506
|
-
wrapper.appendChild(self.element);
|
|
1507
|
-
if (self.altInput)
|
|
1508
|
-
wrapper.appendChild(self.altInput);
|
|
1509
|
-
wrapper.appendChild(self.calendarContainer);
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
if (!self.config.static && !self.config.inline)
|
|
1513
|
-
(self.config.appendTo !== void 0 ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer);
|
|
1514
|
-
}
|
|
1515
|
-
function createDay(className, date, dayNumber, i) {
|
|
1516
|
-
var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", "flatpickr-day " + className, date.getDate().toString());
|
|
1517
|
-
dayElement.dateObj = date;
|
|
1518
|
-
dayElement.$i = i;
|
|
1519
|
-
dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat));
|
|
1520
|
-
if (className.indexOf("hidden") === -1 && compareDates(date, self.now) === 0) {
|
|
1521
|
-
self.todayDateElem = dayElement;
|
|
1522
|
-
dayElement.classList.add("today");
|
|
1523
|
-
dayElement.setAttribute("aria-current", "date");
|
|
1524
|
-
}
|
|
1525
|
-
if (dateIsEnabled) {
|
|
1526
|
-
dayElement.tabIndex = -1;
|
|
1527
|
-
if (isDateSelected(date)) {
|
|
1528
|
-
dayElement.classList.add("selected");
|
|
1529
|
-
self.selectedDateElem = dayElement;
|
|
1530
|
-
if (self.config.mode === "range") {
|
|
1531
|
-
toggleClass(dayElement, "startRange", self.selectedDates[0] && compareDates(date, self.selectedDates[0], true) === 0);
|
|
1532
|
-
toggleClass(dayElement, "endRange", self.selectedDates[1] && compareDates(date, self.selectedDates[1], true) === 0);
|
|
1533
|
-
if (className === "nextMonthDay")
|
|
1534
|
-
dayElement.classList.add("inRange");
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
} else {
|
|
1538
|
-
dayElement.classList.add("flatpickr-disabled");
|
|
1539
|
-
}
|
|
1540
|
-
if (self.config.mode === "range") {
|
|
1541
|
-
if (isDateInRange(date) && !isDateSelected(date))
|
|
1542
|
-
dayElement.classList.add("inRange");
|
|
1543
|
-
}
|
|
1544
|
-
if (self.weekNumbers && self.config.showMonths === 1 && className !== "prevMonthDay" && dayNumber % 7 === 1) {
|
|
1545
|
-
self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>");
|
|
1546
|
-
}
|
|
1547
|
-
triggerEvent("onDayCreate", dayElement);
|
|
1548
|
-
return dayElement;
|
|
1549
|
-
}
|
|
1550
|
-
function focusOnDayElem(targetNode) {
|
|
1551
|
-
targetNode.focus();
|
|
1552
|
-
if (self.config.mode === "range")
|
|
1553
|
-
onMouseOver(targetNode);
|
|
1554
|
-
}
|
|
1555
|
-
function getFirstAvailableDay(delta) {
|
|
1556
|
-
var startMonth = delta > 0 ? 0 : self.config.showMonths - 1;
|
|
1557
|
-
var endMonth = delta > 0 ? self.config.showMonths : -1;
|
|
1558
|
-
for (var m = startMonth; m != endMonth; m += delta) {
|
|
1559
|
-
var month = self.daysContainer.children[m];
|
|
1560
|
-
var startIndex = delta > 0 ? 0 : month.children.length - 1;
|
|
1561
|
-
var endIndex = delta > 0 ? month.children.length : -1;
|
|
1562
|
-
for (var i = startIndex; i != endIndex; i += delta) {
|
|
1563
|
-
var c = month.children[i];
|
|
1564
|
-
if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj))
|
|
1565
|
-
return c;
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
return void 0;
|
|
1569
|
-
}
|
|
1570
|
-
function getNextAvailableDay(current, delta) {
|
|
1571
|
-
var givenMonth = current.className.indexOf("Month") === -1 ? current.dateObj.getMonth() : self.currentMonth;
|
|
1572
|
-
var endMonth = delta > 0 ? self.config.showMonths : -1;
|
|
1573
|
-
var loopDelta = delta > 0 ? 1 : -1;
|
|
1574
|
-
for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) {
|
|
1575
|
-
var month = self.daysContainer.children[m];
|
|
1576
|
-
var startIndex = givenMonth - self.currentMonth === m ? current.$i + delta : delta < 0 ? month.children.length - 1 : 0;
|
|
1577
|
-
var numMonthDays = month.children.length;
|
|
1578
|
-
for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) {
|
|
1579
|
-
var c = month.children[i];
|
|
1580
|
-
if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj) && Math.abs(current.$i - i) >= Math.abs(delta))
|
|
1581
|
-
return focusOnDayElem(c);
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
self.changeMonth(loopDelta);
|
|
1585
|
-
focusOnDay(getFirstAvailableDay(loopDelta), 0);
|
|
1586
|
-
return void 0;
|
|
1587
|
-
}
|
|
1588
|
-
function focusOnDay(current, offset) {
|
|
1589
|
-
var dayFocused = isInView(document.activeElement || document.body);
|
|
1590
|
-
var startElem = current !== void 0 ? current : dayFocused ? document.activeElement : self.selectedDateElem !== void 0 && isInView(self.selectedDateElem) ? self.selectedDateElem : self.todayDateElem !== void 0 && isInView(self.todayDateElem) ? self.todayDateElem : getFirstAvailableDay(offset > 0 ? 1 : -1);
|
|
1591
|
-
if (startElem === void 0)
|
|
1592
|
-
return self._input.focus();
|
|
1593
|
-
if (!dayFocused)
|
|
1594
|
-
return focusOnDayElem(startElem);
|
|
1595
|
-
getNextAvailableDay(startElem, offset);
|
|
1596
|
-
}
|
|
1597
|
-
function buildMonthDays(year, month) {
|
|
1598
|
-
var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;
|
|
1599
|
-
var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12);
|
|
1600
|
-
var daysInMonth = self.utils.getDaysInMonth(month), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay";
|
|
1601
|
-
var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;
|
|
1602
|
-
for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {
|
|
1603
|
-
days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
|
|
1604
|
-
}
|
|
1605
|
-
for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {
|
|
1606
|
-
days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex));
|
|
1607
|
-
}
|
|
1608
|
-
for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {
|
|
1609
|
-
days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
|
|
1610
|
-
}
|
|
1611
|
-
var dayContainer = createElement("div", "dayContainer");
|
|
1612
|
-
dayContainer.appendChild(days);
|
|
1613
|
-
return dayContainer;
|
|
1614
|
-
}
|
|
1615
|
-
function buildDays() {
|
|
1616
|
-
if (self.daysContainer === void 0) {
|
|
1617
|
-
return;
|
|
1618
|
-
}
|
|
1619
|
-
clearNode(self.daysContainer);
|
|
1620
|
-
if (self.weekNumbers)
|
|
1621
|
-
clearNode(self.weekNumbers);
|
|
1622
|
-
var frag = document.createDocumentFragment();
|
|
1623
|
-
for (var i = 0; i < self.config.showMonths; i++) {
|
|
1624
|
-
var d = new Date(self.currentYear, self.currentMonth, 1);
|
|
1625
|
-
d.setMonth(self.currentMonth + i);
|
|
1626
|
-
frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth()));
|
|
1627
|
-
}
|
|
1628
|
-
self.daysContainer.appendChild(frag);
|
|
1629
|
-
self.days = self.daysContainer.firstChild;
|
|
1630
|
-
if (self.config.mode === "range" && self.selectedDates.length === 1) {
|
|
1631
|
-
onMouseOver();
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
function buildMonthSwitch() {
|
|
1635
|
-
if (self.config.showMonths > 1 || self.config.monthSelectorType !== "dropdown")
|
|
1636
|
-
return;
|
|
1637
|
-
var shouldBuildMonth = function(month2) {
|
|
1638
|
-
if (self.config.minDate !== void 0 && self.currentYear === self.config.minDate.getFullYear() && month2 < self.config.minDate.getMonth()) {
|
|
1639
|
-
return false;
|
|
1640
|
-
}
|
|
1641
|
-
return !(self.config.maxDate !== void 0 && self.currentYear === self.config.maxDate.getFullYear() && month2 > self.config.maxDate.getMonth());
|
|
1642
|
-
};
|
|
1643
|
-
self.monthsDropdownContainer.tabIndex = -1;
|
|
1644
|
-
self.monthsDropdownContainer.innerHTML = "";
|
|
1645
|
-
for (var i = 0; i < 12; i++) {
|
|
1646
|
-
if (!shouldBuildMonth(i))
|
|
1647
|
-
continue;
|
|
1648
|
-
var month = createElement("option", "flatpickr-monthDropdown-month");
|
|
1649
|
-
month.value = new Date(self.currentYear, i).getMonth().toString();
|
|
1650
|
-
month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n);
|
|
1651
|
-
month.tabIndex = -1;
|
|
1652
|
-
if (self.currentMonth === i) {
|
|
1653
|
-
month.selected = true;
|
|
1654
|
-
}
|
|
1655
|
-
self.monthsDropdownContainer.appendChild(month);
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
function buildMonth() {
|
|
1659
|
-
var container = createElement("div", "flatpickr-month");
|
|
1660
|
-
var monthNavFragment = window.document.createDocumentFragment();
|
|
1661
|
-
var monthElement;
|
|
1662
|
-
if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") {
|
|
1663
|
-
monthElement = createElement("span", "cur-month");
|
|
1664
|
-
} else {
|
|
1665
|
-
self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months");
|
|
1666
|
-
bind(self.monthsDropdownContainer, "change", function(e) {
|
|
1667
|
-
var target = e.target;
|
|
1668
|
-
var selectedMonth = parseInt(target.value, 10);
|
|
1669
|
-
self.changeMonth(selectedMonth - self.currentMonth);
|
|
1670
|
-
triggerEvent("onMonthChange");
|
|
1671
|
-
});
|
|
1672
|
-
buildMonthSwitch();
|
|
1673
|
-
monthElement = self.monthsDropdownContainer;
|
|
1674
|
-
}
|
|
1675
|
-
var yearInput = createNumberInput("cur-year", { tabindex: "-1" });
|
|
1676
|
-
var yearElement = yearInput.getElementsByTagName("input")[0];
|
|
1677
|
-
yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel);
|
|
1678
|
-
if (self.config.minDate) {
|
|
1679
|
-
yearElement.setAttribute("min", self.config.minDate.getFullYear().toString());
|
|
1680
|
-
}
|
|
1681
|
-
if (self.config.maxDate) {
|
|
1682
|
-
yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString());
|
|
1683
|
-
yearElement.disabled = !!self.config.minDate && self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();
|
|
1684
|
-
}
|
|
1685
|
-
var currentMonth = createElement("div", "flatpickr-current-month");
|
|
1686
|
-
currentMonth.appendChild(monthElement);
|
|
1687
|
-
currentMonth.appendChild(yearInput);
|
|
1688
|
-
monthNavFragment.appendChild(currentMonth);
|
|
1689
|
-
container.appendChild(monthNavFragment);
|
|
1690
|
-
return {
|
|
1691
|
-
container,
|
|
1692
|
-
yearElement,
|
|
1693
|
-
monthElement
|
|
1694
|
-
};
|
|
1695
|
-
}
|
|
1696
|
-
function buildMonths() {
|
|
1697
|
-
clearNode(self.monthNav);
|
|
1698
|
-
self.monthNav.appendChild(self.prevMonthNav);
|
|
1699
|
-
if (self.config.showMonths) {
|
|
1700
|
-
self.yearElements = [];
|
|
1701
|
-
self.monthElements = [];
|
|
1702
|
-
}
|
|
1703
|
-
for (var m = self.config.showMonths; m--; ) {
|
|
1704
|
-
var month = buildMonth();
|
|
1705
|
-
self.yearElements.push(month.yearElement);
|
|
1706
|
-
self.monthElements.push(month.monthElement);
|
|
1707
|
-
self.monthNav.appendChild(month.container);
|
|
1708
|
-
}
|
|
1709
|
-
self.monthNav.appendChild(self.nextMonthNav);
|
|
1710
|
-
}
|
|
1711
|
-
function buildMonthNav() {
|
|
1712
|
-
self.monthNav = createElement("div", "flatpickr-months");
|
|
1713
|
-
self.yearElements = [];
|
|
1714
|
-
self.monthElements = [];
|
|
1715
|
-
self.prevMonthNav = createElement("span", "flatpickr-prev-month");
|
|
1716
|
-
self.prevMonthNav.innerHTML = self.config.prevArrow;
|
|
1717
|
-
self.nextMonthNav = createElement("span", "flatpickr-next-month");
|
|
1718
|
-
self.nextMonthNav.innerHTML = self.config.nextArrow;
|
|
1719
|
-
buildMonths();
|
|
1720
|
-
Object.defineProperty(self, "_hidePrevMonthArrow", {
|
|
1721
|
-
get: function() {
|
|
1722
|
-
return self.__hidePrevMonthArrow;
|
|
1723
|
-
},
|
|
1724
|
-
set: function(bool) {
|
|
1725
|
-
if (self.__hidePrevMonthArrow !== bool) {
|
|
1726
|
-
toggleClass(self.prevMonthNav, "flatpickr-disabled", bool);
|
|
1727
|
-
self.__hidePrevMonthArrow = bool;
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
});
|
|
1731
|
-
Object.defineProperty(self, "_hideNextMonthArrow", {
|
|
1732
|
-
get: function() {
|
|
1733
|
-
return self.__hideNextMonthArrow;
|
|
1734
|
-
},
|
|
1735
|
-
set: function(bool) {
|
|
1736
|
-
if (self.__hideNextMonthArrow !== bool) {
|
|
1737
|
-
toggleClass(self.nextMonthNav, "flatpickr-disabled", bool);
|
|
1738
|
-
self.__hideNextMonthArrow = bool;
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
});
|
|
1742
|
-
self.currentYearElement = self.yearElements[0];
|
|
1743
|
-
updateNavigationCurrentMonth();
|
|
1744
|
-
return self.monthNav;
|
|
1745
|
-
}
|
|
1746
|
-
function buildTime() {
|
|
1747
|
-
self.calendarContainer.classList.add("hasTime");
|
|
1748
|
-
if (self.config.noCalendar)
|
|
1749
|
-
self.calendarContainer.classList.add("noCalendar");
|
|
1750
|
-
self.timeContainer = createElement("div", "flatpickr-time");
|
|
1751
|
-
self.timeContainer.tabIndex = -1;
|
|
1752
|
-
var separator = createElement("span", "flatpickr-time-separator", ":");
|
|
1753
|
-
var hourInput = createNumberInput("flatpickr-hour", {
|
|
1754
|
-
"aria-label": self.l10n.hourAriaLabel
|
|
1755
|
-
});
|
|
1756
|
-
self.hourElement = hourInput.getElementsByTagName("input")[0];
|
|
1757
|
-
var minuteInput = createNumberInput("flatpickr-minute", {
|
|
1758
|
-
"aria-label": self.l10n.minuteAriaLabel
|
|
1759
|
-
});
|
|
1760
|
-
self.minuteElement = minuteInput.getElementsByTagName("input")[0];
|
|
1761
|
-
self.hourElement.tabIndex = self.minuteElement.tabIndex = -1;
|
|
1762
|
-
self.hourElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.time_24hr ? self.config.defaultHour : military2ampm(self.config.defaultHour));
|
|
1763
|
-
self.minuteElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : self.config.defaultMinute);
|
|
1764
|
-
self.hourElement.setAttribute("step", self.config.hourIncrement.toString());
|
|
1765
|
-
self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString());
|
|
1766
|
-
self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1");
|
|
1767
|
-
self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12");
|
|
1768
|
-
self.minuteElement.setAttribute("min", "0");
|
|
1769
|
-
self.minuteElement.setAttribute("max", "59");
|
|
1770
|
-
self.timeContainer.appendChild(hourInput);
|
|
1771
|
-
self.timeContainer.appendChild(separator);
|
|
1772
|
-
self.timeContainer.appendChild(minuteInput);
|
|
1773
|
-
if (self.config.time_24hr)
|
|
1774
|
-
self.timeContainer.classList.add("time24hr");
|
|
1775
|
-
if (self.config.enableSeconds) {
|
|
1776
|
-
self.timeContainer.classList.add("hasSeconds");
|
|
1777
|
-
var secondInput = createNumberInput("flatpickr-second");
|
|
1778
|
-
self.secondElement = secondInput.getElementsByTagName("input")[0];
|
|
1779
|
-
self.secondElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getSeconds() : self.config.defaultSeconds);
|
|
1780
|
-
self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step"));
|
|
1781
|
-
self.secondElement.setAttribute("min", "0");
|
|
1782
|
-
self.secondElement.setAttribute("max", "59");
|
|
1783
|
-
self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":"));
|
|
1784
|
-
self.timeContainer.appendChild(secondInput);
|
|
1785
|
-
}
|
|
1786
|
-
if (!self.config.time_24hr) {
|
|
1787
|
-
self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj ? self.hourElement.value : self.config.defaultHour) > 11)]);
|
|
1788
|
-
self.amPM.title = self.l10n.toggleTitle;
|
|
1789
|
-
self.amPM.tabIndex = -1;
|
|
1790
|
-
self.timeContainer.appendChild(self.amPM);
|
|
1791
|
-
}
|
|
1792
|
-
return self.timeContainer;
|
|
1793
|
-
}
|
|
1794
|
-
function buildWeekdays() {
|
|
1795
|
-
if (!self.weekdayContainer)
|
|
1796
|
-
self.weekdayContainer = createElement("div", "flatpickr-weekdays");
|
|
1797
|
-
else
|
|
1798
|
-
clearNode(self.weekdayContainer);
|
|
1799
|
-
for (var i = self.config.showMonths; i--; ) {
|
|
1800
|
-
var container = createElement("div", "flatpickr-weekdaycontainer");
|
|
1801
|
-
self.weekdayContainer.appendChild(container);
|
|
1802
|
-
}
|
|
1803
|
-
updateWeekdays();
|
|
1804
|
-
return self.weekdayContainer;
|
|
1805
|
-
}
|
|
1806
|
-
function updateWeekdays() {
|
|
1807
|
-
var firstDayOfWeek = self.l10n.firstDayOfWeek;
|
|
1808
|
-
var weekdays = self.l10n.weekdays.shorthand.slice();
|
|
1809
|
-
if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {
|
|
1810
|
-
weekdays = weekdays.splice(firstDayOfWeek, weekdays.length).concat(weekdays.splice(0, firstDayOfWeek));
|
|
1811
|
-
}
|
|
1812
|
-
for (var i = self.config.showMonths; i--; ) {
|
|
1813
|
-
self.weekdayContainer.children[i].innerHTML = "\n <span class='flatpickr-weekday'>\n " + weekdays.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n ";
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
1816
|
-
function buildWeeks() {
|
|
1817
|
-
self.calendarContainer.classList.add("hasWeeks");
|
|
1818
|
-
var weekWrapper = createElement("div", "flatpickr-weekwrapper");
|
|
1819
|
-
weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation));
|
|
1820
|
-
var weekNumbers = createElement("div", "flatpickr-weeks");
|
|
1821
|
-
weekWrapper.appendChild(weekNumbers);
|
|
1822
|
-
return {
|
|
1823
|
-
weekWrapper,
|
|
1824
|
-
weekNumbers
|
|
1825
|
-
};
|
|
1826
|
-
}
|
|
1827
|
-
function changeMonth(value, isOffset) {
|
|
1828
|
-
if (isOffset === void 0) {
|
|
1829
|
-
isOffset = true;
|
|
1830
|
-
}
|
|
1831
|
-
var delta = isOffset ? value : value - self.currentMonth;
|
|
1832
|
-
if (delta < 0 && self._hidePrevMonthArrow === true || delta > 0 && self._hideNextMonthArrow === true)
|
|
1833
|
-
return;
|
|
1834
|
-
self.currentMonth += delta;
|
|
1835
|
-
if (self.currentMonth < 0 || self.currentMonth > 11) {
|
|
1836
|
-
self.currentYear += self.currentMonth > 11 ? 1 : -1;
|
|
1837
|
-
self.currentMonth = (self.currentMonth + 12) % 12;
|
|
1838
|
-
triggerEvent("onYearChange");
|
|
1839
|
-
buildMonthSwitch();
|
|
1840
|
-
}
|
|
1841
|
-
buildDays();
|
|
1842
|
-
triggerEvent("onMonthChange");
|
|
1843
|
-
updateNavigationCurrentMonth();
|
|
1844
|
-
}
|
|
1845
|
-
function clear(triggerChangeEvent, toInitial) {
|
|
1846
|
-
if (triggerChangeEvent === void 0) {
|
|
1847
|
-
triggerChangeEvent = true;
|
|
1848
|
-
}
|
|
1849
|
-
if (toInitial === void 0) {
|
|
1850
|
-
toInitial = true;
|
|
1851
|
-
}
|
|
1852
|
-
self.input.value = "";
|
|
1853
|
-
if (self.altInput !== void 0)
|
|
1854
|
-
self.altInput.value = "";
|
|
1855
|
-
if (self.mobileInput !== void 0)
|
|
1856
|
-
self.mobileInput.value = "";
|
|
1857
|
-
self.selectedDates = [];
|
|
1858
|
-
self.latestSelectedDateObj = void 0;
|
|
1859
|
-
if (toInitial === true) {
|
|
1860
|
-
self.currentYear = self._initialDate.getFullYear();
|
|
1861
|
-
self.currentMonth = self._initialDate.getMonth();
|
|
1862
|
-
}
|
|
1863
|
-
self.showTimeInput = false;
|
|
1864
|
-
if (self.config.enableTime === true) {
|
|
1865
|
-
setDefaultHours();
|
|
1866
|
-
}
|
|
1867
|
-
self.redraw();
|
|
1868
|
-
if (triggerChangeEvent)
|
|
1869
|
-
triggerEvent("onChange");
|
|
1870
|
-
}
|
|
1871
|
-
function close() {
|
|
1872
|
-
self.isOpen = false;
|
|
1873
|
-
if (!self.isMobile) {
|
|
1874
|
-
if (self.calendarContainer !== void 0) {
|
|
1875
|
-
self.calendarContainer.classList.remove("open");
|
|
1876
|
-
}
|
|
1877
|
-
if (self._input !== void 0) {
|
|
1878
|
-
self._input.classList.remove("active");
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
triggerEvent("onClose");
|
|
1882
|
-
}
|
|
1883
|
-
function destroy() {
|
|
1884
|
-
if (self.config !== void 0)
|
|
1885
|
-
triggerEvent("onDestroy");
|
|
1886
|
-
for (var i = self._handlers.length; i--; ) {
|
|
1887
|
-
var h = self._handlers[i];
|
|
1888
|
-
h.element.removeEventListener(h.event, h.handler, h.options);
|
|
1889
|
-
}
|
|
1890
|
-
self._handlers = [];
|
|
1891
|
-
if (self.mobileInput) {
|
|
1892
|
-
if (self.mobileInput.parentNode)
|
|
1893
|
-
self.mobileInput.parentNode.removeChild(self.mobileInput);
|
|
1894
|
-
self.mobileInput = void 0;
|
|
1895
|
-
} else if (self.calendarContainer && self.calendarContainer.parentNode) {
|
|
1896
|
-
if (self.config.static && self.calendarContainer.parentNode) {
|
|
1897
|
-
var wrapper = self.calendarContainer.parentNode;
|
|
1898
|
-
wrapper.lastChild && wrapper.removeChild(wrapper.lastChild);
|
|
1899
|
-
if (wrapper.parentNode) {
|
|
1900
|
-
while (wrapper.firstChild)
|
|
1901
|
-
wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper);
|
|
1902
|
-
wrapper.parentNode.removeChild(wrapper);
|
|
1903
|
-
}
|
|
1904
|
-
} else
|
|
1905
|
-
self.calendarContainer.parentNode.removeChild(self.calendarContainer);
|
|
1906
|
-
}
|
|
1907
|
-
if (self.altInput) {
|
|
1908
|
-
self.input.type = "text";
|
|
1909
|
-
if (self.altInput.parentNode)
|
|
1910
|
-
self.altInput.parentNode.removeChild(self.altInput);
|
|
1911
|
-
delete self.altInput;
|
|
1912
|
-
}
|
|
1913
|
-
if (self.input) {
|
|
1914
|
-
self.input.type = self.input._type;
|
|
1915
|
-
self.input.classList.remove("flatpickr-input");
|
|
1916
|
-
self.input.removeAttribute("readonly");
|
|
1917
|
-
self.input.value = "";
|
|
1918
|
-
}
|
|
1919
|
-
[
|
|
1920
|
-
"_showTimeInput",
|
|
1921
|
-
"latestSelectedDateObj",
|
|
1922
|
-
"_hideNextMonthArrow",
|
|
1923
|
-
"_hidePrevMonthArrow",
|
|
1924
|
-
"__hideNextMonthArrow",
|
|
1925
|
-
"__hidePrevMonthArrow",
|
|
1926
|
-
"isMobile",
|
|
1927
|
-
"isOpen",
|
|
1928
|
-
"selectedDateElem",
|
|
1929
|
-
"minDateHasTime",
|
|
1930
|
-
"maxDateHasTime",
|
|
1931
|
-
"days",
|
|
1932
|
-
"daysContainer",
|
|
1933
|
-
"_input",
|
|
1934
|
-
"_positionElement",
|
|
1935
|
-
"innerContainer",
|
|
1936
|
-
"rContainer",
|
|
1937
|
-
"monthNav",
|
|
1938
|
-
"todayDateElem",
|
|
1939
|
-
"calendarContainer",
|
|
1940
|
-
"weekdayContainer",
|
|
1941
|
-
"prevMonthNav",
|
|
1942
|
-
"nextMonthNav",
|
|
1943
|
-
"monthsDropdownContainer",
|
|
1944
|
-
"currentMonthElement",
|
|
1945
|
-
"currentYearElement",
|
|
1946
|
-
"navigationCurrentMonth",
|
|
1947
|
-
"selectedDateElem",
|
|
1948
|
-
"config"
|
|
1949
|
-
].forEach(function(k) {
|
|
1950
|
-
try {
|
|
1951
|
-
delete self[k];
|
|
1952
|
-
} catch (_) {
|
|
1953
|
-
}
|
|
1954
|
-
});
|
|
1955
|
-
}
|
|
1956
|
-
function isCalendarElem(elem) {
|
|
1957
|
-
if (self.config.appendTo && self.config.appendTo.contains(elem))
|
|
1958
|
-
return true;
|
|
1959
|
-
return self.calendarContainer.contains(elem);
|
|
1960
|
-
}
|
|
1961
|
-
function documentClick(e) {
|
|
1962
|
-
if (self.isOpen && !self.config.inline) {
|
|
1963
|
-
var eventTarget_1 = getEventTarget(e);
|
|
1964
|
-
var isCalendarElement = isCalendarElem(eventTarget_1);
|
|
1965
|
-
var isInput = eventTarget_1 === self.input || eventTarget_1 === self.altInput || self.element.contains(eventTarget_1) || // web components
|
|
1966
|
-
// e.path is not present in all browsers. circumventing typechecks
|
|
1967
|
-
e.path && e.path.indexOf && (~e.path.indexOf(self.input) || ~e.path.indexOf(self.altInput));
|
|
1968
|
-
var lostFocus = e.type === "blur" ? isInput && e.relatedTarget && !isCalendarElem(e.relatedTarget) : !isInput && !isCalendarElement && !isCalendarElem(e.relatedTarget);
|
|
1969
|
-
var isIgnored = !self.config.ignoredFocusElements.some(function(elem) {
|
|
1970
|
-
return elem.contains(eventTarget_1);
|
|
1971
|
-
});
|
|
1972
|
-
if (lostFocus && isIgnored) {
|
|
1973
|
-
self.close();
|
|
1974
|
-
if (self.config.mode === "range" && self.selectedDates.length === 1) {
|
|
1975
|
-
self.clear(false);
|
|
1976
|
-
self.redraw();
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
function changeYear(newYear) {
|
|
1982
|
-
if (!newYear || self.config.minDate && newYear < self.config.minDate.getFullYear() || self.config.maxDate && newYear > self.config.maxDate.getFullYear())
|
|
1983
|
-
return;
|
|
1984
|
-
var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum;
|
|
1985
|
-
self.currentYear = newYearNum || self.currentYear;
|
|
1986
|
-
if (self.config.maxDate && self.currentYear === self.config.maxDate.getFullYear()) {
|
|
1987
|
-
self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);
|
|
1988
|
-
} else if (self.config.minDate && self.currentYear === self.config.minDate.getFullYear()) {
|
|
1989
|
-
self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);
|
|
1990
|
-
}
|
|
1991
|
-
if (isNewYear) {
|
|
1992
|
-
self.redraw();
|
|
1993
|
-
triggerEvent("onYearChange");
|
|
1994
|
-
buildMonthSwitch();
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1997
|
-
function isEnabled(date, timeless) {
|
|
1998
|
-
if (timeless === void 0) {
|
|
1999
|
-
timeless = true;
|
|
2000
|
-
}
|
|
2001
|
-
var dateToCheck = self.parseDate(date, void 0, timeless);
|
|
2002
|
-
if (self.config.minDate && dateToCheck && compareDates(dateToCheck, self.config.minDate, timeless !== void 0 ? timeless : !self.minDateHasTime) < 0 || self.config.maxDate && dateToCheck && compareDates(dateToCheck, self.config.maxDate, timeless !== void 0 ? timeless : !self.maxDateHasTime) > 0)
|
|
2003
|
-
return false;
|
|
2004
|
-
if (self.config.enable.length === 0 && self.config.disable.length === 0)
|
|
2005
|
-
return true;
|
|
2006
|
-
if (dateToCheck === void 0)
|
|
2007
|
-
return false;
|
|
2008
|
-
var bool = self.config.enable.length > 0, array = bool ? self.config.enable : self.config.disable;
|
|
2009
|
-
for (var i = 0, d = void 0; i < array.length; i++) {
|
|
2010
|
-
d = array[i];
|
|
2011
|
-
if (typeof d === "function" && d(dateToCheck))
|
|
2012
|
-
return bool;
|
|
2013
|
-
else if (d instanceof Date && dateToCheck !== void 0 && d.getTime() === dateToCheck.getTime())
|
|
2014
|
-
return bool;
|
|
2015
|
-
else if (typeof d === "string" && dateToCheck !== void 0) {
|
|
2016
|
-
var parsed = self.parseDate(d, void 0, true);
|
|
2017
|
-
return parsed && parsed.getTime() === dateToCheck.getTime() ? bool : !bool;
|
|
2018
|
-
} else if (
|
|
2019
|
-
// disabled by range
|
|
2020
|
-
typeof d === "object" && dateToCheck !== void 0 && d.from && d.to && dateToCheck.getTime() >= d.from.getTime() && dateToCheck.getTime() <= d.to.getTime()
|
|
2021
|
-
)
|
|
2022
|
-
return bool;
|
|
2023
|
-
}
|
|
2024
|
-
return !bool;
|
|
2025
|
-
}
|
|
2026
|
-
function isInView(elem) {
|
|
2027
|
-
if (self.daysContainer !== void 0)
|
|
2028
|
-
return elem.className.indexOf("hidden") === -1 && self.daysContainer.contains(elem);
|
|
2029
|
-
return false;
|
|
2030
|
-
}
|
|
2031
|
-
function onKeyDown(e) {
|
|
2032
|
-
var isInput = e.target === self._input;
|
|
2033
|
-
var allowInput = self.config.allowInput;
|
|
2034
|
-
var allowKeydown = self.isOpen && (!allowInput || !isInput);
|
|
2035
|
-
var allowInlineKeydown = self.config.inline && isInput && !allowInput;
|
|
2036
|
-
if (e.keyCode === 13 && isInput) {
|
|
2037
|
-
if (allowInput) {
|
|
2038
|
-
self.setDate(self._input.value, true, e.target === self.altInput ? self.config.altFormat : self.config.dateFormat);
|
|
2039
|
-
return e.target.blur();
|
|
2040
|
-
} else {
|
|
2041
|
-
self.open();
|
|
2042
|
-
}
|
|
2043
|
-
} else if (isCalendarElem(e.target) || allowKeydown || allowInlineKeydown) {
|
|
2044
|
-
var isTimeObj = !!self.timeContainer && self.timeContainer.contains(e.target);
|
|
2045
|
-
switch (e.keyCode) {
|
|
2046
|
-
case 13:
|
|
2047
|
-
if (isTimeObj) {
|
|
2048
|
-
e.preventDefault();
|
|
2049
|
-
updateTime();
|
|
2050
|
-
focusAndClose();
|
|
2051
|
-
} else
|
|
2052
|
-
selectDate(e);
|
|
2053
|
-
break;
|
|
2054
|
-
case 27:
|
|
2055
|
-
e.preventDefault();
|
|
2056
|
-
focusAndClose();
|
|
2057
|
-
break;
|
|
2058
|
-
case 8:
|
|
2059
|
-
case 46:
|
|
2060
|
-
if (isInput && !self.config.allowInput) {
|
|
2061
|
-
e.preventDefault();
|
|
2062
|
-
self.clear();
|
|
2063
|
-
}
|
|
2064
|
-
break;
|
|
2065
|
-
case 37:
|
|
2066
|
-
case 39:
|
|
2067
|
-
if (!isTimeObj && !isInput) {
|
|
2068
|
-
e.preventDefault();
|
|
2069
|
-
if (self.daysContainer !== void 0 && (allowInput === false || document.activeElement && isInView(document.activeElement))) {
|
|
2070
|
-
var delta_1 = e.keyCode === 39 ? 1 : -1;
|
|
2071
|
-
if (!e.ctrlKey)
|
|
2072
|
-
focusOnDay(void 0, delta_1);
|
|
2073
|
-
else {
|
|
2074
|
-
e.stopPropagation();
|
|
2075
|
-
changeMonth(delta_1);
|
|
2076
|
-
focusOnDay(getFirstAvailableDay(1), 0);
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
} else if (self.hourElement)
|
|
2080
|
-
self.hourElement.focus();
|
|
2081
|
-
break;
|
|
2082
|
-
case 38:
|
|
2083
|
-
case 40:
|
|
2084
|
-
e.preventDefault();
|
|
2085
|
-
var delta = e.keyCode === 40 ? 1 : -1;
|
|
2086
|
-
if (self.daysContainer && e.target.$i !== void 0 || e.target === self.input) {
|
|
2087
|
-
if (e.ctrlKey) {
|
|
2088
|
-
e.stopPropagation();
|
|
2089
|
-
changeYear(self.currentYear - delta);
|
|
2090
|
-
focusOnDay(getFirstAvailableDay(1), 0);
|
|
2091
|
-
} else if (!isTimeObj)
|
|
2092
|
-
focusOnDay(void 0, delta * 7);
|
|
2093
|
-
} else if (e.target === self.currentYearElement) {
|
|
2094
|
-
changeYear(self.currentYear - delta);
|
|
2095
|
-
} else if (self.config.enableTime) {
|
|
2096
|
-
if (!isTimeObj && self.hourElement)
|
|
2097
|
-
self.hourElement.focus();
|
|
2098
|
-
updateTime(e);
|
|
2099
|
-
self._debouncedChange();
|
|
2100
|
-
}
|
|
2101
|
-
break;
|
|
2102
|
-
case 9:
|
|
2103
|
-
if (isTimeObj) {
|
|
2104
|
-
var elems = [
|
|
2105
|
-
self.hourElement,
|
|
2106
|
-
self.minuteElement,
|
|
2107
|
-
self.secondElement,
|
|
2108
|
-
self.amPM
|
|
2109
|
-
].concat(self.pluginElements).filter(function(x) {
|
|
2110
|
-
return x;
|
|
2111
|
-
});
|
|
2112
|
-
var i = elems.indexOf(e.target);
|
|
2113
|
-
if (i !== -1) {
|
|
2114
|
-
var target = elems[i + (e.shiftKey ? -1 : 1)];
|
|
2115
|
-
e.preventDefault();
|
|
2116
|
-
(target || self._input).focus();
|
|
2117
|
-
}
|
|
2118
|
-
} else if (!self.config.noCalendar && self.daysContainer && self.daysContainer.contains(e.target) && e.shiftKey) {
|
|
2119
|
-
e.preventDefault();
|
|
2120
|
-
self._input.focus();
|
|
2121
|
-
}
|
|
2122
|
-
break;
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
if (self.amPM !== void 0 && e.target === self.amPM) {
|
|
2126
|
-
switch (e.key) {
|
|
2127
|
-
case self.l10n.amPM[0].charAt(0):
|
|
2128
|
-
case self.l10n.amPM[0].charAt(0).toLowerCase():
|
|
2129
|
-
self.amPM.textContent = self.l10n.amPM[0];
|
|
2130
|
-
setHoursFromInputs();
|
|
2131
|
-
updateValue();
|
|
2132
|
-
break;
|
|
2133
|
-
case self.l10n.amPM[1].charAt(0):
|
|
2134
|
-
case self.l10n.amPM[1].charAt(0).toLowerCase():
|
|
2135
|
-
self.amPM.textContent = self.l10n.amPM[1];
|
|
2136
|
-
setHoursFromInputs();
|
|
2137
|
-
updateValue();
|
|
2138
|
-
break;
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2141
|
-
if (isInput || isCalendarElem(e.target)) {
|
|
2142
|
-
triggerEvent("onKeyDown", e);
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
function onMouseOver(elem) {
|
|
2146
|
-
if (self.selectedDates.length !== 1 || elem && (!elem.classList.contains("flatpickr-day") || elem.classList.contains("flatpickr-disabled")))
|
|
2147
|
-
return;
|
|
2148
|
-
var hoverDate = elem ? elem.dateObj.getTime() : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], void 0, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime());
|
|
2149
|
-
var containsDisabled = false;
|
|
2150
|
-
var minRange = 0, maxRange = 0;
|
|
2151
|
-
for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) {
|
|
2152
|
-
if (!isEnabled(new Date(t), true)) {
|
|
2153
|
-
containsDisabled = containsDisabled || t > rangeStartDate && t < rangeEndDate;
|
|
2154
|
-
if (t < initialDate && (!minRange || t > minRange))
|
|
2155
|
-
minRange = t;
|
|
2156
|
-
else if (t > initialDate && (!maxRange || t < maxRange))
|
|
2157
|
-
maxRange = t;
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
for (var m = 0; m < self.config.showMonths; m++) {
|
|
2161
|
-
var month = self.daysContainer.children[m];
|
|
2162
|
-
var _loop_1 = function(i2, l2) {
|
|
2163
|
-
var dayElem = month.children[i2], date = dayElem.dateObj;
|
|
2164
|
-
var timestamp = date.getTime();
|
|
2165
|
-
var outOfRange = minRange > 0 && timestamp < minRange || maxRange > 0 && timestamp > maxRange;
|
|
2166
|
-
if (outOfRange) {
|
|
2167
|
-
dayElem.classList.add("notAllowed");
|
|
2168
|
-
["inRange", "startRange", "endRange"].forEach(function(c) {
|
|
2169
|
-
dayElem.classList.remove(c);
|
|
2170
|
-
});
|
|
2171
|
-
return "continue";
|
|
2172
|
-
} else if (containsDisabled && !outOfRange)
|
|
2173
|
-
return "continue";
|
|
2174
|
-
["startRange", "inRange", "endRange", "notAllowed"].forEach(function(c) {
|
|
2175
|
-
dayElem.classList.remove(c);
|
|
2176
|
-
});
|
|
2177
|
-
if (elem !== void 0) {
|
|
2178
|
-
elem.classList.add(hoverDate <= self.selectedDates[0].getTime() ? "startRange" : "endRange");
|
|
2179
|
-
if (initialDate < hoverDate && timestamp === initialDate)
|
|
2180
|
-
dayElem.classList.add("startRange");
|
|
2181
|
-
else if (initialDate > hoverDate && timestamp === initialDate)
|
|
2182
|
-
dayElem.classList.add("endRange");
|
|
2183
|
-
if (timestamp >= minRange && (maxRange === 0 || timestamp <= maxRange) && isBetween(timestamp, initialDate, hoverDate))
|
|
2184
|
-
dayElem.classList.add("inRange");
|
|
2185
|
-
}
|
|
2186
|
-
};
|
|
2187
|
-
for (var i = 0, l = month.children.length; i < l; i++) {
|
|
2188
|
-
_loop_1(i, l);
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
function onResize() {
|
|
2193
|
-
if (self.isOpen && !self.config.static && !self.config.inline)
|
|
2194
|
-
positionCalendar();
|
|
2195
|
-
}
|
|
2196
|
-
function setDefaultTime() {
|
|
2197
|
-
self.setDate(self.config.minDate !== void 0 ? new Date(self.config.minDate.getTime()) : /* @__PURE__ */ new Date(), true);
|
|
2198
|
-
setDefaultHours();
|
|
2199
|
-
updateValue();
|
|
2200
|
-
}
|
|
2201
|
-
function open(e, positionElement) {
|
|
2202
|
-
if (positionElement === void 0) {
|
|
2203
|
-
positionElement = self._positionElement;
|
|
2204
|
-
}
|
|
2205
|
-
if (self.isMobile === true) {
|
|
2206
|
-
if (e) {
|
|
2207
|
-
e.preventDefault();
|
|
2208
|
-
e.target && e.target.blur();
|
|
2209
|
-
}
|
|
2210
|
-
if (self.mobileInput !== void 0) {
|
|
2211
|
-
self.mobileInput.focus();
|
|
2212
|
-
self.mobileInput.click();
|
|
2213
|
-
}
|
|
2214
|
-
triggerEvent("onOpen");
|
|
2215
|
-
return;
|
|
2216
|
-
}
|
|
2217
|
-
if (self._input.disabled || self.config.inline)
|
|
2218
|
-
return;
|
|
2219
|
-
var wasOpen = self.isOpen;
|
|
2220
|
-
self.isOpen = true;
|
|
2221
|
-
if (!wasOpen) {
|
|
2222
|
-
self.calendarContainer.classList.add("open");
|
|
2223
|
-
self._input.classList.add("active");
|
|
2224
|
-
triggerEvent("onOpen");
|
|
2225
|
-
positionCalendar(positionElement);
|
|
2226
|
-
}
|
|
2227
|
-
if (self.config.enableTime === true && self.config.noCalendar === true) {
|
|
2228
|
-
if (self.selectedDates.length === 0) {
|
|
2229
|
-
setDefaultTime();
|
|
2230
|
-
}
|
|
2231
|
-
if (self.config.allowInput === false && (e === void 0 || !self.timeContainer.contains(e.relatedTarget))) {
|
|
2232
|
-
setTimeout(function() {
|
|
2233
|
-
return self.hourElement.select();
|
|
2234
|
-
}, 50);
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
}
|
|
2238
|
-
function minMaxDateSetter(type) {
|
|
2239
|
-
return function(date) {
|
|
2240
|
-
var dateObj = self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat);
|
|
2241
|
-
var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"];
|
|
2242
|
-
if (dateObj !== void 0) {
|
|
2243
|
-
self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] = dateObj.getHours() > 0 || dateObj.getMinutes() > 0 || dateObj.getSeconds() > 0;
|
|
2244
|
-
}
|
|
2245
|
-
if (self.selectedDates) {
|
|
2246
|
-
self.selectedDates = self.selectedDates.filter(function(d) {
|
|
2247
|
-
return isEnabled(d);
|
|
2248
|
-
});
|
|
2249
|
-
if (!self.selectedDates.length && type === "min")
|
|
2250
|
-
setHoursFromDate(dateObj);
|
|
2251
|
-
updateValue();
|
|
2252
|
-
}
|
|
2253
|
-
if (self.daysContainer) {
|
|
2254
|
-
redraw();
|
|
2255
|
-
if (dateObj !== void 0)
|
|
2256
|
-
self.currentYearElement[type] = dateObj.getFullYear().toString();
|
|
2257
|
-
else
|
|
2258
|
-
self.currentYearElement.removeAttribute(type);
|
|
2259
|
-
self.currentYearElement.disabled = !!inverseDateObj && dateObj !== void 0 && inverseDateObj.getFullYear() === dateObj.getFullYear();
|
|
2260
|
-
}
|
|
2261
|
-
};
|
|
2262
|
-
}
|
|
2263
|
-
function parseConfig() {
|
|
2264
|
-
var boolOpts = [
|
|
2265
|
-
"wrap",
|
|
2266
|
-
"weekNumbers",
|
|
2267
|
-
"allowInput",
|
|
2268
|
-
"clickOpens",
|
|
2269
|
-
"time_24hr",
|
|
2270
|
-
"enableTime",
|
|
2271
|
-
"noCalendar",
|
|
2272
|
-
"altInput",
|
|
2273
|
-
"shorthandCurrentMonth",
|
|
2274
|
-
"inline",
|
|
2275
|
-
"static",
|
|
2276
|
-
"enableSeconds",
|
|
2277
|
-
"disableMobile"
|
|
2278
|
-
];
|
|
2279
|
-
var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));
|
|
2280
|
-
var formats2 = {};
|
|
2281
|
-
self.config.parseDate = userConfig.parseDate;
|
|
2282
|
-
self.config.formatDate = userConfig.formatDate;
|
|
2283
|
-
Object.defineProperty(self.config, "enable", {
|
|
2284
|
-
get: function() {
|
|
2285
|
-
return self.config._enable;
|
|
2286
|
-
},
|
|
2287
|
-
set: function(dates) {
|
|
2288
|
-
self.config._enable = parseDateRules(dates);
|
|
2289
|
-
}
|
|
2290
|
-
});
|
|
2291
|
-
Object.defineProperty(self.config, "disable", {
|
|
2292
|
-
get: function() {
|
|
2293
|
-
return self.config._disable;
|
|
2294
|
-
},
|
|
2295
|
-
set: function(dates) {
|
|
2296
|
-
self.config._disable = parseDateRules(dates);
|
|
2297
|
-
}
|
|
2298
|
-
});
|
|
2299
|
-
var timeMode = userConfig.mode === "time";
|
|
2300
|
-
if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) {
|
|
2301
|
-
var defaultDateFormat = flatpickr2.defaultConfig.dateFormat || defaults.dateFormat;
|
|
2302
|
-
formats2.dateFormat = userConfig.noCalendar || timeMode ? "H:i" + (userConfig.enableSeconds ? ":S" : "") : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : "");
|
|
2303
|
-
}
|
|
2304
|
-
if (userConfig.altInput && (userConfig.enableTime || timeMode) && !userConfig.altFormat) {
|
|
2305
|
-
var defaultAltFormat = flatpickr2.defaultConfig.altFormat || defaults.altFormat;
|
|
2306
|
-
formats2.altFormat = userConfig.noCalendar || timeMode ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K") : defaultAltFormat + (" h:i" + (userConfig.enableSeconds ? ":S" : "") + " K");
|
|
2307
|
-
}
|
|
2308
|
-
if (!userConfig.altInputClass) {
|
|
2309
|
-
self.config.altInputClass = self.input.className + " " + self.config.altInputClass;
|
|
2310
|
-
}
|
|
2311
|
-
Object.defineProperty(self.config, "minDate", {
|
|
2312
|
-
get: function() {
|
|
2313
|
-
return self.config._minDate;
|
|
2314
|
-
},
|
|
2315
|
-
set: minMaxDateSetter("min")
|
|
2316
|
-
});
|
|
2317
|
-
Object.defineProperty(self.config, "maxDate", {
|
|
2318
|
-
get: function() {
|
|
2319
|
-
return self.config._maxDate;
|
|
2320
|
-
},
|
|
2321
|
-
set: minMaxDateSetter("max")
|
|
2322
|
-
});
|
|
2323
|
-
var minMaxTimeSetter = function(type) {
|
|
2324
|
-
return function(val) {
|
|
2325
|
-
self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i");
|
|
2326
|
-
};
|
|
2327
|
-
};
|
|
2328
|
-
Object.defineProperty(self.config, "minTime", {
|
|
2329
|
-
get: function() {
|
|
2330
|
-
return self.config._minTime;
|
|
2331
|
-
},
|
|
2332
|
-
set: minMaxTimeSetter("min")
|
|
2333
|
-
});
|
|
2334
|
-
Object.defineProperty(self.config, "maxTime", {
|
|
2335
|
-
get: function() {
|
|
2336
|
-
return self.config._maxTime;
|
|
2337
|
-
},
|
|
2338
|
-
set: minMaxTimeSetter("max")
|
|
2339
|
-
});
|
|
2340
|
-
if (userConfig.mode === "time") {
|
|
2341
|
-
self.config.noCalendar = true;
|
|
2342
|
-
self.config.enableTime = true;
|
|
2343
|
-
}
|
|
2344
|
-
Object.assign(self.config, formats2, userConfig);
|
|
2345
|
-
for (var i = 0; i < boolOpts.length; i++)
|
|
2346
|
-
self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === "true";
|
|
2347
|
-
HOOKS.filter(function(hook) {
|
|
2348
|
-
return self.config[hook] !== void 0;
|
|
2349
|
-
}).forEach(function(hook) {
|
|
2350
|
-
self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance);
|
|
2351
|
-
});
|
|
2352
|
-
self.isMobile = !self.config.disableMobile && !self.config.inline && self.config.mode === "single" && !self.config.disable.length && !self.config.enable.length && !self.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
2353
|
-
for (var i = 0; i < self.config.plugins.length; i++) {
|
|
2354
|
-
var pluginConf = self.config.plugins[i](self) || {};
|
|
2355
|
-
for (var key in pluginConf) {
|
|
2356
|
-
if (HOOKS.indexOf(key) > -1) {
|
|
2357
|
-
self.config[key] = arrayify(pluginConf[key]).map(bindToInstance).concat(self.config[key]);
|
|
2358
|
-
} else if (typeof userConfig[key] === "undefined")
|
|
2359
|
-
self.config[key] = pluginConf[key];
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
triggerEvent("onParseConfig");
|
|
2363
|
-
}
|
|
2364
|
-
function setupLocale() {
|
|
2365
|
-
if (typeof self.config.locale !== "object" && typeof flatpickr2.l10ns[self.config.locale] === "undefined")
|
|
2366
|
-
self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale));
|
|
2367
|
-
self.l10n = __assign({}, flatpickr2.l10ns["default"], typeof self.config.locale === "object" ? self.config.locale : self.config.locale !== "default" ? flatpickr2.l10ns[self.config.locale] : void 0);
|
|
2368
|
-
tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")";
|
|
2369
|
-
var userConfig = __assign({}, instanceConfig, JSON.parse(JSON.stringify(element.dataset || {})));
|
|
2370
|
-
if (userConfig.time_24hr === void 0 && flatpickr2.defaultConfig.time_24hr === void 0) {
|
|
2371
|
-
self.config.time_24hr = self.l10n.time_24hr;
|
|
2372
|
-
}
|
|
2373
|
-
self.formatDate = createDateFormatter(self);
|
|
2374
|
-
self.parseDate = createDateParser({ config: self.config, l10n: self.l10n });
|
|
2375
|
-
}
|
|
2376
|
-
function positionCalendar(customPositionElement) {
|
|
2377
|
-
if (self.calendarContainer === void 0)
|
|
2378
|
-
return;
|
|
2379
|
-
triggerEvent("onPreCalendarPosition");
|
|
2380
|
-
var positionElement = customPositionElement || self._positionElement;
|
|
2381
|
-
var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, function(acc, child) {
|
|
2382
|
-
return acc + child.offsetHeight;
|
|
2383
|
-
}, 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" || configPosVertical !== "below" && distanceFromBottom < calendarHeight && inputBounds.top > calendarHeight;
|
|
2384
|
-
var top = window.pageYOffset + inputBounds.top + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2);
|
|
2385
|
-
toggleClass(self.calendarContainer, "arrowTop", !showOnTop);
|
|
2386
|
-
toggleClass(self.calendarContainer, "arrowBottom", showOnTop);
|
|
2387
|
-
if (self.config.inline)
|
|
2388
|
-
return;
|
|
2389
|
-
var left = window.pageXOffset + inputBounds.left - (configPosHorizontal != null && configPosHorizontal === "center" ? (calendarWidth - inputBounds.width) / 2 : 0);
|
|
2390
|
-
var right = window.document.body.offsetWidth - inputBounds.right;
|
|
2391
|
-
var rightMost = left + calendarWidth > window.document.body.offsetWidth;
|
|
2392
|
-
var centerMost = right + calendarWidth > window.document.body.offsetWidth;
|
|
2393
|
-
toggleClass(self.calendarContainer, "rightMost", rightMost);
|
|
2394
|
-
if (self.config.static)
|
|
2395
|
-
return;
|
|
2396
|
-
self.calendarContainer.style.top = top + "px";
|
|
2397
|
-
if (!rightMost) {
|
|
2398
|
-
self.calendarContainer.style.left = left + "px";
|
|
2399
|
-
self.calendarContainer.style.right = "auto";
|
|
2400
|
-
} else if (!centerMost) {
|
|
2401
|
-
self.calendarContainer.style.left = "auto";
|
|
2402
|
-
self.calendarContainer.style.right = right + "px";
|
|
2403
|
-
} else {
|
|
2404
|
-
var doc = document.styleSheets[0];
|
|
2405
|
-
if (doc === void 0)
|
|
2406
|
-
return;
|
|
2407
|
-
var bodyWidth = window.document.body.offsetWidth;
|
|
2408
|
-
var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2);
|
|
2409
|
-
var centerBefore = ".flatpickr-calendar.centerMost:before";
|
|
2410
|
-
var centerAfter = ".flatpickr-calendar.centerMost:after";
|
|
2411
|
-
var centerIndex = doc.cssRules.length;
|
|
2412
|
-
var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}";
|
|
2413
|
-
toggleClass(self.calendarContainer, "rightMost", false);
|
|
2414
|
-
toggleClass(self.calendarContainer, "centerMost", true);
|
|
2415
|
-
doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex);
|
|
2416
|
-
self.calendarContainer.style.left = centerLeft + "px";
|
|
2417
|
-
self.calendarContainer.style.right = "auto";
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
|
-
function redraw() {
|
|
2421
|
-
if (self.config.noCalendar || self.isMobile)
|
|
2422
|
-
return;
|
|
2423
|
-
updateNavigationCurrentMonth();
|
|
2424
|
-
buildDays();
|
|
2425
|
-
}
|
|
2426
|
-
function focusAndClose() {
|
|
2427
|
-
self._input.focus();
|
|
2428
|
-
if (window.navigator.userAgent.indexOf("MSIE") !== -1 || navigator.msMaxTouchPoints !== void 0) {
|
|
2429
|
-
setTimeout(self.close, 0);
|
|
2430
|
-
} else {
|
|
2431
|
-
self.close();
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
function selectDate(e) {
|
|
2435
|
-
e.preventDefault();
|
|
2436
|
-
e.stopPropagation();
|
|
2437
|
-
var isSelectable = function(day) {
|
|
2438
|
-
return day.classList && day.classList.contains("flatpickr-day") && !day.classList.contains("flatpickr-disabled") && !day.classList.contains("notAllowed");
|
|
2439
|
-
};
|
|
2440
|
-
var t = findParent(e.target, isSelectable);
|
|
2441
|
-
if (t === void 0)
|
|
2442
|
-
return;
|
|
2443
|
-
var target = t;
|
|
2444
|
-
var selectedDate = self.latestSelectedDateObj = new Date(target.dateObj.getTime());
|
|
2445
|
-
var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || selectedDate.getMonth() > self.currentMonth + self.config.showMonths - 1) && self.config.mode !== "range";
|
|
2446
|
-
self.selectedDateElem = target;
|
|
2447
|
-
if (self.config.mode === "single")
|
|
2448
|
-
self.selectedDates = [selectedDate];
|
|
2449
|
-
else if (self.config.mode === "multiple") {
|
|
2450
|
-
var selectedIndex = isDateSelected(selectedDate);
|
|
2451
|
-
if (selectedIndex)
|
|
2452
|
-
self.selectedDates.splice(parseInt(selectedIndex), 1);
|
|
2453
|
-
else
|
|
2454
|
-
self.selectedDates.push(selectedDate);
|
|
2455
|
-
} else if (self.config.mode === "range") {
|
|
2456
|
-
if (self.selectedDates.length === 2) {
|
|
2457
|
-
self.clear(false, false);
|
|
2458
|
-
}
|
|
2459
|
-
self.latestSelectedDateObj = selectedDate;
|
|
2460
|
-
self.selectedDates.push(selectedDate);
|
|
2461
|
-
if (compareDates(selectedDate, self.selectedDates[0], true) !== 0)
|
|
2462
|
-
self.selectedDates.sort(function(a, b) {
|
|
2463
|
-
return a.getTime() - b.getTime();
|
|
2464
|
-
});
|
|
2465
|
-
}
|
|
2466
|
-
setHoursFromInputs();
|
|
2467
|
-
if (shouldChangeMonth) {
|
|
2468
|
-
var isNewYear = self.currentYear !== selectedDate.getFullYear();
|
|
2469
|
-
self.currentYear = selectedDate.getFullYear();
|
|
2470
|
-
self.currentMonth = selectedDate.getMonth();
|
|
2471
|
-
if (isNewYear) {
|
|
2472
|
-
triggerEvent("onYearChange");
|
|
2473
|
-
buildMonthSwitch();
|
|
2474
|
-
}
|
|
2475
|
-
triggerEvent("onMonthChange");
|
|
2476
|
-
}
|
|
2477
|
-
updateNavigationCurrentMonth();
|
|
2478
|
-
buildDays();
|
|
2479
|
-
updateValue();
|
|
2480
|
-
if (self.config.enableTime)
|
|
2481
|
-
setTimeout(function() {
|
|
2482
|
-
return self.showTimeInput = true;
|
|
2483
|
-
}, 50);
|
|
2484
|
-
if (!shouldChangeMonth && self.config.mode !== "range" && self.config.showMonths === 1)
|
|
2485
|
-
focusOnDayElem(target);
|
|
2486
|
-
else if (self.selectedDateElem !== void 0 && self.hourElement === void 0) {
|
|
2487
|
-
self.selectedDateElem && self.selectedDateElem.focus();
|
|
2488
|
-
}
|
|
2489
|
-
if (self.hourElement !== void 0)
|
|
2490
|
-
self.hourElement !== void 0 && self.hourElement.focus();
|
|
2491
|
-
if (self.config.closeOnSelect) {
|
|
2492
|
-
var single = self.config.mode === "single" && !self.config.enableTime;
|
|
2493
|
-
var range = self.config.mode === "range" && self.selectedDates.length === 2 && !self.config.enableTime;
|
|
2494
|
-
if (single || range) {
|
|
2495
|
-
focusAndClose();
|
|
2496
|
-
}
|
|
2497
|
-
}
|
|
2498
|
-
triggerChange();
|
|
2499
|
-
}
|
|
2500
|
-
var CALLBACKS = {
|
|
2501
|
-
locale: [setupLocale, updateWeekdays],
|
|
2502
|
-
showMonths: [buildMonths, setCalendarWidth, buildWeekdays],
|
|
2503
|
-
minDate: [jumpToDate],
|
|
2504
|
-
maxDate: [jumpToDate]
|
|
2505
|
-
};
|
|
2506
|
-
function set(option, value) {
|
|
2507
|
-
if (option !== null && typeof option === "object") {
|
|
2508
|
-
Object.assign(self.config, option);
|
|
2509
|
-
for (var key in option) {
|
|
2510
|
-
if (CALLBACKS[key] !== void 0)
|
|
2511
|
-
CALLBACKS[key].forEach(function(x) {
|
|
2512
|
-
return x();
|
|
2513
|
-
});
|
|
2514
|
-
}
|
|
2515
|
-
} else {
|
|
2516
|
-
self.config[option] = value;
|
|
2517
|
-
if (CALLBACKS[option] !== void 0)
|
|
2518
|
-
CALLBACKS[option].forEach(function(x) {
|
|
2519
|
-
return x();
|
|
2520
|
-
});
|
|
2521
|
-
else if (HOOKS.indexOf(option) > -1)
|
|
2522
|
-
self.config[option] = arrayify(value);
|
|
2523
|
-
}
|
|
2524
|
-
self.redraw();
|
|
2525
|
-
updateValue(false);
|
|
2526
|
-
}
|
|
2527
|
-
function setSelectedDate(inputDate, format) {
|
|
2528
|
-
var dates = [];
|
|
2529
|
-
if (inputDate instanceof Array)
|
|
2530
|
-
dates = inputDate.map(function(d) {
|
|
2531
|
-
return self.parseDate(d, format);
|
|
2532
|
-
});
|
|
2533
|
-
else if (inputDate instanceof Date || typeof inputDate === "number")
|
|
2534
|
-
dates = [self.parseDate(inputDate, format)];
|
|
2535
|
-
else if (typeof inputDate === "string") {
|
|
2536
|
-
switch (self.config.mode) {
|
|
2537
|
-
case "single":
|
|
2538
|
-
case "time":
|
|
2539
|
-
dates = [self.parseDate(inputDate, format)];
|
|
2540
|
-
break;
|
|
2541
|
-
case "multiple":
|
|
2542
|
-
dates = inputDate.split(self.config.conjunction).map(function(date) {
|
|
2543
|
-
return self.parseDate(date, format);
|
|
2544
|
-
});
|
|
2545
|
-
break;
|
|
2546
|
-
case "range":
|
|
2547
|
-
dates = inputDate.split(self.l10n.rangeSeparator).map(function(date) {
|
|
2548
|
-
return self.parseDate(date, format);
|
|
2549
|
-
});
|
|
2550
|
-
break;
|
|
2551
|
-
}
|
|
2552
|
-
} else
|
|
2553
|
-
self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate)));
|
|
2554
|
-
self.selectedDates = dates.filter(function(d) {
|
|
2555
|
-
return d instanceof Date && isEnabled(d, false);
|
|
2556
|
-
});
|
|
2557
|
-
if (self.config.mode === "range")
|
|
2558
|
-
self.selectedDates.sort(function(a, b) {
|
|
2559
|
-
return a.getTime() - b.getTime();
|
|
2560
|
-
});
|
|
2561
|
-
}
|
|
2562
|
-
function setDate(date, triggerChange2, format) {
|
|
2563
|
-
if (triggerChange2 === void 0) {
|
|
2564
|
-
triggerChange2 = false;
|
|
2565
|
-
}
|
|
2566
|
-
if (format === void 0) {
|
|
2567
|
-
format = self.config.dateFormat;
|
|
2568
|
-
}
|
|
2569
|
-
if (date !== 0 && !date || date instanceof Array && date.length === 0)
|
|
2570
|
-
return self.clear(triggerChange2);
|
|
2571
|
-
setSelectedDate(date, format);
|
|
2572
|
-
self.showTimeInput = self.selectedDates.length > 0;
|
|
2573
|
-
self.latestSelectedDateObj = self.selectedDates[self.selectedDates.length - 1];
|
|
2574
|
-
self.redraw();
|
|
2575
|
-
jumpToDate();
|
|
2576
|
-
setHoursFromDate();
|
|
2577
|
-
if (self.selectedDates.length === 0) {
|
|
2578
|
-
self.clear(false);
|
|
2579
|
-
}
|
|
2580
|
-
updateValue(triggerChange2);
|
|
2581
|
-
if (triggerChange2)
|
|
2582
|
-
triggerEvent("onChange");
|
|
2583
|
-
}
|
|
2584
|
-
function parseDateRules(arr) {
|
|
2585
|
-
return arr.slice().map(function(rule) {
|
|
2586
|
-
if (typeof rule === "string" || typeof rule === "number" || rule instanceof Date) {
|
|
2587
|
-
return self.parseDate(rule, void 0, true);
|
|
2588
|
-
} else if (rule && typeof rule === "object" && rule.from && rule.to)
|
|
2589
|
-
return {
|
|
2590
|
-
from: self.parseDate(rule.from, void 0),
|
|
2591
|
-
to: self.parseDate(rule.to, void 0)
|
|
2592
|
-
};
|
|
2593
|
-
return rule;
|
|
2594
|
-
}).filter(function(x) {
|
|
2595
|
-
return x;
|
|
2596
|
-
});
|
|
2597
|
-
}
|
|
2598
|
-
function setupDates() {
|
|
2599
|
-
self.selectedDates = [];
|
|
2600
|
-
self.now = self.parseDate(self.config.now) || /* @__PURE__ */ new Date();
|
|
2601
|
-
var preloadedDate = self.config.defaultDate || ((self.input.nodeName === "INPUT" || self.input.nodeName === "TEXTAREA") && self.input.placeholder && self.input.value === self.input.placeholder ? null : self.input.value);
|
|
2602
|
-
if (preloadedDate)
|
|
2603
|
-
setSelectedDate(preloadedDate, self.config.dateFormat);
|
|
2604
|
-
self._initialDate = self.selectedDates.length > 0 ? self.selectedDates[0] : self.config.minDate && self.config.minDate.getTime() > self.now.getTime() ? self.config.minDate : self.config.maxDate && self.config.maxDate.getTime() < self.now.getTime() ? self.config.maxDate : self.now;
|
|
2605
|
-
self.currentYear = self._initialDate.getFullYear();
|
|
2606
|
-
self.currentMonth = self._initialDate.getMonth();
|
|
2607
|
-
if (self.selectedDates.length > 0)
|
|
2608
|
-
self.latestSelectedDateObj = self.selectedDates[0];
|
|
2609
|
-
if (self.config.minTime !== void 0)
|
|
2610
|
-
self.config.minTime = self.parseDate(self.config.minTime, "H:i");
|
|
2611
|
-
if (self.config.maxTime !== void 0)
|
|
2612
|
-
self.config.maxTime = self.parseDate(self.config.maxTime, "H:i");
|
|
2613
|
-
self.minDateHasTime = !!self.config.minDate && (self.config.minDate.getHours() > 0 || self.config.minDate.getMinutes() > 0 || self.config.minDate.getSeconds() > 0);
|
|
2614
|
-
self.maxDateHasTime = !!self.config.maxDate && (self.config.maxDate.getHours() > 0 || self.config.maxDate.getMinutes() > 0 || self.config.maxDate.getSeconds() > 0);
|
|
2615
|
-
Object.defineProperty(self, "showTimeInput", {
|
|
2616
|
-
get: function() {
|
|
2617
|
-
return self._showTimeInput;
|
|
2618
|
-
},
|
|
2619
|
-
set: function(bool) {
|
|
2620
|
-
self._showTimeInput = bool;
|
|
2621
|
-
if (self.calendarContainer)
|
|
2622
|
-
toggleClass(self.calendarContainer, "showTimeInput", bool);
|
|
2623
|
-
self.isOpen && positionCalendar();
|
|
2624
|
-
}
|
|
2625
|
-
});
|
|
2626
|
-
}
|
|
2627
|
-
function setupInputs() {
|
|
2628
|
-
self.input = self.config.wrap ? element.querySelector("[data-input]") : element;
|
|
2629
|
-
if (!self.input) {
|
|
2630
|
-
self.config.errorHandler(new Error("Invalid input element specified"));
|
|
2631
|
-
return;
|
|
2632
|
-
}
|
|
2633
|
-
self.input._type = self.input.type;
|
|
2634
|
-
self.input.type = "text";
|
|
2635
|
-
self.input.classList.add("flatpickr-input");
|
|
2636
|
-
self._input = self.input;
|
|
2637
|
-
if (self.config.altInput) {
|
|
2638
|
-
self.altInput = createElement(self.input.nodeName, self.config.altInputClass);
|
|
2639
|
-
self._input = self.altInput;
|
|
2640
|
-
self.altInput.placeholder = self.input.placeholder;
|
|
2641
|
-
self.altInput.disabled = self.input.disabled;
|
|
2642
|
-
self.altInput.required = self.input.required;
|
|
2643
|
-
self.altInput.tabIndex = self.input.tabIndex;
|
|
2644
|
-
self.altInput.type = "text";
|
|
2645
|
-
self.input.setAttribute("type", "hidden");
|
|
2646
|
-
if (!self.config.static && self.input.parentNode)
|
|
2647
|
-
self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);
|
|
2648
|
-
}
|
|
2649
|
-
if (!self.config.allowInput)
|
|
2650
|
-
self._input.setAttribute("readonly", "readonly");
|
|
2651
|
-
self._positionElement = self.config.positionElement || self._input;
|
|
2652
|
-
}
|
|
2653
|
-
function setupMobile() {
|
|
2654
|
-
var inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date";
|
|
2655
|
-
self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile");
|
|
2656
|
-
self.mobileInput.step = self.input.getAttribute("step") || "any";
|
|
2657
|
-
self.mobileInput.tabIndex = 1;
|
|
2658
|
-
self.mobileInput.type = inputType;
|
|
2659
|
-
self.mobileInput.disabled = self.input.disabled;
|
|
2660
|
-
self.mobileInput.required = self.input.required;
|
|
2661
|
-
self.mobileInput.placeholder = self.input.placeholder;
|
|
2662
|
-
self.mobileFormatStr = inputType === "datetime-local" ? "Y-m-d\\TH:i:S" : inputType === "date" ? "Y-m-d" : "H:i:S";
|
|
2663
|
-
if (self.selectedDates.length > 0) {
|
|
2664
|
-
self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr);
|
|
2665
|
-
}
|
|
2666
|
-
if (self.config.minDate)
|
|
2667
|
-
self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d");
|
|
2668
|
-
if (self.config.maxDate)
|
|
2669
|
-
self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d");
|
|
2670
|
-
self.input.type = "hidden";
|
|
2671
|
-
if (self.altInput !== void 0)
|
|
2672
|
-
self.altInput.type = "hidden";
|
|
2673
|
-
try {
|
|
2674
|
-
if (self.input.parentNode)
|
|
2675
|
-
self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);
|
|
2676
|
-
} catch (_a) {
|
|
2677
|
-
}
|
|
2678
|
-
bind(self.mobileInput, "change", function(e) {
|
|
2679
|
-
self.setDate(e.target.value, false, self.mobileFormatStr);
|
|
2680
|
-
triggerEvent("onChange");
|
|
2681
|
-
triggerEvent("onClose");
|
|
2682
|
-
});
|
|
2683
|
-
}
|
|
2684
|
-
function toggle(e) {
|
|
2685
|
-
if (self.isOpen === true)
|
|
2686
|
-
return self.close();
|
|
2687
|
-
self.open(e);
|
|
2688
|
-
}
|
|
2689
|
-
function triggerEvent(event, data) {
|
|
2690
|
-
if (self.config === void 0)
|
|
2691
|
-
return;
|
|
2692
|
-
var hooks = self.config[event];
|
|
2693
|
-
if (hooks !== void 0 && hooks.length > 0) {
|
|
2694
|
-
for (var i = 0; hooks[i] && i < hooks.length; i++)
|
|
2695
|
-
hooks[i](self.selectedDates, self.input.value, self, data);
|
|
2696
|
-
}
|
|
2697
|
-
if (event === "onChange") {
|
|
2698
|
-
self.input.dispatchEvent(createEvent("change"));
|
|
2699
|
-
self.input.dispatchEvent(createEvent("input"));
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
function createEvent(name) {
|
|
2703
|
-
var e = document.createEvent("Event");
|
|
2704
|
-
e.initEvent(name, true, true);
|
|
2705
|
-
return e;
|
|
2706
|
-
}
|
|
2707
|
-
function isDateSelected(date) {
|
|
2708
|
-
for (var i = 0; i < self.selectedDates.length; i++) {
|
|
2709
|
-
if (compareDates(self.selectedDates[i], date) === 0)
|
|
2710
|
-
return "" + i;
|
|
2711
|
-
}
|
|
2712
|
-
return false;
|
|
2713
|
-
}
|
|
2714
|
-
function isDateInRange(date) {
|
|
2715
|
-
if (self.config.mode !== "range" || self.selectedDates.length < 2)
|
|
2716
|
-
return false;
|
|
2717
|
-
return compareDates(date, self.selectedDates[0]) >= 0 && compareDates(date, self.selectedDates[1]) <= 0;
|
|
2718
|
-
}
|
|
2719
|
-
function updateNavigationCurrentMonth() {
|
|
2720
|
-
if (self.config.noCalendar || self.isMobile || !self.monthNav)
|
|
2721
|
-
return;
|
|
2722
|
-
self.yearElements.forEach(function(yearElement, i) {
|
|
2723
|
-
var d = new Date(self.currentYear, self.currentMonth, 1);
|
|
2724
|
-
d.setMonth(self.currentMonth + i);
|
|
2725
|
-
if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") {
|
|
2726
|
-
self.monthElements[i].textContent = monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " ";
|
|
2727
|
-
} else {
|
|
2728
|
-
self.monthsDropdownContainer.value = d.getMonth().toString();
|
|
2729
|
-
}
|
|
2730
|
-
yearElement.value = d.getFullYear().toString();
|
|
2731
|
-
});
|
|
2732
|
-
self._hidePrevMonthArrow = self.config.minDate !== void 0 && (self.currentYear === self.config.minDate.getFullYear() ? self.currentMonth <= self.config.minDate.getMonth() : self.currentYear < self.config.minDate.getFullYear());
|
|
2733
|
-
self._hideNextMonthArrow = self.config.maxDate !== void 0 && (self.currentYear === self.config.maxDate.getFullYear() ? self.currentMonth + 1 > self.config.maxDate.getMonth() : self.currentYear > self.config.maxDate.getFullYear());
|
|
2734
|
-
}
|
|
2735
|
-
function getDateStr(format) {
|
|
2736
|
-
return self.selectedDates.map(function(dObj) {
|
|
2737
|
-
return self.formatDate(dObj, format);
|
|
2738
|
-
}).filter(function(d, i, arr) {
|
|
2739
|
-
return self.config.mode !== "range" || self.config.enableTime || arr.indexOf(d) === i;
|
|
2740
|
-
}).join(self.config.mode !== "range" ? self.config.conjunction : self.l10n.rangeSeparator);
|
|
2741
|
-
}
|
|
2742
|
-
function updateValue(triggerChange2) {
|
|
2743
|
-
if (triggerChange2 === void 0) {
|
|
2744
|
-
triggerChange2 = true;
|
|
2745
|
-
}
|
|
2746
|
-
if (self.mobileInput !== void 0 && self.mobileFormatStr) {
|
|
2747
|
-
self.mobileInput.value = self.latestSelectedDateObj !== void 0 ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) : "";
|
|
2748
|
-
}
|
|
2749
|
-
self.input.value = getDateStr(self.config.dateFormat);
|
|
2750
|
-
if (self.altInput !== void 0) {
|
|
2751
|
-
self.altInput.value = getDateStr(self.config.altFormat);
|
|
2752
|
-
}
|
|
2753
|
-
if (triggerChange2 !== false)
|
|
2754
|
-
triggerEvent("onValueUpdate");
|
|
2755
|
-
}
|
|
2756
|
-
function onMonthNavClick(e) {
|
|
2757
|
-
var isPrevMonth = self.prevMonthNav.contains(e.target);
|
|
2758
|
-
var isNextMonth = self.nextMonthNav.contains(e.target);
|
|
2759
|
-
if (isPrevMonth || isNextMonth) {
|
|
2760
|
-
changeMonth(isPrevMonth ? -1 : 1);
|
|
2761
|
-
} else if (self.yearElements.indexOf(e.target) >= 0) {
|
|
2762
|
-
e.target.select();
|
|
2763
|
-
} else if (e.target.classList.contains("arrowUp")) {
|
|
2764
|
-
self.changeYear(self.currentYear + 1);
|
|
2765
|
-
} else if (e.target.classList.contains("arrowDown")) {
|
|
2766
|
-
self.changeYear(self.currentYear - 1);
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
function timeWrapper(e) {
|
|
2770
|
-
e.preventDefault();
|
|
2771
|
-
var isKeyDown = e.type === "keydown", input2 = e.target;
|
|
2772
|
-
if (self.amPM !== void 0 && e.target === self.amPM) {
|
|
2773
|
-
self.amPM.textContent = self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
|
|
2774
|
-
}
|
|
2775
|
-
var min = parseFloat(input2.getAttribute("min")), max = parseFloat(input2.getAttribute("max")), step = parseFloat(input2.getAttribute("step")), curValue = parseInt(input2.value, 10), delta = e.delta || (isKeyDown ? e.which === 38 ? 1 : -1 : 0);
|
|
2776
|
-
var newValue = curValue + step * delta;
|
|
2777
|
-
if (typeof input2.value !== "undefined" && input2.value.length === 2) {
|
|
2778
|
-
var isHourElem = input2 === self.hourElement, isMinuteElem = input2 === self.minuteElement;
|
|
2779
|
-
if (newValue < min) {
|
|
2780
|
-
newValue = max + newValue + int(!isHourElem) + (int(isHourElem) && int(!self.amPM));
|
|
2781
|
-
if (isMinuteElem)
|
|
2782
|
-
incrementNumInput(void 0, -1, self.hourElement);
|
|
2783
|
-
} else if (newValue > max) {
|
|
2784
|
-
newValue = input2 === self.hourElement ? newValue - max - int(!self.amPM) : min;
|
|
2785
|
-
if (isMinuteElem)
|
|
2786
|
-
incrementNumInput(void 0, 1, self.hourElement);
|
|
2787
|
-
}
|
|
2788
|
-
if (self.amPM && isHourElem && (step === 1 ? newValue + curValue === 23 : Math.abs(newValue - curValue) > step)) {
|
|
2789
|
-
self.amPM.textContent = self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])];
|
|
2790
|
-
}
|
|
2791
|
-
input2.value = pad(newValue);
|
|
2792
|
-
}
|
|
2793
|
-
}
|
|
2794
|
-
init();
|
|
2795
|
-
return self;
|
|
2796
|
-
}
|
|
2797
|
-
function _flatpickr(nodeList, config) {
|
|
2798
|
-
var nodes = Array.prototype.slice.call(nodeList).filter(function(x) {
|
|
2799
|
-
return x instanceof HTMLElement;
|
|
2800
|
-
});
|
|
2801
|
-
var instances = [];
|
|
2802
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
2803
|
-
var node = nodes[i];
|
|
2804
|
-
try {
|
|
2805
|
-
if (node.getAttribute("data-fp-omit") !== null)
|
|
2806
|
-
continue;
|
|
2807
|
-
if (node._flatpickr !== void 0) {
|
|
2808
|
-
node._flatpickr.destroy();
|
|
2809
|
-
node._flatpickr = void 0;
|
|
2810
|
-
}
|
|
2811
|
-
node._flatpickr = FlatpickrInstance(node, config || {});
|
|
2812
|
-
instances.push(node._flatpickr);
|
|
2813
|
-
} catch (e) {
|
|
2814
|
-
console.error(e);
|
|
2815
|
-
}
|
|
2816
|
-
}
|
|
2817
|
-
return instances.length === 1 ? instances[0] : instances;
|
|
2818
|
-
}
|
|
2819
|
-
if (typeof HTMLElement !== "undefined" && typeof HTMLCollection !== "undefined" && typeof NodeList !== "undefined") {
|
|
2820
|
-
HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function(config) {
|
|
2821
|
-
return _flatpickr(this, config);
|
|
2822
|
-
};
|
|
2823
|
-
HTMLElement.prototype.flatpickr = function(config) {
|
|
2824
|
-
return _flatpickr([this], config);
|
|
2825
|
-
};
|
|
2826
|
-
}
|
|
2827
|
-
var flatpickr2 = function(selector, config) {
|
|
2828
|
-
if (typeof selector === "string") {
|
|
2829
|
-
return _flatpickr(window.document.querySelectorAll(selector), config);
|
|
2830
|
-
} else if (selector instanceof Node) {
|
|
2831
|
-
return _flatpickr([selector], config);
|
|
2832
|
-
} else {
|
|
2833
|
-
return _flatpickr(selector, config);
|
|
2834
|
-
}
|
|
2835
|
-
};
|
|
2836
|
-
flatpickr2.defaultConfig = {};
|
|
2837
|
-
flatpickr2.l10ns = {
|
|
2838
|
-
en: __assign({}, english),
|
|
2839
|
-
"default": __assign({}, english)
|
|
2840
|
-
};
|
|
2841
|
-
flatpickr2.localize = function(l10n) {
|
|
2842
|
-
flatpickr2.l10ns["default"] = __assign({}, flatpickr2.l10ns["default"], l10n);
|
|
2843
|
-
};
|
|
2844
|
-
flatpickr2.setDefaults = function(config) {
|
|
2845
|
-
flatpickr2.defaultConfig = __assign({}, flatpickr2.defaultConfig, config);
|
|
2846
|
-
};
|
|
2847
|
-
flatpickr2.parseDate = createDateParser({});
|
|
2848
|
-
flatpickr2.formatDate = createDateFormatter({});
|
|
2849
|
-
flatpickr2.compareDates = compareDates;
|
|
2850
|
-
if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") {
|
|
2851
|
-
jQuery.fn.flatpickr = function(config) {
|
|
2852
|
-
return _flatpickr(this, config);
|
|
2853
|
-
};
|
|
2854
|
-
}
|
|
2855
|
-
Date.prototype.fp_incr = function(days) {
|
|
2856
|
-
return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days));
|
|
2857
|
-
};
|
|
2858
|
-
if (typeof window !== "undefined") {
|
|
2859
|
-
window.flatpickr = flatpickr2;
|
|
2860
|
-
}
|
|
2861
|
-
return flatpickr2;
|
|
2862
|
-
});
|
|
2863
|
-
})(flatpickr$1);
|
|
2864
|
-
return flatpickr$1.exports;
|
|
2865
|
-
}
|
|
2866
|
-
var hasRequiredBuild;
|
|
2867
|
-
function requireBuild() {
|
|
2868
|
-
if (hasRequiredBuild) return build;
|
|
2869
|
-
hasRequiredBuild = 1;
|
|
2870
|
-
(function(exports) {
|
|
2871
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2872
|
-
value: true
|
|
2873
|
-
});
|
|
2874
|
-
exports["default"] = void 0;
|
|
2875
|
-
var _react = _interopRequireWildcard(React);
|
|
2876
|
-
var _propTypes = _interopRequireDefault(/* @__PURE__ */ requirePropTypes());
|
|
2877
|
-
var _flatpickr = _interopRequireDefault(requireFlatpickr());
|
|
2878
|
-
function _interopRequireDefault(obj) {
|
|
2879
|
-
return obj && obj.__esModule ? obj : { "default": obj };
|
|
2880
|
-
}
|
|
2881
|
-
function _interopRequireWildcard(obj) {
|
|
2882
|
-
if (obj && obj.__esModule) {
|
|
2883
|
-
return obj;
|
|
2884
|
-
} else {
|
|
2885
|
-
var newObj = {};
|
|
2886
|
-
if (obj != null) {
|
|
2887
|
-
for (var key in obj) {
|
|
2888
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
2889
|
-
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
2890
|
-
if (desc.get || desc.set) {
|
|
2891
|
-
Object.defineProperty(newObj, key, desc);
|
|
2892
|
-
} else {
|
|
2893
|
-
newObj[key] = obj[key];
|
|
2894
|
-
}
|
|
2895
|
-
}
|
|
2896
|
-
}
|
|
2897
|
-
}
|
|
2898
|
-
newObj["default"] = obj;
|
|
2899
|
-
return newObj;
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
function _typeof(obj) {
|
|
2903
|
-
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
2904
|
-
_typeof = function _typeof2(obj2) {
|
|
2905
|
-
return typeof obj2;
|
|
2906
|
-
};
|
|
2907
|
-
} else {
|
|
2908
|
-
_typeof = function _typeof2(obj2) {
|
|
2909
|
-
return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
2910
|
-
};
|
|
2911
|
-
}
|
|
2912
|
-
return _typeof(obj);
|
|
2913
|
-
}
|
|
2914
|
-
function _extends() {
|
|
2915
|
-
_extends = Object.assign || function(target) {
|
|
2916
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
2917
|
-
var source = arguments[i];
|
|
2918
|
-
for (var key in source) {
|
|
2919
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
2920
|
-
target[key] = source[key];
|
|
2921
|
-
}
|
|
2922
|
-
}
|
|
2923
|
-
}
|
|
2924
|
-
return target;
|
|
2925
|
-
};
|
|
2926
|
-
return _extends.apply(this, arguments);
|
|
2927
|
-
}
|
|
2928
|
-
function _objectWithoutProperties(source, excluded) {
|
|
2929
|
-
if (source == null) return {};
|
|
2930
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
2931
|
-
var key, i;
|
|
2932
|
-
if (Object.getOwnPropertySymbols) {
|
|
2933
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
2934
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
2935
|
-
key = sourceSymbolKeys[i];
|
|
2936
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
2937
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
2938
|
-
target[key] = source[key];
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
2941
|
-
return target;
|
|
2942
|
-
}
|
|
2943
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
2944
|
-
if (source == null) return {};
|
|
2945
|
-
var target = {};
|
|
2946
|
-
var sourceKeys = Object.keys(source);
|
|
2947
|
-
var key, i;
|
|
2948
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
2949
|
-
key = sourceKeys[i];
|
|
2950
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
2951
|
-
target[key] = source[key];
|
|
2952
|
-
}
|
|
2953
|
-
return target;
|
|
2954
|
-
}
|
|
2955
|
-
function _objectSpread(target) {
|
|
2956
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
2957
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
2958
|
-
var ownKeys = Object.keys(source);
|
|
2959
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
2960
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
2961
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
2962
|
-
}));
|
|
2963
|
-
}
|
|
2964
|
-
ownKeys.forEach(function(key) {
|
|
2965
|
-
_defineProperty(target, key, source[key]);
|
|
2966
|
-
});
|
|
2967
|
-
}
|
|
2968
|
-
return target;
|
|
2969
|
-
}
|
|
2970
|
-
function _classCallCheck(instance, Constructor) {
|
|
2971
|
-
if (!(instance instanceof Constructor)) {
|
|
2972
|
-
throw new TypeError("Cannot call a class as a function");
|
|
2973
|
-
}
|
|
2974
|
-
}
|
|
2975
|
-
function _defineProperties(target, props) {
|
|
2976
|
-
for (var i = 0; i < props.length; i++) {
|
|
2977
|
-
var descriptor = props[i];
|
|
2978
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
2979
|
-
descriptor.configurable = true;
|
|
2980
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
2981
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2982
|
-
}
|
|
2983
|
-
}
|
|
2984
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
2985
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
2986
|
-
return Constructor;
|
|
2987
|
-
}
|
|
2988
|
-
function _possibleConstructorReturn(self, call) {
|
|
2989
|
-
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
2990
|
-
return call;
|
|
2991
|
-
}
|
|
2992
|
-
return _assertThisInitialized(self);
|
|
2993
|
-
}
|
|
2994
|
-
function _assertThisInitialized(self) {
|
|
2995
|
-
if (self === void 0) {
|
|
2996
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2997
|
-
}
|
|
2998
|
-
return self;
|
|
2999
|
-
}
|
|
3000
|
-
function _getPrototypeOf(o) {
|
|
3001
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
|
|
3002
|
-
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
3003
|
-
};
|
|
3004
|
-
return _getPrototypeOf(o);
|
|
3005
|
-
}
|
|
3006
|
-
function _inherits(subClass, superClass) {
|
|
3007
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
3008
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
3009
|
-
}
|
|
3010
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
3011
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
3012
|
-
}
|
|
3013
|
-
function _setPrototypeOf(o, p) {
|
|
3014
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
|
|
3015
|
-
o2.__proto__ = p2;
|
|
3016
|
-
return o2;
|
|
3017
|
-
};
|
|
3018
|
-
return _setPrototypeOf(o, p);
|
|
3019
|
-
}
|
|
3020
|
-
function _defineProperty(obj, key, value) {
|
|
3021
|
-
if (key in obj) {
|
|
3022
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
3023
|
-
} else {
|
|
3024
|
-
obj[key] = value;
|
|
3025
|
-
}
|
|
3026
|
-
return obj;
|
|
3027
|
-
}
|
|
3028
|
-
var hooks = ["onChange", "onOpen", "onClose", "onMonthChange", "onYearChange", "onReady", "onValueUpdate", "onDayCreate"];
|
|
3029
|
-
var hookPropType = _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].arrayOf(_propTypes["default"].func)]);
|
|
3030
|
-
var callbacks = ["onCreate", "onDestroy"];
|
|
3031
|
-
var callbackPropTypes = _propTypes["default"].func;
|
|
3032
|
-
var DateTimePicker = /* @__PURE__ */ function(_Component) {
|
|
3033
|
-
_inherits(DateTimePicker2, _Component);
|
|
3034
|
-
function DateTimePicker2() {
|
|
3035
|
-
_classCallCheck(this, DateTimePicker2);
|
|
3036
|
-
return _possibleConstructorReturn(this, _getPrototypeOf(DateTimePicker2).apply(this, arguments));
|
|
3037
|
-
}
|
|
3038
|
-
_createClass(DateTimePicker2, [{
|
|
3039
|
-
key: "componentDidUpdate",
|
|
3040
|
-
value: function componentDidUpdate(prevProps) {
|
|
3041
|
-
var _this = this;
|
|
3042
|
-
if (this.props.hasOwnProperty("value") && this.props.value !== prevProps.value) {
|
|
3043
|
-
this.flatpickr.setDate(this.props.value, false);
|
|
3044
|
-
}
|
|
3045
|
-
var options = this.props.options;
|
|
3046
|
-
var prevOptions = prevProps.options;
|
|
3047
|
-
hooks.forEach(function(hook) {
|
|
3048
|
-
if (_this.props.hasOwnProperty(hook)) {
|
|
3049
|
-
options[hook] = _this.props[hook];
|
|
3050
|
-
}
|
|
3051
|
-
if (prevProps.hasOwnProperty(hook)) {
|
|
3052
|
-
prevOptions[hook] = prevProps[hook];
|
|
3053
|
-
}
|
|
3054
|
-
});
|
|
3055
|
-
var optionsKeys = Object.getOwnPropertyNames(options);
|
|
3056
|
-
for (var index = optionsKeys.length - 1; index >= 0; index--) {
|
|
3057
|
-
var key = optionsKeys[index];
|
|
3058
|
-
var value = options[key];
|
|
3059
|
-
if (value !== prevOptions[key]) {
|
|
3060
|
-
if (hooks.indexOf(key) !== -1 && !Array.isArray(value)) {
|
|
3061
|
-
value = [value];
|
|
3062
|
-
}
|
|
3063
|
-
this.flatpickr.set(key, value);
|
|
3064
|
-
}
|
|
3065
|
-
}
|
|
3066
|
-
}
|
|
3067
|
-
}, {
|
|
3068
|
-
key: "componentDidMount",
|
|
3069
|
-
value: function componentDidMount() {
|
|
3070
|
-
var _this2 = this;
|
|
3071
|
-
var options = _objectSpread({
|
|
3072
|
-
onClose: function onClose() {
|
|
3073
|
-
_this2.node.blur && _this2.node.blur();
|
|
3074
|
-
}
|
|
3075
|
-
}, this.props.options);
|
|
3076
|
-
hooks.forEach(function(hook) {
|
|
3077
|
-
if (_this2.props[hook]) {
|
|
3078
|
-
options[hook] = _this2.props[hook];
|
|
3079
|
-
}
|
|
3080
|
-
});
|
|
3081
|
-
this.flatpickr = new _flatpickr["default"](this.node, options);
|
|
3082
|
-
if (this.props.hasOwnProperty("value")) {
|
|
3083
|
-
this.flatpickr.setDate(this.props.value, false);
|
|
3084
|
-
}
|
|
3085
|
-
var onCreate = this.props.onCreate;
|
|
3086
|
-
if (onCreate) onCreate(this.flatpickr);
|
|
3087
|
-
}
|
|
3088
|
-
}, {
|
|
3089
|
-
key: "componentWillUnmount",
|
|
3090
|
-
value: function componentWillUnmount() {
|
|
3091
|
-
var onDestroy = this.props.onDestroy;
|
|
3092
|
-
if (onDestroy) onDestroy(this.flatpickr);
|
|
3093
|
-
this.flatpickr.destroy();
|
|
3094
|
-
}
|
|
3095
|
-
}, {
|
|
3096
|
-
key: "render",
|
|
3097
|
-
value: function render() {
|
|
3098
|
-
var _this3 = this;
|
|
3099
|
-
var _this$props = this.props, options = _this$props.options, defaultValue = _this$props.defaultValue, value = _this$props.value, children = _this$props.children, render2 = _this$props.render, props = _objectWithoutProperties(_this$props, ["options", "defaultValue", "value", "children", "render"]);
|
|
3100
|
-
var ref = function ref2(node) {
|
|
3101
|
-
_this3.node = node;
|
|
3102
|
-
};
|
|
3103
|
-
hooks.forEach(function(hook) {
|
|
3104
|
-
delete props[hook];
|
|
3105
|
-
});
|
|
3106
|
-
callbacks.forEach(function(callback) {
|
|
3107
|
-
delete props[callback];
|
|
3108
|
-
});
|
|
3109
|
-
if (render2) return render2(_objectSpread({}, props, {
|
|
3110
|
-
defaultValue,
|
|
3111
|
-
value
|
|
3112
|
-
}), ref);
|
|
3113
|
-
return options.wrap ? _react["default"].createElement("div", _extends({}, props, {
|
|
3114
|
-
ref
|
|
3115
|
-
}), children) : _react["default"].createElement("input", _extends({}, props, {
|
|
3116
|
-
defaultValue,
|
|
3117
|
-
ref
|
|
3118
|
-
}));
|
|
3119
|
-
}
|
|
3120
|
-
}]);
|
|
3121
|
-
return DateTimePicker2;
|
|
3122
|
-
}(_react.Component);
|
|
3123
|
-
_defineProperty(DateTimePicker, "propTypes", {
|
|
3124
|
-
defaultValue: _propTypes["default"].string,
|
|
3125
|
-
options: _propTypes["default"].object,
|
|
3126
|
-
onChange: hookPropType,
|
|
3127
|
-
onOpen: hookPropType,
|
|
3128
|
-
onClose: hookPropType,
|
|
3129
|
-
onMonthChange: hookPropType,
|
|
3130
|
-
onYearChange: hookPropType,
|
|
3131
|
-
onReady: hookPropType,
|
|
3132
|
-
onValueUpdate: hookPropType,
|
|
3133
|
-
onDayCreate: hookPropType,
|
|
3134
|
-
onCreate: callbackPropTypes,
|
|
3135
|
-
onDestroy: callbackPropTypes,
|
|
3136
|
-
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].array, _propTypes["default"].object, _propTypes["default"].number]),
|
|
3137
|
-
children: _propTypes["default"].node,
|
|
3138
|
-
className: _propTypes["default"].string,
|
|
3139
|
-
render: _propTypes["default"].func
|
|
3140
|
-
});
|
|
3141
|
-
_defineProperty(DateTimePicker, "defaultProps", {
|
|
3142
|
-
options: {}
|
|
3143
|
-
});
|
|
3144
|
-
var _default = DateTimePicker;
|
|
3145
|
-
exports["default"] = _default;
|
|
3146
|
-
})(build);
|
|
3147
|
-
return build;
|
|
3148
|
-
}
|
|
3149
|
-
var buildExports = requireBuild();
|
|
3150
|
-
const Flatpickr = /* @__PURE__ */ getDefaultExportFromCjs(buildExports);
|
|
3151
|
-
const systemGray3 = "#949494";
|
|
3152
|
-
const inputMaxWidthSmall = "DatePicker-module_inputMaxWidthSmall_cRYaK";
|
|
3153
|
-
const inputMaxWidthDefault = "DatePicker-module_inputMaxWidthDefault_GbIO-";
|
|
3154
|
-
const inputMaxWidthLarge = "DatePicker-module_inputMaxWidthLarge_fZKFi";
|
|
3155
|
-
const input = "DatePicker-module_input_3VHte";
|
|
3156
|
-
const inputWrapper = "DatePicker-module_inputWrapper_aqoyL";
|
|
3157
|
-
const inputWrapperCompact = "DatePicker-module_inputWrapperCompact_-7CrL";
|
|
3158
|
-
const iconButton = "DatePicker-module_iconButton_19a6e";
|
|
3159
|
-
const clearButton = "DatePicker-module_clearButton_O1D31";
|
|
3160
|
-
const styles = {
|
|
3161
|
-
systemGray3,
|
|
3162
|
-
inputMaxWidthSmall,
|
|
3163
|
-
inputMaxWidthDefault,
|
|
3164
|
-
inputMaxWidthLarge,
|
|
3165
|
-
input,
|
|
3166
|
-
inputWrapper,
|
|
3167
|
-
inputWrapperCompact,
|
|
3168
|
-
"inputWrapper--error": "DatePicker-module_inputWrapper--error_bhHqD",
|
|
3169
|
-
"inputWrapper--disabled": "DatePicker-module_inputWrapper--disabled_WFJUG",
|
|
3170
|
-
iconButton,
|
|
3171
|
-
clearButton
|
|
3172
|
-
};
|
|
3173
|
-
let ids = 0;
|
|
3174
|
-
function DatePicker({
|
|
3175
|
-
attachTo,
|
|
3176
|
-
compact,
|
|
3177
|
-
inputMaxWidth,
|
|
3178
|
-
defaultDate,
|
|
3179
|
-
disabled,
|
|
3180
|
-
error,
|
|
3181
|
-
fullWidth,
|
|
3182
|
-
id,
|
|
3183
|
-
helperText,
|
|
3184
|
-
optionalLabelText,
|
|
3185
|
-
label,
|
|
3186
|
-
mode,
|
|
3187
|
-
onChange,
|
|
3188
|
-
onOpen,
|
|
3189
|
-
onClose,
|
|
3190
|
-
showClearButton,
|
|
3191
|
-
showIcon,
|
|
3192
|
-
firstSelectableDate,
|
|
3193
|
-
lastSelectableDate,
|
|
3194
|
-
dateFormat = `F j, Y`,
|
|
3195
|
-
allowInput,
|
|
3196
|
-
tooltip,
|
|
3197
|
-
"data-testid": testId,
|
|
3198
|
-
flatpickrRef: flatpickrOutputRef,
|
|
3199
|
-
placeholder,
|
|
3200
|
-
calendarContainerClass
|
|
3201
|
-
}) {
|
|
3202
|
-
var _a, _b;
|
|
3203
|
-
const flatpickrObjectRef = React.useRef();
|
|
3204
|
-
const inputHasValue = Boolean((_b = (_a = flatpickrObjectRef == null ? void 0 : flatpickrObjectRef.current) == null ? void 0 : _a.input) == null ? void 0 : _b.value);
|
|
3205
|
-
const inputClassNames = cx(
|
|
3206
|
-
cx(inputStyles.input, styles.input, {
|
|
3207
|
-
[inputStyles["input--compact"]]: compact,
|
|
3208
|
-
[inputStyles["input--disabled"]]: disabled,
|
|
3209
|
-
[inputStyles["input--error"]]: error
|
|
3210
|
-
})
|
|
3211
|
-
);
|
|
3212
|
-
React.useEffect(() => {
|
|
3213
|
-
if (flatpickrObjectRef.current) {
|
|
3214
|
-
flatpickrObjectRef.current.input.nextSibling.id = id;
|
|
3215
|
-
flatpickrObjectRef.current.input.nextSibling.autocomplete = "off";
|
|
3216
|
-
if (flatpickrOutputRef) {
|
|
3217
|
-
flatpickrOutputRef.current = flatpickrObjectRef.current;
|
|
3218
|
-
}
|
|
3219
|
-
}
|
|
3220
|
-
}, []);
|
|
3221
|
-
React.useEffect(() => {
|
|
3222
|
-
flatpickrObjectRef.current.input.nextSibling.className = inputClassNames;
|
|
3223
|
-
}, [compact, disabled, error, disabled]);
|
|
3224
|
-
const disabledDates = React.useMemo(() => {
|
|
3225
|
-
if (!firstSelectableDate && !lastSelectableDate) {
|
|
3226
|
-
return void 0;
|
|
3227
|
-
}
|
|
3228
|
-
const formattedFirstSelectableDate = dayjs(firstSelectableDate);
|
|
3229
|
-
const formattedLastSelectableDate = dayjs(lastSelectableDate);
|
|
3230
|
-
const formattedDefaultDate = dayjs(defaultDate);
|
|
3231
|
-
return (inputDate) => {
|
|
3232
|
-
const formattedInput = dayjs(inputDate);
|
|
3233
|
-
if (formattedInput.isSame(formattedDefaultDate, "day")) {
|
|
3234
|
-
return false;
|
|
3235
|
-
}
|
|
3236
|
-
let validDate = true;
|
|
3237
|
-
if (firstSelectableDate && formattedInput.isBefore(formattedFirstSelectableDate, "day")) {
|
|
3238
|
-
validDate = false;
|
|
3239
|
-
}
|
|
3240
|
-
if (lastSelectableDate && formattedInput.isAfter(formattedLastSelectableDate, "day")) {
|
|
3241
|
-
validDate = false;
|
|
3242
|
-
}
|
|
3243
|
-
return !validDate;
|
|
3244
|
-
};
|
|
3245
|
-
}, [defaultDate, firstSelectableDate, lastSelectableDate]);
|
|
3246
|
-
let inputMaxWidthClass;
|
|
3247
|
-
switch (inputMaxWidth) {
|
|
3248
|
-
case "small":
|
|
3249
|
-
inputMaxWidthClass = styles.inputMaxWidthSmall;
|
|
3250
|
-
break;
|
|
3251
|
-
case "large":
|
|
3252
|
-
inputMaxWidthClass = styles.inputMaxWidthLarge;
|
|
3253
|
-
break;
|
|
3254
|
-
default:
|
|
3255
|
-
inputMaxWidthClass = styles.inputMaxWidthDefault;
|
|
3256
|
-
}
|
|
3257
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3258
|
-
ControlWrapper,
|
|
3259
|
-
{
|
|
3260
|
-
tooltip,
|
|
3261
|
-
wrapperClassNames: cx({
|
|
3262
|
-
[inputMaxWidthClass]: !fullWidth
|
|
3263
|
-
}),
|
|
3264
|
-
label,
|
|
3265
|
-
helperText,
|
|
3266
|
-
optionalLabelText,
|
|
3267
|
-
disabled,
|
|
3268
|
-
error,
|
|
3269
|
-
inputId: id,
|
|
3270
|
-
fullWidth,
|
|
3271
|
-
renderControl: () => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3272
|
-
Flatpickr,
|
|
3273
|
-
{
|
|
3274
|
-
options: {
|
|
3275
|
-
allowInput,
|
|
3276
|
-
altFormat: dateFormat,
|
|
3277
|
-
altInput: true,
|
|
3278
|
-
altInputClass: inputClassNames,
|
|
3279
|
-
appendTo: attachTo || void 0,
|
|
3280
|
-
dateFormat: "Z",
|
|
3281
|
-
mode,
|
|
3282
|
-
wrap: true,
|
|
3283
|
-
defaultDate,
|
|
3284
|
-
disable: [disabledDates]
|
|
3285
|
-
},
|
|
3286
|
-
onCreate: (flatpickrObject) => {
|
|
3287
|
-
flatpickrObjectRef.current = flatpickrObject;
|
|
3288
|
-
if (calendarContainerClass) {
|
|
3289
|
-
flatpickrObjectRef.current.calendarContainer.className = cx(
|
|
3290
|
-
flatpickrObjectRef.current.calendarContainer.className,
|
|
3291
|
-
calendarContainerClass
|
|
3292
|
-
);
|
|
3293
|
-
}
|
|
3294
|
-
},
|
|
3295
|
-
onChange,
|
|
3296
|
-
onOpen,
|
|
3297
|
-
onClose,
|
|
3298
|
-
"data-testid": testId,
|
|
3299
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3300
|
-
"div",
|
|
3301
|
-
{
|
|
3302
|
-
className: cx(styles.inputWrapper, {
|
|
3303
|
-
[styles["inputWrapper--error"]]: error,
|
|
3304
|
-
[styles["inputWrapper--disabled"]]: disabled,
|
|
3305
|
-
[styles["inputWrapperCompact"]]: compact
|
|
3306
|
-
}),
|
|
3307
|
-
children: [
|
|
3308
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3309
|
-
"input",
|
|
3310
|
-
{
|
|
3311
|
-
className: styles.inputElement,
|
|
3312
|
-
"data-input": true,
|
|
3313
|
-
defaultValue: defaultDate,
|
|
3314
|
-
"data-testid": "date-picker-input",
|
|
3315
|
-
placeholder
|
|
3316
|
-
}
|
|
3317
|
-
),
|
|
3318
|
-
showIcon && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.iconButton, "data-toggle": true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.iconWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3319
|
-
Icon,
|
|
3320
|
-
{
|
|
3321
|
-
icon: "calendar",
|
|
3322
|
-
variant: "thin",
|
|
3323
|
-
size: 24,
|
|
3324
|
-
color: styles.systemGray3
|
|
3325
|
-
}
|
|
3326
|
-
) }) }),
|
|
3327
|
-
// istanbul ignore next - relies on the lifecycle hooks in Flatpickr, which doesn't play nicely with unit tests
|
|
3328
|
-
showClearButton && inputHasValue && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3329
|
-
"button",
|
|
3330
|
-
{
|
|
3331
|
-
className: styles.clearButton,
|
|
3332
|
-
onClick: () => {
|
|
3333
|
-
flatpickrObjectRef.current.clear();
|
|
3334
|
-
},
|
|
3335
|
-
"data-testid": "data-picker-clear-button",
|
|
3336
|
-
title: "Clear",
|
|
3337
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.iconWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3338
|
-
Icon,
|
|
3339
|
-
{
|
|
3340
|
-
icon: "close",
|
|
3341
|
-
variant: "thin",
|
|
3342
|
-
size: 12,
|
|
3343
|
-
color: styles.systemGray3
|
|
3344
|
-
}
|
|
3345
|
-
) })
|
|
3346
|
-
}
|
|
3347
|
-
)
|
|
3348
|
-
]
|
|
3349
|
-
}
|
|
3350
|
-
)
|
|
3351
|
-
}
|
|
3352
|
-
)
|
|
3353
|
-
}
|
|
3354
|
-
);
|
|
3355
|
-
}
|
|
3356
|
-
DatePicker.propTypes = {
|
|
3357
|
-
attachTo: PropTypes.node,
|
|
3358
|
-
allowInput: PropTypes.bool,
|
|
3359
|
-
inputMaxWidth: PropTypes.oneOf(["small", "default", "large"]),
|
|
3360
|
-
compact: PropTypes.bool,
|
|
3361
|
-
disabled: PropTypes.bool,
|
|
3362
|
-
defaultDate: PropTypes.oneOfType([
|
|
3363
|
-
PropTypes.instanceOf(Date),
|
|
3364
|
-
PropTypes.arrayOf(PropTypes.instanceOf(Date)),
|
|
3365
|
-
PropTypes.string
|
|
3366
|
-
]),
|
|
3367
|
-
error: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
3368
|
-
fullWidth: PropTypes.bool,
|
|
3369
|
-
id: PropTypes.string,
|
|
3370
|
-
firstSelectableDate: PropTypes.oneOfType([
|
|
3371
|
-
PropTypes.instanceOf(Date),
|
|
3372
|
-
PropTypes.string
|
|
3373
|
-
]),
|
|
3374
|
-
helperText: PropTypes.string,
|
|
3375
|
-
optionalLabelText: PropTypes.string,
|
|
3376
|
-
label: PropTypes.string,
|
|
3377
|
-
lastSelectableDate: PropTypes.oneOfType([
|
|
3378
|
-
PropTypes.instanceOf(Date),
|
|
3379
|
-
PropTypes.string
|
|
3380
|
-
]),
|
|
3381
|
-
mode: PropTypes.oneOf(["single", "multiple", "range"]),
|
|
3382
|
-
onChange: PropTypes.func.isRequired,
|
|
3383
|
-
onOpen: PropTypes.func,
|
|
3384
|
-
onClose: PropTypes.func,
|
|
3385
|
-
showClearButton: PropTypes.bool,
|
|
3386
|
-
showIcon: PropTypes.bool,
|
|
3387
|
-
dateFormat: PropTypes.string,
|
|
3388
|
-
tooltip: PropTypes.node,
|
|
3389
|
-
flatpickrRef: PropTypes.object,
|
|
3390
|
-
"data-testid": PropTypes.string,
|
|
3391
|
-
placeholder: PropTypes.string
|
|
3392
|
-
};
|
|
3393
|
-
DatePicker.defaultProps = {
|
|
3394
|
-
attachTo: null,
|
|
3395
|
-
allowInput: true,
|
|
3396
|
-
inputMaxWidth: "default",
|
|
3397
|
-
compact: false,
|
|
3398
|
-
defaultDate: /* @__PURE__ */ new Date(),
|
|
3399
|
-
disabled: false,
|
|
3400
|
-
error: "",
|
|
3401
|
-
fullWidth: false,
|
|
3402
|
-
helperText: "",
|
|
3403
|
-
optionalLabelText: "",
|
|
3404
|
-
id: `date-picker-${ids++}`,
|
|
3405
|
-
mode: "single",
|
|
3406
|
-
showClearButton: false,
|
|
3407
|
-
showIcon: true,
|
|
3408
|
-
dateFormat: `F j, Y`
|
|
3409
|
-
};
|
|
3410
|
-
export {
|
|
3411
|
-
DatePicker as default
|
|
3412
|
-
};
|