@cxbox-ui/core 1.37.2-alpha.10 → 1.37.2-alpha.12
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 +2 -1
- package/dist/cxbox-ui-core.cjs.development.js +340 -312
- package/dist/cxbox-ui-core.cjs.production.min.js +1 -1
- package/dist/cxbox-ui-core.esm.js +234 -206
- package/dist/cxbox-ui-core.modern.development.js +230 -203
- package/dist/cxbox-ui-core.modern.js +230 -203
- 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
|
@@ -497,6 +497,8 @@ __export(utils_exports, {
|
|
|
497
497
|
buildSearchResultTree: function () { return buildSearchResultTree; },
|
|
498
498
|
buildUrl: function () { return buildUrl; },
|
|
499
499
|
checkShowCondition: function () { return checkShowCondition; },
|
|
500
|
+
createApiError: function () { return createApiError; },
|
|
501
|
+
createApiErrorObservable: function () { return createApiErrorObservable; },
|
|
500
502
|
defaultBuildURL: function () { return defaultBuildURL; },
|
|
501
503
|
defaultParseURL: function () { return defaultParseURL; },
|
|
502
504
|
deleteUndefinedFromObject: function () { return deleteUndefinedFromObject; },
|
|
@@ -544,6 +546,19 @@ function applyRawParams(url, qso) {
|
|
|
544
546
|
var result = new URLSearchParams(qso).toString();
|
|
545
547
|
return "".concat(addTailControlSequences(url)).concat(result && "".concat(result));
|
|
546
548
|
}
|
|
549
|
+
// src/utils/apiError.ts
|
|
550
|
+
import { actions } from "@cxbox-ui/core";
|
|
551
|
+
import { EMPTY, of } from "rxjs";
|
|
552
|
+
function createApiError(error, context) {
|
|
553
|
+
if (context === void 0) { context = { widgetName: "unknown" }; }
|
|
554
|
+
if (!error.isAxiosError)
|
|
555
|
+
return void 0;
|
|
556
|
+
return actions.apiError({ error: error, callContext: context });
|
|
557
|
+
}
|
|
558
|
+
function createApiErrorObservable(error, context) {
|
|
559
|
+
var apiError2 = createApiError(error, context);
|
|
560
|
+
return apiError2 ? of(apiError2) : EMPTY;
|
|
561
|
+
}
|
|
547
562
|
// src/utils/strings.ts
|
|
548
563
|
function getTemplate(literals) {
|
|
549
564
|
var placeholders = [];
|
|
@@ -1109,7 +1124,9 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1109
1124
|
state.bo.bc[action.payload.bcName].page = action.payload.page;
|
|
1110
1125
|
state.bo.bc[action.payload.bcName].loading = true;
|
|
1111
1126
|
}).addCase(showViewPopup, function (state, action) {
|
|
1112
|
-
|
|
1127
|
+
var _a, _b;
|
|
1128
|
+
var currentPage = (_b = (_a = state.bo.bc[action.payload.bcName]) === null || _a === void 0 ? void 0 : _a.page) !== null && _b !== void 0 ? _b : 1;
|
|
1129
|
+
state.bo.bc[action.payload.bcName].page = action.payload.bcName === action.payload.calleeBCName ? currentPage : 1;
|
|
1113
1130
|
state.bo.bc[action.payload.bcName].loading = action.payload.bcName !== action.payload.calleeBCName;
|
|
1114
1131
|
}).addCase(sendOperationSuccess, function (state, action) {
|
|
1115
1132
|
state.bo.bc[action.payload.bcName].loading = false;
|
|
@@ -1138,7 +1155,8 @@ var initialSessionState = {
|
|
|
1138
1155
|
errorMsg: null,
|
|
1139
1156
|
screens: [],
|
|
1140
1157
|
pendingRequests: [],
|
|
1141
|
-
notifications: []
|
|
1158
|
+
notifications: [],
|
|
1159
|
+
isMetaRefreshing: false
|
|
1142
1160
|
};
|
|
1143
1161
|
var createSessionReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(login, function (state) {
|
|
1144
1162
|
state.loginSpin = true;
|
|
@@ -1168,6 +1186,12 @@ var createSessionReducerBuilderManager = function (initialState) { return new Re
|
|
|
1168
1186
|
}).addCase(removeNotifications, function (state, action) {
|
|
1169
1187
|
var closingKeys = action.payload;
|
|
1170
1188
|
state.notifications = state.notifications.filter(function (notification) { return !closingKeys.includes(notification.key); });
|
|
1189
|
+
}).addCase(refreshMeta, function (state) {
|
|
1190
|
+
state.isMetaRefreshing = true;
|
|
1191
|
+
}).addCase(refreshMetaDone, function (state) {
|
|
1192
|
+
state.isMetaRefreshing = false;
|
|
1193
|
+
}).addCase(refreshMetaFail, function (state) {
|
|
1194
|
+
state.isMetaRefreshing = false;
|
|
1171
1195
|
}); };
|
|
1172
1196
|
// src/reducers/view.ts
|
|
1173
1197
|
import { OperationTypeCrud as OperationTypeCrud4 } from "@cxbox-ui/schema";
|
|
@@ -1216,8 +1240,8 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1216
1240
|
}).addCase(bcNewDataSuccess, function (state, action) {
|
|
1217
1241
|
state.selectedCell = initialViewState.selectedCell;
|
|
1218
1242
|
}).addCase(forceActiveRmUpdate, function (state, action) {
|
|
1219
|
-
var _a, _b, _c, _d;
|
|
1220
|
-
var
|
|
1243
|
+
var _a, _b, _c, _d, _e;
|
|
1244
|
+
var _f = action.payload, bcName = _f.bcName, bcUrl = _f.bcUrl, currentRecordData = _f.currentRecordData, rowMeta = _f.rowMeta, cursor = _f.cursor;
|
|
1221
1245
|
var handledForceActive = {};
|
|
1222
1246
|
var rowMetaForcedValues = {};
|
|
1223
1247
|
var newPendingChangesDiff = {};
|
|
@@ -1228,6 +1252,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1228
1252
|
forceActiveFieldKeys.push(field.key);
|
|
1229
1253
|
}
|
|
1230
1254
|
});
|
|
1255
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1231
1256
|
var consolidatedFrontData = __assign(__assign({}, currentRecordData), state.pendingDataChanges[bcName][cursor]);
|
|
1232
1257
|
Object.keys(consolidatedFrontData).forEach(function (key) {
|
|
1233
1258
|
if (rowMetaForcedValues[key] !== void 0 && consolidatedFrontData[key] !== rowMetaForcedValues[key]) {
|
|
@@ -1240,12 +1265,12 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1240
1265
|
handledForceActive[key] = newPendingDataChanges[key];
|
|
1241
1266
|
}
|
|
1242
1267
|
});
|
|
1243
|
-
state.handledForceActive[bcName] = (
|
|
1244
|
-
state.handledForceActive[bcName][cursor] = (
|
|
1268
|
+
state.handledForceActive[bcName] = (_b = state.handledForceActive[bcName]) !== null && _b !== void 0 ? _b : {};
|
|
1269
|
+
state.handledForceActive[bcName][cursor] = (_c = state.handledForceActive[bcName][cursor]) !== null && _c !== void 0 ? _c : {};
|
|
1245
1270
|
Object.assign(state.handledForceActive[bcName][cursor], handledForceActive);
|
|
1246
|
-
state.pendingDataChanges[bcName] = (
|
|
1271
|
+
state.pendingDataChanges[bcName] = (_d = state.pendingDataChanges[bcName]) !== null && _d !== void 0 ? _d : {};
|
|
1247
1272
|
state.pendingDataChanges[bcName][cursor] = newPendingDataChanges;
|
|
1248
|
-
state.rowMeta[bcName] = (
|
|
1273
|
+
state.rowMeta[bcName] = (_e = state.rowMeta[bcName]) !== null && _e !== void 0 ? _e : {};
|
|
1249
1274
|
state.rowMeta[bcName][bcUrl] = rowMeta;
|
|
1250
1275
|
}).addCase(changeDataItem, function (state, action) {
|
|
1251
1276
|
var _a, _b, _c;
|
|
@@ -1511,9 +1536,9 @@ __export(epics_exports, {
|
|
|
1511
1536
|
userDrillDownEpic: function () { return userDrillDownEpic; }
|
|
1512
1537
|
});
|
|
1513
1538
|
// src/epics/view/sendOperationEpic.ts
|
|
1514
|
-
import { catchError, concat, EMPTY, filter, mergeMap, of as
|
|
1539
|
+
import { catchError, concat, EMPTY as EMPTY2, filter, mergeMap, of as of3 } from "rxjs";
|
|
1515
1540
|
// src/epics/utils/postOperationRoutine.ts
|
|
1516
|
-
import { of } from "rxjs";
|
|
1541
|
+
import { of as of2 } from "rxjs";
|
|
1517
1542
|
function postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName) {
|
|
1518
1543
|
var postInvokeConfirm = Object.values(OperationPostInvokeConfirmType).includes(postInvoke === null || postInvoke === void 0 ? void 0 : postInvoke.type);
|
|
1519
1544
|
var result = [];
|
|
@@ -1536,7 +1561,7 @@ function postOperationRoutine(widgetName, postInvoke, preInvoke, operationType,
|
|
|
1536
1561
|
preInvoke: preInvoke
|
|
1537
1562
|
}));
|
|
1538
1563
|
}
|
|
1539
|
-
return result.map(function (item) { return
|
|
1564
|
+
return result.map(function (item) { return of2(item); });
|
|
1540
1565
|
}
|
|
1541
1566
|
// src/epics/view/sendOperationEpic.ts
|
|
1542
1567
|
var sendOperationEpic = function (action$, state$, _a) {
|
|
@@ -1575,8 +1600,8 @@ var sendOperationEpic = function (action$, state$, _a) {
|
|
|
1575
1600
|
var _a, _b;
|
|
1576
1601
|
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
1577
1602
|
var preInvoke = response.preInvoke;
|
|
1578
|
-
return defaultSaveOperation ? ((_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.onSuccessAction) ? concat(
|
|
1579
|
-
|
|
1603
|
+
return defaultSaveOperation ? ((_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.onSuccessAction) ? concat(of3(bcCancelPendingChanges({ bcNames: [bcName] })), of3(action.payload.onSuccessAction)) : EMPTY2 : concat.apply(void 0, __spreadArray([of3(sendOperationSuccess({ bcName: bcName, cursor: cursor })),
|
|
1604
|
+
of3(bcForceUpdate({ bcName: bcName }))], postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName), false));
|
|
1580
1605
|
}), catchError(function (e) {
|
|
1581
1606
|
var _a, _b, _c, _d, _e, _f;
|
|
1582
1607
|
console.error(e);
|
|
@@ -1587,12 +1612,12 @@ var sendOperationEpic = function (action$, state$, _a) {
|
|
|
1587
1612
|
entityError = (_d = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _d === void 0 ? void 0 : _d.entity;
|
|
1588
1613
|
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];
|
|
1589
1614
|
}
|
|
1590
|
-
return
|
|
1615
|
+
return concat(of3(sendOperationFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError })), createApiErrorObservable(e, context));
|
|
1591
1616
|
}));
|
|
1592
1617
|
}));
|
|
1593
1618
|
};
|
|
1594
1619
|
// src/epics/view/showAssocPopupEpic.ts
|
|
1595
|
-
import { EMPTY as
|
|
1620
|
+
import { EMPTY as EMPTY3, filter as filter2, mergeMap as mergeMap2, of as of4 } from "rxjs";
|
|
1596
1621
|
import { WidgetTypes as WidgetTypes3 } from "@cxbox-ui/schema";
|
|
1597
1622
|
var showAssocPopupEpic = function (action$, state$) { return action$.pipe(filter2(showViewPopup.match), filter2(function (action) { return !!(action.payload.calleeBCName && action.payload.associateFieldKey); }), mergeMap2(function (action) {
|
|
1598
1623
|
var _a, _b, _c, _d;
|
|
@@ -1605,7 +1630,7 @@ var showAssocPopupEpic = function (action$, state$) { return action$.pipe(filter
|
|
|
1605
1630
|
var assocFieldChanges = calleePendingChanges === null || calleePendingChanges === void 0 ? void 0 : calleePendingChanges[assocFieldKey];
|
|
1606
1631
|
var somethingMissing = !assocWidget || !calleePendingChanges || !assocFieldChanges || !assocFieldChanges;
|
|
1607
1632
|
if (somethingMissing || assocWidget.options && !assocWidget.options.hierarchyFull) {
|
|
1608
|
-
return
|
|
1633
|
+
return EMPTY3;
|
|
1609
1634
|
}
|
|
1610
1635
|
var popupInitPendingChanges = {};
|
|
1611
1636
|
assocFieldChanges.forEach(function (record) {
|
|
@@ -1628,14 +1653,14 @@ var showAssocPopupEpic = function (action$, state$) { return action$.pipe(filter
|
|
|
1628
1653
|
}
|
|
1629
1654
|
});
|
|
1630
1655
|
}
|
|
1631
|
-
return
|
|
1656
|
+
return of4(changeDataItems({
|
|
1632
1657
|
bcName: bcName,
|
|
1633
1658
|
cursors: Object.keys(popupInitPendingChanges),
|
|
1634
1659
|
dataItems: Object.values(popupInitPendingChanges)
|
|
1635
1660
|
}));
|
|
1636
1661
|
})); };
|
|
1637
1662
|
// src/epics/view/fileUploadConfirmEpic.ts
|
|
1638
|
-
import { concat as concat2, filter as filter3, mergeMap as mergeMap3, of as
|
|
1663
|
+
import { catchError as catchError2, concat as concat2, filter as filter3, mergeMap as mergeMap3, of as of5 } from "rxjs";
|
|
1639
1664
|
import { OperationTypeCrud as OperationTypeCrud5 } from "@cxbox-ui/schema";
|
|
1640
1665
|
var fileUploadConfirmEpic = function (action$, state$, _a) {
|
|
1641
1666
|
var api = _a.api;
|
|
@@ -1652,14 +1677,17 @@ var fileUploadConfirmEpic = function (action$, state$, _a) {
|
|
|
1652
1677
|
var _a;
|
|
1653
1678
|
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
1654
1679
|
var preInvoke = response.preInvoke;
|
|
1655
|
-
return concat2.apply(void 0, __spreadArray([
|
|
1656
|
-
|
|
1657
|
-
|
|
1680
|
+
return concat2.apply(void 0, __spreadArray([of5(sendOperationSuccess({ bcName: bcName, cursor: null })),
|
|
1681
|
+
of5(bcForceUpdate({ bcName: bcName })),
|
|
1682
|
+
of5(closeViewPopup(null))], postOperationRoutine(widgetName, postInvoke, preInvoke, OperationTypeCrud5.save, bcName), false));
|
|
1683
|
+
}), catchError2(function (error) {
|
|
1684
|
+
console.error(error);
|
|
1685
|
+
return createApiErrorObservable(error);
|
|
1658
1686
|
}));
|
|
1659
1687
|
}));
|
|
1660
1688
|
};
|
|
1661
1689
|
// src/epics/view/selectTableCellInitEpic.ts
|
|
1662
|
-
import { concat as concat3, filter as filter4, mergeMap as mergeMap4, of as
|
|
1690
|
+
import { concat as concat3, filter as filter4, mergeMap as mergeMap4, of as of6 } from "rxjs";
|
|
1663
1691
|
var selectTableCellInitEpic = function (action$, state$) { return action$.pipe(filter4(selectTableCellInit.match), mergeMap4(function (action) {
|
|
1664
1692
|
var _a;
|
|
1665
1693
|
var resultObservables = [];
|
|
@@ -1670,19 +1698,19 @@ var selectTableCellInitEpic = function (action$, state$) { return action$.pipe(f
|
|
|
1670
1698
|
var nextBcCursor = (_a = state.screen.bo.bc[nextBcName]) === null || _a === void 0 ? void 0 : _a.cursor;
|
|
1671
1699
|
var selectedCell = state.view.selectedCell;
|
|
1672
1700
|
if (nextRowId !== nextBcCursor) {
|
|
1673
|
-
resultObservables.push(
|
|
1701
|
+
resultObservables.push(of6(bcSelectRecord({ bcName: nextBcName, cursor: nextRowId })));
|
|
1674
1702
|
}
|
|
1675
1703
|
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || (nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.name) !== selectedCell.widgetName) {
|
|
1676
|
-
resultObservables.push(
|
|
1704
|
+
resultObservables.push(of6(selectTableCell({ widgetName: nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.name, rowId: nextRowId, fieldKey: fieldKey })));
|
|
1677
1705
|
}
|
|
1678
1706
|
return concat3.apply(void 0, resultObservables);
|
|
1679
1707
|
})); };
|
|
1680
1708
|
// src/epics/view/showFileUploadPopupEpic.ts
|
|
1681
|
-
import { concat as concat4, filter as filter5, mergeMap as mergeMap5, of as
|
|
1709
|
+
import { concat as concat4, filter as filter5, mergeMap as mergeMap5, of as of7 } from "rxjs";
|
|
1682
1710
|
import { OperationTypeCrud as OperationTypeCrud6 } from "@cxbox-ui/schema";
|
|
1683
1711
|
var showFileUploadPopupEpic = function (action$, state$) { return action$.pipe(filter5(sendOperation.match), filter5(function (action) { return matchOperationRole(OperationTypeCrud6.fileUpload, action.payload, state$.value); }), mergeMap5(function (action) {
|
|
1684
1712
|
var _a;
|
|
1685
|
-
return concat4(
|
|
1713
|
+
return concat4(of7(bcChangeCursors({ cursorsMap: (_a = {}, _a[action.payload.bcName] = null, _a) })), of7(showFileUploadPopup({ widgetName: action.payload.widgetName })));
|
|
1686
1714
|
})); };
|
|
1687
1715
|
// src/epics/view/sendOperationAssociateEpic.ts
|
|
1688
1716
|
import { filter as filter6, map } from "rxjs";
|
|
@@ -1697,31 +1725,31 @@ var sendOperationAssociateEpic = function (action$, state$) { return action$.pip
|
|
|
1697
1725
|
});
|
|
1698
1726
|
})); };
|
|
1699
1727
|
// src/epics/view/getRowMetaByForceActiveEpic.ts
|
|
1700
|
-
import { EMPTY as
|
|
1728
|
+
import { EMPTY as EMPTY4, concat as concat5, filter as filter7, mergeMap as mergeMap6, of as of8, catchError as catchError3 } from "rxjs";
|
|
1701
1729
|
import { WidgetTypes as WidgetTypes4 } from "@cxbox-ui/schema";
|
|
1702
1730
|
import { nanoid } from "@reduxjs/toolkit";
|
|
1703
1731
|
var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
1704
1732
|
var api = _a.api;
|
|
1705
1733
|
return action$.pipe(filter7(changeDataItem.match), mergeMap6(function (action) {
|
|
1706
|
-
var _a, _b, _c, _d;
|
|
1734
|
+
var _a, _b, _c, _d, _e;
|
|
1707
1735
|
var state = state$.value;
|
|
1708
1736
|
var initUrl = state.view.url;
|
|
1709
|
-
var
|
|
1737
|
+
var _f = action.payload, bcName = _f.bcName, cursor = _f.cursor, disableRetry = _f.disableRetry;
|
|
1710
1738
|
var isBcHierarchy = state.view.widgets.some(function (widget) {
|
|
1711
1739
|
var _a, _b;
|
|
1712
1740
|
return widget.bcName === bcName && widget.type === WidgetTypes4.AssocListPopup && (((_a = widget.options) === null || _a === void 0 ? void 0 : _a.hierarchySameBc) || ((_b = widget.options) === null || _b === void 0 ? void 0 : _b.hierarchyFull));
|
|
1713
1741
|
});
|
|
1714
1742
|
if (isBcHierarchy) {
|
|
1715
|
-
return
|
|
1743
|
+
return EMPTY4;
|
|
1716
1744
|
}
|
|
1717
1745
|
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) && [WidgetTypes4.PickListPopup, WidgetTypes4.FlatTreePopup].includes(item.type); });
|
|
1718
1746
|
var bcUrl = buildBcUrl(bcName, true, state);
|
|
1719
|
-
var pendingChanges = state.view.pendingDataChanges[bcName][cursor];
|
|
1720
|
-
var handledForceActive = ((
|
|
1721
|
-
var currentRecordData = (
|
|
1722
|
-
var fieldsRowMeta = (
|
|
1747
|
+
var pendingChanges = (_a = state.view.pendingDataChanges[bcName]) === null || _a === void 0 ? void 0 : _a[cursor];
|
|
1748
|
+
var handledForceActive = ((_b = state.view.handledForceActive[bcName]) === null || _b === void 0 ? void 0 : _b[cursor]) || {};
|
|
1749
|
+
var currentRecordData = (_c = state.data[bcName]) === null || _c === void 0 ? void 0 : _c.find(function (record) { return record.id === cursor; });
|
|
1750
|
+
var fieldsRowMeta = (_e = (_d = state.view.rowMeta[bcName]) === null || _d === void 0 ? void 0 : _d[bcUrl]) === null || _e === void 0 ? void 0 : _e.fields;
|
|
1723
1751
|
var changedFiledKey = null;
|
|
1724
|
-
var closePopup = concat5(
|
|
1752
|
+
var closePopup = concat5(of8(closeViewPopup(null)), of8(viewClearPickMap(null)), of8(bcRemoveAllFilters({ bcName: bcName })));
|
|
1725
1753
|
var someForceActiveChanged = fieldsRowMeta === null || fieldsRowMeta === void 0 ? void 0 : fieldsRowMeta.filter(function (field) { return field.forceActive && pendingChanges[field.key] !== void 0; }).some(function (field) {
|
|
1726
1754
|
var result = pendingChanges[field.key] !== handledForceActive[field.key];
|
|
1727
1755
|
if (result) {
|
|
@@ -1731,10 +1759,10 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1731
1759
|
});
|
|
1732
1760
|
var requestId = nanoid();
|
|
1733
1761
|
if (someForceActiveChanged && !disableRetry) {
|
|
1734
|
-
return concat5(
|
|
1735
|
-
var result = [
|
|
1762
|
+
return concat5(of8(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(mergeMap6(function (data) {
|
|
1763
|
+
var result = [of8(removePendingRequest({ requestId: requestId }))];
|
|
1736
1764
|
if (state.view.url === initUrl) {
|
|
1737
|
-
result.push(
|
|
1765
|
+
result.push(of8(forceActiveRmUpdate({
|
|
1738
1766
|
rowMeta: data,
|
|
1739
1767
|
currentRecordData: currentRecordData,
|
|
1740
1768
|
bcName: bcName,
|
|
@@ -1746,7 +1774,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1746
1774
|
result.push(closePopup);
|
|
1747
1775
|
}
|
|
1748
1776
|
return concat5.apply(void 0, result);
|
|
1749
|
-
}),
|
|
1777
|
+
}), catchError3(function (e) {
|
|
1750
1778
|
var _a;
|
|
1751
1779
|
var _b, _c, _d, _e, _f, _g;
|
|
1752
1780
|
console.error(e);
|
|
@@ -1757,35 +1785,35 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1757
1785
|
entityError = (_e = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _e === void 0 ? void 0 : _e.entity;
|
|
1758
1786
|
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];
|
|
1759
1787
|
}
|
|
1760
|
-
return concat5(
|
|
1788
|
+
return concat5(of8(removePendingRequest({ requestId: requestId })), state.view.url === initUrl ? concat5(of8(changeDataItem({
|
|
1761
1789
|
bcName: bcName,
|
|
1762
1790
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
1763
1791
|
cursor: cursor,
|
|
1764
1792
|
dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData === null || currentRecordData === void 0 ? void 0 : currentRecordData[changedFiledKey], _a),
|
|
1765
1793
|
disableRetry: true
|
|
1766
|
-
})),
|
|
1794
|
+
})), of8(forceActiveChangeFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError }))) : EMPTY4, createApiErrorObservable(e));
|
|
1767
1795
|
})));
|
|
1768
1796
|
}
|
|
1769
|
-
return isPickListPopup ? closePopup :
|
|
1797
|
+
return isPickListPopup ? closePopup : EMPTY4;
|
|
1770
1798
|
}));
|
|
1771
1799
|
};
|
|
1772
1800
|
// src/epics/view/showAllTableRecordsInitEpic.ts
|
|
1773
|
-
import { concat as concat6, filter as filter8, mergeMap as mergeMap7, of as
|
|
1801
|
+
import { concat as concat6, filter as filter8, mergeMap as mergeMap7, of as of9 } from "rxjs";
|
|
1774
1802
|
var showAllTableRecordsInitEpic = function (action$, state$) { return action$.pipe(filter8(showAllTableRecordsInit.match), mergeMap7(function (action) {
|
|
1775
1803
|
var _a;
|
|
1776
1804
|
var resultObservables = [];
|
|
1777
1805
|
var _b = action.payload, bcName = _b.bcName, cursor = _b.cursor;
|
|
1778
1806
|
var state = state$.value;
|
|
1779
1807
|
var route = state.router;
|
|
1780
|
-
resultObservables.push(
|
|
1808
|
+
resultObservables.push(of9(bcChangeCursors({ cursorsMap: (_a = {}, _a[bcName] = null, _a) })));
|
|
1781
1809
|
var bcPath = route.bcPath.slice(0, route.bcPath.indexOf("".concat(bcName, "/").concat(cursor)));
|
|
1782
1810
|
var url = defaultBuildURL(__assign(__assign({}, route), { bcPath: bcPath }));
|
|
1783
|
-
resultObservables.push(
|
|
1784
|
-
resultObservables.push(
|
|
1811
|
+
resultObservables.push(of9(bcForceUpdate({ bcName: bcName })));
|
|
1812
|
+
resultObservables.push(of9(changeLocation({ location: defaultParseURL(new URL(url, window.location.origin)) })));
|
|
1785
1813
|
return concat6.apply(void 0, resultObservables);
|
|
1786
1814
|
})); };
|
|
1787
1815
|
// src/epics/view/clearPendingDataChangesAfterCursorChangeEpic.ts
|
|
1788
|
-
import { EMPTY as
|
|
1816
|
+
import { EMPTY as EMPTY5, filter as filter9, mergeMap as mergeMap8, of as of10 } from "rxjs";
|
|
1789
1817
|
var clearPendingDataChangesAfterCursorChangeEpic = function (action$, state$) { return action$.pipe(filter9(bcChangeCursors.match), mergeMap8(function (action) {
|
|
1790
1818
|
var state = state$.value;
|
|
1791
1819
|
var nextCursors = parseBcCursors(state.router.bcPath) || {};
|
|
@@ -1798,12 +1826,12 @@ var clearPendingDataChangesAfterCursorChangeEpic = function (action$, state$) {
|
|
|
1798
1826
|
}
|
|
1799
1827
|
});
|
|
1800
1828
|
if (Object.keys(cursorsDiffMap).length) {
|
|
1801
|
-
return
|
|
1829
|
+
return of10(bcChangeCursors({ cursorsMap: cursorsDiffMap }));
|
|
1802
1830
|
}
|
|
1803
|
-
return
|
|
1831
|
+
return EMPTY5;
|
|
1804
1832
|
})); };
|
|
1805
1833
|
// src/epics/router/drilldownEpic.ts
|
|
1806
|
-
import { concat as concat7, EMPTY as
|
|
1834
|
+
import { concat as concat7, EMPTY as EMPTY6, filter as filter10, switchMap } from "rxjs";
|
|
1807
1835
|
var drillDownEpic = function (action$, state$) { return action$.pipe(filter10(drillDown.match), switchMap(function (action) {
|
|
1808
1836
|
var _a, _b;
|
|
1809
1837
|
var state = state$.value;
|
|
@@ -1880,7 +1908,7 @@ var drillDownEpic = function (action$, state$) { return action$.pipe(filter10(dr
|
|
|
1880
1908
|
result.push(changeLocation({ location: defaultParseURL(new URL(makeRelativeUrl(urlBase), window.location.origin)) }));
|
|
1881
1909
|
break;
|
|
1882
1910
|
}
|
|
1883
|
-
return result.length ? concat7(result) :
|
|
1911
|
+
return result.length ? concat7(result) : EMPTY6;
|
|
1884
1912
|
})); };
|
|
1885
1913
|
function shallowCompare(prevProps, nextProps, ignore) {
|
|
1886
1914
|
if (ignore === void 0) { ignore = []; }
|
|
@@ -1908,18 +1936,18 @@ function shallowCompare(prevProps, nextProps, ignore) {
|
|
|
1908
1936
|
return diffProps;
|
|
1909
1937
|
}
|
|
1910
1938
|
// src/epics/router/loginDoneEpic.ts
|
|
1911
|
-
import { filter as filter11, of as
|
|
1939
|
+
import { filter as filter11, of as of11, switchMap as switchMap2 } from "rxjs";
|
|
1912
1940
|
var loginDoneEpic = function (action$, state$) { return action$.pipe(filter11(loginDone.match), switchMap2(function (action) {
|
|
1913
1941
|
var state = state$.value;
|
|
1914
1942
|
if (state.router.type === "router" /* router */) {
|
|
1915
|
-
return
|
|
1943
|
+
return of11(handleRouter(state.router));
|
|
1916
1944
|
}
|
|
1917
1945
|
var nextScreenName = state.router.screenName;
|
|
1918
1946
|
var nextScreen = state.session.screens.find(function (item) { return nextScreenName ? item.name === nextScreenName : item.defaultScreen; }) || state.session.screens[0];
|
|
1919
|
-
return nextScreen ?
|
|
1947
|
+
return nextScreen ? of11(selectScreen({ screen: nextScreen })) : of11(selectScreenFail({ screenName: nextScreenName }));
|
|
1920
1948
|
})); };
|
|
1921
1949
|
// src/epics/router/selectViewEpic.ts
|
|
1922
|
-
import { EMPTY as
|
|
1950
|
+
import { EMPTY as EMPTY7, filter as filter12, of as of12, switchMap as switchMap3 } from "rxjs";
|
|
1923
1951
|
var changeViewEpic = function (action$, state$) { return action$.pipe(filter12(selectView.match), switchMap3(function (action) {
|
|
1924
1952
|
var state = state$.value;
|
|
1925
1953
|
var nextCursors = parseBcCursors(state.router.bcPath) || {};
|
|
@@ -1932,37 +1960,37 @@ var changeViewEpic = function (action$, state$) { return action$.pipe(filter12(s
|
|
|
1932
1960
|
}
|
|
1933
1961
|
});
|
|
1934
1962
|
if (Object.keys(cursorsDiffMap).length) {
|
|
1935
|
-
return
|
|
1963
|
+
return of12(bcChangeCursors({ cursorsMap: cursorsDiffMap }));
|
|
1936
1964
|
}
|
|
1937
|
-
return
|
|
1965
|
+
return EMPTY7;
|
|
1938
1966
|
})); };
|
|
1939
1967
|
// src/epics/router/handleRouterEpic.ts
|
|
1940
|
-
import { catchError as
|
|
1968
|
+
import { catchError as catchError4, EMPTY as EMPTY8, filter as filter13, mergeMap as mergeMap9, switchMap as switchMap4 } from "rxjs";
|
|
1941
1969
|
var handleRouterEpic = function (action$, state$, _a) {
|
|
1942
1970
|
var api = _a.api;
|
|
1943
1971
|
return action$.pipe(filter13(handleRouter.match), switchMap4(function (action) {
|
|
1944
1972
|
var path = action.payload.path;
|
|
1945
1973
|
var params = action.payload.params;
|
|
1946
1974
|
return api.routerRequest(path, params).pipe(mergeMap9(function () {
|
|
1947
|
-
return
|
|
1948
|
-
}),
|
|
1975
|
+
return EMPTY8;
|
|
1976
|
+
}), catchError4(function (error) {
|
|
1949
1977
|
console.error(error);
|
|
1950
|
-
return
|
|
1978
|
+
return createApiErrorObservable(error);
|
|
1951
1979
|
}));
|
|
1952
1980
|
}));
|
|
1953
1981
|
};
|
|
1954
1982
|
// src/epics/router/selectScreenEpic.ts
|
|
1955
|
-
import { filter as filter14, of as
|
|
1983
|
+
import { filter as filter14, of as of13, switchMap as switchMap5 } from "rxjs";
|
|
1956
1984
|
var changeScreen = function (action$, state$) { return action$.pipe(filter14(selectScreen.match), switchMap5(function (action) {
|
|
1957
1985
|
var state = state$.value;
|
|
1958
1986
|
var nextViewName = state.router.viewName;
|
|
1959
1987
|
var requestedView = state.screen.views.find(function (item) { return item.name === nextViewName; });
|
|
1960
1988
|
var defaultView = !nextViewName && state.screen.primaryView && state.screen.views.find(function (item) { return item.name === state.screen.primaryView; });
|
|
1961
1989
|
var nextView = requestedView || defaultView || state.screen.views[0];
|
|
1962
|
-
return nextView ?
|
|
1990
|
+
return nextView ? of13(selectView(nextView)) : of13(selectViewFail({ viewName: nextViewName }));
|
|
1963
1991
|
})); };
|
|
1964
1992
|
// src/epics/router/userDrillDownEpic.ts
|
|
1965
|
-
import { catchError as
|
|
1993
|
+
import { catchError as catchError5, concat as concat8, EMPTY as EMPTY9, filter as filter15, mergeMap as mergeMap10, of as of14, switchMap as switchMap6 } from "rxjs";
|
|
1966
1994
|
var userDrillDownEpic = function (action$, state$, _a) {
|
|
1967
1995
|
var api = _a.api;
|
|
1968
1996
|
return action$.pipe(filter15(userDrillDown.match), switchMap6(function (action) {
|
|
@@ -1975,34 +2003,34 @@ var userDrillDownEpic = function (action$, state$, _a) {
|
|
|
1975
2003
|
var route = state.router;
|
|
1976
2004
|
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;
|
|
1977
2005
|
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];
|
|
1978
|
-
return customDrillDownUrl || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) !== route.path ? concat8((drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDownType) !== DrillDownType.inner ?
|
|
2006
|
+
return customDrillDownUrl || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) !== route.path ? concat8((drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDownType) !== DrillDownType.inner ? of14(bcFetchRowMetaSuccess({ bcName: bcName, rowMeta: rowMeta, bcUrl: bcUrl, cursor: cursor })) : EMPTY9, of14(userDrillDownSuccess({ bcName: bcName, bcUrl: bcUrl, cursor: cursor })), of14(drillDown({
|
|
1979
2007
|
url: customDrillDownUrl || drillDownField.drillDown,
|
|
1980
2008
|
drillDownType: drillDownField.drillDownType,
|
|
1981
2009
|
route: route
|
|
1982
|
-
}))) :
|
|
1983
|
-
}),
|
|
2010
|
+
}))) : EMPTY9;
|
|
2011
|
+
}), catchError5(function (error) {
|
|
1984
2012
|
console.error(error);
|
|
1985
|
-
return
|
|
2013
|
+
return createApiErrorObservable(error);
|
|
1986
2014
|
}));
|
|
1987
2015
|
}));
|
|
1988
2016
|
};
|
|
1989
2017
|
// src/epics/router/changeLocationEpic.ts
|
|
1990
|
-
import { concat as concat9, EMPTY as
|
|
2018
|
+
import { concat as concat9, EMPTY as EMPTY10, filter as filter16, mergeMap as mergeMap11, of as of15 } from "rxjs";
|
|
1991
2019
|
var changeLocationEpic = function (action$, state$) { return action$.pipe(filter16(changeLocation.match), mergeMap11(function (action) {
|
|
1992
2020
|
var _a, _b;
|
|
1993
2021
|
var state = state$.value;
|
|
1994
2022
|
if (!state.session.active) {
|
|
1995
|
-
return
|
|
2023
|
+
return EMPTY10;
|
|
1996
2024
|
}
|
|
1997
2025
|
if (state.router.type === "router" /* router */) {
|
|
1998
|
-
return
|
|
2026
|
+
return of15(handleRouter(state.router));
|
|
1999
2027
|
}
|
|
2000
2028
|
var currentScreenName = state.screen.screenName;
|
|
2001
2029
|
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);
|
|
2002
2030
|
var nextScreenName = state.router.type === "default" /* default */ ? defaultScreenName : state.router.screenName;
|
|
2003
2031
|
if (nextScreenName !== currentScreenName) {
|
|
2004
2032
|
var nextScreen = state.session.screens.find(function (item) { return item.name === nextScreenName; });
|
|
2005
|
-
return nextScreen ?
|
|
2033
|
+
return nextScreen ? of15(selectScreen({ screen: nextScreen })) : of15(selectScreenFail({ screenName: nextScreenName }));
|
|
2006
2034
|
}
|
|
2007
2035
|
var currentViewName = state.view.name;
|
|
2008
2036
|
var nextViewName = state.router.viewName;
|
|
@@ -2019,17 +2047,17 @@ var changeLocationEpic = function (action$, state$) { return action$.pipe(filter
|
|
|
2019
2047
|
var needUpdateViews = nextViewName !== currentViewName;
|
|
2020
2048
|
var resultObservables = [];
|
|
2021
2049
|
if (needUpdateCursors) {
|
|
2022
|
-
resultObservables.push(
|
|
2050
|
+
resultObservables.push(of15(bcChangeCursors({ cursorsMap: cursorsDiffMap })));
|
|
2023
2051
|
}
|
|
2024
2052
|
if (needUpdateViews) {
|
|
2025
2053
|
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];
|
|
2026
|
-
resultObservables.push(nextView ?
|
|
2054
|
+
resultObservables.push(nextView ? of15(selectView(nextView)) : of15(selectViewFail({ viewName: nextViewName })));
|
|
2027
2055
|
}
|
|
2028
2056
|
if (needUpdateCursors && !needUpdateViews) {
|
|
2029
2057
|
Object.entries(nextCursors).forEach(function (entry) {
|
|
2030
2058
|
var bcName = entry[0], cursor = entry[1];
|
|
2031
2059
|
if (!state.data[bcName].find(function (item) { return item.id === cursor; })) {
|
|
2032
|
-
resultObservables.push(
|
|
2060
|
+
resultObservables.push(of15(bcForceUpdate({ bcName: bcName })));
|
|
2033
2061
|
}
|
|
2034
2062
|
});
|
|
2035
2063
|
}
|
|
@@ -2070,27 +2098,27 @@ var userDrillDownChangeCursorsEpic = function (action$, state$) { return action$
|
|
|
2070
2098
|
})); };
|
|
2071
2099
|
// src/epics/screen/apiErrorEpic.ts
|
|
2072
2100
|
import axios from "axios";
|
|
2073
|
-
import { EMPTY as
|
|
2101
|
+
import { EMPTY as EMPTY11, filter as filter20, mergeMap as mergeMap12, of as of16 } from "rxjs";
|
|
2074
2102
|
var apiErrorEpic = function (action$) { return action$.pipe(filter20(apiError.match), mergeMap12(function (action) {
|
|
2075
2103
|
var _a = action.payload, error = _a.error, callContext = _a.callContext;
|
|
2076
2104
|
if (error.response) {
|
|
2077
|
-
return
|
|
2105
|
+
return of16(httpError({
|
|
2078
2106
|
statusCode: error.response.status,
|
|
2079
2107
|
error: error,
|
|
2080
2108
|
callContext: callContext
|
|
2081
2109
|
}));
|
|
2082
2110
|
}
|
|
2083
2111
|
else if (!axios.isCancel(error)) {
|
|
2084
|
-
return
|
|
2112
|
+
return of16(showViewError({
|
|
2085
2113
|
error: {
|
|
2086
2114
|
type: 2 /* NetworkError */
|
|
2087
2115
|
}
|
|
2088
2116
|
}));
|
|
2089
2117
|
}
|
|
2090
|
-
return
|
|
2118
|
+
return EMPTY11;
|
|
2091
2119
|
})); };
|
|
2092
2120
|
// src/epics/screen/downloadFileEpic.ts
|
|
2093
|
-
import { EMPTY as
|
|
2121
|
+
import { EMPTY as EMPTY12, filter as filter21, mergeMap as mergeMap13, tap } from "rxjs";
|
|
2094
2122
|
var downloadFileEpic = function (action$, state$, _a) {
|
|
2095
2123
|
var api = _a.api;
|
|
2096
2124
|
return action$.pipe(filter21(downloadFile.match), tap(function (action) {
|
|
@@ -2103,7 +2131,7 @@ var downloadFileEpic = function (action$, state$, _a) {
|
|
|
2103
2131
|
anchor.click();
|
|
2104
2132
|
document.body.removeChild(anchor);
|
|
2105
2133
|
}, 100);
|
|
2106
|
-
}), mergeMap13(function () { return
|
|
2134
|
+
}), mergeMap13(function () { return EMPTY12; }));
|
|
2107
2135
|
};
|
|
2108
2136
|
// src/epics/screen/httpError401Epic.ts
|
|
2109
2137
|
import { filter as filter22, map as map5 } from "rxjs";
|
|
@@ -2128,24 +2156,24 @@ var httpError409Epic = function (action$, state$) { return action$.pipe(filter23
|
|
|
2128
2156
|
});
|
|
2129
2157
|
})); };
|
|
2130
2158
|
// src/epics/screen/httpError418Epic.ts
|
|
2131
|
-
import { concat as concat10, EMPTY as
|
|
2159
|
+
import { concat as concat10, EMPTY as EMPTY13, filter as filter24, mergeMap as mergeMap14, of as of17 } from "rxjs";
|
|
2132
2160
|
var httpError418Epic = function (action$, state$) { return action$.pipe(filter24(httpError.match), filter24(function (action) { return action.payload.statusCode === 418; }), mergeMap14(function (action) {
|
|
2133
2161
|
var _a, _b;
|
|
2134
2162
|
var _c = action.payload, error = _c.error, callContext = _c.callContext;
|
|
2135
2163
|
var result = [];
|
|
2136
2164
|
var typedError = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2137
2165
|
if (!typedError.error.popup) {
|
|
2138
|
-
return
|
|
2166
|
+
return EMPTY13;
|
|
2139
2167
|
}
|
|
2140
2168
|
var businessError = {
|
|
2141
2169
|
type: 0 /* BusinessError */,
|
|
2142
2170
|
message: typedError.error.popup[0]
|
|
2143
2171
|
};
|
|
2144
|
-
result.push(
|
|
2172
|
+
result.push(of17(showViewError({ error: businessError })));
|
|
2145
2173
|
if ((_b = typedError.error.postActions) === null || _b === void 0 ? void 0 : _b[0]) {
|
|
2146
2174
|
var widget = state$.value.view.widgets.find(function (item) { return item.name === callContext.widgetName; });
|
|
2147
2175
|
var bcName = widget === null || widget === void 0 ? void 0 : widget.bcName;
|
|
2148
|
-
result.push(
|
|
2176
|
+
result.push(of17(processPostInvoke({
|
|
2149
2177
|
bcName: bcName,
|
|
2150
2178
|
postInvoke: typedError.error.postActions[0],
|
|
2151
2179
|
widgetName: widget === null || widget === void 0 ? void 0 : widget.name
|
|
@@ -2177,7 +2205,7 @@ var httpErrorDefaultEpic = function (action$, state$) { return action$.pipe(filt
|
|
|
2177
2205
|
return showViewError({ error: businessError });
|
|
2178
2206
|
})); };
|
|
2179
2207
|
// src/epics/screen/downloadFileByUrlEpic.ts
|
|
2180
|
-
import { EMPTY as
|
|
2208
|
+
import { EMPTY as EMPTY14, filter as filter27, mergeMap as mergeMap15, tap as tap2 } from "rxjs";
|
|
2181
2209
|
var downloadFileByUrlEpic = function (action$, state$) { return action$.pipe(filter27(downloadFileByUrl.match), tap2(function (action) {
|
|
2182
2210
|
var url = action.payload.url;
|
|
2183
2211
|
var anchor = document.createElement("a");
|
|
@@ -2188,16 +2216,16 @@ var downloadFileByUrlEpic = function (action$, state$) { return action$.pipe(fil
|
|
|
2188
2216
|
anchor.click();
|
|
2189
2217
|
document.body.removeChild(anchor);
|
|
2190
2218
|
}, 100);
|
|
2191
|
-
}), mergeMap15(function () { return
|
|
2219
|
+
}), mergeMap15(function () { return EMPTY14; })); };
|
|
2192
2220
|
// src/epics/screen/processPostInvokeEpic.ts
|
|
2193
|
-
import { EMPTY as
|
|
2221
|
+
import { EMPTY as EMPTY15, filter as filter28, mergeMap as mergeMap16, of as of18 } from "rxjs";
|
|
2194
2222
|
var processPostInvokeEpic = function (action$, state$) { return action$.pipe(filter28(processPostInvoke.match), mergeMap16(function (action) {
|
|
2195
2223
|
var _a;
|
|
2196
2224
|
var _b;
|
|
2197
2225
|
var state = state$.value;
|
|
2198
2226
|
switch (action.payload.postInvoke.type) {
|
|
2199
2227
|
case "drillDown" /* drillDown */:
|
|
2200
|
-
return
|
|
2228
|
+
return of18(drillDown(__assign(__assign({}, action.payload.postInvoke), { route: state.router, widgetName: action.payload.widgetName })));
|
|
2201
2229
|
case "postDelete" /* postDelete */: {
|
|
2202
2230
|
var cursorsMap = (_a = {}, _a[action.payload.bcName] = null, _a);
|
|
2203
2231
|
var result = [bcChangeCursors({ cursorsMap: cursorsMap })];
|
|
@@ -2212,7 +2240,7 @@ var processPostInvokeEpic = function (action$, state$) { return action$.pipe(fil
|
|
|
2212
2240
|
widgetName: action.payload.widgetName
|
|
2213
2241
|
}));
|
|
2214
2242
|
}
|
|
2215
|
-
return
|
|
2243
|
+
return of18.apply(void 0, result);
|
|
2216
2244
|
}
|
|
2217
2245
|
case "refreshBC" /* refreshBC */: {
|
|
2218
2246
|
var bo = state.screen.bo;
|
|
@@ -2222,34 +2250,34 @@ var processPostInvokeEpic = function (action$, state$) { return action$.pipe(fil
|
|
|
2222
2250
|
var widgetName = action.payload.widgetName || "";
|
|
2223
2251
|
var infiniteWidgets_1 = state.view.infiniteWidgets || [];
|
|
2224
2252
|
var infinitePagination = state.view.widgets.some(function (item) { return item.bcName === postInvokeBC_1 && infiniteWidgets_1.includes(item.name); });
|
|
2225
|
-
return infinitePagination ?
|
|
2253
|
+
return infinitePagination ? of18(bcFetchDataPages({
|
|
2226
2254
|
bcName: postInvokeBCItem.name,
|
|
2227
2255
|
widgetName: widgetName,
|
|
2228
2256
|
from: 1,
|
|
2229
2257
|
to: postInvokeBCItem.page
|
|
2230
|
-
})) :
|
|
2258
|
+
})) : of18(bcFetchDataRequest({
|
|
2231
2259
|
bcName: postInvokeBCItem.name,
|
|
2232
2260
|
widgetName: widgetName
|
|
2233
2261
|
}));
|
|
2234
2262
|
}
|
|
2235
2263
|
case "showMessage" /* showMessage */: {
|
|
2236
2264
|
var postInvoke = action.payload.postInvoke;
|
|
2237
|
-
return
|
|
2265
|
+
return of18(showNotification({ type: postInvoke.messageType, message: postInvoke.messageText }));
|
|
2238
2266
|
}
|
|
2239
2267
|
case "downloadFile" /* downloadFile */: {
|
|
2240
2268
|
var postInvoke = action.payload.postInvoke;
|
|
2241
|
-
return
|
|
2269
|
+
return of18(downloadFile({ fileId: postInvoke.fileId }));
|
|
2242
2270
|
}
|
|
2243
2271
|
case "downloadFileByUrl" /* downloadFileByUrl */: {
|
|
2244
2272
|
var postInvoke = action.payload.postInvoke;
|
|
2245
|
-
return
|
|
2273
|
+
return of18(downloadFileByUrl({ url: postInvoke.url }));
|
|
2246
2274
|
}
|
|
2247
2275
|
default:
|
|
2248
|
-
return
|
|
2276
|
+
return EMPTY15;
|
|
2249
2277
|
}
|
|
2250
2278
|
})); };
|
|
2251
2279
|
// src/epics/screen/processPostInvokeConfirmEpic.ts
|
|
2252
|
-
import { EMPTY as
|
|
2280
|
+
import { EMPTY as EMPTY16, filter as filter29, mergeMap as mergeMap17, of as of19 } from "rxjs";
|
|
2253
2281
|
import { isAnyOf } from "@reduxjs/toolkit";
|
|
2254
2282
|
var processPostInvokeConfirmEpic = function (action$, state$) { return action$.pipe(filter29(isAnyOf(processPostInvokeConfirm, processPreInvoke)), mergeMap17(function (action) {
|
|
2255
2283
|
var _a = action.payload, bcName = _a.bcName, operationType = _a.operationType, widgetName = _a.widgetName;
|
|
@@ -2259,7 +2287,7 @@ var processPostInvokeConfirmEpic = function (action$, state$) { return action$.p
|
|
|
2259
2287
|
case "info" /* info */:
|
|
2260
2288
|
case "error" /* error */:
|
|
2261
2289
|
case "confirmText" /* confirmText */: {
|
|
2262
|
-
return
|
|
2290
|
+
return of19(operationConfirmation({
|
|
2263
2291
|
operation: {
|
|
2264
2292
|
bcName: bcName,
|
|
2265
2293
|
operationType: operationType,
|
|
@@ -2269,7 +2297,7 @@ var processPostInvokeConfirmEpic = function (action$, state$) { return action$.p
|
|
|
2269
2297
|
}));
|
|
2270
2298
|
}
|
|
2271
2299
|
default:
|
|
2272
|
-
return
|
|
2300
|
+
return EMPTY16;
|
|
2273
2301
|
}
|
|
2274
2302
|
})); };
|
|
2275
2303
|
// src/epics/session/switchRoleEpic.ts
|
|
@@ -2278,7 +2306,7 @@ var switchRoleEpic = function (action$, state$) { return action$.pipe(filter30(s
|
|
|
2278
2306
|
return concat11([logoutDone(null), login({ login: "", password: "", role: action.payload.role })]);
|
|
2279
2307
|
})); };
|
|
2280
2308
|
// src/epics/session/refreshMetaEpic.ts
|
|
2281
|
-
import { catchError as
|
|
2309
|
+
import { catchError as catchError6, concat as concat12, filter as filter31, mergeMap as mergeMap18, switchMap as switchMap8 } from "rxjs";
|
|
2282
2310
|
var refreshMetaEpic = function (action$, state$, _a) {
|
|
2283
2311
|
var api = _a.api;
|
|
2284
2312
|
return action$.pipe(filter31(refreshMeta.match), mergeMap18(function () {
|
|
@@ -2292,14 +2320,14 @@ var refreshMetaEpic = function (action$, state$, _a) {
|
|
|
2292
2320
|
changeLocation({
|
|
2293
2321
|
location: router
|
|
2294
2322
|
})
|
|
2295
|
-
]); }),
|
|
2323
|
+
]); }), catchError6(function (error) { return concat12([loginFail(error), refreshMetaFail(), createApiError(error)]); }));
|
|
2296
2324
|
}));
|
|
2297
2325
|
};
|
|
2298
2326
|
// src/epics/session/loginDoneEpic.ts
|
|
2299
|
-
import { EMPTY as
|
|
2300
|
-
var loginDoneSessionEpic = function (action$, store) { return action$.pipe(filter32(login.match), switchMap9(function (action) { return
|
|
2327
|
+
import { EMPTY as EMPTY17, filter as filter32, switchMap as switchMap9 } from "rxjs";
|
|
2328
|
+
var loginDoneSessionEpic = function (action$, store) { return action$.pipe(filter32(login.match), switchMap9(function (action) { return EMPTY17; })); };
|
|
2301
2329
|
// src/epics/session/loginByAnotherRoleEpic.ts
|
|
2302
|
-
import { catchError as
|
|
2330
|
+
import { catchError as catchError7, concat as concat13, filter as filter33, mergeMap as mergeMap19, of as of20, switchMap as switchMap10 } from "rxjs";
|
|
2303
2331
|
var responseStatusMessages = {
|
|
2304
2332
|
401: "Invalid credentials",
|
|
2305
2333
|
403: "Access denied"
|
|
@@ -2331,18 +2359,18 @@ var loginByAnotherRoleEpic = function (action$, state$, _a) {
|
|
|
2331
2359
|
login: data.login
|
|
2332
2360
|
})
|
|
2333
2361
|
], false));
|
|
2334
|
-
}),
|
|
2362
|
+
}), catchError7(function (error) {
|
|
2335
2363
|
console.error(error);
|
|
2336
2364
|
var errorMsg = error.response ? responseStatusMessages[error.response.status] || "Server application unavailable" : "Empty server response";
|
|
2337
|
-
return
|
|
2365
|
+
return concat13(of20(loginFail({ errorMsg: errorMsg })), createApiErrorObservable(error));
|
|
2338
2366
|
}));
|
|
2339
2367
|
}));
|
|
2340
2368
|
};
|
|
2341
2369
|
// src/epics/session/refreshMetaAndReloadPageEpic.ts
|
|
2342
|
-
import { concat as concat14, EMPTY as
|
|
2343
|
-
var refreshMetaAndReloadPageEpic = function (action$, state$) { return action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(function () { return concat14(
|
|
2370
|
+
import { concat as concat14, EMPTY as EMPTY18, filter as filter34, of as of21, switchMap as switchMap11, take, tap as tap3 } from "rxjs";
|
|
2371
|
+
var refreshMetaAndReloadPageEpic = function (action$, state$) { return action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(function () { return concat14(of21(refreshMeta()), action$.pipe(filter34(loginDone.match), take(1), tap3(function () { return location.reload(); }), switchMap11(function () { return EMPTY18; }))); })); };
|
|
2344
2372
|
// src/epics/data/bcNewDataEpic.ts
|
|
2345
|
-
import { catchError as
|
|
2373
|
+
import { catchError as catchError8, concat as concat15, EMPTY as EMPTY19, filter as filter35, mergeMap as mergeMap20, of as of22 } from "rxjs";
|
|
2346
2374
|
import { OperationTypeCrud as OperationTypeCrud8 } from "@cxbox-ui/schema";
|
|
2347
2375
|
var bcNewDataEpic = function (action$, state$, _a) {
|
|
2348
2376
|
var api = _a.api;
|
|
@@ -2362,24 +2390,24 @@ var bcNewDataEpic = function (action$, state$, _a) {
|
|
|
2362
2390
|
});
|
|
2363
2391
|
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2364
2392
|
var cursor = dataItem.id;
|
|
2365
|
-
return concat15(
|
|
2393
|
+
return concat15(of22(bcNewDataSuccess({ bcName: bcName, dataItem: dataItem, bcUrl: bcUrl })), of22(bcFetchRowMetaSuccess({ bcName: bcName, bcUrl: "".concat(bcUrl, "/").concat(cursor), rowMeta: rowMeta, cursor: cursor })), of22(changeDataItem({
|
|
2366
2394
|
bcName: bcName,
|
|
2367
2395
|
bcUrl: (_b = buildBcUrl(bcName, true, state)) !== null && _b !== void 0 ? _b : "",
|
|
2368
2396
|
cursor: cursor,
|
|
2369
2397
|
dataItem: {
|
|
2370
2398
|
id: cursor
|
|
2371
2399
|
}
|
|
2372
|
-
})), postInvoke ?
|
|
2373
|
-
}),
|
|
2400
|
+
})), postInvoke ? of22(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: action.payload.widgetName })) : EMPTY19);
|
|
2401
|
+
}), catchError8(function (error) {
|
|
2374
2402
|
console.error(error);
|
|
2375
|
-
return
|
|
2403
|
+
return concat15(of22(bcNewDataFail({ bcName: bcName })), createApiErrorObservable(error, context));
|
|
2376
2404
|
}));
|
|
2377
2405
|
}));
|
|
2378
2406
|
};
|
|
2379
2407
|
// src/epics/data/bcLoadMoreEpic.ts
|
|
2380
|
-
import { catchError as
|
|
2408
|
+
import { catchError as catchError9, concat as concat16, filter as filter37, mergeMap as mergeMap22, of as of24, race } from "rxjs";
|
|
2381
2409
|
// src/utils/cancelRequestEpic.ts
|
|
2382
|
-
import { filter as filter36, mergeMap as mergeMap21, of as
|
|
2410
|
+
import { filter as filter36, mergeMap as mergeMap21, of as of23, take as take2 } from "rxjs";
|
|
2383
2411
|
import { isAnyOf as isAnyOf2 } from "@reduxjs/toolkit";
|
|
2384
2412
|
var cancelRequestActionTypes = [selectView, logout];
|
|
2385
2413
|
function cancelRequestEpic(action$, actionTypes, cancelFn, cancelActionCreator, filterFn) {
|
|
@@ -2388,7 +2416,7 @@ function cancelRequestEpic(action$, actionTypes, cancelFn, cancelActionCreator,
|
|
|
2388
2416
|
}; }
|
|
2389
2417
|
return action$.pipe(filter36(isAnyOf2.apply(void 0, actionTypes)), filter36(filterFn), mergeMap21(function () {
|
|
2390
2418
|
cancelFn === null || cancelFn === void 0 ? void 0 : cancelFn();
|
|
2391
|
-
return
|
|
2419
|
+
return of23(cancelActionCreator);
|
|
2392
2420
|
}), take2(1));
|
|
2393
2421
|
}
|
|
2394
2422
|
// src/epics/data/bcLoadMoreEpic.ts
|
|
@@ -2412,21 +2440,21 @@ var bcLoadMoreEpic = function (action$, state$, _a) {
|
|
|
2412
2440
|
var _a;
|
|
2413
2441
|
var oldBcDataIds = (_a = state.data[bcName]) === null || _a === void 0 ? void 0 : _a.map(function (i) { return i.id; });
|
|
2414
2442
|
var newData = __spreadArray(__spreadArray([], state.data[bcName], true), data.data.filter(function (i) { return !oldBcDataIds.includes(i.id); }), true);
|
|
2415
|
-
return
|
|
2443
|
+
return of24(bcFetchDataSuccess({
|
|
2416
2444
|
bcName: bcName,
|
|
2417
2445
|
data: newData,
|
|
2418
2446
|
bcUrl: bcUrl,
|
|
2419
2447
|
hasNext: data.hasNext
|
|
2420
2448
|
}));
|
|
2421
|
-
}),
|
|
2449
|
+
}), catchError9(function (error) {
|
|
2422
2450
|
console.error(error);
|
|
2423
|
-
return
|
|
2451
|
+
return concat16(of24(bcFetchDataFail({ bcName: bcName, bcUrl: bcUrl })), createApiErrorObservable(error));
|
|
2424
2452
|
}));
|
|
2425
2453
|
return race(cancelFlow, normalFlow);
|
|
2426
2454
|
}));
|
|
2427
2455
|
};
|
|
2428
2456
|
// src/epics/data/bcSaveDataEpic.ts
|
|
2429
|
-
import { catchError as
|
|
2457
|
+
import { catchError as catchError10, concat as concat17, EMPTY as EMPTY20, filter as filter38, mergeMap as mergeMap23, of as of25 } from "rxjs";
|
|
2430
2458
|
var bcSaveDataEpic = function (action$, state$, _a) {
|
|
2431
2459
|
var api = _a.api;
|
|
2432
2460
|
return action$.pipe(filter38(sendOperation.match), filter38(function (action) { return matchOperationRole(OperationTypeCrud.save, action.payload, state$.value); }), mergeMap23(function (action) {
|
|
@@ -2460,18 +2488,18 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2460
2488
|
var _a;
|
|
2461
2489
|
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2462
2490
|
var responseDataItem = data.record;
|
|
2463
|
-
return
|
|
2491
|
+
return concat17(of25(bcSaveDataSuccess({ bcName: bcName, cursor: cursor, dataItem: responseDataItem })), of25(bcFetchRowMeta({ widgetName: widgetName, bcName: bcName })), of25.apply(void 0, fetchChildrenBcData), postInvoke ? of25(processPostInvoke({
|
|
2464
2492
|
bcName: bcName,
|
|
2465
2493
|
widgetName: widgetName,
|
|
2466
2494
|
postInvoke: postInvoke,
|
|
2467
2495
|
cursor: responseDataItem.id
|
|
2468
|
-
})) :
|
|
2469
|
-
}),
|
|
2496
|
+
})) : EMPTY20, action.payload.onSuccessAction ? of25(action.payload.onSuccessAction) : EMPTY20);
|
|
2497
|
+
}), catchError10(function (e) {
|
|
2470
2498
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2471
2499
|
console.error(e);
|
|
2472
|
-
var notification$ =
|
|
2500
|
+
var notification$ = EMPTY20;
|
|
2473
2501
|
if (action.payload.onSuccessAction && !(options === null || options === void 0 ? void 0 : options.disableNotification)) {
|
|
2474
|
-
notification$ =
|
|
2502
|
+
notification$ = of25(addNotification({
|
|
2475
2503
|
key: "data_autosave_undo",
|
|
2476
2504
|
type: "buttonWarningNotification",
|
|
2477
2505
|
message: "There are pending changes. Please save them or cancel.",
|
|
@@ -2491,12 +2519,12 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2491
2519
|
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;
|
|
2492
2520
|
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;
|
|
2493
2521
|
}
|
|
2494
|
-
return
|
|
2522
|
+
return concat17(of25(bcSaveDataFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError })), notification$, createApiErrorObservable(e, context));
|
|
2495
2523
|
}));
|
|
2496
2524
|
}));
|
|
2497
2525
|
};
|
|
2498
2526
|
// src/epics/data/selectViewEpic.ts
|
|
2499
|
-
import { EMPTY as
|
|
2527
|
+
import { EMPTY as EMPTY21, filter as filter39, mergeMap as mergeMap24 } from "rxjs";
|
|
2500
2528
|
var selectViewEpic = function (action$, state$) { return action$.pipe(filter39(selectView.match), mergeMap24(function (action) {
|
|
2501
2529
|
try {
|
|
2502
2530
|
var state_1 = state$.value;
|
|
@@ -2522,11 +2550,11 @@ var selectViewEpic = function (action$, state$) { return action$.pipe(filter39(s
|
|
|
2522
2550
|
}
|
|
2523
2551
|
catch (e) {
|
|
2524
2552
|
console.error("selectView Epic:: ".concat(e));
|
|
2525
|
-
return
|
|
2553
|
+
return EMPTY21;
|
|
2526
2554
|
}
|
|
2527
2555
|
})); };
|
|
2528
2556
|
// src/epics/data/bcFetchDataEpic.ts
|
|
2529
|
-
import { catchError as
|
|
2557
|
+
import { catchError as catchError11, concat as concat18, EMPTY as EMPTY22, filter as filter40, mergeMap as mergeMap25, of as of26, race as race2 } from "rxjs";
|
|
2530
2558
|
import { WidgetTypes as WidgetTypes5 } from "@cxbox-ui/schema";
|
|
2531
2559
|
import { isAnyOf as isAnyOf3 } from "@reduxjs/toolkit";
|
|
2532
2560
|
var bcFetchDataEpic = function (action$, state$, _a) {
|
|
@@ -2538,7 +2566,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2538
2566
|
var bcName = action.payload.bcName;
|
|
2539
2567
|
var keepDelta = bcFetchDataRequest.match(action) ? action.payload.keepDelta : void 0;
|
|
2540
2568
|
var newCursor = (_b = data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
2541
|
-
return
|
|
2569
|
+
return of26(bcChangeCursors({
|
|
2542
2570
|
cursorsMap: (_a = {},
|
|
2543
2571
|
_a[bcName] = data.some(function (i) { return i.id === prevCursor; }) ? prevCursor : newCursor,
|
|
2544
2572
|
_a),
|
|
@@ -2548,7 +2576,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2548
2576
|
var getChildrenData = function (widgets, bcDictionary, isHierarchy, showConditionCheck) {
|
|
2549
2577
|
var bcName = action.payload.bcName;
|
|
2550
2578
|
var _a = bcFetchDataRequest.match(action) ? action.payload : { ignorePageLimit: void 0, keepDelta: void 0 }, ignorePageLimit = _a.ignorePageLimit, keepDelta = _a.keepDelta;
|
|
2551
|
-
return
|
|
2579
|
+
return concat18.apply(void 0, Object.entries(getBcChildren(bcName, widgets, bcDictionary)).filter(function (_a) {
|
|
2552
2580
|
var childBcName = _a[0], widgetNames = _a[1];
|
|
2553
2581
|
var nonLazyWidget = widgets.find(function (item) {
|
|
2554
2582
|
return widgetNames.includes(item.name) && !PopupWidgetTypes.includes(item.type) && showConditionCheck(item);
|
|
@@ -2563,7 +2591,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2563
2591
|
var nonLazyWidget = widgets.find(function (item) {
|
|
2564
2592
|
return widgetNames.includes(item.name) && !PopupWidgetTypes.includes(item.type) && showConditionCheck(item);
|
|
2565
2593
|
});
|
|
2566
|
-
return
|
|
2594
|
+
return of26(bcFetchDataRequest({
|
|
2567
2595
|
bcName: childBcName,
|
|
2568
2596
|
widgetName: nonLazyWidget === null || nonLazyWidget === void 0 ? void 0 : nonLazyWidget.name,
|
|
2569
2597
|
ignorePageLimit: ignorePageLimit || showViewPopup.match(action),
|
|
@@ -2578,7 +2606,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2578
2606
|
var _k = state.view, widgets = _k.widgets, infiniteWidgets = _k.infiniteWidgets;
|
|
2579
2607
|
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; });
|
|
2580
2608
|
if (!widget) {
|
|
2581
|
-
return [
|
|
2609
|
+
return [EMPTY22];
|
|
2582
2610
|
}
|
|
2583
2611
|
var bcName = action.payload.bcName;
|
|
2584
2612
|
var bc = state.screen.bo.bc[bcName];
|
|
@@ -2586,7 +2614,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2586
2614
|
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;
|
|
2587
2615
|
var sorters = state.screen.sorters[bcName];
|
|
2588
2616
|
if (showViewPopup.match(action) && bcName === action.payload.calleeBCName) {
|
|
2589
|
-
return [
|
|
2617
|
+
return [EMPTY22];
|
|
2590
2618
|
}
|
|
2591
2619
|
var anyHierarchyWidget = widgets === null || widgets === void 0 ? void 0 : widgets.find(function (item) {
|
|
2592
2620
|
return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && isHierarchyWidget(item);
|
|
@@ -2644,19 +2672,19 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2644
2672
|
var lazyWidget = (!isWidgetVisible(widget) || PopupWidgetTypes.includes(widget.type)) && !parentOfNotLazyWidget;
|
|
2645
2673
|
var skipLazy = ((_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.bcName) !== widget.bcName;
|
|
2646
2674
|
if (lazyWidget && skipLazy) {
|
|
2647
|
-
return
|
|
2675
|
+
return EMPTY22;
|
|
2648
2676
|
}
|
|
2649
|
-
var fetchChildren = ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) :
|
|
2650
|
-
var fetchRowMeta =
|
|
2651
|
-
return
|
|
2677
|
+
var fetchChildren = ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) : EMPTY22;
|
|
2678
|
+
var fetchRowMeta = of26(bcFetchRowMeta({ widgetName: widgetName, bcName: bcName }));
|
|
2679
|
+
return concat18(cursorChange, of26(bcFetchDataSuccess({
|
|
2652
2680
|
bcName: bcName,
|
|
2653
2681
|
data: response.data,
|
|
2654
2682
|
bcUrl: bcUrl,
|
|
2655
2683
|
hasNext: response.hasNext
|
|
2656
2684
|
})), fetchRowMeta, fetchChildren);
|
|
2657
|
-
}),
|
|
2685
|
+
}), catchError11(function (error) {
|
|
2658
2686
|
console.error(error);
|
|
2659
|
-
return
|
|
2687
|
+
return concat18(of26(bcFetchDataFail({ bcName: action.payload.bcName, bcUrl: bcUrl })), createApiErrorObservable(error));
|
|
2660
2688
|
}));
|
|
2661
2689
|
return [cancelFlow, cancelByParentBc, normalFlow];
|
|
2662
2690
|
};
|
|
@@ -2668,7 +2696,7 @@ function isHierarchyWidget(widget) {
|
|
|
2668
2696
|
return ((_a = widget.options) === null || _a === void 0 ? void 0 : _a.hierarchy) || ((_b = widget.options) === null || _b === void 0 ? void 0 : _b.hierarchyFull);
|
|
2669
2697
|
}
|
|
2670
2698
|
// src/epics/data/bcDeleteDataEpic.ts
|
|
2671
|
-
import { catchError as
|
|
2699
|
+
import { catchError as catchError12, concat as concat19, EMPTY as EMPTY23, filter as filter41, mergeMap as mergeMap26, of as of27 } from "rxjs";
|
|
2672
2700
|
import { OperationTypeCrud as OperationTypeCrud9 } from "@cxbox-ui/schema";
|
|
2673
2701
|
var bcDeleteDataEpic = function (action$, store$, _a) {
|
|
2674
2702
|
var api = _a.api;
|
|
@@ -2683,15 +2711,15 @@ var bcDeleteDataEpic = function (action$, store$, _a) {
|
|
|
2683
2711
|
return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe(mergeMap26(function (data) {
|
|
2684
2712
|
var _a;
|
|
2685
2713
|
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2686
|
-
return
|
|
2687
|
-
}),
|
|
2714
|
+
return concat19(isTargetFormatPVF ? of27(bcCancelPendingChanges({ bcNames: [bcName] })) : EMPTY23, of27(bcFetchDataRequest({ bcName: bcName, widgetName: widgetName })), postInvoke ? of27(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: widgetName })) : EMPTY23);
|
|
2715
|
+
}), catchError12(function (error) {
|
|
2688
2716
|
console.error(error);
|
|
2689
|
-
return
|
|
2717
|
+
return concat19(of27(bcDeleteDataFail({ bcName: bcName })), createApiErrorObservable(error, context));
|
|
2690
2718
|
}));
|
|
2691
2719
|
}));
|
|
2692
2720
|
};
|
|
2693
2721
|
// src/epics/data/bcSelectRecordEpic.ts
|
|
2694
|
-
import { concat as
|
|
2722
|
+
import { concat as concat20, filter as filter42, mergeMap as mergeMap27, of as of28 } from "rxjs";
|
|
2695
2723
|
var bcSelectRecordEpic = function (action$, store$) { return action$.pipe(filter42(bcSelectRecord.match), mergeMap27(function (action) {
|
|
2696
2724
|
var _a;
|
|
2697
2725
|
var _b = action.payload, bcName = _b.bcName, cursor = _b.cursor;
|
|
@@ -2706,17 +2734,17 @@ var bcSelectRecordEpic = function (action$, store$) { return action$.pipe(filter
|
|
|
2706
2734
|
keepDelta: action.payload.keepDelta
|
|
2707
2735
|
});
|
|
2708
2736
|
});
|
|
2709
|
-
return
|
|
2737
|
+
return concat20(of28(bcChangeCursors({ cursorsMap: (_a = {}, _a[bcName] = cursor, _a), keepDelta: action.payload.keepDelta })), of28(bcFetchRowMeta({ widgetName: "", bcName: bcName })), fetchChildrenBcData);
|
|
2710
2738
|
})); };
|
|
2711
2739
|
// src/epics/data/changeAssociationEpic.ts
|
|
2712
|
-
import { concat as
|
|
2740
|
+
import { concat as concat21, filter as filter43, mergeMap as mergeMap28, of as of29 } from "rxjs";
|
|
2713
2741
|
var changeAssociationEpic = function (action$, state$) { return action$.pipe(filter43(changeAssociation.match), mergeMap28(function (action) {
|
|
2714
2742
|
var _a, _b, _c, _d, _e;
|
|
2715
2743
|
var state = state$.value;
|
|
2716
2744
|
var selected = action.payload.dataItem._associate;
|
|
2717
2745
|
var bcName = action.payload.bcName;
|
|
2718
2746
|
var result = [
|
|
2719
|
-
|
|
2747
|
+
of29(changeDataItem({
|
|
2720
2748
|
bcName: bcName,
|
|
2721
2749
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
2722
2750
|
cursor: action.payload.dataItem.id,
|
|
@@ -2736,7 +2764,7 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe(fil
|
|
|
2736
2764
|
var hierarchyTraverse = (_d = widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyTraverse;
|
|
2737
2765
|
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; });
|
|
2738
2766
|
if (hierarchyGroupSelection && hierarchyDescriptor.radio && !selected) {
|
|
2739
|
-
result.push(
|
|
2767
|
+
result.push(of29(dropAllAssociations({
|
|
2740
2768
|
bcNames: childrenBc
|
|
2741
2769
|
})));
|
|
2742
2770
|
}
|
|
@@ -2747,11 +2775,11 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe(fil
|
|
|
2747
2775
|
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; });
|
|
2748
2776
|
if (parent && hierarchyTraverse && selected) {
|
|
2749
2777
|
if (hierarchyDescriptor.radio) {
|
|
2750
|
-
result.push(
|
|
2778
|
+
result.push(of29(dropAllAssociations({
|
|
2751
2779
|
bcNames: [parent.bcName]
|
|
2752
2780
|
})));
|
|
2753
2781
|
}
|
|
2754
|
-
result.push(
|
|
2782
|
+
result.push(of29(changeAssociation({
|
|
2755
2783
|
bcName: parent.bcName,
|
|
2756
2784
|
widgetName: action.payload.widgetName,
|
|
2757
2785
|
dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem === null || parentItem === void 0 ? void 0 : parentItem[parent.assocValueKey || action.payload.assocValueKey] }),
|
|
@@ -2768,7 +2796,7 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe(fil
|
|
|
2768
2796
|
data_1.find(function (dataValue) { return dataValue.id === deltaValue.id; });
|
|
2769
2797
|
});
|
|
2770
2798
|
if (wasLastInData && wasLastInDelta) {
|
|
2771
|
-
result.push(
|
|
2799
|
+
result.push(of29(changeAssociation({
|
|
2772
2800
|
bcName: parent.bcName,
|
|
2773
2801
|
widgetName: action.payload.widgetName,
|
|
2774
2802
|
dataItem: __assign(__assign({}, parentItem), { _associate: false }),
|
|
@@ -2776,10 +2804,10 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe(fil
|
|
|
2776
2804
|
})));
|
|
2777
2805
|
}
|
|
2778
2806
|
}
|
|
2779
|
-
return
|
|
2807
|
+
return concat21.apply(void 0, result);
|
|
2780
2808
|
})); };
|
|
2781
2809
|
// src/epics/data/bcCancelCreateDataEpic.ts
|
|
2782
|
-
import { catchError as
|
|
2810
|
+
import { catchError as catchError13, concat as concat22, EMPTY as EMPTY24, filter as filter44, mergeMap as mergeMap29, of as of30 } from "rxjs";
|
|
2783
2811
|
import { OperationTypeCrud as OperationTypeCrud10 } from "@cxbox-ui/schema";
|
|
2784
2812
|
import { isAnyOf as isAnyOf4 } from "@reduxjs/toolkit";
|
|
2785
2813
|
var actionTypesMatcher = isAnyOf4(sendOperation);
|
|
@@ -2803,18 +2831,18 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
|
|
|
2803
2831
|
return api.customAction(screenName, bcUrl, data, context, params).pipe(mergeMap29(function (response) {
|
|
2804
2832
|
var _a;
|
|
2805
2833
|
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2806
|
-
return
|
|
2807
|
-
}),
|
|
2834
|
+
return concat22(of30(sendOperationSuccess({ bcName: bcName, cursor: cursor })), of30(bcChangeCursors({ cursorsMap: cursorsMap })), postInvoke ? of30(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: context.widgetName })) : EMPTY24);
|
|
2835
|
+
}), catchError13(function (error) {
|
|
2808
2836
|
console.error(error);
|
|
2809
|
-
return
|
|
2837
|
+
return concat22(of30(bcDeleteDataFail({ bcName: bcName })), createApiErrorObservable(error, context));
|
|
2810
2838
|
}));
|
|
2811
2839
|
}));
|
|
2812
2840
|
};
|
|
2813
2841
|
// src/epics/data/bcSelectDepthRecordEpic.ts
|
|
2814
|
-
import { concat as
|
|
2842
|
+
import { concat as concat23, filter as filter45, mergeMap as mergeMap30, of as of31 } from "rxjs";
|
|
2815
2843
|
var bcSelectDepthRecordEpic = function (action$) { return action$.pipe(filter45(bcSelectDepthRecord.match), mergeMap30(function (action) {
|
|
2816
2844
|
var _a = action.payload, bcName = _a.bcName, cursor = _a.cursor, depth = _a.depth;
|
|
2817
|
-
return
|
|
2845
|
+
return concat23(of31(bcChangeDepthCursor({ bcName: bcName, depth: depth, cursor: cursor })), of31(bcFetchDataRequest({
|
|
2818
2846
|
bcName: bcName,
|
|
2819
2847
|
depth: depth + 1,
|
|
2820
2848
|
widgetName: "",
|
|
@@ -2822,7 +2850,7 @@ var bcSelectDepthRecordEpic = function (action$) { return action$.pipe(filter45(
|
|
|
2822
2850
|
})));
|
|
2823
2851
|
})); };
|
|
2824
2852
|
// src/epics/data/removeMultivalueTagEpic.ts
|
|
2825
|
-
import { concat as
|
|
2853
|
+
import { concat as concat24, filter as filter46, mergeMap as mergeMap31, of as of32 } from "rxjs";
|
|
2826
2854
|
var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(filter46(removeMultivalueTag.match), mergeMap31(function (action) {
|
|
2827
2855
|
var _a, _b, _c;
|
|
2828
2856
|
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
@@ -2859,7 +2887,7 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(f
|
|
|
2859
2887
|
return removedNodes.includes(descendant) || !associated.includes(descendant);
|
|
2860
2888
|
});
|
|
2861
2889
|
if (parentDeepEmpty) {
|
|
2862
|
-
return
|
|
2890
|
+
return concat24(of32(removeMultivalueTag(__assign(__assign({}, action.payload), { removedItem: { id: parent_1.id, value: null } }))));
|
|
2863
2891
|
}
|
|
2864
2892
|
}
|
|
2865
2893
|
else {
|
|
@@ -2868,7 +2896,7 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(f
|
|
|
2868
2896
|
}
|
|
2869
2897
|
}
|
|
2870
2898
|
if ((_h = widget === null || widget === void 0 ? void 0 : widget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull) {
|
|
2871
|
-
return
|
|
2899
|
+
return of32(changeDataItem({
|
|
2872
2900
|
bcName: bcName,
|
|
2873
2901
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
2874
2902
|
cursor: cursor,
|
|
@@ -2880,7 +2908,7 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(f
|
|
|
2880
2908
|
var _a;
|
|
2881
2909
|
return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
|
|
2882
2910
|
})) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName;
|
|
2883
|
-
return
|
|
2911
|
+
return concat24(of32(changeDataItem({
|
|
2884
2912
|
/**
|
|
2885
2913
|
* This is incorrect and will break if different BC has records with
|
|
2886
2914
|
* identical ids.
|
|
@@ -2891,19 +2919,19 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(f
|
|
|
2891
2919
|
bcUrl: buildBcUrl(hierarchyBcName, true, state),
|
|
2892
2920
|
cursor: action.payload.removedItem.id,
|
|
2893
2921
|
dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
|
|
2894
|
-
})),
|
|
2922
|
+
})), of32(changeDataItem({
|
|
2895
2923
|
bcName: bcName,
|
|
2896
2924
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
2897
2925
|
cursor: cursor,
|
|
2898
2926
|
dataItem: (_b = {}, _b[associateFieldKey] = action.payload.dataItem, _b)
|
|
2899
2927
|
})));
|
|
2900
2928
|
}
|
|
2901
|
-
return
|
|
2929
|
+
return concat24(of32(changeDataItem({
|
|
2902
2930
|
bcName: popupBcName,
|
|
2903
2931
|
bcUrl: buildBcUrl(popupBcName, true, state),
|
|
2904
2932
|
cursor: action.payload.removedItem.id,
|
|
2905
2933
|
dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
|
|
2906
|
-
})),
|
|
2934
|
+
})), of32(changeDataItem({
|
|
2907
2935
|
bcName: bcName,
|
|
2908
2936
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
2909
2937
|
cursor: cursor,
|
|
@@ -2911,7 +2939,7 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(f
|
|
|
2911
2939
|
})));
|
|
2912
2940
|
})); };
|
|
2913
2941
|
// src/epics/data/bcFetchRowMetaRequestEpic.ts
|
|
2914
|
-
import { catchError as
|
|
2942
|
+
import { catchError as catchError14, concat as concat25, filter as filter47, map as map9, mergeMap as mergeMap32, of as of33, race as race3 } from "rxjs";
|
|
2915
2943
|
var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
|
|
2916
2944
|
var api = _a.api;
|
|
2917
2945
|
return action$.pipe(filter47(bcFetchRowMeta.match), mergeMap32(function (action) {
|
|
@@ -2929,15 +2957,15 @@ var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
|
|
|
2929
2957
|
});
|
|
2930
2958
|
var normalFlow = api.fetchRowMeta(screenName, bcUrl, void 0, canceler.cancelToken).pipe(map9(function (rowMeta) {
|
|
2931
2959
|
return bcFetchRowMetaSuccess({ bcName: bcName, rowMeta: rowMeta, bcUrl: bcUrl, cursor: cursor });
|
|
2932
|
-
}),
|
|
2960
|
+
}), catchError14(function (error) {
|
|
2933
2961
|
console.error(error);
|
|
2934
|
-
return
|
|
2962
|
+
return concat25(of33(bcFetchRowMetaFail({ bcName: bcName })), createApiErrorObservable(error));
|
|
2935
2963
|
}));
|
|
2936
2964
|
return race3(cancelFlow, cancelByParentBc, normalFlow);
|
|
2937
2965
|
}));
|
|
2938
2966
|
};
|
|
2939
2967
|
// src/epics/data/changeAssociationFullEpic.ts
|
|
2940
|
-
import { concat as
|
|
2968
|
+
import { concat as concat26, filter as filter48, mergeMap as mergeMap33, of as of34 } from "rxjs";
|
|
2941
2969
|
var changeAssociationFullEpic = function (action$, state$) { return action$.pipe(filter48(changeAssociationFull.match), mergeMap33(function (action) {
|
|
2942
2970
|
var _a, _b, _c, _d, _e;
|
|
2943
2971
|
var state = state$.value;
|
|
@@ -2967,7 +2995,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
2967
2995
|
return false;
|
|
2968
2996
|
});
|
|
2969
2997
|
if (prevSelected) {
|
|
2970
|
-
result.push(
|
|
2998
|
+
result.push(of34(changeAssociationFull({
|
|
2971
2999
|
bcName: bcName,
|
|
2972
3000
|
depth: depth,
|
|
2973
3001
|
widgetName: action.payload.widgetName,
|
|
@@ -2977,7 +3005,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
2977
3005
|
}
|
|
2978
3006
|
}
|
|
2979
3007
|
else {
|
|
2980
|
-
result.push(
|
|
3008
|
+
result.push(of34(changeDescendantsAssociationsFull({
|
|
2981
3009
|
bcName: bcName,
|
|
2982
3010
|
parentId: action.payload.dataItem.id,
|
|
2983
3011
|
depth: depth + 1,
|
|
@@ -2986,14 +3014,14 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
2986
3014
|
})));
|
|
2987
3015
|
}
|
|
2988
3016
|
}
|
|
2989
|
-
result.push(
|
|
3017
|
+
result.push(of34(changeDataItem({
|
|
2990
3018
|
bcName: action.payload.bcName,
|
|
2991
3019
|
bcUrl: buildBcUrl(action.payload.bcName, true, state),
|
|
2992
3020
|
cursor: action.payload.dataItem.id,
|
|
2993
3021
|
dataItem: action.payload.dataItem
|
|
2994
3022
|
})));
|
|
2995
3023
|
if (parentDepth && hierarchyTraverse && selected) {
|
|
2996
|
-
result.push(
|
|
3024
|
+
result.push(of34(changeAssociationFull({
|
|
2997
3025
|
bcName: bcName,
|
|
2998
3026
|
depth: parentDepth,
|
|
2999
3027
|
widgetName: action.payload.widgetName,
|
|
@@ -3009,7 +3037,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
3009
3037
|
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; }));
|
|
3010
3038
|
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; });
|
|
3011
3039
|
if (wasLastInData && wasLastInDelta) {
|
|
3012
|
-
result.push(
|
|
3040
|
+
result.push(of34(changeAssociationFull({
|
|
3013
3041
|
bcName: bcName,
|
|
3014
3042
|
depth: parentDepth,
|
|
3015
3043
|
widgetName: action.payload.widgetName,
|
|
@@ -3018,10 +3046,10 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
3018
3046
|
})));
|
|
3019
3047
|
}
|
|
3020
3048
|
}
|
|
3021
|
-
return
|
|
3049
|
+
return concat26.apply(void 0, result);
|
|
3022
3050
|
})); };
|
|
3023
3051
|
// src/epics/data/saveAssociationsActiveEpic.ts
|
|
3024
|
-
import { catchError as
|
|
3052
|
+
import { catchError as catchError15, concat as concat27, EMPTY as EMPTY25, filter as filter49, mergeMap as mergeMap34, of as of35, switchMap as switchMap12 } from "rxjs";
|
|
3025
3053
|
var saveAssociationsActiveEpic = function (action$, state$, _a) {
|
|
3026
3054
|
var api = _a.api;
|
|
3027
3055
|
return action$.pipe(filter49(saveAssociations.match), filter49(function (action) {
|
|
@@ -3039,21 +3067,21 @@ var saveAssociationsActiveEpic = function (action$, state$, _a) {
|
|
|
3039
3067
|
return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter(function (i) { return i._associate; }), params).pipe(mergeMap34(function (response) {
|
|
3040
3068
|
var postInvoke = response.postActions[0];
|
|
3041
3069
|
var calleeWidget = state.view.widgets.find(function (widgetItem) { return widgetItem.bcName === calleeBCName; });
|
|
3042
|
-
return
|
|
3043
|
-
}),
|
|
3070
|
+
return concat27(postInvoke ? of35(processPostInvoke({ bcName: calleeBCName, postInvoke: postInvoke, widgetName: calleeWidget === null || calleeWidget === void 0 ? void 0 : calleeWidget.name })) : EMPTY25, of35(bcCancelPendingChanges({ bcNames: bcNames })), of35(bcForceUpdate({ bcName: calleeBCName, widgetName: calleeWidgetName })));
|
|
3071
|
+
}), catchError15(function (err) {
|
|
3044
3072
|
console.error(err);
|
|
3045
|
-
return
|
|
3073
|
+
return EMPTY25;
|
|
3046
3074
|
}));
|
|
3047
3075
|
}));
|
|
3048
3076
|
};
|
|
3049
3077
|
// src/epics/data/changeAssociationSameBcEpic.ts
|
|
3050
|
-
import { concat as
|
|
3078
|
+
import { concat as concat28, filter as filter50, mergeMap as mergeMap35, of as of36 } from "rxjs";
|
|
3051
3079
|
var changeAssociationSameBcEpic = function (action$, state$) { return action$.pipe(filter50(changeAssociationSameBc.match), mergeMap35(function (action) {
|
|
3052
3080
|
var _a, _b, _c, _d, _e, _f;
|
|
3053
3081
|
var state = state$.value;
|
|
3054
3082
|
var bcName = action.payload.bcName;
|
|
3055
3083
|
var result = [
|
|
3056
|
-
|
|
3084
|
+
of36(changeDataItem({
|
|
3057
3085
|
bcName: bcName,
|
|
3058
3086
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
3059
3087
|
cursor: action.payload.dataItem.id,
|
|
@@ -3069,7 +3097,7 @@ var changeAssociationSameBcEpic = function (action$, state$) { return action$.pi
|
|
|
3069
3097
|
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;
|
|
3070
3098
|
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;
|
|
3071
3099
|
if (parentDepth && hierarchyTraverse && selected) {
|
|
3072
|
-
result.push(
|
|
3100
|
+
result.push(of36(changeAssociationSameBc({
|
|
3073
3101
|
bcName: bcName,
|
|
3074
3102
|
depth: parentDepth,
|
|
3075
3103
|
widgetName: action.payload.widgetName,
|
|
@@ -3080,7 +3108,7 @@ var changeAssociationSameBcEpic = function (action$, state$) { return action$.pi
|
|
|
3080
3108
|
if (parentDepth && hierarchyTraverse && !selected) {
|
|
3081
3109
|
var wasLastInData = currentData.filter(function (item) { return item.id !== action.payload.dataItem.id; }).every(function (item) { return !item._associate; });
|
|
3082
3110
|
if (wasLastInData) {
|
|
3083
|
-
result.push(
|
|
3111
|
+
result.push(of36(changeAssociationSameBc({
|
|
3084
3112
|
bcName: bcName,
|
|
3085
3113
|
depth: parentDepth,
|
|
3086
3114
|
widgetName: action.payload.widgetName,
|
|
@@ -3089,10 +3117,10 @@ var changeAssociationSameBcEpic = function (action$, state$) { return action$.pi
|
|
|
3089
3117
|
})));
|
|
3090
3118
|
}
|
|
3091
3119
|
}
|
|
3092
|
-
return
|
|
3120
|
+
return concat28.apply(void 0, result);
|
|
3093
3121
|
})); };
|
|
3094
3122
|
// src/epics/data/inlinePickListFetchDataEpic.ts
|
|
3095
|
-
import { catchError as
|
|
3123
|
+
import { catchError as catchError16, filter as filter51, mergeMap as mergeMap36, of as of37, race as race4 } from "rxjs";
|
|
3096
3124
|
var inlinePickListFetchDataEpic = function (action$, state$, _a) {
|
|
3097
3125
|
var api = _a.api;
|
|
3098
3126
|
return action$.pipe(filter51(inlinePickListFetchDataRequest.match), mergeMap36(function (action) {
|
|
@@ -3103,16 +3131,16 @@ var inlinePickListFetchDataEpic = function (action$, state$, _a) {
|
|
|
3103
3131
|
var canceler = api.createCanceler();
|
|
3104
3132
|
var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName: bcName, bcUrl: bcUrl }));
|
|
3105
3133
|
var normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, (_a = {}, _a[searchSpec + ".contains"] = searchString, _a), canceler.cancelToken).pipe(mergeMap36(function (data) {
|
|
3106
|
-
return
|
|
3107
|
-
}),
|
|
3134
|
+
return of37(bcFetchDataSuccess({ bcName: bcName, data: data.data, bcUrl: bcUrl }));
|
|
3135
|
+
}), catchError16(function (error) {
|
|
3108
3136
|
console.error(error);
|
|
3109
|
-
return
|
|
3137
|
+
return of37(bcFetchDataFail({ bcName: action.payload.bcName, bcUrl: bcUrl }));
|
|
3110
3138
|
}));
|
|
3111
3139
|
return race4(cancelFlow, normalFlow);
|
|
3112
3140
|
}));
|
|
3113
3141
|
};
|
|
3114
3142
|
// src/epics/data/saveAssociationsPassiveEpic.ts
|
|
3115
|
-
import { filter as filter52, of as
|
|
3143
|
+
import { filter as filter52, of as of38, switchMap as switchMap13 } from "rxjs";
|
|
3116
3144
|
var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pipe(filter52(saveAssociations.match), filter52(function () {
|
|
3117
3145
|
var _a;
|
|
3118
3146
|
return !((_a = state$.value.view.popupData) === null || _a === void 0 ? void 0 : _a.active);
|
|
@@ -3146,7 +3174,7 @@ var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pi
|
|
|
3146
3174
|
}
|
|
3147
3175
|
return true;
|
|
3148
3176
|
})).concat.apply(_a, addedItems);
|
|
3149
|
-
return
|
|
3177
|
+
return of38(changeDataItem({
|
|
3150
3178
|
bcName: calleeBCName,
|
|
3151
3179
|
bcUrl: buildBcUrl(calleeBCName, true, state),
|
|
3152
3180
|
cursor: cursor,
|
|
@@ -3156,13 +3184,13 @@ var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pi
|
|
|
3156
3184
|
}));
|
|
3157
3185
|
})); };
|
|
3158
3186
|
// src/epics/data/changeChildrenAssociationsEpic.ts
|
|
3159
|
-
import { filter as filter53, mergeMap as mergeMap37, of as
|
|
3187
|
+
import { filter as filter53, mergeMap as mergeMap37, of as of39 } from "rxjs";
|
|
3160
3188
|
var changeChildrenAssociationsEpic = function (action$, state$, _a) {
|
|
3161
3189
|
var api = _a.api;
|
|
3162
3190
|
return action$.pipe(filter53(changeChildrenAssociations.match), mergeMap37(function (action) {
|
|
3163
3191
|
var state = state$.value;
|
|
3164
3192
|
var data = state.data[action.payload.bcName];
|
|
3165
|
-
return
|
|
3193
|
+
return of39(changeDataItems({
|
|
3166
3194
|
bcName: action.payload.bcName,
|
|
3167
3195
|
cursors: data.map(function (item) { return item.id; }),
|
|
3168
3196
|
dataItems: data.map(function (item) { return (__assign(__assign({}, item), { _value: item[action.payload.assocValueKey], _associate: action.payload.selected })); })
|
|
@@ -3170,26 +3198,26 @@ var changeChildrenAssociationsEpic = function (action$, state$, _a) {
|
|
|
3170
3198
|
}));
|
|
3171
3199
|
};
|
|
3172
3200
|
// src/epics/data/changeChildrenAssociationsSameBcEpic.ts
|
|
3173
|
-
import { filter as filter54, mergeMap as mergeMap38, of as
|
|
3201
|
+
import { filter as filter54, mergeMap as mergeMap38, of as of40 } from "rxjs";
|
|
3174
3202
|
var changeChildrenAssociationsSameBcEpic = function (action$, state$) { return action$.pipe(filter54(changeChildrenAssociationsSameBc.match), mergeMap38(function (action) {
|
|
3175
3203
|
var _a;
|
|
3176
3204
|
var state = state$.value;
|
|
3177
3205
|
var data = ((_a = state.depthData[action.payload.depth]) === null || _a === void 0 ? void 0 : _a[action.payload.bcName]) || [];
|
|
3178
|
-
return
|
|
3206
|
+
return of40(changeDataItems({
|
|
3179
3207
|
bcName: action.payload.bcName,
|
|
3180
3208
|
cursors: data.map(function (item) { return item.id; }),
|
|
3181
3209
|
dataItems: data.map(function (item) { return (__assign(__assign({}, item), { _value: item[action.payload.assocValueKey], _associate: action.payload.selected })); })
|
|
3182
3210
|
}));
|
|
3183
3211
|
})); };
|
|
3184
3212
|
// src/epics/data/changeDescendantsAssociationsFullEpic.ts
|
|
3185
|
-
import { concat as
|
|
3213
|
+
import { concat as concat29, filter as filter55, mergeMap as mergeMap39, of as of41 } from "rxjs";
|
|
3186
3214
|
var changeDescendantsAssociationsFullEpic = function (action$, state$) { return action$.pipe(filter55(changeDescendantsAssociationsFull.match), mergeMap39(function (action) {
|
|
3187
3215
|
var state = state$.value;
|
|
3188
3216
|
var depth = action.payload.depth;
|
|
3189
3217
|
var data = state.data[action.payload.bcName];
|
|
3190
3218
|
var targetData = (data || []).filter(function (item) { return item.level === depth && item.parentId === action.payload.parentId; });
|
|
3191
3219
|
var result = [
|
|
3192
|
-
|
|
3220
|
+
of41(changeDataItems({
|
|
3193
3221
|
bcName: action.payload.bcName,
|
|
3194
3222
|
cursors: targetData.map(function (item) { return item.id; }),
|
|
3195
3223
|
dataItems: targetData.map(function (item) { return (__assign(__assign({}, item), { _value: item[action.payload.assocValueKey], _associate: action.payload.selected })); })
|
|
@@ -3197,10 +3225,10 @@ var changeDescendantsAssociationsFullEpic = function (action$, state$) { return
|
|
|
3197
3225
|
];
|
|
3198
3226
|
targetData.forEach(function (targetDataItem) {
|
|
3199
3227
|
if (data.find(function (dataItem) { return dataItem.parentId === targetDataItem.id; })) {
|
|
3200
|
-
result.push(
|
|
3228
|
+
result.push(of41(changeDescendantsAssociationsFull(__assign(__assign({}, action.payload), { parentId: targetDataItem.id, depth: depth + 1 }))));
|
|
3201
3229
|
}
|
|
3202
3230
|
});
|
|
3203
|
-
return
|
|
3231
|
+
return concat29.apply(void 0, result);
|
|
3204
3232
|
})); };
|
|
3205
3233
|
// src/api/ObservableApiWrapper.ts
|
|
3206
3234
|
import axios2 from "axios";
|
|
@@ -3244,7 +3272,7 @@ var ObservableApiWrapper = /** @class */ (function () {
|
|
|
3244
3272
|
}());
|
|
3245
3273
|
// src/api/ObservableApi.ts
|
|
3246
3274
|
import axios3 from "axios";
|
|
3247
|
-
import { EMPTY as
|
|
3275
|
+
import { EMPTY as EMPTY26, expand, map as map11, reduce } from "rxjs";
|
|
3248
3276
|
var Api = /** @class */ (function () {
|
|
3249
3277
|
function class_3(instance) {
|
|
3250
3278
|
this.api$ = new ObservableApiWrapper(instance);
|
|
@@ -3264,7 +3292,7 @@ var Api = /** @class */ (function () {
|
|
|
3264
3292
|
if (params === void 0) { params = {}; }
|
|
3265
3293
|
var currentPage = 1;
|
|
3266
3294
|
return this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: currentPage })).pipe(expand(function (response) {
|
|
3267
|
-
return response.hasNext ? _this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: ++currentPage })) :
|
|
3295
|
+
return response.hasNext ? _this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: ++currentPage })) : EMPTY26;
|
|
3268
3296
|
}), reduce(function (items, nextResponse) {
|
|
3269
3297
|
return __spreadArray(__spreadArray([], items, true), nextResponse.data, true);
|
|
3270
3298
|
}, []));
|
|
@@ -3480,13 +3508,13 @@ var requiredFields = function (_a) {
|
|
|
3480
3508
|
return next(action);
|
|
3481
3509
|
}; };
|
|
3482
3510
|
};
|
|
3483
|
-
function operationRequiresAutosave(operationType,
|
|
3511
|
+
function operationRequiresAutosave(operationType, actions2) {
|
|
3484
3512
|
var result = false;
|
|
3485
|
-
if (!
|
|
3513
|
+
if (!actions2) {
|
|
3486
3514
|
console.error('rowMeta is missing in the middle of "sendOperation" action');
|
|
3487
3515
|
return result;
|
|
3488
3516
|
}
|
|
3489
|
-
result = flattenOperations(
|
|
3517
|
+
result = flattenOperations(actions2).some(function (action) { return action.type === operationType && action.autoSaveBefore; });
|
|
3490
3518
|
return result;
|
|
3491
3519
|
}
|
|
3492
3520
|
function getRequiredFieldsMissing(record, pendingChanges, fieldsMeta) {
|
|
@@ -3542,8 +3570,8 @@ var preInvokeAction = function (_a) {
|
|
|
3542
3570
|
var bcName = (_a = state.view.widgets.find(function (widgetItem) { return widgetItem.name === widgetName_2; })) === null || _a === void 0 ? void 0 : _a.bcName;
|
|
3543
3571
|
var bcUrl = buildBcUrl(bcName, true, state);
|
|
3544
3572
|
var rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) === null || _b === void 0 ? void 0 : _b[bcUrl]);
|
|
3545
|
-
var
|
|
3546
|
-
var preInvoke = (_c =
|
|
3573
|
+
var actions2 = rowMeta && flattenOperations(rowMeta.actions);
|
|
3574
|
+
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;
|
|
3547
3575
|
return preInvoke && !confirm ? next(processPreInvoke({
|
|
3548
3576
|
bcName: bcName,
|
|
3549
3577
|
operationType: operationType_1,
|