@exmg/exm-navigation 1.1.21 → 1.1.23

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 CHANGED
@@ -59,7 +59,9 @@ Some of the components used in the navigation c an be used separately. Please ch
59
59
  interface MenuItem {
60
60
  id: string;
61
61
  label: string;
62
+ type?: 'separator' | 'default';
62
63
  path?: string;
64
+ additionalPath?: Regexp;
63
65
  url?: string;
64
66
  icon?: string;
65
67
  items?: MenuItem[];
@@ -84,7 +84,11 @@ export class ExmNavigationBase extends MediaQueries(ExmgElement) {
84
84
  finished = true;
85
85
  break;
86
86
  }
87
- if ((item.items || []).length > 0) {
87
+ if (item.additionalPath && item.additionalPath.test(window.location.pathname)) {
88
+ finished = true;
89
+ break;
90
+ }
91
+ if (item.items && (item.items || []).length > 0) {
88
92
  checkItems(item.items, depth + 1);
89
93
  }
90
94
  }
@@ -5,6 +5,7 @@ import { property } from 'lit/decorators.js';
5
5
  import { repeat } from 'lit/directives/repeat.js';
6
6
  import { style } from './styles/exm-navigation-rail-css.js';
7
7
  import './exm-navigation-rail-nav-item.js';
8
+ import { classMap } from 'lit/directives/class-map.js';
8
9
  export class ExmNavigationRailBase extends ExmgElement {
9
10
  constructor() {
10
11
  super(...arguments);
@@ -25,20 +26,26 @@ export class ExmNavigationRailBase extends ExmgElement {
25
26
  <nav class="nav">
26
27
  <ul>
27
28
  ${repeat(this.items, (item) => {
28
- return html `
29
- <li>
30
- <exm-navigation-rail-nav-item
31
- @click=${() => this.handleRailClick(item.id)}
32
- @mouseenter=${() => this.handleRailMouseEnter(item.id)}
33
- @mouseleave=${() => this.handleRailMouseLeave(item.id)}
34
- label=${item.label}
35
- icon=${item.icon || ''}
36
- ?hasSubMenu=${(item.items || []).length > 0}
37
- itemId=${item.id}
38
- .selected=${this.selected[0] === item.id}
39
- ></exm-navigation-rail-nav-item>
40
- </li>
41
- `;
29
+ if (item.type === 'separator') {
30
+ return html ` <li class="rail-separator"></li> `;
31
+ }
32
+ else {
33
+ const classes = { hidden: item.type === 'hidden' };
34
+ return html `
35
+ <li class=${classMap(classes)}>
36
+ <exm-navigation-rail-nav-item
37
+ @click=${() => this.handleRailClick(item.id)}
38
+ @mouseenter=${() => this.handleRailMouseEnter(item.id)}
39
+ @mouseleave=${() => this.handleRailMouseLeave(item.id)}
40
+ label=${item.label}
41
+ icon=${item.icon || ''}
42
+ ?hasSubMenu=${(item.items || []).length > 0}
43
+ itemId=${item.id}
44
+ .selected=${this.selected[0] === item.id}
45
+ ></exm-navigation-rail-nav-item>
46
+ </li>
47
+ `;
48
+ }
42
49
  })}
43
50
  </ul>
44
51
  </nav>
@@ -46,5 +46,14 @@ export const style = css `
46
46
  flex-grow: 1;
47
47
  justify-content: flex-end;
48
48
  }
49
+
50
+ .rail-separator {
51
+ border-bottom: 1px solid var(--md-sys-color-outline-variant);
52
+ margin: -2px 16px 14px;
53
+ }
54
+
55
+ .hidden {
56
+ display: none;
57
+ }
49
58
  `;
50
59
  //# sourceMappingURL=exm-navigation-rail-css.js.map
package/dist/types.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export interface MenuItem {
2
2
  id: string;
3
3
  label: string;
4
+ type?: 'separator' | 'default' | 'hidden';
4
5
  path?: string;
6
+ additionalPath?: RegExp;
5
7
  url?: string;
6
8
  icon?: string;
7
9
  items?: MenuItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exmg/exm-navigation",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "610e82fc637c05db52926b1f1fd6dff5e5a5d0b7"
50
+ "gitHead": "7f954ebfd386f5084e7f76a04c839de66aea3102"
51
51
  }