vueless 0.0.8 → 0.0.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/package.json +4 -3
- package/.browserslistrc +0 -4
- package/.editorconfig +0 -12
- package/.eslintignore +0 -6
- package/.eslintrc.cjs +0 -66
- package/.storybook/configs/main.config.js +0 -20
- package/.storybook/decorators/vue3SourceDecorator.js +0 -119
- package/.storybook/index.pcss +0 -3
- package/.storybook/main.js +0 -20
- package/.storybook/manager-head.html +0 -10
- package/.storybook/manager.js +0 -6
- package/.storybook/preview-head.html +0 -72
- package/.storybook/preview.js +0 -42
- package/.storybook/themes/vueless.docs.theme.js +0 -41
- package/.storybook/themes/vueless.theme.js +0 -45
- package/.web-types-gen/index.js +0 -17
- package/.web-types-gen/lib/build.js +0 -252
- package/.web-types-gen/lib/config.js +0 -32
- package/index.pcss +0 -3
- package/postcss.config.js +0 -9
- package/public/images/logo.png +0 -0
- package/readme/README.md +0 -8
- package/readme/UGroup.md +0 -25
- package/readme/UNotify.md +0 -53
- package/readme/UPage.md +0 -37
- package/readme/UTopLoader.md +0 -27
- package/readme/customization.md +0 -347
- package/readme/installation.md +0 -139
- package/readme/storybook-pages/Customisation.mdx +0 -6
- package/readme/storybook-pages/Installation.mdx +0 -7
- package/src/composable.ui/index.js +0 -395
- package/src/service.storybook/index.js +0 -91
- package/src/service.tailwind/index.js +0 -110
- package/src/service.ui/index.js +0 -193
- package/src/ui.button/Docs.mdx +0 -16
- package/src/ui.button/composables/attrs.composable.js +0 -41
- package/src/ui.button/configs/default.config.js +0 -165
- package/src/ui.button/constants/index.js +0 -5
- package/src/ui.button/index.stories.js +0 -166
- package/src/ui.button/index.vue +0 -151
- package/src/ui.button-link/Docs.mdx +0 -16
- package/src/ui.button-link/composables/attrs.composable.js +0 -99
- package/src/ui.button-link/configs/default.config.js +0 -80
- package/src/ui.button-link/constants/index.js +0 -5
- package/src/ui.button-link/index.stories.js +0 -158
- package/src/ui.button-link/index.vue +0 -226
- package/src/ui.button-toggle/Docs.mdx +0 -16
- package/src/ui.button-toggle/composables/attrs.composable.js +0 -16
- package/src/ui.button-toggle/configs/default.config.js +0 -12
- package/src/ui.button-toggle/constants/index.js +0 -7
- package/src/ui.button-toggle/index.stories.js +0 -155
- package/src/ui.button-toggle/index.vue +0 -128
- package/src/ui.button-toggle-item/Docs.mdx +0 -16
- package/src/ui.button-toggle-item/composables/attrs.composable.js +0 -53
- package/src/ui.button-toggle-item/configs/default.config.js +0 -58
- package/src/ui.button-toggle-item/constants/index.js +0 -5
- package/src/ui.button-toggle-item/index.stories.js +0 -77
- package/src/ui.button-toggle-item/index.vue +0 -147
- package/src/ui.container-accordion/composables/attrs.composable.js +0 -45
- package/src/ui.container-accordion/configs/default.config.js +0 -32
- package/src/ui.container-accordion/constants/index.js +0 -5
- package/src/ui.container-accordion/index.stories.js +0 -89
- package/src/ui.container-accordion/index.vue +0 -95
- package/src/ui.container-card/Docs.mdx +0 -16
- package/src/ui.container-card/composable/attrs.composable.js +0 -56
- package/src/ui.container-card/configs/default.config.js +0 -31
- package/src/ui.container-card/constants/index.js +0 -5
- package/src/ui.container-card/index.stories.js +0 -170
- package/src/ui.container-card/index.vue +0 -146
- package/src/ui.container-divider/Docs.mdx +0 -16
- package/src/ui.container-divider/composables/attrs.composable.js +0 -65
- package/src/ui.container-divider/configs/default.config.js +0 -79
- package/src/ui.container-divider/constants/index.js +0 -5
- package/src/ui.container-divider/index.stories.js +0 -124
- package/src/ui.container-divider/index.vue +0 -138
- package/src/ui.container-group/Docs.mdx +0 -16
- package/src/ui.container-group/composables/attrs.composable.js +0 -44
- package/src/ui.container-group/configs/default.config.js +0 -29
- package/src/ui.container-group/constants/index.js +0 -5
- package/src/ui.container-group/index.stories.js +0 -88
- package/src/ui.container-group/index.vue +0 -106
- package/src/ui.container-groups/Docs.mdx +0 -16
- package/src/ui.container-groups/composables/attrs.composable.js +0 -12
- package/src/ui.container-groups/configs/default.config.js +0 -3
- package/src/ui.container-groups/index.stories.js +0 -45
- package/src/ui.container-groups/index.vue +0 -33
- package/src/ui.container-modal/Docs.mdx +0 -16
- package/src/ui.container-modal/composables/attrs.composable.js +0 -90
- package/src/ui.container-modal/configs/default.config.js +0 -69
- package/src/ui.container-modal/constants/index.js +0 -5
- package/src/ui.container-modal/index.stories.js +0 -170
- package/src/ui.container-modal/index.vue +0 -336
- package/src/ui.container-modal-confirm/Docs.mdx +0 -16
- package/src/ui.container-modal-confirm/composable/attrs.composable.js +0 -20
- package/src/ui.container-modal-confirm/configs/default.config.js +0 -15
- package/src/ui.container-modal-confirm/constants/index.js +0 -5
- package/src/ui.container-modal-confirm/index.stories.js +0 -209
- package/src/ui.container-modal-confirm/index.vue +0 -182
- package/src/ui.container-page/Docs.mdx +0 -16
- package/src/ui.container-page/composables/attrs.composable.js +0 -96
- package/src/ui.container-page/configs/default.config.js +0 -71
- package/src/ui.container-page/constants/index.js +0 -5
- package/src/ui.container-page/index.stories.js +0 -147
- package/src/ui.container-page/index.vue +0 -275
- package/src/ui.container-row/Docs.mdx +0 -16
- package/src/ui.container-row/composables/attrs.composable.js +0 -23
- package/src/ui.container-row/configs/default.config.js +0 -14
- package/src/ui.container-row/constants/index.js +0 -5
- package/src/ui.container-row/index.stories.js +0 -81
- package/src/ui.container-row/index.vue +0 -45
- package/src/ui.data-list/composables/attrs.composable.js +0 -45
- package/src/ui.data-list/configs/default.config.js +0 -32
- package/src/ui.data-list/constants/index.js +0 -5
- package/src/ui.data-list/index.stories.js +0 -91
- package/src/ui.data-list/index.vue +0 -259
- package/src/ui.data-table/Docs.mdx +0 -16
- package/src/ui.data-table/composables/attrs.composable.js +0 -188
- package/src/ui.data-table/configs/default.config.js +0 -88
- package/src/ui.data-table/constants/index.js +0 -5
- package/src/ui.data-table/index.stories.js +0 -261
- package/src/ui.data-table/index.vue +0 -730
- package/src/ui.data-table/services/table.service.js +0 -15
- package/src/ui.data-table-cell/composables/attrs.composable.js +0 -24
- package/src/ui.data-table-cell/configs/default.config.js +0 -19
- package/src/ui.data-table-cell/constants/index.js +0 -5
- package/src/ui.data-table-cell/index.vue +0 -44
- package/src/ui.dropdown-badge/Docs.mdx +0 -16
- package/src/ui.dropdown-badge/composables/attrs.composable.js +0 -63
- package/src/ui.dropdown-badge/configs/default.config.js +0 -34
- package/src/ui.dropdown-badge/constants/index.js +0 -5
- package/src/ui.dropdown-badge/index.stories.js +0 -126
- package/src/ui.dropdown-badge/index.vue +0 -234
- package/src/ui.dropdown-button/Docs.mdx +0 -16
- package/src/ui.dropdown-button/composables/attrs.composable.js +0 -63
- package/src/ui.dropdown-button/configs/default.config.js +0 -37
- package/src/ui.dropdown-button/constants/index.js +0 -14
- package/src/ui.dropdown-button/index.stories.js +0 -158
- package/src/ui.dropdown-button/index.vue +0 -271
- package/src/ui.dropdown-item/Docs.mdx +0 -16
- package/src/ui.dropdown-item/composables/attrs.composable.js +0 -13
- package/src/ui.dropdown-item/configs/default.config.js +0 -16
- package/src/ui.dropdown-item/index.stories.js +0 -30
- package/src/ui.dropdown-item/index.vue +0 -53
- package/src/ui.dropdown-link/Docs.mdx +0 -16
- package/src/ui.dropdown-link/composables/attrs.composable.js +0 -65
- package/src/ui.dropdown-link/configs/default.config.js +0 -37
- package/src/ui.dropdown-link/constants/index.js +0 -5
- package/src/ui.dropdown-link/index.stories.js +0 -127
- package/src/ui.dropdown-link/index.vue +0 -261
- package/src/ui.dropdown-list/Docs.mdx +0 -16
- package/src/ui.dropdown-list/composables/attrs.composable.js +0 -93
- package/src/ui.dropdown-list/composables/usePointer.js +0 -77
- package/src/ui.dropdown-list/configs/default.config.js +0 -74
- package/src/ui.dropdown-list/constants/index.js +0 -5
- package/src/ui.dropdown-list/index.stories.js +0 -76
- package/src/ui.dropdown-list/index.vue +0 -284
- package/src/ui.form-calendar/Docs.mdx +0 -52
- package/src/ui.form-calendar/components/DayView.vue +0 -268
- package/src/ui.form-calendar/components/MonthView.vue +0 -114
- package/src/ui.form-calendar/components/YearView.vue +0 -118
- package/src/ui.form-calendar/composables/attrs.composable.js +0 -106
- package/src/ui.form-calendar/configs/default.config.js +0 -125
- package/src/ui.form-calendar/constants/index.js +0 -71
- package/src/ui.form-calendar/index.stories.js +0 -59
- package/src/ui.form-calendar/index.vue +0 -743
- package/src/ui.form-calendar/services/calendar.service.js +0 -189
- package/src/ui.form-calendar/services/date.service.js +0 -282
- package/src/ui.form-calendar/services/formatting.service.js +0 -180
- package/src/ui.form-checkbox/Docs.mdx +0 -16
- package/src/ui.form-checkbox/composables/attrs.composable.js +0 -57
- package/src/ui.form-checkbox/configs/default.config.js +0 -69
- package/src/ui.form-checkbox/constants/index.js +0 -5
- package/src/ui.form-checkbox/index.stories.js +0 -147
- package/src/ui.form-checkbox/index.vue +0 -242
- package/src/ui.form-checkbox-group/Docs.mdx +0 -16
- package/src/ui.form-checkbox-group/composables/attrs.composable.js +0 -17
- package/src/ui.form-checkbox-group/configs/default.config.js +0 -5
- package/src/ui.form-checkbox-group/constants/index.js +0 -5
- package/src/ui.form-checkbox-group/index.stories.js +0 -45
- package/src/ui.form-checkbox-group/index.vue +0 -145
- package/src/ui.form-checkbox-multi-state/Docs.mdx +0 -16
- package/src/ui.form-checkbox-multi-state/composables/attrs.composable.js +0 -24
- package/src/ui.form-checkbox-multi-state/configs/default.config.js +0 -9
- package/src/ui.form-checkbox-multi-state/constants/index.js +0 -5
- package/src/ui.form-checkbox-multi-state/index.stories.js +0 -59
- package/src/ui.form-checkbox-multi-state/index.vue +0 -134
- package/src/ui.form-color-picker/composables/attrs.composable.js +0 -44
- package/src/ui.form-color-picker/configs/default.config.js +0 -52
- package/src/ui.form-color-picker/constants/index.js +0 -5
- package/src/ui.form-color-picker/index.stories.js +0 -63
- package/src/ui.form-color-picker/index.vue +0 -171
- package/src/ui.form-date-picker/Docs.mdx +0 -52
- package/src/ui.form-date-picker/composables/attrs.composable.js +0 -22
- package/src/ui.form-date-picker/configs/default.config.js +0 -26
- package/src/ui.form-date-picker/constants/index.js +0 -5
- package/src/ui.form-date-picker/index.stories.js +0 -132
- package/src/ui.form-date-picker/index.vue +0 -256
- package/src/ui.form-date-picker-range/composables/attrs.composable.js +0 -100
- package/src/ui.form-date-picker-range/configs/default.config.js +0 -172
- package/src/ui.form-date-picker-range/constants/index.js +0 -23
- package/src/ui.form-date-picker-range/index.stories.js +0 -135
- package/src/ui.form-date-picker-range/index.vue +0 -937
- package/src/ui.form-date-picker-range/services/dateRange.service.js +0 -116
- package/src/ui.form-date-picker-range/services/validation.service.js +0 -22
- package/src/ui.form-input/Docs.mdx +0 -16
- package/src/ui.form-input/assets/fonts/text-security-disc.woff +0 -0
- package/src/ui.form-input/composables/attrs.composable.js +0 -66
- package/src/ui.form-input/configs/default.config.js +0 -72
- package/src/ui.form-input/constants/index.js +0 -5
- package/src/ui.form-input/index.stories.js +0 -166
- package/src/ui.form-input/index.vue +0 -388
- package/src/ui.form-input-file/composables/attrs.composable.js +0 -82
- package/src/ui.form-input-file/configs/default.config.js +0 -59
- package/src/ui.form-input-file/constants/index.js +0 -5
- package/src/ui.form-input-file/index.stories.js +0 -86
- package/src/ui.form-input-file/index.vue +0 -387
- package/src/ui.form-input-money/Docs.mdx +0 -16
- package/src/ui.form-input-money/composables/attrs.composable.js +0 -13
- package/src/ui.form-input-money/composables/useFormatCurrency.js +0 -82
- package/src/ui.form-input-money/configs/default.config.js +0 -16
- package/src/ui.form-input-money/constants/index.js +0 -5
- package/src/ui.form-input-money/index.stories.js +0 -126
- package/src/ui.form-input-money/index.vue +0 -263
- package/src/ui.form-input-money/services/format.service.js +0 -72
- package/src/ui.form-input-number/Docs.mdx +0 -16
- package/src/ui.form-input-number/composables/attrs.composable.js +0 -47
- package/src/ui.form-input-number/configs/default.config.js +0 -33
- package/src/ui.form-input-number/constants/index.js +0 -5
- package/src/ui.form-input-number/index.stories.js +0 -103
- package/src/ui.form-input-number/index.vue +0 -162
- package/src/ui.form-input-rating/composables/attrs.composable.js +0 -34
- package/src/ui.form-input-rating/configs/default.config.js +0 -25
- package/src/ui.form-input-rating/constants/index.js +0 -5
- package/src/ui.form-input-rating/index.stories.js +0 -108
- package/src/ui.form-input-rating/index.vue +0 -186
- package/src/ui.form-input-search/composables/attrs.composable.js +0 -21
- package/src/ui.form-input-search/configs/default.config.js +0 -20
- package/src/ui.form-input-search/constants/index.js +0 -5
- package/src/ui.form-input-search/index.stories.js +0 -90
- package/src/ui.form-input-search/index.vue +0 -215
- package/src/ui.form-label/Docs.mdx +0 -16
- package/src/ui.form-label/composables/attrs.composable.js +0 -65
- package/src/ui.form-label/configs/default.config.js +0 -95
- package/src/ui.form-label/constants/index.js +0 -13
- package/src/ui.form-label/index.stories.js +0 -107
- package/src/ui.form-label/index.vue +0 -170
- package/src/ui.form-radio/Docs.mdx +0 -16
- package/src/ui.form-radio/composables/attrs.composable.js +0 -34
- package/src/ui.form-radio/configs/default.config.js +0 -47
- package/src/ui.form-radio/constants/index.js +0 -5
- package/src/ui.form-radio/index.stories.js +0 -71
- package/src/ui.form-radio/index.vue +0 -170
- package/src/ui.form-radio-card/Docs.mdx +0 -16
- package/src/ui.form-radio-card/composables/attrs.composable.js +0 -35
- package/src/ui.form-radio-card/configs/default.config.js +0 -25
- package/src/ui.form-radio-card/constants/index.js +0 -5
- package/src/ui.form-radio-card/index.stories.js +0 -149
- package/src/ui.form-radio-card/index.vue +0 -160
- package/src/ui.form-radio-card/services/variant.service.js +0 -15
- package/src/ui.form-radio-group/Docs.mdx +0 -16
- package/src/ui.form-radio-group/composables/attrs.composable.js +0 -27
- package/src/ui.form-radio-group/configs/default.config.js +0 -18
- package/src/ui.form-radio-group/constants/index.js +0 -5
- package/src/ui.form-radio-group/index.stories.js +0 -42
- package/src/ui.form-radio-group/index.vue +0 -128
- package/src/ui.form-select/Docs.mdx +0 -16
- package/src/ui.form-select/composables/attrs.composable.js +0 -172
- package/src/ui.form-select/configs/default.config.js +0 -138
- package/src/ui.form-select/constants/index.js +0 -19
- package/src/ui.form-select/index.stories.js +0 -339
- package/src/ui.form-select/index.vue +0 -722
- package/src/ui.form-select/services/select.service.js +0 -98
- package/src/ui.form-switch/composables/attrs.composable.js +0 -77
- package/src/ui.form-switch/configs/default.config.js +0 -76
- package/src/ui.form-switch/constants/index.js +0 -5
- package/src/ui.form-switch/index.stories.js +0 -93
- package/src/ui.form-switch/index.vue +0 -199
- package/src/ui.form-switch/services/variant.service.js +0 -31
- package/src/ui.form-textarea/Docs.mdx +0 -16
- package/src/ui.form-textarea/composables/attrs.composable.js +0 -52
- package/src/ui.form-textarea/configs/default.config.js +0 -68
- package/src/ui.form-textarea/constants/index.js +0 -5
- package/src/ui.form-textarea/index.stories.js +0 -151
- package/src/ui.form-textarea/index.vue +0 -284
- package/src/ui.image-avatar/composables/attrs.composable.js +0 -34
- package/src/ui.image-avatar/configs/default.config.js +0 -42
- package/src/ui.image-avatar/constants/index.js +0 -5
- package/src/ui.image-avatar/default-avatar.png +0 -0
- package/src/ui.image-avatar/index.stories.js +0 -107
- package/src/ui.image-avatar/index.vue +0 -121
- package/src/ui.image-icon/Docs.mdx +0 -16
- package/src/ui.image-icon/composables/attrs.composable.js +0 -65
- package/src/ui.image-icon/configs/default.config.js +0 -90
- package/src/ui.image-icon/constants/index.js +0 -5
- package/src/ui.image-icon/index.stories.js +0 -110
- package/src/ui.image-icon/index.vue +0 -223
- package/src/ui.image-logo/composables/attrs.composable.js +0 -41
- package/src/ui.image-logo/configs/default.config.js +0 -38
- package/src/ui.image-logo/constants/index.js +0 -5
- package/src/ui.image-logo/index.stories.js +0 -84
- package/src/ui.image-logo/index.vue +0 -98
- package/src/ui.loader-rendering/index.vue +0 -72
- package/src/ui.loader-rendering/store/index.js +0 -17
- package/src/ui.loader-top/components/TopProgress.vue +0 -277
- package/src/ui.loader-top/index.vue +0 -221
- package/src/ui.loader-top/store/index.js +0 -59
- package/src/ui.navigation-pagination/composables/attrs.composable.js +0 -41
- package/src/ui.navigation-pagination/configs/default.config.js +0 -24
- package/src/ui.navigation-pagination/constants/index.js +0 -8
- package/src/ui.navigation-pagination/index.stories.js +0 -52
- package/src/ui.navigation-pagination/index.vue +0 -276
- package/src/ui.navigation-stepper/composables/attrs.composable.js +0 -25
- package/src/ui.navigation-stepper/configs/default.config.js +0 -13
- package/src/ui.navigation-stepper/constants/index.js +0 -5
- package/src/ui.navigation-stepper/index.stories.js +0 -30
- package/src/ui.navigation-stepper/index.vue +0 -126
- package/src/ui.navigation-tab/composables/attrs.composable.js +0 -30
- package/src/ui.navigation-tab/configs/default.config.js +0 -22
- package/src/ui.navigation-tab/constants/index.js +0 -5
- package/src/ui.navigation-tab/index.stories.js +0 -57
- package/src/ui.navigation-tab/index.vue +0 -85
- package/src/ui.navigation-tabs/composables/attrs.composable.js +0 -24
- package/src/ui.navigation-tabs/configs/default.config.js +0 -14
- package/src/ui.navigation-tabs/constants/index.js +0 -5
- package/src/ui.navigation-tabs/index.stories.js +0 -69
- package/src/ui.navigation-tabs/index.vue +0 -99
- package/src/ui.notify/index.sto_ries.js +0 -102
- package/src/ui.notify/index.vue +0 -248
- package/src/ui.notify/services/index.js +0 -87
- package/src/ui.other-dot/composables/attrs.composable.js +0 -32
- package/src/ui.other-dot/configs/default.config.js +0 -21
- package/src/ui.other-dot/constants/index.js +0 -5
- package/src/ui.other-dot/index.stories.js +0 -77
- package/src/ui.other-dot/index.vue +0 -52
- package/src/ui.other-loader/composables/attrs.composable.js +0 -51
- package/src/ui.other-loader/configs/default.config.js +0 -47
- package/src/ui.other-loader/constants/index.js +0 -5
- package/src/ui.other-loader/index.stories.js +0 -78
- package/src/ui.other-loader/index.vue +0 -136
- package/src/ui.text-alert/composables/attrs.composable.js +0 -48
- package/src/ui.text-alert/configs/default.config.js +0 -51
- package/src/ui.text-alert/constatns/index.js +0 -5
- package/src/ui.text-alert/index.stories.js +0 -157
- package/src/ui.text-alert/index.vue +0 -122
- package/src/ui.text-badge/Docs.mdx +0 -16
- package/src/ui.text-badge/composables/attrs.composable.js +0 -49
- package/src/ui.text-badge/configs/default.config.js +0 -51
- package/src/ui.text-badge/constants/index.js +0 -5
- package/src/ui.text-badge/index.stories.js +0 -190
- package/src/ui.text-badge/index.vue +0 -120
- package/src/ui.text-block/composables/attrs.composable.js +0 -31
- package/src/ui.text-block/configs/default.config.js +0 -35
- package/src/ui.text-block/constatns/index.js +0 -5
- package/src/ui.text-block/index.stories.js +0 -112
- package/src/ui.text-block/index.vue +0 -76
- package/src/ui.text-empty/Docs.mdx +0 -16
- package/src/ui.text-empty/composables/attrs.composable.js +0 -43
- package/src/ui.text-empty/configs/default.config.js +0 -30
- package/src/ui.text-empty/constants/index.js +0 -5
- package/src/ui.text-empty/index.stories.js +0 -106
- package/src/ui.text-empty/index.vue +0 -95
- package/src/ui.text-file/composables/attrs.composable.js +0 -37
- package/src/ui.text-file/configs/default.config.js +0 -15
- package/src/ui.text-file/index.stories.js +0 -29
- package/src/ui.text-file/index.vue +0 -93
- package/src/ui.text-files/composables/attrs.composable.js +0 -19
- package/src/ui.text-files/configs/default.config.js +0 -9
- package/src/ui.text-files/constants/index.js +0 -5
- package/src/ui.text-files/index.stories.js +0 -32
- package/src/ui.text-files/index.vue +0 -87
- package/src/ui.text-header/Docs.mdx +0 -16
- package/src/ui.text-header/composables/attrs.composable.js +0 -34
- package/src/ui.text-header/configs/default.config.js +0 -45
- package/src/ui.text-header/constants/index.js +0 -5
- package/src/ui.text-header/index.stories.js +0 -106
- package/src/ui.text-header/index.vue +0 -83
- package/src/ui.text-money/Docs.mdx +0 -16
- package/src/ui.text-money/assets/credit.svg +0 -7
- package/src/ui.text-money/assets/debit.svg +0 -12
- package/src/ui.text-money/composables/attrs.composable.js +0 -65
- package/src/ui.text-money/configs/default.config.js +0 -69
- package/src/ui.text-money/constants/index.js +0 -7
- package/src/ui.text-money/index.stories.js +0 -265
- package/src/ui.text-money/index.vue +0 -204
- package/src/ui.text-money/services/money.services.js +0 -24
- package/src/ui.viewport/index.vue +0 -78
- package/src/ui.viewport/store/index.js +0 -47
- package/tailwind.config.js +0 -11
- package/vite.config.mjs +0 -39
- package/vueless.config.js +0 -7
- package/web-types.json +0 -7187
|
@@ -1,743 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="wrapperRef" tabindex="1" v-bind="wrapperAttrs" @keydown="onKeydown">
|
|
3
|
-
<div v-bind="navigationAttrs">
|
|
4
|
-
<Teleport
|
|
5
|
-
v-if="rangeSwitchViewContainerRef"
|
|
6
|
-
:to="rangeSwitchViewContainerRef"
|
|
7
|
-
:disabled="!range"
|
|
8
|
-
>
|
|
9
|
-
<UButton
|
|
10
|
-
size="sm"
|
|
11
|
-
color="gray"
|
|
12
|
-
pill
|
|
13
|
-
square
|
|
14
|
-
variant="thirdary"
|
|
15
|
-
v-bind="navigationSwitchViewButtonAttrs"
|
|
16
|
-
@click="onClickViewSwitch"
|
|
17
|
-
@mousedown.prevent.capture
|
|
18
|
-
>
|
|
19
|
-
<span v-if="isCurrentView.day" v-bind="dayViewSwitchLabelAttrs">
|
|
20
|
-
<span v-bind="dayViewSwitchLabelMonthAttrs" v-text="viewSwitchLabel.month" />
|
|
21
|
-
<span v-text="viewSwitchLabel.year" />
|
|
22
|
-
</span>
|
|
23
|
-
<span v-if="isCurrentView.month" v-text="viewSwitchLabel.year" />
|
|
24
|
-
<span v-if="isCurrentView.year" v-text="viewSwitchLabel.yearsRange" />
|
|
25
|
-
|
|
26
|
-
<template #right>
|
|
27
|
-
<UIcon
|
|
28
|
-
v-if="!range"
|
|
29
|
-
size="sm"
|
|
30
|
-
color="gray"
|
|
31
|
-
variant="light"
|
|
32
|
-
:name="config.dayViewSwitchLabelIconName"
|
|
33
|
-
v-bind="dayViewSwitchLabelIconAttrs"
|
|
34
|
-
/>
|
|
35
|
-
</template>
|
|
36
|
-
</UButton>
|
|
37
|
-
</Teleport>
|
|
38
|
-
|
|
39
|
-
<div v-bind="nextPrevWrapperAttrs">
|
|
40
|
-
<UButton
|
|
41
|
-
pill
|
|
42
|
-
size="sm"
|
|
43
|
-
square
|
|
44
|
-
variant="thirdary"
|
|
45
|
-
v-bind="nextPrevButtonAttrs"
|
|
46
|
-
@mousedown.prevent.capture
|
|
47
|
-
@click="onClickPrevButton"
|
|
48
|
-
>
|
|
49
|
-
<UIcon
|
|
50
|
-
size="sm"
|
|
51
|
-
color="gray"
|
|
52
|
-
variant="light"
|
|
53
|
-
:name="config.prevIconName"
|
|
54
|
-
v-bind="prevIconAttrs"
|
|
55
|
-
/>
|
|
56
|
-
</UButton>
|
|
57
|
-
|
|
58
|
-
<div ref="rangeSwitchViewContainerRef" />
|
|
59
|
-
|
|
60
|
-
<UButton
|
|
61
|
-
pill
|
|
62
|
-
size="sm"
|
|
63
|
-
square
|
|
64
|
-
variant="thirdary"
|
|
65
|
-
v-bind="nextPrevButtonAttrs"
|
|
66
|
-
@mousedown.prevent.capture
|
|
67
|
-
@click="onClickNextButton"
|
|
68
|
-
>
|
|
69
|
-
<UIcon
|
|
70
|
-
size="sm"
|
|
71
|
-
color="gray"
|
|
72
|
-
variant="light"
|
|
73
|
-
:name="config.nextIconName"
|
|
74
|
-
v-bind="nextIconAttrs"
|
|
75
|
-
/>
|
|
76
|
-
</UButton>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<DayView
|
|
81
|
-
v-if="isCurrentView.day"
|
|
82
|
-
:selected-date="selectedDate"
|
|
83
|
-
:selected-date-to="selectedDateTo"
|
|
84
|
-
:range="range"
|
|
85
|
-
:active-month="activeMonth"
|
|
86
|
-
:active-date="activeDate"
|
|
87
|
-
:min-date="minDate"
|
|
88
|
-
:max-date="maxDate"
|
|
89
|
-
:date-format="dateFormat"
|
|
90
|
-
:locale="locale"
|
|
91
|
-
:config="config"
|
|
92
|
-
@input="onInputDate"
|
|
93
|
-
/>
|
|
94
|
-
|
|
95
|
-
<MonthView
|
|
96
|
-
v-if="isCurrentView.month"
|
|
97
|
-
:selected-date="selectedDate"
|
|
98
|
-
:active-month="activeMonth"
|
|
99
|
-
:active-date="activeDate"
|
|
100
|
-
:min-date="minDate"
|
|
101
|
-
:max-date="maxDate"
|
|
102
|
-
:date-format="dateFormat"
|
|
103
|
-
:locale="locale"
|
|
104
|
-
:config="config"
|
|
105
|
-
@input="onInput"
|
|
106
|
-
/>
|
|
107
|
-
|
|
108
|
-
<YearView
|
|
109
|
-
v-if="isCurrentView.year"
|
|
110
|
-
:selected-date="selectedDate"
|
|
111
|
-
:active-month="activeMonth"
|
|
112
|
-
:active-date="activeDate"
|
|
113
|
-
:min-date="minDate"
|
|
114
|
-
:max-date="maxDate"
|
|
115
|
-
:date-format="dateFormat"
|
|
116
|
-
:locale="locale"
|
|
117
|
-
:config="config"
|
|
118
|
-
@input="onInput"
|
|
119
|
-
/>
|
|
120
|
-
|
|
121
|
-
<div v-if="isTimepickerEnabled" v-bind="timepickerWrapperAttrs">
|
|
122
|
-
<span v-bind="timepickerLabelAttrs" v-text="locale.timeLabel" />
|
|
123
|
-
|
|
124
|
-
<div v-bind="timepickerInputWrapperAttrs">
|
|
125
|
-
<input
|
|
126
|
-
ref="hoursRef"
|
|
127
|
-
type="text"
|
|
128
|
-
v-bind="timepickerLeftInputAttrs"
|
|
129
|
-
@input.prevent="onTimeInput($event, INPUT_TYPE.hours, MAX_HOURS, MIN_HOURS)"
|
|
130
|
-
@keydown="onTimeKeydown"
|
|
131
|
-
/>
|
|
132
|
-
⁚
|
|
133
|
-
<input
|
|
134
|
-
ref="minutesRef"
|
|
135
|
-
type="text"
|
|
136
|
-
v-bind="timepickerRightInputAttrs"
|
|
137
|
-
@input.prevent="onTimeInput($event, INPUT_TYPE.minutes, MAX_MINUTES, MIN_MINUTES)"
|
|
138
|
-
@keydown="onTimeKeydown"
|
|
139
|
-
/>
|
|
140
|
-
</div>
|
|
141
|
-
|
|
142
|
-
<UButton v-bind="submitButtonAttrs" @click="onClickSubmit">
|
|
143
|
-
{{ locale.okLabel }}
|
|
144
|
-
</UButton>
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
147
|
-
</template>
|
|
148
|
-
|
|
149
|
-
<script setup>
|
|
150
|
-
import { computed, onMounted, ref, watch } from "vue";
|
|
151
|
-
|
|
152
|
-
import UIcon from "../ui.image-icon";
|
|
153
|
-
import UButton from "../ui.button";
|
|
154
|
-
|
|
155
|
-
import UIService from "../service.ui";
|
|
156
|
-
|
|
157
|
-
import {
|
|
158
|
-
parseDate,
|
|
159
|
-
formatDate,
|
|
160
|
-
getYearsRange,
|
|
161
|
-
dateIsOutOfRange,
|
|
162
|
-
isNumeric,
|
|
163
|
-
} from "./services/calendar.service";
|
|
164
|
-
|
|
165
|
-
import {
|
|
166
|
-
getUnixTimestampFromDate,
|
|
167
|
-
getDateWithoutTime,
|
|
168
|
-
addMonths,
|
|
169
|
-
addDays,
|
|
170
|
-
addYears,
|
|
171
|
-
getSortedLocale,
|
|
172
|
-
} from "./services/date.service";
|
|
173
|
-
|
|
174
|
-
import useAttrs from "./composables/attrs.composable";
|
|
175
|
-
|
|
176
|
-
import {
|
|
177
|
-
UCalendar,
|
|
178
|
-
VIEW,
|
|
179
|
-
KEY_CODE,
|
|
180
|
-
YEARS_PER_VIEW,
|
|
181
|
-
MAX_HOURS,
|
|
182
|
-
MIN_HOURS,
|
|
183
|
-
MAX_MINUTES,
|
|
184
|
-
MIN_MINUTES,
|
|
185
|
-
SEPARATOR,
|
|
186
|
-
INPUT_TYPE,
|
|
187
|
-
LOCALE_TYPE,
|
|
188
|
-
} from "./constants";
|
|
189
|
-
|
|
190
|
-
import defaultConfig from "./configs/default.config";
|
|
191
|
-
|
|
192
|
-
import DayView from "./components/DayView.vue";
|
|
193
|
-
import MonthView from "./components/MonthView.vue";
|
|
194
|
-
import YearView from "./components/YearView.vue";
|
|
195
|
-
|
|
196
|
-
defineOptions({ name: "UCalendar" });
|
|
197
|
-
|
|
198
|
-
const props = defineProps({
|
|
199
|
-
/**
|
|
200
|
-
* Calendar value (timestamp).
|
|
201
|
-
*/
|
|
202
|
-
modelValue: {
|
|
203
|
-
type: [Number, Object],
|
|
204
|
-
default: null,
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Calendar view.
|
|
209
|
-
* @values day, month, year
|
|
210
|
-
*/
|
|
211
|
-
view: {
|
|
212
|
-
type: String,
|
|
213
|
-
default: VIEW.day,
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Enable range selection.
|
|
218
|
-
*/
|
|
219
|
-
range: {
|
|
220
|
-
type: Boolean,
|
|
221
|
-
default: UIService.get(defaultConfig, UCalendar).default.range,
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Enable timepicker.
|
|
226
|
-
*/
|
|
227
|
-
timepicker: {
|
|
228
|
-
type: Boolean,
|
|
229
|
-
default: UIService.get(defaultConfig, UCalendar).default.timepicker,
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Date format.
|
|
234
|
-
*/
|
|
235
|
-
dateFormat: {
|
|
236
|
-
type: String,
|
|
237
|
-
default: UIService.get(defaultConfig, UCalendar).default.dateFormat,
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* User friendly date format.
|
|
242
|
-
*/
|
|
243
|
-
userFormat: {
|
|
244
|
-
type: String,
|
|
245
|
-
default: UIService.get(defaultConfig, UCalendar).default.userFormat,
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Min date in format date string or Date.
|
|
250
|
-
*/
|
|
251
|
-
minDate: {
|
|
252
|
-
type: [Date, String],
|
|
253
|
-
default: UIService.get(defaultConfig, UCalendar).default.minDate,
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Max date in format date string or Date.
|
|
258
|
-
*/
|
|
259
|
-
maxDate: {
|
|
260
|
-
type: [Date, String],
|
|
261
|
-
default: UIService.get(defaultConfig, UCalendar).default.maxDate,
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Component ui config object.
|
|
266
|
-
*/
|
|
267
|
-
config: {
|
|
268
|
-
type: Object,
|
|
269
|
-
default: () => ({}),
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Data-cy attribute for automated testing.
|
|
274
|
-
*/
|
|
275
|
-
dataCy: {
|
|
276
|
-
type: String,
|
|
277
|
-
default: "",
|
|
278
|
-
},
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
const emit = defineEmits([
|
|
282
|
-
"update:modelValue",
|
|
283
|
-
"update:view",
|
|
284
|
-
"input",
|
|
285
|
-
"submit",
|
|
286
|
-
"keydown",
|
|
287
|
-
"userDateChange",
|
|
288
|
-
"formattedDateChange",
|
|
289
|
-
]);
|
|
290
|
-
|
|
291
|
-
const {
|
|
292
|
-
config,
|
|
293
|
-
wrapperAttrs,
|
|
294
|
-
navigationAttrs,
|
|
295
|
-
navigationSwitchViewButtonAttrs,
|
|
296
|
-
dayViewSwitchLabelAttrs,
|
|
297
|
-
dayViewSwitchLabelMonthAttrs,
|
|
298
|
-
dayViewSwitchLabelIconAttrs,
|
|
299
|
-
nextIconAttrs,
|
|
300
|
-
nextPrevButtonAttrs,
|
|
301
|
-
prevIconAttrs,
|
|
302
|
-
timepickerWrapperAttrs,
|
|
303
|
-
timepickerLabelAttrs,
|
|
304
|
-
timepickerInputWrapperAttrs,
|
|
305
|
-
timepickerLeftInputAttrs,
|
|
306
|
-
timepickerRightInputAttrs,
|
|
307
|
-
submitButtonAttrs,
|
|
308
|
-
nextPrevWrapperAttrs,
|
|
309
|
-
} = useAttrs(props);
|
|
310
|
-
|
|
311
|
-
const wrapperRef = ref(null);
|
|
312
|
-
const hoursRef = ref(null);
|
|
313
|
-
const minutesRef = ref(null);
|
|
314
|
-
const rangeSwitchViewContainerRef = ref(null);
|
|
315
|
-
|
|
316
|
-
const activeDate = ref(null);
|
|
317
|
-
const activeMonth = ref(null);
|
|
318
|
-
|
|
319
|
-
defineExpose({ wrapperRef });
|
|
320
|
-
|
|
321
|
-
const currentView = ref(props.view);
|
|
322
|
-
|
|
323
|
-
watch(
|
|
324
|
-
() => props.view,
|
|
325
|
-
() => {
|
|
326
|
-
if (props.view !== currentView.value) {
|
|
327
|
-
currentView.value = props.view;
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
);
|
|
331
|
-
|
|
332
|
-
watch(currentView, () => {
|
|
333
|
-
if (props.view !== currentView.value) {
|
|
334
|
-
emit("update:view", currentView.value);
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
const isCurrentView = computed(() => ({
|
|
339
|
-
day: currentView.value === VIEW.day,
|
|
340
|
-
month: currentView.value === VIEW.month,
|
|
341
|
-
year: currentView.value === VIEW.year,
|
|
342
|
-
}));
|
|
343
|
-
|
|
344
|
-
const locale = computed(() => {
|
|
345
|
-
const currentLocale = props.config.i18n || config.value.i18n;
|
|
346
|
-
const formattedLocale = {
|
|
347
|
-
...currentLocale,
|
|
348
|
-
months: {
|
|
349
|
-
shorthand: getSortedLocale(currentLocale.months.shorthand, LOCALE_TYPE.month),
|
|
350
|
-
longhand: getSortedLocale(currentLocale.months.longhand, LOCALE_TYPE.month),
|
|
351
|
-
},
|
|
352
|
-
weekdays: {
|
|
353
|
-
shorthand: getSortedLocale(currentLocale.weekdays.shorthand, LOCALE_TYPE.day),
|
|
354
|
-
longhand: getSortedLocale(currentLocale.weekdays.longhand, LOCALE_TYPE.day),
|
|
355
|
-
},
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
return formattedLocale;
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
const isTimepickerEnabled = computed(() => {
|
|
362
|
-
return props.timepicker && !props.range;
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
const isModelRangeType = computed(() => {
|
|
366
|
-
return (
|
|
367
|
-
props.modelValue !== null &&
|
|
368
|
-
!isNumeric(props.modelValue) &&
|
|
369
|
-
typeof props.modelValue === "object"
|
|
370
|
-
);
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
const localValue = computed({
|
|
374
|
-
get: () => {
|
|
375
|
-
if (props.range) {
|
|
376
|
-
const from = isModelRangeType.value ? props.modelValue.from : props.modelValue || null;
|
|
377
|
-
|
|
378
|
-
const to = isModelRangeType.value ? props.modelValue.to : null;
|
|
379
|
-
|
|
380
|
-
return { from, to };
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
return isModelRangeType.value ? props.modelValue.from : props.modelValue;
|
|
384
|
-
},
|
|
385
|
-
set(value) {
|
|
386
|
-
value = getCurrentValueType(value);
|
|
387
|
-
|
|
388
|
-
const parsedDate = parseDate(props.range ? value.from : value, props.dateFormat, locale.value);
|
|
389
|
-
const parsedDateTo =
|
|
390
|
-
isModelRangeType.value && props.range
|
|
391
|
-
? parseDate(value.to, props.dateFormat, locale.value)
|
|
392
|
-
: undefined;
|
|
393
|
-
|
|
394
|
-
if (parsedDate && isTimepickerEnabled.value) {
|
|
395
|
-
parsedDate.setHours(Number(hoursRef.value.value));
|
|
396
|
-
parsedDate.setMinutes(Number(minutesRef.value.value));
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
const timestamp = parsedDate ? getUnixTimestampFromDate(parsedDate) : null;
|
|
400
|
-
const timestampTo = parsedDateTo ? getUnixTimestampFromDate(parsedDateTo) : null;
|
|
401
|
-
|
|
402
|
-
const isOutOfRange = dateIsOutOfRange(
|
|
403
|
-
parsedDate || new Date(),
|
|
404
|
-
props.minDate,
|
|
405
|
-
props.maxDate,
|
|
406
|
-
locale.value,
|
|
407
|
-
props.dateFormat,
|
|
408
|
-
);
|
|
409
|
-
|
|
410
|
-
if (isOutOfRange) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
emit("update:modelValue", props.range ? { from: timestamp, to: timestampTo } : timestamp);
|
|
415
|
-
|
|
416
|
-
if (parsedDate === null && isTimepickerEnabled.value) {
|
|
417
|
-
const currentDate = new Date();
|
|
418
|
-
|
|
419
|
-
hoursRef.value.value = String(currentDate.getHours()).padStart(2, "0");
|
|
420
|
-
minutesRef.value.value = String(currentDate.getMinutes()).padStart(2, "0");
|
|
421
|
-
}
|
|
422
|
-
},
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
const selectedDate = computed(() => {
|
|
426
|
-
return parseDate(
|
|
427
|
-
props.range ? localValue.value.from : localValue.value,
|
|
428
|
-
props.dateFormat,
|
|
429
|
-
locale.value,
|
|
430
|
-
);
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
const selectedDateTo = computed(() => {
|
|
434
|
-
return props.range ? parseDate(localValue.value.to, props.dateFormat, locale.value) : undefined;
|
|
435
|
-
});
|
|
436
|
-
|
|
437
|
-
const formattedDate = computed(() => {
|
|
438
|
-
return formatDate(selectedDate.value, props.dateFormat, locale.value);
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
const formattedTime = computed(() => {
|
|
442
|
-
if (!isTimepickerEnabled.value) return undefined;
|
|
443
|
-
|
|
444
|
-
const hours = String(selectedDate.value?.getHours()).padStart(2, "0");
|
|
445
|
-
const minutes = String(selectedDate.value?.getMinutes()).padStart(2, "0");
|
|
446
|
-
|
|
447
|
-
return selectedDate.value ? `${hours}:${minutes}` : "";
|
|
448
|
-
});
|
|
449
|
-
|
|
450
|
-
const userFormattedDate = computed(() => {
|
|
451
|
-
const date = formatDate(selectedDate.value, props.userFormat, locale.value);
|
|
452
|
-
const dateTo = props.range
|
|
453
|
-
? formatDate(selectedDateTo.value, props.userFormat, locale.value)
|
|
454
|
-
: undefined;
|
|
455
|
-
|
|
456
|
-
if (isTimepickerEnabled.value && selectedDate.value) {
|
|
457
|
-
return `${date} ${SEPARATOR} ${formattedTime.value}`;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
return props.range ? `${date} ${SEPARATOR} ${dateTo}` : date;
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
const viewSwitchLabel = computed(() => {
|
|
464
|
-
const localValue =
|
|
465
|
-
activeDate.value || activeMonth.value || selectedDate.value || getDateWithoutTime();
|
|
466
|
-
|
|
467
|
-
return {
|
|
468
|
-
year: formatDate(localValue, "Y", locale.value),
|
|
469
|
-
month: formatDate(localValue, "F", locale.value),
|
|
470
|
-
yearsRange: getYearsRange(localValue || getDateWithoutTime()).join(` ${SEPARATOR} `),
|
|
471
|
-
};
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
watch(userFormattedDate, () => {
|
|
475
|
-
emit("userDateChange", userFormattedDate.value);
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
watch(formattedDate, () => {
|
|
479
|
-
emit("formattedDateChange", userFormattedDate.value);
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
// This watcher force updates value when range props changed
|
|
483
|
-
watch(
|
|
484
|
-
() => props.range,
|
|
485
|
-
(newValue, oldValue) => {
|
|
486
|
-
if (newValue !== oldValue) {
|
|
487
|
-
localValue.value = getCurrentValueType(localValue.value);
|
|
488
|
-
}
|
|
489
|
-
},
|
|
490
|
-
);
|
|
491
|
-
|
|
492
|
-
onMounted(() => {
|
|
493
|
-
if (selectedDate.value && isTimepickerEnabled.value) {
|
|
494
|
-
hoursRef.value.value = String(selectedDate.value.getHours()).padStart(2, "0");
|
|
495
|
-
minutesRef.value.value = String(selectedDate.value.getMinutes()).padStart(2, "0");
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
emit("userDateChange", userFormattedDate.value);
|
|
499
|
-
emit("formattedDateChange", userFormattedDate.value);
|
|
500
|
-
});
|
|
501
|
-
|
|
502
|
-
function getCurrentValueType(value) {
|
|
503
|
-
if (props.range && value === null) {
|
|
504
|
-
value = { from: null, to: null };
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
if (isModelRangeType.value && !props.range) {
|
|
508
|
-
value = value.from || value;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
if (typeof value !== "object" && value !== null && props.range) {
|
|
512
|
-
value = { from: value, to: null };
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
return value;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
function onInputDate(newDate) {
|
|
519
|
-
if (newDate === null) {
|
|
520
|
-
localValue.value = newDate;
|
|
521
|
-
|
|
522
|
-
activeDate.value = null;
|
|
523
|
-
activeMonth.value = null;
|
|
524
|
-
|
|
525
|
-
emit("input", localValue.value);
|
|
526
|
-
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
const date = new Date(newDate.valueOf());
|
|
531
|
-
|
|
532
|
-
if (props.range) {
|
|
533
|
-
const isFullReset =
|
|
534
|
-
localValue.value.to ||
|
|
535
|
-
!localValue.value.from ||
|
|
536
|
-
getUnixTimestampFromDate(date) <= localValue.value.from;
|
|
537
|
-
|
|
538
|
-
localValue.value = isFullReset
|
|
539
|
-
? { from: date, to: null }
|
|
540
|
-
: { from: localValue.value.from, to: date };
|
|
541
|
-
} else {
|
|
542
|
-
localValue.value = date;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
activeDate.value = null;
|
|
546
|
-
activeMonth.value = null;
|
|
547
|
-
|
|
548
|
-
emit("input", localValue.value);
|
|
549
|
-
|
|
550
|
-
wrapperRef.value.focus();
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
function onKeydown(event) {
|
|
554
|
-
if (props.range) {
|
|
555
|
-
emit("keydown", event);
|
|
556
|
-
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
if ([KEY_CODE.left, KEY_CODE.up, KEY_CODE.right, KEY_CODE.down].includes(event.keyCode)) {
|
|
561
|
-
arrowKeyHandler(event);
|
|
562
|
-
|
|
563
|
-
minutesRef.value?.blur();
|
|
564
|
-
hoursRef.value?.blur();
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
if (event.keyCode === KEY_CODE.enter) {
|
|
568
|
-
enterKeyHandler(event);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
if (isNumeric(event.key) && document.activeElement !== minutesRef.value) {
|
|
572
|
-
hoursRef.value?.focus();
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
emit("keydown", event);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
function onInput(date) {
|
|
579
|
-
activeDate.value = null;
|
|
580
|
-
activeMonth.value = date;
|
|
581
|
-
|
|
582
|
-
if (isCurrentView.value.month) currentView.value = VIEW.day;
|
|
583
|
-
if (isCurrentView.value.year) currentView.value = VIEW.month;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
function arrowKeyHandler(event) {
|
|
587
|
-
const currentActiveDate =
|
|
588
|
-
activeDate.value || activeMonth.value || selectedDate.value || getDateWithoutTime();
|
|
589
|
-
|
|
590
|
-
let newActiveDate;
|
|
591
|
-
|
|
592
|
-
if (currentView.value === VIEW.day) {
|
|
593
|
-
if (event.keyCode === KEY_CODE.down) {
|
|
594
|
-
newActiveDate = addDays(currentActiveDate, 7);
|
|
595
|
-
} else if (event.keyCode === KEY_CODE.left) {
|
|
596
|
-
newActiveDate = addDays(currentActiveDate, -1);
|
|
597
|
-
} else if (event.keyCode === KEY_CODE.up) {
|
|
598
|
-
newActiveDate = addDays(currentActiveDate, -7);
|
|
599
|
-
} else if (event.keyCode === KEY_CODE.right) {
|
|
600
|
-
newActiveDate = addDays(currentActiveDate, 1);
|
|
601
|
-
}
|
|
602
|
-
} else if (currentView.value === VIEW.month) {
|
|
603
|
-
if (event.keyCode === KEY_CODE.down) {
|
|
604
|
-
newActiveDate = addMonths(currentActiveDate, 4);
|
|
605
|
-
} else if (event.keyCode === KEY_CODE.left) {
|
|
606
|
-
newActiveDate = addMonths(currentActiveDate, -1);
|
|
607
|
-
} else if (event.keyCode === KEY_CODE.up) {
|
|
608
|
-
newActiveDate = addMonths(currentActiveDate, -4);
|
|
609
|
-
} else if (event.keyCode === KEY_CODE.right) {
|
|
610
|
-
newActiveDate = addMonths(currentActiveDate, 1);
|
|
611
|
-
}
|
|
612
|
-
} else if (currentView.value === VIEW.year) {
|
|
613
|
-
if (event.keyCode === KEY_CODE.down) {
|
|
614
|
-
newActiveDate = addYears(currentActiveDate, 4);
|
|
615
|
-
} else if (event.keyCode === KEY_CODE.left) {
|
|
616
|
-
newActiveDate = addYears(currentActiveDate, -1);
|
|
617
|
-
} else if (event.keyCode === KEY_CODE.up) {
|
|
618
|
-
newActiveDate = addYears(currentActiveDate, -4);
|
|
619
|
-
} else if (event.keyCode === KEY_CODE.right) {
|
|
620
|
-
newActiveDate = addYears(currentActiveDate, 1);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
const isOutOfRange = dateIsOutOfRange(
|
|
625
|
-
newActiveDate,
|
|
626
|
-
props.minDate,
|
|
627
|
-
props.maxDate,
|
|
628
|
-
locale.value,
|
|
629
|
-
props.dateFormat,
|
|
630
|
-
);
|
|
631
|
-
|
|
632
|
-
if (newActiveDate && !isOutOfRange) {
|
|
633
|
-
activeDate.value = newActiveDate;
|
|
634
|
-
activeMonth.value = newActiveDate;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
function addActiveMonth(amount) {
|
|
639
|
-
const currentActiveMonth = activeMonth.value || selectedDate.value || getDateWithoutTime();
|
|
640
|
-
const newActiveMonth = addMonths(currentActiveMonth, amount);
|
|
641
|
-
|
|
642
|
-
activeMonth.value = newActiveMonth;
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
function addActiveYear(amount) {
|
|
646
|
-
const currentActiveMonth = activeMonth.value || selectedDate.value || getDateWithoutTime();
|
|
647
|
-
const newActiveMonth = addYears(currentActiveMonth, amount);
|
|
648
|
-
|
|
649
|
-
activeMonth.value = newActiveMonth;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
function onClickNextButton() {
|
|
653
|
-
activeDate.value = null;
|
|
654
|
-
|
|
655
|
-
if (isCurrentView.value.day) addActiveMonth(1);
|
|
656
|
-
if (isCurrentView.value.month) addActiveYear(1);
|
|
657
|
-
if (isCurrentView.value.year) addActiveYear(YEARS_PER_VIEW);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
function onClickPrevButton() {
|
|
661
|
-
activeDate.value = null;
|
|
662
|
-
|
|
663
|
-
if (isCurrentView.value.day) addActiveMonth(-1);
|
|
664
|
-
if (isCurrentView.value.month) addActiveYear(-1);
|
|
665
|
-
if (isCurrentView.value.year) addActiveYear(YEARS_PER_VIEW * -1);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
function enterKeyHandler() {
|
|
669
|
-
if (activeDate.value !== null && isCurrentView.value.day) {
|
|
670
|
-
localValue.value = activeDate.value;
|
|
671
|
-
|
|
672
|
-
activeDate.value = null;
|
|
673
|
-
activeMonth.value = null;
|
|
674
|
-
|
|
675
|
-
emit("input", localValue.value);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
if (isCurrentView.value.month) currentView.value = VIEW.day;
|
|
679
|
-
if (isCurrentView.value.year) currentView.value = VIEW.month;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
function onClickViewSwitch() {
|
|
683
|
-
const views = Object.values(VIEW);
|
|
684
|
-
const currentViewIndex = views.indexOf(currentView.value);
|
|
685
|
-
const nextViewIndex = currentViewIndex + 1;
|
|
686
|
-
|
|
687
|
-
activeDate.value = null;
|
|
688
|
-
|
|
689
|
-
currentView.value = views[nextViewIndex] || views.at(0);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
let lastValidHourValue = "";
|
|
693
|
-
let lastValidMinuteValue = "";
|
|
694
|
-
|
|
695
|
-
function onTimeKeydown(event) {
|
|
696
|
-
if ([KEY_CODE.left, KEY_CODE.up, KEY_CODE.right, KEY_CODE.down].includes(event.keyCode)) {
|
|
697
|
-
wrapperRef.value.focus();
|
|
698
|
-
|
|
699
|
-
return;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
if (event.keyCode === KEY_CODE.enter) {
|
|
703
|
-
enterKeyHandler(event);
|
|
704
|
-
|
|
705
|
-
emit("submit");
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
function onClickSubmit() {
|
|
710
|
-
emit("submit");
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
function onTimeInput(event, type, maxValue, minValue) {
|
|
714
|
-
const input = event.target;
|
|
715
|
-
const value = input.value;
|
|
716
|
-
const numericValue = Number(value);
|
|
717
|
-
|
|
718
|
-
const isHours = type === INPUT_TYPE.hours;
|
|
719
|
-
|
|
720
|
-
if (!isNumeric(event.data)) {
|
|
721
|
-
input.value = isHours ? lastValidHourValue : lastValidMinuteValue;
|
|
722
|
-
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
if (numericValue > maxValue || numericValue < minValue) {
|
|
727
|
-
input.value = "0".padStart(2, "0");
|
|
728
|
-
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
isHours ? (lastValidHourValue = numericValue) : (lastValidMinuteValue = numericValue);
|
|
733
|
-
|
|
734
|
-
if (selectedDate.value) {
|
|
735
|
-
const date = new Date(selectedDate.value.valueOf());
|
|
736
|
-
|
|
737
|
-
date.setHours(lastValidHourValue, lastValidMinuteValue);
|
|
738
|
-
localValue.value = date;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
input.value = String(numericValue).padStart(2, "0");
|
|
742
|
-
}
|
|
743
|
-
</script>
|