mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-3757] returning focus to element from which they were opened (#2837)
* ACS-3757 Return focus to More Actions button after closing modals opened from that button * ACS-3757 Return focus to specific row from personal files after closing modal opened from context menu from row * ACS-3757 Fixed issue that sometimes node was undefined * ACS-3757 Return focus after closing upload new version modal * ACS-3757 Added restore focus on list of libraries, restoring focus to correct row when multi rows are selected, little refactoring * ACS-3757 Use runActionById function instead of runAction * ACS-3757 Fixed unit tests * ACS-3757 Updated description * ACS-3757 Adrressing comments for static and for selectors in jsons * ACS-3757 Remove boolean flag from jsons * ACS-3757 Added some unit tests * ACS-3757 Resolved conflicts * ACS-3757 Created ModalConfiguration interface * ACS-3757 Increase version of ADF * ACS-3757 Fix for e2e * ACS-3757 Fix some more e2e * ACS-3757 Removed log
This commit is contained in:
@@ -53,7 +53,9 @@ export class ToolbarButtonComponent {
|
||||
|
||||
runAction() {
|
||||
if (this.hasClickAction(this.actionRef)) {
|
||||
this.extensions.runActionById(this.actionRef.actions.click);
|
||||
this.extensions.runActionById(this.actionRef.actions.click, {
|
||||
focusedElementOnCloseSelector: `#${this.actionRef.id.replace(/\./g, '\\.')}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -44,6 +44,8 @@ import { MatMenuItem } from '@angular/material/menu';
|
||||
export class ToolbarMenuItemComponent {
|
||||
@Input()
|
||||
actionRef: ContentActionRef;
|
||||
@Input()
|
||||
menuId?: string;
|
||||
|
||||
@ViewChild(MatMenuItem)
|
||||
menuItem: MatMenuItem;
|
||||
@@ -52,7 +54,14 @@ export class ToolbarMenuItemComponent {
|
||||
|
||||
runAction() {
|
||||
if (this.hasClickAction(this.actionRef)) {
|
||||
this.extensions.runActionById(this.actionRef.actions.click);
|
||||
this.extensions.runActionById(
|
||||
this.actionRef.actions.click,
|
||||
this.menuId
|
||||
? {
|
||||
focusedElementOnCloseSelector: `#${this.menuId.replace(/\./g, '\\.')}`
|
||||
}
|
||||
: undefined
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<adf-dynamic-component [id]="child.component" [data]="child.data"></adf-dynamic-component>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchDefault>
|
||||
<app-toolbar-menu-item [actionRef]="child"></app-toolbar-menu-item>
|
||||
<app-toolbar-menu-item [actionRef]="child" [menuId]="actionRef.id"></app-toolbar-menu-item>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
@@ -0,0 +1,3 @@
|
||||
export interface ModalConfiguration {
|
||||
focusedElementOnCloseSelector?: string;
|
||||
}
|
@@ -498,7 +498,7 @@ export class AppExtensionService implements RuleContext {
|
||||
return false;
|
||||
}
|
||||
|
||||
runActionById(id: string) {
|
||||
runActionById(id: string, additionalPayload?: { [key: string]: any }) {
|
||||
const action = this.extensions.getActionById(id);
|
||||
if (action) {
|
||||
const { type, payload } = action;
|
||||
@@ -507,9 +507,21 @@ export class AppExtensionService implements RuleContext {
|
||||
};
|
||||
const expression = this.extensions.runExpression(payload, context);
|
||||
|
||||
this.store.dispatch({ type, payload: expression });
|
||||
this.store.dispatch({
|
||||
type,
|
||||
payload:
|
||||
typeof expression === 'object'
|
||||
? {
|
||||
...expression,
|
||||
...additionalPayload
|
||||
}
|
||||
: expression
|
||||
});
|
||||
} else {
|
||||
this.store.dispatch({ type: id });
|
||||
this.store.dispatch({
|
||||
type: id,
|
||||
payload: additionalPayload
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -48,6 +48,7 @@ export * from './lib/directives/shared.directives.module';
|
||||
|
||||
export * from './lib/models/types';
|
||||
export * from './lib/models/viewer.rules';
|
||||
export * from './lib/models/modal-configuration';
|
||||
|
||||
export * from './lib/routing/shared.guard';
|
||||
|
||||
|
Reference in New Issue
Block a user