@centreon/ui 23.10.121 → 24.4.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 +64 -45
- package/public/mockServiceWorker.js +2 -2
- package/src/ActionsList/ActionsList.styles.ts +40 -71
- package/src/Button/Icon/index.stories.tsx +1 -1
- package/src/Button/Icon/index.tsx +2 -2
- package/src/Button/Save/StartIcon.tsx +3 -3
- package/src/Button/Save/index.tsx +9 -5
- package/src/Checkbox/Checkbox.tsx +2 -2
- package/src/Checkbox/CheckboxGroup/index.tsx +2 -2
- package/src/Checkbox/fonts/roboto-bold-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-bold-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-bold-webfont.woff2 +0 -0
- package/src/Checkbox/fonts/roboto-light-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-light-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-light-webfont.woff2 +0 -0
- package/src/Checkbox/fonts/roboto-medium-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-medium-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-medium-webfont.woff2 +0 -0
- package/src/Checkbox/fonts/roboto-regular-webfont.ttf +0 -0
- package/src/Checkbox/fonts/roboto-regular-webfont.woff +0 -0
- package/src/Checkbox/fonts/roboto-regular-webfont.woff2 +0 -0
- package/src/Dashboard/Dashboard.styles.ts +6 -5
- package/src/Dashboard/Item.tsx +1 -1
- package/src/Dashboard/Layout.tsx +2 -2
- package/src/Dashboard/utils.ts +1 -1
- package/src/Dialog/Confirm/index.tsx +10 -2
- package/src/Dialog/UnsavedChanges/index.tsx +21 -20
- package/src/Dialog/UnsavedChanges/translatedLabels.ts +4 -6
- package/src/Dialog/index.tsx +9 -2
- package/src/FallbackPage/FallbackPage.tsx +3 -3
- package/src/FileDropZone/index.tsx +3 -1
- package/src/Form/Form.cypress.spec.tsx +133 -0
- package/src/Form/Inputs/Grid.tsx +8 -4
- package/src/Form/Inputs/List/Content.tsx +62 -0
- package/src/Form/Inputs/List/List.styles.ts +29 -0
- package/src/Form/Inputs/List/List.tsx +58 -0
- package/src/Form/Inputs/List/useList.ts +81 -0
- package/src/Form/Inputs/Text.tsx +3 -1
- package/src/Form/Inputs/index.tsx +3 -1
- package/src/Form/Inputs/models.ts +23 -13
- package/src/Graph/BarStack/BarStack.cypress.spec.tsx +217 -0
- package/src/Graph/BarStack/BarStack.stories.tsx +125 -0
- package/src/Graph/BarStack/BarStack.styles.ts +66 -0
- package/src/Graph/BarStack/BarStack.tsx +14 -0
- package/src/Graph/BarStack/Graph.tsx +176 -0
- package/src/Graph/BarStack/GraphAndLegend.tsx +119 -0
- package/src/Graph/BarStack/ResponsiveBarStack.tsx +114 -0
- package/src/Graph/BarStack/constants.ts +5 -0
- package/src/Graph/BarStack/index.ts +1 -0
- package/src/Graph/BarStack/models.ts +19 -0
- package/src/Graph/BarStack/useGraphAndLegend.ts +86 -0
- package/src/Graph/BarStack/useResponsiveBarStack.ts +106 -0
- package/src/Graph/Gauge/Gauge.cypress.spec.tsx +102 -0
- package/src/Graph/Gauge/Gauge.tsx +1 -1
- package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +145 -0
- package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -25
- package/src/Graph/HeatMap/HeatMap.styles.tsx +1 -0
- package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +39 -12
- package/src/Graph/HeatMap/model.ts +6 -1
- package/src/Graph/Legend/Legend.styles.ts +10 -0
- package/src/Graph/Legend/Legend.tsx +26 -0
- package/src/Graph/Legend/index.ts +1 -0
- package/src/Graph/Legend/models.ts +11 -0
- package/src/Graph/LineChart/BasicComponents/Lines/RegularLines/index.tsx +2 -1
- package/src/Graph/LineChart/BasicComponents/Lines/StackedLines/index.tsx +3 -4
- package/src/Graph/LineChart/BasicComponents/Lines/Threshold/Circle.tsx +2 -2
- package/src/Graph/LineChart/BasicComponents/ThresholdLine.tsx +3 -1
- package/src/Graph/LineChart/BasicComponents/Thresholds.tsx +2 -2
- package/src/Graph/LineChart/BasicComponents/useFilterLines.ts +3 -5
- package/src/Graph/LineChart/Header/index.tsx +3 -31
- package/src/Graph/LineChart/Icons/Downtime.tsx +3 -3
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/GuidingLines.tsx +2 -2
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTickGraph.ts +9 -11
- package/src/Graph/LineChart/InteractiveComponents/Annotations/EventAnnotations.tsx +1 -1
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/GraphValueTooltip.tsx +68 -0
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltip.ts +27 -0
- package/src/Graph/LineChart/InteractiveComponents/GraphValueTooltip/useGraphValueTooltipStyles.ts +31 -0
- package/src/Graph/LineChart/InteractiveComponents/ZoomPreview/index.tsx +2 -1
- package/src/Graph/LineChart/InteractiveComponents/index.tsx +132 -17
- package/src/Graph/LineChart/InteractiveComponents/interactionWithGraphAtoms.ts +7 -27
- package/src/Graph/LineChart/Legend/Legend.styles.ts +85 -32
- package/src/Graph/LineChart/Legend/LegendContent.tsx +12 -6
- package/src/Graph/LineChart/Legend/LegendHeader.tsx +66 -27
- package/src/Graph/LineChart/Legend/index.tsx +43 -46
- package/src/Graph/LineChart/Legend/models.ts +5 -0
- package/src/Graph/LineChart/Legend/useLegend.ts +12 -13
- package/src/Graph/LineChart/LineChart.cypress.spec.tsx +144 -0
- package/src/Graph/LineChart/LineChart.styles.ts +8 -0
- package/src/Graph/LineChart/LineChart.tsx +125 -123
- package/src/Graph/LineChart/LoadingSkeleton.tsx +2 -2
- package/src/Graph/LineChart/helpers/doc.ts +16 -13
- package/src/Graph/LineChart/helpers/index.ts +1 -1
- package/src/Graph/LineChart/index.stories.tsx +17 -2
- package/src/Graph/LineChart/index.tsx +6 -7
- package/src/Graph/LineChart/mockedData/curvesWithSameColor.json +252 -0
- package/src/Graph/LineChart/mockedData/lastDayWithIncompleteValues.json +1320 -0
- package/src/Graph/LineChart/mockedData/lastDayWithNullValues.json +1314 -0
- package/src/Graph/LineChart/models.ts +12 -1
- package/src/Graph/LineChart/useLineChartData.ts +68 -18
- package/src/Graph/PieChart/PieChart.cypress.spec.tsx +154 -0
- package/src/Graph/PieChart/PieChart.stories.tsx +194 -0
- package/src/Graph/PieChart/PieChart.styles.ts +39 -0
- package/src/Graph/PieChart/PieChart.tsx +14 -0
- package/src/Graph/PieChart/ResponsivePie.tsx +245 -0
- package/src/Graph/PieChart/index.ts +1 -0
- package/src/Graph/PieChart/models.ts +20 -0
- package/src/Graph/PieChart/useResponsivePie.ts +81 -0
- package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +121 -0
- package/src/Graph/SingleBar/Thresholds.tsx +2 -2
- package/src/Graph/Text/Text.cypress.spec.tsx +101 -0
- package/src/Graph/Text/Text.stories.tsx +60 -4
- package/src/Graph/Text/Text.styles.ts +12 -1
- package/src/Graph/Text/Text.tsx +17 -12
- package/src/Graph/Tree/DescendantNodes.tsx +88 -0
- package/src/Graph/Tree/Links.tsx +64 -0
- package/src/Graph/Tree/StandaloneTree.tsx +32 -0
- package/src/Graph/Tree/Tree.cypress.spec.tsx +171 -0
- package/src/Graph/Tree/Tree.stories.tsx +144 -0
- package/src/Graph/Tree/Tree.tsx +116 -0
- package/src/Graph/Tree/constants.ts +2 -0
- package/src/Graph/Tree/index.ts +4 -0
- package/src/Graph/Tree/models.ts +52 -0
- package/src/Graph/Tree/stories/contents.tsx +164 -0
- package/src/Graph/Tree/stories/datas.ts +305 -0
- package/src/Graph/Tree/utils.ts +49 -0
- package/src/Graph/common/testUtils.ts +71 -0
- package/src/Graph/common/timeSeries/index.ts +53 -15
- package/src/Graph/common/utils.ts +69 -1
- package/src/Graph/index.ts +4 -0
- package/src/Icon/BaseIcon.tsx +32 -0
- package/src/Icon/DowntimeIcon.tsx +14 -0
- package/src/InputField/Number/Number.cypress.spec.tsx +85 -0
- package/src/InputField/Number/Number.stories.tsx +66 -0
- package/src/InputField/Number/Number.tsx +74 -0
- package/src/InputField/Search/index.tsx +2 -2
- package/src/InputField/Select/Autocomplete/Connected/Multi/index.test.tsx +22 -1
- package/src/InputField/Select/Autocomplete/Connected/index.test.tsx +3 -2
- package/src/InputField/Select/Autocomplete/Connected/index.tsx +35 -17
- package/src/InputField/Select/Autocomplete/Draggable/SortableList.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/SortableListContent.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Draggable/index.tsx +1 -1
- package/src/InputField/Select/Autocomplete/Multi/index.stories.tsx +19 -0
- package/src/InputField/Select/Autocomplete/Multi/index.tsx +12 -7
- package/src/InputField/Select/Autocomplete/index.tsx +129 -116
- package/src/InputField/Select/IconPopover/index.tsx +3 -3
- package/src/InputField/Select/index.tsx +15 -2
- package/src/InputField/Text/index.tsx +53 -46
- package/src/Listing/ActionBar/index.tsx +11 -10
- package/src/Listing/Cell/DataCell.styles.ts +3 -0
- package/src/Listing/Cell/DataCell.tsx +23 -5
- package/src/Listing/Header/ListingHeader.tsx +1 -1
- package/src/Listing/Listing.cypress.spec.tsx +218 -33
- package/src/Listing/Listing.styles.ts +4 -7
- package/src/Listing/Row/Row.tsx +7 -3
- package/src/Listing/index.stories.tsx +39 -5
- package/src/Listing/index.test.tsx +1 -1
- package/src/Listing/index.tsx +207 -149
- package/src/Listing/models.ts +1 -0
- package/src/Listing/useStyleTable.ts +1 -0
- package/src/Module/LicensedModule/LicenseCheck/index.tsx +24 -9
- package/src/Module/LicensedModule/index.tsx +7 -1
- package/src/Module/Module.cypress.spec.tsx +129 -0
- package/src/Module/index.tsx +2 -4
- package/src/Panel/index.tsx +1 -1
- package/src/PopoverMenu/index.tsx +9 -8
- package/src/RichTextEditor/ContentEditable.tsx +195 -195
- package/src/RichTextEditor/RichTextEditor.cypress.spec.tsx +100 -52
- package/src/RichTextEditor/RichTextEditor.tsx +21 -4
- package/src/RichTextEditor/plugins/ToolbarPlugin/AlignPicker.tsx +21 -20
- package/src/RichTextEditor/plugins/ToolbarPlugin/BlockButtons.tsx +35 -77
- package/src/RichTextEditor/plugins/ToolbarPlugin/FormatButtons.tsx +29 -83
- package/src/RichTextEditor/plugins/ToolbarPlugin/LinkButton.tsx +106 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/ListButton.tsx +155 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/MacrosButton.tsx +23 -39
- package/src/RichTextEditor/plugins/ToolbarPlugin/ToolbarPlugin.styles.ts +24 -14
- package/src/RichTextEditor/plugins/ToolbarPlugin/UndoRedoButtons.tsx +6 -0
- package/src/RichTextEditor/plugins/ToolbarPlugin/index.tsx +5 -10
- package/src/RichTextEditor/translatedLabels.ts +3 -0
- package/src/SortableItems/index.tsx +2 -7
- package/src/StoryBookThemeProvider/index.tsx +35 -36
- package/src/ThemeProvider/index.tsx +39 -12
- package/src/ThemeProvider/palettes.ts +15 -12
- package/src/TimePeriods/CustomTimePeriod/CompactCustomTimePeriod.styles.ts +6 -7
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/PickersStartEndDate.tsx +10 -6
- package/src/TimePeriods/CustomTimePeriod/PopoverCustomTimePeriod/models.ts +0 -2
- package/src/TimePeriods/DateTimePickerInput.tsx +59 -19
- package/src/TimePeriods/ResolutionTimePeriod.cypress.spec.tsx +12 -9
- package/src/TimePeriods/TimePeriods.cypress.spec.tsx +9 -33
- package/src/TimePeriods/helpers/index.ts +1 -1
- package/src/TimePeriods/index.stories.tsx +12 -4
- package/src/TimePeriods/index.tsx +2 -2
- package/src/TopCounterElements/TopCounterLayout.tsx +3 -0
- package/src/TopCounterElements/useCloseOnLegacyPage.tsx +42 -0
- package/src/Typography/FluidTypography/FluidTypography.cypress.spec.tsx +27 -0
- package/src/Typography/FluidTypography/index.stories.tsx +2 -2
- package/src/Typography/FluidTypography/index.tsx +21 -28
- package/src/Typography/Subtitle.tsx +55 -0
- package/src/api/QueryProvider.tsx +1 -1
- package/src/api/TestQueryProvider.tsx +1 -1
- package/src/api/buildListingEndpoint/getSearchQueryParameterValue.ts +7 -1
- package/src/api/buildListingEndpoint/models.ts +3 -1
- package/src/api/customFetch.ts +12 -3
- package/src/api/index.ts +3 -3
- package/src/api/useFetchQuery/index.ts +49 -28
- package/src/api/useGraphQuery/index.ts +26 -5
- package/src/api/useGraphQuery/models.ts +5 -0
- package/src/api/useMutationQuery/index.test.ts +4 -4
- package/src/api/useMutationQuery/index.ts +65 -20
- package/src/components/Button/Icon/IconButton.tsx +6 -2
- package/src/components/CollapsibleItem/CollapsibleItem.cypress.spec.tsx +76 -0
- package/src/components/CollapsibleItem/CollapsibleItem.stories.tsx +26 -0
- package/src/components/CollapsibleItem/CollapsibleItem.tsx +43 -14
- package/src/components/CollapsibleItem/useCollapsibleItemStyles.ts +24 -1
- package/src/components/DataTable/DataListing.tsx +6 -0
- package/src/components/DataTable/DataTable.cypress.spec.tsx +174 -0
- package/src/components/DataTable/DataTable.stories.tsx +40 -0
- package/src/components/DataTable/DataTable.styles.ts +3 -0
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/DataTable/Item/DataTableItem.styles.ts +7 -2
- package/src/components/DataTable/Item/DataTableItem.tsx +4 -60
- package/src/components/DataTable/index.ts +3 -1
- package/src/components/Form/AccessRights/AccessRights.cypress.spec.tsx +373 -0
- package/src/components/Form/AccessRights/AccessRights.stories.tsx +119 -0
- package/src/components/Form/AccessRights/AccessRights.styles.ts +10 -0
- package/src/components/Form/AccessRights/AccessRights.tsx +60 -0
- package/src/components/Form/AccessRights/Actions/Actions.styles.ts +14 -0
- package/src/components/Form/AccessRights/Actions/Actions.tsx +81 -0
- package/src/components/Form/AccessRights/Actions/useActions.ts +79 -0
- package/src/components/Form/AccessRights/List/Item.tsx +90 -0
- package/src/components/Form/AccessRights/List/List.styles.tsx +45 -0
- package/src/components/Form/AccessRights/List/List.tsx +52 -0
- package/src/components/Form/AccessRights/List/ListItemSkeleton.tsx +18 -0
- package/src/components/Form/AccessRights/List/ListSkeleton.tsx +22 -0
- package/src/components/Form/AccessRights/List/RemoveAccessRight.tsx +38 -0
- package/src/components/Form/AccessRights/List/StateChip.tsx +28 -0
- package/src/components/Form/AccessRights/List/useItem.ts +64 -0
- package/src/components/Form/AccessRights/Provider.tsx +15 -0
- package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +50 -0
- package/src/components/Form/AccessRights/ShareInput/ShareInput.styles.ts +17 -0
- package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +78 -0
- package/src/components/Form/AccessRights/ShareInput/useShareInput.tsx +113 -0
- package/src/components/Form/AccessRights/Stats/Stats.tsx +36 -0
- package/src/components/Form/AccessRights/atoms.ts +97 -0
- package/src/components/Form/AccessRights/common/RoleSelectField.styles.tsx +7 -0
- package/src/components/Form/AccessRights/common/RoleSelectField.tsx +45 -0
- package/src/components/Form/AccessRights/models.ts +55 -0
- package/src/components/Form/AccessRights/storiesData.ts +222 -0
- package/src/components/Form/AccessRights/useAccessRightsInitValues.ts +51 -0
- package/src/components/Form/Dashboard/DashboardDuplicationForm.tsx +85 -0
- package/src/components/Form/Dashboard/DashboardForm.tsx +15 -12
- package/src/components/Form/Dashboard/index.ts +1 -0
- package/src/components/Form/FormActions.tsx +7 -2
- package/src/components/Form/index.ts +2 -1
- package/src/components/ItemComposition/Item.tsx +1 -1
- package/src/components/ItemComposition/ItemComposition.cypress.spec.tsx +113 -0
- package/src/components/ItemComposition/ItemComposition.stories.tsx +14 -0
- package/src/components/ItemComposition/ItemComposition.styles.ts +36 -3
- package/src/components/ItemComposition/ItemComposition.tsx +41 -17
- package/src/components/Layout/PageLayout/PageLayout.tsx +1 -1
- package/src/components/Layout/PageLayout/PageLayoutActions.tsx +1 -0
- package/src/components/Layout/PageLayout/PageLayoutBody.tsx +1 -0
- package/src/components/Layout/PageLayout/PageLayoutHeader.tsx +5 -1
- package/src/components/Layout/PageLayout/PageQuickAccess.tsx +76 -0
- package/src/components/Layout/PageLayout/index.ts +3 -1
- package/src/components/Layout/PageLayout.cypress.spec.tsx +66 -0
- package/src/components/List/Item/ListItem.styles.ts +6 -0
- package/src/components/List/Item/ListItem.tsx +6 -4
- package/src/components/List/Item/Text.tsx +5 -3
- package/src/components/Menu/Button/MenuButton.tsx +4 -2
- package/src/components/Menu/MenuItem.tsx +5 -3
- package/src/components/Menu/MenuItems.tsx +4 -3
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.cypress.spec.tsx +168 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.stories.tsx +62 -0
- package/src/components/Modal/ConfirmationModal/ConfirmationModal.tsx +87 -0
- package/src/components/Modal/Modal.styles.ts +10 -2
- package/src/components/Modal/ModalActions.tsx +4 -2
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.stories.tsx +3 -3
- package/src/components/Tooltip/ConfirmationTooltip/ConfirmationTooltip.tsx +1 -1
- package/src/components/Tooltip/ConfirmationTooltip/models.ts +1 -1
- package/src/components/Zoom/Minimap.tsx +127 -0
- package/src/components/Zoom/Zoom.cypress.spec.tsx +246 -0
- package/src/components/Zoom/Zoom.stories.tsx +115 -0
- package/src/components/Zoom/Zoom.styles.tsx +68 -0
- package/src/components/Zoom/Zoom.tsx +61 -0
- package/src/components/Zoom/ZoomContent.tsx +167 -0
- package/src/components/Zoom/constants.ts +2 -0
- package/src/components/Zoom/localPoint.ts +51 -0
- package/src/components/Zoom/models.ts +25 -0
- package/src/components/Zoom/useMinimap.ts +156 -0
- package/src/components/Zoom/useZoom.ts +70 -0
- package/src/components/Zoom/utils.ts +55 -0
- package/src/components/index.ts +1 -0
- package/src/fonts/roboto-bold-webfont.ttf +0 -0
- package/src/fonts/roboto-bold-webfont.woff +0 -0
- package/src/fonts/roboto-bold-webfont.woff2 +0 -0
- package/src/fonts/roboto-light-webfont.ttf +0 -0
- package/src/fonts/roboto-light-webfont.woff +0 -0
- package/src/fonts/roboto-light-webfont.woff2 +0 -0
- package/src/fonts/roboto-medium-webfont.ttf +0 -0
- package/src/fonts/roboto-medium-webfont.woff +0 -0
- package/src/fonts/roboto-medium-webfont.woff2 +0 -0
- package/src/fonts/roboto-regular-webfont.ttf +0 -0
- package/src/fonts/roboto-regular-webfont.woff +0 -0
- package/src/fonts/roboto-regular-webfont.woff2 +0 -0
- package/src/index.ts +6 -0
- package/src/queryParameters/url/index.ts +5 -1
- package/src/utils/index.ts +25 -22
- package/src/utils/useFullscreen/Fullscreen.cypress.spec.tsx +133 -0
- package/src/utils/useFullscreen/atoms.ts +3 -0
- package/src/utils/useFullscreen/index.ts +2 -0
- package/src/utils/useFullscreen/translatedLabels.ts +1 -0
- package/src/utils/useFullscreen/useFullscreen.ts +73 -0
- package/src/utils/useFullscreen/useFullscreenListener.ts +62 -0
- package/src/utils/useInfiniteScrollListing.ts +31 -8
- package/src/utils/{useLicenseExpirationWarning.cypress.spec.tsx → useLicenseExpirationWarning.test.tsx} +48 -37
- package/src/utils/useLicenseExpirationWarning.ts +18 -18
- package/src/utils/useLocale/index.ts +10 -0
- package/src/utils/useLocale/useLocale.cypress.spec.tsx +40 -0
- package/src/utils/useLocaleDateTimeFormat/index.ts +8 -2
- package/src/utils/usePluralizedTranslation.ts +21 -0
- package/src/@assets/icons/downtime.icon.svg +0 -1
- package/src/Graph/LineChart/BasicComponents/LoadingProgress.tsx +0 -46
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/TooltipAnchorPoint.tsx +0 -96
- package/src/Graph/LineChart/InteractiveComponents/AnchorPoint/useTooltipAnchorPoint.ts +0 -107
- package/src/Graph/LineChart/Legend/InteractiveValue.tsx +0 -22
- package/src/Graph/LineChart/Legend/Marker.tsx +0 -43
- package/src/Graph/LineChart/Legend/useInteractiveValues.ts +0 -99
- package/src/Typography/FluidTypography/useFluidResizeObserver.ts +0 -56
- package/src/components/Form/AccessRights/AccessRights.resource.ts +0 -45
- package/src/components/Form/AccessRights/AccessRightsForm.stories.tsx +0 -59
- package/src/components/Form/AccessRights/AccessRightsForm.styles.ts +0 -21
- package/src/components/Form/AccessRights/AccessRightsForm.tsx +0 -67
- package/src/components/Form/AccessRights/AccessRightsFormActions.tsx +0 -80
- package/src/components/Form/AccessRights/Input/AddAction.tsx +0 -31
- package/src/components/Form/AccessRights/Input/ContactAccessRightInput.stories.tsx +0 -54
- package/src/components/Form/AccessRights/Input/ContactAccessRightInput.tsx +0 -72
- package/src/components/Form/AccessRights/Input/ContactAccessRightsInput.styles.ts +0 -22
- package/src/components/Form/AccessRights/Input/ContactInputField.tsx +0 -105
- package/src/components/Form/AccessRights/Input/RoleInputField.tsx +0 -29
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.stories.tsx +0 -97
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.styles.ts +0 -71
- package/src/components/Form/AccessRights/List/ContactAccessRightsList.tsx +0 -51
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.stories.tsx +0 -116
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItem.tsx +0 -118
- package/src/components/Form/AccessRights/List/ContactAccessRightsListItemSkeleton.tsx +0 -26
- package/src/components/Form/AccessRights/List/ContactAccessRightsListSkeleton.tsx +0 -28
- package/src/components/Form/AccessRights/Stats/AccessRightsStats.styles.ts +0 -18
- package/src/components/Form/AccessRights/Stats/AccessRightsStats.tsx +0 -41
- package/src/components/Form/AccessRights/__fixtures__/contactAccessRight.mock.ts +0 -52
- package/src/components/Form/AccessRights/common/GroupLabel.styles.ts +0 -18
- package/src/components/Form/AccessRights/common/GroupLabel.tsx +0 -15
- package/src/components/Form/AccessRights/common/Input.styles.ts +0 -48
- package/src/components/Form/AccessRights/common/RoleInputSelect.styles.ts +0 -11
- package/src/components/Form/AccessRights/common/RoleInputSelect.tsx +0 -57
- package/src/components/Form/AccessRights/index.ts +0 -3
- package/src/components/Form/AccessRights/useAccessRightsForm.test.tsx +0 -531
- package/src/components/Form/AccessRights/useAccessRightsForm.tsx +0 -282
- package/src/components/Form/AccessRights/useAccessRightsForm.utils.ts +0 -41
- package/src/screens/dashboard/DashboardsDetail.stories.tsx +0 -108
- package/src/screens/dashboard/DashboardsOverview.stories.tsx +0 -281
- package/src/utils/useDateTimePickerAdapter.ts +0 -309
- /package/{public → src/Button}/fonts/roboto-bold-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-bold-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-bold-webfont.woff2 +0 -0
- /package/{public → src/Button}/fonts/roboto-light-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-light-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-light-webfont.woff2 +0 -0
- /package/{public → src/Button}/fonts/roboto-medium-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-medium-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-medium-webfont.woff2 +0 -0
- /package/{public → src/Button}/fonts/roboto-regular-webfont.ttf +0 -0
- /package/{public → src/Button}/fonts/roboto-regular-webfont.woff +0 -0
- /package/{public → src/Button}/fonts/roboto-regular-webfont.woff2 +0 -0
|
@@ -32,7 +32,9 @@ import useFetchQuery from '../../../../api/useFetchQuery';
|
|
|
32
32
|
|
|
33
33
|
export interface ConnectedAutoCompleteFieldProps<TData> {
|
|
34
34
|
allowUniqOption?: boolean;
|
|
35
|
-
|
|
35
|
+
baseEndpoint?: string;
|
|
36
|
+
changeIdValue: (item: TData) => number | string;
|
|
37
|
+
exclusionOptionProperty?: keyof SelectEntry;
|
|
36
38
|
field: string;
|
|
37
39
|
getEndpoint: ({ search, page }) => string;
|
|
38
40
|
getRenderedOptionText: (option: TData) => string;
|
|
@@ -53,13 +55,15 @@ const ConnectedAutocompleteField = (
|
|
|
53
55
|
field,
|
|
54
56
|
labelKey,
|
|
55
57
|
open,
|
|
56
|
-
|
|
58
|
+
exclusionOptionProperty = 'id',
|
|
57
59
|
searchConditions = [],
|
|
58
60
|
getRenderedOptionText = (option): string => option.name?.toString(),
|
|
59
61
|
getRequestHeaders,
|
|
60
62
|
displayOptionThumbnail,
|
|
61
63
|
queryKey,
|
|
62
64
|
allowUniqOption,
|
|
65
|
+
baseEndpoint,
|
|
66
|
+
changeIdValue,
|
|
63
67
|
...props
|
|
64
68
|
}: ConnectedAutoCompleteFieldProps<TData> &
|
|
65
69
|
Omit<AutocompleteFieldProps, 'options'>): JSX.Element => {
|
|
@@ -87,6 +91,7 @@ const ConnectedAutocompleteField = (
|
|
|
87
91
|
const { fetchQuery, isFetching, prefetchNextPage } = useFetchQuery<
|
|
88
92
|
ListingModel<TData>
|
|
89
93
|
>({
|
|
94
|
+
baseEndpoint,
|
|
90
95
|
fetchHeaders: getRequestHeaders,
|
|
91
96
|
getEndpoint: (params) => {
|
|
92
97
|
return getEndpoint({
|
|
@@ -101,8 +106,8 @@ const ConnectedAutocompleteField = (
|
|
|
101
106
|
],
|
|
102
107
|
isPaginated: true,
|
|
103
108
|
queryOptions: {
|
|
104
|
-
cacheTime: 0,
|
|
105
109
|
enabled: false,
|
|
110
|
+
gcTime: 0,
|
|
106
111
|
staleTime: 0,
|
|
107
112
|
suspense: false
|
|
108
113
|
}
|
|
@@ -129,10 +134,11 @@ const ConnectedAutocompleteField = (
|
|
|
129
134
|
: [selectedValue];
|
|
130
135
|
|
|
131
136
|
return {
|
|
132
|
-
field
|
|
137
|
+
field,
|
|
138
|
+
operator: '$and',
|
|
133
139
|
values: {
|
|
134
140
|
$ni: map(
|
|
135
|
-
prop(
|
|
141
|
+
prop(exclusionOptionProperty),
|
|
136
142
|
selectedValues as Array<
|
|
137
143
|
Record<keyof SelectEntry, string | undefined>
|
|
138
144
|
>
|
|
@@ -150,6 +156,7 @@ const ConnectedAutocompleteField = (
|
|
|
150
156
|
|
|
151
157
|
return {
|
|
152
158
|
field,
|
|
159
|
+
operator: '$and',
|
|
153
160
|
values: {
|
|
154
161
|
$lk: `%${searchedValue}%`
|
|
155
162
|
}
|
|
@@ -235,17 +242,24 @@ const ConnectedAutocompleteField = (
|
|
|
235
242
|
|
|
236
243
|
const moreOptions = page > 1 ? options : [];
|
|
237
244
|
|
|
245
|
+
const formattedList = changeIdValue
|
|
246
|
+
? newOptions.result.map((item) => ({
|
|
247
|
+
...item,
|
|
248
|
+
id: changeIdValue(item)
|
|
249
|
+
}))
|
|
250
|
+
: newOptions.result;
|
|
251
|
+
|
|
238
252
|
if (!isEmpty(labelKey) && !isNil(labelKey)) {
|
|
239
|
-
const list =
|
|
253
|
+
const list = formattedList.map((item) =>
|
|
240
254
|
renameKey({ key: labelKey, newKey: 'name', object: item })
|
|
241
255
|
);
|
|
242
256
|
setOptions(moreOptions.concat(list as Array<TData>));
|
|
243
257
|
|
|
244
258
|
return;
|
|
245
259
|
}
|
|
246
|
-
setOptions(moreOptions.concat(
|
|
260
|
+
setOptions(moreOptions.concat(formattedList));
|
|
247
261
|
|
|
248
|
-
setOptions(moreOptions.concat(
|
|
262
|
+
setOptions(moreOptions.concat(formattedList as Array<TData>));
|
|
249
263
|
|
|
250
264
|
const total = prop('total', newOptions.meta) || 1;
|
|
251
265
|
const limit = prop('limit', newOptions.meta) || 1;
|
|
@@ -280,13 +294,16 @@ const ConnectedAutocompleteField = (
|
|
|
280
294
|
}
|
|
281
295
|
}, [optionsOpen]);
|
|
282
296
|
|
|
283
|
-
useEffect(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
297
|
+
useEffect(
|
|
298
|
+
() => {
|
|
299
|
+
setSearchParameter(
|
|
300
|
+
!isEmpty(searchConditions)
|
|
301
|
+
? { conditions: searchConditions }
|
|
302
|
+
: undefined
|
|
303
|
+
);
|
|
304
|
+
},
|
|
305
|
+
useDeepCompare([searchConditions])
|
|
306
|
+
);
|
|
290
307
|
|
|
291
308
|
useEffect(() => {
|
|
292
309
|
if (!autocompleteChangedValue && !props?.value) {
|
|
@@ -307,12 +324,13 @@ const ConnectedAutocompleteField = (
|
|
|
307
324
|
<AutocompleteField
|
|
308
325
|
filterOptions={(opt): SelectEntry => opt}
|
|
309
326
|
loading={isFetching}
|
|
310
|
-
open={optionsOpen}
|
|
311
327
|
options={
|
|
312
328
|
allowUniqOption ? uniqBy(getRenderedOptionText, options) : options
|
|
313
329
|
}
|
|
314
330
|
renderOption={renderOptions}
|
|
315
|
-
onChange={(_, value) =>
|
|
331
|
+
onChange={(_, value) => {
|
|
332
|
+
setAutocompleteChangedValue(value);
|
|
333
|
+
}}
|
|
316
334
|
onClose={(): void => setOptionsOpen(false)}
|
|
317
335
|
onOpen={(): void => setOptionsOpen(true)}
|
|
318
336
|
onTextChange={changeText}
|
|
@@ -49,7 +49,7 @@ const SortableListContent = ({
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const itemIndex = findIndex(propEq(
|
|
52
|
+
const itemIndex = findIndex(propEq(id, 'id'), items);
|
|
53
53
|
|
|
54
54
|
itemHover?.(null);
|
|
55
55
|
itemClick?.({ index: itemIndex, item: { createOption, id, name } });
|
|
@@ -77,7 +77,7 @@ const DraggableAutocomplete = (
|
|
|
77
77
|
const deleteValue = (id): void => {
|
|
78
78
|
itemHover?.(null);
|
|
79
79
|
setSelectedValues((values: Array<DraggableSelectEntry>) => {
|
|
80
|
-
const index = findIndex(propEq(
|
|
80
|
+
const index = findIndex(propEq(id, 'id'), values);
|
|
81
81
|
|
|
82
82
|
const newSelectedValues = remove(index, 1, values);
|
|
83
83
|
|
|
@@ -58,3 +58,22 @@ export const popoverWithoutInput = (): JSX.Element => {
|
|
|
58
58
|
/>
|
|
59
59
|
);
|
|
60
60
|
};
|
|
61
|
+
|
|
62
|
+
export const customRenderedTags = (): JSX.Element => {
|
|
63
|
+
const customRender = (tags: React.ReactNode): React.ReactNode => (
|
|
64
|
+
<div style={{ display: 'flex' }}>
|
|
65
|
+
{tags}
|
|
66
|
+
<span style={{ color: '#999' }}>Custom wrapper</span>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<MultiAutocompleteField
|
|
72
|
+
customRenderTags={customRender}
|
|
73
|
+
label="Custom Tags Render"
|
|
74
|
+
options={options}
|
|
75
|
+
placeholder="Type here..."
|
|
76
|
+
value={[options[0], options[1]]}
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { includes, map, prop, reject } from 'ramda';
|
|
1
|
+
import { includes, map, prop, reject, sortBy, toLower, compose } from 'ramda';
|
|
2
2
|
import { makeStyles } from 'tss-react/mui';
|
|
3
3
|
|
|
4
4
|
import { Chip, ChipProps, Tooltip } from '@mui/material';
|
|
@@ -9,10 +9,6 @@ import { SelectEntry } from '../..';
|
|
|
9
9
|
import Option from '../../Option';
|
|
10
10
|
|
|
11
11
|
const useStyles = makeStyles()((theme) => ({
|
|
12
|
-
checkbox: {
|
|
13
|
-
marginRight: theme.spacing(1),
|
|
14
|
-
padding: 0
|
|
15
|
-
},
|
|
16
12
|
deleteIcon: {
|
|
17
13
|
height: theme.spacing(1.5),
|
|
18
14
|
width: theme.spacing(1.5)
|
|
@@ -33,6 +29,7 @@ export interface Props
|
|
|
33
29
|
'multiple'
|
|
34
30
|
> {
|
|
35
31
|
chipProps?: ChipProps;
|
|
32
|
+
customRenderTags?: (tags: React.ReactNode) => React.ReactNode;
|
|
36
33
|
disableSortedOptions?: boolean;
|
|
37
34
|
getOptionTooltipLabel?: (option) => string;
|
|
38
35
|
getTagLabel?: (option) => string;
|
|
@@ -48,6 +45,7 @@ const MultiAutocompleteField = ({
|
|
|
48
45
|
getTagLabel = (option): string => option[optionProperty],
|
|
49
46
|
getOptionTooltipLabel,
|
|
50
47
|
chipProps,
|
|
48
|
+
customRenderTags,
|
|
51
49
|
...props
|
|
52
50
|
}: Props): JSX.Element => {
|
|
53
51
|
const { classes } = useStyles();
|
|
@@ -65,6 +63,7 @@ const MultiAutocompleteField = ({
|
|
|
65
63
|
deleteIcon: classes.deleteIcon,
|
|
66
64
|
root: classes.tag
|
|
67
65
|
}}
|
|
66
|
+
data-testid={`tag-option-chip-${option.id}`}
|
|
68
67
|
label={getTagLabel(option)}
|
|
69
68
|
size="medium"
|
|
70
69
|
{...getTagProps({ index })}
|
|
@@ -85,9 +84,11 @@ const MultiAutocompleteField = ({
|
|
|
85
84
|
return includes(id, valueIds);
|
|
86
85
|
};
|
|
87
86
|
|
|
87
|
+
const sortByName = sortBy(compose(toLower, prop(optionProperty)));
|
|
88
|
+
|
|
88
89
|
const autocompleteOptions = disableSortedOptions
|
|
89
90
|
? options
|
|
90
|
-
: [...values, ...reject(isOptionSelected, options)];
|
|
91
|
+
: sortByName([...values, ...reject(isOptionSelected, options)]);
|
|
91
92
|
|
|
92
93
|
return (
|
|
93
94
|
<Autocomplete
|
|
@@ -104,7 +105,11 @@ const MultiAutocompleteField = ({
|
|
|
104
105
|
<Option checkboxSelected={selected}>{getOptionLabel(option)}</Option>
|
|
105
106
|
</li>
|
|
106
107
|
)}
|
|
107
|
-
renderTags={
|
|
108
|
+
renderTags={(renderedValue, getTagProps): React.ReactNode =>
|
|
109
|
+
customRenderTags
|
|
110
|
+
? customRenderTags(renderTags(renderedValue, getTagProps))
|
|
111
|
+
: renderTags(renderedValue, getTagProps)
|
|
112
|
+
}
|
|
108
113
|
value={value}
|
|
109
114
|
{...props}
|
|
110
115
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import { equals, isNil, pick } from 'ramda';
|
|
3
|
+
import { equals, isEmpty, isNil, pick } from 'ramda';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { makeStyles } from 'tss-react/mui';
|
|
6
6
|
|
|
@@ -141,126 +141,139 @@ type Multiple = boolean;
|
|
|
141
141
|
type DisableClearable = boolean;
|
|
142
142
|
type FreeSolo = boolean;
|
|
143
143
|
|
|
144
|
-
const AutocompleteField = (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
144
|
+
const AutocompleteField = React.forwardRef(
|
|
145
|
+
(
|
|
146
|
+
{
|
|
147
|
+
options,
|
|
148
|
+
label,
|
|
149
|
+
placeholder,
|
|
150
|
+
loading = false,
|
|
151
|
+
onTextChange = (): void => undefined,
|
|
152
|
+
endAdornment = undefined,
|
|
153
|
+
inputValue,
|
|
154
|
+
displayOptionThumbnail = false,
|
|
155
|
+
required = false,
|
|
156
|
+
error,
|
|
157
|
+
displayPopupIcon = true,
|
|
158
|
+
autoFocus = false,
|
|
159
|
+
hideInput = false,
|
|
160
|
+
dataTestId,
|
|
161
|
+
autoSize = false,
|
|
162
|
+
autoSizeDefaultWidth = 0,
|
|
163
|
+
autoSizeCustomPadding,
|
|
164
|
+
getOptionItemLabel = (option) => option.name,
|
|
165
|
+
...autocompleteProps
|
|
166
|
+
}: Props,
|
|
167
|
+
ref?: React.ForwardedRef<HTMLDivElement>
|
|
168
|
+
): JSX.Element => {
|
|
169
|
+
const { classes, cx } = useStyles({ hideInput });
|
|
170
|
+
const { t } = useTranslation();
|
|
171
|
+
const theme = useTheme();
|
|
168
172
|
|
|
169
|
-
|
|
170
|
-
|
|
173
|
+
const areSelectEntriesEqual = (option, value): boolean => {
|
|
174
|
+
const identifyingProps = ['id', 'name'];
|
|
171
175
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
176
|
+
return equals(
|
|
177
|
+
pick(identifyingProps, option),
|
|
178
|
+
pick(identifyingProps, value)
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const renderInput = (params): JSX.Element => (
|
|
183
|
+
<TextField
|
|
184
|
+
{...params}
|
|
185
|
+
InputLabelProps={{
|
|
186
|
+
classes: {
|
|
187
|
+
marginDense: classes.inputLabel,
|
|
188
|
+
shrink: classes.inputLabelShrink
|
|
189
|
+
}
|
|
190
|
+
}}
|
|
191
|
+
InputProps={{
|
|
192
|
+
...params.InputProps,
|
|
193
|
+
endAdornment: (
|
|
194
|
+
<>
|
|
195
|
+
{endAdornment && (
|
|
196
|
+
<InputAdornment position="end">{endAdornment}</InputAdornment>
|
|
197
|
+
)}
|
|
198
|
+
{params.InputProps.endAdornment}
|
|
199
|
+
</>
|
|
200
|
+
),
|
|
201
|
+
style: {
|
|
202
|
+
background: 'transparent',
|
|
203
|
+
minWidth: 0,
|
|
204
|
+
padding: theme.spacing(
|
|
205
|
+
0.75,
|
|
206
|
+
isEmpty(placeholder) ? 0 : 5,
|
|
207
|
+
0.75,
|
|
208
|
+
0.75
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
}}
|
|
212
|
+
autoFocus={autoFocus}
|
|
213
|
+
autoSize={autoSize}
|
|
214
|
+
autoSizeCustomPadding={7 + (autoSizeCustomPadding || 0)}
|
|
215
|
+
autoSizeDefaultWidth={autoSizeDefaultWidth}
|
|
216
|
+
classes={{
|
|
217
|
+
root: classes.textfield
|
|
218
|
+
}}
|
|
219
|
+
error={error}
|
|
220
|
+
externalValueForAutoSize={autocompleteProps?.value?.name}
|
|
221
|
+
inputProps={{
|
|
222
|
+
...params.inputProps,
|
|
223
|
+
'aria-label': label,
|
|
224
|
+
'data-testid': dataTestId || label,
|
|
225
|
+
id: getNormalizedId(label || ''),
|
|
226
|
+
...autocompleteProps?.inputProps
|
|
227
|
+
}}
|
|
228
|
+
label={label}
|
|
229
|
+
placeholder={isNil(placeholder) ? t(searchLabel) : placeholder}
|
|
230
|
+
required={required}
|
|
231
|
+
value={inputValue || undefined}
|
|
232
|
+
onChange={onTextChange}
|
|
233
|
+
/>
|
|
175
234
|
);
|
|
176
|
-
};
|
|
177
235
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)}
|
|
194
|
-
{params.InputProps.endAdornment}
|
|
195
|
-
</>
|
|
196
|
-
),
|
|
197
|
-
style: {
|
|
198
|
-
background: 'transparent',
|
|
199
|
-
paddingRight: theme.spacing(5)
|
|
236
|
+
return (
|
|
237
|
+
<Autocomplete
|
|
238
|
+
disableClearable
|
|
239
|
+
classes={{
|
|
240
|
+
groupLabel: classes.inputLabel,
|
|
241
|
+
inputRoot: cx([
|
|
242
|
+
classes.input,
|
|
243
|
+
label ? classes.inputWithLabel : classes.inputWithoutLabel
|
|
244
|
+
]),
|
|
245
|
+
popper: classes.popper,
|
|
246
|
+
root: classes.textfield
|
|
247
|
+
}}
|
|
248
|
+
forcePopupIcon={displayPopupIcon}
|
|
249
|
+
getOptionLabel={(option): string =>
|
|
250
|
+
(option as SelectEntry)?.name?.toString() || ''
|
|
200
251
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
...params.inputProps,
|
|
213
|
-
'aria-label': label,
|
|
214
|
-
'data-testid': dataTestId || label,
|
|
215
|
-
id: getNormalizedId(label || '')
|
|
216
|
-
}}
|
|
217
|
-
label={label}
|
|
218
|
-
placeholder={isNil(placeholder) ? t(searchLabel) : placeholder}
|
|
219
|
-
required={required}
|
|
220
|
-
value={inputValue || undefined}
|
|
221
|
-
onChange={onTextChange}
|
|
222
|
-
/>
|
|
223
|
-
);
|
|
224
|
-
|
|
225
|
-
return (
|
|
226
|
-
<Autocomplete
|
|
227
|
-
disableClearable
|
|
228
|
-
classes={{
|
|
229
|
-
groupLabel: classes.inputLabel,
|
|
230
|
-
inputRoot: cx([
|
|
231
|
-
classes.input,
|
|
232
|
-
label ? classes.inputWithLabel : classes.inputWithoutLabel
|
|
233
|
-
]),
|
|
234
|
-
popper: classes.popper,
|
|
235
|
-
root: classes.textfield
|
|
236
|
-
}}
|
|
237
|
-
forcePopupIcon={displayPopupIcon}
|
|
238
|
-
getOptionLabel={(option): string =>
|
|
239
|
-
(option as SelectEntry)?.name?.toString() || ''
|
|
240
|
-
}
|
|
241
|
-
isOptionEqualToValue={areSelectEntriesEqual}
|
|
242
|
-
loading={loading}
|
|
243
|
-
loadingText={<LoadingIndicator />}
|
|
244
|
-
options={options}
|
|
245
|
-
renderInput={renderInput}
|
|
246
|
-
renderOption={(props, option): JSX.Element => {
|
|
247
|
-
return (
|
|
248
|
-
<li
|
|
249
|
-
className={classes.options}
|
|
250
|
-
{...(props as React.HTMLAttributes<HTMLLIElement>)}
|
|
251
|
-
>
|
|
252
|
-
<Option
|
|
253
|
-
thumbnailUrl={displayOptionThumbnail ? option.url : undefined}
|
|
252
|
+
isOptionEqualToValue={areSelectEntriesEqual}
|
|
253
|
+
loading={loading}
|
|
254
|
+
loadingText={<LoadingIndicator />}
|
|
255
|
+
options={options}
|
|
256
|
+
ref={ref}
|
|
257
|
+
renderInput={renderInput}
|
|
258
|
+
renderOption={(props, option): JSX.Element => {
|
|
259
|
+
return (
|
|
260
|
+
<li
|
|
261
|
+
className={classes.options}
|
|
262
|
+
{...(props as React.HTMLAttributes<HTMLLIElement>)}
|
|
254
263
|
>
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
264
|
+
<Option
|
|
265
|
+
thumbnailUrl={displayOptionThumbnail ? option.url : undefined}
|
|
266
|
+
>
|
|
267
|
+
{getOptionItemLabel(option)}
|
|
268
|
+
</Option>
|
|
269
|
+
</li>
|
|
270
|
+
);
|
|
271
|
+
}}
|
|
272
|
+
size="small"
|
|
273
|
+
{...autocompleteProps}
|
|
274
|
+
/>
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
);
|
|
265
278
|
|
|
266
279
|
export default AutocompleteField;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from '@mui/material';
|
|
16
16
|
import IconReset from '@mui/icons-material/RotateLeft';
|
|
17
17
|
|
|
18
|
-
import IconButton from '
|
|
18
|
+
import { IconButton } from '../../..';
|
|
19
19
|
import Option from '../Option';
|
|
20
20
|
import { SelectEntry } from '..';
|
|
21
21
|
|
|
@@ -73,14 +73,14 @@ const IconPopoverMultiAutocomplete = ({
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
const isSelected = (id: number | string): boolean => {
|
|
76
|
-
return pipe(find(propEq(
|
|
76
|
+
return pipe(find(propEq(id, 'id')), Boolean)(value);
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
const unSelect = (option: SelectEntry): void => {
|
|
80
80
|
const { id } = option;
|
|
81
81
|
|
|
82
82
|
const updatedValue = isSelected(id)
|
|
83
|
-
? reject(propEq(
|
|
83
|
+
? reject(propEq(id, 'id'), value)
|
|
84
84
|
: [...value, option];
|
|
85
85
|
|
|
86
86
|
onChange(updatedValue);
|
|
@@ -27,6 +27,14 @@ const useStyles = makeStyles()((theme: Theme) => ({
|
|
|
27
27
|
},
|
|
28
28
|
noLabelInput: {
|
|
29
29
|
padding: theme.spacing(1)
|
|
30
|
+
},
|
|
31
|
+
select: {
|
|
32
|
+
'& .MuiInputLabel-shrink~.MuiInputBase-root fieldset legend': {
|
|
33
|
+
maxWidth: '100%'
|
|
34
|
+
},
|
|
35
|
+
'& fieldset legend': {
|
|
36
|
+
maxWidth: 0
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
39
|
}));
|
|
32
40
|
|
|
@@ -69,7 +77,7 @@ const SelectField = ({
|
|
|
69
77
|
const { classes, cx } = useStyles();
|
|
70
78
|
|
|
71
79
|
const getOption = (id): SelectEntry => {
|
|
72
|
-
return options.find(propEq(
|
|
80
|
+
return options.find(propEq(id, 'id')) as SelectEntry;
|
|
73
81
|
};
|
|
74
82
|
|
|
75
83
|
const changeOption = (event): void => {
|
|
@@ -79,7 +87,12 @@ const SelectField = ({
|
|
|
79
87
|
};
|
|
80
88
|
|
|
81
89
|
return (
|
|
82
|
-
<FormControl
|
|
90
|
+
<FormControl
|
|
91
|
+
className={classes.select}
|
|
92
|
+
error={!isNil(error)}
|
|
93
|
+
fullWidth={fullWidth}
|
|
94
|
+
size="small"
|
|
95
|
+
>
|
|
83
96
|
{label && <InputLabel>{label}</InputLabel>}
|
|
84
97
|
<Select
|
|
85
98
|
displayEmpty
|