@cxbox-ui/core 1.37.2-alpha.6 → 1.37.2-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -472,6 +472,15 @@ function isViewNavigationCategory(item) {
472
472
  function isViewNavigationGroup(item) {
473
473
  return !!item && "child" in item && !("categoryName" in item);
474
474
  }
475
+ // src/reducers/router.ts
476
+ var initialRouterState = { type: "default" /* default */, path: "/", params: null, screenName: null };
477
+ var createRouterReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(loginDone, function (state, action) {
478
+ state = __assign(__assign({}, state), action.payload);
479
+ }).addCase(changeLocation, function (state, action) {
480
+ state = __assign(__assign({}, state), action.payload.location);
481
+ }); };
482
+ // src/reducers/screen.ts
483
+ import { OperationTypeCrud as OperationTypeCrud3 } from "@cxbox-ui/schema";
475
484
  // src/utils/index.ts
476
485
  var utils_exports = {};
477
486
  __export(utils_exports, {
@@ -492,7 +501,6 @@ __export(utils_exports, {
492
501
  getBcChildren: function () { return getBcChildren; },
493
502
  getDescendants: function () { return getDescendants; },
494
503
  getFieldTitle: function () { return getFieldTitle; },
495
- getFileUploadEndpoint: function () { return getFileUploadEndpoint; },
496
504
  getFilterType: function () { return getFilterType; },
497
505
  getFilters: function () { return getFilters; },
498
506
  getSorters: function () { return getSorters; },
@@ -532,12 +540,6 @@ function applyRawParams(url, qso) {
532
540
  var result = new URLSearchParams(qso).toString();
533
541
  return "".concat(addTailControlSequences(url)).concat(result && "".concat(result));
534
542
  }
535
- function getFileUploadEndpoint(instance) {
536
- if (!instance.defaults.baseURL) {
537
- return "/file";
538
- }
539
- return instance.defaults.baseURL.endsWith("/") ? "".concat(instance.defaults.baseURL, "file") : "".concat(instance.defaults.baseURL, "/file");
540
- }
541
543
  // src/utils/strings.ts
542
544
  function getTemplate(literals) {
543
545
  var placeholders = [];
@@ -552,10 +554,9 @@ function getTemplate(literals) {
552
554
  result += literals[literals.length - 1];
553
555
  return result;
554
556
  }
555
- function buildBcUrl(bcName, includeSelf, store) {
557
+ function buildBcUrl(bcName, includeSelf, state) {
556
558
  if (includeSelf === void 0) { includeSelf = false; }
557
- var storeInstance = store;
558
- var bcMap = storeInstance.screen.bo.bc;
559
+ var bcMap = state.screen.bo.bc;
559
560
  var bc = bcMap[bcName];
560
561
  if (!bc) {
561
562
  return null;
@@ -688,7 +689,7 @@ function defaultParseURL(url) {
688
689
  }
689
690
  return {
690
691
  type: type,
691
- path: path,
692
+ path: path.length !== 0 && !path.startsWith("/") ? "/".concat(path) : path,
692
693
  params: params,
693
694
  screenName: screenName,
694
695
  viewName: viewName,
@@ -736,8 +737,9 @@ function getSorters(sorters) {
736
737
  return result;
737
738
  }
738
739
  function parseFilters(defaultFilters) {
740
+ if (defaultFilters === void 0) { defaultFilters = ""; }
739
741
  var result = [];
740
- var urlParams = new URL(defaultFilters).searchParams;
742
+ var urlParams = new URL(defaultFilters, window.location.origin).searchParams;
741
743
  urlParams.forEach(function (param) {
742
744
  var _a = param.split("."), fieldName = _a[0], type = _a[1];
743
745
  if (fieldName && type && urlParams.get(param)) {
@@ -767,7 +769,7 @@ function parseSorters(sorters) {
767
769
  return null;
768
770
  }
769
771
  var result = [];
770
- var dictionary = new URL(sorters).searchParams;
772
+ var dictionary = new URL(sorters, window.location.origin).searchParams;
771
773
  Object.entries(dictionary).map(function (_a) {
772
774
  var sort = _a[0], fieldKey = _a[1];
773
775
  var _b = sort.split(".").slice(1), order = _b[0], direction = _b[1];
@@ -846,12 +848,13 @@ function getBcChildren(originBcName, widgets, bcMap) {
846
848
  return childrenBcMap;
847
849
  }
848
850
  function getHierarchyChildBc(originBcName, hierarchyWidget) {
849
- var nestedBcNames = hierarchyWidget.options.hierarchy.map(function (nestedItem) { return nestedItem.bcName; });
850
- if (originBcName !== hierarchyWidget.bcName && !nestedBcNames.includes(originBcName)) {
851
+ var _a, _b;
852
+ var nestedBcNames = (_b = (_a = hierarchyWidget === null || hierarchyWidget === void 0 ? void 0 : hierarchyWidget.options) === null || _a === void 0 ? void 0 : _a.hierarchy) === null || _b === void 0 ? void 0 : _b.map(function (nestedItem) { return nestedItem.bcName; });
853
+ if (originBcName !== hierarchyWidget.bcName && !(nestedBcNames === null || nestedBcNames === void 0 ? void 0 : nestedBcNames.includes(originBcName))) {
851
854
  return [];
852
855
  }
853
- var childHierarchyBcIndex = nestedBcNames.findIndex(function (item) { return item === originBcName; });
854
- var childHierarchyBcName = nestedBcNames[childHierarchyBcIndex + 1];
856
+ var childHierarchyBcIndex = nestedBcNames === null || nestedBcNames === void 0 ? void 0 : nestedBcNames.findIndex(function (item) { return item === originBcName; });
857
+ var childHierarchyBcName = nestedBcNames === null || nestedBcNames === void 0 ? void 0 : nestedBcNames[childHierarchyBcIndex + 1];
855
858
  return [childHierarchyBcName, hierarchyWidget.name];
856
859
  }
857
860
  function checkShowCondition(condition, cursor, data, pendingDataChanges) {
@@ -865,9 +868,9 @@ function checkShowCondition(condition, cursor, data, pendingDataChanges) {
865
868
  if (!record) {
866
869
  return false;
867
870
  }
868
- var actualValue = record === null || record === void 0 ? void 0 : record[params.fieldKey];
869
- var pendingValue = (_b = (_a = pendingDataChanges === null || pendingDataChanges === void 0 ? void 0 : pendingDataChanges[bcName]) === null || _a === void 0 ? void 0 : _a[cursor]) === null || _b === void 0 ? void 0 : _b[params.fieldKey];
870
- return pendingValue !== void 0 ? pendingValue === params.value : actualValue === params.value;
871
+ var actualValue = record === null || record === void 0 ? void 0 : record[params === null || params === void 0 ? void 0 : params.fieldKey];
872
+ var pendingValue = (_b = (_a = pendingDataChanges === null || pendingDataChanges === void 0 ? void 0 : pendingDataChanges[bcName]) === null || _a === void 0 ? void 0 : _a[cursor]) === null || _b === void 0 ? void 0 : _b[params === null || params === void 0 ? void 0 : params.fieldKey];
873
+ return pendingValue !== void 0 ? pendingValue === (params === null || params === void 0 ? void 0 : params.value) : actualValue === (params === null || params === void 0 ? void 0 : params.value);
871
874
  }
872
875
  // src/utils/tree.ts
873
876
  function assignTreeLinks(flat) {
@@ -875,6 +878,7 @@ function assignTreeLinks(flat) {
875
878
  var map12 = {};
876
879
  var orphans = [];
877
880
  result.forEach(function (item) {
881
+ var _a, _b;
878
882
  if (!item.parentId || item.parentId === "0") {
879
883
  return;
880
884
  }
@@ -893,7 +897,7 @@ function assignTreeLinks(flat) {
893
897
  result[parentIndex].children = [item];
894
898
  }
895
899
  else {
896
- result[parentIndex].children.push(item);
900
+ (_b = (_a = result[parentIndex]) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.push(item);
897
901
  }
898
902
  });
899
903
  if (orphans.length) {
@@ -971,22 +975,7 @@ function deleteUndefinedFromObject(obj) {
971
975
  }
972
976
  });
973
977
  }
974
- // src/reducers/router.ts
975
- var initialRouterState = { type: "default" /* default */, path: "/", params: null, screenName: null };
976
- var createRouterReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(loginDone, function (state, action) {
977
- state = __assign(__assign({}, state), action.payload);
978
- }).addCase(changeLocation, function (state, action) {
979
- var _a = action.payload, url = _a.url, route = _a.route;
980
- if (url) {
981
- var path = new URL(url);
982
- state = __assign(__assign({}, state), defaultParseURL(path));
983
- }
984
- if (route !== null) {
985
- state = __assign(__assign({}, state), route);
986
- }
987
- }); };
988
978
  // src/reducers/screen.ts
989
- import { OperationTypeCrud as OperationTypeCrud3 } from "@cxbox-ui/schema";
990
979
  var initialScreenState = {
991
980
  screenName: "",
992
981
  bo: { activeBcName: "", bc: {} },
@@ -998,10 +987,11 @@ var initialScreenState = {
998
987
  };
999
988
  var operationsHandledLocally = [OperationTypeCrud3.associate, OperationTypeCrud3.fileUpload];
1000
989
  var createScreenReducerBuilderManager = function (initialState) { return new ReducerBuilderManager().addCase(selectScreen, function (state, action) {
990
+ var _a, _b, _c, _d, _e;
1001
991
  var bcDictionary = {};
1002
992
  var bcSorters = {};
1003
993
  var bcFilters = {};
1004
- action.payload.screen.meta.bo.bc.forEach(function (item) {
994
+ (_a = action.payload.screen.meta) === null || _a === void 0 ? void 0 : _a.bo.bc.forEach(function (item) {
1005
995
  bcDictionary[item.name] = item;
1006
996
  var sorter = parseSorters(item.defaultSort);
1007
997
  var filter56 = parseFilters(item.defaultFilter);
@@ -1013,8 +1003,8 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
1013
1003
  }
1014
1004
  });
1015
1005
  state.screenName = action.payload.screen.name;
1016
- state.primaryView = action.payload.screen.meta.primary;
1017
- state.views = action.payload.screen.meta.views;
1006
+ state.primaryView = (_c = (_b = action.payload.screen.meta) === null || _b === void 0 ? void 0 : _b.primary) !== null && _c !== void 0 ? _c : state.primaryView;
1007
+ state.views = (_e = (_d = action.payload.screen.meta) === null || _d === void 0 ? void 0 : _d.views) !== null && _e !== void 0 ? _e : state.views;
1018
1008
  state.bo = { activeBcName: null, bc: bcDictionary };
1019
1009
  state.sorters = __assign(__assign({}, state.sorters), bcSorters);
1020
1010
  state.filters = __assign(__assign({}, state.filters), bcFilters);
@@ -1024,12 +1014,14 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
1024
1014
  }).addCase(bcFetchDataRequest, function (state, action) {
1025
1015
  state.bo.bc[action.payload.bcName].loading = true;
1026
1016
  }).addCase(bcLoadMore, function (state, action) {
1017
+ var _a;
1027
1018
  var currentBc = state.bo.bc[action.payload.bcName];
1028
- currentBc.page += 1;
1019
+ currentBc.page = ((_a = currentBc.page) !== null && _a !== void 0 ? _a : 1) + 1;
1029
1020
  currentBc.loading = true;
1030
1021
  }).addCase(selectView, function (state, action) {
1022
+ var _a;
1031
1023
  var newBcs = {};
1032
- Array.from(new Set(action.payload.widgets.map(function (widget) { return widget.bcName; }))
1024
+ Array.from(new Set((_a = action.payload.widgets) === null || _a === void 0 ? void 0 : _a.map(function (widget) { return widget.bcName; }))
1033
1025
  // БК которые есть на вьюхе
1034
1026
  ).filter(function (bcName) { return state.bo.bc[bcName]; }).forEach(function (bcName) {
1035
1027
  newBcs[bcName] = __assign(__assign({}, state.bo.bc[bcName]), { page: 1 });
@@ -1041,9 +1033,10 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
1041
1033
  currentBc.loading = false;
1042
1034
  state.cachedBc[action.payload.bcName] = action.payload.bcUrl;
1043
1035
  }).addCase(bcFetchDataFail, function (state, action) {
1044
- if (Object.values(state.bo.bc).some(function (bc) { return bc.name === action.payload.bcName; })) {
1045
- state.bo.bc[action.payload.bcName].loading = false;
1046
- state.cachedBc[action.payload.bcName] = action.payload.bcUrl;
1036
+ var bcName = action.payload.bcName;
1037
+ if (Object.values(state.bo.bc).some(function (bc) { return bc.name === bcName; })) {
1038
+ state.bo.bc[bcName].loading = false;
1039
+ state.cachedBc[bcName] = action.payload.bcUrl;
1047
1040
  }
1048
1041
  }).addCase(sendOperation, function (state, action) {
1049
1042
  if (!operationsHandledLocally.includes(action.payload.operationType)) {
@@ -1071,10 +1064,12 @@ var createScreenReducerBuilderManager = function (initialState) { return new Red
1071
1064
  Object.assign(state.bo.bc, newCursors);
1072
1065
  Object.assign(state.cachedBc, newCache);
1073
1066
  }).addCase(bcChangeDepthCursor, function (state, action) {
1067
+ var _a;
1074
1068
  if (action.payload.depth === 1) {
1075
1069
  state.bo.bc[action.payload.bcName].cursor = action.payload.cursor;
1076
1070
  }
1077
1071
  else {
1072
+ state.bo.bc[action.payload.bcName].depthBc = (_a = state.bo.bc[action.payload.bcName].depthBc) !== null && _a !== void 0 ? _a : {};
1078
1073
  state.bo.bc[action.payload.bcName].depthBc[action.payload.depth].cursor = action.payload.cursor;
1079
1074
  }
1080
1075
  }).addCase(bcSelectRecord, function (state, action) {
@@ -1159,9 +1154,11 @@ var createSessionReducerBuilderManager = function (initialState) { return new Re
1159
1154
  }).addCase(switchDebugMode, function (state, action) {
1160
1155
  state.debugMode = action.payload;
1161
1156
  }).addCase(addPendingRequest, function (state, action) {
1162
- state.pendingRequests.push(action.payload.request);
1157
+ var _a;
1158
+ (_a = state.pendingRequests) === null || _a === void 0 ? void 0 : _a.push(action.payload.request);
1163
1159
  }).addCase(removePendingRequest, function (state, action) {
1164
- state.pendingRequests = state.pendingRequests.filter(function (item) { return item.requestId !== action.payload.requestId; });
1160
+ var _a;
1161
+ state.pendingRequests = (_a = state.pendingRequests) === null || _a === void 0 ? void 0 : _a.filter(function (item) { return item.requestId !== action.payload.requestId; });
1165
1162
  }).addCase(addNotification, function (state, action) {
1166
1163
  state.notifications.push(action.payload);
1167
1164
  }).addCase(removeNotifications, function (state, action) {
@@ -1208,12 +1205,15 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1208
1205
  state.metaInProgress[action.payload.bcName] = true;
1209
1206
  }
1210
1207
  }).addCase(bcFetchRowMetaSuccess, function (state, action) {
1208
+ var _a;
1209
+ state.rowMeta[action.payload.bcName] = (_a = state.rowMeta[action.payload.bcName]) !== null && _a !== void 0 ? _a : {};
1211
1210
  state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
1212
1211
  state.metaInProgress[action.payload.bcName] = false;
1213
1212
  }).addCase(bcNewDataSuccess, function (state, action) {
1214
1213
  state.selectedCell = initialViewState.selectedCell;
1215
1214
  }).addCase(forceActiveRmUpdate, function (state, action) {
1216
- var _a = action.payload, bcName = _a.bcName, bcUrl = _a.bcUrl, currentRecordData = _a.currentRecordData, rowMeta = _a.rowMeta, cursor = _a.cursor;
1215
+ var _a, _b, _c, _d;
1216
+ var _e = action.payload, bcName = _e.bcName, bcUrl = _e.bcUrl, currentRecordData = _e.currentRecordData, rowMeta = _e.rowMeta, cursor = _e.cursor;
1217
1217
  var handledForceActive = {};
1218
1218
  var rowMetaForcedValues = {};
1219
1219
  var newPendingChangesDiff = {};
@@ -1236,17 +1236,21 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1236
1236
  handledForceActive[key] = newPendingDataChanges[key];
1237
1237
  }
1238
1238
  });
1239
+ state.handledForceActive[bcName] = (_a = state.handledForceActive[bcName]) !== null && _a !== void 0 ? _a : {};
1240
+ state.handledForceActive[bcName][cursor] = (_b = state.handledForceActive[bcName][cursor]) !== null && _b !== void 0 ? _b : {};
1239
1241
  Object.assign(state.handledForceActive[bcName][cursor], handledForceActive);
1242
+ state.pendingDataChanges[bcName] = (_c = state.pendingDataChanges[bcName]) !== null && _c !== void 0 ? _c : {};
1240
1243
  state.pendingDataChanges[bcName][cursor] = newPendingDataChanges;
1244
+ state.rowMeta[bcName] = (_d = state.rowMeta[bcName]) !== null && _d !== void 0 ? _d : {};
1241
1245
  state.rowMeta[bcName][bcUrl] = rowMeta;
1242
1246
  }).addCase(changeDataItem, function (state, action) {
1243
- var _a;
1247
+ var _a, _b, _c;
1244
1248
  var actionBcName = action.payload.bcName;
1245
1249
  var prevBc = state.pendingDataChanges[action.payload.bcName] || {};
1246
1250
  var prevCursor = prevBc[action.payload.cursor] || {};
1247
1251
  var prevPending = prevCursor || {};
1248
1252
  var nextPending = __assign(__assign({}, prevPending), action.payload.dataItem);
1249
- var bcUrl = buildBcUrl(actionBcName, true);
1253
+ var bcUrl = action.payload.bcUrl;
1250
1254
  var rowMeta = (_a = state.rowMeta[actionBcName]) === null || _a === void 0 ? void 0 : _a[bcUrl];
1251
1255
  var nextValidationFails = {};
1252
1256
  var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
@@ -1257,10 +1261,11 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1257
1261
  nextValidationFails[fieldKey] = "This field is mandatory";
1258
1262
  }
1259
1263
  });
1264
+ state.pendingDataChanges[action.payload.bcName] = (_b = state.pendingDataChanges[action.payload.bcName]) !== null && _b !== void 0 ? _b : {};
1260
1265
  state.pendingDataChanges[action.payload.bcName][action.payload.cursor] = nextPending;
1261
1266
  if (isTargetFormatPVF) {
1262
1267
  ;
1263
- state.pendingValidationFails[actionBcName][action.payload.cursor] = nextValidationFails;
1268
+ ((_c = state.pendingValidationFails) === null || _c === void 0 ? void 0 : _c[actionBcName])[action.payload.cursor] = nextValidationFails;
1264
1269
  }
1265
1270
  else {
1266
1271
  state.pendingValidationFails = nextValidationFails;
@@ -1281,7 +1286,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1281
1286
  pendingDataChanges[bcName] = pendingBcChanges;
1282
1287
  });
1283
1288
  var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
1284
- var pendingValidationFails = __assign({}, state.pendingValidationFails);
1289
+ var pendingValidationFails = state.pendingValidationFails ? __assign({}, state.pendingValidationFails) : {};
1285
1290
  if (isTargetFormatPVF) {
1286
1291
  action.payload.bcNames.forEach(function (i) {
1287
1292
  pendingValidationFails[i] = {};
@@ -1296,7 +1301,8 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1296
1301
  }).addCase(bcFetchRowMetaFail, function (state, action) {
1297
1302
  state.metaInProgress[action.payload.bcName] = false;
1298
1303
  }).addCase(forceActiveChangeFail, function (state, action) {
1299
- var _a = action.payload, bcName = _a.bcName, bcUrl = _a.bcUrl, entityError = _a.entityError;
1304
+ var _a;
1305
+ var _b = action.payload, bcName = _b.bcName, bcUrl = _b.bcUrl, entityError = _b.entityError;
1300
1306
  var errors = {};
1301
1307
  if (entityError) {
1302
1308
  Object.entries(entityError.fields).forEach(function (_a) {
@@ -1304,9 +1310,11 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1304
1310
  errors[fieldName] = violation;
1305
1311
  });
1306
1312
  }
1313
+ state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) !== null && _a !== void 0 ? _a : {};
1307
1314
  state.rowMeta[bcName][bcUrl].errors = errors;
1308
1315
  }).addCase(bcSaveDataFail, function (state, action) {
1309
- var _a = action.payload, bcName = _a.bcName, bcUrl = _a.bcUrl, entityError = _a.entityError;
1316
+ var _a;
1317
+ var _b = action.payload, bcName = _b.bcName, bcUrl = _b.bcUrl, entityError = _b.entityError;
1310
1318
  var errors = {};
1311
1319
  if (entityError) {
1312
1320
  Object.entries(entityError.fields).forEach(function (_a) {
@@ -1314,9 +1322,11 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1314
1322
  errors[fieldName] = violation;
1315
1323
  });
1316
1324
  }
1325
+ state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) !== null && _a !== void 0 ? _a : {};
1317
1326
  state.rowMeta[bcName][bcUrl].errors = errors;
1318
1327
  }).addCase(sendOperationFail, function (state, action) {
1319
- var _a = action.payload, bcName = _a.bcName, bcUrl = _a.bcUrl, entityError = _a.entityError;
1328
+ var _a;
1329
+ var _b = action.payload, bcName = _b.bcName, bcUrl = _b.bcUrl, entityError = _b.entityError;
1320
1330
  var errors = {};
1321
1331
  if (entityError) {
1322
1332
  Object.entries(entityError.fields).forEach(function (_a) {
@@ -1324,30 +1334,38 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1324
1334
  errors[fieldName] = violation;
1325
1335
  });
1326
1336
  }
1337
+ state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) !== null && _a !== void 0 ? _a : {};
1327
1338
  state.rowMeta[bcName][bcUrl].errors = errors;
1328
1339
  }).addCase(sendOperationSuccess, function (state, action) {
1329
- var _a = action.payload, bcName = _a.bcName, cursor = _a.cursor;
1340
+ var _a, _b, _c;
1341
+ var bcName = action.payload.bcName;
1342
+ var cursor = action.payload.cursor;
1330
1343
  var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
1344
+ state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) !== null && _a !== void 0 ? _a : {};
1331
1345
  state.pendingDataChanges[bcName][cursor] = {};
1332
1346
  if (isTargetFormatPVF) {
1333
1347
  ;
1334
- state.pendingValidationFails[bcName][cursor] = {};
1348
+ ((_b = state.pendingValidationFails) === null || _b === void 0 ? void 0 : _b[bcName])[cursor] = {};
1335
1349
  }
1336
1350
  else {
1337
1351
  state.pendingValidationFails = initialViewState.pendingValidationFails;
1338
1352
  }
1353
+ state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) !== null && _c !== void 0 ? _c : {};
1339
1354
  state.handledForceActive[bcName][cursor] = {};
1340
1355
  }).addCase(bcSaveDataSuccess, function (state, action) {
1341
- var _a = action.payload, bcName = _a.bcName, cursor = _a.cursor;
1356
+ var _a, _b, _c;
1357
+ var _d = action.payload, bcName = _d.bcName, cursor = _d.cursor;
1342
1358
  var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
1359
+ state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) !== null && _a !== void 0 ? _a : {};
1343
1360
  state.pendingDataChanges[bcName][cursor] = {};
1344
1361
  if (isTargetFormatPVF) {
1345
1362
  ;
1346
- state.pendingValidationFails[bcName][cursor] = {};
1363
+ ((_b = state.pendingValidationFails) === null || _b === void 0 ? void 0 : _b[bcName])[cursor] = {};
1347
1364
  }
1348
1365
  else {
1349
1366
  state.pendingValidationFails = initialViewState.pendingValidationFails;
1350
1367
  }
1368
+ state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) !== null && _c !== void 0 ? _c : {};
1351
1369
  state.handledForceActive[bcName][cursor] = {};
1352
1370
  }).addCase(bcCancelPendingChanges, function (state, action) {
1353
1371
  var _a, _b;
@@ -1358,7 +1376,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1358
1376
  }
1359
1377
  }
1360
1378
  var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
1361
- var pendingValidationFails = __assign({}, state.pendingValidationFails);
1379
+ var pendingValidationFails = state.pendingValidationFails ? __assign({}, state.pendingValidationFails) : {};
1362
1380
  if (isTargetFormatPVF) {
1363
1381
  if (((_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.bcNames) === null || _b === void 0 ? void 0 : _b.length) > 0) {
1364
1382
  action.payload.bcNames.forEach(function (i) {
@@ -1387,8 +1405,8 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1387
1405
  isFilter: isFilter
1388
1406
  };
1389
1407
  }).addCase(showFileUploadPopup, function (state, action) {
1390
- var _a;
1391
- var bcName = (_a = state.widgets.find(function (item) { return item.name === action.payload.widgetName; })) === null || _a === void 0 ? void 0 : _a.bcName;
1408
+ var _a, _b;
1409
+ var bcName = (_b = (_a = state.widgets) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.name === action.payload.widgetName; })) === null || _b === void 0 ? void 0 : _b.bcName;
1392
1410
  state.popupData = {
1393
1411
  type: "file-upload",
1394
1412
  bcName: bcName,
@@ -1400,6 +1418,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1400
1418
  }).addCase(viewClearPickMap, function (state) {
1401
1419
  state.pickMap = null;
1402
1420
  }).addCase(closeViewPopup, function (state) {
1421
+ state.popupData = {};
1403
1422
  state.popupData.bcName = null;
1404
1423
  }).addCase(selectTableCell, function (state, action) {
1405
1424
  state.selectedCell = { widgetName: action.payload.widgetName, rowId: action.payload.rowId, fieldKey: action.payload.fieldKey };
@@ -1407,12 +1426,16 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1407
1426
  state.pendingDataChanges = initialViewState.pendingDataChanges;
1408
1427
  state.selectedCell = initialViewState.selectedCell;
1409
1428
  }).addCase(showNotification, function (state, action) {
1429
+ var _a, _b;
1430
+ state.systemNotifications = (_a = state.systemNotifications) !== null && _a !== void 0 ? _a : [];
1410
1431
  state.systemNotifications.push({
1411
1432
  type: action.payload.type,
1412
1433
  message: action.payload.message,
1413
- id: state.systemNotifications.length
1434
+ id: (_b = state.systemNotifications) === null || _b === void 0 ? void 0 : _b.length
1414
1435
  });
1415
1436
  }).addCase(closeNotification, function (state, action) {
1437
+ var _a;
1438
+ state.systemNotifications = (_a = state.systemNotifications) !== null && _a !== void 0 ? _a : [];
1416
1439
  state.systemNotifications = state.systemNotifications.filter(function (item) { return item.id !== action.payload.id; });
1417
1440
  }).addCase(showViewError, function (state, action) {
1418
1441
  state.error = action.payload.error;
@@ -1520,7 +1543,7 @@ var sendOperationEpic = function (action$, state$, _a) {
1520
1543
  var screenName = state.screen.screenName;
1521
1544
  var _l = action.payload, bcName = _l.bcName, operationType = _l.operationType, widgetName = _l.widgetName;
1522
1545
  var confirm = ((_a = action.payload.confirmOperation) === null || _a === void 0 ? void 0 : _a.type) || action.payload.confirm;
1523
- var bcUrl = buildBcUrl(bcName, true);
1546
+ var bcUrl = buildBcUrl(bcName, true, state);
1524
1547
  var bc = state.screen.bo.bc[bcName];
1525
1548
  var rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) === null || _b === void 0 ? void 0 : _b[bcUrl]);
1526
1549
  var fields = rowMeta === null || rowMeta === void 0 ? void 0 : rowMeta.fields;
@@ -1545,10 +1568,10 @@ var sendOperationEpic = function (action$, state$, _a) {
1545
1568
  }
1546
1569
  var context = { widgetName: action.payload.widgetName };
1547
1570
  return api.customAction(screenName, bcUrl, data, context, params).pipe(mergeMap(function (response) {
1548
- var _a;
1549
- var postInvoke = response.postActions[0];
1571
+ var _a, _b;
1572
+ var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
1550
1573
  var preInvoke = response.preInvoke;
1551
- return defaultSaveOperation ? ((_a = action === null || action === void 0 ? void 0 : action.payload) === null || _a === void 0 ? void 0 : _a.onSuccessAction) ? concat(of2(bcCancelPendingChanges({ bcNames: [bcName] })), of2(action.payload.onSuccessAction)) : EMPTY : concat.apply(void 0, __spreadArray([of2(sendOperationSuccess({ bcName: bcName, cursor: cursor })),
1574
+ return defaultSaveOperation ? ((_b = action === null || action === void 0 ? void 0 : action.payload) === null || _b === void 0 ? void 0 : _b.onSuccessAction) ? concat(of2(bcCancelPendingChanges({ bcNames: [bcName] })), of2(action.payload.onSuccessAction)) : EMPTY : concat.apply(void 0, __spreadArray([of2(sendOperationSuccess({ bcName: bcName, cursor: cursor })),
1552
1575
  of2(bcForceUpdate({ bcName: bcName }))], postOperationRoutine(widgetName, postInvoke, preInvoke, operationType, bcName), false));
1553
1576
  }), catchError(function (e) {
1554
1577
  var _a, _b, _c, _d, _e, _f;
@@ -1613,16 +1636,17 @@ import { OperationTypeCrud as OperationTypeCrud5 } from "@cxbox-ui/schema";
1613
1636
  var fileUploadConfirmEpic = function (action$, state$, _a) {
1614
1637
  var api = _a.api;
1615
1638
  return action$.pipe(filter3(bulkUploadFiles.match), mergeMap3(function (action) {
1616
- var _a;
1639
+ var _a, _b;
1617
1640
  var state = state$.value;
1618
- var bcName = state.view.popupData.bcName;
1619
- var bcUrl = buildBcUrl(bcName, true);
1620
- var widgetName = (_a = state.view.widgets.find(function (item) { return item.bcName === bcName; })) === null || _a === void 0 ? void 0 : _a.name;
1641
+ var bcName = (_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.bcName;
1642
+ var bcUrl = buildBcUrl(bcName, true, state);
1643
+ var widgetName = (_b = state.view.widgets.find(function (item) { return item.bcName === bcName; })) === null || _b === void 0 ? void 0 : _b.name;
1621
1644
  var data = {
1622
1645
  bulkIds: action.payload.fileIds
1623
1646
  };
1624
1647
  return api.customAction(state.screen.screenName, bcUrl, data, null, { _action: "file-upload-save" }).pipe(mergeMap3(function (response) {
1625
- var postInvoke = response.postActions[0];
1648
+ var _a;
1649
+ var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
1626
1650
  var preInvoke = response.preInvoke;
1627
1651
  return concat2.apply(void 0, __spreadArray([of4(sendOperationSuccess({ bcName: bcName, cursor: null })),
1628
1652
  of4(bcForceUpdate({ bcName: bcName })),
@@ -1638,14 +1662,14 @@ var selectTableCellInitEpic = function (action$, state$) { return action$.pipe(f
1638
1662
  var state = state$.value;
1639
1663
  var _b = action.payload, nextRowId = _b.rowId, fieldKey = _b.fieldKey;
1640
1664
  var nextWidget = state.view.widgets.find(function (widget) { return widget.name === action.payload.widgetName; });
1641
- var nextBcName = nextWidget.bcName;
1665
+ var nextBcName = nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.bcName;
1642
1666
  var nextBcCursor = (_a = state.screen.bo.bc[nextBcName]) === null || _a === void 0 ? void 0 : _a.cursor;
1643
1667
  var selectedCell = state.view.selectedCell;
1644
1668
  if (nextRowId !== nextBcCursor) {
1645
1669
  resultObservables.push(of5(bcSelectRecord({ bcName: nextBcName, cursor: nextRowId })));
1646
1670
  }
1647
- if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || nextWidget.name !== selectedCell.widgetName) {
1648
- resultObservables.push(of5(selectTableCell({ widgetName: nextWidget.name, rowId: nextRowId, fieldKey: fieldKey })));
1671
+ if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || (nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.name) !== selectedCell.widgetName) {
1672
+ resultObservables.push(of5(selectTableCell({ widgetName: nextWidget === null || nextWidget === void 0 ? void 0 : nextWidget.name, rowId: nextRowId, fieldKey: fieldKey })));
1649
1673
  }
1650
1674
  return concat3.apply(void 0, resultObservables);
1651
1675
  })); };
@@ -1687,13 +1711,13 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
1687
1711
  return EMPTY3;
1688
1712
  }
1689
1713
  var isPickListPopup = state.view.widgets.find(function (item) { var _a; return item.name === ((_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.widgetName) && [WidgetTypes4.PickListPopup, WidgetTypes4.FlatTreePopup].includes(item.type); });
1690
- var bcUrl = buildBcUrl(bcName, true);
1714
+ var bcUrl = buildBcUrl(bcName, true, state);
1691
1715
  var pendingChanges = state.view.pendingDataChanges[bcName][cursor];
1692
1716
  var handledForceActive = ((_a = state.view.handledForceActive[bcName]) === null || _a === void 0 ? void 0 : _a[cursor]) || {};
1693
1717
  var currentRecordData = (_b = state.data[bcName]) === null || _b === void 0 ? void 0 : _b.find(function (record) { return record.id === cursor; });
1694
1718
  var fieldsRowMeta = (_d = (_c = state.view.rowMeta[bcName]) === null || _c === void 0 ? void 0 : _c[bcUrl]) === null || _d === void 0 ? void 0 : _d.fields;
1695
1719
  var changedFiledKey = null;
1696
- var closePopup = concat5(of7(viewClearPickMap(null)), of7(closeViewPopup(null)), of7(bcRemoveAllFilters({ bcName: bcName })));
1720
+ var closePopup = concat5(of7(closeViewPopup(null)), of7(viewClearPickMap(null)), of7(bcRemoveAllFilters({ bcName: bcName })));
1697
1721
  var someForceActiveChanged = fieldsRowMeta === null || fieldsRowMeta === void 0 ? void 0 : fieldsRowMeta.filter(function (field) { return field.forceActive && pendingChanges[field.key] !== void 0; }).some(function (field) {
1698
1722
  var result = pendingChanges[field.key] !== handledForceActive[field.key];
1699
1723
  if (result) {
@@ -1703,7 +1727,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
1703
1727
  });
1704
1728
  var requestId = nanoid();
1705
1729
  if (someForceActiveChanged && !disableRetry) {
1706
- return concat5(of7(addPendingRequest({ request: { requestId: requestId, type: "force-active" } })), api.getRmByForceActive(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: currentRecordData.vstamp })).pipe(mergeMap6(function (data) {
1730
+ return concat5(of7(addPendingRequest({ request: { requestId: requestId, type: "force-active" } })), api.getRmByForceActive(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: currentRecordData === null || currentRecordData === void 0 ? void 0 : currentRecordData.vstamp })).pipe(mergeMap6(function (data) {
1707
1731
  var result = [of7(removePendingRequest({ requestId: requestId }))];
1708
1732
  if (state.view.url === initUrl) {
1709
1733
  result.push(of7(forceActiveRmUpdate({
@@ -1731,8 +1755,9 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
1731
1755
  }
1732
1756
  return concat5(of7(removePendingRequest({ requestId: requestId })), state.view.url === initUrl ? concat5(of7(changeDataItem({
1733
1757
  bcName: bcName,
1758
+ bcUrl: buildBcUrl(bcName, true, state),
1734
1759
  cursor: cursor,
1735
- dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData[changedFiledKey], _a),
1760
+ dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData === null || currentRecordData === void 0 ? void 0 : currentRecordData[changedFiledKey], _a),
1736
1761
  disableRetry: true
1737
1762
  })), of7(forceActiveChangeFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError }))) : EMPTY3);
1738
1763
  })));
@@ -1745,9 +1770,14 @@ import { concat as concat6, filter as filter8, mergeMap as mergeMap7, of as of8
1745
1770
  var showAllTableRecordsInitEpic = function (action$, state$) { return action$.pipe(filter8(showAllTableRecordsInit.match), mergeMap7(function (action) {
1746
1771
  var _a;
1747
1772
  var resultObservables = [];
1748
- var bcName = action.payload.bcName;
1773
+ var _b = action.payload, bcName = _b.bcName, cursor = _b.cursor;
1774
+ var state = state$.value;
1775
+ var route = state.router;
1749
1776
  resultObservables.push(of8(bcChangeCursors({ cursorsMap: (_a = {}, _a[bcName] = null, _a) })));
1777
+ var bcPath = route.bcPath.slice(0, route.bcPath.indexOf("".concat(bcName, "/").concat(cursor)));
1778
+ var url = defaultBuildURL(__assign(__assign({}, route), { bcPath: bcPath }));
1750
1779
  resultObservables.push(of8(bcForceUpdate({ bcName: bcName })));
1780
+ resultObservables.push(of8(changeLocation({ location: defaultParseURL(new URL(url, window.location.origin)) })));
1751
1781
  return concat6.apply(void 0, resultObservables);
1752
1782
  })); };
1753
1783
  // src/epics/view/clearPendingDataChangesAfterCursorChangeEpic.ts
@@ -1769,10 +1799,110 @@ var clearPendingDataChangesAfterCursorChangeEpic = function (action$, state$) {
1769
1799
  return EMPTY4;
1770
1800
  })); };
1771
1801
  // src/epics/router/drilldownEpic.ts
1772
- import { EMPTY as EMPTY5, filter as filter10, switchMap } from "rxjs";
1802
+ import { concat as concat7, EMPTY as EMPTY5, filter as filter10, switchMap } from "rxjs";
1773
1803
  var drillDownEpic = function (action$, state$) { return action$.pipe(filter10(drillDown.match), switchMap(function (action) {
1774
- return EMPTY5;
1804
+ var _a, _b;
1805
+ var state = state$.value;
1806
+ var url = action.payload.url;
1807
+ var result = [];
1808
+ switch (action.payload.drillDownType) {
1809
+ case DrillDownType.external:
1810
+ window.location.href = url;
1811
+ break;
1812
+ case DrillDownType.externalNew:
1813
+ if (/^[a-z0-9]+:\/\//i.test(url)) {
1814
+ window.open(url);
1815
+ }
1816
+ break;
1817
+ case DrillDownType.relative:
1818
+ window.location.href = "".concat(window.location.origin, "/").concat(url);
1819
+ break;
1820
+ case DrillDownType.relativeNew:
1821
+ window.open("".concat(window.location.origin, "/").concat(url), "_blank");
1822
+ break;
1823
+ case DrillDownType.inner:
1824
+ default:
1825
+ var urlBase = url.split("?")[0];
1826
+ var urlObject = new URL(url, window.location.origin);
1827
+ var urlFilters = urlObject.searchParams.get("filters");
1828
+ var urlSorters = urlObject.searchParams.get("sorters");
1829
+ var newFilters_1 = {};
1830
+ var newSorters = {};
1831
+ try {
1832
+ newFilters_1 = (_a = JSON.parse(urlFilters)) !== null && _a !== void 0 ? _a : newFilters_1;
1833
+ }
1834
+ catch (_c) {
1835
+ urlFilters && console.warn("Failed to parse filters on drilldown");
1836
+ newFilters_1 = {};
1837
+ }
1838
+ try {
1839
+ newSorters = (_b = JSON.parse(urlSorters)) !== null && _b !== void 0 ? _b : newSorters;
1840
+ }
1841
+ catch (_d) {
1842
+ urlSorters && console.warn("Failed to parse sorters on drilldown");
1843
+ newSorters = {};
1844
+ }
1845
+ var bcToUpdate_1 = {};
1846
+ Object.keys(state.screen.filters).forEach(function (bcName) {
1847
+ if (newFilters_1[bcName] === "" || newFilters_1[bcName]) {
1848
+ bcToUpdate_1[bcName] = true;
1849
+ result.push(bcRemoveAllFilters({ bcName: bcName }));
1850
+ }
1851
+ });
1852
+ var nextState = defaultParseURL(urlObject);
1853
+ var viewName_1 = nextState.viewName;
1854
+ Object.entries(newFilters_1).forEach(function (_a) {
1855
+ var _b;
1856
+ var bcName = _a[0], filterExpression = _a[1];
1857
+ var parsedFilters = (_b = parseFilters(filterExpression)) === null || _b === void 0 ? void 0 : _b.map(function (item) { return (__assign(__assign({}, item), { viewName: viewName_1 })); });
1858
+ parsedFilters === null || parsedFilters === void 0 ? void 0 : parsedFilters.forEach(function (parsedFilter) {
1859
+ bcToUpdate_1[bcName] = true;
1860
+ result.push(bcAddFilter({ bcName: bcName, filter: parsedFilter }));
1861
+ });
1862
+ });
1863
+ Object.entries(newSorters).forEach(function (_a) {
1864
+ var bcName = _a[0], sortExpression = _a[1];
1865
+ var sorter = parseSorters(sortExpression);
1866
+ result.push(bcAddSorter({ bcName: bcName, sorter: sorter }));
1867
+ bcToUpdate_1[bcName] = true;
1868
+ });
1869
+ var prevState = state.router;
1870
+ var willUpdateAnyway = shallowCompare(prevState, nextState, ["params"]).length > 0;
1871
+ if (!willUpdateAnyway) {
1872
+ Object.keys(bcToUpdate_1).forEach(function (bcName) {
1873
+ result.push(bcForceUpdate({ bcName: bcName }));
1874
+ });
1875
+ }
1876
+ result.push(changeLocation({ location: defaultParseURL(new URL(makeRelativeUrl(urlBase), window.location.origin)) }));
1877
+ break;
1878
+ }
1879
+ return result.length ? concat7(result) : EMPTY5;
1775
1880
  })); };
1881
+ function shallowCompare(prevProps, nextProps, ignore) {
1882
+ if (ignore === void 0) { ignore = []; }
1883
+ var diffProps = [];
1884
+ if (!prevProps && !nextProps) {
1885
+ return null;
1886
+ }
1887
+ if (!prevProps) {
1888
+ return Object.keys(nextProps);
1889
+ }
1890
+ if (!nextProps) {
1891
+ return Object.keys(prevProps);
1892
+ }
1893
+ var newKeys = Object.keys(nextProps);
1894
+ newKeys.forEach(function (key) {
1895
+ if (prevProps[key] !== nextProps[key] && !ignore.includes(key)) {
1896
+ diffProps.push(key);
1897
+ }
1898
+ });
1899
+ Object.keys(prevProps).forEach(function (key) {
1900
+ if (!newKeys.includes(key)) {
1901
+ diffProps.push(key);
1902
+ }
1903
+ });
1904
+ return diffProps;
1905
+ }
1776
1906
  // src/epics/router/loginDoneEpic.ts
1777
1907
  import { filter as filter11, of as of10, switchMap as switchMap2 } from "rxjs";
1778
1908
  var loginDoneEpic = function (action$, state$) { return action$.pipe(filter11(loginDone.match), switchMap2(function (action) {
@@ -1828,20 +1958,20 @@ var changeScreen = function (action$, state$) { return action$.pipe(filter14(sel
1828
1958
  return nextView ? of12(selectView(nextView)) : of12(selectViewFail({ viewName: nextViewName }));
1829
1959
  })); };
1830
1960
  // src/epics/router/userDrillDownEpic.ts
1831
- import { catchError as catchError4, concat as concat7, EMPTY as EMPTY8, filter as filter15, mergeMap as mergeMap10, of as of13, switchMap as switchMap6 } from "rxjs";
1961
+ import { catchError as catchError4, concat as concat8, EMPTY as EMPTY8, filter as filter15, mergeMap as mergeMap10, of as of13, switchMap as switchMap6 } from "rxjs";
1832
1962
  var userDrillDownEpic = function (action$, state$, _a) {
1833
1963
  var api = _a.api;
1834
1964
  return action$.pipe(filter15(userDrillDown.match), switchMap6(function (action) {
1835
1965
  var state = state$.value;
1836
1966
  var _a = action.payload, bcName = _a.bcName, fieldKey = _a.fieldKey, cursor = _a.cursor;
1837
- var bcUrl = buildBcUrl(bcName, true);
1967
+ var bcUrl = buildBcUrl(bcName, true, state);
1838
1968
  return api.fetchRowMeta(state.screen.screenName, bcUrl).pipe(mergeMap10(function (rowMeta) {
1839
1969
  var _a, _b, _c, _d;
1840
1970
  var drillDownField = rowMeta.fields.find(function (field) { return field.key === fieldKey; });
1841
1971
  var route = state.router;
1842
1972
  var drillDownKey = (_b = (_a = state.view.widgets.find(function (widget) { return widget.bcName === bcName; })) === null || _a === void 0 ? void 0 : _a.fields.find(function (field) { return field.key === fieldKey; })) === null || _b === void 0 ? void 0 : _b.drillDownKey;
1843
1973
  var customDrillDownUrl = (_d = (_c = state.data[bcName]) === null || _c === void 0 ? void 0 : _c.find(function (record) { return record.id === cursor; })) === null || _d === void 0 ? void 0 : _d[drillDownKey];
1844
- return customDrillDownUrl || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) !== route.path ? concat7(drillDownField.drillDownType !== DrillDownType.inner ? of13(bcFetchRowMetaSuccess({ bcName: bcName, rowMeta: rowMeta, bcUrl: bcUrl, cursor: cursor })) : EMPTY8, of13(userDrillDownSuccess({ bcName: bcName, bcUrl: bcUrl, cursor: cursor })), of13(drillDown({
1974
+ return customDrillDownUrl || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) || (drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDown) !== route.path ? concat8((drillDownField === null || drillDownField === void 0 ? void 0 : drillDownField.drillDownType) !== DrillDownType.inner ? of13(bcFetchRowMetaSuccess({ bcName: bcName, rowMeta: rowMeta, bcUrl: bcUrl, cursor: cursor })) : EMPTY8, of13(userDrillDownSuccess({ bcName: bcName, bcUrl: bcUrl, cursor: cursor })), of13(drillDown({
1845
1975
  url: customDrillDownUrl || drillDownField.drillDown,
1846
1976
  drillDownType: drillDownField.drillDownType,
1847
1977
  route: route
@@ -1853,7 +1983,7 @@ var userDrillDownEpic = function (action$, state$, _a) {
1853
1983
  }));
1854
1984
  };
1855
1985
  // src/epics/router/changeLocationEpic.ts
1856
- import { concat as concat8, EMPTY as EMPTY9, filter as filter16, mergeMap as mergeMap11, of as of14 } from "rxjs";
1986
+ import { concat as concat9, EMPTY as EMPTY9, filter as filter16, mergeMap as mergeMap11, of as of14 } from "rxjs";
1857
1987
  var changeLocationEpic = function (action$, state$) { return action$.pipe(filter16(changeLocation.match), mergeMap11(function (action) {
1858
1988
  var _a, _b;
1859
1989
  var state = state$.value;
@@ -1899,7 +2029,7 @@ var changeLocationEpic = function (action$, state$) { return action$.pipe(filter
1899
2029
  }
1900
2030
  });
1901
2031
  }
1902
- return concat8.apply(void 0, resultObservables);
2032
+ return concat9.apply(void 0, resultObservables);
1903
2033
  })); };
1904
2034
  // src/epics/router/selectViewFailEpic.ts
1905
2035
  import { filter as filter17, map as map2 } from "rxjs";
@@ -1932,7 +2062,7 @@ var userDrillDownChangeCursorsEpic = function (action$, state$) { return action$
1932
2062
  if (cursor !== action.payload.cursor) {
1933
2063
  return bcChangeCursors({ cursorsMap: (_a = {}, _a[action.payload.bcName] = action.payload.cursor, _a) });
1934
2064
  }
1935
- return void 0;
2065
+ return emptyAction;
1936
2066
  })); };
1937
2067
  // src/epics/screen/apiErrorEpic.ts
1938
2068
  import axios from "axios";
@@ -1960,7 +2090,9 @@ import { EMPTY as EMPTY11, filter as filter21, mergeMap as mergeMap13, tap } fro
1960
2090
  var downloadFileEpic = function (action$, state$, _a) {
1961
2091
  var api = _a.api;
1962
2092
  return action$.pipe(filter21(downloadFile.match), tap(function (action) {
2093
+ var fileId = action.payload.fileId;
1963
2094
  var anchor = document.createElement("a");
2095
+ anchor.href = "".concat(api.fileUploadEndpoint, "?id=").concat(encodeURIComponent(fileId));
1964
2096
  anchor.style.display = "none";
1965
2097
  document.body.appendChild(anchor);
1966
2098
  setTimeout(function () {
@@ -1977,8 +2109,8 @@ var httpError401Epic = function (action$) { return action$.pipe(filter22(httpErr
1977
2109
  // src/epics/screen/httpError409Epic.ts
1978
2110
  import { filter as filter23, map as map6 } from "rxjs";
1979
2111
  var httpError409Epic = function (action$, state$) { return action$.pipe(filter23(httpError.match), filter23(function (action) { return action.payload.statusCode === 409; }), map6(function (action) {
1980
- var _a, _b;
1981
- var notificationMessage = ((_b = (_a = action.payload.error.response.data.error) === null || _a === void 0 ? void 0 : _a.popup) === null || _b === void 0 ? void 0 : _b[0]) || "";
2112
+ var _a, _b, _c;
2113
+ var notificationMessage = ((_c = (_b = ((_a = action.payload.error.response) === null || _a === void 0 ? void 0 : _a.data).error) === null || _b === void 0 ? void 0 : _b.popup) === null || _c === void 0 ? void 0 : _c[0]) || "";
1982
2114
  return addNotification({
1983
2115
  key: "action_edit_error",
1984
2116
  message: notificationMessage,
@@ -1992,12 +2124,12 @@ var httpError409Epic = function (action$, state$) { return action$.pipe(filter23
1992
2124
  });
1993
2125
  })); };
1994
2126
  // src/epics/screen/httpError418Epic.ts
1995
- import { concat as concat9, EMPTY as EMPTY12, filter as filter24, mergeMap as mergeMap14, of as of16 } from "rxjs";
2127
+ import { concat as concat10, EMPTY as EMPTY12, filter as filter24, mergeMap as mergeMap14, of as of16 } from "rxjs";
1996
2128
  var httpError418Epic = function (action$, state$) { return action$.pipe(filter24(httpError.match), filter24(function (action) { return action.payload.statusCode === 418; }), mergeMap14(function (action) {
1997
- var _a;
1998
- var _b = action.payload, error = _b.error, callContext = _b.callContext;
2129
+ var _a, _b;
2130
+ var _c = action.payload, error = _c.error, callContext = _c.callContext;
1999
2131
  var result = [];
2000
- var typedError = error.response.data;
2132
+ var typedError = (_a = error.response) === null || _a === void 0 ? void 0 : _a.data;
2001
2133
  if (!typedError.error.popup) {
2002
2134
  return EMPTY12;
2003
2135
  }
@@ -2006,16 +2138,16 @@ var httpError418Epic = function (action$, state$) { return action$.pipe(filter24
2006
2138
  message: typedError.error.popup[0]
2007
2139
  };
2008
2140
  result.push(of16(showViewError({ error: businessError })));
2009
- if ((_a = typedError.error.postActions) === null || _a === void 0 ? void 0 : _a[0]) {
2141
+ if ((_b = typedError.error.postActions) === null || _b === void 0 ? void 0 : _b[0]) {
2010
2142
  var widget = state$.value.view.widgets.find(function (item) { return item.name === callContext.widgetName; });
2011
- var bcName = widget.bcName;
2143
+ var bcName = widget === null || widget === void 0 ? void 0 : widget.bcName;
2012
2144
  result.push(of16(processPostInvoke({
2013
2145
  bcName: bcName,
2014
2146
  postInvoke: typedError.error.postActions[0],
2015
- widgetName: widget.name
2147
+ widgetName: widget === null || widget === void 0 ? void 0 : widget.name
2016
2148
  })));
2017
2149
  }
2018
- return concat9.apply(void 0, result);
2150
+ return concat10.apply(void 0, result);
2019
2151
  })); };
2020
2152
  // src/epics/screen/httpError500Epic.ts
2021
2153
  import { filter as filter25, map as map7 } from "rxjs";
@@ -2032,10 +2164,11 @@ var httpError500Epic = function (action$, state$) { return action$.pipe(filter25
2032
2164
  import { filter as filter26, map as map8 } from "rxjs";
2033
2165
  var knownHttpErrors = [401, 409, 418, 500];
2034
2166
  var httpErrorDefaultEpic = function (action$, state$) { return action$.pipe(filter26(httpError.match), filter26(function (action) { return !knownHttpErrors.includes(action.payload.statusCode); }), map8(function (action) {
2167
+ var _a, _b;
2035
2168
  var businessError = {
2036
2169
  type: 0 /* BusinessError */,
2037
- code: action.payload.error.response.status,
2038
- details: action.payload.error.response.data
2170
+ code: (_a = action.payload.error.response) === null || _a === void 0 ? void 0 : _a.status,
2171
+ details: (_b = action.payload.error.response) === null || _b === void 0 ? void 0 : _b.data
2039
2172
  };
2040
2173
  return showViewError({ error: businessError });
2041
2174
  })); };
@@ -2056,6 +2189,7 @@ var downloadFileByUrlEpic = function (action$, state$) { return action$.pipe(fil
2056
2189
  import { EMPTY as EMPTY14, filter as filter28, mergeMap as mergeMap16, of as of17 } from "rxjs";
2057
2190
  var processPostInvokeEpic = function (action$, state$) { return action$.pipe(filter28(processPostInvoke.match), mergeMap16(function (action) {
2058
2191
  var _a;
2192
+ var _b;
2059
2193
  var state = state$.value;
2060
2194
  switch (action.payload.postInvoke.type) {
2061
2195
  case "drillDown" /* drillDown */:
@@ -2063,7 +2197,10 @@ var processPostInvokeEpic = function (action$, state$) { return action$.pipe(fil
2063
2197
  case "postDelete" /* postDelete */: {
2064
2198
  var cursorsMap = (_a = {}, _a[action.payload.bcName] = null, _a);
2065
2199
  var result = [bcChangeCursors({ cursorsMap: cursorsMap })];
2066
- if (state.router.bcPath.includes("".concat(action.payload.bcName, "/"))) {
2200
+ if ((_b = state.router.bcPath) === null || _b === void 0 ? void 0 : _b.includes("".concat(action.payload.bcName, "/"))) {
2201
+ var newBcUrl = state.router.bcPath.split(action.payload.bcName)[0] || "";
2202
+ var newUrl = "/screen/".concat(state.router.screenName, "/view/").concat(state.router.viewName, "/").concat(newBcUrl);
2203
+ result.push(changeLocation({ location: defaultParseURL(new URL(newUrl, window.location.origin)) }));
2067
2204
  }
2068
2205
  else {
2069
2206
  result.push(bcFetchDataRequest({
@@ -2132,24 +2269,23 @@ var processPostInvokeConfirmEpic = function (action$, state$) { return action$.p
2132
2269
  }
2133
2270
  })); };
2134
2271
  // src/epics/session/switchRoleEpic.ts
2135
- import { concat as concat10, filter as filter30, switchMap as switchMap7 } from "rxjs";
2272
+ import { concat as concat11, filter as filter30, switchMap as switchMap7 } from "rxjs";
2136
2273
  var switchRoleEpic = function (action$, state$) { return action$.pipe(filter30(switchRole.match), switchMap7(function (action) {
2137
- return concat10([logoutDone(null), login({ login: "", password: "", role: action.payload.role })]);
2274
+ return concat11([logoutDone(null), login({ login: "", password: "", role: action.payload.role })]);
2138
2275
  })); };
2139
2276
  // src/epics/session/refreshMetaEpic.ts
2140
- import { catchError as catchError5, concat as concat11, filter as filter31, mergeMap as mergeMap18, of as of19, switchMap as switchMap8 } from "rxjs";
2277
+ import { catchError as catchError5, concat as concat12, filter as filter31, mergeMap as mergeMap18, of as of19, switchMap as switchMap8 } from "rxjs";
2141
2278
  var refreshMetaEpic = function (action$, state$, _a) {
2142
2279
  var api = _a.api;
2143
2280
  return action$.pipe(filter31(refreshMeta.match), mergeMap18(function () {
2144
2281
  var state = state$.value;
2145
2282
  var router = state.router;
2146
2283
  var activeRole = state.session.activeRole;
2147
- return api.refreshMeta().pipe(switchMap8(function () { return concat11([
2284
+ return api.refreshMeta().pipe(switchMap8(function () { return concat12([
2148
2285
  logoutDone(null),
2149
2286
  login({ login: "", password: "", role: activeRole }),
2150
2287
  changeLocation({
2151
- route: router,
2152
- action: "PUSH"
2288
+ location: router
2153
2289
  })
2154
2290
  ]); }), catchError5(function (error) { return of19(loginFail(error)); }));
2155
2291
  }));
@@ -2158,7 +2294,7 @@ var refreshMetaEpic = function (action$, state$, _a) {
2158
2294
  import { EMPTY as EMPTY16, filter as filter32, switchMap as switchMap9 } from "rxjs";
2159
2295
  var loginDoneSessionEpic = function (action$, store) { return action$.pipe(filter32(login.match), switchMap9(function (action) { return EMPTY16; })); };
2160
2296
  // src/epics/session/loginByAnotherRoleEpic.ts
2161
- import { catchError as catchError6, EMPTY as EMPTY17, filter as filter33, mergeMap as mergeMap19, of as of20, switchMap as switchMap10 } from "rxjs";
2297
+ import { catchError as catchError6, concat as concat13, filter as filter33, mergeMap as mergeMap19, of as of20, switchMap as switchMap10 } from "rxjs";
2162
2298
  var responseStatusMessages = {
2163
2299
  401: "Invalid credentials",
2164
2300
  403: "Access denied"
@@ -2170,9 +2306,26 @@ var loginByAnotherRoleEpic = function (action$, state$, _a) {
2170
2306
  var role = (_a = action.payload.role) !== null && _a !== void 0 ? _a : "";
2171
2307
  var isSwitchRole = role && role !== state$.value.session.activeRole;
2172
2308
  return api.loginByRoleRequest(role).pipe(mergeMap19(function (data) {
2309
+ var _a;
2310
+ var result = [];
2173
2311
  if (isSwitchRole) {
2312
+ var defaultScreen = data.screens.find(function (screen) { return screen.defaultScreen; }) || data.screens[0];
2313
+ var defaultViewName_1 = (_a = defaultScreen === null || defaultScreen === void 0 ? void 0 : defaultScreen.primary) !== null && _a !== void 0 ? _a : defaultScreen.meta.views[0].name;
2314
+ var defaultView = defaultScreen === null || defaultScreen === void 0 ? void 0 : defaultScreen.meta.views.find(function (view) { return defaultViewName_1 === view.name; });
2315
+ if (defaultView)
2316
+ result.push(changeLocation({ location: defaultParseURL(new URL(defaultView.url, window.location.origin)) }));
2174
2317
  }
2175
- return EMPTY17;
2318
+ return concat13(__spreadArray(__spreadArray([], result, true), [
2319
+ loginDone({
2320
+ devPanelEnabled: data.devPanelEnabled,
2321
+ activeRole: data.activeRole,
2322
+ roles: data.roles,
2323
+ screens: data.screens,
2324
+ firstName: data.firstName,
2325
+ lastName: data.lastName,
2326
+ login: data.login
2327
+ })
2328
+ ], false));
2176
2329
  }), catchError6(function (error) {
2177
2330
  console.error(error);
2178
2331
  var errorMsg = error.response ? responseStatusMessages[error.response.status] || "Server application unavailable" : "Empty server response";
@@ -2181,34 +2334,37 @@ var loginByAnotherRoleEpic = function (action$, state$, _a) {
2181
2334
  }));
2182
2335
  };
2183
2336
  // src/epics/session/refreshMetaAndReloadPageEpic.ts
2184
- import { concat as concat12, EMPTY as EMPTY18, filter as filter34, of as of21, switchMap as switchMap11, take, tap as tap3 } from "rxjs";
2185
- var refreshMetaAndReloadPageEpic = function (action$, state$) { return action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(function () { return concat12(of21(refreshMeta(null)), action$.pipe(filter34(loginDone.match), take(1), tap3(function () { return location.reload(); }), switchMap11(function () { return EMPTY18; }))); })); };
2337
+ import { concat as concat14, EMPTY as EMPTY17, filter as filter34, of as of21, switchMap as switchMap11, take, tap as tap3 } from "rxjs";
2338
+ var refreshMetaAndReloadPageEpic = function (action$, state$) { return action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(function () { return concat14(of21(refreshMeta(null)), action$.pipe(filter34(loginDone.match), take(1), tap3(function () { return location.reload(); }), switchMap11(function () { return EMPTY17; }))); })); };
2186
2339
  // src/epics/data/bcNewDataEpic.ts
2187
- import { catchError as catchError7, concat as concat13, EMPTY as EMPTY19, filter as filter35, mergeMap as mergeMap20, of as of22 } from "rxjs";
2340
+ import { catchError as catchError7, concat as concat15, EMPTY as EMPTY18, filter as filter35, mergeMap as mergeMap20, of as of22 } from "rxjs";
2188
2341
  import { OperationTypeCrud as OperationTypeCrud8 } from "@cxbox-ui/schema";
2189
2342
  var bcNewDataEpic = function (action$, state$, _a) {
2190
2343
  var api = _a.api;
2191
2344
  return action$.pipe(filter35(sendOperation.match), filter35(function (action) { return matchOperationRole(OperationTypeCrud8.create, action.payload, state$.value); }), mergeMap20(function (action) {
2345
+ var _a;
2192
2346
  var state = state$.value;
2193
2347
  var bcName = action.payload.bcName;
2194
- var bcUrl = buildBcUrl(bcName);
2348
+ var bcUrl = (_a = buildBcUrl(bcName, false, state)) !== null && _a !== void 0 ? _a : "";
2195
2349
  var context = { widgetName: action.payload.widgetName };
2196
2350
  var params = { _action: action.payload.operationType };
2197
2351
  return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe(mergeMap20(function (data) {
2352
+ var _a, _b;
2198
2353
  var rowMeta = data.row;
2199
2354
  var dataItem = { id: null, vstamp: -1 };
2200
2355
  data.row.fields.forEach(function (field) {
2201
2356
  dataItem[field.key] = field.currentValue;
2202
2357
  });
2203
- var postInvoke = data.postActions[0];
2358
+ var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
2204
2359
  var cursor = dataItem.id;
2205
- return concat13(of22(bcNewDataSuccess({ bcName: bcName, dataItem: dataItem, bcUrl: bcUrl })), of22(bcFetchRowMetaSuccess({ bcName: bcName, bcUrl: "".concat(bcUrl, "/").concat(cursor), rowMeta: rowMeta, cursor: cursor })), of22(changeDataItem({
2206
- bcName: action.payload.bcName,
2360
+ return concat15(of22(bcNewDataSuccess({ bcName: bcName, dataItem: dataItem, bcUrl: bcUrl })), of22(bcFetchRowMetaSuccess({ bcName: bcName, bcUrl: "".concat(bcUrl, "/").concat(cursor), rowMeta: rowMeta, cursor: cursor })), of22(changeDataItem({
2361
+ bcName: bcName,
2362
+ bcUrl: (_b = buildBcUrl(bcName, true, state)) !== null && _b !== void 0 ? _b : "",
2207
2363
  cursor: cursor,
2208
2364
  dataItem: {
2209
2365
  id: cursor
2210
2366
  }
2211
- })), postInvoke ? of22(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: action.payload.widgetName })) : EMPTY19);
2367
+ })), postInvoke ? of22(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: action.payload.widgetName })) : EMPTY18);
2212
2368
  }), catchError7(function (error) {
2213
2369
  console.error(error);
2214
2370
  return of22(bcNewDataFail({ bcName: bcName }));
@@ -2226,7 +2382,7 @@ function cancelRequestEpic(action$, actionTypes, cancelFn, cancelActionCreator,
2226
2382
  return true;
2227
2383
  }; }
2228
2384
  return action$.pipe(filter36(isAnyOf2.apply(void 0, actionTypes)), filter36(filterFn), mergeMap21(function () {
2229
- cancelFn();
2385
+ cancelFn === null || cancelFn === void 0 ? void 0 : cancelFn();
2230
2386
  return of23(cancelActionCreator);
2231
2387
  }), take2(1));
2232
2388
  }
@@ -2241,7 +2397,7 @@ var bcLoadMoreEpic = function (action$, state$, _a) {
2241
2397
  var cursor = bc.cursor, page = bc.page;
2242
2398
  var limit = ((_a = state.view.widgets.find(function (i) { return i.bcName === bcName; })) === null || _a === void 0 ? void 0 : _a.limit) || bc.limit;
2243
2399
  var limitBySelfCursor = (_b = state.router.bcPath) === null || _b === void 0 ? void 0 : _b.includes("".concat(bcName, "/").concat(cursor));
2244
- var bcUrl = buildBcUrl(bcName, limitBySelfCursor);
2400
+ var bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
2245
2401
  var filters = state.screen.filters[bcName] || [];
2246
2402
  var sorters = state.screen.sorters[bcName];
2247
2403
  var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(filters)), getSorters(sorters));
@@ -2265,20 +2421,20 @@ var bcLoadMoreEpic = function (action$, state$, _a) {
2265
2421
  }));
2266
2422
  };
2267
2423
  // src/epics/data/bcSaveDataEpic.ts
2268
- import { catchError as catchError9, concat as concat14, EMPTY as EMPTY20, filter as filter38, mergeMap as mergeMap23, of as of25 } from "rxjs";
2424
+ import { catchError as catchError9, concat as concat16, EMPTY as EMPTY19, filter as filter38, mergeMap as mergeMap23, of as of25 } from "rxjs";
2269
2425
  var bcSaveDataEpic = function (action$, state$, _a) {
2270
2426
  var api = _a.api;
2271
2427
  return action$.pipe(filter38(sendOperation.match), filter38(function (action) { return matchOperationRole(OperationTypeCrud.save, action.payload, state$.value); }), mergeMap23(function (action) {
2272
- var _a, _b, _c;
2428
+ var _a, _b, _c, _d;
2273
2429
  var state = state$.value;
2274
2430
  var bcName = action.payload.bcName;
2275
- var bcUrl = buildBcUrl(bcName, true);
2431
+ var bcUrl = (_a = buildBcUrl(bcName, true, state)) !== null && _a !== void 0 ? _a : "";
2276
2432
  var widgetName = action.payload.widgetName;
2277
2433
  var cursor = state.screen.bo.bc[bcName].cursor;
2278
2434
  var dataItem = state.data[bcName].find(function (item) { return item.id === cursor; });
2279
- var pendingChanges = (_a = state.view.pendingDataChanges[bcName]) === null || _a === void 0 ? void 0 : _a[cursor];
2280
- var rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) === null || _b === void 0 ? void 0 : _b[bcUrl]);
2281
- var options = (_c = state.view.widgets.find(function (widget) { return widget.name === widgetName; })) === null || _c === void 0 ? void 0 : _c.options;
2435
+ var pendingChanges = (_b = state.view.pendingDataChanges[bcName]) === null || _b === void 0 ? void 0 : _b[cursor];
2436
+ var rowMeta = bcUrl && ((_c = state.view.rowMeta[bcName]) === null || _c === void 0 ? void 0 : _c[bcUrl]);
2437
+ var options = (_d = state.view.widgets.find(function (widget) { return widget.name === widgetName; })) === null || _d === void 0 ? void 0 : _d.options;
2282
2438
  if (rowMeta) {
2283
2439
  var fields = rowMeta.fields;
2284
2440
  var _loop_2 = function (key) {
@@ -2295,19 +2451,20 @@ var bcSaveDataEpic = function (action$, state$, _a) {
2295
2451
  return bcFetchDataRequest({ bcName: childBcName, widgetName: widgetNames[0] });
2296
2452
  });
2297
2453
  var context = { widgetName: action.payload.widgetName };
2298
- return api.saveBcData(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: dataItem.vstamp }), context).pipe(mergeMap23(function (data) {
2299
- var postInvoke = data.postActions[0];
2454
+ return api.saveBcData(state.screen.screenName, bcUrl, __assign(__assign({}, pendingChanges), { vstamp: dataItem === null || dataItem === void 0 ? void 0 : dataItem.vstamp }), context).pipe(mergeMap23(function (data) {
2455
+ var _a;
2456
+ var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
2300
2457
  var responseDataItem = data.record;
2301
- return concat14(of25(bcSaveDataSuccess({ bcName: bcName, cursor: cursor, dataItem: responseDataItem })), of25(bcFetchRowMeta({ widgetName: widgetName, bcName: bcName })), of25.apply(void 0, fetchChildrenBcData), postInvoke ? of25(processPostInvoke({
2458
+ return concat16(of25(bcSaveDataSuccess({ bcName: bcName, cursor: cursor, dataItem: responseDataItem })), of25(bcFetchRowMeta({ widgetName: widgetName, bcName: bcName })), of25.apply(void 0, fetchChildrenBcData), postInvoke ? of25(processPostInvoke({
2302
2459
  bcName: bcName,
2303
2460
  widgetName: widgetName,
2304
2461
  postInvoke: postInvoke,
2305
2462
  cursor: responseDataItem.id
2306
- })) : EMPTY20, action.payload.onSuccessAction ? of25(action.payload.onSuccessAction) : EMPTY20);
2463
+ })) : EMPTY19, action.payload.onSuccessAction ? of25(action.payload.onSuccessAction) : EMPTY19);
2307
2464
  }), catchError9(function (e) {
2308
- var _a, _b, _c, _d, _e, _f;
2465
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2309
2466
  console.error(e);
2310
- var notification$ = EMPTY20;
2467
+ var notification$ = EMPTY19;
2311
2468
  if (action.payload.onSuccessAction && !(options === null || options === void 0 ? void 0 : options.disableNotification)) {
2312
2469
  notification$ = of25(addNotification({
2313
2470
  key: "data_autosave_undo",
@@ -2326,15 +2483,15 @@ var bcSaveDataEpic = function (action$, state$, _a) {
2326
2483
  var entityError = null;
2327
2484
  var operationError = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data;
2328
2485
  if (((_b = e.response) === null || _b === void 0 ? void 0 : _b.data) === Object((_c = e.response) === null || _c === void 0 ? void 0 : _c.data)) {
2329
- entityError = (_d = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _d === void 0 ? void 0 : _d.entity;
2330
- viewError = (_f = (_e = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _e === void 0 ? void 0 : _e.popup) === null || _f === void 0 ? void 0 : _f[0];
2486
+ entityError = (_e = (_d = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _d === void 0 ? void 0 : _d.entity) !== null && _e !== void 0 ? _e : entityError;
2487
+ viewError = (_h = (_g = (_f = operationError === null || operationError === void 0 ? void 0 : operationError.error) === null || _f === void 0 ? void 0 : _f.popup) === null || _g === void 0 ? void 0 : _g[0]) !== null && _h !== void 0 ? _h : viewError;
2331
2488
  }
2332
- return concat14(of25(bcSaveDataFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError })), notification$);
2489
+ return concat16(of25(bcSaveDataFail({ bcName: bcName, bcUrl: bcUrl, viewError: viewError, entityError: entityError })), notification$);
2333
2490
  }));
2334
2491
  }));
2335
2492
  };
2336
2493
  // src/epics/data/selectViewEpic.ts
2337
- import { EMPTY as EMPTY21, filter as filter39, mergeMap as mergeMap24 } from "rxjs";
2494
+ import { EMPTY as EMPTY20, filter as filter39, mergeMap as mergeMap24 } from "rxjs";
2338
2495
  var selectViewEpic = function (action$, state$) { return action$.pipe(filter39(selectView.match), mergeMap24(function (action) {
2339
2496
  try {
2340
2497
  var state_1 = state$.value;
@@ -2360,11 +2517,11 @@ var selectViewEpic = function (action$, state$) { return action$.pipe(filter39(s
2360
2517
  }
2361
2518
  catch (e) {
2362
2519
  console.error("selectView Epic:: ".concat(e));
2363
- return EMPTY21;
2520
+ return EMPTY20;
2364
2521
  }
2365
2522
  })); };
2366
2523
  // src/epics/data/bcFetchDataEpic.ts
2367
- import { catchError as catchError10, concat as concat15, EMPTY as EMPTY22, filter as filter40, mergeMap as mergeMap25, of as of26, race as race2 } from "rxjs";
2524
+ import { catchError as catchError10, concat as concat17, EMPTY as EMPTY21, filter as filter40, mergeMap as mergeMap25, of as of26, race as race2 } from "rxjs";
2368
2525
  import { WidgetTypes as WidgetTypes5 } from "@cxbox-ui/schema";
2369
2526
  import { isAnyOf as isAnyOf3 } from "@reduxjs/toolkit";
2370
2527
  var bcFetchDataEpic = function (action$, state$, _a) {
@@ -2386,7 +2543,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
2386
2543
  var getChildrenData = function (widgets, bcDictionary, isHierarchy, showConditionCheck) {
2387
2544
  var bcName = action.payload.bcName;
2388
2545
  var _a = bcFetchDataRequest.match(action) ? action.payload : { ignorePageLimit: void 0, keepDelta: void 0 }, ignorePageLimit = _a.ignorePageLimit, keepDelta = _a.keepDelta;
2389
- return concat15.apply(void 0, Object.entries(getBcChildren(bcName, widgets, bcDictionary)).filter(function (_a) {
2546
+ return concat17.apply(void 0, Object.entries(getBcChildren(bcName, widgets, bcDictionary)).filter(function (_a) {
2390
2547
  var childBcName = _a[0], widgetNames = _a[1];
2391
2548
  var nonLazyWidget = widgets.find(function (item) {
2392
2549
  return widgetNames.includes(item.name) && !PopupWidgetTypes.includes(item.type) && showConditionCheck(item);
@@ -2403,41 +2560,41 @@ var bcFetchDataEpic = function (action$, state$, _a) {
2403
2560
  });
2404
2561
  return of26(bcFetchDataRequest({
2405
2562
  bcName: childBcName,
2406
- widgetName: nonLazyWidget.name,
2563
+ widgetName: nonLazyWidget === null || nonLazyWidget === void 0 ? void 0 : nonLazyWidget.name,
2407
2564
  ignorePageLimit: ignorePageLimit || showViewPopup.match(action),
2408
2565
  keepDelta: isHierarchy || keepDelta
2409
2566
  }));
2410
2567
  }));
2411
2568
  };
2412
2569
  var bcFetchDataImpl = function () {
2413
- var _a, _b, _c, _d, _e, _f;
2570
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2414
2571
  var state = state$.value;
2415
- var widgetName = action.payload.widgetName;
2416
- var _g = state.view, widgets = _g.widgets, infiniteWidgets = _g.infiniteWidgets;
2417
- var widget = (_a = widgets.find(function (item) { return item.name === widgetName; })) !== null && _a !== void 0 ? _a : widgets.find(function (item) { return item.bcName === action.payload.bcName; });
2572
+ var _j = action.payload.widgetName, widgetName = _j === void 0 ? "" : _j;
2573
+ var _k = state.view, widgets = _k.widgets, infiniteWidgets = _k.infiniteWidgets;
2574
+ var widget = (_a = widgets === null || widgets === void 0 ? void 0 : widgets.find(function (item) { return item.name === widgetName; })) !== null && _a !== void 0 ? _a : widgets === null || widgets === void 0 ? void 0 : widgets.find(function (item) { return item.bcName === action.payload.bcName; });
2418
2575
  if (!widget) {
2419
- return [EMPTY22];
2576
+ return [EMPTY21];
2420
2577
  }
2421
2578
  var bcName = action.payload.bcName;
2422
2579
  var bc = state.screen.bo.bc[bcName];
2423
- var cursor = bc.cursor, page = bc.page;
2424
- var limit = ((_b = widgets.find(function (i) { return i.bcName === bcName; })) === null || _b === void 0 ? void 0 : _b.limit) || bc.limit;
2580
+ var cursor = bc.cursor, _l = bc.page, page = _l === void 0 ? 1 : _l;
2581
+ var limit = (_c = (((_b = widgets === null || widgets === void 0 ? void 0 : widgets.find(function (i) { return i.bcName === bcName; })) === null || _b === void 0 ? void 0 : _b.limit) || bc.limit)) !== null && _c !== void 0 ? _c : 5;
2425
2582
  var sorters = state.screen.sorters[bcName];
2426
2583
  if (showViewPopup.match(action) && bcName === action.payload.calleeBCName) {
2427
- return [EMPTY22];
2584
+ return [EMPTY21];
2428
2585
  }
2429
- var anyHierarchyWidget = widgets.find(function (item) {
2586
+ var anyHierarchyWidget = widgets === null || widgets === void 0 ? void 0 : widgets.find(function (item) {
2430
2587
  return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && isHierarchyWidget(item);
2431
2588
  });
2432
- var fullHierarchyWidget = state.view.widgets.find(function (item) {
2589
+ var fullHierarchyWidget = (_d = state.view.widgets) === null || _d === void 0 ? void 0 : _d.find(function (item) {
2433
2590
  var _a;
2434
2591
  return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && ((_a = item.options) === null || _a === void 0 ? void 0 : _a.hierarchyFull);
2435
2592
  });
2436
- var limitBySelfCursor = (_c = state.router.bcPath) === null || _c === void 0 ? void 0 : _c.includes("".concat(bcName, "/").concat(cursor));
2437
- var bcUrl = buildBcUrl(bcName, limitBySelfCursor);
2593
+ var limitBySelfCursor = (_e = state.router.bcPath) === null || _e === void 0 ? void 0 : _e.includes("".concat(bcName, "/").concat(cursor));
2594
+ var bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
2438
2595
  var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(fullHierarchyWidget ? [] : state.screen.filters[bcName] || [])), getSorters(sorters));
2439
2596
  if (bcForceUpdate.match(action)) {
2440
- var infinityPaginationWidget = widgetName && infiniteWidgets.includes(widgetName) || ((_e = (_d = widgets === null || widgets === void 0 ? void 0 : widgets.filter(function (item) { return item.bcName === bcName; })) === null || _d === void 0 ? void 0 : _d.find(function (item) { return infiniteWidgets.includes(item.name); })) === null || _e === void 0 ? void 0 : _e.name);
2597
+ var infinityPaginationWidget = widgetName && (infiniteWidgets === null || infiniteWidgets === void 0 ? void 0 : infiniteWidgets.includes(widgetName)) || ((_g = (_f = widgets === null || widgets === void 0 ? void 0 : widgets.filter(function (item) { return item.bcName === bcName; })) === null || _f === void 0 ? void 0 : _f.find(function (item) { return infiniteWidgets === null || infiniteWidgets === void 0 ? void 0 : infiniteWidgets.includes(item.name); })) === null || _g === void 0 ? void 0 : _g.name);
2441
2598
  if (infinityPaginationWidget) {
2442
2599
  fetchParams._page = 1;
2443
2600
  fetchParams._limit = limit * page;
@@ -2447,7 +2604,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
2447
2604
  fetchParams._page = action.payload.from || 1;
2448
2605
  fetchParams._limit = (action.payload.to || page - fetchParams._page) * limit;
2449
2606
  }
2450
- if (bcFetchDataRequest.match(action) && action.payload.ignorePageLimit || ((_f = anyHierarchyWidget === null || anyHierarchyWidget === void 0 ? void 0 : anyHierarchyWidget.options) === null || _f === void 0 ? void 0 : _f.hierarchyFull)) {
2607
+ if (bcFetchDataRequest.match(action) && action.payload.ignorePageLimit || ((_h = anyHierarchyWidget === null || anyHierarchyWidget === void 0 ? void 0 : anyHierarchyWidget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull)) {
2451
2608
  fetchParams._limit = 0;
2452
2609
  }
2453
2610
  var canceler = api.createCanceler();
@@ -2459,7 +2616,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
2459
2616
  var normalFlow = api.fetchBcData(state.screen.screenName, bcUrl, fetchParams, canceler.cancelToken).pipe(mergeMap25(function (response) {
2460
2617
  var _a, _b;
2461
2618
  var cursorChange = getCursorChange(response.data, cursor, !!anyHierarchyWidget);
2462
- var parentOfNotLazyWidget = widgets.some(function (item) {
2619
+ var parentOfNotLazyWidget = widgets === null || widgets === void 0 ? void 0 : widgets.some(function (item) {
2463
2620
  var _a;
2464
2621
  return ((_a = state.screen.bo.bc[item.bcName]) === null || _a === void 0 ? void 0 : _a.parentName) === bcName && !PopupWidgetTypes.includes(item.type);
2465
2622
  });
@@ -2482,11 +2639,11 @@ var bcFetchDataEpic = function (action$, state$, _a) {
2482
2639
  var lazyWidget = (!isWidgetVisible(widget) || PopupWidgetTypes.includes(widget.type)) && !parentOfNotLazyWidget;
2483
2640
  var skipLazy = ((_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.bcName) !== widget.bcName;
2484
2641
  if (lazyWidget && skipLazy) {
2485
- return EMPTY22;
2642
+ return EMPTY21;
2486
2643
  }
2487
- var fetchChildren = ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) : EMPTY22;
2644
+ var fetchChildren = ((_b = response.data) === null || _b === void 0 ? void 0 : _b.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) : EMPTY21;
2488
2645
  var fetchRowMeta = of26(bcFetchRowMeta({ widgetName: widgetName, bcName: bcName }));
2489
- return concat15(cursorChange, of26(bcFetchDataSuccess({
2646
+ return concat17(cursorChange, of26(bcFetchDataSuccess({
2490
2647
  bcName: bcName,
2491
2648
  data: response.data,
2492
2649
  bcUrl: bcUrl,
@@ -2506,7 +2663,7 @@ function isHierarchyWidget(widget) {
2506
2663
  return ((_a = widget.options) === null || _a === void 0 ? void 0 : _a.hierarchy) || ((_b = widget.options) === null || _b === void 0 ? void 0 : _b.hierarchyFull);
2507
2664
  }
2508
2665
  // src/epics/data/bcDeleteDataEpic.ts
2509
- import { catchError as catchError11, concat as concat16, EMPTY as EMPTY23, filter as filter41, mergeMap as mergeMap26, of as of27 } from "rxjs";
2666
+ import { catchError as catchError11, concat as concat18, EMPTY as EMPTY22, filter as filter41, mergeMap as mergeMap26, of as of27 } from "rxjs";
2510
2667
  import { OperationTypeCrud as OperationTypeCrud9 } from "@cxbox-ui/schema";
2511
2668
  var bcDeleteDataEpic = function (action$, store$, _a) {
2512
2669
  var api = _a.api;
@@ -2515,12 +2672,13 @@ var bcDeleteDataEpic = function (action$, store$, _a) {
2515
2672
  var state = store$.value;
2516
2673
  var bcName = action.payload.bcName;
2517
2674
  var cursor = state.screen.bo.bc[bcName].cursor;
2518
- var bcUrl = buildBcUrl(bcName, true);
2675
+ var bcUrl = buildBcUrl(bcName, true, state);
2519
2676
  var context = { widgetName: action.payload.widgetName };
2520
2677
  var isTargetFormatPVF = state.view.pendingValidationFailsFormat === "target" /* target */;
2521
2678
  return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe(mergeMap26(function (data) {
2522
- var postInvoke = data.postActions[0];
2523
- return concat16(isTargetFormatPVF ? of27(bcCancelPendingChanges({ bcNames: [bcName] })) : EMPTY23, of27(bcFetchDataRequest({ bcName: bcName, widgetName: widgetName })), postInvoke ? of27(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: widgetName })) : EMPTY23);
2679
+ var _a;
2680
+ var postInvoke = (_a = data.postActions) === null || _a === void 0 ? void 0 : _a[0];
2681
+ return concat18(isTargetFormatPVF ? of27(bcCancelPendingChanges({ bcNames: [bcName] })) : EMPTY22, of27(bcFetchDataRequest({ bcName: bcName, widgetName: widgetName })), postInvoke ? of27(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: widgetName })) : EMPTY22);
2524
2682
  }), catchError11(function (error) {
2525
2683
  console.error(error);
2526
2684
  return of27(bcDeleteDataFail({ bcName: bcName }));
@@ -2528,7 +2686,7 @@ var bcDeleteDataEpic = function (action$, store$, _a) {
2528
2686
  }));
2529
2687
  };
2530
2688
  // src/epics/data/bcSelectRecordEpic.ts
2531
- import { concat as concat17, filter as filter42, mergeMap as mergeMap27, of as of28 } from "rxjs";
2689
+ import { concat as concat19, filter as filter42, mergeMap as mergeMap27, of as of28 } from "rxjs";
2532
2690
  var bcSelectRecordEpic = function (action$, store$) { return action$.pipe(filter42(bcSelectRecord.match), mergeMap27(function (action) {
2533
2691
  var _a;
2534
2692
  var _b = action.payload, bcName = _b.bcName, cursor = _b.cursor;
@@ -2543,17 +2701,19 @@ var bcSelectRecordEpic = function (action$, store$) { return action$.pipe(filter
2543
2701
  keepDelta: action.payload.keepDelta
2544
2702
  });
2545
2703
  });
2546
- return concat17(of28(bcChangeCursors({ cursorsMap: (_a = {}, _a[bcName] = cursor, _a), keepDelta: action.payload.keepDelta })), of28(bcFetchRowMeta({ widgetName: "", bcName: bcName })), fetchChildrenBcData);
2704
+ return concat19(of28(bcChangeCursors({ cursorsMap: (_a = {}, _a[bcName] = cursor, _a), keepDelta: action.payload.keepDelta })), of28(bcFetchRowMeta({ widgetName: "", bcName: bcName })), fetchChildrenBcData);
2547
2705
  })); };
2548
2706
  // src/epics/data/changeAssociationEpic.ts
2549
- import { concat as concat18, filter as filter43, mergeMap as mergeMap28, of as of29 } from "rxjs";
2707
+ import { concat as concat20, filter as filter43, mergeMap as mergeMap28, of as of29 } from "rxjs";
2550
2708
  var changeAssociationEpic = function (action$, state$) { return action$.pipe(filter43(changeAssociation.match), mergeMap28(function (action) {
2551
2709
  var _a, _b, _c, _d, _e;
2552
2710
  var state = state$.value;
2553
2711
  var selected = action.payload.dataItem._associate;
2712
+ var bcName = action.payload.bcName;
2554
2713
  var result = [
2555
2714
  of29(changeDataItem({
2556
- bcName: action.payload.bcName,
2715
+ bcName: bcName,
2716
+ bcUrl: buildBcUrl(bcName, true, state),
2557
2717
  cursor: action.payload.dataItem.id,
2558
2718
  dataItem: action.payload.dataItem
2559
2719
  }))
@@ -2566,19 +2726,19 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe(fil
2566
2726
  fields: widget.fields
2567
2727
  };
2568
2728
  var hierarchy = (_b = widget.options) === null || _b === void 0 ? void 0 : _b.hierarchy;
2569
- var hierarchyDescriptor = isRoot ? rootHierarchyDescriptor : hierarchy.find(function (item) { return item.bcName === action.payload.bcName; });
2729
+ var hierarchyDescriptor = isRoot ? rootHierarchyDescriptor : hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.find(function (item) { return item.bcName === action.payload.bcName; });
2570
2730
  var hierarchyGroupSelection = (_c = widget.options) === null || _c === void 0 ? void 0 : _c.hierarchyGroupSelection;
2571
2731
  var hierarchyTraverse = (_d = widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyTraverse;
2572
- var childrenBc = hierarchy.slice(hierarchy.findIndex(function (item) { return item.bcName === action.payload.bcName; }) + 1).map(function (item) { return item.bcName; });
2732
+ var childrenBc = hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.slice(hierarchy.findIndex(function (item) { return item.bcName === action.payload.bcName; }) + 1).map(function (item) { return item.bcName; });
2573
2733
  if (hierarchyGroupSelection && hierarchyDescriptor.radio && !selected) {
2574
2734
  result.push(of29(dropAllAssociations({
2575
2735
  bcNames: childrenBc
2576
2736
  })));
2577
2737
  }
2578
- var parent = isRoot ? null : hierarchy.find(function (item, index) {
2738
+ var parent = isRoot ? null : (hierarchy === null || hierarchy === void 0 ? void 0 : hierarchy.find(function (item, index) {
2579
2739
  var _a;
2580
2740
  return ((_a = hierarchy[index + 1]) === null || _a === void 0 ? void 0 : _a.bcName) === action.payload.bcName;
2581
- }) || rootHierarchyDescriptor;
2741
+ })) || rootHierarchyDescriptor;
2582
2742
  var parentItem = (_e = state.data[parent === null || parent === void 0 ? void 0 : parent.bcName]) === null || _e === void 0 ? void 0 : _e.find(function (item) { return item.id === state.screen.bo.bc[parent === null || parent === void 0 ? void 0 : parent.bcName].cursor; });
2583
2743
  if (parent && hierarchyTraverse && selected) {
2584
2744
  if (hierarchyDescriptor.radio) {
@@ -2589,7 +2749,7 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe(fil
2589
2749
  result.push(of29(changeAssociation({
2590
2750
  bcName: parent.bcName,
2591
2751
  widgetName: action.payload.widgetName,
2592
- dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem[parent.assocValueKey || action.payload.assocValueKey] }),
2752
+ dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem === null || parentItem === void 0 ? void 0 : parentItem[parent.assocValueKey || action.payload.assocValueKey] }),
2593
2753
  assocValueKey: action.payload.assocValueKey
2594
2754
  })));
2595
2755
  }
@@ -2611,10 +2771,10 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe(fil
2611
2771
  })));
2612
2772
  }
2613
2773
  }
2614
- return concat18.apply(void 0, result);
2774
+ return concat20.apply(void 0, result);
2615
2775
  })); };
2616
2776
  // src/epics/data/bcCancelCreateDataEpic.ts
2617
- import { catchError as catchError12, concat as concat19, EMPTY as EMPTY24, filter as filter44, mergeMap as mergeMap29, of as of30 } from "rxjs";
2777
+ import { catchError as catchError12, concat as concat21, EMPTY as EMPTY23, filter as filter44, mergeMap as mergeMap29, of as of30 } from "rxjs";
2618
2778
  import { OperationTypeCrud as OperationTypeCrud10 } from "@cxbox-ui/schema";
2619
2779
  import { isAnyOf as isAnyOf4 } from "@reduxjs/toolkit";
2620
2780
  var actionTypesMatcher = isAnyOf4(sendOperation);
@@ -2626,7 +2786,7 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
2626
2786
  var state = state$.value;
2627
2787
  var screenName = state.screen.screenName;
2628
2788
  var bcName = action.payload.bcName;
2629
- var bcUrl = buildBcUrl(bcName, true);
2789
+ var bcUrl = buildBcUrl(bcName, true, state);
2630
2790
  var bc = state.screen.bo.bc[bcName];
2631
2791
  var cursor = bc === null || bc === void 0 ? void 0 : bc.cursor;
2632
2792
  var context = { widgetName: action.payload.widgetName };
@@ -2636,8 +2796,9 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
2636
2796
  var params = { _action: action.payload.operationType };
2637
2797
  var cursorsMap = (_a = {}, _a[action.payload.bcName] = null, _a);
2638
2798
  return api.customAction(screenName, bcUrl, data, context, params).pipe(mergeMap29(function (response) {
2639
- var postInvoke = response.postActions[0];
2640
- return concat19(of30(sendOperationSuccess({ bcName: bcName, cursor: cursor })), of30(bcChangeCursors({ cursorsMap: cursorsMap })), postInvoke ? of30(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: context.widgetName })) : EMPTY24);
2799
+ var _a;
2800
+ var postInvoke = (_a = response.postActions) === null || _a === void 0 ? void 0 : _a[0];
2801
+ return concat21(of30(sendOperationSuccess({ bcName: bcName, cursor: cursor })), of30(bcChangeCursors({ cursorsMap: cursorsMap })), postInvoke ? of30(processPostInvoke({ bcName: bcName, postInvoke: postInvoke, cursor: cursor, widgetName: context.widgetName })) : EMPTY23);
2641
2802
  }), catchError12(function (error) {
2642
2803
  console.error(error);
2643
2804
  return of30(bcDeleteDataFail({ bcName: bcName }));
@@ -2645,10 +2806,10 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
2645
2806
  }));
2646
2807
  };
2647
2808
  // src/epics/data/bcSelectDepthRecordEpic.ts
2648
- import { concat as concat20, filter as filter45, mergeMap as mergeMap30, of as of31 } from "rxjs";
2809
+ import { concat as concat22, filter as filter45, mergeMap as mergeMap30, of as of31 } from "rxjs";
2649
2810
  var bcSelectDepthRecordEpic = function (action$) { return action$.pipe(filter45(bcSelectDepthRecord.match), mergeMap30(function (action) {
2650
2811
  var _a = action.payload, bcName = _a.bcName, cursor = _a.cursor, depth = _a.depth;
2651
- return concat20(of31(bcChangeDepthCursor({ bcName: bcName, depth: depth, cursor: cursor })), of31(bcFetchDataRequest({
2812
+ return concat22(of31(bcChangeDepthCursor({ bcName: bcName, depth: depth, cursor: cursor })), of31(bcFetchDataRequest({
2652
2813
  bcName: bcName,
2653
2814
  depth: depth + 1,
2654
2815
  widgetName: "",
@@ -2656,7 +2817,7 @@ var bcSelectDepthRecordEpic = function (action$) { return action$.pipe(filter45(
2656
2817
  })));
2657
2818
  })); };
2658
2819
  // src/epics/data/removeMultivalueTagEpic.ts
2659
- import { concat as concat21, filter as filter46, mergeMap as mergeMap31, of as of32 } from "rxjs";
2820
+ import { concat as concat23, filter as filter46, mergeMap as mergeMap31, of as of32 } from "rxjs";
2660
2821
  var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(filter46(removeMultivalueTag.match), mergeMap31(function (action) {
2661
2822
  var _a, _b, _c;
2662
2823
  var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
@@ -2672,28 +2833,28 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(f
2672
2833
  var removedItem = data.find(function (item) { return item.id === action.payload.removedItem.id; });
2673
2834
  var associated = action.payload.dataItem.map(function (item) { return item.id; });
2674
2835
  var removedNodes = [];
2675
- if ((_d = widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyGroupDeselection) {
2676
- if ((_e = widget.options) === null || _e === void 0 ? void 0 : _e.hierarchyTraverse) {
2836
+ if ((_d = widget === null || widget === void 0 ? void 0 : widget.options) === null || _d === void 0 ? void 0 : _d.hierarchyGroupDeselection) {
2837
+ if ((_e = widget === null || widget === void 0 ? void 0 : widget.options) === null || _e === void 0 ? void 0 : _e.hierarchyTraverse) {
2677
2838
  data = assignTreeLinks(data);
2678
2839
  }
2679
- var removedItemChildren = data.filter(function (item) { return item.parentId === removedItem.id; });
2680
- removedNodes = __spreadArray([removedItem.id], removedItemChildren.filter(function (item) { return associated.includes(item.id); }).map(function (item) { return item.id; }), true);
2681
- if ((_f = widget.options) === null || _f === void 0 ? void 0 : _f.hierarchyTraverse) {
2840
+ var removedItemChildren = data.filter(function (item) { return item.parentId === (removedItem === null || removedItem === void 0 ? void 0 : removedItem.id); });
2841
+ removedNodes = __spreadArray([removedItem === null || removedItem === void 0 ? void 0 : removedItem.id], removedItemChildren.filter(function (item) { return associated.includes(item.id); }).map(function (item) { return item.id; }), true);
2842
+ if ((_f = widget === null || widget === void 0 ? void 0 : widget.options) === null || _f === void 0 ? void 0 : _f.hierarchyTraverse) {
2682
2843
  getDescendants(removedItemChildren, removedNodes);
2683
2844
  removedNodes = data.filter(function (item) { return removedNodes.includes(item.id) && associated.includes(item.id); }).map(function (item) { return item.id; });
2684
2845
  }
2685
- var parent_1 = data.find(function (item) { return item.id === removedItem.parentId; });
2846
+ var parent_1 = data.find(function (item) { return item.id === (removedItem === null || removedItem === void 0 ? void 0 : removedItem.parentId); });
2686
2847
  var siblings = data.filter(function (item) { return item.parentId === (parent_1 === null || parent_1 === void 0 ? void 0 : parent_1.id); });
2687
2848
  var parentEmpty = siblings.every(function (child) { return removedNodes.includes(child.id) || !associated.includes(child.id); });
2688
2849
  if (parent_1 && parentEmpty) {
2689
- if ((_g = widget.options) === null || _g === void 0 ? void 0 : _g.hierarchyTraverse) {
2850
+ if ((_g = widget === null || widget === void 0 ? void 0 : widget.options) === null || _g === void 0 ? void 0 : _g.hierarchyTraverse) {
2690
2851
  var parentDescendants = [];
2691
2852
  getDescendants(siblings, parentDescendants);
2692
2853
  var parentDeepEmpty = parentDescendants.every(function (descendant) {
2693
2854
  return removedNodes.includes(descendant) || !associated.includes(descendant);
2694
2855
  });
2695
2856
  if (parentDeepEmpty) {
2696
- return concat21(of32(removeMultivalueTag(__assign(__assign({}, action.payload), { removedItem: { id: parent_1.id, value: null } }))));
2857
+ return concat23(of32(removeMultivalueTag(__assign(__assign({}, action.payload), { removedItem: { id: parent_1.id, value: null } }))));
2697
2858
  }
2698
2859
  }
2699
2860
  else {
@@ -2701,39 +2862,45 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(f
2701
2862
  }
2702
2863
  }
2703
2864
  }
2704
- if ((_h = widget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull) {
2865
+ if ((_h = widget === null || widget === void 0 ? void 0 : widget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull) {
2705
2866
  return of32(changeDataItem({
2706
2867
  bcName: bcName,
2868
+ bcUrl: buildBcUrl(bcName, true, state),
2707
2869
  cursor: cursor,
2708
2870
  dataItem: (_a = {}, _a[associateFieldKey] = action.payload.dataItem.filter(function (item) { return !removedNodes.includes(item.id); }), _a)
2709
2871
  }));
2710
2872
  }
2711
- if ((_j = widget.options) === null || _j === void 0 ? void 0 : _j.hierarchy) {
2712
- return concat21(of32(changeDataItem({
2873
+ if ((_j = widget === null || widget === void 0 ? void 0 : widget.options) === null || _j === void 0 ? void 0 : _j.hierarchy) {
2874
+ var hierarchyBcName = (_o = (_m = (_l = (_k = widget === null || widget === void 0 ? void 0 : widget.options) === null || _k === void 0 ? void 0 : _k.hierarchy) === null || _l === void 0 ? void 0 : _l.find(function (hierarchyData) {
2875
+ var _a;
2876
+ return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
2877
+ })) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName;
2878
+ return concat23(of32(changeDataItem({
2713
2879
  /**
2714
2880
  * This is incorrect and will break if different BC has records with
2715
2881
  * identical ids.
2716
2882
  *
2717
2883
  * TODO: Record `level` should be mapped to hierarchyData index instead
2718
2884
  */
2719
- bcName: (_o = (_m = (_l = (_k = widget.options) === null || _k === void 0 ? void 0 : _k.hierarchy) === null || _l === void 0 ? void 0 : _l.find(function (hierarchyData) {
2720
- var _a;
2721
- return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
2722
- })) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName,
2885
+ bcName: hierarchyBcName,
2886
+ bcUrl: buildBcUrl(hierarchyBcName, true, state),
2723
2887
  cursor: action.payload.removedItem.id,
2724
2888
  dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
2725
2889
  })), of32(changeDataItem({
2726
2890
  bcName: bcName,
2891
+ bcUrl: buildBcUrl(bcName, true, state),
2727
2892
  cursor: cursor,
2728
2893
  dataItem: (_b = {}, _b[associateFieldKey] = action.payload.dataItem, _b)
2729
2894
  })));
2730
2895
  }
2731
- return concat21(of32(changeDataItem({
2896
+ return concat23(of32(changeDataItem({
2732
2897
  bcName: popupBcName,
2898
+ bcUrl: buildBcUrl(popupBcName, true, state),
2733
2899
  cursor: action.payload.removedItem.id,
2734
2900
  dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
2735
2901
  })), of32(changeDataItem({
2736
2902
  bcName: bcName,
2903
+ bcUrl: buildBcUrl(bcName, true, state),
2737
2904
  cursor: cursor,
2738
2905
  dataItem: (_c = {}, _c[associateFieldKey] = action.payload.dataItem, _c)
2739
2906
  })));
@@ -2743,11 +2910,12 @@ import { catchError as catchError13, filter as filter47, map as map9, mergeMap a
2743
2910
  var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
2744
2911
  var api = _a.api;
2745
2912
  return action$.pipe(filter47(bcFetchRowMeta.match), mergeMap32(function (action) {
2913
+ var _a, _b;
2746
2914
  var state = state$.value;
2747
2915
  var screenName = state.screen.screenName;
2748
2916
  var bcName = action.payload.bcName;
2749
- var cursor = state.screen.bo.bc[bcName].cursor;
2750
- var bcUrl = buildBcUrl(bcName, true);
2917
+ var cursor = (_a = state.screen.bo.bc[bcName].cursor) !== null && _a !== void 0 ? _a : "";
2918
+ var bcUrl = (_b = buildBcUrl(bcName, true, state)) !== null && _b !== void 0 ? _b : "";
2751
2919
  var canceler = api.createCanceler();
2752
2920
  var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }));
2753
2921
  var cancelByParentBc = cancelRequestEpic(action$, [bcSelectRecord], canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }), function (filteredAction) {
@@ -2764,7 +2932,7 @@ var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
2764
2932
  }));
2765
2933
  };
2766
2934
  // src/epics/data/changeAssociationFullEpic.ts
2767
- import { concat as concat22, filter as filter48, mergeMap as mergeMap33, of as of34 } from "rxjs";
2935
+ import { concat as concat24, filter as filter48, mergeMap as mergeMap33, of as of34 } from "rxjs";
2768
2936
  var changeAssociationFullEpic = function (action$, state$) { return action$.pipe(filter48(changeAssociationFull.match), mergeMap33(function (action) {
2769
2937
  var _a, _b, _c, _d, _e;
2770
2938
  var state = state$.value;
@@ -2815,6 +2983,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
2815
2983
  }
2816
2984
  result.push(of34(changeDataItem({
2817
2985
  bcName: action.payload.bcName,
2986
+ bcUrl: buildBcUrl(action.payload.bcName, true, state),
2818
2987
  cursor: action.payload.dataItem.id,
2819
2988
  dataItem: action.payload.dataItem
2820
2989
  })));
@@ -2823,7 +2992,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
2823
2992
  bcName: bcName,
2824
2993
  depth: parentDepth,
2825
2994
  widgetName: action.payload.widgetName,
2826
- dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem[assocValueKey] }),
2995
+ dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem === null || parentItem === void 0 ? void 0 : parentItem[assocValueKey] }),
2827
2996
  assocValueKey: assocValueKey
2828
2997
  })));
2829
2998
  }
@@ -2844,59 +3013,62 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
2844
3013
  })));
2845
3014
  }
2846
3015
  }
2847
- return concat22.apply(void 0, result);
3016
+ return concat24.apply(void 0, result);
2848
3017
  })); };
2849
3018
  // src/epics/data/saveAssociationsActiveEpic.ts
2850
- import { catchError as catchError14, concat as concat23, EMPTY as EMPTY25, filter as filter49, mergeMap as mergeMap34, of as of35, switchMap as switchMap12 } from "rxjs";
3019
+ import { catchError as catchError14, concat as concat25, EMPTY as EMPTY24, filter as filter49, mergeMap as mergeMap34, of as of35, switchMap as switchMap12 } from "rxjs";
2851
3020
  var saveAssociationsActiveEpic = function (action$, state$, _a) {
2852
3021
  var api = _a.api;
2853
3022
  return action$.pipe(filter49(saveAssociations.match), filter49(function (action) {
2854
- return state$.value.view.popupData.active;
3023
+ var _a;
3024
+ return (_a = state$.value.view.popupData) === null || _a === void 0 ? void 0 : _a.active;
2855
3025
  }), switchMap12(function (action) {
3026
+ var _a, _b;
2856
3027
  var state = state$.value;
2857
- var calleeBCName = state.view.popupData.calleeBCName;
2858
- var calleeWidgetName = state.view.popupData.calleeWidgetName;
3028
+ var calleeBCName = (_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.calleeBCName;
3029
+ var calleeWidgetName = (_b = state.view.popupData) === null || _b === void 0 ? void 0 : _b.calleeWidgetName;
2859
3030
  var bcNames = action.payload.bcNames;
2860
- var bcUrl = buildBcUrl(calleeBCName, true);
3031
+ var bcUrl = buildBcUrl(calleeBCName, true, state);
2861
3032
  var pendingChanges = state.view.pendingDataChanges[bcNames[0]] || {};
2862
3033
  var params = bcNames.length ? { _bcName: bcNames[bcNames.length - 1] } : {};
2863
3034
  return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter(function (i) { return i._associate; }), params).pipe(mergeMap34(function (response) {
2864
3035
  var postInvoke = response.postActions[0];
2865
3036
  var calleeWidget = state.view.widgets.find(function (widgetItem) { return widgetItem.bcName === calleeBCName; });
2866
- return concat23(postInvoke ? of35(processPostInvoke({ bcName: calleeBCName, postInvoke: postInvoke, widgetName: calleeWidget.name })) : EMPTY25, of35(bcCancelPendingChanges({ bcNames: bcNames })), of35(bcForceUpdate({ bcName: calleeBCName, widgetName: calleeWidgetName })));
3037
+ return concat25(postInvoke ? of35(processPostInvoke({ bcName: calleeBCName, postInvoke: postInvoke, widgetName: calleeWidget === null || calleeWidget === void 0 ? void 0 : calleeWidget.name })) : EMPTY24, of35(bcCancelPendingChanges({ bcNames: bcNames })), of35(bcForceUpdate({ bcName: calleeBCName, widgetName: calleeWidgetName })));
2867
3038
  }), catchError14(function (err) {
2868
3039
  console.error(err);
2869
- return EMPTY25;
3040
+ return EMPTY24;
2870
3041
  }));
2871
3042
  }));
2872
3043
  };
2873
3044
  // src/epics/data/changeAssociationSameBcEpic.ts
2874
- import { concat as concat24, filter as filter50, mergeMap as mergeMap35, of as of36 } from "rxjs";
3045
+ import { concat as concat26, filter as filter50, mergeMap as mergeMap35, of as of36 } from "rxjs";
2875
3046
  var changeAssociationSameBcEpic = function (action$, state$) { return action$.pipe(filter50(changeAssociationSameBc.match), mergeMap35(function (action) {
2876
- var _a, _b, _c, _d, _e;
3047
+ var _a, _b, _c, _d, _e, _f;
3048
+ var state = state$.value;
2877
3049
  var bcName = action.payload.bcName;
2878
3050
  var result = [
2879
3051
  of36(changeDataItem({
2880
3052
  bcName: bcName,
3053
+ bcUrl: buildBcUrl(bcName, true, state),
2881
3054
  cursor: action.payload.dataItem.id,
2882
3055
  dataItem: action.payload.dataItem
2883
3056
  }))
2884
3057
  ];
2885
- var state = state$.value;
2886
3058
  var selected = action.payload.dataItem._associate;
2887
3059
  var depth = action.payload.depth || 1;
2888
3060
  var parentDepth = depth - 1;
2889
3061
  var widget = state.view.widgets.find(function (item) { return item.name === action.payload.widgetName; });
2890
3062
  var hierarchyTraverse = (_a = widget.options) === null || _a === void 0 ? void 0 : _a.hierarchyTraverse;
2891
3063
  var currentData = depth > 1 ? (_b = state.depthData[depth]) === null || _b === void 0 ? void 0 : _b[bcName] : state.data[bcName];
2892
- var parentCursor = parentDepth ? parentDepth > 1 ? (_c = state.screen.bo.bc[bcName].depthBc[parentDepth]) === null || _c === void 0 ? void 0 : _c.cursor : state.screen.bo.bc[bcName].cursor : null;
2893
- var parentItem = parentCursor ? parentDepth > 1 ? (_e = (_d = state.depthData[parentDepth]) === null || _d === void 0 ? void 0 : _d[bcName]) === null || _e === void 0 ? void 0 : _e.find(function (item) { return item.id === parentCursor; }) : state.data[bcName].find(function (item) { return item.id === parentCursor; }) : null;
3064
+ var parentCursor = parentDepth ? parentDepth > 1 ? (_d = (_c = state.screen.bo.bc[bcName].depthBc) === null || _c === void 0 ? void 0 : _c[parentDepth]) === null || _d === void 0 ? void 0 : _d.cursor : state.screen.bo.bc[bcName].cursor : null;
3065
+ var parentItem = parentCursor ? parentDepth > 1 ? (_f = (_e = state.depthData[parentDepth]) === null || _e === void 0 ? void 0 : _e[bcName]) === null || _f === void 0 ? void 0 : _f.find(function (item) { return item.id === parentCursor; }) : state.data[bcName].find(function (item) { return item.id === parentCursor; }) : null;
2894
3066
  if (parentDepth && hierarchyTraverse && selected) {
2895
3067
  result.push(of36(changeAssociationSameBc({
2896
3068
  bcName: bcName,
2897
3069
  depth: parentDepth,
2898
3070
  widgetName: action.payload.widgetName,
2899
- dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem[action.payload.assocValueKey] }),
3071
+ dataItem: __assign(__assign({}, parentItem), { _associate: true, _value: parentItem === null || parentItem === void 0 ? void 0 : parentItem[action.payload.assocValueKey] }),
2900
3072
  assocValueKey: action.payload.assocValueKey
2901
3073
  })));
2902
3074
  }
@@ -2912,7 +3084,7 @@ var changeAssociationSameBcEpic = function (action$, state$) { return action$.pi
2912
3084
  })));
2913
3085
  }
2914
3086
  }
2915
- return concat24.apply(void 0, result);
3087
+ return concat26.apply(void 0, result);
2916
3088
  })); };
2917
3089
  // src/epics/data/inlinePickListFetchDataEpic.ts
2918
3090
  import { catchError as catchError15, filter as filter51, mergeMap as mergeMap36, of as of37, race as race4 } from "rxjs";
@@ -2921,7 +3093,8 @@ var inlinePickListFetchDataEpic = function (action$, state$, _a) {
2921
3093
  return action$.pipe(filter51(inlinePickListFetchDataRequest.match), mergeMap36(function (action) {
2922
3094
  var _a;
2923
3095
  var _b = action.payload, bcName = _b.bcName, searchSpec = _b.searchSpec, searchString = _b.searchString;
2924
- var bcUrl = buildBcUrl(bcName, false);
3096
+ var state = state$.value;
3097
+ var bcUrl = buildBcUrl(bcName, false, state);
2925
3098
  var canceler = api.createCanceler();
2926
3099
  var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName: bcName, bcUrl: bcUrl }));
2927
3100
  var normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, (_a = {}, _a[searchSpec + ".contains"] = searchString, _a), canceler.cancelToken).pipe(mergeMap36(function (data) {
@@ -2936,14 +3109,15 @@ var inlinePickListFetchDataEpic = function (action$, state$, _a) {
2936
3109
  // src/epics/data/saveAssociationsPassiveEpic.ts
2937
3110
  import { filter as filter52, of as of38, switchMap as switchMap13 } from "rxjs";
2938
3111
  var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pipe(filter52(saveAssociations.match), filter52(function () {
2939
- return !state$.value.view.popupData.active;
3112
+ var _a;
3113
+ return !((_a = state$.value.view.popupData) === null || _a === void 0 ? void 0 : _a.active);
2940
3114
  }), switchMap13(function (action) {
2941
3115
  var _a, _b;
2942
- var _c;
3116
+ var _c, _d;
2943
3117
  var state = state$.value;
2944
- var _d = state.view.popupData, _e = _d.calleeBCName, calleeBCName = _e === void 0 ? action.payload.calleeBcName : _e, _f = _d.associateFieldKey, associateFieldKey = _f === void 0 ? action.payload.associateFieldKey : _f;
3118
+ var _e = (_c = state.view.popupData) !== null && _c !== void 0 ? _c : {}, _f = _e.calleeBCName, calleeBCName = _f === void 0 ? action.payload.calleeBcName : _f, _g = _e.associateFieldKey, associateFieldKey = _g === void 0 ? action.payload.associateFieldKey : _g;
2945
3119
  var cursor = state.screen.bo.bc[calleeBCName].cursor;
2946
- var recordPrevData = (_c = state.data[calleeBCName].find(function (dataStateRecord) { return dataStateRecord.id === cursor; })[associateFieldKey]) !== null && _c !== void 0 ? _c : [];
3120
+ var recordPrevData = (_d = state.data[calleeBCName].find(function (dataStateRecord) { return dataStateRecord.id === cursor; })[associateFieldKey]) !== null && _d !== void 0 ? _d : [];
2947
3121
  var newValues = [];
2948
3122
  action.payload.bcNames.forEach(function (pendingBc) {
2949
3123
  var pendingChanges = state.view.pendingDataChanges[pendingBc] || {};
@@ -2969,6 +3143,7 @@ var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pi
2969
3143
  })).concat.apply(_a, addedItems);
2970
3144
  return of38(changeDataItem({
2971
3145
  bcName: calleeBCName,
3146
+ bcUrl: buildBcUrl(calleeBCName, true, state),
2972
3147
  cursor: cursor,
2973
3148
  dataItem: (_b = {},
2974
3149
  _b[associateFieldKey] = result,
@@ -3002,7 +3177,7 @@ var changeChildrenAssociationsSameBcEpic = function (action$, state$) { return a
3002
3177
  }));
3003
3178
  })); };
3004
3179
  // src/epics/data/changeDescendantsAssociationsFullEpic.ts
3005
- import { concat as concat25, filter as filter55, mergeMap as mergeMap39, of as of41 } from "rxjs";
3180
+ import { concat as concat27, filter as filter55, mergeMap as mergeMap39, of as of41 } from "rxjs";
3006
3181
  var changeDescendantsAssociationsFullEpic = function (action$, state$) { return action$.pipe(filter55(changeDescendantsAssociationsFull.match), mergeMap39(function (action) {
3007
3182
  var state = state$.value;
3008
3183
  var depth = action.payload.depth;
@@ -3020,7 +3195,7 @@ var changeDescendantsAssociationsFullEpic = function (action$, state$) { return
3020
3195
  result.push(of41(changeDescendantsAssociationsFull(__assign(__assign({}, action.payload), { parentId: targetDataItem.id, depth: depth + 1 }))));
3021
3196
  }
3022
3197
  });
3023
- return concat25.apply(void 0, result);
3198
+ return concat27.apply(void 0, result);
3024
3199
  })); };
3025
3200
  // src/api/ObservableApiWrapper.ts
3026
3201
  import axios2 from "axios";
@@ -3049,7 +3224,6 @@ var ObservableApiWrapper = /** @class */ (function () {
3049
3224
  this.instance = instance;
3050
3225
  }
3051
3226
  class_2.prototype.get = function (path, config, callContext) {
3052
- if (config === void 0) { config = {}; }
3053
3227
  return from(this.instance.get(path, config)).pipe(takeWhile(redirectOccurred), map10(function (response) { return response.data; }));
3054
3228
  };
3055
3229
  class_2.prototype.put = function (path, data, callContext) {
@@ -3065,10 +3239,9 @@ var ObservableApiWrapper = /** @class */ (function () {
3065
3239
  }());
3066
3240
  // src/api/ObservableApi.ts
3067
3241
  import axios3 from "axios";
3068
- import { EMPTY as EMPTY26, expand, map as map11, reduce } from "rxjs";
3242
+ import { EMPTY as EMPTY25, expand, map as map11, reduce } from "rxjs";
3069
3243
  var Api = /** @class */ (function () {
3070
3244
  function class_3(instance) {
3071
- this.api$ = new ObservableApiWrapper();
3072
3245
  this.api$ = new ObservableApiWrapper(instance);
3073
3246
  }
3074
3247
  class_3.prototype.routerRequest = function (path, params) {
@@ -3086,7 +3259,7 @@ var Api = /** @class */ (function () {
3086
3259
  if (params === void 0) { params = {}; }
3087
3260
  var currentPage = 1;
3088
3261
  return this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: currentPage })).pipe(expand(function (response) {
3089
- return response.hasNext ? _this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: ++currentPage })) : EMPTY26;
3262
+ return response.hasNext ? _this.fetchBcData(screenName, bcUrl, __assign(__assign({}, params), { _page: ++currentPage })) : EMPTY25;
3090
3263
  }), reduce(function (items, nextResponse) {
3091
3264
  return __spreadArray(__spreadArray([], items, true), nextResponse.data, true);
3092
3265
  }, []));
@@ -3097,19 +3270,20 @@ var Api = /** @class */ (function () {
3097
3270
  };
3098
3271
  class_3.prototype.newBcData = function (screenName, bcUrl, context, params) {
3099
3272
  var url = applyParams(buildUrl(templateObject_3 || (templateObject_3 = __makeTemplateObject(["row-meta-new/", "/"], ["row-meta-new/", "/"])), screenName) + bcUrl, params);
3100
- return this.api$.get(url, null, context).pipe(map11(function (response) { return response.data; }));
3273
+ return this.api$.get(url, void 0, context).pipe(map11(function (response) { return response.data; }));
3101
3274
  };
3102
3275
  class_3.prototype.saveBcData = function (screenName, bcUrl, data, context, params) {
3103
3276
  var url = applyParams(buildUrl(templateObject_4 || (templateObject_4 = __makeTemplateObject(["data/", "/"], ["data/", "/"])), screenName) + bcUrl, params);
3104
3277
  return this.api$.put(url, { data: data }, context).pipe(map11(function (response) { return response.data; }));
3105
3278
  };
3106
3279
  class_3.prototype.deleteBcData = function (screenName, bcUrl, context, params) {
3280
+ if (bcUrl === void 0) { bcUrl = ""; }
3107
3281
  var url = applyParams(buildUrl(templateObject_5 || (templateObject_5 = __makeTemplateObject(["data/", "/"], ["data/", "/"])), screenName) + bcUrl, params);
3108
3282
  return this.api$.delete(url, context).pipe(map11(function (response) { return response.data; }));
3109
3283
  };
3110
3284
  class_3.prototype.customAction = function (screenName, bcUrl, data, context, params) {
3111
3285
  var url = applyParams(buildUrl(templateObject_6 || (templateObject_6 = __makeTemplateObject(["custom-action/", "/"], ["custom-action/", "/"])), screenName) + bcUrl, params);
3112
- return this.api$.post(url, { data: data || {} }, null, context).pipe(map11(function (response) { return response.data; }));
3286
+ return this.api$.post(url, { data: data || {} }, void 0, context).pipe(map11(function (response) { return response.data; }));
3113
3287
  };
3114
3288
  class_3.prototype.associate = function (screenName, bcUrl, data, params) {
3115
3289
  var processedData = Array.isArray(data) ? data.map(function (item) { return ({
@@ -3121,9 +3295,27 @@ var Api = /** @class */ (function () {
3121
3295
  return this.api$.post(url, processedData).pipe(map11(function (response) { return response.data; }));
3122
3296
  };
3123
3297
  class_3.prototype.getRmByForceActive = function (screenName, bcUrl, data, params) {
3124
- var url = applyParams(buildUrl(templateObject_8 || (templateObject_8 = __makeTemplateObject(["row-meta/", "/"], ["row-meta/", "/"])), screenName) + bcUrl, params);
3298
+ var url = applyParams(buildUrl(templateObject_8 || (templateObject_8 = __makeTemplateObject(["row-meta/", "/"], ["row-meta/", "/"])), screenName) + (bcUrl !== null && bcUrl !== void 0 ? bcUrl : ""), params);
3125
3299
  return this.api$.post(url, { data: data }).pipe(map11(function (response) { return response.data.row; }));
3126
3300
  };
3301
+ Object.defineProperty(class_3.prototype, "fileUploadEndpoint", {
3302
+ /**
3303
+ * Get Cxbox API file upload endpoint based on baseURL of axios instance
3304
+ *
3305
+ * Handles empty baseURL and trailing slash
3306
+ *
3307
+ * @returns File upload endpoint
3308
+ */
3309
+ get: function () {
3310
+ var instance = this.api$.instance;
3311
+ if (!instance.defaults.baseURL) {
3312
+ return "/file";
3313
+ }
3314
+ return instance.defaults.baseURL.endsWith("/") ? "".concat(instance.defaults.baseURL, "file") : "".concat(instance.defaults.baseURL, "/file");
3315
+ },
3316
+ enumerable: false,
3317
+ configurable: true
3318
+ });
3127
3319
  class_3.prototype.refreshMeta = function () {
3128
3320
  return this.api$.get(buildUrl(templateObject_9 || (templateObject_9 = __makeTemplateObject(["bc-registry/refresh-meta"], ["bc-registry/refresh-meta"]))));
3129
3321
  };