@wavemaker/react-runtime 11.14.2-1.245 → 12.0.0-next.28533
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 +5 -7
- package/actions/login-action.js +7 -8
- package/actions/logout-action.js +5 -7
- package/actions/navigation-action.js +32 -10
- package/actions/notification-action.js +22 -8
- package/actions/timer-action.js +13 -15
- package/actions/toast.js +4 -2
- package/actions/toast.service.js +1 -2
- package/components/advanced/carousel/index.js +1 -1
- package/components/advanced/carousel/template.js +1 -1
- package/components/basic/anchor/index.js +26 -9
- package/components/basic/html/index.js +115 -24
- package/components/basic/icon/index.js +2 -1
- package/components/basic/iframe/index.js +2 -1
- package/components/basic/label/index.js +12 -9
- package/components/basic/message/index.js +12 -3
- package/components/basic/picture/index.js +11 -4
- package/components/basic/progress-bar/index.js +1 -1
- package/components/basic/progress-circle/index.js +34 -28
- package/components/basic/progress-circle/props.js +10 -2
- package/components/basic/richtexteditor/index.js +95 -94
- package/components/basic/search/index.js +401 -156
- package/components/basic/search/providers.js +126 -61
- package/components/basic/spinner/index.js +2 -1
- package/components/basic/tree/index.js +34 -34
- package/components/basic/tree/utils.js +10 -4
- package/components/chart/components/barColumnChart/index.js +36 -33
- package/components/chart/components/bubbleChart/index.js +35 -25
- package/components/chart/components/chartLegend/utils.js +2 -1
- package/components/chart/components/cumulativeLineChart/index.js +30 -26
- package/components/chart/components/lineAreaChart/index.js +50 -32
- package/components/chart/components/pieDonutChart/index.js +13 -4
- package/components/chart/hooks/useXAxisConfig.js +15 -8
- package/components/chart/index.js +223 -53
- package/components/chart/utils.js +12 -1
- package/components/constants.js +5 -2
- package/components/container/accordion/accordion-pane/index.js +17 -12
- package/components/container/accordion/index.js +9 -4
- package/components/container/alignment-utils.js +56 -1
- package/components/container/index.js +49 -20
- package/components/container/panel/components/panel-header/index.js +3 -4
- package/components/container/panel/index.js +15 -10
- package/components/container/tabs/index.js +92 -14
- package/components/container/tabs/tab-pane/index.js +15 -8
- package/components/container/tabs/utils.js +51 -0
- package/components/container/wizard/components/StepComponents.js +2 -1
- package/components/container/wizard/components/WizardStep.js +2 -1
- package/components/container/wizard/index.js +64 -35
- package/components/container/wizard/utils.js +46 -1
- package/components/container/wizard/wizard-step/index.js +11 -1
- package/components/data/card/card-content/index.js +1 -1
- package/components/data/form/base-form/index.js +991 -180
- package/components/data/form/base-form/props.js +3 -1
- package/components/data/form/base-form/utils.js +159 -1
- package/components/data/form/dynamic-fields/constant.js +53 -0
- package/components/data/form/dynamic-fields/index.js +10 -45
- package/components/data/form/dynamic-fields/utils.js +37 -2
- package/components/data/form/form-action/index.js +5 -4
- package/components/data/form/form-context.js +5 -1
- package/components/data/form/form-controller/utils.js +84 -0
- package/components/data/form/form-controller/validation-contrustor.js +402 -189
- package/components/data/form/form-controller/withFormController.js +191 -52
- package/components/data/form/form-field/base-field.js +54 -33
- package/components/data/form/form-field/index.js +28 -5
- package/components/data/form/form-header/index.js +3 -4
- package/components/data/form/index.js +20 -1
- package/components/data/list/components/ListDND.js +2 -1
- package/components/data/list/components/ListItem.js +6 -2
- package/components/data/list/components/ListItemWithTemplate.js +46 -2
- package/components/data/list/components/ListItems.js +17 -26
- package/components/data/list/components/ListPagination.js +3 -3
- package/components/data/list/components/StandardListItems.js +3 -4
- package/components/data/list/hooks/useListEffects.js +55 -14
- package/components/data/list/hooks/useListEventHandlers.js +3 -1
- package/components/data/list/hooks/useListState.js +3 -1
- package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
- package/components/data/list/index.js +74 -55
- package/components/data/list/utils/list-helpers.js +73 -35
- package/components/data/list/utils/list-widget-methods.js +138 -95
- package/components/data/live-filter/index.js +26 -15
- package/components/data/live-form/index.js +23 -7
- package/components/data/live-form/props.js +1 -1
- package/components/data/pagination/components/BasicPagination.js +71 -16
- package/components/data/pagination/components/PageSizeSelector.js +8 -3
- package/components/data/pagination/components/TotalRecords.js +1 -5
- package/components/data/pagination/hooks/usePagination.js +349 -66
- package/components/data/pagination/index.js +137 -19
- package/components/data/table/components/AddNewRow.js +5 -1
- package/components/data/table/components/EditableCell.js +2 -2
- package/components/data/table/components/RowCells.js +64 -0
- package/components/data/table/components/RowExpansionButton.js +2 -2
- package/components/data/table/components/SummaryCell.js +111 -0
- package/components/data/table/components/SummaryRow.js +54 -0
- package/components/data/table/components/SummaryRowFooter.js +46 -0
- package/components/data/table/components/TableBody.js +61 -59
- package/components/data/table/components/TableDataRow.js +109 -0
- package/components/data/table/components/TableFilters.js +225 -121
- package/components/data/table/components/TableHeader.js +291 -23
- package/components/data/table/components/TablePanelHeading.js +139 -8
- package/components/data/table/components/index.js +22 -1
- package/components/data/table/hooks/use-edited-rows.js +141 -0
- package/components/data/table/hooks/useCellState.js +5 -12
- package/components/data/table/hooks/useFormWidget.js +58 -51
- package/components/data/table/hooks/usePaginationState.js +45 -24
- package/components/data/table/hooks/usePanelStructure.js +4 -4
- package/components/data/table/hooks/useRowHandlers.js +39 -5
- package/components/data/table/hooks/useRowSelection.js +244 -50
- package/components/data/table/hooks/useServerSideSorting.js +81 -37
- package/components/data/table/hooks/useTableColumns.js +211 -118
- package/components/data/table/hooks/useTableData.js +54 -9
- package/components/data/table/hooks/useTableEdit.js +272 -97
- package/components/data/table/hooks/useTableEffects.js +31 -13
- package/components/data/table/hooks/useTableFilter.js +1 -1
- package/components/data/table/hooks/useTableInitialization.js +23 -22
- package/components/data/table/hooks/useTableState.js +11 -5
- package/components/data/table/hooks/useTableStateManager.js +140 -65
- package/components/data/table/index.js +637 -274
- package/components/data/table/live-table/index.js +54 -22
- package/components/data/table/table-action/index.js +1 -1
- package/components/data/table/table-group/index.js +26 -0
- package/components/data/table/table-row-action/index.js +32 -18
- package/components/data/table/utils/buildSelectionColumns.js +12 -21
- package/components/data/table/utils/columnBuilder.js +29 -14
- package/components/data/table/utils/columnProxy.js +68 -1
- package/components/data/table/utils/constants.js +6 -2
- package/components/data/table/utils/crud-handlers.js +68 -63
- package/components/data/table/utils/groupHeaderUtils.js +102 -0
- package/components/data/table/utils/index.js +210 -21
- package/components/data/table/utils/renderDisplayCell.js +6 -6
- package/components/data/table/utils/selectionUtils.js +25 -26
- package/components/data/table/utils/validation.js +1 -0
- package/components/data/utils/filter-field-util.js +3 -3
- package/components/dialogs/alert-dialog/index.js +1 -1
- package/components/dialogs/confirm-dialog/index.js +1 -1
- package/components/dialogs/dialog/index.js +4 -1
- package/components/dialogs/dialog-content/index.js +3 -1
- package/components/dialogs/dialog-header/index.js +2 -2
- package/components/dialogs/iframe-dialog/index.js +11 -5
- package/components/dialogs/index.js +1 -1
- package/components/dialogs/login-dialog/index.js +1 -1
- package/components/dialogs/page-dialog/index.js +1 -1
- package/components/form/button/index.js +33 -7
- package/components/input/calendar/index.js +18 -6
- package/components/input/chips/index.js +99 -28
- package/components/input/chips/utils.js +34 -4
- package/components/input/color-picker/index.js +74 -25
- package/components/input/composite/index.js +3 -3
- package/components/input/currency/index.js +35 -49
- package/components/input/default/checkbox/index.js +23 -28
- package/components/input/default/checkboxset/index.js +38 -18
- package/components/input/default/checkboxset/utils.js +30 -0
- package/components/input/default/radioset/index.js +36 -39
- package/components/input/default/switch/index.js +30 -13
- package/components/input/epoch/date/index.js +130 -69
- package/components/input/epoch/date/utils.js +94 -1
- package/components/input/epoch/datetime/index.js +72 -22
- package/components/input/epoch/datetime/utils.js +49 -10
- package/components/input/epoch/time/index.js +68 -19
- package/components/input/epoch/time/utils.js +62 -14
- package/components/input/fileupload/Utils.js +12 -7
- package/components/input/fileupload/components/MultiUpload.js +2 -6
- package/components/input/fileupload/components/SingleUpload.js +3 -7
- package/components/input/fileupload/index.js +6 -10
- package/components/input/fileupload/useFileUpload.js +16 -5
- package/components/input/number/index.js +158 -43
- package/components/input/rating/index.js +90 -7
- package/components/input/select/index.js +147 -70
- package/components/input/slider/index.js +84 -26
- package/components/input/text/index.js +38 -18
- package/components/input/text/util.js +283 -130
- package/components/input/textarea/index.js +13 -10
- package/components/input/upload/index.js +124 -0
- package/components/input/upload/props.js +5 -0
- package/components/input/util/index.js +11 -0
- package/components/navbar/index.js +51 -3
- package/components/navbar/nav/index.js +46 -16
- package/components/navbar/nav-item/index.js +11 -5
- package/components/navigation/menu/components/ListItems.js +3 -0
- package/components/navigation/menu/constants.js +2 -1
- package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
- package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
- package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
- package/components/navigation/menu/index.js +326 -188
- package/components/navigation/menu/utils/action-task.js +14 -0
- package/components/navigation/menu/utils/role-filter.js +76 -0
- package/components/navigation/popover/index.js +99 -26
- package/components/page/partial-container/index.js +34 -5
- package/components/prefab/index.js +2 -4
- package/context/PrefabContext.js +10 -6
- package/context/WidgetProvider.js +30 -31
- package/core/app.service.js +1 -1
- package/core/constants/events.js +57 -1
- package/core/dialog.service.js +1 -2
- package/core/event-notifier.js +1 -2
- package/core/formatter/array-formatters.js +33 -0
- package/core/formatter/date-formatters.js +2 -4
- package/core/formatter/index.js +2 -1
- package/core/formatter/number-formatters.js +5 -10
- package/core/formatter/security-formatters.js +2 -4
- package/core/formatter/string-formatters.js +3 -6
- package/core/proxy-service.js +84 -13
- package/core/script-registry.js +108 -48
- package/core/util/common.js +4 -4
- package/core/util/compare.js +30 -0
- package/core/util/dom.js +8 -8
- package/core/util/index.js +16 -6
- package/core/util/safe-is-equal.js +156 -0
- package/core/util/security.js +1 -2
- package/core/util/utils.js +16 -7
- package/higherOrder/BaseApp.js +108 -65
- package/higherOrder/BaseDateTime.js +31 -13
- package/higherOrder/BasePage.js +268 -144
- package/higherOrder/BasePartial.js +1 -1
- package/higherOrder/BasePrefab.js +33 -15
- package/higherOrder/DataNav.js +99 -16
- package/higherOrder/helper.js +5 -0
- package/higherOrder/withBaseWrapper.js +41 -28
- package/hooks/useAuth.js +11 -5
- package/hooks/useHttp.js +280 -94
- package/mui-config/theme-provider.js +1 -1
- package/mui-config/theme.js +1 -1
- package/package-lock.json +711 -669
- package/package.json +8 -8
- package/store/bindActions/i18nActions.js +18 -0
- package/store/index.js +3 -1
- package/store/slices/appConfigSlice.js +2 -2
- package/store/slices/authSlice.js +31 -28
- package/store/slices/i18nSlice.js +2 -2
- package/store/slices/navigationSlice.js +35 -0
- package/store/viewport.service.js +255 -0
- package/utils/attr.js +35 -0
- package/utils/dataset-util.js +1 -2
- package/utils/form-state.util.js +43 -12
- package/utils/form-utils.js +47 -2
- package/utils/format-util.js +28 -13
- package/utils/page-params-util.js +33 -1
- package/utils/state-persistance.js +72 -13
- package/utils/transformedDataset-utils.js +35 -24
- package/variables/base-variable.js +12 -14
- package/variables/crud-variable.js +225 -0
- package/variables/live-variable.js +56 -20
- package/variables/metadata.service.js +123 -0
- package/variables/model-variable.js +21 -15
- package/variables/service-variable.js +88 -83
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/react-runtime",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0-next.28533",
|
|
4
4
|
"description": "React runtime package for Wavemaker",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"lint-staged": {
|
|
26
26
|
"*.{js,jsx,ts,tsx,json,css,scss,md}": [
|
|
27
|
-
"
|
|
27
|
+
"prettier --write"
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"lint-staged": "^16.2.0",
|
|
57
57
|
"lodash-es": "^4.17.21",
|
|
58
58
|
"moment-timezone": "^0.6.0",
|
|
59
|
-
"next": "
|
|
59
|
+
"next": "16.1.1",
|
|
60
60
|
"qrcodejs2": "^0.0.2",
|
|
61
|
-
"react": "^19.
|
|
61
|
+
"react": "^19.2.3",
|
|
62
62
|
"react-color": "^2.19.3",
|
|
63
|
-
"react-dom": "^19.
|
|
63
|
+
"react-dom": "^19.2.3",
|
|
64
64
|
"react-hook-form": "^7.58.1",
|
|
65
65
|
"react-redux": "^9.2.0",
|
|
66
66
|
"recharts": "^3.0.2"
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"@types/js-cookie": "^3.0.6",
|
|
76
76
|
"@types/lodash-es": "^4.17.12",
|
|
77
77
|
"@types/node": "^20",
|
|
78
|
-
"@types/react": "^19",
|
|
78
|
+
"@types/react": "^19.2.8",
|
|
79
79
|
"@types/react-color": "^3.0.13",
|
|
80
|
-
"@types/react-dom": "^19",
|
|
81
|
-
"@wavemaker/variables": "
|
|
80
|
+
"@types/react-dom": "^19.2.3",
|
|
81
|
+
"@wavemaker/variables": "12.0.0-next.28533",
|
|
82
82
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
83
83
|
"eslint": "^9",
|
|
84
84
|
"eslint-config-next": "15.1.4",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.i18nService = void 0;
|
|
8
|
+
var _toolkit = require("@reduxjs/toolkit");
|
|
9
|
+
var _store = require("@wavemaker/react-runtime/store");
|
|
10
|
+
var i18nActions = _interopRequireWildcard(require("../slices/i18nSlice"));
|
|
11
|
+
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); }
|
|
12
|
+
var i18nService = exports.i18nService = (0, _toolkit.bindActionCreators)({
|
|
13
|
+
setTimezone: i18nActions.setTimezone,
|
|
14
|
+
setAppLocale: i18nActions.setAppLocale,
|
|
15
|
+
setDateFormat: i18nActions.setDateFormat,
|
|
16
|
+
setTimeFormat: i18nActions.setTimeFormat,
|
|
17
|
+
setCurrencyCode: i18nActions.setCurrencyCode
|
|
18
|
+
}, _store.store.dispatch);
|
package/store/index.js
CHANGED
|
@@ -11,10 +11,12 @@ var _authSlice = _interopRequireDefault(require("@wavemaker/react-runtime/store/
|
|
|
11
11
|
var _appConfigSlice = _interopRequireDefault(require("@wavemaker/react-runtime/store/slices/appConfigSlice"));
|
|
12
12
|
var _reactRedux = require("react-redux");
|
|
13
13
|
var _i18nSlice = _interopRequireDefault(require("@wavemaker/react-runtime/store/slices/i18nSlice"));
|
|
14
|
+
var _navigationSlice = _interopRequireDefault(require("@wavemaker/react-runtime/store/slices/navigationSlice"));
|
|
14
15
|
var rootReducer = (0, _toolkit.combineReducers)({
|
|
15
16
|
auth: _authSlice["default"],
|
|
16
17
|
info: _appConfigSlice["default"],
|
|
17
|
-
i18n: _i18nSlice["default"]
|
|
18
|
+
i18n: _i18nSlice["default"],
|
|
19
|
+
navigation: _navigationSlice["default"]
|
|
18
20
|
});
|
|
19
21
|
var store = exports.store = (0, _toolkit.configureStore)({
|
|
20
22
|
reducer: rootReducer,
|
|
@@ -26,7 +26,7 @@ var getServiceDefinitions = exports.getServiceDefinitions = (0, _toolkit.createA
|
|
|
26
26
|
dispatch = _ref.dispatch, rejectWithValue = _ref.rejectWithValue;
|
|
27
27
|
_context.prev = 1;
|
|
28
28
|
_context.next = 4;
|
|
29
|
-
return _axios["default"].get("".concat(baseUrl, "/services/servicedefs"));
|
|
29
|
+
return _axios["default"].get("".concat(baseUrl !== null && baseUrl !== void 0 ? baseUrl : "", "/services/servicedefs").concat(baseUrl ? "" : ".json"));
|
|
30
30
|
case 4:
|
|
31
31
|
response = _context.sent;
|
|
32
32
|
data = (response === null || response === void 0 ? void 0 : response.data) || {};
|
|
@@ -56,7 +56,7 @@ var getPrefabDefinitions = exports.getPrefabDefinitions = (0, _toolkit.createAsy
|
|
|
56
56
|
prefabName = _ref3.prefabName, baseUrl = _ref3.baseUrl, pages = _ref3.pages;
|
|
57
57
|
dispatch = _ref4.dispatch, rejectWithValue = _ref4.rejectWithValue;
|
|
58
58
|
_context2.prev = 2;
|
|
59
|
-
url = "".concat(baseUrl, "/services/prefabs/").concat(prefabName, "/servicedefs");
|
|
59
|
+
url = "".concat(baseUrl !== null && baseUrl !== void 0 ? baseUrl : "", "/services/prefabs/").concat(prefabName, "/servicedefs").concat(baseUrl ? "" : ".json");
|
|
60
60
|
_context2.next = 6;
|
|
61
61
|
return _axios["default"].get(url);
|
|
62
62
|
case 6:
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.setToken = exports.setSecurityConfig = exports.setPageLoading = exports.setLoggedInUser = exports.setLandingPage = exports.setIsLoggedIn = exports.redirectToLogin = exports.navigateToLandingPage = exports.logout = exports.login = exports.loadSecurityInfo = exports.defaultUserState = exports["default"] = exports.clearError = exports.checkAccess = exports.canAccessPage = exports.XSRF_HEADER_NAME = exports.XSRF_COOKIE_NAME = exports.USER_ROLE = exports.SESSION = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
12
|
var _toolkit = require("@reduxjs/toolkit");
|
|
13
13
|
var _axios = _interopRequireDefault(require("axios"));
|
|
14
14
|
var _each = _interopRequireDefault(require("lodash-es/each"));
|
|
@@ -48,10 +48,24 @@ var initialState = {
|
|
|
48
48
|
landingPage: "",
|
|
49
49
|
error: null
|
|
50
50
|
};
|
|
51
|
+
var saveUserInfo = function saveUserInfo(details, dispatch) {
|
|
52
|
+
var _details$userInfo, _details$userInfo2, _details$userInfo3, _details$userInfo4, _details$userInfo5, _details$userInfo6;
|
|
53
|
+
var user = {
|
|
54
|
+
isAuthenticated: Boolean(details.authenticated),
|
|
55
|
+
isSecurityEnabled: Boolean(details.authenticated),
|
|
56
|
+
roles: Array.isArray((_details$userInfo = details.userInfo) === null || _details$userInfo === void 0 ? void 0 : _details$userInfo.userRoles) ? details.userInfo.userRoles : [],
|
|
57
|
+
name: ((_details$userInfo2 = details.userInfo) === null || _details$userInfo2 === void 0 ? void 0 : _details$userInfo2.userName) || "",
|
|
58
|
+
id: ((_details$userInfo3 = details.userInfo) === null || _details$userInfo3 === void 0 ? void 0 : _details$userInfo3.userId) || "",
|
|
59
|
+
tenantId: ((_details$userInfo4 = details.userInfo) === null || _details$userInfo4 === void 0 ? void 0 : _details$userInfo4.tenantId) || "",
|
|
60
|
+
userAttributes: (0, _typeof2["default"])((_details$userInfo5 = details.userInfo) === null || _details$userInfo5 === void 0 ? void 0 : _details$userInfo5.userAttributes) === "object" ? details.userInfo.userAttributes : {},
|
|
61
|
+
landingPage: ((_details$userInfo6 = details.userInfo) === null || _details$userInfo6 === void 0 ? void 0 : _details$userInfo6.landingPage) || ""
|
|
62
|
+
};
|
|
63
|
+
dispatch(setLoggedInUser(user));
|
|
64
|
+
};
|
|
51
65
|
var loadSecurityInfo = exports.loadSecurityInfo = (0, _toolkit.createAsyncThunk)("auth/loadSecurityInfo", /*#__PURE__*/function () {
|
|
52
66
|
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(baseURL, _ref) {
|
|
53
67
|
var _document;
|
|
54
|
-
var dispatch, rejectWithValue, pathname, cookieToken, wmXsrfToken, response, details, secConfig,
|
|
68
|
+
var dispatch, rejectWithValue, pathname, cookieToken, wmXsrfToken, response, details, secConfig, _secConfig$loginConfi, router, landingPage, loginPage, currentPageName, isOnLoginPage;
|
|
55
69
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
56
70
|
while (1) switch (_context.prev = _context.next) {
|
|
57
71
|
case 0:
|
|
@@ -76,28 +90,18 @@ var loadSecurityInfo = exports.loadSecurityInfo = (0, _toolkit.createAsyncThunk)
|
|
|
76
90
|
secConfig = details || {};
|
|
77
91
|
secConfig.isSecurityEnabled = !!(details !== null && details !== void 0 && details.securityEnabled);
|
|
78
92
|
if (!(typeof details !== "string" && (!(details !== null && details !== void 0 && details.securityEnabled) || details !== null && details !== void 0 && details.authenticated))) {
|
|
79
|
-
_context.next =
|
|
93
|
+
_context.next = 34;
|
|
80
94
|
break;
|
|
81
95
|
}
|
|
82
96
|
if (!(details !== null && details !== void 0 && details.authenticated)) {
|
|
83
|
-
_context.next =
|
|
97
|
+
_context.next = 28;
|
|
84
98
|
break;
|
|
85
99
|
}
|
|
86
100
|
router = (0, _navigationMiddleware.getRouterInstance)();
|
|
87
|
-
|
|
88
|
-
isAuthenticated: Boolean(details.authenticated),
|
|
89
|
-
isSecurityEnabled: Boolean(details.authenticated),
|
|
90
|
-
roles: Array.isArray((_details$userInfo = details.userInfo) === null || _details$userInfo === void 0 ? void 0 : _details$userInfo.userRoles) ? details.userInfo.userRoles : [],
|
|
91
|
-
name: ((_details$userInfo2 = details.userInfo) === null || _details$userInfo2 === void 0 ? void 0 : _details$userInfo2.userName) || "",
|
|
92
|
-
id: ((_details$userInfo3 = details.userInfo) === null || _details$userInfo3 === void 0 ? void 0 : _details$userInfo3.userId) || "",
|
|
93
|
-
tenantId: ((_details$userInfo4 = details.userInfo) === null || _details$userInfo4 === void 0 ? void 0 : _details$userInfo4.tenantId) || "",
|
|
94
|
-
userAttributes: (0, _typeof2["default"])((_details$userInfo5 = details.userInfo) === null || _details$userInfo5 === void 0 ? void 0 : _details$userInfo5.userAttributes) === "object" ? details.userInfo.userAttributes : {},
|
|
95
|
-
landingPage: ((_details$userInfo6 = details.userInfo) === null || _details$userInfo6 === void 0 ? void 0 : _details$userInfo6.landingPage) || ""
|
|
96
|
-
};
|
|
101
|
+
saveUserInfo(details, dispatch);
|
|
97
102
|
_context.next = 18;
|
|
98
103
|
return dispatch((0, _appConfigSlice.getServiceDefinitions)(baseURL)).unwrap();
|
|
99
104
|
case 18:
|
|
100
|
-
dispatch(setLoggedInUser(user));
|
|
101
105
|
dispatch(setIsLoggedIn(true));
|
|
102
106
|
dispatch(setLandingPage(details.userInfo.landingPage));
|
|
103
107
|
|
|
@@ -110,15 +114,16 @@ var loadSecurityInfo = exports.loadSecurityInfo = (0, _toolkit.createAsyncThunk)
|
|
|
110
114
|
if (router && landingPage && isOnLoginPage) {
|
|
111
115
|
router.push("/".concat(_constants.ROUTING_BASEPATH, "/").concat(landingPage));
|
|
112
116
|
}
|
|
113
|
-
_context.next =
|
|
117
|
+
_context.next = 30;
|
|
114
118
|
break;
|
|
115
|
-
case
|
|
116
|
-
_context.next =
|
|
119
|
+
case 28:
|
|
120
|
+
_context.next = 30;
|
|
117
121
|
return dispatch((0, _appConfigSlice.getServiceDefinitions)(baseURL)).unwrap();
|
|
118
|
-
case
|
|
122
|
+
case 30:
|
|
119
123
|
dispatch(setSecurityConfig(secConfig));
|
|
120
124
|
return _context.abrupt("return", Promise.resolve(details));
|
|
121
|
-
case
|
|
125
|
+
case 34:
|
|
126
|
+
saveUserInfo(details, dispatch);
|
|
122
127
|
_context.next = 37;
|
|
123
128
|
return dispatch((0, _appConfigSlice.getServiceDefinitions)(baseURL)).unwrap();
|
|
124
129
|
case 37:
|
|
@@ -248,24 +253,22 @@ var logout = exports.logout = (0, _toolkit.createAsyncThunk)("auth/logout", /*#_
|
|
|
248
253
|
console.error("Logout error:", _context3.t0);
|
|
249
254
|
case 15:
|
|
250
255
|
_context3.prev = 15;
|
|
256
|
+
_context3.next = 18;
|
|
257
|
+
return dispatch(loadSecurityInfo(options.baseURL)).unwrap();
|
|
258
|
+
case 18:
|
|
251
259
|
dispatch(setIsLoggedIn(false));
|
|
252
|
-
dispatch(setLoggedInUser(null));
|
|
253
260
|
dispatch(setLandingPage(""));
|
|
254
|
-
dispatch(setSecurityConfig({}));
|
|
255
261
|
|
|
256
262
|
// Clear access cache when user logs out
|
|
257
263
|
(0, _useAccess.clearAccessCache)();
|
|
258
|
-
_context3.next = 23;
|
|
259
|
-
return dispatch(redirectToLogin({})).unwrap();
|
|
260
|
-
case 23:
|
|
261
264
|
return _context3.finish(15);
|
|
262
|
-
case
|
|
265
|
+
case 22:
|
|
263
266
|
return _context3.abrupt("return", Promise.resolve(responseData));
|
|
264
|
-
case
|
|
267
|
+
case 23:
|
|
265
268
|
case "end":
|
|
266
269
|
return _context3.stop();
|
|
267
270
|
}
|
|
268
|
-
}, _callee3, null, [[2, 12, 15,
|
|
271
|
+
}, _callee3, null, [[2, 12, 15, 22]]);
|
|
269
272
|
}));
|
|
270
273
|
return function (_x5, _x6) {
|
|
271
274
|
return _ref6.apply(this, arguments);
|
|
@@ -26,7 +26,7 @@ var initialState = {
|
|
|
26
26
|
timeFormat: "h:mm:ss a",
|
|
27
27
|
dateTimeFormat: "MMM d, y h:mm:ss a",
|
|
28
28
|
currencyCode: "USD",
|
|
29
|
-
timezone: "UTC",
|
|
29
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC",
|
|
30
30
|
isLoading: false,
|
|
31
31
|
error: null,
|
|
32
32
|
prefabMessages: {}
|
|
@@ -78,7 +78,7 @@ var loadLocaleBundle = exports.loadLocaleBundle = (0, _toolkit.createAsyncThunk)
|
|
|
78
78
|
locale = localLanguage || _selectedDefaultLang || (0, _lodashEs.intersection)(_acceptLang, _supportedLang)[0] || initialState.defaultSupportedLocale;
|
|
79
79
|
_context.prev = 13;
|
|
80
80
|
url = _store.store.getState().info.appConfig.url;
|
|
81
|
-
path = "".concat(url + APP_LOCALE_ROOT_PATH, "/").concat(locale, ".json");
|
|
81
|
+
path = "".concat((url !== null && url !== void 0 ? url : "") + APP_LOCALE_ROOT_PATH, "/").concat(locale, ".json");
|
|
82
82
|
_context.next = 18;
|
|
83
83
|
return _axios["default"].get(path);
|
|
84
84
|
case 18:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setPendingTabSelection = exports.setPendingAccordionExpansion = exports["default"] = exports.clearPendingTabSelection = exports.clearPendingAccordionExpansion = void 0;
|
|
7
|
+
var _toolkit = require("@reduxjs/toolkit");
|
|
8
|
+
var initialState = {
|
|
9
|
+
pendingAccordionExpansion: null,
|
|
10
|
+
pendingTabSelection: null
|
|
11
|
+
};
|
|
12
|
+
var navigationSlice = (0, _toolkit.createSlice)({
|
|
13
|
+
name: "navigation",
|
|
14
|
+
initialState: initialState,
|
|
15
|
+
reducers: {
|
|
16
|
+
setPendingAccordionExpansion: function setPendingAccordionExpansion(state, action) {
|
|
17
|
+
state.pendingAccordionExpansion = action.payload;
|
|
18
|
+
},
|
|
19
|
+
clearPendingAccordionExpansion: function clearPendingAccordionExpansion(state) {
|
|
20
|
+
state.pendingAccordionExpansion = null;
|
|
21
|
+
},
|
|
22
|
+
setPendingTabSelection: function setPendingTabSelection(state, action) {
|
|
23
|
+
state.pendingTabSelection = action.payload;
|
|
24
|
+
},
|
|
25
|
+
clearPendingTabSelection: function clearPendingTabSelection(state) {
|
|
26
|
+
state.pendingTabSelection = null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _navigationSlice$acti = navigationSlice.actions,
|
|
31
|
+
setPendingAccordionExpansion = exports.setPendingAccordionExpansion = _navigationSlice$acti.setPendingAccordionExpansion,
|
|
32
|
+
clearPendingAccordionExpansion = exports.clearPendingAccordionExpansion = _navigationSlice$acti.clearPendingAccordionExpansion,
|
|
33
|
+
setPendingTabSelection = exports.setPendingTabSelection = _navigationSlice$acti.setPendingTabSelection,
|
|
34
|
+
clearPendingTabSelection = exports.clearPendingTabSelection = _navigationSlice$acti.clearPendingTabSelection;
|
|
35
|
+
var _default = exports["default"] = navigationSlice.reducer;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.viewportService = exports.ViewportService = exports.ViewportEvent = void 0;
|
|
9
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var _eventNotifier = _interopRequireDefault(require("../core/event-notifier"));
|
|
13
|
+
var _get = _interopRequireDefault(require("lodash-es/get"));
|
|
14
|
+
var MINIMUM_MOBILE_WIDTH = 480;
|
|
15
|
+
var MINIMUM_TAB_WIDTH = 768;
|
|
16
|
+
var MINIMUM_LARGE_SCREEN_WIDTH = 1200;
|
|
17
|
+
var SCREEN_TYPE = /*#__PURE__*/function (SCREEN_TYPE) {
|
|
18
|
+
SCREEN_TYPE[SCREEN_TYPE["MOBILE"] = 0] = "MOBILE";
|
|
19
|
+
SCREEN_TYPE[SCREEN_TYPE["TABLET"] = 1] = "TABLET";
|
|
20
|
+
SCREEN_TYPE[SCREEN_TYPE["LARGE_SCREEN_DEVICES"] = 2] = "LARGE_SCREEN_DEVICES";
|
|
21
|
+
return SCREEN_TYPE;
|
|
22
|
+
}(SCREEN_TYPE || {});
|
|
23
|
+
var ViewportEvent = exports.ViewportEvent = /*#__PURE__*/function (ViewportEvent) {
|
|
24
|
+
ViewportEvent["ORIENTATION_CHANGE"] = "orientationchange";
|
|
25
|
+
ViewportEvent["RESIZE"] = "resize";
|
|
26
|
+
return ViewportEvent;
|
|
27
|
+
}({});
|
|
28
|
+
var isAndroid = function isAndroid() {
|
|
29
|
+
if (typeof navigator === "undefined") return false;
|
|
30
|
+
return /Android/i.test(navigator.userAgent);
|
|
31
|
+
};
|
|
32
|
+
var isAndroidTablet = function isAndroidTablet() {
|
|
33
|
+
if (typeof navigator === "undefined") return false;
|
|
34
|
+
return /android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent);
|
|
35
|
+
};
|
|
36
|
+
var isIos = function isIos() {
|
|
37
|
+
if (typeof navigator === "undefined") return false;
|
|
38
|
+
return /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
39
|
+
};
|
|
40
|
+
var ViewportService = exports.ViewportService = /*#__PURE__*/function () {
|
|
41
|
+
function ViewportService() {
|
|
42
|
+
var _this = this;
|
|
43
|
+
(0, _classCallCheck2["default"])(this, ViewportService);
|
|
44
|
+
(0, _defineProperty2["default"])(this, "orientation", {
|
|
45
|
+
isPortrait: false,
|
|
46
|
+
isLandscape: false
|
|
47
|
+
});
|
|
48
|
+
(0, _defineProperty2["default"])(this, "isMobileType", false);
|
|
49
|
+
(0, _defineProperty2["default"])(this, "isTabletType", false);
|
|
50
|
+
(0, _defineProperty2["default"])(this, "type", void 0);
|
|
51
|
+
(0, _defineProperty2["default"])(this, "_eventNotifier", new _eventNotifier["default"]());
|
|
52
|
+
(0, _defineProperty2["default"])(this, "screenWidth", 0);
|
|
53
|
+
(0, _defineProperty2["default"])(this, "screenHeight", 0);
|
|
54
|
+
(0, _defineProperty2["default"])(this, "selectedViewPort", void 0);
|
|
55
|
+
(0, _defineProperty2["default"])(this, "boundResizeFn", null);
|
|
56
|
+
if (typeof window === "undefined") return;
|
|
57
|
+
this.setScreenType();
|
|
58
|
+
this.boundResizeFn = this.resizeFn.bind(this);
|
|
59
|
+
window.addEventListener(ViewportEvent.RESIZE, this.boundResizeFn);
|
|
60
|
+
var query = window.matchMedia("(orientation: portrait)");
|
|
61
|
+
if (query.matches) {
|
|
62
|
+
this.orientation.isPortrait = true;
|
|
63
|
+
} else {
|
|
64
|
+
this.orientation.isLandscape = true;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Add a media query change listener
|
|
68
|
+
// addEventListener is not supported ios browser
|
|
69
|
+
if (query.addEventListener) {
|
|
70
|
+
query.addEventListener("change", function ($event) {
|
|
71
|
+
return _this.orientationChange($event, !$event.matches);
|
|
72
|
+
});
|
|
73
|
+
} else if (query.addListener) {
|
|
74
|
+
query.addListener(function ($event) {
|
|
75
|
+
return _this.orientationChange($event, !$event.matches);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return (0, _createClass2["default"])(ViewportService, [{
|
|
80
|
+
key: "update",
|
|
81
|
+
value: function update(selectedViewPort) {
|
|
82
|
+
this.selectedViewPort = selectedViewPort;
|
|
83
|
+
this.setScreenType();
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
key: "orientationChange",
|
|
87
|
+
value: function orientationChange($event, isLandscape) {
|
|
88
|
+
if (isLandscape !== this.orientation.isLandscape) {
|
|
89
|
+
this.orientation.isPortrait = !isLandscape;
|
|
90
|
+
this.orientation.isLandscape = isLandscape;
|
|
91
|
+
this.notify(ViewportEvent.ORIENTATION_CHANGE, {
|
|
92
|
+
$event: $event,
|
|
93
|
+
data: {
|
|
94
|
+
isPortrait: !isLandscape,
|
|
95
|
+
isLandscape: isLandscape
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "resizeFn",
|
|
102
|
+
value: function resizeFn($event) {
|
|
103
|
+
var $el = document.querySelector(".wm-app");
|
|
104
|
+
if (!$el) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this.setScreenType();
|
|
108
|
+
this.orientationChange($event, this.screenWidth >= this.screenHeight);
|
|
109
|
+
this.notify(ViewportEvent.RESIZE, {
|
|
110
|
+
$event: $event,
|
|
111
|
+
data: {
|
|
112
|
+
screenWidth: this.screenWidth,
|
|
113
|
+
screenHeight: this.screenHeight
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "subscribe",
|
|
119
|
+
value: function subscribe(eventName, callback) {
|
|
120
|
+
return this._eventNotifier.subscribe(eventName, callback);
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "notify",
|
|
124
|
+
value: function notify(eventName) {
|
|
125
|
+
for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
126
|
+
data[_key - 1] = arguments[_key];
|
|
127
|
+
}
|
|
128
|
+
this._eventNotifier.notify(eventName, data);
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
key: "setScreenType",
|
|
132
|
+
value: function setScreenType() {
|
|
133
|
+
if (typeof window === "undefined") {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
var $el = document.querySelector(".wm-app");
|
|
137
|
+
if (!$el) return;
|
|
138
|
+
this.screenWidth = $el.clientWidth;
|
|
139
|
+
this.screenHeight = $el.clientHeight;
|
|
140
|
+
this.isTabletType = false;
|
|
141
|
+
this.isMobileType = false;
|
|
142
|
+
if ((0, _get["default"])(this.selectedViewPort, "deviceCategory")) {
|
|
143
|
+
var deviceCategory = this.selectedViewPort.deviceCategory;
|
|
144
|
+
if (deviceCategory === "Tab") {
|
|
145
|
+
this.isTabletType = true;
|
|
146
|
+
} else if (deviceCategory === "Smartphone") {
|
|
147
|
+
this.isMobileType = true;
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
MINIMUM_MOBILE_WIDTH = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--screen-xs")) || 480;
|
|
151
|
+
MINIMUM_TAB_WIDTH = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--screen-sm")) || 768;
|
|
152
|
+
MINIMUM_LARGE_SCREEN_WIDTH = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--screen-lg")) || 1200;
|
|
153
|
+
if (this.screenWidth >= MINIMUM_LARGE_SCREEN_WIDTH) {
|
|
154
|
+
this.isTabletType = isAndroid() || isIos() || isAndroidTablet();
|
|
155
|
+
this.isMobileType = false;
|
|
156
|
+
} else if (this.screenWidth >= MINIMUM_TAB_WIDTH) {
|
|
157
|
+
this.type = SCREEN_TYPE.TABLET;
|
|
158
|
+
this.isTabletType = true;
|
|
159
|
+
} else {
|
|
160
|
+
this.type = SCREEN_TYPE.MOBILE;
|
|
161
|
+
this.isMobileType = true;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
key: "getViewport",
|
|
167
|
+
value: function getViewport() {
|
|
168
|
+
return {
|
|
169
|
+
screenWidth: this.screenWidth,
|
|
170
|
+
screenHeight: this.screenHeight,
|
|
171
|
+
windowWidth: typeof window !== "undefined" ? window.innerWidth : 0,
|
|
172
|
+
windowHeight: typeof window !== "undefined" ? window.innerHeight : 0,
|
|
173
|
+
isMobile: this.isMobileType,
|
|
174
|
+
isTablet: this.isTabletType,
|
|
175
|
+
isDesktop: !this.isMobileType && !this.isTabletType,
|
|
176
|
+
orientation: this.orientation
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
key: "destroy",
|
|
181
|
+
value: function destroy() {
|
|
182
|
+
this._eventNotifier.destroy();
|
|
183
|
+
if (typeof window !== "undefined" && this.boundResizeFn) {
|
|
184
|
+
window.removeEventListener("resize", this.boundResizeFn);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}]);
|
|
188
|
+
}(); // Lazy singleton initialization - only create instance when first accessed
|
|
189
|
+
var viewportServiceInstance = null;
|
|
190
|
+
|
|
191
|
+
// SSR-safe stub that matches ViewportService interface
|
|
192
|
+
var createSSRStub = function createSSRStub() {
|
|
193
|
+
var stub = {
|
|
194
|
+
orientation: {
|
|
195
|
+
isPortrait: false,
|
|
196
|
+
isLandscape: false
|
|
197
|
+
},
|
|
198
|
+
isMobileType: false,
|
|
199
|
+
isTabletType: false,
|
|
200
|
+
type: undefined,
|
|
201
|
+
_eventNotifier: new _eventNotifier["default"](),
|
|
202
|
+
screenWidth: 0,
|
|
203
|
+
screenHeight: 0,
|
|
204
|
+
selectedViewPort: undefined,
|
|
205
|
+
boundResizeFn: null,
|
|
206
|
+
subscribe: function subscribe() {
|
|
207
|
+
return function () {};
|
|
208
|
+
},
|
|
209
|
+
notify: function notify() {},
|
|
210
|
+
update: function update() {},
|
|
211
|
+
getViewport: function getViewport() {
|
|
212
|
+
return {
|
|
213
|
+
screenWidth: 0,
|
|
214
|
+
screenHeight: 0,
|
|
215
|
+
windowWidth: 0,
|
|
216
|
+
windowHeight: 0,
|
|
217
|
+
isMobile: false,
|
|
218
|
+
isTablet: false,
|
|
219
|
+
isDesktop: true,
|
|
220
|
+
orientation: {
|
|
221
|
+
isPortrait: false,
|
|
222
|
+
isLandscape: false
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
destroy: function destroy() {}
|
|
227
|
+
};
|
|
228
|
+
return stub;
|
|
229
|
+
};
|
|
230
|
+
function getViewportService() {
|
|
231
|
+
if (typeof window === "undefined") {
|
|
232
|
+
// During SSR, return stub without creating real instance
|
|
233
|
+
if (!viewportServiceInstance) {
|
|
234
|
+
viewportServiceInstance = createSSRStub();
|
|
235
|
+
}
|
|
236
|
+
return viewportServiceInstance;
|
|
237
|
+
}
|
|
238
|
+
if (!viewportServiceInstance) {
|
|
239
|
+
viewportServiceInstance = new ViewportService();
|
|
240
|
+
}
|
|
241
|
+
return viewportServiceInstance;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Export singleton instance with lazy initialization using Proxy
|
|
245
|
+
var viewportService = exports.viewportService = new Proxy({}, {
|
|
246
|
+
get: function get(_target, prop) {
|
|
247
|
+
var service = getViewportService();
|
|
248
|
+
var value = service[prop];
|
|
249
|
+
// Bind methods to maintain correct 'this' context
|
|
250
|
+
if (typeof value === "function") {
|
|
251
|
+
return value.bind(service);
|
|
252
|
+
}
|
|
253
|
+
return value;
|
|
254
|
+
}
|
|
255
|
+
});
|
package/utils/attr.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.removeInvalidAttributes = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var removeInvalidAttributes = exports.removeInvalidAttributes = function removeInvalidAttributes(attributes, explicitRemoveAttributes) {
|
|
10
|
+
var filteredAttributes = {};
|
|
11
|
+
Object.keys(attributes).forEach(function (key) {
|
|
12
|
+
if (explicitRemoveAttributes !== null && explicitRemoveAttributes !== void 0 && explicitRemoveAttributes.includes(key)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
var value = attributes[key];
|
|
16
|
+
if (Array.isArray(value) || (0, _typeof2["default"])(value) === "object" && value !== null) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (typeof value === "string") {
|
|
20
|
+
var trimmed = value.trim();
|
|
21
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]")) {
|
|
22
|
+
try {
|
|
23
|
+
var parsed = JSON.parse(value);
|
|
24
|
+
if ((0, _typeof2["default"])(parsed) === "object" && parsed !== null) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
} catch (e) {
|
|
28
|
+
// invalid json, ignore
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
filteredAttributes[key] = value;
|
|
33
|
+
});
|
|
34
|
+
return filteredAttributes;
|
|
35
|
+
};
|
package/utils/dataset-util.js
CHANGED
|
@@ -12,7 +12,7 @@ var DatasetUtil = exports["default"] = /*#__PURE__*/function () {
|
|
|
12
12
|
function DatasetUtil() {
|
|
13
13
|
(0, _classCallCheck2["default"])(this, DatasetUtil);
|
|
14
14
|
}
|
|
15
|
-
(0, _createClass2["default"])(DatasetUtil, null, [{
|
|
15
|
+
return (0, _createClass2["default"])(DatasetUtil, null, [{
|
|
16
16
|
key: "isValidDataset",
|
|
17
17
|
value: function isValidDataset(dataSet, isList) {
|
|
18
18
|
if (!dataSet || isList && !(0, _lodashEs.isArray)(dataSet)) {
|
|
@@ -170,5 +170,4 @@ var DatasetUtil = exports["default"] = /*#__PURE__*/function () {
|
|
|
170
170
|
return isList ? dataSet.length : Object.keys(dataSet).length;
|
|
171
171
|
}
|
|
172
172
|
}]);
|
|
173
|
-
return DatasetUtil;
|
|
174
173
|
}();
|