@teipublisher/pb-components 2.26.0-next-3.12 → 2.26.0-next-3.14

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.
Files changed (136) hide show
  1. package/.github/workflows/main.yml +3 -3
  2. package/.github/workflows/node.js.yml +3 -3
  3. package/.github/workflows/release.js.yml +3 -3
  4. package/CHANGELOG.md +43 -0
  5. package/Dockerfile +78 -70
  6. package/css/components.css +5 -5
  7. package/dist/demo/pb-drawer2.html +1 -1
  8. package/dist/demo/pb-grid.html +19 -6
  9. package/dist/demo/pb-leaflet-map.html +1 -1
  10. package/dist/demo/pb-progress.html +2 -2
  11. package/dist/demo/pb-repeat.html +1 -3
  12. package/dist/demo/pb-view3.html +1 -1
  13. package/dist/{iron-form-277f9d42.js → iron-form-78b43d38.js} +1 -1
  14. package/dist/{paper-checkbox-4f410b1f.js → paper-checkbox-d16f23be.js} +44 -44
  15. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-2cd9e0b4.js} +3 -3
  16. package/dist/{paper-listbox-c2468542.js → paper-listbox-2ad5c882.js} +7 -7
  17. package/dist/pb-code-editor.js +25 -20
  18. package/dist/pb-component-docs.js +58 -54
  19. package/dist/pb-components-bundle.js +2057 -2351
  20. package/dist/pb-edit-app.js +167 -107
  21. package/dist/pb-elements.json +45 -45
  22. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  23. package/dist/pb-leaflet-map.js +23 -23
  24. package/dist/pb-mei.js +56 -41
  25. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  26. package/dist/pb-odd-editor.js +923 -756
  27. package/dist/pb-tify.js +2 -2
  28. package/dist/{vaadin-element-mixin-49ab4037.js → vaadin-element-mixin-c200b196.js} +179 -164
  29. package/gh-pages.js +5 -3
  30. package/i18n/common/pl.json +2 -2
  31. package/lib/openseadragon.min.js +1 -1
  32. package/package.json +2 -2
  33. package/pb-elements.json +45 -45
  34. package/src/assets/components.css +5 -5
  35. package/src/authority/airtable.js +20 -21
  36. package/src/authority/anton.js +129 -129
  37. package/src/authority/custom.js +23 -21
  38. package/src/authority/geonames.js +38 -32
  39. package/src/authority/gnd.js +47 -42
  40. package/src/authority/kbga.js +137 -134
  41. package/src/authority/metagrid.js +44 -46
  42. package/src/authority/reconciliation.js +66 -67
  43. package/src/authority/registry.js +4 -4
  44. package/src/docs/pb-component-docs.js +2 -2
  45. package/src/docs/pb-component-view.js +5 -5
  46. package/src/docs/pb-components-list.js +2 -2
  47. package/src/docs/pb-demo-snippet.js +2 -2
  48. package/src/dts-client.js +299 -297
  49. package/src/dts-select-endpoint.js +90 -82
  50. package/src/parse-date-service.js +184 -135
  51. package/src/pb-ajax.js +150 -146
  52. package/src/pb-authority-lookup.js +183 -146
  53. package/src/pb-autocomplete.js +292 -280
  54. package/src/pb-blacklab-highlight.js +264 -259
  55. package/src/pb-blacklab-results.js +236 -221
  56. package/src/pb-browse-docs.js +540 -475
  57. package/src/pb-browse.js +68 -65
  58. package/src/pb-clipboard.js +79 -76
  59. package/src/pb-code-editor.js +110 -102
  60. package/src/pb-code-highlight.js +209 -204
  61. package/src/pb-codepen.js +79 -72
  62. package/src/pb-collapse.js +212 -207
  63. package/src/pb-combo-box.js +190 -190
  64. package/src/pb-components-bundle.js +1 -1
  65. package/src/pb-custom-form.js +151 -149
  66. package/src/pb-dialog.js +94 -85
  67. package/src/pb-document.js +89 -90
  68. package/src/pb-download.js +210 -198
  69. package/src/pb-drawer.js +145 -148
  70. package/src/pb-edit-app.js +301 -229
  71. package/src/pb-edit-xml.js +98 -96
  72. package/src/pb-events.js +114 -107
  73. package/src/pb-facs-link.js +104 -102
  74. package/src/pb-facsimile.js +419 -414
  75. package/src/pb-formula.js +151 -153
  76. package/src/pb-geolocation.js +129 -131
  77. package/src/pb-grid-action.js +53 -56
  78. package/src/pb-grid.js +231 -228
  79. package/src/pb-highlight.js +140 -140
  80. package/src/pb-hotkeys.js +40 -42
  81. package/src/pb-i18n.js +101 -104
  82. package/src/pb-image-strip.js +84 -78
  83. package/src/pb-lang.js +132 -128
  84. package/src/pb-leaflet-map.js +488 -485
  85. package/src/pb-link.js +126 -124
  86. package/src/pb-load.js +431 -426
  87. package/src/pb-login.js +291 -248
  88. package/src/pb-manage-odds.js +364 -318
  89. package/src/pb-map-icon.js +89 -89
  90. package/src/pb-map-layer.js +85 -85
  91. package/src/pb-markdown.js +90 -99
  92. package/src/pb-media-query.js +74 -72
  93. package/src/pb-mei.js +306 -295
  94. package/src/pb-message.js +144 -144
  95. package/src/pb-mixin.js +269 -264
  96. package/src/pb-navigation.js +80 -82
  97. package/src/pb-observable.js +38 -38
  98. package/src/pb-odd-editor.js +1053 -955
  99. package/src/pb-odd-elementspec-editor.js +348 -297
  100. package/src/pb-odd-model-editor.js +1061 -901
  101. package/src/pb-odd-parameter-editor.js +200 -178
  102. package/src/pb-odd-rendition-editor.js +136 -124
  103. package/src/pb-page.js +431 -421
  104. package/src/pb-paginate.js +202 -190
  105. package/src/pb-panel.js +198 -182
  106. package/src/pb-popover-themes.js +7 -5
  107. package/src/pb-popover.js +296 -287
  108. package/src/pb-print-preview.js +127 -127
  109. package/src/pb-progress.js +51 -51
  110. package/src/pb-repeat.js +105 -104
  111. package/src/pb-restricted.js +84 -77
  112. package/src/pb-search.js +252 -241
  113. package/src/pb-select-feature.js +127 -120
  114. package/src/pb-select-odd.js +132 -124
  115. package/src/pb-select-template.js +89 -78
  116. package/src/pb-select.js +251 -227
  117. package/src/pb-split-list.js +179 -174
  118. package/src/pb-svg.js +80 -79
  119. package/src/pb-table-column.js +54 -54
  120. package/src/pb-table-grid.js +221 -203
  121. package/src/pb-tabs.js +61 -63
  122. package/src/pb-tify.js +154 -154
  123. package/src/pb-timeline.js +271 -229
  124. package/src/pb-toggle-feature.js +182 -175
  125. package/src/pb-upload.js +184 -174
  126. package/src/pb-version.js +30 -30
  127. package/src/pb-view-annotate.js +132 -98
  128. package/src/pb-view.js +1290 -1270
  129. package/src/pb-zoom.js +75 -59
  130. package/src/polymer-hack.js +1 -1
  131. package/src/search-result-service.js +256 -223
  132. package/src/seed-element.js +13 -20
  133. package/src/settings.js +4 -4
  134. package/src/theming.js +96 -96
  135. package/src/urls.js +289 -289
  136. package/src/utils.js +53 -51
package/src/pb-select.js CHANGED
@@ -1,12 +1,11 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
- import "@polymer/paper-dropdown-menu/paper-dropdown-menu";
3
- import "@polymer/paper-listbox";
4
- import "@polymer/paper-item";
5
- import "@polymer/iron-label/iron-label.js";
6
- import { translate } from "./pb-i18n.js";
2
+ import '@polymer/paper-dropdown-menu/paper-dropdown-menu';
3
+ import '@polymer/paper-listbox';
4
+ import '@polymer/paper-item';
5
+ import '@polymer/iron-label/iron-label.js';
6
+ import { translate } from './pb-i18n.js';
7
7
  import { pbMixin, waitOnce } from './pb-mixin.js';
8
8
 
9
-
10
9
  /**
11
10
  * Replacement for an HTML select element with additional features:
12
11
  *
@@ -19,256 +18,281 @@ import { pbMixin, waitOnce } from './pb-mixin.js';
19
18
  * @csspart label - the label shown above a multi-selection box (does not apply to single-selection)
20
19
  */
21
20
  export class PbSelect extends pbMixin(LitElement) {
22
- static get properties() {
23
- return {
24
- /**
25
- * Label to display above the select or inside if nothing is selected
26
- */
27
- label: {
28
- type: String
29
- },
30
- /**
31
- * Initial value to select. If not set, no item will be selected
32
- */
33
- value: {
34
- type: String,
35
- reflect: true
36
- },
37
- /**
38
- * If `multi` is set, specify initial values via this property
39
- * instead of using `value`
40
- */
41
- values: {
42
- type: Array,
43
- reflect: true
44
- },
45
- /**
46
- * name used when submitted inside a form
47
- */
48
- name: {
49
- type: String
50
- },
51
- /**
52
- * Optional URL to query for suggestions. If relative, it is interpreted
53
- * relative to the endpoint defined on a surrounding `pb-page`.
54
- */
55
- source: {
56
- type: String
57
- },
58
- multi: {
59
- type: Boolean
60
- },
61
- _items: {
62
- type: Array
63
- },
64
- _selected: {
65
- type: Array
66
- },
67
- ...super.properties
68
- };
69
- }
21
+ static get properties() {
22
+ return {
23
+ /**
24
+ * Label to display above the select or inside if nothing is selected
25
+ */
26
+ label: {
27
+ type: String,
28
+ },
29
+ /**
30
+ * Initial value to select. If not set, no item will be selected
31
+ */
32
+ value: {
33
+ type: String,
34
+ reflect: true,
35
+ },
36
+ /**
37
+ * If `multi` is set, specify initial values via this property
38
+ * instead of using `value`
39
+ */
40
+ values: {
41
+ type: Array,
42
+ reflect: true,
43
+ },
44
+ /**
45
+ * name used when submitted inside a form
46
+ */
47
+ name: {
48
+ type: String,
49
+ },
50
+ /**
51
+ * Optional URL to query for suggestions. If relative, it is interpreted
52
+ * relative to the endpoint defined on a surrounding `pb-page`.
53
+ */
54
+ source: {
55
+ type: String,
56
+ },
57
+ multi: {
58
+ type: Boolean,
59
+ },
60
+ _items: {
61
+ type: Array,
62
+ },
63
+ _selected: {
64
+ type: Array,
65
+ },
66
+ ...super.properties,
67
+ };
68
+ }
70
69
 
71
- constructor() {
72
- super();
73
- this.value = null;
74
- this.values = [];
75
- this._items = [];
76
- this._selected = [];
77
- this._inIronForm = false;
78
- }
70
+ constructor() {
71
+ super();
72
+ this.value = null;
73
+ this.values = [];
74
+ this._items = [];
75
+ this._selected = [];
76
+ this._inIronForm = false;
77
+ }
79
78
 
80
- connectedCallback() {
81
- super.connectedCallback();
79
+ connectedCallback() {
80
+ super.connectedCallback();
82
81
 
83
- this.subscribeTo('pb-i18n-update', this._refresh.bind(this));
84
- // in multi-select mode, copy any value set via 'value' to 'values'
85
- if (this.multi) {
86
- if (this.values.length === 0 && this.value) {
87
- this.values = [this.value];
88
- }
89
- // delete this.value so it is not picked up by iron-form
90
- this.value = undefined;
91
- }
82
+ this.subscribeTo('pb-i18n-update', this._refresh.bind(this));
83
+ // in multi-select mode, copy any value set via 'value' to 'values'
84
+ if (this.multi) {
85
+ if (this.values.length === 0 && this.value) {
86
+ this.values = [this.value];
87
+ }
88
+ // delete this.value so it is not picked up by iron-form
89
+ this.value = undefined;
92
90
  }
91
+ }
93
92
 
94
- firstUpdated() {
95
- super.firstUpdated();
93
+ firstUpdated() {
94
+ super.firstUpdated();
96
95
 
97
- this._inIronForm = this.closest('iron-form, pb-search,pb-custom-form');
96
+ this._inIronForm = this.closest('iron-form, pb-search,pb-custom-form');
98
97
 
99
- const slot = this.shadowRoot.querySelector('[name="subform"]');
100
- if (slot) {
101
- slot.assignedNodes().forEach((node) => {
102
- if (this.name) {
103
- node.addEventListener('change', this._loadRemote.bind(this));
104
- }
105
- const inputs = node.querySelectorAll('[name]');
106
- inputs.forEach((input) => {
107
- input.addEventListener('change', this._loadRemote.bind(this));
108
- });
109
- });
98
+ const slot = this.shadowRoot.querySelector('[name="subform"]');
99
+ if (slot) {
100
+ slot.assignedNodes().forEach(node => {
101
+ if (this.name) {
102
+ node.addEventListener('change', this._loadRemote.bind(this));
110
103
  }
111
- waitOnce('pb-page-ready', () => {
112
- this._loadRemote();
104
+ const inputs = node.querySelectorAll('[name]');
105
+ inputs.forEach(input => {
106
+ input.addEventListener('change', this._loadRemote.bind(this));
113
107
  });
108
+ });
114
109
  }
110
+ waitOnce('pb-page-ready', () => {
111
+ this._loadRemote();
112
+ });
113
+ }
115
114
 
116
- _refresh() {
117
- const listbox = this.shadowRoot.getElementById('list');
118
- if (listbox) {
119
- setTimeout(() => {
120
- const old = listbox.selected;
121
- listbox.selected = undefined;
122
- listbox.selected = old;
123
- });
124
- }
115
+ _refresh() {
116
+ const listbox = this.shadowRoot.getElementById('list');
117
+ if (listbox) {
118
+ setTimeout(() => {
119
+ const old = listbox.selected;
120
+ listbox.selected = undefined;
121
+ listbox.selected = old;
122
+ });
125
123
  }
124
+ }
126
125
 
127
- _clear(selector) {
128
- const slot = this.shadowRoot.querySelector(selector);
129
- if (slot) {
130
- slot.assignedNodes().forEach((node) => {
131
- node.parentNode.removeChild(node);
132
- });
133
- }
126
+ _clear(selector) {
127
+ const slot = this.shadowRoot.querySelector(selector);
128
+ if (slot) {
129
+ slot.assignedNodes().forEach(node => {
130
+ node.parentNode.removeChild(node);
131
+ });
134
132
  }
133
+ }
135
134
 
136
- _loadRemote() {
137
- if (!this.source) {
138
- return // nothing to do
139
- }
135
+ _loadRemote() {
136
+ if (!this.source) {
137
+ return; // nothing to do
138
+ }
140
139
 
141
- let url = this.toAbsoluteURL(this.source);
142
- url += url.includes('?') ? '&' : '?';
143
- url += this._getParameters();
140
+ let url = this.toAbsoluteURL(this.source);
141
+ url += url.includes('?') ? '&' : '?';
142
+ url += this._getParameters();
144
143
 
145
- console.log('<pb-select> loading items from %s', url);
144
+ console.log('<pb-select> loading items from %s', url);
146
145
 
147
- fetch(url, {
148
- method: 'GET',
149
- mode: 'cors',
150
- credentials: 'same-origin'
151
- })
152
- .then((response) => response.json())
153
- .then((json) => {
154
- this._clear('slot:not([name])');
155
- const items = json.map(PbSelect.jsonEntry2item);
156
- console.log('<pb-select> loaded %d items', items.length);
157
- this._items = items;
158
- })
159
- .catch(() => console.error('<pb-select> request to %s failed', url));
160
- }
146
+ fetch(url, {
147
+ method: 'GET',
148
+ mode: 'cors',
149
+ credentials: 'same-origin',
150
+ })
151
+ .then(response => response.json())
152
+ .then(json => {
153
+ this._clear('slot:not([name])');
154
+ const items = json.map(PbSelect.jsonEntry2item);
155
+ console.log('<pb-select> loaded %d items', items.length);
156
+ this._items = items;
157
+ })
158
+ .catch(() => console.error('<pb-select> request to %s failed', url));
159
+ }
161
160
 
162
- static jsonEntry2item (item) {
163
- return {
164
- label: item.text,
165
- value: item.value
166
- };
167
- }
161
+ static jsonEntry2item(item) {
162
+ return {
163
+ label: item.text,
164
+ value: item.value,
165
+ };
166
+ }
168
167
 
169
- _getParameters() {
170
- const slot = this.shadowRoot.querySelector('[name="subform"]');
171
- const params = [];
172
- if (slot) {
173
- slot.assignedNodes().forEach((node) => {
174
- const inputs = node.querySelectorAll('[name]');
175
- inputs.forEach((input) => {
176
- params.push(`${input.name}=${encodeURIComponent(input.value)}`);
177
- });
178
- });
179
- }
180
- return params.join('&');
168
+ _getParameters() {
169
+ const slot = this.shadowRoot.querySelector('[name="subform"]');
170
+ const params = [];
171
+ if (slot) {
172
+ slot.assignedNodes().forEach(node => {
173
+ const inputs = node.querySelectorAll('[name]');
174
+ inputs.forEach(input => {
175
+ params.push(`${input.name}=${encodeURIComponent(input.value)}`);
176
+ });
177
+ });
181
178
  }
179
+ return params.join('&');
180
+ }
182
181
 
183
- render() {
184
- if (this.multi) {
185
- return html`
186
- <slot name="subform"></slot>
187
- <iron-label for="list" part="label">${translate(this.label)}</iron-label>
188
- ${
189
- this.multi ?
190
- html`<paper-listbox id="list" slot="dropdown-content" class="dropdown-content"
191
- .selectedValues="${this.values}" multi
192
- attr-for-selected="value" @iron-select="${this._changed}" @iron-deselect="${this._changed}">
193
- <slot></slot>
194
- ${this._items.map((item) => html`<paper-item value="${item.value}">${item.label}</paper-item>`)}
195
- </paper-listbox>` :
196
- html`<paper-listbox id="list" slot="dropdown-content" class="dropdown-content"
197
- .selected="${this.value}"
198
- attr-for-selected="value" @iron-select="${this._changed}" @iron-deselect="${this._changed}">
199
- <slot></slot>
200
- ${this._items.map((item) => html`<paper-item value="${item.value}">${item.label}</paper-item>`)}
201
- </paper-listbox>`
202
- }
203
- <slot name="output"></slot>
204
- `;
205
- }
206
- return html`
207
- <slot name="subform"></slot>
208
- <paper-dropdown-menu label="${translate(this.label)}">
209
- <paper-listbox id="list" slot="dropdown-content" class="dropdown-content" .selected="${this.value}"
210
- attr-for-selected="value" @iron-select="${this._changed}">
211
- <slot></slot>
212
- ${this._items.map((item) => html`<paper-item value="${item.value}">${item.label}</paper-item>`)}
213
- </paper-listbox>
214
- </paper-dropdown-menu>
215
- <slot name="output"></slot>
216
- `;
182
+ render() {
183
+ if (this.multi) {
184
+ return html`
185
+ <slot name="subform"></slot>
186
+ <iron-label for="list" part="label">${translate(this.label)}</iron-label>
187
+ ${this.multi
188
+ ? html`<paper-listbox
189
+ id="list"
190
+ slot="dropdown-content"
191
+ class="dropdown-content"
192
+ .selectedValues="${this.values}"
193
+ multi
194
+ attr-for-selected="value"
195
+ @iron-select="${this._changed}"
196
+ @iron-deselect="${this._changed}"
197
+ >
198
+ <slot></slot>
199
+ ${this._items.map(
200
+ item => html`<paper-item value="${item.value}">${item.label}</paper-item>`,
201
+ )}
202
+ </paper-listbox>`
203
+ : html`<paper-listbox
204
+ id="list"
205
+ slot="dropdown-content"
206
+ class="dropdown-content"
207
+ .selected="${this.value}"
208
+ attr-for-selected="value"
209
+ @iron-select="${this._changed}"
210
+ @iron-deselect="${this._changed}"
211
+ >
212
+ <slot></slot>
213
+ ${this._items.map(
214
+ item => html`<paper-item value="${item.value}">${item.label}</paper-item>`,
215
+ )}
216
+ </paper-listbox>`}
217
+ <slot name="output"></slot>
218
+ `;
217
219
  }
220
+ return html`
221
+ <slot name="subform"></slot>
222
+ <paper-dropdown-menu label="${translate(this.label)}">
223
+ <paper-listbox
224
+ id="list"
225
+ slot="dropdown-content"
226
+ class="dropdown-content"
227
+ .selected="${this.value}"
228
+ attr-for-selected="value"
229
+ @iron-select="${this._changed}"
230
+ >
231
+ <slot></slot>
232
+ ${this._items.map(
233
+ item => html`<paper-item value="${item.value}">${item.label}</paper-item>`,
234
+ )}
235
+ </paper-listbox>
236
+ </paper-dropdown-menu>
237
+ <slot name="output"></slot>
238
+ `;
239
+ }
218
240
 
219
- _changed() {
220
- const list = this.shadowRoot.getElementById('list');
221
- const oldSelected = Array.of(this._selected);
222
- if (this.multi) {
223
- this._selected = list.selectedValues;
224
- this.values = this._selected;
225
- } else {
226
- this._selected = [list.selected];
227
- this.value = list.selected;
228
- }
241
+ _changed() {
242
+ const list = this.shadowRoot.getElementById('list');
243
+ const oldSelected = Array.of(this._selected);
244
+ if (this.multi) {
245
+ this._selected = list.selectedValues;
246
+ this.values = this._selected;
247
+ } else {
248
+ this._selected = [list.selected];
249
+ this.value = list.selected;
250
+ }
229
251
 
230
- // check if selected items really changed
231
- if (this._selected.length === oldSelected.length &&
232
- this._selected.every((val, index) => val === oldSelected[index])) {
233
- return;
234
- }
252
+ // check if selected items really changed
253
+ if (
254
+ this._selected.length === oldSelected.length &&
255
+ this._selected.every((val, index) => val === oldSelected[index])
256
+ ) {
257
+ return;
258
+ }
235
259
 
236
- if (!this._inIronForm || this.multi) {
237
- this._clear('[name="output"]');
260
+ if (!this._inIronForm || this.multi) {
261
+ this._clear('[name="output"]');
238
262
 
239
- const vals = this.multi ? this.values : [this.value];
240
- vals.forEach((val) => {
241
- const hidden = document.createElement('input');
242
- hidden.type = 'hidden';
243
- hidden.name = this.name;
244
- hidden.value = val;
245
- hidden.slot = 'output';
246
- this.appendChild(hidden);
247
- });
248
- }
249
- this.dispatchEvent(new CustomEvent('change'));
263
+ const vals = this.multi ? this.values : [this.value];
264
+ vals.forEach(val => {
265
+ const hidden = document.createElement('input');
266
+ hidden.type = 'hidden';
267
+ hidden.name = this.name;
268
+ hidden.value = val;
269
+ hidden.slot = 'output';
270
+ this.appendChild(hidden);
271
+ });
250
272
  }
273
+ this.dispatchEvent(new CustomEvent('change'));
274
+ }
251
275
 
252
- static get styles() {
253
- return css`
254
- :host {
255
- display: flex;
256
- flex-direction: column;
257
- position:relative;
258
- margin-top:1rem;
259
- }
276
+ static get styles() {
277
+ return css`
278
+ :host {
279
+ display: flex;
280
+ flex-direction: column;
281
+ position: relative;
282
+ margin-top: 1rem;
283
+ }
260
284
 
261
- iron-label {
262
- font: var(--pb-base-font);
263
- font-size:var(--pb-font-caption);
264
- font-weight: 400;
265
- color: var(--pb-color-lighter);
266
- }
267
-
268
- paper-listbox{
269
- overflow:auto;
270
- }
271
- `;
272
- }
285
+ iron-label {
286
+ font: var(--pb-base-font);
287
+ font-size: var(--pb-font-caption);
288
+ font-weight: 400;
289
+ color: var(--pb-color-lighter);
290
+ }
291
+
292
+ paper-listbox {
293
+ overflow: auto;
294
+ }
295
+ `;
296
+ }
273
297
  }
274
298
  customElements.define('pb-select', PbSelect);