naive-ui 2.21.2 → 2.22.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/es/_internal/close/src/styles/index.cssr.js +6 -5
- package/es/_internal/scrollbar/src/ScrollBar.d.ts +15 -0
- package/es/_internal/scrollbar/src/ScrollBar.js +13 -7
- package/es/_internal/selection/src/Selection.js +11 -9
- package/es/_internal/selection/src/styles/index.cssr.js +6 -2
- package/es/alert/src/Alert.d.ts +20 -20
- package/es/alert/src/Alert.js +22 -22
- package/es/alert/src/styles/index.cssr.js +45 -45
- package/es/anchor/src/AnchorAdapter.js +12 -12
- package/es/anchor/src/styles/index.cssr.js +41 -41
- package/es/avatar/src/Avatar.d.ts +5 -3
- package/es/avatar/src/Avatar.js +7 -5
- package/es/avatar/src/styles/index.cssr.js +3 -5
- package/es/button/src/Button.d.ts +60 -60
- package/es/button/src/Button.js +107 -106
- package/es/button/src/styles/button.cssr.js +83 -80
- package/es/button/styles/dark.js +3 -3
- package/es/button/styles/light.d.ts +3 -3
- package/es/button/styles/light.js +1 -1
- package/es/calendar/src/Calendar.d.ts +37 -30
- package/es/calendar/styles/light.d.ts +3 -3
- package/es/cascader/src/Cascader.d.ts +135 -0
- package/es/cascader/src/Cascader.js +2 -4
- package/es/cascader/src/CascaderMenu.d.ts +345 -0
- package/es/cascader/src/CascaderMenu.js +6 -5
- package/es/cascader/src/CascaderOption.d.ts +18 -0
- package/es/cascader/src/CascaderSelectMenu.d.ts +18 -0
- package/es/cascader/src/CascaderSubmenu.d.ts +18 -0
- package/es/cascader/styles/dark.js +3 -1
- package/es/cascader/styles/light.d.ts +13 -0
- package/es/cascader/styles/light.js +3 -1
- package/es/color-picker/src/ColorInputUnit.d.ts +3 -3
- package/es/color-picker/src/ColorPicker.d.ts +27 -27
- package/es/color-picker/styles/light.d.ts +3 -3
- package/es/config-provider/src/ConfigProvider.d.ts +21 -0
- package/es/data-table/src/DataTable.d.ts +30 -30
- package/es/data-table/src/DataTable.js +7 -14
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +3 -3
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +3 -3
- package/es/data-table/src/MainTable.js +2 -3
- package/es/data-table/src/TableParts/Body.d.ts +18 -7
- package/es/data-table/src/TableParts/Body.js +80 -28
- package/es/data-table/src/TableParts/Cell.d.ts +6 -6
- package/es/data-table/src/TableParts/Header.d.ts +3 -3
- package/es/data-table/src/TableParts/Header.js +1 -1
- package/es/data-table/src/interface.d.ts +4 -1
- package/es/data-table/src/styles/index.cssr.js +9 -12
- package/es/data-table/src/use-check.js +6 -2
- package/es/data-table/src/use-scroll.d.ts +2 -0
- package/es/data-table/src/use-scroll.js +34 -4
- package/es/data-table/src/use-table-data.js +4 -1
- package/es/data-table/styles/_common.js +1 -1
- package/es/data-table/styles/light.d.ts +3 -3
- package/es/date-picker/src/DatePicker.d.ts +94 -69
- package/es/date-picker/src/DatePicker.js +47 -20
- package/es/date-picker/src/config.d.ts +1 -9
- package/es/date-picker/src/config.js +0 -8
- package/es/date-picker/src/interface.d.ts +2 -1
- package/es/date-picker/src/panel/date.d.ts +23 -10
- package/es/date-picker/src/panel/date.js +2 -2
- package/es/date-picker/src/panel/daterange.d.ts +21 -9
- package/es/date-picker/src/panel/daterange.js +2 -2
- package/es/date-picker/src/panel/datetime.d.ts +23 -16
- package/es/date-picker/src/panel/datetime.js +2 -2
- package/es/date-picker/src/panel/datetimerange.d.ts +21 -9
- package/es/date-picker/src/panel/datetimerange.js +2 -2
- package/es/date-picker/src/panel/month.d.ts +27 -20
- package/es/date-picker/src/panel/month.js +23 -12
- package/es/date-picker/src/panel/use-calendar.d.ts +25 -43
- package/es/date-picker/src/panel/use-calendar.js +35 -18
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +21 -40
- package/es/date-picker/src/panel/use-dual-calendar.js +23 -8
- package/es/date-picker/src/panel/use-panel-common.d.ts +21 -36
- package/es/date-picker/src/panel/use-panel-common.js +2 -2
- package/es/date-picker/src/utils.d.ts +19 -3
- package/es/date-picker/src/utils.js +40 -5
- package/es/date-picker/styles/_common.d.ts +2 -0
- package/es/date-picker/styles/_common.js +3 -1
- package/es/date-picker/styles/light.d.ts +10 -6
- package/es/dialog/src/Dialog.d.ts +21 -21
- package/es/dialog/src/styles/index.cssr.js +1 -0
- package/es/dialog/styles/light.d.ts +3 -3
- package/es/dynamic-input/src/DynamicInput.d.ts +30 -30
- package/es/dynamic-input/src/InputPreset.d.ts +3 -3
- package/es/dynamic-input/src/PairPreset.d.ts +3 -3
- package/es/dynamic-input/styles/light.d.ts +3 -3
- package/es/dynamic-tags/src/DynamicTags.d.ts +30 -30
- package/es/dynamic-tags/styles/light.d.ts +3 -3
- package/es/element/index.d.ts +1 -0
- package/es/element/index.js +1 -0
- package/es/form/src/interface.d.ts +5 -4
- package/es/image/src/Image.d.ts +25 -16
- package/es/image/src/Image.js +35 -11
- package/es/image/src/ImageGroup.js +2 -2
- package/es/image/src/styles/index.cssr.js +4 -3
- package/es/input/src/Input.js +2 -0
- package/es/input/src/styles/input.cssr.js +2 -1
- package/es/input-number/src/InputNumber.d.ts +30 -30
- package/es/input-number/src/InputNumber.js +10 -5
- package/es/input-number/src/utils.d.ts +1 -0
- package/es/input-number/src/utils.js +4 -0
- package/es/input-number/styles/light.d.ts +3 -3
- package/es/locales/common/deDE.js +8 -0
- package/es/locales/common/enUS.d.ts +7 -0
- package/es/locales/common/enUS.js +8 -1
- package/es/locales/common/frFR.d.ts +3 -0
- package/es/locales/common/frFR.js +101 -0
- package/es/locales/common/idID.d.ts +2 -93
- package/es/locales/common/idID.js +8 -0
- package/es/locales/common/jaJP.js +8 -0
- package/es/locales/common/nbNO.js +8 -0
- package/es/locales/common/ruRU.js +8 -0
- package/es/locales/common/ukUA.js +8 -0
- package/es/locales/common/zhCN.js +7 -0
- package/es/locales/common/zhTW.d.ts +3 -0
- package/es/locales/common/zhTW.js +100 -0
- package/es/locales/date/frFR.d.ts +3 -0
- package/es/locales/date/frFR.js +6 -0
- package/es/locales/date/idID.d.ts +1 -6
- package/es/locales/date/zhTW.d.ts +3 -0
- package/es/locales/date/zhTW.js +6 -0
- package/es/locales/index.d.ts +4 -0
- package/es/locales/index.js +4 -0
- package/es/modal/src/BodyWrapper.d.ts +6 -6
- package/es/modal/src/Modal.d.ts +36 -36
- package/es/modal/styles/light.d.ts +3 -3
- package/es/page-header/src/PageHeader.js +3 -3
- package/es/page-header/src/styles/index.cssr.js +2 -4
- package/es/popconfirm/src/Popconfirm.d.ts +30 -30
- package/es/popconfirm/styles/light.d.ts +3 -3
- package/es/popover/src/Popover.js +4 -1
- package/es/popover/src/PopoverBody.js +3 -3
- package/es/popselect/src/Popselect.d.ts +2 -11
- package/es/popselect/src/Popselect.js +2 -2
- package/es/popselect/src/PopselectPanel.d.ts +3 -11
- package/es/popselect/src/PopselectPanel.js +17 -11
- package/es/radio/src/Radio.js +3 -3
- package/es/radio/src/RadioButton.js +4 -5
- package/es/radio/src/styles/radio-group.cssr.js +8 -4
- package/es/radio/src/styles/radio.cssr.js +8 -4
- package/es/radio/src/use-radio.d.ts +0 -3
- package/es/radio/src/use-radio.js +1 -26
- package/es/switch/src/Switch.d.ts +16 -1
- package/es/switch/src/Switch.js +17 -4
- package/es/switch/src/styles/index.cssr.js +1 -1
- package/es/tabs/src/styles/index.cssr.js +1 -0
- package/es/tag/src/styles/index.cssr.js +1 -1
- package/es/theme-editor/src/ThemeEditor.js +9 -2
- package/es/time-picker/src/Panel.d.ts +3 -3
- package/es/time-picker/src/TimePicker.d.ts +30 -30
- package/es/time-picker/styles/light.d.ts +3 -3
- package/es/transfer/src/Transfer.d.ts +30 -30
- package/es/transfer/src/TransferFilter.d.ts +3 -3
- package/es/transfer/src/TransferList.d.ts +3 -3
- package/es/transfer/src/TransferListItem.d.ts +3 -3
- package/es/transfer/styles/light.d.ts +3 -3
- package/es/tree/src/Tree.d.ts +8 -4
- package/es/tree/src/Tree.js +32 -6
- package/es/tree-select/src/TreeSelect.d.ts +38 -1
- package/es/tree-select/src/TreeSelect.js +25 -10
- package/es/tree-select/src/styles/index.cssr.js +11 -2
- package/es/tree-select/styles/light.d.ts +6 -0
- package/es/tree-select/styles/light.js +5 -2
- package/es/upload/src/Upload.d.ts +41 -30
- package/es/upload/src/Upload.js +33 -23
- package/es/upload/src/UploadFile.d.ts +4 -4
- package/es/upload/src/UploadFileList.js +4 -2
- package/es/upload/src/UploadProgress.d.ts +3 -3
- package/es/upload/src/interface.d.ts +1 -0
- package/es/upload/src/styles/index.cssr.js +2 -3
- package/es/upload/styles/light.d.ts +3 -3
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/close/src/styles/index.cssr.js +6 -5
- package/lib/_internal/scrollbar/src/ScrollBar.d.ts +15 -0
- package/lib/_internal/scrollbar/src/ScrollBar.js +13 -7
- package/lib/_internal/selection/src/Selection.js +11 -9
- package/lib/_internal/selection/src/styles/index.cssr.js +6 -2
- package/lib/alert/src/Alert.d.ts +20 -20
- package/lib/alert/src/Alert.js +22 -22
- package/lib/alert/src/styles/index.cssr.js +45 -45
- package/lib/anchor/src/AnchorAdapter.js +12 -12
- package/lib/anchor/src/styles/index.cssr.js +41 -41
- package/lib/avatar/src/Avatar.d.ts +5 -3
- package/lib/avatar/src/Avatar.js +7 -5
- package/lib/avatar/src/styles/index.cssr.js +3 -5
- package/lib/button/src/Button.d.ts +60 -60
- package/lib/button/src/Button.js +107 -106
- package/lib/button/src/styles/button.cssr.js +83 -80
- package/lib/button/styles/dark.js +3 -3
- package/lib/button/styles/light.d.ts +3 -3
- package/lib/button/styles/light.js +1 -1
- package/lib/calendar/src/Calendar.d.ts +37 -30
- package/lib/calendar/styles/light.d.ts +3 -3
- package/lib/cascader/src/Cascader.d.ts +135 -0
- package/lib/cascader/src/Cascader.js +2 -4
- package/lib/cascader/src/CascaderMenu.d.ts +345 -0
- package/lib/cascader/src/CascaderMenu.js +6 -5
- package/lib/cascader/src/CascaderOption.d.ts +18 -0
- package/lib/cascader/src/CascaderSelectMenu.d.ts +18 -0
- package/lib/cascader/src/CascaderSubmenu.d.ts +18 -0
- package/lib/cascader/styles/dark.js +3 -1
- package/lib/cascader/styles/light.d.ts +13 -0
- package/lib/cascader/styles/light.js +3 -1
- package/lib/color-picker/src/ColorInputUnit.d.ts +3 -3
- package/lib/color-picker/src/ColorPicker.d.ts +27 -27
- package/lib/color-picker/styles/light.d.ts +3 -3
- package/lib/config-provider/src/ConfigProvider.d.ts +21 -0
- package/lib/data-table/src/DataTable.d.ts +30 -30
- package/lib/data-table/src/DataTable.js +6 -13
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +3 -3
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +3 -3
- package/lib/data-table/src/MainTable.js +1 -2
- package/lib/data-table/src/TableParts/Body.d.ts +18 -7
- package/lib/data-table/src/TableParts/Body.js +78 -26
- package/lib/data-table/src/TableParts/Cell.d.ts +6 -6
- package/lib/data-table/src/TableParts/Header.d.ts +3 -3
- package/lib/data-table/src/TableParts/Header.js +1 -1
- package/lib/data-table/src/interface.d.ts +4 -1
- package/lib/data-table/src/styles/index.cssr.js +9 -12
- package/lib/data-table/src/use-check.js +6 -2
- package/lib/data-table/src/use-scroll.d.ts +2 -0
- package/lib/data-table/src/use-scroll.js +34 -4
- package/lib/data-table/src/use-table-data.js +4 -1
- package/lib/data-table/styles/_common.js +1 -1
- package/lib/data-table/styles/light.d.ts +3 -3
- package/lib/date-picker/src/DatePicker.d.ts +94 -69
- package/lib/date-picker/src/DatePicker.js +46 -19
- package/lib/date-picker/src/config.d.ts +1 -9
- package/lib/date-picker/src/config.js +1 -9
- package/lib/date-picker/src/interface.d.ts +2 -1
- package/lib/date-picker/src/panel/date.d.ts +23 -10
- package/lib/date-picker/src/panel/date.js +1 -1
- package/lib/date-picker/src/panel/daterange.d.ts +21 -9
- package/lib/date-picker/src/panel/daterange.js +1 -1
- package/lib/date-picker/src/panel/datetime.d.ts +23 -16
- package/lib/date-picker/src/panel/datetime.js +1 -1
- package/lib/date-picker/src/panel/datetimerange.d.ts +21 -9
- package/lib/date-picker/src/panel/datetimerange.js +2 -2
- package/lib/date-picker/src/panel/month.d.ts +27 -20
- package/lib/date-picker/src/panel/month.js +23 -12
- package/lib/date-picker/src/panel/use-calendar.d.ts +25 -43
- package/lib/date-picker/src/panel/use-calendar.js +34 -16
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +21 -40
- package/lib/date-picker/src/panel/use-dual-calendar.js +22 -6
- package/lib/date-picker/src/panel/use-panel-common.d.ts +21 -36
- package/lib/date-picker/src/panel/use-panel-common.js +3 -2
- package/lib/date-picker/src/utils.d.ts +19 -3
- package/lib/date-picker/src/utils.js +41 -4
- package/lib/date-picker/styles/_common.d.ts +2 -0
- package/lib/date-picker/styles/_common.js +3 -1
- package/lib/date-picker/styles/light.d.ts +10 -6
- package/lib/dialog/src/Dialog.d.ts +21 -21
- package/lib/dialog/src/styles/index.cssr.js +1 -0
- package/lib/dialog/styles/light.d.ts +3 -3
- package/lib/dynamic-input/src/DynamicInput.d.ts +30 -30
- package/lib/dynamic-input/src/InputPreset.d.ts +3 -3
- package/lib/dynamic-input/src/PairPreset.d.ts +3 -3
- package/lib/dynamic-input/styles/light.d.ts +3 -3
- package/lib/dynamic-tags/src/DynamicTags.d.ts +30 -30
- package/lib/dynamic-tags/styles/light.d.ts +3 -3
- package/lib/element/index.d.ts +1 -0
- package/lib/element/index.js +3 -1
- package/lib/form/src/interface.d.ts +5 -4
- package/lib/image/src/Image.d.ts +25 -16
- package/lib/image/src/Image.js +34 -10
- package/lib/image/src/ImageGroup.js +2 -2
- package/lib/image/src/styles/index.cssr.js +3 -2
- package/lib/input/src/Input.js +2 -0
- package/lib/input/src/styles/input.cssr.js +2 -1
- package/lib/input-number/src/InputNumber.d.ts +30 -30
- package/lib/input-number/src/InputNumber.js +9 -4
- package/lib/input-number/src/utils.d.ts +1 -0
- package/lib/input-number/src/utils.js +6 -1
- package/lib/input-number/styles/light.d.ts +3 -3
- package/lib/locales/common/deDE.js +8 -0
- package/lib/locales/common/enUS.d.ts +7 -0
- package/lib/locales/common/enUS.js +8 -1
- package/lib/locales/common/frFR.d.ts +3 -0
- package/lib/locales/common/frFR.js +103 -0
- package/lib/locales/common/idID.d.ts +2 -93
- package/lib/locales/common/idID.js +8 -0
- package/lib/locales/common/jaJP.js +8 -0
- package/lib/locales/common/nbNO.js +8 -0
- package/lib/locales/common/ruRU.js +8 -0
- package/lib/locales/common/ukUA.js +8 -0
- package/lib/locales/common/zhCN.js +7 -0
- package/lib/locales/common/zhTW.d.ts +3 -0
- package/lib/locales/common/zhTW.js +102 -0
- package/lib/locales/date/frFR.d.ts +3 -0
- package/lib/locales/date/frFR.js +11 -0
- package/lib/locales/date/idID.d.ts +1 -6
- package/lib/locales/date/zhTW.d.ts +3 -0
- package/lib/locales/date/zhTW.js +11 -0
- package/lib/locales/index.d.ts +4 -0
- package/lib/locales/index.js +9 -1
- package/lib/modal/src/BodyWrapper.d.ts +6 -6
- package/lib/modal/src/Modal.d.ts +36 -36
- package/lib/modal/styles/light.d.ts +3 -3
- package/lib/page-header/src/PageHeader.js +3 -3
- package/lib/page-header/src/styles/index.cssr.js +2 -4
- package/lib/popconfirm/src/Popconfirm.d.ts +30 -30
- package/lib/popconfirm/styles/light.d.ts +3 -3
- package/lib/popover/src/Popover.js +4 -1
- package/lib/popover/src/PopoverBody.js +3 -3
- package/lib/popselect/src/Popselect.d.ts +2 -11
- package/lib/popselect/src/Popselect.js +2 -2
- package/lib/popselect/src/PopselectPanel.d.ts +3 -11
- package/lib/popselect/src/PopselectPanel.js +16 -10
- package/lib/radio/src/Radio.js +3 -3
- package/lib/radio/src/RadioButton.js +4 -5
- package/lib/radio/src/styles/radio-group.cssr.js +8 -4
- package/lib/radio/src/styles/radio.cssr.js +8 -4
- package/lib/radio/src/use-radio.d.ts +0 -3
- package/lib/radio/src/use-radio.js +1 -26
- package/lib/switch/src/Switch.d.ts +16 -1
- package/lib/switch/src/Switch.js +17 -4
- package/lib/switch/src/styles/index.cssr.js +1 -1
- package/lib/tabs/src/styles/index.cssr.js +1 -0
- package/lib/tag/src/styles/index.cssr.js +1 -1
- package/lib/theme-editor/src/ThemeEditor.js +9 -2
- package/lib/time-picker/src/Panel.d.ts +3 -3
- package/lib/time-picker/src/TimePicker.d.ts +30 -30
- package/lib/time-picker/styles/light.d.ts +3 -3
- package/lib/transfer/src/Transfer.d.ts +30 -30
- package/lib/transfer/src/TransferFilter.d.ts +3 -3
- package/lib/transfer/src/TransferList.d.ts +3 -3
- package/lib/transfer/src/TransferListItem.d.ts +3 -3
- package/lib/transfer/styles/light.d.ts +3 -3
- package/lib/tree/src/Tree.d.ts +8 -4
- package/lib/tree/src/Tree.js +32 -6
- package/lib/tree-select/src/TreeSelect.d.ts +38 -1
- package/lib/tree-select/src/TreeSelect.js +24 -9
- package/lib/tree-select/src/styles/index.cssr.js +11 -2
- package/lib/tree-select/styles/light.d.ts +6 -0
- package/lib/tree-select/styles/light.js +5 -2
- package/lib/upload/src/Upload.d.ts +41 -30
- package/lib/upload/src/Upload.js +33 -23
- package/lib/upload/src/UploadFile.d.ts +4 -4
- package/lib/upload/src/UploadFileList.js +4 -2
- package/lib/upload/src/UploadProgress.d.ts +3 -3
- package/lib/upload/src/interface.d.ts +1 -0
- package/lib/upload/src/styles/index.cssr.js +2 -3
- package/lib/upload/styles/light.d.ts +3 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +5 -4
- package/web-types.json +99 -7
|
@@ -2,8 +2,8 @@ import { h, defineComponent } from 'vue';
|
|
|
2
2
|
import { VirtualList } from 'vueuc';
|
|
3
3
|
import { NButton, NxButton } from '../../../button';
|
|
4
4
|
import { NBaseFocusDetector, NScrollbar } from '../../../_internal';
|
|
5
|
-
import { useCalendar } from './use-calendar';
|
|
6
5
|
import { MONTH_ITEM_HEIGHT } from '../config';
|
|
6
|
+
import { useCalendar, useCalendarProps } from './use-calendar';
|
|
7
7
|
/**
|
|
8
8
|
* Month Panel
|
|
9
9
|
* Update picker value on:
|
|
@@ -12,32 +12,41 @@ import { MONTH_ITEM_HEIGHT } from '../config';
|
|
|
12
12
|
*/
|
|
13
13
|
export default defineComponent({
|
|
14
14
|
name: 'MonthPanel',
|
|
15
|
-
props: Object.assign(Object.assign({},
|
|
15
|
+
props: Object.assign(Object.assign({}, useCalendarProps), { type: {
|
|
16
16
|
type: String,
|
|
17
17
|
required: true
|
|
18
18
|
} }),
|
|
19
19
|
setup(props) {
|
|
20
20
|
const useCalendarRef = useCalendar(props, props.type);
|
|
21
|
+
const getRenderContent = (item) => {
|
|
22
|
+
switch (item.type) {
|
|
23
|
+
case 'year':
|
|
24
|
+
return item.dateObject.year;
|
|
25
|
+
case 'month':
|
|
26
|
+
return item.dateObject.month + 1;
|
|
27
|
+
case 'quarter':
|
|
28
|
+
return `Q ${item.dateObject.quarter}`;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
21
31
|
const renderItem = (item, i, mergedClsPrefix) => {
|
|
22
32
|
const { mergedIsDateDisabled, handleDateClick } = useCalendarRef;
|
|
23
33
|
return (h("div", { "data-n-date": true, key: i, class: [
|
|
24
34
|
`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item`,
|
|
25
35
|
{
|
|
26
|
-
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--current`]: item.
|
|
27
|
-
? item.isCurrentMonth
|
|
28
|
-
: item.isCurrentYear,
|
|
36
|
+
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--current`]: item.isCurrent,
|
|
29
37
|
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--selected`]: item.selected,
|
|
30
38
|
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--disabled`]: mergedIsDateDisabled(item.ts)
|
|
31
39
|
}
|
|
32
|
-
], onClick: () => handleDateClick(item) }, item
|
|
33
|
-
? item.dateObject.month + 1
|
|
34
|
-
: item.dateObject.year));
|
|
40
|
+
], onClick: () => handleDateClick(item) }, getRenderContent(item)));
|
|
35
41
|
};
|
|
36
42
|
return Object.assign(Object.assign({}, useCalendarRef), { renderItem });
|
|
37
43
|
},
|
|
38
44
|
render() {
|
|
39
45
|
const { mergedClsPrefix, mergedTheme, shortcuts, actions, renderItem, type } = this;
|
|
40
|
-
return (h("div", { ref: "selfRef", tabindex: 0, class:
|
|
46
|
+
return (h("div", { ref: "selfRef", tabindex: 0, class: [
|
|
47
|
+
`${mergedClsPrefix}-date-panel`,
|
|
48
|
+
`${mergedClsPrefix}-date-panel--month`
|
|
49
|
+
], onFocus: this.handlePanelFocus, onKeydown: this.handlePanelKeyDown },
|
|
41
50
|
h("div", { class: `${mergedClsPrefix}-date-panel-month-calendar` },
|
|
42
51
|
h(NScrollbar, { ref: "scrollbarInstRef", class: `${mergedClsPrefix}-date-panel-month-calendar__picker-col`, theme: mergedTheme.peers.Scrollbar, themeOverrides: mergedTheme.peerOverrides.Scrollbar, container: this.virtualListContainer, content: this.virtualListContent, horizontalRailStyle: { zIndex: 1 }, verticalRailStyle: { zIndex: 1 } }, {
|
|
43
52
|
default: () => (h(VirtualList, { ref: "yearScrollRef", items: this.yearArray, itemSize: MONTH_ITEM_HEIGHT, showScrollbar: false, keyField: "ts", onScroll: this.handleVirtualListScroll, paddingBottom: 4 }, {
|
|
@@ -46,11 +55,13 @@ export default defineComponent({
|
|
|
46
55
|
}
|
|
47
56
|
}))
|
|
48
57
|
}),
|
|
49
|
-
type === 'month' ? (h("div", { class: `${mergedClsPrefix}-date-panel-month-calendar__picker-col` },
|
|
58
|
+
type === 'month' || type === 'quarter' ? (h("div", { class: `${mergedClsPrefix}-date-panel-month-calendar__picker-col` },
|
|
50
59
|
h(NScrollbar, { ref: "monthScrollRef", theme: mergedTheme.peers.Scrollbar, themeOverrides: mergedTheme.peerOverrides.Scrollbar }, {
|
|
51
60
|
default: () => [
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
(type === 'month'
|
|
62
|
+
? this.monthArray
|
|
63
|
+
: this.quarterArray).map((item, i) => renderItem(item, i, mergedClsPrefix)),
|
|
64
|
+
h("div", { class: `${mergedClsPrefix}-date-panel-${type}-calendar__padding` })
|
|
54
65
|
]
|
|
55
66
|
}))) : null),
|
|
56
67
|
this.datePickerSlots.footer ? (h("div", { class: `${mergedClsPrefix}-date-panel-footer` }, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import { Shortcuts } from '../interface';
|
|
3
|
-
import type { DateItem, MonthItem, YearItem } from '../utils';
|
|
2
|
+
import type { Shortcuts } from '../interface';
|
|
3
|
+
import type { DateItem, MonthItem, YearItem, QuarterItem } from '../utils';
|
|
4
4
|
declare const useCalendarProps: {
|
|
5
5
|
readonly actions: {
|
|
6
6
|
readonly type: PropType<string[]>;
|
|
@@ -20,6 +20,7 @@ declare const useCalendarProps: {
|
|
|
20
20
|
readonly default: null;
|
|
21
21
|
};
|
|
22
22
|
readonly shortcuts: PropType<Shortcuts>;
|
|
23
|
+
readonly defaultTime: PropType<import("../interface").DefaultTime>;
|
|
23
24
|
readonly onConfirm: FunctionConstructor;
|
|
24
25
|
readonly onClose: PropType<import("../interface").OnClose>;
|
|
25
26
|
readonly onTabOut: FunctionConstructor;
|
|
@@ -28,8 +29,8 @@ declare const useCalendarProps: {
|
|
|
28
29
|
readonly required: true;
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
|
-
declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, type: 'date' | 'datetime' | 'month' | 'year'): {
|
|
32
|
-
handleDateClick: (dateItem: DateItem | MonthItem | YearItem) => void;
|
|
32
|
+
declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, type: 'date' | 'datetime' | 'month' | 'year' | 'quarter'): {
|
|
33
|
+
handleDateClick: (dateItem: DateItem | MonthItem | YearItem | QuarterItem) => void;
|
|
33
34
|
handleDateInputBlur: () => void;
|
|
34
35
|
handleDateInput: (value: string) => void;
|
|
35
36
|
handleTimePickerChange: (value: number | null) => void;
|
|
@@ -212,12 +213,14 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
212
213
|
calendarLeftPaddingDatetimerange: string;
|
|
213
214
|
calendarLeftPaddingMonth: string;
|
|
214
215
|
calendarLeftPaddingYear: string;
|
|
216
|
+
calendarLeftPaddingQuarter: string;
|
|
215
217
|
calendarRightPaddingDate: string;
|
|
216
218
|
calendarRightPaddingDatetime: string;
|
|
217
219
|
calendarRightPaddingDaterange: string;
|
|
218
220
|
calendarRightPaddingDatetimerange: string;
|
|
219
221
|
calendarRightPaddingMonth: string;
|
|
220
222
|
calendarRightPaddingYear: string;
|
|
223
|
+
calendarRightPaddingQuarter: string;
|
|
221
224
|
};
|
|
222
225
|
peers: {
|
|
223
226
|
Input: import("../../../_mixins").Theme<"Input", {
|
|
@@ -294,9 +297,9 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
294
297
|
fontSizeMedium: string;
|
|
295
298
|
fontSizeLarge: string;
|
|
296
299
|
opacityDisabled: string;
|
|
297
|
-
colorOpacitySecondary:
|
|
298
|
-
colorOpacitySecondaryHover:
|
|
299
|
-
colorOpacitySecondaryPressed:
|
|
300
|
+
colorOpacitySecondary: string;
|
|
301
|
+
colorOpacitySecondaryHover: string;
|
|
302
|
+
colorOpacitySecondaryPressed: string;
|
|
300
303
|
colorSecondary: string;
|
|
301
304
|
colorSecondaryHover: string;
|
|
302
305
|
colorSecondaryPressed: string;
|
|
@@ -519,9 +522,9 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
519
522
|
fontSizeMedium: string;
|
|
520
523
|
fontSizeLarge: string;
|
|
521
524
|
opacityDisabled: string;
|
|
522
|
-
colorOpacitySecondary:
|
|
523
|
-
colorOpacitySecondaryHover:
|
|
524
|
-
colorOpacitySecondaryPressed:
|
|
525
|
+
colorOpacitySecondary: string;
|
|
526
|
+
colorOpacitySecondaryHover: string;
|
|
527
|
+
colorOpacitySecondaryPressed: string;
|
|
525
528
|
colorSecondary: string;
|
|
526
529
|
colorSecondaryHover: string;
|
|
527
530
|
colorSecondaryPressed: string;
|
|
@@ -806,9 +809,9 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
806
809
|
fontSizeMedium: string;
|
|
807
810
|
fontSizeLarge: string;
|
|
808
811
|
opacityDisabled: string;
|
|
809
|
-
colorOpacitySecondary:
|
|
810
|
-
colorOpacitySecondaryHover:
|
|
811
|
-
colorOpacitySecondaryPressed:
|
|
812
|
+
colorOpacitySecondary: string;
|
|
813
|
+
colorOpacitySecondaryHover: string;
|
|
814
|
+
colorOpacitySecondaryPressed: string;
|
|
812
815
|
colorSecondary: string;
|
|
813
816
|
colorSecondaryHover: string;
|
|
814
817
|
colorSecondaryPressed: string;
|
|
@@ -1074,6 +1077,11 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
1074
1077
|
yearFormat: string;
|
|
1075
1078
|
monthFormat: string;
|
|
1076
1079
|
dayFormat: string;
|
|
1080
|
+
yearTypeFormat: string;
|
|
1081
|
+
monthTypeFormat: string;
|
|
1082
|
+
dateFormat: string;
|
|
1083
|
+
dateTimeFormat: string;
|
|
1084
|
+
quarterFormat: string;
|
|
1077
1085
|
clear: string;
|
|
1078
1086
|
now: string;
|
|
1079
1087
|
confirm: string;
|
|
@@ -1082,6 +1090,8 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
1082
1090
|
datePlaceholder: string;
|
|
1083
1091
|
datetimePlaceholder: string;
|
|
1084
1092
|
monthPlaceholder: string;
|
|
1093
|
+
yearPlaceholder: string;
|
|
1094
|
+
quarterPlaceholder: string;
|
|
1085
1095
|
startDatePlaceholder: string;
|
|
1086
1096
|
endDatePlaceholder: string;
|
|
1087
1097
|
startDatetimePlaceholder: string;
|
|
@@ -1115,6 +1125,7 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
1115
1125
|
dateArray: import("vue").ComputedRef<DateItem[]>;
|
|
1116
1126
|
monthArray: import("vue").ComputedRef<MonthItem[]>;
|
|
1117
1127
|
yearArray: import("vue").ComputedRef<YearItem[]>;
|
|
1128
|
+
quarterArray: import("vue").ComputedRef<QuarterItem[]>;
|
|
1118
1129
|
calendarYear: import("vue").ComputedRef<string>;
|
|
1119
1130
|
calendarMonth: import("vue").ComputedRef<string>;
|
|
1120
1131
|
weekdays: import("vue").ComputedRef<string[]>;
|
|
@@ -1128,33 +1139,4 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
1128
1139
|
handleSingleShortcutMouseenter: (shortcut: Shortcuts[string]) => void;
|
|
1129
1140
|
handleSingleShortcutClick: (shortcut: Shortcuts[string]) => void;
|
|
1130
1141
|
};
|
|
1131
|
-
|
|
1132
|
-
var props: {
|
|
1133
|
-
readonly actions: {
|
|
1134
|
-
readonly type: PropType<string[]>;
|
|
1135
|
-
readonly default: () => string[];
|
|
1136
|
-
};
|
|
1137
|
-
readonly active: BooleanConstructor;
|
|
1138
|
-
readonly dateFormat: {
|
|
1139
|
-
readonly type: StringConstructor;
|
|
1140
|
-
readonly default: "yyyy-MM-dd";
|
|
1141
|
-
};
|
|
1142
|
-
readonly timeFormat: {
|
|
1143
|
-
readonly type: StringConstructor;
|
|
1144
|
-
readonly default: "HH:mm:ss";
|
|
1145
|
-
};
|
|
1146
|
-
readonly value: {
|
|
1147
|
-
readonly type: PropType<import("../interface").Value | null>;
|
|
1148
|
-
readonly default: null;
|
|
1149
|
-
};
|
|
1150
|
-
readonly shortcuts: PropType<Shortcuts>;
|
|
1151
|
-
readonly onConfirm: FunctionConstructor;
|
|
1152
|
-
readonly onClose: PropType<import("../interface").OnClose>;
|
|
1153
|
-
readonly onTabOut: FunctionConstructor;
|
|
1154
|
-
readonly onUpdateValue: {
|
|
1155
|
-
readonly type: PropType<import("../interface").OnPanelUpdateValue>;
|
|
1156
|
-
readonly required: true;
|
|
1157
|
-
};
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
export { useCalendar };
|
|
1142
|
+
export { useCalendar, useCalendarProps };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ref, computed, inject, watch } from 'vue';
|
|
2
|
-
import { addMonths, addYears, isSameMonth, getTime, format, set, getYear, getMonth, getDate, isValid, startOfDay, startOfSecond, startOfMonth, startOfYear } from 'date-fns';
|
|
3
|
-
import { dateArray, monthArray, strictParse, yearArray } from '../utils';
|
|
4
|
-
import { usePanelCommon } from './use-panel-common';
|
|
2
|
+
import { addMonths, addYears, isSameMonth, getTime, format, set, getYear, getMonth, getDate, isValid, startOfDay, startOfSecond, startOfMonth, startOfYear, startOfQuarter, setQuarter, setYear } from 'date-fns';
|
|
3
|
+
import { getDefaultTime, dateArray, monthArray, strictParse, yearArray, quarterArray } from '../utils';
|
|
5
4
|
import { datePickerInjectionKey } from '../interface';
|
|
6
|
-
|
|
5
|
+
import { usePanelCommon, usePanelCommonProps } from './use-panel-common';
|
|
6
|
+
const useCalendarProps = Object.assign(Object.assign({}, usePanelCommonProps), { actions: {
|
|
7
7
|
type: Array,
|
|
8
8
|
default: () => ['now', 'clear', 'confirm']
|
|
9
9
|
} });
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
11
11
|
function useCalendar(props, type) {
|
|
12
12
|
const panelCommon = usePanelCommon(props);
|
|
13
|
-
const { isValueInvalidRef, isDateDisabledRef, isDateInvalidRef, isTimeInvalidRef, isDateTimeInvalidRef, isHourDisabledRef, isMinuteDisabledRef, isSecondDisabledRef, localeRef, firstDayOfWeekRef, datePickerSlots,
|
|
13
|
+
const { isValueInvalidRef, isDateDisabledRef, isDateInvalidRef, isTimeInvalidRef, isDateTimeInvalidRef, isHourDisabledRef, isMinuteDisabledRef, isSecondDisabledRef, localeRef, firstDayOfWeekRef, datePickerSlots, scrollPickerColumns
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
15
15
|
} = inject(datePickerInjectionKey);
|
|
16
16
|
const validation = {
|
|
@@ -43,6 +43,9 @@ function useCalendar(props, type) {
|
|
|
43
43
|
const yearArrayRef = computed(() => {
|
|
44
44
|
return yearArray(calendarValueRef.value, props.value, nowRef.value);
|
|
45
45
|
});
|
|
46
|
+
const querterArrayRef = computed(() => {
|
|
47
|
+
return quarterArray(calendarValueRef.value, props.value, nowRef.value);
|
|
48
|
+
});
|
|
46
49
|
const weekdaysRef = computed(() => {
|
|
47
50
|
return dateArrayRef.value.slice(0, 7).map((dateItem) => {
|
|
48
51
|
const { ts } = dateItem;
|
|
@@ -76,6 +79,8 @@ function useCalendar(props, type) {
|
|
|
76
79
|
return getTime(startOfMonth(value));
|
|
77
80
|
if (type === 'year')
|
|
78
81
|
return getTime(startOfYear(value));
|
|
82
|
+
if (type === 'quarter')
|
|
83
|
+
return getTime(startOfQuarter(value));
|
|
79
84
|
return getTime(startOfDay(value));
|
|
80
85
|
}
|
|
81
86
|
function mergedIsDateDisabled(ts) {
|
|
@@ -143,17 +148,30 @@ function useCalendar(props, type) {
|
|
|
143
148
|
else {
|
|
144
149
|
newValue = Date.now();
|
|
145
150
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
scrollYearMonth(newValue);
|
|
151
|
+
if (type === 'datetime' &&
|
|
152
|
+
props.defaultTime !== null &&
|
|
153
|
+
!Array.isArray(props.defaultTime)) {
|
|
154
|
+
const time = getDefaultTime(props.defaultTime);
|
|
155
|
+
if (time) {
|
|
156
|
+
newValue = getTime(set(newValue, time)); // setDate getTime(addMilliseconds(startOfDay(newValue), time))
|
|
157
|
+
}
|
|
154
158
|
}
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
newValue = getTime(dateItem.type === 'quarter' && dateItem.dateObject.quarter
|
|
160
|
+
? setQuarter(setYear(newValue, dateItem.dateObject.year), dateItem.dateObject.quarter)
|
|
161
|
+
: set(newValue, dateItem.dateObject));
|
|
162
|
+
panelCommon.doUpdateValue(sanitizeValue(newValue), type === 'date' || type === 'year');
|
|
163
|
+
switch (type) {
|
|
164
|
+
case 'date':
|
|
165
|
+
case 'year':
|
|
166
|
+
panelCommon.doClose();
|
|
167
|
+
break;
|
|
168
|
+
case 'month':
|
|
169
|
+
panelCommon.disableTransitionOneTick();
|
|
170
|
+
scrollPickerColumns(newValue);
|
|
171
|
+
break;
|
|
172
|
+
case 'quarter':
|
|
173
|
+
scrollPickerColumns(newValue);
|
|
174
|
+
break;
|
|
157
175
|
}
|
|
158
176
|
}
|
|
159
177
|
function deriveDateInputValue(time) {
|
|
@@ -227,7 +245,7 @@ function useCalendar(props, type) {
|
|
|
227
245
|
panelCommon.clearPendingValue();
|
|
228
246
|
handleConfirmClick();
|
|
229
247
|
}
|
|
230
|
-
return Object.assign(Object.assign(Object.assign({ dateArray: dateArrayRef, monthArray: monthArrayRef, yearArray: yearArrayRef, calendarYear: calendarYearRef, calendarMonth: calendarMonthRef, weekdays: weekdaysRef, mergedIsDateDisabled,
|
|
248
|
+
return Object.assign(Object.assign(Object.assign({ dateArray: dateArrayRef, monthArray: monthArrayRef, yearArray: yearArrayRef, quarterArray: querterArrayRef, calendarYear: calendarYearRef, calendarMonth: calendarMonthRef, weekdays: weekdaysRef, mergedIsDateDisabled,
|
|
231
249
|
nextYear,
|
|
232
250
|
prevYear,
|
|
233
251
|
nextMonth,
|
|
@@ -249,5 +267,4 @@ function useCalendar(props, type) {
|
|
|
249
267
|
yearScrollRef,
|
|
250
268
|
scrollbarInstRef });
|
|
251
269
|
}
|
|
252
|
-
useCalendar
|
|
253
|
-
export { useCalendar };
|
|
270
|
+
export { useCalendar, useCalendarProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtractPropTypes } from 'vue';
|
|
2
2
|
import { DateItem } from '../utils';
|
|
3
|
-
import { Shortcuts } from '../interface';
|
|
3
|
+
import type { Shortcuts } from '../interface';
|
|
4
4
|
declare const useDualCalendarProps: {
|
|
5
5
|
readonly actions: {
|
|
6
6
|
readonly type: ArrayConstructor;
|
|
@@ -20,6 +20,7 @@ declare const useDualCalendarProps: {
|
|
|
20
20
|
readonly default: null;
|
|
21
21
|
};
|
|
22
22
|
readonly shortcuts: import("vue").PropType<Shortcuts>;
|
|
23
|
+
readonly defaultTime: import("vue").PropType<import("../interface").DefaultTime>;
|
|
23
24
|
readonly onConfirm: FunctionConstructor;
|
|
24
25
|
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
25
26
|
readonly onTabOut: FunctionConstructor;
|
|
@@ -210,12 +211,14 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
210
211
|
calendarLeftPaddingDatetimerange: string;
|
|
211
212
|
calendarLeftPaddingMonth: string;
|
|
212
213
|
calendarLeftPaddingYear: string;
|
|
214
|
+
calendarLeftPaddingQuarter: string;
|
|
213
215
|
calendarRightPaddingDate: string;
|
|
214
216
|
calendarRightPaddingDatetime: string;
|
|
215
217
|
calendarRightPaddingDaterange: string;
|
|
216
218
|
calendarRightPaddingDatetimerange: string;
|
|
217
219
|
calendarRightPaddingMonth: string;
|
|
218
220
|
calendarRightPaddingYear: string;
|
|
221
|
+
calendarRightPaddingQuarter: string;
|
|
219
222
|
};
|
|
220
223
|
peers: {
|
|
221
224
|
Input: import("../../../_mixins").Theme<"Input", {
|
|
@@ -292,9 +295,9 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
292
295
|
fontSizeMedium: string;
|
|
293
296
|
fontSizeLarge: string;
|
|
294
297
|
opacityDisabled: string;
|
|
295
|
-
colorOpacitySecondary:
|
|
296
|
-
colorOpacitySecondaryHover:
|
|
297
|
-
colorOpacitySecondaryPressed:
|
|
298
|
+
colorOpacitySecondary: string;
|
|
299
|
+
colorOpacitySecondaryHover: string;
|
|
300
|
+
colorOpacitySecondaryPressed: string;
|
|
298
301
|
colorSecondary: string;
|
|
299
302
|
colorSecondaryHover: string;
|
|
300
303
|
colorSecondaryPressed: string;
|
|
@@ -517,9 +520,9 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
517
520
|
fontSizeMedium: string;
|
|
518
521
|
fontSizeLarge: string;
|
|
519
522
|
opacityDisabled: string;
|
|
520
|
-
colorOpacitySecondary:
|
|
521
|
-
colorOpacitySecondaryHover:
|
|
522
|
-
colorOpacitySecondaryPressed:
|
|
523
|
+
colorOpacitySecondary: string;
|
|
524
|
+
colorOpacitySecondaryHover: string;
|
|
525
|
+
colorOpacitySecondaryPressed: string;
|
|
523
526
|
colorSecondary: string;
|
|
524
527
|
colorSecondaryHover: string;
|
|
525
528
|
colorSecondaryPressed: string;
|
|
@@ -804,9 +807,9 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
804
807
|
fontSizeMedium: string;
|
|
805
808
|
fontSizeLarge: string;
|
|
806
809
|
opacityDisabled: string;
|
|
807
|
-
colorOpacitySecondary:
|
|
808
|
-
colorOpacitySecondaryHover:
|
|
809
|
-
colorOpacitySecondaryPressed:
|
|
810
|
+
colorOpacitySecondary: string;
|
|
811
|
+
colorOpacitySecondaryHover: string;
|
|
812
|
+
colorOpacitySecondaryPressed: string;
|
|
810
813
|
colorSecondary: string;
|
|
811
814
|
colorSecondaryHover: string;
|
|
812
815
|
colorSecondaryPressed: string;
|
|
@@ -1072,6 +1075,11 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
1072
1075
|
yearFormat: string;
|
|
1073
1076
|
monthFormat: string;
|
|
1074
1077
|
dayFormat: string;
|
|
1078
|
+
yearTypeFormat: string;
|
|
1079
|
+
monthTypeFormat: string;
|
|
1080
|
+
dateFormat: string;
|
|
1081
|
+
dateTimeFormat: string;
|
|
1082
|
+
quarterFormat: string;
|
|
1075
1083
|
clear: string;
|
|
1076
1084
|
now: string;
|
|
1077
1085
|
confirm: string;
|
|
@@ -1080,6 +1088,8 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
1080
1088
|
datePlaceholder: string;
|
|
1081
1089
|
datetimePlaceholder: string;
|
|
1082
1090
|
monthPlaceholder: string;
|
|
1091
|
+
yearPlaceholder: string;
|
|
1092
|
+
quarterPlaceholder: string;
|
|
1083
1093
|
startDatePlaceholder: string;
|
|
1084
1094
|
endDatePlaceholder: string;
|
|
1085
1095
|
startDatetimePlaceholder: string;
|
|
@@ -1128,33 +1138,4 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
1128
1138
|
handleRangeShortcutMouseenter: (shortcut: Shortcuts[string]) => void;
|
|
1129
1139
|
handleRangeShortcutClick: (shortcut: Shortcuts[string]) => void;
|
|
1130
1140
|
};
|
|
1131
|
-
|
|
1132
|
-
var props: {
|
|
1133
|
-
readonly actions: {
|
|
1134
|
-
readonly type: ArrayConstructor;
|
|
1135
|
-
readonly default: () => string[];
|
|
1136
|
-
};
|
|
1137
|
-
readonly active: BooleanConstructor;
|
|
1138
|
-
readonly dateFormat: {
|
|
1139
|
-
readonly type: StringConstructor;
|
|
1140
|
-
readonly default: "yyyy-MM-dd";
|
|
1141
|
-
};
|
|
1142
|
-
readonly timeFormat: {
|
|
1143
|
-
readonly type: StringConstructor;
|
|
1144
|
-
readonly default: "HH:mm:ss";
|
|
1145
|
-
};
|
|
1146
|
-
readonly value: {
|
|
1147
|
-
readonly type: import("vue").PropType<import("../interface").Value | null>;
|
|
1148
|
-
readonly default: null;
|
|
1149
|
-
};
|
|
1150
|
-
readonly shortcuts: import("vue").PropType<Shortcuts>;
|
|
1151
|
-
readonly onConfirm: FunctionConstructor;
|
|
1152
|
-
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
1153
|
-
readonly onTabOut: FunctionConstructor;
|
|
1154
|
-
readonly onUpdateValue: {
|
|
1155
|
-
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
1156
|
-
readonly required: true;
|
|
1157
|
-
};
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
export { useDualCalendar };
|
|
1141
|
+
export { useDualCalendar, useDualCalendarProps };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { inject, computed, watch, ref } from 'vue';
|
|
2
|
-
import { addMonths, format,
|
|
3
|
-
import { dateArray, strictParse } from '../utils';
|
|
4
|
-
import { usePanelCommon } from './use-panel-common';
|
|
2
|
+
import { addMonths, format, getYear, getMonth, startOfMonth, isValid, startOfSecond, startOfDay, set, getDate, getTime } from 'date-fns';
|
|
3
|
+
import { getDefaultTime, dateArray, strictParse } from '../utils';
|
|
5
4
|
import { datePickerInjectionKey } from '../interface';
|
|
6
|
-
|
|
5
|
+
import { usePanelCommon, usePanelCommonProps } from './use-panel-common';
|
|
6
|
+
const useDualCalendarProps = Object.assign(Object.assign({}, usePanelCommonProps), { actions: {
|
|
7
7
|
type: Array,
|
|
8
8
|
default: () => ['clear', 'confirm']
|
|
9
9
|
} });
|
|
@@ -287,8 +287,24 @@ function useDualCalendar(props, type = 'datetime') {
|
|
|
287
287
|
if (typeof startTime !== 'number') {
|
|
288
288
|
startTime = getTime(startTime);
|
|
289
289
|
}
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
let startDefaultTime;
|
|
291
|
+
let endDefaultTime;
|
|
292
|
+
if (type === 'datetimerange') {
|
|
293
|
+
const { defaultTime } = props;
|
|
294
|
+
if (Array.isArray(defaultTime)) {
|
|
295
|
+
startDefaultTime = getDefaultTime(defaultTime[0]);
|
|
296
|
+
endDefaultTime = getDefaultTime(defaultTime[1]);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
startDefaultTime = getDefaultTime(defaultTime);
|
|
300
|
+
endDefaultTime = startDefaultTime;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (startDefaultTime) {
|
|
304
|
+
startTime = getTime(set(startTime, startDefaultTime));
|
|
305
|
+
}
|
|
306
|
+
if (endDefaultTime) {
|
|
307
|
+
endTime = getTime(set(endTime, endDefaultTime));
|
|
292
308
|
}
|
|
293
309
|
panelCommon.doUpdateValue([startTime, endTime], false);
|
|
294
310
|
}
|
|
@@ -467,5 +483,4 @@ function useDualCalendar(props, type = 'datetime') {
|
|
|
467
483
|
handleEndDateInputBlur,
|
|
468
484
|
datePickerSlots, shortcuts: shortcutsRef });
|
|
469
485
|
}
|
|
470
|
-
useDualCalendar
|
|
471
|
-
export { useDualCalendar };
|
|
486
|
+
export { useDualCalendar, useDualCalendarProps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
import { Value, OnPanelUpdateValue, OnClose, Shortcuts } from '../interface';
|
|
2
|
+
import { Value, OnPanelUpdateValue, OnClose, Shortcuts, DefaultTime } from '../interface';
|
|
3
3
|
declare const usePanelCommonProps: {
|
|
4
4
|
readonly active: BooleanConstructor;
|
|
5
5
|
readonly dateFormat: {
|
|
@@ -15,6 +15,7 @@ declare const usePanelCommonProps: {
|
|
|
15
15
|
readonly default: null;
|
|
16
16
|
};
|
|
17
17
|
readonly shortcuts: PropType<Shortcuts>;
|
|
18
|
+
readonly defaultTime: PropType<DefaultTime>;
|
|
18
19
|
readonly onConfirm: FunctionConstructor;
|
|
19
20
|
readonly onClose: PropType<OnClose>;
|
|
20
21
|
readonly onTabOut: FunctionConstructor;
|
|
@@ -176,12 +177,14 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
176
177
|
calendarLeftPaddingDatetimerange: string;
|
|
177
178
|
calendarLeftPaddingMonth: string;
|
|
178
179
|
calendarLeftPaddingYear: string;
|
|
180
|
+
calendarLeftPaddingQuarter: string;
|
|
179
181
|
calendarRightPaddingDate: string;
|
|
180
182
|
calendarRightPaddingDatetime: string;
|
|
181
183
|
calendarRightPaddingDaterange: string;
|
|
182
184
|
calendarRightPaddingDatetimerange: string;
|
|
183
185
|
calendarRightPaddingMonth: string;
|
|
184
186
|
calendarRightPaddingYear: string;
|
|
187
|
+
calendarRightPaddingQuarter: string;
|
|
185
188
|
};
|
|
186
189
|
peers: {
|
|
187
190
|
Input: import("../../../_mixins").Theme<"Input", {
|
|
@@ -258,9 +261,9 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
258
261
|
fontSizeMedium: string;
|
|
259
262
|
fontSizeLarge: string;
|
|
260
263
|
opacityDisabled: string;
|
|
261
|
-
colorOpacitySecondary:
|
|
262
|
-
colorOpacitySecondaryHover:
|
|
263
|
-
colorOpacitySecondaryPressed:
|
|
264
|
+
colorOpacitySecondary: string;
|
|
265
|
+
colorOpacitySecondaryHover: string;
|
|
266
|
+
colorOpacitySecondaryPressed: string;
|
|
264
267
|
colorSecondary: string;
|
|
265
268
|
colorSecondaryHover: string;
|
|
266
269
|
colorSecondaryPressed: string;
|
|
@@ -483,9 +486,9 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
483
486
|
fontSizeMedium: string;
|
|
484
487
|
fontSizeLarge: string;
|
|
485
488
|
opacityDisabled: string;
|
|
486
|
-
colorOpacitySecondary:
|
|
487
|
-
colorOpacitySecondaryHover:
|
|
488
|
-
colorOpacitySecondaryPressed:
|
|
489
|
+
colorOpacitySecondary: string;
|
|
490
|
+
colorOpacitySecondaryHover: string;
|
|
491
|
+
colorOpacitySecondaryPressed: string;
|
|
489
492
|
colorSecondary: string;
|
|
490
493
|
colorSecondaryHover: string;
|
|
491
494
|
colorSecondaryPressed: string;
|
|
@@ -770,9 +773,9 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
770
773
|
fontSizeMedium: string;
|
|
771
774
|
fontSizeLarge: string;
|
|
772
775
|
opacityDisabled: string;
|
|
773
|
-
colorOpacitySecondary:
|
|
774
|
-
colorOpacitySecondaryHover:
|
|
775
|
-
colorOpacitySecondaryPressed:
|
|
776
|
+
colorOpacitySecondary: string;
|
|
777
|
+
colorOpacitySecondaryHover: string;
|
|
778
|
+
colorOpacitySecondaryPressed: string;
|
|
776
779
|
colorSecondary: string;
|
|
777
780
|
colorSecondaryHover: string;
|
|
778
781
|
colorSecondaryPressed: string;
|
|
@@ -1039,6 +1042,11 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
1039
1042
|
yearFormat: string;
|
|
1040
1043
|
monthFormat: string;
|
|
1041
1044
|
dayFormat: string;
|
|
1045
|
+
yearTypeFormat: string;
|
|
1046
|
+
monthTypeFormat: string;
|
|
1047
|
+
dateFormat: string;
|
|
1048
|
+
dateTimeFormat: string;
|
|
1049
|
+
quarterFormat: string;
|
|
1042
1050
|
clear: string;
|
|
1043
1051
|
now: string;
|
|
1044
1052
|
confirm: string;
|
|
@@ -1047,6 +1055,8 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
1047
1055
|
datePlaceholder: string;
|
|
1048
1056
|
datetimePlaceholder: string;
|
|
1049
1057
|
monthPlaceholder: string;
|
|
1058
|
+
yearPlaceholder: string;
|
|
1059
|
+
quarterPlaceholder: string;
|
|
1050
1060
|
startDatePlaceholder: string;
|
|
1051
1061
|
endDatePlaceholder: string;
|
|
1052
1062
|
startDatetimePlaceholder: string;
|
|
@@ -1070,29 +1080,4 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
1070
1080
|
getShortcutValue: (shortcut: Shortcuts[string]) => number | [number, number];
|
|
1071
1081
|
handleShortcutMouseleave: () => void;
|
|
1072
1082
|
};
|
|
1073
|
-
|
|
1074
|
-
var props: {
|
|
1075
|
-
readonly active: BooleanConstructor;
|
|
1076
|
-
readonly dateFormat: {
|
|
1077
|
-
readonly type: StringConstructor;
|
|
1078
|
-
readonly default: "yyyy-MM-dd";
|
|
1079
|
-
};
|
|
1080
|
-
readonly timeFormat: {
|
|
1081
|
-
readonly type: StringConstructor;
|
|
1082
|
-
readonly default: "HH:mm:ss";
|
|
1083
|
-
};
|
|
1084
|
-
readonly value: {
|
|
1085
|
-
readonly type: PropType<Value | null>;
|
|
1086
|
-
readonly default: null;
|
|
1087
|
-
};
|
|
1088
|
-
readonly shortcuts: PropType<Shortcuts>;
|
|
1089
|
-
readonly onConfirm: FunctionConstructor;
|
|
1090
|
-
readonly onClose: PropType<OnClose>;
|
|
1091
|
-
readonly onTabOut: FunctionConstructor;
|
|
1092
|
-
readonly onUpdateValue: {
|
|
1093
|
-
readonly type: PropType<OnPanelUpdateValue>;
|
|
1094
|
-
readonly required: true;
|
|
1095
|
-
};
|
|
1096
|
-
};
|
|
1097
|
-
}
|
|
1098
|
-
export { usePanelCommon };
|
|
1083
|
+
export { usePanelCommon, usePanelCommonProps };
|
|
@@ -18,6 +18,7 @@ const usePanelCommonProps = {
|
|
|
18
18
|
default: null
|
|
19
19
|
},
|
|
20
20
|
shortcuts: Object,
|
|
21
|
+
defaultTime: [Number, String, Array],
|
|
21
22
|
onConfirm: Function,
|
|
22
23
|
onClose: Function,
|
|
23
24
|
onTabOut: Function,
|
|
@@ -139,5 +140,4 @@ function usePanelCommon(props) {
|
|
|
139
140
|
handleShortcutMouseleave: restorePendingValue
|
|
140
141
|
};
|
|
141
142
|
}
|
|
142
|
-
usePanelCommon
|
|
143
|
-
export { usePanelCommon };
|
|
143
|
+
export { usePanelCommon, usePanelCommonProps };
|