@smartbit4all/ng-client 1.0.12 → 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.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 +236 -77
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +225 -76
- 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.12.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
|
|
|
@@ -3280,7 +3401,7 @@ class UiActionService {
|
|
|
3280
3401
|
this.textFieldDialogService = textFieldDialogService;
|
|
3281
3402
|
this._snackBar = _snackBar;
|
|
3282
3403
|
}
|
|
3283
|
-
async execute(uiAction) {
|
|
3404
|
+
async execute(uiAction, options) {
|
|
3284
3405
|
let uiActionRequest;
|
|
3285
3406
|
uiActionRequest = {
|
|
3286
3407
|
code: uiAction.code,
|
|
@@ -3311,7 +3432,7 @@ class UiActionService {
|
|
|
3311
3432
|
}
|
|
3312
3433
|
// InputType
|
|
3313
3434
|
if (uiAction.inputType) {
|
|
3314
|
-
uiActionRequest = await this.handleInputType(uiAction.inputType, uiAction, uiActionRequest,
|
|
3435
|
+
uiActionRequest = await this.handleInputType(uiAction.inputType, uiAction, uiActionRequest, 'inputDialog');
|
|
3315
3436
|
if (!uiActionRequest) {
|
|
3316
3437
|
return;
|
|
3317
3438
|
}
|
|
@@ -3319,7 +3440,7 @@ class UiActionService {
|
|
|
3319
3440
|
}
|
|
3320
3441
|
// Input2Type
|
|
3321
3442
|
if (uiAction.input2Type) {
|
|
3322
|
-
uiActionRequest = await this.handleInputType(uiAction.input2Type, uiAction, uiActionRequest,
|
|
3443
|
+
uiActionRequest = await this.handleInputType(uiAction.input2Type, uiAction, uiActionRequest, 'input2Dialog');
|
|
3323
3444
|
if (!uiActionRequest) {
|
|
3324
3445
|
return;
|
|
3325
3446
|
}
|
|
@@ -3331,7 +3452,7 @@ class UiActionService {
|
|
|
3331
3452
|
}
|
|
3332
3453
|
uiActionRequest = response.uiActionRequest;
|
|
3333
3454
|
}
|
|
3334
|
-
this.performAction(uiAction, uiActionRequest);
|
|
3455
|
+
this.performAction(uiAction, uiActionRequest, options);
|
|
3335
3456
|
}
|
|
3336
3457
|
async handleInputType(inputType, uiAction, uiActionRequest, inputTypeName) {
|
|
3337
3458
|
switch (inputType) {
|
|
@@ -3348,7 +3469,7 @@ class UiActionService {
|
|
|
3348
3469
|
}
|
|
3349
3470
|
async handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest) {
|
|
3350
3471
|
let additionalParams = this.uiActionModel.serviceToUse.getAdditionalParams(uiAction);
|
|
3351
|
-
let inputType = inputTypeName ===
|
|
3472
|
+
let inputType = inputTypeName === 'inputDialog' ? 'inputType' : 'input2Type';
|
|
3352
3473
|
if (uiAction[inputType] === UiActionInputType.Textfield) {
|
|
3353
3474
|
this.textFieldDialogService.nodeName = additionalParams.forTextField;
|
|
3354
3475
|
}
|
|
@@ -3361,7 +3482,7 @@ class UiActionService {
|
|
|
3361
3482
|
await this.textFieldDialogService.onAction.toPromise();
|
|
3362
3483
|
let params = this.textFieldDialogService.params;
|
|
3363
3484
|
if (!params) {
|
|
3364
|
-
console.error(
|
|
3485
|
+
console.error('There was no response from InputDialog');
|
|
3365
3486
|
return;
|
|
3366
3487
|
}
|
|
3367
3488
|
uiActionRequest.params = {
|
|
@@ -3378,18 +3499,25 @@ class UiActionService {
|
|
|
3378
3499
|
uiActionRequest = response.uiActionRequest;
|
|
3379
3500
|
return uiActionRequest;
|
|
3380
3501
|
}
|
|
3381
|
-
async performAction(uiAction, uiActionRequest) {
|
|
3382
|
-
if (!uiActionRequest.params ||
|
|
3383
|
-
(uiActionRequest.params && !Object.keys(uiActionRequest.params).length)) {
|
|
3502
|
+
async performAction(uiAction, uiActionRequest, options) {
|
|
3503
|
+
if (!uiActionRequest.params || (uiActionRequest.params && !Object.keys(uiActionRequest.params).length)) {
|
|
3384
3504
|
uiActionRequest.params = {
|
|
3385
3505
|
model: this.uiActionModel.serviceToUse.getModel(),
|
|
3386
3506
|
};
|
|
3387
3507
|
}
|
|
3388
3508
|
else if (uiAction.submit) {
|
|
3389
|
-
uiActionRequest.params[
|
|
3509
|
+
uiActionRequest.params['model'] = this.uiActionModel.serviceToUse.getModel();
|
|
3390
3510
|
}
|
|
3391
3511
|
try {
|
|
3392
|
-
|
|
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
|
+
}
|
|
3393
3521
|
if (this.uiActionModel.descriptor?.feedbackType === UiActionFeedbackType.Snackbar) {
|
|
3394
3522
|
this.showSavedSnackbar(uiAction);
|
|
3395
3523
|
}
|
|
@@ -3401,17 +3529,17 @@ class UiActionService {
|
|
|
3401
3529
|
showSavedSnackbar(uiAction) {
|
|
3402
3530
|
this._snackBar.openFromComponent(SuccessSnackBarComponent, {
|
|
3403
3531
|
duration: 5 * 1000,
|
|
3404
|
-
panelClass: [
|
|
3532
|
+
panelClass: ['backgroundColor-accent'],
|
|
3405
3533
|
data: uiAction,
|
|
3406
3534
|
});
|
|
3407
3535
|
}
|
|
3408
3536
|
}
|
|
3409
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 });
|
|
3410
|
-
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' });
|
|
3411
3539
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, decorators: [{
|
|
3412
3540
|
type: Injectable,
|
|
3413
3541
|
args: [{
|
|
3414
|
-
providedIn:
|
|
3542
|
+
providedIn: 'root',
|
|
3415
3543
|
}]
|
|
3416
3544
|
}], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionInputDialogService }, { type: i3$2.MatSnackBar }]; } });
|
|
3417
3545
|
|
|
@@ -3428,7 +3556,7 @@ class UiActionToolbarComponent {
|
|
|
3428
3556
|
this.setUp();
|
|
3429
3557
|
}
|
|
3430
3558
|
ngOnChanges(changes) {
|
|
3431
|
-
let uiActionModels = changes[
|
|
3559
|
+
let uiActionModels = changes['uiActionModels'].currentValue;
|
|
3432
3560
|
if (uiActionModels) {
|
|
3433
3561
|
this.uiActionModels = uiActionModels;
|
|
3434
3562
|
this.setUp();
|
|
@@ -3451,19 +3579,19 @@ class UiActionToolbarComponent {
|
|
|
3451
3579
|
getType(uiActionModel) {
|
|
3452
3580
|
switch (uiActionModel.descriptor?.type) {
|
|
3453
3581
|
case UiActionButtonType.Normal:
|
|
3454
|
-
return
|
|
3582
|
+
return 'mat-button';
|
|
3455
3583
|
case UiActionButtonType.Flat:
|
|
3456
|
-
return
|
|
3584
|
+
return 'mat-flat-button';
|
|
3457
3585
|
case UiActionButtonType.Raised:
|
|
3458
|
-
return
|
|
3586
|
+
return 'mat-raised-button';
|
|
3459
3587
|
case UiActionButtonType.Stroked:
|
|
3460
|
-
return
|
|
3588
|
+
return 'mat-stroked-button';
|
|
3461
3589
|
case UiActionButtonType.Icon:
|
|
3462
|
-
return
|
|
3590
|
+
return 'mat-icon-button';
|
|
3463
3591
|
case UiActionButtonType.MiniFab:
|
|
3464
|
-
return
|
|
3592
|
+
return 'mat-mini-fab';
|
|
3465
3593
|
case UiActionButtonType.Fab:
|
|
3466
|
-
return
|
|
3594
|
+
return 'mat-fab';
|
|
3467
3595
|
default:
|
|
3468
3596
|
console.log(`Unhandled action button type case: ${uiActionModel.descriptor?.type}`);
|
|
3469
3597
|
return `mat-button`;
|
|
@@ -3482,7 +3610,7 @@ UiActionToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0",
|
|
|
3482
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"] }] });
|
|
3483
3611
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionToolbarComponent, decorators: [{
|
|
3484
3612
|
type: Component,
|
|
3485
|
-
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"] }]
|
|
3486
3614
|
}], ctorParameters: function () { return [{ type: UiActionService }, { type: UiActionDescriptorService }]; }, propDecorators: { uiActionModels: [{
|
|
3487
3615
|
type: Input
|
|
3488
3616
|
}] } });
|
|
@@ -3612,9 +3740,8 @@ class SmartSubject extends Subject {
|
|
|
3612
3740
|
}
|
|
3613
3741
|
|
|
3614
3742
|
let SmartComponentApiClient = class SmartComponentApiClient {
|
|
3615
|
-
constructor(
|
|
3743
|
+
constructor(inject, auth, pageName) {
|
|
3616
3744
|
this.auth = auth;
|
|
3617
|
-
this.viewContext = viewContext;
|
|
3618
3745
|
this.pageName = pageName;
|
|
3619
3746
|
this._destroy$ = new Subject();
|
|
3620
3747
|
this.detectChange = new SmartSubject(this._destroy$);
|
|
@@ -3627,6 +3754,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3627
3754
|
this.model = model;
|
|
3628
3755
|
this.data = model.data;
|
|
3629
3756
|
});
|
|
3757
|
+
this.viewContext = inject.get(SmartViewContextService);
|
|
3758
|
+
this.uiActionService = inject.get(UiActionService);
|
|
3759
|
+
this.uiActionDescriptorService = inject.get(UiActionDescriptorService);
|
|
3630
3760
|
}
|
|
3631
3761
|
get uuid() {
|
|
3632
3762
|
return this._uuid;
|
|
@@ -3687,10 +3817,15 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3687
3817
|
});
|
|
3688
3818
|
}
|
|
3689
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
|
|
3690
3825
|
getAdditionalParams(uiAction) {
|
|
3691
3826
|
return {
|
|
3692
|
-
forTextArea:
|
|
3693
|
-
forTextField:
|
|
3827
|
+
forTextArea: '',
|
|
3828
|
+
forTextField: '',
|
|
3694
3829
|
};
|
|
3695
3830
|
}
|
|
3696
3831
|
getModel() {
|
|
@@ -3699,21 +3834,35 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3699
3834
|
async performUiActionRequest(uiActionRequest) {
|
|
3700
3835
|
await this.viewContext.performAction(this.uuid, uiActionRequest);
|
|
3701
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
|
+
}
|
|
3702
3843
|
handleSpecificDemandsAsynchronously(uiAction, uiActionRequest) {
|
|
3703
|
-
throw new Error(
|
|
3844
|
+
throw new Error('handleSpecificDemandsAsynchronously method not implemented.');
|
|
3704
3845
|
}
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
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;
|
|
3708
3857
|
}
|
|
3709
3858
|
};
|
|
3710
3859
|
SmartComponentApiClient = __decorate([
|
|
3711
|
-
__param(2, Inject(
|
|
3860
|
+
__param(2, Inject('pageName'))
|
|
3712
3861
|
], SmartComponentApiClient);
|
|
3713
3862
|
|
|
3714
3863
|
class SmartComponent extends SmartComponentApiClient {
|
|
3715
|
-
constructor(
|
|
3716
|
-
super(
|
|
3864
|
+
constructor(inject, auth, pageName) {
|
|
3865
|
+
super(inject, auth, pageName);
|
|
3717
3866
|
}
|
|
3718
3867
|
ngOnInit() {
|
|
3719
3868
|
this._ngOnInit();
|
|
@@ -3722,24 +3871,24 @@ class SmartComponent extends SmartComponentApiClient {
|
|
|
3722
3871
|
this._ngOnDestroy();
|
|
3723
3872
|
}
|
|
3724
3873
|
}
|
|
3725
|
-
SmartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponent, deps: [{ token:
|
|
3726
|
-
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 });
|
|
3727
3876
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponent, decorators: [{
|
|
3728
3877
|
type: Component,
|
|
3729
3878
|
args: [{
|
|
3730
|
-
template:
|
|
3879
|
+
template: '',
|
|
3731
3880
|
}]
|
|
3732
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
3881
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined, decorators: [{
|
|
3733
3882
|
type: Inject,
|
|
3734
3883
|
args: [SmartAuthService]
|
|
3735
|
-
}] }, { type:
|
|
3884
|
+
}] }, { type: undefined, decorators: [{
|
|
3736
3885
|
type: Inject,
|
|
3737
|
-
args: [
|
|
3886
|
+
args: ['pageName']
|
|
3738
3887
|
}] }]; } });
|
|
3739
3888
|
|
|
3740
3889
|
class SmartService extends SmartComponentApiClient {
|
|
3741
|
-
constructor(
|
|
3742
|
-
super(
|
|
3890
|
+
constructor(inject, auth, pageName) {
|
|
3891
|
+
super(inject, auth, pageName);
|
|
3743
3892
|
}
|
|
3744
3893
|
ngOnInit() {
|
|
3745
3894
|
this._ngOnInit();
|
|
@@ -3748,19 +3897,19 @@ class SmartService extends SmartComponentApiClient {
|
|
|
3748
3897
|
this._ngOnDestroy();
|
|
3749
3898
|
}
|
|
3750
3899
|
}
|
|
3751
|
-
SmartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartService, deps: [{ token:
|
|
3752
|
-
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' });
|
|
3753
3902
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartService, decorators: [{
|
|
3754
3903
|
type: Injectable,
|
|
3755
3904
|
args: [{
|
|
3756
|
-
providedIn:
|
|
3905
|
+
providedIn: 'root',
|
|
3757
3906
|
}]
|
|
3758
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
3907
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined, decorators: [{
|
|
3759
3908
|
type: Inject,
|
|
3760
3909
|
args: [SmartAuthService]
|
|
3761
|
-
}] }, { type:
|
|
3910
|
+
}] }, { type: undefined, decorators: [{
|
|
3762
3911
|
type: Inject,
|
|
3763
|
-
args: [
|
|
3912
|
+
args: ['pageName']
|
|
3764
3913
|
}] }]; } });
|
|
3765
3914
|
|
|
3766
3915
|
/*
|