@cxbox-ui/core 1.37.2-alpha.6 → 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 +4 -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 +364 -172
- package/dist/cxbox-ui-core.cjs.production.min.js +1 -1
- package/dist/cxbox-ui-core.esm.js +418 -226
- package/dist/cxbox-ui-core.modern.development.js +411 -225
- package/dist/cxbox-ui-core.modern.js +411 -225
- 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/middlewares/requiredFieldsMiddleware.d.ts +1 -1
- 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 +2 -2
- package/package.json +2 -2
|
@@ -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 = [];
|
|
@@ -589,10 +591,9 @@ function getTemplate(literals) {
|
|
|
589
591
|
result += literals[literals.length - 1];
|
|
590
592
|
return result;
|
|
591
593
|
}
|
|
592
|
-
function buildBcUrl(bcName, includeSelf,
|
|
594
|
+
function buildBcUrl(bcName, includeSelf, state) {
|
|
593
595
|
if (includeSelf === void 0) { includeSelf = false; }
|
|
594
|
-
var
|
|
595
|
-
var bcMap = storeInstance.screen.bo.bc;
|
|
596
|
+
var bcMap = state.screen.bo.bc;
|
|
596
597
|
var bc = bcMap[bcName];
|
|
597
598
|
if (!bc) {
|
|
598
599
|
return null;
|
|
@@ -725,7 +726,7 @@ function defaultParseURL(url) {
|
|
|
725
726
|
}
|
|
726
727
|
return {
|
|
727
728
|
type: type,
|
|
728
|
-
path: path,
|
|
729
|
+
path: path.length !== 0 && !path.startsWith("/") ? "/".concat(path) : path,
|
|
729
730
|
params: params,
|
|
730
731
|
screenName: screenName,
|
|
731
732
|
viewName: viewName,
|
|
@@ -773,8 +774,9 @@ function getSorters(sorters) {
|
|
|
773
774
|
return result;
|
|
774
775
|
}
|
|
775
776
|
function parseFilters(defaultFilters) {
|
|
777
|
+
if (defaultFilters === void 0) { defaultFilters = ""; }
|
|
776
778
|
var result = [];
|
|
777
|
-
var urlParams = new URL(defaultFilters).searchParams;
|
|
779
|
+
var urlParams = new URL(defaultFilters, window.location.origin).searchParams;
|
|
778
780
|
urlParams.forEach(function (param) {
|
|
779
781
|
var _a = param.split("."), fieldName = _a[0], type = _a[1];
|
|
780
782
|
if (fieldName && type && urlParams.get(param)) {
|
|
@@ -804,7 +806,7 @@ function parseSorters(sorters) {
|
|
|
804
806
|
return null;
|
|
805
807
|
}
|
|
806
808
|
var result = [];
|
|
807
|
-
var dictionary = new URL(sorters).searchParams;
|
|
809
|
+
var dictionary = new URL(sorters, window.location.origin).searchParams;
|
|
808
810
|
Object.entries(dictionary).map(function (_a) {
|
|
809
811
|
var sort = _a[0], fieldKey = _a[1];
|
|
810
812
|
var _b = sort.split(".").slice(1), order = _b[0], direction = _b[1];
|
|
@@ -883,12 +885,13 @@ function getBcChildren(originBcName, widgets, bcMap) {
|
|
|
883
885
|
return childrenBcMap;
|
|
884
886
|
}
|
|
885
887
|
function getHierarchyChildBc(originBcName, hierarchyWidget) {
|
|
886
|
-
var
|
|
887
|
-
|
|
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))) {
|
|
888
891
|
return [];
|
|
889
892
|
}
|
|
890
|
-
var childHierarchyBcIndex = nestedBcNames.findIndex(function (item) { return item === originBcName; });
|
|
891
|
-
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];
|
|
892
895
|
return [childHierarchyBcName, hierarchyWidget.name];
|
|
893
896
|
}
|
|
894
897
|
function checkShowCondition(condition, cursor, data, pendingDataChanges) {
|
|
@@ -902,9 +905,9 @@ function checkShowCondition(condition, cursor, data, pendingDataChanges) {
|
|
|
902
905
|
if (!record) {
|
|
903
906
|
return false;
|
|
904
907
|
}
|
|
905
|
-
var actualValue = record === null || record === void 0 ? void 0 : record[params.fieldKey];
|
|
906
|
-
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];
|
|
907
|
-
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);
|
|
908
911
|
}
|
|
909
912
|
// src/utils/tree.ts
|
|
910
913
|
function assignTreeLinks(flat) {
|
|
@@ -912,6 +915,7 @@ function assignTreeLinks(flat) {
|
|
|
912
915
|
var map12 = {};
|
|
913
916
|
var orphans = [];
|
|
914
917
|
result.forEach(function (item) {
|
|
918
|
+
var _a, _b;
|
|
915
919
|
if (!item.parentId || item.parentId === "0") {
|
|
916
920
|
return;
|
|
917
921
|
}
|
|
@@ -930,7 +934,7 @@ function assignTreeLinks(flat) {
|
|
|
930
934
|
result[parentIndex].children = [item];
|
|
931
935
|
}
|
|
932
936
|
else {
|
|
933
|
-
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);
|
|
934
938
|
}
|
|
935
939
|
});
|
|
936
940
|
if (orphans.length) {
|
|
@@ -1008,22 +1012,7 @@ function deleteUndefinedFromObject(obj) {
|
|
|
1008
1012
|
}
|
|
1009
1013
|
});
|
|
1010
1014
|
}
|
|
1011
|
-
// src/reducers/router.ts
|
|
1012
|
-
var initialRouterState = { type: "default" /* default */, path: "/", params: null, screenName: null };
|
|
1013
|
-
var createRouterReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(loginDone, function (state, action) {
|
|
1014
|
-
state = __assign(__assign({}, state), action.payload);
|
|
1015
|
-
}).addCase(changeLocation, function (state, action) {
|
|
1016
|
-
var _a = action.payload, url = _a.url, route = _a.route;
|
|
1017
|
-
if (url) {
|
|
1018
|
-
var path = new URL(url);
|
|
1019
|
-
state = __assign(__assign({}, state), defaultParseURL(path));
|
|
1020
|
-
}
|
|
1021
|
-
if (route !== null) {
|
|
1022
|
-
state = __assign(__assign({}, state), route);
|
|
1023
|
-
}
|
|
1024
|
-
}); };
|
|
1025
1015
|
// src/reducers/screen.ts
|
|
1026
|
-
var import_schema6 = require("@cxbox-ui/schema");
|
|
1027
1016
|
var initialScreenState = {
|
|
1028
1017
|
screenName: "",
|
|
1029
1018
|
bo: { activeBcName: "", bc: {} },
|
|
@@ -1035,10 +1024,11 @@ var initialScreenState = {
|
|
|
1035
1024
|
};
|
|
1036
1025
|
var operationsHandledLocally = [import_schema6.OperationTypeCrud.associate, import_schema6.OperationTypeCrud.fileUpload];
|
|
1037
1026
|
var createScreenReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(selectScreen, function (state, action) {
|
|
1027
|
+
var _a, _b, _c, _d, _e;
|
|
1038
1028
|
var bcDictionary = {};
|
|
1039
1029
|
var bcSorters = {};
|
|
1040
1030
|
var bcFilters = {};
|
|
1041
|
-
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) {
|
|
1042
1032
|
bcDictionary[item.name] = item;
|
|
1043
1033
|
var sorter = parseSorters(item.defaultSort);
|
|
1044
1034
|
var filter56 = parseFilters(item.defaultFilter);
|
|
@@ -1050,8 +1040,8 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1050
1040
|
}
|
|
1051
1041
|
});
|
|
1052
1042
|
state.screenName = action.payload.screen.name;
|
|
1053
|
-
state.primaryView = action.payload.screen.meta.primary;
|
|
1054
|
-
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;
|
|
1055
1045
|
state.bo = { activeBcName: null, bc: bcDictionary };
|
|
1056
1046
|
state.sorters = __assign(__assign({}, state.sorters), bcSorters);
|
|
1057
1047
|
state.filters = __assign(__assign({}, state.filters), bcFilters);
|
|
@@ -1061,12 +1051,14 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1061
1051
|
}).addCase(bcFetchDataRequest, function (state, action) {
|
|
1062
1052
|
state.bo.bc[action.payload.bcName].loading = true;
|
|
1063
1053
|
}).addCase(bcLoadMore, function (state, action) {
|
|
1054
|
+
var _a;
|
|
1064
1055
|
var currentBc = state.bo.bc[action.payload.bcName];
|
|
1065
|
-
currentBc.page
|
|
1056
|
+
currentBc.page = ((_a = currentBc.page) !== null && _a !== void 0 ? _a : 1) + 1;
|
|
1066
1057
|
currentBc.loading = true;
|
|
1067
1058
|
}).addCase(selectView, function (state, action) {
|
|
1059
|
+
var _a;
|
|
1068
1060
|
var newBcs = {};
|
|
1069
|
-
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; }))
|
|
1070
1062
|
// БК которые есть на вьюхе
|
|
1071
1063
|
).filter(function (bcName) { return state.bo.bc[bcName]; }).forEach(function (bcName) {
|
|
1072
1064
|
newBcs[bcName] = __assign(__assign({}, state.bo.bc[bcName]), { page: 1 });
|
|
@@ -1078,9 +1070,10 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1078
1070
|
currentBc.loading = false;
|
|
1079
1071
|
state.cachedBc[action.payload.bcName] = action.payload.bcUrl;
|
|
1080
1072
|
}).addCase(bcFetchDataFail, function (state, action) {
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
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;
|
|
1084
1077
|
}
|
|
1085
1078
|
}).addCase(sendOperation, function (state, action) {
|
|
1086
1079
|
if (!operationsHandledLocally.includes(action.payload.operationType)) {
|
|
@@ -1108,10 +1101,12 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
|
|
|
1108
1101
|
Object.assign(state.bo.bc, newCursors);
|
|
1109
1102
|
Object.assign(state.cachedBc, newCache);
|
|
1110
1103
|
}).addCase(bcChangeDepthCursor, function (state, action) {
|
|
1104
|
+
var _a;
|
|
1111
1105
|
if (action.payload.depth === 1) {
|
|
1112
1106
|
state.bo.bc[action.payload.bcName].cursor = action.payload.cursor;
|
|
1113
1107
|
}
|
|
1114
1108
|
else {
|
|
1109
|
+
state.bo.bc[action.payload.bcName].depthBc = (_a = state.bo.bc[action.payload.bcName].depthBc) !== null && _a !== void 0 ? _a : {};
|
|
1115
1110
|
state.bo.bc[action.payload.bcName].depthBc[action.payload.depth].cursor = action.payload.cursor;
|
|
1116
1111
|
}
|
|
1117
1112
|
}).addCase(bcSelectRecord, function (state, action) {
|
|
@@ -1196,9 +1191,11 @@ var createSessionReducerBuilderManager = function (initialState) { return new Re
|
|
|
1196
1191
|
}).addCase(switchDebugMode, function (state, action) {
|
|
1197
1192
|
state.debugMode = action.payload;
|
|
1198
1193
|
}).addCase(addPendingRequest, function (state, action) {
|
|
1199
|
-
|
|
1194
|
+
var _a;
|
|
1195
|
+
(_a = state.pendingRequests) === null || _a === void 0 ? void 0 : _a.push(action.payload.request);
|
|
1200
1196
|
}).addCase(removePendingRequest, function (state, action) {
|
|
1201
|
-
|
|
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; });
|
|
1202
1199
|
}).addCase(addNotification, function (state, action) {
|
|
1203
1200
|
state.notifications.push(action.payload);
|
|
1204
1201
|
}).addCase(removeNotifications, function (state, action) {
|
|
@@ -1245,12 +1242,15 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1245
1242
|
state.metaInProgress[action.payload.bcName] = true;
|
|
1246
1243
|
}
|
|
1247
1244
|
}).addCase(bcFetchRowMetaSuccess, function (state, action) {
|
|
1245
|
+
var _a;
|
|
1246
|
+
state.rowMeta[action.payload.bcName] = (_a = state.rowMeta[action.payload.bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1248
1247
|
state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
|
|
1249
1248
|
state.metaInProgress[action.payload.bcName] = false;
|
|
1250
1249
|
}).addCase(bcNewDataSuccess, function (state, action) {
|
|
1251
1250
|
state.selectedCell = initialViewState.selectedCell;
|
|
1252
1251
|
}).addCase(forceActiveRmUpdate, function (state, action) {
|
|
1253
|
-
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;
|
|
1254
1254
|
var handledForceActive = {};
|
|
1255
1255
|
var rowMetaForcedValues = {};
|
|
1256
1256
|
var newPendingChangesDiff = {};
|
|
@@ -1273,17 +1273,21 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1273
1273
|
handledForceActive[key] = newPendingDataChanges[key];
|
|
1274
1274
|
}
|
|
1275
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 : {};
|
|
1276
1278
|
Object.assign(state.handledForceActive[bcName][cursor], handledForceActive);
|
|
1279
|
+
state.pendingDataChanges[bcName] = (_c = state.pendingDataChanges[bcName]) !== null && _c !== void 0 ? _c : {};
|
|
1277
1280
|
state.pendingDataChanges[bcName][cursor] = newPendingDataChanges;
|
|
1281
|
+
state.rowMeta[bcName] = (_d = state.rowMeta[bcName]) !== null && _d !== void 0 ? _d : {};
|
|
1278
1282
|
state.rowMeta[bcName][bcUrl] = rowMeta;
|
|
1279
1283
|
}).addCase(changeDataItem, function (state, action) {
|
|
1280
|
-
var _a;
|
|
1284
|
+
var _a, _b, _c;
|
|
1281
1285
|
var actionBcName = action.payload.bcName;
|
|
1282
1286
|
var prevBc = state.pendingDataChanges[action.payload.bcName] || {};
|
|
1283
1287
|
var prevCursor = prevBc[action.payload.cursor] || {};
|
|
1284
1288
|
var prevPending = prevCursor || {};
|
|
1285
1289
|
var nextPending = __assign(__assign({}, prevPending), action.payload.dataItem);
|
|
1286
|
-
var bcUrl =
|
|
1290
|
+
var bcUrl = action.payload.bcUrl;
|
|
1287
1291
|
var rowMeta = (_a = state.rowMeta[actionBcName]) === null || _a === void 0 ? void 0 : _a[bcUrl];
|
|
1288
1292
|
var nextValidationFails = {};
|
|
1289
1293
|
var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
@@ -1294,10 +1298,11 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1294
1298
|
nextValidationFails[fieldKey] = "This field is mandatory";
|
|
1295
1299
|
}
|
|
1296
1300
|
});
|
|
1301
|
+
state.pendingDataChanges[action.payload.bcName] = (_b = state.pendingDataChanges[action.payload.bcName]) !== null && _b !== void 0 ? _b : {};
|
|
1297
1302
|
state.pendingDataChanges[action.payload.bcName][action.payload.cursor] = nextPending;
|
|
1298
1303
|
if (isTargetFormatPVF) {
|
|
1299
1304
|
;
|
|
1300
|
-
state.pendingValidationFails[actionBcName][action.payload.cursor] = nextValidationFails;
|
|
1305
|
+
((_c = state.pendingValidationFails) === null || _c === void 0 ? void 0 : _c[actionBcName])[action.payload.cursor] = nextValidationFails;
|
|
1301
1306
|
}
|
|
1302
1307
|
else {
|
|
1303
1308
|
state.pendingValidationFails = nextValidationFails;
|
|
@@ -1318,7 +1323,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1318
1323
|
pendingDataChanges[bcName] = pendingBcChanges;
|
|
1319
1324
|
});
|
|
1320
1325
|
var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1321
|
-
var pendingValidationFails = __assign({}, state.pendingValidationFails);
|
|
1326
|
+
var pendingValidationFails = state.pendingValidationFails ? __assign({}, state.pendingValidationFails) : {};
|
|
1322
1327
|
if (isTargetFormatPVF) {
|
|
1323
1328
|
action.payload.bcNames.forEach(function (i) {
|
|
1324
1329
|
pendingValidationFails[i] = {};
|
|
@@ -1333,7 +1338,8 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1333
1338
|
}).addCase(bcFetchRowMetaFail, function (state, action) {
|
|
1334
1339
|
state.metaInProgress[action.payload.bcName] = false;
|
|
1335
1340
|
}).addCase(forceActiveChangeFail, function (state, action) {
|
|
1336
|
-
var _a
|
|
1341
|
+
var _a;
|
|
1342
|
+
var _b = action.payload, bcName = _b.bcName, bcUrl = _b.bcUrl, entityError = _b.entityError;
|
|
1337
1343
|
var errors = {};
|
|
1338
1344
|
if (entityError) {
|
|
1339
1345
|
Object.entries(entityError.fields).forEach(function (_a) {
|
|
@@ -1341,9 +1347,11 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1341
1347
|
errors[fieldName] = violation;
|
|
1342
1348
|
});
|
|
1343
1349
|
}
|
|
1350
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1344
1351
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1345
1352
|
}).addCase(bcSaveDataFail, function (state, action) {
|
|
1346
|
-
var _a
|
|
1353
|
+
var _a;
|
|
1354
|
+
var _b = action.payload, bcName = _b.bcName, bcUrl = _b.bcUrl, entityError = _b.entityError;
|
|
1347
1355
|
var errors = {};
|
|
1348
1356
|
if (entityError) {
|
|
1349
1357
|
Object.entries(entityError.fields).forEach(function (_a) {
|
|
@@ -1351,9 +1359,11 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1351
1359
|
errors[fieldName] = violation;
|
|
1352
1360
|
});
|
|
1353
1361
|
}
|
|
1362
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1354
1363
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1355
1364
|
}).addCase(sendOperationFail, function (state, action) {
|
|
1356
|
-
var _a
|
|
1365
|
+
var _a;
|
|
1366
|
+
var _b = action.payload, bcName = _b.bcName, bcUrl = _b.bcUrl, entityError = _b.entityError;
|
|
1357
1367
|
var errors = {};
|
|
1358
1368
|
if (entityError) {
|
|
1359
1369
|
Object.entries(entityError.fields).forEach(function (_a) {
|
|
@@ -1361,30 +1371,38 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1361
1371
|
errors[fieldName] = violation;
|
|
1362
1372
|
});
|
|
1363
1373
|
}
|
|
1374
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1364
1375
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1365
1376
|
}).addCase(sendOperationSuccess, function (state, action) {
|
|
1366
|
-
var _a
|
|
1377
|
+
var _a, _b, _c;
|
|
1378
|
+
var bcName = action.payload.bcName;
|
|
1379
|
+
var cursor = action.payload.cursor;
|
|
1367
1380
|
var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1381
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1368
1382
|
state.pendingDataChanges[bcName][cursor] = {};
|
|
1369
1383
|
if (isTargetFormatPVF) {
|
|
1370
1384
|
;
|
|
1371
|
-
state.pendingValidationFails[bcName][cursor] = {};
|
|
1385
|
+
((_b = state.pendingValidationFails) === null || _b === void 0 ? void 0 : _b[bcName])[cursor] = {};
|
|
1372
1386
|
}
|
|
1373
1387
|
else {
|
|
1374
1388
|
state.pendingValidationFails = initialViewState.pendingValidationFails;
|
|
1375
1389
|
}
|
|
1390
|
+
state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) !== null && _c !== void 0 ? _c : {};
|
|
1376
1391
|
state.handledForceActive[bcName][cursor] = {};
|
|
1377
1392
|
}).addCase(bcSaveDataSuccess, function (state, action) {
|
|
1378
|
-
var _a
|
|
1393
|
+
var _a, _b, _c;
|
|
1394
|
+
var _d = action.payload, bcName = _d.bcName, cursor = _d.cursor;
|
|
1379
1395
|
var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1396
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) !== null && _a !== void 0 ? _a : {};
|
|
1380
1397
|
state.pendingDataChanges[bcName][cursor] = {};
|
|
1381
1398
|
if (isTargetFormatPVF) {
|
|
1382
1399
|
;
|
|
1383
|
-
state.pendingValidationFails[bcName][cursor] = {};
|
|
1400
|
+
((_b = state.pendingValidationFails) === null || _b === void 0 ? void 0 : _b[bcName])[cursor] = {};
|
|
1384
1401
|
}
|
|
1385
1402
|
else {
|
|
1386
1403
|
state.pendingValidationFails = initialViewState.pendingValidationFails;
|
|
1387
1404
|
}
|
|
1405
|
+
state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) !== null && _c !== void 0 ? _c : {};
|
|
1388
1406
|
state.handledForceActive[bcName][cursor] = {};
|
|
1389
1407
|
}).addCase(bcCancelPendingChanges, function (state, action) {
|
|
1390
1408
|
var _a, _b;
|
|
@@ -1395,7 +1413,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1395
1413
|
}
|
|
1396
1414
|
}
|
|
1397
1415
|
var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1398
|
-
var pendingValidationFails = __assign({}, state.pendingValidationFails);
|
|
1416
|
+
var pendingValidationFails = state.pendingValidationFails ? __assign({}, state.pendingValidationFails) : {};
|
|
1399
1417
|
if (isTargetFormatPVF) {
|
|
1400
1418
|
if (((_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.bcNames) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
1401
1419
|
action.payload.bcNames.forEach(function (i) {
|
|
@@ -1424,8 +1442,8 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1424
1442
|
isFilter: isFilter
|
|
1425
1443
|
};
|
|
1426
1444
|
}).addCase(showFileUploadPopup, function (state, action) {
|
|
1427
|
-
var _a;
|
|
1428
|
-
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;
|
|
1429
1447
|
state.popupData = {
|
|
1430
1448
|
type: "file-upload",
|
|
1431
1449
|
bcName: bcName,
|
|
@@ -1437,6 +1455,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1437
1455
|
}).addCase(viewClearPickMap, function (state) {
|
|
1438
1456
|
state.pickMap = null;
|
|
1439
1457
|
}).addCase(closeViewPopup, function (state) {
|
|
1458
|
+
state.popupData = {};
|
|
1440
1459
|
state.popupData.bcName = null;
|
|
1441
1460
|
}).addCase(selectTableCell, function (state, action) {
|
|
1442
1461
|
state.selectedCell = { widgetName: action.payload.widgetName, rowId: action.payload.rowId, fieldKey: action.payload.fieldKey };
|
|
@@ -1444,12 +1463,16 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
|
|
|
1444
1463
|
state.pendingDataChanges = initialViewState.pendingDataChanges;
|
|
1445
1464
|
state.selectedCell = initialViewState.selectedCell;
|
|
1446
1465
|
}).addCase(showNotification, function (state, action) {
|
|
1466
|
+
var _a, _b;
|
|
1467
|
+
state.systemNotifications = (_a = state.systemNotifications) !== null && _a !== void 0 ? _a : [];
|
|
1447
1468
|
state.systemNotifications.push({
|
|
1448
1469
|
type: action.payload.type,
|
|
1449
1470
|
message: action.payload.message,
|
|
1450
|
-
id: state.systemNotifications.length
|
|
1471
|
+
id: (_b = state.systemNotifications) === null || _b === void 0 ? void 0 : _b.length
|
|
1451
1472
|
});
|
|
1452
1473
|
}).addCase(closeNotification, function (state, action) {
|
|
1474
|
+
var _a;
|
|
1475
|
+
state.systemNotifications = (_a = state.systemNotifications) !== null && _a !== void 0 ? _a : [];
|
|
1453
1476
|
state.systemNotifications = state.systemNotifications.filter(function (item) { return item.id !== action.payload.id; });
|
|
1454
1477
|
}).addCase(showViewError, function (state, action) {
|
|
1455
1478
|
state.error = action.payload.error;
|
|
@@ -1557,7 +1580,7 @@ var sendOperationEpic = function (action$, state$, _a) {
|
|
|
1557
1580
|
var screenName = state.screen.screenName;
|
|
1558
1581
|
var _l = action.payload, bcName = _l.bcName, operationType = _l.operationType, widgetName = _l.widgetName;
|
|
1559
1582
|
var confirm = ((_a = action.payload.confirmOperation) === null || _a === void 0 ? void 0 : _a.type) || action.payload.confirm;
|
|
1560
|
-
var bcUrl = buildBcUrl(bcName, true);
|
|
1583
|
+
var bcUrl = buildBcUrl(bcName, true, state);
|
|
1561
1584
|
var bc = state.screen.bo.bc[bcName];
|
|
1562
1585
|
var rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) === null || _b === void 0 ? void 0 : _b[bcUrl]);
|
|
1563
1586
|
var fields = rowMeta === null || rowMeta === void 0 ? void 0 : rowMeta.fields;
|
|
@@ -1582,10 +1605,10 @@ var sendOperationEpic = function (action$, state$, _a) {
|
|
|
1582
1605
|
}
|
|
1583
1606
|
var context = { widgetName: action.payload.widgetName };
|
|
1584
1607
|
return api.customAction(screenName, bcUrl, data, context, params).pipe((0, import_rxjs2.mergeMap)(function (response) {
|
|
1585
|
-
var _a;
|
|
1586
|
-
var postInvoke = response.postActions[0];
|
|
1608
|
+
var _a, _b;
|
|
1609
|
+
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
1587
1610
|
var preInvoke = response.preInvoke;
|
|
1588
|
-
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 })),
|
|
1589
1612
|
(0, import_rxjs2.of)(bcForceUpdate({ bcName: bcName }))], postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName), false));
|
|
1590
1613
|
}), (0, import_rxjs2.catchError)(function (e) {
|
|
1591
1614
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -1650,16 +1673,17 @@ var import_schema9 = require("@cxbox-ui/schema");
|
|
|
1650
1673
|
var fileUploadConfirmEpic = function (action$, state$, _a) {
|
|
1651
1674
|
var api = _a.api;
|
|
1652
1675
|
return action$.pipe((0, import_rxjs4.filter)(bulkUploadFiles.match), (0, import_rxjs4.mergeMap)(function (action) {
|
|
1653
|
-
var _a;
|
|
1676
|
+
var _a, _b;
|
|
1654
1677
|
var state = state$.value;
|
|
1655
|
-
var bcName = state.view.popupData.bcName;
|
|
1656
|
-
var bcUrl = buildBcUrl(bcName, true);
|
|
1657
|
-
var widgetName = (
|
|
1678
|
+
var bcName = (_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.bcName;
|
|
1679
|
+
var bcUrl = buildBcUrl(bcName, true, state);
|
|
1680
|
+
var widgetName = (_b = state.view.widgets.find(function (item) { return item.bcName === bcName; })) === null || _b === void 0 ? void 0 : _b.name;
|
|
1658
1681
|
var data = {
|
|
1659
1682
|
bulkIds: action.payload.fileIds
|
|
1660
1683
|
};
|
|
1661
1684
|
return api.customAction(state.screen.screenName, bcUrl, data, null, { _action: "file-upload-save" }).pipe((0, import_rxjs4.mergeMap)(function (response) {
|
|
1662
|
-
var
|
|
1685
|
+
var _a;
|
|
1686
|
+
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
1663
1687
|
var preInvoke = response.preInvoke;
|
|
1664
1688
|
return (0, import_rxjs4.concat).apply(void 0, __spreadArray([(0, import_rxjs4.of)(sendOperationSuccess({ bcName: bcName, cursor: null })),
|
|
1665
1689
|
(0, import_rxjs4.of)(bcForceUpdate({ bcName: bcName })),
|
|
@@ -1675,14 +1699,14 @@ var selectTableCellInitEpic = function (action$, state$) { return action$.pipe((
|
|
|
1675
1699
|
var state = state$.value;
|
|
1676
1700
|
var _b = action.payload, nextRowId = _b.rowId, fieldKey = _b.fieldKey;
|
|
1677
1701
|
var nextWidget = state.view.widgets.find(function (widget) { return widget.name === action.payload.widgetName; });
|
|
1678
|
-
var nextBcName = nextWidget.bcName;
|
|
1702
|
+
var nextBcName = nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.bcName;
|
|
1679
1703
|
var nextBcCursor = (_a = state.screen.bo.bc[nextBcName]) === null || _a === void 0 ? void 0 : _a.cursor;
|
|
1680
1704
|
var selectedCell = state.view.selectedCell;
|
|
1681
1705
|
if (nextRowId !== nextBcCursor) {
|
|
1682
1706
|
resultObservables.push((0, import_rxjs5.of)(bcSelectRecord({ bcName: nextBcName, cursor: nextRowId })));
|
|
1683
1707
|
}
|
|
1684
|
-
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || nextWidget.name !== selectedCell.widgetName) {
|
|
1685
|
-
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 })));
|
|
1686
1710
|
}
|
|
1687
1711
|
return (0, import_rxjs5.concat).apply(void 0, resultObservables);
|
|
1688
1712
|
})); };
|
|
@@ -1724,13 +1748,13 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1724
1748
|
return import_rxjs8.EMPTY;
|
|
1725
1749
|
}
|
|
1726
1750
|
var isPickListPopup = state.view.widgets.find(function (item) { var _a; return item.name === ((_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.widgetName) && [import_schema12.WidgetTypes.PickListPopup, import_schema12.WidgetTypes.FlatTreePopup].includes(item.type); });
|
|
1727
|
-
var bcUrl = buildBcUrl(bcName, true);
|
|
1751
|
+
var bcUrl = buildBcUrl(bcName, true, state);
|
|
1728
1752
|
var pendingChanges = state.view.pendingDataChanges[bcName][cursor];
|
|
1729
1753
|
var handledForceActive = ((_a = state.view.handledForceActive[bcName]) === null || _a === void 0 ? void 0 : _a[cursor]) || {};
|
|
1730
1754
|
var currentRecordData = (_b = state.data[bcName]) === null || _b === void 0 ? void 0 : _b.find(function (record) { return record.id === cursor; });
|
|
1731
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;
|
|
1732
1756
|
var changedFiledKey = null;
|
|
1733
|
-
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 })));
|
|
1734
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) {
|
|
1735
1759
|
var result = pendingChanges[field.key] !== handledForceActive[field.key];
|
|
1736
1760
|
if (result) {
|
|
@@ -1740,7 +1764,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1740
1764
|
});
|
|
1741
1765
|
var requestId = (0, import_toolkit2.nanoid)();
|
|
1742
1766
|
if (someForceActiveChanged && !disableRetry) {
|
|
1743
|
-
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) {
|
|
1744
1768
|
var result = [(0, import_rxjs8.of)(removePendingRequest({ requestId: requestId }))];
|
|
1745
1769
|
if (state.view.url === initUrl) {
|
|
1746
1770
|
result.push((0, import_rxjs8.of)(forceActiveRmUpdate({
|
|
@@ -1768,8 +1792,9 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
|
|
|
1768
1792
|
}
|
|
1769
1793
|
return (0, import_rxjs8.concat)((0, import_rxjs8.of)(removePendingRequest({ requestId: requestId })), state.view.url === initUrl ? (0, import_rxjs8.concat)((0, import_rxjs8.of)(changeDataItem({
|
|
1770
1794
|
bcName: bcName,
|
|
1795
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
1771
1796
|
cursor: cursor,
|
|
1772
|
-
dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData[changedFiledKey], _a),
|
|
1797
|
+
dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData === null || currentRecordData === void 0 ? void 0 : currentRecordData[changedFiledKey], _a),
|
|
1773
1798
|
disableRetry: true
|
|
1774
1799
|
})), (0, import_rxjs8.of)(forceActiveChangeFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError }))) : import_rxjs8.EMPTY);
|
|
1775
1800
|
})));
|
|
@@ -1782,9 +1807,14 @@ var import_rxjs9 = require("rxjs");
|
|
|
1782
1807
|
var showAllTableRecordsInitEpic = function (action$, state$) { return action$.pipe((0, import_rxjs9.filter)(showAllTableRecordsInit.match), (0, import_rxjs9.mergeMap)(function (action) {
|
|
1783
1808
|
var _a;
|
|
1784
1809
|
var resultObservables = [];
|
|
1785
|
-
var
|
|
1810
|
+
var _b = action.payload, bcName = _b.bcName, cursor = _b.cursor;
|
|
1811
|
+
var state = state$.value;
|
|
1812
|
+
var route = state.router;
|
|
1786
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 }));
|
|
1787
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)) })));
|
|
1788
1818
|
return (0, import_rxjs9.concat).apply(void 0, resultObservables);
|
|
1789
1819
|
})); };
|
|
1790
1820
|
// src/epics/view/clearPendingDataChangesAfterCursorChangeEpic.ts
|
|
@@ -1808,8 +1838,108 @@ var clearPendingDataChangesAfterCursorChangeEpic = function (action$, state$) {
|
|
|
1808
1838
|
// src/epics/router/drilldownEpic.ts
|
|
1809
1839
|
var import_rxjs11 = require("rxjs");
|
|
1810
1840
|
var drillDownEpic = function (action$, state$) { return action$.pipe((0, import_rxjs11.filter)(drillDown.match), (0, import_rxjs11.switchMap)(function (action) {
|
|
1811
|
-
|
|
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;
|
|
1812
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
|
+
}
|
|
1813
1943
|
// src/epics/router/loginDoneEpic.ts
|
|
1814
1944
|
var import_rxjs12 = require("rxjs");
|
|
1815
1945
|
var loginDoneEpic = function (action$, state$) { return action$.pipe((0, import_rxjs12.filter)(loginDone.match), (0, import_rxjs12.switchMap)(function (action) {
|
|
@@ -1871,14 +2001,14 @@ var userDrillDownEpic = function (action$, state$, _a) {
|
|
|
1871
2001
|
return action$.pipe((0, import_rxjs16.filter)(userDrillDown.match), (0, import_rxjs16.switchMap)(function (action) {
|
|
1872
2002
|
var state = state$.value;
|
|
1873
2003
|
var _a = action.payload, bcName = _a.bcName, fieldKey = _a.fieldKey, cursor = _a.cursor;
|
|
1874
|
-
var bcUrl = buildBcUrl(bcName, true);
|
|
2004
|
+
var bcUrl = buildBcUrl(bcName, true, state);
|
|
1875
2005
|
return api.fetchRowMeta(state.screen.screenName, bcUrl).pipe((0, import_rxjs16.mergeMap)(function (rowMeta) {
|
|
1876
2006
|
var _a, _b, _c, _d;
|
|
1877
2007
|
var drillDownField = rowMeta.fields.find(function (field) { return field.key === fieldKey; });
|
|
1878
2008
|
var route = state.router;
|
|
1879
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;
|
|
1880
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];
|
|
1881
|
-
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({
|
|
1882
2012
|
url: customDrillDownUrl || drillDownField.drillDown,
|
|
1883
2013
|
drillDownType: drillDownField.drillDownType,
|
|
1884
2014
|
route: route
|
|
@@ -1969,7 +2099,7 @@ var userDrillDownChangeCursorsEpic = function (action$, state$) { return action$
|
|
|
1969
2099
|
if (cursor !== action.payload.cursor) {
|
|
1970
2100
|
return bcChangeCursors({ cursorsMap: (_a = {}, _a[action.payload.bcName] = action.payload.cursor, _a) });
|
|
1971
2101
|
}
|
|
1972
|
-
return
|
|
2102
|
+
return emptyAction;
|
|
1973
2103
|
})); };
|
|
1974
2104
|
// src/epics/screen/apiErrorEpic.ts
|
|
1975
2105
|
var import_axios = __toESM(require("axios"));
|
|
@@ -1997,7 +2127,9 @@ var import_rxjs22 = require("rxjs");
|
|
|
1997
2127
|
var downloadFileEpic = function (action$, state$, _a) {
|
|
1998
2128
|
var api = _a.api;
|
|
1999
2129
|
return action$.pipe((0, import_rxjs22.filter)(downloadFile.match), (0, import_rxjs22.tap)(function (action) {
|
|
2130
|
+
var fileId = action.payload.fileId;
|
|
2000
2131
|
var anchor = document.createElement("a");
|
|
2132
|
+
anchor.href = "".concat(api.fileUploadEndpoint, "?id=").concat(encodeURIComponent(fileId));
|
|
2001
2133
|
anchor.style.display = "none";
|
|
2002
2134
|
document.body.appendChild(anchor);
|
|
2003
2135
|
setTimeout(function () {
|
|
@@ -2014,8 +2146,8 @@ var httpError401Epic = function (action$) { return action$.pipe((0, import_rxjs2
|
|
|
2014
2146
|
// src/epics/screen/httpError409Epic.ts
|
|
2015
2147
|
var import_rxjs24 = require("rxjs");
|
|
2016
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) {
|
|
2017
|
-
var _a, _b;
|
|
2018
|
-
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]) || "";
|
|
2019
2151
|
return addNotification({
|
|
2020
2152
|
key: "action_edit_error",
|
|
2021
2153
|
message: notificationMessage,
|
|
@@ -2031,10 +2163,10 @@ var httpError409Epic = function (action$, state$) { return action$.pipe((0, impo
|
|
|
2031
2163
|
// src/epics/screen/httpError418Epic.ts
|
|
2032
2164
|
var import_rxjs25 = require("rxjs");
|
|
2033
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) {
|
|
2034
|
-
var _a;
|
|
2035
|
-
var
|
|
2166
|
+
var _a, _b;
|
|
2167
|
+
var _c = action.payload, error = _c.error, callContext = _c.callContext;
|
|
2036
2168
|
var result = [];
|
|
2037
|
-
var typedError = error.response.data;
|
|
2169
|
+
var typedError = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2038
2170
|
if (!typedError.error.popup) {
|
|
2039
2171
|
return import_rxjs25.EMPTY;
|
|
2040
2172
|
}
|
|
@@ -2043,13 +2175,13 @@ var httpError418Epic = function (action$, state$) { return action$.pipe((0, impo
|
|
|
2043
2175
|
message: typedError.error.popup[0]
|
|
2044
2176
|
};
|
|
2045
2177
|
result.push((0, import_rxjs25.of)(showViewError({ error: businessError })));
|
|
2046
|
-
if ((
|
|
2178
|
+
if ((_b = typedError.error.postActions) === null || _b === void 0 ? void 0 : _b[0]) {
|
|
2047
2179
|
var widget = state$.value.view.widgets.find(function (item) { return item.name === callContext.widgetName; });
|
|
2048
|
-
var bcName = widget.bcName;
|
|
2180
|
+
var bcName = widget === null || widget === void 0 ? void 0 : widget.bcName;
|
|
2049
2181
|
result.push((0, import_rxjs25.of)(processPostInvoke({
|
|
2050
2182
|
bcName: bcName,
|
|
2051
2183
|
postInvoke: typedError.error.postActions[0],
|
|
2052
|
-
widgetName: widget.name
|
|
2184
|
+
widgetName: widget === null || widget === void 0 ? void 0 : widget.name
|
|
2053
2185
|
})));
|
|
2054
2186
|
}
|
|
2055
2187
|
return (0, import_rxjs25.concat).apply(void 0, result);
|
|
@@ -2069,10 +2201,11 @@ var httpError500Epic = function (action$, state$) { return action$.pipe((0, impo
|
|
|
2069
2201
|
var import_rxjs27 = require("rxjs");
|
|
2070
2202
|
var knownHttpErrors = [401, 409, 418, 500];
|
|
2071
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;
|
|
2072
2205
|
var businessError = {
|
|
2073
2206
|
type: 0 /* BusinessError */,
|
|
2074
|
-
code: action.payload.error.response.status,
|
|
2075
|
-
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
|
|
2076
2209
|
};
|
|
2077
2210
|
return showViewError({ error: businessError });
|
|
2078
2211
|
})); };
|
|
@@ -2093,6 +2226,7 @@ var downloadFileByUrlEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2093
2226
|
var import_rxjs29 = require("rxjs");
|
|
2094
2227
|
var processPostInvokeEpic = function (action$, state$) { return action$.pipe((0, import_rxjs29.filter)(processPostInvoke.match), (0, import_rxjs29.mergeMap)(function (action) {
|
|
2095
2228
|
var _a;
|
|
2229
|
+
var _b;
|
|
2096
2230
|
var state = state$.value;
|
|
2097
2231
|
switch (action.payload.postInvoke.type) {
|
|
2098
2232
|
case "drillDown" /* drillDown */:
|
|
@@ -2100,7 +2234,10 @@ var processPostInvokeEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2100
2234
|
case "postDelete" /* postDelete */: {
|
|
2101
2235
|
var cursorsMap = (_a = {}, _a[action.payload.bcName] = null, _a);
|
|
2102
2236
|
var result = [bcChangeCursors({ cursorsMap: cursorsMap })];
|
|
2103
|
-
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)) }));
|
|
2104
2241
|
}
|
|
2105
2242
|
else {
|
|
2106
2243
|
result.push(bcFetchDataRequest({
|
|
@@ -2185,8 +2322,7 @@ var refreshMetaEpic = function (action$, state$, _a) {
|
|
|
2185
2322
|
logoutDone(null),
|
|
2186
2323
|
login({ login: "", password: "", role: activeRole }),
|
|
2187
2324
|
changeLocation({
|
|
2188
|
-
|
|
2189
|
-
action: "PUSH"
|
|
2325
|
+
location: router
|
|
2190
2326
|
})
|
|
2191
2327
|
]); }), (0, import_rxjs32.catchError)(function (error) { return (0, import_rxjs32.of)(loginFail(error)); }));
|
|
2192
2328
|
}));
|
|
@@ -2207,9 +2343,26 @@ var loginByAnotherRoleEpic = function (action$, state$, _a) {
|
|
|
2207
2343
|
var role = (_a = action.payload.role) !== null && _a !== void 0 ? _a : "";
|
|
2208
2344
|
var isSwitchRole = role && role !== state$.value.session.activeRole;
|
|
2209
2345
|
return api.loginByRoleRequest(role).pipe((0, import_rxjs34.mergeMap)(function (data) {
|
|
2346
|
+
var _a;
|
|
2347
|
+
var result = [];
|
|
2210
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)) }));
|
|
2211
2354
|
}
|
|
2212
|
-
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));
|
|
2213
2366
|
}), (0, import_rxjs34.catchError)(function (error) {
|
|
2214
2367
|
console.error(error);
|
|
2215
2368
|
var errorMsg = error.response ? responseStatusMessages[error.response.status] || "Server application unavailable" : "Empty server response";
|
|
@@ -2226,21 +2379,24 @@ var import_schema13 = require("@cxbox-ui/schema");
|
|
|
2226
2379
|
var bcNewDataEpic = function (action$, state$, _a) {
|
|
2227
2380
|
var api = _a.api;
|
|
2228
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;
|
|
2229
2383
|
var state = state$.value;
|
|
2230
2384
|
var bcName = action.payload.bcName;
|
|
2231
|
-
var bcUrl = buildBcUrl(bcName);
|
|
2385
|
+
var bcUrl = (_a = buildBcUrl(bcName, false, state)) !== null && _a !== void 0 ? _a : "";
|
|
2232
2386
|
var context = { widgetName: action.payload.widgetName };
|
|
2233
2387
|
var params = { _action: action.payload.operationType };
|
|
2234
2388
|
return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe((0, import_rxjs36.mergeMap)(function (data) {
|
|
2389
|
+
var _a, _b;
|
|
2235
2390
|
var rowMeta = data.row;
|
|
2236
2391
|
var dataItem = { id: null, vstamp: -1 };
|
|
2237
2392
|
data.row.fields.forEach(function (field) {
|
|
2238
2393
|
dataItem[field.key] = field.currentValue;
|
|
2239
2394
|
});
|
|
2240
|
-
var postInvoke = data.postActions[0];
|
|
2395
|
+
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2241
2396
|
var cursor = dataItem.id;
|
|
2242
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({
|
|
2243
|
-
bcName:
|
|
2398
|
+
bcName: bcName,
|
|
2399
|
+
bcUrl: (_b = buildBcUrl(bcName, true, state)) !== null && _b !== void 0 ? _b : "",
|
|
2244
2400
|
cursor: cursor,
|
|
2245
2401
|
dataItem: {
|
|
2246
2402
|
id: cursor
|
|
@@ -2263,7 +2419,7 @@ function cancelRequestEpic(action$, actionTypes, cancelFn, cancelActionCreator,
|
|
|
2263
2419
|
return true;
|
|
2264
2420
|
}; }
|
|
2265
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 () {
|
|
2266
|
-
cancelFn();
|
|
2422
|
+
cancelFn === null || cancelFn === void 0 ? void 0 : cancelFn();
|
|
2267
2423
|
return (0, import_rxjs37.of)(cancelActionCreator);
|
|
2268
2424
|
}), (0, import_rxjs37.take)(1));
|
|
2269
2425
|
}
|
|
@@ -2278,7 +2434,7 @@ var bcLoadMoreEpic = function (action$, state$, _a) {
|
|
|
2278
2434
|
var cursor = bc.cursor, page = bc.page;
|
|
2279
2435
|
var limit = ((_a = state.view.widgets.find(function (i) { return i.bcName === bcName; })) === null || _a === void 0 ? void 0 : _a.limit) || bc.limit;
|
|
2280
2436
|
var limitBySelfCursor = (_b = state.router.bcPath) === null || _b === void 0 ? void 0 : _b.includes("".concat(bcName, "/").concat(cursor));
|
|
2281
|
-
var bcUrl = buildBcUrl(bcName, limitBySelfCursor);
|
|
2437
|
+
var bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
|
|
2282
2438
|
var filters = state.screen.filters[bcName] || [];
|
|
2283
2439
|
var sorters = state.screen.sorters[bcName];
|
|
2284
2440
|
var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(filters)), getSorters(sorters));
|
|
@@ -2306,16 +2462,16 @@ var import_rxjs39 = require("rxjs");
|
|
|
2306
2462
|
var bcSaveDataEpic = function (action$, state$, _a) {
|
|
2307
2463
|
var api = _a.api;
|
|
2308
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) {
|
|
2309
|
-
var _a, _b, _c;
|
|
2465
|
+
var _a, _b, _c, _d;
|
|
2310
2466
|
var state = state$.value;
|
|
2311
2467
|
var bcName = action.payload.bcName;
|
|
2312
|
-
var bcUrl = buildBcUrl(bcName, true);
|
|
2468
|
+
var bcUrl = (_a = buildBcUrl(bcName, true, state)) !== null && _a !== void 0 ? _a : "";
|
|
2313
2469
|
var widgetName = action.payload.widgetName;
|
|
2314
2470
|
var cursor = state.screen.bo.bc[bcName].cursor;
|
|
2315
2471
|
var dataItem = state.data[bcName].find(function (item) { return item.id === cursor; });
|
|
2316
|
-
var pendingChanges = (
|
|
2317
|
-
var rowMeta = bcUrl && ((
|
|
2318
|
-
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;
|
|
2319
2475
|
if (rowMeta) {
|
|
2320
2476
|
var fields = rowMeta.fields;
|
|
2321
2477
|
var _loop_3 = function (key) {
|
|
@@ -2332,8 +2488,9 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2332
2488
|
return bcFetchDataRequest({ bcName: childBcName, widgetName: widgetNames[0] });
|
|
2333
2489
|
});
|
|
2334
2490
|
var context = { widgetName: action.payload.widgetName };
|
|
2335
|
-
return api.saveBcData(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: dataItem.vstamp }), context).pipe((0, import_rxjs39.mergeMap)(function (data) {
|
|
2336
|
-
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];
|
|
2337
2494
|
var responseDataItem = data.record;
|
|
2338
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({
|
|
2339
2496
|
bcName: bcName,
|
|
@@ -2342,7 +2499,7 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2342
2499
|
cursor: responseDataItem.id
|
|
2343
2500
|
})) : import_rxjs39.EMPTY, action.payload.onSuccessAction ? (0, import_rxjs39.of)(action.payload.onSuccessAction) : import_rxjs39.EMPTY);
|
|
2344
2501
|
}), (0, import_rxjs39.catchError)(function (e) {
|
|
2345
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2502
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2346
2503
|
console.error(e);
|
|
2347
2504
|
var notification$ = import_rxjs39.EMPTY;
|
|
2348
2505
|
if (action.payload.onSuccessAction && !(options === null || options === void 0 ? void 0 : options.disableNotification)) {
|
|
@@ -2363,8 +2520,8 @@ var bcSaveDataEpic = function (action$, state$, _a) {
|
|
|
2363
2520
|
var entityError = null;
|
|
2364
2521
|
var operationError = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2365
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)) {
|
|
2366
|
-
entityError = (_d = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _d === void 0 ? void 0 : _d.entity;
|
|
2367
|
-
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;
|
|
2368
2525
|
}
|
|
2369
2526
|
return (0, import_rxjs39.concat)((0, import_rxjs39.of)(bcSaveDataFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError })), notification$);
|
|
2370
2527
|
}));
|
|
@@ -2440,41 +2597,41 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2440
2597
|
});
|
|
2441
2598
|
return (0, import_rxjs41.of)(bcFetchDataRequest({
|
|
2442
2599
|
bcName: childBcName,
|
|
2443
|
-
widgetName: nonLazyWidget.name,
|
|
2600
|
+
widgetName: nonLazyWidget === null || nonLazyWidget === void 0 ? void 0 : nonLazyWidget.name,
|
|
2444
2601
|
ignorePageLimit: ignorePageLimit || showViewPopup.match(action),
|
|
2445
2602
|
keepDelta: isHierarchy || keepDelta
|
|
2446
2603
|
}));
|
|
2447
2604
|
}));
|
|
2448
2605
|
};
|
|
2449
2606
|
var bcFetchDataImpl = function () {
|
|
2450
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2607
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2451
2608
|
var state = state$.value;
|
|
2452
|
-
var
|
|
2453
|
-
var
|
|
2454
|
-
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; });
|
|
2455
2612
|
if (!widget) {
|
|
2456
2613
|
return [import_rxjs41.EMPTY];
|
|
2457
2614
|
}
|
|
2458
2615
|
var bcName = action.payload.bcName;
|
|
2459
2616
|
var bc = state.screen.bo.bc[bcName];
|
|
2460
|
-
var cursor = bc.cursor,
|
|
2461
|
-
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;
|
|
2462
2619
|
var sorters = state.screen.sorters[bcName];
|
|
2463
2620
|
if (showViewPopup.match(action) && bcName === action.payload.calleeBCName) {
|
|
2464
2621
|
return [import_rxjs41.EMPTY];
|
|
2465
2622
|
}
|
|
2466
|
-
var anyHierarchyWidget = widgets.find(function (item) {
|
|
2623
|
+
var anyHierarchyWidget = widgets === null || widgets === void 0 ? void 0 : widgets.find(function (item) {
|
|
2467
2624
|
return item.bcName === widget.bcName && item.type === import_schema14.WidgetTypes.AssocListPopup && isHierarchyWidget(item);
|
|
2468
2625
|
});
|
|
2469
|
-
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) {
|
|
2470
2627
|
var _a;
|
|
2471
2628
|
return item.bcName === widget.bcName && item.type === import_schema14.WidgetTypes.AssocListPopup && ((_a = item.options) === null || _a === void 0 ? void 0 : _a.hierarchyFull);
|
|
2472
2629
|
});
|
|
2473
|
-
var limitBySelfCursor = (
|
|
2474
|
-
var bcUrl = buildBcUrl(bcName, limitBySelfCursor);
|
|
2630
|
+
var limitBySelfCursor = (_e = state.router.bcPath) === null || _e === void 0 ? void 0 : _e.includes("".concat(bcName, "/").concat(cursor));
|
|
2631
|
+
var bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
|
|
2475
2632
|
var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(fullHierarchyWidget ? [] : state.screen.filters[bcName] || [])), getSorters(sorters));
|
|
2476
2633
|
if (bcForceUpdate.match(action)) {
|
|
2477
|
-
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);
|
|
2478
2635
|
if (infinityPaginationWidget) {
|
|
2479
2636
|
fetchParams._page = 1;
|
|
2480
2637
|
fetchParams._limit = limit * page;
|
|
@@ -2484,7 +2641,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2484
2641
|
fetchParams._page = action.payload.from || 1;
|
|
2485
2642
|
fetchParams._limit = (action.payload.to || page - fetchParams._page) * limit;
|
|
2486
2643
|
}
|
|
2487
|
-
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)) {
|
|
2488
2645
|
fetchParams._limit = 0;
|
|
2489
2646
|
}
|
|
2490
2647
|
var canceler = api.createCanceler();
|
|
@@ -2496,7 +2653,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
|
|
|
2496
2653
|
var normalFlow = api.fetchBcData(state.screen.screenName, bcUrl, fetchParams, canceler.cancelToken).pipe((0, import_rxjs41.mergeMap)(function (response) {
|
|
2497
2654
|
var _a, _b;
|
|
2498
2655
|
var cursorChange = getCursorChange(response.data, cursor, !!anyHierarchyWidget);
|
|
2499
|
-
var parentOfNotLazyWidget = widgets.some(function (item) {
|
|
2656
|
+
var parentOfNotLazyWidget = widgets === null || widgets === void 0 ? void 0 : widgets.some(function (item) {
|
|
2500
2657
|
var _a;
|
|
2501
2658
|
return ((_a = state.screen.bo.bc[item.bcName]) === null || _a === void 0 ? void 0 : _a.parentName) === bcName && !PopupWidgetTypes.includes(item.type);
|
|
2502
2659
|
});
|
|
@@ -2552,11 +2709,12 @@ var bcDeleteDataEpic = function (action$, store$, _a) {
|
|
|
2552
2709
|
var state = store$.value;
|
|
2553
2710
|
var bcName = action.payload.bcName;
|
|
2554
2711
|
var cursor = state.screen.bo.bc[bcName].cursor;
|
|
2555
|
-
var bcUrl = buildBcUrl(bcName, true);
|
|
2712
|
+
var bcUrl = buildBcUrl(bcName, true, state);
|
|
2556
2713
|
var context = { widgetName: action.payload.widgetName };
|
|
2557
2714
|
var isTargetFormatPVF = state.view.pendingValidationFailsFormat === "target" /* target */;
|
|
2558
2715
|
return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe((0, import_rxjs42.mergeMap)(function (data) {
|
|
2559
|
-
var
|
|
2716
|
+
var _a;
|
|
2717
|
+
var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2560
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);
|
|
2561
2719
|
}), (0, import_rxjs42.catchError)(function (error) {
|
|
2562
2720
|
console.error(error);
|
|
@@ -2588,9 +2746,11 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2588
2746
|
var _a, _b, _c, _d, _e;
|
|
2589
2747
|
var state = state$.value;
|
|
2590
2748
|
var selected = action.payload.dataItem._associate;
|
|
2749
|
+
var bcName = action.payload.bcName;
|
|
2591
2750
|
var result = [
|
|
2592
2751
|
(0, import_rxjs44.of)(changeDataItem({
|
|
2593
|
-
bcName:
|
|
2752
|
+
bcName: bcName,
|
|
2753
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2594
2754
|
cursor: action.payload.dataItem.id,
|
|
2595
2755
|
dataItem: action.payload.dataItem
|
|
2596
2756
|
}))
|
|
@@ -2603,19 +2763,19 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2603
2763
|
fields: widget.fields
|
|
2604
2764
|
};
|
|
2605
2765
|
var hierarchy = (_b = widget.options) === null || _b === void 0 ? void 0 : _b.hierarchy;
|
|
2606
|
-
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; });
|
|
2607
2767
|
var hierarchyGroupSelection = (_c = widget.options) === null || _c === void 0 ? void 0 : _c.hierarchyGroupSelection;
|
|
2608
2768
|
var hierarchyTraverse = (_d = widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyTraverse;
|
|
2609
|
-
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; });
|
|
2610
2770
|
if (hierarchyGroupSelection && hierarchyDescriptor.radio && !selected) {
|
|
2611
2771
|
result.push((0, import_rxjs44.of)(dropAllAssociations({
|
|
2612
2772
|
bcNames: childrenBc
|
|
2613
2773
|
})));
|
|
2614
2774
|
}
|
|
2615
|
-
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) {
|
|
2616
2776
|
var _a;
|
|
2617
2777
|
return ((_a = hierarchy[index + 1]) === null || _a === void 0 ? void 0 : _a.bcName) === action.payload.bcName;
|
|
2618
|
-
}) || rootHierarchyDescriptor;
|
|
2778
|
+
})) || rootHierarchyDescriptor;
|
|
2619
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; });
|
|
2620
2780
|
if (parent && hierarchyTraverse && selected) {
|
|
2621
2781
|
if (hierarchyDescriptor.radio) {
|
|
@@ -2626,7 +2786,7 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
|
|
|
2626
2786
|
result.push((0, import_rxjs44.of)(changeAssociation({
|
|
2627
2787
|
bcName: parent.bcName,
|
|
2628
2788
|
widgetName: action.payload.widgetName,
|
|
2629
|
-
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] }),
|
|
2630
2790
|
assocValueKey: action.payload.assocValueKey
|
|
2631
2791
|
})));
|
|
2632
2792
|
}
|
|
@@ -2663,7 +2823,7 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
|
|
|
2663
2823
|
var state = state$.value;
|
|
2664
2824
|
var screenName = state.screen.screenName;
|
|
2665
2825
|
var bcName = action.payload.bcName;
|
|
2666
|
-
var bcUrl = buildBcUrl(bcName, true);
|
|
2826
|
+
var bcUrl = buildBcUrl(bcName, true, state);
|
|
2667
2827
|
var bc = state.screen.bo.bc[bcName];
|
|
2668
2828
|
var cursor = bc === null || bc === void 0 ? void 0 : bc.cursor;
|
|
2669
2829
|
var context = { widgetName: action.payload.widgetName };
|
|
@@ -2673,7 +2833,8 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
|
|
|
2673
2833
|
var params = { _action: action.payload.operationType };
|
|
2674
2834
|
var cursorsMap = (_a = {}, _a[action.payload.bcName] = null, _a);
|
|
2675
2835
|
return api.customAction(screenName, bcUrl, data, context, params).pipe((0, import_rxjs45.mergeMap)(function (response) {
|
|
2676
|
-
var
|
|
2836
|
+
var _a;
|
|
2837
|
+
var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
|
|
2677
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);
|
|
2678
2839
|
}), (0, import_rxjs45.catchError)(function (error) {
|
|
2679
2840
|
console.error(error);
|
|
@@ -2709,21 +2870,21 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2709
2870
|
var removedItem = data.find(function (item) { return item.id === action.payload.removedItem.id; });
|
|
2710
2871
|
var associated = action.payload.dataItem.map(function (item) { return item.id; });
|
|
2711
2872
|
var removedNodes = [];
|
|
2712
|
-
if ((_d = widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyGroupDeselection) {
|
|
2713
|
-
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) {
|
|
2714
2875
|
data = assignTreeLinks(data);
|
|
2715
2876
|
}
|
|
2716
|
-
var removedItemChildren = data.filter(function (item) { return item.parentId === removedItem.id; });
|
|
2717
|
-
removedNodes = __spreadArray([removedItem.id], removedItemChildren.filter(function (item) { return associated.includes(item.id); }).map(function (item) { return item.id; }), true);
|
|
2718
|
-
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) {
|
|
2719
2880
|
getDescendants(removedItemChildren, removedNodes);
|
|
2720
2881
|
removedNodes = data.filter(function (item) { return removedNodes.includes(item.id) && associated.includes(item.id); }).map(function (item) { return item.id; });
|
|
2721
2882
|
}
|
|
2722
|
-
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); });
|
|
2723
2884
|
var siblings = data.filter(function (item) { return item.parentId === (parent_1 === null || parent_1 === void 0 ? void 0 : parent_1.id); });
|
|
2724
2885
|
var parentEmpty = siblings.every(function (child) { return removedNodes.includes(child.id) || !associated.includes(child.id); });
|
|
2725
2886
|
if (parent_1 && parentEmpty) {
|
|
2726
|
-
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) {
|
|
2727
2888
|
var parentDescendants = [];
|
|
2728
2889
|
getDescendants(siblings, parentDescendants);
|
|
2729
2890
|
var parentDeepEmpty = parentDescendants.every(function (descendant) {
|
|
@@ -2738,14 +2899,19 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2738
2899
|
}
|
|
2739
2900
|
}
|
|
2740
2901
|
}
|
|
2741
|
-
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) {
|
|
2742
2903
|
return (0, import_rxjs47.of)(changeDataItem({
|
|
2743
2904
|
bcName: bcName,
|
|
2905
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2744
2906
|
cursor: cursor,
|
|
2745
2907
|
dataItem: (_a = {}, _a[associateFieldKey] = action.payload.dataItem.filter(function (item) { return !removedNodes.includes(item.id); }), _a)
|
|
2746
2908
|
}));
|
|
2747
2909
|
}
|
|
2748
|
-
if ((_j = widget.options) === null || _j === void 0 ? void 0 : _j.hierarchy) {
|
|
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) {
|
|
2912
|
+
var _a;
|
|
2913
|
+
return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
|
|
2914
|
+
})) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName;
|
|
2749
2915
|
return (0, import_rxjs47.concat)((0, import_rxjs47.of)(changeDataItem({
|
|
2750
2916
|
/**
|
|
2751
2917
|
* This is incorrect and will break if different BC has records with
|
|
@@ -2753,24 +2919,25 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
|
|
|
2753
2919
|
*
|
|
2754
2920
|
* TODO: Record `level` should be mapped to hierarchyData index instead
|
|
2755
2921
|
*/
|
|
2756
|
-
bcName:
|
|
2757
|
-
|
|
2758
|
-
return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
|
|
2759
|
-
})) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName,
|
|
2922
|
+
bcName: hierarchyBcName,
|
|
2923
|
+
bcUrl: buildBcUrl(hierarchyBcName, true, state),
|
|
2760
2924
|
cursor: action.payload.removedItem.id,
|
|
2761
2925
|
dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
|
|
2762
2926
|
})), (0, import_rxjs47.of)(changeDataItem({
|
|
2763
2927
|
bcName: bcName,
|
|
2928
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2764
2929
|
cursor: cursor,
|
|
2765
2930
|
dataItem: (_b = {}, _b[associateFieldKey] = action.payload.dataItem, _b)
|
|
2766
2931
|
})));
|
|
2767
2932
|
}
|
|
2768
2933
|
return (0, import_rxjs47.concat)((0, import_rxjs47.of)(changeDataItem({
|
|
2769
2934
|
bcName: popupBcName,
|
|
2935
|
+
bcUrl: buildBcUrl(popupBcName, true, state),
|
|
2770
2936
|
cursor: action.payload.removedItem.id,
|
|
2771
2937
|
dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
|
|
2772
2938
|
})), (0, import_rxjs47.of)(changeDataItem({
|
|
2773
2939
|
bcName: bcName,
|
|
2940
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2774
2941
|
cursor: cursor,
|
|
2775
2942
|
dataItem: (_c = {}, _c[associateFieldKey] = action.payload.dataItem, _c)
|
|
2776
2943
|
})));
|
|
@@ -2780,11 +2947,12 @@ var import_rxjs48 = require("rxjs");
|
|
|
2780
2947
|
var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
|
|
2781
2948
|
var api = _a.api;
|
|
2782
2949
|
return action$.pipe((0, import_rxjs48.filter)(bcFetchRowMeta.match), (0, import_rxjs48.mergeMap)(function (action) {
|
|
2950
|
+
var _a, _b;
|
|
2783
2951
|
var state = state$.value;
|
|
2784
2952
|
var screenName = state.screen.screenName;
|
|
2785
2953
|
var bcName = action.payload.bcName;
|
|
2786
|
-
var cursor = state.screen.bo.bc[bcName].cursor;
|
|
2787
|
-
var bcUrl = buildBcUrl(bcName, true);
|
|
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 : "";
|
|
2788
2956
|
var canceler = api.createCanceler();
|
|
2789
2957
|
var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }));
|
|
2790
2958
|
var cancelByParentBc = cancelRequestEpic(action$, [bcSelectRecord], canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }), function (filteredAction) {
|
|
@@ -2852,6 +3020,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
2852
3020
|
}
|
|
2853
3021
|
result.push((0, import_rxjs49.of)(changeDataItem({
|
|
2854
3022
|
bcName: action.payload.bcName,
|
|
3023
|
+
bcUrl: buildBcUrl(action.payload.bcName, true, state),
|
|
2855
3024
|
cursor: action.payload.dataItem.id,
|
|
2856
3025
|
dataItem: action.payload.dataItem
|
|
2857
3026
|
})));
|
|
@@ -2860,7 +3029,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
|
|
|
2860
3029
|
bcName: bcName,
|
|
2861
3030
|
depth: parentDepth,
|
|
2862
3031
|
widgetName: action.payload.widgetName,
|
|
2863
|
-
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] }),
|
|
2864
3033
|
assocValueKey: assocValueKey
|
|
2865
3034
|
})));
|
|
2866
3035
|
}
|
|
@@ -2888,19 +3057,21 @@ var import_rxjs50 = require("rxjs");
|
|
|
2888
3057
|
var saveAssociationsActiveEpic = function (action$, state$, _a) {
|
|
2889
3058
|
var api = _a.api;
|
|
2890
3059
|
return action$.pipe((0, import_rxjs50.filter)(saveAssociations.match), (0, import_rxjs50.filter)(function (action) {
|
|
2891
|
-
|
|
3060
|
+
var _a;
|
|
3061
|
+
return (_a = state$.value.view.popupData) === null || _a === void 0 ? void 0 : _a.active;
|
|
2892
3062
|
}), (0, import_rxjs50.switchMap)(function (action) {
|
|
3063
|
+
var _a, _b;
|
|
2893
3064
|
var state = state$.value;
|
|
2894
|
-
var calleeBCName = state.view.popupData.calleeBCName;
|
|
2895
|
-
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;
|
|
2896
3067
|
var bcNames = action.payload.bcNames;
|
|
2897
|
-
var bcUrl = buildBcUrl(calleeBCName, true);
|
|
3068
|
+
var bcUrl = buildBcUrl(calleeBCName, true, state);
|
|
2898
3069
|
var pendingChanges = state.view.pendingDataChanges[bcNames[0]] || {};
|
|
2899
3070
|
var params = bcNames.length ? { _bcName: bcNames[bcNames.length - 1] } : {};
|
|
2900
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) {
|
|
2901
3072
|
var postInvoke = response.postActions[0];
|
|
2902
3073
|
var calleeWidget = state.view.widgets.find(function (widgetItem) { return widgetItem.bcName === calleeBCName; });
|
|
2903
|
-
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 })));
|
|
2904
3075
|
}), (0, import_rxjs50.catchError)(function (err) {
|
|
2905
3076
|
console.error(err);
|
|
2906
3077
|
return import_rxjs50.EMPTY;
|
|
@@ -2910,30 +3081,31 @@ var saveAssociationsActiveEpic = function (action$, state$, _a) {
|
|
|
2910
3081
|
// src/epics/data/changeAssociationSameBcEpic.ts
|
|
2911
3082
|
var import_rxjs51 = require("rxjs");
|
|
2912
3083
|
var changeAssociationSameBcEpic = function (action$, state$) { return action$.pipe((0, import_rxjs51.filter)(changeAssociationSameBc.match), (0, import_rxjs51.mergeMap)(function (action) {
|
|
2913
|
-
var _a, _b, _c, _d, _e;
|
|
3084
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3085
|
+
var state = state$.value;
|
|
2914
3086
|
var bcName = action.payload.bcName;
|
|
2915
3087
|
var result = [
|
|
2916
3088
|
(0, import_rxjs51.of)(changeDataItem({
|
|
2917
3089
|
bcName: bcName,
|
|
3090
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2918
3091
|
cursor: action.payload.dataItem.id,
|
|
2919
3092
|
dataItem: action.payload.dataItem
|
|
2920
3093
|
}))
|
|
2921
3094
|
];
|
|
2922
|
-
var state = state$.value;
|
|
2923
3095
|
var selected = action.payload.dataItem._associate;
|
|
2924
3096
|
var depth = action.payload.depth || 1;
|
|
2925
3097
|
var parentDepth = depth - 1;
|
|
2926
3098
|
var widget = state.view.widgets.find(function (item) { return item.name === action.payload.widgetName; });
|
|
2927
3099
|
var hierarchyTraverse = (_a = widget.options) === null || _a === void 0 ? void 0 : _a.hierarchyTraverse;
|
|
2928
3100
|
var currentData = depth > 1 ? (_b = state.depthData[depth]) === null || _b === void 0 ? void 0 : _b[bcName] : state.data[bcName];
|
|
2929
|
-
var parentCursor = parentDepth ? parentDepth > 1 ? (_c = state.screen.bo.bc[bcName].depthBc[parentDepth]) === null ||
|
|
2930
|
-
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;
|
|
2931
3103
|
if (parentDepth && hierarchyTraverse && selected) {
|
|
2932
3104
|
result.push((0, import_rxjs51.of)(changeAssociationSameBc({
|
|
2933
3105
|
bcName: bcName,
|
|
2934
3106
|
depth: parentDepth,
|
|
2935
3107
|
widgetName: action.payload.widgetName,
|
|
2936
|
-
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] }),
|
|
2937
3109
|
assocValueKey: action.payload.assocValueKey
|
|
2938
3110
|
})));
|
|
2939
3111
|
}
|
|
@@ -2958,7 +3130,8 @@ var inlinePickListFetchDataEpic = function (action$, state$, _a) {
|
|
|
2958
3130
|
return action$.pipe((0, import_rxjs52.filter)(inlinePickListFetchDataRequest.match), (0, import_rxjs52.mergeMap)(function (action) {
|
|
2959
3131
|
var _a;
|
|
2960
3132
|
var _b = action.payload, bcName = _b.bcName, searchSpec = _b.searchSpec, searchString = _b.searchString;
|
|
2961
|
-
var
|
|
3133
|
+
var state = state$.value;
|
|
3134
|
+
var bcUrl = buildBcUrl(bcName, false, state);
|
|
2962
3135
|
var canceler = api.createCanceler();
|
|
2963
3136
|
var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName: bcName, bcUrl: bcUrl }));
|
|
2964
3137
|
var normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, (_a = {}, _a[searchSpec + ".contains"] = searchString, _a), canceler.cancelToken).pipe((0, import_rxjs52.mergeMap)(function (data) {
|
|
@@ -2973,14 +3146,15 @@ var inlinePickListFetchDataEpic = function (action$, state$, _a) {
|
|
|
2973
3146
|
// src/epics/data/saveAssociationsPassiveEpic.ts
|
|
2974
3147
|
var import_rxjs53 = require("rxjs");
|
|
2975
3148
|
var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pipe((0, import_rxjs53.filter)(saveAssociations.match), (0, import_rxjs53.filter)(function () {
|
|
2976
|
-
|
|
3149
|
+
var _a;
|
|
3150
|
+
return !((_a = state$.value.view.popupData) === null || _a === void 0 ? void 0 : _a.active);
|
|
2977
3151
|
}), (0, import_rxjs53.switchMap)(function (action) {
|
|
2978
3152
|
var _a, _b;
|
|
2979
|
-
var _c;
|
|
3153
|
+
var _c, _d;
|
|
2980
3154
|
var state = state$.value;
|
|
2981
|
-
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;
|
|
2982
3156
|
var cursor = state.screen.bo.bc[calleeBCName].cursor;
|
|
2983
|
-
var recordPrevData = (
|
|
3157
|
+
var recordPrevData = (_d = state.data[calleeBCName].find(function (dataStateRecord) { return dataStateRecord.id === cursor; })[associateFieldKey]) !== null && _d !== void 0 ? _d : [];
|
|
2984
3158
|
var newValues = [];
|
|
2985
3159
|
action.payload.bcNames.forEach(function (pendingBc) {
|
|
2986
3160
|
var pendingChanges = state.view.pendingDataChanges[pendingBc] || {};
|
|
@@ -3006,6 +3180,7 @@ var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pi
|
|
|
3006
3180
|
})).concat.apply(_a, addedItems);
|
|
3007
3181
|
return (0, import_rxjs53.of)(changeDataItem({
|
|
3008
3182
|
bcName: calleeBCName,
|
|
3183
|
+
bcUrl: buildBcUrl(calleeBCName, true, state),
|
|
3009
3184
|
cursor: cursor,
|
|
3010
3185
|
dataItem: (_b = {},
|
|
3011
3186
|
_b[associateFieldKey] = result,
|
|
@@ -3086,7 +3261,6 @@ var ObservableApiWrapper = /** @class */ (function () {
|
|
|
3086
3261
|
this.instance = instance;
|
|
3087
3262
|
}
|
|
3088
3263
|
class_2.prototype.get = function (path, config, callContext) {
|
|
3089
|
-
if (config === void 0) { config = {}; }
|
|
3090
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; }));
|
|
3091
3265
|
};
|
|
3092
3266
|
class_2.prototype.put = function (path, data, callContext) {
|
|
@@ -3105,7 +3279,6 @@ var import_axios3 = __toESM(require("axios"));
|
|
|
3105
3279
|
var import_rxjs58 = require("rxjs");
|
|
3106
3280
|
var Api = /** @class */ (function () {
|
|
3107
3281
|
function class_3(instance) {
|
|
3108
|
-
this.api$ = new ObservableApiWrapper();
|
|
3109
3282
|
this.api$ = new ObservableApiWrapper(instance);
|
|
3110
3283
|
}
|
|
3111
3284
|
class_3.prototype.routerRequest = function (path, params) {
|
|
@@ -3134,19 +3307,20 @@ var Api = /** @class */ (function () {
|
|
|
3134
3307
|
};
|
|
3135
3308
|
class_3.prototype.newBcData = function (screenName, bcUrl, context, params) {
|
|
3136
3309
|
var url = applyParams(buildUrl(__makeTemplateObject(["row-meta-new/", "/"], ["row-meta-new/", "/"]), screenName) + bcUrl, params);
|
|
3137
|
-
return this.api$.get(url,
|
|
3310
|
+
return this.api$.get(url, void 0, context).pipe((0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3138
3311
|
};
|
|
3139
3312
|
class_3.prototype.saveBcData = function (screenName, bcUrl, data, context, params) {
|
|
3140
3313
|
var url = applyParams(buildUrl(__makeTemplateObject(["data/", "/"], ["data/", "/"]), screenName) + bcUrl, params);
|
|
3141
3314
|
return this.api$.put(url, { data: data }, context).pipe((0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3142
3315
|
};
|
|
3143
3316
|
class_3.prototype.deleteBcData = function (screenName, bcUrl, context, params) {
|
|
3317
|
+
if (bcUrl === void 0) { bcUrl = ""; }
|
|
3144
3318
|
var url = applyParams(buildUrl(__makeTemplateObject(["data/", "/"], ["data/", "/"]), screenName) + bcUrl, params);
|
|
3145
3319
|
return this.api$.delete(url, context).pipe((0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3146
3320
|
};
|
|
3147
3321
|
class_3.prototype.customAction = function (screenName, bcUrl, data, context, params) {
|
|
3148
3322
|
var url = applyParams(buildUrl(__makeTemplateObject(["custom-action/", "/"], ["custom-action/", "/"]), screenName) + bcUrl, params);
|
|
3149
|
-
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; }));
|
|
3150
3324
|
};
|
|
3151
3325
|
class_3.prototype.associate = function (screenName, bcUrl, data, params) {
|
|
3152
3326
|
var processedData = Array.isArray(data) ? data.map(function (item) { return ({
|
|
@@ -3158,9 +3332,27 @@ var Api = /** @class */ (function () {
|
|
|
3158
3332
|
return this.api$.post(url, processedData).pipe((0, import_rxjs58.map)(function (response) { return response.data; }));
|
|
3159
3333
|
};
|
|
3160
3334
|
class_3.prototype.getRmByForceActive = function (screenName, bcUrl, data, params) {
|
|
3161
|
-
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);
|
|
3162
3336
|
return this.api$.post(url, { data: data }).pipe((0, import_rxjs58.map)(function (response) { return response.data.row; }));
|
|
3163
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
|
+
});
|
|
3164
3356
|
class_3.prototype.refreshMeta = function () {
|
|
3165
3357
|
return this.api$.get(buildUrl(__makeTemplateObject(["bc-registry/refresh-meta"], ["bc-registry/refresh-meta"])));
|
|
3166
3358
|
};
|