naive-ui 2.21.5 → 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 +33 -33
- package/es/button/src/Button.js +103 -102
- package/es/button/src/styles/button.cssr.js +83 -80
- package/es/button/styles/light.js +1 -1
- package/es/calendar/src/Calendar.d.ts +2 -0
- 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/config-provider/src/ConfigProvider.d.ts +6 -0
- package/es/data-table/src/DataTable.js +7 -13
- package/es/data-table/src/MainTable.js +2 -3
- package/es/data-table/src/TableParts/Body.d.ts +15 -4
- package/es/data-table/src/TableParts/Body.js +80 -28
- 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 +4 -3
- 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 +3 -1
- package/es/data-table/styles/_common.js +1 -1
- package/es/date-picker/src/DatePicker.d.ts +25 -1
- package/es/date-picker/src/DatePicker.js +16 -7
- package/es/date-picker/src/config.d.ts +1 -1
- package/es/date-picker/src/interface.d.ts +2 -1
- package/es/date-picker/src/panel/date.d.ts +9 -1
- package/es/date-picker/src/panel/date.js +2 -2
- package/es/date-picker/src/panel/daterange.d.ts +7 -0
- package/es/date-picker/src/panel/daterange.js +2 -2
- package/es/date-picker/src/panel/datetime.d.ts +9 -7
- package/es/date-picker/src/panel/datetime.js +2 -2
- package/es/date-picker/src/panel/datetimerange.d.ts +7 -0
- package/es/date-picker/src/panel/datetimerange.js +2 -2
- package/es/date-picker/src/panel/month.d.ts +13 -11
- package/es/date-picker/src/panel/month.js +23 -12
- package/es/date-picker/src/panel/use-calendar.d.ts +11 -34
- package/es/date-picker/src/panel/use-calendar.js +35 -18
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +7 -31
- package/es/date-picker/src/panel/use-dual-calendar.js +23 -8
- package/es/date-picker/src/panel/use-panel-common.d.ts +7 -27
- 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 +4 -0
- package/es/image/src/Image.js +8 -12
- package/es/locales/common/deDE.js +2 -0
- package/es/locales/common/enUS.d.ts +2 -0
- package/es/locales/common/enUS.js +2 -0
- package/es/locales/common/frFR.js +3 -0
- package/es/locales/common/idID.js +2 -0
- package/es/locales/common/jaJP.js +2 -0
- package/es/locales/common/nbNO.js +2 -0
- package/es/locales/common/ruRU.js +2 -0
- package/es/locales/common/ukUA.js +2 -0
- package/es/locales/common/zhCN.js +2 -0
- package/es/locales/common/zhTW.d.ts +3 -0
- package/es/locales/common/zhTW.js +100 -0
- package/es/locales/date/zhTW.d.ts +3 -0
- package/es/locales/date/zhTW.js +6 -0
- package/es/locales/index.d.ts +2 -0
- package/es/locales/index.js +2 -0
- package/es/page-header/src/PageHeader.js +3 -3
- package/es/page-header/src/styles/index.cssr.js +2 -4
- 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/tabs/src/styles/index.cssr.js +1 -0
- package/es/tag/src/styles/index.cssr.js +1 -1
- 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/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 +33 -33
- package/lib/button/src/Button.js +103 -102
- package/lib/button/src/styles/button.cssr.js +83 -80
- package/lib/button/styles/light.js +1 -1
- package/lib/calendar/src/Calendar.d.ts +2 -0
- 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/config-provider/src/ConfigProvider.d.ts +6 -0
- package/lib/data-table/src/DataTable.js +6 -12
- package/lib/data-table/src/MainTable.js +1 -2
- package/lib/data-table/src/TableParts/Body.d.ts +15 -4
- package/lib/data-table/src/TableParts/Body.js +78 -26
- 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 +4 -3
- 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 +3 -1
- package/lib/data-table/styles/_common.js +1 -1
- package/lib/date-picker/src/DatePicker.d.ts +25 -1
- package/lib/date-picker/src/DatePicker.js +16 -7
- package/lib/date-picker/src/config.d.ts +1 -1
- package/lib/date-picker/src/interface.d.ts +2 -1
- package/lib/date-picker/src/panel/date.d.ts +9 -1
- package/lib/date-picker/src/panel/date.js +1 -1
- package/lib/date-picker/src/panel/daterange.d.ts +7 -0
- package/lib/date-picker/src/panel/daterange.js +1 -1
- package/lib/date-picker/src/panel/datetime.d.ts +9 -7
- package/lib/date-picker/src/panel/datetime.js +1 -1
- package/lib/date-picker/src/panel/datetimerange.d.ts +7 -0
- package/lib/date-picker/src/panel/datetimerange.js +2 -2
- package/lib/date-picker/src/panel/month.d.ts +13 -11
- package/lib/date-picker/src/panel/month.js +23 -12
- package/lib/date-picker/src/panel/use-calendar.d.ts +11 -34
- package/lib/date-picker/src/panel/use-calendar.js +34 -16
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +7 -31
- package/lib/date-picker/src/panel/use-dual-calendar.js +22 -6
- package/lib/date-picker/src/panel/use-panel-common.d.ts +7 -27
- 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 +4 -0
- package/lib/image/src/Image.js +7 -11
- package/lib/locales/common/deDE.js +2 -0
- package/lib/locales/common/enUS.d.ts +2 -0
- package/lib/locales/common/enUS.js +2 -0
- package/lib/locales/common/frFR.js +3 -0
- package/lib/locales/common/idID.js +2 -0
- package/lib/locales/common/jaJP.js +2 -0
- package/lib/locales/common/nbNO.js +2 -0
- package/lib/locales/common/ruRU.js +2 -0
- package/lib/locales/common/ukUA.js +2 -0
- package/lib/locales/common/zhCN.js +2 -0
- package/lib/locales/common/zhTW.d.ts +3 -0
- package/lib/locales/common/zhTW.js +102 -0
- package/lib/locales/date/zhTW.d.ts +3 -0
- package/lib/locales/date/zhTW.js +11 -0
- package/lib/locales/index.d.ts +2 -0
- package/lib/locales/index.js +5 -1
- package/lib/page-header/src/PageHeader.js +3 -3
- package/lib/page-header/src/styles/index.cssr.js +2 -4
- 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/tabs/src/styles/index.cssr.js +1 -0
- package/lib/tag/src/styles/index.cssr.js +1 -1
- 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/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +4 -3
- package/web-types.json +25 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VNode, PropType } from 'vue';
|
|
2
|
-
import type { MonthItem, YearItem } from '../utils';
|
|
2
|
+
import type { MonthItem, YearItem, QuarterItem } from '../utils';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
type: {
|
|
5
|
-
type: PropType<"month" | "year">;
|
|
5
|
+
type: PropType<"month" | "year" | "quarter">;
|
|
6
6
|
required: true;
|
|
7
7
|
};
|
|
8
8
|
actions: {
|
|
@@ -23,6 +23,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
23
23
|
readonly default: null;
|
|
24
24
|
};
|
|
25
25
|
shortcuts: PropType<import("../interface").Shortcuts>;
|
|
26
|
+
defaultTime: PropType<import("../interface").DefaultTime>;
|
|
26
27
|
onConfirm: FunctionConstructor;
|
|
27
28
|
onClose: PropType<import("../interface").OnClose>;
|
|
28
29
|
onTabOut: FunctionConstructor;
|
|
@@ -31,8 +32,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
31
32
|
readonly required: true;
|
|
32
33
|
};
|
|
33
34
|
}, {
|
|
34
|
-
renderItem: (item: YearItem | MonthItem, i: number, mergedClsPrefix: string) => VNode;
|
|
35
|
-
handleDateClick: (dateItem: import("../utils").DateItem | MonthItem | YearItem) => void;
|
|
35
|
+
renderItem: (item: YearItem | MonthItem | QuarterItem, i: number, mergedClsPrefix: string) => VNode;
|
|
36
|
+
handleDateClick: (dateItem: import("../utils").DateItem | MonthItem | YearItem | QuarterItem) => void;
|
|
36
37
|
handleDateInputBlur: () => void;
|
|
37
38
|
handleDateInput: (value: string) => void;
|
|
38
39
|
handleTimePickerChange: (value: number | null) => void;
|
|
@@ -149,12 +150,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
149
150
|
fontWeight: string;
|
|
150
151
|
fontWeightStrong: string;
|
|
151
152
|
cubicBezierEaseInOut: string;
|
|
152
|
-
/**
|
|
153
|
-
* Month Panel
|
|
154
|
-
* Update picker value on:
|
|
155
|
-
* 1. item click
|
|
156
|
-
* 2. clear click
|
|
157
|
-
*/
|
|
158
153
|
cubicBezierEaseOut: string;
|
|
159
154
|
cubicBezierEaseIn: string;
|
|
160
155
|
borderRadius: string;
|
|
@@ -221,12 +216,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
221
216
|
calendarLeftPaddingDatetimerange: string;
|
|
222
217
|
calendarLeftPaddingMonth: string;
|
|
223
218
|
calendarLeftPaddingYear: string;
|
|
219
|
+
calendarLeftPaddingQuarter: string;
|
|
224
220
|
calendarRightPaddingDate: string;
|
|
225
221
|
calendarRightPaddingDatetime: string;
|
|
226
222
|
calendarRightPaddingDaterange: string;
|
|
227
223
|
calendarRightPaddingDatetimerange: string;
|
|
228
224
|
calendarRightPaddingMonth: string;
|
|
229
225
|
calendarRightPaddingYear: string;
|
|
226
|
+
calendarRightPaddingQuarter: string;
|
|
230
227
|
};
|
|
231
228
|
peers: {
|
|
232
229
|
Input: import("../../../_mixins").Theme<"Input", {
|
|
@@ -1087,6 +1084,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1087
1084
|
monthTypeFormat: string;
|
|
1088
1085
|
dateFormat: string;
|
|
1089
1086
|
dateTimeFormat: string;
|
|
1087
|
+
quarterFormat: string;
|
|
1090
1088
|
clear: string;
|
|
1091
1089
|
now: string;
|
|
1092
1090
|
confirm: string;
|
|
@@ -1096,6 +1094,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1096
1094
|
datetimePlaceholder: string;
|
|
1097
1095
|
monthPlaceholder: string;
|
|
1098
1096
|
yearPlaceholder: string;
|
|
1097
|
+
quarterPlaceholder: string;
|
|
1099
1098
|
startDatePlaceholder: string;
|
|
1100
1099
|
endDatePlaceholder: string;
|
|
1101
1100
|
startDatetimePlaceholder: string;
|
|
@@ -1129,6 +1128,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1129
1128
|
dateArray: import("vue").ComputedRef<import("../utils").DateItem[]>;
|
|
1130
1129
|
monthArray: import("vue").ComputedRef<MonthItem[]>;
|
|
1131
1130
|
yearArray: import("vue").ComputedRef<YearItem[]>;
|
|
1131
|
+
quarterArray: import("vue").ComputedRef<QuarterItem[]>;
|
|
1132
1132
|
calendarYear: import("vue").ComputedRef<string>;
|
|
1133
1133
|
calendarMonth: import("vue").ComputedRef<string>;
|
|
1134
1134
|
weekdays: import("vue").ComputedRef<string[]>;
|
|
@@ -1149,12 +1149,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1149
1149
|
timeFormat?: unknown;
|
|
1150
1150
|
value?: unknown;
|
|
1151
1151
|
shortcuts?: unknown;
|
|
1152
|
+
defaultTime?: unknown;
|
|
1152
1153
|
onConfirm?: unknown;
|
|
1153
1154
|
onClose?: unknown;
|
|
1154
1155
|
onTabOut?: unknown;
|
|
1155
1156
|
onUpdateValue?: unknown;
|
|
1156
1157
|
} & {
|
|
1157
|
-
type: "month" | "year";
|
|
1158
|
+
type: "month" | "year" | "quarter";
|
|
1158
1159
|
value: import("../interface").Value | null;
|
|
1159
1160
|
active: boolean;
|
|
1160
1161
|
dateFormat: string;
|
|
@@ -1165,6 +1166,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1165
1166
|
onTabOut?: Function | undefined;
|
|
1166
1167
|
onClose?: import("../interface").OnClose | undefined;
|
|
1167
1168
|
onConfirm?: Function | undefined;
|
|
1169
|
+
defaultTime?: import("../interface").DefaultTime | undefined;
|
|
1168
1170
|
shortcuts?: import("../interface").Shortcuts | undefined;
|
|
1169
1171
|
}>, {
|
|
1170
1172
|
value: import("../interface").Value | null;
|
|
@@ -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", {
|
|
@@ -1078,6 +1081,7 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
1078
1081
|
monthTypeFormat: string;
|
|
1079
1082
|
dateFormat: string;
|
|
1080
1083
|
dateTimeFormat: string;
|
|
1084
|
+
quarterFormat: string;
|
|
1081
1085
|
clear: string;
|
|
1082
1086
|
now: string;
|
|
1083
1087
|
confirm: string;
|
|
@@ -1087,6 +1091,7 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
1087
1091
|
datetimePlaceholder: string;
|
|
1088
1092
|
monthPlaceholder: string;
|
|
1089
1093
|
yearPlaceholder: string;
|
|
1094
|
+
quarterPlaceholder: string;
|
|
1090
1095
|
startDatePlaceholder: string;
|
|
1091
1096
|
endDatePlaceholder: string;
|
|
1092
1097
|
startDatetimePlaceholder: string;
|
|
@@ -1120,6 +1125,7 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
1120
1125
|
dateArray: import("vue").ComputedRef<DateItem[]>;
|
|
1121
1126
|
monthArray: import("vue").ComputedRef<MonthItem[]>;
|
|
1122
1127
|
yearArray: import("vue").ComputedRef<YearItem[]>;
|
|
1128
|
+
quarterArray: import("vue").ComputedRef<QuarterItem[]>;
|
|
1123
1129
|
calendarYear: import("vue").ComputedRef<string>;
|
|
1124
1130
|
calendarMonth: import("vue").ComputedRef<string>;
|
|
1125
1131
|
weekdays: import("vue").ComputedRef<string[]>;
|
|
@@ -1133,33 +1139,4 @@ declare function useCalendar(props: ExtractPropTypes<typeof useCalendarProps>, t
|
|
|
1133
1139
|
handleSingleShortcutMouseenter: (shortcut: Shortcuts[string]) => void;
|
|
1134
1140
|
handleSingleShortcutClick: (shortcut: Shortcuts[string]) => void;
|
|
1135
1141
|
};
|
|
1136
|
-
|
|
1137
|
-
var props: {
|
|
1138
|
-
readonly actions: {
|
|
1139
|
-
readonly type: PropType<string[]>;
|
|
1140
|
-
readonly default: () => string[];
|
|
1141
|
-
};
|
|
1142
|
-
readonly active: BooleanConstructor;
|
|
1143
|
-
readonly dateFormat: {
|
|
1144
|
-
readonly type: StringConstructor;
|
|
1145
|
-
readonly default: "yyyy-MM-dd";
|
|
1146
|
-
};
|
|
1147
|
-
readonly timeFormat: {
|
|
1148
|
-
readonly type: StringConstructor;
|
|
1149
|
-
readonly default: "HH:mm:ss";
|
|
1150
|
-
};
|
|
1151
|
-
readonly value: {
|
|
1152
|
-
readonly type: PropType<import("../interface").Value | null>;
|
|
1153
|
-
readonly default: null;
|
|
1154
|
-
};
|
|
1155
|
-
readonly shortcuts: PropType<Shortcuts>;
|
|
1156
|
-
readonly onConfirm: FunctionConstructor;
|
|
1157
|
-
readonly onClose: PropType<import("../interface").OnClose>;
|
|
1158
|
-
readonly onTabOut: FunctionConstructor;
|
|
1159
|
-
readonly onUpdateValue: {
|
|
1160
|
-
readonly type: PropType<import("../interface").OnPanelUpdateValue>;
|
|
1161
|
-
readonly required: true;
|
|
1162
|
-
};
|
|
1163
|
-
};
|
|
1164
|
-
}
|
|
1165
|
-
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", {
|
|
@@ -1076,6 +1079,7 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
1076
1079
|
monthTypeFormat: string;
|
|
1077
1080
|
dateFormat: string;
|
|
1078
1081
|
dateTimeFormat: string;
|
|
1082
|
+
quarterFormat: string;
|
|
1079
1083
|
clear: string;
|
|
1080
1084
|
now: string;
|
|
1081
1085
|
confirm: string;
|
|
@@ -1085,6 +1089,7 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
1085
1089
|
datetimePlaceholder: string;
|
|
1086
1090
|
monthPlaceholder: string;
|
|
1087
1091
|
yearPlaceholder: string;
|
|
1092
|
+
quarterPlaceholder: string;
|
|
1088
1093
|
startDatePlaceholder: string;
|
|
1089
1094
|
endDatePlaceholder: string;
|
|
1090
1095
|
startDatetimePlaceholder: string;
|
|
@@ -1133,33 +1138,4 @@ declare function useDualCalendar(props: ExtractPropTypes<typeof useDualCalendarP
|
|
|
1133
1138
|
handleRangeShortcutMouseenter: (shortcut: Shortcuts[string]) => void;
|
|
1134
1139
|
handleRangeShortcutClick: (shortcut: Shortcuts[string]) => void;
|
|
1135
1140
|
};
|
|
1136
|
-
|
|
1137
|
-
var props: {
|
|
1138
|
-
readonly actions: {
|
|
1139
|
-
readonly type: ArrayConstructor;
|
|
1140
|
-
readonly default: () => string[];
|
|
1141
|
-
};
|
|
1142
|
-
readonly active: BooleanConstructor;
|
|
1143
|
-
readonly dateFormat: {
|
|
1144
|
-
readonly type: StringConstructor;
|
|
1145
|
-
readonly default: "yyyy-MM-dd";
|
|
1146
|
-
};
|
|
1147
|
-
readonly timeFormat: {
|
|
1148
|
-
readonly type: StringConstructor;
|
|
1149
|
-
readonly default: "HH:mm:ss";
|
|
1150
|
-
};
|
|
1151
|
-
readonly value: {
|
|
1152
|
-
readonly type: import("vue").PropType<import("../interface").Value | null>;
|
|
1153
|
-
readonly default: null;
|
|
1154
|
-
};
|
|
1155
|
-
readonly shortcuts: import("vue").PropType<Shortcuts>;
|
|
1156
|
-
readonly onConfirm: FunctionConstructor;
|
|
1157
|
-
readonly onClose: import("vue").PropType<import("../interface").OnClose>;
|
|
1158
|
-
readonly onTabOut: FunctionConstructor;
|
|
1159
|
-
readonly onUpdateValue: {
|
|
1160
|
-
readonly type: import("vue").PropType<import("../interface").OnPanelUpdateValue>;
|
|
1161
|
-
readonly required: true;
|
|
1162
|
-
};
|
|
1163
|
-
};
|
|
1164
|
-
}
|
|
1165
|
-
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", {
|
|
@@ -1043,6 +1046,7 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
1043
1046
|
monthTypeFormat: string;
|
|
1044
1047
|
dateFormat: string;
|
|
1045
1048
|
dateTimeFormat: string;
|
|
1049
|
+
quarterFormat: string;
|
|
1046
1050
|
clear: string;
|
|
1047
1051
|
now: string;
|
|
1048
1052
|
confirm: string;
|
|
@@ -1052,6 +1056,7 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
1052
1056
|
datetimePlaceholder: string;
|
|
1053
1057
|
monthPlaceholder: string;
|
|
1054
1058
|
yearPlaceholder: string;
|
|
1059
|
+
quarterPlaceholder: string;
|
|
1055
1060
|
startDatePlaceholder: string;
|
|
1056
1061
|
endDatePlaceholder: string;
|
|
1057
1062
|
startDatetimePlaceholder: string;
|
|
@@ -1075,29 +1080,4 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
|
|
|
1075
1080
|
getShortcutValue: (shortcut: Shortcuts[string]) => number | [number, number];
|
|
1076
1081
|
handleShortcutMouseleave: () => void;
|
|
1077
1082
|
};
|
|
1078
|
-
|
|
1079
|
-
var props: {
|
|
1080
|
-
readonly active: BooleanConstructor;
|
|
1081
|
-
readonly dateFormat: {
|
|
1082
|
-
readonly type: StringConstructor;
|
|
1083
|
-
readonly default: "yyyy-MM-dd";
|
|
1084
|
-
};
|
|
1085
|
-
readonly timeFormat: {
|
|
1086
|
-
readonly type: StringConstructor;
|
|
1087
|
-
readonly default: "HH:mm:ss";
|
|
1088
|
-
};
|
|
1089
|
-
readonly value: {
|
|
1090
|
-
readonly type: PropType<Value | null>;
|
|
1091
|
-
readonly default: null;
|
|
1092
|
-
};
|
|
1093
|
-
readonly shortcuts: PropType<Shortcuts>;
|
|
1094
|
-
readonly onConfirm: FunctionConstructor;
|
|
1095
|
-
readonly onClose: PropType<OnClose>;
|
|
1096
|
-
readonly onTabOut: FunctionConstructor;
|
|
1097
|
-
readonly onUpdateValue: {
|
|
1098
|
-
readonly type: PropType<OnPanelUpdateValue>;
|
|
1099
|
-
readonly required: true;
|
|
1100
|
-
};
|
|
1101
|
-
};
|
|
1102
|
-
}
|
|
1103
|
-
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 };
|
|
@@ -21,7 +21,7 @@ export interface MonthItem {
|
|
|
21
21
|
month: number;
|
|
22
22
|
year: number;
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
isCurrent: boolean;
|
|
25
25
|
selected: boolean;
|
|
26
26
|
ts: number;
|
|
27
27
|
}
|
|
@@ -30,7 +30,17 @@ export interface YearItem {
|
|
|
30
30
|
dateObject: {
|
|
31
31
|
year: number;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
isCurrent: boolean;
|
|
34
|
+
selected: boolean;
|
|
35
|
+
ts: number;
|
|
36
|
+
}
|
|
37
|
+
export interface QuarterItem {
|
|
38
|
+
type: 'quarter';
|
|
39
|
+
dateObject: {
|
|
40
|
+
quarter: number;
|
|
41
|
+
year: number;
|
|
42
|
+
};
|
|
43
|
+
isCurrent: boolean;
|
|
34
44
|
selected: boolean;
|
|
35
45
|
ts: number;
|
|
36
46
|
}
|
|
@@ -40,8 +50,14 @@ export interface YearItem {
|
|
|
40
50
|
*/
|
|
41
51
|
declare function dateArray(monthTs: number, valueTs: number | [number, number] | null, currentTs: number, startDay: 0 | 1 | 2 | 3 | 4 | 5 | 6, strip?: boolean): DateItem[];
|
|
42
52
|
declare function monthArray(monthTs: number, valueTs: number | [number, number] | null, currentTs: number): MonthItem[];
|
|
53
|
+
declare function quarterArray(quarterTs: number, valueTs: number | [number, number] | null, currentTs: number): QuarterItem[];
|
|
43
54
|
declare function yearArray(yearTs: number, valueTs: number | [number, number] | null, currentTs: number): YearItem[];
|
|
44
55
|
declare function strictParse(string: string, pattern: string, backup: Date, option: {
|
|
45
56
|
locale: Locale;
|
|
46
57
|
}): Date;
|
|
47
|
-
|
|
58
|
+
declare function getDefaultTime(timeValue: string | undefined): {
|
|
59
|
+
hours: number;
|
|
60
|
+
minutes: number;
|
|
61
|
+
seconds: number;
|
|
62
|
+
} | undefined;
|
|
63
|
+
export { dateArray, monthArray, yearArray, quarterArray, strictParse, getDerivedTimeFromKeyboardEvent, getDefaultTime };
|