@rio-cloud/uikit-mcp 1.0.0 → 1.1.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/README.md +75 -40
- package/dist/doc-metadata.json +1872 -0
- package/dist/docs/components/accentBar.md +582 -0
- package/dist/docs/components/activity.md +330 -0
- package/dist/docs/components/animatedNumber.md +88 -0
- package/dist/docs/components/animatedTextReveal.md +381 -0
- package/dist/docs/components/animations.md +459 -0
- package/dist/docs/components/appHeader.md +737 -0
- package/dist/docs/components/appLayout.md +2016 -0
- package/dist/docs/components/appNavigationBar.md +274 -0
- package/dist/docs/components/areaCharts.md +828 -0
- package/dist/docs/components/aspectRatioPlaceholder.md +106 -0
- package/dist/docs/components/assetTree.md +3223 -0
- package/dist/docs/components/autosuggests.md +1177 -0
- package/dist/docs/components/avatar.md +206 -0
- package/dist/docs/components/banner.md +668 -0
- package/dist/docs/components/barCharts.md +2785 -0
- package/dist/docs/components/barList.md +517 -0
- package/dist/docs/components/basicMap.md +167 -0
- package/dist/docs/components/bottomSheet.md +721 -0
- package/dist/docs/components/button.md +775 -0
- package/dist/docs/components/buttonToolbar.md +134 -0
- package/dist/docs/components/calendarStripe.md +525 -0
- package/dist/docs/components/card.md +86 -0
- package/dist/docs/components/carousel.md +128 -0
- package/dist/docs/components/chartColors.md +716 -0
- package/dist/docs/components/chartsGettingStarted.md +28 -0
- package/dist/docs/components/chat.md +932 -0
- package/dist/docs/components/checkbox.md +996 -0
- package/dist/docs/components/clearableInput.md +806 -0
- package/dist/docs/components/collapse.md +189 -0
- package/dist/docs/components/composedCharts.md +424 -0
- package/dist/docs/components/contentLoader.md +674 -0
- package/dist/docs/components/dataTabs.md +1251 -0
- package/dist/docs/components/datepickers.md +2543 -0
- package/dist/docs/components/dialogs.md +2244 -0
- package/dist/docs/components/divider.md +219 -0
- package/dist/docs/components/dropdowns.md +17550 -0
- package/dist/docs/components/editableContent.md +1127 -0
- package/dist/docs/components/expander.md +970 -0
- package/dist/docs/components/fade.md +836 -0
- package/dist/docs/components/fadeExpander.md +180 -0
- package/dist/docs/components/fadeUp.md +396 -0
- package/dist/docs/components/feedback.md +758 -0
- package/dist/docs/components/filePickers.md +370 -0
- package/dist/docs/components/formLabel.md +251 -0
- package/dist/docs/components/fullscreenMap.md +10 -0
- package/dist/docs/components/groupedItemList.md +1001 -0
- package/dist/docs/components/iconList.md +306 -0
- package/dist/docs/components/imagePreloader.md +167 -0
- package/dist/docs/components/labeledElement.md +115 -0
- package/dist/docs/components/licensePlate.md +412 -0
- package/dist/docs/components/lineCharts.md +2014 -0
- package/dist/docs/components/listMenu.md +392 -0
- package/dist/docs/components/loadMore.md +219 -0
- package/dist/docs/components/mainNavigation.md +129 -0
- package/dist/docs/components/mapCircle.md +93 -0
- package/dist/docs/components/mapCluster.md +337 -0
- package/dist/docs/components/mapContext.md +284 -0
- package/dist/docs/components/mapDraggableMarker.md +150 -0
- package/dist/docs/components/mapGettingStarted.md +39 -0
- package/dist/docs/components/mapInfoBubble.md +135 -0
- package/dist/docs/components/mapLayerGroup.md +94 -0
- package/dist/docs/components/mapMarker.md +1814 -0
- package/dist/docs/components/mapPolygon.md +959 -0
- package/dist/docs/components/mapRoute.md +3816 -0
- package/dist/docs/components/mapRouteGenerator.md +6 -0
- package/dist/docs/components/mapSettings.md +1040 -0
- package/dist/docs/components/mapUtils.md +132 -0
- package/dist/docs/components/multiselects.md +1921 -0
- package/dist/docs/components/noData.md +210 -0
- package/dist/docs/components/notifications.md +314 -0
- package/dist/docs/components/numbercontrol.md +706 -0
- package/dist/docs/components/onboarding.md +297 -0
- package/dist/docs/components/page.md +241 -0
- package/dist/docs/components/pager.md +133 -0
- package/dist/docs/components/pieCharts.md +1284 -0
- package/dist/docs/components/popover.md +222 -0
- package/dist/docs/components/position.md +50 -0
- package/dist/docs/components/radialBarCharts.md +3663 -0
- package/dist/docs/components/radiobutton.md +1271 -0
- package/dist/docs/components/releaseNotes.md +135 -0
- package/dist/docs/components/resizer.md +162 -0
- package/dist/docs/components/responsiveColumnStripe.md +435 -0
- package/dist/docs/components/responsiveVideo.md +71 -0
- package/dist/docs/components/rioglyph.md +331 -0
- package/dist/docs/components/rules.md +965 -0
- package/dist/docs/components/saveableInput.md +1721 -0
- package/dist/docs/components/selects.md +1993 -0
- package/dist/docs/components/sidebar.md +332 -0
- package/dist/docs/components/sliders.md +376 -0
- package/dist/docs/components/smoothScrollbars.md +1180 -0
- package/dist/docs/components/spinners.md +506 -0
- package/dist/docs/components/states.md +1176 -0
- package/dist/docs/components/statsWidgets.md +636 -0
- package/dist/docs/components/statusBar.md +644 -0
- package/dist/docs/components/stepButton.md +61 -0
- package/dist/docs/components/steppedProgressBars.md +1064 -0
- package/dist/docs/components/subNavigation.md +470 -0
- package/dist/docs/components/supportMarker.md +115 -0
- package/dist/docs/components/svgImage.md +248 -0
- package/dist/docs/components/switch.md +554 -0
- package/dist/docs/components/tables.md +8 -0
- package/dist/docs/components/tagManager.md +476 -0
- package/dist/docs/components/tags.md +785 -0
- package/dist/docs/components/teaser.md +925 -0
- package/dist/docs/components/timeline.md +514 -0
- package/dist/docs/components/timepicker.md +262 -0
- package/dist/docs/components/toggleButton.md +178 -0
- package/dist/docs/components/tooltip.md +454 -0
- package/dist/docs/components/virtualList.md +483 -0
- package/dist/docs/foundations.md +20901 -0
- package/dist/docs/start/changelog.md +439 -0
- package/dist/docs/start/goodtoknow.md +14 -0
- package/dist/docs/start/guidelines/color-combinations.md +678 -0
- package/dist/docs/start/guidelines/custom-css.md +42 -0
- package/dist/docs/start/guidelines/custom-rioglyph.md +35 -0
- package/dist/docs/start/guidelines/formatting.md +587 -0
- package/dist/docs/start/guidelines/iframe.md +323 -0
- package/dist/docs/start/guidelines/obfuscate-data.md +30 -0
- package/dist/docs/start/guidelines/print-css.md +36 -0
- package/dist/docs/start/guidelines/spinner.md +710 -0
- package/dist/docs/start/guidelines/supported-browsers.md +10 -0
- package/dist/docs/start/guidelines/writing.md +635 -0
- package/dist/docs/start/howto.md +187 -0
- package/dist/docs/start/intro.md +43 -0
- package/dist/docs/start/responsiveness.md +98 -0
- package/dist/docs/templates/common-table.md +1111 -0
- package/dist/docs/templates/detail-views.md +942 -0
- package/dist/docs/templates/expandable-details.md +228 -0
- package/dist/docs/templates/feature-cards.md +549 -0
- package/dist/docs/templates/form-summary.md +199 -0
- package/dist/docs/templates/form-toggle.md +367 -0
- package/dist/docs/templates/list-blocks.md +1021 -0
- package/dist/docs/templates/loading-progress.md +109 -0
- package/dist/docs/templates/options-panel.md +152 -0
- package/dist/docs/templates/panel-variants.md +164 -0
- package/dist/docs/templates/progress-cards.md +607 -0
- package/dist/docs/templates/progress-success.md +142 -0
- package/dist/docs/templates/settings-form.md +434 -0
- package/dist/docs/templates/stats-blocks.md +1381 -0
- package/dist/docs/templates/table-panel.md +184 -0
- package/dist/docs/templates/table-row-animation.md +317 -0
- package/dist/docs/templates/usage-cards.md +227 -0
- package/dist/docs/utilities/deviceUtils.md +123 -0
- package/dist/docs/utilities/featureToggles.md +90 -0
- package/dist/docs/utilities/fuelTypeUtils.md +186 -0
- package/dist/docs/utilities/routeUtils.md +138 -0
- package/dist/docs/utilities/useAfterMount.md +66 -0
- package/dist/docs/utilities/useAutoAnimate.md +193 -0
- package/dist/docs/utilities/useAverage.md +95 -0
- package/dist/docs/utilities/useClickOutside.md +61 -0
- package/dist/docs/utilities/useClipboard.md +93 -0
- package/dist/docs/utilities/useCount.md +178 -0
- package/dist/docs/utilities/useDarkMode.md +49 -0
- package/dist/docs/utilities/useDebugInfo.md +126 -0
- package/dist/docs/utilities/useEffectOnce.md +58 -0
- package/dist/docs/utilities/useElapsedTime.md +58 -0
- package/dist/docs/utilities/useElementSize.md +71 -0
- package/dist/docs/utilities/useEsc.md +58 -0
- package/dist/docs/utilities/useEvent.md +64 -0
- package/dist/docs/utilities/useFocusTrap.md +85 -0
- package/dist/docs/utilities/useFullscreen.md +198 -0
- package/dist/docs/utilities/useHover.md +55 -0
- package/dist/docs/utilities/useIncomingPostMessages.md +237 -0
- package/dist/docs/utilities/useInterval.md +85 -0
- package/dist/docs/utilities/useIsFocusWithin.md +114 -0
- package/dist/docs/utilities/useKey.md +151 -0
- package/dist/docs/utilities/useLocalStorage.md +91 -0
- package/dist/docs/utilities/useLocationSuggestions.md +114 -0
- package/dist/docs/utilities/useMax.md +62 -0
- package/dist/docs/utilities/useMin.md +78 -0
- package/dist/docs/utilities/useMutationObserver.md +113 -0
- package/dist/docs/utilities/useOnScreen.md +138 -0
- package/dist/docs/utilities/useOnlineStatus.md +49 -0
- package/dist/docs/utilities/usePostMessage.md +117 -0
- package/dist/docs/utilities/usePostMessageSender.md +257 -0
- package/dist/docs/utilities/usePrevious.md +101 -0
- package/dist/docs/utilities/useResizeObserver.md +151 -0
- package/dist/docs/utilities/useScrollPosition.md +252 -0
- package/dist/docs/utilities/useSearch.md +228 -0
- package/dist/docs/utilities/useSorting.md +389 -0
- package/dist/docs/utilities/useStateWithValidation.md +83 -0
- package/dist/docs/utilities/useSum.md +155 -0
- package/dist/docs/utilities/useTableExport.md +404 -0
- package/dist/docs/utilities/useTableSelection.md +1120 -0
- package/dist/docs/utilities/useTimeout.md +55 -0
- package/dist/docs/utilities/useToggle.md +115 -0
- package/dist/docs/utilities/useWindowResize.md +70 -0
- package/dist/index.mjs +271 -0
- package/dist/search-synonyms.json +134 -0
- package/dist/version.json +4 -0
- package/package.json +23 -19
- package/bin/uikit-mcp.mjs +0 -23
- package/data/pages/Components/components/accentbar.json +0 -207
- package/data/pages/Components/components/activity.json +0 -87
- package/data/pages/Components/components/animatednumber.json +0 -99
- package/data/pages/Components/components/animations.json +0 -87
- package/data/pages/Components/components/appheader.json +0 -291
- package/data/pages/Components/components/applayout.json +0 -1198
- package/data/pages/Components/components/appnavigationbar.json +0 -327
- package/data/pages/Components/components/areacharts.json +0 -563
- package/data/pages/Components/components/aspectratioplaceholder.json +0 -75
- package/data/pages/Components/components/assettree.json +0 -3080
- package/data/pages/Components/components/autosuggests.json +0 -710
- package/data/pages/Components/components/avatar.json +0 -157
- package/data/pages/Components/components/banner.json +0 -599
- package/data/pages/Components/components/barcharts.json +0 -1507
- package/data/pages/Components/components/barlist.json +0 -223
- package/data/pages/Components/components/basicmap.json +0 -68
- package/data/pages/Components/components/bottomsheet.json +0 -601
- package/data/pages/Components/components/button.json +0 -583
- package/data/pages/Components/components/buttontoolbar.json +0 -63
- package/data/pages/Components/components/calendarstripe.json +0 -235
- package/data/pages/Components/components/card.json +0 -69
- package/data/pages/Components/components/carousel.json +0 -39
- package/data/pages/Components/components/chartcolors.json +0 -34
- package/data/pages/Components/components/chartsgettingstarted.json +0 -32
- package/data/pages/Components/components/chat.json +0 -39
- package/data/pages/Components/components/checkbox.json +0 -847
- package/data/pages/Components/components/clearableinput.json +0 -789
- package/data/pages/Components/components/collapse.json +0 -175
- package/data/pages/Components/components/composedcharts.json +0 -159
- package/data/pages/Components/components/contentloader.json +0 -233
- package/data/pages/Components/components/datatabs.json +0 -680
- package/data/pages/Components/components/datepickers.json +0 -287
- package/data/pages/Components/components/dialogs.json +0 -1492
- package/data/pages/Components/components/divider.json +0 -93
- package/data/pages/Components/components/dropdowns.json +0 -936
- package/data/pages/Components/components/editablecontent.json +0 -1117
- package/data/pages/Components/components/expander.json +0 -377
- package/data/pages/Components/components/fade.json +0 -403
- package/data/pages/Components/components/fadeexpander.json +0 -75
- package/data/pages/Components/components/fadeup.json +0 -127
- package/data/pages/Components/components/feedback.json +0 -269
- package/data/pages/Components/components/filepickers.json +0 -269
- package/data/pages/Components/components/formlabel.json +0 -115
- package/data/pages/Components/components/fullscreenmap.json +0 -22
- package/data/pages/Components/components/groupeditemlist.json +0 -323
- package/data/pages/Components/components/iconlist.json +0 -45
- package/data/pages/Components/components/imagepreloader.json +0 -81
- package/data/pages/Components/components/labeledelement.json +0 -75
- package/data/pages/Components/components/licenseplate.json +0 -69
- package/data/pages/Components/components/linecharts.json +0 -987
- package/data/pages/Components/components/listmenu.json +0 -313
- package/data/pages/Components/components/loadmore.json +0 -175
- package/data/pages/Components/components/mainnavigation.json +0 -39
- package/data/pages/Components/components/mapcircle.json +0 -34
- package/data/pages/Components/components/mapcluster.json +0 -51
- package/data/pages/Components/components/mapcontext.json +0 -105
- package/data/pages/Components/components/mapdraggablemarker.json +0 -34
- package/data/pages/Components/components/mapgettingstarted.json +0 -27
- package/data/pages/Components/components/mapgroup.json +0 -1198
- package/data/pages/Components/components/mapinfobubble.json +0 -34
- package/data/pages/Components/components/maplayergroup.json +0 -34
- package/data/pages/Components/components/mapmarker.json +0 -700
- package/data/pages/Components/components/mappolygon.json +0 -45
- package/data/pages/Components/components/maproute.json +0 -623
- package/data/pages/Components/components/maproutegenerator.json +0 -16
- package/data/pages/Components/components/mapsettings.json +0 -51
- package/data/pages/Components/components/maputils.json +0 -34
- package/data/pages/Components/components/multiselects.json +0 -1451
- package/data/pages/Components/components/nodata.json +0 -139
- package/data/pages/Components/components/notifications.json +0 -65
- package/data/pages/Components/components/numbercontrol.json +0 -301
- package/data/pages/Components/components/onboarding.json +0 -302
- package/data/pages/Components/components/page.json +0 -197
- package/data/pages/Components/components/pager.json +0 -93
- package/data/pages/Components/components/piecharts.json +0 -731
- package/data/pages/Components/components/popover.json +0 -251
- package/data/pages/Components/components/position.json +0 -69
- package/data/pages/Components/components/radialbarcharts.json +0 -1304
- package/data/pages/Components/components/radiobutton.json +0 -1105
- package/data/pages/Components/components/releasenotes.json +0 -44
- package/data/pages/Components/components/resizer.json +0 -93
- package/data/pages/Components/components/responsivecolumnstripe.json +0 -123
- package/data/pages/Components/components/responsivevideo.json +0 -75
- package/data/pages/Components/components/rioglyph.json +0 -93
- package/data/pages/Components/components/rules.json +0 -410
- package/data/pages/Components/components/saveableinput.json +0 -703
- package/data/pages/Components/components/selects.json +0 -701
- package/data/pages/Components/components/sidebar.json +0 -243
- package/data/pages/Components/components/sliders.json +0 -235
- package/data/pages/Components/components/smoothscrollbars.json +0 -335
- package/data/pages/Components/components/spinners.json +0 -343
- package/data/pages/Components/components/states.json +0 -1705
- package/data/pages/Components/components/statswidgets.json +0 -314
- package/data/pages/Components/components/statusbar.json +0 -177
- package/data/pages/Components/components/stepbutton.json +0 -57
- package/data/pages/Components/components/steppedprogressbars.json +0 -417
- package/data/pages/Components/components/subnavigation.json +0 -107
- package/data/pages/Components/components/supportmarker.json +0 -45
- package/data/pages/Components/components/svgimage.json +0 -81
- package/data/pages/Components/components/switch.json +0 -111
- package/data/pages/Components/components/tables.json +0 -144
- package/data/pages/Components/components/tagmanager.json +0 -86
- package/data/pages/Components/components/tags.json +0 -146
- package/data/pages/Components/components/teaser.json +0 -188
- package/data/pages/Components/components/timeline.json +0 -45
- package/data/pages/Components/components/timepicker.json +0 -163
- package/data/pages/Components/components/togglebutton.json +0 -247
- package/data/pages/Components/components/tooltip.json +0 -270
- package/data/pages/Components/components/virtuallist.json +0 -175
- package/data/pages/Foundations/foundations.json +0 -2475
- package/data/pages/Getting-started/start/changelog.json +0 -22
- package/data/pages/Getting-started/start/goodtoknow.json +0 -32
- package/data/pages/Getting-started/start/guidelines/color-combinations.json +0 -58
- package/data/pages/Getting-started/start/guidelines/custom-css.json +0 -27
- package/data/pages/Getting-started/start/guidelines/custom-rioglyph.json +0 -22
- package/data/pages/Getting-started/start/guidelines/formatting.json +0 -97
- package/data/pages/Getting-started/start/guidelines/iframe.json +0 -93
- package/data/pages/Getting-started/start/guidelines/obfuscate-data.json +0 -22
- package/data/pages/Getting-started/start/guidelines/print-css.json +0 -37
- package/data/pages/Getting-started/start/guidelines/spinner.json +0 -144
- package/data/pages/Getting-started/start/guidelines/supported-browsers.json +0 -22
- package/data/pages/Getting-started/start/guidelines/writing.json +0 -242
- package/data/pages/Getting-started/start/howto.json +0 -72
- package/data/pages/Getting-started/start/intro.json +0 -37
- package/data/pages/Getting-started/start/responsiveness.json +0 -52
- package/data/pages/Templates/templates/common-table.json +0 -39
- package/data/pages/Templates/templates/detail-views.json +0 -71
- package/data/pages/Templates/templates/expandable-details.json +0 -39
- package/data/pages/Templates/templates/feature-cards.json +0 -103
- package/data/pages/Templates/templates/form-summary.json +0 -39
- package/data/pages/Templates/templates/form-toggle.json +0 -39
- package/data/pages/Templates/templates/list-blocks.json +0 -119
- package/data/pages/Templates/templates/loading-progress.json +0 -39
- package/data/pages/Templates/templates/options-panel.json +0 -39
- package/data/pages/Templates/templates/panel-variants.json +0 -39
- package/data/pages/Templates/templates/progress-cards.json +0 -71
- package/data/pages/Templates/templates/progress-success.json +0 -39
- package/data/pages/Templates/templates/settings-form.json +0 -39
- package/data/pages/Templates/templates/stats-blocks.json +0 -135
- package/data/pages/Templates/templates/table-panel.json +0 -39
- package/data/pages/Templates/templates/table-row-animation.json +0 -39
- package/data/pages/Templates/templates/usage-cards.json +0 -39
- package/data/pages/Utilities/utilities/deviceutils.json +0 -39
- package/data/pages/Utilities/utilities/featuretoggles.json +0 -42
- package/data/pages/Utilities/utilities/fueltypeutils.json +0 -118
- package/data/pages/Utilities/utilities/routeutils.json +0 -34
- package/data/pages/Utilities/utilities/useaftermount.json +0 -63
- package/data/pages/Utilities/utilities/useaverage.json +0 -86
- package/data/pages/Utilities/utilities/useclickoutside.json +0 -69
- package/data/pages/Utilities/utilities/useclipboard.json +0 -57
- package/data/pages/Utilities/utilities/usecount.json +0 -92
- package/data/pages/Utilities/utilities/usedarkmode.json +0 -50
- package/data/pages/Utilities/utilities/usedebuginfo.json +0 -63
- package/data/pages/Utilities/utilities/useeffectonce.json +0 -57
- package/data/pages/Utilities/utilities/useelapsedtime.json +0 -57
- package/data/pages/Utilities/utilities/useelementsize.json +0 -63
- package/data/pages/Utilities/utilities/useesc.json +0 -57
- package/data/pages/Utilities/utilities/useevent.json +0 -75
- package/data/pages/Utilities/utilities/usefocustrap.json +0 -57
- package/data/pages/Utilities/utilities/usefullscreen.json +0 -197
- package/data/pages/Utilities/utilities/usehover.json +0 -57
- package/data/pages/Utilities/utilities/useinterval.json +0 -63
- package/data/pages/Utilities/utilities/useisfocuswithin.json +0 -75
- package/data/pages/Utilities/utilities/usekey.json +0 -75
- package/data/pages/Utilities/utilities/uselocalstorage.json +0 -69
- package/data/pages/Utilities/utilities/uselocationsuggestions.json +0 -110
- package/data/pages/Utilities/utilities/usemax.json +0 -86
- package/data/pages/Utilities/utilities/usemin.json +0 -86
- package/data/pages/Utilities/utilities/usemutationobserver.json +0 -69
- package/data/pages/Utilities/utilities/useonlinestatus.json +0 -39
- package/data/pages/Utilities/utilities/useonscreen.json +0 -63
- package/data/pages/Utilities/utilities/usepostmessage.json +0 -80
- package/data/pages/Utilities/utilities/useprevious.json +0 -63
- package/data/pages/Utilities/utilities/useresizeobserver.json +0 -65
- package/data/pages/Utilities/utilities/usescrollposition.json +0 -103
- package/data/pages/Utilities/utilities/usesearch.json +0 -197
- package/data/pages/Utilities/utilities/usesorting.json +0 -139
- package/data/pages/Utilities/utilities/usestatewithvalidation.json +0 -69
- package/data/pages/Utilities/utilities/usesum.json +0 -86
- package/data/pages/Utilities/utilities/usetableexport.json +0 -87
- package/data/pages/Utilities/utilities/usetableselection.json +0 -311
- package/data/pages/Utilities/utilities/usetimeout.json +0 -63
- package/data/pages/Utilities/utilities/usetoggle.json +0 -75
- package/data/pages/Utilities/utilities/usewindowresize.json +0 -63
- package/data/version.json +0 -4
- package/docs/content-schema.md +0 -147
- package/docs/navigation-inventory.json +0 -1310
- package/docs/search-synonyms.json +0 -43
- package/server/index.mjs +0 -268
- package/server/lib/load-docs.mjs +0 -48
- package/server/lib/normalise-doc.mjs +0 -220
- package/server/lib/render-markdown.mjs +0 -82
- package/server/lib/search-index.mjs +0 -49
- package/server/lib/types.js +0 -99
|
@@ -0,0 +1,3223 @@
|
|
|
1
|
+
# AssetTree
|
|
2
|
+
|
|
3
|
+
*Category:* Components
|
|
4
|
+
*Section:* Selection
|
|
5
|
+
*Source:* https://uikit.developers.rio.cloud/#components/assetTree
|
|
6
|
+
*Captured:* 2025-12-12T12:38:29.787Z
|
|
7
|
+
|
|
8
|
+
The asset tree components are using labels that need to be defined from the outside of the components, meaning the come from your service. To align on the labels and their translations you should use the shared project on Phrase.
|
|
9
|
+
|
|
10
|
+
## AssetTree
|
|
11
|
+
|
|
12
|
+
### Example: Example 1
|
|
13
|
+
|
|
14
|
+
Filter
|
|
15
|
+
|
|
16
|
+
5272
|
|
17
|
+
4
|
|
18
|
+
|
|
19
|
+
Group - Aaron Walsh - 413913
|
|
20
|
+
|
|
21
|
+
Group - Abel O'Reilly I - 66006
|
|
22
|
+
|
|
23
|
+
Group - Adrian Schulist - 692310
|
|
24
|
+
|
|
25
|
+
Group - Adrienne Gislason - 484912
|
|
26
|
+
|
|
27
|
+
Group - Adrienne Yost - 593010
|
|
28
|
+
|
|
29
|
+
Group - Alex Connelly - 289915
|
|
30
|
+
|
|
31
|
+
Group - Alex Rowe - 568311
|
|
32
|
+
|
|
33
|
+
Group - Alice Harris - 978010
|
|
34
|
+
|
|
35
|
+
Group - Allan Auer V - 493512
|
|
36
|
+
|
|
37
|
+
Group - Allan Jenkins IV - 59835
|
|
38
|
+
|
|
39
|
+
Group - Alma Brakus PhD - 48176
|
|
40
|
+
|
|
41
|
+
Group - Alton Konopelski - 71095
|
|
42
|
+
|
|
43
|
+
Group - Alton Pollich - 18919
|
|
44
|
+
|
|
45
|
+
Group - Alyssa Collins - 26536
|
|
46
|
+
|
|
47
|
+
Group - Alyssa Lueilwitz III - 462815
|
|
48
|
+
|
|
49
|
+
200
|
|
50
|
+
|
|
51
|
+
200
|
|
52
|
+
|
|
53
|
+
Load trucksClear treeToggle all groups selection
|
|
54
|
+
|
|
55
|
+
Current category:
|
|
56
|
+
trucks
|
|
57
|
+
Selected groups:
|
|
58
|
+
|
|
59
|
+
Selected assets:
|
|
60
|
+
|
|
61
|
+
Expanded groups:
|
|
62
|
+
Trailer Group
|
|
63
|
+
|
|
64
|
+
Selected drivers:
|
|
65
|
+
|
|
66
|
+
Search value:
|
|
67
|
+
|
|
68
|
+
Asset type filter:
|
|
69
|
+
[]
|
|
70
|
+
|
|
71
|
+
#### Summary
|
|
72
|
+
|
|
73
|
+
Filter
|
|
74
|
+
|
|
75
|
+
5272
|
|
76
|
+
4
|
|
77
|
+
|
|
78
|
+
Group - Aaron Walsh - 413913
|
|
79
|
+
|
|
80
|
+
Group - Abel O'Reilly I - 66006
|
|
81
|
+
|
|
82
|
+
Group - Adrian Schulist - 692310
|
|
83
|
+
|
|
84
|
+
Group - Adrienne Gislason - 484912
|
|
85
|
+
|
|
86
|
+
Group - Adrienne Yost - 593010
|
|
87
|
+
|
|
88
|
+
Group - Alex Connelly - 289915
|
|
89
|
+
|
|
90
|
+
Group - Alex Rowe - 568311
|
|
91
|
+
|
|
92
|
+
Group - Alice Harris - 978010
|
|
93
|
+
|
|
94
|
+
Group - Allan Auer V - 493512
|
|
95
|
+
|
|
96
|
+
Group - Allan Jenkins IV - 59835
|
|
97
|
+
|
|
98
|
+
Group - Alma Brakus PhD - 48176
|
|
99
|
+
|
|
100
|
+
Group - Alton Konopelski - 71095
|
|
101
|
+
|
|
102
|
+
Group - Alton Pollich - 18919
|
|
103
|
+
|
|
104
|
+
Group - Alyssa Collins - 26536
|
|
105
|
+
|
|
106
|
+
Group - Alyssa Lueilwitz III - 462815
|
|
107
|
+
|
|
108
|
+
200
|
|
109
|
+
|
|
110
|
+
200
|
|
111
|
+
|
|
112
|
+
Load trucksClear treeToggle all groups selection
|
|
113
|
+
|
|
114
|
+
Current category:
|
|
115
|
+
trucks
|
|
116
|
+
Selected groups:
|
|
117
|
+
|
|
118
|
+
Selected assets:
|
|
119
|
+
|
|
120
|
+
Expanded groups:
|
|
121
|
+
Trailer Group
|
|
122
|
+
|
|
123
|
+
Selected drivers:
|
|
124
|
+
|
|
125
|
+
Search value:
|
|
126
|
+
|
|
127
|
+
Asset type filter:
|
|
128
|
+
[]
|
|
129
|
+
|
|
130
|
+
#### React (tsx)
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
import { useState } from 'react';
|
|
134
|
+
import { get, isEmpty, isObject, random } from 'es-toolkit/compat';
|
|
135
|
+
import faker from 'faker';
|
|
136
|
+
|
|
137
|
+
import AssetTree from '@rio-cloud/rio-uikit/AssetTree';
|
|
138
|
+
import TreeCategory from '@rio-cloud/rio-uikit/TreeCategory';
|
|
139
|
+
import Tree, {
|
|
140
|
+
type TreeItemName,
|
|
141
|
+
type TreeGroup,
|
|
142
|
+
type TreeItem,
|
|
143
|
+
type SelectionChangeResponse,
|
|
144
|
+
} from '@rio-cloud/rio-uikit/Tree';
|
|
145
|
+
import TreeSearch from '@rio-cloud/rio-uikit/TreeSearch';
|
|
146
|
+
import TreeSummary from '@rio-cloud/rio-uikit/TreeSummary';
|
|
147
|
+
import TreeOption from '@rio-cloud/rio-uikit/TreeOption';
|
|
148
|
+
import Button from '@rio-cloud/rio-uikit/Button';
|
|
149
|
+
|
|
150
|
+
const CATEGORY_FILTER = 'filter';
|
|
151
|
+
const CATEGORY_TRUCKS = 'trucks';
|
|
152
|
+
const CATEGORY_DRIVER = 'driver';
|
|
153
|
+
const CATEGORY_LOREM = 'lorem';
|
|
154
|
+
|
|
155
|
+
const randomDrivers = Array.from({ length: 200 }, (_, index) => ({
|
|
156
|
+
id: `74e8eb86-18a1-4abe-90cb-aeee7909f85${index}`,
|
|
157
|
+
name: {
|
|
158
|
+
firstName: faker.internet.userName(),
|
|
159
|
+
lastName: faker.name.firstName(),
|
|
160
|
+
},
|
|
161
|
+
type: 'driver',
|
|
162
|
+
}));
|
|
163
|
+
|
|
164
|
+
const getTruckGroups = (): TreeGroup[] => {
|
|
165
|
+
const groups = Array.from({ length: random(400, 600) }, (_, index) => ({
|
|
166
|
+
id: `group-${index}`,
|
|
167
|
+
name: `Group - ${faker.name.findName()} - ${random(1000, 9999)}`,
|
|
168
|
+
}));
|
|
169
|
+
return [
|
|
170
|
+
...groups,
|
|
171
|
+
{
|
|
172
|
+
id: 'truck-6ba7c2ec-8bd4-4470-98a4-313c9d33e8d5',
|
|
173
|
+
name: 'Truck Group North',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: 'truck-b40aabcf-01f8-4be2-bc3d-9157cbdb395f',
|
|
177
|
+
name: 'Truck Group East',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
id: 'truck-722a5f86-eb6c-46cf-83da-3f8dbfbcca5e',
|
|
181
|
+
name: 'Truck Group South',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: 'truck-0250a8aa-721e-40b4-b1ea-7908acddfdf4',
|
|
185
|
+
name: 'Truck Group West',
|
|
186
|
+
className: 'foobar',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: 'unassigned',
|
|
190
|
+
name: 'Ungrouped',
|
|
191
|
+
position: 'last',
|
|
192
|
+
},
|
|
193
|
+
];
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const trailerGroups: TreeGroup[] = [
|
|
197
|
+
{
|
|
198
|
+
id: '6ba7c2ec-8bd4-4470-98a4-313c9d33e8d5',
|
|
199
|
+
name: 'Trailer Group',
|
|
200
|
+
},
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
const trailer: TreeItem[] = [
|
|
204
|
+
{
|
|
205
|
+
id: '110191ac-d06d-4567-b13a-7b7fd85d9731',
|
|
206
|
+
name: 'Trailer 03',
|
|
207
|
+
type: 'trailer',
|
|
208
|
+
groupIds: ['unassigned'],
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
id: '110191ac-d06d-4567-b13a-7b7fd85d9740',
|
|
212
|
+
name: 'Trailer 04',
|
|
213
|
+
type: 'trailer',
|
|
214
|
+
groupIds: ['unassigned'],
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: '16807251-95d2-4d73-afd0-4fbd0eadebf4',
|
|
218
|
+
name: 'Trailer 01',
|
|
219
|
+
type: 'trailer',
|
|
220
|
+
groupIds: ['6ba7c2ec-8bd4-4470-98a4-313c9d33e8d5'],
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: '16807251-95d2-4d73-afd0-4fbd0eadebf6',
|
|
224
|
+
name: 'Trailer 02',
|
|
225
|
+
type: 'trailer',
|
|
226
|
+
groupIds: ['6ba7c2ec-8bd4-4470-98a4-313c9d33e8d5'],
|
|
227
|
+
},
|
|
228
|
+
];
|
|
229
|
+
|
|
230
|
+
const getTrucks = (namePrefix = 'Vehicle-'): TreeItem[] => {
|
|
231
|
+
const groups = getTruckGroups();
|
|
232
|
+
const randomTrucks = Array.from({ length: random(5000, 6000) }, (_, index) => ({
|
|
233
|
+
id: `010191ac-d06d-4567-b13a-7b7fd85d97${index}`,
|
|
234
|
+
name: `${namePrefix}${random(1000, 9999)}`,
|
|
235
|
+
info: `M-AN 1${String(index).padStart(3, '0')}`,
|
|
236
|
+
type: 'truck',
|
|
237
|
+
groupIds: [faker.random.arrayElement(groups).id],
|
|
238
|
+
}));
|
|
239
|
+
return [...randomTrucks, ...trailer];
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const truckGroupsWithEmptyGroup: TreeGroup[] = [
|
|
243
|
+
...getTruckGroups(),
|
|
244
|
+
{
|
|
245
|
+
id: '0350a8aa-721e-40b4-b1ea-7908acddfdf4',
|
|
246
|
+
name: 'My Empty Group',
|
|
247
|
+
disabled: true,
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: 'truck-0250a8aa-721e-40b4-b1ea-7908acddfdf1',
|
|
251
|
+
name: 'Truck Group West 2',
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
id: 'truck-0250a8aa-721e-40b4-b1ea-7908acddfdf2',
|
|
255
|
+
name: 'Truck Group West 3',
|
|
256
|
+
},
|
|
257
|
+
...trailerGroups,
|
|
258
|
+
];
|
|
259
|
+
|
|
260
|
+
const defaultExpandedTruckGroups: string[] = ['6ba7c2ec-8bd4-4470-98a4-313c9d33e8d5'];
|
|
261
|
+
|
|
262
|
+
const AssetTreeExample = () => {
|
|
263
|
+
const [trucks, setTrucks] = useState<TreeItem[]>(getTrucks());
|
|
264
|
+
const [truckGroups, setTruckGroups] = useState<TreeGroup[]>(truckGroupsWithEmptyGroup);
|
|
265
|
+
const [selectedTruckGroupIds, setSelectedTruckGroupIds] = useState<string[]>([]);
|
|
266
|
+
const [selectedTruckIds, setSelectedTruckIds] = useState<string[]>([]);
|
|
267
|
+
const [selectedDrivers, setSelectedDrivers] = useState<string[]>([]);
|
|
268
|
+
const [expandedTruckGroups, setExpandedTruckGroups] = useState(defaultExpandedTruckGroups);
|
|
269
|
+
const [currentCategoryId, setCurrentCategoryId] = useState(CATEGORY_TRUCKS);
|
|
270
|
+
const [isTreeOpen, setIsTreeOpen] = useState(true);
|
|
271
|
+
const [searchValue, setSearchValue] = useState('');
|
|
272
|
+
const [showEmptyGroups, setShowEmptyGroups] = useState(false);
|
|
273
|
+
const [showAssetGroups, setShowAssetGroups] = useState(true);
|
|
274
|
+
const [currentTypeFilter, setCurrentTypeFilter] = useState<string[]>([]);
|
|
275
|
+
|
|
276
|
+
const handleSelectTruck = ({ items, groups }: SelectionChangeResponse) => {
|
|
277
|
+
setSelectedTruckIds(items);
|
|
278
|
+
setSelectedTruckGroupIds(groups);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
const handleExpandTruckGroups = (newExpandedTruckGroups: string[]) =>
|
|
282
|
+
setExpandedTruckGroups(newExpandedTruckGroups);
|
|
283
|
+
|
|
284
|
+
const handleSelectDriver = ({ items }: SelectionChangeResponse) => setSelectedDrivers(items);
|
|
285
|
+
const handleChangeCategories = (categoryId: string) => setCurrentCategoryId(categoryId);
|
|
286
|
+
const handleUpdateSearch = (value: string) => setSearchValue(value);
|
|
287
|
+
const handleToggleTree = (toggle: boolean) => setIsTreeOpen(toggle);
|
|
288
|
+
const handleToggleEmptyGroups = () => setShowEmptyGroups(!showEmptyGroups);
|
|
289
|
+
const handleToggleAssetGroups = () => setShowAssetGroups(!showAssetGroups);
|
|
290
|
+
|
|
291
|
+
const renderSelectedItemsOfList = (selectedItemIds: string[], list: TreeGroup[] | TreeItem[]) => {
|
|
292
|
+
return selectedItemIds.map(selectedItemId => {
|
|
293
|
+
const result = list.find(listItem => listItem.id === selectedItemId);
|
|
294
|
+
if (result) {
|
|
295
|
+
const name = isObject(result.name)
|
|
296
|
+
? `${(result.name as TreeItemName).firstName} ${(result.name as TreeItemName).lastName}`
|
|
297
|
+
: result.name;
|
|
298
|
+
return <li key={selectedItemId}>{name}</li>;
|
|
299
|
+
}
|
|
300
|
+
return null;
|
|
301
|
+
});
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
// Custom filter function for driver as for this we showcase the usage of a custom search component
|
|
305
|
+
const filteredDrivers = randomDrivers.filter(driver =>
|
|
306
|
+
`${get(driver, 'name.firstName', '')} ${get(driver, 'name.lastName', '')}`.includes(searchValue)
|
|
307
|
+
);
|
|
308
|
+
|
|
309
|
+
return (
|
|
310
|
+
<div className='display-flex flex-wrap gap-25'>
|
|
311
|
+
<div>
|
|
312
|
+
<AssetTree
|
|
313
|
+
bordered
|
|
314
|
+
minWidth={300}
|
|
315
|
+
maxWidth={450}
|
|
316
|
+
currentCategoryId={currentCategoryId}
|
|
317
|
+
onCategoryChange={handleChangeCategories}
|
|
318
|
+
height={500}
|
|
319
|
+
isOpen={isTreeOpen}
|
|
320
|
+
onToggleTree={handleToggleTree}
|
|
321
|
+
useOffscreen
|
|
322
|
+
>
|
|
323
|
+
<TreeCategory key={CATEGORY_FILTER} id={CATEGORY_FILTER} label='Filter' icon='rioglyph-filter'>
|
|
324
|
+
<div className='margin-15'>Filter</div>
|
|
325
|
+
</TreeCategory>
|
|
326
|
+
|
|
327
|
+
<TreeCategory
|
|
328
|
+
key={CATEGORY_TRUCKS}
|
|
329
|
+
id={CATEGORY_TRUCKS}
|
|
330
|
+
label='Assets'
|
|
331
|
+
icon='rioglyph-truck'
|
|
332
|
+
hasSelection={!isEmpty(selectedTruckIds) || !isEmpty(selectedTruckGroupIds)}
|
|
333
|
+
>
|
|
334
|
+
<Tree
|
|
335
|
+
groups={showAssetGroups ? truckGroups : []}
|
|
336
|
+
items={trucks}
|
|
337
|
+
expandedGroups={expandedTruckGroups}
|
|
338
|
+
onExpandGroupsChange={handleExpandTruckGroups}
|
|
339
|
+
selectedGroups={selectedTruckGroupIds}
|
|
340
|
+
selectedItems={selectedTruckIds}
|
|
341
|
+
onSelectionChange={handleSelectTruck}
|
|
342
|
+
searchPlaceholder='Find asset'
|
|
343
|
+
onSearchChange={handleUpdateSearch}
|
|
344
|
+
showEmptyGroups={showEmptyGroups}
|
|
345
|
+
onTypeFilterChange={setCurrentTypeFilter}
|
|
346
|
+
treeOptionsTooltip='Vehicle tree options'
|
|
347
|
+
treeOptions={[
|
|
348
|
+
<TreeOption
|
|
349
|
+
key='emptyGroupsToggle'
|
|
350
|
+
label='Show empty groups'
|
|
351
|
+
isChecked={showEmptyGroups}
|
|
352
|
+
onChange={handleToggleEmptyGroups}
|
|
353
|
+
/>,
|
|
354
|
+
<TreeOption
|
|
355
|
+
key='assetGroupsToggle'
|
|
356
|
+
label='Show groups'
|
|
357
|
+
isChecked={showAssetGroups}
|
|
358
|
+
onChange={handleToggleAssetGroups}
|
|
359
|
+
/>,
|
|
360
|
+
]}
|
|
361
|
+
/>
|
|
362
|
+
</TreeCategory>
|
|
363
|
+
|
|
364
|
+
<TreeCategory
|
|
365
|
+
key={CATEGORY_DRIVER}
|
|
366
|
+
id={CATEGORY_DRIVER}
|
|
367
|
+
label='My Drivers'
|
|
368
|
+
icon='rioglyph-driver'
|
|
369
|
+
hasSelection={!isEmpty(selectedDrivers)}
|
|
370
|
+
>
|
|
371
|
+
<Tree
|
|
372
|
+
items={filteredDrivers}
|
|
373
|
+
selectedItems={selectedDrivers}
|
|
374
|
+
onSelectionChange={handleSelectDriver}
|
|
375
|
+
hasMultiselect={!isEmpty(filteredDrivers)}
|
|
376
|
+
summary={<TreeSummary assetCounts={{ driver: filteredDrivers.length }} />}
|
|
377
|
+
search={
|
|
378
|
+
<TreeSearch
|
|
379
|
+
value={searchValue}
|
|
380
|
+
placeholder='this is a custom search'
|
|
381
|
+
onChange={handleUpdateSearch}
|
|
382
|
+
/>
|
|
383
|
+
}
|
|
384
|
+
/>
|
|
385
|
+
</TreeCategory>
|
|
386
|
+
|
|
387
|
+
<TreeCategory key='lorem-ipsum' id={CATEGORY_LOREM} label='Lorem ipsum' icon='rioglyph-layer-pois'>
|
|
388
|
+
<div className='custom-pois-wrapper height-100pct'>
|
|
389
|
+
<Tree
|
|
390
|
+
items={filteredDrivers}
|
|
391
|
+
selectedItems={selectedDrivers}
|
|
392
|
+
onSelectionChange={handleSelectDriver}
|
|
393
|
+
hasMultiselect={!isEmpty(filteredDrivers)}
|
|
394
|
+
treeHeaderContent={
|
|
395
|
+
<ul className='rounded-none nav nav-pills nav-pills-filled nav-justified text-size-18'>
|
|
396
|
+
<li className='active'>
|
|
397
|
+
<span className='rioglyph rioglyph-pushpin' />
|
|
398
|
+
</li>
|
|
399
|
+
<li>
|
|
400
|
+
<span className='rioglyph rioglyph-geofence' />
|
|
401
|
+
</li>
|
|
402
|
+
<li>
|
|
403
|
+
<span className='rioglyph rioglyph-workshop' />
|
|
404
|
+
</li>
|
|
405
|
+
<li>
|
|
406
|
+
<span className='rioglyph rioglyph-filling-e-station' />
|
|
407
|
+
</li>
|
|
408
|
+
</ul>
|
|
409
|
+
}
|
|
410
|
+
summary={<TreeSummary assetCounts={{ driver: filteredDrivers.length }} />}
|
|
411
|
+
search={
|
|
412
|
+
<TreeSearch
|
|
413
|
+
value={searchValue}
|
|
414
|
+
placeholder='this is a custom search'
|
|
415
|
+
onChange={handleUpdateSearch}
|
|
416
|
+
/>
|
|
417
|
+
}
|
|
418
|
+
/>
|
|
419
|
+
</div>
|
|
420
|
+
</TreeCategory>
|
|
421
|
+
</AssetTree>
|
|
422
|
+
<div className='btn-toolbar margin-top-25'>
|
|
423
|
+
<Button
|
|
424
|
+
onClick={() => {
|
|
425
|
+
setTrucks(getTrucks('RIO'));
|
|
426
|
+
setTruckGroups(getTruckGroups());
|
|
427
|
+
}}
|
|
428
|
+
>
|
|
429
|
+
Load trucks
|
|
430
|
+
</Button>
|
|
431
|
+
<Button
|
|
432
|
+
onClick={() => {
|
|
433
|
+
setTrucks([]);
|
|
434
|
+
setTruckGroups([]);
|
|
435
|
+
}}
|
|
436
|
+
>
|
|
437
|
+
Clear tree
|
|
438
|
+
</Button>
|
|
439
|
+
<Button
|
|
440
|
+
onClick={() => {
|
|
441
|
+
const isListEmpty = isEmpty(selectedTruckGroupIds);
|
|
442
|
+
setSelectedTruckGroupIds(isListEmpty ? truckGroups.map(group => group.id) : []);
|
|
443
|
+
}}
|
|
444
|
+
>
|
|
445
|
+
Toggle all groups selection
|
|
446
|
+
</Button>
|
|
447
|
+
</div>
|
|
448
|
+
</div>
|
|
449
|
+
<div>
|
|
450
|
+
<div className='h6'>Current category:</div>
|
|
451
|
+
<ul>{currentCategoryId}</ul>
|
|
452
|
+
<div className='h6'>Selected groups:</div>
|
|
453
|
+
<ul>{renderSelectedItemsOfList(selectedTruckGroupIds, truckGroups)}</ul>
|
|
454
|
+
<div className='h6'>Selected assets:</div>
|
|
455
|
+
<ul>{renderSelectedItemsOfList(selectedTruckIds, trucks)}</ul>
|
|
456
|
+
<div className='h6'>Expanded groups:</div>
|
|
457
|
+
<ul>{renderSelectedItemsOfList(expandedTruckGroups, truckGroups)}</ul>
|
|
458
|
+
<hr />
|
|
459
|
+
<div className='h6'>Selected drivers:</div>
|
|
460
|
+
<ul>{renderSelectedItemsOfList(selectedDrivers, randomDrivers)}</ul>
|
|
461
|
+
<hr />
|
|
462
|
+
<div className='h6'>Search value:</div>
|
|
463
|
+
<ul>{searchValue}</ul>
|
|
464
|
+
<hr />
|
|
465
|
+
<div className='h6'>Asset type filter:</div>
|
|
466
|
+
<ul>{`[${currentTypeFilter.join(', ')}]`}</ul>
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
);
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
export default AssetTreeExample;
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
#### Props: AssetTree
|
|
476
|
+
|
|
477
|
+
### AssetTree
|
|
478
|
+
|
|
479
|
+
| Name | Type | Default | Description |
|
|
480
|
+
| --- | --- | --- | --- |
|
|
481
|
+
| fly | boolean | false | Defines if the component will overlap the body content. |
|
|
482
|
+
| resizable | boolean | true | Defines whether or not the sidebar is resizable. |
|
|
483
|
+
| onResizeEnd | Function | () => {} | Callback for when the resize is done. |
|
|
484
|
+
| bordered | boolean | false | Defines whether the component has a border or not. |
|
|
485
|
+
| width | string / number | 350 | Defines the width of the component. The value is set as inline style. Note: when component is resizable it will take the provided width in px only and convert it to number in case. |
|
|
486
|
+
| minWidth | number | 100 | Defines the minimum width of the component in px that will take effect when resizing. |
|
|
487
|
+
| maxWidth | number | 0 | Defines the maximum width of the component in px that will take effect when resizing. |
|
|
488
|
+
| height | number | — | Defines the height of the component in px. |
|
|
489
|
+
| isOpen | boolean | true | Defines whether the component is open or not. |
|
|
490
|
+
| onToggleTree | Function | () => {} | Callback for when the tree visibility is toggled. |
|
|
491
|
+
| currentCategoryId | string | — | The id of the category which is currently active and shall be shown. |
|
|
492
|
+
| onCategoryChange | Function | () => {} | Callback for handling change of category. |
|
|
493
|
+
| useOffscreen | boolean | false | Defines whether the tree components are rendered offscreen and kept mounted in the DOM. |
|
|
494
|
+
| className | String | — | Additional classes added on the wrapper element. |
|
|
495
|
+
| children | TreeCategory | — | A list of TreeCategory components |
|
|
496
|
+
|
|
497
|
+
#### Props: TreeCategory
|
|
498
|
+
|
|
499
|
+
### TreeCategory
|
|
500
|
+
|
|
501
|
+
| Name | Type | Default | Description |
|
|
502
|
+
| --- | --- | --- | --- |
|
|
503
|
+
| id | String | — | A unique identifier for that category. |
|
|
504
|
+
| icon | String | — | The rioglyph icon name for that category. |
|
|
505
|
+
| label | String / Node | — | The optional label for the category which will be shown in a tooltip. |
|
|
506
|
+
| hasSelection | boolean | — | Defines whether or not a selection indicator should be shown. |
|
|
507
|
+
|
|
508
|
+
#### Props: Tree
|
|
509
|
+
|
|
510
|
+
### Tree
|
|
511
|
+
|
|
512
|
+
| Name | Type | Default | Description |
|
|
513
|
+
| --- | --- | --- | --- |
|
|
514
|
+
| groups | Array of objects | [] | The list of groups of the items. If no groups are provided all items are rendered as flat list. |
|
|
515
|
+
| └id | String | — | A unique identifier of a group. |
|
|
516
|
+
| └name | String | — | The name of a group. |
|
|
517
|
+
| └position | string | — | Can be set to "last" to enforce the last position in the tree. |
|
|
518
|
+
| └disabled | Boolean | — | Disallows the selection of the group itself. |
|
|
519
|
+
| └className | String | — | Additional classes added to the group element. |
|
|
520
|
+
| items | Array of Objects | [] | The list of items. |
|
|
521
|
+
| └id | String | — | A unique identifier of an item. |
|
|
522
|
+
| └name | string / object | — | The name of an item. Either it is a plain string or an object composed of: firstName and lastName where lastName is mandatory |
|
|
523
|
+
| └info | String \| Node | — | The subline of an item. |
|
|
524
|
+
| └type | string | — | The primary type of the item. This is also used as the fallback icon name and refers to the name of the respective rioglyph icon (excluding the `rioglyph-` prefix). |
|
|
525
|
+
| └subType | string | — | The sub type of an item which is also the name of the respective rioglyph icon without the prefix. This could be used to show a secondary paired icon like for fuel type. |
|
|
526
|
+
| └icon | string | — | The rioglyph icon name for a group. The prefix `rioglyph-` can be omitted. |
|
|
527
|
+
| └icon | string \| null | — | Optional icon override for the item. If set to a string (e.g. `'truck'`), this icon will be used explicitly. If set to `undefined`, the `type` property will be used as the fallback icon. If set to `null`, no icon will be rendered, even if `type` is defined. This allows full control over the icon behavior while maintaining backward compatibility with type-based icons. |
|
|
528
|
+
| └groupIds | Array of strings | [] | List of group ids the items is associated with. |
|
|
529
|
+
| └className | string | — | Additional classes added to the item element. |
|
|
530
|
+
| selectedGroups | Array of strings | — | List of selected group ids. |
|
|
531
|
+
| selectedItems | Array of strings | — | List of selected item ids. |
|
|
532
|
+
| onSelectionChange | Function | — | Merged Callback for item and group selection changes. It responds with a selection object that contains the selected itemIds and groupIds: { items: [], groups: [] } |
|
|
533
|
+
| hasMultiselect | boolean | true | Defines the selection behavior of the tree. |
|
|
534
|
+
| showRadioButtons | boolean | false | Defines if the single selection should also show radios. |
|
|
535
|
+
| hideSearch | boolean | false | Defines whether or not the built-in Search is shown. |
|
|
536
|
+
| searchPlaceholder | string | — | The text used as placeholder for the search input. |
|
|
537
|
+
| onSearchChange | Function | — | Callback for when the search value changes. |
|
|
538
|
+
| search | node | — | Used to define custom custom search component which replaces the built-in search. |
|
|
539
|
+
| onTypeFilterChange | (currentTypes: string[]) => void | — | Callback triggered when the built-in asset type filter changes. This is only available when the default summary is used. |
|
|
540
|
+
| summary | node | — | Used to define custom asset type counter component which replaces the built-in summary. |
|
|
541
|
+
| hideSummary | boolean | false | Defines whether a summary is shown. |
|
|
542
|
+
| hideTreeHead | boolean | false | Defines whether the entire area below the search field is shown or not. Note: Disabling the tree head will hide the select all checkbox and the tree options as well as the tree summary. |
|
|
543
|
+
| treeHeaderContent | ReactNode | — | Additional custom content that is rendered at the top of the tree component. This can be used for nav pills. |
|
|
544
|
+
| scrollHeight | Number | — | Defines the max-height of the scrollable list |
|
|
545
|
+
| expandedGroups | Array of String | — | List of group ids which are expanded. |
|
|
546
|
+
| onExpandGroupsChange | Function | — | Callback function triggered when a group expands or collapses. |
|
|
547
|
+
| showEmptyGroups | boolean | true | Defines whether empty groups are shown or not. |
|
|
548
|
+
| treeOptions | ReactNode | — | Component to offer customization options for the tree. |
|
|
549
|
+
| treeOptionsTooltip | ReactNode | — | Tooltip content for the tree options dropdown. |
|
|
550
|
+
| virtualizeThreshold | number | 50 | The number of items (including groups and children) used for virtualizing the tree. |
|
|
551
|
+
| overscan | number | 5 | The number of items rendered beyond the visible area of a virtualized tree. |
|
|
552
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
553
|
+
|
|
554
|
+
#### Props: TreeSearch
|
|
555
|
+
|
|
556
|
+
### TreeSearch
|
|
557
|
+
|
|
558
|
+
| Name | Type | Default | Description |
|
|
559
|
+
| --- | --- | --- | --- |
|
|
560
|
+
| value | String | — | The search value to be shown and used for the search. |
|
|
561
|
+
| onChange | Function | () => {} | Callback for when the search value changes. |
|
|
562
|
+
| placeholder | String | — | The placeholder text used for the input field. |
|
|
563
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
564
|
+
|
|
565
|
+
#### Props: TreeSummary
|
|
566
|
+
|
|
567
|
+
### TreeSummary
|
|
568
|
+
|
|
569
|
+
| Name | Type | Default | Description |
|
|
570
|
+
| --- | --- | --- | --- |
|
|
571
|
+
| assetCounts | object | — | The object containing various asset type counter. |
|
|
572
|
+
| └truck | number | — | The amount of trucks. |
|
|
573
|
+
| └trailer | number | — | The amount of trailers. |
|
|
574
|
+
| └bus | number | — | The amount of buses. |
|
|
575
|
+
| └van | number | — | The amount of vans. |
|
|
576
|
+
| └driver | number | — | The amount of drivers. |
|
|
577
|
+
| gridCols | number | 4 | The number of grid columns used for the built-in TreeSummaryRow |
|
|
578
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
579
|
+
|
|
580
|
+
#### Props: TreeSummaryRow
|
|
581
|
+
|
|
582
|
+
### TreeSummaryRow
|
|
583
|
+
|
|
584
|
+
| Name | Type | Default | Description |
|
|
585
|
+
| --- | --- | --- | --- |
|
|
586
|
+
| gridCols | number | 4 | Defined the number of grid columns for a single row. Note, when the amount of children exceed the columns it will wrap around to a new line. |
|
|
587
|
+
|
|
588
|
+
#### Props: TypeCounter
|
|
589
|
+
|
|
590
|
+
### TypeCounter
|
|
591
|
+
|
|
592
|
+
| Name | Type | Default | Description |
|
|
593
|
+
| --- | --- | --- | --- |
|
|
594
|
+
| type | string | — | The item type for that counter. This will be used as a return value for the onClick callback. |
|
|
595
|
+
| icon | string | — | The icon name. Note, when using the built-in generic type counter, the icon name will the same as the item type. So make sure there is a corresponding icon for the defined type. |
|
|
596
|
+
| isActive | Boolean | — | Sets the active styling if active. |
|
|
597
|
+
| hasFilter | boolean | — | Should be set when there is a type filter set in the tree to style the counter accordingly. |
|
|
598
|
+
| enableActivity | boolean | — | Allows for interactivity. Use this prop when you allow clicking on the counter. |
|
|
599
|
+
| hideOnZero | boolean | false | Defines if the counter is rendered at all when the value is not defined ot 0. |
|
|
600
|
+
| onClick | Function | — | Callback function when the counter is clicked. It returns the type value.Make sure the "type" prop is defined to receive the value in the callback and the flag "enableActivity" is set to true otherwise the callback is not triggered. |
|
|
601
|
+
| value | String / Number / Node | — | A custom value to be shown in the counter. |
|
|
602
|
+
|
|
603
|
+
#### Props: TreeOption
|
|
604
|
+
|
|
605
|
+
### TreeOption
|
|
606
|
+
|
|
607
|
+
| Name | Type | Default | Description |
|
|
608
|
+
| --- | --- | --- | --- |
|
|
609
|
+
| isChecked | boolean | — | Defines whether the option is set. |
|
|
610
|
+
| label | string / node | — | The label for the option. |
|
|
611
|
+
| onChange | Function | — | Callback triggered when option is selected. |
|
|
612
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
613
|
+
|
|
614
|
+
## AssetTree with single select
|
|
615
|
+
|
|
616
|
+
### Example: Example 2
|
|
617
|
+
|
|
618
|
+
8
|
|
619
|
+
8
|
|
620
|
+
6
|
|
621
|
+
8
|
|
622
|
+
|
|
623
|
+
My Empty Group5
|
|
624
|
+
|
|
625
|
+
Truck Group East7
|
|
626
|
+
|
|
627
|
+
Truck Group North2
|
|
628
|
+
N18-G566 / M-AN 1026
|
|
629
|
+
N18-G990 / M-AN 1003
|
|
630
|
+
|
|
631
|
+
Truck Group South6
|
|
632
|
+
|
|
633
|
+
Truck Group West4
|
|
634
|
+
|
|
635
|
+
All my unassigned Trucks6
|
|
636
|
+
|
|
637
|
+
Current category:
|
|
638
|
+
assets
|
|
639
|
+
Selected tree groups:
|
|
640
|
+
|
|
641
|
+
Selected assets:
|
|
642
|
+
|
|
643
|
+
Expanded tree groups:
|
|
644
|
+
Truck Group North
|
|
645
|
+
|
|
646
|
+
#### Summary
|
|
647
|
+
|
|
648
|
+
8
|
|
649
|
+
8
|
|
650
|
+
6
|
|
651
|
+
8
|
|
652
|
+
|
|
653
|
+
My Empty Group5
|
|
654
|
+
|
|
655
|
+
Truck Group East7
|
|
656
|
+
|
|
657
|
+
Truck Group North2
|
|
658
|
+
N18-G566 / M-AN 1026
|
|
659
|
+
N18-G990 / M-AN 1003
|
|
660
|
+
|
|
661
|
+
Truck Group South6
|
|
662
|
+
|
|
663
|
+
Truck Group West4
|
|
664
|
+
|
|
665
|
+
All my unassigned Trucks6
|
|
666
|
+
|
|
667
|
+
Current category:
|
|
668
|
+
assets
|
|
669
|
+
Selected tree groups:
|
|
670
|
+
|
|
671
|
+
Selected assets:
|
|
672
|
+
|
|
673
|
+
Expanded tree groups:
|
|
674
|
+
Truck Group North
|
|
675
|
+
|
|
676
|
+
#### React (tsx)
|
|
677
|
+
|
|
678
|
+
```tsx
|
|
679
|
+
import { useState } from 'react';
|
|
680
|
+
import { isEmpty, isObject, random } from 'es-toolkit/compat';
|
|
681
|
+
import faker from 'faker';
|
|
682
|
+
|
|
683
|
+
import AssetTree from '@rio-cloud/rio-uikit/AssetTree';
|
|
684
|
+
import TreeCategory from '@rio-cloud/rio-uikit/TreeCategory';
|
|
685
|
+
import Tree, {
|
|
686
|
+
type TreeGroup,
|
|
687
|
+
type TreeItem,
|
|
688
|
+
type TreeItemName,
|
|
689
|
+
type SelectionChangeResponse,
|
|
690
|
+
} from '@rio-cloud/rio-uikit/Tree';
|
|
691
|
+
|
|
692
|
+
const CATEGORY_ASSETS = 'assets';
|
|
693
|
+
|
|
694
|
+
const assetGroups: TreeGroup[] = [
|
|
695
|
+
{
|
|
696
|
+
id: '6ba7c2ec-8bd4-4470-98a4-313c9d33e8d5',
|
|
697
|
+
name: 'Truck Group North',
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
id: 'b40aabcf-01f8-4be2-bc3d-9157cbdb395f',
|
|
701
|
+
name: 'Truck Group East',
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
id: '722a5f86-eb6c-46cf-83da-3f8dbfbcca5e',
|
|
705
|
+
name: 'Truck Group South',
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
id: '0250a8aa-721e-40b4-b1ea-7908acddfdf4',
|
|
709
|
+
name: 'Truck Group West',
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
id: '0350a8aa-721e-40b4-b1ea-7908acddfdf4',
|
|
713
|
+
name: 'My Empty Group',
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
id: 'static/unassignedTrucks',
|
|
717
|
+
name: 'All my unassigned Trucks',
|
|
718
|
+
position: 'last',
|
|
719
|
+
},
|
|
720
|
+
];
|
|
721
|
+
|
|
722
|
+
const defaultExpandedAssetGroups = ['6ba7c2ec-8bd4-4470-98a4-313c9d33e8d5'];
|
|
723
|
+
const assetTypes = ['truck', 'bus', 'van', 'trailer'];
|
|
724
|
+
|
|
725
|
+
const assets = Array.from({ length: 30 }, (_, index) => ({
|
|
726
|
+
id: `010191ac-d06d-4567-b13a-7b7fd85d97${index}`,
|
|
727
|
+
name: `N18-G${random(100, 999)} / M-AN 1${String(index).padStart(3, '0')}`,
|
|
728
|
+
type: faker.random.arrayElement(assetTypes),
|
|
729
|
+
groupIds: [faker.random.arrayElement(assetGroups).id],
|
|
730
|
+
}));
|
|
731
|
+
|
|
732
|
+
const AssetTreeSingleSelectExample = () => {
|
|
733
|
+
const [selectedAssetGroupIds, setSelectedAssetGroupIds] = useState<string[]>([]);
|
|
734
|
+
const [selectedAssetIds, setSelectedAssetIds] = useState<string[]>([]);
|
|
735
|
+
const [expandedAssetGroups, setExpandedAssetGroups] = useState<string[]>(defaultExpandedAssetGroups);
|
|
736
|
+
const [currentCategoryId, setCurrentCategoryId] = useState<string>(CATEGORY_ASSETS);
|
|
737
|
+
const [isTreeOpen, setIsTreeOpen] = useState(true);
|
|
738
|
+
|
|
739
|
+
const handleSelectAsset = ({ items, groups }: SelectionChangeResponse) => {
|
|
740
|
+
setSelectedAssetIds(items);
|
|
741
|
+
setSelectedAssetGroupIds(groups);
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
const handleExpandAssetGroups = (expandedGroups: string[]) => setExpandedAssetGroups(expandedGroups);
|
|
745
|
+
const handleChangeCategories = (newCategoryId: string) => setCurrentCategoryId(newCategoryId);
|
|
746
|
+
const handleToggleTree = (toggle: boolean) => setIsTreeOpen(toggle);
|
|
747
|
+
|
|
748
|
+
const renderSelectedItemsOfList = (selectedItemIds: string[], list: TreeGroup[] | TreeItem[]) => {
|
|
749
|
+
return selectedItemIds.map(selectedItemId => {
|
|
750
|
+
const result = list.find(listItem => listItem.id === selectedItemId);
|
|
751
|
+
if (result) {
|
|
752
|
+
const name = isObject(result.name)
|
|
753
|
+
? `${(result.name as TreeItemName).firstName} ${(result.name as TreeItemName).lastName}`
|
|
754
|
+
: result.name;
|
|
755
|
+
return <li key={selectedItemId}>{name}</li>;
|
|
756
|
+
}
|
|
757
|
+
return null;
|
|
758
|
+
});
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
return (
|
|
762
|
+
<div className='display-flex flex-wrap gap-25 overflow-auto'>
|
|
763
|
+
<div>
|
|
764
|
+
<AssetTree
|
|
765
|
+
resizable
|
|
766
|
+
bordered
|
|
767
|
+
minWidth={300}
|
|
768
|
+
maxWidth={450}
|
|
769
|
+
currentCategoryId={currentCategoryId}
|
|
770
|
+
onCategoryChange={handleChangeCategories}
|
|
771
|
+
height={500}
|
|
772
|
+
isOpen={isTreeOpen}
|
|
773
|
+
onToggleTree={handleToggleTree}
|
|
774
|
+
>
|
|
775
|
+
<TreeCategory
|
|
776
|
+
key={CATEGORY_ASSETS}
|
|
777
|
+
id={CATEGORY_ASSETS}
|
|
778
|
+
label='Assets'
|
|
779
|
+
icon='rioglyph-truck'
|
|
780
|
+
hasSelection={!isEmpty(selectedAssetIds) || !isEmpty(selectedAssetGroupIds)}
|
|
781
|
+
>
|
|
782
|
+
<Tree
|
|
783
|
+
groups={assetGroups}
|
|
784
|
+
items={assets}
|
|
785
|
+
expandedGroups={expandedAssetGroups}
|
|
786
|
+
onExpandGroupsChange={handleExpandAssetGroups}
|
|
787
|
+
selectedGroups={selectedAssetGroupIds}
|
|
788
|
+
selectedItems={selectedAssetIds}
|
|
789
|
+
onSelectionChange={handleSelectAsset}
|
|
790
|
+
searchPlaceholder='Find asset by name'
|
|
791
|
+
hasMultiselect={false}
|
|
792
|
+
/>
|
|
793
|
+
</TreeCategory>
|
|
794
|
+
</AssetTree>
|
|
795
|
+
</div>
|
|
796
|
+
<div>
|
|
797
|
+
<div className='h6'>Current category:</div>
|
|
798
|
+
<ul>{currentCategoryId}</ul>
|
|
799
|
+
<div className='h6'>Selected tree groups:</div>
|
|
800
|
+
<ul>{renderSelectedItemsOfList(selectedAssetGroupIds, assetGroups)}</ul>
|
|
801
|
+
<div className='h6'>Selected assets:</div>
|
|
802
|
+
<ul>{renderSelectedItemsOfList(selectedAssetIds, assets)}</ul>
|
|
803
|
+
<div className='h6'>Expanded tree groups:</div>
|
|
804
|
+
<ul>{renderSelectedItemsOfList(expandedAssetGroups, assetGroups)}</ul>
|
|
805
|
+
</div>
|
|
806
|
+
</div>
|
|
807
|
+
);
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
export default AssetTreeSingleSelectExample;
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
#### HTML (html)
|
|
814
|
+
|
|
815
|
+
```html
|
|
816
|
+
<div class="display-flex flex-wrap gap-25 overflow-auto">
|
|
817
|
+
<div>
|
|
818
|
+
<div class="AssetTree border fluid" style="width: 350px; height: 500px;">
|
|
819
|
+
<div class="AssetTreeResizeLimit" style="left: 450px;">
|
|
820
|
+
</div>
|
|
821
|
+
<div class="AssetTreeContent">
|
|
822
|
+
<div class="TreeSidebar">
|
|
823
|
+
<ul class="TreeSidebarNavigation">
|
|
824
|
+
<li class="active">
|
|
825
|
+
<div class="selection-bubble">
|
|
826
|
+
<span class="rioglyph rioglyph-truck">
|
|
827
|
+
</span>
|
|
828
|
+
</div>
|
|
829
|
+
</li>
|
|
830
|
+
</ul>
|
|
831
|
+
<div class="TreeSidebarToggle">
|
|
832
|
+
<span class="rioglyph rioglyph-chevron-left">
|
|
833
|
+
</span>
|
|
834
|
+
</div>
|
|
835
|
+
</div>
|
|
836
|
+
<div class="AssetTreeBody scrollbar-fly-in smooth-scrollbar-wrapper" style="position: relative; overflow: hidden; width: 100%; height: 100%;">
|
|
837
|
+
<div class="scrollbar-view" style="position: absolute; inset: 0px; overflow: scroll; margin-right: 0px; margin-bottom: 0px;">
|
|
838
|
+
<div class="scrollbar-content-wrapper">
|
|
839
|
+
<div class="Tree">
|
|
840
|
+
<div class="TreeHeader">
|
|
841
|
+
<div class="TreeSearch">
|
|
842
|
+
<div class="input-group flex-1-0">
|
|
843
|
+
<span class="input-group-addon">
|
|
844
|
+
<span class="rioglyph rioglyph-search" aria-hidden="true">
|
|
845
|
+
</span>
|
|
846
|
+
</span>
|
|
847
|
+
<div class="ClearableInput input-group">
|
|
848
|
+
<input placeholder="Find asset by name" class="form-control" type="text" tabindex="0" value="">
|
|
849
|
+
<span class="clearButton hide">
|
|
850
|
+
<span class="clearButtonIcon rioglyph rioglyph-remove-sign">
|
|
851
|
+
</span>
|
|
852
|
+
</span>
|
|
853
|
+
</div>
|
|
854
|
+
</div>
|
|
855
|
+
</div>
|
|
856
|
+
<div class="TreeHead display-flex gap-5 padding-15">
|
|
857
|
+
<div class="border border-right-only hidden-empty padding-right-10 margin-right-2">
|
|
858
|
+
</div>
|
|
859
|
+
<div class="display-flex justify-content-between align-items-start width-100pct">
|
|
860
|
+
<div class="TreeSummary display-flex flex-wrap align-items-center gap-10 padding-left-3">
|
|
861
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
862
|
+
<span class="rioglyph rioglyph-truck text-size-16 margin-right-2">
|
|
863
|
+
</span>
|
|
864
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">8</span>
|
|
865
|
+
</div>
|
|
866
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
867
|
+
<span class="rioglyph rioglyph-van text-size-16 margin-right-2">
|
|
868
|
+
</span>
|
|
869
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">8</span>
|
|
870
|
+
</div>
|
|
871
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
872
|
+
<span class="rioglyph rioglyph-trailer text-size-16 margin-right-2">
|
|
873
|
+
</span>
|
|
874
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">6</span>
|
|
875
|
+
</div>
|
|
876
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
877
|
+
<span class="rioglyph rioglyph-bus text-size-16 margin-right-2">
|
|
878
|
+
</span>
|
|
879
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">8</span>
|
|
880
|
+
</div>
|
|
881
|
+
</div>
|
|
882
|
+
</div>
|
|
883
|
+
</div>
|
|
884
|
+
</div>
|
|
885
|
+
<div class="TreeRoot user-select-none overflow-hidden" style="position: relative;">
|
|
886
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="0350a8aa-721e-40b4-b1ea-7908acddfdf4">
|
|
887
|
+
<div class="TreeNode from-group" data-key="0350a8aa-721e-40b4-b1ea-7908acddfdf4">
|
|
888
|
+
<span class="TreeLabel TreeLabelName">
|
|
889
|
+
<span class="TreeLabelNameText">
|
|
890
|
+
<span class="TreeLabelNameTextHeadline">My Empty Group</span>
|
|
891
|
+
</span>
|
|
892
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">5</span>
|
|
893
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
894
|
+
</span>
|
|
895
|
+
</span>
|
|
896
|
+
</div>
|
|
897
|
+
</div>
|
|
898
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="b40aabcf-01f8-4be2-bc3d-9157cbdb395f">
|
|
899
|
+
<div class="TreeNode from-group" data-key="b40aabcf-01f8-4be2-bc3d-9157cbdb395f">
|
|
900
|
+
<span class="TreeLabel TreeLabelName">
|
|
901
|
+
<span class="TreeLabelNameText">
|
|
902
|
+
<span class="TreeLabelNameTextHeadline">Truck Group East</span>
|
|
903
|
+
</span>
|
|
904
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">7</span>
|
|
905
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
906
|
+
</span>
|
|
907
|
+
</span>
|
|
908
|
+
</div>
|
|
909
|
+
</div>
|
|
910
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open" data-id="6ba7c2ec-8bd4-4470-98a4-313c9d33e8d5">
|
|
911
|
+
<div class="TreeNode from-group" data-key="6ba7c2ec-8bd4-4470-98a4-313c9d33e8d5">
|
|
912
|
+
<span class="TreeLabel TreeLabelName">
|
|
913
|
+
<span class="TreeLabelNameText">
|
|
914
|
+
<span class="TreeLabelNameTextHeadline">Truck Group North</span>
|
|
915
|
+
</span>
|
|
916
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">2</span>
|
|
917
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
918
|
+
</span>
|
|
919
|
+
</span>
|
|
920
|
+
</div>
|
|
921
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d9726">
|
|
922
|
+
<span class="TreeLabel TreeLabelName">
|
|
923
|
+
<span class="rioglyph rioglyph-bus">
|
|
924
|
+
</span>
|
|
925
|
+
<span class="TreeLabelNameText">
|
|
926
|
+
<span class="TreeLabelNameTextHeadline">N18-G566 / M-AN 1026</span>
|
|
927
|
+
</span>
|
|
928
|
+
</span>
|
|
929
|
+
</div>
|
|
930
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d973">
|
|
931
|
+
<span class="TreeLabel TreeLabelName">
|
|
932
|
+
<span class="rioglyph rioglyph-van">
|
|
933
|
+
</span>
|
|
934
|
+
<span class="TreeLabelNameText">
|
|
935
|
+
<span class="TreeLabelNameTextHeadline">N18-G990 / M-AN 1003</span>
|
|
936
|
+
</span>
|
|
937
|
+
</span>
|
|
938
|
+
</div>
|
|
939
|
+
</div>
|
|
940
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="722a5f86-eb6c-46cf-83da-3f8dbfbcca5e">
|
|
941
|
+
<div class="TreeNode from-group" data-key="722a5f86-eb6c-46cf-83da-3f8dbfbcca5e">
|
|
942
|
+
<span class="TreeLabel TreeLabelName">
|
|
943
|
+
<span class="TreeLabelNameText">
|
|
944
|
+
<span class="TreeLabelNameTextHeadline">Truck Group South</span>
|
|
945
|
+
</span>
|
|
946
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">6</span>
|
|
947
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
948
|
+
</span>
|
|
949
|
+
</span>
|
|
950
|
+
</div>
|
|
951
|
+
</div>
|
|
952
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="0250a8aa-721e-40b4-b1ea-7908acddfdf4">
|
|
953
|
+
<div class="TreeNode from-group" data-key="0250a8aa-721e-40b4-b1ea-7908acddfdf4">
|
|
954
|
+
<span class="TreeLabel TreeLabelName">
|
|
955
|
+
<span class="TreeLabelNameText">
|
|
956
|
+
<span class="TreeLabelNameTextHeadline">Truck Group West</span>
|
|
957
|
+
</span>
|
|
958
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">4</span>
|
|
959
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
960
|
+
</span>
|
|
961
|
+
</span>
|
|
962
|
+
</div>
|
|
963
|
+
</div>
|
|
964
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="static/unassignedTrucks">
|
|
965
|
+
<div class="TreeNode from-group" data-key="static/unassignedTrucks">
|
|
966
|
+
<span class="TreeLabel TreeLabelName">
|
|
967
|
+
<span class="TreeLabelNameText">
|
|
968
|
+
<span class="TreeLabelNameTextHeadline">All my unassigned Trucks</span>
|
|
969
|
+
</span>
|
|
970
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">6</span>
|
|
971
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
972
|
+
</span>
|
|
973
|
+
</span>
|
|
974
|
+
</div>
|
|
975
|
+
</div>
|
|
976
|
+
</div>
|
|
977
|
+
</div>
|
|
978
|
+
</div>
|
|
979
|
+
</div>
|
|
980
|
+
<div class="scrollbar-track-horizontal" style="position: absolute; height: 6px; display: none;">
|
|
981
|
+
<div class="scrollbar-thumb-horizontal" style="position: relative; display: block; height: 100%;">
|
|
982
|
+
</div>
|
|
983
|
+
</div>
|
|
984
|
+
<div class="scrollbar-track-vertical" style="position: absolute; width: 6px; display: none;">
|
|
985
|
+
<div class="scrollbar-thumb-vertical" style="position: relative; display: block; width: 100%;">
|
|
986
|
+
</div>
|
|
987
|
+
</div>
|
|
988
|
+
</div>
|
|
989
|
+
</div>
|
|
990
|
+
<div class="Resizer resize-horizontal resize-right">
|
|
991
|
+
</div>
|
|
992
|
+
</div>
|
|
993
|
+
</div>
|
|
994
|
+
<div>
|
|
995
|
+
<div class="h6">Current category:</div>
|
|
996
|
+
<ul>assets</ul>
|
|
997
|
+
<div class="h6">Selected tree groups:</div>
|
|
998
|
+
<ul>
|
|
999
|
+
</ul>
|
|
1000
|
+
<div class="h6">Selected assets:</div>
|
|
1001
|
+
<ul>
|
|
1002
|
+
</ul>
|
|
1003
|
+
<div class="h6">Expanded tree groups:</div>
|
|
1004
|
+
<ul>
|
|
1005
|
+
<li>Truck Group North</li>
|
|
1006
|
+
</ul>
|
|
1007
|
+
</div>
|
|
1008
|
+
</div>
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
#### Props: AssetTree
|
|
1012
|
+
|
|
1013
|
+
### AssetTree
|
|
1014
|
+
|
|
1015
|
+
| Name | Type | Default | Description |
|
|
1016
|
+
| --- | --- | --- | --- |
|
|
1017
|
+
| fly | boolean | false | Defines if the component will overlap the body content. |
|
|
1018
|
+
| resizable | boolean | true | Defines whether or not the sidebar is resizable. |
|
|
1019
|
+
| onResizeEnd | Function | () => {} | Callback for when the resize is done. |
|
|
1020
|
+
| bordered | boolean | false | Defines whether the component has a border or not. |
|
|
1021
|
+
| width | string / number | 350 | Defines the width of the component. The value is set as inline style. Note: when component is resizable it will take the provided width in px only and convert it to number in case. |
|
|
1022
|
+
| minWidth | number | 100 | Defines the minimum width of the component in px that will take effect when resizing. |
|
|
1023
|
+
| maxWidth | number | 0 | Defines the maximum width of the component in px that will take effect when resizing. |
|
|
1024
|
+
| height | number | — | Defines the height of the component in px. |
|
|
1025
|
+
| isOpen | boolean | true | Defines whether the component is open or not. |
|
|
1026
|
+
| onToggleTree | Function | () => {} | Callback for when the tree visibility is toggled. |
|
|
1027
|
+
| currentCategoryId | string | — | The id of the category which is currently active and shall be shown. |
|
|
1028
|
+
| onCategoryChange | Function | () => {} | Callback for handling change of category. |
|
|
1029
|
+
| useOffscreen | boolean | false | Defines whether the tree components are rendered offscreen and kept mounted in the DOM. |
|
|
1030
|
+
| className | String | — | Additional classes added on the wrapper element. |
|
|
1031
|
+
| children | TreeCategory | — | A list of TreeCategory components |
|
|
1032
|
+
|
|
1033
|
+
#### Props: TreeCategory
|
|
1034
|
+
|
|
1035
|
+
### TreeCategory
|
|
1036
|
+
|
|
1037
|
+
| Name | Type | Default | Description |
|
|
1038
|
+
| --- | --- | --- | --- |
|
|
1039
|
+
| id | String | — | A unique identifier for that category. |
|
|
1040
|
+
| icon | String | — | The rioglyph icon name for that category. |
|
|
1041
|
+
| label | String / Node | — | The optional label for the category which will be shown in a tooltip. |
|
|
1042
|
+
| hasSelection | boolean | — | Defines whether or not a selection indicator should be shown. |
|
|
1043
|
+
|
|
1044
|
+
#### Props: Tree
|
|
1045
|
+
|
|
1046
|
+
### Tree
|
|
1047
|
+
|
|
1048
|
+
| Name | Type | Default | Description |
|
|
1049
|
+
| --- | --- | --- | --- |
|
|
1050
|
+
| groups | Array of objects | [] | The list of groups of the items. If no groups are provided all items are rendered as flat list. |
|
|
1051
|
+
| └id | String | — | A unique identifier of a group. |
|
|
1052
|
+
| └name | String | — | The name of a group. |
|
|
1053
|
+
| └position | string | — | Can be set to "last" to enforce the last position in the tree. |
|
|
1054
|
+
| └disabled | Boolean | — | Disallows the selection of the group itself. |
|
|
1055
|
+
| └className | String | — | Additional classes added to the group element. |
|
|
1056
|
+
| items | Array of Objects | [] | The list of items. |
|
|
1057
|
+
| └id | String | — | A unique identifier of an item. |
|
|
1058
|
+
| └name | string / object | — | The name of an item. Either it is a plain string or an object composed of: firstName and lastName where lastName is mandatory |
|
|
1059
|
+
| └info | String \| Node | — | The subline of an item. |
|
|
1060
|
+
| └type | string | — | The primary type of the item. This is also used as the fallback icon name and refers to the name of the respective rioglyph icon (excluding the `rioglyph-` prefix). |
|
|
1061
|
+
| └subType | string | — | The sub type of an item which is also the name of the respective rioglyph icon without the prefix. This could be used to show a secondary paired icon like for fuel type. |
|
|
1062
|
+
| └icon | string | — | The rioglyph icon name for a group. The prefix `rioglyph-` can be omitted. |
|
|
1063
|
+
| └icon | string \| null | — | Optional icon override for the item. If set to a string (e.g. `'truck'`), this icon will be used explicitly. If set to `undefined`, the `type` property will be used as the fallback icon. If set to `null`, no icon will be rendered, even if `type` is defined. This allows full control over the icon behavior while maintaining backward compatibility with type-based icons. |
|
|
1064
|
+
| └groupIds | Array of strings | [] | List of group ids the items is associated with. |
|
|
1065
|
+
| └className | string | — | Additional classes added to the item element. |
|
|
1066
|
+
| selectedGroups | Array of strings | — | List of selected group ids. |
|
|
1067
|
+
| selectedItems | Array of strings | — | List of selected item ids. |
|
|
1068
|
+
| onSelectionChange | Function | — | Merged Callback for item and group selection changes. It responds with a selection object that contains the selected itemIds and groupIds: { items: [], groups: [] } |
|
|
1069
|
+
| hasMultiselect | boolean | true | Defines the selection behavior of the tree. |
|
|
1070
|
+
| showRadioButtons | boolean | false | Defines if the single selection should also show radios. |
|
|
1071
|
+
| hideSearch | boolean | false | Defines whether or not the built-in Search is shown. |
|
|
1072
|
+
| searchPlaceholder | string | — | The text used as placeholder for the search input. |
|
|
1073
|
+
| onSearchChange | Function | — | Callback for when the search value changes. |
|
|
1074
|
+
| search | node | — | Used to define custom custom search component which replaces the built-in search. |
|
|
1075
|
+
| onTypeFilterChange | (currentTypes: string[]) => void | — | Callback triggered when the built-in asset type filter changes. This is only available when the default summary is used. |
|
|
1076
|
+
| summary | node | — | Used to define custom asset type counter component which replaces the built-in summary. |
|
|
1077
|
+
| hideSummary | boolean | false | Defines whether a summary is shown. |
|
|
1078
|
+
| hideTreeHead | boolean | false | Defines whether the entire area below the search field is shown or not. Note: Disabling the tree head will hide the select all checkbox and the tree options as well as the tree summary. |
|
|
1079
|
+
| treeHeaderContent | ReactNode | — | Additional custom content that is rendered at the top of the tree component. This can be used for nav pills. |
|
|
1080
|
+
| scrollHeight | Number | — | Defines the max-height of the scrollable list |
|
|
1081
|
+
| expandedGroups | Array of String | — | List of group ids which are expanded. |
|
|
1082
|
+
| onExpandGroupsChange | Function | — | Callback function triggered when a group expands or collapses. |
|
|
1083
|
+
| showEmptyGroups | boolean | true | Defines whether empty groups are shown or not. |
|
|
1084
|
+
| treeOptions | ReactNode | — | Component to offer customization options for the tree. |
|
|
1085
|
+
| treeOptionsTooltip | ReactNode | — | Tooltip content for the tree options dropdown. |
|
|
1086
|
+
| virtualizeThreshold | number | 50 | The number of items (including groups and children) used for virtualizing the tree. |
|
|
1087
|
+
| overscan | number | 5 | The number of items rendered beyond the visible area of a virtualized tree. |
|
|
1088
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
1089
|
+
|
|
1090
|
+
#### Props: TreeSearch
|
|
1091
|
+
|
|
1092
|
+
### TreeSearch
|
|
1093
|
+
|
|
1094
|
+
| Name | Type | Default | Description |
|
|
1095
|
+
| --- | --- | --- | --- |
|
|
1096
|
+
| value | String | — | The search value to be shown and used for the search. |
|
|
1097
|
+
| onChange | Function | () => {} | Callback for when the search value changes. |
|
|
1098
|
+
| placeholder | String | — | The placeholder text used for the input field. |
|
|
1099
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
1100
|
+
|
|
1101
|
+
#### Props: TreeSummary
|
|
1102
|
+
|
|
1103
|
+
### TreeSummary
|
|
1104
|
+
|
|
1105
|
+
| Name | Type | Default | Description |
|
|
1106
|
+
| --- | --- | --- | --- |
|
|
1107
|
+
| assetCounts | object | — | The object containing various asset type counter. |
|
|
1108
|
+
| └truck | number | — | The amount of trucks. |
|
|
1109
|
+
| └trailer | number | — | The amount of trailers. |
|
|
1110
|
+
| └bus | number | — | The amount of buses. |
|
|
1111
|
+
| └van | number | — | The amount of vans. |
|
|
1112
|
+
| └driver | number | — | The amount of drivers. |
|
|
1113
|
+
| gridCols | number | 4 | The number of grid columns used for the built-in TreeSummaryRow |
|
|
1114
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
1115
|
+
|
|
1116
|
+
#### Props: TreeSummaryRow
|
|
1117
|
+
|
|
1118
|
+
### TreeSummaryRow
|
|
1119
|
+
|
|
1120
|
+
| Name | Type | Default | Description |
|
|
1121
|
+
| --- | --- | --- | --- |
|
|
1122
|
+
| gridCols | number | 4 | Defined the number of grid columns for a single row. Note, when the amount of children exceed the columns it will wrap around to a new line. |
|
|
1123
|
+
|
|
1124
|
+
#### Props: TypeCounter
|
|
1125
|
+
|
|
1126
|
+
### TypeCounter
|
|
1127
|
+
|
|
1128
|
+
| Name | Type | Default | Description |
|
|
1129
|
+
| --- | --- | --- | --- |
|
|
1130
|
+
| type | string | — | The item type for that counter. This will be used as a return value for the onClick callback. |
|
|
1131
|
+
| icon | string | — | The icon name. Note, when using the built-in generic type counter, the icon name will the same as the item type. So make sure there is a corresponding icon for the defined type. |
|
|
1132
|
+
| isActive | Boolean | — | Sets the active styling if active. |
|
|
1133
|
+
| hasFilter | boolean | — | Should be set when there is a type filter set in the tree to style the counter accordingly. |
|
|
1134
|
+
| enableActivity | boolean | — | Allows for interactivity. Use this prop when you allow clicking on the counter. |
|
|
1135
|
+
| hideOnZero | boolean | false | Defines if the counter is rendered at all when the value is not defined ot 0. |
|
|
1136
|
+
| onClick | Function | — | Callback function when the counter is clicked. It returns the type value.Make sure the "type" prop is defined to receive the value in the callback and the flag "enableActivity" is set to true otherwise the callback is not triggered. |
|
|
1137
|
+
| value | String / Number / Node | — | A custom value to be shown in the counter. |
|
|
1138
|
+
|
|
1139
|
+
#### Props: TreeOption
|
|
1140
|
+
|
|
1141
|
+
### TreeOption
|
|
1142
|
+
|
|
1143
|
+
| Name | Type | Default | Description |
|
|
1144
|
+
| --- | --- | --- | --- |
|
|
1145
|
+
| isChecked | boolean | — | Defines whether the option is set. |
|
|
1146
|
+
| label | string / node | — | The label for the option. |
|
|
1147
|
+
| onChange | Function | — | Callback triggered when option is selected. |
|
|
1148
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
1149
|
+
|
|
1150
|
+
## AssetTree with multiple asset filter in summary
|
|
1151
|
+
|
|
1152
|
+
When using fuel filter, please check out the fuel type utils that ease the implementation of mapping vehicle fuel types to common fuel type groups.
|
|
1153
|
+
|
|
1154
|
+
### Example: Example 3
|
|
1155
|
+
|
|
1156
|
+
6
|
|
1157
|
+
7
|
|
1158
|
+
3
|
|
1159
|
+
4
|
|
1160
|
+
|
|
1161
|
+
10
|
|
1162
|
+
1
|
|
1163
|
+
2
|
|
1164
|
+
4
|
|
1165
|
+
3
|
|
1166
|
+
|
|
1167
|
+
Mixed Vehicles13
|
|
1168
|
+
|
|
1169
|
+
Vehicle-1755Debug: diesel
|
|
1170
|
+
|
|
1171
|
+
Vehicle-3278Debug: dual_fuel_diesel_cng
|
|
1172
|
+
|
|
1173
|
+
Vehicle-3365Debug: electric
|
|
1174
|
+
|
|
1175
|
+
Vehicle-4034Debug: diesel
|
|
1176
|
+
|
|
1177
|
+
Vehicle-5000Debug: diesel
|
|
1178
|
+
|
|
1179
|
+
Vehicle-7205Debug: hydrogen
|
|
1180
|
+
|
|
1181
|
+
Vehicle-7245Debug: hydrogen
|
|
1182
|
+
|
|
1183
|
+
Vehicle-7410Debug: diesel
|
|
1184
|
+
|
|
1185
|
+
Vehicle-8099Debug: heavy_fuel_oil
|
|
1186
|
+
|
|
1187
|
+
Vehicle-8194Debug: heavy_fuel_oil
|
|
1188
|
+
|
|
1189
|
+
Vehicle-8207Debug: lpg
|
|
1190
|
+
|
|
1191
|
+
Selected groups:
|
|
1192
|
+
|
|
1193
|
+
Selected vehicles:
|
|
1194
|
+
|
|
1195
|
+
Expanded groups:
|
|
1196
|
+
Mixed Vehicles
|
|
1197
|
+
|
|
1198
|
+
#### Summary
|
|
1199
|
+
|
|
1200
|
+
6
|
|
1201
|
+
7
|
|
1202
|
+
3
|
|
1203
|
+
4
|
|
1204
|
+
|
|
1205
|
+
10
|
|
1206
|
+
1
|
|
1207
|
+
2
|
|
1208
|
+
4
|
|
1209
|
+
3
|
|
1210
|
+
|
|
1211
|
+
Mixed Vehicles13
|
|
1212
|
+
|
|
1213
|
+
Vehicle-1755Debug: diesel
|
|
1214
|
+
|
|
1215
|
+
Vehicle-3278Debug: dual_fuel_diesel_cng
|
|
1216
|
+
|
|
1217
|
+
Vehicle-3365Debug: electric
|
|
1218
|
+
|
|
1219
|
+
Vehicle-4034Debug: diesel
|
|
1220
|
+
|
|
1221
|
+
Vehicle-5000Debug: diesel
|
|
1222
|
+
|
|
1223
|
+
Vehicle-7205Debug: hydrogen
|
|
1224
|
+
|
|
1225
|
+
Vehicle-7245Debug: hydrogen
|
|
1226
|
+
|
|
1227
|
+
Vehicle-7410Debug: diesel
|
|
1228
|
+
|
|
1229
|
+
Vehicle-8099Debug: heavy_fuel_oil
|
|
1230
|
+
|
|
1231
|
+
Vehicle-8194Debug: heavy_fuel_oil
|
|
1232
|
+
|
|
1233
|
+
Vehicle-8207Debug: lpg
|
|
1234
|
+
|
|
1235
|
+
Selected groups:
|
|
1236
|
+
|
|
1237
|
+
Selected vehicles:
|
|
1238
|
+
|
|
1239
|
+
Expanded groups:
|
|
1240
|
+
Mixed Vehicles
|
|
1241
|
+
|
|
1242
|
+
#### React (tsx)
|
|
1243
|
+
|
|
1244
|
+
```tsx
|
|
1245
|
+
import { useMemo, useState } from 'react';
|
|
1246
|
+
import { isEmpty, random } from 'es-toolkit/compat';
|
|
1247
|
+
import faker from 'faker';
|
|
1248
|
+
|
|
1249
|
+
import AssetTree from '@rio-cloud/rio-uikit/AssetTree';
|
|
1250
|
+
import TreeCategory from '@rio-cloud/rio-uikit/TreeCategory';
|
|
1251
|
+
import Tree, {
|
|
1252
|
+
type TreeGroup,
|
|
1253
|
+
type TreeItem,
|
|
1254
|
+
type SelectionChangeResponse,
|
|
1255
|
+
getTypeCounts,
|
|
1256
|
+
} from '@rio-cloud/rio-uikit/Tree';
|
|
1257
|
+
import TreeOption from '@rio-cloud/rio-uikit/TreeOption';
|
|
1258
|
+
import TreeSummary, { type TreeSummaryCounts } from '@rio-cloud/rio-uikit/TreeSummary';
|
|
1259
|
+
import TreeSummaryRow from '@rio-cloud/rio-uikit/TreeSummaryRow';
|
|
1260
|
+
import TypeCounter from '@rio-cloud/rio-uikit/TypeCounter';
|
|
1261
|
+
import {
|
|
1262
|
+
countFuelTypeGroups,
|
|
1263
|
+
filterByFuelTypeGroup,
|
|
1264
|
+
fuelTypeGroups,
|
|
1265
|
+
getFuelIcon,
|
|
1266
|
+
getFuelTypeGroupIcon,
|
|
1267
|
+
type FuelType,
|
|
1268
|
+
type FuelTypeGroup,
|
|
1269
|
+
} from '@rio-cloud/rio-uikit/fuelTypeUtils';
|
|
1270
|
+
|
|
1271
|
+
const toggleListItem = (list: string[], item: string) => {
|
|
1272
|
+
const set = new Set(list);
|
|
1273
|
+
if (set.has(item)) {
|
|
1274
|
+
set.delete(item);
|
|
1275
|
+
} else {
|
|
1276
|
+
set.add(item);
|
|
1277
|
+
}
|
|
1278
|
+
return [...set];
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1281
|
+
const truckGroups: TreeGroup[] = [
|
|
1282
|
+
{
|
|
1283
|
+
id: 'group-1',
|
|
1284
|
+
name: 'Mixed Vehicles',
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
id: 'unassigned-group',
|
|
1288
|
+
name: 'Ungrouped',
|
|
1289
|
+
position: 'last',
|
|
1290
|
+
},
|
|
1291
|
+
];
|
|
1292
|
+
|
|
1293
|
+
const assetTypes = ['truck', 'bus', 'van', 'car'];
|
|
1294
|
+
const fuelTypes = ['diesel', 'electric', 'gas', 'hydrogen', 'cng', 'lpg', 'dual_fuel_diesel_cng', 'heavy_fuel_oil'];
|
|
1295
|
+
|
|
1296
|
+
const getVehicles = (withSubType = true): TreeItem[] =>
|
|
1297
|
+
Array.from({ length: 20 }, (_, index) => {
|
|
1298
|
+
const fuelType = withSubType ? faker.random.arrayElement(fuelTypes) : undefined;
|
|
1299
|
+
return {
|
|
1300
|
+
id: `010191ac-d06d-4567-b13a-7b7fd85d97${index}`,
|
|
1301
|
+
name: `Vehicle-${random(1000, 9999)}`,
|
|
1302
|
+
info: <span>Debug: {fuelType}</span>,
|
|
1303
|
+
type: faker.random.arrayElement(assetTypes),
|
|
1304
|
+
subType: fuelType, // subType cannot be used as icon here anymore
|
|
1305
|
+
pairIcon: getFuelIcon(fuelType),
|
|
1306
|
+
groupIds: [faker.random.arrayElement(truckGroups).id],
|
|
1307
|
+
};
|
|
1308
|
+
});
|
|
1309
|
+
|
|
1310
|
+
const defaultExpandedTruckGroups = ['group-1'];
|
|
1311
|
+
|
|
1312
|
+
const getAssetTypeCounts = getTypeCounts;
|
|
1313
|
+
const getFuelTypeCounts = (items: TreeItem[]) => countFuelTypeGroups(items, item => item.subType as FuelType);
|
|
1314
|
+
|
|
1315
|
+
const AssetTreeExample = () => {
|
|
1316
|
+
const [selectedTruckGroupIds, setSelectedTruckGroupIds] = useState<string[]>([]);
|
|
1317
|
+
const [selectedTruckIds, setSelectedTruckIds] = useState<string[]>([]);
|
|
1318
|
+
const [expandedTruckGroups, setExpandedTruckGroups] = useState(defaultExpandedTruckGroups);
|
|
1319
|
+
|
|
1320
|
+
const [isTreeOpen, setIsTreeOpen] = useState(true);
|
|
1321
|
+
|
|
1322
|
+
const [showEmptyGroups, setShowEmptyGroups] = useState(false);
|
|
1323
|
+
const [showAssetGroups, setShowAssetGroups] = useState(true);
|
|
1324
|
+
const [showFuelType, setShowFuelType] = useState(true);
|
|
1325
|
+
|
|
1326
|
+
const [activeAssetTypeFilter, setActiveAssetTypeFilter] = useState<string[]>([]);
|
|
1327
|
+
const [activeFuelTypeGroupFilter, setActiveFuelTypeGroupFilter] = useState<string[]>([]);
|
|
1328
|
+
|
|
1329
|
+
const [counters, setCounters] = useState<TreeSummaryCounts>({});
|
|
1330
|
+
const [fuelCounters, setFuelCounters] = useState<Record<string, number>>({});
|
|
1331
|
+
|
|
1332
|
+
const items = useMemo(() => {
|
|
1333
|
+
// Regenerate vehicles to omit the fuel type data used for the sub type
|
|
1334
|
+
const result = getVehicles(showFuelType);
|
|
1335
|
+
|
|
1336
|
+
// Count again all vehicle types and sub types
|
|
1337
|
+
setCounters(getAssetTypeCounts(result));
|
|
1338
|
+
setFuelCounters(getFuelTypeCounts(result));
|
|
1339
|
+
|
|
1340
|
+
return result;
|
|
1341
|
+
}, [showFuelType]);
|
|
1342
|
+
|
|
1343
|
+
const filteredItems = useMemo(() => {
|
|
1344
|
+
let result = items;
|
|
1345
|
+
|
|
1346
|
+
// filter by asset type
|
|
1347
|
+
if (!isEmpty(activeAssetTypeFilter)) {
|
|
1348
|
+
result = result.filter(item => activeAssetTypeFilter.includes(item.type));
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
// filter by fuel type
|
|
1352
|
+
if (!isEmpty(activeFuelTypeGroupFilter)) {
|
|
1353
|
+
result = filterByFuelTypeGroup(
|
|
1354
|
+
result,
|
|
1355
|
+
activeFuelTypeGroupFilter as FuelTypeGroup[],
|
|
1356
|
+
item => item.subType as FuelType
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
return result;
|
|
1361
|
+
}, [items, activeAssetTypeFilter, activeFuelTypeGroupFilter]);
|
|
1362
|
+
|
|
1363
|
+
const handleSelectTruck = ({ items, groups }: SelectionChangeResponse) => {
|
|
1364
|
+
setSelectedTruckIds(items);
|
|
1365
|
+
setSelectedTruckGroupIds(groups);
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
const handleExpandTruckGroups = (newExpandedTruckGroups: string[]) =>
|
|
1369
|
+
setExpandedTruckGroups(newExpandedTruckGroups);
|
|
1370
|
+
|
|
1371
|
+
const handleToggleTree = (toggle: boolean) => setIsTreeOpen(toggle);
|
|
1372
|
+
const handleToggleEmptyGroups = () => setShowEmptyGroups(!showEmptyGroups);
|
|
1373
|
+
const handleToggleAssetGroups = () => setShowAssetGroups(!showAssetGroups);
|
|
1374
|
+
const handleToggleFuelType = () => {
|
|
1375
|
+
setShowFuelType(!showFuelType);
|
|
1376
|
+
setActiveFuelTypeGroupFilter([]);
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
const handleSearchChange = (searchValue: string) => {
|
|
1380
|
+
const filteredAssets = filteredItems.filter(item =>
|
|
1381
|
+
(item.name as string).toLowerCase().includes(searchValue.toLowerCase())
|
|
1382
|
+
);
|
|
1383
|
+
};
|
|
1384
|
+
|
|
1385
|
+
const handleAssetTypeFilterChange = (assetTypeFilter: string) => {
|
|
1386
|
+
setActiveAssetTypeFilter(toggleListItem(activeAssetTypeFilter, assetTypeFilter));
|
|
1387
|
+
};
|
|
1388
|
+
|
|
1389
|
+
const handleFuelTypeGroupFilterChange = (fuelTypeGroupFilter: string) => {
|
|
1390
|
+
setActiveFuelTypeGroupFilter(toggleListItem(activeFuelTypeGroupFilter, fuelTypeGroupFilter));
|
|
1391
|
+
};
|
|
1392
|
+
|
|
1393
|
+
const renderSelectedItemsOfList = (selectedItemIds: string[], list: TreeGroup[] | TreeItem[]) => {
|
|
1394
|
+
return selectedItemIds.map(selectedItemId => {
|
|
1395
|
+
const result = list.find(listItem => listItem.id === selectedItemId);
|
|
1396
|
+
if (result) {
|
|
1397
|
+
return <li key={selectedItemId}>{`${result.name}`}</li>;
|
|
1398
|
+
}
|
|
1399
|
+
return null;
|
|
1400
|
+
});
|
|
1401
|
+
};
|
|
1402
|
+
|
|
1403
|
+
return (
|
|
1404
|
+
<div className='display-flex flex-wrap gap-25 overflow-auto'>
|
|
1405
|
+
<AssetTree
|
|
1406
|
+
bordered
|
|
1407
|
+
minWidth={300}
|
|
1408
|
+
maxWidth={450}
|
|
1409
|
+
height={500}
|
|
1410
|
+
isOpen={isTreeOpen}
|
|
1411
|
+
onToggleTree={handleToggleTree}
|
|
1412
|
+
currentCategoryId='trucks'
|
|
1413
|
+
useOffscreen
|
|
1414
|
+
>
|
|
1415
|
+
<TreeCategory
|
|
1416
|
+
key='trucks'
|
|
1417
|
+
id='trucks'
|
|
1418
|
+
label='Assets'
|
|
1419
|
+
icon='rioglyph-truck'
|
|
1420
|
+
hasSelection={!isEmpty(selectedTruckIds) || !isEmpty(selectedTruckGroupIds)}
|
|
1421
|
+
>
|
|
1422
|
+
<Tree
|
|
1423
|
+
groups={showAssetGroups ? truckGroups : []}
|
|
1424
|
+
items={filteredItems}
|
|
1425
|
+
expandedGroups={expandedTruckGroups}
|
|
1426
|
+
onExpandGroupsChange={handleExpandTruckGroups}
|
|
1427
|
+
selectedGroups={selectedTruckGroupIds}
|
|
1428
|
+
selectedItems={selectedTruckIds}
|
|
1429
|
+
onSelectionChange={handleSelectTruck}
|
|
1430
|
+
searchPlaceholder='Find vehicle'
|
|
1431
|
+
showEmptyGroups={showEmptyGroups}
|
|
1432
|
+
onSearchChange={handleSearchChange}
|
|
1433
|
+
virtualizeThreshold={14}
|
|
1434
|
+
summary={
|
|
1435
|
+
<TreeSummary>
|
|
1436
|
+
<TreeSummaryRow>
|
|
1437
|
+
{assetTypes.map(assetType => (
|
|
1438
|
+
<TypeCounter
|
|
1439
|
+
key={assetType}
|
|
1440
|
+
type={assetType}
|
|
1441
|
+
icon={`${assetType}-baseline`}
|
|
1442
|
+
value={(counters as Record<string, number>)[assetType]}
|
|
1443
|
+
isActive={activeAssetTypeFilter.includes(assetType)}
|
|
1444
|
+
hasFilter={!isEmpty(activeAssetTypeFilter)}
|
|
1445
|
+
onClick={handleAssetTypeFilterChange}
|
|
1446
|
+
enableActivity
|
|
1447
|
+
hideOnZero
|
|
1448
|
+
/>
|
|
1449
|
+
))}
|
|
1450
|
+
</TreeSummaryRow>
|
|
1451
|
+
<TreeSummaryRow>
|
|
1452
|
+
{showFuelType &&
|
|
1453
|
+
fuelTypeGroups.map(fuelTypeGroup => (
|
|
1454
|
+
<TypeCounter
|
|
1455
|
+
key={fuelTypeGroup}
|
|
1456
|
+
type={fuelTypeGroup}
|
|
1457
|
+
icon={getFuelTypeGroupIcon(fuelTypeGroup)}
|
|
1458
|
+
value={fuelCounters[fuelTypeGroup]}
|
|
1459
|
+
isActive={activeFuelTypeGroupFilter.includes(fuelTypeGroup)}
|
|
1460
|
+
hasFilter={!isEmpty(activeFuelTypeGroupFilter)}
|
|
1461
|
+
onClick={handleFuelTypeGroupFilterChange}
|
|
1462
|
+
enableActivity
|
|
1463
|
+
hideOnZero
|
|
1464
|
+
/>
|
|
1465
|
+
))}
|
|
1466
|
+
</TreeSummaryRow>
|
|
1467
|
+
</TreeSummary>
|
|
1468
|
+
}
|
|
1469
|
+
treeOptionsTooltip='Customize view'
|
|
1470
|
+
treeOptions={[
|
|
1471
|
+
<TreeOption
|
|
1472
|
+
key='emptyGroupsToggle'
|
|
1473
|
+
label='Show empty groups'
|
|
1474
|
+
isChecked={showEmptyGroups}
|
|
1475
|
+
onChange={handleToggleEmptyGroups}
|
|
1476
|
+
/>,
|
|
1477
|
+
<TreeOption
|
|
1478
|
+
key='assetGroupsToggle'
|
|
1479
|
+
label='Show groups'
|
|
1480
|
+
isChecked={showAssetGroups}
|
|
1481
|
+
onChange={handleToggleAssetGroups}
|
|
1482
|
+
/>,
|
|
1483
|
+
<hr key='hr' className='width-100pct margin-y-5' />,
|
|
1484
|
+
<TreeOption
|
|
1485
|
+
key='fuelTypeToggle'
|
|
1486
|
+
label='Show alternative fuel types'
|
|
1487
|
+
isChecked={showFuelType}
|
|
1488
|
+
onChange={handleToggleFuelType}
|
|
1489
|
+
/>,
|
|
1490
|
+
]}
|
|
1491
|
+
/>
|
|
1492
|
+
</TreeCategory>
|
|
1493
|
+
</AssetTree>
|
|
1494
|
+
<div>
|
|
1495
|
+
<div className='h6'>Selected groups:</div>
|
|
1496
|
+
<ul>{renderSelectedItemsOfList(selectedTruckGroupIds, truckGroups)}</ul>
|
|
1497
|
+
<div className='h6'>Selected vehicles:</div>
|
|
1498
|
+
<ul>{renderSelectedItemsOfList(selectedTruckIds, items)}</ul>
|
|
1499
|
+
<div className='h6'>Expanded groups:</div>
|
|
1500
|
+
<ul>{renderSelectedItemsOfList(expandedTruckGroups, truckGroups)}</ul>
|
|
1501
|
+
</div>
|
|
1502
|
+
</div>
|
|
1503
|
+
);
|
|
1504
|
+
};
|
|
1505
|
+
|
|
1506
|
+
export default AssetTreeExample;
|
|
1507
|
+
```
|
|
1508
|
+
|
|
1509
|
+
#### HTML (html)
|
|
1510
|
+
|
|
1511
|
+
```html
|
|
1512
|
+
<div class="display-flex flex-wrap gap-25 overflow-auto">
|
|
1513
|
+
<div class="AssetTree border fluid" style="width: 350px; height: 500px;">
|
|
1514
|
+
<div class="AssetTreeResizeLimit" style="left: 450px;">
|
|
1515
|
+
</div>
|
|
1516
|
+
<div class="AssetTreeContent">
|
|
1517
|
+
<div class="TreeSidebar">
|
|
1518
|
+
<ul class="TreeSidebarNavigation">
|
|
1519
|
+
<li class="active">
|
|
1520
|
+
<div class="selection-bubble">
|
|
1521
|
+
<span class="rioglyph rioglyph-truck">
|
|
1522
|
+
</span>
|
|
1523
|
+
</div>
|
|
1524
|
+
</li>
|
|
1525
|
+
</ul>
|
|
1526
|
+
<div class="TreeSidebarToggle">
|
|
1527
|
+
<span class="rioglyph rioglyph-chevron-left">
|
|
1528
|
+
</span>
|
|
1529
|
+
</div>
|
|
1530
|
+
</div>
|
|
1531
|
+
<div class="AssetTreeBody scrollbar-fly-in smooth-scrollbar-wrapper" style="position: relative; overflow: hidden; width: 100%; height: 100%;">
|
|
1532
|
+
<div class="scrollbar-view" style="position: absolute; inset: 0px; overflow: scroll; margin-right: 0px; margin-bottom: 0px;">
|
|
1533
|
+
<div class="scrollbar-content-wrapper">
|
|
1534
|
+
<div class="TreeOffscreenWrapper">
|
|
1535
|
+
<div class="Tree">
|
|
1536
|
+
<div class="TreeHeader">
|
|
1537
|
+
<div class="TreeSearch">
|
|
1538
|
+
<div class="input-group flex-1-0">
|
|
1539
|
+
<span class="input-group-addon">
|
|
1540
|
+
<span class="rioglyph rioglyph-search" aria-hidden="true">
|
|
1541
|
+
</span>
|
|
1542
|
+
</span>
|
|
1543
|
+
<div class="ClearableInput input-group">
|
|
1544
|
+
<input placeholder="Find vehicle" class="form-control" type="text" tabindex="0" value="">
|
|
1545
|
+
<span class="clearButton hide">
|
|
1546
|
+
<span class="clearButtonIcon rioglyph rioglyph-remove-sign">
|
|
1547
|
+
</span>
|
|
1548
|
+
</span>
|
|
1549
|
+
</div>
|
|
1550
|
+
</div>
|
|
1551
|
+
</div>
|
|
1552
|
+
<div class="TreeHead display-flex gap-5 padding-15">
|
|
1553
|
+
<div class="border border-right-only hidden-empty padding-right-10 margin-right-2">
|
|
1554
|
+
<div class="TreeSelectAll display-flex align-items-center">
|
|
1555
|
+
<label class="checkbox margin-top--1" tabindex="0">
|
|
1556
|
+
<input type="checkbox" class="margin-top--1">
|
|
1557
|
+
<span class="checkbox-text">
|
|
1558
|
+
</span>
|
|
1559
|
+
</label>
|
|
1560
|
+
</div>
|
|
1561
|
+
</div>
|
|
1562
|
+
<div class="display-flex justify-content-between align-items-start width-100pct">
|
|
1563
|
+
<div class="TreeSummary display-flex flex-wrap align-items-center gap-10 padding-left-3">
|
|
1564
|
+
<div class="TreeSummaryRow display-grid grid-cols-4 gap-10">
|
|
1565
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
1566
|
+
<span class="rioglyph rioglyph-truck-baseline text-size-16 margin-right-2">
|
|
1567
|
+
</span>
|
|
1568
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">6</span>
|
|
1569
|
+
</div>
|
|
1570
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
1571
|
+
<span class="rioglyph rioglyph-bus-baseline text-size-16 margin-right-2">
|
|
1572
|
+
</span>
|
|
1573
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">7</span>
|
|
1574
|
+
</div>
|
|
1575
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
1576
|
+
<span class="rioglyph rioglyph-van-baseline text-size-16 margin-right-2">
|
|
1577
|
+
</span>
|
|
1578
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">3</span>
|
|
1579
|
+
</div>
|
|
1580
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
1581
|
+
<span class="rioglyph rioglyph-car-baseline text-size-16 margin-right-2">
|
|
1582
|
+
</span>
|
|
1583
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">4</span>
|
|
1584
|
+
</div>
|
|
1585
|
+
</div>
|
|
1586
|
+
<div class="TreeSummaryRow display-grid grid-cols-4 gap-10">
|
|
1587
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
1588
|
+
<span class="rioglyph rioglyph-fuel-liquid text-size-16 margin-right-2">
|
|
1589
|
+
</span>
|
|
1590
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">10</span>
|
|
1591
|
+
</div>
|
|
1592
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
1593
|
+
<span class="rioglyph rioglyph-fuel-gas text-size-16 margin-right-2">
|
|
1594
|
+
</span>
|
|
1595
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">1</span>
|
|
1596
|
+
</div>
|
|
1597
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
1598
|
+
<span class="rioglyph rioglyph-fuel-electric text-size-16 margin-right-2">
|
|
1599
|
+
</span>
|
|
1600
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">2</span>
|
|
1601
|
+
</div>
|
|
1602
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
1603
|
+
<span class="rioglyph rioglyph-fuel-hydrogen text-size-16 margin-right-2">
|
|
1604
|
+
</span>
|
|
1605
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">4</span>
|
|
1606
|
+
</div>
|
|
1607
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
1608
|
+
<span class="rioglyph rioglyph-fuel-mix text-size-16 margin-right-2">
|
|
1609
|
+
</span>
|
|
1610
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">3</span>
|
|
1611
|
+
</div>
|
|
1612
|
+
</div>
|
|
1613
|
+
</div>
|
|
1614
|
+
</div>
|
|
1615
|
+
<div>
|
|
1616
|
+
<div class="dropdown btn-group TreeHeaderOptions height-20">
|
|
1617
|
+
<button type="button" id="ss2t28tcsx" class="btn btn-default btn-sm btn-icon-only btn-component dropdown-toggle hover-bg-white border-none text-color-gray hover-text-color-dark" tabindex="0">
|
|
1618
|
+
<span class="rioglyph rioglyph-option-vertical" aria-hidden="true">
|
|
1619
|
+
</span>
|
|
1620
|
+
</button>
|
|
1621
|
+
</div>
|
|
1622
|
+
</div>
|
|
1623
|
+
</div>
|
|
1624
|
+
</div>
|
|
1625
|
+
<div class="TreeRoot user-select-none overflow-hidden" style="position: relative;">
|
|
1626
|
+
<div class="tree-virtual-scrollbar scrollbar-fly-in smooth-scrollbar-wrapper" style="position: relative; overflow: hidden; width: 100%; height: 100%;">
|
|
1627
|
+
<div class="scrollbar-view" style="position: absolute; inset: 0px; overflow: scroll; margin-right: 0px; margin-bottom: 0px;">
|
|
1628
|
+
<div class="scrollbar-content-wrapper">
|
|
1629
|
+
<div class="grouped-list" style="height: 784px; position: relative;">
|
|
1630
|
+
<div data-index="0" class="virtualized-tree-item group-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 41px; transform: translateY(0px);">
|
|
1631
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open" data-id="group-1">
|
|
1632
|
+
<div class="TreeNode from-group" data-key="group-1">
|
|
1633
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1634
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1635
|
+
<span class="checkbox-text">
|
|
1636
|
+
</span>
|
|
1637
|
+
</label>
|
|
1638
|
+
<span class="TreeLabel TreeLabelName">
|
|
1639
|
+
<span class="TreeLabelNameText">
|
|
1640
|
+
<span class="TreeLabelNameTextHeadline">Mixed Vehicles</span>
|
|
1641
|
+
</span>
|
|
1642
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">13</span>
|
|
1643
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
1644
|
+
</span>
|
|
1645
|
+
</span>
|
|
1646
|
+
</div>
|
|
1647
|
+
</div>
|
|
1648
|
+
</div>
|
|
1649
|
+
<div data-index="1" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(41px);">
|
|
1650
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1651
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d973">
|
|
1652
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1653
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1654
|
+
<span class="checkbox-text">
|
|
1655
|
+
</span>
|
|
1656
|
+
</label>
|
|
1657
|
+
<span class="TreeLabel TreeLabelName">
|
|
1658
|
+
<span class="rioglyph-icon-pair">
|
|
1659
|
+
<span class="rioglyph rioglyph-van">
|
|
1660
|
+
</span>
|
|
1661
|
+
<span class="rioglyph rioglyph-fuel-liquid">
|
|
1662
|
+
</span>
|
|
1663
|
+
</span>
|
|
1664
|
+
<span class="TreeLabelNameText">
|
|
1665
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-1755</span>
|
|
1666
|
+
<span class="TreeLabelNameTextSubline">
|
|
1667
|
+
<span>Debug: diesel</span>
|
|
1668
|
+
</span>
|
|
1669
|
+
</span>
|
|
1670
|
+
</span>
|
|
1671
|
+
</div>
|
|
1672
|
+
</div>
|
|
1673
|
+
</div>
|
|
1674
|
+
<div data-index="2" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(95px);">
|
|
1675
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1676
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d9714">
|
|
1677
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1678
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1679
|
+
<span class="checkbox-text">
|
|
1680
|
+
</span>
|
|
1681
|
+
</label>
|
|
1682
|
+
<span class="TreeLabel TreeLabelName">
|
|
1683
|
+
<span class="rioglyph-icon-pair">
|
|
1684
|
+
<span class="rioglyph rioglyph-bus">
|
|
1685
|
+
</span>
|
|
1686
|
+
<span class="rioglyph rioglyph-fuel-mix">
|
|
1687
|
+
</span>
|
|
1688
|
+
</span>
|
|
1689
|
+
<span class="TreeLabelNameText">
|
|
1690
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-3278</span>
|
|
1691
|
+
<span class="TreeLabelNameTextSubline">
|
|
1692
|
+
<span>Debug: dual_fuel_diesel_cng</span>
|
|
1693
|
+
</span>
|
|
1694
|
+
</span>
|
|
1695
|
+
</span>
|
|
1696
|
+
</div>
|
|
1697
|
+
</div>
|
|
1698
|
+
</div>
|
|
1699
|
+
<div data-index="3" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(149px);">
|
|
1700
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1701
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d9711">
|
|
1702
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1703
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1704
|
+
<span class="checkbox-text">
|
|
1705
|
+
</span>
|
|
1706
|
+
</label>
|
|
1707
|
+
<span class="TreeLabel TreeLabelName">
|
|
1708
|
+
<span class="rioglyph-icon-pair">
|
|
1709
|
+
<span class="rioglyph rioglyph-truck">
|
|
1710
|
+
</span>
|
|
1711
|
+
<span class="rioglyph rioglyph-fuel-electric">
|
|
1712
|
+
</span>
|
|
1713
|
+
</span>
|
|
1714
|
+
<span class="TreeLabelNameText">
|
|
1715
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-3365</span>
|
|
1716
|
+
<span class="TreeLabelNameTextSubline">
|
|
1717
|
+
<span>Debug: electric</span>
|
|
1718
|
+
</span>
|
|
1719
|
+
</span>
|
|
1720
|
+
</span>
|
|
1721
|
+
</div>
|
|
1722
|
+
</div>
|
|
1723
|
+
</div>
|
|
1724
|
+
<div data-index="4" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(203px);">
|
|
1725
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1726
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d9719">
|
|
1727
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1728
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1729
|
+
<span class="checkbox-text">
|
|
1730
|
+
</span>
|
|
1731
|
+
</label>
|
|
1732
|
+
<span class="TreeLabel TreeLabelName">
|
|
1733
|
+
<span class="rioglyph-icon-pair">
|
|
1734
|
+
<span class="rioglyph rioglyph-bus">
|
|
1735
|
+
</span>
|
|
1736
|
+
<span class="rioglyph rioglyph-fuel-liquid">
|
|
1737
|
+
</span>
|
|
1738
|
+
</span>
|
|
1739
|
+
<span class="TreeLabelNameText">
|
|
1740
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-4034</span>
|
|
1741
|
+
<span class="TreeLabelNameTextSubline">
|
|
1742
|
+
<span>Debug: diesel</span>
|
|
1743
|
+
</span>
|
|
1744
|
+
</span>
|
|
1745
|
+
</span>
|
|
1746
|
+
</div>
|
|
1747
|
+
</div>
|
|
1748
|
+
</div>
|
|
1749
|
+
<div data-index="5" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(257px);">
|
|
1750
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1751
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d971">
|
|
1752
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1753
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1754
|
+
<span class="checkbox-text">
|
|
1755
|
+
</span>
|
|
1756
|
+
</label>
|
|
1757
|
+
<span class="TreeLabel TreeLabelName">
|
|
1758
|
+
<span class="rioglyph-icon-pair">
|
|
1759
|
+
<span class="rioglyph rioglyph-bus">
|
|
1760
|
+
</span>
|
|
1761
|
+
<span class="rioglyph rioglyph-fuel-liquid">
|
|
1762
|
+
</span>
|
|
1763
|
+
</span>
|
|
1764
|
+
<span class="TreeLabelNameText">
|
|
1765
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-5000</span>
|
|
1766
|
+
<span class="TreeLabelNameTextSubline">
|
|
1767
|
+
<span>Debug: diesel</span>
|
|
1768
|
+
</span>
|
|
1769
|
+
</span>
|
|
1770
|
+
</span>
|
|
1771
|
+
</div>
|
|
1772
|
+
</div>
|
|
1773
|
+
</div>
|
|
1774
|
+
<div data-index="6" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(311px);">
|
|
1775
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1776
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d9710">
|
|
1777
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1778
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1779
|
+
<span class="checkbox-text">
|
|
1780
|
+
</span>
|
|
1781
|
+
</label>
|
|
1782
|
+
<span class="TreeLabel TreeLabelName">
|
|
1783
|
+
<span class="rioglyph-icon-pair">
|
|
1784
|
+
<span class="rioglyph rioglyph-car">
|
|
1785
|
+
</span>
|
|
1786
|
+
<span class="rioglyph rioglyph-fuel-hydrogen">
|
|
1787
|
+
</span>
|
|
1788
|
+
</span>
|
|
1789
|
+
<span class="TreeLabelNameText">
|
|
1790
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-7205</span>
|
|
1791
|
+
<span class="TreeLabelNameTextSubline">
|
|
1792
|
+
<span>Debug: hydrogen</span>
|
|
1793
|
+
</span>
|
|
1794
|
+
</span>
|
|
1795
|
+
</span>
|
|
1796
|
+
</div>
|
|
1797
|
+
</div>
|
|
1798
|
+
</div>
|
|
1799
|
+
<div data-index="7" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(365px);">
|
|
1800
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1801
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d9715">
|
|
1802
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1803
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1804
|
+
<span class="checkbox-text">
|
|
1805
|
+
</span>
|
|
1806
|
+
</label>
|
|
1807
|
+
<span class="TreeLabel TreeLabelName">
|
|
1808
|
+
<span class="rioglyph-icon-pair">
|
|
1809
|
+
<span class="rioglyph rioglyph-bus">
|
|
1810
|
+
</span>
|
|
1811
|
+
<span class="rioglyph rioglyph-fuel-hydrogen">
|
|
1812
|
+
</span>
|
|
1813
|
+
</span>
|
|
1814
|
+
<span class="TreeLabelNameText">
|
|
1815
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-7245</span>
|
|
1816
|
+
<span class="TreeLabelNameTextSubline">
|
|
1817
|
+
<span>Debug: hydrogen</span>
|
|
1818
|
+
</span>
|
|
1819
|
+
</span>
|
|
1820
|
+
</span>
|
|
1821
|
+
</div>
|
|
1822
|
+
</div>
|
|
1823
|
+
</div>
|
|
1824
|
+
<div data-index="8" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(419px);">
|
|
1825
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1826
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d970">
|
|
1827
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1828
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1829
|
+
<span class="checkbox-text">
|
|
1830
|
+
</span>
|
|
1831
|
+
</label>
|
|
1832
|
+
<span class="TreeLabel TreeLabelName">
|
|
1833
|
+
<span class="rioglyph-icon-pair">
|
|
1834
|
+
<span class="rioglyph rioglyph-van">
|
|
1835
|
+
</span>
|
|
1836
|
+
<span class="rioglyph rioglyph-fuel-liquid">
|
|
1837
|
+
</span>
|
|
1838
|
+
</span>
|
|
1839
|
+
<span class="TreeLabelNameText">
|
|
1840
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-7410</span>
|
|
1841
|
+
<span class="TreeLabelNameTextSubline">
|
|
1842
|
+
<span>Debug: diesel</span>
|
|
1843
|
+
</span>
|
|
1844
|
+
</span>
|
|
1845
|
+
</span>
|
|
1846
|
+
</div>
|
|
1847
|
+
</div>
|
|
1848
|
+
</div>
|
|
1849
|
+
<div data-index="9" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(473px);">
|
|
1850
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1851
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d9712">
|
|
1852
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1853
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1854
|
+
<span class="checkbox-text">
|
|
1855
|
+
</span>
|
|
1856
|
+
</label>
|
|
1857
|
+
<span class="TreeLabel TreeLabelName">
|
|
1858
|
+
<span class="rioglyph-icon-pair">
|
|
1859
|
+
<span class="rioglyph rioglyph-car">
|
|
1860
|
+
</span>
|
|
1861
|
+
<span class="rioglyph rioglyph-fuel-liquid">
|
|
1862
|
+
</span>
|
|
1863
|
+
</span>
|
|
1864
|
+
<span class="TreeLabelNameText">
|
|
1865
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-8099</span>
|
|
1866
|
+
<span class="TreeLabelNameTextSubline">
|
|
1867
|
+
<span>Debug: heavy_fuel_oil</span>
|
|
1868
|
+
</span>
|
|
1869
|
+
</span>
|
|
1870
|
+
</span>
|
|
1871
|
+
</div>
|
|
1872
|
+
</div>
|
|
1873
|
+
</div>
|
|
1874
|
+
<div data-index="10" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(527px);">
|
|
1875
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1876
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d979">
|
|
1877
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1878
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1879
|
+
<span class="checkbox-text">
|
|
1880
|
+
</span>
|
|
1881
|
+
</label>
|
|
1882
|
+
<span class="TreeLabel TreeLabelName">
|
|
1883
|
+
<span class="rioglyph-icon-pair">
|
|
1884
|
+
<span class="rioglyph rioglyph-bus">
|
|
1885
|
+
</span>
|
|
1886
|
+
<span class="rioglyph rioglyph-fuel-liquid">
|
|
1887
|
+
</span>
|
|
1888
|
+
</span>
|
|
1889
|
+
<span class="TreeLabelNameText">
|
|
1890
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-8194</span>
|
|
1891
|
+
<span class="TreeLabelNameTextSubline">
|
|
1892
|
+
<span>Debug: heavy_fuel_oil</span>
|
|
1893
|
+
</span>
|
|
1894
|
+
</span>
|
|
1895
|
+
</span>
|
|
1896
|
+
</div>
|
|
1897
|
+
</div>
|
|
1898
|
+
</div>
|
|
1899
|
+
<div data-index="11" class="virtualized-tree-item leaf-item " style="position: absolute; top: 0px; left: 0px; width: 100%; height: 54px; transform: translateY(581px);">
|
|
1900
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
1901
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="010191ac-d06d-4567-b13a-7b7fd85d975">
|
|
1902
|
+
<label class="checkbox TreeCheckbox" tabindex="0">
|
|
1903
|
+
<input type="checkbox" class="TreeCheckbox">
|
|
1904
|
+
<span class="checkbox-text">
|
|
1905
|
+
</span>
|
|
1906
|
+
</label>
|
|
1907
|
+
<span class="TreeLabel TreeLabelName">
|
|
1908
|
+
<span class="rioglyph-icon-pair">
|
|
1909
|
+
<span class="rioglyph rioglyph-truck">
|
|
1910
|
+
</span>
|
|
1911
|
+
<span class="rioglyph rioglyph-fuel-gas">
|
|
1912
|
+
</span>
|
|
1913
|
+
</span>
|
|
1914
|
+
<span class="TreeLabelNameText">
|
|
1915
|
+
<span class="TreeLabelNameTextHeadline">Vehicle-8207</span>
|
|
1916
|
+
<span class="TreeLabelNameTextSubline">
|
|
1917
|
+
<span>Debug: lpg</span>
|
|
1918
|
+
</span>
|
|
1919
|
+
</span>
|
|
1920
|
+
</span>
|
|
1921
|
+
</div>
|
|
1922
|
+
</div>
|
|
1923
|
+
</div>
|
|
1924
|
+
</div>
|
|
1925
|
+
</div>
|
|
1926
|
+
</div>
|
|
1927
|
+
<div class="scrollbar-track-horizontal" style="position: absolute; height: 6px; display: none;">
|
|
1928
|
+
<div class="scrollbar-thumb-horizontal" style="position: relative; display: block; height: 100%;">
|
|
1929
|
+
</div>
|
|
1930
|
+
</div>
|
|
1931
|
+
<div class="scrollbar-track-vertical" style="position: absolute; width: 6px; display: none;">
|
|
1932
|
+
<div class="scrollbar-thumb-vertical" style="position: relative; display: block; width: 100%;">
|
|
1933
|
+
</div>
|
|
1934
|
+
</div>
|
|
1935
|
+
</div>
|
|
1936
|
+
</div>
|
|
1937
|
+
</div>
|
|
1938
|
+
</div>
|
|
1939
|
+
</div>
|
|
1940
|
+
</div>
|
|
1941
|
+
<div class="scrollbar-track-horizontal" style="position: absolute; height: 6px; display: none;">
|
|
1942
|
+
<div class="scrollbar-thumb-horizontal" style="position: relative; display: block; height: 100%;">
|
|
1943
|
+
</div>
|
|
1944
|
+
</div>
|
|
1945
|
+
<div class="scrollbar-track-vertical" style="position: absolute; width: 6px; display: none;">
|
|
1946
|
+
<div class="scrollbar-thumb-vertical" style="position: relative; display: block; width: 100%;">
|
|
1947
|
+
</div>
|
|
1948
|
+
</div>
|
|
1949
|
+
</div>
|
|
1950
|
+
</div>
|
|
1951
|
+
<div class="Resizer resize-horizontal resize-right">
|
|
1952
|
+
</div>
|
|
1953
|
+
</div>
|
|
1954
|
+
<div>
|
|
1955
|
+
<div class="h6">Selected groups:</div>
|
|
1956
|
+
<ul>
|
|
1957
|
+
</ul>
|
|
1958
|
+
<div class="h6">Selected vehicles:</div>
|
|
1959
|
+
<ul>
|
|
1960
|
+
</ul>
|
|
1961
|
+
<div class="h6">Expanded groups:</div>
|
|
1962
|
+
<ul>
|
|
1963
|
+
<li>Mixed Vehicles</li>
|
|
1964
|
+
</ul>
|
|
1965
|
+
</div>
|
|
1966
|
+
</div>
|
|
1967
|
+
```
|
|
1968
|
+
|
|
1969
|
+
#### Props: AssetTree
|
|
1970
|
+
|
|
1971
|
+
### AssetTree
|
|
1972
|
+
|
|
1973
|
+
| Name | Type | Default | Description |
|
|
1974
|
+
| --- | --- | --- | --- |
|
|
1975
|
+
| fly | boolean | false | Defines if the component will overlap the body content. |
|
|
1976
|
+
| resizable | boolean | true | Defines whether or not the sidebar is resizable. |
|
|
1977
|
+
| onResizeEnd | Function | () => {} | Callback for when the resize is done. |
|
|
1978
|
+
| bordered | boolean | false | Defines whether the component has a border or not. |
|
|
1979
|
+
| width | string / number | 350 | Defines the width of the component. The value is set as inline style. Note: when component is resizable it will take the provided width in px only and convert it to number in case. |
|
|
1980
|
+
| minWidth | number | 100 | Defines the minimum width of the component in px that will take effect when resizing. |
|
|
1981
|
+
| maxWidth | number | 0 | Defines the maximum width of the component in px that will take effect when resizing. |
|
|
1982
|
+
| height | number | — | Defines the height of the component in px. |
|
|
1983
|
+
| isOpen | boolean | true | Defines whether the component is open or not. |
|
|
1984
|
+
| onToggleTree | Function | () => {} | Callback for when the tree visibility is toggled. |
|
|
1985
|
+
| currentCategoryId | string | — | The id of the category which is currently active and shall be shown. |
|
|
1986
|
+
| onCategoryChange | Function | () => {} | Callback for handling change of category. |
|
|
1987
|
+
| useOffscreen | boolean | false | Defines whether the tree components are rendered offscreen and kept mounted in the DOM. |
|
|
1988
|
+
| className | String | — | Additional classes added on the wrapper element. |
|
|
1989
|
+
| children | TreeCategory | — | A list of TreeCategory components |
|
|
1990
|
+
|
|
1991
|
+
#### Props: TreeCategory
|
|
1992
|
+
|
|
1993
|
+
### TreeCategory
|
|
1994
|
+
|
|
1995
|
+
| Name | Type | Default | Description |
|
|
1996
|
+
| --- | --- | --- | --- |
|
|
1997
|
+
| id | String | — | A unique identifier for that category. |
|
|
1998
|
+
| icon | String | — | The rioglyph icon name for that category. |
|
|
1999
|
+
| label | String / Node | — | The optional label for the category which will be shown in a tooltip. |
|
|
2000
|
+
| hasSelection | boolean | — | Defines whether or not a selection indicator should be shown. |
|
|
2001
|
+
|
|
2002
|
+
#### Props: Tree
|
|
2003
|
+
|
|
2004
|
+
### Tree
|
|
2005
|
+
|
|
2006
|
+
| Name | Type | Default | Description |
|
|
2007
|
+
| --- | --- | --- | --- |
|
|
2008
|
+
| groups | Array of objects | [] | The list of groups of the items. If no groups are provided all items are rendered as flat list. |
|
|
2009
|
+
| └id | String | — | A unique identifier of a group. |
|
|
2010
|
+
| └name | String | — | The name of a group. |
|
|
2011
|
+
| └position | string | — | Can be set to "last" to enforce the last position in the tree. |
|
|
2012
|
+
| └disabled | Boolean | — | Disallows the selection of the group itself. |
|
|
2013
|
+
| └className | String | — | Additional classes added to the group element. |
|
|
2014
|
+
| items | Array of Objects | [] | The list of items. |
|
|
2015
|
+
| └id | String | — | A unique identifier of an item. |
|
|
2016
|
+
| └name | string / object | — | The name of an item. Either it is a plain string or an object composed of: firstName and lastName where lastName is mandatory |
|
|
2017
|
+
| └info | String \| Node | — | The subline of an item. |
|
|
2018
|
+
| └type | string | — | The primary type of the item. This is also used as the fallback icon name and refers to the name of the respective rioglyph icon (excluding the `rioglyph-` prefix). |
|
|
2019
|
+
| └subType | string | — | The sub type of an item which is also the name of the respective rioglyph icon without the prefix. This could be used to show a secondary paired icon like for fuel type. |
|
|
2020
|
+
| └icon | string | — | The rioglyph icon name for a group. The prefix `rioglyph-` can be omitted. |
|
|
2021
|
+
| └icon | string \| null | — | Optional icon override for the item. If set to a string (e.g. `'truck'`), this icon will be used explicitly. If set to `undefined`, the `type` property will be used as the fallback icon. If set to `null`, no icon will be rendered, even if `type` is defined. This allows full control over the icon behavior while maintaining backward compatibility with type-based icons. |
|
|
2022
|
+
| └groupIds | Array of strings | [] | List of group ids the items is associated with. |
|
|
2023
|
+
| └className | string | — | Additional classes added to the item element. |
|
|
2024
|
+
| selectedGroups | Array of strings | — | List of selected group ids. |
|
|
2025
|
+
| selectedItems | Array of strings | — | List of selected item ids. |
|
|
2026
|
+
| onSelectionChange | Function | — | Merged Callback for item and group selection changes. It responds with a selection object that contains the selected itemIds and groupIds: { items: [], groups: [] } |
|
|
2027
|
+
| hasMultiselect | boolean | true | Defines the selection behavior of the tree. |
|
|
2028
|
+
| showRadioButtons | boolean | false | Defines if the single selection should also show radios. |
|
|
2029
|
+
| hideSearch | boolean | false | Defines whether or not the built-in Search is shown. |
|
|
2030
|
+
| searchPlaceholder | string | — | The text used as placeholder for the search input. |
|
|
2031
|
+
| onSearchChange | Function | — | Callback for when the search value changes. |
|
|
2032
|
+
| search | node | — | Used to define custom custom search component which replaces the built-in search. |
|
|
2033
|
+
| onTypeFilterChange | (currentTypes: string[]) => void | — | Callback triggered when the built-in asset type filter changes. This is only available when the default summary is used. |
|
|
2034
|
+
| summary | node | — | Used to define custom asset type counter component which replaces the built-in summary. |
|
|
2035
|
+
| hideSummary | boolean | false | Defines whether a summary is shown. |
|
|
2036
|
+
| hideTreeHead | boolean | false | Defines whether the entire area below the search field is shown or not. Note: Disabling the tree head will hide the select all checkbox and the tree options as well as the tree summary. |
|
|
2037
|
+
| treeHeaderContent | ReactNode | — | Additional custom content that is rendered at the top of the tree component. This can be used for nav pills. |
|
|
2038
|
+
| scrollHeight | Number | — | Defines the max-height of the scrollable list |
|
|
2039
|
+
| expandedGroups | Array of String | — | List of group ids which are expanded. |
|
|
2040
|
+
| onExpandGroupsChange | Function | — | Callback function triggered when a group expands or collapses. |
|
|
2041
|
+
| showEmptyGroups | boolean | true | Defines whether empty groups are shown or not. |
|
|
2042
|
+
| treeOptions | ReactNode | — | Component to offer customization options for the tree. |
|
|
2043
|
+
| treeOptionsTooltip | ReactNode | — | Tooltip content for the tree options dropdown. |
|
|
2044
|
+
| virtualizeThreshold | number | 50 | The number of items (including groups and children) used for virtualizing the tree. |
|
|
2045
|
+
| overscan | number | 5 | The number of items rendered beyond the visible area of a virtualized tree. |
|
|
2046
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
2047
|
+
|
|
2048
|
+
#### Props: TreeSearch
|
|
2049
|
+
|
|
2050
|
+
### TreeSearch
|
|
2051
|
+
|
|
2052
|
+
| Name | Type | Default | Description |
|
|
2053
|
+
| --- | --- | --- | --- |
|
|
2054
|
+
| value | String | — | The search value to be shown and used for the search. |
|
|
2055
|
+
| onChange | Function | () => {} | Callback for when the search value changes. |
|
|
2056
|
+
| placeholder | String | — | The placeholder text used for the input field. |
|
|
2057
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
2058
|
+
|
|
2059
|
+
#### Props: TreeSummary
|
|
2060
|
+
|
|
2061
|
+
### TreeSummary
|
|
2062
|
+
|
|
2063
|
+
| Name | Type | Default | Description |
|
|
2064
|
+
| --- | --- | --- | --- |
|
|
2065
|
+
| assetCounts | object | — | The object containing various asset type counter. |
|
|
2066
|
+
| └truck | number | — | The amount of trucks. |
|
|
2067
|
+
| └trailer | number | — | The amount of trailers. |
|
|
2068
|
+
| └bus | number | — | The amount of buses. |
|
|
2069
|
+
| └van | number | — | The amount of vans. |
|
|
2070
|
+
| └driver | number | — | The amount of drivers. |
|
|
2071
|
+
| gridCols | number | 4 | The number of grid columns used for the built-in TreeSummaryRow |
|
|
2072
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
2073
|
+
|
|
2074
|
+
#### Props: TreeSummaryRow
|
|
2075
|
+
|
|
2076
|
+
### TreeSummaryRow
|
|
2077
|
+
|
|
2078
|
+
| Name | Type | Default | Description |
|
|
2079
|
+
| --- | --- | --- | --- |
|
|
2080
|
+
| gridCols | number | 4 | Defined the number of grid columns for a single row. Note, when the amount of children exceed the columns it will wrap around to a new line. |
|
|
2081
|
+
|
|
2082
|
+
#### Props: TypeCounter
|
|
2083
|
+
|
|
2084
|
+
### TypeCounter
|
|
2085
|
+
|
|
2086
|
+
| Name | Type | Default | Description |
|
|
2087
|
+
| --- | --- | --- | --- |
|
|
2088
|
+
| type | string | — | The item type for that counter. This will be used as a return value for the onClick callback. |
|
|
2089
|
+
| icon | string | — | The icon name. Note, when using the built-in generic type counter, the icon name will the same as the item type. So make sure there is a corresponding icon for the defined type. |
|
|
2090
|
+
| isActive | Boolean | — | Sets the active styling if active. |
|
|
2091
|
+
| hasFilter | boolean | — | Should be set when there is a type filter set in the tree to style the counter accordingly. |
|
|
2092
|
+
| enableActivity | boolean | — | Allows for interactivity. Use this prop when you allow clicking on the counter. |
|
|
2093
|
+
| hideOnZero | boolean | false | Defines if the counter is rendered at all when the value is not defined ot 0. |
|
|
2094
|
+
| onClick | Function | — | Callback function when the counter is clicked. It returns the type value.Make sure the "type" prop is defined to receive the value in the callback and the flag "enableActivity" is set to true otherwise the callback is not triggered. |
|
|
2095
|
+
| value | String / Number / Node | — | A custom value to be shown in the counter. |
|
|
2096
|
+
|
|
2097
|
+
#### Props: TreeOption
|
|
2098
|
+
|
|
2099
|
+
### TreeOption
|
|
2100
|
+
|
|
2101
|
+
| Name | Type | Default | Description |
|
|
2102
|
+
| --- | --- | --- | --- |
|
|
2103
|
+
| isChecked | boolean | — | Defines whether the option is set. |
|
|
2104
|
+
| label | string / node | — | The label for the option. |
|
|
2105
|
+
| onChange | Function | — | Callback triggered when option is selected. |
|
|
2106
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
2107
|
+
|
|
2108
|
+
## AssetTree with custom summary
|
|
2109
|
+
|
|
2110
|
+
### Example: Some small dummy text at the bottom to showcase that you can put something here
|
|
2111
|
+
|
|
2112
|
+
3
|
|
2113
|
+
15
|
|
2114
|
+
|
|
2115
|
+
JohnDoe
|
|
2116
|
+
MaxlRainer
|
|
2117
|
+
JohanSchmidt
|
|
2118
|
+
|
|
2119
|
+
Some small dummy text at the bottom to showcase that you can put something here
|
|
2120
|
+
|
|
2121
|
+
#### Summary
|
|
2122
|
+
|
|
2123
|
+
3
|
|
2124
|
+
15
|
|
2125
|
+
|
|
2126
|
+
JohnDoe
|
|
2127
|
+
MaxlRainer
|
|
2128
|
+
JohanSchmidt
|
|
2129
|
+
|
|
2130
|
+
Some small dummy text at the bottom to showcase that you can put something here
|
|
2131
|
+
|
|
2132
|
+
#### React (tsx)
|
|
2133
|
+
|
|
2134
|
+
```tsx
|
|
2135
|
+
import { useState } from 'react';
|
|
2136
|
+
import { countBy } from 'es-toolkit/compat';
|
|
2137
|
+
|
|
2138
|
+
import AssetTree from '@rio-cloud/rio-uikit/AssetTree';
|
|
2139
|
+
import TreeCategory from '@rio-cloud/rio-uikit/TreeCategory';
|
|
2140
|
+
import Tree, { type TreeItemName, type TreeItem } from '@rio-cloud/rio-uikit/Tree';
|
|
2141
|
+
import TreeSummary from '@rio-cloud/rio-uikit/TreeSummary';
|
|
2142
|
+
import TypeCounter from '@rio-cloud/rio-uikit/TypeCounter';
|
|
2143
|
+
import Notification from '@rio-cloud/rio-uikit/Notification';
|
|
2144
|
+
|
|
2145
|
+
const CATEGORY_DRIVER = 'assets';
|
|
2146
|
+
|
|
2147
|
+
const drivers: TreeItem[] = [
|
|
2148
|
+
{
|
|
2149
|
+
id: '74e8eb86-18a1-4abe-90cb-aeee7909f857',
|
|
2150
|
+
name: {
|
|
2151
|
+
firstName: 'John',
|
|
2152
|
+
lastName: 'Doe',
|
|
2153
|
+
},
|
|
2154
|
+
type: 'driver',
|
|
2155
|
+
},
|
|
2156
|
+
{
|
|
2157
|
+
id: '3abc20f5-e0b6-42bb-b310-4e57fdd2be55',
|
|
2158
|
+
name: {
|
|
2159
|
+
firstName: 'Maxl',
|
|
2160
|
+
lastName: 'Rainer',
|
|
2161
|
+
},
|
|
2162
|
+
type: 'driver',
|
|
2163
|
+
},
|
|
2164
|
+
{
|
|
2165
|
+
id: '3abc20f5-e0b6-42bb-b310-4e57fdd2be56',
|
|
2166
|
+
name: {
|
|
2167
|
+
firstName: 'Johan',
|
|
2168
|
+
lastName: 'Schmidt',
|
|
2169
|
+
},
|
|
2170
|
+
type: 'driver',
|
|
2171
|
+
},
|
|
2172
|
+
];
|
|
2173
|
+
|
|
2174
|
+
const getTypeCounts = (items: TreeItem[]) => countBy(items, item => item.type);
|
|
2175
|
+
|
|
2176
|
+
const AssetTreeWithCustomSummaryExample = () => {
|
|
2177
|
+
const [counters, setCounters] = useState({
|
|
2178
|
+
driver: 3,
|
|
2179
|
+
driverOut: 15,
|
|
2180
|
+
});
|
|
2181
|
+
|
|
2182
|
+
const handleSearchChange = (searchValue: string) => {
|
|
2183
|
+
const filteredDriver = drivers.filter(driver =>
|
|
2184
|
+
`${(driver.name as TreeItemName).firstName} ${(driver.name as TreeItemName).lastName}`
|
|
2185
|
+
.toLowerCase()
|
|
2186
|
+
.includes(searchValue.toLowerCase())
|
|
2187
|
+
);
|
|
2188
|
+
const counts = getTypeCounts(filteredDriver);
|
|
2189
|
+
|
|
2190
|
+
setCounters({
|
|
2191
|
+
...counters,
|
|
2192
|
+
driver: counts.driver,
|
|
2193
|
+
});
|
|
2194
|
+
};
|
|
2195
|
+
|
|
2196
|
+
return (
|
|
2197
|
+
<div className='display-flex flex-wrap overflow-auto'>
|
|
2198
|
+
<AssetTree
|
|
2199
|
+
resizable
|
|
2200
|
+
bordered
|
|
2201
|
+
minWidth={300}
|
|
2202
|
+
maxWidth={450}
|
|
2203
|
+
currentCategoryId={CATEGORY_DRIVER}
|
|
2204
|
+
height={500}
|
|
2205
|
+
isOpen
|
|
2206
|
+
>
|
|
2207
|
+
<TreeCategory
|
|
2208
|
+
key={CATEGORY_DRIVER}
|
|
2209
|
+
id={CATEGORY_DRIVER}
|
|
2210
|
+
label='Driver'
|
|
2211
|
+
icon='rioglyph-driver'
|
|
2212
|
+
hasSelection={false}
|
|
2213
|
+
>
|
|
2214
|
+
<div className='flex-1-1 display-flex flex-column justify-content-between'>
|
|
2215
|
+
<Tree
|
|
2216
|
+
summary={
|
|
2217
|
+
<TreeSummary>
|
|
2218
|
+
<TypeCounter
|
|
2219
|
+
icon='driver'
|
|
2220
|
+
value={counters.driver}
|
|
2221
|
+
enableActivity
|
|
2222
|
+
type='driver'
|
|
2223
|
+
onClick={(type: string) => Notification.default(`TypeCounter ${type} clicked`)}
|
|
2224
|
+
/>
|
|
2225
|
+
<TypeCounter icon='drivercard-out' value={counters.driverOut} />
|
|
2226
|
+
</TreeSummary>
|
|
2227
|
+
}
|
|
2228
|
+
groups={[]}
|
|
2229
|
+
items={drivers}
|
|
2230
|
+
expandedGroups={[]}
|
|
2231
|
+
selectedGroups={[]}
|
|
2232
|
+
selectedItems={[]}
|
|
2233
|
+
searchPlaceholder='Find driver by name'
|
|
2234
|
+
onSearchChange={handleSearchChange}
|
|
2235
|
+
hasMultiselect={false}
|
|
2236
|
+
/>
|
|
2237
|
+
<div className='margin-15 padding-10 rounded border1 border-color-lightest shadow-accent text-color-dark line-height-125rel'>
|
|
2238
|
+
Some small dummy text at the bottom to showcase that you can put something here
|
|
2239
|
+
</div>
|
|
2240
|
+
</div>
|
|
2241
|
+
</TreeCategory>
|
|
2242
|
+
</AssetTree>
|
|
2243
|
+
</div>
|
|
2244
|
+
);
|
|
2245
|
+
};
|
|
2246
|
+
|
|
2247
|
+
export default AssetTreeWithCustomSummaryExample;
|
|
2248
|
+
```
|
|
2249
|
+
|
|
2250
|
+
#### HTML (html)
|
|
2251
|
+
|
|
2252
|
+
```html
|
|
2253
|
+
<div class="display-flex flex-wrap overflow-auto">
|
|
2254
|
+
<div class="AssetTree border fluid" style="width: 350px; height: 500px;">
|
|
2255
|
+
<div class="AssetTreeResizeLimit" style="left: 450px;">
|
|
2256
|
+
</div>
|
|
2257
|
+
<div class="AssetTreeContent">
|
|
2258
|
+
<div class="TreeSidebar">
|
|
2259
|
+
<ul class="TreeSidebarNavigation">
|
|
2260
|
+
<li class="active">
|
|
2261
|
+
<div class="selection-bubble">
|
|
2262
|
+
<span class="rioglyph rioglyph-driver">
|
|
2263
|
+
</span>
|
|
2264
|
+
</div>
|
|
2265
|
+
</li>
|
|
2266
|
+
</ul>
|
|
2267
|
+
<div class="TreeSidebarToggle">
|
|
2268
|
+
<span class="rioglyph rioglyph-chevron-left">
|
|
2269
|
+
</span>
|
|
2270
|
+
</div>
|
|
2271
|
+
</div>
|
|
2272
|
+
<div class="AssetTreeBody scrollbar-fly-in smooth-scrollbar-wrapper" style="position: relative; overflow: hidden; width: 100%; height: 100%;">
|
|
2273
|
+
<div class="scrollbar-view" style="position: absolute; inset: 0px; overflow: scroll; margin-right: 0px; margin-bottom: 0px;">
|
|
2274
|
+
<div class="scrollbar-content-wrapper">
|
|
2275
|
+
<div class="flex-1-1 display-flex flex-column justify-content-between">
|
|
2276
|
+
<div class="Tree">
|
|
2277
|
+
<div class="TreeHeader">
|
|
2278
|
+
<div class="TreeSearch">
|
|
2279
|
+
<div class="input-group flex-1-0">
|
|
2280
|
+
<span class="input-group-addon">
|
|
2281
|
+
<span class="rioglyph rioglyph-search" aria-hidden="true">
|
|
2282
|
+
</span>
|
|
2283
|
+
</span>
|
|
2284
|
+
<div class="ClearableInput input-group">
|
|
2285
|
+
<input placeholder="Find driver by name" class="form-control" type="text" tabindex="0" value="">
|
|
2286
|
+
<span class="clearButton hide">
|
|
2287
|
+
<span class="clearButtonIcon rioglyph rioglyph-remove-sign">
|
|
2288
|
+
</span>
|
|
2289
|
+
</span>
|
|
2290
|
+
</div>
|
|
2291
|
+
</div>
|
|
2292
|
+
</div>
|
|
2293
|
+
<div class="TreeHead display-flex gap-5 padding-15">
|
|
2294
|
+
<div class="border border-right-only hidden-empty padding-right-10 margin-right-2">
|
|
2295
|
+
</div>
|
|
2296
|
+
<div class="display-flex justify-content-between align-items-start width-100pct">
|
|
2297
|
+
<div class="TreeSummary display-flex flex-wrap align-items-center gap-10 padding-left-3">
|
|
2298
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 cursor-pointer">
|
|
2299
|
+
<span class="rioglyph rioglyph-driver text-size-16 margin-right-2">
|
|
2300
|
+
</span>
|
|
2301
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">3</span>
|
|
2302
|
+
</div>
|
|
2303
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 pointer-events-none">
|
|
2304
|
+
<span class="rioglyph rioglyph-drivercard-out text-size-16 margin-right-2">
|
|
2305
|
+
</span>
|
|
2306
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">15</span>
|
|
2307
|
+
</div>
|
|
2308
|
+
</div>
|
|
2309
|
+
</div>
|
|
2310
|
+
</div>
|
|
2311
|
+
</div>
|
|
2312
|
+
<div class="TreeRoot user-select-none overflow-hidden" style="position: relative;">
|
|
2313
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden open">
|
|
2314
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="74e8eb86-18a1-4abe-90cb-aeee7909f857">
|
|
2315
|
+
<span class="TreeLabel TreeLabelName">
|
|
2316
|
+
<span class="rioglyph rioglyph-driver">
|
|
2317
|
+
</span>
|
|
2318
|
+
<span class="TreeLabelNameText">
|
|
2319
|
+
<span class="TreeLabelNameTextHeadline">
|
|
2320
|
+
<span class="text-light margin-right-3">John</span>
|
|
2321
|
+
<span>Doe</span>
|
|
2322
|
+
</span>
|
|
2323
|
+
</span>
|
|
2324
|
+
</span>
|
|
2325
|
+
</div>
|
|
2326
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="3abc20f5-e0b6-42bb-b310-4e57fdd2be55">
|
|
2327
|
+
<span class="TreeLabel TreeLabelName">
|
|
2328
|
+
<span class="rioglyph rioglyph-driver">
|
|
2329
|
+
</span>
|
|
2330
|
+
<span class="TreeLabelNameText">
|
|
2331
|
+
<span class="TreeLabelNameTextHeadline">
|
|
2332
|
+
<span class="text-light margin-right-3">Maxl</span>
|
|
2333
|
+
<span>Rainer</span>
|
|
2334
|
+
</span>
|
|
2335
|
+
</span>
|
|
2336
|
+
</span>
|
|
2337
|
+
</div>
|
|
2338
|
+
<div class="TreeLeaf form-group margin-bottom-0" data-key="3abc20f5-e0b6-42bb-b310-4e57fdd2be56">
|
|
2339
|
+
<span class="TreeLabel TreeLabelName">
|
|
2340
|
+
<span class="rioglyph rioglyph-driver">
|
|
2341
|
+
</span>
|
|
2342
|
+
<span class="TreeLabelNameText">
|
|
2343
|
+
<span class="TreeLabelNameTextHeadline">
|
|
2344
|
+
<span class="text-light margin-right-3">Johan</span>
|
|
2345
|
+
<span>Schmidt</span>
|
|
2346
|
+
</span>
|
|
2347
|
+
</span>
|
|
2348
|
+
</span>
|
|
2349
|
+
</div>
|
|
2350
|
+
</div>
|
|
2351
|
+
</div>
|
|
2352
|
+
</div>
|
|
2353
|
+
<div class="margin-15 padding-10 rounded border1 border-color-lightest shadow-accent text-color-dark line-height-125rel">Some small dummy text at the bottom to showcase that you can put something here</div>
|
|
2354
|
+
</div>
|
|
2355
|
+
</div>
|
|
2356
|
+
</div>
|
|
2357
|
+
<div class="scrollbar-track-horizontal" style="position: absolute; height: 6px; display: none;">
|
|
2358
|
+
<div class="scrollbar-thumb-horizontal" style="position: relative; display: block; height: 100%;">
|
|
2359
|
+
</div>
|
|
2360
|
+
</div>
|
|
2361
|
+
<div class="scrollbar-track-vertical" style="position: absolute; width: 6px; display: none;">
|
|
2362
|
+
<div class="scrollbar-thumb-vertical" style="position: relative; display: block; width: 100%;">
|
|
2363
|
+
</div>
|
|
2364
|
+
</div>
|
|
2365
|
+
</div>
|
|
2366
|
+
</div>
|
|
2367
|
+
<div class="Resizer resize-horizontal resize-right">
|
|
2368
|
+
</div>
|
|
2369
|
+
</div>
|
|
2370
|
+
</div>
|
|
2371
|
+
```
|
|
2372
|
+
|
|
2373
|
+
#### Props: AssetTree
|
|
2374
|
+
|
|
2375
|
+
### AssetTree
|
|
2376
|
+
|
|
2377
|
+
| Name | Type | Default | Description |
|
|
2378
|
+
| --- | --- | --- | --- |
|
|
2379
|
+
| fly | boolean | false | Defines if the component will overlap the body content. |
|
|
2380
|
+
| resizable | boolean | true | Defines whether or not the sidebar is resizable. |
|
|
2381
|
+
| onResizeEnd | Function | () => {} | Callback for when the resize is done. |
|
|
2382
|
+
| bordered | boolean | false | Defines whether the component has a border or not. |
|
|
2383
|
+
| width | string / number | 350 | Defines the width of the component. The value is set as inline style. Note: when component is resizable it will take the provided width in px only and convert it to number in case. |
|
|
2384
|
+
| minWidth | number | 100 | Defines the minimum width of the component in px that will take effect when resizing. |
|
|
2385
|
+
| maxWidth | number | 0 | Defines the maximum width of the component in px that will take effect when resizing. |
|
|
2386
|
+
| height | number | — | Defines the height of the component in px. |
|
|
2387
|
+
| isOpen | boolean | true | Defines whether the component is open or not. |
|
|
2388
|
+
| onToggleTree | Function | () => {} | Callback for when the tree visibility is toggled. |
|
|
2389
|
+
| currentCategoryId | string | — | The id of the category which is currently active and shall be shown. |
|
|
2390
|
+
| onCategoryChange | Function | () => {} | Callback for handling change of category. |
|
|
2391
|
+
| useOffscreen | boolean | false | Defines whether the tree components are rendered offscreen and kept mounted in the DOM. |
|
|
2392
|
+
| className | String | — | Additional classes added on the wrapper element. |
|
|
2393
|
+
| children | TreeCategory | — | A list of TreeCategory components |
|
|
2394
|
+
|
|
2395
|
+
#### Props: TreeCategory
|
|
2396
|
+
|
|
2397
|
+
### TreeCategory
|
|
2398
|
+
|
|
2399
|
+
| Name | Type | Default | Description |
|
|
2400
|
+
| --- | --- | --- | --- |
|
|
2401
|
+
| id | String | — | A unique identifier for that category. |
|
|
2402
|
+
| icon | String | — | The rioglyph icon name for that category. |
|
|
2403
|
+
| label | String / Node | — | The optional label for the category which will be shown in a tooltip. |
|
|
2404
|
+
| hasSelection | boolean | — | Defines whether or not a selection indicator should be shown. |
|
|
2405
|
+
|
|
2406
|
+
#### Props: Tree
|
|
2407
|
+
|
|
2408
|
+
### Tree
|
|
2409
|
+
|
|
2410
|
+
| Name | Type | Default | Description |
|
|
2411
|
+
| --- | --- | --- | --- |
|
|
2412
|
+
| groups | Array of objects | [] | The list of groups of the items. If no groups are provided all items are rendered as flat list. |
|
|
2413
|
+
| └id | String | — | A unique identifier of a group. |
|
|
2414
|
+
| └name | String | — | The name of a group. |
|
|
2415
|
+
| └position | string | — | Can be set to "last" to enforce the last position in the tree. |
|
|
2416
|
+
| └disabled | Boolean | — | Disallows the selection of the group itself. |
|
|
2417
|
+
| └className | String | — | Additional classes added to the group element. |
|
|
2418
|
+
| items | Array of Objects | [] | The list of items. |
|
|
2419
|
+
| └id | String | — | A unique identifier of an item. |
|
|
2420
|
+
| └name | string / object | — | The name of an item. Either it is a plain string or an object composed of: firstName and lastName where lastName is mandatory |
|
|
2421
|
+
| └info | String \| Node | — | The subline of an item. |
|
|
2422
|
+
| └type | string | — | The primary type of the item. This is also used as the fallback icon name and refers to the name of the respective rioglyph icon (excluding the `rioglyph-` prefix). |
|
|
2423
|
+
| └subType | string | — | The sub type of an item which is also the name of the respective rioglyph icon without the prefix. This could be used to show a secondary paired icon like for fuel type. |
|
|
2424
|
+
| └icon | string | — | The rioglyph icon name for a group. The prefix `rioglyph-` can be omitted. |
|
|
2425
|
+
| └icon | string \| null | — | Optional icon override for the item. If set to a string (e.g. `'truck'`), this icon will be used explicitly. If set to `undefined`, the `type` property will be used as the fallback icon. If set to `null`, no icon will be rendered, even if `type` is defined. This allows full control over the icon behavior while maintaining backward compatibility with type-based icons. |
|
|
2426
|
+
| └groupIds | Array of strings | [] | List of group ids the items is associated with. |
|
|
2427
|
+
| └className | string | — | Additional classes added to the item element. |
|
|
2428
|
+
| selectedGroups | Array of strings | — | List of selected group ids. |
|
|
2429
|
+
| selectedItems | Array of strings | — | List of selected item ids. |
|
|
2430
|
+
| onSelectionChange | Function | — | Merged Callback for item and group selection changes. It responds with a selection object that contains the selected itemIds and groupIds: { items: [], groups: [] } |
|
|
2431
|
+
| hasMultiselect | boolean | true | Defines the selection behavior of the tree. |
|
|
2432
|
+
| showRadioButtons | boolean | false | Defines if the single selection should also show radios. |
|
|
2433
|
+
| hideSearch | boolean | false | Defines whether or not the built-in Search is shown. |
|
|
2434
|
+
| searchPlaceholder | string | — | The text used as placeholder for the search input. |
|
|
2435
|
+
| onSearchChange | Function | — | Callback for when the search value changes. |
|
|
2436
|
+
| search | node | — | Used to define custom custom search component which replaces the built-in search. |
|
|
2437
|
+
| onTypeFilterChange | (currentTypes: string[]) => void | — | Callback triggered when the built-in asset type filter changes. This is only available when the default summary is used. |
|
|
2438
|
+
| summary | node | — | Used to define custom asset type counter component which replaces the built-in summary. |
|
|
2439
|
+
| hideSummary | boolean | false | Defines whether a summary is shown. |
|
|
2440
|
+
| hideTreeHead | boolean | false | Defines whether the entire area below the search field is shown or not. Note: Disabling the tree head will hide the select all checkbox and the tree options as well as the tree summary. |
|
|
2441
|
+
| treeHeaderContent | ReactNode | — | Additional custom content that is rendered at the top of the tree component. This can be used for nav pills. |
|
|
2442
|
+
| scrollHeight | Number | — | Defines the max-height of the scrollable list |
|
|
2443
|
+
| expandedGroups | Array of String | — | List of group ids which are expanded. |
|
|
2444
|
+
| onExpandGroupsChange | Function | — | Callback function triggered when a group expands or collapses. |
|
|
2445
|
+
| showEmptyGroups | boolean | true | Defines whether empty groups are shown or not. |
|
|
2446
|
+
| treeOptions | ReactNode | — | Component to offer customization options for the tree. |
|
|
2447
|
+
| treeOptionsTooltip | ReactNode | — | Tooltip content for the tree options dropdown. |
|
|
2448
|
+
| virtualizeThreshold | number | 50 | The number of items (including groups and children) used for virtualizing the tree. |
|
|
2449
|
+
| overscan | number | 5 | The number of items rendered beyond the visible area of a virtualized tree. |
|
|
2450
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
2451
|
+
|
|
2452
|
+
#### Props: TreeSearch
|
|
2453
|
+
|
|
2454
|
+
### TreeSearch
|
|
2455
|
+
|
|
2456
|
+
| Name | Type | Default | Description |
|
|
2457
|
+
| --- | --- | --- | --- |
|
|
2458
|
+
| value | String | — | The search value to be shown and used for the search. |
|
|
2459
|
+
| onChange | Function | () => {} | Callback for when the search value changes. |
|
|
2460
|
+
| placeholder | String | — | The placeholder text used for the input field. |
|
|
2461
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
2462
|
+
|
|
2463
|
+
#### Props: TreeSummary
|
|
2464
|
+
|
|
2465
|
+
### TreeSummary
|
|
2466
|
+
|
|
2467
|
+
| Name | Type | Default | Description |
|
|
2468
|
+
| --- | --- | --- | --- |
|
|
2469
|
+
| assetCounts | object | — | The object containing various asset type counter. |
|
|
2470
|
+
| └truck | number | — | The amount of trucks. |
|
|
2471
|
+
| └trailer | number | — | The amount of trailers. |
|
|
2472
|
+
| └bus | number | — | The amount of buses. |
|
|
2473
|
+
| └van | number | — | The amount of vans. |
|
|
2474
|
+
| └driver | number | — | The amount of drivers. |
|
|
2475
|
+
| gridCols | number | 4 | The number of grid columns used for the built-in TreeSummaryRow |
|
|
2476
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
2477
|
+
|
|
2478
|
+
#### Props: TreeSummaryRow
|
|
2479
|
+
|
|
2480
|
+
### TreeSummaryRow
|
|
2481
|
+
|
|
2482
|
+
| Name | Type | Default | Description |
|
|
2483
|
+
| --- | --- | --- | --- |
|
|
2484
|
+
| gridCols | number | 4 | Defined the number of grid columns for a single row. Note, when the amount of children exceed the columns it will wrap around to a new line. |
|
|
2485
|
+
|
|
2486
|
+
#### Props: TypeCounter
|
|
2487
|
+
|
|
2488
|
+
### TypeCounter
|
|
2489
|
+
|
|
2490
|
+
| Name | Type | Default | Description |
|
|
2491
|
+
| --- | --- | --- | --- |
|
|
2492
|
+
| type | string | — | The item type for that counter. This will be used as a return value for the onClick callback. |
|
|
2493
|
+
| icon | string | — | The icon name. Note, when using the built-in generic type counter, the icon name will the same as the item type. So make sure there is a corresponding icon for the defined type. |
|
|
2494
|
+
| isActive | Boolean | — | Sets the active styling if active. |
|
|
2495
|
+
| hasFilter | boolean | — | Should be set when there is a type filter set in the tree to style the counter accordingly. |
|
|
2496
|
+
| enableActivity | boolean | — | Allows for interactivity. Use this prop when you allow clicking on the counter. |
|
|
2497
|
+
| hideOnZero | boolean | false | Defines if the counter is rendered at all when the value is not defined ot 0. |
|
|
2498
|
+
| onClick | Function | — | Callback function when the counter is clicked. It returns the type value.Make sure the "type" prop is defined to receive the value in the callback and the flag "enableActivity" is set to true otherwise the callback is not triggered. |
|
|
2499
|
+
| value | String / Number / Node | — | A custom value to be shown in the counter. |
|
|
2500
|
+
|
|
2501
|
+
#### Props: TreeOption
|
|
2502
|
+
|
|
2503
|
+
### TreeOption
|
|
2504
|
+
|
|
2505
|
+
| Name | Type | Default | Description |
|
|
2506
|
+
| --- | --- | --- | --- |
|
|
2507
|
+
| isChecked | boolean | — | Defines whether the option is set. |
|
|
2508
|
+
| label | string / node | — | The label for the option. |
|
|
2509
|
+
| onChange | Function | — | Callback triggered when option is selected. |
|
|
2510
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
2511
|
+
|
|
2512
|
+
## Tree
|
|
2513
|
+
|
|
2514
|
+
### Example: Tree with header and search
|
|
2515
|
+
|
|
2516
|
+
Tree with header and search
|
|
2517
|
+
|
|
2518
|
+
20
|
|
2519
|
+
|
|
2520
|
+
Folder 016
|
|
2521
|
+
|
|
2522
|
+
Folder 026
|
|
2523
|
+
|
|
2524
|
+
Folder 031
|
|
2525
|
+
|
|
2526
|
+
Folder 047
|
|
2527
|
+
|
|
2528
|
+
Selected items:
|
|
2529
|
+
|
|
2530
|
+
Expanded folders:
|
|
2531
|
+
|
|
2532
|
+
#### Summary
|
|
2533
|
+
|
|
2534
|
+
Tree with header and search
|
|
2535
|
+
|
|
2536
|
+
20
|
|
2537
|
+
|
|
2538
|
+
Folder 016
|
|
2539
|
+
|
|
2540
|
+
Folder 026
|
|
2541
|
+
|
|
2542
|
+
Folder 031
|
|
2543
|
+
|
|
2544
|
+
Folder 047
|
|
2545
|
+
|
|
2546
|
+
Selected items:
|
|
2547
|
+
|
|
2548
|
+
Expanded folders:
|
|
2549
|
+
|
|
2550
|
+
#### React (tsx)
|
|
2551
|
+
|
|
2552
|
+
```tsx
|
|
2553
|
+
import { useState } from 'react';
|
|
2554
|
+
import { random } from 'es-toolkit/compat';
|
|
2555
|
+
import faker from 'faker';
|
|
2556
|
+
|
|
2557
|
+
import Tree, { type TreeItem, type TreeGroup, type SelectionChangeResponse } from '@rio-cloud/rio-uikit/Tree';
|
|
2558
|
+
import LabeledElement from '@rio-cloud/rio-uikit/LabeledElement';
|
|
2559
|
+
|
|
2560
|
+
const folders: TreeGroup[] = [
|
|
2561
|
+
{
|
|
2562
|
+
id: '1',
|
|
2563
|
+
name: 'Folder 01',
|
|
2564
|
+
icon: 'folder-open',
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
id: '2',
|
|
2568
|
+
name: 'Folder 02',
|
|
2569
|
+
icon: 'folder-open',
|
|
2570
|
+
},
|
|
2571
|
+
{
|
|
2572
|
+
id: '3',
|
|
2573
|
+
name: 'Folder 03',
|
|
2574
|
+
icon: 'folder-open',
|
|
2575
|
+
},
|
|
2576
|
+
{
|
|
2577
|
+
id: '4',
|
|
2578
|
+
name: 'Folder 04',
|
|
2579
|
+
icon: 'folder-open',
|
|
2580
|
+
},
|
|
2581
|
+
];
|
|
2582
|
+
|
|
2583
|
+
const treeItems: TreeItem[] = Array.from({ length: 20 }, (_, index) => ({
|
|
2584
|
+
id: `${index}`,
|
|
2585
|
+
name: `${faker.random.words()} ${random(100, 999)}`,
|
|
2586
|
+
type: 'files',
|
|
2587
|
+
icon: 'files',
|
|
2588
|
+
// icon: null, // Set to "null" to omit the icon
|
|
2589
|
+
groupIds: [faker.random.arrayElement(folders).id],
|
|
2590
|
+
}));
|
|
2591
|
+
|
|
2592
|
+
const TreeOnlyExample = () => {
|
|
2593
|
+
const [selectedItemIds, setSelectedItemIds] = useState<string[]>([]);
|
|
2594
|
+
const [expandedFolders, setExpandedFolders] = useState<string[]>([]);
|
|
2595
|
+
|
|
2596
|
+
const handleSelection = ({ items }: SelectionChangeResponse) => {
|
|
2597
|
+
setSelectedItemIds(items);
|
|
2598
|
+
};
|
|
2599
|
+
|
|
2600
|
+
const handleExpandFolder = (newExpandedFolders: string[]) => setExpandedFolders(newExpandedFolders);
|
|
2601
|
+
|
|
2602
|
+
const renderSelectedItemsOfList = (itemIds: string[], list: TreeGroup[] | TreeItem[]) => {
|
|
2603
|
+
return itemIds.map(selectedItemId => {
|
|
2604
|
+
const result = list.find(listItem => listItem.id === selectedItemId);
|
|
2605
|
+
if (result) {
|
|
2606
|
+
return <li key={selectedItemId}>{`${result.name}`}</li>;
|
|
2607
|
+
}
|
|
2608
|
+
return null;
|
|
2609
|
+
});
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2612
|
+
return (
|
|
2613
|
+
<div className='display-flex flex-wrap gap-25 overflow-auto'>
|
|
2614
|
+
<div className='width-500'>
|
|
2615
|
+
<LabeledElement label='Tree with header and search'>
|
|
2616
|
+
<Tree
|
|
2617
|
+
groups={folders}
|
|
2618
|
+
items={treeItems}
|
|
2619
|
+
expandedGroups={expandedFolders}
|
|
2620
|
+
onExpandGroupsChange={handleExpandFolder}
|
|
2621
|
+
selectedItems={selectedItemIds}
|
|
2622
|
+
onSelectionChange={handleSelection}
|
|
2623
|
+
searchPlaceholder='Find file'
|
|
2624
|
+
scrollHeight={300}
|
|
2625
|
+
hasMultiselect={false}
|
|
2626
|
+
/>
|
|
2627
|
+
</LabeledElement>
|
|
2628
|
+
</div>
|
|
2629
|
+
<div>
|
|
2630
|
+
<div className='h6'>Selected items:</div>
|
|
2631
|
+
<ul>{renderSelectedItemsOfList(selectedItemIds, treeItems)}</ul>
|
|
2632
|
+
<div className='h6'>Expanded folders:</div>
|
|
2633
|
+
<ul>{renderSelectedItemsOfList(expandedFolders, folders)}</ul>
|
|
2634
|
+
</div>
|
|
2635
|
+
</div>
|
|
2636
|
+
);
|
|
2637
|
+
};
|
|
2638
|
+
|
|
2639
|
+
export default TreeOnlyExample;
|
|
2640
|
+
```
|
|
2641
|
+
|
|
2642
|
+
#### HTML (html)
|
|
2643
|
+
|
|
2644
|
+
```html
|
|
2645
|
+
<div class="display-flex flex-wrap gap-25 overflow-auto">
|
|
2646
|
+
<div class="width-500">
|
|
2647
|
+
<div class="LabeledElement display-flex flex-column">
|
|
2648
|
+
<div class="text-color-dark max-width-100pct text-size-12 display-inline-block margin-bottom-5">Tree with header and search</div>
|
|
2649
|
+
<div class="Tree">
|
|
2650
|
+
<div class="TreeHeader">
|
|
2651
|
+
<div class="TreeSearch">
|
|
2652
|
+
<div class="input-group flex-1-0">
|
|
2653
|
+
<span class="input-group-addon">
|
|
2654
|
+
<span class="rioglyph rioglyph-search" aria-hidden="true">
|
|
2655
|
+
</span>
|
|
2656
|
+
</span>
|
|
2657
|
+
<div class="ClearableInput input-group">
|
|
2658
|
+
<input placeholder="Find file" class="form-control" type="text" tabindex="0" value="">
|
|
2659
|
+
<span class="clearButton hide">
|
|
2660
|
+
<span class="clearButtonIcon rioglyph rioglyph-remove-sign">
|
|
2661
|
+
</span>
|
|
2662
|
+
</span>
|
|
2663
|
+
</div>
|
|
2664
|
+
</div>
|
|
2665
|
+
</div>
|
|
2666
|
+
<div class="TreeHead display-flex gap-5 padding-15">
|
|
2667
|
+
<div class="border border-right-only hidden-empty padding-right-10 margin-right-2">
|
|
2668
|
+
</div>
|
|
2669
|
+
<div class="display-flex justify-content-between align-items-start width-100pct">
|
|
2670
|
+
<div class="TreeSummary display-flex flex-wrap align-items-center gap-10 padding-left-3">
|
|
2671
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 pointer-events-none">
|
|
2672
|
+
<span class="rioglyph rioglyph-files text-size-16 margin-right-2">
|
|
2673
|
+
</span>
|
|
2674
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">20</span>
|
|
2675
|
+
</div>
|
|
2676
|
+
</div>
|
|
2677
|
+
</div>
|
|
2678
|
+
</div>
|
|
2679
|
+
</div>
|
|
2680
|
+
<div class="TreeRoot user-select-none overflow-auto" style="max-height: 300px; position: relative;">
|
|
2681
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="1">
|
|
2682
|
+
<div class="TreeNode from-group" data-key="1">
|
|
2683
|
+
<span class="TreeLabel TreeLabelName">
|
|
2684
|
+
<span class="rioglyph rioglyph-folder-open">
|
|
2685
|
+
</span>
|
|
2686
|
+
<span class="TreeLabelNameText">
|
|
2687
|
+
<span class="TreeLabelNameTextHeadline">Folder 01</span>
|
|
2688
|
+
</span>
|
|
2689
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">6</span>
|
|
2690
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
2691
|
+
</span>
|
|
2692
|
+
</span>
|
|
2693
|
+
</div>
|
|
2694
|
+
</div>
|
|
2695
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="2">
|
|
2696
|
+
<div class="TreeNode from-group" data-key="2">
|
|
2697
|
+
<span class="TreeLabel TreeLabelName">
|
|
2698
|
+
<span class="rioglyph rioglyph-folder-open">
|
|
2699
|
+
</span>
|
|
2700
|
+
<span class="TreeLabelNameText">
|
|
2701
|
+
<span class="TreeLabelNameTextHeadline">Folder 02</span>
|
|
2702
|
+
</span>
|
|
2703
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">6</span>
|
|
2704
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
2705
|
+
</span>
|
|
2706
|
+
</span>
|
|
2707
|
+
</div>
|
|
2708
|
+
</div>
|
|
2709
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="3">
|
|
2710
|
+
<div class="TreeNode from-group" data-key="3">
|
|
2711
|
+
<span class="TreeLabel TreeLabelName">
|
|
2712
|
+
<span class="rioglyph rioglyph-folder-open">
|
|
2713
|
+
</span>
|
|
2714
|
+
<span class="TreeLabelNameText">
|
|
2715
|
+
<span class="TreeLabelNameTextHeadline">Folder 03</span>
|
|
2716
|
+
</span>
|
|
2717
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">1</span>
|
|
2718
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
2719
|
+
</span>
|
|
2720
|
+
</span>
|
|
2721
|
+
</div>
|
|
2722
|
+
</div>
|
|
2723
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="4">
|
|
2724
|
+
<div class="TreeNode from-group" data-key="4">
|
|
2725
|
+
<span class="TreeLabel TreeLabelName">
|
|
2726
|
+
<span class="rioglyph rioglyph-folder-open">
|
|
2727
|
+
</span>
|
|
2728
|
+
<span class="TreeLabelNameText">
|
|
2729
|
+
<span class="TreeLabelNameTextHeadline">Folder 04</span>
|
|
2730
|
+
</span>
|
|
2731
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">7</span>
|
|
2732
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
2733
|
+
</span>
|
|
2734
|
+
</span>
|
|
2735
|
+
</div>
|
|
2736
|
+
</div>
|
|
2737
|
+
</div>
|
|
2738
|
+
</div>
|
|
2739
|
+
</div>
|
|
2740
|
+
</div>
|
|
2741
|
+
<div>
|
|
2742
|
+
<div class="h6">Selected items:</div>
|
|
2743
|
+
<ul>
|
|
2744
|
+
</ul>
|
|
2745
|
+
<div class="h6">Expanded folders:</div>
|
|
2746
|
+
<ul>
|
|
2747
|
+
</ul>
|
|
2748
|
+
</div>
|
|
2749
|
+
</div>
|
|
2750
|
+
```
|
|
2751
|
+
|
|
2752
|
+
#### Props
|
|
2753
|
+
|
|
2754
|
+
| Name | Type | Default | Description |
|
|
2755
|
+
| --- | --- | --- | --- |
|
|
2756
|
+
| groups | Array of objects | [] | The list of groups of the items. If no groups are provided all items are rendered as flat list. |
|
|
2757
|
+
| └id | String | — | A unique identifier of a group. |
|
|
2758
|
+
| └name | String | — | The name of a group. |
|
|
2759
|
+
| └position | string | — | Can be set to "last" to enforce the last position in the tree. |
|
|
2760
|
+
| └disabled | Boolean | — | Disallows the selection of the group itself. |
|
|
2761
|
+
| └className | String | — | Additional classes added to the group element. |
|
|
2762
|
+
| items | Array of Objects | [] | The list of items. |
|
|
2763
|
+
| └id | String | — | A unique identifier of an item. |
|
|
2764
|
+
| └name | string / object | — | The name of an item. Either it is a plain string or an object composed of: firstName and lastName where lastName is mandatory |
|
|
2765
|
+
| └info | String \| Node | — | The subline of an item. |
|
|
2766
|
+
| └type | string | — | The primary type of the item. This is also used as the fallback icon name and refers to the name of the respective rioglyph icon (excluding the `rioglyph-` prefix). |
|
|
2767
|
+
| └subType | string | — | The sub type of an item which is also the name of the respective rioglyph icon without the prefix. This could be used to show a secondary paired icon like for fuel type. |
|
|
2768
|
+
| └icon | string | — | The rioglyph icon name for a group. The prefix `rioglyph-` can be omitted. |
|
|
2769
|
+
| └icon | string \| null | — | Optional icon override for the item. If set to a string (e.g. `'truck'`), this icon will be used explicitly. If set to `undefined`, the `type` property will be used as the fallback icon. If set to `null`, no icon will be rendered, even if `type` is defined. This allows full control over the icon behavior while maintaining backward compatibility with type-based icons. |
|
|
2770
|
+
| └groupIds | Array of strings | [] | List of group ids the items is associated with. |
|
|
2771
|
+
| └className | string | — | Additional classes added to the item element. |
|
|
2772
|
+
| selectedGroups | Array of strings | — | List of selected group ids. |
|
|
2773
|
+
| selectedItems | Array of strings | — | List of selected item ids. |
|
|
2774
|
+
| onSelectionChange | Function | — | Merged Callback for item and group selection changes. It responds with a selection object that contains the selected itemIds and groupIds: { items: [], groups: [] } |
|
|
2775
|
+
| hasMultiselect | boolean | true | Defines the selection behavior of the tree. |
|
|
2776
|
+
| showRadioButtons | boolean | false | Defines if the single selection should also show radios. |
|
|
2777
|
+
| hideSearch | boolean | false | Defines whether or not the built-in Search is shown. |
|
|
2778
|
+
| searchPlaceholder | string | — | The text used as placeholder for the search input. |
|
|
2779
|
+
| onSearchChange | Function | — | Callback for when the search value changes. |
|
|
2780
|
+
| search | node | — | Used to define custom custom search component which replaces the built-in search. |
|
|
2781
|
+
| onTypeFilterChange | (currentTypes: string[]) => void | — | Callback triggered when the built-in asset type filter changes. This is only available when the default summary is used. |
|
|
2782
|
+
| summary | node | — | Used to define custom asset type counter component which replaces the built-in summary. |
|
|
2783
|
+
| hideSummary | boolean | false | Defines whether a summary is shown. |
|
|
2784
|
+
| hideTreeHead | boolean | false | Defines whether the entire area below the search field is shown or not. Note: Disabling the tree head will hide the select all checkbox and the tree options as well as the tree summary. |
|
|
2785
|
+
| treeHeaderContent | ReactNode | — | Additional custom content that is rendered at the top of the tree component. This can be used for nav pills. |
|
|
2786
|
+
| scrollHeight | Number | — | Defines the max-height of the scrollable list |
|
|
2787
|
+
| expandedGroups | Array of String | — | List of group ids which are expanded. |
|
|
2788
|
+
| onExpandGroupsChange | Function | — | Callback function triggered when a group expands or collapses. |
|
|
2789
|
+
| showEmptyGroups | boolean | true | Defines whether empty groups are shown or not. |
|
|
2790
|
+
| treeOptions | ReactNode | — | Component to offer customization options for the tree. |
|
|
2791
|
+
| treeOptionsTooltip | ReactNode | — | Tooltip content for the tree options dropdown. |
|
|
2792
|
+
| virtualizeThreshold | number | 50 | The number of items (including groups and children) used for virtualizing the tree. |
|
|
2793
|
+
| overscan | number | 5 | The number of items rendered beyond the visible area of a virtualized tree. |
|
|
2794
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
2795
|
+
|
|
2796
|
+
### Example: Tree without header and search
|
|
2797
|
+
|
|
2798
|
+
Tree without header and search
|
|
2799
|
+
|
|
2800
|
+
Folder 013
|
|
2801
|
+
|
|
2802
|
+
Folder 028
|
|
2803
|
+
|
|
2804
|
+
Folder 034
|
|
2805
|
+
|
|
2806
|
+
Folder 045
|
|
2807
|
+
|
|
2808
|
+
Selected items:
|
|
2809
|
+
|
|
2810
|
+
Expanded folders:
|
|
2811
|
+
|
|
2812
|
+
#### Summary
|
|
2813
|
+
|
|
2814
|
+
Tree without header and search
|
|
2815
|
+
|
|
2816
|
+
Folder 013
|
|
2817
|
+
|
|
2818
|
+
Folder 028
|
|
2819
|
+
|
|
2820
|
+
Folder 034
|
|
2821
|
+
|
|
2822
|
+
Folder 045
|
|
2823
|
+
|
|
2824
|
+
Selected items:
|
|
2825
|
+
|
|
2826
|
+
Expanded folders:
|
|
2827
|
+
|
|
2828
|
+
#### React (tsx)
|
|
2829
|
+
|
|
2830
|
+
```tsx
|
|
2831
|
+
import { useState } from 'react';
|
|
2832
|
+
import { random } from 'es-toolkit/compat';
|
|
2833
|
+
import faker from 'faker';
|
|
2834
|
+
|
|
2835
|
+
import Tree, { type TreeItem, type TreeGroup, type SelectionChangeResponse } from '@rio-cloud/rio-uikit/Tree';
|
|
2836
|
+
import LabeledElement from '@rio-cloud/rio-uikit/LabeledElement';
|
|
2837
|
+
|
|
2838
|
+
const folders2: TreeGroup[] = [
|
|
2839
|
+
{
|
|
2840
|
+
id: '1',
|
|
2841
|
+
name: 'Folder 01',
|
|
2842
|
+
icon: 'folder-closed',
|
|
2843
|
+
expandedIcon: 'folder-open',
|
|
2844
|
+
},
|
|
2845
|
+
{
|
|
2846
|
+
id: '2',
|
|
2847
|
+
name: 'Folder 02',
|
|
2848
|
+
icon: 'folder-closed',
|
|
2849
|
+
expandedIcon: 'folder-open',
|
|
2850
|
+
},
|
|
2851
|
+
{
|
|
2852
|
+
id: '3',
|
|
2853
|
+
name: 'Folder 03',
|
|
2854
|
+
icon: 'folder-closed',
|
|
2855
|
+
expandedIcon: 'folder-open',
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
id: '4',
|
|
2859
|
+
name: 'Folder 04',
|
|
2860
|
+
icon: 'folder-closed',
|
|
2861
|
+
expandedIcon: 'folder-open',
|
|
2862
|
+
},
|
|
2863
|
+
];
|
|
2864
|
+
|
|
2865
|
+
const treeItems2: TreeItem[] = Array.from({ length: 20 }, (_, index) => ({
|
|
2866
|
+
id: `${index}`,
|
|
2867
|
+
name: `${faker.random.words()} ${random(100, 999)}`,
|
|
2868
|
+
type: 'files',
|
|
2869
|
+
icon: null, // Set to "null" to omit the icon
|
|
2870
|
+
groupIds: [faker.random.arrayElement(folders2).id],
|
|
2871
|
+
}));
|
|
2872
|
+
|
|
2873
|
+
const TreeOnlyExample = () => {
|
|
2874
|
+
const [selectedItemIds, setSelectedItemIds] = useState<string[]>([]);
|
|
2875
|
+
const [expandedFolders, setExpandedFolders] = useState<string[]>([]);
|
|
2876
|
+
|
|
2877
|
+
const handleSelection = ({ items }: SelectionChangeResponse) => {
|
|
2878
|
+
setSelectedItemIds(items);
|
|
2879
|
+
};
|
|
2880
|
+
|
|
2881
|
+
const handleExpandFolder = (newExpandedFolders: string[]) => setExpandedFolders(newExpandedFolders);
|
|
2882
|
+
|
|
2883
|
+
const renderSelectedItemsOfList = (itemIds: string[], list: TreeGroup[] | TreeItem[]) => {
|
|
2884
|
+
return itemIds.map(selectedItemId => {
|
|
2885
|
+
const result = list.find(listItem => listItem.id === selectedItemId);
|
|
2886
|
+
if (result) {
|
|
2887
|
+
return <li key={selectedItemId}>{`${result.name}`}</li>;
|
|
2888
|
+
}
|
|
2889
|
+
return null;
|
|
2890
|
+
});
|
|
2891
|
+
};
|
|
2892
|
+
|
|
2893
|
+
return (
|
|
2894
|
+
<div className='display-flex flex-wrap gap-25 overflow-auto'>
|
|
2895
|
+
<div className='width-500'>
|
|
2896
|
+
<LabeledElement label='Tree without header and search'>
|
|
2897
|
+
<Tree
|
|
2898
|
+
groups={folders2}
|
|
2899
|
+
items={treeItems2}
|
|
2900
|
+
expandedGroups={expandedFolders}
|
|
2901
|
+
onExpandGroupsChange={handleExpandFolder}
|
|
2902
|
+
selectedItems={selectedItemIds}
|
|
2903
|
+
onSelectionChange={handleSelection}
|
|
2904
|
+
scrollHeight={300}
|
|
2905
|
+
hasMultiselect={false}
|
|
2906
|
+
hideSearch={true}
|
|
2907
|
+
hideTreeHead={true}
|
|
2908
|
+
/>
|
|
2909
|
+
</LabeledElement>
|
|
2910
|
+
</div>
|
|
2911
|
+
<div>
|
|
2912
|
+
<div className='h6'>Selected items:</div>
|
|
2913
|
+
<ul>{renderSelectedItemsOfList(selectedItemIds, treeItems2)}</ul>
|
|
2914
|
+
<div className='h6'>Expanded folders:</div>
|
|
2915
|
+
<ul>{renderSelectedItemsOfList(expandedFolders, folders2)}</ul>
|
|
2916
|
+
</div>
|
|
2917
|
+
</div>
|
|
2918
|
+
);
|
|
2919
|
+
};
|
|
2920
|
+
|
|
2921
|
+
export default TreeOnlyExample;
|
|
2922
|
+
```
|
|
2923
|
+
|
|
2924
|
+
#### HTML (html)
|
|
2925
|
+
|
|
2926
|
+
```html
|
|
2927
|
+
<div class="display-flex flex-wrap gap-25 overflow-auto">
|
|
2928
|
+
<div class="width-500">
|
|
2929
|
+
<div class="LabeledElement display-flex flex-column">
|
|
2930
|
+
<div class="text-color-dark max-width-100pct text-size-12 display-inline-block margin-bottom-5">Tree without header and search</div>
|
|
2931
|
+
<div class="Tree">
|
|
2932
|
+
<div class="TreeHeader">
|
|
2933
|
+
</div>
|
|
2934
|
+
<div class="TreeRoot user-select-none overflow-auto" style="max-height: 300px; position: relative;">
|
|
2935
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="1">
|
|
2936
|
+
<div class="TreeNode from-group" data-key="1">
|
|
2937
|
+
<span class="TreeLabel TreeLabelName">
|
|
2938
|
+
<span class="rioglyph rioglyph-folder-closed">
|
|
2939
|
+
</span>
|
|
2940
|
+
<span class="TreeLabelNameText">
|
|
2941
|
+
<span class="TreeLabelNameTextHeadline">Folder 01</span>
|
|
2942
|
+
</span>
|
|
2943
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">3</span>
|
|
2944
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
2945
|
+
</span>
|
|
2946
|
+
</span>
|
|
2947
|
+
</div>
|
|
2948
|
+
</div>
|
|
2949
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="2">
|
|
2950
|
+
<div class="TreeNode from-group" data-key="2">
|
|
2951
|
+
<span class="TreeLabel TreeLabelName">
|
|
2952
|
+
<span class="rioglyph rioglyph-folder-closed">
|
|
2953
|
+
</span>
|
|
2954
|
+
<span class="TreeLabelNameText">
|
|
2955
|
+
<span class="TreeLabelNameTextHeadline">Folder 02</span>
|
|
2956
|
+
</span>
|
|
2957
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">8</span>
|
|
2958
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
2959
|
+
</span>
|
|
2960
|
+
</span>
|
|
2961
|
+
</div>
|
|
2962
|
+
</div>
|
|
2963
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="3">
|
|
2964
|
+
<div class="TreeNode from-group" data-key="3">
|
|
2965
|
+
<span class="TreeLabel TreeLabelName">
|
|
2966
|
+
<span class="rioglyph rioglyph-folder-closed">
|
|
2967
|
+
</span>
|
|
2968
|
+
<span class="TreeLabelNameText">
|
|
2969
|
+
<span class="TreeLabelNameTextHeadline">Folder 03</span>
|
|
2970
|
+
</span>
|
|
2971
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">4</span>
|
|
2972
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
2973
|
+
</span>
|
|
2974
|
+
</span>
|
|
2975
|
+
</div>
|
|
2976
|
+
</div>
|
|
2977
|
+
<div class="TreeNodeContainer user-select-none overflow-hidden" data-id="4">
|
|
2978
|
+
<div class="TreeNode from-group" data-key="4">
|
|
2979
|
+
<span class="TreeLabel TreeLabelName">
|
|
2980
|
+
<span class="rioglyph rioglyph-folder-closed">
|
|
2981
|
+
</span>
|
|
2982
|
+
<span class="TreeLabelNameText">
|
|
2983
|
+
<span class="TreeLabelNameTextHeadline">Folder 04</span>
|
|
2984
|
+
</span>
|
|
2985
|
+
<span class="TreeLabelCount label label-muted label-filled label-condensed">5</span>
|
|
2986
|
+
<span class="TreeLabelExpander rioglyph rioglyph-chevron-down ">
|
|
2987
|
+
</span>
|
|
2988
|
+
</span>
|
|
2989
|
+
</div>
|
|
2990
|
+
</div>
|
|
2991
|
+
</div>
|
|
2992
|
+
</div>
|
|
2993
|
+
</div>
|
|
2994
|
+
</div>
|
|
2995
|
+
<div>
|
|
2996
|
+
<div class="h6">Selected items:</div>
|
|
2997
|
+
<ul>
|
|
2998
|
+
</ul>
|
|
2999
|
+
<div class="h6">Expanded folders:</div>
|
|
3000
|
+
<ul>
|
|
3001
|
+
</ul>
|
|
3002
|
+
</div>
|
|
3003
|
+
</div>
|
|
3004
|
+
```
|
|
3005
|
+
|
|
3006
|
+
#### Props
|
|
3007
|
+
|
|
3008
|
+
| Name | Type | Default | Description |
|
|
3009
|
+
| --- | --- | --- | --- |
|
|
3010
|
+
| groups | Array of objects | [] | The list of groups of the items. If no groups are provided all items are rendered as flat list. |
|
|
3011
|
+
| └id | String | — | A unique identifier of a group. |
|
|
3012
|
+
| └name | String | — | The name of a group. |
|
|
3013
|
+
| └position | string | — | Can be set to "last" to enforce the last position in the tree. |
|
|
3014
|
+
| └disabled | Boolean | — | Disallows the selection of the group itself. |
|
|
3015
|
+
| └className | String | — | Additional classes added to the group element. |
|
|
3016
|
+
| items | Array of Objects | [] | The list of items. |
|
|
3017
|
+
| └id | String | — | A unique identifier of an item. |
|
|
3018
|
+
| └name | string / object | — | The name of an item. Either it is a plain string or an object composed of: firstName and lastName where lastName is mandatory |
|
|
3019
|
+
| └info | String \| Node | — | The subline of an item. |
|
|
3020
|
+
| └type | string | — | The primary type of the item. This is also used as the fallback icon name and refers to the name of the respective rioglyph icon (excluding the `rioglyph-` prefix). |
|
|
3021
|
+
| └subType | string | — | The sub type of an item which is also the name of the respective rioglyph icon without the prefix. This could be used to show a secondary paired icon like for fuel type. |
|
|
3022
|
+
| └icon | string | — | The rioglyph icon name for a group. The prefix `rioglyph-` can be omitted. |
|
|
3023
|
+
| └icon | string \| null | — | Optional icon override for the item. If set to a string (e.g. `'truck'`), this icon will be used explicitly. If set to `undefined`, the `type` property will be used as the fallback icon. If set to `null`, no icon will be rendered, even if `type` is defined. This allows full control over the icon behavior while maintaining backward compatibility with type-based icons. |
|
|
3024
|
+
| └groupIds | Array of strings | [] | List of group ids the items is associated with. |
|
|
3025
|
+
| └className | string | — | Additional classes added to the item element. |
|
|
3026
|
+
| selectedGroups | Array of strings | — | List of selected group ids. |
|
|
3027
|
+
| selectedItems | Array of strings | — | List of selected item ids. |
|
|
3028
|
+
| onSelectionChange | Function | — | Merged Callback for item and group selection changes. It responds with a selection object that contains the selected itemIds and groupIds: { items: [], groups: [] } |
|
|
3029
|
+
| hasMultiselect | boolean | true | Defines the selection behavior of the tree. |
|
|
3030
|
+
| showRadioButtons | boolean | false | Defines if the single selection should also show radios. |
|
|
3031
|
+
| hideSearch | boolean | false | Defines whether or not the built-in Search is shown. |
|
|
3032
|
+
| searchPlaceholder | string | — | The text used as placeholder for the search input. |
|
|
3033
|
+
| onSearchChange | Function | — | Callback for when the search value changes. |
|
|
3034
|
+
| search | node | — | Used to define custom custom search component which replaces the built-in search. |
|
|
3035
|
+
| onTypeFilterChange | (currentTypes: string[]) => void | — | Callback triggered when the built-in asset type filter changes. This is only available when the default summary is used. |
|
|
3036
|
+
| summary | node | — | Used to define custom asset type counter component which replaces the built-in summary. |
|
|
3037
|
+
| hideSummary | boolean | false | Defines whether a summary is shown. |
|
|
3038
|
+
| hideTreeHead | boolean | false | Defines whether the entire area below the search field is shown or not. Note: Disabling the tree head will hide the select all checkbox and the tree options as well as the tree summary. |
|
|
3039
|
+
| treeHeaderContent | ReactNode | — | Additional custom content that is rendered at the top of the tree component. This can be used for nav pills. |
|
|
3040
|
+
| scrollHeight | Number | — | Defines the max-height of the scrollable list |
|
|
3041
|
+
| expandedGroups | Array of String | — | List of group ids which are expanded. |
|
|
3042
|
+
| onExpandGroupsChange | Function | — | Callback function triggered when a group expands or collapses. |
|
|
3043
|
+
| showEmptyGroups | boolean | true | Defines whether empty groups are shown or not. |
|
|
3044
|
+
| treeOptions | ReactNode | — | Component to offer customization options for the tree. |
|
|
3045
|
+
| treeOptionsTooltip | ReactNode | — | Tooltip content for the tree options dropdown. |
|
|
3046
|
+
| virtualizeThreshold | number | 50 | The number of items (including groups and children) used for virtualizing the tree. |
|
|
3047
|
+
| overscan | number | 5 | The number of items rendered beyond the visible area of a virtualized tree. |
|
|
3048
|
+
| className | String | — | Additional classes added to the wrapping element. |
|
|
3049
|
+
|
|
3050
|
+
## TreeSummary with assetCounts
|
|
3051
|
+
|
|
3052
|
+
### Example: Example 7
|
|
3053
|
+
|
|
3054
|
+
12
|
|
3055
|
+
7
|
|
3056
|
+
2
|
|
3057
|
+
2
|
|
3058
|
+
10
|
|
3059
|
+
|
|
3060
|
+
#### Summary
|
|
3061
|
+
|
|
3062
|
+
12
|
|
3063
|
+
7
|
|
3064
|
+
2
|
|
3065
|
+
2
|
|
3066
|
+
10
|
|
3067
|
+
|
|
3068
|
+
#### React (tsx)
|
|
3069
|
+
|
|
3070
|
+
```tsx
|
|
3071
|
+
import TreeSummary from '@rio-cloud/rio-uikit/TreeSummary';
|
|
3072
|
+
|
|
3073
|
+
const assetCounts = {
|
|
3074
|
+
truck: 12,
|
|
3075
|
+
trailer: 7,
|
|
3076
|
+
bus: 2,
|
|
3077
|
+
van: 2,
|
|
3078
|
+
driver: 10,
|
|
3079
|
+
};
|
|
3080
|
+
|
|
3081
|
+
const TreeSummaryExample = () => <TreeSummary assetCounts={assetCounts} gridCols={5} />;
|
|
3082
|
+
|
|
3083
|
+
export default TreeSummaryExample;
|
|
3084
|
+
```
|
|
3085
|
+
|
|
3086
|
+
#### HTML (html)
|
|
3087
|
+
|
|
3088
|
+
```html
|
|
3089
|
+
<div class="TreeSummary display-flex flex-wrap align-items-center gap-10 padding-left-3">
|
|
3090
|
+
<div class="TreeSummaryRow display-grid grid-cols-5 gap-10">
|
|
3091
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 pointer-events-none">
|
|
3092
|
+
<span class="rioglyph rioglyph-truck-baseline text-size-16 margin-right-2">
|
|
3093
|
+
</span>
|
|
3094
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">12</span>
|
|
3095
|
+
</div>
|
|
3096
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 pointer-events-none">
|
|
3097
|
+
<span class="rioglyph rioglyph-trailer-baseline text-size-16 margin-right-2">
|
|
3098
|
+
</span>
|
|
3099
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">7</span>
|
|
3100
|
+
</div>
|
|
3101
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 pointer-events-none">
|
|
3102
|
+
<span class="rioglyph rioglyph-bus-baseline text-size-16 margin-right-2">
|
|
3103
|
+
</span>
|
|
3104
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">2</span>
|
|
3105
|
+
</div>
|
|
3106
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 pointer-events-none">
|
|
3107
|
+
<span class="rioglyph rioglyph-van-baseline text-size-16 margin-right-2">
|
|
3108
|
+
</span>
|
|
3109
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">2</span>
|
|
3110
|
+
</div>
|
|
3111
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 pointer-events-none">
|
|
3112
|
+
<span class="rioglyph rioglyph-driver text-size-16 margin-right-2">
|
|
3113
|
+
</span>
|
|
3114
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">10</span>
|
|
3115
|
+
</div>
|
|
3116
|
+
</div>
|
|
3117
|
+
</div>
|
|
3118
|
+
```
|
|
3119
|
+
|
|
3120
|
+
#### Props: TreeSummary
|
|
3121
|
+
|
|
3122
|
+
### TreeSummary
|
|
3123
|
+
|
|
3124
|
+
| Name | Type | Default | Description |
|
|
3125
|
+
| --- | --- | --- | --- |
|
|
3126
|
+
| assetCounts | object | — | The object containing various asset type counter. |
|
|
3127
|
+
| └truck | number | — | The amount of trucks. |
|
|
3128
|
+
| └trailer | number | — | The amount of trailers. |
|
|
3129
|
+
| └bus | number | — | The amount of buses. |
|
|
3130
|
+
| └van | number | — | The amount of vans. |
|
|
3131
|
+
| └driver | number | — | The amount of drivers. |
|
|
3132
|
+
| gridCols | number | 4 | The number of grid columns used for the built-in TreeSummaryRow |
|
|
3133
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
3134
|
+
|
|
3135
|
+
#### Props: TypeCounter
|
|
3136
|
+
|
|
3137
|
+
### TypeCounter
|
|
3138
|
+
|
|
3139
|
+
| Name | Type | Default | Description |
|
|
3140
|
+
| --- | --- | --- | --- |
|
|
3141
|
+
| type | string | — | The item type for that counter. This will be used as a return value for the onClick callback. |
|
|
3142
|
+
| icon | string | — | The icon name. Note, when using the built-in generic type counter, the icon name will the same as the item type. So make sure there is a corresponding icon for the defined type. |
|
|
3143
|
+
| isActive | Boolean | — | Sets the active styling if active. |
|
|
3144
|
+
| hasFilter | boolean | — | Should be set when there is a type filter set in the tree to style the counter accordingly. |
|
|
3145
|
+
| enableActivity | boolean | — | Allows for interactivity. Use this prop when you allow clicking on the counter. |
|
|
3146
|
+
| hideOnZero | boolean | false | Defines if the counter is rendered at all when the value is not defined ot 0. |
|
|
3147
|
+
| onClick | Function | — | Callback function when the counter is clicked. It returns the type value.Make sure the "type" prop is defined to receive the value in the callback and the flag "enableActivity" is set to true otherwise the callback is not triggered. |
|
|
3148
|
+
| value | String / Number / Node | — | A custom value to be shown in the counter. |
|
|
3149
|
+
|
|
3150
|
+
## TreeSummary with TypeCounter
|
|
3151
|
+
|
|
3152
|
+
### Example: Example 8
|
|
3153
|
+
|
|
3154
|
+
9
|
|
3155
|
+
15
|
|
3156
|
+
|
|
3157
|
+
#### Summary
|
|
3158
|
+
|
|
3159
|
+
9
|
|
3160
|
+
15
|
|
3161
|
+
|
|
3162
|
+
#### React (tsx)
|
|
3163
|
+
|
|
3164
|
+
```tsx
|
|
3165
|
+
import TreeSummary from '@rio-cloud/rio-uikit/TreeSummary';
|
|
3166
|
+
import TypeCounter from '@rio-cloud/rio-uikit/TypeCounter';
|
|
3167
|
+
|
|
3168
|
+
const TreeSummaryCustomExample = () => (
|
|
3169
|
+
<TreeSummary>
|
|
3170
|
+
<TypeCounter icon='driver' value={9} />
|
|
3171
|
+
<TypeCounter icon='drivercard-out' value={15} />
|
|
3172
|
+
</TreeSummary>
|
|
3173
|
+
);
|
|
3174
|
+
|
|
3175
|
+
export default TreeSummaryCustomExample;
|
|
3176
|
+
```
|
|
3177
|
+
|
|
3178
|
+
#### HTML (html)
|
|
3179
|
+
|
|
3180
|
+
```html
|
|
3181
|
+
<div class="TreeSummary display-flex flex-wrap align-items-center gap-10 padding-left-3">
|
|
3182
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 pointer-events-none">
|
|
3183
|
+
<span class="rioglyph rioglyph-driver text-size-16 margin-right-2">
|
|
3184
|
+
</span>
|
|
3185
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">9</span>
|
|
3186
|
+
</div>
|
|
3187
|
+
<div class="TypeCounter display-flex align-items-center user-select-none margin-right-2 pointer-events-none">
|
|
3188
|
+
<span class="rioglyph rioglyph-drivercard-out text-size-16 margin-right-2">
|
|
3189
|
+
</span>
|
|
3190
|
+
<span class="TreeLabelCount label label-condensed label-muted label-filled">15</span>
|
|
3191
|
+
</div>
|
|
3192
|
+
</div>
|
|
3193
|
+
```
|
|
3194
|
+
|
|
3195
|
+
#### Props: TreeSummary
|
|
3196
|
+
|
|
3197
|
+
### TreeSummary
|
|
3198
|
+
|
|
3199
|
+
| Name | Type | Default | Description |
|
|
3200
|
+
| --- | --- | --- | --- |
|
|
3201
|
+
| assetCounts | object | — | The object containing various asset type counter. |
|
|
3202
|
+
| └truck | number | — | The amount of trucks. |
|
|
3203
|
+
| └trailer | number | — | The amount of trailers. |
|
|
3204
|
+
| └bus | number | — | The amount of buses. |
|
|
3205
|
+
| └van | number | — | The amount of vans. |
|
|
3206
|
+
| └driver | number | — | The amount of drivers. |
|
|
3207
|
+
| gridCols | number | 4 | The number of grid columns used for the built-in TreeSummaryRow |
|
|
3208
|
+
| className | string | — | Additional classes added to the wrapping element. |
|
|
3209
|
+
|
|
3210
|
+
#### Props: TypeCounter
|
|
3211
|
+
|
|
3212
|
+
### TypeCounter
|
|
3213
|
+
|
|
3214
|
+
| Name | Type | Default | Description |
|
|
3215
|
+
| --- | --- | --- | --- |
|
|
3216
|
+
| type | string | — | The item type for that counter. This will be used as a return value for the onClick callback. |
|
|
3217
|
+
| icon | string | — | The icon name. Note, when using the built-in generic type counter, the icon name will the same as the item type. So make sure there is a corresponding icon for the defined type. |
|
|
3218
|
+
| isActive | Boolean | — | Sets the active styling if active. |
|
|
3219
|
+
| hasFilter | boolean | — | Should be set when there is a type filter set in the tree to style the counter accordingly. |
|
|
3220
|
+
| enableActivity | boolean | — | Allows for interactivity. Use this prop when you allow clicking on the counter. |
|
|
3221
|
+
| hideOnZero | boolean | false | Defines if the counter is rendered at all when the value is not defined ot 0. |
|
|
3222
|
+
| onClick | Function | — | Callback function when the counter is clicked. It returns the type value.Make sure the "type" prop is defined to receive the value in the callback and the flag "enableActivity" is set to true otherwise the callback is not triggered. |
|
|
3223
|
+
| value | String / Number / Node | — | A custom value to be shown in the counter. |
|