@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,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommonGridProps, GridActionsType, GridSelectorsType } from '../types';
|
|
3
|
+
type ReturnProps = {
|
|
4
|
+
displayColumnsWidth: {
|
|
5
|
+
[anyColumn: string]: number;
|
|
6
|
+
};
|
|
7
|
+
totalColumnsWidth: number;
|
|
8
|
+
gridBoxRef: React.MutableRefObject<HTMLElement>;
|
|
9
|
+
handleResizeDrag: (column: string, width: number) => void;
|
|
10
|
+
};
|
|
11
|
+
declare const useColumnSizes: (displayColumnsDefinitions: CommonGridProps['columnsDefinitions'], storeColumnsWidth: Required<GridSelectorsType>['columnsWidth'], storeColumnsWidthVariant: GridSelectorsType['columnsWidthVariant'], setColumnWidth: Required<GridActionsType>['setColumnWidth'], columnLayout: Required<CommonGridProps>['columnLayout'], minColumnWidth?: number) => ReturnProps;
|
|
12
|
+
export default useColumnSizes;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import sum from 'lodash/sum';
|
|
3
|
+
var useColumnSizes = function (displayColumnsDefinitions, storeColumnsWidth, storeColumnsWidthVariant, setColumnWidth, columnLayout, minColumnWidth) {
|
|
4
|
+
/**
|
|
5
|
+
* decorate grid resize with layout and reset grid widths if layout changes
|
|
6
|
+
*/
|
|
7
|
+
if (minColumnWidth === void 0) { minColumnWidth = 50; }
|
|
8
|
+
var handleSetColumnWidth = React.useCallback(function (columnWidth) { return setColumnWidth(columnWidth, columnLayout); }, [columnLayout, setColumnWidth]);
|
|
9
|
+
React.useEffect(function () {
|
|
10
|
+
if (storeColumnsWidthVariant != columnLayout)
|
|
11
|
+
handleSetColumnWidth(null);
|
|
12
|
+
}, [columnLayout, storeColumnsWidthVariant, handleSetColumnWidth]);
|
|
13
|
+
/**
|
|
14
|
+
* base width of each displayed column and of all displayed columns put together
|
|
15
|
+
*/
|
|
16
|
+
var displayColumnsWidth = React.useMemo(function () {
|
|
17
|
+
var displayColumnsWidth = {};
|
|
18
|
+
displayColumnsDefinitions.forEach(function (column) { return (displayColumnsWidth[column.name] = (storeColumnsWidth === null || storeColumnsWidth === void 0 ? void 0 : storeColumnsWidth[column.name]) || column.flexBasis); });
|
|
19
|
+
return displayColumnsWidth;
|
|
20
|
+
}, [displayColumnsDefinitions, storeColumnsWidth]);
|
|
21
|
+
var totalColumnsWidth = React.useMemo(function () {
|
|
22
|
+
return sum(Object.values(displayColumnsWidth));
|
|
23
|
+
}, [displayColumnsWidth]);
|
|
24
|
+
/**
|
|
25
|
+
* handling of remaining space
|
|
26
|
+
*/
|
|
27
|
+
// TODO optimize better
|
|
28
|
+
var gridBoxRef = React.useRef(null);
|
|
29
|
+
var testAdjustLastColumn = React.useCallback(function () {
|
|
30
|
+
var _a;
|
|
31
|
+
var _b;
|
|
32
|
+
var gridWidth = ((_b = gridBoxRef === null || gridBoxRef === void 0 ? void 0 : gridBoxRef.current) === null || _b === void 0 ? void 0 : _b.clientWidth) || null;
|
|
33
|
+
if ((columnLayout == 'normal' || columnLayout == 'sticky') && gridWidth && totalColumnsWidth < gridWidth) {
|
|
34
|
+
var lastColumn = displayColumnsDefinitions[displayColumnsDefinitions.length - 1];
|
|
35
|
+
if (lastColumn) {
|
|
36
|
+
var change = (_a = {}, _a[lastColumn.name] = displayColumnsWidth[lastColumn.name] + gridWidth - totalColumnsWidth, _a);
|
|
37
|
+
handleSetColumnWidth(change);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, [columnLayout, displayColumnsDefinitions, displayColumnsWidth, gridBoxRef, handleSetColumnWidth, totalColumnsWidth]);
|
|
41
|
+
React.useEffect(function () {
|
|
42
|
+
testAdjustLastColumn();
|
|
43
|
+
}, [testAdjustLastColumn]);
|
|
44
|
+
React.useLayoutEffect(function () {
|
|
45
|
+
window.addEventListener('resize', testAdjustLastColumn);
|
|
46
|
+
return function () { return window.removeEventListener('resize', testAdjustLastColumn); };
|
|
47
|
+
}, [testAdjustLastColumn]);
|
|
48
|
+
/**
|
|
49
|
+
* resizing of columns
|
|
50
|
+
*/
|
|
51
|
+
var handleResizeDrag = React.useCallback(function (columnName, width) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
var _c;
|
|
54
|
+
var i = displayColumnsDefinitions.findIndex(function (_a) {
|
|
55
|
+
var name = _a.name;
|
|
56
|
+
return name == columnName;
|
|
57
|
+
});
|
|
58
|
+
var nextColumn = displayColumnsDefinitions[i + 1];
|
|
59
|
+
if (columnLayout == 'normal' || columnLayout == 'sticky') {
|
|
60
|
+
var gridWidth = ((_c = gridBoxRef === null || gridBoxRef === void 0 ? void 0 : gridBoxRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) || null;
|
|
61
|
+
var lastColumnWidth = displayColumnsWidth[displayColumnsDefinitions[displayColumnsDefinitions.length - 1].name];
|
|
62
|
+
var lastColumnMinWidth = (gridWidth && gridWidth - (totalColumnsWidth - lastColumnWidth)) || 0;
|
|
63
|
+
var minWidth = !nextColumn ? Math.max(lastColumnMinWidth, minColumnWidth) : minColumnWidth;
|
|
64
|
+
var origin_1 = displayColumnsWidth[columnName];
|
|
65
|
+
var newWidth = origin_1 + width < minWidth ? minWidth : origin_1 + width;
|
|
66
|
+
handleSetColumnWidth((_a = {}, _a[columnName] = newWidth, _a));
|
|
67
|
+
}
|
|
68
|
+
else if (columnLayout == 'no-scroll') {
|
|
69
|
+
var nextColumnWidth = displayColumnsWidth[nextColumn.name];
|
|
70
|
+
var origin_2 = displayColumnsWidth[columnName];
|
|
71
|
+
var addedColumnWidth = origin_2 + width < minColumnWidth ? minColumnWidth - origin_2 : width;
|
|
72
|
+
var addedNextColumnWidth = nextColumnWidth - addedColumnWidth < minColumnWidth ? nextColumnWidth - minColumnWidth : addedColumnWidth;
|
|
73
|
+
var addedWidth = Math.min(addedColumnWidth, addedNextColumnWidth);
|
|
74
|
+
var columnsWidth = (_b = {}, _b[columnName] = origin_2 + addedWidth, _b);
|
|
75
|
+
if (nextColumn) {
|
|
76
|
+
columnsWidth[nextColumn.name] = nextColumnWidth - addedWidth;
|
|
77
|
+
}
|
|
78
|
+
handleSetColumnWidth(columnsWidth);
|
|
79
|
+
}
|
|
80
|
+
}, [displayColumnsDefinitions, columnLayout, displayColumnsWidth, totalColumnsWidth, minColumnWidth, handleSetColumnWidth]);
|
|
81
|
+
return { totalColumnsWidth: totalColumnsWidth, gridBoxRef: gridBoxRef, displayColumnsWidth: displayColumnsWidth, handleResizeDrag: handleResizeDrag };
|
|
82
|
+
};
|
|
83
|
+
export default useColumnSizes;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommonGridProps } from '../types';
|
|
2
|
+
type ExcludedProps = 'components' | 'filters' | 'onBatchAction' | 'extraControlButtons';
|
|
3
|
+
type Props = Omit<CommonGridProps, ExcludedProps>;
|
|
4
|
+
type UseEditReadAsColumnHook = {
|
|
5
|
+
columnsDefinitions: CommonGridProps['columnsDefinitions'];
|
|
6
|
+
actionColumnDefinition: CommonGridProps['actionColumnDefinition'];
|
|
7
|
+
onRowAction: CommonGridProps['onRowAction'];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Because in new design we are displaying lot of the controlls differently, including read and edit buttons in grid,
|
|
11
|
+
* easiest way to make all the definition changes is to just overwrite the here once, instead of modifying every single grid (33 instances atm).
|
|
12
|
+
* This will also allow to easily swap back to grid provided logic, if it becomes usable for redesigned grid or if design changes again
|
|
13
|
+
* */
|
|
14
|
+
declare const useEditReadAsColumn: (props: Props) => UseEditReadAsColumnHook;
|
|
15
|
+
export default useEditReadAsColumn;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
10
|
+
import { useCallback, useMemo } from 'react';
|
|
11
|
+
import getReadEditButtonCell from '../components/ReadEditButtonCell';
|
|
12
|
+
/**
|
|
13
|
+
* Because in new design we are displaying lot of the controlls differently, including read and edit buttons in grid,
|
|
14
|
+
* easiest way to make all the definition changes is to just overwrite the here once, instead of modifying every single grid (33 instances atm).
|
|
15
|
+
* This will also allow to easily swap back to grid provided logic, if it becomes usable for redesigned grid or if design changes again
|
|
16
|
+
* */
|
|
17
|
+
var useEditReadAsColumn = function (props) {
|
|
18
|
+
var onRowAction = props.onRowAction, actionColumnDefinition = props.actionColumnDefinition, columnsDefinitions = props.columnsDefinitions, onRowEditClick = props.onRowEditClick, onRowReadClick = props.onRowReadClick;
|
|
19
|
+
var modifiedActionColumnDefinition = useMemo(function () {
|
|
20
|
+
var _a;
|
|
21
|
+
if ((actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.forceCheckboxes) || ((_a = actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.actionOptions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
22
|
+
// note: this also removes actions, because we render action trigger outside the grid anyway
|
|
23
|
+
return { flexBasis: 40, forceCheckboxes: true, addRowNumbers: true, checkAllPosition: 'top' };
|
|
24
|
+
}
|
|
25
|
+
else if (actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.addRowNumbers) {
|
|
26
|
+
return { flexBasis: 40, addRowNumbers: true };
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}, [actionColumnDefinition]);
|
|
32
|
+
var modifiedOnRowAction = useCallback(function (id, field, value) {
|
|
33
|
+
if (field === 'row_edit' || field === 'row_read') {
|
|
34
|
+
if (field === 'row_edit' && onRowEditClick)
|
|
35
|
+
onRowEditClick(id, value);
|
|
36
|
+
if (field === 'row_read' && onRowReadClick)
|
|
37
|
+
onRowReadClick(id, value);
|
|
38
|
+
}
|
|
39
|
+
else if (onRowAction) {
|
|
40
|
+
return onRowAction(id, field, value);
|
|
41
|
+
}
|
|
42
|
+
}, [onRowAction, onRowEditClick, onRowReadClick]);
|
|
43
|
+
// TODO Entire logic of row edit / row read need to be completely refactored.
|
|
44
|
+
var CellComponent = useMemo(function () { return getReadEditButtonCell(actionColumnDefinition); }, [actionColumnDefinition]);
|
|
45
|
+
var modifiedColumnsDefinitions = useMemo(function () {
|
|
46
|
+
if ((actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowEdit) !== undefined || (actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowRead) !== undefined) {
|
|
47
|
+
return __spreadArray(__spreadArray([], columnsDefinitions, true), [
|
|
48
|
+
{
|
|
49
|
+
name: 'sticky',
|
|
50
|
+
flexBasis: 88,
|
|
51
|
+
filtering: false,
|
|
52
|
+
sorting: false,
|
|
53
|
+
sticky: true,
|
|
54
|
+
stickTo: 'right',
|
|
55
|
+
alwaysOn: true,
|
|
56
|
+
cellComponent: CellComponent,
|
|
57
|
+
},
|
|
58
|
+
], false);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return columnsDefinitions;
|
|
62
|
+
}
|
|
63
|
+
}, [CellComponent, actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowEdit, actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.canRowRead, columnsDefinitions]);
|
|
64
|
+
return {
|
|
65
|
+
columnsDefinitions: modifiedColumnsDefinitions,
|
|
66
|
+
actionColumnDefinition: modifiedActionColumnDefinition,
|
|
67
|
+
onRowAction: modifiedOnRowAction,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export default useEditReadAsColumn;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const useGetGridHeight: () => {
|
|
3
|
+
gridHeight: number | undefined;
|
|
4
|
+
gridRef: import("react").MutableRefObject<HTMLElement | null>;
|
|
5
|
+
paginationRef: import("react").MutableRefObject<HTMLElement | null>;
|
|
6
|
+
};
|
|
7
|
+
export default useGetGridHeight;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
var useGetGridHeight = function () {
|
|
3
|
+
var _a = useState(window.innerHeight), windowHeight = _a[0], setWindowHeight = _a[1];
|
|
4
|
+
var _b = useState(0), topDistance = _b[0], setTopDistance = _b[1];
|
|
5
|
+
var _c = useState(0), bottomDistance = _c[0], setBottomDistance = _c[1];
|
|
6
|
+
var gridRef = useRef(null);
|
|
7
|
+
var paginationRef = useRef(null);
|
|
8
|
+
useEffect(function () {
|
|
9
|
+
var handleResize = function () {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
setTopDistance(((_a = gridRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0);
|
|
12
|
+
setBottomDistance(((_b = paginationRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0);
|
|
13
|
+
setWindowHeight(window.innerHeight);
|
|
14
|
+
};
|
|
15
|
+
handleResize();
|
|
16
|
+
window.addEventListener('resize', handleResize);
|
|
17
|
+
return function () {
|
|
18
|
+
window.removeEventListener('resize', handleResize);
|
|
19
|
+
};
|
|
20
|
+
}, []);
|
|
21
|
+
var gridHeight = useMemo(function () {
|
|
22
|
+
var calculatedHeight = windowHeight - topDistance - bottomDistance;
|
|
23
|
+
if (calculatedHeight !== windowHeight && calculatedHeight > 360) {
|
|
24
|
+
return calculatedHeight - 1;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// grids inside modals
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
}, [bottomDistance, topDistance, windowHeight]);
|
|
31
|
+
return { gridHeight: gridHeight, gridRef: gridRef, paginationRef: paginationRef };
|
|
32
|
+
};
|
|
33
|
+
export default useGetGridHeight;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CommonGridProps, GridActionsType, GridSelectorsType } from '../types';
|
|
3
|
+
type Props = {
|
|
4
|
+
columns: CommonGridProps['columnsDefinitions'];
|
|
5
|
+
gridActions: GridActionsType;
|
|
6
|
+
gridSelectors: GridSelectorsType;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
};
|
|
9
|
+
declare const useManageColumn: ({ columns, gridSelectors, gridActions, onClose }: Props) => {
|
|
10
|
+
columnsConfigValues: string[];
|
|
11
|
+
setColumnsConfigOptions: import("react").Dispatch<import("react").SetStateAction<{
|
|
12
|
+
[x: string]: {
|
|
13
|
+
isHidden?: boolean | undefined;
|
|
14
|
+
};
|
|
15
|
+
}>>;
|
|
16
|
+
onConfirmForm: () => void;
|
|
17
|
+
resetColumnConfig: () => void;
|
|
18
|
+
};
|
|
19
|
+
export default useManageColumn;
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
13
|
+
var useManageColumn = function (_a) {
|
|
14
|
+
var columns = _a.columns, gridSelectors = _a.gridSelectors, gridActions = _a.gridActions, onClose = _a.onClose;
|
|
15
|
+
var resetGrid = gridActions.resetGrid, setColumnConfig = gridActions.setColumnConfig;
|
|
16
|
+
var columnConfig = gridSelectors.columnConfig;
|
|
17
|
+
var _b = useState(__assign({}, columnConfig)), columnsConfigOptions = _b[0], setColumnsConfigOptions = _b[1];
|
|
18
|
+
var columnsConfigValues = useMemo(function () {
|
|
19
|
+
return columns === null || columns === void 0 ? void 0 : columns.filter(function (column) {
|
|
20
|
+
var _a;
|
|
21
|
+
var isHidden = (_a = columnConfig === null || columnConfig === void 0 ? void 0 : columnConfig[column.name]) === null || _a === void 0 ? void 0 : _a.isHidden;
|
|
22
|
+
return (column === null || column === void 0 ? void 0 : column.alwaysOn) || typeof isHidden === 'boolean' ? !isHidden : !(column === null || column === void 0 ? void 0 : column.defaultHidden);
|
|
23
|
+
}).map(function (column) { return column.name; });
|
|
24
|
+
}, [columnConfig, columns]);
|
|
25
|
+
var onConfirmForm = useCallback(function () {
|
|
26
|
+
(setColumnConfig === null || setColumnConfig === void 0 ? void 0 : setColumnConfig(columnsConfigOptions)) && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
27
|
+
}, [columnsConfigOptions, onClose, setColumnConfig]);
|
|
28
|
+
var resetColumnConfig = useCallback(function () {
|
|
29
|
+
(resetGrid === null || resetGrid === void 0 ? void 0 : resetGrid()) && (onClose === null || onClose === void 0 ? void 0 : onClose());
|
|
30
|
+
setColumnsConfigOptions(columnConfig || {});
|
|
31
|
+
}, [onClose, resetGrid]);
|
|
32
|
+
return { columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, onConfirmForm: onConfirmForm, resetColumnConfig: resetColumnConfig };
|
|
33
|
+
};
|
|
34
|
+
export default useManageColumn;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RowProps, UxState } from '../types';
|
|
3
|
+
declare const useRowsKeyControls: (rowsData: RowProps[], uxState: UxState, onUxChange?: ((uxKey: keyof UxState, uxValue: any) => void) | undefined) => (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
4
|
+
export default useRowsKeyControls;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var useRowsKeyControls = function (rowsData, uxState, onUxChange) {
|
|
3
|
+
return React.useCallback(function (e) {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
var selectedRowId = uxState.selectedRow;
|
|
6
|
+
if (!selectedRowId)
|
|
7
|
+
return;
|
|
8
|
+
var selectedRowIdx = rowsData.findIndex(function (row) { return row.id === selectedRowId; });
|
|
9
|
+
var previousRowId = (_a = rowsData[selectedRowIdx - 1]) === null || _a === void 0 ? void 0 : _a.id;
|
|
10
|
+
var nextRowId = (_b = rowsData[selectedRowIdx + 1]) === null || _b === void 0 ? void 0 : _b.id;
|
|
11
|
+
var isFirst = selectedRowIdx === 0;
|
|
12
|
+
var isLast = selectedRowIdx === rowsData.length - 1;
|
|
13
|
+
if (e.key === 'ArrowUp' && !isFirst)
|
|
14
|
+
onUxChange === null || onUxChange === void 0 ? void 0 : onUxChange('selectedRow', previousRowId);
|
|
15
|
+
if (e.key === 'ArrowDown' && !isLast)
|
|
16
|
+
onUxChange === null || onUxChange === void 0 ? void 0 : onUxChange('selectedRow', nextRowId);
|
|
17
|
+
if (e.key === 'Escape')
|
|
18
|
+
onUxChange === null || onUxChange === void 0 ? void 0 : onUxChange('selectedRow', null);
|
|
19
|
+
}, [uxState, rowsData, onUxChange]);
|
|
20
|
+
};
|
|
21
|
+
export default useRowsKeyControls;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
var useUxReset = function (rowsData, uxState, clearUxState) {
|
|
3
|
+
var _a = React.useState('|'), previous = _a[0], setPrevious = _a[1];
|
|
4
|
+
React.useEffect(function () {
|
|
5
|
+
var ids = (rowsData || []).map(function (row) { return row.id; }).join('|');
|
|
6
|
+
// clear uxState if listed rows change and uxState is not clear already
|
|
7
|
+
if (ids !== previous) {
|
|
8
|
+
if (clearUxState && ((uxState.checkedRows && Object.keys(uxState.checkedRows).length) || uxState.selectedRow)) {
|
|
9
|
+
clearUxState();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
setPrevious(ids);
|
|
13
|
+
}, [rowsData]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
14
|
+
};
|
|
15
|
+
export default useUxReset;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import CommonGrid from './CommonGridContainer';
|
|
2
|
+
import withReduxActions from './HoC/withReduxActions';
|
|
3
|
+
import reducer, { actionPrefix, createActions, createSelectors, createFullSelector, actionTypes } from './store';
|
|
4
|
+
import * as Types from './types';
|
|
5
|
+
import * as utils from './utils/public';
|
|
6
|
+
export default CommonGrid;
|
|
7
|
+
export { withReduxActions, reducer, actionPrefix, actionTypes, createActions, createSelectors, createFullSelector, Types, utils };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import CommonGrid from './CommonGridContainer';
|
|
2
|
+
import withReduxActions from './HoC/withReduxActions';
|
|
3
|
+
import reducer, { actionPrefix, createActions, createSelectors, createFullSelector, actionTypes } from './store';
|
|
4
|
+
import * as Types from './types';
|
|
5
|
+
import * as utils from './utils/public';
|
|
6
|
+
export default CommonGrid;
|
|
7
|
+
export { withReduxActions, reducer, actionPrefix, actionTypes, createActions, createSelectors, createFullSelector, Types, utils };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { FilterProps, SortingValueType, InitProps, GridState, GridSelectorsType, ColumnConfig } from '../types';
|
|
2
|
+
type DefaultRootState = {};
|
|
3
|
+
export type MultiState = {
|
|
4
|
+
[key: string]: GridState;
|
|
5
|
+
};
|
|
6
|
+
export declare const initialState: GridState;
|
|
7
|
+
export declare const actionPrefix = "@store/CommonGrid";
|
|
8
|
+
export declare const actionTypes: {
|
|
9
|
+
init: string;
|
|
10
|
+
clearUxState: string;
|
|
11
|
+
handleUxChange: string;
|
|
12
|
+
openConfigForm: string;
|
|
13
|
+
closeConfigForm: string;
|
|
14
|
+
setColumnConfig: string;
|
|
15
|
+
setPage: string;
|
|
16
|
+
setRowsPerPage: string;
|
|
17
|
+
resetFilters: string;
|
|
18
|
+
addFilter: string;
|
|
19
|
+
addSorting: string;
|
|
20
|
+
clearSettings: string;
|
|
21
|
+
resetGrid: string;
|
|
22
|
+
setColumnWidth: string;
|
|
23
|
+
setColumnsOrder: string;
|
|
24
|
+
};
|
|
25
|
+
declare const _default: (state: MultiState | undefined, action: Action) => MultiState;
|
|
26
|
+
export default _default;
|
|
27
|
+
export declare const createActions: (gridName: string) => {
|
|
28
|
+
init: (initProps: InitProps) => Action;
|
|
29
|
+
clearUxState: () => Action;
|
|
30
|
+
handleUxChange: (uxKey: keyof GridState['uxState'], uxValue: any) => Action;
|
|
31
|
+
openConfigForm: () => Action;
|
|
32
|
+
closeConfigForm: () => Action;
|
|
33
|
+
setColumnConfig: (columnConfig: ColumnConfig) => Action;
|
|
34
|
+
setPage: (page: number) => Action;
|
|
35
|
+
setColumnWidth: (columnsWidth: {
|
|
36
|
+
[anyKey: string]: number;
|
|
37
|
+
} | null, columnLayout: 'normal' | 'no-scroll' | 'sticky') => Action;
|
|
38
|
+
resetGrid: () => Action;
|
|
39
|
+
setColumnsOrder: (columnsOrder: string[]) => Action;
|
|
40
|
+
setRowsPerPage: (rowsPerPage: number) => Action;
|
|
41
|
+
resetFilters: () => Action;
|
|
42
|
+
addFilter: (column: string, value: any, filterProps: FilterProps) => Action;
|
|
43
|
+
addSorting: (column: string, direction: SortingValueType) => Action;
|
|
44
|
+
clearSettings: () => Action;
|
|
45
|
+
};
|
|
46
|
+
export declare const createSelectors: (gridName: string) => {
|
|
47
|
+
getUxState: (state: DefaultRootState) => GridState['uxState'];
|
|
48
|
+
isConfigFormOpen: (state: DefaultRootState) => GridState['isConfigFormOpen'];
|
|
49
|
+
getColumnConfig: (state: DefaultRootState) => GridState['columnConfig'];
|
|
50
|
+
getPage: (state: DefaultRootState) => GridState['page'];
|
|
51
|
+
getRowsPerPage: (state: DefaultRootState) => GridState['rowsPerPage'];
|
|
52
|
+
getFilter: (state: DefaultRootState) => GridState['filter'];
|
|
53
|
+
getSorting: (state: DefaultRootState) => GridState['sorting'];
|
|
54
|
+
getColumnsWidth: (state: DefaultRootState) => GridState['columnsWidth'];
|
|
55
|
+
getColumnsWidthVariant: (state: DefaultRootState) => GridState['columnsWidthVariant'];
|
|
56
|
+
getColumnsOrder: (state: DefaultRootState) => GridState['columnsOrder'];
|
|
57
|
+
};
|
|
58
|
+
export declare const createFullSelector: (gridName: string) => (state: DefaultRootState) => GridSelectorsType;
|
|
@@ -0,0 +1,230 @@
|
|
|
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
|
+
import produce from 'immer';
|
|
13
|
+
import getOr from 'lodash/fp/getOr';
|
|
14
|
+
import migrateState from './migrateState';
|
|
15
|
+
import { createSelector } from 'reselect';
|
|
16
|
+
export var initialState = {
|
|
17
|
+
page: 1,
|
|
18
|
+
rowsPerPage: 10,
|
|
19
|
+
sorting: [],
|
|
20
|
+
isConfigFormOpen: false,
|
|
21
|
+
uxState: {
|
|
22
|
+
selectedRow: null,
|
|
23
|
+
checkedRows: {},
|
|
24
|
+
},
|
|
25
|
+
columnConfig: {},
|
|
26
|
+
filter: {},
|
|
27
|
+
columnsWidth: {},
|
|
28
|
+
columnsOrder: [],
|
|
29
|
+
defaultSorting: [],
|
|
30
|
+
};
|
|
31
|
+
export var actionPrefix = '@store/CommonGrid';
|
|
32
|
+
export var actionTypes = {
|
|
33
|
+
init: "".concat(actionPrefix, "/init"),
|
|
34
|
+
clearUxState: "".concat(actionPrefix, "/clearUxState"),
|
|
35
|
+
handleUxChange: "".concat(actionPrefix, "/handleUxChange"),
|
|
36
|
+
openConfigForm: "".concat(actionPrefix, "/openConfigForm"),
|
|
37
|
+
closeConfigForm: "".concat(actionPrefix, "/closeConfigForm"),
|
|
38
|
+
setColumnConfig: "".concat(actionPrefix, "/setColumnConfig"),
|
|
39
|
+
setPage: "".concat(actionPrefix, "/setPage"),
|
|
40
|
+
setRowsPerPage: "".concat(actionPrefix, "/setRowsPerPage"),
|
|
41
|
+
resetFilters: "".concat(actionPrefix, "/resetFilters"),
|
|
42
|
+
addFilter: "".concat(actionPrefix, "/addFilter"),
|
|
43
|
+
addSorting: "".concat(actionPrefix, "/addSorting"),
|
|
44
|
+
clearSettings: "".concat(actionPrefix, "/clearSettings"),
|
|
45
|
+
resetGrid: "".concat(actionPrefix, "/resetGrid"),
|
|
46
|
+
setColumnWidth: "".concat(actionPrefix, "/setColumnWidth"),
|
|
47
|
+
setColumnsOrder: "".concat(actionPrefix, "/setColumnsOrder"),
|
|
48
|
+
};
|
|
49
|
+
var migrationChecked = false;
|
|
50
|
+
export default (function (state, action) {
|
|
51
|
+
if (state === void 0) { state = {}; }
|
|
52
|
+
return produce(state, function (draft) {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
var _c, _d, _e, _f, _g;
|
|
55
|
+
// version migrations
|
|
56
|
+
if (!migrationChecked && state && Object.keys(state).length > 0) {
|
|
57
|
+
draft = migrateState(draft);
|
|
58
|
+
migrationChecked = true;
|
|
59
|
+
}
|
|
60
|
+
var gridName = action.gridName;
|
|
61
|
+
if (!gridName)
|
|
62
|
+
return draft; // action does not contains gridName, skip immediatelly
|
|
63
|
+
if (!draft[gridName]) {
|
|
64
|
+
// if this grid is not yet in store, initialize
|
|
65
|
+
draft[gridName] = __assign({}, initialState);
|
|
66
|
+
}
|
|
67
|
+
if (action.type === actionTypes.init) {
|
|
68
|
+
var defaultSorting = action.initProps.defaultSorting;
|
|
69
|
+
draft[gridName].page = 1;
|
|
70
|
+
if (defaultSorting) {
|
|
71
|
+
draft[gridName].defaultSorting = defaultSorting;
|
|
72
|
+
draft[gridName].sorting = ((_c = draft[gridName].sorting) === null || _c === void 0 ? void 0 : _c.length) ? draft[gridName].sorting : defaultSorting;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else if (action.type === actionTypes.clearUxState) {
|
|
76
|
+
draft[gridName].uxState = initialState.uxState;
|
|
77
|
+
}
|
|
78
|
+
else if (action.type === actionTypes.handleUxChange) {
|
|
79
|
+
// for a specific row id (action.id) append uxState from action
|
|
80
|
+
draft[gridName].uxState = __assign(__assign({}, draft[gridName].uxState), (_a = {}, _a[action.uxKey] = action.uxValue, _a));
|
|
81
|
+
}
|
|
82
|
+
else if (action.type === actionTypes.openConfigForm) {
|
|
83
|
+
draft[gridName].isConfigFormOpen = true;
|
|
84
|
+
}
|
|
85
|
+
else if (action.type === actionTypes.closeConfigForm) {
|
|
86
|
+
draft[gridName].isConfigFormOpen = false;
|
|
87
|
+
}
|
|
88
|
+
else if (action.type === actionTypes.setColumnConfig) {
|
|
89
|
+
draft[gridName].columnConfig = action.columnConfig;
|
|
90
|
+
draft[gridName].isConfigFormOpen = false;
|
|
91
|
+
}
|
|
92
|
+
else if (action.type === actionTypes.resetFilters) {
|
|
93
|
+
draft[gridName].filter = {};
|
|
94
|
+
}
|
|
95
|
+
else if (action.type === actionTypes.addFilter) {
|
|
96
|
+
// append desired filter for specific column to existing filters
|
|
97
|
+
var column = action.column, value = action.value, filterProps = action.filterProps;
|
|
98
|
+
var currentFilterState = (_b = {}, _b[column] = { value: value, filterProps: filterProps }, _b);
|
|
99
|
+
draft[gridName].filter = __assign(__assign({}, draft[gridName].filter), currentFilterState);
|
|
100
|
+
draft[gridName].page = 1;
|
|
101
|
+
}
|
|
102
|
+
else if (action.type === actionTypes.addSorting) {
|
|
103
|
+
// append desired sorting for specific column to existing sortings
|
|
104
|
+
var direction = action.direction;
|
|
105
|
+
var column = action.column;
|
|
106
|
+
if (((_f = (_e = (_d = draft[gridName]) === null || _d === void 0 ? void 0 : _d.defaultSorting) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.column) === column && direction === null) {
|
|
107
|
+
// default column cannot unset itself. it would be stuck on 'desc'
|
|
108
|
+
direction = 'asc';
|
|
109
|
+
}
|
|
110
|
+
var sorting = [{ column: column, direction: direction }];
|
|
111
|
+
if (direction === null) {
|
|
112
|
+
sorting = ((_g = draft[gridName]) === null || _g === void 0 ? void 0 : _g.defaultSorting) || [];
|
|
113
|
+
}
|
|
114
|
+
draft[gridName].sorting = sorting;
|
|
115
|
+
}
|
|
116
|
+
else if (action.type === actionTypes.clearSettings) {
|
|
117
|
+
// clear grid for reuse
|
|
118
|
+
draft[gridName].page = initialState.page;
|
|
119
|
+
draft[gridName].filter = initialState.filter;
|
|
120
|
+
draft[gridName].uxState = initialState.uxState;
|
|
121
|
+
}
|
|
122
|
+
else if (action.type === actionTypes.setPage) {
|
|
123
|
+
draft[gridName].page = action.page;
|
|
124
|
+
}
|
|
125
|
+
else if (action.type === actionTypes.setRowsPerPage) {
|
|
126
|
+
draft[gridName].rowsPerPage = action.rowsPerPage;
|
|
127
|
+
}
|
|
128
|
+
else if (action.type === actionTypes.resetGrid) {
|
|
129
|
+
draft[gridName] = __assign(__assign({}, initialState), { rowsPerPage: draft[gridName].rowsPerPage });
|
|
130
|
+
}
|
|
131
|
+
else if (action.type === actionTypes.setColumnWidth) {
|
|
132
|
+
if (action.columnsWidth === null) {
|
|
133
|
+
draft[gridName].columnsWidth = initialState.columnsWidth;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
draft[gridName].columnsWidth = __assign(__assign({}, draft[gridName].columnsWidth), action.columnsWidth);
|
|
137
|
+
}
|
|
138
|
+
draft[gridName].columnsWidthVariant = action.columnLayout;
|
|
139
|
+
}
|
|
140
|
+
else if (action.type === actionTypes.setColumnsOrder) {
|
|
141
|
+
draft[gridName].columnsOrder = action.columnsOrder;
|
|
142
|
+
}
|
|
143
|
+
return draft;
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
export var createActions = function (gridName) { return ({
|
|
147
|
+
init: function (initProps) { return ({ gridName: gridName, type: actionTypes.init, initProps: initProps }); },
|
|
148
|
+
clearUxState: function () { return ({ gridName: gridName, type: actionTypes.clearUxState }); },
|
|
149
|
+
handleUxChange: function (uxKey, uxValue) { return ({
|
|
150
|
+
gridName: gridName,
|
|
151
|
+
type: actionTypes.handleUxChange,
|
|
152
|
+
uxKey: uxKey,
|
|
153
|
+
uxValue: uxValue,
|
|
154
|
+
}); },
|
|
155
|
+
openConfigForm: function () { return ({ gridName: gridName, type: actionTypes.openConfigForm }); },
|
|
156
|
+
closeConfigForm: function () { return ({ gridName: gridName, type: actionTypes.closeConfigForm }); },
|
|
157
|
+
setColumnConfig: function (columnConfig) { return ({ gridName: gridName, type: actionTypes.setColumnConfig, columnConfig: columnConfig }); },
|
|
158
|
+
setPage: function (page) { return ({ gridName: gridName, type: actionTypes.setPage, page: page }); },
|
|
159
|
+
setColumnWidth: function (columnsWidth, columnLayout) { return ({
|
|
160
|
+
gridName: gridName,
|
|
161
|
+
type: actionTypes.setColumnWidth,
|
|
162
|
+
columnsWidth: columnsWidth,
|
|
163
|
+
columnLayout: columnLayout,
|
|
164
|
+
}); },
|
|
165
|
+
resetGrid: function () { return ({ gridName: gridName, type: actionTypes.resetGrid }); },
|
|
166
|
+
setColumnsOrder: function (columnsOrder) { return ({
|
|
167
|
+
gridName: gridName,
|
|
168
|
+
type: actionTypes.setColumnsOrder,
|
|
169
|
+
columnsOrder: columnsOrder,
|
|
170
|
+
}); },
|
|
171
|
+
setRowsPerPage: function (rowsPerPage) { return ({ gridName: gridName, type: actionTypes.setRowsPerPage, rowsPerPage: rowsPerPage }); },
|
|
172
|
+
resetFilters: function () { return ({ gridName: gridName, type: actionTypes.resetFilters }); },
|
|
173
|
+
addFilter: function (column, value, filterProps) { return ({
|
|
174
|
+
gridName: gridName,
|
|
175
|
+
type: actionTypes.addFilter,
|
|
176
|
+
column: column,
|
|
177
|
+
value: value,
|
|
178
|
+
filterProps: filterProps,
|
|
179
|
+
}); },
|
|
180
|
+
addSorting: function (column, direction) { return ({
|
|
181
|
+
gridName: gridName,
|
|
182
|
+
type: actionTypes.addSorting,
|
|
183
|
+
column: column,
|
|
184
|
+
direction: direction,
|
|
185
|
+
}); },
|
|
186
|
+
clearSettings: function () { return ({ gridName: gridName, type: actionTypes.clearSettings }); },
|
|
187
|
+
}); };
|
|
188
|
+
export var createSelectors = function (gridName) { return ({
|
|
189
|
+
getUxState: function (state) {
|
|
190
|
+
return getOr(initialState.uxState, "commonGrid.".concat(gridName, ".uxState"), state);
|
|
191
|
+
},
|
|
192
|
+
isConfigFormOpen: function (state) {
|
|
193
|
+
return getOr(initialState.isConfigFormOpen, "commonGrid.".concat(gridName, ".isConfigFormOpen"), state);
|
|
194
|
+
},
|
|
195
|
+
getColumnConfig: function (state) {
|
|
196
|
+
return getOr(initialState.columnConfig, "commonGrid.".concat(gridName, ".columnConfig"), state);
|
|
197
|
+
},
|
|
198
|
+
getPage: function (state) { return getOr(initialState.page, "commonGrid.".concat(gridName, ".page"), state); },
|
|
199
|
+
getRowsPerPage: function (state) {
|
|
200
|
+
return getOr(initialState.rowsPerPage, "commonGrid.".concat(gridName, ".rowsPerPage"), state);
|
|
201
|
+
},
|
|
202
|
+
getFilter: function (state) { return getOr(initialState.filter, "commonGrid.".concat(gridName, ".filter"), state); },
|
|
203
|
+
getSorting: function (state) {
|
|
204
|
+
return getOr(initialState.sorting, "commonGrid.".concat(gridName, ".sorting"), state);
|
|
205
|
+
},
|
|
206
|
+
getColumnsWidth: function (state) {
|
|
207
|
+
return getOr(null, "commonGrid.".concat(gridName, ".columnsWidth"), state);
|
|
208
|
+
},
|
|
209
|
+
getColumnsWidthVariant: function (state) {
|
|
210
|
+
return getOr(undefined, "commonGrid.".concat(gridName, ".columnsWidthVariant"), state);
|
|
211
|
+
},
|
|
212
|
+
getColumnsOrder: function (state) {
|
|
213
|
+
return getOr([], "commonGrid.".concat(gridName, ".columnsOrder"), state);
|
|
214
|
+
},
|
|
215
|
+
}); };
|
|
216
|
+
export var createFullSelector = function (gridName) {
|
|
217
|
+
var selectors = createSelectors(gridName);
|
|
218
|
+
return createSelector(function (state) { return selectors.getUxState(state); }, function (state) { return selectors.isConfigFormOpen(state); }, function (state) { return selectors.getColumnConfig(state); }, function (state) { return selectors.getPage(state); }, function (state) { return selectors.getRowsPerPage(state); }, function (state) { return selectors.getFilter(state); }, function (state) { return selectors.getSorting(state); }, function (state) { return selectors.getColumnsWidth(state); }, function (state) { return selectors.getColumnsWidthVariant(state); }, function (state) { return selectors.getColumnsOrder(state); }, function (uxState, isConfigFormOpen, columnConfig, page, rowsPerPage, filter, sorting, columnsWidth, columnsWidthVariant, columnsOrder) { return ({
|
|
219
|
+
uxState: uxState,
|
|
220
|
+
isConfigFormOpen: isConfigFormOpen,
|
|
221
|
+
columnConfig: columnConfig,
|
|
222
|
+
page: page,
|
|
223
|
+
rowsPerPage: rowsPerPage,
|
|
224
|
+
filter: filter,
|
|
225
|
+
sorting: sorting,
|
|
226
|
+
columnsWidth: columnsWidth,
|
|
227
|
+
columnsWidthVariant: columnsWidthVariant,
|
|
228
|
+
columnsOrder: columnsOrder,
|
|
229
|
+
}); });
|
|
230
|
+
};
|