@teipublisher/pb-components 2.25.5 → 2.25.6

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 (128) 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 +8 -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-leaflet-map.html +1 -1
  9. package/dist/demo/pb-repeat.html +1 -3
  10. package/dist/demo/pb-view3.html +1 -1
  11. package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
  12. package/dist/pb-code-editor.js +25 -20
  13. package/dist/pb-component-docs.js +58 -54
  14. package/dist/pb-components-bundle.js +1827 -1520
  15. package/dist/pb-edit-app.js +167 -107
  16. package/dist/pb-elements.json +54 -54
  17. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  18. package/dist/pb-leaflet-map.js +23 -23
  19. package/dist/pb-mei.js +56 -41
  20. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  21. package/dist/pb-odd-editor.js +925 -758
  22. package/dist/pb-tify.js +2 -2
  23. package/dist/{vaadin-element-mixin-859a0132.js → vaadin-element-mixin-ad07ba25.js} +88 -61
  24. package/gh-pages.js +5 -3
  25. package/package.json +2 -2
  26. package/pb-elements.json +54 -54
  27. package/src/assets/components.css +5 -5
  28. package/src/authority/airtable.js +20 -21
  29. package/src/authority/anton.js +129 -129
  30. package/src/authority/custom.js +23 -21
  31. package/src/authority/geonames.js +38 -32
  32. package/src/authority/gnd.js +47 -42
  33. package/src/authority/kbga.js +137 -134
  34. package/src/authority/metagrid.js +44 -46
  35. package/src/authority/reconciliation.js +66 -67
  36. package/src/authority/registry.js +4 -4
  37. package/src/docs/pb-component-docs.js +2 -2
  38. package/src/docs/pb-component-view.js +5 -5
  39. package/src/docs/pb-components-list.js +2 -2
  40. package/src/docs/pb-demo-snippet.js +2 -2
  41. package/src/dts-client.js +299 -297
  42. package/src/dts-select-endpoint.js +90 -82
  43. package/src/parse-date-service.js +184 -135
  44. package/src/pb-ajax.js +171 -167
  45. package/src/pb-authority-lookup.js +96 -81
  46. package/src/pb-autocomplete.js +292 -280
  47. package/src/pb-blacklab-highlight.js +264 -259
  48. package/src/pb-blacklab-results.js +236 -221
  49. package/src/pb-browse-docs.js +540 -475
  50. package/src/pb-browse.js +68 -65
  51. package/src/pb-clipboard.js +79 -76
  52. package/src/pb-code-editor.js +110 -102
  53. package/src/pb-code-highlight.js +209 -204
  54. package/src/pb-codepen.js +79 -72
  55. package/src/pb-collapse.js +149 -146
  56. package/src/pb-combo-box.js +190 -190
  57. package/src/pb-components-bundle.js +1 -1
  58. package/src/pb-custom-form.js +150 -149
  59. package/src/pb-document.js +89 -90
  60. package/src/pb-download.js +208 -195
  61. package/src/pb-drawer.js +145 -148
  62. package/src/pb-edit-app.js +301 -229
  63. package/src/pb-edit-xml.js +99 -96
  64. package/src/pb-events.js +114 -107
  65. package/src/pb-facs-link.js +104 -102
  66. package/src/pb-facsimile.js +411 -413
  67. package/src/pb-formula.js +151 -153
  68. package/src/pb-geolocation.js +129 -131
  69. package/src/pb-grid-action.js +53 -56
  70. package/src/pb-grid.js +231 -228
  71. package/src/pb-highlight.js +140 -140
  72. package/src/pb-hotkeys.js +40 -42
  73. package/src/pb-i18n.js +101 -104
  74. package/src/pb-image-strip.js +84 -78
  75. package/src/pb-lang.js +83 -70
  76. package/src/pb-leaflet-map.js +488 -485
  77. package/src/pb-link.js +126 -124
  78. package/src/pb-load.js +431 -426
  79. package/src/pb-login.js +275 -254
  80. package/src/pb-manage-odds.js +364 -318
  81. package/src/pb-map-icon.js +89 -89
  82. package/src/pb-map-layer.js +85 -85
  83. package/src/pb-markdown.js +90 -99
  84. package/src/pb-media-query.js +74 -72
  85. package/src/pb-mei.js +306 -295
  86. package/src/pb-message.js +143 -130
  87. package/src/pb-mixin.js +269 -264
  88. package/src/pb-navigation.js +80 -82
  89. package/src/pb-observable.js +38 -38
  90. package/src/pb-odd-editor.js +1056 -958
  91. package/src/pb-odd-elementspec-editor.js +348 -297
  92. package/src/pb-odd-model-editor.js +1058 -898
  93. package/src/pb-odd-parameter-editor.js +200 -178
  94. package/src/pb-odd-rendition-editor.js +136 -124
  95. package/src/pb-page.js +432 -422
  96. package/src/pb-paginate.js +202 -190
  97. package/src/pb-panel.js +191 -179
  98. package/src/pb-popover-themes.js +7 -5
  99. package/src/pb-popover.js +296 -287
  100. package/src/pb-print-preview.js +127 -127
  101. package/src/pb-progress.js +49 -49
  102. package/src/pb-repeat.js +105 -104
  103. package/src/pb-restricted.js +84 -77
  104. package/src/pb-search.js +238 -221
  105. package/src/pb-select-feature.js +127 -120
  106. package/src/pb-select-odd.js +132 -124
  107. package/src/pb-select-template.js +89 -78
  108. package/src/pb-select.js +251 -227
  109. package/src/pb-split-list.js +179 -174
  110. package/src/pb-svg.js +80 -79
  111. package/src/pb-table-column.js +54 -54
  112. package/src/pb-table-grid.js +221 -203
  113. package/src/pb-tabs.js +61 -63
  114. package/src/pb-tify.js +154 -154
  115. package/src/pb-timeline.js +271 -229
  116. package/src/pb-toggle-feature.js +198 -185
  117. package/src/pb-upload.js +184 -174
  118. package/src/pb-version.js +30 -30
  119. package/src/pb-view-annotate.js +132 -98
  120. package/src/pb-view.js +1282 -1263
  121. package/src/pb-zoom.js +40 -40
  122. package/src/polymer-hack.js +1 -1
  123. package/src/search-result-service.js +256 -223
  124. package/src/seed-element.js +13 -20
  125. package/src/settings.js +4 -4
  126. package/src/theming.js +91 -91
  127. package/src/urls.js +289 -289
  128. package/src/utils.js +53 -51
package/src/pb-search.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { pbMixin, waitOnce } from './pb-mixin.js';
3
- import { registry } from "./urls.js";
4
- import { translate } from "./pb-i18n.js";
3
+ import { registry } from './urls.js';
4
+ import { translate } from './pb-i18n.js';
5
5
  import '@polymer/paper-input/paper-input.js';
6
6
  import '@polymer/paper-checkbox';
7
7
  import '@polymer/iron-ajax';
@@ -27,248 +27,265 @@ import '@cwmr/paper-autocomplete';
27
27
  * @fires pb-search-resubmit - When received, triggers the search again
28
28
  */
29
29
  export class PbSearch extends pbMixin(LitElement) {
30
- static get properties() {
31
- return {
32
- ...super.properties,
33
- action: {
34
- type: String
35
- },
36
- name: {
37
- type: String
38
- },
39
- value: {
40
- type: String
41
- },
42
- start: {
43
- type: Number
44
- },
45
- placeHolder: {
46
- type: String,
47
- attribute: 'place-holder'
48
- },
49
- redirect: {
50
- type: Boolean
51
- },
52
- currentDoc: {
53
- type: String,
54
- attribute: 'current-doc'
55
- },
56
- submitOnLoad: {
57
- type: Boolean,
58
- attribute: 'submit-on-load'
59
- },
60
- subforms: {
61
- type: String
62
- },
63
- disableAutocomplete: {
64
- type: Boolean,
65
- attribute: 'disable-autocomplete'
66
- },
67
- /**
68
- * Optional URL to query for suggestions. If relative, it is interpreted
69
- * relative to the endpoint defined on a surrounding `pb-page`.
70
- *
71
- * Upon autocomplete, the current input by the user will be sent with a query parameter
72
- * `query`. The name/values of form controls nested within `pb-search` or subforms will also be
73
- * appended to the request as parameters. This allows the server side code to distinguish
74
- * different states.
75
- */
76
- source: {
77
- type: String
78
- }
79
- };
80
- }
30
+ static get properties() {
31
+ return {
32
+ ...super.properties,
33
+ action: {
34
+ type: String,
35
+ },
36
+ name: {
37
+ type: String,
38
+ },
39
+ value: {
40
+ type: String,
41
+ },
42
+ start: {
43
+ type: Number,
44
+ },
45
+ placeHolder: {
46
+ type: String,
47
+ attribute: 'place-holder',
48
+ },
49
+ redirect: {
50
+ type: Boolean,
51
+ },
52
+ currentDoc: {
53
+ type: String,
54
+ attribute: 'current-doc',
55
+ },
56
+ submitOnLoad: {
57
+ type: Boolean,
58
+ attribute: 'submit-on-load',
59
+ },
60
+ subforms: {
61
+ type: String,
62
+ },
63
+ disableAutocomplete: {
64
+ type: Boolean,
65
+ attribute: 'disable-autocomplete',
66
+ },
67
+ /**
68
+ * Optional URL to query for suggestions. If relative, it is interpreted
69
+ * relative to the endpoint defined on a surrounding `pb-page`.
70
+ *
71
+ * Upon autocomplete, the current input by the user will be sent with a query parameter
72
+ * `query`. The name/values of form controls nested within `pb-search` or subforms will also be
73
+ * appended to the request as parameters. This allows the server side code to distinguish
74
+ * different states.
75
+ */
76
+ source: {
77
+ type: String,
78
+ },
79
+ };
80
+ }
81
81
 
82
- constructor() {
83
- super();
84
- this.name = 'query';
85
- this.value = '';
86
- this.redirect = false;
87
- this.submitOnLoad = false;
88
- this.placeHolder = 'search.placeholder';
89
- this.disableAutocomplete = false;
90
- this.start = 1;
91
- }
82
+ constructor() {
83
+ super();
84
+ this.name = 'query';
85
+ this.value = '';
86
+ this.redirect = false;
87
+ this.submitOnLoad = false;
88
+ this.placeHolder = 'search.placeholder';
89
+ this.disableAutocomplete = false;
90
+ this.start = 1;
91
+ }
92
92
 
93
- connectedCallback() {
94
- super.connectedCallback();
93
+ connectedCallback() {
94
+ super.connectedCallback();
95
95
 
96
- this.subscribeTo('pb-search-resubmit', this._doSearch.bind(this));
97
- this.subscribeTo('pb-paginate', (ev) => {
98
- this.start = ev.detail.params.start;
99
- this._doSearch(true);
100
- });
96
+ this.subscribeTo('pb-search-resubmit', this._doSearch.bind(this));
97
+ this.subscribeTo('pb-paginate', ev => {
98
+ this.start = ev.detail.params.start;
99
+ this._doSearch(true);
100
+ });
101
101
 
102
- registry.subscribe(this, (state) => {
103
- this.value = state.query || '';
104
- this.start = state.start || 1;
105
- if (this.submitOnLoad) {
106
- this.emitTo('pb-load', {
107
- "url": this.action,
108
- "params": state
109
- });
110
- }
102
+ registry.subscribe(this, state => {
103
+ this.value = state.query || '';
104
+ this.start = state.start || 1;
105
+ if (this.submitOnLoad) {
106
+ this.emitTo('pb-load', {
107
+ url: this.action,
108
+ params: state,
111
109
  });
110
+ }
111
+ });
112
+ }
113
+
114
+ firstUpdated() {
115
+ if (!this.disableAutocomplete) {
116
+ const autocomplete = this.shadowRoot.getElementById('autocomplete');
117
+ autocomplete.addEventListener('autocomplete-change', this._autocomplete.bind(this));
112
118
  }
119
+ const ironform = this.shadowRoot.getElementById('ironform');
120
+ ironform.addEventListener('iron-form-response', event =>
121
+ event.detail.completes.then(r => this.emitTo('pb-search', r.parseResponse())),
122
+ );
123
+ waitOnce('pb-page-ready', options => {
124
+ const loader = this.shadowRoot.getElementById('autocompleteLoader');
125
+ const url = this.source || 'api/search/autocomplete';
126
+ if (this.minApiVersion('1.0.0')) {
127
+ loader.url = `${options.endpoint}/${url}`;
128
+ } else {
129
+ loader.url = `${options.endpoint}/modules/autocomplete.xql`;
130
+ }
131
+ });
113
132
 
114
- firstUpdated() {
115
- if (!this.disableAutocomplete) {
116
- const autocomplete = this.shadowRoot.getElementById('autocomplete');
117
- autocomplete.addEventListener('autocomplete-change', this._autocomplete.bind(this));
118
- }
119
- const ironform = this.shadowRoot.getElementById('ironform');
120
- ironform.addEventListener('iron-form-response', (event) =>
121
- event.detail.completes.then((r) => this.emitTo('pb-search', r.parseResponse()))
122
- );
123
- waitOnce('pb-page-ready', (options) => {
124
- const loader = this.shadowRoot.getElementById('autocompleteLoader');
125
- const url = this.source || "api/search/autocomplete";
126
- if (this.minApiVersion('1.0.0')) {
127
- loader.url = `${options.endpoint}/${url}`;
128
- } else {
129
- loader.url = `${options.endpoint}/modules/autocomplete.xql`;
130
- }
131
- });
133
+ if (this.submitOnLoad) {
134
+ const params = registry.state;
135
+ registry.replace(this, params);
136
+ this.emitTo('pb-load', {
137
+ url: this.action,
138
+ params,
139
+ });
140
+ }
132
141
 
133
- if (this.submitOnLoad) {
134
- const params = registry.state;
135
- registry.replace(this, params);
136
- this.emitTo('pb-load', {
137
- "url": this.action,
138
- "params": params
139
- });
140
- }
142
+ this.addEventListener('click', e => {
143
+ const root = e.target.closest('[slot]');
144
+ if (!root) {
145
+ return;
146
+ }
147
+ if (root.slot === 'searchButton') {
148
+ this._doSearch();
149
+ }
150
+ if (root.slot === 'resetButton') {
151
+ this._reset();
152
+ }
153
+ });
154
+ }
141
155
 
142
- this.addEventListener('click', (e) => {
143
- const root = e.target.closest('[slot]');
144
- if (!root) {
145
- return;
156
+ render() {
157
+ return html`
158
+ <custom-style>
159
+ <style>
160
+ :host {
161
+ --suggestions-item: {
162
+ color: var(--pb-search-suggestions-color, black);
146
163
  }
147
- if (root.slot === 'searchButton'){
148
- this._doSearch();
164
+ --suggestions-wrapper: {
165
+ background: var(--pb-search-suggestions-background, white);
149
166
  }
150
- if (root.slot === 'resetButton'){
151
- this._reset();
152
- }
153
- });
154
- }
155
-
156
- render() {
157
- return html`
158
- <custom-style>
159
- <style>
160
- :host {
161
- --suggestions-item: {
162
- color: var(--pb-search-suggestions-color, black);
163
- };
164
- --suggestions-wrapper: {
165
- background: var(--pb-search-suggestions-background, white);
166
- }
167
- }
168
- </style>
169
- </custom-style>
170
- <iron-form id="ironform" allow-redirect="${this.redirect}">
171
- <form id="searchPageForm" method="get" action="${this.action}" accept="text/html">
172
- <slot name="beforeInput"></slot>
173
- <paper-input id="search" type="search" name="query" @keyup="${this._handleEnter}" label="${translate(this.placeHolder)}"
174
- value="${this.value}" always-float-label>
175
- <iron-icon icon="search" @click="${this._doSearch}" slot="prefix"></iron-icon>
176
- </paper-input>
177
- <paper-autocomplete-suggestions id="autocomplete" for="search" source="${this._suggestions}" remote-source></paper-autocomplete-suggestions>
178
- <slot></slot>
179
-
180
- <slot name="searchButton"></slot>
181
- <slot name="resetButton"></slot>
182
-
183
- </form>
184
- </iron-form>
185
- <iron-ajax
186
- id="autocompleteLoader"
187
- verbose
188
- handle-as="json"
189
- method="get"
190
- with-credentials
191
- @response="${this._updateSuggestions}"></iron-ajax>
192
- `;
193
- }
167
+ }
168
+ </style>
169
+ </custom-style>
170
+ <iron-form id="ironform" allow-redirect="${this.redirect}">
171
+ <form id="searchPageForm" method="get" action="${this.action}" accept="text/html">
172
+ <slot name="beforeInput"></slot>
173
+ <paper-input
174
+ id="search"
175
+ type="search"
176
+ name="query"
177
+ @keyup="${this._handleEnter}"
178
+ label="${translate(this.placeHolder)}"
179
+ value="${this.value}"
180
+ always-float-label
181
+ >
182
+ <iron-icon icon="search" @click="${this._doSearch}" slot="prefix"></iron-icon>
183
+ </paper-input>
184
+ <paper-autocomplete-suggestions
185
+ id="autocomplete"
186
+ for="search"
187
+ source="${this._suggestions}"
188
+ remote-source
189
+ ></paper-autocomplete-suggestions>
190
+ <slot></slot>
194
191
 
195
- static get styles() {
196
- return css`
197
- :host {
198
- --paper-input-container-color: var(--pb-search-label-color, var(--paper-grey-500, #303030));
199
- --paper-input-container-input-color: var(--pb-search-input-color, var(--pb-color-primary, #000000));
200
- --paper-input-container-focus-color: var(--pb-search-focus-color, var(--paper-grey-500, #303030));
201
- }
202
- a{
203
- padding:1rem;
204
- color:var(--pb-reset-color);
205
- }
206
- .buttons{
207
- margin-top:1rem;
208
- }
209
- form {
210
- margin: 0;
211
- }
212
- `;
213
- }
192
+ <slot name="searchButton"></slot>
193
+ <slot name="resetButton"></slot>
194
+ </form>
195
+ </iron-form>
196
+ <iron-ajax
197
+ id="autocompleteLoader"
198
+ verbose
199
+ handle-as="json"
200
+ method="get"
201
+ with-credentials
202
+ @response="${this._updateSuggestions}"
203
+ ></iron-ajax>
204
+ `;
205
+ }
214
206
 
215
- _doSearch(pagination = false) {
216
- let json = this.shadowRoot.getElementById('ironform').serializeForm();
217
- json = this._paramsFromSubforms(json);
218
- // remove unnecessary param added by autocomplete
219
- delete json['autocomplete-custom-template'];
220
- // always start on first result after submitting new search
221
- json.start = pagination ? this.start : 1;
222
- if (this.redirect) {
223
- window.location.href = `${this.action}?${new URLSearchParams(json)}`;
224
- } else {
225
- registry.commit(this, json);
226
- this.emitTo('pb-load', {
227
- "url": this.action,
228
- "params": json
229
- });
230
- }
231
- }
207
+ static get styles() {
208
+ return css`
209
+ :host {
210
+ --paper-input-container-color: var(--pb-search-label-color, var(--paper-grey-500, #303030));
211
+ --paper-input-container-input-color: var(
212
+ --pb-search-input-color,
213
+ var(--pb-color-primary, #000000)
214
+ );
215
+ --paper-input-container-focus-color: var(
216
+ --pb-search-focus-color,
217
+ var(--paper-grey-500, #303030)
218
+ );
219
+ }
220
+ a {
221
+ padding: 1rem;
222
+ color: var(--pb-reset-color);
223
+ }
224
+ .buttons {
225
+ margin-top: 1rem;
226
+ }
227
+ form {
228
+ margin: 0;
229
+ }
230
+ `;
231
+ }
232
232
 
233
- _paramsFromSubforms(params) {
234
- if (this.subforms) {
235
- document.querySelectorAll(this.subforms).forEach((form) => {
236
- if (form.serializeForm) {
237
- Object.assign(params, form.serializeForm());
238
- }
239
- });
240
- }
241
- return params;
233
+ _doSearch(pagination = false) {
234
+ let json = this.shadowRoot.getElementById('ironform').serializeForm();
235
+ json = this._paramsFromSubforms(json);
236
+ // remove unnecessary param added by autocomplete
237
+ delete json['autocomplete-custom-template'];
238
+ // always start on first result after submitting new search
239
+ json.start = pagination ? this.start : 1;
240
+ if (this.redirect) {
241
+ window.location.href = `${this.action}?${new URLSearchParams(json)}`;
242
+ } else {
243
+ registry.commit(this, json);
244
+ this.emitTo('pb-load', {
245
+ url: this.action,
246
+ params: json,
247
+ });
242
248
  }
249
+ }
243
250
 
244
- _handleEnter(e) {
245
- if (e.keyCode === 13) {
246
- this._doSearch();
251
+ _paramsFromSubforms(params) {
252
+ if (this.subforms) {
253
+ document.querySelectorAll(this.subforms).forEach(form => {
254
+ if (form.serializeForm) {
255
+ Object.assign(params, form.serializeForm());
247
256
  }
257
+ });
248
258
  }
259
+ return params;
260
+ }
249
261
 
250
- _doSubmit() {
251
- this.shadowRoot.getElementById('ironform').submit();
262
+ _handleEnter(e) {
263
+ if (e.keyCode === 13) {
264
+ this._doSearch();
252
265
  }
266
+ }
253
267
 
254
- _reset(){
255
- this.shadowRoot.getElementById('ironform').reset();
256
- }
268
+ _doSubmit() {
269
+ this.shadowRoot.getElementById('ironform').submit();
270
+ }
257
271
 
258
- _autocomplete(ev) {
259
- const params = this.shadowRoot.getElementById('ironform').serializeForm();
260
- const loader = this.shadowRoot.getElementById('autocompleteLoader');
261
- loader.params = params;
262
- loader.generateRequest();
263
- }
272
+ _reset() {
273
+ this.shadowRoot.getElementById('ironform').reset();
274
+ }
264
275
 
265
- _updateSuggestions() {
266
- const autocomplete = this.shadowRoot.getElementById('autocomplete');
267
- const loader = this.shadowRoot.getElementById('autocompleteLoader');
268
- if (loader.lastResponse) {
269
- autocomplete.suggestions(loader.lastResponse);
270
- }
271
- }
276
+ _autocomplete(ev) {
277
+ const params = this.shadowRoot.getElementById('ironform').serializeForm();
278
+ const loader = this.shadowRoot.getElementById('autocompleteLoader');
279
+ loader.params = params;
280
+ loader.generateRequest();
281
+ }
272
282
 
283
+ _updateSuggestions() {
284
+ const autocomplete = this.shadowRoot.getElementById('autocomplete');
285
+ const loader = this.shadowRoot.getElementById('autocompleteLoader');
286
+ if (loader.lastResponse) {
287
+ autocomplete.suggestions(loader.lastResponse);
288
+ }
289
+ }
273
290
  }
274
291
  customElements.define('pb-search', PbSearch);