@wavemaker/react-runtime 11.14.2-rc.6311 → 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 +824 -724
- 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
|
@@ -7,20 +7,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ModelVariable = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
12
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
10
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
11
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
12
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
15
|
var _lodashEs = require("lodash-es");
|
|
17
16
|
var _baseVariable = require("./base-variable");
|
|
18
17
|
var _variables = require("@wavemaker/variables");
|
|
19
|
-
function
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
20
21
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
function _superPropGet(t, o, e, r) { var p = (0, _get2["default"])((0, _getPrototypeOf2["default"])(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
21
23
|
var ModelVariable = exports.ModelVariable = /*#__PURE__*/function (_ModelVariable3) {
|
|
22
|
-
(0, _inherits2["default"])(ModelVariable, _ModelVariable3);
|
|
23
|
-
var _super = _createSuper(ModelVariable);
|
|
24
24
|
function ModelVariable(config) {
|
|
25
25
|
var _this;
|
|
26
26
|
(0, _classCallCheck2["default"])(this, ModelVariable);
|
|
@@ -34,23 +34,30 @@ var ModelVariable = exports.ModelVariable = /*#__PURE__*/function (_ModelVariabl
|
|
|
34
34
|
isList: config.isList,
|
|
35
35
|
twoWayBinding: config.twoWayBinding
|
|
36
36
|
};
|
|
37
|
-
_this =
|
|
38
|
-
(0, _defineProperty2["default"])(
|
|
39
|
-
(0, _defineProperty2["default"])(
|
|
40
|
-
(0, _defineProperty2["default"])(
|
|
41
|
-
(0, _defineProperty2["default"])(
|
|
37
|
+
_this = _callSuper(this, ModelVariable, [variable]);
|
|
38
|
+
(0, _defineProperty2["default"])(_this, "config", void 0);
|
|
39
|
+
(0, _defineProperty2["default"])(_this, "lastParams", void 0);
|
|
40
|
+
(0, _defineProperty2["default"])(_this, "dataSet", void 0);
|
|
41
|
+
(0, _defineProperty2["default"])(_this, "initialized", false);
|
|
42
42
|
_this.config = config;
|
|
43
43
|
_this.invoke();
|
|
44
44
|
return _this;
|
|
45
45
|
}
|
|
46
|
-
(0,
|
|
46
|
+
(0, _inherits2["default"])(ModelVariable, _ModelVariable3);
|
|
47
|
+
return (0, _createClass2["default"])(ModelVariable, [{
|
|
47
48
|
key: "invoke",
|
|
48
49
|
value: function invoke(params, onSuccess, onError) {
|
|
49
50
|
var result;
|
|
50
51
|
try {
|
|
51
|
-
this.dataSet
|
|
52
|
+
if (this.dataSet && this.config.paramProvider()) {
|
|
53
|
+
this.dataSet = _objectSpread(_objectSpread({}, this.config.paramProvider()), this.dataSet);
|
|
54
|
+
} else if (this.dataSet && Object.keys(this.dataSet).length !== 0) {
|
|
55
|
+
this.dataSet = _objectSpread({}, this.dataSet);
|
|
56
|
+
} else {
|
|
57
|
+
this.dataSet = this.config.paramProvider();
|
|
58
|
+
}
|
|
52
59
|
this.notify(_baseVariable.VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);
|
|
53
|
-
result = (
|
|
60
|
+
result = _superPropGet(ModelVariable, "execute", this, 3)([params, function () {}]);
|
|
54
61
|
this.config.onSuccess && this.config.onSuccess(this, this.dataSet);
|
|
55
62
|
onSuccess && onSuccess(this, this.dataSet);
|
|
56
63
|
this.notify(_baseVariable.VariableEvents.SUCCESS, [this, this.dataSet]);
|
|
@@ -73,5 +80,4 @@ var ModelVariable = exports.ModelVariable = /*#__PURE__*/function (_ModelVariabl
|
|
|
73
80
|
return Promise.resolve(this);
|
|
74
81
|
}
|
|
75
82
|
}]);
|
|
76
|
-
return ModelVariable;
|
|
77
83
|
}(_variables.ModelVariable);
|
|
@@ -9,11 +9,10 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
16
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
17
|
var _baseVariable = require("./base-variable");
|
|
19
18
|
var _lodashEs = require("lodash-es");
|
|
@@ -22,18 +21,23 @@ var _variables = require("@wavemaker/variables");
|
|
|
22
21
|
var _useHttp = require("@wavemaker/react-runtime/hooks/useHttp");
|
|
23
22
|
var _formatUtil = require("../utils/format-util");
|
|
24
23
|
var _eventNotifier = _interopRequireDefault(require("@wavemaker/react-runtime/core/event-notifier"));
|
|
25
|
-
|
|
24
|
+
var _formatters = _interopRequireDefault(require("@wavemaker/react-runtime/core/formatters"));
|
|
25
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
26
26
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
27
|
+
function _superPropGet(t, o, e, r) { var p = (0, _get2["default"])((0, _getPrototypeOf2["default"])(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
27
28
|
var _ServiceVariableEvents = /*#__PURE__*/function (_ServiceVariableEvents) {
|
|
28
29
|
_ServiceVariableEvents["BEFORE_INVOKE"] = "beforeInvoke";
|
|
29
30
|
return _ServiceVariableEvents;
|
|
30
31
|
}(_ServiceVariableEvents || {});
|
|
31
32
|
var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceVariable3) {
|
|
32
|
-
(0, _inherits2["default"])(ServiceVariable, _ServiceVariable3);
|
|
33
|
-
var _super = _createSuper(ServiceVariable);
|
|
34
33
|
function ServiceVariable(config) {
|
|
35
34
|
var _this;
|
|
36
35
|
(0, _classCallCheck2["default"])(this, ServiceVariable);
|
|
36
|
+
// Store context in httpService for global access
|
|
37
|
+
if (config._context) {
|
|
38
|
+
_useHttp.httpService.setContext(config._context);
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
// Initialize with minimal configuration first
|
|
38
42
|
var variableConfig = {
|
|
39
43
|
name: config.name,
|
|
@@ -65,7 +69,9 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
65
69
|
onError: function onError(context, args) {
|
|
66
70
|
_this.notify(_baseVariable.VariableEvents.AFTER_INVOKE, [args.variable, args.data, args.options]);
|
|
67
71
|
_this.notify(_baseVariable.VariableEvents.ERROR, [args.variable, args.data, args.options]);
|
|
68
|
-
|
|
72
|
+
if (args.data.includes("Violation")) {
|
|
73
|
+
_eventNotifier["default"].ROOT.notify("SERVICE_ERROR", [args.variable, args.data, args.options]);
|
|
74
|
+
}
|
|
69
75
|
return config.onError && config.onError(args.variable, args.data, args.options);
|
|
70
76
|
},
|
|
71
77
|
onCanUpdate: function onCanUpdate(context, args) {
|
|
@@ -82,19 +88,24 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
82
88
|
return config.onBeforeDatasetReady && config.onBeforeDatasetReady(args.variable, args.data, args.options);
|
|
83
89
|
}
|
|
84
90
|
};
|
|
85
|
-
_this =
|
|
91
|
+
_this = _callSuper(this, ServiceVariable, [variableConfig]);
|
|
86
92
|
|
|
87
93
|
// Set up event handlers
|
|
88
94
|
_this.config = config;
|
|
89
|
-
(0, _defineProperty2["default"])(
|
|
90
|
-
(0, _defineProperty2["default"])(
|
|
91
|
-
(0, _defineProperty2["default"])(
|
|
92
|
-
(0, _defineProperty2["default"])(
|
|
95
|
+
(0, _defineProperty2["default"])(_this, "cancelTokenSource", void 0);
|
|
96
|
+
(0, _defineProperty2["default"])(_this, "initialized", false);
|
|
97
|
+
(0, _defineProperty2["default"])(_this, "params", undefined);
|
|
98
|
+
(0, _defineProperty2["default"])(_this, "lastInvokedParams", undefined);
|
|
99
|
+
(0, _defineProperty2["default"])(_this, "dateFormatter", void 0);
|
|
100
|
+
(0, _defineProperty2["default"])(_this, "lastParams", undefined);
|
|
101
|
+
(0, _defineProperty2["default"])(_this, "lastParamProviderValues", undefined);
|
|
93
102
|
_this.setupEventHandlers(config);
|
|
103
|
+
_this.dateFormatter = _formatters["default"].get("toDate");
|
|
94
104
|
return _this;
|
|
95
105
|
}
|
|
96
106
|
// Method to update firstRecord and lastRecord from the current dataset
|
|
97
|
-
(0,
|
|
107
|
+
(0, _inherits2["default"])(ServiceVariable, _ServiceVariable3);
|
|
108
|
+
return (0, _createClass2["default"])(ServiceVariable, [{
|
|
98
109
|
key: "updateFirstAndLastRecord",
|
|
99
110
|
value: function updateFirstAndLastRecord(data) {
|
|
100
111
|
try {
|
|
@@ -113,72 +124,50 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
113
124
|
console.error("Error updating firstRecord and lastRecord:", error);
|
|
114
125
|
}
|
|
115
126
|
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "initialize",
|
|
118
|
-
value: function () {
|
|
119
|
-
var _initialize = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
120
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
121
|
-
while (1) switch (_context.prev = _context.next) {
|
|
122
|
-
case 0:
|
|
123
|
-
_context.next = 2;
|
|
124
|
-
return this.completeInitialization();
|
|
125
|
-
case 2:
|
|
126
|
-
case "end":
|
|
127
|
-
return _context.stop();
|
|
128
|
-
}
|
|
129
|
-
}, _callee, this);
|
|
130
|
-
}));
|
|
131
|
-
function initialize() {
|
|
132
|
-
return _initialize.apply(this, arguments);
|
|
133
|
-
}
|
|
134
|
-
return initialize;
|
|
135
|
-
}()
|
|
136
127
|
}, {
|
|
137
128
|
key: "setupEventHandlers",
|
|
138
129
|
value: function setupEventHandlers(config) {
|
|
139
130
|
// Implementation for setting up event handlers
|
|
140
131
|
}
|
|
141
|
-
}, {
|
|
142
|
-
key: "completeInitialization",
|
|
143
|
-
value: function () {
|
|
144
|
-
var _completeInitialization = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
145
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
146
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
147
|
-
case 0:
|
|
148
|
-
// Complete the initialization with actual data
|
|
149
|
-
this.dataSet = this.config.paramProvider();
|
|
150
|
-
this.serviceInfo = this.config.getServiceInfo();
|
|
151
|
-
this.init();
|
|
152
|
-
case 3:
|
|
153
|
-
case "end":
|
|
154
|
-
return _context2.stop();
|
|
155
|
-
}
|
|
156
|
-
}, _callee2, this);
|
|
157
|
-
}));
|
|
158
|
-
function completeInitialization() {
|
|
159
|
-
return _completeInitialization.apply(this, arguments);
|
|
160
|
-
}
|
|
161
|
-
return completeInitialization;
|
|
162
|
-
}()
|
|
163
132
|
}, {
|
|
164
133
|
key: "invokeOnParamChange",
|
|
165
134
|
value: function () {
|
|
166
|
-
var _invokeOnParamChange = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
135
|
+
var _invokeOnParamChange = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
167
136
|
var _this2 = this;
|
|
168
|
-
var latest, last;
|
|
169
|
-
return _regenerator["default"].wrap(function
|
|
170
|
-
while (1) switch (
|
|
137
|
+
var currentParams, currentParamProvider, currentDataBinding, paramsChanged, paramProviderChanged, latest, last;
|
|
138
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
139
|
+
while (1) switch (_context.prev = _context.next) {
|
|
171
140
|
case 0:
|
|
172
|
-
|
|
141
|
+
// Get current values from all sources
|
|
142
|
+
currentParams = this.params || {};
|
|
143
|
+
currentParamProvider = this.config.paramProvider() || {};
|
|
144
|
+
currentDataBinding = this.dataBinding || {}; // Detect what CHANGED since last invocation
|
|
145
|
+
paramsChanged = !(0, _lodashEs.isEqual)(this.lastParams, currentParams);
|
|
146
|
+
paramProviderChanged = !(0, _lodashEs.isEqual)(this.lastParamProviderValues, currentParamProvider); // Smart merge based on what actually changed:
|
|
147
|
+
if (paramsChanged && !paramProviderChanged) {
|
|
148
|
+
// Only script/params changed → params should win
|
|
149
|
+
latest = (0, _lodashEs.merge)({}, currentParamProvider, currentDataBinding, currentParams);
|
|
150
|
+
} else if (paramProviderChanged && !paramsChanged) {
|
|
151
|
+
// Only UI/paramProvider changed → paramProvider should win
|
|
152
|
+
latest = (0, _lodashEs.merge)({}, currentParams, currentDataBinding, currentParamProvider);
|
|
153
|
+
} else if (paramsChanged && paramProviderChanged) {
|
|
154
|
+
// Both changed → params wins (script is more intentional than UI)
|
|
155
|
+
latest = (0, _lodashEs.merge)({}, currentParamProvider, currentDataBinding, currentParams);
|
|
156
|
+
} else {
|
|
157
|
+
// Neither changed (first call) → params wins by default
|
|
158
|
+
latest = (0, _lodashEs.merge)({}, currentParamProvider, currentDataBinding, currentParams);
|
|
159
|
+
}
|
|
173
160
|
last = this.lastInvokedParams || {};
|
|
174
161
|
if (!(!(0, _lodashEs.isEqual)(last, latest) && latest !== undefined && !(0, _lodashEs.isEmpty)(latest))) {
|
|
175
|
-
|
|
162
|
+
_context.next = 21;
|
|
176
163
|
break;
|
|
177
164
|
}
|
|
178
|
-
// Update
|
|
165
|
+
// Update all tracking values
|
|
179
166
|
this.lastInvokedParams = (0, _common.deepCopy)({}, latest);
|
|
180
|
-
|
|
181
|
-
|
|
167
|
+
this.lastParams = (0, _common.deepCopy)({}, currentParams);
|
|
168
|
+
this.lastParamProviderValues = (0, _common.deepCopy)({}, currentParamProvider);
|
|
169
|
+
_context.prev = 11;
|
|
170
|
+
_context.next = 14;
|
|
182
171
|
return new Promise(function (resolve, reject) {
|
|
183
172
|
_this2.invoke(latest, function (data) {
|
|
184
173
|
return resolve(data);
|
|
@@ -186,20 +175,27 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
186
175
|
return reject(error);
|
|
187
176
|
});
|
|
188
177
|
});
|
|
189
|
-
case
|
|
190
|
-
|
|
178
|
+
case 14:
|
|
179
|
+
_context.next = 19;
|
|
191
180
|
break;
|
|
192
|
-
case
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
console.error("Error in invokeOnParamChange:",
|
|
196
|
-
case
|
|
197
|
-
|
|
198
|
-
|
|
181
|
+
case 16:
|
|
182
|
+
_context.prev = 16;
|
|
183
|
+
_context.t0 = _context["catch"](11);
|
|
184
|
+
console.error("Error in invokeOnParamChange:", _context.t0);
|
|
185
|
+
case 19:
|
|
186
|
+
_context.next = 23;
|
|
187
|
+
break;
|
|
188
|
+
case 21:
|
|
189
|
+
// Even if not invoking, update tracking to detect future changes
|
|
190
|
+
this.lastParams = (0, _common.deepCopy)({}, currentParams);
|
|
191
|
+
this.lastParamProviderValues = (0, _common.deepCopy)({}, currentParamProvider);
|
|
192
|
+
case 23:
|
|
193
|
+
return _context.abrupt("return", this);
|
|
194
|
+
case 24:
|
|
199
195
|
case "end":
|
|
200
|
-
return
|
|
196
|
+
return _context.stop();
|
|
201
197
|
}
|
|
202
|
-
},
|
|
198
|
+
}, _callee, this, [[11, 16]]);
|
|
203
199
|
}));
|
|
204
200
|
function invokeOnParamChange() {
|
|
205
201
|
return _invokeOnParamChange.apply(this, arguments);
|
|
@@ -209,11 +205,11 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
209
205
|
}, {
|
|
210
206
|
key: "doNext",
|
|
211
207
|
value: function () {
|
|
212
|
-
var _doNext = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
208
|
+
var _doNext = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
213
209
|
var _this3 = this;
|
|
214
210
|
var page;
|
|
215
|
-
return _regenerator["default"].wrap(function
|
|
216
|
-
while (1) switch (
|
|
211
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
212
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
217
213
|
case 0:
|
|
218
214
|
page = 0;
|
|
219
215
|
if ((0, _lodashEs.isString)(this.pagination.page)) {
|
|
@@ -221,7 +217,7 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
221
217
|
} else {
|
|
222
218
|
page = this.pagination.page + 1;
|
|
223
219
|
}
|
|
224
|
-
return
|
|
220
|
+
return _context2.abrupt("return", new Promise(function (resolve, reject) {
|
|
225
221
|
_this3.invoke({
|
|
226
222
|
page: page
|
|
227
223
|
}, function (dataset) {
|
|
@@ -230,9 +226,9 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
230
226
|
}));
|
|
231
227
|
case 3:
|
|
232
228
|
case "end":
|
|
233
|
-
return
|
|
229
|
+
return _context2.stop();
|
|
234
230
|
}
|
|
235
|
-
},
|
|
231
|
+
}, _callee2, this);
|
|
236
232
|
}));
|
|
237
233
|
function doNext() {
|
|
238
234
|
return _doNext.apply(this, arguments);
|
|
@@ -254,13 +250,23 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
254
250
|
}
|
|
255
251
|
options = options || {};
|
|
256
252
|
options.inputFields = this.params;
|
|
253
|
+
this.lastInvokedParams = this.params;
|
|
257
254
|
|
|
255
|
+
// Normalize orderBy option
|
|
256
|
+
if (!options.orderBy) {
|
|
257
|
+
var cfg = this.config;
|
|
258
|
+
var defaultOrder = (cfg === null || cfg === void 0 ? void 0 : cfg.orderBy) || (cfg === null || cfg === void 0 ? void 0 : cfg.orderby) || this.orderBy || this.orderby;
|
|
259
|
+
if (defaultOrder) {
|
|
260
|
+
var norm = String(defaultOrder);
|
|
261
|
+
options.orderBy = norm.includes(":") ? norm.replace(/:/g, " ") : norm;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
258
264
|
// Get the latest service definition
|
|
259
265
|
this.serviceInfo = this.config.getServiceInfo();
|
|
260
266
|
if (!this.serviceInfo) {
|
|
261
267
|
console.error("Service Info is missing for (".concat(this.name, ") variable."));
|
|
262
268
|
}
|
|
263
|
-
return (
|
|
269
|
+
return _superPropGet(ServiceVariable, "invoke", this, 3)([options, onSuccess, onError]);
|
|
264
270
|
}
|
|
265
271
|
}, {
|
|
266
272
|
key: "setInput",
|
|
@@ -269,7 +275,6 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
269
275
|
return this.params;
|
|
270
276
|
}
|
|
271
277
|
}]);
|
|
272
|
-
return ServiceVariable;
|
|
273
278
|
}(_variables.ServiceVariable);
|
|
274
279
|
var _setInput = exports._setInput = function _setInput(targetObj, key, val, options) {
|
|
275
280
|
targetObj = targetObj || {};
|