@teipublisher/pb-components 2.3.0 → 2.4.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/CHANGELOG.md +19 -0
- package/README.md +3 -3
- package/dist/api.html +1 -1
- package/dist/demo/bundle-test.html +1 -1
- package/dist/demo/dts-client.html +2 -2
- package/dist/demo/pb-autocomplete.html +2 -2
- package/dist/demo/pb-autocomplete2.html +2 -2
- package/dist/demo/pb-autocomplete3.html +1 -1
- package/dist/demo/pb-blacklab-highlight.html +2 -2
- package/dist/demo/pb-blacklab-results.html +2 -2
- package/dist/demo/pb-browse-docs.html +2 -2
- package/dist/demo/pb-browse-docs2.html +2 -2
- package/dist/demo/pb-clipboard.html +2 -2
- package/dist/demo/pb-code-editor.html +2 -4
- package/dist/demo/pb-code-highlight.html +1 -1
- package/dist/demo/pb-codepen.html +1 -1
- package/dist/demo/pb-collapse.html +2 -2
- package/dist/demo/pb-collapse2.html +2 -2
- package/dist/demo/pb-combo-box.html +2 -2
- package/dist/demo/pb-custom-form.html +2 -2
- package/dist/demo/pb-document.html +2 -2
- package/dist/demo/pb-download.html +2 -2
- package/dist/demo/pb-drawer.html +2 -2
- package/dist/demo/pb-drawer2.html +2 -2
- package/dist/demo/pb-edit-app.html +2 -2
- package/dist/demo/pb-edit-xml.html +2 -2
- package/dist/demo/pb-facsimile-2.html +2 -2
- package/dist/demo/pb-facsimile.html +2 -2
- package/dist/demo/pb-formula.html +2 -2
- package/dist/demo/pb-grid.html +2 -2
- package/dist/demo/pb-highlight.html +1 -1
- package/dist/demo/pb-i18n.html +1 -1
- package/dist/demo/pb-image-strip-standalone.html +2 -2
- package/dist/demo/pb-image-strip-view.html +2 -2
- package/dist/demo/pb-leaflet-map.html +2 -2
- package/dist/demo/pb-leaflet-map2.html +2 -2
- package/dist/demo/pb-leaflet-map3.html +2 -2
- package/dist/demo/pb-link.html +2 -2
- package/dist/demo/pb-load.html +2 -2
- package/dist/demo/pb-login.html +2 -2
- package/dist/demo/pb-manage-odds.html +2 -2
- package/dist/demo/pb-markdown.html +2 -2
- package/dist/demo/pb-media-query.html +2 -2
- package/dist/demo/pb-mei.html +2 -2
- package/dist/demo/pb-mei2.html +2 -2
- package/dist/demo/pb-message.html +1 -1
- package/dist/demo/pb-odd-editor.html +2 -2
- package/dist/demo/pb-popover.html +2 -2
- package/dist/demo/pb-print-preview.html +2 -2
- package/dist/demo/pb-progress.html +1 -1
- package/dist/demo/pb-repeat.html +1 -1
- package/dist/demo/pb-search.html +2 -2
- package/dist/demo/pb-search2.html +2 -2
- package/dist/demo/pb-search3.html +2 -2
- package/dist/demo/pb-search4.html +2 -2
- package/dist/demo/pb-select-feature.html +2 -2
- package/dist/demo/pb-select-feature2.html +2 -2
- package/dist/demo/pb-select-feature3.html +2 -2
- package/dist/demo/pb-select-i18n.html +1 -1
- package/dist/demo/pb-select-odd.html +2 -2
- package/dist/demo/pb-select.html +2 -2
- package/dist/demo/pb-select2.html +2 -2
- package/dist/demo/pb-select3.html +2 -2
- package/dist/demo/pb-svg.html +2 -2
- package/dist/demo/pb-table-grid.html +3 -3
- package/dist/demo/pb-tabs.html +2 -2
- package/dist/demo/pb-timeline.html +1 -1
- package/dist/demo/pb-timeline2.html +2 -2
- package/dist/demo/pb-toggle-feature.html +2 -2
- package/dist/demo/pb-toggle-feature2.html +2 -2
- package/dist/demo/pb-toggle-feature3.html +2 -2
- package/dist/demo/pb-version.html +1 -1
- package/dist/demo/pb-view.html +2 -2
- package/dist/demo/pb-view2.html +2 -2
- package/dist/demo/pb-view3.html +2 -2
- package/dist/demo/pb-view4.html +2 -2
- package/dist/demo/pb-zoom.html +2 -2
- package/dist/pb-components-bundle.js +22 -8
- package/dist/pb-elements.json +15 -0
- package/package.json +1 -1
- package/pb-elements.json +15 -0
- package/src/authority/airtable.js +3 -3
- package/src/pb-ajax.js +36 -7
- package/src/pb-manage-odds.js +7 -1
- package/src/pb-page.js +16 -1
- package/src/pb-view.js +3 -3
- package/src/urls.js +23 -4
package/dist/pb-elements.json
CHANGED
|
@@ -8164,9 +8164,16 @@
|
|
|
8164
8164
|
},
|
|
8165
8165
|
{
|
|
8166
8166
|
"name": "url-path",
|
|
8167
|
+
"description": "Is the resource path part of the URL or should it be\nencoded as a parameter? TEI Publisher uses the\nURL path, but the webcomponent demos need to encode the resource path\nin a query parameter.",
|
|
8167
8168
|
"type": "string",
|
|
8168
8169
|
"default": "\"path\""
|
|
8169
8170
|
},
|
|
8171
|
+
{
|
|
8172
|
+
"name": "id-hash",
|
|
8173
|
+
"description": "If enabled, a hash in the URL (e.g. documentation.xml#introduction) will\nbe interpreted as an xml:id to navigate to when talking to the server.",
|
|
8174
|
+
"type": "boolean",
|
|
8175
|
+
"default": "false"
|
|
8176
|
+
},
|
|
8170
8177
|
{
|
|
8171
8178
|
"name": "api-version",
|
|
8172
8179
|
"type": "string",
|
|
@@ -8266,9 +8273,17 @@
|
|
|
8266
8273
|
{
|
|
8267
8274
|
"name": "urlPath",
|
|
8268
8275
|
"attribute": "url-path",
|
|
8276
|
+
"description": "Is the resource path part of the URL or should it be\nencoded as a parameter? TEI Publisher uses the\nURL path, but the webcomponent demos need to encode the resource path\nin a query parameter.",
|
|
8269
8277
|
"type": "string",
|
|
8270
8278
|
"default": "\"path\""
|
|
8271
8279
|
},
|
|
8280
|
+
{
|
|
8281
|
+
"name": "idHash",
|
|
8282
|
+
"attribute": "id-hash",
|
|
8283
|
+
"description": "If enabled, a hash in the URL (e.g. documentation.xml#introduction) will\nbe interpreted as an xml:id to navigate to when talking to the server.",
|
|
8284
|
+
"type": "boolean",
|
|
8285
|
+
"default": "false"
|
|
8286
|
+
},
|
|
8272
8287
|
{
|
|
8273
8288
|
"name": "apiVersion",
|
|
8274
8289
|
"attribute": "api-version",
|
package/package.json
CHANGED
package/pb-elements.json
CHANGED
|
@@ -8164,9 +8164,16 @@
|
|
|
8164
8164
|
},
|
|
8165
8165
|
{
|
|
8166
8166
|
"name": "url-path",
|
|
8167
|
+
"description": "Is the resource path part of the URL or should it be\nencoded as a parameter? TEI Publisher uses the\nURL path, but the webcomponent demos need to encode the resource path\nin a query parameter.",
|
|
8167
8168
|
"type": "string",
|
|
8168
8169
|
"default": "\"path\""
|
|
8169
8170
|
},
|
|
8171
|
+
{
|
|
8172
|
+
"name": "id-hash",
|
|
8173
|
+
"description": "If enabled, a hash in the URL (e.g. documentation.xml#introduction) will\nbe interpreted as an xml:id to navigate to when talking to the server.",
|
|
8174
|
+
"type": "boolean",
|
|
8175
|
+
"default": "false"
|
|
8176
|
+
},
|
|
8170
8177
|
{
|
|
8171
8178
|
"name": "api-version",
|
|
8172
8179
|
"type": "string",
|
|
@@ -8266,9 +8273,17 @@
|
|
|
8266
8273
|
{
|
|
8267
8274
|
"name": "urlPath",
|
|
8268
8275
|
"attribute": "url-path",
|
|
8276
|
+
"description": "Is the resource path part of the URL or should it be\nencoded as a parameter? TEI Publisher uses the\nURL path, but the webcomponent demos need to encode the resource path\nin a query parameter.",
|
|
8269
8277
|
"type": "string",
|
|
8270
8278
|
"default": "\"path\""
|
|
8271
8279
|
},
|
|
8280
|
+
{
|
|
8281
|
+
"name": "idHash",
|
|
8282
|
+
"attribute": "id-hash",
|
|
8283
|
+
"description": "If enabled, a hash in the URL (e.g. documentation.xml#introduction) will\nbe interpreted as an xml:id to navigate to when talking to the server.",
|
|
8284
|
+
"type": "boolean",
|
|
8285
|
+
"default": "false"
|
|
8286
|
+
},
|
|
8272
8287
|
{
|
|
8273
8288
|
"name": "apiVersion",
|
|
8274
8289
|
"attribute": "api-version",
|
|
@@ -46,7 +46,7 @@ export class Airtable extends Registry {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
this.tokenizeChars = configElem.getAttribute('tokenize-regex') || "\\W";
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
this.infoExpr = getTemplate(configElem, '.info');
|
|
51
51
|
this.detailExpr = getTemplate(configElem, '.detail');
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@ export class Airtable extends Registry {
|
|
|
55
55
|
|
|
56
56
|
_init() {
|
|
57
57
|
window.ESGlobalBridge.requestAvailability();
|
|
58
|
-
const path = resolveURL('https://
|
|
58
|
+
const path = resolveURL('https://cdn.jsdelivr.net/npm/airtable@0.11.1/build/airtable.browser.js');
|
|
59
59
|
window.ESGlobalBridge.instance.load('airtable', path);
|
|
60
60
|
window.addEventListener(
|
|
61
61
|
'es-bridge-airtable-loaded',
|
|
@@ -140,7 +140,7 @@ export class Airtable extends Registry {
|
|
|
140
140
|
}
|
|
141
141
|
let strings = [];
|
|
142
142
|
const data = {};
|
|
143
|
-
this.fields.forEach((field) => {
|
|
143
|
+
this.fields.forEach((field) => {
|
|
144
144
|
const value = record.get(field);
|
|
145
145
|
if (value) {
|
|
146
146
|
data[field] = value;
|
package/src/pb-ajax.js
CHANGED
|
@@ -16,10 +16,10 @@ import './pb-message.js';
|
|
|
16
16
|
*
|
|
17
17
|
* @slot - unnamed slot for link content
|
|
18
18
|
* @slot title - dialog title
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
20
|
* @fires pb-start-update - Fired before the element updates its content
|
|
21
|
-
* @fires pb-end-update - Fired after the element has finished updating its content
|
|
22
|
-
* @fires pb-update - When received, copies request parameters from the event
|
|
21
|
+
* @fires pb-end-update - Fired after the element has finished updating its content
|
|
22
|
+
* @fires pb-update - When received, copies request parameters from the event
|
|
23
23
|
|
|
24
24
|
*/
|
|
25
25
|
export class PbAjax extends pbMixin(LitElement) {
|
|
@@ -95,6 +95,7 @@ export class PbAjax extends pbMixin(LitElement) {
|
|
|
95
95
|
@response="${this._handleResponse}"></iron-ajax>
|
|
96
96
|
<pb-message id="confirmDialog"></pb-message>
|
|
97
97
|
<slot name="title" style="display: none"></slot>
|
|
98
|
+
<progress id="progress" max="100"></progress>
|
|
98
99
|
`;
|
|
99
100
|
}
|
|
100
101
|
|
|
@@ -103,6 +104,8 @@ export class PbAjax extends pbMixin(LitElement) {
|
|
|
103
104
|
const slot = this.shadowRoot.querySelector('slot[name=title]');
|
|
104
105
|
this._dialogTitle = '';
|
|
105
106
|
slot.assignedNodes().forEach(node => {this._dialogTitle += node.innerHTML});
|
|
107
|
+
this.button = this.querySelector('paper-button');
|
|
108
|
+
this.progress = this.shadowRoot.querySelector('progress');
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
static get styles() {
|
|
@@ -113,6 +116,13 @@ export class PbAjax extends pbMixin(LitElement) {
|
|
|
113
116
|
slot[name="title"] {
|
|
114
117
|
margin: 0;
|
|
115
118
|
}
|
|
119
|
+
progress{
|
|
120
|
+
width: 100%;
|
|
121
|
+
opacity: 0;
|
|
122
|
+
}
|
|
123
|
+
progress.running{
|
|
124
|
+
opacity: 1;
|
|
125
|
+
}
|
|
116
126
|
`;
|
|
117
127
|
}
|
|
118
128
|
|
|
@@ -127,15 +137,33 @@ export class PbAjax extends pbMixin(LitElement) {
|
|
|
127
137
|
this.trigger();
|
|
128
138
|
}
|
|
129
139
|
}
|
|
130
|
-
|
|
131
|
-
trigger() {
|
|
140
|
+
|
|
141
|
+
async trigger() {
|
|
142
|
+
this._disable();
|
|
132
143
|
const loader = this.shadowRoot.getElementById('loadContent');
|
|
133
144
|
loader.url = `${this.getEndpoint()}/${this.url}`;
|
|
134
145
|
this.emitTo('pb-start-update');
|
|
135
|
-
this.shadowRoot.getElementById('loadContent').generateRequest();
|
|
146
|
+
await this.shadowRoot.getElementById('loadContent').generateRequest();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
_enable(){
|
|
150
|
+
if(this.button){
|
|
151
|
+
this.button.removeAttribute('disabled');
|
|
152
|
+
this.button.removeAttribute('readonly');
|
|
153
|
+
this.progress.classList.remove('running');
|
|
154
|
+
}
|
|
136
155
|
}
|
|
156
|
+
_disable(){
|
|
157
|
+
if(this.button){
|
|
158
|
+
this.button.setAttribute('disabled','disabled');
|
|
159
|
+
this.button.setAttribute('readonly','readonly');
|
|
160
|
+
this.progress.classList.add('running');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
137
164
|
|
|
138
165
|
_handleResponse() {
|
|
166
|
+
this._enable();
|
|
139
167
|
const resp = this.shadowRoot.getElementById('loadContent').lastResponse;
|
|
140
168
|
this._message = resp;
|
|
141
169
|
if (!this.quiet) {
|
|
@@ -151,6 +179,7 @@ export class PbAjax extends pbMixin(LitElement) {
|
|
|
151
179
|
}
|
|
152
180
|
|
|
153
181
|
_handleError() {
|
|
182
|
+
this._enable();
|
|
154
183
|
const loader = this.shadowRoot.getElementById('loadContent');
|
|
155
184
|
const msg = loader.lastError.response;
|
|
156
185
|
const parser = new DOMParser();
|
|
@@ -170,4 +199,4 @@ export class PbAjax extends pbMixin(LitElement) {
|
|
|
170
199
|
this.shadowRoot.getElementById('loadContent').params = ev.detail.params;
|
|
171
200
|
}
|
|
172
201
|
}
|
|
173
|
-
customElements.define('pb-ajax', PbAjax);
|
|
202
|
+
customElements.define('pb-ajax', PbAjax);
|
package/src/pb-manage-odds.js
CHANGED
|
@@ -205,7 +205,7 @@ export class PbManageOdds extends pbMixin(LitElement) {
|
|
|
205
205
|
<pb-ajax id="regenerateAll" url="${regenUrl}" method="post" title="${translate('odd.manage.regenerate-all')}"
|
|
206
206
|
emit="${this.emit ? this.emit : ''}" .emitConfig="${this.emitConfig}">
|
|
207
207
|
<h3 slot="title">${translate('odd.manage.regenerate-all')}</h3>
|
|
208
|
-
<a href="#">${translate('odd.manage.regenerate-all')}</a>
|
|
208
|
+
<paper-button raised="raised"><a href="#">${translate('odd.manage.regenerate-all')}</a></paper-button>
|
|
209
209
|
</pb-ajax>
|
|
210
210
|
</pb-restricted>
|
|
211
211
|
${this.odds.map((odd) =>
|
|
@@ -329,6 +329,12 @@ export class PbManageOdds extends pbMixin(LitElement) {
|
|
|
329
329
|
margin-top: 10px;
|
|
330
330
|
text-align: right;
|
|
331
331
|
}
|
|
332
|
+
|
|
333
|
+
#regenerateAll a{
|
|
334
|
+
text-decoration: none;
|
|
335
|
+
color: inherit;
|
|
336
|
+
}
|
|
337
|
+
|
|
332
338
|
[icon]{
|
|
333
339
|
color:var(--pb-manage-odds-icon-color);
|
|
334
340
|
}
|
package/src/pb-page.js
CHANGED
|
@@ -39,10 +39,24 @@ export class PbPage extends pbMixin(LitElement) {
|
|
|
39
39
|
type: String,
|
|
40
40
|
attribute: 'app-root'
|
|
41
41
|
},
|
|
42
|
+
/**
|
|
43
|
+
* Is the resource path part of the URL or should it be
|
|
44
|
+
* encoded as a parameter? TEI Publisher uses the
|
|
45
|
+
* URL path, but the webcomponent demos need to encode the resource path
|
|
46
|
+
* in a query parameter.
|
|
47
|
+
*/
|
|
42
48
|
urlPath: {
|
|
43
49
|
type: String,
|
|
44
50
|
attribute: 'url-path'
|
|
45
51
|
},
|
|
52
|
+
/**
|
|
53
|
+
* If enabled, a hash in the URL (e.g. documentation.xml#introduction) will
|
|
54
|
+
* be interpreted as an xml:id to navigate to when talking to the server.
|
|
55
|
+
*/
|
|
56
|
+
idHash: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
attribute: 'id-hash'
|
|
59
|
+
},
|
|
46
60
|
/**
|
|
47
61
|
* TEI Publisher internal: set to the current page template.
|
|
48
62
|
*/
|
|
@@ -148,6 +162,7 @@ export class PbPage extends pbMixin(LitElement) {
|
|
|
148
162
|
this.unresolved = true;
|
|
149
163
|
this.endpoint = ".";
|
|
150
164
|
this.urlPath = 'path';
|
|
165
|
+
this.idHash = false;
|
|
151
166
|
this.apiVersion = undefined;
|
|
152
167
|
this.requireLanguage = false;
|
|
153
168
|
this.theme = null;
|
|
@@ -189,7 +204,7 @@ export class PbPage extends pbMixin(LitElement) {
|
|
|
189
204
|
this.appRoot = window.location.pathname;
|
|
190
205
|
}
|
|
191
206
|
|
|
192
|
-
registry.configure(this.urlPath === 'path', this.appRoot);
|
|
207
|
+
registry.configure(this.urlPath === 'path', this.idHash, this.appRoot);
|
|
193
208
|
|
|
194
209
|
this.endpoint = this.endpoint.replace(/\/+$/, '');
|
|
195
210
|
|
package/src/pb-view.js
CHANGED
|
@@ -907,13 +907,13 @@ export class PbView extends themableMixin(pbMixin(LitElement)) {
|
|
|
907
907
|
if (this.noScroll) {
|
|
908
908
|
return;
|
|
909
909
|
}
|
|
910
|
-
if (registry.
|
|
911
|
-
const target = this.shadowRoot.getElementById(registry.
|
|
910
|
+
if (registry.hash) {
|
|
911
|
+
const target = this.shadowRoot.getElementById(registry.hash.substring(1));
|
|
912
912
|
console.log('hash target: %o', target);
|
|
913
913
|
if (target) {
|
|
914
914
|
window.requestAnimationFrame(() =>
|
|
915
915
|
setTimeout(() => {
|
|
916
|
-
target.scrollIntoView({block:
|
|
916
|
+
target.scrollIntoView({ block: "center", inline: "nearest" });
|
|
917
917
|
}, 400)
|
|
918
918
|
);
|
|
919
919
|
}
|
package/src/urls.js
CHANGED
|
@@ -36,6 +36,11 @@ class Registry {
|
|
|
36
36
|
|
|
37
37
|
constructor() {
|
|
38
38
|
this.rootPath = '';
|
|
39
|
+
/**
|
|
40
|
+
* Is the resource path part of the URL path or is it
|
|
41
|
+
* passed in a query parameter?
|
|
42
|
+
*/
|
|
43
|
+
this.usePath = false;
|
|
39
44
|
/**
|
|
40
45
|
* Records current state as determined from parsing the URL.
|
|
41
46
|
* This should be used to initialize components.
|
|
@@ -46,12 +51,21 @@ class Registry {
|
|
|
46
51
|
* if a component calls commit or replace.
|
|
47
52
|
*/
|
|
48
53
|
this.channelStates = {};
|
|
54
|
+
/**
|
|
55
|
+
* Records the hash part of the URL, if any
|
|
56
|
+
*/
|
|
57
|
+
this.hash = null;
|
|
58
|
+
/**
|
|
59
|
+
* Should a hash in the URL be interpreted as an xml:id for loading the content?
|
|
60
|
+
*/
|
|
61
|
+
this.idHash = true;
|
|
49
62
|
this._listeners = [];
|
|
50
63
|
}
|
|
51
64
|
|
|
52
|
-
configure(usePath = true, rootPath = '') {
|
|
65
|
+
configure(usePath = true, idHash = false, rootPath = '') {
|
|
53
66
|
this.rootPath = rootPath;
|
|
54
67
|
this.usePath = usePath;
|
|
68
|
+
this.idHash = idHash;
|
|
55
69
|
|
|
56
70
|
// determine initial state of the registry by parsing current URL
|
|
57
71
|
const initialState = this._stateFromURL();
|
|
@@ -92,8 +106,11 @@ class Registry {
|
|
|
92
106
|
|
|
93
107
|
_stateFromURL() {
|
|
94
108
|
const params = {};
|
|
95
|
-
|
|
96
|
-
|
|
109
|
+
this.hash = window.location.hash;
|
|
110
|
+
// use the hash as an xml:id?
|
|
111
|
+
// hashs of the form #1.2.3.4 are internal eXist ids though and thus excluded
|
|
112
|
+
if (this.idHash && this.hash.length > 0 && (!/^#\d+\./.test(this.hash))) {
|
|
113
|
+
params.id = this.hash.substring(1);
|
|
97
114
|
}
|
|
98
115
|
if (this.usePath) {
|
|
99
116
|
params.path = window.location.pathname.replace(new RegExp(`^${this.rootPath}/?`), '');
|
|
@@ -216,7 +233,9 @@ class Registry {
|
|
|
216
233
|
newUrl.pathname = `${this.rootPath}/${this.state.path}`;
|
|
217
234
|
}
|
|
218
235
|
|
|
219
|
-
|
|
236
|
+
if (this.state.id) {
|
|
237
|
+
newUrl.hash = `#${this.state.id}`;
|
|
238
|
+
}
|
|
220
239
|
|
|
221
240
|
console.log('urlFromState', newUrl.searchParams.toString())
|
|
222
241
|
return newUrl;
|