@wavemaker-ai/react-runtime 1.0.0-rc.309 → 1.0.0-rc.314
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/.npmignore +4 -0
- package/actions/base-action.js +12 -29
- package/actions/login-action.js +35 -52
- package/actions/logout-action.js +21 -38
- package/actions/navigation-action.js +251 -346
- package/actions/notification-action.js +121 -149
- package/actions/timer-action.js +95 -151
- package/actions/toast-provider.js +62 -76
- package/actions/toast.js +95 -91
- package/actions/toast.service.js +59 -79
- package/actions/types/index.js +6 -9
- package/components/advanced/carousel/index.js +358 -366
- package/components/advanced/carousel/props.js +0 -5
- package/components/advanced/carousel/template.js +102 -80
- package/components/advanced/login/index.js +227 -285
- package/components/advanced/login/props.js +0 -5
- package/components/advanced/marquee/index.js +169 -163
- package/components/advanced/marquee/props.js +0 -5
- package/components/basic/anchor/index.js +207 -187
- package/components/basic/anchor/props.js +0 -5
- package/components/basic/audio/index.js +110 -72
- package/components/basic/audio/props.js +0 -5
- package/components/basic/html/index.js +163 -203
- package/components/basic/html/props.js +0 -5
- package/components/basic/html/utils.js +30 -28
- package/components/basic/icon/index.js +98 -84
- package/components/basic/icon/props.js +0 -5
- package/components/basic/iframe/iframe.utils.js +7 -16
- package/components/basic/iframe/index.js +97 -103
- package/components/basic/iframe/props.js +0 -5
- package/components/basic/label/index.js +156 -134
- package/components/basic/label/props.js +0 -5
- package/components/basic/message/index.js +129 -113
- package/components/basic/message/props.js +0 -5
- package/components/basic/picture/index.js +156 -127
- package/components/basic/picture/props.js +0 -5
- package/components/basic/progress-bar/index.js +240 -176
- package/components/basic/progress-bar/props.js +5 -31
- package/components/basic/progress-circle/index.js +166 -183
- package/components/basic/progress-circle/props.js +14 -34
- package/components/basic/richtexteditor/index.js +430 -396
- package/components/basic/richtexteditor/props.js +0 -5
- package/components/basic/search/index.js +812 -931
- package/components/basic/search/props.js +0 -5
- package/components/basic/search/providers.js +233 -380
- package/components/basic/spinner/index.js +210 -200
- package/components/basic/spinner/props.js +4 -22
- package/components/basic/tile/index.js +73 -81
- package/components/basic/tile/props.js +0 -5
- package/components/basic/tree/Components/TreeNodeComponent.js +238 -170
- package/components/basic/tree/hooks/useTreePartialNodeApi.js +143 -135
- package/components/basic/tree/index.js +378 -454
- package/components/basic/tree/props.js +0 -5
- package/components/basic/tree/utils.js +129 -185
- package/components/basic/video/index.js +161 -107
- package/components/basic/video/props.js +0 -5
- package/components/chart/index.js +42 -50
- package/components/chart/props.js +31 -37
- package/components/chart/src/ChartRenderer.js +172 -154
- package/components/chart/src/chart.js +391 -213
- package/components/chart/src/chartStyles.generated.js +6 -14
- package/components/chart/src/chartUtils.js +228 -272
- package/components/chart/src/constants.d.ts +13 -0
- package/components/chart/src/constants.js +316 -90
- package/components/chart/src/d3Setup.js +11 -30
- package/components/chart/src/dataUtils.js +362 -446
- package/components/chart/src/formatUtils.js +47 -38
- package/components/chart/src/index.js +11 -19
- package/components/chart/src/nvd3Source.generated.js +5 -13
- package/components/chart/src/pieDonutResponsiveLayout.d.ts +5 -0
- package/components/chart/src/pieDonutResponsiveLayout.js +76 -96
- package/components/chart/src/types.js +0 -5
- package/components/common/AppSpinner.js +17 -33
- package/components/common/app-spinner.js +11 -22
- package/components/common/customTemplate/index.d.ts +3 -0
- package/components/common/customTemplate/index.js +6 -0
- package/components/common/customTemplate/props.d.ts +20 -0
- package/components/common/customTemplate/props.js +0 -0
- package/components/common/customTemplate/template.d.ts +3 -0
- package/components/common/customTemplate/template.js +27 -0
- package/components/common/customTemplate/useCustomTemplate.d.ts +8 -0
- package/components/common/customTemplate/useCustomTemplate.js +17 -0
- package/components/common/customTemplate/utils.d.ts +6 -0
- package/components/common/customTemplate/utils.js +12 -0
- package/components/common/index.js +4 -12
- package/components/constants.js +81 -77
- package/components/container/accordion/accordion-pane/index.js +105 -118
- package/components/container/accordion/accordion-pane/props.js +5 -21
- package/components/container/accordion/index.js +225 -243
- package/components/container/accordion/props.js +5 -16
- package/components/container/index.js +214 -150
- package/components/container/layout-grid/grid-column/index.js +68 -43
- package/components/container/layout-grid/grid-column/props.js +0 -5
- package/components/container/layout-grid/grid-row/index.js +12 -29
- package/components/container/layout-grid/grid-row/props.js +0 -5
- package/components/container/layout-grid/index.js +53 -38
- package/components/container/layout-grid/props.js +0 -5
- package/components/container/linear-layout/index.js +56 -60
- package/components/container/linear-layout/linear-layout-item/index.js +43 -47
- package/components/container/linear-layout/linear-layout-item/props.js +0 -5
- package/components/container/linear-layout/props.js +0 -5
- package/components/container/panel/components/panel-content/index.js +7 -16
- package/components/container/panel/components/panel-header/index.js +166 -146
- package/components/container/panel/components/panel-header/props.js +0 -5
- package/components/container/panel/hooks.js +76 -102
- package/components/container/panel/index.js +289 -252
- package/components/container/panel/props.js +0 -5
- package/components/container/props.js +0 -5
- package/components/container/repeat-template/index.js +65 -44
- package/components/container/repeat-template/props.js +0 -5
- package/components/container/tabs/index.js +517 -526
- package/components/container/tabs/props.js +5 -28
- package/components/container/tabs/tab-pane/index.js +105 -100
- package/components/container/tabs/tab-pane/props.js +0 -5
- package/components/container/tabs/utils.js +30 -35
- package/components/container/wizard/WizardContext.js +9 -11
- package/components/container/wizard/components/StepComponents.js +76 -99
- package/components/container/wizard/components/WizardStep.js +107 -85
- package/components/container/wizard/index.js +791 -921
- package/components/container/wizard/props.js +0 -5
- package/components/container/wizard/utils.js +97 -131
- package/components/container/wizard/wizard-action/index.js +41 -81
- package/components/container/wizard/wizard-step/index.js +140 -120
- package/components/data/card/card-actions/index.js +13 -31
- package/components/data/card/card-content/index.js +27 -36
- package/components/data/card/card-footer/index.js +13 -31
- package/components/data/card/index.js +192 -199
- package/components/data/card/props.js +0 -5
- package/components/data/form/base-form/constant.js +5 -8
- package/components/data/form/base-form/hooks/index.js +26 -77
- package/components/data/form/base-form/hooks/useFormDataSync.js +106 -212
- package/components/data/form/base-form/hooks/useFormOperations.js +109 -161
- package/components/data/form/base-form/hooks/useFormSubmission.js +220 -280
- package/components/data/form/base-form/hooks/useFormValidation.js +119 -168
- package/components/data/form/base-form/hooks/useParentFormRelationship.js +67 -103
- package/components/data/form/base-form/index.js +531 -646
- package/components/data/form/base-form/props.js +74 -151
- package/components/data/form/base-form/utils.js +210 -323
- package/components/data/form/dynamic-fields/constant.js +43 -53
- package/components/data/form/dynamic-fields/index.js +135 -144
- package/components/data/form/dynamic-fields/props.js +0 -5
- package/components/data/form/dynamic-fields/utils.js +99 -158
- package/components/data/form/form-action/index.js +107 -85
- package/components/data/form/form-body/index.js +52 -26
- package/components/data/form/form-context.js +43 -59
- package/components/data/form/form-controller/hooks/index.js +43 -57
- package/components/data/form/form-controller/props.js +5 -8
- package/components/data/form/form-controller/utils.js +54 -49
- package/components/data/form/form-controller/validation-contrustor.js +203 -426
- package/components/data/form/form-controller/withFormController.js +319 -269
- package/components/data/form/form-dynamic-section/index.js +47 -41
- package/components/data/form/form-dynamic-section/props.js +0 -5
- package/components/data/form/form-field/base-field.js +97 -109
- package/components/data/form/form-field/index.js +91 -82
- package/components/data/form/form-field/props.js +0 -5
- package/components/data/form/form-footer/index.js +52 -25
- package/components/data/form/form-header/index.js +61 -58
- package/components/data/form/index.js +95 -74
- package/components/data/form/props.js +0 -5
- package/components/data/list/components/GroupHeader.js +34 -33
- package/components/data/list/components/GroupedListItems.js +108 -104
- package/components/data/list/components/ListContainer.js +22 -27
- package/components/data/list/components/ListDND.js +193 -185
- package/components/data/list/components/ListHeader.js +32 -49
- package/components/data/list/components/ListItem.js +153 -146
- package/components/data/list/components/ListItemWithTemplate.js +87 -105
- package/components/data/list/components/ListItems.js +180 -194
- package/components/data/list/components/ListPagination.js +127 -153
- package/components/data/list/components/LoadMoreButton.js +25 -33
- package/components/data/list/components/NoDataMessage.js +9 -22
- package/components/data/list/components/StandardListItems.js +79 -85
- package/components/data/list/components/index.js +31 -119
- package/components/data/list/components/props.js +0 -5
- package/components/data/list/hooks/index.js +22 -75
- package/components/data/list/hooks/props.js +0 -5
- package/components/data/list/hooks/useCurrentPageItems.js +20 -38
- package/components/data/list/hooks/useGroupedData.js +19 -33
- package/components/data/list/hooks/useListData.js +17 -47
- package/components/data/list/hooks/useListEffects.js +168 -237
- package/components/data/list/hooks/useListEventHandlers.js +301 -285
- package/components/data/list/hooks/useListPagination.js +90 -136
- package/components/data/list/hooks/useListState.js +49 -91
- package/components/data/list/hooks/useListStateManager.js +104 -159
- package/components/data/list/hooks/usePaginatedGroupedData.js +74 -110
- package/components/data/list/index.d.ts +1 -0
- package/components/data/list/index.js +579 -621
- package/components/data/list/props.d.ts +4 -0
- package/components/data/list/props.js +0 -5
- package/components/data/list/templates/media-template.js +29 -50
- package/components/data/list/utils/constants.js +20 -32
- package/components/data/list/utils/list-helpers.d.ts +2 -1
- package/components/data/list/utils/list-helpers.js +71 -115
- package/components/data/list/utils/list-widget-methods.js +56 -76
- package/components/data/list/utils/widget-instance-utils.js +20 -57
- package/components/data/live-filter/index.js +219 -271
- package/components/data/live-filter/props.js +5 -12
- package/components/data/live-form/index.js +68 -91
- package/components/data/live-form/props.js +5 -12
- package/components/data/pagination/components/BasicPagination.js +124 -104
- package/components/data/pagination/components/ClassicPagination.js +167 -190
- package/components/data/pagination/components/InlinePagination.js +97 -98
- package/components/data/pagination/components/LoadingComponent.js +17 -30
- package/components/data/pagination/components/PageSizeSelector.js +176 -169
- package/components/data/pagination/components/PagerNavigation.js +84 -105
- package/components/data/pagination/components/TotalRecords.js +48 -47
- package/components/data/pagination/components/index.js +14 -47
- package/components/data/pagination/components/props.js +0 -5
- package/components/data/pagination/hooks/index.js +6 -19
- package/components/data/pagination/hooks/props.js +0 -5
- package/components/data/pagination/hooks/useNavigationSize.js +12 -21
- package/components/data/pagination/hooks/usePagination.js +702 -905
- package/components/data/pagination/index.js +336 -389
- package/components/data/table/components/AddNewRow.js +122 -154
- package/components/data/table/components/EditableCell.js +68 -75
- package/components/data/table/components/FieldValidationError.js +19 -20
- package/components/data/table/components/RowCells.js +97 -80
- package/components/data/table/components/RowExpansionButton.js +43 -39
- package/components/data/table/components/SummaryCell.js +54 -88
- package/components/data/table/components/SummaryRow.js +45 -52
- package/components/data/table/components/SummaryRowFooter.js +35 -42
- package/components/data/table/components/TableBody.js +222 -218
- package/components/data/table/components/TableDataRow.js +113 -106
- package/components/data/table/components/TableFilters.js +391 -390
- package/components/data/table/components/TableFooterActions.js +25 -32
- package/components/data/table/components/TableHeader.js +460 -435
- package/components/data/table/components/TablePanelHeading.js +157 -181
- package/components/data/table/components/index.js +27 -95
- package/components/data/table/hooks/index.js +21 -230
- package/components/data/table/hooks/use-edited-rows.js +59 -94
- package/components/data/table/hooks/useCellState.js +58 -83
- package/components/data/table/hooks/useCustomExpressionColumns.js +65 -86
- package/components/data/table/hooks/useDynamicColumns.js +59 -92
- package/components/data/table/hooks/useEditingState.js +30 -41
- package/components/data/table/hooks/useFormWidget.js +163 -172
- package/components/data/table/hooks/usePaginationState.js +67 -77
- package/components/data/table/hooks/usePanelStructure.js +47 -41
- package/components/data/table/hooks/useResponsiveColumns.js +14 -20
- package/components/data/table/hooks/useRowExpansion.js +131 -127
- package/components/data/table/hooks/useRowHandlers.js +56 -69
- package/components/data/table/hooks/useRowSelection.js +249 -329
- package/components/data/table/hooks/useServerSideSorting.js +109 -175
- package/components/data/table/hooks/useTableColumns.js +322 -331
- package/components/data/table/hooks/useTableData.js +111 -166
- package/components/data/table/hooks/useTableEdit.js +526 -564
- package/components/data/table/hooks/useTableEffects.js +60 -107
- package/components/data/table/hooks/useTableFilter.js +244 -237
- package/components/data/table/hooks/useTableInitialization.js +44 -76
- package/components/data/table/hooks/useTableState.js +39 -61
- package/components/data/table/hooks/useTableStateManager.js +295 -468
- package/components/data/table/index.js +1553 -1713
- package/components/data/table/live-table/index.js +157 -219
- package/components/data/table/props.js +0 -5
- package/components/data/table/table-action/index.js +97 -75
- package/components/data/table/table-column/index.js +48 -42
- package/components/data/table/table-group/index.js +7 -25
- package/components/data/table/table-row/index.js +63 -55
- package/components/data/table/table-row-action/index.js +102 -77
- package/components/data/table/utils/buildSelectionColumns.js +86 -137
- package/components/data/table/utils/columnBuilder.js +116 -158
- package/components/data/table/utils/columnProxy.js +48 -66
- package/components/data/table/utils/columnWidthDistribution.js +40 -64
- package/components/data/table/utils/constants.js +92 -40
- package/components/data/table/utils/crud-handlers.js +292 -473
- package/components/data/table/utils/dynamic-columns.js +99 -144
- package/components/data/table/utils/groupHeaderUtils.js +36 -61
- package/components/data/table/utils/index.d.ts +8 -5
- package/components/data/table/utils/index.js +419 -639
- package/components/data/table/utils/renderDisplayCell.js +127 -169
- package/components/data/table/utils/script-page-size-broadcast.js +17 -29
- package/components/data/table/utils/selectionUtils.js +59 -113
- package/components/data/table/utils/table-helpers.js +38 -74
- package/components/data/table/utils/validation.js +35 -78
- package/components/data/table/utils/widgetMapping.d.ts +5 -0
- package/components/data/table/utils/widgetMapping.js +41 -0
- package/components/data/types.js +112 -112
- package/components/data/utils/field-data-utils.js +38 -42
- package/components/data/utils/filter-field-util.js +42 -44
- package/components/data/utils/index.js +112 -111
- package/components/dialogs/alert-dialog/index.js +83 -78
- package/components/dialogs/alert-dialog/props.js +0 -5
- package/components/dialogs/confirm-dialog/index.js +102 -92
- package/components/dialogs/confirm-dialog/props.js +0 -5
- package/components/dialogs/dialog/index.js +93 -69
- package/components/dialogs/dialog/props.js +0 -5
- package/components/dialogs/dialog-actions/index.js +12 -26
- package/components/dialogs/dialog-actions/props.js +0 -5
- package/components/dialogs/dialog-body/index.js +13 -30
- package/components/dialogs/dialog-body/props.js +0 -5
- package/components/dialogs/dialog-content/index.js +48 -41
- package/components/dialogs/dialog-content/props.js +0 -5
- package/components/dialogs/dialog-header/index.js +88 -101
- package/components/dialogs/dialog-header/props.js +0 -5
- package/components/dialogs/iframe-dialog/index.js +136 -128
- package/components/dialogs/iframe-dialog/props.js +0 -5
- package/components/dialogs/index.js +104 -101
- package/components/dialogs/login-dialog/index.js +285 -347
- package/components/dialogs/login-dialog/props.js +0 -5
- package/components/dialogs/page-dialog/index.js +95 -86
- package/components/dialogs/page-dialog/props.js +0 -5
- package/components/dialogs/props.js +0 -5
- package/components/dialogs/withDialogWrapper.js +110 -83
- package/components/form/button/index.js +296 -245
- package/components/form/button/props.js +0 -5
- package/components/form/button-group/index.js +80 -69
- package/components/form/button-group/props.js +0 -5
- package/components/input/calendar/index.js +409 -362
- package/components/input/calendar/props.js +0 -5
- package/components/input/calendar/utils.js +164 -172
- package/components/input/chips/SortableChip/index.js +109 -100
- package/components/input/chips/SortableChip/props.js +0 -5
- package/components/input/chips/index.js +663 -570
- package/components/input/chips/props.js +0 -5
- package/components/input/chips/utils.js +131 -122
- package/components/input/color-picker/index.js +536 -594
- package/components/input/color-picker/props.js +0 -5
- package/components/input/composite/index.js +71 -110
- package/components/input/composite/props.js +0 -5
- package/components/input/currency/index.js +277 -224
- package/components/input/currency/props.js +0 -5
- package/components/input/default/checkbox/index.js +329 -250
- package/components/input/default/checkbox/props.js +0 -5
- package/components/input/default/checkboxset/index.d.ts +2 -0
- package/components/input/default/checkboxset/index.js +529 -446
- package/components/input/default/checkboxset/props.d.ts +4 -0
- package/components/input/default/checkboxset/props.js +0 -5
- package/components/input/default/checkboxset/utils.js +15 -25
- package/components/input/default/radioset/index.d.ts +2 -0
- package/components/input/default/radioset/index.js +409 -350
- package/components/input/default/radioset/props.d.ts +6 -0
- package/components/input/default/radioset/props.js +0 -5
- package/components/input/default/switch/index.js +494 -458
- package/components/input/default/switch/prop.js +0 -5
- package/components/input/epoch/date/components/DatePickerPopover.js +242 -193
- package/components/input/epoch/date/index.js +638 -518
- package/components/input/epoch/date/props.js +0 -5
- package/components/input/epoch/date/styled.js +61 -70
- package/components/input/epoch/date/utils.js +67 -115
- package/components/input/epoch/datetime/index.js +758 -695
- package/components/input/epoch/datetime/props.js +0 -5
- package/components/input/epoch/datetime/utils.js +121 -186
- package/components/input/epoch/time/index.js +441 -415
- package/components/input/epoch/time/props.js +0 -5
- package/components/input/epoch/time/utils.js +101 -112
- package/components/input/fileupload/Utils.js +70 -97
- package/components/input/fileupload/components/ListItems.js +132 -130
- package/components/input/fileupload/components/MultiUpload.js +80 -77
- package/components/input/fileupload/components/SingleUpload.js +57 -57
- package/components/input/fileupload/index.js +253 -178
- package/components/input/fileupload/props.js +0 -5
- package/components/input/fileupload/useFileUpload.js +209 -258
- package/components/input/number/index.js +434 -393
- package/components/input/number/props.js +0 -5
- package/components/input/rating/index.js +401 -394
- package/components/input/rating/props.js +0 -5
- package/components/input/select/index.js +408 -463
- package/components/input/select/props.js +0 -5
- package/components/input/slider/index.js +339 -332
- package/components/input/slider/props.js +0 -5
- package/components/input/text/index.d.ts +3 -3
- package/components/input/text/index.js +438 -475
- package/components/input/text/props.d.ts +1 -1
- package/components/input/text/props.js +0 -5
- package/components/input/text/util.js +82 -222
- package/components/input/textarea/index.js +322 -358
- package/components/input/textarea/props.js +0 -5
- package/components/input/upload/index.js +135 -131
- package/components/input/upload/props.js +0 -5
- package/components/input/util/index.js +9 -11
- package/components/layout/footer/index.js +12 -35
- package/components/layout/footer/props.js +0 -5
- package/components/layout/header/index.js +12 -38
- package/components/layout/header/props.js +0 -5
- package/components/layout/leftnav/index.js +38 -44
- package/components/layout/leftnav/props.js +0 -5
- package/components/layout/rightnav/index.js +12 -36
- package/components/layout/rightnav/props.js +0 -5
- package/components/layout/topnav/index.js +24 -38
- package/components/layout/topnav/props.js +0 -5
- package/components/navbar/index.js +119 -98
- package/components/navbar/nav/index.js +236 -232
- package/components/navbar/nav/props.js +0 -5
- package/components/navbar/nav-item/index.js +74 -65
- package/components/navbar/nav-item/props.js +0 -5
- package/components/navigation/breadcrumb/index.js +38 -61
- package/components/navigation/breadcrumb/props.js +0 -5
- package/components/navigation/menu/components/ListItems.js +76 -67
- package/components/navigation/menu/constants.js +27 -42
- package/components/navigation/menu/hooks/useHoverState.hook.js +20 -47
- package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +34 -28
- package/components/navigation/menu/hooks/useTransformedDataset.hook.js +21 -14
- package/components/navigation/menu/index.js +911 -846
- package/components/navigation/menu/props.js +0 -5
- package/components/navigation/menu/utils/action-task.js +6 -9
- package/components/navigation/menu/utils/role-filter.js +41 -56
- package/components/navigation/popover/index.js +191 -205
- package/components/navigation/popover/props.js +5 -8
- package/components/page/content/index.js +9 -31
- package/components/page/content/props.js +0 -5
- package/components/page/error-boundary/index.js +115 -105
- package/components/page/error-boundary/props.js +0 -5
- package/components/page/index.js +84 -102
- package/components/page/page-content/index.js +21 -30
- package/components/page/page-content/props.js +0 -5
- package/components/page/partial/index.js +50 -45
- package/components/page/partial/props.js +0 -5
- package/components/page/partial-container/index.js +81 -107
- package/components/page/partial-container/props.d.ts +1 -1
- package/components/page/partial-container/props.js +0 -5
- package/components/page/props.js +0 -5
- package/components/page/toast-container/index.js +20 -41
- package/components/page/toast-container/props.js +0 -5
- package/components/prefab/container/index.js +60 -53
- package/components/prefab/container/props.js +0 -5
- package/components/prefab/index.js +76 -61
- package/components/prefab/props.js +0 -5
- package/context/AppContext.d.ts +1 -1
- package/context/AppContext.js +17 -18
- package/context/AppSpinnerProvider.js +19 -34
- package/context/LayoutProvider.js +54 -57
- package/context/LocalizationProvider.js +34 -49
- package/context/PrefabContext.js +68 -119
- package/context/WidgetProvider.js +160 -166
- package/core/app-config.js +0 -1
- package/core/app.service.js +200 -327
- package/core/appVariablesStore.js +10 -15
- package/core/appstore.js +37 -53
- package/core/constants/currency-constant.js +81 -83
- package/core/constants/events.js +34 -44
- package/core/constants/index.js +21 -31
- package/core/dialog.service.js +52 -72
- package/core/event-notifier.js +94 -131
- package/core/formatter/array-formatters.js +18 -32
- package/core/formatter/date-formatters.js +140 -204
- package/core/formatter/index.js +64 -117
- package/core/formatter/number-formatters.js +115 -159
- package/core/formatter/security-formatters.js +233 -283
- package/core/formatter/string-formatters.js +23 -45
- package/core/formatter/types.js +12 -18
- package/core/formatters.js +6 -24
- package/core/proxy-service.js +242 -306
- package/core/script-registry.js +87 -134
- package/core/security.service.js +8 -11
- package/core/util/compare.js +13 -25
- package/core/util/dom.js +32 -63
- package/core/util/index.d.ts +5 -0
- package/core/util/index.js +95 -95
- package/core/util/safe-is-equal.js +42 -94
- package/core/util/security.js +114 -153
- package/core/util/utils.d.ts +8 -1
- package/core/util/utils.js +124 -132
- package/core/widget-observer.js +34 -61
- package/higherOrder/BaseApp.js +327 -500
- package/higherOrder/BaseAppProps.js +0 -5
- package/higherOrder/BaseDateTime.js +277 -231
- package/higherOrder/BasePage.js +479 -735
- package/higherOrder/BasePartial.js +87 -114
- package/higherOrder/BasePrefab.js +190 -206
- package/higherOrder/DataNav.js +287 -302
- package/higherOrder/helper.js +62 -48
- package/higherOrder/props.js +0 -5
- package/higherOrder/withBaseWrapper.js +123 -168
- package/higherOrder/withStandalone.js +28 -26
- package/hooks/useAccess.js +113 -289
- package/hooks/useAppConfig.js +15 -40
- package/hooks/useAuth.js +256 -495
- package/hooks/useDataSourceSubscription.d.ts +3 -3
- package/hooks/useDataSourceSubscription.js +99 -109
- package/hooks/useDebounce.js +28 -56
- package/hooks/useDeviceVisibility.js +14 -23
- package/hooks/useHttp.d.ts +1 -0
- package/hooks/useHttp.js +318 -493
- package/libs/index.js +4 -13
- package/libs/prefab/index.js +6 -20
- package/mui-config/theme-provider.js +9 -17
- package/mui-config/theme.js +6 -9
- package/package-lock.json +822 -3191
- package/package.json +3 -19
- package/providers/AppProviders.js +21 -24
- package/runtime-dynamic/App.js +65 -93
- package/runtime-dynamic/app-initializer.js +207 -400
- package/runtime-dynamic/components/ErrorBoundary.js +59 -76
- package/runtime-dynamic/components/PageWrapper.js +23 -35
- package/runtime-dynamic/components/PrefabPreview.js +40 -69
- package/runtime-dynamic/components/partial-content.d.ts +2 -3
- package/runtime-dynamic/components/partial-content.js +66 -48
- package/runtime-dynamic/components/prefab-content.js +37 -30
- package/runtime-dynamic/components/use-dynamic-component.js +62 -150
- package/runtime-dynamic/factories/build-base-page-like-component.js +44 -58
- package/runtime-dynamic/factories/dynamic-component.d.ts +9 -0
- package/runtime-dynamic/factories/dynamic-component.js +83 -0
- package/runtime-dynamic/factories/prefab-factory.js +60 -81
- package/runtime-dynamic/factories/startup-info.js +12 -25
- package/runtime-dynamic/factories/utils.d.ts +1 -9
- package/runtime-dynamic/factories/utils.js +47 -130
- package/runtime-dynamic/index.js +56 -191
- package/runtime-dynamic/main.js +42 -70
- package/runtime-dynamic/preview-mode.js +14 -29
- package/runtime-dynamic/preview-navigation.js +21 -30
- package/runtime-dynamic/preview-path.d.ts +5 -0
- package/runtime-dynamic/preview-path.js +13 -0
- package/runtime-dynamic/preview-resource-base.js +15 -31
- package/runtime-dynamic/registry/component-registry.js +269 -334
- package/runtime-dynamic/registry/custom-widget-registry.js +11 -15
- package/runtime-dynamic/registry/index.js +24 -63
- package/runtime-dynamic/registry/store.d.ts +1 -0
- package/runtime-dynamic/registry/store.js +18 -23
- package/runtime-dynamic/routes.js +53 -81
- package/runtime-dynamic/services/app-extension-provider.js +17 -44
- package/runtime-dynamic/services/autolayout-inject.d.ts +4 -0
- package/runtime-dynamic/services/autolayout-inject.js +27 -0
- package/runtime-dynamic/services/cache.js +27 -33
- package/runtime-dynamic/services/compile-render.d.ts +9 -0
- package/runtime-dynamic/services/compile-render.js +142 -0
- package/runtime-dynamic/services/component-ref-provider.js +70 -124
- package/runtime-dynamic/services/css-scoping.js +27 -28
- package/runtime-dynamic/services/fragment-url.js +37 -50
- package/runtime-dynamic/services/index.js +48 -152
- package/runtime-dynamic/services/markup-transpiler.d.ts +2 -2
- package/runtime-dynamic/services/markup-transpiler.js +39 -231
- package/runtime-dynamic/services/prefab-resources.js +42 -130
- package/runtime-dynamic/services/resource-manager.d.ts +2 -1
- package/runtime-dynamic/services/resource-manager.js +32 -63
- package/runtime-dynamic/services/script-executor.js +50 -61
- package/runtime-dynamic/services/variable-factory.js +141 -184
- package/runtime-dynamic/services/variable-registry.js +69 -115
- package/runtime-dynamic/services/variable-transpiler.js +73 -103
- package/runtime-dynamic/shims/next-image.js +79 -50
- package/runtime-dynamic/shims/next-link.js +58 -32
- package/runtime-dynamic/shims/next-navigation.js +17 -34
- package/runtime-dynamic/utils/index.d.ts +2 -0
- package/runtime-dynamic/utils/index.js +22 -24
- package/store/bindActions/i18nActions.js +16 -18
- package/store/index.js +29 -35
- package/store/middleware/navigationMiddleware.js +25 -45
- package/store/middleware/pendingTabNavigationIntentMiddleware.js +20 -25
- package/store/slices/appConfigSlice.js +65 -94
- package/store/slices/authSlice.js +317 -471
- package/store/slices/i18nSlice.js +169 -168
- package/store/slices/navigationSlice.js +22 -20
- package/store/util/resolve-path.d.ts +1 -0
- package/store/util/resolve-path.js +7 -0
- package/store/viewport.service.js +150 -194
- package/types/index.js +10 -15
- package/utils/attr.js +198 -41
- package/utils/custom-expression/index.js +55 -151
- package/utils/custom-expression/parser.js +106 -182
- package/utils/dataset-util.js +113 -154
- package/utils/eval-expression.js +10 -19
- package/utils/form-state.util.js +60 -118
- package/utils/form-utils.js +49 -190
- package/utils/format-util.js +113 -184
- package/utils/layoutsize-util.js +11 -17
- package/utils/lib-error-skipper.js +54 -52
- package/utils/page-params-util.js +50 -40
- package/utils/pending-tab-navigation-intent.js +7 -17
- package/utils/resource-url.js +8 -19
- package/utils/state-persistance.js +136 -253
- package/utils/style-utils.d.ts +2 -0
- package/utils/style-utils.js +25 -74
- package/utils/transformedDataset-utils.js +353 -381
- package/utils/widget-cleanup-util.js +42 -74
- package/utils/widgets.js +19 -31
- package/variables/base-variable.js +117 -166
- package/variables/constants.js +5 -8
- package/variables/crud-variable.js +150 -181
- package/variables/live-variable.d.ts +1 -1
- package/variables/live-variable.js +140 -174
- package/variables/metadata.service.js +74 -116
- package/variables/model-variable.js +68 -78
- package/variables/service-variable.js +171 -285
- package/wm-namespace.js +11 -14
- package/components/chart/src/css.d.js +0 -1
- package/tsconfig.declaration.tsbuildinfo +0 -1
- package/types/global.d.js +0 -3
|
@@ -1,916 +1,948 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import React, { memo, useEffect, useRef, useState, useMemo, useCallback } from "react";
|
|
34
|
+
import clsx from "clsx";
|
|
35
|
+
import Box from "@mui/material/Box";
|
|
36
|
+
import Button from "@mui/material/Button";
|
|
37
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
38
|
+
import { withBaseWrapper } from "../../../higherOrder/withBaseWrapper";
|
|
39
|
+
import { transformDataset } from "../../../utils/transformedDataset-utils";
|
|
40
|
+
import {
|
|
41
|
+
POSITION,
|
|
42
|
+
LAYOUT,
|
|
43
|
+
AUTO_OPEN,
|
|
44
|
+
AUTO_CLOSE,
|
|
45
|
+
TOOLTIP_ENTER_DELAY,
|
|
46
|
+
CARET_CLS,
|
|
47
|
+
menuAlignClass
|
|
48
|
+
} from "./constants";
|
|
49
|
+
import { isEmpty, cloneDeep } from "lodash";
|
|
50
|
+
import Link from "@mui/material/Link";
|
|
51
|
+
import { buildMenuListClasses, CollapsibleMenu, MenuList } from "./components/ListItems";
|
|
52
|
+
import {
|
|
53
|
+
getRouteNameFromLink,
|
|
54
|
+
triggerItemAction
|
|
55
|
+
} from "../../../core/util/utils";
|
|
56
|
+
import { usePathname } from "next/navigation";
|
|
57
|
+
import { executeActionTaskFromItem } from "./utils/action-task";
|
|
58
|
+
import { filterMenuNodesByRole } from "./utils/role-filter";
|
|
59
|
+
import { useKeyboardMovements } from "./hooks/useKeyboardMovements.hook";
|
|
60
|
+
import { useTransformedDataset } from "./hooks/useTransformedDataset.hook";
|
|
61
|
+
import { useHoverState } from "./hooks/useHoverState.hook";
|
|
62
|
+
import { hyperLinkMofify } from "../../../core/constants";
|
|
63
|
+
import { removeInvalidAttributes } from "../../../utils/attr";
|
|
64
|
+
const isPathMatchingLink = (path, link) => {
|
|
65
|
+
const cleanLink = link.replace(/^#\/?/, "").split("?")[0].trim();
|
|
46
66
|
if (!cleanLink) return false;
|
|
47
|
-
|
|
48
|
-
return new RegExp("(^|/)".concat(cleanLink, "($|/)"), "i").test(path);
|
|
67
|
+
return new RegExp(`(^|/)${cleanLink}($|/)`, "i").test(path);
|
|
49
68
|
};
|
|
50
|
-
|
|
69
|
+
const hasLinkToCurrentPage = (nodes, currentPath) => {
|
|
51
70
|
if (!nodes || !Array.isArray(nodes)) return false;
|
|
52
|
-
return nodes.some(
|
|
71
|
+
return nodes.some((node) => {
|
|
53
72
|
if (node.link === currentPath) return true;
|
|
54
|
-
return node.children &&
|
|
73
|
+
return node.children && hasLinkToCurrentPage(node.children, currentPath);
|
|
55
74
|
});
|
|
56
75
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
76
|
+
const WmMenu = memo((props) => {
|
|
77
|
+
var _b, _c;
|
|
78
|
+
const _a = props, {
|
|
79
|
+
menualign = "left",
|
|
80
|
+
menuposition: initialMenuPosition = "down,right",
|
|
81
|
+
menulayout = "vertical",
|
|
82
|
+
menuclass,
|
|
83
|
+
linktarget = "_self",
|
|
84
|
+
iconclass,
|
|
85
|
+
type = "button",
|
|
86
|
+
animateitems,
|
|
87
|
+
disableMenuContext = false,
|
|
88
|
+
showonhover = false,
|
|
89
|
+
panelPosition,
|
|
90
|
+
autoclose = "outsideClick",
|
|
91
|
+
autoopen = "never",
|
|
92
|
+
hint,
|
|
93
|
+
arialabel,
|
|
94
|
+
width,
|
|
95
|
+
height,
|
|
96
|
+
iconposition = "left",
|
|
97
|
+
caption,
|
|
98
|
+
shortcutkey,
|
|
99
|
+
onClick,
|
|
100
|
+
onSelect,
|
|
101
|
+
navNodes = [],
|
|
102
|
+
styles,
|
|
103
|
+
conditionalstyles,
|
|
104
|
+
className,
|
|
105
|
+
children,
|
|
106
|
+
listener,
|
|
107
|
+
name,
|
|
108
|
+
resetNavNodes,
|
|
109
|
+
nodes$,
|
|
110
|
+
dataset,
|
|
111
|
+
orderby,
|
|
112
|
+
itemlabel = "label",
|
|
113
|
+
itemlink = "Link",
|
|
114
|
+
itemicon = "Icon",
|
|
115
|
+
itemaction,
|
|
116
|
+
userrole,
|
|
117
|
+
loggedInUser,
|
|
118
|
+
itemchildren = "children",
|
|
119
|
+
isactive,
|
|
120
|
+
displayValue,
|
|
121
|
+
onActionsclick,
|
|
122
|
+
dataPath,
|
|
123
|
+
isFromNav = false,
|
|
124
|
+
onNavItemActivate,
|
|
125
|
+
isNavItemActive = false
|
|
126
|
+
} = _a, restProps = __objRest(_a, [
|
|
127
|
+
"menualign",
|
|
128
|
+
"menuposition",
|
|
129
|
+
"menulayout",
|
|
130
|
+
"menuclass",
|
|
131
|
+
"linktarget",
|
|
132
|
+
"iconclass",
|
|
133
|
+
"type",
|
|
134
|
+
"animateitems",
|
|
135
|
+
"disableMenuContext",
|
|
136
|
+
"showonhover",
|
|
137
|
+
"panelPosition",
|
|
138
|
+
"autoclose",
|
|
139
|
+
"autoopen",
|
|
140
|
+
"hint",
|
|
141
|
+
"arialabel",
|
|
142
|
+
"width",
|
|
143
|
+
"height",
|
|
144
|
+
"iconposition",
|
|
145
|
+
"caption",
|
|
146
|
+
"shortcutkey",
|
|
147
|
+
"onClick",
|
|
148
|
+
"onSelect",
|
|
149
|
+
"navNodes",
|
|
150
|
+
"styles",
|
|
151
|
+
"conditionalstyles",
|
|
152
|
+
"className",
|
|
153
|
+
"children",
|
|
154
|
+
"listener",
|
|
155
|
+
"name",
|
|
156
|
+
"resetNavNodes",
|
|
157
|
+
"nodes$",
|
|
158
|
+
"dataset",
|
|
159
|
+
"orderby",
|
|
160
|
+
"itemlabel",
|
|
161
|
+
"itemlink",
|
|
162
|
+
"itemicon",
|
|
163
|
+
"itemaction",
|
|
164
|
+
"userrole",
|
|
165
|
+
"loggedInUser",
|
|
166
|
+
"itemchildren",
|
|
167
|
+
"isactive",
|
|
168
|
+
"displayValue",
|
|
169
|
+
"onActionsclick",
|
|
170
|
+
"dataPath",
|
|
171
|
+
"isFromNav",
|
|
172
|
+
"onNavItemActivate",
|
|
173
|
+
"isNavItemActive"
|
|
174
|
+
]);
|
|
175
|
+
const deepCloneDataset = cloneDeep(dataset);
|
|
176
|
+
const itemLabelWrapper = typeof itemlabel === "function" ? (rest) => itemlabel(__spreadValues({ App: listener == null ? void 0 : listener.App }, rest)) : itemlabel;
|
|
177
|
+
const path = usePathname();
|
|
178
|
+
const user = useMemo(
|
|
179
|
+
() => {
|
|
180
|
+
var _a2, _b2;
|
|
181
|
+
return (_b2 = loggedInUser != null ? loggedInUser : (_a2 = listener == null ? void 0 : listener.appConfig) == null ? void 0 : _a2.loggedInUser) != null ? _b2 : null;
|
|
182
|
+
},
|
|
183
|
+
[loggedInUser, (_b = listener == null ? void 0 : listener.appConfig) == null ? void 0 : _b.loggedInUser]
|
|
184
|
+
);
|
|
185
|
+
const [open, setOpen] = useState(false);
|
|
186
|
+
const [activeItem, setActiveItem] = useState(null);
|
|
187
|
+
const [focusedIndex, setFocusedIndex] = useState(-1);
|
|
188
|
+
const [menuPosition, setMenuPosition] = useState(initialMenuPosition);
|
|
189
|
+
const buttonRef = useRef(null);
|
|
190
|
+
const menuRef = useRef(null);
|
|
191
|
+
const keyboardMovements = useKeyboardMovements(menuPosition);
|
|
192
|
+
const transformedDataset = useTransformedDataset(
|
|
193
|
+
deepCloneDataset,
|
|
194
|
+
itemLabelWrapper,
|
|
195
|
+
orderby,
|
|
196
|
+
itemchildren,
|
|
197
|
+
dataPath
|
|
198
|
+
);
|
|
199
|
+
const filteredDataset = useMemo(() => {
|
|
164
200
|
if (!userrole || !transformedDataset) {
|
|
165
201
|
return transformedDataset;
|
|
166
202
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return (0, _roleFilter.filterMenuNodesByRole)(transformedDataset, userRoles, userrole);
|
|
173
|
-
}, [transformedDataset, userrole, user === null || user === void 0 ? void 0 : user.roles]);
|
|
174
|
-
var _useHoverState = (0, _useHoverState2.useHoverState)(),
|
|
175
|
-
hoveredPaths = _useHoverState.hoveredPaths,
|
|
176
|
-
handlePathMouseEnter = _useHoverState.handlePathMouseEnter,
|
|
177
|
-
handlePathMouseLeave = _useHoverState.handlePathMouseLeave;
|
|
178
|
-
|
|
179
|
-
// Hover handlers for showonhover functionality
|
|
180
|
-
var handleContainerMouseEnter = (0, _react.useCallback)(function () {
|
|
203
|
+
const userRoles = (user == null ? void 0 : user.roles) || [];
|
|
204
|
+
return filterMenuNodesByRole(transformedDataset, userRoles, userrole);
|
|
205
|
+
}, [transformedDataset, userrole, user == null ? void 0 : user.roles]);
|
|
206
|
+
const { hoveredPaths, handlePathMouseEnter, handlePathMouseLeave } = useHoverState();
|
|
207
|
+
const handleContainerMouseEnter = useCallback(() => {
|
|
181
208
|
if (showonhover) {
|
|
182
209
|
setOpen(true);
|
|
183
210
|
}
|
|
184
211
|
}, [showonhover]);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}, [showonhover]);
|
|
196
|
-
|
|
197
|
-
// Memoized values
|
|
198
|
-
var transformChildrenDataset = (0, _react.useCallback)(function (children) {
|
|
199
|
-
if (!children || !Array.isArray(children)) return [];
|
|
200
|
-
return (0, _transformedDatasetUtils.transformDataset)(children, "", itemLabelWrapper, undefined, undefined, orderby, undefined, undefined, itemchildren);
|
|
201
|
-
}, [itemLabelWrapper, orderby]);
|
|
202
|
-
var createRefsForNodes = (0, _react.useCallback)(function (nodes) {
|
|
203
|
-
if (!nodes || !Array.isArray(nodes)) return [];
|
|
204
|
-
return nodes.map(function (node) {
|
|
205
|
-
var _dataObject;
|
|
206
|
-
var nodeWithRef = _objectSpread({}, node);
|
|
207
|
-
if (!nodeWithRef.nodeRef) {
|
|
208
|
-
nodeWithRef.nodeRef = /*#__PURE__*/_react["default"].createRef();
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Check for children at node.children first, then at dataObject.children (where datasetItems stores them)
|
|
212
|
-
var existingChildren = nodeWithRef.children || ((_dataObject = nodeWithRef.dataObject) === null || _dataObject === void 0 ? void 0 : _dataObject.children);
|
|
213
|
-
if (existingChildren && existingChildren.length) {
|
|
214
|
-
var _existingChildren$;
|
|
215
|
-
// If children already have dataObject (already transformed by datasetItems), just add refs
|
|
216
|
-
// Otherwise, transform them first
|
|
217
|
-
var alreadyTransformed = ((_existingChildren$ = existingChildren[0]) === null || _existingChildren$ === void 0 ? void 0 : _existingChildren$.dataObject) !== undefined;
|
|
218
|
-
var processedChildren = alreadyTransformed ? existingChildren : transformChildrenDataset(existingChildren);
|
|
219
|
-
nodeWithRef.children = createRefsForNodes(processedChildren);
|
|
212
|
+
const handleContainerMouseLeave = useCallback(
|
|
213
|
+
(event) => {
|
|
214
|
+
var _a2, _b2, _c2;
|
|
215
|
+
if (!showonhover) return;
|
|
216
|
+
const relatedTarget = event == null ? void 0 : event.relatedTarget;
|
|
217
|
+
const isMovingToMenu = relatedTarget && (((_a2 = relatedTarget.classList) == null ? void 0 : _a2.contains("dropdown-menu")) || ((_b2 = relatedTarget.closest) == null ? void 0 : _b2.call(relatedTarget, ".dropdown-menu")) !== null || ((_c2 = relatedTarget.closest) == null ? void 0 : _c2.call(relatedTarget, ".app-menu")) !== null);
|
|
218
|
+
if (!isMovingToMenu) {
|
|
219
|
+
setOpen(false);
|
|
220
|
+
setFocusedIndex(-1);
|
|
221
|
+
setActiveItem(null);
|
|
220
222
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
},
|
|
224
|
+
[showonhover]
|
|
225
|
+
);
|
|
226
|
+
const transformChildrenDataset = useCallback(
|
|
227
|
+
(children2) => {
|
|
228
|
+
if (!children2 || !Array.isArray(children2)) return [];
|
|
229
|
+
return transformDataset(
|
|
230
|
+
children2,
|
|
231
|
+
"",
|
|
232
|
+
itemLabelWrapper,
|
|
233
|
+
void 0,
|
|
234
|
+
void 0,
|
|
235
|
+
orderby,
|
|
236
|
+
void 0,
|
|
237
|
+
void 0,
|
|
238
|
+
itemchildren
|
|
239
|
+
);
|
|
240
|
+
},
|
|
241
|
+
[itemLabelWrapper, orderby]
|
|
242
|
+
);
|
|
243
|
+
const createRefsForNodes = useCallback(
|
|
244
|
+
(nodes) => {
|
|
245
|
+
if (!nodes || !Array.isArray(nodes)) return [];
|
|
246
|
+
return nodes.map((node) => {
|
|
247
|
+
var _a2, _b2;
|
|
248
|
+
const nodeWithRef = __spreadValues({}, node);
|
|
249
|
+
if (!nodeWithRef.nodeRef) {
|
|
250
|
+
nodeWithRef.nodeRef = React.createRef();
|
|
251
|
+
}
|
|
252
|
+
const existingChildren = nodeWithRef.children || ((_a2 = nodeWithRef.dataObject) == null ? void 0 : _a2.children);
|
|
253
|
+
if (existingChildren && existingChildren.length) {
|
|
254
|
+
const alreadyTransformed = ((_b2 = existingChildren[0]) == null ? void 0 : _b2.dataObject) !== void 0;
|
|
255
|
+
const processedChildren = alreadyTransformed ? existingChildren : transformChildrenDataset(existingChildren);
|
|
256
|
+
nodeWithRef.children = createRefsForNodes(processedChildren);
|
|
257
|
+
}
|
|
258
|
+
return nodeWithRef;
|
|
259
|
+
});
|
|
260
|
+
},
|
|
261
|
+
[transformChildrenDataset]
|
|
262
|
+
);
|
|
263
|
+
const nodesWithRefs = useMemo(
|
|
264
|
+
() => createRefsForNodes(filteredDataset),
|
|
265
|
+
[filteredDataset, createRefsForNodes]
|
|
266
|
+
);
|
|
267
|
+
const flattenNodes = useCallback((nodes) => {
|
|
228
268
|
if (!nodes || !Array.isArray(nodes)) return [];
|
|
229
|
-
return nodes.reduce(
|
|
269
|
+
return nodes.reduce((acc, node) => {
|
|
230
270
|
acc.push(node);
|
|
231
271
|
if (node.children && node.children.length) {
|
|
232
|
-
acc.push
|
|
272
|
+
acc.push(...flattenNodes(node.children));
|
|
233
273
|
}
|
|
234
274
|
return acc;
|
|
235
275
|
}, []);
|
|
236
276
|
}, []);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
label = (node
|
|
277
|
+
const flattenedNodes = useMemo(() => flattenNodes(nodesWithRefs), [nodesWithRefs, flattenNodes]);
|
|
278
|
+
const getNodeProperties = useCallback(
|
|
279
|
+
(node) => {
|
|
280
|
+
const dataObject = node.dataObject || {};
|
|
281
|
+
let label;
|
|
282
|
+
let children2;
|
|
283
|
+
if (typeof itemLabelWrapper === "function") {
|
|
284
|
+
try {
|
|
285
|
+
label = itemLabelWrapper(dataObject);
|
|
286
|
+
} catch (error) {
|
|
287
|
+
console.warn("Error evaluating itemlabel expression:", error);
|
|
288
|
+
label = (node == null ? void 0 : node["label"]) || dataObject["label"];
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
label = (node == null ? void 0 : node[itemLabelWrapper]) || dataObject[itemLabelWrapper];
|
|
252
292
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
children = childrenData;
|
|
293
|
+
if (typeof itemchildren === "function") {
|
|
294
|
+
try {
|
|
295
|
+
const childrenData = itemchildren(dataObject);
|
|
296
|
+
if (Array.isArray(childrenData)) {
|
|
297
|
+
children2 = transformChildrenDataset(childrenData);
|
|
298
|
+
} else {
|
|
299
|
+
children2 = childrenData;
|
|
300
|
+
}
|
|
301
|
+
} catch (error) {
|
|
302
|
+
console.warn("Error evaluating itemchildren expression:", error);
|
|
303
|
+
children2 = (node == null ? void 0 : node["children"]) || dataObject["children"];
|
|
265
304
|
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
children = (node === null || node === void 0 ? void 0 : node["children"]) || dataObject["children"];
|
|
305
|
+
} else {
|
|
306
|
+
children2 = (node == null ? void 0 : node.children) || (dataObject == null ? void 0 : dataObject.children) || (node == null ? void 0 : node[itemchildren]) || (dataObject == null ? void 0 : dataObject[itemchildren]);
|
|
269
307
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, styles), conditionalstyles), width !== undefined && {
|
|
288
|
-
width: typeof width === "number" ? "".concat(width, "px") : width
|
|
289
|
-
}), height !== undefined && {
|
|
290
|
-
height: typeof height === "number" ? "".concat(height, "px") : height
|
|
291
|
-
});
|
|
292
|
-
}, [styles, conditionalstyles, width, height]);
|
|
293
|
-
var menuContainerStyles = (0, _react.useMemo)(function () {
|
|
294
|
-
return {
|
|
308
|
+
return {
|
|
309
|
+
label,
|
|
310
|
+
icon: (node == null ? void 0 : node[itemicon]) || dataObject[itemicon],
|
|
311
|
+
link: (node == null ? void 0 : node[itemlink]) || dataObject[itemlink] || dataObject["link"],
|
|
312
|
+
hint: (node == null ? void 0 : node[hint]) || dataObject[hint],
|
|
313
|
+
disabled: (node == null ? void 0 : node.disabled) || dataObject.disabled,
|
|
314
|
+
children: children2
|
|
315
|
+
};
|
|
316
|
+
},
|
|
317
|
+
[itemlabel, itemicon, itemlink, hint, itemchildren]
|
|
318
|
+
);
|
|
319
|
+
const buttonStyles = useMemo(
|
|
320
|
+
() => __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, styles), conditionalstyles), width !== void 0 && { width: typeof width === "number" ? `${width}px` : width }), height !== void 0 && { height: typeof height === "number" ? `${height}px` : height }),
|
|
321
|
+
[styles, conditionalstyles, width, height]
|
|
322
|
+
);
|
|
323
|
+
const menuContainerStyles = useMemo(
|
|
324
|
+
() => ({
|
|
295
325
|
textAlign: menualign,
|
|
296
326
|
position: "relative"
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
327
|
+
}),
|
|
328
|
+
[menualign]
|
|
329
|
+
);
|
|
330
|
+
const getMenuLayoutStyles = useCallback(() => {
|
|
300
331
|
switch (menulayout) {
|
|
301
|
-
case
|
|
332
|
+
case LAYOUT.HORIZONTAL:
|
|
302
333
|
return {
|
|
303
334
|
display: "flex",
|
|
304
335
|
flexDirection: "row"
|
|
305
336
|
};
|
|
306
|
-
case
|
|
337
|
+
case LAYOUT.GRID:
|
|
307
338
|
return {
|
|
308
339
|
display: "grid",
|
|
309
340
|
gridTemplateColumns: "repeat(auto-fill, minmax(150px, 1fr))",
|
|
310
341
|
gap: "8px"
|
|
311
342
|
};
|
|
312
|
-
case
|
|
343
|
+
case LAYOUT.VERTICAL:
|
|
313
344
|
default:
|
|
314
345
|
return {
|
|
315
346
|
display: "block"
|
|
316
347
|
};
|
|
317
348
|
}
|
|
318
349
|
}, [menulayout]);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
var handleMenuClick = (0, _react.useCallback)(function (event) {
|
|
322
|
-
event.preventDefault();
|
|
323
|
-
if (onClick && listener !== null && listener !== void 0 && listener.Widgets && name && listener.Widgets[name]) {
|
|
324
|
-
onClick(event, listener.Widgets[name]);
|
|
325
|
-
}
|
|
326
|
-
setOpen(function (prevState) {
|
|
327
|
-
return !prevState;
|
|
328
|
-
});
|
|
329
|
-
if (!open) {
|
|
330
|
-
setActiveItem(null);
|
|
331
|
-
setFocusedIndex(-1);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// If menu is from nav, notify nav to activate the nav item when menu button is clicked
|
|
335
|
-
if (isFromNav && onNavItemActivate) {
|
|
336
|
-
onNavItemActivate();
|
|
337
|
-
}
|
|
338
|
-
}, [onClick, listener, name, open, isFromNav, onNavItemActivate]);
|
|
339
|
-
var handleMenuItemClick = (0, _react.useCallback)(function (event, item) {
|
|
340
|
-
var _item$dataObject, _item$dataObject2, _item$dataObject3, _item$dataObject4, _item$dataObject5;
|
|
341
|
-
// since event is a synthetic event, we need to convert it to a native event to support the angular behavior
|
|
342
|
-
event = event.nativeEvent;
|
|
343
|
-
var _getNodeProperties = getNodeProperties(item),
|
|
344
|
-
label = _getNodeProperties.label,
|
|
345
|
-
icon = _getNodeProperties.icon,
|
|
346
|
-
link = _getNodeProperties.link;
|
|
347
|
-
|
|
348
|
-
// Only prevent default if item has children (submenu) or no valid link
|
|
349
|
-
if (item.children && item.children.length > 0 || !link || link === "#") {
|
|
350
|
+
const handleMenuClick = useCallback(
|
|
351
|
+
(event) => {
|
|
350
352
|
event.preventDefault();
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
353
|
+
if (onClick && (listener == null ? void 0 : listener.Widgets) && name && listener.Widgets[name]) {
|
|
354
|
+
onClick(event, listener.Widgets[name]);
|
|
355
|
+
}
|
|
356
|
+
setOpen((prevState) => !prevState);
|
|
357
|
+
if (!open) {
|
|
358
|
+
setActiveItem(null);
|
|
359
|
+
setFocusedIndex(-1);
|
|
360
|
+
}
|
|
361
|
+
if (isFromNav && onNavItemActivate) {
|
|
362
|
+
onNavItemActivate();
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
[onClick, listener, name, open, isFromNav, onNavItemActivate]
|
|
366
|
+
);
|
|
367
|
+
const handleMenuItemClick = useCallback(
|
|
368
|
+
(event, item) => {
|
|
369
|
+
var _a2, _b2, _c2, _d, _e;
|
|
370
|
+
event = event.nativeEvent;
|
|
371
|
+
const { label, icon, link } = getNodeProperties(item);
|
|
372
|
+
if (item.children && item.children.length > 0 || !link || link === "#") {
|
|
373
|
+
event.preventDefault();
|
|
374
|
+
}
|
|
375
|
+
setActiveItem(item);
|
|
376
|
+
const index = flattenedNodes.findIndex((node) => node === item);
|
|
377
|
+
if (index !== -1) {
|
|
378
|
+
setFocusedIndex(index);
|
|
379
|
+
}
|
|
380
|
+
executeActionTaskFromItem(item, listener);
|
|
381
|
+
if (item.children && item.children.length > 0) {
|
|
382
|
+
item.expanded = !item.expanded;
|
|
383
|
+
}
|
|
384
|
+
const simplifiedItem = __spreadValues(__spreadProps(__spreadValues({}, item.dataObject || {}), {
|
|
385
|
+
name: ((_a2 = item.dataObject) == null ? void 0 : _a2.name) || name,
|
|
386
|
+
label,
|
|
387
|
+
dataValue: ((_b2 = item.dataObject) == null ? void 0 : _b2.dataValue) || label,
|
|
388
|
+
value: ((_c2 = item.dataObject) == null ? void 0 : _c2.dataValue) || label,
|
|
389
|
+
icon: ((_d = item.dataObject) == null ? void 0 : _d.icon) || icon,
|
|
390
|
+
link,
|
|
391
|
+
target: (_e = item.dataObject) == null ? void 0 : _e.target
|
|
392
|
+
}), item == null ? void 0 : item.value);
|
|
393
|
+
if (onSelect) {
|
|
394
|
+
onSelect(event, props, simplifiedItem);
|
|
395
|
+
}
|
|
396
|
+
if (isFromNav && onNavItemActivate) {
|
|
397
|
+
onNavItemActivate();
|
|
398
|
+
}
|
|
399
|
+
if (name && (listener == null ? void 0 : listener.Widgets[name])) {
|
|
400
|
+
listener.Widgets[name].displayValue = label;
|
|
401
|
+
}
|
|
402
|
+
if (listener == null ? void 0 : listener.onChange) {
|
|
403
|
+
listener.onChange(name, {
|
|
404
|
+
datavalue: label
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
const routeName = hyperLinkMofify(getRouteNameFromLink((simplifiedItem == null ? void 0 : simplifiedItem.link) || ""));
|
|
408
|
+
const currentPath = window.location.pathname;
|
|
409
|
+
if (routeName !== currentPath) {
|
|
410
|
+
setTimeout(() => {
|
|
411
|
+
triggerItemAction(simplifiedItem);
|
|
412
|
+
}, 0);
|
|
413
|
+
}
|
|
414
|
+
if (autoclose === AUTO_CLOSE.ALWAYS && (!item.children || item.children.length === 0)) {
|
|
415
|
+
setOpen(false);
|
|
416
|
+
setFocusedIndex(-1);
|
|
417
|
+
}
|
|
418
|
+
onActionsclick == null ? void 0 : onActionsclick(item);
|
|
419
|
+
},
|
|
420
|
+
[
|
|
421
|
+
flattenedNodes,
|
|
422
|
+
onSelect,
|
|
423
|
+
props,
|
|
424
|
+
name,
|
|
425
|
+
listener,
|
|
426
|
+
autoclose,
|
|
427
|
+
getNodeProperties,
|
|
428
|
+
isFromNav,
|
|
429
|
+
onNavItemActivate
|
|
430
|
+
]
|
|
431
|
+
);
|
|
432
|
+
const focusNode = useCallback(
|
|
433
|
+
(index) => {
|
|
434
|
+
var _a2, _b2;
|
|
435
|
+
if ((_b2 = (_a2 = flattenedNodes[index]) == null ? void 0 : _a2.nodeRef) == null ? void 0 : _b2.current) {
|
|
436
|
+
flattenedNodes[index].nodeRef.current.focus();
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
[flattenedNodes]
|
|
440
|
+
);
|
|
441
|
+
const closeMenu = useCallback(() => {
|
|
442
|
+
var _a2;
|
|
416
443
|
setOpen(false);
|
|
417
444
|
setFocusedIndex(-1);
|
|
418
445
|
setActiveItem(null);
|
|
419
|
-
(
|
|
446
|
+
(_a2 = buttonRef.current) == null ? void 0 : _a2.focus();
|
|
420
447
|
}, []);
|
|
421
|
-
|
|
422
|
-
setOpen(
|
|
423
|
-
return !prevOpen;
|
|
424
|
-
});
|
|
448
|
+
const toggleMenu = useCallback(() => {
|
|
449
|
+
setOpen((prevOpen) => !prevOpen);
|
|
425
450
|
}, []);
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
var nextIndex = focusedIndex < 0 ? 0 : (focusedIndex + 1) % flattenedNodes.length;
|
|
434
|
-
setFocusedIndex(nextIndex);
|
|
435
|
-
focusNode(nextIndex);
|
|
436
|
-
}, [keyboardMovements, open, focusedIndex, flattenedNodes.length, focusNode]);
|
|
437
|
-
var handleArrowUp = (0, _react.useCallback)(function (event) {
|
|
438
|
-
if (keyboardMovements.MOVE_UP !== "UP-ARROW") return;
|
|
439
|
-
event.preventDefault();
|
|
440
|
-
if (!open) {
|
|
441
|
-
setOpen(true);
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
if (focusedIndex === 0) {
|
|
445
|
-
closeMenu();
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
var prevIndex = focusedIndex <= 0 ? flattenedNodes.length - 1 : (focusedIndex - 1) % flattenedNodes.length;
|
|
449
|
-
setFocusedIndex(prevIndex);
|
|
450
|
-
focusNode(prevIndex);
|
|
451
|
-
}, [keyboardMovements, open, focusedIndex, flattenedNodes.length, focusNode, closeMenu]);
|
|
452
|
-
var handleEnterOrSpace = (0, _react.useCallback)(function (event) {
|
|
453
|
-
if (keyboardMovements.ON_ENTER !== "ENTER") return;
|
|
454
|
-
event.preventDefault();
|
|
455
|
-
if (focusedIndex >= 0 && flattenedNodes[focusedIndex]) {
|
|
456
|
-
handleMenuItemClick(event, flattenedNodes[focusedIndex]);
|
|
457
|
-
} else if (open) {
|
|
458
|
-
closeMenu();
|
|
459
|
-
}
|
|
460
|
-
}, [keyboardMovements, focusedIndex, flattenedNodes, handleMenuItemClick, open, closeMenu]);
|
|
461
|
-
var handleEscape = (0, _react.useCallback)(function (event) {
|
|
462
|
-
if (keyboardMovements.ON_ESCAPE !== "ESC") return;
|
|
463
|
-
event.preventDefault();
|
|
464
|
-
closeMenu();
|
|
465
|
-
}, [keyboardMovements, closeMenu]);
|
|
466
|
-
var moveFocusHorizontally = (0, _react.useCallback)(function (direction) {
|
|
467
|
-
var nextIndex = (focusedIndex + direction + flattenedNodes.length) % flattenedNodes.length;
|
|
468
|
-
setFocusedIndex(nextIndex);
|
|
469
|
-
focusNode(nextIndex);
|
|
470
|
-
}, [focusedIndex, flattenedNodes.length, focusNode]);
|
|
471
|
-
var expandAndFocusChild = (0, _react.useCallback)(function (currentItem) {
|
|
472
|
-
currentItem.expanded = true;
|
|
473
|
-
var firstChild = currentItem.children[0];
|
|
474
|
-
var childIndex = flattenedNodes.findIndex(function (node) {
|
|
475
|
-
return node === firstChild;
|
|
476
|
-
});
|
|
477
|
-
if (childIndex !== -1) {
|
|
478
|
-
setFocusedIndex(childIndex);
|
|
479
|
-
setActiveItem(flattenedNodes[childIndex]);
|
|
480
|
-
focusNode(childIndex);
|
|
481
|
-
}
|
|
482
|
-
}, [flattenedNodes, focusNode]);
|
|
483
|
-
var collapseAndFocusParent = (0, _react.useCallback)(function (currentItem) {
|
|
484
|
-
var parentIndex = flattenedNodes.findIndex(function (node) {
|
|
485
|
-
var _node$children;
|
|
486
|
-
return (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.some(function (child) {
|
|
487
|
-
return child === currentItem;
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
if (parentIndex !== -1) {
|
|
491
|
-
flattenedNodes[parentIndex].expanded = false;
|
|
492
|
-
setFocusedIndex(parentIndex);
|
|
493
|
-
setActiveItem(flattenedNodes[parentIndex]);
|
|
494
|
-
focusNode(parentIndex);
|
|
495
|
-
}
|
|
496
|
-
}, [flattenedNodes, focusNode]);
|
|
497
|
-
var handleArrowRight = (0, _react.useCallback)(function (event) {
|
|
498
|
-
if (menulayout === _constants.LAYOUT.HORIZONTAL || keyboardMovements.MOVE_RIGHT !== "RIGHT-ARROW") return;
|
|
499
|
-
event.preventDefault();
|
|
500
|
-
if (focusedIndex >= 0 && flattenedNodes[focusedIndex]) {
|
|
501
|
-
var currentItem = flattenedNodes[focusedIndex];
|
|
502
|
-
if (currentItem.children && currentItem.children.length > 0) {
|
|
503
|
-
expandAndFocusChild(currentItem);
|
|
504
|
-
} else if (menulayout === _constants.LAYOUT.HORIZONTAL) {
|
|
505
|
-
moveFocusHorizontally(1);
|
|
451
|
+
const handleArrowDown = useCallback(
|
|
452
|
+
(event) => {
|
|
453
|
+
if (keyboardMovements.MOVE_DOWN !== "DOWN-ARROW") return;
|
|
454
|
+
event.preventDefault();
|
|
455
|
+
if (!open) {
|
|
456
|
+
setOpen(true);
|
|
457
|
+
return;
|
|
506
458
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
459
|
+
const nextIndex = focusedIndex < 0 ? 0 : (focusedIndex + 1) % flattenedNodes.length;
|
|
460
|
+
setFocusedIndex(nextIndex);
|
|
461
|
+
focusNode(nextIndex);
|
|
462
|
+
},
|
|
463
|
+
[keyboardMovements, open, focusedIndex, flattenedNodes.length, focusNode]
|
|
464
|
+
);
|
|
465
|
+
const handleArrowUp = useCallback(
|
|
466
|
+
(event) => {
|
|
467
|
+
if (keyboardMovements.MOVE_UP !== "UP-ARROW") return;
|
|
468
|
+
event.preventDefault();
|
|
469
|
+
if (!open) {
|
|
470
|
+
setOpen(true);
|
|
471
|
+
return;
|
|
518
472
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
473
|
+
if (focusedIndex === 0) {
|
|
474
|
+
closeMenu();
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const prevIndex = focusedIndex <= 0 ? flattenedNodes.length - 1 : (focusedIndex - 1) % flattenedNodes.length;
|
|
478
|
+
setFocusedIndex(prevIndex);
|
|
479
|
+
focusNode(prevIndex);
|
|
480
|
+
},
|
|
481
|
+
[keyboardMovements, open, focusedIndex, flattenedNodes.length, focusNode, closeMenu]
|
|
482
|
+
);
|
|
483
|
+
const handleEnterOrSpace = useCallback(
|
|
484
|
+
(event) => {
|
|
485
|
+
if (keyboardMovements.ON_ENTER !== "ENTER") return;
|
|
524
486
|
event.preventDefault();
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
487
|
+
if (focusedIndex >= 0 && flattenedNodes[focusedIndex]) {
|
|
488
|
+
handleMenuItemClick(event, flattenedNodes[focusedIndex]);
|
|
489
|
+
} else if (open) {
|
|
490
|
+
closeMenu();
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
[keyboardMovements, focusedIndex, flattenedNodes, handleMenuItemClick, open, closeMenu]
|
|
494
|
+
);
|
|
495
|
+
const handleEscape = useCallback(
|
|
496
|
+
(event) => {
|
|
497
|
+
if (keyboardMovements.ON_ESCAPE !== "ESC") return;
|
|
529
498
|
event.preventDefault();
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
* Path structure examples:
|
|
562
|
-
* - Root item 0: "0"
|
|
563
|
-
* - Root item 1: "1"
|
|
564
|
-
* - First child of item 0: "0-0"
|
|
565
|
-
* - Second child of item 1: "1-1"
|
|
566
|
-
* - Grandchild: "0-0-0"
|
|
567
|
-
*/
|
|
568
|
-
var renderMenuItems = (0, _react.useCallback)(function (nodes) {
|
|
569
|
-
var pathPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
570
|
-
if (!nodes || !Array.isArray(nodes)) return null;
|
|
571
|
-
return nodes.map(function (node, index) {
|
|
572
|
-
var _value;
|
|
573
|
-
var _getNodeProperties2 = getNodeProperties(node),
|
|
574
|
-
label = _getNodeProperties2.label,
|
|
575
|
-
icon = _getNodeProperties2.icon,
|
|
576
|
-
link = _getNodeProperties2.link,
|
|
577
|
-
hint = _getNodeProperties2.hint,
|
|
578
|
-
disabled = _getNodeProperties2.disabled,
|
|
579
|
-
children = _getNodeProperties2.children;
|
|
580
|
-
|
|
581
|
-
// Generate unique path for this menu item by combining parent path with index
|
|
582
|
-
var itemPath = pathPrefix ? "".concat(pathPrefix, "-").concat(index) : "".concat(index);
|
|
583
|
-
var nodeValueLink = node === null || node === void 0 || (_value = node.value) === null || _value === void 0 ? void 0 : _value.link;
|
|
584
|
-
var isActive = nodeValueLink && typeof nodeValueLink === "string" ? isPathMatchingLink(path, nodeValueLink) : link ? isPathMatchingLink(path, link) : false;
|
|
585
|
-
var _menuPosition$split = menuPosition.split(","),
|
|
586
|
-
_menuPosition$split2 = (0, _slicedToArray2["default"])(_menuPosition$split, 2),
|
|
587
|
-
verticalPos = _menuPosition$split2[0],
|
|
588
|
-
horizontalPos = _menuPosition$split2[1];
|
|
589
|
-
|
|
590
|
-
// Check if this specific path is currently hovered
|
|
591
|
-
var isHovered = hoveredPaths.has(itemPath);
|
|
592
|
-
|
|
593
|
-
// Submenu opens when item is expanded OR hovered
|
|
594
|
-
var isSubmenuOpen = node.expanded || isHovered;
|
|
595
|
-
var submenuClassName = (0, _ListItems.buildMenuListClasses)(iconposition, menulayout, horizontalPos, panelPosition, animateitems, menuPosition, isHovered);
|
|
596
|
-
return __jsx(_Box["default"], {
|
|
597
|
-
component: "li",
|
|
598
|
-
key: index,
|
|
599
|
-
className: (0, _clsx["default"])(children && children.length > 0 && "dropdown-submenu", "app-menu-item", {
|
|
600
|
-
active: isActive,
|
|
601
|
-
hovered: isHovered
|
|
602
|
-
})
|
|
603
|
-
// Track hover state for this item's path
|
|
604
|
-
,
|
|
605
|
-
onMouseEnter: function onMouseEnter() {
|
|
606
|
-
return handlePathMouseEnter(itemPath);
|
|
607
|
-
},
|
|
608
|
-
onMouseLeave: function onMouseLeave(e) {
|
|
609
|
-
return handlePathMouseLeave(itemPath, e);
|
|
610
|
-
},
|
|
611
|
-
style: {
|
|
612
|
-
position: "relative"
|
|
613
|
-
}
|
|
614
|
-
}, __jsx(_Link["default"], {
|
|
615
|
-
title: label,
|
|
616
|
-
className: disabled ? "disabled" : "",
|
|
617
|
-
onClick: function onClick(event) {
|
|
618
|
-
handleMenuItemClick(event, node);
|
|
499
|
+
closeMenu();
|
|
500
|
+
},
|
|
501
|
+
[keyboardMovements, closeMenu]
|
|
502
|
+
);
|
|
503
|
+
const moveFocusHorizontally = useCallback(
|
|
504
|
+
(direction) => {
|
|
505
|
+
const nextIndex = (focusedIndex + direction + flattenedNodes.length) % flattenedNodes.length;
|
|
506
|
+
setFocusedIndex(nextIndex);
|
|
507
|
+
focusNode(nextIndex);
|
|
508
|
+
},
|
|
509
|
+
[focusedIndex, flattenedNodes.length, focusNode]
|
|
510
|
+
);
|
|
511
|
+
const expandAndFocusChild = useCallback(
|
|
512
|
+
(currentItem) => {
|
|
513
|
+
currentItem.expanded = true;
|
|
514
|
+
const firstChild = currentItem.children[0];
|
|
515
|
+
const childIndex = flattenedNodes.findIndex((node) => node === firstChild);
|
|
516
|
+
if (childIndex !== -1) {
|
|
517
|
+
setFocusedIndex(childIndex);
|
|
518
|
+
setActiveItem(flattenedNodes[childIndex]);
|
|
519
|
+
focusNode(childIndex);
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
[flattenedNodes, focusNode]
|
|
523
|
+
);
|
|
524
|
+
const collapseAndFocusParent = useCallback(
|
|
525
|
+
(currentItem) => {
|
|
526
|
+
const parentIndex = flattenedNodes.findIndex(
|
|
527
|
+
(node) => {
|
|
528
|
+
var _a2;
|
|
529
|
+
return (_a2 = node.children) == null ? void 0 : _a2.some((child) => child === currentItem);
|
|
619
530
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
531
|
+
);
|
|
532
|
+
if (parentIndex !== -1) {
|
|
533
|
+
flattenedNodes[parentIndex].expanded = false;
|
|
534
|
+
setFocusedIndex(parentIndex);
|
|
535
|
+
setActiveItem(flattenedNodes[parentIndex]);
|
|
536
|
+
focusNode(parentIndex);
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
[flattenedNodes, focusNode]
|
|
540
|
+
);
|
|
541
|
+
const handleArrowRight = useCallback(
|
|
542
|
+
(event) => {
|
|
543
|
+
if (menulayout === LAYOUT.HORIZONTAL || keyboardMovements.MOVE_RIGHT !== "RIGHT-ARROW")
|
|
544
|
+
return;
|
|
545
|
+
event.preventDefault();
|
|
546
|
+
if (focusedIndex >= 0 && flattenedNodes[focusedIndex]) {
|
|
547
|
+
const currentItem = flattenedNodes[focusedIndex];
|
|
548
|
+
if (currentItem.children && currentItem.children.length > 0) {
|
|
549
|
+
expandAndFocusChild(currentItem);
|
|
550
|
+
} else if (menulayout === LAYOUT.HORIZONTAL) {
|
|
551
|
+
moveFocusHorizontally(1);
|
|
639
552
|
}
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
[
|
|
556
|
+
menulayout,
|
|
557
|
+
keyboardMovements,
|
|
558
|
+
focusedIndex,
|
|
559
|
+
flattenedNodes,
|
|
560
|
+
expandAndFocusChild,
|
|
561
|
+
moveFocusHorizontally
|
|
562
|
+
]
|
|
563
|
+
);
|
|
564
|
+
const handleArrowLeft = useCallback(
|
|
565
|
+
(event) => {
|
|
566
|
+
if (menulayout === LAYOUT.HORIZONTAL || keyboardMovements.MOVE_LEFT !== "LEFT-ARROW") return;
|
|
567
|
+
event.preventDefault();
|
|
568
|
+
if (focusedIndex >= 0 && flattenedNodes[focusedIndex]) {
|
|
569
|
+
const currentItem = flattenedNodes[focusedIndex];
|
|
570
|
+
if (menulayout === LAYOUT.HORIZONTAL) {
|
|
571
|
+
moveFocusHorizontally(-1);
|
|
572
|
+
} else {
|
|
573
|
+
collapseAndFocusParent(currentItem);
|
|
654
574
|
}
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
[
|
|
578
|
+
menulayout,
|
|
579
|
+
keyboardMovements,
|
|
580
|
+
focusedIndex,
|
|
581
|
+
flattenedNodes,
|
|
582
|
+
moveFocusHorizontally,
|
|
583
|
+
collapseAndFocusParent
|
|
584
|
+
]
|
|
585
|
+
);
|
|
586
|
+
const handleKeyDown = useCallback(
|
|
587
|
+
(event) => {
|
|
588
|
+
const key = event.key;
|
|
589
|
+
if (key === "Enter" && document.activeElement === buttonRef.current) {
|
|
590
|
+
event.preventDefault();
|
|
591
|
+
toggleMenu();
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
if (!open && key === "Enter") {
|
|
595
|
+
event.preventDefault();
|
|
596
|
+
setOpen(true);
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
if (!open && !["ArrowDown", "ArrowUp", "Enter", " "].includes(key)) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
if (flattenedNodes.length === 0 && open) return;
|
|
603
|
+
const keyHandlers = {
|
|
604
|
+
ArrowDown: handleArrowDown,
|
|
605
|
+
ArrowUp: handleArrowUp,
|
|
606
|
+
Enter: handleEnterOrSpace,
|
|
607
|
+
" ": handleEnterOrSpace,
|
|
608
|
+
Escape: handleEscape,
|
|
609
|
+
Tab: closeMenu,
|
|
610
|
+
ArrowRight: handleArrowRight,
|
|
611
|
+
ArrowLeft: handleArrowLeft
|
|
612
|
+
};
|
|
613
|
+
const handler = keyHandlers[key];
|
|
614
|
+
if (handler) {
|
|
615
|
+
handler(event);
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
[
|
|
619
|
+
open,
|
|
620
|
+
flattenedNodes.length,
|
|
621
|
+
toggleMenu,
|
|
622
|
+
handleArrowDown,
|
|
623
|
+
handleArrowUp,
|
|
624
|
+
handleEnterOrSpace,
|
|
625
|
+
handleEscape,
|
|
626
|
+
closeMenu,
|
|
627
|
+
handleArrowRight,
|
|
628
|
+
handleArrowLeft
|
|
629
|
+
]
|
|
630
|
+
);
|
|
631
|
+
const renderMenuItems = useCallback(
|
|
632
|
+
(nodes, pathPrefix = "") => {
|
|
633
|
+
if (!nodes || !Array.isArray(nodes)) return null;
|
|
634
|
+
return nodes.map((node, index) => {
|
|
635
|
+
var _a2;
|
|
636
|
+
const { label, icon, link, hint: hint2, disabled, children: children2 } = getNodeProperties(node);
|
|
637
|
+
const itemPath = pathPrefix ? `${pathPrefix}-${index}` : `${index}`;
|
|
638
|
+
const nodeValueLink = (_a2 = node == null ? void 0 : node.value) == null ? void 0 : _a2.link;
|
|
639
|
+
const isActive = nodeValueLink && typeof nodeValueLink === "string" ? isPathMatchingLink(path, nodeValueLink) : link ? isPathMatchingLink(path, link) : false;
|
|
640
|
+
const [verticalPos2, horizontalPos2] = menuPosition.split(",");
|
|
641
|
+
const isHovered = hoveredPaths.has(itemPath);
|
|
642
|
+
const isSubmenuOpen = node.expanded || isHovered;
|
|
643
|
+
const submenuClassName = buildMenuListClasses(
|
|
644
|
+
iconposition,
|
|
645
|
+
menulayout,
|
|
646
|
+
horizontalPos2,
|
|
647
|
+
panelPosition,
|
|
648
|
+
animateitems,
|
|
649
|
+
menuPosition,
|
|
650
|
+
isHovered
|
|
651
|
+
);
|
|
652
|
+
return /* @__PURE__ */ jsxs(
|
|
653
|
+
Box,
|
|
654
|
+
{
|
|
655
|
+
component: "li",
|
|
656
|
+
className: clsx(
|
|
657
|
+
children2 && children2.length > 0 && "dropdown-submenu",
|
|
658
|
+
"app-menu-item",
|
|
659
|
+
{
|
|
660
|
+
active: isActive,
|
|
661
|
+
hovered: isHovered
|
|
662
|
+
}
|
|
663
|
+
),
|
|
664
|
+
onMouseEnter: () => handlePathMouseEnter(itemPath),
|
|
665
|
+
onMouseLeave: (e) => handlePathMouseLeave(itemPath, e),
|
|
666
|
+
style: { position: "relative" },
|
|
667
|
+
children: [
|
|
668
|
+
/* @__PURE__ */ jsxs(
|
|
669
|
+
Link,
|
|
670
|
+
{
|
|
671
|
+
title: label,
|
|
672
|
+
className: disabled ? "disabled" : "",
|
|
673
|
+
onClick: (event) => {
|
|
674
|
+
handleMenuItemClick(event, node);
|
|
675
|
+
},
|
|
676
|
+
children: [
|
|
677
|
+
children2 && children2.length > 0 && /* @__PURE__ */ jsx(
|
|
678
|
+
"span",
|
|
679
|
+
{
|
|
680
|
+
className: clsx(
|
|
681
|
+
"pull-right fa caret",
|
|
682
|
+
menuAlignClass[menualign] || "fa-caret-right"
|
|
683
|
+
)
|
|
684
|
+
}
|
|
685
|
+
),
|
|
686
|
+
icon && /* @__PURE__ */ jsx("i", { className: `app-icon ${icon}` }),
|
|
687
|
+
/* @__PURE__ */ jsx("span", { className: "anchor-caption", children: label })
|
|
688
|
+
]
|
|
689
|
+
}
|
|
690
|
+
),
|
|
691
|
+
children2 && children2.length > 0 && (type !== "anchor" ? /* @__PURE__ */ jsx(
|
|
692
|
+
CollapsibleMenu,
|
|
693
|
+
{
|
|
694
|
+
isOpen: isSubmenuOpen,
|
|
695
|
+
verticalPos: verticalPos2,
|
|
696
|
+
className: submenuClassName,
|
|
697
|
+
style: getMenuLayoutStyles(),
|
|
698
|
+
onMouseEnter: () => handlePathMouseEnter(itemPath),
|
|
699
|
+
onMouseLeave: (e) => handlePathMouseLeave(itemPath, e),
|
|
700
|
+
children: renderMenuItems(children2, itemPath)
|
|
701
|
+
}
|
|
702
|
+
) : isSubmenuOpen && open && /* @__PURE__ */ jsx(
|
|
703
|
+
MenuList,
|
|
704
|
+
{
|
|
705
|
+
iconposition,
|
|
706
|
+
className: submenuClassName,
|
|
707
|
+
style: getMenuLayoutStyles(),
|
|
708
|
+
onMouseEnter: () => handlePathMouseEnter(itemPath),
|
|
709
|
+
onMouseLeave: (e) => handlePathMouseLeave(itemPath, e),
|
|
710
|
+
onClick: (event) => onActionsclick == null ? void 0 : onActionsclick(node),
|
|
711
|
+
children: renderMenuItems(children2, itemPath)
|
|
712
|
+
}
|
|
713
|
+
))
|
|
714
|
+
]
|
|
715
|
+
},
|
|
716
|
+
index
|
|
717
|
+
);
|
|
718
|
+
});
|
|
719
|
+
},
|
|
720
|
+
[
|
|
721
|
+
getNodeProperties,
|
|
722
|
+
menuPosition,
|
|
723
|
+
hoveredPaths,
|
|
724
|
+
handlePathMouseEnter,
|
|
725
|
+
handlePathMouseLeave,
|
|
726
|
+
hint,
|
|
727
|
+
handleMenuItemClick,
|
|
728
|
+
activeItem,
|
|
729
|
+
linktarget,
|
|
730
|
+
iconposition,
|
|
731
|
+
animateitems,
|
|
732
|
+
menualign,
|
|
733
|
+
getMenuLayoutStyles,
|
|
734
|
+
type,
|
|
735
|
+
open,
|
|
736
|
+
panelPosition
|
|
737
|
+
]
|
|
738
|
+
);
|
|
739
|
+
useEffect(() => {
|
|
661
740
|
if (!open) return;
|
|
662
741
|
setActiveItem(null);
|
|
663
742
|
setFocusedIndex(-1);
|
|
664
743
|
}, [open]);
|
|
665
|
-
|
|
666
|
-
if (autoopen ===
|
|
744
|
+
useEffect(() => {
|
|
745
|
+
if (autoopen === AUTO_OPEN.ALWAYS) {
|
|
667
746
|
setOpen(true);
|
|
668
|
-
} else if (autoopen ===
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
747
|
+
} else if (autoopen === AUTO_OPEN.ACTIVE_PAGE) {
|
|
748
|
+
const hasActiveItem = filteredDataset.some(
|
|
749
|
+
(node) => hasLinkToCurrentPage([node], window.location.pathname)
|
|
750
|
+
);
|
|
672
751
|
if (hasActiveItem) {
|
|
673
752
|
setOpen(true);
|
|
674
753
|
}
|
|
675
754
|
}
|
|
676
755
|
}, [filteredDataset, autoopen]);
|
|
677
|
-
|
|
678
|
-
|
|
756
|
+
const notifiedPathRef = useRef(null);
|
|
757
|
+
useEffect(() => {
|
|
679
758
|
if (!isFromNav || !onNavItemActivate || !filteredDataset || filteredDataset.length === 0) {
|
|
680
759
|
return;
|
|
681
760
|
}
|
|
682
|
-
|
|
683
|
-
// Check if any menu item is active using the same logic as renderMenuItems
|
|
684
|
-
var _checkIfActive = function checkIfActive(nodes) {
|
|
761
|
+
const checkIfActive = (nodes) => {
|
|
685
762
|
if (!nodes || !Array.isArray(nodes)) return false;
|
|
686
|
-
return nodes.some(
|
|
687
|
-
var
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
var nodeValueLink = node === null || node === void 0 || (_value2 = node.value) === null || _value2 === void 0 ? void 0 : _value2.link;
|
|
692
|
-
var isActive = nodeValueLink && typeof nodeValueLink === "string" ? isPathMatchingLink(path, nodeValueLink) : link ? isPathMatchingLink(path, link) : false;
|
|
763
|
+
return nodes.some((node) => {
|
|
764
|
+
var _a2;
|
|
765
|
+
const { link, children: children2 } = getNodeProperties(node);
|
|
766
|
+
const nodeValueLink = (_a2 = node == null ? void 0 : node.value) == null ? void 0 : _a2.link;
|
|
767
|
+
const isActive = nodeValueLink && typeof nodeValueLink === "string" ? isPathMatchingLink(path, nodeValueLink) : link ? isPathMatchingLink(path, link) : false;
|
|
693
768
|
if (isActive) return true;
|
|
694
|
-
if (
|
|
695
|
-
return
|
|
769
|
+
if (children2 && children2.length > 0) {
|
|
770
|
+
return checkIfActive(children2);
|
|
696
771
|
}
|
|
697
772
|
return false;
|
|
698
773
|
});
|
|
699
774
|
};
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
// Notify nav if there's an active item and we haven't notified for this path yet
|
|
775
|
+
const hasActiveItem = checkIfActive(filteredDataset);
|
|
703
776
|
if (hasActiveItem && notifiedPathRef.current !== path) {
|
|
704
777
|
onNavItemActivate();
|
|
705
778
|
notifiedPathRef.current = path;
|
|
706
779
|
setOpen(true);
|
|
707
780
|
} else if (!hasActiveItem) {
|
|
708
|
-
// Reset when no active item found
|
|
709
781
|
notifiedPathRef.current = null;
|
|
710
782
|
}
|
|
711
783
|
}, [path, filteredDataset, isFromNav, onNavItemActivate, getNodeProperties]);
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
var _menuRef$current, _buttonRef$current2;
|
|
784
|
+
useEffect(() => {
|
|
785
|
+
if (!open || autoclose === AUTO_CLOSE.NEVER || autoclose === AUTO_CLOSE.DISABLED) return;
|
|
786
|
+
const handleOutsideClick = (event) => {
|
|
787
|
+
var _a2, _b2, _c2;
|
|
717
788
|
if (!event.target) return;
|
|
718
|
-
|
|
719
|
-
|
|
789
|
+
const clickedInsideMenu = (_a2 = menuRef.current) == null ? void 0 : _a2.contains(event.target);
|
|
790
|
+
const clickedOnButton = (_b2 = buttonRef.current) == null ? void 0 : _b2.contains(event.target);
|
|
720
791
|
if (!clickedInsideMenu && !clickedOnButton) {
|
|
721
|
-
var _buttonRef$current3;
|
|
722
792
|
setOpen(false);
|
|
723
793
|
setFocusedIndex(-1);
|
|
724
794
|
setActiveItem(null);
|
|
725
|
-
(
|
|
795
|
+
(_c2 = buttonRef.current) == null ? void 0 : _c2.focus();
|
|
726
796
|
}
|
|
727
797
|
};
|
|
728
798
|
document.addEventListener("mousedown", handleOutsideClick);
|
|
729
|
-
return
|
|
799
|
+
return () => {
|
|
730
800
|
document.removeEventListener("mousedown", handleOutsideClick);
|
|
731
801
|
};
|
|
732
802
|
}, [open, autoclose]);
|
|
733
|
-
|
|
803
|
+
useEffect(() => {
|
|
734
804
|
if (!shortcutkey) return;
|
|
735
|
-
|
|
736
|
-
var
|
|
805
|
+
const handleShortcutKey = (event) => {
|
|
806
|
+
var _a2;
|
|
807
|
+
const isModifierKey = event.altKey || navigator.platform.indexOf("Mac") !== -1 && event.ctrlKey && event.altKey;
|
|
737
808
|
if (isModifierKey && event.key.toLowerCase() === shortcutkey.toLowerCase()) {
|
|
738
|
-
var _buttonRef$current4;
|
|
739
809
|
event.preventDefault();
|
|
740
|
-
setOpen(
|
|
741
|
-
|
|
742
|
-
});
|
|
743
|
-
(_buttonRef$current4 = buttonRef.current) === null || _buttonRef$current4 === void 0 || _buttonRef$current4.focus();
|
|
810
|
+
setOpen((prev) => !prev);
|
|
811
|
+
(_a2 = buttonRef.current) == null ? void 0 : _a2.focus();
|
|
744
812
|
}
|
|
745
813
|
};
|
|
746
814
|
window.addEventListener("keydown", handleShortcutKey);
|
|
747
|
-
return
|
|
815
|
+
return () => {
|
|
748
816
|
window.removeEventListener("keydown", handleShortcutKey);
|
|
749
817
|
};
|
|
750
818
|
}, [shortcutkey]);
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
(0, _react.useEffect)(function () {
|
|
755
|
-
if (nodes$ && typeof nodes$.subscribe === "function") return; // nodes$ flow will handle it
|
|
819
|
+
const executedInitialActiveRef = useRef(false);
|
|
820
|
+
useEffect(() => {
|
|
821
|
+
if (nodes$ && typeof nodes$.subscribe === "function") return;
|
|
756
822
|
if (executedInitialActiveRef.current) return;
|
|
757
823
|
if (!transformedDataset || transformedDataset.length === 0) return;
|
|
758
|
-
|
|
759
|
-
|
|
824
|
+
let itemFound = false;
|
|
825
|
+
const getItem = (nodes) => {
|
|
760
826
|
if (!nodes || !Array.isArray(nodes)) return;
|
|
761
|
-
nodes.forEach(
|
|
762
|
-
var
|
|
827
|
+
nodes.forEach((item) => {
|
|
828
|
+
var _a2;
|
|
763
829
|
if (itemFound) return;
|
|
764
|
-
if (item
|
|
830
|
+
if ((item == null ? void 0 : item.isactive) || ((_a2 = item == null ? void 0 : item.dataObject) == null ? void 0 : _a2.isactive)) {
|
|
765
831
|
itemFound = true;
|
|
766
|
-
if (listener
|
|
767
|
-
|
|
832
|
+
if ((listener == null ? void 0 : listener.Widgets) && name && onSelect) {
|
|
833
|
+
const widget = listener.Widgets[name];
|
|
768
834
|
if (widget) {
|
|
769
835
|
onSelect({}, widget, item);
|
|
770
836
|
}
|
|
771
837
|
}
|
|
772
|
-
|
|
838
|
+
executeActionTaskFromItem(item, listener);
|
|
773
839
|
}
|
|
774
|
-
if (item.children && !
|
|
775
|
-
|
|
840
|
+
if (item.children && !isEmpty(item.children)) {
|
|
841
|
+
getItem(item.children);
|
|
776
842
|
}
|
|
777
843
|
});
|
|
778
844
|
};
|
|
779
|
-
|
|
845
|
+
getItem(transformedDataset);
|
|
780
846
|
if (itemFound) {
|
|
781
847
|
executedInitialActiveRef.current = true;
|
|
782
848
|
}
|
|
783
849
|
}, []);
|
|
784
|
-
|
|
850
|
+
useEffect(() => {
|
|
785
851
|
if (!nodes$ || typeof nodes$.subscribe !== "function") return;
|
|
786
|
-
|
|
852
|
+
const datasetSubscription = nodes$.subscribe(() => {
|
|
787
853
|
if (!dataset) return;
|
|
788
|
-
|
|
789
|
-
|
|
854
|
+
let itemFound = false;
|
|
855
|
+
const getItem = (nodes) => {
|
|
790
856
|
if (!nodes || !Array.isArray(nodes)) return;
|
|
791
|
-
nodes.forEach(
|
|
857
|
+
nodes.forEach((item) => {
|
|
792
858
|
if (itemFound) return;
|
|
793
859
|
if (item.isactive) {
|
|
794
860
|
itemFound = true;
|
|
795
|
-
if (listener
|
|
796
|
-
|
|
861
|
+
if ((listener == null ? void 0 : listener.Widgets) && name && onSelect) {
|
|
862
|
+
const widget = listener.Widgets[name];
|
|
797
863
|
if (widget) {
|
|
798
864
|
onSelect({}, widget, item);
|
|
799
865
|
}
|
|
800
866
|
}
|
|
801
867
|
return false;
|
|
802
868
|
}
|
|
803
|
-
if (item.children && !
|
|
804
|
-
|
|
869
|
+
if (item.children && !isEmpty(item.children)) {
|
|
870
|
+
getItem(item.children);
|
|
805
871
|
}
|
|
806
872
|
});
|
|
807
873
|
};
|
|
808
|
-
|
|
874
|
+
getItem(dataset);
|
|
809
875
|
});
|
|
810
|
-
return
|
|
876
|
+
return () => {
|
|
811
877
|
if (datasetSubscription && typeof datasetSubscription.unsubscribe === "function") {
|
|
812
878
|
datasetSubscription.unsubscribe();
|
|
813
879
|
}
|
|
814
880
|
};
|
|
815
881
|
}, [dataset, nodes$, name, listener, onSelect]);
|
|
816
|
-
|
|
817
|
-
// ============ Exposed Methods Implementation ============
|
|
818
|
-
// 1. onShow - Lifecycle callback triggered when menu opens
|
|
819
|
-
var onShowCallback = (0, _react.useCallback)(function () {
|
|
820
|
-
// Similar to Angular's @HostListener('onShown') - lines 121-129
|
|
821
|
-
// Focus first item if opened via keyboard
|
|
882
|
+
const onShowCallback = useCallback(() => {
|
|
822
883
|
if (open && flattenedNodes.length > 0 && focusedIndex === 0) {
|
|
823
|
-
setTimeout(
|
|
824
|
-
var
|
|
825
|
-
(
|
|
884
|
+
setTimeout(() => {
|
|
885
|
+
var _a2, _b2, _c2;
|
|
886
|
+
(_c2 = (_b2 = (_a2 = flattenedNodes[0]) == null ? void 0 : _a2.nodeRef) == null ? void 0 : _b2.current) == null ? void 0 : _c2.focus();
|
|
826
887
|
}, 0);
|
|
827
888
|
}
|
|
828
|
-
|
|
829
|
-
// add the open class to the menu
|
|
830
889
|
setOpen(true);
|
|
831
890
|
}, [open, flattenedNodes, focusedIndex, props, listener, name]);
|
|
832
|
-
|
|
833
|
-
// 2. onHide - Lifecycle callback triggered when menu closes
|
|
834
|
-
var onHideCallback = (0, _react.useCallback)(function () {
|
|
835
|
-
// Similar to Angular's @HostListener('onHidden') - lines 130-137
|
|
836
|
-
// Reset menu state
|
|
891
|
+
const onHideCallback = useCallback(() => {
|
|
837
892
|
setFocusedIndex(-1);
|
|
838
893
|
setActiveItem(null);
|
|
839
|
-
|
|
840
|
-
// Reset menuposition to original value
|
|
841
894
|
setMenuPosition(initialMenuPosition);
|
|
842
|
-
|
|
843
|
-
// remove the open class from the menu
|
|
844
895
|
setOpen(false);
|
|
845
896
|
}, [initialMenuPosition, props, listener, name]);
|
|
846
|
-
|
|
847
|
-
// 3. resetNodes - Method to reset/rebuild menu items
|
|
848
|
-
var resetNodesMethod = (0, _react.useCallback)(function () {
|
|
849
|
-
// Similar to Angular's resetNodes() - lines 227-233
|
|
850
|
-
// Call the parent resetNavNodes if available
|
|
897
|
+
const resetNodesMethod = useCallback(() => {
|
|
851
898
|
if (resetNavNodes) {
|
|
852
899
|
resetNavNodes();
|
|
853
900
|
}
|
|
854
|
-
|
|
855
|
-
// Auto-open logic from Angular implementation
|
|
856
|
-
if (autoopen === _constants.AUTO_OPEN.ACTIVE_PAGE && _hasLinkToCurrentPage(transformedDataset, path)) {
|
|
901
|
+
if (autoopen === AUTO_OPEN.ACTIVE_PAGE && hasLinkToCurrentPage(transformedDataset, path)) {
|
|
857
902
|
setOpen(true);
|
|
858
|
-
} else if (autoopen ===
|
|
903
|
+
} else if (autoopen === AUTO_OPEN.ALWAYS) {
|
|
859
904
|
setOpen(true);
|
|
860
905
|
}
|
|
861
906
|
}, [resetNavNodes, autoopen, transformedDataset, path]);
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
907
|
+
const setMenuPositionMethod = useCallback((position) => {
|
|
908
|
+
const validPositions = [
|
|
909
|
+
POSITION.DOWN_RIGHT,
|
|
910
|
+
POSITION.DOWN_LEFT,
|
|
911
|
+
POSITION.UP_RIGHT,
|
|
912
|
+
POSITION.UP_LEFT,
|
|
913
|
+
POSITION.INLINE
|
|
914
|
+
];
|
|
867
915
|
if (validPositions.includes(position)) {
|
|
868
916
|
setMenuPosition(position);
|
|
869
917
|
} else {
|
|
870
|
-
console.warn(
|
|
918
|
+
console.warn(
|
|
919
|
+
`Invalid menu position: ${position}. Valid positions are: ${validPositions.join(", ")}`
|
|
920
|
+
);
|
|
871
921
|
}
|
|
872
922
|
}, []);
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
(0, _react.useEffect)(function () {
|
|
897
|
-
if (listener !== null && listener !== void 0 && listener.onChange && name) {
|
|
898
|
-
Object.defineProperty(onShowCallback, "name", {
|
|
899
|
-
value: "onShow",
|
|
900
|
-
writable: false
|
|
901
|
-
});
|
|
902
|
-
Object.defineProperty(onHideCallback, "name", {
|
|
903
|
-
value: "onHide",
|
|
904
|
-
writable: false
|
|
905
|
-
});
|
|
906
|
-
Object.defineProperty(onKeyDownMethod, "name", {
|
|
907
|
-
value: "onKeyDown",
|
|
908
|
-
writable: false
|
|
909
|
-
});
|
|
910
|
-
Object.defineProperty(resetNodesMethod, "name", {
|
|
911
|
-
value: "resetNodes",
|
|
912
|
-
writable: false
|
|
913
|
-
});
|
|
923
|
+
const onKeyDownMethod = useCallback(
|
|
924
|
+
(event, eventAction) => {
|
|
925
|
+
if (eventAction) {
|
|
926
|
+
}
|
|
927
|
+
handleKeyDown(event);
|
|
928
|
+
},
|
|
929
|
+
[handleKeyDown]
|
|
930
|
+
);
|
|
931
|
+
const onMenuItemSelectMethod = useCallback(
|
|
932
|
+
(event, item) => {
|
|
933
|
+
var _a2;
|
|
934
|
+
if (onSelect && ((_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name])) {
|
|
935
|
+
onSelect(event, listener.Widgets[name], item);
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
[onSelect, listener, name]
|
|
939
|
+
);
|
|
940
|
+
useEffect(() => {
|
|
941
|
+
if ((listener == null ? void 0 : listener.onChange) && name) {
|
|
942
|
+
Object.defineProperty(onShowCallback, "name", { value: "onShow", writable: false });
|
|
943
|
+
Object.defineProperty(onHideCallback, "name", { value: "onHide", writable: false });
|
|
944
|
+
Object.defineProperty(onKeyDownMethod, "name", { value: "onKeyDown", writable: false });
|
|
945
|
+
Object.defineProperty(resetNodesMethod, "name", { value: "resetNodes", writable: false });
|
|
914
946
|
Object.defineProperty(setMenuPositionMethod, "name", {
|
|
915
947
|
value: "setMenuPosition",
|
|
916
948
|
writable: false
|
|
@@ -929,103 +961,136 @@ var WmMenu = exports.WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
929
961
|
});
|
|
930
962
|
}
|
|
931
963
|
}, []);
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
964
|
+
const [verticalPos, horizontalPos] = menuPosition.split(",");
|
|
965
|
+
const mainMenuClassName = useMemo(
|
|
966
|
+
() => buildMenuListClasses(
|
|
967
|
+
iconposition,
|
|
968
|
+
menulayout,
|
|
969
|
+
horizontalPos,
|
|
970
|
+
panelPosition,
|
|
971
|
+
animateitems,
|
|
972
|
+
menuPosition
|
|
973
|
+
),
|
|
974
|
+
[iconposition, menulayout, horizontalPos, panelPosition, animateitems, menuPosition]
|
|
975
|
+
);
|
|
976
|
+
const hoverEventHandlers = showonhover ? {
|
|
942
977
|
onMouseEnter: handleContainerMouseEnter,
|
|
943
978
|
onMouseLeave: handleContainerMouseLeave
|
|
944
979
|
} : {};
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
980
|
+
return /* @__PURE__ */ jsxs(
|
|
981
|
+
"div",
|
|
982
|
+
__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
983
|
+
caption,
|
|
984
|
+
ref: menuRef,
|
|
985
|
+
className: clsx("dropdown", "app-menu", { open }, className)
|
|
986
|
+
}, hoverEventHandlers), {
|
|
987
|
+
onKeyDown: handleKeyDown,
|
|
988
|
+
role: "menu",
|
|
989
|
+
"aria-label": arialabel || "Menu",
|
|
990
|
+
"aria-expanded": open
|
|
991
|
+
}), { type, name }), {
|
|
992
|
+
children: [
|
|
993
|
+
/* @__PURE__ */ jsx(Tooltip, { title: hint || "", enterDelay: TOOLTIP_ENTER_DELAY, disableHoverListener: !hint, children: type === "anchor" ? /* @__PURE__ */ jsxs(
|
|
994
|
+
"a",
|
|
995
|
+
__spreadProps(__spreadValues({
|
|
996
|
+
className: clsx("dropdown-toggle app-anchor", isNavItemActive && "active"),
|
|
997
|
+
"icon-position": "left",
|
|
998
|
+
role: "button",
|
|
999
|
+
onClick: handleMenuClick,
|
|
1000
|
+
"aria-label": arialabel || "Menu",
|
|
1001
|
+
"aria-expanded": open,
|
|
1002
|
+
"aria-haspopup": "true",
|
|
1003
|
+
accessKey: shortcutkey,
|
|
1004
|
+
tabIndex: props.tabindex,
|
|
1005
|
+
style: {
|
|
1006
|
+
width: width !== void 0 ? typeof width === "number" ? `${width}px` : width : void 0,
|
|
1007
|
+
height: height !== void 0 ? typeof height === "number" ? `${height}px` : height : void 0,
|
|
1008
|
+
textAlign: menualign
|
|
1009
|
+
}
|
|
1010
|
+
}, removeInvalidAttributes(restProps)), {
|
|
1011
|
+
children: [
|
|
1012
|
+
iconclass && /* @__PURE__ */ jsx("i", { className: clsx("app-icon", iconclass), "aria-hidden": "true" }),
|
|
1013
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: `${caption} ${(_c = listener == null ? void 0 : listener.appLocale) == null ? void 0 : _c.LABEL_ICON}` }),
|
|
1014
|
+
/* @__PURE__ */ jsx("span", { className: "anchor-caption", children: caption || "" }),
|
|
1015
|
+
/* @__PURE__ */ jsx(
|
|
1016
|
+
"span",
|
|
1017
|
+
{
|
|
1018
|
+
className: clsx(
|
|
1019
|
+
"pull-right caret fa",
|
|
1020
|
+
(menuPosition == null ? void 0 : menuPosition.startsWith("up")) ? CARET_CLS.UP : CARET_CLS.DOWN
|
|
1021
|
+
)
|
|
1022
|
+
}
|
|
1023
|
+
)
|
|
1024
|
+
]
|
|
1025
|
+
})
|
|
1026
|
+
) : /* @__PURE__ */ jsxs(
|
|
1027
|
+
Button,
|
|
1028
|
+
__spreadProps(__spreadValues({
|
|
1029
|
+
className: clsx(
|
|
1030
|
+
"btn dropdown-toggle",
|
|
1031
|
+
`icon-position-${iconposition}`,
|
|
1032
|
+
"app-button",
|
|
1033
|
+
menuclass,
|
|
1034
|
+
`menu-layout-${menulayout}`,
|
|
1035
|
+
`menu-align-${menualign}`,
|
|
1036
|
+
open ? "open" : "",
|
|
1037
|
+
(menuPosition == null ? void 0 : menuPosition.startsWith("up")) ? "dropup" : "",
|
|
1038
|
+
menuPosition === POSITION.INLINE ? "dropinline-menu" : ""
|
|
1039
|
+
),
|
|
1040
|
+
ref: buttonRef,
|
|
1041
|
+
onClick: handleMenuClick,
|
|
1042
|
+
"aria-haspopup": "true",
|
|
1043
|
+
"aria-expanded": open,
|
|
1044
|
+
"aria-label": arialabel || "Menu",
|
|
1045
|
+
accessKey: shortcutkey,
|
|
1046
|
+
tabIndex: props.tabindex,
|
|
1047
|
+
style: __spreadValues(__spreadValues({
|
|
1048
|
+
width: width !== void 0 ? typeof width === "number" ? `${width}px` : width : void 0,
|
|
1049
|
+
height: height !== void 0 ? typeof height === "number" ? `${height}px` : height : void 0
|
|
1050
|
+
}, buttonStyles), menuContainerStyles)
|
|
1051
|
+
}, removeInvalidAttributes(restProps)), {
|
|
1052
|
+
children: [
|
|
1053
|
+
iconclass && /* @__PURE__ */ jsx("i", { className: clsx("app-icon", iconclass), "aria-hidden": "true" }),
|
|
1054
|
+
/* @__PURE__ */ jsx("span", { className: "btn-caption", children: caption }),
|
|
1055
|
+
/* @__PURE__ */ jsx(
|
|
1056
|
+
"span",
|
|
1057
|
+
{
|
|
1058
|
+
className: clsx(
|
|
1059
|
+
"pull-right caret fa",
|
|
1060
|
+
(menuPosition == null ? void 0 : menuPosition.startsWith("up")) ? CARET_CLS.UP : CARET_CLS.DOWN
|
|
1061
|
+
)
|
|
1062
|
+
}
|
|
1063
|
+
)
|
|
1064
|
+
]
|
|
1065
|
+
})
|
|
1066
|
+
) }),
|
|
1067
|
+
type !== "anchor" ? /* @__PURE__ */ jsx(
|
|
1068
|
+
CollapsibleMenu,
|
|
1069
|
+
__spreadProps(__spreadValues({
|
|
1070
|
+
isOpen: open,
|
|
1071
|
+
verticalPos,
|
|
1072
|
+
className: mainMenuClassName,
|
|
1073
|
+
style: getMenuLayoutStyles()
|
|
1074
|
+
}, hoverEventHandlers), {
|
|
1075
|
+
children: renderMenuItems(nodesWithRefs)
|
|
1076
|
+
})
|
|
1077
|
+
) : open && /* @__PURE__ */ jsx(
|
|
1078
|
+
MenuList,
|
|
1079
|
+
__spreadProps(__spreadValues({
|
|
1080
|
+
iconposition,
|
|
1081
|
+
className: mainMenuClassName,
|
|
1082
|
+
style: getMenuLayoutStyles()
|
|
1083
|
+
}, hoverEventHandlers), {
|
|
1084
|
+
children: renderMenuItems(nodesWithRefs)
|
|
1085
|
+
})
|
|
1086
|
+
)
|
|
1087
|
+
]
|
|
1088
|
+
})
|
|
1089
|
+
);
|
|
1018
1090
|
});
|
|
1019
1091
|
WmMenu.displayName = "WmMenu";
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
* - [Playground](https://react-components.wavemaker.ai/?path=/story/navigation-menu--showcase)
|
|
1026
|
-
*
|
|
1027
|
-
* - [Docs](https://react-components.wavemaker.ai/?path=/story/navigation-menu--docs)
|
|
1028
|
-
*
|
|
1029
|
-
* @param props - {@link WmMenuExtendedProps}
|
|
1030
|
-
*/
|
|
1031
|
-
var _default = exports["default"] = (0, _withBaseWrapper.withBaseWrapper)(WmMenu);
|
|
1092
|
+
var menu_default = withBaseWrapper(WmMenu);
|
|
1093
|
+
export {
|
|
1094
|
+
WmMenu,
|
|
1095
|
+
menu_default as default
|
|
1096
|
+
};
|