@things-factory/meta-ui 7.0.1-alpha.1 → 7.0.1-alpha.11

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 (93) hide show
  1. package/client/actions/main.js +14 -20
  2. package/client/bootstrap.ts +13 -6
  3. package/client/component/grist/renderer/grist-renderer-meta-object-selector.js +18 -13
  4. package/client/pages/entity/config-entity.js +180 -112
  5. package/client/pages/entity/main-menu-selector.js +85 -84
  6. package/client/pages/history/history-copy-list-popup.js +33 -45
  7. package/client/pages/history/history-json-list-popup.js +38 -50
  8. package/client/pages/menu/dynamic-menu-template.js +1 -1
  9. package/client/pages/menu/dynamic-menu.js +137 -121
  10. package/client/pages/menu/export-menu-popup.js +210 -218
  11. package/client/pages/personalize/personal-column-selector.js +112 -122
  12. package/client/utils/meta-ui-util.js +0 -4
  13. package/client/utils/service-util.js +4 -4
  14. package/client/utils/terms-util.js +41 -42
  15. package/client/utils/ui-util.js +2 -5
  16. package/client/viewparts/dynamic-menu-part.js +7 -28
  17. package/dist-client/actions/main.js +6 -5
  18. package/dist-client/actions/main.js.map +1 -1
  19. package/dist-client/bootstrap.d.ts +4 -1
  20. package/dist-client/bootstrap.js +12 -6
  21. package/dist-client/bootstrap.js.map +1 -1
  22. package/dist-client/component/grist/renderer/grist-renderer-code-input.d.ts +1 -1
  23. package/dist-client/component/grist/renderer/grist-renderer-meta-code-selector.d.ts +1 -1
  24. package/dist-client/component/grist/renderer/grist-renderer-meta-object-selector.d.ts +1 -1
  25. package/dist-client/component/grist/renderer/grist-renderer-meta-object-selector.js +9 -3
  26. package/dist-client/component/grist/renderer/grist-renderer-meta-object-selector.js.map +1 -1
  27. package/dist-client/component/popup/code-input-editor-popup.d.ts +1 -1
  28. package/dist-client/component/popup/meta-object-selector-popup.d.ts +1 -1
  29. package/dist-client/component/popup/record-based-code-editor-popup.d.ts +1 -1
  30. package/dist-client/mixin/meta-basic-grist-mixin.d.ts +1 -1
  31. package/dist-client/pages/activity/meta-activity-viewer-element.d.ts +1 -1
  32. package/dist-client/pages/activity/meta-activity-writer-element.d.ts +1 -1
  33. package/dist-client/pages/button-role/button-role-detail.d.ts +1 -1
  34. package/dist-client/pages/entity/config-entity.js +131 -62
  35. package/dist-client/pages/entity/config-entity.js.map +1 -1
  36. package/dist-client/pages/entity/main-menu-selector.d.ts +1 -1
  37. package/dist-client/pages/entity/main-menu-selector.js +74 -73
  38. package/dist-client/pages/entity/main-menu-selector.js.map +1 -1
  39. package/dist-client/pages/history/history-copy-list-popup.d.ts +1 -1
  40. package/dist-client/pages/history/history-copy-list-popup.js +14 -26
  41. package/dist-client/pages/history/history-copy-list-popup.js.map +1 -1
  42. package/dist-client/pages/history/history-json-list-popup.d.ts +5 -5
  43. package/dist-client/pages/history/history-json-list-popup.js +19 -31
  44. package/dist-client/pages/history/history-json-list-popup.js.map +1 -1
  45. package/dist-client/pages/menu/dynamic-menu-setting-let.d.ts +1 -1
  46. package/dist-client/pages/menu/dynamic-menu-template.js +1 -1
  47. package/dist-client/pages/menu/dynamic-menu-template.js.map +1 -1
  48. package/dist-client/pages/menu/dynamic-menu.js +68 -48
  49. package/dist-client/pages/menu/dynamic-menu.js.map +1 -1
  50. package/dist-client/pages/menu/export-menu-popup.d.ts +5 -5
  51. package/dist-client/pages/menu/export-menu-popup.js +50 -54
  52. package/dist-client/pages/menu/export-menu-popup.js.map +1 -1
  53. package/dist-client/pages/meta-grist-element.d.ts +1 -1
  54. package/dist-client/pages/meta-grist-page.d.ts +1 -1
  55. package/dist-client/pages/personalize/personal-column-selector.d.ts +1 -1
  56. package/dist-client/pages/personalize/personal-column-selector.js +76 -84
  57. package/dist-client/pages/personalize/personal-column-selector.js.map +1 -1
  58. package/dist-client/pages/work-code/work-code-detail-popup.d.ts +1 -1
  59. package/dist-client/tsconfig.tsbuildinfo +1 -1
  60. package/dist-client/utils/meta-ui-util.js +0 -3
  61. package/dist-client/utils/meta-ui-util.js.map +1 -1
  62. package/dist-client/utils/service-util.js +4 -4
  63. package/dist-client/utils/service-util.js.map +1 -1
  64. package/dist-client/utils/terms-util.d.ts +13 -13
  65. package/dist-client/utils/terms-util.js +10 -12
  66. package/dist-client/utils/terms-util.js.map +1 -1
  67. package/dist-client/utils/ui-util.js +1 -4
  68. package/dist-client/utils/ui-util.js.map +1 -1
  69. package/dist-client/viewparts/dynamic-menu-part.d.ts +1 -1
  70. package/dist-client/viewparts/dynamic-menu-part.js +7 -26
  71. package/dist-client/viewparts/dynamic-menu-part.js.map +1 -1
  72. package/dist-server/tsconfig.tsbuildinfo +1 -1
  73. package/package.json +9 -8
  74. package/client/viewparts/dynamic-menu-landscape-styles.js +0 -149
  75. package/client/viewparts/dynamic-menu-landscape.js +0 -106
  76. package/client/viewparts/dynamic-menu-portrait-styles.js +0 -130
  77. package/client/viewparts/dynamic-menu-portrait.js +0 -90
  78. package/client/viewparts/dynamic-top-menu-bar.js +0 -148
  79. package/dist-client/viewparts/dynamic-menu-landscape-styles.d.ts +0 -1
  80. package/dist-client/viewparts/dynamic-menu-landscape-styles.js +0 -149
  81. package/dist-client/viewparts/dynamic-menu-landscape-styles.js.map +0 -1
  82. package/dist-client/viewparts/dynamic-menu-landscape.d.ts +0 -21
  83. package/dist-client/viewparts/dynamic-menu-landscape.js +0 -87
  84. package/dist-client/viewparts/dynamic-menu-landscape.js.map +0 -1
  85. package/dist-client/viewparts/dynamic-menu-portrait-styles.d.ts +0 -1
  86. package/dist-client/viewparts/dynamic-menu-portrait-styles.js +0 -130
  87. package/dist-client/viewparts/dynamic-menu-portrait-styles.js.map +0 -1
  88. package/dist-client/viewparts/dynamic-menu-portrait.d.ts +0 -13
  89. package/dist-client/viewparts/dynamic-menu-portrait.js +0 -74
  90. package/dist-client/viewparts/dynamic-menu-portrait.js.map +0 -1
  91. package/dist-client/viewparts/dynamic-top-menu-bar.d.ts +0 -27
  92. package/dist-client/viewparts/dynamic-top-menu-bar.js +0 -133
  93. package/dist-client/viewparts/dynamic-top-menu-bar.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/meta-ui",
3
- "version": "7.0.1-alpha.1",
3
+ "version": "7.0.1-alpha.11",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -30,18 +30,19 @@
30
30
  "@operato/data-grist": "^2.0.0-alpha.0",
31
31
  "@operato/i18n": "^2.0.0-alpha.0",
32
32
  "@operato/layout": "^2.0.0-alpha.0",
33
+ "@operato/menu": "^2.0.0-alpha.0",
33
34
  "@operato/popup": "^2.0.0-alpha.0",
34
35
  "@operato/shell": "^2.0.0-alpha.0",
35
36
  "@operato/styles": "^2.0.0-alpha.0",
36
37
  "@operato/time-calculator": "^2.0.0-alpha.0",
37
38
  "@operato/utils": "^2.0.0-alpha.0",
38
- "@things-factory/auth-base": "^7.0.1-alpha.1",
39
+ "@things-factory/auth-base": "^7.0.1-alpha.10",
39
40
  "@things-factory/env": "^7.0.1-alpha.0",
40
- "@things-factory/id-rule-base": "^7.0.1-alpha.1",
41
- "@things-factory/menu-base": "^7.0.1-alpha.1",
42
- "@things-factory/resource-base": "^7.0.1-alpha.1",
43
- "@things-factory/shell": "^7.0.1-alpha.1",
44
- "@things-factory/worklist": "^7.0.1-alpha.1"
41
+ "@things-factory/id-rule-base": "^7.0.1-alpha.10",
42
+ "@things-factory/menu-base": "^7.0.1-alpha.10",
43
+ "@things-factory/resource-base": "^7.0.1-alpha.10",
44
+ "@things-factory/shell": "^7.0.1-alpha.10",
45
+ "@things-factory/worklist": "^7.0.1-alpha.10"
45
46
  },
46
- "gitHead": "6cc9a9da9059f32f8c2968c57831c1d353a2ec97"
47
+ "gitHead": "c535494f8e2d0761fb672bcb7a8efe427e733129"
47
48
  }
@@ -1,149 +0,0 @@
1
- import { css } from 'lit'
2
-
3
- export const DynamicMenuLandscapeStyles = css`
4
- :host {
5
- overflow-x: auto;
6
- background-color: var(--secondary-text-color);
7
- --focus-anchor-color: #e6ffa2;
8
- }
9
-
10
- :host > div {
11
- overflow-x: auto;
12
- }
13
-
14
- :host > div > ul {
15
- display: flex;
16
- flex-direction: row;
17
- list-style: none;
18
- margin: auto;
19
- padding: 0;
20
- border: var(--border-dark-color);
21
- border-width: 0 1px;
22
- max-width: 1250px;
23
- }
24
-
25
- :host > div > ul > li {
26
- flex: 1;
27
-
28
- display: flex;
29
- flex-direction: column;
30
- }
31
- :host > div > ul > li > a {
32
- display: none;
33
- font-weight: bold;
34
- font-size: var(--fontsize-large);
35
- }
36
-
37
- ul[submenus] {
38
- flex: 1;
39
- list-style: none;
40
- overflow-y: hidden;
41
- background-color: var(--primary-color);
42
- margin: 0;
43
- padding: 0;
44
- border-left: var(--border-dark-color);
45
- }
46
-
47
- ul[submenus] li {
48
- min-width: 120px;
49
- max-width: 180px;
50
- }
51
-
52
- a {
53
- display: block;
54
- padding: var(--padding-default) var(--padding-default) var(--padding-narrow) var(--padding-wide);
55
- text-decoration: none;
56
- font: normal 14px var(--theme-font);
57
- color: var(--theme-white-color);
58
- text-transform: capitalize;
59
-
60
- overflow: hidden;
61
- white-space: nowrap;
62
- text-overflow: ellipsis;
63
- }
64
-
65
- a:hover {
66
- font-weight: bold;
67
- }
68
-
69
- ul[submenus] a::before {
70
- content: '';
71
- display: inline-block;
72
- position: relative;
73
- top: -1px;
74
- width: 5px;
75
- height: 5px;
76
- border: 1px solid var(--theme-white-color);
77
- border-radius: 50%;
78
- background-color: transparent;
79
- margin-right: 3px;
80
- }
81
- ul[submenus] a:hover,
82
- ul[submenus] li[active] a {
83
- background-color: rgba(var(--secondary-color-rgb), 0.3);
84
- color: var(--focus-anchor-color);
85
- font-weight: bold;
86
- }
87
-
88
- [description] {
89
- background-color: var(--primary-color);
90
- margin: 0;
91
- padding: var(--padding-default) 0;
92
- border-left: 1px solid rgba(0, 0, 0, 0.1);
93
- color: var(--focus-anchor-color);
94
- font-size: 11px;
95
- }
96
- [description] mwc-icon {
97
- background-color: rgba(0, 0, 0, 0.15);
98
- margin-right: 4px;
99
- padding: var(--padding-narrow);
100
- border-radius: 0 5px 5px 0;
101
- float: left;
102
- font-size: 26px;
103
- }
104
-
105
- @media only screen and (max-width: 460px) {
106
- :host {
107
- min-width: 100vw;
108
- }
109
- :host > div {
110
- display: initial;
111
- }
112
- :host > div > ul {
113
- flex-direction: column;
114
- }
115
- a {
116
- padding: var(--padding-wide);
117
- font: normal 15px var(--theme-font);
118
- }
119
- li[active] ul {
120
- border-bottom: 2px solid rgba(0, 0, 0, 0.1);
121
- }
122
- li li a {
123
- display: block;
124
- padding: var(--padding-wide) var(--padding-default) var(--padding-wide) 35px;
125
- overflow: hidden;
126
- text-overflow: ellipsis;
127
- white-space: nowrap;
128
- font: normal 14px var(--theme-font);
129
- }
130
- li li[active] a {
131
- font: bold 14px var(--theme-font);
132
- }
133
- :host > div > ul > li > a {
134
- display: block;
135
- }
136
- :host > div > ul > li > a mwc-icon {
137
- font-size: 1em;
138
- position: relative;
139
- top: 2px;
140
- }
141
- [description] {
142
- display: none;
143
- }
144
- ul[submenus] a:hover,
145
- ul[submenus] li[active] a {
146
- background-color: rgba(var(--secondary-color-rgb), 0.3);
147
- }
148
- }
149
- `
@@ -1,106 +0,0 @@
1
- import '@material/mwc-icon'
2
-
3
- import { html, LitElement } from 'lit'
4
- import { connect } from 'pwa-helpers'
5
-
6
- import { navigate, store } from '@operato/shell'
7
- import { ScrollbarStyles } from '@operato/styles'
8
-
9
- import { DynamicMenuLandscapeStyles } from './dynamic-menu-landscape-styles'
10
-
11
- export class DynamicMenuLandscape extends connect(store)(LitElement) {
12
- static get styles() {
13
- return [ScrollbarStyles, DynamicMenuLandscapeStyles]
14
- }
15
-
16
- static get properties() {
17
- return {
18
- menus: Array,
19
- activeTopLevel: Object,
20
- activeMenu: Object,
21
- path: String
22
- }
23
- }
24
-
25
- render() {
26
- const { menus = [], activeTopLevel, activeMenu } = this
27
-
28
- return html`
29
- <div id="wrap">
30
- <ul>
31
- ${menus.map(menu =>
32
- menu.type == 'group'
33
- ? html``
34
- : html`
35
- <li ?active=${menu === activeTopLevel}>
36
- <a href=${menu.path || '#'}>
37
- ${menu.icon ? html`<mwc-icon>${menu.icon}</mwc-icon>` : html``} ${menu.name}
38
- </a>
39
-
40
- <ul submenus>
41
- ${menu.menus?.map(
42
- menu => html`
43
- <li ?active=${menu === activeMenu}>
44
- <a href=${menu.path || '#'}> ${menu.name} </a>
45
- </li>
46
- `
47
- )}
48
- </ul>
49
-
50
- <div description>
51
- ${menu.icon ? html`<mwc-icon>${menu.icon}</mwc-icon>` : html``} ${menu.description || ''}
52
- </div>
53
- </li>
54
- `
55
- )}
56
- </ul>
57
- </div>
58
- `
59
- }
60
-
61
- firstUpdated() {
62
- const wrap = this.renderRoot.querySelector('#wrap')
63
- wrap.addEventListener('mousewheel', this.onWheelEvent.bind(this), false)
64
-
65
- this.renderRoot.addEventListener('click', e => {
66
- if (e.target.submenu) {
67
- /* protect to act move to href. */
68
- e.stopPropagation()
69
- e.preventDefault()
70
-
71
- let menu = e.target.submenu
72
-
73
- this.dispatchEvent(
74
- new CustomEvent('active-toplevel', {
75
- bubbles: true,
76
- detail: this.activeTopLevel === menu ? undefined : menu
77
- })
78
- )
79
-
80
- return
81
- }
82
-
83
- /* to respond even if current acting menu is selected */
84
- let href = e.target.href
85
- href && location.href === href && navigate(href + '#force', true)
86
- })
87
-
88
- /* to hide scrollbar during transition */
89
- this.renderRoot.addEventListener('transitionstart', e => {
90
- e.target.removeAttribute('settled')
91
- })
92
- this.renderRoot.addEventListener('transitionend', e => {
93
- e.target.setAttribute('settled', '')
94
- })
95
- }
96
-
97
- onWheelEvent(e) {
98
- const wrap = e.currentTarget
99
- var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))
100
- wrap.scrollLeft -= delta * 10
101
-
102
- e.preventDefault()
103
- }
104
- }
105
-
106
- customElements.define('dynamic-menu-landscape', DynamicMenuLandscape)
@@ -1,130 +0,0 @@
1
- import { css } from 'lit'
2
-
3
- export const DynamicMenuPortraitStyles = css`
4
- :host {
5
- display: flex;
6
- overflow-y: auto;
7
- flex-direction: column;
8
- height: 100%;
9
- }
10
-
11
- :host > ul {
12
- margin-block-end: 1.5em;
13
- }
14
-
15
- ul {
16
- list-style: none;
17
- margin: 0;
18
- padding: 0;
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
- a {
28
- display: flex;
29
- align-items: center;
30
- border-bottom: 1px solid rgba(0, 0, 0, 0.07);
31
- padding: var(--padding-default) var(--padding-default) var(--padding-default) var(--padding-wide);
32
- text-decoration: none;
33
- font: normal 14px var(--theme-font);
34
- color: var(--secondary-color);
35
- text-transform: capitalize;
36
-
37
- overflow: hidden;
38
- white-space: nowrap;
39
- text-overflow: ellipsis;
40
- }
41
- a:hover {
42
- color: var(--primary-color);
43
- font-weight: bold;
44
- }
45
- a * {
46
- vertical-align: middle;
47
- }
48
- a mwc-icon {
49
- margin-top: -3px;
50
- margin-right: var(--margin-narrow);
51
- font-size: 15px;
52
- color: rgba(var(--secondary-color-rgb), 0.7);
53
- }
54
- a [submenu-button] {
55
- float: left;
56
- margin: -5px 0 0 -8px;
57
- font-size: 25px;
58
- max-height: 20px;
59
- }
60
- a [submenu-button]::before {
61
- content: 'arrow_right';
62
- }
63
- li[active] > a [submenu-button]::before {
64
- content: 'arrow_drop_down';
65
- }
66
- li[active] > a {
67
- border-left: 3px solid var(--primary-color);
68
- font-weight: bold;
69
- color: var(--primary-color);
70
- }
71
- li li a {
72
- padding: 7px 0 7px 35px;
73
- font: normal 13px var(--theme-font);
74
- color: var(--secondary-color);
75
- }
76
- li li[active] a {
77
- background-color: rgba(var(--primary-color-rgb), 0.15);
78
- font: bold 13px var(--theme-font);
79
- color: var(--primary-color);
80
- }
81
- li > ul {
82
- overflow-y: hidden;
83
- max-height: 0;
84
- background-color: #f6f6f6;
85
-
86
- transition-property: all;
87
- transition-duration: 0.7s;
88
- }
89
- li[active] > ul {
90
- max-height: 500px;
91
- }
92
- li[active] > ul[settled] {
93
- overflow-y: auto;
94
- }
95
- li li a::before {
96
- margin-right: var(--margin-narrow);
97
- }
98
-
99
- a [badge] {
100
- margin-left: auto;
101
- background-color: var(--primary-background-color);
102
- color: white;
103
- border-radius: 999em;
104
- padding: 0px 6px;
105
- }
106
-
107
- @media only screen and (max-width: 460px) {
108
- :host {
109
- min-width: 100vw;
110
- }
111
- a {
112
- padding: var(--padding-wide);
113
- font: normal 15px var(--theme-font);
114
- }
115
- li[active] ul {
116
- border-bottom: 2px solid rgba(0, 0, 0, 0.1);
117
- }
118
- li li a {
119
- display: block;
120
- padding: var(--padding-wide) var(--padding-default) var(--padding-wide) 35px;
121
- overflow: hidden;
122
- text-overflow: ellipsis;
123
- white-space: nowrap;
124
- font: normal 14px var(--theme-font);
125
- }
126
- li li[active] a {
127
- font: bold 14px var(--theme-font);
128
- }
129
- }
130
- `
@@ -1,90 +0,0 @@
1
- import '@material/mwc-icon'
2
-
3
- import { html, LitElement } from 'lit'
4
-
5
- import { navigate } from '@operato/shell'
6
- import { ScrollbarStyles } from '@operato/styles'
7
-
8
- import { DynamicMenuPortraitStyles } from './dynamic-menu-portrait-styles'
9
-
10
- export class DynamicMenuPortrait extends LitElement {
11
- static get styles() {
12
- return [ScrollbarStyles, DynamicMenuPortraitStyles]
13
- }
14
-
15
- static get properties() {
16
- return {
17
- menus: Array,
18
- activeTopLevel: Object,
19
- activeMenu: Object,
20
- path: String
21
- }
22
- }
23
-
24
- renderMenus(menus, activeTopLevel, activeMenu) {
25
- return html`
26
- <ul>
27
- ${menus.map(menu => {
28
- var { type, active, path, name, badge, icon, menus } = menu
29
- active = active && typeof active === 'function' ? active.call(menu, { path: this.path }) : false
30
- badge = typeof badge === 'function' ? badge.call(menu) : badge ?? false
31
-
32
- return type == 'group'
33
- ? html`<li group-label>${name}</li>`
34
- : html`
35
- <li ?active=${activeTopLevel ? menu === activeTopLevel : active} .menu=${menu} menu>
36
- <a href=${path || '#'}>
37
- ${menus?.length > 0 ? html` <mwc-icon submenu-button></mwc-icon> ` : html``}
38
- <mwc-icon>${icon}</mwc-icon>
39
- ${name} ${badge !== false ? html`<div badge>${badge}</div>` : html``}
40
- </a>
41
- ${menus && this.renderMenus(menus, activeMenu)}
42
- </li>
43
- `
44
- })}
45
- </ul>
46
- `
47
- }
48
-
49
- render() {
50
- const { menus, activeTopLevel, activeMenu } = this
51
- return this.renderMenus(menus, activeTopLevel, activeMenu)
52
- }
53
-
54
- firstUpdated() {
55
- this.renderRoot.addEventListener('click', e => {
56
- const menuElement = e.target.closest('[menu]')
57
-
58
- if (menuElement?.menu) {
59
- let menu = menuElement.menu
60
-
61
- if (!menu.path) {
62
- /* protect to act move to href. */
63
- e.stopPropagation()
64
- e.preventDefault()
65
- }
66
-
67
- this.dispatchEvent(
68
- new CustomEvent('active-toplevel', {
69
- bubbles: true,
70
- detail: this.activeTopLevel === menu ? undefined : menu
71
- })
72
- )
73
- }
74
-
75
- /* to respond even if current acting menu is selected */
76
- let href = e.target.href
77
- href && location.href === href && navigate(href + '#force', true)
78
- })
79
-
80
- /* to hide scrollbar during transition */
81
- this.renderRoot.addEventListener('transitionstart', e => {
82
- e.target.removeAttribute('settled')
83
- })
84
- this.renderRoot.addEventListener('transitionend', e => {
85
- e.target.setAttribute('settled', '')
86
- })
87
- }
88
- }
89
-
90
- customElements.define('dynamic-menu-portrait', DynamicMenuPortrait)
@@ -1,148 +0,0 @@
1
- import '@material/mwc-icon'
2
-
3
- import { css, html, LitElement } from 'lit'
4
- import { connect } from 'pwa-helpers'
5
-
6
- import { toggleOverlay } from '@operato/layout'
7
- import { store } from '@operato/shell'
8
-
9
- export class DynamicTopMenuBar extends connect(store)(LitElement) {
10
- static get styles() {
11
- return css`
12
- :host {
13
- display: flex;
14
- flex-direction: row;
15
- }
16
-
17
- span {
18
- flex: 1;
19
- }
20
-
21
- ul {
22
- display: flex;
23
- align-items: center;
24
- list-style: none;
25
- margin: 0;
26
- padding: 0;
27
- }
28
-
29
- li {
30
- display: inline-flex;
31
- flex-direction: row nowrap;
32
- float: left;
33
- overflow: none;
34
- }
35
-
36
- a {
37
- display: inline-block;
38
- white-space: nowrap;
39
- overflow: hidden;
40
- text-overflow: ellipsis;
41
- padding: var(--padding-default) var(--padding-wide) var(--padding-narrow) var(--padding-wide);
42
- text-decoration: none;
43
- color: white;
44
- }
45
- a * {
46
- vertical-align: middle;
47
- }
48
- a mwc-icon {
49
- opacity: 0.5;
50
- position: relative;
51
- top: -2px;
52
- font-size: 1em;
53
- }
54
-
55
- li[active] a {
56
- font-weight: bold;
57
- }
58
- li[active] a mwc-icon {
59
- opacity: 1;
60
- }
61
- `
62
- }
63
-
64
- static get properties() {
65
- return {
66
- page: String,
67
- resourceId: String,
68
- menus: Array,
69
-
70
- _activeTopLevel: Object
71
- }
72
- }
73
-
74
- render() {
75
- const { menus = [], _activeTopLevel } = this
76
-
77
- return html`
78
- <slot name="head"></slot>
79
- <ul>
80
- ${menus.map(menu =>
81
- menu.type == 'group'
82
- ? html``
83
- : html`
84
- <li ?active=${menu === _activeTopLevel}>
85
- <a
86
- href="#"
87
- @click=${e => {
88
- e.preventDefault()
89
- toggleOverlay('dyamic-menu-part', {
90
- backdrop: true
91
- })
92
- }}
93
- >
94
- ${menu.name}
95
- <mwc-icon>expand_more</mwc-icon>
96
- </a>
97
- </li>
98
- `
99
- )}
100
- </ul>
101
- <slot name="tail"></slot>
102
- `
103
- }
104
-
105
- stateChanged(state) {
106
- this.page = state.route.page
107
- this.resourceId = state.route.resourceId
108
- this.menus = state.metaUI.menus || []
109
- this.slotTemplate = state.metaUI.slotTemplate
110
- }
111
-
112
- // firstUpdated() {
113
- // this.addEventListener('mousewheel', this.onWheelEvent.bind(this), false)
114
- // }
115
-
116
- updated(changes) {
117
- if (changes.has('menus') || changes.has('page') || changes.has('resourceId')) {
118
- this._findActivePage()
119
- }
120
-
121
- if (changes.has('slotTemplate')) {
122
- this.replaceChild(this.slotTemplate)
123
- }
124
- }
125
-
126
- // onWheelEvent(e) {
127
- // var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail))
128
- // this.scrollLeft -= delta * 40
129
- // console.log('delta', this.scrollLeft, delta, e.wheelDelta || -e.detail)
130
-
131
- // e.preventDefault()
132
- // }
133
-
134
- _findActivePage() {
135
- var path = this.resourceId ? `${this.page}/${this.resourceId}` : this.page
136
- var menus = this.menus || []
137
-
138
- this._activeTopLevel = menus.find(menu => {
139
- if (menu.path?.split('?')[0] === path) {
140
- return true
141
- } else if (menu.menus) {
142
- return !!menu.menus.find(menu => menu.path?.split('?')[0] === path)
143
- }
144
- })
145
- }
146
- }
147
-
148
- customElements.define('dynamic-top-menu-bar', DynamicTopMenuBar)
@@ -1 +0,0 @@
1
- export const DynamicMenuLandscapeStyles: import("lit").CSSResult;