chore(prettier): full repo linting and code reformatting once and for all (#3627)
This commit is contained in:
1 parent
01500a2d4c
commit
9045ddaedc
656 files changed
+21737
-20628
No files matched your search
@@ -19,10 +19,7 @@ export default class ContextMenuController {
|
||||
services: Types.Services;
|
||||
menuItems: Menu[] | MenuItem[];
|
||||
|
||||
constructor(
|
||||
servicesManager: ServicesManager,
|
||||
commandsManager: CommandsManager
|
||||
) {
|
||||
constructor(servicesManager: ServicesManager, commandsManager: CommandsManager) {
|
||||
this.services = servicesManager.services as Obj;
|
||||
this.commandsManager = commandsManager;
|
||||
}
|
||||
@@ -74,8 +71,7 @@ export default class ContextMenuController {
|
||||
|
||||
// This naming is part of hte uiDialogService convention
|
||||
// Clicking outside simpy closes the dialog box.
|
||||
onClickOutside: () =>
|
||||
this.services.uiDialogService.dismiss({ id: 'context-menu' }),
|
||||
onClickOutside: () => this.services.uiDialogService.dismiss({ id: 'context-menu' }),
|
||||
|
||||
contentProps: {
|
||||
items,
|
||||
@@ -170,9 +166,7 @@ export default class ContextMenuController {
|
||||
};
|
||||
|
||||
static _isValidPosition = (source): boolean => {
|
||||
return (
|
||||
source && typeof source.x === 'number' && typeof source.y === 'number'
|
||||
);
|
||||
return source && typeof source.x === 'number' && typeof source.y === 'number';
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -180,10 +174,7 @@ export default class ContextMenuController {
|
||||
*/
|
||||
static _getDefaultPosition = (canvasPoints, eventDetail, viewerElement) => {
|
||||
function* getPositionIterator() {
|
||||
yield ContextMenuController._getCanvasPointsPosition(
|
||||
canvasPoints,
|
||||
viewerElement
|
||||
);
|
||||
yield ContextMenuController._getCanvasPointsPosition(canvasPoints, viewerElement);
|
||||
yield ContextMenuController._getEventDefaultPosition(eventDetail);
|
||||
yield ContextMenuController._getElementDefaultPosition(viewerElement);
|
||||
yield ContextMenuController.getDefaultPosition();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import ContextMenuItemsBuilder from "./ContextMenuItemsBuilder";
|
||||
import ContextMenuItemsBuilder from './ContextMenuItemsBuilder';
|
||||
|
||||
const menus = [
|
||||
{
|
||||
|
||||
@@ -31,16 +31,11 @@ export function findMenuById(menus: Menu[], menuId?: string): Menu {
|
||||
* @param {*} subProps
|
||||
* @returns
|
||||
*/
|
||||
export function findMenuDefault(
|
||||
menus: Menu[],
|
||||
subProps: Record<string, unknown>
|
||||
): Menu {
|
||||
export function findMenuDefault(menus: Menu[], subProps: Record<string, unknown>): Menu {
|
||||
if (!menus) {
|
||||
return null;
|
||||
}
|
||||
return menus.find(
|
||||
menu => !menu.selector || menu.selector(subProps.selectorProps)
|
||||
);
|
||||
return menus.find(menu => !menu.selector || menu.selector(subProps.selectorProps));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,11 +48,7 @@ export function findMenuDefault(
|
||||
* @param menuIdFilter - menu id identifier (to be considered on selection)
|
||||
* This is intended to support other types of filtering in the future.
|
||||
*/
|
||||
export function findMenu(
|
||||
menus: Menu[],
|
||||
props?: Types.IProps,
|
||||
menuIdFilter?: string
|
||||
) {
|
||||
export function findMenu(menus: Menu[], props?: Types.IProps, menuIdFilter?: string) {
|
||||
const { subMenu } = props;
|
||||
|
||||
function* findMenuIterator() {
|
||||
@@ -137,10 +128,7 @@ export function getMenuItems(
|
||||
|
||||
if (!selector || selector(selectorProps)) {
|
||||
if (delegating) {
|
||||
menuItems = [
|
||||
...menuItems,
|
||||
...getMenuItems(selectorProps, event, menus, subMenu),
|
||||
];
|
||||
menuItems = [...menuItems, ...getMenuItems(selectorProps, event, menus, subMenu)];
|
||||
} else {
|
||||
const toAdd = adaptItem(item, subProps);
|
||||
menuItems.push(toAdd);
|
||||
@@ -161,10 +149,7 @@ export function getMenuItems(
|
||||
* @returns a MenuItem that is compatible with the base ContextMenu
|
||||
* This requires having a label and set of actions to be called.
|
||||
*/
|
||||
export function adaptItem(
|
||||
item: MenuItem,
|
||||
subProps: ContextMenuProps
|
||||
): ContextMenuItem {
|
||||
export function adaptItem(item: MenuItem, subProps: ContextMenuProps): ContextMenuItem {
|
||||
const newItem: ContextMenuItem = {
|
||||
...item,
|
||||
value: subProps.selectorProps?.value,
|
||||
|
||||
Reference in new issue
Block a user