@mailstep/design-system 0.8.51 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +22 -6
- package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.js +1 -1
- package/ui/Blocks/CommonGrid/components/ButtonMore/ButtonMore.d.ts +0 -1
- package/ui/Blocks/CommonGrid/hooks/useManageColumn.d.ts +2 -2
- package/ui/Blocks/CommonGrid/hooks/useManageColumn.js +6 -7
- package/ui/Blocks/Header/components/UserMenu/index.js +1 -1
- package/ui/Blocks/Header/styles.js +1 -1
- package/ui/Elements/Avatar/Avatar.js +1 -1
- package/ui/Elements/Avatar/styles.js +1 -1
- package/ui/Elements/Button/styles.js +1 -1
- package/ui/Elements/DropdownMenu/components/MenuItem.js +16 -29
- package/ui/Elements/DropdownMenu/types.d.ts +0 -2
- package/ui/Modules/Dashboard/Hoc/LoadingBoundary.d.ts +8 -0
- package/ui/Modules/Dashboard/Hoc/LoadingBoundary.js +11 -0
- package/ui/Modules/Dashboard/Hoc/index.d.ts +3 -0
- package/ui/Modules/Dashboard/Hoc/index.js +4 -0
- package/ui/Modules/Dashboard/Hoc/storybook/withReduxProvider.d.ts +4 -0
- package/ui/Modules/Dashboard/Hoc/storybook/withReduxProvider.js +14 -0
- package/ui/Modules/Dashboard/Hoc/withConfig.d.ts +7 -0
- package/ui/Modules/Dashboard/Hoc/withConfig.js +22 -0
- package/ui/Modules/Dashboard/Hoc/withFetch.d.ts +26 -0
- package/ui/Modules/Dashboard/Hoc/withFetch.js +50 -0
- package/ui/Modules/Dashboard/Hoc/withProps.d.ts +4 -0
- package/ui/Modules/Dashboard/Hoc/withProps.js +25 -0
- package/ui/Modules/Dashboard/assets/BarChartPreview.png +0 -0
- package/ui/Modules/Dashboard/assets/ColorBoxPreview.png +0 -0
- package/ui/Modules/Dashboard/assets/HorizontalBarPreview.png +0 -0
- package/ui/Modules/Dashboard/assets/NumberBoxPreview.png +0 -0
- package/ui/Modules/Dashboard/assets/PieChartPreview.png +0 -0
- package/ui/Modules/Dashboard/assets/TablePreview.png +0 -0
- package/ui/Modules/Dashboard/assets/TextBoxPreview.png +0 -0
- package/ui/Modules/Dashboard/assets/move.svg +18 -0
- package/ui/Modules/Dashboard/components/Config/MultiConfig.d.ts +6 -0
- package/ui/Modules/Dashboard/components/Config/MultiConfig.js +51 -0
- package/ui/Modules/Dashboard/components/Config/components/CommonConfig.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Config/components/CommonConfig.js +20 -0
- package/ui/Modules/Dashboard/components/Config/components/InputConfig.d.ts +5 -0
- package/ui/Modules/Dashboard/components/Config/components/InputConfig.js +104 -0
- package/ui/Modules/Dashboard/components/Config/types.d.ts +1 -0
- package/ui/Modules/Dashboard/components/Config/types.js +1 -0
- package/ui/Modules/Dashboard/components/Dashboard/Dashboard.d.ts +9 -0
- package/ui/Modules/Dashboard/components/Dashboard/Dashboard.js +16 -0
- package/ui/Modules/Dashboard/components/Dashboard/DashboardContainer.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Dashboard/DashboardContainer.js +31 -0
- package/ui/Modules/Dashboard/components/Dashboard/components/Body.d.ts +7 -0
- package/ui/Modules/Dashboard/components/Dashboard/components/Body.js +7 -0
- package/ui/Modules/Dashboard/components/Dashboard/components/HandleChange.d.ts +6 -0
- package/ui/Modules/Dashboard/components/Dashboard/components/HandleChange.js +25 -0
- package/ui/Modules/Dashboard/components/Dashboard/components/LayoutErrorBoundary.d.ts +13 -0
- package/ui/Modules/Dashboard/components/Dashboard/components/LayoutErrorBoundary.js +19 -0
- package/ui/Modules/Dashboard/components/Dashboard/dashboard2.css +124 -0
- package/ui/Modules/Dashboard/components/Dashboard/index.d.ts +2 -0
- package/ui/Modules/Dashboard/components/Dashboard/index.js +5 -0
- package/ui/Modules/Dashboard/components/Header/Header.d.ts +8 -0
- package/ui/Modules/Dashboard/components/Header/Header.js +9 -0
- package/ui/Modules/Dashboard/components/Header/index.d.ts +2 -0
- package/ui/Modules/Dashboard/components/Header/index.js +5 -0
- package/ui/Modules/Dashboard/components/Layout/Layout.d.ts +18 -0
- package/ui/Modules/Dashboard/components/Layout/Layout.js +39 -0
- package/ui/Modules/Dashboard/components/Layout/LayoutContainer.d.ts +7 -0
- package/ui/Modules/Dashboard/components/Layout/LayoutContainer.js +40 -0
- package/ui/Modules/Dashboard/components/Layout/components/Item/Item.d.ts +18 -0
- package/ui/Modules/Dashboard/components/Layout/components/Item/Item.js +79 -0
- package/ui/Modules/Dashboard/components/Layout/components/Item/ItemContainer.d.ts +11 -0
- package/ui/Modules/Dashboard/components/Layout/components/Item/ItemContainer.js +64 -0
- package/ui/Modules/Dashboard/components/Layout/components/Item/WidgetErrorBoundary.d.ts +14 -0
- package/ui/Modules/Dashboard/components/Layout/components/Item/WidgetErrorBoundary.js +28 -0
- package/ui/Modules/Dashboard/components/Layout/components/Item/index.d.ts +2 -0
- package/ui/Modules/Dashboard/components/Layout/components/Item/index.js +5 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemConfig/ItemConfig.d.ts +13 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemConfig/ItemConfig.js +18 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemConfig/ItemConfigControls.d.ts +8 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemConfig/ItemConfigControls.js +31 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemConfig/index.d.ts +2 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemConfig/index.js +5 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemHeader/ItemHeader.d.ts +12 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemHeader/ItemHeader.js +27 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemHeader/index.d.ts +2 -0
- package/ui/Modules/Dashboard/components/Layout/components/ItemHeader/index.js +5 -0
- package/ui/Modules/Dashboard/components/Layout/index.d.ts +2 -0
- package/ui/Modules/Dashboard/components/Layout/index.js +5 -0
- package/ui/Modules/Dashboard/components/NoData/NoData.d.ts +2 -0
- package/ui/Modules/Dashboard/components/NoData/NoData.js +14 -0
- package/ui/Modules/Dashboard/components/NoData/index.d.ts +2 -0
- package/ui/Modules/Dashboard/components/NoData/index.js +5 -0
- package/ui/Modules/Dashboard/components/Picker/Picker.d.ts +8 -0
- package/ui/Modules/Dashboard/components/Picker/Picker.js +38 -0
- package/ui/Modules/Dashboard/components/Picker/PickerContainer.d.ts +7 -0
- package/ui/Modules/Dashboard/components/Picker/PickerContainer.js +38 -0
- package/ui/Modules/Dashboard/components/Picker/components/PickerItem.d.ts +8 -0
- package/ui/Modules/Dashboard/components/Picker/components/PickerItem.js +25 -0
- package/ui/Modules/Dashboard/components/Picker/index.d.ts +2 -0
- package/ui/Modules/Dashboard/components/Picker/index.js +5 -0
- package/ui/Modules/Dashboard/components/Text/Text.d.ts +7 -0
- package/ui/Modules/Dashboard/components/Text/Text.js +14 -0
- package/ui/Modules/Dashboard/components/Text/index.d.ts +1 -0
- package/ui/Modules/Dashboard/components/Text/index.js +2 -0
- package/ui/Modules/Dashboard/components/Widgets/BarChart/BarChart.d.ts +19 -0
- package/ui/Modules/Dashboard/components/Widgets/BarChart/BarChart.js +52 -0
- package/ui/Modules/Dashboard/components/Widgets/BarChart/Config.d.ts +1 -0
- package/ui/Modules/Dashboard/components/Widgets/BarChart/Config.js +5 -0
- package/ui/Modules/Dashboard/components/Widgets/BarChart/index.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Widgets/BarChart/index.js +6 -0
- package/ui/Modules/Dashboard/components/Widgets/BarChart/styles.d.ts +12 -0
- package/ui/Modules/Dashboard/components/Widgets/BarChart/styles.js +39 -0
- package/ui/Modules/Dashboard/components/Widgets/ColorBox/ColorBox.d.ts +7 -0
- package/ui/Modules/Dashboard/components/Widgets/ColorBox/ColorBox.js +21 -0
- package/ui/Modules/Dashboard/components/Widgets/ColorBox/Config.d.ts +3 -0
- package/ui/Modules/Dashboard/components/Widgets/ColorBox/Config.js +23 -0
- package/ui/Modules/Dashboard/components/Widgets/ColorBox/index.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Widgets/ColorBox/index.js +6 -0
- package/ui/Modules/Dashboard/components/Widgets/EmptyWidget/EmptyWidget.d.ts +7 -0
- package/ui/Modules/Dashboard/components/Widgets/EmptyWidget/EmptyWidget.js +10 -0
- package/ui/Modules/Dashboard/components/Widgets/EmptyWidget/index.d.ts +2 -0
- package/ui/Modules/Dashboard/components/Widgets/EmptyWidget/index.js +5 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/Config.d.ts +1 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/Config.js +5 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/HorizontalBar.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/HorizontalBar.js +38 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/components/LabelsLine.d.ts +8 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/components/LabelsLine.js +14 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/components/ProgressLine.d.ts +7 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/components/ProgressLine.js +14 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/index.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/index.js +6 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/storybook.sample.d.ts +2 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/storybook.sample.js +33 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/styles.d.ts +18 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/styles.js +58 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/types.d.ts +13 -0
- package/ui/Modules/Dashboard/components/Widgets/HorizontalBar/types.js +1 -0
- package/ui/Modules/Dashboard/components/Widgets/NumberBox/Config.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Widgets/NumberBox/Config.js +38 -0
- package/ui/Modules/Dashboard/components/Widgets/NumberBox/NumberBox.d.ts +5 -0
- package/ui/Modules/Dashboard/components/Widgets/NumberBox/NumberBox.js +38 -0
- package/ui/Modules/Dashboard/components/Widgets/NumberBox/index.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Widgets/NumberBox/index.js +6 -0
- package/ui/Modules/Dashboard/components/Widgets/NumberBox/styles.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Widgets/NumberBox/styles.js +25 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/Config.d.ts +1 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/Config.js +5 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/PieChart.d.ts +21 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/PieChart.js +59 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/components/CenteredMetric.d.ts +10 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/components/CenteredMetric.js +24 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/index.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/index.js +6 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/styles.d.ts +14 -0
- package/ui/Modules/Dashboard/components/Widgets/PieChart/styles.js +47 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/Config.d.ts +9 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/Config.js +87 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/Table.d.ts +4 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/Table.js +93 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/components/IconLabelCell.d.ts +8 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/components/IconLabelCell.js +19 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/components/PaginatorList.d.ts +9 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/components/PaginatorList.js +31 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/components/PaginatorLocation.d.ts +8 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/components/PaginatorLocation.js +15 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/components/TableCell.d.ts +6 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/components/TableCell.js +33 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/hooks/useCondition.d.ts +10 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/hooks/useCondition.js +27 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/hooks/usePages.d.ts +17 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/hooks/usePages.js +27 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/hooks/useSort.d.ts +10 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/hooks/useSort.js +31 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/index.d.ts +5 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/index.js +7 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/storybook.sample.d.ts +73 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/storybook.sample.js +211 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/styles.d.ts +23 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/styles.js +69 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/types.d.ts +52 -0
- package/ui/Modules/Dashboard/components/Widgets/Table/types.js +1 -0
- package/ui/Modules/Dashboard/components/Widgets/TextBox/TextBox.d.ts +10 -0
- package/ui/Modules/Dashboard/components/Widgets/TextBox/TextBox.js +12 -0
- package/ui/Modules/Dashboard/components/Widgets/TextBox/index.d.ts +3 -0
- package/ui/Modules/Dashboard/components/Widgets/TextBox/index.js +5 -0
- package/ui/Modules/Dashboard/components/Widgets/index.d.ts +11 -0
- package/ui/Modules/Dashboard/components/Widgets/index.js +108 -0
- package/ui/Modules/Dashboard/components/Widgets/utils/generic.d.ts +5 -0
- package/ui/Modules/Dashboard/components/Widgets/utils/generic.js +20 -0
- package/ui/Modules/Dashboard/components/Widgets/utils/helpers.d.ts +3 -0
- package/ui/Modules/Dashboard/components/Widgets/utils/helpers.js +25 -0
- package/ui/Modules/Dashboard/components/Widgets/utils/legends.d.ts +20 -0
- package/ui/Modules/Dashboard/components/Widgets/utils/legends.js +57 -0
- package/ui/Modules/Dashboard/context/ComponentContext.d.ts +5 -0
- package/ui/Modules/Dashboard/context/ComponentContext.js +15 -0
- package/ui/Modules/Dashboard/context/LangContext.d.ts +3 -0
- package/ui/Modules/Dashboard/context/LangContext.js +5 -0
- package/ui/Modules/Dashboard/errors/ErrorMessage.d.ts +7 -0
- package/ui/Modules/Dashboard/errors/ErrorMessage.js +12 -0
- package/ui/Modules/Dashboard/errors/WidgetError.d.ts +5 -0
- package/ui/Modules/Dashboard/errors/WidgetError.js +10 -0
- package/ui/Modules/Dashboard/hooks/usePrevious.d.ts +5 -0
- package/ui/Modules/Dashboard/hooks/usePrevious.js +14 -0
- package/ui/Modules/Dashboard/hooks/useRefWithCallback.d.ts +2 -0
- package/ui/Modules/Dashboard/hooks/useRefWithCallback.js +16 -0
- package/ui/Modules/Dashboard/hooks/useResize.d.ts +6 -0
- package/ui/Modules/Dashboard/hooks/useResize.js +19 -0
- package/ui/Modules/Dashboard/index.d.ts +7 -0
- package/ui/Modules/Dashboard/index.js +12 -0
- package/ui/Modules/Dashboard/locale/cs.d.ts +24 -0
- package/ui/Modules/Dashboard/locale/cs.js +26 -0
- package/ui/Modules/Dashboard/locale/en.d.ts +24 -0
- package/ui/Modules/Dashboard/locale/en.js +26 -0
- package/ui/Modules/Dashboard/locale/index.d.ts +4 -0
- package/ui/Modules/Dashboard/locale/index.js +13 -0
- package/ui/Modules/Dashboard/locale/it.d.ts +24 -0
- package/ui/Modules/Dashboard/locale/it.js +26 -0
- package/ui/Modules/Dashboard/locale/uk.d.ts +24 -0
- package/ui/Modules/Dashboard/locale/uk.js +26 -0
- package/ui/Modules/Dashboard/store/reducers/index.d.ts +9 -0
- package/ui/Modules/Dashboard/store/reducers/index.js +6 -0
- package/ui/Modules/Dashboard/store/reducers/widgetListReducer.d.ts +41 -0
- package/ui/Modules/Dashboard/store/reducers/widgetListReducer.js +76 -0
- package/ui/Modules/Dashboard/stories/storybook.sample.d.ts +50 -0
- package/ui/Modules/Dashboard/stories/storybook.sample.js +237 -0
- package/ui/Modules/Dashboard/styles.d.ts +63 -0
- package/ui/Modules/Dashboard/styles.js +358 -0
- package/ui/Modules/Dashboard/types.d.ts +185 -0
- package/ui/Modules/Dashboard/types.js +1 -0
- package/ui/Modules/index.d.ts +1 -0
- package/ui/Modules/index.js +8 -0
- package/ui/ThemeProvider/themes/index.d.ts +224 -0
- package/ui/ThemeProvider/themes/index.js +3 -1
- package/ui/ThemeProvider/themes/mailwiseDark.d.ts +225 -0
- package/ui/ThemeProvider/themes/mailwiseDark.js +16 -0
- package/ui/ThemeProvider/types.d.ts +1 -1
- package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.d.ts +0 -41
- package/ui/Blocks/CommonGrid/storybook/stories/default.stories.d.ts +0 -6
- package/ui/Blocks/CommonGrid/storybook/stories/gridStates.stories.d.ts +0 -8
- package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNoScrollLayout.stories.d.ts +0 -10
- package/ui/Blocks/CommonGrid/storybook/stories/manyColumnsNormalLayout.stories.d.ts +0 -10
- package/ui/Blocks/CommonGrid/storybook/stories/styledCommonGrid.stories.d.ts +0 -6
- package/ui/Blocks/CommonGrid/storybook/stories/withCustomGridActions.stories.d.ts +0 -10
- package/ui/Blocks/CommonGrid/storybook/stories/withForcedCheckboxes.stories.d.ts +0 -14
- package/ui/Blocks/CommonGrid/storybook/stories/withQuickFilter.stories.d.ts +0 -11
- package/ui/Blocks/CornerDialog/stories/CornerDialog.stories.d.ts +0 -13
- package/ui/Blocks/Header/stories/Header.stories.d.ts +0 -52
- package/ui/Blocks/HidePrint/stories/HidePrint.stories.d.ts +0 -12
- package/ui/Blocks/ImageList/stories/ImageList.stories.d.ts +0 -14
- package/ui/Blocks/LanguageSwitch/stories/LanguageSwith.stories.d.ts +0 -10
- package/ui/Blocks/LightBox/stories/LightBox.stories.d.ts +0 -10
- package/ui/Blocks/LoginPage/stories/LoginPage.stories.d.ts +0 -10
- package/ui/Blocks/Modal/stories/Modal.stories.d.ts +0 -28
- package/ui/Blocks/Popover/stories/Popover.stories.d.ts +0 -16
- package/ui/Blocks/Scheduler/stories/Scheduler.stories.d.ts +0 -7
- package/ui/Blocks/SideMenu/stories/SideMenu.stories.d.ts +0 -11
- package/ui/Blocks/Stepper/stories/Stepper.stories.d.ts +0 -9
- package/ui/Blocks/Table/stories/Table.stories.d.ts +0 -12
- package/ui/Blocks/Tabs/stories/Tabs.stories.d.ts +0 -12
- package/ui/Elements/Alert/stories/Alert.stories.d.ts +0 -17
- package/ui/Elements/AsyncSelect/stories/AsyncSelect.stories.d.ts +0 -10
- package/ui/Elements/Avatar/stories/Avatar.stories.d.ts +0 -11
- package/ui/Elements/Badge/stories/Badge.stories.d.ts +0 -12
- package/ui/Elements/BarChartSymbol/stories/BarChartSymbol.stories.d.ts +0 -12
- package/ui/Elements/BorderedBox/stories/BorderedBox.stories.d.ts +0 -10
- package/ui/Elements/Button/stories/Button.stories.d.ts +0 -28
- package/ui/Elements/Card/stories/Card.stories.d.ts +0 -13
- package/ui/Elements/CheckedCircle/storries/CheckedCircle.stories.d.ts +0 -16
- package/ui/Elements/DatePicker/stories/DatePicker.stories.d.ts +0 -11
- package/ui/Elements/Dropdown/stories/Dropdown.stories.d.ts +0 -10
- package/ui/Elements/DropdownMenu/stories/DropdownMenu.stories.d.ts +0 -10
- package/ui/Elements/DropdownSelect/stories/DropdownSelect.stories.d.ts +0 -22
- package/ui/Elements/ErrorMessage/stories/ErrorMessage.stories.d.ts +0 -11
- package/ui/Elements/HighlightBox/stories/HighlightBox.stories.d.ts +0 -31
- package/ui/Elements/Icon/stories/BadgeIcon.stories.d.ts +0 -28
- package/ui/Elements/Icon/stories/Icon.stories.d.ts +0 -15
- package/ui/Elements/Image/stories/Image.stories.d.ts +0 -13
- package/ui/Elements/Label/stories/Label.stories.d.ts +0 -13
- package/ui/Elements/Line/stories/Line.stories.d.ts +0 -16
- package/ui/Elements/Link/stories/Link.stories.d.ts +0 -30
- package/ui/Elements/Logo/stories/Logo.stories.d.ts +0 -37
- package/ui/Elements/Pagination/stories/Pagination.stories.d.ts +0 -13
- package/ui/Elements/Portal/stories/Portal.stories.d.ts +0 -11
- package/ui/Elements/ProgressBar/stories/ProgressBar.stories.d.ts +0 -18
- package/ui/Elements/Select/stories/Select.stories.d.ts +0 -9
- package/ui/Elements/SimpleLink/stories/SimpleLink.stories.d.ts +0 -13
- package/ui/Elements/SingleSelect/stories/SingleSelect.stories.d.ts +0 -10
- package/ui/Elements/SpaceAround/stories/SpaceAround.stories.d.ts +0 -11
- package/ui/Elements/Spinner/stories/Spinner.stories.d.ts +0 -19
- package/ui/Elements/Table/stories/Table.stories.d.ts +0 -8
- package/ui/Elements/Tag/stories/Tag.stories.d.ts +0 -19
- package/ui/Elements/Text/stories/Text.stories.d.ts +0 -15
- package/ui/Elements/Toast/stories/Toast.stories.d.ts +0 -13
- package/ui/Elements/Toggle/stories/Toggle.stories.d.ts +0 -16
- package/ui/Elements/Tooltip/stories/Tooltip.stories.d.ts +0 -10
- package/ui/Elements/Typography/stories/Typography.stories.d.ts +0 -20
- package/ui/Forms/Checkbox/stories/Checkbox.stories.d.ts +0 -13
- package/ui/Forms/Input/stories/Input.stories.d.ts +0 -18
- package/ui/Forms/RadioButton/stories/RadioButton.stories.d.ts +0 -13
- package/ui/utils/KeyPress/KeyPress.stories.d.ts +0 -10
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import Button_default from "../../../../../Elements/Button/index.js";
|
|
2
|
+
import styles_default from "../../../styles.js";
|
|
3
|
+
import { useText } from "../../Text/Text.js";
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import omit from "lodash/omit";
|
|
7
|
+
//#region packages/ui/Modules/Dashboard/components/Config/components/InputConfig.tsx
|
|
8
|
+
const getSelectValue = (currentValue, targetValue, isMulti, isChecked = false) => {
|
|
9
|
+
if (isMulti) {
|
|
10
|
+
const asserted = currentValue ?? [];
|
|
11
|
+
if (isChecked) return asserted.concat(targetValue);
|
|
12
|
+
return asserted.filter((val) => val !== targetValue);
|
|
13
|
+
}
|
|
14
|
+
return targetValue;
|
|
15
|
+
};
|
|
16
|
+
const createConfigField = (fieldName, value, label) => ({
|
|
17
|
+
[fieldName]: value,
|
|
18
|
+
...label && { [`${fieldName}Label`]: label }
|
|
19
|
+
});
|
|
20
|
+
const InputConfig = ({ onChange, config, label, name, input, isMulti = false, options = [], placeholder }) => {
|
|
21
|
+
const none = useText("widgets.none");
|
|
22
|
+
const clear = useText("widgets.clear");
|
|
23
|
+
const selectAll = useText("widgets.selectAll");
|
|
24
|
+
const value = config?.[name];
|
|
25
|
+
const handleChange = useCallback((e) => {
|
|
26
|
+
const selectOption = options.find((option) => option.value === e.target.value);
|
|
27
|
+
const selectValue = getSelectValue(value, selectOption?.value || "", isMulti, e.target.checked);
|
|
28
|
+
const configField = createConfigField(name, input ? e.target.value : selectValue, input ? void 0 : selectOption?.label);
|
|
29
|
+
onChange({
|
|
30
|
+
...config,
|
|
31
|
+
...configField
|
|
32
|
+
});
|
|
33
|
+
}, [
|
|
34
|
+
name,
|
|
35
|
+
options,
|
|
36
|
+
onChange,
|
|
37
|
+
value,
|
|
38
|
+
isMulti,
|
|
39
|
+
config,
|
|
40
|
+
input
|
|
41
|
+
]);
|
|
42
|
+
const handleSelectAll = useCallback(() => {
|
|
43
|
+
const configFields = createConfigField(name, options.map((opt) => opt.value));
|
|
44
|
+
onChange({
|
|
45
|
+
...config,
|
|
46
|
+
...configFields
|
|
47
|
+
});
|
|
48
|
+
}, [
|
|
49
|
+
name,
|
|
50
|
+
options,
|
|
51
|
+
config,
|
|
52
|
+
onChange
|
|
53
|
+
]);
|
|
54
|
+
const handleRemoveAll = useCallback(() => {
|
|
55
|
+
onChange({ ...omit(config, name) });
|
|
56
|
+
}, [
|
|
57
|
+
name,
|
|
58
|
+
config,
|
|
59
|
+
onChange
|
|
60
|
+
]);
|
|
61
|
+
return /* @__PURE__ */ jsxs(styles_default.ConfigRow, {
|
|
62
|
+
isBlock: isMulti,
|
|
63
|
+
children: [/* @__PURE__ */ jsxs(styles_default.ConfigLabel, { children: [label, ": "] }), /* @__PURE__ */ jsx(styles_default.ConfigInput, { children: input ? /* @__PURE__ */ jsx(styles_default.Input, {
|
|
64
|
+
type: input,
|
|
65
|
+
defaultValue: value || "",
|
|
66
|
+
onChange: handleChange
|
|
67
|
+
}) : isMulti ? /* @__PURE__ */ jsxs(styles_default.CheckboxContent, { children: [/* @__PURE__ */ jsxs(styles_default.CheckboxControls, { children: [
|
|
68
|
+
/* @__PURE__ */ jsx(Button_default, {
|
|
69
|
+
onClick: handleSelectAll,
|
|
70
|
+
children: selectAll
|
|
71
|
+
}),
|
|
72
|
+
" ",
|
|
73
|
+
/* @__PURE__ */ jsx(Button_default, {
|
|
74
|
+
appearance: "secondary",
|
|
75
|
+
onClick: handleRemoveAll,
|
|
76
|
+
children: clear
|
|
77
|
+
})
|
|
78
|
+
] }), options.map((option) => {
|
|
79
|
+
const isChecked = (value || []).includes(option.value);
|
|
80
|
+
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("input", {
|
|
81
|
+
id: option.value,
|
|
82
|
+
type: "checkbox",
|
|
83
|
+
value: option.value,
|
|
84
|
+
onChange: handleChange,
|
|
85
|
+
checked: isChecked
|
|
86
|
+
}), /* @__PURE__ */ jsx("label", {
|
|
87
|
+
htmlFor: option.value,
|
|
88
|
+
children: option.label
|
|
89
|
+
})] }, option.value);
|
|
90
|
+
})] }) : /* @__PURE__ */ jsxs(styles_default.Select, {
|
|
91
|
+
onChange: handleChange,
|
|
92
|
+
value: value || "",
|
|
93
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
94
|
+
value: "",
|
|
95
|
+
children: placeholder || none
|
|
96
|
+
}), options.map((option) => /* @__PURE__ */ jsx("option", {
|
|
97
|
+
value: option.value,
|
|
98
|
+
children: option.label
|
|
99
|
+
}, option.value))]
|
|
100
|
+
}) })]
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { InputConfig as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { MultiConfigProps } from './MultiConfig';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { DashboardProps } from '../../types';
|
|
3
|
+
import './dashboard.css';
|
|
4
|
+
type Props = {
|
|
5
|
+
title?: DashboardProps['title'];
|
|
6
|
+
widgetDefinitions: DashboardProps['widgetDefinitions'];
|
|
7
|
+
};
|
|
8
|
+
declare const DashboardComponent: ({ title, widgetDefinitions }: Props) => JSX.Element;
|
|
9
|
+
export default DashboardComponent;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styles_default from "../../styles.js";
|
|
2
|
+
import Header_default from "../Header/index.js";
|
|
3
|
+
import Layout_default from "../Layout/index.js";
|
|
4
|
+
import DashboardBody from "./components/Body.js";
|
|
5
|
+
import LayoutErrorBoundary from "./components/LayoutErrorBoundary.js";
|
|
6
|
+
/* empty css */
|
|
7
|
+
import "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region packages/ui/Modules/Dashboard/components/Dashboard/Dashboard.tsx
|
|
10
|
+
const emptyWidgetDefinitions = [];
|
|
11
|
+
const DashboardComponent = ({ title, widgetDefinitions = emptyWidgetDefinitions }) => /* @__PURE__ */ jsxs(styles_default.Wrapper, { children: [/* @__PURE__ */ jsx(Header_default, {
|
|
12
|
+
title,
|
|
13
|
+
widgetDefinitions
|
|
14
|
+
}), /* @__PURE__ */ jsx(DashboardBody, { children: /* @__PURE__ */ jsx(LayoutErrorBoundary, { children: /* @__PURE__ */ jsx(Layout_default, { widgetDefinitions }) }) })] });
|
|
15
|
+
//#endregion
|
|
16
|
+
export { DashboardComponent as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { actions } from "../../store/reducers/widgetListReducer.js";
|
|
2
|
+
import LangContext from "../../context/LangContext.js";
|
|
3
|
+
import ComponentContext, { defaultComponents } from "../../context/ComponentContext.js";
|
|
4
|
+
import DashboardComponent from "./Dashboard.js";
|
|
5
|
+
import HandleChange from "./components/HandleChange.js";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useDispatch } from "react-redux";
|
|
9
|
+
//#region packages/ui/Modules/Dashboard/components/Dashboard/DashboardContainer.tsx
|
|
10
|
+
const DashboardContainer = ({ initialWidgets, onChange, lang = "en", components, ...rest }) => {
|
|
11
|
+
const dispatch = useDispatch();
|
|
12
|
+
/**
|
|
13
|
+
* on mount move data from props to store
|
|
14
|
+
*/
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (initialWidgets) dispatch(actions.initWidgets(initialWidgets));
|
|
17
|
+
}, [dispatch, JSON.stringify(initialWidgets)]);
|
|
18
|
+
const mergedComponents = React.useMemo(() => ({
|
|
19
|
+
...defaultComponents,
|
|
20
|
+
...components || {}
|
|
21
|
+
}), [components]);
|
|
22
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(LangContext.Provider, {
|
|
23
|
+
value: lang,
|
|
24
|
+
children: /* @__PURE__ */ jsx(ComponentContext.Provider, {
|
|
25
|
+
value: mergedComponents,
|
|
26
|
+
children: /* @__PURE__ */ jsx(DashboardComponent, { ...rest })
|
|
27
|
+
})
|
|
28
|
+
}), /* @__PURE__ */ jsx(HandleChange, { onChange })] });
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { DashboardContainer as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import styles_default from "../../../styles.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region packages/ui/Modules/Dashboard/components/Dashboard/components/Body.tsx
|
|
5
|
+
const DashboardBody = ({ children }) => /* @__PURE__ */ jsx(styles_default.Body, { children });
|
|
6
|
+
//#endregion
|
|
7
|
+
export { DashboardBody as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { selectors } from "../../../store/reducers/widgetListReducer.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useSelector } from "react-redux";
|
|
5
|
+
//#region packages/ui/Modules/Dashboard/components/Dashboard/components/HandleChange.tsx
|
|
6
|
+
const useEffectChange = (onChange, widgets, deps) => {
|
|
7
|
+
const [wasFirstRender, setWasFirstRender] = React.useState(false);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
if (!onChange) return;
|
|
10
|
+
if (!wasFirstRender && widgets !== null) {
|
|
11
|
+
setWasFirstRender(true);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
onChange();
|
|
15
|
+
}, deps);
|
|
16
|
+
};
|
|
17
|
+
const HandleChange = ({ onChange }) => {
|
|
18
|
+
const widgets = useSelector(selectors.getWidgets);
|
|
19
|
+
useEffectChange(() => {
|
|
20
|
+
if (onChange && widgets !== null) onChange(widgets);
|
|
21
|
+
}, widgets, [onChange, JSON.stringify(widgets)]);
|
|
22
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { HandleChange as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface LayoutErrorBoundaryProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
type LayoutErrorBoundaryState = {
|
|
6
|
+
error: Error | null;
|
|
7
|
+
};
|
|
8
|
+
declare class LayoutErrorBoundary extends React.Component<LayoutErrorBoundaryProps, LayoutErrorBoundaryState> {
|
|
9
|
+
constructor(props: LayoutErrorBoundaryProps);
|
|
10
|
+
static getDerivedStateFromError(error: Error): LayoutErrorBoundaryState;
|
|
11
|
+
render(): React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export default LayoutErrorBoundary;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import styles_default from "../../../styles.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region packages/ui/Modules/Dashboard/components/Dashboard/components/LayoutErrorBoundary.tsx
|
|
5
|
+
var LayoutErrorBoundary = class extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.state = { error: null };
|
|
9
|
+
}
|
|
10
|
+
static getDerivedStateFromError(error) {
|
|
11
|
+
return { error };
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
if (this.state.error) return /* @__PURE__ */ jsxs(styles_default.LayoutError, { children: [/* @__PURE__ */ jsx(styles_default.LayoutErrorTitle, { children: "Something went wrong." }), /* @__PURE__ */ jsx(styles_default.LayoutErrorMessage, { children: this.state.error?.message })] });
|
|
15
|
+
return this.props.children;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { LayoutErrorBoundary as default };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
.react-grid-layout {
|
|
2
|
+
transition: height .2s;
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.react-grid-item {
|
|
7
|
+
transition: left .2s, top .2s;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.react-grid-item img {
|
|
11
|
+
pointer-events: none;
|
|
12
|
+
user-select: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.react-grid-item.cssTransforms {
|
|
16
|
+
transition-property: transform;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.react-grid-item.resizing {
|
|
20
|
+
z-index: 1;
|
|
21
|
+
will-change: width, height;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.react-grid-item.react-draggable-dragging {
|
|
25
|
+
z-index: 3;
|
|
26
|
+
will-change: transform;
|
|
27
|
+
transition: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.react-grid-item.dropping {
|
|
31
|
+
visibility: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.react-grid-item.react-grid-placeholder {
|
|
35
|
+
opacity: .2;
|
|
36
|
+
z-index: 2;
|
|
37
|
+
-webkit-user-select: none;
|
|
38
|
+
-moz-user-select: none;
|
|
39
|
+
-ms-user-select: none;
|
|
40
|
+
user-select: none;
|
|
41
|
+
-o-user-select: none;
|
|
42
|
+
background: red;
|
|
43
|
+
transition-duration: .1s;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.react-grid-item > .react-resizable-handle {
|
|
47
|
+
width: 20px;
|
|
48
|
+
height: 20px;
|
|
49
|
+
position: absolute;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.react-grid-item > .react-resizable-handle:after {
|
|
53
|
+
content: "";
|
|
54
|
+
border-bottom: 2px solid #0006;
|
|
55
|
+
border-right: 2px solid #0006;
|
|
56
|
+
width: 5px;
|
|
57
|
+
height: 5px;
|
|
58
|
+
position: absolute;
|
|
59
|
+
bottom: 3px;
|
|
60
|
+
right: 3px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.react-resizable-hide > .react-resizable-handle {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-sw {
|
|
68
|
+
cursor: sw-resize;
|
|
69
|
+
bottom: 0;
|
|
70
|
+
left: 0;
|
|
71
|
+
transform: rotate(90deg);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-se {
|
|
75
|
+
cursor: se-resize;
|
|
76
|
+
bottom: 0;
|
|
77
|
+
right: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-nw {
|
|
81
|
+
cursor: nw-resize;
|
|
82
|
+
top: 0;
|
|
83
|
+
left: 0;
|
|
84
|
+
transform: rotate(180deg);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-ne {
|
|
88
|
+
cursor: ne-resize;
|
|
89
|
+
top: 0;
|
|
90
|
+
right: 0;
|
|
91
|
+
transform: rotate(270deg);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-w, .react-grid-item > .react-resizable-handle.react-resizable-handle-e {
|
|
95
|
+
cursor: ew-resize;
|
|
96
|
+
margin-top: -10px;
|
|
97
|
+
top: 50%;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-w {
|
|
101
|
+
left: 0;
|
|
102
|
+
transform: rotate(135deg);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-e {
|
|
106
|
+
right: 0;
|
|
107
|
+
transform: rotate(315deg);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-n, .react-grid-item > .react-resizable-handle.react-resizable-handle-s {
|
|
111
|
+
cursor: ns-resize;
|
|
112
|
+
margin-left: -10px;
|
|
113
|
+
left: 50%;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-n {
|
|
117
|
+
top: 0;
|
|
118
|
+
transform: rotate(225deg);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.react-grid-item > .react-resizable-handle.react-resizable-handle-s {
|
|
122
|
+
bottom: 0;
|
|
123
|
+
transform: rotate(45deg);
|
|
124
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { WidgetDefinition } from '../../types';
|
|
3
|
+
interface HeaderProps {
|
|
4
|
+
title?: string | boolean;
|
|
5
|
+
widgetDefinitions: WidgetDefinition[];
|
|
6
|
+
}
|
|
7
|
+
declare const Header: ({ title, widgetDefinitions }: HeaderProps) => JSX.Element | null;
|
|
8
|
+
export default Header;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styles_default from "../../styles.js";
|
|
2
|
+
import Text from "../Text/Text.js";
|
|
3
|
+
import Picker_default from "../Picker/index.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region packages/ui/Modules/Dashboard/components/Header/Header.tsx
|
|
7
|
+
const Header = ({ title = "", widgetDefinitions }) => /* @__PURE__ */ jsxs(styles_default.Header, { children: [/* @__PURE__ */ jsx("h1", { children: title || title === false || /* @__PURE__ */ jsx(Text, { code: "dashboard.title" }) }), /* @__PURE__ */ jsx(Picker_default, { widgetDefinitions })] });
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Header as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import { Layout } from 'react-grid-layout';
|
|
3
|
+
import type { LayoutWidgetItem, WidgetDefinition } from '../../types';
|
|
4
|
+
export declare const rowHeight = 100;
|
|
5
|
+
export declare const margin: [number, number];
|
|
6
|
+
interface DashboardLayoutProps {
|
|
7
|
+
widgetDefinitions: WidgetDefinition[];
|
|
8
|
+
widgetList: LayoutWidgetItem[] | null;
|
|
9
|
+
onLayoutChange: (layout: Layout[]) => void;
|
|
10
|
+
openedConfigs: string[];
|
|
11
|
+
toggleOpenedConfig: (widgetId: string) => void;
|
|
12
|
+
onSetHeight: (id: string, height: number) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Map of items
|
|
16
|
+
*/
|
|
17
|
+
declare const DashboardLayout: ({ widgetList, widgetDefinitions, onLayoutChange, toggleOpenedConfig, openedConfigs, onSetHeight }: DashboardLayoutProps) => JSX.Element;
|
|
18
|
+
export default DashboardLayout;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import styles_default from "../../styles.js";
|
|
2
|
+
import Text from "../Text/Text.js";
|
|
3
|
+
import Item_default from "./components/Item/index.js";
|
|
4
|
+
import "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import GridLayout, { WidthProvider } from "react-grid-layout";
|
|
7
|
+
//#region packages/ui/Modules/Dashboard/components/Layout/Layout.tsx
|
|
8
|
+
const rowHeight = 100;
|
|
9
|
+
const margin = [20, 20];
|
|
10
|
+
const GridLayoutWithWidth = WidthProvider(GridLayout);
|
|
11
|
+
/**
|
|
12
|
+
* Map of items
|
|
13
|
+
*/
|
|
14
|
+
const DashboardLayout = ({ widgetList, widgetDefinitions, onLayoutChange, toggleOpenedConfig, openedConfigs, onSetHeight }) => {
|
|
15
|
+
if (!widgetList?.length) return /* @__PURE__ */ jsx(styles_default.Nowidget, { children: /* @__PURE__ */ jsx(Text, { code: "layout.nowidget" }) });
|
|
16
|
+
return /* @__PURE__ */ jsx(GridLayoutWithWidth, {
|
|
17
|
+
className: "layout",
|
|
18
|
+
rowHeight: 100,
|
|
19
|
+
margin,
|
|
20
|
+
onLayoutChange,
|
|
21
|
+
layout: widgetList.map((widgetItem) => widgetItem.layout),
|
|
22
|
+
draggableHandle: ".drag-handle",
|
|
23
|
+
children: widgetList.map((widgetItem) => {
|
|
24
|
+
const isConfigOpen = openedConfigs.includes(widgetItem.id) || widgetItem.config === null;
|
|
25
|
+
return /* @__PURE__ */ jsx(styles_default.LayoutItem, {
|
|
26
|
+
isConfigOpen,
|
|
27
|
+
children: /* @__PURE__ */ jsx(Item_default, {
|
|
28
|
+
widgetItem,
|
|
29
|
+
widgetDefinitions,
|
|
30
|
+
toggleOpenedConfig,
|
|
31
|
+
isConfigOpen,
|
|
32
|
+
onSetHeight
|
|
33
|
+
})
|
|
34
|
+
}, widgetItem.id);
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { DashboardLayout as default, margin, rowHeight };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { WidgetDefinition } from '../../types';
|
|
3
|
+
type DashboardLayoutContainerProps = {
|
|
4
|
+
widgetDefinitions: WidgetDefinition[];
|
|
5
|
+
};
|
|
6
|
+
declare const LayoutContainer: ({ widgetDefinitions }: DashboardLayoutContainerProps) => JSX.Element;
|
|
7
|
+
export default LayoutContainer;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { actions, selectors } from "../../store/reducers/widgetListReducer.js";
|
|
2
|
+
import DashboardLayout, { margin } from "./Layout.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
6
|
+
//#region packages/ui/Modules/Dashboard/components/Layout/LayoutContainer.tsx
|
|
7
|
+
const LayoutContainer = ({ widgetDefinitions }) => {
|
|
8
|
+
const dispatch = useDispatch();
|
|
9
|
+
const widgetList = useSelector(selectors.getWidgets);
|
|
10
|
+
const handleLayoutChange = React.useCallback((layouts) => {
|
|
11
|
+
dispatch(actions.setWidgetsLayout(layouts));
|
|
12
|
+
}, [dispatch]);
|
|
13
|
+
const [openedConfigs, setOpenedConfigs] = React.useState([]);
|
|
14
|
+
const handleSetHeight = React.useCallback((widgetId, height) => {
|
|
15
|
+
const widgetItem = widgetList?.find((widgetItem) => widgetItem.layout.i === widgetId);
|
|
16
|
+
if (!height || !widgetList || !widgetItem) return;
|
|
17
|
+
const { layout } = widgetItem;
|
|
18
|
+
const optimalH = Math.ceil((height + margin[1]) / (100 + margin[1]));
|
|
19
|
+
const newH = Math.min(Math.max(layout.minH || 0, optimalH), layout.maxH || 100);
|
|
20
|
+
if (layout.h !== newH) dispatch(actions.setWidgetsLayout(widgetList.map((widgetItem) => ({
|
|
21
|
+
...widgetItem.layout,
|
|
22
|
+
...widgetItem.layout.i === widgetId ? {
|
|
23
|
+
...layout,
|
|
24
|
+
h: newH
|
|
25
|
+
} : {}
|
|
26
|
+
}))));
|
|
27
|
+
}, [widgetList, dispatch]);
|
|
28
|
+
return /* @__PURE__ */ jsx(DashboardLayout, {
|
|
29
|
+
widgetDefinitions,
|
|
30
|
+
widgetList,
|
|
31
|
+
onLayoutChange: handleLayoutChange,
|
|
32
|
+
toggleOpenedConfig: React.useCallback((widgetId) => {
|
|
33
|
+
setOpenedConfigs((state) => state.includes(widgetId) ? state.filter((id) => id !== widgetId) : [...state, widgetId]);
|
|
34
|
+
}, [setOpenedConfigs]),
|
|
35
|
+
openedConfigs,
|
|
36
|
+
onSetHeight: handleSetHeight
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { LayoutContainer as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import { WidgetDefinition, WidgetConfig } from '../../../../types';
|
|
3
|
+
type DashboardItemProps = {
|
|
4
|
+
id: string;
|
|
5
|
+
widget: WidgetDefinition;
|
|
6
|
+
newConfig: WidgetConfig;
|
|
7
|
+
config: WidgetConfig;
|
|
8
|
+
onRemove: () => void;
|
|
9
|
+
onSave: () => void;
|
|
10
|
+
onCancel: () => void;
|
|
11
|
+
onSetConfig: (config: WidgetConfig) => void;
|
|
12
|
+
onSetHeight: (id: string, height: number) => void;
|
|
13
|
+
onSaveConfigProps: (props: Record<string, any>) => void;
|
|
14
|
+
isConfigOpen: boolean;
|
|
15
|
+
toggleConfigOpen: () => void;
|
|
16
|
+
};
|
|
17
|
+
declare const DashboardItem: ({ id, widget, newConfig, config, onRemove, onSetConfig, onSetHeight, onSave, onCancel, isConfigOpen, toggleConfigOpen, onSaveConfigProps, }: DashboardItemProps) => JSX.Element;
|
|
18
|
+
export default DashboardItem;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import styles_default from "../../../../styles.js";
|
|
2
|
+
import ComponentContext from "../../../../context/ComponentContext.js";
|
|
3
|
+
import ItemConfig_default from "../ItemConfig/index.js";
|
|
4
|
+
import usePrevious from "../../../../hooks/usePrevious.js";
|
|
5
|
+
import { useRefWithCallback } from "../../../../hooks/useRefWithCallback.js";
|
|
6
|
+
import "../../Layout.js";
|
|
7
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region packages/ui/Modules/Dashboard/components/Layout/components/Item/Item.tsx
|
|
10
|
+
const WidgetsWithFullHeight = ["table", "chart"];
|
|
11
|
+
const DashboardItem = ({ id, widget, newConfig, config, onRemove, onSetConfig, onSetHeight, onSave, onCancel, isConfigOpen, toggleConfigOpen, onSaveConfigProps }) => {
|
|
12
|
+
const { ItemHeader } = React.useContext(ComponentContext);
|
|
13
|
+
const Widget = widget.component;
|
|
14
|
+
const configInDropdown = widget.isWidgetConfigInDropdown || false;
|
|
15
|
+
const widgetRef = useRef(null);
|
|
16
|
+
const headerRef = useRef(null);
|
|
17
|
+
const headerHeight = (headerRef.current?.clientHeight || 0) + 40;
|
|
18
|
+
const wasConfigOpen = usePrevious(isConfigOpen);
|
|
19
|
+
const [isChanged, refCallback, ref] = useRefWithCallback();
|
|
20
|
+
const canChangeHeight = !WidgetsWithFullHeight.includes(widget?.code);
|
|
21
|
+
const [widgetWithPaginationHeight, setWidgetWithPaginationHeight] = useState(null);
|
|
22
|
+
const returnWidgetWithPaginationHeight = useCallback((height) => {
|
|
23
|
+
height && setWidgetWithPaginationHeight(height);
|
|
24
|
+
}, []);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!configInDropdown && wasConfigOpen === false && isConfigOpen) onSetHeight(id, widget.initHeight * 100);
|
|
27
|
+
}, [isConfigOpen]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!configInDropdown && !isConfigOpen && canChangeHeight && wasConfigOpen === true) onSetHeight(id, (ref.current?.clientHeight || 0) + headerHeight);
|
|
30
|
+
}, [isConfigOpen, isChanged]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!canChangeHeight && !isConfigOpen && wasConfigOpen === true) widgetWithPaginationHeight && onSetHeight(id, widgetWithPaginationHeight + headerHeight);
|
|
33
|
+
}, [isConfigOpen, widgetWithPaginationHeight]);
|
|
34
|
+
const ItemConfigJSX = /* @__PURE__ */ jsx(ItemConfig_default, {
|
|
35
|
+
config: newConfig,
|
|
36
|
+
onCancel,
|
|
37
|
+
onRemove,
|
|
38
|
+
onSetConfig,
|
|
39
|
+
onSave,
|
|
40
|
+
component: widget.configComponent
|
|
41
|
+
});
|
|
42
|
+
return /* @__PURE__ */ jsxs(styles_default.ItemWrapper, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(ItemHeader, {
|
|
44
|
+
dragHandleClassName: "drag-handle",
|
|
45
|
+
widget,
|
|
46
|
+
config,
|
|
47
|
+
onSave,
|
|
48
|
+
headerRef,
|
|
49
|
+
onRemove,
|
|
50
|
+
isConfigOpen,
|
|
51
|
+
toggleConfigOpen
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ jsx(styles_default.ItemBodyWrapper, {
|
|
54
|
+
isConfigOpen,
|
|
55
|
+
children: /* @__PURE__ */ jsxs(styles_default.ItemBody, {
|
|
56
|
+
isConfigOpen,
|
|
57
|
+
inDropdown: configInDropdown,
|
|
58
|
+
isFullHeight: !canChangeHeight,
|
|
59
|
+
children: [!configInDropdown && /* @__PURE__ */ jsx(styles_default.WidgetConfig, {
|
|
60
|
+
isConfigOpen,
|
|
61
|
+
inDropdown: configInDropdown,
|
|
62
|
+
children: ItemConfigJSX
|
|
63
|
+
}), /* @__PURE__ */ jsx(styles_default.WidgetVisibility, {
|
|
64
|
+
isVisible: !isConfigOpen,
|
|
65
|
+
children: /* @__PURE__ */ jsx(Widget, {
|
|
66
|
+
config,
|
|
67
|
+
innerRef: canChangeHeight ? refCallback : widgetRef,
|
|
68
|
+
onSaveConfigProps,
|
|
69
|
+
components: widget.components,
|
|
70
|
+
returnWidgetWithPaginationHeight
|
|
71
|
+
})
|
|
72
|
+
})]
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
75
|
+
configInDropdown && isConfigOpen && /* @__PURE__ */ jsx(styles_default.WidgetConfigInDropdown, { children: ItemConfigJSX })
|
|
76
|
+
] });
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { DashboardItem as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { WidgetDefinition, LayoutWidgetItem } from '../../../../types';
|
|
3
|
+
type ItemContainerProps = {
|
|
4
|
+
widgetDefinitions: WidgetDefinition[];
|
|
5
|
+
widgetItem: LayoutWidgetItem;
|
|
6
|
+
toggleOpenedConfig: (id: string) => void;
|
|
7
|
+
isConfigOpen: boolean;
|
|
8
|
+
onSetHeight: (id: string, height: number) => void;
|
|
9
|
+
};
|
|
10
|
+
declare const ItemContainer: ({ widgetItem, widgetDefinitions, toggleOpenedConfig, isConfigOpen, onSetHeight }: ItemContainerProps) => JSX.Element;
|
|
11
|
+
export default ItemContainer;
|