@teipublisher/pb-components 2.1.1 → 2.2.0
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/.gitattributes +1 -0
- package/.github/dependabot.yml +11 -0
- package/.github/workflows/main.yml +5 -3
- package/.github/workflows/node.js.yml +4 -4
- package/.github/workflows/release.js.yml +4 -2
- package/CHANGELOG.md +11 -0
- package/Dockerfile +6 -6
- package/dist/demo/pb-autocomplete3.html +2 -1
- package/dist/demo/pb-blacklab-results.html +1 -1
- package/dist/demo/pb-collapse.html +2 -2
- package/dist/demo/pb-image-strip-standalone.html +2 -2
- package/dist/demo/pb-leaflet-map3.html +2 -2
- package/dist/pb-components-bundle.js +7 -11
- package/dist/pb-elements.json +3 -3
- package/dist/pb-odd-editor.js +1 -1
- package/dist/{vaadin-element-mixin-672938e3.js → vaadin-element-mixin-c9455086.js} +19 -14
- package/package.json +1 -1
- package/pb-elements.json +3 -3
- package/src/pb-collapse.js +197 -184
- package/src/pb-login.js +11 -9
- package/.travis.yml +0 -20
package/src/pb-collapse.js
CHANGED
|
@@ -1,184 +1,197 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import '@polymer/iron-icon';
|
|
5
|
-
import '@polymer/iron-icons';
|
|
6
|
-
import '@polymer/iron-collapse';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A collapsible block: in collapsed state it only shows a header and expands if clicked.
|
|
11
|
-
* The header should go into slot `collapse-trigger`, the content into `collapse-content`.
|
|
12
|
-
* Example:
|
|
13
|
-
*
|
|
14
|
-
* ```html
|
|
15
|
-
* <pb-collapse>
|
|
16
|
-
* <div slot="collapse-trigger">
|
|
17
|
-
* Metadata
|
|
18
|
-
* </div>
|
|
19
|
-
* <pb-view slot="collapse-content" src="document1" subscribe="transcription" xpath="//teiHeader"></pb-view>
|
|
20
|
-
* </pb-collapse>
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
this.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
this.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
this.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
1
|
+
import {LitElement, html, css} from 'lit-element';
|
|
2
|
+
import {pbMixin} from './pb-mixin.js';
|
|
3
|
+
import {themableMixin} from "./theming.js";
|
|
4
|
+
import '@polymer/iron-icon';
|
|
5
|
+
import '@polymer/iron-icons';
|
|
6
|
+
import '@polymer/iron-collapse';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A collapsible block: in collapsed state it only shows a header and expands if clicked.
|
|
11
|
+
* The header should go into slot `collapse-trigger`, the content into `collapse-content`.
|
|
12
|
+
* Example:
|
|
13
|
+
*
|
|
14
|
+
* ```html
|
|
15
|
+
* <pb-collapse>
|
|
16
|
+
* <div slot="collapse-trigger">
|
|
17
|
+
* Metadata
|
|
18
|
+
* </div>
|
|
19
|
+
* <pb-view slot="collapse-content" src="document1" subscribe="transcription" xpath="//teiHeader"></pb-view>
|
|
20
|
+
* </pb-collapse>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* By adding a CSS 'icon-right' to a `pb-collapse` the icon can be placed on the right side
|
|
24
|
+
* ```
|
|
25
|
+
* <pb-collapse class='icon-right'>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @slot collapse-trigger - trigger toggling collapsed content on/off
|
|
29
|
+
* @slot collapse-content - content to be collapsed
|
|
30
|
+
* @cssprop [--pb-collapse-icon-padding=0 4px 0 0] - padding in px for the "caret-down" icon left to the collapsible item
|
|
31
|
+
* @fires pb-collapse-open - Fires opening the collapsed section
|
|
32
|
+
*/
|
|
33
|
+
export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
34
|
+
static get properties() {
|
|
35
|
+
return {
|
|
36
|
+
...super.properties,
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated
|
|
39
|
+
* Corresponds to the iron-collapse's horizontal property.
|
|
40
|
+
*/
|
|
41
|
+
horizontal: {
|
|
42
|
+
type: Boolean
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Corresponds to the iron-collapse's noAnimation property.
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
noAnimation: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
attribute: 'no-animation'
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Whether currently expanded.
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
opened: {
|
|
57
|
+
type: Boolean
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.
|
|
61
|
+
* Set to true to keep multiple pb-collapse open at the same time.
|
|
62
|
+
*/
|
|
63
|
+
toggles: {
|
|
64
|
+
type: Boolean
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* The iron-icon when collapsed. Value must be one of the icons defined by iron-icons
|
|
68
|
+
*/
|
|
69
|
+
expandIcon: {
|
|
70
|
+
type: String,
|
|
71
|
+
attribute: 'expand-icon'
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* The icon when expanded.
|
|
75
|
+
*/
|
|
76
|
+
collapseIcon: {
|
|
77
|
+
type: String,
|
|
78
|
+
attribute: 'collapse-icon'
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Whether to hide the expand/collapse icon.
|
|
82
|
+
*/
|
|
83
|
+
noIcons: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
attribute: 'no-icons'
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
constructor() {
|
|
91
|
+
super();
|
|
92
|
+
this.horizontal = false;
|
|
93
|
+
this.noAnimation = false;
|
|
94
|
+
this.opened = false;
|
|
95
|
+
this.expandIcon = 'icons:expand-more';
|
|
96
|
+
this.collapseIcon = 'icons:expand-less';
|
|
97
|
+
this.noIcons = false;
|
|
98
|
+
this.toggles = false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
connectedCallback() {
|
|
102
|
+
super.connectedCallback();
|
|
103
|
+
this.addEventListener('pb-collapse-open', () => {
|
|
104
|
+
this.open();
|
|
105
|
+
});
|
|
106
|
+
if (this.toggles) {
|
|
107
|
+
this.subscribeTo('pb-collapse-open', (ev) => {
|
|
108
|
+
if (!ev.detail || ev.detail._source === this) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
for (const collapse of this.querySelectorAll('pb-collapse')) {
|
|
112
|
+
if (collapse === ev.detail._source) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
this.close();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* opens the collapsible section
|
|
123
|
+
*/
|
|
124
|
+
open() {
|
|
125
|
+
if (this.opened) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.opened = true;
|
|
129
|
+
|
|
130
|
+
this.emitTo('pb-collapse-open', this);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* closes the collapsible section
|
|
135
|
+
*/
|
|
136
|
+
close() {
|
|
137
|
+
if (this.opened) {
|
|
138
|
+
this.opened = false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* toggles the collapsible state
|
|
144
|
+
*/
|
|
145
|
+
toggle() {
|
|
146
|
+
this.opened = !this.opened;
|
|
147
|
+
if (this.opened) {
|
|
148
|
+
this.emitTo('pb-collapse-open', this.data);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
render() {
|
|
153
|
+
return html`
|
|
154
|
+
<div id="trigger" @click="${this.toggle}" class="collapse-trigger">
|
|
155
|
+
${
|
|
156
|
+
!this.noIcons ?
|
|
157
|
+
html`<iron-icon icon="${this.opened ? this.collapseIcon : this.expandIcon}"></iron-icon>` :
|
|
158
|
+
null
|
|
159
|
+
}
|
|
160
|
+
<slot id="collapseTrigger" name="collapse-trigger"></slot>
|
|
161
|
+
</div>
|
|
162
|
+
<iron-collapse id="collapse" horizontal="${this.horizontal}" no-animation="${this.noAnimation}" .opened="${this.opened}">
|
|
163
|
+
<slot name="collapse-content"></slot>
|
|
164
|
+
</iron-collapse>
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
static get styles() {
|
|
169
|
+
return css`
|
|
170
|
+
:host {
|
|
171
|
+
display: block;
|
|
172
|
+
position: relative;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#trigger {
|
|
176
|
+
display: table-row;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
iron-icon {
|
|
180
|
+
display: table-cell;
|
|
181
|
+
padding: var(--pb-collapse-icon-padding, 0 4px 0 0);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
:host(.icon-right) iron-icon {
|
|
185
|
+
position: absolute;
|
|
186
|
+
right: 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
slot[name="collapse-trigger"] {
|
|
190
|
+
display: table-cell;
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (!customElements.get('pb-collapse')) {
|
|
196
|
+
customElements.define('pb-collapse', PbCollapse);
|
|
197
|
+
}
|
package/src/pb-login.js
CHANGED
|
@@ -129,16 +129,22 @@ export class PbLogin extends pbMixin(LitElement) {
|
|
|
129
129
|
};
|
|
130
130
|
this._checkLogin.generateRequest();
|
|
131
131
|
});
|
|
132
|
+
this.addEventListener('keyup', event => {
|
|
133
|
+
if (event.keyCode === 13) {
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
this._confirmLogin();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
132
138
|
}
|
|
133
139
|
|
|
134
140
|
render() {
|
|
135
141
|
return html`
|
|
136
|
-
<a href="#" @click="${this._show}" title="${this.user}">
|
|
142
|
+
<a href="#" @click="${this._show}" role="button" title="${this.user ? this.user : this.loginLabel}">
|
|
137
143
|
${
|
|
138
144
|
this.loggedIn ?
|
|
139
145
|
html`<iron-icon icon="${this.logoutIcon}"></iron-icon> <span class="label">${translate(this.logoutLabel, { user: this.user })}</span>` :
|
|
140
146
|
html`<iron-icon icon="${this.loginIcon}"></iron-icon> <span class="label">${translate(this.loginLabel)}</span>`
|
|
141
|
-
}
|
|
147
|
+
}
|
|
142
148
|
</a>
|
|
143
149
|
|
|
144
150
|
<paper-dialog id="loginDialog">
|
|
@@ -191,12 +197,8 @@ export class PbLogin extends pbMixin(LitElement) {
|
|
|
191
197
|
a {
|
|
192
198
|
color: var(--pb-login-link-color, --pb-link-color);
|
|
193
199
|
text-decoration: none;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
@media (max-width: 1024px) {
|
|
197
|
-
.label {
|
|
198
|
-
display: none;
|
|
199
|
-
}
|
|
200
|
+
display: flex;
|
|
201
|
+
gap:0.5rem;
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
#message {
|
|
@@ -280,4 +282,4 @@ export class PbLogin extends pbMixin(LitElement) {
|
|
|
280
282
|
* @param {Array<String>} groups groups the user is a member of
|
|
281
283
|
*/
|
|
282
284
|
}
|
|
283
|
-
customElements.define('pb-login', PbLogin);
|
|
285
|
+
customElements.define('pb-login', PbLogin);
|
package/.travis.yml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
dist: xenial
|
|
2
|
-
language: node_js
|
|
3
|
-
node_js:
|
|
4
|
-
- 14
|
|
5
|
-
services:
|
|
6
|
-
- docker
|
|
7
|
-
env:
|
|
8
|
-
- img=existdb/teipublisher:6.0.0-RC1
|
|
9
|
-
before_install:
|
|
10
|
-
- docker pull $img
|
|
11
|
-
- docker create --name exist-ci -p 8080:8080 $img
|
|
12
|
-
- npm prune
|
|
13
|
-
install:
|
|
14
|
-
- npm install -q
|
|
15
|
-
before_script:
|
|
16
|
-
- docker start exist-ci
|
|
17
|
-
# exist needs time
|
|
18
|
-
- sleep 30
|
|
19
|
-
script:
|
|
20
|
-
- npm test
|