@eintrek/erp-shell 0.1.57 → 0.1.58
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/README.md +10 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +129 -83
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +129 -82
- package/dist/index.js.map +1 -1
- package/dist/navigation/navigation-data-helpers.d.ts +44 -9
- package/dist/navigation/navigation-types.d.ts +6 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,15 @@ export declare function filterNavigationModulesByPermission(modules: Module[], r
|
|
|
27
27
|
* the trail and the tabs could disagree about where the user was.
|
|
28
28
|
*/
|
|
29
29
|
export declare function getActiveModule(pathname: string, modules: Module[]): string | null;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Find the active sub-module id from `pathname`: the page whose own URL — or
|
|
32
|
+
* one of whose listed `subPages` — is the path itself (below the org code,
|
|
33
|
+
* ignoring a trailing slash). A record, a create or an edit page below a page
|
|
34
|
+
* is no page of the menu, so it has no active sub-module (0.1.58); the module
|
|
35
|
+
* (`getActiveModule`) still says where it belongs.
|
|
36
|
+
*
|
|
37
|
+
* Equal URLs in two modules go to the active module's page.
|
|
38
|
+
*/
|
|
31
39
|
export declare function getActiveSubModule(pathname: string, modules: Module[]): string | null;
|
|
32
40
|
/** Prepend `code` (org code) to a relative URL so `/sales` → `/O25.../sales`.
|
|
33
41
|
* Absolute `http(s)://` URLs are left intact; optional `{code}` placeholder is replaced.
|
|
@@ -40,19 +48,37 @@ export declare function buildUrlWithCode(code: string | undefined, url: string):
|
|
|
40
48
|
* `item` is the index of the top-level row. `sub` is the index of the
|
|
41
49
|
* sub-item under it, or null when the row itself is the entry (a one-line
|
|
42
50
|
* item, or a group on its own URL with no page of its own matching).
|
|
43
|
-
* `subPage` is the index of the page inside a
|
|
51
|
+
* `subPage` is the index of the page inside a sub-item's `subPages`.
|
|
44
52
|
*/
|
|
45
53
|
export interface ActiveNavEntry {
|
|
46
54
|
item: number;
|
|
47
55
|
sub: number | null;
|
|
48
56
|
subPage: number | null;
|
|
49
57
|
}
|
|
58
|
+
/** Where the current page sits in the menu, lit or not. */
|
|
59
|
+
export interface SidebarNavState {
|
|
60
|
+
/**
|
|
61
|
+
* The entry lit for this page — only when the page is that entry's own
|
|
62
|
+
* page (its URL, or one of its `subPages`). Null on a record, a create or
|
|
63
|
+
* an edit page below a menu page.
|
|
64
|
+
*/
|
|
65
|
+
active: ActiveNavEntry | null;
|
|
66
|
+
/**
|
|
67
|
+
* The group (and sub-item) holding the page: the lit entry's, or else the
|
|
68
|
+
* one with the deepest URL the path sits below. It opens so the user sees
|
|
69
|
+
* where they are, with nothing in it lit.
|
|
70
|
+
*/
|
|
71
|
+
open: {
|
|
72
|
+
item: number;
|
|
73
|
+
sub: number | null;
|
|
74
|
+
} | null;
|
|
75
|
+
}
|
|
50
76
|
export interface ResolveActiveNavOptions {
|
|
51
77
|
/** Org code the relative URLs are prefixed with. */
|
|
52
78
|
code?: string;
|
|
53
79
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
80
|
+
* Kept for callers. Since 0.1.58 every chrome treats "/O1/x/" and "/O1/x"
|
|
81
|
+
* as the same page; this no longer changes anything.
|
|
56
82
|
*/
|
|
57
83
|
workspace?: boolean;
|
|
58
84
|
/** See NavMain: a one-line item is lit by `item.isActive` alone. */
|
|
@@ -61,13 +87,22 @@ export interface ResolveActiveNavOptions {
|
|
|
61
87
|
/** "/O1/" and "/O1" are the same page; a query string never is. */
|
|
62
88
|
export declare function samePage(pathname: string, url: string): boolean;
|
|
63
89
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
90
|
+
* Where `pathname` sits in the sidebar: the entry to light and the group to
|
|
91
|
+
* open.
|
|
92
|
+
*
|
|
93
|
+
* Lit (0.1.58): only the entry whose own page this is — its URL or one of its
|
|
94
|
+
* `subPages`, exactly. A record, a create or an edit page below a menu page
|
|
95
|
+
* (Plannex /project/detail/<id>/schedule under "โครงการ" /project) lights
|
|
96
|
+
* nothing; an app lists such a page in `subPages` when it should keep its
|
|
97
|
+
* entry lit. At most one entry across every group (0.1.57).
|
|
98
|
+
*
|
|
99
|
+
* Open: the lit entry's group, or else the group with the deepest URL the
|
|
100
|
+
* path sits below.
|
|
68
101
|
*
|
|
69
102
|
* Equal lengths go to the group the app marks active (`item.isActive`, from
|
|
70
103
|
* its `activeModule`), then to a page over a group row, then to the first in
|
|
71
104
|
* menu order.
|
|
72
105
|
*/
|
|
73
|
-
export declare function
|
|
106
|
+
export declare function resolveSidebarNav(items: Module[], pathname: string | null | undefined, { code, highlightActiveModule }?: ResolveActiveNavOptions): SidebarNavState;
|
|
107
|
+
/** The entry lit for `pathname` — `resolveSidebarNav(...).active`. */
|
|
108
|
+
export declare function resolveActiveNav(items: Module[], pathname: string | null | undefined, options?: ResolveActiveNavOptions): ActiveNavEntry | null;
|
|
@@ -38,6 +38,12 @@ export interface SubModule {
|
|
|
38
38
|
isActive?: boolean;
|
|
39
39
|
icon?: IconType;
|
|
40
40
|
isCollapsible?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Pages that are this item's own: the sidebar lights the item on any of
|
|
43
|
+
* them, exactly as on its URL (0.1.58 lights nothing on other pages below
|
|
44
|
+
* it). A collapsible item also draws them as its children. Each needs a
|
|
45
|
+
* `permissionRouteKey` the user holds — the filter drops one without.
|
|
46
|
+
*/
|
|
41
47
|
subPages?: SubPage[];
|
|
42
48
|
permissionRouteKey?: string;
|
|
43
49
|
/**
|
package/dist/version.d.ts
CHANGED