@teipublisher/pb-components 2.26.0-next-3.10 → 2.26.0-next-3.12
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 +15 -0
- package/dist/demo/components.css +2 -8
- package/dist/pb-components-bundle.js +13 -13
- package/dist/pb-elements.json +30 -8
- package/dist/pb-odd-editor.js +1 -1
- package/dist/{vaadin-element-mixin-6633322b.js → vaadin-element-mixin-49ab4037.js} +31 -8
- package/package.json +1 -1
- package/pb-elements.json +30 -8
- package/src/pb-dialog.js +30 -3
- package/src/pb-login.js +12 -12
- package/src/pb-view-annotate.js +3 -0
- package/src/pb-view.js +38 -20
package/src/pb-login.js
CHANGED
|
@@ -146,13 +146,6 @@ export class PbLogin extends themableMixin(pbMixin(LitElement)) {
|
|
|
146
146
|
<a href="#" @click="${this._show}" title="${this.user ? this.user : this.loginLabel}" part="trigger">
|
|
147
147
|
${
|
|
148
148
|
this.loggedIn ?
|
|
149
|
-
html`
|
|
150
|
-
<slot name="icon-login">
|
|
151
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person" viewBox="0 0 16 16" part="icon">
|
|
152
|
-
<path d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z"/>
|
|
153
|
-
</svg>
|
|
154
|
-
</slot>
|
|
155
|
-
` :
|
|
156
149
|
html`
|
|
157
150
|
<slot name="icon-logout" part="icon">
|
|
158
151
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-check" viewBox="0 0 16 16" part="icon">
|
|
@@ -160,6 +153,13 @@ export class PbLogin extends themableMixin(pbMixin(LitElement)) {
|
|
|
160
153
|
<path d="M8.256 14a4.5 4.5 0 0 1-.229-1.004H3c.001-.246.154-.986.832-1.664C4.484 10.68 5.711 10 8 10q.39 0 .74.025c.226-.341.496-.65.804-.918Q8.844 9.002 8 9c-5 0-6 3-6 4s1 1 1 1z"/>
|
|
161
154
|
</svg>
|
|
162
155
|
</slot>
|
|
156
|
+
` :
|
|
157
|
+
html`
|
|
158
|
+
<slot name="icon-login">
|
|
159
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person" viewBox="0 0 16 16" part="icon">
|
|
160
|
+
<path d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z"/>
|
|
161
|
+
</svg>
|
|
162
|
+
</slot>
|
|
163
163
|
`
|
|
164
164
|
}
|
|
165
165
|
<span class="label" part="label">${translate(this.loggedIn ? this.logoutLabel : this.loginLabel, { user: this.user })}</span>
|
|
@@ -245,7 +245,7 @@ export class PbLogin extends themableMixin(pbMixin(LitElement)) {
|
|
|
245
245
|
_handleError() {
|
|
246
246
|
this.loggedIn = false;
|
|
247
247
|
this.password = null;
|
|
248
|
-
|
|
248
|
+
|
|
249
249
|
const resp = {
|
|
250
250
|
userChanged: this.loggedIn,
|
|
251
251
|
user: null
|
|
@@ -261,7 +261,7 @@ export class PbLogin extends themableMixin(pbMixin(LitElement)) {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
264
|
+
*
|
|
265
265
|
* @param {Array<String>} arr array containg string values (name of groups)
|
|
266
266
|
* @param {String} val value to check if it's in the array
|
|
267
267
|
* @returns true if the checked values is in the array
|
|
@@ -269,10 +269,10 @@ export class PbLogin extends themableMixin(pbMixin(LitElement)) {
|
|
|
269
269
|
_isItemInArray(arr, val) {
|
|
270
270
|
return arr.some((arrVal) => val === arrVal);
|
|
271
271
|
}
|
|
272
|
-
|
|
272
|
+
|
|
273
273
|
/**
|
|
274
|
-
*
|
|
275
|
-
* @param {object} info object returned by login function;
|
|
274
|
+
*
|
|
275
|
+
* @param {object} info object returned by login function;
|
|
276
276
|
* contains groups the user is a member of
|
|
277
277
|
* @returns true if user is member of one of defined groups
|
|
278
278
|
*/
|
package/src/pb-view-annotate.js
CHANGED
package/src/pb-view.js
CHANGED
|
@@ -12,11 +12,11 @@ import '@polymer/iron-ajax';
|
|
|
12
12
|
* The document to be viewed is determined by the `pb-document` element the property
|
|
13
13
|
* `src` points to. If not overwritten, `pb-view` will use the settings defined by
|
|
14
14
|
* the connected document, like view type, ODD etc.
|
|
15
|
-
*
|
|
15
|
+
*
|
|
16
16
|
* `pb-view` can display an entire document or just a fragment of it
|
|
17
17
|
* as defined by the properties `xpath`, `xmlId` or `nodeId`. The most common use case
|
|
18
18
|
* is to set `xpath` to point to a specific part of a document.
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
20
|
* Navigating to the next or previous fragment would usually be triggered by a separate
|
|
21
21
|
* `pb-navigation` element, which sends a `pb-navigate` event to the `pb-view`. However,
|
|
22
22
|
* `pb-view` also implements automatic loading of next/previous fragments if the user
|
|
@@ -48,7 +48,7 @@ import '@polymer/iron-ajax';
|
|
|
48
48
|
* @cssprop --pb-view-scroll-margin-top - Applied to any element with an id
|
|
49
49
|
* @csspart content - The root div around the displayed content
|
|
50
50
|
* @csspart footnotes - div containing the footnotes
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
* @fires pb-start-update - Fired before the element updates its content
|
|
53
53
|
* @fires pb-update - Fired when the component received content from the server
|
|
54
54
|
* @fires pb-end-update - Fired after the element has finished updating its content
|
|
@@ -95,6 +95,16 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
95
95
|
view: {
|
|
96
96
|
type: String
|
|
97
97
|
},
|
|
98
|
+
/**
|
|
99
|
+
* Controls the pagination-by-div algorithm: if a page would have less than
|
|
100
|
+
* `fill` elements, it tries to fill
|
|
101
|
+
* up the page by pulling following divs in. When set to 0, it will never
|
|
102
|
+
* attempt to fill up the page. For the annotation editor this should
|
|
103
|
+
* always be 0.
|
|
104
|
+
*/
|
|
105
|
+
fill: {
|
|
106
|
+
type: Number
|
|
107
|
+
},
|
|
98
108
|
/**
|
|
99
109
|
* An eXist nodeId. If specified, selects the root of the fragment of the document
|
|
100
110
|
* which should be displayed. Normally this property is set automatically by pagination.
|
|
@@ -193,7 +203,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
193
203
|
},
|
|
194
204
|
/**
|
|
195
205
|
* The reading direction, i.e. 'ltr' or 'rtl'.
|
|
196
|
-
*
|
|
206
|
+
*
|
|
197
207
|
* @type {"ltr"|"rtl"}
|
|
198
208
|
*/
|
|
199
209
|
direction: {
|
|
@@ -217,7 +227,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
217
227
|
/**
|
|
218
228
|
* If set, a refresh will be triggered if a `pb-i18n-update` event is received,
|
|
219
229
|
* e.g. due to the user selecting a different interface language.
|
|
220
|
-
*
|
|
230
|
+
*
|
|
221
231
|
* Also requires `requireLanguage` to be set on the surrounding `pb-page`.
|
|
222
232
|
* See there for more information.
|
|
223
233
|
*/
|
|
@@ -236,7 +246,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
236
246
|
* Experimental: if enabled, the view will incrementally load new document fragments if the user tries to scroll
|
|
237
247
|
* beyond the start or end of the visible text. The feature inserts a small blank section at the top
|
|
238
248
|
* and bottom. If this section becomes visible, a load operation will be triggered.
|
|
239
|
-
*
|
|
249
|
+
*
|
|
240
250
|
* Note: only browsers implementing the `IntersectionObserver` API are supported. Also the feature
|
|
241
251
|
* does not work in two-column mode or with animations.
|
|
242
252
|
*/
|
|
@@ -259,8 +269,8 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
259
269
|
* When method `wait` is called, it will wait until all referenced
|
|
260
270
|
* components signal with a `pb-ready` event that they are ready and listening
|
|
261
271
|
* to events.
|
|
262
|
-
*
|
|
263
|
-
* `pb-view` by default sets this property to select `pb-toggle-feature` and `pb-select-feature`
|
|
272
|
+
*
|
|
273
|
+
* `pb-view` by default sets this property to select `pb-toggle-feature` and `pb-select-feature`
|
|
264
274
|
* elements.
|
|
265
275
|
*/
|
|
266
276
|
waitFor: {
|
|
@@ -270,7 +280,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
270
280
|
/**
|
|
271
281
|
* By default, navigating to next/previous page will update browser parameters,
|
|
272
282
|
* so reloading the page will load the correct position within the document.
|
|
273
|
-
*
|
|
283
|
+
*
|
|
274
284
|
* Set this property to disable location tracking for the component altogether.
|
|
275
285
|
*/
|
|
276
286
|
disableHistory: {
|
|
@@ -289,7 +299,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
289
299
|
attribute: 'before-update-event'
|
|
290
300
|
},
|
|
291
301
|
/**
|
|
292
|
-
* If set, do not scroll the view to target node (e.g. given in URL hash)
|
|
302
|
+
* If set, do not scroll the view to target node (e.g. given in URL hash)
|
|
293
303
|
* after content was loaded.
|
|
294
304
|
*/
|
|
295
305
|
noScroll: {
|
|
@@ -401,6 +411,9 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
401
411
|
if (this.view !== 'single') {
|
|
402
412
|
newState.root = this.nodeId;
|
|
403
413
|
}
|
|
414
|
+
if (this.fill) {
|
|
415
|
+
newState.fill = this.fill;
|
|
416
|
+
}
|
|
404
417
|
console.log('id: %s; state: %o', this.id, newState);
|
|
405
418
|
registry.replace(this, newState);
|
|
406
419
|
|
|
@@ -506,7 +519,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
506
519
|
|
|
507
520
|
/**
|
|
508
521
|
* Returns the ODD used to render content.
|
|
509
|
-
*
|
|
522
|
+
*
|
|
510
523
|
* @returns the ODD being used
|
|
511
524
|
*/
|
|
512
525
|
getOdd() {
|
|
@@ -581,6 +594,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
581
594
|
this.columnSeparator = ev.detail.columnSeparator;
|
|
582
595
|
}
|
|
583
596
|
this.view = ev.detail.view || this.getView();
|
|
597
|
+
this.fill = ev.detail.fill || this.fill;
|
|
584
598
|
if (ev.detail.xpath) {
|
|
585
599
|
this.xpath = ev.detail.xpath;
|
|
586
600
|
this.nodeId = null;
|
|
@@ -648,7 +662,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
648
662
|
}
|
|
649
663
|
|
|
650
664
|
const loadContent = this.shadowRoot.getElementById('loadContent');
|
|
651
|
-
|
|
665
|
+
|
|
652
666
|
if (this.static !== null) {
|
|
653
667
|
this._staticUrl(params).then((url) => {
|
|
654
668
|
loadContent.url = url;
|
|
@@ -689,7 +703,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
689
703
|
});
|
|
690
704
|
return urlComponents.join('&');
|
|
691
705
|
}
|
|
692
|
-
|
|
706
|
+
|
|
693
707
|
const index = await fetch(`index.json`)
|
|
694
708
|
.then((response) => response.json());
|
|
695
709
|
const paramNames = ['odd', 'view', 'xpath', 'map'];
|
|
@@ -729,7 +743,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
729
743
|
} else {
|
|
730
744
|
message = '<pb-i18n key="dialogs.serverError"></pb-i18n>';
|
|
731
745
|
}
|
|
732
|
-
|
|
746
|
+
|
|
733
747
|
let content;
|
|
734
748
|
if (this.notFound != null) {
|
|
735
749
|
content = `<p>${this.notFound}</p>`;
|
|
@@ -764,7 +778,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
764
778
|
|
|
765
779
|
if (this._scrollTarget) {
|
|
766
780
|
this.updateComplete.then(() => {
|
|
767
|
-
const target = this.shadowRoot.getElementById(this._scrollTarget) ||
|
|
781
|
+
const target = this.shadowRoot.getElementById(this._scrollTarget) ||
|
|
768
782
|
this.shadowRoot.querySelector(`[node-id="${this._scrollTarget}"]`);
|
|
769
783
|
if (target) {
|
|
770
784
|
window.requestAnimationFrame(() =>
|
|
@@ -1025,6 +1039,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
1025
1039
|
}
|
|
1026
1040
|
params.odd = this.getOdd() + '.odd';
|
|
1027
1041
|
params.view = this.getView();
|
|
1042
|
+
params.fill = this.fill;
|
|
1028
1043
|
if (pos) {
|
|
1029
1044
|
params['root'] = pos;
|
|
1030
1045
|
}
|
|
@@ -1120,7 +1135,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
1120
1135
|
* Check the number of fragments which were already loaded in infinite
|
|
1121
1136
|
* scroll mode. If they exceed `infiniteScrollMax`, remove either the
|
|
1122
1137
|
* first or last fragment from the DOM, depending on the scroll direction.
|
|
1123
|
-
*
|
|
1138
|
+
*
|
|
1124
1139
|
* @param {string} direction either 'forward' or 'backward'
|
|
1125
1140
|
*/
|
|
1126
1141
|
_checkChunks(direction) {
|
|
@@ -1165,7 +1180,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
1165
1180
|
const properties = registry.getState(this);
|
|
1166
1181
|
if (properties) {
|
|
1167
1182
|
this._setState(properties);
|
|
1168
|
-
|
|
1183
|
+
|
|
1169
1184
|
}
|
|
1170
1185
|
|
|
1171
1186
|
if (ev.detail.refresh) {
|
|
@@ -1213,6 +1228,9 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
1213
1228
|
this.nodeId = this.switchView;
|
|
1214
1229
|
}
|
|
1215
1230
|
}
|
|
1231
|
+
if (properties.fill && !this.getAttribute('fill')) {
|
|
1232
|
+
this.fill = properties.fill;
|
|
1233
|
+
}
|
|
1216
1234
|
if (properties.xpath && !this.getAttribute('xpath')) {
|
|
1217
1235
|
this.xpath = properties.xpath;
|
|
1218
1236
|
}
|
|
@@ -1273,9 +1291,9 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
1273
1291
|
-ms-overflow-style: none;
|
|
1274
1292
|
}
|
|
1275
1293
|
|
|
1276
|
-
:host(.noscroll)::-webkit-scrollbar {
|
|
1294
|
+
:host(.noscroll)::-webkit-scrollbar {
|
|
1277
1295
|
width: 0 !important;
|
|
1278
|
-
display: none;
|
|
1296
|
+
display: none;
|
|
1279
1297
|
}
|
|
1280
1298
|
|
|
1281
1299
|
[id] {
|
|
@@ -1355,7 +1373,7 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
1355
1373
|
0% {
|
|
1356
1374
|
background-position: 3rem 0;
|
|
1357
1375
|
}
|
|
1358
|
-
|
|
1376
|
+
|
|
1359
1377
|
100% {
|
|
1360
1378
|
background-position: 0 0;
|
|
1361
1379
|
}
|