@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,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useDebounceCallback = exports.debounce = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* A hook that returns a debounced version of the provided callback function.
|
|
10
|
+
* The callback will only be executed after the specified delay has passed since the last invocation.
|
|
11
|
+
*
|
|
12
|
+
* @param callback - The function to debounce
|
|
13
|
+
* @param delay - The delay in milliseconds
|
|
14
|
+
* @returns A debounced version of the callback function with a cancel method
|
|
15
|
+
*/
|
|
16
|
+
var useDebounceCallback = exports.useDebounceCallback = function useDebounceCallback(callback, delay) {
|
|
17
|
+
var timeoutRef = (0, _react.useRef)(null);
|
|
18
|
+
var debouncedCallback = (0, _react.useCallback)(function () {
|
|
19
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
args[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
// Clear the previous timeout if it exists
|
|
23
|
+
if (timeoutRef.current) {
|
|
24
|
+
clearTimeout(timeoutRef.current);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Set a new timeout
|
|
28
|
+
timeoutRef.current = setTimeout(function () {
|
|
29
|
+
callback.apply(void 0, args);
|
|
30
|
+
timeoutRef.current = null;
|
|
31
|
+
}, delay);
|
|
32
|
+
}, [callback, delay]);
|
|
33
|
+
|
|
34
|
+
// Add cancel method to the debounced function
|
|
35
|
+
var cancel = (0, _react.useCallback)(function () {
|
|
36
|
+
if (timeoutRef.current) {
|
|
37
|
+
clearTimeout(timeoutRef.current);
|
|
38
|
+
timeoutRef.current = null;
|
|
39
|
+
}
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
// Attach cancel method to the debounced function
|
|
43
|
+
debouncedCallback.cancel = cancel;
|
|
44
|
+
return debouncedCallback;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A simpler debounce utility function that can be used outside of React components
|
|
49
|
+
*
|
|
50
|
+
* @param func - The function to debounce
|
|
51
|
+
* @param delay - The delay in milliseconds
|
|
52
|
+
* @returns A debounced version of the function with a cancel method
|
|
53
|
+
*/
|
|
54
|
+
var debounce = exports.debounce = function debounce(func, delay) {
|
|
55
|
+
var timeoutId = null;
|
|
56
|
+
var debouncedFunction = function debouncedFunction() {
|
|
57
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
58
|
+
args[_key2] = arguments[_key2];
|
|
59
|
+
}
|
|
60
|
+
if (timeoutId) {
|
|
61
|
+
clearTimeout(timeoutId);
|
|
62
|
+
}
|
|
63
|
+
timeoutId = setTimeout(function () {
|
|
64
|
+
func.apply(void 0, args);
|
|
65
|
+
timeoutId = null;
|
|
66
|
+
}, delay);
|
|
67
|
+
};
|
|
68
|
+
var cancel = function cancel() {
|
|
69
|
+
if (timeoutId) {
|
|
70
|
+
clearTimeout(timeoutId);
|
|
71
|
+
timeoutId = null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
debouncedFunction.cancel = cancel;
|
|
75
|
+
return debouncedFunction;
|
|
76
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useDeviceVisibility = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var useDeviceVisibility = exports.useDeviceVisibility = function useDeviceVisibility(devices) {
|
|
10
|
+
var _useState = (0, _react.useState)(typeof window !== "undefined" ? window.innerWidth : undefined),
|
|
11
|
+
windowSize = _useState[0],
|
|
12
|
+
setWindowSize = _useState[1];
|
|
13
|
+
var checkIsHidden = function checkIsHidden() {
|
|
14
|
+
if (!windowSize) return false;
|
|
15
|
+
if (!devices || devices.length === 0 || devices.includes("all")) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (windowSize <= 767) {
|
|
19
|
+
// Mobile
|
|
20
|
+
return !devices.includes("xs");
|
|
21
|
+
}
|
|
22
|
+
if (windowSize >= 768 && windowSize <= 991) {
|
|
23
|
+
// Tablet
|
|
24
|
+
return !devices.includes("sm");
|
|
25
|
+
}
|
|
26
|
+
if (windowSize >= 992 && windowSize <= 1199) {
|
|
27
|
+
// Small Desktop
|
|
28
|
+
return !devices.includes("md");
|
|
29
|
+
}
|
|
30
|
+
if (windowSize >= 1200) {
|
|
31
|
+
// Large Desktop
|
|
32
|
+
return !devices.includes("lg");
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
(0, _react.useEffect)(function () {
|
|
37
|
+
var handleResize = function handleResize() {
|
|
38
|
+
setWindowSize(window.innerWidth);
|
|
39
|
+
};
|
|
40
|
+
window.addEventListener("resize", handleResize);
|
|
41
|
+
return function () {
|
|
42
|
+
return window.removeEventListener("resize", handleResize);
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
return {
|
|
46
|
+
isHidden: checkIsHidden(),
|
|
47
|
+
windowSize: windowSize
|
|
48
|
+
};
|
|
49
|
+
};
|
package/hooks/useHttp.js
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useHttp = exports.httpService = exports["default"] = exports.HttpProvider = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _axios = _interopRequireWildcard(require("axios"));
|
|
16
|
+
var _constants = require("@wavemaker/react-runtime/variables/constants");
|
|
17
|
+
var _store = require("../store");
|
|
18
|
+
var _authSlice = require("../store/slices/authSlice");
|
|
19
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
20
|
+
var __jsx = _react["default"].createElement;
|
|
21
|
+
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; }
|
|
22
|
+
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; } // @ts-ignore
|
|
23
|
+
// Types
|
|
24
|
+
// Create the HTTP service class implementing HttpClientService
|
|
25
|
+
var ModernHttpService = /*#__PURE__*/function () {
|
|
26
|
+
function ModernHttpService() {
|
|
27
|
+
var baseURL = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
28
|
+
(0, _classCallCheck2["default"])(this, ModernHttpService);
|
|
29
|
+
(0, _defineProperty2["default"])(this, "axiosInstance", void 0);
|
|
30
|
+
this.axiosInstance = _axios["default"].create({
|
|
31
|
+
baseURL: baseURL
|
|
32
|
+
});
|
|
33
|
+
this.setupInterceptors();
|
|
34
|
+
}
|
|
35
|
+
(0, _createClass2["default"])(ModernHttpService, [{
|
|
36
|
+
key: "setupInterceptors",
|
|
37
|
+
value: function setupInterceptors() {
|
|
38
|
+
this.axiosInstance.interceptors.request.use(function (config) {
|
|
39
|
+
var _state$info, _config$withCredentia, _config$url;
|
|
40
|
+
// Create new headers instance
|
|
41
|
+
var state = _store.store.getState();
|
|
42
|
+
var token = state.auth.token;
|
|
43
|
+
var baseUrl = ((_state$info = state.info) === null || _state$info === void 0 || (_state$info = _state$info.appConfig) === null || _state$info === void 0 ? void 0 : _state$info.url) || "";
|
|
44
|
+
var headers = new _axios.AxiosHeaders(config.headers);
|
|
45
|
+
// Check if this is a file download operation
|
|
46
|
+
var wmVariable = config.__wmVariable;
|
|
47
|
+
var isFileDownload = (wmVariable === null || wmVariable === void 0 ? void 0 : wmVariable.operation) === "getDownloadFile";
|
|
48
|
+
|
|
49
|
+
// Only set Accept header for non-download operations
|
|
50
|
+
if (!isFileDownload) {
|
|
51
|
+
headers.set("Accept", "application/json");
|
|
52
|
+
}
|
|
53
|
+
config.headers = headers;
|
|
54
|
+
config.withCredentials = (_config$withCredentia = config.withCredentials) !== null && _config$withCredentia !== void 0 ? _config$withCredentia : true;
|
|
55
|
+
if ((_config$url = config.url) !== null && _config$url !== void 0 && _config$url.startsWith(baseUrl) && token) {
|
|
56
|
+
if (config.headers) config.headers[_authSlice.XSRF_HEADER_NAME] = token;
|
|
57
|
+
}
|
|
58
|
+
return config;
|
|
59
|
+
}, function (error) {
|
|
60
|
+
return Promise.reject(error);
|
|
61
|
+
});
|
|
62
|
+
this.axiosInstance.interceptors.response.use(function (response) {
|
|
63
|
+
return _objectSpread(_objectSpread({}, response), {}, {
|
|
64
|
+
body: response.data,
|
|
65
|
+
type: 4 // mimic Angular's HttpEventType.Response
|
|
66
|
+
});
|
|
67
|
+
}, /*#__PURE__*/function () {
|
|
68
|
+
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(error) {
|
|
69
|
+
var _error$response;
|
|
70
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
71
|
+
while (1) switch (_context.prev = _context.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 401) {}
|
|
74
|
+
throw error.response || error;
|
|
75
|
+
case 2:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context.stop();
|
|
78
|
+
}
|
|
79
|
+
}, _callee);
|
|
80
|
+
}));
|
|
81
|
+
return function (_x) {
|
|
82
|
+
return _ref.apply(this, arguments);
|
|
83
|
+
};
|
|
84
|
+
}());
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "send",
|
|
88
|
+
value: function () {
|
|
89
|
+
var _send = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(options, variable) {
|
|
90
|
+
var serviceInfo, headers, requestBody, url, _options$url$replace, methodType, isNonDataMethod, axiosConfig, response;
|
|
91
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
92
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
serviceInfo = variable.serviceInfo;
|
|
95
|
+
headers = new _axios.AxiosHeaders(options.headers);
|
|
96
|
+
requestBody = options.data;
|
|
97
|
+
url = options.url;
|
|
98
|
+
variable.cancelTokenSource = _axios["default"].CancelToken.source();
|
|
99
|
+
if (variable.category === "wm.LiveVariable" && !(url.startsWith("http://") || url.startsWith("https://"))) {
|
|
100
|
+
url = variable.config.baseUrl + options.url.replace("./", "/");
|
|
101
|
+
} else if (options.isExtURL && options.url.startsWith("http")) {
|
|
102
|
+
url = options.url;
|
|
103
|
+
} else {
|
|
104
|
+
url = variable.config.baseUrl + ((_options$url$replace = options.url.replace("./services", "")) === null || _options$url$replace === void 0 ? void 0 : _options$url$replace.replace("./", "/"));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Ensure all requests are marked as XMLHttpRequest if not a direct call
|
|
108
|
+
if (!options.isDirectCall) {
|
|
109
|
+
headers = headers.set("X-Requested-With", "XMLHttpRequest");
|
|
110
|
+
}
|
|
111
|
+
methodType = ((serviceInfo === null || serviceInfo === void 0 ? void 0 : serviceInfo.methodType) || options.method || "get").toLowerCase();
|
|
112
|
+
isNonDataMethod = _constants.WS_CONSTANTS.NON_DATA_AXIOS_METHODS.indexOf(methodType.toUpperCase()) > -1;
|
|
113
|
+
axiosConfig = _objectSpread(_objectSpread({
|
|
114
|
+
url: url.endsWith("/") ? url.slice(0, -1) : url,
|
|
115
|
+
method: methodType,
|
|
116
|
+
headers: headers,
|
|
117
|
+
cancelToken: variable.cancelTokenSource.token,
|
|
118
|
+
withCredentials: (options === null || options === void 0 ? void 0 : options.withCredentials) !== false
|
|
119
|
+
}, isNonDataMethod ? {} : {
|
|
120
|
+
data: requestBody || {}
|
|
121
|
+
}), {}, {
|
|
122
|
+
__wmVariable: {
|
|
123
|
+
name: variable.name,
|
|
124
|
+
owner: variable.config._context.name,
|
|
125
|
+
operation: variable.operation // Add operation to the context
|
|
126
|
+
}
|
|
127
|
+
}); // Set responseType for file download operations to prevent XML parsing errors
|
|
128
|
+
if (variable.operation === "getDownloadFile" || (serviceInfo === null || serviceInfo === void 0 ? void 0 : serviceInfo.operationId) === "FileController_getDownloadFile") {
|
|
129
|
+
axiosConfig.responseType = "blob";
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Add progress tracking if provided
|
|
133
|
+
if (options !== null && options !== void 0 && options.onUploadProgress) {
|
|
134
|
+
axiosConfig.onUploadProgress = options.onUploadProgress;
|
|
135
|
+
}
|
|
136
|
+
_context2.prev = 12;
|
|
137
|
+
_context2.next = 15;
|
|
138
|
+
return this.axiosInstance.request(axiosConfig);
|
|
139
|
+
case 15:
|
|
140
|
+
response = _context2.sent;
|
|
141
|
+
if (!(variable.operation === "getDownloadFile" || (serviceInfo === null || serviceInfo === void 0 ? void 0 : serviceInfo.operationId) === "FileController_getDownloadFile")) {
|
|
142
|
+
_context2.next = 18;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
return _context2.abrupt("return", this.handleFileDownload(response, options, variable));
|
|
146
|
+
case 18:
|
|
147
|
+
return _context2.abrupt("return", response);
|
|
148
|
+
case 21:
|
|
149
|
+
_context2.prev = 21;
|
|
150
|
+
_context2.t0 = _context2["catch"](12);
|
|
151
|
+
throw _context2.t0.response || _context2.t0;
|
|
152
|
+
case 24:
|
|
153
|
+
case "end":
|
|
154
|
+
return _context2.stop();
|
|
155
|
+
}
|
|
156
|
+
}, _callee2, this, [[12, 21]]);
|
|
157
|
+
}));
|
|
158
|
+
function send(_x2, _x3) {
|
|
159
|
+
return _send.apply(this, arguments);
|
|
160
|
+
}
|
|
161
|
+
return send;
|
|
162
|
+
}()
|
|
163
|
+
}, {
|
|
164
|
+
key: "sendCall",
|
|
165
|
+
value: function () {
|
|
166
|
+
var _sendCall = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(requestParams, variable) {
|
|
167
|
+
var response;
|
|
168
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
169
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
170
|
+
case 0:
|
|
171
|
+
_context3.prev = 0;
|
|
172
|
+
_context3.next = 3;
|
|
173
|
+
return this.send(requestParams, variable);
|
|
174
|
+
case 3:
|
|
175
|
+
response = _context3.sent;
|
|
176
|
+
return _context3.abrupt("return", response);
|
|
177
|
+
case 7:
|
|
178
|
+
_context3.prev = 7;
|
|
179
|
+
_context3.t0 = _context3["catch"](0);
|
|
180
|
+
throw _context3.t0;
|
|
181
|
+
case 10:
|
|
182
|
+
case "end":
|
|
183
|
+
return _context3.stop();
|
|
184
|
+
}
|
|
185
|
+
}, _callee3, this, [[0, 7]]);
|
|
186
|
+
}));
|
|
187
|
+
function sendCall(_x4, _x5) {
|
|
188
|
+
return _sendCall.apply(this, arguments);
|
|
189
|
+
}
|
|
190
|
+
return sendCall;
|
|
191
|
+
}()
|
|
192
|
+
}, {
|
|
193
|
+
key: "getLocale",
|
|
194
|
+
value: function getLocale() {
|
|
195
|
+
return "appLocale";
|
|
196
|
+
}
|
|
197
|
+
}, {
|
|
198
|
+
key: "cancel",
|
|
199
|
+
value: function cancel(variable) {
|
|
200
|
+
if (variable.cancelTokenSource) {
|
|
201
|
+
variable.cancelTokenSource.cancel("Operation cancelled by user");
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Handle file download operations with proper filename extraction and blob processing
|
|
207
|
+
* @param response - Axios response object
|
|
208
|
+
* @param options - Request options
|
|
209
|
+
* @param variable - Variable configuration
|
|
210
|
+
* @returns Modified response object with download success information
|
|
211
|
+
*/
|
|
212
|
+
}, {
|
|
213
|
+
key: "handleFileDownload",
|
|
214
|
+
value: function handleFileDownload(response, options, variable) {
|
|
215
|
+
var filename = "download";
|
|
216
|
+
var contentDisposition = response.headers["content-disposition"];
|
|
217
|
+
if (contentDisposition) {
|
|
218
|
+
// Simple extraction: look for filename= followed by the value
|
|
219
|
+
var filenameMatch = contentDisposition.match(/filename[*]?=['"]?([^'";]+)/);
|
|
220
|
+
if (filenameMatch && filenameMatch[1]) {
|
|
221
|
+
filename = filenameMatch[1].trim();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Fallback to URL parameter or variable name
|
|
226
|
+
if (!filename || filename === "download") {
|
|
227
|
+
if (options.url && options.url.includes("file=")) {
|
|
228
|
+
var urlParams = new URLSearchParams(options.url.split("?")[1]);
|
|
229
|
+
filename = urlParams.get("file") || variable.name || "download";
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Create blob URL and trigger download
|
|
234
|
+
var blob = response.data; // This should be a blob due to responseType: "blob"
|
|
235
|
+
var url = URL.createObjectURL(blob);
|
|
236
|
+
var downloadLink = document.createElement("a");
|
|
237
|
+
downloadLink.href = url;
|
|
238
|
+
downloadLink.download = filename;
|
|
239
|
+
downloadLink.click();
|
|
240
|
+
|
|
241
|
+
// Clean up the blob URL
|
|
242
|
+
URL.revokeObjectURL(url);
|
|
243
|
+
|
|
244
|
+
// Return success response for the variable
|
|
245
|
+
return _objectSpread(_objectSpread({}, response), {}, {
|
|
246
|
+
data: {
|
|
247
|
+
success: true,
|
|
248
|
+
filename: filename,
|
|
249
|
+
downloaded: true
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}, {
|
|
254
|
+
key: "uploadFile",
|
|
255
|
+
value: function () {
|
|
256
|
+
var _uploadFile = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(url, data, variable, options) {
|
|
257
|
+
var _this = this;
|
|
258
|
+
var requestParams;
|
|
259
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
260
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
261
|
+
case 0:
|
|
262
|
+
_context4.prev = 0;
|
|
263
|
+
requestParams = {
|
|
264
|
+
url: url,
|
|
265
|
+
data: data,
|
|
266
|
+
// Send individual file
|
|
267
|
+
method: "POST",
|
|
268
|
+
headers: new _axios.AxiosHeaders({
|
|
269
|
+
"Content-Type": "multipart/form-data"
|
|
270
|
+
}),
|
|
271
|
+
onUploadProgress: function onUploadProgress(progressEvent) {
|
|
272
|
+
if (progressEvent.total) {
|
|
273
|
+
var progress = Math.round(progressEvent.loaded * 100 / progressEvent.total);
|
|
274
|
+
options.notify(progress);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
return _context4.abrupt("return", new Promise(function (resolve, reject) {
|
|
279
|
+
variable.request = _this.send(requestParams, variable).then(function (event) {
|
|
280
|
+
resolve(event.data);
|
|
281
|
+
})["catch"](function (error) {
|
|
282
|
+
reject(error);
|
|
283
|
+
});
|
|
284
|
+
}));
|
|
285
|
+
case 5:
|
|
286
|
+
_context4.prev = 5;
|
|
287
|
+
_context4.t0 = _context4["catch"](0);
|
|
288
|
+
console.error("Unexpected error in uploadFile:", _context4.t0);
|
|
289
|
+
throw _context4.t0;
|
|
290
|
+
case 9:
|
|
291
|
+
case "end":
|
|
292
|
+
return _context4.stop();
|
|
293
|
+
}
|
|
294
|
+
}, _callee4, null, [[0, 5]]);
|
|
295
|
+
}));
|
|
296
|
+
function uploadFile(_x6, _x7, _x8, _x9) {
|
|
297
|
+
return _uploadFile.apply(this, arguments);
|
|
298
|
+
}
|
|
299
|
+
return uploadFile;
|
|
300
|
+
}()
|
|
301
|
+
}]);
|
|
302
|
+
return ModernHttpService;
|
|
303
|
+
}(); // Create Context
|
|
304
|
+
var HttpContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
305
|
+
|
|
306
|
+
// Provider Component
|
|
307
|
+
var HttpProvider = exports.HttpProvider = function HttpProvider(_ref2) {
|
|
308
|
+
var children = _ref2.children,
|
|
309
|
+
_ref2$baseURL = _ref2.baseURL,
|
|
310
|
+
baseURL = _ref2$baseURL === void 0 ? "" : _ref2$baseURL;
|
|
311
|
+
var httpService = (0, _react.useRef)(new ModernHttpService(baseURL));
|
|
312
|
+
var contextValue = (0, _react.useMemo)(function () {
|
|
313
|
+
return _objectSpread(_objectSpread({}, httpService.current), {}, {
|
|
314
|
+
axiosInstance: httpService.current["axiosInstance"],
|
|
315
|
+
send: httpService.current.send.bind(httpService.current),
|
|
316
|
+
sendCall: httpService.current.sendCall.bind(httpService.current),
|
|
317
|
+
cancel: httpService.current.cancel.bind(httpService.current),
|
|
318
|
+
uploadFile: httpService.current.uploadFile.bind(httpService.current),
|
|
319
|
+
getLocale: httpService.current.getLocale.bind(httpService.current)
|
|
320
|
+
});
|
|
321
|
+
}, []);
|
|
322
|
+
return __jsx(HttpContext.Provider, {
|
|
323
|
+
value: contextValue
|
|
324
|
+
}, children);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// Hook
|
|
328
|
+
var useHttp = exports.useHttp = function useHttp() {
|
|
329
|
+
var context = (0, _react.useContext)(HttpContext);
|
|
330
|
+
if (!context) {
|
|
331
|
+
throw new Error("useHttp must be used within an HttpProvider");
|
|
332
|
+
}
|
|
333
|
+
return context;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// Export singleton instance for direct usage
|
|
337
|
+
var httpService = exports.httpService = new ModernHttpService();
|
|
338
|
+
var _default = exports["default"] = httpService;
|
package/libs/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "QRCode", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _qrcodejs["default"];
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "Utils", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function get() {
|
|
16
|
+
return _utils.Utils;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _utils = require("@wavemaker/react-runtime/core/util/utils");
|
|
20
|
+
var _qrcodejs = _interopRequireDefault(require("qrcodejs2"));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.WmThemeProvider = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _theme = _interopRequireDefault(require("@wavemaker/react-runtime/mui-config/theme"));
|
|
11
|
+
var __jsx = _react["default"].createElement;
|
|
12
|
+
var WmThemeProvider = exports.WmThemeProvider = function WmThemeProvider(_ref) {
|
|
13
|
+
var children = _ref.children;
|
|
14
|
+
return __jsx(_material.ThemeProvider, {
|
|
15
|
+
theme: _theme["default"]
|
|
16
|
+
}, __jsx(_material.CssBaseline, null), " ", children);
|
|
17
|
+
};
|