@smartbit4all/ng-client 2.1.3 → 2.2.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 +28 -29
- package/esm2020/lib/view-context/api/model/componentModel.mjs +1 -1
- package/esm2020/lib/view-context/api/model/uiAction.mjs +1 -1
- package/esm2020/lib/view-context/api/model/view.mjs +1 -1
- 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 +22 -12
- package/fesm2015/smartbit4all-ng-client.mjs +48 -39
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +49 -40
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-client/smart-component-api-client.d.ts +4 -10
- package/lib/view-context/api/model/uiAction.d.ts +7 -0
- package/lib/view-context/smart-ui-action/ui-action.model.d.ts +8 -1
- package/package.json +2 -2
- package/smartbit4all-ng-client-2.2.0.tgz +0 -0
- package/smartbit4all-ng-client-2.1.3.tgz +0 -0
|
@@ -4138,18 +4138,28 @@ class UiActionService {
|
|
|
4138
4138
|
identifier: uiAction.identifier,
|
|
4139
4139
|
params: uiAction.params ?? {},
|
|
4140
4140
|
};
|
|
4141
|
-
if (uiAction.submit) {
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4141
|
+
if (uiAction.submit || uiAction.model) {
|
|
4142
|
+
// submit: with validation, model: without validation. both can be undefined
|
|
4143
|
+
const validate = !uiAction.model;
|
|
4144
|
+
if ('reSubscribeToChange' in this.uiActionModel.serviceToUse) {
|
|
4145
|
+
if (!validate) {
|
|
4146
|
+
console.error(`Validate = false, but UseUiAction doesn't support it`);
|
|
4147
|
+
}
|
|
4148
|
+
this.uiActionModel.serviceToUse.submit.next();
|
|
4149
|
+
try {
|
|
4150
|
+
await this.uiActionModel.serviceToUse.submit.toPromise();
|
|
4151
|
+
this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
|
|
4152
|
+
this.uiActionModel.serviceToUse.reSubscribeToChange.next();
|
|
4153
|
+
}
|
|
4154
|
+
catch (error) {
|
|
4155
|
+
console.error(error);
|
|
4156
|
+
this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
|
|
4157
|
+
this.uiActionModel.serviceToUse.reSubscribeToChange.next();
|
|
4158
|
+
return;
|
|
4159
|
+
}
|
|
4160
|
+
}
|
|
4161
|
+
else {
|
|
4162
|
+
this.uiActionModel.serviceToUse.submitForm(validate);
|
|
4153
4163
|
}
|
|
4154
4164
|
}
|
|
4155
4165
|
if (uiAction.confirm) {
|
|
@@ -5882,14 +5892,31 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
5882
5892
|
this.pageName = pageName;
|
|
5883
5893
|
this._destroy$ = new Subject();
|
|
5884
5894
|
this.sendDataChanges = false;
|
|
5885
|
-
|
|
5886
|
-
|
|
5895
|
+
// private _useAutoSubmit: boolean = false;
|
|
5896
|
+
// private _useAutoSubmitTurnedOff: Subject<void> = new SmartSubject(this._destroy$);
|
|
5897
|
+
// protected get useAutoSubmit(): boolean {
|
|
5898
|
+
// return this._useAutoSubmit;
|
|
5899
|
+
// }
|
|
5900
|
+
// protected set useAutoSubmit(useAutoSubmit: boolean) {
|
|
5901
|
+
// this._useAutoSubmit = useAutoSubmit;
|
|
5902
|
+
// if (this._useAutoSubmit) {
|
|
5903
|
+
// this.subscribeToAutoSubmit();
|
|
5904
|
+
// this.reSubscribeToChange.pipe(takeUntil(this._useAutoSubmitTurnedOff)).subscribe(() => {
|
|
5905
|
+
// this.subscribeToAutoSubmit();
|
|
5906
|
+
// });
|
|
5907
|
+
// } else {
|
|
5908
|
+
// this._useAutoSubmitTurnedOff.next();
|
|
5909
|
+
// }
|
|
5910
|
+
// }
|
|
5911
|
+
// private subscribeToAutoSubmit(): void {
|
|
5912
|
+
// this.submit.pipe(takeUntil(this._useAutoSubmitTurnedOff)).subscribe(() => {
|
|
5913
|
+
// this.submitForms();
|
|
5914
|
+
// this.submit.complete();
|
|
5915
|
+
// });
|
|
5916
|
+
// }
|
|
5887
5917
|
this.detectChange = new SmartSubject(this._destroy$);
|
|
5888
5918
|
this.uiActionModels = [];
|
|
5889
5919
|
this.dataChanged = new SmartSubject(this._destroy$);
|
|
5890
|
-
// UseUiAction
|
|
5891
|
-
this.submit = new SmartSubject(this._destroy$);
|
|
5892
|
-
this.reSubscribeToChange = new SmartSubject(this._destroy$);
|
|
5893
5920
|
// Contained Widgets
|
|
5894
5921
|
this.widgets = new WidgetMap();
|
|
5895
5922
|
this.formWidgets = new WidgetMap();
|
|
@@ -5900,27 +5927,6 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
5900
5927
|
this.uiActionService = inject.get(UiActionService);
|
|
5901
5928
|
this.uiActionDescriptorService = inject.get(UiActionDescriptorService);
|
|
5902
5929
|
}
|
|
5903
|
-
get useAutoSubmit() {
|
|
5904
|
-
return this._useAutoSubmit;
|
|
5905
|
-
}
|
|
5906
|
-
set useAutoSubmit(useAutoSubmit) {
|
|
5907
|
-
this._useAutoSubmit = useAutoSubmit;
|
|
5908
|
-
if (this._useAutoSubmit) {
|
|
5909
|
-
this.subscribeToAutoSubmit();
|
|
5910
|
-
this.reSubscribeToChange.pipe(takeUntil(this._useAutoSubmitTurnedOff)).subscribe(() => {
|
|
5911
|
-
this.subscribeToAutoSubmit();
|
|
5912
|
-
});
|
|
5913
|
-
}
|
|
5914
|
-
else {
|
|
5915
|
-
this._useAutoSubmitTurnedOff.next();
|
|
5916
|
-
}
|
|
5917
|
-
}
|
|
5918
|
-
subscribeToAutoSubmit() {
|
|
5919
|
-
this.submit.pipe(takeUntil(this._useAutoSubmitTurnedOff)).subscribe(() => {
|
|
5920
|
-
this.submitForms();
|
|
5921
|
-
this.submit.complete();
|
|
5922
|
-
});
|
|
5923
|
-
}
|
|
5924
5930
|
get uuid() {
|
|
5925
5931
|
return this._uuid;
|
|
5926
5932
|
}
|
|
@@ -6029,6 +6035,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
6029
6035
|
getModel() {
|
|
6030
6036
|
return this.data;
|
|
6031
6037
|
}
|
|
6038
|
+
submitForm(validate) {
|
|
6039
|
+
this.submitForms(validate);
|
|
6040
|
+
}
|
|
6032
6041
|
async performUiActionRequest(uiActionRequest, widgetId, nodeId) {
|
|
6033
6042
|
if (uiActionRequest.params['_files']) {
|
|
6034
6043
|
const param = uiActionRequest.params['param'];
|
|
@@ -6061,9 +6070,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
6061
6070
|
/**
|
|
6062
6071
|
* Submits all the registered forms in the SmartComponent
|
|
6063
6072
|
*/
|
|
6064
|
-
submitForms() {
|
|
6073
|
+
submitForms(validate) {
|
|
6065
6074
|
Object.keys(this.formWidgets.widgets).map((key) => {
|
|
6066
|
-
this.formWidgets.widgets.get(key)?.submitForm();
|
|
6075
|
+
this.formWidgets.widgets.get(key)?.submitForm(validate);
|
|
6067
6076
|
});
|
|
6068
6077
|
}
|
|
6069
6078
|
addGrid(smartGrid, options, useAsDefaultGrid, componentReference) {
|