@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.
- 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 +73 -18
- 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 +31 -11
- 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 +4 -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/repeat-template/index.js +33 -0
- package/components/container/tabs/index.js +83 -14
- package/components/container/tabs/tab-pane/index.js +33 -10
- 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 +985 -183
- 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 +67 -45
- 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 +51 -18
- 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 -52
- 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 +209 -72
- 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 +105 -32
- 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 +85 -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 +41 -3
- 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 +423 -331
- 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/higherOrder/BaseApp.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use client";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
@@ -13,6 +14,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
14
|
var _cloneDeep = _interopRequireDefault(require("lodash-es/cloneDeep"));
|
|
14
15
|
var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
|
|
15
16
|
var _get2 = _interopRequireDefault(require("lodash-es/get"));
|
|
17
|
+
var _variables = require("@wavemaker/variables");
|
|
16
18
|
var _store = require("../store");
|
|
17
19
|
var _useAuth = require("../hooks/useAuth");
|
|
18
20
|
var _i18nSlice = require("../store/slices/i18nSlice");
|
|
@@ -26,6 +28,11 @@ var _proxyService = require("../core/proxy-service");
|
|
|
26
28
|
var _helper = require("./helper");
|
|
27
29
|
var _authSlice = require("../store/slices/authSlice");
|
|
28
30
|
var _AppSpinnerProvider = _interopRequireDefault(require("../context/AppSpinnerProvider"));
|
|
31
|
+
var _formatter = _interopRequireDefault(require("../core/formatter"));
|
|
32
|
+
var _utils = require("../core/util/utils");
|
|
33
|
+
var _metadata = require("../variables/metadata.service");
|
|
34
|
+
var _i18nActions = require("../store/bindActions/i18nActions");
|
|
35
|
+
var _ref, _ref$wm; // @ts-ignore
|
|
29
36
|
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); }
|
|
30
37
|
var __jsx = _react["default"].createElement;
|
|
31
38
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
@@ -33,6 +40,10 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
33
40
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
34
41
|
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; }
|
|
35
42
|
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; }
|
|
43
|
+
// Add global declaration for wm property
|
|
44
|
+
|
|
45
|
+
(_ref$wm = (_ref = global).wm) !== null && _ref$wm !== void 0 ? _ref$wm : _ref.wm = {};
|
|
46
|
+
|
|
36
47
|
// HOC function that wraps the app component
|
|
37
48
|
var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript, getAppVariables) {
|
|
38
49
|
var appInfo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
@@ -46,7 +57,8 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
46
57
|
var info = (0, _store.useAppSelector)(function (state) {
|
|
47
58
|
return state.info;
|
|
48
59
|
});
|
|
49
|
-
var
|
|
60
|
+
var i18nService = _appstore["default"].I18nService.get();
|
|
61
|
+
var _useState = (0, _react.useState)(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _helper.BaseAppInitialState), {}, {
|
|
50
62
|
updateActivePage: updateActivePage,
|
|
51
63
|
changeLocale: changeLocale,
|
|
52
64
|
selectedLocale: i18n.selectedLocale || "en",
|
|
@@ -63,8 +75,11 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
63
75
|
executeStartAppOperations: executeStartAppOperations,
|
|
64
76
|
importModule: _helper.importModule,
|
|
65
77
|
Widgets: {},
|
|
66
|
-
subscribe: subscribe
|
|
67
|
-
|
|
78
|
+
subscribe: subscribe,
|
|
79
|
+
targetPlatform: "WEB",
|
|
80
|
+
hasOwnObjectProperty: _utils.hasOwnObjectProperty,
|
|
81
|
+
formatters: _formatter["default"]
|
|
82
|
+
}, appInfo), _i18nActions.i18nService), i18nService)),
|
|
68
83
|
appContext = _useState[0],
|
|
69
84
|
setAppContext = _useState[1];
|
|
70
85
|
var appProxyRef = (0, _react.useRef)(null);
|
|
@@ -78,7 +93,7 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
78
93
|
// Set up service error listener using EventNotifier (outside useEffect)
|
|
79
94
|
(0, _react.useEffect)(function () {
|
|
80
95
|
var unsubscribe = _eventNotifier["default"].ROOT.subscribe("SERVICE_ERROR", function (variable, error, options) {
|
|
81
|
-
var _options$xhrObj, _options$xhrObj2
|
|
96
|
+
var _options$xhrObj, _options$xhrObj2;
|
|
82
97
|
// if error is 401, show login dialog
|
|
83
98
|
if ((options === null || options === void 0 || (_options$xhrObj = options.xhrObj) === null || _options$xhrObj === void 0 ? void 0 : _options$xhrObj.status) === 401) {
|
|
84
99
|
(0, _app.handle401)();
|
|
@@ -86,10 +101,7 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
86
101
|
if ((options === null || options === void 0 || (_options$xhrObj2 = options.xhrObj) === null || _options$xhrObj2 === void 0 ? void 0 : _options$xhrObj2.code) === "ERR_CANCELED") {
|
|
87
102
|
return;
|
|
88
103
|
}
|
|
89
|
-
|
|
90
|
-
appProxyRef.current.onServiceError(error, options.xhrObj);
|
|
91
|
-
}
|
|
92
|
-
notifyApp(error, "error", "Service Error");
|
|
104
|
+
notifyApp(error, "error", false);
|
|
93
105
|
});
|
|
94
106
|
serviceErrorSubscriptionRef.current = unsubscribe;
|
|
95
107
|
// Cleanup function
|
|
@@ -140,85 +152,91 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
140
152
|
return _executeStartAppOperations.apply(this, arguments);
|
|
141
153
|
}
|
|
142
154
|
function _executeStartAppOperations() {
|
|
143
|
-
_executeStartAppOperations = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
155
|
+
_executeStartAppOperations = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
144
156
|
var startUpVariables, appVariables, variablePromises;
|
|
145
|
-
return _regenerator["default"].wrap(function
|
|
146
|
-
while (1) switch (
|
|
157
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
158
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
147
159
|
case 0:
|
|
148
160
|
if (!isVariablesExecutedRef.current) {
|
|
149
|
-
|
|
161
|
+
_context5.next = 2;
|
|
150
162
|
break;
|
|
151
163
|
}
|
|
152
|
-
return
|
|
164
|
+
return _context5.abrupt("return");
|
|
153
165
|
case 2:
|
|
154
166
|
isVariablesExecutedRef.current = true;
|
|
155
167
|
startUpVariables = appInfo.startUpVariables || [];
|
|
156
168
|
appVariables = appProxyRef.current.Variables; // Execute startup variables
|
|
157
169
|
variablePromises = startUpVariables.map(/*#__PURE__*/function () {
|
|
158
|
-
var
|
|
170
|
+
var _ref5 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(varName) {
|
|
159
171
|
var variable;
|
|
160
|
-
return _regenerator["default"].wrap(function
|
|
161
|
-
while (1) switch (
|
|
172
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
173
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
162
174
|
case 0:
|
|
163
175
|
variable = appVariables[varName];
|
|
164
176
|
if (!(variable && variable.invoke && typeof variable.invoke === "function")) {
|
|
165
|
-
|
|
177
|
+
_context4.next = 12;
|
|
166
178
|
break;
|
|
167
179
|
}
|
|
168
|
-
|
|
169
|
-
|
|
180
|
+
_context4.prev = 2;
|
|
181
|
+
_context4.next = 5;
|
|
170
182
|
return variable.invoke();
|
|
171
183
|
case 5:
|
|
172
|
-
return
|
|
184
|
+
return _context4.abrupt("return", _context4.sent);
|
|
173
185
|
case 8:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
console.warn("Error invoking startup variable ".concat(varName, ":"),
|
|
177
|
-
return
|
|
186
|
+
_context4.prev = 8;
|
|
187
|
+
_context4.t0 = _context4["catch"](2);
|
|
188
|
+
console.warn("Error invoking startup variable ".concat(varName, ":"), _context4.t0);
|
|
189
|
+
return _context4.abrupt("return", null);
|
|
178
190
|
case 12:
|
|
179
|
-
return
|
|
191
|
+
return _context4.abrupt("return", Promise.resolve());
|
|
180
192
|
case 13:
|
|
181
193
|
case "end":
|
|
182
|
-
return
|
|
194
|
+
return _context4.stop();
|
|
183
195
|
}
|
|
184
|
-
},
|
|
196
|
+
}, _callee4, null, [[2, 8]]);
|
|
185
197
|
}));
|
|
186
198
|
return function (_x) {
|
|
187
|
-
return
|
|
199
|
+
return _ref5.apply(this, arguments);
|
|
188
200
|
};
|
|
189
201
|
}());
|
|
190
|
-
|
|
191
|
-
|
|
202
|
+
_context5.prev = 6;
|
|
203
|
+
_context5.next = 9;
|
|
192
204
|
return Promise.allSettled(variablePromises);
|
|
193
205
|
case 9:
|
|
194
206
|
if (!(appProxyRef.current.onAppVariablesReady && typeof appProxyRef.current.onAppVariablesReady === "function")) {
|
|
195
|
-
|
|
207
|
+
_context5.next = 12;
|
|
196
208
|
break;
|
|
197
209
|
}
|
|
198
|
-
|
|
210
|
+
_context5.next = 12;
|
|
199
211
|
return appProxyRef.current.onAppVariablesReady();
|
|
200
212
|
case 12:
|
|
201
|
-
|
|
213
|
+
setTimeout(function () {
|
|
214
|
+
var _appProxyRef$current2;
|
|
215
|
+
notify("app-variables-data-loaded", {
|
|
216
|
+
pageName: (_appProxyRef$current2 = appProxyRef.current) === null || _appProxyRef$current2 === void 0 ? void 0 : _appProxyRef$current2.activePageName
|
|
217
|
+
});
|
|
218
|
+
}, 0);
|
|
219
|
+
_context5.next = 18;
|
|
202
220
|
break;
|
|
203
|
-
case
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
console.error("Error during app startup operations:",
|
|
207
|
-
case
|
|
221
|
+
case 15:
|
|
222
|
+
_context5.prev = 15;
|
|
223
|
+
_context5.t0 = _context5["catch"](6);
|
|
224
|
+
console.error("Error during app startup operations:", _context5.t0);
|
|
225
|
+
case 18:
|
|
208
226
|
case "end":
|
|
209
|
-
return
|
|
227
|
+
return _context5.stop();
|
|
210
228
|
}
|
|
211
|
-
},
|
|
229
|
+
}, _callee5, null, [[6, 15]]);
|
|
212
230
|
}));
|
|
213
231
|
return _executeStartAppOperations.apply(this, arguments);
|
|
214
232
|
}
|
|
215
233
|
var initializeApp = /*#__PURE__*/function () {
|
|
216
|
-
var
|
|
217
|
-
var appProxy, appVariables, _get, APP_VARIABLES, executeAppStartup;
|
|
218
|
-
return _regenerator["default"].wrap(function
|
|
219
|
-
while (1) switch (
|
|
234
|
+
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
235
|
+
var appProxy, appVariables, _get, APP_VARIABLES, executeAppStartup, executeAppBeforeStartup;
|
|
236
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
237
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
220
238
|
case 0:
|
|
221
|
-
|
|
239
|
+
_context3.prev = 0;
|
|
222
240
|
appProxy = (0, _proxyService.createStateProxy)(appContext, [], setAppContext);
|
|
223
241
|
appProxyRef.current = appProxy;
|
|
224
242
|
|
|
@@ -248,7 +266,7 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
248
266
|
|
|
249
267
|
// Execute app startup operations
|
|
250
268
|
executeAppStartup = /*#__PURE__*/function () {
|
|
251
|
-
var
|
|
269
|
+
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
252
270
|
var startUpActions, _iterator, _step, actionName, action;
|
|
253
271
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
254
272
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -279,15 +297,32 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
279
297
|
}, _callee);
|
|
280
298
|
}));
|
|
281
299
|
return function executeAppStartup() {
|
|
282
|
-
return
|
|
300
|
+
return _ref3.apply(this, arguments);
|
|
283
301
|
};
|
|
284
302
|
}();
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
303
|
+
executeAppBeforeStartup = /*#__PURE__*/function () {
|
|
304
|
+
var _ref4 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
305
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
306
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
307
|
+
case 0:
|
|
308
|
+
appProxy.hasOwnProperty("onBeforeAppReady") && appProxy.onBeforeAppReady();
|
|
309
|
+
return _context2.abrupt("return", Promise.resolve());
|
|
310
|
+
case 2:
|
|
311
|
+
case "end":
|
|
312
|
+
return _context2.stop();
|
|
313
|
+
}
|
|
314
|
+
}, _callee2);
|
|
315
|
+
}));
|
|
316
|
+
return function executeAppBeforeStartup() {
|
|
317
|
+
return _ref4.apply(this, arguments);
|
|
318
|
+
};
|
|
319
|
+
}(); // onBeforeAppReady should call before calling anything
|
|
320
|
+
_context3.next = 12;
|
|
321
|
+
return executeAppBeforeStartup();
|
|
322
|
+
case 12:
|
|
323
|
+
_context3.next = 14;
|
|
289
324
|
return executeAppStartup();
|
|
290
|
-
case
|
|
325
|
+
case 14:
|
|
291
326
|
// Initialize DialogService in appstore
|
|
292
327
|
_appstore["default"].DialogService.set(_dialog["default"]);
|
|
293
328
|
|
|
@@ -300,25 +335,25 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
300
335
|
isAppReady: true
|
|
301
336
|
});
|
|
302
337
|
});
|
|
303
|
-
|
|
338
|
+
_context3.next = 22;
|
|
304
339
|
break;
|
|
305
|
-
case
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
console.error("Error initializing app:",
|
|
340
|
+
case 18:
|
|
341
|
+
_context3.prev = 18;
|
|
342
|
+
_context3.t0 = _context3["catch"](0);
|
|
343
|
+
console.error("Error initializing app:", _context3.t0);
|
|
309
344
|
setAppContext(function (prev) {
|
|
310
345
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
311
346
|
isAppReady: true
|
|
312
347
|
});
|
|
313
348
|
});
|
|
314
|
-
case
|
|
349
|
+
case 22:
|
|
315
350
|
case "end":
|
|
316
|
-
return
|
|
351
|
+
return _context3.stop();
|
|
317
352
|
}
|
|
318
|
-
},
|
|
353
|
+
}, _callee3, null, [[0, 18]]);
|
|
319
354
|
}));
|
|
320
355
|
return function initializeApp() {
|
|
321
|
-
return
|
|
356
|
+
return _ref2.apply(this, arguments);
|
|
322
357
|
};
|
|
323
358
|
}();
|
|
324
359
|
function evaluateExpression(fn) {
|
|
@@ -335,8 +370,8 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
335
370
|
}
|
|
336
371
|
function updateActivePage(pageName) {
|
|
337
372
|
if (appProxyRef.current) {
|
|
338
|
-
var _appProxyRef$
|
|
339
|
-
appProxyRef.current.lastActivePage = (_appProxyRef$
|
|
373
|
+
var _appProxyRef$current;
|
|
374
|
+
appProxyRef.current.lastActivePage = (_appProxyRef$current = appProxyRef.current) === null || _appProxyRef$current === void 0 ? void 0 : _appProxyRef$current.activePageName;
|
|
340
375
|
appProxyRef.current.activePageName = pageName;
|
|
341
376
|
}
|
|
342
377
|
}
|
|
@@ -380,7 +415,7 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
380
415
|
locale: locale
|
|
381
416
|
}));
|
|
382
417
|
}
|
|
383
|
-
function notifyApp(message, type,
|
|
418
|
+
function notifyApp(message, type, showTypeLabel) {
|
|
384
419
|
// App-level notification
|
|
385
420
|
var notificationAction = (0, _get2["default"])(appContext, "Actions.appNotification");
|
|
386
421
|
if (notificationAction) {
|
|
@@ -391,7 +426,8 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
391
426
|
content: "inline",
|
|
392
427
|
"class": type || "Success",
|
|
393
428
|
duration: appNotification.duration || 3000,
|
|
394
|
-
toasterPosition: appNotification.toasterPosition || "bottom right"
|
|
429
|
+
toasterPosition: appNotification.toasterPosition || "bottom right",
|
|
430
|
+
showTypeLabel: showTypeLabel !== null && showTypeLabel !== void 0 ? showTypeLabel : false
|
|
395
431
|
};
|
|
396
432
|
};
|
|
397
433
|
notificationAction.config.paramProvider = newParams;
|
|
@@ -459,6 +495,13 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
459
495
|
}));
|
|
460
496
|
});
|
|
461
497
|
};
|
|
498
|
+
(0, _react.useEffect)(function () {
|
|
499
|
+
_metadata.metadataService.setMetadata(appContext === null || appContext === void 0 ? void 0 : appContext.serviceDefinitions);
|
|
500
|
+
(0, _variables.wmSetDependency)("metadata", _metadata.metadataService);
|
|
501
|
+
(0, _variables.wmSetDependency)("appManager", {
|
|
502
|
+
notify: notify
|
|
503
|
+
});
|
|
504
|
+
}, []);
|
|
462
505
|
return __jsx(_AppContext["default"].Provider, {
|
|
463
506
|
value: {
|
|
464
507
|
state: appContext,
|
|
@@ -12,6 +12,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
|
|
14
14
|
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
|
|
15
|
+
var _utils = require("../components/input/epoch/datetime/utils");
|
|
15
16
|
var _excluded = ["formControlName", "name", "required", "datavalue", "outputformat", "mindate", "maxdate", "excludedays", "excludedates", "dataentrymode", "datepattern", "timepattern", "showweeks", "selectfromothermonth", "todaybutton", "clearbutton", "todaybuttonlabel", "clearbuttonlabel", "showcustompicker", "adaptiveposition", "widgetSubType", "context", "viewParent", "invokeEventCallback", "formControlRegistry", "ref"];
|
|
16
17
|
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" != _typeof3(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); }
|
|
17
18
|
var __jsx = _react["default"].createElement;
|
|
@@ -90,14 +91,11 @@ var withBaseDateTime = function withBaseDateTime(WrappedComponent) {
|
|
|
90
91
|
|
|
91
92
|
// State management
|
|
92
93
|
var _useState = (0, _react.useState)(datavalue),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
var _useState2 = (0, _react.useState)(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var _useState3 = (0, _react.useState)(false),
|
|
99
|
-
showPicker = _useState3[0],
|
|
100
|
-
setShowPicker = _useState3[1];
|
|
94
|
+
prevValue = _useState[0],
|
|
95
|
+
setPrevValue = _useState[1];
|
|
96
|
+
var _useState2 = (0, _react.useState)(false),
|
|
97
|
+
showPicker = _useState2[0],
|
|
98
|
+
setShowPicker = _useState2[1];
|
|
101
99
|
|
|
102
100
|
// Refs
|
|
103
101
|
var datepickerRef = (0, _react.useRef)(null);
|
|
@@ -154,9 +152,25 @@ var withBaseDateTime = function withBaseDateTime(WrappedComponent) {
|
|
|
154
152
|
}, []);
|
|
155
153
|
var getFormattedDate = (0, _react.useCallback)(function (date, pattern, timezone) {
|
|
156
154
|
if (!date) return "";
|
|
157
|
-
var selectedTimezone = timezone || _momentTimezone["default"].tz.guess();
|
|
158
155
|
var selectedPattern = pattern || outputformat;
|
|
159
|
-
|
|
156
|
+
|
|
157
|
+
// Handle special patterns
|
|
158
|
+
if (selectedPattern === "timestamp") {
|
|
159
|
+
return date.getTime().toString();
|
|
160
|
+
}
|
|
161
|
+
if (selectedPattern === "UTC") {
|
|
162
|
+
return date.toISOString();
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
// Map pattern and apply replacements for moment.js compatibility
|
|
166
|
+
var momentPattern = (0, _utils.mapToMomentPattern)(selectedPattern).replaceAll("y", "Y").replaceAll("d", "D").replaceAll("a", "A");
|
|
167
|
+
var tz = timezone || (0, _utils.getTimezone)();
|
|
168
|
+
return (0, _momentTimezone["default"])(date).tz(tz).format(momentPattern);
|
|
169
|
+
} catch (error) {
|
|
170
|
+
console.warn("Date formatting error:", error);
|
|
171
|
+
var _tz = timezone || (0, _utils.getTimezone)();
|
|
172
|
+
return (0, _momentTimezone["default"])(date).tz(_tz).format((0, _utils.mapToMomentPattern)(selectedPattern));
|
|
173
|
+
}
|
|
160
174
|
}, [outputformat]);
|
|
161
175
|
var isValidDate = (0, _react.useCallback)(function (date) {
|
|
162
176
|
return date instanceof Date && !isNaN(date.getTime());
|
|
@@ -209,10 +223,14 @@ var withBaseDateTime = function withBaseDateTime(WrappedComponent) {
|
|
|
209
223
|
};
|
|
210
224
|
}, [required]);
|
|
211
225
|
|
|
226
|
+
// Keep prevValue in sync with parent datavalue for invokeOnChange oldVal
|
|
227
|
+
(0, _react.useEffect)(function () {
|
|
228
|
+
setPrevValue(datavalue);
|
|
229
|
+
}, [datavalue]);
|
|
230
|
+
|
|
212
231
|
// Effects
|
|
213
232
|
(0, _react.useEffect)(function () {
|
|
214
233
|
if (widgetSubType !== null && widgetSubType !== void 0 && widgetSubType.startsWith(CUSTOM_WIDGET_PREFIX)) return;
|
|
215
|
-
setControlValue(datavalue);
|
|
216
234
|
invokeOnChange(datavalue);
|
|
217
235
|
updatePrevDatavalue(datavalue);
|
|
218
236
|
}, [datavalue, widgetSubType, invokeOnChange, updatePrevDatavalue]);
|
|
@@ -221,7 +239,7 @@ var withBaseDateTime = function withBaseDateTime(WrappedComponent) {
|
|
|
221
239
|
var enhancedProps = (0, _react.useMemo)(function () {
|
|
222
240
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
223
241
|
ref: ref,
|
|
224
|
-
datavalue:
|
|
242
|
+
datavalue: datavalue,
|
|
225
243
|
formControlName: formControlName,
|
|
226
244
|
getFormattedDate: getFormattedDate,
|
|
227
245
|
invokeOnChange: invokeOnChange,
|
|
@@ -242,7 +260,7 @@ var withBaseDateTime = function withBaseDateTime(WrappedComponent) {
|
|
|
242
260
|
updatePrevDatavalue: updatePrevDatavalue,
|
|
243
261
|
updateBoundVariable: updateBoundVariable
|
|
244
262
|
});
|
|
245
|
-
}, [restProps,
|
|
263
|
+
}, [restProps, datavalue, name, formControlName, getFormattedDate, invokeOnChange, customValidator, todaybutton, clearbutton, todaybuttonlabel, clearbuttonlabel, showPicker, handleKeyDown, getDateObject, isValidDate, validateDateRange, validateDateFormat, updatePrevDatavalue, updateBoundVariable]);
|
|
246
264
|
return __jsx(WrappedComponent, enhancedProps);
|
|
247
265
|
};
|
|
248
266
|
WithBaseDateTime.displayName = "WithBaseDateTime(".concat(WrappedComponent.displayName || WrappedComponent.name || "Component", ")");
|