@atom8n/n8n-editor-ui 2.2.0

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.
Files changed (310) hide show
  1. package/.stylelintcache +1 -0
  2. package/README.md +59 -0
  3. package/biome.jsonc +8 -0
  4. package/build.log +55 -0
  5. package/data/node-popularity.json +3998 -0
  6. package/dist/assets/AddDataTableModal-UINkk54_.js +1555 -0
  7. package/dist/assets/AgentEditorModal-CVww87TJ.js +358 -0
  8. package/dist/assets/Alert-Dy86dyOr.js +102 -0
  9. package/dist/assets/AnimatedSpinner-DmPN4poP.js +15 -0
  10. package/dist/assets/AnnotationTagsDropdown.ee-BJ7N9lek.js +71 -0
  11. package/dist/assets/AuthView-D2LWHrMp.js +106 -0
  12. package/dist/assets/BottomMenu-CIQiK_dJ.js +532 -0
  13. package/dist/assets/CalendarDate-DgQUMbNo.js +875 -0
  14. package/dist/assets/ChangePasswordView-Z6tUkw0u.js +133 -0
  15. package/dist/assets/ChatAgentAvatar-50YBnv3N.js +67 -0
  16. package/dist/assets/ChatFile-xZxmc2nV.js +146 -0
  17. package/dist/assets/ChatLayout-CTE_5SiM.js +96 -0
  18. package/dist/assets/ChatPersonalAgentsView-BGpHk03K.js +149 -0
  19. package/dist/assets/ChatSidebar-BkVwIypC.js +528 -0
  20. package/dist/assets/ChatView-BbbdeU9x.js +1559 -0
  21. package/dist/assets/ChatWorkflowAgentsView-BtunOxlC.js +116 -0
  22. package/dist/assets/CollectionParameter-BdcPG1lu.js +52 -0
  23. package/dist/assets/CommitMonoVariable-ytizKI8U.woff2 +0 -0
  24. package/dist/assets/CommunityNodeUpdateInfo-C37kca4W.js +273 -0
  25. package/dist/assets/CopyInput-DDZVu2iU.js +74 -0
  26. package/dist/assets/CredentialIcon-8YdTTFZ1.js +80 -0
  27. package/dist/assets/CredentialPicker-DWtj314o.js +293 -0
  28. package/dist/assets/CredentialSelectorModal-DTW2fKh0.js +138 -0
  29. package/dist/assets/CredentialsView-BjUchcCu.js +480 -0
  30. package/dist/assets/DataTableActions-DpAkoxg_.js +95 -0
  31. package/dist/assets/DataTableDetailsView-Coq7zdW5.js +41922 -0
  32. package/dist/assets/DataTableView-Cs-BIkzw.js +293 -0
  33. package/dist/assets/DemoFooter-Cga3jvi-.js +65 -0
  34. package/dist/assets/Draggable-vfvXl9Sp.js +105 -0
  35. package/dist/assets/EmptySharedSectionActionBox-DOXZtTCv.js +36 -0
  36. package/dist/assets/EnterpriseEdition.ee-D_rCFexM.js +15 -0
  37. package/dist/assets/EntityNotFound-3dhTRWsE.js +85 -0
  38. package/dist/assets/EntityUnAuthorised-ChJYZakE.js +66 -0
  39. package/dist/assets/ErrorView-zT9cX76a.js +61 -0
  40. package/dist/assets/EvaluationsRootView-C-OVWYnY.js +523 -0
  41. package/dist/assets/EvaluationsView-CJwJTruc.js +469 -0
  42. package/dist/assets/ExecutionsTime-DEQiyozR.js +573 -0
  43. package/dist/assets/ExecutionsView-Bd5Oh8TH.js +791 -0
  44. package/dist/assets/ExternalSecretsProviderConnectionSwitch.ee-C7Ih-uRo.js +191 -0
  45. package/dist/assets/FixedCollectionParameter-CYuTDW9t.js +496 -0
  46. package/dist/assets/ForgotMyPasswordView-Bs_L9P27.js +102 -0
  47. package/dist/assets/InsightsChartAverageRuntime-Bp3VA8_7.js +62 -0
  48. package/dist/assets/InsightsChartFailed-KPaNWoEr.js +52 -0
  49. package/dist/assets/InsightsChartFailureRate-DE6kE3FM.js +54 -0
  50. package/dist/assets/InsightsChartTimeSaved-auABNZlc.js +68 -0
  51. package/dist/assets/InsightsChartTotal-BKzYRKE7.js +56 -0
  52. package/dist/assets/InsightsDashboard-JWx4W6Db.js +473 -0
  53. package/dist/assets/InsightsPaywall-C8zLLKe8.js +63 -0
  54. package/dist/assets/InsightsSummary-cmN1lHDm.js +210 -0
  55. package/dist/assets/InsightsTableWorkflows-CqcC3IbQ.js +203 -0
  56. package/dist/assets/InterVariable-DiVDrmQJ.woff2 +0 -0
  57. package/dist/assets/InterVariable-Italic-FCBEiFp6.woff2 +0 -0
  58. package/dist/assets/ItemsRenderer-DC8WVyMv.js +922 -0
  59. package/dist/assets/KeyboardShortcutTooltip-D8PAK5JP.js +31 -0
  60. package/dist/assets/LogsPanel-BR06u9RK.js +52 -0
  61. package/dist/assets/LogsPanel-C-_acMHp.js +2325 -0
  62. package/dist/assets/MCPConnectWorkflowsModal-3g8_iUa4.js +303 -0
  63. package/dist/assets/MainHeader-DiQc1edn.js +2153 -0
  64. package/dist/assets/MainSidebar-CoPGG5Ea.js +804 -0
  65. package/dist/assets/MigrationRuleDetail-BAxk1Pvl.js +295 -0
  66. package/dist/assets/MigrationRules-IW9lZMpE.js +285 -0
  67. package/dist/assets/Modal-CIzXlZdZ.js +204 -0
  68. package/dist/assets/ModelByIdSelectorModal-DLvBjzJO.js +115 -0
  69. package/dist/assets/NDVEmptyState-33UoX00I.js +19743 -0
  70. package/dist/assets/NodeCreation-BNzbSWSB.js +240 -0
  71. package/dist/assets/NodeCreator-BftgCKx7.js +1288 -0
  72. package/dist/assets/NodeDetailsView-CsoQCpcF.js +1075 -0
  73. package/dist/assets/NodeDetailsViewV2-C_wNQR_3.js +981 -0
  74. package/dist/assets/NodeIcon-B9VW6tX6.js +87 -0
  75. package/dist/assets/NodeSettings-ZwVip6VR.js +1872 -0
  76. package/dist/assets/NodeView-D4WUEvLB.js +2452 -0
  77. package/dist/assets/OAuthConsentView-DlrUqZbT.js +230 -0
  78. package/dist/assets/PageViewLayout-NT1KPFgy.js +12 -0
  79. package/dist/assets/ParameterInputList-sG2nz-Jo.js +38091 -0
  80. package/dist/assets/PrebuiltAgentTemplatesView-Csi5U8dc.js +154 -0
  81. package/dist/assets/ProjectBreadcrumb-C_XiY7sc.js +98 -0
  82. package/dist/assets/ProjectCardBadge-t_hs7vzx.js +209 -0
  83. package/dist/assets/ProjectHeader-Dq5Ihb26.js +549 -0
  84. package/dist/assets/ProjectIcon-DY8gGuHX.js +64 -0
  85. package/dist/assets/ProjectRoleView-Du-KTrAC.js +435 -0
  86. package/dist/assets/ProjectRolesView-DjxM_y4u.js +239 -0
  87. package/dist/assets/ProjectSettings-C6kWuV21.js +966 -0
  88. package/dist/assets/ProjectSharing-CVUgNWAY.js +262 -0
  89. package/dist/assets/ProjectVariables-CJlAo3dv.js +467 -0
  90. package/dist/assets/ProviderSettingsModal-BUFC2ZLv.js +307 -0
  91. package/dist/assets/PushConnectionTracker-DPBnGV0v.js +27 -0
  92. package/dist/assets/ResolversView-3BdkvvYA.js +209 -0
  93. package/dist/assets/ResourceFiltersDropdown-dgyXpcEX.js +159 -0
  94. package/dist/assets/ResourcesListLayout-qBLtomK6.js +631 -0
  95. package/dist/assets/RunDataHtml-BrW0OQra.js +7 -0
  96. package/dist/assets/RunDataHtml-Cleia4Cj.js +40 -0
  97. package/dist/assets/RunDataJson-uxkrhYRK.js +227 -0
  98. package/dist/assets/RunDataJsonActions-DkPk7E8d.js +5007 -0
  99. package/dist/assets/RunDataParsedAiContent-CtPRjig-.js +26 -0
  100. package/dist/assets/RunDataParsedAiContent-WAuqLQ5M.js +192 -0
  101. package/dist/assets/RunDataSearch-YBWUr93C.js +141 -0
  102. package/dist/assets/RunDataTable-DcXaBynW.js +631 -0
  103. package/dist/assets/SamlOnboarding-BTdQ_hr3.js +78 -0
  104. package/dist/assets/SaveButton-D5sQSxIk.js +89 -0
  105. package/dist/assets/SelectedItemsInfo-BHZ-NvF5.js +58 -0
  106. package/dist/assets/SettingsApiView-IfZTMXx1.js +313 -0
  107. package/dist/assets/SettingsChatHubView-gWh2X6vX.js +285 -0
  108. package/dist/assets/SettingsCommunityNodesView-D8VQtpGY.js +349 -0
  109. package/dist/assets/SettingsExternalSecrets-CpMc7mkW.js +233 -0
  110. package/dist/assets/SettingsLdapView-CU5a2MAy.js +2553 -0
  111. package/dist/assets/SettingsLogStreamingView-uojTe-oX.js +375 -0
  112. package/dist/assets/SettingsMCPView-B5Swp1C_.js +1214 -0
  113. package/dist/assets/SettingsPersonalView-Cr3aGood.js +402 -0
  114. package/dist/assets/SettingsSourceControl-DXOvFDEY.js +547 -0
  115. package/dist/assets/SettingsSso-27MfU1HV.js +1032 -0
  116. package/dist/assets/SettingsUsageAndPlan-DqIO-G46.js +419 -0
  117. package/dist/assets/SettingsUsersView-DfHB4_Kh.js +833 -0
  118. package/dist/assets/SettingsView-C4sA7Uny.js +90 -0
  119. package/dist/assets/SetupTemplateFormStep-BmiSzZin.js +258 -0
  120. package/dist/assets/SetupView-VORZ-L_u.js +112 -0
  121. package/dist/assets/SetupWorkflowCredentialsButton-DTmkOAW5.js +73 -0
  122. package/dist/assets/SetupWorkflowFromTemplateView-B9NupdJE.js +286 -0
  123. package/dist/assets/SeverityTag-CX1qTTNA.js +45 -0
  124. package/dist/assets/SigninView-D9_Pm16j.js +358 -0
  125. package/dist/assets/SignoutView-BFsjEAGz.js +19 -0
  126. package/dist/assets/SignupView-Am4ot0QZ.js +137 -0
  127. package/dist/assets/SkeletonAgentCard-C5TL-h8F.js +191 -0
  128. package/dist/assets/TagsDropdown-Bvx_Hd6Q.js +230 -0
  129. package/dist/assets/TemplateCard-CyQ1GuVz.js +105 -0
  130. package/dist/assets/TemplateDetails-CZRusTxE.js +124 -0
  131. package/dist/assets/TemplateList-DKvbwuiY.js +333 -0
  132. package/dist/assets/TemplatesCollectionView-D8dxU8By.js +184 -0
  133. package/dist/assets/TemplatesSearchView-CebC_GLs.js +1230 -0
  134. package/dist/assets/TemplatesView-025CcmIY.js +57 -0
  135. package/dist/assets/TemplatesWorkflowView-C2JfwJAn.js +170 -0
  136. package/dist/assets/TestRunDetailView-Ck78TTWO.js +395 -0
  137. package/dist/assets/TextWithHighlights-BxumwGnv.js +57 -0
  138. package/dist/assets/TimeAgo-C6EN4lCs.js +123 -0
  139. package/dist/assets/ToolsSelectorModal-8QJoUvRL.js +368 -0
  140. package/dist/assets/TriggerPanel-B6pacLkk.js +1225 -0
  141. package/dist/assets/VirtualSchema-B3zGe_8b.js +2402 -0
  142. package/dist/assets/VirtualSchema-Dkh0Cu5z.js +37 -0
  143. package/dist/assets/VueMarkdown-CQqJL9vK.js +28 -0
  144. package/dist/assets/WorkerView-Caznsljo.js +563 -0
  145. package/dist/assets/WorkflowActivationErrorMessage-CGrfPi9O.js +17 -0
  146. package/dist/assets/WorkflowActivator-BINnz0f7.js +362 -0
  147. package/dist/assets/WorkflowExecutionsInfoAccordion-Dg37yEfT.js +166 -0
  148. package/dist/assets/WorkflowExecutionsLandingPage-V2wdubhK.js +93 -0
  149. package/dist/assets/WorkflowExecutionsPreview-DdJaqYV6.js +616 -0
  150. package/dist/assets/WorkflowExecutionsView-DV8ySTfn.js +808 -0
  151. package/dist/assets/WorkflowHistory-GtaBMzIM.js +973 -0
  152. package/dist/assets/WorkflowLocation-CQ9Sq-2y.js +164 -0
  153. package/dist/assets/WorkflowOnboardingView-C49gt0Jr.js +61 -0
  154. package/dist/assets/WorkflowPreview-CXdvv4Nq.js +186 -0
  155. package/dist/assets/WorkflowTagsDropdown-QwbICWjN.js +71 -0
  156. package/dist/assets/WorkflowsView-B-MWIECO.js +3253 -0
  157. package/dist/assets/_MapCache-CcdIl4Ae.js +363 -0
  158. package/dist/assets/_baseOrderBy-N8Be_6z6.js +2989 -0
  159. package/dist/assets/_initCloneObject-viQQyT6o.js +80 -0
  160. package/dist/assets/_plugin-vue_export-helper-BwBpWJRZ.js +6 -0
  161. package/dist/assets/aiTemplatesStarterCollection.store-nL9nePkK.js +656 -0
  162. package/dist/assets/apiKeys.store-BhOFmP2j.js +51 -0
  163. package/dist/assets/assistant.store-CNywgN4S.js +518 -0
  164. package/dist/assets/auth.eventBus-CWXS0Qp7.js +5 -0
  165. package/dist/assets/banners.store-CGEcBTDn.js +195 -0
  166. package/dist/assets/builder.store-Czk2ipDE.js +31417 -0
  167. package/dist/assets/buttons.esm-yintpW2E.js +364 -0
  168. package/dist/assets/chart-CNvyywtJ.js +10958 -0
  169. package/dist/assets/chartjs.utils-BAE52Cv9.js +155 -0
  170. package/dist/assets/chat.store-290YeyrQ.js +865 -0
  171. package/dist/assets/chatPanel.store-NDaawEZL.js +118 -0
  172. package/dist/assets/chunk-6z4oVpB-.js +36 -0
  173. package/dist/assets/col-Cmt4cmuS.js +158 -0
  174. package/dist/assets/constants-C8OH4tTq.js +106256 -0
  175. package/dist/assets/constants-DMrsrpD7.js +32 -0
  176. package/dist/assets/core-B9gt_4yk.js +4 -0
  177. package/dist/assets/core-CP5FY4aX.js +1202 -0
  178. package/dist/assets/core-CRbPymLT.js +9741 -0
  179. package/dist/assets/dataTable.store-DmipQsol.js +207 -0
  180. package/dist/assets/date-picker-2IDsBs2n.js +4115 -0
  181. package/dist/assets/dateFormatter-ik4-9_9r.js +33 -0
  182. package/dist/assets/dateformat-hG8NERse.js +181 -0
  183. package/dist/assets/dialog-lMho1TD8.js +425 -0
  184. package/dist/assets/dist-Cw46Is-h.js +151 -0
  185. package/dist/assets/doppler-B__k0MeW.webp +0 -0
  186. package/dist/assets/element-icons-B-tDfklg.woff +0 -0
  187. package/dist/assets/element-icons-_lZGOqcG.ttf +0 -0
  188. package/dist/assets/empty-BuGRxzl4.js +2210 -0
  189. package/dist/assets/en-CF30SCh2.js +95 -0
  190. package/dist/assets/en-DyO2pPiC.js +2 -0
  191. package/dist/assets/es-BkUFJVtD.js +43338 -0
  192. package/dist/assets/evaluation.constants-GYAwmJnh.js +284 -0
  193. package/dist/assets/executions.store-B9uRYwgv.js +205 -0
  194. package/dist/assets/exports-Crx_gvt_.js +1799 -0
  195. package/dist/assets/externalSecrets.ee.store-BJh4a_6G.js +118 -0
  196. package/dist/assets/fileUtils-CRWqOQje.js +20 -0
  197. package/dist/assets/folders.store-yAFj-5Vl.js +235 -0
  198. package/dist/assets/get-BcEmeOxn.js +2781 -0
  199. package/dist/assets/index-SL8542zQ.js +28372 -0
  200. package/dist/assets/insights.constants-BkJCYJTL.js +55 -0
  201. package/dist/assets/insights.store-BFc3kDUo.js +61 -0
  202. package/dist/assets/insights.utils-CcLXdrrz.js +77 -0
  203. package/dist/assets/isEmpty-C3XXoHqJ.js +35216 -0
  204. package/dist/assets/languageModules-9LyndCqU.js +13862 -0
  205. package/dist/assets/logStreaming.store-IZhWe_VK.js +190 -0
  206. package/dist/assets/mcp.constants-_Jcn7fPq.js +10 -0
  207. package/dist/assets/mcp.store-B9yfcAN9.js +116 -0
  208. package/dist/assets/merge-DhuTk1HM.js +564 -0
  209. package/dist/assets/nodeCreator.store-Bpnrwp2l.js +5444 -0
  210. package/dist/assets/nodeIcon-D6X-ENYt.js +102 -0
  211. package/dist/assets/nodeTransforms-RzcOM0v2.js +42 -0
  212. package/dist/assets/orderBy-Cu9F9DU_.js +15 -0
  213. package/dist/assets/path-browserify-RUt2u7iT.js +328 -0
  214. package/dist/assets/personalizedTemplatesV3.store-BGYp0YBN.js +334 -0
  215. package/dist/assets/pickBy-UI0Jt4wC.js +18 -0
  216. package/dist/assets/preload-helper-dyVz7ck7.js +59 -0
  217. package/dist/assets/radio-CSce3UT0.js +262 -0
  218. package/dist/assets/readyToRun.store-YEMvPUqo.js +626 -0
  219. package/dist/assets/readyToRunWorkflows.store-G3srgIze.js +1319 -0
  220. package/dist/assets/retry-BgHaYzbB.js +23 -0
  221. package/dist/assets/roles.store-CRf_zJTb.js +51 -0
  222. package/dist/assets/router-DNpzz3GH.js +2631 -0
  223. package/dist/assets/sanitize-html-CbW56HUN.js +10758 -0
  224. package/dist/assets/schemaPreview.store-DUgN1yVE.js +113 -0
  225. package/dist/assets/semver-Bk6DGseV.js +1306 -0
  226. package/dist/assets/smartDecimal-DAZl4HKA.js +6 -0
  227. package/dist/assets/sortByProperty-Cn7iGKYu.js +8 -0
  228. package/dist/assets/sourceControl.eventBus-D47xXSc_.js +3 -0
  229. package/dist/assets/sqlite3-DBpDb1lf.wasm +0 -0
  230. package/dist/assets/sqlite3-opfs-async-proxy-vVtmDGHX.js +461 -0
  231. package/dist/assets/sqlite3-worker1-bundler-friendly-DLarOZDL.js +9405 -0
  232. package/dist/assets/src-jviYSG25.js +55454 -0
  233. package/dist/assets/sso.store-DyApJwhx.js +139 -0
  234. package/dist/assets/style-E3CrYFV8.css +111829 -0
  235. package/dist/assets/table-we1DjFMV.js +3944 -0
  236. package/dist/assets/templateActions-bEDSARw2.js +65 -0
  237. package/dist/assets/templateTransforms-BHWiRbtR.js +43 -0
  238. package/dist/assets/truncate-C0KYt7i3.js +4176 -0
  239. package/dist/assets/typescript.worker-CYqLvLHh.js +152048 -0
  240. package/dist/assets/uniqBy-xDyuCRP0.js +10 -0
  241. package/dist/assets/usage.store-CU5J_nGm.js +100 -0
  242. package/dist/assets/useActions-B1JckIRj.js +255 -0
  243. package/dist/assets/useBeforeUnload-DiDkvI8p.js +40 -0
  244. package/dist/assets/useCanvasMapping-BXT7rGhC.js +12570 -0
  245. package/dist/assets/useCanvasOperations-8ULLtMkY.js +1765 -0
  246. package/dist/assets/useClipboard-DvjhVHqJ.js +39 -0
  247. package/dist/assets/useCommandBar-C4tLJbKt.js +2425 -0
  248. package/dist/assets/useCredentialResolvers-BKeFGJnY.js +78 -0
  249. package/dist/assets/useCustomAgent-DpILEt5e.js +471 -0
  250. package/dist/assets/useDebounce-Br5_1ug-.js +147 -0
  251. package/dist/assets/useExecutionData-M5iKsX6z.js +23 -0
  252. package/dist/assets/useExecutionDebugging-8azMzbnd.js +191 -0
  253. package/dist/assets/useExecutionHelpers-BgRRhpBM.js +91 -0
  254. package/dist/assets/useImportCurlCommand-CKiEmX5P.js +8891 -0
  255. package/dist/assets/useIntersectionObserver-BWMwOueh.js +33 -0
  256. package/dist/assets/useKeybindings-B2jfN6rd.js +62 -0
  257. package/dist/assets/useLogsTreeExpand-sZViUfdM.js +843 -0
  258. package/dist/assets/useMcp-DoMOIfqT.js +27 -0
  259. package/dist/assets/usePageRedirectionHelper-DjkznpX6.js +51 -0
  260. package/dist/assets/usePinnedData-BhZkqttf.js +203 -0
  261. package/dist/assets/usePushConnection-DMS-F_IW.js +513 -0
  262. package/dist/assets/useRecentResources-BVORr7eM.js +118 -0
  263. package/dist/assets/useRunWorkflow-LO7ffLp9.js +950 -0
  264. package/dist/assets/useSettingsItems-BhZXwMZn.js +144 -0
  265. package/dist/assets/useTelemetryContext-V6bv4YRq.js +34 -0
  266. package/dist/assets/useWorkflowActivate-DeSmDXjI.js +152 -0
  267. package/dist/assets/useWorkflowsCache-DtcEEAIR.js +179 -0
  268. package/dist/assets/userRoleProvisioning.store-kkSIdeTo.js +33 -0
  269. package/dist/assets/utils-DI7dLldp.js +54 -0
  270. package/dist/assets/versions.store-B1z2OrLE.js +191 -0
  271. package/dist/assets/vue-CydWIhxN.js +4378 -0
  272. package/dist/assets/vue-json-pretty-CsGX66mG.js +1130 -0
  273. package/dist/assets/vue.runtime.esm-bundler-tP5dCd7J.js +7325 -0
  274. package/dist/assets/xml-B_oj6Mle.js +2060 -0
  275. package/dist/favicon.ico +0 -0
  276. package/dist/index.html +157 -0
  277. package/dist/static/base-path.js +1 -0
  278. package/dist/static/community_package_tooltip_img.png +0 -0
  279. package/dist/static/data-mapping-gif.gif +0 -0
  280. package/dist/static/form-grey.svg +1 -0
  281. package/dist/static/google-auth/disabled.dark.png +0 -0
  282. package/dist/static/google-auth/disabled.png +0 -0
  283. package/dist/static/google-auth/focus.dark.png +0 -0
  284. package/dist/static/google-auth/focus.png +0 -0
  285. package/dist/static/google-auth/normal.dark.png +0 -0
  286. package/dist/static/google-auth/normal.png +0 -0
  287. package/dist/static/google-auth/pressed.dark.png +0 -0
  288. package/dist/static/google-auth/pressed.png +0 -0
  289. package/dist/static/n8n-logo.png +0 -0
  290. package/dist/static/og_image.png +0 -0
  291. package/dist/static/open-ai.svg +1 -0
  292. package/dist/static/openChat.png +0 -0
  293. package/dist/static/posthog.init.js +41 -0
  294. package/dist/static/prefers-color-scheme.css +5 -0
  295. package/dist/static/webhook-icon.svg +1 -0
  296. package/dist/tree-sitter-bash.wasm +0 -0
  297. package/dist/tree-sitter.wasm +0 -0
  298. package/eslint.config.mjs +59 -0
  299. package/index.html +45 -0
  300. package/index.js +0 -0
  301. package/package.json +147 -0
  302. package/postcss.config.cjs +6 -0
  303. package/scripts/fetch-node-popularity.mjs +102 -0
  304. package/stylelint.config.mjs +9 -0
  305. package/tailwind.config.js +8 -0
  306. package/tsconfig.json +36 -0
  307. package/vite/i18n-locales-hmr-helpers.ts +19 -0
  308. package/vite/source-map-js-shim.ts +1 -0
  309. package/vite/vite-plugin-node-popularity.mts +32 -0
  310. package/vite.config.mts +304 -0
@@ -0,0 +1,4115 @@
1
+ import { o as __toESM, t as __commonJSMin } from "./chunk-6z4oVpB-.js";
2
+ import { C as computed, Cn as toDisplayString, D as createElementBlock, E as createCommentVNode, F as getCurrentInstance, G as nextTick, Gt as unref, It as ref, M as createVNode, P as defineComponent, Pt as reactive, T as createBlock, Vt as toRef, W as mergeProps, Z as onMounted, _ as Fragment, _t as watch, an as isFunction, at as renderSlot, bn as normalizeStyle, bt as withCtx, ct as resolveDynamicComponent, et as openBlock, h as withModifiers, in as isDate, it as renderList, j as createTextVNode, m as withKeys, n as Transition, nn as isArray, nt as provide, p as vShow, pt as useSlots, tn as init_shared_esm_bundler, ut as useAttrs, vn as normalizeClass, w as createBaseVNode, xt as withDirectives, z as inject } from "./vue.runtime.esm-bundler-tP5dCd7J.js";
3
+ import { Bt as ElTooltip, Ht as ElScrollbar, Rt as vRepeatClick, Vt as TOOLTIP_INJECTION_KEY, nn as flatten_default, qt as isEqual_default, zt as ClickOutside } from "./src-jviYSG25.js";
4
+ import { $ as buildProps, A as useLocale, At as debugWarn, Bt as isUndefined, C as useSizeProp, Dt as getStyle, H as datePickTypes, Ot as hasClass, Rt as isEmpty, U as EVENT_CODE, Wt as debounce_default, at as calendar_default, c as ElButton, ct as circle_close_default, dt as d_arrow_left_default, et as definePropType, f as ElInput, ft as d_arrow_right_default, g as useFormSize, gn as onClickOutside, it as arrow_up_default, k as useNamespace, lt as clock_default, nt as arrow_left_default, p as useFormItem, rt as arrow_right_default, tt as arrow_down_default, v as ElIcon, y as _export_sfc } from "./truncate-C0KYt7i3.js";
5
+ var castArray = (arr) => {
6
+ if (!arr && arr !== 0) return [];
7
+ return Array.isArray(arr) ? arr : [arr];
8
+ };
9
+ var require_dayjs_min = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10
+ (function(t, e) {
11
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
12
+ })(exports, (function() {
13
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = {
14
+ name: "en",
15
+ weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
16
+ months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
17
+ ordinal: function(t$1) {
18
+ var e$1 = [
19
+ "th",
20
+ "st",
21
+ "nd",
22
+ "rd"
23
+ ], n$1 = t$1 % 100;
24
+ return "[" + t$1 + (e$1[(n$1 - 20) % 10] || e$1[n$1] || e$1[0]) + "]";
25
+ }
26
+ }, m = function(t$1, e$1, n$1) {
27
+ var r$1 = String(t$1);
28
+ return !r$1 || r$1.length >= e$1 ? t$1 : "" + Array(e$1 + 1 - r$1.length).join(n$1) + t$1;
29
+ }, v = {
30
+ s: m,
31
+ z: function(t$1) {
32
+ var e$1 = -t$1.utcOffset(), n$1 = Math.abs(e$1), r$1 = Math.floor(n$1 / 60), i$1 = n$1 % 60;
33
+ return (e$1 <= 0 ? "+" : "-") + m(r$1, 2, "0") + ":" + m(i$1, 2, "0");
34
+ },
35
+ m: function t$1(e$1, n$1) {
36
+ if (e$1.date() < n$1.date()) return -t$1(n$1, e$1);
37
+ var r$1 = 12 * (n$1.year() - e$1.year()) + (n$1.month() - e$1.month()), i$1 = e$1.clone().add(r$1, c), s$1 = n$1 - i$1 < 0, u$1 = e$1.clone().add(r$1 + (s$1 ? -1 : 1), c);
38
+ return +(-(r$1 + (n$1 - i$1) / (s$1 ? i$1 - u$1 : u$1 - i$1)) || 0);
39
+ },
40
+ a: function(t$1) {
41
+ return t$1 < 0 ? Math.ceil(t$1) || 0 : Math.floor(t$1);
42
+ },
43
+ p: function(t$1) {
44
+ return {
45
+ M: c,
46
+ y: h,
47
+ w: o,
48
+ d: a,
49
+ D: d,
50
+ h: u,
51
+ m: s,
52
+ s: i,
53
+ ms: r,
54
+ Q: f
55
+ }[t$1] || String(t$1 || "").toLowerCase().replace(/s$/, "");
56
+ },
57
+ u: function(t$1) {
58
+ return void 0 === t$1;
59
+ }
60
+ }, g = "en", D = {};
61
+ D[g] = M;
62
+ var p = "$isDayjsObject", S = function(t$1) {
63
+ return t$1 instanceof _ || !(!t$1 || !t$1[p]);
64
+ }, w = function t$1(e$1, n$1, r$1) {
65
+ var i$1;
66
+ if (!e$1) return g;
67
+ if ("string" == typeof e$1) {
68
+ var s$1 = e$1.toLowerCase();
69
+ D[s$1] && (i$1 = s$1), n$1 && (D[s$1] = n$1, i$1 = s$1);
70
+ var u$1 = e$1.split("-");
71
+ if (!i$1 && u$1.length > 1) return t$1(u$1[0]);
72
+ } else {
73
+ var a$1 = e$1.name;
74
+ D[a$1] = e$1, i$1 = a$1;
75
+ }
76
+ return !r$1 && i$1 && (g = i$1), i$1 || !r$1 && g;
77
+ }, O = function(t$1, e$1) {
78
+ if (S(t$1)) return t$1.clone();
79
+ var n$1 = "object" == typeof e$1 ? e$1 : {};
80
+ return n$1.date = t$1, n$1.args = arguments, new _(n$1);
81
+ }, b = v;
82
+ b.l = w, b.i = S, b.w = function(t$1, e$1) {
83
+ return O(t$1, {
84
+ locale: e$1.$L,
85
+ utc: e$1.$u,
86
+ x: e$1.$x,
87
+ $offset: e$1.$offset
88
+ });
89
+ };
90
+ var _ = function() {
91
+ function M$1(t$1) {
92
+ this.$L = w(t$1.locale, null, !0), this.parse(t$1), this.$x = this.$x || t$1.x || {}, this[p] = !0;
93
+ }
94
+ var m$1 = M$1.prototype;
95
+ return m$1.parse = function(t$1) {
96
+ this.$d = function(t$2) {
97
+ var e$1 = t$2.date, n$1 = t$2.utc;
98
+ if (null === e$1) return /* @__PURE__ */ new Date(NaN);
99
+ if (b.u(e$1)) return /* @__PURE__ */ new Date();
100
+ if (e$1 instanceof Date) return new Date(e$1);
101
+ if ("string" == typeof e$1 && !/Z$/i.test(e$1)) {
102
+ var r$1 = e$1.match($);
103
+ if (r$1) {
104
+ var i$1 = r$1[2] - 1 || 0, s$1 = (r$1[7] || "0").substring(0, 3);
105
+ return n$1 ? new Date(Date.UTC(r$1[1], i$1, r$1[3] || 1, r$1[4] || 0, r$1[5] || 0, r$1[6] || 0, s$1)) : new Date(r$1[1], i$1, r$1[3] || 1, r$1[4] || 0, r$1[5] || 0, r$1[6] || 0, s$1);
106
+ }
107
+ }
108
+ return new Date(e$1);
109
+ }(t$1), this.init();
110
+ }, m$1.init = function() {
111
+ var t$1 = this.$d;
112
+ this.$y = t$1.getFullYear(), this.$M = t$1.getMonth(), this.$D = t$1.getDate(), this.$W = t$1.getDay(), this.$H = t$1.getHours(), this.$m = t$1.getMinutes(), this.$s = t$1.getSeconds(), this.$ms = t$1.getMilliseconds();
113
+ }, m$1.$utils = function() {
114
+ return b;
115
+ }, m$1.isValid = function() {
116
+ return !(this.$d.toString() === l);
117
+ }, m$1.isSame = function(t$1, e$1) {
118
+ var n$1 = O(t$1);
119
+ return this.startOf(e$1) <= n$1 && n$1 <= this.endOf(e$1);
120
+ }, m$1.isAfter = function(t$1, e$1) {
121
+ return O(t$1) < this.startOf(e$1);
122
+ }, m$1.isBefore = function(t$1, e$1) {
123
+ return this.endOf(e$1) < O(t$1);
124
+ }, m$1.$g = function(t$1, e$1, n$1) {
125
+ return b.u(t$1) ? this[e$1] : this.set(n$1, t$1);
126
+ }, m$1.unix = function() {
127
+ return Math.floor(this.valueOf() / 1e3);
128
+ }, m$1.valueOf = function() {
129
+ return this.$d.getTime();
130
+ }, m$1.startOf = function(t$1, e$1) {
131
+ var n$1 = this, r$1 = !!b.u(e$1) || e$1, f$1 = b.p(t$1), l$1 = function(t$2, e$2) {
132
+ var i$1 = b.w(n$1.$u ? Date.UTC(n$1.$y, e$2, t$2) : new Date(n$1.$y, e$2, t$2), n$1);
133
+ return r$1 ? i$1 : i$1.endOf(a);
134
+ }, $$1 = function(t$2, e$2) {
135
+ return b.w(n$1.toDate()[t$2].apply(n$1.toDate("s"), (r$1 ? [
136
+ 0,
137
+ 0,
138
+ 0,
139
+ 0
140
+ ] : [
141
+ 23,
142
+ 59,
143
+ 59,
144
+ 999
145
+ ]).slice(e$2)), n$1);
146
+ }, y$1 = this.$W, M$2 = this.$M, m$2 = this.$D, v$1 = "set" + (this.$u ? "UTC" : "");
147
+ switch (f$1) {
148
+ case h: return r$1 ? l$1(1, 0) : l$1(31, 11);
149
+ case c: return r$1 ? l$1(1, M$2) : l$1(0, M$2 + 1);
150
+ case o:
151
+ var g$1 = this.$locale().weekStart || 0, D$1 = (y$1 < g$1 ? y$1 + 7 : y$1) - g$1;
152
+ return l$1(r$1 ? m$2 - D$1 : m$2 + (6 - D$1), M$2);
153
+ case a:
154
+ case d: return $$1(v$1 + "Hours", 0);
155
+ case u: return $$1(v$1 + "Minutes", 1);
156
+ case s: return $$1(v$1 + "Seconds", 2);
157
+ case i: return $$1(v$1 + "Milliseconds", 3);
158
+ default: return this.clone();
159
+ }
160
+ }, m$1.endOf = function(t$1) {
161
+ return this.startOf(t$1, !1);
162
+ }, m$1.$set = function(t$1, e$1) {
163
+ var n$1, o$1 = b.p(t$1), f$1 = "set" + (this.$u ? "UTC" : ""), l$1 = (n$1 = {}, n$1[a] = f$1 + "Date", n$1[d] = f$1 + "Date", n$1[c] = f$1 + "Month", n$1[h] = f$1 + "FullYear", n$1[u] = f$1 + "Hours", n$1[s] = f$1 + "Minutes", n$1[i] = f$1 + "Seconds", n$1[r] = f$1 + "Milliseconds", n$1)[o$1], $$1 = o$1 === a ? this.$D + (e$1 - this.$W) : e$1;
164
+ if (o$1 === c || o$1 === h) {
165
+ var y$1 = this.clone().set(d, 1);
166
+ y$1.$d[l$1]($$1), y$1.init(), this.$d = y$1.set(d, Math.min(this.$D, y$1.daysInMonth())).$d;
167
+ } else l$1 && this.$d[l$1]($$1);
168
+ return this.init(), this;
169
+ }, m$1.set = function(t$1, e$1) {
170
+ return this.clone().$set(t$1, e$1);
171
+ }, m$1.get = function(t$1) {
172
+ return this[b.p(t$1)]();
173
+ }, m$1.add = function(r$1, f$1) {
174
+ var d$1, l$1 = this;
175
+ r$1 = Number(r$1);
176
+ var $$1 = b.p(f$1), y$1 = function(t$1) {
177
+ var e$1 = O(l$1);
178
+ return b.w(e$1.date(e$1.date() + Math.round(t$1 * r$1)), l$1);
179
+ };
180
+ if ($$1 === c) return this.set(c, this.$M + r$1);
181
+ if ($$1 === h) return this.set(h, this.$y + r$1);
182
+ if ($$1 === a) return y$1(1);
183
+ if ($$1 === o) return y$1(7);
184
+ var M$2 = (d$1 = {}, d$1[s] = e, d$1[u] = n, d$1[i] = t, d$1)[$$1] || 1, m$2 = this.$d.getTime() + r$1 * M$2;
185
+ return b.w(m$2, this);
186
+ }, m$1.subtract = function(t$1, e$1) {
187
+ return this.add(-1 * t$1, e$1);
188
+ }, m$1.format = function(t$1) {
189
+ var e$1 = this, n$1 = this.$locale();
190
+ if (!this.isValid()) return n$1.invalidDate || l;
191
+ var r$1 = t$1 || "YYYY-MM-DDTHH:mm:ssZ", i$1 = b.z(this), s$1 = this.$H, u$1 = this.$m, a$1 = this.$M, o$1 = n$1.weekdays, c$1 = n$1.months, f$1 = n$1.meridiem, h$1 = function(t$2, n$2, i$2, s$2) {
192
+ return t$2 && (t$2[n$2] || t$2(e$1, r$1)) || i$2[n$2].slice(0, s$2);
193
+ }, d$1 = function(t$2) {
194
+ return b.s(s$1 % 12 || 12, t$2, "0");
195
+ }, $$1 = f$1 || function(t$2, e$2, n$2) {
196
+ var r$2 = t$2 < 12 ? "AM" : "PM";
197
+ return n$2 ? r$2.toLowerCase() : r$2;
198
+ };
199
+ return r$1.replace(y, (function(t$2, r$2) {
200
+ return r$2 || function(t$3) {
201
+ switch (t$3) {
202
+ case "YY": return String(e$1.$y).slice(-2);
203
+ case "YYYY": return b.s(e$1.$y, 4, "0");
204
+ case "M": return a$1 + 1;
205
+ case "MM": return b.s(a$1 + 1, 2, "0");
206
+ case "MMM": return h$1(n$1.monthsShort, a$1, c$1, 3);
207
+ case "MMMM": return h$1(c$1, a$1);
208
+ case "D": return e$1.$D;
209
+ case "DD": return b.s(e$1.$D, 2, "0");
210
+ case "d": return String(e$1.$W);
211
+ case "dd": return h$1(n$1.weekdaysMin, e$1.$W, o$1, 2);
212
+ case "ddd": return h$1(n$1.weekdaysShort, e$1.$W, o$1, 3);
213
+ case "dddd": return o$1[e$1.$W];
214
+ case "H": return String(s$1);
215
+ case "HH": return b.s(s$1, 2, "0");
216
+ case "h": return d$1(1);
217
+ case "hh": return d$1(2);
218
+ case "a": return $$1(s$1, u$1, !0);
219
+ case "A": return $$1(s$1, u$1, !1);
220
+ case "m": return String(u$1);
221
+ case "mm": return b.s(u$1, 2, "0");
222
+ case "s": return String(e$1.$s);
223
+ case "ss": return b.s(e$1.$s, 2, "0");
224
+ case "SSS": return b.s(e$1.$ms, 3, "0");
225
+ case "Z": return i$1;
226
+ }
227
+ return null;
228
+ }(t$2) || i$1.replace(":", "");
229
+ }));
230
+ }, m$1.utcOffset = function() {
231
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
232
+ }, m$1.diff = function(r$1, d$1, l$1) {
233
+ var $$1, y$1 = this, M$2 = b.p(d$1), m$2 = O(r$1), v$1 = (m$2.utcOffset() - this.utcOffset()) * e, g$1 = this - m$2, D$1 = function() {
234
+ return b.m(y$1, m$2);
235
+ };
236
+ switch (M$2) {
237
+ case h:
238
+ $$1 = D$1() / 12;
239
+ break;
240
+ case c:
241
+ $$1 = D$1();
242
+ break;
243
+ case f:
244
+ $$1 = D$1() / 3;
245
+ break;
246
+ case o:
247
+ $$1 = (g$1 - v$1) / 6048e5;
248
+ break;
249
+ case a:
250
+ $$1 = (g$1 - v$1) / 864e5;
251
+ break;
252
+ case u:
253
+ $$1 = g$1 / n;
254
+ break;
255
+ case s:
256
+ $$1 = g$1 / e;
257
+ break;
258
+ case i:
259
+ $$1 = g$1 / t;
260
+ break;
261
+ default: $$1 = g$1;
262
+ }
263
+ return l$1 ? $$1 : b.a($$1);
264
+ }, m$1.daysInMonth = function() {
265
+ return this.endOf(c).$D;
266
+ }, m$1.$locale = function() {
267
+ return D[this.$L];
268
+ }, m$1.locale = function(t$1, e$1) {
269
+ if (!t$1) return this.$L;
270
+ var n$1 = this.clone(), r$1 = w(t$1, e$1, !0);
271
+ return r$1 && (n$1.$L = r$1), n$1;
272
+ }, m$1.clone = function() {
273
+ return b.w(this.$d, this);
274
+ }, m$1.toDate = function() {
275
+ return new Date(this.valueOf());
276
+ }, m$1.toJSON = function() {
277
+ return this.isValid() ? this.toISOString() : null;
278
+ }, m$1.toISOString = function() {
279
+ return this.$d.toISOString();
280
+ }, m$1.toString = function() {
281
+ return this.$d.toUTCString();
282
+ }, M$1;
283
+ }(), k = _.prototype;
284
+ return O.prototype = k, [
285
+ ["$ms", r],
286
+ ["$s", i],
287
+ ["$m", s],
288
+ ["$H", u],
289
+ ["$W", a],
290
+ ["$M", c],
291
+ ["$y", h],
292
+ ["$D", d]
293
+ ].forEach((function(t$1) {
294
+ k[t$1[1]] = function(e$1) {
295
+ return this.$g(e$1, t$1[0], t$1[1]);
296
+ };
297
+ })), O.extend = function(t$1, e$1) {
298
+ return t$1.$i || (t$1(e$1, _, O), t$1.$i = !0), O;
299
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t$1) {
300
+ return O(1e3 * t$1);
301
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
302
+ }));
303
+ }));
304
+ var require_customParseFormat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
305
+ (function(e, t) {
306
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_customParseFormat = t();
307
+ })(exports, (function() {
308
+ var e = {
309
+ LTS: "h:mm:ss A",
310
+ LT: "h:mm A",
311
+ L: "MM/DD/YYYY",
312
+ LL: "MMMM D, YYYY",
313
+ LLL: "MMMM D, YYYY h:mm A",
314
+ LLLL: "dddd, MMMM D, YYYY h:mm A"
315
+ }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d\d/, r = /\d\d?/, i = /\d*[^-_:/,()\s\d]+/, o = {}, s = function(e$1) {
316
+ return (e$1 = +e$1) + (e$1 > 68 ? 1900 : 2e3);
317
+ };
318
+ var a = function(e$1) {
319
+ return function(t$1) {
320
+ this[e$1] = +t$1;
321
+ };
322
+ }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e$1) {
323
+ (this.zone || (this.zone = {})).offset = function(e$2) {
324
+ if (!e$2) return 0;
325
+ if ("Z" === e$2) return 0;
326
+ var t$1 = e$2.match(/([+-]|\d\d)/g), n$1 = 60 * t$1[1] + (+t$1[2] || 0);
327
+ return 0 === n$1 ? 0 : "+" === t$1[0] ? -n$1 : n$1;
328
+ }(e$1);
329
+ }], h = function(e$1) {
330
+ var t$1 = o[e$1];
331
+ return t$1 && (t$1.indexOf ? t$1 : t$1.s.concat(t$1.f));
332
+ }, u = function(e$1, t$1) {
333
+ var n$1, r$1 = o.meridiem;
334
+ if (r$1) {
335
+ for (var i$1 = 1; i$1 <= 24; i$1 += 1) if (e$1.indexOf(r$1(i$1, 0, t$1)) > -1) {
336
+ n$1 = i$1 > 12;
337
+ break;
338
+ }
339
+ } else n$1 = e$1 === (t$1 ? "pm" : "PM");
340
+ return n$1;
341
+ }, d = {
342
+ A: [i, function(e$1) {
343
+ this.afternoon = u(e$1, !1);
344
+ }],
345
+ a: [i, function(e$1) {
346
+ this.afternoon = u(e$1, !0);
347
+ }],
348
+ S: [/\d/, function(e$1) {
349
+ this.milliseconds = 100 * +e$1;
350
+ }],
351
+ SS: [n, function(e$1) {
352
+ this.milliseconds = 10 * +e$1;
353
+ }],
354
+ SSS: [/\d{3}/, function(e$1) {
355
+ this.milliseconds = +e$1;
356
+ }],
357
+ s: [r, a("seconds")],
358
+ ss: [r, a("seconds")],
359
+ m: [r, a("minutes")],
360
+ mm: [r, a("minutes")],
361
+ H: [r, a("hours")],
362
+ h: [r, a("hours")],
363
+ HH: [r, a("hours")],
364
+ hh: [r, a("hours")],
365
+ D: [r, a("day")],
366
+ DD: [n, a("day")],
367
+ Do: [i, function(e$1) {
368
+ var t$1 = o.ordinal;
369
+ if (this.day = e$1.match(/\d+/)[0], t$1) for (var r$1 = 1; r$1 <= 31; r$1 += 1) t$1(r$1).replace(/\[|\]/g, "") === e$1 && (this.day = r$1);
370
+ }],
371
+ M: [r, a("month")],
372
+ MM: [n, a("month")],
373
+ MMM: [i, function(e$1) {
374
+ var t$1 = h("months"), n$1 = (h("monthsShort") || t$1.map((function(e$2) {
375
+ return e$2.slice(0, 3);
376
+ }))).indexOf(e$1) + 1;
377
+ if (n$1 < 1) throw new Error();
378
+ this.month = n$1 % 12 || n$1;
379
+ }],
380
+ MMMM: [i, function(e$1) {
381
+ var t$1 = h("months").indexOf(e$1) + 1;
382
+ if (t$1 < 1) throw new Error();
383
+ this.month = t$1 % 12 || t$1;
384
+ }],
385
+ Y: [/[+-]?\d+/, a("year")],
386
+ YY: [n, function(e$1) {
387
+ this.year = s(e$1);
388
+ }],
389
+ YYYY: [/\d{4}/, a("year")],
390
+ Z: f,
391
+ ZZ: f
392
+ };
393
+ function c(n$1) {
394
+ var r$1 = n$1, i$1 = o && o.formats;
395
+ for (var s$1 = (n$1 = r$1.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t$1, n$2, r$2) {
396
+ var o$1 = r$2 && r$2.toUpperCase();
397
+ return n$2 || i$1[r$2] || e[r$2] || i$1[o$1].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e$1, t$2, n$3) {
398
+ return t$2 || n$3.slice(1);
399
+ }));
400
+ }))).match(t), a$1 = s$1.length, f$1 = 0; f$1 < a$1; f$1 += 1) {
401
+ var h$1 = s$1[f$1], u$1 = d[h$1], c$1 = u$1 && u$1[0], l = u$1 && u$1[1];
402
+ s$1[f$1] = l ? {
403
+ regex: c$1,
404
+ parser: l
405
+ } : h$1.replace(/^\[|\]$/g, "");
406
+ }
407
+ return function(e$1) {
408
+ for (var t$1 = {}, n$2 = 0, r$2 = 0; n$2 < a$1; n$2 += 1) {
409
+ var i$2 = s$1[n$2];
410
+ if ("string" == typeof i$2) r$2 += i$2.length;
411
+ else {
412
+ var o$1 = i$2.regex, f$2 = i$2.parser, h$2 = e$1.slice(r$2), u$2 = o$1.exec(h$2)[0];
413
+ f$2.call(t$1, u$2), e$1 = e$1.replace(u$2, "");
414
+ }
415
+ }
416
+ return function(e$2) {
417
+ var t$2 = e$2.afternoon;
418
+ if (void 0 !== t$2) {
419
+ var n$3 = e$2.hours;
420
+ t$2 ? n$3 < 12 && (e$2.hours += 12) : 12 === n$3 && (e$2.hours = 0), delete e$2.afternoon;
421
+ }
422
+ }(t$1), t$1;
423
+ };
424
+ }
425
+ return function(e$1, t$1, n$1) {
426
+ n$1.p.customParseFormat = !0, e$1 && e$1.parseTwoDigitYear && (s = e$1.parseTwoDigitYear);
427
+ var r$1 = t$1.prototype, i$1 = r$1.parse;
428
+ r$1.parse = function(e$2) {
429
+ var t$2 = e$2.date, r$2 = e$2.utc, s$1 = e$2.args;
430
+ this.$u = r$2;
431
+ var a$1 = s$1[1];
432
+ if ("string" == typeof a$1) {
433
+ var f$1 = !0 === s$1[2], h$1 = !0 === s$1[3], u$1 = f$1 || h$1, d$1 = s$1[2];
434
+ h$1 && (d$1 = s$1[2]), o = this.$locale(), !f$1 && d$1 && (o = n$1.Ls[d$1]), this.$d = function(e$3, t$3, n$2) {
435
+ try {
436
+ if (["x", "X"].indexOf(t$3) > -1) return /* @__PURE__ */ new Date(("X" === t$3 ? 1e3 : 1) * e$3);
437
+ var r$3 = c(t$3)(e$3), i$2 = r$3.year, o$1 = r$3.month, s$2 = r$3.day, a$2 = r$3.hours, f$2 = r$3.minutes, h$2 = r$3.seconds, u$2 = r$3.milliseconds, d$2 = r$3.zone, l$1 = /* @__PURE__ */ new Date(), m$1 = s$2 || (i$2 || o$1 ? 1 : l$1.getDate()), M$1 = i$2 || l$1.getFullYear(), Y = 0;
438
+ i$2 && !o$1 || (Y = o$1 > 0 ? o$1 - 1 : l$1.getMonth());
439
+ var p = a$2 || 0, v = f$2 || 0, D = h$2 || 0, g = u$2 || 0;
440
+ return d$2 ? new Date(Date.UTC(M$1, Y, m$1, p, v, D, g + 60 * d$2.offset * 1e3)) : n$2 ? new Date(Date.UTC(M$1, Y, m$1, p, v, D, g)) : new Date(M$1, Y, m$1, p, v, D, g);
441
+ } catch (e$4) {
442
+ return /* @__PURE__ */ new Date("");
443
+ }
444
+ }(t$2, a$1, r$2), this.init(), d$1 && !0 !== d$1 && (this.$L = this.locale(d$1).$L), u$1 && t$2 != this.format(a$1) && (this.$d = /* @__PURE__ */ new Date("")), o = {};
445
+ } else if (a$1 instanceof Array) for (var l = a$1.length, m = 1; m <= l; m += 1) {
446
+ s$1[1] = a$1[m - 1];
447
+ var M = n$1.apply(this, s$1);
448
+ if (M.isValid()) {
449
+ this.$d = M.$d, this.$L = M.$L, this.init();
450
+ break;
451
+ }
452
+ m === l && (this.$d = /* @__PURE__ */ new Date(""));
453
+ }
454
+ else i$1.call(this, e$2);
455
+ };
456
+ };
457
+ }));
458
+ }));
459
+ var timeUnits = [
460
+ "hours",
461
+ "minutes",
462
+ "seconds"
463
+ ];
464
+ var DEFAULT_FORMATS_TIME = "HH:mm:ss";
465
+ var DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
466
+ var DEFAULT_FORMATS_DATEPICKER = {
467
+ date: DEFAULT_FORMATS_DATE,
468
+ dates: DEFAULT_FORMATS_DATE,
469
+ week: "gggg[w]ww",
470
+ year: "YYYY",
471
+ month: "YYYY-MM",
472
+ datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
473
+ monthrange: "YYYY-MM",
474
+ daterange: DEFAULT_FORMATS_DATE,
475
+ datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
476
+ };
477
+ var import_dayjs_min$10 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
478
+ init_shared_esm_bundler();
479
+ var buildTimeList = (value, bound) => {
480
+ return [
481
+ value > 0 ? value - 1 : void 0,
482
+ value,
483
+ value < bound ? value + 1 : void 0
484
+ ];
485
+ };
486
+ var rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
487
+ var extractDateFormat = (format) => {
488
+ return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
489
+ };
490
+ var extractTimeFormat = (format) => {
491
+ return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
492
+ };
493
+ var dateEquals = function(a, b) {
494
+ const aIsDate = isDate(a);
495
+ const bIsDate = isDate(b);
496
+ if (aIsDate && bIsDate) return a.getTime() === b.getTime();
497
+ if (!aIsDate && !bIsDate) return a === b;
498
+ return false;
499
+ };
500
+ var valueEquals = function(a, b) {
501
+ const aIsArray = isArray(a);
502
+ const bIsArray = isArray(b);
503
+ if (aIsArray && bIsArray) {
504
+ if (a.length !== b.length) return false;
505
+ return a.every((item, index) => dateEquals(item, b[index]));
506
+ }
507
+ if (!aIsArray && !bIsArray) return dateEquals(a, b);
508
+ return false;
509
+ };
510
+ var parseDate = function(date$1, format, lang) {
511
+ const day = isEmpty(format) || format === "x" ? (0, import_dayjs_min$10.default)(date$1).locale(lang) : (0, import_dayjs_min$10.default)(date$1, format).locale(lang);
512
+ return day.isValid() ? day : void 0;
513
+ };
514
+ var formatter = function(date$1, format, lang) {
515
+ if (isEmpty(format)) return date$1;
516
+ if (format === "x") return +date$1;
517
+ return (0, import_dayjs_min$10.default)(date$1).locale(lang).format(format);
518
+ };
519
+ var makeList = (total, method) => {
520
+ var _a;
521
+ const arr = [];
522
+ const disabledArr = method == null ? void 0 : method();
523
+ for (let i = 0; i < total; i++) arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
524
+ return arr;
525
+ };
526
+ var disabledTimeListsProps = buildProps({
527
+ disabledHours: { type: definePropType(Function) },
528
+ disabledMinutes: { type: definePropType(Function) },
529
+ disabledSeconds: { type: definePropType(Function) }
530
+ });
531
+ var timePanelSharedProps = buildProps({
532
+ visible: Boolean,
533
+ actualVisible: {
534
+ type: Boolean,
535
+ default: void 0
536
+ },
537
+ format: {
538
+ type: String,
539
+ default: ""
540
+ }
541
+ });
542
+ var timePickerDefaultProps = buildProps({
543
+ id: { type: definePropType([Array, String]) },
544
+ name: {
545
+ type: definePropType([Array, String]),
546
+ default: ""
547
+ },
548
+ popperClass: {
549
+ type: String,
550
+ default: ""
551
+ },
552
+ format: String,
553
+ valueFormat: String,
554
+ dateFormat: String,
555
+ timeFormat: String,
556
+ type: {
557
+ type: String,
558
+ default: ""
559
+ },
560
+ clearable: {
561
+ type: Boolean,
562
+ default: true
563
+ },
564
+ clearIcon: {
565
+ type: definePropType([String, Object]),
566
+ default: circle_close_default
567
+ },
568
+ editable: {
569
+ type: Boolean,
570
+ default: true
571
+ },
572
+ prefixIcon: {
573
+ type: definePropType([String, Object]),
574
+ default: ""
575
+ },
576
+ size: useSizeProp,
577
+ readonly: Boolean,
578
+ disabled: Boolean,
579
+ placeholder: {
580
+ type: String,
581
+ default: ""
582
+ },
583
+ popperOptions: {
584
+ type: definePropType(Object),
585
+ default: () => ({})
586
+ },
587
+ modelValue: {
588
+ type: definePropType([
589
+ Date,
590
+ Array,
591
+ String,
592
+ Number
593
+ ]),
594
+ default: ""
595
+ },
596
+ rangeSeparator: {
597
+ type: String,
598
+ default: "-"
599
+ },
600
+ startPlaceholder: String,
601
+ endPlaceholder: String,
602
+ defaultValue: { type: definePropType([Date, Array]) },
603
+ defaultTime: { type: definePropType([Date, Array]) },
604
+ isRange: Boolean,
605
+ ...disabledTimeListsProps,
606
+ disabledDate: { type: Function },
607
+ cellClassName: { type: Function },
608
+ shortcuts: {
609
+ type: Array,
610
+ default: () => []
611
+ },
612
+ arrowControl: Boolean,
613
+ label: {
614
+ type: String,
615
+ default: void 0
616
+ },
617
+ tabindex: {
618
+ type: definePropType([String, Number]),
619
+ default: 0
620
+ },
621
+ validateEvent: {
622
+ type: Boolean,
623
+ default: true
624
+ },
625
+ unlinkPanels: Boolean
626
+ });
627
+ init_shared_esm_bundler();
628
+ var _hoisted_1$7 = [
629
+ "id",
630
+ "name",
631
+ "placeholder",
632
+ "value",
633
+ "disabled",
634
+ "readonly"
635
+ ];
636
+ var _hoisted_2$7 = [
637
+ "id",
638
+ "name",
639
+ "placeholder",
640
+ "value",
641
+ "disabled",
642
+ "readonly"
643
+ ];
644
+ var CommonPicker = /* @__PURE__ */ _export_sfc(/* @__PURE__ */ defineComponent({
645
+ ...defineComponent({ name: "Picker" }),
646
+ props: timePickerDefaultProps,
647
+ emits: [
648
+ "update:modelValue",
649
+ "change",
650
+ "focus",
651
+ "blur",
652
+ "calendar-change",
653
+ "panel-change",
654
+ "visible-change",
655
+ "keydown"
656
+ ],
657
+ setup(__props, { expose, emit }) {
658
+ const props = __props;
659
+ const attrs = useAttrs();
660
+ const { lang } = useLocale();
661
+ const nsDate = useNamespace("date");
662
+ const nsInput = useNamespace("input");
663
+ const nsRange = useNamespace("range");
664
+ const { form, formItem } = useFormItem();
665
+ const elPopperOptions = inject("ElPopperOptions", {});
666
+ const refPopper = ref();
667
+ const inputRef = ref();
668
+ const pickerVisible = ref(false);
669
+ const pickerActualVisible = ref(false);
670
+ const valueOnOpen = ref(null);
671
+ let hasJustTabExitedInput = false;
672
+ let ignoreFocusEvent = false;
673
+ const rangeInputKls = computed(() => [
674
+ nsDate.b("editor"),
675
+ nsDate.bm("editor", props.type),
676
+ nsInput.e("wrapper"),
677
+ nsDate.is("disabled", pickerDisabled.value),
678
+ nsDate.is("active", pickerVisible.value),
679
+ nsRange.b("editor"),
680
+ pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
681
+ attrs.class
682
+ ]);
683
+ const clearIconKls = computed(() => [
684
+ nsInput.e("icon"),
685
+ nsRange.e("close-icon"),
686
+ !showClose.value ? nsRange.e("close-icon--hidden") : ""
687
+ ]);
688
+ watch(pickerVisible, (val) => {
689
+ if (!val) {
690
+ userInput.value = null;
691
+ nextTick(() => {
692
+ emitChange(props.modelValue);
693
+ });
694
+ } else nextTick(() => {
695
+ if (val) valueOnOpen.value = props.modelValue;
696
+ });
697
+ });
698
+ const emitChange = (val, isClear) => {
699
+ if (isClear || !valueEquals(val, valueOnOpen.value)) {
700
+ emit("change", val);
701
+ props.validateEvent && formItem?.validate("change").catch((err) => debugWarn(err));
702
+ }
703
+ };
704
+ const emitInput = (input) => {
705
+ if (!valueEquals(props.modelValue, input)) {
706
+ let formatted;
707
+ if (isArray(input)) formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
708
+ else if (input) formatted = formatter(input, props.valueFormat, lang.value);
709
+ emit("update:modelValue", input ? formatted : input, lang.value);
710
+ }
711
+ };
712
+ const emitKeydown = (e) => {
713
+ emit("keydown", e);
714
+ };
715
+ const refInput = computed(() => {
716
+ if (inputRef.value) {
717
+ const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
718
+ return Array.from(_r.querySelectorAll("input"));
719
+ }
720
+ return [];
721
+ });
722
+ const setSelectionRange = (start, end, pos) => {
723
+ const _inputs = refInput.value;
724
+ if (!_inputs.length) return;
725
+ if (!pos || pos === "min") {
726
+ _inputs[0].setSelectionRange(start, end);
727
+ _inputs[0].focus();
728
+ } else if (pos === "max") {
729
+ _inputs[1].setSelectionRange(start, end);
730
+ _inputs[1].focus();
731
+ }
732
+ };
733
+ const focusOnInputBox = () => {
734
+ focus(true, true);
735
+ nextTick(() => {
736
+ ignoreFocusEvent = false;
737
+ });
738
+ };
739
+ const onPick = (date$1 = "", visible = false) => {
740
+ if (!visible) ignoreFocusEvent = true;
741
+ pickerVisible.value = visible;
742
+ let result;
743
+ if (isArray(date$1)) result = date$1.map((_) => _.toDate());
744
+ else result = date$1 ? date$1.toDate() : date$1;
745
+ userInput.value = null;
746
+ emitInput(result);
747
+ };
748
+ const onBeforeShow = () => {
749
+ pickerActualVisible.value = true;
750
+ };
751
+ const onShow = () => {
752
+ emit("visible-change", true);
753
+ };
754
+ const onKeydownPopperContent = (event) => {
755
+ if ((event == null ? void 0 : event.key) === EVENT_CODE.esc) focus(true, true);
756
+ };
757
+ const onHide = () => {
758
+ pickerActualVisible.value = false;
759
+ pickerVisible.value = false;
760
+ ignoreFocusEvent = false;
761
+ emit("visible-change", false);
762
+ };
763
+ const handleOpen = () => {
764
+ pickerVisible.value = true;
765
+ };
766
+ const handleClose = () => {
767
+ pickerVisible.value = false;
768
+ };
769
+ const focus = (focusStartInput = true, isIgnoreFocusEvent = false) => {
770
+ ignoreFocusEvent = isIgnoreFocusEvent;
771
+ const [leftInput, rightInput] = unref(refInput);
772
+ let input = leftInput;
773
+ if (!focusStartInput && isRangeInput.value) input = rightInput;
774
+ if (input) input.focus();
775
+ };
776
+ const handleFocusInput = (e) => {
777
+ if (props.readonly || pickerDisabled.value || pickerVisible.value || ignoreFocusEvent) return;
778
+ pickerVisible.value = true;
779
+ emit("focus", e);
780
+ };
781
+ let currentHandleBlurDeferCallback = void 0;
782
+ const handleBlurInput = (e) => {
783
+ const handleBlurDefer = async () => {
784
+ setTimeout(() => {
785
+ var _a;
786
+ if (currentHandleBlurDeferCallback === handleBlurDefer) {
787
+ if (!(((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent()) && !hasJustTabExitedInput) && refInput.value.filter((input) => {
788
+ return input.contains(document.activeElement);
789
+ }).length === 0) {
790
+ handleChange();
791
+ pickerVisible.value = false;
792
+ emit("blur", e);
793
+ props.validateEvent && formItem?.validate("blur").catch((err) => debugWarn(err));
794
+ }
795
+ hasJustTabExitedInput = false;
796
+ }
797
+ }, 0);
798
+ };
799
+ currentHandleBlurDeferCallback = handleBlurDefer;
800
+ handleBlurDefer();
801
+ };
802
+ const pickerDisabled = computed(() => {
803
+ return props.disabled || (form == null ? void 0 : form.disabled);
804
+ });
805
+ const parsedValue$1 = computed(() => {
806
+ let dayOrDays;
807
+ if (valueIsEmpty.value) {
808
+ if (pickerOptions.value.getDefaultValue) dayOrDays = pickerOptions.value.getDefaultValue();
809
+ } else if (isArray(props.modelValue)) dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
810
+ else dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
811
+ if (pickerOptions.value.getRangeAvailableTime) {
812
+ const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
813
+ if (!isEqual_default(availableResult, dayOrDays)) {
814
+ dayOrDays = availableResult;
815
+ emitInput(isArray(dayOrDays) ? dayOrDays.map((_) => _.toDate()) : dayOrDays.toDate());
816
+ }
817
+ }
818
+ if (isArray(dayOrDays) && dayOrDays.some((day) => !day)) dayOrDays = [];
819
+ return dayOrDays;
820
+ });
821
+ const displayValue = computed(() => {
822
+ if (!pickerOptions.value.panelReady) return "";
823
+ const formattedValue = formatDayjsToString(parsedValue$1.value);
824
+ if (isArray(userInput.value)) return [userInput.value[0] || formattedValue && formattedValue[0] || "", userInput.value[1] || formattedValue && formattedValue[1] || ""];
825
+ else if (userInput.value !== null) return userInput.value;
826
+ if (!isTimePicker.value && valueIsEmpty.value) return "";
827
+ if (!pickerVisible.value && valueIsEmpty.value) return "";
828
+ if (formattedValue) return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
829
+ return "";
830
+ });
831
+ const isTimeLikePicker = computed(() => props.type.includes("time"));
832
+ const isTimePicker = computed(() => props.type.startsWith("time"));
833
+ const isDatesPicker = computed(() => props.type === "dates");
834
+ const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
835
+ const showClose = ref(false);
836
+ const onClearIconClick = (event) => {
837
+ if (props.readonly || pickerDisabled.value) return;
838
+ if (showClose.value) {
839
+ event.stopPropagation();
840
+ focusOnInputBox();
841
+ emitInput(null);
842
+ emitChange(null, true);
843
+ showClose.value = false;
844
+ pickerVisible.value = false;
845
+ pickerOptions.value.handleClear && pickerOptions.value.handleClear();
846
+ }
847
+ };
848
+ const valueIsEmpty = computed(() => {
849
+ const { modelValue } = props;
850
+ return !modelValue || isArray(modelValue) && !modelValue.filter(Boolean).length;
851
+ });
852
+ const onMouseDownInput = async (event) => {
853
+ var _a;
854
+ if (props.readonly || pickerDisabled.value) return;
855
+ if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) pickerVisible.value = true;
856
+ };
857
+ const onMouseEnter = () => {
858
+ if (props.readonly || pickerDisabled.value) return;
859
+ if (!valueIsEmpty.value && props.clearable) showClose.value = true;
860
+ };
861
+ const onMouseLeave = () => {
862
+ showClose.value = false;
863
+ };
864
+ const onTouchStartInput = (event) => {
865
+ var _a;
866
+ if (props.readonly || pickerDisabled.value) return;
867
+ if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) pickerVisible.value = true;
868
+ };
869
+ const isRangeInput = computed(() => {
870
+ return props.type.includes("range");
871
+ });
872
+ const pickerSize = useFormSize();
873
+ const popperEl = computed(() => {
874
+ var _a, _b;
875
+ return (_b = (_a = unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
876
+ });
877
+ const actualInputRef = computed(() => {
878
+ var _a;
879
+ if (unref(isRangeInput)) return unref(inputRef);
880
+ return (_a = unref(inputRef)) == null ? void 0 : _a.$el;
881
+ });
882
+ onClickOutside(actualInputRef, (e) => {
883
+ const unrefedPopperEl = unref(popperEl);
884
+ const inputEl = unref(actualInputRef);
885
+ if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl)) return;
886
+ pickerVisible.value = false;
887
+ });
888
+ const userInput = ref(null);
889
+ const handleChange = () => {
890
+ if (userInput.value) {
891
+ const value = parseUserInputToDayjs(displayValue.value);
892
+ if (value) {
893
+ if (isValidValue(value)) {
894
+ emitInput(isArray(value) ? value.map((_) => _.toDate()) : value.toDate());
895
+ userInput.value = null;
896
+ }
897
+ }
898
+ }
899
+ if (userInput.value === "") {
900
+ emitInput(null);
901
+ emitChange(null);
902
+ userInput.value = null;
903
+ }
904
+ };
905
+ const parseUserInputToDayjs = (value) => {
906
+ if (!value) return null;
907
+ return pickerOptions.value.parseUserInput(value);
908
+ };
909
+ const formatDayjsToString = (value) => {
910
+ if (!value) return null;
911
+ return pickerOptions.value.formatToString(value);
912
+ };
913
+ const isValidValue = (value) => {
914
+ return pickerOptions.value.isValidValue(value);
915
+ };
916
+ const handleKeydownInput = async (event) => {
917
+ if (props.readonly || pickerDisabled.value) return;
918
+ const { code } = event;
919
+ emitKeydown(event);
920
+ if (code === EVENT_CODE.esc) {
921
+ if (pickerVisible.value === true) {
922
+ pickerVisible.value = false;
923
+ event.preventDefault();
924
+ event.stopPropagation();
925
+ }
926
+ return;
927
+ }
928
+ if (code === EVENT_CODE.down) {
929
+ if (pickerOptions.value.handleFocusPicker) {
930
+ event.preventDefault();
931
+ event.stopPropagation();
932
+ }
933
+ if (pickerVisible.value === false) {
934
+ pickerVisible.value = true;
935
+ await nextTick();
936
+ }
937
+ if (pickerOptions.value.handleFocusPicker) {
938
+ pickerOptions.value.handleFocusPicker();
939
+ return;
940
+ }
941
+ }
942
+ if (code === EVENT_CODE.tab) {
943
+ hasJustTabExitedInput = true;
944
+ return;
945
+ }
946
+ if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
947
+ if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
948
+ handleChange();
949
+ pickerVisible.value = false;
950
+ }
951
+ event.stopPropagation();
952
+ return;
953
+ }
954
+ if (userInput.value) {
955
+ event.stopPropagation();
956
+ return;
957
+ }
958
+ if (pickerOptions.value.handleKeydownInput) pickerOptions.value.handleKeydownInput(event);
959
+ };
960
+ const onUserInput = (e) => {
961
+ userInput.value = e;
962
+ if (!pickerVisible.value) pickerVisible.value = true;
963
+ };
964
+ const handleStartInput = (event) => {
965
+ const target = event.target;
966
+ if (userInput.value) userInput.value = [target.value, userInput.value[1]];
967
+ else userInput.value = [target.value, null];
968
+ };
969
+ const handleEndInput = (event) => {
970
+ const target = event.target;
971
+ if (userInput.value) userInput.value = [userInput.value[0], target.value];
972
+ else userInput.value = [null, target.value];
973
+ };
974
+ const handleStartChange = () => {
975
+ var _a;
976
+ const values = userInput.value;
977
+ const value = parseUserInputToDayjs(values && values[0]);
978
+ const parsedVal = unref(parsedValue$1);
979
+ if (value && value.isValid()) {
980
+ userInput.value = [formatDayjsToString(value), ((_a = displayValue.value) == null ? void 0 : _a[1]) || null];
981
+ const newValue = [value, parsedVal && (parsedVal[1] || null)];
982
+ if (isValidValue(newValue)) {
983
+ emitInput(newValue);
984
+ userInput.value = null;
985
+ }
986
+ }
987
+ };
988
+ const handleEndChange = () => {
989
+ var _a;
990
+ const values = unref(userInput);
991
+ const value = parseUserInputToDayjs(values && values[1]);
992
+ const parsedVal = unref(parsedValue$1);
993
+ if (value && value.isValid()) {
994
+ userInput.value = [((_a = unref(displayValue)) == null ? void 0 : _a[0]) || null, formatDayjsToString(value)];
995
+ const newValue = [parsedVal && parsedVal[0], value];
996
+ if (isValidValue(newValue)) {
997
+ emitInput(newValue);
998
+ userInput.value = null;
999
+ }
1000
+ }
1001
+ };
1002
+ const pickerOptions = ref({});
1003
+ const onSetPickerOption = (e) => {
1004
+ pickerOptions.value[e[0]] = e[1];
1005
+ pickerOptions.value.panelReady = true;
1006
+ };
1007
+ const onCalendarChange = (e) => {
1008
+ emit("calendar-change", e);
1009
+ };
1010
+ const onPanelChange = (value, mode, view) => {
1011
+ emit("panel-change", value, mode, view);
1012
+ };
1013
+ provide("EP_PICKER_BASE", { props });
1014
+ expose({
1015
+ focus,
1016
+ handleFocusInput,
1017
+ handleBlurInput,
1018
+ handleOpen,
1019
+ handleClose,
1020
+ onPick
1021
+ });
1022
+ return (_ctx, _cache) => {
1023
+ return openBlock(), createBlock(unref(ElTooltip), mergeProps({
1024
+ ref_key: "refPopper",
1025
+ ref: refPopper,
1026
+ visible: pickerVisible.value,
1027
+ effect: "light",
1028
+ pure: "",
1029
+ trigger: "click"
1030
+ }, _ctx.$attrs, {
1031
+ role: "dialog",
1032
+ teleported: "",
1033
+ transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
1034
+ "popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
1035
+ "popper-options": unref(elPopperOptions),
1036
+ "fallback-placements": [
1037
+ "bottom",
1038
+ "top",
1039
+ "right",
1040
+ "left"
1041
+ ],
1042
+ "gpu-acceleration": false,
1043
+ "stop-popper-mouse-event": false,
1044
+ "hide-after": 0,
1045
+ persistent: "",
1046
+ onBeforeShow,
1047
+ onShow,
1048
+ onHide
1049
+ }), {
1050
+ default: withCtx(() => [!unref(isRangeInput) ? (openBlock(), createBlock(unref(ElInput), {
1051
+ key: 0,
1052
+ id: _ctx.id,
1053
+ ref_key: "inputRef",
1054
+ ref: inputRef,
1055
+ "container-role": "combobox",
1056
+ "model-value": unref(displayValue),
1057
+ name: _ctx.name,
1058
+ size: unref(pickerSize),
1059
+ disabled: unref(pickerDisabled),
1060
+ placeholder: _ctx.placeholder,
1061
+ class: normalizeClass([
1062
+ unref(nsDate).b("editor"),
1063
+ unref(nsDate).bm("editor", _ctx.type),
1064
+ _ctx.$attrs.class
1065
+ ]),
1066
+ style: normalizeStyle(_ctx.$attrs.style),
1067
+ readonly: !_ctx.editable || _ctx.readonly || unref(isDatesPicker) || _ctx.type === "week",
1068
+ label: _ctx.label,
1069
+ tabindex: _ctx.tabindex,
1070
+ "validate-event": false,
1071
+ onInput: onUserInput,
1072
+ onFocus: handleFocusInput,
1073
+ onBlur: handleBlurInput,
1074
+ onKeydown: handleKeydownInput,
1075
+ onChange: handleChange,
1076
+ onMousedown: onMouseDownInput,
1077
+ onMouseenter: onMouseEnter,
1078
+ onMouseleave: onMouseLeave,
1079
+ onTouchstart: onTouchStartInput,
1080
+ onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
1081
+ }, {
1082
+ prefix: withCtx(() => [unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
1083
+ key: 0,
1084
+ class: normalizeClass(unref(nsInput).e("icon")),
1085
+ onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
1086
+ onTouchstart: onTouchStartInput
1087
+ }, {
1088
+ default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))]),
1089
+ _: 1
1090
+ }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)]),
1091
+ suffix: withCtx(() => [showClose.value && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
1092
+ key: 0,
1093
+ class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
1094
+ onClick: withModifiers(onClearIconClick, ["stop"])
1095
+ }, {
1096
+ default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
1097
+ _: 1
1098
+ }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)]),
1099
+ _: 1
1100
+ }, 8, [
1101
+ "id",
1102
+ "model-value",
1103
+ "name",
1104
+ "size",
1105
+ "disabled",
1106
+ "placeholder",
1107
+ "class",
1108
+ "style",
1109
+ "readonly",
1110
+ "label",
1111
+ "tabindex",
1112
+ "onKeydown"
1113
+ ])) : (openBlock(), createElementBlock("div", {
1114
+ key: 1,
1115
+ ref_key: "inputRef",
1116
+ ref: inputRef,
1117
+ class: normalizeClass(unref(rangeInputKls)),
1118
+ style: normalizeStyle(_ctx.$attrs.style),
1119
+ onClick: handleFocusInput,
1120
+ onMouseenter: onMouseEnter,
1121
+ onMouseleave: onMouseLeave,
1122
+ onTouchstart: onTouchStartInput,
1123
+ onKeydown: handleKeydownInput
1124
+ }, [
1125
+ unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
1126
+ key: 0,
1127
+ class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")]),
1128
+ onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
1129
+ onTouchstart: onTouchStartInput
1130
+ }, {
1131
+ default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))]),
1132
+ _: 1
1133
+ }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
1134
+ createBaseVNode("input", {
1135
+ id: _ctx.id && _ctx.id[0],
1136
+ autocomplete: "off",
1137
+ name: _ctx.name && _ctx.name[0],
1138
+ placeholder: _ctx.startPlaceholder,
1139
+ value: unref(displayValue) && unref(displayValue)[0],
1140
+ disabled: unref(pickerDisabled),
1141
+ readonly: !_ctx.editable || _ctx.readonly,
1142
+ class: normalizeClass(unref(nsRange).b("input")),
1143
+ onMousedown: onMouseDownInput,
1144
+ onInput: handleStartInput,
1145
+ onChange: handleStartChange,
1146
+ onFocus: handleFocusInput,
1147
+ onBlur: handleBlurInput
1148
+ }, null, 42, _hoisted_1$7),
1149
+ renderSlot(_ctx.$slots, "range-separator", {}, () => [createBaseVNode("span", { class: normalizeClass(unref(nsRange).b("separator")) }, toDisplayString(_ctx.rangeSeparator), 3)]),
1150
+ createBaseVNode("input", {
1151
+ id: _ctx.id && _ctx.id[1],
1152
+ autocomplete: "off",
1153
+ name: _ctx.name && _ctx.name[1],
1154
+ placeholder: _ctx.endPlaceholder,
1155
+ value: unref(displayValue) && unref(displayValue)[1],
1156
+ disabled: unref(pickerDisabled),
1157
+ readonly: !_ctx.editable || _ctx.readonly,
1158
+ class: normalizeClass(unref(nsRange).b("input")),
1159
+ onMousedown: onMouseDownInput,
1160
+ onFocus: handleFocusInput,
1161
+ onBlur: handleBlurInput,
1162
+ onInput: handleEndInput,
1163
+ onChange: handleEndChange
1164
+ }, null, 42, _hoisted_2$7),
1165
+ _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
1166
+ key: 1,
1167
+ class: normalizeClass(unref(clearIconKls)),
1168
+ onClick: onClearIconClick
1169
+ }, {
1170
+ default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
1171
+ _: 1
1172
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
1173
+ ], 38))]),
1174
+ content: withCtx(() => [renderSlot(_ctx.$slots, "default", {
1175
+ visible: pickerVisible.value,
1176
+ actualVisible: pickerActualVisible.value,
1177
+ parsedValue: unref(parsedValue$1),
1178
+ format: _ctx.format,
1179
+ dateFormat: _ctx.dateFormat,
1180
+ timeFormat: _ctx.timeFormat,
1181
+ unlinkPanels: _ctx.unlinkPanels,
1182
+ type: _ctx.type,
1183
+ defaultValue: _ctx.defaultValue,
1184
+ onPick,
1185
+ onSelectRange: setSelectionRange,
1186
+ onSetPickerOption,
1187
+ onCalendarChange,
1188
+ onPanelChange,
1189
+ onKeydown: onKeydownPopperContent,
1190
+ onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
1191
+ })]),
1192
+ _: 3
1193
+ }, 16, [
1194
+ "visible",
1195
+ "transition",
1196
+ "popper-class",
1197
+ "popper-options"
1198
+ ]);
1199
+ };
1200
+ }
1201
+ }), [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/common/picker.vue"]]);
1202
+ var panelTimePickerProps = buildProps({
1203
+ ...timePanelSharedProps,
1204
+ datetimeRole: String,
1205
+ parsedValue: { type: definePropType(Object) }
1206
+ });
1207
+ var useTimePanel = ({ getAvailableHours, getAvailableMinutes, getAvailableSeconds }) => {
1208
+ const getAvailableTime = (date$1, role, first, compareDate) => {
1209
+ const availableTimeGetters = {
1210
+ hour: getAvailableHours,
1211
+ minute: getAvailableMinutes,
1212
+ second: getAvailableSeconds
1213
+ };
1214
+ let result = date$1;
1215
+ [
1216
+ "hour",
1217
+ "minute",
1218
+ "second"
1219
+ ].forEach((type) => {
1220
+ if (availableTimeGetters[type]) {
1221
+ let availableTimeSlots;
1222
+ const method = availableTimeGetters[type];
1223
+ switch (type) {
1224
+ case "minute":
1225
+ availableTimeSlots = method(result.hour(), role, compareDate);
1226
+ break;
1227
+ case "second":
1228
+ availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
1229
+ break;
1230
+ default:
1231
+ availableTimeSlots = method(role, compareDate);
1232
+ break;
1233
+ }
1234
+ if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
1235
+ const pos = first ? 0 : availableTimeSlots.length - 1;
1236
+ result = result[type](availableTimeSlots[pos]);
1237
+ }
1238
+ }
1239
+ });
1240
+ return result;
1241
+ };
1242
+ const timePickerOptions = {};
1243
+ const onSetOption = ([key, val]) => {
1244
+ timePickerOptions[key] = val;
1245
+ };
1246
+ return {
1247
+ timePickerOptions,
1248
+ getAvailableTime,
1249
+ onSetOption
1250
+ };
1251
+ };
1252
+ var makeAvailableArr = (disabledList) => {
1253
+ const trueOrNumber = (isDisabled, index) => isDisabled || index;
1254
+ const getNumber = (predicate) => predicate !== true;
1255
+ return disabledList.map(trueOrNumber).filter(getNumber);
1256
+ };
1257
+ var getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
1258
+ const getHoursList = (role, compare) => {
1259
+ return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
1260
+ };
1261
+ const getMinutesList = (hour, role, compare) => {
1262
+ return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
1263
+ };
1264
+ const getSecondsList = (hour, minute, role, compare) => {
1265
+ return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
1266
+ };
1267
+ return {
1268
+ getHoursList,
1269
+ getMinutesList,
1270
+ getSecondsList
1271
+ };
1272
+ };
1273
+ var buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
1274
+ const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
1275
+ const getAvailableHours = (role, compare) => {
1276
+ return makeAvailableArr(getHoursList(role, compare));
1277
+ };
1278
+ const getAvailableMinutes = (hour, role, compare) => {
1279
+ return makeAvailableArr(getMinutesList(hour, role, compare));
1280
+ };
1281
+ const getAvailableSeconds = (hour, minute, role, compare) => {
1282
+ return makeAvailableArr(getSecondsList(hour, minute, role, compare));
1283
+ };
1284
+ return {
1285
+ getAvailableHours,
1286
+ getAvailableMinutes,
1287
+ getAvailableSeconds
1288
+ };
1289
+ };
1290
+ var useOldValue = (props) => {
1291
+ const oldValue = ref(props.parsedValue);
1292
+ watch(() => props.visible, (val) => {
1293
+ if (!val) oldValue.value = props.parsedValue;
1294
+ });
1295
+ return oldValue;
1296
+ };
1297
+ var basicTimeSpinnerProps = buildProps({
1298
+ role: {
1299
+ type: String,
1300
+ required: true
1301
+ },
1302
+ spinnerDate: {
1303
+ type: definePropType(Object),
1304
+ required: true
1305
+ },
1306
+ showSeconds: {
1307
+ type: Boolean,
1308
+ default: true
1309
+ },
1310
+ arrowControl: Boolean,
1311
+ amPmMode: {
1312
+ type: definePropType(String),
1313
+ default: ""
1314
+ },
1315
+ ...disabledTimeListsProps
1316
+ });
1317
+ var _hoisted_1$6 = ["onClick"];
1318
+ var _hoisted_2$6 = ["onMouseenter"];
1319
+ var TimeSpinner = /* @__PURE__ */ _export_sfc(/* @__PURE__ */ defineComponent({
1320
+ __name: "basic-time-spinner",
1321
+ props: basicTimeSpinnerProps,
1322
+ emits: [
1323
+ "change",
1324
+ "select-range",
1325
+ "set-option"
1326
+ ],
1327
+ setup(__props, { emit }) {
1328
+ const props = __props;
1329
+ const ns = useNamespace("time");
1330
+ const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
1331
+ let isScrolling = false;
1332
+ const currentScrollbar = ref();
1333
+ const listRefsMap = {
1334
+ hours: ref(),
1335
+ minutes: ref(),
1336
+ seconds: ref()
1337
+ };
1338
+ const spinnerItems = computed(() => {
1339
+ return props.showSeconds ? timeUnits : timeUnits.slice(0, 2);
1340
+ });
1341
+ const timePartials = computed(() => {
1342
+ const { spinnerDate } = props;
1343
+ return {
1344
+ hours: spinnerDate.hour(),
1345
+ minutes: spinnerDate.minute(),
1346
+ seconds: spinnerDate.second()
1347
+ };
1348
+ });
1349
+ const timeList = computed(() => {
1350
+ const { hours, minutes } = unref(timePartials);
1351
+ return {
1352
+ hours: getHoursList(props.role),
1353
+ minutes: getMinutesList(hours, props.role),
1354
+ seconds: getSecondsList(hours, minutes, props.role)
1355
+ };
1356
+ });
1357
+ const arrowControlTimeList = computed(() => {
1358
+ const { hours, minutes, seconds } = unref(timePartials);
1359
+ return {
1360
+ hours: buildTimeList(hours, 23),
1361
+ minutes: buildTimeList(minutes, 59),
1362
+ seconds: buildTimeList(seconds, 59)
1363
+ };
1364
+ });
1365
+ const debouncedResetScroll = debounce_default((type) => {
1366
+ isScrolling = false;
1367
+ adjustCurrentSpinner(type);
1368
+ }, 200);
1369
+ const getAmPmFlag = (hour) => {
1370
+ if (!!!props.amPmMode) return "";
1371
+ const isCapital = props.amPmMode === "A";
1372
+ let content = hour < 12 ? " am" : " pm";
1373
+ if (isCapital) content = content.toUpperCase();
1374
+ return content;
1375
+ };
1376
+ const emitSelectRange = (type) => {
1377
+ let range;
1378
+ switch (type) {
1379
+ case "hours":
1380
+ range = [0, 2];
1381
+ break;
1382
+ case "minutes":
1383
+ range = [3, 5];
1384
+ break;
1385
+ case "seconds":
1386
+ range = [6, 8];
1387
+ break;
1388
+ }
1389
+ const [left, right] = range;
1390
+ emit("select-range", left, right);
1391
+ currentScrollbar.value = type;
1392
+ };
1393
+ const adjustCurrentSpinner = (type) => {
1394
+ adjustSpinner(type, unref(timePartials)[type]);
1395
+ };
1396
+ const adjustSpinners = () => {
1397
+ adjustCurrentSpinner("hours");
1398
+ adjustCurrentSpinner("minutes");
1399
+ adjustCurrentSpinner("seconds");
1400
+ };
1401
+ const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
1402
+ const adjustSpinner = (type, value) => {
1403
+ if (props.arrowControl) return;
1404
+ const scrollbar = unref(listRefsMap[type]);
1405
+ if (scrollbar && scrollbar.$el) getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
1406
+ };
1407
+ const typeItemHeight = (type) => {
1408
+ const scrollbar = unref(listRefsMap[type]);
1409
+ const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
1410
+ if (listItem) return Number.parseFloat(getStyle(listItem, "height")) || 0;
1411
+ return 0;
1412
+ };
1413
+ const onIncrement = () => {
1414
+ scrollDown(1);
1415
+ };
1416
+ const onDecrement = () => {
1417
+ scrollDown(-1);
1418
+ };
1419
+ const scrollDown = (step) => {
1420
+ if (!currentScrollbar.value) emitSelectRange("hours");
1421
+ const label = currentScrollbar.value;
1422
+ const now = unref(timePartials)[label];
1423
+ const next = findNextUnDisabled(label, now, step, currentScrollbar.value === "hours" ? 24 : 60);
1424
+ modifyDateField(label, next);
1425
+ adjustSpinner(label, next);
1426
+ nextTick(() => emitSelectRange(label));
1427
+ };
1428
+ const findNextUnDisabled = (type, now, step, total) => {
1429
+ let next = (now + step + total) % total;
1430
+ const list = unref(timeList)[type];
1431
+ while (list[next] && next !== now) next = (next + step + total) % total;
1432
+ return next;
1433
+ };
1434
+ const modifyDateField = (type, value) => {
1435
+ if (unref(timeList)[type][value]) return;
1436
+ const { hours, minutes, seconds } = unref(timePartials);
1437
+ let changeTo;
1438
+ switch (type) {
1439
+ case "hours":
1440
+ changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
1441
+ break;
1442
+ case "minutes":
1443
+ changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
1444
+ break;
1445
+ case "seconds":
1446
+ changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
1447
+ break;
1448
+ }
1449
+ emit("change", changeTo);
1450
+ };
1451
+ const handleClick = (type, { value, disabled }) => {
1452
+ if (!disabled) {
1453
+ modifyDateField(type, value);
1454
+ emitSelectRange(type);
1455
+ adjustSpinner(type, value);
1456
+ }
1457
+ };
1458
+ const handleScroll = (type) => {
1459
+ isScrolling = true;
1460
+ debouncedResetScroll(type);
1461
+ modifyDateField(type, Math.min(Math.round((getScrollbarElement(unref(listRefsMap[type]).$el).scrollTop - (scrollBarHeight(type) * .5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59));
1462
+ };
1463
+ const scrollBarHeight = (type) => {
1464
+ return unref(listRefsMap[type]).$el.offsetHeight;
1465
+ };
1466
+ const bindScrollEvent = () => {
1467
+ const bindFunction = (type) => {
1468
+ const scrollbar = unref(listRefsMap[type]);
1469
+ if (scrollbar && scrollbar.$el) getScrollbarElement(scrollbar.$el).onscroll = () => {
1470
+ handleScroll(type);
1471
+ };
1472
+ };
1473
+ bindFunction("hours");
1474
+ bindFunction("minutes");
1475
+ bindFunction("seconds");
1476
+ };
1477
+ onMounted(() => {
1478
+ nextTick(() => {
1479
+ !props.arrowControl && bindScrollEvent();
1480
+ adjustSpinners();
1481
+ if (props.role === "start") emitSelectRange("hours");
1482
+ });
1483
+ });
1484
+ const setRef = (scrollbar, type) => {
1485
+ listRefsMap[type].value = scrollbar;
1486
+ };
1487
+ emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
1488
+ emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
1489
+ watch(() => props.spinnerDate, () => {
1490
+ if (isScrolling) return;
1491
+ adjustSpinners();
1492
+ });
1493
+ return (_ctx, _cache) => {
1494
+ return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }]) }, [!_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(spinnerItems), (item) => {
1495
+ return openBlock(), createBlock(unref(ElScrollbar), {
1496
+ key: item,
1497
+ ref_for: true,
1498
+ ref: (scrollbar) => setRef(scrollbar, item),
1499
+ class: normalizeClass(unref(ns).be("spinner", "wrapper")),
1500
+ "wrap-style": "max-height: inherit;",
1501
+ "view-class": unref(ns).be("spinner", "list"),
1502
+ noresize: "",
1503
+ tag: "ul",
1504
+ onMouseenter: ($event) => emitSelectRange(item),
1505
+ onMousemove: ($event) => adjustCurrentSpinner(item)
1506
+ }, {
1507
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(timeList)[item], (disabled, key) => {
1508
+ return openBlock(), createElementBlock("li", {
1509
+ key,
1510
+ class: normalizeClass([
1511
+ unref(ns).be("spinner", "item"),
1512
+ unref(ns).is("active", key === unref(timePartials)[item]),
1513
+ unref(ns).is("disabled", disabled)
1514
+ ]),
1515
+ onClick: ($event) => handleClick(item, {
1516
+ value: key,
1517
+ disabled
1518
+ })
1519
+ }, [item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(getAmPmFlag(key)), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)], 64))], 10, _hoisted_1$6);
1520
+ }), 128))]),
1521
+ _: 2
1522
+ }, 1032, [
1523
+ "class",
1524
+ "view-class",
1525
+ "onMouseenter",
1526
+ "onMousemove"
1527
+ ]);
1528
+ }), 128)) : createCommentVNode("v-if", true), _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(spinnerItems), (item) => {
1529
+ return openBlock(), createElementBlock("div", {
1530
+ key: item,
1531
+ class: normalizeClass([unref(ns).be("spinner", "wrapper"), unref(ns).is("arrow")]),
1532
+ onMouseenter: ($event) => emitSelectRange(item)
1533
+ }, [
1534
+ withDirectives((openBlock(), createBlock(unref(ElIcon), { class: normalizeClass(["arrow-up", unref(ns).be("spinner", "arrow")]) }, {
1535
+ default: withCtx(() => [createVNode(unref(arrow_up_default))]),
1536
+ _: 1
1537
+ }, 8, ["class"])), [[unref(vRepeatClick), onDecrement]]),
1538
+ withDirectives((openBlock(), createBlock(unref(ElIcon), { class: normalizeClass(["arrow-down", unref(ns).be("spinner", "arrow")]) }, {
1539
+ default: withCtx(() => [createVNode(unref(arrow_down_default))]),
1540
+ _: 1
1541
+ }, 8, ["class"])), [[unref(vRepeatClick), onIncrement]]),
1542
+ createBaseVNode("ul", { class: normalizeClass(unref(ns).be("spinner", "list")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(arrowControlTimeList)[item], (time, key) => {
1543
+ return openBlock(), createElementBlock("li", {
1544
+ key,
1545
+ class: normalizeClass([
1546
+ unref(ns).be("spinner", "item"),
1547
+ unref(ns).is("active", time === unref(timePartials)[item]),
1548
+ unref(ns).is("disabled", unref(timeList)[item][time])
1549
+ ])
1550
+ }, [typeof time === "number" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(getAmPmFlag(time)), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)], 64))], 64)) : createCommentVNode("v-if", true)], 2);
1551
+ }), 128))], 2)
1552
+ ], 42, _hoisted_2$6);
1553
+ }), 128)) : createCommentVNode("v-if", true)], 2);
1554
+ };
1555
+ }
1556
+ }), [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue"]]);
1557
+ var import_dayjs_min$9 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
1558
+ var TimePickPanel = /* @__PURE__ */ _export_sfc(/* @__PURE__ */ defineComponent({
1559
+ __name: "panel-time-pick",
1560
+ props: panelTimePickerProps,
1561
+ emits: [
1562
+ "pick",
1563
+ "select-range",
1564
+ "set-picker-option"
1565
+ ],
1566
+ setup(__props, { emit }) {
1567
+ const props = __props;
1568
+ const { arrowControl, disabledHours, disabledMinutes, disabledSeconds, defaultValue } = inject("EP_PICKER_BASE").props;
1569
+ const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
1570
+ const ns = useNamespace("time");
1571
+ const { t, lang } = useLocale();
1572
+ const selectionRange = ref([0, 2]);
1573
+ const oldValue = useOldValue(props);
1574
+ const transitionName = computed(() => {
1575
+ return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
1576
+ });
1577
+ const showSeconds = computed(() => {
1578
+ return props.format.includes("ss");
1579
+ });
1580
+ const amPmMode = computed(() => {
1581
+ if (props.format.includes("A")) return "A";
1582
+ if (props.format.includes("a")) return "a";
1583
+ return "";
1584
+ });
1585
+ const isValidValue = (_date) => {
1586
+ const parsedDate = (0, import_dayjs_min$9.default)(_date).locale(lang.value);
1587
+ const result = getRangeAvailableTime(parsedDate);
1588
+ return parsedDate.isSame(result);
1589
+ };
1590
+ const handleCancel = () => {
1591
+ emit("pick", oldValue.value, false);
1592
+ };
1593
+ const handleConfirm = (visible = false, first = false) => {
1594
+ if (first) return;
1595
+ emit("pick", props.parsedValue, visible);
1596
+ };
1597
+ const handleChange = (_date) => {
1598
+ if (!props.visible) return;
1599
+ emit("pick", getRangeAvailableTime(_date).millisecond(0), true);
1600
+ };
1601
+ const setSelectionRange = (start, end) => {
1602
+ emit("select-range", start, end);
1603
+ selectionRange.value = [start, end];
1604
+ };
1605
+ const changeSelectionRange = (step) => {
1606
+ const list = [0, 3].concat(showSeconds.value ? [6] : []);
1607
+ const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
1608
+ const next = (list.indexOf(selectionRange.value[0]) + step + list.length) % list.length;
1609
+ timePickerOptions["start_emitSelectRange"](mapping[next]);
1610
+ };
1611
+ const handleKeydown = (event) => {
1612
+ const code = event.code;
1613
+ const { left, right, up, down } = EVENT_CODE;
1614
+ if ([left, right].includes(code)) {
1615
+ changeSelectionRange(code === left ? -1 : 1);
1616
+ event.preventDefault();
1617
+ return;
1618
+ }
1619
+ if ([up, down].includes(code)) {
1620
+ const step = code === up ? -1 : 1;
1621
+ timePickerOptions["start_scrollDown"](step);
1622
+ event.preventDefault();
1623
+ return;
1624
+ }
1625
+ };
1626
+ const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
1627
+ getAvailableHours,
1628
+ getAvailableMinutes,
1629
+ getAvailableSeconds
1630
+ });
1631
+ const getRangeAvailableTime = (date$1) => {
1632
+ return getAvailableTime(date$1, props.datetimeRole || "", true);
1633
+ };
1634
+ const parseUserInput = (value) => {
1635
+ if (!value) return null;
1636
+ return (0, import_dayjs_min$9.default)(value, props.format).locale(lang.value);
1637
+ };
1638
+ const formatToString = (value) => {
1639
+ if (!value) return null;
1640
+ return value.format(props.format);
1641
+ };
1642
+ const getDefaultValue$1 = () => {
1643
+ return (0, import_dayjs_min$9.default)(defaultValue).locale(lang.value);
1644
+ };
1645
+ emit("set-picker-option", ["isValidValue", isValidValue]);
1646
+ emit("set-picker-option", ["formatToString", formatToString]);
1647
+ emit("set-picker-option", ["parseUserInput", parseUserInput]);
1648
+ emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
1649
+ emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
1650
+ emit("set-picker-option", ["getDefaultValue", getDefaultValue$1]);
1651
+ return (_ctx, _cache) => {
1652
+ return openBlock(), createBlock(Transition, { name: unref(transitionName) }, {
1653
+ default: withCtx(() => [_ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
1654
+ key: 0,
1655
+ class: normalizeClass(unref(ns).b("panel"))
1656
+ }, [createBaseVNode("div", { class: normalizeClass([unref(ns).be("panel", "content"), { "has-seconds": unref(showSeconds) }]) }, [createVNode(TimeSpinner, {
1657
+ ref: "spinner",
1658
+ role: _ctx.datetimeRole || "start",
1659
+ "arrow-control": unref(arrowControl),
1660
+ "show-seconds": unref(showSeconds),
1661
+ "am-pm-mode": unref(amPmMode),
1662
+ "spinner-date": _ctx.parsedValue,
1663
+ "disabled-hours": unref(disabledHours),
1664
+ "disabled-minutes": unref(disabledMinutes),
1665
+ "disabled-seconds": unref(disabledSeconds),
1666
+ onChange: handleChange,
1667
+ onSetOption: unref(onSetOption),
1668
+ onSelectRange: setSelectionRange
1669
+ }, null, 8, [
1670
+ "role",
1671
+ "arrow-control",
1672
+ "show-seconds",
1673
+ "am-pm-mode",
1674
+ "spinner-date",
1675
+ "disabled-hours",
1676
+ "disabled-minutes",
1677
+ "disabled-seconds",
1678
+ "onSetOption"
1679
+ ])], 2), createBaseVNode("div", { class: normalizeClass(unref(ns).be("panel", "footer")) }, [createBaseVNode("button", {
1680
+ type: "button",
1681
+ class: normalizeClass([unref(ns).be("panel", "btn"), "cancel"]),
1682
+ onClick: handleCancel
1683
+ }, toDisplayString(unref(t)("el.datepicker.cancel")), 3), createBaseVNode("button", {
1684
+ type: "button",
1685
+ class: normalizeClass([unref(ns).be("panel", "btn"), "confirm"]),
1686
+ onClick: _cache[0] || (_cache[0] = ($event) => handleConfirm())
1687
+ }, toDisplayString(unref(t)("el.datepicker.confirm")), 3)], 2)], 2)) : createCommentVNode("v-if", true)]),
1688
+ _: 1
1689
+ }, 8, ["name"]);
1690
+ };
1691
+ }
1692
+ }), [["__file", "/home/runner/work/element-plus/element-plus/packages/components/time-picker/src/time-picker-com/panel-time-pick.vue"]]);
1693
+ var require_localeData = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1694
+ (function(n, e) {
1695
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (n = "undefined" != typeof globalThis ? globalThis : n || self).dayjs_plugin_localeData = e();
1696
+ })(exports, (function() {
1697
+ return function(n, e, t) {
1698
+ var r = e.prototype, o = function(n$1) {
1699
+ return n$1 && (n$1.indexOf ? n$1 : n$1.s);
1700
+ }, u = function(n$1, e$1, t$1, r$1, u$1) {
1701
+ var i$1 = n$1.name ? n$1 : n$1.$locale(), a$1 = o(i$1[e$1]), s$1 = o(i$1[t$1]), f = a$1 || s$1.map((function(n$2) {
1702
+ return n$2.slice(0, r$1);
1703
+ }));
1704
+ if (!u$1) return f;
1705
+ var d = i$1.weekStart;
1706
+ return f.map((function(n$2, e$2) {
1707
+ return f[(e$2 + (d || 0)) % 7];
1708
+ }));
1709
+ }, i = function() {
1710
+ return t.Ls[t.locale()];
1711
+ }, a = function(n$1, e$1) {
1712
+ return n$1.formats[e$1] || function(n$2) {
1713
+ return n$2.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(n$3, e$2, t$1) {
1714
+ return e$2 || t$1.slice(1);
1715
+ }));
1716
+ }(n$1.formats[e$1.toUpperCase()]);
1717
+ }, s = function() {
1718
+ var n$1 = this;
1719
+ return {
1720
+ months: function(e$1) {
1721
+ return e$1 ? e$1.format("MMMM") : u(n$1, "months");
1722
+ },
1723
+ monthsShort: function(e$1) {
1724
+ return e$1 ? e$1.format("MMM") : u(n$1, "monthsShort", "months", 3);
1725
+ },
1726
+ firstDayOfWeek: function() {
1727
+ return n$1.$locale().weekStart || 0;
1728
+ },
1729
+ weekdays: function(e$1) {
1730
+ return e$1 ? e$1.format("dddd") : u(n$1, "weekdays");
1731
+ },
1732
+ weekdaysMin: function(e$1) {
1733
+ return e$1 ? e$1.format("dd") : u(n$1, "weekdaysMin", "weekdays", 2);
1734
+ },
1735
+ weekdaysShort: function(e$1) {
1736
+ return e$1 ? e$1.format("ddd") : u(n$1, "weekdaysShort", "weekdays", 3);
1737
+ },
1738
+ longDateFormat: function(e$1) {
1739
+ return a(n$1.$locale(), e$1);
1740
+ },
1741
+ meridiem: this.$locale().meridiem,
1742
+ ordinal: this.$locale().ordinal
1743
+ };
1744
+ };
1745
+ r.localeData = function() {
1746
+ return s.bind(this)();
1747
+ }, t.localeData = function() {
1748
+ var n$1 = i();
1749
+ return {
1750
+ firstDayOfWeek: function() {
1751
+ return n$1.weekStart || 0;
1752
+ },
1753
+ weekdays: function() {
1754
+ return t.weekdays();
1755
+ },
1756
+ weekdaysShort: function() {
1757
+ return t.weekdaysShort();
1758
+ },
1759
+ weekdaysMin: function() {
1760
+ return t.weekdaysMin();
1761
+ },
1762
+ months: function() {
1763
+ return t.months();
1764
+ },
1765
+ monthsShort: function() {
1766
+ return t.monthsShort();
1767
+ },
1768
+ longDateFormat: function(e$1) {
1769
+ return a(n$1, e$1);
1770
+ },
1771
+ meridiem: n$1.meridiem,
1772
+ ordinal: n$1.ordinal
1773
+ };
1774
+ }, t.months = function() {
1775
+ return u(i(), "months");
1776
+ }, t.monthsShort = function() {
1777
+ return u(i(), "monthsShort", "months", 3);
1778
+ }, t.weekdays = function(n$1) {
1779
+ return u(i(), "weekdays", null, null, n$1);
1780
+ }, t.weekdaysShort = function(n$1) {
1781
+ return u(i(), "weekdaysShort", "weekdays", 3, n$1);
1782
+ }, t.weekdaysMin = function(n$1) {
1783
+ return u(i(), "weekdaysMin", "weekdays", 2, n$1);
1784
+ };
1785
+ };
1786
+ }));
1787
+ }));
1788
+ var require_advancedFormat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1789
+ (function(e, t) {
1790
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_advancedFormat = t();
1791
+ })(exports, (function() {
1792
+ return function(e, t) {
1793
+ var r = t.prototype, n = r.format;
1794
+ r.format = function(e$1) {
1795
+ var t$1 = this, r$1 = this.$locale();
1796
+ if (!this.isValid()) return n.bind(this)(e$1);
1797
+ var s = this.$utils(), a = (e$1 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, (function(e$2) {
1798
+ switch (e$2) {
1799
+ case "Q": return Math.ceil((t$1.$M + 1) / 3);
1800
+ case "Do": return r$1.ordinal(t$1.$D);
1801
+ case "gggg": return t$1.weekYear();
1802
+ case "GGGG": return t$1.isoWeekYear();
1803
+ case "wo": return r$1.ordinal(t$1.week(), "W");
1804
+ case "w":
1805
+ case "ww": return s.s(t$1.week(), "w" === e$2 ? 1 : 2, "0");
1806
+ case "W":
1807
+ case "WW": return s.s(t$1.isoWeek(), "W" === e$2 ? 1 : 2, "0");
1808
+ case "k":
1809
+ case "kk": return s.s(String(0 === t$1.$H ? 24 : t$1.$H), "k" === e$2 ? 1 : 2, "0");
1810
+ case "X": return Math.floor(t$1.$d.getTime() / 1e3);
1811
+ case "x": return t$1.$d.getTime();
1812
+ case "z": return "[" + t$1.offsetName() + "]";
1813
+ case "zzz": return "[" + t$1.offsetName("long") + "]";
1814
+ default: return e$2;
1815
+ }
1816
+ }));
1817
+ return n.bind(this)(a);
1818
+ };
1819
+ };
1820
+ }));
1821
+ }));
1822
+ var require_weekOfYear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1823
+ (function(e, t) {
1824
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_weekOfYear = t();
1825
+ })(exports, (function() {
1826
+ var e = "week", t = "year";
1827
+ return function(i, n, r) {
1828
+ var f = n.prototype;
1829
+ f.week = function(i$1) {
1830
+ if (void 0 === i$1 && (i$1 = null), null !== i$1) return this.add(7 * (i$1 - this.week()), "day");
1831
+ var n$1 = this.$locale().yearStart || 1;
1832
+ if (11 === this.month() && this.date() > 25) {
1833
+ var f$1 = r(this).startOf(t).add(1, t).date(n$1), s = r(this).endOf(e);
1834
+ if (f$1.isBefore(s)) return 1;
1835
+ }
1836
+ var a = r(this).startOf(t).date(n$1).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, !0);
1837
+ return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
1838
+ }, f.weeks = function(e$1) {
1839
+ return void 0 === e$1 && (e$1 = null), this.week(e$1);
1840
+ };
1841
+ };
1842
+ }));
1843
+ }));
1844
+ var require_weekYear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1845
+ (function(e, t) {
1846
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_weekYear = t();
1847
+ })(exports, (function() {
1848
+ return function(e, t) {
1849
+ t.prototype.weekYear = function() {
1850
+ var e$1 = this.month(), t$1 = this.week(), n = this.year();
1851
+ return 1 === t$1 && 11 === e$1 ? n + 1 : 0 === e$1 && t$1 >= 52 ? n - 1 : n;
1852
+ };
1853
+ };
1854
+ }));
1855
+ }));
1856
+ var require_dayOfYear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1857
+ (function(e, t) {
1858
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_dayOfYear = t();
1859
+ })(exports, (function() {
1860
+ return function(e, t, n) {
1861
+ t.prototype.dayOfYear = function(e$1) {
1862
+ var t$1 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
1863
+ return null == e$1 ? t$1 : this.add(e$1 - t$1, "day");
1864
+ };
1865
+ };
1866
+ }));
1867
+ }));
1868
+ var require_isSameOrAfter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1869
+ (function(e, t) {
1870
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isSameOrAfter = t();
1871
+ })(exports, (function() {
1872
+ return function(e, t) {
1873
+ t.prototype.isSameOrAfter = function(e$1, t$1) {
1874
+ return this.isSame(e$1, t$1) || this.isAfter(e$1, t$1);
1875
+ };
1876
+ };
1877
+ }));
1878
+ }));
1879
+ var require_isSameOrBefore = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1880
+ (function(e, i) {
1881
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = i() : "function" == typeof define && define.amd ? define(i) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isSameOrBefore = i();
1882
+ })(exports, (function() {
1883
+ return function(e, i) {
1884
+ i.prototype.isSameOrBefore = function(e$1, i$1) {
1885
+ return this.isSame(e$1, i$1) || this.isBefore(e$1, i$1);
1886
+ };
1887
+ };
1888
+ }));
1889
+ }));
1890
+ var ROOT_PICKER_INJECTION_KEY = Symbol();
1891
+ var datePickerProps = buildProps({
1892
+ ...timePickerDefaultProps,
1893
+ type: {
1894
+ type: definePropType(String),
1895
+ default: "date"
1896
+ }
1897
+ });
1898
+ var selectionModes = [
1899
+ "date",
1900
+ "dates",
1901
+ "year",
1902
+ "month",
1903
+ "week",
1904
+ "range"
1905
+ ];
1906
+ var datePickerSharedProps = buildProps({
1907
+ disabledDate: { type: definePropType(Function) },
1908
+ date: {
1909
+ type: definePropType(Object),
1910
+ required: true
1911
+ },
1912
+ minDate: { type: definePropType(Object) },
1913
+ maxDate: { type: definePropType(Object) },
1914
+ parsedValue: { type: definePropType([Object, Array]) },
1915
+ rangeState: {
1916
+ type: definePropType(Object),
1917
+ default: () => ({
1918
+ endDate: null,
1919
+ selecting: false
1920
+ })
1921
+ }
1922
+ });
1923
+ var panelSharedProps = buildProps({
1924
+ type: {
1925
+ type: definePropType(String),
1926
+ required: true,
1927
+ values: datePickTypes
1928
+ },
1929
+ dateFormat: String,
1930
+ timeFormat: String
1931
+ });
1932
+ var panelRangeSharedProps = buildProps({
1933
+ unlinkPanels: Boolean,
1934
+ parsedValue: { type: definePropType(Array) }
1935
+ });
1936
+ var selectionModeWithDefault = (mode) => {
1937
+ return {
1938
+ type: String,
1939
+ values: selectionModes,
1940
+ default: mode
1941
+ };
1942
+ };
1943
+ var panelDatePickProps = buildProps({
1944
+ ...panelSharedProps,
1945
+ parsedValue: { type: definePropType([Object, Array]) },
1946
+ visible: { type: Boolean },
1947
+ format: {
1948
+ type: String,
1949
+ default: ""
1950
+ }
1951
+ });
1952
+ var basicDateTableProps = buildProps({
1953
+ ...datePickerSharedProps,
1954
+ cellClassName: { type: definePropType(Function) },
1955
+ showWeekNumber: Boolean,
1956
+ selectionMode: selectionModeWithDefault("date")
1957
+ });
1958
+ var basicDateTableEmits = [
1959
+ "changerange",
1960
+ "pick",
1961
+ "select"
1962
+ ];
1963
+ var import_dayjs_min$8 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
1964
+ init_shared_esm_bundler();
1965
+ var isValidRange = (range) => {
1966
+ if (!isArray(range)) return false;
1967
+ const [left, right] = range;
1968
+ return import_dayjs_min$8.default.isDayjs(left) && import_dayjs_min$8.default.isDayjs(right) && left.isSameOrBefore(right);
1969
+ };
1970
+ var getDefaultValue = (defaultValue, { lang, unit: unit$2, unlinkPanels }) => {
1971
+ let start;
1972
+ if (isArray(defaultValue)) {
1973
+ let [left, right] = defaultValue.map((d) => (0, import_dayjs_min$8.default)(d).locale(lang));
1974
+ if (!unlinkPanels) right = left.add(1, unit$2);
1975
+ return [left, right];
1976
+ } else if (defaultValue) start = (0, import_dayjs_min$8.default)(defaultValue);
1977
+ else start = (0, import_dayjs_min$8.default)();
1978
+ start = start.locale(lang);
1979
+ return [start, start.add(1, unit$2)];
1980
+ };
1981
+ var buildPickerTable = (dimension, rows, { columnIndexOffset, startDate, nextEndDate, now, unit: unit$2, relativeDateGetter, setCellMetadata, setRowMetadata }) => {
1982
+ for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
1983
+ const row = rows[rowIndex];
1984
+ for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
1985
+ let cell = row[columnIndex + columnIndexOffset];
1986
+ if (!cell) cell = {
1987
+ row: rowIndex,
1988
+ column: columnIndex,
1989
+ type: "normal",
1990
+ inRange: false,
1991
+ start: false,
1992
+ end: false
1993
+ };
1994
+ const nextStartDate = relativeDateGetter(rowIndex * dimension.column + columnIndex);
1995
+ cell.dayjs = nextStartDate;
1996
+ cell.date = nextStartDate.toDate();
1997
+ cell.timestamp = nextStartDate.valueOf();
1998
+ cell.type = "normal";
1999
+ cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit$2) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit$2)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit$2) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit$2));
2000
+ if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
2001
+ cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit$2);
2002
+ cell.end = startDate && nextStartDate.isSame(startDate, unit$2);
2003
+ } else {
2004
+ cell.start = !!startDate && nextStartDate.isSame(startDate, unit$2);
2005
+ cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit$2);
2006
+ }
2007
+ if (nextStartDate.isSame(now, unit$2)) cell.type = "today";
2008
+ setCellMetadata?.(cell, {
2009
+ rowIndex,
2010
+ columnIndex
2011
+ });
2012
+ row[columnIndex + columnIndexOffset] = cell;
2013
+ }
2014
+ setRowMetadata?.(row);
2015
+ }
2016
+ };
2017
+ var import_dayjs_min$7 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
2018
+ var isNormalDay = (type = "") => {
2019
+ return ["normal", "today"].includes(type);
2020
+ };
2021
+ var useBasicDateTable = (props, emit) => {
2022
+ const { lang } = useLocale();
2023
+ const tbodyRef = ref();
2024
+ const currentCellRef = ref();
2025
+ const lastRow = ref();
2026
+ const lastColumn = ref();
2027
+ const tableRows = ref([
2028
+ [],
2029
+ [],
2030
+ [],
2031
+ [],
2032
+ [],
2033
+ []
2034
+ ]);
2035
+ let focusWithClick = false;
2036
+ const firstDayOfWeek = props.date.$locale().weekStart || 7;
2037
+ const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
2038
+ const offsetDay = computed(() => {
2039
+ return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
2040
+ });
2041
+ const startDate = computed(() => {
2042
+ const startDayOfMonth = props.date.startOf("month");
2043
+ return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
2044
+ });
2045
+ const WEEKS = computed(() => {
2046
+ return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
2047
+ });
2048
+ const hasCurrent = computed(() => {
2049
+ return flatten_default(unref(rows)).some((row) => {
2050
+ return row.isCurrent;
2051
+ });
2052
+ });
2053
+ const days = computed(() => {
2054
+ const startOfMonth = props.date.startOf("month");
2055
+ return {
2056
+ startOfMonthDay: startOfMonth.day() || 7,
2057
+ dateCountOfMonth: startOfMonth.daysInMonth(),
2058
+ dateCountOfLastMonth: startOfMonth.subtract(1, "month").daysInMonth()
2059
+ };
2060
+ });
2061
+ const selectedDate = computed(() => {
2062
+ return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
2063
+ });
2064
+ const setDateText = (cell, { count, rowIndex, columnIndex }) => {
2065
+ const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = unref(days);
2066
+ const offset = unref(offsetDay);
2067
+ if (rowIndex >= 0 && rowIndex <= 1) {
2068
+ const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
2069
+ if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
2070
+ cell.text = count;
2071
+ return true;
2072
+ } else {
2073
+ cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
2074
+ cell.type = "prev-month";
2075
+ }
2076
+ } else {
2077
+ if (count <= dateCountOfMonth) cell.text = count;
2078
+ else {
2079
+ cell.text = count - dateCountOfMonth;
2080
+ cell.type = "next-month";
2081
+ }
2082
+ return true;
2083
+ }
2084
+ return false;
2085
+ };
2086
+ const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
2087
+ const { disabledDate: disabledDate$1, cellClassName } = props;
2088
+ const _selectedDate = unref(selectedDate);
2089
+ const shouldIncrement = setDateText(cell, {
2090
+ count,
2091
+ rowIndex,
2092
+ columnIndex
2093
+ });
2094
+ const cellDate = cell.dayjs.toDate();
2095
+ cell.selected = _selectedDate.find((d) => d.valueOf() === cell.dayjs.valueOf());
2096
+ cell.isSelected = !!cell.selected;
2097
+ cell.isCurrent = isCurrent(cell);
2098
+ cell.disabled = disabledDate$1 == null ? void 0 : disabledDate$1(cellDate);
2099
+ cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
2100
+ return shouldIncrement;
2101
+ };
2102
+ const setRowMetadata = (row) => {
2103
+ if (props.selectionMode === "week") {
2104
+ const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
2105
+ const isActive = isWeekActive(row[start + 1]);
2106
+ row[start].inRange = isActive;
2107
+ row[start].start = isActive;
2108
+ row[end].inRange = isActive;
2109
+ row[end].end = isActive;
2110
+ }
2111
+ };
2112
+ const rows = computed(() => {
2113
+ const { minDate, maxDate, rangeState, showWeekNumber } = props;
2114
+ const offset = unref(offsetDay);
2115
+ const rows_ = unref(tableRows);
2116
+ const dateUnit = "day";
2117
+ let count = 1;
2118
+ if (showWeekNumber) {
2119
+ for (let rowIndex = 0; rowIndex < 6; rowIndex++) if (!rows_[rowIndex][0]) rows_[rowIndex][0] = {
2120
+ type: "week",
2121
+ text: unref(startDate).add(rowIndex * 7 + 1, dateUnit).week()
2122
+ };
2123
+ }
2124
+ buildPickerTable({
2125
+ row: 6,
2126
+ column: 7
2127
+ }, rows_, {
2128
+ startDate: minDate,
2129
+ columnIndexOffset: showWeekNumber ? 1 : 0,
2130
+ nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
2131
+ now: (0, import_dayjs_min$7.default)().locale(unref(lang)).startOf(dateUnit),
2132
+ unit: dateUnit,
2133
+ relativeDateGetter: (idx) => unref(startDate).add(idx - offset, dateUnit),
2134
+ setCellMetadata: (...args) => {
2135
+ if (setCellMetadata(...args, count)) count += 1;
2136
+ },
2137
+ setRowMetadata
2138
+ });
2139
+ return rows_;
2140
+ });
2141
+ watch(() => props.date, async () => {
2142
+ var _a;
2143
+ if ((_a = unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
2144
+ await nextTick();
2145
+ await focus();
2146
+ }
2147
+ });
2148
+ const focus = async () => {
2149
+ var _a;
2150
+ return (_a = unref(currentCellRef)) == null ? void 0 : _a.focus();
2151
+ };
2152
+ const isCurrent = (cell) => {
2153
+ return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
2154
+ };
2155
+ const cellMatchesDate = (cell, date$1) => {
2156
+ if (!date$1) return false;
2157
+ return (0, import_dayjs_min$7.default)(date$1).locale(unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
2158
+ };
2159
+ const getDateOfCell = (row, column) => {
2160
+ const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - unref(offsetDay);
2161
+ return unref(startDate).add(offsetFromStart, "day");
2162
+ };
2163
+ const handleMouseMove = (event) => {
2164
+ var _a;
2165
+ if (!props.rangeState.selecting) return;
2166
+ let target = event.target;
2167
+ if (target.tagName === "SPAN") target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
2168
+ if (target.tagName === "DIV") target = target.parentNode;
2169
+ if (target.tagName !== "TD") return;
2170
+ const row = target.parentNode.rowIndex - 1;
2171
+ const column = target.cellIndex;
2172
+ if (unref(rows)[row][column].disabled) return;
2173
+ if (row !== unref(lastRow) || column !== unref(lastColumn)) {
2174
+ lastRow.value = row;
2175
+ lastColumn.value = column;
2176
+ emit("changerange", {
2177
+ selecting: true,
2178
+ endDate: getDateOfCell(row, column)
2179
+ });
2180
+ }
2181
+ };
2182
+ const isSelectedCell = (cell) => {
2183
+ return !unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
2184
+ };
2185
+ const handleFocus = (event) => {
2186
+ if (focusWithClick || unref(hasCurrent) || props.selectionMode !== "date") return;
2187
+ handlePickDate(event, true);
2188
+ };
2189
+ const handleMouseDown = (event) => {
2190
+ if (!event.target.closest("td")) return;
2191
+ focusWithClick = true;
2192
+ };
2193
+ const handleMouseUp = (event) => {
2194
+ if (!event.target.closest("td")) return;
2195
+ focusWithClick = false;
2196
+ };
2197
+ const handleRangePick = (newDate) => {
2198
+ if (!props.rangeState.selecting || !props.minDate) {
2199
+ emit("pick", {
2200
+ minDate: newDate,
2201
+ maxDate: null
2202
+ });
2203
+ emit("select", true);
2204
+ } else {
2205
+ if (newDate >= props.minDate) emit("pick", {
2206
+ minDate: props.minDate,
2207
+ maxDate: newDate
2208
+ });
2209
+ else emit("pick", {
2210
+ minDate: newDate,
2211
+ maxDate: props.minDate
2212
+ });
2213
+ emit("select", false);
2214
+ }
2215
+ };
2216
+ const handleWeekPick = (newDate) => {
2217
+ const weekNumber = newDate.week();
2218
+ const value = `${newDate.year()}w${weekNumber}`;
2219
+ emit("pick", {
2220
+ year: newDate.year(),
2221
+ week: weekNumber,
2222
+ value,
2223
+ date: newDate.startOf("week")
2224
+ });
2225
+ };
2226
+ const handleDatesPick = (newDate, selected) => {
2227
+ emit("pick", selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]));
2228
+ };
2229
+ const handlePickDate = (event, isKeyboardMovement = false) => {
2230
+ const target = event.target.closest("td");
2231
+ if (!target) return;
2232
+ const row = target.parentNode.rowIndex - 1;
2233
+ const column = target.cellIndex;
2234
+ const cell = unref(rows)[row][column];
2235
+ if (cell.disabled || cell.type === "week") return;
2236
+ const newDate = getDateOfCell(row, column);
2237
+ switch (props.selectionMode) {
2238
+ case "range":
2239
+ handleRangePick(newDate);
2240
+ break;
2241
+ case "date":
2242
+ emit("pick", newDate, isKeyboardMovement);
2243
+ break;
2244
+ case "week":
2245
+ handleWeekPick(newDate);
2246
+ break;
2247
+ case "dates":
2248
+ handleDatesPick(newDate, !!cell.selected);
2249
+ break;
2250
+ default: break;
2251
+ }
2252
+ };
2253
+ const isWeekActive = (cell) => {
2254
+ if (props.selectionMode !== "week") return false;
2255
+ let newDate = props.date.startOf("day");
2256
+ if (cell.type === "prev-month") newDate = newDate.subtract(1, "month");
2257
+ if (cell.type === "next-month") newDate = newDate.add(1, "month");
2258
+ newDate = newDate.date(Number.parseInt(cell.text, 10));
2259
+ if (props.parsedValue && !Array.isArray(props.parsedValue)) {
2260
+ const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
2261
+ return props.parsedValue.subtract(dayOffset, "day").isSame(newDate, "day");
2262
+ }
2263
+ return false;
2264
+ };
2265
+ return {
2266
+ WEEKS,
2267
+ rows,
2268
+ tbodyRef,
2269
+ currentCellRef,
2270
+ focus,
2271
+ isCurrent,
2272
+ isWeekActive,
2273
+ isSelectedCell,
2274
+ handlePickDate,
2275
+ handleMouseUp,
2276
+ handleMouseDown,
2277
+ handleMouseMove,
2278
+ handleFocus
2279
+ };
2280
+ };
2281
+ var useBasicDateTableDOM = (props, { isCurrent, isWeekActive }) => {
2282
+ const ns = useNamespace("date-table");
2283
+ const { t } = useLocale();
2284
+ const tableKls = computed(() => [ns.b(), { "is-week-mode": props.selectionMode === "week" }]);
2285
+ const tableLabel = computed(() => t("el.datepicker.dateTablePrompt"));
2286
+ const weekLabel = computed(() => t("el.datepicker.week"));
2287
+ const getCellClasses = (cell) => {
2288
+ const classes = [];
2289
+ if (isNormalDay(cell.type) && !cell.disabled) {
2290
+ classes.push("available");
2291
+ if (cell.type === "today") classes.push("today");
2292
+ } else classes.push(cell.type);
2293
+ if (isCurrent(cell)) classes.push("current");
2294
+ if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
2295
+ classes.push("in-range");
2296
+ if (cell.start) classes.push("start-date");
2297
+ if (cell.end) classes.push("end-date");
2298
+ }
2299
+ if (cell.disabled) classes.push("disabled");
2300
+ if (cell.selected) classes.push("selected");
2301
+ if (cell.customClass) classes.push(cell.customClass);
2302
+ return classes.join(" ");
2303
+ };
2304
+ const getRowKls = (cell) => [ns.e("row"), { current: isWeekActive(cell) }];
2305
+ return {
2306
+ tableKls,
2307
+ tableLabel,
2308
+ weekLabel,
2309
+ getCellClasses,
2310
+ getRowKls,
2311
+ t
2312
+ };
2313
+ };
2314
+ var ElDatePickerCell = defineComponent({
2315
+ name: "ElDatePickerCell",
2316
+ props: buildProps({ cell: { type: definePropType(Object) } }),
2317
+ setup(props) {
2318
+ const ns = useNamespace("date-table-cell");
2319
+ const { slots } = inject(ROOT_PICKER_INJECTION_KEY);
2320
+ return () => {
2321
+ const { cell } = props;
2322
+ if (slots.default) {
2323
+ const list = slots.default(cell).filter((item) => {
2324
+ return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)" && item.type.toString() !== "Symbol(v-cmt)";
2325
+ });
2326
+ if (list.length) return list;
2327
+ }
2328
+ return createVNode("div", { "class": ns.b() }, [createVNode("span", { "class": ns.e("text") }, [cell == null ? void 0 : cell.text])]);
2329
+ };
2330
+ }
2331
+ });
2332
+ var _hoisted_1$5 = ["aria-label"];
2333
+ var _hoisted_2$5 = {
2334
+ key: 0,
2335
+ scope: "col"
2336
+ };
2337
+ var _hoisted_3$5 = ["aria-label"];
2338
+ var _hoisted_4$3 = [
2339
+ "aria-current",
2340
+ "aria-selected",
2341
+ "tabindex"
2342
+ ];
2343
+ var DateTable = /* @__PURE__ */ _export_sfc(/* @__PURE__ */ defineComponent({
2344
+ __name: "basic-date-table",
2345
+ props: basicDateTableProps,
2346
+ emits: basicDateTableEmits,
2347
+ setup(__props, { expose, emit }) {
2348
+ const props = __props;
2349
+ const { WEEKS, rows, tbodyRef, currentCellRef, focus, isCurrent, isWeekActive, isSelectedCell, handlePickDate, handleMouseUp, handleMouseDown, handleMouseMove, handleFocus } = useBasicDateTable(props, emit);
2350
+ const { tableLabel, tableKls, weekLabel, getCellClasses, getRowKls, t } = useBasicDateTableDOM(props, {
2351
+ isCurrent,
2352
+ isWeekActive
2353
+ });
2354
+ expose({ focus });
2355
+ return (_ctx, _cache) => {
2356
+ return openBlock(), createElementBlock("table", {
2357
+ "aria-label": unref(tableLabel),
2358
+ class: normalizeClass(unref(tableKls)),
2359
+ cellspacing: "0",
2360
+ cellpadding: "0",
2361
+ role: "grid",
2362
+ onClick: _cache[1] || (_cache[1] = (...args) => unref(handlePickDate) && unref(handlePickDate)(...args)),
2363
+ onMousemove: _cache[2] || (_cache[2] = (...args) => unref(handleMouseMove) && unref(handleMouseMove)(...args)),
2364
+ onMousedown: _cache[3] || (_cache[3] = withModifiers((...args) => unref(handleMouseDown) && unref(handleMouseDown)(...args), ["prevent"])),
2365
+ onMouseup: _cache[4] || (_cache[4] = (...args) => unref(handleMouseUp) && unref(handleMouseUp)(...args))
2366
+ }, [createBaseVNode("tbody", {
2367
+ ref_key: "tbodyRef",
2368
+ ref: tbodyRef
2369
+ }, [createBaseVNode("tr", null, [_ctx.showWeekNumber ? (openBlock(), createElementBlock("th", _hoisted_2$5, toDisplayString(unref(weekLabel)), 1)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(WEEKS), (week, key) => {
2370
+ return openBlock(), createElementBlock("th", {
2371
+ key,
2372
+ "aria-label": unref(t)("el.datepicker.weeksFull." + week),
2373
+ scope: "col"
2374
+ }, toDisplayString(unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_3$5);
2375
+ }), 128))]), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
2376
+ return openBlock(), createElementBlock("tr", {
2377
+ key: rowKey,
2378
+ class: normalizeClass(unref(getRowKls)(row[1]))
2379
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, columnKey) => {
2380
+ return openBlock(), createElementBlock("td", {
2381
+ key: `${rowKey}.${columnKey}`,
2382
+ ref_for: true,
2383
+ ref: (el) => unref(isSelectedCell)(cell) && (currentCellRef.value = el),
2384
+ class: normalizeClass(unref(getCellClasses)(cell)),
2385
+ "aria-current": cell.isCurrent ? "date" : void 0,
2386
+ "aria-selected": cell.isCurrent,
2387
+ tabindex: unref(isSelectedCell)(cell) ? 0 : -1,
2388
+ onFocus: _cache[0] || (_cache[0] = (...args) => unref(handleFocus) && unref(handleFocus)(...args))
2389
+ }, [createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])], 42, _hoisted_4$3);
2390
+ }), 128))], 2);
2391
+ }), 128))], 512)], 42, _hoisted_1$5);
2392
+ };
2393
+ }
2394
+ }), [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-date-table.vue"]]);
2395
+ var basicMonthTableProps = buildProps({
2396
+ ...datePickerSharedProps,
2397
+ selectionMode: selectionModeWithDefault("month")
2398
+ });
2399
+ var import_dayjs_min$6 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
2400
+ var _hoisted_1$4 = ["aria-label"];
2401
+ var _hoisted_2$4 = [
2402
+ "aria-selected",
2403
+ "aria-label",
2404
+ "tabindex",
2405
+ "onKeydown"
2406
+ ];
2407
+ var _hoisted_3$4 = { class: "cell" };
2408
+ var MonthTable = /* @__PURE__ */ _export_sfc(/* @__PURE__ */ defineComponent({
2409
+ __name: "basic-month-table",
2410
+ props: basicMonthTableProps,
2411
+ emits: [
2412
+ "changerange",
2413
+ "pick",
2414
+ "select"
2415
+ ],
2416
+ setup(__props, { expose, emit }) {
2417
+ const props = __props;
2418
+ const datesInMonth = (year, month, lang2) => {
2419
+ const firstDay = (0, import_dayjs_min$6.default)().locale(lang2).startOf("month").month(month).year(year);
2420
+ return rangeArr(firstDay.daysInMonth()).map((n) => firstDay.add(n, "day").toDate());
2421
+ };
2422
+ const ns = useNamespace("month-table");
2423
+ const { t, lang } = useLocale();
2424
+ const tbodyRef = ref();
2425
+ const currentCellRef = ref();
2426
+ const months = ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
2427
+ const tableRows = ref([
2428
+ [],
2429
+ [],
2430
+ []
2431
+ ]);
2432
+ const lastRow = ref();
2433
+ const lastColumn = ref();
2434
+ const rows = computed(() => {
2435
+ var _a, _b;
2436
+ const rows2 = tableRows.value;
2437
+ const now = (0, import_dayjs_min$6.default)().locale(lang.value).startOf("month");
2438
+ for (let i = 0; i < 3; i++) {
2439
+ const row = rows2[i];
2440
+ for (let j = 0; j < 4; j++) {
2441
+ const cell = row[j] || (row[j] = {
2442
+ row: i,
2443
+ column: j,
2444
+ type: "normal",
2445
+ inRange: false,
2446
+ start: false,
2447
+ end: false,
2448
+ text: -1,
2449
+ disabled: false
2450
+ });
2451
+ cell.type = "normal";
2452
+ const index = i * 4 + j;
2453
+ const calTime = props.date.startOf("year").month(index);
2454
+ const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
2455
+ cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "month") && calEndDate && calTime.isSameOrBefore(calEndDate, "month")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "month") && calEndDate && calTime.isSameOrAfter(calEndDate, "month"));
2456
+ if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
2457
+ cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
2458
+ cell.end = props.minDate && calTime.isSame(props.minDate, "month");
2459
+ } else {
2460
+ cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
2461
+ cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
2462
+ }
2463
+ if (now.isSame(calTime)) cell.type = "today";
2464
+ cell.text = index;
2465
+ cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
2466
+ }
2467
+ }
2468
+ return rows2;
2469
+ });
2470
+ const focus = () => {
2471
+ var _a;
2472
+ (_a = currentCellRef.value) == null || _a.focus();
2473
+ };
2474
+ const getCellStyle = (cell) => {
2475
+ const style = {};
2476
+ const year = props.date.year();
2477
+ const today = /* @__PURE__ */ new Date();
2478
+ const month = cell.text;
2479
+ style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
2480
+ style.current = castArray(props.parsedValue).findIndex((date$1) => import_dayjs_min$6.default.isDayjs(date$1) && date$1.year() === year && date$1.month() === month) >= 0;
2481
+ style.today = today.getFullYear() === year && today.getMonth() === month;
2482
+ if (cell.inRange) {
2483
+ style["in-range"] = true;
2484
+ if (cell.start) style["start-date"] = true;
2485
+ if (cell.end) style["end-date"] = true;
2486
+ }
2487
+ return style;
2488
+ };
2489
+ const isSelectedCell = (cell) => {
2490
+ const year = props.date.year();
2491
+ const month = cell.text;
2492
+ return castArray(props.date).findIndex((date$1) => date$1.year() === year && date$1.month() === month) >= 0;
2493
+ };
2494
+ const handleMouseMove = (event) => {
2495
+ var _a;
2496
+ if (!props.rangeState.selecting) return;
2497
+ let target = event.target;
2498
+ if (target.tagName === "A") target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
2499
+ if (target.tagName === "DIV") target = target.parentNode;
2500
+ if (target.tagName !== "TD") return;
2501
+ const row = target.parentNode.rowIndex;
2502
+ const column = target.cellIndex;
2503
+ if (rows.value[row][column].disabled) return;
2504
+ if (row !== lastRow.value || column !== lastColumn.value) {
2505
+ lastRow.value = row;
2506
+ lastColumn.value = column;
2507
+ emit("changerange", {
2508
+ selecting: true,
2509
+ endDate: props.date.startOf("year").month(row * 4 + column)
2510
+ });
2511
+ }
2512
+ };
2513
+ const handleMonthTableClick = (event) => {
2514
+ var _a;
2515
+ const target = (_a = event.target) == null ? void 0 : _a.closest("td");
2516
+ if ((target == null ? void 0 : target.tagName) !== "TD") return;
2517
+ if (hasClass(target, "disabled")) return;
2518
+ const column = target.cellIndex;
2519
+ const month = target.parentNode.rowIndex * 4 + column;
2520
+ const newDate = props.date.startOf("year").month(month);
2521
+ if (props.selectionMode === "range") if (!props.rangeState.selecting) {
2522
+ emit("pick", {
2523
+ minDate: newDate,
2524
+ maxDate: null
2525
+ });
2526
+ emit("select", true);
2527
+ } else {
2528
+ if (props.minDate && newDate >= props.minDate) emit("pick", {
2529
+ minDate: props.minDate,
2530
+ maxDate: newDate
2531
+ });
2532
+ else emit("pick", {
2533
+ minDate: newDate,
2534
+ maxDate: props.minDate
2535
+ });
2536
+ emit("select", false);
2537
+ }
2538
+ else emit("pick", month);
2539
+ };
2540
+ watch(() => props.date, async () => {
2541
+ var _a, _b;
2542
+ if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
2543
+ await nextTick();
2544
+ (_b = currentCellRef.value) == null || _b.focus();
2545
+ }
2546
+ });
2547
+ expose({ focus });
2548
+ return (_ctx, _cache) => {
2549
+ return openBlock(), createElementBlock("table", {
2550
+ role: "grid",
2551
+ "aria-label": unref(t)("el.datepicker.monthTablePrompt"),
2552
+ class: normalizeClass(unref(ns).b()),
2553
+ onClick: handleMonthTableClick,
2554
+ onMousemove: handleMouseMove
2555
+ }, [createBaseVNode("tbody", {
2556
+ ref_key: "tbodyRef",
2557
+ ref: tbodyRef
2558
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, key) => {
2559
+ return openBlock(), createElementBlock("tr", { key }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
2560
+ return openBlock(), createElementBlock("td", {
2561
+ key: key_,
2562
+ ref_for: true,
2563
+ ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
2564
+ class: normalizeClass(getCellStyle(cell)),
2565
+ "aria-selected": `${isSelectedCell(cell)}`,
2566
+ "aria-label": unref(t)(`el.datepicker.month${+cell.text + 1}`),
2567
+ tabindex: isSelectedCell(cell) ? 0 : -1,
2568
+ onKeydown: [withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]), withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])]
2569
+ }, [createBaseVNode("div", null, [createBaseVNode("span", _hoisted_3$4, toDisplayString(unref(t)("el.datepicker.months." + months.value[cell.text])), 1)])], 42, _hoisted_2$4);
2570
+ }), 128))]);
2571
+ }), 128))], 512)], 42, _hoisted_1$4);
2572
+ };
2573
+ }
2574
+ }), [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-month-table.vue"]]);
2575
+ var { date, disabledDate, parsedValue } = datePickerSharedProps;
2576
+ var basicYearTableProps = buildProps({
2577
+ date,
2578
+ disabledDate,
2579
+ parsedValue
2580
+ });
2581
+ var import_dayjs_min$5 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
2582
+ var _hoisted_1$3 = ["aria-label"];
2583
+ var _hoisted_2$3 = [
2584
+ "aria-selected",
2585
+ "tabindex",
2586
+ "onKeydown"
2587
+ ];
2588
+ var _hoisted_3$3 = { class: "cell" };
2589
+ var _hoisted_4$2 = { key: 1 };
2590
+ var YearTable = /* @__PURE__ */ _export_sfc(/* @__PURE__ */ defineComponent({
2591
+ __name: "basic-year-table",
2592
+ props: basicYearTableProps,
2593
+ emits: ["pick"],
2594
+ setup(__props, { expose, emit }) {
2595
+ const props = __props;
2596
+ const datesInYear = (year, lang2) => {
2597
+ const firstDay = (0, import_dayjs_min$5.default)(String(year)).locale(lang2).startOf("year");
2598
+ return rangeArr(firstDay.endOf("year").dayOfYear()).map((n) => firstDay.add(n, "day").toDate());
2599
+ };
2600
+ const ns = useNamespace("year-table");
2601
+ const { t, lang } = useLocale();
2602
+ const tbodyRef = ref();
2603
+ const currentCellRef = ref();
2604
+ const startYear = computed(() => {
2605
+ return Math.floor(props.date.year() / 10) * 10;
2606
+ });
2607
+ const focus = () => {
2608
+ var _a;
2609
+ (_a = currentCellRef.value) == null || _a.focus();
2610
+ };
2611
+ const getCellKls = (year) => {
2612
+ const kls = {};
2613
+ const today = (0, import_dayjs_min$5.default)().locale(lang.value);
2614
+ kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
2615
+ kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
2616
+ kls.today = today.year() === year;
2617
+ return kls;
2618
+ };
2619
+ const isSelectedCell = (year) => {
2620
+ return year === startYear.value && props.date.year() < startYear.value && props.date.year() > startYear.value + 9 || castArray(props.date).findIndex((date$1) => date$1.year() === year) >= 0;
2621
+ };
2622
+ const handleYearTableClick = (event) => {
2623
+ const target = event.target.closest("td");
2624
+ if (target && target.textContent) {
2625
+ if (hasClass(target, "disabled")) return;
2626
+ const year = target.textContent || target.innerText;
2627
+ emit("pick", Number(year));
2628
+ }
2629
+ };
2630
+ watch(() => props.date, async () => {
2631
+ var _a, _b;
2632
+ if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
2633
+ await nextTick();
2634
+ (_b = currentCellRef.value) == null || _b.focus();
2635
+ }
2636
+ });
2637
+ expose({ focus });
2638
+ return (_ctx, _cache) => {
2639
+ return openBlock(), createElementBlock("table", {
2640
+ role: "grid",
2641
+ "aria-label": unref(t)("el.datepicker.yearTablePrompt"),
2642
+ class: normalizeClass(unref(ns).b()),
2643
+ onClick: handleYearTableClick
2644
+ }, [createBaseVNode("tbody", {
2645
+ ref_key: "tbodyRef",
2646
+ ref: tbodyRef
2647
+ }, [(openBlock(), createElementBlock(Fragment, null, renderList(3, (_, i) => {
2648
+ return createBaseVNode("tr", { key: i }, [(openBlock(), createElementBlock(Fragment, null, renderList(4, (__, j) => {
2649
+ return openBlock(), createElementBlock(Fragment, { key: i + "_" + j }, [i * 4 + j < 10 ? (openBlock(), createElementBlock("td", {
2650
+ key: 0,
2651
+ ref_for: true,
2652
+ ref: (el) => isSelectedCell(unref(startYear) + i * 4 + j) && (currentCellRef.value = el),
2653
+ class: normalizeClass(["available", getCellKls(unref(startYear) + i * 4 + j)]),
2654
+ "aria-selected": `${isSelectedCell(unref(startYear) + i * 4 + j)}`,
2655
+ tabindex: isSelectedCell(unref(startYear) + i * 4 + j) ? 0 : -1,
2656
+ onKeydown: [withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]), withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])]
2657
+ }, [createBaseVNode("span", _hoisted_3$3, toDisplayString(unref(startYear) + i * 4 + j), 1)], 42, _hoisted_2$3)) : (openBlock(), createElementBlock("td", _hoisted_4$2))], 64);
2658
+ }), 64))]);
2659
+ }), 64))], 512)], 10, _hoisted_1$3);
2660
+ };
2661
+ }
2662
+ }), [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
2663
+ var import_dayjs_min$4 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
2664
+ init_shared_esm_bundler();
2665
+ var _hoisted_1$2 = ["onClick"];
2666
+ var _hoisted_2$2 = ["aria-label"];
2667
+ var _hoisted_3$2 = ["aria-label"];
2668
+ var _hoisted_4$1 = ["aria-label"];
2669
+ var _hoisted_5$1 = ["aria-label"];
2670
+ var DatePickPanel = /* @__PURE__ */ _export_sfc(/* @__PURE__ */ defineComponent({
2671
+ __name: "panel-date-pick",
2672
+ props: panelDatePickProps,
2673
+ emits: [
2674
+ "pick",
2675
+ "set-picker-option",
2676
+ "panel-change"
2677
+ ],
2678
+ setup(__props, { emit: contextEmit }) {
2679
+ const props = __props;
2680
+ const timeWithinRange = (_, __, ___) => true;
2681
+ const ppNs = useNamespace("picker-panel");
2682
+ const dpNs = useNamespace("date-picker");
2683
+ const attrs = useAttrs();
2684
+ const slots = useSlots();
2685
+ const { t, lang } = useLocale();
2686
+ const pickerBase = inject("EP_PICKER_BASE");
2687
+ const popper = inject(TOOLTIP_INJECTION_KEY);
2688
+ const { shortcuts, disabledDate: disabledDate$1, cellClassName, defaultTime } = pickerBase.props;
2689
+ const defaultValue = toRef(pickerBase.props, "defaultValue");
2690
+ const currentViewRef = ref();
2691
+ const innerDate = ref((0, import_dayjs_min$4.default)().locale(lang.value));
2692
+ const isChangeToNow = ref(false);
2693
+ let isShortcut = false;
2694
+ const defaultTimeD = computed(() => {
2695
+ return (0, import_dayjs_min$4.default)(defaultTime).locale(lang.value);
2696
+ });
2697
+ const month = computed(() => {
2698
+ return innerDate.value.month();
2699
+ });
2700
+ const year = computed(() => {
2701
+ return innerDate.value.year();
2702
+ });
2703
+ const selectableRange = ref([]);
2704
+ const userInputDate = ref(null);
2705
+ const userInputTime = ref(null);
2706
+ const checkDateWithinRange = (date$1) => {
2707
+ return selectableRange.value.length > 0 ? timeWithinRange(date$1, selectableRange.value, props.format || "HH:mm:ss") : true;
2708
+ };
2709
+ const formatEmit = (emitDayjs) => {
2710
+ if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
2711
+ if (showTime.value) return emitDayjs.millisecond(0);
2712
+ return emitDayjs.startOf("day");
2713
+ };
2714
+ const emit = (value, ...args) => {
2715
+ if (!value) contextEmit("pick", value, ...args);
2716
+ else if (isArray(value)) contextEmit("pick", value.map(formatEmit), ...args);
2717
+ else contextEmit("pick", formatEmit(value), ...args);
2718
+ userInputDate.value = null;
2719
+ userInputTime.value = null;
2720
+ isChangeToNow.value = false;
2721
+ isShortcut = false;
2722
+ };
2723
+ const handleDatePick = (value, keepOpen) => {
2724
+ if (selectionMode.value === "date") {
2725
+ value = value;
2726
+ let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
2727
+ if (!checkDateWithinRange(newDate)) newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
2728
+ innerDate.value = newDate;
2729
+ emit(newDate, showTime.value || keepOpen);
2730
+ } else if (selectionMode.value === "week") emit(value.date);
2731
+ else if (selectionMode.value === "dates") emit(value, true);
2732
+ };
2733
+ const moveByMonth = (forward) => {
2734
+ const action = forward ? "add" : "subtract";
2735
+ innerDate.value = innerDate.value[action](1, "month");
2736
+ handlePanelChange("month");
2737
+ };
2738
+ const moveByYear = (forward) => {
2739
+ const currentDate = innerDate.value;
2740
+ const action = forward ? "add" : "subtract";
2741
+ innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
2742
+ handlePanelChange("year");
2743
+ };
2744
+ const currentView = ref("date");
2745
+ const yearLabel = computed(() => {
2746
+ const yearTranslation = t("el.datepicker.year");
2747
+ if (currentView.value === "year") {
2748
+ const startYear = Math.floor(year.value / 10) * 10;
2749
+ if (yearTranslation) return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
2750
+ return `${startYear} - ${startYear + 9}`;
2751
+ }
2752
+ return `${year.value} ${yearTranslation}`;
2753
+ });
2754
+ const handleShortcutClick = (shortcut) => {
2755
+ const shortcutValue = isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
2756
+ if (shortcutValue) {
2757
+ isShortcut = true;
2758
+ emit((0, import_dayjs_min$4.default)(shortcutValue).locale(lang.value));
2759
+ return;
2760
+ }
2761
+ if (shortcut.onClick) shortcut.onClick({
2762
+ attrs,
2763
+ slots,
2764
+ emit: contextEmit
2765
+ });
2766
+ };
2767
+ const selectionMode = computed(() => {
2768
+ const { type } = props;
2769
+ if ([
2770
+ "week",
2771
+ "month",
2772
+ "year",
2773
+ "dates"
2774
+ ].includes(type)) return type;
2775
+ return "date";
2776
+ });
2777
+ const keyboardMode = computed(() => {
2778
+ return selectionMode.value === "date" ? currentView.value : selectionMode.value;
2779
+ });
2780
+ const hasShortcuts = computed(() => !!shortcuts.length);
2781
+ const handleMonthPick = async (month2) => {
2782
+ innerDate.value = innerDate.value.startOf("month").month(month2);
2783
+ if (selectionMode.value === "month") emit(innerDate.value, false);
2784
+ else {
2785
+ currentView.value = "date";
2786
+ if ([
2787
+ "month",
2788
+ "year",
2789
+ "date",
2790
+ "week"
2791
+ ].includes(selectionMode.value)) {
2792
+ emit(innerDate.value, true);
2793
+ await nextTick();
2794
+ handleFocusPicker();
2795
+ }
2796
+ }
2797
+ handlePanelChange("month");
2798
+ };
2799
+ const handleYearPick = async (year2) => {
2800
+ if (selectionMode.value === "year") {
2801
+ innerDate.value = innerDate.value.startOf("year").year(year2);
2802
+ emit(innerDate.value, false);
2803
+ } else {
2804
+ innerDate.value = innerDate.value.year(year2);
2805
+ currentView.value = "month";
2806
+ if ([
2807
+ "month",
2808
+ "year",
2809
+ "date",
2810
+ "week"
2811
+ ].includes(selectionMode.value)) {
2812
+ emit(innerDate.value, true);
2813
+ await nextTick();
2814
+ handleFocusPicker();
2815
+ }
2816
+ }
2817
+ handlePanelChange("year");
2818
+ };
2819
+ const showPicker = async (view) => {
2820
+ currentView.value = view;
2821
+ await nextTick();
2822
+ handleFocusPicker();
2823
+ };
2824
+ const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
2825
+ const footerVisible = computed(() => {
2826
+ return showTime.value || selectionMode.value === "dates";
2827
+ });
2828
+ const disabledConfirm = computed(() => {
2829
+ if (!disabledDate$1) return false;
2830
+ if (!props.parsedValue) return true;
2831
+ if (isArray(props.parsedValue)) return disabledDate$1(props.parsedValue[0].toDate());
2832
+ return disabledDate$1(props.parsedValue.toDate());
2833
+ });
2834
+ const onConfirm = () => {
2835
+ if (selectionMode.value === "dates") emit(props.parsedValue);
2836
+ else {
2837
+ let result = props.parsedValue;
2838
+ if (!result) {
2839
+ const defaultTimeD2 = (0, import_dayjs_min$4.default)(defaultTime).locale(lang.value);
2840
+ const defaultValueD = getDefaultValue$1();
2841
+ result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
2842
+ }
2843
+ innerDate.value = result;
2844
+ emit(result);
2845
+ }
2846
+ };
2847
+ const disabledNow = computed(() => {
2848
+ if (!disabledDate$1) return false;
2849
+ return disabledDate$1((0, import_dayjs_min$4.default)().locale(lang.value).toDate());
2850
+ });
2851
+ const changeToNow = () => {
2852
+ const nowDate = (0, import_dayjs_min$4.default)().locale(lang.value).toDate();
2853
+ isChangeToNow.value = true;
2854
+ if ((!disabledDate$1 || !disabledDate$1(nowDate)) && checkDateWithinRange(nowDate)) {
2855
+ innerDate.value = (0, import_dayjs_min$4.default)().locale(lang.value);
2856
+ emit(innerDate.value);
2857
+ }
2858
+ };
2859
+ const timeFormat = computed(() => {
2860
+ return props.timeFormat || extractTimeFormat(props.format);
2861
+ });
2862
+ const dateFormat = computed(() => {
2863
+ return props.dateFormat || extractDateFormat(props.format);
2864
+ });
2865
+ const visibleTime = computed(() => {
2866
+ if (userInputTime.value) return userInputTime.value;
2867
+ if (!props.parsedValue && !defaultValue.value) return;
2868
+ return (props.parsedValue || innerDate.value).format(timeFormat.value);
2869
+ });
2870
+ const visibleDate = computed(() => {
2871
+ if (userInputDate.value) return userInputDate.value;
2872
+ if (!props.parsedValue && !defaultValue.value) return;
2873
+ return (props.parsedValue || innerDate.value).format(dateFormat.value);
2874
+ });
2875
+ const timePickerVisible = ref(false);
2876
+ const onTimePickerInputFocus = () => {
2877
+ timePickerVisible.value = true;
2878
+ };
2879
+ const handleTimePickClose = () => {
2880
+ timePickerVisible.value = false;
2881
+ };
2882
+ const getUnits = (date$1) => {
2883
+ return {
2884
+ hour: date$1.hour(),
2885
+ minute: date$1.minute(),
2886
+ second: date$1.second(),
2887
+ year: date$1.year(),
2888
+ month: date$1.month(),
2889
+ date: date$1.date()
2890
+ };
2891
+ };
2892
+ const handleTimePick = (value, visible, first) => {
2893
+ const { hour, minute, second } = getUnits(value);
2894
+ innerDate.value = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
2895
+ emit(innerDate.value, true);
2896
+ if (!first) timePickerVisible.value = visible;
2897
+ };
2898
+ const handleVisibleTimeChange = (value) => {
2899
+ const newDate = (0, import_dayjs_min$4.default)(value, timeFormat.value).locale(lang.value);
2900
+ if (newDate.isValid() && checkDateWithinRange(newDate)) {
2901
+ const { year: year2, month: month2, date: date$1 } = getUnits(innerDate.value);
2902
+ innerDate.value = newDate.year(year2).month(month2).date(date$1);
2903
+ userInputTime.value = null;
2904
+ timePickerVisible.value = false;
2905
+ emit(innerDate.value, true);
2906
+ }
2907
+ };
2908
+ const handleVisibleDateChange = (value) => {
2909
+ const newDate = (0, import_dayjs_min$4.default)(value, dateFormat.value).locale(lang.value);
2910
+ if (newDate.isValid()) {
2911
+ if (disabledDate$1 && disabledDate$1(newDate.toDate())) return;
2912
+ const { hour, minute, second } = getUnits(innerDate.value);
2913
+ innerDate.value = newDate.hour(hour).minute(minute).second(second);
2914
+ userInputDate.value = null;
2915
+ emit(innerDate.value, true);
2916
+ }
2917
+ };
2918
+ const isValidValue = (date$1) => {
2919
+ return import_dayjs_min$4.default.isDayjs(date$1) && date$1.isValid() && (disabledDate$1 ? !disabledDate$1(date$1.toDate()) : true);
2920
+ };
2921
+ const formatToString = (value) => {
2922
+ if (selectionMode.value === "dates") return value.map((_) => _.format(props.format));
2923
+ return value.format(props.format);
2924
+ };
2925
+ const parseUserInput = (value) => {
2926
+ return (0, import_dayjs_min$4.default)(value, props.format).locale(lang.value);
2927
+ };
2928
+ const getDefaultValue$1 = () => {
2929
+ const parseDate$1 = (0, import_dayjs_min$4.default)(defaultValue.value).locale(lang.value);
2930
+ if (!defaultValue.value) {
2931
+ const defaultTimeDValue = defaultTimeD.value;
2932
+ return (0, import_dayjs_min$4.default)().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
2933
+ }
2934
+ return parseDate$1;
2935
+ };
2936
+ const handleFocusPicker = async () => {
2937
+ var _a;
2938
+ if ([
2939
+ "week",
2940
+ "month",
2941
+ "year",
2942
+ "date"
2943
+ ].includes(selectionMode.value)) {
2944
+ (_a = currentViewRef.value) == null || _a.focus();
2945
+ if (selectionMode.value === "week") handleKeyControl(EVENT_CODE.down);
2946
+ }
2947
+ };
2948
+ const handleKeydownTable = (event) => {
2949
+ const { code } = event;
2950
+ if ([
2951
+ EVENT_CODE.up,
2952
+ EVENT_CODE.down,
2953
+ EVENT_CODE.left,
2954
+ EVENT_CODE.right,
2955
+ EVENT_CODE.home,
2956
+ EVENT_CODE.end,
2957
+ EVENT_CODE.pageUp,
2958
+ EVENT_CODE.pageDown
2959
+ ].includes(code)) {
2960
+ handleKeyControl(code);
2961
+ event.stopPropagation();
2962
+ event.preventDefault();
2963
+ }
2964
+ if ([
2965
+ EVENT_CODE.enter,
2966
+ EVENT_CODE.space,
2967
+ EVENT_CODE.numpadEnter
2968
+ ].includes(code) && userInputDate.value === null && userInputTime.value === null) {
2969
+ event.preventDefault();
2970
+ emit(innerDate.value, false);
2971
+ }
2972
+ };
2973
+ const handleKeyControl = (code) => {
2974
+ var _a;
2975
+ const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
2976
+ const mapping = {
2977
+ year: {
2978
+ [up]: -4,
2979
+ [down]: 4,
2980
+ [left]: -1,
2981
+ [right]: 1,
2982
+ offset: (date$1, step) => date$1.setFullYear(date$1.getFullYear() + step)
2983
+ },
2984
+ month: {
2985
+ [up]: -4,
2986
+ [down]: 4,
2987
+ [left]: -1,
2988
+ [right]: 1,
2989
+ offset: (date$1, step) => date$1.setMonth(date$1.getMonth() + step)
2990
+ },
2991
+ week: {
2992
+ [up]: -1,
2993
+ [down]: 1,
2994
+ [left]: -1,
2995
+ [right]: 1,
2996
+ offset: (date$1, step) => date$1.setDate(date$1.getDate() + step * 7)
2997
+ },
2998
+ date: {
2999
+ [up]: -7,
3000
+ [down]: 7,
3001
+ [left]: -1,
3002
+ [right]: 1,
3003
+ [home]: (date$1) => -date$1.getDay(),
3004
+ [end]: (date$1) => -date$1.getDay() + 6,
3005
+ [pageUp]: (date$1) => -new Date(date$1.getFullYear(), date$1.getMonth(), 0).getDate(),
3006
+ [pageDown]: (date$1) => new Date(date$1.getFullYear(), date$1.getMonth() + 1, 0).getDate(),
3007
+ offset: (date$1, step) => date$1.setDate(date$1.getDate() + step)
3008
+ }
3009
+ };
3010
+ const newDate = innerDate.value.toDate();
3011
+ while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
3012
+ const map = mapping[keyboardMode.value];
3013
+ if (!map) return;
3014
+ map.offset(newDate, isFunction(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
3015
+ if (disabledDate$1 && disabledDate$1(newDate)) break;
3016
+ const result = (0, import_dayjs_min$4.default)(newDate).locale(lang.value);
3017
+ innerDate.value = result;
3018
+ contextEmit("pick", result, true);
3019
+ break;
3020
+ }
3021
+ };
3022
+ const handlePanelChange = (mode) => {
3023
+ contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
3024
+ };
3025
+ watch(() => selectionMode.value, (val) => {
3026
+ if (["month", "year"].includes(val)) {
3027
+ currentView.value = val;
3028
+ return;
3029
+ }
3030
+ currentView.value = "date";
3031
+ }, { immediate: true });
3032
+ watch(() => currentView.value, () => {
3033
+ popper?.updatePopper();
3034
+ });
3035
+ watch(() => defaultValue.value, (val) => {
3036
+ if (val) innerDate.value = getDefaultValue$1();
3037
+ }, { immediate: true });
3038
+ watch(() => props.parsedValue, (val) => {
3039
+ if (val) {
3040
+ if (selectionMode.value === "dates") return;
3041
+ if (Array.isArray(val)) return;
3042
+ innerDate.value = val;
3043
+ } else innerDate.value = getDefaultValue$1();
3044
+ }, { immediate: true });
3045
+ contextEmit("set-picker-option", ["isValidValue", isValidValue]);
3046
+ contextEmit("set-picker-option", ["formatToString", formatToString]);
3047
+ contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
3048
+ contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
3049
+ return (_ctx, _cache) => {
3050
+ return openBlock(), createElementBlock("div", { class: normalizeClass([
3051
+ unref(ppNs).b(),
3052
+ unref(dpNs).b(),
3053
+ {
3054
+ "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
3055
+ "has-time": unref(showTime)
3056
+ }
3057
+ ]) }, [createBaseVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
3058
+ renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
3059
+ unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
3060
+ key: 0,
3061
+ class: normalizeClass(unref(ppNs).e("sidebar"))
3062
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
3063
+ return openBlock(), createElementBlock("button", {
3064
+ key,
3065
+ type: "button",
3066
+ class: normalizeClass(unref(ppNs).e("shortcut")),
3067
+ onClick: ($event) => handleShortcutClick(shortcut)
3068
+ }, toDisplayString(shortcut.text), 11, _hoisted_1$2);
3069
+ }), 128))], 2)) : createCommentVNode("v-if", true),
3070
+ createBaseVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [
3071
+ unref(showTime) ? (openBlock(), createElementBlock("div", {
3072
+ key: 0,
3073
+ class: normalizeClass(unref(dpNs).e("time-header"))
3074
+ }, [createBaseVNode("span", { class: normalizeClass(unref(dpNs).e("editor-wrap")) }, [createVNode(unref(ElInput), {
3075
+ placeholder: unref(t)("el.datepicker.selectDate"),
3076
+ "model-value": unref(visibleDate),
3077
+ size: "small",
3078
+ "validate-event": false,
3079
+ onInput: _cache[0] || (_cache[0] = (val) => userInputDate.value = val),
3080
+ onChange: handleVisibleDateChange
3081
+ }, null, 8, ["placeholder", "model-value"])], 2), withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(unref(dpNs).e("editor-wrap")) }, [createVNode(unref(ElInput), {
3082
+ placeholder: unref(t)("el.datepicker.selectTime"),
3083
+ "model-value": unref(visibleTime),
3084
+ size: "small",
3085
+ "validate-event": false,
3086
+ onFocus: onTimePickerInputFocus,
3087
+ onInput: _cache[1] || (_cache[1] = (val) => userInputTime.value = val),
3088
+ onChange: handleVisibleTimeChange
3089
+ }, null, 8, ["placeholder", "model-value"]), createVNode(unref(TimePickPanel), {
3090
+ visible: timePickerVisible.value,
3091
+ format: unref(timeFormat),
3092
+ "parsed-value": innerDate.value,
3093
+ onPick: handleTimePick
3094
+ }, null, 8, [
3095
+ "visible",
3096
+ "format",
3097
+ "parsed-value"
3098
+ ])], 2)), [[unref(ClickOutside), handleTimePickClose]])], 2)) : createCommentVNode("v-if", true),
3099
+ withDirectives(createBaseVNode("div", { class: normalizeClass([unref(dpNs).e("header"), (currentView.value === "year" || currentView.value === "month") && unref(dpNs).e("header--bordered")]) }, [
3100
+ createBaseVNode("span", { class: normalizeClass(unref(dpNs).e("prev-btn")) }, [createBaseVNode("button", {
3101
+ type: "button",
3102
+ "aria-label": unref(t)(`el.datepicker.prevYear`),
3103
+ class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
3104
+ onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false))
3105
+ }, [createVNode(unref(ElIcon), null, {
3106
+ default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
3107
+ _: 1
3108
+ })], 10, _hoisted_2$2), withDirectives(createBaseVNode("button", {
3109
+ type: "button",
3110
+ "aria-label": unref(t)(`el.datepicker.prevMonth`),
3111
+ class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
3112
+ onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false))
3113
+ }, [createVNode(unref(ElIcon), null, {
3114
+ default: withCtx(() => [createVNode(unref(arrow_left_default))]),
3115
+ _: 1
3116
+ })], 10, _hoisted_3$2), [[vShow, currentView.value === "date"]])], 2),
3117
+ createBaseVNode("span", {
3118
+ role: "button",
3119
+ class: normalizeClass(unref(dpNs).e("header-label")),
3120
+ "aria-live": "polite",
3121
+ tabindex: "0",
3122
+ onKeydown: _cache[4] || (_cache[4] = withKeys(($event) => showPicker("year"), ["enter"])),
3123
+ onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year"))
3124
+ }, toDisplayString(unref(yearLabel)), 35),
3125
+ withDirectives(createBaseVNode("span", {
3126
+ role: "button",
3127
+ "aria-live": "polite",
3128
+ tabindex: "0",
3129
+ class: normalizeClass([unref(dpNs).e("header-label"), { active: currentView.value === "month" }]),
3130
+ onKeydown: _cache[6] || (_cache[6] = withKeys(($event) => showPicker("month"), ["enter"])),
3131
+ onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month"))
3132
+ }, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)), 35), [[vShow, currentView.value === "date"]]),
3133
+ createBaseVNode("span", { class: normalizeClass(unref(dpNs).e("next-btn")) }, [withDirectives(createBaseVNode("button", {
3134
+ type: "button",
3135
+ "aria-label": unref(t)(`el.datepicker.nextMonth`),
3136
+ class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
3137
+ onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true))
3138
+ }, [createVNode(unref(ElIcon), null, {
3139
+ default: withCtx(() => [createVNode(unref(arrow_right_default))]),
3140
+ _: 1
3141
+ })], 10, _hoisted_4$1), [[vShow, currentView.value === "date"]]), createBaseVNode("button", {
3142
+ type: "button",
3143
+ "aria-label": unref(t)(`el.datepicker.nextYear`),
3144
+ class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
3145
+ onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true))
3146
+ }, [createVNode(unref(ElIcon), null, {
3147
+ default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
3148
+ _: 1
3149
+ })], 10, _hoisted_5$1)], 2)
3150
+ ], 2), [[vShow, currentView.value !== "time"]]),
3151
+ createBaseVNode("div", {
3152
+ class: normalizeClass(unref(ppNs).e("content")),
3153
+ onKeydown: handleKeydownTable
3154
+ }, [
3155
+ currentView.value === "date" ? (openBlock(), createBlock(DateTable, {
3156
+ key: 0,
3157
+ ref_key: "currentViewRef",
3158
+ ref: currentViewRef,
3159
+ "selection-mode": unref(selectionMode),
3160
+ date: innerDate.value,
3161
+ "parsed-value": _ctx.parsedValue,
3162
+ "disabled-date": unref(disabledDate$1),
3163
+ "cell-class-name": unref(cellClassName),
3164
+ onPick: handleDatePick
3165
+ }, null, 8, [
3166
+ "selection-mode",
3167
+ "date",
3168
+ "parsed-value",
3169
+ "disabled-date",
3170
+ "cell-class-name"
3171
+ ])) : createCommentVNode("v-if", true),
3172
+ currentView.value === "year" ? (openBlock(), createBlock(YearTable, {
3173
+ key: 1,
3174
+ ref_key: "currentViewRef",
3175
+ ref: currentViewRef,
3176
+ date: innerDate.value,
3177
+ "disabled-date": unref(disabledDate$1),
3178
+ "parsed-value": _ctx.parsedValue,
3179
+ onPick: handleYearPick
3180
+ }, null, 8, [
3181
+ "date",
3182
+ "disabled-date",
3183
+ "parsed-value"
3184
+ ])) : createCommentVNode("v-if", true),
3185
+ currentView.value === "month" ? (openBlock(), createBlock(MonthTable, {
3186
+ key: 2,
3187
+ ref_key: "currentViewRef",
3188
+ ref: currentViewRef,
3189
+ date: innerDate.value,
3190
+ "parsed-value": _ctx.parsedValue,
3191
+ "disabled-date": unref(disabledDate$1),
3192
+ onPick: handleMonthPick
3193
+ }, null, 8, [
3194
+ "date",
3195
+ "parsed-value",
3196
+ "disabled-date"
3197
+ ])) : createCommentVNode("v-if", true)
3198
+ ], 34)
3199
+ ], 2)
3200
+ ], 2), withDirectives(createBaseVNode("div", { class: normalizeClass(unref(ppNs).e("footer")) }, [withDirectives(createVNode(unref(ElButton), {
3201
+ text: "",
3202
+ size: "small",
3203
+ class: normalizeClass(unref(ppNs).e("link-btn")),
3204
+ disabled: unref(disabledNow),
3205
+ onClick: changeToNow
3206
+ }, {
3207
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.now")), 1)]),
3208
+ _: 1
3209
+ }, 8, ["class", "disabled"]), [[vShow, unref(selectionMode) !== "dates"]]), createVNode(unref(ElButton), {
3210
+ plain: "",
3211
+ size: "small",
3212
+ class: normalizeClass(unref(ppNs).e("link-btn")),
3213
+ disabled: unref(disabledConfirm),
3214
+ onClick: onConfirm
3215
+ }, {
3216
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)]),
3217
+ _: 1
3218
+ }, 8, ["class", "disabled"])], 2), [[vShow, unref(footerVisible) && currentView.value === "date"]])], 2);
3219
+ };
3220
+ }
3221
+ }), [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue"]]);
3222
+ var panelDateRangeProps = buildProps({
3223
+ ...panelSharedProps,
3224
+ ...panelRangeSharedProps
3225
+ });
3226
+ var import_dayjs_min$3 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
3227
+ init_shared_esm_bundler();
3228
+ var useShortcut = (lang) => {
3229
+ const { emit } = getCurrentInstance();
3230
+ const attrs = useAttrs();
3231
+ const slots = useSlots();
3232
+ const handleShortcutClick = (shortcut) => {
3233
+ const shortcutValues = isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
3234
+ if (shortcutValues) {
3235
+ emit("pick", [(0, import_dayjs_min$3.default)(shortcutValues[0]).locale(lang.value), (0, import_dayjs_min$3.default)(shortcutValues[1]).locale(lang.value)]);
3236
+ return;
3237
+ }
3238
+ if (shortcut.onClick) shortcut.onClick({
3239
+ attrs,
3240
+ slots,
3241
+ emit
3242
+ });
3243
+ };
3244
+ return handleShortcutClick;
3245
+ };
3246
+ init_shared_esm_bundler();
3247
+ var useRangePicker = (props, { defaultValue, leftDate, rightDate, unit: unit$2, onParsedValueChanged }) => {
3248
+ const { emit } = getCurrentInstance();
3249
+ const { pickerNs } = inject(ROOT_PICKER_INJECTION_KEY);
3250
+ const drpNs = useNamespace("date-range-picker");
3251
+ const { t, lang } = useLocale();
3252
+ const handleShortcutClick = useShortcut(lang);
3253
+ const minDate = ref();
3254
+ const maxDate = ref();
3255
+ const rangeState = ref({
3256
+ endDate: null,
3257
+ selecting: false
3258
+ });
3259
+ const handleChangeRange = (val) => {
3260
+ rangeState.value = val;
3261
+ };
3262
+ const handleRangeConfirm = (visible = false) => {
3263
+ const _minDate = unref(minDate);
3264
+ const _maxDate = unref(maxDate);
3265
+ if (isValidRange([_minDate, _maxDate])) emit("pick", [_minDate, _maxDate], visible);
3266
+ };
3267
+ const onSelect = (selecting) => {
3268
+ rangeState.value.selecting = selecting;
3269
+ if (!selecting) rangeState.value.endDate = null;
3270
+ };
3271
+ const restoreDefault = () => {
3272
+ const [start, end] = getDefaultValue(unref(defaultValue), {
3273
+ lang: unref(lang),
3274
+ unit: unit$2,
3275
+ unlinkPanels: props.unlinkPanels
3276
+ });
3277
+ minDate.value = void 0;
3278
+ maxDate.value = void 0;
3279
+ leftDate.value = start;
3280
+ rightDate.value = end;
3281
+ };
3282
+ watch(defaultValue, (val) => {
3283
+ if (val) restoreDefault();
3284
+ }, { immediate: true });
3285
+ watch(() => props.parsedValue, (parsedValue$1) => {
3286
+ if (isArray(parsedValue$1) && parsedValue$1.length === 2) {
3287
+ const [start, end] = parsedValue$1;
3288
+ minDate.value = start;
3289
+ leftDate.value = start;
3290
+ maxDate.value = end;
3291
+ onParsedValueChanged(unref(minDate), unref(maxDate));
3292
+ } else restoreDefault();
3293
+ }, { immediate: true });
3294
+ return {
3295
+ minDate,
3296
+ maxDate,
3297
+ rangeState,
3298
+ lang,
3299
+ ppNs: pickerNs,
3300
+ drpNs,
3301
+ handleChangeRange,
3302
+ handleRangeConfirm,
3303
+ handleShortcutClick,
3304
+ onSelect,
3305
+ t
3306
+ };
3307
+ };
3308
+ var import_dayjs_min$2 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
3309
+ init_shared_esm_bundler();
3310
+ var _hoisted_1$1 = ["onClick"];
3311
+ var _hoisted_2$1 = ["aria-label"];
3312
+ var _hoisted_3$1 = ["aria-label"];
3313
+ var _hoisted_4 = ["disabled", "aria-label"];
3314
+ var _hoisted_5 = ["disabled", "aria-label"];
3315
+ var _hoisted_6 = ["disabled", "aria-label"];
3316
+ var _hoisted_7 = ["disabled", "aria-label"];
3317
+ var _hoisted_8 = ["aria-label"];
3318
+ var _hoisted_9 = ["aria-label"];
3319
+ var unit$1 = "month";
3320
+ var DateRangePickPanel = /* @__PURE__ */ _export_sfc(/* @__PURE__ */ defineComponent({
3321
+ __name: "panel-date-range",
3322
+ props: panelDateRangeProps,
3323
+ emits: [
3324
+ "pick",
3325
+ "set-picker-option",
3326
+ "calendar-change",
3327
+ "panel-change"
3328
+ ],
3329
+ setup(__props, { emit }) {
3330
+ const props = __props;
3331
+ const pickerBase = inject("EP_PICKER_BASE");
3332
+ const { disabledDate: disabledDate$1, cellClassName, format, defaultTime, clearable } = pickerBase.props;
3333
+ const shortcuts = toRef(pickerBase.props, "shortcuts");
3334
+ const defaultValue = toRef(pickerBase.props, "defaultValue");
3335
+ const { lang } = useLocale();
3336
+ const leftDate = ref((0, import_dayjs_min$2.default)().locale(lang.value));
3337
+ const rightDate = ref((0, import_dayjs_min$2.default)().locale(lang.value).add(1, unit$1));
3338
+ const { minDate, maxDate, rangeState, ppNs, drpNs, handleChangeRange, handleRangeConfirm, handleShortcutClick, onSelect, t } = useRangePicker(props, {
3339
+ defaultValue,
3340
+ leftDate,
3341
+ rightDate,
3342
+ unit: unit$1,
3343
+ onParsedValueChanged
3344
+ });
3345
+ const dateUserInput = ref({
3346
+ min: null,
3347
+ max: null
3348
+ });
3349
+ const timeUserInput = ref({
3350
+ min: null,
3351
+ max: null
3352
+ });
3353
+ const leftLabel = computed(() => {
3354
+ return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
3355
+ });
3356
+ const rightLabel = computed(() => {
3357
+ return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
3358
+ });
3359
+ const leftYear = computed(() => {
3360
+ return leftDate.value.year();
3361
+ });
3362
+ const leftMonth = computed(() => {
3363
+ return leftDate.value.month();
3364
+ });
3365
+ const rightYear = computed(() => {
3366
+ return rightDate.value.year();
3367
+ });
3368
+ const rightMonth = computed(() => {
3369
+ return rightDate.value.month();
3370
+ });
3371
+ const hasShortcuts = computed(() => !!shortcuts.value.length);
3372
+ const minVisibleDate = computed(() => {
3373
+ if (dateUserInput.value.min !== null) return dateUserInput.value.min;
3374
+ if (minDate.value) return minDate.value.format(dateFormat.value);
3375
+ return "";
3376
+ });
3377
+ const maxVisibleDate = computed(() => {
3378
+ if (dateUserInput.value.max !== null) return dateUserInput.value.max;
3379
+ if (maxDate.value || minDate.value) return (maxDate.value || minDate.value).format(dateFormat.value);
3380
+ return "";
3381
+ });
3382
+ const minVisibleTime = computed(() => {
3383
+ if (timeUserInput.value.min !== null) return timeUserInput.value.min;
3384
+ if (minDate.value) return minDate.value.format(timeFormat.value);
3385
+ return "";
3386
+ });
3387
+ const maxVisibleTime = computed(() => {
3388
+ if (timeUserInput.value.max !== null) return timeUserInput.value.max;
3389
+ if (maxDate.value || minDate.value) return (maxDate.value || minDate.value).format(timeFormat.value);
3390
+ return "";
3391
+ });
3392
+ const timeFormat = computed(() => {
3393
+ return props.timeFormat || extractTimeFormat(format);
3394
+ });
3395
+ const dateFormat = computed(() => {
3396
+ return props.dateFormat || extractDateFormat(format);
3397
+ });
3398
+ const isValidValue = (date$1) => {
3399
+ return isValidRange(date$1) && (disabledDate$1 ? !disabledDate$1(date$1[0].toDate()) && !disabledDate$1(date$1[1].toDate()) : true);
3400
+ };
3401
+ const leftPrevYear = () => {
3402
+ leftDate.value = leftDate.value.subtract(1, "year");
3403
+ if (!props.unlinkPanels) rightDate.value = leftDate.value.add(1, "month");
3404
+ handlePanelChange("year");
3405
+ };
3406
+ const leftPrevMonth = () => {
3407
+ leftDate.value = leftDate.value.subtract(1, "month");
3408
+ if (!props.unlinkPanels) rightDate.value = leftDate.value.add(1, "month");
3409
+ handlePanelChange("month");
3410
+ };
3411
+ const rightNextYear = () => {
3412
+ if (!props.unlinkPanels) {
3413
+ leftDate.value = leftDate.value.add(1, "year");
3414
+ rightDate.value = leftDate.value.add(1, "month");
3415
+ } else rightDate.value = rightDate.value.add(1, "year");
3416
+ handlePanelChange("year");
3417
+ };
3418
+ const rightNextMonth = () => {
3419
+ if (!props.unlinkPanels) {
3420
+ leftDate.value = leftDate.value.add(1, "month");
3421
+ rightDate.value = leftDate.value.add(1, "month");
3422
+ } else rightDate.value = rightDate.value.add(1, "month");
3423
+ handlePanelChange("month");
3424
+ };
3425
+ const leftNextYear = () => {
3426
+ leftDate.value = leftDate.value.add(1, "year");
3427
+ handlePanelChange("year");
3428
+ };
3429
+ const leftNextMonth = () => {
3430
+ leftDate.value = leftDate.value.add(1, "month");
3431
+ handlePanelChange("month");
3432
+ };
3433
+ const rightPrevYear = () => {
3434
+ rightDate.value = rightDate.value.subtract(1, "year");
3435
+ handlePanelChange("year");
3436
+ };
3437
+ const rightPrevMonth = () => {
3438
+ rightDate.value = rightDate.value.subtract(1, "month");
3439
+ handlePanelChange("month");
3440
+ };
3441
+ const handlePanelChange = (mode) => {
3442
+ emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
3443
+ };
3444
+ const enableMonthArrow = computed(() => {
3445
+ const nextMonth = (leftMonth.value + 1) % 12;
3446
+ const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
3447
+ return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
3448
+ });
3449
+ const enableYearArrow = computed(() => {
3450
+ return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
3451
+ });
3452
+ const btnDisabled = computed(() => {
3453
+ return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
3454
+ });
3455
+ const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
3456
+ const formatEmit = (emitDayjs, index) => {
3457
+ if (!emitDayjs) return;
3458
+ if (defaultTime) return (0, import_dayjs_min$2.default)(defaultTime[index] || defaultTime).locale(lang.value).year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
3459
+ return emitDayjs;
3460
+ };
3461
+ const handleRangePick = (val, close = true) => {
3462
+ const min_ = val.minDate;
3463
+ const max_ = val.maxDate;
3464
+ const minDate_ = formatEmit(min_, 0);
3465
+ const maxDate_ = formatEmit(max_, 1);
3466
+ if (maxDate.value === maxDate_ && minDate.value === minDate_) return;
3467
+ emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
3468
+ maxDate.value = maxDate_;
3469
+ minDate.value = minDate_;
3470
+ if (!close || showTime.value) return;
3471
+ handleRangeConfirm();
3472
+ };
3473
+ const minTimePickerVisible = ref(false);
3474
+ const maxTimePickerVisible = ref(false);
3475
+ const handleMinTimeClose = () => {
3476
+ minTimePickerVisible.value = false;
3477
+ };
3478
+ const handleMaxTimeClose = () => {
3479
+ maxTimePickerVisible.value = false;
3480
+ };
3481
+ const handleDateInput = (value, type) => {
3482
+ dateUserInput.value[type] = value;
3483
+ const parsedValueD = (0, import_dayjs_min$2.default)(value, dateFormat.value).locale(lang.value);
3484
+ if (parsedValueD.isValid()) {
3485
+ if (disabledDate$1 && disabledDate$1(parsedValueD.toDate())) return;
3486
+ if (type === "min") {
3487
+ leftDate.value = parsedValueD;
3488
+ minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
3489
+ if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
3490
+ rightDate.value = parsedValueD.add(1, "month");
3491
+ maxDate.value = minDate.value.add(1, "month");
3492
+ }
3493
+ } else {
3494
+ rightDate.value = parsedValueD;
3495
+ maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
3496
+ if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
3497
+ leftDate.value = parsedValueD.subtract(1, "month");
3498
+ minDate.value = maxDate.value.subtract(1, "month");
3499
+ }
3500
+ }
3501
+ }
3502
+ };
3503
+ const handleDateChange = (_, type) => {
3504
+ dateUserInput.value[type] = null;
3505
+ };
3506
+ const handleTimeInput = (value, type) => {
3507
+ timeUserInput.value[type] = value;
3508
+ const parsedValueD = (0, import_dayjs_min$2.default)(value, timeFormat.value).locale(lang.value);
3509
+ if (parsedValueD.isValid()) if (type === "min") {
3510
+ minTimePickerVisible.value = true;
3511
+ minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
3512
+ if (!maxDate.value || maxDate.value.isBefore(minDate.value)) maxDate.value = minDate.value;
3513
+ } else {
3514
+ maxTimePickerVisible.value = true;
3515
+ maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
3516
+ rightDate.value = maxDate.value;
3517
+ if (maxDate.value && maxDate.value.isBefore(minDate.value)) minDate.value = maxDate.value;
3518
+ }
3519
+ };
3520
+ const handleTimeChange = (value, type) => {
3521
+ timeUserInput.value[type] = null;
3522
+ if (type === "min") {
3523
+ leftDate.value = minDate.value;
3524
+ minTimePickerVisible.value = false;
3525
+ } else {
3526
+ rightDate.value = maxDate.value;
3527
+ maxTimePickerVisible.value = false;
3528
+ }
3529
+ };
3530
+ const handleMinTimePick = (value, visible, first) => {
3531
+ if (timeUserInput.value.min) return;
3532
+ if (value) {
3533
+ leftDate.value = value;
3534
+ minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
3535
+ }
3536
+ if (!first) minTimePickerVisible.value = visible;
3537
+ if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
3538
+ maxDate.value = minDate.value;
3539
+ rightDate.value = value;
3540
+ }
3541
+ };
3542
+ const handleMaxTimePick = (value, visible, first) => {
3543
+ if (timeUserInput.value.max) return;
3544
+ if (value) {
3545
+ rightDate.value = value;
3546
+ maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
3547
+ }
3548
+ if (!first) maxTimePickerVisible.value = visible;
3549
+ if (maxDate.value && maxDate.value.isBefore(minDate.value)) minDate.value = maxDate.value;
3550
+ };
3551
+ const handleClear = () => {
3552
+ leftDate.value = getDefaultValue(unref(defaultValue), {
3553
+ lang: unref(lang),
3554
+ unit: "month",
3555
+ unlinkPanels: props.unlinkPanels
3556
+ })[0];
3557
+ rightDate.value = leftDate.value.add(1, "month");
3558
+ emit("pick", null);
3559
+ };
3560
+ const formatToString = (value) => {
3561
+ return isArray(value) ? value.map((_) => _.format(format)) : value.format(format);
3562
+ };
3563
+ const parseUserInput = (value) => {
3564
+ return isArray(value) ? value.map((_) => (0, import_dayjs_min$2.default)(_, format).locale(lang.value)) : (0, import_dayjs_min$2.default)(value, format).locale(lang.value);
3565
+ };
3566
+ function onParsedValueChanged(minDate2, maxDate2) {
3567
+ if (props.unlinkPanels && maxDate2) {
3568
+ const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
3569
+ const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
3570
+ const maxDateYear = maxDate2.year();
3571
+ const maxDateMonth = maxDate2.month();
3572
+ rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$1) : maxDate2;
3573
+ } else {
3574
+ rightDate.value = leftDate.value.add(1, unit$1);
3575
+ if (maxDate2) rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
3576
+ }
3577
+ }
3578
+ emit("set-picker-option", ["isValidValue", isValidValue]);
3579
+ emit("set-picker-option", ["parseUserInput", parseUserInput]);
3580
+ emit("set-picker-option", ["formatToString", formatToString]);
3581
+ emit("set-picker-option", ["handleClear", handleClear]);
3582
+ return (_ctx, _cache) => {
3583
+ return openBlock(), createElementBlock("div", { class: normalizeClass([
3584
+ unref(ppNs).b(),
3585
+ unref(drpNs).b(),
3586
+ {
3587
+ "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
3588
+ "has-time": unref(showTime)
3589
+ }
3590
+ ]) }, [createBaseVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
3591
+ renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
3592
+ unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
3593
+ key: 0,
3594
+ class: normalizeClass(unref(ppNs).e("sidebar"))
3595
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
3596
+ return openBlock(), createElementBlock("button", {
3597
+ key,
3598
+ type: "button",
3599
+ class: normalizeClass(unref(ppNs).e("shortcut")),
3600
+ onClick: ($event) => unref(handleShortcutClick)(shortcut)
3601
+ }, toDisplayString(shortcut.text), 11, _hoisted_1$1);
3602
+ }), 128))], 2)) : createCommentVNode("v-if", true),
3603
+ createBaseVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [
3604
+ unref(showTime) ? (openBlock(), createElementBlock("div", {
3605
+ key: 0,
3606
+ class: normalizeClass(unref(drpNs).e("time-header"))
3607
+ }, [
3608
+ createBaseVNode("span", { class: normalizeClass(unref(drpNs).e("editors-wrap")) }, [createBaseVNode("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
3609
+ size: "small",
3610
+ disabled: unref(rangeState).selecting,
3611
+ placeholder: unref(t)("el.datepicker.startDate"),
3612
+ class: normalizeClass(unref(drpNs).e("editor")),
3613
+ "model-value": unref(minVisibleDate),
3614
+ "validate-event": false,
3615
+ onInput: _cache[0] || (_cache[0] = (val) => handleDateInput(val, "min")),
3616
+ onChange: _cache[1] || (_cache[1] = (val) => handleDateChange(val, "min"))
3617
+ }, null, 8, [
3618
+ "disabled",
3619
+ "placeholder",
3620
+ "class",
3621
+ "model-value"
3622
+ ])], 2), withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
3623
+ size: "small",
3624
+ class: normalizeClass(unref(drpNs).e("editor")),
3625
+ disabled: unref(rangeState).selecting,
3626
+ placeholder: unref(t)("el.datepicker.startTime"),
3627
+ "model-value": unref(minVisibleTime),
3628
+ "validate-event": false,
3629
+ onFocus: _cache[2] || (_cache[2] = ($event) => minTimePickerVisible.value = true),
3630
+ onInput: _cache[3] || (_cache[3] = (val) => handleTimeInput(val, "min")),
3631
+ onChange: _cache[4] || (_cache[4] = (val) => handleTimeChange(val, "min"))
3632
+ }, null, 8, [
3633
+ "class",
3634
+ "disabled",
3635
+ "placeholder",
3636
+ "model-value"
3637
+ ]), createVNode(unref(TimePickPanel), {
3638
+ visible: minTimePickerVisible.value,
3639
+ format: unref(timeFormat),
3640
+ "datetime-role": "start",
3641
+ "parsed-value": leftDate.value,
3642
+ onPick: handleMinTimePick
3643
+ }, null, 8, [
3644
+ "visible",
3645
+ "format",
3646
+ "parsed-value"
3647
+ ])], 2)), [[unref(ClickOutside), handleMinTimeClose]])], 2),
3648
+ createBaseVNode("span", null, [createVNode(unref(ElIcon), null, {
3649
+ default: withCtx(() => [createVNode(unref(arrow_right_default))]),
3650
+ _: 1
3651
+ })]),
3652
+ createBaseVNode("span", { class: normalizeClass([unref(drpNs).e("editors-wrap"), "is-right"]) }, [createBaseVNode("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
3653
+ size: "small",
3654
+ class: normalizeClass(unref(drpNs).e("editor")),
3655
+ disabled: unref(rangeState).selecting,
3656
+ placeholder: unref(t)("el.datepicker.endDate"),
3657
+ "model-value": unref(maxVisibleDate),
3658
+ readonly: !unref(minDate),
3659
+ "validate-event": false,
3660
+ onInput: _cache[5] || (_cache[5] = (val) => handleDateInput(val, "max")),
3661
+ onChange: _cache[6] || (_cache[6] = (val) => handleDateChange(val, "max"))
3662
+ }, null, 8, [
3663
+ "class",
3664
+ "disabled",
3665
+ "placeholder",
3666
+ "model-value",
3667
+ "readonly"
3668
+ ])], 2), withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
3669
+ size: "small",
3670
+ class: normalizeClass(unref(drpNs).e("editor")),
3671
+ disabled: unref(rangeState).selecting,
3672
+ placeholder: unref(t)("el.datepicker.endTime"),
3673
+ "model-value": unref(maxVisibleTime),
3674
+ readonly: !unref(minDate),
3675
+ "validate-event": false,
3676
+ onFocus: _cache[7] || (_cache[7] = ($event) => unref(minDate) && (maxTimePickerVisible.value = true)),
3677
+ onInput: _cache[8] || (_cache[8] = (val) => handleTimeInput(val, "max")),
3678
+ onChange: _cache[9] || (_cache[9] = (val) => handleTimeChange(val, "max"))
3679
+ }, null, 8, [
3680
+ "class",
3681
+ "disabled",
3682
+ "placeholder",
3683
+ "model-value",
3684
+ "readonly"
3685
+ ]), createVNode(unref(TimePickPanel), {
3686
+ "datetime-role": "end",
3687
+ visible: maxTimePickerVisible.value,
3688
+ format: unref(timeFormat),
3689
+ "parsed-value": rightDate.value,
3690
+ onPick: handleMaxTimePick
3691
+ }, null, 8, [
3692
+ "visible",
3693
+ "format",
3694
+ "parsed-value"
3695
+ ])], 2)), [[unref(ClickOutside), handleMaxTimeClose]])], 2)
3696
+ ], 2)) : createCommentVNode("v-if", true),
3697
+ createBaseVNode("div", { class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"]) }, [createBaseVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
3698
+ createBaseVNode("button", {
3699
+ type: "button",
3700
+ class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
3701
+ "aria-label": unref(t)(`el.datepicker.prevYear`),
3702
+ onClick: leftPrevYear
3703
+ }, [createVNode(unref(ElIcon), null, {
3704
+ default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
3705
+ _: 1
3706
+ })], 10, _hoisted_2$1),
3707
+ createBaseVNode("button", {
3708
+ type: "button",
3709
+ class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
3710
+ "aria-label": unref(t)(`el.datepicker.prevMonth`),
3711
+ onClick: leftPrevMonth
3712
+ }, [createVNode(unref(ElIcon), null, {
3713
+ default: withCtx(() => [createVNode(unref(arrow_left_default))]),
3714
+ _: 1
3715
+ })], 10, _hoisted_3$1),
3716
+ _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
3717
+ key: 0,
3718
+ type: "button",
3719
+ disabled: !unref(enableYearArrow),
3720
+ class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-right"]),
3721
+ "aria-label": unref(t)(`el.datepicker.nextYear`),
3722
+ onClick: leftNextYear
3723
+ }, [createVNode(unref(ElIcon), null, {
3724
+ default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
3725
+ _: 1
3726
+ })], 10, _hoisted_4)) : createCommentVNode("v-if", true),
3727
+ _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
3728
+ key: 1,
3729
+ type: "button",
3730
+ disabled: !unref(enableMonthArrow),
3731
+ class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableMonthArrow) }], "arrow-right"]),
3732
+ "aria-label": unref(t)(`el.datepicker.nextMonth`),
3733
+ onClick: leftNextMonth
3734
+ }, [createVNode(unref(ElIcon), null, {
3735
+ default: withCtx(() => [createVNode(unref(arrow_right_default))]),
3736
+ _: 1
3737
+ })], 10, _hoisted_5)) : createCommentVNode("v-if", true),
3738
+ createBaseVNode("div", null, toDisplayString(unref(leftLabel)), 1)
3739
+ ], 2), createVNode(DateTable, {
3740
+ "selection-mode": "range",
3741
+ date: leftDate.value,
3742
+ "min-date": unref(minDate),
3743
+ "max-date": unref(maxDate),
3744
+ "range-state": unref(rangeState),
3745
+ "disabled-date": unref(disabledDate$1),
3746
+ "cell-class-name": unref(cellClassName),
3747
+ onChangerange: unref(handleChangeRange),
3748
+ onPick: handleRangePick,
3749
+ onSelect: unref(onSelect)
3750
+ }, null, 8, [
3751
+ "date",
3752
+ "min-date",
3753
+ "max-date",
3754
+ "range-state",
3755
+ "disabled-date",
3756
+ "cell-class-name",
3757
+ "onChangerange",
3758
+ "onSelect"
3759
+ ])], 2),
3760
+ createBaseVNode("div", { class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"]) }, [createBaseVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
3761
+ _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
3762
+ key: 0,
3763
+ type: "button",
3764
+ disabled: !unref(enableYearArrow),
3765
+ class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
3766
+ "aria-label": unref(t)(`el.datepicker.prevYear`),
3767
+ onClick: rightPrevYear
3768
+ }, [createVNode(unref(ElIcon), null, {
3769
+ default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
3770
+ _: 1
3771
+ })], 10, _hoisted_6)) : createCommentVNode("v-if", true),
3772
+ _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
3773
+ key: 1,
3774
+ type: "button",
3775
+ disabled: !unref(enableMonthArrow),
3776
+ class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableMonthArrow) }], "arrow-left"]),
3777
+ "aria-label": unref(t)(`el.datepicker.prevMonth`),
3778
+ onClick: rightPrevMonth
3779
+ }, [createVNode(unref(ElIcon), null, {
3780
+ default: withCtx(() => [createVNode(unref(arrow_left_default))]),
3781
+ _: 1
3782
+ })], 10, _hoisted_7)) : createCommentVNode("v-if", true),
3783
+ createBaseVNode("button", {
3784
+ type: "button",
3785
+ "aria-label": unref(t)(`el.datepicker.nextYear`),
3786
+ class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
3787
+ onClick: rightNextYear
3788
+ }, [createVNode(unref(ElIcon), null, {
3789
+ default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
3790
+ _: 1
3791
+ })], 10, _hoisted_8),
3792
+ createBaseVNode("button", {
3793
+ type: "button",
3794
+ class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
3795
+ "aria-label": unref(t)(`el.datepicker.nextMonth`),
3796
+ onClick: rightNextMonth
3797
+ }, [createVNode(unref(ElIcon), null, {
3798
+ default: withCtx(() => [createVNode(unref(arrow_right_default))]),
3799
+ _: 1
3800
+ })], 10, _hoisted_9),
3801
+ createBaseVNode("div", null, toDisplayString(unref(rightLabel)), 1)
3802
+ ], 2), createVNode(DateTable, {
3803
+ "selection-mode": "range",
3804
+ date: rightDate.value,
3805
+ "min-date": unref(minDate),
3806
+ "max-date": unref(maxDate),
3807
+ "range-state": unref(rangeState),
3808
+ "disabled-date": unref(disabledDate$1),
3809
+ "cell-class-name": unref(cellClassName),
3810
+ onChangerange: unref(handleChangeRange),
3811
+ onPick: handleRangePick,
3812
+ onSelect: unref(onSelect)
3813
+ }, null, 8, [
3814
+ "date",
3815
+ "min-date",
3816
+ "max-date",
3817
+ "range-state",
3818
+ "disabled-date",
3819
+ "cell-class-name",
3820
+ "onChangerange",
3821
+ "onSelect"
3822
+ ])], 2)
3823
+ ], 2)
3824
+ ], 2), unref(showTime) ? (openBlock(), createElementBlock("div", {
3825
+ key: 0,
3826
+ class: normalizeClass(unref(ppNs).e("footer"))
3827
+ }, [unref(clearable) ? (openBlock(), createBlock(unref(ElButton), {
3828
+ key: 0,
3829
+ text: "",
3830
+ size: "small",
3831
+ class: normalizeClass(unref(ppNs).e("link-btn")),
3832
+ onClick: handleClear
3833
+ }, {
3834
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.clear")), 1)]),
3835
+ _: 1
3836
+ }, 8, ["class"])) : createCommentVNode("v-if", true), createVNode(unref(ElButton), {
3837
+ plain: "",
3838
+ size: "small",
3839
+ class: normalizeClass(unref(ppNs).e("link-btn")),
3840
+ disabled: unref(btnDisabled),
3841
+ onClick: _cache[10] || (_cache[10] = ($event) => unref(handleRangeConfirm)(false))
3842
+ }, {
3843
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)]),
3844
+ _: 1
3845
+ }, 8, ["class", "disabled"])], 2)) : createCommentVNode("v-if", true)], 2);
3846
+ };
3847
+ }
3848
+ }), [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-date-range.vue"]]);
3849
+ var panelMonthRangeProps = buildProps({ ...panelRangeSharedProps });
3850
+ var panelMonthRangeEmits = [
3851
+ "pick",
3852
+ "set-picker-option",
3853
+ "calendar-change"
3854
+ ];
3855
+ var useMonthRangeHeader = ({ unlinkPanels, leftDate, rightDate }) => {
3856
+ const { t } = useLocale();
3857
+ const leftPrevYear = () => {
3858
+ leftDate.value = leftDate.value.subtract(1, "year");
3859
+ if (!unlinkPanels.value) rightDate.value = rightDate.value.subtract(1, "year");
3860
+ };
3861
+ const rightNextYear = () => {
3862
+ if (!unlinkPanels.value) leftDate.value = leftDate.value.add(1, "year");
3863
+ rightDate.value = rightDate.value.add(1, "year");
3864
+ };
3865
+ const leftNextYear = () => {
3866
+ leftDate.value = leftDate.value.add(1, "year");
3867
+ };
3868
+ const rightPrevYear = () => {
3869
+ rightDate.value = rightDate.value.subtract(1, "year");
3870
+ };
3871
+ return {
3872
+ leftPrevYear,
3873
+ rightNextYear,
3874
+ leftNextYear,
3875
+ rightPrevYear,
3876
+ leftLabel: computed(() => {
3877
+ return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
3878
+ }),
3879
+ rightLabel: computed(() => {
3880
+ return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
3881
+ }),
3882
+ leftYear: computed(() => {
3883
+ return leftDate.value.year();
3884
+ }),
3885
+ rightYear: computed(() => {
3886
+ return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
3887
+ })
3888
+ };
3889
+ };
3890
+ var import_dayjs_min$1 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
3891
+ var _hoisted_1 = ["onClick"];
3892
+ var _hoisted_2 = ["disabled"];
3893
+ var _hoisted_3 = ["disabled"];
3894
+ var unit = "year";
3895
+ var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(/* @__PURE__ */ defineComponent({
3896
+ ...defineComponent({ name: "DatePickerMonthRange" }),
3897
+ props: panelMonthRangeProps,
3898
+ emits: panelMonthRangeEmits,
3899
+ setup(__props, { emit }) {
3900
+ const props = __props;
3901
+ const { lang } = useLocale();
3902
+ const pickerBase = inject("EP_PICKER_BASE");
3903
+ const { shortcuts, disabledDate: disabledDate$1, format } = pickerBase.props;
3904
+ const defaultValue = toRef(pickerBase.props, "defaultValue");
3905
+ const leftDate = ref((0, import_dayjs_min$1.default)().locale(lang.value));
3906
+ const rightDate = ref((0, import_dayjs_min$1.default)().locale(lang.value).add(1, unit));
3907
+ const { minDate, maxDate, rangeState, ppNs, drpNs, handleChangeRange, handleRangeConfirm, handleShortcutClick, onSelect } = useRangePicker(props, {
3908
+ defaultValue,
3909
+ leftDate,
3910
+ rightDate,
3911
+ unit,
3912
+ onParsedValueChanged
3913
+ });
3914
+ const hasShortcuts = computed(() => !!shortcuts.length);
3915
+ const { leftPrevYear, rightNextYear, leftNextYear, rightPrevYear, leftLabel, rightLabel, leftYear, rightYear } = useMonthRangeHeader({
3916
+ unlinkPanels: toRef(props, "unlinkPanels"),
3917
+ leftDate,
3918
+ rightDate
3919
+ });
3920
+ const enableYearArrow = computed(() => {
3921
+ return props.unlinkPanels && rightYear.value > leftYear.value + 1;
3922
+ });
3923
+ const handleRangePick = (val, close = true) => {
3924
+ const minDate_ = val.minDate;
3925
+ const maxDate_ = val.maxDate;
3926
+ if (maxDate.value === maxDate_ && minDate.value === minDate_) return;
3927
+ emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
3928
+ maxDate.value = maxDate_;
3929
+ minDate.value = minDate_;
3930
+ if (!close) return;
3931
+ handleRangeConfirm();
3932
+ };
3933
+ const formatToString = (days) => {
3934
+ return days.map((day) => day.format(format));
3935
+ };
3936
+ function onParsedValueChanged(minDate2, maxDate2) {
3937
+ if (props.unlinkPanels && maxDate2) rightDate.value = ((minDate2 == null ? void 0 : minDate2.year()) || 0) === maxDate2.year() ? maxDate2.add(1, unit) : maxDate2;
3938
+ else rightDate.value = leftDate.value.add(1, unit);
3939
+ }
3940
+ emit("set-picker-option", ["formatToString", formatToString]);
3941
+ return (_ctx, _cache) => {
3942
+ return openBlock(), createElementBlock("div", { class: normalizeClass([
3943
+ unref(ppNs).b(),
3944
+ unref(drpNs).b(),
3945
+ { "has-sidebar": Boolean(_ctx.$slots.sidebar) || unref(hasShortcuts) }
3946
+ ]) }, [createBaseVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
3947
+ renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
3948
+ unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
3949
+ key: 0,
3950
+ class: normalizeClass(unref(ppNs).e("sidebar"))
3951
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
3952
+ return openBlock(), createElementBlock("button", {
3953
+ key,
3954
+ type: "button",
3955
+ class: normalizeClass(unref(ppNs).e("shortcut")),
3956
+ onClick: ($event) => unref(handleShortcutClick)(shortcut)
3957
+ }, toDisplayString(shortcut.text), 11, _hoisted_1);
3958
+ }), 128))], 2)) : createCommentVNode("v-if", true),
3959
+ createBaseVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [createBaseVNode("div", { class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"]) }, [createBaseVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
3960
+ createBaseVNode("button", {
3961
+ type: "button",
3962
+ class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
3963
+ onClick: _cache[0] || (_cache[0] = (...args) => unref(leftPrevYear) && unref(leftPrevYear)(...args))
3964
+ }, [createVNode(unref(ElIcon), null, {
3965
+ default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
3966
+ _: 1
3967
+ })], 2),
3968
+ _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
3969
+ key: 0,
3970
+ type: "button",
3971
+ disabled: !unref(enableYearArrow),
3972
+ class: normalizeClass([[unref(ppNs).e("icon-btn"), { [unref(ppNs).is("disabled")]: !unref(enableYearArrow) }], "d-arrow-right"]),
3973
+ onClick: _cache[1] || (_cache[1] = (...args) => unref(leftNextYear) && unref(leftNextYear)(...args))
3974
+ }, [createVNode(unref(ElIcon), null, {
3975
+ default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
3976
+ _: 1
3977
+ })], 10, _hoisted_2)) : createCommentVNode("v-if", true),
3978
+ createBaseVNode("div", null, toDisplayString(unref(leftLabel)), 1)
3979
+ ], 2), createVNode(MonthTable, {
3980
+ "selection-mode": "range",
3981
+ date: leftDate.value,
3982
+ "min-date": unref(minDate),
3983
+ "max-date": unref(maxDate),
3984
+ "range-state": unref(rangeState),
3985
+ "disabled-date": unref(disabledDate$1),
3986
+ onChangerange: unref(handleChangeRange),
3987
+ onPick: handleRangePick,
3988
+ onSelect: unref(onSelect)
3989
+ }, null, 8, [
3990
+ "date",
3991
+ "min-date",
3992
+ "max-date",
3993
+ "range-state",
3994
+ "disabled-date",
3995
+ "onChangerange",
3996
+ "onSelect"
3997
+ ])], 2), createBaseVNode("div", { class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"]) }, [createBaseVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
3998
+ _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
3999
+ key: 0,
4000
+ type: "button",
4001
+ disabled: !unref(enableYearArrow),
4002
+ class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
4003
+ onClick: _cache[2] || (_cache[2] = (...args) => unref(rightPrevYear) && unref(rightPrevYear)(...args))
4004
+ }, [createVNode(unref(ElIcon), null, {
4005
+ default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
4006
+ _: 1
4007
+ })], 10, _hoisted_3)) : createCommentVNode("v-if", true),
4008
+ createBaseVNode("button", {
4009
+ type: "button",
4010
+ class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
4011
+ onClick: _cache[3] || (_cache[3] = (...args) => unref(rightNextYear) && unref(rightNextYear)(...args))
4012
+ }, [createVNode(unref(ElIcon), null, {
4013
+ default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
4014
+ _: 1
4015
+ })], 2),
4016
+ createBaseVNode("div", null, toDisplayString(unref(rightLabel)), 1)
4017
+ ], 2), createVNode(MonthTable, {
4018
+ "selection-mode": "range",
4019
+ date: rightDate.value,
4020
+ "min-date": unref(minDate),
4021
+ "max-date": unref(maxDate),
4022
+ "range-state": unref(rangeState),
4023
+ "disabled-date": unref(disabledDate$1),
4024
+ onChangerange: unref(handleChangeRange),
4025
+ onPick: handleRangePick,
4026
+ onSelect: unref(onSelect)
4027
+ }, null, 8, [
4028
+ "date",
4029
+ "min-date",
4030
+ "max-date",
4031
+ "range-state",
4032
+ "disabled-date",
4033
+ "onChangerange",
4034
+ "onSelect"
4035
+ ])], 2)], 2)
4036
+ ], 2)], 2);
4037
+ };
4038
+ }
4039
+ }), [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/panel-month-range.vue"]]);
4040
+ var getPanel = function(type) {
4041
+ switch (type) {
4042
+ case "daterange":
4043
+ case "datetimerange": return DateRangePickPanel;
4044
+ case "monthrange": return MonthRangePickPanel;
4045
+ default: return DatePickPanel;
4046
+ }
4047
+ };
4048
+ var import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min(), 1);
4049
+ var import_customParseFormat = /* @__PURE__ */ __toESM(require_customParseFormat(), 1);
4050
+ var import_advancedFormat = /* @__PURE__ */ __toESM(require_advancedFormat(), 1);
4051
+ var import_localeData = /* @__PURE__ */ __toESM(require_localeData(), 1);
4052
+ var import_weekOfYear = /* @__PURE__ */ __toESM(require_weekOfYear(), 1);
4053
+ var import_weekYear = /* @__PURE__ */ __toESM(require_weekYear(), 1);
4054
+ var import_dayOfYear = /* @__PURE__ */ __toESM(require_dayOfYear(), 1);
4055
+ var import_isSameOrAfter = /* @__PURE__ */ __toESM(require_isSameOrAfter(), 1);
4056
+ var import_isSameOrBefore = /* @__PURE__ */ __toESM(require_isSameOrBefore(), 1);
4057
+ import_dayjs_min.default.extend(import_localeData.default);
4058
+ import_dayjs_min.default.extend(import_advancedFormat.default);
4059
+ import_dayjs_min.default.extend(import_customParseFormat.default);
4060
+ import_dayjs_min.default.extend(import_weekOfYear.default);
4061
+ import_dayjs_min.default.extend(import_weekYear.default);
4062
+ import_dayjs_min.default.extend(import_dayOfYear.default);
4063
+ import_dayjs_min.default.extend(import_isSameOrAfter.default);
4064
+ import_dayjs_min.default.extend(import_isSameOrBefore.default);
4065
+ var _DatePicker = defineComponent({
4066
+ name: "ElDatePicker",
4067
+ install: null,
4068
+ props: datePickerProps,
4069
+ emits: ["update:modelValue"],
4070
+ setup(props, { expose, emit, slots }) {
4071
+ const ns = useNamespace("picker-panel");
4072
+ provide("ElPopperOptions", reactive(toRef(props, "popperOptions")));
4073
+ provide(ROOT_PICKER_INJECTION_KEY, {
4074
+ slots,
4075
+ pickerNs: ns
4076
+ });
4077
+ const commonPicker = ref();
4078
+ expose({
4079
+ focus: (focusStartInput = true) => {
4080
+ var _a;
4081
+ (_a = commonPicker.value) == null || _a.focus(focusStartInput);
4082
+ },
4083
+ handleOpen: () => {
4084
+ var _a;
4085
+ (_a = commonPicker.value) == null || _a.handleOpen();
4086
+ },
4087
+ handleClose: () => {
4088
+ var _a;
4089
+ (_a = commonPicker.value) == null || _a.handleClose();
4090
+ }
4091
+ });
4092
+ const onModelValueUpdated = (val) => {
4093
+ emit("update:modelValue", val);
4094
+ };
4095
+ return () => {
4096
+ var _a;
4097
+ const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || "YYYY-MM-DD";
4098
+ const Component = getPanel(props.type);
4099
+ return createVNode(CommonPicker, mergeProps(props, {
4100
+ "format": format,
4101
+ "type": props.type,
4102
+ "ref": commonPicker,
4103
+ "onUpdate:modelValue": onModelValueUpdated
4104
+ }), {
4105
+ default: (scopedProps) => createVNode(Component, scopedProps, null),
4106
+ "range-separator": slots["range-separator"]
4107
+ });
4108
+ };
4109
+ }
4110
+ });
4111
+ _DatePicker.install = (app) => {
4112
+ app.component(_DatePicker.name, _DatePicker);
4113
+ };
4114
+ var ElDatePicker = _DatePicker;
4115
+ export { ElDatePicker as t };