uview-ultra-plus 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/lime-dayuts/changelog.md +33 -0
- package/lime-dayuts/common/constant.ts +32 -0
- package/lime-dayuts/common/dates.ts +194 -0
- package/lime-dayuts/common/index.ts +1103 -0
- package/lime-dayuts/common/locale/en/index.ts +57 -0
- package/lime-dayuts/common/locale/zh-cn/index.ts +75 -0
- package/lime-dayuts/common/test.ts +106 -0
- package/lime-dayuts/common/use.ts +63 -0
- package/lime-dayuts/common/utils.ts +106 -0
- package/lime-dayuts/index.ts +6 -0
- package/lime-dayuts/package.json +106 -0
- package/lime-dayuts/readme - /345/211/257/346/234/254.md" +445 -0
- package/lime-dayuts/readme.md +264 -0
- package/lime-dayuts/utssdk/app-js/config.json +3 -0
- package/lime-dayuts/utssdk/app-js/index.uts +3 -0
- package/lime-dayuts/utssdk/interface.uts +405 -0
- package/lime-dayuts/utssdk/unierror.uts +39 -0
- package/package.json +42 -0
- package/uview-ultra/LICENSE +20 -0
- package/uview-ultra/README.md +76 -0
- package/uview-ultra/changelog.md +449 -0
- package/uview-ultra/components/up-action-sheet/actionSheet.js +26 -0
- package/uview-ultra/components/up-action-sheet/actionSheet.uts +28 -0
- package/uview-ultra/components/up-action-sheet/props.js +62 -0
- package/uview-ultra/components/up-action-sheet/props.uts +66 -0
- package/uview-ultra/components/up-action-sheet/types.uts +86 -0
- package/uview-ultra/components/up-action-sheet/up-action-sheet.uvue +337 -0
- package/uview-ultra/components/up-action-sheet/up-action-sheet.vue +283 -0
- package/uview-ultra/components/up-album/album.js +27 -0
- package/uview-ultra/components/up-album/album.uts +27 -0
- package/uview-ultra/components/up-album/props.js +81 -0
- package/uview-ultra/components/up-album/props.uts +84 -0
- package/uview-ultra/components/up-album/up-album.uvue +347 -0
- package/uview-ultra/components/up-album/up-album.vue +278 -0
- package/uview-ultra/components/up-alert/alert.js +22 -0
- package/uview-ultra/components/up-alert/alert.uts +22 -0
- package/uview-ultra/components/up-alert/props.js +46 -0
- package/uview-ultra/components/up-alert/props.uts +48 -0
- package/uview-ultra/components/up-alert/up-alert.uvue +287 -0
- package/uview-ultra/components/up-alert/up-alert.vue +249 -0
- package/uview-ultra/components/up-avatar/avatar.js +28 -0
- package/uview-ultra/components/up-avatar/avatar.uts +28 -0
- package/uview-ultra/components/up-avatar/props.js +82 -0
- package/uview-ultra/components/up-avatar/props.uts +82 -0
- package/uview-ultra/components/up-avatar/up-avatar.uvue +235 -0
- package/uview-ultra/components/up-avatar/up-avatar.vue +180 -0
- package/uview-ultra/components/up-avatar-group/avatarGroup.js +23 -0
- package/uview-ultra/components/up-avatar-group/avatarGroup.uts +23 -0
- package/uview-ultra/components/up-avatar-group/props.js +54 -0
- package/uview-ultra/components/up-avatar-group/props.uts +55 -0
- package/uview-ultra/components/up-avatar-group/up-avatar-group.uvue +160 -0
- package/uview-ultra/components/up-avatar-group/up-avatar-group.vue +110 -0
- package/uview-ultra/components/up-back-top/backtop.js +27 -0
- package/uview-ultra/components/up-back-top/backtop.uts +27 -0
- package/uview-ultra/components/up-back-top/props.js +56 -0
- package/uview-ultra/components/up-back-top/props.uts +57 -0
- package/uview-ultra/components/up-back-top/up-back-top.uvue +157 -0
- package/uview-ultra/components/up-back-top/up-back-top.vue +133 -0
- package/uview-ultra/components/up-badge/badge.js +27 -0
- package/uview-ultra/components/up-badge/badge.uts +27 -0
- package/uview-ultra/components/up-badge/props.js +79 -0
- package/uview-ultra/components/up-badge/props.uts +89 -0
- package/uview-ultra/components/up-badge/up-badge.uvue +260 -0
- package/uview-ultra/components/up-badge/up-badge.vue +179 -0
- package/uview-ultra/components/up-box/box.js +24 -0
- package/uview-ultra/components/up-box/box.uts +24 -0
- package/uview-ultra/components/up-box/props.js +57 -0
- package/uview-ultra/components/up-box/props.uts +58 -0
- package/uview-ultra/components/up-box/up-box.uvue +137 -0
- package/uview-ultra/components/up-box/up-box.vue +107 -0
- package/uview-ultra/components/up-button/button.js +42 -0
- package/uview-ultra/components/up-button/button.uts +42 -0
- package/uview-ultra/components/up-button/props.js +155 -0
- package/uview-ultra/components/up-button/props.uts +164 -0
- package/uview-ultra/components/up-button/up-button.uvue +609 -0
- package/uview-ultra/components/up-button/up-button.vue +442 -0
- package/uview-ultra/components/up-button/vue.scss +85 -0
- package/uview-ultra/components/up-calendar/calendar.js +42 -0
- package/uview-ultra/components/up-calendar/calendar.uts +42 -0
- package/uview-ultra/components/up-calendar/header.uvue +103 -0
- package/uview-ultra/components/up-calendar/header.vue +103 -0
- package/uview-ultra/components/up-calendar/month.uvue +608 -0
- package/uview-ultra/components/up-calendar/month.vue +587 -0
- package/uview-ultra/components/up-calendar/props.js +147 -0
- package/uview-ultra/components/up-calendar/props.uts +149 -0
- package/uview-ultra/components/up-calendar/up-calendar.uvue +632 -0
- package/uview-ultra/components/up-calendar/up-calendar.vue +409 -0
- package/uview-ultra/components/up-calendar/util.js +86 -0
- package/uview-ultra/components/up-calendar/util.uts +93 -0
- package/uview-ultra/components/up-car-keyboard/carKeyboard.js +15 -0
- package/uview-ultra/components/up-car-keyboard/carKeyboard.uts +16 -0
- package/uview-ultra/components/up-car-keyboard/props.js +17 -0
- package/uview-ultra/components/up-car-keyboard/props.uts +27 -0
- package/uview-ultra/components/up-car-keyboard/up-car-keyboard.uvue +337 -0
- package/uview-ultra/components/up-car-keyboard/up-car-keyboard.vue +315 -0
- package/uview-ultra/components/up-card/card.uts +58 -0
- package/uview-ultra/components/up-card/props.js +140 -0
- package/uview-ultra/components/up-card/props.uts +150 -0
- package/uview-ultra/components/up-card/up-card.uvue +292 -0
- package/uview-ultra/components/up-card/up-card.vue +186 -0
- package/uview-ultra/components/up-cell/cell.js +35 -0
- package/uview-ultra/components/up-cell/cell.uts +35 -0
- package/uview-ultra/components/up-cell/props.js +113 -0
- package/uview-ultra/components/up-cell/props.uts +108 -0
- package/uview-ultra/components/up-cell/up-cell.uvue +301 -0
- package/uview-ultra/components/up-cell/up-cell.vue +268 -0
- package/uview-ultra/components/up-cell-group/cellGroup.js +16 -0
- package/uview-ultra/components/up-cell-group/cellGroup.uts +16 -0
- package/uview-ultra/components/up-cell-group/props.js +16 -0
- package/uview-ultra/components/up-cell-group/props.uts +26 -0
- package/uview-ultra/components/up-cell-group/up-cell-group.uvue +61 -0
- package/uview-ultra/components/up-cell-group/up-cell-group.vue +67 -0
- package/uview-ultra/components/up-checkbox/checkbox.js +27 -0
- package/uview-ultra/components/up-checkbox/checkbox.uts +27 -0
- package/uview-ultra/components/up-checkbox/props.js +76 -0
- package/uview-ultra/components/up-checkbox/props.uts +77 -0
- package/uview-ultra/components/up-checkbox/up-checkbox.uvue +523 -0
- package/uview-ultra/components/up-checkbox/up-checkbox.vue +386 -0
- package/uview-ultra/components/up-checkbox-group/checkboxGroup.js +29 -0
- package/uview-ultra/components/up-checkbox-group/checkboxGroup.uts +29 -0
- package/uview-ultra/components/up-checkbox-group/props.js +93 -0
- package/uview-ultra/components/up-checkbox-group/props.uts +84 -0
- package/uview-ultra/components/up-checkbox-group/up-checkbox-group.uvue +195 -0
- package/uview-ultra/components/up-checkbox-group/up-checkbox-group.vue +137 -0
- package/uview-ultra/components/up-circle-progress/circleProgress.js +15 -0
- package/uview-ultra/components/up-circle-progress/props.js +10 -0
- package/uview-ultra/components/up-circle-progress/up-circle-progress.vue +201 -0
- package/uview-ultra/components/up-code/code.js +21 -0
- package/uview-ultra/components/up-code/code.uts +20 -0
- package/uview-ultra/components/up-code/props.js +36 -0
- package/uview-ultra/components/up-code/props.uts +47 -0
- package/uview-ultra/components/up-code/up-code.uvue +183 -0
- package/uview-ultra/components/up-code/up-code.vue +132 -0
- package/uview-ultra/components/up-code-input/codeInput.js +29 -0
- package/uview-ultra/components/up-code-input/codeInput.uts +29 -0
- package/uview-ultra/components/up-code-input/props.js +90 -0
- package/uview-ultra/components/up-code-input/props.uts +83 -0
- package/uview-ultra/components/up-code-input/up-code-input.uvue +321 -0
- package/uview-ultra/components/up-code-input/up-code-input.vue +300 -0
- package/uview-ultra/components/up-col/col.js +19 -0
- package/uview-ultra/components/up-col/col.uts +19 -0
- package/uview-ultra/components/up-col/props.js +32 -0
- package/uview-ultra/components/up-col/props.uts +41 -0
- package/uview-ultra/components/up-col/up-col.uvue +193 -0
- package/uview-ultra/components/up-col/up-col.vue +172 -0
- package/uview-ultra/components/up-collapse/collapse.js +17 -0
- package/uview-ultra/components/up-collapse/collapse.uts +17 -0
- package/uview-ultra/components/up-collapse/props.js +21 -0
- package/uview-ultra/components/up-collapse/props.uts +23 -0
- package/uview-ultra/components/up-collapse/up-collapse.uvue +116 -0
- package/uview-ultra/components/up-collapse/up-collapse.vue +91 -0
- package/uview-ultra/components/up-collapse-item/collapseItem.js +26 -0
- package/uview-ultra/components/up-collapse-item/collapseItem.uts +26 -0
- package/uview-ultra/components/up-collapse-item/props.js +66 -0
- package/uview-ultra/components/up-collapse-item/props.uts +69 -0
- package/uview-ultra/components/up-collapse-item/up-collapse-item.uvue +266 -0
- package/uview-ultra/components/up-collapse-item/up-collapse-item.vue +242 -0
- package/uview-ultra/components/up-column-notice/columnNotice.js +24 -0
- package/uview-ultra/components/up-column-notice/columnNotice.uts +24 -0
- package/uview-ultra/components/up-column-notice/props.js +57 -0
- package/uview-ultra/components/up-column-notice/props.uts +59 -0
- package/uview-ultra/components/up-column-notice/up-column-notice.uvue +194 -0
- package/uview-ultra/components/up-column-notice/up-column-notice.vue +165 -0
- package/uview-ultra/components/up-copy/up-copy.uvue +74 -0
- package/uview-ultra/components/up-copy/up-copy.vue +70 -0
- package/uview-ultra/components/up-count-down/countDown.js +18 -0
- package/uview-ultra/components/up-count-down/countDown.uts +18 -0
- package/uview-ultra/components/up-count-down/props.js +26 -0
- package/uview-ultra/components/up-count-down/props.uts +37 -0
- package/uview-ultra/components/up-count-down/up-count-down.uvue +194 -0
- package/uview-ultra/components/up-count-down/up-count-down.vue +166 -0
- package/uview-ultra/components/up-count-down/utils.js +62 -0
- package/uview-ultra/components/up-count-down/utils.uts +67 -0
- package/uview-ultra/components/up-count-to/countTo.js +25 -0
- package/uview-ultra/components/up-count-to/countTo.uts +25 -0
- package/uview-ultra/components/up-count-to/props.js +61 -0
- package/uview-ultra/components/up-count-to/props.uts +72 -0
- package/uview-ultra/components/up-count-to/up-count-to.uvue +307 -0
- package/uview-ultra/components/up-count-to/up-count-to.vue +189 -0
- package/uview-ultra/components/up-datetime-picker/datetimePicker.js +37 -0
- package/uview-ultra/components/up-datetime-picker/datetimePicker.uts +42 -0
- package/uview-ultra/components/up-datetime-picker/dayjs.esm.min.js +7 -0
- package/uview-ultra/components/up-datetime-picker/props.js +150 -0
- package/uview-ultra/components/up-datetime-picker/props.uts +154 -0
- package/uview-ultra/components/up-datetime-picker/up-datetime-picker.uvue +657 -0
- package/uview-ultra/components/up-datetime-picker/up-datetime-picker.vue +472 -0
- package/uview-ultra/components/up-divider/divider.js +23 -0
- package/uview-ultra/components/up-divider/divider.uts +22 -0
- package/uview-ultra/components/up-divider/props.js +46 -0
- package/uview-ultra/components/up-divider/props.uts +57 -0
- package/uview-ultra/components/up-divider/up-divider.uvue +142 -0
- package/uview-ultra/components/up-divider/up-divider.vue +121 -0
- package/uview-ultra/components/up-dropdown/dropdown.uts +25 -0
- package/uview-ultra/components/up-dropdown/props.js +61 -0
- package/uview-ultra/components/up-dropdown/props.uts +72 -0
- package/uview-ultra/components/up-dropdown/types.uts +5 -0
- package/uview-ultra/components/up-dropdown/up-dropdown.uvue +349 -0
- package/uview-ultra/components/up-dropdown/up-dropdown.vue +259 -0
- package/uview-ultra/components/up-dropdown-item/dropdown-item.uts +25 -0
- package/uview-ultra/components/up-dropdown-item/props.js +47 -0
- package/uview-ultra/components/up-dropdown-item/props.uts +56 -0
- package/uview-ultra/components/up-dropdown-item/up-dropdown-item.uvue +170 -0
- package/uview-ultra/components/up-dropdown-item/up-dropdown-item.vue +120 -0
- package/uview-ultra/components/up-empty/empty.js +26 -0
- package/uview-ultra/components/up-empty/empty.uts +24 -0
- package/uview-ultra/components/up-empty/props.js +61 -0
- package/uview-ultra/components/up-empty/props.uts +71 -0
- package/uview-ultra/components/up-empty/up-empty.uvue +179 -0
- package/uview-ultra/components/up-empty/up-empty.vue +133 -0
- package/uview-ultra/components/up-form/form.js +22 -0
- package/uview-ultra/components/up-form/form.uts +22 -0
- package/uview-ultra/components/up-form/props.js +47 -0
- package/uview-ultra/components/up-form/props.uts +57 -0
- package/uview-ultra/components/up-form/up-form.uvue +248 -0
- package/uview-ultra/components/up-form/up-form.vue +252 -0
- package/uview-ultra/components/up-form-item/formItem.js +24 -0
- package/uview-ultra/components/up-form-item/formItem.uts +24 -0
- package/uview-ultra/components/up-form-item/props.js +55 -0
- package/uview-ultra/components/up-form-item/props.uts +65 -0
- package/uview-ultra/components/up-form-item/up-form-item.uvue +264 -0
- package/uview-ultra/components/up-form-item/up-form-item.vue +261 -0
- package/uview-ultra/components/up-gap/gap.js +19 -0
- package/uview-ultra/components/up-gap/gap.uts +19 -0
- package/uview-ultra/components/up-gap/props.js +27 -0
- package/uview-ultra/components/up-gap/props.uts +36 -0
- package/uview-ultra/components/up-gap/up-gap.uvue +54 -0
- package/uview-ultra/components/up-gap/up-gap.vue +41 -0
- package/uview-ultra/components/up-grid/grid.js +17 -0
- package/uview-ultra/components/up-grid/grid.uts +17 -0
- package/uview-ultra/components/up-grid/props.js +28 -0
- package/uview-ultra/components/up-grid/props.uts +37 -0
- package/uview-ultra/components/up-grid/up-grid.uvue +145 -0
- package/uview-ultra/components/up-grid/up-grid.vue +114 -0
- package/uview-ultra/components/up-grid-item/gridItem.js +16 -0
- package/uview-ultra/components/up-grid-item/gridItem.uts +16 -0
- package/uview-ultra/components/up-grid-item/props.js +16 -0
- package/uview-ultra/components/up-grid-item/props.uts +27 -0
- package/uview-ultra/components/up-grid-item/up-grid-item.uvue +211 -0
- package/uview-ultra/components/up-grid-item/up-grid-item.vue +219 -0
- package/uview-ultra/components/up-icon/icon.js +36 -0
- package/uview-ultra/components/up-icon/icon.uts +33 -0
- package/uview-ultra/components/up-icon/icons.js +426 -0
- package/uview-ultra/components/up-icon/icons.uts +222 -0
- package/uview-ultra/components/up-icon/props.js +92 -0
- package/uview-ultra/components/up-icon/props.uts +101 -0
- package/uview-ultra/components/up-icon/up-icon.uvue +278 -0
- package/uview-ultra/components/up-icon/up-icon.vue +242 -0
- package/uview-ultra/components/up-image/image.js +30 -0
- package/uview-ultra/components/up-image/image.uts +30 -0
- package/uview-ultra/components/up-image/props.js +87 -0
- package/uview-ultra/components/up-image/props.uts +88 -0
- package/uview-ultra/components/up-image/up-image.uvue +246 -0
- package/uview-ultra/components/up-image/up-image.vue +237 -0
- package/uview-ultra/components/up-index-anchor/indexAnchor.js +19 -0
- package/uview-ultra/components/up-index-anchor/indexAnchor.uts +19 -0
- package/uview-ultra/components/up-index-anchor/props.js +31 -0
- package/uview-ultra/components/up-index-anchor/props.uts +41 -0
- package/uview-ultra/components/up-index-anchor/up-index-anchor.uvue +129 -0
- package/uview-ultra/components/up-index-anchor/up-index-anchor.vue +110 -0
- package/uview-ultra/components/up-index-item/indexItem.uts +15 -0
- package/uview-ultra/components/up-index-item/props.js +8 -0
- package/uview-ultra/components/up-index-item/props.uts +15 -0
- package/uview-ultra/components/up-index-item/up-index-item.uvue +92 -0
- package/uview-ultra/components/up-index-item/up-index-item.vue +89 -0
- package/uview-ultra/components/up-index-list/indexList.js +21 -0
- package/uview-ultra/components/up-index-list/indexList.uts +21 -0
- package/uview-ultra/components/up-index-list/props.js +41 -0
- package/uview-ultra/components/up-index-list/props.uts +51 -0
- package/uview-ultra/components/up-index-list/up-index-list.uvue +564 -0
- package/uview-ultra/components/up-index-list/up-index-list.vue +598 -0
- package/uview-ultra/components/up-input/input.js +48 -0
- package/uview-ultra/components/up-input/input.uts +49 -0
- package/uview-ultra/components/up-input/props.js +198 -0
- package/uview-ultra/components/up-input/props.uts +198 -0
- package/uview-ultra/components/up-input/up-input.uvue +545 -0
- package/uview-ultra/components/up-input/up-input.vue +394 -0
- package/uview-ultra/components/up-keyboard/keyboard.js +30 -0
- package/uview-ultra/components/up-keyboard/keyboard.uts +30 -0
- package/uview-ultra/components/up-keyboard/props.js +86 -0
- package/uview-ultra/components/up-keyboard/props.uts +97 -0
- package/uview-ultra/components/up-keyboard/up-keyboard.uvue +166 -0
- package/uview-ultra/components/up-keyboard/up-keyboard.vue +167 -0
- package/uview-ultra/components/up-lazy-load/lazyLoad.uts +19 -0
- package/uview-ultra/components/up-lazy-load/props.uts +74 -0
- package/uview-ultra/components/up-lazy-load/up-lazy-load.uvue +211 -0
- package/uview-ultra/components/up-lazy-load/up-lazy-load.vue +258 -0
- package/uview-ultra/components/up-line/line.js +20 -0
- package/uview-ultra/components/up-line/line.uts +20 -0
- package/uview-ultra/components/up-line/props.js +36 -0
- package/uview-ultra/components/up-line/props.uts +37 -0
- package/uview-ultra/components/up-line/up-line.uvue +61 -0
- package/uview-ultra/components/up-line/up-line.vue +66 -0
- package/uview-ultra/components/up-line-progress/lineProgress.js +19 -0
- package/uview-ultra/components/up-line-progress/props.js +30 -0
- package/uview-ultra/components/up-line-progress/up-line-progress.vue +149 -0
- package/uview-ultra/components/up-link/link.js +26 -0
- package/uview-ultra/components/up-link/link.uts +23 -0
- package/uview-ultra/components/up-link/props.js +41 -0
- package/uview-ultra/components/up-link/props.uts +43 -0
- package/uview-ultra/components/up-link/up-link.uvue +90 -0
- package/uview-ultra/components/up-link/up-link.vue +87 -0
- package/uview-ultra/components/up-list/list.js +28 -0
- package/uview-ultra/components/up-list/list.uts +33 -0
- package/uview-ultra/components/up-list/props.js +101 -0
- package/uview-ultra/components/up-list/props.uts +111 -0
- package/uview-ultra/components/up-list/up-list.uvue +146 -0
- package/uview-ultra/components/up-list/up-list.vue +185 -0
- package/uview-ultra/components/up-list-item/listItem.js +15 -0
- package/uview-ultra/components/up-list-item/listItem.uts +15 -0
- package/uview-ultra/components/up-list-item/props.js +11 -0
- package/uview-ultra/components/up-list-item/props.uts +21 -0
- package/uview-ultra/components/up-list-item/up-list-item.uvue +125 -0
- package/uview-ultra/components/up-list-item/up-list-item.vue +118 -0
- package/uview-ultra/components/up-loading-icon/loadingIcon.js +30 -0
- package/uview-ultra/components/up-loading-icon/loadingIcon.uts +28 -0
- package/uview-ultra/components/up-loading-icon/props.js +62 -0
- package/uview-ultra/components/up-loading-icon/props.uts +71 -0
- package/uview-ultra/components/up-loading-icon/up-loading-icon.uvue +311 -0
- package/uview-ultra/components/up-loading-icon/up-loading-icon.vue +349 -0
- package/uview-ultra/components/up-loading-page/loadingPage.js +24 -0
- package/uview-ultra/components/up-loading-page/loadingPage.uts +24 -0
- package/uview-ultra/components/up-loading-page/props.js +57 -0
- package/uview-ultra/components/up-loading-page/props.uts +58 -0
- package/uview-ultra/components/up-loading-page/up-loading-page.uvue +129 -0
- package/uview-ultra/components/up-loading-page/up-loading-page.vue +123 -0
- package/uview-ultra/components/up-loadmore/loadmore.js +32 -0
- package/uview-ultra/components/up-loadmore/loadmore.uts +32 -0
- package/uview-ultra/components/up-loadmore/props.js +96 -0
- package/uview-ultra/components/up-loadmore/props.uts +107 -0
- package/uview-ultra/components/up-loadmore/up-loadmore.uvue +160 -0
- package/uview-ultra/components/up-loadmore/up-loadmore.vue +155 -0
- package/uview-ultra/components/up-modal/modal.js +36 -0
- package/uview-ultra/components/up-modal/modal.uts +36 -0
- package/uview-ultra/components/up-modal/props.js +111 -0
- package/uview-ultra/components/up-modal/props.uts +113 -0
- package/uview-ultra/components/up-modal/up-modal.uvue +269 -0
- package/uview-ultra/components/up-modal/up-modal.vue +265 -0
- package/uview-ultra/components/up-navbar/navbar.js +33 -0
- package/uview-ultra/components/up-navbar/navbar.uts +32 -0
- package/uview-ultra/components/up-navbar/props.js +87 -0
- package/uview-ultra/components/up-navbar/props.uts +88 -0
- package/uview-ultra/components/up-navbar/up-navbar.uvue +205 -0
- package/uview-ultra/components/up-navbar/up-navbar.vue +193 -0
- package/uview-ultra/components/up-navbar-mini/navbarMini.js +23 -0
- package/uview-ultra/components/up-navbar-mini/navbarMini.uts +23 -0
- package/uview-ultra/components/up-navbar-mini/props.js +51 -0
- package/uview-ultra/components/up-navbar-mini/props.uts +53 -0
- package/uview-ultra/components/up-navbar-mini/up-navbar-mini.uvue +146 -0
- package/uview-ultra/components/up-navbar-mini/up-navbar-mini.vue +137 -0
- package/uview-ultra/components/up-no-network/noNetwork.js +18 -0
- package/uview-ultra/components/up-no-network/noNetwork.uts +18 -0
- package/uview-ultra/components/up-no-network/props.js +21 -0
- package/uview-ultra/components/up-no-network/props.uts +31 -0
- package/uview-ultra/components/up-no-network/up-no-network.uvue +227 -0
- package/uview-ultra/components/up-no-network/up-no-network.vue +224 -0
- package/uview-ultra/components/up-notice-bar/noticeBar.js +27 -0
- package/uview-ultra/components/up-notice-bar/noticeBar.uts +27 -0
- package/uview-ultra/components/up-notice-bar/props.js +72 -0
- package/uview-ultra/components/up-notice-bar/props.uts +74 -0
- package/uview-ultra/components/up-notice-bar/up-notice-bar.uvue +108 -0
- package/uview-ultra/components/up-notice-bar/up-notice-bar.vue +105 -0
- package/uview-ultra/components/up-notify/notify.js +22 -0
- package/uview-ultra/components/up-notify/notify.uts +22 -0
- package/uview-ultra/components/up-notify/props.js +51 -0
- package/uview-ultra/components/up-notify/props.uts +56 -0
- package/uview-ultra/components/up-notify/up-notify.uvue +253 -0
- package/uview-ultra/components/up-notify/up-notify.vue +217 -0
- package/uview-ultra/components/up-number-box/numberBox.js +40 -0
- package/uview-ultra/components/up-number-box/numberBox.uts +40 -0
- package/uview-ultra/components/up-number-box/props.js +145 -0
- package/uview-ultra/components/up-number-box/props.uts +148 -0
- package/uview-ultra/components/up-number-box/up-number-box.uvue +447 -0
- package/uview-ultra/components/up-number-box/up-number-box.vue +479 -0
- package/uview-ultra/components/up-number-keyboard/numberKeyboard.js +17 -0
- package/uview-ultra/components/up-number-keyboard/numberKeyboard.uts +17 -0
- package/uview-ultra/components/up-number-keyboard/props.js +21 -0
- package/uview-ultra/components/up-number-keyboard/props.uts +32 -0
- package/uview-ultra/components/up-number-keyboard/up-number-keyboard.uvue +208 -0
- package/uview-ultra/components/up-number-keyboard/up-number-keyboard.vue +199 -0
- package/uview-ultra/components/up-overlay/overlay.js +18 -0
- package/uview-ultra/components/up-overlay/overlay.uts +18 -0
- package/uview-ultra/components/up-overlay/props.js +26 -0
- package/uview-ultra/components/up-overlay/props.uts +28 -0
- package/uview-ultra/components/up-overlay/up-overlay.uvue +71 -0
- package/uview-ultra/components/up-overlay/up-overlay.vue +71 -0
- package/uview-ultra/components/up-parse/node/node.vue +584 -0
- package/uview-ultra/components/up-parse/parse.js +22 -0
- package/uview-ultra/components/up-parse/parser.js +1333 -0
- package/uview-ultra/components/up-parse/props.js +48 -0
- package/uview-ultra/components/up-parse/up-parse.vue +499 -0
- package/uview-ultra/components/up-picker/picker.js +30 -0
- package/uview-ultra/components/up-picker/picker.uts +30 -0
- package/uview-ultra/components/up-picker/props.js +103 -0
- package/uview-ultra/components/up-picker/props.uts +114 -0
- package/uview-ultra/components/up-picker/up-picker.uvue +391 -0
- package/uview-ultra/components/up-picker/up-picker.vue +345 -0
- package/uview-ultra/components/up-picker-column/props.js +7 -0
- package/uview-ultra/components/up-picker-column/props.uts +7 -0
- package/uview-ultra/components/up-picker-column/up-picker-column.uvue +28 -0
- package/uview-ultra/components/up-picker-column/up-picker-column.vue +28 -0
- package/uview-ultra/components/up-popup/popup.js +29 -0
- package/uview-ultra/components/up-popup/popup.uts +28 -0
- package/uview-ultra/components/up-popup/props.js +81 -0
- package/uview-ultra/components/up-popup/props.uts +91 -0
- package/uview-ultra/components/up-popup/up-popup.uvue +318 -0
- package/uview-ultra/components/up-popup/up-popup.vue +310 -0
- package/uview-ultra/components/up-qrcode/qrcode.js +1281 -0
- package/uview-ultra/components/up-qrcode/up-qrcode.vue +536 -0
- package/uview-ultra/components/up-radio/props.js +71 -0
- package/uview-ultra/components/up-radio/props.uts +81 -0
- package/uview-ultra/components/up-radio/radio.js +27 -0
- package/uview-ultra/components/up-radio/radio.uts +27 -0
- package/uview-ultra/components/up-radio/up-radio.uvue +393 -0
- package/uview-ultra/components/up-radio/up-radio.vue +348 -0
- package/uview-ultra/components/up-radio-group/props.js +95 -0
- package/uview-ultra/components/up-radio-group/props.uts +90 -0
- package/uview-ultra/components/up-radio-group/radioGroup.js +30 -0
- package/uview-ultra/components/up-radio-group/radioGroup.uts +30 -0
- package/uview-ultra/components/up-radio-group/up-radio-group.uvue +113 -0
- package/uview-ultra/components/up-radio-group/up-radio-group.vue +128 -0
- package/uview-ultra/components/up-rate/props.js +80 -0
- package/uview-ultra/components/up-rate/props.uts +82 -0
- package/uview-ultra/components/up-rate/rate.js +26 -0
- package/uview-ultra/components/up-rate/rate.uts +27 -0
- package/uview-ultra/components/up-rate/up-rate.uvue +316 -0
- package/uview-ultra/components/up-rate/up-rate.vue +327 -0
- package/uview-ultra/components/up-read-more/props.js +63 -0
- package/uview-ultra/components/up-read-more/props.uts +61 -0
- package/uview-ultra/components/up-read-more/readMore.js +23 -0
- package/uview-ultra/components/up-read-more/readMore.uts +23 -0
- package/uview-ultra/components/up-read-more/up-read-more.uvue +160 -0
- package/uview-ultra/components/up-read-more/up-read-more.vue +165 -0
- package/uview-ultra/components/up-row/props.js +22 -0
- package/uview-ultra/components/up-row/props.uts +31 -0
- package/uview-ultra/components/up-row/row.js +17 -0
- package/uview-ultra/components/up-row/row.uts +17 -0
- package/uview-ultra/components/up-row/up-row.uvue +118 -0
- package/uview-ultra/components/up-row/up-row.vue +97 -0
- package/uview-ultra/components/up-row-notice/props.js +41 -0
- package/uview-ultra/components/up-row-notice/props.uts +43 -0
- package/uview-ultra/components/up-row-notice/rowNotice.js +21 -0
- package/uview-ultra/components/up-row-notice/rowNotice.uts +21 -0
- package/uview-ultra/components/up-row-notice/up-row-notice.uvue +304 -0
- package/uview-ultra/components/up-row-notice/up-row-notice.vue +337 -0
- package/uview-ultra/components/up-safe-bottom/props.js +7 -0
- package/uview-ultra/components/up-safe-bottom/props.uts +6 -0
- package/uview-ultra/components/up-safe-bottom/up-safe-bottom.uvue +59 -0
- package/uview-ultra/components/up-safe-bottom/up-safe-bottom.vue +59 -0
- package/uview-ultra/components/up-scroll-list/nvue.js +31 -0
- package/uview-ultra/components/up-scroll-list/props.js +36 -0
- package/uview-ultra/components/up-scroll-list/props.uts +38 -0
- package/uview-ultra/components/up-scroll-list/scrollList.js +20 -0
- package/uview-ultra/components/up-scroll-list/scrollList.uts +20 -0
- package/uview-ultra/components/up-scroll-list/scrollWxs.wxs +50 -0
- package/uview-ultra/components/up-scroll-list/up-scroll-list.uvue +212 -0
- package/uview-ultra/components/up-scroll-list/up-scroll-list.vue +233 -0
- package/uview-ultra/components/up-search/props.js +156 -0
- package/uview-ultra/components/up-search/props.uts +152 -0
- package/uview-ultra/components/up-search/search.js +41 -0
- package/uview-ultra/components/up-search/search.uts +41 -0
- package/uview-ultra/components/up-search/up-search.uvue +364 -0
- package/uview-ultra/components/up-search/up-search.vue +354 -0
- package/uview-ultra/components/up-skeleton/props.js +61 -0
- package/uview-ultra/components/up-skeleton/props.uts +69 -0
- package/uview-ultra/components/up-skeleton/skeleton.js +25 -0
- package/uview-ultra/components/up-skeleton/skeleton.uts +22 -0
- package/uview-ultra/components/up-skeleton/up-skeleton.uvue +228 -0
- package/uview-ultra/components/up-skeleton/up-skeleton.vue +248 -0
- package/uview-ultra/components/up-slider/props.js +95 -0
- package/uview-ultra/components/up-slider/props.uts +102 -0
- package/uview-ultra/components/up-slider/slider.js +28 -0
- package/uview-ultra/components/up-slider/slider.uts +25 -0
- package/uview-ultra/components/up-slider/up-slider.uvue +547 -0
- package/uview-ultra/components/up-slider/up-slider.vue +511 -0
- package/uview-ultra/components/up-status-bar/props.js +10 -0
- package/uview-ultra/components/up-status-bar/props.uts +12 -0
- package/uview-ultra/components/up-status-bar/statusBar.js +15 -0
- package/uview-ultra/components/up-status-bar/statusBar.uts +15 -0
- package/uview-ultra/components/up-status-bar/up-status-bar.uvue +47 -0
- package/uview-ultra/components/up-status-bar/up-status-bar.vue +49 -0
- package/uview-ultra/components/up-steps/props.js +41 -0
- package/uview-ultra/components/up-steps/props.uts +43 -0
- package/uview-ultra/components/up-steps/steps.js +21 -0
- package/uview-ultra/components/up-steps/steps.uts +22 -0
- package/uview-ultra/components/up-steps/up-steps.uvue +93 -0
- package/uview-ultra/components/up-steps/up-steps.vue +94 -0
- package/uview-ultra/components/up-steps-item/props.js +31 -0
- package/uview-ultra/components/up-steps-item/props.uts +33 -0
- package/uview-ultra/components/up-steps-item/stepsItem.js +18 -0
- package/uview-ultra/components/up-steps-item/stepsItem.uts +18 -0
- package/uview-ultra/components/up-steps-item/up-steps-item.uvue +412 -0
- package/uview-ultra/components/up-steps-item/up-steps-item.vue +349 -0
- package/uview-ultra/components/up-sticky/props.js +42 -0
- package/uview-ultra/components/up-sticky/props.uts +52 -0
- package/uview-ultra/components/up-sticky/sticky.js +20 -0
- package/uview-ultra/components/up-sticky/sticky.uts +20 -0
- package/uview-ultra/components/up-sticky/up-sticky.uvue +173 -0
- package/uview-ultra/components/up-sticky/up-sticky.vue +221 -0
- package/uview-ultra/components/up-subsection/props.js +51 -0
- package/uview-ultra/components/up-subsection/props.uts +53 -0
- package/uview-ultra/components/up-subsection/subsection.js +23 -0
- package/uview-ultra/components/up-subsection/subsection.uts +23 -0
- package/uview-ultra/components/up-subsection/up-subsection.uvue +301 -0
- package/uview-ultra/components/up-subsection/up-subsection.vue +318 -0
- package/uview-ultra/components/up-swipe-action/props.js +16 -0
- package/uview-ultra/components/up-swipe-action/props.uts +18 -0
- package/uview-ultra/components/up-swipe-action/swipeAction.js +15 -0
- package/uview-ultra/components/up-swipe-action/swipeAction.uts +16 -0
- package/uview-ultra/components/up-swipe-action/up-swipe-action.uvue +88 -0
- package/uview-ultra/components/up-swipe-action/up-swipe-action.vue +84 -0
- package/uview-ultra/components/up-swipe-action-item/alipay.sjs +229 -0
- package/uview-ultra/components/up-swipe-action-item/index.wxs +234 -0
- package/uview-ultra/components/up-swipe-action-item/nvue.js +174 -0
- package/uview-ultra/components/up-swipe-action-item/other.js +178 -0
- package/uview-ultra/components/up-swipe-action-item/other.uts +176 -0
- package/uview-ultra/components/up-swipe-action-item/props.js +47 -0
- package/uview-ultra/components/up-swipe-action-item/props.uts +48 -0
- package/uview-ultra/components/up-swipe-action-item/swipeActionItem.js +22 -0
- package/uview-ultra/components/up-swipe-action-item/swipeActionItem.uts +23 -0
- package/uview-ultra/components/up-swipe-action-item/types.uts +11 -0
- package/uview-ultra/components/up-swipe-action-item/up-swipe-action-item.uvue +382 -0
- package/uview-ultra/components/up-swipe-action-item/up-swipe-action-item.vue +249 -0
- package/uview-ultra/components/up-swipe-action-item/wxs.js +15 -0
- package/uview-ultra/components/up-swiper/props.js +127 -0
- package/uview-ultra/components/up-swiper/props.uts +137 -0
- package/uview-ultra/components/up-swiper/swiper.js +39 -0
- package/uview-ultra/components/up-swiper/swiper.uts +38 -0
- package/uview-ultra/components/up-swiper/up-swiper.uvue +290 -0
- package/uview-ultra/components/up-swiper/up-swiper.vue +269 -0
- package/uview-ultra/components/up-swiper-indicator/props.js +31 -0
- package/uview-ultra/components/up-swiper-indicator/props.uts +41 -0
- package/uview-ultra/components/up-swiper-indicator/swipterIndicator.js +19 -0
- package/uview-ultra/components/up-swiper-indicator/swipterIndicator.uts +19 -0
- package/uview-ultra/components/up-swiper-indicator/up-swiper-indicator.uvue +123 -0
- package/uview-ultra/components/up-swiper-indicator/up-swiper-indicator.vue +114 -0
- package/uview-ultra/components/up-switch/props.js +64 -0
- package/uview-ultra/components/up-switch/props.uts +82 -0
- package/uview-ultra/components/up-switch/switch.js +24 -0
- package/uview-ultra/components/up-switch/switch.uts +27 -0
- package/uview-ultra/components/up-switch/up-switch.uvue +193 -0
- package/uview-ultra/components/up-switch/up-switch.vue +215 -0
- package/uview-ultra/components/up-tabbar/props.js +57 -0
- package/uview-ultra/components/up-tabbar/props.uts +66 -0
- package/uview-ultra/components/up-tabbar/tabbar.js +24 -0
- package/uview-ultra/components/up-tabbar/tabbar.uts +24 -0
- package/uview-ultra/components/up-tabbar/up-tabbar.uvue +149 -0
- package/uview-ultra/components/up-tabbar/up-tabbar.vue +151 -0
- package/uview-ultra/components/up-tabbar-item/props.js +41 -0
- package/uview-ultra/components/up-tabbar-item/props.uts +51 -0
- package/uview-ultra/components/up-tabbar-item/tabbarItem.js +21 -0
- package/uview-ultra/components/up-tabbar-item/tabbarItem.uts +21 -0
- package/uview-ultra/components/up-tabbar-item/up-tabbar-item.uvue +207 -0
- package/uview-ultra/components/up-tabbar-item/up-tabbar-item.vue +197 -0
- package/uview-ultra/components/up-table/props.js +7 -0
- package/uview-ultra/components/up-table/props.uts +39 -0
- package/uview-ultra/components/up-table/table.uts +21 -0
- package/uview-ultra/components/up-table/up-table.uvue +111 -0
- package/uview-ultra/components/up-table/up-table.vue +104 -0
- package/uview-ultra/components/up-tabs/props.js +71 -0
- package/uview-ultra/components/up-tabs/props.uts +73 -0
- package/uview-ultra/components/up-tabs/tabs.js +33 -0
- package/uview-ultra/components/up-tabs/tabs.uts +34 -0
- package/uview-ultra/components/up-tabs/types.uts +19 -0
- package/uview-ultra/components/up-tabs/up-tabs.uvue +417 -0
- package/uview-ultra/components/up-tabs/up-tabs.vue +413 -0
- package/uview-ultra/components/up-tabs-item/props.js +7 -0
- package/uview-ultra/components/up-tabs-item/props.uts +7 -0
- package/uview-ultra/components/up-tabs-item/up-tabs-item.uvue +31 -0
- package/uview-ultra/components/up-tabs-item/up-tabs-item.vue +31 -0
- package/uview-ultra/components/up-tag/props.js +91 -0
- package/uview-ultra/components/up-tag/props.uts +100 -0
- package/uview-ultra/components/up-tag/tag.js +30 -0
- package/uview-ultra/components/up-tag/tag.uts +30 -0
- package/uview-ultra/components/up-tag/up-tag.uvue +370 -0
- package/uview-ultra/components/up-tag/up-tag.vue +368 -0
- package/uview-ultra/components/up-td/props.js +7 -0
- package/uview-ultra/components/up-td/props.uts +7 -0
- package/uview-ultra/components/up-td/td.uts +19 -0
- package/uview-ultra/components/up-td/up-td.uvue +105 -0
- package/uview-ultra/components/up-td/up-td.vue +98 -0
- package/uview-ultra/components/up-text/props.js +118 -0
- package/uview-ultra/components/up-text/props.uts +154 -0
- package/uview-ultra/components/up-text/text.js +39 -0
- package/uview-ultra/components/up-text/text.uts +44 -0
- package/uview-ultra/components/up-text/up-text.uvue +339 -0
- package/uview-ultra/components/up-text/up-text.vue +228 -0
- package/uview-ultra/components/up-text/value.js +87 -0
- package/uview-ultra/components/up-textarea/props.js +127 -0
- package/uview-ultra/components/up-textarea/props.uts +125 -0
- package/uview-ultra/components/up-textarea/textarea.js +36 -0
- package/uview-ultra/components/up-textarea/textarea.uts +36 -0
- package/uview-ultra/components/up-textarea/up-textarea.uvue +258 -0
- package/uview-ultra/components/up-textarea/up-textarea.vue +278 -0
- package/uview-ultra/components/up-th/props.js +7 -0
- package/uview-ultra/components/up-th/props.uts +7 -0
- package/uview-ultra/components/up-th/th.uts +16 -0
- package/uview-ultra/components/up-th/up-th.uvue +74 -0
- package/uview-ultra/components/up-th/up-th.vue +66 -0
- package/uview-ultra/components/up-title/up-title.uvue +36 -0
- package/uview-ultra/components/up-title/up-title.vue +36 -0
- package/uview-ultra/components/up-toast/toast.js +30 -0
- package/uview-ultra/components/up-toast/toast.uts +29 -0
- package/uview-ultra/components/up-toast/up-toast.uvue +330 -0
- package/uview-ultra/components/up-toast/up-toast.vue +304 -0
- package/uview-ultra/components/up-toolbar/props.js +41 -0
- package/uview-ultra/components/up-toolbar/props.uts +43 -0
- package/uview-ultra/components/up-toolbar/toolbar.js +21 -0
- package/uview-ultra/components/up-toolbar/toolbar.uts +20 -0
- package/uview-ultra/components/up-toolbar/up-toolbar.uvue +125 -0
- package/uview-ultra/components/up-toolbar/up-toolbar.vue +125 -0
- package/uview-ultra/components/up-tooltip/props.js +61 -0
- package/uview-ultra/components/up-tooltip/tooltip.js +25 -0
- package/uview-ultra/components/up-tooltip/up-tooltip.vue +342 -0
- package/uview-ultra/components/up-tr/props.js +7 -0
- package/uview-ultra/components/up-tr/props.uts +7 -0
- package/uview-ultra/components/up-tr/up-tr.uvue +22 -0
- package/uview-ultra/components/up-tr/up-tr.vue +34 -0
- package/uview-ultra/components/up-transition/nvue-ani-map.js +68 -0
- package/uview-ultra/components/up-transition/props.js +27 -0
- package/uview-ultra/components/up-transition/props.uts +36 -0
- package/uview-ultra/components/up-transition/transition.js +18 -0
- package/uview-ultra/components/up-transition/transition.uts +18 -0
- package/uview-ultra/components/up-transition/transitionMixin.js +163 -0
- package/uview-ultra/components/up-transition/up-transition.uvue +161 -0
- package/uview-ultra/components/up-transition/up-transition.vue +96 -0
- package/uview-ultra/components/up-transition/vue.ani-style.scss +113 -0
- package/uview-ultra/components/up-upload/mixin.js +23 -0
- package/uview-ultra/components/up-upload/mixin.uts +24 -0
- package/uview-ultra/components/up-upload/props.js +176 -0
- package/uview-ultra/components/up-upload/props.uts +176 -0
- package/uview-ultra/components/up-upload/types.uts +38 -0
- package/uview-ultra/components/up-upload/up-upload.uvue +965 -0
- package/uview-ultra/components/up-upload/up-upload.vue +927 -0
- package/uview-ultra/components/up-upload/upload.js +46 -0
- package/uview-ultra/components/up-upload/upload.uts +46 -0
- package/uview-ultra/components/up-upload/utils.js +180 -0
- package/uview-ultra/components/up-upload/utils.uts +213 -0
- package/uview-ultra/components/up-waterfall/props.uts +49 -0
- package/uview-ultra/components/up-waterfall/up-waterfall.uvue +344 -0
- package/uview-ultra/components/up-waterfall/up-waterfall.vue +416 -0
- package/uview-ultra/components/up-waterfall/waterfall.uts +20 -0
- package/uview-ultra/index.js +145 -0
- package/uview-ultra/index.scss +18 -0
- package/uview-ultra/index.uts +67 -0
- package/uview-ultra/libs/composable/useButton.uts +61 -0
- package/uview-ultra/libs/composable/useFuncIndex.uts +861 -0
- package/uview-ultra/libs/composable/useMp.uts +6 -0
- package/uview-ultra/libs/composable/useOpenType.uts +63 -0
- package/uview-ultra/libs/composable/useUltraUI.uts +206 -0
- package/uview-ultra/libs/config/color.js +17 -0
- package/uview-ultra/libs/config/color.uts +17 -0
- package/uview-ultra/libs/config/config.js +33 -0
- package/uview-ultra/libs/config/config.uts +33 -0
- package/uview-ultra/libs/config/props.js +190 -0
- package/uview-ultra/libs/config/props.uts +3 -0
- package/uview-ultra/libs/config/zIndex.js +20 -0
- package/uview-ultra/libs/config/zIndex.uts +20 -0
- package/uview-ultra/libs/css/color.scss +311 -0
- package/uview-ultra/libs/css/common.scss +121 -0
- package/uview-ultra/libs/css/components.scss +34 -0
- package/uview-ultra/libs/css/flex.scss +368 -0
- package/uview-ultra/libs/css/h5.scss +0 -0
- package/uview-ultra/libs/css/mixin.scss +8 -0
- package/uview-ultra/libs/css/mp.scss +0 -0
- package/uview-ultra/libs/css/vue.scss +35 -0
- package/uview-ultra/libs/function/colorGradient.js +134 -0
- package/uview-ultra/libs/function/colorGradient.uts +316 -0
- package/uview-ultra/libs/function/debounce.js +29 -0
- package/uview-ultra/libs/function/debounce.uts +33 -0
- package/uview-ultra/libs/function/digit.js +167 -0
- package/uview-ultra/libs/function/digit.uts +182 -0
- package/uview-ultra/libs/function/index.js +747 -0
- package/uview-ultra/libs/function/index.uts +826 -0
- package/uview-ultra/libs/function/platform.js +75 -0
- package/uview-ultra/libs/function/platform.uts +75 -0
- package/uview-ultra/libs/function/test.js +330 -0
- package/uview-ultra/libs/function/test.uts +343 -0
- package/uview-ultra/libs/function/throttle.js +30 -0
- package/uview-ultra/libs/function/throttle.uts +36 -0
- package/uview-ultra/libs/i18n/index.js +55 -0
- package/uview-ultra/libs/i18n/index.uts +65 -0
- package/uview-ultra/libs/i18n/locales/de.json +85 -0
- package/uview-ultra/libs/i18n/locales/en.json +85 -0
- package/uview-ultra/libs/i18n/locales/es.json +85 -0
- package/uview-ultra/libs/i18n/locales/fr.json +85 -0
- package/uview-ultra/libs/i18n/locales/ja.json +85 -0
- package/uview-ultra/libs/i18n/locales/ko.json +85 -0
- package/uview-ultra/libs/i18n/locales/ru.json +85 -0
- package/uview-ultra/libs/i18n/locales/th.json +85 -0
- package/uview-ultra/libs/i18n/locales/zh-Hans.json +85 -0
- package/uview-ultra/libs/i18n/locales/zh-Hant.json +85 -0
- package/uview-ultra/libs/luch-request/adapters/index.js +97 -0
- package/uview-ultra/libs/luch-request/core/InterceptorManager.js +50 -0
- package/uview-ultra/libs/luch-request/core/Request.js +198 -0
- package/uview-ultra/libs/luch-request/core/buildFullPath.js +20 -0
- package/uview-ultra/libs/luch-request/core/defaults.js +29 -0
- package/uview-ultra/libs/luch-request/core/dispatchRequest.js +3 -0
- package/uview-ultra/libs/luch-request/core/mergeConfig.js +103 -0
- package/uview-ultra/libs/luch-request/core/settle.js +16 -0
- package/uview-ultra/libs/luch-request/helpers/buildURL.js +69 -0
- package/uview-ultra/libs/luch-request/helpers/combineURLs.js +14 -0
- package/uview-ultra/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/uview-ultra/libs/luch-request/index.d.ts +116 -0
- package/uview-ultra/libs/luch-request/index.js +3 -0
- package/uview-ultra/libs/luch-request/utils/clone.js +264 -0
- package/uview-ultra/libs/luch-request/utils.js +131 -0
- package/uview-ultra/libs/mixin/button.js +18 -0
- package/uview-ultra/libs/mixin/button.uts +15 -0
- package/uview-ultra/libs/mixin/mixin.js +201 -0
- package/uview-ultra/libs/mixin/mixin.uts +220 -0
- package/uview-ultra/libs/mixin/mpMixin.js +13 -0
- package/uview-ultra/libs/mixin/mpMixin.uts +10 -0
- package/uview-ultra/libs/mixin/mpShare.js +27 -0
- package/uview-ultra/libs/mixin/mpShare.uts +26 -0
- package/uview-ultra/libs/mixin/openType.js +27 -0
- package/uview-ultra/libs/mixin/openType.uts +36 -0
- package/uview-ultra/libs/mixin/style.js +249 -0
- package/uview-ultra/libs/mixin/touch.js +61 -0
- package/uview-ultra/libs/mixin/touch.uts +72 -0
- package/uview-ultra/libs/util/async-validator.js +1343 -0
- package/uview-ultra/libs/util/async-validator.uts +1339 -0
- package/uview-ultra/libs/util/calendar.js +546 -0
- package/uview-ultra/libs/util/calendar.uts +546 -0
- package/uview-ultra/libs/util/emitter.js +51 -0
- package/uview-ultra/libs/util/route.js +124 -0
- package/uview-ultra/libs/util/route.uts +130 -0
- package/uview-ultra/libs/vue.js +3 -0
- package/uview-ultra/libs/vue.uts +8 -0
- package/uview-ultra/package.json +108 -0
- package/uview-ultra/theme.scss +77 -0
- package/uview-ultra/types/common.uts +14 -0
- package/uview-ultra/types/comps/_common.d.ts +9 -0
- package/uview-ultra/types/comps/actionSheet.d.ts +121 -0
- package/uview-ultra/types/comps/album.d.ts +82 -0
- package/uview-ultra/types/comps/alert.d.ts +55 -0
- package/uview-ultra/types/comps/avatar.d.ts +85 -0
- package/uview-ultra/types/comps/avatarGroup.d.ts +62 -0
- package/uview-ultra/types/comps/backTop.d.ts +74 -0
- package/uview-ultra/types/comps/badge.d.ts +76 -0
- package/uview-ultra/types/comps/button.d.ts +169 -0
- package/uview-ultra/types/comps/calendar.d.ts +164 -0
- package/uview-ultra/types/comps/cell.d.ts +133 -0
- package/uview-ultra/types/comps/cellGroup.d.ts +27 -0
- package/uview-ultra/types/comps/checkbox.d.ts +69 -0
- package/uview-ultra/types/comps/checkboxGroup.d.ts +93 -0
- package/uview-ultra/types/comps/code.d.ts +69 -0
- package/uview-ultra/types/comps/codeInput.d.ts +98 -0
- package/uview-ultra/types/comps/col.d.ts +43 -0
- package/uview-ultra/types/comps/collapse.d.ts +52 -0
- package/uview-ultra/types/comps/collapseItem.d.ts +83 -0
- package/uview-ultra/types/comps/countDown.d.ts +60 -0
- package/uview-ultra/types/comps/countTo.d.ts +88 -0
- package/uview-ultra/types/comps/datetimePicker.d.ts +146 -0
- package/uview-ultra/types/comps/divider.d.ts +58 -0
- package/uview-ultra/types/comps/empty.d.ts +72 -0
- package/uview-ultra/types/comps/form.d.ts +76 -0
- package/uview-ultra/types/comps/formItem.d.ts +68 -0
- package/uview-ultra/types/comps/gap.d.ts +35 -0
- package/uview-ultra/types/comps/grid.d.ts +34 -0
- package/uview-ultra/types/comps/gridItem.d.ts +28 -0
- package/uview-ultra/types/comps/icon.d.ts +93 -0
- package/uview-ultra/types/comps/image.d.ts +119 -0
- package/uview-ultra/types/comps/indexAnchor.d.ts +38 -0
- package/uview-ultra/types/comps/indexItem.d.ts +18 -0
- package/uview-ultra/types/comps/indexList.d.ts +39 -0
- package/uview-ultra/types/comps/input.d.ts +234 -0
- package/uview-ultra/types/comps/keyboard.d.ts +125 -0
- package/uview-ultra/types/comps/line.d.ts +44 -0
- package/uview-ultra/types/comps/lineProgress.d.ts +51 -0
- package/uview-ultra/types/comps/link.d.ts +51 -0
- package/uview-ultra/types/comps/list.d.ts +92 -0
- package/uview-ultra/types/comps/listItem.d.ts +18 -0
- package/uview-ultra/types/comps/loadMore.d.ts +108 -0
- package/uview-ultra/types/comps/loadingIcon.d.ts +68 -0
- package/uview-ultra/types/comps/loadingPage.d.ts +58 -0
- package/uview-ultra/types/comps/modal.d.ts +115 -0
- package/uview-ultra/types/comps/navbar.d.ts +113 -0
- package/uview-ultra/types/comps/navbarMini.d.ts +78 -0
- package/uview-ultra/types/comps/noNetwork.d.ts +40 -0
- package/uview-ultra/types/comps/noticeBar.d.ts +85 -0
- package/uview-ultra/types/comps/notify.d.ts +73 -0
- package/uview-ultra/types/comps/numberBox.d.ts +155 -0
- package/uview-ultra/types/comps/overlay.d.ts +46 -0
- package/uview-ultra/types/comps/parse.d.ts +101 -0
- package/uview-ultra/types/comps/picker.d.ts +115 -0
- package/uview-ultra/types/comps/popup.d.ts +103 -0
- package/uview-ultra/types/comps/radio.d.ts +77 -0
- package/uview-ultra/types/comps/radioGroup.d.ts +97 -0
- package/uview-ultra/types/comps/rate.d.ts +85 -0
- package/uview-ultra/types/comps/readMore.d.ts +80 -0
- package/uview-ultra/types/comps/row.d.ts +34 -0
- package/uview-ultra/types/comps/safeBottom.d.ts +16 -0
- package/uview-ultra/types/comps/scrollList.d.ts +51 -0
- package/uview-ultra/types/comps/search.d.ts +167 -0
- package/uview-ultra/types/comps/skeleton.d.ts +70 -0
- package/uview-ultra/types/comps/slider.d.ts +79 -0
- package/uview-ultra/types/comps/statusBar.d.ts +22 -0
- package/uview-ultra/types/comps/steps.d.ts +48 -0
- package/uview-ultra/types/comps/stepsItem.d.ts +41 -0
- package/uview-ultra/types/comps/sticky.d.ts +48 -0
- package/uview-ultra/types/comps/subsection.d.ts +64 -0
- package/uview-ultra/types/comps/swipeAction.d.ts +24 -0
- package/uview-ultra/types/comps/swipeActionItem.d.ts +58 -0
- package/uview-ultra/types/comps/swiper.d.ts +142 -0
- package/uview-ultra/types/comps/swiperIndicator.d.ts +37 -0
- package/uview-ultra/types/comps/switch.d.ts +73 -0
- package/uview-ultra/types/comps/tabbar.d.ts +54 -0
- package/uview-ultra/types/comps/tabbarItem.d.ts +52 -0
- package/uview-ultra/types/comps/tabs.d.ts +85 -0
- package/uview-ultra/types/comps/tag.d.ts +93 -0
- package/uview-ultra/types/comps/text.d.ts +110 -0
- package/uview-ultra/types/comps/textarea.d.ts +158 -0
- package/uview-ultra/types/comps/toast.d.ts +59 -0
- package/uview-ultra/types/comps/tooltip.d.ts +71 -0
- package/uview-ultra/types/comps/transition.d.ts +61 -0
- package/uview-ultra/types/comps/upload.d.ts +163 -0
- package/uview-ultra/types/comps.d.ts +101 -0
- package/uview-ultra/types/index.d.ts +172 -0
- package/uview-ultra/types/index.uts +7 -0
- package/uview-ultra/types/package.json +26 -0
|
@@ -0,0 +1,1103 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { DayutsConfig, type DayutsLocale, DayutsUnit, DayutsObject } from '../utssdk/interface'
|
|
3
|
+
import { REGEX_FORMAT, REGEX_PARSE, INVALID_DATE_STRING, M, Y, W, D, DATE, H, MIN, S, MS, Q, MILLISECONDS_A_MINUTE, MILLISECONDS_A_HOUR, MILLISECONDS_A_SECOND, MILLISECONDS_A_WEEK, MILLISECONDS_A_DAY, FORMAT_DEFAULT } from './constant'
|
|
4
|
+
import { isNumber, prettyUnit, padStart, padZoneStr, monthDiff, absFloor } from './utils'
|
|
5
|
+
import { dayutsIntl, localeState } from './use'
|
|
6
|
+
|
|
7
|
+
type Threshold = {
|
|
8
|
+
l : string;
|
|
9
|
+
r ?: number;
|
|
10
|
+
d ?: DayutsUnit;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function parseLocale(preset : string | null) : string | null;
|
|
14
|
+
function parseLocale(preset : DayutsLocale | null) : string | null;
|
|
15
|
+
function parseLocale(preset : string, object : DayutsLocale | null, isLocal : boolean) : string | null;
|
|
16
|
+
function parseLocale(preset : DayutsLocale, object : DayutsLocale, isLocal : boolean) : string | null;
|
|
17
|
+
function parseLocale(preset : any | null, object : DayutsLocale | null = null, isLocal : boolean = false) : string | null {
|
|
18
|
+
let l : string | null = null
|
|
19
|
+
if (preset == null) return dayutsIntl.locale
|
|
20
|
+
if (typeof preset == 'string') {
|
|
21
|
+
const presetLower = (preset as string).toLowerCase()
|
|
22
|
+
if (dayutsIntl.has(presetLower)) {
|
|
23
|
+
l = presetLower
|
|
24
|
+
}
|
|
25
|
+
if (object != null) {
|
|
26
|
+
dayutsIntl.set(presetLower, object)
|
|
27
|
+
l = presetLower
|
|
28
|
+
}
|
|
29
|
+
const presetSplit = preset.split('-')
|
|
30
|
+
if (l == null && presetSplit.length > 1) {
|
|
31
|
+
return parseLocale(presetSplit[0])
|
|
32
|
+
}
|
|
33
|
+
} else if (preset instanceof DayutsLocale) {
|
|
34
|
+
// const { name } = preset as DayutsLocale
|
|
35
|
+
dayutsIntl.set(preset.name, preset)
|
|
36
|
+
l = preset.name
|
|
37
|
+
}
|
|
38
|
+
if (!isLocal && l != null) {
|
|
39
|
+
// L = l
|
|
40
|
+
dayutsIntl.locale = l
|
|
41
|
+
}
|
|
42
|
+
// return l ?? L //(!isLocal && L != null)
|
|
43
|
+
return l ?? dayutsIntl.locale //(!isLocal && L != null)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function tryParseNumberAtIndex(digits : (any|null)[], index : number) : number | null {
|
|
47
|
+
// 检查索引是否在数组范围内
|
|
48
|
+
if (index >= 0 && index < digits.length) {
|
|
49
|
+
if(digits[index] == null) return null
|
|
50
|
+
// 尝试解析索引位置的字符串为数字
|
|
51
|
+
const parsedNumber = isNumber(digits[index]) ? digits[index] as number : parseInt(`${digits[index]}`, 10);
|
|
52
|
+
|
|
53
|
+
// 检查解析结果是否为有效数字
|
|
54
|
+
if (!isNaN(parsedNumber)) {
|
|
55
|
+
return parsedNumber;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return null
|
|
59
|
+
}
|
|
60
|
+
// function createDateFromArray(d: number[]):Date
|
|
61
|
+
// function createDateFromArray(d: string[]):Date
|
|
62
|
+
function createDateFromArray(d : (any|null)[], offset : number = 0) : Date {
|
|
63
|
+
const year = tryParseNumberAtIndex(d, 1 - offset) ?? new Date().getFullYear()
|
|
64
|
+
const month = (tryParseNumberAtIndex(d, 2 - offset) ?? 1) - 1
|
|
65
|
+
const day = tryParseNumberAtIndex(d, 3 - offset) ?? 1
|
|
66
|
+
const hour = tryParseNumberAtIndex(d, 4 - offset) ?? 0
|
|
67
|
+
const minute = tryParseNumberAtIndex(d, 5 - offset) ?? 0
|
|
68
|
+
const second = tryParseNumberAtIndex(d, 6 - offset) ?? 0
|
|
69
|
+
const millisecond = (tryParseNumberAtIndex(d, 7 - offset) ?? 0).toString().substring(0, 3) //d.length > 7 ? parseInt((d[7] ?? '0').substring(0, 3)) : 0
|
|
70
|
+
|
|
71
|
+
return new Date(
|
|
72
|
+
year,
|
|
73
|
+
month,
|
|
74
|
+
day,
|
|
75
|
+
hour,
|
|
76
|
+
minute,
|
|
77
|
+
second,
|
|
78
|
+
parseInt(millisecond))
|
|
79
|
+
}
|
|
80
|
+
function parseDate(cfg : DayutsConfig) : Date|null {
|
|
81
|
+
const { date } = cfg
|
|
82
|
+
if (date == null) return new Date()
|
|
83
|
+
if (date instanceof Date) return date as Date
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
if (typeof date == 'string' && /^\d+$/.test(date as string)) {
|
|
87
|
+
return new Date(parseInt(`${date}`.padEnd(13, '0')))
|
|
88
|
+
}
|
|
89
|
+
if (typeof date == 'string' && !/Z$/i.test(date as string)) {
|
|
90
|
+
const d = date.match(REGEX_PARSE)
|
|
91
|
+
// #ifndef APP-ANDROID || APP-IOS
|
|
92
|
+
const isNull = d == null
|
|
93
|
+
// #endif
|
|
94
|
+
// #ifdef APP-ANDROID || APP-IOS
|
|
95
|
+
const isNull = d == null|| Array.isArray(d) && d.length == 0
|
|
96
|
+
// #endif
|
|
97
|
+
if (!isNull) {
|
|
98
|
+
return createDateFromArray(d as (any|null)[])
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (typeof date == 'string') return new Date(date as string)
|
|
102
|
+
if (Array.isArray(date)) {
|
|
103
|
+
return createDateFromArray(date as (any|null)[], 1)
|
|
104
|
+
}
|
|
105
|
+
if (isNumber(date)) return new Date(date as number)
|
|
106
|
+
return null//new Date()
|
|
107
|
+
} catch(err) {
|
|
108
|
+
return null//new Date()
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function wrapper(date : any, instance : Dayuts) : Dayuts {
|
|
113
|
+
return dayuts(date, instance.$L)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export class Dayuts {
|
|
117
|
+
$L : string
|
|
118
|
+
private valid: boolean = true;
|
|
119
|
+
private $d : Date = new Date()
|
|
120
|
+
private $y : number = 0
|
|
121
|
+
private $M : number = 0
|
|
122
|
+
private $D : number = 0
|
|
123
|
+
private $W : number = 0
|
|
124
|
+
private $H : number = 0
|
|
125
|
+
private $m : number = 0
|
|
126
|
+
private $s : number = 0
|
|
127
|
+
private $ms : number = 0
|
|
128
|
+
private $u : boolean = false
|
|
129
|
+
constructor(cfg : DayutsConfig) {
|
|
130
|
+
this.$L = parseLocale(cfg.locale) ?? dayutsIntl.locale //'en'
|
|
131
|
+
this.parse(cfg)
|
|
132
|
+
}
|
|
133
|
+
parse(cfg : DayutsConfig) {
|
|
134
|
+
const _d = parseDate(cfg)
|
|
135
|
+
if(_d != null) {
|
|
136
|
+
this.$d = parseDate(cfg)!
|
|
137
|
+
this.init()
|
|
138
|
+
} else {
|
|
139
|
+
this.valid = false
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
init() {
|
|
143
|
+
const { $d } = this
|
|
144
|
+
this.$y = $d.getFullYear()
|
|
145
|
+
this.$M = $d.getMonth()
|
|
146
|
+
this.$D = $d.getDate()
|
|
147
|
+
this.$W = $d.getDay()
|
|
148
|
+
this.$H = $d.getHours()
|
|
149
|
+
this.$m = $d.getMinutes()
|
|
150
|
+
this.$s = $d.getSeconds()
|
|
151
|
+
this.$ms = $d.getMilliseconds()
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* 检查日期对象是否有效。
|
|
155
|
+
*
|
|
156
|
+
* @returns {boolean} 如果日期对象有效,则返回true;否则返回false。
|
|
157
|
+
*/
|
|
158
|
+
isValid() : boolean {
|
|
159
|
+
return this.valid
|
|
160
|
+
// return !(this.$d.toString() == INVALID_DATE_STRING)
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* 检查当前日期是否与给定的日期在指定的时间单位内相同。
|
|
164
|
+
*
|
|
165
|
+
* @param {string|number|Date} input - 要比较的日期。
|
|
166
|
+
* @param {string} units - 时间单位,例如'year'、'month'、'day'等。
|
|
167
|
+
* @returns {boolean} 如果当前日期与给定的日期在指定的时间单位内相同,则返回true;否则返回false。
|
|
168
|
+
*/
|
|
169
|
+
isSame(input : string) : boolean
|
|
170
|
+
isSame(input : number) : boolean
|
|
171
|
+
isSame(input : Date) : boolean
|
|
172
|
+
isSame(input : Dayuts) : boolean
|
|
173
|
+
isSame(input : UTSJSONObject) : boolean
|
|
174
|
+
|
|
175
|
+
isSame(input : string, units : DayutsUnit) : boolean
|
|
176
|
+
isSame(input : number, units : DayutsUnit) : boolean
|
|
177
|
+
isSame(input : Date, units : DayutsUnit) : boolean
|
|
178
|
+
isSame(input : Dayuts, units : DayutsUnit) : boolean
|
|
179
|
+
isSame(input : UTSJSONObject, units : DayutsUnit) : boolean
|
|
180
|
+
isSame(input : any, units : DayutsUnit = 'millisecond') : boolean {
|
|
181
|
+
const other = input instanceof Dayuts ? input : dayuts(input)
|
|
182
|
+
const date1 = this.startOf(units).valueOf()
|
|
183
|
+
const date2 = other.valueOf()
|
|
184
|
+
const date3 = this.endOf(units).valueOf()
|
|
185
|
+
return date1 <= date2 && date2 <= date3
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 检查给定的日期或时间是否在当前 dayuts 对象的指定时间单位之后。
|
|
189
|
+
*
|
|
190
|
+
* @param {string | number | Date | Dayuts} input - 要与当前 dayuts 对象进行比较的日期或时间。
|
|
191
|
+
* @param {string} units - 要比较的时间单位(如 "year"、"month"、"day" 等)。
|
|
192
|
+
* @returns {boolean} 如果给定的日期或时间在当前 dayuts 对象的指定时间单位之后,则返回 `true`,否则返回 `false`。
|
|
193
|
+
*/
|
|
194
|
+
isAfter(input : string) : boolean
|
|
195
|
+
isAfter(input : number) : boolean
|
|
196
|
+
isAfter(input : Date) : boolean
|
|
197
|
+
isAfter(input : Dayuts) : boolean
|
|
198
|
+
isAfter(input : UTSJSONObject) : boolean
|
|
199
|
+
|
|
200
|
+
isAfter(input : string, units : DayutsUnit) : boolean
|
|
201
|
+
isAfter(input : number, units : DayutsUnit) : boolean
|
|
202
|
+
isAfter(input : Date, units : DayutsUnit) : boolean
|
|
203
|
+
isAfter(input : Dayuts, units : DayutsUnit) : boolean
|
|
204
|
+
isAfter(input : UTSJSONObject, units : DayutsUnit) : boolean
|
|
205
|
+
isAfter(input : any, units : DayutsUnit = 'millisecond') : boolean {
|
|
206
|
+
const other = input instanceof Dayuts ? input : dayuts(input)
|
|
207
|
+
const date1 = other.valueOf()
|
|
208
|
+
const date2 = this.startOf(units).valueOf()
|
|
209
|
+
return date1 < date2;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* 检查给定的日期或时间是否在当前 dayuts 对象的指定时间单位之前。
|
|
213
|
+
*
|
|
214
|
+
* @param {string | number | Date | Dayuts} input - 要与当前 dayuts 对象进行比较的日期或时间。
|
|
215
|
+
* @param {string} units - 要比较的时间单位(如 "year"、"month"、"day" 等)。
|
|
216
|
+
* @returns {boolean} 如果给定的日期或时间在当前 dayuts 对象的指定时间单位之前,则返回 `true`,否则返回 `false`。
|
|
217
|
+
*/
|
|
218
|
+
isBefore(input : string) : boolean
|
|
219
|
+
isBefore(input : number) : boolean
|
|
220
|
+
isBefore(input : Date) : boolean
|
|
221
|
+
isBefore(input : Dayuts) : boolean
|
|
222
|
+
isBefore(input : UTSJSONObject) : boolean
|
|
223
|
+
|
|
224
|
+
isBefore(input : string, units : DayutsUnit) : boolean
|
|
225
|
+
isBefore(input : number, units : DayutsUnit) : boolean
|
|
226
|
+
isBefore(input : Date, units : DayutsUnit) : boolean
|
|
227
|
+
isBefore(input : Dayuts, units : DayutsUnit) : boolean
|
|
228
|
+
isBefore(input : UTSJSONObject, units : DayutsUnit) : boolean
|
|
229
|
+
isBefore(input : any, units : DayutsUnit = 'millisecond') : boolean {
|
|
230
|
+
const other = input instanceof Dayuts ? input : dayuts(input);
|
|
231
|
+
const date1 = other.valueOf()
|
|
232
|
+
const date2 = this.endOf(units).valueOf()
|
|
233
|
+
return date2 < date1;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* 判断当前Dayuts对象是否与给定的输入在同一时间或之前,根据指定的时间单位
|
|
237
|
+
* @param {(string | number | Date | Dayuts | UTSJSONObject)} input - 输入的时间
|
|
238
|
+
* @param {DayutsUnit} units - 指定的时间单位
|
|
239
|
+
* @returns {boolean} - 如果当前Dayuts对象与给定的输入在同一时间或之前,则返回true,否则返回false
|
|
240
|
+
*/
|
|
241
|
+
isSameOrBefore(input : string) : boolean
|
|
242
|
+
isSameOrBefore(input : number) : boolean
|
|
243
|
+
isSameOrBefore(input : Date) : boolean
|
|
244
|
+
isSameOrBefore(input : Dayuts) : boolean
|
|
245
|
+
isSameOrBefore(input : UTSJSONObject) : boolean
|
|
246
|
+
|
|
247
|
+
isSameOrBefore(input : string, units : DayutsUnit) : boolean
|
|
248
|
+
isSameOrBefore(input : number, units : DayutsUnit) : boolean
|
|
249
|
+
isSameOrBefore(input : Date, units : DayutsUnit) : boolean
|
|
250
|
+
isSameOrBefore(input : Dayuts, units : DayutsUnit) : boolean
|
|
251
|
+
isSameOrBefore(input : UTSJSONObject, units : DayutsUnit) : boolean
|
|
252
|
+
isSameOrBefore(input : any, units : DayutsUnit = 'millisecond') : boolean {
|
|
253
|
+
return this.isSame(input, units) || this.isBefore(input, units)
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* 判断当前Dayuts对象是否与给定的输入在同一时间或之后,根据指定的时间单位
|
|
257
|
+
* @param {(string | number | Date | Dayuts | UTSJSONObject)} input - 输入的时间
|
|
258
|
+
* @param {DayutsUnit} units - 指定的时间单位
|
|
259
|
+
* @returns {boolean} - 如果当前Dayuts对象与给定的输入在同一时间或之后,则返回true,否则返回false
|
|
260
|
+
*/
|
|
261
|
+
isSameOrAfter(input : string) : boolean
|
|
262
|
+
isSameOrAfter(input : number) : boolean
|
|
263
|
+
isSameOrAfter(input : Date) : boolean
|
|
264
|
+
isSameOrAfter(input : Dayuts) : boolean
|
|
265
|
+
isSameOrAfter(input : UTSJSONObject) : boolean
|
|
266
|
+
|
|
267
|
+
isSameOrAfter(input : string, units : DayutsUnit) : boolean
|
|
268
|
+
isSameOrAfter(input : number, units : DayutsUnit) : boolean
|
|
269
|
+
isSameOrAfter(input : Date, units : DayutsUnit) : boolean
|
|
270
|
+
isSameOrAfter(input : Dayuts, units : DayutsUnit) : boolean
|
|
271
|
+
isSameOrAfter(input : UTSJSONObject, units : DayutsUnit) : boolean
|
|
272
|
+
isSameOrAfter(input : any, units : DayutsUnit = 'millisecond') : boolean {
|
|
273
|
+
return this.isSame(input, units) || this.isAfter(input, units)
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* 判断当前Dayuts对象是否在给定的两个时间之间
|
|
277
|
+
* @param {any} input - 第一个时间输入
|
|
278
|
+
* @param {any} input2 - 第二个时间输入
|
|
279
|
+
* @param {DayutsUnit} units - 指定的时间单位
|
|
280
|
+
* @param {string} interval - 区间符号,表示区间的开闭性,默认为'()',表示开区间
|
|
281
|
+
* @returns {boolean} - 如果当前Dayuts对象在给定的两个时间之间,则返回true,否则返回false
|
|
282
|
+
*/
|
|
283
|
+
isBetween(input : any, input2 : any, units : DayutsUnit = 'millisecond', interval : string = '()') : boolean {
|
|
284
|
+
const dA = dayuts(input)
|
|
285
|
+
const dB = dayuts(input2)
|
|
286
|
+
const dAi = interval.startsWith('(')
|
|
287
|
+
const dBi = interval.endsWith(')')
|
|
288
|
+
|
|
289
|
+
return ((dAi ? this.isAfter(dA, units) : !this.isBefore(dA, units)) &&
|
|
290
|
+
(dBi ? this.isBefore(dB, units) : !this.isAfter(dB, units)))
|
|
291
|
+
|| ((dAi ? this.isBefore(dA, units) : !this.isAfter(dA, units)) &&
|
|
292
|
+
(dBi ? this.isAfter(dB, units) : !this.isBefore(dB, units)))
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* 判断当前Dayuts对象所在的年份是否为闰年
|
|
296
|
+
* @returns {boolean} - 如果当前Dayuts对象所在的年份是闰年,则返回true,否则返回false
|
|
297
|
+
*/
|
|
298
|
+
isLeapYear():boolean{
|
|
299
|
+
return ((this.$y % 4 == 0) && (this.$y % 100 != 0)) || (this.$y % 400 == 0)
|
|
300
|
+
}
|
|
301
|
+
isToday():boolean{
|
|
302
|
+
const comparisonTemplate = 'YYYY-MM-DD'
|
|
303
|
+
const now = dayuts()
|
|
304
|
+
|
|
305
|
+
return this.format(comparisonTemplate) == now.format(comparisonTemplate)
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* 获取当前 `dayuts` 对象的 Unix 时间戳(以秒为单位)。
|
|
309
|
+
*
|
|
310
|
+
* @returns {number} 返回当前 `dayuts` 对象的 Unix 时间戳(以秒为单位)。
|
|
311
|
+
*/
|
|
312
|
+
unix() : number {
|
|
313
|
+
return Math.floor(this.valueOf() / 1000);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* 将当前日期设置为指定时间单位的开始或结束。
|
|
317
|
+
*
|
|
318
|
+
* @param {string} units - 时间单位,例如'year'、'month'、'day'等。
|
|
319
|
+
* @param {boolean} startOf - 如果为true,则设置为开始;如果为false,则设置为结束。
|
|
320
|
+
* @returns {Dayuts} 返回一个新的Dayuts对象,表示调整后的日期。
|
|
321
|
+
*/
|
|
322
|
+
startOf(units : DayutsUnit, startOf : boolean = true) : Dayuts {
|
|
323
|
+
const isStartOf = startOf;
|
|
324
|
+
const unit = prettyUnit(units)
|
|
325
|
+
// instanceFactory 函数用于创建一个新的 Dayuts 对象,表示给定日期的开始或结束。
|
|
326
|
+
// 参数 d 和 m 分别表示日期和月份。
|
|
327
|
+
const instanceFactory = (d : number, m : number) : Dayuts => {
|
|
328
|
+
const ins = dayuts(new Date(this.$y, m, d))
|
|
329
|
+
return isStartOf ? ins : ins.endOf(D)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// instanceFactorySet 函数用于创建一个新的 Dayuts 对象,表示调整后的时间。
|
|
333
|
+
// 参数 method 表示要调用的 Date 对象的方法(如 'setHours'),slice 表示要调整的时间部分的索引。
|
|
334
|
+
const instanceFactorySet = (method : string, slice : number) : Dayuts => {
|
|
335
|
+
// 定义表示开始和结束时间的参数数组。
|
|
336
|
+
const argumentStart = [0, 0, 0, 0]
|
|
337
|
+
const argumentEnd = [23, 59, 59, 999]
|
|
338
|
+
// 根据 isStartOf 的值,选择开始或结束时间的参数数组,并调用 Date 对象的方法。
|
|
339
|
+
const args = (isStartOf ? argumentStart : argumentEnd).slice(slice)
|
|
340
|
+
const date = this.toDate()
|
|
341
|
+
if (method == 'setHours') {
|
|
342
|
+
date.setHours(args[0]);
|
|
343
|
+
date.setMinutes(args[1])
|
|
344
|
+
date.setSeconds(args[2])
|
|
345
|
+
date.setMilliseconds(args[3])
|
|
346
|
+
} else if (method == 'setMinutes') {
|
|
347
|
+
date.setMinutes(args[0]);
|
|
348
|
+
date.setSeconds(args[1])
|
|
349
|
+
date.setMilliseconds(args[2])
|
|
350
|
+
} else if (method == 'setSeconds') {
|
|
351
|
+
date.setSeconds(args[0])
|
|
352
|
+
date.setMilliseconds(args[1])
|
|
353
|
+
} else if (method == 'setMilliseconds') {
|
|
354
|
+
date.setMilliseconds(args[0])
|
|
355
|
+
}
|
|
356
|
+
return dayuts(date)
|
|
357
|
+
}
|
|
358
|
+
const { $W, $M, $D } = this
|
|
359
|
+
const utcPad = `set${this.$u ? 'UTC' : ''}`
|
|
360
|
+
if (unit == Y) {
|
|
361
|
+
return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11);
|
|
362
|
+
} else if (unit == M) {
|
|
363
|
+
return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1);
|
|
364
|
+
} else if (unit == W) {
|
|
365
|
+
const weekStart = this.$locale().weekStart ?? 0;
|
|
366
|
+
const gap = ($W < weekStart ? $W + 7 : $W) - weekStart;
|
|
367
|
+
return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M);
|
|
368
|
+
} else if (unit == D || unit == DATE) {
|
|
369
|
+
return instanceFactorySet(`${utcPad}Hours`, 0);
|
|
370
|
+
} else if (unit == H) {
|
|
371
|
+
return instanceFactorySet(`${utcPad}Minutes`, 1);
|
|
372
|
+
} else if (unit == MIN) {
|
|
373
|
+
return instanceFactorySet(`${utcPad}Seconds`, 2);
|
|
374
|
+
} else if (unit == S) {
|
|
375
|
+
return instanceFactorySet(`${utcPad}Milliseconds`, 3);
|
|
376
|
+
} else {
|
|
377
|
+
return this.clone();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* 将当前日期设置为指定时间单位的结束。
|
|
382
|
+
*
|
|
383
|
+
* @param {string} arg - 时间单位,例如'year'、'month'、'day'等。
|
|
384
|
+
* @returns {Dayuts} 返回一个新的Dayuts对象,表示调整后的日期。
|
|
385
|
+
*/
|
|
386
|
+
endOf(units : DayutsUnit) : Dayuts {
|
|
387
|
+
return this.startOf(units, false)
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* 设置指定的时间单位的值。
|
|
391
|
+
*
|
|
392
|
+
* @param {string} units - 要设置的时间单位(如 "year"、"month"、"day" 等)。
|
|
393
|
+
* @param {number} int - 要设置的值。
|
|
394
|
+
* @returns {Dayuts} 返回当前对象。
|
|
395
|
+
*/
|
|
396
|
+
private $set(units : DayutsUnit, int : number) : Dayuts { // private set
|
|
397
|
+
const unit = prettyUnit(units)
|
|
398
|
+
// const utcPad = `set${this.$u ? 'UTC' : ''}`
|
|
399
|
+
const arg = unit == D ? this.$D + (int - this.$W) : int
|
|
400
|
+
const setDateUnit = (date : Dayuts, unit : DayutsUnit, arg : number) => {
|
|
401
|
+
if (unit == D || unit == DATE) {
|
|
402
|
+
date.$d.setDate(arg);
|
|
403
|
+
} else if (unit == M) {
|
|
404
|
+
date.$d.setMonth(arg);
|
|
405
|
+
} else if (unit == Y) {
|
|
406
|
+
date.$d.setFullYear(arg);
|
|
407
|
+
} else if (unit == H) {
|
|
408
|
+
date.$d.setHours(arg);
|
|
409
|
+
} else if (unit == MIN) {
|
|
410
|
+
date.$d.setMinutes(arg);
|
|
411
|
+
} else if (unit == S) {
|
|
412
|
+
date.$d.setSeconds(arg);
|
|
413
|
+
} else if (unit == MS) {
|
|
414
|
+
date.$d.setMilliseconds(arg);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (unit == M || unit == Y) {
|
|
418
|
+
// clone is for badMutable plugin
|
|
419
|
+
const date = this.clone().set(DATE, 1)
|
|
420
|
+
// date.$d[name](arg)
|
|
421
|
+
setDateUnit(date, unit, arg)
|
|
422
|
+
date.init()
|
|
423
|
+
this.$d = date.set(DATE, Math.min(this.$D, date.daysInMonth())).$d
|
|
424
|
+
} else {
|
|
425
|
+
setDateUnit(this, unit, arg)
|
|
426
|
+
// this.$d[name](arg)
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
this.init()
|
|
430
|
+
return this
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* 创建一个当前对象的副本,并设置指定的时间单位的值。
|
|
434
|
+
*
|
|
435
|
+
* @param {string} string - 要设置的时间单位(如 "year"、"month"、"day" 等)。
|
|
436
|
+
* @param {number} int - 要设置的值。
|
|
437
|
+
* @returns {Dayuts} 返回一个新的 `dayuts` 对象,其值为当前对象的副本,并设置了指定的时间单位的值。
|
|
438
|
+
*/
|
|
439
|
+
set(string : DayutsUnit, int : number) : Dayuts {
|
|
440
|
+
return this.clone().$set(string, int);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* 获取当前 `dayuts` 对象的指定时间单位的值。
|
|
444
|
+
*
|
|
445
|
+
* @param {string} units - 要获取的时间单位(如 "year"、"month"、"day" 等)。
|
|
446
|
+
* @returns {number} 返回当前 `dayuts` 对象的指定时间单位的值。
|
|
447
|
+
*/
|
|
448
|
+
get(units : DayutsUnit) : number {
|
|
449
|
+
const unit = prettyUnit(units)
|
|
450
|
+
if (unit == D) {
|
|
451
|
+
return this.day()
|
|
452
|
+
} else if (unit == DATE) {
|
|
453
|
+
return this.date()
|
|
454
|
+
} else if (unit == M) {
|
|
455
|
+
return this.month()
|
|
456
|
+
} else if (unit == Y) {
|
|
457
|
+
return this.year()
|
|
458
|
+
} else if (unit == H) {
|
|
459
|
+
return this.hour()
|
|
460
|
+
} else if (unit == MIN) {
|
|
461
|
+
return this.minute()
|
|
462
|
+
} else if (unit == S) {
|
|
463
|
+
return this.second()
|
|
464
|
+
} else if (unit == MS) {
|
|
465
|
+
return this.millisecond()
|
|
466
|
+
}
|
|
467
|
+
return 0
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* 获取或设置年份。
|
|
471
|
+
* @param {number | null} [input] - 要设置的年份。
|
|
472
|
+
* @returns {number | Dayuts} 年份或 Dayuts 实例。
|
|
473
|
+
*/
|
|
474
|
+
year() : number
|
|
475
|
+
year(input : number) : Dayuts
|
|
476
|
+
year(input : number | null = null) : any {
|
|
477
|
+
if (input == null) return this.$y
|
|
478
|
+
return this.set(Y, input)
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* 获取或设置月份。
|
|
482
|
+
* @param {number | null} [input] - 要设置的月份(0-11)。
|
|
483
|
+
* @returns {number | Dayuts} 月份或 Dayuts 实例。
|
|
484
|
+
*/
|
|
485
|
+
month() : number
|
|
486
|
+
month(input : number) : Dayuts
|
|
487
|
+
month(input : number | null = null) : any {
|
|
488
|
+
if (input == null) return this.$M
|
|
489
|
+
return this.set(M, input)
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* 获取或设置星期几。
|
|
493
|
+
* @param {number | null} [input] - 要设置的星期几(0-6)。
|
|
494
|
+
* @returns {number | Dayuts} 星期几或 Dayuts 实例。
|
|
495
|
+
*/
|
|
496
|
+
day() : number
|
|
497
|
+
day(input : number) : Dayuts
|
|
498
|
+
day(input : number | null = null) : any {
|
|
499
|
+
if (input == null) return this.$W
|
|
500
|
+
return this.set(D, input)
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* 获取或设置月份中的某一天。
|
|
504
|
+
* @param {number | null} [input] - 要设置的月份中的某一天(1-31)。
|
|
505
|
+
* @returns {number | Dayuts} 月份中的某一天或 Dayuts 实例。
|
|
506
|
+
*/
|
|
507
|
+
date() : number
|
|
508
|
+
date(input : number) : Dayuts
|
|
509
|
+
date(input : number | null = null) : any {
|
|
510
|
+
if (input == null) return this.$D
|
|
511
|
+
return this.set(DATE, input)
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* 获取或设置小时。
|
|
515
|
+
* @param {number | null} [input] - 要设置的小时(0-23)。
|
|
516
|
+
* @returns {number | Dayuts} 小时或 Dayuts 实例。
|
|
517
|
+
*/
|
|
518
|
+
hour() : number
|
|
519
|
+
hour(input : number) : Dayuts
|
|
520
|
+
hour(input : number | null = null) : any {
|
|
521
|
+
if (input == null) return this.$H
|
|
522
|
+
return this.set(H, input)
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* 获取或设置分钟。
|
|
526
|
+
* @param {number | null} [input] - 要设置的分钟(0-59)。
|
|
527
|
+
* @returns {number | Dayuts} 分钟或 Dayuts 实例。
|
|
528
|
+
*/
|
|
529
|
+
minute() : number
|
|
530
|
+
minute(input : number) : Dayuts
|
|
531
|
+
minute(input : number | null = null) : any {
|
|
532
|
+
if (input == null) return this.$m
|
|
533
|
+
return this.set(MIN, input)
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* 获取或设置秒。
|
|
537
|
+
* @param {number | null} [input] - 要设置的秒(0-59)。
|
|
538
|
+
* @returns {number | Dayuts} 秒或 Dayuts 实例。
|
|
539
|
+
*/
|
|
540
|
+
second() : number
|
|
541
|
+
second(input : number) : Dayuts
|
|
542
|
+
second(input : number | null = null) : any {
|
|
543
|
+
if (input == null) return this.$s
|
|
544
|
+
return this.set(S, input)
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* 获取或设置毫秒。
|
|
548
|
+
* @param {number | null} [input] - 要设置的毫秒(0-999)。
|
|
549
|
+
* @returns {number | Dayuts} 毫秒或 Dayuts 实例。
|
|
550
|
+
*/
|
|
551
|
+
millisecond() : number
|
|
552
|
+
millisecond(input : number) : Dayuts
|
|
553
|
+
millisecond(input : number | null = null) : any {
|
|
554
|
+
if (input == null) return this.$ms
|
|
555
|
+
return this.set(MS, input)
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* 在当前 Dayuts 实例上添加指定的时间长度。
|
|
560
|
+
* @param {number} number - 要添加的时间长度。
|
|
561
|
+
* @param {string} units - 要添加的时间单位(例如,“years”,“months”,“days”等)。
|
|
562
|
+
* @returns {Dayuts} 更新的 Dayuts 实例。
|
|
563
|
+
*/
|
|
564
|
+
add(number : number, units : DayutsUnit) : Dayuts {
|
|
565
|
+
const unit = prettyUnit(units)
|
|
566
|
+
// 创建一个新的 Dayuts 实例,并根据给定的 n 值设置日期。
|
|
567
|
+
// n 值乘以 number 参数,然后加到当前日期上,以设置新的日期。
|
|
568
|
+
const instanceFactorySet = (n : number) : Dayuts => {
|
|
569
|
+
// 创建一个新的 Dayuts 实例,它是当前实例的副本
|
|
570
|
+
const d = dayuts(this)
|
|
571
|
+
// 设置新的日期并返回更新后的 Dayuts 实例
|
|
572
|
+
return d.date(d.date() + Math.round(n * number)) //Utils.w(d.date(d.date() + Math.round(n * number)), this)
|
|
573
|
+
}
|
|
574
|
+
if (unit == M) {
|
|
575
|
+
return this.set(M, this.$M + number)
|
|
576
|
+
}
|
|
577
|
+
if (unit == Y) {
|
|
578
|
+
return this.set(Y, this.$y + number)
|
|
579
|
+
}
|
|
580
|
+
if (unit == D) {
|
|
581
|
+
return instanceFactorySet(1)
|
|
582
|
+
}
|
|
583
|
+
if (unit == W) {
|
|
584
|
+
return instanceFactorySet(7)
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
const steps = new Map<string, number>([
|
|
588
|
+
[MIN, MILLISECONDS_A_MINUTE],
|
|
589
|
+
[H, MILLISECONDS_A_HOUR],
|
|
590
|
+
[S, MILLISECONDS_A_SECOND],
|
|
591
|
+
])
|
|
592
|
+
const step = steps.get(unit) ?? 1;
|
|
593
|
+
const nextTimeStamp = this.$d.getTime() + (number * step)
|
|
594
|
+
return wrapper(nextTimeStamp, this)
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* 从当前 Dayuts 实例中减去指定的时间。
|
|
598
|
+
* @param {number} number - 要减去的时间。
|
|
599
|
+
* @param {string} units - 要减去的时间单位(例如,“years”,“months”,“days”等)。
|
|
600
|
+
* @returns {Dayuts} 更新的 Dayuts 实例。
|
|
601
|
+
*/
|
|
602
|
+
subtract(number : number, units : DayutsUnit) : Dayuts {
|
|
603
|
+
// 通过将 number 乘以 -1,然后调用 add 方法来实现减法操作
|
|
604
|
+
return this.add(number * -1, units);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* 日期格式化
|
|
608
|
+
* @param {string} formatStr - 格式化字符串,包含各种格式化占位符(例如,“YYYY-MM-DD”,“HH:mm:ss”等)。
|
|
609
|
+
* @returns {string} 格式化后的日期字符串。
|
|
610
|
+
*/
|
|
611
|
+
format(formatStr : string | null = null) : string {
|
|
612
|
+
const locale = this.$locale();
|
|
613
|
+
if (!this.isValid()) return INVALID_DATE_STRING // locale.invalidDate || INVALID_DATE_STRING;
|
|
614
|
+
|
|
615
|
+
const str = formatStr ?? FORMAT_DEFAULT;
|
|
616
|
+
// @ts-ignore
|
|
617
|
+
const zoneStr = padZoneStr(this);
|
|
618
|
+
const { $H, $m, $M } = this;
|
|
619
|
+
const { weekdays, months, meridiem } = locale;
|
|
620
|
+
/**
|
|
621
|
+
* 从给定的数组中获取缩写或完整的字符串。
|
|
622
|
+
* @param {Array} arr - 包含缩写字符串的数组。
|
|
623
|
+
* @param {number} index - 数组中要获取的元素的索引。
|
|
624
|
+
* @param {Array} full - 包含完整字符串的数组。
|
|
625
|
+
* @param {number} length - 要返回的字符串的长度。
|
|
626
|
+
* @returns {string} 缩写或完整的字符串。
|
|
627
|
+
*/
|
|
628
|
+
function getShort(arr : string[] | null, index : number, full : string[] = [], length : number = 0) : string {
|
|
629
|
+
if (arr != null && arr.length >= index) {
|
|
630
|
+
return arr[index]
|
|
631
|
+
} else if (full.length >= index) {
|
|
632
|
+
return full[index].slice(0, length)
|
|
633
|
+
}
|
|
634
|
+
return ''
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* 获取12小时制的小时数。
|
|
638
|
+
* @param {number} num - 小时数的位数。
|
|
639
|
+
* @returns {string} 12小时制的小时数字符串。
|
|
640
|
+
*/
|
|
641
|
+
const get$H = (num : number) : string => padStart(($H % 12 == 0 ? 12 : $H % 12).toString(), num, '0')
|
|
642
|
+
/**
|
|
643
|
+
* 获取上午或下午的字符串表示。
|
|
644
|
+
* @param {number} hour - 小时数。
|
|
645
|
+
* @param {number} minute - 分钟数。
|
|
646
|
+
* @param {boolean} isLowercase - 是否返回小写字符串。
|
|
647
|
+
* @returns {string} 上午或下午的字符串表示。
|
|
648
|
+
*/
|
|
649
|
+
const meridiemFunc = meridiem ?? ((hour : number, _ : number, isLowercase : boolean) : string => {
|
|
650
|
+
const m = (hour < 12 ? 'AM' : 'PM');
|
|
651
|
+
return isLowercase ? m.toLowerCase() : m;
|
|
652
|
+
});
|
|
653
|
+
// #ifdef APP-ANDROID
|
|
654
|
+
return str.replace('YYYY', padStart(this.$y.toString(), 4, '0'))
|
|
655
|
+
.replace('YY', (this.$y).toString().slice(-2))
|
|
656
|
+
.replace('MMMM', getShort(months, $M))
|
|
657
|
+
.replace('MM', padStart(($M + 1).toString(), 2, '0'))
|
|
658
|
+
.replace('M', ($M + 1).toString())
|
|
659
|
+
.replace('DD', padStart(this.$D.toString(), 2, '0'))
|
|
660
|
+
.replace('D', this.$D.toString())
|
|
661
|
+
.replace('dddd', weekdays[this.$W])
|
|
662
|
+
.replace('ddd', getShort(locale.weekdaysShort, this.$W, weekdays, 3))
|
|
663
|
+
.replace('dd', getShort(locale.weekdaysMin, this.$W, weekdays, 2))
|
|
664
|
+
.replace('d', this.$W.toString())
|
|
665
|
+
.replace('HH', padStart($H.toString(), 2, '0'))
|
|
666
|
+
.replace('H', $H.toString())
|
|
667
|
+
.replace('hh', get$H(2))
|
|
668
|
+
.replace('h', get$H(1))
|
|
669
|
+
.replace('mm', padStart($m.toString(), 2, '0'))
|
|
670
|
+
.replace('m', $m.toString())
|
|
671
|
+
.replace('ss', padStart(this.$s.toString(), 2, '0'))
|
|
672
|
+
.replace('s', this.$s.toString())
|
|
673
|
+
.replace('SSS', padStart(this.$ms.toString(), 3, '0'))
|
|
674
|
+
.replace('A', meridiemFunc($H, $m, false))
|
|
675
|
+
.replace('a', meridiemFunc($H, $m, true))
|
|
676
|
+
.replace('Z', zoneStr)
|
|
677
|
+
// #endif
|
|
678
|
+
// #ifndef APP-ANDROID
|
|
679
|
+
const matches = (match : string) : string | null => {
|
|
680
|
+
if (match == 'YY') {
|
|
681
|
+
return (this.$y).toString().slice(-2);
|
|
682
|
+
} else if (match == 'YYYY') {
|
|
683
|
+
return padStart(this.$y.toString(), 4, '0');
|
|
684
|
+
} else if (match == 'M') {
|
|
685
|
+
return ($M + 1).toString();
|
|
686
|
+
} else if (match == 'MM') {
|
|
687
|
+
return padStart(($M + 1).toString(), 2, '0');
|
|
688
|
+
} else if (match == 'MMM') {
|
|
689
|
+
return getShort(locale.monthsShort, $M, months, 3);
|
|
690
|
+
} else if (match == 'MMMM') {
|
|
691
|
+
return getShort(months, $M);
|
|
692
|
+
} else if (match == 'D') {
|
|
693
|
+
return this.$D.toString();
|
|
694
|
+
} else if (match == 'DD') {
|
|
695
|
+
return padStart(this.$D.toString(), 2, '0');
|
|
696
|
+
} else if (match == 'd') {
|
|
697
|
+
return this.$W.toString();
|
|
698
|
+
} else if (match == 'dd') {
|
|
699
|
+
return getShort(locale.weekdaysMin, this.$W, weekdays, 2);
|
|
700
|
+
} else if (match == 'ddd') {
|
|
701
|
+
return getShort(locale.weekdaysShort, this.$W, weekdays, 3);
|
|
702
|
+
} else if (match == 'dddd') {
|
|
703
|
+
return weekdays[this.$W];
|
|
704
|
+
} else if (match == 'H') {
|
|
705
|
+
return $H.toString();
|
|
706
|
+
} else if (match == 'HH') {
|
|
707
|
+
return padStart($H.toString(), 2, '0');
|
|
708
|
+
} else if (match == 'h') {
|
|
709
|
+
return get$H(1);
|
|
710
|
+
} else if (match == 'hh') {
|
|
711
|
+
return get$H(2);
|
|
712
|
+
} else if (match == 'a') {
|
|
713
|
+
return meridiemFunc($H, $m, true);
|
|
714
|
+
} else if (match == 'A') {
|
|
715
|
+
return meridiemFunc($H, $m, false);
|
|
716
|
+
} else if (match == 'm') {
|
|
717
|
+
return $m.toString();
|
|
718
|
+
} else if (match == 'mm') {
|
|
719
|
+
return padStart($m.toString(), 2, '0');
|
|
720
|
+
} else if (match == 's') {
|
|
721
|
+
return this.$s.toString();
|
|
722
|
+
} else if (match == 'ss') {
|
|
723
|
+
return padStart(this.$s.toString(), 2, '0');
|
|
724
|
+
} else if (match == 'SSS') {
|
|
725
|
+
return padStart(this.$ms.toString(), 3, '0');
|
|
726
|
+
} else if (match == 'Z') {
|
|
727
|
+
return zoneStr; // 'ZZ' logic below
|
|
728
|
+
}
|
|
729
|
+
return null;
|
|
730
|
+
};
|
|
731
|
+
return str.replace(REGEX_FORMAT, (match : string, $1 : string, offset : number, string : string) : string => {
|
|
732
|
+
return $1 ?? matches(match) ?? zoneStr.replace(':', '')
|
|
733
|
+
})
|
|
734
|
+
// #endif
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* 获取 Dayuts 实例的 UTC 偏移量(以分钟为单位)。
|
|
738
|
+
* @returns {number} UTC 偏移量(以分钟为单位)。
|
|
739
|
+
*/
|
|
740
|
+
utcOffset() : number {
|
|
741
|
+
// Because a bug at FF24, we're rounding the timezone offset around 15 minutes
|
|
742
|
+
// https://github.com/moment/moment/pull/1871
|
|
743
|
+
// #ifndef APP-ANDROID || APP-IOS
|
|
744
|
+
return -Math.round(this.$d.getTimezoneOffset() / 15) * 15
|
|
745
|
+
// #endif
|
|
746
|
+
// #ifdef APP-ANDROID || APP-IOS
|
|
747
|
+
return 0
|
|
748
|
+
// #endif
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* 计算两个日期之间的差值
|
|
752
|
+
* @param {string|number|Date|Dayuts} input - 要比较的日期
|
|
753
|
+
* @param {string} units - 要计算的时间单位,如 'years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'
|
|
754
|
+
* @param {boolean} float - 是否返回浮点数结果
|
|
755
|
+
* @returns {number} 返回两个日期之间的差值
|
|
756
|
+
*/
|
|
757
|
+
diff(input : string) : number
|
|
758
|
+
diff(input : number) : number
|
|
759
|
+
diff(input : Date) : number
|
|
760
|
+
diff(input : Dayuts) : number
|
|
761
|
+
diff(input : UTSJSONObject) : number
|
|
762
|
+
|
|
763
|
+
diff(input : string, units : DayutsUnit) : number
|
|
764
|
+
diff(input : number, units : DayutsUnit) : number
|
|
765
|
+
diff(input : Date, units : DayutsUnit) : number
|
|
766
|
+
diff(input : Dayuts, units : DayutsUnit) : number
|
|
767
|
+
diff(input : UTSJSONObject, units : DayutsUnit) : number
|
|
768
|
+
|
|
769
|
+
diff(input : string, units : DayutsUnit, float : boolean) : number
|
|
770
|
+
diff(input : number, units : DayutsUnit, float : boolean) : number
|
|
771
|
+
diff(input : Date, units : DayutsUnit, float : boolean) : number
|
|
772
|
+
diff(input : Dayuts, units : DayutsUnit, float : boolean) : number
|
|
773
|
+
diff(input : UTSJSONObject, units : DayutsUnit, float : boolean) : number
|
|
774
|
+
diff(input : any, units : DayutsUnit = 'millisecond', float : boolean = false) : number {
|
|
775
|
+
const unit = prettyUnit(units)
|
|
776
|
+
const that = dayuts(input)
|
|
777
|
+
const zoneDelta = (that.utcOffset() - this.utcOffset()) * MILLISECONDS_A_MINUTE
|
|
778
|
+
const diff = this.valueOf() - that.valueOf()
|
|
779
|
+
// @ts-ignore
|
|
780
|
+
const getMonth = () : number => monthDiff(this, that)
|
|
781
|
+
let result : number;
|
|
782
|
+
switch (unit) {
|
|
783
|
+
case Y:
|
|
784
|
+
result = getMonth() / 12
|
|
785
|
+
break
|
|
786
|
+
case M:
|
|
787
|
+
result = getMonth()
|
|
788
|
+
break
|
|
789
|
+
case Q:
|
|
790
|
+
result = getMonth() / 3
|
|
791
|
+
break
|
|
792
|
+
case W:
|
|
793
|
+
result = (diff - zoneDelta) / MILLISECONDS_A_WEEK
|
|
794
|
+
break
|
|
795
|
+
case D:
|
|
796
|
+
result = (diff - zoneDelta) / MILLISECONDS_A_DAY
|
|
797
|
+
break
|
|
798
|
+
case H:
|
|
799
|
+
result = diff / MILLISECONDS_A_HOUR
|
|
800
|
+
break
|
|
801
|
+
case MIN:
|
|
802
|
+
result = diff / MILLISECONDS_A_MINUTE
|
|
803
|
+
break
|
|
804
|
+
case S:
|
|
805
|
+
result = diff / MILLISECONDS_A_SECOND
|
|
806
|
+
break
|
|
807
|
+
default:
|
|
808
|
+
result = diff // milliseconds
|
|
809
|
+
break
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
return float ? result : absFloor(result)
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* 将当前 Dayuts 对象转换为原生 Date 对象。
|
|
816
|
+
*
|
|
817
|
+
* @returns {Date} 返回一个表示当前日期的原生 Date 对象。
|
|
818
|
+
*/
|
|
819
|
+
toDate() : Date {
|
|
820
|
+
return new Date(this.valueOf())
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* 将 Moment 对象转换为 JSON 字符串
|
|
824
|
+
* @returns {string | null} 如果 Moment 对象有效,则返回 ISO 8601 格式的字符串,否则返回 null
|
|
825
|
+
*/
|
|
826
|
+
toJSON() : string | null {
|
|
827
|
+
return this.isValid() ? this.toISOString() : null;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* 将 Moment 对象转换为 ISO 8601 格式的字符串
|
|
831
|
+
* @returns {string} 返回 ISO 8601 格式的字符串
|
|
832
|
+
*/
|
|
833
|
+
toISOString() : string {
|
|
834
|
+
// #ifndef APP-ANDROID || APP-IOS
|
|
835
|
+
return this.$d.toISOString();
|
|
836
|
+
// #endif
|
|
837
|
+
// #ifdef APP-ANDROID || APP-IOS
|
|
838
|
+
return this.$d.toString();
|
|
839
|
+
// #endif
|
|
840
|
+
}
|
|
841
|
+
toObject() : DayutsObject {
|
|
842
|
+
return {
|
|
843
|
+
years: this.$y,
|
|
844
|
+
months: this.$M,
|
|
845
|
+
date: this.$D,
|
|
846
|
+
hours: this.$H,
|
|
847
|
+
minutes: this.$m,
|
|
848
|
+
seconds: this.$s,
|
|
849
|
+
milliseconds: this.$ms
|
|
850
|
+
} as DayutsObject
|
|
851
|
+
}
|
|
852
|
+
toArray() : number[] {
|
|
853
|
+
return [
|
|
854
|
+
this.$y,
|
|
855
|
+
this.$M,
|
|
856
|
+
this.$D,
|
|
857
|
+
this.$H,
|
|
858
|
+
this.$m,
|
|
859
|
+
this.$s,
|
|
860
|
+
this.$ms
|
|
861
|
+
]
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* 获取当前日期的毫秒数。
|
|
865
|
+
*
|
|
866
|
+
* @returns {number} 返回一个表示当前日期的毫秒数。
|
|
867
|
+
*/
|
|
868
|
+
valueOf() : number {
|
|
869
|
+
// 使用 Date 对象的 getTime 方法获取当前日期的毫秒数。
|
|
870
|
+
return this.$d.getTime()
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* 获取当前 `dayuts` 对象所在月份的天数。
|
|
874
|
+
*
|
|
875
|
+
* @returns {number} 返回当前 `dayuts` 对象所在月份的天数。
|
|
876
|
+
*/
|
|
877
|
+
daysInMonth() : number {
|
|
878
|
+
return this.endOf(M).$D;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* 获取当前日期的区域设置对象。
|
|
883
|
+
*
|
|
884
|
+
* @returns {Object} 区域设置对象。
|
|
885
|
+
*/
|
|
886
|
+
private $locale() : DayutsLocale { // get locale object
|
|
887
|
+
// return Ls.get(this.$L)!
|
|
888
|
+
return localeState.locales.get(this.$L)!
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* 设置或获取 Dayuts 实例的本地化配置
|
|
892
|
+
* @param {string|Object} preset - 本地化预设名称或自定义本地化配置对象
|
|
893
|
+
* @param {Object} [DayutsLocale] - 可选的自定义本地化配置对象
|
|
894
|
+
* @returns {Dayuts|string} 如果设置了本地化配置,则返回一个新的 Dayuts 实例;否则返回当前实例的本地化配置名称
|
|
895
|
+
*/
|
|
896
|
+
locale(preset : string, object : DayutsLocale) : Dayuts
|
|
897
|
+
locale(preset : DayutsLocale, object : DayutsLocale) : Dayuts
|
|
898
|
+
locale(preset : any, object : DayutsLocale | null = null) : Dayuts {
|
|
899
|
+
// if (!preset) return this.$L
|
|
900
|
+
const that = this.clone()
|
|
901
|
+
const nextLocaleName = parseLocale(preset, object, true)
|
|
902
|
+
if (nextLocaleName != null) that.$L = nextLocaleName
|
|
903
|
+
return that
|
|
904
|
+
}
|
|
905
|
+
clone() : Dayuts {
|
|
906
|
+
return wrapper(this.$d.getTime(), this)
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* 返回当前 dayuts 对象的 UTC 字符串表示。
|
|
910
|
+
*
|
|
911
|
+
* @returns {string} 当前 dayuts 对象的 UTC 字符串表示。
|
|
912
|
+
*/
|
|
913
|
+
// #ifdef APP-ANDROID
|
|
914
|
+
override toString() : string {
|
|
915
|
+
// return this.$d.toUTCString();
|
|
916
|
+
// const locale = localeState.locales.get('en')!
|
|
917
|
+
// const weekday = locale.weekdays[this.$d.getDay()].substring(0,3);
|
|
918
|
+
// const month = locale.months[this.$d.getMonth()].substring(0,3)
|
|
919
|
+
// const day = `${this.$D}`.padStart(2, '0');
|
|
920
|
+
// const hours = `${this.$H}`.padStart(2, '0');
|
|
921
|
+
// const minutes = `${this.$m}`.padStart(2, '0');
|
|
922
|
+
// const seconds = `${this.$s}`.padStart(2, '0');
|
|
923
|
+
// return `${weekday}, ${day} ${month} ${this.$y} ${hours}:${minutes}:${seconds} GMT`;
|
|
924
|
+
return this.$d.toString();
|
|
925
|
+
}
|
|
926
|
+
// #endif
|
|
927
|
+
// #ifndef APP-ANDROID
|
|
928
|
+
toString() : string {
|
|
929
|
+
// return this.$d.toUTCString();
|
|
930
|
+
return this.$d.toString();
|
|
931
|
+
}
|
|
932
|
+
// #endif
|
|
933
|
+
/**
|
|
934
|
+
* 计算给定日期在当年的第几天,或者设置给定日期为当年的第几天。
|
|
935
|
+
* @param {number} [input] - 如果提供了输入值,则将日期设置为当年的第几天。如果没有提供输入值,则返回当前日期在当年的第几天。
|
|
936
|
+
* @returns {number} 如果提供了输入值,则返回调整后的日期。如果没有提供输入值,则返回当前日期在当年的第几天。
|
|
937
|
+
*/
|
|
938
|
+
dayOfYear() : number
|
|
939
|
+
dayOfYear(input : number) : Dayuts
|
|
940
|
+
dayOfYear(input : number | null = null) : any {
|
|
941
|
+
const dayOfYear = Math.round((this.startOf('day').valueOf() - this.startOf('year').valueOf()) / 864e5) + 1
|
|
942
|
+
return input == null ? dayOfYear : this.add(input - dayOfYear, 'day')
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* 根据输入的时间计算与当前时间的相对时间差,并以指定的格式返回。
|
|
946
|
+
* @param {Date|number|string} input - 输入的时间,可以是Date对象、时间戳或符合Date.parse()方法的字符串
|
|
947
|
+
* @param {boolean} withoutSuffix - 是否省略“未来”或“过去”的后缀
|
|
948
|
+
* @param {Object} instance - 当前时间的实例
|
|
949
|
+
* @param {boolean} isFrom - 是否从输入时间计算到当前时间
|
|
950
|
+
* @param {Function} postFormat - 格式化绝对值后的结果的函数
|
|
951
|
+
* @returns {string} 相对时间差的格式化字符串
|
|
952
|
+
*/
|
|
953
|
+
// postFormat
|
|
954
|
+
fromToBase(input : string, withoutSuffix : boolean, instance : Dayuts, isFrom : boolean) : string
|
|
955
|
+
fromToBase(input : number, withoutSuffix : boolean, instance : Dayuts, isFrom : boolean) : string
|
|
956
|
+
fromToBase(input : Date, withoutSuffix : boolean, instance : Dayuts, isFrom : boolean) : string
|
|
957
|
+
fromToBase(input : Dayuts, withoutSuffix : boolean, instance : Dayuts, isFrom : boolean) : string
|
|
958
|
+
fromToBase(input : UTSJSONObject, withoutSuffix : boolean, instance : Dayuts, isFrom : boolean) : string
|
|
959
|
+
fromToBase(input : any, withoutSuffix : boolean, instance : Dayuts, isFrom : boolean) : string {
|
|
960
|
+
const relObj = localeState.locales.get('en')?.relativeTime
|
|
961
|
+
const loc = instance.$locale().relativeTime ?? relObj
|
|
962
|
+
if (loc == null) return '';
|
|
963
|
+
const T : Threshold[] = [
|
|
964
|
+
{ l: 's', r: 44, d: S },
|
|
965
|
+
{ l: 'm', r: 89 },
|
|
966
|
+
{ l: 'mm', r: 44, d: MIN },
|
|
967
|
+
{ l: 'h', r: 89 },
|
|
968
|
+
{ l: 'hh', r: 21, d: H },
|
|
969
|
+
{ l: 'd', r: 35 },
|
|
970
|
+
{ l: 'dd', r: 25, d: D },
|
|
971
|
+
{ l: 'M', r: 45 },
|
|
972
|
+
{ l: 'MM', r: 10, d: M },
|
|
973
|
+
{ l: 'y', r: 17 },
|
|
974
|
+
{ l: 'yy', d: Y }
|
|
975
|
+
]
|
|
976
|
+
const Tl = T.length
|
|
977
|
+
let result : number = 0;
|
|
978
|
+
let out : string = '';
|
|
979
|
+
let isFuture : boolean = false
|
|
980
|
+
for (let i = 0; i < Tl; i += 1) {
|
|
981
|
+
let t = T[i]
|
|
982
|
+
if (t.d != null) {
|
|
983
|
+
result = isFrom
|
|
984
|
+
? dayuts(input).diff(instance, t.d!, true)
|
|
985
|
+
: instance.diff(input, t.d!, true)
|
|
986
|
+
}
|
|
987
|
+
let abs = Math.round(Math.abs(result))
|
|
988
|
+
isFuture = result > 0
|
|
989
|
+
if (t.r == null || t.r != null && abs <= t.r!) {
|
|
990
|
+
if (abs <= 1 && i > 0) t = T[i - 1] // 1 minutes -> a minute, 0 seconds -> 0 second
|
|
991
|
+
const format = loc[t.l]
|
|
992
|
+
// if (postFormat) {
|
|
993
|
+
// abs = postFormat(`${abs}`)
|
|
994
|
+
// }
|
|
995
|
+
if (typeof format == 'string') {
|
|
996
|
+
out = (format as string).replace('%d', abs.toString())
|
|
997
|
+
}
|
|
998
|
+
// else {
|
|
999
|
+
// out = format(abs, withoutSuffix, t.l!, isFuture)
|
|
1000
|
+
// }
|
|
1001
|
+
break
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
if (withoutSuffix) return out
|
|
1005
|
+
const pastOrFuture = isFuture ? loc.future : loc.past
|
|
1006
|
+
// if (typeof pastOrFuture == 'function') {
|
|
1007
|
+
// return pastOrFuture(out)
|
|
1008
|
+
// }
|
|
1009
|
+
return pastOrFuture.replace('%s', out)
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* 相对指定时间(后)。
|
|
1013
|
+
* @param {string|number|Date|Dayuts|UTSJSONObject} input - 输入的时间,可以是字符串、数字(时间戳)、Date对象、Dayuts对象或UTSJSONObject。
|
|
1014
|
+
* @param {boolean} withoutSuffix - 是否省略“未来”或“过去”的后缀。
|
|
1015
|
+
* @returns {string} 相对时间差的格式化字符串。
|
|
1016
|
+
*/
|
|
1017
|
+
to(input : string) : string
|
|
1018
|
+
to(input : number) : string
|
|
1019
|
+
to(input : Date) : string
|
|
1020
|
+
to(input : Dayuts) : string
|
|
1021
|
+
to(input : UTSJSONObject) : string
|
|
1022
|
+
|
|
1023
|
+
to(input : string, withoutSuffix : boolean) : string
|
|
1024
|
+
to(input : number, withoutSuffix : boolean) : string
|
|
1025
|
+
to(input : Date, withoutSuffix : boolean) : string
|
|
1026
|
+
to(input : Dayuts, withoutSuffix : boolean) : string
|
|
1027
|
+
to(input : UTSJSONObject, withoutSuffix : boolean) : string
|
|
1028
|
+
to(input : any, withoutSuffix : boolean = false) : string {
|
|
1029
|
+
return this.fromToBase(input, withoutSuffix, this, true)
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* 将当前时间转换为与输入时间的相对时间差,并以指定的格式返回。
|
|
1033
|
+
* @param {string|number|Date|Dayuts|UTSJSONObject} input - 输入的时间,可以是字符串、数字(时间戳)、Date对象、Dayuts对象或UTSJSONObject。
|
|
1034
|
+
* @param {boolean} withoutSuffix - 是否省略“未来”或“过去”的后缀。
|
|
1035
|
+
* @returns {string} 相对时间差的格式化字符串。
|
|
1036
|
+
*/
|
|
1037
|
+
from(input : string) : string
|
|
1038
|
+
from(input : number) : string
|
|
1039
|
+
from(input : Date) : string
|
|
1040
|
+
from(input : Dayuts) : string
|
|
1041
|
+
from(input : UTSJSONObject) : string
|
|
1042
|
+
|
|
1043
|
+
from(input : string, withoutSuffix : boolean) : string
|
|
1044
|
+
from(input : number, withoutSuffix : boolean) : string
|
|
1045
|
+
from(input : Date, withoutSuffix : boolean) : string
|
|
1046
|
+
from(input : Dayuts, withoutSuffix : boolean) : string
|
|
1047
|
+
from(input : UTSJSONObject, withoutSuffix : boolean) : string
|
|
1048
|
+
from(input : any, withoutSuffix : boolean = false) : string {
|
|
1049
|
+
return this.fromToBase(input, withoutSuffix, this, false)
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* 获取当前时间与实例时间的相对时间差,并以指定的格式返回。
|
|
1053
|
+
* @param {boolean} withoutSuffix - 是否省略“未来”或“过去”的后缀。
|
|
1054
|
+
* @returns {string} 相对时间差的格式化字符串。
|
|
1055
|
+
*/
|
|
1056
|
+
toNow() : string
|
|
1057
|
+
toNow(withoutSuffix : boolean = false) : string {
|
|
1058
|
+
return this.to(dayuts(), withoutSuffix)
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* 获取实例时间与当前时间的相对时间差,并以指定的格式返回。
|
|
1062
|
+
* @param {boolean} withoutSuffix - 是否省略“未来”或“过去”的后缀。
|
|
1063
|
+
* @returns {string} 相对时间差的格式化字符串。
|
|
1064
|
+
*/
|
|
1065
|
+
fromNow() : string
|
|
1066
|
+
fromNow(withoutSuffix : boolean = false) : string {
|
|
1067
|
+
return this.from(dayuts(), withoutSuffix)
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
function dayuts() : Dayuts;
|
|
1072
|
+
function dayuts(date : string) : Dayuts;
|
|
1073
|
+
function dayuts(date : any[]) : Dayuts;
|
|
1074
|
+
function dayuts(date : number) : Dayuts;
|
|
1075
|
+
function dayuts(date : UTSJSONObject) : Dayuts;
|
|
1076
|
+
function dayuts(date : Date) : Dayuts;
|
|
1077
|
+
function dayuts(date : Dayuts) : Dayuts;
|
|
1078
|
+
// #ifndef APP-ANDROID || APP-IOS
|
|
1079
|
+
function dayuts(date : any | null, format : string) : Dayuts;
|
|
1080
|
+
function dayuts(date : any | null, format : string | null, locale : string | null) : Dayuts;
|
|
1081
|
+
// #endif
|
|
1082
|
+
function dayuts(date : any | null = null, format : string | null = null, locale : string | null = null) : Dayuts {
|
|
1083
|
+
if (date != null && date instanceof Dayuts) return date.clone()
|
|
1084
|
+
return new Dayuts({
|
|
1085
|
+
date,
|
|
1086
|
+
format,
|
|
1087
|
+
locale
|
|
1088
|
+
} as DayutsConfig)
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* 判断给定的对象是否为Dayuts实例
|
|
1093
|
+
* @param {(any | null)} date - 输入的对象
|
|
1094
|
+
* @returns {boolean} - 如果给定的对象是Dayuts实例,则返回true,否则返回false
|
|
1095
|
+
*/
|
|
1096
|
+
function isDayuts(date : any | null = null) : boolean {
|
|
1097
|
+
return date instanceof Dayuts
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
export {
|
|
1101
|
+
dayuts,
|
|
1102
|
+
isDayuts
|
|
1103
|
+
}
|