@mailstep/design-system 0.4.21 → 0.5.0-beta.10
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/package.json +33 -2
- package/ui/Blocks/CommonGrid/CommonGrid.d.ts +3 -0
- package/ui/Blocks/CommonGrid/CommonGrid.js +106 -0
- package/ui/Blocks/CommonGrid/CommonGridContainer.d.ts +3 -0
- package/ui/Blocks/CommonGrid/CommonGridContainer.js +67 -0
- package/ui/Blocks/CommonGrid/CommonGridContext.d.ts +9 -0
- package/ui/Blocks/CommonGrid/CommonGridContext.js +32 -0
- package/ui/Blocks/CommonGrid/HoC/withReduxActions.d.ts +2 -0
- package/ui/Blocks/CommonGrid/HoC/withReduxActions.js +36 -0
- package/ui/Blocks/CommonGrid/StandardButtons.d.ts +6 -0
- package/ui/Blocks/CommonGrid/StandardButtons.js +50 -0
- package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.d.ts +11 -0
- package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.js +53 -0
- package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownMenu.d.ts +11 -0
- package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownMenu.js +18 -0
- package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownSelect.d.ts +12 -0
- package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownSelect.js +45 -0
- package/ui/Blocks/CommonGrid/components/ActionHead/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/ActionHead/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/BooleanSelect/BooleanSelect.d.ts +6 -0
- package/ui/Blocks/CommonGrid/components/BooleanSelect/BooleanSelect.js +35 -0
- package/ui/Blocks/CommonGrid/components/BooleanSelect/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/BooleanSelect/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/ButtonMore/ButtonMore.d.ts +13 -0
- package/ui/Blocks/CommonGrid/components/ButtonMore/ButtonMore.js +32 -0
- package/ui/Blocks/CommonGrid/components/ButtonMore/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/ButtonMore/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/ColumnFilterCell.d.ts +11 -0
- package/ui/Blocks/CommonGrid/components/ColumnFilterCell.js +41 -0
- package/ui/Blocks/CommonGrid/components/ColumnTitle/ColumnTitle.d.ts +5 -0
- package/ui/Blocks/CommonGrid/components/ColumnTitle/ColumnTitle.js +58 -0
- package/ui/Blocks/CommonGrid/components/ColumnTitle/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/ColumnTitle/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/ColumnTitle.d.ts +9 -0
- package/ui/Blocks/CommonGrid/components/ColumnTitle.js +20 -0
- package/ui/Blocks/CommonGrid/components/ControlButtons/ControlButtons.d.ts +11 -0
- package/ui/Blocks/CommonGrid/components/ControlButtons/ControlButtons.js +20 -0
- package/ui/Blocks/CommonGrid/components/ControlButtons/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/ControlButtons/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/DataCell.d.ts +11 -0
- package/ui/Blocks/CommonGrid/components/DataCell.js +52 -0
- package/ui/Blocks/CommonGrid/components/DataRow.d.ts +21 -0
- package/ui/Blocks/CommonGrid/components/DataRow.js +110 -0
- package/ui/Blocks/CommonGrid/components/DatePickerRange/DatePickerRange.d.ts +12 -0
- package/ui/Blocks/CommonGrid/components/DatePickerRange/DatePickerRange.js +113 -0
- package/ui/Blocks/CommonGrid/components/DatePickerRange/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/DatePickerRange/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/DatePickerRange/utils/sameDate.d.ts +1 -0
- package/ui/Blocks/CommonGrid/components/DatePickerRange/utils/sameDate.js +3 -0
- package/ui/Blocks/CommonGrid/components/DropdownSelect/DropdownSelect.d.ts +21 -0
- package/ui/Blocks/CommonGrid/components/DropdownSelect/DropdownSelect.js +47 -0
- package/ui/Blocks/CommonGrid/components/DropdownSelect/index.d.ts +4 -0
- package/ui/Blocks/CommonGrid/components/DropdownSelect/index.js +3 -0
- package/ui/Blocks/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.d.ts +8 -0
- package/ui/Blocks/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.js +43 -0
- package/ui/Blocks/CommonGrid/components/ExtraControlButtons/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/ExtraControlButtons/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/FilterDropdown.d.ts +3 -0
- package/ui/Blocks/CommonGrid/components/FilterDropdown.js +36 -0
- package/ui/Blocks/CommonGrid/components/FilterRow.d.ts +15 -0
- package/ui/Blocks/CommonGrid/components/FilterRow.js +34 -0
- package/ui/Blocks/CommonGrid/components/FloatingButton/FloatingButton.d.ts +7 -0
- package/ui/Blocks/CommonGrid/components/FloatingButton/FloatingButton.js +45 -0
- package/ui/Blocks/CommonGrid/components/FloatingButton/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/FloatingButton/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/GridSelect/GridSelect.d.ts +10 -0
- package/ui/Blocks/CommonGrid/components/GridSelect/GridSelect.js +19 -0
- package/ui/Blocks/CommonGrid/components/GridSelect/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/GridSelect/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/GroupRow.d.ts +9 -0
- package/ui/Blocks/CommonGrid/components/GroupRow.js +27 -0
- package/ui/Blocks/CommonGrid/components/HeadCell.d.ts +27 -0
- package/ui/Blocks/CommonGrid/components/HeadCell.js +40 -0
- package/ui/Blocks/CommonGrid/components/HeadRow.d.ts +15 -0
- package/ui/Blocks/CommonGrid/components/HeadRow.js +69 -0
- package/ui/Blocks/CommonGrid/components/HidePrint/HidePrint.d.ts +6 -0
- package/ui/Blocks/CommonGrid/components/HidePrint/HidePrint.js +13 -0
- package/ui/Blocks/CommonGrid/components/IconList/IconList.d.ts +18 -0
- package/ui/Blocks/CommonGrid/components/IconList/IconList.js +29 -0
- package/ui/Blocks/CommonGrid/components/IconList/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/IconList/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.d.ts +11 -0
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.js +20 -0
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ActionRow.d.ts +12 -0
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ActionRow.js +47 -0
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/NumberRange/NumberRange.d.ts +3 -0
- package/ui/Blocks/CommonGrid/components/NumberRange/NumberRange.js +76 -0
- package/ui/Blocks/CommonGrid/components/NumberRange/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/NumberRange/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/NumberRange/types.d.ts +17 -0
- package/ui/Blocks/CommonGrid/components/NumberRange/types.js +1 -0
- package/ui/Blocks/CommonGrid/components/OversizedScroll.d.ts +11 -0
- package/ui/Blocks/CommonGrid/components/OversizedScroll.js +21 -0
- package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/ReadEditButtonCell.d.ts +6 -0
- package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/ReadEditButtonCell.js +26 -0
- package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/Resize.d.ts +7 -0
- package/ui/Blocks/CommonGrid/components/Resize.js +33 -0
- package/ui/Blocks/CommonGrid/components/Table.d.ts +10 -0
- package/ui/Blocks/CommonGrid/components/Table.js +25 -0
- package/ui/Blocks/CommonGrid/components/TablePagination/TablePagination.d.ts +7 -0
- package/ui/Blocks/CommonGrid/components/TablePagination/TablePagination.js +31 -0
- package/ui/Blocks/CommonGrid/components/TablePagination/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/TablePagination/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/TextRange/TextRange.d.ts +4 -0
- package/ui/Blocks/CommonGrid/components/TextRange/TextRange.js +89 -0
- package/ui/Blocks/CommonGrid/components/TextRange/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/TextRange/index.js +2 -0
- package/ui/Blocks/CommonGrid/components/TextRange/types.d.ts +21 -0
- package/ui/Blocks/CommonGrid/components/TextRange/types.js +1 -0
- package/ui/Blocks/CommonGrid/components/gridCells/BoolIcon.d.ts +5 -0
- package/ui/Blocks/CommonGrid/components/gridCells/BoolIcon.js +22 -0
- package/ui/Blocks/CommonGrid/components/gridCells/ButtonInCell.d.ts +4 -0
- package/ui/Blocks/CommonGrid/components/gridCells/ButtonInCell.js +16 -0
- package/ui/Blocks/CommonGrid/components/gridCells/Date.d.ts +4 -0
- package/ui/Blocks/CommonGrid/components/gridCells/Date.js +8 -0
- package/ui/Blocks/CommonGrid/components/gridCells/DateTime.d.ts +4 -0
- package/ui/Blocks/CommonGrid/components/gridCells/DateTime.js +13 -0
- package/ui/Blocks/CommonGrid/components/gridCells/EnumInCell.d.ts +9 -0
- package/ui/Blocks/CommonGrid/components/gridCells/EnumInCell.js +33 -0
- package/ui/Blocks/CommonGrid/components/gridCells/HoverBubble.d.ts +5 -0
- package/ui/Blocks/CommonGrid/components/gridCells/HoverBubble.js +19 -0
- package/ui/Blocks/CommonGrid/components/gridCells/IconButtonInCell.d.ts +9 -0
- package/ui/Blocks/CommonGrid/components/gridCells/IconButtonInCell.js +15 -0
- package/ui/Blocks/CommonGrid/components/gridCells/ImageCell.d.ts +6 -0
- package/ui/Blocks/CommonGrid/components/gridCells/ImageCell.js +23 -0
- package/ui/Blocks/CommonGrid/components/gridCells/LinkInCell.d.ts +1 -0
- package/ui/Blocks/CommonGrid/components/gridCells/LinkInCell.js +8 -0
- package/ui/Blocks/CommonGrid/components/gridCells/RemoveItem.d.ts +5 -0
- package/ui/Blocks/CommonGrid/components/gridCells/RemoveItem.js +24 -0
- package/ui/Blocks/CommonGrid/components/gridCells/RowActionsCell.d.ts +7 -0
- package/ui/Blocks/CommonGrid/components/gridCells/RowActionsCell.js +30 -0
- package/ui/Blocks/CommonGrid/components/gridCells/StringJoin.d.ts +4 -0
- package/ui/Blocks/CommonGrid/components/gridCells/StringJoin.js +7 -0
- package/ui/Blocks/CommonGrid/components/gridCells/SwitchInCell.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/gridCells/SwitchInCell.js +16 -0
- package/ui/Blocks/CommonGrid/components/gridCells/index.d.ts +12 -0
- package/ui/Blocks/CommonGrid/components/gridCells/index.js +12 -0
- package/ui/Blocks/CommonGrid/components/icons/ArrowSimple.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/icons/ArrowSimple.js +14 -0
- package/ui/Blocks/CommonGrid/components/icons/Edit.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/icons/Edit.js +14 -0
- package/ui/Blocks/CommonGrid/components/icons/EyeOpen.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/icons/EyeOpen.js +14 -0
- package/ui/Blocks/CommonGrid/components/icons/Sorting.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/icons/Sorting.js +14 -0
- package/ui/Blocks/CommonGrid/components/utils.d.ts +8 -0
- package/ui/Blocks/CommonGrid/components/utils.js +22 -0
- package/ui/Blocks/CommonGrid/hooks/useColumnSizes.d.ts +12 -0
- package/ui/Blocks/CommonGrid/hooks/useColumnSizes.js +83 -0
- package/ui/Blocks/CommonGrid/hooks/useEditReadAsColumn.d.ts +15 -0
- package/ui/Blocks/CommonGrid/hooks/useEditReadAsColumn.js +70 -0
- package/ui/Blocks/CommonGrid/hooks/useGetGridHeight.d.ts +7 -0
- package/ui/Blocks/CommonGrid/hooks/useGetGridHeight.js +33 -0
- package/ui/Blocks/CommonGrid/hooks/useManageColumn.d.ts +19 -0
- package/ui/Blocks/CommonGrid/hooks/useManageColumn.js +34 -0
- package/ui/Blocks/CommonGrid/hooks/useRowsKeyControls.d.ts +4 -0
- package/ui/Blocks/CommonGrid/hooks/useRowsKeyControls.js +21 -0
- package/ui/Blocks/CommonGrid/hooks/useUxReset.d.ts +3 -0
- package/ui/Blocks/CommonGrid/hooks/useUxReset.js +15 -0
- package/ui/Blocks/CommonGrid/index.d.ts +7 -0
- package/ui/Blocks/CommonGrid/index.js +7 -0
- package/ui/Blocks/CommonGrid/store/index.d.ts +58 -0
- package/ui/Blocks/CommonGrid/store/index.js +230 -0
- package/ui/Blocks/CommonGrid/store/migrateState.d.ts +3 -0
- package/ui/Blocks/CommonGrid/store/migrateState.js +14 -0
- package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.d.ts +11 -0
- package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.js +31 -0
- package/ui/Blocks/CommonGrid/storybook/stories/customControllButtons.stories.d.ts +13 -0
- package/ui/Blocks/CommonGrid/storybook/stories/customControllButtons.stories.js +49 -0
- package/ui/Blocks/CommonGrid/storybook/stories/default.stories.d.ts +6 -0
- package/ui/Blocks/CommonGrid/storybook/stories/default.stories.js +14 -0
- package/ui/Blocks/CommonGrid/storybook/stories/loading.stories.d.ts +10 -0
- package/ui/Blocks/CommonGrid/storybook/stories/loading.stories.js +11 -0
- package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNoScrollLayout.stories.d.ts +10 -0
- package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNoScrollLayout.stories.js +12 -0
- package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNormalLayout.stories.d.ts +10 -0
- package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNormalLayout.stories.js +12 -0
- package/ui/Blocks/CommonGrid/storybook/stories/styledCommonGrid.stories.d.ts +6 -0
- package/ui/Blocks/CommonGrid/storybook/stories/styledCommonGrid.stories.js +15 -0
- package/ui/Blocks/CommonGrid/storybook/stories/withCustomGridActions.stories.d.ts +10 -0
- package/ui/Blocks/CommonGrid/storybook/stories/withCustomGridActions.stories.js +15 -0
- package/ui/Blocks/CommonGrid/storybook/stories/withForcedCheckboxes.stories.d.ts +14 -0
- package/ui/Blocks/CommonGrid/storybook/stories/withForcedCheckboxes.stories.js +24 -0
- package/ui/Blocks/CommonGrid/storybook/utils/actions.d.ts +4 -0
- package/ui/Blocks/CommonGrid/storybook/utils/actions.js +6 -0
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.d.ts +10 -0
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +97 -0
- package/ui/Blocks/CommonGrid/storybook/utils/filters.d.ts +2 -0
- package/ui/Blocks/CommonGrid/storybook/utils/filters.js +23 -0
- package/ui/Blocks/CommonGrid/storybook/utils/utils.d.ts +17 -0
- package/ui/Blocks/CommonGrid/storybook/utils/utils.js +66 -0
- package/ui/Blocks/CommonGrid/storybook/utils/withRedux.d.ts +2 -0
- package/ui/Blocks/CommonGrid/storybook/utils/withRedux.js +12 -0
- package/ui/Blocks/CommonGrid/storybook/utils/withRouter.d.ts +2 -0
- package/ui/Blocks/CommonGrid/storybook/utils/withRouter.js +4 -0
- package/ui/Blocks/CommonGrid/storybook/utils/withTheme.d.ts +2 -0
- package/ui/Blocks/CommonGrid/storybook/utils/withTheme.js +18 -0
- package/ui/Blocks/CommonGrid/styles.d.ts +12 -0
- package/ui/Blocks/CommonGrid/styles.js +33 -0
- package/ui/Blocks/CommonGrid/translations.d.ts +1 -0
- package/ui/Blocks/CommonGrid/translations.js +6 -0
- package/ui/Blocks/CommonGrid/types.d.ts +313 -0
- package/ui/Blocks/CommonGrid/types.js +8 -0
- package/ui/Blocks/CommonGrid/utils/index.d.ts +19 -0
- package/ui/Blocks/CommonGrid/utils/index.js +78 -0
- package/ui/Blocks/CommonGrid/utils/public.d.ts +16 -0
- package/ui/Blocks/CommonGrid/utils/public.js +52 -0
- package/ui/Blocks/Popover/index.d.ts +10 -0
- package/ui/Blocks/Popover/index.js +19 -0
- package/ui/Elements/DatePicker/DatePicker.d.ts +20 -0
- package/ui/Elements/DatePicker/DatePicker.js +65 -0
- package/ui/Elements/DatePicker/Datetime/DateTime.d.ts +95 -0
- package/ui/Elements/DatePicker/Datetime/DateTime.js +516 -0
- package/ui/Elements/DatePicker/Datetime/components/Timepicker.d.ts +8 -0
- package/ui/Elements/DatePicker/Datetime/components/Timepicker.js +57 -0
- package/ui/Elements/DatePicker/Datetime/components/ViewNavigation.d.ts +9 -0
- package/ui/Elements/DatePicker/Datetime/components/ViewNavigation.js +16 -0
- package/ui/Elements/DatePicker/Datetime/types.d.ts +61 -0
- package/ui/Elements/DatePicker/Datetime/types.js +7 -0
- package/ui/Elements/DatePicker/Datetime/views/DaysView.d.ts +14 -0
- package/ui/Elements/DatePicker/Datetime/views/DaysView.js +145 -0
- package/ui/Elements/DatePicker/Datetime/views/MonthsView.d.ts +10 -0
- package/ui/Elements/DatePicker/Datetime/views/MonthsView.js +111 -0
- package/ui/Elements/DatePicker/Datetime/views/YearsView.d.ts +15 -0
- package/ui/Elements/DatePicker/Datetime/views/YearsView.js +117 -0
- package/ui/Elements/DatePicker/index.d.ts +2 -0
- package/ui/Elements/DatePicker/index.js +2 -0
- package/ui/Elements/DatePicker/styles.d.ts +2 -0
- package/ui/Elements/DatePicker/styles.js +8 -0
- package/ui/Elements/DatePicker/utils/getLanguage.d.ts +1 -0
- package/ui/Elements/DatePicker/utils/getLanguage.js +10 -0
- package/ui/Elements/DropdownMenu/DropdownMenu.d.ts +2 -0
- package/ui/Elements/DropdownMenu/DropdownMenu.js +36 -0
- package/ui/Elements/DropdownMenu/components/DefaultItem.d.ts +3 -0
- package/ui/Elements/DropdownMenu/components/DefaultItem.js +16 -0
- package/ui/Elements/DropdownMenu/components/MenuItem.d.ts +3 -0
- package/ui/Elements/DropdownMenu/components/MenuItem.js +51 -0
- package/ui/Elements/DropdownMenu/components/MenuList.d.ts +3 -0
- package/ui/Elements/DropdownMenu/components/MenuList.js +10 -0
- package/ui/Elements/DropdownMenu/index.d.ts +1 -0
- package/ui/Elements/DropdownMenu/index.js +1 -0
- package/ui/Elements/DropdownMenu/types.d.ts +41 -0
- package/ui/Elements/DropdownMenu/types.js +1 -0
- package/ui/Elements/HighlightBox/HighlightBox.d.ts +50 -0
- package/ui/Elements/HighlightBox/HighlightBox.js +65 -0
- package/ui/Elements/HighlightBox/index.d.ts +2 -0
- package/ui/Elements/HighlightBox/index.js +2 -0
- package/ui/Elements/MultiSelect/MultiSelect.d.ts +6 -0
- package/ui/Elements/MultiSelect/MultiSelect.js +29 -0
- package/ui/Elements/MultiSelect/index.d.ts +2 -0
- package/ui/Elements/MultiSelect/index.js +2 -0
- package/ui/Elements/Pagination/Pagination.d.ts +1 -1
- package/ui/Elements/Pagination/Pagination.js +6 -2
- package/ui/Elements/Pagination/styled.js +6 -6
- package/ui/Elements/Select/Select.d.ts +3 -0
- package/ui/Elements/Select/Select.js +69 -0
- package/ui/Elements/Select/index.d.ts +2 -0
- package/ui/Elements/Select/index.js +2 -0
- package/ui/Elements/Select/styles.d.ts +5 -0
- package/ui/Elements/Select/styles.js +12 -0
- package/ui/Elements/Select/themes/CustomComponents.d.ts +9 -0
- package/ui/Elements/Select/themes/CustomComponents.js +131 -0
- package/ui/Elements/Select/themes/baseStyles.d.ts +28 -0
- package/ui/Elements/Select/themes/baseStyles.js +70 -0
- package/ui/Elements/Select/themes/formStyles.d.ts +23 -0
- package/ui/Elements/Select/themes/formStyles.js +104 -0
- package/ui/Elements/Select/themes/headingStyles.d.ts +17 -0
- package/ui/Elements/Select/themes/headingStyles.js +99 -0
- package/ui/Elements/Select/themes/index.d.ts +3 -0
- package/ui/Elements/Select/themes/index.js +61 -0
- package/ui/Elements/Select/themes/leftMenuStyles.d.ts +18 -0
- package/ui/Elements/Select/themes/leftMenuStyles.js +57 -0
- package/ui/Elements/Select/types.d.ts +54 -0
- package/ui/Elements/Select/types.js +1 -0
- package/ui/Elements/SingleSelect/SingleSelect.d.ts +20 -0
- package/ui/Elements/SingleSelect/SingleSelect.js +197 -0
- package/ui/Elements/SingleSelect/index.d.ts +2 -0
- package/ui/Elements/SingleSelect/index.js +2 -0
- package/ui/Forms/Input/types.d.ts +2 -2
- package/ui/index.es.js +868 -1104
- package/ui/index.umd.js +8 -5
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import moment from 'moment';
|
|
25
|
+
// @TODO each language has 62kb gziped, please replace moment with different lib
|
|
26
|
+
import 'moment/dist/locale/cs';
|
|
27
|
+
import 'moment/dist/locale/ru';
|
|
28
|
+
import 'moment/dist/locale/sk';
|
|
29
|
+
import 'moment/dist/locale/it';
|
|
30
|
+
import 'moment/dist/locale/el';
|
|
31
|
+
import React, { useCallback } from 'react';
|
|
32
|
+
import DatetimePicker from './Datetime/DateTime';
|
|
33
|
+
import { x } from '@xstyled/styled-components';
|
|
34
|
+
import { DatePickerBase } from './styles';
|
|
35
|
+
import SpaceAroundWrap from '../SpaceAround';
|
|
36
|
+
import Input from '../../Forms/Input';
|
|
37
|
+
import { getLanguage } from './utils/getLanguage';
|
|
38
|
+
var defaultDateFormat = 'DD.MM.YYYY';
|
|
39
|
+
var DatePicker = function (_a) {
|
|
40
|
+
var name = _a.name, value = _a.value, initialViewDate = _a.initialViewDate, error = _a.error, label = _a.label, disabled = _a.disabled, isValidDate = _a.isValidDate, onChange = _a.onChange, _b = _a.dateFormat, dateFormat = _b === void 0 ? defaultDateFormat : _b, _c = _a.timeFormat, timeFormat = _c === void 0 ? false : _c, open = _a.open, _d = _a.secondValue, secondValue = _d === void 0 ? null : _d, input = _a.input, _e = _a.icon, icon = _e === void 0 ? true : _e, _f = _a.showInputLabel, showInputLabel = _f === void 0 ? false : _f, _g = _a.showCalendarLabel, showCalendarLabel = _g === void 0 ? true : _g, _h = _a.spaceAround, spaceAround = _h === void 0 ? false : _h, className = _a.className, onClear = _a.onClear, passProps = __rest(_a, ["name", "value", "initialViewDate", "error", "label", "disabled", "isValidDate", "onChange", "dateFormat", "timeFormat", "open", "secondValue", "input", "icon", "showInputLabel", "showCalendarLabel", "spaceAround", "className", "onClear"]);
|
|
41
|
+
var format = "".concat(dateFormat).concat(timeFormat ? " ".concat(timeFormat) : "");
|
|
42
|
+
var isValid = !!value && moment(value, format).isValid();
|
|
43
|
+
var stringValue = isValid ? moment(value, format).format(format) : value;
|
|
44
|
+
var locale = getLanguage();
|
|
45
|
+
var handleRenderInput = useCallback(function (_, openCalendar) {
|
|
46
|
+
return (_jsx(Input, { type: "text", icon: icon ? 'calendar' : undefined, name: name, error: error, disabled: disabled, isInvalid: !!error, label: showInputLabel ? label : undefined, value: stringValue, onFocus: openCalendar, iconOnClick: openCalendar, onClear: onClear }));
|
|
47
|
+
}, [name, stringValue, error, label, showInputLabel, isValid, disabled]);
|
|
48
|
+
var handleRenderView = useCallback(function (_, renderCalendar) {
|
|
49
|
+
if (label && !showInputLabel) {
|
|
50
|
+
return (_jsx(x.div, { display: "flex", flexDirection: "column", children: renderCalendar() }));
|
|
51
|
+
}
|
|
52
|
+
return renderCalendar();
|
|
53
|
+
}, [label, showInputLabel]);
|
|
54
|
+
var handleChange = useCallback(function (value) {
|
|
55
|
+
var parsed = typeof value === 'string' ? value : value.toDate();
|
|
56
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(parsed);
|
|
57
|
+
}, [onChange]);
|
|
58
|
+
var handleIsValid = useCallback(function (current, selected) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
var parsed = [(_a = current === null || current === void 0 ? void 0 : current.toDate) === null || _a === void 0 ? void 0 : _a.call(current), (_b = selected === null || selected === void 0 ? void 0 : selected.toDate) === null || _b === void 0 ? void 0 : _b.call(selected)];
|
|
61
|
+
return isValidDate ? isValidDate.apply(void 0, parsed) : true;
|
|
62
|
+
}, [isValidDate]);
|
|
63
|
+
return (_jsx(SpaceAroundWrap, { spaceAround: spaceAround, children: _jsx(DatePickerBase, { className: className, children: _jsx(DatetimePicker, __assign({ value: value, dateFormat: dateFormat, timeFormat: timeFormat, secondValue: secondValue, open: open, input: input, label: showCalendarLabel ? label : undefined, onChange: handleChange, isValidDate: handleIsValid, renderView: handleRenderView, renderInput: handleRenderInput, initialViewDate: initialViewDate, locale: locale }, passProps)) }) }));
|
|
64
|
+
};
|
|
65
|
+
export default React.memo(DatePicker);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DatetimepickerProps } from './types';
|
|
4
|
+
export default class Datetime extends React.Component<DatetimepickerProps> {
|
|
5
|
+
static defaultProps: {
|
|
6
|
+
onOpen: () => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
onCalendarOpen: () => void;
|
|
9
|
+
onCalendarClose: () => void;
|
|
10
|
+
onChange: () => void;
|
|
11
|
+
onNavigate: () => void;
|
|
12
|
+
onBeforeNavigate: (next: any) => any;
|
|
13
|
+
onNavigateBack: () => void;
|
|
14
|
+
onNavigateForward: () => void;
|
|
15
|
+
dateFormat: boolean;
|
|
16
|
+
timeFormat: boolean;
|
|
17
|
+
utc: boolean;
|
|
18
|
+
className: string;
|
|
19
|
+
input: boolean;
|
|
20
|
+
inputProps: {};
|
|
21
|
+
timeConstraints: {};
|
|
22
|
+
isValidDate: () => boolean;
|
|
23
|
+
strictParsing: boolean;
|
|
24
|
+
closeOnSelect: boolean;
|
|
25
|
+
closeOnTab: boolean;
|
|
26
|
+
closeOnClickOutside: boolean;
|
|
27
|
+
renderView: (_: any, renderFunc: any) => any;
|
|
28
|
+
};
|
|
29
|
+
static moment: typeof moment;
|
|
30
|
+
constructor(props: any);
|
|
31
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
renderInput(): import("react/jsx-runtime").JSX.Element | undefined;
|
|
33
|
+
renderView(): JSX.Element;
|
|
34
|
+
_renderCalendar: () => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
getInitialState(): {
|
|
36
|
+
open: boolean;
|
|
37
|
+
currentView: string;
|
|
38
|
+
viewDate: any;
|
|
39
|
+
selectedDate: any;
|
|
40
|
+
inputValue: any;
|
|
41
|
+
};
|
|
42
|
+
getInitialViewDate(selectedDate: any): any;
|
|
43
|
+
getInitialDate(): any;
|
|
44
|
+
getInitialView(): string;
|
|
45
|
+
parseDate(date: any, dateFormat: any): any;
|
|
46
|
+
getClassName(): string;
|
|
47
|
+
isOpen(): any;
|
|
48
|
+
getUpdateOn(dateFormat: any): string;
|
|
49
|
+
getLocaleData(): any;
|
|
50
|
+
getDateFormat(): any;
|
|
51
|
+
getTimeFormat(): any;
|
|
52
|
+
getFormat(type: any): any;
|
|
53
|
+
_showView: (view: any, date: any) => void;
|
|
54
|
+
updateTime(op: any, amount: any, type: any, toSelected: any): void;
|
|
55
|
+
viewToMethod: {
|
|
56
|
+
days: string;
|
|
57
|
+
months: string;
|
|
58
|
+
years: string;
|
|
59
|
+
};
|
|
60
|
+
nextView: {
|
|
61
|
+
days: string;
|
|
62
|
+
months: string;
|
|
63
|
+
years: string;
|
|
64
|
+
};
|
|
65
|
+
_updateDate: (e: any) => void;
|
|
66
|
+
_viewNavigate: (modifier: any, unit: any) => void;
|
|
67
|
+
_setTime: (type: any, value: any) => void;
|
|
68
|
+
_openCalendar: () => void;
|
|
69
|
+
_closeCalendar: () => void;
|
|
70
|
+
_handleClickOutside: () => void;
|
|
71
|
+
localMoment(date: any, format: any, props: any): any;
|
|
72
|
+
checkTZ(): void;
|
|
73
|
+
componentDidUpdate(prevProps: any): void;
|
|
74
|
+
regenerateDates(): void;
|
|
75
|
+
getSelectedDate(): any;
|
|
76
|
+
getInitialInputValue(selectedDate: any): any;
|
|
77
|
+
getInputValue(): any;
|
|
78
|
+
/**
|
|
79
|
+
* Set the date that is currently shown in the calendar.
|
|
80
|
+
* This is independent from the selected date and it's the one used to navigate through months or days in the calendar.
|
|
81
|
+
* @param dateType date
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
setViewDate(date: any): void;
|
|
85
|
+
/**
|
|
86
|
+
* Set the view currently shown by the calendar. View modes shipped with react-datetime are 'years', 'months', 'days' and 'time'.
|
|
87
|
+
* @param TYPES.string mode
|
|
88
|
+
*/
|
|
89
|
+
navigate(mode: any): void;
|
|
90
|
+
_onInputFocus: (e: any) => void;
|
|
91
|
+
_onInputChange: (e: any) => void;
|
|
92
|
+
_onInputKeyDown: (e: any) => void;
|
|
93
|
+
_onInputClick: (e: any) => void;
|
|
94
|
+
callHandler(method: any, e: any): boolean;
|
|
95
|
+
}
|
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __assign = (this && this.__assign) || function () {
|
|
17
|
+
__assign = Object.assign || function(t) {
|
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
+
s = arguments[i];
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
+
t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
return __assign.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
|
+
// @ts-nocheck
|
|
29
|
+
import moment from 'moment';
|
|
30
|
+
import React from 'react';
|
|
31
|
+
import DaysView from './views/DaysView';
|
|
32
|
+
import MonthsView from './views/MonthsView';
|
|
33
|
+
import YearsView from './views/YearsView';
|
|
34
|
+
import onClickOutside from 'react-onclickoutside';
|
|
35
|
+
var viewModes = {
|
|
36
|
+
YEARS: 'years',
|
|
37
|
+
MONTHS: 'months',
|
|
38
|
+
DAYS: 'days',
|
|
39
|
+
TIME: 'time',
|
|
40
|
+
};
|
|
41
|
+
var nofn = function () { };
|
|
42
|
+
var Datetime = /** @class */ (function (_super) {
|
|
43
|
+
__extends(Datetime, _super);
|
|
44
|
+
function Datetime(props) {
|
|
45
|
+
var _this = _super.call(this, props) || this;
|
|
46
|
+
_this._renderCalendar = function () {
|
|
47
|
+
var props = _this.props;
|
|
48
|
+
var state = _this.state;
|
|
49
|
+
var viewProps = {
|
|
50
|
+
viewDate: state.viewDate.clone(),
|
|
51
|
+
label: props.label,
|
|
52
|
+
secondValue: props.secondValue,
|
|
53
|
+
selectedDate: _this.getSelectedDate(),
|
|
54
|
+
isValidDate: props.isValidDate,
|
|
55
|
+
updateDate: _this._updateDate,
|
|
56
|
+
navigate: _this._viewNavigate,
|
|
57
|
+
moment: moment,
|
|
58
|
+
showView: _this._showView,
|
|
59
|
+
};
|
|
60
|
+
// Probably updateOn, updateSelectedDate and setDate can be merged in the same method
|
|
61
|
+
// that would update viewDate or selectedDate depending on the view and the dateFormat
|
|
62
|
+
switch (state.currentView) {
|
|
63
|
+
case viewModes.YEARS:
|
|
64
|
+
// Used viewProps
|
|
65
|
+
// { viewDate, selectedDate, renderYear, isValidDate, navigate, showView, updateDate }
|
|
66
|
+
viewProps.renderYear = props.renderYear;
|
|
67
|
+
return _jsx(YearsView, __assign({}, viewProps));
|
|
68
|
+
case viewModes.MONTHS:
|
|
69
|
+
// { viewDate, selectedDate, renderMonth, isValidDate, navigate, showView, updateDate }
|
|
70
|
+
viewProps.renderMonth = props.renderMonth;
|
|
71
|
+
return _jsx(MonthsView, __assign({}, viewProps));
|
|
72
|
+
case viewModes.DAYS:
|
|
73
|
+
// { viewDate, selectedDate, renderDay, isValidDate, navigate, showView, updateDate, timeFormat
|
|
74
|
+
viewProps.renderDay = props.renderDay;
|
|
75
|
+
viewProps.timeFormat = _this.getFormat('time');
|
|
76
|
+
viewProps.setTime = _this._setTime;
|
|
77
|
+
viewProps.value = _this.props.value;
|
|
78
|
+
viewProps.disabled = _this.props.disabled;
|
|
79
|
+
return _jsx(DaysView, __assign({}, viewProps));
|
|
80
|
+
default:
|
|
81
|
+
viewProps.renderDay = props.renderDay;
|
|
82
|
+
viewProps.timeFormat = _this.getFormat('time');
|
|
83
|
+
viewProps.setTime = _this._setTime;
|
|
84
|
+
viewProps.value = _this.props.value;
|
|
85
|
+
return _jsx(DaysView, __assign({}, viewProps));
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
_this._showView = function (view, date) {
|
|
89
|
+
var d = (date || _this.state.viewDate).clone();
|
|
90
|
+
var nextView = _this.props.onBeforeNavigate(view, _this.state.currentView, d);
|
|
91
|
+
if (nextView && _this.state.currentView !== nextView) {
|
|
92
|
+
_this.props.onNavigate(nextView);
|
|
93
|
+
_this.setState({ currentView: nextView });
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
_this.viewToMethod = { days: 'date', months: 'month', years: 'year' };
|
|
97
|
+
_this.nextView = { days: 'time', months: 'days', years: 'months' };
|
|
98
|
+
_this._updateDate = function (e) {
|
|
99
|
+
var state = _this.state;
|
|
100
|
+
var currentView = state.currentView;
|
|
101
|
+
var updateOnView = _this.getUpdateOn(_this.getFormat('date'));
|
|
102
|
+
var viewDate = _this.state.viewDate.clone();
|
|
103
|
+
// Set the value into day/month/year
|
|
104
|
+
viewDate[_this.viewToMethod[currentView]](parseInt(e.target.getAttribute('data-value'), 10));
|
|
105
|
+
// Need to set month and year will for days view (prev/next month)
|
|
106
|
+
if (currentView === 'days') {
|
|
107
|
+
viewDate.month(parseInt(e.target.getAttribute('data-month'), 10));
|
|
108
|
+
viewDate.year(parseInt(e.target.getAttribute('data-year'), 10));
|
|
109
|
+
}
|
|
110
|
+
var update = { viewDate: viewDate };
|
|
111
|
+
if (currentView === updateOnView) {
|
|
112
|
+
update.selectedDate = viewDate.clone();
|
|
113
|
+
update.inputValue = viewDate.format(_this.getFormat('datetime'));
|
|
114
|
+
if (_this.props.open === undefined && _this.props.input && _this.props.closeOnSelect) {
|
|
115
|
+
_this._closeCalendar();
|
|
116
|
+
}
|
|
117
|
+
_this.props.onChange(viewDate.clone());
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
_this._showView(_this.nextView[currentView], viewDate);
|
|
121
|
+
}
|
|
122
|
+
_this.setState(update);
|
|
123
|
+
};
|
|
124
|
+
_this._viewNavigate = function (modifier, unit) {
|
|
125
|
+
var viewDate = _this.state.viewDate.clone();
|
|
126
|
+
// Subtracting is just adding negative time
|
|
127
|
+
viewDate.add(modifier, unit);
|
|
128
|
+
if (modifier > 0) {
|
|
129
|
+
_this.props.onNavigateForward(modifier, unit);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
_this.props.onNavigateBack(-modifier, unit);
|
|
133
|
+
}
|
|
134
|
+
_this.setState({ viewDate: viewDate });
|
|
135
|
+
};
|
|
136
|
+
_this._setTime = function (type, value) {
|
|
137
|
+
var date = (_this.getSelectedDate() || _this.state.viewDate).clone();
|
|
138
|
+
date[type](value);
|
|
139
|
+
if (!_this.props.value) {
|
|
140
|
+
_this.setState({
|
|
141
|
+
selectedDate: date,
|
|
142
|
+
viewDate: date.clone(),
|
|
143
|
+
inputValue: date.format(_this.getFormat('datetime')),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
_this.props.onChange(date);
|
|
147
|
+
};
|
|
148
|
+
_this._openCalendar = function () {
|
|
149
|
+
if (_this.isOpen())
|
|
150
|
+
return;
|
|
151
|
+
_this.setState({ open: true }, _this.props.onOpen);
|
|
152
|
+
};
|
|
153
|
+
_this._closeCalendar = function () {
|
|
154
|
+
if (!_this.isOpen())
|
|
155
|
+
return;
|
|
156
|
+
_this.setState({ open: false }, function () {
|
|
157
|
+
_this.props.onClose(_this.state.selectedDate || _this.state.inputValue);
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
_this._handleClickOutside = function () {
|
|
161
|
+
var props = _this.props;
|
|
162
|
+
if (props.input && _this.state.open && props.open === undefined && props.closeOnClickOutside) {
|
|
163
|
+
_this._closeCalendar();
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
_this._onInputFocus = function (e) {
|
|
167
|
+
if (!_this.callHandler(_this.props.inputProps.onFocus, e))
|
|
168
|
+
return;
|
|
169
|
+
_this._openCalendar();
|
|
170
|
+
};
|
|
171
|
+
_this._onInputChange = function (e) {
|
|
172
|
+
if (!_this.callHandler(_this.props.inputProps.onChange, e))
|
|
173
|
+
return;
|
|
174
|
+
var value = e.target ? e.target.value : e;
|
|
175
|
+
var localMoment = _this.localMoment(value, _this.getFormat('datetime'));
|
|
176
|
+
var update = { inputValue: value };
|
|
177
|
+
if (localMoment.isValid()) {
|
|
178
|
+
update.selectedDate = localMoment;
|
|
179
|
+
update.viewDate = localMoment.clone().startOf('month');
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
update.selectedDate = null;
|
|
183
|
+
}
|
|
184
|
+
_this.setState(update, function () {
|
|
185
|
+
_this.props.onChange(localMoment.isValid() ? localMoment : _this.state.inputValue);
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
_this._onInputKeyDown = function (e) {
|
|
189
|
+
if (!_this.callHandler(_this.props.inputProps.onKeyDown, e))
|
|
190
|
+
return;
|
|
191
|
+
if (e.which === 9 && _this.props.closeOnTab) {
|
|
192
|
+
_this._closeCalendar();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
_this._onInputClick = function (e) {
|
|
196
|
+
// Focus event should open the calendar, but there is some case where
|
|
197
|
+
// the input is already focused and the picker is closed, so clicking the input
|
|
198
|
+
// should open it again see https://github.com/arqex/react-datetime/issues/717
|
|
199
|
+
if (!_this.callHandler(_this.props.inputProps.onClick, e))
|
|
200
|
+
return;
|
|
201
|
+
_this._openCalendar();
|
|
202
|
+
};
|
|
203
|
+
_this.state = _this.getInitialState();
|
|
204
|
+
return _this;
|
|
205
|
+
}
|
|
206
|
+
Datetime.prototype.render = function () {
|
|
207
|
+
return (_jsxs(ClickableWrapper, { className: this.getClassName(), onClickOut: this._handleClickOutside, children: [this.renderInput(), _jsx("div", { className: "rdtPicker", children: this.renderView() })] }));
|
|
208
|
+
};
|
|
209
|
+
Datetime.prototype.renderInput = function () {
|
|
210
|
+
if (!this.props.input)
|
|
211
|
+
return;
|
|
212
|
+
var finalInputProps = __assign(__assign({ type: 'text', className: 'form-control', value: this.getInputValue() }, this.props.inputProps), { onFocus: this._onInputFocus, onChange: this._onInputChange, onKeyDown: this._onInputKeyDown, onClick: this._onInputClick });
|
|
213
|
+
if (this.props.renderInput) {
|
|
214
|
+
return _jsx("div", { children: this.props.renderInput(finalInputProps, this._openCalendar, this._closeCalendar) });
|
|
215
|
+
}
|
|
216
|
+
return _jsx("input", __assign({}, finalInputProps));
|
|
217
|
+
};
|
|
218
|
+
Datetime.prototype.renderView = function () {
|
|
219
|
+
return this.props.renderView(this.state.currentView, this._renderCalendar);
|
|
220
|
+
};
|
|
221
|
+
Datetime.prototype.getInitialState = function () {
|
|
222
|
+
var props = this.props;
|
|
223
|
+
var inputFormat = this.getFormat('datetime');
|
|
224
|
+
var selectedDate = this.parseDate(props.value || props.initialValue, inputFormat);
|
|
225
|
+
this.checkTZ();
|
|
226
|
+
return {
|
|
227
|
+
open: !props.input,
|
|
228
|
+
currentView: props.initialViewMode || this.getInitialView(),
|
|
229
|
+
viewDate: this.getInitialViewDate(selectedDate),
|
|
230
|
+
selectedDate: selectedDate && selectedDate.isValid() ? selectedDate : undefined,
|
|
231
|
+
inputValue: this.getInitialInputValue(selectedDate),
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
Datetime.prototype.getInitialViewDate = function (selectedDate) {
|
|
235
|
+
var propDate = this.props.initialViewDate;
|
|
236
|
+
var viewDate;
|
|
237
|
+
if (propDate) {
|
|
238
|
+
viewDate = this.parseDate(propDate, this.getFormat('datetime'));
|
|
239
|
+
if (viewDate && viewDate.isValid()) {
|
|
240
|
+
return viewDate;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
console.log('The initialViewDated given "' + propDate + '" is not valid. Using current date instead.');
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else if (selectedDate && selectedDate.isValid()) {
|
|
247
|
+
return selectedDate.clone();
|
|
248
|
+
}
|
|
249
|
+
return this.getInitialDate();
|
|
250
|
+
};
|
|
251
|
+
Datetime.prototype.getInitialDate = function () {
|
|
252
|
+
var m = this.localMoment();
|
|
253
|
+
m.hour(0).minute(0).second(0).millisecond(0);
|
|
254
|
+
return m;
|
|
255
|
+
};
|
|
256
|
+
Datetime.prototype.getInitialView = function () {
|
|
257
|
+
var dateFormat = this.getFormat('date');
|
|
258
|
+
return dateFormat ? this.getUpdateOn(dateFormat) : viewModes.TIME;
|
|
259
|
+
};
|
|
260
|
+
Datetime.prototype.parseDate = function (date, dateFormat) {
|
|
261
|
+
var parsedDate;
|
|
262
|
+
if (date && typeof date === 'string')
|
|
263
|
+
parsedDate = this.localMoment(date, dateFormat);
|
|
264
|
+
else if (date)
|
|
265
|
+
parsedDate = this.localMoment(date);
|
|
266
|
+
if (parsedDate && !parsedDate.isValid())
|
|
267
|
+
parsedDate = null;
|
|
268
|
+
return parsedDate;
|
|
269
|
+
};
|
|
270
|
+
Datetime.prototype.getClassName = function () {
|
|
271
|
+
var cn = 'rdt';
|
|
272
|
+
var props = this.props;
|
|
273
|
+
var propCn = props.className;
|
|
274
|
+
if (Array.isArray(propCn)) {
|
|
275
|
+
cn += ' ' + propCn.join(' ');
|
|
276
|
+
}
|
|
277
|
+
else if (propCn) {
|
|
278
|
+
cn += ' ' + propCn;
|
|
279
|
+
}
|
|
280
|
+
if (!props.input) {
|
|
281
|
+
cn += ' rdtStatic';
|
|
282
|
+
}
|
|
283
|
+
if (this.isOpen()) {
|
|
284
|
+
cn += ' rdtOpen';
|
|
285
|
+
}
|
|
286
|
+
return cn;
|
|
287
|
+
};
|
|
288
|
+
Datetime.prototype.isOpen = function () {
|
|
289
|
+
return !this.props.input || (this.props.open === undefined ? this.state.open : this.props.open);
|
|
290
|
+
};
|
|
291
|
+
Datetime.prototype.getUpdateOn = function (dateFormat) {
|
|
292
|
+
if (this.props.updateOnView) {
|
|
293
|
+
return this.props.updateOnView;
|
|
294
|
+
}
|
|
295
|
+
if (dateFormat.match(/[lLD]/)) {
|
|
296
|
+
return viewModes.DAYS;
|
|
297
|
+
}
|
|
298
|
+
if (dateFormat.indexOf('M') !== -1) {
|
|
299
|
+
return viewModes.MONTHS;
|
|
300
|
+
}
|
|
301
|
+
if (dateFormat.indexOf('Y') !== -1) {
|
|
302
|
+
return viewModes.YEARS;
|
|
303
|
+
}
|
|
304
|
+
return viewModes.DAYS;
|
|
305
|
+
};
|
|
306
|
+
Datetime.prototype.getLocaleData = function () {
|
|
307
|
+
var p = this.props;
|
|
308
|
+
return this.localMoment(p.value || p.defaultValue || new Date()).localeData();
|
|
309
|
+
};
|
|
310
|
+
Datetime.prototype.getDateFormat = function () {
|
|
311
|
+
var locale = this.getLocaleData();
|
|
312
|
+
var format = this.props.dateFormat;
|
|
313
|
+
if (format === true)
|
|
314
|
+
return locale.longDateFormat('L');
|
|
315
|
+
if (format)
|
|
316
|
+
return format;
|
|
317
|
+
return '';
|
|
318
|
+
};
|
|
319
|
+
Datetime.prototype.getTimeFormat = function () {
|
|
320
|
+
var locale = this.getLocaleData();
|
|
321
|
+
var format = this.props.timeFormat;
|
|
322
|
+
if (format === true) {
|
|
323
|
+
return locale.longDateFormat('LT');
|
|
324
|
+
}
|
|
325
|
+
return format || '';
|
|
326
|
+
};
|
|
327
|
+
Datetime.prototype.getFormat = function (type) {
|
|
328
|
+
if (type === 'date') {
|
|
329
|
+
return this.getDateFormat();
|
|
330
|
+
}
|
|
331
|
+
else if (type === 'time') {
|
|
332
|
+
return this.getTimeFormat();
|
|
333
|
+
}
|
|
334
|
+
var dateFormat = this.getDateFormat();
|
|
335
|
+
var timeFormat = this.getTimeFormat();
|
|
336
|
+
return dateFormat && timeFormat ? dateFormat + ' ' + timeFormat : dateFormat || timeFormat;
|
|
337
|
+
};
|
|
338
|
+
Datetime.prototype.updateTime = function (op, amount, type, toSelected) {
|
|
339
|
+
var update = {};
|
|
340
|
+
var date = toSelected ? 'selectedDate' : 'viewDate';
|
|
341
|
+
update[date] = this.state[date].clone()[op](amount, type);
|
|
342
|
+
this.setState(update);
|
|
343
|
+
};
|
|
344
|
+
Datetime.prototype.localMoment = function (date, format, props) {
|
|
345
|
+
props = props || this.props;
|
|
346
|
+
var m = null;
|
|
347
|
+
if (props.utc) {
|
|
348
|
+
m = moment.utc(date, format, props.strictParsing);
|
|
349
|
+
}
|
|
350
|
+
else if (props.displayTimeZone) {
|
|
351
|
+
m = moment.tz(date, format, props.displayTimeZone);
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
m = moment(date, format, props.strictParsing);
|
|
355
|
+
}
|
|
356
|
+
if (props.locale)
|
|
357
|
+
m.locale(props.locale);
|
|
358
|
+
return m;
|
|
359
|
+
};
|
|
360
|
+
Datetime.prototype.checkTZ = function () {
|
|
361
|
+
var displayTimeZone = this.props.displayTimeZone;
|
|
362
|
+
if (displayTimeZone && !this.tzWarning && !moment.tz) {
|
|
363
|
+
this.tzWarning = true;
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
Datetime.prototype.componentDidUpdate = function (prevProps) {
|
|
367
|
+
if (prevProps === this.props)
|
|
368
|
+
return;
|
|
369
|
+
var needsUpdate = false;
|
|
370
|
+
var thisProps = this.props;
|
|
371
|
+
['locale', 'utc', 'displayZone', 'dateFormat', 'timeFormat'].forEach(function (p) {
|
|
372
|
+
prevProps[p] !== thisProps[p] && (needsUpdate = true);
|
|
373
|
+
});
|
|
374
|
+
if (needsUpdate) {
|
|
375
|
+
this.regenerateDates();
|
|
376
|
+
}
|
|
377
|
+
if (thisProps.value && thisProps.value !== prevProps.value) {
|
|
378
|
+
this.setViewDate(thisProps.value);
|
|
379
|
+
}
|
|
380
|
+
this.checkTZ();
|
|
381
|
+
};
|
|
382
|
+
Datetime.prototype.regenerateDates = function () {
|
|
383
|
+
var props = this.props;
|
|
384
|
+
var viewDate = this.state.viewDate.clone();
|
|
385
|
+
var selectedDate = this.state.selectedDate && this.state.selectedDate.clone();
|
|
386
|
+
if (props.locale) {
|
|
387
|
+
viewDate.locale(props.locale);
|
|
388
|
+
selectedDate && selectedDate.locale(props.locale);
|
|
389
|
+
}
|
|
390
|
+
if (props.utc) {
|
|
391
|
+
viewDate.utc();
|
|
392
|
+
selectedDate && selectedDate.utc();
|
|
393
|
+
}
|
|
394
|
+
else if (props.displayTimeZone) {
|
|
395
|
+
viewDate.tz(props.displayTimeZone);
|
|
396
|
+
selectedDate && selectedDate.tz(props.displayTimeZone);
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
viewDate.locale();
|
|
400
|
+
selectedDate && selectedDate.locale();
|
|
401
|
+
}
|
|
402
|
+
var update = { viewDate: viewDate, selectedDate: selectedDate };
|
|
403
|
+
if (selectedDate && selectedDate.isValid()) {
|
|
404
|
+
update.inputValue = selectedDate.format(this.getFormat('datetime'));
|
|
405
|
+
}
|
|
406
|
+
this.setState(update);
|
|
407
|
+
};
|
|
408
|
+
Datetime.prototype.getSelectedDate = function () {
|
|
409
|
+
if (this.props.value === undefined)
|
|
410
|
+
return this.state.selectedDate;
|
|
411
|
+
var selectedDate = this.parseDate(this.props.value, this.getFormat('datetime'));
|
|
412
|
+
return selectedDate && selectedDate.isValid() ? selectedDate : false;
|
|
413
|
+
};
|
|
414
|
+
Datetime.prototype.getInitialInputValue = function (selectedDate) {
|
|
415
|
+
var props = this.props;
|
|
416
|
+
if (props.inputProps.value)
|
|
417
|
+
return props.inputProps.value;
|
|
418
|
+
if (selectedDate && selectedDate.isValid())
|
|
419
|
+
return selectedDate.format(this.getFormat('datetime'));
|
|
420
|
+
if (props.value && typeof props.value === 'string')
|
|
421
|
+
return props.value;
|
|
422
|
+
if (props.initialValue && typeof props.initialValue === 'string')
|
|
423
|
+
return props.initialValue;
|
|
424
|
+
return '';
|
|
425
|
+
};
|
|
426
|
+
Datetime.prototype.getInputValue = function () {
|
|
427
|
+
var selectedDate = this.getSelectedDate();
|
|
428
|
+
return selectedDate ? selectedDate.format(this.getFormat('datetime')) : this.state.inputValue;
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* Set the date that is currently shown in the calendar.
|
|
432
|
+
* This is independent from the selected date and it's the one used to navigate through months or days in the calendar.
|
|
433
|
+
* @param dateType date
|
|
434
|
+
* @public
|
|
435
|
+
*/
|
|
436
|
+
Datetime.prototype.setViewDate = function (date) {
|
|
437
|
+
var logError = function () {
|
|
438
|
+
return console.log('Invalid date passed to the `setViewDate` method: ' + date);
|
|
439
|
+
};
|
|
440
|
+
if (!date)
|
|
441
|
+
return logError();
|
|
442
|
+
var viewDate;
|
|
443
|
+
if (typeof date === 'string') {
|
|
444
|
+
viewDate = this.localMoment(date, this.getFormat('datetime'));
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
viewDate = this.localMoment(date);
|
|
448
|
+
}
|
|
449
|
+
if (!viewDate || !viewDate.isValid())
|
|
450
|
+
return logError();
|
|
451
|
+
this.setState({ viewDate: viewDate });
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* Set the view currently shown by the calendar. View modes shipped with react-datetime are 'years', 'months', 'days' and 'time'.
|
|
455
|
+
* @param TYPES.string mode
|
|
456
|
+
*/
|
|
457
|
+
Datetime.prototype.navigate = function (mode) {
|
|
458
|
+
this._showView(mode);
|
|
459
|
+
};
|
|
460
|
+
Datetime.prototype.callHandler = function (method, e) {
|
|
461
|
+
if (!method)
|
|
462
|
+
return true;
|
|
463
|
+
return method(e) !== false;
|
|
464
|
+
};
|
|
465
|
+
Datetime.defaultProps = {
|
|
466
|
+
onOpen: nofn,
|
|
467
|
+
onClose: nofn,
|
|
468
|
+
onCalendarOpen: nofn,
|
|
469
|
+
onCalendarClose: nofn,
|
|
470
|
+
onChange: nofn,
|
|
471
|
+
onNavigate: nofn,
|
|
472
|
+
onBeforeNavigate: function (next) {
|
|
473
|
+
return next;
|
|
474
|
+
},
|
|
475
|
+
onNavigateBack: nofn,
|
|
476
|
+
onNavigateForward: nofn,
|
|
477
|
+
dateFormat: true,
|
|
478
|
+
timeFormat: true,
|
|
479
|
+
utc: false,
|
|
480
|
+
className: '',
|
|
481
|
+
input: true,
|
|
482
|
+
inputProps: {},
|
|
483
|
+
timeConstraints: {},
|
|
484
|
+
isValidDate: function () {
|
|
485
|
+
return true;
|
|
486
|
+
},
|
|
487
|
+
strictParsing: true,
|
|
488
|
+
closeOnSelect: false,
|
|
489
|
+
closeOnTab: true,
|
|
490
|
+
closeOnClickOutside: true,
|
|
491
|
+
renderView: function (_, renderFunc) { return renderFunc(); },
|
|
492
|
+
};
|
|
493
|
+
// Make moment accessible through the Datetime class
|
|
494
|
+
Datetime.moment = moment;
|
|
495
|
+
return Datetime;
|
|
496
|
+
}(React.Component));
|
|
497
|
+
export default Datetime;
|
|
498
|
+
var ClickOutBase = /** @class */ (function (_super) {
|
|
499
|
+
__extends(ClickOutBase, _super);
|
|
500
|
+
function ClickOutBase() {
|
|
501
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
502
|
+
_this.container = React.createRef();
|
|
503
|
+
return _this;
|
|
504
|
+
}
|
|
505
|
+
ClickOutBase.prototype.render = function () {
|
|
506
|
+
return (_jsx("div", { className: this.props.className, ref: this.container, children: this.props.children }));
|
|
507
|
+
};
|
|
508
|
+
ClickOutBase.prototype.handleClickOutside = function (e) {
|
|
509
|
+
this.props.onClickOut(e);
|
|
510
|
+
};
|
|
511
|
+
ClickOutBase.prototype.setClickOutsideRef = function () {
|
|
512
|
+
return this.container.current;
|
|
513
|
+
};
|
|
514
|
+
return ClickOutBase;
|
|
515
|
+
}(React.Component));
|
|
516
|
+
var ClickableWrapper = onClickOutside(ClickOutBase);
|