@smartbit4all/ng-client 2.1.3 → 2.2.1
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 +37 -38
- 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 +57 -48
- package/fesm2015/smartbit4all-ng-client.mjs.map +1 -1
- package/fesm2020/smartbit4all-ng-client.mjs +58 -49
- package/fesm2020/smartbit4all-ng-client.mjs.map +1 -1
- package/lib/smart-client/smart-component-api-client.d.ts +4 -11
- 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.1.tgz +0 -0
- package/smartbit4all-ng-client-2.1.3.tgz +0 -0
|
@@ -4120,18 +4120,28 @@ class UiActionService {
|
|
|
4120
4120
|
identifier: uiAction.identifier,
|
|
4121
4121
|
params: (_a = uiAction.params) !== null && _a !== void 0 ? _a : {},
|
|
4122
4122
|
};
|
|
4123
|
-
if (uiAction.submit) {
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4123
|
+
if (uiAction.submit || uiAction.model) {
|
|
4124
|
+
// submit: with validation, model: without validation. both can be undefined
|
|
4125
|
+
const validate = !uiAction.model;
|
|
4126
|
+
if ('reSubscribeToChange' in this.uiActionModel.serviceToUse) {
|
|
4127
|
+
if (!validate) {
|
|
4128
|
+
console.error(`Validate = false, but UseUiAction doesn't support it`);
|
|
4129
|
+
}
|
|
4130
|
+
this.uiActionModel.serviceToUse.submit.next();
|
|
4131
|
+
try {
|
|
4132
|
+
yield this.uiActionModel.serviceToUse.submit.toPromise();
|
|
4133
|
+
this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
|
|
4134
|
+
this.uiActionModel.serviceToUse.reSubscribeToChange.next();
|
|
4135
|
+
}
|
|
4136
|
+
catch (error) {
|
|
4137
|
+
console.error(error);
|
|
4138
|
+
this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
|
|
4139
|
+
this.uiActionModel.serviceToUse.reSubscribeToChange.next();
|
|
4140
|
+
return;
|
|
4141
|
+
}
|
|
4129
4142
|
}
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
|
|
4133
|
-
this.uiActionModel.serviceToUse.reSubscribeToChange.next();
|
|
4134
|
-
return;
|
|
4143
|
+
else {
|
|
4144
|
+
this.uiActionModel.serviceToUse.submitForm(validate);
|
|
4135
4145
|
}
|
|
4136
4146
|
}
|
|
4137
4147
|
if (uiAction.confirm) {
|
|
@@ -5911,15 +5921,32 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
5911
5921
|
this.auth = auth;
|
|
5912
5922
|
this.pageName = pageName;
|
|
5913
5923
|
this._destroy$ = new Subject();
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5924
|
+
// protected sendDataChanges: boolean = false;
|
|
5925
|
+
// private _useAutoSubmit: boolean = false;
|
|
5926
|
+
// private _useAutoSubmitTurnedOff: Subject<void> = new SmartSubject(this._destroy$);
|
|
5927
|
+
// protected get useAutoSubmit(): boolean {
|
|
5928
|
+
// return this._useAutoSubmit;
|
|
5929
|
+
// }
|
|
5930
|
+
// protected set useAutoSubmit(useAutoSubmit: boolean) {
|
|
5931
|
+
// this._useAutoSubmit = useAutoSubmit;
|
|
5932
|
+
// if (this._useAutoSubmit) {
|
|
5933
|
+
// this.subscribeToAutoSubmit();
|
|
5934
|
+
// this.reSubscribeToChange.pipe(takeUntil(this._useAutoSubmitTurnedOff)).subscribe(() => {
|
|
5935
|
+
// this.subscribeToAutoSubmit();
|
|
5936
|
+
// });
|
|
5937
|
+
// } else {
|
|
5938
|
+
// this._useAutoSubmitTurnedOff.next();
|
|
5939
|
+
// }
|
|
5940
|
+
// }
|
|
5941
|
+
// private subscribeToAutoSubmit(): void {
|
|
5942
|
+
// this.submit.pipe(takeUntil(this._useAutoSubmitTurnedOff)).subscribe(() => {
|
|
5943
|
+
// this.submitForms();
|
|
5944
|
+
// this.submit.complete();
|
|
5945
|
+
// });
|
|
5946
|
+
// }
|
|
5917
5947
|
this.detectChange = new SmartSubject(this._destroy$);
|
|
5918
5948
|
this.uiActionModels = [];
|
|
5919
5949
|
this.dataChanged = new SmartSubject(this._destroy$);
|
|
5920
|
-
// UseUiAction
|
|
5921
|
-
this.submit = new SmartSubject(this._destroy$);
|
|
5922
|
-
this.reSubscribeToChange = new SmartSubject(this._destroy$);
|
|
5923
5950
|
// Contained Widgets
|
|
5924
5951
|
this.widgets = new WidgetMap();
|
|
5925
5952
|
this.formWidgets = new WidgetMap();
|
|
@@ -5930,27 +5957,6 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
5930
5957
|
this.uiActionService = inject.get(UiActionService);
|
|
5931
5958
|
this.uiActionDescriptorService = inject.get(UiActionDescriptorService);
|
|
5932
5959
|
}
|
|
5933
|
-
get useAutoSubmit() {
|
|
5934
|
-
return this._useAutoSubmit;
|
|
5935
|
-
}
|
|
5936
|
-
set useAutoSubmit(useAutoSubmit) {
|
|
5937
|
-
this._useAutoSubmit = useAutoSubmit;
|
|
5938
|
-
if (this._useAutoSubmit) {
|
|
5939
|
-
this.subscribeToAutoSubmit();
|
|
5940
|
-
this.reSubscribeToChange.pipe(takeUntil(this._useAutoSubmitTurnedOff)).subscribe(() => {
|
|
5941
|
-
this.subscribeToAutoSubmit();
|
|
5942
|
-
});
|
|
5943
|
-
}
|
|
5944
|
-
else {
|
|
5945
|
-
this._useAutoSubmitTurnedOff.next();
|
|
5946
|
-
}
|
|
5947
|
-
}
|
|
5948
|
-
subscribeToAutoSubmit() {
|
|
5949
|
-
this.submit.pipe(takeUntil(this._useAutoSubmitTurnedOff)).subscribe(() => {
|
|
5950
|
-
this.submitForms();
|
|
5951
|
-
this.submit.complete();
|
|
5952
|
-
});
|
|
5953
|
-
}
|
|
5954
5960
|
get uuid() {
|
|
5955
5961
|
return this._uuid;
|
|
5956
5962
|
}
|
|
@@ -6063,6 +6069,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
6063
6069
|
getModel() {
|
|
6064
6070
|
return this.data;
|
|
6065
6071
|
}
|
|
6072
|
+
submitForm(validate) {
|
|
6073
|
+
this.submitForms(validate);
|
|
6074
|
+
}
|
|
6066
6075
|
performUiActionRequest(uiActionRequest, widgetId, nodeId) {
|
|
6067
6076
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6068
6077
|
if (uiActionRequest.params['_files']) {
|
|
@@ -6097,10 +6106,10 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
6097
6106
|
/**
|
|
6098
6107
|
* Submits all the registered forms in the SmartComponent
|
|
6099
6108
|
*/
|
|
6100
|
-
submitForms() {
|
|
6109
|
+
submitForms(validate) {
|
|
6101
6110
|
Object.keys(this.formWidgets.widgets).map((key) => {
|
|
6102
6111
|
var _a;
|
|
6103
|
-
(_a = this.formWidgets.widgets.get(key)) === null || _a === void 0 ? void 0 : _a.submitForm();
|
|
6112
|
+
(_a = this.formWidgets.widgets.get(key)) === null || _a === void 0 ? void 0 : _a.submitForm(validate);
|
|
6104
6113
|
});
|
|
6105
6114
|
}
|
|
6106
6115
|
addGrid(smartGrid, options, useAsDefaultGrid, componentReference) {
|
|
@@ -6118,14 +6127,14 @@ let SmartComponentApiClient = class SmartComponentApiClient {
|
|
|
6118
6127
|
}
|
|
6119
6128
|
addForm(smartFormId, smartForm, componentReference) {
|
|
6120
6129
|
this.formWidgets.addWidget(smartFormId, componentReference);
|
|
6121
|
-
if (this.sendDataChanges && componentReference) {
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
}
|
|
6130
|
+
// if (this.sendDataChanges && componentReference) {
|
|
6131
|
+
// smartForm.useOnValueChangeEvent = true;
|
|
6132
|
+
// componentReference.sophisticatedValueChange
|
|
6133
|
+
// .pipe(takeUntil(this._destroy$))
|
|
6134
|
+
// .subscribe((valueChange: SophisticatedValueChange) => {
|
|
6135
|
+
// this.handleValueChanges(valueChange);
|
|
6136
|
+
// });
|
|
6137
|
+
// }
|
|
6129
6138
|
return smartForm;
|
|
6130
6139
|
}
|
|
6131
6140
|
setUpDefaultTree(treeId) {
|