@cxbox-ui/core 1.37.2-alpha.5 → 1.37.2-alpha.7

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.
@@ -165,7 +165,7 @@ var bcFetchRowMetaSuccess = createAction("bcFetchRowMetaSuccess");
165
165
  var bcFetchRowMetaFail = createAction("bcFetchRowMetaFail");
166
166
  var bcNewData = createAction("bcNewData");
167
167
  var bcNewDataSuccess = createAction("bcNewDataSuccess");
168
- var bcNewDataFail = createAction("bcNewDataSuccess");
168
+ var bcNewDataFail = createAction("bcNewDataFail");
169
169
  var bcDeleteDataFail = createAction("bcDeleteDataFail");
170
170
  var forceActiveChangeFail = createAction("forceActiveChangeFail");
171
171
  var sendOperation = createAction("sendOperation");
@@ -552,10 +552,9 @@ function getTemplate(literals) {
552
552
  result += literals[literals.length - 1];
553
553
  return result;
554
554
  }
555
- function buildBcUrl(bcName, includeSelf, store) {
555
+ function buildBcUrl(bcName, includeSelf, state) {
556
556
  if (includeSelf === void 0) { includeSelf = false; }
557
- var storeInstance = store;
558
- var bcMap = storeInstance.screen.bo.bc;
557
+ var bcMap = state.screen.bo.bc;
559
558
  var bc = bcMap[bcName];
560
559
  if (!bc) {
561
560
  return null;
@@ -737,7 +736,7 @@ function getSorters(sorters) {
737
736
  }
738
737
  function parseFilters(defaultFilters) {
739
738
  var result = [];
740
- var urlParams = new URL(defaultFilters).searchParams;
739
+ var urlParams = new URL(defaultFilters, window.location.origin).searchParams;
741
740
  urlParams.forEach(function (param) {
742
741
  var _a = param.split("."), fieldName = _a[0], type = _a[1];
743
742
  if (fieldName && type && urlParams.get(param)) {
@@ -767,7 +766,7 @@ function parseSorters(sorters) {
767
766
  return null;
768
767
  }
769
768
  var result = [];
770
- var dictionary = new URL(sorters).searchParams;
769
+ var dictionary = new URL(sorters, window.location.origin).searchParams;
771
770
  Object.entries(dictionary).map(function (_a) {
772
771
  var sort = _a[0], fieldKey = _a[1];
773
772
  var _b = sort.split(".").slice(1), order = _b[0], direction = _b[1];
@@ -1208,7 +1207,9 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1208
1207
  state.metaInProgress[action.payload.bcName] = true;
1209
1208
  }
1210
1209
  }).addCase(bcFetchRowMetaSuccess, function (state, action) {
1211
- state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
1210
+ if (state.rowMeta[action.payload.bcName]) {
1211
+ state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
1212
+ }
1212
1213
  state.metaInProgress[action.payload.bcName] = false;
1213
1214
  }).addCase(bcNewDataSuccess, function (state, action) {
1214
1215
  state.selectedCell = initialViewState.selectedCell;
@@ -1246,7 +1247,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1246
1247
  var prevCursor = prevBc[action.payload.cursor] || {};
1247
1248
  var prevPending = prevCursor || {};
1248
1249
  var nextPending = __assign(__assign({}, prevPending), action.payload.dataItem);
1249
- var bcUrl = buildBcUrl(actionBcName, true);
1250
+ var bcUrl = action.payload.bcUrl;
1250
1251
  var rowMeta = (_a = state.rowMeta[actionBcName]) === null || _a === void 0 ? void 0 : _a[bcUrl];
1251
1252
  var nextValidationFails = {};
1252
1253
  var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
@@ -1520,7 +1521,7 @@ var sendOperationEpic = function (action$, state$, _a) {
1520
1521
  var screenName = state.screen.screenName;
1521
1522
  var _l = action.payload, bcName = _l.bcName, operationType = _l.operationType, widgetName = _l.widgetName;
1522
1523
  var confirm = ((_a = action.payload.confirmOperation) === null || _a === void 0 ? void 0 : _a.type) || action.payload.confirm;
1523
- var bcUrl = buildBcUrl(bcName, true);
1524
+ var bcUrl = buildBcUrl(bcName, true, state);
1524
1525
  var bc = state.screen.bo.bc[bcName];
1525
1526
  var rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) === null || _b === void 0 ? void 0 : _b[bcUrl]);
1526
1527
  var fields = rowMeta === null || rowMeta === void 0 ? void 0 : rowMeta.fields;
@@ -1616,7 +1617,7 @@ var fileUploadConfirmEpic = function (action$, state$, _a) {
1616
1617
  var _a;
1617
1618
  var state = state$.value;
1618
1619
  var bcName = state.view.popupData.bcName;
1619
- var bcUrl = buildBcUrl(bcName, true);
1620
+ var bcUrl = buildBcUrl(bcName, true, state);
1620
1621
  var widgetName = (_a = state.view.widgets.find(function (item) { return item.bcName === bcName; })) === null || _a === void 0 ? void 0 : _a.name;
1621
1622
  var data = {
1622
1623
  bulkIds: action.payload.fileIds
@@ -1687,7 +1688,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
1687
1688
  return EMPTY3;
1688
1689
  }
1689
1690
  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);
1691
+ var bcUrl = buildBcUrl(bcName, true, state);
1691
1692
  var pendingChanges = state.view.pendingDataChanges[bcName][cursor];
1692
1693
  var handledForceActive = ((_a = state.view.handledForceActive[bcName]) === null || _a === void 0 ? void 0 : _a[cursor]) || {};
1693
1694
  var currentRecordData = (_b = state.data[bcName]) === null || _b === void 0 ? void 0 : _b.find(function (record) { return record.id === cursor; });
@@ -1731,6 +1732,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
1731
1732
  }
1732
1733
  return concat5(of7(removePendingRequest({ requestId: requestId })), state.view.url === initUrl ? concat5(of7(changeDataItem({
1733
1734
  bcName: bcName,
1735
+ bcUrl: buildBcUrl(bcName, true, state),
1734
1736
  cursor: cursor,
1735
1737
  dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData[changedFiledKey], _a),
1736
1738
  disableRetry: true
@@ -1834,7 +1836,7 @@ var userDrillDownEpic = function (action$, state$, _a) {
1834
1836
  return action$.pipe(filter15(userDrillDown.match), switchMap6(function (action) {
1835
1837
  var state = state$.value;
1836
1838
  var _a = action.payload, bcName = _a.bcName, fieldKey = _a.fieldKey, cursor = _a.cursor;
1837
- var bcUrl = buildBcUrl(bcName, true);
1839
+ var bcUrl = buildBcUrl(bcName, true, state);
1838
1840
  return api.fetchRowMeta(state.screen.screenName, bcUrl).pipe(mergeMap10(function (rowMeta) {
1839
1841
  var _a, _b, _c, _d;
1840
1842
  var drillDownField = rowMeta.fields.find(function (field) { return field.key === fieldKey; });
@@ -2191,7 +2193,7 @@ var bcNewDataEpic = function (action$, state$, _a) {
2191
2193
  return action$.pipe(filter35(sendOperation.match), filter35(function (action) { return matchOperationRole(OperationTypeCrud8.create, action.payload, state$.value); }), mergeMap20(function (action) {
2192
2194
  var state = state$.value;
2193
2195
  var bcName = action.payload.bcName;
2194
- var bcUrl = buildBcUrl(bcName);
2196
+ var bcUrl = buildBcUrl(bcName, false, state);
2195
2197
  var context = { widgetName: action.payload.widgetName };
2196
2198
  var params = { _action: action.payload.operationType };
2197
2199
  return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe(mergeMap20(function (data) {
@@ -2203,7 +2205,8 @@ var bcNewDataEpic = function (action$, state$, _a) {
2203
2205
  var postInvoke = data.postActions[0];
2204
2206
  var cursor = dataItem.id;
2205
2207
  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,
2208
+ bcName: bcName,
2209
+ bcUrl: buildBcUrl(bcName, true, state),
2207
2210
  cursor: cursor,
2208
2211
  dataItem: {
2209
2212
  id: cursor
@@ -2241,7 +2244,7 @@ var bcLoadMoreEpic = function (action$, state$, _a) {
2241
2244
  var cursor = bc.cursor, page = bc.page;
2242
2245
  var limit = ((_a = state.view.widgets.find(function (i) { return i.bcName === bcName; })) === null || _a === void 0 ? void 0 : _a.limit) || bc.limit;
2243
2246
  var limitBySelfCursor = (_b = state.router.bcPath) === null || _b === void 0 ? void 0 : _b.includes("".concat(bcName, "/").concat(cursor));
2244
- var bcUrl = buildBcUrl(bcName, limitBySelfCursor);
2247
+ var bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
2245
2248
  var filters = state.screen.filters[bcName] || [];
2246
2249
  var sorters = state.screen.sorters[bcName];
2247
2250
  var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(filters)), getSorters(sorters));
@@ -2272,7 +2275,7 @@ var bcSaveDataEpic = function (action$, state$, _a) {
2272
2275
  var _a, _b, _c;
2273
2276
  var state = state$.value;
2274
2277
  var bcName = action.payload.bcName;
2275
- var bcUrl = buildBcUrl(bcName, true);
2278
+ var bcUrl = buildBcUrl(bcName, true, state);
2276
2279
  var widgetName = action.payload.widgetName;
2277
2280
  var cursor = state.screen.bo.bc[bcName].cursor;
2278
2281
  var dataItem = state.data[bcName].find(function (item) { return item.id === cursor; });
@@ -2434,7 +2437,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
2434
2437
  return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && ((_a = item.options) === null || _a === void 0 ? void 0 : _a.hierarchyFull);
2435
2438
  });
2436
2439
  var limitBySelfCursor = (_c = state.router.bcPath) === null || _c === void 0 ? void 0 : _c.includes("".concat(bcName, "/").concat(cursor));
2437
- var bcUrl = buildBcUrl(bcName, limitBySelfCursor);
2440
+ var bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
2438
2441
  var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(fullHierarchyWidget ? [] : state.screen.filters[bcName] || [])), getSorters(sorters));
2439
2442
  if (bcForceUpdate.match(action)) {
2440
2443
  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);
@@ -2515,7 +2518,7 @@ var bcDeleteDataEpic = function (action$, store$, _a) {
2515
2518
  var state = store$.value;
2516
2519
  var bcName = action.payload.bcName;
2517
2520
  var cursor = state.screen.bo.bc[bcName].cursor;
2518
- var bcUrl = buildBcUrl(bcName, true);
2521
+ var bcUrl = buildBcUrl(bcName, true, state);
2519
2522
  var context = { widgetName: action.payload.widgetName };
2520
2523
  var isTargetFormatPVF = state.view.pendingValidationFailsFormat === "target" /* target */;
2521
2524
  return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe(mergeMap26(function (data) {
@@ -2551,9 +2554,11 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe(fil
2551
2554
  var _a, _b, _c, _d, _e;
2552
2555
  var state = state$.value;
2553
2556
  var selected = action.payload.dataItem._associate;
2557
+ var bcName = action.payload.bcName;
2554
2558
  var result = [
2555
2559
  of29(changeDataItem({
2556
- bcName: action.payload.bcName,
2560
+ bcName: bcName,
2561
+ bcUrl: buildBcUrl(bcName, true, state),
2557
2562
  cursor: action.payload.dataItem.id,
2558
2563
  dataItem: action.payload.dataItem
2559
2564
  }))
@@ -2626,7 +2631,7 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
2626
2631
  var state = state$.value;
2627
2632
  var screenName = state.screen.screenName;
2628
2633
  var bcName = action.payload.bcName;
2629
- var bcUrl = buildBcUrl(bcName, true);
2634
+ var bcUrl = buildBcUrl(bcName, true, state);
2630
2635
  var bc = state.screen.bo.bc[bcName];
2631
2636
  var cursor = bc === null || bc === void 0 ? void 0 : bc.cursor;
2632
2637
  var context = { widgetName: action.payload.widgetName };
@@ -2704,11 +2709,16 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(f
2704
2709
  if ((_h = widget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull) {
2705
2710
  return of32(changeDataItem({
2706
2711
  bcName: bcName,
2712
+ bcUrl: buildBcUrl(bcName, true, state),
2707
2713
  cursor: cursor,
2708
2714
  dataItem: (_a = {}, _a[associateFieldKey] = action.payload.dataItem.filter(function (item) { return !removedNodes.includes(item.id); }), _a)
2709
2715
  }));
2710
2716
  }
2711
2717
  if ((_j = widget.options) === null || _j === void 0 ? void 0 : _j.hierarchy) {
2718
+ var hierarchyBcName = (_o = (_m = (_l = (_k = widget.options) === null || _k === void 0 ? void 0 : _k.hierarchy) === null || _l === void 0 ? void 0 : _l.find(function (hierarchyData) {
2719
+ var _a;
2720
+ return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
2721
+ })) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName;
2712
2722
  return concat21(of32(changeDataItem({
2713
2723
  /**
2714
2724
  * This is incorrect and will break if different BC has records with
@@ -2716,24 +2726,25 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe(f
2716
2726
  *
2717
2727
  * TODO: Record `level` should be mapped to hierarchyData index instead
2718
2728
  */
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,
2729
+ bcName: hierarchyBcName,
2730
+ bcUrl: buildBcUrl(hierarchyBcName, true, state),
2723
2731
  cursor: action.payload.removedItem.id,
2724
2732
  dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
2725
2733
  })), of32(changeDataItem({
2726
2734
  bcName: bcName,
2735
+ bcUrl: buildBcUrl(bcName, true, state),
2727
2736
  cursor: cursor,
2728
2737
  dataItem: (_b = {}, _b[associateFieldKey] = action.payload.dataItem, _b)
2729
2738
  })));
2730
2739
  }
2731
2740
  return concat21(of32(changeDataItem({
2732
2741
  bcName: popupBcName,
2742
+ bcUrl: buildBcUrl(popupBcName, true, state),
2733
2743
  cursor: action.payload.removedItem.id,
2734
2744
  dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
2735
2745
  })), of32(changeDataItem({
2736
2746
  bcName: bcName,
2747
+ bcUrl: buildBcUrl(bcName, true, state),
2737
2748
  cursor: cursor,
2738
2749
  dataItem: (_c = {}, _c[associateFieldKey] = action.payload.dataItem, _c)
2739
2750
  })));
@@ -2747,7 +2758,7 @@ var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
2747
2758
  var screenName = state.screen.screenName;
2748
2759
  var bcName = action.payload.bcName;
2749
2760
  var cursor = state.screen.bo.bc[bcName].cursor;
2750
- var bcUrl = buildBcUrl(bcName, true);
2761
+ var bcUrl = buildBcUrl(bcName, true, state);
2751
2762
  var canceler = api.createCanceler();
2752
2763
  var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }));
2753
2764
  var cancelByParentBc = cancelRequestEpic(action$, [bcSelectRecord], canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }), function (filteredAction) {
@@ -2815,6 +2826,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
2815
2826
  }
2816
2827
  result.push(of34(changeDataItem({
2817
2828
  bcName: action.payload.bcName,
2829
+ bcUrl: buildBcUrl(action.payload.bcName, true, state),
2818
2830
  cursor: action.payload.dataItem.id,
2819
2831
  dataItem: action.payload.dataItem
2820
2832
  })));
@@ -2857,7 +2869,7 @@ var saveAssociationsActiveEpic = function (action$, state$, _a) {
2857
2869
  var calleeBCName = state.view.popupData.calleeBCName;
2858
2870
  var calleeWidgetName = state.view.popupData.calleeWidgetName;
2859
2871
  var bcNames = action.payload.bcNames;
2860
- var bcUrl = buildBcUrl(calleeBCName, true);
2872
+ var bcUrl = buildBcUrl(calleeBCName, true, state);
2861
2873
  var pendingChanges = state.view.pendingDataChanges[bcNames[0]] || {};
2862
2874
  var params = bcNames.length ? { _bcName: bcNames[bcNames.length - 1] } : {};
2863
2875
  return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter(function (i) { return i._associate; }), params).pipe(mergeMap34(function (response) {
@@ -2874,15 +2886,16 @@ var saveAssociationsActiveEpic = function (action$, state$, _a) {
2874
2886
  import { concat as concat24, filter as filter50, mergeMap as mergeMap35, of as of36 } from "rxjs";
2875
2887
  var changeAssociationSameBcEpic = function (action$, state$) { return action$.pipe(filter50(changeAssociationSameBc.match), mergeMap35(function (action) {
2876
2888
  var _a, _b, _c, _d, _e;
2889
+ var state = state$.value;
2877
2890
  var bcName = action.payload.bcName;
2878
2891
  var result = [
2879
2892
  of36(changeDataItem({
2880
2893
  bcName: bcName,
2894
+ bcUrl: buildBcUrl(bcName, true, state),
2881
2895
  cursor: action.payload.dataItem.id,
2882
2896
  dataItem: action.payload.dataItem
2883
2897
  }))
2884
2898
  ];
2885
- var state = state$.value;
2886
2899
  var selected = action.payload.dataItem._associate;
2887
2900
  var depth = action.payload.depth || 1;
2888
2901
  var parentDepth = depth - 1;
@@ -2921,7 +2934,8 @@ var inlinePickListFetchDataEpic = function (action$, state$, _a) {
2921
2934
  return action$.pipe(filter51(inlinePickListFetchDataRequest.match), mergeMap36(function (action) {
2922
2935
  var _a;
2923
2936
  var _b = action.payload, bcName = _b.bcName, searchSpec = _b.searchSpec, searchString = _b.searchString;
2924
- var bcUrl = buildBcUrl(bcName, false);
2937
+ var state = state$.value;
2938
+ var bcUrl = buildBcUrl(bcName, false, state);
2925
2939
  var canceler = api.createCanceler();
2926
2940
  var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName: bcName, bcUrl: bcUrl }));
2927
2941
  var normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, (_a = {}, _a[searchSpec + ".contains"] = searchString, _a), canceler.cancelToken).pipe(mergeMap36(function (data) {
@@ -2969,6 +2983,7 @@ var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pi
2969
2983
  })).concat.apply(_a, addedItems);
2970
2984
  return of38(changeDataItem({
2971
2985
  bcName: calleeBCName,
2986
+ bcUrl: buildBcUrl(calleeBCName, true, state),
2972
2987
  cursor: cursor,
2973
2988
  dataItem: (_b = {},
2974
2989
  _b[associateFieldKey] = result,
@@ -163,7 +163,7 @@ var bcFetchRowMetaSuccess = createAction("bcFetchRowMetaSuccess");
163
163
  var bcFetchRowMetaFail = createAction("bcFetchRowMetaFail");
164
164
  var bcNewData = createAction("bcNewData");
165
165
  var bcNewDataSuccess = createAction("bcNewDataSuccess");
166
- var bcNewDataFail = createAction("bcNewDataSuccess");
166
+ var bcNewDataFail = createAction("bcNewDataFail");
167
167
  var bcDeleteDataFail = createAction("bcDeleteDataFail");
168
168
  var forceActiveChangeFail = createAction("forceActiveChangeFail");
169
169
  var sendOperation = createAction("sendOperation");
@@ -544,9 +544,8 @@ function getTemplate(literals, ...placeholders) {
544
544
  result += literals[literals.length - 1];
545
545
  return result;
546
546
  }
547
- function buildBcUrl(bcName, includeSelf = false, store) {
548
- const storeInstance = store;
549
- const bcMap = storeInstance.screen.bo.bc;
547
+ function buildBcUrl(bcName, includeSelf = false, state) {
548
+ const bcMap = state.screen.bo.bc;
550
549
  const bc = bcMap[bcName];
551
550
  if (!bc) {
552
551
  return null;
@@ -724,7 +723,7 @@ function getSorters(sorters) {
724
723
  }
725
724
  function parseFilters(defaultFilters) {
726
725
  const result = [];
727
- const urlParams = new URL(defaultFilters).searchParams;
726
+ const urlParams = new URL(defaultFilters, window.location.origin).searchParams;
728
727
  urlParams.forEach((param) => {
729
728
  const [fieldName, type] = param.split(".");
730
729
  if (fieldName && type && urlParams.get(param)) {
@@ -754,7 +753,7 @@ function parseSorters(sorters) {
754
753
  return null;
755
754
  }
756
755
  const result = [];
757
- const dictionary = new URL(sorters).searchParams;
756
+ const dictionary = new URL(sorters, window.location.origin).searchParams;
758
757
  Object.entries(dictionary).map(([sort, fieldKey]) => {
759
758
  const [order, direction] = sort.split(".").slice(1);
760
759
  return { fieldName: fieldKey, order: Number.parseInt(order, 10), direction };
@@ -1194,7 +1193,9 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
1194
1193
  state.metaInProgress[action.payload.bcName] = true;
1195
1194
  }
1196
1195
  }).addCase(bcFetchRowMetaSuccess, (state, action) => {
1197
- state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
1196
+ if (state.rowMeta[action.payload.bcName]) {
1197
+ state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
1198
+ }
1198
1199
  state.metaInProgress[action.payload.bcName] = false;
1199
1200
  }).addCase(bcNewDataSuccess, (state, action) => {
1200
1201
  state.selectedCell = initialViewState.selectedCell;
@@ -1232,7 +1233,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
1232
1233
  const prevCursor = prevBc[action.payload.cursor] || {};
1233
1234
  const prevPending = prevCursor || {};
1234
1235
  const nextPending = __spreadValues(__spreadValues({}, prevPending), action.payload.dataItem);
1235
- const bcUrl = buildBcUrl(actionBcName, true);
1236
+ const bcUrl = action.payload.bcUrl;
1236
1237
  const rowMeta = (_a = state.rowMeta[actionBcName]) == null ? void 0 : _a[bcUrl];
1237
1238
  const nextValidationFails = {};
1238
1239
  const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
@@ -1501,7 +1502,7 @@ var sendOperationEpic = (action$, state$, { api }) => action$.pipe(filter(sendOp
1501
1502
  const screenName = state.screen.screenName;
1502
1503
  const { bcName, operationType, widgetName } = action.payload;
1503
1504
  const confirm = ((_a = action.payload.confirmOperation) == null ? void 0 : _a.type) || action.payload.confirm;
1504
- const bcUrl = buildBcUrl(bcName, true);
1505
+ const bcUrl = buildBcUrl(bcName, true, state);
1505
1506
  const bc = state.screen.bo.bc[bcName];
1506
1507
  const rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) == null ? void 0 : _b[bcUrl]);
1507
1508
  const fields = rowMeta == null ? void 0 : rowMeta.fields;
@@ -1592,7 +1593,7 @@ var fileUploadConfirmEpic = (action$, state$, { api }) => action$.pipe(filter3(b
1592
1593
  var _a;
1593
1594
  const state = state$.value;
1594
1595
  const bcName = state.view.popupData.bcName;
1595
- const bcUrl = buildBcUrl(bcName, true);
1596
+ const bcUrl = buildBcUrl(bcName, true, state);
1596
1597
  const widgetName = (_a = state.view.widgets.find((item) => item.bcName === bcName)) == null ? void 0 : _a.name;
1597
1598
  const data = {
1598
1599
  bulkIds: action.payload.fileIds
@@ -1660,7 +1661,7 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
1660
1661
  var _a2;
1661
1662
  return item.name === ((_a2 = state.view.popupData) == null ? void 0 : _a2.widgetName) && [WidgetTypes4.PickListPopup, WidgetTypes4.FlatTreePopup].includes(item.type);
1662
1663
  });
1663
- const bcUrl = buildBcUrl(bcName, true);
1664
+ const bcUrl = buildBcUrl(bcName, true, state);
1664
1665
  const pendingChanges = state.view.pendingDataChanges[bcName][cursor];
1665
1666
  const handledForceActive = ((_a = state.view.handledForceActive[bcName]) == null ? void 0 : _a[cursor]) || {};
1666
1667
  const currentRecordData = (_b = state.data[bcName]) == null ? void 0 : _b.find((record) => record.id === cursor);
@@ -1703,6 +1704,7 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
1703
1704
  }
1704
1705
  return concat5(of7(removePendingRequest({ requestId })), state.view.url === initUrl ? concat5(of7(changeDataItem({
1705
1706
  bcName,
1707
+ bcUrl: buildBcUrl(bcName, true, state),
1706
1708
  cursor,
1707
1709
  dataItem: { [changedFiledKey]: currentRecordData[changedFiledKey] },
1708
1710
  disableRetry: true
@@ -1799,7 +1801,7 @@ import { catchError as catchError4, concat as concat7, EMPTY as EMPTY8, filter a
1799
1801
  var userDrillDownEpic = (action$, state$, { api }) => action$.pipe(filter15(userDrillDown.match), switchMap6((action) => {
1800
1802
  const state = state$.value;
1801
1803
  const { bcName, fieldKey, cursor } = action.payload;
1802
- const bcUrl = buildBcUrl(bcName, true);
1804
+ const bcUrl = buildBcUrl(bcName, true, state);
1803
1805
  return api.fetchRowMeta(state.screen.screenName, bcUrl).pipe(mergeMap10((rowMeta) => {
1804
1806
  var _a, _b, _c, _d;
1805
1807
  const drillDownField = rowMeta.fields.find((field) => field.key === fieldKey);
@@ -2148,7 +2150,7 @@ import { OperationTypeCrud as OperationTypeCrud8 } from "@cxbox-ui/schema";
2148
2150
  var bcNewDataEpic = (action$, state$, { api }) => action$.pipe(filter35(sendOperation.match), filter35((action) => matchOperationRole(OperationTypeCrud8.create, action.payload, state$.value)), mergeMap20((action) => {
2149
2151
  const state = state$.value;
2150
2152
  const bcName = action.payload.bcName;
2151
- const bcUrl = buildBcUrl(bcName);
2153
+ const bcUrl = buildBcUrl(bcName, false, state);
2152
2154
  const context = { widgetName: action.payload.widgetName };
2153
2155
  const params = { _action: action.payload.operationType };
2154
2156
  return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe(mergeMap20((data) => {
@@ -2160,7 +2162,8 @@ var bcNewDataEpic = (action$, state$, { api }) => action$.pipe(filter35(sendOper
2160
2162
  const postInvoke = data.postActions[0];
2161
2163
  const cursor = dataItem.id;
2162
2164
  return concat13(of22(bcNewDataSuccess({ bcName, dataItem, bcUrl })), of22(bcFetchRowMetaSuccess({ bcName, bcUrl: `${bcUrl}/${cursor}`, rowMeta, cursor })), of22(changeDataItem({
2163
- bcName: action.payload.bcName,
2165
+ bcName,
2166
+ bcUrl: buildBcUrl(bcName, true, state),
2164
2167
  cursor,
2165
2168
  dataItem: {
2166
2169
  id: cursor
@@ -2194,7 +2197,7 @@ var bcLoadMoreEpic = (action$, state$, { api }) => action$.pipe(filter37(bcLoadM
2194
2197
  const { cursor, page } = bc;
2195
2198
  const limit = ((_a = state.view.widgets.find((i) => i.bcName === bcName)) == null ? void 0 : _a.limit) || bc.limit;
2196
2199
  const limitBySelfCursor = (_b = state.router.bcPath) == null ? void 0 : _b.includes(`${bcName}/${cursor}`);
2197
- const bcUrl = buildBcUrl(bcName, limitBySelfCursor);
2200
+ const bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
2198
2201
  const filters = state.screen.filters[bcName] || [];
2199
2202
  const sorters = state.screen.sorters[bcName];
2200
2203
  const fetchParams = __spreadValues(__spreadValues({
@@ -2225,7 +2228,7 @@ var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOpe
2225
2228
  var _a, _b, _c;
2226
2229
  const state = state$.value;
2227
2230
  const bcName = action.payload.bcName;
2228
- const bcUrl = buildBcUrl(bcName, true);
2231
+ const bcUrl = buildBcUrl(bcName, true, state);
2229
2232
  const widgetName = action.payload.widgetName;
2230
2233
  const cursor = state.screen.bo.bc[bcName].cursor;
2231
2234
  const dataItem = state.data[bcName].find((item) => item.id === cursor);
@@ -2377,7 +2380,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
2377
2380
  return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && ((_a2 = item.options) == null ? void 0 : _a2.hierarchyFull);
2378
2381
  });
2379
2382
  const limitBySelfCursor = (_c = state.router.bcPath) == null ? void 0 : _c.includes(`${bcName}/${cursor}`);
2380
- const bcUrl = buildBcUrl(bcName, limitBySelfCursor);
2383
+ const bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
2381
2384
  const fetchParams = __spreadValues(__spreadValues({
2382
2385
  _page: page,
2383
2386
  _limit: limit
@@ -2458,7 +2461,7 @@ var bcDeleteDataEpic = (action$, store$, { api }) => action$.pipe(filter41(sendO
2458
2461
  const state = store$.value;
2459
2462
  const bcName = action.payload.bcName;
2460
2463
  const cursor = state.screen.bo.bc[bcName].cursor;
2461
- const bcUrl = buildBcUrl(bcName, true);
2464
+ const bcUrl = buildBcUrl(bcName, true, state);
2462
2465
  const context = { widgetName: action.payload.widgetName };
2463
2466
  const isTargetFormatPVF = state.view.pendingValidationFailsFormat === "target" /* target */;
2464
2467
  return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe(mergeMap26((data) => {
@@ -2492,9 +2495,11 @@ var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAss
2492
2495
  var _a, _b, _c, _d, _e;
2493
2496
  const state = state$.value;
2494
2497
  const selected = action.payload.dataItem._associate;
2498
+ const bcName = action.payload.bcName;
2495
2499
  const result = [
2496
2500
  of29(changeDataItem({
2497
- bcName: action.payload.bcName,
2501
+ bcName,
2502
+ bcUrl: buildBcUrl(bcName, true, state),
2498
2503
  cursor: action.payload.dataItem.id,
2499
2504
  dataItem: action.payload.dataItem
2500
2505
  }))
@@ -2567,7 +2572,7 @@ var bcCancelCreateDataEpic = (action$, state$, { api }) => action$.pipe(filter44
2567
2572
  const state = state$.value;
2568
2573
  const screenName = state.screen.screenName;
2569
2574
  const bcName = action.payload.bcName;
2570
- const bcUrl = buildBcUrl(bcName, true);
2575
+ const bcUrl = buildBcUrl(bcName, true, state);
2571
2576
  const bc = state.screen.bo.bc[bcName];
2572
2577
  const cursor = bc == null ? void 0 : bc.cursor;
2573
2578
  const context = { widgetName: action.payload.widgetName };
@@ -2645,11 +2650,16 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
2645
2650
  if ((_e = widget.options) == null ? void 0 : _e.hierarchyFull) {
2646
2651
  return of32(changeDataItem({
2647
2652
  bcName,
2653
+ bcUrl: buildBcUrl(bcName, true, state),
2648
2654
  cursor,
2649
2655
  dataItem: { [associateFieldKey]: action.payload.dataItem.filter((item) => !removedNodes.includes(item.id)) }
2650
2656
  }));
2651
2657
  }
2652
2658
  if ((_f = widget.options) == null ? void 0 : _f.hierarchy) {
2659
+ const hierarchyBcName = (_j = (_i = (_h = (_g = widget.options) == null ? void 0 : _g.hierarchy) == null ? void 0 : _h.find((hierarchyData) => {
2660
+ var _a2;
2661
+ return (_a2 = state.view.pendingDataChanges[hierarchyData.bcName]) == null ? void 0 : _a2[action.payload.removedItem.id];
2662
+ })) == null ? void 0 : _i.bcName) != null ? _j : bcName;
2653
2663
  return concat21(of32(changeDataItem({
2654
2664
  /**
2655
2665
  * This is incorrect and will break if different BC has records with
@@ -2657,24 +2667,25 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
2657
2667
  *
2658
2668
  * TODO: Record `level` should be mapped to hierarchyData index instead
2659
2669
  */
2660
- bcName: (_j = (_i = (_h = (_g = widget.options) == null ? void 0 : _g.hierarchy) == null ? void 0 : _h.find((hierarchyData) => {
2661
- var _a2;
2662
- return (_a2 = state.view.pendingDataChanges[hierarchyData.bcName]) == null ? void 0 : _a2[action.payload.removedItem.id];
2663
- })) == null ? void 0 : _i.bcName) != null ? _j : bcName,
2670
+ bcName: hierarchyBcName,
2671
+ bcUrl: buildBcUrl(hierarchyBcName, true, state),
2664
2672
  cursor: action.payload.removedItem.id,
2665
2673
  dataItem: __spreadProps(__spreadValues({}, action.payload.removedItem), { _associate: false })
2666
2674
  })), of32(changeDataItem({
2667
2675
  bcName,
2676
+ bcUrl: buildBcUrl(bcName, true, state),
2668
2677
  cursor,
2669
2678
  dataItem: { [associateFieldKey]: action.payload.dataItem }
2670
2679
  })));
2671
2680
  }
2672
2681
  return concat21(of32(changeDataItem({
2673
2682
  bcName: popupBcName,
2683
+ bcUrl: buildBcUrl(popupBcName, true, state),
2674
2684
  cursor: action.payload.removedItem.id,
2675
2685
  dataItem: __spreadProps(__spreadValues({}, action.payload.removedItem), { _associate: false })
2676
2686
  })), of32(changeDataItem({
2677
2687
  bcName,
2688
+ bcUrl: buildBcUrl(bcName, true, state),
2678
2689
  cursor,
2679
2690
  dataItem: { [associateFieldKey]: action.payload.dataItem }
2680
2691
  })));
@@ -2686,7 +2697,7 @@ var bcFetchRowMetaRequestEpic = (action$, state$, { api }) => action$.pipe(filte
2686
2697
  const screenName = state.screen.screenName;
2687
2698
  const bcName = action.payload.bcName;
2688
2699
  const cursor = state.screen.bo.bc[bcName].cursor;
2689
- const bcUrl = buildBcUrl(bcName, true);
2700
+ const bcUrl = buildBcUrl(bcName, true, state);
2690
2701
  const canceler = api.createCanceler();
2691
2702
  const cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchRowMetaFail({ bcName }));
2692
2703
  const cancelByParentBc = cancelRequestEpic(action$, [bcSelectRecord], canceler.cancel, bcFetchRowMetaFail({ bcName }), (filteredAction) => {
@@ -2753,6 +2764,7 @@ var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(chang
2753
2764
  }
2754
2765
  result.push(of34(changeDataItem({
2755
2766
  bcName: action.payload.bcName,
2767
+ bcUrl: buildBcUrl(action.payload.bcName, true, state),
2756
2768
  cursor: action.payload.dataItem.id,
2757
2769
  dataItem: action.payload.dataItem
2758
2770
  })));
@@ -2796,7 +2808,7 @@ var saveAssociationsActiveEpic = (action$, state$, { api }) => action$.pipe(filt
2796
2808
  const calleeBCName = state.view.popupData.calleeBCName;
2797
2809
  const calleeWidgetName = state.view.popupData.calleeWidgetName;
2798
2810
  const bcNames = action.payload.bcNames;
2799
- const bcUrl = buildBcUrl(calleeBCName, true);
2811
+ const bcUrl = buildBcUrl(calleeBCName, true, state);
2800
2812
  const pendingChanges = state.view.pendingDataChanges[bcNames[0]] || {};
2801
2813
  const params = bcNames.length ? { _bcName: bcNames[bcNames.length - 1] } : {};
2802
2814
  return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter((i) => i._associate), params).pipe(mergeMap34((response) => {
@@ -2812,15 +2824,16 @@ var saveAssociationsActiveEpic = (action$, state$, { api }) => action$.pipe(filt
2812
2824
  import { concat as concat24, filter as filter50, mergeMap as mergeMap35, of as of36 } from "rxjs";
2813
2825
  var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(changeAssociationSameBc.match), mergeMap35((action) => {
2814
2826
  var _a, _b, _c, _d, _e;
2827
+ const state = state$.value;
2815
2828
  const bcName = action.payload.bcName;
2816
2829
  const result = [
2817
2830
  of36(changeDataItem({
2818
2831
  bcName,
2832
+ bcUrl: buildBcUrl(bcName, true, state),
2819
2833
  cursor: action.payload.dataItem.id,
2820
2834
  dataItem: action.payload.dataItem
2821
2835
  }))
2822
2836
  ];
2823
- const state = state$.value;
2824
2837
  const selected = action.payload.dataItem._associate;
2825
2838
  const depth = action.payload.depth || 1;
2826
2839
  const parentDepth = depth - 1;
@@ -2859,7 +2872,8 @@ var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(cha
2859
2872
  import { catchError as catchError15, filter as filter51, mergeMap as mergeMap36, of as of37, race as race4 } from "rxjs";
2860
2873
  var inlinePickListFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter51(inlinePickListFetchDataRequest.match), mergeMap36((action) => {
2861
2874
  const { bcName, searchSpec, searchString } = action.payload;
2862
- const bcUrl = buildBcUrl(bcName, false);
2875
+ const state = state$.value;
2876
+ const bcUrl = buildBcUrl(bcName, false, state);
2863
2877
  const canceler = api.createCanceler();
2864
2878
  const cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName, bcUrl }));
2865
2879
  const normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, { [searchSpec + ".contains"]: searchString }, canceler.cancelToken).pipe(mergeMap36((data) => {
@@ -2904,6 +2918,7 @@ var saveAssociationsPassiveEpic = (action$, state$) => action$.pipe(filter52(sav
2904
2918
  }).concat(...addedItems);
2905
2919
  return of38(changeDataItem({
2906
2920
  bcName: calleeBCName,
2921
+ bcUrl: buildBcUrl(calleeBCName, true, state),
2907
2922
  cursor,
2908
2923
  dataItem: {
2909
2924
  [associateFieldKey]: result