@teipublisher/pb-components 2.15.0 → 2.15.2

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.
@@ -2396,7 +2396,7 @@
2396
2396
  "attributes": [
2397
2397
  {
2398
2398
  "name": "code",
2399
- "description": "The code to be highlighted as a string. If not set,\r\nthis will be populated from either a template child element\r\nor the element's text content.",
2399
+ "description": "The code to be highlighted as a string. If not set,\r\nthis will be populated from either a template child element\r\nor the element's text content.\r\nThe value of the property can be changed programmatically from JavaScript.",
2400
2400
  "type": "string"
2401
2401
  },
2402
2402
  {
@@ -2421,7 +2421,7 @@
2421
2421
  {
2422
2422
  "name": "code",
2423
2423
  "attribute": "code",
2424
- "description": "The code to be highlighted as a string. If not set,\r\nthis will be populated from either a template child element\r\nor the element's text content.",
2424
+ "description": "The code to be highlighted as a string. If not set,\r\nthis will be populated from either a template child element\r\nor the element's text content.\r\nThe value of the property can be changed programmatically from JavaScript.",
2425
2425
  "type": "string"
2426
2426
  },
2427
2427
  {
@@ -7147,6 +7147,11 @@
7147
7147
  "description": "Register a shortcut key, e.g. 'left' or 'shift+left'",
7148
7148
  "type": "string"
7149
7149
  },
7150
+ {
7151
+ "name": "rendition",
7152
+ "description": "Rendition of the navigation element if it's disabled\nPossible values:\n- hidden (default if not set; control is removed from the document layout)\n- invisible (controll is hidden, but keeped in the document layout)\n- visible (control is visible)",
7153
+ "type": "string"
7154
+ },
7150
7155
  {
7151
7156
  "name": "direction",
7152
7157
  "description": "The direction to navigate in, either `forward` or `backward`",
@@ -7197,6 +7202,12 @@
7197
7202
  "description": "Register a shortcut key, e.g. 'left' or 'shift+left'",
7198
7203
  "type": "string"
7199
7204
  },
7205
+ {
7206
+ "name": "rendition",
7207
+ "attribute": "rendition",
7208
+ "description": "Rendition of the navigation element if it's disabled\nPossible values:\n- hidden (default if not set; control is removed from the document layout)\n- invisible (controll is hidden, but keeped in the document layout)\n- visible (control is visible)",
7209
+ "type": "string"
7210
+ },
7200
7211
  {
7201
7212
  "name": "direction",
7202
7213
  "attribute": "direction",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teipublisher/pb-components",
3
- "version": "2.15.0",
3
+ "version": "2.15.2",
4
4
  "description": "Collection of webcomponents underlying TEI Publisher",
5
5
  "repository": "https://github.com/eeditiones/tei-publisher-components.git",
6
6
  "main": "index.html",
package/pb-elements.json CHANGED
@@ -2396,7 +2396,7 @@
2396
2396
  "attributes": [
2397
2397
  {
2398
2398
  "name": "code",
2399
- "description": "The code to be highlighted as a string. If not set,\r\nthis will be populated from either a template child element\r\nor the element's text content.",
2399
+ "description": "The code to be highlighted as a string. If not set,\r\nthis will be populated from either a template child element\r\nor the element's text content.\r\nThe value of the property can be changed programmatically from JavaScript.",
2400
2400
  "type": "string"
2401
2401
  },
2402
2402
  {
@@ -2421,7 +2421,7 @@
2421
2421
  {
2422
2422
  "name": "code",
2423
2423
  "attribute": "code",
2424
- "description": "The code to be highlighted as a string. If not set,\r\nthis will be populated from either a template child element\r\nor the element's text content.",
2424
+ "description": "The code to be highlighted as a string. If not set,\r\nthis will be populated from either a template child element\r\nor the element's text content.\r\nThe value of the property can be changed programmatically from JavaScript.",
2425
2425
  "type": "string"
2426
2426
  },
2427
2427
  {
@@ -7147,6 +7147,11 @@
7147
7147
  "description": "Register a shortcut key, e.g. 'left' or 'shift+left'",
7148
7148
  "type": "string"
7149
7149
  },
7150
+ {
7151
+ "name": "rendition",
7152
+ "description": "Rendition of the navigation element if it's disabled\nPossible values:\n- hidden (default if not set; control is removed from the document layout)\n- invisible (controll is hidden, but keeped in the document layout)\n- visible (control is visible)",
7153
+ "type": "string"
7154
+ },
7150
7155
  {
7151
7156
  "name": "direction",
7152
7157
  "description": "The direction to navigate in, either `forward` or `backward`",
@@ -7197,6 +7202,12 @@
7197
7202
  "description": "Register a shortcut key, e.g. 'left' or 'shift+left'",
7198
7203
  "type": "string"
7199
7204
  },
7205
+ {
7206
+ "name": "rendition",
7207
+ "attribute": "rendition",
7208
+ "description": "Rendition of the navigation element if it's disabled\nPossible values:\n- hidden (default if not set; control is removed from the document layout)\n- invisible (controll is hidden, but keeped in the document layout)\n- visible (control is visible)",
7209
+ "type": "string"
7210
+ },
7200
7211
  {
7201
7212
  "name": "direction",
7202
7213
  "attribute": "direction",
@@ -163,6 +163,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
163
163
  const connector = this._authorities[item.register];
164
164
  const options = {
165
165
  strings: item.strings,
166
+ type: item.register,
166
167
  properties: {
167
168
  ref: item.id,
168
169
  }
@@ -182,9 +183,9 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
182
183
  if (connector) {
183
184
  connector
184
185
  .select(item)
185
- .then(() => this.emitTo('pb-authority-edit-entity', {id: item.id}));
186
+ .then(() => this.emitTo('pb-authority-edit-entity', {id: item.id, type: item.register}));
186
187
  } else {
187
- this.emitTo('pb-authority-edit-entity', {id: item.id});
188
+ this.emitTo('pb-authority-edit-entity', {id: item.id, type: item.register});
188
189
  }
189
190
  }
190
191
 
@@ -207,7 +208,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
207
208
  }
208
209
 
209
210
  _addEntity() {
210
- this.emitTo('pb-authority-new-entity', {query: this.query});
211
+ this.emitTo('pb-authority-new-entity', {query: this.query, type: this.type});
211
212
  }
212
213
 
213
214
  _occurrences(items) {
@@ -51,6 +51,7 @@ export class PbCodeHighlight extends themableMixin(LitElement) {
51
51
  * The code to be highlighted as a string. If not set,
52
52
  * this will be populated from either a template child element
53
53
  * or the element's text content.
54
+ * The value of the property can be changed programmatically from JavaScript.
54
55
  */
55
56
  code: {
56
57
  type: String
@@ -118,6 +119,14 @@ export class PbCodeHighlight extends themableMixin(LitElement) {
118
119
  updated(changedProperties) {
119
120
  super.updated(changedProperties);
120
121
  if (changedProperties.has('code')) {
122
+ //if the code property is changed, the content of the <code> element is replaced
123
+ const pre = this.shadowRoot.getElementById("pb-code-highlight");
124
+ if(pre != null) {
125
+ const code = document.createElement("code");
126
+ code.textContent = this.code; //textContent property keeps new lines in the code
127
+ pre.replaceChildren(code);
128
+
129
+ }
121
130
  this.highlight();
122
131
  }
123
132
  }
@@ -130,7 +139,7 @@ export class PbCodeHighlight extends themableMixin(LitElement) {
130
139
  if (this.code) {
131
140
  return html`
132
141
  ${this._themeStyles}
133
- <pre class="${this.lineNumbers ? 'line-numbers' : ''} language-${this.language}"><code>${this.code}</code></pre>
142
+ <pre id="pb-code-highlight" class="${this.lineNumbers ? 'line-numbers' : ''} language-${this.language}"><code>${this.code}</code></pre>
134
143
  `;
135
144
  }
136
145
  return html`<pre class="line-numbers"><code><code></pre>`;
@@ -157,7 +157,7 @@ export class PbComboBox extends pbMixin(LitElement) {
157
157
  const url = this.toAbsoluteURL(this.source);
158
158
  options.labelField = 'text';
159
159
  options.valueField = 'value';
160
- options.searchField = ['text', 'value'];
160
+ options.searchField = [];
161
161
  options.preload = this.preload;
162
162
  options.load = (query, callback) => {
163
163
  fetch(`${url}?query=${encodeURIComponent(query)}`, {
@@ -27,6 +27,16 @@ export class PbNavigation extends pbHotkeys(pbMixin(LitElement)) {
27
27
  */
28
28
  keyboard: {
29
29
  type: String
30
+ },
31
+ /**
32
+ * Rendition of the navigation element if it's disabled
33
+ * Possible values:
34
+ * - hidden (default if not set; control is removed from the document layout)
35
+ * - invisible (controll is hidden, but keeped in the document layout)
36
+ * - visible (control is visible)
37
+ */
38
+ rendition : {
39
+ type: String
30
40
  }
31
41
  };
32
42
  }
@@ -79,13 +89,20 @@ export class PbNavigation extends pbHotkeys(pbMixin(LitElement)) {
79
89
 
80
90
  static get styles() {
81
91
  return css`
82
- :host {
83
- display: inline;
84
- }
85
- :host([disabled]) {
86
- display: none;
87
- }
88
- `;
92
+ :host {
93
+ display: inline;
94
+ }
95
+ :host([disabled]):host(:not([rendition])), :host([disabled]):host([rendition="hidden"]) {
96
+ display: none;
97
+ }
98
+ :host([disabled]):host([rendition="invisible"]) {
99
+ visibility: hidden;
100
+ }
101
+ :host([disabled]):host([rendition="visible"]) {
102
+ visibility: visible;
103
+ cursor: not-allowed;
104
+ }
105
+ `;
89
106
  }
90
107
  }
91
108