@things-factory/lite-menu 7.0.1-alpha.4 → 7.0.1-alpha.9

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.
Files changed (40) hide show
  1. package/client/actions/lite-menu.ts +4 -4
  2. package/client/bootstrap.ts +1 -4
  3. package/client/index.ts +0 -3
  4. package/client/lite-menu-setting-let.ts +1 -6
  5. package/dist-client/actions/lite-menu.d.ts +1 -1
  6. package/dist-client/actions/lite-menu.js +4 -4
  7. package/dist-client/actions/lite-menu.js.map +1 -1
  8. package/dist-client/bootstrap.js.map +1 -1
  9. package/dist-client/index.d.ts +0 -2
  10. package/dist-client/index.js +0 -2
  11. package/dist-client/index.js.map +1 -1
  12. package/dist-client/lite-menu-setting-let.js +1 -6
  13. package/dist-client/lite-menu-setting-let.js.map +1 -1
  14. package/dist-client/tsconfig.tsbuildinfo +1 -1
  15. package/dist-server/tsconfig.tsbuildinfo +1 -1
  16. package/package.json +9 -8
  17. package/client/viewparts/lite-menu-landscape-styles.ts +0 -149
  18. package/client/viewparts/lite-menu-landscape.ts +0 -104
  19. package/client/viewparts/lite-menu-part.ts +0 -129
  20. package/client/viewparts/lite-menu-portrait-styles.ts +0 -147
  21. package/client/viewparts/lite-menu-portrait.ts +0 -86
  22. package/client/viewparts/top-menu-bar.ts +0 -145
  23. package/dist-client/viewparts/lite-menu-landscape-styles.d.ts +0 -1
  24. package/dist-client/viewparts/lite-menu-landscape-styles.js +0 -149
  25. package/dist-client/viewparts/lite-menu-landscape-styles.js.map +0 -1
  26. package/dist-client/viewparts/lite-menu-landscape.d.ts +0 -20
  27. package/dist-client/viewparts/lite-menu-landscape.js +0 -103
  28. package/dist-client/viewparts/lite-menu-landscape.js.map +0 -1
  29. package/dist-client/viewparts/lite-menu-part.d.ts +0 -28
  30. package/dist-client/viewparts/lite-menu-part.js +0 -143
  31. package/dist-client/viewparts/lite-menu-part.js.map +0 -1
  32. package/dist-client/viewparts/lite-menu-portrait-styles.d.ts +0 -1
  33. package/dist-client/viewparts/lite-menu-portrait-styles.js +0 -147
  34. package/dist-client/viewparts/lite-menu-portrait-styles.js.map +0 -1
  35. package/dist-client/viewparts/lite-menu-portrait.d.ts +0 -12
  36. package/dist-client/viewparts/lite-menu-portrait.js +0 -89
  37. package/dist-client/viewparts/lite-menu-portrait.js.map +0 -1
  38. package/dist-client/viewparts/top-menu-bar.d.ts +0 -22
  39. package/dist-client/viewparts/top-menu-bar.js +0 -150
  40. package/dist-client/viewparts/top-menu-bar.js.map +0 -1
@@ -1,147 +0,0 @@
1
- import { css } from 'lit';
2
- export const LiteMenuPortraitStyles = css `
3
- :host {
4
- display: flex;
5
- overflow-y: auto;
6
- flex-direction: column;
7
- height: 100%;
8
- }
9
-
10
- :host > ul {
11
- margin-block-end: 1.5em;
12
- }
13
-
14
- ul {
15
- list-style: none;
16
- margin: 0;
17
- padding: 0;
18
- }
19
-
20
- [group-label] {
21
- padding: 25px 0 var(--padding-narrow) var(--padding-wide);
22
- border-bottom: var(--border-dark-color);
23
- font: bold 12px var(--theme-font);
24
- color: rgba(var(--primary-color-rgb), 0.9);
25
- text-transform: uppercase;
26
- }
27
-
28
- a {
29
- display: flex;
30
- align-items: center;
31
- border-bottom: 1px solid rgba(0, 0, 0, 0.07);
32
- padding: var(--padding-default) var(--padding-default) var(--padding-default) var(--padding-wide);
33
- text-decoration: none;
34
- font: normal 14px var(--theme-font);
35
- color: var(--secondary-color);
36
- text-transform: capitalize;
37
-
38
- overflow: hidden;
39
- white-space: nowrap;
40
- text-overflow: ellipsis;
41
- }
42
-
43
- a:hover {
44
- color: var(--primary-color);
45
- font-weight: bold;
46
- }
47
-
48
- a * {
49
- vertical-align: middle;
50
- }
51
-
52
- a mwc-icon {
53
- margin-right: var(--margin-narrow);
54
- font-size: 15px;
55
- color: rgba(var(--secondary-color-rgb), 0.7);
56
- }
57
-
58
- a [submenu-button] {
59
- float: left;
60
- font-size: 15px;
61
- max-height: 20px;
62
- }
63
-
64
- a [submenu-button]::before {
65
- content: 'add_box';
66
- }
67
-
68
- li[active] > a [submenu-button]::before {
69
- content: 'indeterminate_check_box';
70
- }
71
-
72
- li[active] > a {
73
- border-left: 3px solid var(--primary-color);
74
- font-weight: bold;
75
- color: var(--primary-color);
76
- }
77
-
78
- li li a {
79
- padding: 7px 0 7px 35px;
80
- font: normal 13px var(--theme-font);
81
- color: var(--secondary-color);
82
- }
83
-
84
- li li[active] a {
85
- background-color: rgba(var(--primary-color-rgb), 0.15);
86
- font: bold 13px var(--theme-font);
87
- color: var(--primary-color);
88
- }
89
-
90
- li > ul {
91
- overflow-y: hidden;
92
- max-height: 0;
93
- background-color: #f6f6f6;
94
-
95
- transition-property: all;
96
- transition-duration: 0.7s;
97
- }
98
-
99
- li[active] > ul {
100
- max-height: 500px;
101
- }
102
-
103
- li[active] > ul[settled] {
104
- overflow-y: auto;
105
- }
106
-
107
- li li a::before {
108
- margin-right: var(--margin-narrow);
109
- }
110
-
111
- a [badge] {
112
- margin-left: auto;
113
- background-color: var(--primary-background-color);
114
- color: white;
115
- border-radius: 999em;
116
- padding: 0px 6px;
117
- }
118
-
119
- @media only screen and (max-width: 460px) {
120
- :host {
121
- min-width: 100vw;
122
- }
123
-
124
- a {
125
- padding: var(--padding-wide);
126
- font: normal 15px var(--theme-font);
127
- }
128
-
129
- li[active] ul {
130
- border-bottom: 2px solid rgba(0, 0, 0, 0.1);
131
- }
132
-
133
- li li a {
134
- display: block;
135
- padding: var(--padding-wide) var(--padding-default) var(--padding-wide) 35px;
136
- overflow: hidden;
137
- text-overflow: ellipsis;
138
- white-space: nowrap;
139
- font: normal 14px var(--theme-font);
140
- }
141
-
142
- li li[active] a {
143
- font: bold 14px var(--theme-font);
144
- }
145
- }
146
- `;
147
- //# sourceMappingURL=lite-menu-portrait-styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lite-menu-portrait-styles.js","sourceRoot":"","sources":["../../client/viewparts/lite-menu-portrait-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgJxC,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport const LiteMenuPortraitStyles = css`\n :host {\n display: flex;\n overflow-y: auto;\n flex-direction: column;\n height: 100%;\n }\n\n :host > ul {\n margin-block-end: 1.5em;\n }\n\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n [group-label] {\n padding: 25px 0 var(--padding-narrow) var(--padding-wide);\n border-bottom: var(--border-dark-color);\n font: bold 12px var(--theme-font);\n color: rgba(var(--primary-color-rgb), 0.9);\n text-transform: uppercase;\n }\n\n a {\n display: flex;\n align-items: center;\n border-bottom: 1px solid rgba(0, 0, 0, 0.07);\n padding: var(--padding-default) var(--padding-default) var(--padding-default) var(--padding-wide);\n text-decoration: none;\n font: normal 14px var(--theme-font);\n color: var(--secondary-color);\n text-transform: capitalize;\n\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n\n a:hover {\n color: var(--primary-color);\n font-weight: bold;\n }\n\n a * {\n vertical-align: middle;\n }\n\n a mwc-icon {\n margin-right: var(--margin-narrow);\n font-size: 15px;\n color: rgba(var(--secondary-color-rgb), 0.7);\n }\n\n a [submenu-button] {\n float: left;\n font-size: 15px;\n max-height: 20px;\n }\n\n a [submenu-button]::before {\n content: 'add_box';\n }\n\n li[active] > a [submenu-button]::before {\n content: 'indeterminate_check_box';\n }\n\n li[active] > a {\n border-left: 3px solid var(--primary-color);\n font-weight: bold;\n color: var(--primary-color);\n }\n\n li li a {\n padding: 7px 0 7px 35px;\n font: normal 13px var(--theme-font);\n color: var(--secondary-color);\n }\n\n li li[active] a {\n background-color: rgba(var(--primary-color-rgb), 0.15);\n font: bold 13px var(--theme-font);\n color: var(--primary-color);\n }\n\n li > ul {\n overflow-y: hidden;\n max-height: 0;\n background-color: #f6f6f6;\n\n transition-property: all;\n transition-duration: 0.7s;\n }\n\n li[active] > ul {\n max-height: 500px;\n }\n\n li[active] > ul[settled] {\n overflow-y: auto;\n }\n\n li li a::before {\n margin-right: var(--margin-narrow);\n }\n\n a [badge] {\n margin-left: auto;\n background-color: var(--primary-background-color);\n color: white;\n border-radius: 999em;\n padding: 0px 6px;\n }\n\n @media only screen and (max-width: 460px) {\n :host {\n min-width: 100vw;\n }\n\n a {\n padding: var(--padding-wide);\n font: normal 15px var(--theme-font);\n }\n\n li[active] ul {\n border-bottom: 2px solid rgba(0, 0, 0, 0.1);\n }\n\n li li a {\n display: block;\n padding: var(--padding-wide) var(--padding-default) var(--padding-wide) 35px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font: normal 14px var(--theme-font);\n }\n\n li li[active] a {\n font: bold 14px var(--theme-font);\n }\n }\n`\n"]}
@@ -1,12 +0,0 @@
1
- import '@material/mwc-icon';
2
- import { LitElement } from 'lit';
3
- export declare class LiteMenuPortrait extends LitElement {
4
- static styles: import("lit").CSSResult[];
5
- menus?: any[];
6
- activeTopLevel: any;
7
- activeMenu: any;
8
- path?: string;
9
- renderMenus(menus: any, activeTopLevel: any, activeMenu?: any): import("lit").TemplateResult<1>;
10
- render(): import("lit").TemplateResult<1>;
11
- firstUpdated(): void;
12
- }
@@ -1,89 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import '@material/mwc-icon';
3
- import { html, LitElement } from 'lit';
4
- import { customElement, property } from 'lit/decorators.js';
5
- import { navigate } from '@operato/shell';
6
- import { ScrollbarStyles } from '@operato/styles';
7
- import { LiteMenuPortraitStyles } from './lite-menu-portrait-styles';
8
- let LiteMenuPortrait = class LiteMenuPortrait extends LitElement {
9
- renderMenus(menus, activeTopLevel, activeMenu) {
10
- return html `
11
- <ul>
12
- ${menus.map(menu => {
13
- var { type, active, path, name, badge, icon, menus } = menu;
14
- active = active && typeof active === 'function' ? active.call(menu, { path: this.path }) : false;
15
- badge = typeof badge === 'function' ? badge.call(menu) : badge !== null && badge !== void 0 ? badge : false;
16
- return type == 'group'
17
- ? html `<li group-label>${name}</li>`
18
- : html `
19
- <li ?active=${activeTopLevel ? menu === activeTopLevel : active} .menu=${menu} menu>
20
- <a href=${path || '#'}>
21
- ${(menus === null || menus === void 0 ? void 0 : menus.length) > 0 ? html ` <mwc-icon submenu-button></mwc-icon> ` : html ``}
22
- <mwc-icon>${icon}</mwc-icon>
23
- ${name} ${badge !== false ? html `<div badge>${badge}</div>` : html ``}
24
- </a>
25
- ${menus && this.renderMenus(menus, activeMenu)}
26
- </li>
27
- `;
28
- })}
29
- </ul>
30
- `;
31
- }
32
- render() {
33
- const { menus, activeTopLevel, activeMenu } = this;
34
- return this.renderMenus(menus, activeTopLevel, activeMenu);
35
- }
36
- firstUpdated() {
37
- this.renderRoot.addEventListener('click', (e) => {
38
- const menuElement = e.target.closest('[menu]');
39
- //@ts-ignore
40
- if (menuElement === null || menuElement === void 0 ? void 0 : menuElement.menu) {
41
- //@ts-ignore
42
- let menu = menuElement.menu;
43
- if (!menu.path) {
44
- /* protect to act move to href. */
45
- e.stopPropagation();
46
- e.preventDefault();
47
- }
48
- this.dispatchEvent(new CustomEvent('active-toplevel', {
49
- bubbles: true,
50
- detail: this.activeTopLevel === menu ? undefined : menu
51
- }));
52
- }
53
- /* to respond even if current acting menu is selected */
54
- let href = e.target.href;
55
- href && location.href === href && navigate(href + '#force', true);
56
- });
57
- /* to hide scrollbar during transition */
58
- this.renderRoot.addEventListener('transitionstart', e => {
59
- ;
60
- e.target.removeAttribute('settled');
61
- });
62
- this.renderRoot.addEventListener('transitionend', e => {
63
- ;
64
- e.target.setAttribute('settled', '');
65
- });
66
- }
67
- };
68
- LiteMenuPortrait.styles = [ScrollbarStyles, LiteMenuPortraitStyles];
69
- __decorate([
70
- property({ type: Array }),
71
- __metadata("design:type", Array)
72
- ], LiteMenuPortrait.prototype, "menus", void 0);
73
- __decorate([
74
- property({ type: Object }),
75
- __metadata("design:type", Object)
76
- ], LiteMenuPortrait.prototype, "activeTopLevel", void 0);
77
- __decorate([
78
- property({ type: Object }),
79
- __metadata("design:type", Object)
80
- ], LiteMenuPortrait.prototype, "activeMenu", void 0);
81
- __decorate([
82
- property({ type: String }),
83
- __metadata("design:type", String)
84
- ], LiteMenuPortrait.prototype, "path", void 0);
85
- LiteMenuPortrait = __decorate([
86
- customElement('lite-menu-portrait')
87
- ], LiteMenuPortrait);
88
- export { LiteMenuPortrait };
89
- //# sourceMappingURL=lite-menu-portrait.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lite-menu-portrait.js","sourceRoot":"","sources":["../../client/viewparts/lite-menu-portrait.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAA;AAEzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAG7D,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,UAAU;IAQ9C,WAAW,CAAC,KAAK,EAAE,cAAc,EAAE,UAAW;QAC5C,OAAO,IAAI,CAAA;;UAEL,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACjB,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;YAC3D,MAAM,GAAG,MAAM,IAAI,OAAO,MAAM,KAAK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E,KAAK,EAAE,CAAC;;+CAAc;AACxC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wDAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAgB;AAC3C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAc;AAN9B,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA0E5B;SA1EY,gBAAgB","sourcesContent":["import '@material/mwc-icon'\n\nimport { html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\n\nimport { navigate } from '@operato/shell'\nimport { ScrollbarStyles } from '@operato/styles'\n\nimport { LiteMenuPortraitStyles } from './lite-menu-portrait-styles'\n\n@customElement('lite-menu-portrait')\nexport class LiteMenuPortrait extends LitElement {\n static styles = [ScrollbarStyles, LiteMenuPortraitStyles]\n\n @property({ type: Array }) menus?: any[]\n @property({ type: Object }) activeTopLevel: any\n @property({ type: Object }) activeMenu: any\n @property({ type: String }) path?: string\n\n renderMenus(menus, activeTopLevel, activeMenu?) {\n return html`\n <ul>\n ${menus.map(menu => {\n var { type, active, path, name, badge, icon, menus } = menu\n active = active && typeof active === 'function' ? active.call(menu, { path: this.path }) : false\n badge = typeof badge === 'function' ? badge.call(menu) : badge ?? false\n\n return type == 'group'\n ? html`<li group-label>${name}</li>`\n : html`\n <li ?active=${activeTopLevel ? menu === activeTopLevel : active} .menu=${menu} menu>\n <a href=${path || '#'}>\n ${menus?.length > 0 ? html` <mwc-icon submenu-button></mwc-icon> ` : html``}\n <mwc-icon>${icon}</mwc-icon>\n ${name} ${badge !== false ? html`<div badge>${badge}</div>` : html``}\n </a>\n ${menus && this.renderMenus(menus, activeMenu)}\n </li>\n `\n })}\n </ul>\n `\n }\n\n render() {\n const { menus, activeTopLevel, activeMenu } = this\n return this.renderMenus(menus, activeTopLevel, activeMenu)\n }\n\n firstUpdated() {\n this.renderRoot.addEventListener('click', (e: Event) => {\n const menuElement = (e.target as Element)!.closest('[menu]')\n\n //@ts-ignore\n if (menuElement?.menu) {\n //@ts-ignore\n let menu = menuElement.menu\n\n if (!menu.path) {\n /* protect to act move to href. */\n e.stopPropagation()\n e.preventDefault()\n }\n\n this.dispatchEvent(\n new CustomEvent('active-toplevel', {\n bubbles: true,\n detail: this.activeTopLevel === menu ? undefined : menu\n })\n )\n }\n\n /* to respond even if current acting menu is selected */\n let href = (e.target as HTMLAnchorElement)!.href\n href && location.href === href && navigate(href + '#force', true)\n })\n\n /* to hide scrollbar during transition */\n this.renderRoot.addEventListener('transitionstart', e => {\n ;(e.target as Element).removeAttribute('settled')\n })\n this.renderRoot.addEventListener('transitionend', e => {\n ;(e.target as Element).setAttribute('settled', '')\n })\n }\n}\n"]}
@@ -1,22 +0,0 @@
1
- import '@material/mwc-icon';
2
- import { LitElement } from 'lit';
3
- declare const TopMenuBar_base: (new (...args: any[]) => {
4
- _storeUnsubscribe: import("redux").Unsubscribe;
5
- connectedCallback(): void;
6
- disconnectedCallback(): void;
7
- stateChanged(_state: unknown): void;
8
- readonly isConnected: boolean;
9
- }) & typeof LitElement;
10
- export declare class TopMenuBar extends TopMenuBar_base {
11
- static styles: import("lit").CSSResult[];
12
- page?: string;
13
- resourceId?: string;
14
- menus?: any[];
15
- private slotTemplate;
16
- private _activeTopLevel;
17
- render(): import("lit").TemplateResult<1>;
18
- stateChanged(state: any): void;
19
- updated(changes: any): void;
20
- _findActivePage(): void;
21
- }
22
- export {};
@@ -1,150 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import '@material/mwc-icon';
3
- import { css, html, LitElement } from 'lit';
4
- import { customElement, property, state } from 'lit/decorators.js';
5
- import { connect } from 'pwa-helpers';
6
- import { toggleOverlay } from '@operato/layout';
7
- import { store } from '@operato/shell';
8
- let TopMenuBar = class TopMenuBar extends connect(store)(LitElement) {
9
- render() {
10
- const { menus = [], _activeTopLevel } = this;
11
- return html `
12
- <slot name="head"></slot>
13
- <ul>
14
- ${menus.map(menu => menu.type == 'group'
15
- ? html ``
16
- : html `
17
- <li ?active=${menu === _activeTopLevel}>
18
- <a
19
- href="#"
20
- @click=${e => {
21
- e.preventDefault();
22
- toggleOverlay('lite-menu-part', {
23
- backdrop: true
24
- });
25
- }}
26
- >
27
- ${menu.name}
28
- <mwc-icon>expand_more</mwc-icon>
29
- </a>
30
- </li>
31
- `)}
32
- </ul>
33
- <slot name="tail"></slot>
34
- `;
35
- }
36
- stateChanged(state) {
37
- this.page = state.route.page;
38
- this.resourceId = state.route.resourceId;
39
- this.menus = state.liteMenu.menus || [];
40
- this.slotTemplate = state.liteMenu.slotTemplate;
41
- }
42
- // firstUpdated() {
43
- // this.addEventListener('mousewheel', this.onWheelEvent.bind(this), false)
44
- // }
45
- updated(changes) {
46
- if (changes.has('menus') || changes.has('page') || changes.has('resourceId')) {
47
- this._findActivePage();
48
- }
49
- if (changes.has('slotTemplate')) {
50
- this.replaceChild(this.slotTemplate, this.renderRoot);
51
- }
52
- }
53
- // onWheelEvent(e) {
54
- // var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))
55
- // this.scrollLeft -= delta * 40
56
- // console.log('delta', this.scrollLeft, delta, e.wheelDelta || -e.detail)
57
- // e.preventDefault()
58
- // }
59
- _findActivePage() {
60
- var path = this.resourceId ? `${this.page}/${this.resourceId}` : this.page;
61
- var menus = this.menus || [];
62
- this._activeTopLevel = menus.find(menu => {
63
- var _a;
64
- if (((_a = menu.path) === null || _a === void 0 ? void 0 : _a.split('?')[0]) === path) {
65
- return true;
66
- }
67
- else if (menu.menus) {
68
- return !!menu.menus.find(menu => { var _a; return ((_a = menu.path) === null || _a === void 0 ? void 0 : _a.split('?')[0]) === path; });
69
- }
70
- });
71
- }
72
- };
73
- TopMenuBar.styles = [
74
- css `
75
- :host {
76
- display: flex;
77
- flex-direction: row;
78
- }
79
-
80
- span {
81
- flex: 1;
82
- }
83
-
84
- ul {
85
- display: flex;
86
- align-items: center;
87
- list-style: none;
88
- margin: 0;
89
- padding: 0;
90
- }
91
-
92
- li {
93
- display: inline-flex;
94
- flex-direction: row nowrap;
95
- float: left;
96
- overflow: none;
97
- }
98
-
99
- a {
100
- display: inline-block;
101
- white-space: nowrap;
102
- overflow: hidden;
103
- text-overflow: ellipsis;
104
- padding: var(--padding-default) var(--padding-wide) var(--padding-narrow) var(--padding-wide);
105
- text-decoration: none;
106
- color: white;
107
- }
108
- a * {
109
- vertical-align: middle;
110
- }
111
- a mwc-icon {
112
- opacity: 0.5;
113
- position: relative;
114
- top: -2px;
115
- font-size: 1em;
116
- }
117
-
118
- li[active] a {
119
- font-weight: bold;
120
- }
121
- li[active] a mwc-icon {
122
- opacity: 1;
123
- }
124
- `
125
- ];
126
- __decorate([
127
- property({ type: String }),
128
- __metadata("design:type", String)
129
- ], TopMenuBar.prototype, "page", void 0);
130
- __decorate([
131
- property({ type: String }),
132
- __metadata("design:type", String)
133
- ], TopMenuBar.prototype, "resourceId", void 0);
134
- __decorate([
135
- property({ type: Array }),
136
- __metadata("design:type", Array)
137
- ], TopMenuBar.prototype, "menus", void 0);
138
- __decorate([
139
- state(),
140
- __metadata("design:type", Object)
141
- ], TopMenuBar.prototype, "slotTemplate", void 0);
142
- __decorate([
143
- state(),
144
- __metadata("design:type", Object)
145
- ], TopMenuBar.prototype, "_activeTopLevel", void 0);
146
- TopMenuBar = __decorate([
147
- customElement('top-menu-bar')
148
- ], TopMenuBar);
149
- export { TopMenuBar };
150
- //# sourceMappingURL=top-menu-bar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"top-menu-bar.js","sourceRoot":"","sources":["../../client/viewparts/top-menu-bar.ts"],"names":[],"mappings":";AAAA,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAS,KAAK,EAAE,MAA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CAAc;AACzC;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CAAoB;AAC/C;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;yCAAc;AAExC;IAAC,KAAK,EAAE;;gDAA0B;AAClC;IAAC,KAAK,EAAE;;mDAA6B;AA5D1B,UAAU;IADtB,aAAa,CAAC,cAAc,CAAC;GACjB,UAAU,CAsItB;SAtIY,UAAU","sourcesContent":["import '@material/mwc-icon'\n\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { connect } from 'pwa-helpers'\n\nimport { toggleOverlay } from '@operato/layout'\nimport { store } from '@operato/shell'\n\n@customElement('top-menu-bar')\nexport class TopMenuBar extends connect(store)(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: row;\n }\n\n span {\n flex: 1;\n }\n\n ul {\n display: flex;\n align-items: center;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n\n li {\n display: inline-flex;\n flex-direction: row nowrap;\n float: left;\n overflow: none;\n }\n\n a {\n display: inline-block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: var(--padding-default) var(--padding-wide) var(--padding-narrow) var(--padding-wide);\n text-decoration: none;\n color: white;\n }\n a * {\n vertical-align: middle;\n }\n a mwc-icon {\n opacity: 0.5;\n position: relative;\n top: -2px;\n font-size: 1em;\n }\n\n li[active] a {\n font-weight: bold;\n }\n li[active] a mwc-icon {\n opacity: 1;\n }\n `\n ]\n\n @property({ type: String }) page?: string\n @property({ type: String }) resourceId?: string\n @property({ type: Array }) menus?: any[]\n\n @state() private slotTemplate: any\n @state() private _activeTopLevel: any\n\n render() {\n const { menus = [], _activeTopLevel } = this\n\n return html`\n <slot name=\"head\"></slot>\n <ul>\n ${menus.map(menu =>\n menu.type == 'group'\n ? html``\n : html`\n <li ?active=${menu === _activeTopLevel}>\n <a\n href=\"#\"\n @click=${e => {\n e.preventDefault()\n toggleOverlay('lite-menu-part', {\n backdrop: true\n })\n }}\n >\n ${menu.name}\n <mwc-icon>expand_more</mwc-icon>\n </a>\n </li>\n `\n )}\n </ul>\n <slot name=\"tail\"></slot>\n `\n }\n\n stateChanged(state) {\n this.page = state.route.page\n this.resourceId = state.route.resourceId\n this.menus = state.liteMenu.menus || []\n this.slotTemplate = state.liteMenu.slotTemplate\n }\n\n // firstUpdated() {\n // this.addEventListener('mousewheel', this.onWheelEvent.bind(this), false)\n // }\n\n updated(changes) {\n if (changes.has('menus') || changes.has('page') || changes.has('resourceId')) {\n this._findActivePage()\n }\n\n if (changes.has('slotTemplate')) {\n this.replaceChild(this.slotTemplate, this.renderRoot)\n }\n }\n\n // onWheelEvent(e) {\n // var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))\n // this.scrollLeft -= delta * 40\n // console.log('delta', this.scrollLeft, delta, e.wheelDelta || -e.detail)\n\n // e.preventDefault()\n // }\n\n _findActivePage() {\n var path = this.resourceId ? `${this.page}/${this.resourceId}` : this.page\n var menus = this.menus || []\n\n this._activeTopLevel = menus.find(menu => {\n if (menu.path?.split('?')[0] === path) {\n return true\n } else if (menu.menus) {\n return !!menu.menus.find(menu => menu.path?.split('?')[0] === path)\n }\n })\n }\n}\n"]}