UI: Blur multiple input widget on submit. Fix datasource single entity resolution.

This commit is contained in:
Igor Kulikov 2020-07-10 11:47:03 +03:00
parent 5e3572e5c6
commit da4a2d9d55
2 changed files with 11 additions and 1 deletions

View File

@ -367,6 +367,9 @@ export class MultipleInputWidgetComponent extends PageComponent implements OnIni
} }
public save(dataToSave?: MultipleInputWidgetSource) { public save(dataToSave?: MultipleInputWidgetSource) {
if (document && document.activeElement) {
(document.activeElement as HTMLElement).blur();
}
const config: RequestConfig = { const config: RequestConfig = {
ignoreLoading: !this.settings.showActionButtons ignoreLoading: !this.settings.showActionButtons
}; };

View File

@ -615,7 +615,12 @@ export function entityDataToEntityInfo(entityData: EntityData): EntityInfo {
} }
export function updateDatasourceFromEntityInfo(datasource: Datasource, entity: EntityInfo, createFilter = false) { export function updateDatasourceFromEntityInfo(datasource: Datasource, entity: EntityInfo, createFilter = false) {
datasource.entity = {}; datasource.entity = {
id: {
entityType: entity.entityType,
id: entity.id
}
};
datasource.entityId = entity.id; datasource.entityId = entity.id;
datasource.entityType = entity.entityType; datasource.entityType = entity.entityType;
if (datasource.type === DatasourceType.entity) { if (datasource.type === DatasourceType.entity) {
@ -623,6 +628,8 @@ export function updateDatasourceFromEntityInfo(datasource: Datasource, entity: E
datasource.entityLabel = entity.label; datasource.entityLabel = entity.label;
datasource.name = entity.name; datasource.name = entity.name;
datasource.entityDescription = entity.entityDescription; datasource.entityDescription = entity.entityDescription;
datasource.entity.label = entity.label;
datasource.entity.name = entity.name;
if (createFilter) { if (createFilter) {
datasource.entityFilter = { datasource.entityFilter = {
type: AliasFilterType.singleEntity, type: AliasFilterType.singleEntity,