@cxbox-ui/core 1.37.2-alpha.1 → 1.37.2-alpha.10
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 +12 -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 +649 -221
- package/dist/cxbox-ui-core.cjs.production.min.js +1 -1
- package/dist/cxbox-ui-core.esm.js +722 -286
- package/dist/cxbox-ui-core.modern.development.js +715 -285
- package/dist/cxbox-ui-core.modern.js +715 -285
- package/dist/cxbox-ui-core.modern.production.min.js +1 -1
- package/dist/epics/screen/apiErrorEpic.d.ts +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/interfaces/bc.d.ts +5 -4
- package/dist/interfaces/widget.d.ts +2 -1
- package/dist/middlewares/autosaveMiddleware.d.ts +2 -17
- package/dist/middlewares/index.d.ts +2 -12
- package/dist/middlewares/popupMiddleware.d.ts +2 -0
- package/dist/middlewares/preInvokeMiddleware.d.ts +2 -5
- package/dist/middlewares/requiredFieldsMiddleware.d.ts +3 -6
- 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/combineMiddlewares.d.ts +1 -12
- package/dist/utils/filters.d.ts +2 -2
- package/dist/utils/strings.d.ts +2 -2
- package/package.json +2 -2
|
@@ -113,6 +113,8 @@ __export(actions_exports, {
|
|
|
113
113
|
processPreInvoke: () => processPreInvoke,
|
|
114
114
|
refreshMeta: () => refreshMeta,
|
|
115
115
|
refreshMetaAndReloadPage: () => refreshMetaAndReloadPage,
|
|
116
|
+
refreshMetaDone: () => refreshMetaDone,
|
|
117
|
+
refreshMetaFail: () => refreshMetaFail,
|
|
116
118
|
removeMultivalueTag: () => removeMultivalueTag,
|
|
117
119
|
removeNotifications: () => removeNotifications,
|
|
118
120
|
removePendingRequest: () => removePendingRequest,
|
|
@@ -163,7 +165,7 @@ var bcFetchRowMetaSuccess = createAction("bcFetchRowMetaSuccess");
|
|
|
163
165
|
var bcFetchRowMetaFail = createAction("bcFetchRowMetaFail");
|
|
164
166
|
var bcNewData = createAction("bcNewData");
|
|
165
167
|
var bcNewDataSuccess = createAction("bcNewDataSuccess");
|
|
166
|
-
var bcNewDataFail = createAction("
|
|
168
|
+
var bcNewDataFail = createAction("bcNewDataFail");
|
|
167
169
|
var bcDeleteDataFail = createAction("bcDeleteDataFail");
|
|
168
170
|
var forceActiveChangeFail = createAction("forceActiveChangeFail");
|
|
169
171
|
var sendOperation = createAction("sendOperation");
|
|
@@ -178,7 +180,7 @@ var drillDown = createAction("drillDown");
|
|
|
178
180
|
var bcChangeCursors = createAction("bcChangeCursors");
|
|
179
181
|
var bcChangeDepthCursor = createAction("bcChangeDepthCursor");
|
|
180
182
|
var changeDataItem = createAction("changeDataItem");
|
|
181
|
-
var changeDataItems = createAction("
|
|
183
|
+
var changeDataItems = createAction("changeDataItems");
|
|
182
184
|
var forceActiveRmUpdate = createAction("forceActiveRmUpdate");
|
|
183
185
|
var showViewPopup = createAction("showViewPopup");
|
|
184
186
|
var showFileUploadPopup = createAction("showFileUploadPopup");
|
|
@@ -232,6 +234,8 @@ var switchDebugMode = createAction("switchDebugMode");
|
|
|
232
234
|
var exportState = createAction("exportState");
|
|
233
235
|
var emptyAction = createAction("emptyAction");
|
|
234
236
|
var refreshMeta = createAction("refreshMeta");
|
|
237
|
+
var refreshMetaDone = createAction("refreshMetaDone");
|
|
238
|
+
var refreshMetaFail = createAction("refreshMetaFail");
|
|
235
239
|
var refreshMetaAndReloadPage = createAction("refreshMetaAndReloadPage");
|
|
236
240
|
var switchRole = createAction("switchRole");
|
|
237
241
|
var addPendingRequest = createAction("addPendingRequest");
|
|
@@ -339,8 +343,10 @@ __export(interfaces_exports, {
|
|
|
339
343
|
PaginationMode: () => PaginationMode,
|
|
340
344
|
PendingValidationFailsFormat: () => PendingValidationFailsFormat,
|
|
341
345
|
PopupWidgetTypes: () => PopupWidgetTypes,
|
|
346
|
+
PositionTypes: () => PositionTypes,
|
|
342
347
|
RouteType: () => RouteType,
|
|
343
348
|
TableLikeWidgetTypes: () => TableLikeWidgetTypes,
|
|
349
|
+
WidgetTypes: () => WidgetTypes2,
|
|
344
350
|
coreOperations: () => coreOperations,
|
|
345
351
|
isCustomWidget: () => isCustomWidget,
|
|
346
352
|
isCustomWidgetConfiguration: () => isCustomWidgetConfiguration,
|
|
@@ -383,6 +389,7 @@ var ApplicationErrorType = /* @__PURE__ */ ((ApplicationErrorType2) => {
|
|
|
383
389
|
})(ApplicationErrorType || {});
|
|
384
390
|
// src/interfaces/widget.ts
|
|
385
391
|
import { WidgetTypes } from "@cxbox-ui/schema";
|
|
392
|
+
import { WidgetTypes as WidgetTypes2, PositionTypes } from "@cxbox-ui/schema";
|
|
386
393
|
var TableLikeWidgetTypes = [
|
|
387
394
|
WidgetTypes.List,
|
|
388
395
|
WidgetTypes.DataGrid,
|
|
@@ -465,6 +472,15 @@ function isViewNavigationCategory(item) {
|
|
|
465
472
|
function isViewNavigationGroup(item) {
|
|
466
473
|
return !!item && "child" in item && !("categoryName" in item);
|
|
467
474
|
}
|
|
475
|
+
// src/reducers/router.ts
|
|
476
|
+
var initialRouterState = { type: "default" /* default */, path: "/", params: null, screenName: null };
|
|
477
|
+
var createRouterReducerBuilderManager = (initialState) => new ReducerBuilderManager().addCase(loginDone, (state, action) => {
|
|
478
|
+
state = __spreadValues(__spreadValues({}, state), action.payload);
|
|
479
|
+
}).addCase(changeLocation, (state, action) => {
|
|
480
|
+
state = __spreadValues(__spreadValues({}, state), action.payload.location);
|
|
481
|
+
});
|
|
482
|
+
// src/reducers/screen.ts
|
|
483
|
+
import { OperationTypeCrud as OperationTypeCrud3 } from "@cxbox-ui/schema";
|
|
468
484
|
// src/utils/index.ts
|
|
469
485
|
var utils_exports = {};
|
|
470
486
|
__export(utils_exports, {
|
|
@@ -485,7 +501,6 @@ __export(utils_exports, {
|
|
|
485
501
|
getBcChildren: () => getBcChildren,
|
|
486
502
|
getDescendants: () => getDescendants,
|
|
487
503
|
getFieldTitle: () => getFieldTitle,
|
|
488
|
-
getFileUploadEndpoint: () => getFileUploadEndpoint,
|
|
489
504
|
getFilterType: () => getFilterType,
|
|
490
505
|
getFilters: () => getFilters,
|
|
491
506
|
getSorters: () => getSorters,
|
|
@@ -525,12 +540,6 @@ function applyRawParams(url, qso) {
|
|
|
525
540
|
const result = new URLSearchParams(qso).toString();
|
|
526
541
|
return `${addTailControlSequences(url)}${result && `${result}`}`;
|
|
527
542
|
}
|
|
528
|
-
function getFileUploadEndpoint(instance) {
|
|
529
|
-
if (!instance.defaults.baseURL) {
|
|
530
|
-
return "/file";
|
|
531
|
-
}
|
|
532
|
-
return instance.defaults.baseURL.endsWith("/") ? `${instance.defaults.baseURL}file` : `${instance.defaults.baseURL}/file`;
|
|
533
|
-
}
|
|
534
543
|
// src/utils/strings.ts
|
|
535
544
|
function getTemplate(literals, ...placeholders) {
|
|
536
545
|
let result = "";
|
|
@@ -541,9 +550,8 @@ function getTemplate(literals, ...placeholders) {
|
|
|
541
550
|
result += literals[literals.length - 1];
|
|
542
551
|
return result;
|
|
543
552
|
}
|
|
544
|
-
function buildBcUrl(bcName, includeSelf = false,
|
|
545
|
-
const
|
|
546
|
-
const bcMap = storeInstance.screen.bo.bc;
|
|
553
|
+
function buildBcUrl(bcName, includeSelf = false, state) {
|
|
554
|
+
const bcMap = state.screen.bo.bc;
|
|
547
555
|
const bc = bcMap[bcName];
|
|
548
556
|
if (!bc) {
|
|
549
557
|
return null;
|
|
@@ -672,7 +680,7 @@ function defaultParseURL(url) {
|
|
|
672
680
|
}
|
|
673
681
|
return {
|
|
674
682
|
type,
|
|
675
|
-
path,
|
|
683
|
+
path: path.length !== 0 && !path.startsWith("/") ? `/${path}` : path,
|
|
676
684
|
params,
|
|
677
685
|
screenName,
|
|
678
686
|
viewName,
|
|
@@ -719,9 +727,9 @@ function getSorters(sorters) {
|
|
|
719
727
|
});
|
|
720
728
|
return result;
|
|
721
729
|
}
|
|
722
|
-
function parseFilters(defaultFilters) {
|
|
730
|
+
function parseFilters(defaultFilters = "") {
|
|
723
731
|
const result = [];
|
|
724
|
-
const urlParams = new URL(defaultFilters).searchParams;
|
|
732
|
+
const urlParams = new URL(defaultFilters, window.location.origin).searchParams;
|
|
725
733
|
urlParams.forEach((param) => {
|
|
726
734
|
const [fieldName, type] = param.split(".");
|
|
727
735
|
if (fieldName && type && urlParams.get(param)) {
|
|
@@ -751,7 +759,7 @@ function parseSorters(sorters) {
|
|
|
751
759
|
return null;
|
|
752
760
|
}
|
|
753
761
|
const result = [];
|
|
754
|
-
const dictionary = new URL(sorters).searchParams;
|
|
762
|
+
const dictionary = new URL(sorters, window.location.origin).searchParams;
|
|
755
763
|
Object.entries(dictionary).map(([sort, fieldKey]) => {
|
|
756
764
|
const [order, direction] = sort.split(".").slice(1);
|
|
757
765
|
return { fieldName: fieldKey, order: Number.parseInt(order, 10), direction };
|
|
@@ -832,12 +840,13 @@ function getBcChildren(originBcName, widgets, bcMap) {
|
|
|
832
840
|
return childrenBcMap;
|
|
833
841
|
}
|
|
834
842
|
function getHierarchyChildBc(originBcName, hierarchyWidget) {
|
|
835
|
-
|
|
836
|
-
|
|
843
|
+
var _a, _b;
|
|
844
|
+
const nestedBcNames = (_b = (_a = hierarchyWidget == null ? void 0 : hierarchyWidget.options) == null ? void 0 : _a.hierarchy) == null ? void 0 : _b.map((nestedItem) => nestedItem.bcName);
|
|
845
|
+
if (originBcName !== hierarchyWidget.bcName && !(nestedBcNames == null ? void 0 : nestedBcNames.includes(originBcName))) {
|
|
837
846
|
return [];
|
|
838
847
|
}
|
|
839
|
-
const childHierarchyBcIndex = nestedBcNames.findIndex((item) => item === originBcName);
|
|
840
|
-
const childHierarchyBcName = nestedBcNames[childHierarchyBcIndex + 1];
|
|
848
|
+
const childHierarchyBcIndex = nestedBcNames == null ? void 0 : nestedBcNames.findIndex((item) => item === originBcName);
|
|
849
|
+
const childHierarchyBcName = nestedBcNames == null ? void 0 : nestedBcNames[childHierarchyBcIndex + 1];
|
|
841
850
|
return [childHierarchyBcName, hierarchyWidget.name];
|
|
842
851
|
}
|
|
843
852
|
function checkShowCondition(condition, cursor, data, pendingDataChanges) {
|
|
@@ -851,9 +860,9 @@ function checkShowCondition(condition, cursor, data, pendingDataChanges) {
|
|
|
851
860
|
if (!record) {
|
|
852
861
|
return false;
|
|
853
862
|
}
|
|
854
|
-
const actualValue = record == null ? void 0 : record[params.fieldKey];
|
|
855
|
-
const pendingValue = (_b = (_a = pendingDataChanges == null ? void 0 : pendingDataChanges[bcName]) == null ? void 0 : _a[cursor]) == null ? void 0 : _b[params.fieldKey];
|
|
856
|
-
return pendingValue !== void 0 ? pendingValue === params.value : actualValue === params.value;
|
|
863
|
+
const actualValue = record == null ? void 0 : record[params == null ? void 0 : params.fieldKey];
|
|
864
|
+
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];
|
|
865
|
+
return pendingValue !== void 0 ? pendingValue === (params == null ? void 0 : params.value) : actualValue === (params == null ? void 0 : params.value);
|
|
857
866
|
}
|
|
858
867
|
// src/utils/tree.ts
|
|
859
868
|
function assignTreeLinks(flat) {
|
|
@@ -861,6 +870,7 @@ function assignTreeLinks(flat) {
|
|
|
861
870
|
const map12 = {};
|
|
862
871
|
const orphans = [];
|
|
863
872
|
result.forEach((item) => {
|
|
873
|
+
var _a, _b;
|
|
864
874
|
if (!item.parentId || item.parentId === "0") {
|
|
865
875
|
return;
|
|
866
876
|
}
|
|
@@ -879,7 +889,7 @@ function assignTreeLinks(flat) {
|
|
|
879
889
|
result[parentIndex].children = [item];
|
|
880
890
|
}
|
|
881
891
|
else {
|
|
882
|
-
result[parentIndex].children.push(item);
|
|
892
|
+
(_b = (_a = result[parentIndex]) == null ? void 0 : _a.children) == null ? void 0 : _b.push(item);
|
|
883
893
|
}
|
|
884
894
|
});
|
|
885
895
|
if (orphans.length) {
|
|
@@ -955,22 +965,7 @@ function deleteUndefinedFromObject(obj) {
|
|
|
955
965
|
}
|
|
956
966
|
});
|
|
957
967
|
}
|
|
958
|
-
// src/reducers/router.ts
|
|
959
|
-
var initialRouterState = { type: "default" /* default */, path: "/", params: null, screenName: null };
|
|
960
|
-
var createRouterReducerBuilderManager = (initialState) => new ReducerBuilderManager().addCase(loginDone, (state, action) => {
|
|
961
|
-
state = __spreadValues(__spreadValues({}, state), action.payload);
|
|
962
|
-
}).addCase(changeLocation, (state, action) => {
|
|
963
|
-
const { url, route } = action.payload;
|
|
964
|
-
if (url) {
|
|
965
|
-
const path = new URL(url);
|
|
966
|
-
state = __spreadValues(__spreadValues({}, state), defaultParseURL(path));
|
|
967
|
-
}
|
|
968
|
-
if (route !== null) {
|
|
969
|
-
state = __spreadValues(__spreadValues({}, state), route);
|
|
970
|
-
}
|
|
971
|
-
});
|
|
972
968
|
// src/reducers/screen.ts
|
|
973
|
-
import { OperationTypeCrud as OperationTypeCrud3 } from "@cxbox-ui/schema";
|
|
974
969
|
var initialScreenState = {
|
|
975
970
|
screenName: "",
|
|
976
971
|
bo: { activeBcName: "", bc: {} },
|
|
@@ -982,10 +977,11 @@ var initialScreenState = {
|
|
|
982
977
|
};
|
|
983
978
|
var operationsHandledLocally = [OperationTypeCrud3.associate, OperationTypeCrud3.fileUpload];
|
|
984
979
|
var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderManager().addCase(selectScreen, (state, action) => {
|
|
980
|
+
var _a, _b, _c, _d, _e;
|
|
985
981
|
const bcDictionary = {};
|
|
986
982
|
const bcSorters = {};
|
|
987
983
|
const bcFilters = {};
|
|
988
|
-
action.payload.screen.meta.bo.bc.forEach((item) => {
|
|
984
|
+
(_a = action.payload.screen.meta) == null ? void 0 : _a.bo.bc.forEach((item) => {
|
|
989
985
|
bcDictionary[item.name] = item;
|
|
990
986
|
const sorter = parseSorters(item.defaultSort);
|
|
991
987
|
const filter56 = parseFilters(item.defaultFilter);
|
|
@@ -997,8 +993,8 @@ var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderMana
|
|
|
997
993
|
}
|
|
998
994
|
});
|
|
999
995
|
state.screenName = action.payload.screen.name;
|
|
1000
|
-
state.primaryView = action.payload.screen.meta.primary;
|
|
1001
|
-
state.views = action.payload.screen.meta.views;
|
|
996
|
+
state.primaryView = (_c = (_b = action.payload.screen.meta) == null ? void 0 : _b.primary) != null ? _c : state.primaryView;
|
|
997
|
+
state.views = (_e = (_d = action.payload.screen.meta) == null ? void 0 : _d.views) != null ? _e : state.views;
|
|
1002
998
|
state.bo = { activeBcName: null, bc: bcDictionary };
|
|
1003
999
|
state.sorters = __spreadValues(__spreadValues({}, state.sorters), bcSorters);
|
|
1004
1000
|
state.filters = __spreadValues(__spreadValues({}, state.filters), bcFilters);
|
|
@@ -1008,12 +1004,14 @@ var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderMana
|
|
|
1008
1004
|
}).addCase(bcFetchDataRequest, (state, action) => {
|
|
1009
1005
|
state.bo.bc[action.payload.bcName].loading = true;
|
|
1010
1006
|
}).addCase(bcLoadMore, (state, action) => {
|
|
1007
|
+
var _a;
|
|
1011
1008
|
const currentBc = state.bo.bc[action.payload.bcName];
|
|
1012
|
-
currentBc.page
|
|
1009
|
+
currentBc.page = ((_a = currentBc.page) != null ? _a : 1) + 1;
|
|
1013
1010
|
currentBc.loading = true;
|
|
1014
1011
|
}).addCase(selectView, (state, action) => {
|
|
1012
|
+
var _a;
|
|
1015
1013
|
const newBcs = {};
|
|
1016
|
-
Array.from(new Set(action.payload.widgets.map((widget) => widget.bcName))
|
|
1014
|
+
Array.from(new Set((_a = action.payload.widgets) == null ? void 0 : _a.map((widget) => widget.bcName))
|
|
1017
1015
|
// БК которые есть на вьюхе
|
|
1018
1016
|
).filter((bcName) => state.bo.bc[bcName]).forEach((bcName) => {
|
|
1019
1017
|
newBcs[bcName] = __spreadProps(__spreadValues({}, state.bo.bc[bcName]), { page: 1 });
|
|
@@ -1025,9 +1023,10 @@ var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderMana
|
|
|
1025
1023
|
currentBc.loading = false;
|
|
1026
1024
|
state.cachedBc[action.payload.bcName] = action.payload.bcUrl;
|
|
1027
1025
|
}).addCase(bcFetchDataFail, (state, action) => {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
state.
|
|
1026
|
+
const bcName = action.payload.bcName;
|
|
1027
|
+
if (Object.values(state.bo.bc).some((bc) => bc.name === bcName)) {
|
|
1028
|
+
state.bo.bc[bcName].loading = false;
|
|
1029
|
+
state.cachedBc[bcName] = action.payload.bcUrl;
|
|
1031
1030
|
}
|
|
1032
1031
|
}).addCase(sendOperation, (state, action) => {
|
|
1033
1032
|
if (!operationsHandledLocally.includes(action.payload.operationType)) {
|
|
@@ -1055,10 +1054,12 @@ var createScreenReducerBuilderManager = (initialState) => new ReducerBuilderMana
|
|
|
1055
1054
|
Object.assign(state.bo.bc, newCursors);
|
|
1056
1055
|
Object.assign(state.cachedBc, newCache);
|
|
1057
1056
|
}).addCase(bcChangeDepthCursor, (state, action) => {
|
|
1057
|
+
var _a;
|
|
1058
1058
|
if (action.payload.depth === 1) {
|
|
1059
1059
|
state.bo.bc[action.payload.bcName].cursor = action.payload.cursor;
|
|
1060
1060
|
}
|
|
1061
1061
|
else {
|
|
1062
|
+
state.bo.bc[action.payload.bcName].depthBc = (_a = state.bo.bc[action.payload.bcName].depthBc) != null ? _a : {};
|
|
1062
1063
|
state.bo.bc[action.payload.bcName].depthBc[action.payload.depth].cursor = action.payload.cursor;
|
|
1063
1064
|
}
|
|
1064
1065
|
}).addCase(bcSelectRecord, (state, action) => {
|
|
@@ -1142,9 +1143,11 @@ var createSessionReducerBuilderManager = (initialState) => new ReducerBuilderMan
|
|
|
1142
1143
|
}).addCase(switchDebugMode, (state, action) => {
|
|
1143
1144
|
state.debugMode = action.payload;
|
|
1144
1145
|
}).addCase(addPendingRequest, (state, action) => {
|
|
1145
|
-
|
|
1146
|
+
var _a;
|
|
1147
|
+
(_a = state.pendingRequests) == null ? void 0 : _a.push(action.payload.request);
|
|
1146
1148
|
}).addCase(removePendingRequest, (state, action) => {
|
|
1147
|
-
|
|
1149
|
+
var _a;
|
|
1150
|
+
state.pendingRequests = (_a = state.pendingRequests) == null ? void 0 : _a.filter((item) => item.requestId !== action.payload.requestId);
|
|
1148
1151
|
}).addCase(addNotification, (state, action) => {
|
|
1149
1152
|
state.notifications.push(action.payload);
|
|
1150
1153
|
}).addCase(removeNotifications, (state, action) => {
|
|
@@ -1191,11 +1194,14 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1191
1194
|
state.metaInProgress[action.payload.bcName] = true;
|
|
1192
1195
|
}
|
|
1193
1196
|
}).addCase(bcFetchRowMetaSuccess, (state, action) => {
|
|
1197
|
+
var _a;
|
|
1198
|
+
state.rowMeta[action.payload.bcName] = (_a = state.rowMeta[action.payload.bcName]) != null ? _a : {};
|
|
1194
1199
|
state.rowMeta[action.payload.bcName][action.payload.bcUrl] = action.payload.rowMeta;
|
|
1195
1200
|
state.metaInProgress[action.payload.bcName] = false;
|
|
1196
1201
|
}).addCase(bcNewDataSuccess, (state, action) => {
|
|
1197
1202
|
state.selectedCell = initialViewState.selectedCell;
|
|
1198
1203
|
}).addCase(forceActiveRmUpdate, (state, action) => {
|
|
1204
|
+
var _a, _b, _c, _d;
|
|
1199
1205
|
const { bcName, bcUrl, currentRecordData, rowMeta, cursor } = action.payload;
|
|
1200
1206
|
const handledForceActive = {};
|
|
1201
1207
|
const rowMetaForcedValues = {};
|
|
@@ -1219,17 +1225,21 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1219
1225
|
handledForceActive[key] = newPendingDataChanges[key];
|
|
1220
1226
|
}
|
|
1221
1227
|
});
|
|
1228
|
+
state.handledForceActive[bcName] = (_a = state.handledForceActive[bcName]) != null ? _a : {};
|
|
1229
|
+
state.handledForceActive[bcName][cursor] = (_b = state.handledForceActive[bcName][cursor]) != null ? _b : {};
|
|
1222
1230
|
Object.assign(state.handledForceActive[bcName][cursor], handledForceActive);
|
|
1231
|
+
state.pendingDataChanges[bcName] = (_c = state.pendingDataChanges[bcName]) != null ? _c : {};
|
|
1223
1232
|
state.pendingDataChanges[bcName][cursor] = newPendingDataChanges;
|
|
1233
|
+
state.rowMeta[bcName] = (_d = state.rowMeta[bcName]) != null ? _d : {};
|
|
1224
1234
|
state.rowMeta[bcName][bcUrl] = rowMeta;
|
|
1225
1235
|
}).addCase(changeDataItem, (state, action) => {
|
|
1226
|
-
var _a;
|
|
1236
|
+
var _a, _b, _c;
|
|
1227
1237
|
const actionBcName = action.payload.bcName;
|
|
1228
1238
|
const prevBc = state.pendingDataChanges[action.payload.bcName] || {};
|
|
1229
1239
|
const prevCursor = prevBc[action.payload.cursor] || {};
|
|
1230
1240
|
const prevPending = prevCursor || {};
|
|
1231
1241
|
const nextPending = __spreadValues(__spreadValues({}, prevPending), action.payload.dataItem);
|
|
1232
|
-
const bcUrl =
|
|
1242
|
+
const bcUrl = action.payload.bcUrl;
|
|
1233
1243
|
const rowMeta = (_a = state.rowMeta[actionBcName]) == null ? void 0 : _a[bcUrl];
|
|
1234
1244
|
const nextValidationFails = {};
|
|
1235
1245
|
const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
@@ -1240,10 +1250,11 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1240
1250
|
nextValidationFails[fieldKey] = "This field is mandatory";
|
|
1241
1251
|
}
|
|
1242
1252
|
});
|
|
1253
|
+
state.pendingDataChanges[action.payload.bcName] = (_b = state.pendingDataChanges[action.payload.bcName]) != null ? _b : {};
|
|
1243
1254
|
state.pendingDataChanges[action.payload.bcName][action.payload.cursor] = nextPending;
|
|
1244
1255
|
if (isTargetFormatPVF) {
|
|
1245
1256
|
;
|
|
1246
|
-
state.pendingValidationFails[actionBcName][action.payload.cursor] = nextValidationFails;
|
|
1257
|
+
((_c = state.pendingValidationFails) == null ? void 0 : _c[actionBcName])[action.payload.cursor] = nextValidationFails;
|
|
1247
1258
|
}
|
|
1248
1259
|
else {
|
|
1249
1260
|
state.pendingValidationFails = nextValidationFails;
|
|
@@ -1264,7 +1275,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1264
1275
|
pendingDataChanges[bcName] = pendingBcChanges;
|
|
1265
1276
|
});
|
|
1266
1277
|
const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1267
|
-
const pendingValidationFails = __spreadValues({}, state.pendingValidationFails);
|
|
1278
|
+
const pendingValidationFails = state.pendingValidationFails ? __spreadValues({}, state.pendingValidationFails) : {};
|
|
1268
1279
|
if (isTargetFormatPVF) {
|
|
1269
1280
|
action.payload.bcNames.forEach((i) => {
|
|
1270
1281
|
pendingValidationFails[i] = {};
|
|
@@ -1279,6 +1290,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1279
1290
|
}).addCase(bcFetchRowMetaFail, (state, action) => {
|
|
1280
1291
|
state.metaInProgress[action.payload.bcName] = false;
|
|
1281
1292
|
}).addCase(forceActiveChangeFail, (state, action) => {
|
|
1293
|
+
var _a;
|
|
1282
1294
|
const { bcName, bcUrl, entityError } = action.payload;
|
|
1283
1295
|
const errors = {};
|
|
1284
1296
|
if (entityError) {
|
|
@@ -1286,8 +1298,10 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1286
1298
|
errors[fieldName] = violation;
|
|
1287
1299
|
});
|
|
1288
1300
|
}
|
|
1301
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) != null ? _a : {};
|
|
1289
1302
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1290
1303
|
}).addCase(bcSaveDataFail, (state, action) => {
|
|
1304
|
+
var _a;
|
|
1291
1305
|
const { bcName, bcUrl, entityError } = action.payload;
|
|
1292
1306
|
const errors = {};
|
|
1293
1307
|
if (entityError) {
|
|
@@ -1295,8 +1309,10 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1295
1309
|
errors[fieldName] = violation;
|
|
1296
1310
|
});
|
|
1297
1311
|
}
|
|
1312
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) != null ? _a : {};
|
|
1298
1313
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1299
1314
|
}).addCase(sendOperationFail, (state, action) => {
|
|
1315
|
+
var _a;
|
|
1300
1316
|
const { bcName, bcUrl, entityError } = action.payload;
|
|
1301
1317
|
const errors = {};
|
|
1302
1318
|
if (entityError) {
|
|
@@ -1304,30 +1320,38 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1304
1320
|
errors[fieldName] = violation;
|
|
1305
1321
|
});
|
|
1306
1322
|
}
|
|
1323
|
+
state.rowMeta[bcName] = (_a = state.rowMeta[bcName]) != null ? _a : {};
|
|
1307
1324
|
state.rowMeta[bcName][bcUrl].errors = errors;
|
|
1308
1325
|
}).addCase(sendOperationSuccess, (state, action) => {
|
|
1309
|
-
|
|
1326
|
+
var _a, _b, _c;
|
|
1327
|
+
const bcName = action.payload.bcName;
|
|
1328
|
+
const cursor = action.payload.cursor;
|
|
1310
1329
|
const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1330
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) != null ? _a : {};
|
|
1311
1331
|
state.pendingDataChanges[bcName][cursor] = {};
|
|
1312
1332
|
if (isTargetFormatPVF) {
|
|
1313
1333
|
;
|
|
1314
|
-
state.pendingValidationFails[bcName][cursor] = {};
|
|
1334
|
+
((_b = state.pendingValidationFails) == null ? void 0 : _b[bcName])[cursor] = {};
|
|
1315
1335
|
}
|
|
1316
1336
|
else {
|
|
1317
1337
|
state.pendingValidationFails = initialViewState.pendingValidationFails;
|
|
1318
1338
|
}
|
|
1339
|
+
state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) != null ? _c : {};
|
|
1319
1340
|
state.handledForceActive[bcName][cursor] = {};
|
|
1320
1341
|
}).addCase(bcSaveDataSuccess, (state, action) => {
|
|
1342
|
+
var _a, _b, _c;
|
|
1321
1343
|
const { bcName, cursor } = action.payload;
|
|
1322
1344
|
const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1345
|
+
state.pendingDataChanges[bcName] = (_a = state.pendingDataChanges[bcName]) != null ? _a : {};
|
|
1323
1346
|
state.pendingDataChanges[bcName][cursor] = {};
|
|
1324
1347
|
if (isTargetFormatPVF) {
|
|
1325
1348
|
;
|
|
1326
|
-
state.pendingValidationFails[bcName][cursor] = {};
|
|
1349
|
+
((_b = state.pendingValidationFails) == null ? void 0 : _b[bcName])[cursor] = {};
|
|
1327
1350
|
}
|
|
1328
1351
|
else {
|
|
1329
1352
|
state.pendingValidationFails = initialViewState.pendingValidationFails;
|
|
1330
1353
|
}
|
|
1354
|
+
state.handledForceActive[bcName] = (_c = state.handledForceActive[bcName]) != null ? _c : {};
|
|
1331
1355
|
state.handledForceActive[bcName][cursor] = {};
|
|
1332
1356
|
}).addCase(bcCancelPendingChanges, (state, action) => {
|
|
1333
1357
|
var _a, _b;
|
|
@@ -1338,7 +1362,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1338
1362
|
}
|
|
1339
1363
|
}
|
|
1340
1364
|
const isTargetFormatPVF = state.pendingValidationFailsFormat === "target" /* target */;
|
|
1341
|
-
let pendingValidationFails = __spreadValues({}, state.pendingValidationFails);
|
|
1365
|
+
let pendingValidationFails = state.pendingValidationFails ? __spreadValues({}, state.pendingValidationFails) : {};
|
|
1342
1366
|
if (isTargetFormatPVF) {
|
|
1343
1367
|
if (((_b = (_a = action.payload) == null ? void 0 : _a.bcNames) == null ? void 0 : _b.length) > 0) {
|
|
1344
1368
|
action.payload.bcNames.forEach((i) => {
|
|
@@ -1367,8 +1391,8 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1367
1391
|
isFilter
|
|
1368
1392
|
};
|
|
1369
1393
|
}).addCase(showFileUploadPopup, (state, action) => {
|
|
1370
|
-
var _a;
|
|
1371
|
-
const bcName = (_a = state.widgets.find((item) => item.name === action.payload.widgetName)) == null ? void 0 :
|
|
1394
|
+
var _a, _b;
|
|
1395
|
+
const bcName = (_b = (_a = state.widgets) == null ? void 0 : _a.find((item) => item.name === action.payload.widgetName)) == null ? void 0 : _b.bcName;
|
|
1372
1396
|
state.popupData = {
|
|
1373
1397
|
type: "file-upload",
|
|
1374
1398
|
bcName,
|
|
@@ -1380,6 +1404,7 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1380
1404
|
}).addCase(viewClearPickMap, (state) => {
|
|
1381
1405
|
state.pickMap = null;
|
|
1382
1406
|
}).addCase(closeViewPopup, (state) => {
|
|
1407
|
+
state.popupData = {};
|
|
1383
1408
|
state.popupData.bcName = null;
|
|
1384
1409
|
}).addCase(selectTableCell, (state, action) => {
|
|
1385
1410
|
state.selectedCell = { widgetName: action.payload.widgetName, rowId: action.payload.rowId, fieldKey: action.payload.fieldKey };
|
|
@@ -1387,12 +1412,16 @@ var createViewReducerBuilderManager = (initialState) => new ReducerBuilderManage
|
|
|
1387
1412
|
state.pendingDataChanges = initialViewState.pendingDataChanges;
|
|
1388
1413
|
state.selectedCell = initialViewState.selectedCell;
|
|
1389
1414
|
}).addCase(showNotification, (state, action) => {
|
|
1415
|
+
var _a, _b;
|
|
1416
|
+
state.systemNotifications = (_a = state.systemNotifications) != null ? _a : [];
|
|
1390
1417
|
state.systemNotifications.push({
|
|
1391
1418
|
type: action.payload.type,
|
|
1392
1419
|
message: action.payload.message,
|
|
1393
|
-
id: state.systemNotifications.length
|
|
1420
|
+
id: (_b = state.systemNotifications) == null ? void 0 : _b.length
|
|
1394
1421
|
});
|
|
1395
1422
|
}).addCase(closeNotification, (state, action) => {
|
|
1423
|
+
var _a;
|
|
1424
|
+
state.systemNotifications = (_a = state.systemNotifications) != null ? _a : [];
|
|
1396
1425
|
state.systemNotifications = state.systemNotifications.filter((item) => item.id !== action.payload.id);
|
|
1397
1426
|
}).addCase(showViewError, (state, action) => {
|
|
1398
1427
|
state.error = action.payload.error;
|
|
@@ -1440,7 +1469,6 @@ __export(epics_exports, {
|
|
|
1440
1469
|
httpError500Epic: () => httpError500Epic,
|
|
1441
1470
|
httpErrorDefaultEpic: () => httpErrorDefaultEpic,
|
|
1442
1471
|
inlinePickListFetchDataEpic: () => inlinePickListFetchDataEpic,
|
|
1443
|
-
knownHttpErrors: () => knownHttpErrors,
|
|
1444
1472
|
loginByAnotherRoleEpic: () => loginByAnotherRoleEpic,
|
|
1445
1473
|
loginDoneEpic: () => loginDoneEpic,
|
|
1446
1474
|
loginDoneSessionEpic: () => loginDoneSessionEpic,
|
|
@@ -1499,7 +1527,7 @@ var sendOperationEpic = (action$, state$, { api }) => action$.pipe(filter(sendOp
|
|
|
1499
1527
|
const screenName = state.screen.screenName;
|
|
1500
1528
|
const { bcName, operationType, widgetName } = action.payload;
|
|
1501
1529
|
const confirm = ((_a = action.payload.confirmOperation) == null ? void 0 : _a.type) || action.payload.confirm;
|
|
1502
|
-
const bcUrl = buildBcUrl(bcName, true);
|
|
1530
|
+
const bcUrl = buildBcUrl(bcName, true, state);
|
|
1503
1531
|
const bc = state.screen.bo.bc[bcName];
|
|
1504
1532
|
const rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) == null ? void 0 : _b[bcUrl]);
|
|
1505
1533
|
const fields = rowMeta == null ? void 0 : rowMeta.fields;
|
|
@@ -1507,7 +1535,7 @@ var sendOperationEpic = (action$, state$, { api }) => action$.pipe(filter(sendOp
|
|
|
1507
1535
|
const record = (_c = state.data[bcName]) == null ? void 0 : _c.find((item) => item.id === bc.cursor);
|
|
1508
1536
|
const filters = state.screen.filters[bcName];
|
|
1509
1537
|
const sorters = state.screen.sorters[bcName];
|
|
1510
|
-
const pendingRecordChange = (_d = state.view.pendingDataChanges[bcName]) == null ? void 0 : _d[bc.cursor];
|
|
1538
|
+
const pendingRecordChange = __spreadValues({}, (_d = state.view.pendingDataChanges[bcName]) == null ? void 0 : _d[bc.cursor]);
|
|
1511
1539
|
for (const key in pendingRecordChange) {
|
|
1512
1540
|
if (fields.find((item) => item.key === key && item.disabled)) {
|
|
1513
1541
|
delete pendingRecordChange[key];
|
|
@@ -1523,10 +1551,10 @@ var sendOperationEpic = (action$, state$, { api }) => action$.pipe(filter(sendOp
|
|
|
1523
1551
|
}
|
|
1524
1552
|
const context = { widgetName: action.payload.widgetName };
|
|
1525
1553
|
return api.customAction(screenName, bcUrl, data, context, params).pipe(mergeMap((response) => {
|
|
1526
|
-
var _a2;
|
|
1527
|
-
const postInvoke = response.postActions[0];
|
|
1554
|
+
var _a2, _b2;
|
|
1555
|
+
const postInvoke = (_a2 = response.postActions) == null ? void 0 : _a2[0];
|
|
1528
1556
|
const preInvoke = response.preInvoke;
|
|
1529
|
-
return defaultSaveOperation ? ((
|
|
1557
|
+
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));
|
|
1530
1558
|
}), catchError((e) => {
|
|
1531
1559
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
1532
1560
|
console.error(e);
|
|
@@ -1542,12 +1570,12 @@ var sendOperationEpic = (action$, state$, { api }) => action$.pipe(filter(sendOp
|
|
|
1542
1570
|
}));
|
|
1543
1571
|
// src/epics/view/showAssocPopupEpic.ts
|
|
1544
1572
|
import { EMPTY as EMPTY2, filter as filter2, mergeMap as mergeMap2, of as of3 } from "rxjs";
|
|
1545
|
-
import { WidgetTypes as
|
|
1573
|
+
import { WidgetTypes as WidgetTypes3 } from "@cxbox-ui/schema";
|
|
1546
1574
|
var showAssocPopupEpic = (action$, state$) => action$.pipe(filter2(showViewPopup.match), filter2((action) => !!(action.payload.calleeBCName && action.payload.associateFieldKey)), mergeMap2((action) => {
|
|
1547
1575
|
var _a, _b, _c, _d;
|
|
1548
1576
|
const { bcName, calleeBCName } = action.payload;
|
|
1549
1577
|
const state = state$.value;
|
|
1550
|
-
const assocWidget = state.view.widgets.find((widget) => widget.bcName === bcName && widget.type ===
|
|
1578
|
+
const assocWidget = state.view.widgets.find((widget) => widget.bcName === bcName && widget.type === WidgetTypes3.AssocListPopup);
|
|
1551
1579
|
const calleeCursor = (_a = state.screen.bo.bc[calleeBCName]) == null ? void 0 : _a.cursor;
|
|
1552
1580
|
const calleePendingChanges = (_b = state.view.pendingDataChanges[calleeBCName]) == null ? void 0 : _b[calleeCursor];
|
|
1553
1581
|
const assocFieldKey = action.payload.associateFieldKey;
|
|
@@ -1587,16 +1615,17 @@ var showAssocPopupEpic = (action$, state$) => action$.pipe(filter2(showViewPopup
|
|
|
1587
1615
|
import { concat as concat2, filter as filter3, mergeMap as mergeMap3, of as of4 } from "rxjs";
|
|
1588
1616
|
import { OperationTypeCrud as OperationTypeCrud5 } from "@cxbox-ui/schema";
|
|
1589
1617
|
var fileUploadConfirmEpic = (action$, state$, { api }) => action$.pipe(filter3(bulkUploadFiles.match), mergeMap3((action) => {
|
|
1590
|
-
var _a;
|
|
1618
|
+
var _a, _b;
|
|
1591
1619
|
const state = state$.value;
|
|
1592
|
-
const bcName = state.view.popupData.bcName;
|
|
1593
|
-
const bcUrl = buildBcUrl(bcName, true);
|
|
1594
|
-
const widgetName = (
|
|
1620
|
+
const bcName = (_a = state.view.popupData) == null ? void 0 : _a.bcName;
|
|
1621
|
+
const bcUrl = buildBcUrl(bcName, true, state);
|
|
1622
|
+
const widgetName = (_b = state.view.widgets.find((item) => item.bcName === bcName)) == null ? void 0 : _b.name;
|
|
1595
1623
|
const data = {
|
|
1596
1624
|
bulkIds: action.payload.fileIds
|
|
1597
1625
|
};
|
|
1598
1626
|
return api.customAction(state.screen.screenName, bcUrl, data, null, { _action: "file-upload-save" }).pipe(mergeMap3((response) => {
|
|
1599
|
-
|
|
1627
|
+
var _a2;
|
|
1628
|
+
const postInvoke = (_a2 = response.postActions) == null ? void 0 : _a2[0];
|
|
1600
1629
|
const preInvoke = response.preInvoke;
|
|
1601
1630
|
return concat2(of4(sendOperationSuccess({ bcName, cursor: null })), of4(bcForceUpdate({ bcName })), of4(closeViewPopup(null)), ...postOperationRoutine(widgetName, postInvoke, preInvoke, OperationTypeCrud5.save, bcName));
|
|
1602
1631
|
}));
|
|
@@ -1609,14 +1638,14 @@ var selectTableCellInitEpic = (action$, state$) => action$.pipe(filter4(selectTa
|
|
|
1609
1638
|
const state = state$.value;
|
|
1610
1639
|
const { rowId: nextRowId, fieldKey } = action.payload;
|
|
1611
1640
|
const nextWidget = state.view.widgets.find((widget) => widget.name === action.payload.widgetName);
|
|
1612
|
-
const nextBcName = nextWidget.bcName;
|
|
1641
|
+
const nextBcName = nextWidget == null ? void 0 : nextWidget.bcName;
|
|
1613
1642
|
const nextBcCursor = (_a = state.screen.bo.bc[nextBcName]) == null ? void 0 : _a.cursor;
|
|
1614
1643
|
const selectedCell = state.view.selectedCell;
|
|
1615
1644
|
if (nextRowId !== nextBcCursor) {
|
|
1616
1645
|
resultObservables.push(of5(bcSelectRecord({ bcName: nextBcName, cursor: nextRowId })));
|
|
1617
1646
|
}
|
|
1618
|
-
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || nextWidget.name !== selectedCell.widgetName) {
|
|
1619
|
-
resultObservables.push(of5(selectTableCell({ widgetName: nextWidget.name, rowId: nextRowId, fieldKey })));
|
|
1647
|
+
if (!selectedCell || fieldKey !== selectedCell.fieldKey || nextRowId !== selectedCell.rowId || (nextWidget == null ? void 0 : nextWidget.name) !== selectedCell.widgetName) {
|
|
1648
|
+
resultObservables.push(of5(selectTableCell({ widgetName: nextWidget == null ? void 0 : nextWidget.name, rowId: nextRowId, fieldKey })));
|
|
1620
1649
|
}
|
|
1621
1650
|
return concat3(...resultObservables);
|
|
1622
1651
|
}));
|
|
@@ -1640,7 +1669,7 @@ var sendOperationAssociateEpic = (action$, state$) => action$.pipe(filter6(sendO
|
|
|
1640
1669
|
}));
|
|
1641
1670
|
// src/epics/view/getRowMetaByForceActiveEpic.ts
|
|
1642
1671
|
import { EMPTY as EMPTY3, concat as concat5, filter as filter7, mergeMap as mergeMap6, of as of7, catchError as catchError2 } from "rxjs";
|
|
1643
|
-
import { WidgetTypes as
|
|
1672
|
+
import { WidgetTypes as WidgetTypes4 } from "@cxbox-ui/schema";
|
|
1644
1673
|
import { nanoid } from "@reduxjs/toolkit";
|
|
1645
1674
|
var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(filter7(changeDataItem.match), mergeMap6((action) => {
|
|
1646
1675
|
var _a, _b, _c, _d;
|
|
@@ -1649,22 +1678,22 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1649
1678
|
const { bcName, cursor, disableRetry } = action.payload;
|
|
1650
1679
|
const isBcHierarchy = state.view.widgets.some((widget) => {
|
|
1651
1680
|
var _a2, _b2;
|
|
1652
|
-
return widget.bcName === bcName && widget.type ===
|
|
1681
|
+
return widget.bcName === bcName && widget.type === WidgetTypes4.AssocListPopup && (((_a2 = widget.options) == null ? void 0 : _a2.hierarchySameBc) || ((_b2 = widget.options) == null ? void 0 : _b2.hierarchyFull));
|
|
1653
1682
|
});
|
|
1654
1683
|
if (isBcHierarchy) {
|
|
1655
1684
|
return EMPTY3;
|
|
1656
1685
|
}
|
|
1657
1686
|
const isPickListPopup = state.view.widgets.find((item) => {
|
|
1658
1687
|
var _a2;
|
|
1659
|
-
return item.name === ((_a2 = state.view.popupData) == null ? void 0 : _a2.widgetName) && [
|
|
1688
|
+
return item.name === ((_a2 = state.view.popupData) == null ? void 0 : _a2.widgetName) && [WidgetTypes4.PickListPopup, WidgetTypes4.FlatTreePopup].includes(item.type);
|
|
1660
1689
|
});
|
|
1661
|
-
const bcUrl = buildBcUrl(bcName, true);
|
|
1690
|
+
const bcUrl = buildBcUrl(bcName, true, state);
|
|
1662
1691
|
const pendingChanges = state.view.pendingDataChanges[bcName][cursor];
|
|
1663
1692
|
const handledForceActive = ((_a = state.view.handledForceActive[bcName]) == null ? void 0 : _a[cursor]) || {};
|
|
1664
1693
|
const currentRecordData = (_b = state.data[bcName]) == null ? void 0 : _b.find((record) => record.id === cursor);
|
|
1665
1694
|
const fieldsRowMeta = (_d = (_c = state.view.rowMeta[bcName]) == null ? void 0 : _c[bcUrl]) == null ? void 0 : _d.fields;
|
|
1666
1695
|
let changedFiledKey = null;
|
|
1667
|
-
const closePopup = concat5(of7(
|
|
1696
|
+
const closePopup = concat5(of7(closeViewPopup(null)), of7(viewClearPickMap(null)), of7(bcRemoveAllFilters({ bcName })));
|
|
1668
1697
|
const someForceActiveChanged = fieldsRowMeta == null ? void 0 : fieldsRowMeta.filter((field) => field.forceActive && pendingChanges[field.key] !== void 0).some((field) => {
|
|
1669
1698
|
const result = pendingChanges[field.key] !== handledForceActive[field.key];
|
|
1670
1699
|
if (result) {
|
|
@@ -1674,7 +1703,7 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1674
1703
|
});
|
|
1675
1704
|
const requestId = nanoid();
|
|
1676
1705
|
if (someForceActiveChanged && !disableRetry) {
|
|
1677
|
-
return concat5(of7(addPendingRequest({ request: { requestId, type: "force-active" } })), api.getRmByForceActive(state.screen.screenName, bcUrl, __spreadProps(__spreadValues({}, pendingChanges), { vstamp: currentRecordData.vstamp })).pipe(mergeMap6((data) => {
|
|
1706
|
+
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) => {
|
|
1678
1707
|
const result = [of7(removePendingRequest({ requestId }))];
|
|
1679
1708
|
if (state.view.url === initUrl) {
|
|
1680
1709
|
result.push(of7(forceActiveRmUpdate({
|
|
@@ -1701,8 +1730,9 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1701
1730
|
}
|
|
1702
1731
|
return concat5(of7(removePendingRequest({ requestId })), state.view.url === initUrl ? concat5(of7(changeDataItem({
|
|
1703
1732
|
bcName,
|
|
1733
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
1704
1734
|
cursor,
|
|
1705
|
-
dataItem: { [changedFiledKey]: currentRecordData[changedFiledKey] },
|
|
1735
|
+
dataItem: { [changedFiledKey]: currentRecordData == null ? void 0 : currentRecordData[changedFiledKey] },
|
|
1706
1736
|
disableRetry: true
|
|
1707
1737
|
})), of7(forceActiveChangeFail({ bcName, bcUrl, viewError, entityError }))) : EMPTY3);
|
|
1708
1738
|
})));
|
|
@@ -1713,9 +1743,14 @@ var getRowMetaByForceActiveEpic = (action$, state$, { api }) => action$.pipe(fil
|
|
|
1713
1743
|
import { concat as concat6, filter as filter8, mergeMap as mergeMap7, of as of8 } from "rxjs";
|
|
1714
1744
|
var showAllTableRecordsInitEpic = (action$, state$) => action$.pipe(filter8(showAllTableRecordsInit.match), mergeMap7((action) => {
|
|
1715
1745
|
const resultObservables = [];
|
|
1716
|
-
const { bcName } = action.payload;
|
|
1746
|
+
const { bcName, cursor } = action.payload;
|
|
1747
|
+
const state = state$.value;
|
|
1748
|
+
const route = state.router;
|
|
1717
1749
|
resultObservables.push(of8(bcChangeCursors({ cursorsMap: { [bcName]: null } })));
|
|
1750
|
+
const bcPath = route.bcPath.slice(0, route.bcPath.indexOf(`${bcName}/${cursor}`));
|
|
1751
|
+
const url = defaultBuildURL(__spreadProps(__spreadValues({}, route), { bcPath }));
|
|
1718
1752
|
resultObservables.push(of8(bcForceUpdate({ bcName })));
|
|
1753
|
+
resultObservables.push(of8(changeLocation({ location: defaultParseURL(new URL(url, window.location.origin)) })));
|
|
1719
1754
|
return concat6(...resultObservables);
|
|
1720
1755
|
}));
|
|
1721
1756
|
// src/epics/view/clearPendingDataChangesAfterCursorChangeEpic.ts
|
|
@@ -1737,10 +1772,107 @@ var clearPendingDataChangesAfterCursorChangeEpic = (action$, state$) => action$.
|
|
|
1737
1772
|
return EMPTY4;
|
|
1738
1773
|
}));
|
|
1739
1774
|
// src/epics/router/drilldownEpic.ts
|
|
1740
|
-
import { EMPTY as EMPTY5, filter as filter10, switchMap } from "rxjs";
|
|
1775
|
+
import { concat as concat7, EMPTY as EMPTY5, filter as filter10, switchMap } from "rxjs";
|
|
1741
1776
|
var drillDownEpic = (action$, state$) => action$.pipe(filter10(drillDown.match), switchMap((action) => {
|
|
1742
|
-
|
|
1777
|
+
var _a, _b;
|
|
1778
|
+
const state = state$.value;
|
|
1779
|
+
const url = action.payload.url;
|
|
1780
|
+
const result = [];
|
|
1781
|
+
switch (action.payload.drillDownType) {
|
|
1782
|
+
case DrillDownType.external:
|
|
1783
|
+
window.location.href = url;
|
|
1784
|
+
break;
|
|
1785
|
+
case DrillDownType.externalNew:
|
|
1786
|
+
if (/^[a-z0-9]+:\/\//i.test(url)) {
|
|
1787
|
+
window.open(url);
|
|
1788
|
+
}
|
|
1789
|
+
break;
|
|
1790
|
+
case DrillDownType.relative:
|
|
1791
|
+
window.location.href = `${window.location.origin}/${url}`;
|
|
1792
|
+
break;
|
|
1793
|
+
case DrillDownType.relativeNew:
|
|
1794
|
+
window.open(`${window.location.origin}/${url}`, "_blank");
|
|
1795
|
+
break;
|
|
1796
|
+
case DrillDownType.inner:
|
|
1797
|
+
default:
|
|
1798
|
+
const [urlBase] = url.split("?");
|
|
1799
|
+
const urlObject = new URL(url, window.location.origin);
|
|
1800
|
+
const urlFilters = urlObject.searchParams.get("filters");
|
|
1801
|
+
const urlSorters = urlObject.searchParams.get("sorters");
|
|
1802
|
+
let newFilters = {};
|
|
1803
|
+
let newSorters = {};
|
|
1804
|
+
try {
|
|
1805
|
+
newFilters = (_a = JSON.parse(urlFilters)) != null ? _a : newFilters;
|
|
1806
|
+
}
|
|
1807
|
+
catch (e) {
|
|
1808
|
+
urlFilters && console.warn("Failed to parse filters on drilldown");
|
|
1809
|
+
newFilters = {};
|
|
1810
|
+
}
|
|
1811
|
+
try {
|
|
1812
|
+
newSorters = (_b = JSON.parse(urlSorters)) != null ? _b : newSorters;
|
|
1813
|
+
}
|
|
1814
|
+
catch (e) {
|
|
1815
|
+
urlSorters && console.warn("Failed to parse sorters on drilldown");
|
|
1816
|
+
newSorters = {};
|
|
1817
|
+
}
|
|
1818
|
+
const bcToUpdate = {};
|
|
1819
|
+
Object.keys(state.screen.filters).forEach((bcName) => {
|
|
1820
|
+
if (newFilters[bcName] === "" || newFilters[bcName]) {
|
|
1821
|
+
bcToUpdate[bcName] = true;
|
|
1822
|
+
result.push(bcRemoveAllFilters({ bcName }));
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1825
|
+
const nextState = defaultParseURL(urlObject);
|
|
1826
|
+
const viewName = nextState.viewName;
|
|
1827
|
+
Object.entries(newFilters).forEach(([bcName, filterExpression]) => {
|
|
1828
|
+
var _a2;
|
|
1829
|
+
const parsedFilters = (_a2 = parseFilters(filterExpression)) == null ? void 0 : _a2.map((item) => __spreadProps(__spreadValues({}, item), { viewName }));
|
|
1830
|
+
parsedFilters == null ? void 0 : parsedFilters.forEach((parsedFilter) => {
|
|
1831
|
+
bcToUpdate[bcName] = true;
|
|
1832
|
+
result.push(bcAddFilter({ bcName, filter: parsedFilter }));
|
|
1833
|
+
});
|
|
1834
|
+
});
|
|
1835
|
+
Object.entries(newSorters).forEach(([bcName, sortExpression]) => {
|
|
1836
|
+
const sorter = parseSorters(sortExpression);
|
|
1837
|
+
result.push(bcAddSorter({ bcName, sorter }));
|
|
1838
|
+
bcToUpdate[bcName] = true;
|
|
1839
|
+
});
|
|
1840
|
+
const prevState = state.router;
|
|
1841
|
+
const willUpdateAnyway = shallowCompare(prevState, nextState, ["params"]).length > 0;
|
|
1842
|
+
if (!willUpdateAnyway) {
|
|
1843
|
+
Object.keys(bcToUpdate).forEach((bcName) => {
|
|
1844
|
+
result.push(bcForceUpdate({ bcName }));
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
result.push(changeLocation({ location: defaultParseURL(new URL(makeRelativeUrl(urlBase), window.location.origin)) }));
|
|
1848
|
+
break;
|
|
1849
|
+
}
|
|
1850
|
+
return result.length ? concat7(result) : EMPTY5;
|
|
1743
1851
|
}));
|
|
1852
|
+
function shallowCompare(prevProps, nextProps, ignore = []) {
|
|
1853
|
+
const diffProps = [];
|
|
1854
|
+
if (!prevProps && !nextProps) {
|
|
1855
|
+
return null;
|
|
1856
|
+
}
|
|
1857
|
+
if (!prevProps) {
|
|
1858
|
+
return Object.keys(nextProps);
|
|
1859
|
+
}
|
|
1860
|
+
if (!nextProps) {
|
|
1861
|
+
return Object.keys(prevProps);
|
|
1862
|
+
}
|
|
1863
|
+
const newKeys = Object.keys(nextProps);
|
|
1864
|
+
newKeys.forEach((key) => {
|
|
1865
|
+
if (prevProps[key] !== nextProps[key] && !ignore.includes(key)) {
|
|
1866
|
+
diffProps.push(key);
|
|
1867
|
+
}
|
|
1868
|
+
});
|
|
1869
|
+
Object.keys(prevProps).forEach((key) => {
|
|
1870
|
+
if (!newKeys.includes(key)) {
|
|
1871
|
+
diffProps.push(key);
|
|
1872
|
+
}
|
|
1873
|
+
});
|
|
1874
|
+
return diffProps;
|
|
1875
|
+
}
|
|
1744
1876
|
// src/epics/router/loginDoneEpic.ts
|
|
1745
1877
|
import { filter as filter11, of as of10, switchMap as switchMap2 } from "rxjs";
|
|
1746
1878
|
var loginDoneEpic = (action$, state$) => action$.pipe(filter11(loginDone.match), switchMap2((action) => {
|
|
@@ -1793,18 +1925,18 @@ var changeScreen = (action$, state$) => action$.pipe(filter14(selectScreen.match
|
|
|
1793
1925
|
return nextView ? of12(selectView(nextView)) : of12(selectViewFail({ viewName: nextViewName }));
|
|
1794
1926
|
}));
|
|
1795
1927
|
// src/epics/router/userDrillDownEpic.ts
|
|
1796
|
-
import { catchError as catchError4, concat as
|
|
1928
|
+
import { catchError as catchError4, concat as concat8, EMPTY as EMPTY8, filter as filter15, mergeMap as mergeMap10, of as of13, switchMap as switchMap6 } from "rxjs";
|
|
1797
1929
|
var userDrillDownEpic = (action$, state$, { api }) => action$.pipe(filter15(userDrillDown.match), switchMap6((action) => {
|
|
1798
1930
|
const state = state$.value;
|
|
1799
1931
|
const { bcName, fieldKey, cursor } = action.payload;
|
|
1800
|
-
const bcUrl = buildBcUrl(bcName, true);
|
|
1932
|
+
const bcUrl = buildBcUrl(bcName, true, state);
|
|
1801
1933
|
return api.fetchRowMeta(state.screen.screenName, bcUrl).pipe(mergeMap10((rowMeta) => {
|
|
1802
1934
|
var _a, _b, _c, _d;
|
|
1803
1935
|
const drillDownField = rowMeta.fields.find((field) => field.key === fieldKey);
|
|
1804
1936
|
const route = state.router;
|
|
1805
1937
|
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;
|
|
1806
1938
|
const customDrillDownUrl = (_d = (_c = state.data[bcName]) == null ? void 0 : _c.find((record) => record.id === cursor)) == null ? void 0 : _d[drillDownKey];
|
|
1807
|
-
return customDrillDownUrl || (drillDownField == null ? void 0 : drillDownField.drillDown) || (drillDownField == null ? void 0 : drillDownField.drillDown) !== route.path ?
|
|
1939
|
+
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({
|
|
1808
1940
|
url: customDrillDownUrl || drillDownField.drillDown,
|
|
1809
1941
|
drillDownType: drillDownField.drillDownType,
|
|
1810
1942
|
route
|
|
@@ -1815,7 +1947,7 @@ var userDrillDownEpic = (action$, state$, { api }) => action$.pipe(filter15(user
|
|
|
1815
1947
|
}));
|
|
1816
1948
|
}));
|
|
1817
1949
|
// src/epics/router/changeLocationEpic.ts
|
|
1818
|
-
import { concat as
|
|
1950
|
+
import { concat as concat9, EMPTY as EMPTY9, filter as filter16, mergeMap as mergeMap11, of as of14 } from "rxjs";
|
|
1819
1951
|
var changeLocationEpic = (action$, state$) => action$.pipe(filter16(changeLocation.match), mergeMap11((action) => {
|
|
1820
1952
|
var _a, _b;
|
|
1821
1953
|
const state = state$.value;
|
|
@@ -1861,7 +1993,7 @@ var changeLocationEpic = (action$, state$) => action$.pipe(filter16(changeLocati
|
|
|
1861
1993
|
}
|
|
1862
1994
|
});
|
|
1863
1995
|
}
|
|
1864
|
-
return
|
|
1996
|
+
return concat9(...resultObservables);
|
|
1865
1997
|
}));
|
|
1866
1998
|
// src/epics/router/selectViewFailEpic.ts
|
|
1867
1999
|
import { filter as filter17, map as map2 } from "rxjs";
|
|
@@ -1893,12 +2025,11 @@ var userDrillDownChangeCursorsEpic = (action$, state$) => action$.pipe(filter19(
|
|
|
1893
2025
|
if (cursor !== action.payload.cursor) {
|
|
1894
2026
|
return bcChangeCursors({ cursorsMap: { [action.payload.bcName]: action.payload.cursor } });
|
|
1895
2027
|
}
|
|
1896
|
-
return
|
|
2028
|
+
return emptyAction;
|
|
1897
2029
|
}));
|
|
1898
2030
|
// src/epics/screen/apiErrorEpic.ts
|
|
1899
2031
|
import axios from "axios";
|
|
1900
2032
|
import { EMPTY as EMPTY10, filter as filter20, mergeMap as mergeMap12, of as of15 } from "rxjs";
|
|
1901
|
-
var knownHttpErrors = [401, 409, 418, 500];
|
|
1902
2033
|
var apiErrorEpic = (action$) => action$.pipe(filter20(apiError.match), mergeMap12((action) => {
|
|
1903
2034
|
const { error, callContext } = action.payload;
|
|
1904
2035
|
if (error.response) {
|
|
@@ -1920,7 +2051,9 @@ var apiErrorEpic = (action$) => action$.pipe(filter20(apiError.match), mergeMap1
|
|
|
1920
2051
|
// src/epics/screen/downloadFileEpic.ts
|
|
1921
2052
|
import { EMPTY as EMPTY11, filter as filter21, mergeMap as mergeMap13, tap } from "rxjs";
|
|
1922
2053
|
var downloadFileEpic = (action$, state$, { api }) => action$.pipe(filter21(downloadFile.match), tap((action) => {
|
|
2054
|
+
const { fileId } = action.payload;
|
|
1923
2055
|
const anchor = document.createElement("a");
|
|
2056
|
+
anchor.href = `${api.fileUploadEndpoint}?id=${encodeURIComponent(fileId)}`;
|
|
1924
2057
|
anchor.style.display = "none";
|
|
1925
2058
|
document.body.appendChild(anchor);
|
|
1926
2059
|
setTimeout(() => {
|
|
@@ -1936,8 +2069,8 @@ var httpError401Epic = (action$) => action$.pipe(filter22(httpError.match), filt
|
|
|
1936
2069
|
// src/epics/screen/httpError409Epic.ts
|
|
1937
2070
|
import { filter as filter23, map as map6 } from "rxjs";
|
|
1938
2071
|
var httpError409Epic = (action$, state$) => action$.pipe(filter23(httpError.match), filter23((action) => action.payload.statusCode === 409), map6((action) => {
|
|
1939
|
-
var _a, _b;
|
|
1940
|
-
const notificationMessage = ((_b = (_a = action.payload.error.response.data.error) == null ? void 0 :
|
|
2072
|
+
var _a, _b, _c;
|
|
2073
|
+
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]) || "";
|
|
1941
2074
|
return addNotification({
|
|
1942
2075
|
key: "action_edit_error",
|
|
1943
2076
|
message: notificationMessage,
|
|
@@ -1951,12 +2084,12 @@ var httpError409Epic = (action$, state$) => action$.pipe(filter23(httpError.matc
|
|
|
1951
2084
|
});
|
|
1952
2085
|
}));
|
|
1953
2086
|
// src/epics/screen/httpError418Epic.ts
|
|
1954
|
-
import { concat as
|
|
2087
|
+
import { concat as concat10, EMPTY as EMPTY12, filter as filter24, mergeMap as mergeMap14, of as of16 } from "rxjs";
|
|
1955
2088
|
var httpError418Epic = (action$, state$) => action$.pipe(filter24(httpError.match), filter24((action) => action.payload.statusCode === 418), mergeMap14((action) => {
|
|
1956
|
-
var _a;
|
|
2089
|
+
var _a, _b;
|
|
1957
2090
|
const { error, callContext } = action.payload;
|
|
1958
2091
|
const result = [];
|
|
1959
|
-
const typedError = error.response.data;
|
|
2092
|
+
const typedError = (_a = error.response) == null ? void 0 : _a.data;
|
|
1960
2093
|
if (!typedError.error.popup) {
|
|
1961
2094
|
return EMPTY12;
|
|
1962
2095
|
}
|
|
@@ -1965,16 +2098,16 @@ var httpError418Epic = (action$, state$) => action$.pipe(filter24(httpError.matc
|
|
|
1965
2098
|
message: typedError.error.popup[0]
|
|
1966
2099
|
};
|
|
1967
2100
|
result.push(of16(showViewError({ error: businessError })));
|
|
1968
|
-
if ((
|
|
2101
|
+
if ((_b = typedError.error.postActions) == null ? void 0 : _b[0]) {
|
|
1969
2102
|
const widget = state$.value.view.widgets.find((item) => item.name === callContext.widgetName);
|
|
1970
|
-
const bcName = widget.bcName;
|
|
2103
|
+
const bcName = widget == null ? void 0 : widget.bcName;
|
|
1971
2104
|
result.push(of16(processPostInvoke({
|
|
1972
2105
|
bcName,
|
|
1973
2106
|
postInvoke: typedError.error.postActions[0],
|
|
1974
|
-
widgetName: widget.name
|
|
2107
|
+
widgetName: widget == null ? void 0 : widget.name
|
|
1975
2108
|
})));
|
|
1976
2109
|
}
|
|
1977
|
-
return
|
|
2110
|
+
return concat10(...result);
|
|
1978
2111
|
}));
|
|
1979
2112
|
// src/epics/screen/httpError500Epic.ts
|
|
1980
2113
|
import { filter as filter25, map as map7 } from "rxjs";
|
|
@@ -1989,11 +2122,13 @@ var httpError500Epic = (action$, state$) => action$.pipe(filter25(httpError.matc
|
|
|
1989
2122
|
}));
|
|
1990
2123
|
// src/epics/screen/httpErrorDefaultEpic.ts
|
|
1991
2124
|
import { filter as filter26, map as map8 } from "rxjs";
|
|
1992
|
-
var
|
|
2125
|
+
var knownHttpErrors = [401, 409, 418, 500];
|
|
2126
|
+
var httpErrorDefaultEpic = (action$, state$) => action$.pipe(filter26(httpError.match), filter26((action) => !knownHttpErrors.includes(action.payload.statusCode)), map8((action) => {
|
|
2127
|
+
var _a, _b;
|
|
1993
2128
|
const businessError = {
|
|
1994
2129
|
type: 0 /* BusinessError */,
|
|
1995
|
-
code: action.payload.error.response.status,
|
|
1996
|
-
details: action.payload.error.response.data
|
|
2130
|
+
code: (_a = action.payload.error.response) == null ? void 0 : _a.status,
|
|
2131
|
+
details: (_b = action.payload.error.response) == null ? void 0 : _b.data
|
|
1997
2132
|
};
|
|
1998
2133
|
return showViewError({ error: businessError });
|
|
1999
2134
|
}));
|
|
@@ -2013,6 +2148,7 @@ var downloadFileByUrlEpic = (action$, state$) => action$.pipe(filter27(downloadF
|
|
|
2013
2148
|
// src/epics/screen/processPostInvokeEpic.ts
|
|
2014
2149
|
import { EMPTY as EMPTY14, filter as filter28, mergeMap as mergeMap16, of as of17 } from "rxjs";
|
|
2015
2150
|
var processPostInvokeEpic = (action$, state$) => action$.pipe(filter28(processPostInvoke.match), mergeMap16((action) => {
|
|
2151
|
+
var _a;
|
|
2016
2152
|
const state = state$.value;
|
|
2017
2153
|
switch (action.payload.postInvoke.type) {
|
|
2018
2154
|
case "drillDown" /* drillDown */:
|
|
@@ -2023,7 +2159,10 @@ var processPostInvokeEpic = (action$, state$) => action$.pipe(filter28(processPo
|
|
|
2023
2159
|
case "postDelete" /* postDelete */: {
|
|
2024
2160
|
const cursorsMap = { [action.payload.bcName]: null };
|
|
2025
2161
|
const result = [bcChangeCursors({ cursorsMap })];
|
|
2026
|
-
if (state.router.bcPath.includes(`${action.payload.bcName}/`)) {
|
|
2162
|
+
if ((_a = state.router.bcPath) == null ? void 0 : _a.includes(`${action.payload.bcName}/`)) {
|
|
2163
|
+
const newBcUrl = state.router.bcPath.split(action.payload.bcName)[0] || "";
|
|
2164
|
+
const newUrl = `/screen/${state.router.screenName}/view/${state.router.viewName}/${newBcUrl}`;
|
|
2165
|
+
result.push(changeLocation({ location: defaultParseURL(new URL(newUrl, window.location.origin)) }));
|
|
2027
2166
|
}
|
|
2028
2167
|
else {
|
|
2029
2168
|
result.push(bcFetchDataRequest({
|
|
@@ -2092,30 +2231,30 @@ var processPostInvokeConfirmEpic = (action$, state$) => action$.pipe(filter29(is
|
|
|
2092
2231
|
}
|
|
2093
2232
|
}));
|
|
2094
2233
|
// src/epics/session/switchRoleEpic.ts
|
|
2095
|
-
import { concat as
|
|
2234
|
+
import { concat as concat11, filter as filter30, switchMap as switchMap7 } from "rxjs";
|
|
2096
2235
|
var switchRoleEpic = (action$, state$) => action$.pipe(filter30(switchRole.match), switchMap7((action) => {
|
|
2097
|
-
return
|
|
2236
|
+
return concat11([logoutDone(null), login({ login: "", password: "", role: action.payload.role })]);
|
|
2098
2237
|
}));
|
|
2099
2238
|
// src/epics/session/refreshMetaEpic.ts
|
|
2100
|
-
import { catchError as catchError5, concat as
|
|
2239
|
+
import { catchError as catchError5, concat as concat12, filter as filter31, mergeMap as mergeMap18, switchMap as switchMap8 } from "rxjs";
|
|
2101
2240
|
var refreshMetaEpic = (action$, state$, { api }) => action$.pipe(filter31(refreshMeta.match), mergeMap18(() => {
|
|
2102
2241
|
const state = state$.value;
|
|
2103
2242
|
const { router } = state;
|
|
2104
2243
|
const { activeRole } = state.session;
|
|
2105
|
-
return api.refreshMeta().pipe(switchMap8(() =>
|
|
2244
|
+
return api.refreshMeta().pipe(switchMap8(() => concat12([
|
|
2245
|
+
refreshMetaDone(),
|
|
2106
2246
|
logoutDone(null),
|
|
2107
2247
|
login({ login: "", password: "", role: activeRole }),
|
|
2108
2248
|
changeLocation({
|
|
2109
|
-
|
|
2110
|
-
action: "PUSH"
|
|
2249
|
+
location: router
|
|
2111
2250
|
})
|
|
2112
|
-
])), catchError5((error) =>
|
|
2251
|
+
])), catchError5((error) => concat12([loginFail(error), refreshMetaFail()])));
|
|
2113
2252
|
}));
|
|
2114
2253
|
// src/epics/session/loginDoneEpic.ts
|
|
2115
2254
|
import { EMPTY as EMPTY16, filter as filter32, switchMap as switchMap9 } from "rxjs";
|
|
2116
2255
|
var loginDoneSessionEpic = (action$, store) => action$.pipe(filter32(login.match), switchMap9((action) => EMPTY16));
|
|
2117
2256
|
// src/epics/session/loginByAnotherRoleEpic.ts
|
|
2118
|
-
import { catchError as catchError6,
|
|
2257
|
+
import { catchError as catchError6, concat as concat13, filter as filter33, mergeMap as mergeMap19, of as of19, switchMap as switchMap10 } from "rxjs";
|
|
2119
2258
|
var responseStatusMessages = {
|
|
2120
2259
|
401: "Invalid credentials",
|
|
2121
2260
|
403: "Access denied"
|
|
@@ -2128,59 +2267,80 @@ var loginByAnotherRoleEpic = (action$, state$, { api }) => action$.pipe(filter33
|
|
|
2128
2267
|
const role = (_a = action.payload.role) != null ? _a : "";
|
|
2129
2268
|
const isSwitchRole = role && role !== state$.value.session.activeRole;
|
|
2130
2269
|
return api.loginByRoleRequest(role).pipe(mergeMap19((data) => {
|
|
2270
|
+
var _a2;
|
|
2271
|
+
const result = [];
|
|
2131
2272
|
if (isSwitchRole) {
|
|
2132
|
-
|
|
2133
|
-
|
|
2273
|
+
const defaultScreen = data.screens.find((screen) => screen.defaultScreen) || data.screens[0];
|
|
2274
|
+
const defaultViewName = (_a2 = defaultScreen == null ? void 0 : defaultScreen.primary) != null ? _a2 : defaultScreen.meta.views[0].name;
|
|
2275
|
+
const defaultView = defaultScreen == null ? void 0 : defaultScreen.meta.views.find((view) => defaultViewName === view.name);
|
|
2276
|
+
if (defaultView)
|
|
2277
|
+
result.push(changeLocation({ location: defaultParseURL(new URL(defaultView.url, window.location.origin)) }));
|
|
2278
|
+
}
|
|
2279
|
+
return concat13([
|
|
2280
|
+
...result,
|
|
2281
|
+
loginDone({
|
|
2282
|
+
devPanelEnabled: data.devPanelEnabled,
|
|
2283
|
+
activeRole: data.activeRole,
|
|
2284
|
+
roles: data.roles,
|
|
2285
|
+
screens: data.screens,
|
|
2286
|
+
firstName: data.firstName,
|
|
2287
|
+
lastName: data.lastName,
|
|
2288
|
+
login: data.login
|
|
2289
|
+
})
|
|
2290
|
+
]);
|
|
2134
2291
|
}), catchError6((error) => {
|
|
2135
2292
|
console.error(error);
|
|
2136
2293
|
const errorMsg = error.response ? responseStatusMessages[error.response.status] || "Server application unavailable" : "Empty server response";
|
|
2137
|
-
return
|
|
2294
|
+
return of19(loginFail({ errorMsg }));
|
|
2138
2295
|
}));
|
|
2139
2296
|
}));
|
|
2140
2297
|
// src/epics/session/refreshMetaAndReloadPageEpic.ts
|
|
2141
|
-
import { concat as
|
|
2142
|
-
var refreshMetaAndReloadPageEpic = (action$, state$) => action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(() =>
|
|
2298
|
+
import { concat as concat14, EMPTY as EMPTY17, filter as filter34, of as of20, switchMap as switchMap11, take, tap as tap3 } from "rxjs";
|
|
2299
|
+
var refreshMetaAndReloadPageEpic = (action$, state$) => action$.pipe(filter34(refreshMetaAndReloadPage.match), switchMap11(() => concat14(of20(refreshMeta(null)), action$.pipe(filter34(loginDone.match), take(1), tap3(() => location.reload()), switchMap11(() => EMPTY17)))));
|
|
2143
2300
|
// src/epics/data/bcNewDataEpic.ts
|
|
2144
|
-
import { catchError as catchError7, concat as
|
|
2301
|
+
import { catchError as catchError7, concat as concat15, EMPTY as EMPTY18, filter as filter35, mergeMap as mergeMap20, of as of21 } from "rxjs";
|
|
2145
2302
|
import { OperationTypeCrud as OperationTypeCrud8 } from "@cxbox-ui/schema";
|
|
2146
2303
|
var bcNewDataEpic = (action$, state$, { api }) => action$.pipe(filter35(sendOperation.match), filter35((action) => matchOperationRole(OperationTypeCrud8.create, action.payload, state$.value)), mergeMap20((action) => {
|
|
2304
|
+
var _a;
|
|
2147
2305
|
const state = state$.value;
|
|
2148
2306
|
const bcName = action.payload.bcName;
|
|
2149
|
-
const bcUrl = buildBcUrl(bcName);
|
|
2307
|
+
const bcUrl = (_a = buildBcUrl(bcName, false, state)) != null ? _a : "";
|
|
2150
2308
|
const context = { widgetName: action.payload.widgetName };
|
|
2151
2309
|
const params = { _action: action.payload.operationType };
|
|
2152
2310
|
return api.newBcData(state.screen.screenName, bcUrl, context, params).pipe(mergeMap20((data) => {
|
|
2311
|
+
var _a2, _b;
|
|
2153
2312
|
const rowMeta = data.row;
|
|
2154
2313
|
const dataItem = { id: null, vstamp: -1 };
|
|
2155
2314
|
data.row.fields.forEach((field) => {
|
|
2156
2315
|
dataItem[field.key] = field.currentValue;
|
|
2157
2316
|
});
|
|
2158
|
-
const postInvoke = data.postActions[0];
|
|
2317
|
+
const postInvoke = (_a2 = data.postActions) == null ? void 0 : _a2[0];
|
|
2159
2318
|
const cursor = dataItem.id;
|
|
2160
|
-
return
|
|
2161
|
-
bcName
|
|
2319
|
+
return concat15(of21(bcNewDataSuccess({ bcName, dataItem, bcUrl })), of21(bcFetchRowMetaSuccess({ bcName, bcUrl: `${bcUrl}/${cursor}`, rowMeta, cursor })), of21(changeDataItem({
|
|
2320
|
+
bcName,
|
|
2321
|
+
bcUrl: (_b = buildBcUrl(bcName, true, state)) != null ? _b : "",
|
|
2162
2322
|
cursor,
|
|
2163
2323
|
dataItem: {
|
|
2164
2324
|
id: cursor
|
|
2165
2325
|
}
|
|
2166
|
-
})), postInvoke ?
|
|
2326
|
+
})), postInvoke ? of21(processPostInvoke({ bcName, postInvoke, cursor, widgetName: action.payload.widgetName })) : EMPTY18);
|
|
2167
2327
|
}), catchError7((error) => {
|
|
2168
2328
|
console.error(error);
|
|
2169
|
-
return
|
|
2329
|
+
return of21(bcNewDataFail({ bcName }));
|
|
2170
2330
|
}));
|
|
2171
2331
|
}));
|
|
2172
2332
|
// src/epics/data/bcLoadMoreEpic.ts
|
|
2173
|
-
import { catchError as catchError8, filter as filter37, mergeMap as mergeMap22, of as
|
|
2333
|
+
import { catchError as catchError8, filter as filter37, mergeMap as mergeMap22, of as of23, race } from "rxjs";
|
|
2174
2334
|
// src/utils/cancelRequestEpic.ts
|
|
2175
|
-
import { filter as filter36, mergeMap as mergeMap21, of as
|
|
2335
|
+
import { filter as filter36, mergeMap as mergeMap21, of as of22, take as take2 } from "rxjs";
|
|
2176
2336
|
import { isAnyOf as isAnyOf2 } from "@reduxjs/toolkit";
|
|
2177
2337
|
var cancelRequestActionTypes = [selectView, logout];
|
|
2178
2338
|
function cancelRequestEpic(action$, actionTypes, cancelFn, cancelActionCreator, filterFn = (item) => {
|
|
2179
2339
|
return true;
|
|
2180
2340
|
}) {
|
|
2181
2341
|
return action$.pipe(filter36(isAnyOf2(...actionTypes)), filter36(filterFn), mergeMap21(() => {
|
|
2182
|
-
cancelFn();
|
|
2183
|
-
return
|
|
2342
|
+
cancelFn == null ? void 0 : cancelFn();
|
|
2343
|
+
return of22(cancelActionCreator);
|
|
2184
2344
|
}), take2(1));
|
|
2185
2345
|
}
|
|
2186
2346
|
// src/epics/data/bcLoadMoreEpic.ts
|
|
@@ -2192,7 +2352,7 @@ var bcLoadMoreEpic = (action$, state$, { api }) => action$.pipe(filter37(bcLoadM
|
|
|
2192
2352
|
const { cursor, page } = bc;
|
|
2193
2353
|
const limit = ((_a = state.view.widgets.find((i) => i.bcName === bcName)) == null ? void 0 : _a.limit) || bc.limit;
|
|
2194
2354
|
const limitBySelfCursor = (_b = state.router.bcPath) == null ? void 0 : _b.includes(`${bcName}/${cursor}`);
|
|
2195
|
-
const bcUrl = buildBcUrl(bcName, limitBySelfCursor);
|
|
2355
|
+
const bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
|
|
2196
2356
|
const filters = state.screen.filters[bcName] || [];
|
|
2197
2357
|
const sorters = state.screen.sorters[bcName];
|
|
2198
2358
|
const fetchParams = __spreadValues(__spreadValues({
|
|
@@ -2205,7 +2365,7 @@ var bcLoadMoreEpic = (action$, state$, { api }) => action$.pipe(filter37(bcLoadM
|
|
|
2205
2365
|
var _a2;
|
|
2206
2366
|
const oldBcDataIds = (_a2 = state.data[bcName]) == null ? void 0 : _a2.map((i) => i.id);
|
|
2207
2367
|
const newData = [...state.data[bcName], ...data.data.filter((i) => !oldBcDataIds.includes(i.id))];
|
|
2208
|
-
return
|
|
2368
|
+
return of23(bcFetchDataSuccess({
|
|
2209
2369
|
bcName,
|
|
2210
2370
|
data: newData,
|
|
2211
2371
|
bcUrl,
|
|
@@ -2213,23 +2373,23 @@ var bcLoadMoreEpic = (action$, state$, { api }) => action$.pipe(filter37(bcLoadM
|
|
|
2213
2373
|
}));
|
|
2214
2374
|
}), catchError8((error) => {
|
|
2215
2375
|
console.error(error);
|
|
2216
|
-
return
|
|
2376
|
+
return of23(bcFetchDataFail({ bcName, bcUrl }));
|
|
2217
2377
|
}));
|
|
2218
2378
|
return race(cancelFlow, normalFlow);
|
|
2219
2379
|
}));
|
|
2220
2380
|
// src/epics/data/bcSaveDataEpic.ts
|
|
2221
|
-
import { catchError as catchError9, concat as
|
|
2381
|
+
import { catchError as catchError9, concat as concat16, EMPTY as EMPTY19, filter as filter38, mergeMap as mergeMap23, of as of24 } from "rxjs";
|
|
2222
2382
|
var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOperation.match), filter38((action) => matchOperationRole(OperationTypeCrud.save, action.payload, state$.value)), mergeMap23((action) => {
|
|
2223
|
-
var _a, _b, _c;
|
|
2383
|
+
var _a, _b, _c, _d;
|
|
2224
2384
|
const state = state$.value;
|
|
2225
2385
|
const bcName = action.payload.bcName;
|
|
2226
|
-
const bcUrl = buildBcUrl(bcName, true);
|
|
2386
|
+
const bcUrl = (_a = buildBcUrl(bcName, true, state)) != null ? _a : "";
|
|
2227
2387
|
const widgetName = action.payload.widgetName;
|
|
2228
2388
|
const cursor = state.screen.bo.bc[bcName].cursor;
|
|
2229
2389
|
const dataItem = state.data[bcName].find((item) => item.id === cursor);
|
|
2230
|
-
const pendingChanges = (
|
|
2231
|
-
const rowMeta = bcUrl && ((
|
|
2232
|
-
const options = (
|
|
2390
|
+
const pendingChanges = __spreadValues({}, (_b = state.view.pendingDataChanges[bcName]) == null ? void 0 : _b[cursor]);
|
|
2391
|
+
const rowMeta = bcUrl && ((_c = state.view.rowMeta[bcName]) == null ? void 0 : _c[bcUrl]);
|
|
2392
|
+
const options = (_d = state.view.widgets.find((widget) => widget.name === widgetName)) == null ? void 0 : _d.options;
|
|
2233
2393
|
if (rowMeta) {
|
|
2234
2394
|
const fields = rowMeta.fields;
|
|
2235
2395
|
for (const key in pendingChanges) {
|
|
@@ -2243,21 +2403,22 @@ var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOpe
|
|
|
2243
2403
|
return bcFetchDataRequest({ bcName: childBcName, widgetName: widgetNames[0] });
|
|
2244
2404
|
});
|
|
2245
2405
|
const context = { widgetName: action.payload.widgetName };
|
|
2246
|
-
return api.saveBcData(state.screen.screenName, bcUrl, __spreadProps(__spreadValues({}, pendingChanges), { vstamp: dataItem.vstamp }), context).pipe(mergeMap23((data) => {
|
|
2247
|
-
|
|
2406
|
+
return api.saveBcData(state.screen.screenName, bcUrl, __spreadProps(__spreadValues({}, pendingChanges), { vstamp: dataItem == null ? void 0 : dataItem.vstamp }), context).pipe(mergeMap23((data) => {
|
|
2407
|
+
var _a2;
|
|
2408
|
+
const postInvoke = (_a2 = data.postActions) == null ? void 0 : _a2[0];
|
|
2248
2409
|
const responseDataItem = data.record;
|
|
2249
|
-
return
|
|
2410
|
+
return concat16(of24(bcSaveDataSuccess({ bcName, cursor, dataItem: responseDataItem })), of24(bcFetchRowMeta({ widgetName, bcName })), of24(...fetchChildrenBcData), postInvoke ? of24(processPostInvoke({
|
|
2250
2411
|
bcName,
|
|
2251
2412
|
widgetName,
|
|
2252
2413
|
postInvoke,
|
|
2253
2414
|
cursor: responseDataItem.id
|
|
2254
|
-
})) :
|
|
2415
|
+
})) : EMPTY19, action.payload.onSuccessAction ? of24(action.payload.onSuccessAction) : EMPTY19);
|
|
2255
2416
|
}), catchError9((e) => {
|
|
2256
|
-
var _a2, _b2, _c2,
|
|
2417
|
+
var _a2, _b2, _c2, _d2, _e, _f, _g, _h;
|
|
2257
2418
|
console.error(e);
|
|
2258
|
-
let notification$ =
|
|
2419
|
+
let notification$ = EMPTY19;
|
|
2259
2420
|
if (action.payload.onSuccessAction && !(options == null ? void 0 : options.disableNotification)) {
|
|
2260
|
-
notification$ =
|
|
2421
|
+
notification$ = of24(addNotification({
|
|
2261
2422
|
key: "data_autosave_undo",
|
|
2262
2423
|
type: "buttonWarningNotification",
|
|
2263
2424
|
message: "There are pending changes. Please save them or cancel.",
|
|
@@ -2274,14 +2435,14 @@ var bcSaveDataEpic = (action$, state$, { api }) => action$.pipe(filter38(sendOpe
|
|
|
2274
2435
|
let entityError = null;
|
|
2275
2436
|
const operationError = (_a2 = e.response) == null ? void 0 : _a2.data;
|
|
2276
2437
|
if (((_b2 = e.response) == null ? void 0 : _b2.data) === Object((_c2 = e.response) == null ? void 0 : _c2.data)) {
|
|
2277
|
-
entityError = (
|
|
2278
|
-
viewError = (
|
|
2438
|
+
entityError = (_e = (_d2 = operationError == null ? void 0 : operationError.error) == null ? void 0 : _d2.entity) != null ? _e : entityError;
|
|
2439
|
+
viewError = (_h = (_g = (_f = operationError == null ? void 0 : operationError.error) == null ? void 0 : _f.popup) == null ? void 0 : _g[0]) != null ? _h : viewError;
|
|
2279
2440
|
}
|
|
2280
|
-
return
|
|
2441
|
+
return concat16(of24(bcSaveDataFail({ bcName, bcUrl, viewError, entityError })), notification$);
|
|
2281
2442
|
}));
|
|
2282
2443
|
}));
|
|
2283
2444
|
// src/epics/data/selectViewEpic.ts
|
|
2284
|
-
import { EMPTY as
|
|
2445
|
+
import { EMPTY as EMPTY20, filter as filter39, mergeMap as mergeMap24 } from "rxjs";
|
|
2285
2446
|
var selectViewEpic = (action$, state$) => action$.pipe(filter39(selectView.match), mergeMap24((action) => {
|
|
2286
2447
|
try {
|
|
2287
2448
|
const state = state$.value;
|
|
@@ -2306,12 +2467,12 @@ var selectViewEpic = (action$, state$) => action$.pipe(filter39(selectView.match
|
|
|
2306
2467
|
}
|
|
2307
2468
|
catch (e) {
|
|
2308
2469
|
console.error(`selectView Epic:: ${e}`);
|
|
2309
|
-
return
|
|
2470
|
+
return EMPTY20;
|
|
2310
2471
|
}
|
|
2311
2472
|
}));
|
|
2312
2473
|
// src/epics/data/bcFetchDataEpic.ts
|
|
2313
|
-
import { catchError as catchError10, concat as
|
|
2314
|
-
import { WidgetTypes as
|
|
2474
|
+
import { catchError as catchError10, concat as concat17, EMPTY as EMPTY21, filter as filter40, mergeMap as mergeMap25, of as of25, race as race2 } from "rxjs";
|
|
2475
|
+
import { WidgetTypes as WidgetTypes5 } from "@cxbox-ui/schema";
|
|
2315
2476
|
import { isAnyOf as isAnyOf3 } from "@reduxjs/toolkit";
|
|
2316
2477
|
var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyOf3(bcFetchDataRequest, bcFetchDataPages, showViewPopup, bcForceUpdate, bcChangePage)), mergeMap25((action) => {
|
|
2317
2478
|
const getCursorChange = (data, prevCursor, isHierarchy) => {
|
|
@@ -2319,7 +2480,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2319
2480
|
const { bcName } = action.payload;
|
|
2320
2481
|
const keepDelta = bcFetchDataRequest.match(action) ? action.payload.keepDelta : void 0;
|
|
2321
2482
|
const newCursor = (_a = data[0]) == null ? void 0 : _a.id;
|
|
2322
|
-
return
|
|
2483
|
+
return of25(bcChangeCursors({
|
|
2323
2484
|
cursorsMap: {
|
|
2324
2485
|
[bcName]: data.some((i) => i.id === prevCursor) ? prevCursor : newCursor
|
|
2325
2486
|
},
|
|
@@ -2329,7 +2490,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2329
2490
|
const getChildrenData = (widgets, bcDictionary, isHierarchy, showConditionCheck) => {
|
|
2330
2491
|
const { bcName } = action.payload;
|
|
2331
2492
|
const { ignorePageLimit, keepDelta } = bcFetchDataRequest.match(action) ? action.payload : { ignorePageLimit: void 0, keepDelta: void 0 };
|
|
2332
|
-
return
|
|
2493
|
+
return concat17(...Object.entries(getBcChildren(bcName, widgets, bcDictionary)).filter(([childBcName, widgetNames]) => {
|
|
2333
2494
|
const nonLazyWidget = widgets.find((item) => {
|
|
2334
2495
|
return widgetNames.includes(item.name) && !PopupWidgetTypes.includes(item.type) && showConditionCheck(item);
|
|
2335
2496
|
});
|
|
@@ -2342,46 +2503,46 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2342
2503
|
const nonLazyWidget = widgets.find((item) => {
|
|
2343
2504
|
return widgetNames.includes(item.name) && !PopupWidgetTypes.includes(item.type) && showConditionCheck(item);
|
|
2344
2505
|
});
|
|
2345
|
-
return
|
|
2506
|
+
return of25(bcFetchDataRequest({
|
|
2346
2507
|
bcName: childBcName,
|
|
2347
|
-
widgetName: nonLazyWidget.name,
|
|
2508
|
+
widgetName: nonLazyWidget == null ? void 0 : nonLazyWidget.name,
|
|
2348
2509
|
ignorePageLimit: ignorePageLimit || showViewPopup.match(action),
|
|
2349
2510
|
keepDelta: isHierarchy || keepDelta
|
|
2350
2511
|
}));
|
|
2351
2512
|
}));
|
|
2352
2513
|
};
|
|
2353
2514
|
const bcFetchDataImpl = () => {
|
|
2354
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2515
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2355
2516
|
const state = state$.value;
|
|
2356
|
-
const { widgetName } = action.payload;
|
|
2517
|
+
const { widgetName = "" } = action.payload;
|
|
2357
2518
|
const { widgets, infiniteWidgets } = state.view;
|
|
2358
|
-
const widget = (_a = widgets.find((item) => item.name === widgetName)) != null ? _a : widgets.find((item) => item.bcName === action.payload.bcName);
|
|
2519
|
+
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);
|
|
2359
2520
|
if (!widget) {
|
|
2360
|
-
return [
|
|
2521
|
+
return [EMPTY21];
|
|
2361
2522
|
}
|
|
2362
2523
|
const bcName = action.payload.bcName;
|
|
2363
2524
|
const bc = state.screen.bo.bc[bcName];
|
|
2364
|
-
const { cursor, page } = bc;
|
|
2365
|
-
const limit = ((_b = widgets.find((i) => i.bcName === bcName)) == null ? void 0 : _b.limit) || bc.limit;
|
|
2525
|
+
const { cursor, page = 1 } = bc;
|
|
2526
|
+
const limit = (_c = ((_b = widgets == null ? void 0 : widgets.find((i) => i.bcName === bcName)) == null ? void 0 : _b.limit) || bc.limit) != null ? _c : 5;
|
|
2366
2527
|
const sorters = state.screen.sorters[bcName];
|
|
2367
2528
|
if (showViewPopup.match(action) && bcName === action.payload.calleeBCName) {
|
|
2368
|
-
return [
|
|
2529
|
+
return [EMPTY21];
|
|
2369
2530
|
}
|
|
2370
|
-
const anyHierarchyWidget = widgets.find((item) => {
|
|
2371
|
-
return item.bcName === widget.bcName && item.type ===
|
|
2531
|
+
const anyHierarchyWidget = widgets == null ? void 0 : widgets.find((item) => {
|
|
2532
|
+
return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && isHierarchyWidget(item);
|
|
2372
2533
|
});
|
|
2373
|
-
const fullHierarchyWidget = state.view.widgets.find((item) => {
|
|
2534
|
+
const fullHierarchyWidget = (_d = state.view.widgets) == null ? void 0 : _d.find((item) => {
|
|
2374
2535
|
var _a2;
|
|
2375
|
-
return item.bcName === widget.bcName && item.type ===
|
|
2536
|
+
return item.bcName === widget.bcName && item.type === WidgetTypes5.AssocListPopup && ((_a2 = item.options) == null ? void 0 : _a2.hierarchyFull);
|
|
2376
2537
|
});
|
|
2377
|
-
const limitBySelfCursor = (
|
|
2378
|
-
const bcUrl = buildBcUrl(bcName, limitBySelfCursor);
|
|
2538
|
+
const limitBySelfCursor = (_e = state.router.bcPath) == null ? void 0 : _e.includes(`${bcName}/${cursor}`);
|
|
2539
|
+
const bcUrl = buildBcUrl(bcName, limitBySelfCursor, state);
|
|
2379
2540
|
const fetchParams = __spreadValues(__spreadValues({
|
|
2380
2541
|
_page: page,
|
|
2381
2542
|
_limit: limit
|
|
2382
2543
|
}, getFilters(fullHierarchyWidget ? [] : state.screen.filters[bcName] || [])), getSorters(sorters));
|
|
2383
2544
|
if (bcForceUpdate.match(action)) {
|
|
2384
|
-
const infinityPaginationWidget = widgetName && infiniteWidgets.includes(widgetName) || ((
|
|
2545
|
+
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);
|
|
2385
2546
|
if (infinityPaginationWidget) {
|
|
2386
2547
|
fetchParams._page = 1;
|
|
2387
2548
|
fetchParams._limit = limit * page;
|
|
@@ -2391,7 +2552,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2391
2552
|
fetchParams._page = action.payload.from || 1;
|
|
2392
2553
|
fetchParams._limit = (action.payload.to || page - fetchParams._page) * limit;
|
|
2393
2554
|
}
|
|
2394
|
-
if (bcFetchDataRequest.match(action) && action.payload.ignorePageLimit || ((
|
|
2555
|
+
if (bcFetchDataRequest.match(action) && action.payload.ignorePageLimit || ((_h = anyHierarchyWidget == null ? void 0 : anyHierarchyWidget.options) == null ? void 0 : _h.hierarchyFull)) {
|
|
2395
2556
|
fetchParams._limit = 0;
|
|
2396
2557
|
}
|
|
2397
2558
|
const canceler = api.createCanceler();
|
|
@@ -2403,12 +2564,12 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2403
2564
|
const normalFlow = api.fetchBcData(state.screen.screenName, bcUrl, fetchParams, canceler.cancelToken).pipe(mergeMap25((response) => {
|
|
2404
2565
|
var _a2, _b2;
|
|
2405
2566
|
const cursorChange = getCursorChange(response.data, cursor, !!anyHierarchyWidget);
|
|
2406
|
-
const parentOfNotLazyWidget = widgets.some((item) => {
|
|
2567
|
+
const parentOfNotLazyWidget = widgets == null ? void 0 : widgets.some((item) => {
|
|
2407
2568
|
var _a3;
|
|
2408
2569
|
return ((_a3 = state.screen.bo.bc[item.bcName]) == null ? void 0 : _a3.parentName) === bcName && !PopupWidgetTypes.includes(item.type);
|
|
2409
2570
|
});
|
|
2410
2571
|
const isWidgetVisible = (w) => {
|
|
2411
|
-
var _a3, _b3, _c2, _d2, _e2, _f2,
|
|
2572
|
+
var _a3, _b3, _c2, _d2, _e2, _f2, _g2, _h2, _i;
|
|
2412
2573
|
if (((_a3 = w.showCondition) == null ? void 0 : _a3.bcName) === ((_b3 = state.screen.bo.bc[w.bcName]) == null ? void 0 : _b3.parentName)) {
|
|
2413
2574
|
let parentName = (_d2 = state.screen.bo.bc[(_c2 = w.showCondition) == null ? void 0 : _c2.bcName]) == null ? void 0 : _d2.parentName;
|
|
2414
2575
|
let parent = parentName === bcName;
|
|
@@ -2420,17 +2581,17 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2420
2581
|
return true;
|
|
2421
2582
|
}
|
|
2422
2583
|
}
|
|
2423
|
-
const dataToCheck = bcName === ((_f2 = w.showCondition) == null ? void 0 : _f2.bcName) ? response.data : state.data[(
|
|
2424
|
-
return checkShowCondition(w.showCondition, (_i = state.screen.bo.bc[(
|
|
2584
|
+
const dataToCheck = bcName === ((_f2 = w.showCondition) == null ? void 0 : _f2.bcName) ? response.data : state.data[(_g2 = w.showCondition) == null ? void 0 : _g2.bcName];
|
|
2585
|
+
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);
|
|
2425
2586
|
};
|
|
2426
2587
|
const lazyWidget = (!isWidgetVisible(widget) || PopupWidgetTypes.includes(widget.type)) && !parentOfNotLazyWidget;
|
|
2427
2588
|
const skipLazy = ((_a2 = state.view.popupData) == null ? void 0 : _a2.bcName) !== widget.bcName;
|
|
2428
2589
|
if (lazyWidget && skipLazy) {
|
|
2429
|
-
return
|
|
2590
|
+
return EMPTY21;
|
|
2430
2591
|
}
|
|
2431
|
-
const fetchChildren = ((_b2 = response.data) == null ? void 0 : _b2.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) :
|
|
2432
|
-
const fetchRowMeta =
|
|
2433
|
-
return
|
|
2592
|
+
const fetchChildren = ((_b2 = response.data) == null ? void 0 : _b2.length) ? getChildrenData(widgets, state.screen.bo.bc, !!anyHierarchyWidget, isWidgetVisible) : EMPTY21;
|
|
2593
|
+
const fetchRowMeta = of25(bcFetchRowMeta({ widgetName, bcName }));
|
|
2594
|
+
return concat17(cursorChange, of25(bcFetchDataSuccess({
|
|
2434
2595
|
bcName,
|
|
2435
2596
|
data: response.data,
|
|
2436
2597
|
bcUrl,
|
|
@@ -2438,7 +2599,7 @@ var bcFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter40(isAnyO
|
|
|
2438
2599
|
})), fetchRowMeta, fetchChildren);
|
|
2439
2600
|
}), catchError10((error) => {
|
|
2440
2601
|
console.error(error);
|
|
2441
|
-
return
|
|
2602
|
+
return of25(bcFetchDataFail({ bcName: action.payload.bcName, bcUrl }));
|
|
2442
2603
|
}));
|
|
2443
2604
|
return [cancelFlow, cancelByParentBc, normalFlow];
|
|
2444
2605
|
};
|
|
@@ -2449,26 +2610,27 @@ function isHierarchyWidget(widget) {
|
|
|
2449
2610
|
return ((_a = widget.options) == null ? void 0 : _a.hierarchy) || ((_b = widget.options) == null ? void 0 : _b.hierarchyFull);
|
|
2450
2611
|
}
|
|
2451
2612
|
// src/epics/data/bcDeleteDataEpic.ts
|
|
2452
|
-
import { catchError as catchError11, concat as
|
|
2613
|
+
import { catchError as catchError11, concat as concat18, EMPTY as EMPTY22, filter as filter41, mergeMap as mergeMap26, of as of26 } from "rxjs";
|
|
2453
2614
|
import { OperationTypeCrud as OperationTypeCrud9 } from "@cxbox-ui/schema";
|
|
2454
2615
|
var bcDeleteDataEpic = (action$, store$, { api }) => action$.pipe(filter41(sendOperation.match), filter41((action) => matchOperationRole(OperationTypeCrud9.delete, action.payload, store$.value)), mergeMap26((action) => {
|
|
2455
2616
|
const widgetName = action.payload.widgetName;
|
|
2456
2617
|
const state = store$.value;
|
|
2457
2618
|
const bcName = action.payload.bcName;
|
|
2458
2619
|
const cursor = state.screen.bo.bc[bcName].cursor;
|
|
2459
|
-
const bcUrl = buildBcUrl(bcName, true);
|
|
2620
|
+
const bcUrl = buildBcUrl(bcName, true, state);
|
|
2460
2621
|
const context = { widgetName: action.payload.widgetName };
|
|
2461
2622
|
const isTargetFormatPVF = state.view.pendingValidationFailsFormat === "target" /* target */;
|
|
2462
2623
|
return api.deleteBcData(state.screen.screenName, bcUrl, context).pipe(mergeMap26((data) => {
|
|
2463
|
-
|
|
2464
|
-
|
|
2624
|
+
var _a;
|
|
2625
|
+
const postInvoke = (_a = data.postActions) == null ? void 0 : _a[0];
|
|
2626
|
+
return concat18(isTargetFormatPVF ? of26(bcCancelPendingChanges({ bcNames: [bcName] })) : EMPTY22, of26(bcFetchDataRequest({ bcName, widgetName })), postInvoke ? of26(processPostInvoke({ bcName, postInvoke, cursor, widgetName })) : EMPTY22);
|
|
2465
2627
|
}), catchError11((error) => {
|
|
2466
2628
|
console.error(error);
|
|
2467
|
-
return
|
|
2629
|
+
return of26(bcDeleteDataFail({ bcName }));
|
|
2468
2630
|
}));
|
|
2469
2631
|
}));
|
|
2470
2632
|
// src/epics/data/bcSelectRecordEpic.ts
|
|
2471
|
-
import { concat as
|
|
2633
|
+
import { concat as concat19, filter as filter42, mergeMap as mergeMap27, of as of27 } from "rxjs";
|
|
2472
2634
|
var bcSelectRecordEpic = (action$, store$) => action$.pipe(filter42(bcSelectRecord.match), mergeMap27((action) => {
|
|
2473
2635
|
const { bcName, cursor } = action.payload;
|
|
2474
2636
|
const widgets = store$.value.view.widgets;
|
|
@@ -2482,17 +2644,19 @@ var bcSelectRecordEpic = (action$, store$) => action$.pipe(filter42(bcSelectReco
|
|
|
2482
2644
|
keepDelta: action.payload.keepDelta
|
|
2483
2645
|
});
|
|
2484
2646
|
});
|
|
2485
|
-
return
|
|
2647
|
+
return concat19(of27(bcChangeCursors({ cursorsMap: { [bcName]: cursor }, keepDelta: action.payload.keepDelta })), of27(bcFetchRowMeta({ widgetName: "", bcName })), fetchChildrenBcData);
|
|
2486
2648
|
}));
|
|
2487
2649
|
// src/epics/data/changeAssociationEpic.ts
|
|
2488
|
-
import { concat as
|
|
2650
|
+
import { concat as concat20, filter as filter43, mergeMap as mergeMap28, of as of28 } from "rxjs";
|
|
2489
2651
|
var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAssociation.match), mergeMap28((action) => {
|
|
2490
2652
|
var _a, _b, _c, _d, _e;
|
|
2491
2653
|
const state = state$.value;
|
|
2492
2654
|
const selected = action.payload.dataItem._associate;
|
|
2655
|
+
const bcName = action.payload.bcName;
|
|
2493
2656
|
const result = [
|
|
2494
|
-
|
|
2495
|
-
bcName
|
|
2657
|
+
of28(changeDataItem({
|
|
2658
|
+
bcName,
|
|
2659
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2496
2660
|
cursor: action.payload.dataItem.id,
|
|
2497
2661
|
dataItem: action.payload.dataItem
|
|
2498
2662
|
}))
|
|
@@ -2505,32 +2669,32 @@ var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAss
|
|
|
2505
2669
|
fields: widget.fields
|
|
2506
2670
|
};
|
|
2507
2671
|
const hierarchy = (_b = widget.options) == null ? void 0 : _b.hierarchy;
|
|
2508
|
-
const hierarchyDescriptor = isRoot ? rootHierarchyDescriptor : hierarchy.find((item) => item.bcName === action.payload.bcName);
|
|
2672
|
+
const hierarchyDescriptor = isRoot ? rootHierarchyDescriptor : hierarchy == null ? void 0 : hierarchy.find((item) => item.bcName === action.payload.bcName);
|
|
2509
2673
|
const hierarchyGroupSelection = (_c = widget.options) == null ? void 0 : _c.hierarchyGroupSelection;
|
|
2510
2674
|
const hierarchyTraverse = (_d = widget.options) == null ? void 0 : _d.hierarchyTraverse;
|
|
2511
|
-
const childrenBc = hierarchy.slice(hierarchy.findIndex((item) => item.bcName === action.payload.bcName) + 1).map((item) => item.bcName);
|
|
2675
|
+
const childrenBc = hierarchy == null ? void 0 : hierarchy.slice(hierarchy.findIndex((item) => item.bcName === action.payload.bcName) + 1).map((item) => item.bcName);
|
|
2512
2676
|
if (hierarchyGroupSelection && hierarchyDescriptor.radio && !selected) {
|
|
2513
|
-
result.push(
|
|
2677
|
+
result.push(of28(dropAllAssociations({
|
|
2514
2678
|
bcNames: childrenBc
|
|
2515
2679
|
})));
|
|
2516
2680
|
}
|
|
2517
|
-
const parent = isRoot ? null : hierarchy.find((item, index) => {
|
|
2681
|
+
const parent = isRoot ? null : (hierarchy == null ? void 0 : hierarchy.find((item, index) => {
|
|
2518
2682
|
var _a2;
|
|
2519
2683
|
return ((_a2 = hierarchy[index + 1]) == null ? void 0 : _a2.bcName) === action.payload.bcName;
|
|
2520
|
-
}) || rootHierarchyDescriptor;
|
|
2684
|
+
})) || rootHierarchyDescriptor;
|
|
2521
2685
|
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);
|
|
2522
2686
|
if (parent && hierarchyTraverse && selected) {
|
|
2523
2687
|
if (hierarchyDescriptor.radio) {
|
|
2524
|
-
result.push(
|
|
2688
|
+
result.push(of28(dropAllAssociations({
|
|
2525
2689
|
bcNames: [parent.bcName]
|
|
2526
2690
|
})));
|
|
2527
2691
|
}
|
|
2528
|
-
result.push(
|
|
2692
|
+
result.push(of28(changeAssociation({
|
|
2529
2693
|
bcName: parent.bcName,
|
|
2530
2694
|
widgetName: action.payload.widgetName,
|
|
2531
2695
|
dataItem: __spreadProps(__spreadValues({}, parentItem), {
|
|
2532
2696
|
_associate: true,
|
|
2533
|
-
_value: parentItem[parent.assocValueKey || action.payload.assocValueKey]
|
|
2697
|
+
_value: parentItem == null ? void 0 : parentItem[parent.assocValueKey || action.payload.assocValueKey]
|
|
2534
2698
|
}),
|
|
2535
2699
|
assocValueKey: action.payload.assocValueKey
|
|
2536
2700
|
})));
|
|
@@ -2545,7 +2709,7 @@ var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAss
|
|
|
2545
2709
|
data.find((dataValue) => dataValue.id === deltaValue.id);
|
|
2546
2710
|
});
|
|
2547
2711
|
if (wasLastInData && wasLastInDelta) {
|
|
2548
|
-
result.push(
|
|
2712
|
+
result.push(of28(changeAssociation({
|
|
2549
2713
|
bcName: parent.bcName,
|
|
2550
2714
|
widgetName: action.payload.widgetName,
|
|
2551
2715
|
dataItem: __spreadProps(__spreadValues({}, parentItem), { _associate: false }),
|
|
@@ -2553,10 +2717,10 @@ var changeAssociationEpic = (action$, state$) => action$.pipe(filter43(changeAss
|
|
|
2553
2717
|
})));
|
|
2554
2718
|
}
|
|
2555
2719
|
}
|
|
2556
|
-
return
|
|
2720
|
+
return concat20(...result);
|
|
2557
2721
|
}));
|
|
2558
2722
|
// src/epics/data/bcCancelCreateDataEpic.ts
|
|
2559
|
-
import { catchError as catchError12, concat as
|
|
2723
|
+
import { catchError as catchError12, concat as concat21, EMPTY as EMPTY23, filter as filter44, mergeMap as mergeMap29, of as of29 } from "rxjs";
|
|
2560
2724
|
import { OperationTypeCrud as OperationTypeCrud10 } from "@cxbox-ui/schema";
|
|
2561
2725
|
import { isAnyOf as isAnyOf4 } from "@reduxjs/toolkit";
|
|
2562
2726
|
var actionTypesMatcher = isAnyOf4(sendOperation);
|
|
@@ -2565,7 +2729,7 @@ var bcCancelCreateDataEpic = (action$, state$, { api }) => action$.pipe(filter44
|
|
|
2565
2729
|
const state = state$.value;
|
|
2566
2730
|
const screenName = state.screen.screenName;
|
|
2567
2731
|
const bcName = action.payload.bcName;
|
|
2568
|
-
const bcUrl = buildBcUrl(bcName, true);
|
|
2732
|
+
const bcUrl = buildBcUrl(bcName, true, state);
|
|
2569
2733
|
const bc = state.screen.bo.bc[bcName];
|
|
2570
2734
|
const cursor = bc == null ? void 0 : bc.cursor;
|
|
2571
2735
|
const context = { widgetName: action.payload.widgetName };
|
|
@@ -2575,18 +2739,19 @@ var bcCancelCreateDataEpic = (action$, state$, { api }) => action$.pipe(filter44
|
|
|
2575
2739
|
const params = { _action: action.payload.operationType };
|
|
2576
2740
|
const cursorsMap = { [action.payload.bcName]: null };
|
|
2577
2741
|
return api.customAction(screenName, bcUrl, data, context, params).pipe(mergeMap29((response) => {
|
|
2578
|
-
|
|
2579
|
-
|
|
2742
|
+
var _a2;
|
|
2743
|
+
const postInvoke = (_a2 = response.postActions) == null ? void 0 : _a2[0];
|
|
2744
|
+
return concat21(of29(sendOperationSuccess({ bcName, cursor })), of29(bcChangeCursors({ cursorsMap })), postInvoke ? of29(processPostInvoke({ bcName, postInvoke, cursor, widgetName: context.widgetName })) : EMPTY23);
|
|
2580
2745
|
}), catchError12((error) => {
|
|
2581
2746
|
console.error(error);
|
|
2582
|
-
return
|
|
2747
|
+
return of29(bcDeleteDataFail({ bcName }));
|
|
2583
2748
|
}));
|
|
2584
2749
|
}));
|
|
2585
2750
|
// src/epics/data/bcSelectDepthRecordEpic.ts
|
|
2586
|
-
import { concat as
|
|
2751
|
+
import { concat as concat22, filter as filter45, mergeMap as mergeMap30, of as of30 } from "rxjs";
|
|
2587
2752
|
var bcSelectDepthRecordEpic = (action$) => action$.pipe(filter45(bcSelectDepthRecord.match), mergeMap30((action) => {
|
|
2588
2753
|
const { bcName, cursor, depth } = action.payload;
|
|
2589
|
-
return
|
|
2754
|
+
return concat22(of30(bcChangeDepthCursor({ bcName, depth, cursor })), of30(bcFetchDataRequest({
|
|
2590
2755
|
bcName,
|
|
2591
2756
|
depth: depth + 1,
|
|
2592
2757
|
widgetName: "",
|
|
@@ -2594,7 +2759,7 @@ var bcSelectDepthRecordEpic = (action$) => action$.pipe(filter45(bcSelectDepthRe
|
|
|
2594
2759
|
})));
|
|
2595
2760
|
}));
|
|
2596
2761
|
// src/epics/data/removeMultivalueTagEpic.ts
|
|
2597
|
-
import { concat as
|
|
2762
|
+
import { concat as concat23, filter as filter46, mergeMap as mergeMap31, of as of31 } from "rxjs";
|
|
2598
2763
|
var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeMultivalueTag.match), mergeMap31((action) => {
|
|
2599
2764
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2600
2765
|
const state = state$.value;
|
|
@@ -2609,28 +2774,28 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2609
2774
|
const removedItem = data.find((item) => item.id === action.payload.removedItem.id);
|
|
2610
2775
|
const associated = action.payload.dataItem.map((item) => item.id);
|
|
2611
2776
|
let removedNodes = [];
|
|
2612
|
-
if ((_a = widget.options) == null ? void 0 : _a.hierarchyGroupDeselection) {
|
|
2613
|
-
if ((_b = widget.options) == null ? void 0 : _b.hierarchyTraverse) {
|
|
2777
|
+
if ((_a = widget == null ? void 0 : widget.options) == null ? void 0 : _a.hierarchyGroupDeselection) {
|
|
2778
|
+
if ((_b = widget == null ? void 0 : widget.options) == null ? void 0 : _b.hierarchyTraverse) {
|
|
2614
2779
|
data = assignTreeLinks(data);
|
|
2615
2780
|
}
|
|
2616
|
-
const removedItemChildren = data.filter((item) => item.parentId === removedItem.id);
|
|
2617
|
-
removedNodes = [removedItem.id, ...removedItemChildren.filter((item) => associated.includes(item.id)).map((item) => item.id)];
|
|
2618
|
-
if ((_c = widget.options) == null ? void 0 : _c.hierarchyTraverse) {
|
|
2781
|
+
const removedItemChildren = data.filter((item) => item.parentId === (removedItem == null ? void 0 : removedItem.id));
|
|
2782
|
+
removedNodes = [removedItem == null ? void 0 : removedItem.id, ...removedItemChildren.filter((item) => associated.includes(item.id)).map((item) => item.id)];
|
|
2783
|
+
if ((_c = widget == null ? void 0 : widget.options) == null ? void 0 : _c.hierarchyTraverse) {
|
|
2619
2784
|
getDescendants(removedItemChildren, removedNodes);
|
|
2620
2785
|
removedNodes = data.filter((item) => removedNodes.includes(item.id) && associated.includes(item.id)).map((item) => item.id);
|
|
2621
2786
|
}
|
|
2622
|
-
const parent = data.find((item) => item.id === removedItem.parentId);
|
|
2787
|
+
const parent = data.find((item) => item.id === (removedItem == null ? void 0 : removedItem.parentId));
|
|
2623
2788
|
const siblings = data.filter((item) => item.parentId === (parent == null ? void 0 : parent.id));
|
|
2624
2789
|
const parentEmpty = siblings.every((child) => removedNodes.includes(child.id) || !associated.includes(child.id));
|
|
2625
2790
|
if (parent && parentEmpty) {
|
|
2626
|
-
if ((_d = widget.options) == null ? void 0 : _d.hierarchyTraverse) {
|
|
2791
|
+
if ((_d = widget == null ? void 0 : widget.options) == null ? void 0 : _d.hierarchyTraverse) {
|
|
2627
2792
|
const parentDescendants = [];
|
|
2628
2793
|
getDescendants(siblings, parentDescendants);
|
|
2629
2794
|
const parentDeepEmpty = parentDescendants.every((descendant) => {
|
|
2630
2795
|
return removedNodes.includes(descendant) || !associated.includes(descendant);
|
|
2631
2796
|
});
|
|
2632
2797
|
if (parentDeepEmpty) {
|
|
2633
|
-
return
|
|
2798
|
+
return concat23(of31(removeMultivalueTag(__spreadProps(__spreadValues({}, action.payload), {
|
|
2634
2799
|
removedItem: { id: parent.id, value: null }
|
|
2635
2800
|
}))));
|
|
2636
2801
|
}
|
|
@@ -2640,51 +2805,58 @@ var removeMultivalueTagEpic = (action$, state$) => action$.pipe(filter46(removeM
|
|
|
2640
2805
|
}
|
|
2641
2806
|
}
|
|
2642
2807
|
}
|
|
2643
|
-
if ((_e = widget.options) == null ? void 0 : _e.hierarchyFull) {
|
|
2644
|
-
return
|
|
2808
|
+
if ((_e = widget == null ? void 0 : widget.options) == null ? void 0 : _e.hierarchyFull) {
|
|
2809
|
+
return of31(changeDataItem({
|
|
2645
2810
|
bcName,
|
|
2811
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2646
2812
|
cursor,
|
|
2647
2813
|
dataItem: { [associateFieldKey]: action.payload.dataItem.filter((item) => !removedNodes.includes(item.id)) }
|
|
2648
2814
|
}));
|
|
2649
2815
|
}
|
|
2650
|
-
if ((_f = widget.options) == null ? void 0 : _f.hierarchy) {
|
|
2651
|
-
|
|
2816
|
+
if ((_f = widget == null ? void 0 : widget.options) == null ? void 0 : _f.hierarchy) {
|
|
2817
|
+
const hierarchyBcName = (_j = (_i = (_h = (_g = widget == null ? void 0 : widget.options) == null ? void 0 : _g.hierarchy) == null ? void 0 : _h.find((hierarchyData) => {
|
|
2818
|
+
var _a2;
|
|
2819
|
+
return (_a2 = state.view.pendingDataChanges[hierarchyData.bcName]) == null ? void 0 : _a2[action.payload.removedItem.id];
|
|
2820
|
+
})) == null ? void 0 : _i.bcName) != null ? _j : bcName;
|
|
2821
|
+
return concat23(of31(changeDataItem({
|
|
2652
2822
|
/**
|
|
2653
2823
|
* This is incorrect and will break if different BC has records with
|
|
2654
2824
|
* identical ids.
|
|
2655
2825
|
*
|
|
2656
2826
|
* TODO: Record `level` should be mapped to hierarchyData index instead
|
|
2657
2827
|
*/
|
|
2658
|
-
bcName:
|
|
2659
|
-
|
|
2660
|
-
return (_a2 = state.view.pendingDataChanges[hierarchyData.bcName]) == null ? void 0 : _a2[action.payload.removedItem.id];
|
|
2661
|
-
})) == null ? void 0 : _i.bcName) != null ? _j : bcName,
|
|
2828
|
+
bcName: hierarchyBcName,
|
|
2829
|
+
bcUrl: buildBcUrl(hierarchyBcName, true, state),
|
|
2662
2830
|
cursor: action.payload.removedItem.id,
|
|
2663
2831
|
dataItem: __spreadProps(__spreadValues({}, action.payload.removedItem), { _associate: false })
|
|
2664
|
-
})),
|
|
2832
|
+
})), of31(changeDataItem({
|
|
2665
2833
|
bcName,
|
|
2834
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2666
2835
|
cursor,
|
|
2667
2836
|
dataItem: { [associateFieldKey]: action.payload.dataItem }
|
|
2668
2837
|
})));
|
|
2669
2838
|
}
|
|
2670
|
-
return
|
|
2839
|
+
return concat23(of31(changeDataItem({
|
|
2671
2840
|
bcName: popupBcName,
|
|
2841
|
+
bcUrl: buildBcUrl(popupBcName, true, state),
|
|
2672
2842
|
cursor: action.payload.removedItem.id,
|
|
2673
2843
|
dataItem: __spreadProps(__spreadValues({}, action.payload.removedItem), { _associate: false })
|
|
2674
|
-
})),
|
|
2844
|
+
})), of31(changeDataItem({
|
|
2675
2845
|
bcName,
|
|
2846
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2676
2847
|
cursor,
|
|
2677
2848
|
dataItem: { [associateFieldKey]: action.payload.dataItem }
|
|
2678
2849
|
})));
|
|
2679
2850
|
}));
|
|
2680
2851
|
// src/epics/data/bcFetchRowMetaRequestEpic.ts
|
|
2681
|
-
import { catchError as catchError13, filter as filter47, map as map9, mergeMap as mergeMap32, of as
|
|
2852
|
+
import { catchError as catchError13, filter as filter47, map as map9, mergeMap as mergeMap32, of as of32, race as race3 } from "rxjs";
|
|
2682
2853
|
var bcFetchRowMetaRequestEpic = (action$, state$, { api }) => action$.pipe(filter47(bcFetchRowMeta.match), mergeMap32((action) => {
|
|
2854
|
+
var _a, _b;
|
|
2683
2855
|
const state = state$.value;
|
|
2684
2856
|
const screenName = state.screen.screenName;
|
|
2685
2857
|
const bcName = action.payload.bcName;
|
|
2686
|
-
const cursor = state.screen.bo.bc[bcName].cursor;
|
|
2687
|
-
const bcUrl = buildBcUrl(bcName, true);
|
|
2858
|
+
const cursor = (_a = state.screen.bo.bc[bcName].cursor) != null ? _a : "";
|
|
2859
|
+
const bcUrl = (_b = buildBcUrl(bcName, true, state)) != null ? _b : "";
|
|
2688
2860
|
const canceler = api.createCanceler();
|
|
2689
2861
|
const cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchRowMetaFail({ bcName }));
|
|
2690
2862
|
const cancelByParentBc = cancelRequestEpic(action$, [bcSelectRecord], canceler.cancel, bcFetchRowMetaFail({ bcName }), (filteredAction) => {
|
|
@@ -2695,12 +2867,12 @@ var bcFetchRowMetaRequestEpic = (action$, state$, { api }) => action$.pipe(filte
|
|
|
2695
2867
|
return bcFetchRowMetaSuccess({ bcName, rowMeta, bcUrl, cursor });
|
|
2696
2868
|
}), catchError13((error) => {
|
|
2697
2869
|
console.error(error);
|
|
2698
|
-
return
|
|
2870
|
+
return of32(bcFetchRowMetaFail({ bcName }));
|
|
2699
2871
|
}));
|
|
2700
2872
|
return race3(cancelFlow, cancelByParentBc, normalFlow);
|
|
2701
2873
|
}));
|
|
2702
2874
|
// src/epics/data/changeAssociationFullEpic.ts
|
|
2703
|
-
import { concat as
|
|
2875
|
+
import { concat as concat24, filter as filter48, mergeMap as mergeMap33, of as of33 } from "rxjs";
|
|
2704
2876
|
var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(changeAssociationFull.match), mergeMap33((action) => {
|
|
2705
2877
|
var _a, _b, _c, _d, _e;
|
|
2706
2878
|
const state = state$.value;
|
|
@@ -2730,7 +2902,7 @@ var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(chang
|
|
|
2730
2902
|
return false;
|
|
2731
2903
|
});
|
|
2732
2904
|
if (prevSelected) {
|
|
2733
|
-
result.push(
|
|
2905
|
+
result.push(of33(changeAssociationFull({
|
|
2734
2906
|
bcName,
|
|
2735
2907
|
depth,
|
|
2736
2908
|
widgetName: action.payload.widgetName,
|
|
@@ -2740,7 +2912,7 @@ var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(chang
|
|
|
2740
2912
|
}
|
|
2741
2913
|
}
|
|
2742
2914
|
else {
|
|
2743
|
-
result.push(
|
|
2915
|
+
result.push(of33(changeDescendantsAssociationsFull({
|
|
2744
2916
|
bcName,
|
|
2745
2917
|
parentId: action.payload.dataItem.id,
|
|
2746
2918
|
depth: depth + 1,
|
|
@@ -2749,19 +2921,20 @@ var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(chang
|
|
|
2749
2921
|
})));
|
|
2750
2922
|
}
|
|
2751
2923
|
}
|
|
2752
|
-
result.push(
|
|
2924
|
+
result.push(of33(changeDataItem({
|
|
2753
2925
|
bcName: action.payload.bcName,
|
|
2926
|
+
bcUrl: buildBcUrl(action.payload.bcName, true, state),
|
|
2754
2927
|
cursor: action.payload.dataItem.id,
|
|
2755
2928
|
dataItem: action.payload.dataItem
|
|
2756
2929
|
})));
|
|
2757
2930
|
if (parentDepth && hierarchyTraverse && selected) {
|
|
2758
|
-
result.push(
|
|
2931
|
+
result.push(of33(changeAssociationFull({
|
|
2759
2932
|
bcName,
|
|
2760
2933
|
depth: parentDepth,
|
|
2761
2934
|
widgetName: action.payload.widgetName,
|
|
2762
2935
|
dataItem: __spreadProps(__spreadValues({}, parentItem), {
|
|
2763
2936
|
_associate: true,
|
|
2764
|
-
_value: parentItem[assocValueKey]
|
|
2937
|
+
_value: parentItem == null ? void 0 : parentItem[assocValueKey]
|
|
2765
2938
|
}),
|
|
2766
2939
|
assocValueKey
|
|
2767
2940
|
})));
|
|
@@ -2774,7 +2947,7 @@ var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(chang
|
|
|
2774
2947
|
const deltaFalseId = delta && ((_e = Object.values(delta)) == null ? void 0 : _e.filter((item) => item._associate === false).map((item) => item.id));
|
|
2775
2948
|
const wasLastInData = currentLevelData.filter((item) => item.id !== action.payload.dataItem.id && !(deltaFalseId == null ? void 0 : deltaFalseId.includes(item.id))).every((item) => !item._associate);
|
|
2776
2949
|
if (wasLastInData && wasLastInDelta) {
|
|
2777
|
-
result.push(
|
|
2950
|
+
result.push(of33(changeAssociationFull({
|
|
2778
2951
|
bcName,
|
|
2779
2952
|
depth: parentDepth,
|
|
2780
2953
|
widgetName: action.payload.widgetName,
|
|
@@ -2783,58 +2956,61 @@ var changeAssociationFullEpic = (action$, state$) => action$.pipe(filter48(chang
|
|
|
2783
2956
|
})));
|
|
2784
2957
|
}
|
|
2785
2958
|
}
|
|
2786
|
-
return
|
|
2959
|
+
return concat24(...result);
|
|
2787
2960
|
}));
|
|
2788
2961
|
// src/epics/data/saveAssociationsActiveEpic.ts
|
|
2789
|
-
import { catchError as catchError14, concat as
|
|
2962
|
+
import { catchError as catchError14, concat as concat25, EMPTY as EMPTY24, filter as filter49, mergeMap as mergeMap34, of as of34, switchMap as switchMap12 } from "rxjs";
|
|
2790
2963
|
var saveAssociationsActiveEpic = (action$, state$, { api }) => action$.pipe(filter49(saveAssociations.match), filter49((action) => {
|
|
2791
|
-
|
|
2964
|
+
var _a;
|
|
2965
|
+
return (_a = state$.value.view.popupData) == null ? void 0 : _a.active;
|
|
2792
2966
|
}), switchMap12((action) => {
|
|
2967
|
+
var _a, _b;
|
|
2793
2968
|
const state = state$.value;
|
|
2794
|
-
const calleeBCName = state.view.popupData.calleeBCName;
|
|
2795
|
-
const calleeWidgetName = state.view.popupData.calleeWidgetName;
|
|
2969
|
+
const calleeBCName = (_a = state.view.popupData) == null ? void 0 : _a.calleeBCName;
|
|
2970
|
+
const calleeWidgetName = (_b = state.view.popupData) == null ? void 0 : _b.calleeWidgetName;
|
|
2796
2971
|
const bcNames = action.payload.bcNames;
|
|
2797
|
-
const bcUrl = buildBcUrl(calleeBCName, true);
|
|
2972
|
+
const bcUrl = buildBcUrl(calleeBCName, true, state);
|
|
2798
2973
|
const pendingChanges = state.view.pendingDataChanges[bcNames[0]] || {};
|
|
2799
2974
|
const params = bcNames.length ? { _bcName: bcNames[bcNames.length - 1] } : {};
|
|
2800
2975
|
return api.associate(state.screen.screenName, bcUrl, Object.values(pendingChanges).filter((i) => i._associate), params).pipe(mergeMap34((response) => {
|
|
2801
2976
|
const postInvoke = response.postActions[0];
|
|
2802
2977
|
const calleeWidget = state.view.widgets.find((widgetItem) => widgetItem.bcName === calleeBCName);
|
|
2803
|
-
return
|
|
2978
|
+
return concat25(postInvoke ? of34(processPostInvoke({ bcName: calleeBCName, postInvoke, widgetName: calleeWidget == null ? void 0 : calleeWidget.name })) : EMPTY24, of34(bcCancelPendingChanges({ bcNames })), of34(bcForceUpdate({ bcName: calleeBCName, widgetName: calleeWidgetName })));
|
|
2804
2979
|
}), catchError14((err) => {
|
|
2805
2980
|
console.error(err);
|
|
2806
|
-
return
|
|
2981
|
+
return EMPTY24;
|
|
2807
2982
|
}));
|
|
2808
2983
|
}));
|
|
2809
2984
|
// src/epics/data/changeAssociationSameBcEpic.ts
|
|
2810
|
-
import { concat as
|
|
2985
|
+
import { concat as concat26, filter as filter50, mergeMap as mergeMap35, of as of35 } from "rxjs";
|
|
2811
2986
|
var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(changeAssociationSameBc.match), mergeMap35((action) => {
|
|
2812
|
-
var _a, _b, _c, _d, _e;
|
|
2987
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2988
|
+
const state = state$.value;
|
|
2813
2989
|
const bcName = action.payload.bcName;
|
|
2814
2990
|
const result = [
|
|
2815
|
-
|
|
2991
|
+
of35(changeDataItem({
|
|
2816
2992
|
bcName,
|
|
2993
|
+
bcUrl: buildBcUrl(bcName, true, state),
|
|
2817
2994
|
cursor: action.payload.dataItem.id,
|
|
2818
2995
|
dataItem: action.payload.dataItem
|
|
2819
2996
|
}))
|
|
2820
2997
|
];
|
|
2821
|
-
const state = state$.value;
|
|
2822
2998
|
const selected = action.payload.dataItem._associate;
|
|
2823
2999
|
const depth = action.payload.depth || 1;
|
|
2824
3000
|
const parentDepth = depth - 1;
|
|
2825
3001
|
const widget = state.view.widgets.find((item) => item.name === action.payload.widgetName);
|
|
2826
3002
|
const hierarchyTraverse = (_a = widget.options) == null ? void 0 : _a.hierarchyTraverse;
|
|
2827
3003
|
const currentData = depth > 1 ? (_b = state.depthData[depth]) == null ? void 0 : _b[bcName] : state.data[bcName];
|
|
2828
|
-
const parentCursor = parentDepth ? parentDepth > 1 ? (_c = state.screen.bo.bc[bcName].depthBc[parentDepth]) == null ? void 0 :
|
|
2829
|
-
const parentItem = parentCursor ? parentDepth > 1 ? (
|
|
3004
|
+
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;
|
|
3005
|
+
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;
|
|
2830
3006
|
if (parentDepth && hierarchyTraverse && selected) {
|
|
2831
|
-
result.push(
|
|
3007
|
+
result.push(of35(changeAssociationSameBc({
|
|
2832
3008
|
bcName,
|
|
2833
3009
|
depth: parentDepth,
|
|
2834
3010
|
widgetName: action.payload.widgetName,
|
|
2835
3011
|
dataItem: __spreadProps(__spreadValues({}, parentItem), {
|
|
2836
3012
|
_associate: true,
|
|
2837
|
-
_value: parentItem[action.payload.assocValueKey]
|
|
3013
|
+
_value: parentItem == null ? void 0 : parentItem[action.payload.assocValueKey]
|
|
2838
3014
|
}),
|
|
2839
3015
|
assocValueKey: action.payload.assocValueKey
|
|
2840
3016
|
})));
|
|
@@ -2842,7 +3018,7 @@ var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(cha
|
|
|
2842
3018
|
if (parentDepth && hierarchyTraverse && !selected) {
|
|
2843
3019
|
const wasLastInData = currentData.filter((item) => item.id !== action.payload.dataItem.id).every((item) => !item._associate);
|
|
2844
3020
|
if (wasLastInData) {
|
|
2845
|
-
result.push(
|
|
3021
|
+
result.push(of35(changeAssociationSameBc({
|
|
2846
3022
|
bcName,
|
|
2847
3023
|
depth: parentDepth,
|
|
2848
3024
|
widgetName: action.payload.widgetName,
|
|
@@ -2851,33 +3027,35 @@ var changeAssociationSameBcEpic = (action$, state$) => action$.pipe(filter50(cha
|
|
|
2851
3027
|
})));
|
|
2852
3028
|
}
|
|
2853
3029
|
}
|
|
2854
|
-
return
|
|
3030
|
+
return concat26(...result);
|
|
2855
3031
|
}));
|
|
2856
3032
|
// src/epics/data/inlinePickListFetchDataEpic.ts
|
|
2857
|
-
import { catchError as catchError15, filter as filter51, mergeMap as mergeMap36, of as
|
|
3033
|
+
import { catchError as catchError15, filter as filter51, mergeMap as mergeMap36, of as of36, race as race4 } from "rxjs";
|
|
2858
3034
|
var inlinePickListFetchDataEpic = (action$, state$, { api }) => action$.pipe(filter51(inlinePickListFetchDataRequest.match), mergeMap36((action) => {
|
|
2859
3035
|
const { bcName, searchSpec, searchString } = action.payload;
|
|
2860
|
-
const
|
|
3036
|
+
const state = state$.value;
|
|
3037
|
+
const bcUrl = buildBcUrl(bcName, false, state);
|
|
2861
3038
|
const canceler = api.createCanceler();
|
|
2862
3039
|
const cancelFlow = cancelRequestEpic(action$, cancelRequestActionTypes, canceler.cancel, bcFetchDataFail({ bcName, bcUrl }));
|
|
2863
3040
|
const normalFlow = api.fetchBcData(state$.value.screen.screenName, bcUrl, { [searchSpec + ".contains"]: searchString }, canceler.cancelToken).pipe(mergeMap36((data) => {
|
|
2864
|
-
return
|
|
3041
|
+
return of36(bcFetchDataSuccess({ bcName, data: data.data, bcUrl }));
|
|
2865
3042
|
}), catchError15((error) => {
|
|
2866
3043
|
console.error(error);
|
|
2867
|
-
return
|
|
3044
|
+
return of36(bcFetchDataFail({ bcName: action.payload.bcName, bcUrl }));
|
|
2868
3045
|
}));
|
|
2869
3046
|
return race4(cancelFlow, normalFlow);
|
|
2870
3047
|
}));
|
|
2871
3048
|
// src/epics/data/saveAssociationsPassiveEpic.ts
|
|
2872
|
-
import { filter as filter52, of as
|
|
3049
|
+
import { filter as filter52, of as of37, switchMap as switchMap13 } from "rxjs";
|
|
2873
3050
|
var saveAssociationsPassiveEpic = (action$, state$) => action$.pipe(filter52(saveAssociations.match), filter52(() => {
|
|
2874
|
-
return !state$.value.view.popupData.active;
|
|
2875
|
-
}), switchMap13((action) => {
|
|
2876
3051
|
var _a;
|
|
3052
|
+
return !((_a = state$.value.view.popupData) == null ? void 0 : _a.active);
|
|
3053
|
+
}), switchMap13((action) => {
|
|
3054
|
+
var _a, _b;
|
|
2877
3055
|
const state = state$.value;
|
|
2878
|
-
const { calleeBCName = action.payload.calleeBcName, associateFieldKey = action.payload.associateFieldKey } = state.view.popupData;
|
|
3056
|
+
const { calleeBCName = action.payload.calleeBcName, associateFieldKey = action.payload.associateFieldKey } = (_a = state.view.popupData) != null ? _a : {};
|
|
2879
3057
|
const cursor = state.screen.bo.bc[calleeBCName].cursor;
|
|
2880
|
-
const recordPrevData = (
|
|
3058
|
+
const recordPrevData = (_b = state.data[calleeBCName].find((dataStateRecord) => dataStateRecord.id === cursor)[associateFieldKey]) != null ? _b : [];
|
|
2881
3059
|
const newValues = [];
|
|
2882
3060
|
action.payload.bcNames.forEach((pendingBc) => {
|
|
2883
3061
|
const pendingChanges = state.view.pendingDataChanges[pendingBc] || {};
|
|
@@ -2900,8 +3078,9 @@ var saveAssociationsPassiveEpic = (action$, state$) => action$.pipe(filter52(sav
|
|
|
2900
3078
|
}
|
|
2901
3079
|
return true;
|
|
2902
3080
|
}).concat(...addedItems);
|
|
2903
|
-
return
|
|
3081
|
+
return of37(changeDataItem({
|
|
2904
3082
|
bcName: calleeBCName,
|
|
3083
|
+
bcUrl: buildBcUrl(calleeBCName, true, state),
|
|
2905
3084
|
cursor,
|
|
2906
3085
|
dataItem: {
|
|
2907
3086
|
[associateFieldKey]: result
|
|
@@ -2909,11 +3088,11 @@ var saveAssociationsPassiveEpic = (action$, state$) => action$.pipe(filter52(sav
|
|
|
2909
3088
|
}));
|
|
2910
3089
|
}));
|
|
2911
3090
|
// src/epics/data/changeChildrenAssociationsEpic.ts
|
|
2912
|
-
import { filter as filter53, mergeMap as mergeMap37, of as
|
|
3091
|
+
import { filter as filter53, mergeMap as mergeMap37, of as of38 } from "rxjs";
|
|
2913
3092
|
var changeChildrenAssociationsEpic = (action$, state$, { api }) => action$.pipe(filter53(changeChildrenAssociations.match), mergeMap37((action) => {
|
|
2914
3093
|
const state = state$.value;
|
|
2915
3094
|
const data = state.data[action.payload.bcName];
|
|
2916
|
-
return
|
|
3095
|
+
return of38(changeDataItems({
|
|
2917
3096
|
bcName: action.payload.bcName,
|
|
2918
3097
|
cursors: data.map((item) => item.id),
|
|
2919
3098
|
dataItems: data.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
@@ -2923,12 +3102,12 @@ var changeChildrenAssociationsEpic = (action$, state$, { api }) => action$.pipe(
|
|
|
2923
3102
|
}));
|
|
2924
3103
|
}));
|
|
2925
3104
|
// src/epics/data/changeChildrenAssociationsSameBcEpic.ts
|
|
2926
|
-
import { filter as filter54, mergeMap as mergeMap38, of as
|
|
3105
|
+
import { filter as filter54, mergeMap as mergeMap38, of as of39 } from "rxjs";
|
|
2927
3106
|
var changeChildrenAssociationsSameBcEpic = (action$, state$) => action$.pipe(filter54(changeChildrenAssociationsSameBc.match), mergeMap38((action) => {
|
|
2928
3107
|
var _a;
|
|
2929
3108
|
const state = state$.value;
|
|
2930
3109
|
const data = ((_a = state.depthData[action.payload.depth]) == null ? void 0 : _a[action.payload.bcName]) || [];
|
|
2931
|
-
return
|
|
3110
|
+
return of39(changeDataItems({
|
|
2932
3111
|
bcName: action.payload.bcName,
|
|
2933
3112
|
cursors: data.map((item) => item.id),
|
|
2934
3113
|
dataItems: data.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
@@ -2938,14 +3117,14 @@ var changeChildrenAssociationsSameBcEpic = (action$, state$) => action$.pipe(fil
|
|
|
2938
3117
|
}));
|
|
2939
3118
|
}));
|
|
2940
3119
|
// src/epics/data/changeDescendantsAssociationsFullEpic.ts
|
|
2941
|
-
import { concat as
|
|
3120
|
+
import { concat as concat27, filter as filter55, mergeMap as mergeMap39, of as of40 } from "rxjs";
|
|
2942
3121
|
var changeDescendantsAssociationsFullEpic = (action$, state$) => action$.pipe(filter55(changeDescendantsAssociationsFull.match), mergeMap39((action) => {
|
|
2943
3122
|
const state = state$.value;
|
|
2944
3123
|
const depth = action.payload.depth;
|
|
2945
3124
|
const data = state.data[action.payload.bcName];
|
|
2946
3125
|
const targetData = (data || []).filter((item) => item.level === depth && item.parentId === action.payload.parentId);
|
|
2947
3126
|
const result = [
|
|
2948
|
-
|
|
3127
|
+
of40(changeDataItems({
|
|
2949
3128
|
bcName: action.payload.bcName,
|
|
2950
3129
|
cursors: targetData.map((item) => item.id),
|
|
2951
3130
|
dataItems: targetData.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
@@ -2956,13 +3135,13 @@ var changeDescendantsAssociationsFullEpic = (action$, state$) => action$.pipe(fi
|
|
|
2956
3135
|
];
|
|
2957
3136
|
targetData.forEach((targetDataItem) => {
|
|
2958
3137
|
if (data.find((dataItem) => dataItem.parentId === targetDataItem.id)) {
|
|
2959
|
-
result.push(
|
|
3138
|
+
result.push(of40(changeDescendantsAssociationsFull(__spreadProps(__spreadValues({}, action.payload), {
|
|
2960
3139
|
parentId: targetDataItem.id,
|
|
2961
3140
|
depth: depth + 1
|
|
2962
3141
|
}))));
|
|
2963
3142
|
}
|
|
2964
3143
|
});
|
|
2965
|
-
return
|
|
3144
|
+
return concat27(...result);
|
|
2966
3145
|
}));
|
|
2967
3146
|
// src/api/ObservableApiWrapper.ts
|
|
2968
3147
|
import axios2 from "axios";
|
|
@@ -2990,7 +3169,7 @@ var ObservableApiWrapper = class {
|
|
|
2990
3169
|
}));
|
|
2991
3170
|
this.instance = instance;
|
|
2992
3171
|
}
|
|
2993
|
-
get(path, config
|
|
3172
|
+
get(path, config, callContext) {
|
|
2994
3173
|
return from(this.instance.get(path, config)).pipe(takeWhile(redirectOccurred), map10((response) => response.data));
|
|
2995
3174
|
}
|
|
2996
3175
|
put(path, data, callContext) {
|
|
@@ -3005,10 +3184,10 @@ var ObservableApiWrapper = class {
|
|
|
3005
3184
|
};
|
|
3006
3185
|
// src/api/ObservableApi.ts
|
|
3007
3186
|
import axios3 from "axios";
|
|
3008
|
-
import { EMPTY as
|
|
3187
|
+
import { EMPTY as EMPTY25, expand, map as map11, reduce } from "rxjs";
|
|
3009
3188
|
var Api = class {
|
|
3010
3189
|
constructor(instance) {
|
|
3011
|
-
__publicField(this, "api$"
|
|
3190
|
+
__publicField(this, "api$");
|
|
3012
3191
|
this.api$ = new ObservableApiWrapper(instance);
|
|
3013
3192
|
}
|
|
3014
3193
|
routerRequest(path, params) {
|
|
@@ -3026,30 +3205,33 @@ var Api = class {
|
|
|
3026
3205
|
fetchBcDataAll(screenName, bcUrl, params = {}) {
|
|
3027
3206
|
let currentPage = 1;
|
|
3028
3207
|
return this.fetchBcData(screenName, bcUrl, __spreadProps(__spreadValues({}, params), { _page: currentPage })).pipe(expand((response) => {
|
|
3029
|
-
return response.hasNext ? this.fetchBcData(screenName, bcUrl, __spreadProps(__spreadValues({}, params), { _page: ++currentPage })) :
|
|
3208
|
+
return response.hasNext ? this.fetchBcData(screenName, bcUrl, __spreadProps(__spreadValues({}, params), { _page: ++currentPage })) : EMPTY25;
|
|
3030
3209
|
}), reduce((items, nextResponse) => {
|
|
3031
3210
|
return [...items, ...nextResponse.data];
|
|
3032
3211
|
}, []));
|
|
3033
3212
|
}
|
|
3034
3213
|
fetchRowMeta(screenName, bcUrl, params, cancelToken) {
|
|
3035
3214
|
const url = applyParams(buildUrl `row-meta/${screenName}/` + bcUrl, params);
|
|
3036
|
-
return this.api$.get(url, { cancelToken }).pipe(map11((response) =>
|
|
3215
|
+
return this.api$.get(url, { cancelToken }).pipe(map11((response) => {
|
|
3216
|
+
var _a;
|
|
3217
|
+
return (_a = response.data) == null ? void 0 : _a.row;
|
|
3218
|
+
}));
|
|
3037
3219
|
}
|
|
3038
3220
|
newBcData(screenName, bcUrl, context, params) {
|
|
3039
3221
|
const url = applyParams(buildUrl `row-meta-new/${screenName}/` + bcUrl, params);
|
|
3040
|
-
return this.api$.get(url,
|
|
3222
|
+
return this.api$.get(url, void 0, context).pipe(map11((response) => response.data));
|
|
3041
3223
|
}
|
|
3042
3224
|
saveBcData(screenName, bcUrl, data, context, params) {
|
|
3043
3225
|
const url = applyParams(buildUrl `data/${screenName}/` + bcUrl, params);
|
|
3044
3226
|
return this.api$.put(url, { data }, context).pipe(map11((response) => response.data));
|
|
3045
3227
|
}
|
|
3046
|
-
deleteBcData(screenName, bcUrl, context, params) {
|
|
3228
|
+
deleteBcData(screenName, bcUrl = "", context, params) {
|
|
3047
3229
|
const url = applyParams(buildUrl `data/${screenName}/` + bcUrl, params);
|
|
3048
3230
|
return this.api$.delete(url, context).pipe(map11((response) => response.data));
|
|
3049
3231
|
}
|
|
3050
3232
|
customAction(screenName, bcUrl, data, context, params) {
|
|
3051
3233
|
const url = applyParams(buildUrl `custom-action/${screenName}/` + bcUrl, params);
|
|
3052
|
-
return this.api$.post(url, { data: data || {} },
|
|
3234
|
+
return this.api$.post(url, { data: data || {} }, void 0, context).pipe(map11((response) => response.data));
|
|
3053
3235
|
}
|
|
3054
3236
|
associate(screenName, bcUrl, data, params) {
|
|
3055
3237
|
const processedData = Array.isArray(data) ? data.map((item) => ({
|
|
@@ -3061,9 +3243,23 @@ var Api = class {
|
|
|
3061
3243
|
return this.api$.post(url, processedData).pipe(map11((response) => response.data));
|
|
3062
3244
|
}
|
|
3063
3245
|
getRmByForceActive(screenName, bcUrl, data, params) {
|
|
3064
|
-
const url = applyParams(buildUrl `row-meta/${screenName}/` + bcUrl, params);
|
|
3246
|
+
const url = applyParams(buildUrl `row-meta/${screenName}/` + (bcUrl != null ? bcUrl : ""), params);
|
|
3065
3247
|
return this.api$.post(url, { data }).pipe(map11((response) => response.data.row));
|
|
3066
3248
|
}
|
|
3249
|
+
/**
|
|
3250
|
+
* Get Cxbox API file upload endpoint based on baseURL of axios instance
|
|
3251
|
+
*
|
|
3252
|
+
* Handles empty baseURL and trailing slash
|
|
3253
|
+
*
|
|
3254
|
+
* @returns File upload endpoint
|
|
3255
|
+
*/
|
|
3256
|
+
get fileUploadEndpoint() {
|
|
3257
|
+
const instance = this.api$.instance;
|
|
3258
|
+
if (!instance.defaults.baseURL) {
|
|
3259
|
+
return "/file";
|
|
3260
|
+
}
|
|
3261
|
+
return instance.defaults.baseURL.endsWith("/") ? `${instance.defaults.baseURL}file` : `${instance.defaults.baseURL}/file`;
|
|
3262
|
+
}
|
|
3067
3263
|
refreshMeta() {
|
|
3068
3264
|
return this.api$.get(buildUrl `bc-registry/refresh-meta`);
|
|
3069
3265
|
}
|
|
@@ -3081,5 +3277,239 @@ var Api = class {
|
|
|
3081
3277
|
};
|
|
3082
3278
|
}
|
|
3083
3279
|
};
|
|
3084
|
-
|
|
3280
|
+
// src/utils/autosave.ts
|
|
3281
|
+
function autosaveRoutine(action, store, next) {
|
|
3282
|
+
var _a, _b, _c;
|
|
3283
|
+
const state = store.getState();
|
|
3284
|
+
const dispatch = store.dispatch;
|
|
3285
|
+
const pendingDataChanges = state.view.pendingDataChanges;
|
|
3286
|
+
const bcList = Object.keys(pendingDataChanges);
|
|
3287
|
+
const baseBcNameIndex = ((_a = action.payload) == null ? void 0 : _a.bcName) && bcHasPendingAutosaveChanges(state, action.payload.bcName, (_b = state.screen.bo.bc[action.payload.bcName]) == null ? void 0 : _b.cursor) ? bcList.findIndex((bcName) => {
|
|
3288
|
+
var _a2;
|
|
3289
|
+
return bcName === ((_a2 = action.payload) == null ? void 0 : _a2.bcName);
|
|
3290
|
+
}) : bcList.findIndex((bcName) => {
|
|
3291
|
+
var _a2;
|
|
3292
|
+
return bcHasPendingAutosaveChanges(state, bcName, (_a2 = state.screen.bo.bc[bcName]) == null ? void 0 : _a2.cursor);
|
|
3293
|
+
});
|
|
3294
|
+
const baseBcName = bcList[baseBcNameIndex];
|
|
3295
|
+
if (baseBcNameIndex > -1) {
|
|
3296
|
+
bcList.splice(baseBcNameIndex, 1);
|
|
3297
|
+
}
|
|
3298
|
+
if (baseBcName) {
|
|
3299
|
+
bcList.forEach((bcName) => {
|
|
3300
|
+
var _a2, _b2;
|
|
3301
|
+
const widget = (_a2 = state.view.widgets) == null ? void 0 : _a2.find((v) => v.bcName === bcName);
|
|
3302
|
+
const cursor = (_b2 = state.screen.bo.bc[bcName]) == null ? void 0 : _b2.cursor;
|
|
3303
|
+
if (bcHasPendingAutosaveChanges(state, bcName, cursor)) {
|
|
3304
|
+
dispatch(sendOperation({
|
|
3305
|
+
bcName,
|
|
3306
|
+
operationType: OperationTypeCrud.save,
|
|
3307
|
+
widgetName: widget == null ? void 0 : widget.name
|
|
3308
|
+
}));
|
|
3309
|
+
}
|
|
3310
|
+
});
|
|
3311
|
+
const baseWidget = (_c = state.view.widgets) == null ? void 0 : _c.find((v) => v.bcName === baseBcName);
|
|
3312
|
+
return next(sendOperation({
|
|
3313
|
+
bcName: baseBcName,
|
|
3314
|
+
operationType: OperationTypeCrud.save,
|
|
3315
|
+
widgetName: baseWidget == null ? void 0 : baseWidget.name,
|
|
3316
|
+
onSuccessAction: action
|
|
3317
|
+
}));
|
|
3318
|
+
}
|
|
3319
|
+
return next(action);
|
|
3320
|
+
}
|
|
3321
|
+
function bcHasPendingAutosaveChanges(store, bcName, cursor) {
|
|
3322
|
+
var _a;
|
|
3323
|
+
const pendingChanges = store.view.pendingDataChanges;
|
|
3324
|
+
const cursorChanges = (_a = pendingChanges[bcName]) == null ? void 0 : _a[cursor];
|
|
3325
|
+
const result = cursorChanges && !Object.keys(cursorChanges).includes("_associate") && Object.values(cursorChanges).length > 0;
|
|
3326
|
+
return result;
|
|
3327
|
+
}
|
|
3328
|
+
function checkUnsavedChangesOfBc(store, bcName) {
|
|
3329
|
+
var _a, _b;
|
|
3330
|
+
const pendingCursors = Object.keys((_b = (_a = store.view.pendingDataChanges) == null ? void 0 : _a[bcName]) != null ? _b : {});
|
|
3331
|
+
return pendingCursors.some((cursor) => bcHasPendingAutosaveChanges(store, bcName, cursor));
|
|
3332
|
+
}
|
|
3333
|
+
// src/middlewares/autosaveMiddleware.ts
|
|
3334
|
+
var saveFormMiddleware = ({ getState, dispatch }) => (next) => (action) => {
|
|
3335
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3336
|
+
const state = getState();
|
|
3337
|
+
const isSendOperation = sendOperation.match(action);
|
|
3338
|
+
const isCoreSendOperation = isSendOperation && coreOperations.includes(action.payload.operationType);
|
|
3339
|
+
const isSelectTableCellInit = selectTableCellInit.match(action);
|
|
3340
|
+
const isSaveAction = isSendOperation && action.payload.operationType === OperationTypeCrud.save;
|
|
3341
|
+
const isNotSaveAction = !isSaveAction;
|
|
3342
|
+
const actionBcName = isSendOperation && action.payload.bcName;
|
|
3343
|
+
const hasAnotherUnsavedBc = Object.keys(state.view.pendingDataChanges).filter((key) => key !== actionBcName).filter((key) => checkUnsavedChangesOfBc(state, key)).length > 0;
|
|
3344
|
+
const isSendOperationForAnotherBc = isCoreSendOperation && hasAnotherUnsavedBc;
|
|
3345
|
+
const selectedCell = state.view.selectedCell;
|
|
3346
|
+
const isSelectTableCellInitOnAnotherRowOrWidget = selectedCell && isSelectTableCellInit && (selectedCell.widgetName !== action.payload.widgetName || selectedCell.rowId !== action.payload.rowId);
|
|
3347
|
+
const defaultSaveWidget = (_a = state.view.widgets) == null ? void 0 : _a.find((item) => {
|
|
3348
|
+
var _a2, _b2;
|
|
3349
|
+
return (_b2 = (_a2 = item == null ? void 0 : item.options) == null ? void 0 : _a2.actionGroups) == null ? void 0 : _b2.defaultSave;
|
|
3350
|
+
});
|
|
3351
|
+
const defaultCursor = (_c = (_b = state.screen.bo.bc) == null ? void 0 : _b[defaultSaveWidget == null ? void 0 : defaultSaveWidget.bcName]) == null ? void 0 : _c.cursor;
|
|
3352
|
+
const pendingData = (_f = (_e = (_d = state.view) == null ? void 0 : _d.pendingDataChanges) == null ? void 0 : _e[defaultSaveWidget == null ? void 0 : defaultSaveWidget.bcName]) == null ? void 0 : _f[defaultCursor];
|
|
3353
|
+
const isChangeLocation = defaultSaveWidget && changeLocation.match(action) && Object.keys(pendingData || {}).length > 0;
|
|
3354
|
+
if (isChangeLocation) {
|
|
3355
|
+
return next(sendOperation({
|
|
3356
|
+
bcName: defaultSaveWidget.bcName,
|
|
3357
|
+
operationType: ((_g = defaultSaveWidget.options) == null ? void 0 : _g.actionGroups).defaultSave,
|
|
3358
|
+
widgetName: defaultSaveWidget.name,
|
|
3359
|
+
onSuccessAction: action
|
|
3360
|
+
}));
|
|
3361
|
+
}
|
|
3362
|
+
const isNeedSaveCondition = isNotSaveAction && (isSendOperationForAnotherBc || isSelectTableCellInitOnAnotherRowOrWidget);
|
|
3363
|
+
if (isNeedSaveCondition) {
|
|
3364
|
+
return autosaveRoutine(action, { getState, dispatch }, next);
|
|
3365
|
+
}
|
|
3366
|
+
return next(action);
|
|
3367
|
+
};
|
|
3368
|
+
// src/middlewares/requiredFieldsMiddleware.ts
|
|
3369
|
+
var requiredFields = ({ getState, dispatch }) => (next) => (action) => {
|
|
3370
|
+
var _a, _b, _c, _d;
|
|
3371
|
+
const state = getState();
|
|
3372
|
+
if (sendOperation.match(action)) {
|
|
3373
|
+
const { bcName, operationType, widgetName } = action.payload;
|
|
3374
|
+
const cursor = (_a = state.screen.bo.bc[bcName]) == null ? void 0 : _a.cursor;
|
|
3375
|
+
if (cursor) {
|
|
3376
|
+
const bcUrl = buildBcUrl(bcName, true, state);
|
|
3377
|
+
const record = (_b = state.data[bcName]) == null ? void 0 : _b.find((item) => item.id === cursor);
|
|
3378
|
+
const rowMeta = bcUrl && ((_c = state.view.rowMeta[bcName]) == null ? void 0 : _c[bcUrl]);
|
|
3379
|
+
const pendingValues = (_d = state.view.pendingDataChanges[bcName]) == null ? void 0 : _d[cursor];
|
|
3380
|
+
const widget = state.view.widgets.find((item) => item.name === widgetName);
|
|
3381
|
+
if (operationRequiresAutosave(operationType, rowMeta == null ? void 0 : rowMeta.actions)) {
|
|
3382
|
+
const fieldsToCheck = {};
|
|
3383
|
+
state.view.widgets.filter((item) => item.bcName === (widget == null ? void 0 : widget.bcName)).forEach((item) => {
|
|
3384
|
+
const itemFieldsCalc = item.fields;
|
|
3385
|
+
if (item.fields) {
|
|
3386
|
+
item.fields.forEach((block) => {
|
|
3387
|
+
if (isWidgetFieldBlock(block)) {
|
|
3388
|
+
block.fields.forEach((field) => itemFieldsCalc.push(field));
|
|
3389
|
+
}
|
|
3390
|
+
});
|
|
3391
|
+
}
|
|
3392
|
+
itemFieldsCalc.forEach((widgetField) => {
|
|
3393
|
+
var _a2;
|
|
3394
|
+
const matchingRowMeta = (_a2 = rowMeta == null ? void 0 : rowMeta.fields) == null ? void 0 : _a2.find((rowMetaField) => rowMetaField.key === widgetField.key);
|
|
3395
|
+
if (!fieldsToCheck[widgetField.key] && matchingRowMeta && !matchingRowMeta.hidden) {
|
|
3396
|
+
fieldsToCheck[widgetField.key] = matchingRowMeta;
|
|
3397
|
+
}
|
|
3398
|
+
});
|
|
3399
|
+
});
|
|
3400
|
+
const dataItem = getRequiredFieldsMissing(record, pendingValues, Object.values(fieldsToCheck));
|
|
3401
|
+
if (dataItem && TableLikeWidgetTypes.includes(widget == null ? void 0 : widget.type)) {
|
|
3402
|
+
dispatch(selectTableCellInit({ widgetName, rowId: cursor, fieldKey: Object.keys(dataItem)[0] }));
|
|
3403
|
+
}
|
|
3404
|
+
return dataItem ? next(changeDataItem({ bcName, bcUrl: buildBcUrl(bcName, true, state), cursor, dataItem })) : next(action);
|
|
3405
|
+
}
|
|
3406
|
+
if (hasPendingValidationFails(state, bcName)) {
|
|
3407
|
+
return addNotification({
|
|
3408
|
+
key: "requiredFieldsMissing",
|
|
3409
|
+
type: "buttonWarningNotification",
|
|
3410
|
+
message: "Required fields are missing",
|
|
3411
|
+
duration: 0,
|
|
3412
|
+
options: {
|
|
3413
|
+
buttonWarningNotificationOptions: {
|
|
3414
|
+
buttonText: "Cancel changes",
|
|
3415
|
+
actionsForClick: [bcCancelPendingChanges(null), clearValidationFails(null)]
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
});
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
return next(action);
|
|
3423
|
+
};
|
|
3424
|
+
function operationRequiresAutosave(operationType, actions) {
|
|
3425
|
+
let result = false;
|
|
3426
|
+
if (!actions) {
|
|
3427
|
+
console.error('rowMeta is missing in the middle of "sendOperation" action');
|
|
3428
|
+
return result;
|
|
3429
|
+
}
|
|
3430
|
+
result = flattenOperations(actions).some((action) => action.type === operationType && action.autoSaveBefore);
|
|
3431
|
+
return result;
|
|
3432
|
+
}
|
|
3433
|
+
function getRequiredFieldsMissing(record, pendingChanges, fieldsMeta) {
|
|
3434
|
+
const result = {};
|
|
3435
|
+
fieldsMeta.forEach((field) => {
|
|
3436
|
+
const value = record == null ? void 0 : record[field.key];
|
|
3437
|
+
const pendingValue = pendingChanges == null ? void 0 : pendingChanges[field.key];
|
|
3438
|
+
const effectiveValue = pendingValue !== void 0 ? pendingValue : value;
|
|
3439
|
+
let falsyValue = false;
|
|
3440
|
+
if (effectiveValue === null || effectiveValue === void 0 || effectiveValue === "") {
|
|
3441
|
+
falsyValue = true;
|
|
3442
|
+
}
|
|
3443
|
+
else if (Array.isArray(effectiveValue) && !effectiveValue.length) {
|
|
3444
|
+
falsyValue = true;
|
|
3445
|
+
}
|
|
3446
|
+
else if (effectiveValue && typeof effectiveValue === "object" && !Object.keys(effectiveValue).length) {
|
|
3447
|
+
falsyValue = true;
|
|
3448
|
+
}
|
|
3449
|
+
if (field.required && falsyValue) {
|
|
3450
|
+
result[field.key] = Array.isArray(effectiveValue) ? [] : null;
|
|
3451
|
+
}
|
|
3452
|
+
});
|
|
3453
|
+
return Object.keys(result).length > 0 ? result : null;
|
|
3454
|
+
}
|
|
3455
|
+
function hasPendingValidationFails(store, bcName) {
|
|
3456
|
+
var _a;
|
|
3457
|
+
if (store.view.pendingValidationFailsFormat !== "target" /* target */ && store.view.pendingValidationFails && Object.keys(store.view.pendingValidationFails).length) {
|
|
3458
|
+
return true;
|
|
3459
|
+
}
|
|
3460
|
+
let checkResult = false;
|
|
3461
|
+
const bcPendingValidations = (_a = store.view.pendingValidationFails) == null ? void 0 : _a[bcName];
|
|
3462
|
+
const cursorsList = bcPendingValidations && Object.keys(bcPendingValidations);
|
|
3463
|
+
if (!cursorsList) {
|
|
3464
|
+
return false;
|
|
3465
|
+
}
|
|
3466
|
+
let i = 0;
|
|
3467
|
+
for (; i < cursorsList.length; i++) {
|
|
3468
|
+
if (Object.keys(bcPendingValidations[cursorsList[i]]).length) {
|
|
3469
|
+
checkResult = true;
|
|
3470
|
+
break;
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
return checkResult;
|
|
3474
|
+
}
|
|
3475
|
+
// src/middlewares/preInvokeMiddleware.ts
|
|
3476
|
+
var preInvokeAction = ({ getState }) => (next) => (action) => {
|
|
3477
|
+
var _a, _b, _c;
|
|
3478
|
+
if (sendOperation.match(action)) {
|
|
3479
|
+
const state = getState();
|
|
3480
|
+
const { operationType, widgetName, confirm } = action.payload;
|
|
3481
|
+
const bcName = (_a = state.view.widgets.find((widgetItem) => widgetItem.name === widgetName)) == null ? void 0 : _a.bcName;
|
|
3482
|
+
const bcUrl = buildBcUrl(bcName, true, state);
|
|
3483
|
+
const rowMeta = bcUrl && ((_b = state.view.rowMeta[bcName]) == null ? void 0 : _b[bcUrl]);
|
|
3484
|
+
const actions = rowMeta && flattenOperations(rowMeta.actions);
|
|
3485
|
+
const preInvoke = (_c = actions == null ? void 0 : actions.find((item) => item.type === operationType)) == null ? void 0 : _c.preInvoke;
|
|
3486
|
+
return preInvoke && !confirm ? next(processPreInvoke({
|
|
3487
|
+
bcName,
|
|
3488
|
+
operationType,
|
|
3489
|
+
widgetName,
|
|
3490
|
+
preInvoke
|
|
3491
|
+
})) : next(action);
|
|
3492
|
+
}
|
|
3493
|
+
return next(action);
|
|
3494
|
+
};
|
|
3495
|
+
// src/middlewares/popupMiddleware.ts
|
|
3496
|
+
var popupMiddleware = ({ getState }) => (next) => (action) => {
|
|
3497
|
+
var _a, _b, _c;
|
|
3498
|
+
if (showViewPopup.match(action)) {
|
|
3499
|
+
const state = getState();
|
|
3500
|
+
const bcName = action.payload.bcName;
|
|
3501
|
+
const widgetValueKey = (_b = (_a = state.view.widgets.find((item) => item.bcName === bcName)) == null ? void 0 : _a.options) == null ? void 0 : _b.displayedValueKey;
|
|
3502
|
+
const assocValueKey = (_c = action.payload.assocValueKey) != null ? _c : widgetValueKey;
|
|
3503
|
+
return widgetValueKey ? next(showViewPopup(__spreadProps(__spreadValues({}, action.payload), { assocValueKey }))) : next(action);
|
|
3504
|
+
}
|
|
3505
|
+
return next(action);
|
|
3506
|
+
};
|
|
3507
|
+
// src/middlewares/index.ts
|
|
3508
|
+
var middlewares = {
|
|
3509
|
+
autosave: saveFormMiddleware,
|
|
3510
|
+
requiredFields,
|
|
3511
|
+
preInvoke: preInvokeAction,
|
|
3512
|
+
popup: popupMiddleware
|
|
3513
|
+
};
|
|
3514
|
+
export { Api, actions_exports as actions, epics_exports as epics, interfaces_exports as interfaces, middlewares, reducers_exports as reducers, utils_exports as utils };
|
|
3085
3515
|
//# sourceMappingURL=cxbox-ui-core.modern.development.js.map
|