@smartbit4all/ng-client 1.0.12 → 1.0.14
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 +40 -16
- 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 +18 -19
- package/esm2020/lib/view-context/smart-view-context.service.mjs +37 -33
- package/fesm2015/smartbit4all-ng-client.mjs +229 -80
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +221 -78
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-client/smart-component-api-client.d.ts +13 -7
- 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 +3 -3
- 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.14.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,17 @@ 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
|
-
await this.uiActionModel.serviceToUse.performUiActionRequest(uiActionRequest);
|
|
3512
|
+
await this.uiActionModel.serviceToUse.performUiActionRequest(uiActionRequest, options?.widgetId, options?.nodeId);
|
|
3393
3513
|
if (this.uiActionModel.descriptor?.feedbackType === UiActionFeedbackType.Snackbar) {
|
|
3394
3514
|
this.showSavedSnackbar(uiAction);
|
|
3395
3515
|
}
|
|
@@ -3401,17 +3521,17 @@ class UiActionService {
|
|
|
3401
3521
|
showSavedSnackbar(uiAction) {
|
|
3402
3522
|
this._snackBar.openFromComponent(SuccessSnackBarComponent, {
|
|
3403
3523
|
duration: 5 * 1000,
|
|
3404
|
-
panelClass: [
|
|
3524
|
+
panelClass: ['backgroundColor-accent'],
|
|
3405
3525
|
data: uiAction,
|
|
3406
3526
|
});
|
|
3407
3527
|
}
|
|
3408
3528
|
}
|
|
3409
3529
|
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:
|
|
3530
|
+
UiActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, providedIn: 'root' });
|
|
3411
3531
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, decorators: [{
|
|
3412
3532
|
type: Injectable,
|
|
3413
3533
|
args: [{
|
|
3414
|
-
providedIn:
|
|
3534
|
+
providedIn: 'root',
|
|
3415
3535
|
}]
|
|
3416
3536
|
}], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionInputDialogService }, { type: i3$2.MatSnackBar }]; } });
|
|
3417
3537
|
|
|
@@ -3428,7 +3548,7 @@ class UiActionToolbarComponent {
|
|
|
3428
3548
|
this.setUp();
|
|
3429
3549
|
}
|
|
3430
3550
|
ngOnChanges(changes) {
|
|
3431
|
-
let uiActionModels = changes[
|
|
3551
|
+
let uiActionModels = changes['uiActionModels'].currentValue;
|
|
3432
3552
|
if (uiActionModels) {
|
|
3433
3553
|
this.uiActionModels = uiActionModels;
|
|
3434
3554
|
this.setUp();
|
|
@@ -3451,19 +3571,19 @@ class UiActionToolbarComponent {
|
|
|
3451
3571
|
getType(uiActionModel) {
|
|
3452
3572
|
switch (uiActionModel.descriptor?.type) {
|
|
3453
3573
|
case UiActionButtonType.Normal:
|
|
3454
|
-
return
|
|
3574
|
+
return 'mat-button';
|
|
3455
3575
|
case UiActionButtonType.Flat:
|
|
3456
|
-
return
|
|
3576
|
+
return 'mat-flat-button';
|
|
3457
3577
|
case UiActionButtonType.Raised:
|
|
3458
|
-
return
|
|
3578
|
+
return 'mat-raised-button';
|
|
3459
3579
|
case UiActionButtonType.Stroked:
|
|
3460
|
-
return
|
|
3580
|
+
return 'mat-stroked-button';
|
|
3461
3581
|
case UiActionButtonType.Icon:
|
|
3462
|
-
return
|
|
3582
|
+
return 'mat-icon-button';
|
|
3463
3583
|
case UiActionButtonType.MiniFab:
|
|
3464
|
-
return
|
|
3584
|
+
return 'mat-mini-fab';
|
|
3465
3585
|
case UiActionButtonType.Fab:
|
|
3466
|
-
return
|
|
3586
|
+
return 'mat-fab';
|
|
3467
3587
|
default:
|
|
3468
3588
|
console.log(`Unhandled action button type case: ${uiActionModel.descriptor?.type}`);
|
|
3469
3589
|
return `mat-button`;
|
|
@@ -3482,7 +3602,7 @@ UiActionToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0",
|
|
|
3482
3602
|
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
3603
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionToolbarComponent, decorators: [{
|
|
3484
3604
|
type: Component,
|
|
3485
|
-
args: [{ selector:
|
|
3605
|
+
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
3606
|
}], ctorParameters: function () { return [{ type: UiActionService }, { type: UiActionDescriptorService }]; }, propDecorators: { uiActionModels: [{
|
|
3487
3607
|
type: Input
|
|
3488
3608
|
}] } });
|
|
@@ -3612,9 +3732,8 @@ class SmartSubject extends Subject {
|
|
|
3612
3732
|
}
|
|
3613
3733
|
|
|
3614
3734
|
let SmartComponentApiClient = class SmartComponentApiClient {
|
|
3615
|
-
constructor(
|
|
3735
|
+
constructor(inject, auth, pageName) {
|
|
3616
3736
|
this.auth = auth;
|
|
3617
|
-
this.viewContext = viewContext;
|
|
3618
3737
|
this.pageName = pageName;
|
|
3619
3738
|
this._destroy$ = new Subject();
|
|
3620
3739
|
this.detectChange = new SmartSubject(this._destroy$);
|
|
@@ -3627,6 +3746,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3627
3746
|
this.model = model;
|
|
3628
3747
|
this.data = model.data;
|
|
3629
3748
|
});
|
|
3749
|
+
this.viewContext = inject.get(SmartViewContextService);
|
|
3750
|
+
this.uiActionService = inject.get(UiActionService);
|
|
3751
|
+
this.uiActionDescriptorService = inject.get(UiActionDescriptorService);
|
|
3630
3752
|
}
|
|
3631
3753
|
get uuid() {
|
|
3632
3754
|
return this._uuid;
|
|
@@ -3687,33 +3809,54 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3687
3809
|
});
|
|
3688
3810
|
}
|
|
3689
3811
|
}
|
|
3812
|
+
async load() {
|
|
3813
|
+
this.uuid = this.viewContext.getUuidOfPage(this.pageName);
|
|
3814
|
+
this.model = await this.viewContext.load(this.uuid);
|
|
3815
|
+
}
|
|
3816
|
+
//#region UseUiAction
|
|
3690
3817
|
getAdditionalParams(uiAction) {
|
|
3691
3818
|
return {
|
|
3692
|
-
forTextArea:
|
|
3693
|
-
forTextField:
|
|
3819
|
+
forTextArea: '',
|
|
3820
|
+
forTextField: '',
|
|
3694
3821
|
};
|
|
3695
3822
|
}
|
|
3696
3823
|
getModel() {
|
|
3697
3824
|
return this.data;
|
|
3698
3825
|
}
|
|
3699
|
-
async performUiActionRequest(uiActionRequest) {
|
|
3700
|
-
|
|
3826
|
+
async performUiActionRequest(uiActionRequest, widgetId, nodeId) {
|
|
3827
|
+
if (widgetId && nodeId) {
|
|
3828
|
+
await this.viewContext.performWidgetAction(this.uuid, widgetId, nodeId, uiActionRequest);
|
|
3829
|
+
}
|
|
3830
|
+
else if (widgetId) {
|
|
3831
|
+
await this.viewContext.performWidgetMainAction(this.uuid, widgetId, uiActionRequest);
|
|
3832
|
+
}
|
|
3833
|
+
else {
|
|
3834
|
+
await this.viewContext.performAction(this.uuid, uiActionRequest);
|
|
3835
|
+
}
|
|
3701
3836
|
}
|
|
3702
3837
|
handleSpecificDemandsAsynchronously(uiAction, uiActionRequest) {
|
|
3703
|
-
throw new Error(
|
|
3838
|
+
throw new Error('handleSpecificDemandsAsynchronously method not implemented.');
|
|
3704
3839
|
}
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3840
|
+
//#endregion
|
|
3841
|
+
addGrid(smartGrid, options, useAsDefaultGrid) {
|
|
3842
|
+
smartGrid.options = options;
|
|
3843
|
+
smartGrid.uiActionService = this.uiActionService;
|
|
3844
|
+
smartGrid.uiActionDescriptorService = this.uiActionDescriptorService;
|
|
3845
|
+
smartGrid.serviceToUse = this;
|
|
3846
|
+
if (useAsDefaultGrid) {
|
|
3847
|
+
this.smartGrid = smartGrid;
|
|
3848
|
+
return this.smartGrid;
|
|
3849
|
+
}
|
|
3850
|
+
return smartGrid;
|
|
3708
3851
|
}
|
|
3709
3852
|
};
|
|
3710
3853
|
SmartComponentApiClient = __decorate([
|
|
3711
|
-
__param(2, Inject(
|
|
3854
|
+
__param(2, Inject('pageName'))
|
|
3712
3855
|
], SmartComponentApiClient);
|
|
3713
3856
|
|
|
3714
3857
|
class SmartComponent extends SmartComponentApiClient {
|
|
3715
|
-
constructor(
|
|
3716
|
-
super(
|
|
3858
|
+
constructor(inject, auth, pageName) {
|
|
3859
|
+
super(inject, auth, pageName);
|
|
3717
3860
|
}
|
|
3718
3861
|
ngOnInit() {
|
|
3719
3862
|
this._ngOnInit();
|
|
@@ -3722,24 +3865,24 @@ class SmartComponent extends SmartComponentApiClient {
|
|
|
3722
3865
|
this._ngOnDestroy();
|
|
3723
3866
|
}
|
|
3724
3867
|
}
|
|
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:
|
|
3868
|
+
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 });
|
|
3869
|
+
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
3870
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponent, decorators: [{
|
|
3728
3871
|
type: Component,
|
|
3729
3872
|
args: [{
|
|
3730
|
-
template:
|
|
3873
|
+
template: '',
|
|
3731
3874
|
}]
|
|
3732
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
3875
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined, decorators: [{
|
|
3733
3876
|
type: Inject,
|
|
3734
3877
|
args: [SmartAuthService]
|
|
3735
|
-
}] }, { type:
|
|
3878
|
+
}] }, { type: undefined, decorators: [{
|
|
3736
3879
|
type: Inject,
|
|
3737
|
-
args: [
|
|
3880
|
+
args: ['pageName']
|
|
3738
3881
|
}] }]; } });
|
|
3739
3882
|
|
|
3740
3883
|
class SmartService extends SmartComponentApiClient {
|
|
3741
|
-
constructor(
|
|
3742
|
-
super(
|
|
3884
|
+
constructor(inject, auth, pageName) {
|
|
3885
|
+
super(inject, auth, pageName);
|
|
3743
3886
|
}
|
|
3744
3887
|
ngOnInit() {
|
|
3745
3888
|
this._ngOnInit();
|
|
@@ -3748,19 +3891,19 @@ class SmartService extends SmartComponentApiClient {
|
|
|
3748
3891
|
this._ngOnDestroy();
|
|
3749
3892
|
}
|
|
3750
3893
|
}
|
|
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:
|
|
3894
|
+
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 });
|
|
3895
|
+
SmartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartService, providedIn: 'root' });
|
|
3753
3896
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartService, decorators: [{
|
|
3754
3897
|
type: Injectable,
|
|
3755
3898
|
args: [{
|
|
3756
|
-
providedIn:
|
|
3899
|
+
providedIn: 'root',
|
|
3757
3900
|
}]
|
|
3758
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
3901
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: undefined, decorators: [{
|
|
3759
3902
|
type: Inject,
|
|
3760
3903
|
args: [SmartAuthService]
|
|
3761
|
-
}] }, { type:
|
|
3904
|
+
}] }, { type: undefined, decorators: [{
|
|
3762
3905
|
type: Inject,
|
|
3763
|
-
args: [
|
|
3906
|
+
args: ['pageName']
|
|
3764
3907
|
}] }]; } });
|
|
3765
3908
|
|
|
3766
3909
|
/*
|