@teipublisher/pb-components 2.26.0-next-3.11 → 2.26.0-next-3.13

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 (133) 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 +38 -0
  5. package/Dockerfile +78 -70
  6. package/css/components.css +5 -5
  7. package/dist/demo/components.css +2 -8
  8. package/dist/demo/pb-drawer2.html +1 -1
  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/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
  14. package/dist/pb-code-editor.js +25 -20
  15. package/dist/pb-component-docs.js +58 -54
  16. package/dist/pb-components-bundle.js +1937 -1782
  17. package/dist/pb-edit-app.js +167 -107
  18. package/dist/pb-elements.json +45 -45
  19. package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
  20. package/dist/pb-leaflet-map.js +23 -23
  21. package/dist/pb-mei.js +56 -41
  22. package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
  23. package/dist/pb-odd-editor.js +923 -756
  24. package/dist/pb-tify.js +2 -2
  25. package/dist/{vaadin-element-mixin-6633322b.js → vaadin-element-mixin-84fb7d82.js} +181 -143
  26. package/gh-pages.js +5 -3
  27. package/i18n/common/pl.json +2 -2
  28. package/lib/openseadragon.min.js +1 -1
  29. package/package.json +2 -2
  30. package/pb-elements.json +45 -45
  31. package/src/assets/components.css +5 -5
  32. package/src/authority/airtable.js +20 -21
  33. package/src/authority/anton.js +129 -129
  34. package/src/authority/custom.js +23 -21
  35. package/src/authority/geonames.js +38 -32
  36. package/src/authority/gnd.js +47 -42
  37. package/src/authority/kbga.js +137 -134
  38. package/src/authority/metagrid.js +44 -46
  39. package/src/authority/reconciliation.js +66 -67
  40. package/src/authority/registry.js +4 -4
  41. package/src/docs/pb-component-docs.js +2 -2
  42. package/src/docs/pb-component-view.js +5 -5
  43. package/src/docs/pb-components-list.js +2 -2
  44. package/src/docs/pb-demo-snippet.js +2 -2
  45. package/src/dts-client.js +299 -297
  46. package/src/dts-select-endpoint.js +90 -82
  47. package/src/parse-date-service.js +184 -135
  48. package/src/pb-ajax.js +150 -146
  49. package/src/pb-authority-lookup.js +183 -146
  50. package/src/pb-autocomplete.js +292 -280
  51. package/src/pb-blacklab-highlight.js +264 -259
  52. package/src/pb-blacklab-results.js +236 -221
  53. package/src/pb-browse-docs.js +540 -475
  54. package/src/pb-browse.js +68 -65
  55. package/src/pb-clipboard.js +79 -76
  56. package/src/pb-code-editor.js +110 -102
  57. package/src/pb-code-highlight.js +209 -204
  58. package/src/pb-codepen.js +79 -72
  59. package/src/pb-collapse.js +212 -207
  60. package/src/pb-combo-box.js +190 -190
  61. package/src/pb-components-bundle.js +1 -1
  62. package/src/pb-custom-form.js +151 -149
  63. package/src/pb-dialog.js +96 -60
  64. package/src/pb-document.js +89 -90
  65. package/src/pb-download.js +210 -198
  66. package/src/pb-drawer.js +145 -148
  67. package/src/pb-edit-app.js +301 -229
  68. package/src/pb-edit-xml.js +98 -96
  69. package/src/pb-events.js +114 -107
  70. package/src/pb-facs-link.js +104 -102
  71. package/src/pb-facsimile.js +411 -413
  72. package/src/pb-formula.js +151 -153
  73. package/src/pb-geolocation.js +129 -131
  74. package/src/pb-grid-action.js +53 -56
  75. package/src/pb-grid.js +231 -228
  76. package/src/pb-highlight.js +140 -140
  77. package/src/pb-hotkeys.js +40 -42
  78. package/src/pb-i18n.js +101 -104
  79. package/src/pb-image-strip.js +84 -78
  80. package/src/pb-lang.js +132 -128
  81. package/src/pb-leaflet-map.js +488 -485
  82. package/src/pb-link.js +126 -124
  83. package/src/pb-load.js +431 -426
  84. package/src/pb-login.js +291 -248
  85. package/src/pb-manage-odds.js +364 -318
  86. package/src/pb-map-icon.js +89 -89
  87. package/src/pb-map-layer.js +85 -85
  88. package/src/pb-markdown.js +90 -99
  89. package/src/pb-media-query.js +74 -72
  90. package/src/pb-mei.js +306 -295
  91. package/src/pb-message.js +144 -144
  92. package/src/pb-mixin.js +269 -264
  93. package/src/pb-navigation.js +80 -82
  94. package/src/pb-observable.js +38 -38
  95. package/src/pb-odd-editor.js +1053 -955
  96. package/src/pb-odd-elementspec-editor.js +348 -297
  97. package/src/pb-odd-model-editor.js +1061 -901
  98. package/src/pb-odd-parameter-editor.js +200 -178
  99. package/src/pb-odd-rendition-editor.js +136 -124
  100. package/src/pb-page.js +431 -421
  101. package/src/pb-paginate.js +202 -190
  102. package/src/pb-panel.js +191 -179
  103. package/src/pb-popover-themes.js +7 -5
  104. package/src/pb-popover.js +296 -287
  105. package/src/pb-print-preview.js +127 -127
  106. package/src/pb-progress.js +51 -51
  107. package/src/pb-repeat.js +105 -104
  108. package/src/pb-restricted.js +84 -77
  109. package/src/pb-search.js +252 -241
  110. package/src/pb-select-feature.js +127 -120
  111. package/src/pb-select-odd.js +132 -124
  112. package/src/pb-select-template.js +89 -78
  113. package/src/pb-select.js +251 -227
  114. package/src/pb-split-list.js +179 -174
  115. package/src/pb-svg.js +80 -79
  116. package/src/pb-table-column.js +54 -54
  117. package/src/pb-table-grid.js +221 -203
  118. package/src/pb-tabs.js +61 -63
  119. package/src/pb-tify.js +154 -154
  120. package/src/pb-timeline.js +271 -229
  121. package/src/pb-toggle-feature.js +182 -175
  122. package/src/pb-upload.js +184 -174
  123. package/src/pb-version.js +30 -30
  124. package/src/pb-view-annotate.js +132 -98
  125. package/src/pb-view.js +1289 -1270
  126. package/src/pb-zoom.js +75 -59
  127. package/src/polymer-hack.js +1 -1
  128. package/src/search-result-service.js +256 -223
  129. package/src/seed-element.js +13 -20
  130. package/src/settings.js +4 -4
  131. package/src/theming.js +96 -96
  132. package/src/urls.js +289 -289
  133. package/src/utils.js +53 -51
@@ -1,156 +1,159 @@
1
- import { internalProperty } from "lit-element";
2
- import { Registry } from "./registry.js";
1
+ import { internalProperty } from 'lit-element';
2
+ import { Registry } from './registry.js';
3
3
 
4
4
  export class KBGA extends Registry {
5
-
6
- constructor(configElem) {
7
- super(configElem);
8
- this._api = configElem.getAttribute('api');
9
- this._limit = configElem.getAttribute('limit') || 999999;
10
- }
5
+ constructor(configElem) {
6
+ super(configElem);
7
+ this._api = configElem.getAttribute('api');
8
+ this._limit = configElem.getAttribute('limit') || 999999;
9
+ }
11
10
 
12
- async query(key) {
13
- const results = [];
14
-
15
- const register = this.getRegister();
16
- const searchParam = register === 'bibls' ? 'biblsearch' : 'search';
17
- const url = `https://meta.karl-barth.ch/api/${register}?${searchParam}=${encodeURIComponent(key)}&perPage=${this._limit}`;
18
- const label = this.getLabelField();
19
- return new Promise((resolve) => {
20
- fetch(url)
21
- .then(response => response.json())
22
- .then(json => {
23
- json.data.forEach(item => {
24
-
25
- if ((this._register === 'organization' && item.authority_type !== 'organisation') ||
26
- (this._register === 'person' && item.authority_type !== 'person')) {
27
- return;
28
- }
29
- const result = {
30
- register: this._register,
31
- id: (this._prefix ? `${this._prefix}:${item['full-id']}` : item['full-id']),
32
- label: typeof label === "string" ? item[label] : label(item),
33
- details: `${item['full-id']}`,
34
- link: `https://meta.karl-barth.ch/${register}/${item.id}`,
35
- strings: [typeof label === "string" ? item[label] : label(item)],
36
- provider: 'KBGA'
37
- };
38
- results.push(result);
39
- });
40
- resolve({
41
- totalItems: json.meta.total,
42
- items: results,
43
- });
44
- });
45
- })
46
- }
11
+ async query(key) {
12
+ const results = [];
47
13
 
48
- info(key, container) {
49
- if (!key) {
50
- return Promise.resolve({});
51
- }
52
- const label = this.getLabelField();
53
- return new Promise((resolve) => {
54
- this.getRecord(key)
14
+ const register = this.getRegister();
15
+ const searchParam = register === 'bibls' ? 'biblsearch' : 'search';
16
+ const url = `https://meta.karl-barth.ch/api/${register}?${searchParam}=${encodeURIComponent(
17
+ key,
18
+ )}&perPage=${this._limit}`;
19
+ const label = this.getLabelField();
20
+ return new Promise(resolve => {
21
+ fetch(url)
22
+ .then(response => response.json())
55
23
  .then(json => {
56
- const died = json.data.death ? `† ${json.data.death}` : '';
57
- const dates = json.data.birth ? `<p>* ${json.data.birth} ${died}</p>` : '';
58
- const note = json.data.note_bio ? `<p>${json.data.note_bio}</p>` : '';
59
- const output = `
60
- <h3 class="label"><a href="https://${json.wikipediaURL}" target="_blank">${typeof label === 'string' ? json.data[label] : label(json.data)}</a></h3>
24
+ json.data.forEach(item => {
25
+ if (
26
+ (this._register === 'organization' && item.authority_type !== 'organisation') ||
27
+ (this._register === 'person' && item.authority_type !== 'person')
28
+ ) {
29
+ return;
30
+ }
31
+ const result = {
32
+ register: this._register,
33
+ id: this._prefix ? `${this._prefix}:${item['full-id']}` : item['full-id'],
34
+ label: typeof label === 'string' ? item[label] : label(item),
35
+ details: `${item['full-id']}`,
36
+ link: `https://meta.karl-barth.ch/${register}/${item.id}`,
37
+ strings: [typeof label === 'string' ? item[label] : label(item)],
38
+ provider: 'KBGA',
39
+ };
40
+ results.push(result);
41
+ });
42
+ resolve({
43
+ totalItems: json.meta.total,
44
+ items: results,
45
+ });
46
+ });
47
+ });
48
+ }
49
+
50
+ info(key, container) {
51
+ if (!key) {
52
+ return Promise.resolve({});
53
+ }
54
+ const label = this.getLabelField();
55
+ return new Promise(resolve => {
56
+ this.getRecord(key).then(json => {
57
+ const died = json.data.death ? `† ${json.data.death}` : '';
58
+ const dates = json.data.birth ? `<p>* ${json.data.birth} ${died}</p>` : '';
59
+ const note = json.data.note_bio ? `<p>${json.data.note_bio}</p>` : '';
60
+ const output = `
61
+ <h3 class="label"><a href="https://${json.wikipediaURL}" target="_blank">${
62
+ typeof label === 'string' ? json.data[label] : label(json.data)
63
+ }</a></h3>
61
64
  ${dates}
62
65
  ${note}
63
66
  `;
64
- container.innerHTML = output;
65
- resolve({
66
- id: json.data['full-id'],
67
- strings: [typeof label === 'string' ? json.data[label] : label(json.data)]
68
- });
67
+ container.innerHTML = output;
68
+ resolve({
69
+ id: json.data['full-id'],
70
+ strings: [typeof label === 'string' ? json.data[label] : label(json.data)],
69
71
  });
70
72
  });
71
- }
73
+ });
74
+ }
72
75
 
73
- /**
76
+ /**
74
77
  * Retrieve a raw JSON record for the given key as returned by the endpoint.
75
- *
78
+ *
76
79
  * @param {string} key the key to look up
77
80
  * @returns {Promise<any>} promise resolving to the JSON record returned by the endpoint
78
81
  */
79
82
  async getRecord(key) {
80
- const id = key.replace(/^.*-([^-]+)$/, '$1')
83
+ const id = key.replace(/^.*-([^-]+)$/, '$1');
81
84
  return fetch(`https://meta.karl-barth.ch/api/${this.getRegister()}/${id}`)
82
- .then(response => response.json())
83
- .then(json => {
84
- const output = Object.assign({}, json);
85
- output.name = json.data[this.getLabelField()];
86
- switch (this._register) {
87
- case 'place':
88
- output.country = json.data.country;
89
- output.location = json.data.location.coordinates;
90
- output.links = json.data.links.map((link) => link.url);
91
- break;
92
- case 'person':
93
- output.birth = json.data.birth;
94
- output.death = json.data.death;
95
- output.note = json.data.note_bio;
96
- output.links = [`https://${json.wikipediaURL}`];
97
- break;
98
- default:
99
- break;
100
- }
101
- return output;
102
- })
103
- .catch((reason) => Promise.reject(reason));
104
- }
105
-
106
- getLabelField() {
107
- let label;
108
- switch (this._register) {
85
+ .then(response => response.json())
86
+ .then(json => {
87
+ const output = { ...json };
88
+ output.name = json.data[this.getLabelField()];
89
+ switch (this._register) {
109
90
  case 'place':
110
- label = 'placeName_full';
111
- break;
112
- case 'term':
113
- label = 'fullLabel';
114
- break;
115
- case 'abbreviation':
116
- label = 'label';
117
- break;
118
- case 'bibl':
119
- case 'songs':
120
- label = 'asHtml';
121
- break;
91
+ output.country = json.data.country;
92
+ output.location = json.data.location.coordinates;
93
+ output.links = json.data.links.map(link => link.url);
94
+ break;
95
+ case 'person':
96
+ output.birth = json.data.birth;
97
+ output.death = json.data.death;
98
+ output.note = json.data.note_bio;
99
+ output.links = [`https://${json.wikipediaURL}`];
100
+ break;
122
101
  default:
123
- label = 'persName_full';
124
- break;
125
- }
126
- return label;
102
+ break;
103
+ }
104
+ return output;
105
+ })
106
+ .catch(reason => Promise.reject(reason));
107
+ }
108
+
109
+ getLabelField() {
110
+ let label;
111
+ switch (this._register) {
112
+ case 'place':
113
+ label = 'placeName_full';
114
+ break;
115
+ case 'term':
116
+ label = 'fullLabel';
117
+ break;
118
+ case 'abbreviation':
119
+ label = 'label';
120
+ break;
121
+ case 'bibl':
122
+ case 'songs':
123
+ label = 'asHtml';
124
+ break;
125
+ default:
126
+ label = 'persName_full';
127
+ break;
127
128
  }
129
+ return label;
130
+ }
128
131
 
129
- getRegister() {
130
- if (this._api) {
131
- return this._api;
132
- }
133
- let register;
134
- switch(this._register) {
135
- case 'person':
136
- case 'organization':
137
- register = 'actors';
138
- break;
139
- case 'place':
140
- register = 'places';
141
- break;
142
- case 'term':
143
- register = 'terms';
144
- break;
145
- case 'abbreviation':
146
- register = 'abbreviations';
147
- break;
148
- case 'bibl':
149
- register = 'bibls';
150
- break;
151
- default:
152
- register = this._register;
153
- }
154
- return register;
132
+ getRegister() {
133
+ if (this._api) {
134
+ return this._api;
155
135
  }
156
- }
136
+ let register;
137
+ switch (this._register) {
138
+ case 'person':
139
+ case 'organization':
140
+ register = 'actors';
141
+ break;
142
+ case 'place':
143
+ register = 'places';
144
+ break;
145
+ case 'term':
146
+ register = 'terms';
147
+ break;
148
+ case 'abbreviation':
149
+ register = 'abbreviations';
150
+ break;
151
+ case 'bibl':
152
+ register = 'bibls';
153
+ break;
154
+ default:
155
+ register = this._register;
156
+ }
157
+ return register;
158
+ }
159
+ }
@@ -2,42 +2,40 @@
2
2
  import { Registry } from './registry.js';
3
3
 
4
4
  export class Metagrid extends Registry {
5
-
6
5
  async query(key) {
7
6
  const query = key.replace(/[^\w\s]+/g, '');
8
7
  const results = [];
9
8
  const url = `https://api.metagrid.ch/search?query=${encodeURIComponent(query)}`;
10
-
11
- return new Promise((resolve) => {
12
- fetch(url)
13
- .then((response) => response.json())
14
- .then((json) => {
15
- json.resources.forEach(item => {
16
- const name = `${item.metadata.last_name}, ${item.metadata.first_name} `;
17
- const result = {
18
- register: this._register,
19
- id: `${item.provider.slug}-${item.identifier}`,
20
- label: name,
21
- details: `${item.metadata.birth_date} - ${item.metadata.death_date}`,
22
- link: item.link.uri,
23
- provider: item.provider.slug
24
- };
25
- results.push(result);
26
- });
27
- resolve({
28
- totalItems: json.meta.total,
29
- items: results,
30
- });
9
+
10
+ return new Promise(resolve => {
11
+ fetch(url)
12
+ .then(response => response.json())
13
+ .then(json => {
14
+ json.resources.forEach(item => {
15
+ const name = `${item.metadata.last_name}, ${item.metadata.first_name} `;
16
+ const result = {
17
+ register: this._register,
18
+ id: `${item.provider.slug}-${item.identifier}`,
19
+ label: name,
20
+ details: `${item.metadata.birth_date} - ${item.metadata.death_date}`,
21
+ link: item.link.uri,
22
+ provider: item.provider.slug,
23
+ };
24
+ results.push(result);
25
+ });
26
+ resolve({
27
+ totalItems: json.meta.total,
28
+ items: results,
29
+ });
31
30
  });
32
- })
31
+ });
33
32
  }
34
33
 
35
34
  info(key, container) {
36
35
  const p = key.indexOf('-');
37
36
  const slug = key.substring(0, p);
38
- return new Promise((resolve) => {
39
- this.getRecord(key)
40
- .then(json => {
37
+ return new Promise(resolve => {
38
+ this.getRecord(key).then(json => {
41
39
  const output = `
42
40
  <h3 class="label">
43
41
  <a href="https://${json.link.uri}" target="_blank">
@@ -49,37 +47,37 @@ export class Metagrid extends Registry {
49
47
  container.innerHTML = output;
50
48
  resolve({
51
49
  id: `${slug}-${json.identifier}`,
52
- strings: [`${json.metadata.first_name} ${json.metadata.last_name}`]
53
- })
50
+ strings: [`${json.metadata.first_name} ${json.metadata.last_name}`],
51
+ });
54
52
  });
55
53
  });
56
54
  }
57
55
 
58
56
  /**
59
57
  * Retrieve a raw JSON record for the given key as returned by the endpoint.
60
- *
58
+ *
61
59
  * @param {string} key the key to look up
62
60
  * @returns {Promise<any>} promise resolving to the JSON record returned by the endpoint
63
61
  */
64
- async getRecord(key) {
62
+ async getRecord(key) {
65
63
  const p = key.indexOf('-');
66
64
  const slug = key.substring(0, p);
67
65
  const id = key.substring(p + 1);
68
66
  return fetch(`https://api.metagrid.ch/search?slug=${slug}&query=${id}`)
69
- .then(response => response.json())
70
- .then(json => {
71
- const item = json.resources[0];
72
- const output = Object.assign({}, item);
73
- output.name = `${item.metadata.first_name} ${item.metadata.last_name}`;
74
- output.links = [`https://${item.link.uri}`];
75
- if (item.metadata.birth_date && item.metadata.birth_date.length > 0) {
76
- output.birth = item.metadata.birth_date;
77
- }
78
- if (item.metadata.death_date && item.metadata.death_date.length > 0) {
79
- output.death = item.metadata.death_date;
80
- }
81
- return output;
82
- })
83
- .catch((reason) => Promise.reject(reason));
84
- }
67
+ .then(response => response.json())
68
+ .then(json => {
69
+ const item = json.resources[0];
70
+ const output = { ...item };
71
+ output.name = `${item.metadata.first_name} ${item.metadata.last_name}`;
72
+ output.links = [`https://${item.link.uri}`];
73
+ if (item.metadata.birth_date && item.metadata.birth_date.length > 0) {
74
+ output.birth = item.metadata.birth_date;
75
+ }
76
+ if (item.metadata.death_date && item.metadata.death_date.length > 0) {
77
+ output.death = item.metadata.death_date;
78
+ }
79
+ return output;
80
+ })
81
+ .catch(reason => Promise.reject(reason));
82
+ }
85
83
  }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable class-methods-use-this */
2
- import { Registry } from './registry.js'
2
+ import { Registry } from './registry.js';
3
3
 
4
4
  // Todo:
5
5
  // - strings <- types
@@ -7,26 +7,28 @@ import { Registry } from './registry.js'
7
7
  // - test with other providers, inside custom connector
8
8
  // - documentation
9
9
 
10
- async function getServiceManifest (endpoint) {
11
- const response = await fetch(endpoint);
12
- const data = await response.json();
10
+ async function getServiceManifest(endpoint) {
11
+ const response = await fetch(endpoint);
12
+ const data = await response.json();
13
13
  return data;
14
14
  }
15
15
 
16
16
  export class ReconciliationService extends Registry {
17
17
  constructor(configElem) {
18
- super(configElem)
18
+ super(configElem);
19
19
  this.endpoint = configElem.getAttribute('endpoint');
20
20
  this.debug = configElem.getAttribute('debug');
21
- getServiceManifest(this.endpoint).then((result) => {
21
+ getServiceManifest(this.endpoint).then(result => {
22
22
  this.ORConfig = result;
23
23
  if (this.debug) {
24
24
  console.log(
25
- 'OpenReconcile connector for register \'%s\' at endpoint <%s>. Using config: %o',
26
- this._register, this.endpoint, this.ORConfig
25
+ "OpenReconcile connector for register '%s' at endpoint <%s>. Using config: %o",
26
+ this._register,
27
+ this.endpoint,
28
+ this.ORConfig,
27
29
  );
28
30
  }
29
- })
31
+ });
30
32
  }
31
33
 
32
34
  /**
@@ -37,57 +39,54 @@ export class ReconciliationService extends Registry {
37
39
  async query(key) {
38
40
  const results = [];
39
41
  const paramsObj = {
40
- q1: {
41
- query: key
42
- }
43
- };
42
+ q1: {
43
+ query: key,
44
+ },
45
+ };
44
46
 
45
- return new Promise((resolve) => {
46
- fetch(this.endpoint, {
47
- method: 'POST',
48
- headers: {
49
- 'Accept': 'application/json',
50
- 'Content-Type': 'application/x-www-form-urlencoded'
51
- },
52
- body: "queries=".concat(JSON.stringify(paramsObj))
53
- })
54
- .then((response) => response.json())
55
- .then((json) => {
56
- json.q1.result.forEach((item) => {
57
- if (this.ORConfig.view) {
58
- this.view = this.ORConfig.view.url.replace('{{id}}', item.id);
59
- } else {
60
- this.view = item.id;
61
- }
62
- if (item.description) {
63
- this.description = item.description;
64
- } else if (item.type) {
65
- this.description = item.type.map(t => t.name.toString() ).join(', ')
66
- } else {
67
- this.description = ""
68
- }
69
- const result = {
70
- register: this._register,
71
- id: (this._prefix ? `${this._prefix}-${item.id}` : item.id),
72
- label: item.name,
73
- link: this.view,
74
- details: this.description,
75
- provider: 'OpenReconcile'
76
- };
77
- results.push(result);
78
- });
79
- if (this.debug) {
80
- console.log(
81
- 'OpenReconcile results: %o',
82
- results
83
- );
47
+ return new Promise(resolve => {
48
+ fetch(this.endpoint, {
49
+ method: 'POST',
50
+ headers: {
51
+ Accept: 'application/json',
52
+ 'Content-Type': 'application/x-www-form-urlencoded',
53
+ },
54
+ body: 'queries='.concat(JSON.stringify(paramsObj)),
55
+ })
56
+ .then(response => response.json())
57
+ .then(json => {
58
+ json.q1.result.forEach(item => {
59
+ if (this.ORConfig.view) {
60
+ this.view = this.ORConfig.view.url.replace('{{id}}', item.id);
61
+ } else {
62
+ this.view = item.id;
84
63
  }
85
- resolve({
86
- totalItems: json.q1.result.length,
87
- items: results,
88
- });
89
- })
90
- })
64
+ if (item.description) {
65
+ this.description = item.description;
66
+ } else if (item.type) {
67
+ this.description = item.type.map(t => t.name.toString()).join(', ');
68
+ } else {
69
+ this.description = '';
70
+ }
71
+ const result = {
72
+ register: this._register,
73
+ id: this._prefix ? `${this._prefix}-${item.id}` : item.id,
74
+ label: item.name,
75
+ link: this.view,
76
+ details: this.description,
77
+ provider: 'OpenReconcile',
78
+ };
79
+ results.push(result);
80
+ });
81
+ if (this.debug) {
82
+ console.log('OpenReconcile results: %o', results);
83
+ }
84
+ resolve({
85
+ totalItems: json.q1.result.length,
86
+ items: results,
87
+ });
88
+ });
89
+ });
91
90
  }
92
91
 
93
92
  /**
@@ -103,7 +102,7 @@ export class ReconciliationService extends Registry {
103
102
  return Promise.resolve({});
104
103
  }
105
104
  if (!this.ORConfig.preview) {
106
- container.innerHTML = 'no \'preview\' information in endpoint\'s manifest';
105
+ container.innerHTML = "no 'preview' information in endpoint's manifest";
107
106
  return Promise.resolve();
108
107
  }
109
108
 
@@ -111,14 +110,14 @@ export class ReconciliationService extends Registry {
111
110
  const rawid = this._prefix ? id.substring(this._prefix.length + 1) : id;
112
111
  const url = this.ORConfig.preview.url.replace('{{id}}', encodeURIComponent(rawid));
113
112
  fetch(url)
114
- .then(response => response.text())
115
- .then((output) => {
116
- container.innerHTML = output;
117
- resolve({
118
- id: this._prefix ? `${this._prefix}-${rawid}` : rawid
119
- });
120
- })
121
- .catch(() => reject());
113
+ .then(response => response.text())
114
+ .then(output => {
115
+ container.innerHTML = output;
116
+ resolve({
117
+ id: this._prefix ? `${this._prefix}-${rawid}` : rawid,
118
+ });
119
+ })
120
+ .catch(() => reject());
122
121
  });
123
122
  }
124
123
  }
@@ -29,11 +29,11 @@ export class Registry {
29
29
  set name(name) {
30
30
  this._register = name;
31
31
  }
32
-
32
+
33
33
  get editable() {
34
34
  return false;
35
35
  }
36
-
36
+
37
37
  /**
38
38
  * Query the authority and return a RegistryResult.
39
39
  *
@@ -69,11 +69,11 @@ export class Registry {
69
69
 
70
70
  /**
71
71
  * Retrieve a raw JSON record for the given key as returned by the endpoint.
72
- *
72
+ *
73
73
  * @param {string} key the key to look up
74
74
  * @returns {Promise<any>} promise resolving to the JSON record returned by the endpoint
75
75
  */
76
76
  async getRecord(key) {
77
- return Promise.reject();
77
+ return Promise.reject();
78
78
  }
79
79
  }
@@ -8,7 +8,7 @@ import { PbComponentView } from './pb-component-view.js';
8
8
  /**
9
9
  * An API viewer for webcomponents based on the JSON format produced
10
10
  * by web-component-analyzer.
11
- *
11
+ *
12
12
  * @slot logo - HTML to show as logo on top of the drawer
13
13
  * @listens pb-api-component if another webcomponent should be shown
14
14
  */
@@ -171,4 +171,4 @@ export class PbComponentDocs extends LitElement {
171
171
  `;
172
172
  }
173
173
  }
174
- customElements.define('pb-component-docs', PbComponentDocs);
174
+ customElements.define('pb-component-docs', PbComponentDocs);