@teipublisher/pb-components 1.43.5 → 1.44.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/.github/workflows/main.yml +21 -0
- package/CHANGELOG.md +7 -0
- package/dist/demo/pb-table-grid.html +16 -16
- package/dist/demo/pb-view2.html +135 -135
- package/dist/demo/redirect.html +3 -0
- package/dist/pb-code-editor.js +1 -1
- package/dist/pb-components-bundle.js +95 -104
- package/dist/pb-edit-app.js +1 -1
- package/dist/pb-elements.json +1009 -690
- package/dist/{pb-i18n-dc551878.js → pb-i18n-3963b098.js} +1 -1
- package/dist/pb-leaflet-map.js +1 -1
- package/dist/pb-odd-editor.js +1 -1
- package/dist/{pb-message-fbc1b645.js → vaadin-element-mixin-08cf11b5.js} +21 -19
- package/gh-pages.js +23 -0
- package/i18n/common/en.json +7 -2
- package/package.json +5 -3
- package/pb-elements.json +1009 -690
- package/src/pb-ajax.js +37 -19
- package/src/pb-browse-docs.js +520 -520
- package/src/pb-browse.js +77 -0
- package/src/pb-components.js +1 -0
- package/src/pb-message.js +6 -10
- package/src/pb-mixin.js +542 -542
- package/src/pb-page.js +399 -399
- package/src/pb-split-list.js +188 -188
- package/src/pb-table-grid.js +218 -218
- package/src/pb-view.js +1366 -1366
- /package/dist/{pb-mixin-f8b22e51.js → pb-mixin-88125cb2.js} +0 -0
package/src/pb-browse.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { PbLoad } from './pb-load.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extends PbLoad to support browsing collections.
|
|
5
|
+
*
|
|
6
|
+
* This is a reduced version of `pb-browse-docs`, which differs
|
|
7
|
+
* from a plain `pb-load` only in that it scans the returned
|
|
8
|
+
* collection listing for links to subcollections and keeps
|
|
9
|
+
* track of the current collection.
|
|
10
|
+
*
|
|
11
|
+
* All UI elements present in `pb-browse-docs` have been removed.
|
|
12
|
+
*/
|
|
13
|
+
export class PbBrowse extends PbLoad {
|
|
14
|
+
|
|
15
|
+
static get properties() {
|
|
16
|
+
return {
|
|
17
|
+
...super.properties,
|
|
18
|
+
/** The collection currently being browsed (if any) */
|
|
19
|
+
collection: {
|
|
20
|
+
type: String
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* If set, rewrite URLs to load pages as static HTML files,
|
|
24
|
+
* so no TEI Publisher instance is required
|
|
25
|
+
*/
|
|
26
|
+
static: {
|
|
27
|
+
type: Boolean
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
this.collection = null;
|
|
35
|
+
this.static = false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
connectedCallback() {
|
|
39
|
+
super.connectedCallback();
|
|
40
|
+
this.collection = this.getParameter('collection');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getURL(params) {
|
|
44
|
+
if (this.static) {
|
|
45
|
+
// use a static URL
|
|
46
|
+
return `collections/${this.collection ? this.collection + '/' : ''}${params.start || '1'}.html`;
|
|
47
|
+
}
|
|
48
|
+
const url = super.getURL(params);
|
|
49
|
+
return this.collection ? `${url}/${this.collection}` : url;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_onLoad(content) {
|
|
53
|
+
window.scrollTo(0, 0);
|
|
54
|
+
const div = content.querySelector('[data-root]');
|
|
55
|
+
const collection = div && div.getAttribute('data-root');
|
|
56
|
+
const writable = div && div.classList.contains('writable');
|
|
57
|
+
this.emitTo('pb-collection', {
|
|
58
|
+
writable,
|
|
59
|
+
collection
|
|
60
|
+
});
|
|
61
|
+
document.querySelectorAll('[can-write]').forEach((elem) => {
|
|
62
|
+
elem.disabled = !writable;
|
|
63
|
+
});
|
|
64
|
+
content.querySelectorAll('[data-collection]').forEach(link => {
|
|
65
|
+
link.addEventListener('click', (ev) => {
|
|
66
|
+
ev.preventDefault();
|
|
67
|
+
this.collection = link.getAttribute('data-collection');
|
|
68
|
+
this.start = 1;
|
|
69
|
+
this.setParameter('collection', this.collection);
|
|
70
|
+
this.pushHistory('browse collection');
|
|
71
|
+
console.log('<pb-browse> loading collection %s', this.collection);
|
|
72
|
+
this.emitTo('pb-search-resubmit');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
customElements.define('pb-browse', PbBrowse);
|
package/src/pb-components.js
CHANGED
package/src/pb-message.js
CHANGED
|
@@ -6,13 +6,7 @@ import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
|
6
6
|
import { translate } from "./pb-i18n.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Show a dialog with buttons. Used by editor.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* todo:confirmation is only partly implemented needs some method to detect which button was clicked
|
|
13
|
-
* @customElement
|
|
14
|
-
* @polymer
|
|
15
|
-
* @demo demo/pb-message.html
|
|
9
|
+
* Show a dialog with buttons. Used by ODD editor.
|
|
16
10
|
*/
|
|
17
11
|
export class PbMessage extends LitElement {
|
|
18
12
|
|
|
@@ -58,14 +52,16 @@ export class PbMessage extends LitElement {
|
|
|
58
52
|
super();
|
|
59
53
|
this.title = '';
|
|
60
54
|
this.message = '';
|
|
61
|
-
this.type = 'message'; //defaults to 'message'
|
|
55
|
+
this.type = 'message'; // defaults to 'message'
|
|
62
56
|
}
|
|
63
57
|
|
|
64
58
|
render() {
|
|
65
59
|
return html`
|
|
66
60
|
<paper-dialog id="modal">
|
|
67
|
-
<h2 id="title">${this.title}</h2>
|
|
68
|
-
<paper-dialog-scrollable id="message" class="message" tabindex="0"
|
|
61
|
+
<h2 id="title">${unsafeHTML(this.title)}</h2>
|
|
62
|
+
<paper-dialog-scrollable id="message" class="message" tabindex="0">
|
|
63
|
+
${ this.message ? unsafeHTML(this.message) : html`<slot></slot>` }
|
|
64
|
+
</paper-dialog-scrollable>
|
|
69
65
|
|
|
70
66
|
<div class="buttons">
|
|
71
67
|
<paper-button dialog-confirm="dialog-confirm" autofocus="autofocus" ?hidden="${this.isConfirm()}">${translate('dialogs.close')}</paper-button>
|