@orbe-agro/client-core 5.3.8 → 5.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@ecme/assets/styles/app.css +1 -1
- package/dist/@ecme/assets/styles/components/_input.css +1 -1
- package/dist/@ecme/assets/styles/components/_select.css +1 -1
- package/dist/@ecme/assets/styles/components/_tabs.css +1 -1
- package/dist/@ecme/assets/styles/components/index.css +1 -1
- package/dist/@ecme/assets/styles/tailwind/index.css +1 -1
- package/dist/@ecme/auth/AuthContext.js.map +1 -1
- package/dist/@ecme/auth/AuthProvider.js.map +1 -1
- package/dist/@ecme/components/docs/DemoCard/CardFooter.js.map +1 -1
- package/dist/@ecme/components/docs/DemoCard/DemoCard.js.map +1 -1
- package/dist/@ecme/components/docs/DocumentationNav.js.map +1 -1
- package/dist/@ecme/components/layouts/AuthLayout/AuthLayout.js.map +1 -1
- package/dist/@ecme/components/layouts/PostLoginLayout/PostLoginLayout.js.map +1 -1
- package/dist/@ecme/components/route/AppRoute.js.map +1 -1
- package/dist/@ecme/components/shared/AbbreviateNumber.js.map +1 -1
- package/dist/@ecme/components/shared/Affix.js.map +1 -1
- package/dist/@ecme/components/shared/AutoComplete.js.map +1 -1
- package/dist/@ecme/components/shared/CalendarView.js.map +1 -1
- package/dist/@ecme/components/shared/Chart.js.map +1 -1
- package/dist/@ecme/components/shared/ConfirmDialog.js.map +1 -1
- package/dist/@ecme/components/shared/DataTable.js.map +1 -1
- package/dist/@ecme/components/shared/DebounceInput.js.map +1 -1
- package/dist/@ecme/components/shared/GanttChart/TaskListTable.js.map +1 -1
- package/dist/@ecme/components/shared/GanttChart/getStartEndDateForProject.js.map +1 -1
- package/dist/@ecme/components/shared/GanttChart/tasksPreProcess.js.map +1 -1
- package/dist/@ecme/components/shared/Masonry/breakpoints.js.map +1 -1
- package/dist/@ecme/components/shared/Masonry/useCoulmnsCount.js.map +1 -1
- package/dist/@ecme/components/shared/Masonry/useMasonry.js.map +1 -1
- package/dist/@ecme/components/shared/Masonry/useWindowWidth.js.map +1 -1
- package/dist/@ecme/components/shared/OtpInput.js.map +1 -1
- package/dist/@ecme/components/shared/PasswordInput.js.map +1 -1
- package/dist/@ecme/components/shared/RegionMap.js.map +1 -1
- package/dist/@ecme/components/shared/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/@ecme/components/shared/StickyFooter.js.map +1 -1
- package/dist/@ecme/components/shared/StrictModeDroppable.js.map +1 -1
- package/dist/@ecme/components/shared/ToggleDrawer.js.map +1 -1
- package/dist/@ecme/components/shared/UsersAvatarGroup.js.map +1 -1
- package/dist/@ecme/components/template/HorizontalMenuContent/HorizontalMenuDropdown.js.map +1 -1
- package/dist/@ecme/components/template/HorizontalMenuContent/HorizontalMenuDropdownContent.js.map +1 -1
- package/dist/@ecme/components/template/HorizontalMenuContent/HorizontalMenuDropdownTrigger.js.map +1 -1
- package/dist/@ecme/components/template/LanguageSelector.js.map +1 -1
- package/dist/@ecme/components/template/MobileNav.js.map +1 -1
- package/dist/@ecme/components/template/Notification/Notification.js.map +1 -1
- package/dist/@ecme/components/template/Search.js.map +1 -1
- package/dist/@ecme/components/template/SideNavToggle.js.map +1 -1
- package/dist/@ecme/components/template/SidePanel/SidePanel.js.map +1 -1
- package/dist/@ecme/components/template/StackedSideNav/StackedSideNav.js.map +1 -1
- package/dist/@ecme/components/template/StackedSideNav/StackedSideNavMini.js.map +1 -1
- package/dist/@ecme/components/template/StackedSideNav/StackedSideNavSecondary.js.map +1 -1
- package/dist/@ecme/components/template/ThemeConfigurator/CopyButton.js.map +1 -1
- package/dist/@ecme/components/template/ThemeConfigurator/DirectionSwitcher.js.map +1 -1
- package/dist/@ecme/components/template/ThemeConfigurator/LayoutSwitcher.js.map +1 -1
- package/dist/@ecme/components/template/ThemeConfigurator/ModeSwitcher.js.map +1 -1
- package/dist/@ecme/components/template/UserProfileDropdown.js.map +1 -1
- package/dist/@ecme/components/template/VerticalMenuContent/VerticalMenuContent.js.map +1 -1
- package/dist/@ecme/components/ui/Alert/Alert.js.map +1 -1
- package/dist/@ecme/components/ui/Avatar/Avatar.js.map +1 -1
- package/dist/@ecme/components/ui/Avatar/AvatarGroup.js.map +1 -1
- package/dist/@ecme/components/ui/Button/Button.js.map +1 -1
- package/dist/@ecme/components/ui/Card/Card.js.map +1 -1
- package/dist/@ecme/components/ui/Checkbox/Checkbox.js.map +1 -1
- package/dist/@ecme/components/ui/Checkbox/Group.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/BasePicker.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/Calendar.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/CalendarBase.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/DatePicker.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/DatePickerRange.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/DateTimepicker.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/RangeCalendar.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/tables/DateTable.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/tables/MonthTable.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/tables/YearTable.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/tables/components/Month.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/utils/getDecadeRange.js.map +1 -1
- package/dist/@ecme/components/ui/DatePicker/utils/getMonthDays.js.map +1 -1
- package/dist/@ecme/components/ui/Dialog/Dialog.js.map +1 -1
- package/dist/@ecme/components/ui/Drawer/Drawer.js.map +1 -1
- package/dist/@ecme/components/ui/Dropdown/DropdownItem.js.map +1 -1
- package/dist/@ecme/components/ui/Dropdown/DropdownMenu.js.map +1 -1
- package/dist/@ecme/components/ui/Dropdown/context/menuContext.js.map +1 -1
- package/dist/@ecme/components/ui/Form/FormItem.js.map +1 -1
- package/dist/@ecme/components/ui/Input/Input.js.map +1 -1
- package/dist/@ecme/components/ui/Menu/MenuCollapse.js.map +1 -1
- package/dist/@ecme/components/ui/MenuItem/index.js.map +1 -1
- package/dist/@ecme/components/ui/Notification/Notification.js.map +1 -1
- package/dist/@ecme/components/ui/Pagination/Next.js.map +1 -1
- package/dist/@ecme/components/ui/Pagination/Pagers.js.map +1 -1
- package/dist/@ecme/components/ui/Pagination/Pagination.js.map +1 -1
- package/dist/@ecme/components/ui/Pagination/Prev.js.map +1 -1
- package/dist/@ecme/components/ui/Progress/Circle.js.map +1 -1
- package/dist/@ecme/components/ui/Progress/Progress.js.map +1 -1
- package/dist/@ecme/components/ui/Radio/Group.js.map +1 -1
- package/dist/@ecme/components/ui/Radio/Radio.js.map +1 -1
- package/dist/@ecme/components/ui/Segment/Segment.js.map +1 -1
- package/dist/@ecme/components/ui/Segment/SegmentItem.js.map +1 -1
- package/dist/@ecme/components/ui/Select/Select.js.map +1 -1
- package/dist/@ecme/components/ui/Steps/StepItem.js.map +1 -1
- package/dist/@ecme/components/ui/Steps/Steps.js.map +1 -1
- package/dist/@ecme/components/ui/Switcher/Switcher.js.map +1 -1
- package/dist/@ecme/components/ui/Tabs/TabNav.js.map +1 -1
- package/dist/@ecme/components/ui/TimeInput/AmPmInput.js.map +1 -1
- package/dist/@ecme/components/ui/TimeInput/TimeInput.js.map +1 -1
- package/dist/@ecme/components/ui/TimeInput/TimeInputField.js.map +1 -1
- package/dist/@ecme/components/ui/TimeInput/TimeInputRange.js.map +1 -1
- package/dist/@ecme/components/ui/TimeInput/utils/createAmPmHandler.js.map +1 -1
- package/dist/@ecme/components/ui/TimeInput/utils/createTimeHandler.js.map +1 -1
- package/dist/@ecme/components/ui/Tooltip/Arrow.js.map +1 -1
- package/dist/@ecme/components/ui/Tooltip/Tooltip.js.map +1 -1
- package/dist/@ecme/components/ui/Upload/Upload.js.map +1 -1
- package/dist/@ecme/components/ui/hooks/useCallbackRef.js.map +1 -1
- package/dist/@ecme/components/ui/hooks/useControllableState.js.map +1 -1
- package/dist/@ecme/components/ui/hooks/useDidUpdate.js.map +1 -1
- package/dist/@ecme/components/ui/hooks/useMergeRef.js.map +1 -1
- package/dist/@ecme/components/ui/hooks/useRootClose.js.map +1 -1
- package/dist/@ecme/components/ui/hooks/useTimeout.js.map +1 -1
- package/dist/@ecme/components/ui/hooks/useWindowSize.js.map +1 -1
- package/dist/@ecme/components/ui/toast/ToastWrapper.js.map +1 -1
- package/dist/@ecme/components/ui/toast/toast.js.map +1 -1
- package/dist/@ecme/components/ui/utils/chainedFunction.js.map +1 -1
- package/dist/@ecme/components/ui/utils/mapCloneElement.js.map +1 -1
- package/dist/@ecme/components/view/Activity/ActivityAvatar.js.map +1 -1
- package/dist/@ecme/components/view/Activity/ActivityEvent.js.map +1 -1
- package/dist/@ecme/components/view/ChatBox/components/Attachment.js.map +1 -1
- package/dist/@ecme/components/view/ChatBox/components/ChatInput.js.map +1 -1
- package/dist/@ecme/components/view/CreditCardDialog/CreditCardDialog.js.map +1 -1
- package/dist/@ecme/configs/chart.config.js.map +1 -1
- package/dist/@ecme/constants/theme.constant.js +23 -23
- package/dist/@ecme/constants/theme.constant.js.map +1 -1
- package/dist/@ecme/mock/fakeApi/accountsFakeApi.js.map +1 -1
- package/dist/@ecme/mock/fakeApi/aiFakeApi.js.map +1 -1
- package/dist/@ecme/mock/fakeApi/authFakeApi.js.map +1 -1
- package/dist/@ecme/mock/fakeApi/commonFakeApi.js.map +1 -1
- package/dist/@ecme/mock/fakeApi/customersFakeApi.js.map +1 -1
- package/dist/@ecme/mock/fakeApi/fileFakeApi.js.map +1 -1
- package/dist/@ecme/mock/fakeApi/helpCenterFakeApi.js.map +1 -1
- package/dist/@ecme/mock/fakeApi/ordersFakeApi.js.map +1 -1
- package/dist/@ecme/mock/fakeApi/productsFakeApi.js.map +1 -1
- package/dist/@ecme/services/ApiService.js.map +1 -1
- package/dist/@ecme/services/axios/AxiosRequestIntrceptorConfigCallback.js.map +1 -1
- package/dist/@ecme/store/authStore.js.map +1 -1
- package/dist/@ecme/store/localeStore.js.map +1 -1
- package/dist/@ecme/utils/cookiesStorage.js.map +1 -1
- package/dist/@ecme/utils/hoc/withHeaderItem.js.map +1 -1
- package/dist/@ecme/utils/hooks/useDarkMode.js.map +1 -1
- package/dist/@ecme/utils/hooks/useDirection.js.map +1 -1
- package/dist/@ecme/utils/hooks/useInfiniteScroll.js.map +1 -1
- package/dist/@ecme/utils/hooks/useInterval .js.map +1 -1
- package/dist/@ecme/utils/hooks/useLayoutGap.js.map +1 -1
- package/dist/@ecme/utils/hooks/useLocale.js.map +1 -1
- package/dist/@ecme/utils/hooks/useMenuActive.js.map +1 -1
- package/dist/@ecme/utils/hooks/useRandomBgColor.js.map +1 -1
- package/dist/@ecme/utils/hooks/useResponsive.js.map +1 -1
- package/dist/@ecme/utils/hooks/useScrollTop.js.map +1 -1
- package/dist/@ecme/utils/hooks/useThemeSchema.js.map +1 -1
- package/dist/@ecme/utils/hooks/useTimeOutMessage.js.map +1 -1
- package/dist/@ecme/utils/reorderDragable.js.map +1 -1
- package/dist/@ecme/utils/sortBy.js.map +1 -1
- package/dist/@ecme/utils/wildCardSearch.js.map +1 -1
- package/dist/@ecme/views/auth/ForgotPassword/ForgotPassword.js.map +1 -1
- package/dist/@ecme/views/auth/ForgotPassword/components/ForgotPasswordForm.js.map +1 -1
- package/dist/@ecme/views/auth/OtpVerification/OtpVerification.js.map +1 -1
- package/dist/@ecme/views/auth/OtpVerification/components/OtpVerificationForm.js.map +1 -1
- package/dist/@ecme/views/auth/ResetPassword/ResetPassword.js.map +1 -1
- package/dist/@ecme/views/auth/ResetPassword/components/ResetPasswordForm.js.map +1 -1
- package/dist/@ecme/views/auth/SignIn/components/OauthSignIn.js.map +1 -1
- package/dist/@ecme/views/auth/SignIn/components/SignInForm.js.map +1 -1
- package/dist/@ecme/views/auth/SignUp/components/SignUpForm.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/ActivityLog/ActivityLog.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Pricing/components/PaymentDialog.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Pricing/components/Plans.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/RolesPermissions/components/RolesPermissionsAccessDialog.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/RolesPermissions/components/RolesPermissionsGroups.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/RolesPermissions/components/RolesPermissionsUserAction.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/RolesPermissions/components/RolesPermissionsUserSelected.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/RolesPermissions/components/RolesPermissionsUserTable.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/RolesPermissions/store/rolePermissionsStore.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Settings/components/BillingHistory.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Settings/components/SettingIntegration.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Settings/components/SettingMobileMenu.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Settings/components/SettingsBilling.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Settings/components/SettingsMenu.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Settings/components/SettingsNotification.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Settings/components/SettingsProfile.js.map +1 -1
- package/dist/@ecme/views/concepts/accounts/Settings/components/SettingsSecurity.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatCustomAction.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatCustomContent.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatHistory.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatHistoryItem.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatHistoryRenameDialog.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatSideNav.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/components/ChatView.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/hooks/useChatSend.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Chat/store/generativeChatStore.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Image/components/Gallery.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Image/components/GeneratorPrompt.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Image/components/ImageDialog.js.map +1 -1
- package/dist/@ecme/views/concepts/ai/Image/store/imageGeneratorStore.js.map +1 -1
- package/dist/@ecme/views/concepts/calendar/Calendar/Calendar.js.map +1 -1
- package/dist/@ecme/views/concepts/calendar/Calendar/components/EventDialog.js.map +1 -1
- package/dist/@ecme/views/concepts/chat/Chat/components/ChatAction.js.map +1 -1
- package/dist/@ecme/views/concepts/chat/Chat/components/ChatBody.js.map +1 -1
- package/dist/@ecme/views/concepts/chat/Chat/components/ChatList.js.map +1 -1
- package/dist/@ecme/views/concepts/chat/Chat/components/ContactInfoDrawer.js.map +1 -1
- package/dist/@ecme/views/concepts/chat/Chat/components/NewChat.js.map +1 -1
- package/dist/@ecme/views/concepts/chat/Chat/hooks/useChat.js.map +1 -1
- package/dist/@ecme/views/concepts/chat/Chat/store/chatStore.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerCreate/CustomerCreate.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerDetails/ActivitySection.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerDetails/BillingSection.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerDetails/ProfileSection.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerEdit/CustomerEdit.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerForm/AccountSection.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerForm/CustomerForm.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerForm/OverviewSection.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerForm/ProfileImageSection.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerList/components/CustomerListSelected.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerList/components/CustomerListTable.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerList/components/CustomerListTableFilter.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerList/components/CustomersListTableTools.js.map +1 -1
- package/dist/@ecme/views/concepts/customers/CustomerList/store/customerListStore.js.map +1 -1
- package/dist/@ecme/views/concepts/files/FileManager/FileManager.js.map +1 -1
- package/dist/@ecme/views/concepts/files/FileManager/components/FileDetails.js.map +1 -1
- package/dist/@ecme/views/concepts/files/FileManager/components/FileItemDropdown.js.map +1 -1
- package/dist/@ecme/views/concepts/files/FileManager/components/FileManagerDeleteDialog.js.map +1 -1
- package/dist/@ecme/views/concepts/files/FileManager/components/FileManagerHeader.js.map +1 -1
- package/dist/@ecme/views/concepts/files/FileManager/components/FileManagerInviteDialog.js.map +1 -1
- package/dist/@ecme/views/concepts/files/FileManager/components/FileManagerRenameDialog.js.map +1 -1
- package/dist/@ecme/views/concepts/files/FileManager/components/UploadFile.js.map +1 -1
- package/dist/@ecme/views/concepts/files/FileManager/store/useFileManagerStore.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/Article/components/ArticleAction.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/EditArticle/components/EditArticleFooter.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/EditArticle/components/EditArticleHeader.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/ManageArticle/components/ArticleListSearch.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/ManageArticle/components/ArticleListSelected.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/ManageArticle/components/ArticleListTable.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/ManageArticle/components/ArticleTableFilter.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/ManageArticle/store/manageArticleStore.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/SupportHub/components/Article.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/SupportHub/components/ArticleList.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/SupportHub/components/Categories.js.map +1 -1
- package/dist/@ecme/views/concepts/help-center/SupportHub/components/TopSection.js.map +1 -1
- package/dist/@ecme/views/concepts/mail/Mail/components/MailBody.js.map +1 -1
- package/dist/@ecme/views/concepts/mail/Mail/components/MailBodyTop.js.map +1 -1
- package/dist/@ecme/views/concepts/mail/Mail/components/MailDetailAction.js.map +1 -1
- package/dist/@ecme/views/concepts/mail/Mail/components/MailDetailTitle.js.map +1 -1
- package/dist/@ecme/views/concepts/mail/Mail/components/MailEditor.js.map +1 -1
- package/dist/@ecme/views/concepts/mail/Mail/components/MailList.js.map +1 -1
- package/dist/@ecme/views/concepts/mail/Mail/components/MailSidebar.js.map +1 -1
- package/dist/@ecme/views/concepts/mail/Mail/hooks/useMail.js.map +1 -1
- package/dist/@ecme/views/concepts/mail/Mail/hooks/useMailAction.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderCreate/OrderCreate.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderDetails/components/OrderDetailHeaderExtra.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderEdit/OrderEdit.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderForm/OrderForm.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderForm/components/CustomerDetailSection.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderForm/components/PaymentMethodSection.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderForm/components/ProductSelectSection.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderList/components/OrderListTable.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderList/components/OrderListTableFilter.js.map +1 -1
- package/dist/@ecme/views/concepts/orders/OrderList/components/OrderListTableTools.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductCreate/ProductCreate.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductEdit/ProducEdit.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductForm/ProductForm.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductForm/components/GeneralSection.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductForm/components/ImageSection.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductForm/components/PricingSection.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductList/components/ProducListTableTools.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductList/components/ProductListSearch.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductList/components/ProductListSelected.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductList/components/ProductListTable.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductList/components/ProductTableFilter.js.map +1 -1
- package/dist/@ecme/views/concepts/products/ProductList/store/productListStore.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/Issue/Issue.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/Issue/components/IssueBody.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/Issue/components/IssueFooter.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/Issue/components/IssueHeader.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectDetails/ProjectDetails.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectDetails/components/ProjectDetailsActivity.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectDetails/components/ProjectDetailsHeader.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectDetails/components/ProjectDetailsNavigation.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectDetails/components/ProjectDetailsSetting.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectDetails/components/ProjectDetailsTask.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectList/components/NewProjectForm.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectList/components/NewTaskField.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectList/components/ProjectListContent.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectList/components/ProjectListHeader.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectList/hooks/useProjectList.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ProjectList/store/projectListStore.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ScrumBoard/components/AddNewColumnContent.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ScrumBoard/components/AddNewMemberContent.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ScrumBoard/components/AddNewTicketContent.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ScrumBoard/components/Board.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ScrumBoard/components/BoardCard.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ScrumBoard/components/BoardTitle.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ScrumBoard/components/ScrumBoardHeader.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/ScrumBoard/components/TicketContent.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/Tasks/Tasks.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/Tasks/components/AddTask.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/Tasks/components/TaskList.js.map +1 -1
- package/dist/@ecme/views/concepts/projects/Tasks/components/TasksHeader.js.map +1 -1
- package/dist/@ecme/views/dashboards/AnalyticDashboard/components/AnalyticChart.js.map +1 -1
- package/dist/@ecme/views/dashboards/AnalyticDashboard/components/AnalyticHeader.js.map +1 -1
- package/dist/@ecme/views/dashboards/AnalyticDashboard/components/DeviceSession.js.map +1 -1
- package/dist/@ecme/views/dashboards/AnalyticDashboard/components/Traffic.js.map +1 -1
- package/dist/@ecme/views/dashboards/EcommerceDashboard/components/Overview.js.map +1 -1
- package/dist/@ecme/views/dashboards/EcommerceDashboard/components/RecentOrder.js.map +1 -1
- package/dist/@ecme/views/dashboards/EcommerceDashboard/components/RevenueByChannel.js.map +1 -1
- package/dist/@ecme/views/dashboards/EcommerceDashboard/components/SalesTarget.js.map +1 -1
- package/dist/@ecme/views/dashboards/EcommerceDashboard/components/TopProduct.js.map +1 -1
- package/dist/@ecme/views/dashboards/MarketingDashboard/components/AdsPerformance.js.map +1 -1
- package/dist/@ecme/views/dashboards/MarketingDashboard/components/CreateCampaign.js.map +1 -1
- package/dist/@ecme/views/dashboards/MarketingDashboard/components/LeadPerformance.js.map +1 -1
- package/dist/@ecme/views/dashboards/MarketingDashboard/components/RecentCampaign.js.map +1 -1
- package/dist/@ecme/views/dashboards/ProjectDashboard/components/CreateEventDialog.js.map +1 -1
- package/dist/@ecme/views/dashboards/ProjectDashboard/components/CurrentTasks.js.map +1 -1
- package/dist/@ecme/views/dashboards/ProjectDashboard/components/Schedule.js.map +1 -1
- package/dist/@ecme/views/dashboards/ProjectDashboard/components/UpcomingSchedule.js.map +1 -1
- package/dist/@ecme/views/guide/Documentations/components/Layouts.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/CalendarViewDoc/Example.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/ConfirmDialogDoc/Example.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/CustomFormatInputDoc/Simple.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/CustomFormatInputDoc/WithForm.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/DataTableDoc/Basic.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/DataTableDoc/Checkable.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/DataTableDoc/Query.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/DebounceInputDoc/Example.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/GanttChartDoc/Example.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/MasonryDoc/Basic.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/MasonryDoc/Responsive.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/NumericInputDoc/Basic.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/NumericInputDoc/WithForm.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/OtpInputDoc/Basic.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/OtpInputDoc/Length.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/PasswordInputDoc/Example.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/PatternInputDoc/Basic.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/PatternInputDoc/WithForm.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/PresetSegmentItemOptionDoc/Example.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/RichTextEditorDoc/CustomConfig.js.map +1 -1
- package/dist/@ecme/views/guide/SharedComponentsDoc/components/RichTextEditorDoc/WithForm.js.map +1 -1
- package/dist/@ecme/views/ui-components/common/Button/ButtonWithIcon.js.map +1 -1
- package/dist/@ecme/views/ui-components/common/Button/Loading.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Calendar/CustomRender.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/DragAndDrop.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/Editable.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/Expanding.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/Filtering.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/Group.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/PaginationTable.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/Resizable.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/RowSelection.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/Sorting.js.map +1 -1
- package/dist/@ecme/views/ui-components/data-display/Table/SubComponent.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Alert/Closable.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Dialog/Basic.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Dialog/Closable.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Dialog/CloseWithEscBackdrop.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Dialog/CustomStyle.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Dialog/InternalScroll.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Dialog/Size.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Dialog/StaticBackdrop.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Drawer/Basic.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Drawer/Closable.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Drawer/CustomStyle.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Drawer/Footer.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Drawer/Placement.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Drawer/WidthHeight.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Progress/Dynamic.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Toast/AlertToast.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Toast/Closable.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Toast/CustomClose.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Toast/CustomIcon.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Toast/Duration.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Toast/Notification.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Toast/NotificationType.js.map +1 -1
- package/dist/@ecme/views/ui-components/feedback/Toast/Placement.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Checkbox/Default.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Checkbox/Group.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/DatePicker/Controlled.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/DatePicker/CustomRender.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/DatePicker/DisabledCertainDate.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/FormControl/AsyncValidation.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/FormControl/Basic.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/FormControl/DependentValidation.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/FormControl/DynamicForm.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/FormControl/FieldValidation.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/FormControl/Layout.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/FormControl/MixedFormControl.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/FormControl/SchemaValidation.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/FormControl/Sizes.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Input/PasswordVisible.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Radio/Group.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Radio/Vertical.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Segment/Controlled.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Segment/Size.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Select/AsyncOnSearch.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Select/Creatable.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Select/LoadOptionOnExpand.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Switcher/Basic.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Switcher/Controlled.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Switcher/Loading.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Upload/AvatarImage.js.map +1 -1
- package/dist/@ecme/views/ui-components/forms/Upload/BeforeUpload.js.map +1 -1
- package/dist/@ecme/views/ui-components/graph/Charts/DashedLine.js.map +1 -1
- package/dist/@ecme/views/ui-components/graph/Maps/ChoroplethQuantile.js.map +1 -1
- package/dist/@ecme/views/ui-components/graph/Maps/ChoroplethQuantize.js.map +1 -1
- package/dist/@ecme/views/ui-components/graph/Maps/MapChartWithTooltip.js.map +1 -1
- package/dist/@ecme/views/ui-components/graph/Maps/UsaStatesMapWithLabels.js.map +1 -1
- package/dist/@ecme/views/ui-components/navigation/Dropdown/Default.js.map +1 -1
- package/dist/@ecme/views/ui-components/navigation/Menu/CollapsableMenuItem.js.map +1 -1
- package/dist/@ecme/views/ui-components/navigation/Menu/Simple.js.map +1 -1
- package/dist/@ecme/views/ui-components/navigation/Pagination/Basic.js.map +1 -1
- package/dist/@ecme/views/ui-components/navigation/Pagination/Controlled.js.map +1 -1
- package/dist/@ecme/views/ui-components/navigation/Pagination/PageSize.js.map +1 -1
- package/dist/@ecme/views/ui-components/navigation/Steps/Clickable.js.map +1 -1
- package/dist/@ecme/views/ui-components/navigation/Steps/Controlled.js.map +1 -1
- package/dist/@types/@ecme/configs/chart.config.d.ts +2 -0
- package/dist/@types/@ecme/configs/chart.config.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/Ticket/ticket.endpoint.config.d.ts +1 -0
- package/dist/@types/base/configs/endpoints.config/Ticket/ticket.endpoint.config.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/centralNfe/centralNfe.d.ts +18 -0
- package/dist/@types/base/configs/endpoints.config/centralNfe/centralNfe.d.ts.map +1 -1
- package/dist/@types/base/configs/endpoints.config/centralNfe/config/vinculoUnidadeMedida.d.ts +20 -0
- package/dist/@types/base/configs/endpoints.config/centralNfe/config/vinculoUnidadeMedida.d.ts.map +1 -0
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts +18 -0
- package/dist/@types/base/configs/endpoints.config/endpoints.navigation.d.ts.map +1 -1
- package/dist/@types/base/configs/navigation.config/modules.submenu/centralNfe/submenu.centralNfe.d.ts.map +1 -1
- package/dist/@types/base/services/modules/Ticket/TicketService.d.ts +1 -0
- package/dist/@types/base/services/modules/Ticket/TicketService.d.ts.map +1 -1
- package/dist/@types/base/services/modules/centralNfe/index.d.ts +2 -0
- package/dist/@types/base/services/modules/centralNfe/index.d.ts.map +1 -1
- package/dist/@types/base/services/modules/centralNfe/vinculoUnidadeMedida/VinculoUnidadeMedidaService.d.ts +5 -0
- package/dist/@types/base/services/modules/centralNfe/vinculoUnidadeMedida/VinculoUnidadeMedidaService.d.ts.map +1 -0
- package/dist/@types/base/services/modules/modules.query.d.ts +4 -0
- package/dist/@types/base/services/modules/modules.query.d.ts.map +1 -1
- package/dist/base/assets/styles/init.css +1 -1
- package/dist/base/components/forms/GenericForms/GenericUploadFormSection.js.map +1 -1
- package/dist/base/components/forms/NumberFormVariant/GenericNumberFormSectionPercentage.js.map +1 -1
- package/dist/base/components/shared/AceitarProcessoDialog.js.map +1 -1
- package/dist/base/components/shared/AdicionarHistoricoDialog.js.map +1 -1
- package/dist/base/components/shared/CancelarProcessoDialog.js.map +1 -1
- package/dist/base/components/shared/ConcluirProcessoDialog.js.map +1 -1
- package/dist/base/components/shared/ReabrirProcessoDialog.js.map +1 -1
- package/dist/base/components/shared/RetornarFluxAtendimentoDialog.js.map +1 -1
- package/dist/base/components/shared/TransferirParaAtendenteDialog.js.map +1 -1
- package/dist/base/components/shared/TransferirParaSolicitanteDialog.js.map +1 -1
- package/dist/base/components/shared/TransferirProcessoDialog.js.map +1 -1
- package/dist/base/components/table/ListColumn.js.map +1 -1
- package/dist/base/components/tools/NavFilter.js.map +1 -1
- package/dist/base/configs/endpoints.config/Ticket/ticket.endpoint.config.js +1 -0
- package/dist/base/configs/endpoints.config/Ticket/ticket.endpoint.config.js.map +1 -1
- package/dist/base/configs/endpoints.config/centralNfe/centralNfe.js +5 -3
- package/dist/base/configs/endpoints.config/centralNfe/centralNfe.js.map +1 -1
- package/dist/base/configs/endpoints.config/centralNfe/config/vinculoUnidadeMedida.js +10 -0
- package/dist/base/configs/endpoints.config/centralNfe/config/vinculoUnidadeMedida.js.map +1 -0
- package/dist/base/configs/navigation.config/modules.submenu/centralNfe/submenu.centralNfe.js +10 -0
- package/dist/base/configs/navigation.config/modules.submenu/centralNfe/submenu.centralNfe.js.map +1 -1
- package/dist/base/hooks/flux/useAceitarProcesso.js.map +1 -1
- package/dist/base/hooks/flux/useAdicionarHistorico.js.map +1 -1
- package/dist/base/hooks/flux/useCancelarProcesso.js.map +1 -1
- package/dist/base/hooks/flux/useConcluirProcesso.js.map +1 -1
- package/dist/base/hooks/flux/useReabrirProcesso.js.map +1 -1
- package/dist/base/hooks/flux/useRetornarFluxoAtendimento.js.map +1 -1
- package/dist/base/hooks/flux/useTransferirParaAtendente.js.map +1 -1
- package/dist/base/hooks/flux/useTransferirParaSolicitante.js.map +1 -1
- package/dist/base/hooks/flux/useTransferirProcesso.js.map +1 -1
- package/dist/base/services/modules/Ticket/TicketService.js +17 -9
- package/dist/base/services/modules/Ticket/TicketService.js.map +1 -1
- package/dist/base/services/modules/centralNfe/index.js +13 -3
- package/dist/base/services/modules/centralNfe/index.js.map +1 -1
- package/dist/base/services/modules/centralNfe/vinculoUnidadeMedida/VinculoUnidadeMedidaService.js +37 -0
- package/dist/base/services/modules/centralNfe/vinculoUnidadeMedida/VinculoUnidadeMedidaService.js.map +1 -0
- package/dist/base/services/modules/modules.query.js +7 -6
- package/dist/base/services/modules/modules.query.js.map +1 -1
- package/dist/base/services/query.js.map +1 -1
- package/dist/base/utils/functions/formUtils.js.map +1 -1
- package/dist/base/utils/functions/handleInputChangeUtils.js.map +1 -1
- package/dist/base/utils/functions/stringUtils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePicker.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/BasePicker.tsx"],"sourcesContent":["import dayjs from 'dayjs'\nimport localizedFormat from 'dayjs/plugin/localizedFormat'\nimport { Input } from '../Input'\nimport useMergedRef from '../hooks/useMergeRef'\nimport { HiOutlineCalendar } from 'react-icons/hi'\nimport CloseButton from '../CloseButton'\nimport type { CommonProps, TypeAttributes } from '../@types/common'\nimport type {\n ReactNode,\n FocusEvent,\n HTMLInputTypeAttribute,\n KeyboardEvent,\n MouseEvent,\n ChangeEvent,\n Ref,\n} from 'react'\nimport {\n useFloating,\n useInteractions,\n useDismiss,\n useRole,\n useFocus,\n useClick,\n useId,\n autoUpdate,\n offset,\n flip,\n shift,\n} from '@floating-ui/react'\n\ndayjs.extend(localizedFormat)\n\nexport interface BasePickerSharedProps {\n clearable?: boolean\n clearButton?: string | ReactNode\n disabled?: boolean\n inputtable?: boolean\n inputPrefix?: string | ReactNode\n inputSuffix?: string | ReactNode\n name?: string\n onBlur?: (event: FocusEvent<HTMLInputElement, Element>) => void\n onDropdownOpen?: () => void\n onDropdownClose?: () => void\n onFocus?: (event: FocusEvent<HTMLInputElement, Element>) => void\n placeholder?: string\n size?: TypeAttributes.ControlSize\n type?: HTMLInputTypeAttribute\n}\n\ninterface BasePickerProps extends CommonProps, BasePickerSharedProps {\n dropdownOpened: boolean\n inputtableBlurClose?: boolean\n inputLabel?: string\n onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void\n onClear?: (event: MouseEvent<HTMLElement>) => void\n onChange?: (event: ChangeEvent<HTMLInputElement>) => void\n setDropdownOpened: (opened: boolean) => void\n ref?: Ref<HTMLInputElement>\n}\n\nconst BasePicker = (props: BasePickerProps) => {\n const {\n className,\n clearable = true,\n clearButton,\n children,\n disabled,\n dropdownOpened,\n inputtable,\n inputtableBlurClose = false,\n inputLabel,\n inputPrefix,\n inputSuffix = <HiOutlineCalendar className=\"text-lg\" />,\n name,\n onDropdownOpen,\n onDropdownClose,\n onBlur,\n onFocus,\n onChange,\n onKeyDown,\n onClear,\n placeholder,\n ref = null,\n setDropdownOpened,\n size,\n type,\n } = props\n\n const handleInputClick = () => {\n inputtable ? openDropdown() : toggleDropdown(!dropdownOpened)\n }\n\n const closeDropdown = () => {\n setDropdownOpened(false)\n onDropdownClose?.()\n }\n\n const suffixIconSlot = clearable ? (\n clearButton ? (\n <div role=\"presentation\" onClick={onClear}>\n {clearButton}\n </div>\n ) : (\n <CloseButton className=\"text-base\" onClick={onClear} />\n )\n ) : inputSuffix ? (\n <>{inputSuffix}</>\n ) : null\n\n const toggleDropdown = (open: boolean) => {\n setDropdownOpened(open)\n open ? onDropdownOpen?.() : onDropdownClose?.()\n }\n\n const openDropdown = () => {\n setDropdownOpened(true)\n onDropdownOpen?.()\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n typeof onKeyDown === 'function' && onKeyDown(event)\n if ((event.key === 'Space' || event.key === 'Enter') && !inputtable) {\n event.preventDefault()\n openDropdown()\n }\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement, Element>) => {\n onBlur?.(event)\n if (inputtable && inputtableBlurClose) {\n closeDropdown()\n }\n }\n\n const handleInputFocus = (event: FocusEvent<HTMLInputElement, Element>) => {\n onFocus?.(event)\n }\n\n const { refs, floatingStyles, context } = useFloating({\n open: dropdownOpened,\n onOpenChange: toggleDropdown,\n placement: 'bottom-start',\n middleware: [\n offset(10),\n flip({\n fallbackAxisSideDirection: 'start',\n }),\n shift(),\n ],\n whileElementsMounted: autoUpdate,\n })\n\n const focus = useFocus(context)\n const click = useClick(context)\n const dismiss = useDismiss(context)\n const role = useRole(context)\n\n const { getReferenceProps, getFloatingProps } = useInteractions([\n inputtable ? focus : click,\n dismiss,\n role,\n ])\n\n const headingId = useId()\n\n return (\n <>\n <Input\n ref={useMergedRef(ref, refs.setReference)}\n className={className}\n placeholder={placeholder}\n size={size}\n name={name}\n value={inputLabel}\n readOnly={!inputtable}\n suffix={suffixIconSlot}\n prefix={inputPrefix}\n autoComplete=\"off\"\n type={type}\n disabled={disabled}\n asElement={'input'}\n onKeyDown={handleKeyDown}\n onClick={handleInputClick}\n onChange={onChange}\n {...getReferenceProps({\n onBlur: handleInputBlur,\n onFocus: handleInputFocus,\n })}\n />\n {dropdownOpened && (\n <div\n ref={refs.setFloating}\n className=\"picker\"\n style={floatingStyles}\n aria-labelledby={headingId}\n {...getFloatingProps()}\n >\n <div className=\"picker-panel\">{children}</div>\n </div>\n )}\n </>\n )\n}\n\nexport default BasePicker\n"],"names":["dayjs","localizedFormat","BasePicker","props","className","clearable","clearButton","children","disabled","dropdownOpened","inputtable","inputtableBlurClose","inputLabel","inputPrefix","inputSuffix","jsx","HiOutlineCalendar","name","onDropdownOpen","onDropdownClose","onBlur","onFocus","onChange","onKeyDown","onClear","placeholder","ref","setDropdownOpened","size","type","handleInputClick","openDropdown","toggleDropdown","closeDropdown","suffixIconSlot","CloseButton","Fragment","open","handleKeyDown","event","handleInputBlur","handleInputFocus","refs","floatingStyles","context","useFloating","offset","flip","shift","autoUpdate","focus","useFocus","click","useClick","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","headingId","useId","jsxs","Input","useMergedRef"],"mappings":";;;;;;;;;;AA8BAA,EAAM,OAAOC,CAAe;AA8B5B,MAAMC,KAAa,CAACC,MAA2B;AAC3C,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC,IAAc,gBAAAC,EAACC,GAAA,EAAkB,WAAU,UAAA,CAAU;AAAA,IACrD,MAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,mBAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,EAAA,IACA1B,GAEE2B,IAAmB,MAAM;AAC3B,IAAApB,IAAaqB,EAAA,IAAiBC,EAAe,CAACvB,CAAc;AAAA,
|
|
1
|
+
{"version":3,"file":"BasePicker.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/BasePicker.tsx"],"sourcesContent":["import dayjs from 'dayjs'\nimport localizedFormat from 'dayjs/plugin/localizedFormat'\nimport { Input } from '../Input'\nimport useMergedRef from '../hooks/useMergeRef'\nimport { HiOutlineCalendar } from 'react-icons/hi'\nimport CloseButton from '../CloseButton'\nimport type { CommonProps, TypeAttributes } from '../@types/common'\nimport type {\n ReactNode,\n FocusEvent,\n HTMLInputTypeAttribute,\n KeyboardEvent,\n MouseEvent,\n ChangeEvent,\n Ref,\n} from 'react'\nimport {\n useFloating,\n useInteractions,\n useDismiss,\n useRole,\n useFocus,\n useClick,\n useId,\n autoUpdate,\n offset,\n flip,\n shift,\n} from '@floating-ui/react'\n\ndayjs.extend(localizedFormat)\n\nexport interface BasePickerSharedProps {\n clearable?: boolean\n clearButton?: string | ReactNode\n disabled?: boolean\n inputtable?: boolean\n inputPrefix?: string | ReactNode\n inputSuffix?: string | ReactNode\n name?: string\n onBlur?: (event: FocusEvent<HTMLInputElement, Element>) => void\n onDropdownOpen?: () => void\n onDropdownClose?: () => void\n onFocus?: (event: FocusEvent<HTMLInputElement, Element>) => void\n placeholder?: string\n size?: TypeAttributes.ControlSize\n type?: HTMLInputTypeAttribute\n}\n\ninterface BasePickerProps extends CommonProps, BasePickerSharedProps {\n dropdownOpened: boolean\n inputtableBlurClose?: boolean\n inputLabel?: string\n onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void\n onClear?: (event: MouseEvent<HTMLElement>) => void\n onChange?: (event: ChangeEvent<HTMLInputElement>) => void\n setDropdownOpened: (opened: boolean) => void\n ref?: Ref<HTMLInputElement>\n}\n\nconst BasePicker = (props: BasePickerProps) => {\n const {\n className,\n clearable = true,\n clearButton,\n children,\n disabled,\n dropdownOpened,\n inputtable,\n inputtableBlurClose = false,\n inputLabel,\n inputPrefix,\n inputSuffix = <HiOutlineCalendar className=\"text-lg\" />,\n name,\n onDropdownOpen,\n onDropdownClose,\n onBlur,\n onFocus,\n onChange,\n onKeyDown,\n onClear,\n placeholder,\n ref = null,\n setDropdownOpened,\n size,\n type,\n } = props\n\n const handleInputClick = () => {\n inputtable ? openDropdown() : toggleDropdown(!dropdownOpened)\n }\n\n const closeDropdown = () => {\n setDropdownOpened(false)\n onDropdownClose?.()\n }\n\n const suffixIconSlot = clearable ? (\n clearButton ? (\n <div role=\"presentation\" onClick={onClear}>\n {clearButton}\n </div>\n ) : (\n <CloseButton className=\"text-base\" onClick={onClear} />\n )\n ) : inputSuffix ? (\n <>{inputSuffix}</>\n ) : null\n\n const toggleDropdown = (open: boolean) => {\n setDropdownOpened(open)\n open ? onDropdownOpen?.() : onDropdownClose?.()\n }\n\n const openDropdown = () => {\n setDropdownOpened(true)\n onDropdownOpen?.()\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n typeof onKeyDown === 'function' && onKeyDown(event)\n if ((event.key === 'Space' || event.key === 'Enter') && !inputtable) {\n event.preventDefault()\n openDropdown()\n }\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement, Element>) => {\n onBlur?.(event)\n if (inputtable && inputtableBlurClose) {\n closeDropdown()\n }\n }\n\n const handleInputFocus = (event: FocusEvent<HTMLInputElement, Element>) => {\n onFocus?.(event)\n }\n\n const { refs, floatingStyles, context } = useFloating({\n open: dropdownOpened,\n onOpenChange: toggleDropdown,\n placement: 'bottom-start',\n middleware: [\n offset(10),\n flip({\n fallbackAxisSideDirection: 'start',\n }),\n shift(),\n ],\n whileElementsMounted: autoUpdate,\n })\n\n const focus = useFocus(context)\n const click = useClick(context)\n const dismiss = useDismiss(context)\n const role = useRole(context)\n\n const { getReferenceProps, getFloatingProps } = useInteractions([\n inputtable ? focus : click,\n dismiss,\n role,\n ])\n\n const headingId = useId()\n\n return (\n <>\n <Input\n ref={useMergedRef(ref, refs.setReference)}\n className={className}\n placeholder={placeholder}\n size={size}\n name={name}\n value={inputLabel}\n readOnly={!inputtable}\n suffix={suffixIconSlot}\n prefix={inputPrefix}\n autoComplete=\"off\"\n type={type}\n disabled={disabled}\n asElement={'input'}\n onKeyDown={handleKeyDown}\n onClick={handleInputClick}\n onChange={onChange}\n {...getReferenceProps({\n onBlur: handleInputBlur,\n onFocus: handleInputFocus,\n })}\n />\n {dropdownOpened && (\n <div\n ref={refs.setFloating}\n className=\"picker\"\n style={floatingStyles}\n aria-labelledby={headingId}\n {...getFloatingProps()}\n >\n <div className=\"picker-panel\">{children}</div>\n </div>\n )}\n </>\n )\n}\n\nexport default BasePicker\n"],"names":["dayjs","localizedFormat","BasePicker","props","className","clearable","clearButton","children","disabled","dropdownOpened","inputtable","inputtableBlurClose","inputLabel","inputPrefix","inputSuffix","jsx","HiOutlineCalendar","name","onDropdownOpen","onDropdownClose","onBlur","onFocus","onChange","onKeyDown","onClear","placeholder","ref","setDropdownOpened","size","type","handleInputClick","openDropdown","toggleDropdown","closeDropdown","suffixIconSlot","CloseButton","Fragment","open","handleKeyDown","event","handleInputBlur","handleInputFocus","refs","floatingStyles","context","useFloating","offset","flip","shift","autoUpdate","focus","useFocus","click","useClick","dismiss","useDismiss","role","useRole","getReferenceProps","getFloatingProps","useInteractions","headingId","useId","jsxs","Input","useMergedRef"],"mappings":";;;;;;;;;;AA8BAA,EAAM,OAAOC,CAAe;AA8B5B,MAAMC,KAAa,CAACC,MAA2B;AAC3C,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,YAAAC;AAAA,IACA,aAAA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AAA,QACP,mBAAiBkB;AAAA,QAChB,GAAGF,EAAA;AAAA,QAEJ,UAAA,gBAAA5C,EAAC,OAAA,EAAI,WAAU,gBAAgB,UAAAR,EAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAC5C,GAER;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/Calendar.tsx"],"sourcesContent":["import CalendarBase from './CalendarBase'\nimport { isSameDate } from './utils'\nimport type { CommonProps } from '../@types/common'\nimport type { CalendarSharedProps } from './CalendarBase'\n\nexport interface CalenderProps<MultipleSelection extends boolean = false>\n extends CommonProps,\n CalendarSharedProps {\n multipleSelection?: MultipleSelection\n value?: MultipleSelection extends true ? Date[] : Date | null\n onChange?(\n value: MultipleSelection extends true ? Date[] : Date | null,\n ): void\n}\n\nconst Calendar = <MultipleSelection extends boolean = false>(\n props: CalenderProps<MultipleSelection>,\n) => {\n const { multipleSelection, value, onChange, ...rest } = props\n\n const handleChange = (date: Date | Date[]) => {\n if (!multipleSelection) {\n return onChange?.(\n date as MultipleSelection extends true ? Date[] : Date,\n )\n }\n\n const isSelected = (value as Date[])?.some((val) =>\n isSameDate(val, date as Date),\n )\n\n return onChange?.(\n (isSelected\n ? (value as Date[])?.filter(\n (val: Date) => !isSameDate(val, date as Date),\n )\n : [\n ...(value as Date[]),\n date,\n ]) as MultipleSelection extends true ? Date[] : Date,\n )\n }\n\n return <CalendarBase value={value} onChange={handleChange} {...rest} />\n}\n\nexport default Calendar\n"],"names":["Calendar","props","multipleSelection","value","onChange","rest","CalendarBase","date","isSelected","val","isSameDate"],"mappings":";;;;AAeA,MAAMA,IAAW,CACbC,MACC;AACD,QAAM,EAAE,mBAAAC,GAAmB,OAAAC,GAAO,UAAAC,GAAU,GAAGC,MAASJ;AAyBxD,2BAAQK,GAAA,EAAa,OAAAH,GAAc,UAvBd,CAACI,MAAwB;AAC1C,QAAI,CAACL;AACD,aAAOE,KAAA,gBAAAA;AAAA,QACHG;AAAA;AAIR,UAAMC,IAAcL,KAAA,gBAAAA,EAAkB;AAAA,MAAK,CAACM,MACxCC,EAAWD,GAAKF,CAAY;AAAA;AAGhC,WAAOH,KAAA,gBAAAA;AAAA,MACFI,IACML,KAAA,gBAAAA,EAAkB;AAAA,QACf,CAACM,MAAc,CAACC,EAAWD,GAAKF,CAAY;AAAA,UAEhD;AAAA,QACI,GAAIJ;AAAA,QACJI;AAAA,MAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"Calendar.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/Calendar.tsx"],"sourcesContent":["import CalendarBase from './CalendarBase'\nimport { isSameDate } from './utils'\nimport type { CommonProps } from '../@types/common'\nimport type { CalendarSharedProps } from './CalendarBase'\n\nexport interface CalenderProps<MultipleSelection extends boolean = false>\n extends CommonProps,\n CalendarSharedProps {\n multipleSelection?: MultipleSelection\n value?: MultipleSelection extends true ? Date[] : Date | null\n onChange?(\n value: MultipleSelection extends true ? Date[] : Date | null,\n ): void\n}\n\nconst Calendar = <MultipleSelection extends boolean = false>(\n props: CalenderProps<MultipleSelection>,\n) => {\n const { multipleSelection, value, onChange, ...rest } = props\n\n const handleChange = (date: Date | Date[]) => {\n if (!multipleSelection) {\n return onChange?.(\n date as MultipleSelection extends true ? Date[] : Date,\n )\n }\n\n const isSelected = (value as Date[])?.some((val) =>\n isSameDate(val, date as Date),\n )\n\n return onChange?.(\n (isSelected\n ? (value as Date[])?.filter(\n (val: Date) => !isSameDate(val, date as Date),\n )\n : [\n ...(value as Date[]),\n date,\n ]) as MultipleSelection extends true ? Date[] : Date,\n )\n }\n\n return <CalendarBase value={value} onChange={handleChange} {...rest} />\n}\n\nexport default Calendar\n"],"names":["Calendar","props","multipleSelection","value","onChange","rest","CalendarBase","date","isSelected","val","isSameDate"],"mappings":";;;;AAeA,MAAMA,IAAW,CACbC,MACC;AACD,QAAM,EAAE,mBAAAC,GAAmB,OAAAC,GAAO,UAAAC,GAAU,GAAGC,MAASJ;AAyBxD,2BAAQK,GAAA,EAAa,OAAAH,GAAc,UAvBd,CAACI,MAAwB;AAC1C,QAAI,CAACL;AACD,aAAOE,KAAA,gBAAAA;AAAA,QACHG;AAAA;AAIR,UAAMC,IAAcL,KAAA,gBAAAA,EAAkB;AAAA,MAAK,CAACM,MACxCC,EAAWD,GAAKF,CAAY;AAAA;AAGhC,WAAOH,KAAA,gBAAAA;AAAA,MACFI,IACML,KAAA,gBAAAA,EAAkB;AAAA,QACf,CAACM,MAAc,CAACC,EAAWD,GAAKF,CAAY;AAAA,UAEhD;AAAA,QACI,GAAIJ;AAAA,QACJI;AAAA,MAAA;AAAA;AAAA,EAGlB,GAE4D,GAAGF,GAAM;AACzE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarBase.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/CalendarBase.tsx"],"sourcesContent":["import { useRef, useState } from 'react'\nimport classNames from 'classnames'\nimport useControllableState from '../hooks/useControllableState'\nimport { useConfig } from '../ConfigProvider'\nimport DateTable from './tables/DateTable'\nimport MonthTable from './tables/MonthTable'\nimport YearTable from './tables/YearTable'\nimport type { CommonProps } from '../@types/common'\nimport type { MonthBaseProps } from './tables/components/Month'\nimport type { DayKeydownPayload } from './tables/components/types'\nimport type { ReactNode, KeyboardEvent, MouseEvent, Ref } from 'react'\n\nexport interface CalendarSharedProps extends Omit<MonthBaseProps, 'value'> {\n dateViewCount?: number\n defaultView?: 'date' | 'month' | 'year'\n defaultMonth?: Date\n enableHeaderLabel?: boolean\n locale?: string\n labelFormat?: { month: string; year: string }\n monthLabelFormat?: string\n onDayMouseEnter?: (date: Date, event: MouseEvent) => void\n onMonthChange?: (month: Date) => void\n paginateBy?: number\n range?: [Date, Date]\n renderDay?: (date: Date) => ReactNode\n weekdayLabelFormat?: string\n yearLabelFormat?: string\n}\n\ninterface CalendarBaseProps extends CommonProps, CalendarSharedProps {\n ref?: Ref<HTMLDivElement>\n onChange?: (value: Date | Date[]) => void\n value?: Date | Date[] | null\n}\n\nconst CalendarBase = (props: CalendarBaseProps) => {\n const {\n className,\n dateViewCount = 1,\n dayClassName,\n dayStyle,\n defaultMonth,\n defaultView = 'date',\n disableDate,\n disableOutOfMonth,\n enableHeaderLabel = true,\n firstDayOfWeek = 'monday',\n hideOutOfMonthDates,\n hideWeekdays,\n isDateFirstInRange,\n isDateInRange,\n isDateLastInRange,\n labelFormat = {\n month: 'MMM',\n year: 'YYYY',\n },\n locale,\n maxDate,\n minDate,\n month,\n monthLabelFormat = 'MMM',\n onChange,\n onDayMouseEnter,\n onMonthChange,\n paginateBy = dateViewCount,\n preventFocus,\n range,\n ref,\n renderDay,\n style,\n value,\n weekdayLabelFormat = 'dd',\n weekendDays,\n yearLabelFormat = 'YYYY',\n ...rest\n } = props\n\n const { locale: themeLocale } = useConfig()\n\n const [selectionState, setSelectionState] = useState(defaultView)\n\n const finalLocale = locale || themeLocale\n\n const daysRefs = useRef<HTMLButtonElement[][][]>(\n Array(dateViewCount)\n .fill(0)\n .map(() => []),\n )\n\n const [_month, setMonth] = useControllableState({\n prop: month,\n defaultProp: defaultMonth !== undefined ? defaultMonth : new Date(),\n onChange: onMonthChange,\n })\n\n const [yearSelection, setYearSelection] = useState(_month?.getFullYear())\n const [monthSelection, setMonthSelection] = useState(_month?.getMonth())\n\n const minYear = minDate instanceof Date ? minDate.getFullYear() : 100\n const maxYear = maxDate instanceof Date ? maxDate.getFullYear() : 10000\n\n const daysPerRow = 6\n\n const focusOnNextFocusableDay = (\n direction: 'down' | 'up' | 'left' | 'right',\n monthIndex: number,\n payload: DayKeydownPayload,\n n = 1,\n ) => {\n const changeRow = ['down', 'up'].includes(direction)\n\n const rowIndex = changeRow\n ? payload.rowIndex + (direction === 'down' ? n : -n)\n : payload.rowIndex\n\n const cellIndex = changeRow\n ? payload.cellIndex\n : payload.cellIndex + (direction === 'right' ? n : -n)\n\n const dayToFocus = daysRefs.current[monthIndex][rowIndex][cellIndex]\n\n if (!dayToFocus) {\n return\n }\n\n if (dayToFocus.disabled) {\n focusOnNextFocusableDay(direction, monthIndex, payload, n + 1)\n } else {\n dayToFocus.focus()\n }\n }\n\n const handleDayKeyDown = (\n monthIndex: number,\n payload: DayKeydownPayload,\n event: KeyboardEvent<HTMLButtonElement>,\n ) => {\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault()\n\n const hasRowBelow =\n payload.rowIndex + 1 < daysRefs.current[monthIndex].length\n if (hasRowBelow) {\n focusOnNextFocusableDay('down', monthIndex, payload)\n }\n break\n }\n case 'ArrowUp': {\n event.preventDefault()\n\n const hasRowAbove = payload.rowIndex > 0\n if (hasRowAbove) {\n focusOnNextFocusableDay('up', monthIndex, payload)\n }\n break\n }\n case 'ArrowRight': {\n event.preventDefault()\n\n const isNotLastCell = payload.cellIndex !== daysPerRow\n if (isNotLastCell) {\n focusOnNextFocusableDay('right', monthIndex, payload)\n } else if (monthIndex + 1 < dateViewCount) {\n if (daysRefs.current[monthIndex + 1][payload.rowIndex]) {\n daysRefs.current[monthIndex + 1][\n payload.rowIndex\n ][0]?.focus()\n }\n }\n break\n }\n case 'ArrowLeft': {\n event.preventDefault()\n\n if (payload.cellIndex !== 0) {\n focusOnNextFocusableDay('left', monthIndex, payload)\n } else if (monthIndex > 0) {\n if (daysRefs.current[monthIndex - 1][payload.rowIndex]) {\n daysRefs.current[monthIndex - 1][payload.rowIndex][\n daysPerRow\n ].focus()\n }\n }\n break\n }\n default:\n break\n }\n }\n\n return (\n <div\n ref={ref}\n className={classNames('picker-view', className)}\n {...rest}\n >\n {selectionState === 'year' && (\n <YearTable\n value={yearSelection as number}\n minYear={minYear}\n maxYear={maxYear}\n className={className}\n preventFocus={preventFocus}\n yearLabelFormat={yearLabelFormat}\n onChange={(year) => {\n setMonth(new Date(year, monthSelection as number, 1))\n setYearSelection(year)\n setSelectionState('date')\n }}\n />\n )}\n {selectionState === 'month' && (\n <MonthTable\n value={{\n month: (_month as Date).getMonth(),\n year: (_month as Date).getFullYear(),\n }}\n year={yearSelection as number}\n locale={finalLocale}\n minDate={minDate}\n maxDate={maxDate}\n className={className}\n style={style}\n preventFocus={preventFocus}\n yearLabelFormat={yearLabelFormat}\n monthLabelFormat={monthLabelFormat}\n onYearChange={setYearSelection}\n onNextLevel={() => setSelectionState('year')}\n onChange={(monthValue) => {\n setMonth(\n new Date(yearSelection as number, monthValue, 1),\n )\n setMonthSelection(monthValue)\n setSelectionState('date')\n }}\n />\n )}\n {selectionState === 'date' && (\n <DateTable\n dateViewCount={dateViewCount}\n paginateBy={paginateBy}\n month={_month as Date}\n locale={finalLocale}\n minDate={minDate}\n maxDate={maxDate}\n enableHeaderLabel={enableHeaderLabel}\n daysRefs={daysRefs}\n style={style}\n dayClassName={dayClassName}\n dayStyle={dayStyle}\n disableOutOfMonth={disableOutOfMonth}\n disableDate={disableDate}\n hideWeekdays={hideWeekdays}\n preventFocus={preventFocus}\n firstDayOfWeek={firstDayOfWeek}\n value={value as Date | Date[]}\n range={range}\n labelFormat={labelFormat}\n weekdayLabelFormat={weekdayLabelFormat}\n renderDay={renderDay}\n hideOutOfMonthDates={hideOutOfMonthDates}\n isDateInRange={isDateInRange}\n isDateFirstInRange={isDateFirstInRange}\n isDateLastInRange={isDateLastInRange}\n weekendDays={weekendDays}\n onMonthChange={setMonth}\n onNextLevel={(view) => setSelectionState(view)}\n onDayKeyDown={handleDayKeyDown}\n onChange={onChange}\n onDayMouseEnter={onDayMouseEnter}\n />\n )}\n </div>\n )\n}\n\nexport default CalendarBase\n"],"names":["CalendarBase","props","className","dateViewCount","dayClassName","dayStyle","defaultMonth","defaultView","disableDate","disableOutOfMonth","enableHeaderLabel","firstDayOfWeek","hideOutOfMonthDates","hideWeekdays","isDateFirstInRange","isDateInRange","isDateLastInRange","labelFormat","locale","maxDate","minDate","month","monthLabelFormat","onChange","onDayMouseEnter","onMonthChange","paginateBy","preventFocus","range","ref","renderDay","style","value","weekdayLabelFormat","weekendDays","yearLabelFormat","rest","themeLocale","useConfig","selectionState","setSelectionState","useState","finalLocale","daysRefs","useRef","_month","setMonth","useControllableState","yearSelection","setYearSelection","monthSelection","setMonthSelection","minYear","maxYear","daysPerRow","focusOnNextFocusableDay","direction","monthIndex","payload","n","changeRow","rowIndex","cellIndex","dayToFocus","handleDayKeyDown","event","_a","jsxs","classNames","jsx","YearTable","year","MonthTable","monthValue","DateTable","view"],"mappings":";;;;;;;;;AAmCA,MAAMA,KAAe,CAACC,MAA6B;AAC/C,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,aAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,gBAAAC,IAAiB;AAAA,IACjB,qBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,MACV,OAAO;AAAA,MACP,MAAM;AAAA,IAAA;AAAA,IAEV,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,kBAAAC,IAAmB;AAAA,IACnB,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC,IAAavB;AAAA,IACb,cAAAwB;AAAA,IACA,OAAAC;AAAA,IACA,KAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,oBAAAC,IAAqB;AAAA,IACrB,aAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,GAAGC;AAAA,EAAA,IACHnC,GAEE,EAAE,QAAQoC,GAAA,IAAgBC,GAAA,GAE1B,CAACC,GAAgBC,CAAiB,IAAIC,EAASlC,CAAW,GAE1DmC,IAAcxB,KAAUm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1
|
+
{"version":3,"file":"CalendarBase.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/CalendarBase.tsx"],"sourcesContent":["import { useRef, useState } from 'react'\nimport classNames from 'classnames'\nimport useControllableState from '../hooks/useControllableState'\nimport { useConfig } from '../ConfigProvider'\nimport DateTable from './tables/DateTable'\nimport MonthTable from './tables/MonthTable'\nimport YearTable from './tables/YearTable'\nimport type { CommonProps } from '../@types/common'\nimport type { MonthBaseProps } from './tables/components/Month'\nimport type { DayKeydownPayload } from './tables/components/types'\nimport type { ReactNode, KeyboardEvent, MouseEvent, Ref } from 'react'\n\nexport interface CalendarSharedProps extends Omit<MonthBaseProps, 'value'> {\n dateViewCount?: number\n defaultView?: 'date' | 'month' | 'year'\n defaultMonth?: Date\n enableHeaderLabel?: boolean\n locale?: string\n labelFormat?: { month: string; year: string }\n monthLabelFormat?: string\n onDayMouseEnter?: (date: Date, event: MouseEvent) => void\n onMonthChange?: (month: Date) => void\n paginateBy?: number\n range?: [Date, Date]\n renderDay?: (date: Date) => ReactNode\n weekdayLabelFormat?: string\n yearLabelFormat?: string\n}\n\ninterface CalendarBaseProps extends CommonProps, CalendarSharedProps {\n ref?: Ref<HTMLDivElement>\n onChange?: (value: Date | Date[]) => void\n value?: Date | Date[] | null\n}\n\nconst CalendarBase = (props: CalendarBaseProps) => {\n const {\n className,\n dateViewCount = 1,\n dayClassName,\n dayStyle,\n defaultMonth,\n defaultView = 'date',\n disableDate,\n disableOutOfMonth,\n enableHeaderLabel = true,\n firstDayOfWeek = 'monday',\n hideOutOfMonthDates,\n hideWeekdays,\n isDateFirstInRange,\n isDateInRange,\n isDateLastInRange,\n labelFormat = {\n month: 'MMM',\n year: 'YYYY',\n },\n locale,\n maxDate,\n minDate,\n month,\n monthLabelFormat = 'MMM',\n onChange,\n onDayMouseEnter,\n onMonthChange,\n paginateBy = dateViewCount,\n preventFocus,\n range,\n ref,\n renderDay,\n style,\n value,\n weekdayLabelFormat = 'dd',\n weekendDays,\n yearLabelFormat = 'YYYY',\n ...rest\n } = props\n\n const { locale: themeLocale } = useConfig()\n\n const [selectionState, setSelectionState] = useState(defaultView)\n\n const finalLocale = locale || themeLocale\n\n const daysRefs = useRef<HTMLButtonElement[][][]>(\n Array(dateViewCount)\n .fill(0)\n .map(() => []),\n )\n\n const [_month, setMonth] = useControllableState({\n prop: month,\n defaultProp: defaultMonth !== undefined ? defaultMonth : new Date(),\n onChange: onMonthChange,\n })\n\n const [yearSelection, setYearSelection] = useState(_month?.getFullYear())\n const [monthSelection, setMonthSelection] = useState(_month?.getMonth())\n\n const minYear = minDate instanceof Date ? minDate.getFullYear() : 100\n const maxYear = maxDate instanceof Date ? maxDate.getFullYear() : 10000\n\n const daysPerRow = 6\n\n const focusOnNextFocusableDay = (\n direction: 'down' | 'up' | 'left' | 'right',\n monthIndex: number,\n payload: DayKeydownPayload,\n n = 1,\n ) => {\n const changeRow = ['down', 'up'].includes(direction)\n\n const rowIndex = changeRow\n ? payload.rowIndex + (direction === 'down' ? n : -n)\n : payload.rowIndex\n\n const cellIndex = changeRow\n ? payload.cellIndex\n : payload.cellIndex + (direction === 'right' ? n : -n)\n\n const dayToFocus = daysRefs.current[monthIndex][rowIndex][cellIndex]\n\n if (!dayToFocus) {\n return\n }\n\n if (dayToFocus.disabled) {\n focusOnNextFocusableDay(direction, monthIndex, payload, n + 1)\n } else {\n dayToFocus.focus()\n }\n }\n\n const handleDayKeyDown = (\n monthIndex: number,\n payload: DayKeydownPayload,\n event: KeyboardEvent<HTMLButtonElement>,\n ) => {\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault()\n\n const hasRowBelow =\n payload.rowIndex + 1 < daysRefs.current[monthIndex].length\n if (hasRowBelow) {\n focusOnNextFocusableDay('down', monthIndex, payload)\n }\n break\n }\n case 'ArrowUp': {\n event.preventDefault()\n\n const hasRowAbove = payload.rowIndex > 0\n if (hasRowAbove) {\n focusOnNextFocusableDay('up', monthIndex, payload)\n }\n break\n }\n case 'ArrowRight': {\n event.preventDefault()\n\n const isNotLastCell = payload.cellIndex !== daysPerRow\n if (isNotLastCell) {\n focusOnNextFocusableDay('right', monthIndex, payload)\n } else if (monthIndex + 1 < dateViewCount) {\n if (daysRefs.current[monthIndex + 1][payload.rowIndex]) {\n daysRefs.current[monthIndex + 1][\n payload.rowIndex\n ][0]?.focus()\n }\n }\n break\n }\n case 'ArrowLeft': {\n event.preventDefault()\n\n if (payload.cellIndex !== 0) {\n focusOnNextFocusableDay('left', monthIndex, payload)\n } else if (monthIndex > 0) {\n if (daysRefs.current[monthIndex - 1][payload.rowIndex]) {\n daysRefs.current[monthIndex - 1][payload.rowIndex][\n daysPerRow\n ].focus()\n }\n }\n break\n }\n default:\n break\n }\n }\n\n return (\n <div\n ref={ref}\n className={classNames('picker-view', className)}\n {...rest}\n >\n {selectionState === 'year' && (\n <YearTable\n value={yearSelection as number}\n minYear={minYear}\n maxYear={maxYear}\n className={className}\n preventFocus={preventFocus}\n yearLabelFormat={yearLabelFormat}\n onChange={(year) => {\n setMonth(new Date(year, monthSelection as number, 1))\n setYearSelection(year)\n setSelectionState('date')\n }}\n />\n )}\n {selectionState === 'month' && (\n <MonthTable\n value={{\n month: (_month as Date).getMonth(),\n year: (_month as Date).getFullYear(),\n }}\n year={yearSelection as number}\n locale={finalLocale}\n minDate={minDate}\n maxDate={maxDate}\n className={className}\n style={style}\n preventFocus={preventFocus}\n yearLabelFormat={yearLabelFormat}\n monthLabelFormat={monthLabelFormat}\n onYearChange={setYearSelection}\n onNextLevel={() => setSelectionState('year')}\n onChange={(monthValue) => {\n setMonth(\n new Date(yearSelection as number, monthValue, 1),\n )\n setMonthSelection(monthValue)\n setSelectionState('date')\n }}\n />\n )}\n {selectionState === 'date' && (\n <DateTable\n dateViewCount={dateViewCount}\n paginateBy={paginateBy}\n month={_month as Date}\n locale={finalLocale}\n minDate={minDate}\n maxDate={maxDate}\n enableHeaderLabel={enableHeaderLabel}\n daysRefs={daysRefs}\n style={style}\n dayClassName={dayClassName}\n dayStyle={dayStyle}\n disableOutOfMonth={disableOutOfMonth}\n disableDate={disableDate}\n hideWeekdays={hideWeekdays}\n preventFocus={preventFocus}\n firstDayOfWeek={firstDayOfWeek}\n value={value as Date | Date[]}\n range={range}\n labelFormat={labelFormat}\n weekdayLabelFormat={weekdayLabelFormat}\n renderDay={renderDay}\n hideOutOfMonthDates={hideOutOfMonthDates}\n isDateInRange={isDateInRange}\n isDateFirstInRange={isDateFirstInRange}\n isDateLastInRange={isDateLastInRange}\n weekendDays={weekendDays}\n onMonthChange={setMonth}\n onNextLevel={(view) => setSelectionState(view)}\n onDayKeyDown={handleDayKeyDown}\n onChange={onChange}\n onDayMouseEnter={onDayMouseEnter}\n />\n )}\n </div>\n )\n}\n\nexport default CalendarBase\n"],"names":["CalendarBase","props","className","dateViewCount","dayClassName","dayStyle","defaultMonth","defaultView","disableDate","disableOutOfMonth","enableHeaderLabel","firstDayOfWeek","hideOutOfMonthDates","hideWeekdays","isDateFirstInRange","isDateInRange","isDateLastInRange","labelFormat","locale","maxDate","minDate","month","monthLabelFormat","onChange","onDayMouseEnter","onMonthChange","paginateBy","preventFocus","range","ref","renderDay","style","value","weekdayLabelFormat","weekendDays","yearLabelFormat","rest","themeLocale","useConfig","selectionState","setSelectionState","useState","finalLocale","daysRefs","useRef","_month","setMonth","useControllableState","yearSelection","setYearSelection","monthSelection","setMonthSelection","minYear","maxYear","daysPerRow","focusOnNextFocusableDay","direction","monthIndex","payload","n","changeRow","rowIndex","cellIndex","dayToFocus","handleDayKeyDown","event","_a","jsxs","classNames","jsx","YearTable","year","MonthTable","monthValue","DateTable","view"],"mappings":";;;;;;;;;AAmCA,MAAMA,KAAe,CAACC,MAA6B;AAC/C,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,aAAAC;AAAA,IACA,mBAAAC;AAAA,IACA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;AAAA,UAACK;AAAA,UAAA;AAAA,YACG,eAAAvE;AAAA,YACA,YAAAuB;AAAA,YACA,OAAOmB;AAAA,YACP,QAAQH;AAAA,YACR,SAAAtB;AAAA,YACA,SAAAD;AAAA,YACA,mBAAAT;AAAA,YACA,UAAAiC;AAAA,YACA,OAAAZ;AAAA,YACA,cAAA3B;AAAA,YACA,UAAAC;AAAA,YACA,mBAAAI;AAAA,YACA,aAAAD;AAAA,YACA,cAAAK;AAAA,YACA,cAAAc;AAAA,YACA,gBAAAhB;AAAA,YACA,OAAAqB;AAAA,YACA,OAAAJ;AAAA,YACA,aAAAX;AAAA,YACA,oBAAAgB;AAAA,YACA,WAAAH;AAAA,YACA,qBAAAlB;AAAA,YACA,eAAAG;AAAA,YACA,oBAAAD;AAAA,YACA,mBAAAE;AAAA,YACA,aAAAkB;AAAA,YACA,eAAeY;AAAA,YACf,aAAa,CAAC6B,MAASnC,EAAkBmC,CAAI;AAAA,YAC7C,cAAcX;AAAA,YACd,UAAAzC;AAAA,YACA,iBAAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACJ;AAAA,IAAA;AAAA,EAAA;AAIhB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/DatePicker.tsx"],"sourcesContent":["import { useState, useRef, useEffect } from 'react'\nimport dayjs from 'dayjs'\nimport useControllableState from '../hooks/useControllableState'\nimport useMergedRef from '../hooks/useMergeRef'\nimport Calendar from './Calendar'\nimport BasePicker from './BasePicker'\nimport { useConfig } from '../ConfigProvider'\nimport capitalize from '../utils/capitalize'\nimport type { CommonProps } from '../@types/common'\nimport type { CalendarSharedProps } from './CalendarBase'\nimport type { BasePickerSharedProps } from './BasePicker'\nimport type { FocusEvent, KeyboardEvent, ChangeEvent, Ref } from 'react'\n\nconst DEFAULT_INPUT_FORMAT = 'YYYY-MM-DD'\n\nexport interface DatePickerProps\n extends CommonProps,\n Omit<\n CalendarSharedProps,\n | 'onMonthChange'\n | 'onChange'\n | 'isDateInRange'\n | 'isDateFirstInRange'\n | 'isDateLastInRange'\n | 'month'\n >,\n BasePickerSharedProps {\n closePickerOnChange?: boolean\n defaultOpen?: boolean\n defaultValue?: Date | null\n value?: Date | null\n inputFormat?: string\n inputtableBlurClose?: boolean\n openPickerOnClear?: boolean\n onChange?: (value: Date | null) => void\n ref?: Ref<HTMLInputElement>\n}\n\nconst DatePicker = (props: DatePickerProps) => {\n const {\n className,\n clearable = true,\n clearButton,\n closePickerOnChange = true,\n dateViewCount,\n dayClassName,\n dayStyle,\n defaultMonth,\n defaultOpen = false,\n defaultValue,\n defaultView,\n disabled = false,\n disableDate,\n enableHeaderLabel,\n disableOutOfMonth,\n firstDayOfWeek = 'monday',\n hideOutOfMonthDates,\n hideWeekdays,\n inputFormat,\n inputPrefix,\n inputSuffix,\n inputtable,\n labelFormat = {\n month: 'MMM',\n year: 'YYYY',\n },\n locale,\n maxDate,\n minDate,\n name = 'date',\n onBlur,\n onChange,\n onFocus,\n onDropdownClose,\n onDropdownOpen,\n openPickerOnClear = false,\n renderDay,\n ref = null,\n size,\n style,\n type,\n value,\n weekendDays,\n yearLabelFormat,\n ...rest\n } = props\n\n const { locale: themeLocale } = useConfig()\n const finalLocale = locale || themeLocale\n\n const dateFormat =\n type === 'date'\n ? DEFAULT_INPUT_FORMAT\n : inputFormat || DEFAULT_INPUT_FORMAT\n\n const [dropdownOpened, setDropdownOpened] = useState(defaultOpen)\n\n const inputRef = useRef<HTMLInputElement>(null)\n\n const [lastValidValue, setLastValidValue] = useState(defaultValue ?? null)\n\n const [_value, setValue] = useControllableState({\n prop: value,\n defaultProp: defaultValue,\n onChange,\n })\n\n const [calendarMonth, setCalendarMonth] = useState(\n _value || defaultMonth || new Date(),\n )\n\n const [focused, setFocused] = useState(false)\n\n const [inputState, setInputState] = useState(\n _value instanceof Date\n ? capitalize(dayjs(_value).locale(finalLocale).format(dateFormat))\n : '',\n )\n\n const closeDropdown = () => {\n setDropdownOpened(false)\n onDropdownClose?.()\n }\n\n const openDropdown = () => {\n setDropdownOpened(true)\n onDropdownOpen?.()\n }\n\n useEffect(() => {\n if (!_value) {\n if (maxDate && dayjs(calendarMonth).isAfter(maxDate)) {\n setCalendarMonth(maxDate)\n }\n\n if (minDate && dayjs(calendarMonth).isBefore(minDate)) {\n setCalendarMonth(minDate)\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [minDate, maxDate])\n\n useEffect(() => {\n if (value === null && !focused) {\n setInputState('')\n }\n\n if (value instanceof Date && !focused) {\n setInputState(\n capitalize(dayjs(value).locale(finalLocale).format(dateFormat)),\n )\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, focused, themeLocale])\n\n useEffect(() => {\n if (defaultValue instanceof Date && inputState && !focused) {\n setInputState(\n capitalize(\n dayjs(_value).locale(finalLocale).format(dateFormat),\n ),\n )\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [themeLocale])\n\n const handleValueChange = (date: Date | null) => {\n setValue(date)\n setInputState(\n capitalize(dayjs(date).locale(finalLocale).format(dateFormat)),\n )\n if (closePickerOnChange) {\n openDropdown()\n }\n window.setTimeout(() => inputRef.current?.focus(), 0)\n }\n\n const handleClear = () => {\n setValue(null)\n setLastValidValue(null)\n setInputState('')\n if (openPickerOnClear) {\n openDropdown()\n }\n inputRef.current?.focus()\n }\n\n const parseDate = (date: string) =>\n dayjs(date, dateFormat, finalLocale).toDate()\n\n const setDateFromInput = () => {\n let date = typeof _value === 'string' ? parseDate(_value) : _value\n\n if (maxDate && dayjs(date).isAfter(maxDate)) {\n date = maxDate\n }\n\n if (minDate && dayjs(date).isBefore(minDate)) {\n date = minDate\n }\n\n if (dayjs(date).isValid()) {\n setValue(date)\n setLastValidValue(date as Date)\n setInputState(\n capitalize(dayjs(date).locale(finalLocale).format(dateFormat)),\n )\n setCalendarMonth(date as Date)\n } else {\n setValue(lastValidValue)\n }\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement, Element>) => {\n if (typeof onBlur === 'function') {\n onBlur(event)\n }\n setFocused(false)\n\n if (inputtable) {\n setDateFromInput()\n }\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' && inputtable) {\n closeDropdown()\n setDateFromInput()\n }\n }\n\n const handleInputFocus = (event: FocusEvent<HTMLInputElement, Element>) => {\n if (typeof onFocus === 'function') {\n onFocus(event)\n }\n setFocused(true)\n }\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n openDropdown()\n\n const date = parseDate(event.target.value)\n if (dayjs(date).isValid()) {\n setValue(date)\n setLastValidValue(date)\n setInputState(event.target.value)\n setCalendarMonth(date)\n } else {\n setInputState(event.target.value)\n }\n }\n\n return (\n <BasePicker\n ref={useMergedRef(ref, inputRef)}\n inputtable={inputtable}\n dropdownOpened={dropdownOpened as boolean}\n setDropdownOpened={setDropdownOpened}\n size={size}\n style={style}\n className={className}\n name={name}\n inputLabel={inputState}\n clearable={\n type === 'date' ? false : clearable && !!_value && !disabled\n }\n clearButton={clearButton}\n disabled={disabled}\n type={type}\n inputPrefix={inputPrefix}\n inputSuffix={inputSuffix}\n onChange={handleChange}\n onBlur={handleInputBlur}\n onFocus={handleInputFocus}\n onKeyDown={handleKeyDown}\n onClear={handleClear}\n onDropdownClose={onDropdownClose}\n onDropdownOpen={onDropdownOpen}\n {...rest}\n >\n <Calendar\n locale={finalLocale}\n month={inputtable ? calendarMonth : undefined}\n defaultMonth={\n defaultMonth ||\n (_value instanceof Date ? _value : new Date())\n }\n value={\n _value instanceof Date\n ? _value\n : _value && dayjs(_value).toDate()\n }\n labelFormat={labelFormat}\n dayClassName={dayClassName}\n dayStyle={dayStyle}\n disableOutOfMonth={disableOutOfMonth}\n minDate={minDate}\n maxDate={maxDate}\n disableDate={disableDate}\n firstDayOfWeek={firstDayOfWeek}\n preventFocus={inputtable}\n dateViewCount={dateViewCount}\n enableHeaderLabel={enableHeaderLabel}\n defaultView={defaultView}\n hideOutOfMonthDates={hideOutOfMonthDates}\n hideWeekdays={hideWeekdays}\n renderDay={renderDay}\n weekendDays={weekendDays}\n yearLabelFormat={yearLabelFormat}\n onMonthChange={setCalendarMonth}\n onChange={handleValueChange}\n />\n </BasePicker>\n )\n}\n\nexport default DatePicker\n"],"names":["DEFAULT_INPUT_FORMAT","DatePicker","props","className","clearable","clearButton","closePickerOnChange","dateViewCount","dayClassName","dayStyle","defaultMonth","defaultOpen","defaultValue","defaultView","disabled","disableDate","enableHeaderLabel","disableOutOfMonth","firstDayOfWeek","hideOutOfMonthDates","hideWeekdays","inputFormat","inputPrefix","inputSuffix","inputtable","labelFormat","locale","maxDate","minDate","name","onBlur","onChange","onFocus","onDropdownClose","onDropdownOpen","openPickerOnClear","renderDay","ref","size","style","type","value","weekendDays","yearLabelFormat","rest","themeLocale","useConfig","finalLocale","dateFormat","dropdownOpened","setDropdownOpened","useState","inputRef","useRef","lastValidValue","setLastValidValue","_value","setValue","useControllableState","calendarMonth","setCalendarMonth","focused","setFocused","inputState","setInputState","capitalize","dayjs","closeDropdown","openDropdown","useEffect","handleValueChange","date","_a","handleClear","parseDate","setDateFromInput","handleInputBlur","event","handleKeyDown","handleInputFocus","handleChange","jsx","BasePicker","useMergedRef","Calendar"],"mappings":";;;;;;;;;;AAaA,MAAMA,IAAuB,cAyBvBC,KAAa,CAACC,MAA2B;AAC3C,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,aAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,aAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,qBAAA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,KAAKC,GAAa9C,IAAKe,CAAQ;AAAA,MAC/B,YAAA5B;AAAA,MACA,gBAAAyB;AAAA,MACA,mBAAAC;AAAA,MACA,MAAAZ;AAAA,MACA,OAAAC;AAAA,MACA,WAAApC;AAAA,MACA,MAAA0B;AAAA,MACA,YAAYkC;AAAA,MACZ,WACIvB,MAAS,SAAS,KAAQpC,KAAa,CAAC,CAACoD,KAAU,CAAC1C;AAAA,MAExD,aAAAT;AAAA,MACA,UAAAS;AAAA,MACA,MAAA0B;AAAA,MACA,aAAAlB;AAAA,MACA,aAAAC;AAAA,MACA,UAAUyD;AAAA,MACV,QAAQJ;AAAA,MACR,SAASG;AAAA,MACT,WAAWD;AAAA,MACX,SAASL;AAAA,MACT,iBAAAxC;AAAA,MACA,gBAAAC;AAAA,MACC,GAAGU;AAAA,MAEJ,UAAA,gBAAAqC;AAAA,QAACG;AAAA,QAAA;AAAA,UACG,QAAQrC;AAAA,UACR,OAAOvB,IAAamC,IAAgB;AAAA,UACpC,cACIjD,MACC8C,aAAkB,OAAOA,wBAAa;UAE3C,OACIA,aAAkB,OACZA,IACAA,KAAUU,EAAMV,CAAM,EAAE,OAAA;AAAA,UAElC,aAAA/B;AAAA,UACA,cAAAjB;AAAA,UACA,UAAAC;AAAA,UACA,mBAAAQ;AAAA,UACA,SAAAW;AAAA,UACA,SAAAD;AAAA,UACA,aAAAZ;AAAA,UACA,gBAAAG;AAAA,UACA,cAAcM;AAAA,UACd,eAAAjB;AAAA,UACA,mBAAAS;AAAA,UACA,aAAAH;AAAA,UACA,qBAAAM;AAAA,UACA,cAAAC;AAAA,UACA,WAAAgB;AAAA,UACA,aAAAM;AAAA,UACA,iBAAAC;AAAA,UACA,eAAeiB;AAAA,UACf,UAAUU;AAAA,QAAA;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAGZ;"}
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/DatePicker.tsx"],"sourcesContent":["import { useState, useRef, useEffect } from 'react'\nimport dayjs from 'dayjs'\nimport useControllableState from '../hooks/useControllableState'\nimport useMergedRef from '../hooks/useMergeRef'\nimport Calendar from './Calendar'\nimport BasePicker from './BasePicker'\nimport { useConfig } from '../ConfigProvider'\nimport capitalize from '../utils/capitalize'\nimport type { CommonProps } from '../@types/common'\nimport type { CalendarSharedProps } from './CalendarBase'\nimport type { BasePickerSharedProps } from './BasePicker'\nimport type { FocusEvent, KeyboardEvent, ChangeEvent, Ref } from 'react'\n\nconst DEFAULT_INPUT_FORMAT = 'YYYY-MM-DD'\n\nexport interface DatePickerProps\n extends CommonProps,\n Omit<\n CalendarSharedProps,\n | 'onMonthChange'\n | 'onChange'\n | 'isDateInRange'\n | 'isDateFirstInRange'\n | 'isDateLastInRange'\n | 'month'\n >,\n BasePickerSharedProps {\n closePickerOnChange?: boolean\n defaultOpen?: boolean\n defaultValue?: Date | null\n value?: Date | null\n inputFormat?: string\n inputtableBlurClose?: boolean\n openPickerOnClear?: boolean\n onChange?: (value: Date | null) => void\n ref?: Ref<HTMLInputElement>\n}\n\nconst DatePicker = (props: DatePickerProps) => {\n const {\n className,\n clearable = true,\n clearButton,\n closePickerOnChange = true,\n dateViewCount,\n dayClassName,\n dayStyle,\n defaultMonth,\n defaultOpen = false,\n defaultValue,\n defaultView,\n disabled = false,\n disableDate,\n enableHeaderLabel,\n disableOutOfMonth,\n firstDayOfWeek = 'monday',\n hideOutOfMonthDates,\n hideWeekdays,\n inputFormat,\n inputPrefix,\n inputSuffix,\n inputtable,\n labelFormat = {\n month: 'MMM',\n year: 'YYYY',\n },\n locale,\n maxDate,\n minDate,\n name = 'date',\n onBlur,\n onChange,\n onFocus,\n onDropdownClose,\n onDropdownOpen,\n openPickerOnClear = false,\n renderDay,\n ref = null,\n size,\n style,\n type,\n value,\n weekendDays,\n yearLabelFormat,\n ...rest\n } = props\n\n const { locale: themeLocale } = useConfig()\n const finalLocale = locale || themeLocale\n\n const dateFormat =\n type === 'date'\n ? DEFAULT_INPUT_FORMAT\n : inputFormat || DEFAULT_INPUT_FORMAT\n\n const [dropdownOpened, setDropdownOpened] = useState(defaultOpen)\n\n const inputRef = useRef<HTMLInputElement>(null)\n\n const [lastValidValue, setLastValidValue] = useState(defaultValue ?? null)\n\n const [_value, setValue] = useControllableState({\n prop: value,\n defaultProp: defaultValue,\n onChange,\n })\n\n const [calendarMonth, setCalendarMonth] = useState(\n _value || defaultMonth || new Date(),\n )\n\n const [focused, setFocused] = useState(false)\n\n const [inputState, setInputState] = useState(\n _value instanceof Date\n ? capitalize(dayjs(_value).locale(finalLocale).format(dateFormat))\n : '',\n )\n\n const closeDropdown = () => {\n setDropdownOpened(false)\n onDropdownClose?.()\n }\n\n const openDropdown = () => {\n setDropdownOpened(true)\n onDropdownOpen?.()\n }\n\n useEffect(() => {\n if (!_value) {\n if (maxDate && dayjs(calendarMonth).isAfter(maxDate)) {\n setCalendarMonth(maxDate)\n }\n\n if (minDate && dayjs(calendarMonth).isBefore(minDate)) {\n setCalendarMonth(minDate)\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [minDate, maxDate])\n\n useEffect(() => {\n if (value === null && !focused) {\n setInputState('')\n }\n\n if (value instanceof Date && !focused) {\n setInputState(\n capitalize(dayjs(value).locale(finalLocale).format(dateFormat)),\n )\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [value, focused, themeLocale])\n\n useEffect(() => {\n if (defaultValue instanceof Date && inputState && !focused) {\n setInputState(\n capitalize(\n dayjs(_value).locale(finalLocale).format(dateFormat),\n ),\n )\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [themeLocale])\n\n const handleValueChange = (date: Date | null) => {\n setValue(date)\n setInputState(\n capitalize(dayjs(date).locale(finalLocale).format(dateFormat)),\n )\n if (closePickerOnChange) {\n openDropdown()\n }\n window.setTimeout(() => inputRef.current?.focus(), 0)\n }\n\n const handleClear = () => {\n setValue(null)\n setLastValidValue(null)\n setInputState('')\n if (openPickerOnClear) {\n openDropdown()\n }\n inputRef.current?.focus()\n }\n\n const parseDate = (date: string) =>\n dayjs(date, dateFormat, finalLocale).toDate()\n\n const setDateFromInput = () => {\n let date = typeof _value === 'string' ? parseDate(_value) : _value\n\n if (maxDate && dayjs(date).isAfter(maxDate)) {\n date = maxDate\n }\n\n if (minDate && dayjs(date).isBefore(minDate)) {\n date = minDate\n }\n\n if (dayjs(date).isValid()) {\n setValue(date)\n setLastValidValue(date as Date)\n setInputState(\n capitalize(dayjs(date).locale(finalLocale).format(dateFormat)),\n )\n setCalendarMonth(date as Date)\n } else {\n setValue(lastValidValue)\n }\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement, Element>) => {\n if (typeof onBlur === 'function') {\n onBlur(event)\n }\n setFocused(false)\n\n if (inputtable) {\n setDateFromInput()\n }\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' && inputtable) {\n closeDropdown()\n setDateFromInput()\n }\n }\n\n const handleInputFocus = (event: FocusEvent<HTMLInputElement, Element>) => {\n if (typeof onFocus === 'function') {\n onFocus(event)\n }\n setFocused(true)\n }\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n openDropdown()\n\n const date = parseDate(event.target.value)\n if (dayjs(date).isValid()) {\n setValue(date)\n setLastValidValue(date)\n setInputState(event.target.value)\n setCalendarMonth(date)\n } else {\n setInputState(event.target.value)\n }\n }\n\n return (\n <BasePicker\n ref={useMergedRef(ref, inputRef)}\n inputtable={inputtable}\n dropdownOpened={dropdownOpened as boolean}\n setDropdownOpened={setDropdownOpened}\n size={size}\n style={style}\n className={className}\n name={name}\n inputLabel={inputState}\n clearable={\n type === 'date' ? false : clearable && !!_value && !disabled\n }\n clearButton={clearButton}\n disabled={disabled}\n type={type}\n inputPrefix={inputPrefix}\n inputSuffix={inputSuffix}\n onChange={handleChange}\n onBlur={handleInputBlur}\n onFocus={handleInputFocus}\n onKeyDown={handleKeyDown}\n onClear={handleClear}\n onDropdownClose={onDropdownClose}\n onDropdownOpen={onDropdownOpen}\n {...rest}\n >\n <Calendar\n locale={finalLocale}\n month={inputtable ? calendarMonth : undefined}\n defaultMonth={\n defaultMonth ||\n (_value instanceof Date ? _value : new Date())\n }\n value={\n _value instanceof Date\n ? _value\n : _value && dayjs(_value).toDate()\n }\n labelFormat={labelFormat}\n dayClassName={dayClassName}\n dayStyle={dayStyle}\n disableOutOfMonth={disableOutOfMonth}\n minDate={minDate}\n maxDate={maxDate}\n disableDate={disableDate}\n firstDayOfWeek={firstDayOfWeek}\n preventFocus={inputtable}\n dateViewCount={dateViewCount}\n enableHeaderLabel={enableHeaderLabel}\n defaultView={defaultView}\n hideOutOfMonthDates={hideOutOfMonthDates}\n hideWeekdays={hideWeekdays}\n renderDay={renderDay}\n weekendDays={weekendDays}\n yearLabelFormat={yearLabelFormat}\n onMonthChange={setCalendarMonth}\n onChange={handleValueChange}\n />\n </BasePicker>\n )\n}\n\nexport default DatePicker\n"],"names":["DEFAULT_INPUT_FORMAT","DatePicker","props","className","clearable","clearButton","closePickerOnChange","dateViewCount","dayClassName","dayStyle","defaultMonth","defaultOpen","defaultValue","defaultView","disabled","disableDate","enableHeaderLabel","disableOutOfMonth","firstDayOfWeek","hideOutOfMonthDates","hideWeekdays","inputFormat","inputPrefix","inputSuffix","inputtable","labelFormat","locale","maxDate","minDate","name","onBlur","onChange","onFocus","onDropdownClose","onDropdownOpen","openPickerOnClear","renderDay","ref","size","style","type","value","weekendDays","yearLabelFormat","rest","themeLocale","useConfig","finalLocale","dateFormat","dropdownOpened","setDropdownOpened","useState","inputRef","useRef","lastValidValue","setLastValidValue","_value","setValue","useControllableState","calendarMonth","setCalendarMonth","focused","setFocused","inputState","setInputState","capitalize","dayjs","closeDropdown","openDropdown","useEffect","handleValueChange","date","_a","handleClear","parseDate","setDateFromInput","handleInputBlur","event","handleKeyDown","handleInputFocus","handleChange","jsx","BasePicker","useMergedRef","Calendar"],"mappings":";;;;;;;;;;AAaA,MA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AA,UACA,aAAAZ;AAAA,UACA,gBAAAG;AAAA,UACA,cAAcM;AAAA,UACd,eAAAjB;AAAA,UACA,mBAAAS;AAAA,UACA,aAAAH;AAAA,UACA,qBAAAM;AAAA,UACA,cAAAC;AAAA,UACA,WAAAgB;AAAA,UACA,aAAAM;AAAA,UACA,iBAAAC;AAAA,UACA,eAAeiB;AAAA,UACf,UAAUU;AAAA,QAAA;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAGZ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerRange.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/DatePickerRange.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useState, useRef } from 'react'\nimport dayjs from 'dayjs'\nimport useControllableState from '../hooks/useControllableState'\nimport useMergedRef from '../hooks/useMergeRef'\nimport capitalize from '../utils/capitalize'\nimport RangeCalendar from './RangeCalendar'\nimport BasePicker from './BasePicker'\nimport { useConfig } from '../ConfigProvider'\nimport type { CommonProps } from '../@types/common'\nimport type { CalendarSharedProps } from './CalendarBase'\nimport type { BasePickerSharedProps } from './BasePicker'\nimport type { Ref } from 'react'\n\nexport type DatePickerRangeValue = [Date | null, Date | null]\n\nexport interface DatePickerRangeProps\n extends CommonProps,\n Omit<\n CalendarSharedProps,\n | 'onMonthChange'\n | 'onChange'\n | 'isDateInRange'\n | 'isDateFirstInRange'\n | 'isDateLastInRange'\n | 'month'\n >,\n BasePickerSharedProps {\n closePickerOnChange?: boolean\n defaultOpen?: boolean\n defaultValue?: DatePickerRangeValue\n inputFormat?: string\n separator?: string\n onChange?: (value: DatePickerRangeValue) => void\n openPickerOnClear?: boolean\n ref?: Ref<HTMLInputElement>\n singleDate?: boolean\n value?: DatePickerRangeValue\n}\n\nconst validationRule = (val: any) =>\n Array.isArray(val) &&\n val.length === 2 &&\n val.every((v) => v instanceof Date)\n\nconst isFirstDateSet = (val: any) =>\n Array.isArray(val) && val.length === 2 && val[0] instanceof Date\n\nconst DatePickerRange = (props: DatePickerRangeProps) => {\n const {\n className,\n clearable = true,\n clearButton,\n closePickerOnChange = true,\n dateViewCount = 1,\n dayClassName,\n dayStyle,\n defaultMonth,\n defaultOpen = false,\n defaultValue,\n defaultView,\n disabled,\n disableDate,\n enableHeaderLabel,\n disableOutOfMonth,\n firstDayOfWeek = 'monday',\n hideOutOfMonthDates,\n hideWeekdays,\n inputFormat,\n inputPrefix,\n inputSuffix,\n labelFormat = {\n month: 'MMM',\n year: 'YYYY',\n },\n separator = '~',\n locale,\n maxDate,\n minDate,\n onChange,\n onDropdownClose,\n onDropdownOpen,\n openPickerOnClear = false,\n ref = null,\n renderDay,\n singleDate = false,\n size,\n style,\n value,\n weekendDays,\n yearLabelFormat,\n ...rest\n } = props\n\n const { locale: themeLocale } = useConfig()\n\n const finalLocale = locale || themeLocale\n\n const dateFormat = inputFormat || 'YYYY-MM-DD'\n\n const [dropdownOpened, setDropdownOpened] = useState(defaultOpen)\n\n const inputRef = useRef<HTMLInputElement>(null)\n\n const [_value, setValue] = useControllableState<[Date | null, Date | null]>(\n {\n prop: value,\n defaultProp:\n defaultValue !== undefined ? defaultValue : [null, null],\n onChange,\n },\n )\n\n const handleValueChange = (range: [Date, Date]) => {\n setValue(range)\n if (closePickerOnChange && validationRule(range)) {\n setDropdownOpened(false)\n onDropdownClose?.()\n window.setTimeout(() => inputRef.current?.focus(), 0)\n }\n }\n\n const valueValid = validationRule(_value)\n const firstValueValid = isFirstDateSet(_value)\n\n const firstDateLabel = _value?.[0]\n ? capitalize(dayjs(_value[0]).locale(finalLocale).format(dateFormat))\n : ''\n\n const secondDateLabel = _value?.[1]\n ? capitalize(dayjs(_value[1]).locale(finalLocale).format(dateFormat))\n : ''\n\n const handleClear = () => {\n setValue([null, null])\n setDropdownOpened(true)\n openPickerOnClear && onDropdownOpen?.()\n inputRef.current?.focus()\n }\n\n const handleDropdownToggle = (isOpened: boolean) => {\n if (!isOpened && firstValueValid && _value?.[1] === null) {\n handleClear()\n }\n setDropdownOpened(isOpened)\n }\n\n return (\n <BasePicker\n ref={useMergedRef(ref, inputRef)}\n dropdownOpened={dropdownOpened as boolean}\n setDropdownOpened={handleDropdownToggle}\n size={size}\n style={style}\n className={className}\n inputLabel={\n firstValueValid\n ? `${firstDateLabel} ${separator} ${secondDateLabel}`\n : ''\n }\n clearable={clearable && firstValueValid}\n clearButton={clearButton}\n disabled={disabled}\n inputPrefix={inputPrefix}\n inputSuffix={inputSuffix}\n onClear={handleClear}\n onDropdownClose={onDropdownClose}\n onDropdownOpen={onDropdownOpen}\n {...rest}\n >\n <RangeCalendar\n locale={finalLocale}\n defaultMonth={(valueValid ? _value?.[0] : defaultMonth) as Date}\n value={_value as [Date | null, Date | null]}\n labelFormat={labelFormat}\n dayClassName={dayClassName}\n dayStyle={dayStyle}\n disableOutOfMonth={disableOutOfMonth}\n minDate={minDate}\n maxDate={maxDate}\n disableDate={disableDate}\n firstDayOfWeek={firstDayOfWeek}\n enableHeaderLabel={enableHeaderLabel}\n singleDate={singleDate}\n dateViewCount={dateViewCount}\n defaultView={defaultView}\n hideOutOfMonthDates={hideOutOfMonthDates}\n hideWeekdays={hideWeekdays}\n renderDay={renderDay}\n weekendDays={weekendDays}\n yearLabelFormat={yearLabelFormat}\n onChange={(date) => handleValueChange(date as [Date, Date])}\n />\n </BasePicker>\n )\n}\n\nexport default DatePickerRange\n"],"names":["validationRule","val","v","isFirstDateSet","DatePickerRange","props","className","clearable","clearButton","closePickerOnChange","dateViewCount","dayClassName","dayStyle","defaultMonth","defaultOpen","defaultValue","defaultView","disabled","disableDate","enableHeaderLabel","disableOutOfMonth","firstDayOfWeek","hideOutOfMonthDates","hideWeekdays","inputFormat","inputPrefix","inputSuffix","labelFormat","separator","locale","maxDate","minDate","onChange","onDropdownClose","onDropdownOpen","openPickerOnClear","ref","renderDay","singleDate","size","style","value","weekendDays","yearLabelFormat","rest","themeLocale","useConfig","finalLocale","dateFormat","dropdownOpened","setDropdownOpened","useState","inputRef","useRef","_value","setValue","useControllableState","handleValueChange","range","_a","valueValid","firstValueValid","firstDateLabel","capitalize","dayjs","secondDateLabel","handleClear","handleDropdownToggle","isOpened","jsx","BasePicker","useMergedRef","RangeCalendar","date"],"mappings":";;;;;;;;;;AAwCA,MAAMA,IAAiB,CAACC,MACpB,MAAM,QAAQA,CAAG,KACjBA,EAAI,WAAW,KACfA,EAAI,MAAM,CAACC,MAAMA,aAAa,IAAI,GAEhCC,KAAiB,CAACF,MACpB,MAAM,QAAQA,CAAG,KAAKA,EAAI,WAAW,KAAKA,EAAI,CAAC,aAAa,MAE1DG,KAAkB,CAACC,MAAgC;AACrD,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,aAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,eAAAC,IAAgB;AAAA,IAChB,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,qBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,MACV,OAAO;AAAA,MACP,MAAM;AAAA,IAAA;AAAA,IAEV,WAAAC,IAAY;AAAA,IACZ,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,KAAAC,IAAM;AAAA,IACN,WAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iB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AAG9B,SACI,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,KAAKC,GAAanC,GAAKgB,CAAQ;AAAA,MAC/B,gBAAAH;AAAA,MACA,mBAAmBkB;AAAA,MACnB,MAAA5B;AAAA,MACA,OAAAC;AAAA,MACA,WAAAlC;AAAA,MACA,YACIuD,IACM,GAAGC,EAAc,IAAIlC,CAAS,IAAIqC,EAAe,KACjD;AAAA,MAEV,WAAW1D,KAAasD;AAAA,MACxB,aAAArD;AAAA,MACA,UAAAS;AAAA,MACA,aAAAQ;AAAA,MACA,aAAAC;AAAA,MACA,SAASwC;AAAA,MACT,iBAAAjC;AAAA,MACA,gBAAAC;AAAA,MACC,GAAGU;AAAA,MAEJ,UAAA,gBAAAyB;AAAA,QAACG;AAAA,QAAA;AAAA,UACG,QAAQzB;AAAA,UACR,cAAea,KAAaN,KAAA,gBAAAA,EAAS,KAAKzC;AAAA,UAC1C,OAAOyC;AAAA,UACP,aAAA3B;AAAA,UACA,cAAAhB;AAAA,UACA,UAAAC;AAAA,UACA,mBAAAQ;AAAA,UACA,SAAAW;AAAA,UACA,SAAAD;AAAA,UACA,aAAAZ;AAAA,UACA,gBAAAG;AAAA,UACA,mBAAAF;AAAA,UACA,YAAAmB;AAAA,UACA,eAAA5B;AAAA,UACA,aAAAM;AAAA,UACA,qBAAAM;AAAA,UACA,cAAAC;AAAA,UACA,WAAAc;AAAA,UACA,aAAAK;AAAA,UACA,iBAAAC;AAAA,UACA,UAAU,CAAC8B,MAAShB,GAAkBgB,CAAoB;AAAA,QAAA;AAAA,MAAA;AAAA,IAC9D;AAAA,EAAA;AAGZ;"}
|
|
1
|
+
{"version":3,"file":"DatePickerRange.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/DatePickerRange.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useState, useRef } from 'react'\nimport dayjs from 'dayjs'\nimport useControllableState from '../hooks/useControllableState'\nimport useMergedRef from '../hooks/useMergeRef'\nimport capitalize from '../utils/capitalize'\nimport RangeCalendar from './RangeCalendar'\nimport BasePicker from './BasePicker'\nimport { useConfig } from '../ConfigProvider'\nimport type { CommonProps } from '../@types/common'\nimport type { CalendarSharedProps } from './CalendarBase'\nimport type { BasePickerSharedProps } from './BasePicker'\nimport type { Ref } from 'react'\n\nexport type DatePickerRangeValue = [Date | null, Date | null]\n\nexport interface DatePickerRangeProps\n extends CommonProps,\n Omit<\n CalendarSharedProps,\n | 'onMonthChange'\n | 'onChange'\n | 'isDateInRange'\n | 'isDateFirstInRange'\n | 'isDateLastInRange'\n | 'month'\n >,\n BasePickerSharedProps {\n closePickerOnChange?: boolean\n defaultOpen?: boolean\n defaultValue?: DatePickerRangeValue\n inputFormat?: string\n separator?: string\n onChange?: (value: DatePickerRangeValue) => void\n openPickerOnClear?: boolean\n ref?: Ref<HTMLInputElement>\n singleDate?: boolean\n value?: DatePickerRangeValue\n}\n\nconst validationRule = (val: any) =>\n Array.isArray(val) &&\n val.length === 2 &&\n val.every((v) => v instanceof Date)\n\nconst isFirstDateSet = (val: any) =>\n Array.isArray(val) && val.length === 2 && val[0] instanceof Date\n\nconst DatePickerRange = (props: DatePickerRangeProps) => {\n const {\n className,\n clearable = true,\n clearButton,\n closePickerOnChange = true,\n dateViewCount = 1,\n dayClassName,\n dayStyle,\n defaultMonth,\n defaultOpen = false,\n defaultValue,\n defaultView,\n disabled,\n disableDate,\n enableHeaderLabel,\n disableOutOfMonth,\n firstDayOfWeek = 'monday',\n hideOutOfMonthDates,\n hideWeekdays,\n inputFormat,\n inputPrefix,\n inputSuffix,\n labelFormat = {\n month: 'MMM',\n year: 'YYYY',\n },\n separator = '~',\n locale,\n maxDate,\n minDate,\n onChange,\n onDropdownClose,\n onDropdownOpen,\n openPickerOnClear = false,\n ref = null,\n renderDay,\n singleDate = false,\n size,\n style,\n value,\n weekendDays,\n yearLabelFormat,\n ...rest\n } = props\n\n const { locale: themeLocale } = useConfig()\n\n const finalLocale = locale || themeLocale\n\n const dateFormat = inputFormat || 'YYYY-MM-DD'\n\n const [dropdownOpened, setDropdownOpened] = useState(defaultOpen)\n\n const inputRef = useRef<HTMLInputElement>(null)\n\n const [_value, setValue] = useControllableState<[Date | null, Date | null]>(\n {\n prop: value,\n defaultProp:\n defaultValue !== undefined ? defaultValue : [null, null],\n onChange,\n },\n )\n\n const handleValueChange = (range: [Date, Date]) => {\n setValue(range)\n if (closePickerOnChange && validationRule(range)) {\n setDropdownOpened(false)\n onDropdownClose?.()\n window.setTimeout(() => inputRef.current?.focus(), 0)\n }\n }\n\n const valueValid = validationRule(_value)\n const firstValueValid = isFirstDateSet(_value)\n\n const firstDateLabel = _value?.[0]\n ? capitalize(dayjs(_value[0]).locale(finalLocale).format(dateFormat))\n : ''\n\n const secondDateLabel = _value?.[1]\n ? capitalize(dayjs(_value[1]).locale(finalLocale).format(dateFormat))\n : ''\n\n const handleClear = () => {\n setValue([null, null])\n setDropdownOpened(true)\n openPickerOnClear && onDropdownOpen?.()\n inputRef.current?.focus()\n }\n\n const handleDropdownToggle = (isOpened: boolean) => {\n if (!isOpened && firstValueValid && _value?.[1] === null) {\n handleClear()\n }\n setDropdownOpened(isOpened)\n }\n\n return (\n <BasePicker\n ref={useMergedRef(ref, inputRef)}\n dropdownOpened={dropdownOpened as boolean}\n setDropdownOpened={handleDropdownToggle}\n size={size}\n style={style}\n className={className}\n inputLabel={\n firstValueValid\n ? `${firstDateLabel} ${separator} ${secondDateLabel}`\n : ''\n }\n clearable={clearable && firstValueValid}\n clearButton={clearButton}\n disabled={disabled}\n inputPrefix={inputPrefix}\n inputSuffix={inputSuffix}\n onClear={handleClear}\n onDropdownClose={onDropdownClose}\n onDropdownOpen={onDropdownOpen}\n {...rest}\n >\n <RangeCalendar\n locale={finalLocale}\n defaultMonth={(valueValid ? _value?.[0] : defaultMonth) as Date}\n value={_value as [Date | null, Date | null]}\n labelFormat={labelFormat}\n dayClassName={dayClassName}\n dayStyle={dayStyle}\n disableOutOfMonth={disableOutOfMonth}\n minDate={minDate}\n maxDate={maxDate}\n disableDate={disableDate}\n firstDayOfWeek={firstDayOfWeek}\n enableHeaderLabel={enableHeaderLabel}\n singleDate={singleDate}\n dateViewCount={dateViewCount}\n defaultView={defaultView}\n hideOutOfMonthDates={hideOutOfMonthDates}\n hideWeekdays={hideWeekdays}\n renderDay={renderDay}\n weekendDays={weekendDays}\n yearLabelFormat={yearLabelFormat}\n onChange={(date) => handleValueChange(date as [Date, Date])}\n />\n </BasePicker>\n )\n}\n\nexport default DatePickerRange\n"],"names":["validationRule","val","v","isFirstDateSet","DatePickerRange","props","className","clearable","clearButton","closePickerOnChange","dateViewCount","dayClassName","dayStyle","defaultMonth","defaultOpen","defaultValue","defaultView","disabled","disableDate","enableHeaderLabel","disableOutOfMonth","firstDayOfWeek","hideOutOfMonthDates","hideWeekdays","inputFormat","inputPrefix","inputSuffix","labelFormat","separator","locale","maxDate","minDate","onChange","onDropdownClose","onDropdownOpen","openPickerOnClear","ref","renderDay","singleDate","size","style","value","weekendDays","yearLabelFormat","rest","themeLocale","useConfig","finalLocale","dateFormat","dropdownOpened","setDropdownOpened","useState","inputRef","useRef","_value","setValue","useControllableState","handleValueChange","range","_a","valueValid","firstValueValid","firstDateLabel","capitalize","dayjs","secondDateLabel","handleClear","handleDropdownToggle","isOpened","jsx","BasePicker","useMergedRef","RangeCalendar","date"],"mappings":";;;;;;;;;;AAwCA,MAAMA,IAAiB,CAACC,MACpB,MAAM,QAAQA,CAAG,KACjBA,EAAI,WAAW,KACfA,EAAI,MAAM,CAACC,MAAMA,aAAa,IAAI,GAEhCC,KAAiB,CAACF,MACpB,MAAM,QAAQA,CAAG,KAAKA,EAAI,WAAW,KAAKA,EAAI,CAAC,aAAa,MAE1DG,KAAkB,CAACC,MAAgC;AACrD,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,aAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,eAAAC,IAAgB;AAAA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AAA,EAAS,KAAKzC;AAAA,UAC1C,OAAOyC;AAAA,UACP,aAAA3B;AAAA,UACA,cAAAhB;AAAA,UACA,UAAAC;AAAA,UACA,mBAAAQ;AAAA,UACA,SAAAW;AAAA,UACA,SAAAD;AAAA,UACA,aAAAZ;AAAA,UACA,gBAAAG;AAAA,UACA,mBAAAF;AAAA,UACA,YAAAmB;AAAA,UACA,eAAA5B;AAAA,UACA,aAAAM;AAAA,UACA,qBAAAM;AAAA,UACA,cAAAC;AAAA,UACA,WAAAc;AAAA,UACA,aAAAK;AAAA,UACA,iBAAAC;AAAA,UACA,UAAU,CAAC8B,MAAShB,GAAkBgB,CAAoB;AAAA,QAAA;AAAA,MAAA;AAAA,IAC9D;AAAA,EAAA;AAGZ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimepicker.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/DateTimepicker.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\r\nimport dayjs from 'dayjs'\r\nimport useControllableState from '../hooks/useControllableState'\r\nimport useMergedRef from '../hooks/useMergeRef'\r\nimport capitalize from '../utils/capitalize'\r\nimport TimeInput from '../TimeInput/TimeInput'\r\nimport Calendar from './Calendar'\r\nimport BasePicker from './BasePicker'\r\nimport Button from '../Button/Button'\r\nimport { useConfig } from '../ConfigProvider'\r\nimport type { CommonProps } from '../@types/common'\r\nimport type { CalendarSharedProps } from './CalendarBase'\r\nimport type { BasePickerSharedProps } from './BasePicker'\r\nimport type { FocusEvent, ChangeEvent, Ref } from 'react'\r\n\r\nexport interface DateTimepickerProps\r\n extends CommonProps,\r\n Omit<\r\n CalendarSharedProps,\r\n | 'onMonthChange'\r\n | 'onChange'\r\n | 'isDateInRange'\r\n | 'isDateFirstInRange'\r\n | 'isDateLastInRange'\r\n | 'month'\r\n >,\r\n BasePickerSharedProps {\r\n closePickerOnChange?: boolean\r\n defaultOpen?: boolean\r\n defaultValue?: Date | null\r\n value?: Date | null\r\n inputFormat?: string\r\n openPickerOnClear?: boolean\r\n onChange?: (value: Date | null) => void\r\n ref?: Ref<HTMLInputElement>\r\n amPm?: boolean\r\n okButtonContent?: boolean\r\n}\r\n\r\nconst DEFAULT_INPUT_FORMAT = 'DD-MMM-YYYY hh:mm a'\r\n\r\nconst DateTimepicker = (props: DateTimepickerProps) => {\r\n const {\r\n amPm = true,\r\n className,\r\n clearable = true,\r\n closePickerOnChange = false,\r\n dateViewCount,\r\n dayClassName,\r\n dayStyle,\r\n defaultMonth,\r\n defaultOpen = false,\r\n defaultValue,\r\n defaultView,\r\n disabled = false,\r\n disableDate,\r\n enableHeaderLabel,\r\n disableOutOfMonth,\r\n firstDayOfWeek = 'monday',\r\n hideOutOfMonthDates,\r\n hideWeekdays,\r\n inputFormat,\r\n inputPrefix,\r\n inputSuffix,\r\n inputtable,\r\n labelFormat = {\r\n month: 'MMM',\r\n year: 'YYYY',\r\n },\r\n locale,\r\n maxDate,\r\n minDate,\r\n name = 'dateTime',\r\n okButtonContent = 'OK',\r\n onBlur,\r\n onChange,\r\n onFocus,\r\n onDropdownClose,\r\n onDropdownOpen,\r\n openPickerOnClear,\r\n ref = null,\r\n renderDay,\r\n size,\r\n value,\r\n weekendDays,\r\n yearLabelFormat,\r\n ...rest\r\n } = props\r\n\r\n const { locale: themeLocale } = useConfig()\r\n\r\n const finalLocale = locale || themeLocale\r\n\r\n const dateFormat = inputFormat || DEFAULT_INPUT_FORMAT\r\n\r\n const [dropdownOpened, setDropdownOpened] = useState(defaultOpen)\r\n\r\n const inputRef = useRef<HTMLInputElement>(null)\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const [_, setLastValidValue] = useState(defaultValue ?? null)\r\n const [_value, setValue] = useControllableState({\r\n prop: value,\r\n defaultProp: defaultValue,\r\n onChange,\r\n })\r\n\r\n const [calendarMonth, setCalendarMonth] = useState(\r\n _value || defaultMonth || new Date(),\r\n )\r\n\r\n const [focused, setFocused] = useState(false)\r\n const [inputState, setInputState] = useState(\r\n _value instanceof Date\r\n ? capitalize(dayjs(_value).locale(finalLocale).format(dateFormat))\r\n : '',\r\n )\r\n\r\n const closeDropdown = () => {\r\n setDropdownOpened(false)\r\n onDropdownClose?.()\r\n }\r\n\r\n const openDropdown = () => {\r\n setDropdownOpened(true)\r\n onDropdownOpen?.()\r\n }\r\n\r\n useEffect(() => {\r\n if (value === null && !focused) {\r\n setInputState('')\r\n }\r\n\r\n if (value instanceof Date && !focused) {\r\n setInputState(dayjs(value).locale(finalLocale).format(dateFormat))\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [value, focused])\r\n\r\n const handleValueChange = (date: Date) => {\r\n if (_value) {\r\n date.setHours(_value.getHours())\r\n date.setMinutes(_value.getMinutes())\r\n } else {\r\n const now = new Date(Date.now())\r\n date.setHours(now.getHours())\r\n date.setMinutes(now.getMinutes())\r\n }\r\n setValue(date)\r\n if (!value && !closePickerOnChange) {\r\n setInputState(dayjs(date).locale(finalLocale).format(dateFormat))\r\n }\r\n closePickerOnChange &&\r\n setInputState(\r\n capitalize(dayjs(date).locale(finalLocale).format(dateFormat)),\r\n )\r\n closePickerOnChange && closeDropdown()\r\n window.setTimeout(() => inputRef.current?.focus(), 0)\r\n }\r\n\r\n const handleClear = () => {\r\n setValue(null)\r\n setLastValidValue(null)\r\n setInputState('')\r\n openPickerOnClear && openDropdown()\r\n inputRef.current?.focus()\r\n onChange?.(null)\r\n }\r\n\r\n const parseDate = (date: string) =>\r\n dayjs(date, dateFormat, finalLocale).toDate()\r\n\r\n const handleInputBlur = (event: FocusEvent<HTMLInputElement, Element>) => {\r\n typeof onBlur === 'function' && onBlur(event)\r\n setFocused(false)\r\n }\r\n\r\n const handleInputFocus = (event: FocusEvent<HTMLInputElement, Element>) => {\r\n typeof onFocus === 'function' && onFocus(event)\r\n setFocused(true)\r\n }\r\n\r\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\r\n openDropdown()\r\n\r\n const date = parseDate(event.target.value)\r\n if (dayjs(date).isValid()) {\r\n setValue(date)\r\n setLastValidValue(date)\r\n closePickerOnChange && setInputState(event.target.value)\r\n setCalendarMonth(date)\r\n } else {\r\n closePickerOnChange && setInputState(event.target.value)\r\n }\r\n }\r\n\r\n const handleTimeChange = (time: Date | null) => {\r\n if (_value instanceof Date && time instanceof Date) {\r\n const newDateTime = new Date(\r\n _value.getFullYear(),\r\n _value.getMonth(),\r\n _value.getDate(),\r\n time.getHours(),\r\n time.getMinutes(),\r\n time.getSeconds(),\r\n time.getMilliseconds(),\r\n )\r\n setValue(newDateTime)\r\n\r\n if (!value && !closePickerOnChange) {\r\n setInputState(\r\n capitalize(\r\n dayjs(newDateTime)\r\n .locale(finalLocale)\r\n .format(dateFormat),\r\n ),\r\n )\r\n }\r\n\r\n closePickerOnChange &&\r\n setInputState(\r\n capitalize(\r\n dayjs(newDateTime)\r\n .locale(finalLocale)\r\n .format(dateFormat),\r\n ),\r\n )\r\n }\r\n closePickerOnChange && closeDropdown()\r\n }\r\n\r\n const handleOk = () => {\r\n setInputState(\r\n capitalize(dayjs(_value).locale(finalLocale).format(dateFormat)),\r\n )\r\n closeDropdown()\r\n window.setTimeout(() => inputRef.current?.focus(), 0)\r\n onChange?.(_value as Date | null)\r\n }\r\n\r\n return (\r\n <BasePicker\r\n ref={useMergedRef(ref, inputRef)}\r\n dropdownOpened={dropdownOpened as boolean}\r\n setDropdownOpened={setDropdownOpened}\r\n className={className}\r\n name={name}\r\n inputLabel={inputState}\r\n clearable={clearable && !!_value && !disabled}\r\n disabled={disabled}\r\n size={size}\r\n inputPrefix={inputPrefix}\r\n inputSuffix={inputSuffix}\r\n onChange={handleChange}\r\n onBlur={handleInputBlur}\r\n onFocus={handleInputFocus}\r\n onClear={handleClear}\r\n onDropdownClose={onDropdownClose}\r\n onDropdownOpen={onDropdownOpen}\r\n {...rest}\r\n >\r\n <Calendar\r\n locale={finalLocale}\r\n month={inputtable ? calendarMonth : undefined}\r\n defaultMonth={\r\n defaultMonth ||\r\n (_value instanceof Date ? _value : new Date())\r\n }\r\n value={\r\n _value instanceof Date\r\n ? _value\r\n : _value && dayjs(_value).toDate()\r\n }\r\n labelFormat={labelFormat}\r\n dayClassName={dayClassName}\r\n dayStyle={dayStyle}\r\n disableOutOfMonth={disableOutOfMonth}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n disableDate={disableDate}\r\n firstDayOfWeek={firstDayOfWeek}\r\n preventFocus={false}\r\n dateViewCount={dateViewCount}\r\n enableHeaderLabel={enableHeaderLabel}\r\n defaultView={defaultView}\r\n hideOutOfMonthDates={hideOutOfMonthDates}\r\n hideWeekdays={hideWeekdays}\r\n renderDay={renderDay}\r\n weekendDays={weekendDays}\r\n yearLabelFormat={yearLabelFormat}\r\n onMonthChange={setCalendarMonth}\r\n onChange={handleValueChange}\r\n />\r\n <div className=\"flex items-center gap-4 mt-4\">\r\n <TimeInput\r\n disabled={!_value}\r\n value={_value}\r\n format={amPm ? '12' : '24'}\r\n clearable={false}\r\n size=\"sm\"\r\n onChange={handleTimeChange}\r\n />\r\n <Button size=\"sm\" disabled={!_value} onClick={handleOk}>\r\n {okButtonContent}\r\n </Button>\r\n </div>\r\n </BasePicker>\r\n )\r\n}\r\n\r\nDateTimepicker.displayName = 'DateTimepicker'\r\n\r\nexport default DateTimepicker\r\n"],"names":["DEFAULT_INPUT_FORMAT","DateTimepicker","props","amPm","className","clearable","closePickerOnChange","dateViewCount","dayClassName","dayStyle","defaultMonth","defaultOpen","defaultValue","defaultView","disabled","disableDate","enableHeaderLabel","disableOutOfMonth","firstDayOfWeek","hideOutOfMonthDates","hideWeekdays","inputFormat","inputPrefix","inputSuffix","inputtable","labelFormat","locale","maxDate","minDate","name","okButtonContent","onBlur","onChange","onFocus","onDropdownClose","onDropdownOpen","openPickerOnClear","ref","renderDay","size","value","weekendDays","yearLabelFormat","rest","themeLocale","useConfig","finalLocale","dateFormat","dropdownOpened","setDropdownOpened","useState","inputRef","useRef","_","setLastValidValue","_value","setValue","useControllableState","calendarMonth","setCalendarMonth","focused","setFocused","inputState","setInputState","capitalize","dayjs","closeDropdown","openDropdown","useEffect","handleValueChange","date","now","_a","handleClear","parseDate","handleInputBlur","event","handleInputFocus","handleChange","handleTimeChange","time","newDateTime","handleOk","jsxs","BasePicker","useMergedRef","jsx","Calendar","TimeInput","Button"],"mappings":";;;;;;;;;;;;AAuCA,MAAMA,KAAuB,uBAEvBC,KAAiB,CAACC,MAA+B;AACnD,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,WAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,qBAAAC,IAAsB;AAAA,IACtB,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,aAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,qBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,MACV,OAAO;AAAA,MACP,MAAM;AAAA,IAAA;AAAA,IAEV,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,iBAAAC,KAAkB;AAAA,IAClB,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,KAAAC,KAAM;AAAA,IACN,WAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHzC,GAEE,EAAE,QAAQ0C,GAAA,IAAgBC,GAAA,GAE1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AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAA2C;AAAA,UAACC;AAAA,UAAA;AAAA,YACG,QAAQzC;AAAA,YACR,OAAOtB,IAAakC,KAAgB;AAAA,YACpC,cACIhD,MACC6C,aAAkB,OAAOA,wBAAa;YAE3C,OACIA,aAAkB,OACZA,IACAA,KAAUU,EAAMV,CAAM,EAAE,OAAA;AAAA,YAElC,aAAA9B;AAAA,YACA,cAAAjB;AAAA,YACA,UAAAC;AAAA,YACA,mBAAAQ;AAAA,YACA,SAAAW;AAAA,YACA,SAAAD;AAAA,YACA,aAAAZ;AAAA,YACA,gBAAAG;AAAA,YACA,cAAc;AAAA,YACd,eAAAX;AAAA,YACA,mBAAAS;AAAA,YACA,aAAAH;AAAA,YACA,qBAAAM;AAAA,YACA,cAAAC;AAAA,YACA,WAAAkB;AAAA,YACA,aAAAG;AAAA,YACA,iBAAAC;AAAA,YACA,eAAeiB;AAAA,YACf,UAAUU;AAAA,UAAA;AAAA,QAAA;AAAA,QAEd,gBAAAc,EAAC,OAAA,EAAI,WAAU,gCACX,UAAA;AAAA,UAAA,gBAAAG;AAAA,YAACE;AAAA,YAAA;AAAA,cACG,UAAU,CAACjC;AAAA,cACX,OAAOA;AAAA,cACP,QAAQpD,IAAO,OAAO;AAAA,cACtB,WAAW;AAAA,cACX,MAAK;AAAA,cACL,UAAU4E;AAAA,YAAA;AAAA,UAAA;AAAA,UAEd,gBAAAO,EAACG,MAAO,MAAK,MAAK,UAAU,CAAClC,GAAQ,SAAS2B,IACzC,UAAApD,GAAA,CACL;AAAA,QAAA,EAAA,CACJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;AAEA7B,GAAe,cAAc;"}
|
|
1
|
+
{"version":3,"file":"DateTimepicker.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/DateTimepicker.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\r\nimport dayjs from 'dayjs'\r\nimport useControllableState from '../hooks/useControllableState'\r\nimport useMergedRef from '../hooks/useMergeRef'\r\nimport capitalize from '../utils/capitalize'\r\nimport TimeInput from '../TimeInput/TimeInput'\r\nimport Calendar from './Calendar'\r\nimport BasePicker from './BasePicker'\r\nimport Button from '../Button/Button'\r\nimport { useConfig } from '../ConfigProvider'\r\nimport type { CommonProps } from '../@types/common'\r\nimport type { CalendarSharedProps } from './CalendarBase'\r\nimport type { BasePickerSharedProps } from './BasePicker'\r\nimport type { FocusEvent, ChangeEvent, Ref } from 'react'\r\n\r\nexport interface DateTimepickerProps\r\n extends CommonProps,\r\n Omit<\r\n CalendarSharedProps,\r\n | 'onMonthChange'\r\n | 'onChange'\r\n | 'isDateInRange'\r\n | 'isDateFirstInRange'\r\n | 'isDateLastInRange'\r\n | 'month'\r\n >,\r\n BasePickerSharedProps {\r\n closePickerOnChange?: boolean\r\n defaultOpen?: boolean\r\n defaultValue?: Date | null\r\n value?: Date | null\r\n inputFormat?: string\r\n openPickerOnClear?: boolean\r\n onChange?: (value: Date | null) => void\r\n ref?: Ref<HTMLInputElement>\r\n amPm?: boolean\r\n okButtonContent?: boolean\r\n}\r\n\r\nconst DEFAULT_INPUT_FORMAT = 'DD-MMM-YYYY hh:mm a'\r\n\r\nconst DateTimepicker = (props: DateTimepickerProps) => {\r\n const {\r\n amPm = true,\r\n className,\r\n clearable = true,\r\n closePickerOnChange = false,\r\n dateViewCount,\r\n dayClassName,\r\n dayStyle,\r\n defaultMonth,\r\n defaultOpen = false,\r\n defaultValue,\r\n defaultView,\r\n disabled = false,\r\n disableDate,\r\n enableHeaderLabel,\r\n disableOutOfMonth,\r\n firstDayOfWeek = 'monday',\r\n hideOutOfMonthDates,\r\n hideWeekdays,\r\n inputFormat,\r\n inputPrefix,\r\n inputSuffix,\r\n inputtable,\r\n labelFormat = {\r\n month: 'MMM',\r\n year: 'YYYY',\r\n },\r\n locale,\r\n maxDate,\r\n minDate,\r\n name = 'dateTime',\r\n okButtonContent = 'OK',\r\n onBlur,\r\n onChange,\r\n onFocus,\r\n onDropdownClose,\r\n onDropdownOpen,\r\n openPickerOnClear,\r\n ref = null,\r\n renderDay,\r\n size,\r\n value,\r\n weekendDays,\r\n yearLabelFormat,\r\n ...rest\r\n } = props\r\n\r\n const { locale: themeLocale } = useConfig()\r\n\r\n const finalLocale = locale || themeLocale\r\n\r\n const dateFormat = inputFormat || DEFAULT_INPUT_FORMAT\r\n\r\n const [dropdownOpened, setDropdownOpened] = useState(defaultOpen)\r\n\r\n const inputRef = useRef<HTMLInputElement>(null)\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const [_, setLastValidValue] = useState(defaultValue ?? null)\r\n const [_value, setValue] = useControllableState({\r\n prop: value,\r\n defaultProp: defaultValue,\r\n onChange,\r\n })\r\n\r\n const [calendarMonth, setCalendarMonth] = useState(\r\n _value || defaultMonth || new Date(),\r\n )\r\n\r\n const [focused, setFocused] = useState(false)\r\n const [inputState, setInputState] = useState(\r\n _value instanceof Date\r\n ? capitalize(dayjs(_value).locale(finalLocale).format(dateFormat))\r\n : '',\r\n )\r\n\r\n const closeDropdown = () => {\r\n setDropdownOpened(false)\r\n onDropdownClose?.()\r\n }\r\n\r\n const openDropdown = () => {\r\n setDropdownOpened(true)\r\n onDropdownOpen?.()\r\n }\r\n\r\n useEffect(() => {\r\n if (value === null && !focused) {\r\n setInputState('')\r\n }\r\n\r\n if (value instanceof Date && !focused) {\r\n setInputState(dayjs(value).locale(finalLocale).format(dateFormat))\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [value, focused])\r\n\r\n const handleValueChange = (date: Date) => {\r\n if (_value) {\r\n date.setHours(_value.getHours())\r\n date.setMinutes(_value.getMinutes())\r\n } else {\r\n const now = new Date(Date.now())\r\n date.setHours(now.getHours())\r\n date.setMinutes(now.getMinutes())\r\n }\r\n setValue(date)\r\n if (!value && !closePickerOnChange) {\r\n setInputState(dayjs(date).locale(finalLocale).format(dateFormat))\r\n }\r\n closePickerOnChange &&\r\n setInputState(\r\n capitalize(dayjs(date).locale(finalLocale).format(dateFormat)),\r\n )\r\n closePickerOnChange && closeDropdown()\r\n window.setTimeout(() => inputRef.current?.focus(), 0)\r\n }\r\n\r\n const handleClear = () => {\r\n setValue(null)\r\n setLastValidValue(null)\r\n setInputState('')\r\n openPickerOnClear && openDropdown()\r\n inputRef.current?.focus()\r\n onChange?.(null)\r\n }\r\n\r\n const parseDate = (date: string) =>\r\n dayjs(date, dateFormat, finalLocale).toDate()\r\n\r\n const handleInputBlur = (event: FocusEvent<HTMLInputElement, Element>) => {\r\n typeof onBlur === 'function' && onBlur(event)\r\n setFocused(false)\r\n }\r\n\r\n const handleInputFocus = (event: FocusEvent<HTMLInputElement, Element>) => {\r\n typeof onFocus === 'function' && onFocus(event)\r\n setFocused(true)\r\n }\r\n\r\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\r\n openDropdown()\r\n\r\n const date = parseDate(event.target.value)\r\n if (dayjs(date).isValid()) {\r\n setValue(date)\r\n setLastValidValue(date)\r\n closePickerOnChange && setInputState(event.target.value)\r\n setCalendarMonth(date)\r\n } else {\r\n closePickerOnChange && setInputState(event.target.value)\r\n }\r\n }\r\n\r\n const handleTimeChange = (time: Date | null) => {\r\n if (_value instanceof Date && time instanceof Date) {\r\n const newDateTime = new Date(\r\n _value.getFullYear(),\r\n _value.getMonth(),\r\n _value.getDate(),\r\n time.getHours(),\r\n time.getMinutes(),\r\n time.getSeconds(),\r\n time.getMilliseconds(),\r\n )\r\n setValue(newDateTime)\r\n\r\n if (!value && !closePickerOnChange) {\r\n setInputState(\r\n capitalize(\r\n dayjs(newDateTime)\r\n .locale(finalLocale)\r\n .format(dateFormat),\r\n ),\r\n )\r\n }\r\n\r\n closePickerOnChange &&\r\n setInputState(\r\n capitalize(\r\n dayjs(newDateTime)\r\n .locale(finalLocale)\r\n .format(dateFormat),\r\n ),\r\n )\r\n }\r\n closePickerOnChange && closeDropdown()\r\n }\r\n\r\n const handleOk = () => {\r\n setInputState(\r\n capitalize(dayjs(_value).locale(finalLocale).format(dateFormat)),\r\n )\r\n closeDropdown()\r\n window.setTimeout(() => inputRef.current?.focus(), 0)\r\n onChange?.(_value as Date | null)\r\n }\r\n\r\n return (\r\n <BasePicker\r\n ref={useMergedRef(ref, inputRef)}\r\n dropdownOpened={dropdownOpened as boolean}\r\n setDropdownOpened={setDropdownOpened}\r\n className={className}\r\n name={name}\r\n inputLabel={inputState}\r\n clearable={clearable && !!_value && !disabled}\r\n disabled={disabled}\r\n size={size}\r\n inputPrefix={inputPrefix}\r\n inputSuffix={inputSuffix}\r\n onChange={handleChange}\r\n onBlur={handleInputBlur}\r\n onFocus={handleInputFocus}\r\n onClear={handleClear}\r\n onDropdownClose={onDropdownClose}\r\n onDropdownOpen={onDropdownOpen}\r\n {...rest}\r\n >\r\n <Calendar\r\n locale={finalLocale}\r\n month={inputtable ? calendarMonth : undefined}\r\n defaultMonth={\r\n defaultMonth ||\r\n (_value instanceof Date ? _value : new Date())\r\n }\r\n value={\r\n _value instanceof Date\r\n ? _value\r\n : _value && dayjs(_value).toDate()\r\n }\r\n labelFormat={labelFormat}\r\n dayClassName={dayClassName}\r\n dayStyle={dayStyle}\r\n disableOutOfMonth={disableOutOfMonth}\r\n minDate={minDate}\r\n maxDate={maxDate}\r\n disableDate={disableDate}\r\n firstDayOfWeek={firstDayOfWeek}\r\n preventFocus={false}\r\n dateViewCount={dateViewCount}\r\n enableHeaderLabel={enableHeaderLabel}\r\n defaultView={defaultView}\r\n hideOutOfMonthDates={hideOutOfMonthDates}\r\n hideWeekdays={hideWeekdays}\r\n renderDay={renderDay}\r\n weekendDays={weekendDays}\r\n yearLabelFormat={yearLabelFormat}\r\n onMonthChange={setCalendarMonth}\r\n onChange={handleValueChange}\r\n />\r\n <div className=\"flex items-center gap-4 mt-4\">\r\n <TimeInput\r\n disabled={!_value}\r\n value={_value}\r\n format={amPm ? '12' : '24'}\r\n clearable={false}\r\n size=\"sm\"\r\n onChange={handleTimeChange}\r\n />\r\n <Button size=\"sm\" disabled={!_value} onClick={handleOk}>\r\n {okButtonContent}\r\n </Button>\r\n </div>\r\n </BasePicker>\r\n )\r\n}\r\n\r\nDateTimepicker.displayName = 'DateTimepicker'\r\n\r\nexport default DateTimepicker\r\n"],"names":["DEFAULT_INPUT_FORMAT","DateTimepicker","props","amPm","className","clearable","closePickerOnChange","dateViewCount","dayClassName","dayStyle","defaultMonth","defaultOpen","defaultValue","defaultView","disabled","disableDate","enableHeaderLabel","disableOutOfMonth","firstDayOfWeek","hideOutOfMonthDates","hideWeekdays","inputFormat","inputPrefix","inputSuffix","inputtable","labelFormat","locale","maxDate","minDate","name","okButtonContent","onBlur","onChange","onFocus","onDropdownClose","onDropdownOpen","openPickerOnClear","ref","renderDay","size","value","weekendDays","yearLabelFormat","rest","themeLocale","useConfig","finalLocale","dateFormat","dropdownOpened","setDropdownOpened","useState","inputRef","useRef","_","setLastValidValue","_value","setValue","useControllableState","calendarMonth","setCalendarMonth","focused","setFocused","inputState","setInputState","capitalize","dayjs","closeDropdown","openDropdown","useEffect","handleValueChange","date","now","_a","handleClear","parseDate","handleInputBlur","event","handleInputFocus","handleChange","handleTimeChange","time","newDateTime","handleOk","jsxs","BasePicker","useMergedRef","jsx","Calendar","TimeInput","Button"],"mappings":";;;;;;;;;;;;AAuCA,MAAMA,KAAuB,uBAEvBC,KAAiB,CAACC,MAA+B;AACnD,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,WAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,qBAAAC,IAAsB;AAAA,IACtB,eAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,aAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,qBAAAC;AAAA,IACA,cAAAC;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BAAAG;AAAA,YAACE;AAAA,YAAA;AAAA,cACG,UAAU,CAACjC;AAAA,cACX,OAAOA;AAAA,cACP,QAAQpD,IAAO,OAAO;AAAA,cACtB,WAAW;AAAA,cACX,MAAK;AAAA,cACL,UAAU4E;AAAA,YAAA;AAAA,UAAA;AAAA,UAEd,gBAAAO,EAACG,MAAO,MAAK,MAAK,UAAU,CAAClC,GAAQ,SAAS2B,IACzC,UAAApD,GAAA,CACL;AAAA,QAAA,EAAA,CACJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;AAEA7B,GAAe,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeCalendar.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/RangeCalendar.tsx"],"sourcesContent":["import { useState } from 'react'\nimport dayjs from 'dayjs'\nimport { isSameDate } from './utils/isSameDate'\nimport CalendarBase from './CalendarBase'\nimport type { CommonProps } from '../@types/common'\nimport type { CalendarSharedProps } from './CalendarBase'\nimport type { Modifiers } from './tables/components/types'\nimport type { Ref } from 'react'\n\nexport interface RangeCalendarProps\n extends CommonProps,\n Omit<\n CalendarSharedProps,\n | 'value'\n | 'isDateInRange'\n | 'isDateFirstInRange'\n | 'isDateLastInRange'\n > {\n value: [Date | null, Date | null]\n onChange: (value: [Date | null, Date | null]) => void\n ref?: Ref<HTMLDivElement>\n singleDate?: boolean\n}\n\nconst RangeCalendar = (props: RangeCalendarProps) => {\n const {\n value,\n onChange,\n dayStyle,\n singleDate = false,\n dateViewCount = 1,\n paginateBy,\n ref,\n ...rest\n } = props\n\n const [hoveredDay, setHoveredDay] = useState<Date | null>(null)\n const [pickedDate, setPickedDate] = useState<Date | null>(null)\n\n const setRangeDate = (date: Date) => {\n if (pickedDate instanceof Date) {\n if (isSameDate(date, pickedDate) && !singleDate) {\n setPickedDate(null)\n setHoveredDay(null)\n return null\n }\n\n const result: [Date, Date] = [date, pickedDate]\n result.sort((a, b) => a.getTime() - b.getTime())\n onChange(result)\n setPickedDate(null)\n return null\n }\n\n if (value[0] && isSameDate(date, value[0]) && !singleDate) {\n setPickedDate(null)\n setHoveredDay(null)\n onChange([null, null])\n return null\n }\n\n onChange([date, null])\n setPickedDate(date)\n return null\n }\n\n const shouldHighlightDate = (date: Date, modifiers: Modifiers) => {\n if (pickedDate instanceof Date && hoveredDay instanceof Date) {\n const result = [hoveredDay, pickedDate]\n result.sort((a, b) => a.getTime() - b.getTime())\n return (\n !modifiers.selected &&\n dayjs(date).subtract(1, 'day').isBefore(result[1]) &&\n dayjs(date).add(1, 'day').isAfter(result[0])\n )\n }\n\n return false\n }\n\n const isPickedDateFirstInRange = (date: Date, modifiers: Modifiers) => {\n if (pickedDate instanceof Date && hoveredDay instanceof Date) {\n const result = [hoveredDay, pickedDate]\n result.sort((a, b) => a.getTime() - b.getTime())\n return modifiers.selected && dayjs(date).isBefore(result[1])\n }\n\n return false\n }\n\n const isPickedDateLastInRange = (date: Date, modifiers: Modifiers) => {\n if (pickedDate instanceof Date && hoveredDay instanceof Date) {\n const result = [hoveredDay, pickedDate]\n result.sort((a, b) => a.getTime() - b.getTime())\n return modifiers.selected && dayjs(date).isAfter(result[0])\n }\n\n return false\n }\n\n return (\n <CalendarBase\n ref={ref}\n dayStyle={dayStyle}\n value={pickedDate}\n range={value as [Date, Date]}\n dateViewCount={dateViewCount}\n paginateBy={paginateBy || dateViewCount}\n hideOutOfMonthDates={(dateViewCount as number) > 1}\n isDateInRange={shouldHighlightDate}\n isDateFirstInRange={isPickedDateFirstInRange}\n isDateLastInRange={isPickedDateLastInRange}\n onDayMouseEnter={(date) => setHoveredDay(date)}\n onChange={(date) => setRangeDate(date as Date)}\n {...rest}\n />\n )\n}\n\nexport default RangeCalendar\n"],"names":["RangeCalendar","props","value","onChange","dayStyle","singleDate","dateViewCount","paginateBy","ref","rest","hoveredDay","setHoveredDay","useState","pickedDate","setPickedDate","setRangeDate","date","isSameDate","result","a","b","shouldHighlightDate","modifiers","dayjs","isPickedDateFirstInRange","isPickedDateLastInRange","jsx","CalendarBase"],"mappings":";;;;;AAwBA,MAAMA,IAAgB,CAACC,MAA8B;AACjD,QAAM;AAAA,IACF,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,eAAAC,IAAgB;AAAA,IAChB,YAAAC;AAAA,IACA,KAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHR,GAEE,CAACS,GAAYC,CAAa,IAAIC,EAAsB,IAAI,GACxD,CAACC,GAAYC,CAAa,IAAIF,EAAsB,IAAI,GAExDG,IAAe,CAACC,MAAe;AACjC,QAAIH,aAAsB,MAAM;AAC5B,UAAII,EAAWD,GAAMH,CAAU,KAAK,CAACR;AACjC,eAAAS,EAAc,IAAI,GAClBH,EAAc,IAAI,GACX;AAGX,YAAMO,IAAuB,CAACF,GAAMH,CAAU;AAC9C,aAAAK,EAAO,KAAK,CAACC,GAAGC,MAAMD,EAAE,QAAA,IAAYC,EAAE,SAAS,GAC/CjB,EAASe,CAAM,GACfJ,EAAc,IAAI,GACX;AAAA,
|
|
1
|
+
{"version":3,"file":"RangeCalendar.js","sources":["../../../../../lib/@ecme/components/ui/DatePicker/RangeCalendar.tsx"],"sourcesContent":["import { useState } from 'react'\nimport dayjs from 'dayjs'\nimport { isSameDate } from './utils/isSameDate'\nimport CalendarBase from './CalendarBase'\nimport type { CommonProps } from '../@types/common'\nimport type { CalendarSharedProps } from './CalendarBase'\nimport type { Modifiers } from './tables/components/types'\nimport type { Ref } from 'react'\n\nexport interface RangeCalendarProps\n extends CommonProps,\n Omit<\n CalendarSharedProps,\n | 'value'\n | 'isDateInRange'\n | 'isDateFirstInRange'\n | 'isDateLastInRange'\n > {\n value: [Date | null, Date | null]\n onChange: (value: [Date | null, Date | null]) => void\n ref?: Ref<HTMLDivElement>\n singleDate?: boolean\n}\n\nconst RangeCalendar = (props: RangeCalendarProps) => {\n const {\n value,\n onChange,\n dayStyle,\n singleDate = false,\n dateViewCount = 1,\n paginateBy,\n ref,\n ...rest\n } = props\n\n const [hoveredDay, setHoveredDay] = useState<Date | null>(null)\n const [pickedDate, setPickedDate] = useState<Date | null>(null)\n\n const setRangeDate = (date: Date) => {\n if (pickedDate instanceof Date) {\n if (isSameDate(date, pickedDate) && !singleDate) {\n setPickedDate(null)\n setHoveredDay(null)\n return null\n }\n\n const result: [Date, Date] = [date, pickedDate]\n result.sort((a, b) => a.getTime() - b.getTime())\n onChange(result)\n setPickedDate(null)\n return null\n }\n\n if (value[0] && isSameDate(date, value[0]) && !singleDate) {\n setPickedDate(null)\n setHoveredDay(null)\n onChange([null, null])\n return null\n }\n\n onChange([date, null])\n setPickedDate(date)\n return null\n }\n\n const shouldHighlightDate = (date: Date, modifiers: Modifiers) => {\n if (pickedDate instanceof Date && hoveredDay instanceof Date) {\n const result = [hoveredDay, pickedDate]\n result.sort((a, b) => a.getTime() - b.getTime())\n return (\n !modifiers.selected &&\n dayjs(date).subtract(1, 'day').isBefore(result[1]) &&\n dayjs(date).add(1, 'day').isAfter(result[0])\n )\n }\n\n return false\n }\n\n const isPickedDateFirstInRange = (date: Date, modifiers: Modifiers) => {\n if (pickedDate instanceof Date && hoveredDay instanceof Date) {\n const result = [hoveredDay, pickedDate]\n result.sort((a, b) => a.getTime() - b.getTime())\n return modifiers.selected && dayjs(date).isBefore(result[1])\n }\n\n return false\n }\n\n const isPickedDateLastInRange = (date: Date, modifiers: Modifiers) => {\n if (pickedDate instanceof Date && hoveredDay instanceof Date) {\n const result = [hoveredDay, pickedDate]\n result.sort((a, b) => a.getTime() - b.getTime())\n return modifiers.selected && dayjs(date).isAfter(result[0])\n }\n\n return false\n }\n\n return (\n <CalendarBase\n ref={ref}\n dayStyle={dayStyle}\n value={pickedDate}\n range={value as [Date, Date]}\n dateViewCount={dateViewCount}\n paginateBy={paginateBy || dateViewCount}\n hideOutOfMonthDates={(dateViewCount as number) > 1}\n isDateInRange={shouldHighlightDate}\n isDateFirstInRange={isPickedDateFirstInRange}\n isDateLastInRange={isPickedDateLastInRange}\n onDayMouseEnter={(date) => setHoveredDay(date)}\n onChange={(date) => setRangeDate(date as Date)}\n {...rest}\n />\n )\n}\n\nexport default RangeCalendar\n"],"names":["RangeCalendar","props","value","onChange","dayStyle","singleDate","dateViewCount","paginateBy","ref","rest","hoveredDay","setHoveredDay","useState","pickedDate","setPickedDate","setRangeDate","date","isSameDate","result","a","b","shouldHighlightDate","modifiers","dayjs","isPickedDateFirstInRange","isPickedDateLastInRange","jsx","CalendarBase"],"mappings":";;;;;AAwBA,MAAMA,IAAgB,CAACC,MAA8B;AACjD,QAAM;AAAA,IACF,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,eAAAC,IAAgB;AAAA,IAChB,YAAAC;AAAA,IACA,KAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHR,GAEE,CAACS,GAAYC,CAAa,IAAIC,EAAsB,IAAI,GACxD,CAACC,GAAYC,CAAa,IAAIF,EAAsB,IAAI,GAExDG,IAAe,CAACC,MAAe;AACjC,QAAIH,aAAsB,MAAM;AAC5B,UAAII,EAAWD,GAAMH,CAAU,KAAK,CAACR;AACjC,eAAAS,EAAc,IAAI,GAClBH,EAAc,IAAI,GACX;AAGX,YAAMO,IAAuB,CAACF,GAAMH,CAAU;AAC9C,aAAAK,EAAO,KAAK,CAACC,GAAGC,MAAMD,EAAE,QAAA,IAAYC,EAAE,SAAS,GAC/CjB,EAASe,CAAM,GACfJ,EAAc,IAAI,GACX;AAAA,IACX;AAEA,WAAIZ,EAAM,CAAC,KAAKe,EAAWD,GAAMd,EAAM,CAAC,CAAC,KAAK,CAACG,KAC3CS,EAAc,IAAI,GAClBH,EAAc,IAAI,GAClBR,EAAS,CAAC,MAAM,IAAI,CAAC,GACd,SAGXA,EAAS,CAACa,GAAM,IAAI,CAAC,GACrBF,EAAcE,CAAI,GACX;AAAA,EACX,GAEMK,IAAsB,CA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nB,iBAAiB,CAACT,MAASL,EAAcK,CAAI;AAAA,MAC7C,UAAU,CAACA,MAASD,EAAaC,CAAY;AAAA,MAC5C,GAAGP;AAAA,IAAA;AAAA,EAAA;AAGhB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTable.js","sources":["../../../../../../lib/@ecme/components/ui/DatePicker/tables/DateTable.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport dayjs from 'dayjs'\nimport { isMonthInRange } from '../utils/isMonthInRange'\nimport Header from './Header'\nimport Month from './components/Month'\nimport capitalize from '../../utils/capitalize'\nimport type { CommonProps } from '../../@types/common'\nimport type { MonthBaseProps } from './components/Month'\nimport type { DayKeydownPayload } from './components/types'\nimport type { RefObject } from 'react'\n\nexport interface DateTableProps extends CommonProps, MonthBaseProps {\n dateViewCount: number\n paginateBy: number\n locale: string\n enableHeaderLabel: boolean\n daysRefs: RefObject<HTMLButtonElement[][][] | null>\n onMonthChange: (month: Date) => void\n onNextLevel: (unit: 'month' | 'year') => void\n onDayKeyDown: (\n monthIndex: number,\n payload: DayKeydownPayload,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => void\n labelFormat?: { month: string; year: string }\n weekdayLabelFormat?: string\n onChange?: (value: Date) => void\n onDayMouseEnter?: (date: Date, event: React.MouseEvent) => void\n preventFocus?: boolean\n renderDay?: (date: Date) => React.ReactNode\n range?: [Date, Date]\n}\n\nfunction formatMonthLabel({\n month,\n locale,\n format,\n}: {\n month: Date\n locale: string\n format: string\n}) {\n return capitalize(dayjs(month).locale(locale).format(format))\n}\n\nconst DateTable = (props: DateTableProps) => {\n const {\n dateViewCount,\n paginateBy,\n month,\n locale,\n minDate,\n maxDate,\n enableHeaderLabel,\n daysRefs,\n onMonthChange,\n onNextLevel,\n onDayKeyDown,\n className,\n labelFormat,\n weekdayLabelFormat,\n preventFocus,\n renderDay,\n ...rest\n } = props\n\n const nextMonth = dayjs(month).add(dateViewCount, 'months').toDate()\n const previousMonth = dayjs(month).subtract(1, 'months').toDate()\n\n const pickerHeaderLabelClass = 'picker-header-label hover:text-primary'\n\n const months = Array(dateViewCount)\n .fill(0)\n .map((_, index) => {\n const monthDate = dayjs(month).add(index, 'months').toDate()\n return (\n <div key={index} className=\"day-picker\">\n <Header\n hasNext={\n index + 1 === dateViewCount &&\n isMonthInRange({\n date: nextMonth,\n minDate,\n maxDate,\n })\n }\n hasPrevious={\n index === 0 &&\n isMonthInRange({\n date: previousMonth,\n minDate,\n maxDate,\n })\n }\n className={className}\n onNext={() =>\n onMonthChange(\n dayjs(month).add(paginateBy, 'months').toDate(),\n )\n }\n onPrevious={() =>\n onMonthChange(\n dayjs(month)\n .subtract(paginateBy, 'months')\n .toDate(),\n )\n }\n >\n <div>\n <button\n className={classNames(pickerHeaderLabelClass)}\n disabled={!enableHeaderLabel}\n tabIndex={index > 0 ? -1 : 0}\n type=\"button\"\n onClick={() => onNextLevel('month')}\n onMouseDown={(event) =>\n preventFocus && event.preventDefault()\n }\n >\n {formatMonthLabel({\n month: monthDate,\n locale,\n format: labelFormat?.month || 'MMM',\n })}\n </button>\n <button\n className={classNames(pickerHeaderLabelClass)}\n disabled={!enableHeaderLabel}\n tabIndex={index > 0 ? -1 : 0}\n type=\"button\"\n onClick={() => onNextLevel('year')}\n onMouseDown={(event) =>\n preventFocus && event.preventDefault()\n }\n >\n {formatMonthLabel({\n month: monthDate,\n locale,\n format: labelFormat?.year || 'YYYY',\n })}\n </button>\n </div>\n </Header>\n <Month\n month={monthDate}\n daysRefs={\n (daysRefs.current as HTMLButtonElement[][][])[index]\n }\n minDate={minDate}\n maxDate={maxDate}\n className={className}\n locale={locale}\n focusable={index === 0}\n preventFocus={preventFocus}\n renderDay={renderDay}\n weekdayLabelFormat={weekdayLabelFormat}\n onDayKeyDown={(...args) => onDayKeyDown(index, ...args)}\n {...rest}\n />\n </div>\n )\n })\n\n return <>{months}</>\n}\n\nexport default DateTable\n"],"names":["formatMonthLabel","month","locale","format","capitalize","dayjs","DateTable","props","dateViewCount","paginateBy","minDate","maxDate","enableHeaderLabel","daysRefs","onMonthChange","onNextLevel","onDayKeyDown","className","labelFormat","weekdayLabelFormat","preventFocus","renderDay","rest","nextMonth","previousMonth","pickerHeaderLabelClass","months","_","index","monthDate","jsxs","jsx","Header","isMonthInRange","classNames","event","Month","args"],"mappings":";;;;;;;AAiCA,SAASA,EAAiB;AAAA,EACtB,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACJ,GAIG;AACC,SAAOC,EAAWC,EAAMJ,CAAK,EAAE,OAAOC,CAAM,EAAE,OAAOC,CAAM,CAAC;AAChE;AAEA,MAAMG,IAAY,CAACC,MAA0B;AACzC,QAAM;AAAA,IACF,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAR;AAAA,IACA,QAAAC;AAAA,IACA,SAAAQ;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHf,GAEEgB,IAAYlB,EAAMJ,CAAK,EAAE,IAAIO,GAAe,QAAQ,EAAE,OAAA,GACtDgB,IAAgBnB,EAAMJ,CAAK,EAAE,SAAS,GAAG,QAAQ,EAAE,OAAA,GAEnDwB,IAAyB,0CAEzBC,IAAS,MAAMlB,CAAa,EAC7B,KAAK,CAAC,EACN,IAAI,CAACmB,GAAGC,MAAU;AACf,UAAMC,IAAYxB,EAAMJ,CAAK,EAAE,IAAI2B,GAAO,QAAQ,EAAE,OAAA;AACpD,WACI,gBAAAE,EAAC,OAAA,EAAgB,WAAU,cACvB,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACG,SACIJ,IAAQ,MAAMpB,KACdyB,EAAe;AAAA,YACX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AA,CAChC;AAAA,cAAA;AAAA,YAAA;AAAA,UACL,EAAA,CACJ;AAAA,QAAA;AAAA,MAAA;AAAA,MAEJ,gBAAAa;AAAA,QAACK;AAAA,QAAA;AAAA,UACG,OAAOP;AAAA,UACP,UACKhB,EAAS,QAAoCe,CAAK;AAAA,UAEvD,SAAAlB;AAAA,UACA,SAAAC;AAAA,UACA,WAAAM;AAAA,UACA,QAAAf;AAAA,UACA,WAAW0B,MAAU;AAAA,UACrB,cAAAR;AAAA,UACA,WAAAC;AAAA,UACA,oBAAAF;AAAA,UACA,cAAc,IAAIkB,MAASrB,EAAaY,GAAO,GAAGS,CAAI;AAAA,UACrD,GAAGf;AAAA,QAAA;AAAA,MAAA;AAAA,IACR,EAAA,GAlFMM,CAmFV;AAAA,
|
|
1
|
+
{"version":3,"file":"DateTable.js","sources":["../../../../../../lib/@ecme/components/ui/DatePicker/tables/DateTable.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport dayjs from 'dayjs'\nimport { isMonthInRange } from '../utils/isMonthInRange'\nimport Header from './Header'\nimport Month from './components/Month'\nimport capitalize from '../../utils/capitalize'\nimport type { CommonProps } from '../../@types/common'\nimport type { MonthBaseProps } from './components/Month'\nimport type { DayKeydownPayload } from './components/types'\nimport type { RefObject } from 'react'\n\nexport interface DateTableProps extends CommonProps, MonthBaseProps {\n dateViewCount: number\n paginateBy: number\n locale: string\n enableHeaderLabel: boolean\n daysRefs: RefObject<HTMLButtonElement[][][] | null>\n onMonthChange: (month: Date) => void\n onNextLevel: (unit: 'month' | 'year') => void\n onDayKeyDown: (\n monthIndex: number,\n payload: DayKeydownPayload,\n event: React.KeyboardEvent<HTMLButtonElement>,\n ) => void\n labelFormat?: { month: string; year: string }\n weekdayLabelFormat?: string\n onChange?: (value: Date) => void\n onDayMouseEnter?: (date: Date, event: React.MouseEvent) => void\n preventFocus?: boolean\n renderDay?: (date: Date) => React.ReactNode\n range?: [Date, Date]\n}\n\nfunction formatMonthLabel({\n month,\n locale,\n format,\n}: {\n month: Date\n locale: string\n format: string\n}) {\n return capitalize(dayjs(month).locale(locale).format(format))\n}\n\nconst DateTable = (props: DateTableProps) => {\n const {\n dateViewCount,\n paginateBy,\n month,\n locale,\n minDate,\n maxDate,\n enableHeaderLabel,\n daysRefs,\n onMonthChange,\n onNextLevel,\n onDayKeyDown,\n className,\n labelFormat,\n weekdayLabelFormat,\n preventFocus,\n renderDay,\n ...rest\n } = props\n\n const nextMonth = dayjs(month).add(dateViewCount, 'months').toDate()\n const previousMonth = dayjs(month).subtract(1, 'months').toDate()\n\n const pickerHeaderLabelClass = 'picker-header-label hover:text-primary'\n\n const months = Array(dateViewCount)\n .fill(0)\n .map((_, index) => {\n const monthDate = dayjs(month).add(index, 'months').toDate()\n return (\n <div key={index} className=\"day-picker\">\n <Header\n hasNext={\n index + 1 === dateViewCount &&\n isMonthInRange({\n date: nextMonth,\n minDate,\n maxDate,\n })\n }\n hasPrevious={\n index === 0 &&\n isMonthInRange({\n date: previousMonth,\n minDate,\n maxDate,\n })\n }\n className={className}\n onNext={() =>\n onMonthChange(\n dayjs(month).add(paginateBy, 'months').toDate(),\n )\n }\n onPrevious={() =>\n onMonthChange(\n dayjs(month)\n .subtract(paginateBy, 'months')\n .toDate(),\n )\n }\n >\n <div>\n <button\n className={classNames(pickerHeaderLabelClass)}\n disabled={!enableHeaderLabel}\n tabIndex={index > 0 ? -1 : 0}\n type=\"button\"\n onClick={() => onNextLevel('month')}\n onMouseDown={(event) =>\n preventFocus && event.preventDefault()\n }\n >\n {formatMonthLabel({\n month: monthDate,\n locale,\n format: labelFormat?.month || 'MMM',\n })}\n </button>\n <button\n className={classNames(pickerHeaderLabelClass)}\n disabled={!enableHeaderLabel}\n tabIndex={index > 0 ? -1 : 0}\n type=\"button\"\n onClick={() => onNextLevel('year')}\n onMouseDown={(event) =>\n preventFocus && event.preventDefault()\n }\n >\n {formatMonthLabel({\n month: monthDate,\n locale,\n format: labelFormat?.year || 'YYYY',\n })}\n </button>\n </div>\n </Header>\n <Month\n month={monthDate}\n daysRefs={\n (daysRefs.current as HTMLButtonElement[][][])[index]\n }\n minDate={minDate}\n maxDate={maxDate}\n className={className}\n locale={locale}\n focusable={index === 0}\n preventFocus={preventFocus}\n renderDay={renderDay}\n weekdayLabelFormat={weekdayLabelFormat}\n onDayKeyDown={(...args) => onDayKeyDown(index, ...args)}\n {...rest}\n />\n </div>\n )\n })\n\n return <>{months}</>\n}\n\nexport default DateTable\n"],"names":["formatMonthLabel","month","locale","format","capitalize","dayjs","DateTable","props","dateViewCount","paginateBy","minDate","maxDate","enableHeaderLabel","daysRefs","onMonthChange","onNextLevel","onDayKeyDown","className","labelFormat","weekdayLabelFormat","preventFocus","renderDay","rest","nextMonth","previousMonth","pickerHeaderLabelClass","months","_","index","monthDate","jsxs","jsx","Header","isMonthInRange","classNames","event","Month","args"],"mappings":";;;;;;;AAiCA,SAASA,EAAiB;AAAA,EACtB,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACJ,GAIG;AACC,SAAOC,EAAWC,EAAMJ,CAAK,EAAE,OAAOC,CAAM,EAAE,OAAOC,CAAM,CAAC;AAChE;AAEA,MAAMG,IAAY,CAACC,MAA0B;AACzC,QAAM;AAAA,IACF,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAR;AAAA,IACA,QAAAC;AAAA,IACA,SAAAQ;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHf,GAEEgB,IAAYlB,EAAMJ,CAAK,EAAE,IAAIO,GAAe,QAAQ,EAAE,OAAA,GACtDgB,IAAgBnB,EAAMJ,CAAK,EAAE,SAAS,GAAG,QAAQ,EAAE,OAAA,GAEnD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WG,EAAWT,CAAsB;AAAA,gBAC5C,UAAU,CAACb;AAAA,gBACX,UAAUgB,IAAQ,IAAI,KAAK;AAAA,gBAC3B,MAAK;AAAA,gBACL,SAAS,MAAMb,EAAY,MAAM;AAAA,gBACjC,aAAa,CAACoB,MACVf,KAAgBe,EAAM,eAAA;AAAA,gBAGzB,UAAAnC,EAAiB;AAAA,kBACd,OAAO6B;AAAA,kBACP,QAAA3B;AAAA,kBACA,SAAQgB,KAAA,gBAAAA,EAAa,SAAQ;AAAA,gBAAA,CAChC;AAAA,cAAA;AAAA,YAAA;AAAA,UACL,EAAA,CACJ;AAAA,QAAA;AAAA,MAAA;AAAA,MAEJ,gBAAAa;AAAA,QAACK;AAAA,QAAA;AAAA,UACG,OAAOP;AAAA,UACP,UACKhB,EAAS,QAAoCe,CAAK;AAAA,UAEvD,SAAAlB;AAAA,UACA,SAAAC;AAAA,UACA,WAAAM;AAAA,UACA,QAAAf;AAAA,UACA,WAAW0B,MAAU;AAAA,UACrB,cAAAR;AAAA,UACA,WAAAC;AAAA,UACA,oBAAAF;AAAA,UACA,cAAc,IAAIkB,MAASrB,EAAaY,GAAO,GAAGS,CAAI;AAAA,UACrD,GAAGf;AAAA,QAAA;AAAA,MAAA;AAAA,IACR,EAAA,GAlFMM,CAmFV;AAAA,EAER,CAAC;AAEL,gCAAU,UAAAF,EAAA,CAAO;AACrB;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthTable.js","sources":["../../../../../../lib/@ecme/components/ui/DatePicker/tables/MonthTable.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport Header from './Header'\nimport { isMonthInRange, getMonthsNames, formatYear } from '../utils'\nimport type { CommonProps } from '../../@types/common'\n\nexport interface MonthTableProps extends CommonProps {\n value: { year: number; month: number }\n onChange: (value: number) => void\n locale: string\n year: number\n onYearChange: (year: number) => void\n onNextLevel?: () => void\n minDate?: Date\n maxDate?: Date\n monthLabelFormat?: string\n yearLabelFormat?: string\n preventFocus?: boolean\n}\n\nconst MonthTable = (props: MonthTableProps) => {\n const {\n className,\n value,\n onChange,\n locale,\n year,\n onYearChange,\n onNextLevel,\n minDate,\n maxDate,\n preventFocus,\n monthLabelFormat = 'MMM',\n yearLabelFormat = 'YYYY',\n ...rest\n } = props\n\n const range = getMonthsNames(locale, monthLabelFormat)\n const minYear = minDate instanceof Date ? minDate.getFullYear() : undefined\n const maxYear = maxDate instanceof Date ? maxDate.getFullYear() : undefined\n\n const months = range.map((month, index) => {\n const disabled = !isMonthInRange({\n date: new Date(year, index),\n minDate,\n maxDate,\n })\n\n const active = index === value.month && year === value.year\n\n return (\n <button\n key={month}\n className={classNames(\n 'month-picker-cell',\n active && !disabled\n ? 'month-picker-cell-active bg-primary'\n : 'text-gray-800 dark:text-gray-100',\n !active && !disabled && 'hover:bg-gray-100',\n disabled && 'month-picker-cell-disabled',\n )}\n disabled={disabled}\n type=\"button\"\n onClick={() => onChange(index)}\n onMouseDown={(event) => preventFocus && event.preventDefault()}\n >\n {month}\n </button>\n )\n })\n\n return (\n <div className={classNames('month-picker', className)} {...rest}>\n <Header\n label={formatYear(year, yearLabelFormat)}\n hasNext={typeof maxYear === 'number' ? year < maxYear : true}\n hasPrevious={\n typeof minYear === 'number' ? year > minYear : true\n }\n className={className}\n nextLabel={'Next year'}\n previousLabel={'Previous year'}\n preventFocus={preventFocus}\n onNext={() => onYearChange(year + 1)}\n onPrevious={() => onYearChange(year - 1)}\n onNextLevel={onNextLevel}\n />\n <div className=\"month-table\">{months}</div>\n </div>\n )\n}\n\nexport default MonthTable\n"],"names":["MonthTable","props","className","value","onChange","locale","year","onYearChange","onNextLevel","minDate","maxDate","preventFocus","monthLabelFormat","yearLabelFormat","rest","range","getMonthsNames","minYear","maxYear","months","month","index","disabled","isMonthInRange","active","jsx","classNames","event","jsxs","Header","formatYear"],"mappings":";;;;;;;AAmBA,MAAMA,IAAa,CAACC,MAA2B;AAC3C,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,kBAAAC,IAAmB;AAAA,IACnB,iBAAAC,IAAkB;AAAA,IAClB,GAAGC;AAAA,EAAA,IACHb,GAEEc,IAAQC,EAAeX,GAAQO,CAAgB,GAC/CK,IAAUR,aAAmB,OAAOA,EAAQ,gBAAgB,QAC5DS,IAAUR,aAAmB,OAAOA,EAAQ,gBAAgB,QAE5DS,IAASJ,EAAM,IAAI,CAACK,GAAOC,MAAU;AACvC,UAAMC,IAAW,CAACC,EAAe;AAAA,MAC7B,MAAM,IAAI,KAAKjB,GAAMe,CAAK;AAAA,MAC1B,SAAAZ;AAAA,MACA,SAAAC;AAAA,IAAA,CACH,GAEKc,IAASH,MAAUlB,EAAM,SAASG,MAASH,EAAM;AAEvD,WACI,gBAAAsB;AAAA,MAAC;AAAA,MAAA;AAAA,QAEG,WAAWC;AAAA,UACP;AAAA,UACAF,KAAU,CAACF,IACL,wCACA;AAAA,UACN,CAACE,KAAU,CAACF,KAAY;AAAA,UACxBA,KAAY;AAAA,QAAA;AAAA,QAEhB,UAAAA;AAAA,QACA,MAAK;AAAA,QACL,SAAS,MAAMlB,EAASiB,CAAK;AAAA,QAC7B,aAAa,CAACM,MAAUhB,KAAgBgB,EAAM,eAAA;AAAA,QAE7C,UAAAP;AAAA,MAAA;AAAA,MAdIA;AAAA,IAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"MonthTable.js","sources":["../../../../../../lib/@ecme/components/ui/DatePicker/tables/MonthTable.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport Header from './Header'\nimport { isMonthInRange, getMonthsNames, formatYear } from '../utils'\nimport type { CommonProps } from '../../@types/common'\n\nexport interface MonthTableProps extends CommonProps {\n value: { year: number; month: number }\n onChange: (value: number) => void\n locale: string\n year: number\n onYearChange: (year: number) => void\n onNextLevel?: () => void\n minDate?: Date\n maxDate?: Date\n monthLabelFormat?: string\n yearLabelFormat?: string\n preventFocus?: boolean\n}\n\nconst MonthTable = (props: MonthTableProps) => {\n const {\n className,\n value,\n onChange,\n locale,\n year,\n onYearChange,\n onNextLevel,\n minDate,\n maxDate,\n preventFocus,\n monthLabelFormat = 'MMM',\n yearLabelFormat = 'YYYY',\n ...rest\n } = props\n\n const range = getMonthsNames(locale, monthLabelFormat)\n const minYear = minDate instanceof Date ? minDate.getFullYear() : undefined\n const maxYear = maxDate instanceof Date ? maxDate.getFullYear() : undefined\n\n const months = range.map((month, index) => {\n const disabled = !isMonthInRange({\n date: new Date(year, index),\n minDate,\n maxDate,\n })\n\n const active = index === value.month && year === value.year\n\n return (\n <button\n key={month}\n className={classNames(\n 'month-picker-cell',\n active && !disabled\n ? 'month-picker-cell-active bg-primary'\n : 'text-gray-800 dark:text-gray-100',\n !active && !disabled && 'hover:bg-gray-100',\n disabled && 'month-picker-cell-disabled',\n )}\n disabled={disabled}\n type=\"button\"\n onClick={() => onChange(index)}\n onMouseDown={(event) => preventFocus && event.preventDefault()}\n >\n {month}\n </button>\n )\n })\n\n return (\n <div className={classNames('month-picker', className)} {...rest}>\n <Header\n label={formatYear(year, yearLabelFormat)}\n hasNext={typeof maxYear === 'number' ? year < maxYear : true}\n hasPrevious={\n typeof minYear === 'number' ? year > minYear : true\n }\n className={className}\n nextLabel={'Next year'}\n previousLabel={'Previous year'}\n preventFocus={preventFocus}\n onNext={() => onYearChange(year + 1)}\n onPrevious={() => onYearChange(year - 1)}\n onNextLevel={onNextLevel}\n />\n <div className=\"month-table\">{months}</div>\n </div>\n )\n}\n\nexport default MonthTable\n"],"names":["MonthTable","props","className","value","onChange","locale","year","onYearChange","onNextLevel","minDate","maxDate","preventFocus","monthLabelFormat","yearLabelFormat","rest","range","getMonthsNames","minYear","maxYear","months","month","index","disabled","isMonthInRange","active","jsx","classNames","event","jsxs","Header","formatYear"],"mapp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MO,CAAe;AAAA,QACvC,SAAS,OAAOK,KAAY,WAAWZ,IAAOY,IAAU;AAAA,QACxD,aACI,OAAOD,KAAY,WAAWX,IAAOW,IAAU;AAAA,QAEnD,WAAAf;AAAA,QACA,WAAW;AAAA,QACX,eAAe;AAAA,QACf,cAAAS;AAAA,QACA,QAAQ,MAAMJ,EAAaD,IAAO,CAAC;AAAA,QACnC,YAAY,MAAMC,EAAaD,IAAO,CAAC;AAAA,QACvC,aAAAE;AAAA,MAAA;AAAA,IAAA;AAAA,IAEJ,gBAAAiB,EAAC,OAAA,EAAI,WAAU,eAAe,UAAAN,EAAA,CAAO;AAAA,EAAA,GACzC;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YearTable.js","sources":["../../../../../../lib/@ecme/components/ui/DatePicker/tables/YearTable.tsx"],"sourcesContent":["import { useState } from 'react'\nimport classNames from 'classnames'\nimport Header from './Header'\nimport { getDecadeRange, formatYear } from '../utils'\nimport type { CommonProps } from '../../@types/common'\n\nexport interface YearTableProps extends CommonProps {\n value: number\n onChange: (value: number) => void\n minYear?: number\n maxYear?: number\n yearLabelFormat?: string\n preventFocus?: boolean\n}\n\nconst YearTable = (props: YearTableProps) => {\n const {\n className,\n value,\n onChange,\n minYear,\n maxYear,\n preventFocus,\n yearLabelFormat = 'YYYY',\n ...rest\n } = props\n\n const [decade, setDecade] = useState(value)\n const range = getDecadeRange(decade)\n\n const years = range.map((year) => {\n const disabled =\n year < (minYear as number) || year > (maxYear as number)\n\n const active = year === value\n\n return (\n <button\n key={year}\n disabled={disabled}\n className={classNames(\n 'year-picker-cell',\n active && !disabled\n ? 'year-picker-cell-active bg-primary'\n : 'text-gray-800 dark:text-gray-100',\n !active && !disabled && 'hover:bg-gray-100',\n disabled && 'year-picker-cell-disabled',\n )}\n type=\"button\"\n onClick={() => onChange(year)}\n onMouseDown={(event) => preventFocus && event.preventDefault()}\n >\n {formatYear(year, yearLabelFormat)}\n </button>\n )\n })\n\n return (\n <div className={classNames('year-picker', className)} {...rest}>\n <Header\n nextLevelDisabled\n label={`${formatYear(range[0], yearLabelFormat)} - ${formatYear(\n range[range.length - 1],\n yearLabelFormat,\n )}`}\n hasPrevious={\n typeof minYear === 'number' ? minYear < range[0] : true\n }\n hasNext={\n typeof maxYear === 'number'\n ? maxYear > range[range.length - 1]\n : true\n }\n nextLabel={'Next decade'}\n previousLabel={'Previous decade'}\n preventFocus={preventFocus}\n onNext={() => setDecade((current) => current + 10)}\n onPrevious={() => setDecade((current) => current - 10)}\n />\n <div className=\"year-table\">{years}</div>\n </div>\n )\n}\n\nexport default YearTable\n"],"names":["YearTable","props","className","value","onChange","minYear","maxYear","preventFocus","yearLabelFormat","rest","decade","setDecade","useState","range","getDecadeRange","years","year","disabled","active","jsx","classNames","event","formatYear","jsxs","Header","current"],"mappings":";;;;;;;AAeA,MAAMA,IAAY,CAACC,MAA0B;AACzC,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,GAAGC;AAAA,EAAA,IACHR,GAEE,CAACS,GAAQC,CAAS,IAAIC,EAAST,CAAK,GACpCU,IAAQC,EAAeJ,CAAM,GAE7BK,IAAQF,EAAM,IAAI,CAACG,MAAS;AAC9B,UAAMC,IACFD,IAAQX,KAAsBW,IAAQV,GAEpCY,IAASF,MAASb;AAExB,WACI,gBAAAgB;AAAA,MAAC;AAAA,MAAA;AAAA,QAEG,UAAAF;AAAA,QACA,WAAWG;AAAA,UACP;AAAA,UACAF,KAAU,CAACD,IACL,uCACA;AAAA,UACN,CAACC,KAAU,CAACD,KAAY;AAAA,UACxBA,KAAY;AAAA,QAAA;AAAA,QAEhB,MAAK;AAAA,QACL,SAAS,MAAMb,EAASY,CAAI;AAAA,QAC5B,aAAa,CAACK,MAAUd,KAAgBc,EAAM,eAAA;AAAA,QAE7C,UAAAC,EAAWN,GAAMR,CAAe;AAAA,MAAA;AAAA,MAd5BQ;AAAA,IAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"YearTable.js","sources":["../../../../../../lib/@ecme/components/ui/DatePicker/tables/YearTable.tsx"],"sourcesContent":["import { useState } from 'react'\nimport classNames from 'classnames'\nimport Header from './Header'\nimport { getDecadeRange, formatYear } from '../utils'\nimport type { CommonProps } from '../../@types/common'\n\nexport interface YearTableProps extends CommonProps {\n value: number\n onChange: (value: number) => void\n minYear?: number\n maxYear?: number\n yearLabelFormat?: string\n preventFocus?: boolean\n}\n\nconst YearTable = (props: YearTableProps) => {\n const {\n className,\n value,\n onChange,\n minYear,\n maxYear,\n preventFocus,\n yearLabelFormat = 'YYYY',\n ...rest\n } = props\n\n const [decade, setDecade] = useState(value)\n const range = getDecadeRange(decade)\n\n const years = range.map((year) => {\n const disabled =\n year < (minYear as number) || year > (maxYear as number)\n\n const active = year === value\n\n return (\n <button\n key={year}\n disabled={disabled}\n className={classNames(\n 'year-picker-cell',\n active && !disabled\n ? 'year-picker-cell-active bg-primary'\n : 'text-gray-800 dark:text-gray-100',\n !active && !disabled && 'hover:bg-gray-100',\n disabled && 'year-picker-cell-disabled',\n )}\n type=\"button\"\n onClick={() => onChange(year)}\n onMouseDown={(event) => preventFocus && event.preventDefault()}\n >\n {formatYear(year, yearLabelFormat)}\n </button>\n )\n })\n\n return (\n <div className={classNames('year-picker', className)} {...rest}>\n <Header\n nextLevelDisabled\n label={`${formatYear(range[0], yearLabelFormat)} - ${formatYear(\n range[range.length - 1],\n yearLabelFormat,\n )}`}\n hasPrevious={\n typeof minYear === 'number' ? minYear < range[0] : true\n }\n hasNext={\n typeof maxYear === 'number'\n ? maxYear > range[range.length - 1]\n : true\n }\n nextLabel={'Next decade'}\n previousLabel={'Previous decade'}\n preventFocus={preventFocus}\n onNext={() => setDecade((current) => current + 10)}\n onPrevious={() => setDecade((current) => current - 10)}\n />\n <div className=\"year-table\">{years}</div>\n </div>\n )\n}\n\nexport default YearTable\n"],"names":["YearTable","props","className","value","onChange","minYear","maxYear","preventFocus","yearLabelFormat","rest","decade","setDecade","useState","range","getDecadeRange","years","year","disabled","active","jsx","classNames","event","formatYear","jsxs","Header","current"],"mappings":";;;;;;;AAeA,MAAMA,IAAY,CAACC,MAA0B;AACzC,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,GAAGC;AAAA,EAAA,IACHR,GAEE,CAACS,GAAQC,CAAS,IAAIC,EAAST,CAAK,GACpCU,IAAQC,EAAeJ,CAAM,GAE7BK,IAAQF,EAAM,IAAI,CAACG,MAAS;AAC9B,UAAMC,IACFD,IAAQX,KAAsBW,IAAQV,GAEpCY,IAASF,MAASb;AAExB,WACI,gBAAAgB;AAAA,MAAC;AAAA,MAAA;AAAA,QAEG,UAAAF;AAAA,QACA,WAAWG;AAAA,UACP;AAAA,UACAF,KAAU,CAACD,IACL,uCACA;AAAA,UACN,CAACC,KAAU,CAACD,KAAY;AAAA,UACxBA,KAAY;AAAA,QAAA;AAAA,QAEhB,MAAK;AAAA,QACL,SAAS,MAAMb,EAASY,CAAI;AAAA,QAC5B,aAAa,CAACK,MAAUd,KAAgBc,EAAM,eAAA;AAAA,QAE7C,UAAAC,EAAWN,GAAMR,CAAe;AAAA,MAAA;AAAA,MAd5BQ;AAAA,IAAA;AAAA,EAiBjB,CAAC;AAED,SACI,gBAAAO,EAAC,SAAI,WAAWH,EAAW,eAAelB,CAAS,GAAI,GAAGO,GACtD,UAAA;AAAA,IAAA,gBAAAU;AAAA,MAACK;AAAA,MAAA;AAAA,QACG,mBAAiB;AAAA,QACjB,OAAO,GAAGF,EAAWT,EAAM,CAAC,GAAGL,CAAe,CAAC,MAAMc;AAAA,UACjDT,EAAMA,EAAM,SAAS,CAAC;AAAA,UACtBL;AAAA,QAAA,CACH;AAAA,QACD,aACI,OAAOH,KAAY,WAAWA,IAAUQ,EAAM,CAAC,IAAI;AAAA,QAEvD,SACI,OAAOP,KAAY,WACbA,IAAUO,EAAMA,EAAM,SAAS,CAAC,IAChC;AAAA,QAEV,WAAW;AAAA,QACX,eAAe;AAAA,QACf,cAAAN;AAAA,QACA,QAAQ,MAAMI,EAAU,CAACc,MAAYA,IAAU,EAAE;AAAA,QACjD,YAAY,MAAMd,EAAU,CAACc,MAAYA,IAAU,EAAE;AAAA,MAAA;AAAA,IAAA;AAAA,IAEzD,gBAAAN,EAAC,OAAA,EAAI,WAAU,cAAc,UAAAJ,EAAA,CAAM;AAAA,EAAA,GACvC;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Month.js","sources":["../../../../../../../lib/@ecme/components/ui/DatePicker/tables/components/Month.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport classNames from 'classnames'\nimport dayjs from 'dayjs'\nimport Day from './Day'\nimport getDayProps from './props/getDayProps'\nimport { isSameDate, getWeekdaysNames, getMonthDays } from '../../utils'\nimport { useConfig } from '../../../ConfigProvider'\nimport type { CommonProps } from '../../../@types/common'\nimport type { FirstDayOfWeek } from '../../../@types/date'\nimport type { Modifiers, DayKeydownPayload } from './types'\nimport type { GetDayPropsReturn } from './props/getDayProps'\nimport type {\n KeyboardEvent,\n ReactNode,\n MouseEvent,\n CSSProperties,\n Ref,\n} from 'react'\n\nexport interface MonthBaseProps {\n month?: Date\n value?: Date | Date[]\n dayClassName?: (date: Date, modifiers: Modifiers) => string\n dayStyle?: (date: Date, modifiers: Modifiers) => CSSProperties\n disableDate?: (date: Date) => boolean\n disableOutOfMonth?: boolean\n minDate?: Date\n maxDate?: Date\n hideWeekdays?: boolean\n fullWidth?: boolean\n preventFocus?: boolean\n focusable?: boolean\n firstDayOfWeek?: FirstDayOfWeek\n hideOutOfMonthDates?: boolean\n weekendDays?: [number, number]\n isDateInRange?:\n | (() => boolean)\n | ((date: Date, props: GetDayPropsReturn) => boolean)\n isDateFirstInRange?:\n | (() => boolean)\n | ((date: Date, props: GetDayPropsReturn) => boolean)\n isDateLastInRange?:\n | (() => boolean)\n | ((date: Date, props: GetDayPropsReturn) => boolean)\n}\n\nexport interface MonthProps extends CommonProps, MonthBaseProps {\n onChange?: (value: Date) => void\n locale?: string\n onDayMouseEnter?: (date: Date, event: MouseEvent<HTMLButtonElement>) => void\n range?: [Date, Date]\n onDayKeyDown?: (\n payload: DayKeydownPayload,\n event: KeyboardEvent<HTMLButtonElement>,\n ) => void\n daysRefs: HTMLButtonElement[][]\n ref?: Ref<HTMLTableElement>\n renderDay?: (date: Date) => ReactNode\n weekdayLabelFormat?: string\n}\n\nconst noop = () => false\n\nconst Month = (props: MonthProps) => {\n const {\n className,\n month,\n value,\n onChange,\n disableOutOfMonth = false,\n locale,\n dayClassName,\n dayStyle,\n minDate,\n maxDate,\n disableDate,\n onDayMouseEnter,\n range,\n hideWeekdays = false,\n fullWidth = false,\n preventFocus = false,\n focusable = true,\n firstDayOfWeek = 'monday',\n onDayKeyDown,\n daysRefs,\n hideOutOfMonthDates = false,\n isDateInRange = noop,\n isDateFirstInRange = noop,\n isDateLastInRange = noop,\n ref,\n renderDay,\n weekdayLabelFormat,\n weekendDays = [0, 6],\n ...rest\n } = props\n\n const { locale: themeLocale } = useConfig()\n\n const finalLocale = locale || themeLocale\n const days = getMonthDays(month as Date, firstDayOfWeek)\n\n const weekdays = getWeekdaysNames(\n finalLocale,\n firstDayOfWeek,\n weekdayLabelFormat,\n ).map((weekday) => (\n <th key={weekday} className=\"week-day-cell\">\n <span className=\"week-day-cell-content\">{weekday}</span>\n </th>\n ))\n\n const hasValue = Array.isArray(value)\n ? value.every((item) => item instanceof Date)\n : value instanceof Date\n\n const hasValueInMonthRange =\n value instanceof Date &&\n dayjs(value).isAfter(dayjs(month).startOf('month')) &&\n dayjs(value).isBefore(dayjs(month).endOf('month'))\n\n const getDayPropsParams = {\n month: month as Date,\n hasValue,\n minDate: minDate as Date,\n maxDate: maxDate as Date,\n value: value as Date,\n disableDate: disableDate as (date: Date) => boolean,\n disableOutOfMonth: disableOutOfMonth as boolean,\n range: range as [Date, Date],\n weekendDays,\n }\n\n const firstIncludedDay = useMemo(\n () =>\n days\n .flatMap((_) => _)\n .find((date) => {\n const dayProps = getDayProps({\n ...getDayPropsParams,\n ...{ date },\n })\n\n return !dayProps.disabled && !dayProps.outOfMonth\n }) || dayjs(month).startOf('month').toDate(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n )\n\n const rows = days.map((row, rowIndex) => {\n const cells = row.map((date, cellIndex) => {\n const dayProps = getDayProps({ ...getDayPropsParams, ...{ date } })\n\n const onKeyDownPayload = { rowIndex, cellIndex, date }\n\n return (\n <td key={cellIndex} className={classNames('date-picker-cell')}>\n <Day\n ref={(button) => {\n if (daysRefs) {\n if (!Array.isArray(daysRefs[rowIndex])) {\n daysRefs[rowIndex] = []\n }\n\n daysRefs[rowIndex][cellIndex] =\n button as HTMLButtonElement\n }\n }}\n outOfMonth={dayProps.outOfMonth}\n weekend={dayProps.weekend}\n inRange={\n dayProps.inRange || isDateInRange(date, dayProps)\n }\n firstInRange={\n dayProps.firstInRange ||\n isDateFirstInRange(date, dayProps)\n }\n lastInRange={\n dayProps.lastInRange ||\n isDateLastInRange(date, dayProps)\n }\n firstInMonth={isSameDate(date, firstIncludedDay)}\n selected={dayProps.selected || dayProps.selectedInRange}\n hasValue={hasValueInMonthRange}\n className={\n typeof dayClassName === 'function'\n ? dayClassName(date, dayProps)\n : ''\n }\n style={\n typeof dayStyle === 'function'\n ? dayStyle(date, dayProps)\n : {}\n }\n disabled={dayProps.disabled}\n fullWidth={fullWidth}\n focusable={focusable}\n hideOutOfMonthDates={hideOutOfMonthDates}\n renderDay={renderDay}\n isToday={isSameDate(date, new Date())}\n value={date}\n onClick={() =>\n typeof onChange === 'function' && onChange(date)\n }\n onMouseDown={(event) =>\n preventFocus && event.preventDefault()\n }\n onKeyDown={(event) =>\n typeof onDayKeyDown === 'function' &&\n onDayKeyDown(onKeyDownPayload, event)\n }\n onMouseEnter={\n typeof onDayMouseEnter === 'function'\n ? onDayMouseEnter\n : noop\n }\n />\n </td>\n )\n })\n\n return (\n <tr key={rowIndex} className={classNames('date-picker-week-cell')}>\n {cells}\n </tr>\n )\n })\n\n return (\n <table\n ref={ref}\n className={classNames('picker-table', className)}\n cellSpacing=\"0\"\n {...rest}\n >\n {!hideWeekdays && (\n <thead>\n <tr>{weekdays}</tr>\n </thead>\n )}\n <tbody>{rows}</tbody>\n </table>\n )\n}\n\nexport default Month\n"],"names":["noop","Month","props","className","month","value","onChange","disableOutOfMonth","locale","dayClassName","dayStyle","minDate","maxDate","disableDate","onDayMouseEnter","range","hideWeekdays","fullWidth","preventFocus","focusable","firstDayOfWeek","onDayKeyDown","daysRefs","hideOutOfMonthDates","isDateInRange","isDateFirstInRange","isDateLastInRange","ref","renderDay","weekdayLabelFormat","weekendDays","rest","themeLocale","useConfig","finalLocale","days","getMonthDays","weekdays","getWeekdaysNames","weekday","jsx","hasValue","item","hasValueInMonthRange","dayjs","getDayPropsParams","firstIncludedDay","useMemo","_","date","dayProps","getDayProps","rows","row","rowIndex","cells","cellIndex","onKeyDownPayload","classNames","Day","button","isSameDate","event","jsxs"],"mappings":";;;;;;;;;;;;AA6DA,MAAMA,IAAO,MAAM,IAEbC,KAAQ,CAACC,MAAsB;AACjC,QAAM;AAAA,IACF,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,QAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,WAAAC,IAAY;AAAA,IACZ,cAAAC,IAAe;AAAA,IACf,W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qBAAAI;AAAA,UACA,WAAAK;AAAA,UACA,SAASiC,EAAWZ,GAAM,oBAAI,MAAM;AAAA,UACpC,OAAOA;AAAA,UACP,SAAS,MACL,OAAO3C,KAAa,cAAcA,EAAS2C,CAAI;AAAA,UAEnD,aAAa,CAACa,MACV5C,KAAgB4C,EAAM,eAAA;AAAA,UAE1B,WAAW,CAACA,MACR,OAAOzC,KAAiB,cACxBA,EAAaoC,GAAkBK,CAAK;AAAA,UAExC,cACI,OAAOhD,KAAoB,aACrBA,IACAd;AAAA,QAAA;AAAA,MAAA,KA1DTwD,CA6DT;AAAA,IAAA,CAEP;AAED,6BACK,MAAA,EAAkB,WAAWE,EAAW,uBAAuB,GAC3D,eADIJ,CAET;AAAA,EAAA,CAEP;AAED,SACI,gBAAAS;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAApC;AAAA,MACA,WAAW+B,EAAW,gBAAgBvD,CAAS;AAAA,MAC/C,aAAY;AAAA,MACX,GAAG4B;AAAA,MAEH,UAAA;AAAA,QAAA,CAACf,KACE,gBAAAwB,EAAC,SAAA,EACG,UAAA,gBAAAA,EAAC,MAAA,EAAI,aAAS,EAAA,CAClB;AAAA,QAEJ,gBAAAA,EAAC,WAAO,UAAAY,EAAA,CAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGzB;"}
|
|
1
|
+
{"version":3,"file":"Month.js","sources":["../../../../../../../lib/@ecme/components/ui/DatePicker/tables/components/Month.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport classNames from 'classnames'\nimport dayjs from 'dayjs'\nimport Day from './Day'\nimport getDayProps from './props/getDayProps'\nimport { isSameDate, getWeekdaysNames, getMonthDays } from '../../utils'\nimport { useConfig } from '../../../ConfigProvider'\nimport type { CommonProps } from '../../../@types/common'\nimport type { FirstDayOfWeek } from '../../../@types/date'\nimport type { Modifiers, DayKeydownPayload } from './types'\nimport type { GetDayPropsReturn } from './props/getDayProps'\nimport type {\n KeyboardEvent,\n ReactNode,\n MouseEvent,\n CSSProperties,\n Ref,\n} from 'react'\n\nexport interface MonthBaseProps {\n month?: Date\n value?: Date | Date[]\n dayClassName?: (date: Date, modifiers: Modifiers) => string\n dayStyle?: (date: Date, modifiers: Modifiers) => CSSProperties\n disableDate?: (date: Date) => boolean\n disableOutOfMonth?: boolean\n minDate?: Date\n maxDate?: Date\n hideWeekdays?: boolean\n fullWidth?: boolean\n preventFocus?: boolean\n focusable?: boolean\n firstDayOfWeek?: FirstDayOfWeek\n hideOutOfMonthDates?: boolean\n weekendDays?: [number, number]\n isDateInRange?:\n | (() => boolean)\n | ((date: Date, props: GetDayPropsReturn) => boolean)\n isDateFirstInRange?:\n | (() => boolean)\n | ((date: Date, props: GetDayPropsReturn) => boolean)\n isDateLastInRange?:\n | (() => boolean)\n | ((date: Date, props: GetDayPropsReturn) => boolean)\n}\n\nexport interface MonthProps extends CommonProps, MonthBaseProps {\n onChange?: (value: Date) => void\n locale?: string\n onDayMouseEnter?: (date: Date, event: MouseEvent<HTMLButtonElement>) => void\n range?: [Date, Date]\n onDayKeyDown?: (\n payload: DayKeydownPayload,\n event: KeyboardEvent<HTMLButtonElement>,\n ) => void\n daysRefs: HTMLButtonElement[][]\n ref?: Ref<HTMLTableElement>\n renderDay?: (date: Date) => ReactNode\n weekdayLabelFormat?: string\n}\n\nconst noop = () => false\n\nconst Month = (props: MonthProps) => {\n const {\n className,\n month,\n value,\n onChange,\n disableOutOfMonth = false,\n locale,\n dayClassName,\n dayStyle,\n minDate,\n maxDate,\n disableDate,\n onDayMouseEnter,\n range,\n hideWeekdays = false,\n fullWidth = false,\n preventFocus = false,\n focusable = true,\n firstDayOfWeek = 'monday',\n onDayKeyDown,\n daysRefs,\n hideOutOfMonthDates = false,\n isDateInRange = noop,\n isDateFirstInRange = noop,\n isDateLastInRange = noop,\n ref,\n renderDay,\n weekdayLabelFormat,\n weekendDays = [0, 6],\n ...rest\n } = props\n\n const { locale: themeLocale } = useConfig()\n\n const finalLocale = locale || themeLocale\n const days = getMonthDays(month as Date, firstDayOfWeek)\n\n const weekdays = getWeekdaysNames(\n finalLocale,\n firstDayOfWeek,\n weekdayLabelFormat,\n ).map((weekday) => (\n <th key={weekday} className=\"week-day-cell\">\n <span className=\"week-day-cell-content\">{weekday}</span>\n </th>\n ))\n\n const hasValue = Array.isArray(value)\n ? value.every((item) => item instanceof Date)\n : value instanceof Date\n\n const hasValueInMonthRange =\n value instanceof Date &&\n dayjs(value).isAfter(dayjs(month).startOf('month')) &&\n dayjs(value).isBefore(dayjs(month).endOf('month'))\n\n const getDayPropsParams = {\n month: month as Date,\n hasValue,\n minDate: minDate as Date,\n maxDate: maxDate as Date,\n value: value as Date,\n disableDate: disableDate as (date: Date) => boolean,\n disableOutOfMonth: disableOutOfMonth as boolean,\n range: range as [Date, Date],\n weekendDays,\n }\n\n const firstIncludedDay = useMemo(\n () =>\n days\n .flatMap((_) => _)\n .find((date) => {\n const dayProps = getDayProps({\n ...getDayPropsParams,\n ...{ date },\n })\n\n return !dayProps.disabled && !dayProps.outOfMonth\n }) || dayjs(month).startOf('month').toDate(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n )\n\n const rows = days.map((row, rowIndex) => {\n const cells = row.map((date, cellIndex) => {\n const dayProps = getDayProps({ ...getDayPropsParams, ...{ date } })\n\n const onKeyDownPayload = { rowIndex, cellIndex, date }\n\n return (\n <td key={cellIndex} className={classNames('date-picker-cell')}>\n <Day\n ref={(button) => {\n if (daysRefs) {\n if (!Array.isArray(daysRefs[rowIndex])) {\n daysRefs[rowIndex] = []\n }\n\n daysRefs[rowIndex][cellIndex] =\n button as HTMLButtonElement\n }\n }}\n outOfMonth={dayProps.outOfMonth}\n weekend={dayProps.weekend}\n inRange={\n dayProps.inRange || isDateInRange(date, dayProps)\n }\n firstInRange={\n dayProps.firstInRange ||\n isDateFirstInRange(date, dayProps)\n }\n lastInRange={\n dayProps.lastInRange ||\n isDateLastInRange(date, dayProps)\n }\n firstInMonth={isSameDate(date, firstIncludedDay)}\n selected={dayProps.selected || dayProps.selectedInRange}\n hasValue={hasValueInMonthRange}\n className={\n typeof dayClassName === 'function'\n ? dayClassName(date, dayProps)\n : ''\n }\n style={\n typeof dayStyle === 'function'\n ? dayStyle(date, dayProps)\n : {}\n }\n disabled={dayProps.disabled}\n fullWidth={fullWidth}\n focusable={focusable}\n hideOutOfMonthDates={hideOutOfMonthDates}\n renderDay={renderDay}\n isToday={isSameDate(date, new Date())}\n value={date}\n onClick={() =>\n typeof onChange === 'function' && onChange(date)\n }\n onMouseDown={(event) =>\n preventFocus && event.preventDefault()\n }\n onKeyDown={(event) =>\n typeof onDayKeyDown === 'function' &&\n onDayKeyDown(onKeyDownPayload, event)\n }\n onMouseEnter={\n typeof onDayMouseEnter === 'function'\n ? onDayMouseEnter\n : noop\n }\n />\n </td>\n )\n })\n\n return (\n <tr key={rowIndex} className={classNames('date-picker-week-cell')}>\n {cells}\n </tr>\n )\n })\n\n return (\n <table\n ref={ref}\n className={classNames('picker-table', className)}\n cellSpacing=\"0\"\n {...rest}\n >\n {!hideWeekdays && (\n <thead>\n <tr>{weekdays}</tr>\n </thead>\n )}\n <tbody>{rows}</tbody>\n </table>\n )\n}\n\nexport default Month\n"],"names":["noop","Month","props","className","month","value","onChange","disableOutOfMonth","locale","dayClassName","dayStyle","minDate","maxDate","disableDate","onDayMouseEnter","range","hideWeekdays","fullWidth","preventFocus","focusable","firstDayOfWeek","onDayKeyDown","daysRefs","hideOutOfMonthDates","isDateInRange","isDateFirstInRange","isDateLastInRange","ref","renderDay","weekdayLabelFormat","weekendDays","rest","themeLocale","useConfig","finalLocale","days","getMonthDays","weekdays","getWeekdaysNames","weekday","jsx","hasValue","item","hasValueInMonthRange","dayjs","getDayPropsParams","firstIncludedDay","useMemo","_","date","dayProps","getDayProps","rows","row","rowIndex","cells","cellIndex","onKeyDownPayload","classNames","Day","button","isSameDate","event","jsxs"],"mappings":";;;;;;;;;;;;AA6DA,MAAMA,IAAO,MAAM,IAEbC,KAAQ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