@cxbox-ui/core 1.37.2-alpha.7 → 1.37.2-alpha.8
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 +3 -17
- package/dist/api/ObservableApi.d.ts +10 -2
- package/dist/api/ObservableApiWrapper.d.ts +1 -1
- package/dist/cxbox-ui-core.cjs.development.js +331 -154
- package/dist/cxbox-ui-core.cjs.production.min.js +1 -1
- package/dist/cxbox-ui-core.esm.js +385 -208
- package/dist/cxbox-ui-core.modern.development.js +378 -207
- package/dist/cxbox-ui-core.modern.js +378 -207
- package/dist/cxbox-ui-core.modern.production.min.js +1 -1
- package/dist/interfaces/bc.d.ts +5 -4
- package/dist/middlewares/index.d.ts +1 -0
- package/dist/middlewares/popupMiddleware.d.ts +5 -0
- package/dist/utils/api.d.ts +1 -10
- package/dist/utils/bc.d.ts +1 -1
- package/dist/utils/cancelRequestEpic.d.ts +1 -1
- package/dist/utils/filters.d.ts +2 -2
- package/dist/utils/strings.d.ts +1 -1
- package/package.json +1 -1
|
@@ -509,6 +509,15 @@ function isViewNavigationCategory(item) {
|
|
|
509
509
|
function isViewNavigationGroup(item) {
|
|
510
510
|
return !!item && "child" in item && !("categoryName" in item);
|
|
511
511
|
}
|
|
512
|
+
// src/reducers/router.ts
|
|
513
|
+
var initialRouterState = { type: "default" /* default */, path: "/", params: null, screenName: null };
|
|
514
|
+
var createRouterReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(loginDone, function (state, action) {
|
|
515
|
+
state = __assign(__assign({}, state), action.payload);
|
|
516
|
+
}).addCase(changeLocation, function (state, action) {
|
|
517
|
+
state = __assign(__assign({}, state), action.payload.location);
|
|
518
|
+
}); };
|
|
519
|
+
// src/reducers/screen.ts
|
|
520
|
+
var import_schema6 = require("@cxbox-ui/schema");
|
|
512
521
|
// src/utils/index.ts
|
|
513
522
|
var utils_exports = {};
|
|
514
523
|
__export(utils_exports, {
|
|
@@ -529,7 +538,6 @@ __export(utils_exports, {
|
|
|
529
538
|
getBcChildren: function () { return getBcChildren; },
|
|
530
539
|
getDescendants: function () { return getDescendants; },
|
|
531
540
|
getFieldTitle: function () { return getFieldTitle; },
|
|
532
|
-
getFileUploadEndpoint: function () { return getFileUploadEndpoint; },
|
|
533
541
|
getFilterType: function () { return getFilterType; },
|
|
534
542
|
getFilters: function () { return getFilters; },
|
|
535
543
|
getSorters: function () { return getSorters; },
|
|
@@ -569,12 +577,6 @@ function applyRawParams(url, qso) {
|
|
|
569
577
|
var result = new URLSearchParams(qso).toString();
|
|
570
578
|
return "".concat(addTailControlSequences(url)).concat(result && "".concat(result));
|
|
571
579
|
}
|
|
572
|
-
function getFileUploadEndpoint(instance) {
|
|
573
|
-
if (!instance.defaults.baseURL) {
|
|
574
|
-
return "/file";
|
|
575
|
-
}
|
|
576
|
-
return instance.defaults.baseURL.endsWith("/") ? "".concat(instance.defaults.baseURL, "file") : "".concat(instance.defaults.baseURL, "/file");
|
|
577
|
-
}
|
|
578
580
|
// src/utils/strings.ts
|
|
579
581
|
function getTemplate(literals) {
|
|
580
582
|
var placeholders = [];
|
|
@@ -724,7 +726,7 @@ function defaultParseURL(url) {
|
|
|
724
726
|
}
|
|
725
727
|
return {
|
|
726
728
|
type: type,
|
|
727
|
-
path: path,
|
|
729
|
+
path: path.length !== 0 && !path.startsWith("/") ? "/".concat(path) : path,
|
|
728
730
|
params: params,
|
|
729
731
|
screenName: screenName,
|
|
730
732
|
viewName: viewName,
|
|
@@ -772,6 +774,7 @@ function getSorters(sorters) {
|
|
|
772
774
|
return result;
|
|
773
775
|
}
|
|
774
776
|
function parseFilters(defaultFilters) {
|
|
777
|
+
if (defaultFilters === void 0) { defaultFilters = ""; }
|
|
775
778
|
var result = [];
|
|
776
779
|
var urlParams = new URL(defaultFilters, window.location.origin).searchParams;
|
|
777
780
|
urlParams.forEach(function (param) {
|
|
@@ -882,12 +885,13 @@ function getBcChildren(originBcName, widgets, bcMap) {
|
|
|
882
885
|
return childrenBcMap;
|
|
883
886
|
}
|
|
884
887
|
function getHierarchyChildBc(originBcName, hierarchyWidget) {
|
|
885
|
-
var
|
|
886
|
-
|
|
888
|
+
var _a, _b;
|
|
889
|
+
var nestedBcNames = (_b = (_a = hierarchyWidget === null || hierarchyWidget === void 0 ? void 0 : hierarchyWidget.options) === null || _a === void 0 ? void 0 : _a.hierarchy) === null || _b === void 0 ? void 0 : _b.map(function (nestedItem) { return nestedItem.bcName; });
|
|
890
|
+
if (originBcName !== hierarchyWidget.bcName && !(nestedBcNames === null || nestedBcNames === void 0 ? void 0 : nestedBcNames.includes(originBcName))) {
|
|
887
891
|
return [];
|
|
888
892
|
}
|
|
889
|
-
var childHierarchyBcIndex = nestedBcNames.findIndex(function (item) { return item === originBcName; });
|
|
890
|
-
var childHierarchyBcName = nestedBcNames[childHierarchyBcIndex + 1];
|
|
893
|
+
var childHierarchyBcIndex = nestedBcNames === null || nestedBcNames === void 0 ? void 0 : nestedBcNames.findIndex(function (item) { return item === originBcName; });
|
|
894
|
+
var childHierarchyBcName = nestedBcNames === null || nestedBcNames === void 0 ? void 0 : nestedBcNames[childHierarchyBcIndex + 1];
|
|
891
895
|
return [childHierarchyBcName, hierarchyWidget.name];
|
|
892
896
|
}
|
|
893
897
|
function checkShowCondition(condition, cursor, data, pendingDataChanges) {
|
|
@@ -901,9 +905,9 @@ function checkShowCondition(condition, cursor, data, pendingDataChanges) {
|
|
|
901
905
|
if (!record) {
|
|
902
906
|
return false;
|
|
903
907
|
}
|
|
904
|
-
var actualValue = record === null || record === void 0 ? void 0 : record[params.fieldKey];
|
|
905
|
-
var pendingValue = (_b = (_a = pendingDataChanges === null || pendingDataChanges === void 0 ? void 0 : pendingDataChanges[bcName]) === null || _a === void 0 ? void 0 : _a[cursor]) === null || _b === void 0 ? void 0 : _b[params.fieldKey];
|
|
906
|
-
return pendingValue !== void 0 ? pendingValue === params.value : actualValue === params.value;
|
|
908
|
+
var actualValue = record === null || record === void 0 ? void 0 : record[params === null || params === void 0 ? void 0 : params.fieldKey];
|
|
909
|
+
var pendingValue = (_b = (_a = pendingDataChanges === null || pendingDataChanges === void 0 ? void 0 : pendingDataChanges[bcName]) === null || _a === void 0 ? void 0 : _a[cursor]) === null || _b === void 0 ? void 0 : _b[params === null || params === void 0 ? void 0 : params.fieldKey];
|
|
910
|
+
return pendingValue !== void 0 ? pendingValue === (params === null || params === void 0 ? void 0 : params.value) : actualValue === (params === null || params === void 0 ? void 0 : params.value);
|
|
907
911
|
}
|
|
908
912
|
// src/utils/tree.ts
|
|
909
913
|
function assignTreeLinks(flat) {
|
|
@@ -911,6 +915,7 @@ function assignTreeLinks(flat) {
|
|
|
911
915
|
var map12 = {};
|
|
912
916
|
var orphans = [];
|
|
913
917
|
result.forEach(function (item) {
|
|
918
|
+
var _a, _b;
|
|
914
919
|
if (!item.parentId || item.parentId === "0") {
|
|
915
920
|
return;
|
|
916
921
|
}
|
|
@@ -929,7 +934,7 @@ function assignTreeLinks(flat) {
|
|
|
929
934
|
result[parentIndex].children = [item];
|
|
930
935
|
}
|
|
931
936
|
else {
|
|
932
|
-
result[parentIndex].children.push(item);
|
|
937
|
+
(_b = (_a = result[parentIndex]) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.push(item);
|
|
933
938
|
}
|
|
934
939
|
});
|
|
935
940
|
if (orphans.length) {
|
|
@@ -1007,22 +1012,7 @@ function deleteUndefinedFromObject(obj) {
|
|
|
1007
1012
|
}
|
|
1008
1013
|
});
|
|
1009
1014
|
}
|
|
1010
|
-
// src/reducers/router.ts
|
|
1011
|
-
var initialRouterState = { type: "default" /* default */, path: "/", params: null, screenName: null };
|
|
1012
|
-
var createRouterReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(loginDone, function (state, action) {
|
|
1013
|
-
state = __assign(__assign({}, state), action.payload);
|
|
1014
|
-
}).addCase(changeLocation, function (state, action) {
|
|
1015
|
-
var _a = action.payload, url = _a.url, route = _a.route;
|
|
1016
|
-
if (url) {
|
|
1017
|
-
var path = new URL(url);
|
|
1018
|
-
state = __assign(__assign({}, state), defaultParseURL(path));
|
|
1019
|
-
}
|
|
1020
|
-
if (route !== null) {
|
|
1021
|
-
state = __assign(__assign({}, state), route);
|
|
1022
|
-
}
|
|
1023
|
-
}); };
|
|
1024
1015
|
// src/reducers/screen.ts
|
|
1025
|
-
var import_schema6 = require("@cxbox-ui/schema");
|
|
1026
1016
|
var initialScreenState = {
|
|
1027
1017
|
screenName: "",
|
|
1028
1018
|
bo: { activeBcName: "", bc: {} },
|
|
@@ -1034,10 +1024,11 @@ var initialScreenState = {
|
|
|
1034
1024
|
};
|
|
1035
1025
|
var operationsHandledLocally = [import_schema6.OperationTypeCrud.associate, import_schema6.OperationTypeCrud.fileUpload];
|
|
1036
1026
|
var createScreenReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(selectScreen, function (state, action) {
|
|
1027
|
+
var _a, _b, _c, _d, _e;
|
|
1037
1028
|
var bcDictionary = {};
|
|
1038
1029
|
var bcSorters = {};
|
|
1039
1030
|
var bcFilters = {};
|
|
1040
|
-
action.payload.screen.meta.bo.bc.forEach(function (item) {
|
|
1031
|
+
(_a = action.payload.screen.meta) === null || _a === void 0 ? void 0 : _a.bo.bc.forEach(function (item) {
|
|
1041
1032
|
bcDictionary[item.name] = item;
|
|
1042
1033
|
var sorter = parseSorters(item.defaultSort);
|
|
1043
1034
|
var filter56 = parseFilters(item.defaultFilter);
|
|
@@ -1049,8 +1040,8 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1049
1040
|
}
|
|
1050
1041
|
});
|
|
1051
1042
|
state.screenName = action.payload.screen.name;
|
|
1052
|
-
state.primaryView = action.payload.screen.meta.primary;
|
|
1053
|
-
state.views = action.payload.screen.meta.views;
|
|
1043
|
+
state.primaryView = (_c = (_b = action.payload.screen.meta) === null || _b === void 0 ? void 0 : _b.primary) !== null && _c !== void 0 ? _c : state.primaryView;
|
|
1044
|
+
state.views = (_e = (_d = action.payload.screen.meta) === null || _d === void 0 ? void 0 : _d.views) !== null && _e !== void 0 ? _e : state.views;
|
|
1054
1045
|
state.bo = { activeBcName: null, bc: bcDictionary };
|
|
1055
1046
|
state.sorters = __assign(__assign({}, state.sorters), bcSorters);
|
|
1056
1047
|
state.filters = __assign(__assign({}, state.filters), bcFilters);
|
|
@@ -1060,12 +1051,14 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1060
1051
|
}).addCase(bcFetchDataRequest, function (state, action) {
|
|
1061
1052
|
state.bo.bc[action.payload.bcName].loading = true;
|
|
1062
1053
|
}).addCase(bcLoadMore, function (state, action) {
|
|
1054
|
+
var _a;
|
|
1063
1055
|
var currentBc = state.bo.bc[action.payload.bcName];
|
|
1064
|
-
currentBc.page
|
|
1056
|
+
currentBc.page = ((_a = currentBc.page) !== null && _a !== void 0 ? _a : 1) + 1;
|
|
1065
1057
|
currentBc.loading = true;
|
|
1066
1058
|
}).addCase(selectView, function (state, action) {
|
|
1059
|
+
var _a;
|
|
1067
1060
|
var newBcs = {};
|
|
1068
|
-
Array.from(new Set(action.payload.widgets.map(function (widget) { return widget.bcName; }))
|
|
1061
|
+
Array.from(new Set((_a = action.payload.widgets) === null || _a === void 0 ? void 0 : _a.map(function (widget) { return widget.bcName; }))
|
|
1069
1062
|
// БК которые есть на вьюхе
|
|
1070
1063
|
).filter(function (bcName) { return state.bo.bc[bcName]; }).forEach(function (bcName) {
|
|
1071
1064
|
newBcs[bcName] = __assign(__assign({}, state.bo.bc[bcName]), { page: 1 });
|
|
@@ -1077,9 +1070,10 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1077
1070
|
currentBc.loading = false;
|
|
1078
1071
|
state.cachedBc[action.payload.bcName] = action.payload.bcUrl;
|
|
1079
1072
|
}).addCase(bcFetchDataFail, function (state, action) {
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
state.
|
|
1073
|
+
var bcName = action.payload.bcName;
|
|
1074
|
+
if (Object.values(state.bo.bc).some(function (bc) { return bc.name === bcName; })) {
|
|
1075
|
+
state.bo.bc[bcName].loading = false;
|
|
1076
|
+
state.cachedBc[bcName] = action.payload.bcUrl;
|
|
1083
1077
|
}
|
|
1084
1078
|
}).addCase(sendOperation, function (state, action) {
|
|
1085
1079
|
if (!operationsHandledLocally.includes(action.payload.operationType)) {
|
|
@@ -1107,10 +1101,12 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1107
1101
|
Object.assign(state.bo.bc, newCursors);
|
|
1108
1102
|
Object.assign(state.cachedBc, newCache);
|
|
1109
1103
|
}).addCase(bcChangeDepthCursor, function (state, action) {
|
|
1104
|
+
var _a;
|
|
1110
1105
|
if (action.payload.depth === 1) {
|
|
1111
1106
|
state.bo.bc[action.payload.bcName].cursor = action.payload.cursor;
|
|
1112
1107
|
}
|
|
1113
1108
|
else {
|
|
1109
|
+
state.bo.bc[action.payload.bcName].depthBc = (_a = state.bo.bc[action.payload.bcName].depthBc) !== null && _a !== void 0 ? _a : {};
|
|
1114
1110
|
state.bo.bc[action.payload.bcName].depthBc[action.payload.depth].cursor = action.payload.cursor;
|
|
1115
1111
|
}
|
|
1116
1112
|
}).addCase(bcSelectRecord, function (state, action) {
|
|
@@ -1195,9 +1191,11 @@ var createSessionReducerBuilderManager = function (initialState) { return new Re
|
|
|
1195
1191
|
}).addCase(switchDebugMode, function (state, action) {
|
|
1196
1192
|
state.debugMode = action.payload;
|
|
1197
1193
|
}).addCase(addPendingRequest, function (state, action) {
|
|
1198
|
-
|
|
1194
|
+
var _a;
|
|
1195
|
+
(_a = state.pendingRequests) === null || _a === void 0 ? void 0 : _a.push(action.payload.request);
|
|
1199
1196
|
}).addCase(removePendingRequest, function (state, action) {
|
|
1200
|
-
|
|
1197
|
+
var _a;
|
|
1198
|
+
state.pendingRequests = (_a = state.pendingRequests) === null || _a === void 0 ? void 0 : _a.filter(function (item) { return item.requestId !== action.payload.requestId; });
|
|
1201
1199
|
}).addCase(addNotification, function (state, action) {
|
|
1202
1200
|
state.notifications.push(action.payload);
|
|
1203
1201
|
}).addCase(removeNotifications, function (state, action) {
|
|
@@ -1244,14 +1242,15 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1244
1242
|
state.metaInProgress[action.payload.bcName] = true;
|
|
1245
1243
|
}
|
|
1246
1244
|
}).addCase(bcFetchRowMetaSuccess, function (state, action) {
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1245
|
+
var _a;
|
|
1246
|
+
state.rowMeta[action.payload.bcName] = (_a = state.rowMeta[action.payload.bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1247
|
+
state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
|
|
1250
1248
|
state.metaInProgress[action.payload.bcName] = false;
|
|
1251
1249
|
}).addCase(bcNewDataSuccess, function (state, action) {
|
|
1252
1250
|
state.selectedCell = initialViewState.selectedCell;
|
|
1253
1251
|
}).addCase(forceActiveRmUpdate, function (state, action) {
|
|
1254
|
-
var _a
|
|
1252
|
+
var _a, _b, _c, _d;
|
|
1253
|
+
var _e = action.payload, bcName = _e.bcName, bcUrl = _e.bcUrl, currentRecordData = _e.currentRecordData, rowMeta = _e.rowMeta, cursor = _e.cursor;
|
|
1255
1254
|
var handledForceActive = {};
|
|
1256
1255
|
var rowMetaForcedValues = {};
|
|
1257
1256
|
var newPendingChangesDiff = {};
|
|
@@ -1274,11 +1273,15 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1274
1273
|
handledForceActive[key] = newPendingDataChanges[key];
|
|
1275
1274
|
}
|
|
1276
1275
|
});
|
|
1276
|
+
state.handledForceActive[bcName] = (_a = state.handledForceActive[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1277
|
+
state.handledForceActive[bcName][cursor] = (_b = state.handledForceActive[bcName][cursor]) !== null && _b !== void 0 ? _b : {};
|
|
1277
1278
|
Object.assign(state.handledForceActive[bcName][cursor], handledForceActive);
|
|
1279
|
+
state.pendingDataChanges[bcName] = (_c = state.pendingDataChanges[bcName]) !== null && _c !== void 0 ? _c : {};
|
|
1278
1280
|
state.pendingDataChanges[bcName][cursor] = newPendingDataChanges;
|
|
1281
|
+
state.rowMeta[bcName] = (_d = state.rowMeta[bcName]) !== null && _d !== void 0 ? _d : {};
|
|
1279
1282
|
state.rowMeta[bcName][bcUrl] = rowMeta;
|
|
1280
1283
|
}).addCase(changeDataItem, function (state, action) {
|
|
1281
|
-
var _a;
|
|
1284
|
+
var _a, _b, _c;
|
|
1282
1285
|
var actionBcName = action.payload.bcName;
|
|
1283
1286
|
var prevBc = state.pendingDataChanges[action.payload.bcName] || {};
|
|
1284
1287
|
var prevCursor = prevBc[action.payload.cursor] || {};
|
|
@@ -1295,10 +1298,11 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1295
1298
|
nextValidationFails[fieldKey] = "This field is mandatory";
|
|
1296
1299
|
}
|
|
1297
1300
|
});
|
|
1301
|
+
state.pendingDataChanges[action.payload.bcName] = (_b = state.pendingDataChanges[action.payload.bcName]) !== null && _b !== void 0 ? _b : {};
|
|
1298
1302
|
state.pendingDataChanges[action.payload.bcName][action.payload.cursor] = nextPending;
|
|
1299
1303
|
if (isTargetFormatPVF) {
|
|
1300
1304
|
;
|
|
1301
|
-
state.pendingValidationFails[actionBcName][action.payload.cursor] = nextValidationFails;
|
|
1305
|
+
((_c = state.pendingValidationFails) === null || _c === void 0 ? void 0 : _c[actionBcName])[action.payload.cursor] = nextValidationFails;
|
|
1302
1306
|
}
|
|
1303
1307
|
else {
|
|
1304
1308
|
state.pendingValidationFails = nextValidationFails;
|
|
@@ -1319,7 +1323,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1319
1323
|
pendingDataChanges[bcName] = pendingBcChanges;
|
|
1320
1324
|
});
|
|
1321
1325
|
var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1322
|
-
var pendingValidationFails = __assign({}, state.pendingValidationFails);
|
|
1326
|
+
var pendingValidationFails = state.pendingValidationFails ? __assign({}, state.pendingValidationFails) : {};
|
|
1323
1327
|
if (isTargetFormatPVF) {
|
|
1324
1328
|
action.payload.bcNames.forEach(function (i) {
|
|
1325
1329
|
pendingValidationFails[i] = {};
|
|
@@ -1334,7 +1338,8 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1334
1338
|
}).addCase(bcFetchRowMetaFail, function (state, action) {
|
|
1335
1339
|
state.metaInProgress[action.payload.bcName] = false;
|
|
1336
1340
|
}).addCase(forceActiveChangeFail, function (state, action) {
|
|
1337
|
-
var _a
|
|
1341
|
+
var _a;
|
|
1342
|
+
var _b = action.payload, bcName = _b.bcName, bcUrl = _b.bcUrl, entityError = _b.entityError;
|
|
1338
1343
|
var errors = {};
|
|
1339
1344
|
if (entityError) {
|
|
1340
1345
|
Object.entries(entityError.fields).forEach(function (_a) {
|
|
@@ -1342,9 +1347,11 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1342
1347
|
errors[fieldName] = violation;
|
|
1343
1348
|
});
|
|
1344
1349
|
}
|
|
1350
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1345
1351
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1346
1352
|
}).addCase(bcSaveDataFail, function (state, action) {
|
|
1347
|
-
var _a
|
|
1353
|
+
var _a;
|
|
1354
|
+
var _b = action.payload, bcName = _b.bcName, bcUrl = _b.bcUrl, entityError = _b.entityError;
|
|
1348
1355
|
var errors = {};
|
|
1349
1356
|
if (entityError) {
|
|
1350
1357
|
Object.entries(entityError.fields).forEach(function (_a) {
|
|
@@ -1352,9 +1359,11 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1352
1359
|
errors[fieldName] = violation;
|
|
1353
1360
|
});
|
|
1354
1361
|
}
|
|
1362
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1355
1363
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1356
1364
|
}).addCase(sendOperationFail, function (state, action) {
|
|
1357
|
-
var _a
|
|
1365
|
+
var _a;
|
|
1366
|
+
var _b = action.payload, bcName = _b.bcName, bcUrl = _b.bcUrl, entityError = _b.entityError;
|
|
1358
1367
|
var errors = {};
|
|
1359
1368
|
if (entityError) {
|
|
1360
1369
|
Object.entries(entityError.fields).forEach(function (_a) {
|
|
@@ -1362,30 +1371,38 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1362
1371
|
errors[fieldName] = violation;
|
|
1363
1372
|
});
|
|
1364
1373
|
}
|
|
1374
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1365
1375
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1366
1376
|
}).addCase(sendOperationSuccess, function (state, action) {
|
|
1367
|
-
var _a
|
|
1377
|
+
var _a, _b, _c;
|
|
1378
|
+
var bcName = action.payload.bcName;
|
|
1379
|
+
var cursor = action.payload.cursor;
|
|
1368
1380
|
var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1381
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1369
1382
|
state.pendingDataChanges[bcName][cursor] = {};
|
|
1370
1383
|
if (isTargetFormatPVF) {
|
|
1371
1384
|
;
|
|
1372
|
-
state.pendingValidationFails[bcName][cursor] = {};
|
|
1385
|
+
((_b = state.pendingValidationFails) === null || _b === void 0 ? void 0 : _b[bcName])[cursor] = {};
|
|
1373
1386
|
}
|
|
1374
1387
|
else {
|
|
1375
1388
|
state.pendingValidationFails = initialViewState.pendingValidationFails;
|
|
1376
1389
|
}
|
|
1390
|
+
state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) !== null && _c !== void 0 ? _c : {};
|
|
1377
1391
|
state.handledForceActive[bcName][cursor] = {};
|
|
1378
1392
|
}).addCase(bcSaveDataSuccess, function (state, action) {
|
|
1379
|
-
var _a
|
|
1393
|
+
var _a, _b, _c;
|
|
1394
|
+
var _d = action.payload, bcName = _d.bcName, cursor = _d.cursor;
|
|
1380
1395
|
var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1396
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1381
1397
|
state.pendingDataChanges[bcName][cursor] = {};
|
|
1382
1398
|
if (isTargetFormatPVF) {
|
|
1383
1399
|
;
|
|
1384
|
-
state.pendingValidationFails[bcName][cursor] = {};
|
|
1400
|
+
((_b = state.pendingValidationFails) === null || _b === void 0 ? void 0 : _b[bcName])[cursor] = {};
|
|
1385
1401
|
}
|
|
1386
1402
|
else {
|
|
1387
1403
|
state.pendingValidationFails = initialViewState.pendingValidationFails;
|
|
1388
1404
|
}
|
|
1405
|
+
state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) !== null && _c !== void 0 ? _c : {};
|
|
1389
1406
|
state.handledForceActive[bcName][cursor] = {};
|
|
1390
1407
|
}).addCase(bcCancelPendingChanges, function (state, action) {
|
|
1391
1408
|
var _a, _b;
|
|
@@ -1396,7 +1413,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1396
1413
|
}
|
|
1397
1414
|
}
|
|
1398
1415
|
var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1399
|
-
var pendingValidationFails = __assign({}, state.pendingValidationFails);
|
|
1416
|
+
var pendingValidationFails = state.pendingValidationFails ? __assign({}, state.pendingValidationFails) : {};
|
|
1400
1417
|
if (isTargetFormatPVF) {
|
|
1401
1418
|
if (((_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.bcNames) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
1402
1419
|
action.payload.bcNames.forEach(function (i) {
|
|
@@ -1425,8 +1442,8 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1425
1442
|
isFilter: isFilter
|
|
1426
1443
|
};
|
|
1427
1444
|
}).addCase(showFileUploadPopup, function (state, action) {
|
|
1428
|
-
var _a;
|
|
1429
|
-
var bcName = (_a = state.widgets.find(function (item) { return item.name === action.payload.widgetName; })) === null ||
|
|
1445
|
+
var _a, _b;
|
|
1446
|
+
var bcName = (_b = (_a = state.widgets) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.name === action.payload.widgetName; })) === null || _b === void 0 ? void 0 : _b.bcName;
|
|
1430
1447
|
state.popupData = {
|
|
1431
1448
|
type: "file-upload",
|
|
1432
1449
|
bcName: bcName,
|
|
@@ -1438,6 +1455,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1438
1455
|
}).addCase(viewClearPickMap, function (state) {
|
|
1439
1456
|
state.pickMap = null;
|
|
1440
1457
|
}).addCase(closeViewPopup, function (state) {
|
|
1458
|
+
state.popupData = {};
|
|
1441
1459
|
state.popupData.bcName = null;
|
|
1442
1460
|
}).addCase(selectTableCell, function (state, action) {
|
|
1443
1461
|
state.selectedCell = { widgetName: action.payload.widgetName, rowId: action.payload.rowId, fieldKey: action.payload.fieldKey };
|
|
@@ -1445,12 +1463,16 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1445
1463
|
state.pendingDataChanges = initialViewState.pendingDataChanges;
|
|
1446
1464
|
state.selectedCell = initialViewState.selectedCell;
|
|
1447
1465
|
}).addCase(showNotification, function (state, action) {
|
|
1466
|
+
var _a, _b;
|
|
1467
|
+
state.systemNotifications = (_a = state.systemNotifications) !== null && _a !== void 0 ? _a : [];
|
|
1448
1468
|
state.systemNotifications.push({
|
|
1449
1469
|
type: action.payload.type,
|
|
1450
1470
|
message: action.payload.message,
|
|
1451
|
-
id: state.systemNotifications.length
|
|
1471
|
+
id: (_b = state.systemNotifications) === null || _b === void 0 ? void 0 : _b.length
|
|
1452
1472
|
});
|
|
1453
1473
|
}).addCase(closeNotification, function (state, action) {
|
|
1474
|
+
var _a;
|
|
1475
|
+
state.systemNotifications = (_a = state.systemNotifications) !== null && _a !== void 0 ? _a : [];
|
|
1454
1476
|
state.systemNotifications = state.systemNotifications.filter(function (item) { return item.id !== action.payload.id; });
|
|
1455
1477
|
}).addCase(showViewError, function (state, action) {
|
|
1456
1478
|
state.error = action.payload.error;
|
|
@@ -1583,10 +1605,10 @@ var sendOperationEpic = function (action$, state$, _a) {
|
|
|
1583
1605
|
}
|
|
1584
1606
|
var context = { widgetName: action.payload.widgetName };
|
|
1585
1607
|
return api.customAction(screenName, bcUrl, data, context, params).pipe((0, import_rxjs2.mergeMap)(function (response) {
|
|
1586
|
-
var _a;
|
|
1587
|
-
var postInvoke = response.postActions[0];
|
|
1608
|
+
var _a, _b;
|
|
1609
|
+
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
1588
1610
|
var preInvoke = response.preInvoke;
|
|
1589
|
-
return defaultSaveOperation ? ((
|
|
1611
|
+
return defaultSaveOperation ? ((_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.onSuccessAction) ? (0, import_rxjs2.concat)((0, import_rxjs2.of)(bcCancelPendingChanges({ bcNames: [bcName] })), (0, import_rxjs2.of)(action.payload.onSuccessAction)) : import_rxjs2.EMPTY : (0, import_rxjs2.concat).apply(void 0, __spreadArray([(0, import_rxjs2.of)(sendOperationSuccess({ bcName: bcName, cursor: cursor })),
|
|
1590
1612
|
(0, import_rxjs2.of)(bcForceUpdate({ bcName: bcName }))], postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName), false));
|
|
1591
1613
|
}), (0, import_rxjs2.catchError)(function (e) {
|
|
1592
1614
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -1651,16 +1673,17 @@ var import_schema9 = require("@cxbox-ui/schema");
|
|
|
1651
1673
|
var fileUploadConfirmEpic = function (action$, state$, _a) {
|
|
1652
1674
|
var api = _a.api;
|
|
1653
1675
|
return action$.pipe((0, import_rxjs4.filter)(bulkUploadFiles.match), (0, import_rxjs4.mergeMap)(function (action) {
|
|
1654
|
-
var _a;
|
|
1676
|
+
var _a, _b;
|
|
1655
1677
|
var state = state$.value;
|
|
1656
|
-
var bcName = state.view.popupData.bcName;
|
|
1678
|
+
var bcName = (_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.bcName;
|
|
1657
1679
|
var bcUrl = buildBcUrl(bcName, true, state);
|
|
1658
|
-
var widgetName = (
|
|
1680
|
+
var widgetName = (_b = state.view.widgets.find(function (item) { return item.bcName === bcName; })) === null || _b === void 0 ? void 0 : _b.name;
|
|
1659
1681
|
var data = {
|
|
1660
1682
|
bulkIds: action.payload.fileIds
|
|
1661
1683
|
};
|
|
1662
1684
|
return api.customAction(state.screen.screenName, bcUrl, data, null, { _action: "file-upload-save" }).pipe((0, import_rxjs4.mergeMap)(function (response) {
|
|
1663
|
-
var
|
|
1685
|
+
var _a;
|
|
1686
|
+
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
1664
1687
|
var preInvoke = response.preInvoke;
|
|
1665
1688
|
return (0, import_rxjs4.concat).apply(void 0, __spreadArray([(0, import_rxjs4.of)(sendOperationSuccess({ bcName: bcName, cursor: null })),
|
|
1666
1689
|
(0, import_rxjs4.of)(bcForceUpdate({ bcName: bcName })),
|
|
@@ -1676,14 +1699,14 @@ var selectTableCellInitEpic = function (action$, state$) { return action$.pipe((
|
|
|
1676
1699
|
var state = state$.value;
|
|
1677
1700
|
var _b = action.payload, nextRowId = _b.rowId, fieldKey = _b.fieldKey;
|
|
1678
1701
|
var nextWidget = state.view.widgets.find(function (widget) { return widget.name === action.payload.widgetName; });
|
|
1679
|
-
var nextBcName = nextWidget.bcName;
|
|
1702
|
+
var nextBcName = nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.bcName;
|
|
1680
1703
|
var nextBcCursor = (_a = state.screen.bo.bc[nextBcName]) === null || _a === void 0 ? void 0 : _a.cursor;
|
|
1681
1704
|
var selectedCell = state.view.selectedCell;
|
|
1682
1705
|
if (nextRowId !== nextBcCursor) {
|
|
1683
1706
|
resultObservables.push((0, import_rxjs5.of)(bcSelectRecord({ bcName: nextBcName, cursor: nextRowId })));
|
|
1684
1707
|
}
|
|
1685
|
-
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || nextWidget.name !== selectedCell.widgetName) {
|
|
1686
|
-
resultObservables.push((0, import_rxjs5.of)(selectTableCell({ widgetName: nextWidget.name, rowId: nextRowId, fieldKey: fieldKey })));
|
|
1708
|
+
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || (nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.name) !== selectedCell.widgetName) {
|
|
1709
|
+
resultObservables.push((0, import_rxjs5.of)(selectTableCell({ widgetName: nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.name, rowId: nextRowId, fieldKey: fieldKey })));
|
|
1687
1710
|
}
|
|
1688
1711
|
return (0, import_rxjs5.concat).apply(void 0, resultObservables);
|
|
1689
1712
|
})); };
|
|
@@ -1731,7 +1754,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1731
1754
|
var currentRecordData = (_b = state.data[bcName]) === null || _b === void 0 ? void 0 : _b.find(function (record) { return record.id === cursor; });
|
|
1732
1755
|
var fieldsRowMeta = (_d = (_c = state.view.rowMeta[bcName]) === null || _c === void 0 ? void 0 : _c[bcUrl]) === null || _d === void 0 ? void 0 : _d.fields;
|
|
1733
1756
|
var changedFiledKey = null;
|
|
1734
|
-
var closePopup = (0, import_rxjs8.concat)((0, import_rxjs8.of)(
|
|
1757
|
+
var closePopup = (0, import_rxjs8.concat)((0, import_rxjs8.of)(closeViewPopup(null)), (0, import_rxjs8.of)(viewClearPickMap(null)), (0, import_rxjs8.of)(bcRemoveAllFilters({ bcName: bcName })));
|
|
1735
1758
|
var someForceActiveChanged = fieldsRowMeta === null || fieldsRowMeta === void 0 ? void 0 : fieldsRowMeta.filter(function (field) { return field.forceActive && pendingChanges[field.key] !== void 0; }).some(function (field) {
|
|
1736
1759
|
var result = pendingChanges[field.key] !== handledForceActive[field.key];
|
|
1737
1760
|
if (result) {
|
|
@@ -1741,7 +1764,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1741
1764
|
});
|
|
1742
1765
|
var requestId = (0, import_toolkit2.nanoid)();
|
|
1743
1766
|
if (someForceActiveChanged && !disableRetry) {
|
|
1744
|
-
return (0, import_rxjs8.concat)((0, import_rxjs8.of)(addPendingRequest({ request: { requestId: requestId, type: "force-active" } })), api.getRmByForceActive(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: currentRecordData.vstamp })).pipe((0, import_rxjs8.mergeMap)(function (data) {
|
|
1767
|
+
return (0, import_rxjs8.concat)((0, import_rxjs8.of)(addPendingRequest({ request: { requestId: requestId, type: "force-active" } })), api.getRmByForceActive(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: currentRecordData === null || currentRecordData === void 0 ? void 0 : currentRecordData.vstamp })).pipe((0, import_rxjs8.mergeMap)(function (data) {
|
|
1745
1768
|
var result = [(0, import_rxjs8.of)(removePendingRequest({ requestId: requestId }))];
|
|
1746
1769
|
if (state.view.url === initUrl) {
|
|
1747
1770
|
result.push((0, import_rxjs8.of)(forceActiveRmUpdate({
|
|
@@ -1771,7 +1794,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1771
1794
|
bcName: bcName,
|
|
1772
1795
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
1773
1796
|
cursor: cursor,
|
|
1774
|
-
dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData[changedFiledKey], _a),
|
|
1797
|
+
dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData === null || currentRecordData === void 0 ? void 0 : currentRecordData[changedFiledKey], _a),
|
|
1775
1798
|
disableRetry: true
|
|
1776
1799
|
})), (0, import_rxjs8.of)(forceActiveChangeFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError }))) : import_rxjs8.EMPTY);
|
|
1777
1800
|
})));
|
|
@@ -1784,9 +1807,14 @@ var import_rxjs9 = require("rxjs");
|
|
|
1784
1807
|
var showAllTableRecordsInitEpic = function (action$, state$) { return action$.pipe((0, import_rxjs9.filter)(showAllTableRecordsInit.match), (0, import_rxjs9.mergeMap)(function (action) {
|
|
1785
1808
|
var _a;
|
|
1786
1809
|
var resultObservables = [];
|
|
1787
|
-
var
|
|
1810
|
+
var _b = action.payload, bcName = _b.bcName, cursor = _b.cursor;
|
|
1811
|
+
var state = state$.value;
|
|
1812
|
+
var route = state.router;
|
|
1788
1813
|
resultObservables.push((0, import_rxjs9.of)(bcChangeCursors({ cursorsMap: (_a = {}, _a[bcName] = null, _a) })));
|
|
1814
|
+
var bcPath = route.bcPath.slice(0, route.bcPath.indexOf("".concat(bcName, "/").concat(cursor)));
|
|
1815
|
+
var url = defaultBuildURL(__assign(__assign({}, route), { bcPath: bcPath }));
|
|
1789
1816
|
resultObservables.push((0, import_rxjs9.of)(bcForceUpdate({ bcName: bcName })));
|
|
1817
|
+
resultObservables.push((0, import_rxjs9.of)(changeLocation({ location: defaultParseURL(new URL(url, window.location.origin)) })));
|
|
1790
1818
|
return (0, import_rxjs9.concat).apply(void 0, resultObservables);
|
|
1791
1819
|
})); };
|
|
1792
1820
|
// src/epics/view/clearPendingDataChangesAfterCursorChangeEpic.ts
|
|
@@ -1810,8 +1838,108 @@ var clearPendingDataChangesAfterCursorChangeEpic = function (action$, state$) {
|
|
|
1810
1838
|
// src/epics/router/drilldownEpic.ts
|
|
1811
1839
|
var import_rxjs11 = require("rxjs");
|
|
1812
1840
|
var drillDownEpic = function (action$, state$) { return action$.pipe((0, import_rxjs11.filter)(drillDown.match), (0, import_rxjs11.switchMap)(function (action) {
|
|
1813
|
-
|
|
1841
|
+
var _a, _b;
|
|
1842
|
+
var state = state$.value;
|
|
1843
|
+
var url = action.payload.url;
|
|
1844
|
+
var result = [];
|
|
1845
|
+
switch (action.payload.drillDownType) {
|
|
1846
|
+
case import_schema.DrillDownType.external:
|
|
1847
|
+
window.location.href = url;
|
|
1848
|
+
break;
|
|
1849
|
+
case import_schema.DrillDownType.externalNew:
|
|
1850
|
+
if (/^[a-z0-9]+:\/\//i.test(url)) {
|
|
1851
|
+
window.open(url);
|
|
1852
|
+
}
|
|
1853
|
+
break;
|
|
1854
|
+
case import_schema.DrillDownType.relative:
|
|
1855
|
+
window.location.href = "".concat(window.location.origin, "/").concat(url);
|
|
1856
|
+
break;
|
|
1857
|
+
case import_schema.DrillDownType.relativeNew:
|
|
1858
|
+
window.open("".concat(window.location.origin, "/").concat(url), "_blank");
|
|
1859
|
+
break;
|
|
1860
|
+
case import_schema.DrillDownType.inner:
|
|
1861
|
+
default:
|
|
1862
|
+
var urlBase = url.split("?")[0];
|
|
1863
|
+
var urlObject = new URL(url, window.location.origin);
|
|
1864
|
+
var urlFilters = urlObject.searchParams.get("filters");
|
|
1865
|
+
var urlSorters = urlObject.searchParams.get("sorters");
|
|
1866
|
+
var newFilters_1 = {};
|
|
1867
|
+
var newSorters = {};
|
|
1868
|
+
try {
|
|
1869
|
+
newFilters_1 = (_a = JSON.parse(urlFilters)) !== null && _a !== void 0 ? _a : newFilters_1;
|
|
1870
|
+
}
|
|
1871
|
+
catch (_c) {
|
|
1872
|
+
urlFilters && console.warn("Failed to parse filters on drilldown");
|
|
1873
|
+
newFilters_1 = {};
|
|
1874
|
+
}
|
|
1875
|
+
try {
|
|
1876
|
+
newSorters = (_b = JSON.parse(urlSorters)) !== null && _b !== void 0 ? _b : newSorters;
|
|
1877
|
+
}
|
|
1878
|
+
catch (_d) {
|
|
1879
|
+
urlSorters && console.warn("Failed to parse sorters on drilldown");
|
|
1880
|
+
newSorters = {};
|
|
1881
|
+
}
|
|
1882
|
+
var bcToUpdate_1 = {};
|
|
1883
|
+
Object.keys(state.screen.filters).forEach(function (bcName) {
|
|
1884
|
+
if (newFilters_1[bcName] === "" || newFilters_1[bcName]) {
|
|
1885
|
+
bcToUpdate_1[bcName] = true;
|
|
1886
|
+
result.push(bcRemoveAllFilters({ bcName: bcName }));
|
|
1887
|
+
}
|
|
1888
|
+
});
|
|
1889
|
+
var nextState = defaultParseURL(urlObject);
|
|
1890
|
+
var viewName_1 = nextState.viewName;
|
|
1891
|
+
Object.entries(newFilters_1).forEach(function (_a) {
|
|
1892
|
+
var _b;
|
|
1893
|
+
var bcName = _a[0], filterExpression = _a[1];
|
|
1894
|
+
var parsedFilters = (_b = parseFilters(filterExpression)) === null || _b === void 0 ? void 0 : _b.map(function (item) { return (__assign(__assign({}, item), { viewName: viewName_1 })); });
|
|
1895
|
+
parsedFilters === null || parsedFilters === void 0 ? void 0 : parsedFilters.forEach(function (parsedFilter) {
|
|
1896
|
+
bcToUpdate_1[bcName] = true;
|
|
1897
|
+
result.push(bcAddFilter({ bcName: bcName, filter: parsedFilter }));
|
|
1898
|
+
});
|
|
1899
|
+
});
|
|
1900
|
+
Object.entries(newSorters).forEach(function (_a) {
|
|
1901
|
+
var bcName = _a[0], sortExpression = _a[1];
|
|
1902
|
+
var sorter = parseSorters(sortExpression);
|
|
1903
|
+
result.push(bcAddSorter({ bcName: bcName, sorter: sorter }));
|
|
1904
|
+
bcToUpdate_1[bcName] = true;
|
|
1905
|
+
});
|
|
1906
|
+
var prevState = state.router;
|
|
1907
|
+
var willUpdateAnyway = shallowCompare(prevState, nextState, ["params"]).length > 0;
|
|
1908
|
+
if (!willUpdateAnyway) {
|
|
1909
|
+
Object.keys(bcToUpdate_1).forEach(function (bcName) {
|
|
1910
|
+
result.push(bcForceUpdate({ bcName: bcName }));
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
result.push(changeLocation({ location: defaultParseURL(new URL(makeRelativeUrl(urlBase), window.location.origin)) }));
|
|
1914
|
+
break;
|
|
1915
|
+
}
|
|
1916
|
+
return result.length ? (0, import_rxjs11.concat)(result) : import_rxjs11.EMPTY;
|
|
1814
1917
|
})); };
|
|
1918
|
+
function shallowCompare(prevProps, nextProps, ignore) {
|
|
1919
|
+
if (ignore === void 0) { ignore = []; }
|
|
1920
|
+
var diffProps = [];
|
|
1921
|
+
if (!prevProps && !nextProps) {
|
|
1922
|
+
return null;
|
|
1923
|
+
}
|
|
1924
|
+
if (!prevProps) {
|
|
1925
|
+
return Object.keys(nextProps);
|
|
1926
|
+
}
|
|
1927
|
+
if (!nextProps) {
|
|
1928
|
+
return Object.keys(prevProps);
|
|
1929
|
+
}
|
|
1930
|
+
var newKeys = Object.keys(nextProps);
|
|
1931
|
+
newKeys.forEach(function (key) {
|
|
1932
|
+
if (prevProps[key] !== nextProps[key] && !ignore.includes(key)) {
|
|
1933
|
+
diffProps.push(key);
|
|
1934
|
+
}
|
|
1935
|
+
});
|
|
1936
|
+
Object.keys(prevProps).forEach(function (key) {
|
|
1937
|
+
if (!newKeys.includes(key)) {
|
|
1938
|
+
diffProps.push(key);
|
|
1939
|
+
}
|
|
1940
|
+
});
|
|
1941
|
+
return diffProps;
|
|
1942
|
+
}
|
|
1815
1943
|
// src/epics/router/loginDoneEpic.ts
|
|
1816
1944
|
var import_rxjs12 = require("rxjs");
|
|
1817
1945
|
var loginDoneEpic = function (action$, state$) { return action$.pipe((0, import_rxjs12.filter)(loginDone.match), (0, import_rxjs12.switchMap)(function (action) {
|
|
@@ -1880,7 +2008,7 @@ var userDrillDownEpic = function (action$, state$, _a) {
|
|
|
1880
2008
|
var route = state.router;
|
|
1881
2009
|
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;
|
|
1882
2010
|
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];
|
|
1883
|
-
return customDrillDownUrl || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) !== route.path ? (0, import_rxjs16.concat)(drillDownField.drillDownType !== import_schema.DrillDownType.inner ? (0, import_rxjs16.of)(bcFetchRowMetaSuccess({ bcName: bcName, rowMeta: rowMeta, bcUrl: bcUrl, cursor: cursor })) : import_rxjs16.EMPTY, (0, import_rxjs16.of)(userDrillDownSuccess({ bcName: bcName, bcUrl: bcUrl, cursor: cursor })), (0, import_rxjs16.of)(drillDown({
|
|
2011
|
+
return customDrillDownUrl || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) !== route.path ? (0, import_rxjs16.concat)((drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDownType) !== import_schema.DrillDownType.inner ? (0, import_rxjs16.of)(bcFetchRowMetaSuccess({ bcName: bcName, rowMeta: rowMeta, bcUrl: bcUrl, cursor: cursor })) : import_rxjs16.EMPTY, (0, import_rxjs16.of)(userDrillDownSuccess({ bcName: bcName, bcUrl: bcUrl, cursor: cursor })), (0, import_rxjs16.of)(drillDown({
|
|
1884
2012
|
url: customDrillDownUrl || drillDownField.drillDown,
|
|
1885
2013
|
drillDownType: drillDownField.drillDownType,
|
|
1886
2014
|
route: route
|
|
@@ -1971,7 +2099,7 @@ var userDrillDownChangeCursorsEpic = function (action$, state$) { return action$
|
|
|
1971
2099
|
if (cursor !== action.payload.cursor) {
|
|
1972
2100
|
return bcChangeCursors({ cursorsMap: (_a = {}, _a[action.payload.bcName] = action.payload.cursor, _a) });
|
|
1973
2101
|
}
|
|
1974
|
-
return
|
|
2102
|
+
return emptyAction;
|
|
1975
2103
|
})); };
|
|
1976
2104
|
// src/epics/screen/apiErrorEpic.ts
|
|
1977
2105
|
var import_axios = __toESM(require("axios"));
|
|
@@ -1999,7 +2127,9 @@ var import_rxjs22 = require("rxjs");
|
|
|
1999
2127
|
var downloadFileEpic = function (action$, state$, _a) {
|
|
2000
2128
|
var api = _a.api;
|
|
2001
2129
|
return action$.pipe((0, import_rxjs22.filter)(downloadFile.match), (0, import_rxjs22.tap)(function (action) {
|
|
2130
|
+
var fileId = action.payload.fileId;
|
|
2002
2131
|
var anchor = document.createElement("a");
|
|
2132
|
+
anchor.href = "".concat(api.fileUploadEndpoint, "?id=").concat(encodeURIComponent(fileId));
|
|
2003
2133
|
anchor.style.display = "none";
|
|
2004
2134
|
document.body.appendChild(anchor);
|
|
2005
2135
|
setTimeout(function () {
|
|
@@ -2016,8 +2146,8 @@ var httpError401Epic = function (action$) { return action$.pipe((0, import_rxjs2
|
|
|
2016
2146
|
// src/epics/screen/httpError409Epic.ts
|
|
2017
2147
|
var import_rxjs24 = require("rxjs");
|
|
2018
2148
|
var httpError409Epic = function (action$, state$) { return action$.pipe((0, import_rxjs24.filter)(httpError.match), (0, import_rxjs24.filter)(function (action) { return action.payload.statusCode === 409; }), (0, import_rxjs24.map)(function (action) {
|
|
2019
|
-
var _a, _b;
|
|
2020
|
-
var notificationMessage = ((_b = (_a = action.payload.error.response.data.error) === null ||
|
|
2149
|
+
var _a, _b, _c;
|
|
2150
|
+
var notificationMessage = ((_c = (_b = ((_a = action.payload.error.response) === null || _a === void 0 ? void 0 : _a.data).error) === null || _b === void 0 ? void 0 : _b.popup) === null || _c === void 0 ? void 0 : _c[0]) || "";
|
|
2021
2151
|
return addNotification({
|
|
2022
2152
|
key: "action_edit_error",
|
|
2023
2153
|
message: notificationMessage,
|
|
@@ -2033,10 +2163,10 @@ var httpError409Epic = function (action$, state$) { return action$.pipe((0, impo
|
|
|
2033
2163
|
// src/epics/screen/httpError418Epic.ts
|
|
2034
2164
|
var import_rxjs25 = require("rxjs");
|
|
2035
2165
|
var httpError418Epic = function (action$, state$) { return action$.pipe((0, import_rxjs25.filter)(httpError.match), (0, import_rxjs25.filter)(function (action) { return action.payload.statusCode === 418; }), (0, import_rxjs25.mergeMap)(function (action) {
|
|
2036
|
-
var _a;
|
|
2037
|
-
var
|
|
2166
|
+
var _a, _b;
|
|
2167
|
+
var _c = action.payload, error = _c.error, callContext = _c.callContext;
|
|
2038
2168
|
var result = [];
|
|
2039
|
-
var typedError = error.response.data;
|
|
2169
|
+
var typedError = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2040
2170
|
if (!typedError.error.popup) {
|
|
2041
2171
|
return import_rxjs25.EMPTY;
|
|
2042
2172
|
}
|
|
@@ -2045,13 +2175,13 @@ var httpError418Epic = function (action$, state$) { return action$.pipe((0, impo
|
|
|
2045
2175
|
message: typedError.error.popup[0]
|
|
2046
2176
|
};
|
|
2047
2177
|
result.push((0, import_rxjs25.of)(showViewError({ error: businessError })));
|
|
2048
|
-
if ((
|
|
2178
|
+
if ((_b = typedError.error.postActions) === null || _b === void 0 ? void 0 : _b[0]) {
|
|
2049
2179
|
var widget = state$.value.view.widgets.find(function (item) { return item.name === callContext.widgetName; });
|
|
2050
|
-
var bcName = widget.bcName;
|
|
2180
|
+
var bcName = widget === null || widget === void 0 ? void 0 : widget.bcName;
|
|
2051
2181
|
result.push((0, import_rxjs25.of)(processPostInvoke({
|
|
2052
2182
|
bcName: bcName,
|
|
2053
2183
|
postInvoke: typedError.error.postActions[0],
|
|
2054
|
-
widgetName: widget.name
|
|
2184
|
+
widgetName: widget === null || widget === void 0 ? void 0 : widget.name
|
|
2055
2185
|
})));
|
|
2056
2186
|
}
|
|
2057
2187
|
return (0, import_rxjs25.concat).apply(void 0, result);
|
|
@@ -2071,10 +2201,11 @@ var httpError500Epic = function (action$, state$) { return action$.pipe((0, impo
|
|
|
2071
2201
|
var import_rxjs27 = require("rxjs");
|
|
2072
2202
|
var knownHttpErrors = [401, 409, 418, 500];
|
|
2073
2203
|
var httpErrorDefaultEpic = function (action$, state$) { return action$.pipe((0, import_rxjs27.filter)(httpError.match), (0, import_rxjs27.filter)(function (action) { return !knownHttpErrors.includes(action.payload.statusCode); }), (0, import_rxjs27.map)(function (action) {
|
|
2204
|
+
var _a, _b;
|
|
2074
2205
|
var businessError = {
|
|
2075
2206
|
type: 0 /* BusinessError */,
|
|
2076
|
-
code: action.payload.error.response.status,
|
|
2077
|
-
details: action.payload.error.response.data
|
|
2207
|
+
code: (_a = action.payload.error.response) === null || _a === void 0 ? void 0 : _a.status,
|
|
2208
|
+
details: (_b = action.payload.error.response) === null || _b === void 0 ? void 0 : _b.data
|
|
2078
2209
|
};
|
|
2079
2210
|
return showViewError({ error: businessError });
|
|
2080
2211
|
})); };
|
|
@@ -2095,6 +2226,7 @@ var downloadFileByUrlEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2095
2226
|
var import_rxjs29 = require("rxjs");
|
|
2096
2227
|
var processPostInvokeEpic = function (action$, state$) { return action$.pipe((0, import_rxjs29.filter)(processPostInvoke.match), (0, import_rxjs29.mergeMap)(function (action) {
|
|
2097
2228
|
var _a;
|
|
2229
|
+
var _b;
|
|
2098
2230
|
var state = state$.value;
|
|
2099
2231
|
switch (action.payload.postInvoke.type) {
|
|
2100
2232
|
case "drillDown" /* drillDown */:
|
|
@@ -2102,7 +2234,10 @@ var processPostInvokeEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2102
2234
|
case "postDelete" /* postDelete */: {
|
|
2103
2235
|
var cursorsMap = (_a = {}, _a[action.payload.bcName] = null, _a);
|
|
2104
2236
|
var result = [bcChangeCursors({ cursorsMap: cursorsMap })];
|
|
2105
|
-
if (state.router.bcPath.includes("".concat(action.payload.bcName, "/"))) {
|
|
2237
|
+
if ((_b = state.router.bcPath) === null || _b === void 0 ? void 0 : _b.includes("".concat(action.payload.bcName, "/"))) {
|
|
2238
|
+
var newBcUrl = state.router.bcPath.split(action.payload.bcName)[0] || "";
|
|
2239
|
+
var newUrl = "/screen/".concat(state.router.screenName, "/view/").concat(state.router.viewName, "/").concat(newBcUrl);
|
|
2240
|
+
result.push(changeLocation({ location: defaultParseURL(new URL(newUrl, window.location.origin)) }));
|
|
2106
2241
|
}
|
|
2107
2242
|
else {
|
|
2108
2243
|
result.push(bcFetchDataRequest({
|
|
@@ -2187,8 +2322,7 @@ var refreshMetaEpic = function (action$, state$, _a) {
|
|
|
2187
2322
|
logoutDone(null),
|
|
2188
2323
|
login({ login: "", password: "", role: activeRole }),
|
|
2189
2324
|
changeLocation({
|
|
2190
|
-
|
|
2191
|
-
action: "PUSH"
|
|
2325
|
+
location: router
|
|
2192
2326
|
})
|
|
2193
2327
|
]); }), (0, import_rxjs32.catchError)(function (error) { return (0, import_rxjs32.of)(loginFail(error)); }));
|
|
2194
2328
|
}));
|
|
@@ -2209,9 +2343,26 @@ var loginByAnotherRoleEpic = function (action$, state$, _a) {
|
|
|
2209
2343
|
var role = (_a = action.payload.role) !== null && _a !== void 0 ? _a : "";
|
|
2210
2344
|
var isSwitchRole = role && role !== state$.value.session.activeRole;
|
|
2211
2345
|
return api.loginByRoleRequest(role).pipe((0, import_rxjs34.mergeMap)(function (data) {
|
|
2346
|
+
var _a;
|
|
2347
|
+
var result = [];
|
|
2212
2348
|
if (isSwitchRole) {
|
|
2349
|
+
var defaultScreen = data.screens.find(function (screen) { return screen.defaultScreen; }) || data.screens[0];
|
|
2350
|
+
var defaultViewName_1 = (_a = defaultScreen === null || defaultScreen === void 0 ? void 0 : defaultScreen.primary) !== null && _a !== void 0 ? _a : defaultScreen.meta.views[0].name;
|
|
2351
|
+
var defaultView = defaultScreen === null || defaultScreen === void 0 ? void 0 : defaultScreen.meta.views.find(function (view) { return defaultViewName_1 === view.name; });
|
|
2352
|
+
if (defaultView)
|
|
2353
|
+
result.push(changeLocation({ location: defaultParseURL(new URL(defaultView.url, window.location.origin)) }));
|
|
2213
2354
|
}
|
|
2214
|
-
return import_rxjs34.
|
|
2355
|
+
return (0, import_rxjs34.concat)(__spreadArray(__spreadArray([], result, true), [
|
|
2356
|
+
loginDone({
|
|
2357
|
+
devPanelEnabled: data.devPanelEnabled,
|
|
2358
|
+
activeRole: data.activeRole,
|
|
2359
|
+
roles: data.roles,
|
|
2360
|
+
screens: data.screens,
|
|
2361
|
+
firstName: data.firstName,
|
|
2362
|
+
lastName: data.lastName,
|
|
2363
|
+
login: data.login
|
|
2364
|
+
})
|
|
2365
|
+
], false));
|
|
2215
2366
|
}), (0, import_rxjs34.catchError)(function (error) {
|
|
2216
2367
|
console.error(error);
|
|
2217
2368
|
var errorMsg = error.response ? responseStatusMessages[error.response.status] || "Server application unavailable" : "Empty server response";
|
|
@@ -2228,22 +2379,24 @@ var import_schema13 = require("@cxbox-ui/schema");
|
|
|
2228
2379
|
var bcNewDataEpic = function (action$, state$, _a) {
|
|
2229
2380
|
var api = _a.api;
|
|
2230
2381
|
return action$.pipe((0, import_rxjs36.filter)(sendOperation.match), (0, import_rxjs36.filter)(function (action) { return matchOperationRole(import_schema13.OperationTypeCrud.create, action.payload, state$.value); }), (0, import_rxjs36.mergeMap)(function (action) {
|
|
2382
|
+
var _a;
|
|
2231
2383
|
var state = state$.value;
|
|
2232
2384
|
var bcName = action.payload.bcName;
|
|
2233
|
-
var bcUrl = buildBcUrl(bcName, false, state);
|
|
2385
|
+
var bcUrl = (_a = buildBcUrl(bcName, false, state)) !== null && _a !== void 0 ? _a : "";
|
|
2234
2386
|
var context = { widgetName: action.payload.widgetName };
|
|
2235
2387
|
var params = { _action: action.payload.operationType };
|
|
2236
2388
|
return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe((0, import_rxjs36.mergeMap)(function (data) {
|
|
2389
|
+
var _a, _b;
|
|
2237
2390
|
var rowMeta = data.row;
|
|
2238
2391
|
var dataItem = { id: null, vstamp: -1 };
|
|
2239
2392
|
data.row.fields.forEach(function (field) {
|
|
2240
2393
|
dataItem[field.key] = field.currentValue;
|
|
2241
2394
|
});
|
|
2242
|
-
var postInvoke = data.postActions[0];
|
|
2395
|
+
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2243
2396
|
var cursor = dataItem.id;
|
|
2244
2397
|
return (0, import_rxjs36.concat)((0, import_rxjs36.of)(bcNewDataSuccess({ bcName: bcName, dataItem: dataItem, bcUrl: bcUrl })), (0, import_rxjs36.of)(bcFetchRowMetaSuccess({ bcName: bcName, bcUrl: "".concat(bcUrl, "/").concat(cursor), rowMeta: rowMeta, cursor: cursor })), (0, import_rxjs36.of)(changeDataItem({
|
|
2245
2398
|
bcName: bcName,
|
|
2246
|
-
bcUrl: buildBcUrl(bcName, true, state),
|
|
2399
|
+
bcUrl: (_b = buildBcUrl(bcName, true, state)) !== null && _b !== void 0 ? _b : "",
|
|
2247
2400
|
cursor: cursor,
|
|
2248
2401
|
dataItem: {
|
|
2249
2402
|
id: cursor
|
|
@@ -2266,7 +2419,7 @@ function cancelRequestEpic(action$, actionTypes, cancelFn, cancelActionCreator,
|
|
|
2266
2419
|
return true;
|
|
2267
2420
|
}; }
|
|
2268
2421
|
return action$.pipe((0, import_rxjs37.filter)((0, import_toolkit4.isAnyOf).apply(void 0, actionTypes)), (0, import_rxjs37.filter)(filterFn), (0, import_rxjs37.mergeMap)(function () {
|
|
2269
|
-
cancelFn();
|
|
2422
|
+
cancelFn === null || cancelFn === void 0 ? void 0 : cancelFn();
|
|
2270
2423
|
return (0, import_rxjs37.of)(cancelActionCreator);
|
|
2271
2424
|
}), (0, import_rxjs37.take)(1));
|
|
2272
2425
|
}
|
|
@@ -2309,16 +2462,16 @@ var import_rxjs39 = require("rxjs");
|
|
|
2309
2462
|
var bcSaveDataEpic = function (action$, state$, _a) {
|
|
2310
2463
|
var api = _a.api;
|
|
2311
2464
|
return action$.pipe((0, import_rxjs39.filter)(sendOperation.match), (0, import_rxjs39.filter)(function (action) { return matchOperationRole(import_schema5.OperationTypeCrud.save, action.payload, state$.value); }), (0, import_rxjs39.mergeMap)(function (action) {
|
|
2312
|
-
var _a, _b, _c;
|
|
2465
|
+
var _a, _b, _c, _d;
|
|
2313
2466
|
var state = state$.value;
|
|
2314
2467
|
var bcName = action.payload.bcName;
|
|
2315
|
-
var bcUrl = buildBcUrl(bcName, true, state);
|
|
2468
|
+
var bcUrl = (_a = buildBcUrl(bcName, true, state)) !== null && _a !== void 0 ? _a : "";
|
|
2316
2469
|
var widgetName = action.payload.widgetName;
|
|
2317
2470
|
var cursor = state.screen.bo.bc[bcName].cursor;
|
|
2318
2471
|
var dataItem = state.data[bcName].find(function (item) { return item.id === cursor; });
|
|
2319
|
-
var pendingChanges = (
|
|
2320
|
-
var rowMeta = bcUrl && ((
|
|
2321
|
-
var options = (
|
|
2472
|
+
var pendingChanges = (_b = state.view.pendingDataChanges[bcName]) === null || _b === void 0 ? void 0 : _b[cursor];
|
|
2473
|
+
var rowMeta = bcUrl && ((_c = state.view.rowMeta[bcName]) === null || _c === void 0 ? void 0 : _c[bcUrl]);
|
|
2474
|
+
var options = (_d = state.view.widgets.find(function (widget) { return widget.name === widgetName; })) === null || _d === void 0 ? void 0 : _d.options;
|
|
2322
2475
|
if (rowMeta) {
|
|
2323
2476
|
var fields = rowMeta.fields;
|
|
2324
2477
|
var _loop_3 = function (key) {
|
|
@@ -2335,8 +2488,9 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2335
2488
|
return bcFetchDataRequest({ bcName: childBcName, widgetName: widgetNames[0] });
|
|
2336
2489
|
});
|
|
2337
2490
|
var context = { widgetName: action.payload.widgetName };
|
|
2338
|
-
return api.saveBcData(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: dataItem.vstamp }), context).pipe((0, import_rxjs39.mergeMap)(function (data) {
|
|
2339
|
-
var
|
|
2491
|
+
return api.saveBcData(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: dataItem === null || dataItem === void 0 ? void 0 : dataItem.vstamp }), context).pipe((0, import_rxjs39.mergeMap)(function (data) {
|
|
2492
|
+
var _a;
|
|
2493
|
+
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2340
2494
|
var responseDataItem = data.record;
|
|
2341
2495
|
return (0, import_rxjs39.concat)((0, import_rxjs39.of)(bcSaveDataSuccess({ bcName: bcName, cursor: cursor, dataItem: responseDataItem })), (0, import_rxjs39.of)(bcFetchRowMeta({ widgetName: widgetName, bcName: bcName })), (0, import_rxjs39.of).apply(void 0, fetchChildrenBcData), postInvoke ? (0, import_rxjs39.of)(processPostInvoke({
|
|
2342
2496
|
bcName: bcName,
|
|
@@ -2345,7 +2499,7 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2345
2499
|
cursor: responseDataItem.id
|
|
2346
2500
|
})) : import_rxjs39.EMPTY, action.payload.onSuccessAction ? (0, import_rxjs39.of)(action.payload.onSuccessAction) : import_rxjs39.EMPTY);
|
|
2347
2501
|
}), (0, import_rxjs39.catchError)(function (e) {
|
|
2348
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2502
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2349
2503
|
console.error(e);
|
|
2350
2504
|
var notification$ = import_rxjs39.EMPTY;
|
|
2351
2505
|
if (action.payload.onSuccessAction && !(options === null || options === void 0 ? void 0 : options.disableNotification)) {
|
|
@@ -2366,8 +2520,8 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2366
2520
|
var entityError = null;
|
|
2367
2521
|
var operationError = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2368
2522
|
if (((_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === Object((_c = e.response) === null || _c === void 0 ? void 0 : _c.data)) {
|
|
2369
|
-
entityError = (_d = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _d === void 0 ? void 0 : _d.entity;
|
|
2370
|
-
viewError = (
|
|
2523
|
+
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;
|
|
2524
|
+
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;
|
|
2371
2525
|
}
|
|
2372
2526
|
return (0, import_rxjs39.concat)((0, import_rxjs39.of)(bcSaveDataFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError })), notification$);
|
|
2373
2527
|
}));
|
|
@@ -2443,41 +2597,41 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2443
2597
|
});
|
|
2444
2598
|
return (0, import_rxjs41.of)(bcFetchDataRequest({
|
|
2445
2599
|
bcName: childBcName,
|
|
2446
|
-
widgetName: nonLazyWidget.name,
|
|
2600
|
+
widgetName: nonLazyWidget === null || nonLazyWidget === void 0 ? void 0 : nonLazyWidget.name,
|
|
2447
2601
|
ignorePageLimit: ignorePageLimit || showViewPopup.match(action),
|
|
2448
2602
|
keepDelta: isHierarchy || keepDelta
|
|
2449
2603
|
}));
|
|
2450
2604
|
}));
|
|
2451
2605
|
};
|
|
2452
2606
|
var bcFetchDataImpl = function () {
|
|
2453
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2607
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2454
2608
|
var state = state$.value;
|
|
2455
|
-
var
|
|
2456
|
-
var
|
|
2457
|
-
var widget = (_a = widgets.find(function (item) { return item.name === widgetName; })) !== null && _a !== void 0 ? _a : widgets.find(function (item) { return item.bcName === action.payload.bcName; });
|
|
2609
|
+
var _j = action.payload.widgetName, widgetName = _j === void 0 ? "" : _j;
|
|
2610
|
+
var _k = state.view, widgets = _k.widgets, infiniteWidgets = _k.infiniteWidgets;
|
|
2611
|
+
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; });
|
|
2458
2612
|
if (!widget) {
|
|
2459
2613
|
return [import_rxjs41.EMPTY];
|
|
2460
2614
|
}
|
|
2461
2615
|
var bcName = action.payload.bcName;
|
|
2462
2616
|
var bc = state.screen.bo.bc[bcName];
|
|
2463
|
-
var cursor = bc.cursor,
|
|
2464
|
-
var limit = ((_b = widgets.find(function (i) { return i.bcName === bcName; })) === null || _b === void 0 ? void 0 : _b.limit) || bc.limit;
|
|
2617
|
+
var cursor = bc.cursor, _l = bc.page, page = _l === void 0 ? 1 : _l;
|
|
2618
|
+
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;
|
|
2465
2619
|
var sorters = state.screen.sorters[bcName];
|
|
2466
2620
|
if (showViewPopup.match(action) && bcName === action.payload.calleeBCName) {
|
|
2467
2621
|
return [import_rxjs41.EMPTY];
|
|
2468
2622
|
}
|
|
2469
|
-
var anyHierarchyWidget = widgets.find(function (item) {
|
|
2623
|
+
var anyHierarchyWidget = widgets === null || widgets === void 0 ? void 0 : widgets.find(function (item) {
|
|
2470
2624
|
return item.bcName === widget.bcName && item.type === import_schema14.WidgetTypes.AssocListPopup && isHierarchyWidget(item);
|
|
2471
2625
|
});
|
|
2472
|
-
var fullHierarchyWidget = state.view.widgets.find(function (item) {
|
|
2626
|
+
var fullHierarchyWidget = (_d = state.view.widgets) === null || _d === void 0 ? void 0 : _d.find(function (item) {
|
|
2473
2627
|
var _a;
|
|
2474
2628
|
return item.bcName === widget.bcName && item.type === import_schema14.WidgetTypes.AssocListPopup && ((_a = item.options) === null || _a === void 0 ? void 0 : _a.hierarchyFull);
|
|
2475
2629
|
});
|
|
2476
|
-
var limitBySelfCursor = (
|
|
2630
|
+
var limitBySelfCursor = (_e = state.router.bcPath) === null || _e === void 0 ? void 0 : _e.includes("".concat(bcName, "/").concat(cursor));
|
|
2477
2631
|
var bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
|
|
2478
2632
|
var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(fullHierarchyWidget ? [] : state.screen.filters[bcName] || [])), getSorters(sorters));
|
|
2479
2633
|
if (bcForceUpdate.match(action)) {
|
|
2480
|
-
var infinityPaginationWidget = widgetName && infiniteWidgets.includes(widgetName) || ((
|
|
2634
|
+
var infinityPaginationWidget = widgetName && (infiniteWidgets === null || infiniteWidgets === void 0 ? void 0 : infiniteWidgets.includes(widgetName)) || ((_g = (_f = widgets === null || widgets === void 0 ? void 0 : widgets.filter(function (item) { return item.bcName === bcName; })) === null || _f === void 0 ? void 0 : _f.find(function (item) { return infiniteWidgets === null || infiniteWidgets === void 0 ? void 0 : infiniteWidgets.includes(item.name); })) === null || _g === void 0 ? void 0 : _g.name);
|
|
2481
2635
|
if (infinityPaginationWidget) {
|
|
2482
2636
|
fetchParams._page = 1;
|
|
2483
2637
|
fetchParams._limit = limit * page;
|
|
@@ -2487,7 +2641,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2487
2641
|
fetchParams._page = action.payload.from || 1;
|
|
2488
2642
|
fetchParams._limit = (action.payload.to || page - fetchParams._page) * limit;
|
|
2489
2643
|
}
|
|
2490
|
-
if (bcFetchDataRequest.match(action) && action.payload.ignorePageLimit || ((
|
|
2644
|
+
if (bcFetchDataRequest.match(action) && action.payload.ignorePageLimit || ((_h = anyHierarchyWidget === null || anyHierarchyWidget === void 0 ? void 0 : anyHierarchyWidget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull)) {
|
|
2491
2645
|
fetchParams._limit = 0;
|
|
2492
2646
|
}
|
|
2493
2647
|
var canceler = api.createCanceler();
|
|
@@ -2499,7 +2653,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2499
2653
|
var normalFlow = api.fetchBcData(state.screen.screenName, bcUrl, fetchParams, canceler.cancelToken).pipe((0, import_rxjs41.mergeMap)(function (response) {
|
|
2500
2654
|
var _a, _b;
|
|
2501
2655
|
var cursorChange = getCursorChange(response.data, cursor, !!anyHierarchyWidget);
|
|
2502
|
-
var parentOfNotLazyWidget = widgets.some(function (item) {
|
|
2656
|
+
var parentOfNotLazyWidget = widgets === null || widgets === void 0 ? void 0 : widgets.some(function (item) {
|
|
2503
2657
|
var _a;
|
|
2504
2658
|
return ((_a = state.screen.bo.bc[item.bcName]) === null || _a === void 0 ? void 0 : _a.parentName) === bcName && !PopupWidgetTypes.includes(item.type);
|
|
2505
2659
|
});
|
|
@@ -2559,7 +2713,8 @@ var bcDeleteDataEpic = function (action$, store$, _a) {
|
|
|
2559
2713
|
var context = { widgetName: action.payload.widgetName };
|
|
2560
2714
|
var isTargetFormatPVF = state.view.pendingValidationFailsFormat === "target" /* target */;
|
|
2561
2715
|
return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe((0, import_rxjs42.mergeMap)(function (data) {
|
|
2562
|
-
var
|
|
2716
|
+
var _a;
|
|
2717
|
+
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2563
2718
|
return (0, import_rxjs42.concat)(isTargetFormatPVF ? (0, import_rxjs42.of)(bcCancelPendingChanges({ bcNames: [bcName] })) : import_rxjs42.EMPTY, (0, import_rxjs42.of)(bcFetchDataRequest({ bcName: bcName, widgetName: widgetName })), postInvoke ? (0, import_rxjs42.of)(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: widgetName })) : import_rxjs42.EMPTY);
|
|
2564
2719
|
}), (0, import_rxjs42.catchError)(function (error) {
|
|
2565
2720
|
console.error(error);
|
|
@@ -2608,19 +2763,19 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2608
2763
|
fields: widget.fields
|
|
2609
2764
|
};
|
|
2610
2765
|
var hierarchy = (_b = widget.options) === null || _b === void 0 ? void 0 : _b.hierarchy;
|
|
2611
|
-
var hierarchyDescriptor = isRoot ? rootHierarchyDescriptor : hierarchy.find(function (item) { return item.bcName === action.payload.bcName; });
|
|
2766
|
+
var hierarchyDescriptor = isRoot ? rootHierarchyDescriptor : hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.find(function (item) { return item.bcName === action.payload.bcName; });
|
|
2612
2767
|
var hierarchyGroupSelection = (_c = widget.options) === null || _c === void 0 ? void 0 : _c.hierarchyGroupSelection;
|
|
2613
2768
|
var hierarchyTraverse = (_d = widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyTraverse;
|
|
2614
|
-
var childrenBc = hierarchy.slice(hierarchy.findIndex(function (item) { return item.bcName === action.payload.bcName; }) + 1).map(function (item) { return item.bcName; });
|
|
2769
|
+
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; });
|
|
2615
2770
|
if (hierarchyGroupSelection && hierarchyDescriptor.radio && !selected) {
|
|
2616
2771
|
result.push((0, import_rxjs44.of)(dropAllAssociations({
|
|
2617
2772
|
bcNames: childrenBc
|
|
2618
2773
|
})));
|
|
2619
2774
|
}
|
|
2620
|
-
var parent = isRoot ? null : hierarchy.find(function (item, index) {
|
|
2775
|
+
var parent = isRoot ? null : (hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.find(function (item, index) {
|
|
2621
2776
|
var _a;
|
|
2622
2777
|
return ((_a = hierarchy[index + 1]) === null || _a === void 0 ? void 0 : _a.bcName) === action.payload.bcName;
|
|
2623
|
-
}) || rootHierarchyDescriptor;
|
|
2778
|
+
})) || rootHierarchyDescriptor;
|
|
2624
2779
|
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; });
|
|
2625
2780
|
if (parent && hierarchyTraverse && selected) {
|
|
2626
2781
|
if (hierarchyDescriptor.radio) {
|
|
@@ -2631,7 +2786,7 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2631
2786
|
result.push((0, import_rxjs44.of)(changeAssociation({
|
|
2632
2787
|
bcName: parent.bcName,
|
|
2633
2788
|
widgetName: action.payload.widgetName,
|
|
2634
|
-
dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem[parent.assocValueKey || action.payload.assocValueKey] }),
|
|
2789
|
+
dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem === null || parentItem === void 0 ? void 0 : parentItem[parent.assocValueKey || action.payload.assocValueKey] }),
|
|
2635
2790
|
assocValueKey: action.payload.assocValueKey
|
|
2636
2791
|
})));
|
|
2637
2792
|
}
|
|
@@ -2678,7 +2833,8 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
|
|
|
2678
2833
|
var params = { _action: action.payload.operationType };
|
|
2679
2834
|
var cursorsMap = (_a = {}, _a[action.payload.bcName] = null, _a);
|
|
2680
2835
|
return api.customAction(screenName, bcUrl, data, context, params).pipe((0, import_rxjs45.mergeMap)(function (response) {
|
|
2681
|
-
var
|
|
2836
|
+
var _a;
|
|
2837
|
+
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2682
2838
|
return (0, import_rxjs45.concat)((0, import_rxjs45.of)(sendOperationSuccess({ bcName: bcName, cursor: cursor })), (0, import_rxjs45.of)(bcChangeCursors({ cursorsMap: cursorsMap })), postInvoke ? (0, import_rxjs45.of)(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: context.widgetName })) : import_rxjs45.EMPTY);
|
|
2683
2839
|
}), (0, import_rxjs45.catchError)(function (error) {
|
|
2684
2840
|
console.error(error);
|
|
@@ -2714,21 +2870,21 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2714
2870
|
var removedItem = data.find(function (item) { return item.id === action.payload.removedItem.id; });
|
|
2715
2871
|
var associated = action.payload.dataItem.map(function (item) { return item.id; });
|
|
2716
2872
|
var removedNodes = [];
|
|
2717
|
-
if ((_d = widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyGroupDeselection) {
|
|
2718
|
-
if ((_e = widget.options) === null || _e === void 0 ? void 0 : _e.hierarchyTraverse) {
|
|
2873
|
+
if ((_d = widget === null || widget === void 0 ? void 0 : widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyGroupDeselection) {
|
|
2874
|
+
if ((_e = widget === null || widget === void 0 ? void 0 : widget.options) === null || _e === void 0 ? void 0 : _e.hierarchyTraverse) {
|
|
2719
2875
|
data = assignTreeLinks(data);
|
|
2720
2876
|
}
|
|
2721
|
-
var removedItemChildren = data.filter(function (item) { return item.parentId === removedItem.id; });
|
|
2722
|
-
removedNodes = __spreadArray([removedItem.id], removedItemChildren.filter(function (item) { return associated.includes(item.id); }).map(function (item) { return item.id; }), true);
|
|
2723
|
-
if ((_f = widget.options) === null || _f === void 0 ? void 0 : _f.hierarchyTraverse) {
|
|
2877
|
+
var removedItemChildren = data.filter(function (item) { return item.parentId === (removedItem === null || removedItem === void 0 ? void 0 : removedItem.id); });
|
|
2878
|
+
removedNodes = __spreadArray([removedItem === null || removedItem === void 0 ? void 0 : removedItem.id], removedItemChildren.filter(function (item) { return associated.includes(item.id); }).map(function (item) { return item.id; }), true);
|
|
2879
|
+
if ((_f = widget === null || widget === void 0 ? void 0 : widget.options) === null || _f === void 0 ? void 0 : _f.hierarchyTraverse) {
|
|
2724
2880
|
getDescendants(removedItemChildren, removedNodes);
|
|
2725
2881
|
removedNodes = data.filter(function (item) { return removedNodes.includes(item.id) && associated.includes(item.id); }).map(function (item) { return item.id; });
|
|
2726
2882
|
}
|
|
2727
|
-
var parent_1 = data.find(function (item) { return item.id === removedItem.parentId; });
|
|
2883
|
+
var parent_1 = data.find(function (item) { return item.id === (removedItem === null || removedItem === void 0 ? void 0 : removedItem.parentId); });
|
|
2728
2884
|
var siblings = data.filter(function (item) { return item.parentId === (parent_1 === null || parent_1 === void 0 ? void 0 : parent_1.id); });
|
|
2729
2885
|
var parentEmpty = siblings.every(function (child) { return removedNodes.includes(child.id) || !associated.includes(child.id); });
|
|
2730
2886
|
if (parent_1 && parentEmpty) {
|
|
2731
|
-
if ((_g = widget.options) === null || _g === void 0 ? void 0 : _g.hierarchyTraverse) {
|
|
2887
|
+
if ((_g = widget === null || widget === void 0 ? void 0 : widget.options) === null || _g === void 0 ? void 0 : _g.hierarchyTraverse) {
|
|
2732
2888
|
var parentDescendants = [];
|
|
2733
2889
|
getDescendants(siblings, parentDescendants);
|
|
2734
2890
|
var parentDeepEmpty = parentDescendants.every(function (descendant) {
|
|
@@ -2743,7 +2899,7 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2743
2899
|
}
|
|
2744
2900
|
}
|
|
2745
2901
|
}
|
|
2746
|
-
if ((_h = widget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull) {
|
|
2902
|
+
if ((_h = widget === null || widget === void 0 ? void 0 : widget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull) {
|
|
2747
2903
|
return (0, import_rxjs47.of)(changeDataItem({
|
|
2748
2904
|
bcName: bcName,
|
|
2749
2905
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
@@ -2751,8 +2907,8 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2751
2907
|
dataItem: (_a = {}, _a[associateFieldKey] = action.payload.dataItem.filter(function (item) { return !removedNodes.includes(item.id); }), _a)
|
|
2752
2908
|
}));
|
|
2753
2909
|
}
|
|
2754
|
-
if ((_j = widget.options) === null || _j === void 0 ? void 0 : _j.hierarchy) {
|
|
2755
|
-
var hierarchyBcName = (_o = (_m = (_l = (_k = widget.options) === null || _k === void 0 ? void 0 : _k.hierarchy) === null || _l === void 0 ? void 0 : _l.find(function (hierarchyData) {
|
|
2910
|
+
if ((_j = widget === null || widget === void 0 ? void 0 : widget.options) === null || _j === void 0 ? void 0 : _j.hierarchy) {
|
|
2911
|
+
var hierarchyBcName = (_o = (_m = (_l = (_k = widget === null || widget === void 0 ? void 0 : widget.options) === null || _k === void 0 ? void 0 : _k.hierarchy) === null || _l === void 0 ? void 0 : _l.find(function (hierarchyData) {
|
|
2756
2912
|
var _a;
|
|
2757
2913
|
return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
|
|
2758
2914
|
})) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName;
|
|
@@ -2791,11 +2947,12 @@ var import_rxjs48 = require("rxjs");
|
|
|
2791
2947
|
var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
|
|
2792
2948
|
var api = _a.api;
|
|
2793
2949
|
return action$.pipe((0, import_rxjs48.filter)(bcFetchRowMeta.match), (0, import_rxjs48.mergeMap)(function (action) {
|
|
2950
|
+
var _a, _b;
|
|
2794
2951
|
var state = state$.value;
|
|
2795
2952
|
var screenName = state.screen.screenName;
|
|
2796
2953
|
var bcName = action.payload.bcName;
|
|
2797
|
-
var cursor = state.screen.bo.bc[bcName].cursor;
|
|
2798
|
-
var bcUrl = buildBcUrl(bcName, true, state);
|
|
2954
|
+
var cursor = (_a = state.screen.bo.bc[bcName].cursor) !== null && _a !== void 0 ? _a : "";
|
|
2955
|
+
var bcUrl = (_b = buildBcUrl(bcName, true, state)) !== null && _b !== void 0 ? _b : "";
|
|
2799
2956
|
var canceler = api.createCanceler();
|
|
2800
2957
|
var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }));
|
|
2801
2958
|
var cancelByParentBc = cancelRequestEpic(action$, [bcSelectRecord], canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }), function (filteredAction) {
|
|
@@ -2872,7 +3029,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
2872
3029
|
bcName: bcName,
|
|
2873
3030
|
depth: parentDepth,
|
|
2874
3031
|
widgetName: action.payload.widgetName,
|
|
2875
|
-
dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem[assocValueKey] }),
|
|
3032
|
+
dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem === null || parentItem === void 0 ? void 0 : parentItem[assocValueKey] }),
|
|
2876
3033
|
assocValueKey: assocValueKey
|
|
2877
3034
|
})));
|
|
2878
3035
|
}
|
|
@@ -2900,11 +3057,13 @@ var import_rxjs50 = require("rxjs");
|
|
|
2900
3057
|
var saveAssociationsActiveEpic = function (action$, state$, _a) {
|
|
2901
3058
|
var api = _a.api;
|
|
2902
3059
|
return action$.pipe((0, import_rxjs50.filter)(saveAssociations.match), (0, import_rxjs50.filter)(function (action) {
|
|
2903
|
-
|
|
3060
|
+
var _a;
|
|
3061
|
+
return (_a = state$.value.view.popupData) === null || _a === void 0 ? void 0 : _a.active;
|
|
2904
3062
|
}), (0, import_rxjs50.switchMap)(function (action) {
|
|
3063
|
+
var _a, _b;
|
|
2905
3064
|
var state = state$.value;
|
|
2906
|
-
var calleeBCName = state.view.popupData.calleeBCName;
|
|
2907
|
-
var calleeWidgetName = state.view.popupData.calleeWidgetName;
|
|
3065
|
+
var calleeBCName = (_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.calleeBCName;
|
|
3066
|
+
var calleeWidgetName = (_b = state.view.popupData) === null || _b === void 0 ? void 0 : _b.calleeWidgetName;
|
|
2908
3067
|
var bcNames = action.payload.bcNames;
|
|
2909
3068
|
var bcUrl = buildBcUrl(calleeBCName, true, state);
|
|
2910
3069
|
var pendingChanges = state.view.pendingDataChanges[bcNames[0]] || {};
|
|
@@ -2912,7 +3071,7 @@ var saveAssociationsActiveEpic = function (action$, state$, _a) {
|
|
|
2912
3071
|
return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter(function (i) { return i._associate; }), params).pipe((0, import_rxjs50.mergeMap)(function (response) {
|
|
2913
3072
|
var postInvoke = response.postActions[0];
|
|
2914
3073
|
var calleeWidget = state.view.widgets.find(function (widgetItem) { return widgetItem.bcName === calleeBCName; });
|
|
2915
|
-
return (0, import_rxjs50.concat)(postInvoke ? (0, import_rxjs50.of)(processPostInvoke({ bcName: calleeBCName, postInvoke: postInvoke, widgetName: calleeWidget.name })) : import_rxjs50.EMPTY, (0, import_rxjs50.of)(bcCancelPendingChanges({ bcNames: bcNames })), (0, import_rxjs50.of)(bcForceUpdate({ bcName: calleeBCName, widgetName: calleeWidgetName })));
|
|
3074
|
+
return (0, import_rxjs50.concat)(postInvoke ? (0, import_rxjs50.of)(processPostInvoke({ bcName: calleeBCName, postInvoke: postInvoke, widgetName: calleeWidget === null || calleeWidget === void 0 ? void 0 : calleeWidget.name })) : import_rxjs50.EMPTY, (0, import_rxjs50.of)(bcCancelPendingChanges({ bcNames: bcNames })), (0, import_rxjs50.of)(bcForceUpdate({ bcName: calleeBCName, widgetName: calleeWidgetName })));
|
|
2916
3075
|
}), (0, import_rxjs50.catchError)(function (err) {
|
|
2917
3076
|
console.error(err);
|
|
2918
3077
|
return import_rxjs50.EMPTY;
|
|
@@ -2922,7 +3081,7 @@ var saveAssociationsActiveEpic = function (action$, state$, _a) {
|
|
|
2922
3081
|
// src/epics/data/changeAssociationSameBcEpic.ts
|
|
2923
3082
|
var import_rxjs51 = require("rxjs");
|
|
2924
3083
|
var changeAssociationSameBcEpic = function (action$, state$) { return action$.pipe((0, import_rxjs51.filter)(changeAssociationSameBc.match), (0, import_rxjs51.mergeMap)(function (action) {
|
|
2925
|
-
var _a, _b, _c, _d, _e;
|
|
3084
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2926
3085
|
var state = state$.value;
|
|
2927
3086
|
var bcName = action.payload.bcName;
|
|
2928
3087
|
var result = [
|
|
@@ -2939,14 +3098,14 @@ var changeAssociationSameBcEpic = function (action$, state$) { return action$.pi
|
|
|
2939
3098
|
var widget = state.view.widgets.find(function (item) { return item.name === action.payload.widgetName; });
|
|
2940
3099
|
var hierarchyTraverse = (_a = widget.options) === null || _a === void 0 ? void 0 : _a.hierarchyTraverse;
|
|
2941
3100
|
var currentData = depth > 1 ? (_b = state.depthData[depth]) === null || _b === void 0 ? void 0 : _b[bcName] : state.data[bcName];
|
|
2942
|
-
var parentCursor = parentDepth ? parentDepth > 1 ? (_c = state.screen.bo.bc[bcName].depthBc[parentDepth]) === null ||
|
|
2943
|
-
var parentItem = parentCursor ? parentDepth > 1 ? (
|
|
3101
|
+
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;
|
|
3102
|
+
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;
|
|
2944
3103
|
if (parentDepth && hierarchyTraverse && selected) {
|
|
2945
3104
|
result.push((0, import_rxjs51.of)(changeAssociationSameBc({
|
|
2946
3105
|
bcName: bcName,
|
|
2947
3106
|
depth: parentDepth,
|
|
2948
3107
|
widgetName: action.payload.widgetName,
|
|
2949
|
-
dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem[action.payload.assocValueKey] }),
|
|
3108
|
+
dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem === null || parentItem === void 0 ? void 0 : parentItem[action.payload.assocValueKey] }),
|
|
2950
3109
|
assocValueKey: action.payload.assocValueKey
|
|
2951
3110
|
})));
|
|
2952
3111
|
}
|
|
@@ -2987,14 +3146,15 @@ var inlinePickListFetchDataEpic = function (action$, state$, _a) {
|
|
|
2987
3146
|
// src/epics/data/saveAssociationsPassiveEpic.ts
|
|
2988
3147
|
var import_rxjs53 = require("rxjs");
|
|
2989
3148
|
var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pipe((0, import_rxjs53.filter)(saveAssociations.match), (0, import_rxjs53.filter)(function () {
|
|
2990
|
-
|
|
3149
|
+
var _a;
|
|
3150
|
+
return !((_a = state$.value.view.popupData) === null || _a === void 0 ? void 0 : _a.active);
|
|
2991
3151
|
}), (0, import_rxjs53.switchMap)(function (action) {
|
|
2992
3152
|
var _a, _b;
|
|
2993
|
-
var _c;
|
|
3153
|
+
var _c, _d;
|
|
2994
3154
|
var state = state$.value;
|
|
2995
|
-
var
|
|
3155
|
+
var _e = (_c = state.view.popupData) !== null && _c !== void 0 ? _c : {}, _f = _e.calleeBCName, calleeBCName = _f === void 0 ? action.payload.calleeBcName : _f, _g = _e.associateFieldKey, associateFieldKey = _g === void 0 ? action.payload.associateFieldKey : _g;
|
|
2996
3156
|
var cursor = state.screen.bo.bc[calleeBCName].cursor;
|
|
2997
|
-
var recordPrevData = (
|
|
3157
|
+
var recordPrevData = (_d = state.data[calleeBCName].find(function (dataStateRecord) { return dataStateRecord.id === cursor; })[associateFieldKey]) !== null && _d !== void 0 ? _d : [];
|
|
2998
3158
|
var newValues = [];
|
|
2999
3159
|
action.payload.bcNames.forEach(function (pendingBc) {
|
|
3000
3160
|
var pendingChanges = state.view.pendingDataChanges[pendingBc] || {};
|
|
@@ -3101,7 +3261,6 @@ var ObservableApiWrapper = /** @class */ (function () {
|
|
|
3101
3261
|
this.instance = instance;
|
|
3102
3262
|
}
|
|
3103
3263
|
class_2.prototype.get = function (path, config, callContext) {
|
|
3104
|
-
if (config === void 0) { config = {}; }
|
|
3105
3264
|
return (0, import_rxjs57.from)(this.instance.get(path, config)).pipe((0, import_rxjs57.takeWhile)(redirectOccurred), (0, import_rxjs57.map)(function (response) { return response.data; }));
|
|
3106
3265
|
};
|
|
3107
3266
|
class_2.prototype.put = function (path, data, callContext) {
|
|
@@ -3120,7 +3279,6 @@ var import_axios3 = __toESM(require("axios"));
|
|
|
3120
3279
|
var import_rxjs58 = require("rxjs");
|
|
3121
3280
|
var Api = /** @class */ (function () {
|
|
3122
3281
|
function class_3(instance) {
|
|
3123
|
-
this.api$ = new ObservableApiWrapper();
|
|
3124
3282
|
this.api$ = new ObservableApiWrapper(instance);
|
|
3125
3283
|
}
|
|
3126
3284
|
class_3.prototype.routerRequest = function (path, params) {
|
|
@@ -3149,19 +3307,20 @@ var Api = /** @class */ (function () {
|
|
|
3149
3307
|
};
|
|
3150
3308
|
class_3.prototype.newBcData = function (screenName, bcUrl, context, params) {
|
|
3151
3309
|
var url = applyParams(buildUrl(__makeTemplateObject(["row-meta-new/", "/"], ["row-meta-new/", "/"]), screenName) + bcUrl, params);
|
|
3152
|
-
return this.api$.get(url,
|
|
3310
|
+
return this.api$.get(url, void 0, context).pipe((0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3153
3311
|
};
|
|
3154
3312
|
class_3.prototype.saveBcData = function (screenName, bcUrl, data, context, params) {
|
|
3155
3313
|
var url = applyParams(buildUrl(__makeTemplateObject(["data/", "/"], ["data/", "/"]), screenName) + bcUrl, params);
|
|
3156
3314
|
return this.api$.put(url, { data: data }, context).pipe((0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3157
3315
|
};
|
|
3158
3316
|
class_3.prototype.deleteBcData = function (screenName, bcUrl, context, params) {
|
|
3317
|
+
if (bcUrl === void 0) { bcUrl = ""; }
|
|
3159
3318
|
var url = applyParams(buildUrl(__makeTemplateObject(["data/", "/"], ["data/", "/"]), screenName) + bcUrl, params);
|
|
3160
3319
|
return this.api$.delete(url, context).pipe((0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3161
3320
|
};
|
|
3162
3321
|
class_3.prototype.customAction = function (screenName, bcUrl, data, context, params) {
|
|
3163
3322
|
var url = applyParams(buildUrl(__makeTemplateObject(["custom-action/", "/"], ["custom-action/", "/"]), screenName) + bcUrl, params);
|
|
3164
|
-
return this.api$.post(url, { data: data || {} },
|
|
3323
|
+
return this.api$.post(url, { data: data || {} }, void 0, context).pipe((0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3165
3324
|
};
|
|
3166
3325
|
class_3.prototype.associate = function (screenName, bcUrl, data, params) {
|
|
3167
3326
|
var processedData = Array.isArray(data) ? data.map(function (item) { return ({
|
|
@@ -3173,9 +3332,27 @@ var Api = /** @class */ (function () {
|
|
|
3173
3332
|
return this.api$.post(url, processedData).pipe((0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3174
3333
|
};
|
|
3175
3334
|
class_3.prototype.getRmByForceActive = function (screenName, bcUrl, data, params) {
|
|
3176
|
-
var url = applyParams(buildUrl(__makeTemplateObject(["row-meta/", "/"], ["row-meta/", "/"]), screenName) + bcUrl, params);
|
|
3335
|
+
var url = applyParams(buildUrl(__makeTemplateObject(["row-meta/", "/"], ["row-meta/", "/"]), screenName) + (bcUrl !== null && bcUrl !== void 0 ? bcUrl : ""), params);
|
|
3177
3336
|
return this.api$.post(url, { data: data }).pipe((0, import_rxjs58.map)(function (response) { return response.data.row; }));
|
|
3178
3337
|
};
|
|
3338
|
+
Object.defineProperty(class_3.prototype, "fileUploadEndpoint", {
|
|
3339
|
+
/**
|
|
3340
|
+
* Get Cxbox API file upload endpoint based on baseURL of axios instance
|
|
3341
|
+
*
|
|
3342
|
+
* Handles empty baseURL and trailing slash
|
|
3343
|
+
*
|
|
3344
|
+
* @returns File upload endpoint
|
|
3345
|
+
*/
|
|
3346
|
+
get: function () {
|
|
3347
|
+
var instance = this.api$.instance;
|
|
3348
|
+
if (!instance.defaults.baseURL) {
|
|
3349
|
+
return "/file";
|
|
3350
|
+
}
|
|
3351
|
+
return instance.defaults.baseURL.endsWith("/") ? "".concat(instance.defaults.baseURL, "file") : "".concat(instance.defaults.baseURL, "/file");
|
|
3352
|
+
},
|
|
3353
|
+
enumerable: false,
|
|
3354
|
+
configurable: true
|
|
3355
|
+
});
|
|
3179
3356
|
class_3.prototype.refreshMeta = function () {
|
|
3180
3357
|
return this.api$.get(buildUrl(__makeTemplateObject(["bc-registry/refresh-meta"], ["bc-registry/refresh-meta"])));
|
|
3181
3358
|
};
|