@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.
@@ -534,6 +534,7 @@ export declare const bcChangeDepthCursor: import("@reduxjs/toolkit").ActionCreat
534
534
  */
535
535
  export declare const changeDataItem: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<{
536
536
  bcName: string;
537
+ bcUrl: string;
537
538
  cursor: string;
538
539
  dataItem: PendingDataItem;
539
540
  disableRetry?: boolean;
@@ -202,7 +202,7 @@ var bcFetchRowMetaSuccess = (0, import_toolkit.createAction)("bcFetchRowMetaSucc
202
202
  var bcFetchRowMetaFail = (0, import_toolkit.createAction)("bcFetchRowMetaFail");
203
203
  var bcNewData = (0, import_toolkit.createAction)("bcNewData");
204
204
  var bcNewDataSuccess = (0, import_toolkit.createAction)("bcNewDataSuccess");
205
- var bcNewDataFail = (0, import_toolkit.createAction)("bcNewDataSuccess");
205
+ var bcNewDataFail = (0, import_toolkit.createAction)("bcNewDataFail");
206
206
  var bcDeleteDataFail = (0, import_toolkit.createAction)("bcDeleteDataFail");
207
207
  var forceActiveChangeFail = (0, import_toolkit.createAction)("forceActiveChangeFail");
208
208
  var sendOperation = (0, import_toolkit.createAction)("sendOperation");
@@ -589,10 +589,9 @@ function getTemplate(literals) {
589
589
  result += literals[literals.length - 1];
590
590
  return result;
591
591
  }
592
- function buildBcUrl(bcName, includeSelf, store) {
592
+ function buildBcUrl(bcName, includeSelf, state) {
593
593
  if (includeSelf === void 0) { includeSelf = false; }
594
- var storeInstance = store;
595
- var bcMap = storeInstance.screen.bo.bc;
594
+ var bcMap = state.screen.bo.bc;
596
595
  var bc = bcMap[bcName];
597
596
  if (!bc) {
598
597
  return null;
@@ -774,7 +773,7 @@ function getSorters(sorters) {
774
773
  }
775
774
  function parseFilters(defaultFilters) {
776
775
  var result = [];
777
- var urlParams = new URL(defaultFilters).searchParams;
776
+ var urlParams = new URL(defaultFilters, window.location.origin).searchParams;
778
777
  urlParams.forEach(function (param) {
779
778
  var _a = param.split("."), fieldName = _a[0], type = _a[1];
780
779
  if (fieldName && type && urlParams.get(param)) {
@@ -804,7 +803,7 @@ function parseSorters(sorters) {
804
803
  return null;
805
804
  }
806
805
  var result = [];
807
- var dictionary = new URL(sorters).searchParams;
806
+ var dictionary = new URL(sorters, window.location.origin).searchParams;
808
807
  Object.entries(dictionary).map(function (_a) {
809
808
  var sort = _a[0], fieldKey = _a[1];
810
809
  var _b = sort.split(".").slice(1), order = _b[0], direction = _b[1];
@@ -1245,7 +1244,9 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1245
1244
  state.metaInProgress[action.payload.bcName] = true;
1246
1245
  }
1247
1246
  }).addCase(bcFetchRowMetaSuccess, function (state, action) {
1248
- state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
1247
+ if (state.rowMeta[action.payload.bcName]) {
1248
+ state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
1249
+ }
1249
1250
  state.metaInProgress[action.payload.bcName] = false;
1250
1251
  }).addCase(bcNewDataSuccess, function (state, action) {
1251
1252
  state.selectedCell = initialViewState.selectedCell;
@@ -1283,7 +1284,7 @@ var createViewReducerBuilderManager = function (initialState) { return new Reduc
1283
1284
  var prevCursor = prevBc[action.payload.cursor] || {};
1284
1285
  var prevPending = prevCursor || {};
1285
1286
  var nextPending = __assign(__assign({}, prevPending), action.payload.dataItem);
1286
- var bcUrl = buildBcUrl(actionBcName, true);
1287
+ var bcUrl = action.payload.bcUrl;
1287
1288
  var rowMeta = (_a = state.rowMeta[actionBcName]) === null || _a === void 0 ? void 0 : _a[bcUrl];
1288
1289
  var nextValidationFails = {};
1289
1290
  var isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
@@ -1557,7 +1558,7 @@ var sendOperationEpic = function (action$, state$, _a) {
1557
1558
  var screenName = state.screen.screenName;
1558
1559
  var _l = action.payload, bcName = _l.bcName, operationType = _l.operationType, widgetName = _l.widgetName;
1559
1560
  var confirm = ((_a = action.payload.confirmOperation) === null || _a === void 0 ? void 0 : _a.type) || action.payload.confirm;
1560
- var bcUrl = buildBcUrl(bcName, true);
1561
+ var bcUrl = buildBcUrl(bcName, true, state);
1561
1562
  var bc = state.screen.bo.bc[bcName];
1562
1563
  var rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) === null || _b === void 0 ? void 0 : _b[bcUrl]);
1563
1564
  var fields = rowMeta === null || rowMeta === void 0 ? void 0 : rowMeta.fields;
@@ -1653,7 +1654,7 @@ var fileUploadConfirmEpic = function (action$, state$, _a) {
1653
1654
  var _a;
1654
1655
  var state = state$.value;
1655
1656
  var bcName = state.view.popupData.bcName;
1656
- var bcUrl = buildBcUrl(bcName, true);
1657
+ var bcUrl = buildBcUrl(bcName, true, state);
1657
1658
  var widgetName = (_a = state.view.widgets.find(function (item) { return item.bcName === bcName; })) === null || _a === void 0 ? void 0 : _a.name;
1658
1659
  var data = {
1659
1660
  bulkIds: action.payload.fileIds
@@ -1724,7 +1725,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
1724
1725
  return import_rxjs8.EMPTY;
1725
1726
  }
1726
1727
  var isPickListPopup = state.view.widgets.find(function (item) { var _a; return item.name === ((_a = state.view.popupData) === null || _a === void 0 ? void 0 : _a.widgetName) && [import_schema12.WidgetTypes.PickListPopup, import_schema12.WidgetTypes.FlatTreePopup].includes(item.type); });
1727
- var bcUrl = buildBcUrl(bcName, true);
1728
+ var bcUrl = buildBcUrl(bcName, true, state);
1728
1729
  var pendingChanges = state.view.pendingDataChanges[bcName][cursor];
1729
1730
  var handledForceActive = ((_a = state.view.handledForceActive[bcName]) === null || _a === void 0 ? void 0 : _a[cursor]) || {};
1730
1731
  var currentRecordData = (_b = state.data[bcName]) === null || _b === void 0 ? void 0 : _b.find(function (record) { return record.id === cursor; });
@@ -1768,6 +1769,7 @@ var getRowMetaByForceActiveEpic = function (action$, state$, _a) {
1768
1769
  }
1769
1770
  return (0, import_rxjs8.concat)((0, import_rxjs8.of)(removePendingRequest({ requestId: requestId })), state.view.url === initUrl ? (0, import_rxjs8.concat)((0, import_rxjs8.of)(changeDataItem({
1770
1771
  bcName: bcName,
1772
+ bcUrl: buildBcUrl(bcName, true, state),
1771
1773
  cursor: cursor,
1772
1774
  dataItem: (_a = {}, _a[changedFiledKey] = currentRecordData[changedFiledKey], _a),
1773
1775
  disableRetry: true
@@ -1871,7 +1873,7 @@ var userDrillDownEpic = function (action$, state$, _a) {
1871
1873
  return action$.pipe((0, import_rxjs16.filter)(userDrillDown.match), (0, import_rxjs16.switchMap)(function (action) {
1872
1874
  var state = state$.value;
1873
1875
  var _a = action.payload, bcName = _a.bcName, fieldKey = _a.fieldKey, cursor = _a.cursor;
1874
- var bcUrl = buildBcUrl(bcName, true);
1876
+ var bcUrl = buildBcUrl(bcName, true, state);
1875
1877
  return api.fetchRowMeta(state.screen.screenName, bcUrl).pipe((0, import_rxjs16.mergeMap)(function (rowMeta) {
1876
1878
  var _a, _b, _c, _d;
1877
1879
  var drillDownField = rowMeta.fields.find(function (field) { return field.key === fieldKey; });
@@ -2228,7 +2230,7 @@ var bcNewDataEpic = function (action$, state$, _a) {
2228
2230
  return action$.pipe((0, import_rxjs36.filter)(sendOperation.match), (0, import_rxjs36.filter)(function (action) { return matchOperationRole(import_schema13.OperationTypeCrud.create, action.payload, state$.value); }), (0, import_rxjs36.mergeMap)(function (action) {
2229
2231
  var state = state$.value;
2230
2232
  var bcName = action.payload.bcName;
2231
- var bcUrl = buildBcUrl(bcName);
2233
+ var bcUrl = buildBcUrl(bcName, false, state);
2232
2234
  var context = { widgetName: action.payload.widgetName };
2233
2235
  var params = { _action: action.payload.operationType };
2234
2236
  return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe((0, import_rxjs36.mergeMap)(function (data) {
@@ -2240,7 +2242,8 @@ var bcNewDataEpic = function (action$, state$, _a) {
2240
2242
  var postInvoke = data.postActions[0];
2241
2243
  var cursor = dataItem.id;
2242
2244
  return (0, import_rxjs36.concat)((0, import_rxjs36.of)(bcNewDataSuccess({ bcName: bcName, dataItem: dataItem, bcUrl: bcUrl })), (0, import_rxjs36.of)(bcFetchRowMetaSuccess({ bcName: bcName, bcUrl: "".concat(bcUrl, "/").concat(cursor), rowMeta: rowMeta, cursor: cursor })), (0, import_rxjs36.of)(changeDataItem({
2243
- bcName: action.payload.bcName,
2245
+ bcName: bcName,
2246
+ bcUrl: buildBcUrl(bcName, true, state),
2244
2247
  cursor: cursor,
2245
2248
  dataItem: {
2246
2249
  id: cursor
@@ -2278,7 +2281,7 @@ var bcLoadMoreEpic = function (action$, state$, _a) {
2278
2281
  var cursor = bc.cursor, page = bc.page;
2279
2282
  var limit = ((_a = state.view.widgets.find(function (i) { return i.bcName === bcName; })) === null || _a === void 0 ? void 0 : _a.limit) || bc.limit;
2280
2283
  var limitBySelfCursor = (_b = state.router.bcPath) === null || _b === void 0 ? void 0 : _b.includes("".concat(bcName, "/").concat(cursor));
2281
- var bcUrl = buildBcUrl(bcName, limitBySelfCursor);
2284
+ var bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
2282
2285
  var filters = state.screen.filters[bcName] || [];
2283
2286
  var sorters = state.screen.sorters[bcName];
2284
2287
  var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(filters)), getSorters(sorters));
@@ -2309,7 +2312,7 @@ var bcSaveDataEpic = function (action$, state$, _a) {
2309
2312
  var _a, _b, _c;
2310
2313
  var state = state$.value;
2311
2314
  var bcName = action.payload.bcName;
2312
- var bcUrl = buildBcUrl(bcName, true);
2315
+ var bcUrl = buildBcUrl(bcName, true, state);
2313
2316
  var widgetName = action.payload.widgetName;
2314
2317
  var cursor = state.screen.bo.bc[bcName].cursor;
2315
2318
  var dataItem = state.data[bcName].find(function (item) { return item.id === cursor; });
@@ -2471,7 +2474,7 @@ var bcFetchDataEpic = function (action$, state$, _a) {
2471
2474
  return item.bcName === widget.bcName && item.type === import_schema14.WidgetTypes.AssocListPopup && ((_a = item.options) === null || _a === void 0 ? void 0 : _a.hierarchyFull);
2472
2475
  });
2473
2476
  var limitBySelfCursor = (_c = state.router.bcPath) === null || _c === void 0 ? void 0 : _c.includes("".concat(bcName, "/").concat(cursor));
2474
- var bcUrl = buildBcUrl(bcName, limitBySelfCursor);
2477
+ var bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
2475
2478
  var fetchParams = __assign(__assign({ _page: page, _limit: limit }, getFilters(fullHierarchyWidget ? [] : state.screen.filters[bcName] || [])), getSorters(sorters));
2476
2479
  if (bcForceUpdate.match(action)) {
2477
2480
  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);
@@ -2552,7 +2555,7 @@ var bcDeleteDataEpic = function (action$, store$, _a) {
2552
2555
  var state = store$.value;
2553
2556
  var bcName = action.payload.bcName;
2554
2557
  var cursor = state.screen.bo.bc[bcName].cursor;
2555
- var bcUrl = buildBcUrl(bcName, true);
2558
+ var bcUrl = buildBcUrl(bcName, true, state);
2556
2559
  var context = { widgetName: action.payload.widgetName };
2557
2560
  var isTargetFormatPVF = state.view.pendingValidationFailsFormat === "target" /* target */;
2558
2561
  return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe((0, import_rxjs42.mergeMap)(function (data) {
@@ -2588,9 +2591,11 @@ var changeAssociationEpic = function (action$, state$) { return action$.pipe((0,
2588
2591
  var _a, _b, _c, _d, _e;
2589
2592
  var state = state$.value;
2590
2593
  var selected = action.payload.dataItem._associate;
2594
+ var bcName = action.payload.bcName;
2591
2595
  var result = [
2592
2596
  (0, import_rxjs44.of)(changeDataItem({
2593
- bcName: action.payload.bcName,
2597
+ bcName: bcName,
2598
+ bcUrl: buildBcUrl(bcName, true, state),
2594
2599
  cursor: action.payload.dataItem.id,
2595
2600
  dataItem: action.payload.dataItem
2596
2601
  }))
@@ -2663,7 +2668,7 @@ var bcCancelCreateDataEpic = function (action$, state$, _a) {
2663
2668
  var state = state$.value;
2664
2669
  var screenName = state.screen.screenName;
2665
2670
  var bcName = action.payload.bcName;
2666
- var bcUrl = buildBcUrl(bcName, true);
2671
+ var bcUrl = buildBcUrl(bcName, true, state);
2667
2672
  var bc = state.screen.bo.bc[bcName];
2668
2673
  var cursor = bc === null || bc === void 0 ? void 0 : bc.cursor;
2669
2674
  var context = { widgetName: action.payload.widgetName };
@@ -2741,11 +2746,16 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
2741
2746
  if ((_h = widget.options) === null || _h === void 0 ? void 0 : _h.hierarchyFull) {
2742
2747
  return (0, import_rxjs47.of)(changeDataItem({
2743
2748
  bcName: bcName,
2749
+ bcUrl: buildBcUrl(bcName, true, state),
2744
2750
  cursor: cursor,
2745
2751
  dataItem: (_a = {}, _a[associateFieldKey] = action.payload.dataItem.filter(function (item) { return !removedNodes.includes(item.id); }), _a)
2746
2752
  }));
2747
2753
  }
2748
2754
  if ((_j = widget.options) === null || _j === void 0 ? void 0 : _j.hierarchy) {
2755
+ var hierarchyBcName = (_o = (_m = (_l = (_k = widget.options) === null || _k === void 0 ? void 0 : _k.hierarchy) === null || _l === void 0 ? void 0 : _l.find(function (hierarchyData) {
2756
+ var _a;
2757
+ return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
2758
+ })) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName;
2749
2759
  return (0, import_rxjs47.concat)((0, import_rxjs47.of)(changeDataItem({
2750
2760
  /**
2751
2761
  * This is incorrect and will break if different BC has records with
@@ -2753,24 +2763,25 @@ var removeMultivalueTagEpic = function (action$, state$) { return action$.pipe((
2753
2763
  *
2754
2764
  * TODO: Record `level` should be mapped to hierarchyData index instead
2755
2765
  */
2756
- 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) {
2757
- var _a;
2758
- return (_a = state.view.pendingDataChanges[hierarchyData.bcName]) === null || _a === void 0 ? void 0 : _a[action.payload.removedItem.id];
2759
- })) === null || _m === void 0 ? void 0 : _m.bcName) !== null && _o !== void 0 ? _o : bcName,
2766
+ bcName: hierarchyBcName,
2767
+ bcUrl: buildBcUrl(hierarchyBcName, true, state),
2760
2768
  cursor: action.payload.removedItem.id,
2761
2769
  dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
2762
2770
  })), (0, import_rxjs47.of)(changeDataItem({
2763
2771
  bcName: bcName,
2772
+ bcUrl: buildBcUrl(bcName, true, state),
2764
2773
  cursor: cursor,
2765
2774
  dataItem: (_b = {}, _b[associateFieldKey] = action.payload.dataItem, _b)
2766
2775
  })));
2767
2776
  }
2768
2777
  return (0, import_rxjs47.concat)((0, import_rxjs47.of)(changeDataItem({
2769
2778
  bcName: popupBcName,
2779
+ bcUrl: buildBcUrl(popupBcName, true, state),
2770
2780
  cursor: action.payload.removedItem.id,
2771
2781
  dataItem: __assign(__assign({}, action.payload.removedItem), { _associate: false })
2772
2782
  })), (0, import_rxjs47.of)(changeDataItem({
2773
2783
  bcName: bcName,
2784
+ bcUrl: buildBcUrl(bcName, true, state),
2774
2785
  cursor: cursor,
2775
2786
  dataItem: (_c = {}, _c[associateFieldKey] = action.payload.dataItem, _c)
2776
2787
  })));
@@ -2784,7 +2795,7 @@ var bcFetchRowMetaRequestEpic = function (action$, state$, _a) {
2784
2795
  var screenName = state.screen.screenName;
2785
2796
  var bcName = action.payload.bcName;
2786
2797
  var cursor = state.screen.bo.bc[bcName].cursor;
2787
- var bcUrl = buildBcUrl(bcName, true);
2798
+ var bcUrl = buildBcUrl(bcName, true, state);
2788
2799
  var canceler = api.createCanceler();
2789
2800
  var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }));
2790
2801
  var cancelByParentBc = cancelRequestEpic(action$, [bcSelectRecord], canceler.cancel, bcFetchRowMetaFail({ bcName: bcName }), function (filteredAction) {
@@ -2852,6 +2863,7 @@ var changeAssociationFullEpic = function (action$, state$) { return action$.pipe
2852
2863
  }
2853
2864
  result.push((0, import_rxjs49.of)(changeDataItem({
2854
2865
  bcName: action.payload.bcName,
2866
+ bcUrl: buildBcUrl(action.payload.bcName, true, state),
2855
2867
  cursor: action.payload.dataItem.id,
2856
2868
  dataItem: action.payload.dataItem
2857
2869
  })));
@@ -2894,7 +2906,7 @@ var saveAssociationsActiveEpic = function (action$, state$, _a) {
2894
2906
  var calleeBCName = state.view.popupData.calleeBCName;
2895
2907
  var calleeWidgetName = state.view.popupData.calleeWidgetName;
2896
2908
  var bcNames = action.payload.bcNames;
2897
- var bcUrl = buildBcUrl(calleeBCName, true);
2909
+ var bcUrl = buildBcUrl(calleeBCName, true, state);
2898
2910
  var pendingChanges = state.view.pendingDataChanges[bcNames[0]] || {};
2899
2911
  var params = bcNames.length ? { _bcName: bcNames[bcNames.length - 1] } : {};
2900
2912
  return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter(function (i) { return i._associate; }), params).pipe((0, import_rxjs50.mergeMap)(function (response) {
@@ -2911,15 +2923,16 @@ var saveAssociationsActiveEpic = function (action$, state$, _a) {
2911
2923
  var import_rxjs51 = require("rxjs");
2912
2924
  var changeAssociationSameBcEpic = function (action$, state$) { return action$.pipe((0, import_rxjs51.filter)(changeAssociationSameBc.match), (0, import_rxjs51.mergeMap)(function (action) {
2913
2925
  var _a, _b, _c, _d, _e;
2926
+ var state = state$.value;
2914
2927
  var bcName = action.payload.bcName;
2915
2928
  var result = [
2916
2929
  (0, import_rxjs51.of)(changeDataItem({
2917
2930
  bcName: bcName,
2931
+ bcUrl: buildBcUrl(bcName, true, state),
2918
2932
  cursor: action.payload.dataItem.id,
2919
2933
  dataItem: action.payload.dataItem
2920
2934
  }))
2921
2935
  ];
2922
- var state = state$.value;
2923
2936
  var selected = action.payload.dataItem._associate;
2924
2937
  var depth = action.payload.depth || 1;
2925
2938
  var parentDepth = depth - 1;
@@ -2958,7 +2971,8 @@ var inlinePickListFetchDataEpic = function (action$, state$, _a) {
2958
2971
  return action$.pipe((0, import_rxjs52.filter)(inlinePickListFetchDataRequest.match), (0, import_rxjs52.mergeMap)(function (action) {
2959
2972
  var _a;
2960
2973
  var _b = action.payload, bcName = _b.bcName, searchSpec = _b.searchSpec, searchString = _b.searchString;
2961
- var bcUrl = buildBcUrl(bcName, false);
2974
+ var state = state$.value;
2975
+ var bcUrl = buildBcUrl(bcName, false, state);
2962
2976
  var canceler = api.createCanceler();
2963
2977
  var cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName: bcName, bcUrl: bcUrl }));
2964
2978
  var normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, (_a = {}, _a[searchSpec + ".contains"] = searchString, _a), canceler.cancelToken).pipe((0, import_rxjs52.mergeMap)(function (data) {
@@ -3006,6 +3020,7 @@ var saveAssociationsPassiveEpic = function (action$, state$) { return action$.pi
3006
3020
  })).concat.apply(_a, addedItems);
3007
3021
  return (0, import_rxjs53.of)(changeDataItem({
3008
3022
  bcName: calleeBCName,
3023
+ bcUrl: buildBcUrl(calleeBCName, true, state),
3009
3024
  cursor: cursor,
3010
3025
  dataItem: (_b = {},
3011
3026
  _b[associateFieldKey] = result,