PageRegistration / PageMenuRegistration fixes & more simplification (#1386)

* PageRegistration & PageMenuRegistration fixes & more simplification, fix #1383

Signed-off-by: Roman <ixrock@gmail.com>

* clean up test, deprecate page.routePath

Signed-off-by: Roman <ixrock@gmail.com>

* fix: proper `isActive` state matching for page-menu-target to page considering current document location

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman authored and GitHub committed 2020-11-16 15:18:53 +02:00
1 parent 596e60a6f3
commit 13dbdac2f2
12 files changed
+147 -93

No files matched your search

+5 -3
View File
@@ -1,13 +1,15 @@
// Base class for extensions-api registries
import { action, observable } from "mobx";
import { LensExtension } from "../lens-extension";
export class BaseRegistry<T = any> {
export class BaseRegistry<T = object, I extends T = T> {
private items = observable<T>([], { deep: false });
getItems(): T[] {
return this.items.toJS();
getItems(): I[] {
return this.items.toJS() as I[];
}
add(items: T | T[], ext?: LensExtension): () => void; // allow method overloading with required "ext"
@action
add(items: T | T[]) {
const normalizedItems = (Array.isArray(items) ? items : [items])