@teipublisher/pb-components 2.26.1-next.2 → 3.0.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.
Files changed (154) 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 +4 -4
  4. package/.releaserc.json +2 -2
  5. package/CHANGELOG.md +267 -9
  6. package/Dockerfile +78 -70
  7. package/css/components.css +5 -5
  8. package/css/leaflet/images/layers.png +0 -0
  9. package/dist/demo/components.css +46 -1
  10. package/dist/demo/pb-browse-docs2.html +1 -1
  11. package/dist/demo/pb-dialog.html +3 -5
  12. package/dist/demo/pb-drawer2.html +1 -1
  13. package/dist/demo/pb-facsimile.html +2 -2
  14. package/dist/demo/pb-grid.html +19 -6
  15. package/dist/demo/pb-leaflet-map.html +1 -1
  16. package/dist/demo/pb-login.html +0 -2
  17. package/dist/demo/pb-message.html +1 -2
  18. package/dist/demo/pb-progress.html +2 -2
  19. package/dist/demo/pb-repeat.html +1 -3
  20. package/dist/demo/pb-search.html +7 -4
  21. package/dist/demo/pb-search3.html +1 -1
  22. package/dist/demo/pb-search4.html +2 -2
  23. package/dist/demo/pb-view3.html +1 -1
  24. package/dist/{iron-form-3b8dcaa7.js → iron-form-dfb3e3b1.js} +95 -95
  25. package/dist/paper-checkbox-645e1077.js +200 -0
  26. package/dist/{paper-icon-button-b1d31571.js → paper-icon-button-984162bd.js} +1 -1
  27. package/dist/{paper-checkbox-515a5284.js → paper-inky-focus-behavior-fa16796b.js} +58 -247
  28. package/dist/{paper-listbox-a3b7175c.js → paper-listbox-5f5d1cec.js} +152 -162
  29. package/dist/pb-code-editor.js +25 -20
  30. package/dist/pb-component-docs.js +68 -64
  31. package/dist/pb-components-bundle.js +1983 -2293
  32. package/dist/pb-edit-app.js +167 -107
  33. package/dist/pb-elements.json +176 -120
  34. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  35. package/dist/pb-leaflet-map.js +23 -23
  36. package/dist/pb-mei.js +56 -41
  37. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  38. package/dist/pb-odd-editor.js +1023 -782
  39. package/dist/pb-tify.js +2 -2
  40. package/dist/vaadin-element-mixin-beb74ffd.js +545 -0
  41. package/gh-pages.js +5 -3
  42. package/i18n/common/en.json +6 -0
  43. package/i18n/common/pl.json +2 -2
  44. package/lib/openseadragon.min.js +6 -6
  45. package/package.json +3 -3
  46. package/pb-elements.json +176 -120
  47. package/src/assets/components.css +5 -5
  48. package/src/authority/airtable.js +20 -21
  49. package/src/authority/anton.js +129 -129
  50. package/src/authority/custom.js +23 -21
  51. package/src/authority/geonames.js +38 -32
  52. package/src/authority/gnd.js +50 -42
  53. package/src/authority/kbga.js +137 -134
  54. package/src/authority/metagrid.js +44 -46
  55. package/src/authority/reconciliation.js +66 -67
  56. package/src/authority/registry.js +4 -4
  57. package/src/docs/pb-component-docs.js +2 -2
  58. package/src/docs/pb-component-view.js +5 -5
  59. package/src/docs/pb-components-list.js +2 -2
  60. package/src/docs/pb-demo-snippet.js +2 -2
  61. package/src/dts-client.js +299 -297
  62. package/src/dts-select-endpoint.js +90 -82
  63. package/src/parse-date-service.js +184 -135
  64. package/src/pb-ajax.js +158 -171
  65. package/src/pb-authority-lookup.js +191 -156
  66. package/src/pb-autocomplete.js +292 -280
  67. package/src/pb-blacklab-highlight.js +264 -259
  68. package/src/pb-blacklab-results.js +236 -221
  69. package/src/pb-browse-docs.js +540 -475
  70. package/src/pb-browse.js +68 -65
  71. package/src/pb-clipboard.js +79 -76
  72. package/src/pb-code-editor.js +110 -102
  73. package/src/pb-code-highlight.js +209 -204
  74. package/src/pb-codepen.js +79 -72
  75. package/src/pb-collapse.js +211 -151
  76. package/src/pb-combo-box.js +190 -190
  77. package/src/pb-components-bundle.js +1 -1
  78. package/src/pb-components.js +1 -0
  79. package/src/pb-custom-form.js +173 -153
  80. package/src/pb-dialog.js +98 -62
  81. package/src/pb-document.js +89 -90
  82. package/src/pb-download.js +212 -196
  83. package/src/pb-drawer.js +145 -148
  84. package/src/pb-edit-app.js +301 -229
  85. package/src/pb-edit-xml.js +100 -97
  86. package/src/pb-events.js +114 -107
  87. package/src/pb-facs-link.js +104 -102
  88. package/src/pb-facsimile.js +474 -410
  89. package/src/pb-formula.js +151 -153
  90. package/src/pb-geolocation.js +129 -131
  91. package/src/pb-grid-action.js +53 -56
  92. package/src/pb-grid.js +231 -228
  93. package/src/pb-highlight.js +140 -140
  94. package/src/pb-hotkeys.js +40 -42
  95. package/src/pb-i18n.js +101 -104
  96. package/src/pb-image-strip.js +84 -78
  97. package/src/pb-lang.js +142 -57
  98. package/src/pb-leaflet-map.js +488 -485
  99. package/src/pb-link.js +126 -124
  100. package/src/pb-load.js +431 -429
  101. package/src/pb-login.js +299 -244
  102. package/src/pb-manage-odds.js +352 -336
  103. package/src/pb-map-icon.js +89 -89
  104. package/src/pb-map-layer.js +85 -85
  105. package/src/pb-markdown.js +90 -99
  106. package/src/pb-media-query.js +74 -72
  107. package/src/pb-mei.js +306 -295
  108. package/src/pb-message.js +139 -97
  109. package/src/pb-mixin.js +269 -264
  110. package/src/pb-navigation.js +80 -95
  111. package/src/pb-observable.js +38 -38
  112. package/src/pb-odd-editor.js +1054 -958
  113. package/src/pb-odd-elementspec-editor.js +349 -298
  114. package/src/pb-odd-model-editor.js +1075 -909
  115. package/src/pb-odd-parameter-editor.js +200 -178
  116. package/src/pb-odd-rendition-editor.js +136 -124
  117. package/src/pb-page.js +431 -422
  118. package/src/pb-paginate.js +228 -179
  119. package/src/pb-panel.js +198 -182
  120. package/src/pb-popover-themes.js +15 -8
  121. package/src/pb-popover.js +296 -287
  122. package/src/pb-print-preview.js +127 -127
  123. package/src/pb-progress.js +51 -51
  124. package/src/pb-repeat.js +105 -104
  125. package/src/pb-restricted.js +84 -77
  126. package/src/pb-search.js +256 -228
  127. package/src/pb-select-feature.js +127 -120
  128. package/src/pb-select-odd.js +132 -124
  129. package/src/pb-select-template.js +89 -78
  130. package/src/pb-select.js +251 -227
  131. package/src/pb-split-list.js +179 -174
  132. package/src/pb-svg.js +80 -79
  133. package/src/pb-table-column.js +54 -54
  134. package/src/pb-table-grid.js +221 -203
  135. package/src/pb-tabs.js +61 -63
  136. package/src/pb-tify.js +154 -154
  137. package/src/pb-timeline.js +382 -249
  138. package/src/pb-toggle-feature.js +195 -187
  139. package/src/pb-upload.js +184 -174
  140. package/src/pb-version.js +30 -30
  141. package/src/pb-view-annotate.js +135 -98
  142. package/src/pb-view.js +1282 -1270
  143. package/src/pb-zoom.js +127 -45
  144. package/src/polymer-hack.js +1 -1
  145. package/src/search-result-service.js +256 -223
  146. package/src/seed-element.js +13 -20
  147. package/src/settings.js +4 -4
  148. package/src/theming.js +98 -91
  149. package/src/urls.js +289 -289
  150. package/src/utils.js +53 -51
  151. package/css/pb-styles.css +0 -51
  152. package/dist/vaadin-element-mixin-6e4cee3a.js +0 -527
  153. package/src/assets/pb-styles.css +0 -51
  154. package/src/pb-light-dom.js +0 -40
@@ -1,32 +1,32 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { pbMixin, waitOnce } from './pb-mixin.js';
3
- import { translate } from "./pb-i18n.js";
3
+ import { translate } from './pb-i18n.js';
4
4
  import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
5
5
  import '@polymer/paper-listbox';
6
6
  import '@polymer/paper-item';
7
7
  import { registry } from './urls.js';
8
- import { addSelector } from "./pb-toggle-feature.js";
8
+ import { addSelector } from './pb-toggle-feature.js';
9
9
 
10
10
  /**
11
11
  * Similar to `pb-toggle-feature` but allows you to choose from a list of defined states instead of a simple
12
- * on/off toggle. Like `pb-toggle-feature` it can change state server-side as well as client-side.
13
- *
12
+ * on/off toggle. Like `pb-toggle-feature` it can change state server-side as well as client-side.
13
+ *
14
14
  * The list of states is passed as a JSON array to property `items`:
15
- *
15
+ *
16
16
  * # Server-side
17
- *
17
+ *
18
18
  * Properties to be passed to the server are specified as follows:
19
- *
19
+ *
20
20
  * ```javascript
21
21
  * [
22
22
  * {"name": "Diplomatic View", "properties": {"mode": "diplomatic", "view": "page"}},
23
23
  * {"name": "Normalized View", "properties": {"mode": "norm", "view": "single"}}
24
24
  * ]
25
25
  * ```
26
- *
26
+ *
27
27
  * If the `name` property references the path to a translated label, the translation will be used instead.
28
28
  * # Client-side
29
- *
29
+ *
30
30
  * ```javascript
31
31
  * [
32
32
  * {"name": "Diplomatic View", "selectors": [{"selector": ".choice,.choice-alternate,br", "state": false},{"selector": ".tei-foreign,pb-highlight,pb-popover", "command": "disable"}]},
@@ -34,141 +34,148 @@ import { addSelector } from "./pb-toggle-feature.js";
34
34
  * {"name": "Plain Reading View", "selectors": [{"selector": ".choice,.choice-alternate,br", "state": true}, {"selector": ".tei-foreign,pb-highlight,pb-popover", "command": "disable", "state": true}]}
35
35
  * ]
36
36
  * ```
37
- *
37
+ *
38
38
  * Each item in the `selectors` property above defines either a state or a command. *state* will simply add
39
39
  * a css class `.toggle` to the target element when true. If *command* is set to 'disable', it will entirely disable
40
40
  * the functionality of selected elements - provided that they are
41
41
  * publisher components implementing the corresponding `command` method of `pb-mixin`.
42
- *
42
+ *
43
43
  * Client-side you may also pass an optional property `"global": true` to toggle the state of elements which reside
44
44
  * in the surrounding HTML context below `pb-page` (means: elements which are not inside a `pb-view` or `pb-load`).
45
- *
45
+ *
46
46
  * @fires pb-toggle - Fired when a feature is selected from the dropdown and sends the selected properties
47
47
  */
48
48
  export class PbSelectFeature extends pbMixin(LitElement) {
49
- static get properties() {
50
- return {
51
- ...super.properties,
52
- /**
53
- * The name of the feature (required). This will correspond to the name of the custom parameter
54
- * passed to the ODD.
55
- */
56
- name: {
57
- type: String
58
- },
59
- /**
60
- * The label to display on top of the drop down
61
- */
62
- label: {
63
- type: String
64
- },
65
- selected: {
66
- type: Number
67
- },
68
- items: {
69
- type: Array
70
- }
71
- };
72
- }
49
+ static get properties() {
50
+ return {
51
+ ...super.properties,
52
+ /**
53
+ * The name of the feature (required). This will correspond to the name of the custom parameter
54
+ * passed to the ODD.
55
+ */
56
+ name: {
57
+ type: String,
58
+ },
59
+ /**
60
+ * The label to display on top of the drop down
61
+ */
62
+ label: {
63
+ type: String,
64
+ },
65
+ selected: {
66
+ type: Number,
67
+ },
68
+ items: {
69
+ type: Array,
70
+ },
71
+ };
72
+ }
73
73
 
74
- constructor() {
75
- super();
76
- this.initializing = true;
77
- this.items = [];
78
- this.label = 'document.selectFeature';
79
- }
74
+ constructor() {
75
+ super();
76
+ this.initializing = true;
77
+ this.items = [];
78
+ this.label = 'document.selectFeature';
79
+ }
80
80
 
81
- connectedCallback() {
82
- super.connectedCallback();
81
+ connectedCallback() {
82
+ super.connectedCallback();
83
83
 
84
- registry.subscribe(this, (state) => {
85
- const param = state[this.name];
86
- if (typeof param !== 'undefined') {
87
- this.selected = parseInt(param, 10);
88
- } else {
89
- this.selected = 0;
90
- }
91
- this.shadowRoot.getElementById('list').selected = this.selected;
92
- });
84
+ registry.subscribe(this, state => {
85
+ const param = state[this.name];
86
+ if (typeof param !== 'undefined') {
87
+ this.selected = parseInt(param, 10);
88
+ } else {
89
+ this.selected = 0;
90
+ }
91
+ this.shadowRoot.getElementById('list').selected = this.selected;
92
+ });
93
93
 
94
- const param = registry.state[this.name];
95
- if (typeof param !== 'undefined') {
96
- this.selected = parseInt(param, 10);
97
- } else if (this.items.length > 0) {
98
- this.selected = 0;
99
- }
94
+ const param = registry.state[this.name];
95
+ if (typeof param !== 'undefined') {
96
+ this.selected = parseInt(param, 10);
97
+ } else if (this.items.length > 0) {
98
+ this.selected = 0;
99
+ }
100
100
 
101
- const newState = {};
102
- newState[this.name] = this.selected;
103
- registry.replace(this, newState);
101
+ const newState = {};
102
+ newState[this.name] = this.selected;
103
+ registry.replace(this, newState);
104
104
 
105
- this.signalReady();
106
- }
105
+ this.signalReady();
106
+ }
107
107
 
108
- firstUpdated() {
109
- super.firstUpdated();
108
+ firstUpdated() {
109
+ super.firstUpdated();
110
110
 
111
- this.shadowRoot.getElementById('list').selected = this.selected;
112
- this.shadowRoot.getElementById('menu').addEventListener('iron-select', this._selectionChanged.bind(this));
113
- }
111
+ this.shadowRoot.getElementById('list').selected = this.selected;
112
+ this.shadowRoot
113
+ .getElementById('menu')
114
+ .addEventListener('iron-select', this._selectionChanged.bind(this));
115
+ }
114
116
 
115
- _selectionChanged() {
116
- const refresh = this._saveState();
117
- if (this.initializing) {
118
- this.initializing = false;
119
- } else {
120
- this.emitTo('pb-toggle', { refresh });
121
- }
117
+ _selectionChanged() {
118
+ const refresh = this._saveState();
119
+ if (this.initializing) {
120
+ this.initializing = false;
121
+ } else {
122
+ this.emitTo('pb-toggle', { refresh });
122
123
  }
124
+ }
123
125
 
124
- _saveState() {
125
- const current = this.shadowRoot.getElementById('list').selected;
126
+ _saveState() {
127
+ const current = this.shadowRoot.getElementById('list').selected;
126
128
 
127
- const state = registry.getState(this);
128
- state[this.name] = current;
129
- Object.assign(state, this.items[current].properties);
130
- if (this.items[current].selectors) {
131
- if (!state.selectors) {
132
- state.selectors = [];
133
- }
134
- this.items[current].selectors.forEach((config) => {
135
- if (config.global) {
136
- registry.commit(this, state);
137
- this.dispatchEvent(new CustomEvent('pb-global-toggle', { detail: config, bubbles: true, composed: true }));
138
- } else {
139
- addSelector({
140
- selector: config.selector,
141
- state: config.state,
142
- command: config.command
143
- }, state.selectors);
144
- }
145
- });
129
+ const state = registry.getState(this);
130
+ state[this.name] = current;
131
+ Object.assign(state, this.items[current].properties);
132
+ if (this.items[current].selectors) {
133
+ if (!state.selectors) {
134
+ state.selectors = [];
135
+ }
136
+ this.items[current].selectors.forEach(config => {
137
+ if (config.global) {
138
+ registry.commit(this, state);
139
+ this.dispatchEvent(
140
+ new CustomEvent('pb-global-toggle', { detail: config, bubbles: true, composed: true }),
141
+ );
142
+ } else {
143
+ addSelector(
144
+ {
145
+ selector: config.selector,
146
+ state: config.state,
147
+ command: config.command,
148
+ },
149
+ state.selectors,
150
+ );
146
151
  }
147
- return this.items[current].properties instanceof Object
152
+ });
148
153
  }
154
+ return this.items[current].properties instanceof Object;
155
+ }
149
156
 
150
- render() {
151
- return html`
152
- <paper-dropdown-menu id="menu" label="${translate(this.label)}" .disabled="${this.disabled}">
153
- <paper-listbox id="list" slot="dropdown-content" .selected="${this.selected}">
154
- ${this.items.map((item) => html`<paper-item>${translate(item.name)}</paper-item>`)}
155
- </paper-listbox>
156
- </paper-dropdown-menu>
157
- `;
158
- }
157
+ render() {
158
+ return html`
159
+ <paper-dropdown-menu id="menu" label="${translate(this.label)}" .disabled="${this.disabled}">
160
+ <paper-listbox id="list" slot="dropdown-content" .selected="${this.selected}">
161
+ ${this.items.map(item => html`<paper-item>${translate(item.name)}</paper-item>`)}
162
+ </paper-listbox>
163
+ </paper-dropdown-menu>
164
+ `;
165
+ }
159
166
 
160
- static get styles() {
161
- return css`
162
- :host {
163
- display: block;
164
- }
167
+ static get styles() {
168
+ return css`
169
+ :host {
170
+ display: block;
171
+ }
165
172
 
166
- #menu {
167
- width: inherit;
168
- min-width: inherit;
169
- max-width: inherit;
170
- }
171
- `;
172
- }
173
+ #menu {
174
+ width: inherit;
175
+ min-width: inherit;
176
+ max-width: inherit;
177
+ }
178
+ `;
179
+ }
173
180
  }
174
- customElements.define('pb-select-feature', PbSelectFeature);
181
+ customElements.define('pb-select-feature', PbSelectFeature);
@@ -1,13 +1,13 @@
1
1
  import { LitElement, html, css } from 'lit-element';
2
2
  import { pbMixin, waitOnce } from './pb-mixin.js';
3
3
  import { translate } from './pb-i18n.js';
4
- import "@polymer/paper-listbox";
5
- import "@polymer/paper-item";
6
- import "@polymer/paper-dropdown-menu/paper-dropdown-menu.js";
7
- import "@polymer/iron-ajax";
8
- import "web-animations-js";
9
- import "@polymer/neon-animation";
10
- import {registry} from "./urls.js";
4
+ import '@polymer/paper-listbox';
5
+ import '@polymer/paper-item';
6
+ import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
7
+ import '@polymer/iron-ajax';
8
+ import 'web-animations-js';
9
+ import '@polymer/neon-animation';
10
+ import { registry } from './urls.js';
11
11
 
12
12
  /**
13
13
  * `pb-select-odd`: Switch between available ODDs.
@@ -19,127 +19,135 @@ import {registry} from "./urls.js";
19
19
  *
20
20
  */
21
21
  export class PbSelectOdd extends pbMixin(LitElement) {
22
- static get properties() {
23
- return {
24
- ...super.properties,
25
- /** The label to show on top of the dropdown menu */
26
- label: {
27
- type: String
28
- },
29
- /** The ODDs to show. */
30
- odds: {
31
- type: Array
32
- },
33
- name: {
34
- type: String
35
- },
36
- /** Currently selected ODD. If this property is set, the component
37
- * will immediately load the list of ODDs from the server and select
38
- * the given ODD.
39
- */
40
- odd: {
41
- type: String,
42
- notify: true
43
- }
44
- };
22
+ static get properties() {
23
+ return {
24
+ ...super.properties,
25
+ /** The label to show on top of the dropdown menu */
26
+ label: {
27
+ type: String,
28
+ },
29
+ /** The ODDs to show. */
30
+ odds: {
31
+ type: Array,
32
+ },
33
+ name: {
34
+ type: String,
35
+ },
36
+ /** Currently selected ODD. If this property is set, the component
37
+ * will immediately load the list of ODDs from the server and select
38
+ * the given ODD.
39
+ */
40
+ odd: {
41
+ type: String,
42
+ notify: true,
43
+ },
44
+ };
45
+ }
46
+
47
+ constructor() {
48
+ super();
49
+
50
+ this.label = 'document.selectODD';
51
+ this.odds = [];
52
+ }
53
+
54
+ connectedCallback() {
55
+ super.connectedCallback();
56
+
57
+ this.subscribeTo('pb-update', this._onTargetUpdate.bind(this));
58
+ }
59
+
60
+ firstUpdated() {
61
+ super.firstUpdated();
62
+ waitOnce('pb-page-ready', () => {
63
+ this._refresh();
64
+ });
65
+ }
66
+
67
+ render() {
68
+ return html`
69
+ <paper-dropdown-menu id="menu" label="${translate(this.label)}" name="${this.name}">
70
+ <paper-listbox
71
+ id="odds"
72
+ slot="dropdown-content"
73
+ class="dropdown-content"
74
+ selected="${this.odd}"
75
+ attr-for-selected="value"
76
+ @selected-item-changed="${this._selected}"
77
+ >
78
+ ${this.odds.map(
79
+ item => html`<paper-item value="${item.name}">${item.label}</paper-item>`,
80
+ )}
81
+ </paper-listbox>
82
+ </paper-dropdown-menu>
83
+
84
+ <iron-ajax
85
+ id="load"
86
+ verbose
87
+ handle-as="json"
88
+ method="get"
89
+ with-credentials
90
+ @response="${this._update}"
91
+ ></iron-ajax>
92
+ `;
93
+ }
94
+
95
+ static get styles() {
96
+ return css`
97
+ :host {
98
+ display: block;
99
+ }
100
+
101
+ paper-dropdown-menu {
102
+ --paper-listbox-background-color: white;
103
+ width: 100%;
104
+ }
105
+ `;
106
+ }
107
+
108
+ _selected() {
109
+ const newOdd = this.shadowRoot.getElementById('odds').selected;
110
+ if (newOdd === this.odd) {
111
+ return;
45
112
  }
46
-
47
- constructor() {
48
- super();
49
-
50
- this.label = 'document.selectODD';
51
- this.odds = [];
52
- }
53
-
54
- connectedCallback() {
55
- super.connectedCallback();
56
-
57
- this.subscribeTo('pb-update', this._onTargetUpdate.bind(this));
58
- }
59
-
60
- firstUpdated() {
61
- super.firstUpdated();
62
- waitOnce('pb-page-ready', () => {
63
- this._refresh();
64
- });
65
- }
66
-
67
- render() {
68
- return html`
69
- <paper-dropdown-menu id="menu" label="${translate(this.label)}" name="${this.name}">
70
- <paper-listbox id="odds" slot="dropdown-content" class="dropdown-content" selected="${this.odd}"
71
- attr-for-selected="value" @selected-item-changed="${this._selected}">
72
- ${this.odds.map((item) => html`<paper-item value="${item.name}">${item.label}</paper-item>`)}
73
- </paper-listbox>
74
- </paper-dropdown-menu>
75
-
76
- <iron-ajax
77
- id="load"
78
- verbose
79
- handle-as="json"
80
- method="get"
81
- with-credentials
82
- @response="${this._update}"></iron-ajax>
83
- `;
113
+ this.odd = newOdd;
114
+ console.log('<pb-select-odd> Switching to ODD %s', this.odd);
115
+ const doc = this.getDocument();
116
+ if (doc) {
117
+ doc.odd = this.odd;
84
118
  }
85
-
86
- static get styles() {
87
- return css`
88
- :host {
89
- display: block;
90
- }
91
-
92
- paper-dropdown-menu {
93
- --paper-listbox-background-color: white;
94
- width: 100%;
95
- }
96
- `;
97
- }
98
-
99
- _selected() {
100
- const newOdd = this.shadowRoot.getElementById('odds').selected;
101
- if (newOdd === this.odd) {
102
- return;
103
- }
104
- this.odd = newOdd;
105
- console.log('<pb-select-odd> Switching to ODD %s', this.odd);
106
- const doc = this.getDocument();
107
- if (doc) {
108
- doc.odd = this.odd;
109
- }
110
- registry.commit(this,{odd: this.odd});
111
-
112
- this.emitTo('pb-refresh', {
113
- odd: this.odd
114
- });
119
+ registry.commit(this, { odd: this.odd });
120
+
121
+ this.emitTo('pb-refresh', {
122
+ odd: this.odd,
123
+ });
124
+ }
125
+
126
+ _refresh() {
127
+ const load = this.shadowRoot.getElementById('load');
128
+ if (this.minApiVersion('1.0.0')) {
129
+ load.url = `${this.getEndpoint()}/api/odd`;
130
+ } else {
131
+ load.url = `${this.getEndpoint()}/modules/lib/components-list-odds.xql`;
115
132
  }
116
-
117
- _refresh() {
118
- const load = this.shadowRoot.getElementById('load');
119
- if (this.minApiVersion('1.0.0')) {
120
- load.url = `${this.getEndpoint()}/api/odd`;
121
- } else {
122
- load.url = `${this.getEndpoint()}/modules/lib/components-list-odds.xql`;
123
- }
124
- load.params = { odd: this.odd };
125
- load.generateRequest();
133
+ load.params = { odd: this.odd };
134
+ load.generateRequest();
135
+ }
136
+
137
+ _update() {
138
+ const load = this.shadowRoot.getElementById('load');
139
+ this.odds = load.lastResponse;
140
+ }
141
+
142
+ _onTargetUpdate(ev) {
143
+ let newOdd = ev.detail.data.odd;
144
+ if (newOdd) {
145
+ newOdd = newOdd.replace(/^(.*?)\.[^\.]+$/, '$1');
126
146
  }
127
-
128
- _update() {
129
- const load = this.shadowRoot.getElementById('load');
130
- this.odds = load.lastResponse;
147
+ if (newOdd !== this.odd) {
148
+ console.log('<pb-select-odd> Set current ODD from %s to %s', this.odd, newOdd);
131
149
  }
132
-
133
- _onTargetUpdate(ev) {
134
- let newOdd = ev.detail.data.odd;
135
- if (newOdd) {
136
- newOdd = newOdd.replace(/^(.*?)\.[^\.]+$/, '$1');
137
- }
138
- if (newOdd !== this.odd) {
139
- console.log('<pb-select-odd> Set current ODD from %s to %s', this.odd, newOdd);
140
- }
141
- this.odd = newOdd;
142
- }
143
-
150
+ this.odd = newOdd;
151
+ }
144
152
  }
145
153
  customElements.define('pb-select-odd', PbSelectOdd);