@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailstep/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-beta.10",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./ui/index.js",
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"@fortawesome/pro-regular-svg-icons": "^6.0.0",
|
|
30
30
|
"@fortawesome/pro-solid-svg-icons": "^6.3.0",
|
|
31
31
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
32
|
+
"@lingui/macro": "3.15.0",
|
|
33
|
+
"@lingui/react": "3.15.0",
|
|
34
|
+
"@popperjs/core": "^2.11.8",
|
|
32
35
|
"@storybook/addon-controls": "7.6.8",
|
|
33
36
|
"@storybook/addon-essentials": "7.6.8",
|
|
34
37
|
"@storybook/addon-interactions": "7.6.8",
|
|
@@ -38,8 +41,11 @@
|
|
|
38
41
|
"@storybook/react-webpack5": "7.6.8",
|
|
39
42
|
"@storybook/testing-library": "0.2.2",
|
|
40
43
|
"@svgr/rollup": "^8.0.1",
|
|
44
|
+
"@types/faker": "^4.1.11",
|
|
45
|
+
"@types/luxon": "^3.4.2",
|
|
41
46
|
"@types/node": "^20.1.7",
|
|
42
47
|
"@types/react": "^18.2.6",
|
|
48
|
+
"@types/react-beautiful-dnd": "^13.1.2",
|
|
43
49
|
"@types/react-dom": "^18.2.4",
|
|
44
50
|
"@types/react-helmet": "^6.1.11",
|
|
45
51
|
"@types/react-router": "^5.1.20",
|
|
@@ -48,18 +54,30 @@
|
|
|
48
54
|
"@vitejs/plugin-react": "^4.2.1",
|
|
49
55
|
"@xstyled/styled-components": "^3.8.0",
|
|
50
56
|
"babel-loader": "^9.1.2",
|
|
57
|
+
"babel-plugin-macros": "^3.1.0",
|
|
51
58
|
"babel-plugin-named-exports-order": "^0.0.2",
|
|
52
59
|
"eslint-plugin-storybook": "0.6.15",
|
|
60
|
+
"faker": "^5.1.0",
|
|
61
|
+
"immer": "9.0.7",
|
|
53
62
|
"lodash": "^4.17.21",
|
|
63
|
+
"luxon": "^3.4.4",
|
|
64
|
+
"moment": "^2.30.1",
|
|
54
65
|
"react": "^18.2.0",
|
|
55
|
-
"react-
|
|
66
|
+
"react-beautiful-dnd": "^13.0.0",
|
|
56
67
|
"react-dom": "^18.2.0",
|
|
68
|
+
"react-helmet": "^6.1.0",
|
|
57
69
|
"react-image": "^4.1.0",
|
|
70
|
+
"react-onclickoutside": "^6.13.0",
|
|
71
|
+
"react-popper": "^2.3.0",
|
|
72
|
+
"react-redux": "*",
|
|
58
73
|
"react-router": "^5.1.2",
|
|
59
74
|
"react-router-dom": "^5.1.2",
|
|
60
75
|
"react-script": "^2.0.5",
|
|
76
|
+
"react-select": "^5.8.0",
|
|
61
77
|
"react-toastify": "^9.1.3",
|
|
62
78
|
"react-use-draggable-scroll": "^0.4.7",
|
|
79
|
+
"redux": ">=4.0.5",
|
|
80
|
+
"reselect": "5.0.0-alpha.2",
|
|
63
81
|
"storybook": "7.6.8",
|
|
64
82
|
"string-width": "6.1.0",
|
|
65
83
|
"styled-components": "^5.3.10",
|
|
@@ -79,16 +97,29 @@
|
|
|
79
97
|
"@fortawesome/pro-regular-svg-icons": "^6.0.0",
|
|
80
98
|
"@fortawesome/pro-solid-svg-icons": "^6.3.0",
|
|
81
99
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
100
|
+
"@lingui/macro": "3.15.0",
|
|
101
|
+
"@lingui/react": "3.15.0",
|
|
102
|
+
"@popperjs/core": "^2.11.8",
|
|
82
103
|
"@xstyled/styled-components": "^3.8.0",
|
|
104
|
+
"immer": "9.0.7",
|
|
83
105
|
"lodash": "^4.17.21",
|
|
106
|
+
"luxon": "^3.4.4",
|
|
107
|
+
"moment": "^2.30.1",
|
|
84
108
|
"react": "^18.2.0",
|
|
109
|
+
"react-beautiful-dnd": "^13.0.0",
|
|
85
110
|
"react-dom": "^18.2.0",
|
|
86
111
|
"react-helmet": "^6.1.0",
|
|
87
112
|
"react-image": "^4.1.0",
|
|
113
|
+
"react-onclickoutside": "^6.13.0",
|
|
114
|
+
"react-popper": "^2.3.0",
|
|
115
|
+
"react-redux": ">=4.0.5",
|
|
88
116
|
"react-router": "^5.1.2",
|
|
89
117
|
"react-router-dom": "^5.1.2",
|
|
118
|
+
"react-select": "^5.8.0",
|
|
90
119
|
"react-toastify": "^9.1.3",
|
|
91
120
|
"react-use-draggable-scroll": "^0.4.7",
|
|
121
|
+
"redux": ">=4.0.5",
|
|
122
|
+
"reselect": "5.0.0-alpha.2",
|
|
92
123
|
"styled-components": "^5.3.10",
|
|
93
124
|
"swiper": "^11.0.3",
|
|
94
125
|
"tslib": "^2.6.2",
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CommonGridProps } from './types';
|
|
2
|
+
declare const CommonGrid: ({ filters, gridSelectors, gridActions, isLoading, rowsData, hasColouredRows, columnsDefinitions, actionColumnDefinition, allowRowSelect, allowRowSelectOnAction, onRowAction, onRowEditClick, onRowReadClick, onRowClick, columnLayout, hideColumnConfig, className, gridRef, minColumnWidth, errorMessage, floatingButtonProps, }: CommonGridProps) => JSX.Element;
|
|
3
|
+
export default CommonGrid;
|
|
@@ -0,0 +1,106 @@
|
|
|
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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { x } from '@xstyled/styled-components';
|
|
15
|
+
import { Row, MessageCell } from './components/Table';
|
|
16
|
+
import OversizedScroll from './components/OversizedScroll';
|
|
17
|
+
import GroupRow from './components/GroupRow';
|
|
18
|
+
import FilterRow from './components/FilterRow';
|
|
19
|
+
import DataRow from './components/DataRow';
|
|
20
|
+
import HeadRow from './components/HeadRow';
|
|
21
|
+
import useUxReset from './hooks/useUxReset';
|
|
22
|
+
import useRowsKeyControls from './hooks/useRowsKeyControls';
|
|
23
|
+
import useColumnSizes from './hooks/useColumnSizes';
|
|
24
|
+
import { Provider as ContextProvider } from './CommonGridContext';
|
|
25
|
+
import { isColumnOn, getGroups } from './utils';
|
|
26
|
+
import { initialState } from './store';
|
|
27
|
+
import { Trans } from '@lingui/react';
|
|
28
|
+
import FloatingButton from './components/FloatingButton/FloatingButton';
|
|
29
|
+
var rowsStyles = { outline: 'none' };
|
|
30
|
+
var defaultVoidFunction = function () {
|
|
31
|
+
var args = [];
|
|
32
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
33
|
+
args[_i] = arguments[_i];
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
var defaultUxState = initialState.uxState;
|
|
38
|
+
var defaultColumnsWidth = {};
|
|
39
|
+
var defaultPerPageOptions = [10, 20, 50, 100];
|
|
40
|
+
var CommonGrid = function (_a) {
|
|
41
|
+
var filters = _a.filters,
|
|
42
|
+
// redux props
|
|
43
|
+
gridSelectors = _a.gridSelectors, gridActions = _a.gridActions,
|
|
44
|
+
// input props
|
|
45
|
+
isLoading = _a.isLoading, rowsData = _a.rowsData, hasColouredRows = _a.hasColouredRows, columnsDefinitions = _a.columnsDefinitions, actionColumnDefinition = _a.actionColumnDefinition, allowRowSelect = _a.allowRowSelect, allowRowSelectOnAction = _a.allowRowSelectOnAction, onRowAction = _a.onRowAction, onRowEditClick = _a.onRowEditClick, onRowReadClick = _a.onRowReadClick, onRowClick = _a.onRowClick, _b = _a.columnLayout, columnLayout = _b === void 0 ? 'normal' : _b, hideColumnConfig = _a.hideColumnConfig, className = _a.className, gridRef = _a.gridRef, minColumnWidth = _a.minColumnWidth, errorMessage = _a.errorMessage, floatingButtonProps = _a.floatingButtonProps;
|
|
46
|
+
var _c = gridSelectors.uxState, uxState = _c === void 0 ? defaultUxState : _c, columnConfig = gridSelectors.columnConfig, _d = gridSelectors.columnsWidth, columnsWidth = _d === void 0 ? defaultColumnsWidth : _d, columnsWidthVariant = gridSelectors.columnsWidthVariant, _e = gridSelectors.page, page = _e === void 0 ? 1 : _e, filter = gridSelectors.filter, sorting = gridSelectors.sorting, _f = gridSelectors.rowsPerPage, rowsPerPage = _f === void 0 ? 10 : _f;
|
|
47
|
+
var clearUxState = gridActions.clearUxState, handleUxChange = gridActions.handleUxChange, _g = gridActions.addFilter, addFilter = _g === void 0 ? defaultVoidFunction : _g, _h = gridActions.addSorting, addSorting = _h === void 0 ? defaultVoidFunction : _h, _j = gridActions.setColumnWidth, setColumnWidth = _j === void 0 ? defaultVoidFunction : _j, _k = gridActions.setColumnsOrder, setColumnsOrder = _k === void 0 ? defaultVoidFunction : _k;
|
|
48
|
+
var handleRowsKeyDown = useRowsKeyControls(rowsData, uxState, handleUxChange);
|
|
49
|
+
useUxReset(rowsData, uxState, clearUxState);
|
|
50
|
+
var checksColumnsOrder = React.useCallback(function (colsOrder) {
|
|
51
|
+
var stickyRightColls = columnsDefinitions.filter(function (col) { return col.sticky === true && col.stickTo === 'right'; });
|
|
52
|
+
var stickyLeftColls = columnsDefinitions.filter(function (col) { return col.sticky === true && col.stickTo !== 'right'; });
|
|
53
|
+
if (stickyLeftColls.length > 1 || stickyRightColls.length > 1) {
|
|
54
|
+
console.error('Grid can have only sticky column on each side.');
|
|
55
|
+
}
|
|
56
|
+
if (stickyLeftColls.length && colsOrder.indexOf(stickyLeftColls[0].name) !== 0) {
|
|
57
|
+
console.error('The left sticky column should be the first one in a row');
|
|
58
|
+
}
|
|
59
|
+
if (stickyRightColls.length && colsOrder.indexOf(stickyRightColls[0].name) !== colsOrder.length - 1) {
|
|
60
|
+
console.error('The Right sticky column should be the last one in a row');
|
|
61
|
+
}
|
|
62
|
+
}, [columnsDefinitions]);
|
|
63
|
+
// todo refactor as part of definitions
|
|
64
|
+
var columnsOrder = React.useMemo(function () {
|
|
65
|
+
var _a;
|
|
66
|
+
var order = ((_a = gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.columnsOrder) === null || _a === void 0 ? void 0 : _a.length)
|
|
67
|
+
? gridSelectors.columnsOrder
|
|
68
|
+
: columnsDefinitions.map(function (column) { return column.name; });
|
|
69
|
+
checksColumnsOrder(order);
|
|
70
|
+
return order;
|
|
71
|
+
}, [columnsDefinitions, gridSelectors.columnsOrder]);
|
|
72
|
+
// filtered and ordered columns definition, relevant columns definition to iterate over and render
|
|
73
|
+
var displayColumnsDefinitions = React.useMemo(function () {
|
|
74
|
+
return (!hideColumnConfig ? columnsDefinitions.filter(function (column) { return isColumnOn(column, columnConfig); }) : columnsDefinitions).sort(function (col1, col2) {
|
|
75
|
+
var i = (columnsOrder || []).indexOf(col1.name);
|
|
76
|
+
var j = (columnsOrder || []).indexOf(col2.name);
|
|
77
|
+
return i > j ? 1 : i < j ? -1 : 0;
|
|
78
|
+
});
|
|
79
|
+
}, [hideColumnConfig, columnConfig, columnsDefinitions, columnsOrder]);
|
|
80
|
+
var GridMessage;
|
|
81
|
+
var messageClass = 'info';
|
|
82
|
+
if (isLoading)
|
|
83
|
+
GridMessage = _jsx(Trans, { id: "dataGrid.status.loadingData", message: "... loading data ..." });
|
|
84
|
+
if (!isLoading && (!rowsData || rowsData.length < 1))
|
|
85
|
+
GridMessage = _jsx(Trans, { id: "dataGrid.status.noDataFound", message: "No data found." });
|
|
86
|
+
if (!isLoading && errorMessage) {
|
|
87
|
+
GridMessage = errorMessage;
|
|
88
|
+
messageClass = 'error';
|
|
89
|
+
}
|
|
90
|
+
var _l = useColumnSizes(displayColumnsDefinitions, columnsWidth, columnsWidthVariant, setColumnWidth, columnLayout, minColumnWidth), displayColumnsWidth = _l.displayColumnsWidth, totalColumnsWidth = _l.totalColumnsWidth, gridBoxRef = _l.gridBoxRef, handleResizeDrag = _l.handleResizeDrag;
|
|
91
|
+
var groups = React.useMemo(function () {
|
|
92
|
+
return getGroups(displayColumnsDefinitions);
|
|
93
|
+
}, [displayColumnsDefinitions]);
|
|
94
|
+
var commonGridRef = React.useCallback(function (node) {
|
|
95
|
+
gridBoxRef.current = node;
|
|
96
|
+
!!gridRef && (gridRef.current = node);
|
|
97
|
+
}, []);
|
|
98
|
+
return (_jsxs(ContextProvider, { children: [_jsx(x.div, { className: className || '', children: _jsxs(OversizedScroll, { columnLayout: columnLayout, isLoading: isLoading, totalColumnsWidth: totalColumnsWidth, floatingChildren: GridMessage && (_jsx(Row, { className: "dataRow", align: "center", children: _jsx(MessageCell, { align: "center", className: "gridMessage ".concat(messageClass), children: GridMessage }) })), ref: commonGridRef, children: [_jsxs("div", { className: "gridHead", children: [columnsDefinitions.find(function (col) { return col.group; }) && (_jsx(GroupRow, { actionColumn: actionColumnDefinition, columns: displayColumnsDefinitions, displayColumnsWidth: displayColumnsWidth, groups: groups })), _jsx(HeadRow, { columns: displayColumnsDefinitions, actionColumn: actionColumnDefinition, onAddSort: addSorting, columnLayout: columnLayout, setColumnsOrder: setColumnsOrder, columnsOrder: columnsOrder, sortingValues: sorting, displayColumnsWidth: displayColumnsWidth, handleResizeDrag: handleResizeDrag, groups: groups }), columnsDefinitions.find(function (col) { return col.filtering; }) && (_jsx(FilterRow, { filters: filters, columns: displayColumnsDefinitions, actionColumn: actionColumnDefinition, onChange: addFilter, filterValues: filter, displayColumnsWidth: displayColumnsWidth, groups: groups, rowsData: rowsData, uxState: uxState, handleUxChange: handleUxChange }))] }), _jsx("div", { className: "body flx_1", style: rowsStyles, tabIndex: -1, onKeyDown: handleRowsKeyDown, children: !isLoading &&
|
|
99
|
+
rowsData &&
|
|
100
|
+
displayColumnsDefinitions &&
|
|
101
|
+
rowsData.map(function (row, index) {
|
|
102
|
+
var rowIndex = rowsPerPage * page + (index + 1) - rowsPerPage;
|
|
103
|
+
return (_jsx(DataRow, { rowData: row, rowIndex: rowIndex, uxState: uxState, isEven: hasColouredRows && (index + 1) % 2 === 0, allowRowSelect: allowRowSelect, allowRowSelectOnAction: allowRowSelectOnAction, onRowAction: onRowAction, onUxChange: handleUxChange, onRowEditClick: onRowEditClick, onRowReadClick: onRowReadClick, onRowClick: onRowClick, columns: displayColumnsDefinitions, actionColumn: actionColumnDefinition, displayColumnsWidth: displayColumnsWidth, groups: groups }, row.id));
|
|
104
|
+
}) })] }) }), floatingButtonProps && _jsx(FloatingButton, __assign({}, floatingButtonProps))] }));
|
|
105
|
+
};
|
|
106
|
+
export default CommonGrid;
|
|
@@ -0,0 +1,67 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import useGetGridHeight from './hooks/useGetGridHeight';
|
|
25
|
+
import { useEffect, useMemo } from 'react';
|
|
26
|
+
import { getFilters, GRID_MIN_ROWS } from './utils';
|
|
27
|
+
import useEditReadAsColumn from './hooks/useEditReadAsColumn';
|
|
28
|
+
import { useModal } from '../Modal/hooks/useModal';
|
|
29
|
+
import useManageColumn from './hooks/useManageColumn';
|
|
30
|
+
import { CommonGridWithStyles, BottomWrapper, CommonGridWrap, ContentContainer, StyledButtonStrip, StyledColumnButton, } from './styles';
|
|
31
|
+
import { H6 } from '../../Elements/Typography';
|
|
32
|
+
import HidePrint from './components/HidePrint/HidePrint';
|
|
33
|
+
import ControlButtons from './components/ControlButtons';
|
|
34
|
+
import { Rows } from '../../Elements/Icon/icons/Rows';
|
|
35
|
+
import { x } from '@xstyled/styled-components';
|
|
36
|
+
import ActionHead from './components/ActionHead';
|
|
37
|
+
import { Pagination } from '../../Elements/Pagination';
|
|
38
|
+
import TablePagination from './components/TablePagination';
|
|
39
|
+
import Modal from '../Modal';
|
|
40
|
+
import ManageColumnForm from './components/ManageColumnForm';
|
|
41
|
+
import { Trans } from '@lingui/react';
|
|
42
|
+
var StyledCommonGrid = function (props) {
|
|
43
|
+
var _a = props.optimizeFilters, optimizeFilters = _a === void 0 ? false : _a, extraControlButtons = props.extraControlButtons, eshopSelect = props.eshopSelect, onBatchAction = props.onBatchAction, onExport = props.onExport, hideControlButtons = props.hideControlButtons, floatingButtonProps = props.floatingButtonProps, passDownProps = __rest(props, ["optimizeFilters", "extraControlButtons", "eshopSelect", "onBatchAction", "onExport", "hideControlButtons", "floatingButtonProps"]);
|
|
44
|
+
var gridActions = passDownProps.gridActions, gridSelectors = passDownProps.gridSelectors, rowsData = passDownProps.rowsData, actionColumnDefinition = passDownProps.actionColumnDefinition;
|
|
45
|
+
var rowHeight = 40;
|
|
46
|
+
var _b = useGetGridHeight(), gridHeight = _b.gridHeight, gridRef = _b.gridRef, paginationRef = _b.paginationRef;
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
var _a;
|
|
49
|
+
if (!(gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.rowsPerPage) && gridHeight && gridHeight > 0) {
|
|
50
|
+
// Only main grids (without form grids on new pages)
|
|
51
|
+
var numberOfRows = Math.max(Math.floor(gridHeight / rowHeight - 2), GRID_MIN_ROWS);
|
|
52
|
+
numberOfRows && ((_a = gridActions.setRowsPerPage) === null || _a === void 0 ? void 0 : _a.call(gridActions, numberOfRows));
|
|
53
|
+
}
|
|
54
|
+
}, [gridHeight, gridActions]);
|
|
55
|
+
var modifiedPassDownProps = useEditReadAsColumn(passDownProps);
|
|
56
|
+
var filters = useMemo(function () { return getFilters(optimizeFilters); }, [optimizeFilters]);
|
|
57
|
+
var columns = modifiedPassDownProps.columnsDefinitions;
|
|
58
|
+
var _c = useModal(), openManageColumnForm = _c.onOpen, manageColumnFormVisible = _c.isOpen, onClose = _c.onClose;
|
|
59
|
+
var _d = useManageColumn({
|
|
60
|
+
columns: columns,
|
|
61
|
+
gridActions: gridActions,
|
|
62
|
+
gridSelectors: gridSelectors,
|
|
63
|
+
onClose: onClose,
|
|
64
|
+
}), columnsConfigValues = _d.columnsConfigValues, setColumnsConfigOptions = _d.setColumnsConfigOptions, onConfirmForm = _d.onConfirmForm, resetColumnConfig = _d.resetColumnConfig;
|
|
65
|
+
return (_jsxs(ContentContainer, { children: [_jsxs(CommonGridWrap, { children: [_jsx(HidePrint, { children: _jsxs(StyledButtonStrip, { className: "buttonsStrip", children: [!hideControlButtons && (_jsx(ControlButtons, { extraControlButtons: extraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, eshopSelect: eshopSelect })), _jsx(StyledColumnButton, { type: "button", appearance: "ghost", icon: _jsx(Rows, {}), onClick: openManageColumnForm, children: _jsx(H6, { children: _jsx(Trans, { id: "manageColumn.title", message: "Manage column" }) }) })] }) }), _jsx(CommonGridWithStyles, __assign({}, passDownProps, modifiedPassDownProps, { filters: filters, gridRef: gridRef, hasColouredRows: true, floatingButtonProps: floatingButtonProps }))] }), _jsx(HidePrint, { children: _jsxs(BottomWrapper, { ref: paginationRef, isAbsolute: !!gridHeight, children: [_jsx(ActionHead, { rowsData: rowsData, onBatchAction: onBatchAction, gridActions: gridActions, gridSelectors: gridSelectors, actionColumn: actionColumnDefinition, onExport: onExport }), _jsxs(x.div, { display: "flex", justifyContent: "center", alignItems: "center", className: "paginatorWrapper", w: "100%", h: window.innerWidth > 1204 ? '60px' : '32px', children: [_jsx(Pagination, { page: gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.page, itemCount: passDownProps === null || passDownProps === void 0 ? void 0 : passDownProps.totalRowsCount, itemPerPage: (gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.rowsPerPage) || 10, onPageChange: gridActions === null || gridActions === void 0 ? void 0 : gridActions.setPage }), _jsx(TablePagination, { gridActions: gridActions, gridSelectors: gridSelectors })] })] }) }), manageColumnFormVisible && (_jsx(Modal, { title: _jsx(Trans, { id: "manageColumn.title", message: "Manage columns" }), onClose: onClose, onCancel: onClose, onExtraAction: resetColumnConfig, onConfirm: onConfirmForm, width: "auto", minWidth: "350px", hasFooter: true, extraActionLabel: _jsx(Trans, { id: "dataGrid.buttonClearConfig", message: "Reset config" }), cancelLabel: _jsx(Trans, { id: "form.buttonCancel", message: "Cancel" }), confirmLabel: _jsx(Trans, { id: "form.buttonConfirm", message: "Confirm" }), children: _jsx(ManageColumnForm, { columns: columns, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions }) }))] }));
|
|
66
|
+
};
|
|
67
|
+
export default StyledCommonGrid;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const Context: React.Context<null>;
|
|
3
|
+
type EnhancedProviderProps = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
declare const Provider: ({ ...rest }: EnhancedProviderProps) => JSX.Element;
|
|
7
|
+
declare const Consumer: React.Consumer<null>;
|
|
8
|
+
export default Context;
|
|
9
|
+
export { Provider, Consumer };
|
|
@@ -0,0 +1,32 @@
|
|
|
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 React from 'react';
|
|
25
|
+
var Context = React.createContext(null);
|
|
26
|
+
var Provider = function (_a) {
|
|
27
|
+
var rest = __rest(_a, []);
|
|
28
|
+
return _jsx(Context.Provider, __assign({ value: null }, rest));
|
|
29
|
+
};
|
|
30
|
+
var Consumer = Context.Consumer;
|
|
31
|
+
export default Context;
|
|
32
|
+
export { Provider, Consumer };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { connect } from 'react-redux';
|
|
2
|
+
import { bindActionCreators } from 'redux';
|
|
3
|
+
import { createActions, createFullSelector } from '../store';
|
|
4
|
+
var withReduxActions = function (gridName, prefix) {
|
|
5
|
+
if (prefix === void 0) { prefix = 'grid'; }
|
|
6
|
+
var actions = createActions(gridName);
|
|
7
|
+
var selectors = createFullSelector(gridName);
|
|
8
|
+
return connect(function (state) {
|
|
9
|
+
var _a;
|
|
10
|
+
return (_a = {},
|
|
11
|
+
_a["".concat(prefix, "Selectors")] = selectors(state),
|
|
12
|
+
_a);
|
|
13
|
+
}, function (dispatch) {
|
|
14
|
+
var _a;
|
|
15
|
+
return (_a = {},
|
|
16
|
+
_a["".concat(prefix, "Actions")] = bindActionCreators({
|
|
17
|
+
init: actions.init,
|
|
18
|
+
clearUxState: actions.clearUxState,
|
|
19
|
+
handleUxChange: actions.handleUxChange,
|
|
20
|
+
openConfigForm: actions.openConfigForm,
|
|
21
|
+
closeConfigForm: actions.closeConfigForm,
|
|
22
|
+
setColumnConfig: actions.setColumnConfig,
|
|
23
|
+
setPage: actions.setPage,
|
|
24
|
+
setRowsPerPage: actions.setRowsPerPage,
|
|
25
|
+
addFilter: actions.addFilter,
|
|
26
|
+
resetFilters: actions.resetFilters,
|
|
27
|
+
addSorting: actions.addSorting,
|
|
28
|
+
clearSettings: actions.clearSettings,
|
|
29
|
+
setColumnWidth: actions.setColumnWidth,
|
|
30
|
+
resetGrid: actions.resetGrid,
|
|
31
|
+
setColumnsOrder: actions.setColumnsOrder,
|
|
32
|
+
}, dispatch),
|
|
33
|
+
_a);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export default withReduxActions;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExtraControlButton } from './types';
|
|
2
|
+
import { Option, ValueType } from '../../Elements/Select/types';
|
|
3
|
+
export declare const getCreateButton: (onCreate: () => void, canCreate: boolean, disabled?: boolean) => ExtraControlButton;
|
|
4
|
+
export declare const getImportButton: (onImport: () => void, canImport: boolean, disabled?: boolean) => ExtraControlButton;
|
|
5
|
+
export declare const getMoreButton: (onExport: () => void, onImport?: () => void, canImport?: boolean) => ExtraControlButton;
|
|
6
|
+
export declare const getEshopSelect: (eshopOptions: Option[], selectedEshop: string, onChange: (eshopOption: ValueType) => void, isClearable?: boolean) => ExtraControlButton[];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Trans } from '@lingui/react';
|
|
3
|
+
import { x } from '@xstyled/styled-components';
|
|
4
|
+
import { t } from '@lingui/macro';
|
|
5
|
+
import Select from '../../Elements/Select';
|
|
6
|
+
import ButtonMore from './components/ButtonMore/ButtonMore';
|
|
7
|
+
export var getCreateButton = function (onCreate, canCreate, disabled) { return ({
|
|
8
|
+
label: _jsx(Trans, { id: "dataGrid.actionOptions.createNew", message: "Create new" }),
|
|
9
|
+
style: 'primary',
|
|
10
|
+
onClick: onCreate,
|
|
11
|
+
hide: !canCreate,
|
|
12
|
+
disabled: disabled,
|
|
13
|
+
}); };
|
|
14
|
+
export var getImportButton = function (onImport, canImport, disabled) { return ({
|
|
15
|
+
label: _jsx(Trans, { id: "form.buttonImport", message: "Import" }),
|
|
16
|
+
onClick: onImport,
|
|
17
|
+
hide: !canImport,
|
|
18
|
+
disabled: disabled,
|
|
19
|
+
}); };
|
|
20
|
+
export var getMoreButton = function (onExport, onImport, canImport) {
|
|
21
|
+
var items = [];
|
|
22
|
+
if (onImport && canImport) {
|
|
23
|
+
items.push({
|
|
24
|
+
title: _jsx(Trans, { id: "form.buttonImport", message: "Import" }),
|
|
25
|
+
onClick: onImport,
|
|
26
|
+
link: '#',
|
|
27
|
+
name: 'moreActionImportBtn',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
items.push({
|
|
31
|
+
title: _jsx(Trans, { id: "dataGrid.actionOptions.export", message: "Export" }),
|
|
32
|
+
onClick: onExport,
|
|
33
|
+
link: '#',
|
|
34
|
+
name: 'moreActionExportBtn',
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
node: _jsx(ButtonMore, { items: items }),
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export var getEshopSelect = function (eshopOptions, selectedEshop, onChange, isClearable) {
|
|
41
|
+
if (isClearable === void 0) { isClearable = true; }
|
|
42
|
+
var eshops = [];
|
|
43
|
+
if (eshopOptions.length > 1) {
|
|
44
|
+
eshops.push({
|
|
45
|
+
position: 'top-right',
|
|
46
|
+
node: (_jsx(x.div, { w: "200px", "data-cy": "eshopSelect", children: _jsx(Select, { name: "eshop", options: eshopOptions, value: selectedEshop, onChange: onChange, isSearchable: false, isClearable: isClearable, disabled: !eshopOptions.length, placeholder: t({ id: 'products.eshopFilterPlaceholder', message: 'Select eshop...' }) }) })),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return eshops;
|
|
50
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GridActionsType, GridSelectorsType, OnBatchActionFn, RowProps, ActionColumn } from '../../types';
|
|
2
|
+
type Props = {
|
|
3
|
+
gridActions: GridActionsType;
|
|
4
|
+
gridSelectors: GridSelectorsType;
|
|
5
|
+
actionColumn?: ActionColumn;
|
|
6
|
+
onBatchAction?: OnBatchActionFn;
|
|
7
|
+
rowsData: RowProps[];
|
|
8
|
+
onExport?: (range: 'filtered' | 'selected', format: string) => void;
|
|
9
|
+
};
|
|
10
|
+
declare const ActionHead: ({ gridActions, gridSelectors, actionColumn, onBatchAction, rowsData, onExport }: Props) => JSX.Element;
|
|
11
|
+
export default ActionHead;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
|
+
import styled from '@xstyled/styled-components';
|
|
8
|
+
import { Trans } from '@lingui/react';
|
|
9
|
+
import { t } from '@lingui/macro';
|
|
10
|
+
import { useGridActionTrigger, useToggleAllCheckbox } from '../../utils/public';
|
|
11
|
+
import { useModal } from '../../../Modal/hooks/useModal';
|
|
12
|
+
import { Button } from '../../../../Elements/Button';
|
|
13
|
+
import ButtonMore from '../ButtonMore/ButtonMore';
|
|
14
|
+
var Wrap = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n width: 100%;\n margin-right: 2;\n gap: 24px;\n background-color: red;\n position: relative;\n"], ["\n display: flex;\n align-items: center;\n width: 100%;\n margin-right: 2;\n gap: 24px;\n background-color: red;\n position: relative;\n"])));
|
|
15
|
+
var ActionsWrap = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translate(-50%);\n width: 596px;\n padding: 12px 24px;\n border-radius: 10px;\n background-color: #fff;\n box-shadow: dropShadow;\n z-index: 2;\n"], ["\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translate(-50%);\n width: 596px;\n padding: 12px 24px;\n border-radius: 10px;\n background-color: #fff;\n box-shadow: dropShadow;\n z-index: 2;\n"])));
|
|
16
|
+
var StyledText = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: 14px;\n line-height: 18px;\n color: blue2;\n font-weight: 600;\n"], ["\n font-size: 14px;\n line-height: 18px;\n color: blue2;\n font-weight: 600;\n"])));
|
|
17
|
+
var ContentWrap = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"], ["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])));
|
|
18
|
+
var ButtonsWrap = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-left: 10px;\n\n & > * {\n margin-left: 10px;\n }\n"], ["\n display: flex;\n align-items: center;\n margin-left: 10px;\n\n & > * {\n margin-left: 10px;\n }\n"])));
|
|
19
|
+
var ActionHead = function (_a) {
|
|
20
|
+
var _b;
|
|
21
|
+
var gridActions = _a.gridActions, gridSelectors = _a.gridSelectors, actionColumn = _a.actionColumn, onBatchAction = _a.onBatchAction, rowsData = _a.rowsData, onExport = _a.onExport;
|
|
22
|
+
var handleUxChange = (gridActions || {}).handleUxChange;
|
|
23
|
+
var _c = (gridSelectors || {}).uxState, uxState = _c === void 0 ? {} : _c;
|
|
24
|
+
var _d = useModal(), onExportClick = _d.onOpen, exportFormVisible = _d.isOpen, hideExport = _d.onClose;
|
|
25
|
+
var _e = useToggleAllCheckbox(rowsData, uxState, handleUxChange), checked = _e[0], toggleCheckbox = _e[1];
|
|
26
|
+
var _f = useGridActionTrigger(rowsData, uxState, actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions, onBatchAction), enabledActions = _f[0], onSubmit = _f[1];
|
|
27
|
+
var checkedRowsCount = Object.keys((uxState === null || uxState === void 0 ? void 0 : uxState.checkedRows) || []).length;
|
|
28
|
+
var checkAll = useCallback(function () {
|
|
29
|
+
if (!checked) {
|
|
30
|
+
toggleCheckbox();
|
|
31
|
+
}
|
|
32
|
+
}, [checked, toggleCheckbox]);
|
|
33
|
+
var actionsOptions = useMemo(function () {
|
|
34
|
+
var _a;
|
|
35
|
+
if ((_a = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _a === void 0 ? void 0 : _a.length) {
|
|
36
|
+
return actionColumn.actionOptions.map(function (option) { return ({
|
|
37
|
+
title: option.label,
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
39
|
+
onClick: function () { return onSubmit(option.value); },
|
|
40
|
+
link: '#',
|
|
41
|
+
}); });
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
}, [actionColumn, onSubmit]);
|
|
45
|
+
var canExport = typeof onExport === 'function';
|
|
46
|
+
return (_jsx(Wrap, { children: checkedRowsCount > 0 && (_jsx(ActionsWrap, { children: _jsxs(ContentWrap, { children: [_jsx(StyledText, { children: t({
|
|
47
|
+
id: 'dataGrid.checkedRowsCount',
|
|
48
|
+
message: "Selected {checkedRowsCount} items",
|
|
49
|
+
values: { checkedRowsCount: checkedRowsCount },
|
|
50
|
+
}) }), _jsxs(ButtonsWrap, { children: [_jsx(Button, { type: "button", onClick: checkAll, appearance: "secondaryLg", "data-cy": "checkAllBtn", disabled: checked, children: _jsx(Trans, { id: "dataGrid.checkAll", message: "Check all" }) }), canExport && (_jsx(Button, { type: "button", onClick: onExportClick, appearance: "primary", "data-cy": "exportBtn", disabled: !rowsData.length, children: _jsx(Trans, { id: "dataGrid.actionOptions.export", message: "Export" }) })), ((_b = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _b === void 0 ? void 0 : _b.length) && (_jsx(ButtonMore, { items: actionsOptions, disabled: !enabledActions.length || !rowsData.length, dropdownPosition: "top" }))] })] }) })) }));
|
|
51
|
+
};
|
|
52
|
+
export default ActionHead;
|
|
53
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
type ItemType = {
|
|
3
|
+
title: string | JSX.Element;
|
|
4
|
+
onClick: () => void;
|
|
5
|
+
link: string;
|
|
6
|
+
};
|
|
7
|
+
type DropdownMenuProps = {
|
|
8
|
+
items: ItemType[];
|
|
9
|
+
};
|
|
10
|
+
declare const ActionDropdownMenu: FC<DropdownMenuProps>;
|
|
11
|
+
export default ActionDropdownMenu;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import styled from '@xstyled/styled-components';
|
|
7
|
+
import { th } from '@xstyled/system';
|
|
8
|
+
var StyledDropdownWrap = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n left: 0;\n top: 3px;\n display: flex;\n flex-direction: column;\n padding: 2;\n width: 100%;\n background-color: ", ";\n box-shadow: ", ";\n min-width: 8.9rem;\n font-size: 12px;\n font-weight: normal;\n border-radius: 10px;\n z-index: 1;\n"], ["\n position: relative;\n left: 0;\n top: 3px;\n display: flex;\n flex-direction: column;\n padding: 2;\n width: 100%;\n background-color: ", ";\n box-shadow: ", ";\n min-width: 8.9rem;\n font-size: 12px;\n font-weight: normal;\n border-radius: 10px;\n z-index: 1;\n"])), th.color('white'), th.shadow('dropShadow'));
|
|
9
|
+
var StyledDropdownItem = styled.li(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 2 2;\n border-radius: 6px;\n cursor: pointer;\n &:hover {\n background-color: ", ";\n color: ", ";\n font-weight: bold;\n }\n"], ["\n padding: 2 2;\n border-radius: 6px;\n cursor: pointer;\n &:hover {\n background-color: ", ";\n color: ", ";\n font-weight: bold;\n }\n"])), th.color('bgLightGray1'), th.color('typoPrimary'));
|
|
10
|
+
var ActionDropdownMenu = function (_a) {
|
|
11
|
+
var items = _a.items;
|
|
12
|
+
return (_jsx(StyledDropdownWrap, { children: items.map(function (item, index) {
|
|
13
|
+
var _a;
|
|
14
|
+
return (_jsx(StyledDropdownItem, { onClick: (_a = item.onClick) !== null && _a !== void 0 ? _a : undefined, children: item.title }, index));
|
|
15
|
+
}) }));
|
|
16
|
+
};
|
|
17
|
+
export default ActionDropdownMenu;
|
|
18
|
+
var templateObject_1, templateObject_2;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Item = {
|
|
3
|
+
label: string | JSX.Element;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
type DropdownSelectProps = {
|
|
7
|
+
options: Item[];
|
|
8
|
+
onSelect: (value: Item['value']) => void;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: React.MemoExoticComponent<({ options, onSelect, disabled }: DropdownSelectProps) => JSX.Element>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
|
+
import React, { memo, useRef } from 'react';
|
|
7
|
+
import styled from '@xstyled/styled-components';
|
|
8
|
+
import { th } from '@xstyled/system';
|
|
9
|
+
import { Trans } from '@lingui/react';
|
|
10
|
+
import ActionDropdownMenu from './ActionDropdownMenu';
|
|
11
|
+
import { Popover } from '../../../../Popover';
|
|
12
|
+
import Icon from '../../../../../Elements/Icon/Icon';
|
|
13
|
+
var Content = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n padding: 1 2;\n min-width: 9rem;\n height: 28px;\n background-color: ", ";\n color: ", ";\n border: slim;\n border-color: ", ";\n font-size: 12px;\n font-weight: 600;\n border-radius: 6px;\n cursor: ", ";\n transition: 0.2s;\n &:not(:disabled):hover {\n color: ", ";\n border-color: ", ";\n }\n p {\n margin: 0;\n margin-right: auto;\n padding-right: 36px;\n }\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n padding: 1 2;\n min-width: 9rem;\n height: 28px;\n background-color: ", ";\n color: ", ";\n border: slim;\n border-color: ", ";\n font-size: 12px;\n font-weight: 600;\n border-radius: 6px;\n cursor: ", ";\n transition: 0.2s;\n &:not(:disabled):hover {\n color: ", ";\n border-color: ", ";\n }\n p {\n margin: 0;\n margin-right: auto;\n padding-right: 36px;\n }\n"])), th.color('white'), function (_a) {
|
|
14
|
+
var $isDisabled = _a.$isDisabled;
|
|
15
|
+
return ($isDisabled ? th.color('lightGray7') : th.color('lightGray5'));
|
|
16
|
+
}, function (_a) {
|
|
17
|
+
var $isDisabled = _a.$isDisabled, $isOpened = _a.$isOpened;
|
|
18
|
+
return $isDisabled ? th.color('lightGray7') : $isOpened ? th.color('blue2') : th.color('lightGray5');
|
|
19
|
+
}, function (_a) {
|
|
20
|
+
var $isDisabled = _a.$isDisabled;
|
|
21
|
+
return ($isDisabled ? 'not-allowed' : 'pointer');
|
|
22
|
+
}, th.color('gray1'), th.color('gray1'));
|
|
23
|
+
var IconWrap = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n font-size: 0.8rem;\n font-weight: 1000;\n transform: rotate(", ");\n"], ["\n color: ", ";\n font-size: 0.8rem;\n font-weight: 1000;\n transform: rotate(", ");\n"])), function (_a) {
|
|
24
|
+
var $isDisabled = _a.$isDisabled, $isOpened = _a.$isOpened;
|
|
25
|
+
return $isDisabled ? th.color('lightGray6') : $isOpened ? th.color('blue2') : th.color('gray1');
|
|
26
|
+
}, function (_a) {
|
|
27
|
+
var $isOpened = _a.$isOpened;
|
|
28
|
+
return ($isOpened ? '180deg' : 0);
|
|
29
|
+
});
|
|
30
|
+
var ActionDropdownSelect = function (_a) {
|
|
31
|
+
var options = _a.options, onSelect = _a.onSelect, _b = _a.disabled, disabled = _b === void 0 ? false : _b;
|
|
32
|
+
var _c = React.useState(false), showDropdownMenu = _c[0], setShowDropdownMenu = _c[1];
|
|
33
|
+
var toggleDropdownMenu = React.useCallback(function () {
|
|
34
|
+
setShowDropdownMenu(function (prev) { return !prev; });
|
|
35
|
+
}, []);
|
|
36
|
+
var handleSelectItem = React.useCallback(function (item) {
|
|
37
|
+
setShowDropdownMenu(false);
|
|
38
|
+
onSelect(item.value);
|
|
39
|
+
}, [onSelect]);
|
|
40
|
+
var items = options.map(function (item) { return ({ title: item.label, onClick: function () { return handleSelectItem(item); }, link: '#' }); });
|
|
41
|
+
var ref = useRef(null);
|
|
42
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Content, { "$isDisabled": disabled, "$isOpened": showDropdownMenu, onClick: toggleDropdownMenu, ref: ref, children: [_jsx("p", { children: _jsx(Trans, { id: "dataGrid.buttonActions", message: "Actions" }) }), _jsx(IconWrap, { "$isDisabled": disabled, "$isOpened": showDropdownMenu, children: _jsx(Icon, { icon: "goDown" }) })] }), showDropdownMenu && !disabled && (items === null || items === void 0 ? void 0 : items.length) > 0 && (_jsx(Popover, { parentRef: ref, onClose: toggleDropdownMenu, placement: "bottom-start", children: _jsx(ActionDropdownMenu, { items: items }) }))] }));
|
|
43
|
+
};
|
|
44
|
+
export default memo(ActionDropdownSelect);
|
|
45
|
+
var templateObject_1, templateObject_2;
|