kr-elements 0.0.1-alpha.35 → 0.0.1-alpha.37
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.
- package/dist/cjs/combobox/Combobox.markup.js +8 -1
- package/dist/cjs/combobox/HTML.combobox.element.js +2 -1
- package/dist/cjs/combobox/HTML.combobox.option.element.js +6 -31
- package/dist/esm/combobox/Combobox.markup.js +8 -1
- package/dist/esm/combobox/HTML.combobox.element.js +2 -1
- package/dist/esm/combobox/HTML.combobox.option.element.js +6 -31
- package/dist/types/combobox/Combobox.markup.d.ts +1 -0
- package/dist/types/combobox/Combobox.markup.d.ts.map +1 -1
- package/dist/types/combobox/HTML.combobox.element.d.ts +1 -1
- package/dist/types/combobox/HTML.combobox.element.d.ts.map +1 -1
- package/dist/types/combobox/HTML.combobox.option.element.d.ts +0 -1
- package/dist/types/combobox/HTML.combobox.option.element.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -147,7 +147,7 @@ class ComboboxMarkup {
|
|
|
147
147
|
const template = this.tagTemplate;
|
|
148
148
|
tag = template.cloneNode(true);
|
|
149
149
|
const label = tag.querySelector('[part="tag-label"]');
|
|
150
|
-
label.textContent = option.
|
|
150
|
+
label.textContent = option.textContent;
|
|
151
151
|
button = tag.querySelector('[part="clear-tag"]');
|
|
152
152
|
}
|
|
153
153
|
button?.setAttribute('value', value);
|
|
@@ -165,6 +165,13 @@ class ComboboxMarkup {
|
|
|
165
165
|
return this.optionsContainer
|
|
166
166
|
.querySelectorAll('box-option[selected]');
|
|
167
167
|
}
|
|
168
|
+
static importCSS(urls) {
|
|
169
|
+
ComboboxMarkup.template.replace(':host {', `
|
|
170
|
+
${urls.map(url => `@import "${url}"`)}
|
|
171
|
+
|
|
172
|
+
:host {
|
|
173
|
+
`);
|
|
174
|
+
}
|
|
168
175
|
static get template() {
|
|
169
176
|
return `
|
|
170
177
|
<style>
|
|
@@ -327,7 +327,8 @@ class HTMLComboboxElement extends HTMLElement {
|
|
|
327
327
|
this[key] = this.getAttribute(key);
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
static
|
|
330
|
+
static loadCssFromUrls(urls) {
|
|
331
|
+
Combobox_markup_js_1.ComboboxMarkup.importCSS(urls);
|
|
331
332
|
}
|
|
332
333
|
static loadCssFromDocumentStyleSheets() {
|
|
333
334
|
if (document.readyState === 'complete') {
|
|
@@ -5,54 +5,29 @@ exports.HTMLComboboxOptionElement = void 0;
|
|
|
5
5
|
const Boolean_attribute_value_normalizer_js_1 = require("./Boolean.attribute.value.normalizer.js");
|
|
6
6
|
class HTMLComboboxOptionElement extends HTMLElement {
|
|
7
7
|
static OWN_IDL = new Set(['value', 'label', 'selected']);
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
-
}
|
|
11
8
|
connectedCallback() {
|
|
12
9
|
this.#initialAttributesSynchronization();
|
|
13
10
|
this.part.add('option');
|
|
14
11
|
super.setAttribute('tabindex', "0");
|
|
15
12
|
super.setAttribute('role', "option");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const hasNoMarkup = this.children.length === 0;
|
|
19
|
-
const text = this.textContent.trim();
|
|
20
|
-
const hasText = text.length > 0;
|
|
21
|
-
if (!value && !label) {
|
|
22
|
-
if (hasNoMarkup && hasText) {
|
|
23
|
-
this.value = text;
|
|
24
|
-
this.label = text;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
throw new Error('box-option must have value and label attributes');
|
|
28
|
-
}
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
if (value && !label) {
|
|
32
|
-
if (hasNoMarkup && hasText) {
|
|
33
|
-
this.label = text;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.label = value;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (!value && label) {
|
|
40
|
-
this.value = label;
|
|
41
|
-
}
|
|
42
|
-
if (hasNoMarkup && !hasText) {
|
|
43
|
-
this.textContent = label || value;
|
|
13
|
+
if (!this.value) {
|
|
14
|
+
this.value = this.textContent;
|
|
44
15
|
}
|
|
45
16
|
}
|
|
46
17
|
get value() {
|
|
47
18
|
return this.getAttribute('value');
|
|
48
19
|
}
|
|
49
20
|
set value(value) {
|
|
21
|
+
if (value == null)
|
|
22
|
+
return;
|
|
50
23
|
super.setAttribute('value', String(value));
|
|
51
24
|
}
|
|
52
25
|
get label() {
|
|
53
26
|
return this.getAttribute('label');
|
|
54
27
|
}
|
|
55
28
|
set label(value) {
|
|
29
|
+
if (value == null)
|
|
30
|
+
return;
|
|
56
31
|
super.setAttribute('label', String(value));
|
|
57
32
|
}
|
|
58
33
|
get selected() {
|
|
@@ -144,7 +144,7 @@ export class ComboboxMarkup {
|
|
|
144
144
|
const template = this.tagTemplate;
|
|
145
145
|
tag = template.cloneNode(true);
|
|
146
146
|
const label = tag.querySelector('[part="tag-label"]');
|
|
147
|
-
label.textContent = option.
|
|
147
|
+
label.textContent = option.textContent;
|
|
148
148
|
button = tag.querySelector('[part="clear-tag"]');
|
|
149
149
|
}
|
|
150
150
|
button?.setAttribute('value', value);
|
|
@@ -162,6 +162,13 @@ export class ComboboxMarkup {
|
|
|
162
162
|
return this.optionsContainer
|
|
163
163
|
.querySelectorAll('box-option[selected]');
|
|
164
164
|
}
|
|
165
|
+
static importCSS(urls) {
|
|
166
|
+
ComboboxMarkup.template.replace(':host {', `
|
|
167
|
+
${urls.map(url => `@import "${url}"`)}
|
|
168
|
+
|
|
169
|
+
:host {
|
|
170
|
+
`);
|
|
171
|
+
}
|
|
165
172
|
static get template() {
|
|
166
173
|
return `
|
|
167
174
|
<style>
|
|
@@ -323,7 +323,8 @@ export class HTMLComboboxElement extends HTMLElement {
|
|
|
323
323
|
this[key] = this.getAttribute(key);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
static
|
|
326
|
+
static loadCssFromUrls(urls) {
|
|
327
|
+
ComboboxMarkup.importCSS(urls);
|
|
327
328
|
}
|
|
328
329
|
static loadCssFromDocumentStyleSheets() {
|
|
329
330
|
if (document.readyState === 'complete') {
|
|
@@ -1,54 +1,29 @@
|
|
|
1
1
|
import { toBoolean } from './Boolean.attribute.value.normalizer.js';
|
|
2
2
|
export class HTMLComboboxOptionElement extends HTMLElement {
|
|
3
3
|
static OWN_IDL = new Set(['value', 'label', 'selected']);
|
|
4
|
-
constructor() {
|
|
5
|
-
super();
|
|
6
|
-
}
|
|
7
4
|
connectedCallback() {
|
|
8
5
|
this.#initialAttributesSynchronization();
|
|
9
6
|
this.part.add('option');
|
|
10
7
|
super.setAttribute('tabindex', "0");
|
|
11
8
|
super.setAttribute('role', "option");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const hasNoMarkup = this.children.length === 0;
|
|
15
|
-
const text = this.textContent.trim();
|
|
16
|
-
const hasText = text.length > 0;
|
|
17
|
-
if (!value && !label) {
|
|
18
|
-
if (hasNoMarkup && hasText) {
|
|
19
|
-
this.value = text;
|
|
20
|
-
this.label = text;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
throw new Error('box-option must have value and label attributes');
|
|
24
|
-
}
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (value && !label) {
|
|
28
|
-
if (hasNoMarkup && hasText) {
|
|
29
|
-
this.label = text;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
this.label = value;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (!value && label) {
|
|
36
|
-
this.value = label;
|
|
37
|
-
}
|
|
38
|
-
if (hasNoMarkup && !hasText) {
|
|
39
|
-
this.textContent = label || value;
|
|
9
|
+
if (!this.value) {
|
|
10
|
+
this.value = this.textContent;
|
|
40
11
|
}
|
|
41
12
|
}
|
|
42
13
|
get value() {
|
|
43
14
|
return this.getAttribute('value');
|
|
44
15
|
}
|
|
45
16
|
set value(value) {
|
|
17
|
+
if (value == null)
|
|
18
|
+
return;
|
|
46
19
|
super.setAttribute('value', String(value));
|
|
47
20
|
}
|
|
48
21
|
get label() {
|
|
49
22
|
return this.getAttribute('label');
|
|
50
23
|
}
|
|
51
24
|
set label(value) {
|
|
25
|
+
if (value == null)
|
|
26
|
+
return;
|
|
52
27
|
super.setAttribute('label', String(value));
|
|
53
28
|
}
|
|
54
29
|
get selected() {
|
|
@@ -25,6 +25,7 @@ export declare class ComboboxMarkup {
|
|
|
25
25
|
getTagByValue(value: string): HTMLComboboxTagElement;
|
|
26
26
|
getOptionByValue(value: string): HTMLComboboxOptionElement;
|
|
27
27
|
get selectedOptions(): NodeListOf<HTMLComboboxOptionElement>;
|
|
28
|
+
static importCSS(urls: string[]): void;
|
|
28
29
|
static get template(): string;
|
|
29
30
|
}
|
|
30
31
|
//# sourceMappingURL=Combobox.markup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.markup.d.ts","sourceRoot":"","sources":["../../../src/combobox/Combobox.markup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,qBAAa,cAAc;;IAGzB,aAAa,EAAE,cAAc,GAAG,IAAI,CAAQ;IAC5C,gBAAgB,EAAE,cAAc,GAAG,IAAI,CAAQ;IAC/C,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAChD,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAQ;IACvC,WAAW,EAAE,cAAc,GAAG,IAAI,CAAQ;IAC1C,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAQ;IAC5C,WAAW,EAAE,sBAAsB,GAAG,IAAI,CAAQ;IAClD,OAAO,EAAE,UAAU,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC;IACtD,SAAS,UAAS;gBAEN,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB;IAU/D,OAAO;IAiBP,sBAAsB;IAMtB,IAAI,CAAC,KAAK,EAAE,MAAM;IAelB,UA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D,aAAa,CAAC,KAAK,EAAE,MAAM;IAI3B,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAI9B,IAAI,eAAe,0CAGlB;IAED,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE;IAQ/B,MAAM,KAAK,QAAQ,WAoMlB;CACF"}
|
|
@@ -49,7 +49,7 @@ export declare class HTMLComboboxElement extends HTMLElement {
|
|
|
49
49
|
showPicker(): void;
|
|
50
50
|
setAttribute(name: string, value: any): void;
|
|
51
51
|
removeAttribute(name: string): void;
|
|
52
|
-
static
|
|
52
|
+
static loadCssFromUrls(urls: string[]): void;
|
|
53
53
|
static loadCssFromDocumentStyleSheets(): void;
|
|
54
54
|
}
|
|
55
55
|
//# sourceMappingURL=HTML.combobox.element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML.combobox.element.d.ts","sourceRoot":"","sources":["../../../src/combobox/HTML.combobox.element.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAI9E,qBAAa,mBAAoB,SAAQ,WAAW;;IAClD,MAAM,CAAC,OAAO,cAA0H;IACxI,MAAM,CAAC,eAAe;;;;MAA0D;IAChF,MAAM,CAAC,UAAU,kBAAuB;IACxC,MAAM,CAAC,cAAc,UAAQ;IAE7B,UAAU,EAAE,UAAU,CAAC;;IAoBvB,iBAAiB;IASjB,oBAAoB;IAOpB,iBAAiB;IAQjB,oBAAoB,CAAC,UAAU,EAAE,OAAO;IAOxC,IAAI,YAAY,aAEf;IAED,IAAI,KAAK,IAGQ,MAAM,CADtB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAQtB;IAED,IAAI,WAAW,WAEd;IACD,IAAI,WAAW,CAAC,KAAK,QAAA,EAQpB;IAED,IAAI,SAAS,YAEZ;IACD,IAAI,SAAS,CAAC,KAAK,SAAA,EAElB;IAED,IAAI,UAAU,YAEb;IACD,IAAI,UAAU,CAAC,KA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["../../../src/combobox/HTML.combobox.option.element.ts"],"names":[],"mappings":"AAEA,qBAAa,yBAA0B,SAAQ,WAAW;;IACxD,MAAM,CAAC,OAAO,cAA2C
|
|
1
|
+
{"version":3,"file":"HTML.combobox.option.element.d.ts","sourceRoot":"","sources":["../../../src/combobox/HTML.combobox.option.element.ts"],"names":[],"mappings":"AAEA,qBAAa,yBAA0B,SAAQ,WAAW;;IACxD,MAAM,CAAC,OAAO,cAA2C;IAEzD,iBAAiB;IAWjB,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAGd;IAED,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAGd;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAEjB;IAQD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAQxC,eAAe,CAAC,IAAI,EAAE,MAAM;CAO7B"}
|