duoyun-ui 2.2.3 → 2.2.8
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/elements/badge.d.ts +2 -16
- package/elements/badge.d.ts.map +1 -1
- package/elements/badge.js +4 -158
- package/elements/badge.js.map +1 -1
- package/elements/banner.d.ts +2 -17
- package/elements/banner.d.ts.map +1 -1
- package/elements/banner.js +4 -127
- package/elements/banner.js.map +1 -1
- package/elements/base/chart.d.ts +2 -2
- package/elements/base/resize.d.ts +1 -22
- package/elements/base/resize.d.ts.map +1 -1
- package/elements/base/resize.js +1 -95
- package/elements/base/resize.js.map +1 -1
- package/elements/base/scroll.d.ts +1 -8
- package/elements/base/scroll.d.ts.map +1 -1
- package/elements/base/scroll.js +1 -157
- package/elements/base/scroll.js.map +1 -1
- package/elements/base/visible.d.ts +1 -18
- package/elements/base/visible.d.ts.map +1 -1
- package/elements/base/visible.js +1 -112
- package/elements/base/visible.js.map +1 -1
- package/elements/button.d.ts +2 -24
- package/elements/button.d.ts.map +1 -1
- package/elements/button.js +7 -287
- package/elements/button.js.map +1 -1
- package/elements/checkbox.d.ts +3 -21
- package/elements/checkbox.d.ts.map +1 -1
- package/elements/checkbox.js +6 -180
- package/elements/checkbox.js.map +1 -1
- package/elements/code-block.d.ts +2 -7
- package/elements/code-block.d.ts.map +1 -1
- package/elements/code-block.js +4 -432
- package/elements/code-block.js.map +1 -1
- package/elements/collapse.d.ts +3 -29
- package/elements/collapse.d.ts.map +1 -1
- package/elements/collapse.js +6 -197
- package/elements/collapse.js.map +1 -1
- package/elements/compartment.d.ts +2 -5
- package/elements/compartment.d.ts.map +1 -1
- package/elements/compartment.js +4 -23
- package/elements/compartment.js.map +1 -1
- package/elements/contextmenu.d.ts +5 -42
- package/elements/contextmenu.d.ts.map +1 -1
- package/elements/contextmenu.js +8 -285
- package/elements/contextmenu.js.map +1 -1
- package/elements/countdown.d.ts +2 -12
- package/elements/countdown.d.ts.map +1 -1
- package/elements/countdown.js +4 -94
- package/elements/countdown.js.map +1 -1
- package/elements/divider.d.ts +2 -8
- package/elements/divider.d.ts.map +1 -1
- package/elements/divider.js +4 -129
- package/elements/divider.js.map +1 -1
- package/elements/empty.d.ts +2 -8
- package/elements/empty.d.ts.map +1 -1
- package/elements/empty.js +4 -59
- package/elements/empty.js.map +1 -1
- package/elements/grouped-picker.d.ts +29 -0
- package/elements/grouped-picker.d.ts.map +1 -0
- package/elements/grouped-picker.js +199 -0
- package/elements/grouped-picker.js.map +1 -0
- package/elements/input.d.ts +4 -36
- package/elements/input.d.ts.map +1 -1
- package/elements/input.js +6 -489
- package/elements/input.js.map +1 -1
- package/elements/letters.d.ts +2 -36
- package/elements/letters.d.ts.map +1 -1
- package/elements/letters.js +10 -677
- package/elements/letters.js.map +1 -1
- package/elements/link.d.ts +3 -5
- package/elements/link.d.ts.map +1 -1
- package/elements/link.js +6 -38
- package/elements/link.js.map +1 -1
- package/elements/list.d.ts +5 -58
- package/elements/list.d.ts.map +1 -1
- package/elements/list.js +19 -664
- package/elements/list.js.map +1 -1
- package/elements/modal.d.ts +5 -63
- package/elements/modal.d.ts.map +1 -1
- package/elements/modal.js +13 -411
- package/elements/modal.js.map +1 -1
- package/elements/options.d.ts +4 -32
- package/elements/options.d.ts.map +1 -1
- package/elements/options.js +5 -254
- package/elements/options.js.map +1 -1
- package/elements/page-loadbar.js +1 -1
- package/elements/paragraph.d.ts +2 -2
- package/elements/paragraph.d.ts.map +1 -1
- package/elements/paragraph.js +4 -45
- package/elements/paragraph.js.map +1 -1
- package/elements/placeholder.d.ts +2 -14
- package/elements/placeholder.d.ts.map +1 -1
- package/elements/placeholder.js +4 -114
- package/elements/placeholder.js.map +1 -1
- package/elements/radio.d.ts +5 -24
- package/elements/radio.d.ts.map +1 -1
- package/elements/radio.js +7 -165
- package/elements/radio.js.map +1 -1
- package/elements/rate.d.ts +2 -12
- package/elements/rate.d.ts.map +1 -1
- package/elements/rate.js +4 -142
- package/elements/rate.js.map +1 -1
- package/elements/rolling-number.d.ts +2 -12
- package/elements/rolling-number.d.ts.map +1 -1
- package/elements/rolling-number.js +4 -434
- package/elements/rolling-number.js.map +1 -1
- package/elements/scroll-box.d.ts +2 -2
- package/elements/scroll-box.d.ts.map +1 -1
- package/elements/scroll-box.js +4 -5
- package/elements/scroll-box.js.map +1 -1
- package/elements/segmented.d.ts +3 -20
- package/elements/segmented.d.ts.map +1 -1
- package/elements/segmented.js +4 -192
- package/elements/segmented.js.map +1 -1
- package/elements/slider.d.ts +2 -20
- package/elements/slider.d.ts.map +1 -1
- package/elements/slider.js +4 -261
- package/elements/slider.js.map +1 -1
- package/elements/sort-box.d.ts +1 -2
- package/elements/sort-box.d.ts.map +1 -1
- package/elements/sort-box.js +4 -15
- package/elements/sort-box.js.map +1 -1
- package/elements/space.d.ts +2 -4
- package/elements/space.d.ts.map +1 -1
- package/elements/space.js +4 -37
- package/elements/space.js.map +1 -1
- package/elements/switch.d.ts +2 -11
- package/elements/switch.d.ts.map +1 -1
- package/elements/switch.js +5 -134
- package/elements/switch.js.map +1 -1
- package/elements/tag.d.ts +3 -16
- package/elements/tag.d.ts.map +1 -1
- package/elements/tag.js +4 -133
- package/elements/tag.js.map +1 -1
- package/elements/toast.js +1 -1
- package/elements/wait.js +1 -1
- package/helper/error.js +2 -39
- package/helper/error.js.map +1 -1
- package/helper/webapp.d.ts +4 -5
- package/helper/webapp.d.ts.map +1 -1
- package/helper/webapp.js +5 -11
- package/helper/webapp.js.map +1 -1
- package/lib/animations.d.ts +1 -10
- package/lib/animations.d.ts.map +1 -1
- package/lib/animations.js +1 -29
- package/lib/animations.js.map +1 -1
- package/lib/cache.d.ts +1 -18
- package/lib/cache.d.ts.map +1 -1
- package/lib/cache.js +1 -62
- package/lib/cache.js.map +1 -1
- package/lib/color.d.ts +1 -37
- package/lib/color.d.ts.map +1 -1
- package/lib/color.js +1 -98
- package/lib/color.js.map +1 -1
- package/lib/decorators.d.ts +1 -2
- package/lib/decorators.d.ts.map +1 -1
- package/lib/decorators.js +1 -16
- package/lib/decorators.js.map +1 -1
- package/lib/easing.d.ts +1 -78
- package/lib/easing.d.ts.map +1 -1
- package/lib/easing.js +1 -139
- package/lib/easing.js.map +1 -1
- package/lib/element.d.ts +1 -18
- package/lib/element.d.ts.map +1 -1
- package/lib/element.js +1 -131
- package/lib/element.js.map +1 -1
- package/lib/encode.d.ts +1 -10
- package/lib/encode.d.ts.map +1 -1
- package/lib/encode.js +1 -48
- package/lib/encode.js.map +1 -1
- package/lib/hotkeys.d.ts +1 -43
- package/lib/hotkeys.d.ts.map +1 -1
- package/lib/hotkeys.js +1 -247
- package/lib/hotkeys.js.map +1 -1
- package/lib/icons.d.ts +1 -114
- package/lib/icons.d.ts.map +1 -1
- package/lib/icons.js +1 -90
- package/lib/icons.js.map +1 -1
- package/lib/image.d.ts +1 -39
- package/lib/image.d.ts.map +1 -1
- package/lib/image.js +1 -140
- package/lib/image.js.map +1 -1
- package/lib/locale.d.ts +1 -87
- package/lib/locale.d.ts.map +1 -1
- package/lib/locale.js +1 -8
- package/lib/locale.js.map +1 -1
- package/lib/map.d.ts +1 -8
- package/lib/map.d.ts.map +1 -1
- package/lib/map.js +1 -31
- package/lib/map.js.map +1 -1
- package/lib/number.d.ts +1 -94
- package/lib/number.d.ts.map +1 -1
- package/lib/number.js +1 -169
- package/lib/number.js.map +1 -1
- package/lib/patterns.d.ts +1 -9
- package/lib/patterns.d.ts.map +1 -1
- package/lib/patterns.js +1 -11
- package/lib/patterns.js.map +1 -1
- package/lib/styles.d.ts +1 -4
- package/lib/styles.d.ts.map +1 -1
- package/lib/styles.js +1 -28
- package/lib/styles.js.map +1 -1
- package/lib/theme.d.ts +1 -85
- package/lib/theme.d.ts.map +1 -1
- package/lib/theme.js +6 -70
- package/lib/theme.js.map +1 -1
- package/lib/time.d.ts +1 -81
- package/lib/time.d.ts.map +1 -1
- package/lib/time.js +1 -255
- package/lib/time.js.map +1 -1
- package/lib/timer.d.ts +1 -25
- package/lib/timer.d.ts.map +1 -1
- package/lib/timer.js +1 -106
- package/lib/timer.js.map +1 -1
- package/lib/types.d.ts +1 -13
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +1 -16
- package/lib/types.js.map +1 -1
- package/lib/utils.d.ts +1 -80
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +1 -244
- package/lib/utils.js.map +1 -1
- package/locales/en.d.ts +1 -37
- package/locales/en.d.ts.map +1 -1
- package/locales/en.js +1 -36
- package/locales/en.js.map +1 -1
- package/locales/zh.d.ts +1 -3
- package/locales/zh.d.ts.map +1 -1
- package/locales/zh.js +1 -37
- package/locales/zh.js.map +1 -1
- package/package.json +3 -5
- package/patterns/console.d.ts +1 -1
- package/patterns/form.d.ts +5 -3
- package/patterns/form.d.ts.map +1 -1
- package/patterns/form.js +16 -3
- package/patterns/form.js.map +1 -1
- package/react/DyActionText.d.ts +19 -0
- package/react/DyActionText.js +18 -0
- package/react/DyActiveLink.d.ts +15 -0
- package/react/DyActiveLink.js +18 -0
- package/react/DyAlert.d.ts +19 -0
- package/react/DyAlert.js +18 -0
- package/react/DyAreaChart.d.ts +46 -0
- package/react/DyAreaChart.js +18 -0
- package/react/DyAvatar.d.ts +23 -0
- package/react/DyAvatar.js +18 -0
- package/react/DyAvatarGroup.d.ts +22 -0
- package/react/DyAvatarGroup.js +18 -0
- package/react/DyBadge.d.ts +15 -0
- package/react/DyBadge.js +18 -0
- package/react/DyBanner.d.ts +15 -0
- package/react/DyBanner.js +18 -0
- package/react/DyBarChart.d.ts +23 -0
- package/react/DyBarChart.js +18 -0
- package/react/DyBreadcrumbs.d.ts +20 -0
- package/react/DyBreadcrumbs.js +18 -0
- package/react/DyButton.d.ts +15 -0
- package/react/DyButton.js +18 -0
- package/react/DyCalendar.d.ts +23 -0
- package/react/DyCalendar.js +18 -0
- package/react/DyCard.d.ts +24 -0
- package/react/DyCard.js +18 -0
- package/react/DyCarousel.d.ts +25 -0
- package/react/DyCarousel.js +18 -0
- package/react/DyCascader.d.ts +22 -0
- package/react/DyCascader.js +18 -0
- package/react/DyCascaderPicker.d.ts +27 -0
- package/react/DyCascaderPicker.js +22 -0
- package/react/DyChartTooltip.d.ts +15 -0
- package/react/DyChartTooltip.js +18 -0
- package/react/DyChartZoom.d.ts +20 -0
- package/react/DyChartZoom.js +18 -0
- package/react/DyCheckbox.d.ts +15 -0
- package/react/DyCheckbox.js +18 -0
- package/react/DyCheckboxGroup.d.ts +15 -0
- package/react/DyCheckboxGroup.js +18 -0
- package/react/DyCoachMark.d.ts +20 -0
- package/react/DyCoachMark.js +18 -0
- package/react/DyCodeBlock.d.ts +15 -0
- package/react/DyCodeBlock.js +18 -0
- package/react/DyCollapse.d.ts +15 -0
- package/react/DyCollapse.js +18 -0
- package/react/DyCollapsePanel.d.ts +15 -0
- package/react/DyCollapsePanel.js +18 -0
- package/react/DyColorPanel.d.ts +19 -0
- package/react/DyColorPanel.js +18 -0
- package/react/DyColorPicker.d.ts +22 -0
- package/react/DyColorPicker.js +22 -0
- package/react/DyCompartment.d.ts +15 -0
- package/react/DyCompartment.js +18 -0
- package/react/DyContextmenu.d.ts +15 -0
- package/react/DyContextmenu.js +18 -0
- package/react/DyCopy.d.ts +21 -0
- package/react/DyCopy.js +18 -0
- package/react/DyCountdown.d.ts +15 -0
- package/react/DyCountdown.js +18 -0
- package/react/DyDatePanel.d.ts +22 -0
- package/react/DyDatePanel.js +18 -0
- package/react/DyDatePicker.d.ts +26 -0
- package/react/DyDatePicker.js +22 -0
- package/react/DyDateRangePanel.d.ts +18 -0
- package/react/DyDateRangePanel.js +18 -0
- package/react/DyDateRangePicker.d.ts +26 -0
- package/react/DyDateRangePicker.js +22 -0
- package/react/DyDivider.d.ts +15 -0
- package/react/DyDivider.js +18 -0
- package/react/DyDonutChart.d.ts +20 -0
- package/react/DyDonutChart.js +18 -0
- package/react/DyDrawer.d.ts +15 -0
- package/react/DyDrawer.js +18 -0
- package/react/DyDropArea.d.ts +23 -0
- package/react/DyDropArea.js +18 -0
- package/react/DyEmpty.d.ts +15 -0
- package/react/DyEmpty.js +18 -0
- package/react/DyFilePicker.d.ts +27 -0
- package/react/DyFilePicker.js +22 -0
- package/react/DyForm.d.ts +24 -0
- package/react/DyForm.js +34 -0
- package/react/DyFormItem.d.ts +47 -0
- package/react/DyFormItem.js +31 -0
- package/react/DyFormItemInlineGroup.d.ts +15 -0
- package/react/DyFormItemInlineGroup.js +18 -0
- package/react/DyGesture.d.ts +15 -0
- package/react/DyGesture.js +18 -0
- package/react/DyGroupedPicker.d.ts +27 -0
- package/react/DyGroupedPicker.js +22 -0
- package/react/DyHeading.d.ts +17 -0
- package/react/DyHeading.js +18 -0
- package/react/DyHelpText.d.ts +17 -0
- package/react/DyHelpText.js +18 -0
- package/react/DyIcons.d.ts +15 -0
- package/react/DyIcons.js +18 -0
- package/react/DyImagePreview.d.ts +20 -0
- package/react/DyImagePreview.js +18 -0
- package/react/DyInput.d.ts +15 -0
- package/react/DyInput.js +18 -0
- package/react/DyInputCapture.d.ts +15 -0
- package/react/DyInputCapture.js +18 -0
- package/react/DyInputGroup.d.ts +15 -0
- package/react/DyInputGroup.js +18 -0
- package/react/DyKeyboardAccess.d.ts +19 -0
- package/react/DyKeyboardAccess.js +18 -0
- package/react/DyLegend.d.ts +20 -0
- package/react/DyLegend.js +18 -0
- package/react/DyLetters.d.ts +15 -0
- package/react/DyLetters.js +18 -0
- package/react/DyLightRoute.d.ts +15 -0
- package/react/DyLightRoute.js +18 -0
- package/react/DyLineChart.d.ts +15 -0
- package/react/DyLineChart.js +18 -0
- package/react/DyLink.d.ts +15 -0
- package/react/DyLink.js +18 -0
- package/react/DyList.d.ts +17 -0
- package/react/DyList.js +18 -0
- package/react/DyLoading.d.ts +15 -0
- package/react/DyLoading.js +18 -0
- package/react/DyMeter.d.ts +24 -0
- package/react/DyMeter.js +18 -0
- package/react/DyMore.d.ts +20 -0
- package/react/DyMore.js +18 -0
- package/react/DyMoreSlot.d.ts +17 -0
- package/react/DyMoreSlot.js +18 -0
- package/react/DyOptions.d.ts +15 -0
- package/react/DyOptions.js +18 -0
- package/react/DyPageLoadbar.d.ts +15 -0
- package/react/DyPageLoadbar.js +18 -0
- package/react/DyPagination.d.ts +23 -0
- package/react/DyPagination.js +18 -0
- package/react/DyParagraph.d.ts +15 -0
- package/react/DyParagraph.js +18 -0
- package/react/DyPatConsole.d.ts +25 -0
- package/react/DyPatConsole.js +18 -0
- package/react/DyPatFilterForm.d.ts +20 -0
- package/react/DyPatFilterForm.js +18 -0
- package/react/DyPatFooter.d.ts +23 -0
- package/react/DyPatFooter.js +18 -0
- package/react/DyPatForm.d.ts +20 -0
- package/react/DyPatForm.js +18 -0
- package/react/DyPatNav.d.ts +21 -0
- package/react/DyPatNav.js +18 -0
- package/react/DyPatTable.d.ts +32 -0
- package/react/DyPatTable.js +18 -0
- package/react/DyPicker.d.ts +28 -0
- package/react/DyPicker.js +22 -0
- package/react/DyPlaceholder.d.ts +15 -0
- package/react/DyPlaceholder.js +18 -0
- package/react/DyPopover.d.ts +27 -0
- package/react/DyPopover.js +22 -0
- package/react/DyPopoverGhost.d.ts +17 -0
- package/react/DyPopoverGhost.js +18 -0
- package/react/DyProgress.d.ts +18 -0
- package/react/DyProgress.js +18 -0
- package/react/DyRadarChart.d.ts +22 -0
- package/react/DyRadarChart.js +18 -0
- package/react/DyRadio.d.ts +15 -0
- package/react/DyRadio.js +18 -0
- package/react/DyRadioGroup.d.ts +15 -0
- package/react/DyRadioGroup.js +18 -0
- package/react/DyRate.d.ts +15 -0
- package/react/DyRate.js +18 -0
- package/react/DyReflect.d.ts +15 -0
- package/react/DyReflect.js +18 -0
- package/react/DyResult.d.ts +21 -0
- package/react/DyResult.js +18 -0
- package/react/DyRollingNumber.d.ts +15 -0
- package/react/DyRollingNumber.js +18 -0
- package/react/DyRoute.d.ts +15 -0
- package/react/DyRoute.js +18 -0
- package/react/DySankeyChart.d.ts +21 -0
- package/react/DySankeyChart.js +18 -0
- package/react/DyScatterChart.d.ts +17 -0
- package/react/DyScatterChart.js +18 -0
- package/react/DyScrollBox.d.ts +15 -0
- package/react/DyScrollBox.js +18 -0
- package/react/DySegmented.d.ts +15 -0
- package/react/DySegmented.js +18 -0
- package/react/DySelect.d.ts +37 -0
- package/react/DySelect.js +25 -0
- package/react/DySelectionBox.d.ts +18 -0
- package/react/DySelectionBox.js +18 -0
- package/react/DySelectionBoxMask.d.ts +15 -0
- package/react/DySelectionBoxMask.js +18 -0
- package/react/DyShortcutRecord.d.ts +23 -0
- package/react/DyShortcutRecord.js +18 -0
- package/react/DySideNavigation.d.ts +18 -0
- package/react/DySideNavigation.js +18 -0
- package/react/DySlider.d.ts +15 -0
- package/react/DySlider.js +18 -0
- package/react/DySortBox.d.ts +17 -0
- package/react/DySortBox.js +18 -0
- package/react/DySortHandle.d.ts +15 -0
- package/react/DySortHandle.js +18 -0
- package/react/DySortItem.d.ts +15 -0
- package/react/DySortItem.js +18 -0
- package/react/DySpace.d.ts +15 -0
- package/react/DySpace.js +18 -0
- package/react/DyStatistic.d.ts +25 -0
- package/react/DyStatistic.js +18 -0
- package/react/DyStatusLight.d.ts +17 -0
- package/react/DyStatusLight.js +18 -0
- package/react/DySwitch.d.ts +15 -0
- package/react/DySwitch.js +18 -0
- package/react/DyTabPanel.d.ts +17 -0
- package/react/DyTabPanel.js +18 -0
- package/react/DyTable.d.ts +36 -0
- package/react/DyTable.js +25 -0
- package/react/DyTabs.d.ts +21 -0
- package/react/DyTabs.js +18 -0
- package/react/DyTag.d.ts +15 -0
- package/react/DyTag.js +18 -0
- package/react/DyTextMask.d.ts +20 -0
- package/react/DyTextMask.js +18 -0
- package/react/DyTimePanel.d.ts +19 -0
- package/react/DyTimePanel.js +18 -0
- package/react/DyTimePicker.d.ts +25 -0
- package/react/DyTimePicker.js +22 -0
- package/react/DyTimeline.d.ts +17 -0
- package/react/DyTimeline.js +18 -0
- package/react/DyTitle.d.ts +15 -0
- package/react/DyTitle.js +18 -0
- package/react/DyToast.d.ts +17 -0
- package/react/DyToast.js +18 -0
- package/react/DyTooltip.d.ts +15 -0
- package/react/DyTooltip.js +18 -0
- package/react/DyTree.d.ts +29 -0
- package/react/DyTree.js +31 -0
- package/react/DyUnsafe.d.ts +15 -0
- package/react/DyUnsafe.js +18 -0
- package/react/DyUse.d.ts +15 -0
- package/react/DyUse.js +18 -0
- package/react/DyVestaboard.d.ts +21 -0
- package/react/DyVestaboard.js +18 -0
- package/react/DyWait.d.ts +17 -0
- package/react/DyWait.js +18 -0
- package/svelte/action-text.d.ts +13 -0
- package/svelte/action-text.js +2 -0
- package/svelte/alert.d.ts +13 -0
- package/svelte/alert.js +2 -0
- package/svelte/area-chart.d.ts +40 -0
- package/svelte/area-chart.js +2 -0
- package/svelte/avatar.d.ts +16 -0
- package/svelte/avatar.js +2 -0
- package/svelte/badge.d.ts +9 -0
- package/svelte/badge.js +2 -0
- package/svelte/banner.d.ts +9 -0
- package/svelte/banner.js +2 -0
- package/svelte/bar-chart.d.ts +17 -0
- package/svelte/bar-chart.js +2 -0
- package/svelte/breadcrumbs.d.ts +14 -0
- package/svelte/breadcrumbs.js +2 -0
- package/svelte/button.d.ts +9 -0
- package/svelte/button.js +2 -0
- package/svelte/calendar.d.ts +17 -0
- package/svelte/calendar.js +2 -0
- package/svelte/card.d.ts +18 -0
- package/svelte/card.js +2 -0
- package/svelte/carousel.d.ts +19 -0
- package/svelte/carousel.js +2 -0
- package/svelte/cascader-picker.d.ts +19 -0
- package/svelte/cascader-picker.js +2 -0
- package/svelte/cascader.d.ts +16 -0
- package/svelte/cascader.js +2 -0
- package/svelte/chart-tooltip.d.ts +9 -0
- package/svelte/chart-tooltip.js +2 -0
- package/svelte/chart-zoom.d.ts +14 -0
- package/svelte/chart-zoom.js +2 -0
- package/svelte/checkbox.d.ts +9 -0
- package/svelte/checkbox.js +2 -0
- package/svelte/coach-mark.d.ts +14 -0
- package/svelte/coach-mark.js +2 -0
- package/svelte/code-block.d.ts +9 -0
- package/svelte/code-block.js +2 -0
- package/svelte/collapse.d.ts +9 -0
- package/svelte/collapse.js +2 -0
- package/svelte/color-panel.d.ts +13 -0
- package/svelte/color-panel.js +2 -0
- package/svelte/color-picker.d.ts +14 -0
- package/svelte/color-picker.js +2 -0
- package/svelte/compartment.d.ts +9 -0
- package/svelte/compartment.js +2 -0
- package/svelte/contextmenu.d.ts +9 -0
- package/svelte/contextmenu.js +2 -0
- package/svelte/copy.d.ts +15 -0
- package/svelte/copy.js +2 -0
- package/svelte/countdown.d.ts +9 -0
- package/svelte/countdown.js +2 -0
- package/svelte/date-panel.d.ts +16 -0
- package/svelte/date-panel.js +2 -0
- package/svelte/date-picker.d.ts +18 -0
- package/svelte/date-picker.js +2 -0
- package/svelte/date-range-panel.d.ts +12 -0
- package/svelte/date-range-panel.js +2 -0
- package/svelte/date-range-picker.d.ts +18 -0
- package/svelte/date-range-picker.js +2 -0
- package/svelte/divider.d.ts +9 -0
- package/svelte/divider.js +2 -0
- package/svelte/donut-chart.d.ts +14 -0
- package/svelte/donut-chart.js +2 -0
- package/svelte/drawer.d.ts +9 -0
- package/svelte/drawer.js +2 -0
- package/svelte/drop-area.d.ts +17 -0
- package/svelte/drop-area.js +2 -0
- package/svelte/empty.d.ts +9 -0
- package/svelte/empty.js +2 -0
- package/svelte/file-picker.d.ts +19 -0
- package/svelte/file-picker.js +2 -0
- package/svelte/form.d.ts +36 -0
- package/svelte/form.js +2 -0
- package/svelte/gesture.d.ts +9 -0
- package/svelte/gesture.js +2 -0
- package/svelte/grouped-picker.d.ts +19 -0
- package/svelte/grouped-picker.js +2 -0
- package/svelte/heading.d.ts +11 -0
- package/svelte/heading.js +2 -0
- package/svelte/help-text.d.ts +11 -0
- package/svelte/help-text.js +2 -0
- package/svelte/icons.d.ts +9 -0
- package/svelte/icons.js +2 -0
- package/svelte/image-preview.d.ts +14 -0
- package/svelte/image-preview.js +2 -0
- package/svelte/input-capture.d.ts +9 -0
- package/svelte/input-capture.js +2 -0
- package/svelte/input.d.ts +9 -0
- package/svelte/input.js +2 -0
- package/svelte/keyboard-access.d.ts +13 -0
- package/svelte/keyboard-access.js +2 -0
- package/svelte/legend.d.ts +14 -0
- package/svelte/legend.js +2 -0
- package/svelte/letters.d.ts +9 -0
- package/svelte/letters.js +2 -0
- package/svelte/line-chart.d.ts +9 -0
- package/svelte/line-chart.js +2 -0
- package/svelte/link.d.ts +9 -0
- package/svelte/link.js +2 -0
- package/svelte/list.d.ts +11 -0
- package/svelte/list.js +2 -0
- package/svelte/loading.d.ts +9 -0
- package/svelte/loading.js +2 -0
- package/svelte/meter.d.ts +18 -0
- package/svelte/meter.js +2 -0
- package/svelte/more.d.ts +11 -0
- package/svelte/more.js +2 -0
- package/svelte/options.d.ts +9 -0
- package/svelte/options.js +2 -0
- package/svelte/page-loadbar.d.ts +9 -0
- package/svelte/page-loadbar.js +2 -0
- package/svelte/pagination.d.ts +17 -0
- package/svelte/pagination.js +2 -0
- package/svelte/paragraph.d.ts +9 -0
- package/svelte/paragraph.js +2 -0
- package/svelte/pat-console.d.ts +19 -0
- package/svelte/pat-console.js +2 -0
- package/svelte/pat-filter-form.d.ts +14 -0
- package/svelte/pat-filter-form.js +2 -0
- package/svelte/pat-footer.d.ts +17 -0
- package/svelte/pat-footer.js +2 -0
- package/svelte/pat-form.d.ts +14 -0
- package/svelte/pat-form.js +2 -0
- package/svelte/pat-nav.d.ts +15 -0
- package/svelte/pat-nav.js +2 -0
- package/svelte/pat-table.d.ts +26 -0
- package/svelte/pat-table.js +2 -0
- package/svelte/picker.d.ts +20 -0
- package/svelte/picker.js +2 -0
- package/svelte/placeholder.d.ts +9 -0
- package/svelte/placeholder.js +2 -0
- package/svelte/popover.d.ts +11 -0
- package/svelte/popover.js +2 -0
- package/svelte/progress.d.ts +12 -0
- package/svelte/progress.js +2 -0
- package/svelte/radar-chart.d.ts +16 -0
- package/svelte/radar-chart.js +2 -0
- package/svelte/radio.d.ts +9 -0
- package/svelte/radio.js +2 -0
- package/svelte/rate.d.ts +9 -0
- package/svelte/rate.js +2 -0
- package/svelte/reflect.d.ts +9 -0
- package/svelte/reflect.js +2 -0
- package/svelte/result.d.ts +15 -0
- package/svelte/result.js +2 -0
- package/svelte/rolling-number.d.ts +9 -0
- package/svelte/rolling-number.js +2 -0
- package/svelte/route.d.ts +9 -0
- package/svelte/route.js +2 -0
- package/svelte/sankey-chart.d.ts +15 -0
- package/svelte/sankey-chart.js +2 -0
- package/svelte/scatter-chart.d.ts +11 -0
- package/svelte/scatter-chart.js +2 -0
- package/svelte/scroll-box.d.ts +9 -0
- package/svelte/scroll-box.js +2 -0
- package/svelte/segmented.d.ts +9 -0
- package/svelte/segmented.js +2 -0
- package/svelte/select.d.ts +28 -0
- package/svelte/select.js +2 -0
- package/svelte/selection-box.d.ts +9 -0
- package/svelte/selection-box.js +2 -0
- package/svelte/shortcut-record.d.ts +17 -0
- package/svelte/shortcut-record.js +2 -0
- package/svelte/side-navigation.d.ts +12 -0
- package/svelte/side-navigation.js +2 -0
- package/svelte/slider.d.ts +9 -0
- package/svelte/slider.js +2 -0
- package/svelte/sort-box.d.ts +9 -0
- package/svelte/sort-box.js +2 -0
- package/svelte/space.d.ts +9 -0
- package/svelte/space.js +2 -0
- package/svelte/statistic.d.ts +19 -0
- package/svelte/statistic.js +2 -0
- package/svelte/status-light.d.ts +11 -0
- package/svelte/status-light.js +2 -0
- package/svelte/switch.d.ts +9 -0
- package/svelte/switch.js +2 -0
- package/svelte/table.d.ts +27 -0
- package/svelte/table.js +2 -0
- package/svelte/tabs.d.ts +11 -0
- package/svelte/tabs.js +2 -0
- package/svelte/tag.d.ts +9 -0
- package/svelte/tag.js +2 -0
- package/svelte/text-mask.d.ts +14 -0
- package/svelte/text-mask.js +2 -0
- package/svelte/time-panel.d.ts +13 -0
- package/svelte/time-panel.js +2 -0
- package/svelte/time-picker.d.ts +17 -0
- package/svelte/time-picker.js +2 -0
- package/svelte/timeline.d.ts +11 -0
- package/svelte/timeline.js +2 -0
- package/svelte/title.d.ts +9 -0
- package/svelte/title.js +2 -0
- package/svelte/toast.d.ts +11 -0
- package/svelte/toast.js +2 -0
- package/svelte/tooltip.d.ts +9 -0
- package/svelte/tooltip.js +2 -0
- package/svelte/tree.d.ts +18 -0
- package/svelte/tree.js +2 -0
- package/svelte/unsafe.d.ts +9 -0
- package/svelte/unsafe.js +2 -0
- package/svelte/use.d.ts +9 -0
- package/svelte/use.js +2 -0
- package/svelte/vestaboard.d.ts +15 -0
- package/svelte/vestaboard.js +2 -0
- package/svelte/wait.d.ts +11 -0
- package/svelte/wait.js +2 -0
- package/vue/DyActionText.vue +44 -0
- package/vue/DyActiveLink.vue +42 -0
- package/vue/DyAlert.vue +44 -0
- package/vue/DyAreaChart.vue +70 -0
- package/vue/DyAvatar.vue +48 -0
- package/vue/DyAvatarGroup.vue +47 -0
- package/vue/DyBadge.vue +42 -0
- package/vue/DyBanner.vue +42 -0
- package/vue/DyBarChart.vue +48 -0
- package/vue/DyBreadcrumbs.vue +45 -0
- package/vue/DyButton.vue +42 -0
- package/vue/DyCalendar.vue +47 -0
- package/vue/DyCard.vue +49 -0
- package/vue/DyCarousel.vue +49 -0
- package/vue/DyCascader.vue +46 -0
- package/vue/DyCascaderPicker.vue +53 -0
- package/vue/DyChartTooltip.vue +42 -0
- package/vue/DyChartZoom.vue +44 -0
- package/vue/DyCheckbox.vue +42 -0
- package/vue/DyCheckboxGroup.vue +42 -0
- package/vue/DyCoachMark.vue +45 -0
- package/vue/DyCodeBlock.vue +42 -0
- package/vue/DyCollapse.vue +42 -0
- package/vue/DyCollapsePanel.vue +42 -0
- package/vue/DyColorPanel.vue +43 -0
- package/vue/DyColorPicker.vue +48 -0
- package/vue/DyCompartment.vue +42 -0
- package/vue/DyContextmenu.vue +42 -0
- package/vue/DyCopy.vue +45 -0
- package/vue/DyCountdown.vue +42 -0
- package/vue/DyDatePanel.vue +46 -0
- package/vue/DyDatePicker.vue +52 -0
- package/vue/DyDateRangePanel.vue +42 -0
- package/vue/DyDateRangePicker.vue +52 -0
- package/vue/DyDivider.vue +42 -0
- package/vue/DyDonutChart.vue +45 -0
- package/vue/DyDrawer.vue +42 -0
- package/vue/DyDropArea.vue +47 -0
- package/vue/DyEmpty.vue +42 -0
- package/vue/DyFilePicker.vue +53 -0
- package/vue/DyForm.vue +66 -0
- package/vue/DyFormItem.vue +85 -0
- package/vue/DyFormItemInlineGroup.vue +42 -0
- package/vue/DyGesture.vue +42 -0
- package/vue/DyGroupedPicker.vue +53 -0
- package/vue/DyHeading.vue +42 -0
- package/vue/DyHelpText.vue +42 -0
- package/vue/DyIcons.vue +42 -0
- package/vue/DyImagePreview.vue +45 -0
- package/vue/DyInput.vue +42 -0
- package/vue/DyInputCapture.vue +42 -0
- package/vue/DyInputGroup.vue +42 -0
- package/vue/DyKeyboardAccess.vue +43 -0
- package/vue/DyLegend.vue +44 -0
- package/vue/DyLetters.vue +42 -0
- package/vue/DyLightRoute.vue +42 -0
- package/vue/DyLineChart.vue +42 -0
- package/vue/DyLink.vue +42 -0
- package/vue/DyList.vue +42 -0
- package/vue/DyLoading.vue +42 -0
- package/vue/DyMeter.vue +49 -0
- package/vue/DyMore.vue +45 -0
- package/vue/DyMoreSlot.vue +42 -0
- package/vue/DyOptions.vue +42 -0
- package/vue/DyPageLoadbar.vue +42 -0
- package/vue/DyPagination.vue +47 -0
- package/vue/DyParagraph.vue +42 -0
- package/vue/DyPatConsole.vue +50 -0
- package/vue/DyPatFilterForm.vue +44 -0
- package/vue/DyPatFooter.vue +47 -0
- package/vue/DyPatForm.vue +44 -0
- package/vue/DyPatNav.vue +46 -0
- package/vue/DyPatTable.vue +56 -0
- package/vue/DyPicker.vue +54 -0
- package/vue/DyPlaceholder.vue +42 -0
- package/vue/DyPopover.vue +53 -0
- package/vue/DyPopoverGhost.vue +42 -0
- package/vue/DyProgress.vue +43 -0
- package/vue/DyRadarChart.vue +47 -0
- package/vue/DyRadio.vue +42 -0
- package/vue/DyRadioGroup.vue +42 -0
- package/vue/DyRate.vue +42 -0
- package/vue/DyReflect.vue +42 -0
- package/vue/DyResult.vue +46 -0
- package/vue/DyRollingNumber.vue +42 -0
- package/vue/DyRoute.vue +42 -0
- package/vue/DySankeyChart.vue +46 -0
- package/vue/DyScatterChart.vue +42 -0
- package/vue/DyScrollBox.vue +42 -0
- package/vue/DySegmented.vue +42 -0
- package/vue/DySelect.vue +67 -0
- package/vue/DySelectionBox.vue +42 -0
- package/vue/DySelectionBoxMask.vue +42 -0
- package/vue/DyShortcutRecord.vue +47 -0
- package/vue/DySideNavigation.vue +43 -0
- package/vue/DySlider.vue +42 -0
- package/vue/DySortBox.vue +42 -0
- package/vue/DySortHandle.vue +42 -0
- package/vue/DySortItem.vue +42 -0
- package/vue/DySpace.vue +42 -0
- package/vue/DyStatistic.vue +50 -0
- package/vue/DyStatusLight.vue +42 -0
- package/vue/DySwitch.vue +42 -0
- package/vue/DyTabPanel.vue +42 -0
- package/vue/DyTable.vue +66 -0
- package/vue/DyTabs.vue +45 -0
- package/vue/DyTag.vue +42 -0
- package/vue/DyTextMask.vue +45 -0
- package/vue/DyTimePanel.vue +43 -0
- package/vue/DyTimePicker.vue +51 -0
- package/vue/DyTimeline.vue +42 -0
- package/vue/DyTitle.vue +42 -0
- package/vue/DyToast.vue +42 -0
- package/vue/DyTooltip.vue +42 -0
- package/vue/DyTree.vue +67 -0
- package/vue/DyUnsafe.vue +42 -0
- package/vue/DyUse.vue +42 -0
- package/vue/DyVestaboard.vue +46 -0
- package/vue/DyWait.vue +42 -0
- package/elements/flow.d.ts +0 -52
- package/elements/flow.d.ts.map +0 -1
- package/elements/flow.js +0 -703
- package/elements/flow.js.map +0 -1
- package/elements/map.d.ts +0 -48
- package/elements/map.d.ts.map +0 -1
- package/elements/map.js +0 -396
- package/elements/map.js.map +0 -1
package/lib/time.js
CHANGED
|
@@ -1,256 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { locale } from './locale';
|
|
3
|
-
const intlDigitFormatter = Intl.DateTimeFormat(undefined, {
|
|
4
|
-
year: 'numeric',
|
|
5
|
-
month: '2-digit',
|
|
6
|
-
day: '2-digit',
|
|
7
|
-
hour: '2-digit',
|
|
8
|
-
minute: '2-digit',
|
|
9
|
-
second: '2-digit',
|
|
10
|
-
hour12: false,
|
|
11
|
-
});
|
|
12
|
-
/**Parse Date/number to object */
|
|
13
|
-
export function parseDate(date) {
|
|
14
|
-
const parts = Number.isNaN(Number(date)) ? [] : intlDigitFormatter.formatToParts(date);
|
|
15
|
-
const dateObj = {};
|
|
16
|
-
parts.forEach(({ type, value }) => (dateObj[type] = value));
|
|
17
|
-
const { year = '', month = '', day = '', hour = '', minute = '', second = '' } = dateObj;
|
|
18
|
-
return { year, month, day, hour, minute, second };
|
|
19
|
-
}
|
|
20
|
-
const Ds = 1000;
|
|
21
|
-
const Dm = Ds * 60;
|
|
22
|
-
const Dh = Dm * 60;
|
|
23
|
-
const Dd = Dh * 24;
|
|
24
|
-
const Dw = Dd * 7;
|
|
25
|
-
const DM = Dd * 31;
|
|
26
|
-
const DY = Dd * 366;
|
|
27
|
-
const durationList = [
|
|
28
|
-
['Y', DY],
|
|
29
|
-
['M', DM],
|
|
30
|
-
['w', Dw],
|
|
31
|
-
['d', Dd],
|
|
32
|
-
['h', Dh],
|
|
33
|
-
['m', Dm],
|
|
34
|
-
['s', Ds],
|
|
35
|
-
];
|
|
36
|
-
const durationMap = Object.fromEntries(durationList);
|
|
37
|
-
const unitMap = {
|
|
38
|
-
Y: 'year',
|
|
39
|
-
M: 'month',
|
|
40
|
-
w: 'week',
|
|
41
|
-
d: 'day',
|
|
42
|
-
h: 'hour',
|
|
43
|
-
m: 'minute',
|
|
44
|
-
s: 'second',
|
|
45
|
-
};
|
|
46
|
-
export function parseNarrowTimeRange(str) {
|
|
47
|
-
if (!str)
|
|
48
|
-
return;
|
|
49
|
-
if (str in unitMap) {
|
|
50
|
-
return [new Time().startOf(str), new Time().endOf(str)];
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
export function parseNarrowRelativeTime(str) {
|
|
54
|
-
if (!str)
|
|
55
|
-
return;
|
|
56
|
-
const r = str.match(/^(?<number>-?\d+)(?<unit>\w)$/);
|
|
57
|
-
if (r?.groups && r.groups.unit in unitMap) {
|
|
58
|
-
const number = Number(r.groups.number);
|
|
59
|
-
const unit = r.groups.unit;
|
|
60
|
-
return new Time().add(number, unit);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function getDuration(unit) {
|
|
64
|
-
switch (unit) {
|
|
65
|
-
case 'h':
|
|
66
|
-
return Dh;
|
|
67
|
-
case 'm':
|
|
68
|
-
return Dm;
|
|
69
|
-
case 's':
|
|
70
|
-
return Ds;
|
|
71
|
-
default:
|
|
72
|
-
return 1;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Provide some convenient operation methods for Date/Time
|
|
77
|
-
*/
|
|
78
|
-
export class Time extends Date {
|
|
79
|
-
static #rtfCache = new Map();
|
|
80
|
-
static #formatReg = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|H{1,2}|m{1,2}|s{1,2}/g;
|
|
81
|
-
get isInvalidTime() {
|
|
82
|
-
return Number.isNaN(this.valueOf());
|
|
83
|
-
}
|
|
84
|
-
formatToParts(opt = { year: 'numeric', month: 'short' }) {
|
|
85
|
-
if (this.isInvalidTime)
|
|
86
|
-
return [];
|
|
87
|
-
return Intl.DateTimeFormat(locale.localeCode, opt).formatToParts(this);
|
|
88
|
-
}
|
|
89
|
-
format(opt = 'YYYY-MM-DD HH:mm:ss') {
|
|
90
|
-
if (typeof opt !== 'string') {
|
|
91
|
-
if (this.isInvalidTime)
|
|
92
|
-
return '';
|
|
93
|
-
return Intl.DateTimeFormat(locale.localeCode, opt).format(this);
|
|
94
|
-
}
|
|
95
|
-
const { year, month, day, hour, minute, second } = parseDate(this);
|
|
96
|
-
const map = {
|
|
97
|
-
YYYY: year,
|
|
98
|
-
MM: month,
|
|
99
|
-
DD: day,
|
|
100
|
-
HH: hour,
|
|
101
|
-
mm: minute,
|
|
102
|
-
ss: second,
|
|
103
|
-
};
|
|
104
|
-
return opt.replace(Time.#formatReg, (match) => map[match]);
|
|
105
|
-
}
|
|
106
|
-
subtract(number, unit) {
|
|
107
|
-
switch (unit) {
|
|
108
|
-
case 'Y':
|
|
109
|
-
this.setFullYear(this.getFullYear() - number);
|
|
110
|
-
break;
|
|
111
|
-
case 'M':
|
|
112
|
-
this.setMonth(this.getMonth() - number);
|
|
113
|
-
break;
|
|
114
|
-
case 'w':
|
|
115
|
-
this.setDate(this.getDate() - 7 * number);
|
|
116
|
-
break;
|
|
117
|
-
case 'd':
|
|
118
|
-
this.setDate(this.getDate() - number);
|
|
119
|
-
break;
|
|
120
|
-
default:
|
|
121
|
-
this.setTime(this.getTime() - number * getDuration(unit));
|
|
122
|
-
}
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
add(number, unit) {
|
|
126
|
-
this.subtract(-number, unit);
|
|
127
|
-
return this;
|
|
128
|
-
}
|
|
129
|
-
startOf(unit) {
|
|
130
|
-
switch (unit) {
|
|
131
|
-
case 'w':
|
|
132
|
-
this.subtract(this.getDay(), 'd').startOf('d');
|
|
133
|
-
break;
|
|
134
|
-
case 'Y':
|
|
135
|
-
this.setMonth(0);
|
|
136
|
-
case 'M':
|
|
137
|
-
this.setDate(1);
|
|
138
|
-
case 'd':
|
|
139
|
-
this.setHours(0);
|
|
140
|
-
case 'h':
|
|
141
|
-
this.setMinutes(0);
|
|
142
|
-
case 'm':
|
|
143
|
-
this.setSeconds(0);
|
|
144
|
-
case 's':
|
|
145
|
-
this.setMilliseconds(0);
|
|
146
|
-
case 'ms':
|
|
147
|
-
}
|
|
148
|
-
return this;
|
|
149
|
-
}
|
|
150
|
-
endOf(unit) {
|
|
151
|
-
this.add(1, unit).startOf(unit).subtract(1, 'ms');
|
|
152
|
-
return this;
|
|
153
|
-
}
|
|
154
|
-
isSame(d, unit) {
|
|
155
|
-
let result = true;
|
|
156
|
-
const targetDate = new Time(d);
|
|
157
|
-
switch (unit) {
|
|
158
|
-
case 'w': {
|
|
159
|
-
const ws = new Time(this).subtract(this.getDay(), 'd').startOf('d');
|
|
160
|
-
return targetDate.getTime() >= ws.getTime() && targetDate.getTime() <= ws.getTime() + 7 * Dd;
|
|
161
|
-
}
|
|
162
|
-
case 'ms':
|
|
163
|
-
return this.getTime() === targetDate.getTime();
|
|
164
|
-
case 's':
|
|
165
|
-
result &&= this.getSeconds() === targetDate.getSeconds();
|
|
166
|
-
case 'm':
|
|
167
|
-
result &&= this.getMinutes() === targetDate.getMinutes();
|
|
168
|
-
case 'h':
|
|
169
|
-
result &&= this.getHours() === targetDate.getHours();
|
|
170
|
-
case 'd':
|
|
171
|
-
result &&= this.getDate() === targetDate.getDate();
|
|
172
|
-
case 'M':
|
|
173
|
-
result &&= this.getMonth() === targetDate.getMonth();
|
|
174
|
-
case 'Y':
|
|
175
|
-
result &&= this.getFullYear() === targetDate.getFullYear();
|
|
176
|
-
}
|
|
177
|
-
return result;
|
|
178
|
-
}
|
|
179
|
-
/**@deprecated */
|
|
180
|
-
isSome = this.isSame;
|
|
181
|
-
diff(d, unit = 'ms') {
|
|
182
|
-
const diff = this.valueOf() - d.valueOf();
|
|
183
|
-
if (unit === 'ms')
|
|
184
|
-
return diff;
|
|
185
|
-
return diff / durationMap[unit];
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* new D().relativeTimeFormat(new D().add(40, 'd'), { unitLimit: 2, lang: 'zh' }) => '40天后'
|
|
189
|
-
*/
|
|
190
|
-
relativeTimeFormat(date, { min = 1, lang = locale.localeCode, rtf = Time.#rtfCache.get(String(lang)) } = {}) {
|
|
191
|
-
if (!rtf) {
|
|
192
|
-
rtf = new Intl.RelativeTimeFormat(lang, { style: 'short', numeric: 'auto' });
|
|
193
|
-
Time.#rtfCache.set(String(lang), rtf);
|
|
194
|
-
}
|
|
195
|
-
const target = new Time(date);
|
|
196
|
-
const diff = target.getTime() - this.getTime();
|
|
197
|
-
for (const [unit, d] of durationList) {
|
|
198
|
-
const n = Math.trunc(diff / d);
|
|
199
|
-
if (Math.abs(n) >= 1 * min) {
|
|
200
|
-
const normalizeDiff = target.startOf(unit).getTime() - new Time(this).startOf(unit).getTime();
|
|
201
|
-
return rtf.format(Math.round(normalizeDiff / d), unitMap[unit]);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return rtf.format(0, 'minute');
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
/**Parse timestamp to Duration object */
|
|
208
|
-
export function parseDuration(ms) {
|
|
209
|
-
if (ms >= DY) {
|
|
210
|
-
return { number: Math.ceil(ms / DY).toString(), unit: locale.year };
|
|
211
|
-
}
|
|
212
|
-
if (ms >= DM) {
|
|
213
|
-
return { number: Math.ceil(ms / DM).toString(), unit: locale.month };
|
|
214
|
-
}
|
|
215
|
-
if (ms >= Dw) {
|
|
216
|
-
return { number: Math.ceil(ms / Dw).toString(), unit: locale.week };
|
|
217
|
-
}
|
|
218
|
-
if (ms >= Dd) {
|
|
219
|
-
return { number: Math.ceil(ms / Dd).toString(), unit: locale.day };
|
|
220
|
-
}
|
|
221
|
-
if (ms >= Dh) {
|
|
222
|
-
return { number: Math.ceil(ms / Dh).toString(), unit: locale.hour };
|
|
223
|
-
}
|
|
224
|
-
if (ms >= Dm) {
|
|
225
|
-
return { number: Math.ceil(ms / Dm).toString(), unit: locale.minute };
|
|
226
|
-
}
|
|
227
|
-
if (ms >= Ds) {
|
|
228
|
-
return { number: Math.ceil(ms / Ds).toString(), unit: locale.second };
|
|
229
|
-
}
|
|
230
|
-
return { number: Math.ceil(ms).toString(), unit: locale.millisecond };
|
|
231
|
-
}
|
|
232
|
-
export function parseDurationToParts(ms, hasDays) {
|
|
233
|
-
const days = hasDays ? Math.floor(ms / Dd) : 0;
|
|
234
|
-
const hours = Math.floor((hasDays ? ms % Dd : ms) / Dh);
|
|
235
|
-
const minutes = Math.floor((ms % Dh) / Dm);
|
|
236
|
-
const seconds = Math.floor((ms % Dm) / Ds);
|
|
237
|
-
const milliseconds = ms % Ds;
|
|
238
|
-
return { days, hours, minutes, seconds, milliseconds };
|
|
239
|
-
}
|
|
240
|
-
export function formatDuration(ms, options = {}) {
|
|
241
|
-
const { numeric, style = 'short', precision } = options;
|
|
242
|
-
const precisionTime = precision && ms > durationMap[precision] ? durationMap[precision] : 1;
|
|
243
|
-
const { days, hours, minutes, seconds, milliseconds } = parseDurationToParts(Math.floor(ms / precisionTime) * precisionTime, !numeric);
|
|
244
|
-
if (numeric) {
|
|
245
|
-
const fill = (n) => n.toString().padStart(2, '0');
|
|
246
|
-
return `${fill(hours)}:${fill(minutes)}:${fill(seconds)}`;
|
|
247
|
-
}
|
|
248
|
-
return new Intl.DurationFormat(locale.localeCode, { style }).format({
|
|
249
|
-
days,
|
|
250
|
-
hours,
|
|
251
|
-
minutes,
|
|
252
|
-
seconds,
|
|
253
|
-
milliseconds,
|
|
254
|
-
});
|
|
255
|
-
}
|
|
1
|
+
export * from '@mantou/tap-ui/lib/time';
|
|
256
2
|
//# sourceMappingURL=time.js.map
|
package/lib/time.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/lib/time.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE;IACxD,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,iCAAiC;AACjC,MAAM,UAAU,SAAS,CAAC,IAAoB;IAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CA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I,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5D,CAAC;IAED,OAAO,IAAK,IAAY,CAAC,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QAC3E,IAAI;QACJ,KAAK;QACL,OAAO;QACP,OAAO;QACP,YAAY;KACb,CAAC,CAAC;AACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/lib/time.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
package/lib/timer.d.ts
CHANGED
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function forever<T>(fn: () => Promise<T>, interval?: number): Promise<T>;
|
|
3
|
-
/**Polling calls until cancel */
|
|
4
|
-
export declare function polling(fn: (args?: any[]) => any, delay: number): (haveNext?: boolean) => void;
|
|
5
|
-
export declare function sleep(ms?: number): Promise<unknown>;
|
|
6
|
-
export declare function nextFrame(): Promise<unknown>;
|
|
7
|
-
export declare function throttle<T extends (...args: any) => any>(fn: T, wait?: number, { leading, maxWait }?: {
|
|
8
|
-
leading?: boolean;
|
|
9
|
-
maxWait?: number;
|
|
10
|
-
}): (...rest: Parameters<T>) => void;
|
|
11
|
-
export declare function debounce<T extends (...args: any) => any>(fn: T, wait?: number, { leading }?: {
|
|
12
|
-
leading?: boolean;
|
|
13
|
-
}): (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
14
|
-
/**Invoke the function by condition */
|
|
15
|
-
export declare function invoke<T extends (...args: any) => any>(fn: T, condition: (options: {
|
|
16
|
-
count: number;
|
|
17
|
-
timestamp: number;
|
|
18
|
-
prevTimestamp: number;
|
|
19
|
-
invokeCount: number;
|
|
20
|
-
invokeTimestamp: number;
|
|
21
|
-
}) => boolean): (...rest: Parameters<T>) => ReturnType<T> | undefined;
|
|
22
|
-
/**Only invoke first */
|
|
23
|
-
export declare function once<T extends (...args: any) => any>(fn: T): T;
|
|
24
|
-
/**Ignore the first invoke */
|
|
25
|
-
export declare function omitOnce<T extends (...args: any) => any>(fn: T): (...rest: Parameters<T>) => ReturnType<T> | undefined;
|
|
1
|
+
export * from '@mantou/tap-ui/lib/timer';
|
|
26
2
|
//# sourceMappingURL=timer.d.ts.map
|
package/lib/timer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../src/lib/timer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../src/lib/timer.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
package/lib/timer.js
CHANGED
|
@@ -1,107 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const setTimeout = globalThis.setTimeout;
|
|
3
|
-
/**Until the callback function resolve */
|
|
4
|
-
export async function forever(fn, interval = 1000) {
|
|
5
|
-
try {
|
|
6
|
-
return await fn();
|
|
7
|
-
}
|
|
8
|
-
catch (err) {
|
|
9
|
-
logger.error(err);
|
|
10
|
-
await sleep(interval);
|
|
11
|
-
return forever(fn, interval);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/**Polling calls until cancel */
|
|
15
|
-
export function polling(fn, delay) {
|
|
16
|
-
let timer = 0;
|
|
17
|
-
let hasExit = false;
|
|
18
|
-
const poll = async () => {
|
|
19
|
-
try {
|
|
20
|
-
await fn();
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
}
|
|
24
|
-
finally {
|
|
25
|
-
if (!hasExit) {
|
|
26
|
-
timer = setTimeout(poll, delay);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
poll();
|
|
31
|
-
return (haveNext = false) => {
|
|
32
|
-
hasExit = true;
|
|
33
|
-
haveNext ? setTimeout(() => clearTimeout(timer), delay) : clearTimeout(timer);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export function sleep(ms = 3000) {
|
|
37
|
-
return new Promise((res) => setTimeout(res, ms));
|
|
38
|
-
}
|
|
39
|
-
export function nextFrame() {
|
|
40
|
-
return new Promise((resolve) => requestAnimationFrame(() => resolve(null)));
|
|
41
|
-
}
|
|
42
|
-
export function throttle(fn, wait = 500, { leading = false, maxWait = Infinity } = {}) {
|
|
43
|
-
let timer = 0;
|
|
44
|
-
let first = 0;
|
|
45
|
-
const exec = (...rest) => {
|
|
46
|
-
timer = setTimeout(() => (timer = 0), wait);
|
|
47
|
-
fn(...rest);
|
|
48
|
-
};
|
|
49
|
-
return (...rest) => {
|
|
50
|
-
const now = Date.now();
|
|
51
|
-
if (!timer)
|
|
52
|
-
first = now;
|
|
53
|
-
if (now - first > maxWait) {
|
|
54
|
-
first = now;
|
|
55
|
-
clearTimeout(timer);
|
|
56
|
-
exec(...rest);
|
|
57
|
-
}
|
|
58
|
-
else if (leading && !timer) {
|
|
59
|
-
exec(...rest);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
clearTimeout(timer);
|
|
63
|
-
timer = setTimeout(() => exec(...rest), wait);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
export function debounce(fn, wait = 500, { leading = false } = {}) {
|
|
68
|
-
let timer = 0;
|
|
69
|
-
return (...args) => new Promise((resolve, reject) => {
|
|
70
|
-
clearTimeout(timer);
|
|
71
|
-
timer = setTimeout(() => {
|
|
72
|
-
timer = setTimeout(() => (timer = 0), wait);
|
|
73
|
-
Promise.resolve(fn(...args))
|
|
74
|
-
.then(resolve)
|
|
75
|
-
.catch(reject);
|
|
76
|
-
}, leading && !timer ? 0 : wait);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**Invoke the function by condition */
|
|
80
|
-
export function invoke(fn, condition) {
|
|
81
|
-
let result;
|
|
82
|
-
let count = 0;
|
|
83
|
-
let invokeCount = 0;
|
|
84
|
-
let timestamp = 0;
|
|
85
|
-
let prevTimestamp = 0;
|
|
86
|
-
let invokeTimestamp = 0;
|
|
87
|
-
return (...rest) => {
|
|
88
|
-
prevTimestamp = timestamp;
|
|
89
|
-
timestamp = performance.now();
|
|
90
|
-
count++;
|
|
91
|
-
if (condition({ count, invokeCount, timestamp, prevTimestamp, invokeTimestamp })) {
|
|
92
|
-
invokeTimestamp = timestamp;
|
|
93
|
-
invokeCount++;
|
|
94
|
-
result = fn(...rest);
|
|
95
|
-
}
|
|
96
|
-
return result;
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
/**Only invoke first */
|
|
100
|
-
export function once(fn) {
|
|
101
|
-
return invoke(fn, ({ count }) => count === 1);
|
|
102
|
-
}
|
|
103
|
-
/**Ignore the first invoke */
|
|
104
|
-
export function omitOnce(fn) {
|
|
105
|
-
return invoke(fn, ({ count }) => count !== 1);
|
|
106
|
-
}
|
|
1
|
+
export * from '@mantou/tap-ui/lib/timer';
|
|
107
2
|
//# sourceMappingURL=timer.js.map
|
package/lib/timer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.js","sourceRoot":"","sources":["../src/lib/timer.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"timer.js","sourceRoot":"","sources":["../src/lib/timer.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type StringList<T> = T | (string & NonNullable<unknown>);
|
|
3
|
-
export type ElementOf<T> = T extends (infer E)[] ? E : never;
|
|
4
|
-
export type ValueOf<T> = T[keyof T];
|
|
5
|
-
export type Modify<T, R> = Omit<T, keyof R> & R;
|
|
6
|
-
export type DeepPartial<T> = {
|
|
7
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
8
|
-
};
|
|
9
|
-
export declare function isNullish<T>(v: T | undefined | null): v is null | undefined;
|
|
10
|
-
export declare function isNotNullish<T>(v: T | undefined | null): v is T;
|
|
11
|
-
export declare function isNotString<T>(v: T | string): v is T;
|
|
12
|
-
export declare function isNotBoolean<T>(v: T | boolean): v is T;
|
|
13
|
-
export declare function isNotNumber<T>(v: T | number): v is T;
|
|
1
|
+
export * from '@mantou/tap-ui/lib/types';
|
|
14
2
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
package/lib/types.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
return v === null || v === undefined;
|
|
3
|
-
}
|
|
4
|
-
// Array.filter type support
|
|
5
|
-
export function isNotNullish(v) {
|
|
6
|
-
return !isNullish(v);
|
|
7
|
-
}
|
|
8
|
-
export function isNotString(v) {
|
|
9
|
-
return typeof v !== 'string';
|
|
10
|
-
}
|
|
11
|
-
export function isNotBoolean(v) {
|
|
12
|
-
return typeof v !== 'boolean';
|
|
13
|
-
}
|
|
14
|
-
export function isNotNumber(v) {
|
|
15
|
-
return typeof v !== 'number';
|
|
16
|
-
}
|
|
1
|
+
export * from '@mantou/tap-ui/lib/types';
|
|
17
2
|
//# sourceMappingURL=types.js.map
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/lib/types.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,81 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Store } from '@mantou/gem/lib/store';
|
|
3
|
-
import type { NonPrimitive } from '@mantou/gem/lib/utils';
|
|
4
|
-
/**Similar `lodash.keyBy` */
|
|
5
|
-
export declare function convertToMap<T extends Record<string, any>, V = T>(list: (T | null)[], key: keyof T): Record<string, V>;
|
|
6
|
-
export declare function convertToMap<T extends Record<string, any>, V = string>(list: (T | null)[], key: keyof T, value: keyof T, fallback?: any): Record<string, V>;
|
|
7
|
-
/**Get Cascader/Tree max deep*/
|
|
8
|
-
export declare function getCascaderDeep<T>(list: T[], cascaderKey: keyof T): number;
|
|
9
|
-
/**
|
|
10
|
-
* Get the value from the bottom layer,
|
|
11
|
-
* compare the new value of the upper layer to choose a new value, bubbling to the top layer
|
|
12
|
-
*/
|
|
13
|
-
export declare function getCascaderBubbleWeakMap<T extends Record<string, any>, F extends (_: T) => any, K = Exclude<ReturnType<F>, undefined | null>>(list: T[] | undefined, cascaderKey: keyof T, getValue: F, comparerFn?: (bottomValue: K, topValue: K) => K, setValueCallback?: (item: T, bubbleValue: K) => void): WeakMap<T, K>;
|
|
14
|
-
/**Simple proxy object, use prop name as a fallback when reading prop */
|
|
15
|
-
export declare function proxyObject(object: Record<string | symbol | number, any>): Record<string | number | symbol, any>;
|
|
16
|
-
type ReadPropOptions = {
|
|
17
|
-
fill?: boolean;
|
|
18
|
-
onlyFillIntermediate?: boolean;
|
|
19
|
-
};
|
|
20
|
-
/**Deep read prop */
|
|
21
|
-
export declare function readProp(obj: Record<string, any>, paths: string | number | symbol | string[], options?: ReadPropOptions): any;
|
|
22
|
-
/**Only let the last add Promise take effect, don’t care about the order of Resolve */
|
|
23
|
-
export declare class OrderlyPromisePool {
|
|
24
|
-
pool: any[];
|
|
25
|
-
add<T>(promise: Promise<T>, callback: (r: T) => void): void;
|
|
26
|
-
}
|
|
27
|
-
export declare enum ComparerType {
|
|
28
|
-
Eq = "eq",
|
|
29
|
-
Gte = "gte",
|
|
30
|
-
Lte = "lte",
|
|
31
|
-
Lt = "lt",
|
|
32
|
-
Gt = "gt",
|
|
33
|
-
Ne = "ne",
|
|
34
|
-
Miss = "miss",
|
|
35
|
-
Have = "have"
|
|
36
|
-
}
|
|
37
|
-
/**Serialize comparer */
|
|
38
|
-
export declare function comparer(a: any, comparerType: ComparerType, b: any): boolean;
|
|
39
|
-
/**Serialized `TemplateResult` return text content */
|
|
40
|
-
export declare function getStringFromTemplate(input: TemplateResult | string): string;
|
|
41
|
-
/**Segmentation search word */
|
|
42
|
-
export declare function splitString(s: string): string[];
|
|
43
|
-
/**Search */
|
|
44
|
-
export declare function isIncludesString(origin: TemplateResult | string, search: string, caseSensitive?: boolean): boolean;
|
|
45
|
-
export type UseCacheStoreOptions<T> = {
|
|
46
|
-
cacheExcludeKeys?: (keyof T)[];
|
|
47
|
-
prefix?: string | (() => string | undefined);
|
|
48
|
-
depStore?: Store<NonPrimitive>;
|
|
49
|
-
};
|
|
50
|
-
/**Create auto cache(localStorage) Store */
|
|
51
|
-
export declare function createCacheStore<T extends Record<string, any>>(storageKey: string, initStore: T, options?: UseCacheStoreOptions<T>): {
|
|
52
|
-
store: ((value?: Partial<T> | undefined) => void) & Omit<{
|
|
53
|
-
name: never;
|
|
54
|
-
apply: never;
|
|
55
|
-
call: never;
|
|
56
|
-
bind: never;
|
|
57
|
-
toString: never;
|
|
58
|
-
prototype: never;
|
|
59
|
-
length: never;
|
|
60
|
-
arguments: never;
|
|
61
|
-
caller: never;
|
|
62
|
-
[Symbol.hasInstance]: never;
|
|
63
|
-
[Symbol.metadata]: never;
|
|
64
|
-
}, keyof T> & T;
|
|
65
|
-
saveStore: () => void;
|
|
66
|
-
};
|
|
67
|
-
export declare function isRemoteIcon(icon: string | Element | DocumentFragment): icon is string;
|
|
68
|
-
/**
|
|
69
|
-
* Pass additional fields
|
|
70
|
-
*
|
|
71
|
-
* not support async function
|
|
72
|
-
*/
|
|
73
|
-
export declare class DyPromise<T, E extends Record<string, unknown>> extends Promise<T> {
|
|
74
|
-
static new<V, U extends Record<string, unknown>>(executor: (resolve: (value: V | PromiseLike<V>) => void, reject: (reason?: any) => void) => void, props: U): DyPromise<V, U> & U;
|
|
75
|
-
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): DyPromise<TResult1 | TResult2, E> & E;
|
|
76
|
-
catch<TResult>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): DyPromise<TResult | T, E> & E;
|
|
77
|
-
finally(onfinally?: (() => void) | null | undefined): DyPromise<T, E> & E;
|
|
78
|
-
}
|
|
79
|
-
export declare const ignoredPromiseReasonSet: WeakSet<WeakKey>;
|
|
80
|
-
export {};
|
|
1
|
+
export * from '@mantou/tap-ui/lib/utils';
|
|
81
2
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/lib/utils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/lib/utils.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|