@mezzanine-ui/core 0.13.10 → 0.13.12
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/_internal/input-check/index.d.ts +2 -2
- package/_internal/input-check/inputCheck.d.ts +12 -12
- package/_internal/input-check/inputCheck.js +9 -9
- package/_internal/input-check/inputCheckGroup.d.ts +7 -7
- package/_internal/input-check/inputCheckGroup.js +4 -4
- package/_internal/input-trigger-popper/index.d.ts +1 -1
- package/_internal/input-trigger-popper/inputTriggerPopper.d.ts +4 -4
- package/_internal/input-trigger-popper/inputTriggerPopper.js +3 -3
- package/_internal/overlay-with-slide-fade/index.d.ts +1 -1
- package/_internal/overlay-with-slide-fade/overlayWithSlideFade.d.ts +4 -4
- package/_internal/overlay-with-slide-fade/overlayWithSlideFade.js +3 -3
- package/accordion/accordion.d.ts +13 -13
- package/accordion/accordion.js +12 -12
- package/accordion/index.d.ts +1 -1
- package/alert/alert.d.ts +15 -15
- package/alert/alert.js +12 -12
- package/alert/index.d.ts +1 -1
- package/app-bar/appBar.d.ts +8 -8
- package/app-bar/appBar.js +5 -5
- package/app-bar/appBarBrand.d.ts +4 -4
- package/app-bar/appBarBrand.js +3 -3
- package/app-bar/appBarMain.d.ts +4 -4
- package/app-bar/appBarMain.js +3 -3
- package/app-bar/appBarSupport.d.ts +4 -4
- package/app-bar/appBarSupport.js +3 -3
- package/app-bar/index.d.ts +4 -4
- package/badge/badge.d.ts +7 -7
- package/badge/badge.js +6 -6
- package/badge/index.d.ts +1 -1
- package/button/button.d.ts +17 -17
- package/button/button.js +11 -11
- package/button/buttonGroup.d.ts +18 -18
- package/button/buttonGroup.js +15 -15
- package/button/index.d.ts +2 -2
- package/calendar/calendar.d.ts +47 -47
- package/calendar/calendar.js +61 -61
- package/calendar/index.d.ts +2 -2
- package/calendar/typings.d.ts +43 -43
- package/calendarMethodsDayjs/index.d.ts +3 -3
- package/calendarMethodsDayjs/index.js +97 -97
- package/calendarMethodsLuxon/index.d.ts +3 -3
- package/calendarMethodsLuxon/index.js +100 -100
- package/calendarMethodsMoment/index.d.ts +3 -3
- package/calendarMethodsMoment/index.js +112 -112
- package/card/card.d.ts +7 -7
- package/card/card.js +6 -6
- package/card/cardActions.d.ts +4 -4
- package/card/cardActions.js +3 -3
- package/card/index.d.ts +2 -2
- package/checkbox/checkbox.d.ts +15 -15
- package/checkbox/checkbox.js +6 -6
- package/checkbox/index.d.ts +1 -1
- package/date-range-picker/dateRangePicker.d.ts +11 -11
- package/date-range-picker/dateRangePicker.js +10 -10
- package/date-range-picker/index.d.ts +1 -1
- package/date-time-picker/dateTimePicker.d.ts +9 -9
- package/date-time-picker/dateTimePicker.js +8 -8
- package/date-time-picker/index.d.ts +1 -1
- package/drawer/drawer.d.ts +10 -10
- package/drawer/drawer.js +8 -8
- package/drawer/index.d.ts +1 -1
- package/empty/empty.d.ts +8 -8
- package/empty/empty.js +7 -7
- package/empty/index.d.ts +1 -1
- package/form/form.d.ts +1 -1
- package/form/formField.d.ts +18 -18
- package/form/formField.js +16 -16
- package/form/index.d.ts +2 -2
- package/icon/icon.d.ts +15 -15
- package/icon/icon.js +38 -38
- package/icon/index.d.ts +1 -1
- package/input/index.d.ts +1 -1
- package/input/input.d.ts +8 -8
- package/input/input.js +5 -5
- package/loading/index.d.ts +1 -1
- package/loading/loading.d.ts +8 -8
- package/loading/loading.js +7 -7
- package/menu/index.d.ts +4 -4
- package/menu/menu.d.ts +13 -13
- package/menu/menu.js +13 -13
- package/menu/menuDivider.d.ts +4 -4
- package/menu/menuDivider.js +3 -3
- package/menu/menuItem.d.ts +8 -8
- package/menu/menuItem.js +7 -7
- package/menu/menuItemGroup.d.ts +6 -6
- package/menu/menuItemGroup.js +5 -5
- package/message/index.d.ts +1 -1
- package/message/message.d.ts +16 -16
- package/message/message.js +13 -13
- package/modal/index.d.ts +1 -1
- package/modal/modal.d.ts +30 -30
- package/modal/modal.js +25 -25
- package/navigation/index.d.ts +3 -3
- package/navigation/navigation.d.ts +8 -8
- package/navigation/navigation.js +5 -5
- package/navigation/navigationItem.d.ts +6 -6
- package/navigation/navigationItem.js +5 -5
- package/navigation/navigationSubMenu.d.ts +11 -11
- package/navigation/navigationSubMenu.js +10 -10
- package/notification/index.d.ts +1 -1
- package/notification/notification.d.ts +25 -25
- package/notification/notification.js +22 -22
- package/overlay/index.d.ts +1 -1
- package/overlay/overlay.d.ts +10 -10
- package/overlay/overlay.js +9 -9
- package/package.json +3 -3
- package/page-footer/index.d.ts +1 -1
- package/page-footer/pageFooter.d.ts +4 -4
- package/page-footer/pageFooter.js +3 -3
- package/pagination/index.d.ts +4 -4
- package/pagination/pagination.d.ts +8 -8
- package/pagination/pagination.js +7 -7
- package/pagination/paginationItem.d.ts +9 -9
- package/pagination/paginationItem.js +7 -7
- package/pagination/paginationJumper.d.ts +5 -5
- package/pagination/paginationJumper.js +4 -4
- package/pagination/paginationPageSize.d.ts +5 -5
- package/pagination/paginationPageSize.js +4 -4
- package/picker/index.d.ts +1 -1
- package/picker/picker.d.ts +10 -10
- package/picker/picker.js +5 -5
- package/popconfirm/index.d.ts +1 -1
- package/popconfirm/popconfirm.d.ts +5 -5
- package/popconfirm/popconfirm.js +4 -4
- package/popover/index.d.ts +1 -1
- package/popover/popover.d.ts +6 -6
- package/popover/popover.js +5 -5
- package/progress/index.d.ts +1 -1
- package/progress/progress.d.ts +27 -27
- package/progress/progress.js +25 -25
- package/radio/index.d.ts +1 -1
- package/radio/radio.d.ts +13 -13
- package/radio/radio.js +4 -4
- package/select/index.d.ts +1 -1
- package/select/select.d.ts +30 -30
- package/select/select.js +26 -26
- package/skeleton/index.d.ts +1 -1
- package/skeleton/skeleton.d.ts +5 -5
- package/skeleton/skeleton.js +4 -4
- package/slider/index.d.ts +1 -1
- package/slider/slider.d.ts +60 -60
- package/slider/slider.js +122 -122
- package/stepper/index.d.ts +2 -2
- package/stepper/step.d.ts +9 -9
- package/stepper/step.js +8 -8
- package/stepper/stepper.d.ts +4 -4
- package/stepper/stepper.js +3 -3
- package/switch/index.d.ts +1 -1
- package/switch/switch.d.ts +13 -13
- package/switch/switch.js +21 -21
- package/table/index.d.ts +1 -1
- package/table/table.d.ts +150 -150
- package/table/table.js +65 -65
- package/tabs/index.d.ts +1 -1
- package/tabs/tabs.d.ts +11 -11
- package/tabs/tabs.js +10 -10
- package/tag/index.d.ts +1 -1
- package/tag/tag.d.ts +10 -10
- package/tag/tag.js +7 -7
- package/text-field/index.d.ts +1 -1
- package/text-field/textField.d.ts +19 -19
- package/text-field/textField.js +16 -16
- package/textarea/index.d.ts +1 -1
- package/textarea/textarea.d.ts +9 -9
- package/textarea/textarea.js +6 -6
- package/time-panel/index.d.ts +1 -1
- package/time-panel/timePanel.d.ts +33 -33
- package/time-panel/timePanel.js +45 -45
- package/tooltip/index.d.ts +1 -1
- package/tooltip/tooltip.d.ts +4 -4
- package/tooltip/tooltip.js +3 -3
- package/tree/index.d.ts +1 -1
- package/tree/tree.d.ts +49 -49
- package/tree/tree.js +20 -20
- package/typography/index.d.ts +2 -2
- package/typography/typography.d.ts +22 -22
- package/typography/typography.js +17 -17
- package/upload/UploadPictureBlock.d.ts +51 -51
- package/upload/UploadPictureBlock.js +105 -105
- package/upload/UploadPictureWall.d.ts +5 -5
- package/upload/UploadPictureWall.js +4 -4
- package/upload/index.d.ts +5 -5
- package/upload/uploadInput.d.ts +4 -4
- package/upload/uploadInput.js +3 -3
- package/upload/uploadPicture.d.ts +4 -4
- package/upload/uploadPicture.js +3 -3
- package/upload/uploadResult.d.ts +17 -17
- package/upload/uploadResult.js +14 -14
package/calendar/calendar.d.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
/** Types */
|
|
2
|
-
export
|
|
3
|
-
/** ISO 8601 text */
|
|
4
|
-
export
|
|
5
|
-
/** Classes */
|
|
6
|
-
export declare const calendarPrefix = "mzn-calendar";
|
|
7
|
-
export declare const calendarBoardPrefix
|
|
8
|
-
export declare const calendarRowPrefix
|
|
9
|
-
export declare const calendarCellPrefix
|
|
10
|
-
export declare const calendarButtonPrefix
|
|
11
|
-
export declare const calendarTwelveGridPrefix
|
|
12
|
-
export declare const calendarControlsPrefix
|
|
13
|
-
export declare const calendarClasses: {
|
|
14
|
-
host: string;
|
|
15
|
-
/** Date grid classes */
|
|
16
|
-
board: string;
|
|
17
|
-
/** Button classes */
|
|
18
|
-
button: string;
|
|
19
|
-
buttonActive: string;
|
|
20
|
-
buttonDisabled: string;
|
|
21
|
-
buttonInRange: string;
|
|
22
|
-
buttonInactive: string;
|
|
23
|
-
/** Row classes */
|
|
24
|
-
row: string;
|
|
25
|
-
/** Cell classes */
|
|
26
|
-
cell: string;
|
|
27
|
-
cellInner: string;
|
|
28
|
-
cellToday: string;
|
|
29
|
-
cellActive: string;
|
|
30
|
-
cellDisabled: string;
|
|
31
|
-
/** Twelve grid classes */
|
|
32
|
-
twelveGrid: string;
|
|
33
|
-
/** Controls classes */
|
|
34
|
-
controls: string;
|
|
35
|
-
controlsButton: string;
|
|
36
|
-
controlsIconButton: string;
|
|
37
|
-
controlsPrev: string;
|
|
38
|
-
controlsNext: string;
|
|
39
|
-
};
|
|
40
|
-
/** Constants */
|
|
41
|
-
export declare const calendarYearsBase: number[];
|
|
42
|
-
export declare const calendarYearModuler = 10;
|
|
43
|
-
export declare const calendarMonths: number[];
|
|
44
|
-
/** Helpers */
|
|
45
|
-
export declare function getYearRange(year: number, mod: number): number[];
|
|
46
|
-
export declare function getCalendarYearRange(year: number): number[];
|
|
47
|
-
export declare function getDefaultModeFormat(mode: CalendarMode): "gggg-wo" | "YYYY-MM" | "YYYY" | "YYYY-MM-DD";
|
|
1
|
+
/** Types */
|
|
2
|
+
export type CalendarMode = 'year' | 'month' | 'week' | 'day';
|
|
3
|
+
/** ISO 8601 text */
|
|
4
|
+
export type DateType = string;
|
|
5
|
+
/** Classes */
|
|
6
|
+
export declare const calendarPrefix = "mzn-calendar";
|
|
7
|
+
export declare const calendarBoardPrefix = "mzn-calendar-board";
|
|
8
|
+
export declare const calendarRowPrefix = "mzn-calendar-row";
|
|
9
|
+
export declare const calendarCellPrefix = "mzn-calendar-cell";
|
|
10
|
+
export declare const calendarButtonPrefix = "mzn-calendar-button";
|
|
11
|
+
export declare const calendarTwelveGridPrefix = "mzn-calendar-twelve-grid";
|
|
12
|
+
export declare const calendarControlsPrefix = "mzn-calendar-controls";
|
|
13
|
+
export declare const calendarClasses: {
|
|
14
|
+
host: string;
|
|
15
|
+
/** Date grid classes */
|
|
16
|
+
board: string;
|
|
17
|
+
/** Button classes */
|
|
18
|
+
button: string;
|
|
19
|
+
buttonActive: string;
|
|
20
|
+
buttonDisabled: string;
|
|
21
|
+
buttonInRange: string;
|
|
22
|
+
buttonInactive: string;
|
|
23
|
+
/** Row classes */
|
|
24
|
+
row: string;
|
|
25
|
+
/** Cell classes */
|
|
26
|
+
cell: string;
|
|
27
|
+
cellInner: string;
|
|
28
|
+
cellToday: string;
|
|
29
|
+
cellActive: string;
|
|
30
|
+
cellDisabled: string;
|
|
31
|
+
/** Twelve grid classes */
|
|
32
|
+
twelveGrid: string;
|
|
33
|
+
/** Controls classes */
|
|
34
|
+
controls: string;
|
|
35
|
+
controlsButton: string;
|
|
36
|
+
controlsIconButton: string;
|
|
37
|
+
controlsPrev: string;
|
|
38
|
+
controlsNext: string;
|
|
39
|
+
};
|
|
40
|
+
/** Constants */
|
|
41
|
+
export declare const calendarYearsBase: number[];
|
|
42
|
+
export declare const calendarYearModuler = 10;
|
|
43
|
+
export declare const calendarMonths: number[];
|
|
44
|
+
/** Helpers */
|
|
45
|
+
export declare function getYearRange(year: number, mod: number): number[];
|
|
46
|
+
export declare function getCalendarYearRange(year: number): number[];
|
|
47
|
+
export declare function getDefaultModeFormat(mode: CalendarMode): "gggg-wo" | "YYYY-MM" | "YYYY" | "YYYY-MM-DD";
|
package/calendar/calendar.js
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
/** Classes */
|
|
2
|
-
const calendarPrefix = 'mzn-calendar';
|
|
3
|
-
const calendarBoardPrefix = `${calendarPrefix}-board`;
|
|
4
|
-
const calendarRowPrefix = `${calendarPrefix}-row`;
|
|
5
|
-
const calendarCellPrefix = `${calendarPrefix}-cell`;
|
|
6
|
-
const calendarButtonPrefix = `${calendarPrefix}-button`;
|
|
7
|
-
const calendarTwelveGridPrefix = `${calendarPrefix}-twelve-grid`;
|
|
8
|
-
const calendarControlsPrefix = `${calendarPrefix}-controls`;
|
|
9
|
-
const calendarClasses = {
|
|
10
|
-
host: calendarPrefix,
|
|
11
|
-
/** Date grid classes */
|
|
12
|
-
board: calendarBoardPrefix,
|
|
13
|
-
/** Button classes */
|
|
14
|
-
button: calendarButtonPrefix,
|
|
15
|
-
buttonActive: `${calendarButtonPrefix}--active`,
|
|
16
|
-
buttonDisabled: `${calendarButtonPrefix}--disabled`,
|
|
17
|
-
buttonInRange: `${calendarButtonPrefix}--inRange`,
|
|
18
|
-
buttonInactive: `${calendarButtonPrefix}--inactive`,
|
|
19
|
-
/** Row classes */
|
|
20
|
-
row: calendarRowPrefix,
|
|
21
|
-
/** Cell classes */
|
|
22
|
-
cell: calendarCellPrefix,
|
|
23
|
-
cellInner: `${calendarCellPrefix}__inner`,
|
|
24
|
-
cellToday: `${calendarCellPrefix}--today`,
|
|
25
|
-
cellActive: `${calendarCellPrefix}--active`,
|
|
26
|
-
cellDisabled: `${calendarCellPrefix}--disabled`,
|
|
27
|
-
/** Twelve grid classes */
|
|
28
|
-
twelveGrid: calendarTwelveGridPrefix,
|
|
29
|
-
/** Controls classes */
|
|
30
|
-
controls: calendarControlsPrefix,
|
|
31
|
-
controlsButton: `${calendarControlsPrefix}__button`,
|
|
32
|
-
controlsIconButton: `${calendarControlsPrefix}__icon-button`,
|
|
33
|
-
controlsPrev: `${calendarControlsPrefix}__prev`,
|
|
34
|
-
controlsNext: `${calendarControlsPrefix}__next`,
|
|
35
|
-
};
|
|
36
|
-
/** Constants */
|
|
37
|
-
const calendarYearsBase = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
38
|
-
const calendarYearModuler = 10;
|
|
39
|
-
const calendarMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
40
|
-
/** Helpers */
|
|
41
|
-
function getYearRange(year, mod) {
|
|
42
|
-
const remainder = year % mod;
|
|
43
|
-
const end = year + (mod - 1) - remainder;
|
|
44
|
-
const start = end - (mod - 1);
|
|
45
|
-
return [start, end];
|
|
46
|
-
}
|
|
47
|
-
function getCalendarYearRange(year) {
|
|
48
|
-
const [start, end] = getYearRange(year, calendarYearModuler);
|
|
49
|
-
return [start - 1, end + 1];
|
|
50
|
-
}
|
|
51
|
-
function getDefaultModeFormat(mode) {
|
|
52
|
-
if (mode === 'week') {
|
|
53
|
-
return 'gggg-wo';
|
|
54
|
-
}
|
|
55
|
-
if (mode === 'month') {
|
|
56
|
-
return 'YYYY-MM';
|
|
57
|
-
}
|
|
58
|
-
if (mode === 'year') {
|
|
59
|
-
return 'YYYY';
|
|
60
|
-
}
|
|
61
|
-
return 'YYYY-MM-DD';
|
|
1
|
+
/** Classes */
|
|
2
|
+
const calendarPrefix = 'mzn-calendar';
|
|
3
|
+
const calendarBoardPrefix = `${calendarPrefix}-board`;
|
|
4
|
+
const calendarRowPrefix = `${calendarPrefix}-row`;
|
|
5
|
+
const calendarCellPrefix = `${calendarPrefix}-cell`;
|
|
6
|
+
const calendarButtonPrefix = `${calendarPrefix}-button`;
|
|
7
|
+
const calendarTwelveGridPrefix = `${calendarPrefix}-twelve-grid`;
|
|
8
|
+
const calendarControlsPrefix = `${calendarPrefix}-controls`;
|
|
9
|
+
const calendarClasses = {
|
|
10
|
+
host: calendarPrefix,
|
|
11
|
+
/** Date grid classes */
|
|
12
|
+
board: calendarBoardPrefix,
|
|
13
|
+
/** Button classes */
|
|
14
|
+
button: calendarButtonPrefix,
|
|
15
|
+
buttonActive: `${calendarButtonPrefix}--active`,
|
|
16
|
+
buttonDisabled: `${calendarButtonPrefix}--disabled`,
|
|
17
|
+
buttonInRange: `${calendarButtonPrefix}--inRange`,
|
|
18
|
+
buttonInactive: `${calendarButtonPrefix}--inactive`,
|
|
19
|
+
/** Row classes */
|
|
20
|
+
row: calendarRowPrefix,
|
|
21
|
+
/** Cell classes */
|
|
22
|
+
cell: calendarCellPrefix,
|
|
23
|
+
cellInner: `${calendarCellPrefix}__inner`,
|
|
24
|
+
cellToday: `${calendarCellPrefix}--today`,
|
|
25
|
+
cellActive: `${calendarCellPrefix}--active`,
|
|
26
|
+
cellDisabled: `${calendarCellPrefix}--disabled`,
|
|
27
|
+
/** Twelve grid classes */
|
|
28
|
+
twelveGrid: calendarTwelveGridPrefix,
|
|
29
|
+
/** Controls classes */
|
|
30
|
+
controls: calendarControlsPrefix,
|
|
31
|
+
controlsButton: `${calendarControlsPrefix}__button`,
|
|
32
|
+
controlsIconButton: `${calendarControlsPrefix}__icon-button`,
|
|
33
|
+
controlsPrev: `${calendarControlsPrefix}__prev`,
|
|
34
|
+
controlsNext: `${calendarControlsPrefix}__next`,
|
|
35
|
+
};
|
|
36
|
+
/** Constants */
|
|
37
|
+
const calendarYearsBase = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
38
|
+
const calendarYearModuler = 10;
|
|
39
|
+
const calendarMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
40
|
+
/** Helpers */
|
|
41
|
+
function getYearRange(year, mod) {
|
|
42
|
+
const remainder = year % mod;
|
|
43
|
+
const end = year + (mod - 1) - remainder;
|
|
44
|
+
const start = end - (mod - 1);
|
|
45
|
+
return [start, end];
|
|
46
|
+
}
|
|
47
|
+
function getCalendarYearRange(year) {
|
|
48
|
+
const [start, end] = getYearRange(year, calendarYearModuler);
|
|
49
|
+
return [start - 1, end + 1];
|
|
50
|
+
}
|
|
51
|
+
function getDefaultModeFormat(mode) {
|
|
52
|
+
if (mode === 'week') {
|
|
53
|
+
return 'gggg-wo';
|
|
54
|
+
}
|
|
55
|
+
if (mode === 'month') {
|
|
56
|
+
return 'YYYY-MM';
|
|
57
|
+
}
|
|
58
|
+
if (mode === 'year') {
|
|
59
|
+
return 'YYYY';
|
|
60
|
+
}
|
|
61
|
+
return 'YYYY-MM-DD';
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export { calendarBoardPrefix, calendarButtonPrefix, calendarCellPrefix, calendarClasses, calendarControlsPrefix, calendarMonths, calendarPrefix, calendarRowPrefix, calendarTwelveGridPrefix, calendarYearModuler, calendarYearsBase, getCalendarYearRange, getDefaultModeFormat, getYearRange };
|
package/calendar/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './typings';
|
|
2
|
-
export * from './calendar';
|
|
1
|
+
export * from './typings';
|
|
2
|
+
export * from './calendar';
|
package/calendar/typings.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { DateType } from './calendar';
|
|
2
|
-
/** Method Types */
|
|
3
|
-
export
|
|
4
|
-
/** Get date infos */
|
|
5
|
-
getNow: () => TDateType;
|
|
6
|
-
getSecond: (value: TDateType) => number;
|
|
7
|
-
getMinute: (value: TDateType) => number;
|
|
8
|
-
getHour: (value: TDateType) => number;
|
|
9
|
-
getDate: (value: TDateType) => number;
|
|
10
|
-
getWeekDay: (value: TDateType) => number;
|
|
11
|
-
getMonth: (value: TDateType) => number;
|
|
12
|
-
getYear: (value: TDateType) => number;
|
|
13
|
-
getWeekDayNames: (locale: string) => string[];
|
|
14
|
-
getMonthShortName: (value: number, locale: string) => string;
|
|
15
|
-
getMonthShortNames: (locale: string) => Readonly<string[]>;
|
|
16
|
-
/** Manipulate */
|
|
17
|
-
addDay: (value: TDateType, diff: number) => TDateType;
|
|
18
|
-
addYear: (value: TDateType, diff: number) => TDateType;
|
|
19
|
-
addMonth: (value: TDateType, diff: number) => TDateType;
|
|
20
|
-
setSecond: (value: TDateType, second: number) => TDateType;
|
|
21
|
-
setMinute: (value: TDateType, minute: number) => TDateType;
|
|
22
|
-
setHour: (value: TDateType, hour: number) => TDateType;
|
|
23
|
-
setYear: (value: TDateType, year: number) => TDateType;
|
|
24
|
-
setMonth: (value: TDateType, month: number) => TDateType;
|
|
25
|
-
setDate: (value: TDateType, date: number) => TDateType;
|
|
26
|
-
startOf: (value: TDateType, granularity: any) => TDateType;
|
|
27
|
-
/** Generate day calendar */
|
|
28
|
-
getCalendarGrid: (target: TDateType) => number[][];
|
|
29
|
-
/** Compares */
|
|
30
|
-
isBefore: (target: TDateType, comparison: TDateType) => boolean;
|
|
31
|
-
isBetween: (value: TDateType, target1: TDateType, target2: TDateType, granularity: any) => boolean;
|
|
32
|
-
isSameDate: (dateOne: TDateType, dateTwo: TDateType) => boolean;
|
|
33
|
-
isSameWeek: (dateOne: TDateType, dateTwo: TDateType) => boolean;
|
|
34
|
-
isInMonth: (target: TDateType, month: number) => boolean;
|
|
35
|
-
isDateIncluded: (date: TDateType, targets: TDateType[]) => boolean;
|
|
36
|
-
isWeekIncluded: (firstDateOfWeek: TDateType, targets: TDateType[]) => boolean;
|
|
37
|
-
isMonthIncluded: (date: TDateType, targets: TDateType[]) => boolean;
|
|
38
|
-
isYearIncluded: (date: TDateType, targets: TDateType[]) => boolean;
|
|
39
|
-
/** Format */
|
|
40
|
-
formatToString: (locale: string, date: TDateType, format: string) => string;
|
|
41
|
-
/** Parse */
|
|
42
|
-
parse: (locale: string, text: string, formats: string[]) => TDateType | undefined;
|
|
43
|
-
};
|
|
1
|
+
import { DateType } from './calendar';
|
|
2
|
+
/** Method Types */
|
|
3
|
+
export type CalendarMethods<TDateType = DateType> = {
|
|
4
|
+
/** Get date infos */
|
|
5
|
+
getNow: () => TDateType;
|
|
6
|
+
getSecond: (value: TDateType) => number;
|
|
7
|
+
getMinute: (value: TDateType) => number;
|
|
8
|
+
getHour: (value: TDateType) => number;
|
|
9
|
+
getDate: (value: TDateType) => number;
|
|
10
|
+
getWeekDay: (value: TDateType) => number;
|
|
11
|
+
getMonth: (value: TDateType) => number;
|
|
12
|
+
getYear: (value: TDateType) => number;
|
|
13
|
+
getWeekDayNames: (locale: string) => string[];
|
|
14
|
+
getMonthShortName: (value: number, locale: string) => string;
|
|
15
|
+
getMonthShortNames: (locale: string) => Readonly<string[]>;
|
|
16
|
+
/** Manipulate */
|
|
17
|
+
addDay: (value: TDateType, diff: number) => TDateType;
|
|
18
|
+
addYear: (value: TDateType, diff: number) => TDateType;
|
|
19
|
+
addMonth: (value: TDateType, diff: number) => TDateType;
|
|
20
|
+
setSecond: (value: TDateType, second: number) => TDateType;
|
|
21
|
+
setMinute: (value: TDateType, minute: number) => TDateType;
|
|
22
|
+
setHour: (value: TDateType, hour: number) => TDateType;
|
|
23
|
+
setYear: (value: TDateType, year: number) => TDateType;
|
|
24
|
+
setMonth: (value: TDateType, month: number) => TDateType;
|
|
25
|
+
setDate: (value: TDateType, date: number) => TDateType;
|
|
26
|
+
startOf: (value: TDateType, granularity: any) => TDateType;
|
|
27
|
+
/** Generate day calendar */
|
|
28
|
+
getCalendarGrid: (target: TDateType) => number[][];
|
|
29
|
+
/** Compares */
|
|
30
|
+
isBefore: (target: TDateType, comparison: TDateType) => boolean;
|
|
31
|
+
isBetween: (value: TDateType, target1: TDateType, target2: TDateType, granularity: any) => boolean;
|
|
32
|
+
isSameDate: (dateOne: TDateType, dateTwo: TDateType) => boolean;
|
|
33
|
+
isSameWeek: (dateOne: TDateType, dateTwo: TDateType) => boolean;
|
|
34
|
+
isInMonth: (target: TDateType, month: number) => boolean;
|
|
35
|
+
isDateIncluded: (date: TDateType, targets: TDateType[]) => boolean;
|
|
36
|
+
isWeekIncluded: (firstDateOfWeek: TDateType, targets: TDateType[]) => boolean;
|
|
37
|
+
isMonthIncluded: (date: TDateType, targets: TDateType[]) => boolean;
|
|
38
|
+
isYearIncluded: (date: TDateType, targets: TDateType[]) => boolean;
|
|
39
|
+
/** Format */
|
|
40
|
+
formatToString: (locale: string, date: TDateType, format: string) => string;
|
|
41
|
+
/** Parse */
|
|
42
|
+
parse: (locale: string, text: string, formats: string[]) => TDateType | undefined;
|
|
43
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CalendarMethods as CalendarMethodsType } from '../calendar/typings';
|
|
2
|
-
declare const CalendarMethods: CalendarMethodsType;
|
|
3
|
-
export default CalendarMethods;
|
|
1
|
+
import { CalendarMethods as CalendarMethodsType } from '../calendar/typings';
|
|
2
|
+
declare const CalendarMethods: CalendarMethodsType;
|
|
3
|
+
export default CalendarMethods;
|
|
@@ -5,103 +5,103 @@ import isBetween from 'dayjs/plugin/isBetween';
|
|
|
5
5
|
import range from 'lodash/range';
|
|
6
6
|
import chunk from 'lodash/chunk';
|
|
7
7
|
|
|
8
|
-
const localeMappingTable = {
|
|
9
|
-
'en-us': 'en',
|
|
10
|
-
};
|
|
11
|
-
const localeMapping = (locale) => { var _a; return (_a = localeMappingTable[locale]) !== null && _a !== void 0 ? _a : locale; };
|
|
12
|
-
function init() {
|
|
13
|
-
dayjs.extend(weekday);
|
|
14
|
-
dayjs.extend(localeData);
|
|
15
|
-
dayjs.extend(isBetween);
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
const CalendarMethodsDayjs = {
|
|
19
|
-
/** Get date infos */
|
|
20
|
-
getNow: () => dayjs().toISOString(),
|
|
21
|
-
getSecond: (date) => dayjs(date).second(),
|
|
22
|
-
getMinute: (date) => dayjs(date).minute(),
|
|
23
|
-
getHour: (date) => dayjs(date).hour(),
|
|
24
|
-
getDate: (date) => dayjs(date).date(),
|
|
25
|
-
getWeekDay: (date) => {
|
|
26
|
-
const clone = dayjs(date).locale('en');
|
|
27
|
-
return clone.weekday() + clone.localeData().firstDayOfWeek();
|
|
28
|
-
},
|
|
29
|
-
getMonth: (date) => dayjs(date).month(),
|
|
30
|
-
getYear: (date) => dayjs(date).year(),
|
|
31
|
-
getWeekDayNames: (locale) => {
|
|
32
|
-
return dayjs().locale(localeMapping(locale)).localeData().weekdaysMin();
|
|
33
|
-
},
|
|
34
|
-
getMonthShortName: (month, locale) => {
|
|
35
|
-
const names = CalendarMethodsDayjs.getMonthShortNames(localeMapping(locale));
|
|
36
|
-
return names[month];
|
|
37
|
-
},
|
|
38
|
-
getMonthShortNames: (locale) => {
|
|
39
|
-
return dayjs().locale(localeMapping(locale)).localeData().monthsShort();
|
|
40
|
-
},
|
|
41
|
-
/** Manipulate */
|
|
42
|
-
addDay: (date, diff) => dayjs(date).add(diff, 'day').toISOString(),
|
|
43
|
-
addYear: (date, diff) => dayjs(date).add(diff, 'year').toISOString(),
|
|
44
|
-
addMonth: (date, diff) => dayjs(date).add(diff, 'month').toISOString(),
|
|
45
|
-
setSecond: (date, second) => dayjs(date).second(second).toISOString(),
|
|
46
|
-
setMinute: (date, minute) => dayjs(date).minute(minute).toISOString(),
|
|
47
|
-
setHour: (date, hour) => dayjs(date).hour(hour).toISOString(),
|
|
48
|
-
setMonth: (date, month) => dayjs(date).month(month).toISOString(),
|
|
49
|
-
setYear: (date, year) => dayjs(date).year(year).toISOString(),
|
|
50
|
-
setDate: (date, target) => dayjs(date).date(target).toISOString(),
|
|
51
|
-
startOf: (target, granularity) => dayjs(target).startOf(granularity).toISOString(),
|
|
52
|
-
/** Generate day calendar */
|
|
53
|
-
getCalendarGrid: (target) => {
|
|
54
|
-
const lastDateOfPrevMonth = dayjs(target).subtract(1, 'month').endOf('month')
|
|
55
|
-
.date();
|
|
56
|
-
const firstDayOfCurrentMonth = dayjs(target).date(1).day();
|
|
57
|
-
const lastDateOfCurrentMonth = dayjs(target).endOf('month').date();
|
|
58
|
-
return chunk([
|
|
59
|
-
...range(lastDateOfPrevMonth - firstDayOfCurrentMonth + 1, lastDateOfPrevMonth + 1),
|
|
60
|
-
...range(1, lastDateOfCurrentMonth + 1),
|
|
61
|
-
...range(1, 42 - lastDateOfCurrentMonth - firstDayOfCurrentMonth + 1),
|
|
62
|
-
], 7);
|
|
63
|
-
},
|
|
64
|
-
/** Compares */
|
|
65
|
-
isBefore: (target, comparison) => dayjs(target).isBefore(comparison),
|
|
66
|
-
isBetween: (value, target1, target2, granularity) => dayjs(value).isBetween(target1, target2, granularity),
|
|
67
|
-
isSameDate: (dateOne, dateTwo) => dayjs(dateOne).isSame(dayjs(dateTwo), 'date'),
|
|
68
|
-
isSameWeek: (dateOne, dateTwo) => dayjs(dateOne).isSame(dayjs(dateTwo), 'week'),
|
|
69
|
-
isInMonth: (target, month) => dayjs(target).month() === month,
|
|
70
|
-
isDateIncluded: (date, targets) => targets.some((target) => dayjs(date).isSame(dayjs(target), 'day')),
|
|
71
|
-
isWeekIncluded: (firstDateOfWeek, targets) => targets.some((target) => dayjs(firstDateOfWeek).isSame(dayjs(target), 'week')),
|
|
72
|
-
isMonthIncluded: (date, targets) => targets.some((target) => dayjs(date).isSame(dayjs(target), 'month')),
|
|
73
|
-
isYearIncluded: (date, targets) => targets.some((target) => dayjs(date).isSame(dayjs(target), 'year')),
|
|
74
|
-
/** Format */
|
|
75
|
-
formatToString: (locale, date, format) => {
|
|
76
|
-
const clone = dayjs(date);
|
|
77
|
-
const result = clone.locale(localeMapping(locale));
|
|
78
|
-
return result.format(format);
|
|
79
|
-
},
|
|
80
|
-
/** Parse */
|
|
81
|
-
parse: (locale, text, formats) => {
|
|
82
|
-
for (let i = 0; i < formats.length; i += 1) {
|
|
83
|
-
let format = formats[i];
|
|
84
|
-
let formatText = text;
|
|
85
|
-
if (format.includes('wo') || format.includes('Wo')) {
|
|
86
|
-
format = format.replace(/wo/g, 'w').replace(/Wo/g, 'W');
|
|
87
|
-
const matchFormat = format.match(/[-YyMmDdHhSsWwGg]+/g);
|
|
88
|
-
const matchText = formatText.match(/[-\d]+/g);
|
|
89
|
-
if (matchFormat && matchText) {
|
|
90
|
-
format = matchFormat.join('');
|
|
91
|
-
formatText = matchText.join('');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const date = dayjs(formatText, format, localeMapping(locale), true);
|
|
95
|
-
if (date.isValid()) {
|
|
96
|
-
return date.toISOString();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return undefined;
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
const CalendarMethods = (() => {
|
|
103
|
-
init();
|
|
104
|
-
return CalendarMethodsDayjs;
|
|
8
|
+
const localeMappingTable = {
|
|
9
|
+
'en-us': 'en',
|
|
10
|
+
};
|
|
11
|
+
const localeMapping = (locale) => { var _a; return (_a = localeMappingTable[locale]) !== null && _a !== void 0 ? _a : locale; };
|
|
12
|
+
function init() {
|
|
13
|
+
dayjs.extend(weekday);
|
|
14
|
+
dayjs.extend(localeData);
|
|
15
|
+
dayjs.extend(isBetween);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
const CalendarMethodsDayjs = {
|
|
19
|
+
/** Get date infos */
|
|
20
|
+
getNow: () => dayjs().toISOString(),
|
|
21
|
+
getSecond: (date) => dayjs(date).second(),
|
|
22
|
+
getMinute: (date) => dayjs(date).minute(),
|
|
23
|
+
getHour: (date) => dayjs(date).hour(),
|
|
24
|
+
getDate: (date) => dayjs(date).date(),
|
|
25
|
+
getWeekDay: (date) => {
|
|
26
|
+
const clone = dayjs(date).locale('en');
|
|
27
|
+
return clone.weekday() + clone.localeData().firstDayOfWeek();
|
|
28
|
+
},
|
|
29
|
+
getMonth: (date) => dayjs(date).month(),
|
|
30
|
+
getYear: (date) => dayjs(date).year(),
|
|
31
|
+
getWeekDayNames: (locale) => {
|
|
32
|
+
return dayjs().locale(localeMapping(locale)).localeData().weekdaysMin();
|
|
33
|
+
},
|
|
34
|
+
getMonthShortName: (month, locale) => {
|
|
35
|
+
const names = CalendarMethodsDayjs.getMonthShortNames(localeMapping(locale));
|
|
36
|
+
return names[month];
|
|
37
|
+
},
|
|
38
|
+
getMonthShortNames: (locale) => {
|
|
39
|
+
return dayjs().locale(localeMapping(locale)).localeData().monthsShort();
|
|
40
|
+
},
|
|
41
|
+
/** Manipulate */
|
|
42
|
+
addDay: (date, diff) => dayjs(date).add(diff, 'day').toISOString(),
|
|
43
|
+
addYear: (date, diff) => dayjs(date).add(diff, 'year').toISOString(),
|
|
44
|
+
addMonth: (date, diff) => dayjs(date).add(diff, 'month').toISOString(),
|
|
45
|
+
setSecond: (date, second) => dayjs(date).second(second).toISOString(),
|
|
46
|
+
setMinute: (date, minute) => dayjs(date).minute(minute).toISOString(),
|
|
47
|
+
setHour: (date, hour) => dayjs(date).hour(hour).toISOString(),
|
|
48
|
+
setMonth: (date, month) => dayjs(date).month(month).toISOString(),
|
|
49
|
+
setYear: (date, year) => dayjs(date).year(year).toISOString(),
|
|
50
|
+
setDate: (date, target) => dayjs(date).date(target).toISOString(),
|
|
51
|
+
startOf: (target, granularity) => dayjs(target).startOf(granularity).toISOString(),
|
|
52
|
+
/** Generate day calendar */
|
|
53
|
+
getCalendarGrid: (target) => {
|
|
54
|
+
const lastDateOfPrevMonth = dayjs(target).subtract(1, 'month').endOf('month')
|
|
55
|
+
.date();
|
|
56
|
+
const firstDayOfCurrentMonth = dayjs(target).date(1).day();
|
|
57
|
+
const lastDateOfCurrentMonth = dayjs(target).endOf('month').date();
|
|
58
|
+
return chunk([
|
|
59
|
+
...range(lastDateOfPrevMonth - firstDayOfCurrentMonth + 1, lastDateOfPrevMonth + 1),
|
|
60
|
+
...range(1, lastDateOfCurrentMonth + 1),
|
|
61
|
+
...range(1, 42 - lastDateOfCurrentMonth - firstDayOfCurrentMonth + 1),
|
|
62
|
+
], 7);
|
|
63
|
+
},
|
|
64
|
+
/** Compares */
|
|
65
|
+
isBefore: (target, comparison) => dayjs(target).isBefore(comparison),
|
|
66
|
+
isBetween: (value, target1, target2, granularity) => dayjs(value).isBetween(target1, target2, granularity),
|
|
67
|
+
isSameDate: (dateOne, dateTwo) => dayjs(dateOne).isSame(dayjs(dateTwo), 'date'),
|
|
68
|
+
isSameWeek: (dateOne, dateTwo) => dayjs(dateOne).isSame(dayjs(dateTwo), 'week'),
|
|
69
|
+
isInMonth: (target, month) => dayjs(target).month() === month,
|
|
70
|
+
isDateIncluded: (date, targets) => targets.some((target) => dayjs(date).isSame(dayjs(target), 'day')),
|
|
71
|
+
isWeekIncluded: (firstDateOfWeek, targets) => targets.some((target) => dayjs(firstDateOfWeek).isSame(dayjs(target), 'week')),
|
|
72
|
+
isMonthIncluded: (date, targets) => targets.some((target) => dayjs(date).isSame(dayjs(target), 'month')),
|
|
73
|
+
isYearIncluded: (date, targets) => targets.some((target) => dayjs(date).isSame(dayjs(target), 'year')),
|
|
74
|
+
/** Format */
|
|
75
|
+
formatToString: (locale, date, format) => {
|
|
76
|
+
const clone = dayjs(date);
|
|
77
|
+
const result = clone.locale(localeMapping(locale));
|
|
78
|
+
return result.format(format);
|
|
79
|
+
},
|
|
80
|
+
/** Parse */
|
|
81
|
+
parse: (locale, text, formats) => {
|
|
82
|
+
for (let i = 0; i < formats.length; i += 1) {
|
|
83
|
+
let format = formats[i];
|
|
84
|
+
let formatText = text;
|
|
85
|
+
if (format.includes('wo') || format.includes('Wo')) {
|
|
86
|
+
format = format.replace(/wo/g, 'w').replace(/Wo/g, 'W');
|
|
87
|
+
const matchFormat = format.match(/[-YyMmDdHhSsWwGg]+/g);
|
|
88
|
+
const matchText = formatText.match(/[-\d]+/g);
|
|
89
|
+
if (matchFormat && matchText) {
|
|
90
|
+
format = matchFormat.join('');
|
|
91
|
+
formatText = matchText.join('');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const date = dayjs(formatText, format, localeMapping(locale), true);
|
|
95
|
+
if (date.isValid()) {
|
|
96
|
+
return date.toISOString();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
const CalendarMethods = (() => {
|
|
103
|
+
init();
|
|
104
|
+
return CalendarMethodsDayjs;
|
|
105
105
|
})();
|
|
106
106
|
|
|
107
107
|
export { CalendarMethods as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { CalendarMethods as CalendarMethodsType } from '../calendar/typings';
|
|
2
|
-
declare const CalendarMethodsLuxon: CalendarMethodsType;
|
|
3
|
-
export default CalendarMethodsLuxon;
|
|
1
|
+
import { CalendarMethods as CalendarMethodsType } from '../calendar/typings';
|
|
2
|
+
declare const CalendarMethodsLuxon: CalendarMethodsType;
|
|
3
|
+
export default CalendarMethodsLuxon;
|