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