@teipublisher/pb-components 2.26.0-next-3.9 → 2.26.0-next-3.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.
- package/CHANGELOG.md +14 -0
- package/dist/{iron-form-b76df6d4.js → iron-form-277f9d42.js} +1 -1
- package/dist/{paper-listbox-9b2edde9.js → paper-listbox-c2468542.js} +46 -46
- package/dist/pb-components-bundle.js +7 -7
- package/dist/pb-edit-app.js +1 -1
- package/dist/pb-elements.json +44 -45
- package/dist/pb-odd-editor.js +60 -56
- package/dist/{vaadin-element-mixin-497e09e1.js → vaadin-element-mixin-6633322b.js} +111 -70
- package/package.json +1 -2
- package/pb-elements.json +44 -45
- package/src/pb-collapse.js +106 -51
- package/src/pb-odd-editor.js +24 -26
- package/src/pb-odd-elementspec-editor.js +3 -3
- package/src/pb-odd-model-editor.js +31 -25
- package/src/pb-view-annotate.js +3 -0
- package/src/pb-view.js +38 -20
|
@@ -13,7 +13,7 @@ import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
|
|
|
13
13
|
import '@polymer/paper-listbox/paper-listbox.js';
|
|
14
14
|
import '@polymer/paper-item/paper-item.js';
|
|
15
15
|
import '@polymer/paper-styles/color.js';
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
import "@jinntec/jinn-codemirror/dist/src/jinn-codemirror";
|
|
18
18
|
|
|
19
19
|
import { cmpVersion } from './utils.js';
|
|
@@ -149,7 +149,7 @@ export class PbOddModelEditor extends LitElement {
|
|
|
149
149
|
display:inline;
|
|
150
150
|
align-self:stretch;
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
.group {
|
|
154
154
|
margin: 0;
|
|
155
155
|
font-size: 16px;
|
|
@@ -199,20 +199,25 @@ export class PbOddModelEditor extends LitElement {
|
|
|
199
199
|
:host([currentselection]) > form > header > h4 > .btn-group{
|
|
200
200
|
display: inline-block;
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
details {
|
|
203
|
+
display: block;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
details summary {
|
|
207
|
+
display: none;
|
|
203
208
|
}
|
|
204
209
|
|
|
205
210
|
.renditions{
|
|
206
211
|
margin-top:10px;
|
|
207
212
|
}
|
|
208
|
-
|
|
213
|
+
|
|
209
214
|
.details{
|
|
210
215
|
padding:0px 50px 20px 20px;
|
|
211
216
|
background:var(--paper-grey-200);
|
|
212
217
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
218
|
+
|
|
219
|
+
details:not([open]) {
|
|
220
|
+
padding: 0;
|
|
216
221
|
}
|
|
217
222
|
|
|
218
223
|
.editor label {
|
|
@@ -425,12 +430,12 @@ export class PbOddModelEditor extends LitElement {
|
|
|
425
430
|
}
|
|
426
431
|
return html`
|
|
427
432
|
<form>
|
|
428
|
-
<header>
|
|
433
|
+
<header>
|
|
429
434
|
<h4>
|
|
430
435
|
<paper-icon-button id="toggle"
|
|
431
436
|
icon="${this.icon}" @click="${this.toggle}"
|
|
432
437
|
class="model-collapse"></paper-icon-button>
|
|
433
|
-
|
|
438
|
+
|
|
434
439
|
<span class="modelType">${this.type}<span class="behaviour" ?hidden="${this._isGroupOrSequence()}">${this.behaviour}</span></span>
|
|
435
440
|
|
|
436
441
|
<span class="btn-group">
|
|
@@ -470,7 +475,8 @@ export class PbOddModelEditor extends LitElement {
|
|
|
470
475
|
<div class="predicate">${this.predicate}</div>
|
|
471
476
|
</p>
|
|
472
477
|
</header>
|
|
473
|
-
<
|
|
478
|
+
<details ?open="${this.show}" class="details">
|
|
479
|
+
<summary style="display: none;"></summary>
|
|
474
480
|
<div class="horizontal">
|
|
475
481
|
<paper-dropdown-menu class="selectOutput" label="Output">
|
|
476
482
|
<paper-listbox id="output" slot="dropdown-content" attr-for-selected="value"
|
|
@@ -494,13 +500,13 @@ export class PbOddModelEditor extends LitElement {
|
|
|
494
500
|
<div class="editor">
|
|
495
501
|
<label>Predicate</label>
|
|
496
502
|
<jinn-codemirror id="predicate"
|
|
497
|
-
code="${this.predicate}"
|
|
503
|
+
code="${this.predicate}"
|
|
498
504
|
mode="xquery"
|
|
499
505
|
linter="${this.endpoint}/${cmpVersion(this.apiVersion, '1.0.0') < 0 ? 'modules/editor.xql' : 'api/lint'}"
|
|
500
506
|
placeholder="${translate('odd.editor.model.predicate-placeholder')}"
|
|
501
507
|
@update="${this._updatePredicate}"></jinn-codemirror>
|
|
502
508
|
</div>
|
|
503
|
-
|
|
509
|
+
|
|
504
510
|
${this._isModel()
|
|
505
511
|
? html`
|
|
506
512
|
<div>
|
|
@@ -519,13 +525,13 @@ export class PbOddModelEditor extends LitElement {
|
|
|
519
525
|
<span></span>
|
|
520
526
|
</div>
|
|
521
527
|
|
|
522
|
-
|
|
523
|
-
|
|
528
|
+
|
|
529
|
+
|
|
524
530
|
<paper-input id="css" .value="${this.css}"
|
|
525
531
|
placeholder="${translate('odd.editor.model.css-class-placeholder')}"
|
|
526
532
|
label="CSS Class"
|
|
527
533
|
@change="${this._inputCss}"></paper-input>
|
|
528
|
-
|
|
534
|
+
|
|
529
535
|
<div class="editor">
|
|
530
536
|
<label>Template</label>
|
|
531
537
|
<jinn-codemirror id="template"
|
|
@@ -538,20 +544,20 @@ export class PbOddModelEditor extends LitElement {
|
|
|
538
544
|
title="Select element around current cursor position"><|></paper-button>
|
|
539
545
|
<paper-button data-mode="xml" data-command="encloseWith" data-key="mod-e mod-e"
|
|
540
546
|
title="Enclose selection in new element"><...></paper-button>
|
|
541
|
-
<paper-button data-mode="xml" data-command="removeEnclosing" title="Remove enclosing tags"
|
|
547
|
+
<paper-button data-mode="xml" data-command="removeEnclosing" title="Remove enclosing tags"
|
|
542
548
|
data-key="mod-e mod-r" class="sep"><X></paper-button>
|
|
543
549
|
<paper-button data-mode="html" data-command="selectElement" data-key="mod-e mod-s"
|
|
544
550
|
title="Select element around current cursor position"><|></paper-button>
|
|
545
551
|
<paper-button data-mode="html" data-command="encloseWith" data-key="mod-e mod-e"
|
|
546
552
|
title="Enclose selection in new element"><...></paper-button>
|
|
547
|
-
<paper-button data-mode="html" data-command="removeEnclosing" title="Remove enclosing tags"
|
|
553
|
+
<paper-button data-mode="html" data-command="removeEnclosing" title="Remove enclosing tags"
|
|
548
554
|
data-key="mod-e mod-r" class="sep"><X></paper-button>
|
|
549
555
|
<paper-button data-key="mod-e mod-p" data-command="snippet" data-params="[[\${_}]]" title="Insert template variable">[[...]]</paper-button>
|
|
550
556
|
</div>
|
|
551
557
|
</jinn-codemirror>
|
|
552
558
|
</div>
|
|
553
559
|
</div>
|
|
554
|
-
|
|
560
|
+
|
|
555
561
|
<div class="parameters">
|
|
556
562
|
<div class="group">
|
|
557
563
|
<span class="title">Parameters</span>
|
|
@@ -560,7 +566,7 @@ export class PbOddModelEditor extends LitElement {
|
|
|
560
566
|
</div>
|
|
561
567
|
${repeat(this.parameters, (parameter) => parameter.name, (parameter, index) =>
|
|
562
568
|
html`
|
|
563
|
-
<pb-odd-parameter-editor
|
|
569
|
+
<pb-odd-parameter-editor
|
|
564
570
|
behaviour="${this.behaviour}"
|
|
565
571
|
name="${parameter.name}"
|
|
566
572
|
value="${parameter.value}"
|
|
@@ -597,11 +603,11 @@ export class PbOddModelEditor extends LitElement {
|
|
|
597
603
|
`
|
|
598
604
|
: ''
|
|
599
605
|
}
|
|
600
|
-
</
|
|
601
|
-
|
|
606
|
+
</details>
|
|
607
|
+
|
|
602
608
|
<div class="models">
|
|
603
609
|
${repeat(this.model.models, (model, index) => html`
|
|
604
|
-
<pb-odd-model-editor
|
|
610
|
+
<pb-odd-model-editor
|
|
605
611
|
behaviour="${model.behaviour || 'inline'}"
|
|
606
612
|
predicate="${model.predicate}"
|
|
607
613
|
type="${model.type}"
|
|
@@ -625,9 +631,9 @@ export class PbOddModelEditor extends LitElement {
|
|
|
625
631
|
hasParent
|
|
626
632
|
></pb-odd-model-editor>
|
|
627
633
|
`)}
|
|
628
|
-
|
|
629
|
-
</div>
|
|
630
|
-
</form>
|
|
634
|
+
|
|
635
|
+
</div>
|
|
636
|
+
</form>
|
|
631
637
|
<pb-message id="dialog"></pb-message>
|
|
632
638
|
`;
|
|
633
639
|
}
|
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
|
}
|