@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,658 +1,575 @@
|
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
disabled =
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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 { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import React, { useEffect, useRef, useState, useCallback, useMemo, startTransition } from "react";
|
|
34
|
+
import clsx from "clsx";
|
|
35
|
+
import Image from "next/image";
|
|
36
|
+
import debounce from "lodash-es/debounce";
|
|
37
|
+
import isPlainObject from "lodash-es/isPlainObject";
|
|
38
|
+
import Typography from "@mui/material/Typography";
|
|
39
|
+
import IconButton from "@mui/material/IconButton";
|
|
40
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
41
|
+
import MenuList from "@mui/material/MenuList";
|
|
42
|
+
import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
43
|
+
import Paper from "@mui/material/Paper";
|
|
44
|
+
import Popper from "@mui/material/Popper";
|
|
45
|
+
import CircularProgress from "@mui/material/CircularProgress";
|
|
46
|
+
import DOMPurify from "dompurify";
|
|
47
|
+
import { Box, Button } from "@mui/material";
|
|
48
|
+
import withBaseWrapper from "../../../higherOrder/withBaseWrapper";
|
|
49
|
+
import { transformDataset } from "../../../utils/transformedDataset-utils";
|
|
50
|
+
import { DataProvider, LocalDataProvider } from "./providers";
|
|
51
|
+
import withFormController from "../../data/form/form-controller/withFormController";
|
|
52
|
+
import withStandalone from "../../../higherOrder/withStandalone";
|
|
53
|
+
import {
|
|
54
|
+
CustomTemplateCaption,
|
|
55
|
+
useCustomTemplate
|
|
56
|
+
} from "../../common/customTemplate";
|
|
57
|
+
const DEFAULT_CLASS = "app-search input-group";
|
|
58
|
+
const Search = React.forwardRef((props, ref) => {
|
|
59
|
+
const _a = props, {
|
|
60
|
+
showclear = false,
|
|
61
|
+
debouncetime = 250,
|
|
62
|
+
searchkey,
|
|
63
|
+
searchon = "typing",
|
|
64
|
+
matchmode = "contains",
|
|
65
|
+
minchars = 1,
|
|
66
|
+
limit = 10,
|
|
67
|
+
tabindex = 0,
|
|
68
|
+
placeholder = "Search",
|
|
69
|
+
dropup = false,
|
|
70
|
+
readonly = false,
|
|
71
|
+
datavalue,
|
|
72
|
+
dataset = [],
|
|
73
|
+
datafield = "All Fields",
|
|
74
|
+
displayfield,
|
|
75
|
+
disabled = false,
|
|
76
|
+
autofocus = false,
|
|
77
|
+
type = "search",
|
|
78
|
+
showsearchicon: showsearchicon = true,
|
|
79
|
+
showbackbutton = false,
|
|
80
|
+
imagewidth: imagewidth = "16px",
|
|
81
|
+
width,
|
|
82
|
+
displaylabel: displaylabel,
|
|
83
|
+
displayimagesrc,
|
|
84
|
+
displayexpression,
|
|
85
|
+
datacompletemsg = "No more data to load",
|
|
86
|
+
loadingdatamsg = "Loading items...",
|
|
87
|
+
clearsearchiconclass = "wi wi-close",
|
|
88
|
+
backsearchiconclass = "wi wi-arrow-left",
|
|
89
|
+
searchiconclass = "sl-search wm-sl-l",
|
|
90
|
+
navsearchbar = false,
|
|
91
|
+
className,
|
|
92
|
+
shortcutkey,
|
|
93
|
+
required,
|
|
94
|
+
hint,
|
|
95
|
+
arialabel = "Search field",
|
|
96
|
+
onBeforeservicecall,
|
|
97
|
+
onBlur,
|
|
98
|
+
onChange,
|
|
99
|
+
onFocus,
|
|
100
|
+
onSelect,
|
|
101
|
+
onSubmit,
|
|
102
|
+
onClear,
|
|
103
|
+
onSearch,
|
|
104
|
+
onDatasetready,
|
|
105
|
+
styles: styles = {},
|
|
106
|
+
name,
|
|
107
|
+
listener,
|
|
108
|
+
content,
|
|
109
|
+
value,
|
|
110
|
+
datasetItems: datasetItems,
|
|
111
|
+
selectedItems,
|
|
112
|
+
displayValue,
|
|
113
|
+
groupedData: initialGroupedData,
|
|
114
|
+
handleHeaderClick,
|
|
115
|
+
toggleAllHeaders,
|
|
116
|
+
isDestroyed,
|
|
117
|
+
validation,
|
|
118
|
+
casesensitive = false,
|
|
119
|
+
isUpdateRequired: isUpdateRequired,
|
|
120
|
+
onQuerySearch,
|
|
121
|
+
getDisplayExpression,
|
|
122
|
+
standalone = false,
|
|
123
|
+
viewParent,
|
|
124
|
+
destroy,
|
|
125
|
+
clearSearch
|
|
126
|
+
} = _a, restProps = __objRest(_a, [
|
|
127
|
+
"showclear",
|
|
128
|
+
"debouncetime",
|
|
129
|
+
"searchkey",
|
|
130
|
+
"searchon",
|
|
131
|
+
"matchmode",
|
|
132
|
+
"minchars",
|
|
133
|
+
"limit",
|
|
134
|
+
"tabindex",
|
|
135
|
+
"placeholder",
|
|
136
|
+
"dropup",
|
|
137
|
+
"readonly",
|
|
138
|
+
"datavalue",
|
|
139
|
+
"dataset",
|
|
140
|
+
"datafield",
|
|
141
|
+
"displayfield",
|
|
142
|
+
"disabled",
|
|
143
|
+
"autofocus",
|
|
144
|
+
"type",
|
|
145
|
+
// Changed default to 'search'
|
|
146
|
+
"showsearchicon",
|
|
147
|
+
"showbackbutton",
|
|
148
|
+
// Added with default false
|
|
149
|
+
"imagewidth",
|
|
150
|
+
"width",
|
|
151
|
+
// Added width prop
|
|
152
|
+
"displaylabel",
|
|
153
|
+
"displayimagesrc",
|
|
154
|
+
"displayexpression",
|
|
155
|
+
"datacompletemsg",
|
|
156
|
+
"loadingdatamsg",
|
|
157
|
+
"clearsearchiconclass",
|
|
158
|
+
"backsearchiconclass",
|
|
159
|
+
"searchiconclass",
|
|
160
|
+
"navsearchbar",
|
|
161
|
+
"className",
|
|
162
|
+
"shortcutkey",
|
|
163
|
+
"required",
|
|
164
|
+
"hint",
|
|
165
|
+
"arialabel",
|
|
166
|
+
"onBeforeservicecall",
|
|
167
|
+
"onBlur",
|
|
168
|
+
"onChange",
|
|
169
|
+
"onFocus",
|
|
170
|
+
"onSelect",
|
|
171
|
+
"onSubmit",
|
|
172
|
+
"onClear",
|
|
173
|
+
"onSearch",
|
|
174
|
+
"onDatasetready",
|
|
175
|
+
// Added onDatasetready callback
|
|
176
|
+
"styles",
|
|
177
|
+
"name",
|
|
178
|
+
"listener",
|
|
179
|
+
"content",
|
|
180
|
+
"value",
|
|
181
|
+
// Extract props that should not be spread to DOM elements
|
|
182
|
+
"datasetItems",
|
|
183
|
+
"selectedItems",
|
|
184
|
+
"displayValue",
|
|
185
|
+
"groupedData",
|
|
186
|
+
"handleHeaderClick",
|
|
187
|
+
"toggleAllHeaders",
|
|
188
|
+
"isDestroyed",
|
|
189
|
+
"validation",
|
|
190
|
+
"casesensitive",
|
|
191
|
+
// Default to case-insensitive
|
|
192
|
+
"isUpdateRequired",
|
|
193
|
+
"onQuerySearch",
|
|
194
|
+
"getDisplayExpression",
|
|
195
|
+
"standalone",
|
|
196
|
+
"viewParent",
|
|
197
|
+
"destroy",
|
|
198
|
+
"clearSearch"
|
|
199
|
+
]);
|
|
200
|
+
const debouncedSearchRef = useRef(null);
|
|
201
|
+
const debouncedSearchItemRef = useRef(null);
|
|
202
|
+
const getDataSourceRef = useRef(
|
|
203
|
+
null
|
|
204
|
+
);
|
|
205
|
+
const searchRef = useRef(null);
|
|
206
|
+
const inputRef = useRef(null);
|
|
207
|
+
const dropdownRef = useRef(null);
|
|
208
|
+
const searchButtonRef = useRef(null);
|
|
209
|
+
const listRef = useRef(null);
|
|
210
|
+
const initializedRef = useRef(false);
|
|
211
|
+
const isLoadingNextPageRef = useRef(false);
|
|
212
|
+
const [query, setQuery] = useState(typeof datavalue === "string" ? datavalue : "");
|
|
213
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
214
|
+
const [loadingItems, setLoadingItems] = useState(false);
|
|
215
|
+
const [isScrolled, setIsScrolled] = useState(false);
|
|
216
|
+
const [page, setPage] = useState(1);
|
|
217
|
+
const [formattedDataset, setFormattedDataset] = useState([]);
|
|
218
|
+
const [groupedData, setGroupedData] = useState({});
|
|
219
|
+
const [listenQuery, setListenQuery] = useState(type === "autocomplete");
|
|
220
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
221
|
+
const [hasMoreData, setHasMoreData] = useState(true);
|
|
222
|
+
const [selectedItem, setSelectedItem] = useState(null);
|
|
223
|
+
const [updateRequired, setUpdateRequired] = useState(void 0);
|
|
224
|
+
const { templateName, setTemplate } = useCustomTemplate({ content, name });
|
|
225
|
+
const dataProvider = useMemo(() => new DataProvider(), []);
|
|
226
|
+
const normalizedData = useMemo(
|
|
227
|
+
() => transformDataset(
|
|
228
|
+
dataset,
|
|
229
|
+
datafield,
|
|
230
|
+
displayfield,
|
|
231
|
+
displaylabel,
|
|
232
|
+
displayexpression,
|
|
233
|
+
props.orderby,
|
|
234
|
+
void 0,
|
|
235
|
+
// Don't pre-group - getGroupedData will handle it
|
|
236
|
+
props.dataPath
|
|
237
|
+
),
|
|
238
|
+
[
|
|
239
|
+
dataset,
|
|
240
|
+
datafield,
|
|
241
|
+
displayfield,
|
|
242
|
+
displaylabel,
|
|
243
|
+
displayexpression,
|
|
244
|
+
props.orderby,
|
|
245
|
+
props.dataPath
|
|
246
|
+
]
|
|
247
|
+
);
|
|
248
|
+
useEffect(() => {
|
|
249
|
+
var _a2;
|
|
250
|
+
if (datavalue === void 0 || datavalue === null || datavalue === "") {
|
|
202
251
|
setQuery("");
|
|
203
252
|
setSelectedItem(null);
|
|
204
253
|
setFormattedDataset([]);
|
|
205
254
|
return;
|
|
206
255
|
}
|
|
207
|
-
if (((
|
|
208
|
-
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
-
|
|
256
|
+
if ((isPlainObject(datavalue) || Array.isArray(datavalue)) && searchkey && Object.keys(datavalue).length > 0) {
|
|
257
|
+
const value2 = Array.isArray(datavalue) ? datavalue[0] : datavalue;
|
|
258
|
+
if (value2) {
|
|
259
|
+
const key = searchkey.split(",")[0] || searchkey;
|
|
260
|
+
const item = (getDisplayExpression == null ? void 0 : getDisplayExpression(value2)) || value2[key];
|
|
212
261
|
if (item) {
|
|
213
262
|
setQuery(item);
|
|
214
|
-
handleUpdateDatavalue(
|
|
263
|
+
handleUpdateDatavalue(value2);
|
|
215
264
|
}
|
|
216
265
|
}
|
|
217
266
|
} else if (datafield !== "All Fields" && datafield) {
|
|
218
|
-
|
|
219
|
-
return item.value === datavalue;
|
|
220
|
-
});
|
|
267
|
+
let findItem = normalizedData == null ? void 0 : normalizedData.find((item) => item.value === datavalue);
|
|
221
268
|
if (findItem) {
|
|
222
|
-
|
|
223
|
-
setQuery(
|
|
269
|
+
let displayValue2 = (getDisplayExpression == null ? void 0 : getDisplayExpression(getSelectedItem(findItem))) || findItem.label;
|
|
270
|
+
setQuery(displayValue2);
|
|
224
271
|
handleUpdateDatavalue(findItem);
|
|
225
272
|
} else {
|
|
226
|
-
|
|
227
|
-
(_debouncedSearchItemR = debouncedSearchItemRef.current) === null || _debouncedSearchItemR === void 0 || _debouncedSearchItemR.call(debouncedSearchItemRef, datavalue);
|
|
273
|
+
(_a2 = debouncedSearchItemRef.current) == null ? void 0 : _a2.call(debouncedSearchItemRef, datavalue);
|
|
228
274
|
}
|
|
229
|
-
}
|
|
230
|
-
// do not remove this code specifically handled for chips component for clearing the query.
|
|
231
|
-
else if (!(0, _isPlainObject["default"])(datavalue)) {
|
|
275
|
+
} else if (!isPlainObject(datavalue)) {
|
|
232
276
|
setQuery(datavalue);
|
|
233
277
|
}
|
|
234
278
|
}, [datavalue]);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
var searchStyle = _objectSpread({
|
|
238
|
-
width: width
|
|
279
|
+
const searchStyle = __spreadValues({
|
|
280
|
+
width
|
|
239
281
|
}, styles);
|
|
240
|
-
|
|
241
|
-
// Create dataProvider instance
|
|
242
|
-
|
|
243
|
-
// Initialize debounced searchItem function
|
|
244
|
-
(0, _react.useEffect)(function () {
|
|
245
|
-
// Cancel previous debounced function if it exists
|
|
282
|
+
useEffect(() => {
|
|
246
283
|
if (debouncedSearchItemRef.current) {
|
|
247
284
|
debouncedSearchItemRef.current.cancel();
|
|
248
285
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
_context.next = 9;
|
|
263
|
-
break;
|
|
264
|
-
}
|
|
265
|
-
key = (searchkey === null || searchkey === void 0 ? void 0 : searchkey.split(",")[0]) || searchkey;
|
|
266
|
-
if (key) {
|
|
267
|
-
_context.next = 7;
|
|
268
|
-
break;
|
|
269
|
-
}
|
|
270
|
-
return _context.abrupt("return");
|
|
271
|
-
case 7:
|
|
272
|
-
findItem = response.find(function (item) {
|
|
273
|
-
return item[key] == value;
|
|
274
|
-
});
|
|
275
|
-
if (findItem && Object.keys(findItem).length > 0) {
|
|
276
|
-
_displayValue2 = (getDisplayExpression === null || getDisplayExpression === void 0 ? void 0 : getDisplayExpression(getSelectedItem(findItem))) || findItem[key];
|
|
277
|
-
setQuery(_displayValue2);
|
|
278
|
-
}
|
|
279
|
-
case 9:
|
|
280
|
-
case "end":
|
|
281
|
-
return _context.stop();
|
|
282
|
-
}
|
|
283
|
-
}, _callee);
|
|
284
|
-
}));
|
|
285
|
-
return function (_x) {
|
|
286
|
-
return _ref.apply(this, arguments);
|
|
287
|
-
};
|
|
288
|
-
}(), 200);
|
|
289
|
-
|
|
290
|
-
// Cleanup: cancel debounced function on unmount or dependency change
|
|
291
|
-
return function () {
|
|
286
|
+
debouncedSearchItemRef.current = debounce(async (value2) => {
|
|
287
|
+
const response = await (dataProvider == null ? void 0 : dataProvider.invokeVariable(props, value2));
|
|
288
|
+
if (response && response.length > 0) {
|
|
289
|
+
let key = (searchkey == null ? void 0 : searchkey.split(",")[0]) || searchkey;
|
|
290
|
+
if (!key) return;
|
|
291
|
+
const findItem = response.find((item) => item[key] == value2);
|
|
292
|
+
if (findItem && Object.keys(findItem).length > 0) {
|
|
293
|
+
let displayValue2 = (getDisplayExpression == null ? void 0 : getDisplayExpression(getSelectedItem(findItem))) || findItem[key];
|
|
294
|
+
setQuery(displayValue2);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}, 200);
|
|
298
|
+
return () => {
|
|
292
299
|
if (debouncedSearchItemRef.current) {
|
|
293
300
|
debouncedSearchItemRef.current.cancel();
|
|
294
301
|
}
|
|
295
302
|
};
|
|
296
303
|
}, [dataProvider, props, searchkey, getDisplayExpression]);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
(0, _react.useEffect)(function () {
|
|
304
|
+
useEffect(() => {
|
|
305
|
+
var _a2;
|
|
300
306
|
if (autofocus) {
|
|
301
|
-
|
|
302
|
-
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
307
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
303
308
|
}
|
|
304
309
|
if (listener && listener.onChange) {
|
|
305
310
|
listener.onChange(name, {
|
|
306
|
-
clearSearch: handleClearSearch
|
|
311
|
+
clearSearch: handleClearSearch,
|
|
312
|
+
setTemplate
|
|
307
313
|
});
|
|
308
314
|
}
|
|
309
315
|
}, []);
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
var handleShortcutKey = function handleShortcutKey(event) {
|
|
316
|
+
useEffect(() => {
|
|
317
|
+
const handleShortcutKey = (event) => {
|
|
318
|
+
var _a2;
|
|
314
319
|
if (shortcutkey && event.key.toLowerCase() === shortcutkey.toLowerCase()) {
|
|
315
|
-
var _inputRef$current2;
|
|
316
320
|
event.preventDefault();
|
|
317
|
-
(
|
|
321
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
318
322
|
}
|
|
319
323
|
};
|
|
320
324
|
window.addEventListener("keydown", handleShortcutKey);
|
|
321
|
-
return
|
|
322
|
-
return window.removeEventListener("keydown", handleShortcutKey);
|
|
323
|
-
};
|
|
325
|
+
return () => window.removeEventListener("keydown", handleShortcutKey);
|
|
324
326
|
}, [shortcutkey]);
|
|
325
|
-
|
|
326
|
-
// Process and prepare dataset for autocomplete type since it list should be loaded immediately when the component is mounted
|
|
327
|
-
(0, _react.useEffect)(function () {
|
|
328
|
-
// For autocomplete type load data immediately
|
|
327
|
+
useEffect(() => {
|
|
329
328
|
if (type === "autocomplete") {
|
|
330
329
|
getDataSource("");
|
|
331
330
|
}
|
|
332
|
-
// Update listen query state when type changes
|
|
333
331
|
setListenQuery(type === "autocomplete");
|
|
334
332
|
}, [type]);
|
|
335
|
-
|
|
336
|
-
if (type !== "autocomplete" || !(normalizedData
|
|
333
|
+
useEffect(() => {
|
|
334
|
+
if (type !== "autocomplete" || !(normalizedData == null ? void 0 : normalizedData.length)) {
|
|
337
335
|
return;
|
|
338
336
|
}
|
|
339
|
-
|
|
337
|
+
startTransition(() => {
|
|
340
338
|
setFormattedDataset(normalizedData);
|
|
341
|
-
if (props
|
|
339
|
+
if (props == null ? void 0 : props.groupby) {
|
|
342
340
|
setGroupedData(getGroupedData(normalizedData));
|
|
343
341
|
}
|
|
344
342
|
});
|
|
345
343
|
}, [normalizedData]);
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
result[groupKey]
|
|
357
|
-
|
|
358
|
-
|
|
344
|
+
const getGroupedData = useCallback(
|
|
345
|
+
(data) => {
|
|
346
|
+
if ((props == null ? void 0 : props.groupby) && (data == null ? void 0 : data.length)) {
|
|
347
|
+
const result = {};
|
|
348
|
+
data.forEach((item) => {
|
|
349
|
+
var _a2;
|
|
350
|
+
if (!(props == null ? void 0 : props.groupby)) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
const groupKey = item[props == null ? void 0 : props.groupby] || ((_a2 = item == null ? void 0 : item.dataObject) == null ? void 0 : _a2[props == null ? void 0 : props.groupby]) || "ungrouped";
|
|
354
|
+
if (!result[groupKey]) {
|
|
355
|
+
result[groupKey] = [];
|
|
356
|
+
}
|
|
357
|
+
result[groupKey].push(item);
|
|
358
|
+
});
|
|
359
|
+
return result;
|
|
360
|
+
}
|
|
361
|
+
return { ungrouped: data };
|
|
362
|
+
},
|
|
363
|
+
[props == null ? void 0 : props.groupby]
|
|
364
|
+
);
|
|
365
|
+
const getDataSource = useCallback(
|
|
366
|
+
async (query2, nextPage) => {
|
|
367
|
+
if (nextPage && isLoadingNextPageRef.current) {
|
|
368
|
+
return [];
|
|
369
|
+
}
|
|
370
|
+
if (!query2 && (type === "search" || type === "autocomplete" && !nextPage)) {
|
|
371
|
+
setFormattedDataset([]);
|
|
372
|
+
setIsOpen(false);
|
|
373
|
+
setMenuOpen(false);
|
|
374
|
+
return [];
|
|
375
|
+
}
|
|
376
|
+
const dataConfig = __spreadProps(__spreadValues({}, props), {
|
|
377
|
+
dataset: normalizedData,
|
|
378
|
+
datafield: datafield || "All Fields",
|
|
379
|
+
query: query2,
|
|
380
|
+
matchMode: matchmode,
|
|
381
|
+
casesensitive: false,
|
|
382
|
+
searchKey: searchkey,
|
|
383
|
+
isformfield: false,
|
|
384
|
+
page: nextPage ? page + 1 : 1,
|
|
385
|
+
isLocalFilter: true,
|
|
386
|
+
onBeforeservicecall,
|
|
387
|
+
groupby: props.groupby,
|
|
388
|
+
orderby: props.orderby,
|
|
389
|
+
limit
|
|
359
390
|
});
|
|
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
|
-
isformfield: false,
|
|
395
|
-
page: nextPage ? page + 1 : 1,
|
|
396
|
-
isLocalFilter: true,
|
|
397
|
-
onBeforeservicecall: onBeforeservicecall,
|
|
398
|
-
groupby: props.groupby,
|
|
399
|
-
orderby: props.orderby,
|
|
400
|
-
limit: limit
|
|
401
|
-
}); // Set loading flag for pagination requests
|
|
402
|
-
if (nextPage) {
|
|
403
|
-
isLoadingNextPageRef.current = true;
|
|
404
|
-
setPage(function (prev) {
|
|
405
|
-
return prev + 1;
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
_context2.prev = 9;
|
|
409
|
-
setLoadingItems(true);
|
|
410
|
-
_isUpdateRequired = updateRequired;
|
|
411
|
-
if (searchkey && updateRequired === undefined) {
|
|
412
|
-
_isUpdateRequired = dataProvider.init(dataConfig);
|
|
413
|
-
setUpdateRequired(_isUpdateRequired);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// Handle remote search if required
|
|
417
|
-
if (!(searchkey && _isUpdateRequired)) {
|
|
418
|
-
_context2.next = 32;
|
|
419
|
-
break;
|
|
420
|
-
}
|
|
421
|
-
_context2.prev = 14;
|
|
422
|
-
_context2.next = 17;
|
|
423
|
-
return dataProvider === null || dataProvider === void 0 ? void 0 : dataProvider.invokeVariable(dataConfig, query);
|
|
424
|
-
case 17:
|
|
425
|
-
_response = _context2.sent;
|
|
426
|
-
if (!_response) {
|
|
427
|
-
_context2.next = 23;
|
|
428
|
-
break;
|
|
429
|
-
}
|
|
430
|
-
dataSet = Array.isArray(_response) ? _response : [_response];
|
|
431
|
-
if (!nextPage) {
|
|
432
|
-
setFormattedDataset(dataSet);
|
|
433
|
-
setGroupedData(getGroupedData(dataSet));
|
|
434
|
-
} else {
|
|
435
|
-
setFormattedDataset(function (prev) {
|
|
436
|
-
var updatedDataset = [].concat((0, _toConsumableArray2["default"])(prev), (0, _toConsumableArray2["default"])(dataSet));
|
|
437
|
-
setGroupedData(getGroupedData(updatedDataset));
|
|
438
|
-
return updatedDataset;
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// Update UI state based on results
|
|
443
|
-
if (dataSet.length > 0) {
|
|
444
|
-
setIsOpen(true);
|
|
445
|
-
setMenuOpen(true);
|
|
446
|
-
} else {
|
|
447
|
-
setIsOpen(false);
|
|
448
|
-
setMenuOpen(false);
|
|
391
|
+
if (nextPage) {
|
|
392
|
+
isLoadingNextPageRef.current = true;
|
|
393
|
+
setPage((prev) => prev + 1);
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
setLoadingItems(true);
|
|
397
|
+
let isUpdateRequired2 = updateRequired;
|
|
398
|
+
if (searchkey && updateRequired === void 0) {
|
|
399
|
+
isUpdateRequired2 = dataProvider.init(dataConfig);
|
|
400
|
+
setUpdateRequired(isUpdateRequired2);
|
|
401
|
+
}
|
|
402
|
+
if (searchkey && isUpdateRequired2) {
|
|
403
|
+
try {
|
|
404
|
+
const response2 = await (dataProvider == null ? void 0 : dataProvider.invokeVariable(dataConfig, query2));
|
|
405
|
+
if (response2) {
|
|
406
|
+
const dataSet = Array.isArray(response2) ? response2 : [response2];
|
|
407
|
+
if (!nextPage) {
|
|
408
|
+
setFormattedDataset(dataSet);
|
|
409
|
+
setGroupedData(getGroupedData(dataSet));
|
|
410
|
+
} else {
|
|
411
|
+
setFormattedDataset((prev) => {
|
|
412
|
+
const updatedDataset = [...prev, ...dataSet];
|
|
413
|
+
setGroupedData(getGroupedData(updatedDataset));
|
|
414
|
+
return updatedDataset;
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
if (dataSet.length > 0) {
|
|
418
|
+
setIsOpen(true);
|
|
419
|
+
setMenuOpen(true);
|
|
420
|
+
} else {
|
|
421
|
+
setIsOpen(false);
|
|
422
|
+
setMenuOpen(false);
|
|
423
|
+
}
|
|
424
|
+
return dataSet;
|
|
449
425
|
}
|
|
450
|
-
|
|
451
|
-
case 23:
|
|
452
|
-
_context2.next = 31;
|
|
453
|
-
break;
|
|
454
|
-
case 25:
|
|
455
|
-
_context2.prev = 25;
|
|
456
|
-
_context2.t0 = _context2["catch"](14);
|
|
426
|
+
} catch (error) {
|
|
457
427
|
setLoadingItems(false);
|
|
458
428
|
setIsOpen(false);
|
|
459
429
|
setMenuOpen(false);
|
|
460
|
-
// Reset scroll flag on error so user can try again
|
|
461
|
-
if (nextPage) {
|
|
462
|
-
setIsScrolled(false);
|
|
463
|
-
}
|
|
464
|
-
// TODO: call a toast here
|
|
465
|
-
case 31:
|
|
466
|
-
return _context2.abrupt("return", []);
|
|
467
|
-
case 32:
|
|
468
|
-
if (!(!normalizedData || normalizedData.length === 0)) {
|
|
469
|
-
_context2.next = 34;
|
|
470
|
-
break;
|
|
471
|
-
}
|
|
472
|
-
return _context2.abrupt("return", []);
|
|
473
|
-
case 34:
|
|
474
|
-
localDataProvider = new _providers.LocalDataProvider();
|
|
475
|
-
_context2.next = 37;
|
|
476
|
-
return localDataProvider.filter(dataConfig);
|
|
477
|
-
case 37:
|
|
478
|
-
response = _context2.sent;
|
|
479
|
-
data = response.data, isLastPage = response.isLastPage; // Update hasMoreData state based on results
|
|
480
|
-
setHasMoreData(data.length > 0 && !isLastPage);
|
|
481
|
-
if (!nextPage) {
|
|
482
|
-
setFormattedDataset(data);
|
|
483
|
-
setGroupedData(getGroupedData(data));
|
|
484
|
-
} else {
|
|
485
|
-
setFormattedDataset(function (prev) {
|
|
486
|
-
var updatedDataset = [].concat((0, _toConsumableArray2["default"])(prev), (0, _toConsumableArray2["default"])(data));
|
|
487
|
-
setGroupedData(getGroupedData(updatedDataset));
|
|
488
|
-
return updatedDataset;
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
// Show dropdown if we have results
|
|
493
|
-
if (data.length > 0) {
|
|
494
|
-
setIsOpen(true);
|
|
495
|
-
setMenuOpen(true);
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
// Call onDatasetready callback if provided
|
|
499
|
-
if (onDatasetready && (standalone || listener !== null && listener !== void 0 && listener.Widgets && name && name in listener.Widgets)) {
|
|
500
|
-
onDatasetready(name != null && listener !== null && listener !== void 0 && listener.Widgets && name in listener.Widgets ? listener.Widgets[name] : props, data);
|
|
501
|
-
}
|
|
502
|
-
return _context2.abrupt("return", data);
|
|
503
|
-
case 46:
|
|
504
|
-
_context2.prev = 46;
|
|
505
|
-
_context2.t1 = _context2["catch"](9);
|
|
506
|
-
console.error("Error fetching data:", _context2.t1);
|
|
507
|
-
return _context2.abrupt("return", []);
|
|
508
|
-
case 50:
|
|
509
|
-
_context2.prev = 50;
|
|
510
|
-
setLoadingItems(false);
|
|
511
|
-
// Reset pagination loading flag and scroll state
|
|
512
430
|
if (nextPage) {
|
|
513
|
-
isLoadingNextPageRef.current = false;
|
|
514
431
|
setIsScrolled(false);
|
|
515
432
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
case "end":
|
|
519
|
-
return _context2.stop();
|
|
433
|
+
}
|
|
434
|
+
return [];
|
|
520
435
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
436
|
+
if (!normalizedData || normalizedData.length === 0) {
|
|
437
|
+
return [];
|
|
438
|
+
}
|
|
439
|
+
const localDataProvider = new LocalDataProvider();
|
|
440
|
+
const response = await localDataProvider.filter(dataConfig);
|
|
441
|
+
const { data, isLastPage } = response;
|
|
442
|
+
setHasMoreData(data.length > 0 && !isLastPage);
|
|
443
|
+
if (!nextPage) {
|
|
444
|
+
setFormattedDataset(data);
|
|
445
|
+
setGroupedData(getGroupedData(data));
|
|
446
|
+
} else {
|
|
447
|
+
setFormattedDataset((prev) => {
|
|
448
|
+
const updatedDataset = [...prev, ...data];
|
|
449
|
+
setGroupedData(getGroupedData(updatedDataset));
|
|
450
|
+
return updatedDataset;
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
if (data.length > 0) {
|
|
454
|
+
setIsOpen(true);
|
|
455
|
+
setMenuOpen(true);
|
|
456
|
+
}
|
|
457
|
+
if (onDatasetready && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
458
|
+
onDatasetready(
|
|
459
|
+
name != null && (listener == null ? void 0 : listener.Widgets) && name in listener.Widgets ? listener.Widgets[name] : props,
|
|
460
|
+
data
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
return data;
|
|
464
|
+
} catch (error) {
|
|
465
|
+
console.error("Error fetching data:", error);
|
|
466
|
+
return [];
|
|
467
|
+
} finally {
|
|
468
|
+
setLoadingItems(false);
|
|
469
|
+
if (nextPage) {
|
|
470
|
+
isLoadingNextPageRef.current = false;
|
|
471
|
+
setIsScrolled(false);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
[
|
|
476
|
+
dataset,
|
|
477
|
+
datafield,
|
|
478
|
+
matchmode,
|
|
479
|
+
searchkey,
|
|
480
|
+
limit,
|
|
481
|
+
onBeforeservicecall,
|
|
482
|
+
page,
|
|
483
|
+
formattedDataset,
|
|
484
|
+
getGroupedData,
|
|
485
|
+
type,
|
|
486
|
+
onDatasetready,
|
|
487
|
+
standalone,
|
|
488
|
+
listener == null ? void 0 : listener.Widgets,
|
|
489
|
+
name
|
|
490
|
+
]
|
|
491
|
+
);
|
|
492
|
+
useEffect(() => {
|
|
530
493
|
getDataSourceRef.current = getDataSource;
|
|
531
494
|
}, [getDataSource]);
|
|
532
|
-
|
|
533
|
-
// Initialize or update the debounced function when dependencies change
|
|
534
|
-
// Note: Using ref for getDataSource to prevent debounced function recreation on every render
|
|
535
|
-
(0, _react.useEffect)(function () {
|
|
536
|
-
// Cancel previous debounced function if it exists
|
|
495
|
+
useEffect(() => {
|
|
537
496
|
if (debouncedSearchRef.current) {
|
|
538
497
|
debouncedSearchRef.current.cancel();
|
|
539
498
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}
|
|
561
|
-
_context3.prev = 6;
|
|
562
|
-
setLoadingItems(true);
|
|
563
|
-
// Use ref to get latest getDataSource function
|
|
564
|
-
_context3.next = 10;
|
|
565
|
-
return (_getDataSourceRef$cur = getDataSourceRef.current) === null || _getDataSourceRef$cur === void 0 ? void 0 : _getDataSourceRef$cur.call(getDataSourceRef, query);
|
|
566
|
-
case 10:
|
|
567
|
-
_context3.t0 = _context3.sent;
|
|
568
|
-
if (_context3.t0) {
|
|
569
|
-
_context3.next = 13;
|
|
570
|
-
break;
|
|
571
|
-
}
|
|
572
|
-
_context3.t0 = [];
|
|
573
|
-
case 13:
|
|
574
|
-
data = _context3.t0;
|
|
575
|
-
setLoadingItems(false);
|
|
576
|
-
|
|
577
|
-
// Update the formatted dataset first
|
|
578
|
-
setFormattedDataset(data);
|
|
579
|
-
|
|
580
|
-
// Then update visibility based on results
|
|
581
|
-
if (data && data.length > 0) {
|
|
582
|
-
setIsOpen(true);
|
|
583
|
-
setMenuOpen(true);
|
|
584
|
-
} else {
|
|
585
|
-
setIsOpen(false);
|
|
586
|
-
setMenuOpen(false);
|
|
587
|
-
}
|
|
588
|
-
_context3.next = 25;
|
|
589
|
-
break;
|
|
590
|
-
case 19:
|
|
591
|
-
_context3.prev = 19;
|
|
592
|
-
_context3.t1 = _context3["catch"](6);
|
|
593
|
-
console.error("Error in search:", _context3.t1);
|
|
594
|
-
setLoadingItems(false);
|
|
595
|
-
setIsOpen(false);
|
|
596
|
-
setMenuOpen(false);
|
|
597
|
-
case 25:
|
|
598
|
-
case "end":
|
|
599
|
-
return _context3.stop();
|
|
499
|
+
debouncedSearchRef.current = debounce(async (query2) => {
|
|
500
|
+
var _a2;
|
|
501
|
+
if (!query2) {
|
|
502
|
+
setFormattedDataset([]);
|
|
503
|
+
setIsOpen(false);
|
|
504
|
+
setMenuOpen(false);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
if (query2.length >= minchars) {
|
|
508
|
+
try {
|
|
509
|
+
setLoadingItems(true);
|
|
510
|
+
const data = await ((_a2 = getDataSourceRef.current) == null ? void 0 : _a2.call(getDataSourceRef, query2)) || [];
|
|
511
|
+
setLoadingItems(false);
|
|
512
|
+
setFormattedDataset(data);
|
|
513
|
+
if (data && data.length > 0) {
|
|
514
|
+
setIsOpen(true);
|
|
515
|
+
setMenuOpen(true);
|
|
516
|
+
} else {
|
|
517
|
+
setIsOpen(false);
|
|
518
|
+
setMenuOpen(false);
|
|
600
519
|
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
return
|
|
520
|
+
} catch (error) {
|
|
521
|
+
console.error("Error in search:", error);
|
|
522
|
+
setLoadingItems(false);
|
|
523
|
+
setIsOpen(false);
|
|
524
|
+
setMenuOpen(false);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}, debouncetime);
|
|
528
|
+
return () => {
|
|
610
529
|
if (debouncedSearchRef.current) {
|
|
611
530
|
debouncedSearchRef.current.cancel();
|
|
612
531
|
}
|
|
613
532
|
};
|
|
614
|
-
}, [minchars, debouncetime]);
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
(0, _react.useEffect)(function () {
|
|
533
|
+
}, [minchars, debouncetime]);
|
|
534
|
+
useEffect(() => {
|
|
535
|
+
var _a2;
|
|
618
536
|
if (query && (type === "autocomplete" && listenQuery || type === "search" && searchon === "typing")) {
|
|
619
|
-
|
|
620
|
-
// Call the persisted debounced function
|
|
621
|
-
(_debouncedSearchRef$c = debouncedSearchRef.current) === null || _debouncedSearchRef$c === void 0 || _debouncedSearchRef$c.call(debouncedSearchRef, query);
|
|
537
|
+
(_a2 = debouncedSearchRef.current) == null ? void 0 : _a2.call(debouncedSearchRef, query);
|
|
622
538
|
}
|
|
623
539
|
}, [query, type, listenQuery, searchon]);
|
|
624
540
|
function clearDataValue() {
|
|
625
|
-
var
|
|
626
|
-
listener
|
|
541
|
+
var _a2;
|
|
542
|
+
(_a2 = listener == null ? void 0 : listener.onChange) == null ? void 0 : _a2.call(listener, props.fieldName || name, {
|
|
627
543
|
datavalue: ""
|
|
628
544
|
});
|
|
629
545
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
var handleInputChange = function handleInputChange(event) {
|
|
633
|
-
var _event$target;
|
|
546
|
+
const handleInputChange = (event) => {
|
|
547
|
+
var _a2;
|
|
634
548
|
if (readonly || disabled) {
|
|
635
549
|
return;
|
|
636
550
|
}
|
|
637
|
-
|
|
551
|
+
const queryValue = ((_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.value) || "";
|
|
638
552
|
setQuery(queryValue);
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
553
|
+
if (onChange && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
554
|
+
onChange(
|
|
555
|
+
event,
|
|
556
|
+
name != null && (listener == null ? void 0 : listener.Widgets) && name in listener.Widgets ? listener.Widgets[name] : props,
|
|
557
|
+
queryValue,
|
|
558
|
+
queryValue
|
|
559
|
+
);
|
|
643
560
|
}
|
|
644
|
-
|
|
645
|
-
// Handle empty query - for autocomplete show all options, for search close dropdown
|
|
646
561
|
if (!queryValue) {
|
|
647
562
|
setSelectedItem(null);
|
|
648
|
-
if (onClear && (standalone || listener
|
|
649
|
-
onClear(
|
|
563
|
+
if (onClear && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
564
|
+
onClear(
|
|
565
|
+
event,
|
|
566
|
+
name != null && (listener == null ? void 0 : listener.Widgets) && name in listener.Widgets ? listener.Widgets[name] : props
|
|
567
|
+
);
|
|
650
568
|
}
|
|
651
569
|
clearDataValue();
|
|
652
|
-
// For autocomplete type, show all options when query is cleared
|
|
653
570
|
if (type === "autocomplete" && normalizedData && normalizedData.length > 0) {
|
|
654
571
|
setFormattedDataset(normalizedData);
|
|
655
|
-
if (props
|
|
572
|
+
if (props == null ? void 0 : props.groupby) {
|
|
656
573
|
setGroupedData(getGroupedData(normalizedData));
|
|
657
574
|
}
|
|
658
575
|
setIsOpen(true);
|
|
@@ -665,25 +582,24 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
665
582
|
return;
|
|
666
583
|
}
|
|
667
584
|
};
|
|
668
|
-
|
|
585
|
+
const handleKeyDown = (event) => {
|
|
586
|
+
var _a2;
|
|
669
587
|
if (event.key === "Enter") {
|
|
670
|
-
// If dropdown is open and we have items
|
|
671
588
|
if (menuOpen && formattedDataset.length > 0) {
|
|
672
|
-
|
|
673
|
-
var matches = ((_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.querySelectorAll("li")) || [];
|
|
589
|
+
const matches = ((_a2 = dropdownRef.current) == null ? void 0 : _a2.querySelectorAll("li")) || [];
|
|
674
590
|
if (matches.length > 0) {
|
|
675
|
-
|
|
591
|
+
const firstMatch = matches[0];
|
|
676
592
|
handleMatchSelect(firstMatch);
|
|
677
593
|
}
|
|
678
594
|
} else {
|
|
679
|
-
// For search type with searchon=iconclick or no searchon specified
|
|
680
595
|
if (type === "search" && (!searchon || searchon === "onsearchiconclick")) {
|
|
681
596
|
handleSearchClick(event);
|
|
682
597
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
598
|
+
if (onSubmit && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
599
|
+
onSubmit(
|
|
600
|
+
event,
|
|
601
|
+
name != null && (listener == null ? void 0 : listener.Widgets) && name in listener.Widgets ? listener.Widgets[name] : props
|
|
602
|
+
);
|
|
687
603
|
}
|
|
688
604
|
if (props.isSearchInChips) {
|
|
689
605
|
setQuery("");
|
|
@@ -697,37 +613,36 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
697
613
|
setMenuOpen(false);
|
|
698
614
|
}
|
|
699
615
|
};
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
var target = event.currentTarget;
|
|
704
|
-
// Consider it "at the bottom" if within 1px of the bottom (to deal with floating point inaccuracies)
|
|
616
|
+
useEffect(() => {
|
|
617
|
+
const handler = (event) => {
|
|
618
|
+
const target = event.currentTarget;
|
|
705
619
|
if (target.scrollHeight - target.scrollTop - target.clientHeight <= 1) {
|
|
706
|
-
// Cast a synthetic event that looks like React's UIEvent if needed, otherwise just call with event
|
|
707
620
|
handleScroll(event);
|
|
708
621
|
}
|
|
709
622
|
};
|
|
710
623
|
if (listRef.current) {
|
|
711
624
|
listRef.current.addEventListener("scroll", handler);
|
|
712
625
|
}
|
|
713
|
-
return
|
|
626
|
+
return () => {
|
|
714
627
|
if (listRef.current) {
|
|
715
628
|
listRef.current.removeEventListener("scroll", handler);
|
|
716
629
|
}
|
|
717
630
|
};
|
|
718
631
|
}, [hasMoreData]);
|
|
719
|
-
|
|
720
|
-
var
|
|
632
|
+
const handleClearSearch = (event) => {
|
|
633
|
+
var _a2;
|
|
721
634
|
setQuery("");
|
|
722
635
|
setSelectedItem(null);
|
|
723
|
-
if (onClear && (standalone || listener
|
|
724
|
-
onClear(
|
|
636
|
+
if (onClear && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
637
|
+
onClear(
|
|
638
|
+
event,
|
|
639
|
+
name != null && (listener == null ? void 0 : listener.Widgets) && name in listener.Widgets ? listener.Widgets[name] : props
|
|
640
|
+
);
|
|
725
641
|
}
|
|
726
642
|
clearDataValue();
|
|
727
|
-
// For autocomplete type, show all options after clearing
|
|
728
643
|
if (type === "autocomplete" && normalizedData && normalizedData.length > 0) {
|
|
729
644
|
setFormattedDataset(normalizedData);
|
|
730
|
-
if (props
|
|
645
|
+
if (props == null ? void 0 : props.groupby) {
|
|
731
646
|
setGroupedData(getGroupedData(normalizedData));
|
|
732
647
|
}
|
|
733
648
|
setIsOpen(true);
|
|
@@ -737,115 +652,106 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
737
652
|
setIsOpen(false);
|
|
738
653
|
setMenuOpen(false);
|
|
739
654
|
}
|
|
740
|
-
|
|
741
|
-
// Focus back on input
|
|
742
|
-
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.focus();
|
|
655
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
743
656
|
};
|
|
744
|
-
|
|
657
|
+
const handleClickAway = (e) => {
|
|
745
658
|
if (isOpen) {
|
|
746
659
|
setIsOpen(false);
|
|
747
660
|
setMenuOpen(false);
|
|
748
661
|
handleBlur(e);
|
|
749
662
|
}
|
|
750
663
|
};
|
|
751
|
-
|
|
752
|
-
// For autocomplete type - show all options on focus
|
|
664
|
+
const handleFocus = (event) => {
|
|
753
665
|
if (type === "autocomplete") {
|
|
754
|
-
// If we already have results, show them
|
|
755
666
|
if (formattedDataset.length > 0 && !selectedItem) {
|
|
756
667
|
setIsOpen(true);
|
|
757
668
|
setMenuOpen(true);
|
|
758
|
-
}
|
|
759
|
-
// Show all data on focus (use normalizedData which is already computed)
|
|
760
|
-
else if (normalizedData && normalizedData.length > 0) {
|
|
669
|
+
} else if (normalizedData && normalizedData.length > 0) {
|
|
761
670
|
setFormattedDataset(normalizedData);
|
|
762
|
-
|
|
763
|
-
if (props !== null && props !== void 0 && props.groupby) {
|
|
671
|
+
if (props == null ? void 0 : props.groupby) {
|
|
764
672
|
setGroupedData(getGroupedData(normalizedData));
|
|
765
673
|
}
|
|
766
674
|
setIsOpen(true);
|
|
767
675
|
setMenuOpen(true);
|
|
768
676
|
}
|
|
769
677
|
}
|
|
770
|
-
if (onFocus && (standalone || listener
|
|
771
|
-
onFocus(
|
|
678
|
+
if (onFocus && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
679
|
+
onFocus(
|
|
680
|
+
event,
|
|
681
|
+
name != null && (listener == null ? void 0 : listener.Widgets) && name in listener.Widgets ? listener.Widgets[name] : props
|
|
682
|
+
);
|
|
772
683
|
}
|
|
773
684
|
};
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
if (document.activeElement !== dropdownRef.current && !((_dropdownRef$current2 = dropdownRef.current) !== null && _dropdownRef$current2 !== void 0 && _dropdownRef$current2.contains(activeElement)) && !((_searchButtonRef$curr = searchButtonRef.current) !== null && _searchButtonRef$curr !== void 0 && _searchButtonRef$curr.contains(activeElement))) {
|
|
685
|
+
const handleBlur = (event) => {
|
|
686
|
+
setTimeout(() => {
|
|
687
|
+
var _a2, _b;
|
|
688
|
+
const activeElement = document.activeElement;
|
|
689
|
+
if (document.activeElement !== dropdownRef.current && !((_a2 = dropdownRef.current) == null ? void 0 : _a2.contains(activeElement)) && !((_b = searchButtonRef.current) == null ? void 0 : _b.contains(activeElement))) {
|
|
780
690
|
setIsOpen(false);
|
|
781
691
|
setMenuOpen(false);
|
|
782
692
|
}
|
|
783
693
|
}, 200);
|
|
784
|
-
if (onBlur && (standalone || listener
|
|
785
|
-
onBlur(
|
|
694
|
+
if (onBlur && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
695
|
+
onBlur(
|
|
696
|
+
event,
|
|
697
|
+
name != null && (listener == null ? void 0 : listener.Widgets) && name in listener.Widgets ? listener.Widgets[name] : props
|
|
698
|
+
);
|
|
786
699
|
}
|
|
787
700
|
};
|
|
788
|
-
|
|
701
|
+
const handleSearchClick = (event) => {
|
|
789
702
|
event.preventDefault();
|
|
790
703
|
event.stopPropagation();
|
|
791
|
-
// Reset hasMoreData state before new search
|
|
792
704
|
setHasMoreData(true);
|
|
793
|
-
|
|
794
|
-
// For search type with searchon=iconclick or no searchon specified
|
|
795
705
|
if (type === "search" && (!searchon || searchon === "onsearchiconclick")) {
|
|
796
|
-
// First set loading state
|
|
797
706
|
setLoadingItems(true);
|
|
798
707
|
getDataSource(query);
|
|
799
708
|
}
|
|
800
|
-
if (onSearch && (standalone || listener
|
|
801
|
-
onSearch(
|
|
709
|
+
if (onSearch && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
710
|
+
onSearch(
|
|
711
|
+
event,
|
|
712
|
+
name != null && (listener == null ? void 0 : listener.Widgets) && name in listener.Widgets ? listener.Widgets[name] : props
|
|
713
|
+
);
|
|
802
714
|
}
|
|
803
715
|
};
|
|
804
|
-
|
|
805
|
-
var
|
|
806
|
-
// For autocomplete type, open dropdown if closed and no item is selected
|
|
716
|
+
const handleFocusNextItem = () => {
|
|
717
|
+
var _a2;
|
|
807
718
|
if (type === "autocomplete" && !menuOpen && query.length >= minchars && !selectedItem) {
|
|
808
719
|
setIsOpen(true);
|
|
809
720
|
setMenuOpen(true);
|
|
810
|
-
|
|
811
|
-
// Load data if not loaded
|
|
812
721
|
if (formattedDataset.length === 0) {
|
|
813
722
|
getDataSource(query);
|
|
814
723
|
}
|
|
815
724
|
}
|
|
816
|
-
|
|
817
|
-
// Focus on first menu item
|
|
818
|
-
var matches = ((_dropdownRef$current3 = dropdownRef.current) === null || _dropdownRef$current3 === void 0 ? void 0 : _dropdownRef$current3.querySelectorAll("li")) || [];
|
|
725
|
+
const matches = ((_a2 = dropdownRef.current) == null ? void 0 : _a2.querySelectorAll("li")) || [];
|
|
819
726
|
if (matches.length > 0) {
|
|
820
|
-
|
|
727
|
+
const firstMatch = matches[0];
|
|
821
728
|
firstMatch.focus();
|
|
822
729
|
}
|
|
823
730
|
};
|
|
824
731
|
function handleUpdateDatavalue(item) {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
if (listener
|
|
732
|
+
const updatedItem = getSelectedItem(item);
|
|
733
|
+
const value2 = datafield === "All Fields" ? updatedItem : updatedItem == null ? void 0 : updatedItem[datafield];
|
|
734
|
+
if (listener == null ? void 0 : listener.onChange) {
|
|
828
735
|
listener.onChange(props.fieldName || name, {
|
|
829
|
-
datavalue:
|
|
736
|
+
datavalue: value2
|
|
830
737
|
});
|
|
831
738
|
}
|
|
832
739
|
}
|
|
833
740
|
function getSelectedItem(item) {
|
|
834
|
-
var
|
|
835
|
-
return (item
|
|
741
|
+
var _a2;
|
|
742
|
+
return ((_a2 = item == null ? void 0 : item.dataObject) == null ? void 0 : _a2.dataObject) || (item == null ? void 0 : item.dataObject) || item;
|
|
836
743
|
}
|
|
837
|
-
|
|
744
|
+
const handleMatchSelect = (match) => {
|
|
745
|
+
var _a2, _b;
|
|
838
746
|
if (readonly || disabled) {
|
|
839
747
|
return;
|
|
840
748
|
}
|
|
841
|
-
|
|
749
|
+
const itemData = match.getAttribute("data-item");
|
|
842
750
|
if (!itemData) return;
|
|
843
751
|
try {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
// Set display value in input
|
|
848
|
-
var displayVal = (getDisplayExpression === null || getDisplayExpression === void 0 ? void 0 : getDisplayExpression(_selectedItem)) || item.displayValue || item.label;
|
|
752
|
+
const item = JSON.parse(itemData);
|
|
753
|
+
const selectedItem2 = getSelectedItem(item);
|
|
754
|
+
const displayVal = (getDisplayExpression == null ? void 0 : getDisplayExpression(selectedItem2)) || item.displayValue || item.label;
|
|
849
755
|
if (props.isSearchInChips) {
|
|
850
756
|
setQuery("");
|
|
851
757
|
} else {
|
|
@@ -853,55 +759,65 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
853
759
|
}
|
|
854
760
|
setIsOpen(false);
|
|
855
761
|
setMenuOpen(false);
|
|
856
|
-
setSelectedItem(item);
|
|
857
|
-
setFormattedDataset([]);
|
|
858
|
-
if (onChange && (standalone || listener
|
|
859
|
-
|
|
860
|
-
|
|
762
|
+
setSelectedItem(item);
|
|
763
|
+
setFormattedDataset([]);
|
|
764
|
+
if (onChange && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
765
|
+
onChange(
|
|
766
|
+
void 0,
|
|
767
|
+
name != null && (listener == null ? void 0 : listener.Widgets) && name in listener.Widgets ? listener.Widgets[name] : props,
|
|
768
|
+
(_a2 = item.dataObject) == null ? void 0 : _a2.value,
|
|
769
|
+
(_b = item.dataObject) == null ? void 0 : _b.value
|
|
770
|
+
);
|
|
861
771
|
}
|
|
862
772
|
if (!props.isSearchInChips) {
|
|
863
773
|
handleUpdateDatavalue(item);
|
|
864
774
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
775
|
+
if (onSelect && (standalone || (listener == null ? void 0 : listener.Widgets) && name && name in listener.Widgets)) {
|
|
776
|
+
onSelect(
|
|
777
|
+
new MouseEvent("click"),
|
|
778
|
+
props,
|
|
779
|
+
selectedItem2
|
|
780
|
+
);
|
|
781
|
+
props.onSubmit && !props.isSearchInChips && props.onSubmit(
|
|
782
|
+
new MouseEvent("click"),
|
|
783
|
+
props
|
|
784
|
+
);
|
|
870
785
|
}
|
|
871
786
|
} catch (error) {
|
|
872
787
|
console.error("Error parsing item data:", error);
|
|
873
788
|
}
|
|
874
789
|
};
|
|
875
|
-
|
|
790
|
+
const handleMenuItemClick = (event, item) => {
|
|
876
791
|
handleMatchSelect(event.currentTarget);
|
|
877
792
|
};
|
|
878
|
-
|
|
793
|
+
const handleScroll = (event) => {
|
|
879
794
|
if (!loadingItems && !isScrolled && !isLoadingNextPageRef.current && hasMoreData && !selectedItem) {
|
|
880
|
-
|
|
795
|
+
const target = event.target;
|
|
881
796
|
if (target.scrollHeight - target.scrollTop <= target.clientHeight + 50) {
|
|
882
797
|
setIsScrolled(true);
|
|
883
798
|
getDataSource(query, true);
|
|
884
799
|
}
|
|
885
800
|
}
|
|
886
801
|
};
|
|
887
|
-
|
|
802
|
+
const renderGroupDivider = (groupKey) => {
|
|
888
803
|
if (props.groupby && groupKey !== "ungrouped") {
|
|
889
|
-
return
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
804
|
+
return /* @__PURE__ */ jsx(
|
|
805
|
+
MenuItem,
|
|
806
|
+
{
|
|
807
|
+
onClick: handleMenuItemClick,
|
|
808
|
+
dense: true,
|
|
809
|
+
className: "list-group-header",
|
|
810
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "group-title wm-search-group-title", children: groupKey })
|
|
811
|
+
},
|
|
812
|
+
`header-${groupKey}`
|
|
813
|
+
);
|
|
898
814
|
}
|
|
899
815
|
return null;
|
|
900
816
|
};
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
if (
|
|
904
|
-
|
|
817
|
+
const prepareDataItem = (item, index) => {
|
|
818
|
+
var _a2, _b, _c, _d, _e;
|
|
819
|
+
if (typeof item !== "object" || item === null) {
|
|
820
|
+
const stringValue = String(item);
|
|
905
821
|
return {
|
|
906
822
|
key: index,
|
|
907
823
|
value: item,
|
|
@@ -911,35 +827,19 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
911
827
|
dataObject: item
|
|
912
828
|
};
|
|
913
829
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
return item.hasOwnProperty(prop);
|
|
918
|
-
});
|
|
830
|
+
const isNormalized = ["key", "value", "label", "displayValue"].every(
|
|
831
|
+
(prop) => item.hasOwnProperty(prop)
|
|
832
|
+
);
|
|
919
833
|
if (isNormalized) return item;
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
_step;
|
|
925
|
-
try {
|
|
926
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
927
|
-
var field = _step.value;
|
|
928
|
-
if (field && item.hasOwnProperty(field) && item[field] != null && item[field] !== "") {
|
|
929
|
-
return item[field];
|
|
930
|
-
}
|
|
834
|
+
const findFieldValue = (fields, fallback) => {
|
|
835
|
+
for (const field of fields.filter(Boolean)) {
|
|
836
|
+
if (field && item.hasOwnProperty(field) && item[field] != null && item[field] !== "") {
|
|
837
|
+
return item[field];
|
|
931
838
|
}
|
|
932
|
-
} catch (err) {
|
|
933
|
-
_iterator.e(err);
|
|
934
|
-
} finally {
|
|
935
|
-
_iterator.f();
|
|
936
839
|
}
|
|
937
840
|
return fallback;
|
|
938
841
|
};
|
|
939
|
-
|
|
940
|
-
// Get display value with priority: displayexpression > field names > first object value
|
|
941
|
-
var getDisplayValue = function getDisplayValue() {
|
|
942
|
-
// Try displayexpression first
|
|
842
|
+
const getDisplayValue = () => {
|
|
943
843
|
if (displayexpression && typeof displayexpression === "function") {
|
|
944
844
|
try {
|
|
945
845
|
return displayexpression(item.dataObject ? item.dataObject : item);
|
|
@@ -947,112 +847,119 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
947
847
|
console.warn("Error executing displayexpression:", e);
|
|
948
848
|
}
|
|
949
849
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
850
|
+
const displayFields = [
|
|
851
|
+
displaylabel,
|
|
852
|
+
displayfield,
|
|
853
|
+
"label",
|
|
854
|
+
"name",
|
|
855
|
+
"title",
|
|
856
|
+
"text",
|
|
857
|
+
"displayValue",
|
|
858
|
+
"display"
|
|
859
|
+
];
|
|
860
|
+
const fieldValue = findFieldValue(displayFields);
|
|
954
861
|
if (fieldValue != null) return String(fieldValue);
|
|
955
|
-
|
|
956
|
-
// Fallback to first object value
|
|
957
|
-
var firstValue = !(props.groupby && props.isSearchInChips) && Object.values(item).find(function (val) {
|
|
958
|
-
return val != null;
|
|
959
|
-
});
|
|
862
|
+
const firstValue = !(props.groupby && props.isSearchInChips) && Object.values(item).find((val) => val != null);
|
|
960
863
|
return firstValue ? String(firstValue) : "";
|
|
961
864
|
};
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
865
|
+
const displayValue2 = getDisplayValue();
|
|
866
|
+
const keyFields = [
|
|
867
|
+
datafield && datafield !== "All Fields" ? datafield : null,
|
|
868
|
+
"id",
|
|
869
|
+
"key",
|
|
870
|
+
"value"
|
|
871
|
+
];
|
|
872
|
+
const keyValue = findFieldValue(keyFields, index);
|
|
873
|
+
let imageSrc = null;
|
|
966
874
|
if (typeof displayimagesrc === "function") {
|
|
967
|
-
|
|
968
|
-
imageSrc = displayimagesrc((_ref4 = (_item$dataObject$data = item === null || item === void 0 || (_item$dataObject5 = item.dataObject) === null || _item$dataObject5 === void 0 ? void 0 : _item$dataObject5.dataObject) !== null && _item$dataObject$data !== void 0 ? _item$dataObject$data : item === null || item === void 0 ? void 0 : item.dataObject) !== null && _ref4 !== void 0 ? _ref4 : item);
|
|
875
|
+
imageSrc = displayimagesrc((_c = (_b = (_a2 = item == null ? void 0 : item.dataObject) == null ? void 0 : _a2.dataObject) != null ? _b : item == null ? void 0 : item.dataObject) != null ? _c : item);
|
|
969
876
|
} else {
|
|
970
|
-
|
|
971
|
-
imageSrc = displayimagesrc && (_item$dataObject6 = item.dataObject) !== null && _item$dataObject6 !== void 0 && _item$dataObject6[displayimagesrc] ? (_item$dataObject7 = item.dataObject) === null || _item$dataObject7 === void 0 ? void 0 : _item$dataObject7[displayimagesrc] : null;
|
|
877
|
+
imageSrc = displayimagesrc && ((_d = item.dataObject) == null ? void 0 : _d[displayimagesrc]) ? (_e = item.dataObject) == null ? void 0 : _e[displayimagesrc] : null;
|
|
972
878
|
}
|
|
973
879
|
return {
|
|
974
880
|
key: keyValue,
|
|
975
881
|
value: item,
|
|
976
|
-
label:
|
|
977
|
-
displayValue:
|
|
882
|
+
label: displayValue2,
|
|
883
|
+
displayValue: displayValue2,
|
|
978
884
|
displayImage: imageSrc,
|
|
979
885
|
dataObject: item
|
|
980
886
|
};
|
|
981
887
|
};
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
var highlightMatch = function highlightMatch(text, query) {
|
|
985
|
-
if (!query || !text) return text;
|
|
888
|
+
const highlightMatch = (text, query2) => {
|
|
889
|
+
if (!query2 || !text) return text;
|
|
986
890
|
try {
|
|
987
|
-
|
|
988
|
-
return parts.map(
|
|
989
|
-
if (part.toLowerCase() ===
|
|
990
|
-
return
|
|
991
|
-
key: index,
|
|
992
|
-
className: "wm-search-match-highlight"
|
|
993
|
-
}, part);
|
|
891
|
+
const parts = text.split(new RegExp(`(${query2})`, "gi"));
|
|
892
|
+
return parts.map((part, index) => {
|
|
893
|
+
if (part.toLowerCase() === query2.toLowerCase()) {
|
|
894
|
+
return /* @__PURE__ */ jsx("strong", { className: "wm-search-match-highlight", children: part }, index);
|
|
994
895
|
}
|
|
995
896
|
return part;
|
|
996
897
|
});
|
|
997
898
|
} catch (e) {
|
|
998
|
-
// If there's any error in regex, return original text
|
|
999
899
|
return text;
|
|
1000
900
|
}
|
|
1001
901
|
};
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
// Convert raw data item to our format
|
|
1006
|
-
var dataItem = prepareDataItem(item, index);
|
|
1007
|
-
|
|
1008
|
-
// Get the display text
|
|
1009
|
-
var displayText = typeof dataItem.displayValue === "string" ? _dompurify["default"].sanitize(dataItem.displayValue) : String(dataItem.label);
|
|
902
|
+
const renderItem = (item, query2, index) => {
|
|
903
|
+
const dataItem = prepareDataItem(item, index);
|
|
904
|
+
const displayText = typeof dataItem.displayValue === "string" ? DOMPurify.sanitize(dataItem.displayValue) : String(dataItem.label);
|
|
1010
905
|
function handleClick(event) {
|
|
1011
906
|
handleMenuItemClick(event, dataItem);
|
|
1012
907
|
}
|
|
1013
|
-
return
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
908
|
+
return /* @__PURE__ */ jsx(
|
|
909
|
+
MenuItem,
|
|
910
|
+
{
|
|
911
|
+
onClick: handleClick,
|
|
912
|
+
"data-item": JSON.stringify(dataItem),
|
|
913
|
+
dense: true,
|
|
914
|
+
className: "search-dropdown-item wm-search-dropdown-item",
|
|
915
|
+
children: /* @__PURE__ */ jsx(
|
|
916
|
+
Box,
|
|
917
|
+
{
|
|
918
|
+
component: "a",
|
|
919
|
+
className: clsx("wm-search-item-link", templateName && "customTemplate"),
|
|
920
|
+
children: templateName ? /* @__PURE__ */ jsx(Box, { component: "div", children: /* @__PURE__ */ jsx(
|
|
921
|
+
CustomTemplateCaption,
|
|
922
|
+
{
|
|
923
|
+
templateName,
|
|
924
|
+
item: dataItem,
|
|
925
|
+
index,
|
|
926
|
+
widgetName: name,
|
|
927
|
+
listener
|
|
928
|
+
}
|
|
929
|
+
) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
930
|
+
dataItem.displayImage && /* @__PURE__ */ jsx(
|
|
931
|
+
Image,
|
|
932
|
+
{
|
|
933
|
+
src: dataItem.displayImage,
|
|
934
|
+
alt: "",
|
|
935
|
+
width: parseInt(imagewidth) || 16,
|
|
936
|
+
height: parseInt(imagewidth) || 16,
|
|
937
|
+
className: "wm-search-item-image"
|
|
938
|
+
}
|
|
939
|
+
),
|
|
940
|
+
/* @__PURE__ */ jsx(Box, { component: "span", className: "", title: displayText, children: getDisplayExpression ? highlightMatch(getDisplayExpression(getSelectedItem(item)), query2) : highlightMatch(displayText, query2) })
|
|
941
|
+
] })
|
|
942
|
+
}
|
|
943
|
+
)
|
|
944
|
+
},
|
|
945
|
+
`item-${index}-${dataItem.key}`
|
|
946
|
+
);
|
|
1033
947
|
};
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
var renderItems = function renderItems() {
|
|
1037
|
-
var itemCount = 0;
|
|
1038
|
-
|
|
1039
|
-
// If we have grouped data, render by groups
|
|
948
|
+
const renderItems = () => {
|
|
949
|
+
let itemCount = 0;
|
|
1040
950
|
if (props.groupby) {
|
|
1041
|
-
|
|
951
|
+
const groupKeys = Object.keys(groupedData || {});
|
|
1042
952
|
if (groupKeys.length === 0) {
|
|
1043
953
|
return null;
|
|
1044
954
|
}
|
|
1045
|
-
|
|
1046
|
-
groupKeys.forEach(
|
|
1047
|
-
|
|
1048
|
-
var divider = renderGroupDivider(groupKey);
|
|
955
|
+
const renderedItems = [];
|
|
956
|
+
groupKeys.forEach((groupKey) => {
|
|
957
|
+
const divider = renderGroupDivider(groupKey);
|
|
1049
958
|
if (divider) {
|
|
1050
959
|
renderedItems.push(divider);
|
|
1051
960
|
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
var groupItems = (groupedData === null || groupedData === void 0 ? void 0 : groupedData[groupKey]) || [];
|
|
1055
|
-
groupItems.forEach(function (item) {
|
|
961
|
+
const groupItems = (groupedData == null ? void 0 : groupedData[groupKey]) || [];
|
|
962
|
+
groupItems.forEach((item) => {
|
|
1056
963
|
if (itemCount < limit) {
|
|
1057
964
|
renderedItems.push(renderItem(item, query, itemCount));
|
|
1058
965
|
itemCount++;
|
|
@@ -1061,197 +968,171 @@ var Search = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
1061
968
|
});
|
|
1062
969
|
return renderedItems;
|
|
1063
970
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
var formattedArray = Array.isArray(formattedDataset) ? formattedDataset : [];
|
|
1067
|
-
return formattedArray.map(function (item, index) {
|
|
971
|
+
const formattedArray = Array.isArray(formattedDataset) ? formattedDataset : [];
|
|
972
|
+
return formattedArray.map((item, index) => {
|
|
1068
973
|
return renderItem(item, query, index);
|
|
1069
|
-
}).filter(Boolean);
|
|
974
|
+
}).filter(Boolean);
|
|
1070
975
|
};
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
className: "app-icon ".concat(clearsearchiconclass)
|
|
1083
|
-
}));
|
|
976
|
+
const renderClearButton = () => /* @__PURE__ */ jsx(
|
|
977
|
+
Button,
|
|
978
|
+
{
|
|
979
|
+
type: "button",
|
|
980
|
+
className: clsx("btn btn-icon form-control-feedback clear-btn", {
|
|
981
|
+
"show-btn": !!query
|
|
982
|
+
}),
|
|
983
|
+
"aria-label": "Clear",
|
|
984
|
+
onClick: handleClearSearch,
|
|
985
|
+
size: "small",
|
|
986
|
+
children: /* @__PURE__ */ jsx(Box, { component: "i", className: `app-icon ${clearsearchiconclass}` })
|
|
1084
987
|
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
var renderSearchIcon = function renderSearchIcon() {
|
|
988
|
+
);
|
|
989
|
+
const renderSearchIcon = () => {
|
|
1088
990
|
if (showsearchicon) {
|
|
1089
|
-
return
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
991
|
+
return /* @__PURE__ */ jsx(
|
|
992
|
+
Button,
|
|
993
|
+
{
|
|
994
|
+
ref: searchButtonRef,
|
|
995
|
+
className: "app-search-button btn btn-icon",
|
|
996
|
+
title: "search",
|
|
997
|
+
type: "button",
|
|
998
|
+
onClick: handleSearchClick,
|
|
999
|
+
disabled,
|
|
1000
|
+
size: "small",
|
|
1001
|
+
children: /* @__PURE__ */ jsx(Box, { component: "i", className: `app-icon ${searchiconclass}` })
|
|
1002
|
+
}
|
|
1003
|
+
);
|
|
1101
1004
|
}
|
|
1102
1005
|
return null;
|
|
1103
1006
|
};
|
|
1104
|
-
|
|
1007
|
+
const renderBackButton = () => {
|
|
1105
1008
|
if (showbackbutton && backsearchiconclass) {
|
|
1106
|
-
return
|
|
1107
|
-
|
|
1108
|
-
"
|
|
1109
|
-
|
|
1110
|
-
size: "small"
|
|
1111
|
-
}, __jsx(_material.Box, {
|
|
1112
|
-
component: "span",
|
|
1113
|
-
className: "app-icon ".concat(backsearchiconclass)
|
|
1114
|
-
}), __jsx(_material.Box, {
|
|
1115
|
-
component: "span",
|
|
1116
|
-
className: "sr-only"
|
|
1117
|
-
}, "Back button"));
|
|
1009
|
+
return /* @__PURE__ */ jsxs(IconButton, { className: "back-btn", "aria-label": "Back", onClick: handleClearSearch, size: "small", children: [
|
|
1010
|
+
/* @__PURE__ */ jsx(Box, { component: "span", className: `app-icon ${backsearchiconclass}` }),
|
|
1011
|
+
/* @__PURE__ */ jsx(Box, { component: "span", className: "sr-only", children: "Back button" })
|
|
1012
|
+
] });
|
|
1118
1013
|
}
|
|
1119
1014
|
return null;
|
|
1120
1015
|
};
|
|
1121
|
-
|
|
1016
|
+
const renderLoadingIndicator = () => {
|
|
1122
1017
|
if (loadingItems) {
|
|
1123
|
-
return
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
}
|
|
1127
|
-
className: "wm-search-loading-spinner"
|
|
1128
|
-
}, __jsx(_CircularProgress["default"], {
|
|
1129
|
-
size: 20,
|
|
1130
|
-
color: "primary"
|
|
1131
|
-
})), loadingdatamsg);
|
|
1018
|
+
return /* @__PURE__ */ jsxs(Typography, { variant: "body2", className: "dropdown-status", children: [
|
|
1019
|
+
/* @__PURE__ */ jsx("span", { className: "wm-search-loading-spinner", children: /* @__PURE__ */ jsx(CircularProgress, { size: 20, color: "primary" }) }),
|
|
1020
|
+
loadingdatamsg
|
|
1021
|
+
] });
|
|
1132
1022
|
}
|
|
1133
1023
|
return null;
|
|
1134
1024
|
};
|
|
1135
|
-
|
|
1025
|
+
const renderNoResultsMessage = () => {
|
|
1136
1026
|
if (!loadingItems && formattedDataset.length === 0 && query !== "" && !selectedItem) {
|
|
1137
|
-
return
|
|
1138
|
-
variant: "body2",
|
|
1139
|
-
className: "dropdown-status wm-search-dropdown-message"
|
|
1140
|
-
}, "No results found");
|
|
1027
|
+
return /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "dropdown-status wm-search-dropdown-message", children: "No results found" });
|
|
1141
1028
|
}
|
|
1142
1029
|
return null;
|
|
1143
1030
|
};
|
|
1144
|
-
|
|
1145
|
-
// Show "No more data to load" message when there are results but no more data to load
|
|
1031
|
+
const renderCompletionMessage = () => {
|
|
1146
1032
|
if (!loadingItems && formattedDataset.length > 0 && !selectedItem) {
|
|
1147
|
-
return
|
|
1148
|
-
variant: "body2",
|
|
1149
|
-
className: "dropdown-status wm-search-dropdown-completion"
|
|
1150
|
-
}, datacompletemsg);
|
|
1033
|
+
return /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "dropdown-status wm-search-dropdown-completion", children: datacompletemsg });
|
|
1151
1034
|
}
|
|
1152
1035
|
return null;
|
|
1153
1036
|
};
|
|
1154
|
-
|
|
1155
|
-
var
|
|
1156
|
-
// Don't show dropdown if an item is selected or if menu is not open
|
|
1037
|
+
const renderDropdown = () => {
|
|
1038
|
+
var _a2;
|
|
1157
1039
|
if (!isOpen || !menuOpen || selectedItem) return null;
|
|
1158
|
-
return
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1040
|
+
return /* @__PURE__ */ jsx(
|
|
1041
|
+
Popper,
|
|
1042
|
+
{
|
|
1043
|
+
open: isOpen && menuOpen,
|
|
1044
|
+
anchorEl: inputRef.current,
|
|
1045
|
+
placement: dropup ? "top-start" : "bottom-start",
|
|
1046
|
+
className: "wm-search-popper",
|
|
1047
|
+
style: { width: (_a2 = searchRef.current) == null ? void 0 : _a2.clientWidth },
|
|
1048
|
+
children: /* @__PURE__ */ jsx(Paper, { elevation: 3, className: "search-dropdown-paper", children: /* @__PURE__ */ jsx(
|
|
1049
|
+
Box,
|
|
1050
|
+
{
|
|
1051
|
+
component: "div",
|
|
1052
|
+
ref: dropdownRef,
|
|
1053
|
+
onScroll: handleScroll,
|
|
1054
|
+
className: "search-dropdown-container wm-search-dropdown-scroll",
|
|
1055
|
+
children: /* @__PURE__ */ jsxs(MenuList, { className: "search-menu-list app-search dropdown-menu", ref: listRef, children: [
|
|
1056
|
+
renderItems(),
|
|
1057
|
+
renderNoResultsMessage(),
|
|
1058
|
+
renderLoadingIndicator(),
|
|
1059
|
+
renderCompletionMessage()
|
|
1060
|
+
] })
|
|
1061
|
+
}
|
|
1062
|
+
) })
|
|
1165
1063
|
}
|
|
1166
|
-
|
|
1167
|
-
elevation: 3,
|
|
1168
|
-
className: "search-dropdown-paper"
|
|
1169
|
-
}, __jsx(_material.Box, {
|
|
1170
|
-
component: "div",
|
|
1171
|
-
ref: dropdownRef,
|
|
1172
|
-
onScroll: handleScroll,
|
|
1173
|
-
className: "search-dropdown-container wm-search-dropdown-scroll"
|
|
1174
|
-
}, __jsx(_MenuList["default"], {
|
|
1175
|
-
className: "search-menu-list app-search dropdown-menu",
|
|
1176
|
-
ref: listRef
|
|
1177
|
-
}, renderItems(), renderNoResultsMessage(), renderLoadingIndicator(), renderCompletionMessage()))));
|
|
1064
|
+
);
|
|
1178
1065
|
};
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
style: searchStyle
|
|
1198
|
-
// Don't pass tabIndex to div when it contains focusable elements
|
|
1199
|
-
}, safeRestProps, {
|
|
1200
|
-
className: (0, _clsx["default"])(DEFAULT_CLASS, className),
|
|
1201
|
-
"data-search-type": type,
|
|
1202
|
-
type: type,
|
|
1203
|
-
"aria-readonly": readonly
|
|
1204
|
-
}), renderBackButton(), __jsx(_material.Box, {
|
|
1205
|
-
component: "span",
|
|
1206
|
-
className: "sr-only"
|
|
1207
|
-
}, "Back button"), __jsx(_material.Box, {
|
|
1208
|
-
component: "input",
|
|
1209
|
-
name: name,
|
|
1210
|
-
className: (0, _clsx["default"])("app-textbox form-control list-of-objs app-search-input"),
|
|
1211
|
-
type: "text",
|
|
1212
|
-
"focus-target": "true",
|
|
1213
|
-
value: query,
|
|
1214
|
-
onChange: !readonly ? handleInputChange : undefined,
|
|
1215
|
-
disabled: disabled,
|
|
1216
|
-
tabIndex: tabindex,
|
|
1217
|
-
ref: inputRef,
|
|
1218
|
-
"aria-label": arialabel,
|
|
1219
|
-
autoComplete: "off",
|
|
1220
|
-
title: query,
|
|
1221
|
-
placeholder: placeholder,
|
|
1222
|
-
readOnly: readonly,
|
|
1223
|
-
onBlur: function onBlur(e) {
|
|
1224
|
-
return handleBlur(e);
|
|
1225
|
-
},
|
|
1226
|
-
onFocus: function onFocus(e) {
|
|
1227
|
-
return handleFocus(e);
|
|
1066
|
+
const safeRestProps = Object.entries(restProps).reduce(
|
|
1067
|
+
(acc, [key, value2]) => {
|
|
1068
|
+
const invalidProps = [
|
|
1069
|
+
"validation",
|
|
1070
|
+
"datasetItems",
|
|
1071
|
+
"selectedItems",
|
|
1072
|
+
"displayValue",
|
|
1073
|
+
"onchange",
|
|
1074
|
+
"onblur",
|
|
1075
|
+
"groupedData",
|
|
1076
|
+
"handleHeaderClick",
|
|
1077
|
+
"toggleAllHeaders",
|
|
1078
|
+
"isDestroyed"
|
|
1079
|
+
];
|
|
1080
|
+
if (!invalidProps.includes(key)) {
|
|
1081
|
+
acc[key] = value2;
|
|
1082
|
+
}
|
|
1083
|
+
return acc;
|
|
1228
1084
|
},
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1085
|
+
{}
|
|
1086
|
+
);
|
|
1087
|
+
return /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: handleClickAway, children: /* @__PURE__ */ jsxs(
|
|
1088
|
+
Box,
|
|
1089
|
+
__spreadProps(__spreadValues({
|
|
1090
|
+
component: "div",
|
|
1091
|
+
ref: searchRef,
|
|
1092
|
+
style: searchStyle
|
|
1093
|
+
}, safeRestProps), {
|
|
1094
|
+
className: clsx(DEFAULT_CLASS, className),
|
|
1095
|
+
"data-search-type": type,
|
|
1096
|
+
type,
|
|
1097
|
+
"aria-readonly": readonly,
|
|
1098
|
+
children: [
|
|
1099
|
+
renderBackButton(),
|
|
1100
|
+
/* @__PURE__ */ jsx(Box, { component: "span", className: "sr-only", children: "Back button" }),
|
|
1101
|
+
/* @__PURE__ */ jsx(
|
|
1102
|
+
Box,
|
|
1103
|
+
{
|
|
1104
|
+
component: "input",
|
|
1105
|
+
name,
|
|
1106
|
+
className: clsx("app-textbox form-control list-of-objs app-search-input"),
|
|
1107
|
+
type: "text",
|
|
1108
|
+
"focus-target": "true",
|
|
1109
|
+
value: query,
|
|
1110
|
+
onChange: !readonly ? handleInputChange : void 0,
|
|
1111
|
+
disabled,
|
|
1112
|
+
tabIndex: tabindex,
|
|
1113
|
+
ref: inputRef,
|
|
1114
|
+
"aria-label": arialabel,
|
|
1115
|
+
autoComplete: "off",
|
|
1116
|
+
title: query,
|
|
1117
|
+
placeholder,
|
|
1118
|
+
readOnly: readonly,
|
|
1119
|
+
onBlur: (e) => handleBlur(e),
|
|
1120
|
+
onFocus: (e) => handleFocus(e),
|
|
1121
|
+
onKeyDown: (e) => handleKeyDown(e)
|
|
1122
|
+
}
|
|
1123
|
+
),
|
|
1124
|
+
type === "autocomplete" ? null : /* @__PURE__ */ jsx(Box, { component: "span", className: "input-group-addon", children: /* @__PURE__ */ jsx(Box, { component: "form", noValidate: true, autoComplete: "off", children: renderSearchIcon() }) }),
|
|
1125
|
+
/* @__PURE__ */ jsx(Box, { component: "span", className: "sr-only", children: "Clear button" }),
|
|
1126
|
+
renderClearButton(),
|
|
1127
|
+
renderDropdown()
|
|
1128
|
+
]
|
|
1129
|
+
})
|
|
1130
|
+
) });
|
|
1243
1131
|
});
|
|
1244
|
-
|
|
1132
|
+
const WmSearchStandalone = withStandalone(withFormController(Search));
|
|
1245
1133
|
Search.displayName = "WmSearch";
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
* - [Playground](https://react-components.wavemaker.ai/?path=/story/basic-search--showcase)
|
|
1252
|
-
*
|
|
1253
|
-
* - [Docs](https://react-components.wavemaker.ai/?path=/story/basic-search--docs)
|
|
1254
|
-
*
|
|
1255
|
-
* @param props - {@link WmSearchProps}
|
|
1256
|
-
*/
|
|
1257
|
-
var _default = exports["default"] = (0, _withFormController["default"])((0, _withBaseWrapper["default"])(Search));
|
|
1134
|
+
var search_default = withFormController(withBaseWrapper(Search));
|
|
1135
|
+
export {
|
|
1136
|
+
WmSearchStandalone as WmSearch,
|
|
1137
|
+
search_default as default
|
|
1138
|
+
};
|