@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,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.BaseAction = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _baseVariable = require("@wavemaker/react-runtime/variables/base-variable");
|
|
14
|
+
var _lodashEs = require("lodash-es");
|
|
15
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; }
|
|
16
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
|
+
var BaseAction = exports.BaseAction = /*#__PURE__*/function (_BaseVariable) {
|
|
18
|
+
(0, _inherits2["default"])(BaseAction, _BaseVariable);
|
|
19
|
+
var _super = _createSuper(BaseAction);
|
|
20
|
+
function BaseAction(config) {
|
|
21
|
+
(0, _classCallCheck2["default"])(this, BaseAction);
|
|
22
|
+
return _super.call(this, config);
|
|
23
|
+
}
|
|
24
|
+
(0, _createClass2["default"])(BaseAction, [{
|
|
25
|
+
key: "setData",
|
|
26
|
+
value: function setData(dataSet) {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
this.dataSet = (0, _lodashEs.merge)(this.config.paramProvider(), dataSet);
|
|
29
|
+
}
|
|
30
|
+
}]);
|
|
31
|
+
return BaseAction;
|
|
32
|
+
}(_baseVariable.BaseVariable);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LoginAction = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _baseAction = require("./base-action");
|
|
14
|
+
var _baseVariable = require("../variables/base-variable");
|
|
15
|
+
var _get = _interopRequireDefault(require("lodash-es/get"));
|
|
16
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; }
|
|
17
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
+
var LoginAction = exports.LoginAction = /*#__PURE__*/function (_BaseAction) {
|
|
19
|
+
(0, _inherits2["default"])(LoginAction, _BaseAction);
|
|
20
|
+
var _super = _createSuper(LoginAction);
|
|
21
|
+
function LoginAction(config) {
|
|
22
|
+
(0, _classCallCheck2["default"])(this, LoginAction);
|
|
23
|
+
return _super.call(this, config);
|
|
24
|
+
}
|
|
25
|
+
(0, _createClass2["default"])(LoginAction, [{
|
|
26
|
+
key: "invoke",
|
|
27
|
+
value: function invoke(options, successcb, errorcb) {
|
|
28
|
+
var _this = this;
|
|
29
|
+
var params;
|
|
30
|
+
if (!(0, _get["default"])(options, "formData")) {
|
|
31
|
+
params = this.config.paramProvider();
|
|
32
|
+
}
|
|
33
|
+
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this, params]);
|
|
34
|
+
return this.config.securityService().login({
|
|
35
|
+
baseURL: this.config.baseURL,
|
|
36
|
+
formData: (0, _get["default"])(options, "formData") || params,
|
|
37
|
+
useDefaultSuccessHandler: this.config.useDefaultSuccessHandler
|
|
38
|
+
}).then(function (data) {
|
|
39
|
+
_this.config.onSuccess && _this.config.onSuccess(_this, (0, _get["default"])(data, "userInfo"));
|
|
40
|
+
successcb && successcb(data);
|
|
41
|
+
_this.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [_this, data]);
|
|
42
|
+
if (_this.config.useDefaultSuccessHandler) {
|
|
43
|
+
_this.config.securityService().navigateToLandingPage(data);
|
|
44
|
+
}
|
|
45
|
+
})["catch"](function (error) {
|
|
46
|
+
_this.config.onError && _this.config.onError(_this, error);
|
|
47
|
+
errorcb && errorcb(error);
|
|
48
|
+
_this.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [_this, error]);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}]);
|
|
52
|
+
return LoginAction;
|
|
53
|
+
}(_baseAction.BaseAction);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LogoutAction = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
+
var _baseAction = require("./base-action");
|
|
14
|
+
var _baseVariable = require("../variables/base-variable");
|
|
15
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; }
|
|
16
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
17
|
+
var LogoutAction = exports.LogoutAction = /*#__PURE__*/function (_BaseAction) {
|
|
18
|
+
(0, _inherits2["default"])(LogoutAction, _BaseAction);
|
|
19
|
+
var _super = _createSuper(LogoutAction);
|
|
20
|
+
function LogoutAction(config) {
|
|
21
|
+
(0, _classCallCheck2["default"])(this, LogoutAction);
|
|
22
|
+
return _super.call(this, config);
|
|
23
|
+
}
|
|
24
|
+
(0, _createClass2["default"])(LogoutAction, [{
|
|
25
|
+
key: "invoke",
|
|
26
|
+
value: function invoke(options, successcb, errorcb) {
|
|
27
|
+
var _this = this;
|
|
28
|
+
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this]);
|
|
29
|
+
return this.config.securityService().logout(this.config.baseURL).then(function (data) {
|
|
30
|
+
_this.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [_this, data]);
|
|
31
|
+
_this.config.onSuccess && _this.config.onSuccess(_this, data);
|
|
32
|
+
successcb && successcb(data);
|
|
33
|
+
})["catch"](function (error) {
|
|
34
|
+
_this.config.onError && _this.config.onError(_this, error);
|
|
35
|
+
errorcb && errorcb(error);
|
|
36
|
+
_this.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [_this, error]);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}]);
|
|
40
|
+
return LogoutAction;
|
|
41
|
+
}(_baseAction.BaseAction);
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.NavigationAction = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
+
var _baseVariable = require("@wavemaker/react-runtime/variables/base-variable");
|
|
16
|
+
var _baseAction = require("./base-action");
|
|
17
|
+
var _lodashEs = require("lodash-es");
|
|
18
|
+
var _navigationMiddleware = require("@wavemaker/react-runtime/store/middleware/navigationMiddleware");
|
|
19
|
+
var _constants = require("../core/constants");
|
|
20
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
var NavigationAction = exports.NavigationAction = /*#__PURE__*/function (_BaseAction) {
|
|
23
|
+
(0, _inherits2["default"])(NavigationAction, _BaseAction);
|
|
24
|
+
var _super = _createSuper(NavigationAction);
|
|
25
|
+
function NavigationAction(config) {
|
|
26
|
+
(0, _classCallCheck2["default"])(this, NavigationAction);
|
|
27
|
+
return _super.call(this, config);
|
|
28
|
+
}
|
|
29
|
+
(0, _createClass2["default"])(NavigationAction, [{
|
|
30
|
+
key: "invoke",
|
|
31
|
+
value: function invoke(params, onSuccess, onError) {
|
|
32
|
+
var _params,
|
|
33
|
+
_this = this;
|
|
34
|
+
var config = this.config;
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
params = (_params = params) !== null && _params !== void 0 && _params.data ? (0, _lodashEs.merge)(this.config.paramProvider(), params.data) : (0, _lodashEs.merge)(this.config.paramProvider(), this.dataSet);
|
|
37
|
+
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);
|
|
38
|
+
return (0, _get2["default"])((0, _getPrototypeOf2["default"])(NavigationAction.prototype), "invoke", this).call(this, params, onSuccess, onError).then(function () {
|
|
39
|
+
switch (config.operation) {
|
|
40
|
+
case "goToPreviousPage":
|
|
41
|
+
_this.handleGoToPreviousPage();
|
|
42
|
+
break;
|
|
43
|
+
case "gotoTab":
|
|
44
|
+
_this.handleGotoTab(params || {});
|
|
45
|
+
break;
|
|
46
|
+
case "gotoAccordion":
|
|
47
|
+
_this.handleGotoAccordion(params || {});
|
|
48
|
+
break;
|
|
49
|
+
case "gotoPage":
|
|
50
|
+
_this.handleGotoPage(params || {});
|
|
51
|
+
}
|
|
52
|
+
}).then(function () {
|
|
53
|
+
config.onSuccess && config.onSuccess(_this, _this.dataSet);
|
|
54
|
+
_this.notify(_baseVariable.VariableEvents.SUCCESS, [_this, _this.dataSet]);
|
|
55
|
+
}, function () {
|
|
56
|
+
config.onError && config.onError(_this, null);
|
|
57
|
+
_this.notify(_baseVariable.VariableEvents.ERROR, [_this, _this.dataSet]);
|
|
58
|
+
}).then(function () {
|
|
59
|
+
_this.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [_this, _this.dataSet]);
|
|
60
|
+
return _this;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "navigate",
|
|
65
|
+
value: function navigate(params, onSuccess, onError) {
|
|
66
|
+
return this.invoke(params, onSuccess, onError);
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "handleGoToPreviousPage",
|
|
70
|
+
value: function handleGoToPreviousPage() {
|
|
71
|
+
var router = (0, _navigationMiddleware.getRouterInstance)();
|
|
72
|
+
try {
|
|
73
|
+
if (router) {
|
|
74
|
+
router.back();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Fallback to window history if router.back() doesn't work
|
|
79
|
+
if (typeof window !== "undefined") {
|
|
80
|
+
window.history.length > 1 ? window.history.go(-1) : window.location.href = "/";
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
console.warn("Unable to navigate to previous page");
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error("Error navigating to previous page:", error);
|
|
86
|
+
if (typeof window !== "undefined") {
|
|
87
|
+
window.location.href = "/";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "handleGotoTab",
|
|
93
|
+
value: function handleGotoTab(params) {
|
|
94
|
+
var _this$config$_context;
|
|
95
|
+
var tabName = params === null || params === void 0 ? void 0 : params.tabName;
|
|
96
|
+
if (tabName && (_this$config$_context = this.config._context) !== null && _this$config$_context !== void 0 && (_this$config$_context = _this$config$_context.Widgets[tabName]) !== null && _this$config$_context !== void 0 && _this$config$_context.select) {
|
|
97
|
+
this.config._context.Widgets[tabName].select();
|
|
98
|
+
} else {
|
|
99
|
+
console.warn("Unable to select tab: ".concat(tabName));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "handleGotoAccordion",
|
|
104
|
+
value: function handleGotoAccordion(params) {
|
|
105
|
+
var _this$config$_context2;
|
|
106
|
+
var accordionName = params === null || params === void 0 ? void 0 : params.accordionName;
|
|
107
|
+
if (accordionName && (_this$config$_context2 = this.config._context) !== null && _this$config$_context2 !== void 0 && (_this$config$_context2 = _this$config$_context2.Widgets[accordionName]) !== null && _this$config$_context2 !== void 0 && _this$config$_context2.expand) {
|
|
108
|
+
this.config._context.Widgets[accordionName].expand();
|
|
109
|
+
} else {
|
|
110
|
+
console.warn("Unable to expand accordion: ".concat(accordionName));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
key: "handleGotoPage",
|
|
115
|
+
value: function handleGotoPage(params) {
|
|
116
|
+
var router = (0, _navigationMiddleware.getRouterInstance)();
|
|
117
|
+
var pageName = params === null || params === void 0 ? void 0 : params.pageName;
|
|
118
|
+
if (pageName) {
|
|
119
|
+
// Remove leading slash if present, then add it back to ensure consistency
|
|
120
|
+
var cleanPageName = pageName.replace(/^\//, "");
|
|
121
|
+
|
|
122
|
+
// Prepare query params if any exist
|
|
123
|
+
var queryParams = Object.entries(params).filter(function (_ref) {
|
|
124
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 1),
|
|
125
|
+
key = _ref2[0];
|
|
126
|
+
return key !== "pageName";
|
|
127
|
+
}).map(function (_ref3) {
|
|
128
|
+
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2),
|
|
129
|
+
key = _ref4[0],
|
|
130
|
+
value = _ref4[1];
|
|
131
|
+
return "".concat(key, "=").concat(encodeURIComponent(value));
|
|
132
|
+
}).join("&");
|
|
133
|
+
|
|
134
|
+
// Construct full path with optional query string
|
|
135
|
+
var fullPath = queryParams ? "/".concat(cleanPageName, "?").concat(queryParams) : "/".concat(cleanPageName);
|
|
136
|
+
if (router) {
|
|
137
|
+
router.push("/".concat(_constants.ROUTING_BASEPATH).concat(fullPath));
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
console.warn("No page name provided for navigation");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}]);
|
|
144
|
+
return NavigationAction;
|
|
145
|
+
}(_baseAction.BaseAction);
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.NotificationAction = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _baseAction = require("./base-action");
|
|
15
|
+
var _baseVariable = require("@wavemaker/react-runtime/variables/base-variable");
|
|
16
|
+
var _lodashEs = require("lodash-es");
|
|
17
|
+
var _toast = require("./toast.service");
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
var DEFAULT_DURATION = 3000;
|
|
23
|
+
var NOTIFICATION_TYPE = {
|
|
24
|
+
success: "success",
|
|
25
|
+
error: "error",
|
|
26
|
+
warning: "warning",
|
|
27
|
+
information: "info",
|
|
28
|
+
info: "info"
|
|
29
|
+
};
|
|
30
|
+
var NotificationAction = exports.NotificationAction = /*#__PURE__*/function (_BaseAction) {
|
|
31
|
+
(0, _inherits2["default"])(NotificationAction, _BaseAction);
|
|
32
|
+
var _super = _createSuper(NotificationAction);
|
|
33
|
+
function NotificationAction(config) {
|
|
34
|
+
(0, _classCallCheck2["default"])(this, NotificationAction);
|
|
35
|
+
return _super.call(this, config);
|
|
36
|
+
}
|
|
37
|
+
(0, _createClass2["default"])(NotificationAction, [{
|
|
38
|
+
key: "prepareToastOptions",
|
|
39
|
+
value: function prepareToastOptions() {
|
|
40
|
+
var _this = this;
|
|
41
|
+
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
42
|
+
var configParams = this.config.paramProvider();
|
|
43
|
+
var mergedParams = _objectSpread(_objectSpread({}, configParams), params);
|
|
44
|
+
var alertClass = (mergedParams["class"] || "info").toLowerCase();
|
|
45
|
+
var type = NOTIFICATION_TYPE[alertClass] || "info";
|
|
46
|
+
|
|
47
|
+
// get toast position
|
|
48
|
+
var position = mergedParams.toasterPosition || "top right";
|
|
49
|
+
|
|
50
|
+
// Determine duration (0 means stay until dismissed)
|
|
51
|
+
var duration = parseInt(String(mergedParams.duration));
|
|
52
|
+
if (isNaN(duration)) {
|
|
53
|
+
duration = type === "success" ? DEFAULT_DURATION : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Create final options object
|
|
57
|
+
return {
|
|
58
|
+
text: mergedParams.text || mergedParams.message || "",
|
|
59
|
+
type: type,
|
|
60
|
+
position: position,
|
|
61
|
+
content: this.config.partialContent,
|
|
62
|
+
duration: duration,
|
|
63
|
+
name: this.name,
|
|
64
|
+
styles: mergedParams.styles || {},
|
|
65
|
+
hideOnClick: mergedParams.hideOnClick !== false,
|
|
66
|
+
onClose: function onClose() {
|
|
67
|
+
if (_this.config.onClose) {
|
|
68
|
+
_this.config.onClose(_this, null);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
onClick: function onClick() {
|
|
72
|
+
if (_this.config.onOk) {
|
|
73
|
+
_this.config.onOk(_this, null);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "invoke",
|
|
80
|
+
value: function invoke(params, onSuccess, onError) {
|
|
81
|
+
var _this2 = this;
|
|
82
|
+
// Priority: params.data > params > this.dataSet
|
|
83
|
+
var mergedParams = params !== null && params !== void 0 && params.data ? (0, _lodashEs.merge)(this.config.paramProvider(), params.data) : params ? (0, _lodashEs.merge)(this.config.paramProvider(), params) : (0, _lodashEs.merge)(this.config.paramProvider(), this.dataSet);
|
|
84
|
+
|
|
85
|
+
// Notify before invoke
|
|
86
|
+
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this, mergedParams]);
|
|
87
|
+
try {
|
|
88
|
+
// Handle different operation types
|
|
89
|
+
if (this.config.operation === "toast") {
|
|
90
|
+
this.showToast(mergedParams);
|
|
91
|
+
} else if (this.config.showDialog) {
|
|
92
|
+
var dialogData = _objectSpread(_objectSpread({}, mergedParams), {}, {
|
|
93
|
+
onOk: function onOk() {
|
|
94
|
+
var _this2$config$onOk, _this2$config;
|
|
95
|
+
return (_this2$config$onOk = (_this2$config = _this2.config).onOk) === null || _this2$config$onOk === void 0 ? void 0 : _this2$config$onOk.call(_this2$config, _this2, mergedParams);
|
|
96
|
+
},
|
|
97
|
+
onCancel: function onCancel() {
|
|
98
|
+
var _this2$config$onCance, _this2$config2;
|
|
99
|
+
return (_this2$config$onCance = (_this2$config2 = _this2.config).onCancel) === null || _this2$config$onCance === void 0 ? void 0 : _this2$config$onCance.call(_this2$config2, _this2, mergedParams);
|
|
100
|
+
},
|
|
101
|
+
onClose: function onClose() {
|
|
102
|
+
var _this2$config$onClose, _this2$config3;
|
|
103
|
+
return (_this2$config$onClose = (_this2$config3 = _this2.config).onClose) === null || _this2$config$onClose === void 0 ? void 0 : _this2$config$onClose.call(_this2$config3, _this2, mergedParams);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
this.config.showDialog(dialogData);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Call success callback
|
|
110
|
+
if (onSuccess && typeof onSuccess === "function") {
|
|
111
|
+
onSuccess(this, mergedParams);
|
|
112
|
+
}
|
|
113
|
+
this.notify(_baseVariable.VariableEvents.SUCCESS, [this, mergedParams]);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
// Handle errors
|
|
116
|
+
console.error("Error in notification action:", error);
|
|
117
|
+
if (onError) onError(this, error);
|
|
118
|
+
this.notify(_baseVariable.VariableEvents.ERROR, [this, error]);
|
|
119
|
+
return Promise.reject(error);
|
|
120
|
+
}
|
|
121
|
+
this.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [this, mergedParams]);
|
|
122
|
+
return Promise.resolve(this);
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "showToast",
|
|
126
|
+
value: function showToast(params) {
|
|
127
|
+
try {
|
|
128
|
+
var _this$config$toasterS, _this$config;
|
|
129
|
+
var service = (_this$config$toasterS = (_this$config = this.config).toasterService) === null || _this$config$toasterS === void 0 ? void 0 : _this$config$toasterS.call(_this$config);
|
|
130
|
+
if (!service) {
|
|
131
|
+
service = _toast.toastService;
|
|
132
|
+
}
|
|
133
|
+
if (service && typeof service.showToast === "function") {
|
|
134
|
+
service.showToast(this.prepareToastOptions(params));
|
|
135
|
+
} else {
|
|
136
|
+
console.warn("Toast service not available");
|
|
137
|
+
}
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.error("Error showing toast:", error);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}, {
|
|
143
|
+
key: "getMessage",
|
|
144
|
+
value: function getMessage() {}
|
|
145
|
+
}]);
|
|
146
|
+
return NotificationAction;
|
|
147
|
+
}(_baseAction.BaseAction);
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TimerAction = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
12
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _baseAction = require("./base-action");
|
|
17
|
+
var _baseVariable = require("@wavemaker/react-runtime/variables/base-variable");
|
|
18
|
+
var _lodashEs = require("lodash-es");
|
|
19
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; }
|
|
20
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
var TimerAction = exports.TimerAction = /*#__PURE__*/function (_BaseAction) {
|
|
22
|
+
(0, _inherits2["default"])(TimerAction, _BaseAction);
|
|
23
|
+
var _super = _createSuper(TimerAction);
|
|
24
|
+
function TimerAction(config) {
|
|
25
|
+
var _this;
|
|
26
|
+
(0, _classCallCheck2["default"])(this, TimerAction);
|
|
27
|
+
_this = _super.call(this, config);
|
|
28
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_timerId", -1);
|
|
29
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_isActive", false);
|
|
30
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_onSuccess", void 0);
|
|
31
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_onError", void 0);
|
|
32
|
+
return _this;
|
|
33
|
+
}
|
|
34
|
+
(0, _createClass2["default"])(TimerAction, [{
|
|
35
|
+
key: "invoke",
|
|
36
|
+
value: function invoke(params, onSuccess, onError) {
|
|
37
|
+
var _params,
|
|
38
|
+
_this2 = this;
|
|
39
|
+
params = (_params = params) !== null && _params !== void 0 && _params.data ? (0, _lodashEs.merge)(this.config.paramProvider(), params.data) : (0, _lodashEs.merge)(this.config.paramProvider(), this.dataSet);
|
|
40
|
+
|
|
41
|
+
// Notify that we're about to invoke
|
|
42
|
+
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);
|
|
43
|
+
return (0, _get2["default"])((0, _getPrototypeOf2["default"])(TimerAction.prototype), "invoke", this).call(this, params, onSuccess, onError).then(function () {
|
|
44
|
+
// Start the timer
|
|
45
|
+
_this2.startTimer();
|
|
46
|
+
|
|
47
|
+
// Store the callbacks for later use when timer fires
|
|
48
|
+
_this2._onSuccess = onSuccess;
|
|
49
|
+
_this2._onError = onError;
|
|
50
|
+
}).then(function () {
|
|
51
|
+
_this2.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [_this2, _this2.dataSet]);
|
|
52
|
+
return _this2;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Starts the timer based on configuration
|
|
58
|
+
*/
|
|
59
|
+
}, {
|
|
60
|
+
key: "startTimer",
|
|
61
|
+
value: function startTimer() {
|
|
62
|
+
var _this3 = this;
|
|
63
|
+
// Cancel any existing timer first
|
|
64
|
+
this.cancel();
|
|
65
|
+
var _this$config = this.config,
|
|
66
|
+
repeating = _this$config.repeating,
|
|
67
|
+
delay = _this$config.delay;
|
|
68
|
+
this._isActive = true;
|
|
69
|
+
var executeCallback = function executeCallback() {
|
|
70
|
+
try {
|
|
71
|
+
// Call the configured success handler
|
|
72
|
+
_this3.config.onSuccess && _this3.config.onSuccess(_this3, _this3.dataSet);
|
|
73
|
+
_this3._onSuccess && _this3._onSuccess(_this3, _this3.dataSet);
|
|
74
|
+
_this3.notify(_baseVariable.VariableEvents.SUCCESS, [_this3, _this3.dataSet]);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
console.error("Error in timer callback:", error);
|
|
77
|
+
|
|
78
|
+
// Call the configured error handler
|
|
79
|
+
_this3.config.onError && _this3.config.onError(_this3, error);
|
|
80
|
+
_this3._onError && _this3._onError(_this3, error);
|
|
81
|
+
_this3.notify(_baseVariable.VariableEvents.ERROR, [_this3, error]);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
if (repeating) {
|
|
85
|
+
this._timerId = setInterval(executeCallback, delay);
|
|
86
|
+
} else {
|
|
87
|
+
this._timerId = setTimeout(function () {
|
|
88
|
+
executeCallback();
|
|
89
|
+
_this3._isActive = false;
|
|
90
|
+
_this3._timerId = -1;
|
|
91
|
+
}, delay);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Cancel active timer
|
|
96
|
+
}, {
|
|
97
|
+
key: "cancel",
|
|
98
|
+
value: function cancel() {
|
|
99
|
+
if (this._timerId !== -1) {
|
|
100
|
+
if (this.config.repeating) {
|
|
101
|
+
clearInterval(this._timerId);
|
|
102
|
+
} else {
|
|
103
|
+
clearTimeout(this._timerId);
|
|
104
|
+
}
|
|
105
|
+
this._timerId = -1;
|
|
106
|
+
this._isActive = false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Pauses the timer (alias for cancel)
|
|
111
|
+
}, {
|
|
112
|
+
key: "pause",
|
|
113
|
+
value: function pause() {
|
|
114
|
+
this.cancel();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Resumes the timer (if it was paused)
|
|
118
|
+
}, {
|
|
119
|
+
key: "resume",
|
|
120
|
+
value: function resume() {
|
|
121
|
+
if (!this._isActive) {
|
|
122
|
+
this.startTimer();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "trigger",
|
|
127
|
+
value: function trigger() {
|
|
128
|
+
// Notify we're about to trigger
|
|
129
|
+
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);
|
|
130
|
+
|
|
131
|
+
// Execute callback immediately
|
|
132
|
+
try {
|
|
133
|
+
this.config.onSuccess && this.config.onSuccess(this, this.dataSet);
|
|
134
|
+
this._onSuccess && this._onSuccess(this, this.dataSet);
|
|
135
|
+
this.notify(_baseVariable.VariableEvents.SUCCESS, [this, this.dataSet]);
|
|
136
|
+
} catch (error) {
|
|
137
|
+
console.error("Error in timer trigger:", error);
|
|
138
|
+
this.config.onError && this.config.onError(this, error);
|
|
139
|
+
this._onError && this._onError(this, error);
|
|
140
|
+
this.notify(_baseVariable.VariableEvents.ERROR, [this, error]);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Notify we've completed the trigger
|
|
144
|
+
this.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [this, this.dataSet]);
|
|
145
|
+
return Promise.resolve(this);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Checks if the timer is currently active
|
|
150
|
+
*/
|
|
151
|
+
}, {
|
|
152
|
+
key: "isActive",
|
|
153
|
+
value: function isActive() {
|
|
154
|
+
return this._isActive;
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "destroy",
|
|
158
|
+
value: function destroy() {
|
|
159
|
+
this.cancel();
|
|
160
|
+
(0, _get2["default"])((0, _getPrototypeOf2["default"])(TimerAction.prototype), "destroy", this).call(this);
|
|
161
|
+
}
|
|
162
|
+
}]);
|
|
163
|
+
return TimerAction;
|
|
164
|
+
}(_baseAction.BaseAction);
|