@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
|
@@ -113,6 +113,8 @@ __export(actions_exports, {
|
|
|
113
113
|
processPreInvoke: () => processPreInvoke,
|
|
114
114
|
refreshMeta: () => refreshMeta,
|
|
115
115
|
refreshMetaAndReloadPage: () => refreshMetaAndReloadPage,
|
|
116
|
+
refreshMetaDone: () => refreshMetaDone,
|
|
117
|
+
refreshMetaFail: () => refreshMetaFail,
|
|
116
118
|
removeMultivalueTag: () => removeMultivalueTag,
|
|
117
119
|
removeNotifications: () => removeNotifications,
|
|
118
120
|
removePendingRequest: () => removePendingRequest,
|
|
@@ -232,6 +234,8 @@ var switchDebugMode = createAction("switchDebugMode");
|
|
|
232
234
|
var exportState = createAction("exportState");
|
|
233
235
|
var emptyAction = createAction("emptyAction");
|
|
234
236
|
var refreshMeta = createAction("refreshMeta");
|
|
237
|
+
var refreshMetaDone = createAction("refreshMetaDone");
|
|
238
|
+
var refreshMetaFail = createAction("refreshMetaFail");
|
|
235
239
|
var refreshMetaAndReloadPage = createAction("refreshMetaAndReloadPage");
|
|
236
240
|
var switchRole = createAction("switchRole");
|
|
237
241
|
var addPendingRequest = createAction("addPendingRequest");
|
|
@@ -489,6 +493,8 @@ __export(utils_exports, {
|
|
|
489
493
|
buildSearchResultTree: () => buildSearchResultTree,
|
|
490
494
|
buildUrl: () => buildUrl,
|
|
491
495
|
checkShowCondition: () => checkShowCondition,
|
|
496
|
+
createApiError: () => createApiError,
|
|
497
|
+
createApiErrorObservable: () => createApiErrorObservable,
|
|
492
498
|
defaultBuildURL: () => defaultBuildURL,
|
|
493
499
|
defaultParseURL: () => defaultParseURL,
|
|
494
500
|
deleteUndefinedFromObject: () => deleteUndefinedFromObject,
|
|
@@ -536,6 +542,18 @@ function applyRawParams(url, qso) {
|
|
|
536
542
|
const result = new URLSearchParams(qso).toString();
|
|
537
543
|
return `${addTailControlSequences(url)}${result && `${result}`}`;
|
|
538
544
|
}
|
|
545
|
+
// src/utils/apiError.ts
|
|
546
|
+
import { actions } from "@cxbox-ui/core";
|
|
547
|
+
import { EMPTY, of } from "rxjs";
|
|
548
|
+
function createApiError(error, context = { widgetName: "unknown" }) {
|
|
549
|
+
if (!error.isAxiosError)
|
|
550
|
+
return void 0;
|
|
551
|
+
return actions.apiError({ error, callContext: context });
|
|
552
|
+
}
|
|
553
|
+
function createApiErrorObservable(error, context) {
|
|
554
|
+
const apiError2 = createApiError(error, context);
|
|
555
|
+
return apiError2 ? of(apiError2) : EMPTY;
|
|
556
|
+
}
|
|
539
557
|
// src/utils/strings.ts
|
|
540
558
|
function getTemplate(literals, ...placeholders) {
|
|
541
559
|
let result = "";
|
|
@@ -1090,7 +1108,9 @@ var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderMana
|
|
|
1090
1108
|
state.bo.bc[action.payload.bcName].page = action.payload.page;
|
|
1091
1109
|
state.bo.bc[action.payload.bcName].loading = true;
|
|
1092
1110
|
}).addCase(showViewPopup, (state, action) => {
|
|
1093
|
-
|
|
1111
|
+
var _a, _b;
|
|
1112
|
+
const currentPage = (_b = (_a = state.bo.bc[action.payload.bcName]) == null ? void 0 : _a.page) != null ? _b : 1;
|
|
1113
|
+
state.bo.bc[action.payload.bcName].page = action.payload.bcName === action.payload.calleeBCName ? currentPage : 1;
|
|
1094
1114
|
state.bo.bc[action.payload.bcName].loading = action.payload.bcName !== action.payload.calleeBCName;
|
|
1095
1115
|
}).addCase(sendOperationSuccess, (state, action) => {
|
|
1096
1116
|
state.bo.bc[action.payload.bcName].loading = false;
|
|
@@ -1119,7 +1139,8 @@ var initialSessionState = {
|
|
|
1119
1139
|
errorMsg: null,
|
|
1120
1140
|
screens: [],
|
|
1121
1141
|
pendingRequests: [],
|
|
1122
|
-
notifications: []
|
|
1142
|
+
notifications: [],
|
|
1143
|
+
isMetaRefreshing: false
|
|
1123
1144
|
};
|
|
1124
1145
|
var createSessionReducerBuilderManager = (initialState) => new ReducerBuilderManager().addCase(login, (state) => {
|
|
1125
1146
|
state.loginSpin = true;
|
|
@@ -1149,6 +1170,12 @@ var createSessionReducerBuilderManager = (initialState) => new ReducerBuilderMan
|
|
|
1149
1170
|
}).addCase(removeNotifications, (state, action) => {
|
|
1150
1171
|
const closingKeys = action.payload;
|
|
1151
1172
|
state.notifications = state.notifications.filter((notification) => !closingKeys.includes(notification.key));
|
|
1173
|
+
}).addCase(refreshMeta, (state) => {
|
|
1174
|
+
state.isMetaRefreshing = true;
|
|
1175
|
+
}).addCase(refreshMetaDone, (state) => {
|
|
1176
|
+
state.isMetaRefreshing = false;
|
|
1177
|
+
}).addCase(refreshMetaFail, (state) => {
|
|
1178
|
+
state.isMetaRefreshing = false;
|
|
1152
1179
|
});
|
|
1153
1180
|
// src/reducers/view.ts
|
|
1154
1181
|
import { OperationTypeCrud as OperationTypeCrud4 } from "@cxbox-ui/schema";
|
|
@@ -1197,7 +1224,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1197
1224
|
}).addCase(bcNewDataSuccess, (state, action) => {
|
|
1198
1225
|
state.selectedCell = initialViewState.selectedCell;
|
|
1199
1226
|
}).addCase(forceActiveRmUpdate, (state, action) => {
|
|
1200
|
-
var _a, _b, _c, _d;
|
|
1227
|
+
var _a, _b, _c, _d, _e;
|
|
1201
1228
|
const { bcName, bcUrl, currentRecordData, rowMeta, cursor } = action.payload;
|
|
1202
1229
|
const handledForceActive = {};
|
|
1203
1230
|
const rowMetaForcedValues = {};
|
|
@@ -1209,6 +1236,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1209
1236
|
forceActiveFieldKeys.push(field.key);
|
|
1210
1237
|
}
|
|
1211
1238
|
});
|
|
1239
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) != null ? _a : {};
|
|
1212
1240
|
const consolidatedFrontData = __spreadValues(__spreadValues({}, currentRecordData), state.pendingDataChanges[bcName][cursor]);
|
|
1213
1241
|
Object.keys(consolidatedFrontData).forEach((key) => {
|
|
1214
1242
|
if (rowMetaForcedValues[key] !== void 0 && consolidatedFrontData[key] !== rowMetaForcedValues[key]) {
|
|
@@ -1221,12 +1249,12 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1221
1249
|
handledForceActive[key] = newPendingDataChanges[key];
|
|
1222
1250
|
}
|
|
1223
1251
|
});
|
|
1224
|
-
state.handledForceActive[bcName] = (
|
|
1225
|
-
state.handledForceActive[bcName][cursor] = (
|
|
1252
|
+
state.handledForceActive[bcName] = (_b = state.handledForceActive[bcName]) != null ? _b : {};
|
|
1253
|
+
state.handledForceActive[bcName][cursor] = (_c = state.handledForceActive[bcName][cursor]) != null ? _c : {};
|
|
1226
1254
|
Object.assign(state.handledForceActive[bcName][cursor], handledForceActive);
|
|
1227
|
-
state.pendingDataChanges[bcName] = (
|
|
1255
|
+
state.pendingDataChanges[bcName] = (_d = state.pendingDataChanges[bcName]) != null ? _d : {};
|
|
1228
1256
|
state.pendingDataChanges[bcName][cursor] = newPendingDataChanges;
|
|
1229
|
-
state.rowMeta[bcName] = (
|
|
1257
|
+
state.rowMeta[bcName] = (_e = state.rowMeta[bcName]) != null ? _e : {};
|
|
1230
1258
|
state.rowMeta[bcName][bcUrl] = rowMeta;
|
|
1231
1259
|
}).addCase(changeDataItem, (state, action) => {
|
|
1232
1260
|
var _a, _b, _c;
|
|
@@ -1489,9 +1517,9 @@ __export(epics_exports, {
|
|
|
1489
1517
|
userDrillDownEpic: () => userDrillDownEpic
|
|
1490
1518
|
});
|
|
1491
1519
|
// src/epics/view/sendOperationEpic.ts
|
|
1492
|
-
import { catchError, concat, EMPTY, filter, mergeMap, of as
|
|
1520
|
+
import { catchError, concat, EMPTY as EMPTY2, filter, mergeMap, of as of3 } from "rxjs";
|
|
1493
1521
|
// src/epics/utils/postOperationRoutine.ts
|
|
1494
|
-
import { of } from "rxjs";
|
|
1522
|
+
import { of as of2 } from "rxjs";
|
|
1495
1523
|
function postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName) {
|
|
1496
1524
|
const postInvokeConfirm = Object.values(OperationPostInvokeConfirmType).includes(postInvoke == null ? void 0 : postInvoke.type);
|
|
1497
1525
|
const result = [];
|
|
@@ -1514,7 +1542,7 @@ function postOperationRoutine(widgetName, postInvoke, preInvoke, operationType,
|
|
|
1514
1542
|
preInvoke
|
|
1515
1543
|
}));
|
|
1516
1544
|
}
|
|
1517
|
-
return result.map((item) =>
|
|
1545
|
+
return result.map((item) => of2(item));
|
|
1518
1546
|
}
|
|
1519
1547
|
// src/epics/view/sendOperationEpic.ts
|
|
1520
1548
|
var sendOperationEpic = (action$, state$, { api }) => action$.pipe(filter(sendOperation.match), filter((action) => matchOperationRole("none", action.payload, state$.value)), mergeMap((action) => {
|
|
@@ -1550,7 +1578,7 @@ var sendOperationEpic = (action$, state$, { api }) => action$.pipe(filter(sendOp
|
|
|
1550
1578
|
var _a2, _b2;
|
|
1551
1579
|
const postInvoke = (_a2 = response.postActions) == null ? void 0 : _a2[0];
|
|
1552
1580
|
const preInvoke = response.preInvoke;
|
|
1553
|
-
return defaultSaveOperation ? ((_b2 = action == null ? void 0 : action.payload) == null ? void 0 : _b2.onSuccessAction) ? concat(
|
|
1581
|
+
return defaultSaveOperation ? ((_b2 = action == null ? void 0 : action.payload) == null ? void 0 : _b2.onSuccessAction) ? concat(of3(bcCancelPendingChanges({ bcNames: [bcName] })), of3(action.payload.onSuccessAction)) : EMPTY2 : concat(of3(sendOperationSuccess({ bcName, cursor })), of3(bcForceUpdate({ bcName })), ...postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName));
|
|
1554
1582
|
}), catchError((e) => {
|
|
1555
1583
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
1556
1584
|
console.error(e);
|
|
@@ -1561,11 +1589,11 @@ var sendOperationEpic = (action$, state$, { api }) => action$.pipe(filter(sendOp
|
|
|
1561
1589
|
entityError = (_d2 = operationError == null ? void 0 : operationError.error) == null ? void 0 : _d2.entity;
|
|
1562
1590
|
viewError = (_f2 = (_e2 = operationError == null ? void 0 : operationError.error) == null ? void 0 : _e2.popup) == null ? void 0 : _f2[0];
|
|
1563
1591
|
}
|
|
1564
|
-
return
|
|
1592
|
+
return concat(of3(sendOperationFail({ bcName, bcUrl, viewError, entityError })), createApiErrorObservable(e, context));
|
|
1565
1593
|
}));
|
|
1566
1594
|
}));
|
|
1567
1595
|
// src/epics/view/showAssocPopupEpic.ts
|
|
1568
|
-
import { EMPTY as
|
|
1596
|
+
import { EMPTY as EMPTY3, filter as filter2, mergeMap as mergeMap2, of as of4 } from "rxjs";
|
|
1569
1597
|
import { WidgetTypes as WidgetTypes3 } from "@cxbox-ui/schema";
|
|
1570
1598
|
var showAssocPopupEpic = (action$, state$) => action$.pipe(filter2(showViewPopup.match), filter2((action) => !!(action.payload.calleeBCName && action.payload.associateFieldKey)), mergeMap2((action) => {
|
|
1571
1599
|
var _a, _b, _c, _d;
|
|
@@ -1578,7 +1606,7 @@ var showAssocPopupEpic = (action$, state$) => action$.pipe(filter2(showViewPopup
|
|
|
1578
1606
|
const assocFieldChanges = calleePendingChanges == null ? void 0 : calleePendingChanges[assocFieldKey];
|
|
1579
1607
|
const somethingMissing = !assocWidget || !calleePendingChanges || !assocFieldChanges || !assocFieldChanges;
|
|
1580
1608
|
if (somethingMissing || assocWidget.options && !assocWidget.options.hierarchyFull) {
|
|
1581
|
-
return
|
|
1609
|
+
return EMPTY3;
|
|
1582
1610
|
}
|
|
1583
1611
|
const popupInitPendingChanges = {};
|
|
1584
1612
|
assocFieldChanges.forEach((record) => {
|
|
@@ -1601,14 +1629,14 @@ var showAssocPopupEpic = (action$, state$) => action$.pipe(filter2(showViewPopup
|
|
|
1601
1629
|
}
|
|
1602
1630
|
});
|
|
1603
1631
|
}
|
|
1604
|
-
return
|
|
1632
|
+
return of4(changeDataItems({
|
|
1605
1633
|
bcName,
|
|
1606
1634
|
cursors: Object.keys(popupInitPendingChanges),
|
|
1607
1635
|
dataItems: Object.values(popupInitPendingChanges)
|
|
1608
1636
|
}));
|
|
1609
1637
|
}));
|
|
1610
1638
|
// src/epics/view/fileUploadConfirmEpic.ts
|
|
1611
|
-
import { concat as concat2, filter as filter3, mergeMap as mergeMap3, of as
|
|
1639
|
+
import { catchError as catchError2, concat as concat2, filter as filter3, mergeMap as mergeMap3, of as of5 } from "rxjs";
|
|
1612
1640
|
import { OperationTypeCrud as OperationTypeCrud5 } from "@cxbox-ui/schema";
|
|
1613
1641
|
var fileUploadConfirmEpic = (action$, state$, { api }) => action$.pipe(filter3(bulkUploadFiles.match), mergeMap3((action) => {
|
|
1614
1642
|
var _a, _b;
|
|
@@ -1623,11 +1651,14 @@ var fileUploadConfirmEpic = (action$, state$, { api }) => action$.pipe(filter3(b
|
|
|
1623
1651
|
var _a2;
|
|
1624
1652
|
const postInvoke = (_a2 = response.postActions) == null ? void 0 : _a2[0];
|
|
1625
1653
|
const preInvoke = response.preInvoke;
|
|
1626
|
-
return concat2(
|
|
1654
|
+
return concat2(of5(sendOperationSuccess({ bcName, cursor: null })), of5(bcForceUpdate({ bcName })), of5(closeViewPopup(null)), ...postOperationRoutine(widgetName, postInvoke, preInvoke, OperationTypeCrud5.save, bcName));
|
|
1655
|
+
}), catchError2((error) => {
|
|
1656
|
+
console.error(error);
|
|
1657
|
+
return createApiErrorObservable(error);
|
|
1627
1658
|
}));
|
|
1628
1659
|
}));
|
|
1629
1660
|
// src/epics/view/selectTableCellInitEpic.ts
|
|
1630
|
-
import { concat as concat3, filter as filter4, mergeMap as mergeMap4, of as
|
|
1661
|
+
import { concat as concat3, filter as filter4, mergeMap as mergeMap4, of as of6 } from "rxjs";
|
|
1631
1662
|
var selectTableCellInitEpic = (action$, state$) => action$.pipe(filter4(selectTableCellInit.match), mergeMap4((action) => {
|
|
1632
1663
|
var _a;
|
|
1633
1664
|
const resultObservables = [];
|
|
@@ -1638,18 +1669,18 @@ var selectTableCellInitEpic = (action$, state$) => action$.pipe(filter4(selectTa
|
|
|
1638
1669
|
const nextBcCursor = (_a = state.screen.bo.bc[nextBcName]) == null ? void 0 : _a.cursor;
|
|
1639
1670
|
const selectedCell = state.view.selectedCell;
|
|
1640
1671
|
if (nextRowId !== nextBcCursor) {
|
|
1641
|
-
resultObservables.push(
|
|
1672
|
+
resultObservables.push(of6(bcSelectRecord({ bcName: nextBcName, cursor: nextRowId })));
|
|
1642
1673
|
}
|
|
1643
1674
|
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || (nextWidget == null ? void 0 : nextWidget.name) !== selectedCell.widgetName) {
|
|
1644
|
-
resultObservables.push(
|
|
1675
|
+
resultObservables.push(of6(selectTableCell({ widgetName: nextWidget == null ? void 0 : nextWidget.name, rowId: nextRowId, fieldKey })));
|
|
1645
1676
|
}
|
|
1646
1677
|
return concat3(...resultObservables);
|
|
1647
1678
|
}));
|
|
1648
1679
|
// src/epics/view/showFileUploadPopupEpic.ts
|
|
1649
|
-
import { concat as concat4, filter as filter5, mergeMap as mergeMap5, of as
|
|
1680
|
+
import { concat as concat4, filter as filter5, mergeMap as mergeMap5, of as of7 } from "rxjs";
|
|
1650
1681
|
import { OperationTypeCrud as OperationTypeCrud6 } from "@cxbox-ui/schema";
|
|
1651
1682
|
var showFileUploadPopupEpic = (action$, state$) => action$.pipe(filter5(sendOperation.match), filter5((action) => matchOperationRole(OperationTypeCrud6.fileUpload, action.payload, state$.value)), mergeMap5((action) => {
|
|
1652
|
-
return concat4(
|
|
1683
|
+
return concat4(of7(bcChangeCursors({ cursorsMap: { [action.payload.bcName]: null } })), of7(showFileUploadPopup({ widgetName: action.payload.widgetName })));
|
|
1653
1684
|
}));
|
|
1654
1685
|
// src/epics/view/sendOperationAssociateEpic.ts
|
|
1655
1686
|
import { filter as filter6, map } from "rxjs";
|
|
@@ -1664,11 +1695,11 @@ var sendOperationAssociateEpic = (action$, state$) => action$.pipe(filter6(sendO
|
|
|
1664
1695
|
});
|
|
1665
1696
|
}));
|
|
1666
1697
|
// src/epics/view/getRowMetaByForceActiveEpic.ts
|
|
1667
|
-
import { EMPTY as
|
|
1698
|
+
import { EMPTY as EMPTY4, concat as concat5, filter as filter7, mergeMap as mergeMap6, of as of8, catchError as catchError3 } from "rxjs";
|
|
1668
1699
|
import { WidgetTypes as WidgetTypes4 } from "@cxbox-ui/schema";
|
|
1669
1700
|
import { nanoid } from "@reduxjs/toolkit";
|
|
1670
1701
|
var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(filter7(changeDataItem.match), mergeMap6((action) => {
|
|
1671
|
-
var _a, _b, _c, _d;
|
|
1702
|
+
var _a, _b, _c, _d, _e;
|
|
1672
1703
|
const state = state$.value;
|
|
1673
1704
|
const initUrl = state.view.url;
|
|
1674
1705
|
const { bcName, cursor, disableRetry } = action.payload;
|
|
@@ -1677,19 +1708,19 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1677
1708
|
return widget.bcName === bcName && widget.type === WidgetTypes4.AssocListPopup && (((_a2 = widget.options) == null ? void 0 : _a2.hierarchySameBc) || ((_b2 = widget.options) == null ? void 0 : _b2.hierarchyFull));
|
|
1678
1709
|
});
|
|
1679
1710
|
if (isBcHierarchy) {
|
|
1680
|
-
return
|
|
1711
|
+
return EMPTY4;
|
|
1681
1712
|
}
|
|
1682
1713
|
const isPickListPopup = state.view.widgets.find((item) => {
|
|
1683
1714
|
var _a2;
|
|
1684
1715
|
return item.name === ((_a2 = state.view.popupData) == null ? void 0 : _a2.widgetName) && [WidgetTypes4.PickListPopup, WidgetTypes4.FlatTreePopup].includes(item.type);
|
|
1685
1716
|
});
|
|
1686
1717
|
const bcUrl = buildBcUrl(bcName, true, state);
|
|
1687
|
-
const pendingChanges = state.view.pendingDataChanges[bcName][cursor];
|
|
1688
|
-
const handledForceActive = ((
|
|
1689
|
-
const currentRecordData = (
|
|
1690
|
-
const fieldsRowMeta = (
|
|
1718
|
+
const pendingChanges = (_a = state.view.pendingDataChanges[bcName]) == null ? void 0 : _a[cursor];
|
|
1719
|
+
const handledForceActive = ((_b = state.view.handledForceActive[bcName]) == null ? void 0 : _b[cursor]) || {};
|
|
1720
|
+
const currentRecordData = (_c = state.data[bcName]) == null ? void 0 : _c.find((record) => record.id === cursor);
|
|
1721
|
+
const fieldsRowMeta = (_e = (_d = state.view.rowMeta[bcName]) == null ? void 0 : _d[bcUrl]) == null ? void 0 : _e.fields;
|
|
1691
1722
|
let changedFiledKey = null;
|
|
1692
|
-
const closePopup = concat5(
|
|
1723
|
+
const closePopup = concat5(of8(closeViewPopup(null)), of8(viewClearPickMap(null)), of8(bcRemoveAllFilters({ bcName })));
|
|
1693
1724
|
const someForceActiveChanged = fieldsRowMeta == null ? void 0 : fieldsRowMeta.filter((field) => field.forceActive && pendingChanges[field.key] !== void 0).some((field) => {
|
|
1694
1725
|
const result = pendingChanges[field.key] !== handledForceActive[field.key];
|
|
1695
1726
|
if (result) {
|
|
@@ -1699,10 +1730,10 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1699
1730
|
});
|
|
1700
1731
|
const requestId = nanoid();
|
|
1701
1732
|
if (someForceActiveChanged && !disableRetry) {
|
|
1702
|
-
return concat5(
|
|
1703
|
-
const result = [
|
|
1733
|
+
return concat5(of8(addPendingRequest({ request: { requestId, type: "force-active" } })), api.getRmByForceActive(state.screen.screenName, bcUrl, __spreadProps(__spreadValues({}, pendingChanges), { vstamp: currentRecordData == null ? void 0 : currentRecordData.vstamp })).pipe(mergeMap6((data) => {
|
|
1734
|
+
const result = [of8(removePendingRequest({ requestId }))];
|
|
1704
1735
|
if (state.view.url === initUrl) {
|
|
1705
|
-
result.push(
|
|
1736
|
+
result.push(of8(forceActiveRmUpdate({
|
|
1706
1737
|
rowMeta: data,
|
|
1707
1738
|
currentRecordData,
|
|
1708
1739
|
bcName,
|
|
@@ -1714,43 +1745,43 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1714
1745
|
result.push(closePopup);
|
|
1715
1746
|
}
|
|
1716
1747
|
return concat5(...result);
|
|
1717
|
-
}),
|
|
1718
|
-
var _a2, _b2, _c2, _d2,
|
|
1748
|
+
}), catchError3((e) => {
|
|
1749
|
+
var _a2, _b2, _c2, _d2, _e2, _f;
|
|
1719
1750
|
console.error(e);
|
|
1720
1751
|
let viewError = null;
|
|
1721
1752
|
let entityError = null;
|
|
1722
1753
|
const operationError = (_a2 = e.response) == null ? void 0 : _a2.data;
|
|
1723
1754
|
if (((_b2 = e.response) == null ? void 0 : _b2.data) === Object((_c2 = e.response) == null ? void 0 : _c2.data)) {
|
|
1724
1755
|
entityError = (_d2 = operationError == null ? void 0 : operationError.error) == null ? void 0 : _d2.entity;
|
|
1725
|
-
viewError = (_f = (
|
|
1756
|
+
viewError = (_f = (_e2 = operationError == null ? void 0 : operationError.error) == null ? void 0 : _e2.popup) == null ? void 0 : _f[0];
|
|
1726
1757
|
}
|
|
1727
|
-
return concat5(
|
|
1758
|
+
return concat5(of8(removePendingRequest({ requestId })), state.view.url === initUrl ? concat5(of8(changeDataItem({
|
|
1728
1759
|
bcName,
|
|
1729
1760
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
1730
1761
|
cursor,
|
|
1731
1762
|
dataItem: { [changedFiledKey]: currentRecordData == null ? void 0 : currentRecordData[changedFiledKey] },
|
|
1732
1763
|
disableRetry: true
|
|
1733
|
-
})),
|
|
1764
|
+
})), of8(forceActiveChangeFail({ bcName, bcUrl, viewError, entityError }))) : EMPTY4, createApiErrorObservable(e));
|
|
1734
1765
|
})));
|
|
1735
1766
|
}
|
|
1736
|
-
return isPickListPopup ? closePopup :
|
|
1767
|
+
return isPickListPopup ? closePopup : EMPTY4;
|
|
1737
1768
|
}));
|
|
1738
1769
|
// src/epics/view/showAllTableRecordsInitEpic.ts
|
|
1739
|
-
import { concat as concat6, filter as filter8, mergeMap as mergeMap7, of as
|
|
1770
|
+
import { concat as concat6, filter as filter8, mergeMap as mergeMap7, of as of9 } from "rxjs";
|
|
1740
1771
|
var showAllTableRecordsInitEpic = (action$, state$) => action$.pipe(filter8(showAllTableRecordsInit.match), mergeMap7((action) => {
|
|
1741
1772
|
const resultObservables = [];
|
|
1742
1773
|
const { bcName, cursor } = action.payload;
|
|
1743
1774
|
const state = state$.value;
|
|
1744
1775
|
const route = state.router;
|
|
1745
|
-
resultObservables.push(
|
|
1776
|
+
resultObservables.push(of9(bcChangeCursors({ cursorsMap: { [bcName]: null } })));
|
|
1746
1777
|
const bcPath = route.bcPath.slice(0, route.bcPath.indexOf(`${bcName}/${cursor}`));
|
|
1747
1778
|
const url = defaultBuildURL(__spreadProps(__spreadValues({}, route), { bcPath }));
|
|
1748
|
-
resultObservables.push(
|
|
1749
|
-
resultObservables.push(
|
|
1779
|
+
resultObservables.push(of9(bcForceUpdate({ bcName })));
|
|
1780
|
+
resultObservables.push(of9(changeLocation({ location: defaultParseURL(new URL(url, window.location.origin)) })));
|
|
1750
1781
|
return concat6(...resultObservables);
|
|
1751
1782
|
}));
|
|
1752
1783
|
// src/epics/view/clearPendingDataChangesAfterCursorChangeEpic.ts
|
|
1753
|
-
import { EMPTY as
|
|
1784
|
+
import { EMPTY as EMPTY5, filter as filter9, mergeMap as mergeMap8, of as of10 } from "rxjs";
|
|
1754
1785
|
var clearPendingDataChangesAfterCursorChangeEpic = (action$, state$) => action$.pipe(filter9(bcChangeCursors.match), mergeMap8((action) => {
|
|
1755
1786
|
const state = state$.value;
|
|
1756
1787
|
const nextCursors = parseBcCursors(state.router.bcPath) || {};
|
|
@@ -1763,12 +1794,12 @@ var clearPendingDataChangesAfterCursorChangeEpic = (action$, state$) => action$.
|
|
|
1763
1794
|
}
|
|
1764
1795
|
});
|
|
1765
1796
|
if (Object.keys(cursorsDiffMap).length) {
|
|
1766
|
-
return
|
|
1797
|
+
return of10(bcChangeCursors({ cursorsMap: cursorsDiffMap }));
|
|
1767
1798
|
}
|
|
1768
|
-
return
|
|
1799
|
+
return EMPTY5;
|
|
1769
1800
|
}));
|
|
1770
1801
|
// src/epics/router/drilldownEpic.ts
|
|
1771
|
-
import { concat as concat7, EMPTY as
|
|
1802
|
+
import { concat as concat7, EMPTY as EMPTY6, filter as filter10, switchMap } from "rxjs";
|
|
1772
1803
|
var drillDownEpic = (action$, state$) => action$.pipe(filter10(drillDown.match), switchMap((action) => {
|
|
1773
1804
|
var _a, _b;
|
|
1774
1805
|
const state = state$.value;
|
|
@@ -1843,7 +1874,7 @@ var drillDownEpic = (action$, state$) => action$.pipe(filter10(drillDown.match),
|
|
|
1843
1874
|
result.push(changeLocation({ location: defaultParseURL(new URL(makeRelativeUrl(urlBase), window.location.origin)) }));
|
|
1844
1875
|
break;
|
|
1845
1876
|
}
|
|
1846
|
-
return result.length ? concat7(result) :
|
|
1877
|
+
return result.length ? concat7(result) : EMPTY6;
|
|
1847
1878
|
}));
|
|
1848
1879
|
function shallowCompare(prevProps, nextProps, ignore = []) {
|
|
1849
1880
|
const diffProps = [];
|
|
@@ -1870,18 +1901,18 @@ function shallowCompare(prevProps, nextProps, ignore = []) {
|
|
|
1870
1901
|
return diffProps;
|
|
1871
1902
|
}
|
|
1872
1903
|
// src/epics/router/loginDoneEpic.ts
|
|
1873
|
-
import { filter as filter11, of as
|
|
1904
|
+
import { filter as filter11, of as of11, switchMap as switchMap2 } from "rxjs";
|
|
1874
1905
|
var loginDoneEpic = (action$, state$) => action$.pipe(filter11(loginDone.match), switchMap2((action) => {
|
|
1875
1906
|
const state = state$.value;
|
|
1876
1907
|
if (state.router.type === "router" /* router */) {
|
|
1877
|
-
return
|
|
1908
|
+
return of11(handleRouter(state.router));
|
|
1878
1909
|
}
|
|
1879
1910
|
const nextScreenName = state.router.screenName;
|
|
1880
1911
|
const nextScreen = state.session.screens.find((item) => nextScreenName ? item.name === nextScreenName : item.defaultScreen) || state.session.screens[0];
|
|
1881
|
-
return nextScreen ?
|
|
1912
|
+
return nextScreen ? of11(selectScreen({ screen: nextScreen })) : of11(selectScreenFail({ screenName: nextScreenName }));
|
|
1882
1913
|
}));
|
|
1883
1914
|
// src/epics/router/selectViewEpic.ts
|
|
1884
|
-
import { EMPTY as
|
|
1915
|
+
import { EMPTY as EMPTY7, filter as filter12, of as of12, switchMap as switchMap3 } from "rxjs";
|
|
1885
1916
|
var changeViewEpic = (action$, state$) => action$.pipe(filter12(selectView.match), switchMap3((action) => {
|
|
1886
1917
|
const state = state$.value;
|
|
1887
1918
|
const nextCursors = parseBcCursors(state.router.bcPath) || {};
|
|
@@ -1894,34 +1925,34 @@ var changeViewEpic = (action$, state$) => action$.pipe(filter12(selectView.match
|
|
|
1894
1925
|
}
|
|
1895
1926
|
});
|
|
1896
1927
|
if (Object.keys(cursorsDiffMap).length) {
|
|
1897
|
-
return
|
|
1928
|
+
return of12(bcChangeCursors({ cursorsMap: cursorsDiffMap }));
|
|
1898
1929
|
}
|
|
1899
|
-
return
|
|
1930
|
+
return EMPTY7;
|
|
1900
1931
|
}));
|
|
1901
1932
|
// src/epics/router/handleRouterEpic.ts
|
|
1902
|
-
import { catchError as
|
|
1933
|
+
import { catchError as catchError4, EMPTY as EMPTY8, filter as filter13, mergeMap as mergeMap9, switchMap as switchMap4 } from "rxjs";
|
|
1903
1934
|
var handleRouterEpic = (action$, state$, { api }) => action$.pipe(filter13(handleRouter.match), switchMap4((action) => {
|
|
1904
1935
|
const path = action.payload.path;
|
|
1905
1936
|
const params = action.payload.params;
|
|
1906
1937
|
return api.routerRequest(path, params).pipe(mergeMap9(() => {
|
|
1907
|
-
return
|
|
1908
|
-
}),
|
|
1938
|
+
return EMPTY8;
|
|
1939
|
+
}), catchError4((error) => {
|
|
1909
1940
|
console.error(error);
|
|
1910
|
-
return
|
|
1941
|
+
return createApiErrorObservable(error);
|
|
1911
1942
|
}));
|
|
1912
1943
|
}));
|
|
1913
1944
|
// src/epics/router/selectScreenEpic.ts
|
|
1914
|
-
import { filter as filter14, of as
|
|
1945
|
+
import { filter as filter14, of as of13, switchMap as switchMap5 } from "rxjs";
|
|
1915
1946
|
var changeScreen = (action$, state$) => action$.pipe(filter14(selectScreen.match), switchMap5((action) => {
|
|
1916
1947
|
const state = state$.value;
|
|
1917
1948
|
const nextViewName = state.router.viewName;
|
|
1918
1949
|
const requestedView = state.screen.views.find((item) => item.name === nextViewName);
|
|
1919
1950
|
const defaultView = !nextViewName && state.screen.primaryView && state.screen.views.find((item) => item.name === state.screen.primaryView);
|
|
1920
1951
|
const nextView = requestedView || defaultView || state.screen.views[0];
|
|
1921
|
-
return nextView ?
|
|
1952
|
+
return nextView ? of13(selectView(nextView)) : of13(selectViewFail({ viewName: nextViewName }));
|
|
1922
1953
|
}));
|
|
1923
1954
|
// src/epics/router/userDrillDownEpic.ts
|
|
1924
|
-
import { catchError as
|
|
1955
|
+
import { catchError as catchError5, concat as concat8, EMPTY as EMPTY9, filter as filter15, mergeMap as mergeMap10, of as of14, switchMap as switchMap6 } from "rxjs";
|
|
1925
1956
|
var userDrillDownEpic = (action$, state$, { api }) => action$.pipe(filter15(userDrillDown.match), switchMap6((action) => {
|
|
1926
1957
|
const state = state$.value;
|
|
1927
1958
|
const { bcName, fieldKey, cursor } = action.payload;
|
|
@@ -1932,33 +1963,33 @@ var userDrillDownEpic = (action$, state$, { api }) => action$.pipe(filter15(user
|
|
|
1932
1963
|
const route = state.router;
|
|
1933
1964
|
const drillDownKey = (_b = (_a = state.view.widgets.find((widget) => widget.bcName === bcName)) == null ? void 0 : _a.fields.find((field) => field.key === fieldKey)) == null ? void 0 : _b.drillDownKey;
|
|
1934
1965
|
const customDrillDownUrl = (_d = (_c = state.data[bcName]) == null ? void 0 : _c.find((record) => record.id === cursor)) == null ? void 0 : _d[drillDownKey];
|
|
1935
|
-
return customDrillDownUrl || (drillDownField == null ? void 0 : drillDownField.drillDown) || (drillDownField == null ? void 0 : drillDownField.drillDown) !== route.path ? concat8((drillDownField == null ? void 0 : drillDownField.drillDownType) !== DrillDownType.inner ?
|
|
1966
|
+
return customDrillDownUrl || (drillDownField == null ? void 0 : drillDownField.drillDown) || (drillDownField == null ? void 0 : drillDownField.drillDown) !== route.path ? concat8((drillDownField == null ? void 0 : drillDownField.drillDownType) !== DrillDownType.inner ? of14(bcFetchRowMetaSuccess({ bcName, rowMeta, bcUrl, cursor })) : EMPTY9, of14(userDrillDownSuccess({ bcName, bcUrl, cursor })), of14(drillDown({
|
|
1936
1967
|
url: customDrillDownUrl || drillDownField.drillDown,
|
|
1937
1968
|
drillDownType: drillDownField.drillDownType,
|
|
1938
1969
|
route
|
|
1939
|
-
}))) :
|
|
1940
|
-
}),
|
|
1970
|
+
}))) : EMPTY9;
|
|
1971
|
+
}), catchError5((error) => {
|
|
1941
1972
|
console.error(error);
|
|
1942
|
-
return
|
|
1973
|
+
return createApiErrorObservable(error);
|
|
1943
1974
|
}));
|
|
1944
1975
|
}));
|
|
1945
1976
|
// src/epics/router/changeLocationEpic.ts
|
|
1946
|
-
import { concat as concat9, EMPTY as
|
|
1977
|
+
import { concat as concat9, EMPTY as EMPTY10, filter as filter16, mergeMap as mergeMap11, of as of15 } from "rxjs";
|
|
1947
1978
|
var changeLocationEpic = (action$, state$) => action$.pipe(filter16(changeLocation.match), mergeMap11((action) => {
|
|
1948
1979
|
var _a, _b;
|
|
1949
1980
|
const state = state$.value;
|
|
1950
1981
|
if (!state.session.active) {
|
|
1951
|
-
return
|
|
1982
|
+
return EMPTY10;
|
|
1952
1983
|
}
|
|
1953
1984
|
if (state.router.type === "router" /* router */) {
|
|
1954
|
-
return
|
|
1985
|
+
return of15(handleRouter(state.router));
|
|
1955
1986
|
}
|
|
1956
1987
|
const currentScreenName = state.screen.screenName;
|
|
1957
1988
|
const defaultScreenName = ((_a = state.session.screens.find((screen) => screen.defaultScreen)) == null ? void 0 : _a.name) || ((_b = state.session.screens[0]) == null ? void 0 : _b.name);
|
|
1958
1989
|
const nextScreenName = state.router.type === "default" /* default */ ? defaultScreenName : state.router.screenName;
|
|
1959
1990
|
if (nextScreenName !== currentScreenName) {
|
|
1960
1991
|
const nextScreen = state.session.screens.find((item) => item.name === nextScreenName);
|
|
1961
|
-
return nextScreen ?
|
|
1992
|
+
return nextScreen ? of15(selectScreen({ screen: nextScreen })) : of15(selectScreenFail({ screenName: nextScreenName }));
|
|
1962
1993
|
}
|
|
1963
1994
|
const currentViewName = state.view.name;
|
|
1964
1995
|
const nextViewName = state.router.viewName;
|
|
@@ -1975,17 +2006,17 @@ var changeLocationEpic = (action$, state$) => action$.pipe(filter16(changeLocati
|
|
|
1975
2006
|
const needUpdateViews = nextViewName !== currentViewName;
|
|
1976
2007
|
const resultObservables = [];
|
|
1977
2008
|
if (needUpdateCursors) {
|
|
1978
|
-
resultObservables.push(
|
|
2009
|
+
resultObservables.push(of15(bcChangeCursors({ cursorsMap: cursorsDiffMap })));
|
|
1979
2010
|
}
|
|
1980
2011
|
if (needUpdateViews) {
|
|
1981
2012
|
const nextView = nextViewName ? state.screen.views.find((item) => item.name === nextViewName) : state.screen.primaryView ? state.screen.views.find((item) => item.name === state.screen.primaryView) : state.screen.views[0];
|
|
1982
|
-
resultObservables.push(nextView ?
|
|
2013
|
+
resultObservables.push(nextView ? of15(selectView(nextView)) : of15(selectViewFail({ viewName: nextViewName })));
|
|
1983
2014
|
}
|
|
1984
2015
|
if (needUpdateCursors && !needUpdateViews) {
|
|
1985
2016
|
Object.entries(nextCursors).forEach((entry) => {
|
|
1986
2017
|
const [bcName, cursor] = entry;
|
|
1987
2018
|
if (!state.data[bcName].find((item) => item.id === cursor)) {
|
|
1988
|
-
resultObservables.push(
|
|
2019
|
+
resultObservables.push(of15(bcForceUpdate({ bcName })));
|
|
1989
2020
|
}
|
|
1990
2021
|
});
|
|
1991
2022
|
}
|
|
@@ -2025,27 +2056,27 @@ var userDrillDownChangeCursorsEpic = (action$, state$) => action$.pipe(filter19(
|
|
|
2025
2056
|
}));
|
|
2026
2057
|
// src/epics/screen/apiErrorEpic.ts
|
|
2027
2058
|
import axios from "axios";
|
|
2028
|
-
import { EMPTY as
|
|
2059
|
+
import { EMPTY as EMPTY11, filter as filter20, mergeMap as mergeMap12, of as of16 } from "rxjs";
|
|
2029
2060
|
var apiErrorEpic = (action$) => action$.pipe(filter20(apiError.match), mergeMap12((action) => {
|
|
2030
2061
|
const { error, callContext } = action.payload;
|
|
2031
2062
|
if (error.response) {
|
|
2032
|
-
return
|
|
2063
|
+
return of16(httpError({
|
|
2033
2064
|
statusCode: error.response.status,
|
|
2034
2065
|
error,
|
|
2035
2066
|
callContext
|
|
2036
2067
|
}));
|
|
2037
2068
|
}
|
|
2038
2069
|
else if (!axios.isCancel(error)) {
|
|
2039
|
-
return
|
|
2070
|
+
return of16(showViewError({
|
|
2040
2071
|
error: {
|
|
2041
2072
|
type: 2 /* NetworkError */
|
|
2042
2073
|
}
|
|
2043
2074
|
}));
|
|
2044
2075
|
}
|
|
2045
|
-
return
|
|
2076
|
+
return EMPTY11;
|
|
2046
2077
|
}));
|
|
2047
2078
|
// src/epics/screen/downloadFileEpic.ts
|
|
2048
|
-
import { EMPTY as
|
|
2079
|
+
import { EMPTY as EMPTY12, filter as filter21, mergeMap as mergeMap13, tap } from "rxjs";
|
|
2049
2080
|
var downloadFileEpic = (action$, state$, { api }) => action$.pipe(filter21(downloadFile.match), tap((action) => {
|
|
2050
2081
|
const { fileId } = action.payload;
|
|
2051
2082
|
const anchor = document.createElement("a");
|
|
@@ -2056,7 +2087,7 @@ var downloadFileEpic = (action$, state$, { api }) => action$.pipe(filter21(downl
|
|
|
2056
2087
|
anchor.click();
|
|
2057
2088
|
document.body.removeChild(anchor);
|
|
2058
2089
|
}, 100);
|
|
2059
|
-
}), mergeMap13(() =>
|
|
2090
|
+
}), mergeMap13(() => EMPTY12));
|
|
2060
2091
|
// src/epics/screen/httpError401Epic.ts
|
|
2061
2092
|
import { filter as filter22, map as map5 } from "rxjs";
|
|
2062
2093
|
var httpError401Epic = (action$) => action$.pipe(filter22(httpError.match), filter22((action) => action.payload.statusCode === 401), map5((action) => {
|
|
@@ -2080,24 +2111,24 @@ var httpError409Epic = (action$, state$) => action$.pipe(filter23(httpError.matc
|
|
|
2080
2111
|
});
|
|
2081
2112
|
}));
|
|
2082
2113
|
// src/epics/screen/httpError418Epic.ts
|
|
2083
|
-
import { concat as concat10, EMPTY as
|
|
2114
|
+
import { concat as concat10, EMPTY as EMPTY13, filter as filter24, mergeMap as mergeMap14, of as of17 } from "rxjs";
|
|
2084
2115
|
var httpError418Epic = (action$, state$) => action$.pipe(filter24(httpError.match), filter24((action) => action.payload.statusCode === 418), mergeMap14((action) => {
|
|
2085
2116
|
var _a, _b;
|
|
2086
2117
|
const { error, callContext } = action.payload;
|
|
2087
2118
|
const result = [];
|
|
2088
2119
|
const typedError = (_a = error.response) == null ? void 0 : _a.data;
|
|
2089
2120
|
if (!typedError.error.popup) {
|
|
2090
|
-
return
|
|
2121
|
+
return EMPTY13;
|
|
2091
2122
|
}
|
|
2092
2123
|
const businessError = {
|
|
2093
2124
|
type: 0 /* BusinessError */,
|
|
2094
2125
|
message: typedError.error.popup[0]
|
|
2095
2126
|
};
|
|
2096
|
-
result.push(
|
|
2127
|
+
result.push(of17(showViewError({ error: businessError })));
|
|
2097
2128
|
if ((_b = typedError.error.postActions) == null ? void 0 : _b[0]) {
|
|
2098
2129
|
const widget = state$.value.view.widgets.find((item) => item.name === callContext.widgetName);
|
|
2099
2130
|
const bcName = widget == null ? void 0 : widget.bcName;
|
|
2100
|
-
result.push(
|
|
2131
|
+
result.push(of17(processPostInvoke({
|
|
2101
2132
|
bcName,
|
|
2102
2133
|
postInvoke: typedError.error.postActions[0],
|
|
2103
2134
|
widgetName: widget == null ? void 0 : widget.name
|
|
@@ -2129,7 +2160,7 @@ var httpErrorDefaultEpic = (action$, state$) => action$.pipe(filter26(httpError.
|
|
|
2129
2160
|
return showViewError({ error: businessError });
|
|
2130
2161
|
}));
|
|
2131
2162
|
// src/epics/screen/downloadFileByUrlEpic.ts
|
|
2132
|
-
import { EMPTY as
|
|
2163
|
+
import { EMPTY as EMPTY14, filter as filter27, mergeMap as mergeMap15, tap as tap2 } from "rxjs";
|
|
2133
2164
|
var downloadFileByUrlEpic = (action$, state$) => action$.pipe(filter27(downloadFileByUrl.match), tap2((action) => {
|
|
2134
2165
|
const { url } = action.payload;
|
|
2135
2166
|
const anchor = document.createElement("a");
|
|
@@ -2140,15 +2171,15 @@ var downloadFileByUrlEpic = (action$, state$) => action$.pipe(filter27(downloadF
|
|
|
2140
2171
|
anchor.click();
|
|
2141
2172
|
document.body.removeChild(anchor);
|
|
2142
2173
|
}, 100);
|
|
2143
|
-
}), mergeMap15(() =>
|
|
2174
|
+
}), mergeMap15(() => EMPTY14));
|
|
2144
2175
|
// src/epics/screen/processPostInvokeEpic.ts
|
|
2145
|
-
import { EMPTY as
|
|
2176
|
+
import { EMPTY as EMPTY15, filter as filter28, mergeMap as mergeMap16, of as of18 } from "rxjs";
|
|
2146
2177
|
var processPostInvokeEpic = (action$, state$) => action$.pipe(filter28(processPostInvoke.match), mergeMap16((action) => {
|
|
2147
2178
|
var _a;
|
|
2148
2179
|
const state = state$.value;
|
|
2149
2180
|
switch (action.payload.postInvoke.type) {
|
|
2150
2181
|
case "drillDown" /* drillDown */:
|
|
2151
|
-
return
|
|
2182
|
+
return of18(drillDown(__spreadProps(__spreadValues({}, action.payload.postInvoke), {
|
|
2152
2183
|
route: state.router,
|
|
2153
2184
|
widgetName: action.payload.widgetName
|
|
2154
2185
|
})));
|
|
@@ -2166,7 +2197,7 @@ var processPostInvokeEpic = (action$, state$) => action$.pipe(filter28(processPo
|
|
|
2166
2197
|
widgetName: action.payload.widgetName
|
|
2167
2198
|
}));
|
|
2168
2199
|
}
|
|
2169
|
-
return
|
|
2200
|
+
return of18(...result);
|
|
2170
2201
|
}
|
|
2171
2202
|
case "refreshBC" /* refreshBC */: {
|
|
2172
2203
|
const bo = state.screen.bo;
|
|
@@ -2176,34 +2207,34 @@ var processPostInvokeEpic = (action$, state$) => action$.pipe(filter28(processPo
|
|
|
2176
2207
|
const widgetName = action.payload.widgetName || "";
|
|
2177
2208
|
const infiniteWidgets = state.view.infiniteWidgets || [];
|
|
2178
2209
|
const infinitePagination = state.view.widgets.some((item) => item.bcName === postInvokeBC && infiniteWidgets.includes(item.name));
|
|
2179
|
-
return infinitePagination ?
|
|
2210
|
+
return infinitePagination ? of18(bcFetchDataPages({
|
|
2180
2211
|
bcName: postInvokeBCItem.name,
|
|
2181
2212
|
widgetName,
|
|
2182
2213
|
from: 1,
|
|
2183
2214
|
to: postInvokeBCItem.page
|
|
2184
|
-
})) :
|
|
2215
|
+
})) : of18(bcFetchDataRequest({
|
|
2185
2216
|
bcName: postInvokeBCItem.name,
|
|
2186
2217
|
widgetName
|
|
2187
2218
|
}));
|
|
2188
2219
|
}
|
|
2189
2220
|
case "showMessage" /* showMessage */: {
|
|
2190
2221
|
const postInvoke = action.payload.postInvoke;
|
|
2191
|
-
return
|
|
2222
|
+
return of18(showNotification({ type: postInvoke.messageType, message: postInvoke.messageText }));
|
|
2192
2223
|
}
|
|
2193
2224
|
case "downloadFile" /* downloadFile */: {
|
|
2194
2225
|
const postInvoke = action.payload.postInvoke;
|
|
2195
|
-
return
|
|
2226
|
+
return of18(downloadFile({ fileId: postInvoke.fileId }));
|
|
2196
2227
|
}
|
|
2197
2228
|
case "downloadFileByUrl" /* downloadFileByUrl */: {
|
|
2198
2229
|
const postInvoke = action.payload.postInvoke;
|
|
2199
|
-
return
|
|
2230
|
+
return of18(downloadFileByUrl({ url: postInvoke.url }));
|
|
2200
2231
|
}
|
|
2201
2232
|
default:
|
|
2202
|
-
return
|
|
2233
|
+
return EMPTY15;
|
|
2203
2234
|
}
|
|
2204
2235
|
}));
|
|
2205
2236
|
// src/epics/screen/processPostInvokeConfirmEpic.ts
|
|
2206
|
-
import { EMPTY as
|
|
2237
|
+
import { EMPTY as EMPTY16, filter as filter29, mergeMap as mergeMap17, of as of19 } from "rxjs";
|
|
2207
2238
|
import { isAnyOf } from "@reduxjs/toolkit";
|
|
2208
2239
|
var processPostInvokeConfirmEpic = (action$, state$) => action$.pipe(filter29(isAnyOf(processPostInvokeConfirm, processPreInvoke)), mergeMap17((action) => {
|
|
2209
2240
|
const { bcName, operationType, widgetName } = action.payload;
|
|
@@ -2213,7 +2244,7 @@ var processPostInvokeConfirmEpic = (action$, state$) => action$.pipe(filter29(is
|
|
|
2213
2244
|
case "info" /* info */:
|
|
2214
2245
|
case "error" /* error */:
|
|
2215
2246
|
case "confirmText" /* confirmText */: {
|
|
2216
|
-
return
|
|
2247
|
+
return of19(operationConfirmation({
|
|
2217
2248
|
operation: {
|
|
2218
2249
|
bcName,
|
|
2219
2250
|
operationType,
|
|
@@ -2223,7 +2254,7 @@ var processPostInvokeConfirmEpic = (action$, state$) => action$.pipe(filter29(is
|
|
|
2223
2254
|
}));
|
|
2224
2255
|
}
|
|
2225
2256
|
default:
|
|
2226
|
-
return
|
|
2257
|
+
return EMPTY16;
|
|
2227
2258
|
}
|
|
2228
2259
|
}));
|
|
2229
2260
|
// src/epics/session/switchRoleEpic.ts
|
|
@@ -2232,24 +2263,25 @@ var switchRoleEpic = (action$, state$) => action$.pipe(filter30(switchRole.match
|
|
|
2232
2263
|
return concat11([logoutDone(null), login({ login: "", password: "", role: action.payload.role })]);
|
|
2233
2264
|
}));
|
|
2234
2265
|
// src/epics/session/refreshMetaEpic.ts
|
|
2235
|
-
import { catchError as
|
|
2266
|
+
import { catchError as catchError6, concat as concat12, filter as filter31, mergeMap as mergeMap18, switchMap as switchMap8 } from "rxjs";
|
|
2236
2267
|
var refreshMetaEpic = (action$, state$, { api }) => action$.pipe(filter31(refreshMeta.match), mergeMap18(() => {
|
|
2237
2268
|
const state = state$.value;
|
|
2238
2269
|
const { router } = state;
|
|
2239
2270
|
const { activeRole } = state.session;
|
|
2240
2271
|
return api.refreshMeta().pipe(switchMap8(() => concat12([
|
|
2272
|
+
refreshMetaDone(),
|
|
2241
2273
|
logoutDone(null),
|
|
2242
2274
|
login({ login: "", password: "", role: activeRole }),
|
|
2243
2275
|
changeLocation({
|
|
2244
2276
|
location: router
|
|
2245
2277
|
})
|
|
2246
|
-
])),
|
|
2278
|
+
])), catchError6((error) => concat12([loginFail(error), refreshMetaFail(), createApiError(error)])));
|
|
2247
2279
|
}));
|
|
2248
2280
|
// src/epics/session/loginDoneEpic.ts
|
|
2249
|
-
import { EMPTY as
|
|
2250
|
-
var loginDoneSessionEpic = (action$, store) => action$.pipe(filter32(login.match), switchMap9((action) =>
|
|
2281
|
+
import { EMPTY as EMPTY17, filter as filter32, switchMap as switchMap9 } from "rxjs";
|
|
2282
|
+
var loginDoneSessionEpic = (action$, store) => action$.pipe(filter32(login.match), switchMap9((action) => EMPTY17));
|
|
2251
2283
|
// src/epics/session/loginByAnotherRoleEpic.ts
|
|
2252
|
-
import { catchError as
|
|
2284
|
+
import { catchError as catchError7, concat as concat13, filter as filter33, mergeMap as mergeMap19, of as of20, switchMap as switchMap10 } from "rxjs";
|
|
2253
2285
|
var responseStatusMessages = {
|
|
2254
2286
|
401: "Invalid credentials",
|
|
2255
2287
|
403: "Access denied"
|
|
@@ -2283,17 +2315,17 @@ var loginByAnotherRoleEpic = (action$, state$, { api }) => action$.pipe(filter33
|
|
|
2283
2315
|
login: data.login
|
|
2284
2316
|
})
|
|
2285
2317
|
]);
|
|
2286
|
-
}),
|
|
2318
|
+
}), catchError7((error) => {
|
|
2287
2319
|
console.error(error);
|
|
2288
2320
|
const errorMsg = error.response ? responseStatusMessages[error.response.status] || "Server application unavailable" : "Empty server response";
|
|
2289
|
-
return of20(loginFail({ errorMsg }));
|
|
2321
|
+
return concat13(of20(loginFail({ errorMsg })), createApiErrorObservable(error));
|
|
2290
2322
|
}));
|
|
2291
2323
|
}));
|
|
2292
2324
|
// src/epics/session/refreshMetaAndReloadPageEpic.ts
|
|
2293
|
-
import { concat as concat14, EMPTY as
|
|
2294
|
-
var refreshMetaAndReloadPageEpic = (action$, state$) => action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(() => concat14(of21(refreshMeta(
|
|
2325
|
+
import { concat as concat14, EMPTY as EMPTY18, filter as filter34, of as of21, switchMap as switchMap11, take, tap as tap3 } from "rxjs";
|
|
2326
|
+
var refreshMetaAndReloadPageEpic = (action$, state$) => action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(() => concat14(of21(refreshMeta()), action$.pipe(filter34(loginDone.match), take(1), tap3(() => location.reload()), switchMap11(() => EMPTY18)))));
|
|
2295
2327
|
// src/epics/data/bcNewDataEpic.ts
|
|
2296
|
-
import { catchError as
|
|
2328
|
+
import { catchError as catchError8, concat as concat15, EMPTY as EMPTY19, filter as filter35, mergeMap as mergeMap20, of as of22 } from "rxjs";
|
|
2297
2329
|
import { OperationTypeCrud as OperationTypeCrud8 } from "@cxbox-ui/schema";
|
|
2298
2330
|
var bcNewDataEpic = (action$, state$, { api }) => action$.pipe(filter35(sendOperation.match), filter35((action) => matchOperationRole(OperationTypeCrud8.create, action.payload, state$.value)), mergeMap20((action) => {
|
|
2299
2331
|
var _a;
|
|
@@ -2318,14 +2350,14 @@ var bcNewDataEpic = (action$, state$, { api }) => action$.pipe(filter35(sendOper
|
|
|
2318
2350
|
dataItem: {
|
|
2319
2351
|
id: cursor
|
|
2320
2352
|
}
|
|
2321
|
-
})), postInvoke ? of22(processPostInvoke({ bcName, postInvoke, cursor, widgetName: action.payload.widgetName })) :
|
|
2322
|
-
}),
|
|
2353
|
+
})), postInvoke ? of22(processPostInvoke({ bcName, postInvoke, cursor, widgetName: action.payload.widgetName })) : EMPTY19);
|
|
2354
|
+
}), catchError8((error) => {
|
|
2323
2355
|
console.error(error);
|
|
2324
|
-
return of22(bcNewDataFail({ bcName }));
|
|
2356
|
+
return concat15(of22(bcNewDataFail({ bcName })), createApiErrorObservable(error, context));
|
|
2325
2357
|
}));
|
|
2326
2358
|
}));
|
|
2327
2359
|
// src/epics/data/bcLoadMoreEpic.ts
|
|
2328
|
-
import { catchError as
|
|
2360
|
+
import { catchError as catchError9, concat as concat16, filter as filter37, mergeMap as mergeMap22, of as of24, race } from "rxjs";
|
|
2329
2361
|
// src/utils/cancelRequestEpic.ts
|
|
2330
2362
|
import { filter as filter36, mergeMap as mergeMap21, of as of23, take as take2 } from "rxjs";
|
|
2331
2363
|
import { isAnyOf as isAnyOf2 } from "@reduxjs/toolkit";
|
|
@@ -2366,14 +2398,14 @@ var bcLoadMoreEpic = (action$, state$, { api }) => action$.pipe(filter37(bcLoadM
|
|
|
2366
2398
|
bcUrl,
|
|
2367
2399
|
hasNext: data.hasNext
|
|
2368
2400
|
}));
|
|
2369
|
-
}),
|
|
2401
|
+
}), catchError9((error) => {
|
|
2370
2402
|
console.error(error);
|
|
2371
|
-
return of24(bcFetchDataFail({ bcName, bcUrl }));
|
|
2403
|
+
return concat16(of24(bcFetchDataFail({ bcName, bcUrl })), createApiErrorObservable(error));
|
|
2372
2404
|
}));
|
|
2373
2405
|
return race(cancelFlow, normalFlow);
|
|
2374
2406
|
}));
|
|
2375
2407
|
// src/epics/data/bcSaveDataEpic.ts
|
|
2376
|
-
import { catchError as
|
|
2408
|
+
import { catchError as catchError10, concat as concat17, EMPTY as EMPTY20, filter as filter38, mergeMap as mergeMap23, of as of25 } from "rxjs";
|
|
2377
2409
|
var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOperation.match), filter38((action) => matchOperationRole(OperationTypeCrud.save, action.payload, state$.value)), mergeMap23((action) => {
|
|
2378
2410
|
var _a, _b, _c, _d;
|
|
2379
2411
|
const state = state$.value;
|
|
@@ -2402,16 +2434,16 @@ var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOpe
|
|
|
2402
2434
|
var _a2;
|
|
2403
2435
|
const postInvoke = (_a2 = data.postActions) == null ? void 0 : _a2[0];
|
|
2404
2436
|
const responseDataItem = data.record;
|
|
2405
|
-
return
|
|
2437
|
+
return concat17(of25(bcSaveDataSuccess({ bcName, cursor, dataItem: responseDataItem })), of25(bcFetchRowMeta({ widgetName, bcName })), of25(...fetchChildrenBcData), postInvoke ? of25(processPostInvoke({
|
|
2406
2438
|
bcName,
|
|
2407
2439
|
widgetName,
|
|
2408
2440
|
postInvoke,
|
|
2409
2441
|
cursor: responseDataItem.id
|
|
2410
|
-
})) :
|
|
2411
|
-
}),
|
|
2442
|
+
})) : EMPTY20, action.payload.onSuccessAction ? of25(action.payload.onSuccessAction) : EMPTY20);
|
|
2443
|
+
}), catchError10((e) => {
|
|
2412
2444
|
var _a2, _b2, _c2, _d2, _e, _f, _g, _h;
|
|
2413
2445
|
console.error(e);
|
|
2414
|
-
let notification$ =
|
|
2446
|
+
let notification$ = EMPTY20;
|
|
2415
2447
|
if (action.payload.onSuccessAction && !(options == null ? void 0 : options.disableNotification)) {
|
|
2416
2448
|
notification$ = of25(addNotification({
|
|
2417
2449
|
key: "data_autosave_undo",
|
|
@@ -2433,11 +2465,11 @@ var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOpe
|
|
|
2433
2465
|
entityError = (_e = (_d2 = operationError == null ? void 0 : operationError.error) == null ? void 0 : _d2.entity) != null ? _e : entityError;
|
|
2434
2466
|
viewError = (_h = (_g = (_f = operationError == null ? void 0 : operationError.error) == null ? void 0 : _f.popup) == null ? void 0 : _g[0]) != null ? _h : viewError;
|
|
2435
2467
|
}
|
|
2436
|
-
return
|
|
2468
|
+
return concat17(of25(bcSaveDataFail({ bcName, bcUrl, viewError, entityError })), notification$, createApiErrorObservable(e, context));
|
|
2437
2469
|
}));
|
|
2438
2470
|
}));
|
|
2439
2471
|
// src/epics/data/selectViewEpic.ts
|
|
2440
|
-
import { EMPTY as
|
|
2472
|
+
import { EMPTY as EMPTY21, filter as filter39, mergeMap as mergeMap24 } from "rxjs";
|
|
2441
2473
|
var selectViewEpic = (action$, state$) => action$.pipe(filter39(selectView.match), mergeMap24((action) => {
|
|
2442
2474
|
try {
|
|
2443
2475
|
const state = state$.value;
|
|
@@ -2462,11 +2494,11 @@ var selectViewEpic = (action$, state$) => action$.pipe(filter39(selectView.match
|
|
|
2462
2494
|
}
|
|
2463
2495
|
catch (e) {
|
|
2464
2496
|
console.error(`selectView Epic:: ${e}`);
|
|
2465
|
-
return
|
|
2497
|
+
return EMPTY21;
|
|
2466
2498
|
}
|
|
2467
2499
|
}));
|
|
2468
2500
|
// src/epics/data/bcFetchDataEpic.ts
|
|
2469
|
-
import { catchError as
|
|
2501
|
+
import { catchError as catchError11, concat as concat18, EMPTY as EMPTY22, filter as filter40, mergeMap as mergeMap25, of as of26, race as race2 } from "rxjs";
|
|
2470
2502
|
import { WidgetTypes as WidgetTypes5 } from "@cxbox-ui/schema";
|
|
2471
2503
|
import { isAnyOf as isAnyOf3 } from "@reduxjs/toolkit";
|
|
2472
2504
|
var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyOf3(bcFetchDataRequest, bcFetchDataPages, showViewPopup, bcForceUpdate, bcChangePage)), mergeMap25((action) => {
|
|
@@ -2485,7 +2517,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2485
2517
|
const getChildrenData = (widgets, bcDictionary, isHierarchy, showConditionCheck) => {
|
|
2486
2518
|
const { bcName } = action.payload;
|
|
2487
2519
|
const { ignorePageLimit, keepDelta } = bcFetchDataRequest.match(action) ? action.payload : { ignorePageLimit: void 0, keepDelta: void 0 };
|
|
2488
|
-
return
|
|
2520
|
+
return concat18(...Object.entries(getBcChildren(bcName, widgets, bcDictionary)).filter(([childBcName, widgetNames]) => {
|
|
2489
2521
|
const nonLazyWidget = widgets.find((item) => {
|
|
2490
2522
|
return widgetNames.includes(item.name) && !PopupWidgetTypes.includes(item.type) && showConditionCheck(item);
|
|
2491
2523
|
});
|
|
@@ -2513,7 +2545,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2513
2545
|
const { widgets, infiniteWidgets } = state.view;
|
|
2514
2546
|
const widget = (_a = widgets == null ? void 0 : widgets.find((item) => item.name === widgetName)) != null ? _a : widgets == null ? void 0 : widgets.find((item) => item.bcName === action.payload.bcName);
|
|
2515
2547
|
if (!widget) {
|
|
2516
|
-
return [
|
|
2548
|
+
return [EMPTY22];
|
|
2517
2549
|
}
|
|
2518
2550
|
const bcName = action.payload.bcName;
|
|
2519
2551
|
const bc = state.screen.bo.bc[bcName];
|
|
@@ -2521,7 +2553,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2521
2553
|
const limit = (_c = ((_b = widgets == null ? void 0 : widgets.find((i) => i.bcName === bcName)) == null ? void 0 : _b.limit) || bc.limit) != null ? _c : 5;
|
|
2522
2554
|
const sorters = state.screen.sorters[bcName];
|
|
2523
2555
|
if (showViewPopup.match(action) && bcName === action.payload.calleeBCName) {
|
|
2524
|
-
return [
|
|
2556
|
+
return [EMPTY22];
|
|
2525
2557
|
}
|
|
2526
2558
|
const anyHierarchyWidget = widgets == null ? void 0 : widgets.find((item) => {
|
|
2527
2559
|
return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && isHierarchyWidget(item);
|
|
@@ -2582,19 +2614,19 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2582
2614
|
const lazyWidget = (!isWidgetVisible(widget) || PopupWidgetTypes.includes(widget.type)) && !parentOfNotLazyWidget;
|
|
2583
2615
|
const skipLazy = ((_a2 = state.view.popupData) == null ? void 0 : _a2.bcName) !== widget.bcName;
|
|
2584
2616
|
if (lazyWidget && skipLazy) {
|
|
2585
|
-
return
|
|
2617
|
+
return EMPTY22;
|
|
2586
2618
|
}
|
|
2587
|
-
const fetchChildren = ((_b2 = response.data) == null ? void 0 : _b2.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) :
|
|
2619
|
+
const fetchChildren = ((_b2 = response.data) == null ? void 0 : _b2.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) : EMPTY22;
|
|
2588
2620
|
const fetchRowMeta = of26(bcFetchRowMeta({ widgetName, bcName }));
|
|
2589
|
-
return
|
|
2621
|
+
return concat18(cursorChange, of26(bcFetchDataSuccess({
|
|
2590
2622
|
bcName,
|
|
2591
2623
|
data: response.data,
|
|
2592
2624
|
bcUrl,
|
|
2593
2625
|
hasNext: response.hasNext
|
|
2594
2626
|
})), fetchRowMeta, fetchChildren);
|
|
2595
|
-
}),
|
|
2627
|
+
}), catchError11((error) => {
|
|
2596
2628
|
console.error(error);
|
|
2597
|
-
return of26(bcFetchDataFail({ bcName: action.payload.bcName, bcUrl }));
|
|
2629
|
+
return concat18(of26(bcFetchDataFail({ bcName: action.payload.bcName, bcUrl })), createApiErrorObservable(error));
|
|
2598
2630
|
}));
|
|
2599
2631
|
return [cancelFlow, cancelByParentBc, normalFlow];
|
|
2600
2632
|
};
|
|
@@ -2605,7 +2637,7 @@ function isHierarchyWidget(widget) {
|
|
|
2605
2637
|
return ((_a = widget.options) == null ? void 0 : _a.hierarchy) || ((_b = widget.options) == null ? void 0 : _b.hierarchyFull);
|
|
2606
2638
|
}
|
|
2607
2639
|
// src/epics/data/bcDeleteDataEpic.ts
|
|
2608
|
-
import { catchError as
|
|
2640
|
+
import { catchError as catchError12, concat as concat19, EMPTY as EMPTY23, filter as filter41, mergeMap as mergeMap26, of as of27 } from "rxjs";
|
|
2609
2641
|
import { OperationTypeCrud as OperationTypeCrud9 } from "@cxbox-ui/schema";
|
|
2610
2642
|
var bcDeleteDataEpic = (action$, store$, { api }) => action$.pipe(filter41(sendOperation.match), filter41((action) => matchOperationRole(OperationTypeCrud9.delete, action.payload, store$.value)), mergeMap26((action) => {
|
|
2611
2643
|
const widgetName = action.payload.widgetName;
|
|
@@ -2618,14 +2650,14 @@ var bcDeleteDataEpic = (action$, store$, { api }) => action$.pipe(filter41(sendO
|
|
|
2618
2650
|
return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe(mergeMap26((data) => {
|
|
2619
2651
|
var _a;
|
|
2620
2652
|
const postInvoke = (_a = data.postActions) == null ? void 0 : _a[0];
|
|
2621
|
-
return
|
|
2622
|
-
}),
|
|
2653
|
+
return concat19(isTargetFormatPVF ? of27(bcCancelPendingChanges({ bcNames: [bcName] })) : EMPTY23, of27(bcFetchDataRequest({ bcName, widgetName })), postInvoke ? of27(processPostInvoke({ bcName, postInvoke, cursor, widgetName })) : EMPTY23);
|
|
2654
|
+
}), catchError12((error) => {
|
|
2623
2655
|
console.error(error);
|
|
2624
|
-
return of27(bcDeleteDataFail({ bcName }));
|
|
2656
|
+
return concat19(of27(bcDeleteDataFail({ bcName })), createApiErrorObservable(error, context));
|
|
2625
2657
|
}));
|
|
2626
2658
|
}));
|
|
2627
2659
|
// src/epics/data/bcSelectRecordEpic.ts
|
|
2628
|
-
import { concat as
|
|
2660
|
+
import { concat as concat20, filter as filter42, mergeMap as mergeMap27, of as of28 } from "rxjs";
|
|
2629
2661
|
var bcSelectRecordEpic = (action$, store$) => action$.pipe(filter42(bcSelectRecord.match), mergeMap27((action) => {
|
|
2630
2662
|
const { bcName, cursor } = action.payload;
|
|
2631
2663
|
const widgets = store$.value.view.widgets;
|
|
@@ -2639,10 +2671,10 @@ var bcSelectRecordEpic = (action$, store$) => action$.pipe(filter42(bcSelectReco
|
|
|
2639
2671
|
keepDelta: action.payload.keepDelta
|
|
2640
2672
|
});
|
|
2641
2673
|
});
|
|
2642
|
-
return
|
|
2674
|
+
return concat20(of28(bcChangeCursors({ cursorsMap: { [bcName]: cursor }, keepDelta: action.payload.keepDelta })), of28(bcFetchRowMeta({ widgetName: "", bcName })), fetchChildrenBcData);
|
|
2643
2675
|
}));
|
|
2644
2676
|
// src/epics/data/changeAssociationEpic.ts
|
|
2645
|
-
import { concat as
|
|
2677
|
+
import { concat as concat21, filter as filter43, mergeMap as mergeMap28, of as of29 } from "rxjs";
|
|
2646
2678
|
var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAssociation.match), mergeMap28((action) => {
|
|
2647
2679
|
var _a, _b, _c, _d, _e;
|
|
2648
2680
|
const state = state$.value;
|
|
@@ -2712,10 +2744,10 @@ var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAss
|
|
|
2712
2744
|
})));
|
|
2713
2745
|
}
|
|
2714
2746
|
}
|
|
2715
|
-
return
|
|
2747
|
+
return concat21(...result);
|
|
2716
2748
|
}));
|
|
2717
2749
|
// src/epics/data/bcCancelCreateDataEpic.ts
|
|
2718
|
-
import { catchError as
|
|
2750
|
+
import { catchError as catchError13, concat as concat22, EMPTY as EMPTY24, filter as filter44, mergeMap as mergeMap29, of as of30 } from "rxjs";
|
|
2719
2751
|
import { OperationTypeCrud as OperationTypeCrud10 } from "@cxbox-ui/schema";
|
|
2720
2752
|
import { isAnyOf as isAnyOf4 } from "@reduxjs/toolkit";
|
|
2721
2753
|
var actionTypesMatcher = isAnyOf4(sendOperation);
|
|
@@ -2736,17 +2768,17 @@ var bcCancelCreateDataEpic = (action$, state$, { api }) => action$.pipe(filter44
|
|
|
2736
2768
|
return api.customAction(screenName, bcUrl, data, context, params).pipe(mergeMap29((response) => {
|
|
2737
2769
|
var _a2;
|
|
2738
2770
|
const postInvoke = (_a2 = response.postActions) == null ? void 0 : _a2[0];
|
|
2739
|
-
return
|
|
2740
|
-
}),
|
|
2771
|
+
return concat22(of30(sendOperationSuccess({ bcName, cursor })), of30(bcChangeCursors({ cursorsMap })), postInvoke ? of30(processPostInvoke({ bcName, postInvoke, cursor, widgetName: context.widgetName })) : EMPTY24);
|
|
2772
|
+
}), catchError13((error) => {
|
|
2741
2773
|
console.error(error);
|
|
2742
|
-
return of30(bcDeleteDataFail({ bcName }));
|
|
2774
|
+
return concat22(of30(bcDeleteDataFail({ bcName })), createApiErrorObservable(error, context));
|
|
2743
2775
|
}));
|
|
2744
2776
|
}));
|
|
2745
2777
|
// src/epics/data/bcSelectDepthRecordEpic.ts
|
|
2746
|
-
import { concat as
|
|
2778
|
+
import { concat as concat23, filter as filter45, mergeMap as mergeMap30, of as of31 } from "rxjs";
|
|
2747
2779
|
var bcSelectDepthRecordEpic = (action$) => action$.pipe(filter45(bcSelectDepthRecord.match), mergeMap30((action) => {
|
|
2748
2780
|
const { bcName, cursor, depth } = action.payload;
|
|
2749
|
-
return
|
|
2781
|
+
return concat23(of31(bcChangeDepthCursor({ bcName, depth, cursor })), of31(bcFetchDataRequest({
|
|
2750
2782
|
bcName,
|
|
2751
2783
|
depth: depth + 1,
|
|
2752
2784
|
widgetName: "",
|
|
@@ -2754,7 +2786,7 @@ var bcSelectDepthRecordEpic = (action$) => action$.pipe(filter45(bcSelectDepthRe
|
|
|
2754
2786
|
})));
|
|
2755
2787
|
}));
|
|
2756
2788
|
// src/epics/data/removeMultivalueTagEpic.ts
|
|
2757
|
-
import { concat as
|
|
2789
|
+
import { concat as concat24, filter as filter46, mergeMap as mergeMap31, of as of32 } from "rxjs";
|
|
2758
2790
|
var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeMultivalueTag.match), mergeMap31((action) => {
|
|
2759
2791
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2760
2792
|
const state = state$.value;
|
|
@@ -2790,7 +2822,7 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2790
2822
|
return removedNodes.includes(descendant) || !associated.includes(descendant);
|
|
2791
2823
|
});
|
|
2792
2824
|
if (parentDeepEmpty) {
|
|
2793
|
-
return
|
|
2825
|
+
return concat24(of32(removeMultivalueTag(__spreadProps(__spreadValues({}, action.payload), {
|
|
2794
2826
|
removedItem: { id: parent.id, value: null }
|
|
2795
2827
|
}))));
|
|
2796
2828
|
}
|
|
@@ -2813,7 +2845,7 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2813
2845
|
var _a2;
|
|
2814
2846
|
return (_a2 = state.view.pendingDataChanges[hierarchyData.bcName]) == null ? void 0 : _a2[action.payload.removedItem.id];
|
|
2815
2847
|
})) == null ? void 0 : _i.bcName) != null ? _j : bcName;
|
|
2816
|
-
return
|
|
2848
|
+
return concat24(of32(changeDataItem({
|
|
2817
2849
|
/**
|
|
2818
2850
|
* This is incorrect and will break if different BC has records with
|
|
2819
2851
|
* identical ids.
|
|
@@ -2831,7 +2863,7 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2831
2863
|
dataItem: { [associateFieldKey]: action.payload.dataItem }
|
|
2832
2864
|
})));
|
|
2833
2865
|
}
|
|
2834
|
-
return
|
|
2866
|
+
return concat24(of32(changeDataItem({
|
|
2835
2867
|
bcName: popupBcName,
|
|
2836
2868
|
bcUrl: buildBcUrl(popupBcName, true, state),
|
|
2837
2869
|
cursor: action.payload.removedItem.id,
|
|
@@ -2844,7 +2876,7 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2844
2876
|
})));
|
|
2845
2877
|
}));
|
|
2846
2878
|
// src/epics/data/bcFetchRowMetaRequestEpic.ts
|
|
2847
|
-
import { catchError as
|
|
2879
|
+
import { catchError as catchError14, concat as concat25, filter as filter47, map as map9, mergeMap as mergeMap32, of as of33, race as race3 } from "rxjs";
|
|
2848
2880
|
var bcFetchRowMetaRequestEpic = (action$, state$, { api }) => action$.pipe(filter47(bcFetchRowMeta.match), mergeMap32((action) => {
|
|
2849
2881
|
var _a, _b;
|
|
2850
2882
|
const state = state$.value;
|
|
@@ -2860,14 +2892,14 @@ var bcFetchRowMetaRequestEpic = (action$, state$, { api }) => action$.pipe(filte
|
|
|
2860
2892
|
});
|
|
2861
2893
|
const normalFlow = api.fetchRowMeta(screenName, bcUrl, void 0, canceler.cancelToken).pipe(map9((rowMeta) => {
|
|
2862
2894
|
return bcFetchRowMetaSuccess({ bcName, rowMeta, bcUrl, cursor });
|
|
2863
|
-
}),
|
|
2895
|
+
}), catchError14((error) => {
|
|
2864
2896
|
console.error(error);
|
|
2865
|
-
return of33(bcFetchRowMetaFail({ bcName }));
|
|
2897
|
+
return concat25(of33(bcFetchRowMetaFail({ bcName })), createApiErrorObservable(error));
|
|
2866
2898
|
}));
|
|
2867
2899
|
return race3(cancelFlow, cancelByParentBc, normalFlow);
|
|
2868
2900
|
}));
|
|
2869
2901
|
// src/epics/data/changeAssociationFullEpic.ts
|
|
2870
|
-
import { concat as
|
|
2902
|
+
import { concat as concat26, filter as filter48, mergeMap as mergeMap33, of as of34 } from "rxjs";
|
|
2871
2903
|
var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(changeAssociationFull.match), mergeMap33((action) => {
|
|
2872
2904
|
var _a, _b, _c, _d, _e;
|
|
2873
2905
|
const state = state$.value;
|
|
@@ -2951,10 +2983,10 @@ var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(chang
|
|
|
2951
2983
|
})));
|
|
2952
2984
|
}
|
|
2953
2985
|
}
|
|
2954
|
-
return
|
|
2986
|
+
return concat26(...result);
|
|
2955
2987
|
}));
|
|
2956
2988
|
// src/epics/data/saveAssociationsActiveEpic.ts
|
|
2957
|
-
import { catchError as
|
|
2989
|
+
import { catchError as catchError15, concat as concat27, EMPTY as EMPTY25, filter as filter49, mergeMap as mergeMap34, of as of35, switchMap as switchMap12 } from "rxjs";
|
|
2958
2990
|
var saveAssociationsActiveEpic = (action$, state$, { api }) => action$.pipe(filter49(saveAssociations.match), filter49((action) => {
|
|
2959
2991
|
var _a;
|
|
2960
2992
|
return (_a = state$.value.view.popupData) == null ? void 0 : _a.active;
|
|
@@ -2970,14 +3002,14 @@ var saveAssociationsActiveEpic = (action$, state$, { api }) => action$.pipe(filt
|
|
|
2970
3002
|
return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter((i) => i._associate), params).pipe(mergeMap34((response) => {
|
|
2971
3003
|
const postInvoke = response.postActions[0];
|
|
2972
3004
|
const calleeWidget = state.view.widgets.find((widgetItem) => widgetItem.bcName === calleeBCName);
|
|
2973
|
-
return
|
|
2974
|
-
}),
|
|
3005
|
+
return concat27(postInvoke ? of35(processPostInvoke({ bcName: calleeBCName, postInvoke, widgetName: calleeWidget == null ? void 0 : calleeWidget.name })) : EMPTY25, of35(bcCancelPendingChanges({ bcNames })), of35(bcForceUpdate({ bcName: calleeBCName, widgetName: calleeWidgetName })));
|
|
3006
|
+
}), catchError15((err) => {
|
|
2975
3007
|
console.error(err);
|
|
2976
|
-
return
|
|
3008
|
+
return EMPTY25;
|
|
2977
3009
|
}));
|
|
2978
3010
|
}));
|
|
2979
3011
|
// src/epics/data/changeAssociationSameBcEpic.ts
|
|
2980
|
-
import { concat as
|
|
3012
|
+
import { concat as concat28, filter as filter50, mergeMap as mergeMap35, of as of36 } from "rxjs";
|
|
2981
3013
|
var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(changeAssociationSameBc.match), mergeMap35((action) => {
|
|
2982
3014
|
var _a, _b, _c, _d, _e, _f;
|
|
2983
3015
|
const state = state$.value;
|
|
@@ -3022,10 +3054,10 @@ var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(cha
|
|
|
3022
3054
|
})));
|
|
3023
3055
|
}
|
|
3024
3056
|
}
|
|
3025
|
-
return
|
|
3057
|
+
return concat28(...result);
|
|
3026
3058
|
}));
|
|
3027
3059
|
// src/epics/data/inlinePickListFetchDataEpic.ts
|
|
3028
|
-
import { catchError as
|
|
3060
|
+
import { catchError as catchError16, filter as filter51, mergeMap as mergeMap36, of as of37, race as race4 } from "rxjs";
|
|
3029
3061
|
var inlinePickListFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter51(inlinePickListFetchDataRequest.match), mergeMap36((action) => {
|
|
3030
3062
|
const { bcName, searchSpec, searchString } = action.payload;
|
|
3031
3063
|
const state = state$.value;
|
|
@@ -3034,7 +3066,7 @@ var inlinePickListFetchDataEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
3034
3066
|
const cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName, bcUrl }));
|
|
3035
3067
|
const normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, { [searchSpec + ".contains"]: searchString }, canceler.cancelToken).pipe(mergeMap36((data) => {
|
|
3036
3068
|
return of37(bcFetchDataSuccess({ bcName, data: data.data, bcUrl }));
|
|
3037
|
-
}),
|
|
3069
|
+
}), catchError16((error) => {
|
|
3038
3070
|
console.error(error);
|
|
3039
3071
|
return of37(bcFetchDataFail({ bcName: action.payload.bcName, bcUrl }));
|
|
3040
3072
|
}));
|
|
@@ -3112,7 +3144,7 @@ var changeChildrenAssociationsSameBcEpic = (action$, state$) => action$.pipe(fil
|
|
|
3112
3144
|
}));
|
|
3113
3145
|
}));
|
|
3114
3146
|
// src/epics/data/changeDescendantsAssociationsFullEpic.ts
|
|
3115
|
-
import { concat as
|
|
3147
|
+
import { concat as concat29, filter as filter55, mergeMap as mergeMap39, of as of41 } from "rxjs";
|
|
3116
3148
|
var changeDescendantsAssociationsFullEpic = (action$, state$) => action$.pipe(filter55(changeDescendantsAssociationsFull.match), mergeMap39((action) => {
|
|
3117
3149
|
const state = state$.value;
|
|
3118
3150
|
const depth = action.payload.depth;
|
|
@@ -3136,7 +3168,7 @@ var changeDescendantsAssociationsFullEpic = (action$, state$) => action$.pipe(fi
|
|
|
3136
3168
|
}))));
|
|
3137
3169
|
}
|
|
3138
3170
|
});
|
|
3139
|
-
return
|
|
3171
|
+
return concat29(...result);
|
|
3140
3172
|
}));
|
|
3141
3173
|
// src/api/ObservableApiWrapper.ts
|
|
3142
3174
|
import axios2 from "axios";
|
|
@@ -3179,7 +3211,7 @@ var ObservableApiWrapper = class {
|
|
|
3179
3211
|
};
|
|
3180
3212
|
// src/api/ObservableApi.ts
|
|
3181
3213
|
import axios3 from "axios";
|
|
3182
|
-
import { EMPTY as
|
|
3214
|
+
import { EMPTY as EMPTY26, expand, map as map11, reduce } from "rxjs";
|
|
3183
3215
|
var Api = class {
|
|
3184
3216
|
constructor(instance) {
|
|
3185
3217
|
__publicField(this, "api$");
|
|
@@ -3200,7 +3232,7 @@ var Api = class {
|
|
|
3200
3232
|
fetchBcDataAll(screenName, bcUrl, params = {}) {
|
|
3201
3233
|
let currentPage = 1;
|
|
3202
3234
|
return this.fetchBcData(screenName, bcUrl, __spreadProps(__spreadValues({}, params), { _page: currentPage })).pipe(expand((response) => {
|
|
3203
|
-
return response.hasNext ? this.fetchBcData(screenName, bcUrl, __spreadProps(__spreadValues({}, params), { _page: ++currentPage })) :
|
|
3235
|
+
return response.hasNext ? this.fetchBcData(screenName, bcUrl, __spreadProps(__spreadValues({}, params), { _page: ++currentPage })) : EMPTY26;
|
|
3204
3236
|
}), reduce((items, nextResponse) => {
|
|
3205
3237
|
return [...items, ...nextResponse.data];
|
|
3206
3238
|
}, []));
|
|
@@ -3416,13 +3448,13 @@ var requiredFields = ({ getState, dispatch }) => (next) => (action) => {
|
|
|
3416
3448
|
}
|
|
3417
3449
|
return next(action);
|
|
3418
3450
|
};
|
|
3419
|
-
function operationRequiresAutosave(operationType,
|
|
3451
|
+
function operationRequiresAutosave(operationType, actions2) {
|
|
3420
3452
|
let result = false;
|
|
3421
|
-
if (!
|
|
3453
|
+
if (!actions2) {
|
|
3422
3454
|
console.error('rowMeta is missing in the middle of "sendOperation" action');
|
|
3423
3455
|
return result;
|
|
3424
3456
|
}
|
|
3425
|
-
result = flattenOperations(
|
|
3457
|
+
result = flattenOperations(actions2).some((action) => action.type === operationType && action.autoSaveBefore);
|
|
3426
3458
|
return result;
|
|
3427
3459
|
}
|
|
3428
3460
|
function getRequiredFieldsMissing(record, pendingChanges, fieldsMeta) {
|
|
@@ -3476,8 +3508,8 @@ var preInvokeAction = ({ getState }) => (next) => (action) => {
|
|
|
3476
3508
|
const bcName = (_a = state.view.widgets.find((widgetItem) => widgetItem.name === widgetName)) == null ? void 0 : _a.bcName;
|
|
3477
3509
|
const bcUrl = buildBcUrl(bcName, true, state);
|
|
3478
3510
|
const rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) == null ? void 0 : _b[bcUrl]);
|
|
3479
|
-
const
|
|
3480
|
-
const preInvoke = (_c =
|
|
3511
|
+
const actions2 = rowMeta && flattenOperations(rowMeta.actions);
|
|
3512
|
+
const preInvoke = (_c = actions2 == null ? void 0 : actions2.find((item) => item.type === operationType)) == null ? void 0 : _c.preInvoke;
|
|
3481
3513
|
return preInvoke && !confirm ? next(processPreInvoke({
|
|
3482
3514
|
bcName,
|
|
3483
3515
|
operationType,
|