@cxbox-ui/core 1.37.2-alpha.7 → 1.37.2-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.d.ts +3 -17
- package/dist/api/ObservableApi.d.ts +10 -2
- package/dist/api/ObservableApiWrapper.d.ts +1 -1
- package/dist/cxbox-ui-core.cjs.development.js +331 -154
- package/dist/cxbox-ui-core.cjs.production.min.js +1 -1
- package/dist/cxbox-ui-core.esm.js +385 -208
- package/dist/cxbox-ui-core.modern.development.js +378 -207
- package/dist/cxbox-ui-core.modern.js +378 -207
- package/dist/cxbox-ui-core.modern.production.min.js +1 -1
- package/dist/interfaces/bc.d.ts +5 -4
- package/dist/middlewares/index.d.ts +1 -0
- package/dist/middlewares/popupMiddleware.d.ts +5 -0
- package/dist/utils/api.d.ts +1 -10
- package/dist/utils/bc.d.ts +1 -1
- package/dist/utils/cancelRequestEpic.d.ts +1 -1
- package/dist/utils/filters.d.ts +2 -2
- package/dist/utils/strings.d.ts +1 -1
- package/package.json +1 -1
|
@@ -468,6 +468,15 @@ function isViewNavigationCategory(item) {
|
|
|
468
468
|
function isViewNavigationGroup(item) {
|
|
469
469
|
return !!item && "child" in item && !("categoryName" in item);
|
|
470
470
|
}
|
|
471
|
+
// src/reducers/router.ts
|
|
472
|
+
var initialRouterState = { type: "default" /* default */, path: "/", params: null, screenName: null };
|
|
473
|
+
var createRouterReducerBuilderManager = (initialState) => new ReducerBuilderManager().addCase(loginDone, (state, action) => {
|
|
474
|
+
state = __spreadValues(__spreadValues({}, state), action.payload);
|
|
475
|
+
}).addCase(changeLocation, (state, action) => {
|
|
476
|
+
state = __spreadValues(__spreadValues({}, state), action.payload.location);
|
|
477
|
+
});
|
|
478
|
+
// src/reducers/screen.ts
|
|
479
|
+
import { OperationTypeCrud as OperationTypeCrud3 } from "@cxbox-ui/schema";
|
|
471
480
|
// src/utils/index.ts
|
|
472
481
|
var utils_exports = {};
|
|
473
482
|
__export(utils_exports, {
|
|
@@ -488,7 +497,6 @@ __export(utils_exports, {
|
|
|
488
497
|
getBcChildren: () => getBcChildren,
|
|
489
498
|
getDescendants: () => getDescendants,
|
|
490
499
|
getFieldTitle: () => getFieldTitle,
|
|
491
|
-
getFileUploadEndpoint: () => getFileUploadEndpoint,
|
|
492
500
|
getFilterType: () => getFilterType,
|
|
493
501
|
getFilters: () => getFilters,
|
|
494
502
|
getSorters: () => getSorters,
|
|
@@ -528,12 +536,6 @@ function applyRawParams(url, qso) {
|
|
|
528
536
|
const result = new URLSearchParams(qso).toString();
|
|
529
537
|
return `${addTailControlSequences(url)}${result && `${result}`}`;
|
|
530
538
|
}
|
|
531
|
-
function getFileUploadEndpoint(instance) {
|
|
532
|
-
if (!instance.defaults.baseURL) {
|
|
533
|
-
return "/file";
|
|
534
|
-
}
|
|
535
|
-
return instance.defaults.baseURL.endsWith("/") ? `${instance.defaults.baseURL}file` : `${instance.defaults.baseURL}/file`;
|
|
536
|
-
}
|
|
537
539
|
// src/utils/strings.ts
|
|
538
540
|
function getTemplate(literals, ...placeholders) {
|
|
539
541
|
let result = "";
|
|
@@ -674,7 +676,7 @@ function defaultParseURL(url) {
|
|
|
674
676
|
}
|
|
675
677
|
return {
|
|
676
678
|
type,
|
|
677
|
-
path,
|
|
679
|
+
path: path.length !== 0 && !path.startsWith("/") ? `/${path}` : path,
|
|
678
680
|
params,
|
|
679
681
|
screenName,
|
|
680
682
|
viewName,
|
|
@@ -721,7 +723,7 @@ function getSorters(sorters) {
|
|
|
721
723
|
});
|
|
722
724
|
return result;
|
|
723
725
|
}
|
|
724
|
-
function parseFilters(defaultFilters) {
|
|
726
|
+
function parseFilters(defaultFilters = "") {
|
|
725
727
|
const result = [];
|
|
726
728
|
const urlParams = new URL(defaultFilters, window.location.origin).searchParams;
|
|
727
729
|
urlParams.forEach((param) => {
|
|
@@ -834,12 +836,13 @@ function getBcChildren(originBcName, widgets, bcMap) {
|
|
|
834
836
|
return childrenBcMap;
|
|
835
837
|
}
|
|
836
838
|
function getHierarchyChildBc(originBcName, hierarchyWidget) {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
+
var _a, _b;
|
|
840
|
+
const nestedBcNames = (_b = (_a = hierarchyWidget == null ? void 0 : hierarchyWidget.options) == null ? void 0 : _a.hierarchy) == null ? void 0 : _b.map((nestedItem) => nestedItem.bcName);
|
|
841
|
+
if (originBcName !== hierarchyWidget.bcName && !(nestedBcNames == null ? void 0 : nestedBcNames.includes(originBcName))) {
|
|
839
842
|
return [];
|
|
840
843
|
}
|
|
841
|
-
const childHierarchyBcIndex = nestedBcNames.findIndex((item) => item === originBcName);
|
|
842
|
-
const childHierarchyBcName = nestedBcNames[childHierarchyBcIndex + 1];
|
|
844
|
+
const childHierarchyBcIndex = nestedBcNames == null ? void 0 : nestedBcNames.findIndex((item) => item === originBcName);
|
|
845
|
+
const childHierarchyBcName = nestedBcNames == null ? void 0 : nestedBcNames[childHierarchyBcIndex + 1];
|
|
843
846
|
return [childHierarchyBcName, hierarchyWidget.name];
|
|
844
847
|
}
|
|
845
848
|
function checkShowCondition(condition, cursor, data, pendingDataChanges) {
|
|
@@ -853,9 +856,9 @@ function checkShowCondition(condition, cursor, data, pendingDataChanges) {
|
|
|
853
856
|
if (!record) {
|
|
854
857
|
return false;
|
|
855
858
|
}
|
|
856
|
-
const actualValue = record == null ? void 0 : record[params.fieldKey];
|
|
857
|
-
const pendingValue = (_b = (_a = pendingDataChanges == null ? void 0 : pendingDataChanges[bcName]) == null ? void 0 : _a[cursor]) == null ? void 0 : _b[params.fieldKey];
|
|
858
|
-
return pendingValue !== void 0 ? pendingValue === params.value : actualValue === params.value;
|
|
859
|
+
const actualValue = record == null ? void 0 : record[params == null ? void 0 : params.fieldKey];
|
|
860
|
+
const pendingValue = (_b = (_a = pendingDataChanges == null ? void 0 : pendingDataChanges[bcName]) == null ? void 0 : _a[cursor]) == null ? void 0 : _b[params == null ? void 0 : params.fieldKey];
|
|
861
|
+
return pendingValue !== void 0 ? pendingValue === (params == null ? void 0 : params.value) : actualValue === (params == null ? void 0 : params.value);
|
|
859
862
|
}
|
|
860
863
|
// src/utils/tree.ts
|
|
861
864
|
function assignTreeLinks(flat) {
|
|
@@ -863,6 +866,7 @@ function assignTreeLinks(flat) {
|
|
|
863
866
|
const map12 = {};
|
|
864
867
|
const orphans = [];
|
|
865
868
|
result.forEach((item) => {
|
|
869
|
+
var _a, _b;
|
|
866
870
|
if (!item.parentId || item.parentId === "0") {
|
|
867
871
|
return;
|
|
868
872
|
}
|
|
@@ -881,7 +885,7 @@ function assignTreeLinks(flat) {
|
|
|
881
885
|
result[parentIndex].children = [item];
|
|
882
886
|
}
|
|
883
887
|
else {
|
|
884
|
-
result[parentIndex].children.push(item);
|
|
888
|
+
(_b = (_a = result[parentIndex]) == null ? void 0 : _a.children) == null ? void 0 : _b.push(item);
|
|
885
889
|
}
|
|
886
890
|
});
|
|
887
891
|
if (orphans.length) {
|
|
@@ -957,22 +961,7 @@ function deleteUndefinedFromObject(obj) {
|
|
|
957
961
|
}
|
|
958
962
|
});
|
|
959
963
|
}
|
|
960
|
-
// src/reducers/router.ts
|
|
961
|
-
var initialRouterState = { type: "default" /* default */, path: "/", params: null, screenName: null };
|
|
962
|
-
var createRouterReducerBuilderManager = (initialState) => new ReducerBuilderManager().addCase(loginDone, (state, action) => {
|
|
963
|
-
state = __spreadValues(__spreadValues({}, state), action.payload);
|
|
964
|
-
}).addCase(changeLocation, (state, action) => {
|
|
965
|
-
const { url, route } = action.payload;
|
|
966
|
-
if (url) {
|
|
967
|
-
const path = new URL(url);
|
|
968
|
-
state = __spreadValues(__spreadValues({}, state), defaultParseURL(path));
|
|
969
|
-
}
|
|
970
|
-
if (route !== null) {
|
|
971
|
-
state = __spreadValues(__spreadValues({}, state), route);
|
|
972
|
-
}
|
|
973
|
-
});
|
|
974
964
|
// src/reducers/screen.ts
|
|
975
|
-
import { OperationTypeCrud as OperationTypeCrud3 } from "@cxbox-ui/schema";
|
|
976
965
|
var initialScreenState = {
|
|
977
966
|
screenName: "",
|
|
978
967
|
bo: { activeBcName: "", bc: {} },
|
|
@@ -984,10 +973,11 @@ var initialScreenState = {
|
|
|
984
973
|
};
|
|
985
974
|
var operationsHandledLocally = [OperationTypeCrud3.associate, OperationTypeCrud3.fileUpload];
|
|
986
975
|
var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderManager().addCase(selectScreen, (state, action) => {
|
|
976
|
+
var _a, _b, _c, _d, _e;
|
|
987
977
|
const bcDictionary = {};
|
|
988
978
|
const bcSorters = {};
|
|
989
979
|
const bcFilters = {};
|
|
990
|
-
action.payload.screen.meta.bo.bc.forEach((item) => {
|
|
980
|
+
(_a = action.payload.screen.meta) == null ? void 0 : _a.bo.bc.forEach((item) => {
|
|
991
981
|
bcDictionary[item.name] = item;
|
|
992
982
|
const sorter = parseSorters(item.defaultSort);
|
|
993
983
|
const filter56 = parseFilters(item.defaultFilter);
|
|
@@ -999,8 +989,8 @@ var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderMana
|
|
|
999
989
|
}
|
|
1000
990
|
});
|
|
1001
991
|
state.screenName = action.payload.screen.name;
|
|
1002
|
-
state.primaryView = action.payload.screen.meta.primary;
|
|
1003
|
-
state.views = action.payload.screen.meta.views;
|
|
992
|
+
state.primaryView = (_c = (_b = action.payload.screen.meta) == null ? void 0 : _b.primary) != null ? _c : state.primaryView;
|
|
993
|
+
state.views = (_e = (_d = action.payload.screen.meta) == null ? void 0 : _d.views) != null ? _e : state.views;
|
|
1004
994
|
state.bo = { activeBcName: null, bc: bcDictionary };
|
|
1005
995
|
state.sorters = __spreadValues(__spreadValues({}, state.sorters), bcSorters);
|
|
1006
996
|
state.filters = __spreadValues(__spreadValues({}, state.filters), bcFilters);
|
|
@@ -1010,12 +1000,14 @@ var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderMana
|
|
|
1010
1000
|
}).addCase(bcFetchDataRequest, (state, action) => {
|
|
1011
1001
|
state.bo.bc[action.payload.bcName].loading = true;
|
|
1012
1002
|
}).addCase(bcLoadMore, (state, action) => {
|
|
1003
|
+
var _a;
|
|
1013
1004
|
const currentBc = state.bo.bc[action.payload.bcName];
|
|
1014
|
-
currentBc.page
|
|
1005
|
+
currentBc.page = ((_a = currentBc.page) != null ? _a : 1) + 1;
|
|
1015
1006
|
currentBc.loading = true;
|
|
1016
1007
|
}).addCase(selectView, (state, action) => {
|
|
1008
|
+
var _a;
|
|
1017
1009
|
const newBcs = {};
|
|
1018
|
-
Array.from(new Set(action.payload.widgets.map((widget) => widget.bcName))
|
|
1010
|
+
Array.from(new Set((_a = action.payload.widgets) == null ? void 0 : _a.map((widget) => widget.bcName))
|
|
1019
1011
|
// БК которые есть на вьюхе
|
|
1020
1012
|
).filter((bcName) => state.bo.bc[bcName]).forEach((bcName) => {
|
|
1021
1013
|
newBcs[bcName] = __spreadProps(__spreadValues({}, state.bo.bc[bcName]), { page: 1 });
|
|
@@ -1027,9 +1019,10 @@ var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderMana
|
|
|
1027
1019
|
currentBc.loading = false;
|
|
1028
1020
|
state.cachedBc[action.payload.bcName] = action.payload.bcUrl;
|
|
1029
1021
|
}).addCase(bcFetchDataFail, (state, action) => {
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
state.
|
|
1022
|
+
const bcName = action.payload.bcName;
|
|
1023
|
+
if (Object.values(state.bo.bc).some((bc) => bc.name === bcName)) {
|
|
1024
|
+
state.bo.bc[bcName].loading = false;
|
|
1025
|
+
state.cachedBc[bcName] = action.payload.bcUrl;
|
|
1033
1026
|
}
|
|
1034
1027
|
}).addCase(sendOperation, (state, action) => {
|
|
1035
1028
|
if (!operationsHandledLocally.includes(action.payload.operationType)) {
|
|
@@ -1057,10 +1050,12 @@ var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderMana
|
|
|
1057
1050
|
Object.assign(state.bo.bc, newCursors);
|
|
1058
1051
|
Object.assign(state.cachedBc, newCache);
|
|
1059
1052
|
}).addCase(bcChangeDepthCursor, (state, action) => {
|
|
1053
|
+
var _a;
|
|
1060
1054
|
if (action.payload.depth === 1) {
|
|
1061
1055
|
state.bo.bc[action.payload.bcName].cursor = action.payload.cursor;
|
|
1062
1056
|
}
|
|
1063
1057
|
else {
|
|
1058
|
+
state.bo.bc[action.payload.bcName].depthBc = (_a = state.bo.bc[action.payload.bcName].depthBc) != null ? _a : {};
|
|
1064
1059
|
state.bo.bc[action.payload.bcName].depthBc[action.payload.depth].cursor = action.payload.cursor;
|
|
1065
1060
|
}
|
|
1066
1061
|
}).addCase(bcSelectRecord, (state, action) => {
|
|
@@ -1144,9 +1139,11 @@ var createSessionReducerBuilderManager = (initialState) => new ReducerBuilderMan
|
|
|
1144
1139
|
}).addCase(switchDebugMode, (state, action) => {
|
|
1145
1140
|
state.debugMode = action.payload;
|
|
1146
1141
|
}).addCase(addPendingRequest, (state, action) => {
|
|
1147
|
-
|
|
1142
|
+
var _a;
|
|
1143
|
+
(_a = state.pendingRequests) == null ? void 0 : _a.push(action.payload.request);
|
|
1148
1144
|
}).addCase(removePendingRequest, (state, action) => {
|
|
1149
|
-
|
|
1145
|
+
var _a;
|
|
1146
|
+
state.pendingRequests = (_a = state.pendingRequests) == null ? void 0 : _a.filter((item) => item.requestId !== action.payload.requestId);
|
|
1150
1147
|
}).addCase(addNotification, (state, action) => {
|
|
1151
1148
|
state.notifications.push(action.payload);
|
|
1152
1149
|
}).addCase(removeNotifications, (state, action) => {
|
|
@@ -1193,13 +1190,14 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1193
1190
|
state.metaInProgress[action.payload.bcName] = true;
|
|
1194
1191
|
}
|
|
1195
1192
|
}).addCase(bcFetchRowMetaSuccess, (state, action) => {
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1193
|
+
var _a;
|
|
1194
|
+
state.rowMeta[action.payload.bcName] = (_a = state.rowMeta[action.payload.bcName]) != null ? _a : {};
|
|
1195
|
+
state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
|
|
1199
1196
|
state.metaInProgress[action.payload.bcName] = false;
|
|
1200
1197
|
}).addCase(bcNewDataSuccess, (state, action) => {
|
|
1201
1198
|
state.selectedCell = initialViewState.selectedCell;
|
|
1202
1199
|
}).addCase(forceActiveRmUpdate, (state, action) => {
|
|
1200
|
+
var _a, _b, _c, _d;
|
|
1203
1201
|
const { bcName, bcUrl, currentRecordData, rowMeta, cursor } = action.payload;
|
|
1204
1202
|
const handledForceActive = {};
|
|
1205
1203
|
const rowMetaForcedValues = {};
|
|
@@ -1223,11 +1221,15 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1223
1221
|
handledForceActive[key] = newPendingDataChanges[key];
|
|
1224
1222
|
}
|
|
1225
1223
|
});
|
|
1224
|
+
state.handledForceActive[bcName] = (_a = state.handledForceActive[bcName]) != null ? _a : {};
|
|
1225
|
+
state.handledForceActive[bcName][cursor] = (_b = state.handledForceActive[bcName][cursor]) != null ? _b : {};
|
|
1226
1226
|
Object.assign(state.handledForceActive[bcName][cursor], handledForceActive);
|
|
1227
|
+
state.pendingDataChanges[bcName] = (_c = state.pendingDataChanges[bcName]) != null ? _c : {};
|
|
1227
1228
|
state.pendingDataChanges[bcName][cursor] = newPendingDataChanges;
|
|
1229
|
+
state.rowMeta[bcName] = (_d = state.rowMeta[bcName]) != null ? _d : {};
|
|
1228
1230
|
state.rowMeta[bcName][bcUrl] = rowMeta;
|
|
1229
1231
|
}).addCase(changeDataItem, (state, action) => {
|
|
1230
|
-
var _a;
|
|
1232
|
+
var _a, _b, _c;
|
|
1231
1233
|
const actionBcName = action.payload.bcName;
|
|
1232
1234
|
const prevBc = state.pendingDataChanges[action.payload.bcName] || {};
|
|
1233
1235
|
const prevCursor = prevBc[action.payload.cursor] || {};
|
|
@@ -1244,10 +1246,11 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1244
1246
|
nextValidationFails[fieldKey] = "This field is mandatory";
|
|
1245
1247
|
}
|
|
1246
1248
|
});
|
|
1249
|
+
state.pendingDataChanges[action.payload.bcName] = (_b = state.pendingDataChanges[action.payload.bcName]) != null ? _b : {};
|
|
1247
1250
|
state.pendingDataChanges[action.payload.bcName][action.payload.cursor] = nextPending;
|
|
1248
1251
|
if (isTargetFormatPVF) {
|
|
1249
1252
|
;
|
|
1250
|
-
state.pendingValidationFails[actionBcName][action.payload.cursor] = nextValidationFails;
|
|
1253
|
+
((_c = state.pendingValidationFails) == null ? void 0 : _c[actionBcName])[action.payload.cursor] = nextValidationFails;
|
|
1251
1254
|
}
|
|
1252
1255
|
else {
|
|
1253
1256
|
state.pendingValidationFails = nextValidationFails;
|
|
@@ -1268,7 +1271,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1268
1271
|
pendingDataChanges[bcName] = pendingBcChanges;
|
|
1269
1272
|
});
|
|
1270
1273
|
const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1271
|
-
const pendingValidationFails = __spreadValues({}, state.pendingValidationFails);
|
|
1274
|
+
const pendingValidationFails = state.pendingValidationFails ? __spreadValues({}, state.pendingValidationFails) : {};
|
|
1272
1275
|
if (isTargetFormatPVF) {
|
|
1273
1276
|
action.payload.bcNames.forEach((i) => {
|
|
1274
1277
|
pendingValidationFails[i] = {};
|
|
@@ -1283,6 +1286,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1283
1286
|
}).addCase(bcFetchRowMetaFail, (state, action) => {
|
|
1284
1287
|
state.metaInProgress[action.payload.bcName] = false;
|
|
1285
1288
|
}).addCase(forceActiveChangeFail, (state, action) => {
|
|
1289
|
+
var _a;
|
|
1286
1290
|
const { bcName, bcUrl, entityError } = action.payload;
|
|
1287
1291
|
const errors = {};
|
|
1288
1292
|
if (entityError) {
|
|
@@ -1290,8 +1294,10 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1290
1294
|
errors[fieldName] = violation;
|
|
1291
1295
|
});
|
|
1292
1296
|
}
|
|
1297
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) != null ? _a : {};
|
|
1293
1298
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1294
1299
|
}).addCase(bcSaveDataFail, (state, action) => {
|
|
1300
|
+
var _a;
|
|
1295
1301
|
const { bcName, bcUrl, entityError } = action.payload;
|
|
1296
1302
|
const errors = {};
|
|
1297
1303
|
if (entityError) {
|
|
@@ -1299,8 +1305,10 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1299
1305
|
errors[fieldName] = violation;
|
|
1300
1306
|
});
|
|
1301
1307
|
}
|
|
1308
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) != null ? _a : {};
|
|
1302
1309
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1303
1310
|
}).addCase(sendOperationFail, (state, action) => {
|
|
1311
|
+
var _a;
|
|
1304
1312
|
const { bcName, bcUrl, entityError } = action.payload;
|
|
1305
1313
|
const errors = {};
|
|
1306
1314
|
if (entityError) {
|
|
@@ -1308,30 +1316,38 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1308
1316
|
errors[fieldName] = violation;
|
|
1309
1317
|
});
|
|
1310
1318
|
}
|
|
1319
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) != null ? _a : {};
|
|
1311
1320
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1312
1321
|
}).addCase(sendOperationSuccess, (state, action) => {
|
|
1313
|
-
|
|
1322
|
+
var _a, _b, _c;
|
|
1323
|
+
const bcName = action.payload.bcName;
|
|
1324
|
+
const cursor = action.payload.cursor;
|
|
1314
1325
|
const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1326
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) != null ? _a : {};
|
|
1315
1327
|
state.pendingDataChanges[bcName][cursor] = {};
|
|
1316
1328
|
if (isTargetFormatPVF) {
|
|
1317
1329
|
;
|
|
1318
|
-
state.pendingValidationFails[bcName][cursor] = {};
|
|
1330
|
+
((_b = state.pendingValidationFails) == null ? void 0 : _b[bcName])[cursor] = {};
|
|
1319
1331
|
}
|
|
1320
1332
|
else {
|
|
1321
1333
|
state.pendingValidationFails = initialViewState.pendingValidationFails;
|
|
1322
1334
|
}
|
|
1335
|
+
state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) != null ? _c : {};
|
|
1323
1336
|
state.handledForceActive[bcName][cursor] = {};
|
|
1324
1337
|
}).addCase(bcSaveDataSuccess, (state, action) => {
|
|
1338
|
+
var _a, _b, _c;
|
|
1325
1339
|
const { bcName, cursor } = action.payload;
|
|
1326
1340
|
const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1341
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) != null ? _a : {};
|
|
1327
1342
|
state.pendingDataChanges[bcName][cursor] = {};
|
|
1328
1343
|
if (isTargetFormatPVF) {
|
|
1329
1344
|
;
|
|
1330
|
-
state.pendingValidationFails[bcName][cursor] = {};
|
|
1345
|
+
((_b = state.pendingValidationFails) == null ? void 0 : _b[bcName])[cursor] = {};
|
|
1331
1346
|
}
|
|
1332
1347
|
else {
|
|
1333
1348
|
state.pendingValidationFails = initialViewState.pendingValidationFails;
|
|
1334
1349
|
}
|
|
1350
|
+
state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) != null ? _c : {};
|
|
1335
1351
|
state.handledForceActive[bcName][cursor] = {};
|
|
1336
1352
|
}).addCase(bcCancelPendingChanges, (state, action) => {
|
|
1337
1353
|
var _a, _b;
|
|
@@ -1342,7 +1358,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1342
1358
|
}
|
|
1343
1359
|
}
|
|
1344
1360
|
const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1345
|
-
let pendingValidationFails = __spreadValues({}, state.pendingValidationFails);
|
|
1361
|
+
let pendingValidationFails = state.pendingValidationFails ? __spreadValues({}, state.pendingValidationFails) : {};
|
|
1346
1362
|
if (isTargetFormatPVF) {
|
|
1347
1363
|
if (((_b = (_a = action.payload) == null ? void 0 : _a.bcNames) == null ? void 0 : _b.length) > 0) {
|
|
1348
1364
|
action.payload.bcNames.forEach((i) => {
|
|
@@ -1371,8 +1387,8 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1371
1387
|
isFilter
|
|
1372
1388
|
};
|
|
1373
1389
|
}).addCase(showFileUploadPopup, (state, action) => {
|
|
1374
|
-
var _a;
|
|
1375
|
-
const bcName = (_a = state.widgets.find((item) => item.name === action.payload.widgetName)) == null ? void 0 :
|
|
1390
|
+
var _a, _b;
|
|
1391
|
+
const bcName = (_b = (_a = state.widgets) == null ? void 0 : _a.find((item) => item.name === action.payload.widgetName)) == null ? void 0 : _b.bcName;
|
|
1376
1392
|
state.popupData = {
|
|
1377
1393
|
type: "file-upload",
|
|
1378
1394
|
bcName,
|
|
@@ -1384,6 +1400,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1384
1400
|
}).addCase(viewClearPickMap, (state) => {
|
|
1385
1401
|
state.pickMap = null;
|
|
1386
1402
|
}).addCase(closeViewPopup, (state) => {
|
|
1403
|
+
state.popupData = {};
|
|
1387
1404
|
state.popupData.bcName = null;
|
|
1388
1405
|
}).addCase(selectTableCell, (state, action) => {
|
|
1389
1406
|
state.selectedCell = { widgetName: action.payload.widgetName, rowId: action.payload.rowId, fieldKey: action.payload.fieldKey };
|
|
@@ -1391,12 +1408,16 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1391
1408
|
state.pendingDataChanges = initialViewState.pendingDataChanges;
|
|
1392
1409
|
state.selectedCell = initialViewState.selectedCell;
|
|
1393
1410
|
}).addCase(showNotification, (state, action) => {
|
|
1411
|
+
var _a, _b;
|
|
1412
|
+
state.systemNotifications = (_a = state.systemNotifications) != null ? _a : [];
|
|
1394
1413
|
state.systemNotifications.push({
|
|
1395
1414
|
type: action.payload.type,
|
|
1396
1415
|
message: action.payload.message,
|
|
1397
|
-
id: state.systemNotifications.length
|
|
1416
|
+
id: (_b = state.systemNotifications) == null ? void 0 : _b.length
|
|
1398
1417
|
});
|
|
1399
1418
|
}).addCase(closeNotification, (state, action) => {
|
|
1419
|
+
var _a;
|
|
1420
|
+
state.systemNotifications = (_a = state.systemNotifications) != null ? _a : [];
|
|
1400
1421
|
state.systemNotifications = state.systemNotifications.filter((item) => item.id !== action.payload.id);
|
|
1401
1422
|
}).addCase(showViewError, (state, action) => {
|
|
1402
1423
|
state.error = action.payload.error;
|
|
@@ -1526,10 +1547,10 @@ var sendOperationEpic = (action$, state$, { api }) => action$.pipe(filter(sendOp
|
|
|
1526
1547
|
}
|
|
1527
1548
|
const context = { widgetName: action.payload.widgetName };
|
|
1528
1549
|
return api.customAction(screenName, bcUrl, data, context, params).pipe(mergeMap((response) => {
|
|
1529
|
-
var _a2;
|
|
1530
|
-
const postInvoke = response.postActions[0];
|
|
1550
|
+
var _a2, _b2;
|
|
1551
|
+
const postInvoke = (_a2 = response.postActions) == null ? void 0 : _a2[0];
|
|
1531
1552
|
const preInvoke = response.preInvoke;
|
|
1532
|
-
return defaultSaveOperation ? ((
|
|
1553
|
+
return defaultSaveOperation ? ((_b2 = action == null ? void 0 : action.payload) == null ? void 0 : _b2.onSuccessAction) ? concat(of2(bcCancelPendingChanges({ bcNames: [bcName] })), of2(action.payload.onSuccessAction)) : EMPTY : concat(of2(sendOperationSuccess({ bcName, cursor })), of2(bcForceUpdate({ bcName })), ...postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName));
|
|
1533
1554
|
}), catchError((e) => {
|
|
1534
1555
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
1535
1556
|
console.error(e);
|
|
@@ -1590,16 +1611,17 @@ var showAssocPopupEpic = (action$, state$) => action$.pipe(filter2(showViewPopup
|
|
|
1590
1611
|
import { concat as concat2, filter as filter3, mergeMap as mergeMap3, of as of4 } from "rxjs";
|
|
1591
1612
|
import { OperationTypeCrud as OperationTypeCrud5 } from "@cxbox-ui/schema";
|
|
1592
1613
|
var fileUploadConfirmEpic = (action$, state$, { api }) => action$.pipe(filter3(bulkUploadFiles.match), mergeMap3((action) => {
|
|
1593
|
-
var _a;
|
|
1614
|
+
var _a, _b;
|
|
1594
1615
|
const state = state$.value;
|
|
1595
|
-
const bcName = state.view.popupData.bcName;
|
|
1616
|
+
const bcName = (_a = state.view.popupData) == null ? void 0 : _a.bcName;
|
|
1596
1617
|
const bcUrl = buildBcUrl(bcName, true, state);
|
|
1597
|
-
const widgetName = (
|
|
1618
|
+
const widgetName = (_b = state.view.widgets.find((item) => item.bcName === bcName)) == null ? void 0 : _b.name;
|
|
1598
1619
|
const data = {
|
|
1599
1620
|
bulkIds: action.payload.fileIds
|
|
1600
1621
|
};
|
|
1601
1622
|
return api.customAction(state.screen.screenName, bcUrl, data, null, { _action: "file-upload-save" }).pipe(mergeMap3((response) => {
|
|
1602
|
-
|
|
1623
|
+
var _a2;
|
|
1624
|
+
const postInvoke = (_a2 = response.postActions) == null ? void 0 : _a2[0];
|
|
1603
1625
|
const preInvoke = response.preInvoke;
|
|
1604
1626
|
return concat2(of4(sendOperationSuccess({ bcName, cursor: null })), of4(bcForceUpdate({ bcName })), of4(closeViewPopup(null)), ...postOperationRoutine(widgetName, postInvoke, preInvoke, OperationTypeCrud5.save, bcName));
|
|
1605
1627
|
}));
|
|
@@ -1612,14 +1634,14 @@ var selectTableCellInitEpic = (action$, state$) => action$.pipe(filter4(selectTa
|
|
|
1612
1634
|
const state = state$.value;
|
|
1613
1635
|
const { rowId: nextRowId, fieldKey } = action.payload;
|
|
1614
1636
|
const nextWidget = state.view.widgets.find((widget) => widget.name === action.payload.widgetName);
|
|
1615
|
-
const nextBcName = nextWidget.bcName;
|
|
1637
|
+
const nextBcName = nextWidget == null ? void 0 : nextWidget.bcName;
|
|
1616
1638
|
const nextBcCursor = (_a = state.screen.bo.bc[nextBcName]) == null ? void 0 : _a.cursor;
|
|
1617
1639
|
const selectedCell = state.view.selectedCell;
|
|
1618
1640
|
if (nextRowId !== nextBcCursor) {
|
|
1619
1641
|
resultObservables.push(of5(bcSelectRecord({ bcName: nextBcName, cursor: nextRowId })));
|
|
1620
1642
|
}
|
|
1621
|
-
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || nextWidget.name !== selectedCell.widgetName) {
|
|
1622
|
-
resultObservables.push(of5(selectTableCell({ widgetName: nextWidget.name, rowId: nextRowId, fieldKey })));
|
|
1643
|
+
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || (nextWidget == null ? void 0 : nextWidget.name) !== selectedCell.widgetName) {
|
|
1644
|
+
resultObservables.push(of5(selectTableCell({ widgetName: nextWidget == null ? void 0 : nextWidget.name, rowId: nextRowId, fieldKey })));
|
|
1623
1645
|
}
|
|
1624
1646
|
return concat3(...resultObservables);
|
|
1625
1647
|
}));
|
|
@@ -1667,7 +1689,7 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1667
1689
|
const currentRecordData = (_b = state.data[bcName]) == null ? void 0 : _b.find((record) => record.id === cursor);
|
|
1668
1690
|
const fieldsRowMeta = (_d = (_c = state.view.rowMeta[bcName]) == null ? void 0 : _c[bcUrl]) == null ? void 0 : _d.fields;
|
|
1669
1691
|
let changedFiledKey = null;
|
|
1670
|
-
const closePopup = concat5(of7(
|
|
1692
|
+
const closePopup = concat5(of7(closeViewPopup(null)), of7(viewClearPickMap(null)), of7(bcRemoveAllFilters({ bcName })));
|
|
1671
1693
|
const someForceActiveChanged = fieldsRowMeta == null ? void 0 : fieldsRowMeta.filter((field) => field.forceActive && pendingChanges[field.key] !== void 0).some((field) => {
|
|
1672
1694
|
const result = pendingChanges[field.key] !== handledForceActive[field.key];
|
|
1673
1695
|
if (result) {
|
|
@@ -1677,7 +1699,7 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1677
1699
|
});
|
|
1678
1700
|
const requestId = nanoid();
|
|
1679
1701
|
if (someForceActiveChanged && !disableRetry) {
|
|
1680
|
-
return concat5(of7(addPendingRequest({ request: { requestId, type: "force-active" } })), api.getRmByForceActive(state.screen.screenName, bcUrl, __spreadProps(__spreadValues({}, pendingChanges), { vstamp: currentRecordData.vstamp })).pipe(mergeMap6((data) => {
|
|
1702
|
+
return concat5(of7(addPendingRequest({ request: { requestId, type: "force-active" } })), api.getRmByForceActive(state.screen.screenName, bcUrl, __spreadProps(__spreadValues({}, pendingChanges), { vstamp: currentRecordData == null ? void 0 : currentRecordData.vstamp })).pipe(mergeMap6((data) => {
|
|
1681
1703
|
const result = [of7(removePendingRequest({ requestId }))];
|
|
1682
1704
|
if (state.view.url === initUrl) {
|
|
1683
1705
|
result.push(of7(forceActiveRmUpdate({
|
|
@@ -1706,7 +1728,7 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1706
1728
|
bcName,
|
|
1707
1729
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
1708
1730
|
cursor,
|
|
1709
|
-
dataItem: { [changedFiledKey]: currentRecordData[changedFiledKey] },
|
|
1731
|
+
dataItem: { [changedFiledKey]: currentRecordData == null ? void 0 : currentRecordData[changedFiledKey] },
|
|
1710
1732
|
disableRetry: true
|
|
1711
1733
|
})), of7(forceActiveChangeFail({ bcName, bcUrl, viewError, entityError }))) : EMPTY3);
|
|
1712
1734
|
})));
|
|
@@ -1717,9 +1739,14 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1717
1739
|
import { concat as concat6, filter as filter8, mergeMap as mergeMap7, of as of8 } from "rxjs";
|
|
1718
1740
|
var showAllTableRecordsInitEpic = (action$, state$) => action$.pipe(filter8(showAllTableRecordsInit.match), mergeMap7((action) => {
|
|
1719
1741
|
const resultObservables = [];
|
|
1720
|
-
const { bcName } = action.payload;
|
|
1742
|
+
const { bcName, cursor } = action.payload;
|
|
1743
|
+
const state = state$.value;
|
|
1744
|
+
const route = state.router;
|
|
1721
1745
|
resultObservables.push(of8(bcChangeCursors({ cursorsMap: { [bcName]: null } })));
|
|
1746
|
+
const bcPath = route.bcPath.slice(0, route.bcPath.indexOf(`${bcName}/${cursor}`));
|
|
1747
|
+
const url = defaultBuildURL(__spreadProps(__spreadValues({}, route), { bcPath }));
|
|
1722
1748
|
resultObservables.push(of8(bcForceUpdate({ bcName })));
|
|
1749
|
+
resultObservables.push(of8(changeLocation({ location: defaultParseURL(new URL(url, window.location.origin)) })));
|
|
1723
1750
|
return concat6(...resultObservables);
|
|
1724
1751
|
}));
|
|
1725
1752
|
// src/epics/view/clearPendingDataChangesAfterCursorChangeEpic.ts
|
|
@@ -1741,10 +1768,107 @@ var clearPendingDataChangesAfterCursorChangeEpic = (action$, state$) => action$.
|
|
|
1741
1768
|
return EMPTY4;
|
|
1742
1769
|
}));
|
|
1743
1770
|
// src/epics/router/drilldownEpic.ts
|
|
1744
|
-
import { EMPTY as EMPTY5, filter as filter10, switchMap } from "rxjs";
|
|
1771
|
+
import { concat as concat7, EMPTY as EMPTY5, filter as filter10, switchMap } from "rxjs";
|
|
1745
1772
|
var drillDownEpic = (action$, state$) => action$.pipe(filter10(drillDown.match), switchMap((action) => {
|
|
1746
|
-
|
|
1773
|
+
var _a, _b;
|
|
1774
|
+
const state = state$.value;
|
|
1775
|
+
const url = action.payload.url;
|
|
1776
|
+
const result = [];
|
|
1777
|
+
switch (action.payload.drillDownType) {
|
|
1778
|
+
case DrillDownType.external:
|
|
1779
|
+
window.location.href = url;
|
|
1780
|
+
break;
|
|
1781
|
+
case DrillDownType.externalNew:
|
|
1782
|
+
if (/^[a-z0-9]+:\/\//i.test(url)) {
|
|
1783
|
+
window.open(url);
|
|
1784
|
+
}
|
|
1785
|
+
break;
|
|
1786
|
+
case DrillDownType.relative:
|
|
1787
|
+
window.location.href = `${window.location.origin}/${url}`;
|
|
1788
|
+
break;
|
|
1789
|
+
case DrillDownType.relativeNew:
|
|
1790
|
+
window.open(`${window.location.origin}/${url}`, "_blank");
|
|
1791
|
+
break;
|
|
1792
|
+
case DrillDownType.inner:
|
|
1793
|
+
default:
|
|
1794
|
+
const [urlBase] = url.split("?");
|
|
1795
|
+
const urlObject = new URL(url, window.location.origin);
|
|
1796
|
+
const urlFilters = urlObject.searchParams.get("filters");
|
|
1797
|
+
const urlSorters = urlObject.searchParams.get("sorters");
|
|
1798
|
+
let newFilters = {};
|
|
1799
|
+
let newSorters = {};
|
|
1800
|
+
try {
|
|
1801
|
+
newFilters = (_a = JSON.parse(urlFilters)) != null ? _a : newFilters;
|
|
1802
|
+
}
|
|
1803
|
+
catch (e) {
|
|
1804
|
+
urlFilters && console.warn("Failed to parse filters on drilldown");
|
|
1805
|
+
newFilters = {};
|
|
1806
|
+
}
|
|
1807
|
+
try {
|
|
1808
|
+
newSorters = (_b = JSON.parse(urlSorters)) != null ? _b : newSorters;
|
|
1809
|
+
}
|
|
1810
|
+
catch (e) {
|
|
1811
|
+
urlSorters && console.warn("Failed to parse sorters on drilldown");
|
|
1812
|
+
newSorters = {};
|
|
1813
|
+
}
|
|
1814
|
+
const bcToUpdate = {};
|
|
1815
|
+
Object.keys(state.screen.filters).forEach((bcName) => {
|
|
1816
|
+
if (newFilters[bcName] === "" || newFilters[bcName]) {
|
|
1817
|
+
bcToUpdate[bcName] = true;
|
|
1818
|
+
result.push(bcRemoveAllFilters({ bcName }));
|
|
1819
|
+
}
|
|
1820
|
+
});
|
|
1821
|
+
const nextState = defaultParseURL(urlObject);
|
|
1822
|
+
const viewName = nextState.viewName;
|
|
1823
|
+
Object.entries(newFilters).forEach(([bcName, filterExpression]) => {
|
|
1824
|
+
var _a2;
|
|
1825
|
+
const parsedFilters = (_a2 = parseFilters(filterExpression)) == null ? void 0 : _a2.map((item) => __spreadProps(__spreadValues({}, item), { viewName }));
|
|
1826
|
+
parsedFilters == null ? void 0 : parsedFilters.forEach((parsedFilter) => {
|
|
1827
|
+
bcToUpdate[bcName] = true;
|
|
1828
|
+
result.push(bcAddFilter({ bcName, filter: parsedFilter }));
|
|
1829
|
+
});
|
|
1830
|
+
});
|
|
1831
|
+
Object.entries(newSorters).forEach(([bcName, sortExpression]) => {
|
|
1832
|
+
const sorter = parseSorters(sortExpression);
|
|
1833
|
+
result.push(bcAddSorter({ bcName, sorter }));
|
|
1834
|
+
bcToUpdate[bcName] = true;
|
|
1835
|
+
});
|
|
1836
|
+
const prevState = state.router;
|
|
1837
|
+
const willUpdateAnyway = shallowCompare(prevState, nextState, ["params"]).length > 0;
|
|
1838
|
+
if (!willUpdateAnyway) {
|
|
1839
|
+
Object.keys(bcToUpdate).forEach((bcName) => {
|
|
1840
|
+
result.push(bcForceUpdate({ bcName }));
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
result.push(changeLocation({ location: defaultParseURL(new URL(makeRelativeUrl(urlBase), window.location.origin)) }));
|
|
1844
|
+
break;
|
|
1845
|
+
}
|
|
1846
|
+
return result.length ? concat7(result) : EMPTY5;
|
|
1747
1847
|
}));
|
|
1848
|
+
function shallowCompare(prevProps, nextProps, ignore = []) {
|
|
1849
|
+
const diffProps = [];
|
|
1850
|
+
if (!prevProps && !nextProps) {
|
|
1851
|
+
return null;
|
|
1852
|
+
}
|
|
1853
|
+
if (!prevProps) {
|
|
1854
|
+
return Object.keys(nextProps);
|
|
1855
|
+
}
|
|
1856
|
+
if (!nextProps) {
|
|
1857
|
+
return Object.keys(prevProps);
|
|
1858
|
+
}
|
|
1859
|
+
const newKeys = Object.keys(nextProps);
|
|
1860
|
+
newKeys.forEach((key) => {
|
|
1861
|
+
if (prevProps[key] !== nextProps[key] && !ignore.includes(key)) {
|
|
1862
|
+
diffProps.push(key);
|
|
1863
|
+
}
|
|
1864
|
+
});
|
|
1865
|
+
Object.keys(prevProps).forEach((key) => {
|
|
1866
|
+
if (!newKeys.includes(key)) {
|
|
1867
|
+
diffProps.push(key);
|
|
1868
|
+
}
|
|
1869
|
+
});
|
|
1870
|
+
return diffProps;
|
|
1871
|
+
}
|
|
1748
1872
|
// src/epics/router/loginDoneEpic.ts
|
|
1749
1873
|
import { filter as filter11, of as of10, switchMap as switchMap2 } from "rxjs";
|
|
1750
1874
|
var loginDoneEpic = (action$, state$) => action$.pipe(filter11(loginDone.match), switchMap2((action) => {
|
|
@@ -1797,7 +1921,7 @@ var changeScreen = (action$, state$) => action$.pipe(filter14(selectScreen.match
|
|
|
1797
1921
|
return nextView ? of12(selectView(nextView)) : of12(selectViewFail({ viewName: nextViewName }));
|
|
1798
1922
|
}));
|
|
1799
1923
|
// src/epics/router/userDrillDownEpic.ts
|
|
1800
|
-
import { catchError as catchError4, concat as
|
|
1924
|
+
import { catchError as catchError4, concat as concat8, EMPTY as EMPTY8, filter as filter15, mergeMap as mergeMap10, of as of13, switchMap as switchMap6 } from "rxjs";
|
|
1801
1925
|
var userDrillDownEpic = (action$, state$, { api }) => action$.pipe(filter15(userDrillDown.match), switchMap6((action) => {
|
|
1802
1926
|
const state = state$.value;
|
|
1803
1927
|
const { bcName, fieldKey, cursor } = action.payload;
|
|
@@ -1808,7 +1932,7 @@ var userDrillDownEpic = (action$, state$, { api }) => action$.pipe(filter15(user
|
|
|
1808
1932
|
const route = state.router;
|
|
1809
1933
|
const drillDownKey = (_b = (_a = state.view.widgets.find((widget) => widget.bcName === bcName)) == null ? void 0 : _a.fields.find((field) => field.key === fieldKey)) == null ? void 0 : _b.drillDownKey;
|
|
1810
1934
|
const customDrillDownUrl = (_d = (_c = state.data[bcName]) == null ? void 0 : _c.find((record) => record.id === cursor)) == null ? void 0 : _d[drillDownKey];
|
|
1811
|
-
return customDrillDownUrl || (drillDownField == null ? void 0 : drillDownField.drillDown) || (drillDownField == null ? void 0 : drillDownField.drillDown) !== route.path ?
|
|
1935
|
+
return customDrillDownUrl || (drillDownField == null ? void 0 : drillDownField.drillDown) || (drillDownField == null ? void 0 : drillDownField.drillDown) !== route.path ? concat8((drillDownField == null ? void 0 : drillDownField.drillDownType) !== DrillDownType.inner ? of13(bcFetchRowMetaSuccess({ bcName, rowMeta, bcUrl, cursor })) : EMPTY8, of13(userDrillDownSuccess({ bcName, bcUrl, cursor })), of13(drillDown({
|
|
1812
1936
|
url: customDrillDownUrl || drillDownField.drillDown,
|
|
1813
1937
|
drillDownType: drillDownField.drillDownType,
|
|
1814
1938
|
route
|
|
@@ -1819,7 +1943,7 @@ var userDrillDownEpic = (action$, state$, { api }) => action$.pipe(filter15(user
|
|
|
1819
1943
|
}));
|
|
1820
1944
|
}));
|
|
1821
1945
|
// src/epics/router/changeLocationEpic.ts
|
|
1822
|
-
import { concat as
|
|
1946
|
+
import { concat as concat9, EMPTY as EMPTY9, filter as filter16, mergeMap as mergeMap11, of as of14 } from "rxjs";
|
|
1823
1947
|
var changeLocationEpic = (action$, state$) => action$.pipe(filter16(changeLocation.match), mergeMap11((action) => {
|
|
1824
1948
|
var _a, _b;
|
|
1825
1949
|
const state = state$.value;
|
|
@@ -1865,7 +1989,7 @@ var changeLocationEpic = (action$, state$) => action$.pipe(filter16(changeLocati
|
|
|
1865
1989
|
}
|
|
1866
1990
|
});
|
|
1867
1991
|
}
|
|
1868
|
-
return
|
|
1992
|
+
return concat9(...resultObservables);
|
|
1869
1993
|
}));
|
|
1870
1994
|
// src/epics/router/selectViewFailEpic.ts
|
|
1871
1995
|
import { filter as filter17, map as map2 } from "rxjs";
|
|
@@ -1897,7 +2021,7 @@ var userDrillDownChangeCursorsEpic = (action$, state$) => action$.pipe(filter19(
|
|
|
1897
2021
|
if (cursor !== action.payload.cursor) {
|
|
1898
2022
|
return bcChangeCursors({ cursorsMap: { [action.payload.bcName]: action.payload.cursor } });
|
|
1899
2023
|
}
|
|
1900
|
-
return
|
|
2024
|
+
return emptyAction;
|
|
1901
2025
|
}));
|
|
1902
2026
|
// src/epics/screen/apiErrorEpic.ts
|
|
1903
2027
|
import axios from "axios";
|
|
@@ -1923,7 +2047,9 @@ var apiErrorEpic = (action$) => action$.pipe(filter20(apiError.match), mergeMap1
|
|
|
1923
2047
|
// src/epics/screen/downloadFileEpic.ts
|
|
1924
2048
|
import { EMPTY as EMPTY11, filter as filter21, mergeMap as mergeMap13, tap } from "rxjs";
|
|
1925
2049
|
var downloadFileEpic = (action$, state$, { api }) => action$.pipe(filter21(downloadFile.match), tap((action) => {
|
|
2050
|
+
const { fileId } = action.payload;
|
|
1926
2051
|
const anchor = document.createElement("a");
|
|
2052
|
+
anchor.href = `${api.fileUploadEndpoint}?id=${encodeURIComponent(fileId)}`;
|
|
1927
2053
|
anchor.style.display = "none";
|
|
1928
2054
|
document.body.appendChild(anchor);
|
|
1929
2055
|
setTimeout(() => {
|
|
@@ -1939,8 +2065,8 @@ var httpError401Epic = (action$) => action$.pipe(filter22(httpError.match), filt
|
|
|
1939
2065
|
// src/epics/screen/httpError409Epic.ts
|
|
1940
2066
|
import { filter as filter23, map as map6 } from "rxjs";
|
|
1941
2067
|
var httpError409Epic = (action$, state$) => action$.pipe(filter23(httpError.match), filter23((action) => action.payload.statusCode === 409), map6((action) => {
|
|
1942
|
-
var _a, _b;
|
|
1943
|
-
const notificationMessage = ((_b = (_a = action.payload.error.response.data.error) == null ? void 0 :
|
|
2068
|
+
var _a, _b, _c;
|
|
2069
|
+
const notificationMessage = ((_c = (_b = ((_a = action.payload.error.response) == null ? void 0 : _a.data).error) == null ? void 0 : _b.popup) == null ? void 0 : _c[0]) || "";
|
|
1944
2070
|
return addNotification({
|
|
1945
2071
|
key: "action_edit_error",
|
|
1946
2072
|
message: notificationMessage,
|
|
@@ -1954,12 +2080,12 @@ var httpError409Epic = (action$, state$) => action$.pipe(filter23(httpError.matc
|
|
|
1954
2080
|
});
|
|
1955
2081
|
}));
|
|
1956
2082
|
// src/epics/screen/httpError418Epic.ts
|
|
1957
|
-
import { concat as
|
|
2083
|
+
import { concat as concat10, EMPTY as EMPTY12, filter as filter24, mergeMap as mergeMap14, of as of16 } from "rxjs";
|
|
1958
2084
|
var httpError418Epic = (action$, state$) => action$.pipe(filter24(httpError.match), filter24((action) => action.payload.statusCode === 418), mergeMap14((action) => {
|
|
1959
|
-
var _a;
|
|
2085
|
+
var _a, _b;
|
|
1960
2086
|
const { error, callContext } = action.payload;
|
|
1961
2087
|
const result = [];
|
|
1962
|
-
const typedError = error.response.data;
|
|
2088
|
+
const typedError = (_a = error.response) == null ? void 0 : _a.data;
|
|
1963
2089
|
if (!typedError.error.popup) {
|
|
1964
2090
|
return EMPTY12;
|
|
1965
2091
|
}
|
|
@@ -1968,16 +2094,16 @@ var httpError418Epic = (action$, state$) => action$.pipe(filter24(httpError.matc
|
|
|
1968
2094
|
message: typedError.error.popup[0]
|
|
1969
2095
|
};
|
|
1970
2096
|
result.push(of16(showViewError({ error: businessError })));
|
|
1971
|
-
if ((
|
|
2097
|
+
if ((_b = typedError.error.postActions) == null ? void 0 : _b[0]) {
|
|
1972
2098
|
const widget = state$.value.view.widgets.find((item) => item.name === callContext.widgetName);
|
|
1973
|
-
const bcName = widget.bcName;
|
|
2099
|
+
const bcName = widget == null ? void 0 : widget.bcName;
|
|
1974
2100
|
result.push(of16(processPostInvoke({
|
|
1975
2101
|
bcName,
|
|
1976
2102
|
postInvoke: typedError.error.postActions[0],
|
|
1977
|
-
widgetName: widget.name
|
|
2103
|
+
widgetName: widget == null ? void 0 : widget.name
|
|
1978
2104
|
})));
|
|
1979
2105
|
}
|
|
1980
|
-
return
|
|
2106
|
+
return concat10(...result);
|
|
1981
2107
|
}));
|
|
1982
2108
|
// src/epics/screen/httpError500Epic.ts
|
|
1983
2109
|
import { filter as filter25, map as map7 } from "rxjs";
|
|
@@ -1994,10 +2120,11 @@ var httpError500Epic = (action$, state$) => action$.pipe(filter25(httpError.matc
|
|
|
1994
2120
|
import { filter as filter26, map as map8 } from "rxjs";
|
|
1995
2121
|
var knownHttpErrors = [401, 409, 418, 500];
|
|
1996
2122
|
var httpErrorDefaultEpic = (action$, state$) => action$.pipe(filter26(httpError.match), filter26((action) => !knownHttpErrors.includes(action.payload.statusCode)), map8((action) => {
|
|
2123
|
+
var _a, _b;
|
|
1997
2124
|
const businessError = {
|
|
1998
2125
|
type: 0 /* BusinessError */,
|
|
1999
|
-
code: action.payload.error.response.status,
|
|
2000
|
-
details: action.payload.error.response.data
|
|
2126
|
+
code: (_a = action.payload.error.response) == null ? void 0 : _a.status,
|
|
2127
|
+
details: (_b = action.payload.error.response) == null ? void 0 : _b.data
|
|
2001
2128
|
};
|
|
2002
2129
|
return showViewError({ error: businessError });
|
|
2003
2130
|
}));
|
|
@@ -2017,6 +2144,7 @@ var downloadFileByUrlEpic = (action$, state$) => action$.pipe(filter27(downloadF
|
|
|
2017
2144
|
// src/epics/screen/processPostInvokeEpic.ts
|
|
2018
2145
|
import { EMPTY as EMPTY14, filter as filter28, mergeMap as mergeMap16, of as of17 } from "rxjs";
|
|
2019
2146
|
var processPostInvokeEpic = (action$, state$) => action$.pipe(filter28(processPostInvoke.match), mergeMap16((action) => {
|
|
2147
|
+
var _a;
|
|
2020
2148
|
const state = state$.value;
|
|
2021
2149
|
switch (action.payload.postInvoke.type) {
|
|
2022
2150
|
case "drillDown" /* drillDown */:
|
|
@@ -2027,7 +2155,10 @@ var processPostInvokeEpic = (action$, state$) => action$.pipe(filter28(processPo
|
|
|
2027
2155
|
case "postDelete" /* postDelete */: {
|
|
2028
2156
|
const cursorsMap = { [action.payload.bcName]: null };
|
|
2029
2157
|
const result = [bcChangeCursors({ cursorsMap })];
|
|
2030
|
-
if (state.router.bcPath.includes(`${action.payload.bcName}/`)) {
|
|
2158
|
+
if ((_a = state.router.bcPath) == null ? void 0 : _a.includes(`${action.payload.bcName}/`)) {
|
|
2159
|
+
const newBcUrl = state.router.bcPath.split(action.payload.bcName)[0] || "";
|
|
2160
|
+
const newUrl = `/screen/${state.router.screenName}/view/${state.router.viewName}/${newBcUrl}`;
|
|
2161
|
+
result.push(changeLocation({ location: defaultParseURL(new URL(newUrl, window.location.origin)) }));
|
|
2031
2162
|
}
|
|
2032
2163
|
else {
|
|
2033
2164
|
result.push(bcFetchDataRequest({
|
|
@@ -2096,22 +2227,21 @@ var processPostInvokeConfirmEpic = (action$, state$) => action$.pipe(filter29(is
|
|
|
2096
2227
|
}
|
|
2097
2228
|
}));
|
|
2098
2229
|
// src/epics/session/switchRoleEpic.ts
|
|
2099
|
-
import { concat as
|
|
2230
|
+
import { concat as concat11, filter as filter30, switchMap as switchMap7 } from "rxjs";
|
|
2100
2231
|
var switchRoleEpic = (action$, state$) => action$.pipe(filter30(switchRole.match), switchMap7((action) => {
|
|
2101
|
-
return
|
|
2232
|
+
return concat11([logoutDone(null), login({ login: "", password: "", role: action.payload.role })]);
|
|
2102
2233
|
}));
|
|
2103
2234
|
// src/epics/session/refreshMetaEpic.ts
|
|
2104
|
-
import { catchError as catchError5, concat as
|
|
2235
|
+
import { catchError as catchError5, concat as concat12, filter as filter31, mergeMap as mergeMap18, of as of19, switchMap as switchMap8 } from "rxjs";
|
|
2105
2236
|
var refreshMetaEpic = (action$, state$, { api }) => action$.pipe(filter31(refreshMeta.match), mergeMap18(() => {
|
|
2106
2237
|
const state = state$.value;
|
|
2107
2238
|
const { router } = state;
|
|
2108
2239
|
const { activeRole } = state.session;
|
|
2109
|
-
return api.refreshMeta().pipe(switchMap8(() =>
|
|
2240
|
+
return api.refreshMeta().pipe(switchMap8(() => concat12([
|
|
2110
2241
|
logoutDone(null),
|
|
2111
2242
|
login({ login: "", password: "", role: activeRole }),
|
|
2112
2243
|
changeLocation({
|
|
2113
|
-
|
|
2114
|
-
action: "PUSH"
|
|
2244
|
+
location: router
|
|
2115
2245
|
})
|
|
2116
2246
|
])), catchError5((error) => of19(loginFail(error))));
|
|
2117
2247
|
}));
|
|
@@ -2119,7 +2249,7 @@ var refreshMetaEpic = (action$, state$, { api }) => action$.pipe(filter31(refres
|
|
|
2119
2249
|
import { EMPTY as EMPTY16, filter as filter32, switchMap as switchMap9 } from "rxjs";
|
|
2120
2250
|
var loginDoneSessionEpic = (action$, store) => action$.pipe(filter32(login.match), switchMap9((action) => EMPTY16));
|
|
2121
2251
|
// src/epics/session/loginByAnotherRoleEpic.ts
|
|
2122
|
-
import { catchError as catchError6,
|
|
2252
|
+
import { catchError as catchError6, concat as concat13, filter as filter33, mergeMap as mergeMap19, of as of20, switchMap as switchMap10 } from "rxjs";
|
|
2123
2253
|
var responseStatusMessages = {
|
|
2124
2254
|
401: "Invalid credentials",
|
|
2125
2255
|
403: "Access denied"
|
|
@@ -2132,9 +2262,27 @@ var loginByAnotherRoleEpic = (action$, state$, { api }) => action$.pipe(filter33
|
|
|
2132
2262
|
const role = (_a = action.payload.role) != null ? _a : "";
|
|
2133
2263
|
const isSwitchRole = role && role !== state$.value.session.activeRole;
|
|
2134
2264
|
return api.loginByRoleRequest(role).pipe(mergeMap19((data) => {
|
|
2265
|
+
var _a2;
|
|
2266
|
+
const result = [];
|
|
2135
2267
|
if (isSwitchRole) {
|
|
2136
|
-
|
|
2137
|
-
|
|
2268
|
+
const defaultScreen = data.screens.find((screen) => screen.defaultScreen) || data.screens[0];
|
|
2269
|
+
const defaultViewName = (_a2 = defaultScreen == null ? void 0 : defaultScreen.primary) != null ? _a2 : defaultScreen.meta.views[0].name;
|
|
2270
|
+
const defaultView = defaultScreen == null ? void 0 : defaultScreen.meta.views.find((view) => defaultViewName === view.name);
|
|
2271
|
+
if (defaultView)
|
|
2272
|
+
result.push(changeLocation({ location: defaultParseURL(new URL(defaultView.url, window.location.origin)) }));
|
|
2273
|
+
}
|
|
2274
|
+
return concat13([
|
|
2275
|
+
...result,
|
|
2276
|
+
loginDone({
|
|
2277
|
+
devPanelEnabled: data.devPanelEnabled,
|
|
2278
|
+
activeRole: data.activeRole,
|
|
2279
|
+
roles: data.roles,
|
|
2280
|
+
screens: data.screens,
|
|
2281
|
+
firstName: data.firstName,
|
|
2282
|
+
lastName: data.lastName,
|
|
2283
|
+
login: data.login
|
|
2284
|
+
})
|
|
2285
|
+
]);
|
|
2138
2286
|
}), catchError6((error) => {
|
|
2139
2287
|
console.error(error);
|
|
2140
2288
|
const errorMsg = error.response ? responseStatusMessages[error.response.status] || "Server application unavailable" : "Empty server response";
|
|
@@ -2142,33 +2290,35 @@ var loginByAnotherRoleEpic = (action$, state$, { api }) => action$.pipe(filter33
|
|
|
2142
2290
|
}));
|
|
2143
2291
|
}));
|
|
2144
2292
|
// src/epics/session/refreshMetaAndReloadPageEpic.ts
|
|
2145
|
-
import { concat as
|
|
2146
|
-
var refreshMetaAndReloadPageEpic = (action$, state$) => action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(() =>
|
|
2293
|
+
import { concat as concat14, EMPTY as EMPTY17, filter as filter34, of as of21, switchMap as switchMap11, take, tap as tap3 } from "rxjs";
|
|
2294
|
+
var refreshMetaAndReloadPageEpic = (action$, state$) => action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(() => concat14(of21(refreshMeta(null)), action$.pipe(filter34(loginDone.match), take(1), tap3(() => location.reload()), switchMap11(() => EMPTY17)))));
|
|
2147
2295
|
// src/epics/data/bcNewDataEpic.ts
|
|
2148
|
-
import { catchError as catchError7, concat as
|
|
2296
|
+
import { catchError as catchError7, concat as concat15, EMPTY as EMPTY18, filter as filter35, mergeMap as mergeMap20, of as of22 } from "rxjs";
|
|
2149
2297
|
import { OperationTypeCrud as OperationTypeCrud8 } from "@cxbox-ui/schema";
|
|
2150
2298
|
var bcNewDataEpic = (action$, state$, { api }) => action$.pipe(filter35(sendOperation.match), filter35((action) => matchOperationRole(OperationTypeCrud8.create, action.payload, state$.value)), mergeMap20((action) => {
|
|
2299
|
+
var _a;
|
|
2151
2300
|
const state = state$.value;
|
|
2152
2301
|
const bcName = action.payload.bcName;
|
|
2153
|
-
const bcUrl = buildBcUrl(bcName, false, state);
|
|
2302
|
+
const bcUrl = (_a = buildBcUrl(bcName, false, state)) != null ? _a : "";
|
|
2154
2303
|
const context = { widgetName: action.payload.widgetName };
|
|
2155
2304
|
const params = { _action: action.payload.operationType };
|
|
2156
2305
|
return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe(mergeMap20((data) => {
|
|
2306
|
+
var _a2, _b;
|
|
2157
2307
|
const rowMeta = data.row;
|
|
2158
2308
|
const dataItem = { id: null, vstamp: -1 };
|
|
2159
2309
|
data.row.fields.forEach((field) => {
|
|
2160
2310
|
dataItem[field.key] = field.currentValue;
|
|
2161
2311
|
});
|
|
2162
|
-
const postInvoke = data.postActions[0];
|
|
2312
|
+
const postInvoke = (_a2 = data.postActions) == null ? void 0 : _a2[0];
|
|
2163
2313
|
const cursor = dataItem.id;
|
|
2164
|
-
return
|
|
2314
|
+
return concat15(of22(bcNewDataSuccess({ bcName, dataItem, bcUrl })), of22(bcFetchRowMetaSuccess({ bcName, bcUrl: `${bcUrl}/${cursor}`, rowMeta, cursor })), of22(changeDataItem({
|
|
2165
2315
|
bcName,
|
|
2166
|
-
bcUrl: buildBcUrl(bcName, true, state),
|
|
2316
|
+
bcUrl: (_b = buildBcUrl(bcName, true, state)) != null ? _b : "",
|
|
2167
2317
|
cursor,
|
|
2168
2318
|
dataItem: {
|
|
2169
2319
|
id: cursor
|
|
2170
2320
|
}
|
|
2171
|
-
})), postInvoke ? of22(processPostInvoke({ bcName, postInvoke, cursor, widgetName: action.payload.widgetName })) :
|
|
2321
|
+
})), postInvoke ? of22(processPostInvoke({ bcName, postInvoke, cursor, widgetName: action.payload.widgetName })) : EMPTY18);
|
|
2172
2322
|
}), catchError7((error) => {
|
|
2173
2323
|
console.error(error);
|
|
2174
2324
|
return of22(bcNewDataFail({ bcName }));
|
|
@@ -2184,7 +2334,7 @@ function cancelRequestEpic(action$, actionTypes, cancelFn, cancelActionCreator,
|
|
|
2184
2334
|
return true;
|
|
2185
2335
|
}) {
|
|
2186
2336
|
return action$.pipe(filter36(isAnyOf2(...actionTypes)), filter36(filterFn), mergeMap21(() => {
|
|
2187
|
-
cancelFn();
|
|
2337
|
+
cancelFn == null ? void 0 : cancelFn();
|
|
2188
2338
|
return of23(cancelActionCreator);
|
|
2189
2339
|
}), take2(1));
|
|
2190
2340
|
}
|
|
@@ -2223,18 +2373,18 @@ var bcLoadMoreEpic = (action$, state$, { api }) => action$.pipe(filter37(bcLoadM
|
|
|
2223
2373
|
return race(cancelFlow, normalFlow);
|
|
2224
2374
|
}));
|
|
2225
2375
|
// src/epics/data/bcSaveDataEpic.ts
|
|
2226
|
-
import { catchError as catchError9, concat as
|
|
2376
|
+
import { catchError as catchError9, concat as concat16, EMPTY as EMPTY19, filter as filter38, mergeMap as mergeMap23, of as of25 } from "rxjs";
|
|
2227
2377
|
var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOperation.match), filter38((action) => matchOperationRole(OperationTypeCrud.save, action.payload, state$.value)), mergeMap23((action) => {
|
|
2228
|
-
var _a, _b, _c;
|
|
2378
|
+
var _a, _b, _c, _d;
|
|
2229
2379
|
const state = state$.value;
|
|
2230
2380
|
const bcName = action.payload.bcName;
|
|
2231
|
-
const bcUrl = buildBcUrl(bcName, true, state);
|
|
2381
|
+
const bcUrl = (_a = buildBcUrl(bcName, true, state)) != null ? _a : "";
|
|
2232
2382
|
const widgetName = action.payload.widgetName;
|
|
2233
2383
|
const cursor = state.screen.bo.bc[bcName].cursor;
|
|
2234
2384
|
const dataItem = state.data[bcName].find((item) => item.id === cursor);
|
|
2235
|
-
const pendingChanges = (
|
|
2236
|
-
const rowMeta = bcUrl && ((
|
|
2237
|
-
const options = (
|
|
2385
|
+
const pendingChanges = (_b = state.view.pendingDataChanges[bcName]) == null ? void 0 : _b[cursor];
|
|
2386
|
+
const rowMeta = bcUrl && ((_c = state.view.rowMeta[bcName]) == null ? void 0 : _c[bcUrl]);
|
|
2387
|
+
const options = (_d = state.view.widgets.find((widget) => widget.name === widgetName)) == null ? void 0 : _d.options;
|
|
2238
2388
|
if (rowMeta) {
|
|
2239
2389
|
const fields = rowMeta.fields;
|
|
2240
2390
|
for (const key in pendingChanges) {
|
|
@@ -2248,19 +2398,20 @@ var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOpe
|
|
|
2248
2398
|
return bcFetchDataRequest({ bcName: childBcName, widgetName: widgetNames[0] });
|
|
2249
2399
|
});
|
|
2250
2400
|
const context = { widgetName: action.payload.widgetName };
|
|
2251
|
-
return api.saveBcData(state.screen.screenName, bcUrl, __spreadProps(__spreadValues({}, pendingChanges), { vstamp: dataItem.vstamp }), context).pipe(mergeMap23((data) => {
|
|
2252
|
-
|
|
2401
|
+
return api.saveBcData(state.screen.screenName, bcUrl, __spreadProps(__spreadValues({}, pendingChanges), { vstamp: dataItem == null ? void 0 : dataItem.vstamp }), context).pipe(mergeMap23((data) => {
|
|
2402
|
+
var _a2;
|
|
2403
|
+
const postInvoke = (_a2 = data.postActions) == null ? void 0 : _a2[0];
|
|
2253
2404
|
const responseDataItem = data.record;
|
|
2254
|
-
return
|
|
2405
|
+
return concat16(of25(bcSaveDataSuccess({ bcName, cursor, dataItem: responseDataItem })), of25(bcFetchRowMeta({ widgetName, bcName })), of25(...fetchChildrenBcData), postInvoke ? of25(processPostInvoke({
|
|
2255
2406
|
bcName,
|
|
2256
2407
|
widgetName,
|
|
2257
2408
|
postInvoke,
|
|
2258
2409
|
cursor: responseDataItem.id
|
|
2259
|
-
})) :
|
|
2410
|
+
})) : EMPTY19, action.payload.onSuccessAction ? of25(action.payload.onSuccessAction) : EMPTY19);
|
|
2260
2411
|
}), catchError9((e) => {
|
|
2261
|
-
var _a2, _b2, _c2,
|
|
2412
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h;
|
|
2262
2413
|
console.error(e);
|
|
2263
|
-
let notification$ =
|
|
2414
|
+
let notification$ = EMPTY19;
|
|
2264
2415
|
if (action.payload.onSuccessAction && !(options == null ? void 0 : options.disableNotification)) {
|
|
2265
2416
|
notification$ = of25(addNotification({
|
|
2266
2417
|
key: "data_autosave_undo",
|
|
@@ -2279,14 +2430,14 @@ var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOpe
|
|
|
2279
2430
|
let entityError = null;
|
|
2280
2431
|
const operationError = (_a2 = e.response) == null ? void 0 : _a2.data;
|
|
2281
2432
|
if (((_b2 = e.response) == null ? void 0 : _b2.data) === Object((_c2 = e.response) == null ? void 0 : _c2.data)) {
|
|
2282
|
-
entityError = (
|
|
2283
|
-
viewError = (
|
|
2433
|
+
entityError = (_e = (_d2 = operationError == null ? void 0 : operationError.error) == null ? void 0 : _d2.entity) != null ? _e : entityError;
|
|
2434
|
+
viewError = (_h = (_g = (_f = operationError == null ? void 0 : operationError.error) == null ? void 0 : _f.popup) == null ? void 0 : _g[0]) != null ? _h : viewError;
|
|
2284
2435
|
}
|
|
2285
|
-
return
|
|
2436
|
+
return concat16(of25(bcSaveDataFail({ bcName, bcUrl, viewError, entityError })), notification$);
|
|
2286
2437
|
}));
|
|
2287
2438
|
}));
|
|
2288
2439
|
// src/epics/data/selectViewEpic.ts
|
|
2289
|
-
import { EMPTY as
|
|
2440
|
+
import { EMPTY as EMPTY20, filter as filter39, mergeMap as mergeMap24 } from "rxjs";
|
|
2290
2441
|
var selectViewEpic = (action$, state$) => action$.pipe(filter39(selectView.match), mergeMap24((action) => {
|
|
2291
2442
|
try {
|
|
2292
2443
|
const state = state$.value;
|
|
@@ -2311,11 +2462,11 @@ var selectViewEpic = (action$, state$) => action$.pipe(filter39(selectView.match
|
|
|
2311
2462
|
}
|
|
2312
2463
|
catch (e) {
|
|
2313
2464
|
console.error(`selectView Epic:: ${e}`);
|
|
2314
|
-
return
|
|
2465
|
+
return EMPTY20;
|
|
2315
2466
|
}
|
|
2316
2467
|
}));
|
|
2317
2468
|
// src/epics/data/bcFetchDataEpic.ts
|
|
2318
|
-
import { catchError as catchError10, concat as
|
|
2469
|
+
import { catchError as catchError10, concat as concat17, EMPTY as EMPTY21, filter as filter40, mergeMap as mergeMap25, of as of26, race as race2 } from "rxjs";
|
|
2319
2470
|
import { WidgetTypes as WidgetTypes5 } from "@cxbox-ui/schema";
|
|
2320
2471
|
import { isAnyOf as isAnyOf3 } from "@reduxjs/toolkit";
|
|
2321
2472
|
var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyOf3(bcFetchDataRequest, bcFetchDataPages, showViewPopup, bcForceUpdate, bcChangePage)), mergeMap25((action) => {
|
|
@@ -2334,7 +2485,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2334
2485
|
const getChildrenData = (widgets, bcDictionary, isHierarchy, showConditionCheck) => {
|
|
2335
2486
|
const { bcName } = action.payload;
|
|
2336
2487
|
const { ignorePageLimit, keepDelta } = bcFetchDataRequest.match(action) ? action.payload : { ignorePageLimit: void 0, keepDelta: void 0 };
|
|
2337
|
-
return
|
|
2488
|
+
return concat17(...Object.entries(getBcChildren(bcName, widgets, bcDictionary)).filter(([childBcName, widgetNames]) => {
|
|
2338
2489
|
const nonLazyWidget = widgets.find((item) => {
|
|
2339
2490
|
return widgetNames.includes(item.name) && !PopupWidgetTypes.includes(item.type) && showConditionCheck(item);
|
|
2340
2491
|
});
|
|
@@ -2349,44 +2500,44 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2349
2500
|
});
|
|
2350
2501
|
return of26(bcFetchDataRequest({
|
|
2351
2502
|
bcName: childBcName,
|
|
2352
|
-
widgetName: nonLazyWidget.name,
|
|
2503
|
+
widgetName: nonLazyWidget == null ? void 0 : nonLazyWidget.name,
|
|
2353
2504
|
ignorePageLimit: ignorePageLimit || showViewPopup.match(action),
|
|
2354
2505
|
keepDelta: isHierarchy || keepDelta
|
|
2355
2506
|
}));
|
|
2356
2507
|
}));
|
|
2357
2508
|
};
|
|
2358
2509
|
const bcFetchDataImpl = () => {
|
|
2359
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2510
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2360
2511
|
const state = state$.value;
|
|
2361
|
-
const { widgetName } = action.payload;
|
|
2512
|
+
const { widgetName = "" } = action.payload;
|
|
2362
2513
|
const { widgets, infiniteWidgets } = state.view;
|
|
2363
|
-
const widget = (_a = widgets.find((item) => item.name === widgetName)) != null ? _a : widgets.find((item) => item.bcName === action.payload.bcName);
|
|
2514
|
+
const widget = (_a = widgets == null ? void 0 : widgets.find((item) => item.name === widgetName)) != null ? _a : widgets == null ? void 0 : widgets.find((item) => item.bcName === action.payload.bcName);
|
|
2364
2515
|
if (!widget) {
|
|
2365
|
-
return [
|
|
2516
|
+
return [EMPTY21];
|
|
2366
2517
|
}
|
|
2367
2518
|
const bcName = action.payload.bcName;
|
|
2368
2519
|
const bc = state.screen.bo.bc[bcName];
|
|
2369
|
-
const { cursor, page } = bc;
|
|
2370
|
-
const limit = ((_b = widgets.find((i) => i.bcName === bcName)) == null ? void 0 : _b.limit) || bc.limit;
|
|
2520
|
+
const { cursor, page = 1 } = bc;
|
|
2521
|
+
const limit = (_c = ((_b = widgets == null ? void 0 : widgets.find((i) => i.bcName === bcName)) == null ? void 0 : _b.limit) || bc.limit) != null ? _c : 5;
|
|
2371
2522
|
const sorters = state.screen.sorters[bcName];
|
|
2372
2523
|
if (showViewPopup.match(action) && bcName === action.payload.calleeBCName) {
|
|
2373
|
-
return [
|
|
2524
|
+
return [EMPTY21];
|
|
2374
2525
|
}
|
|
2375
|
-
const anyHierarchyWidget = widgets.find((item) => {
|
|
2526
|
+
const anyHierarchyWidget = widgets == null ? void 0 : widgets.find((item) => {
|
|
2376
2527
|
return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && isHierarchyWidget(item);
|
|
2377
2528
|
});
|
|
2378
|
-
const fullHierarchyWidget = state.view.widgets.find((item) => {
|
|
2529
|
+
const fullHierarchyWidget = (_d = state.view.widgets) == null ? void 0 : _d.find((item) => {
|
|
2379
2530
|
var _a2;
|
|
2380
2531
|
return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && ((_a2 = item.options) == null ? void 0 : _a2.hierarchyFull);
|
|
2381
2532
|
});
|
|
2382
|
-
const limitBySelfCursor = (
|
|
2533
|
+
const limitBySelfCursor = (_e = state.router.bcPath) == null ? void 0 : _e.includes(`${bcName}/${cursor}`);
|
|
2383
2534
|
const bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
|
|
2384
2535
|
const fetchParams = __spreadValues(__spreadValues({
|
|
2385
2536
|
_page: page,
|
|
2386
2537
|
_limit: limit
|
|
2387
2538
|
}, getFilters(fullHierarchyWidget ? [] : state.screen.filters[bcName] || [])), getSorters(sorters));
|
|
2388
2539
|
if (bcForceUpdate.match(action)) {
|
|
2389
|
-
const infinityPaginationWidget = widgetName && infiniteWidgets.includes(widgetName) || ((
|
|
2540
|
+
const infinityPaginationWidget = widgetName && (infiniteWidgets == null ? void 0 : infiniteWidgets.includes(widgetName)) || ((_g = (_f = widgets == null ? void 0 : widgets.filter((item) => item.bcName === bcName)) == null ? void 0 : _f.find((item) => infiniteWidgets == null ? void 0 : infiniteWidgets.includes(item.name))) == null ? void 0 : _g.name);
|
|
2390
2541
|
if (infinityPaginationWidget) {
|
|
2391
2542
|
fetchParams._page = 1;
|
|
2392
2543
|
fetchParams._limit = limit * page;
|
|
@@ -2396,7 +2547,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2396
2547
|
fetchParams._page = action.payload.from || 1;
|
|
2397
2548
|
fetchParams._limit = (action.payload.to || page - fetchParams._page) * limit;
|
|
2398
2549
|
}
|
|
2399
|
-
if (bcFetchDataRequest.match(action) && action.payload.ignorePageLimit || ((
|
|
2550
|
+
if (bcFetchDataRequest.match(action) && action.payload.ignorePageLimit || ((_h = anyHierarchyWidget == null ? void 0 : anyHierarchyWidget.options) == null ? void 0 : _h.hierarchyFull)) {
|
|
2400
2551
|
fetchParams._limit = 0;
|
|
2401
2552
|
}
|
|
2402
2553
|
const canceler = api.createCanceler();
|
|
@@ -2408,12 +2559,12 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2408
2559
|
const normalFlow = api.fetchBcData(state.screen.screenName, bcUrl, fetchParams, canceler.cancelToken).pipe(mergeMap25((response) => {
|
|
2409
2560
|
var _a2, _b2;
|
|
2410
2561
|
const cursorChange = getCursorChange(response.data, cursor, !!anyHierarchyWidget);
|
|
2411
|
-
const parentOfNotLazyWidget = widgets.some((item) => {
|
|
2562
|
+
const parentOfNotLazyWidget = widgets == null ? void 0 : widgets.some((item) => {
|
|
2412
2563
|
var _a3;
|
|
2413
2564
|
return ((_a3 = state.screen.bo.bc[item.bcName]) == null ? void 0 : _a3.parentName) === bcName && !PopupWidgetTypes.includes(item.type);
|
|
2414
2565
|
});
|
|
2415
2566
|
const isWidgetVisible = (w) => {
|
|
2416
|
-
var _a3, _b3, _c2, _d2, _e2, _f2,
|
|
2567
|
+
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i;
|
|
2417
2568
|
if (((_a3 = w.showCondition) == null ? void 0 : _a3.bcName) === ((_b3 = state.screen.bo.bc[w.bcName]) == null ? void 0 : _b3.parentName)) {
|
|
2418
2569
|
let parentName = (_d2 = state.screen.bo.bc[(_c2 = w.showCondition) == null ? void 0 : _c2.bcName]) == null ? void 0 : _d2.parentName;
|
|
2419
2570
|
let parent = parentName === bcName;
|
|
@@ -2425,17 +2576,17 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2425
2576
|
return true;
|
|
2426
2577
|
}
|
|
2427
2578
|
}
|
|
2428
|
-
const dataToCheck = bcName === ((_f2 = w.showCondition) == null ? void 0 : _f2.bcName) ? response.data : state.data[(
|
|
2429
|
-
return checkShowCondition(w.showCondition, (_i = state.screen.bo.bc[(
|
|
2579
|
+
const dataToCheck = bcName === ((_f2 = w.showCondition) == null ? void 0 : _f2.bcName) ? response.data : state.data[(_g2 = w.showCondition) == null ? void 0 : _g2.bcName];
|
|
2580
|
+
return checkShowCondition(w.showCondition, (_i = state.screen.bo.bc[(_h2 = w.showCondition) == null ? void 0 : _h2.bcName]) == null ? void 0 : _i.cursor, dataToCheck, state.view.pendingDataChanges);
|
|
2430
2581
|
};
|
|
2431
2582
|
const lazyWidget = (!isWidgetVisible(widget) || PopupWidgetTypes.includes(widget.type)) && !parentOfNotLazyWidget;
|
|
2432
2583
|
const skipLazy = ((_a2 = state.view.popupData) == null ? void 0 : _a2.bcName) !== widget.bcName;
|
|
2433
2584
|
if (lazyWidget && skipLazy) {
|
|
2434
|
-
return
|
|
2585
|
+
return EMPTY21;
|
|
2435
2586
|
}
|
|
2436
|
-
const fetchChildren = ((_b2 = response.data) == null ? void 0 : _b2.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) :
|
|
2587
|
+
const fetchChildren = ((_b2 = response.data) == null ? void 0 : _b2.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) : EMPTY21;
|
|
2437
2588
|
const fetchRowMeta = of26(bcFetchRowMeta({ widgetName, bcName }));
|
|
2438
|
-
return
|
|
2589
|
+
return concat17(cursorChange, of26(bcFetchDataSuccess({
|
|
2439
2590
|
bcName,
|
|
2440
2591
|
data: response.data,
|
|
2441
2592
|
bcUrl,
|
|
@@ -2454,7 +2605,7 @@ function isHierarchyWidget(widget) {
|
|
|
2454
2605
|
return ((_a = widget.options) == null ? void 0 : _a.hierarchy) || ((_b = widget.options) == null ? void 0 : _b.hierarchyFull);
|
|
2455
2606
|
}
|
|
2456
2607
|
// src/epics/data/bcDeleteDataEpic.ts
|
|
2457
|
-
import { catchError as catchError11, concat as
|
|
2608
|
+
import { catchError as catchError11, concat as concat18, EMPTY as EMPTY22, filter as filter41, mergeMap as mergeMap26, of as of27 } from "rxjs";
|
|
2458
2609
|
import { OperationTypeCrud as OperationTypeCrud9 } from "@cxbox-ui/schema";
|
|
2459
2610
|
var bcDeleteDataEpic = (action$, store$, { api }) => action$.pipe(filter41(sendOperation.match), filter41((action) => matchOperationRole(OperationTypeCrud9.delete, action.payload, store$.value)), mergeMap26((action) => {
|
|
2460
2611
|
const widgetName = action.payload.widgetName;
|
|
@@ -2465,15 +2616,16 @@ var bcDeleteDataEpic = (action$, store$, { api }) => action$.pipe(filter41(sendO
|
|
|
2465
2616
|
const context = { widgetName: action.payload.widgetName };
|
|
2466
2617
|
const isTargetFormatPVF = state.view.pendingValidationFailsFormat === "target" /* target */;
|
|
2467
2618
|
return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe(mergeMap26((data) => {
|
|
2468
|
-
|
|
2469
|
-
|
|
2619
|
+
var _a;
|
|
2620
|
+
const postInvoke = (_a = data.postActions) == null ? void 0 : _a[0];
|
|
2621
|
+
return concat18(isTargetFormatPVF ? of27(bcCancelPendingChanges({ bcNames: [bcName] })) : EMPTY22, of27(bcFetchDataRequest({ bcName, widgetName })), postInvoke ? of27(processPostInvoke({ bcName, postInvoke, cursor, widgetName })) : EMPTY22);
|
|
2470
2622
|
}), catchError11((error) => {
|
|
2471
2623
|
console.error(error);
|
|
2472
2624
|
return of27(bcDeleteDataFail({ bcName }));
|
|
2473
2625
|
}));
|
|
2474
2626
|
}));
|
|
2475
2627
|
// src/epics/data/bcSelectRecordEpic.ts
|
|
2476
|
-
import { concat as
|
|
2628
|
+
import { concat as concat19, filter as filter42, mergeMap as mergeMap27, of as of28 } from "rxjs";
|
|
2477
2629
|
var bcSelectRecordEpic = (action$, store$) => action$.pipe(filter42(bcSelectRecord.match), mergeMap27((action) => {
|
|
2478
2630
|
const { bcName, cursor } = action.payload;
|
|
2479
2631
|
const widgets = store$.value.view.widgets;
|
|
@@ -2487,10 +2639,10 @@ var bcSelectRecordEpic = (action$, store$) => action$.pipe(filter42(bcSelectReco
|
|
|
2487
2639
|
keepDelta: action.payload.keepDelta
|
|
2488
2640
|
});
|
|
2489
2641
|
});
|
|
2490
|
-
return
|
|
2642
|
+
return concat19(of28(bcChangeCursors({ cursorsMap: { [bcName]: cursor }, keepDelta: action.payload.keepDelta })), of28(bcFetchRowMeta({ widgetName: "", bcName })), fetchChildrenBcData);
|
|
2491
2643
|
}));
|
|
2492
2644
|
// src/epics/data/changeAssociationEpic.ts
|
|
2493
|
-
import { concat as
|
|
2645
|
+
import { concat as concat20, filter as filter43, mergeMap as mergeMap28, of as of29 } from "rxjs";
|
|
2494
2646
|
var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAssociation.match), mergeMap28((action) => {
|
|
2495
2647
|
var _a, _b, _c, _d, _e;
|
|
2496
2648
|
const state = state$.value;
|
|
@@ -2512,19 +2664,19 @@ var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAss
|
|
|
2512
2664
|
fields: widget.fields
|
|
2513
2665
|
};
|
|
2514
2666
|
const hierarchy = (_b = widget.options) == null ? void 0 : _b.hierarchy;
|
|
2515
|
-
const hierarchyDescriptor = isRoot ? rootHierarchyDescriptor : hierarchy.find((item) => item.bcName === action.payload.bcName);
|
|
2667
|
+
const hierarchyDescriptor = isRoot ? rootHierarchyDescriptor : hierarchy == null ? void 0 : hierarchy.find((item) => item.bcName === action.payload.bcName);
|
|
2516
2668
|
const hierarchyGroupSelection = (_c = widget.options) == null ? void 0 : _c.hierarchyGroupSelection;
|
|
2517
2669
|
const hierarchyTraverse = (_d = widget.options) == null ? void 0 : _d.hierarchyTraverse;
|
|
2518
|
-
const childrenBc = hierarchy.slice(hierarchy.findIndex((item) => item.bcName === action.payload.bcName) + 1).map((item) => item.bcName);
|
|
2670
|
+
const childrenBc = hierarchy == null ? void 0 : hierarchy.slice(hierarchy.findIndex((item) => item.bcName === action.payload.bcName) + 1).map((item) => item.bcName);
|
|
2519
2671
|
if (hierarchyGroupSelection && hierarchyDescriptor.radio && !selected) {
|
|
2520
2672
|
result.push(of29(dropAllAssociations({
|
|
2521
2673
|
bcNames: childrenBc
|
|
2522
2674
|
})));
|
|
2523
2675
|
}
|
|
2524
|
-
const parent = isRoot ? null : hierarchy.find((item, index) => {
|
|
2676
|
+
const parent = isRoot ? null : (hierarchy == null ? void 0 : hierarchy.find((item, index) => {
|
|
2525
2677
|
var _a2;
|
|
2526
2678
|
return ((_a2 = hierarchy[index + 1]) == null ? void 0 : _a2.bcName) === action.payload.bcName;
|
|
2527
|
-
}) || rootHierarchyDescriptor;
|
|
2679
|
+
})) || rootHierarchyDescriptor;
|
|
2528
2680
|
const parentItem = (_e = state.data[parent == null ? void 0 : parent.bcName]) == null ? void 0 : _e.find((item) => item.id === state.screen.bo.bc[parent == null ? void 0 : parent.bcName].cursor);
|
|
2529
2681
|
if (parent && hierarchyTraverse && selected) {
|
|
2530
2682
|
if (hierarchyDescriptor.radio) {
|
|
@@ -2537,7 +2689,7 @@ var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAss
|
|
|
2537
2689
|
widgetName: action.payload.widgetName,
|
|
2538
2690
|
dataItem: __spreadProps(__spreadValues({}, parentItem), {
|
|
2539
2691
|
_associate: true,
|
|
2540
|
-
_value: parentItem[parent.assocValueKey || action.payload.assocValueKey]
|
|
2692
|
+
_value: parentItem == null ? void 0 : parentItem[parent.assocValueKey || action.payload.assocValueKey]
|
|
2541
2693
|
}),
|
|
2542
2694
|
assocValueKey: action.payload.assocValueKey
|
|
2543
2695
|
})));
|
|
@@ -2560,10 +2712,10 @@ var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAss
|
|
|
2560
2712
|
})));
|
|
2561
2713
|
}
|
|
2562
2714
|
}
|
|
2563
|
-
return
|
|
2715
|
+
return concat20(...result);
|
|
2564
2716
|
}));
|
|
2565
2717
|
// src/epics/data/bcCancelCreateDataEpic.ts
|
|
2566
|
-
import { catchError as catchError12, concat as
|
|
2718
|
+
import { catchError as catchError12, concat as concat21, EMPTY as EMPTY23, filter as filter44, mergeMap as mergeMap29, of as of30 } from "rxjs";
|
|
2567
2719
|
import { OperationTypeCrud as OperationTypeCrud10 } from "@cxbox-ui/schema";
|
|
2568
2720
|
import { isAnyOf as isAnyOf4 } from "@reduxjs/toolkit";
|
|
2569
2721
|
var actionTypesMatcher = isAnyOf4(sendOperation);
|
|
@@ -2582,18 +2734,19 @@ var bcCancelCreateDataEpic = (action$, state$, { api }) => action$.pipe(filter44
|
|
|
2582
2734
|
const params = { _action: action.payload.operationType };
|
|
2583
2735
|
const cursorsMap = { [action.payload.bcName]: null };
|
|
2584
2736
|
return api.customAction(screenName, bcUrl, data, context, params).pipe(mergeMap29((response) => {
|
|
2585
|
-
|
|
2586
|
-
|
|
2737
|
+
var _a2;
|
|
2738
|
+
const postInvoke = (_a2 = response.postActions) == null ? void 0 : _a2[0];
|
|
2739
|
+
return concat21(of30(sendOperationSuccess({ bcName, cursor })), of30(bcChangeCursors({ cursorsMap })), postInvoke ? of30(processPostInvoke({ bcName, postInvoke, cursor, widgetName: context.widgetName })) : EMPTY23);
|
|
2587
2740
|
}), catchError12((error) => {
|
|
2588
2741
|
console.error(error);
|
|
2589
2742
|
return of30(bcDeleteDataFail({ bcName }));
|
|
2590
2743
|
}));
|
|
2591
2744
|
}));
|
|
2592
2745
|
// src/epics/data/bcSelectDepthRecordEpic.ts
|
|
2593
|
-
import { concat as
|
|
2746
|
+
import { concat as concat22, filter as filter45, mergeMap as mergeMap30, of as of31 } from "rxjs";
|
|
2594
2747
|
var bcSelectDepthRecordEpic = (action$) => action$.pipe(filter45(bcSelectDepthRecord.match), mergeMap30((action) => {
|
|
2595
2748
|
const { bcName, cursor, depth } = action.payload;
|
|
2596
|
-
return
|
|
2749
|
+
return concat22(of31(bcChangeDepthCursor({ bcName, depth, cursor })), of31(bcFetchDataRequest({
|
|
2597
2750
|
bcName,
|
|
2598
2751
|
depth: depth + 1,
|
|
2599
2752
|
widgetName: "",
|
|
@@ -2601,7 +2754,7 @@ var bcSelectDepthRecordEpic = (action$) => action$.pipe(filter45(bcSelectDepthRe
|
|
|
2601
2754
|
})));
|
|
2602
2755
|
}));
|
|
2603
2756
|
// src/epics/data/removeMultivalueTagEpic.ts
|
|
2604
|
-
import { concat as
|
|
2757
|
+
import { concat as concat23, filter as filter46, mergeMap as mergeMap31, of as of32 } from "rxjs";
|
|
2605
2758
|
var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeMultivalueTag.match), mergeMap31((action) => {
|
|
2606
2759
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2607
2760
|
const state = state$.value;
|
|
@@ -2616,28 +2769,28 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2616
2769
|
const removedItem = data.find((item) => item.id === action.payload.removedItem.id);
|
|
2617
2770
|
const associated = action.payload.dataItem.map((item) => item.id);
|
|
2618
2771
|
let removedNodes = [];
|
|
2619
|
-
if ((_a = widget.options) == null ? void 0 : _a.hierarchyGroupDeselection) {
|
|
2620
|
-
if ((_b = widget.options) == null ? void 0 : _b.hierarchyTraverse) {
|
|
2772
|
+
if ((_a = widget == null ? void 0 : widget.options) == null ? void 0 : _a.hierarchyGroupDeselection) {
|
|
2773
|
+
if ((_b = widget == null ? void 0 : widget.options) == null ? void 0 : _b.hierarchyTraverse) {
|
|
2621
2774
|
data = assignTreeLinks(data);
|
|
2622
2775
|
}
|
|
2623
|
-
const removedItemChildren = data.filter((item) => item.parentId === removedItem.id);
|
|
2624
|
-
removedNodes = [removedItem.id, ...removedItemChildren.filter((item) => associated.includes(item.id)).map((item) => item.id)];
|
|
2625
|
-
if ((_c = widget.options) == null ? void 0 : _c.hierarchyTraverse) {
|
|
2776
|
+
const removedItemChildren = data.filter((item) => item.parentId === (removedItem == null ? void 0 : removedItem.id));
|
|
2777
|
+
removedNodes = [removedItem == null ? void 0 : removedItem.id, ...removedItemChildren.filter((item) => associated.includes(item.id)).map((item) => item.id)];
|
|
2778
|
+
if ((_c = widget == null ? void 0 : widget.options) == null ? void 0 : _c.hierarchyTraverse) {
|
|
2626
2779
|
getDescendants(removedItemChildren, removedNodes);
|
|
2627
2780
|
removedNodes = data.filter((item) => removedNodes.includes(item.id) && associated.includes(item.id)).map((item) => item.id);
|
|
2628
2781
|
}
|
|
2629
|
-
const parent = data.find((item) => item.id === removedItem.parentId);
|
|
2782
|
+
const parent = data.find((item) => item.id === (removedItem == null ? void 0 : removedItem.parentId));
|
|
2630
2783
|
const siblings = data.filter((item) => item.parentId === (parent == null ? void 0 : parent.id));
|
|
2631
2784
|
const parentEmpty = siblings.every((child) => removedNodes.includes(child.id) || !associated.includes(child.id));
|
|
2632
2785
|
if (parent && parentEmpty) {
|
|
2633
|
-
if ((_d = widget.options) == null ? void 0 : _d.hierarchyTraverse) {
|
|
2786
|
+
if ((_d = widget == null ? void 0 : widget.options) == null ? void 0 : _d.hierarchyTraverse) {
|
|
2634
2787
|
const parentDescendants = [];
|
|
2635
2788
|
getDescendants(siblings, parentDescendants);
|
|
2636
2789
|
const parentDeepEmpty = parentDescendants.every((descendant) => {
|
|
2637
2790
|
return removedNodes.includes(descendant) || !associated.includes(descendant);
|
|
2638
2791
|
});
|
|
2639
2792
|
if (parentDeepEmpty) {
|
|
2640
|
-
return
|
|
2793
|
+
return concat23(of32(removeMultivalueTag(__spreadProps(__spreadValues({}, action.payload), {
|
|
2641
2794
|
removedItem: { id: parent.id, value: null }
|
|
2642
2795
|
}))));
|
|
2643
2796
|
}
|
|
@@ -2647,7 +2800,7 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2647
2800
|
}
|
|
2648
2801
|
}
|
|
2649
2802
|
}
|
|
2650
|
-
if ((_e = widget.options) == null ? void 0 : _e.hierarchyFull) {
|
|
2803
|
+
if ((_e = widget == null ? void 0 : widget.options) == null ? void 0 : _e.hierarchyFull) {
|
|
2651
2804
|
return of32(changeDataItem({
|
|
2652
2805
|
bcName,
|
|
2653
2806
|
bcUrl: buildBcUrl(bcName, true, state),
|
|
@@ -2655,12 +2808,12 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2655
2808
|
dataItem: { [associateFieldKey]: action.payload.dataItem.filter((item) => !removedNodes.includes(item.id)) }
|
|
2656
2809
|
}));
|
|
2657
2810
|
}
|
|
2658
|
-
if ((_f = widget.options) == null ? void 0 : _f.hierarchy) {
|
|
2659
|
-
const hierarchyBcName = (_j = (_i = (_h = (_g = widget.options) == null ? void 0 : _g.hierarchy) == null ? void 0 : _h.find((hierarchyData) => {
|
|
2811
|
+
if ((_f = widget == null ? void 0 : widget.options) == null ? void 0 : _f.hierarchy) {
|
|
2812
|
+
const hierarchyBcName = (_j = (_i = (_h = (_g = widget == null ? void 0 : widget.options) == null ? void 0 : _g.hierarchy) == null ? void 0 : _h.find((hierarchyData) => {
|
|
2660
2813
|
var _a2;
|
|
2661
2814
|
return (_a2 = state.view.pendingDataChanges[hierarchyData.bcName]) == null ? void 0 : _a2[action.payload.removedItem.id];
|
|
2662
2815
|
})) == null ? void 0 : _i.bcName) != null ? _j : bcName;
|
|
2663
|
-
return
|
|
2816
|
+
return concat23(of32(changeDataItem({
|
|
2664
2817
|
/**
|
|
2665
2818
|
* This is incorrect and will break if different BC has records with
|
|
2666
2819
|
* identical ids.
|
|
@@ -2678,7 +2831,7 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2678
2831
|
dataItem: { [associateFieldKey]: action.payload.dataItem }
|
|
2679
2832
|
})));
|
|
2680
2833
|
}
|
|
2681
|
-
return
|
|
2834
|
+
return concat23(of32(changeDataItem({
|
|
2682
2835
|
bcName: popupBcName,
|
|
2683
2836
|
bcUrl: buildBcUrl(popupBcName, true, state),
|
|
2684
2837
|
cursor: action.payload.removedItem.id,
|
|
@@ -2693,11 +2846,12 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2693
2846
|
// src/epics/data/bcFetchRowMetaRequestEpic.ts
|
|
2694
2847
|
import { catchError as catchError13, filter as filter47, map as map9, mergeMap as mergeMap32, of as of33, race as race3 } from "rxjs";
|
|
2695
2848
|
var bcFetchRowMetaRequestEpic = (action$, state$, { api }) => action$.pipe(filter47(bcFetchRowMeta.match), mergeMap32((action) => {
|
|
2849
|
+
var _a, _b;
|
|
2696
2850
|
const state = state$.value;
|
|
2697
2851
|
const screenName = state.screen.screenName;
|
|
2698
2852
|
const bcName = action.payload.bcName;
|
|
2699
|
-
const cursor = state.screen.bo.bc[bcName].cursor;
|
|
2700
|
-
const bcUrl = buildBcUrl(bcName, true, state);
|
|
2853
|
+
const cursor = (_a = state.screen.bo.bc[bcName].cursor) != null ? _a : "";
|
|
2854
|
+
const bcUrl = (_b = buildBcUrl(bcName, true, state)) != null ? _b : "";
|
|
2701
2855
|
const canceler = api.createCanceler();
|
|
2702
2856
|
const cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchRowMetaFail({ bcName }));
|
|
2703
2857
|
const cancelByParentBc = cancelRequestEpic(action$, [bcSelectRecord], canceler.cancel, bcFetchRowMetaFail({ bcName }), (filteredAction) => {
|
|
@@ -2713,7 +2867,7 @@ var bcFetchRowMetaRequestEpic = (action$, state$, { api }) => action$.pipe(filte
|
|
|
2713
2867
|
return race3(cancelFlow, cancelByParentBc, normalFlow);
|
|
2714
2868
|
}));
|
|
2715
2869
|
// src/epics/data/changeAssociationFullEpic.ts
|
|
2716
|
-
import { concat as
|
|
2870
|
+
import { concat as concat24, filter as filter48, mergeMap as mergeMap33, of as of34 } from "rxjs";
|
|
2717
2871
|
var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(changeAssociationFull.match), mergeMap33((action) => {
|
|
2718
2872
|
var _a, _b, _c, _d, _e;
|
|
2719
2873
|
const state = state$.value;
|
|
@@ -2775,7 +2929,7 @@ var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(chang
|
|
|
2775
2929
|
widgetName: action.payload.widgetName,
|
|
2776
2930
|
dataItem: __spreadProps(__spreadValues({}, parentItem), {
|
|
2777
2931
|
_associate: true,
|
|
2778
|
-
_value: parentItem[assocValueKey]
|
|
2932
|
+
_value: parentItem == null ? void 0 : parentItem[assocValueKey]
|
|
2779
2933
|
}),
|
|
2780
2934
|
assocValueKey
|
|
2781
2935
|
})));
|
|
@@ -2797,16 +2951,18 @@ var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(chang
|
|
|
2797
2951
|
})));
|
|
2798
2952
|
}
|
|
2799
2953
|
}
|
|
2800
|
-
return
|
|
2954
|
+
return concat24(...result);
|
|
2801
2955
|
}));
|
|
2802
2956
|
// src/epics/data/saveAssociationsActiveEpic.ts
|
|
2803
|
-
import { catchError as catchError14, concat as
|
|
2957
|
+
import { catchError as catchError14, concat as concat25, EMPTY as EMPTY24, filter as filter49, mergeMap as mergeMap34, of as of35, switchMap as switchMap12 } from "rxjs";
|
|
2804
2958
|
var saveAssociationsActiveEpic = (action$, state$, { api }) => action$.pipe(filter49(saveAssociations.match), filter49((action) => {
|
|
2805
|
-
|
|
2959
|
+
var _a;
|
|
2960
|
+
return (_a = state$.value.view.popupData) == null ? void 0 : _a.active;
|
|
2806
2961
|
}), switchMap12((action) => {
|
|
2962
|
+
var _a, _b;
|
|
2807
2963
|
const state = state$.value;
|
|
2808
|
-
const calleeBCName = state.view.popupData.calleeBCName;
|
|
2809
|
-
const calleeWidgetName = state.view.popupData.calleeWidgetName;
|
|
2964
|
+
const calleeBCName = (_a = state.view.popupData) == null ? void 0 : _a.calleeBCName;
|
|
2965
|
+
const calleeWidgetName = (_b = state.view.popupData) == null ? void 0 : _b.calleeWidgetName;
|
|
2810
2966
|
const bcNames = action.payload.bcNames;
|
|
2811
2967
|
const bcUrl = buildBcUrl(calleeBCName, true, state);
|
|
2812
2968
|
const pendingChanges = state.view.pendingDataChanges[bcNames[0]] || {};
|
|
@@ -2814,16 +2970,16 @@ var saveAssociationsActiveEpic = (action$, state$, { api }) => action$.pipe(filt
|
|
|
2814
2970
|
return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter((i) => i._associate), params).pipe(mergeMap34((response) => {
|
|
2815
2971
|
const postInvoke = response.postActions[0];
|
|
2816
2972
|
const calleeWidget = state.view.widgets.find((widgetItem) => widgetItem.bcName === calleeBCName);
|
|
2817
|
-
return
|
|
2973
|
+
return concat25(postInvoke ? of35(processPostInvoke({ bcName: calleeBCName, postInvoke, widgetName: calleeWidget == null ? void 0 : calleeWidget.name })) : EMPTY24, of35(bcCancelPendingChanges({ bcNames })), of35(bcForceUpdate({ bcName: calleeBCName, widgetName: calleeWidgetName })));
|
|
2818
2974
|
}), catchError14((err) => {
|
|
2819
2975
|
console.error(err);
|
|
2820
|
-
return
|
|
2976
|
+
return EMPTY24;
|
|
2821
2977
|
}));
|
|
2822
2978
|
}));
|
|
2823
2979
|
// src/epics/data/changeAssociationSameBcEpic.ts
|
|
2824
|
-
import { concat as
|
|
2980
|
+
import { concat as concat26, filter as filter50, mergeMap as mergeMap35, of as of36 } from "rxjs";
|
|
2825
2981
|
var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(changeAssociationSameBc.match), mergeMap35((action) => {
|
|
2826
|
-
var _a, _b, _c, _d, _e;
|
|
2982
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2827
2983
|
const state = state$.value;
|
|
2828
2984
|
const bcName = action.payload.bcName;
|
|
2829
2985
|
const result = [
|
|
@@ -2840,8 +2996,8 @@ var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(cha
|
|
|
2840
2996
|
const widget = state.view.widgets.find((item) => item.name === action.payload.widgetName);
|
|
2841
2997
|
const hierarchyTraverse = (_a = widget.options) == null ? void 0 : _a.hierarchyTraverse;
|
|
2842
2998
|
const currentData = depth > 1 ? (_b = state.depthData[depth]) == null ? void 0 : _b[bcName] : state.data[bcName];
|
|
2843
|
-
const parentCursor = parentDepth ? parentDepth > 1 ? (_c = state.screen.bo.bc[bcName].depthBc[parentDepth]) == null ? void 0 :
|
|
2844
|
-
const parentItem = parentCursor ? parentDepth > 1 ? (
|
|
2999
|
+
const parentCursor = parentDepth ? parentDepth > 1 ? (_d = (_c = state.screen.bo.bc[bcName].depthBc) == null ? void 0 : _c[parentDepth]) == null ? void 0 : _d.cursor : state.screen.bo.bc[bcName].cursor : null;
|
|
3000
|
+
const parentItem = parentCursor ? parentDepth > 1 ? (_f = (_e = state.depthData[parentDepth]) == null ? void 0 : _e[bcName]) == null ? void 0 : _f.find((item) => item.id === parentCursor) : state.data[bcName].find((item) => item.id === parentCursor) : null;
|
|
2845
3001
|
if (parentDepth && hierarchyTraverse && selected) {
|
|
2846
3002
|
result.push(of36(changeAssociationSameBc({
|
|
2847
3003
|
bcName,
|
|
@@ -2849,7 +3005,7 @@ var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(cha
|
|
|
2849
3005
|
widgetName: action.payload.widgetName,
|
|
2850
3006
|
dataItem: __spreadProps(__spreadValues({}, parentItem), {
|
|
2851
3007
|
_associate: true,
|
|
2852
|
-
_value: parentItem[action.payload.assocValueKey]
|
|
3008
|
+
_value: parentItem == null ? void 0 : parentItem[action.payload.assocValueKey]
|
|
2853
3009
|
}),
|
|
2854
3010
|
assocValueKey: action.payload.assocValueKey
|
|
2855
3011
|
})));
|
|
@@ -2866,7 +3022,7 @@ var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(cha
|
|
|
2866
3022
|
})));
|
|
2867
3023
|
}
|
|
2868
3024
|
}
|
|
2869
|
-
return
|
|
3025
|
+
return concat26(...result);
|
|
2870
3026
|
}));
|
|
2871
3027
|
// src/epics/data/inlinePickListFetchDataEpic.ts
|
|
2872
3028
|
import { catchError as catchError15, filter as filter51, mergeMap as mergeMap36, of as of37, race as race4 } from "rxjs";
|
|
@@ -2887,13 +3043,14 @@ var inlinePickListFetchDataEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
2887
3043
|
// src/epics/data/saveAssociationsPassiveEpic.ts
|
|
2888
3044
|
import { filter as filter52, of as of38, switchMap as switchMap13 } from "rxjs";
|
|
2889
3045
|
var saveAssociationsPassiveEpic = (action$, state$) => action$.pipe(filter52(saveAssociations.match), filter52(() => {
|
|
2890
|
-
return !state$.value.view.popupData.active;
|
|
2891
|
-
}), switchMap13((action) => {
|
|
2892
3046
|
var _a;
|
|
3047
|
+
return !((_a = state$.value.view.popupData) == null ? void 0 : _a.active);
|
|
3048
|
+
}), switchMap13((action) => {
|
|
3049
|
+
var _a, _b;
|
|
2893
3050
|
const state = state$.value;
|
|
2894
|
-
const { calleeBCName = action.payload.calleeBcName, associateFieldKey = action.payload.associateFieldKey } = state.view.popupData;
|
|
3051
|
+
const { calleeBCName = action.payload.calleeBcName, associateFieldKey = action.payload.associateFieldKey } = (_a = state.view.popupData) != null ? _a : {};
|
|
2895
3052
|
const cursor = state.screen.bo.bc[calleeBCName].cursor;
|
|
2896
|
-
const recordPrevData = (
|
|
3053
|
+
const recordPrevData = (_b = state.data[calleeBCName].find((dataStateRecord) => dataStateRecord.id === cursor)[associateFieldKey]) != null ? _b : [];
|
|
2897
3054
|
const newValues = [];
|
|
2898
3055
|
action.payload.bcNames.forEach((pendingBc) => {
|
|
2899
3056
|
const pendingChanges = state.view.pendingDataChanges[pendingBc] || {};
|
|
@@ -2955,7 +3112,7 @@ var changeChildrenAssociationsSameBcEpic = (action$, state$) => action$.pipe(fil
|
|
|
2955
3112
|
}));
|
|
2956
3113
|
}));
|
|
2957
3114
|
// src/epics/data/changeDescendantsAssociationsFullEpic.ts
|
|
2958
|
-
import { concat as
|
|
3115
|
+
import { concat as concat27, filter as filter55, mergeMap as mergeMap39, of as of41 } from "rxjs";
|
|
2959
3116
|
var changeDescendantsAssociationsFullEpic = (action$, state$) => action$.pipe(filter55(changeDescendantsAssociationsFull.match), mergeMap39((action) => {
|
|
2960
3117
|
const state = state$.value;
|
|
2961
3118
|
const depth = action.payload.depth;
|
|
@@ -2979,7 +3136,7 @@ var changeDescendantsAssociationsFullEpic = (action$, state$) => action$.pipe(fi
|
|
|
2979
3136
|
}))));
|
|
2980
3137
|
}
|
|
2981
3138
|
});
|
|
2982
|
-
return
|
|
3139
|
+
return concat27(...result);
|
|
2983
3140
|
}));
|
|
2984
3141
|
// src/api/ObservableApiWrapper.ts
|
|
2985
3142
|
import axios2 from "axios";
|
|
@@ -3007,7 +3164,7 @@ var ObservableApiWrapper = class {
|
|
|
3007
3164
|
}));
|
|
3008
3165
|
this.instance = instance;
|
|
3009
3166
|
}
|
|
3010
|
-
get(path, config
|
|
3167
|
+
get(path, config, callContext) {
|
|
3011
3168
|
return from(this.instance.get(path, config)).pipe(takeWhile(redirectOccurred), map10((response) => response.data));
|
|
3012
3169
|
}
|
|
3013
3170
|
put(path, data, callContext) {
|
|
@@ -3022,10 +3179,10 @@ var ObservableApiWrapper = class {
|
|
|
3022
3179
|
};
|
|
3023
3180
|
// src/api/ObservableApi.ts
|
|
3024
3181
|
import axios3 from "axios";
|
|
3025
|
-
import { EMPTY as
|
|
3182
|
+
import { EMPTY as EMPTY25, expand, map as map11, reduce } from "rxjs";
|
|
3026
3183
|
var Api = class {
|
|
3027
3184
|
constructor(instance) {
|
|
3028
|
-
__publicField(this, "api$"
|
|
3185
|
+
__publicField(this, "api$");
|
|
3029
3186
|
this.api$ = new ObservableApiWrapper(instance);
|
|
3030
3187
|
}
|
|
3031
3188
|
routerRequest(path, params) {
|
|
@@ -3043,7 +3200,7 @@ var Api = class {
|
|
|
3043
3200
|
fetchBcDataAll(screenName, bcUrl, params = {}) {
|
|
3044
3201
|
let currentPage = 1;
|
|
3045
3202
|
return this.fetchBcData(screenName, bcUrl, __spreadProps(__spreadValues({}, params), { _page: currentPage })).pipe(expand((response) => {
|
|
3046
|
-
return response.hasNext ? this.fetchBcData(screenName, bcUrl, __spreadProps(__spreadValues({}, params), { _page: ++currentPage })) :
|
|
3203
|
+
return response.hasNext ? this.fetchBcData(screenName, bcUrl, __spreadProps(__spreadValues({}, params), { _page: ++currentPage })) : EMPTY25;
|
|
3047
3204
|
}), reduce((items, nextResponse) => {
|
|
3048
3205
|
return [...items, ...nextResponse.data];
|
|
3049
3206
|
}, []));
|
|
@@ -3054,19 +3211,19 @@ var Api = class {
|
|
|
3054
3211
|
}
|
|
3055
3212
|
newBcData(screenName, bcUrl, context, params) {
|
|
3056
3213
|
const url = applyParams(buildUrl `row-meta-new/${screenName}/` + bcUrl, params);
|
|
3057
|
-
return this.api$.get(url,
|
|
3214
|
+
return this.api$.get(url, void 0, context).pipe(map11((response) => response.data));
|
|
3058
3215
|
}
|
|
3059
3216
|
saveBcData(screenName, bcUrl, data, context, params) {
|
|
3060
3217
|
const url = applyParams(buildUrl `data/${screenName}/` + bcUrl, params);
|
|
3061
3218
|
return this.api$.put(url, { data }, context).pipe(map11((response) => response.data));
|
|
3062
3219
|
}
|
|
3063
|
-
deleteBcData(screenName, bcUrl, context, params) {
|
|
3220
|
+
deleteBcData(screenName, bcUrl = "", context, params) {
|
|
3064
3221
|
const url = applyParams(buildUrl `data/${screenName}/` + bcUrl, params);
|
|
3065
3222
|
return this.api$.delete(url, context).pipe(map11((response) => response.data));
|
|
3066
3223
|
}
|
|
3067
3224
|
customAction(screenName, bcUrl, data, context, params) {
|
|
3068
3225
|
const url = applyParams(buildUrl `custom-action/${screenName}/` + bcUrl, params);
|
|
3069
|
-
return this.api$.post(url, { data: data || {} },
|
|
3226
|
+
return this.api$.post(url, { data: data || {} }, void 0, context).pipe(map11((response) => response.data));
|
|
3070
3227
|
}
|
|
3071
3228
|
associate(screenName, bcUrl, data, params) {
|
|
3072
3229
|
const processedData = Array.isArray(data) ? data.map((item) => ({
|
|
@@ -3078,9 +3235,23 @@ var Api = class {
|
|
|
3078
3235
|
return this.api$.post(url, processedData).pipe(map11((response) => response.data));
|
|
3079
3236
|
}
|
|
3080
3237
|
getRmByForceActive(screenName, bcUrl, data, params) {
|
|
3081
|
-
const url = applyParams(buildUrl `row-meta/${screenName}/` + bcUrl, params);
|
|
3238
|
+
const url = applyParams(buildUrl `row-meta/${screenName}/` + (bcUrl != null ? bcUrl : ""), params);
|
|
3082
3239
|
return this.api$.post(url, { data }).pipe(map11((response) => response.data.row));
|
|
3083
3240
|
}
|
|
3241
|
+
/**
|
|
3242
|
+
* Get Cxbox API file upload endpoint based on baseURL of axios instance
|
|
3243
|
+
*
|
|
3244
|
+
* Handles empty baseURL and trailing slash
|
|
3245
|
+
*
|
|
3246
|
+
* @returns File upload endpoint
|
|
3247
|
+
*/
|
|
3248
|
+
get fileUploadEndpoint() {
|
|
3249
|
+
const instance = this.api$.instance;
|
|
3250
|
+
if (!instance.defaults.baseURL) {
|
|
3251
|
+
return "/file";
|
|
3252
|
+
}
|
|
3253
|
+
return instance.defaults.baseURL.endsWith("/") ? `${instance.defaults.baseURL}file` : `${instance.defaults.baseURL}/file`;
|
|
3254
|
+
}
|
|
3084
3255
|
refreshMeta() {
|
|
3085
3256
|
return this.api$.get(buildUrl `bc-registry/refresh-meta`);
|
|
3086
3257
|
}
|