@smartbit4all/ng-client 1.0.11 → 1.0.13
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/smart-client/smart-component-api-client.mjs +36 -14
- package/esm2020/lib/smart-client/smart.component.mjs +12 -13
- package/esm2020/lib/smart-client/smart.service.mjs +12 -13
- package/esm2020/lib/view-context/api/api/view.service.mjs +118 -1
- package/esm2020/lib/view-context/smart-ui-action/ui-action-toolbar.component.mjs +13 -13
- package/esm2020/lib/view-context/smart-ui-action/ui-action.descriptor.service.mjs +3 -2
- package/esm2020/lib/view-context/smart-ui-action/ui-action.model.mjs +1 -1
- package/esm2020/lib/view-context/smart-ui-action/ui-action.service.mjs +26 -19
- package/esm2020/lib/view-context/smart-view-context.service.mjs +37 -33
- package/fesm2015/smartbit4all-ng-client.mjs +238 -78
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +227 -77
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-client/smart-component-api-client.d.ts +14 -6
- package/lib/smart-client/smart.component.d.ts +4 -5
- package/lib/smart-client/smart.service.d.ts +4 -5
- package/lib/view-context/api/api/view.service.d.ts +41 -0
- package/lib/view-context/smart-ui-action/ui-action-toolbar.component.d.ts +5 -5
- package/lib/view-context/smart-ui-action/ui-action.model.d.ts +4 -2
- package/lib/view-context/smart-ui-action/ui-action.service.d.ts +16 -6
- package/lib/view-context/smart-view-context.service.d.ts +10 -7
- package/package.json +1 -1
- package/smartbit4all-ng-client-1.0.13.tgz +0 -0
- package/smartbit4all-ng-client-1.0.11.tgz +0 -0
|
@@ -1450,6 +1450,123 @@ class ViewService {
|
|
|
1450
1450
|
reportProgress: reportProgress
|
|
1451
1451
|
});
|
|
1452
1452
|
}
|
|
1453
|
+
performWidgetAction(uuid, widgetId, nodeId, body, observe = 'body', reportProgress = false, options) {
|
|
1454
|
+
if (uuid === null || uuid === undefined) {
|
|
1455
|
+
throw new Error('Required parameter uuid was null or undefined when calling performWidgetAction.');
|
|
1456
|
+
}
|
|
1457
|
+
if (widgetId === null || widgetId === undefined) {
|
|
1458
|
+
throw new Error('Required parameter widgetId was null or undefined when calling performWidgetAction.');
|
|
1459
|
+
}
|
|
1460
|
+
if (nodeId === null || nodeId === undefined) {
|
|
1461
|
+
throw new Error('Required parameter nodeId was null or undefined when calling performWidgetAction.');
|
|
1462
|
+
}
|
|
1463
|
+
if (body === null || body === undefined) {
|
|
1464
|
+
throw new Error('Required parameter body was null or undefined when calling performWidgetAction.');
|
|
1465
|
+
}
|
|
1466
|
+
let localVarHeaders = this.defaultHeaders;
|
|
1467
|
+
let localVarHttpHeaderAcceptSelected = options && options.httpHeaderAccept;
|
|
1468
|
+
if (localVarHttpHeaderAcceptSelected === undefined) {
|
|
1469
|
+
// to determine the Accept header
|
|
1470
|
+
const httpHeaderAccepts = [
|
|
1471
|
+
'application/json'
|
|
1472
|
+
];
|
|
1473
|
+
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
1474
|
+
}
|
|
1475
|
+
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
1476
|
+
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
1477
|
+
}
|
|
1478
|
+
let localVarHttpContext = options && options.context;
|
|
1479
|
+
if (localVarHttpContext === undefined) {
|
|
1480
|
+
localVarHttpContext = new HttpContext();
|
|
1481
|
+
}
|
|
1482
|
+
// to determine the Content-Type header
|
|
1483
|
+
const consumes = [
|
|
1484
|
+
'application/json'
|
|
1485
|
+
];
|
|
1486
|
+
const httpContentTypeSelected = this.configuration.selectHeaderContentType(consumes);
|
|
1487
|
+
if (httpContentTypeSelected !== undefined) {
|
|
1488
|
+
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
|
1489
|
+
}
|
|
1490
|
+
let responseType_ = 'json';
|
|
1491
|
+
if (localVarHttpHeaderAcceptSelected) {
|
|
1492
|
+
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
1493
|
+
responseType_ = 'text';
|
|
1494
|
+
}
|
|
1495
|
+
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
1496
|
+
responseType_ = 'json';
|
|
1497
|
+
}
|
|
1498
|
+
else {
|
|
1499
|
+
responseType_ = 'blob';
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
let localVarPath = `/component/${this.configuration.encodeParam({ name: "uuid", value: uuid, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid" })}/${this.configuration.encodeParam({ name: "widgetId", value: widgetId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}/${this.configuration.encodeParam({ name: "nodeId", value: nodeId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}/action`;
|
|
1503
|
+
return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, {
|
|
1504
|
+
context: localVarHttpContext,
|
|
1505
|
+
body: body,
|
|
1506
|
+
responseType: responseType_,
|
|
1507
|
+
withCredentials: this.configuration.withCredentials,
|
|
1508
|
+
headers: localVarHeaders,
|
|
1509
|
+
observe: observe,
|
|
1510
|
+
reportProgress: reportProgress
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
performWidgetMainAction(uuid, widgetId, body, observe = 'body', reportProgress = false, options) {
|
|
1514
|
+
if (uuid === null || uuid === undefined) {
|
|
1515
|
+
throw new Error('Required parameter uuid was null or undefined when calling performWidgetMainAction.');
|
|
1516
|
+
}
|
|
1517
|
+
if (widgetId === null || widgetId === undefined) {
|
|
1518
|
+
throw new Error('Required parameter widgetId was null or undefined when calling performWidgetMainAction.');
|
|
1519
|
+
}
|
|
1520
|
+
if (body === null || body === undefined) {
|
|
1521
|
+
throw new Error('Required parameter body was null or undefined when calling performWidgetMainAction.');
|
|
1522
|
+
}
|
|
1523
|
+
let localVarHeaders = this.defaultHeaders;
|
|
1524
|
+
let localVarHttpHeaderAcceptSelected = options && options.httpHeaderAccept;
|
|
1525
|
+
if (localVarHttpHeaderAcceptSelected === undefined) {
|
|
1526
|
+
// to determine the Accept header
|
|
1527
|
+
const httpHeaderAccepts = [
|
|
1528
|
+
'application/json'
|
|
1529
|
+
];
|
|
1530
|
+
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
1531
|
+
}
|
|
1532
|
+
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
1533
|
+
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
1534
|
+
}
|
|
1535
|
+
let localVarHttpContext = options && options.context;
|
|
1536
|
+
if (localVarHttpContext === undefined) {
|
|
1537
|
+
localVarHttpContext = new HttpContext();
|
|
1538
|
+
}
|
|
1539
|
+
// to determine the Content-Type header
|
|
1540
|
+
const consumes = [
|
|
1541
|
+
'application/json'
|
|
1542
|
+
];
|
|
1543
|
+
const httpContentTypeSelected = this.configuration.selectHeaderContentType(consumes);
|
|
1544
|
+
if (httpContentTypeSelected !== undefined) {
|
|
1545
|
+
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
|
1546
|
+
}
|
|
1547
|
+
let responseType_ = 'json';
|
|
1548
|
+
if (localVarHttpHeaderAcceptSelected) {
|
|
1549
|
+
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
1550
|
+
responseType_ = 'text';
|
|
1551
|
+
}
|
|
1552
|
+
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
1553
|
+
responseType_ = 'json';
|
|
1554
|
+
}
|
|
1555
|
+
else {
|
|
1556
|
+
responseType_ = 'blob';
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
let localVarPath = `/component/${this.configuration.encodeParam({ name: "uuid", value: uuid, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid" })}/${this.configuration.encodeParam({ name: "widgetId", value: widgetId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}/action`;
|
|
1560
|
+
return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, {
|
|
1561
|
+
context: localVarHttpContext,
|
|
1562
|
+
body: body,
|
|
1563
|
+
responseType: responseType_,
|
|
1564
|
+
withCredentials: this.configuration.withCredentials,
|
|
1565
|
+
headers: localVarHeaders,
|
|
1566
|
+
observe: observe,
|
|
1567
|
+
reportProgress: reportProgress
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1453
1570
|
showPublishedView(channel, uuid, observe = 'body', reportProgress = false, options) {
|
|
1454
1571
|
if (channel === null || channel === undefined) {
|
|
1455
1572
|
throw new Error('Required parameter channel was null or undefined when calling showPublishedView.');
|
|
@@ -1870,8 +1987,8 @@ class SmartViewContextService {
|
|
|
1870
1987
|
this.session = session;
|
|
1871
1988
|
this.navigation = navigation;
|
|
1872
1989
|
this.dialog = dialog;
|
|
1873
|
-
this.tabIdName =
|
|
1874
|
-
this.tabIdhttpHeaderName =
|
|
1990
|
+
this.tabIdName = 'viewContextUuid';
|
|
1991
|
+
this.tabIdhttpHeaderName = 'viewContextUuid';
|
|
1875
1992
|
this.viewHandlers = new Array();
|
|
1876
1993
|
this.openedViewUuids = new Array();
|
|
1877
1994
|
this.uuidOfPageHasBeenChanged = new Subject();
|
|
@@ -1904,7 +2021,7 @@ class SmartViewContextService {
|
|
|
1904
2021
|
}
|
|
1905
2022
|
getActionDescriptors() {
|
|
1906
2023
|
if (!this.actionDescriptors) {
|
|
1907
|
-
console.error(
|
|
2024
|
+
console.error('No action descriptors has been set to ViewContext.');
|
|
1908
2025
|
}
|
|
1909
2026
|
return this.actionDescriptors;
|
|
1910
2027
|
}
|
|
@@ -1925,7 +2042,7 @@ class SmartViewContextService {
|
|
|
1925
2042
|
this.view.configuration.basePath = this.url;
|
|
1926
2043
|
}
|
|
1927
2044
|
setUrl(url) {
|
|
1928
|
-
this.url = url +
|
|
2045
|
+
this.url = url + '/view';
|
|
1929
2046
|
this.setUpUrlForViewService();
|
|
1930
2047
|
}
|
|
1931
2048
|
async getAndSyncViewContext(uuid) {
|
|
@@ -1939,7 +2056,7 @@ class SmartViewContextService {
|
|
|
1939
2056
|
async getViewContext(uuid) {
|
|
1940
2057
|
this.viewContext = await this.view.getViewContext(uuid).toPromise();
|
|
1941
2058
|
if (!this.viewContext) {
|
|
1942
|
-
throw new Error(
|
|
2059
|
+
throw new Error('ViewContext does not exist with the given uuid.');
|
|
1943
2060
|
}
|
|
1944
2061
|
return this.viewContext;
|
|
1945
2062
|
}
|
|
@@ -1947,7 +2064,7 @@ class SmartViewContextService {
|
|
|
1947
2064
|
if (!this.viewContext) {
|
|
1948
2065
|
let viewContextUuid = sessionStorage.getItem(this.tabIdName);
|
|
1949
2066
|
if (!viewContextUuid) {
|
|
1950
|
-
throw new Error(
|
|
2067
|
+
throw new Error('View context is not initialized!');
|
|
1951
2068
|
}
|
|
1952
2069
|
await this.getViewContext(viewContextUuid);
|
|
1953
2070
|
}
|
|
@@ -1971,11 +2088,9 @@ class SmartViewContextService {
|
|
|
1971
2088
|
}
|
|
1972
2089
|
async startViewContext() {
|
|
1973
2090
|
this.clearSessionStorage();
|
|
1974
|
-
let newViewContext = await this.view
|
|
1975
|
-
.createViewContext()
|
|
1976
|
-
.toPromise();
|
|
2091
|
+
let newViewContext = await this.view.createViewContext().toPromise();
|
|
1977
2092
|
if (!newViewContext) {
|
|
1978
|
-
throw new Error(
|
|
2093
|
+
throw new Error('No ViewContext was created');
|
|
1979
2094
|
}
|
|
1980
2095
|
this.viewContext = newViewContext;
|
|
1981
2096
|
this.setTabId(newViewContext.uuid);
|
|
@@ -1986,7 +2101,7 @@ class SmartViewContextService {
|
|
|
1986
2101
|
throw new Error("There aren't any viewHandlers in SmartViewContextService! Provide some to use its functions.");
|
|
1987
2102
|
}
|
|
1988
2103
|
if (!this.messageDialogname) {
|
|
1989
|
-
throw new Error(
|
|
2104
|
+
throw new Error('The messageDialogName provided by the backend has not been set.');
|
|
1990
2105
|
}
|
|
1991
2106
|
if (uuid) {
|
|
1992
2107
|
let subscription = this.session.headersUpdated.subscribe(async () => {
|
|
@@ -2030,10 +2145,10 @@ class SmartViewContextService {
|
|
|
2030
2145
|
if (viewHandler.route === undefined) {
|
|
2031
2146
|
throw new Error(`Route is undefined in SmartViewHandlerModel with name: ${view.viewName}`);
|
|
2032
2147
|
}
|
|
2033
|
-
this.navigation.navigateTo(viewHandler.route.split(
|
|
2148
|
+
this.navigation.navigateTo(viewHandler.route.split('/'));
|
|
2034
2149
|
}
|
|
2035
2150
|
else {
|
|
2036
|
-
throw new Error(
|
|
2151
|
+
throw new Error('The type of the view and its viewHandler is not the same!');
|
|
2037
2152
|
}
|
|
2038
2153
|
view.state = ViewState.Opened;
|
|
2039
2154
|
this.openedViewUuids.push(view.uuid);
|
|
@@ -2062,7 +2177,7 @@ class SmartViewContextService {
|
|
|
2062
2177
|
this.dialogRefs.splice(index, 1);
|
|
2063
2178
|
}
|
|
2064
2179
|
else {
|
|
2065
|
-
throw new Error(
|
|
2180
|
+
throw new Error('DialogRef is not found by uuid.');
|
|
2066
2181
|
}
|
|
2067
2182
|
}
|
|
2068
2183
|
else if (view.type === ViewType.Normal) {
|
|
@@ -2070,7 +2185,7 @@ class SmartViewContextService {
|
|
|
2070
2185
|
// this.navigation.navigateTo(viewHandler.route.split("/"));
|
|
2071
2186
|
}
|
|
2072
2187
|
else {
|
|
2073
|
-
throw new Error(
|
|
2188
|
+
throw new Error('The type of the view and its viewHandler is not the same!');
|
|
2074
2189
|
}
|
|
2075
2190
|
view.state = ViewState.Closed;
|
|
2076
2191
|
this.openedViewUuids.slice(this.openedViewUuids.indexOf(view.uuid), 1);
|
|
@@ -2114,18 +2229,16 @@ class SmartViewContextService {
|
|
|
2114
2229
|
return uuid;
|
|
2115
2230
|
}
|
|
2116
2231
|
async message(messageData, messageResult) {
|
|
2117
|
-
await this.view
|
|
2118
|
-
.message(messageData.viewUuid ?? "", messageData.uuid, messageResult)
|
|
2119
|
-
.toPromise();
|
|
2232
|
+
await this.view.message(messageData.viewUuid ?? '', messageData.uuid, messageResult).toPromise();
|
|
2120
2233
|
await this.getAndSyncViewContext();
|
|
2121
2234
|
}
|
|
2122
2235
|
getSmartViewContextApiErrorByCode(code) {
|
|
2123
2236
|
if (!this.smartViewContextApiErrors) {
|
|
2124
2237
|
return {
|
|
2125
2238
|
code,
|
|
2126
|
-
message:
|
|
2127
|
-
buttonLabel:
|
|
2128
|
-
dialogTitle:
|
|
2239
|
+
message: 'An error has occured.',
|
|
2240
|
+
buttonLabel: 'Ok',
|
|
2241
|
+
dialogTitle: 'Hiba',
|
|
2129
2242
|
};
|
|
2130
2243
|
}
|
|
2131
2244
|
let apiErrorsWithCode = this.smartViewContextApiErrors.viewContextApiErrors.filter((apiError) => {
|
|
@@ -2135,9 +2248,9 @@ class SmartViewContextService {
|
|
|
2135
2248
|
console.error(`SmartViewContextApiError with code ${code} could not be found.`);
|
|
2136
2249
|
return {
|
|
2137
2250
|
code,
|
|
2138
|
-
message:
|
|
2139
|
-
buttonLabel:
|
|
2140
|
-
dialogTitle:
|
|
2251
|
+
message: 'An error has occured.',
|
|
2252
|
+
buttonLabel: 'Ok',
|
|
2253
|
+
dialogTitle: 'Hiba',
|
|
2141
2254
|
};
|
|
2142
2255
|
}
|
|
2143
2256
|
return apiErrorsWithCode[0];
|
|
@@ -2145,7 +2258,7 @@ class SmartViewContextService {
|
|
|
2145
2258
|
async getViewConstraint(uuid) {
|
|
2146
2259
|
let viewConstraintResponse = await this.view.getViewConstraint(uuid).toPromise();
|
|
2147
2260
|
if (!viewConstraintResponse)
|
|
2148
|
-
throw new Error(
|
|
2261
|
+
throw new Error('Could not get ViewConstraint with the given uuid.');
|
|
2149
2262
|
return viewConstraintResponse;
|
|
2150
2263
|
}
|
|
2151
2264
|
async showPublishedView(channel, uuid) {
|
|
@@ -2163,7 +2276,15 @@ class SmartViewContextService {
|
|
|
2163
2276
|
return await this.view.downloadItem(uuid, item).toPromise();
|
|
2164
2277
|
}
|
|
2165
2278
|
async performAction(uuid, uiActionRequest) {
|
|
2166
|
-
|
|
2279
|
+
return await this.handlePerformActionResponse(await this.view.performAction(uuid, uiActionRequest).toPromise());
|
|
2280
|
+
}
|
|
2281
|
+
async performWidgetAction(uuid, widgetId, nodeId, uiActionRequest) {
|
|
2282
|
+
return await this.handlePerformActionResponse(await this.view.performWidgetAction(uuid, widgetId, nodeId, uiActionRequest).toPromise());
|
|
2283
|
+
}
|
|
2284
|
+
async performWidgetMainAction(uuid, widgetId, uiActionRequest) {
|
|
2285
|
+
return await this.handlePerformActionResponse(await this.view.performWidgetMainAction(uuid, widgetId, uiActionRequest).toPromise());
|
|
2286
|
+
}
|
|
2287
|
+
async handlePerformActionResponse(viewContextChange) {
|
|
2167
2288
|
this.viewContext = viewContextChange?.viewContext;
|
|
2168
2289
|
this.syncView();
|
|
2169
2290
|
if (viewContextChange?.changes) {
|
|
@@ -2183,11 +2304,11 @@ class SmartViewContextService {
|
|
|
2183
2304
|
}
|
|
2184
2305
|
}
|
|
2185
2306
|
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 });
|
|
2186
|
-
SmartViewContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, providedIn:
|
|
2307
|
+
SmartViewContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, providedIn: 'root' });
|
|
2187
2308
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, decorators: [{
|
|
2188
2309
|
type: Injectable,
|
|
2189
2310
|
args: [{
|
|
2190
|
-
providedIn:
|
|
2311
|
+
providedIn: 'root',
|
|
2191
2312
|
}]
|
|
2192
2313
|
}], ctorParameters: function () { return [{ type: ViewService }, { type: SmartSessionService }, { type: i3$1.SmartNavigationService }, { type: i4.SmartdialogService }]; } });
|
|
2193
2314
|
|
|
@@ -2980,7 +3101,8 @@ class UiActionDescriptorService {
|
|
|
2980
3101
|
uiActionDescriptor = await this.deepTranslate(uiActionDescriptor);
|
|
2981
3102
|
return uiActionDescriptor;
|
|
2982
3103
|
}
|
|
2983
|
-
async deepTranslate(
|
|
3104
|
+
async deepTranslate(_model) {
|
|
3105
|
+
let model = { ..._model };
|
|
2984
3106
|
await Promise.all(Object.keys(model).map(async (key) => {
|
|
2985
3107
|
if (model[key] !== undefined &&
|
|
2986
3108
|
typeof model[key] === 'string' &&
|
|
@@ -3279,7 +3401,7 @@ class UiActionService {
|
|
|
3279
3401
|
this.textFieldDialogService = textFieldDialogService;
|
|
3280
3402
|
this._snackBar = _snackBar;
|
|
3281
3403
|
}
|
|
3282
|
-
async execute(uiAction) {
|
|
3404
|
+
async execute(uiAction, options) {
|
|
3283
3405
|
let uiActionRequest;
|
|
3284
3406
|
uiActionRequest = {
|
|
3285
3407
|
code: uiAction.code,
|
|
@@ -3310,7 +3432,7 @@ class UiActionService {
|
|
|
3310
3432
|
}
|
|
3311
3433
|
// InputType
|
|
3312
3434
|
if (uiAction.inputType) {
|
|
3313
|
-
uiActionRequest = await this.handleInputType(uiAction.inputType, uiAction, uiActionRequest,
|
|
3435
|
+
uiActionRequest = await this.handleInputType(uiAction.inputType, uiAction, uiActionRequest, 'inputDialog');
|
|
3314
3436
|
if (!uiActionRequest) {
|
|
3315
3437
|
return;
|
|
3316
3438
|
}
|
|
@@ -3318,7 +3440,7 @@ class UiActionService {
|
|
|
3318
3440
|
}
|
|
3319
3441
|
// Input2Type
|
|
3320
3442
|
if (uiAction.input2Type) {
|
|
3321
|
-
uiActionRequest = await this.handleInputType(uiAction.input2Type, uiAction, uiActionRequest,
|
|
3443
|
+
uiActionRequest = await this.handleInputType(uiAction.input2Type, uiAction, uiActionRequest, 'input2Dialog');
|
|
3322
3444
|
if (!uiActionRequest) {
|
|
3323
3445
|
return;
|
|
3324
3446
|
}
|
|
@@ -3330,7 +3452,7 @@ class UiActionService {
|
|
|
3330
3452
|
}
|
|
3331
3453
|
uiActionRequest = response.uiActionRequest;
|
|
3332
3454
|
}
|
|
3333
|
-
this.performAction(uiAction, uiActionRequest);
|
|
3455
|
+
this.performAction(uiAction, uiActionRequest, options);
|
|
3334
3456
|
}
|
|
3335
3457
|
async handleInputType(inputType, uiAction, uiActionRequest, inputTypeName) {
|
|
3336
3458
|
switch (inputType) {
|
|
@@ -3347,7 +3469,7 @@ class UiActionService {
|
|
|
3347
3469
|
}
|
|
3348
3470
|
async handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest) {
|
|
3349
3471
|
let additionalParams = this.uiActionModel.serviceToUse.getAdditionalParams(uiAction);
|
|
3350
|
-
let inputType = inputTypeName ===
|
|
3472
|
+
let inputType = inputTypeName === 'inputDialog' ? 'inputType' : 'input2Type';
|
|
3351
3473
|
if (uiAction[inputType] === UiActionInputType.Textfield) {
|
|
3352
3474
|
this.textFieldDialogService.nodeName = additionalParams.forTextField;
|
|
3353
3475
|
}
|
|
@@ -3360,7 +3482,7 @@ class UiActionService {
|
|
|
3360
3482
|
await this.textFieldDialogService.onAction.toPromise();
|
|
3361
3483
|
let params = this.textFieldDialogService.params;
|
|
3362
3484
|
if (!params) {
|
|
3363
|
-
console.error(
|
|
3485
|
+
console.error('There was no response from InputDialog');
|
|
3364
3486
|
return;
|
|
3365
3487
|
}
|
|
3366
3488
|
uiActionRequest.params = {
|
|
@@ -3377,18 +3499,25 @@ class UiActionService {
|
|
|
3377
3499
|
uiActionRequest = response.uiActionRequest;
|
|
3378
3500
|
return uiActionRequest;
|
|
3379
3501
|
}
|
|
3380
|
-
async performAction(uiAction, uiActionRequest) {
|
|
3381
|
-
if (!uiActionRequest.params ||
|
|
3382
|
-
(uiActionRequest.params && !Object.keys(uiActionRequest.params).length)) {
|
|
3502
|
+
async performAction(uiAction, uiActionRequest, options) {
|
|
3503
|
+
if (!uiActionRequest.params || (uiActionRequest.params && !Object.keys(uiActionRequest.params).length)) {
|
|
3383
3504
|
uiActionRequest.params = {
|
|
3384
3505
|
model: this.uiActionModel.serviceToUse.getModel(),
|
|
3385
3506
|
};
|
|
3386
3507
|
}
|
|
3387
3508
|
else if (uiAction.submit) {
|
|
3388
|
-
uiActionRequest.params[
|
|
3509
|
+
uiActionRequest.params['model'] = this.uiActionModel.serviceToUse.getModel();
|
|
3389
3510
|
}
|
|
3390
3511
|
try {
|
|
3391
|
-
|
|
3512
|
+
if (options && options.nodeId && options.widgetId) {
|
|
3513
|
+
await this.uiActionModel.serviceToUse.performWidgetActionRequest(uiActionRequest, options.widgetId, options.nodeId);
|
|
3514
|
+
}
|
|
3515
|
+
else if (options && options.widgetId) {
|
|
3516
|
+
await this.uiActionModel.serviceToUse.performWidgetMainActionRequest(uiActionRequest, options.widgetId);
|
|
3517
|
+
}
|
|
3518
|
+
else {
|
|
3519
|
+
await this.uiActionModel.serviceToUse.performUiActionRequest(uiActionRequest);
|
|
3520
|
+
}
|
|
3392
3521
|
if (this.uiActionModel.descriptor?.feedbackType === UiActionFeedbackType.Snackbar) {
|
|
3393
3522
|
this.showSavedSnackbar(uiAction);
|
|
3394
3523
|
}
|
|
@@ -3400,17 +3529,17 @@ class UiActionService {
|
|
|
3400
3529
|
showSavedSnackbar(uiAction) {
|
|
3401
3530
|
this._snackBar.openFromComponent(SuccessSnackBarComponent, {
|
|
3402
3531
|
duration: 5 * 1000,
|
|
3403
|
-
panelClass: [
|
|
3532
|
+
panelClass: ['backgroundColor-accent'],
|
|
3404
3533
|
data: uiAction,
|
|
3405
3534
|
});
|
|
3406
3535
|
}
|
|
3407
3536
|
}
|
|
3408
3537
|
UiActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, deps: [{ token: UiActionConfirmDialogService }, { token: UiActionInputDialogService }, { token: i3$2.MatSnackBar }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3409
|
-
UiActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, providedIn:
|
|
3538
|
+
UiActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, providedIn: 'root' });
|
|
3410
3539
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, decorators: [{
|
|
3411
3540
|
type: Injectable,
|
|
3412
3541
|
args: [{
|
|
3413
|
-
providedIn:
|
|
3542
|
+
providedIn: 'root',
|
|
3414
3543
|
}]
|
|
3415
3544
|
}], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionInputDialogService }, { type: i3$2.MatSnackBar }]; } });
|
|
3416
3545
|
|
|
@@ -3427,7 +3556,7 @@ class UiActionToolbarComponent {
|
|
|
3427
3556
|
this.setUp();
|
|
3428
3557
|
}
|
|
3429
3558
|
ngOnChanges(changes) {
|
|
3430
|
-
let uiActionModels = changes[
|
|
3559
|
+
let uiActionModels = changes['uiActionModels'].currentValue;
|
|
3431
3560
|
if (uiActionModels) {
|
|
3432
3561
|
this.uiActionModels = uiActionModels;
|
|
3433
3562
|
this.setUp();
|
|
@@ -3450,19 +3579,19 @@ class UiActionToolbarComponent {
|
|
|
3450
3579
|
getType(uiActionModel) {
|
|
3451
3580
|
switch (uiActionModel.descriptor?.type) {
|
|
3452
3581
|
case UiActionButtonType.Normal:
|
|
3453
|
-
return
|
|
3582
|
+
return 'mat-button';
|
|
3454
3583
|
case UiActionButtonType.Flat:
|
|
3455
|
-
return
|
|
3584
|
+
return 'mat-flat-button';
|
|
3456
3585
|
case UiActionButtonType.Raised:
|
|
3457
|
-
return
|
|
3586
|
+
return 'mat-raised-button';
|
|
3458
3587
|
case UiActionButtonType.Stroked:
|
|
3459
|
-
return
|
|
3588
|
+
return 'mat-stroked-button';
|
|
3460
3589
|
case UiActionButtonType.Icon:
|
|
3461
|
-
return
|
|
3590
|
+
return 'mat-icon-button';
|
|
3462
3591
|
case UiActionButtonType.MiniFab:
|
|
3463
|
-
return
|
|
3592
|
+
return 'mat-mini-fab';
|
|
3464
3593
|
case UiActionButtonType.Fab:
|
|
3465
|
-
return
|
|
3594
|
+
return 'mat-fab';
|
|
3466
3595
|
default:
|
|
3467
3596
|
console.log(`Unhandled action button type case: ${uiActionModel.descriptor?.type}`);
|
|
3468
3597
|
return `mat-button`;
|
|
@@ -3481,7 +3610,7 @@ UiActionToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0",
|
|
|
3481
3610
|
UiActionToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: UiActionToolbarComponent, selector: "smart-ui-action-toolbar", inputs: { uiActionModels: "uiActionModels" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"uiActionButtonsContainer\">\n <button\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\n mat-button\n [ngClass]=\"getType(uiActionModel)\"\n class=\"{{ uiActionModel.cssClass }}\"\n [color]=\"uiActionModel.descriptor?.color\"\n (click)=\"onActionClicked($event, uiActionModel)\"\n >\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\n <ng-template #iconOnly>\n <smart-icon\n *ngIf=\"uiActionModel.descriptor?.icon\"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n <ng-template #text>\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Pre\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n {{ uiActionModel.descriptor?.title }}\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Post\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n </button>\n</div>\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap;min-height:2.25rem}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4$1.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }], directives: [{ type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
3482
3611
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionToolbarComponent, decorators: [{
|
|
3483
3612
|
type: Component,
|
|
3484
|
-
args: [{ selector:
|
|
3613
|
+
args: [{ selector: 'smart-ui-action-toolbar', template: "<div class=\"uiActionButtonsContainer\">\n <button\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\n mat-button\n [ngClass]=\"getType(uiActionModel)\"\n class=\"{{ uiActionModel.cssClass }}\"\n [color]=\"uiActionModel.descriptor?.color\"\n (click)=\"onActionClicked($event, uiActionModel)\"\n >\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\n <ng-template #iconOnly>\n <smart-icon\n *ngIf=\"uiActionModel.descriptor?.icon\"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n <ng-template #text>\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Pre\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n {{ uiActionModel.descriptor?.title }}\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Post\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n </button>\n</div>\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap;min-height:2.25rem}\n"] }]
|
|
3485
3614
|
}], ctorParameters: function () { return [{ type: UiActionService }, { type: UiActionDescriptorService }]; }, propDecorators: { uiActionModels: [{
|
|
3486
3615
|
type: Input
|
|
3487
3616
|
}] } });
|
|
@@ -3611,9 +3740,8 @@ class SmartSubject extends Subject {
|
|
|
3611
3740
|
}
|
|
3612
3741
|
|
|
3613
3742
|
let SmartComponentApiClient = class SmartComponentApiClient {
|
|
3614
|
-
constructor(
|
|
3743
|
+
constructor(inject, auth, pageName) {
|
|
3615
3744
|
this.auth = auth;
|
|
3616
|
-
this.viewContext = viewContext;
|
|
3617
3745
|
this.pageName = pageName;
|
|
3618
3746
|
this._destroy$ = new Subject();
|
|
3619
3747
|
this.detectChange = new SmartSubject(this._destroy$);
|
|
@@ -3626,6 +3754,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3626
3754
|
this.model = model;
|
|
3627
3755
|
this.data = model.data;
|
|
3628
3756
|
});
|
|
3757
|
+
this.viewContext = inject.get(SmartViewContextService);
|
|
3758
|
+
this.uiActionService = inject.get(UiActionService);
|
|
3759
|
+
this.uiActionDescriptorService = inject.get(UiActionDescriptorService);
|
|
3629
3760
|
}
|
|
3630
3761
|
get uuid() {
|
|
3631
3762
|
return this._uuid;
|
|
@@ -3686,10 +3817,15 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3686
3817
|
});
|
|
3687
3818
|
}
|
|
3688
3819
|
}
|
|
3820
|
+
async load() {
|
|
3821
|
+
this.uuid = this.viewContext.getUuidOfPage(this.pageName);
|
|
3822
|
+
this.model = await this.viewContext.load(this.uuid);
|
|
3823
|
+
}
|
|
3824
|
+
//#region UseUiAction
|
|
3689
3825
|
getAdditionalParams(uiAction) {
|
|
3690
3826
|
return {
|
|
3691
|
-
forTextArea:
|
|
3692
|
-
forTextField:
|
|
3827
|
+
forTextArea: '',
|
|
3828
|
+
forTextField: '',
|
|
3693
3829
|
};
|
|
3694
3830
|
}
|
|
3695
3831
|
getModel() {
|
|
@@ -3698,21 +3834,35 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3698
3834
|
async performUiActionRequest(uiActionRequest) {
|
|
3699
3835
|
await this.viewContext.performAction(this.uuid, uiActionRequest);
|
|
3700
3836
|
}
|
|
3837
|
+
async performWidgetActionRequest(uiActionRequest, widgetId, nodeId) {
|
|
3838
|
+
await this.viewContext.performWidgetAction(this.uuid, widgetId, nodeId, uiActionRequest);
|
|
3839
|
+
}
|
|
3840
|
+
async performWidgetMainActionRequest(uiActionRequest, widgetId) {
|
|
3841
|
+
await this.viewContext.performWidgetMainAction(this.uuid, widgetId, uiActionRequest);
|
|
3842
|
+
}
|
|
3701
3843
|
handleSpecificDemandsAsynchronously(uiAction, uiActionRequest) {
|
|
3702
|
-
throw new Error(
|
|
3844
|
+
throw new Error('handleSpecificDemandsAsynchronously method not implemented.');
|
|
3703
3845
|
}
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3846
|
+
//#endregion
|
|
3847
|
+
addGrid(smartGrid, options, useAsDefaultGrid) {
|
|
3848
|
+
smartGrid.options = options;
|
|
3849
|
+
smartGrid.uiActionService = this.uiActionService;
|
|
3850
|
+
smartGrid.uiActionDescriptorService = this.uiActionDescriptorService;
|
|
3851
|
+
smartGrid.serviceToUse = this;
|
|
3852
|
+
if (useAsDefaultGrid) {
|
|
3853
|
+
this.smartGrid = smartGrid;
|
|
3854
|
+
return this.smartGrid;
|
|
3855
|
+
}
|
|
3856
|
+
return smartGrid;
|
|
3707
3857
|
}
|
|
3708
3858
|
};
|
|
3709
3859
|
SmartComponentApiClient = __decorate([
|
|
3710
|
-
__param(2, Inject(
|
|
3860
|
+
__param(2, Inject('pageName'))
|
|
3711
3861
|
], SmartComponentApiClient);
|
|
3712
3862
|
|
|
3713
3863
|
class SmartComponent extends SmartComponentApiClient {
|
|
3714
|
-
constructor(
|
|
3715
|
-
super(
|
|
3864
|
+
constructor(inject, auth, pageName) {
|
|
3865
|
+
super(inject, auth, pageName);
|
|
3716
3866
|
}
|
|
3717
3867
|
ngOnInit() {
|
|
3718
3868
|
this._ngOnInit();
|
|
@@ -3721,24 +3871,24 @@ class SmartComponent extends SmartComponentApiClient {
|
|
|
3721
3871
|
this._ngOnDestroy();
|
|
3722
3872
|
}
|
|
3723
3873
|
}
|
|
3724
|
-
SmartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponent, deps: [{ token:
|
|
3725
|
-
SmartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template:
|
|
3874
|
+
SmartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponent, deps: [{ token: i0.Injector }, { token: SmartAuthService }, { token: 'pageName' }], target: i0.ɵɵFactoryTarget.Component });
|
|
3875
|
+
SmartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
3726
3876
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponent, decorators: [{
|
|
3727
3877
|
type: Component,
|
|
3728
3878
|
args: [{
|
|
3729
|
-
template:
|
|
3879
|
+
template: '',
|
|
3730
3880
|
}]
|
|
3731
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
3881
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined, decorators: [{
|
|
3732
3882
|
type: Inject,
|
|
3733
3883
|
args: [SmartAuthService]
|
|
3734
|
-
}] }, { type:
|
|
3884
|
+
}] }, { type: undefined, decorators: [{
|
|
3735
3885
|
type: Inject,
|
|
3736
|
-
args: [
|
|
3886
|
+
args: ['pageName']
|
|
3737
3887
|
}] }]; } });
|
|
3738
3888
|
|
|
3739
3889
|
class SmartService extends SmartComponentApiClient {
|
|
3740
|
-
constructor(
|
|
3741
|
-
super(
|
|
3890
|
+
constructor(inject, auth, pageName) {
|
|
3891
|
+
super(inject, auth, pageName);
|
|
3742
3892
|
}
|
|
3743
3893
|
ngOnInit() {
|
|
3744
3894
|
this._ngOnInit();
|
|
@@ -3747,19 +3897,19 @@ class SmartService extends SmartComponentApiClient {
|
|
|
3747
3897
|
this._ngOnDestroy();
|
|
3748
3898
|
}
|
|
3749
3899
|
}
|
|
3750
|
-
SmartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartService, deps: [{ token:
|
|
3751
|
-
SmartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartService, providedIn:
|
|
3900
|
+
SmartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartService, deps: [{ token: i0.Injector }, { token: SmartAuthService }, { token: 'pageName' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3901
|
+
SmartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartService, providedIn: 'root' });
|
|
3752
3902
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartService, decorators: [{
|
|
3753
3903
|
type: Injectable,
|
|
3754
3904
|
args: [{
|
|
3755
|
-
providedIn:
|
|
3905
|
+
providedIn: 'root',
|
|
3756
3906
|
}]
|
|
3757
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
3907
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined, decorators: [{
|
|
3758
3908
|
type: Inject,
|
|
3759
3909
|
args: [SmartAuthService]
|
|
3760
|
-
}] }, { type:
|
|
3910
|
+
}] }, { type: undefined, decorators: [{
|
|
3761
3911
|
type: Inject,
|
|
3762
|
-
args: [
|
|
3912
|
+
args: ['pageName']
|
|
3763
3913
|
}] }]; } });
|
|
3764
3914
|
|
|
3765
3915
|
/*
|