@smartbit4all/ng-client 1.0.20 → 1.0.22
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/esm2020/lib/view-context/smart-view-context.interceptor.mjs +14 -3
- package/esm2020/lib/view-context/smart-view-context.service.mjs +50 -38
- package/fesm2015/smartbit4all-ng-client.mjs +58 -35
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +56 -33
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/view-context/smart-view-context.interceptor.d.ts +5 -4
- package/lib/view-context/smart-view-context.service.d.ts +7 -7
- package/package.json +1 -1
- package/smartbit4all-ng-client-1.0.22.tgz +0 -0
- package/smartbit4all-ng-client-1.0.20.tgz +0 -0
|
@@ -1909,8 +1909,8 @@ class SmartViewContextService {
|
|
|
1909
1909
|
this.session = session;
|
|
1910
1910
|
this.navigation = navigation;
|
|
1911
1911
|
this.dialog = dialog;
|
|
1912
|
-
this.tabIdName =
|
|
1913
|
-
this.tabIdhttpHeaderName =
|
|
1912
|
+
this.tabIdName = "viewContextUuid";
|
|
1913
|
+
this.tabIdhttpHeaderName = "viewContextUuid";
|
|
1914
1914
|
this.viewHandlers = new Array();
|
|
1915
1915
|
this.openedViewUuids = new Array();
|
|
1916
1916
|
this.uuidOfPageHasBeenChanged = new Subject();
|
|
@@ -1943,7 +1943,7 @@ class SmartViewContextService {
|
|
|
1943
1943
|
}
|
|
1944
1944
|
getActionDescriptors() {
|
|
1945
1945
|
if (!this.actionDescriptors) {
|
|
1946
|
-
console.error(
|
|
1946
|
+
console.error("No action descriptors has been set to ViewContext.");
|
|
1947
1947
|
}
|
|
1948
1948
|
return this.actionDescriptors;
|
|
1949
1949
|
}
|
|
@@ -1964,7 +1964,7 @@ class SmartViewContextService {
|
|
|
1964
1964
|
this.view.configuration.basePath = this.url;
|
|
1965
1965
|
}
|
|
1966
1966
|
setUrl(url) {
|
|
1967
|
-
this.url = url +
|
|
1967
|
+
this.url = url + "/view";
|
|
1968
1968
|
this.setUpUrlForViewService();
|
|
1969
1969
|
}
|
|
1970
1970
|
getAndSyncViewContext(uuid) {
|
|
@@ -1981,7 +1981,7 @@ class SmartViewContextService {
|
|
|
1981
1981
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1982
1982
|
this.viewContext = yield this.view.getViewContext(uuid).toPromise();
|
|
1983
1983
|
if (!this.viewContext) {
|
|
1984
|
-
throw new Error(
|
|
1984
|
+
throw new Error("ViewContext does not exist with the given uuid.");
|
|
1985
1985
|
}
|
|
1986
1986
|
return this.viewContext;
|
|
1987
1987
|
});
|
|
@@ -1992,7 +1992,7 @@ class SmartViewContextService {
|
|
|
1992
1992
|
if (!this.viewContext) {
|
|
1993
1993
|
let viewContextUuid = sessionStorage.getItem(this.tabIdName);
|
|
1994
1994
|
if (!viewContextUuid) {
|
|
1995
|
-
throw new Error(
|
|
1995
|
+
throw new Error("View context is not initialized!");
|
|
1996
1996
|
}
|
|
1997
1997
|
yield this.getViewContext(viewContextUuid);
|
|
1998
1998
|
}
|
|
@@ -2006,7 +2006,9 @@ class SmartViewContextService {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
updateViewContext(viewContextUpdate) {
|
|
2008
2008
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2009
|
-
this.viewContext = yield this.view
|
|
2009
|
+
this.viewContext = yield this.view
|
|
2010
|
+
.updateViewContext(viewContextUpdate)
|
|
2011
|
+
.toPromise();
|
|
2010
2012
|
return this.viewContext;
|
|
2011
2013
|
});
|
|
2012
2014
|
}
|
|
@@ -2015,7 +2017,10 @@ class SmartViewContextService {
|
|
|
2015
2017
|
}
|
|
2016
2018
|
setTabId(tabId) {
|
|
2017
2019
|
sessionStorage.setItem(this.tabIdName, tabId);
|
|
2018
|
-
this.session.addHeaderParam({
|
|
2020
|
+
this.session.addHeaderParam({
|
|
2021
|
+
headerName: this.tabIdhttpHeaderName,
|
|
2022
|
+
value: tabId,
|
|
2023
|
+
});
|
|
2019
2024
|
}
|
|
2020
2025
|
startViewContext() {
|
|
2021
2026
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -2024,7 +2029,7 @@ class SmartViewContextService {
|
|
|
2024
2029
|
.createViewContext()
|
|
2025
2030
|
.toPromise();
|
|
2026
2031
|
if (!newViewContext) {
|
|
2027
|
-
throw new Error(
|
|
2032
|
+
throw new Error("No ViewContext was created");
|
|
2028
2033
|
}
|
|
2029
2034
|
this.viewContext = newViewContext;
|
|
2030
2035
|
this.setTabId(newViewContext.uuid);
|
|
@@ -2037,7 +2042,7 @@ class SmartViewContextService {
|
|
|
2037
2042
|
throw new Error("There aren't any viewHandlers in SmartViewContextService! Provide some to use its functions.");
|
|
2038
2043
|
}
|
|
2039
2044
|
if (!this.messageDialogname) {
|
|
2040
|
-
throw new Error(
|
|
2045
|
+
throw new Error("The messageDialogName provided by the backend has not been set.");
|
|
2041
2046
|
}
|
|
2042
2047
|
if (uuid) {
|
|
2043
2048
|
let subscription = this.session.headersUpdated.subscribe(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -2059,7 +2064,7 @@ class SmartViewContextService {
|
|
|
2059
2064
|
});
|
|
2060
2065
|
}
|
|
2061
2066
|
openView(view) {
|
|
2062
|
-
var _a
|
|
2067
|
+
var _a;
|
|
2063
2068
|
let viewHandler = this.viewHandlers.find((handler) => handler.name === view.viewName);
|
|
2064
2069
|
if (!viewHandler) {
|
|
2065
2070
|
throw new Error(`SmartViewHandlerModel was not found by view name: ${view.viewName}`);
|
|
@@ -2069,11 +2074,11 @@ class SmartViewContextService {
|
|
|
2069
2074
|
throw new Error(`Component is undefined in SmartViewHandlerModel with name: ${view.viewName}`);
|
|
2070
2075
|
}
|
|
2071
2076
|
let dialogRef = this.dialog.openComponentAsDialog(viewHandler.component, viewHandler.name);
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
}
|
|
2077
|
+
dialogRef.disableClose = true;
|
|
2078
|
+
// if (view.viewName === this.messageDialogname) {
|
|
2079
|
+
// if (view.message?.options && view.message.options.length) {
|
|
2080
|
+
// }
|
|
2081
|
+
// }
|
|
2077
2082
|
this.dialogRefs.push({
|
|
2078
2083
|
uuid: view.uuid,
|
|
2079
2084
|
dialogRef,
|
|
@@ -2083,10 +2088,10 @@ class SmartViewContextService {
|
|
|
2083
2088
|
if (viewHandler.route === undefined) {
|
|
2084
2089
|
throw new Error(`Route is undefined in SmartViewHandlerModel with name: ${view.viewName}`);
|
|
2085
2090
|
}
|
|
2086
|
-
this.navigation.navigateTo(viewHandler.route.split(
|
|
2091
|
+
this.navigation.navigateTo(viewHandler.route.split("/"));
|
|
2087
2092
|
}
|
|
2088
2093
|
else {
|
|
2089
|
-
throw new Error(
|
|
2094
|
+
throw new Error("The type of the view and its viewHandler is not the same!");
|
|
2090
2095
|
}
|
|
2091
2096
|
view.state = ViewState.Opened;
|
|
2092
2097
|
this.openedViewUuids.push(view.uuid);
|
|
@@ -2099,7 +2104,7 @@ class SmartViewContextService {
|
|
|
2099
2104
|
uuid: view.uuid,
|
|
2100
2105
|
},
|
|
2101
2106
|
],
|
|
2102
|
-
uuid: (
|
|
2107
|
+
uuid: (_a = this.viewContext) === null || _a === void 0 ? void 0 : _a.uuid,
|
|
2103
2108
|
});
|
|
2104
2109
|
}
|
|
2105
2110
|
closeView(view) {
|
|
@@ -2116,7 +2121,7 @@ class SmartViewContextService {
|
|
|
2116
2121
|
this.dialogRefs.splice(index, 1);
|
|
2117
2122
|
}
|
|
2118
2123
|
else {
|
|
2119
|
-
throw new Error(
|
|
2124
|
+
throw new Error("DialogRef is not found by uuid.");
|
|
2120
2125
|
}
|
|
2121
2126
|
}
|
|
2122
2127
|
else if (view.type === ViewType.Normal) {
|
|
@@ -2124,7 +2129,7 @@ class SmartViewContextService {
|
|
|
2124
2129
|
// this.navigation.navigateTo(viewHandler.route.split("/"));
|
|
2125
2130
|
}
|
|
2126
2131
|
else {
|
|
2127
|
-
throw new Error(
|
|
2132
|
+
throw new Error("The type of the view and its viewHandler is not the same!");
|
|
2128
2133
|
}
|
|
2129
2134
|
view.state = ViewState.Closed;
|
|
2130
2135
|
this.openedViewUuids.slice(this.openedViewUuids.indexOf(view.uuid), 1);
|
|
@@ -2174,7 +2179,7 @@ class SmartViewContextService {
|
|
|
2174
2179
|
var _a;
|
|
2175
2180
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2176
2181
|
yield this.view
|
|
2177
|
-
.message((_a = messageData.viewUuid) !== null && _a !== void 0 ? _a :
|
|
2182
|
+
.message((_a = messageData.viewUuid) !== null && _a !== void 0 ? _a : "", messageData.uuid, messageResult)
|
|
2178
2183
|
.toPromise();
|
|
2179
2184
|
yield this.getAndSyncViewContext();
|
|
2180
2185
|
});
|
|
@@ -2183,30 +2188,33 @@ class SmartViewContextService {
|
|
|
2183
2188
|
if (!this.smartViewContextApiErrors) {
|
|
2184
2189
|
return {
|
|
2185
2190
|
code,
|
|
2186
|
-
message:
|
|
2187
|
-
buttonLabel:
|
|
2188
|
-
dialogTitle:
|
|
2191
|
+
message: "An error has occured.",
|
|
2192
|
+
buttonLabel: "Ok",
|
|
2193
|
+
dialogTitle: "Hiba",
|
|
2189
2194
|
};
|
|
2190
2195
|
}
|
|
2191
2196
|
let apiErrorsWithCode = this.smartViewContextApiErrors.viewContextApiErrors.filter((apiError) => {
|
|
2192
2197
|
return apiError.code === code;
|
|
2193
2198
|
});
|
|
2194
|
-
if (!apiErrorsWithCode ||
|
|
2199
|
+
if (!apiErrorsWithCode ||
|
|
2200
|
+
(apiErrorsWithCode && !apiErrorsWithCode.length)) {
|
|
2195
2201
|
console.error(`SmartViewContextApiError with code ${code} could not be found.`);
|
|
2196
2202
|
return {
|
|
2197
2203
|
code,
|
|
2198
|
-
message:
|
|
2199
|
-
buttonLabel:
|
|
2200
|
-
dialogTitle:
|
|
2204
|
+
message: "An error has occured.",
|
|
2205
|
+
buttonLabel: "Ok",
|
|
2206
|
+
dialogTitle: "Hiba",
|
|
2201
2207
|
};
|
|
2202
2208
|
}
|
|
2203
2209
|
return apiErrorsWithCode[0];
|
|
2204
2210
|
}
|
|
2205
2211
|
getViewConstraint(uuid) {
|
|
2206
2212
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2207
|
-
let viewConstraintResponse = yield this.view
|
|
2213
|
+
let viewConstraintResponse = yield this.view
|
|
2214
|
+
.getViewConstraint(uuid)
|
|
2215
|
+
.toPromise();
|
|
2208
2216
|
if (!viewConstraintResponse)
|
|
2209
|
-
throw new Error(
|
|
2217
|
+
throw new Error("Could not get ViewConstraint with the given uuid.");
|
|
2210
2218
|
return viewConstraintResponse;
|
|
2211
2219
|
});
|
|
2212
2220
|
}
|
|
@@ -2235,12 +2243,16 @@ class SmartViewContextService {
|
|
|
2235
2243
|
}
|
|
2236
2244
|
performWidgetAction(uuid, widgetId, nodeId, uiActionRequest) {
|
|
2237
2245
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2238
|
-
return yield this.handlePerformActionResponse(yield this.view
|
|
2246
|
+
return yield this.handlePerformActionResponse(yield this.view
|
|
2247
|
+
.performWidgetAction(uuid, widgetId, nodeId, uiActionRequest)
|
|
2248
|
+
.toPromise());
|
|
2239
2249
|
});
|
|
2240
2250
|
}
|
|
2241
2251
|
performWidgetMainAction(uuid, widgetId, uiActionRequest) {
|
|
2242
2252
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2243
|
-
return yield this.handlePerformActionResponse(yield this.view
|
|
2253
|
+
return yield this.handlePerformActionResponse(yield this.view
|
|
2254
|
+
.performWidgetMainAction(uuid, widgetId, uiActionRequest)
|
|
2255
|
+
.toPromise());
|
|
2244
2256
|
});
|
|
2245
2257
|
}
|
|
2246
2258
|
handlePerformActionResponse(viewContextChange) {
|
|
@@ -2267,11 +2279,11 @@ class SmartViewContextService {
|
|
|
2267
2279
|
}
|
|
2268
2280
|
}
|
|
2269
2281
|
SmartViewContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, deps: [{ token: ViewService }, { token: SmartSessionService }, { token: i3$1.SmartNavigationService }, { token: i4.SmartdialogService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2270
|
-
SmartViewContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, providedIn:
|
|
2282
|
+
SmartViewContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, providedIn: "root" });
|
|
2271
2283
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, decorators: [{
|
|
2272
2284
|
type: Injectable,
|
|
2273
2285
|
args: [{
|
|
2274
|
-
providedIn:
|
|
2286
|
+
providedIn: "root",
|
|
2275
2287
|
}]
|
|
2276
2288
|
}], ctorParameters: function () { return [{ type: ViewService }, { type: SmartSessionService }, { type: i3$1.SmartNavigationService }, { type: i4.SmartdialogService }]; } });
|
|
2277
2289
|
|
|
@@ -2948,6 +2960,16 @@ class SmartViewContextInterceptor {
|
|
|
2948
2960
|
this.viewContextErrorDialog = viewContextErrorDialog;
|
|
2949
2961
|
}
|
|
2950
2962
|
intercept(request, next) {
|
|
2963
|
+
// parameter: async: True -> don't throw/open error (dialog)
|
|
2964
|
+
if (request.body) {
|
|
2965
|
+
try {
|
|
2966
|
+
let body = request.body;
|
|
2967
|
+
if (body.params[IS_ASYNC_PARAM_NAME]) {
|
|
2968
|
+
return next.handle(request);
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
catch (error) { }
|
|
2972
|
+
}
|
|
2951
2973
|
return next.handle(request).pipe(catchError((error) => {
|
|
2952
2974
|
if (error.status === 409 &&
|
|
2953
2975
|
(error.error.code || error.error.message)) {
|
|
@@ -2966,6 +2988,7 @@ SmartViewContextInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "1
|
|
|
2966
2988
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextInterceptor, decorators: [{
|
|
2967
2989
|
type: Injectable
|
|
2968
2990
|
}], ctorParameters: function () { return [{ type: SmartViewContextErrorDialogService }]; } });
|
|
2991
|
+
const IS_ASYNC_PARAM_NAME = 'isAsync';
|
|
2969
2992
|
|
|
2970
2993
|
class SmartViewRedirect {
|
|
2971
2994
|
constructor(service, navigation, route) {
|