@smartbit4all/ng-client 1.0.29 → 1.1.0
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 +131 -7
- package/esm2020/lib/view-context/api/api/view.service.mjs +55 -1
- package/esm2020/lib/view-context/api/model/componentModel.mjs +1 -1
- package/esm2020/lib/view-context/api/model/componentModelChange.mjs +1 -1
- package/esm2020/lib/view-context/api/model/dataChange.mjs +2 -0
- package/esm2020/lib/view-context/api/model/dataChangeEvent.mjs +2 -0
- package/esm2020/lib/view-context/api/model/dataChangeKind.mjs +17 -0
- package/esm2020/lib/view-context/api/model/models.mjs +5 -1
- package/esm2020/lib/view-context/api/model/view.mjs +1 -1
- package/esm2020/lib/view-context/api/model/viewEventHandler.mjs +20 -0
- package/fesm2015/smartbit4all-ng-client.mjs +222 -6
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +221 -6
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-client/smart-component-api-client.d.ts +24 -3
- package/lib/view-context/api/api/view.service.d.ts +20 -0
- package/lib/view-context/api/model/componentModel.d.ts +0 -6
- package/lib/view-context/api/model/componentModelChange.d.ts +10 -0
- package/lib/view-context/api/model/dataChange.d.ts +27 -0
- package/lib/view-context/api/model/dataChangeEvent.d.ts +33 -0
- package/lib/view-context/api/model/dataChangeKind.d.ts +20 -0
- package/lib/view-context/api/model/models.d.ts +4 -0
- package/lib/view-context/api/model/view.d.ts +22 -1
- package/lib/view-context/api/model/viewEventHandler.d.ts +30 -0
- package/package.json +1 -1
- package/smartbit4all-ng-client-1.1.0.tgz +0 -0
- package/smartbit4all-ng-client-1.0.29.tgz +0 -0
|
@@ -27,6 +27,7 @@ import { Validators } from '@angular/forms';
|
|
|
27
27
|
import * as i5$1 from '@smartbit4all/form';
|
|
28
28
|
import { SmartFormWidgetType, SmartValidatorName, SmartFormWidgetDirection, SmartformModule } from '@smartbit4all/form';
|
|
29
29
|
import { __decorate, __param } from 'tslib';
|
|
30
|
+
import { SmartGridComponent } from '@smartbit4all/grid';
|
|
30
31
|
import { SmarttreeGenericService } from '@smartbit4all/tree';
|
|
31
32
|
|
|
32
33
|
/**
|
|
@@ -1150,6 +1151,60 @@ class ViewService {
|
|
|
1150
1151
|
reportProgress: reportProgress
|
|
1151
1152
|
});
|
|
1152
1153
|
}
|
|
1154
|
+
dataChanged(uuid, dataChange, observe = 'body', reportProgress = false, options) {
|
|
1155
|
+
if (uuid === null || uuid === undefined) {
|
|
1156
|
+
throw new Error('Required parameter uuid was null or undefined when calling dataChanged.');
|
|
1157
|
+
}
|
|
1158
|
+
if (dataChange === null || dataChange === undefined) {
|
|
1159
|
+
throw new Error('Required parameter dataChange was null or undefined when calling dataChanged.');
|
|
1160
|
+
}
|
|
1161
|
+
let localVarHeaders = this.defaultHeaders;
|
|
1162
|
+
let localVarHttpHeaderAcceptSelected = options && options.httpHeaderAccept;
|
|
1163
|
+
if (localVarHttpHeaderAcceptSelected === undefined) {
|
|
1164
|
+
// to determine the Accept header
|
|
1165
|
+
const httpHeaderAccepts = [
|
|
1166
|
+
'application/json'
|
|
1167
|
+
];
|
|
1168
|
+
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|
1169
|
+
}
|
|
1170
|
+
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
1171
|
+
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
1172
|
+
}
|
|
1173
|
+
let localVarHttpContext = options && options.context;
|
|
1174
|
+
if (localVarHttpContext === undefined) {
|
|
1175
|
+
localVarHttpContext = new HttpContext();
|
|
1176
|
+
}
|
|
1177
|
+
// to determine the Content-Type header
|
|
1178
|
+
const consumes = [
|
|
1179
|
+
'application/json'
|
|
1180
|
+
];
|
|
1181
|
+
const httpContentTypeSelected = this.configuration.selectHeaderContentType(consumes);
|
|
1182
|
+
if (httpContentTypeSelected !== undefined) {
|
|
1183
|
+
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
|
1184
|
+
}
|
|
1185
|
+
let responseType_ = 'json';
|
|
1186
|
+
if (localVarHttpHeaderAcceptSelected) {
|
|
1187
|
+
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
1188
|
+
responseType_ = 'text';
|
|
1189
|
+
}
|
|
1190
|
+
else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
1191
|
+
responseType_ = 'json';
|
|
1192
|
+
}
|
|
1193
|
+
else {
|
|
1194
|
+
responseType_ = 'blob';
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
let localVarPath = `/component/${this.configuration.encodeParam({ name: "uuid", value: uuid, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid" })}/data`;
|
|
1198
|
+
return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, {
|
|
1199
|
+
context: localVarHttpContext,
|
|
1200
|
+
body: dataChange,
|
|
1201
|
+
responseType: responseType_,
|
|
1202
|
+
withCredentials: this.configuration.withCredentials,
|
|
1203
|
+
headers: localVarHeaders,
|
|
1204
|
+
observe: observe,
|
|
1205
|
+
reportProgress: reportProgress
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1153
1208
|
downloadItem(uuid, item, observe = 'body', reportProgress = false, options) {
|
|
1154
1209
|
if (uuid === null || uuid === undefined) {
|
|
1155
1210
|
throw new Error('Required parameter uuid was null or undefined when calling downloadItem.');
|
|
@@ -1710,6 +1765,23 @@ const CloseResult = {
|
|
|
1710
1765
|
* Do not edit the class manually.
|
|
1711
1766
|
*/
|
|
1712
1767
|
|
|
1768
|
+
/**
|
|
1769
|
+
* View API
|
|
1770
|
+
* View API
|
|
1771
|
+
*
|
|
1772
|
+
* The version of the OpenAPI document: 1.0.0
|
|
1773
|
+
* Contact: info@it4all.hu
|
|
1774
|
+
*
|
|
1775
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
1776
|
+
* https://openapi-generator.tech
|
|
1777
|
+
* Do not edit the class manually.
|
|
1778
|
+
*/
|
|
1779
|
+
const DataChangeKind = {
|
|
1780
|
+
Widget: 'WIDGET',
|
|
1781
|
+
Selection: 'SELECTION',
|
|
1782
|
+
Lookup: 'LOOKUP'
|
|
1783
|
+
};
|
|
1784
|
+
|
|
1713
1785
|
/**
|
|
1714
1786
|
* View API
|
|
1715
1787
|
* View API
|
|
@@ -1852,6 +1924,26 @@ const UiActionInputType = {
|
|
|
1852
1924
|
* Do not edit the class manually.
|
|
1853
1925
|
*/
|
|
1854
1926
|
|
|
1927
|
+
/**
|
|
1928
|
+
* View API
|
|
1929
|
+
* View API
|
|
1930
|
+
*
|
|
1931
|
+
* The version of the OpenAPI document: 1.0.0
|
|
1932
|
+
* Contact: info@it4all.hu
|
|
1933
|
+
*
|
|
1934
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
1935
|
+
* https://openapi-generator.tech
|
|
1936
|
+
* Do not edit the class manually.
|
|
1937
|
+
*/
|
|
1938
|
+
var ViewEventHandler;
|
|
1939
|
+
(function (ViewEventHandler) {
|
|
1940
|
+
ViewEventHandler.ViewEventTypeEnum = {
|
|
1941
|
+
Before: 'before',
|
|
1942
|
+
Instead: 'instead',
|
|
1943
|
+
After: 'after',
|
|
1944
|
+
};
|
|
1945
|
+
})(ViewEventHandler || (ViewEventHandler = {}));
|
|
1946
|
+
|
|
1855
1947
|
/**
|
|
1856
1948
|
* View API
|
|
1857
1949
|
* View API
|
|
@@ -3787,9 +3879,11 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3787
3879
|
// UseUiAction
|
|
3788
3880
|
this.submit = new SmartSubject(this._destroy$);
|
|
3789
3881
|
this.reSubscribeToChange = new SmartSubject(this._destroy$);
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3882
|
+
// Contained Widgets
|
|
3883
|
+
this.widgets = new WidgetMap();
|
|
3884
|
+
this.formWidgets = new WidgetMap();
|
|
3885
|
+
this.detectChange.subscribe((change) => {
|
|
3886
|
+
this.handleChanges(change);
|
|
3793
3887
|
});
|
|
3794
3888
|
this.viewContext = inject.get(SmartViewContextService);
|
|
3795
3889
|
this.uiActionService = inject.get(UiActionService);
|
|
@@ -3833,6 +3927,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3833
3927
|
}
|
|
3834
3928
|
_ngOnDestroy() {
|
|
3835
3929
|
this.viewContext.unfollow(this.uuid);
|
|
3930
|
+
this.widgets.clearWidgets();
|
|
3836
3931
|
this._destroy$.next();
|
|
3837
3932
|
this._destroy$.complete();
|
|
3838
3933
|
}
|
|
@@ -3895,7 +3990,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3895
3990
|
throw new Error('handleSpecificDemandsAsynchronously method not implemented.');
|
|
3896
3991
|
}
|
|
3897
3992
|
//#endregion
|
|
3898
|
-
addGrid(smartGrid, options, useAsDefaultGrid) {
|
|
3993
|
+
addGrid(smartGrid, options, useAsDefaultGrid, componentReference) {
|
|
3899
3994
|
smartGrid.options = options;
|
|
3900
3995
|
smartGrid.uiActionService = this.uiActionService;
|
|
3901
3996
|
smartGrid.uiActionDescriptorService = this.uiActionDescriptorService;
|
|
@@ -3905,18 +4000,138 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
3905
4000
|
this.smartGrid = smartGrid;
|
|
3906
4001
|
return this.smartGrid;
|
|
3907
4002
|
}
|
|
4003
|
+
this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
|
|
3908
4004
|
return smartGrid;
|
|
3909
4005
|
}
|
|
4006
|
+
addForm(smartFormId, smartForm, componentReference) {
|
|
4007
|
+
this.formWidgets.addWidget(smartFormId, componentReference);
|
|
4008
|
+
// TODO form value changes
|
|
4009
|
+
return smartForm;
|
|
4010
|
+
}
|
|
3910
4011
|
setUpDefaultTree(treeId) {
|
|
3911
4012
|
this.smartTreeService = new SmarttreeGenericService(this.inject, this.pageName, treeId);
|
|
4013
|
+
this.widgets.addWidget(treeId, this.smartTreeService);
|
|
3912
4014
|
}
|
|
3913
4015
|
createTreeService(treeId) {
|
|
3914
|
-
|
|
4016
|
+
const treeService = new SmarttreeGenericService(this.inject, this.pageName, treeId);
|
|
4017
|
+
this.widgets.addWidget(treeId, treeService);
|
|
4018
|
+
return treeService;
|
|
4019
|
+
}
|
|
4020
|
+
// #region handle changes
|
|
4021
|
+
handleChanges(change) {
|
|
4022
|
+
if (change.changedWidgets) {
|
|
4023
|
+
this.handleChangeWidgets(change.changedWidgets);
|
|
4024
|
+
}
|
|
4025
|
+
if (change.changes) {
|
|
4026
|
+
const changes = change.changes;
|
|
4027
|
+
Object.keys(changes).map((changeKey) => {
|
|
4028
|
+
if (changeKey.startsWith('data.')) {
|
|
4029
|
+
this.handleDataChange(changes, changeKey);
|
|
4030
|
+
}
|
|
4031
|
+
else if (changeKey.startsWith('layouts.') && this.model?.layouts) {
|
|
4032
|
+
this.handleLayoutChange(changes, changeKey);
|
|
4033
|
+
}
|
|
4034
|
+
else if (changeKey.startsWith('valueSets.') && this.model?.valueSets) {
|
|
4035
|
+
this.handleValueSetChange(changes, changeKey);
|
|
4036
|
+
}
|
|
4037
|
+
else if (changeKey === 'actions') {
|
|
4038
|
+
this.handleActionChange(changes, changeKey);
|
|
4039
|
+
}
|
|
4040
|
+
else if (changeKey === 'constraints') {
|
|
4041
|
+
this.handleConstraintChange(changes, changeKey);
|
|
4042
|
+
}
|
|
4043
|
+
});
|
|
4044
|
+
}
|
|
4045
|
+
if (!change.changedWidgets && !change.changes && change.value) {
|
|
4046
|
+
this.model = change.value;
|
|
4047
|
+
}
|
|
4048
|
+
}
|
|
4049
|
+
handleChangeWidgets(changedWidgets) {
|
|
4050
|
+
changedWidgets.forEach((key) => {
|
|
4051
|
+
const reference = this.widgets.get(key);
|
|
4052
|
+
if (reference instanceof SmartGridComponent) {
|
|
4053
|
+
reference.refresh();
|
|
4054
|
+
}
|
|
4055
|
+
else if (reference instanceof SmarttreeGenericService) {
|
|
4056
|
+
reference.initialize();
|
|
4057
|
+
}
|
|
4058
|
+
else if (reference === undefined) {
|
|
4059
|
+
console.error(`Provided reference for ${key} is undefined.`);
|
|
4060
|
+
}
|
|
4061
|
+
});
|
|
4062
|
+
}
|
|
4063
|
+
setValueDeeply(model, key, value) {
|
|
4064
|
+
let splittedKeys = key.split('.');
|
|
4065
|
+
let deepModel = [model];
|
|
4066
|
+
let tempModel;
|
|
4067
|
+
for (let index = 0; index < splittedKeys.length; index++) {
|
|
4068
|
+
tempModel = deepModel[index];
|
|
4069
|
+
if (typeof tempModel[splittedKeys[index]] !== 'string' &&
|
|
4070
|
+
typeof tempModel[splittedKeys[index]] !== 'boolean' &&
|
|
4071
|
+
typeof tempModel[splittedKeys[index]] !== 'number' &&
|
|
4072
|
+
tempModel[splittedKeys[index]] !== undefined) {
|
|
4073
|
+
deepModel.push(tempModel[splittedKeys[index]]);
|
|
4074
|
+
}
|
|
4075
|
+
if (index === splittedKeys.length - 1) {
|
|
4076
|
+
tempModel[splittedKeys[index]] = value;
|
|
4077
|
+
break;
|
|
4078
|
+
}
|
|
4079
|
+
}
|
|
4080
|
+
return model;
|
|
4081
|
+
}
|
|
4082
|
+
handleDataChange(changes, changeKey) {
|
|
4083
|
+
this.setValueDeeply(this.data, changeKey, changes[changeKey]);
|
|
4084
|
+
this.formWidgets.widgets.forEach((formComponent, key) => {
|
|
4085
|
+
if (formComponent === undefined) {
|
|
4086
|
+
console.error(`Provided form reference for ${key} is undefined.`);
|
|
4087
|
+
}
|
|
4088
|
+
else {
|
|
4089
|
+
formComponent.refresh();
|
|
4090
|
+
}
|
|
4091
|
+
});
|
|
4092
|
+
}
|
|
4093
|
+
handleLayoutChange(changes, changeKey) {
|
|
4094
|
+
let layoutKey = changeKey.split('.')[1];
|
|
4095
|
+
this.model.layouts[layoutKey] = changes[changeKey];
|
|
4096
|
+
}
|
|
4097
|
+
handleValueSetChange(changes, changeKey) {
|
|
4098
|
+
let valueSetKey = changeKey.split('.')[1];
|
|
4099
|
+
this.model.valueSets[valueSetKey] = changes[changeKey];
|
|
4100
|
+
}
|
|
4101
|
+
handleActionChange(changes, changeKey) {
|
|
4102
|
+
this.model.actions = changes[changeKey];
|
|
4103
|
+
this.initActions();
|
|
4104
|
+
}
|
|
4105
|
+
handleConstraintChange(changes, changeKey) {
|
|
4106
|
+
this.model.constraints = changes[changeKey];
|
|
3915
4107
|
}
|
|
3916
4108
|
};
|
|
3917
4109
|
SmartComponentApiClient = __decorate([
|
|
3918
4110
|
__param(2, Inject('pageName'))
|
|
3919
4111
|
], SmartComponentApiClient);
|
|
4112
|
+
class WidgetMap {
|
|
4113
|
+
constructor() {
|
|
4114
|
+
this._widgets = new Map();
|
|
4115
|
+
}
|
|
4116
|
+
get widgets() {
|
|
4117
|
+
return this._widgets;
|
|
4118
|
+
}
|
|
4119
|
+
set widgets(widgets) {
|
|
4120
|
+
this._widgets = widgets;
|
|
4121
|
+
}
|
|
4122
|
+
addWidget(key, reference, isForm) {
|
|
4123
|
+
this._widgets.set(key, reference);
|
|
4124
|
+
}
|
|
4125
|
+
removeWidget(key) {
|
|
4126
|
+
this._widgets.delete(key);
|
|
4127
|
+
}
|
|
4128
|
+
clearWidgets() {
|
|
4129
|
+
this._widgets.clear();
|
|
4130
|
+
}
|
|
4131
|
+
get(key) {
|
|
4132
|
+
return this.widgets.get(key);
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
3920
4135
|
|
|
3921
4136
|
class SmartComponent extends SmartComponentApiClient {
|
|
3922
4137
|
constructor(inject, auth, pageName) {
|
|
@@ -3978,5 +4193,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3978
4193
|
* Generated bundle index. Do not edit.
|
|
3979
4194
|
*/
|
|
3980
4195
|
|
|
3981
|
-
export { APIS, ApiModule, BASE_PATH, COLLECTION_FORMATS, CloseResult, Configuration, IS_ASYNC_PARAM_NAME, MessageOptionType, MessageType, SessionAPIS, SessionErrorBehaviour, SessionService, SmartAuthService, SmartComponent, SmartComponentApiClient, SmartDevToolDatePipe, SmartDevToolFloatingButtonComponent, SmartDevToolService, SmartLinkChannelVariableInPath, SmartLinkUuidVariableInPath, SmartNgClientModule, SmartNgClientService, SmartService, SmartSessionModule, SmartSessionService, SmartSessionTimerComponent, SmartSessionTimerService, SmartSubject, SmartViewContextModule, SmartViewContextService, SmartViewRedirect, UiActionButtonIconPos, UiActionButtonType, UiActionConfirmDialogComponent, UiActionConfirmDialogService, UiActionDescriptorService, UiActionDialogType, UiActionFeedbackType, UiActionInputDialogComponent, UiActionInputDialogService, UiActionInputType, UiActionService, UiActionToolbarComponent, ViewService, ViewState, ViewType };
|
|
4196
|
+
export { APIS, ApiModule, BASE_PATH, COLLECTION_FORMATS, CloseResult, Configuration, DataChangeKind, IS_ASYNC_PARAM_NAME, MessageOptionType, MessageType, SessionAPIS, SessionErrorBehaviour, SessionService, SmartAuthService, SmartComponent, SmartComponentApiClient, SmartDevToolDatePipe, SmartDevToolFloatingButtonComponent, SmartDevToolService, SmartLinkChannelVariableInPath, SmartLinkUuidVariableInPath, SmartNgClientModule, SmartNgClientService, SmartService, SmartSessionModule, SmartSessionService, SmartSessionTimerComponent, SmartSessionTimerService, SmartSubject, SmartViewContextModule, SmartViewContextService, SmartViewRedirect, UiActionButtonIconPos, UiActionButtonType, UiActionConfirmDialogComponent, UiActionConfirmDialogService, UiActionDescriptorService, UiActionDialogType, UiActionFeedbackType, UiActionInputDialogComponent, UiActionInputDialogService, UiActionInputType, UiActionService, UiActionToolbarComponent, ViewEventHandler, ViewService, ViewState, ViewType, WidgetMap };
|
|
3982
4197
|
//# sourceMappingURL=smartbit4all-ng-client.mjs.map
|