@eintrek/erp-shell 0.1.56 → 0.1.57
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/dist/index.d.ts +1 -1
- package/dist/index.esm.js +192 -92
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +192 -91
- package/dist/index.js.map +1 -1
- package/dist/navigation/navigation-data-helpers.d.ts +45 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -18,14 +18,56 @@ export declare function filterNavigationToolsByPermission(tools: Tool[], rulesMa
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function filterNavigationModulesByPermission(modules: Module[], rulesMap: PermissionRulesMap, userChildSegments: string[]): Module[];
|
|
20
20
|
/**
|
|
21
|
-
* Find the active top-level module id from `pathname
|
|
22
|
-
*
|
|
21
|
+
* Find the active top-level module id from `pathname`: the module whose URL
|
|
22
|
+
* (or one of whose pages' URLs) is the longest prefix of the path below the
|
|
23
|
+
* org code.
|
|
24
|
+
*
|
|
25
|
+
* Before 0.1.57 this took the first module with a page URL anywhere in the
|
|
26
|
+
* path (`includes`), so "/project" claimed /project/schedule and the sidebar,
|
|
27
|
+
* the trail and the tabs could disagree about where the user was.
|
|
23
28
|
*/
|
|
24
29
|
export declare function getActiveModule(pathname: string, modules: Module[]): string | null;
|
|
25
|
-
/** Find the active sub-module id from `pathname
|
|
30
|
+
/** Find the active sub-module id from `pathname`, by the same rule. */
|
|
26
31
|
export declare function getActiveSubModule(pathname: string, modules: Module[]): string | null;
|
|
27
32
|
/** Prepend `code` (org code) to a relative URL so `/sales` → `/O25.../sales`.
|
|
28
33
|
* Absolute `http(s)://` URLs are left intact; optional `{code}` placeholder is replaced.
|
|
29
34
|
* Query/hash are preserved: `/?start=1` → `/O25...?start=1` (not `/O25.../?start=1`).
|
|
30
35
|
*/
|
|
31
36
|
export declare function buildUrlWithCode(code: string | undefined, url: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* The one entry in the sidebar that stands for the current page.
|
|
39
|
+
*
|
|
40
|
+
* `item` is the index of the top-level row. `sub` is the index of the
|
|
41
|
+
* sub-item under it, or null when the row itself is the entry (a one-line
|
|
42
|
+
* 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 collapsible sub-item.
|
|
44
|
+
*/
|
|
45
|
+
export interface ActiveNavEntry {
|
|
46
|
+
item: number;
|
|
47
|
+
sub: number | null;
|
|
48
|
+
subPage: number | null;
|
|
49
|
+
}
|
|
50
|
+
export interface ResolveActiveNavOptions {
|
|
51
|
+
/** Org code the relative URLs are prefixed with. */
|
|
52
|
+
code?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Workspace chrome: a row's own URL counts with or without a trailing
|
|
55
|
+
* slash. The brand chrome has always compared it exactly.
|
|
56
|
+
*/
|
|
57
|
+
workspace?: boolean;
|
|
58
|
+
/** See NavMain: a one-line item is lit by `item.isActive` alone. */
|
|
59
|
+
highlightActiveModule?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** "/O1/" and "/O1" are the same page; a query string never is. */
|
|
62
|
+
export declare function samePage(pathname: string, url: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Pick the single sidebar entry for `pathname`: the longest URL that covers
|
|
65
|
+
* the path, across every group. Before 0.1.57 the longest match was taken in
|
|
66
|
+
* each group separately, so /project/schedule lit both "โครงการ" (/project,
|
|
67
|
+
* under โครงการ) and "ภาพรวมแผน" (/project/schedule, under แผนงาน).
|
|
68
|
+
*
|
|
69
|
+
* Equal lengths go to the group the app marks active (`item.isActive`, from
|
|
70
|
+
* its `activeModule`), then to a page over a group row, then to the first in
|
|
71
|
+
* menu order.
|
|
72
|
+
*/
|
|
73
|
+
export declare function resolveActiveNav(items: Module[], pathname: string | null | undefined, { code, workspace, highlightActiveModule }?: ResolveActiveNavOptions): ActiveNavEntry | null;
|
package/dist/version.d.ts
CHANGED