@operato/context 2.0.0-alpha.7 → 2.0.0-alpha.71
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/CHANGELOG.md +374 -0
- package/demo/index.html +13 -2
- package/dist/src/layouts/ox-context-page-toolbar.d.ts +9 -4
- package/dist/src/layouts/ox-context-page-toolbar.js +30 -10
- package/dist/src/layouts/ox-context-page-toolbar.js.map +1 -1
- package/dist/src/layouts/ox-context-toolbar.d.ts +2 -2
- package/dist/src/layouts/ox-context-toolbar.js +98 -70
- package/dist/src/layouts/ox-context-toolbar.js.map +1 -1
- package/dist/src/styles/ox-context-toolbar-overlay-style.js +2 -2
- package/dist/src/styles/ox-context-toolbar-overlay-style.js.map +1 -1
- package/dist/src/tools/ox-page-action-context-bar.d.ts +12 -5
- package/dist/src/tools/ox-page-action-context-bar.js +74 -45
- package/dist/src/tools/ox-page-action-context-bar.js.map +1 -1
- package/dist/src/tools/ox-page-action-overlay-template.d.ts +2 -2
- package/dist/src/tools/ox-page-action-overlay-template.js +27 -21
- package/dist/src/tools/ox-page-action-overlay-template.js.map +1 -1
- package/dist/src/tools/ox-page-title-bar.d.ts +2 -2
- package/dist/src/tools/ox-page-title-bar.js +6 -8
- package/dist/src/tools/ox-page-title-bar.js.map +1 -1
- package/dist/src/tools/ox-title-bar.d.ts +2 -2
- package/dist/src/tools/ox-title-bar.js +6 -8
- package/dist/src/tools/ox-title-bar.js.map +1 -1
- package/dist/stories/ox-context-page-toolbar-select-buttons.stories.d.ts +25 -0
- package/dist/stories/ox-context-page-toolbar-select-buttons.stories.js +127 -0
- package/dist/stories/ox-context-page-toolbar-select-buttons.stories.js.map +1 -0
- package/dist/stories/ox-context-page-toolbar-select.stories.d.ts +24 -0
- package/dist/stories/ox-context-page-toolbar-select.stories.js +85 -0
- package/dist/stories/ox-context-page-toolbar-select.stories.js.map +1 -0
- package/dist/stories/ox-context-page-toolbar.stories.d.ts +24 -0
- package/dist/stories/ox-context-page-toolbar.stories.js +90 -0
- package/dist/stories/ox-context-page-toolbar.stories.js.map +1 -0
- package/dist/stories/ox-context-toolbar-complex.stories.d.ts +19 -0
- package/dist/stories/ox-context-toolbar-complex.stories.js +146 -0
- package/dist/stories/ox-context-toolbar-complex.stories.js.map +1 -0
- package/dist/stories/ox-context-toolbar-empty.stories.d.ts +19 -0
- package/dist/stories/ox-context-toolbar-empty.stories.js +48 -0
- package/dist/stories/ox-context-toolbar-empty.stories.js.map +1 -0
- package/dist/stories/ox-context-toolbar-overflow.stories.d.ts +19 -0
- package/dist/stories/ox-context-toolbar-overflow.stories.js +127 -0
- package/dist/stories/ox-context-toolbar-overflow.stories.js.map +1 -0
- package/dist/stories/ox-context-toolbar.stories.d.ts +19 -0
- package/dist/stories/ox-context-toolbar.stories.js +82 -0
- package/dist/stories/ox-context-toolbar.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -20
- package/src/layouts/ox-context-page-toolbar.ts +33 -10
- package/src/layouts/ox-context-toolbar.ts +98 -70
- package/src/styles/ox-context-toolbar-overlay-style.ts +2 -2
- package/src/tools/ox-page-action-context-bar.ts +102 -64
- package/src/tools/ox-page-action-overlay-template.ts +47 -41
- package/src/tools/ox-page-title-bar.ts +6 -8
- package/src/tools/ox-title-bar.ts +6 -8
- package/stories/ox-context-page-toolbar-select-buttons.stories.ts +141 -0
- package/stories/ox-context-page-toolbar-select.stories.ts +99 -0
- package/stories/ox-context-page-toolbar.stories.ts +104 -0
- package/stories/ox-context-toolbar-complex.stories.ts +158 -0
- package/stories/ox-context-toolbar-empty.stories.ts +61 -0
- package/stories/ox-context-toolbar-overflow.stories.ts +139 -0
- package/stories/ox-context-toolbar.stories.ts +94 -0
- package/themes/app-theme.css +145 -0
- package/themes/context-theme.css +74 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '@material/
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
2
|
|
|
3
3
|
import { css, html, LitElement, nothing } from 'lit'
|
|
4
4
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
@@ -14,77 +14,97 @@ export class ContextToolbar extends connect(store)(LitElement) {
|
|
|
14
14
|
css`
|
|
15
15
|
:host {
|
|
16
16
|
display: flex;
|
|
17
|
-
position: relative;
|
|
18
17
|
|
|
19
18
|
background-color: var(--context-toolbar-background-color);
|
|
20
|
-
justify-content: space-between;
|
|
21
19
|
box-shadow: var(--context-toolbar-shadow-line);
|
|
22
|
-
}
|
|
23
|
-
#front-end {
|
|
24
|
-
padding-left: var(--context-toolbar-side-padding);
|
|
25
|
-
}
|
|
26
|
-
#rear-end {
|
|
27
|
-
padding-right: var(--context-toolbar-side-padding);
|
|
28
|
-
}
|
|
29
|
-
#front-end mwc-icon,
|
|
30
|
-
#front mwc-icon {
|
|
31
|
-
background-color: var(--context-toolbar-function-button-background-color);
|
|
32
|
-
border: var(--context-toolbar-function-button-border);
|
|
33
|
-
height: var(--context-toolbar-function-button-height);
|
|
34
|
-
margin: var(--context-toolbar-button-margin);
|
|
35
|
-
padding: var(--context-toolbar-function-button-padding);
|
|
36
|
-
color: var(--context-toolbar-function-button-color);
|
|
37
|
-
line-height: var(--context-toolbar-function-button-lineheight);
|
|
38
|
-
cursor: pointer;
|
|
39
|
-
}
|
|
40
|
-
#front-end mwc-icon:first-child,
|
|
41
|
-
#front mwc-icon:first-child {
|
|
42
|
-
border-top-left-radius: var(--context-toolbar-function-button-radius);
|
|
43
|
-
border-bottom-left-radius: var(--context-toolbar-function-button-radius);
|
|
44
|
-
}
|
|
45
|
-
#front-end mwc-icon:last-child,
|
|
46
|
-
#front mwc-icon:last-child {
|
|
47
|
-
border-top-right-radius: var(--context-toolbar-function-button-radius);
|
|
48
|
-
border-bottom-right-radius: var(--context-toolbar-function-button-radius);
|
|
49
|
-
}
|
|
50
20
|
|
|
51
|
-
|
|
52
|
-
background-color: var(--primary-color);
|
|
53
|
-
}
|
|
54
|
-
#front-end mwc-icon:hover {
|
|
55
|
-
background-color: var(--context-toolbar-function-button-background-color);
|
|
56
|
-
}
|
|
57
|
-
#front mwc-icon:hover {
|
|
58
|
-
background-color: var(--context-toolbar-function-button-hover-background-color);
|
|
21
|
+
padding: 0;
|
|
59
22
|
}
|
|
60
23
|
|
|
61
|
-
|
|
24
|
+
div[container] {
|
|
62
25
|
flex: 1;
|
|
63
|
-
align-items: center;
|
|
64
|
-
justify-content: end;
|
|
65
|
-
}
|
|
66
26
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
#rear-end > *,
|
|
71
|
-
#rear > * {
|
|
72
|
-
margin: var(--context-toolbar-button-margin);
|
|
73
|
-
}
|
|
74
|
-
#rear-end {
|
|
75
|
-
align-items: start;
|
|
76
|
-
}
|
|
27
|
+
display: flex;
|
|
28
|
+
position: relative;
|
|
29
|
+
overflow: hidden;
|
|
77
30
|
|
|
78
|
-
|
|
79
|
-
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
|
|
33
|
+
gap: 4px;
|
|
34
|
+
padding: 6px 10px;
|
|
35
|
+
|
|
36
|
+
&:empty {
|
|
37
|
+
padding: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
div {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: row;
|
|
43
|
+
flex-wrap: nowrap;
|
|
44
|
+
|
|
45
|
+
align-items: center;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
padding: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#front-end md-icon,
|
|
51
|
+
#front md-icon {
|
|
52
|
+
background-color: var(--context-toolbar-function-button-background-color);
|
|
53
|
+
border: var(--context-toolbar-function-button-border);
|
|
54
|
+
color: var(--context-toolbar-function-button-color);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#front-end md-icon {
|
|
58
|
+
background-color: var(--primary-color);
|
|
59
|
+
}
|
|
60
|
+
#front-end md-icon:hover {
|
|
61
|
+
background-color: var(--context-toolbar-function-button-background-color);
|
|
62
|
+
}
|
|
63
|
+
#front md-icon:hover {
|
|
64
|
+
background-color: var(--context-toolbar-function-button-hover-background-color);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
md-icon {
|
|
68
|
+
background-color: var(--button-background-color, #fafbfc);
|
|
69
|
+
border: 1px solid rgba(var(--primary-color-rgb), 0.5);
|
|
70
|
+
border-radius: var(--button-border-radius);
|
|
71
|
+
padding: var(--iconbtn-padding, 2px);
|
|
72
|
+
|
|
73
|
+
color: var(--primary-color);
|
|
74
|
+
|
|
75
|
+
&:hover {
|
|
76
|
+
background-color: var(--primary-color);
|
|
77
|
+
|
|
78
|
+
color: var(--theme-white-color);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
div md-icon:first-child {
|
|
83
|
+
border-radius: 0;
|
|
84
|
+
border-top-left-radius: var(--context-toolbar-function-button-radius);
|
|
85
|
+
border-bottom-left-radius: var(--context-toolbar-function-button-radius);
|
|
86
|
+
}
|
|
87
|
+
div md-icon:last-child {
|
|
88
|
+
border-radius: 0;
|
|
89
|
+
border-top-right-radius: var(--context-toolbar-function-button-radius);
|
|
90
|
+
border-bottom-right-radius: var(--context-toolbar-function-button-radius);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
#center {
|
|
94
|
+
flex: 1;
|
|
95
|
+
justify-content: end;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
* {
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
80
101
|
}
|
|
81
102
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
padding: 0;
|
|
103
|
+
@media only screen and (max-width: 460px) {
|
|
104
|
+
div[container] {
|
|
105
|
+
padding: 0;
|
|
106
|
+
gap: 0;
|
|
107
|
+
}
|
|
88
108
|
}
|
|
89
109
|
`
|
|
90
110
|
]
|
|
@@ -112,15 +132,23 @@ export class ContextToolbar extends connect(store)(LitElement) {
|
|
|
112
132
|
let rearEndTools = tools.filter(tool => tool.position == TOOL_POSITION.REAR_END)
|
|
113
133
|
|
|
114
134
|
return html`
|
|
115
|
-
<div
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
135
|
+
<div container>
|
|
136
|
+
${frontEndTools.length > 0
|
|
137
|
+
? html`<div id="front-end">${frontEndTools.map(tool => html` ${tool.template} `)}</div>`
|
|
138
|
+
: nothing}
|
|
139
|
+
${frontTools.length > 0
|
|
140
|
+
? html`<div id="front">${frontTools.map(tool => html` ${tool.template} `)}</div>`
|
|
141
|
+
: nothing}
|
|
142
|
+
${centerTools.length > 0
|
|
143
|
+
? html`<div id="center">${centerTools.map(tool => html` ${tool.template} `)}</div>`
|
|
144
|
+
: nothing}
|
|
145
|
+
${rearTools.length > 0
|
|
146
|
+
? html`<div id="rear">${rearTools.map(tool => html` ${tool.template} `)}</div>`
|
|
147
|
+
: nothing}
|
|
148
|
+
${rearEndTools.length > 0
|
|
149
|
+
? html`<div id="rear-end">${rearEndTools.map(tool => html` ${tool.template} `)}</div>`
|
|
150
|
+
: nothing}
|
|
151
|
+
</div>
|
|
124
152
|
`
|
|
125
153
|
}
|
|
126
154
|
|
|
@@ -23,7 +23,7 @@ export const ContextToolbarOverlayStyle = css`
|
|
|
23
23
|
padding: var(--context-ui-list-padding);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
li >
|
|
26
|
+
li > md-icon {
|
|
27
27
|
font-size: 1em;
|
|
28
28
|
|
|
29
29
|
padding: var(--context-ui-padding);
|
|
@@ -37,7 +37,7 @@ export const ContextToolbarOverlayStyle = css`
|
|
|
37
37
|
color: var(--context-ui-list-color);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
li:hover
|
|
40
|
+
li:hover md-icon,
|
|
41
41
|
li:hover span {
|
|
42
42
|
color: #fff;
|
|
43
43
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import '@material/
|
|
2
|
-
import '@material/mwc-icon'
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
3
2
|
import './ox-page-action-overlay-template.js'
|
|
4
3
|
|
|
5
4
|
import { css, html, LitElement, PropertyValues } from 'lit'
|
|
@@ -19,54 +18,79 @@ export class PageActionContextBar extends connect(store)(LitElement) {
|
|
|
19
18
|
:host {
|
|
20
19
|
display: flex;
|
|
21
20
|
overflow: hidden;
|
|
22
|
-
|
|
21
|
+
gap: var(--padding-narrow);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
:host *:focus {
|
|
26
25
|
outline: none;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
button {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
background-color: var(--button-background-color, #fafbfc);
|
|
32
|
+
border: 1px solid rgba(var(--primary-color-rgb), 0.5);
|
|
33
|
+
border-radius: var(--button-border-radius);
|
|
34
|
+
|
|
35
|
+
font-size: var(--fontsize-default);
|
|
36
|
+
color: var(--secondary-color);
|
|
37
|
+
|
|
38
|
+
md-icon {
|
|
39
|
+
margin: 4px 1px;
|
|
40
|
+
|
|
41
|
+
--md-icon-size: 18px;
|
|
42
|
+
color: var(--primary-color);
|
|
43
|
+
}
|
|
44
|
+
&:hover {
|
|
45
|
+
background-color: var(--primary-color);
|
|
46
|
+
|
|
47
|
+
color: var(--theme-white-color);
|
|
48
|
+
|
|
49
|
+
md-icon {
|
|
50
|
+
color: var(--white-theme-color);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[filled] {
|
|
56
|
+
font-variation-settings: 'FILL' 1;
|
|
33
57
|
}
|
|
34
58
|
|
|
35
59
|
[danger] {
|
|
36
|
-
|
|
37
|
-
|
|
60
|
+
color: var(--md-danger-button-primary-color);
|
|
61
|
+
border-color: var(--md-danger-button-outline-color);
|
|
62
|
+
|
|
63
|
+
md-icon {
|
|
64
|
+
color: var(--md-danger-button-primary-color);
|
|
65
|
+
}
|
|
66
|
+
&:hover {
|
|
67
|
+
background-color: var(--md-danger-button-primary-color);
|
|
68
|
+
}
|
|
38
69
|
}
|
|
39
70
|
|
|
40
71
|
[more] {
|
|
41
72
|
position: absolute;
|
|
42
73
|
top: 0;
|
|
43
|
-
right:
|
|
74
|
+
right: 0;
|
|
44
75
|
background-color: var(--context-action-bar-more-button-background-color);
|
|
45
76
|
box-shadow: -2px 0px 2px 1px rgba(0, 0, 0, 0.2);
|
|
46
77
|
padding: var(--context-action-bar-more-button-padding);
|
|
47
78
|
color: var(--context-action-bar-more-button-color);
|
|
79
|
+
padding: 10px;
|
|
48
80
|
font-size: 2rem;
|
|
49
81
|
}
|
|
50
82
|
|
|
51
|
-
mwc-icon {
|
|
52
|
-
background-color: var(--theme-white-color);
|
|
53
|
-
border: 1px solid rgba(var(--primary-color-rgb), 0.5);
|
|
54
|
-
padding: 1px 2px;
|
|
55
|
-
color: var(--primary-color);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
83
|
@media screen and (max-width: 460px) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
--mdc-shape-small: var(--context-action-bar-more-button-border-radius);
|
|
84
|
+
:host {
|
|
85
|
+
gap: 0;
|
|
62
86
|
}
|
|
63
87
|
|
|
64
88
|
[more] {
|
|
65
|
-
position: absolute;
|
|
66
89
|
margin-top: -10px;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
button {
|
|
93
|
+
border-radius: 0;
|
|
70
94
|
}
|
|
71
95
|
}
|
|
72
96
|
|
|
@@ -82,7 +106,15 @@ export class PageActionContextBar extends connect(store)(LitElement) {
|
|
|
82
106
|
]
|
|
83
107
|
}
|
|
84
108
|
|
|
85
|
-
@
|
|
109
|
+
@property({ type: Array }) actions: {
|
|
110
|
+
title: string
|
|
111
|
+
action: () => void
|
|
112
|
+
icon: string
|
|
113
|
+
type: string
|
|
114
|
+
select: string[]
|
|
115
|
+
href?: string
|
|
116
|
+
emphasis?: boolean
|
|
117
|
+
}[] = []
|
|
86
118
|
@state() private overflown: boolean = false
|
|
87
119
|
|
|
88
120
|
private overflownUpdaterThrottle: any
|
|
@@ -115,7 +147,7 @@ export class PageActionContextBar extends connect(store)(LitElement) {
|
|
|
115
147
|
render() {
|
|
116
148
|
return html`
|
|
117
149
|
${this.renderActions()}
|
|
118
|
-
${this.overflown ? html` <
|
|
150
|
+
${this.overflown ? html` <md-icon more @click=${this.showMore.bind(this)}>more_horiz</md-icon> ` : html``}
|
|
119
151
|
`
|
|
120
152
|
}
|
|
121
153
|
|
|
@@ -123,47 +155,49 @@ export class PageActionContextBar extends connect(store)(LitElement) {
|
|
|
123
155
|
return html`
|
|
124
156
|
${this.actions.map(($action, idx) => {
|
|
125
157
|
let { type, title, icon, action, select, href, emphasis } = $action as any
|
|
126
|
-
let { outlined, raised, dense, danger } = emphasis || {}
|
|
158
|
+
let { outlined, raised, dense, danger, filled } = emphasis || {}
|
|
127
159
|
|
|
128
160
|
return type == 'text'
|
|
129
161
|
? html` <span @click=${action}>${title}</span> `
|
|
130
162
|
: type == 'select' || (select && select.length > 0)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
? html`
|
|
164
|
+
<select @change=${action}>
|
|
165
|
+
${select.map((option: any) => html` <option>${option}</option> `)}
|
|
166
|
+
</select>
|
|
167
|
+
`
|
|
168
|
+
: type == 'link'
|
|
169
|
+
? html` <a href=${href}>${title}</a> `
|
|
170
|
+
: type == 'icon'
|
|
171
|
+
? html`<md-icon @click=${action}>${icon}</md-icon>`
|
|
172
|
+
: html`
|
|
173
|
+
<button
|
|
174
|
+
?dense=${dense}
|
|
175
|
+
?raised=${raised}
|
|
176
|
+
?outlined=${outlined}
|
|
177
|
+
?danger=${danger}
|
|
178
|
+
?filled=${filled}
|
|
179
|
+
@click=${async (e: MouseEvent) => {
|
|
180
|
+
/* all actions should be bloked for a second */
|
|
181
|
+
const button = e.currentTarget as any
|
|
182
|
+
button.icon = 'rotate_right'
|
|
183
|
+
button.setAttribute('working', true)
|
|
184
|
+
button.disabled = true
|
|
185
|
+
|
|
186
|
+
try {
|
|
187
|
+
await action()
|
|
188
|
+
} finally {
|
|
189
|
+
await sleep(1000)
|
|
190
|
+
button.disabled = false
|
|
191
|
+
/* because icon can be changed after sleep, don't use closure 'icon'. */
|
|
192
|
+
button.icon = this.actions[idx]?.icon || 'done_all'
|
|
193
|
+
button.removeAttribute('working')
|
|
194
|
+
}
|
|
195
|
+
}}
|
|
196
|
+
>
|
|
197
|
+
<md-icon>${icon || 'done_all'}</md-icon>
|
|
198
|
+
${title}
|
|
199
|
+
</button>
|
|
200
|
+
`
|
|
167
201
|
})}
|
|
168
202
|
`
|
|
169
203
|
}
|
|
@@ -175,7 +209,11 @@ export class PageActionContextBar extends connect(store)(LitElement) {
|
|
|
175
209
|
}
|
|
176
210
|
|
|
177
211
|
stateChanged(state: any) {
|
|
178
|
-
|
|
212
|
+
const { actions } = state.route?.context || {}
|
|
213
|
+
|
|
214
|
+
if (actions) {
|
|
215
|
+
this.actions = actions.filter((action: any) => !!action)
|
|
216
|
+
}
|
|
179
217
|
}
|
|
180
218
|
|
|
181
219
|
showMore() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '@material/
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
2
|
|
|
3
3
|
import { css, html, LitElement } from 'lit'
|
|
4
4
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
@@ -26,19 +26,23 @@ export class PageActionOverlayTemplate extends connect(store)(LitElement) {
|
|
|
26
26
|
outline: none;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
button {
|
|
30
30
|
background-color: var(--main-section-background-color);
|
|
31
31
|
border-radius: var(--context-action-bar-more-button-border-radius);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
[danger] {
|
|
35
|
-
--
|
|
36
|
-
--
|
|
35
|
+
--md-theme-primary: var(--md-danger-button-primary-color);
|
|
36
|
+
--md-button-outline-color: var(--md-danger-button-outline-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[filled] {
|
|
40
|
+
font-variation-settings: 'FILL' 1;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
@media screen and (max-width: 460px) {
|
|
40
|
-
|
|
41
|
-
--
|
|
44
|
+
button {
|
|
45
|
+
--md-button-horizontal-padding: var(--padding-default);
|
|
42
46
|
border-radius: 4px;
|
|
43
47
|
}
|
|
44
48
|
}
|
|
@@ -61,47 +65,49 @@ export class PageActionOverlayTemplate extends connect(store)(LitElement) {
|
|
|
61
65
|
return html`
|
|
62
66
|
${this.actions.map(($action, idx) => {
|
|
63
67
|
let { type, title, icon, action, select, href, emphasis } = $action as any
|
|
64
|
-
let { outlined, raised, dense, danger } = emphasis || {}
|
|
68
|
+
let { outlined, raised, dense, danger, filled } = emphasis || {}
|
|
65
69
|
|
|
66
70
|
return type == 'text'
|
|
67
71
|
? html` <span>${title}</span> `
|
|
68
72
|
: type == 'select' || (select && select.length > 0)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
button.disabled = true
|
|
73
|
+
? html`
|
|
74
|
+
<select @change=${action}>
|
|
75
|
+
${select.map((option: any) => html` <option>${option}</option> `)}
|
|
76
|
+
</select>
|
|
77
|
+
`
|
|
78
|
+
: type == 'link'
|
|
79
|
+
? html` <a href=${href}>${title}</a> `
|
|
80
|
+
: html`
|
|
81
|
+
<button
|
|
82
|
+
?dense=${dense}
|
|
83
|
+
?raised=${raised}
|
|
84
|
+
?outlined=${outlined}
|
|
85
|
+
?danger=${danger}
|
|
86
|
+
?filled=${filled}
|
|
87
|
+
@click=${async (e: MouseEvent) => {
|
|
88
|
+
/* all actions should be bloked for a second */
|
|
89
|
+
const button = e.currentTarget as any
|
|
90
|
+
button.icon = 'rotate_right'
|
|
91
|
+
button.setAttribute('working', true)
|
|
92
|
+
button.disabled = true
|
|
90
93
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
try {
|
|
95
|
+
action()
|
|
96
|
+
} finally {
|
|
97
|
+
await sleep(1000)
|
|
98
|
+
button.disabled = false
|
|
99
|
+
/* because icon can be changed after sleep, don't use closure 'icon'. */
|
|
100
|
+
button.icon = this.actions[idx]?.icon || 'done_all'
|
|
101
|
+
button.removeAttribute('working')
|
|
99
102
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
window.history.back()
|
|
104
|
+
}
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
<md-icon>${icon || 'done_all'}</md-icon>
|
|
108
|
+
${title}
|
|
109
|
+
</button>
|
|
110
|
+
`
|
|
105
111
|
})}
|
|
106
112
|
`
|
|
107
113
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '@material/
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
2
|
import '@operato/input/ox-input-search.js'
|
|
3
3
|
|
|
4
4
|
import { css, html, LitElement } from 'lit'
|
|
@@ -22,7 +22,7 @@ export class PageTitleBar extends connect(store)(LitElement) {
|
|
|
22
22
|
--help-icon-opacity: 0.2;
|
|
23
23
|
--help-icon-size: 20px;
|
|
24
24
|
|
|
25
|
-
--
|
|
25
|
+
--md-icon-size: 20px;
|
|
26
26
|
|
|
27
27
|
--input-search-padding: var(--padding-narrow);
|
|
28
28
|
--input-search-font: normal 14px var(--theme-font);
|
|
@@ -92,10 +92,8 @@ export class PageTitleBar extends connect(store)(LitElement) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
return html`
|
|
95
|
-
${title ? html` <div titler>${icon ? html`<
|
|
96
|
-
${help && title
|
|
97
|
-
? html` <mwc-icon @click=${(e: MouseEvent) => openHelp(help)} help>help</mwc-icon> `
|
|
98
|
-
: html``}
|
|
95
|
+
${title ? html` <div titler>${icon ? html`<md-icon>${icon}</md-icon> ` : html``}${text}</div> ` : html``}
|
|
96
|
+
${help && title ? html` <md-icon @click=${(e: MouseEvent) => openHelp(help)} help>help</md-icon> ` : html``}
|
|
99
97
|
${searchable || filterable
|
|
100
98
|
? html`
|
|
101
99
|
<div search>
|
|
@@ -110,9 +108,9 @@ export class PageTitleBar extends connect(store)(LitElement) {
|
|
|
110
108
|
></ox-input-search>`
|
|
111
109
|
: html``}
|
|
112
110
|
${!title && help && searchable
|
|
113
|
-
? html`<
|
|
111
|
+
? html`<md-icon @click=${(e: MouseEvent) => openHelp(help)} help>help</md-icon>`
|
|
114
112
|
: html``}
|
|
115
|
-
${filterable ? html`<
|
|
113
|
+
${filterable ? html`<md-icon @click=${(e: MouseEvent) => filterHandler()}>unfold_more</md-icon>` : html``}
|
|
116
114
|
</div>
|
|
117
115
|
`
|
|
118
116
|
: html``}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '@material/
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
2
|
import '@operato/input/ox-input-search.js'
|
|
3
3
|
|
|
4
4
|
import { css, html, LitElement } from 'lit'
|
|
@@ -21,7 +21,7 @@ export class TitleBar extends connect(store)(LitElement) {
|
|
|
21
21
|
--help-icon-opacity: 0.2;
|
|
22
22
|
--help-icon-size: 20px;
|
|
23
23
|
|
|
24
|
-
--
|
|
24
|
+
--md-icon-size: 20px;
|
|
25
25
|
|
|
26
26
|
--input-search-padding: 7px;
|
|
27
27
|
--input-search-border-bottom: none;
|
|
@@ -88,10 +88,8 @@ export class TitleBar extends connect(store)(LitElement) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
return html`
|
|
91
|
-
${title ? html` <div titler>${icon ? html`<
|
|
92
|
-
${help && title
|
|
93
|
-
? html` <mwc-icon @click=${(e: MouseEvent) => openHelp(help)} help>help</mwc-icon> `
|
|
94
|
-
: html``}
|
|
91
|
+
${title ? html` <div titler>${icon ? html`<md-icon>${icon}</md-icon> ` : html``}${text}</div> ` : html``}
|
|
92
|
+
${help && title ? html` <md-icon @click=${(e: MouseEvent) => openHelp(help)} help>help</md-icon> ` : html``}
|
|
95
93
|
${searchable || filterable
|
|
96
94
|
? html`
|
|
97
95
|
<div search>
|
|
@@ -106,9 +104,9 @@ export class TitleBar extends connect(store)(LitElement) {
|
|
|
106
104
|
></ox-input-search>`
|
|
107
105
|
: html``}
|
|
108
106
|
${!title && help && searchable
|
|
109
|
-
? html`<
|
|
107
|
+
? html`<md-icon @click=${(e: MouseEvent) => openHelp(help)} help>help</md-icon>`
|
|
110
108
|
: html``}
|
|
111
|
-
${filterable ? html`<
|
|
109
|
+
${filterable ? html`<md-icon @click=${(e: MouseEvent) => filterHandler()}>tune</md-icon>` : html``}
|
|
112
110
|
</div>
|
|
113
111
|
`
|
|
114
112
|
: html``}
|