@wavemaker/react-runtime 11.14.1-15.6409
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/actions/base-action.js +32 -0
- package/actions/login-action.js +53 -0
- package/actions/logout-action.js +41 -0
- package/actions/navigation-action.js +145 -0
- package/actions/notification-action.js +147 -0
- package/actions/timer-action.js +164 -0
- package/actions/toast-provider.js +111 -0
- package/actions/toast.js +115 -0
- package/actions/toast.service.js +94 -0
- package/actions/types/index.js +11 -0
- package/components/advanced/carousel/index.js +456 -0
- package/components/advanced/carousel/props.js +5 -0
- package/components/advanced/carousel/template.js +72 -0
- package/components/advanced/login/index.js +307 -0
- package/components/advanced/login/props.js +5 -0
- package/components/advanced/marquee/index.js +158 -0
- package/components/advanced/marquee/props.js +5 -0
- package/components/basic/anchor/index.js +239 -0
- package/components/basic/anchor/props.js +5 -0
- package/components/basic/audio/index.js +61 -0
- package/components/basic/html/index.js +158 -0
- package/components/basic/icon/index.js +85 -0
- package/components/basic/iframe/iframe.utils.js +10 -0
- package/components/basic/iframe/index.js +95 -0
- package/components/basic/label/index.js +139 -0
- package/components/basic/message/index.js +120 -0
- package/components/basic/message/props.js +5 -0
- package/components/basic/picture/index.js +117 -0
- package/components/basic/picture/props.js +5 -0
- package/components/basic/progress-bar/index.js +168 -0
- package/components/basic/progress-bar/props.js +18 -0
- package/components/basic/progress-circle/index.js +196 -0
- package/components/basic/progress-circle/props.js +16 -0
- package/components/basic/richtexteditor/index.js +533 -0
- package/components/basic/richtexteditor/props.js +5 -0
- package/components/basic/search/index.js +1023 -0
- package/components/basic/search/props.js +5 -0
- package/components/basic/search/providers.js +350 -0
- package/components/basic/spinner/index.js +202 -0
- package/components/basic/spinner/props.js +12 -0
- package/components/basic/tile/index.js +91 -0
- package/components/basic/tree/Components/TreeNodeComponent.js +142 -0
- package/components/basic/tree/index.js +503 -0
- package/components/basic/tree/props.js +5 -0
- package/components/basic/tree/utils.js +154 -0
- package/components/basic/video/index.js +85 -0
- package/components/basic/video/props.js +5 -0
- package/components/chart/components/barColumnChart/index.js +132 -0
- package/components/chart/components/barColumnChart/props.js +5 -0
- package/components/chart/components/bubbleChart/index.js +176 -0
- package/components/chart/components/bubbleChart/props.js +5 -0
- package/components/chart/components/chartLegend/components/ClassicLegendItem.js +39 -0
- package/components/chart/components/chartLegend/components/FuriousLegendItem.js +81 -0
- package/components/chart/components/chartLegend/index.js +69 -0
- package/components/chart/components/chartLegend/props.js +5 -0
- package/components/chart/components/chartLegend/utils.js +31 -0
- package/components/chart/components/chartTooltip/index.js +53 -0
- package/components/chart/components/chartTooltip/styles.js +37 -0
- package/components/chart/components/chartTooltip/utils.js +23 -0
- package/components/chart/components/cumulativeLineChart/index.js +113 -0
- package/components/chart/components/cumulativeLineChart/props.js +5 -0
- package/components/chart/components/cumulativeLineChart/utils.js +34 -0
- package/components/chart/components/index.js +40 -0
- package/components/chart/components/lineAreaChart/index.js +140 -0
- package/components/chart/components/lineAreaChart/props.js +5 -0
- package/components/chart/components/noDataMessage/index.js +27 -0
- package/components/chart/components/pieDonutChart/index.js +171 -0
- package/components/chart/components/pieDonutChart/props.js +5 -0
- package/components/chart/constant.js +72 -0
- package/components/chart/index.js +930 -0
- package/components/chart/props.js +5 -0
- package/components/chart/utils.js +691 -0
- package/components/common/AppSpinner.js +36 -0
- package/components/common/app-spinner.js +26 -0
- package/components/common/index.js +12 -0
- package/components/constants.js +1208 -0
- package/components/container/accordion/accordion-pane/index.js +108 -0
- package/components/container/accordion/accordion-pane/props.js +11 -0
- package/components/container/accordion/index.js +232 -0
- package/components/container/accordion/props.js +13 -0
- package/components/container/alignment-utils.js +183 -0
- package/components/container/index.js +188 -0
- package/components/container/layout-grid/grid-column/index.js +34 -0
- package/components/container/layout-grid/grid-row/index.js +24 -0
- package/components/container/layout-grid/index.js +33 -0
- package/components/container/linear-layout/index.js +72 -0
- package/components/container/linear-layout/linear-layout-item/index.js +43 -0
- package/components/container/panel/components/panel-header/index.js +144 -0
- package/components/container/panel/components/panel-header/props.js +5 -0
- package/components/container/panel/hooks.js +144 -0
- package/components/container/panel/index.js +286 -0
- package/components/container/panel/props.js +5 -0
- package/components/container/props.js +5 -0
- package/components/container/tabs/index.js +379 -0
- package/components/container/tabs/props.js +20 -0
- package/components/container/tabs/tab-pane/index.js +42 -0
- package/components/container/tabs/tab-pane/props.js +5 -0
- package/components/container/wizard/WizardContext.js +16 -0
- package/components/container/wizard/components/StepComponents.js +100 -0
- package/components/container/wizard/components/WizardStep.js +89 -0
- package/components/container/wizard/index.js +710 -0
- package/components/container/wizard/props.js +5 -0
- package/components/container/wizard/utils.js +133 -0
- package/components/container/wizard/wizard-action/index.js +22 -0
- package/components/container/wizard/wizard-step/index.js +94 -0
- package/components/data/card/card-actions/index.js +24 -0
- package/components/data/card/card-content/index.js +38 -0
- package/components/data/card/card-footer/index.js +24 -0
- package/components/data/card/index.js +246 -0
- package/components/data/card/props.js +5 -0
- package/components/data/form/base-form/constant.js +39 -0
- package/components/data/form/base-form/index.js +460 -0
- package/components/data/form/base-form/props.js +29 -0
- package/components/data/form/base-form/utils.js +42 -0
- package/components/data/form/dynamic-fields/index.js +196 -0
- package/components/data/form/dynamic-fields/props.js +5 -0
- package/components/data/form/dynamic-fields/utils.js +237 -0
- package/components/data/form/form-action/index.js +71 -0
- package/components/data/form/form-body/index.js +26 -0
- package/components/data/form/form-context.js +34 -0
- package/components/data/form/form-controller/props.js +19 -0
- package/components/data/form/form-controller/validation-contrustor.js +313 -0
- package/components/data/form/form-controller/withFormController.js +320 -0
- package/components/data/form/form-field/base-field.js +138 -0
- package/components/data/form/form-field/index.js +36 -0
- package/components/data/form/form-field/props.js +5 -0
- package/components/data/form/form-footer/index.js +26 -0
- package/components/data/form/form-header/index.js +56 -0
- package/components/data/form/index.js +39 -0
- package/components/data/form/props.js +5 -0
- package/components/data/list/components/GroupHeader.js +35 -0
- package/components/data/list/components/GroupedListItems.js +98 -0
- package/components/data/list/components/ListContainer.js +27 -0
- package/components/data/list/components/ListDND.js +241 -0
- package/components/data/list/components/ListHeader.js +59 -0
- package/components/data/list/components/ListItem.js +148 -0
- package/components/data/list/components/ListItemWithTemplate.js +59 -0
- package/components/data/list/components/ListItems.js +231 -0
- package/components/data/list/components/ListPagination.js +165 -0
- package/components/data/list/components/LoadMoreButton.js +39 -0
- package/components/data/list/components/NoDataMessage.js +22 -0
- package/components/data/list/components/StandardListItems.js +84 -0
- package/components/data/list/components/index.js +119 -0
- package/components/data/list/components/props.js +5 -0
- package/components/data/list/hooks/index.js +75 -0
- package/components/data/list/hooks/props.js +5 -0
- package/components/data/list/hooks/useCurrentPageItems.js +48 -0
- package/components/data/list/hooks/useGroupedData.js +37 -0
- package/components/data/list/hooks/useListData.js +60 -0
- package/components/data/list/hooks/useListEffects.js +285 -0
- package/components/data/list/hooks/useListEventHandlers.js +291 -0
- package/components/data/list/hooks/useListPagination.js +168 -0
- package/components/data/list/hooks/useListState.js +98 -0
- package/components/data/list/hooks/useListStateManager.js +195 -0
- package/components/data/list/hooks/usePaginatedGroupedData.js +121 -0
- package/components/data/list/index.js +611 -0
- package/components/data/list/props.js +5 -0
- package/components/data/list/templates/media-template.js +53 -0
- package/components/data/list/utils/constants.js +81 -0
- package/components/data/list/utils/list-helpers.js +173 -0
- package/components/data/list/utils/list-widget-methods.js +114 -0
- package/components/data/live-filter/index.js +279 -0
- package/components/data/live-filter/props.js +12 -0
- package/components/data/live-form/index.js +93 -0
- package/components/data/live-form/props.js +16 -0
- package/components/data/pagination/components/BasicPagination.js +77 -0
- package/components/data/pagination/components/ClassicPagination.js +191 -0
- package/components/data/pagination/components/InlinePagination.js +99 -0
- package/components/data/pagination/components/LoadingComponent.js +31 -0
- package/components/data/pagination/components/PageSizeSelector.js +175 -0
- package/components/data/pagination/components/PagerNavigation.js +105 -0
- package/components/data/pagination/components/TotalRecords.js +52 -0
- package/components/data/pagination/components/index.js +47 -0
- package/components/data/pagination/components/props.js +5 -0
- package/components/data/pagination/hooks/index.js +19 -0
- package/components/data/pagination/hooks/props.js +5 -0
- package/components/data/pagination/hooks/useNavigationSize.js +44 -0
- package/components/data/pagination/hooks/usePagination.js +796 -0
- package/components/data/pagination/index.js +322 -0
- package/components/data/table/components/AddNewRow.js +190 -0
- package/components/data/table/components/EditableCell.js +91 -0
- package/components/data/table/components/FieldValidationError.js +24 -0
- package/components/data/table/components/RowExpansionButton.js +74 -0
- package/components/data/table/components/TableBody.js +279 -0
- package/components/data/table/components/TableFilters.js +325 -0
- package/components/data/table/components/TableFooterActions.js +48 -0
- package/components/data/table/components/TableHeader.js +174 -0
- package/components/data/table/components/TablePanelHeading.js +68 -0
- package/components/data/table/components/index.js +74 -0
- package/components/data/table/hooks/index.js +219 -0
- package/components/data/table/hooks/useCellState.js +117 -0
- package/components/data/table/hooks/useDynamicColumns.js +85 -0
- package/components/data/table/hooks/useEditingState.js +47 -0
- package/components/data/table/hooks/useFormWidget.js +184 -0
- package/components/data/table/hooks/usePaginationState.js +60 -0
- package/components/data/table/hooks/usePanelStructure.js +40 -0
- package/components/data/table/hooks/useResponsiveColumns.js +34 -0
- package/components/data/table/hooks/useRowExpansion.js +110 -0
- package/components/data/table/hooks/useRowHandlers.js +38 -0
- package/components/data/table/hooks/useRowSelection.js +213 -0
- package/components/data/table/hooks/useServerSideSorting.js +165 -0
- package/components/data/table/hooks/useTableColumns.js +263 -0
- package/components/data/table/hooks/useTableData.js +154 -0
- package/components/data/table/hooks/useTableEdit.js +467 -0
- package/components/data/table/hooks/useTableEffects.js +139 -0
- package/components/data/table/hooks/useTableFilter.js +389 -0
- package/components/data/table/hooks/useTableInitialization.js +103 -0
- package/components/data/table/hooks/useTableState.js +69 -0
- package/components/data/table/hooks/useTableStateManager.js +558 -0
- package/components/data/table/index.js +1295 -0
- package/components/data/table/live-table/index.js +232 -0
- package/components/data/table/props.js +5 -0
- package/components/data/table/table-action/index.js +78 -0
- package/components/data/table/table-column/index.js +35 -0
- package/components/data/table/table-row/index.js +49 -0
- package/components/data/table/table-row-action/index.js +74 -0
- package/components/data/table/utils/buildSelectionColumns.js +173 -0
- package/components/data/table/utils/columnBuilder.js +209 -0
- package/components/data/table/utils/columnProxy.js +48 -0
- package/components/data/table/utils/columnWidthDistribution.js +98 -0
- package/components/data/table/utils/constants.js +80 -0
- package/components/data/table/utils/crud-handlers.js +518 -0
- package/components/data/table/utils/dynamic-columns.js +118 -0
- package/components/data/table/utils/index.js +607 -0
- package/components/data/table/utils/renderDisplayCell.js +183 -0
- package/components/data/table/utils/selectionUtils.js +166 -0
- package/components/data/table/utils/table-helpers.js +100 -0
- package/components/data/table/utils/validation.js +124 -0
- package/components/data/types.js +113 -0
- package/components/data/utils/field-data-utils.js +66 -0
- package/components/data/utils/filter-field-util.js +81 -0
- package/components/data/utils/index.js +216 -0
- package/components/dialogs/alert-dialog/index.js +80 -0
- package/components/dialogs/confirm-dialog/index.js +105 -0
- package/components/dialogs/dialog/index.js +56 -0
- package/components/dialogs/dialog-actions/index.js +18 -0
- package/components/dialogs/dialog-body/index.js +21 -0
- package/components/dialogs/dialog-content/index.js +30 -0
- package/components/dialogs/dialog-header/index.js +93 -0
- package/components/dialogs/iframe-dialog/index.js +114 -0
- package/components/dialogs/index.js +129 -0
- package/components/dialogs/login-dialog/index.js +369 -0
- package/components/dialogs/login-dialog/props.js +5 -0
- package/components/dialogs/page-dialog/index.js +96 -0
- package/components/dialogs/withDialogWrapper.js +108 -0
- package/components/form/button/index.js +216 -0
- package/components/form/button-group/index.js +60 -0
- package/components/input/calendar/index.js +546 -0
- package/components/input/calendar/props.js +5 -0
- package/components/input/calendar/utils.js +340 -0
- package/components/input/chips/SortableChip/index.js +115 -0
- package/components/input/chips/SortableChip/props.js +5 -0
- package/components/input/chips/index.js +488 -0
- package/components/input/chips/props.js +5 -0
- package/components/input/chips/utils.js +259 -0
- package/components/input/color-picker/index.js +678 -0
- package/components/input/color-picker/props.js +5 -0
- package/components/input/composite/index.js +137 -0
- package/components/input/currency/index.js +263 -0
- package/components/input/currency/props.js +5 -0
- package/components/input/default/checkbox/index.js +230 -0
- package/components/input/default/checkbox/props.js +5 -0
- package/components/input/default/checkboxset/index.js +476 -0
- package/components/input/default/checkboxset/props.js +5 -0
- package/components/input/default/radioset/index.js +379 -0
- package/components/input/default/radioset/props.js +5 -0
- package/components/input/default/switch/index.js +490 -0
- package/components/input/default/switch/prop.js +5 -0
- package/components/input/epoch/date/components/DatePickerPopover.js +220 -0
- package/components/input/epoch/date/index.js +520 -0
- package/components/input/epoch/date/props.js +5 -0
- package/components/input/epoch/date/styled.js +70 -0
- package/components/input/epoch/date/utils.js +108 -0
- package/components/input/epoch/datetime/index.js +656 -0
- package/components/input/epoch/datetime/props.js +5 -0
- package/components/input/epoch/datetime/styled.js +90 -0
- package/components/input/epoch/datetime/utils.js +244 -0
- package/components/input/epoch/time/index.js +412 -0
- package/components/input/epoch/time/props.js +5 -0
- package/components/input/epoch/time/utils.js +209 -0
- package/components/input/fileupload/Utils.js +134 -0
- package/components/input/fileupload/components/ListItems.js +140 -0
- package/components/input/fileupload/components/MultiUpload.js +85 -0
- package/components/input/fileupload/components/SingleUpload.js +65 -0
- package/components/input/fileupload/index.js +170 -0
- package/components/input/fileupload/props.js +5 -0
- package/components/input/fileupload/useFileUpload.js +400 -0
- package/components/input/number/index.js +295 -0
- package/components/input/number/props.js +5 -0
- package/components/input/rating/index.js +368 -0
- package/components/input/rating/props.js +5 -0
- package/components/input/select/index.js +344 -0
- package/components/input/select/props.js +5 -0
- package/components/input/slider/index.js +167 -0
- package/components/input/slider/props.js +5 -0
- package/components/input/text/index.js +434 -0
- package/components/input/text/props.js +5 -0
- package/components/input/text/util.js +179 -0
- package/components/input/textarea/index.js +347 -0
- package/components/input/textarea/props.js +5 -0
- package/components/layout/footer/index.js +30 -0
- package/components/layout/header/index.js +30 -0
- package/components/layout/leftnav/index.js +44 -0
- package/components/layout/rightnav/index.js +32 -0
- package/components/layout/topnav/index.js +34 -0
- package/components/navbar/index.js +41 -0
- package/components/navbar/nav/index.js +102 -0
- package/components/navbar/nav/props.js +5 -0
- package/components/navbar/nav-item/index.js +44 -0
- package/components/navigation/breadcrumb/index.js +56 -0
- package/components/navigation/breadcrumb/props.js +5 -0
- package/components/navigation/menu/components/ListItems.js +66 -0
- package/components/navigation/menu/constants.js +101 -0
- package/components/navigation/menu/index.js +807 -0
- package/components/navigation/menu/props.js +5 -0
- package/components/navigation/popover/index.js +209 -0
- package/components/navigation/popover/props.js +15 -0
- package/components/page/content/index.js +28 -0
- package/components/page/error-boundary/index.js +108 -0
- package/components/page/index.js +137 -0
- package/components/page/page-content/index.js +23 -0
- package/components/page/partial/index.js +36 -0
- package/components/page/partial-container/index.js +48 -0
- package/components/page/props.js +5 -0
- package/components/page/toast-container/index.js +33 -0
- package/components/prefab/container/index.js +46 -0
- package/components/prefab/index.js +67 -0
- package/context/AppContext.js +25 -0
- package/context/AppSpinnerProvider.js +43 -0
- package/context/LocalizationProvider.js +79 -0
- package/context/PrefabContext.js +66 -0
- package/context/WidgetProvider.js +187 -0
- package/core/app-config.js +1 -0
- package/core/app.service.js +357 -0
- package/core/appVariablesStore.js +20 -0
- package/core/appstore.js +88 -0
- package/core/constants/currency-constant.js +1071 -0
- package/core/constants/events.js +34 -0
- package/core/constants/index.js +27 -0
- package/core/dialog.service.js +76 -0
- package/core/event-notifier.js +151 -0
- package/core/formatter/date-formatters.js +222 -0
- package/core/formatter/index.js +131 -0
- package/core/formatter/number-formatters.js +142 -0
- package/core/formatter/security-formatters.js +323 -0
- package/core/formatter/string-formatters.js +52 -0
- package/core/formatter/types.js +18 -0
- package/core/formatters.js +24 -0
- package/core/proxy-service.js +412 -0
- package/core/script-registry.js +63 -0
- package/core/security.service.js +11 -0
- package/core/util/common.js +33 -0
- package/core/util/dom.js +107 -0
- package/core/util/index.js +136 -0
- package/core/util/security.js +184 -0
- package/core/util/utils.js +189 -0
- package/core/widget-observer.js +98 -0
- package/higherOrder/BaseApp.js +430 -0
- package/higherOrder/BaseAppProps.js +5 -0
- package/higherOrder/BaseDateTime.js +251 -0
- package/higherOrder/BasePage.js +715 -0
- package/higherOrder/BasePartial.js +124 -0
- package/higherOrder/BasePrefab.js +145 -0
- package/higherOrder/DataNav.js +377 -0
- package/higherOrder/helper.js +43 -0
- package/higherOrder/props.js +5 -0
- package/higherOrder/withBaseWrapper.js +183 -0
- package/hooks/useAccess.js +308 -0
- package/hooks/useAppConfig.js +42 -0
- package/hooks/useAuth.js +562 -0
- package/hooks/useDataSourceSubscription.js +125 -0
- package/hooks/useDebounce.js +76 -0
- package/hooks/useDeviceVisibility.js +49 -0
- package/hooks/useHttp.js +338 -0
- package/libs/index.js +20 -0
- package/mui-config/theme-provider.js +17 -0
- package/mui-config/theme.js +371 -0
- package/package-lock.json +10177 -0
- package/package.json +95 -0
- package/store/index.js +33 -0
- package/store/middleware/navigationMiddleware.js +48 -0
- package/store/slices/appConfigSlice.js +103 -0
- package/store/slices/authSlice.js +508 -0
- package/store/slices/i18nSlice.js +206 -0
- package/types/index.js +15 -0
- package/utils/dataset-util.js +174 -0
- package/utils/eval-expression.js +32 -0
- package/utils/form-state.util.js +140 -0
- package/utils/form-utils.js +187 -0
- package/utils/format-util.js +260 -0
- package/utils/page-params-util.js +24 -0
- package/utils/resource-url.js +27 -0
- package/utils/state-persistance.js +343 -0
- package/utils/style-utils.js +73 -0
- package/utils/transformedDataset-utils.js +633 -0
- package/utils/widget-cleanup-util.js +84 -0
- package/utils/widgets.js +99 -0
- package/variables/base-variable.js +173 -0
- package/variables/constants.js +27 -0
- package/variables/live-variable.js +166 -0
- package/variables/model-variable.js +77 -0
- package/variables/service-variable.js +307 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LocalDataProvider = exports.DataProvider = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
|
+
var _lodash = require("lodash");
|
|
15
|
+
// Enhanced LocalDataProvider with React Native logic
|
|
16
|
+
var LocalDataProvider = exports.LocalDataProvider = /*#__PURE__*/function () {
|
|
17
|
+
function LocalDataProvider() {
|
|
18
|
+
(0, _classCallCheck2["default"])(this, LocalDataProvider);
|
|
19
|
+
}
|
|
20
|
+
(0, _createClass2["default"])(LocalDataProvider, [{
|
|
21
|
+
key: "createEmptyResult",
|
|
22
|
+
value: function createEmptyResult() {
|
|
23
|
+
return {
|
|
24
|
+
data: [],
|
|
25
|
+
hasMoreData: false,
|
|
26
|
+
isLastPage: true
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
key: "applyFilter",
|
|
31
|
+
value: function applyFilter(entry, queryText) {
|
|
32
|
+
entry = (0, _lodash.isNumber)(entry) ? entry.toString() : entry;
|
|
33
|
+
return (0, _lodash.includes)(entry, queryText);
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
key: "filter",
|
|
37
|
+
value: function filter(config) {
|
|
38
|
+
var _this = this;
|
|
39
|
+
var entries = config.dataset || [];
|
|
40
|
+
var queryText = typeof config.query === "string" ? config.query : "";
|
|
41
|
+
var searchKey = config.searchKey,
|
|
42
|
+
_config$casesensitive = config.casesensitive,
|
|
43
|
+
casesensitive = _config$casesensitive === void 0 ? false : _config$casesensitive;
|
|
44
|
+
var filteredData = [];
|
|
45
|
+
return new Promise(function (resolve) {
|
|
46
|
+
// If searchkey is defined, then check for match string against each item in the dataset
|
|
47
|
+
if (searchKey) {
|
|
48
|
+
var keys = (0, _lodash.split)(searchKey, ",");
|
|
49
|
+
if (!entries.length) {
|
|
50
|
+
return resolve(_this.createEmptyResult());
|
|
51
|
+
}
|
|
52
|
+
var entryObj = entries[0];
|
|
53
|
+
entryObj = entryObj.hasOwnProperty("dataObject") ? entryObj["dataObject"] : entryObj;
|
|
54
|
+
var entryKeys = Object.keys(entryObj);
|
|
55
|
+
var hasEntry = keys.find(function (k) {
|
|
56
|
+
if (k.includes(".")) {
|
|
57
|
+
k = (0, _lodash.split)(k, ".")[0];
|
|
58
|
+
}
|
|
59
|
+
return entryKeys.includes(k);
|
|
60
|
+
});
|
|
61
|
+
if (!hasEntry) {
|
|
62
|
+
// Widget bound to query variable, searchkey is query or path params
|
|
63
|
+
return resolve({
|
|
64
|
+
data: entries,
|
|
65
|
+
hasMoreData: false,
|
|
66
|
+
isLastPage: true
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
filteredData = (0, _lodash.filter)(entries, function (item) {
|
|
70
|
+
return keys.some(function (key) {
|
|
71
|
+
var a = (0, _lodash.get)(item.dataObject || item, key);
|
|
72
|
+
var b = queryText;
|
|
73
|
+
if (!casesensitive) {
|
|
74
|
+
a = (0, _lodash.toLower)(String(a));
|
|
75
|
+
b = (0, _lodash.toLower)(String(b));
|
|
76
|
+
}
|
|
77
|
+
return _this.applyFilter(a, b);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
// Local search on data with array of objects
|
|
82
|
+
if ((0, _lodash.isArray)(entries) && entries.length > 0) {
|
|
83
|
+
// Check if entries have dataObject property (normalized format)
|
|
84
|
+
var hasDataObject = entries[0] && entries[0].hasOwnProperty("dataObject");
|
|
85
|
+
if (hasDataObject) {
|
|
86
|
+
// Handle normalized dataset format
|
|
87
|
+
filteredData = (0, _lodash.filter)(entries, function (entry) {
|
|
88
|
+
var dataObj = entry.dataObject || entry;
|
|
89
|
+
var a = (0, _lodash.isString)(dataObj) ? dataObj : (0, _lodash.values)(dataObj).join(" ");
|
|
90
|
+
if (!casesensitive) {
|
|
91
|
+
a = (0, _lodash.toLower)(String(a));
|
|
92
|
+
queryText = (0, _lodash.toLower)(String(queryText));
|
|
93
|
+
}
|
|
94
|
+
return _this.applyFilter(a, queryText);
|
|
95
|
+
});
|
|
96
|
+
} else if ((0, _lodash.isObject)(entries[0])) {
|
|
97
|
+
// Handle regular object array
|
|
98
|
+
filteredData = (0, _lodash.filter)(entries, function (entry) {
|
|
99
|
+
var dataObj = entry.dataObject || entry;
|
|
100
|
+
var a = (0, _lodash.isString)(dataObj) ? dataObj : (0, _lodash.values)(dataObj).join(" ");
|
|
101
|
+
if (!casesensitive) {
|
|
102
|
+
a = (0, _lodash.toLower)(String(a));
|
|
103
|
+
queryText = (0, _lodash.toLower)(String(queryText));
|
|
104
|
+
}
|
|
105
|
+
return _this.applyFilter(a, queryText);
|
|
106
|
+
});
|
|
107
|
+
} else {
|
|
108
|
+
// Handle primitive values
|
|
109
|
+
filteredData = (0, _lodash.filter)(entries, function (entry) {
|
|
110
|
+
var entryValue = entry;
|
|
111
|
+
if (!casesensitive) {
|
|
112
|
+
entryValue = (0, _lodash.toLower)(String(entryValue));
|
|
113
|
+
queryText = (0, _lodash.toLower)(String(queryText));
|
|
114
|
+
}
|
|
115
|
+
return _this.applyFilter(entryValue, queryText);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
filteredData = (0, _lodash.filter)(entries, function (entry) {
|
|
120
|
+
var entryValue = entry;
|
|
121
|
+
if (!casesensitive) {
|
|
122
|
+
entryValue = (0, _lodash.toLower)(String(entryValue));
|
|
123
|
+
queryText = (0, _lodash.toLower)(String(queryText));
|
|
124
|
+
}
|
|
125
|
+
return _this.applyFilter(entryValue, queryText);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
resolve({
|
|
130
|
+
data: filteredData,
|
|
131
|
+
hasMoreData: false,
|
|
132
|
+
isLastPage: true
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Keep existing methods for backward compatibility (not used till now)
|
|
138
|
+
}, {
|
|
139
|
+
key: "performFiltering",
|
|
140
|
+
value: function performFiltering(entries, query, matchMode, datafield, searchKey) {
|
|
141
|
+
var isAllFieldsSearch = datafield === "All Fields" || !datafield;
|
|
142
|
+
if (isAllFieldsSearch) {
|
|
143
|
+
return this.filterAllFields(entries, query, matchMode);
|
|
144
|
+
}
|
|
145
|
+
return this.filterSpecificFields(entries, query, matchMode, datafield, searchKey);
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "filterAllFields",
|
|
149
|
+
value: function filterAllFields(entries, query, matchMode) {
|
|
150
|
+
var _this2 = this;
|
|
151
|
+
if (this.isObjectArray(entries)) {
|
|
152
|
+
return entries === null || entries === void 0 ? void 0 : entries.filter(function (entry) {
|
|
153
|
+
return Object.keys(entry).some(function (key) {
|
|
154
|
+
return _this2.matchesField(entry[key], query, matchMode);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return entries === null || entries === void 0 ? void 0 : entries.filter(function (entry) {
|
|
159
|
+
return _this2.matchesField(entry, query, matchMode);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
key: "filterSpecificFields",
|
|
164
|
+
value: function filterSpecificFields(entries, query, matchMode, datafield, searchKey) {
|
|
165
|
+
var _this3 = this;
|
|
166
|
+
var keys = searchKey ? searchKey.split(",") : [datafield];
|
|
167
|
+
return entries === null || entries === void 0 ? void 0 : entries.filter(function (item) {
|
|
168
|
+
return keys.some(function (key) {
|
|
169
|
+
if (!key || item[key] === undefined) return false;
|
|
170
|
+
return _this3.matchesField(item[key], query, matchMode);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
key: "matchesField",
|
|
176
|
+
value: function matchesField(fieldValue, query, matchMode) {
|
|
177
|
+
if (fieldValue == null) return false;
|
|
178
|
+
var normalizedField = this.normalizeValue(fieldValue);
|
|
179
|
+
var normalizedQuery = this.normalizeValue(query);
|
|
180
|
+
return this.applyMatchMode(normalizedField, normalizedQuery, matchMode);
|
|
181
|
+
}
|
|
182
|
+
}, {
|
|
183
|
+
key: "normalizeValue",
|
|
184
|
+
value: function normalizeValue(value) {
|
|
185
|
+
var _value$toString$toLow;
|
|
186
|
+
return (_value$toString$toLow = value === null || value === void 0 ? void 0 : value.toString().toLowerCase()) !== null && _value$toString$toLow !== void 0 ? _value$toString$toLow : "";
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
key: "isObjectArray",
|
|
190
|
+
value: function isObjectArray(entries) {
|
|
191
|
+
return Array.isArray(entries) && entries.length > 0 && (0, _typeof2["default"])(entries[0]) === "object";
|
|
192
|
+
}
|
|
193
|
+
}, {
|
|
194
|
+
key: "applyMatchMode",
|
|
195
|
+
value: function applyMatchMode(entry, queryText, matchMode) {
|
|
196
|
+
if (!queryText) return true;
|
|
197
|
+
if (matchMode !== null && matchMode !== void 0 && matchMode.includes("start")) {
|
|
198
|
+
return entry.startsWith(queryText);
|
|
199
|
+
}
|
|
200
|
+
if (matchMode !== null && matchMode !== void 0 && matchMode.includes("end")) {
|
|
201
|
+
return entry.endsWith(queryText);
|
|
202
|
+
}
|
|
203
|
+
if (matchMode !== null && matchMode !== void 0 && matchMode.includes("exact")) {
|
|
204
|
+
return entry === queryText;
|
|
205
|
+
}
|
|
206
|
+
return entry.includes(queryText);
|
|
207
|
+
}
|
|
208
|
+
}]);
|
|
209
|
+
return LocalDataProvider;
|
|
210
|
+
}(); // Enhanced DataProvider with React Native logic
|
|
211
|
+
var DataProvider = exports.DataProvider = /*#__PURE__*/function () {
|
|
212
|
+
function DataProvider() {
|
|
213
|
+
(0, _classCallCheck2["default"])(this, DataProvider);
|
|
214
|
+
(0, _defineProperty2["default"])(this, "localDataProvider", new LocalDataProvider());
|
|
215
|
+
}
|
|
216
|
+
(0, _createClass2["default"])(DataProvider, [{
|
|
217
|
+
key: "init",
|
|
218
|
+
value:
|
|
219
|
+
// Check if the variable is of type service variable and whether update is required
|
|
220
|
+
function init(component) {
|
|
221
|
+
if (component !== null && component !== void 0 && component.isUpdateRequired) {
|
|
222
|
+
return component === null || component === void 0 ? void 0 : component.isUpdateRequired();
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Setting the inputFields and invoking the variable for API calls
|
|
228
|
+
}, {
|
|
229
|
+
key: "invokeVariable",
|
|
230
|
+
value: function () {
|
|
231
|
+
var _invokeVariable = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(component, query) {
|
|
232
|
+
var paramsObj;
|
|
233
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
234
|
+
while (1) switch (_context.prev = _context.next) {
|
|
235
|
+
case 0:
|
|
236
|
+
paramsObj = null;
|
|
237
|
+
if (component !== null && component !== void 0 && component.searchkey) {
|
|
238
|
+
component === null || component === void 0 || component.searchkey.split(",").forEach(function (k) {
|
|
239
|
+
if (!paramsObj) {
|
|
240
|
+
paramsObj = {};
|
|
241
|
+
}
|
|
242
|
+
paramsObj[k] = query;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Use the onQuerySearch callback if available
|
|
247
|
+
if (!(component !== null && component !== void 0 && component.onQuerySearch)) {
|
|
248
|
+
_context.next = 4;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
252
|
+
component === null || component === void 0 || component.onQuerySearch(paramsObj, function (response) {
|
|
253
|
+
return resolve(response);
|
|
254
|
+
}, function (error) {
|
|
255
|
+
return reject(error);
|
|
256
|
+
});
|
|
257
|
+
}));
|
|
258
|
+
case 4:
|
|
259
|
+
return _context.abrupt("return", Promise.resolve());
|
|
260
|
+
case 5:
|
|
261
|
+
case "end":
|
|
262
|
+
return _context.stop();
|
|
263
|
+
}
|
|
264
|
+
}, _callee);
|
|
265
|
+
}));
|
|
266
|
+
function invokeVariable(_x, _x2) {
|
|
267
|
+
return _invokeVariable.apply(this, arguments);
|
|
268
|
+
}
|
|
269
|
+
return invokeVariable;
|
|
270
|
+
}()
|
|
271
|
+
}, {
|
|
272
|
+
key: "filter",
|
|
273
|
+
value: function () {
|
|
274
|
+
var _filter2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(config) {
|
|
275
|
+
var searchKey, keys, updateRequired, response, dataSet;
|
|
276
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
277
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
278
|
+
case 0:
|
|
279
|
+
searchKey = config.searchKey; // If searchkey is provided, check if we need to make an API call
|
|
280
|
+
if (!searchKey) {
|
|
281
|
+
_context2.next = 22;
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
keys = (0, _lodash.split)(searchKey, ",");
|
|
285
|
+
if (!(keys.length && config.component)) {
|
|
286
|
+
_context2.next = 22;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
// Check if update is required for service variables
|
|
290
|
+
updateRequired = this.init(config.component);
|
|
291
|
+
if (!updateRequired) {
|
|
292
|
+
_context2.next = 22;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
_context2.prev = 6;
|
|
296
|
+
_context2.next = 9;
|
|
297
|
+
return this.invokeVariable(config.component, config.query || "");
|
|
298
|
+
case 9:
|
|
299
|
+
response = _context2.sent;
|
|
300
|
+
if (!response) {
|
|
301
|
+
_context2.next = 16;
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
dataSet = response.dataSet || response;
|
|
305
|
+
if (!(0, _lodash.isEmpty)(dataSet)) {
|
|
306
|
+
_context2.next = 14;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
return _context2.abrupt("return", {
|
|
310
|
+
data: [],
|
|
311
|
+
hasMoreData: false,
|
|
312
|
+
isLastPage: true
|
|
313
|
+
});
|
|
314
|
+
case 14:
|
|
315
|
+
if ((0, _lodash.isObject)(dataSet) && !(0, _lodash.isArray)(dataSet)) {
|
|
316
|
+
dataSet = [dataSet];
|
|
317
|
+
}
|
|
318
|
+
return _context2.abrupt("return", {
|
|
319
|
+
data: dataSet,
|
|
320
|
+
hasMoreData: false,
|
|
321
|
+
isLastPage: true
|
|
322
|
+
});
|
|
323
|
+
case 16:
|
|
324
|
+
_context2.next = 22;
|
|
325
|
+
break;
|
|
326
|
+
case 18:
|
|
327
|
+
_context2.prev = 18;
|
|
328
|
+
_context2.t0 = _context2["catch"](6);
|
|
329
|
+
console.error("API call failed:", _context2.t0);
|
|
330
|
+
return _context2.abrupt("return", {
|
|
331
|
+
data: [],
|
|
332
|
+
hasMoreData: false,
|
|
333
|
+
isLastPage: true
|
|
334
|
+
});
|
|
335
|
+
case 22:
|
|
336
|
+
return _context2.abrupt("return", this.localDataProvider.filter(config));
|
|
337
|
+
case 23:
|
|
338
|
+
case "end":
|
|
339
|
+
return _context2.stop();
|
|
340
|
+
}
|
|
341
|
+
}, _callee2, this, [[6, 18]]);
|
|
342
|
+
}));
|
|
343
|
+
function filter(_x3) {
|
|
344
|
+
return _filter2.apply(this, arguments);
|
|
345
|
+
}
|
|
346
|
+
return filter;
|
|
347
|
+
}()
|
|
348
|
+
}]);
|
|
349
|
+
return DataProvider;
|
|
350
|
+
}();
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.WmSpinner = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _styles = require("@mui/material/styles");
|
|
12
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
14
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
15
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
16
|
+
var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
|
|
17
|
+
var _props = require("./props");
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
19
|
+
var __jsx = _react["default"].createElement;
|
|
20
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
+
var SpinnerImage = (0, _styles.styled)(_Box["default"])(function (_ref) {
|
|
23
|
+
var imagewidth = _ref.imagewidth,
|
|
24
|
+
imageheight = _ref.imageheight,
|
|
25
|
+
picture = _ref.picture;
|
|
26
|
+
return {
|
|
27
|
+
width: imagewidth || "20px",
|
|
28
|
+
height: imageheight || "auto",
|
|
29
|
+
backgroundImage: picture ? "url(".concat(picture, ")") : undefined,
|
|
30
|
+
backgroundSize: imagewidth || "20px",
|
|
31
|
+
backgroundRepeat: "no-repeat",
|
|
32
|
+
display: "inline-block"
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
var WmSpinner = exports.WmSpinner = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
36
|
+
var _props$listener2;
|
|
37
|
+
var _props$caption = props.caption,
|
|
38
|
+
caption = _props$caption === void 0 ? "" : _props$caption,
|
|
39
|
+
name = props.name,
|
|
40
|
+
_props$type = props.type,
|
|
41
|
+
type = _props$type === void 0 ? "icon" : _props$type,
|
|
42
|
+
_props$iconclass = props.iconclass,
|
|
43
|
+
iconclass = _props$iconclass === void 0 ? "fa fa-circle-o-notch fa-spin" : _props$iconclass,
|
|
44
|
+
iconsize = props.iconsize,
|
|
45
|
+
_props$imagewidth = props.imagewidth,
|
|
46
|
+
imagewidth = _props$imagewidth === void 0 ? "20px" : _props$imagewidth,
|
|
47
|
+
imageheight = props.imageheight,
|
|
48
|
+
_props$animation = props.animation,
|
|
49
|
+
animation = _props$animation === void 0 ? "spin" : _props$animation,
|
|
50
|
+
styles = props.styles,
|
|
51
|
+
className = props.className,
|
|
52
|
+
id = props.id,
|
|
53
|
+
servicevariabletotrack = props.servicevariabletotrack,
|
|
54
|
+
show = props.show,
|
|
55
|
+
hint = props.hint,
|
|
56
|
+
arialabel = props.arialabel;
|
|
57
|
+
var DEFAULT_CLS = "app-spinner";
|
|
58
|
+
var servicesRef = (0, _react.useRef)(null);
|
|
59
|
+
var isMounted = (0, _react.useRef)(true);
|
|
60
|
+
var invokedVariablesRef = (0, _react.useRef)(new Set());
|
|
61
|
+
var _useState = (0, _react.useState)({}),
|
|
62
|
+
trackedVariable = _useState[0],
|
|
63
|
+
setTrackedVariable = _useState[1];
|
|
64
|
+
var parsedShow = (0, _react.useMemo)(function () {
|
|
65
|
+
return !!show;
|
|
66
|
+
}, [show]);
|
|
67
|
+
var _useState2 = (0, _react.useState)(parsedShow),
|
|
68
|
+
isVisible = _useState2[0],
|
|
69
|
+
setIsVisible = _useState2[1];
|
|
70
|
+
var handleVariableEvent = function handleVariableEvent(variableName, event, variable) {
|
|
71
|
+
var _ref2;
|
|
72
|
+
// Prevent state updates if component is unmounted
|
|
73
|
+
if (!isMounted.current) return;
|
|
74
|
+
var updateState = (_ref2 = event === _props.VariableEvents.SUCCESS ? variable : undefined) !== null && _ref2 !== void 0 ? _ref2 : {};
|
|
75
|
+
setTrackedVariable(function (prev) {
|
|
76
|
+
return _objectSpread(_objectSpread({}, prev), {}, (0, _defineProperty2["default"])({}, variableName, _objectSpread(_objectSpread({}, prev[variableName] || {}), {}, {
|
|
77
|
+
loading: event === _props.VariableEvents.BEFORE_INVOKE,
|
|
78
|
+
error: event === _props.VariableEvents.ERROR ? variable : null,
|
|
79
|
+
variable: variable,
|
|
80
|
+
spinnerMessage: variable.spinnerMessage,
|
|
81
|
+
spinnerContext: variable.spinnerContext
|
|
82
|
+
})));
|
|
83
|
+
});
|
|
84
|
+
if (updateState != undefined) {
|
|
85
|
+
messageHandler(variableName);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var messageHandler = function messageHandler(key) {
|
|
89
|
+
var _trackedVariable$key;
|
|
90
|
+
return __jsx(_Typography["default"], {
|
|
91
|
+
component: "p",
|
|
92
|
+
key: key
|
|
93
|
+
}, (_trackedVariable$key = trackedVariable[key]) === null || _trackedVariable$key === void 0 ? void 0 : _trackedVariable$key.spinnerMessage);
|
|
94
|
+
};
|
|
95
|
+
(0, _react.useEffect)(function () {
|
|
96
|
+
var newSubscriptions = [];
|
|
97
|
+
if (servicevariabletotrack && props.listener) {
|
|
98
|
+
var _props$listener;
|
|
99
|
+
servicesRef.current = servicevariabletotrack.split(",");
|
|
100
|
+
var Variables = (_props$listener = props.listener) === null || _props$listener === void 0 ? void 0 : _props$listener.Variables;
|
|
101
|
+
if (!Variables) return; // Guard if listener or Variables is not present
|
|
102
|
+
servicesRef.current.forEach(function (name) {
|
|
103
|
+
var variable = Variables[name];
|
|
104
|
+
if (variable) {
|
|
105
|
+
if (typeof variable.invoke === "function" && !invokedVariablesRef.current.has(name)) {
|
|
106
|
+
variable.invoke();
|
|
107
|
+
invokedVariablesRef.current.add(name);
|
|
108
|
+
}
|
|
109
|
+
Object.values(_props.VariableEvents).forEach(function (event) {
|
|
110
|
+
var handler = function handler() {
|
|
111
|
+
return handleVariableEvent(name, event, variable);
|
|
112
|
+
};
|
|
113
|
+
if (variable && typeof variable.subscribe === "function") {
|
|
114
|
+
variable.subscribe(event, handler);
|
|
115
|
+
newSubscriptions.push({
|
|
116
|
+
variable: variable,
|
|
117
|
+
event: event,
|
|
118
|
+
handler: handler
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return function () {
|
|
126
|
+
newSubscriptions.forEach(function (_ref3) {
|
|
127
|
+
var variable = _ref3.variable,
|
|
128
|
+
event = _ref3.event,
|
|
129
|
+
handler = _ref3.handler;
|
|
130
|
+
if (variable && typeof variable.unsubscribe === "function") {
|
|
131
|
+
variable.unsubscribe(event, handler);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
}, [servicevariabletotrack, (_props$listener2 = props.listener) === null || _props$listener2 === void 0 ? void 0 : _props$listener2.Variables]);
|
|
136
|
+
(0, _react.useEffect)(function () {
|
|
137
|
+
if (servicevariabletotrack) {
|
|
138
|
+
// If servicevariabletotrack is defined, its loading state dictates visibility
|
|
139
|
+
var services = servicevariabletotrack.split(",");
|
|
140
|
+
var isLoading = services.some(function (serviceName) {
|
|
141
|
+
var _trackedVariable$serv;
|
|
142
|
+
return ((_trackedVariable$serv = trackedVariable[serviceName]) === null || _trackedVariable$serv === void 0 ? void 0 : _trackedVariable$serv.loading) === true;
|
|
143
|
+
});
|
|
144
|
+
setIsVisible(isLoading);
|
|
145
|
+
} else {
|
|
146
|
+
// If servicevariabletotrack is NOT defined, parsedShow dictates visibility
|
|
147
|
+
setIsVisible(parsedShow);
|
|
148
|
+
}
|
|
149
|
+
}, [trackedVariable, servicevariabletotrack, parsedShow]);
|
|
150
|
+
var renderSpinnerContent = function renderSpinnerContent() {
|
|
151
|
+
if (type === "image" && props.image) {
|
|
152
|
+
return __jsx(SpinnerImage, {
|
|
153
|
+
imagewidth: imagewidth,
|
|
154
|
+
imageheight: imageheight,
|
|
155
|
+
picture: props.image,
|
|
156
|
+
className: (0, _clsx["default"])("spinner-image animated infinite", animation === "spin" ? "fa-spin" : animation),
|
|
157
|
+
"aria-hidden": "true"
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (type === "icon") {
|
|
161
|
+
return __jsx("i", {
|
|
162
|
+
className: (0, _clsx["default"])("spinner-image animated infinite", iconclass, animation === "spin" ? "fa-spin" : animation),
|
|
163
|
+
"aria-hidden": "true",
|
|
164
|
+
style: {
|
|
165
|
+
fontSize: iconsize
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return __jsx(_CircularProgress["default"], null);
|
|
170
|
+
};
|
|
171
|
+
var hasDynamicMessages = servicevariabletotrack && Object.keys(trackedVariable).length > 0;
|
|
172
|
+
var shouldShowStaticCaption = caption && !hasDynamicMessages;
|
|
173
|
+
return __jsx(_react["default"].Fragment, null, isVisible && __jsx(_Box["default"], {
|
|
174
|
+
title: hint,
|
|
175
|
+
className: (0, _clsx["default"])(DEFAULT_CLS, className),
|
|
176
|
+
style: styles,
|
|
177
|
+
id: id,
|
|
178
|
+
"aria-label": arialabel,
|
|
179
|
+
role: "alert",
|
|
180
|
+
"aria-live": "polite",
|
|
181
|
+
"aria-busy": "true"
|
|
182
|
+
}, __jsx(_Box["default"], {
|
|
183
|
+
className: "spinner-message"
|
|
184
|
+
}, renderSpinnerContent(), shouldShowStaticCaption && __jsx(_Typography["default"], {
|
|
185
|
+
component: "span",
|
|
186
|
+
className: "spinner-text",
|
|
187
|
+
dangerouslySetInnerHTML: {
|
|
188
|
+
__html: caption
|
|
189
|
+
}
|
|
190
|
+
}), hasDynamicMessages && __jsx(_Box["default"], {
|
|
191
|
+
className: "spinner-messages"
|
|
192
|
+
}, Object.keys(trackedVariable).map(function (key) {
|
|
193
|
+
return messageHandler(key);
|
|
194
|
+
})))));
|
|
195
|
+
}, function (prev, current) {
|
|
196
|
+
var keys = ["caption", "type", "servicevariabletotrack", "show", "iconclass", "iconsize", "image", "imagewidth", "imageheight", "animation"];
|
|
197
|
+
return keys.every(function (key) {
|
|
198
|
+
return prev[key] === current[key];
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
WmSpinner.displayName = "WmSpinner";
|
|
202
|
+
var _default = exports["default"] = (0, _withBaseWrapper.withBaseWrapper)(WmSpinner);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VariableEvents = void 0;
|
|
7
|
+
var VariableEvents = exports.VariableEvents = {
|
|
8
|
+
BEFORE_INVOKE: "beforeInvoke",
|
|
9
|
+
SUCCESS: "success",
|
|
10
|
+
ERROR: "error",
|
|
11
|
+
AFTER_INVOKE: "afterInvoke"
|
|
12
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
|
+
var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
|
|
14
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
15
|
+
var _excluded = ["styles", "className"];
|
|
16
|
+
var __jsx = _react["default"].createElement;
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
var DEFAULT_TILE_CLASS = "app-tile";
|
|
20
|
+
function WmTile(props) {
|
|
21
|
+
var styles = props.styles,
|
|
22
|
+
className = props.className,
|
|
23
|
+
restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
24
|
+
function handleClick(event) {
|
|
25
|
+
var _props$onClick;
|
|
26
|
+
props === null || props === void 0 || (_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, event, props);
|
|
27
|
+
}
|
|
28
|
+
function handleOnBlur(event) {
|
|
29
|
+
var _props$onBlur;
|
|
30
|
+
props === null || props === void 0 || (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, event, props);
|
|
31
|
+
}
|
|
32
|
+
function handleOnFocus(event) {
|
|
33
|
+
var _props$onFocus;
|
|
34
|
+
props === null || props === void 0 || (_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 || _props$onFocus.call(props, event, props);
|
|
35
|
+
}
|
|
36
|
+
function handleMouseOver(event) {
|
|
37
|
+
var _props$onMouseOver;
|
|
38
|
+
props === null || props === void 0 || (_props$onMouseOver = props.onMouseOver) === null || _props$onMouseOver === void 0 || _props$onMouseOver.call(props, event, props);
|
|
39
|
+
}
|
|
40
|
+
function handleMouseOut(event) {
|
|
41
|
+
var _props$onMouseOut;
|
|
42
|
+
props === null || props === void 0 || (_props$onMouseOut = props.onMouseOut) === null || _props$onMouseOut === void 0 || _props$onMouseOut.call(props, event, props);
|
|
43
|
+
}
|
|
44
|
+
function handleMouseEnter(event) {
|
|
45
|
+
var _props$onMouseEnter;
|
|
46
|
+
props === null || props === void 0 || (_props$onMouseEnter = props.onMouseEnter) === null || _props$onMouseEnter === void 0 || _props$onMouseEnter.call(props, event, props);
|
|
47
|
+
}
|
|
48
|
+
function handleMouseLeave(event) {
|
|
49
|
+
var _props$onMouseLeave;
|
|
50
|
+
props === null || props === void 0 || (_props$onMouseLeave = props.onMouseLeave) === null || _props$onMouseLeave === void 0 || _props$onMouseLeave.call(props, event, props);
|
|
51
|
+
}
|
|
52
|
+
function handleDoubleClick(event) {
|
|
53
|
+
var _props$onDoubleClick;
|
|
54
|
+
props === null || props === void 0 || (_props$onDoubleClick = props.onDoubleClick) === null || _props$onDoubleClick === void 0 || _props$onDoubleClick.call(props, event, props);
|
|
55
|
+
}
|
|
56
|
+
function handleKeyDown(event) {
|
|
57
|
+
var _props$onKeydown;
|
|
58
|
+
props === null || props === void 0 || (_props$onKeydown = props.onKeydown) === null || _props$onKeydown === void 0 || _props$onKeydown.call(props, event, props);
|
|
59
|
+
}
|
|
60
|
+
function handleKeyUp(event) {
|
|
61
|
+
var _props$onKeyup;
|
|
62
|
+
props === null || props === void 0 || (_props$onKeyup = props.onKeyup) === null || _props$onKeyup === void 0 || _props$onKeyup.call(props, event, props);
|
|
63
|
+
}
|
|
64
|
+
var domEvents = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (props === null || props === void 0 ? void 0 : props.onBlur) && {
|
|
65
|
+
onBlur: handleOnBlur
|
|
66
|
+
}), (props === null || props === void 0 ? void 0 : props.onFocus) && {
|
|
67
|
+
onFocus: handleOnFocus
|
|
68
|
+
}), (props === null || props === void 0 ? void 0 : props.onMouseEnter) && {
|
|
69
|
+
onMouseEnter: handleMouseEnter
|
|
70
|
+
}), (props === null || props === void 0 ? void 0 : props.onMouseLeave) && {
|
|
71
|
+
onMouseLeave: handleMouseLeave
|
|
72
|
+
}), (props === null || props === void 0 ? void 0 : props.onMouseOver) && {
|
|
73
|
+
onMouseOver: handleMouseOver
|
|
74
|
+
}), (props === null || props === void 0 ? void 0 : props.onMouseOut) && {
|
|
75
|
+
onMouseOut: handleMouseOut
|
|
76
|
+
}), (props === null || props === void 0 ? void 0 : props.onDoubleClick) && {
|
|
77
|
+
onDoubleClick: handleDoubleClick
|
|
78
|
+
}), (props === null || props === void 0 ? void 0 : props.onKeydown) && {
|
|
79
|
+
onKeyDown: handleKeyDown
|
|
80
|
+
}), (props === null || props === void 0 ? void 0 : props.onKeyup) && {
|
|
81
|
+
onKeyUp: handleKeyUp
|
|
82
|
+
}), (props === null || props === void 0 ? void 0 : props.onClick) && {
|
|
83
|
+
onClick: handleClick
|
|
84
|
+
});
|
|
85
|
+
return __jsx(_Box["default"], (0, _extends2["default"])({
|
|
86
|
+
className: (0, _clsx["default"])(DEFAULT_TILE_CLASS, className),
|
|
87
|
+
style: styles
|
|
88
|
+
}, restProps, domEvents), props.children);
|
|
89
|
+
}
|
|
90
|
+
WmTile.displayName = "WmTile";
|
|
91
|
+
var _default = exports["default"] = (0, _withBaseWrapper.withBaseWrapper)(WmTile);
|