@wavemaker/react-runtime 11.14.3-rc.6401 → 11.15.0-2.247

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.
Files changed (245) hide show
  1. package/actions/base-action.js +5 -7
  2. package/actions/login-action.js +7 -8
  3. package/actions/logout-action.js +5 -7
  4. package/actions/navigation-action.js +73 -18
  5. package/actions/notification-action.js +22 -8
  6. package/actions/timer-action.js +13 -15
  7. package/actions/toast.js +4 -2
  8. package/actions/toast.service.js +1 -2
  9. package/components/advanced/carousel/index.js +1 -1
  10. package/components/advanced/carousel/template.js +1 -1
  11. package/components/basic/anchor/index.js +31 -11
  12. package/components/basic/html/index.js +115 -24
  13. package/components/basic/icon/index.js +2 -1
  14. package/components/basic/iframe/index.js +2 -1
  15. package/components/basic/label/index.js +12 -9
  16. package/components/basic/message/index.js +12 -3
  17. package/components/basic/picture/index.js +11 -4
  18. package/components/basic/progress-bar/index.js +4 -1
  19. package/components/basic/progress-circle/index.js +34 -28
  20. package/components/basic/progress-circle/props.js +10 -2
  21. package/components/basic/richtexteditor/index.js +95 -94
  22. package/components/basic/search/index.js +401 -156
  23. package/components/basic/search/providers.js +126 -61
  24. package/components/basic/spinner/index.js +2 -1
  25. package/components/basic/tree/index.js +34 -34
  26. package/components/basic/tree/utils.js +10 -4
  27. package/components/chart/components/barColumnChart/index.js +36 -33
  28. package/components/chart/components/bubbleChart/index.js +35 -25
  29. package/components/chart/components/chartLegend/utils.js +2 -1
  30. package/components/chart/components/cumulativeLineChart/index.js +30 -26
  31. package/components/chart/components/lineAreaChart/index.js +50 -32
  32. package/components/chart/components/pieDonutChart/index.js +13 -4
  33. package/components/chart/hooks/useXAxisConfig.js +15 -8
  34. package/components/chart/index.js +223 -53
  35. package/components/chart/utils.js +12 -1
  36. package/components/constants.js +5 -2
  37. package/components/container/accordion/accordion-pane/index.js +17 -12
  38. package/components/container/accordion/index.js +9 -4
  39. package/components/container/alignment-utils.js +56 -1
  40. package/components/container/index.js +49 -20
  41. package/components/container/panel/components/panel-header/index.js +3 -4
  42. package/components/container/panel/index.js +15 -10
  43. package/components/container/repeat-template/index.js +33 -0
  44. package/components/container/tabs/index.js +83 -14
  45. package/components/container/tabs/tab-pane/index.js +33 -10
  46. package/components/container/tabs/utils.js +51 -0
  47. package/components/container/wizard/components/StepComponents.js +2 -1
  48. package/components/container/wizard/components/WizardStep.js +2 -1
  49. package/components/container/wizard/index.js +64 -35
  50. package/components/container/wizard/utils.js +46 -1
  51. package/components/container/wizard/wizard-step/index.js +11 -1
  52. package/components/data/card/card-content/index.js +1 -1
  53. package/components/data/form/base-form/index.js +985 -183
  54. package/components/data/form/base-form/props.js +3 -1
  55. package/components/data/form/base-form/utils.js +159 -1
  56. package/components/data/form/dynamic-fields/constant.js +53 -0
  57. package/components/data/form/dynamic-fields/index.js +10 -45
  58. package/components/data/form/dynamic-fields/utils.js +37 -2
  59. package/components/data/form/form-action/index.js +5 -4
  60. package/components/data/form/form-context.js +5 -1
  61. package/components/data/form/form-controller/utils.js +84 -0
  62. package/components/data/form/form-controller/validation-contrustor.js +402 -189
  63. package/components/data/form/form-controller/withFormController.js +191 -52
  64. package/components/data/form/form-field/base-field.js +67 -45
  65. package/components/data/form/form-field/index.js +28 -5
  66. package/components/data/form/form-header/index.js +3 -4
  67. package/components/data/form/index.js +20 -1
  68. package/components/data/list/components/ListDND.js +2 -1
  69. package/components/data/list/components/ListItem.js +6 -2
  70. package/components/data/list/components/ListItemWithTemplate.js +46 -2
  71. package/components/data/list/components/ListItems.js +17 -26
  72. package/components/data/list/components/ListPagination.js +3 -3
  73. package/components/data/list/components/StandardListItems.js +3 -4
  74. package/components/data/list/hooks/useListEffects.js +55 -14
  75. package/components/data/list/hooks/useListEventHandlers.js +3 -1
  76. package/components/data/list/hooks/useListState.js +3 -1
  77. package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
  78. package/components/data/list/index.js +74 -55
  79. package/components/data/list/utils/list-helpers.js +73 -35
  80. package/components/data/list/utils/list-widget-methods.js +138 -95
  81. package/components/data/live-filter/index.js +26 -15
  82. package/components/data/live-form/index.js +51 -18
  83. package/components/data/live-form/props.js +1 -1
  84. package/components/data/pagination/components/BasicPagination.js +71 -16
  85. package/components/data/pagination/components/PageSizeSelector.js +8 -3
  86. package/components/data/pagination/components/TotalRecords.js +1 -5
  87. package/components/data/pagination/hooks/usePagination.js +349 -66
  88. package/components/data/pagination/index.js +137 -19
  89. package/components/data/table/components/AddNewRow.js +5 -1
  90. package/components/data/table/components/EditableCell.js +2 -2
  91. package/components/data/table/components/RowCells.js +64 -0
  92. package/components/data/table/components/RowExpansionButton.js +2 -2
  93. package/components/data/table/components/SummaryCell.js +111 -0
  94. package/components/data/table/components/SummaryRow.js +54 -0
  95. package/components/data/table/components/SummaryRowFooter.js +46 -0
  96. package/components/data/table/components/TableBody.js +61 -59
  97. package/components/data/table/components/TableDataRow.js +109 -0
  98. package/components/data/table/components/TableFilters.js +225 -121
  99. package/components/data/table/components/TableHeader.js +291 -23
  100. package/components/data/table/components/TablePanelHeading.js +139 -8
  101. package/components/data/table/components/index.js +22 -1
  102. package/components/data/table/hooks/use-edited-rows.js +141 -0
  103. package/components/data/table/hooks/useCellState.js +5 -12
  104. package/components/data/table/hooks/useFormWidget.js +58 -52
  105. package/components/data/table/hooks/usePaginationState.js +45 -24
  106. package/components/data/table/hooks/usePanelStructure.js +4 -4
  107. package/components/data/table/hooks/useRowHandlers.js +39 -5
  108. package/components/data/table/hooks/useRowSelection.js +244 -50
  109. package/components/data/table/hooks/useServerSideSorting.js +81 -37
  110. package/components/data/table/hooks/useTableColumns.js +211 -118
  111. package/components/data/table/hooks/useTableData.js +54 -9
  112. package/components/data/table/hooks/useTableEdit.js +272 -97
  113. package/components/data/table/hooks/useTableEffects.js +31 -13
  114. package/components/data/table/hooks/useTableFilter.js +1 -1
  115. package/components/data/table/hooks/useTableInitialization.js +23 -22
  116. package/components/data/table/hooks/useTableState.js +11 -5
  117. package/components/data/table/hooks/useTableStateManager.js +140 -65
  118. package/components/data/table/index.js +637 -274
  119. package/components/data/table/live-table/index.js +54 -22
  120. package/components/data/table/table-action/index.js +1 -1
  121. package/components/data/table/table-group/index.js +26 -0
  122. package/components/data/table/table-row-action/index.js +32 -18
  123. package/components/data/table/utils/buildSelectionColumns.js +12 -21
  124. package/components/data/table/utils/columnBuilder.js +29 -14
  125. package/components/data/table/utils/columnProxy.js +68 -1
  126. package/components/data/table/utils/constants.js +6 -2
  127. package/components/data/table/utils/crud-handlers.js +68 -63
  128. package/components/data/table/utils/groupHeaderUtils.js +102 -0
  129. package/components/data/table/utils/index.js +210 -21
  130. package/components/data/table/utils/renderDisplayCell.js +6 -6
  131. package/components/data/table/utils/selectionUtils.js +25 -26
  132. package/components/data/table/utils/validation.js +1 -0
  133. package/components/data/utils/filter-field-util.js +3 -3
  134. package/components/dialogs/alert-dialog/index.js +1 -1
  135. package/components/dialogs/confirm-dialog/index.js +1 -1
  136. package/components/dialogs/dialog/index.js +4 -1
  137. package/components/dialogs/dialog-content/index.js +3 -1
  138. package/components/dialogs/dialog-header/index.js +2 -2
  139. package/components/dialogs/iframe-dialog/index.js +11 -5
  140. package/components/dialogs/index.js +1 -1
  141. package/components/dialogs/login-dialog/index.js +1 -1
  142. package/components/dialogs/page-dialog/index.js +1 -1
  143. package/components/form/button/index.js +33 -7
  144. package/components/input/calendar/index.js +18 -6
  145. package/components/input/chips/index.js +99 -28
  146. package/components/input/chips/utils.js +34 -4
  147. package/components/input/color-picker/index.js +74 -25
  148. package/components/input/composite/index.js +3 -3
  149. package/components/input/currency/index.js +35 -49
  150. package/components/input/default/checkbox/index.js +23 -28
  151. package/components/input/default/checkboxset/index.js +38 -18
  152. package/components/input/default/checkboxset/utils.js +30 -0
  153. package/components/input/default/radioset/index.js +36 -39
  154. package/components/input/default/switch/index.js +30 -13
  155. package/components/input/epoch/date/index.js +130 -69
  156. package/components/input/epoch/date/utils.js +94 -1
  157. package/components/input/epoch/datetime/index.js +72 -22
  158. package/components/input/epoch/datetime/utils.js +49 -10
  159. package/components/input/epoch/time/index.js +68 -19
  160. package/components/input/epoch/time/utils.js +62 -14
  161. package/components/input/fileupload/Utils.js +12 -7
  162. package/components/input/fileupload/components/MultiUpload.js +2 -6
  163. package/components/input/fileupload/components/SingleUpload.js +3 -7
  164. package/components/input/fileupload/index.js +6 -10
  165. package/components/input/fileupload/useFileUpload.js +16 -5
  166. package/components/input/number/index.js +158 -43
  167. package/components/input/rating/index.js +90 -7
  168. package/components/input/select/index.js +209 -72
  169. package/components/input/slider/index.js +84 -26
  170. package/components/input/text/index.js +38 -18
  171. package/components/input/text/util.js +283 -130
  172. package/components/input/textarea/index.js +13 -10
  173. package/components/input/upload/index.js +124 -0
  174. package/components/input/upload/props.js +5 -0
  175. package/components/input/util/index.js +11 -0
  176. package/components/navbar/index.js +51 -3
  177. package/components/navbar/nav/index.js +46 -16
  178. package/components/navbar/nav-item/index.js +11 -5
  179. package/components/navigation/menu/components/ListItems.js +3 -0
  180. package/components/navigation/menu/constants.js +2 -1
  181. package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
  182. package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
  183. package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
  184. package/components/navigation/menu/index.js +326 -188
  185. package/components/navigation/menu/utils/action-task.js +14 -0
  186. package/components/navigation/menu/utils/role-filter.js +76 -0
  187. package/components/navigation/popover/index.js +105 -32
  188. package/components/page/partial-container/index.js +34 -5
  189. package/components/prefab/index.js +2 -4
  190. package/context/PrefabContext.js +10 -6
  191. package/context/WidgetProvider.js +30 -31
  192. package/core/app.service.js +1 -1
  193. package/core/constants/events.js +57 -1
  194. package/core/dialog.service.js +1 -2
  195. package/core/event-notifier.js +1 -2
  196. package/core/formatter/array-formatters.js +33 -0
  197. package/core/formatter/date-formatters.js +2 -4
  198. package/core/formatter/index.js +2 -1
  199. package/core/formatter/number-formatters.js +5 -10
  200. package/core/formatter/security-formatters.js +2 -4
  201. package/core/formatter/string-formatters.js +3 -6
  202. package/core/proxy-service.js +85 -13
  203. package/core/script-registry.js +108 -48
  204. package/core/util/common.js +4 -4
  205. package/core/util/compare.js +30 -0
  206. package/core/util/dom.js +8 -8
  207. package/core/util/index.js +16 -6
  208. package/core/util/safe-is-equal.js +156 -0
  209. package/core/util/security.js +1 -2
  210. package/core/util/utils.js +16 -7
  211. package/higherOrder/BaseApp.js +108 -65
  212. package/higherOrder/BaseDateTime.js +31 -13
  213. package/higherOrder/BasePage.js +268 -144
  214. package/higherOrder/BasePartial.js +1 -1
  215. package/higherOrder/BasePrefab.js +33 -15
  216. package/higherOrder/DataNav.js +99 -16
  217. package/higherOrder/helper.js +41 -3
  218. package/higherOrder/withBaseWrapper.js +41 -28
  219. package/hooks/useAuth.js +11 -5
  220. package/hooks/useHttp.js +280 -94
  221. package/mui-config/theme-provider.js +1 -1
  222. package/mui-config/theme.js +1 -1
  223. package/package-lock.json +423 -331
  224. package/package.json +8 -8
  225. package/store/bindActions/i18nActions.js +18 -0
  226. package/store/index.js +3 -1
  227. package/store/slices/appConfigSlice.js +2 -2
  228. package/store/slices/authSlice.js +31 -28
  229. package/store/slices/i18nSlice.js +2 -2
  230. package/store/slices/navigationSlice.js +35 -0
  231. package/store/viewport.service.js +255 -0
  232. package/utils/attr.js +35 -0
  233. package/utils/dataset-util.js +1 -2
  234. package/utils/form-state.util.js +43 -12
  235. package/utils/form-utils.js +47 -2
  236. package/utils/format-util.js +28 -13
  237. package/utils/page-params-util.js +33 -1
  238. package/utils/state-persistance.js +72 -13
  239. package/utils/transformedDataset-utils.js +35 -24
  240. package/variables/base-variable.js +12 -14
  241. package/variables/crud-variable.js +225 -0
  242. package/variables/live-variable.js +56 -20
  243. package/variables/metadata.service.js +123 -0
  244. package/variables/model-variable.js +21 -15
  245. package/variables/service-variable.js +88 -83
package/hooks/useHttp.js CHANGED
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.useHttp = exports.httpService = exports["default"] = exports.HttpProvider = void 0;
8
+ exports.useHttp = exports.httpService = exports.getHttpService = exports["default"] = exports.HttpProvider = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
@@ -13,13 +13,17 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
13
13
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
14
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
15
  var _axios = _interopRequireWildcard(require("axios"));
16
+ var axiosModule = _axios;
16
17
  var _constants = require("@wavemaker/react-runtime/variables/constants");
17
18
  var _store = require("../store");
18
19
  var _authSlice = require("../store/slices/authSlice");
19
20
  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
21
  var __jsx = _react["default"].createElement;
21
22
  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
+ 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; }
24
+ var axios = axiosModule["default"] || axiosModule;
25
+
26
+ // @ts-ignore
23
27
  // Types
24
28
  // Create the HTTP service class implementing HttpClientService
25
29
  var ModernHttpService = /*#__PURE__*/function () {
@@ -27,74 +31,201 @@ var ModernHttpService = /*#__PURE__*/function () {
27
31
  var baseURL = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
28
32
  (0, _classCallCheck2["default"])(this, ModernHttpService);
29
33
  (0, _defineProperty2["default"])(this, "axiosInstance", void 0);
30
- this.axiosInstance = _axios["default"].create({
34
+ (0, _defineProperty2["default"])(this, "_context", null);
35
+ (0, _defineProperty2["default"])(this, "localeObject", _store.store.getState().i18n.appLocale);
36
+ this.axiosInstance = axios.create({
31
37
  baseURL: baseURL
32
38
  });
33
39
  this.setupInterceptors();
34
40
  }
35
- (0, _createClass2["default"])(ModernHttpService, [{
41
+
42
+ /**
43
+ * Set the current context (page/component context)
44
+ * @param context - The context object to store
45
+ */
46
+ return (0, _createClass2["default"])(ModernHttpService, [{
47
+ key: "setContext",
48
+ value: function setContext(context) {
49
+ this._context = context;
50
+ }
51
+
52
+ /**
53
+ * Get the currently stored context
54
+ * @returns The stored context object
55
+ */
56
+ }, {
57
+ key: "getContext",
58
+ value: function getContext() {
59
+ return this._context;
60
+ }
61
+ }, {
62
+ key: "getAppManager",
63
+ value: function getAppManager() {
64
+ var _ref, _currentContext$App;
65
+ var currentContext = this.getContext();
66
+ return (_ref = (_currentContext$App = currentContext === null || currentContext === void 0 ? void 0 : currentContext.App) !== null && _currentContext$App !== void 0 ? _currentContext$App : currentContext) !== null && _ref !== void 0 ? _ref : {};
67
+ }
68
+ }, {
36
69
  key: "setupInterceptors",
37
70
  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;
71
+ var _this = this;
72
+ this.axiosInstance.interceptors.request.use(/*#__PURE__*/function () {
73
+ var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(config) {
74
+ var _state$info, _config$withCredentia, _config$url;
75
+ var appManager, state, token, baseUrl, headers, wmVariable, isFileDownload, modifiedReq;
70
76
  return _regenerator["default"].wrap(function _callee$(_context) {
71
77
  while (1) switch (_context.prev = _context.next) {
72
78
  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:
79
+ appManager = _this.getAppManager(); // Create new headers instance
80
+ state = _store.store.getState();
81
+ token = state.auth.token;
82
+ 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) || "";
83
+ headers = new _axios.AxiosHeaders(config.headers); // Check if this is a file download operation
84
+ wmVariable = config.__wmVariable;
85
+ isFileDownload = (wmVariable === null || wmVariable === void 0 ? void 0 : wmVariable.operation) === "getDownloadFile"; // Only set Accept header for non-download operations
86
+ if (!isFileDownload) {
87
+ headers.set("Accept", "application/json");
88
+ }
89
+ config.headers = headers;
90
+ config.withCredentials = (_config$withCredentia = config.withCredentials) !== null && _config$withCredentia !== void 0 ? _config$withCredentia : true;
91
+ if ((_config$url = config.url) !== null && _config$url !== void 0 && _config$url.startsWith(baseUrl) && token) {
92
+ if (config.headers) config.headers[_authSlice.XSRF_HEADER_NAME] = token;
93
+ }
94
+
95
+ // Call onBeforeServiceCall if available - wait for promise to resolve
96
+ // This allows the app to modify the request config before it's sent
97
+ if (!(appManager && appManager.onBeforeServiceCall)) {
98
+ _context.next = 22;
99
+ break;
100
+ }
101
+ _context.prev = 12;
102
+ _context.next = 15;
103
+ return appManager.onBeforeServiceCall(config);
104
+ case 15:
105
+ modifiedReq = _context.sent;
106
+ if (modifiedReq) {
107
+ config = modifiedReq;
108
+ }
109
+ _context.next = 22;
110
+ break;
111
+ case 19:
112
+ _context.prev = 19;
113
+ _context.t0 = _context["catch"](12);
114
+ console.error("Error in onBeforeServiceCall:", _context.t0);
115
+ // Continue with original config if the callback fails
116
+ case 22:
117
+ return _context.abrupt("return", config);
118
+ case 23:
76
119
  case "end":
77
120
  return _context.stop();
78
121
  }
79
- }, _callee);
122
+ }, _callee, null, [[12, 19]]);
80
123
  }));
81
124
  return function (_x) {
82
- return _ref.apply(this, arguments);
125
+ return _ref2.apply(this, arguments);
126
+ };
127
+ }(), function (error) {
128
+ return Promise.reject(error);
129
+ });
130
+ this.axiosInstance.interceptors.response.use(/*#__PURE__*/function () {
131
+ var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(response) {
132
+ var appManager, modifiedResponse, modifiedResp;
133
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
134
+ while (1) switch (_context2.prev = _context2.next) {
135
+ case 0:
136
+ appManager = _this.getAppManager();
137
+ modifiedResponse = _objectSpread(_objectSpread({}, response), {}, {
138
+ body: response.data,
139
+ type: 4 // mimic Angular's HttpEventType.Response
140
+ }); // Call appOnServiceSuccess if available - similar to Angular's tap operator
141
+ if (!(appManager && appManager.onServiceSuccess)) {
142
+ _context2.next = 13;
143
+ break;
144
+ }
145
+ _context2.prev = 3;
146
+ _context2.next = 6;
147
+ return appManager.onServiceSuccess(modifiedResponse.body, modifiedResponse);
148
+ case 6:
149
+ modifiedResp = _context2.sent;
150
+ if (modifiedResp) {
151
+ modifiedResponse = _objectSpread(_objectSpread({}, modifiedResponse), modifiedResp);
152
+ }
153
+ _context2.next = 13;
154
+ break;
155
+ case 10:
156
+ _context2.prev = 10;
157
+ _context2.t0 = _context2["catch"](3);
158
+ console.error("Error in onServiceSuccess:", _context2.t0);
159
+ case 13:
160
+ return _context2.abrupt("return", modifiedResponse);
161
+ case 14:
162
+ case "end":
163
+ return _context2.stop();
164
+ }
165
+ }, _callee2, null, [[3, 10]]);
166
+ }));
167
+ return function (_x2) {
168
+ return _ref3.apply(this, arguments);
169
+ };
170
+ }(), /*#__PURE__*/function () {
171
+ var _ref4 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(error) {
172
+ var _error$response;
173
+ var appManager, errorResponse, _errorResponse, _errorResponse2, _errorResponse3, errorMessage, modifiedResp;
174
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
175
+ while (1) switch (_context3.prev = _context3.next) {
176
+ case 0:
177
+ appManager = _this.getAppManager();
178
+ errorResponse = error.response || error; // Handle 401 session timeout if needed
179
+ if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 401) {
180
+ // Session timeout handling can be added here
181
+ }
182
+
183
+ // Call appOnServiceError if available
184
+ if (!(appManager && appManager.onServiceError)) {
185
+ _context3.next = 16;
186
+ break;
187
+ }
188
+ _context3.prev = 4;
189
+ errorMessage = ((_errorResponse = errorResponse) === null || _errorResponse === void 0 || (_errorResponse = _errorResponse.data) === null || _errorResponse === void 0 ? void 0 : _errorResponse.message) || ((_errorResponse2 = errorResponse) === null || _errorResponse2 === void 0 ? void 0 : _errorResponse2.message) || "Unknown error";
190
+ errorResponse.error = ((_errorResponse3 = errorResponse) === null || _errorResponse3 === void 0 ? void 0 : _errorResponse3.data) || errorResponse;
191
+ _context3.next = 9;
192
+ return appManager.onServiceError(errorMessage, errorResponse);
193
+ case 9:
194
+ modifiedResp = _context3.sent;
195
+ if (modifiedResp) {
196
+ errorResponse = _objectSpread(_objectSpread({}, errorResponse), modifiedResp);
197
+ }
198
+ _context3.next = 16;
199
+ break;
200
+ case 13:
201
+ _context3.prev = 13;
202
+ _context3.t0 = _context3["catch"](4);
203
+ console.error("Error in onServiceError:", _context3.t0);
204
+ case 16:
205
+ throw errorResponse;
206
+ case 17:
207
+ case "end":
208
+ return _context3.stop();
209
+ }
210
+ }, _callee3, null, [[4, 13]]);
211
+ }));
212
+ return function (_x3) {
213
+ return _ref4.apply(this, arguments);
83
214
  };
84
215
  }());
85
216
  }
86
217
  }, {
87
218
  key: "send",
88
219
  value: function () {
89
- var _send = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(options, variable) {
220
+ var _send = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(options, variable) {
90
221
  var serviceInfo, headers, requestBody, url, _serviceInfo$proxySet, isProxyCall, _options$url$replace, methodType, isNonDataMethod, axiosConfig, response;
91
- return _regenerator["default"].wrap(function _callee2$(_context2) {
92
- while (1) switch (_context2.prev = _context2.next) {
222
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
223
+ while (1) switch (_context4.prev = _context4.next) {
93
224
  case 0:
94
225
  serviceInfo = variable.serviceInfo;
95
226
  headers = new _axios.AxiosHeaders(options.headers);
96
227
  requestBody = options.data;
97
- variable.cancelTokenSource = _axios["default"].CancelToken.source();
228
+ variable.cancelTokenSource = axios.CancelToken.source();
98
229
  url = options.url;
99
230
  if (serviceInfo) {
100
231
  serviceInfo.proxySettings = (serviceInfo === null || serviceInfo === void 0 ? void 0 : serviceInfo.proxySettings) || {
@@ -103,7 +234,13 @@ var ModernHttpService = /*#__PURE__*/function () {
103
234
  isProxyCall = serviceInfo === null || serviceInfo === void 0 || (_serviceInfo$proxySet = serviceInfo.proxySettings) === null || _serviceInfo$proxySet === void 0 ? void 0 : _serviceInfo$proxySet.web;
104
235
  url = isProxyCall ? options.url : serviceInfo === null || serviceInfo === void 0 ? void 0 : serviceInfo.directPath;
105
236
  }
106
- if (variable.category === "wm.LiveVariable" && !(url.startsWith("http://") || url.startsWith("https://"))) {
237
+ if (variable.category === "wm.CrudVariable") {
238
+ if (url.startsWith("http://") || url.startsWith("https://")) {
239
+ url = url;
240
+ } else {
241
+ url = variable.config.baseUrl + options.url.replace(".//", "/").replace("./", "/");
242
+ }
243
+ } else if (variable.category === "wm.LiveVariable" && !(url.startsWith("http://") || url.startsWith("https://"))) {
107
244
  url = variable.config.baseUrl + options.url.replace("./", "/");
108
245
  } else if (url === (serviceInfo === null || serviceInfo === void 0 ? void 0 : serviceInfo.directPath) && options.url.startsWith("http")) {
109
246
  url = options.url;
@@ -140,29 +277,29 @@ var ModernHttpService = /*#__PURE__*/function () {
140
277
  if (options !== null && options !== void 0 && options.onUploadProgress) {
141
278
  axiosConfig.onUploadProgress = options.onUploadProgress;
142
279
  }
143
- _context2.prev = 13;
144
- _context2.next = 16;
280
+ _context4.prev = 13;
281
+ _context4.next = 16;
145
282
  return this.axiosInstance.request(axiosConfig);
146
283
  case 16:
147
- response = _context2.sent;
284
+ response = _context4.sent;
148
285
  if (!(variable.operation === "getDownloadFile" || (serviceInfo === null || serviceInfo === void 0 ? void 0 : serviceInfo.operationId) === "FileController_getDownloadFile")) {
149
- _context2.next = 19;
286
+ _context4.next = 19;
150
287
  break;
151
288
  }
152
- return _context2.abrupt("return", this.handleFileDownload(response, options, variable));
289
+ return _context4.abrupt("return", this.handleFileDownload(response, options, variable));
153
290
  case 19:
154
- return _context2.abrupt("return", response);
291
+ return _context4.abrupt("return", response);
155
292
  case 22:
156
- _context2.prev = 22;
157
- _context2.t0 = _context2["catch"](13);
158
- throw _context2.t0.response || _context2.t0;
293
+ _context4.prev = 22;
294
+ _context4.t0 = _context4["catch"](13);
295
+ throw _context4.t0.response || _context4.t0;
159
296
  case 25:
160
297
  case "end":
161
- return _context2.stop();
298
+ return _context4.stop();
162
299
  }
163
- }, _callee2, this, [[13, 22]]);
300
+ }, _callee4, this, [[13, 22]]);
164
301
  }));
165
- function send(_x2, _x3) {
302
+ function send(_x4, _x5) {
166
303
  return _send.apply(this, arguments);
167
304
  }
168
305
  return send;
@@ -170,36 +307,41 @@ var ModernHttpService = /*#__PURE__*/function () {
170
307
  }, {
171
308
  key: "sendCall",
172
309
  value: function () {
173
- var _sendCall = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(requestParams, variable) {
310
+ var _sendCall = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(requestParams, variable) {
174
311
  var response;
175
- return _regenerator["default"].wrap(function _callee3$(_context3) {
176
- while (1) switch (_context3.prev = _context3.next) {
312
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
313
+ while (1) switch (_context5.prev = _context5.next) {
177
314
  case 0:
178
- _context3.prev = 0;
179
- _context3.next = 3;
315
+ _context5.prev = 0;
316
+ _context5.next = 3;
180
317
  return this.send(requestParams, variable);
181
318
  case 3:
182
- response = _context3.sent;
183
- return _context3.abrupt("return", response);
319
+ response = _context5.sent;
320
+ return _context5.abrupt("return", response);
184
321
  case 7:
185
- _context3.prev = 7;
186
- _context3.t0 = _context3["catch"](0);
187
- throw _context3.t0;
322
+ _context5.prev = 7;
323
+ _context5.t0 = _context5["catch"](0);
324
+ throw _context5.t0;
188
325
  case 10:
189
326
  case "end":
190
- return _context3.stop();
327
+ return _context5.stop();
191
328
  }
192
- }, _callee3, this, [[0, 7]]);
329
+ }, _callee5, this, [[0, 7]]);
193
330
  }));
194
- function sendCall(_x4, _x5) {
331
+ function sendCall(_x6, _x7) {
195
332
  return _sendCall.apply(this, arguments);
196
333
  }
197
334
  return sendCall;
198
335
  }()
336
+ }, {
337
+ key: "setLocale",
338
+ value: function setLocale(locale) {
339
+ this.localeObject = locale;
340
+ }
199
341
  }, {
200
342
  key: "getLocale",
201
343
  value: function getLocale() {
202
- return "appLocale";
344
+ return this.localeObject;
203
345
  }
204
346
  }, {
205
347
  key: "cancel",
@@ -260,13 +402,13 @@ var ModernHttpService = /*#__PURE__*/function () {
260
402
  }, {
261
403
  key: "uploadFile",
262
404
  value: function () {
263
- var _uploadFile = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(url, data, variable, options) {
264
- var _this = this;
405
+ var _uploadFile = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6(url, data, variable, options) {
406
+ var _this2 = this;
265
407
  var requestParams;
266
- return _regenerator["default"].wrap(function _callee4$(_context4) {
267
- while (1) switch (_context4.prev = _context4.next) {
408
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
409
+ while (1) switch (_context6.prev = _context6.next) {
268
410
  case 0:
269
- _context4.prev = 0;
411
+ _context6.prev = 0;
270
412
  requestParams = {
271
413
  url: url,
272
414
  data: data,
@@ -282,39 +424,38 @@ var ModernHttpService = /*#__PURE__*/function () {
282
424
  }
283
425
  }
284
426
  };
285
- return _context4.abrupt("return", new Promise(function (resolve, reject) {
286
- variable.request = _this.send(requestParams, variable).then(function (event) {
427
+ return _context6.abrupt("return", new Promise(function (resolve, reject) {
428
+ variable.request = _this2.send(requestParams, variable).then(function (event) {
287
429
  resolve(event.data);
288
430
  })["catch"](function (error) {
289
431
  reject(error);
290
432
  });
291
433
  }));
292
434
  case 5:
293
- _context4.prev = 5;
294
- _context4.t0 = _context4["catch"](0);
295
- console.error("Unexpected error in uploadFile:", _context4.t0);
296
- throw _context4.t0;
435
+ _context6.prev = 5;
436
+ _context6.t0 = _context6["catch"](0);
437
+ console.error("Unexpected error in uploadFile:", _context6.t0);
438
+ throw _context6.t0;
297
439
  case 9:
298
440
  case "end":
299
- return _context4.stop();
441
+ return _context6.stop();
300
442
  }
301
- }, _callee4, null, [[0, 5]]);
443
+ }, _callee6, null, [[0, 5]]);
302
444
  }));
303
- function uploadFile(_x6, _x7, _x8, _x9) {
445
+ function uploadFile(_x8, _x9, _x0, _x1) {
304
446
  return _uploadFile.apply(this, arguments);
305
447
  }
306
448
  return uploadFile;
307
449
  }()
308
450
  }]);
309
- return ModernHttpService;
310
451
  }(); // Create Context
311
452
  var HttpContext = /*#__PURE__*/(0, _react.createContext)(null);
312
453
 
313
454
  // Provider Component
314
- var HttpProvider = exports.HttpProvider = function HttpProvider(_ref2) {
315
- var children = _ref2.children,
316
- _ref2$baseURL = _ref2.baseURL,
317
- baseURL = _ref2$baseURL === void 0 ? "" : _ref2$baseURL;
455
+ var HttpProvider = exports.HttpProvider = function HttpProvider(_ref5) {
456
+ var children = _ref5.children,
457
+ _ref5$baseURL = _ref5.baseURL,
458
+ baseURL = _ref5$baseURL === void 0 ? "" : _ref5$baseURL;
318
459
  var httpService = (0, _react.useRef)(new ModernHttpService(baseURL));
319
460
  var contextValue = (0, _react.useMemo)(function () {
320
461
  return _objectSpread(_objectSpread({}, httpService.current), {}, {
@@ -323,7 +464,9 @@ var HttpProvider = exports.HttpProvider = function HttpProvider(_ref2) {
323
464
  sendCall: httpService.current.sendCall.bind(httpService.current),
324
465
  cancel: httpService.current.cancel.bind(httpService.current),
325
466
  uploadFile: httpService.current.uploadFile.bind(httpService.current),
326
- getLocale: httpService.current.getLocale.bind(httpService.current)
467
+ getLocale: httpService.current.getLocale.bind(httpService.current),
468
+ setContext: httpService.current.setContext.bind(httpService.current),
469
+ getContext: httpService.current.getContext.bind(httpService.current)
327
470
  });
328
471
  }, []);
329
472
  return __jsx(HttpContext.Provider, {
@@ -340,6 +483,49 @@ var useHttp = exports.useHttp = function useHttp() {
340
483
  return context;
341
484
  };
342
485
 
343
- // Export singleton instance for direct usage
344
- var httpService = exports.httpService = new ModernHttpService();
486
+ // Lazy singleton - only created when first accessed
487
+ var _httpService = null;
488
+ var getHttpService = exports.getHttpService = function getHttpService() {
489
+ if (!_httpService) {
490
+ _httpService = new ModernHttpService();
491
+ }
492
+ return _httpService;
493
+ };
494
+
495
+ // For backward compatibility - use getter pattern
496
+ var httpService = exports.httpService = {
497
+ get instance() {
498
+ return getHttpService();
499
+ },
500
+ send: function send() {
501
+ var _getHttpService;
502
+ return (_getHttpService = getHttpService()).send.apply(_getHttpService, arguments);
503
+ },
504
+ sendCall: function sendCall() {
505
+ var _getHttpService2;
506
+ return (_getHttpService2 = getHttpService()).sendCall.apply(_getHttpService2, arguments);
507
+ },
508
+ cancel: function cancel() {
509
+ var _getHttpService3;
510
+ return (_getHttpService3 = getHttpService()).cancel.apply(_getHttpService3, arguments);
511
+ },
512
+ uploadFile: function uploadFile() {
513
+ var _getHttpService4;
514
+ return (_getHttpService4 = getHttpService()).uploadFile.apply(_getHttpService4, arguments);
515
+ },
516
+ setLocale: function setLocale() {
517
+ var _getHttpService5;
518
+ return (_getHttpService5 = getHttpService()).setLocale.apply(_getHttpService5, arguments);
519
+ },
520
+ getLocale: function getLocale() {
521
+ return getHttpService().getLocale();
522
+ },
523
+ setContext: function setContext() {
524
+ var _getHttpService6;
525
+ return (_getHttpService6 = getHttpService()).setContext.apply(_getHttpService6, arguments);
526
+ },
527
+ getContext: function getContext() {
528
+ return getHttpService().getContext();
529
+ }
530
+ };
345
531
  var _default = exports["default"] = httpService;
@@ -13,5 +13,5 @@ var WmThemeProvider = exports.WmThemeProvider = function WmThemeProvider(_ref) {
13
13
  var children = _ref.children;
14
14
  return __jsx(_material.ThemeProvider, {
15
15
  theme: _theme["default"]
16
- }, __jsx(_material.CssBaseline, null), " ", children);
16
+ }, children);
17
17
  };
@@ -68,7 +68,7 @@ var theme = (0, _styles.createTheme)({
68
68
  styleOverrides: {
69
69
  root: {
70
70
  "& .MuiDialog-container": {
71
- width: "inherit"
71
+ width: "100vw"
72
72
  },
73
73
  "& .MuiDialog-paper": {
74
74
  backgroundColor: "transparent"