hys-ui 0.6.0 → 0.8.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/CHANGELOG.md +15 -0
- package/LICENSE +19 -0
- package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
- package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1055 -753
- package/dist/components/HysDataGrid/gridColumnLayout.js +46 -0
- package/dist/components/HysDataGrid/gridPresentation.js +17 -0
- package/dist/components/HysDataGrid/useGridContextMenu.js +33 -0
- package/dist/components/HysDatePicker/HysDatePicker.vue.js +102 -48
- package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
- package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +874 -532
- package/dist/components/HysDatePicker/HysDatePickerPanel.vue.js +2 -2
- package/dist/components/HysDatePicker/HysDatePickerPanel2.vue.js +209 -168
- package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +102 -48
- package/dist/components/HysDescriptions/HysDescriptions.vue.js +7 -0
- package/dist/components/HysDescriptions/HysDescriptions2.vue.js +146 -0
- package/dist/components/HysForm/HysForm2.vue.js +9 -8
- package/dist/components/HysIcon/HysIcon.vue.js +373 -0
- package/dist/components/HysIcon/HysIcon2.vue.js +5 -0
- package/dist/components/HysIcon/IconGraphic/IconGraphic.vue.js +147 -0
- package/dist/components/HysIcon/IconGraphic/IconGraphic2.vue.js +4 -0
- package/dist/components/HysIcon/IconPickerPanel/IconPickerPanel.vue.js +7 -0
- package/dist/components/HysIcon/IconPickerPanel/IconPickerPanel2.vue.js +440 -0
- package/dist/components/HysIcon/IconReferenceGraphic/IconReferenceGraphic.vue.js +29 -0
- package/dist/components/HysIcon/IconReferenceGraphic/IconReferenceGraphic2.vue.js +4 -0
- package/dist/components/HysIcon/IconTooltip/IconTooltip.vue.js +19 -0
- package/dist/components/HysIcon/IconTooltip/IconTooltip2.vue.js +4 -0
- package/dist/components/HysIcon/builtins/access.js +180 -0
- package/dist/components/HysIcon/builtins/actions.js +327 -0
- package/dist/components/HysIcon/builtins/business.js +364 -0
- package/dist/components/HysIcon/builtins/catalog/access-1.json.js +51 -0
- package/dist/components/HysIcon/builtins/catalog/access-2.json.js +35 -0
- package/dist/components/HysIcon/builtins/catalog/accessibility.json.js +26 -0
- package/dist/components/HysIcon/builtins/catalog/arrows-1.json.js +45 -0
- package/dist/components/HysIcon/builtins/catalog/arrows-2.json.js +46 -0
- package/dist/components/HysIcon/builtins/catalog/arrows-3.json.js +42 -0
- package/dist/components/HysIcon/builtins/catalog/charts-1.json.js +50 -0
- package/dist/components/HysIcon/builtins/catalog/charts-2.json.js +13 -0
- package/dist/components/HysIcon/builtins/catalog/commerce.json.js +43 -0
- package/dist/components/HysIcon/builtins/catalog/communication-1.json.js +49 -0
- package/dist/components/HysIcon/builtins/catalog/communication-2.json.js +37 -0
- package/dist/components/HysIcon/builtins/catalog/design-1.json.js +61 -0
- package/dist/components/HysIcon/builtins/catalog/design-2.json.js +27 -0
- package/dist/components/HysIcon/builtins/catalog/development-1.json.js +58 -0
- package/dist/components/HysIcon/builtins/catalog/development-2.json.js +60 -0
- package/dist/components/HysIcon/builtins/catalog/development-3.json.js +25 -0
- package/dist/components/HysIcon/builtins/catalog/devices-1.json.js +52 -0
- package/dist/components/HysIcon/builtins/catalog/devices-2.json.js +55 -0
- package/dist/components/HysIcon/builtins/catalog/devices-3.json.js +23 -0
- package/dist/components/HysIcon/builtins/catalog/education.json.js +34 -0
- package/dist/components/HysIcon/builtins/catalog/emoji.json.js +24 -0
- package/dist/components/HysIcon/builtins/catalog/files-1.json.js +45 -0
- package/dist/components/HysIcon/builtins/catalog/files-2.json.js +47 -0
- package/dist/components/HysIcon/builtins/catalog/files-3.json.js +8 -0
- package/dist/components/HysIcon/builtins/catalog/food-1.json.js +67 -0
- package/dist/components/HysIcon/builtins/catalog/food-2.json.js +40 -0
- package/dist/components/HysIcon/builtins/catalog/home.json.js +36 -0
- package/dist/components/HysIcon/builtins/catalog/layout-1.json.js +46 -0
- package/dist/components/HysIcon/builtins/catalog/layout-2.json.js +45 -0
- package/dist/components/HysIcon/builtins/catalog/manifest.json.js +4 -0
- package/dist/components/HysIcon/builtins/catalog/maps-1.json.js +61 -0
- package/dist/components/HysIcon/builtins/catalog/maps-2.json.js +24 -0
- package/dist/components/HysIcon/builtins/catalog/media-1.json.js +57 -0
- package/dist/components/HysIcon/builtins/catalog/media-2.json.js +13 -0
- package/dist/components/HysIcon/builtins/catalog/medical.json.js +30 -0
- package/dist/components/HysIcon/builtins/catalog/nature.json.js +54 -0
- package/dist/components/HysIcon/builtins/catalog/recreation.json.js +51 -0
- package/dist/components/HysIcon/builtins/catalog/shapes.json.js +54 -0
- package/dist/components/HysIcon/builtins/catalog/text-1.json.js +52 -0
- package/dist/components/HysIcon/builtins/catalog/text-2.json.js +54 -0
- package/dist/components/HysIcon/builtins/catalog/text-3.json.js +58 -0
- package/dist/components/HysIcon/builtins/catalog/text-4.json.js +41 -0
- package/dist/components/HysIcon/builtins/catalog/time.json.js +39 -0
- package/dist/components/HysIcon/builtins/catalog/transport-1.json.js +57 -0
- package/dist/components/HysIcon/builtins/catalog/transport-2.json.js +7 -0
- package/dist/components/HysIcon/builtins/catalog/weather.json.js +46 -0
- package/dist/components/HysIcon/builtins/communication.js +314 -0
- package/dist/components/HysIcon/builtins/documents.js +315 -0
- package/dist/components/HysIcon/builtins/extendedCatalog.js +75 -0
- package/dist/components/HysIcon/builtins/iconInCategory.js +11 -0
- package/dist/components/HysIcon/builtins/media.js +255 -0
- package/dist/components/HysIcon/builtins/navigation.js +276 -0
- package/dist/components/HysIcon/builtins/technology.js +189 -0
- package/dist/components/HysIcon/iconBuiltins.js +228 -0
- package/dist/components/HysIcon/iconConfig.js +30 -0
- package/dist/components/HysIcon/iconRegistry.js +183 -0
- package/dist/components/HysIcon/iconSafety.js +191 -0
- package/dist/components/HysIcon/iconStyle.js +70 -0
- package/dist/components/HysIcon/useIconResource.js +75 -0
- package/dist/components/HysPopconfirm/HysPopconfirm.vue.js +7 -0
- package/dist/components/HysPopconfirm/HysPopconfirm2.vue.js +346 -0
- package/dist/components/HysPopconfirm/usePopconfirmAction.js +32 -0
- package/dist/components/HysResult/HysResult.vue.js +7 -0
- package/dist/components/HysResult/HysResult2.vue.js +124 -0
- package/dist/components/HysSpace/HysSpace.vue.js +7 -0
- package/dist/components/HysSpace/HysSpace2.vue.js +79 -0
- package/dist/components/HysSpace/spaceItems.js +17 -0
- package/dist/components/HysSpin/HysSpin.vue.js +7 -0
- package/dist/components/HysSpin/HysSpin2.vue.js +427 -0
- package/dist/components/HysSpin/SpinGlyph/SpinGlyph.vue.js +334 -0
- package/dist/components/HysSpin/SpinGlyph/SpinGlyph2.vue.js +5 -0
- package/dist/components/HysSpin/SpinPortal/SpinPortal.vue.js +7 -0
- package/dist/components/HysSpin/SpinPortal/SpinPortal2.vue.js +66 -0
- package/dist/components/HysSpin/SpinPortal/spinTarget.js +57 -0
- package/dist/components/HysSpin/spinCatalog.js +35 -0
- package/dist/components/HysSpin/spinConfig.js +32 -0
- package/dist/components/HysSpin/spinService.js +160 -0
- package/dist/components/HysSpin/spinStyle.js +39 -0
- package/dist/components/HysSpin/useHysSpinTask.js +92 -0
- package/dist/components/HysSpin/useSpinFullscreen.js +60 -0
- package/dist/components/HysSpin/useSpinVisibility.js +59 -0
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +285 -204
- package/dist/components/HysSplitPane/splitPaneResize.js +75 -0
- package/dist/components/HysTabPane/HysTabPane.vue.js +49 -0
- package/dist/components/HysTabPane/HysTabPane2.vue.js +4 -0
- package/dist/components/HysTable/HysTable.vue.js +3 -3
- package/dist/components/HysTable/HysTable2.vue.js +412 -383
- package/dist/components/HysTable/tableSearch.js +24 -0
- package/dist/components/HysTabs/HysTabs.vue.js +172 -5
- package/dist/components/HysTabs/HysTabs2.vue.js +2 -275
- package/dist/components/HysTabs/TabsMore/TabsMore.vue.js +7 -0
- package/dist/components/HysTabs/TabsMore/TabsMore2.vue.js +133 -0
- package/dist/components/HysTabs/TabsPanels/TabsPanels.vue.js +161 -0
- package/dist/components/HysTabs/TabsPanels/TabsPanels2.vue.js +4 -0
- package/dist/components/HysTabs/TabsPrompts/TabsPrompts.vue.js +4 -0
- package/dist/components/HysTabs/TabsPrompts/TabsPrompts2.vue.js +88 -0
- package/dist/components/HysTabs/TabsSlot/TabsSlot.js +13 -0
- package/dist/components/HysTabs/TabsWorkbench/TabsWorkbench.vue.js +7 -0
- package/dist/components/HysTabs/TabsWorkbench/TabsWorkbench2.vue.js +687 -0
- package/dist/components/HysTabs/tabsConfig.js +35 -0
- package/dist/components/HysTabs/tabsItems.js +79 -0
- package/dist/components/HysTabs/tabsPersistence.js +118 -0
- package/dist/components/HysTabs/useHysRouteTabs.js +77 -0
- package/dist/components/HysTabs/useTabsDragGhost.js +47 -0
- package/dist/components/HysTabs/useTabsNav.js +127 -0
- package/dist/components/HysTabs/useTabsOverlays.js +52 -0
- package/dist/components/HysTabs/useTabsPanels.js +101 -0
- package/dist/components/HysTabs/useTabsPointer.js +131 -0
- package/dist/components/HysTabs/useTabsState.js +263 -0
- package/dist/composables/datePicker.js +153 -94
- package/dist/composables/datePickerModel.js +156 -0
- package/dist/composables/datePickerPanels.js +78 -0
- package/dist/composables/datePickerRules.js +166 -0
- package/dist/composables/floatingPosition.js +32 -13
- package/dist/composables/formLayout.js +20 -42
- package/dist/composables/popupSurfaceStyle.js +30 -0
- package/dist/composables/useContainerWidth.js +24 -0
- package/dist/composables/useDatePicker.js +274 -381
- package/dist/composables/useFloating.js +42 -41
- package/dist/composables/usePageVisibility.js +19 -0
- package/dist/composables/usePopupSurface.js +153 -162
- package/dist/composables/usePopupSurfaceInteractions.js +91 -90
- package/dist/composables/useSplitPaneDrag.js +29 -26
- package/dist/composables/useSvgInstanceId.js +15 -0
- package/dist/composables/useTable.js +321 -306
- package/dist/composables/useTabularRowNavigation.js +46 -0
- package/dist/index.js +229 -185
- package/dist/internal/MultiSplitPane.vue.js +246 -205
- package/dist/internal/PopupSurfacePanel.vue.js +2 -2
- package/dist/internal/PopupSurfacePanel2.vue.js +35 -30
- package/dist/style.css +1 -1
- package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +40 -2
- package/dist/types/components/HysDataGrid/gridColumnLayout.d.ts +22 -0
- package/dist/types/components/HysDataGrid/gridPresentation.d.ts +47 -0
- package/dist/types/components/HysDataGrid/useGridContextMenu.d.ts +14 -0
- package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +6 -9
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +12 -0
- package/dist/types/components/HysDatePicker/HysDatePickerPanel.vue.d.ts +6 -0
- package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +6 -9
- package/dist/types/components/HysDescriptions/HysDescriptions.vue.d.ts +20 -0
- package/dist/types/components/HysDescriptions/descriptionsTypes.d.ts +54 -0
- package/dist/types/components/HysForm/HysForm.vue.d.ts +1 -1
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
- package/dist/types/components/HysIcon/HysIcon.vue.d.ts +76 -0
- package/dist/types/components/HysIcon/IconGraphic/IconGraphic.vue.d.ts +43 -0
- package/dist/types/components/HysIcon/IconPickerPanel/IconPickerPanel.vue.d.ts +17 -0
- package/dist/types/components/HysIcon/IconReferenceGraphic/IconReferenceGraphic.vue.d.ts +10 -0
- package/dist/types/components/HysIcon/IconTooltip/IconTooltip.vue.d.ts +11 -0
- package/dist/types/components/HysIcon/builtins/access.d.ts +15 -0
- package/dist/types/components/HysIcon/builtins/actions.d.ts +30 -0
- package/dist/types/components/HysIcon/builtins/business.d.ts +31 -0
- package/dist/types/components/HysIcon/builtins/communication.d.ts +27 -0
- package/dist/types/components/HysIcon/builtins/documents.d.ts +29 -0
- package/dist/types/components/HysIcon/builtins/extendedCatalog.d.ts +2 -0
- package/dist/types/components/HysIcon/builtins/iconInCategory.d.ts +2 -0
- package/dist/types/components/HysIcon/builtins/media.d.ts +24 -0
- package/dist/types/components/HysIcon/builtins/navigation.d.ts +30 -0
- package/dist/types/components/HysIcon/builtins/technology.d.ts +18 -0
- package/dist/types/components/HysIcon/iconBuiltins.d.ts +2 -0
- package/dist/types/components/HysIcon/iconConfig.d.ts +10 -0
- package/dist/types/components/HysIcon/iconRegistry.d.ts +5 -0
- package/dist/types/components/HysIcon/iconSafety.d.ts +8 -0
- package/dist/types/components/HysIcon/iconStyle.d.ts +6 -0
- package/dist/types/components/HysIcon/iconTypes.d.ts +192 -0
- package/dist/types/components/HysIcon/useIconResource.d.ts +14 -0
- package/dist/types/components/HysPopconfirm/HysPopconfirm.vue.d.ts +85 -0
- package/dist/types/components/HysPopconfirm/popconfirmTypes.d.ts +72 -0
- package/dist/types/components/HysPopconfirm/usePopconfirmAction.d.ts +6 -0
- package/dist/types/components/HysProgress/HysProgress.vue.d.ts +1 -1
- package/dist/types/components/HysResult/HysResult.vue.d.ts +22 -0
- package/dist/types/components/HysResult/resultTypes.d.ts +32 -0
- package/dist/types/components/HysSpace/HysSpace.vue.d.ts +15 -0
- package/dist/types/components/HysSpace/spaceItems.d.ts +9 -0
- package/dist/types/components/HysSpace/spaceTypes.d.ts +20 -0
- package/dist/types/components/HysSpin/HysSpin.vue.d.ts +84 -0
- package/dist/types/components/HysSpin/SpinGlyph/SpinGlyph.vue.d.ts +16 -0
- package/dist/types/components/HysSpin/SpinPortal/SpinPortal.vue.d.ts +21 -0
- package/dist/types/components/HysSpin/SpinPortal/spinTarget.d.ts +3 -0
- package/dist/types/components/HysSpin/spinCatalog.d.ts +122 -0
- package/dist/types/components/HysSpin/spinConfig.d.ts +10 -0
- package/dist/types/components/HysSpin/spinService.d.ts +7 -0
- package/dist/types/components/HysSpin/spinStyle.d.ts +5 -0
- package/dist/types/components/HysSpin/spinTypes.d.ts +133 -0
- package/dist/types/components/HysSpin/useHysSpinTask.d.ts +4 -0
- package/dist/types/components/HysSpin/useSpinFullscreen.d.ts +17 -0
- package/dist/types/components/HysSpin/useSpinVisibility.d.ts +10 -0
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +25 -2
- package/dist/types/components/HysSplitPane/splitPaneResize.d.ts +17 -0
- package/dist/types/components/HysTabPane/HysTabPane.vue.d.ts +11 -0
- package/dist/types/components/HysTable/HysTable.vue.d.ts +16 -10
- package/dist/types/components/HysTable/tableSearch.d.ts +2 -0
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +83 -74
- package/dist/types/components/HysTabs/TabsMore/TabsMore.vue.d.ts +14 -0
- package/dist/types/components/HysTabs/TabsPanels/TabsPanels.vue.d.ts +17 -0
- package/dist/types/components/HysTabs/TabsPrompts/TabsPrompts.vue.d.ts +7 -0
- package/dist/types/components/HysTabs/TabsSlot/TabsSlot.d.ts +9 -0
- package/dist/types/components/HysTabs/TabsWorkbench/TabsWorkbench.vue.d.ts +32 -0
- package/dist/types/components/HysTabs/tabsConfig.d.ts +4 -0
- package/dist/types/components/HysTabs/tabsItems.d.ts +14 -0
- package/dist/types/components/HysTabs/tabsPersistence.d.ts +6 -0
- package/dist/types/components/HysTabs/tabsTypes.d.ts +236 -0
- package/dist/types/components/HysTabs/useHysRouteTabs.d.ts +22 -0
- package/dist/types/components/HysTabs/useTabsDragGhost.d.ts +22 -0
- package/dist/types/components/HysTabs/useTabsNav.d.ts +20 -0
- package/dist/types/components/HysTabs/useTabsOverlays.d.ts +54 -0
- package/dist/types/components/HysTabs/useTabsPanels.d.ts +14 -0
- package/dist/types/components/HysTabs/useTabsPointer.d.ts +30 -0
- package/dist/types/components/HysTabs/useTabsState.d.ts +32 -0
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +2 -2
- package/dist/types/components/HysToast/toastPresentation.d.ts +1 -1
- package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +2 -2
- package/dist/types/composables/dataGrid.d.ts +34 -0
- package/dist/types/composables/datePicker.d.ts +14 -214
- package/dist/types/composables/datePickerModel.d.ts +63 -0
- package/dist/types/composables/datePickerPanels.d.ts +23 -0
- package/dist/types/composables/datePickerRules.d.ts +31 -0
- package/dist/types/composables/datePickerTypes.d.ts +277 -0
- package/dist/types/composables/floatingPosition.d.ts +1 -1
- package/dist/types/composables/formLayout.d.ts +1 -2
- package/dist/types/composables/popupSurfaceStyle.d.ts +7 -0
- package/dist/types/composables/table.d.ts +10 -1
- package/dist/types/composables/toastQueue.d.ts +4 -4
- package/dist/types/composables/toastQueueModel.d.ts +2 -2
- package/dist/types/composables/useColorPicker.d.ts +2 -4
- package/dist/types/composables/useContainerWidth.d.ts +2 -0
- package/dist/types/composables/useContextMenu.d.ts +2 -4
- package/dist/types/composables/useDatePicker.d.ts +20 -11
- package/dist/types/composables/useFloating.d.ts +4 -5
- package/dist/types/composables/usePageVisibility.d.ts +1 -0
- package/dist/types/composables/usePopupSurface.d.ts +9 -3
- package/dist/types/composables/usePopupSurfaceInteractions.d.ts +4 -2
- package/dist/types/composables/useSplitPaneDrag.d.ts +2 -2
- package/dist/types/composables/useSvgInstanceId.d.ts +1 -0
- package/dist/types/composables/useTable.d.ts +2 -0
- package/dist/types/composables/useTabularRowNavigation.d.ts +18 -0
- package/dist/types/index.d.ts +31 -3
- package/dist/types/internal/MultiSplitPane.vue.d.ts +10 -1
- package/dist/types/internal/PopupSurfacePanel.vue.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { calendarDate as
|
|
2
|
-
const
|
|
1
|
+
import { calendarDate as F, calendarParts as M, calendarISO as x, civilDay as u, calendarDay as Q, calendarShift as v } from "./calendar.js";
|
|
2
|
+
const I = {
|
|
3
3
|
open: void 0,
|
|
4
4
|
showConfirm: void 0,
|
|
5
5
|
type: "date",
|
|
6
6
|
clearable: !1,
|
|
7
|
+
allowClear: void 0,
|
|
8
|
+
automaticDropdown: void 0,
|
|
9
|
+
showWeekNumber: void 0,
|
|
10
|
+
use12Hours: void 0,
|
|
11
|
+
hideDisabledOptions: void 0,
|
|
12
|
+
teleported: void 0,
|
|
7
13
|
editable: !1,
|
|
8
14
|
bordered: !0,
|
|
9
15
|
firstDayOfWeek: 1,
|
|
@@ -21,7 +27,7 @@ const P = {
|
|
|
21
27
|
rangeValidation: "endpoints",
|
|
22
28
|
validateEvent: !0,
|
|
23
29
|
appendTo: "body"
|
|
24
|
-
},
|
|
30
|
+
}, q = {
|
|
25
31
|
today: "今天",
|
|
26
32
|
now: "此刻",
|
|
27
33
|
clear: "清空",
|
|
@@ -46,7 +52,7 @@ const P = {
|
|
|
46
52
|
second: "秒",
|
|
47
53
|
empty: "选择日期",
|
|
48
54
|
limit: "最多选择 {count} 项"
|
|
49
|
-
},
|
|
55
|
+
}, z = {
|
|
50
56
|
today: "Today",
|
|
51
57
|
now: "Now",
|
|
52
58
|
clear: "Clear",
|
|
@@ -71,117 +77,168 @@ const P = {
|
|
|
71
77
|
second: "Second",
|
|
72
78
|
empty: "Choose a date",
|
|
73
79
|
limit: "Select up to {count} items"
|
|
74
|
-
},
|
|
75
|
-
function
|
|
76
|
-
|
|
80
|
+
}, W = u(1, 0, 1), p = u(9999, 11, 31), _ = (e) => !!(e != null && e.endsWith("range"));
|
|
81
|
+
function A(e) {
|
|
82
|
+
const t = e == null ? void 0 : e.replace(/range$/, "").replace(/s$/, "");
|
|
83
|
+
return t === "week" || t === "month" || t === "quarter" || t === "year" ? t : "date";
|
|
77
84
|
}
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
const j = (e) => ["dates", "weeks", "months", "quarters", "years"].includes(e ?? "");
|
|
86
|
+
function R(e, t = !1) {
|
|
87
|
+
return t ? "YYYY-MM-DD HH:mm:ss" : A(e) === "year" ? "YYYY" : A(e) === "month" ? "YYYY-MM" : A(e) === "quarter" ? "YYYY-[Q]Q" : "YYYY-MM-DD";
|
|
88
|
+
}
|
|
89
|
+
function X(e, t, d = 1) {
|
|
90
|
+
const a = M(e);
|
|
80
91
|
if (t === "year")
|
|
81
|
-
return [
|
|
92
|
+
return [u(a.year, 0, 1), u(a.year, 11, 31)];
|
|
82
93
|
if (t === "quarter") {
|
|
83
|
-
const
|
|
84
|
-
return [
|
|
94
|
+
const s = Math.floor(a.month / 3) * 3;
|
|
95
|
+
return [u(a.year, s, 1), u(a.year, s + 3, 0)];
|
|
85
96
|
}
|
|
86
97
|
if (t === "month")
|
|
87
|
-
return [
|
|
98
|
+
return [u(a.year, a.month, 1), u(a.year, a.month + 1, 0)];
|
|
88
99
|
if (t === "week") {
|
|
89
|
-
const
|
|
90
|
-
return [Math.max(
|
|
100
|
+
const s = e - (a.weekday - d + 7) % 7;
|
|
101
|
+
return [Math.max(W, s), Math.min(p, s + 6)];
|
|
91
102
|
}
|
|
92
103
|
return [e, e];
|
|
93
104
|
}
|
|
94
|
-
function
|
|
105
|
+
function K(e) {
|
|
106
|
+
if (e instanceof Date)
|
|
107
|
+
return Number.isFinite(e.getTime()) ? e.getHours() * 3600 + e.getMinutes() * 60 + e.getSeconds() : 0;
|
|
95
108
|
const t = /^(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(e ?? "");
|
|
96
109
|
return t && +t[1] < 24 && +t[2] < 60 && +(t[3] ?? 0) < 60 ? +t[1] * 3600 + +t[2] * 60 + +(t[3] ?? 0) : 0;
|
|
97
110
|
}
|
|
98
|
-
const
|
|
99
|
-
function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
111
|
+
const H = /\[[^\]]*\]|YYYY|GGGG|MMMM|MMM|MM|dddd|ddd|dd|DD|HH|hh|mm|ss|WW|M|D|H|h|m|s|Q|A|a/g, T = ["MMM", "MMMM", "dd", "ddd", "dddd"], S = /* @__PURE__ */ new Map();
|
|
112
|
+
function k(e) {
|
|
113
|
+
const t = S.get(e);
|
|
114
|
+
if (t) return t;
|
|
115
|
+
function d(s, r, i = !1) {
|
|
116
|
+
let c;
|
|
117
|
+
try {
|
|
118
|
+
c = new Intl.DateTimeFormat(e, s);
|
|
119
|
+
} catch {
|
|
120
|
+
c = new Intl.DateTimeFormat("en", s);
|
|
121
|
+
}
|
|
122
|
+
return Array.from(
|
|
123
|
+
{ length: r },
|
|
124
|
+
(m, h) => c.format(new Date(2026, i ? h : 0, i ? 1 : 4 + h))
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
const a = {
|
|
128
|
+
MMM: d({ month: "short" }, 12, !0),
|
|
129
|
+
MMMM: d({ month: "long" }, 12, !0),
|
|
130
|
+
dd: d({ weekday: "narrow" }, 7),
|
|
131
|
+
ddd: d({ weekday: "short" }, 7),
|
|
132
|
+
dddd: d({ weekday: "long" }, 7)
|
|
133
|
+
};
|
|
134
|
+
return S.size >= 16 && S.clear(), S.set(e, a), a;
|
|
135
|
+
}
|
|
136
|
+
function P(e, t = 1, d = 4) {
|
|
137
|
+
t = Number.isFinite(t) ? (Math.trunc(t) % 7 + 7) % 7 : 1, d = Number.isFinite(d) ? Math.max(1, Math.min(7, Math.trunc(d))) : 4;
|
|
138
|
+
const a = (m) => {
|
|
139
|
+
const h = u(m, 0, d);
|
|
140
|
+
return h - (M(h).weekday - t + 7) % 7;
|
|
141
|
+
}, s = e - (M(e).weekday - t + 7) % 7;
|
|
142
|
+
let r = M(e).year;
|
|
143
|
+
s < a(r) ? r-- : s >= a(r + 1) && r++;
|
|
144
|
+
const i = Math.max(W, s), c = Math.min(p, s + 6);
|
|
108
145
|
return {
|
|
109
|
-
year:
|
|
110
|
-
week: Math.floor((
|
|
111
|
-
start:
|
|
112
|
-
end:
|
|
146
|
+
year: r,
|
|
147
|
+
week: Math.floor((s - a(r)) / 7) + 1,
|
|
148
|
+
start: x(i),
|
|
149
|
+
end: x(c),
|
|
113
150
|
dates: Array.from(
|
|
114
|
-
{ length: Math.max(0, c -
|
|
115
|
-
(
|
|
151
|
+
{ length: Math.max(0, c - i + 1) },
|
|
152
|
+
(m, h) => x(i + h)
|
|
116
153
|
)
|
|
117
154
|
};
|
|
118
155
|
}
|
|
119
|
-
function
|
|
120
|
-
const r =
|
|
156
|
+
function L(e, t, d = 1, a = 4, s = "en") {
|
|
157
|
+
const r = M(e.day), i = P(e.day, d, a), c = Math.floor(e.second / 3600), m = Math.floor(e.second / 60) % 60, h = e.second % 60, Y = {
|
|
121
158
|
YYYY: String(r.year).padStart(4, "0"),
|
|
122
|
-
GGGG: String(
|
|
159
|
+
GGGG: String(i.year).padStart(4, "0"),
|
|
123
160
|
MM: String(r.month + 1).padStart(2, "0"),
|
|
124
161
|
DD: String(r.day).padStart(2, "0"),
|
|
125
162
|
HH: String(Math.floor(e.second / 3600)).padStart(2, "0"),
|
|
126
163
|
mm: String(Math.floor(e.second / 60) % 60).padStart(2, "0"),
|
|
127
164
|
ss: String(e.second % 60).padStart(2, "0"),
|
|
128
|
-
WW: String(
|
|
129
|
-
Q: String(Math.floor(r.month / 3) + 1)
|
|
165
|
+
WW: String(i.week).padStart(2, "0"),
|
|
166
|
+
Q: String(Math.floor(r.month / 3) + 1),
|
|
167
|
+
M: String(r.month + 1),
|
|
168
|
+
D: String(r.day),
|
|
169
|
+
H: String(c),
|
|
170
|
+
h: String(c % 12 || 12),
|
|
171
|
+
hh: String(c % 12 || 12).padStart(2, "0"),
|
|
172
|
+
m: String(m),
|
|
173
|
+
s: String(h),
|
|
174
|
+
A: c < 12 ? "AM" : "PM",
|
|
175
|
+
a: c < 12 ? "am" : "pm"
|
|
130
176
|
};
|
|
131
177
|
return t.replace(
|
|
132
|
-
|
|
133
|
-
(
|
|
178
|
+
H,
|
|
179
|
+
(f) => f.startsWith("[") ? f.slice(1, -1) : T.includes(f) ? k(s)[f][f.startsWith("M") ? r.month : r.weekday] : Y[f]
|
|
134
180
|
);
|
|
135
181
|
}
|
|
136
|
-
function E(e, t = "YYYY-MM-DD",
|
|
182
|
+
function E(e, t = "YYYY-MM-DD", d = 1, a = 4, s = "en") {
|
|
137
183
|
if (e instanceof Date || typeof e == "number") {
|
|
138
|
-
const
|
|
139
|
-
if (!Number.isFinite(
|
|
140
|
-
const
|
|
141
|
-
return
|
|
142
|
-
day:
|
|
143
|
-
second:
|
|
184
|
+
const n = e instanceof Date ? e : new Date(e);
|
|
185
|
+
if (!Number.isFinite(n.getTime())) return;
|
|
186
|
+
const o = Q(n);
|
|
187
|
+
return o === void 0 ? void 0 : {
|
|
188
|
+
day: o,
|
|
189
|
+
second: n.getHours() * 3600 + n.getMinutes() * 60 + n.getSeconds()
|
|
144
190
|
};
|
|
145
191
|
}
|
|
146
192
|
if (typeof e != "string" || !e.trim()) return;
|
|
147
193
|
if (t === "x" || t === "X")
|
|
148
194
|
return /^-?\d+(?:\.\d+)?$/.test(e) ? E(Number(e) * (t === "X" ? 1e3 : 1)) : void 0;
|
|
149
|
-
const r = {},
|
|
150
|
-
let
|
|
151
|
-
for (const
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
195
|
+
const r = {}, i = [];
|
|
196
|
+
let c = 0, m = "";
|
|
197
|
+
for (const n of t.matchAll(H)) {
|
|
198
|
+
m += D(t.slice(c, n.index));
|
|
199
|
+
const o = n[0];
|
|
200
|
+
o.startsWith("[") ? m += D(o.slice(1, -1)) : (i.push(o), m += T.includes(o) ? "(" + k(s)[o].map(D).join("|") + ")" : o === "A" || o === "a" ? "(AM|PM|am|pm)" : o === "Q" ? "(\\d)" : o === "YYYY" || o === "GGGG" ? "(\\d{4})" : o.length === 1 ? "(\\d{1,2})" : "(\\d{2})"), c = n.index + o.length;
|
|
155
201
|
}
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
202
|
+
m += D(t.slice(c));
|
|
203
|
+
const h = new RegExp("^" + m + "$").exec(e.trim());
|
|
204
|
+
if (!h || !i.some((n) => n === "YYYY" || n === "GGGG") || new Set(i).size !== i.length)
|
|
159
205
|
return;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
206
|
+
i.forEach((n, o) => {
|
|
207
|
+
n === "MMM" || n === "MMMM" ? r[n] = k(s)[n].indexOf(h[o + 1]) + 1 : n.startsWith("d") || (r[n] = n === "A" || n === "a" ? +(h[o + 1].toLowerCase() === "pm") : +h[o + 1]);
|
|
208
|
+
});
|
|
209
|
+
const Y = r.hh ?? r.h, f = r.A ?? r.a;
|
|
210
|
+
if (Y !== void 0 && (Y < 1 || Y > 12)) return;
|
|
211
|
+
const y = r.YYYY ?? r.GGGG, g = r.MM ?? r.M ?? r.MMM ?? r.MMMM ?? (r.Q ? (r.Q - 1) * 3 + 1 : 1), w = r.DD ?? r.D ?? 1, G = Y === void 0 ? r.HH ?? r.H ?? 0 : Y % 12 + (f ?? 0) * 12, N = r.mm ?? r.m ?? 0, C = r.ss ?? r.s ?? 0;
|
|
212
|
+
if (y < 1 || y > 9999 || g < 1 || g > 12 || w < 1 || w > 31 || G > 23 || N > 59 || C > 59 || r.Q !== void 0 && (r.Q < 1 || r.Q > 4))
|
|
163
213
|
return;
|
|
164
|
-
let
|
|
214
|
+
let l = u(y, g - 1, w);
|
|
165
215
|
if (r.WW !== void 0) {
|
|
166
216
|
if (r.WW < 1 || r.WW > 53) return;
|
|
167
|
-
const
|
|
168
|
-
|
|
217
|
+
const n = u(
|
|
218
|
+
y,
|
|
169
219
|
0,
|
|
170
|
-
Math.max(1, Math.min(7, Math.trunc(
|
|
220
|
+
Math.max(1, Math.min(7, Math.trunc(a)))
|
|
171
221
|
);
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
if (
|
|
175
|
-
} else if (
|
|
222
|
+
l = n - (M(n).weekday - d + 7) % 7 + (r.WW - 1) * 7;
|
|
223
|
+
const o = P(l, d, a);
|
|
224
|
+
if (o.week !== r.WW || o.year !== y) return;
|
|
225
|
+
} else if (M(l).month !== g - 1 || M(l).day !== w)
|
|
176
226
|
return;
|
|
177
|
-
if (
|
|
178
|
-
|
|
227
|
+
if (l < W || l > p) return;
|
|
228
|
+
const b = M(l).weekday;
|
|
229
|
+
if (!i.some(
|
|
230
|
+
(n, o) => n.startsWith("d") && k(s)[n][b] !== h[o + 1]
|
|
231
|
+
))
|
|
232
|
+
return { day: l, second: G * 3600 + N * 60 + C };
|
|
233
|
+
}
|
|
234
|
+
function B(e, t) {
|
|
235
|
+
return E("2000-01-01 " + e.trim(), "YYYY-MM-DD " + t);
|
|
179
236
|
}
|
|
180
|
-
function
|
|
237
|
+
function D(e) {
|
|
181
238
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
182
239
|
}
|
|
183
|
-
function
|
|
184
|
-
const t =
|
|
240
|
+
function U(e) {
|
|
241
|
+
const t = F(e.day);
|
|
185
242
|
return t.setHours(
|
|
186
243
|
Math.floor(e.second / 3600),
|
|
187
244
|
Math.floor(e.second / 60) % 60,
|
|
@@ -189,39 +246,41 @@ function I(e) {
|
|
|
189
246
|
0
|
|
190
247
|
), t;
|
|
191
248
|
}
|
|
192
|
-
function
|
|
193
|
-
return e instanceof Date && t instanceof Date ? e.getTime() === t.getTime() : Array.isArray(e) && Array.isArray(t) ? e.length === t.length && e.every((
|
|
249
|
+
function O(e, t) {
|
|
250
|
+
return e instanceof Date && t instanceof Date ? e.getTime() === t.getTime() : Array.isArray(e) && Array.isArray(t) ? e.length === t.length && e.every((d, a) => O(d, t[a])) : Object.is(e, t);
|
|
194
251
|
}
|
|
195
|
-
function
|
|
252
|
+
function V(e) {
|
|
196
253
|
return e instanceof Date ? new Date(e) : Array.isArray(e) ? e.map((t) => t instanceof Date ? new Date(t) : t) : e;
|
|
197
254
|
}
|
|
198
|
-
function
|
|
255
|
+
function J(e) {
|
|
199
256
|
try {
|
|
200
257
|
return new Intl.DateTimeFormat(e, { month: "long" });
|
|
201
258
|
} catch {
|
|
202
259
|
return new Intl.DateTimeFormat("zh-CN", { month: "long" });
|
|
203
260
|
}
|
|
204
261
|
}
|
|
205
|
-
function
|
|
206
|
-
return Math.max(
|
|
262
|
+
function Z(e, t) {
|
|
263
|
+
return Math.max(W, Math.min(p, v(e, t)));
|
|
207
264
|
}
|
|
208
265
|
export {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
266
|
+
p as DATE_MAX,
|
|
267
|
+
W as DATE_MIN,
|
|
268
|
+
B as dateClockPoint,
|
|
269
|
+
V as dateClone,
|
|
270
|
+
O as dateEqual,
|
|
271
|
+
L as dateFormat,
|
|
272
|
+
J as dateLocale,
|
|
273
|
+
j as dateMultiple,
|
|
274
|
+
U as dateNative,
|
|
275
|
+
R as datePattern,
|
|
276
|
+
X as datePeriod,
|
|
277
|
+
I as datePickerDefaults,
|
|
278
|
+
z as datePickerEnglish,
|
|
279
|
+
q as datePickerWords,
|
|
222
280
|
E as datePoint,
|
|
223
|
-
_ as
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
281
|
+
_ as dateRange,
|
|
282
|
+
Z as dateShift,
|
|
283
|
+
K as dateTimeSeconds,
|
|
284
|
+
A as dateUnit,
|
|
285
|
+
P as dateWeek
|
|
227
286
|
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { ref as j, computed as n, watch as B } from "vue";
|
|
2
|
+
import { useChoiceModel as I } from "./choiceModel.js";
|
|
3
|
+
import { dateUnit as G, dateMultiple as J, datePattern as H, datePickerEnglish as K, datePickerWords as L, dateEqual as D, dateClone as Y, datePoint as g, dateNative as E, dateFormat as N, datePeriod as Q } from "./datePicker.js";
|
|
4
|
+
function p(t, i) {
|
|
5
|
+
const A = j("string"), M = n(
|
|
6
|
+
() => t.type === "datetime" || t.type === "datetimerange" || !!t.showTime && (t.picker ?? G(t.type)) === "date"
|
|
7
|
+
), r = n(() => t.picker ?? G(t.type)), W = n(
|
|
8
|
+
() => i.value && r.value === "date" && t.defaultTime !== void 0
|
|
9
|
+
), c = n(() => !i.value && J(t.type)), v = n(
|
|
10
|
+
() => Number.isFinite(t.firstDayOfWeek) ? (Math.trunc(t.firstDayOfWeek) % 7 + 7) % 7 : 1
|
|
11
|
+
), C = n(
|
|
12
|
+
() => Number.isFinite(t.firstWeekContainsDate) ? Math.max(1, Math.min(7, Math.trunc(t.firstWeekContainsDate))) : 4
|
|
13
|
+
), f = n(
|
|
14
|
+
() => t.valueFormat ?? H(r.value, M.value)
|
|
15
|
+
), h = n(() => {
|
|
16
|
+
const e = t.format;
|
|
17
|
+
return (typeof e == "string" || typeof e == "function" ? e : e == null ? void 0 : e[0]) ?? (r.value === "week" ? "GGGG-[W]WW" : H(r.value, M.value));
|
|
18
|
+
}), S = n(() => {
|
|
19
|
+
var e;
|
|
20
|
+
return {
|
|
21
|
+
...L,
|
|
22
|
+
...(e = t.locale) != null && e.startsWith("en") ? K : {},
|
|
23
|
+
...t.messages
|
|
24
|
+
};
|
|
25
|
+
}), b = I(
|
|
26
|
+
{
|
|
27
|
+
get modelValue() {
|
|
28
|
+
return t.modelValue === void 0 ? t.value : t.modelValue;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
() => Y(
|
|
32
|
+
t.defaultValue ?? (i.value ? ["", ""] : c.value ? [] : "")
|
|
33
|
+
),
|
|
34
|
+
D
|
|
35
|
+
), u = b.current, o = n(
|
|
36
|
+
() => t.valueType ?? (m(u.value) ? A.value : u.value instanceof Date || Array.isArray(u.value) && u.value.some((e) => e instanceof Date) ? "date" : typeof u.value == "number" || Array.isArray(u.value) && u.value.some((e) => typeof e == "number") ? "timestamp" : A.value)
|
|
37
|
+
);
|
|
38
|
+
function y(e) {
|
|
39
|
+
return g(
|
|
40
|
+
e,
|
|
41
|
+
f.value,
|
|
42
|
+
v.value,
|
|
43
|
+
C.value,
|
|
44
|
+
t.locale
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function P(e) {
|
|
48
|
+
return y(e) ?? g(e, "YYYY-MM-DD") ?? g(e, "YYYY-MM-DD HH:mm:ss") ?? g(e, "YYYY-MM-DD[T]HH:mm:ss");
|
|
49
|
+
}
|
|
50
|
+
function k(e) {
|
|
51
|
+
return {
|
|
52
|
+
day: Q(e.day, r.value, v.value)[0],
|
|
53
|
+
second: M.value || W.value ? e.second : 0
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
let T;
|
|
57
|
+
function m(e) {
|
|
58
|
+
var a;
|
|
59
|
+
return e == null || e === "" || ((a = t.emptyValues) == null ? void 0 : a.some((l) => D(e, l))) || t.clearValue !== void 0 && D(e, t.clearValue) || typeof t.valueOnClear != "function" && t.valueOnClear !== void 0 && D(e, t.valueOnClear) || T !== void 0 && D(e, T);
|
|
60
|
+
}
|
|
61
|
+
function w(e = u.value) {
|
|
62
|
+
if (m(e)) return i.value ? [null, null] : [];
|
|
63
|
+
if (i.value)
|
|
64
|
+
return Array.from({ length: 2 }, (l, d) => {
|
|
65
|
+
const s = Array.isArray(e) && !m(e[d]) ? y(e[d]) : void 0;
|
|
66
|
+
return s ? k(s) : null;
|
|
67
|
+
});
|
|
68
|
+
if (c.value) {
|
|
69
|
+
const l = /* @__PURE__ */ new Set();
|
|
70
|
+
return (Array.isArray(e) ? e : []).flatMap((d) => {
|
|
71
|
+
const s = m(d) ? void 0 : y(d);
|
|
72
|
+
if (!s) return [];
|
|
73
|
+
const V = k(s);
|
|
74
|
+
return r.value === "week" && l.has(V.day) ? [] : (l.add(V.day), [V]);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const a = y(e);
|
|
78
|
+
return a ? [k(a)] : [];
|
|
79
|
+
}
|
|
80
|
+
const x = n(() => w()), z = n(() => P(t.min)), q = n(() => P(t.max));
|
|
81
|
+
function O(e) {
|
|
82
|
+
const a = E(e);
|
|
83
|
+
return o.value === "date" ? a : o.value === "timestamp" ? a.getTime() : f.value === "x" ? String(a.getTime()) : f.value === "X" ? String(Math.floor(a.getTime() / 1e3)) : N(
|
|
84
|
+
e,
|
|
85
|
+
f.value,
|
|
86
|
+
v.value,
|
|
87
|
+
C.value,
|
|
88
|
+
t.locale
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function U(e) {
|
|
92
|
+
return i.value || c.value ? e.map(
|
|
93
|
+
(a) => a ? O(a) : o.value === "string" ? "" : null
|
|
94
|
+
) : e[0] ? O(e[0]) : F();
|
|
95
|
+
}
|
|
96
|
+
function F() {
|
|
97
|
+
if (t.valueOnClear !== void 0) {
|
|
98
|
+
const e = typeof t.valueOnClear == "function" ? t.valueOnClear() : t.valueOnClear;
|
|
99
|
+
return Y(e);
|
|
100
|
+
}
|
|
101
|
+
return t.clearValue !== void 0 ? Y(t.clearValue) : i.value ? o.value === "string" ? ["", ""] : [null, null] : c.value ? [] : o.value === "string" ? "" : null;
|
|
102
|
+
}
|
|
103
|
+
function X(e = x.value) {
|
|
104
|
+
return e.map(
|
|
105
|
+
(a) => a ? typeof h.value == "function" ? h.value(E(a)) : N(
|
|
106
|
+
a,
|
|
107
|
+
h.value,
|
|
108
|
+
v.value,
|
|
109
|
+
C.value,
|
|
110
|
+
t.locale
|
|
111
|
+
) : ""
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
B(
|
|
115
|
+
u,
|
|
116
|
+
(e) => {
|
|
117
|
+
if (m(e)) return;
|
|
118
|
+
const a = Array.isArray(e) ? e : [e], l = a.find((d) => !m(d));
|
|
119
|
+
l !== void 0 && (A.value = l instanceof Date ? "date" : typeof l == "number" ? "timestamp" : "string");
|
|
120
|
+
},
|
|
121
|
+
{ immediate: !0, flush: "sync" }
|
|
122
|
+
);
|
|
123
|
+
function _(e) {
|
|
124
|
+
T = Y(e);
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
time: M,
|
|
128
|
+
rangeDefaultTime: W,
|
|
129
|
+
unit: r,
|
|
130
|
+
multiple: c,
|
|
131
|
+
first: v,
|
|
132
|
+
weekContains: C,
|
|
133
|
+
pattern: f,
|
|
134
|
+
displayPattern: h,
|
|
135
|
+
words: S,
|
|
136
|
+
model: b,
|
|
137
|
+
current: u,
|
|
138
|
+
outputType: o,
|
|
139
|
+
parse: y,
|
|
140
|
+
boundary: P,
|
|
141
|
+
normalize: k,
|
|
142
|
+
isEmpty: m,
|
|
143
|
+
points: w,
|
|
144
|
+
selected: x,
|
|
145
|
+
minPoint: z,
|
|
146
|
+
maxPoint: q,
|
|
147
|
+
encodePoint: O,
|
|
148
|
+
encode: U,
|
|
149
|
+
empty: F,
|
|
150
|
+
describe: X,
|
|
151
|
+
markClear: _
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
p as useDatePickerModel
|
|
156
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ref as y, computed as k } from "vue";
|
|
2
|
+
import { civilDay as j, calendarParts as E } from "./calendar.js";
|
|
3
|
+
import { dateShift as z, dateNative as A, DATE_MIN as T, DATE_MAX as _ } from "./datePicker.js";
|
|
4
|
+
function K({
|
|
5
|
+
props: l,
|
|
6
|
+
unit: t,
|
|
7
|
+
range: w,
|
|
8
|
+
time: M,
|
|
9
|
+
selected: V,
|
|
10
|
+
minPoint: F,
|
|
11
|
+
maxPoint: I,
|
|
12
|
+
boundary: f,
|
|
13
|
+
encodePoint: g,
|
|
14
|
+
emit: i
|
|
15
|
+
}) {
|
|
16
|
+
const r = y(
|
|
17
|
+
l.defaultMode ?? (t.value === "week" ? "date" : t.value)
|
|
18
|
+
), c = y(r.value), s = y(0), o = y(0), P = k(() => {
|
|
19
|
+
var u, n, v, d;
|
|
20
|
+
const e = ((n = f(((u = l.panelValues) == null ? void 0 : u[0]) ?? l.panelValue)) == null ? void 0 : n.day) ?? s.value, a = (d = f((v = l.panelValues) == null ? void 0 : v[1])) == null ? void 0 : d.day;
|
|
21
|
+
return [
|
|
22
|
+
e,
|
|
23
|
+
a ?? (l.panelValue !== void 0 && !l.unlinkPanels ? h(e, 1) : o.value)
|
|
24
|
+
];
|
|
25
|
+
}), D = k(() => t.value === "week" ? "date" : t.value), m = k(() => {
|
|
26
|
+
const e = l.mode ?? r.value;
|
|
27
|
+
return e === "time" && !M.value ? D.value : e;
|
|
28
|
+
});
|
|
29
|
+
function R(e) {
|
|
30
|
+
var d, q, B, C;
|
|
31
|
+
const a = l.defaultPickerValue, u = Array.isArray(a) ? a[0] : a, n = N(
|
|
32
|
+
((d = V.value.find(Boolean)) == null ? void 0 : d.day) ?? ((q = f(u)) == null ? void 0 : q.day) ?? e
|
|
33
|
+
);
|
|
34
|
+
s.value = n;
|
|
35
|
+
const v = ((B = V.value[1]) == null ? void 0 : B.day) ?? (Array.isArray(a) ? (C = f(a[1])) == null ? void 0 : C.day : void 0);
|
|
36
|
+
o.value = (l.unlinkPanels || !V.value.some(Boolean) && Array.isArray(a)) && v !== void 0 ? N(v) : h(n, 1), r.value = l.defaultMode ?? (t.value === "week" ? "date" : t.value), c.value = r.value === "time" ? D.value : r.value;
|
|
37
|
+
}
|
|
38
|
+
function N(e) {
|
|
39
|
+
var a, u;
|
|
40
|
+
return Math.max(
|
|
41
|
+
((a = F.value) == null ? void 0 : a.day) ?? T,
|
|
42
|
+
Math.min(((u = I.value) == null ? void 0 : u.day) ?? _, e)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function h(e, a) {
|
|
46
|
+
const u = t.value === "year" ? 144 : t.value === "month" || t.value === "quarter" ? 12 : 1;
|
|
47
|
+
return z(e, a * u);
|
|
48
|
+
}
|
|
49
|
+
function S(e, a = 0) {
|
|
50
|
+
if (!Number.isFinite(e) || e < T || e > _) return !1;
|
|
51
|
+
const u = j(
|
|
52
|
+
E(e).year,
|
|
53
|
+
E(e).month,
|
|
54
|
+
1
|
|
55
|
+
), n = [...P.value];
|
|
56
|
+
return n[a] = u, l.unlinkPanels || (n[1 - a] = h(u, a ? -1 : 1)), !l.panelValues && a === 0 ? (l.panelValue === void 0 && (s.value = u), i("update:panelValue", g({ day: u, second: 0 })), w.value && !l.unlinkPanels && (o.value = n[1])) : l.panelValues || (o.value = u, l.unlinkPanels || (l.panelValue === void 0 && (s.value = n[0]), i("update:panelValue", g({ day: n[0], second: 0 })))), w.value && i(
|
|
57
|
+
"update:panelValues",
|
|
58
|
+
n.map((v) => A({ day: v, second: 0 }))
|
|
59
|
+
), i(
|
|
60
|
+
"panelChange",
|
|
61
|
+
A({ day: u, second: 0 }),
|
|
62
|
+
a ? c.value : m.value,
|
|
63
|
+
{ index: a }
|
|
64
|
+
), !0;
|
|
65
|
+
}
|
|
66
|
+
function X(e, a = 0) {
|
|
67
|
+
return !["date", "month", "quarter", "year", "decade", "time"].includes(e) || e === "time" && !M.value ? !1 : (a ? c.value = e : (l.mode === void 0 && (r.value = e), i("update:mode", e)), i(
|
|
68
|
+
"panelChange",
|
|
69
|
+
A({ day: P.value[a], second: 0 }),
|
|
70
|
+
e,
|
|
71
|
+
{ index: a }
|
|
72
|
+
), a ? !0 : m.value === e);
|
|
73
|
+
}
|
|
74
|
+
return { currentView: m, rightView: c, panels: P, resetPanels: R, setPanel: S, setMode: X };
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
K as useDatePickerPanels
|
|
78
|
+
};
|