@cxbox-ui/core 1.37.2-alpha.9 → 1.37.3-alpha.0
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/dist/actions/index.d.ts +10 -1
- package/dist/cxbox-ui-core.cjs.development.js +345 -312
- package/dist/cxbox-ui-core.cjs.production.min.js +1 -1
- package/dist/cxbox-ui-core.esm.js +205 -172
- package/dist/cxbox-ui-core.modern.development.js +201 -169
- package/dist/cxbox-ui-core.modern.js +201 -169
- package/dist/cxbox-ui-core.modern.production.min.js +1 -1
- package/dist/interfaces/session.d.ts +1 -0
- package/dist/utils/apiError.d.ts +19 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -153,6 +153,8 @@ __export(actions_exports, {
|
|
|
153
153
|
processPreInvoke: function () { return processPreInvoke; },
|
|
154
154
|
refreshMeta: function () { return refreshMeta; },
|
|
155
155
|
refreshMetaAndReloadPage: function () { return refreshMetaAndReloadPage; },
|
|
156
|
+
refreshMetaDone: function () { return refreshMetaDone; },
|
|
157
|
+
refreshMetaFail: function () { return refreshMetaFail; },
|
|
156
158
|
removeMultivalueTag: function () { return removeMultivalueTag; },
|
|
157
159
|
removeNotifications: function () { return removeNotifications; },
|
|
158
160
|
removePendingRequest: function () { return removePendingRequest; },
|
|
@@ -272,6 +274,8 @@ var switchDebugMode = (0, import_toolkit.createAction)("switchDebugMode");
|
|
|
272
274
|
var exportState = (0, import_toolkit.createAction)("exportState");
|
|
273
275
|
var emptyAction = (0, import_toolkit.createAction)("emptyAction");
|
|
274
276
|
var refreshMeta = (0, import_toolkit.createAction)("refreshMeta");
|
|
277
|
+
var refreshMetaDone = (0, import_toolkit.createAction)("refreshMetaDone");
|
|
278
|
+
var refreshMetaFail = (0, import_toolkit.createAction)("refreshMetaFail");
|
|
275
279
|
var refreshMetaAndReloadPage = (0, import_toolkit.createAction)("refreshMetaAndReloadPage");
|
|
276
280
|
var switchRole = (0, import_toolkit.createAction)("switchRole");
|
|
277
281
|
var addPendingRequest = (0, import_toolkit.createAction)("addPendingRequest");
|
|
@@ -531,6 +535,8 @@ __export(utils_exports, {
|
|
|
531
535
|
buildSearchResultTree: function () { return buildSearchResultTree; },
|
|
532
536
|
buildUrl: function () { return buildUrl; },
|
|
533
537
|
checkShowCondition: function () { return checkShowCondition; },
|
|
538
|
+
createApiError: function () { return createApiError; },
|
|
539
|
+
createApiErrorObservable: function () { return createApiErrorObservable; },
|
|
534
540
|
defaultBuildURL: function () { return defaultBuildURL; },
|
|
535
541
|
defaultParseURL: function () { return defaultParseURL; },
|
|
536
542
|
deleteUndefinedFromObject: function () { return deleteUndefinedFromObject; },
|
|
@@ -578,6 +584,19 @@ function applyRawParams(url, qso) {
|
|
|
578
584
|
var result = new URLSearchParams(qso).toString();
|
|
579
585
|
return "".concat(addTailControlSequences(url)).concat(result && "".concat(result));
|
|
580
586
|
}
|
|
587
|
+
// src/utils/apiError.ts
|
|
588
|
+
var import_core = require("@cxbox-ui/core");
|
|
589
|
+
var import_rxjs = require("rxjs");
|
|
590
|
+
function createApiError(error, context) {
|
|
591
|
+
if (context === void 0) { context = { widgetName: "unknown" }; }
|
|
592
|
+
if (!error.isAxiosError)
|
|
593
|
+
return void 0;
|
|
594
|
+
return import_core.actions.apiError({ error: error, callContext: context });
|
|
595
|
+
}
|
|
596
|
+
function createApiErrorObservable(error, context) {
|
|
597
|
+
var apiError2 = createApiError(error, context);
|
|
598
|
+
return apiError2 ? (0, import_rxjs.of)(apiError2) : import_rxjs.EMPTY;
|
|
599
|
+
}
|
|
581
600
|
// src/utils/strings.ts
|
|
582
601
|
function getTemplate(literals) {
|
|
583
602
|
var placeholders = [];
|
|
@@ -1143,7 +1162,9 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1143
1162
|
state.bo.bc[action.payload.bcName].page = action.payload.page;
|
|
1144
1163
|
state.bo.bc[action.payload.bcName].loading = true;
|
|
1145
1164
|
}).addCase(showViewPopup, function (state, action) {
|
|
1146
|
-
|
|
1165
|
+
var _a, _b;
|
|
1166
|
+
var currentPage = (_b = (_a = state.bo.bc[action.payload.bcName]) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 1;
|
|
1167
|
+
state.bo.bc[action.payload.bcName].page = action.payload.bcName === action.payload.calleeBCName ? currentPage : 1;
|
|
1147
1168
|
state.bo.bc[action.payload.bcName].loading = action.payload.bcName !== action.payload.calleeBCName;
|
|
1148
1169
|
}).addCase(sendOperationSuccess, function (state, action) {
|
|
1149
1170
|
state.bo.bc[action.payload.bcName].loading = false;
|
|
@@ -1172,7 +1193,8 @@ var initialSessionState = {
|
|
|
1172
1193
|
errorMsg: null,
|
|
1173
1194
|
screens: [],
|
|
1174
1195
|
pendingRequests: [],
|
|
1175
|
-
notifications: []
|
|
1196
|
+
notifications: [],
|
|
1197
|
+
isMetaRefreshing: false
|
|
1176
1198
|
};
|
|
1177
1199
|
var createSessionReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(login, function (state) {
|
|
1178
1200
|
state.loginSpin = true;
|
|
@@ -1202,6 +1224,12 @@ var createSessionReducerBuilderManager = function (initialState) { return new Re
|
|
|
1202
1224
|
}).addCase(removeNotifications, function (state, action) {
|
|
1203
1225
|
var closingKeys = action.payload;
|
|
1204
1226
|
state.notifications = state.notifications.filter(function (notification) { return !closingKeys.includes(notification.key); });
|
|
1227
|
+
}).addCase(refreshMeta, function (state) {
|
|
1228
|
+
state.isMetaRefreshing = true;
|
|
1229
|
+
}).addCase(refreshMetaDone, function (state) {
|
|
1230
|
+
state.isMetaRefreshing = false;
|
|
1231
|
+
}).addCase(refreshMetaFail, function (state) {
|
|
1232
|
+
state.isMetaRefreshing = false;
|
|
1205
1233
|
}); };
|
|
1206
1234
|
// src/reducers/view.ts
|
|
1207
1235
|
var import_schema7 = require("@cxbox-ui/schema");
|
|
@@ -1250,8 +1278,8 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1250
1278
|
}).addCase(bcNewDataSuccess, function (state, action) {
|
|
1251
1279
|
state.selectedCell = initialViewState.selectedCell;
|
|
1252
1280
|
}).addCase(forceActiveRmUpdate, function (state, action) {
|
|
1253
|
-
var _a, _b, _c, _d;
|
|
1254
|
-
var
|
|
1281
|
+
var _a, _b, _c, _d, _e;
|
|
1282
|
+
var _f = action.payload, bcName = _f.bcName, bcUrl = _f.bcUrl, currentRecordData = _f.currentRecordData, rowMeta = _f.rowMeta, cursor = _f.cursor;
|
|
1255
1283
|
var handledForceActive = {};
|
|
1256
1284
|
var rowMetaForcedValues = {};
|
|
1257
1285
|
var newPendingChangesDiff = {};
|
|
@@ -1262,6 +1290,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1262
1290
|
forceActiveFieldKeys.push(field.key);
|
|
1263
1291
|
}
|
|
1264
1292
|
});
|
|
1293
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1265
1294
|
var consolidatedFrontData = __assign(__assign({}, currentRecordData), state.pendingDataChanges[bcName][cursor]);
|
|
1266
1295
|
Object.keys(consolidatedFrontData).forEach(function (key) {
|
|
1267
1296
|
if (rowMetaForcedValues[key] !== void 0 && consolidatedFrontData[key] !== rowMetaForcedValues[key]) {
|
|
@@ -1274,12 +1303,12 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1274
1303
|
handledForceActive[key] = newPendingDataChanges[key];
|
|
1275
1304
|
}
|
|
1276
1305
|
});
|
|
1277
|
-
state.handledForceActive[bcName] = (
|
|
1278
|
-
state.handledForceActive[bcName][cursor] = (
|
|
1306
|
+
state.handledForceActive[bcName] = (_b = state.handledForceActive[bcName]) !== null && _b !== void 0 ? _b : {};
|
|
1307
|
+
state.handledForceActive[bcName][cursor] = (_c = state.handledForceActive[bcName][cursor]) !== null && _c !== void 0 ? _c : {};
|
|
1279
1308
|
Object.assign(state.handledForceActive[bcName][cursor], handledForceActive);
|
|
1280
|
-
state.pendingDataChanges[bcName] = (
|
|
1309
|
+
state.pendingDataChanges[bcName] = (_d = state.pendingDataChanges[bcName]) !== null && _d !== void 0 ? _d : {};
|
|
1281
1310
|
state.pendingDataChanges[bcName][cursor] = newPendingDataChanges;
|
|
1282
|
-
state.rowMeta[bcName] = (
|
|
1311
|
+
state.rowMeta[bcName] = (_e = state.rowMeta[bcName]) !== null && _e !== void 0 ? _e : {};
|
|
1283
1312
|
state.rowMeta[bcName][bcUrl] = rowMeta;
|
|
1284
1313
|
}).addCase(changeDataItem, function (state, action) {
|
|
1285
1314
|
var _a, _b, _c;
|
|
@@ -1545,9 +1574,9 @@ __export(epics_exports, {
|
|
|
1545
1574
|
userDrillDownEpic: function () { return userDrillDownEpic; }
|
|
1546
1575
|
});
|
|
1547
1576
|
// src/epics/view/sendOperationEpic.ts
|
|
1548
|
-
var
|
|
1577
|
+
var import_rxjs3 = require("rxjs");
|
|
1549
1578
|
// src/epics/utils/postOperationRoutine.ts
|
|
1550
|
-
var
|
|
1579
|
+
var import_rxjs2 = require("rxjs");
|
|
1551
1580
|
function postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName) {
|
|
1552
1581
|
var postInvokeConfirm = Object.values(OperationPostInvokeConfirmType).includes(postInvoke === null || postInvoke === void 0 ? void 0 : postInvoke.type);
|
|
1553
1582
|
var result = [];
|
|
@@ -1570,12 +1599,12 @@ function postOperationRoutine(widgetName, postInvoke, preInvoke, operationType,
|
|
|
1570
1599
|
preInvoke: preInvoke
|
|
1571
1600
|
}));
|
|
1572
1601
|
}
|
|
1573
|
-
return result.map(function (item) { return (0,
|
|
1602
|
+
return result.map(function (item) { return (0, import_rxjs2.of)(item); });
|
|
1574
1603
|
}
|
|
1575
1604
|
// src/epics/view/sendOperationEpic.ts
|
|
1576
1605
|
var sendOperationEpic = function (action$, state$, _a) {
|
|
1577
1606
|
var api = _a.api;
|
|
1578
|
-
return action$.pipe((0,
|
|
1607
|
+
return action$.pipe((0, import_rxjs3.filter)(sendOperation.match), (0, import_rxjs3.filter)(function (action) { return matchOperationRole("none", action.payload, state$.value); }), (0, import_rxjs3.mergeMap)(function (action) {
|
|
1579
1608
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1580
1609
|
var state = state$.value;
|
|
1581
1610
|
var screenName = state.screen.screenName;
|
|
@@ -1605,13 +1634,13 @@ var sendOperationEpic = function (action$, state$, _a) {
|
|
|
1605
1634
|
params._confirm = confirm;
|
|
1606
1635
|
}
|
|
1607
1636
|
var context = { widgetName: action.payload.widgetName };
|
|
1608
|
-
return api.customAction(screenName, bcUrl, data, context, params).pipe((0,
|
|
1637
|
+
return api.customAction(screenName, bcUrl, data, context, params).pipe((0, import_rxjs3.mergeMap)(function (response) {
|
|
1609
1638
|
var _a, _b;
|
|
1610
1639
|
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
1611
1640
|
var preInvoke = response.preInvoke;
|
|
1612
|
-
return defaultSaveOperation ? ((_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.onSuccessAction) ? (0,
|
|
1613
|
-
(0,
|
|
1614
|
-
}), (0,
|
|
1641
|
+
return defaultSaveOperation ? ((_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.onSuccessAction) ? (0, import_rxjs3.concat)((0, import_rxjs3.of)(bcCancelPendingChanges({ bcNames: [bcName] })), (0, import_rxjs3.of)(action.payload.onSuccessAction)) : import_rxjs3.EMPTY : (0, import_rxjs3.concat).apply(void 0, __spreadArray([(0, import_rxjs3.of)(sendOperationSuccess({ bcName: bcName, cursor: cursor })),
|
|
1642
|
+
(0, import_rxjs3.of)(bcForceUpdate({ bcName: bcName }))], postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName), false));
|
|
1643
|
+
}), (0, import_rxjs3.catchError)(function (e) {
|
|
1615
1644
|
var _a, _b, _c, _d, _e, _f;
|
|
1616
1645
|
console.error(e);
|
|
1617
1646
|
var viewError = null;
|
|
@@ -1621,14 +1650,14 @@ var sendOperationEpic = function (action$, state$, _a) {
|
|
|
1621
1650
|
entityError = (_d = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _d === void 0 ? void 0 : _d.entity;
|
|
1622
1651
|
viewError = (_f = (_e = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _e === void 0 ? void 0 : _e.popup) === null || _f === void 0 ? void 0 : _f[0];
|
|
1623
1652
|
}
|
|
1624
|
-
return (0,
|
|
1653
|
+
return (0, import_rxjs3.concat)((0, import_rxjs3.of)(sendOperationFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError })), createApiErrorObservable(e, context));
|
|
1625
1654
|
}));
|
|
1626
1655
|
}));
|
|
1627
1656
|
};
|
|
1628
1657
|
// src/epics/view/showAssocPopupEpic.ts
|
|
1629
|
-
var
|
|
1658
|
+
var import_rxjs4 = require("rxjs");
|
|
1630
1659
|
var import_schema8 = require("@cxbox-ui/schema");
|
|
1631
|
-
var showAssocPopupEpic = function (action$, state$) { return action$.pipe((0,
|
|
1660
|
+
var showAssocPopupEpic = function (action$, state$) { return action$.pipe((0, import_rxjs4.filter)(showViewPopup.match), (0, import_rxjs4.filter)(function (action) { return !!(action.payload.calleeBCName && action.payload.associateFieldKey); }), (0, import_rxjs4.mergeMap)(function (action) {
|
|
1632
1661
|
var _a, _b, _c, _d;
|
|
1633
1662
|
var _e = action.payload, bcName = _e.bcName, calleeBCName = _e.calleeBCName;
|
|
1634
1663
|
var state = state$.value;
|
|
@@ -1639,7 +1668,7 @@ var showAssocPopupEpic = function (action$, state$) { return action$.pipe((0, im
|
|
|
1639
1668
|
var assocFieldChanges = calleePendingChanges === null || calleePendingChanges === void 0 ? void 0 : calleePendingChanges[assocFieldKey];
|
|
1640
1669
|
var somethingMissing = !assocWidget || !calleePendingChanges || !assocFieldChanges || !assocFieldChanges;
|
|
1641
1670
|
if (somethingMissing || assocWidget.options && !assocWidget.options.hierarchyFull) {
|
|
1642
|
-
return
|
|
1671
|
+
return import_rxjs4.EMPTY;
|
|
1643
1672
|
}
|
|
1644
1673
|
var popupInitPendingChanges = {};
|
|
1645
1674
|
assocFieldChanges.forEach(function (record) {
|
|
@@ -1662,18 +1691,18 @@ var showAssocPopupEpic = function (action$, state$) { return action$.pipe((0, im
|
|
|
1662
1691
|
}
|
|
1663
1692
|
});
|
|
1664
1693
|
}
|
|
1665
|
-
return (0,
|
|
1694
|
+
return (0, import_rxjs4.of)(changeDataItems({
|
|
1666
1695
|
bcName: bcName,
|
|
1667
1696
|
cursors: Object.keys(popupInitPendingChanges),
|
|
1668
1697
|
dataItems: Object.values(popupInitPendingChanges)
|
|
1669
1698
|
}));
|
|
1670
1699
|
})); };
|
|
1671
1700
|
// src/epics/view/fileUploadConfirmEpic.ts
|
|
1672
|
-
var
|
|
1701
|
+
var import_rxjs5 = require("rxjs");
|
|
1673
1702
|
var import_schema9 = require("@cxbox-ui/schema");
|
|
1674
1703
|
var fileUploadConfirmEpic = function (action$, state$, _a) {
|
|
1675
1704
|
var api = _a.api;
|
|
1676
|
-
return action$.pipe((0,
|
|
1705
|
+
return action$.pipe((0, import_rxjs5.filter)(bulkUploadFiles.match), (0, import_rxjs5.mergeMap)(function (action) {
|
|
1677
1706
|
var _a, _b;
|
|
1678
1707
|
var state = state$.value;
|
|
1679
1708
|
var bcName = (_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.bcName;
|
|
@@ -1682,19 +1711,22 @@ var fileUploadConfirmEpic = function (action$, state$, _a) {
|
|
|
1682
1711
|
var data = {
|
|
1683
1712
|
bulkIds: action.payload.fileIds
|
|
1684
1713
|
};
|
|
1685
|
-
return api.customAction(state.screen.screenName, bcUrl, data, null, { _action: "file-upload-save" }).pipe((0,
|
|
1714
|
+
return api.customAction(state.screen.screenName, bcUrl, data, null, { _action: "file-upload-save" }).pipe((0, import_rxjs5.mergeMap)(function (response) {
|
|
1686
1715
|
var _a;
|
|
1687
1716
|
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
1688
1717
|
var preInvoke = response.preInvoke;
|
|
1689
|
-
return (0,
|
|
1690
|
-
(0,
|
|
1691
|
-
(0,
|
|
1718
|
+
return (0, import_rxjs5.concat).apply(void 0, __spreadArray([(0, import_rxjs5.of)(sendOperationSuccess({ bcName: bcName, cursor: null })),
|
|
1719
|
+
(0, import_rxjs5.of)(bcForceUpdate({ bcName: bcName })),
|
|
1720
|
+
(0, import_rxjs5.of)(closeViewPopup(null))], postOperationRoutine(widgetName, postInvoke, preInvoke, import_schema9.OperationTypeCrud.save, bcName), false));
|
|
1721
|
+
}), (0, import_rxjs5.catchError)(function (error) {
|
|
1722
|
+
console.error(error);
|
|
1723
|
+
return createApiErrorObservable(error);
|
|
1692
1724
|
}));
|
|
1693
1725
|
}));
|
|
1694
1726
|
};
|
|
1695
1727
|
// src/epics/view/selectTableCellInitEpic.ts
|
|
1696
|
-
var
|
|
1697
|
-
var selectTableCellInitEpic = function (action$, state$) { return action$.pipe((0,
|
|
1728
|
+
var import_rxjs6 = require("rxjs");
|
|
1729
|
+
var selectTableCellInitEpic = function (action$, state$) { return action$.pipe((0, import_rxjs6.filter)(selectTableCellInit.match), (0, import_rxjs6.mergeMap)(function (action) {
|
|
1698
1730
|
var _a;
|
|
1699
1731
|
var resultObservables = [];
|
|
1700
1732
|
var state = state$.value;
|
|
@@ -1704,24 +1736,24 @@ var selectTableCellInitEpic = function (action$, state$) { return action$.pipe((
|
|
|
1704
1736
|
var nextBcCursor = (_a = state.screen.bo.bc[nextBcName]) === null || _a === void 0 ? void 0 : _a.cursor;
|
|
1705
1737
|
var selectedCell = state.view.selectedCell;
|
|
1706
1738
|
if (nextRowId !== nextBcCursor) {
|
|
1707
|
-
resultObservables.push((0,
|
|
1739
|
+
resultObservables.push((0, import_rxjs6.of)(bcSelectRecord({ bcName: nextBcName, cursor: nextRowId })));
|
|
1708
1740
|
}
|
|
1709
1741
|
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || (nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.name) !== selectedCell.widgetName) {
|
|
1710
|
-
resultObservables.push((0,
|
|
1742
|
+
resultObservables.push((0, import_rxjs6.of)(selectTableCell({ widgetName: nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.name, rowId: nextRowId, fieldKey: fieldKey })));
|
|
1711
1743
|
}
|
|
1712
|
-
return (0,
|
|
1744
|
+
return (0, import_rxjs6.concat).apply(void 0, resultObservables);
|
|
1713
1745
|
})); };
|
|
1714
1746
|
// src/epics/view/showFileUploadPopupEpic.ts
|
|
1715
|
-
var
|
|
1747
|
+
var import_rxjs7 = require("rxjs");
|
|
1716
1748
|
var import_schema10 = require("@cxbox-ui/schema");
|
|
1717
|
-
var showFileUploadPopupEpic = function (action$, state$) { return action$.pipe((0,
|
|
1749
|
+
var showFileUploadPopupEpic = function (action$, state$) { return action$.pipe((0, import_rxjs7.filter)(sendOperation.match), (0, import_rxjs7.filter)(function (action) { return matchOperationRole(import_schema10.OperationTypeCrud.fileUpload, action.payload, state$.value); }), (0, import_rxjs7.mergeMap)(function (action) {
|
|
1718
1750
|
var _a;
|
|
1719
|
-
return (0,
|
|
1751
|
+
return (0, import_rxjs7.concat)((0, import_rxjs7.of)(bcChangeCursors({ cursorsMap: (_a = {}, _a[action.payload.bcName] = null, _a) })), (0, import_rxjs7.of)(showFileUploadPopup({ widgetName: action.payload.widgetName })));
|
|
1720
1752
|
})); };
|
|
1721
1753
|
// src/epics/view/sendOperationAssociateEpic.ts
|
|
1722
|
-
var
|
|
1754
|
+
var import_rxjs8 = require("rxjs");
|
|
1723
1755
|
var import_schema11 = require("@cxbox-ui/schema");
|
|
1724
|
-
var sendOperationAssociateEpic = function (action$, state$) { return action$.pipe((0,
|
|
1756
|
+
var sendOperationAssociateEpic = function (action$, state$) { return action$.pipe((0, import_rxjs8.filter)(sendOperation.match), (0, import_rxjs8.filter)(function (action) { return matchOperationRole(import_schema11.OperationTypeCrud.associate, action.payload, state$.value); }), (0, import_rxjs8.map)(function (action) {
|
|
1725
1757
|
return showViewPopup({
|
|
1726
1758
|
// TODO: 2.0.0 bcKey and bcName will be removed in favor `widgetName`
|
|
1727
1759
|
bcName: action.payload.bcKey ? "".concat(action.payload.bcKey) : "".concat(action.payload.bcName, "Assoc"),
|
|
@@ -1731,31 +1763,31 @@ var sendOperationAssociateEpic = function (action$, state$) { return action$.pip
|
|
|
1731
1763
|
});
|
|
1732
1764
|
})); };
|
|
1733
1765
|
// src/epics/view/getRowMetaByForceActiveEpic.ts
|
|
1734
|
-
var
|
|
1766
|
+
var import_rxjs9 = require("rxjs");
|
|
1735
1767
|
var import_schema12 = require("@cxbox-ui/schema");
|
|
1736
1768
|
var import_toolkit2 = require("@reduxjs/toolkit");
|
|
1737
1769
|
var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
1738
1770
|
var api = _a.api;
|
|
1739
|
-
return action$.pipe((0,
|
|
1740
|
-
var _a, _b, _c, _d;
|
|
1771
|
+
return action$.pipe((0, import_rxjs9.filter)(changeDataItem.match), (0, import_rxjs9.mergeMap)(function (action) {
|
|
1772
|
+
var _a, _b, _c, _d, _e;
|
|
1741
1773
|
var state = state$.value;
|
|
1742
1774
|
var initUrl = state.view.url;
|
|
1743
|
-
var
|
|
1775
|
+
var _f = action.payload, bcName = _f.bcName, cursor = _f.cursor, disableRetry = _f.disableRetry;
|
|
1744
1776
|
var isBcHierarchy = state.view.widgets.some(function (widget) {
|
|
1745
1777
|
var _a, _b;
|
|
1746
1778
|
return widget.bcName === bcName && widget.type === import_schema12.WidgetTypes.AssocListPopup && (((_a = widget.options) === null || _a === void 0 ? void 0 : _a.hierarchySameBc) || ((_b = widget.options) === null || _b === void 0 ? void 0 : _b.hierarchyFull));
|
|
1747
1779
|
});
|
|
1748
1780
|
if (isBcHierarchy) {
|
|
1749
|
-
return
|
|
1781
|
+
return import_rxjs9.EMPTY;
|
|
1750
1782
|
}
|
|
1751
1783
|
var isPickListPopup = state.view.widgets.find(function (item) { var _a; return item.name === ((_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.widgetName) && [import_schema12.WidgetTypes.PickListPopup, import_schema12.WidgetTypes.FlatTreePopup].includes(item.type); });
|
|
1752
1784
|
var bcUrl = buildBcUrl(bcName, true, state);
|
|
1753
|
-
var pendingChanges = state.view.pendingDataChanges[bcName][cursor];
|
|
1754
|
-
var handledForceActive = ((
|
|
1755
|
-
var currentRecordData = (
|
|
1756
|
-
var fieldsRowMeta = (
|
|
1785
|
+
var pendingChanges = (_a = state.view.pendingDataChanges[bcName]) === null || _a === void 0 ? void 0 : _a[cursor];
|
|
1786
|
+
var handledForceActive = ((_b = state.view.handledForceActive[bcName]) === null || _b === void 0 ? void 0 : _b[cursor]) || {};
|
|
1787
|
+
var currentRecordData = (_c = state.data[bcName]) === null || _c === void 0 ? void 0 : _c.find(function (record) { return record.id === cursor; });
|
|
1788
|
+
var fieldsRowMeta = (_e = (_d = state.view.rowMeta[bcName]) === null || _d === void 0 ? void 0 : _d[bcUrl]) === null || _e === void 0 ? void 0 : _e.fields;
|
|
1757
1789
|
var changedFiledKey = null;
|
|
1758
|
-
var closePopup = (0,
|
|
1790
|
+
var closePopup = (0, import_rxjs9.concat)((0, import_rxjs9.of)(closeViewPopup(null)), (0, import_rxjs9.of)(viewClearPickMap(null)), (0, import_rxjs9.of)(bcRemoveAllFilters({ bcName: bcName })));
|
|
1759
1791
|
var someForceActiveChanged = fieldsRowMeta === null || fieldsRowMeta === void 0 ? void 0 : fieldsRowMeta.filter(function (field) { return field.forceActive && pendingChanges[field.key] !== void 0; }).some(function (field) {
|
|
1760
1792
|
var result = pendingChanges[field.key] !== handledForceActive[field.key];
|
|
1761
1793
|
if (result) {
|
|
@@ -1765,10 +1797,10 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1765
1797
|
});
|
|
1766
1798
|
var requestId = (0, import_toolkit2.nanoid)();
|
|
1767
1799
|
if (someForceActiveChanged && !disableRetry) {
|
|
1768
|
-
return (0,
|
|
1769
|
-
var result = [(0,
|
|
1800
|
+
return (0, import_rxjs9.concat)((0, import_rxjs9.of)(addPendingRequest({ request: { requestId: requestId, type: "force-active" } })), api.getRmByForceActive(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: currentRecordData === null || currentRecordData === void 0 ? void 0 : currentRecordData.vstamp })).pipe((0, import_rxjs9.mergeMap)(function (data) {
|
|
1801
|
+
var result = [(0, import_rxjs9.of)(removePendingRequest({ requestId: requestId }))];
|
|
1770
1802
|
if (state.view.url === initUrl) {
|
|
1771
|
-
result.push((0,
|
|
1803
|
+
result.push((0, import_rxjs9.of)(forceActiveRmUpdate({
|
|
1772
1804
|
rowMeta: data,
|
|
1773
1805
|
currentRecordData: currentRecordData,
|
|
1774
1806
|
bcName: bcName,
|
|
@@ -1779,8 +1811,8 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1779
1811
|
if (isPickListPopup) {
|
|
1780
1812
|
result.push(closePopup);
|
|
1781
1813
|
}
|
|
1782
|
-
return (0,
|
|
1783
|
-
}), (0,
|
|
1814
|
+
return (0, import_rxjs9.concat).apply(void 0, result);
|
|
1815
|
+
}), (0, import_rxjs9.catchError)(function (e) {
|
|
1784
1816
|
var _a;
|
|
1785
1817
|
var _b, _c, _d, _e, _f, _g;
|
|
1786
1818
|
console.error(e);
|
|
@@ -1791,36 +1823,36 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1791
1823
|
entityError = (_e = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _e === void 0 ? void 0 : _e.entity;
|
|
1792
1824
|
viewError = (_g = (_f = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _f === void 0 ? void 0 : _f.popup) === null || _g === void 0 ? void 0 : _g[0];
|
|
1793
1825
|
}
|
|
1794
|
-
return (0,
|
|
1826
|
+
return (0, import_rxjs9.concat)((0, import_rxjs9.of)(removePendingRequest({ requestId: requestId })), state.view.url === initUrl ? (0, import_rxjs9.concat)((0, import_rxjs9.of)(changeDataItem({
|
|
1795
1827
|
bcName: bcName,
|
|
1796
1828
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
1797
1829
|
cursor: cursor,
|
|
1798
1830
|
dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData === null || currentRecordData === void 0 ? void 0 : currentRecordData[changedFiledKey], _a),
|
|
1799
1831
|
disableRetry: true
|
|
1800
|
-
})), (0,
|
|
1832
|
+
})), (0, import_rxjs9.of)(forceActiveChangeFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError }))) : import_rxjs9.EMPTY, createApiErrorObservable(e));
|
|
1801
1833
|
})));
|
|
1802
1834
|
}
|
|
1803
|
-
return isPickListPopup ? closePopup :
|
|
1835
|
+
return isPickListPopup ? closePopup : import_rxjs9.EMPTY;
|
|
1804
1836
|
}));
|
|
1805
1837
|
};
|
|
1806
1838
|
// src/epics/view/showAllTableRecordsInitEpic.ts
|
|
1807
|
-
var
|
|
1808
|
-
var showAllTableRecordsInitEpic = function (action$, state$) { return action$.pipe((0,
|
|
1839
|
+
var import_rxjs10 = require("rxjs");
|
|
1840
|
+
var showAllTableRecordsInitEpic = function (action$, state$) { return action$.pipe((0, import_rxjs10.filter)(showAllTableRecordsInit.match), (0, import_rxjs10.mergeMap)(function (action) {
|
|
1809
1841
|
var _a;
|
|
1810
1842
|
var resultObservables = [];
|
|
1811
1843
|
var _b = action.payload, bcName = _b.bcName, cursor = _b.cursor;
|
|
1812
1844
|
var state = state$.value;
|
|
1813
1845
|
var route = state.router;
|
|
1814
|
-
resultObservables.push((0,
|
|
1846
|
+
resultObservables.push((0, import_rxjs10.of)(bcChangeCursors({ cursorsMap: (_a = {}, _a[bcName] = null, _a) })));
|
|
1815
1847
|
var bcPath = route.bcPath.slice(0, route.bcPath.indexOf("".concat(bcName, "/").concat(cursor)));
|
|
1816
1848
|
var url = defaultBuildURL(__assign(__assign({}, route), { bcPath: bcPath }));
|
|
1817
|
-
resultObservables.push((0,
|
|
1818
|
-
resultObservables.push((0,
|
|
1819
|
-
return (0,
|
|
1849
|
+
resultObservables.push((0, import_rxjs10.of)(bcForceUpdate({ bcName: bcName })));
|
|
1850
|
+
resultObservables.push((0, import_rxjs10.of)(changeLocation({ location: defaultParseURL(new URL(url, window.location.origin)) })));
|
|
1851
|
+
return (0, import_rxjs10.concat).apply(void 0, resultObservables);
|
|
1820
1852
|
})); };
|
|
1821
1853
|
// src/epics/view/clearPendingDataChangesAfterCursorChangeEpic.ts
|
|
1822
|
-
var
|
|
1823
|
-
var clearPendingDataChangesAfterCursorChangeEpic = function (action$, state$) { return action$.pipe((0,
|
|
1854
|
+
var import_rxjs11 = require("rxjs");
|
|
1855
|
+
var clearPendingDataChangesAfterCursorChangeEpic = function (action$, state$) { return action$.pipe((0, import_rxjs11.filter)(bcChangeCursors.match), (0, import_rxjs11.mergeMap)(function (action) {
|
|
1824
1856
|
var state = state$.value;
|
|
1825
1857
|
var nextCursors = parseBcCursors(state.router.bcPath) || {};
|
|
1826
1858
|
var cursorsDiffMap = {};
|
|
@@ -1832,13 +1864,13 @@ var clearPendingDataChangesAfterCursorChangeEpic = function (action$, state$) {
|
|
|
1832
1864
|
}
|
|
1833
1865
|
});
|
|
1834
1866
|
if (Object.keys(cursorsDiffMap).length) {
|
|
1835
|
-
return (0,
|
|
1867
|
+
return (0, import_rxjs11.of)(bcChangeCursors({ cursorsMap: cursorsDiffMap }));
|
|
1836
1868
|
}
|
|
1837
|
-
return
|
|
1869
|
+
return import_rxjs11.EMPTY;
|
|
1838
1870
|
})); };
|
|
1839
1871
|
// src/epics/router/drilldownEpic.ts
|
|
1840
|
-
var
|
|
1841
|
-
var drillDownEpic = function (action$, state$) { return action$.pipe((0,
|
|
1872
|
+
var import_rxjs12 = require("rxjs");
|
|
1873
|
+
var drillDownEpic = function (action$, state$) { return action$.pipe((0, import_rxjs12.filter)(drillDown.match), (0, import_rxjs12.switchMap)(function (action) {
|
|
1842
1874
|
var _a, _b;
|
|
1843
1875
|
var state = state$.value;
|
|
1844
1876
|
var url = action.payload.url;
|
|
@@ -1914,7 +1946,7 @@ var drillDownEpic = function (action$, state$) { return action$.pipe((0, import_
|
|
|
1914
1946
|
result.push(changeLocation({ location: defaultParseURL(new URL(makeRelativeUrl(urlBase), window.location.origin)) }));
|
|
1915
1947
|
break;
|
|
1916
1948
|
}
|
|
1917
|
-
return result.length ? (0,
|
|
1949
|
+
return result.length ? (0, import_rxjs12.concat)(result) : import_rxjs12.EMPTY;
|
|
1918
1950
|
})); };
|
|
1919
1951
|
function shallowCompare(prevProps, nextProps, ignore) {
|
|
1920
1952
|
if (ignore === void 0) { ignore = []; }
|
|
@@ -1942,19 +1974,19 @@ function shallowCompare(prevProps, nextProps, ignore) {
|
|
|
1942
1974
|
return diffProps;
|
|
1943
1975
|
}
|
|
1944
1976
|
// src/epics/router/loginDoneEpic.ts
|
|
1945
|
-
var
|
|
1946
|
-
var loginDoneEpic = function (action$, state$) { return action$.pipe((0,
|
|
1977
|
+
var import_rxjs13 = require("rxjs");
|
|
1978
|
+
var loginDoneEpic = function (action$, state$) { return action$.pipe((0, import_rxjs13.filter)(loginDone.match), (0, import_rxjs13.switchMap)(function (action) {
|
|
1947
1979
|
var state = state$.value;
|
|
1948
1980
|
if (state.router.type === "router" /* router */) {
|
|
1949
|
-
return (0,
|
|
1981
|
+
return (0, import_rxjs13.of)(handleRouter(state.router));
|
|
1950
1982
|
}
|
|
1951
1983
|
var nextScreenName = state.router.screenName;
|
|
1952
1984
|
var nextScreen = state.session.screens.find(function (item) { return nextScreenName ? item.name === nextScreenName : item.defaultScreen; }) || state.session.screens[0];
|
|
1953
|
-
return nextScreen ? (0,
|
|
1985
|
+
return nextScreen ? (0, import_rxjs13.of)(selectScreen({ screen: nextScreen })) : (0, import_rxjs13.of)(selectScreenFail({ screenName: nextScreenName }));
|
|
1954
1986
|
})); };
|
|
1955
1987
|
// src/epics/router/selectViewEpic.ts
|
|
1956
|
-
var
|
|
1957
|
-
var changeViewEpic = function (action$, state$) { return action$.pipe((0,
|
|
1988
|
+
var import_rxjs14 = require("rxjs");
|
|
1989
|
+
var changeViewEpic = function (action$, state$) { return action$.pipe((0, import_rxjs14.filter)(selectView.match), (0, import_rxjs14.switchMap)(function (action) {
|
|
1958
1990
|
var state = state$.value;
|
|
1959
1991
|
var nextCursors = parseBcCursors(state.router.bcPath) || {};
|
|
1960
1992
|
var cursorsDiffMap = {};
|
|
@@ -1966,77 +1998,77 @@ var changeViewEpic = function (action$, state$) { return action$.pipe((0, import
|
|
|
1966
1998
|
}
|
|
1967
1999
|
});
|
|
1968
2000
|
if (Object.keys(cursorsDiffMap).length) {
|
|
1969
|
-
return (0,
|
|
2001
|
+
return (0, import_rxjs14.of)(bcChangeCursors({ cursorsMap: cursorsDiffMap }));
|
|
1970
2002
|
}
|
|
1971
|
-
return
|
|
2003
|
+
return import_rxjs14.EMPTY;
|
|
1972
2004
|
})); };
|
|
1973
2005
|
// src/epics/router/handleRouterEpic.ts
|
|
1974
|
-
var
|
|
2006
|
+
var import_rxjs15 = require("rxjs");
|
|
1975
2007
|
var handleRouterEpic = function (action$, state$, _a) {
|
|
1976
2008
|
var api = _a.api;
|
|
1977
|
-
return action$.pipe((0,
|
|
2009
|
+
return action$.pipe((0, import_rxjs15.filter)(handleRouter.match), (0, import_rxjs15.switchMap)(function (action) {
|
|
1978
2010
|
var path = action.payload.path;
|
|
1979
2011
|
var params = action.payload.params;
|
|
1980
|
-
return api.routerRequest(path, params).pipe((0,
|
|
1981
|
-
return
|
|
1982
|
-
}), (0,
|
|
2012
|
+
return api.routerRequest(path, params).pipe((0, import_rxjs15.mergeMap)(function () {
|
|
2013
|
+
return import_rxjs15.EMPTY;
|
|
2014
|
+
}), (0, import_rxjs15.catchError)(function (error) {
|
|
1983
2015
|
console.error(error);
|
|
1984
|
-
return
|
|
2016
|
+
return createApiErrorObservable(error);
|
|
1985
2017
|
}));
|
|
1986
2018
|
}));
|
|
1987
2019
|
};
|
|
1988
2020
|
// src/epics/router/selectScreenEpic.ts
|
|
1989
|
-
var
|
|
1990
|
-
var changeScreen = function (action$, state$) { return action$.pipe((0,
|
|
2021
|
+
var import_rxjs16 = require("rxjs");
|
|
2022
|
+
var changeScreen = function (action$, state$) { return action$.pipe((0, import_rxjs16.filter)(selectScreen.match), (0, import_rxjs16.switchMap)(function (action) {
|
|
1991
2023
|
var state = state$.value;
|
|
1992
2024
|
var nextViewName = state.router.viewName;
|
|
1993
2025
|
var requestedView = state.screen.views.find(function (item) { return item.name === nextViewName; });
|
|
1994
2026
|
var defaultView = !nextViewName && state.screen.primaryView && state.screen.views.find(function (item) { return item.name === state.screen.primaryView; });
|
|
1995
2027
|
var nextView = requestedView || defaultView || state.screen.views[0];
|
|
1996
|
-
return nextView ? (0,
|
|
2028
|
+
return nextView ? (0, import_rxjs16.of)(selectView(nextView)) : (0, import_rxjs16.of)(selectViewFail({ viewName: nextViewName }));
|
|
1997
2029
|
})); };
|
|
1998
2030
|
// src/epics/router/userDrillDownEpic.ts
|
|
1999
|
-
var
|
|
2031
|
+
var import_rxjs17 = require("rxjs");
|
|
2000
2032
|
var userDrillDownEpic = function (action$, state$, _a) {
|
|
2001
2033
|
var api = _a.api;
|
|
2002
|
-
return action$.pipe((0,
|
|
2034
|
+
return action$.pipe((0, import_rxjs17.filter)(userDrillDown.match), (0, import_rxjs17.switchMap)(function (action) {
|
|
2003
2035
|
var state = state$.value;
|
|
2004
2036
|
var _a = action.payload, bcName = _a.bcName, fieldKey = _a.fieldKey, cursor = _a.cursor;
|
|
2005
2037
|
var bcUrl = buildBcUrl(bcName, true, state);
|
|
2006
|
-
return api.fetchRowMeta(state.screen.screenName, bcUrl).pipe((0,
|
|
2038
|
+
return api.fetchRowMeta(state.screen.screenName, bcUrl).pipe((0, import_rxjs17.mergeMap)(function (rowMeta) {
|
|
2007
2039
|
var _a, _b, _c, _d;
|
|
2008
2040
|
var drillDownField = rowMeta.fields.find(function (field) { return field.key === fieldKey; });
|
|
2009
2041
|
var route = state.router;
|
|
2010
2042
|
var drillDownKey = (_b = (_a = state.view.widgets.find(function (widget) { return widget.bcName === bcName; })) === null || _a === void 0 ? void 0 : _a.fields.find(function (field) { return field.key === fieldKey; })) === null || _b === void 0 ? void 0 : _b.drillDownKey;
|
|
2011
2043
|
var customDrillDownUrl = (_d = (_c = state.data[bcName]) === null || _c === void 0 ? void 0 : _c.find(function (record) { return record.id === cursor; })) === null || _d === void 0 ? void 0 : _d[drillDownKey];
|
|
2012
|
-
return customDrillDownUrl || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) !== route.path ? (0,
|
|
2044
|
+
return customDrillDownUrl || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) !== route.path ? (0, import_rxjs17.concat)((drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDownType) !== import_schema.DrillDownType.inner ? (0, import_rxjs17.of)(bcFetchRowMetaSuccess({ bcName: bcName, rowMeta: rowMeta, bcUrl: bcUrl, cursor: cursor })) : import_rxjs17.EMPTY, (0, import_rxjs17.of)(userDrillDownSuccess({ bcName: bcName, bcUrl: bcUrl, cursor: cursor })), (0, import_rxjs17.of)(drillDown({
|
|
2013
2045
|
url: customDrillDownUrl || drillDownField.drillDown,
|
|
2014
2046
|
drillDownType: drillDownField.drillDownType,
|
|
2015
2047
|
route: route
|
|
2016
|
-
}))) :
|
|
2017
|
-
}), (0,
|
|
2048
|
+
}))) : import_rxjs17.EMPTY;
|
|
2049
|
+
}), (0, import_rxjs17.catchError)(function (error) {
|
|
2018
2050
|
console.error(error);
|
|
2019
|
-
return
|
|
2051
|
+
return createApiErrorObservable(error);
|
|
2020
2052
|
}));
|
|
2021
2053
|
}));
|
|
2022
2054
|
};
|
|
2023
2055
|
// src/epics/router/changeLocationEpic.ts
|
|
2024
|
-
var
|
|
2025
|
-
var changeLocationEpic = function (action$, state$) { return action$.pipe((0,
|
|
2056
|
+
var import_rxjs18 = require("rxjs");
|
|
2057
|
+
var changeLocationEpic = function (action$, state$) { return action$.pipe((0, import_rxjs18.filter)(changeLocation.match), (0, import_rxjs18.mergeMap)(function (action) {
|
|
2026
2058
|
var _a, _b;
|
|
2027
2059
|
var state = state$.value;
|
|
2028
2060
|
if (!state.session.active) {
|
|
2029
|
-
return
|
|
2061
|
+
return import_rxjs18.EMPTY;
|
|
2030
2062
|
}
|
|
2031
2063
|
if (state.router.type === "router" /* router */) {
|
|
2032
|
-
return (0,
|
|
2064
|
+
return (0, import_rxjs18.of)(handleRouter(state.router));
|
|
2033
2065
|
}
|
|
2034
2066
|
var currentScreenName = state.screen.screenName;
|
|
2035
2067
|
var defaultScreenName = ((_a = state.session.screens.find(function (screen) { return screen.defaultScreen; })) === null || _a === void 0 ? void 0 : _a.name) || ((_b = state.session.screens[0]) === null || _b === void 0 ? void 0 : _b.name);
|
|
2036
2068
|
var nextScreenName = state.router.type === "default" /* default */ ? defaultScreenName : state.router.screenName;
|
|
2037
2069
|
if (nextScreenName !== currentScreenName) {
|
|
2038
2070
|
var nextScreen = state.session.screens.find(function (item) { return item.name === nextScreenName; });
|
|
2039
|
-
return nextScreen ? (0,
|
|
2071
|
+
return nextScreen ? (0, import_rxjs18.of)(selectScreen({ screen: nextScreen })) : (0, import_rxjs18.of)(selectScreenFail({ screenName: nextScreenName }));
|
|
2040
2072
|
}
|
|
2041
2073
|
var currentViewName = state.view.name;
|
|
2042
2074
|
var nextViewName = state.router.viewName;
|
|
@@ -2053,25 +2085,25 @@ var changeLocationEpic = function (action$, state$) { return action$.pipe((0, im
|
|
|
2053
2085
|
var needUpdateViews = nextViewName !== currentViewName;
|
|
2054
2086
|
var resultObservables = [];
|
|
2055
2087
|
if (needUpdateCursors) {
|
|
2056
|
-
resultObservables.push((0,
|
|
2088
|
+
resultObservables.push((0, import_rxjs18.of)(bcChangeCursors({ cursorsMap: cursorsDiffMap })));
|
|
2057
2089
|
}
|
|
2058
2090
|
if (needUpdateViews) {
|
|
2059
2091
|
var nextView = nextViewName ? state.screen.views.find(function (item) { return item.name === nextViewName; }) : state.screen.primaryView ? state.screen.views.find(function (item) { return item.name === state.screen.primaryView; }) : state.screen.views[0];
|
|
2060
|
-
resultObservables.push(nextView ? (0,
|
|
2092
|
+
resultObservables.push(nextView ? (0, import_rxjs18.of)(selectView(nextView)) : (0, import_rxjs18.of)(selectViewFail({ viewName: nextViewName })));
|
|
2061
2093
|
}
|
|
2062
2094
|
if (needUpdateCursors && !needUpdateViews) {
|
|
2063
2095
|
Object.entries(nextCursors).forEach(function (entry) {
|
|
2064
2096
|
var bcName = entry[0], cursor = entry[1];
|
|
2065
2097
|
if (!state.data[bcName].find(function (item) { return item.id === cursor; })) {
|
|
2066
|
-
resultObservables.push((0,
|
|
2098
|
+
resultObservables.push((0, import_rxjs18.of)(bcForceUpdate({ bcName: bcName })));
|
|
2067
2099
|
}
|
|
2068
2100
|
});
|
|
2069
2101
|
}
|
|
2070
|
-
return (0,
|
|
2102
|
+
return (0, import_rxjs18.concat).apply(void 0, resultObservables);
|
|
2071
2103
|
})); };
|
|
2072
2104
|
// src/epics/router/selectViewFailEpic.ts
|
|
2073
|
-
var
|
|
2074
|
-
var selectViewFailEpic = function (action$, state$) { return action$.pipe((0,
|
|
2105
|
+
var import_rxjs19 = require("rxjs");
|
|
2106
|
+
var selectViewFailEpic = function (action$, state$) { return action$.pipe((0, import_rxjs19.filter)(selectViewFail.match), (0, import_rxjs19.map)(function (action) {
|
|
2075
2107
|
return addNotification({
|
|
2076
2108
|
type: "error",
|
|
2077
2109
|
key: "selectViewFail",
|
|
@@ -2080,8 +2112,8 @@ var selectViewFailEpic = function (action$, state$) { return action$.pipe((0, im
|
|
|
2080
2112
|
});
|
|
2081
2113
|
})); };
|
|
2082
2114
|
// src/epics/router/selectScreenFailEpic.ts
|
|
2083
|
-
var
|
|
2084
|
-
var selectScreenFailEpic = function (action$) { return action$.pipe((0,
|
|
2115
|
+
var import_rxjs20 = require("rxjs");
|
|
2116
|
+
var selectScreenFailEpic = function (action$) { return action$.pipe((0, import_rxjs20.filter)(selectScreenFail.match), (0, import_rxjs20.map)(function (action) {
|
|
2085
2117
|
return addNotification({
|
|
2086
2118
|
type: "error",
|
|
2087
2119
|
key: "selectScreenFail",
|
|
@@ -2090,8 +2122,8 @@ var selectScreenFailEpic = function (action$) { return action$.pipe((0, import_r
|
|
|
2090
2122
|
});
|
|
2091
2123
|
})); };
|
|
2092
2124
|
// src/epics/router/userDrilldownChangeCursorsEpic.ts
|
|
2093
|
-
var
|
|
2094
|
-
var userDrillDownChangeCursorsEpic = function (action$, state$) { return action$.pipe((0,
|
|
2125
|
+
var import_rxjs21 = require("rxjs");
|
|
2126
|
+
var userDrillDownChangeCursorsEpic = function (action$, state$) { return action$.pipe((0, import_rxjs21.filter)(userDrillDown.match), (0, import_rxjs21.map)(function (action) {
|
|
2095
2127
|
var _a;
|
|
2096
2128
|
var _b;
|
|
2097
2129
|
var state = state$.value;
|
|
@@ -2104,30 +2136,30 @@ var userDrillDownChangeCursorsEpic = function (action$, state$) { return action$
|
|
|
2104
2136
|
})); };
|
|
2105
2137
|
// src/epics/screen/apiErrorEpic.ts
|
|
2106
2138
|
var import_axios = __toESM(require("axios"));
|
|
2107
|
-
var
|
|
2108
|
-
var apiErrorEpic = function (action$) { return action$.pipe((0,
|
|
2139
|
+
var import_rxjs22 = require("rxjs");
|
|
2140
|
+
var apiErrorEpic = function (action$) { return action$.pipe((0, import_rxjs22.filter)(apiError.match), (0, import_rxjs22.mergeMap)(function (action) {
|
|
2109
2141
|
var _a = action.payload, error = _a.error, callContext = _a.callContext;
|
|
2110
2142
|
if (error.response) {
|
|
2111
|
-
return (0,
|
|
2143
|
+
return (0, import_rxjs22.of)(httpError({
|
|
2112
2144
|
statusCode: error.response.status,
|
|
2113
2145
|
error: error,
|
|
2114
2146
|
callContext: callContext
|
|
2115
2147
|
}));
|
|
2116
2148
|
}
|
|
2117
2149
|
else if (!import_axios.default.isCancel(error)) {
|
|
2118
|
-
return (0,
|
|
2150
|
+
return (0, import_rxjs22.of)(showViewError({
|
|
2119
2151
|
error: {
|
|
2120
2152
|
type: 2 /* NetworkError */
|
|
2121
2153
|
}
|
|
2122
2154
|
}));
|
|
2123
2155
|
}
|
|
2124
|
-
return
|
|
2156
|
+
return import_rxjs22.EMPTY;
|
|
2125
2157
|
})); };
|
|
2126
2158
|
// src/epics/screen/downloadFileEpic.ts
|
|
2127
|
-
var
|
|
2159
|
+
var import_rxjs23 = require("rxjs");
|
|
2128
2160
|
var downloadFileEpic = function (action$, state$, _a) {
|
|
2129
2161
|
var api = _a.api;
|
|
2130
|
-
return action$.pipe((0,
|
|
2162
|
+
return action$.pipe((0, import_rxjs23.filter)(downloadFile.match), (0, import_rxjs23.tap)(function (action) {
|
|
2131
2163
|
var fileId = action.payload.fileId;
|
|
2132
2164
|
var anchor = document.createElement("a");
|
|
2133
2165
|
anchor.href = "".concat(api.fileUploadEndpoint, "?id=").concat(encodeURIComponent(fileId));
|
|
@@ -2137,16 +2169,16 @@ var downloadFileEpic = function (action$, state$, _a) {
|
|
|
2137
2169
|
anchor.click();
|
|
2138
2170
|
document.body.removeChild(anchor);
|
|
2139
2171
|
}, 100);
|
|
2140
|
-
}), (0,
|
|
2172
|
+
}), (0, import_rxjs23.mergeMap)(function () { return import_rxjs23.EMPTY; }));
|
|
2141
2173
|
};
|
|
2142
2174
|
// src/epics/screen/httpError401Epic.ts
|
|
2143
|
-
var
|
|
2144
|
-
var httpError401Epic = function (action$) { return action$.pipe((0,
|
|
2175
|
+
var import_rxjs24 = require("rxjs");
|
|
2176
|
+
var httpError401Epic = function (action$) { return action$.pipe((0, import_rxjs24.filter)(httpError.match), (0, import_rxjs24.filter)(function (action) { return action.payload.statusCode === 401; }), (0, import_rxjs24.map)(function (action) {
|
|
2145
2177
|
return logoutDone(null);
|
|
2146
2178
|
})); };
|
|
2147
2179
|
// src/epics/screen/httpError409Epic.ts
|
|
2148
|
-
var
|
|
2149
|
-
var httpError409Epic = function (action$, state$) { return action$.pipe((0,
|
|
2180
|
+
var import_rxjs25 = require("rxjs");
|
|
2181
|
+
var httpError409Epic = function (action$, state$) { return action$.pipe((0, import_rxjs25.filter)(httpError.match), (0, import_rxjs25.filter)(function (action) { return action.payload.statusCode === 409; }), (0, import_rxjs25.map)(function (action) {
|
|
2150
2182
|
var _a, _b, _c;
|
|
2151
2183
|
var notificationMessage = ((_c = (_b = ((_a = action.payload.error.response) === null || _a === void 0 ? void 0 : _a.data).error) === null || _b === void 0 ? void 0 : _b.popup) === null || _c === void 0 ? void 0 : _c[0]) || "";
|
|
2152
2184
|
return addNotification({
|
|
@@ -2162,34 +2194,34 @@ var httpError409Epic = function (action$, state$) { return action$.pipe((0, impo
|
|
|
2162
2194
|
});
|
|
2163
2195
|
})); };
|
|
2164
2196
|
// src/epics/screen/httpError418Epic.ts
|
|
2165
|
-
var
|
|
2166
|
-
var httpError418Epic = function (action$, state$) { return action$.pipe((0,
|
|
2197
|
+
var import_rxjs26 = require("rxjs");
|
|
2198
|
+
var httpError418Epic = function (action$, state$) { return action$.pipe((0, import_rxjs26.filter)(httpError.match), (0, import_rxjs26.filter)(function (action) { return action.payload.statusCode === 418; }), (0, import_rxjs26.mergeMap)(function (action) {
|
|
2167
2199
|
var _a, _b;
|
|
2168
2200
|
var _c = action.payload, error = _c.error, callContext = _c.callContext;
|
|
2169
2201
|
var result = [];
|
|
2170
2202
|
var typedError = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2171
2203
|
if (!typedError.error.popup) {
|
|
2172
|
-
return
|
|
2204
|
+
return import_rxjs26.EMPTY;
|
|
2173
2205
|
}
|
|
2174
2206
|
var businessError = {
|
|
2175
2207
|
type: 0 /* BusinessError */,
|
|
2176
2208
|
message: typedError.error.popup[0]
|
|
2177
2209
|
};
|
|
2178
|
-
result.push((0,
|
|
2210
|
+
result.push((0, import_rxjs26.of)(showViewError({ error: businessError })));
|
|
2179
2211
|
if ((_b = typedError.error.postActions) === null || _b === void 0 ? void 0 : _b[0]) {
|
|
2180
2212
|
var widget = state$.value.view.widgets.find(function (item) { return item.name === callContext.widgetName; });
|
|
2181
2213
|
var bcName = widget === null || widget === void 0 ? void 0 : widget.bcName;
|
|
2182
|
-
result.push((0,
|
|
2214
|
+
result.push((0, import_rxjs26.of)(processPostInvoke({
|
|
2183
2215
|
bcName: bcName,
|
|
2184
2216
|
postInvoke: typedError.error.postActions[0],
|
|
2185
2217
|
widgetName: widget === null || widget === void 0 ? void 0 : widget.name
|
|
2186
2218
|
})));
|
|
2187
2219
|
}
|
|
2188
|
-
return (0,
|
|
2220
|
+
return (0, import_rxjs26.concat).apply(void 0, result);
|
|
2189
2221
|
})); };
|
|
2190
2222
|
// src/epics/screen/httpError500Epic.ts
|
|
2191
|
-
var
|
|
2192
|
-
var httpError500Epic = function (action$, state$) { return action$.pipe((0,
|
|
2223
|
+
var import_rxjs27 = require("rxjs");
|
|
2224
|
+
var httpError500Epic = function (action$, state$) { return action$.pipe((0, import_rxjs27.filter)(httpError.match), (0, import_rxjs27.filter)(function (action) { return action.payload.statusCode === 500; }), (0, import_rxjs27.map)(function (action) {
|
|
2193
2225
|
var _a;
|
|
2194
2226
|
var systemError = {
|
|
2195
2227
|
type: 1 /* SystemError */,
|
|
@@ -2199,9 +2231,9 @@ var httpError500Epic = function (action$, state$) { return action$.pipe((0, impo
|
|
|
2199
2231
|
return showViewError({ error: systemError });
|
|
2200
2232
|
})); };
|
|
2201
2233
|
// src/epics/screen/httpErrorDefaultEpic.ts
|
|
2202
|
-
var
|
|
2234
|
+
var import_rxjs28 = require("rxjs");
|
|
2203
2235
|
var knownHttpErrors = [401, 409, 418, 500];
|
|
2204
|
-
var httpErrorDefaultEpic = function (action$, state$) { return action$.pipe((0,
|
|
2236
|
+
var httpErrorDefaultEpic = function (action$, state$) { return action$.pipe((0, import_rxjs28.filter)(httpError.match), (0, import_rxjs28.filter)(function (action) { return !knownHttpErrors.includes(action.payload.statusCode); }), (0, import_rxjs28.map)(function (action) {
|
|
2205
2237
|
var _a, _b;
|
|
2206
2238
|
var businessError = {
|
|
2207
2239
|
type: 0 /* BusinessError */,
|
|
@@ -2211,8 +2243,8 @@ var httpErrorDefaultEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2211
2243
|
return showViewError({ error: businessError });
|
|
2212
2244
|
})); };
|
|
2213
2245
|
// src/epics/screen/downloadFileByUrlEpic.ts
|
|
2214
|
-
var
|
|
2215
|
-
var downloadFileByUrlEpic = function (action$, state$) { return action$.pipe((0,
|
|
2246
|
+
var import_rxjs29 = require("rxjs");
|
|
2247
|
+
var downloadFileByUrlEpic = function (action$, state$) { return action$.pipe((0, import_rxjs29.filter)(downloadFileByUrl.match), (0, import_rxjs29.tap)(function (action) {
|
|
2216
2248
|
var url = action.payload.url;
|
|
2217
2249
|
var anchor = document.createElement("a");
|
|
2218
2250
|
anchor.href = url;
|
|
@@ -2222,16 +2254,16 @@ var downloadFileByUrlEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2222
2254
|
anchor.click();
|
|
2223
2255
|
document.body.removeChild(anchor);
|
|
2224
2256
|
}, 100);
|
|
2225
|
-
}), (0,
|
|
2257
|
+
}), (0, import_rxjs29.mergeMap)(function () { return import_rxjs29.EMPTY; })); };
|
|
2226
2258
|
// src/epics/screen/processPostInvokeEpic.ts
|
|
2227
|
-
var
|
|
2228
|
-
var processPostInvokeEpic = function (action$, state$) { return action$.pipe((0,
|
|
2259
|
+
var import_rxjs30 = require("rxjs");
|
|
2260
|
+
var processPostInvokeEpic = function (action$, state$) { return action$.pipe((0, import_rxjs30.filter)(processPostInvoke.match), (0, import_rxjs30.mergeMap)(function (action) {
|
|
2229
2261
|
var _a;
|
|
2230
2262
|
var _b;
|
|
2231
2263
|
var state = state$.value;
|
|
2232
2264
|
switch (action.payload.postInvoke.type) {
|
|
2233
2265
|
case "drillDown" /* drillDown */:
|
|
2234
|
-
return (0,
|
|
2266
|
+
return (0, import_rxjs30.of)(drillDown(__assign(__assign({}, action.payload.postInvoke), { route: state.router, widgetName: action.payload.widgetName })));
|
|
2235
2267
|
case "postDelete" /* postDelete */: {
|
|
2236
2268
|
var cursorsMap = (_a = {}, _a[action.payload.bcName] = null, _a);
|
|
2237
2269
|
var result = [bcChangeCursors({ cursorsMap: cursorsMap })];
|
|
@@ -2246,7 +2278,7 @@ var processPostInvokeEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2246
2278
|
widgetName: action.payload.widgetName
|
|
2247
2279
|
}));
|
|
2248
2280
|
}
|
|
2249
|
-
return (0,
|
|
2281
|
+
return (0, import_rxjs30.of).apply(void 0, result);
|
|
2250
2282
|
}
|
|
2251
2283
|
case "refreshBC" /* refreshBC */: {
|
|
2252
2284
|
var bo = state.screen.bo;
|
|
@@ -2256,36 +2288,36 @@ var processPostInvokeEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2256
2288
|
var widgetName = action.payload.widgetName || "";
|
|
2257
2289
|
var infiniteWidgets_1 = state.view.infiniteWidgets || [];
|
|
2258
2290
|
var infinitePagination = state.view.widgets.some(function (item) { return item.bcName === postInvokeBC_1 && infiniteWidgets_1.includes(item.name); });
|
|
2259
|
-
return infinitePagination ? (0,
|
|
2291
|
+
return infinitePagination ? (0, import_rxjs30.of)(bcFetchDataPages({
|
|
2260
2292
|
bcName: postInvokeBCItem.name,
|
|
2261
2293
|
widgetName: widgetName,
|
|
2262
2294
|
from: 1,
|
|
2263
2295
|
to: postInvokeBCItem.page
|
|
2264
|
-
})) : (0,
|
|
2296
|
+
})) : (0, import_rxjs30.of)(bcFetchDataRequest({
|
|
2265
2297
|
bcName: postInvokeBCItem.name,
|
|
2266
2298
|
widgetName: widgetName
|
|
2267
2299
|
}));
|
|
2268
2300
|
}
|
|
2269
2301
|
case "showMessage" /* showMessage */: {
|
|
2270
2302
|
var postInvoke = action.payload.postInvoke;
|
|
2271
|
-
return (0,
|
|
2303
|
+
return (0, import_rxjs30.of)(showNotification({ type: postInvoke.messageType, message: postInvoke.messageText }));
|
|
2272
2304
|
}
|
|
2273
2305
|
case "downloadFile" /* downloadFile */: {
|
|
2274
2306
|
var postInvoke = action.payload.postInvoke;
|
|
2275
|
-
return (0,
|
|
2307
|
+
return (0, import_rxjs30.of)(downloadFile({ fileId: postInvoke.fileId }));
|
|
2276
2308
|
}
|
|
2277
2309
|
case "downloadFileByUrl" /* downloadFileByUrl */: {
|
|
2278
2310
|
var postInvoke = action.payload.postInvoke;
|
|
2279
|
-
return (0,
|
|
2311
|
+
return (0, import_rxjs30.of)(downloadFileByUrl({ url: postInvoke.url }));
|
|
2280
2312
|
}
|
|
2281
2313
|
default:
|
|
2282
|
-
return
|
|
2314
|
+
return import_rxjs30.EMPTY;
|
|
2283
2315
|
}
|
|
2284
2316
|
})); };
|
|
2285
2317
|
// src/epics/screen/processPostInvokeConfirmEpic.ts
|
|
2286
|
-
var
|
|
2318
|
+
var import_rxjs31 = require("rxjs");
|
|
2287
2319
|
var import_toolkit3 = require("@reduxjs/toolkit");
|
|
2288
|
-
var processPostInvokeConfirmEpic = function (action$, state$) { return action$.pipe((0,
|
|
2320
|
+
var processPostInvokeConfirmEpic = function (action$, state$) { return action$.pipe((0, import_rxjs31.filter)((0, import_toolkit3.isAnyOf)(processPostInvokeConfirm, processPreInvoke)), (0, import_rxjs31.mergeMap)(function (action) {
|
|
2289
2321
|
var _a = action.payload, bcName = _a.bcName, operationType = _a.operationType, widgetName = _a.widgetName;
|
|
2290
2322
|
var confirm = processPostInvokeConfirm.match(action) ? action.payload.postInvokeConfirm : action.payload.preInvoke;
|
|
2291
2323
|
switch (confirm.type) {
|
|
@@ -2293,7 +2325,7 @@ var processPostInvokeConfirmEpic = function (action$, state$) { return action$.p
|
|
|
2293
2325
|
case "info" /* info */:
|
|
2294
2326
|
case "error" /* error */:
|
|
2295
2327
|
case "confirmText" /* confirmText */: {
|
|
2296
|
-
return (0,
|
|
2328
|
+
return (0, import_rxjs31.of)(operationConfirmation({
|
|
2297
2329
|
operation: {
|
|
2298
2330
|
bcName: bcName,
|
|
2299
2331
|
operationType: operationType,
|
|
@@ -2303,47 +2335,48 @@ var processPostInvokeConfirmEpic = function (action$, state$) { return action$.p
|
|
|
2303
2335
|
}));
|
|
2304
2336
|
}
|
|
2305
2337
|
default:
|
|
2306
|
-
return
|
|
2338
|
+
return import_rxjs31.EMPTY;
|
|
2307
2339
|
}
|
|
2308
2340
|
})); };
|
|
2309
2341
|
// src/epics/session/switchRoleEpic.ts
|
|
2310
|
-
var
|
|
2311
|
-
var switchRoleEpic = function (action$, state$) { return action$.pipe((0,
|
|
2312
|
-
return (0,
|
|
2342
|
+
var import_rxjs32 = require("rxjs");
|
|
2343
|
+
var switchRoleEpic = function (action$, state$) { return action$.pipe((0, import_rxjs32.filter)(switchRole.match), (0, import_rxjs32.switchMap)(function (action) {
|
|
2344
|
+
return (0, import_rxjs32.concat)([logoutDone(null), login({ login: "", password: "", role: action.payload.role })]);
|
|
2313
2345
|
})); };
|
|
2314
2346
|
// src/epics/session/refreshMetaEpic.ts
|
|
2315
|
-
var
|
|
2347
|
+
var import_rxjs33 = require("rxjs");
|
|
2316
2348
|
var refreshMetaEpic = function (action$, state$, _a) {
|
|
2317
2349
|
var api = _a.api;
|
|
2318
|
-
return action$.pipe((0,
|
|
2350
|
+
return action$.pipe((0, import_rxjs33.filter)(refreshMeta.match), (0, import_rxjs33.mergeMap)(function () {
|
|
2319
2351
|
var state = state$.value;
|
|
2320
2352
|
var router = state.router;
|
|
2321
2353
|
var activeRole = state.session.activeRole;
|
|
2322
|
-
return api.refreshMeta().pipe((0,
|
|
2354
|
+
return api.refreshMeta().pipe((0, import_rxjs33.switchMap)(function () { return (0, import_rxjs33.concat)([
|
|
2355
|
+
refreshMetaDone(),
|
|
2323
2356
|
logoutDone(null),
|
|
2324
2357
|
login({ login: "", password: "", role: activeRole }),
|
|
2325
2358
|
changeLocation({
|
|
2326
2359
|
location: router
|
|
2327
2360
|
})
|
|
2328
|
-
]); }), (0,
|
|
2361
|
+
]); }), (0, import_rxjs33.catchError)(function (error) { return (0, import_rxjs33.concat)([loginFail(error), refreshMetaFail(), createApiError(error)]); }));
|
|
2329
2362
|
}));
|
|
2330
2363
|
};
|
|
2331
2364
|
// src/epics/session/loginDoneEpic.ts
|
|
2332
|
-
var import_rxjs33 = require("rxjs");
|
|
2333
|
-
var loginDoneSessionEpic = function (action$, store) { return action$.pipe((0, import_rxjs33.filter)(login.match), (0, import_rxjs33.switchMap)(function (action) { return import_rxjs33.EMPTY; })); };
|
|
2334
|
-
// src/epics/session/loginByAnotherRoleEpic.ts
|
|
2335
2365
|
var import_rxjs34 = require("rxjs");
|
|
2366
|
+
var loginDoneSessionEpic = function (action$, store) { return action$.pipe((0, import_rxjs34.filter)(login.match), (0, import_rxjs34.switchMap)(function (action) { return import_rxjs34.EMPTY; })); };
|
|
2367
|
+
// src/epics/session/loginByAnotherRoleEpic.ts
|
|
2368
|
+
var import_rxjs35 = require("rxjs");
|
|
2336
2369
|
var responseStatusMessages = {
|
|
2337
2370
|
401: "Invalid credentials",
|
|
2338
2371
|
403: "Access denied"
|
|
2339
2372
|
};
|
|
2340
2373
|
var loginByAnotherRoleEpic = function (action$, state$, _a) {
|
|
2341
2374
|
var api = _a.api;
|
|
2342
|
-
return action$.pipe((0,
|
|
2375
|
+
return action$.pipe((0, import_rxjs35.filter)(login.match), (0, import_rxjs35.filter)(function (action) { var _a; return !!((_a = action.payload) === null || _a === void 0 ? void 0 : _a.role); }), (0, import_rxjs35.switchMap)(function (action) {
|
|
2343
2376
|
var _a;
|
|
2344
2377
|
var role = (_a = action.payload.role) !== null && _a !== void 0 ? _a : "";
|
|
2345
2378
|
var isSwitchRole = role && role !== state$.value.session.activeRole;
|
|
2346
|
-
return api.loginByRoleRequest(role).pipe((0,
|
|
2379
|
+
return api.loginByRoleRequest(role).pipe((0, import_rxjs35.mergeMap)(function (data) {
|
|
2347
2380
|
var _a;
|
|
2348
2381
|
var result = [];
|
|
2349
2382
|
if (isSwitchRole) {
|
|
@@ -2353,7 +2386,7 @@ var loginByAnotherRoleEpic = function (action$, state$, _a) {
|
|
|
2353
2386
|
if (defaultView)
|
|
2354
2387
|
result.push(changeLocation({ location: defaultParseURL(new URL(defaultView.url, window.location.origin)) }));
|
|
2355
2388
|
}
|
|
2356
|
-
return (0,
|
|
2389
|
+
return (0, import_rxjs35.concat)(__spreadArray(__spreadArray([], result, true), [
|
|
2357
2390
|
loginDone({
|
|
2358
2391
|
devPanelEnabled: data.devPanelEnabled,
|
|
2359
2392
|
activeRole: data.activeRole,
|
|
@@ -2364,29 +2397,29 @@ var loginByAnotherRoleEpic = function (action$, state$, _a) {
|
|
|
2364
2397
|
login: data.login
|
|
2365
2398
|
})
|
|
2366
2399
|
], false));
|
|
2367
|
-
}), (0,
|
|
2400
|
+
}), (0, import_rxjs35.catchError)(function (error) {
|
|
2368
2401
|
console.error(error);
|
|
2369
2402
|
var errorMsg = error.response ? responseStatusMessages[error.response.status] || "Server application unavailable" : "Empty server response";
|
|
2370
|
-
return (0,
|
|
2403
|
+
return (0, import_rxjs35.concat)((0, import_rxjs35.of)(loginFail({ errorMsg: errorMsg })), createApiErrorObservable(error));
|
|
2371
2404
|
}));
|
|
2372
2405
|
}));
|
|
2373
2406
|
};
|
|
2374
2407
|
// src/epics/session/refreshMetaAndReloadPageEpic.ts
|
|
2375
|
-
var import_rxjs35 = require("rxjs");
|
|
2376
|
-
var refreshMetaAndReloadPageEpic = function (action$, state$) { return action$.pipe((0, import_rxjs35.filter)(refreshMetaAndReloadPage.match), (0, import_rxjs35.switchMap)(function () { return (0, import_rxjs35.concat)((0, import_rxjs35.of)(refreshMeta(null)), action$.pipe((0, import_rxjs35.filter)(loginDone.match), (0, import_rxjs35.take)(1), (0, import_rxjs35.tap)(function () { return location.reload(); }), (0, import_rxjs35.switchMap)(function () { return import_rxjs35.EMPTY; }))); })); };
|
|
2377
|
-
// src/epics/data/bcNewDataEpic.ts
|
|
2378
2408
|
var import_rxjs36 = require("rxjs");
|
|
2409
|
+
var refreshMetaAndReloadPageEpic = function (action$, state$) { return action$.pipe((0, import_rxjs36.filter)(refreshMetaAndReloadPage.match), (0, import_rxjs36.switchMap)(function () { return (0, import_rxjs36.concat)((0, import_rxjs36.of)(refreshMeta()), action$.pipe((0, import_rxjs36.filter)(loginDone.match), (0, import_rxjs36.take)(1), (0, import_rxjs36.tap)(function () { return location.reload(); }), (0, import_rxjs36.switchMap)(function () { return import_rxjs36.EMPTY; }))); })); };
|
|
2410
|
+
// src/epics/data/bcNewDataEpic.ts
|
|
2411
|
+
var import_rxjs37 = require("rxjs");
|
|
2379
2412
|
var import_schema13 = require("@cxbox-ui/schema");
|
|
2380
2413
|
var bcNewDataEpic = function (action$, state$, _a) {
|
|
2381
2414
|
var api = _a.api;
|
|
2382
|
-
return action$.pipe((0,
|
|
2415
|
+
return action$.pipe((0, import_rxjs37.filter)(sendOperation.match), (0, import_rxjs37.filter)(function (action) { return matchOperationRole(import_schema13.OperationTypeCrud.create, action.payload, state$.value); }), (0, import_rxjs37.mergeMap)(function (action) {
|
|
2383
2416
|
var _a;
|
|
2384
2417
|
var state = state$.value;
|
|
2385
2418
|
var bcName = action.payload.bcName;
|
|
2386
2419
|
var bcUrl = (_a = buildBcUrl(bcName, false, state)) !== null && _a !== void 0 ? _a : "";
|
|
2387
2420
|
var context = { widgetName: action.payload.widgetName };
|
|
2388
2421
|
var params = { _action: action.payload.operationType };
|
|
2389
|
-
return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe((0,
|
|
2422
|
+
return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe((0, import_rxjs37.mergeMap)(function (data) {
|
|
2390
2423
|
var _a, _b;
|
|
2391
2424
|
var rowMeta = data.row;
|
|
2392
2425
|
var dataItem = { id: null, vstamp: -1 };
|
|
@@ -2395,39 +2428,39 @@ var bcNewDataEpic = function (action$, state$, _a) {
|
|
|
2395
2428
|
});
|
|
2396
2429
|
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2397
2430
|
var cursor = dataItem.id;
|
|
2398
|
-
return (0,
|
|
2431
|
+
return (0, import_rxjs37.concat)((0, import_rxjs37.of)(bcNewDataSuccess({ bcName: bcName, dataItem: dataItem, bcUrl: bcUrl })), (0, import_rxjs37.of)(bcFetchRowMetaSuccess({ bcName: bcName, bcUrl: "".concat(bcUrl, "/").concat(cursor), rowMeta: rowMeta, cursor: cursor })), (0, import_rxjs37.of)(changeDataItem({
|
|
2399
2432
|
bcName: bcName,
|
|
2400
2433
|
bcUrl: (_b = buildBcUrl(bcName, true, state)) !== null && _b !== void 0 ? _b : "",
|
|
2401
2434
|
cursor: cursor,
|
|
2402
2435
|
dataItem: {
|
|
2403
2436
|
id: cursor
|
|
2404
2437
|
}
|
|
2405
|
-
})), postInvoke ? (0,
|
|
2406
|
-
}), (0,
|
|
2438
|
+
})), postInvoke ? (0, import_rxjs37.of)(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: action.payload.widgetName })) : import_rxjs37.EMPTY);
|
|
2439
|
+
}), (0, import_rxjs37.catchError)(function (error) {
|
|
2407
2440
|
console.error(error);
|
|
2408
|
-
return (0,
|
|
2441
|
+
return (0, import_rxjs37.concat)((0, import_rxjs37.of)(bcNewDataFail({ bcName: bcName })), createApiErrorObservable(error, context));
|
|
2409
2442
|
}));
|
|
2410
2443
|
}));
|
|
2411
2444
|
};
|
|
2412
2445
|
// src/epics/data/bcLoadMoreEpic.ts
|
|
2413
|
-
var
|
|
2446
|
+
var import_rxjs39 = require("rxjs");
|
|
2414
2447
|
// src/utils/cancelRequestEpic.ts
|
|
2415
|
-
var
|
|
2448
|
+
var import_rxjs38 = require("rxjs");
|
|
2416
2449
|
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
2417
2450
|
var cancelRequestActionTypes = [selectView, logout];
|
|
2418
2451
|
function cancelRequestEpic(action$, actionTypes, cancelFn, cancelActionCreator, filterFn) {
|
|
2419
2452
|
if (filterFn === void 0) { filterFn = function (item) {
|
|
2420
2453
|
return true;
|
|
2421
2454
|
}; }
|
|
2422
|
-
return action$.pipe((0,
|
|
2455
|
+
return action$.pipe((0, import_rxjs38.filter)((0, import_toolkit4.isAnyOf).apply(void 0, actionTypes)), (0, import_rxjs38.filter)(filterFn), (0, import_rxjs38.mergeMap)(function () {
|
|
2423
2456
|
cancelFn === null || cancelFn === void 0 ? void 0 : cancelFn();
|
|
2424
|
-
return (0,
|
|
2425
|
-
}), (0,
|
|
2457
|
+
return (0, import_rxjs38.of)(cancelActionCreator);
|
|
2458
|
+
}), (0, import_rxjs38.take)(1));
|
|
2426
2459
|
}
|
|
2427
2460
|
// src/epics/data/bcLoadMoreEpic.ts
|
|
2428
2461
|
var bcLoadMoreEpic = function (action$, state$, _a) {
|
|
2429
2462
|
var api = _a.api;
|
|
2430
|
-
return action$.pipe((0,
|
|
2463
|
+
return action$.pipe((0, import_rxjs39.filter)(bcLoadMore.match), (0, import_rxjs39.mergeMap)(function (action) {
|
|
2431
2464
|
var _a, _b;
|
|
2432
2465
|
var state = state$.value;
|
|
2433
2466
|
var bcName = action.payload.bcName;
|
|
@@ -2441,28 +2474,28 @@ var bcLoadMoreEpic = function (action$, state$, _a) {
|
|
|
2441
2474
|
var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(filters)), getSorters(sorters));
|
|
2442
2475
|
var canceler = api.createCanceler();
|
|
2443
2476
|
var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName: bcName, bcUrl: bcUrl }));
|
|
2444
|
-
var normalFlow = api.fetchBcData(state.screen.screenName, bcUrl, fetchParams, canceler.cancelToken).pipe((0,
|
|
2477
|
+
var normalFlow = api.fetchBcData(state.screen.screenName, bcUrl, fetchParams, canceler.cancelToken).pipe((0, import_rxjs39.mergeMap)(function (data) {
|
|
2445
2478
|
var _a;
|
|
2446
2479
|
var oldBcDataIds = (_a = state.data[bcName]) === null || _a === void 0 ? void 0 : _a.map(function (i) { return i.id; });
|
|
2447
2480
|
var newData = __spreadArray(__spreadArray([], state.data[bcName], true), data.data.filter(function (i) { return !oldBcDataIds.includes(i.id); }), true);
|
|
2448
|
-
return (0,
|
|
2481
|
+
return (0, import_rxjs39.of)(bcFetchDataSuccess({
|
|
2449
2482
|
bcName: bcName,
|
|
2450
2483
|
data: newData,
|
|
2451
2484
|
bcUrl: bcUrl,
|
|
2452
2485
|
hasNext: data.hasNext
|
|
2453
2486
|
}));
|
|
2454
|
-
}), (0,
|
|
2487
|
+
}), (0, import_rxjs39.catchError)(function (error) {
|
|
2455
2488
|
console.error(error);
|
|
2456
|
-
return (0,
|
|
2489
|
+
return (0, import_rxjs39.concat)((0, import_rxjs39.of)(bcFetchDataFail({ bcName: bcName, bcUrl: bcUrl })), createApiErrorObservable(error));
|
|
2457
2490
|
}));
|
|
2458
|
-
return (0,
|
|
2491
|
+
return (0, import_rxjs39.race)(cancelFlow, normalFlow);
|
|
2459
2492
|
}));
|
|
2460
2493
|
};
|
|
2461
2494
|
// src/epics/data/bcSaveDataEpic.ts
|
|
2462
|
-
var
|
|
2495
|
+
var import_rxjs40 = require("rxjs");
|
|
2463
2496
|
var bcSaveDataEpic = function (action$, state$, _a) {
|
|
2464
2497
|
var api = _a.api;
|
|
2465
|
-
return action$.pipe((0,
|
|
2498
|
+
return action$.pipe((0, import_rxjs40.filter)(sendOperation.match), (0, import_rxjs40.filter)(function (action) { return matchOperationRole(import_schema5.OperationTypeCrud.save, action.payload, state$.value); }), (0, import_rxjs40.mergeMap)(function (action) {
|
|
2466
2499
|
var _a, _b, _c, _d;
|
|
2467
2500
|
var state = state$.value;
|
|
2468
2501
|
var bcName = action.payload.bcName;
|
|
@@ -2489,22 +2522,22 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2489
2522
|
return bcFetchDataRequest({ bcName: childBcName, widgetName: widgetNames[0] });
|
|
2490
2523
|
});
|
|
2491
2524
|
var context = { widgetName: action.payload.widgetName };
|
|
2492
|
-
return api.saveBcData(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: dataItem === null || dataItem === void 0 ? void 0 : dataItem.vstamp }), context).pipe((0,
|
|
2525
|
+
return api.saveBcData(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: dataItem === null || dataItem === void 0 ? void 0 : dataItem.vstamp }), context).pipe((0, import_rxjs40.mergeMap)(function (data) {
|
|
2493
2526
|
var _a;
|
|
2494
2527
|
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2495
2528
|
var responseDataItem = data.record;
|
|
2496
|
-
return (0,
|
|
2529
|
+
return (0, import_rxjs40.concat)((0, import_rxjs40.of)(bcSaveDataSuccess({ bcName: bcName, cursor: cursor, dataItem: responseDataItem })), (0, import_rxjs40.of)(bcFetchRowMeta({ widgetName: widgetName, bcName: bcName })), (0, import_rxjs40.of).apply(void 0, fetchChildrenBcData), postInvoke ? (0, import_rxjs40.of)(processPostInvoke({
|
|
2497
2530
|
bcName: bcName,
|
|
2498
2531
|
widgetName: widgetName,
|
|
2499
2532
|
postInvoke: postInvoke,
|
|
2500
2533
|
cursor: responseDataItem.id
|
|
2501
|
-
})) :
|
|
2502
|
-
}), (0,
|
|
2534
|
+
})) : import_rxjs40.EMPTY, action.payload.onSuccessAction ? (0, import_rxjs40.of)(action.payload.onSuccessAction) : import_rxjs40.EMPTY);
|
|
2535
|
+
}), (0, import_rxjs40.catchError)(function (e) {
|
|
2503
2536
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2504
2537
|
console.error(e);
|
|
2505
|
-
var notification$ =
|
|
2538
|
+
var notification$ = import_rxjs40.EMPTY;
|
|
2506
2539
|
if (action.payload.onSuccessAction && !(options === null || options === void 0 ? void 0 : options.disableNotification)) {
|
|
2507
|
-
notification$ = (0,
|
|
2540
|
+
notification$ = (0, import_rxjs40.of)(addNotification({
|
|
2508
2541
|
key: "data_autosave_undo",
|
|
2509
2542
|
type: "buttonWarningNotification",
|
|
2510
2543
|
message: "There are pending changes. Please save them or cancel.",
|
|
@@ -2524,13 +2557,13 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2524
2557
|
entityError = (_e = (_d = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _d === void 0 ? void 0 : _d.entity) !== null && _e !== void 0 ? _e : entityError;
|
|
2525
2558
|
viewError = (_h = (_g = (_f = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _f === void 0 ? void 0 : _f.popup) === null || _g === void 0 ? void 0 : _g[0]) !== null && _h !== void 0 ? _h : viewError;
|
|
2526
2559
|
}
|
|
2527
|
-
return (0,
|
|
2560
|
+
return (0, import_rxjs40.concat)((0, import_rxjs40.of)(bcSaveDataFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError })), notification$, createApiErrorObservable(e, context));
|
|
2528
2561
|
}));
|
|
2529
2562
|
}));
|
|
2530
2563
|
};
|
|
2531
2564
|
// src/epics/data/selectViewEpic.ts
|
|
2532
|
-
var
|
|
2533
|
-
var selectViewEpic = function (action$, state$) { return action$.pipe((0,
|
|
2565
|
+
var import_rxjs41 = require("rxjs");
|
|
2566
|
+
var selectViewEpic = function (action$, state$) { return action$.pipe((0, import_rxjs41.filter)(selectView.match), (0, import_rxjs41.mergeMap)(function (action) {
|
|
2534
2567
|
try {
|
|
2535
2568
|
var state_1 = state$.value;
|
|
2536
2569
|
var bcToLoad_1 = {};
|
|
@@ -2555,23 +2588,23 @@ var selectViewEpic = function (action$, state$) { return action$.pipe((0, import
|
|
|
2555
2588
|
}
|
|
2556
2589
|
catch (e) {
|
|
2557
2590
|
console.error("selectView Epic:: ".concat(e));
|
|
2558
|
-
return
|
|
2591
|
+
return import_rxjs41.EMPTY;
|
|
2559
2592
|
}
|
|
2560
2593
|
})); };
|
|
2561
2594
|
// src/epics/data/bcFetchDataEpic.ts
|
|
2562
|
-
var
|
|
2595
|
+
var import_rxjs42 = require("rxjs");
|
|
2563
2596
|
var import_schema14 = require("@cxbox-ui/schema");
|
|
2564
2597
|
var import_toolkit5 = require("@reduxjs/toolkit");
|
|
2565
2598
|
var bcFetchDataEpic = function (action$, state$, _a) {
|
|
2566
2599
|
var api = _a.api;
|
|
2567
|
-
return action$.pipe((0,
|
|
2600
|
+
return action$.pipe((0, import_rxjs42.filter)((0, import_toolkit5.isAnyOf)(bcFetchDataRequest, bcFetchDataPages, showViewPopup, bcForceUpdate, bcChangePage)), (0, import_rxjs42.mergeMap)(function (action) {
|
|
2568
2601
|
var getCursorChange = function (data, prevCursor, isHierarchy) {
|
|
2569
2602
|
var _a;
|
|
2570
2603
|
var _b;
|
|
2571
2604
|
var bcName = action.payload.bcName;
|
|
2572
2605
|
var keepDelta = bcFetchDataRequest.match(action) ? action.payload.keepDelta : void 0;
|
|
2573
2606
|
var newCursor = (_b = data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
2574
|
-
return (0,
|
|
2607
|
+
return (0, import_rxjs42.of)(bcChangeCursors({
|
|
2575
2608
|
cursorsMap: (_a = {},
|
|
2576
2609
|
_a[bcName] = data.some(function (i) { return i.id === prevCursor; }) ? prevCursor : newCursor,
|
|
2577
2610
|
_a),
|
|
@@ -2581,7 +2614,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2581
2614
|
var getChildrenData = function (widgets, bcDictionary, isHierarchy, showConditionCheck) {
|
|
2582
2615
|
var bcName = action.payload.bcName;
|
|
2583
2616
|
var _a = bcFetchDataRequest.match(action) ? action.payload : { ignorePageLimit: void 0, keepDelta: void 0 }, ignorePageLimit = _a.ignorePageLimit, keepDelta = _a.keepDelta;
|
|
2584
|
-
return (0,
|
|
2617
|
+
return (0, import_rxjs42.concat).apply(void 0, Object.entries(getBcChildren(bcName, widgets, bcDictionary)).filter(function (_a) {
|
|
2585
2618
|
var childBcName = _a[0], widgetNames = _a[1];
|
|
2586
2619
|
var nonLazyWidget = widgets.find(function (item) {
|
|
2587
2620
|
return widgetNames.includes(item.name) && !PopupWidgetTypes.includes(item.type) && showConditionCheck(item);
|
|
@@ -2596,7 +2629,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2596
2629
|
var nonLazyWidget = widgets.find(function (item) {
|
|
2597
2630
|
return widgetNames.includes(item.name) && !PopupWidgetTypes.includes(item.type) && showConditionCheck(item);
|
|
2598
2631
|
});
|
|
2599
|
-
return (0,
|
|
2632
|
+
return (0, import_rxjs42.of)(bcFetchDataRequest({
|
|
2600
2633
|
bcName: childBcName,
|
|
2601
2634
|
widgetName: nonLazyWidget === null || nonLazyWidget === void 0 ? void 0 : nonLazyWidget.name,
|
|
2602
2635
|
ignorePageLimit: ignorePageLimit || showViewPopup.match(action),
|
|
@@ -2611,7 +2644,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2611
2644
|
var _k = state.view, widgets = _k.widgets, infiniteWidgets = _k.infiniteWidgets;
|
|
2612
2645
|
var widget = (_a = widgets === null || widgets === void 0 ? void 0 : widgets.find(function (item) { return item.name === widgetName; })) !== null && _a !== void 0 ? _a : widgets === null || widgets === void 0 ? void 0 : widgets.find(function (item) { return item.bcName === action.payload.bcName; });
|
|
2613
2646
|
if (!widget) {
|
|
2614
|
-
return [
|
|
2647
|
+
return [import_rxjs42.EMPTY];
|
|
2615
2648
|
}
|
|
2616
2649
|
var bcName = action.payload.bcName;
|
|
2617
2650
|
var bc = state.screen.bo.bc[bcName];
|
|
@@ -2619,7 +2652,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2619
2652
|
var limit = (_c = (((_b = widgets === null || widgets === void 0 ? void 0 : widgets.find(function (i) { return i.bcName === bcName; })) === null || _b === void 0 ? void 0 : _b.limit) || bc.limit)) !== null && _c !== void 0 ? _c : 5;
|
|
2620
2653
|
var sorters = state.screen.sorters[bcName];
|
|
2621
2654
|
if (showViewPopup.match(action) && bcName === action.payload.calleeBCName) {
|
|
2622
|
-
return [
|
|
2655
|
+
return [import_rxjs42.EMPTY];
|
|
2623
2656
|
}
|
|
2624
2657
|
var anyHierarchyWidget = widgets === null || widgets === void 0 ? void 0 : widgets.find(function (item) {
|
|
2625
2658
|
return item.bcName === widget.bcName && item.type === import_schema14.WidgetTypes.AssocListPopup && isHierarchyWidget(item);
|
|
@@ -2651,7 +2684,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2651
2684
|
var actionBc = filteredAction.payload.bcName;
|
|
2652
2685
|
return bc.parentName === actionBc;
|
|
2653
2686
|
});
|
|
2654
|
-
var normalFlow = api.fetchBcData(state.screen.screenName, bcUrl, fetchParams, canceler.cancelToken).pipe((0,
|
|
2687
|
+
var normalFlow = api.fetchBcData(state.screen.screenName, bcUrl, fetchParams, canceler.cancelToken).pipe((0, import_rxjs42.mergeMap)(function (response) {
|
|
2655
2688
|
var _a, _b;
|
|
2656
2689
|
var cursorChange = getCursorChange(response.data, cursor, !!anyHierarchyWidget);
|
|
2657
2690
|
var parentOfNotLazyWidget = widgets === null || widgets === void 0 ? void 0 : widgets.some(function (item) {
|
|
@@ -2677,23 +2710,23 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2677
2710
|
var lazyWidget = (!isWidgetVisible(widget) || PopupWidgetTypes.includes(widget.type)) && !parentOfNotLazyWidget;
|
|
2678
2711
|
var skipLazy = ((_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.bcName) !== widget.bcName;
|
|
2679
2712
|
if (lazyWidget && skipLazy) {
|
|
2680
|
-
return
|
|
2713
|
+
return import_rxjs42.EMPTY;
|
|
2681
2714
|
}
|
|
2682
|
-
var fetchChildren = ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) :
|
|
2683
|
-
var fetchRowMeta = (0,
|
|
2684
|
-
return (0,
|
|
2715
|
+
var fetchChildren = ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) : import_rxjs42.EMPTY;
|
|
2716
|
+
var fetchRowMeta = (0, import_rxjs42.of)(bcFetchRowMeta({ widgetName: widgetName, bcName: bcName }));
|
|
2717
|
+
return (0, import_rxjs42.concat)(cursorChange, (0, import_rxjs42.of)(bcFetchDataSuccess({
|
|
2685
2718
|
bcName: bcName,
|
|
2686
2719
|
data: response.data,
|
|
2687
2720
|
bcUrl: bcUrl,
|
|
2688
2721
|
hasNext: response.hasNext
|
|
2689
2722
|
})), fetchRowMeta, fetchChildren);
|
|
2690
|
-
}), (0,
|
|
2723
|
+
}), (0, import_rxjs42.catchError)(function (error) {
|
|
2691
2724
|
console.error(error);
|
|
2692
|
-
return (0,
|
|
2725
|
+
return (0, import_rxjs42.concat)((0, import_rxjs42.of)(bcFetchDataFail({ bcName: action.payload.bcName, bcUrl: bcUrl })), createApiErrorObservable(error));
|
|
2693
2726
|
}));
|
|
2694
2727
|
return [cancelFlow, cancelByParentBc, normalFlow];
|
|
2695
2728
|
};
|
|
2696
|
-
return (0,
|
|
2729
|
+
return (0, import_rxjs42.race).apply(void 0, bcFetchDataImpl());
|
|
2697
2730
|
}));
|
|
2698
2731
|
};
|
|
2699
2732
|
function isHierarchyWidget(widget) {
|
|
@@ -2701,11 +2734,11 @@ function isHierarchyWidget(widget) {
|
|
|
2701
2734
|
return ((_a = widget.options) === null || _a === void 0 ? void 0 : _a.hierarchy) || ((_b = widget.options) === null || _b === void 0 ? void 0 : _b.hierarchyFull);
|
|
2702
2735
|
}
|
|
2703
2736
|
// src/epics/data/bcDeleteDataEpic.ts
|
|
2704
|
-
var
|
|
2737
|
+
var import_rxjs43 = require("rxjs");
|
|
2705
2738
|
var import_schema15 = require("@cxbox-ui/schema");
|
|
2706
2739
|
var bcDeleteDataEpic = function (action$, store$, _a) {
|
|
2707
2740
|
var api = _a.api;
|
|
2708
|
-
return action$.pipe((0,
|
|
2741
|
+
return action$.pipe((0, import_rxjs43.filter)(sendOperation.match), (0, import_rxjs43.filter)(function (action) { return matchOperationRole(import_schema15.OperationTypeCrud.delete, action.payload, store$.value); }), (0, import_rxjs43.mergeMap)(function (action) {
|
|
2709
2742
|
var widgetName = action.payload.widgetName;
|
|
2710
2743
|
var state = store$.value;
|
|
2711
2744
|
var bcName = action.payload.bcName;
|
|
@@ -2713,19 +2746,19 @@ var bcDeleteDataEpic = function (action$, store$, _a) {
|
|
|
2713
2746
|
var bcUrl = buildBcUrl(bcName, true, state);
|
|
2714
2747
|
var context = { widgetName: action.payload.widgetName };
|
|
2715
2748
|
var isTargetFormatPVF = state.view.pendingValidationFailsFormat === "target" /* target */;
|
|
2716
|
-
return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe((0,
|
|
2749
|
+
return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe((0, import_rxjs43.mergeMap)(function (data) {
|
|
2717
2750
|
var _a;
|
|
2718
2751
|
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2719
|
-
return (0,
|
|
2720
|
-
}), (0,
|
|
2752
|
+
return (0, import_rxjs43.concat)(isTargetFormatPVF ? (0, import_rxjs43.of)(bcCancelPendingChanges({ bcNames: [bcName] })) : import_rxjs43.EMPTY, (0, import_rxjs43.of)(bcFetchDataRequest({ bcName: bcName, widgetName: widgetName })), postInvoke ? (0, import_rxjs43.of)(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: widgetName })) : import_rxjs43.EMPTY);
|
|
2753
|
+
}), (0, import_rxjs43.catchError)(function (error) {
|
|
2721
2754
|
console.error(error);
|
|
2722
|
-
return (0,
|
|
2755
|
+
return (0, import_rxjs43.concat)((0, import_rxjs43.of)(bcDeleteDataFail({ bcName: bcName })), createApiErrorObservable(error, context));
|
|
2723
2756
|
}));
|
|
2724
2757
|
}));
|
|
2725
2758
|
};
|
|
2726
2759
|
// src/epics/data/bcSelectRecordEpic.ts
|
|
2727
|
-
var
|
|
2728
|
-
var bcSelectRecordEpic = function (action$, store$) { return action$.pipe((0,
|
|
2760
|
+
var import_rxjs44 = require("rxjs");
|
|
2761
|
+
var bcSelectRecordEpic = function (action$, store$) { return action$.pipe((0, import_rxjs44.filter)(bcSelectRecord.match), (0, import_rxjs44.mergeMap)(function (action) {
|
|
2729
2762
|
var _a;
|
|
2730
2763
|
var _b = action.payload, bcName = _b.bcName, cursor = _b.cursor;
|
|
2731
2764
|
var widgets = store$.value.view.widgets;
|
|
@@ -2739,17 +2772,17 @@ var bcSelectRecordEpic = function (action$, store$) { return action$.pipe((0, im
|
|
|
2739
2772
|
keepDelta: action.payload.keepDelta
|
|
2740
2773
|
});
|
|
2741
2774
|
});
|
|
2742
|
-
return (0,
|
|
2775
|
+
return (0, import_rxjs44.concat)((0, import_rxjs44.of)(bcChangeCursors({ cursorsMap: (_a = {}, _a[bcName] = cursor, _a), keepDelta: action.payload.keepDelta })), (0, import_rxjs44.of)(bcFetchRowMeta({ widgetName: "", bcName: bcName })), fetchChildrenBcData);
|
|
2743
2776
|
})); };
|
|
2744
2777
|
// src/epics/data/changeAssociationEpic.ts
|
|
2745
|
-
var
|
|
2746
|
-
var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
2778
|
+
var import_rxjs45 = require("rxjs");
|
|
2779
|
+
var changeAssociationEpic = function (action$, state$) { return action$.pipe((0, import_rxjs45.filter)(changeAssociation.match), (0, import_rxjs45.mergeMap)(function (action) {
|
|
2747
2780
|
var _a, _b, _c, _d, _e;
|
|
2748
2781
|
var state = state$.value;
|
|
2749
2782
|
var selected = action.payload.dataItem._associate;
|
|
2750
2783
|
var bcName = action.payload.bcName;
|
|
2751
2784
|
var result = [
|
|
2752
|
-
(0,
|
|
2785
|
+
(0, import_rxjs45.of)(changeDataItem({
|
|
2753
2786
|
bcName: bcName,
|
|
2754
2787
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
2755
2788
|
cursor: action.payload.dataItem.id,
|
|
@@ -2769,7 +2802,7 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2769
2802
|
var hierarchyTraverse = (_d = widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyTraverse;
|
|
2770
2803
|
var childrenBc = hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.slice(hierarchy.findIndex(function (item) { return item.bcName === action.payload.bcName; }) + 1).map(function (item) { return item.bcName; });
|
|
2771
2804
|
if (hierarchyGroupSelection && hierarchyDescriptor.radio && !selected) {
|
|
2772
|
-
result.push((0,
|
|
2805
|
+
result.push((0, import_rxjs45.of)(dropAllAssociations({
|
|
2773
2806
|
bcNames: childrenBc
|
|
2774
2807
|
})));
|
|
2775
2808
|
}
|
|
@@ -2780,11 +2813,11 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2780
2813
|
var parentItem = (_e = state.data[parent === null || parent === void 0 ? void 0 : parent.bcName]) === null || _e === void 0 ? void 0 : _e.find(function (item) { return item.id === state.screen.bo.bc[parent === null || parent === void 0 ? void 0 : parent.bcName].cursor; });
|
|
2781
2814
|
if (parent && hierarchyTraverse && selected) {
|
|
2782
2815
|
if (hierarchyDescriptor.radio) {
|
|
2783
|
-
result.push((0,
|
|
2816
|
+
result.push((0, import_rxjs45.of)(dropAllAssociations({
|
|
2784
2817
|
bcNames: [parent.bcName]
|
|
2785
2818
|
})));
|
|
2786
2819
|
}
|
|
2787
|
-
result.push((0,
|
|
2820
|
+
result.push((0, import_rxjs45.of)(changeAssociation({
|
|
2788
2821
|
bcName: parent.bcName,
|
|
2789
2822
|
widgetName: action.payload.widgetName,
|
|
2790
2823
|
dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem === null || parentItem === void 0 ? void 0 : parentItem[parent.assocValueKey || action.payload.assocValueKey] }),
|
|
@@ -2801,7 +2834,7 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2801
2834
|
data_1.find(function (dataValue) { return dataValue.id === deltaValue.id; });
|
|
2802
2835
|
});
|
|
2803
2836
|
if (wasLastInData && wasLastInDelta) {
|
|
2804
|
-
result.push((0,
|
|
2837
|
+
result.push((0, import_rxjs45.of)(changeAssociation({
|
|
2805
2838
|
bcName: parent.bcName,
|
|
2806
2839
|
widgetName: action.payload.widgetName,
|
|
2807
2840
|
dataItem: __assign(__assign({}, parentItem), { _associate: false }),
|
|
@@ -2809,16 +2842,16 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2809
2842
|
})));
|
|
2810
2843
|
}
|
|
2811
2844
|
}
|
|
2812
|
-
return (0,
|
|
2845
|
+
return (0, import_rxjs45.concat).apply(void 0, result);
|
|
2813
2846
|
})); };
|
|
2814
2847
|
// src/epics/data/bcCancelCreateDataEpic.ts
|
|
2815
|
-
var
|
|
2848
|
+
var import_rxjs46 = require("rxjs");
|
|
2816
2849
|
var import_schema16 = require("@cxbox-ui/schema");
|
|
2817
2850
|
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
2818
2851
|
var actionTypesMatcher = (0, import_toolkit6.isAnyOf)(sendOperation);
|
|
2819
2852
|
var bcCancelCreateDataEpic = function (action$, state$, _a) {
|
|
2820
2853
|
var api = _a.api;
|
|
2821
|
-
return action$.pipe((0,
|
|
2854
|
+
return action$.pipe((0, import_rxjs46.filter)(actionTypesMatcher), (0, import_rxjs46.filter)(function (action) { return matchOperationRole(import_schema16.OperationTypeCrud.cancelCreate, action.payload, state$.value); }), (0, import_rxjs46.mergeMap)(function (action) {
|
|
2822
2855
|
var _a;
|
|
2823
2856
|
var _b, _c;
|
|
2824
2857
|
var state = state$.value;
|
|
@@ -2833,21 +2866,21 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
|
|
|
2833
2866
|
var data = record && __assign(__assign({}, pendingRecordChange), { vstamp: record.vstamp });
|
|
2834
2867
|
var params = { _action: action.payload.operationType };
|
|
2835
2868
|
var cursorsMap = (_a = {}, _a[action.payload.bcName] = null, _a);
|
|
2836
|
-
return api.customAction(screenName, bcUrl, data, context, params).pipe((0,
|
|
2869
|
+
return api.customAction(screenName, bcUrl, data, context, params).pipe((0, import_rxjs46.mergeMap)(function (response) {
|
|
2837
2870
|
var _a;
|
|
2838
2871
|
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2839
|
-
return (0,
|
|
2840
|
-
}), (0,
|
|
2872
|
+
return (0, import_rxjs46.concat)((0, import_rxjs46.of)(sendOperationSuccess({ bcName: bcName, cursor: cursor })), (0, import_rxjs46.of)(bcChangeCursors({ cursorsMap: cursorsMap })), postInvoke ? (0, import_rxjs46.of)(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: context.widgetName })) : import_rxjs46.EMPTY);
|
|
2873
|
+
}), (0, import_rxjs46.catchError)(function (error) {
|
|
2841
2874
|
console.error(error);
|
|
2842
|
-
return (0,
|
|
2875
|
+
return (0, import_rxjs46.concat)((0, import_rxjs46.of)(bcDeleteDataFail({ bcName: bcName })), createApiErrorObservable(error, context));
|
|
2843
2876
|
}));
|
|
2844
2877
|
}));
|
|
2845
2878
|
};
|
|
2846
2879
|
// src/epics/data/bcSelectDepthRecordEpic.ts
|
|
2847
|
-
var
|
|
2848
|
-
var bcSelectDepthRecordEpic = function (action$) { return action$.pipe((0,
|
|
2880
|
+
var import_rxjs47 = require("rxjs");
|
|
2881
|
+
var bcSelectDepthRecordEpic = function (action$) { return action$.pipe((0, import_rxjs47.filter)(bcSelectDepthRecord.match), (0, import_rxjs47.mergeMap)(function (action) {
|
|
2849
2882
|
var _a = action.payload, bcName = _a.bcName, cursor = _a.cursor, depth = _a.depth;
|
|
2850
|
-
return (0,
|
|
2883
|
+
return (0, import_rxjs47.concat)((0, import_rxjs47.of)(bcChangeDepthCursor({ bcName: bcName, depth: depth, cursor: cursor })), (0, import_rxjs47.of)(bcFetchDataRequest({
|
|
2851
2884
|
bcName: bcName,
|
|
2852
2885
|
depth: depth + 1,
|
|
2853
2886
|
widgetName: "",
|
|
@@ -2855,8 +2888,8 @@ var bcSelectDepthRecordEpic = function (action$) { return action$.pipe((0, impor
|
|
|
2855
2888
|
})));
|
|
2856
2889
|
})); };
|
|
2857
2890
|
// src/epics/data/removeMultivalueTagEpic.ts
|
|
2858
|
-
var
|
|
2859
|
-
var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((0,
|
|
2891
|
+
var import_rxjs48 = require("rxjs");
|
|
2892
|
+
var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((0, import_rxjs48.filter)(removeMultivalueTag.match), (0, import_rxjs48.mergeMap)(function (action) {
|
|
2860
2893
|
var _a, _b, _c;
|
|
2861
2894
|
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
2862
2895
|
var state = state$.value;
|
|
@@ -2892,7 +2925,7 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2892
2925
|
return removedNodes.includes(descendant) || !associated.includes(descendant);
|
|
2893
2926
|
});
|
|
2894
2927
|
if (parentDeepEmpty) {
|
|
2895
|
-
return (0,
|
|
2928
|
+
return (0, import_rxjs48.concat)((0, import_rxjs48.of)(removeMultivalueTag(__assign(__assign({}, action.payload), { removedItem: { id: parent_1.id, value: null } }))));
|
|
2896
2929
|
}
|
|
2897
2930
|
}
|
|
2898
2931
|
else {
|
|
@@ -2901,7 +2934,7 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2901
2934
|
}
|
|
2902
2935
|
}
|
|
2903
2936
|
if ((_h = widget === null || widget === void 0 ? void 0 : widget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull) {
|
|
2904
|
-
return (0,
|
|
2937
|
+
return (0, import_rxjs48.of)(changeDataItem({
|
|
2905
2938
|
bcName: bcName,
|
|
2906
2939
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
2907
2940
|
cursor: cursor,
|
|
@@ -2913,7 +2946,7 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2913
2946
|
var _a;
|
|
2914
2947
|
return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
|
|
2915
2948
|
})) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName;
|
|
2916
|
-
return (0,
|
|
2949
|
+
return (0, import_rxjs48.concat)((0, import_rxjs48.of)(changeDataItem({
|
|
2917
2950
|
/**
|
|
2918
2951
|
* This is incorrect and will break if different BC has records with
|
|
2919
2952
|
* identical ids.
|
|
@@ -2924,19 +2957,19 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2924
2957
|
bcUrl: buildBcUrl(hierarchyBcName, true, state),
|
|
2925
2958
|
cursor: action.payload.removedItem.id,
|
|
2926
2959
|
dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
|
|
2927
|
-
})), (0,
|
|
2960
|
+
})), (0, import_rxjs48.of)(changeDataItem({
|
|
2928
2961
|
bcName: bcName,
|
|
2929
2962
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
2930
2963
|
cursor: cursor,
|
|
2931
2964
|
dataItem: (_b = {}, _b[associateFieldKey] = action.payload.dataItem, _b)
|
|
2932
2965
|
})));
|
|
2933
2966
|
}
|
|
2934
|
-
return (0,
|
|
2967
|
+
return (0, import_rxjs48.concat)((0, import_rxjs48.of)(changeDataItem({
|
|
2935
2968
|
bcName: popupBcName,
|
|
2936
2969
|
bcUrl: buildBcUrl(popupBcName, true, state),
|
|
2937
2970
|
cursor: action.payload.removedItem.id,
|
|
2938
2971
|
dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
|
|
2939
|
-
})), (0,
|
|
2972
|
+
})), (0, import_rxjs48.of)(changeDataItem({
|
|
2940
2973
|
bcName: bcName,
|
|
2941
2974
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
2942
2975
|
cursor: cursor,
|
|
@@ -2944,10 +2977,10 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2944
2977
|
})));
|
|
2945
2978
|
})); };
|
|
2946
2979
|
// src/epics/data/bcFetchRowMetaRequestEpic.ts
|
|
2947
|
-
var
|
|
2980
|
+
var import_rxjs49 = require("rxjs");
|
|
2948
2981
|
var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
|
|
2949
2982
|
var api = _a.api;
|
|
2950
|
-
return action$.pipe((0,
|
|
2983
|
+
return action$.pipe((0, import_rxjs49.filter)(bcFetchRowMeta.match), (0, import_rxjs49.mergeMap)(function (action) {
|
|
2951
2984
|
var _a, _b;
|
|
2952
2985
|
var state = state$.value;
|
|
2953
2986
|
var screenName = state.screen.screenName;
|
|
@@ -2960,18 +2993,18 @@ var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
|
|
|
2960
2993
|
var actionBc = filteredAction.payload.bcName;
|
|
2961
2994
|
return state.screen.bo.bc[bcName].parentName === actionBc;
|
|
2962
2995
|
});
|
|
2963
|
-
var normalFlow = api.fetchRowMeta(screenName, bcUrl, void 0, canceler.cancelToken).pipe((0,
|
|
2996
|
+
var normalFlow = api.fetchRowMeta(screenName, bcUrl, void 0, canceler.cancelToken).pipe((0, import_rxjs49.map)(function (rowMeta) {
|
|
2964
2997
|
return bcFetchRowMetaSuccess({ bcName: bcName, rowMeta: rowMeta, bcUrl: bcUrl, cursor: cursor });
|
|
2965
|
-
}), (0,
|
|
2998
|
+
}), (0, import_rxjs49.catchError)(function (error) {
|
|
2966
2999
|
console.error(error);
|
|
2967
|
-
return (0,
|
|
3000
|
+
return (0, import_rxjs49.concat)((0, import_rxjs49.of)(bcFetchRowMetaFail({ bcName: bcName })), createApiErrorObservable(error));
|
|
2968
3001
|
}));
|
|
2969
|
-
return (0,
|
|
3002
|
+
return (0, import_rxjs49.race)(cancelFlow, cancelByParentBc, normalFlow);
|
|
2970
3003
|
}));
|
|
2971
3004
|
};
|
|
2972
3005
|
// src/epics/data/changeAssociationFullEpic.ts
|
|
2973
|
-
var
|
|
2974
|
-
var changeAssociationFullEpic = function (action$, state$) { return action$.pipe((0,
|
|
3006
|
+
var import_rxjs50 = require("rxjs");
|
|
3007
|
+
var changeAssociationFullEpic = function (action$, state$) { return action$.pipe((0, import_rxjs50.filter)(changeAssociationFull.match), (0, import_rxjs50.mergeMap)(function (action) {
|
|
2975
3008
|
var _a, _b, _c, _d, _e;
|
|
2976
3009
|
var state = state$.value;
|
|
2977
3010
|
var result = [];
|
|
@@ -3000,7 +3033,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
3000
3033
|
return false;
|
|
3001
3034
|
});
|
|
3002
3035
|
if (prevSelected) {
|
|
3003
|
-
result.push((0,
|
|
3036
|
+
result.push((0, import_rxjs50.of)(changeAssociationFull({
|
|
3004
3037
|
bcName: bcName,
|
|
3005
3038
|
depth: depth,
|
|
3006
3039
|
widgetName: action.payload.widgetName,
|
|
@@ -3010,7 +3043,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
3010
3043
|
}
|
|
3011
3044
|
}
|
|
3012
3045
|
else {
|
|
3013
|
-
result.push((0,
|
|
3046
|
+
result.push((0, import_rxjs50.of)(changeDescendantsAssociationsFull({
|
|
3014
3047
|
bcName: bcName,
|
|
3015
3048
|
parentId: action.payload.dataItem.id,
|
|
3016
3049
|
depth: depth + 1,
|
|
@@ -3019,14 +3052,14 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
3019
3052
|
})));
|
|
3020
3053
|
}
|
|
3021
3054
|
}
|
|
3022
|
-
result.push((0,
|
|
3055
|
+
result.push((0, import_rxjs50.of)(changeDataItem({
|
|
3023
3056
|
bcName: action.payload.bcName,
|
|
3024
3057
|
bcUrl: buildBcUrl(action.payload.bcName, true, state),
|
|
3025
3058
|
cursor: action.payload.dataItem.id,
|
|
3026
3059
|
dataItem: action.payload.dataItem
|
|
3027
3060
|
})));
|
|
3028
3061
|
if (parentDepth && hierarchyTraverse && selected) {
|
|
3029
|
-
result.push((0,
|
|
3062
|
+
result.push((0, import_rxjs50.of)(changeAssociationFull({
|
|
3030
3063
|
bcName: bcName,
|
|
3031
3064
|
depth: parentDepth,
|
|
3032
3065
|
widgetName: action.payload.widgetName,
|
|
@@ -3042,7 +3075,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
3042
3075
|
var deltaFalseId_1 = delta && ((_e = Object.values(delta)) === null || _e === void 0 ? void 0 : _e.filter(function (item) { return item._associate === false; }).map(function (item) { return item.id; }));
|
|
3043
3076
|
var wasLastInData = currentLevelData.filter(function (item) { return item.id !== action.payload.dataItem.id && !(deltaFalseId_1 === null || deltaFalseId_1 === void 0 ? void 0 : deltaFalseId_1.includes(item.id)); }).every(function (item) { return !item._associate; });
|
|
3044
3077
|
if (wasLastInData && wasLastInDelta) {
|
|
3045
|
-
result.push((0,
|
|
3078
|
+
result.push((0, import_rxjs50.of)(changeAssociationFull({
|
|
3046
3079
|
bcName: bcName,
|
|
3047
3080
|
depth: parentDepth,
|
|
3048
3081
|
widgetName: action.payload.widgetName,
|
|
@@ -3051,16 +3084,16 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
3051
3084
|
})));
|
|
3052
3085
|
}
|
|
3053
3086
|
}
|
|
3054
|
-
return (0,
|
|
3087
|
+
return (0, import_rxjs50.concat).apply(void 0, result);
|
|
3055
3088
|
})); };
|
|
3056
3089
|
// src/epics/data/saveAssociationsActiveEpic.ts
|
|
3057
|
-
var
|
|
3090
|
+
var import_rxjs51 = require("rxjs");
|
|
3058
3091
|
var saveAssociationsActiveEpic = function (action$, state$, _a) {
|
|
3059
3092
|
var api = _a.api;
|
|
3060
|
-
return action$.pipe((0,
|
|
3093
|
+
return action$.pipe((0, import_rxjs51.filter)(saveAssociations.match), (0, import_rxjs51.filter)(function (action) {
|
|
3061
3094
|
var _a;
|
|
3062
3095
|
return (_a = state$.value.view.popupData) === null || _a === void 0 ? void 0 : _a.active;
|
|
3063
|
-
}), (0,
|
|
3096
|
+
}), (0, import_rxjs51.switchMap)(function (action) {
|
|
3064
3097
|
var _a, _b;
|
|
3065
3098
|
var state = state$.value;
|
|
3066
3099
|
var calleeBCName = (_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.calleeBCName;
|
|
@@ -3069,24 +3102,24 @@ var saveAssociationsActiveEpic = function (action$, state$, _a) {
|
|
|
3069
3102
|
var bcUrl = buildBcUrl(calleeBCName, true, state);
|
|
3070
3103
|
var pendingChanges = state.view.pendingDataChanges[bcNames[0]] || {};
|
|
3071
3104
|
var params = bcNames.length ? { _bcName: bcNames[bcNames.length - 1] } : {};
|
|
3072
|
-
return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter(function (i) { return i._associate; }), params).pipe((0,
|
|
3105
|
+
return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter(function (i) { return i._associate; }), params).pipe((0, import_rxjs51.mergeMap)(function (response) {
|
|
3073
3106
|
var postInvoke = response.postActions[0];
|
|
3074
3107
|
var calleeWidget = state.view.widgets.find(function (widgetItem) { return widgetItem.bcName === calleeBCName; });
|
|
3075
|
-
return (0,
|
|
3076
|
-
}), (0,
|
|
3108
|
+
return (0, import_rxjs51.concat)(postInvoke ? (0, import_rxjs51.of)(processPostInvoke({ bcName: calleeBCName, postInvoke: postInvoke, widgetName: calleeWidget === null || calleeWidget === void 0 ? void 0 : calleeWidget.name })) : import_rxjs51.EMPTY, (0, import_rxjs51.of)(bcCancelPendingChanges({ bcNames: bcNames })), (0, import_rxjs51.of)(bcForceUpdate({ bcName: calleeBCName, widgetName: calleeWidgetName })));
|
|
3109
|
+
}), (0, import_rxjs51.catchError)(function (err) {
|
|
3077
3110
|
console.error(err);
|
|
3078
|
-
return
|
|
3111
|
+
return import_rxjs51.EMPTY;
|
|
3079
3112
|
}));
|
|
3080
3113
|
}));
|
|
3081
3114
|
};
|
|
3082
3115
|
// src/epics/data/changeAssociationSameBcEpic.ts
|
|
3083
|
-
var
|
|
3084
|
-
var changeAssociationSameBcEpic = function (action$, state$) { return action$.pipe((0,
|
|
3116
|
+
var import_rxjs52 = require("rxjs");
|
|
3117
|
+
var changeAssociationSameBcEpic = function (action$, state$) { return action$.pipe((0, import_rxjs52.filter)(changeAssociationSameBc.match), (0, import_rxjs52.mergeMap)(function (action) {
|
|
3085
3118
|
var _a, _b, _c, _d, _e, _f;
|
|
3086
3119
|
var state = state$.value;
|
|
3087
3120
|
var bcName = action.payload.bcName;
|
|
3088
3121
|
var result = [
|
|
3089
|
-
(0,
|
|
3122
|
+
(0, import_rxjs52.of)(changeDataItem({
|
|
3090
3123
|
bcName: bcName,
|
|
3091
3124
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
3092
3125
|
cursor: action.payload.dataItem.id,
|
|
@@ -3102,7 +3135,7 @@ var changeAssociationSameBcEpic = function (action$, state$) { return action$.pi
|
|
|
3102
3135
|
var parentCursor = parentDepth ? parentDepth > 1 ? (_d = (_c = state.screen.bo.bc[bcName].depthBc) === null || _c === void 0 ? void 0 : _c[parentDepth]) === null || _d === void 0 ? void 0 : _d.cursor : state.screen.bo.bc[bcName].cursor : null;
|
|
3103
3136
|
var parentItem = parentCursor ? parentDepth > 1 ? (_f = (_e = state.depthData[parentDepth]) === null || _e === void 0 ? void 0 : _e[bcName]) === null || _f === void 0 ? void 0 : _f.find(function (item) { return item.id === parentCursor; }) : state.data[bcName].find(function (item) { return item.id === parentCursor; }) : null;
|
|
3104
3137
|
if (parentDepth && hierarchyTraverse && selected) {
|
|
3105
|
-
result.push((0,
|
|
3138
|
+
result.push((0, import_rxjs52.of)(changeAssociationSameBc({
|
|
3106
3139
|
bcName: bcName,
|
|
3107
3140
|
depth: parentDepth,
|
|
3108
3141
|
widgetName: action.payload.widgetName,
|
|
@@ -3113,7 +3146,7 @@ var changeAssociationSameBcEpic = function (action$, state$) { return action$.pi
|
|
|
3113
3146
|
if (parentDepth && hierarchyTraverse && !selected) {
|
|
3114
3147
|
var wasLastInData = currentData.filter(function (item) { return item.id !== action.payload.dataItem.id; }).every(function (item) { return !item._associate; });
|
|
3115
3148
|
if (wasLastInData) {
|
|
3116
|
-
result.push((0,
|
|
3149
|
+
result.push((0, import_rxjs52.of)(changeAssociationSameBc({
|
|
3117
3150
|
bcName: bcName,
|
|
3118
3151
|
depth: parentDepth,
|
|
3119
3152
|
widgetName: action.payload.widgetName,
|
|
@@ -3122,34 +3155,34 @@ var changeAssociationSameBcEpic = function (action$, state$) { return action$.pi
|
|
|
3122
3155
|
})));
|
|
3123
3156
|
}
|
|
3124
3157
|
}
|
|
3125
|
-
return (0,
|
|
3158
|
+
return (0, import_rxjs52.concat).apply(void 0, result);
|
|
3126
3159
|
})); };
|
|
3127
3160
|
// src/epics/data/inlinePickListFetchDataEpic.ts
|
|
3128
|
-
var
|
|
3161
|
+
var import_rxjs53 = require("rxjs");
|
|
3129
3162
|
var inlinePickListFetchDataEpic = function (action$, state$, _a) {
|
|
3130
3163
|
var api = _a.api;
|
|
3131
|
-
return action$.pipe((0,
|
|
3164
|
+
return action$.pipe((0, import_rxjs53.filter)(inlinePickListFetchDataRequest.match), (0, import_rxjs53.mergeMap)(function (action) {
|
|
3132
3165
|
var _a;
|
|
3133
3166
|
var _b = action.payload, bcName = _b.bcName, searchSpec = _b.searchSpec, searchString = _b.searchString;
|
|
3134
3167
|
var state = state$.value;
|
|
3135
3168
|
var bcUrl = buildBcUrl(bcName, false, state);
|
|
3136
3169
|
var canceler = api.createCanceler();
|
|
3137
3170
|
var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName: bcName, bcUrl: bcUrl }));
|
|
3138
|
-
var normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, (_a = {}, _a[searchSpec + ".contains"] = searchString, _a), canceler.cancelToken).pipe((0,
|
|
3139
|
-
return (0,
|
|
3140
|
-
}), (0,
|
|
3171
|
+
var normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, (_a = {}, _a[searchSpec + ".contains"] = searchString, _a), canceler.cancelToken).pipe((0, import_rxjs53.mergeMap)(function (data) {
|
|
3172
|
+
return (0, import_rxjs53.of)(bcFetchDataSuccess({ bcName: bcName, data: data.data, bcUrl: bcUrl }));
|
|
3173
|
+
}), (0, import_rxjs53.catchError)(function (error) {
|
|
3141
3174
|
console.error(error);
|
|
3142
|
-
return (0,
|
|
3175
|
+
return (0, import_rxjs53.of)(bcFetchDataFail({ bcName: action.payload.bcName, bcUrl: bcUrl }));
|
|
3143
3176
|
}));
|
|
3144
|
-
return (0,
|
|
3177
|
+
return (0, import_rxjs53.race)(cancelFlow, normalFlow);
|
|
3145
3178
|
}));
|
|
3146
3179
|
};
|
|
3147
3180
|
// src/epics/data/saveAssociationsPassiveEpic.ts
|
|
3148
|
-
var
|
|
3149
|
-
var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pipe((0,
|
|
3181
|
+
var import_rxjs54 = require("rxjs");
|
|
3182
|
+
var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pipe((0, import_rxjs54.filter)(saveAssociations.match), (0, import_rxjs54.filter)(function () {
|
|
3150
3183
|
var _a;
|
|
3151
3184
|
return !((_a = state$.value.view.popupData) === null || _a === void 0 ? void 0 : _a.active);
|
|
3152
|
-
}), (0,
|
|
3185
|
+
}), (0, import_rxjs54.switchMap)(function (action) {
|
|
3153
3186
|
var _a, _b;
|
|
3154
3187
|
var _c, _d;
|
|
3155
3188
|
var state = state$.value;
|
|
@@ -3179,7 +3212,7 @@ var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pi
|
|
|
3179
3212
|
}
|
|
3180
3213
|
return true;
|
|
3181
3214
|
})).concat.apply(_a, addedItems);
|
|
3182
|
-
return (0,
|
|
3215
|
+
return (0, import_rxjs54.of)(changeDataItem({
|
|
3183
3216
|
bcName: calleeBCName,
|
|
3184
3217
|
bcUrl: buildBcUrl(calleeBCName, true, state),
|
|
3185
3218
|
cursor: cursor,
|
|
@@ -3189,13 +3222,13 @@ var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pi
|
|
|
3189
3222
|
}));
|
|
3190
3223
|
})); };
|
|
3191
3224
|
// src/epics/data/changeChildrenAssociationsEpic.ts
|
|
3192
|
-
var
|
|
3225
|
+
var import_rxjs55 = require("rxjs");
|
|
3193
3226
|
var changeChildrenAssociationsEpic = function (action$, state$, _a) {
|
|
3194
3227
|
var api = _a.api;
|
|
3195
|
-
return action$.pipe((0,
|
|
3228
|
+
return action$.pipe((0, import_rxjs55.filter)(changeChildrenAssociations.match), (0, import_rxjs55.mergeMap)(function (action) {
|
|
3196
3229
|
var state = state$.value;
|
|
3197
3230
|
var data = state.data[action.payload.bcName];
|
|
3198
|
-
return (0,
|
|
3231
|
+
return (0, import_rxjs55.of)(changeDataItems({
|
|
3199
3232
|
bcName: action.payload.bcName,
|
|
3200
3233
|
cursors: data.map(function (item) { return item.id; }),
|
|
3201
3234
|
dataItems: data.map(function (item) { return (__assign(__assign({}, item), { _value: item[action.payload.assocValueKey], _associate: action.payload.selected })); })
|
|
@@ -3203,26 +3236,26 @@ var changeChildrenAssociationsEpic = function (action$, state$, _a) {
|
|
|
3203
3236
|
}));
|
|
3204
3237
|
};
|
|
3205
3238
|
// src/epics/data/changeChildrenAssociationsSameBcEpic.ts
|
|
3206
|
-
var
|
|
3207
|
-
var changeChildrenAssociationsSameBcEpic = function (action$, state$) { return action$.pipe((0,
|
|
3239
|
+
var import_rxjs56 = require("rxjs");
|
|
3240
|
+
var changeChildrenAssociationsSameBcEpic = function (action$, state$) { return action$.pipe((0, import_rxjs56.filter)(changeChildrenAssociationsSameBc.match), (0, import_rxjs56.mergeMap)(function (action) {
|
|
3208
3241
|
var _a;
|
|
3209
3242
|
var state = state$.value;
|
|
3210
3243
|
var data = ((_a = state.depthData[action.payload.depth]) === null || _a === void 0 ? void 0 : _a[action.payload.bcName]) || [];
|
|
3211
|
-
return (0,
|
|
3244
|
+
return (0, import_rxjs56.of)(changeDataItems({
|
|
3212
3245
|
bcName: action.payload.bcName,
|
|
3213
3246
|
cursors: data.map(function (item) { return item.id; }),
|
|
3214
3247
|
dataItems: data.map(function (item) { return (__assign(__assign({}, item), { _value: item[action.payload.assocValueKey], _associate: action.payload.selected })); })
|
|
3215
3248
|
}));
|
|
3216
3249
|
})); };
|
|
3217
3250
|
// src/epics/data/changeDescendantsAssociationsFullEpic.ts
|
|
3218
|
-
var
|
|
3219
|
-
var changeDescendantsAssociationsFullEpic = function (action$, state$) { return action$.pipe((0,
|
|
3251
|
+
var import_rxjs57 = require("rxjs");
|
|
3252
|
+
var changeDescendantsAssociationsFullEpic = function (action$, state$) { return action$.pipe((0, import_rxjs57.filter)(changeDescendantsAssociationsFull.match), (0, import_rxjs57.mergeMap)(function (action) {
|
|
3220
3253
|
var state = state$.value;
|
|
3221
3254
|
var depth = action.payload.depth;
|
|
3222
3255
|
var data = state.data[action.payload.bcName];
|
|
3223
3256
|
var targetData = (data || []).filter(function (item) { return item.level === depth && item.parentId === action.payload.parentId; });
|
|
3224
3257
|
var result = [
|
|
3225
|
-
(0,
|
|
3258
|
+
(0, import_rxjs57.of)(changeDataItems({
|
|
3226
3259
|
bcName: action.payload.bcName,
|
|
3227
3260
|
cursors: targetData.map(function (item) { return item.id; }),
|
|
3228
3261
|
dataItems: targetData.map(function (item) { return (__assign(__assign({}, item), { _value: item[action.payload.assocValueKey], _associate: action.payload.selected })); })
|
|
@@ -3230,14 +3263,14 @@ var changeDescendantsAssociationsFullEpic = function (action$, state$) { return
|
|
|
3230
3263
|
];
|
|
3231
3264
|
targetData.forEach(function (targetDataItem) {
|
|
3232
3265
|
if (data.find(function (dataItem) { return dataItem.parentId === targetDataItem.id; })) {
|
|
3233
|
-
result.push((0,
|
|
3266
|
+
result.push((0, import_rxjs57.of)(changeDescendantsAssociationsFull(__assign(__assign({}, action.payload), { parentId: targetDataItem.id, depth: depth + 1 }))));
|
|
3234
3267
|
}
|
|
3235
3268
|
});
|
|
3236
|
-
return (0,
|
|
3269
|
+
return (0, import_rxjs57.concat).apply(void 0, result);
|
|
3237
3270
|
})); };
|
|
3238
3271
|
// src/api/ObservableApiWrapper.ts
|
|
3239
3272
|
var import_axios2 = __toESM(require("axios"));
|
|
3240
|
-
var
|
|
3273
|
+
var import_rxjs58 = require("rxjs");
|
|
3241
3274
|
function redirectOccurred(value) {
|
|
3242
3275
|
var _a;
|
|
3243
3276
|
if ((_a = value.data) === null || _a === void 0 ? void 0 : _a.redirectUrl) {
|
|
@@ -3262,22 +3295,22 @@ var ObservableApiWrapper = /** @class */ (function () {
|
|
|
3262
3295
|
this.instance = instance;
|
|
3263
3296
|
}
|
|
3264
3297
|
class_2.prototype.get = function (path, config, callContext) {
|
|
3265
|
-
return (0,
|
|
3298
|
+
return (0, import_rxjs58.from)(this.instance.get(path, config)).pipe((0, import_rxjs58.takeWhile)(redirectOccurred), (0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3266
3299
|
};
|
|
3267
3300
|
class_2.prototype.put = function (path, data, callContext) {
|
|
3268
|
-
return (0,
|
|
3301
|
+
return (0, import_rxjs58.from)(this.instance.put(path, data)).pipe((0, import_rxjs58.takeWhile)(redirectOccurred), (0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3269
3302
|
};
|
|
3270
3303
|
class_2.prototype.post = function (path, data, config, callContext) {
|
|
3271
|
-
return (0,
|
|
3304
|
+
return (0, import_rxjs58.from)(this.instance.post(path, data)).pipe((0, import_rxjs58.takeWhile)(redirectOccurred), (0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3272
3305
|
};
|
|
3273
3306
|
class_2.prototype.delete = function (path, data, config, callContext) {
|
|
3274
|
-
return (0,
|
|
3307
|
+
return (0, import_rxjs58.from)(this.instance.delete(path, data)).pipe((0, import_rxjs58.takeWhile)(redirectOccurred), (0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3275
3308
|
};
|
|
3276
3309
|
return class_2;
|
|
3277
3310
|
}());
|
|
3278
3311
|
// src/api/ObservableApi.ts
|
|
3279
3312
|
var import_axios3 = __toESM(require("axios"));
|
|
3280
|
-
var
|
|
3313
|
+
var import_rxjs59 = require("rxjs");
|
|
3281
3314
|
var Api = /** @class */ (function () {
|
|
3282
3315
|
function class_3(instance) {
|
|
3283
3316
|
this.api$ = new ObservableApiWrapper(instance);
|
|
@@ -3296,32 +3329,32 @@ var Api = /** @class */ (function () {
|
|
|
3296
3329
|
var _this = this;
|
|
3297
3330
|
if (params === void 0) { params = {}; }
|
|
3298
3331
|
var currentPage = 1;
|
|
3299
|
-
return this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: currentPage })).pipe((0,
|
|
3300
|
-
return response.hasNext ? _this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: ++currentPage })) :
|
|
3301
|
-
}), (0,
|
|
3332
|
+
return this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: currentPage })).pipe((0, import_rxjs59.expand)(function (response) {
|
|
3333
|
+
return response.hasNext ? _this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: ++currentPage })) : import_rxjs59.EMPTY;
|
|
3334
|
+
}), (0, import_rxjs59.reduce)(function (items, nextResponse) {
|
|
3302
3335
|
return __spreadArray(__spreadArray([], items, true), nextResponse.data, true);
|
|
3303
3336
|
}, []));
|
|
3304
3337
|
};
|
|
3305
3338
|
class_3.prototype.fetchRowMeta = function (screenName, bcUrl, params, cancelToken) {
|
|
3306
3339
|
var url = applyParams(buildUrl(__makeTemplateObject(["row-meta/", "/"], ["row-meta/", "/"]), screenName) + bcUrl, params);
|
|
3307
|
-
return this.api$.get(url, { cancelToken: cancelToken }).pipe((0,
|
|
3340
|
+
return this.api$.get(url, { cancelToken: cancelToken }).pipe((0, import_rxjs59.map)(function (response) { var _a; return (_a = response.data) === null || _a === void 0 ? void 0 : _a.row; }));
|
|
3308
3341
|
};
|
|
3309
3342
|
class_3.prototype.newBcData = function (screenName, bcUrl, context, params) {
|
|
3310
3343
|
var url = applyParams(buildUrl(__makeTemplateObject(["row-meta-new/", "/"], ["row-meta-new/", "/"]), screenName) + bcUrl, params);
|
|
3311
|
-
return this.api$.get(url, void 0, context).pipe((0,
|
|
3344
|
+
return this.api$.get(url, void 0, context).pipe((0, import_rxjs59.map)(function (response) { return response.data; }));
|
|
3312
3345
|
};
|
|
3313
3346
|
class_3.prototype.saveBcData = function (screenName, bcUrl, data, context, params) {
|
|
3314
3347
|
var url = applyParams(buildUrl(__makeTemplateObject(["data/", "/"], ["data/", "/"]), screenName) + bcUrl, params);
|
|
3315
|
-
return this.api$.put(url, { data: data }, context).pipe((0,
|
|
3348
|
+
return this.api$.put(url, { data: data }, context).pipe((0, import_rxjs59.map)(function (response) { return response.data; }));
|
|
3316
3349
|
};
|
|
3317
3350
|
class_3.prototype.deleteBcData = function (screenName, bcUrl, context, params) {
|
|
3318
3351
|
if (bcUrl === void 0) { bcUrl = ""; }
|
|
3319
3352
|
var url = applyParams(buildUrl(__makeTemplateObject(["data/", "/"], ["data/", "/"]), screenName) + bcUrl, params);
|
|
3320
|
-
return this.api$.delete(url, context).pipe((0,
|
|
3353
|
+
return this.api$.delete(url, context).pipe((0, import_rxjs59.map)(function (response) { return response.data; }));
|
|
3321
3354
|
};
|
|
3322
3355
|
class_3.prototype.customAction = function (screenName, bcUrl, data, context, params) {
|
|
3323
3356
|
var url = applyParams(buildUrl(__makeTemplateObject(["custom-action/", "/"], ["custom-action/", "/"]), screenName) + bcUrl, params);
|
|
3324
|
-
return this.api$.post(url, { data: data || {} }, void 0, context).pipe((0,
|
|
3357
|
+
return this.api$.post(url, { data: data || {} }, void 0, context).pipe((0, import_rxjs59.map)(function (response) { return response.data; }));
|
|
3325
3358
|
};
|
|
3326
3359
|
class_3.prototype.associate = function (screenName, bcUrl, data, params) {
|
|
3327
3360
|
var processedData = Array.isArray(data) ? data.map(function (item) { return ({
|
|
@@ -3330,11 +3363,11 @@ var Api = /** @class */ (function () {
|
|
|
3330
3363
|
associated: item._associate
|
|
3331
3364
|
}); }) : data;
|
|
3332
3365
|
var url = applyParams(buildUrl(__makeTemplateObject(["associate/", "/"], ["associate/", "/"]), screenName) + bcUrl, params);
|
|
3333
|
-
return this.api$.post(url, processedData).pipe((0,
|
|
3366
|
+
return this.api$.post(url, processedData).pipe((0, import_rxjs59.map)(function (response) { return response.data; }));
|
|
3334
3367
|
};
|
|
3335
3368
|
class_3.prototype.getRmByForceActive = function (screenName, bcUrl, data, params) {
|
|
3336
3369
|
var url = applyParams(buildUrl(__makeTemplateObject(["row-meta/", "/"], ["row-meta/", "/"]), screenName) + (bcUrl !== null && bcUrl !== void 0 ? bcUrl : ""), params);
|
|
3337
|
-
return this.api$.post(url, { data: data }).pipe((0,
|
|
3370
|
+
return this.api$.post(url, { data: data }).pipe((0, import_rxjs59.map)(function (response) { return response.data.row; }));
|
|
3338
3371
|
};
|
|
3339
3372
|
Object.defineProperty(class_3.prototype, "fileUploadEndpoint", {
|
|
3340
3373
|
/**
|
|
@@ -3513,13 +3546,13 @@ var requiredFields = function (_a) {
|
|
|
3513
3546
|
return next(action);
|
|
3514
3547
|
}; };
|
|
3515
3548
|
};
|
|
3516
|
-
function operationRequiresAutosave(operationType,
|
|
3549
|
+
function operationRequiresAutosave(operationType, actions2) {
|
|
3517
3550
|
var result = false;
|
|
3518
|
-
if (!
|
|
3551
|
+
if (!actions2) {
|
|
3519
3552
|
console.error('rowMeta is missing in the middle of "sendOperation" action');
|
|
3520
3553
|
return result;
|
|
3521
3554
|
}
|
|
3522
|
-
result = flattenOperations(
|
|
3555
|
+
result = flattenOperations(actions2).some(function (action) { return action.type === operationType && action.autoSaveBefore; });
|
|
3523
3556
|
return result;
|
|
3524
3557
|
}
|
|
3525
3558
|
function getRequiredFieldsMissing(record, pendingChanges, fieldsMeta) {
|
|
@@ -3575,8 +3608,8 @@ var preInvokeAction = function (_a) {
|
|
|
3575
3608
|
var bcName = (_a = state.view.widgets.find(function (widgetItem) { return widgetItem.name === widgetName_2; })) === null || _a === void 0 ? void 0 : _a.bcName;
|
|
3576
3609
|
var bcUrl = buildBcUrl(bcName, true, state);
|
|
3577
3610
|
var rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) === null || _b === void 0 ? void 0 : _b[bcUrl]);
|
|
3578
|
-
var
|
|
3579
|
-
var preInvoke = (_c =
|
|
3611
|
+
var actions2 = rowMeta && flattenOperations(rowMeta.actions);
|
|
3612
|
+
var preInvoke = (_c = actions2 === null || actions2 === void 0 ? void 0 : actions2.find(function (item) { return item.type === operationType_1; })) === null || _c === void 0 ? void 0 : _c.preInvoke;
|
|
3580
3613
|
return preInvoke && !confirm ? next(processPreInvoke({
|
|
3581
3614
|
bcName: bcName,
|
|
3582
3615
|
operationType: operationType_1,
|