@wavemaker/react-runtime 11.14.1-rc.236
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 +10183 -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,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.loginErrorMessage = exports.invokeFormEvent = exports.getFormWidget = exports.getFormProps = exports.getFormData = exports.formValidate = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
/**
|
|
12
|
+
* Form utility functions for centralizing form operations across widgets
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The `loginErrorMessage` function handles various scenarios to generate an appropriate error message
|
|
17
|
+
* for login failures, including extracting from standard error response structures and providing
|
|
18
|
+
* fallback options.
|
|
19
|
+
* @param {any} error - The `error` parameter in the `loginErrorMessage` function is used to handle
|
|
20
|
+
* different types of errors that may occur during the login process. It can be of any type, such as a
|
|
21
|
+
* string, object, or other data types, and the function provides different logic to extract and handle
|
|
22
|
+
* error messages based
|
|
23
|
+
* @param [appLocale] - The `appLocale` parameter is an optional object that contains localized strings
|
|
24
|
+
* for different languages or regions. It is used to provide localized error messages based on the
|
|
25
|
+
* user's preferred language or region. If a specific error message is not provided, the function will
|
|
26
|
+
* fallback to a default error message stored in the `
|
|
27
|
+
* @param {string} [errorMessage] - The `errorMessage` parameter in the `loginErrorMessage` function is
|
|
28
|
+
* a string that can be passed directly to override any other error message handling logic in the
|
|
29
|
+
* function. If a value is provided for `errorMessage`, it will be returned immediately without going
|
|
30
|
+
* through the other error handling steps in the function.
|
|
31
|
+
* @returns The function `loginErrorMessage` returns a string message based on the provided error
|
|
32
|
+
* object, appLocale object, and optional errorMessage string. The function follows these steps to
|
|
33
|
+
* determine the message to return:
|
|
34
|
+
*/
|
|
35
|
+
var loginErrorMessage = exports.loginErrorMessage = function loginErrorMessage(error, appLocale, errorMessage) {
|
|
36
|
+
// 1. If a direct error message is passed, use it
|
|
37
|
+
if (errorMessage) return errorMessage;
|
|
38
|
+
|
|
39
|
+
// 2. If it's a plain string error
|
|
40
|
+
if (typeof error === "string") {
|
|
41
|
+
return error;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 3. Try extracting from standard error response structure
|
|
45
|
+
if (error && (0, _typeof2["default"])(error) === "object") {
|
|
46
|
+
var _error$data;
|
|
47
|
+
var serverError = error === null || error === void 0 || (_error$data = error.data) === null || _error$data === void 0 || (_error$data = _error$data.errors) === null || _error$data === void 0 || (_error$data = _error$data.error) === null || _error$data === void 0 ? void 0 : _error$data[0];
|
|
48
|
+
if (serverError) {
|
|
49
|
+
var message = serverError.message,
|
|
50
|
+
_serverError$paramete = serverError.parameters,
|
|
51
|
+
parameters = _serverError$paramete === void 0 ? [] : _serverError$paramete;
|
|
52
|
+
if (typeof message === "string") {
|
|
53
|
+
// Replace {0}, {1}, {2}, ... with corresponding parameters dynamically
|
|
54
|
+
return message.replace(/{(\d+)}/g, function (match, index) {
|
|
55
|
+
var param = parameters[+index];
|
|
56
|
+
return param !== undefined ? param : match;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// If no message, but parameters exist, just join them
|
|
61
|
+
if (parameters.length) {
|
|
62
|
+
return parameters.join(", ");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Fallback to error.message or .toString()
|
|
67
|
+
return error.message || error.toString();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 4. Fallback to localized or default error message
|
|
71
|
+
return (appLocale === null || appLocale === void 0 ? void 0 : appLocale.LABEL_INVALID_USERNAME_OR_PASSWORD) || "Invalid username or password";
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get form properties safely from a form reference
|
|
76
|
+
*/
|
|
77
|
+
var getFormProps = exports.getFormProps = function getFormProps(formRef) {
|
|
78
|
+
var _formRef$current;
|
|
79
|
+
if (!((_formRef$current = formRef.current) !== null && _formRef$current !== void 0 && _formRef$current.getProps)) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return formRef.current.getProps();
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get form widget from listener widgets collection
|
|
87
|
+
*/
|
|
88
|
+
var getFormWidget = exports.getFormWidget = function getFormWidget(formName, listener) {
|
|
89
|
+
var _listener$Widgets;
|
|
90
|
+
return listener === null || listener === void 0 || (_listener$Widgets = listener.Widgets) === null || _listener$Widgets === void 0 ? void 0 : _listener$Widgets[formName];
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get form data from form reference with fallback
|
|
95
|
+
*/
|
|
96
|
+
var getFormData = exports.getFormData = function getFormData(formRef) {
|
|
97
|
+
if (!formRef.current) return {
|
|
98
|
+
values: {},
|
|
99
|
+
isValid: false
|
|
100
|
+
};
|
|
101
|
+
if (formRef.current.getFormData) {
|
|
102
|
+
return formRef.current.getFormData();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Fallback for legacy forms
|
|
106
|
+
return {
|
|
107
|
+
values: {},
|
|
108
|
+
isValid: true
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
var formValidate = exports.formValidate = /*#__PURE__*/function () {
|
|
112
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(formRef) {
|
|
113
|
+
var _formRef$current$vali, _formRef$current2;
|
|
114
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
115
|
+
while (1) switch (_context.prev = _context.next) {
|
|
116
|
+
case 0:
|
|
117
|
+
if (formRef.current) {
|
|
118
|
+
_context.next = 2;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
return _context.abrupt("return", false);
|
|
122
|
+
case 2:
|
|
123
|
+
_context.next = 4;
|
|
124
|
+
return (_formRef$current$vali = (_formRef$current2 = formRef.current).validateForm) === null || _formRef$current$vali === void 0 ? void 0 : _formRef$current$vali.call(_formRef$current2);
|
|
125
|
+
case 4:
|
|
126
|
+
_context.t0 = _context.sent;
|
|
127
|
+
if (_context.t0) {
|
|
128
|
+
_context.next = 7;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
_context.t0 = false;
|
|
132
|
+
case 7:
|
|
133
|
+
return _context.abrupt("return", _context.t0);
|
|
134
|
+
case 8:
|
|
135
|
+
case "end":
|
|
136
|
+
return _context.stop();
|
|
137
|
+
}
|
|
138
|
+
}, _callee);
|
|
139
|
+
}));
|
|
140
|
+
return function formValidate(_x) {
|
|
141
|
+
return _ref.apply(this, arguments);
|
|
142
|
+
};
|
|
143
|
+
}();
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Invoke form events in a centralized way
|
|
147
|
+
* @param formRef - Reference to the form element
|
|
148
|
+
* @param listener - Widget listener containing form widgets
|
|
149
|
+
* @param eventName - Name of the event to invoke ('onSubmit', 'onBeforeSubmit', etc.)
|
|
150
|
+
* @param event - The event object
|
|
151
|
+
* @param formData - Optional form data to pass to the event handler
|
|
152
|
+
* @returns The result from the event handler (boolean, string, object, or undefined)
|
|
153
|
+
*/
|
|
154
|
+
var invokeFormEvent = exports.invokeFormEvent = /*#__PURE__*/function () {
|
|
155
|
+
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(formRef, listener, eventName, event, formData) {
|
|
156
|
+
var formProps, formName, eventHandler, formWidget, result;
|
|
157
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
158
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
159
|
+
case 0:
|
|
160
|
+
formProps = getFormProps(formRef);
|
|
161
|
+
if (formProps) {
|
|
162
|
+
_context2.next = 3;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
return _context2.abrupt("return");
|
|
166
|
+
case 3:
|
|
167
|
+
formName = formProps.name, eventHandler = formProps[eventName];
|
|
168
|
+
if (!(eventHandler && formName)) {
|
|
169
|
+
_context2.next = 10;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
formWidget = getFormWidget(formName, listener);
|
|
173
|
+
_context2.next = 8;
|
|
174
|
+
return eventHandler(event, formWidget, formData.values || {});
|
|
175
|
+
case 8:
|
|
176
|
+
result = _context2.sent;
|
|
177
|
+
return _context2.abrupt("return", result);
|
|
178
|
+
case 10:
|
|
179
|
+
case "end":
|
|
180
|
+
return _context2.stop();
|
|
181
|
+
}
|
|
182
|
+
}, _callee2);
|
|
183
|
+
}));
|
|
184
|
+
return function invokeFormEvent(_x2, _x3, _x4, _x5, _x6) {
|
|
185
|
+
return _ref2.apply(this, arguments);
|
|
186
|
+
};
|
|
187
|
+
}();
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.validateNumericValue = exports.roundToStep = exports.parseNumber = exports.isPercentageValue = exports.handleValidatedValueUpdate = exports.handleStepValue = exports.handleNumericInputChange = exports.getValueInRange = exports.getDecimalCount = exports.formatOnBlur = exports.formatNumberWithCommas = exports.formatFinancialValue = exports.findValueOf = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
var getDecimalCount = exports.getDecimalCount = function getDecimalCount(format, DECIMAL_COUNT_MAP) {
|
|
13
|
+
return DECIMAL_COUNT_MAP[format] || 0;
|
|
14
|
+
};
|
|
15
|
+
var isPercentageValue = exports.isPercentageValue = function isPercentageValue(value) {
|
|
16
|
+
return value.includes("%");
|
|
17
|
+
};
|
|
18
|
+
var findValueOf = exports.findValueOf = function findValueOf(datum, key) {
|
|
19
|
+
return datum[key] !== undefined ? datum[key] : datum;
|
|
20
|
+
};
|
|
21
|
+
var parseNumber = exports.parseNumber = function parseNumber(val) {
|
|
22
|
+
return Number.parseFloat(val) || NaN;
|
|
23
|
+
};
|
|
24
|
+
var formatFinancialValue = exports.formatFinancialValue = function formatFinancialValue(value, decimalplaces) {
|
|
25
|
+
var numericValue = value.replace(/[^\d]/g, "");
|
|
26
|
+
if (!numericValue) return "";
|
|
27
|
+
var num = Number.parseInt(numericValue, 10) / Math.pow(10, decimalplaces);
|
|
28
|
+
return new Intl.NumberFormat("en-US", {
|
|
29
|
+
minimumFractionDigits: decimalplaces,
|
|
30
|
+
maximumFractionDigits: decimalplaces
|
|
31
|
+
}).format(num);
|
|
32
|
+
};
|
|
33
|
+
var formatNumberWithCommas = exports.formatNumberWithCommas = function formatNumberWithCommas(value, trailingzero, decimalplaces) {
|
|
34
|
+
if (!value && value !== 0) return "";
|
|
35
|
+
if (trailingzero && typeof value === "string") {
|
|
36
|
+
// When trailingzero is true, preserve the original string format
|
|
37
|
+
var _num = Number(value.replace(/,/g, ""));
|
|
38
|
+
if (isNaN(_num)) return "";
|
|
39
|
+
|
|
40
|
+
// If the string has decimal places, preserve them with commas in integer part
|
|
41
|
+
if (value.includes(".")) {
|
|
42
|
+
var _value$split = value.split("."),
|
|
43
|
+
_value$split2 = (0, _slicedToArray2["default"])(_value$split, 2),
|
|
44
|
+
intPart = _value$split2[0],
|
|
45
|
+
decPart = _value$split2[1];
|
|
46
|
+
var intWithCommas = new Intl.NumberFormat("en-US").format(Number(intPart));
|
|
47
|
+
return "".concat(intWithCommas, ".").concat(decPart);
|
|
48
|
+
} else {
|
|
49
|
+
return new Intl.NumberFormat("en-US").format(_num);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var num = typeof value === "string" ? Number(value.toString().replace(/,/g, "")) : value;
|
|
53
|
+
if (isNaN(num)) return "";
|
|
54
|
+
if (trailingzero && decimalplaces !== undefined && decimalplaces > 0) {
|
|
55
|
+
// Show trailing zeros with specified decimal places
|
|
56
|
+
return new Intl.NumberFormat("en-US", {
|
|
57
|
+
minimumFractionDigits: decimalplaces,
|
|
58
|
+
maximumFractionDigits: decimalplaces
|
|
59
|
+
}).format(num);
|
|
60
|
+
} else {
|
|
61
|
+
return new Intl.NumberFormat("en-US").format(num);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var getValueInRange = exports.getValueInRange = function getValueInRange(value, minvalue, maxvalue) {
|
|
65
|
+
if (!isNaN(minvalue) && value < minvalue) {
|
|
66
|
+
return minvalue;
|
|
67
|
+
}
|
|
68
|
+
if (!isNaN(maxvalue) && value > maxvalue) {
|
|
69
|
+
return maxvalue;
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// Helper function to round value based on step decimal places
|
|
75
|
+
var roundToStep = exports.roundToStep = function roundToStep(value, step, decimalplaces) {
|
|
76
|
+
var _step$toString$split$;
|
|
77
|
+
if (step === 0) return value;
|
|
78
|
+
var stepDecimals = step.toString().includes(".") ? ((_step$toString$split$ = step.toString().split(".")[1]) === null || _step$toString$split$ === void 0 ? void 0 : _step$toString$split$.length) || 0 : 0;
|
|
79
|
+
var factor = Math.pow(10, Math.max(stepDecimals, decimalplaces));
|
|
80
|
+
return Math.round(value * factor) / factor;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Handle step value calculation for increment/decrement operations
|
|
84
|
+
var handleStepValue = exports.handleStepValue = function handleStepValue(currentValue, direction, step, decimalplaces, minvalue, maxvalue) {
|
|
85
|
+
if (step === 0) {
|
|
86
|
+
return currentValue || 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Calculate new value based on step
|
|
90
|
+
var newValue;
|
|
91
|
+
if (currentValue === null || currentValue === undefined || isNaN(currentValue)) {
|
|
92
|
+
newValue = getValueInRange(minvalue || 0, minvalue || 0, maxvalue || 0);
|
|
93
|
+
} else {
|
|
94
|
+
var stepAmount = direction === "UP" ? step : -step;
|
|
95
|
+
newValue = getValueInRange(currentValue + stepAmount, minvalue || 0, maxvalue || 0);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Round to appropriate decimal places
|
|
99
|
+
return roundToStep(newValue, step, decimalplaces);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// Common validation function for both currency and number widgets
|
|
103
|
+
var validateNumericValue = exports.validateNumericValue = function validateNumericValue(value, required, minvalue, maxvalue, regexp) {
|
|
104
|
+
if (!value && required) {
|
|
105
|
+
return {
|
|
106
|
+
isValid: false,
|
|
107
|
+
message: "This field is required"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
var numValue = typeof value === "string" ? parseNumber(value) : value;
|
|
111
|
+
if (!numValue && required) {
|
|
112
|
+
return {
|
|
113
|
+
isValid: false,
|
|
114
|
+
message: "This field is required"
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (!numValue) {
|
|
118
|
+
return {
|
|
119
|
+
isValid: !required,
|
|
120
|
+
message: required ? "This field is required" : ""
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Regex validation (mainly for number widget)
|
|
125
|
+
if (regexp && !RegExp(regexp).test(numValue.toString())) {
|
|
126
|
+
return {
|
|
127
|
+
isValid: false,
|
|
128
|
+
message: "Invalid number format"
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if (minvalue !== undefined && numValue < minvalue) {
|
|
132
|
+
return {
|
|
133
|
+
isValid: false,
|
|
134
|
+
message: "Value must be at least ".concat(minvalue)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (maxvalue !== undefined && numValue > maxvalue) {
|
|
138
|
+
return {
|
|
139
|
+
isValid: false,
|
|
140
|
+
message: "Value must not exceed ".concat(maxvalue)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
isValid: true,
|
|
145
|
+
message: ""
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// Common input change handler for both widgets
|
|
150
|
+
var handleNumericInputChange = exports.handleNumericInputChange = function handleNumericInputChange(inputValue, inputmode, decimalplaces, setRawInputValue) {
|
|
151
|
+
var processedInputValue = inputValue;
|
|
152
|
+
var newVal;
|
|
153
|
+
if (inputmode === "financial") {
|
|
154
|
+
var digitsOnly = inputValue.replace(/[^\d]/g, "");
|
|
155
|
+
if (digitsOnly === "") {
|
|
156
|
+
processedInputValue = "";
|
|
157
|
+
newVal = null;
|
|
158
|
+
setRawInputValue("");
|
|
159
|
+
} else {
|
|
160
|
+
var divisor = Math.pow(10, decimalplaces);
|
|
161
|
+
newVal = parseInt(digitsOnly) / divisor;
|
|
162
|
+
if (decimalplaces > 0) {
|
|
163
|
+
processedInputValue = newVal.toFixed(decimalplaces);
|
|
164
|
+
} else {
|
|
165
|
+
processedInputValue = newVal.toString();
|
|
166
|
+
}
|
|
167
|
+
setRawInputValue(processedInputValue);
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
// Basic validation for decimal input
|
|
171
|
+
if (decimalplaces > 0) {
|
|
172
|
+
// Allow digits, one dot, and basic decimal formatting
|
|
173
|
+
var _cleanValue = inputValue.replace(/[^\d.-]/g, "");
|
|
174
|
+
var dotCount = (_cleanValue.match(/\./g) || []).length;
|
|
175
|
+
|
|
176
|
+
// Prevent multiple dots
|
|
177
|
+
if (dotCount > 1) {
|
|
178
|
+
return {
|
|
179
|
+
inputValue: inputValue,
|
|
180
|
+
newVal: null
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Prevent decimal places beyond the limit
|
|
185
|
+
var _cleanValue$split = _cleanValue.split("."),
|
|
186
|
+
_cleanValue$split2 = (0, _slicedToArray2["default"])(_cleanValue$split, 2),
|
|
187
|
+
intPart = _cleanValue$split2[0],
|
|
188
|
+
_cleanValue$split2$ = _cleanValue$split2[1],
|
|
189
|
+
decPart = _cleanValue$split2$ === void 0 ? "" : _cleanValue$split2$;
|
|
190
|
+
if (decPart && decPart.length > decimalplaces) {
|
|
191
|
+
return {
|
|
192
|
+
inputValue: inputValue,
|
|
193
|
+
newVal: null
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
processedInputValue = _cleanValue;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Remove commas for processing but keep original input for display
|
|
200
|
+
var cleanValue = processedInputValue.replace(/,/g, "");
|
|
201
|
+
if (cleanValue === "" || cleanValue === "-") {
|
|
202
|
+
newVal = null;
|
|
203
|
+
setRawInputValue(cleanValue);
|
|
204
|
+
} else {
|
|
205
|
+
// Convert to number for validation and calculations
|
|
206
|
+
newVal = Number(cleanValue);
|
|
207
|
+
if (isNaN(newVal)) {
|
|
208
|
+
return {
|
|
209
|
+
inputValue: inputValue,
|
|
210
|
+
newVal: null
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Store raw input value to preserve trailing zeros
|
|
215
|
+
setRawInputValue(cleanValue);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Don't format during typing - keep original input
|
|
219
|
+
processedInputValue = inputValue;
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
inputValue: processedInputValue,
|
|
223
|
+
newVal: newVal
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
// Common blur formatting function
|
|
228
|
+
var formatOnBlur = exports.formatOnBlur = function formatOnBlur(datavalue, rawInputValue, trailingzero, decimalplaces) {
|
|
229
|
+
if (datavalue !== null) {
|
|
230
|
+
if (trailingzero) {
|
|
231
|
+
// Use the raw input value to preserve trailing zeros
|
|
232
|
+
return formatNumberWithCommas(rawInputValue, trailingzero, decimalplaces);
|
|
233
|
+
} else {
|
|
234
|
+
return formatNumberWithCommas(datavalue);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return "";
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// Common validated value update function
|
|
241
|
+
var handleValidatedValueUpdate = exports.handleValidatedValueUpdate = function handleValidatedValueUpdate(value, name, inputElCurrent, onChangeProp, listenerProp, prevDatavalueState, setPrevDatavalueState, widgetProps) {
|
|
242
|
+
var stringifiedValue = value === null ? "" : value.toString();
|
|
243
|
+
var widgetInfo = name && listenerProp !== null && listenerProp !== void 0 && listenerProp.Widgets ? listenerProp.Widgets[name] : undefined;
|
|
244
|
+
if (onChangeProp) {
|
|
245
|
+
var syntheticEvent = {
|
|
246
|
+
target: {
|
|
247
|
+
value: stringifiedValue,
|
|
248
|
+
name: name
|
|
249
|
+
},
|
|
250
|
+
currentTarget: inputElCurrent
|
|
251
|
+
};
|
|
252
|
+
onChangeProp(syntheticEvent, widgetInfo || widgetProps, value, prevDatavalueState);
|
|
253
|
+
}
|
|
254
|
+
if (listenerProp !== null && listenerProp !== void 0 && listenerProp.onChange) {
|
|
255
|
+
listenerProp.onChange(name, _objectSpread(_objectSpread({}, widgetInfo || {}), {}, {
|
|
256
|
+
datavalue: stringifiedValue
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
setPrevDatavalueState(value);
|
|
260
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.computeMergedPageParams = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
var computeMergedPageParams = exports.computeMergedPageParams = function computeMergedPageParams(urlParams, options) {
|
|
12
|
+
var _ref = options || {},
|
|
13
|
+
componentType = _ref.componentType,
|
|
14
|
+
props = _ref.props;
|
|
15
|
+
if (componentType === "PARTIAL") {
|
|
16
|
+
var partialParams = {};
|
|
17
|
+
Object.keys(props || {}).forEach(function (k) {
|
|
18
|
+
// Including all incoming props as partial params
|
|
19
|
+
partialParams[k] = props[k];
|
|
20
|
+
});
|
|
21
|
+
return _objectSpread(_objectSpread({}, urlParams), partialParams);
|
|
22
|
+
}
|
|
23
|
+
return urlParams;
|
|
24
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.prefixPrefabResourceUrl = prefixPrefabResourceUrl;
|
|
7
|
+
function prefixPrefabResourceUrl(source, prefabName) {
|
|
8
|
+
if (!source) return source;
|
|
9
|
+
var trimmed = source.trim();
|
|
10
|
+
|
|
11
|
+
// Skip if absolute http(s) URL or starts with data: or blob:
|
|
12
|
+
var lower = trimmed.toLowerCase();
|
|
13
|
+
if (lower.startsWith("http://") || lower.startsWith("https://") || lower.startsWith("data:") || lower.startsWith("blob:")) {
|
|
14
|
+
return source;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Only process if starts with resources/ and prefabName exists
|
|
18
|
+
if (!prefabName) return source;
|
|
19
|
+
if (!trimmed.startsWith("resources/")) return source;
|
|
20
|
+
|
|
21
|
+
// If already prefixed with prefabName/, avoid double prefixing
|
|
22
|
+
var prefabPrefix = "".concat(prefabName, "/");
|
|
23
|
+
if (trimmed.startsWith(prefabPrefix)) return source;
|
|
24
|
+
|
|
25
|
+
// concadinating the prefabName with scr path like Port_In_PreCheck + /resources/images/imagelists/bring_your_phone.png
|
|
26
|
+
return "".concat(prefabName, "/").concat(trimmed);
|
|
27
|
+
}
|