@luftborn/custom-elements 2.13.5 → 2.13.7
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/demo/index.js +22 -15
- package/demo/index.min.js +21 -14
- package/demo/index.min.js.map +1 -1
- package/dist/elements/CheckBoxElement/CheckBoxElement.js +11 -8
- package/dist/elements/CheckBoxElement/CheckBoxElement.js.map +1 -1
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js +10 -6
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/CheckBoxElement/CheckBoxElement.ts +22 -20
- package/src/elements/RadioButtonGroup/RadioButtonGroupElement.ts +22 -19
|
@@ -70,13 +70,16 @@ var CheckBoxElement = /** @class */ (function (_super) {
|
|
|
70
70
|
var _this = this;
|
|
71
71
|
var wrapper = _super.prototype.getChildElement.call(this, '.wrapper');
|
|
72
72
|
var fieldset = wrapper.querySelector('fieldset');
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
if (!fieldset) {
|
|
74
|
+
fieldset = document.createElement('fieldset');
|
|
75
|
+
wrapper.appendChild(fieldset);
|
|
76
|
+
if (this.label) {
|
|
77
|
+
fieldset.insertAdjacentHTML('beforeend', "<legend class=\"sr-only\">" + this.label + "</legend>");
|
|
78
|
+
}
|
|
79
|
+
this.options.forEach(function (element, index) {
|
|
80
|
+
fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.checkboxTemplate, _this.name, element, _this.name + "-" + index));
|
|
81
|
+
});
|
|
76
82
|
}
|
|
77
|
-
this.options.forEach(function (element, index) {
|
|
78
|
-
fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.checkboxTemplate, _this.name, element, _this.name + "-" + index));
|
|
79
|
-
});
|
|
80
83
|
};
|
|
81
84
|
// events
|
|
82
85
|
CheckBoxElement.prototype.change = function ($event) {
|
|
@@ -97,8 +100,8 @@ var CheckBoxElement = /** @class */ (function (_super) {
|
|
|
97
100
|
CheckBoxElement = __decorate([
|
|
98
101
|
(0, custom_element_decorator_1.default)({
|
|
99
102
|
selector: 'checkbox-element',
|
|
100
|
-
template: "\n\t\t\t<div class=\"wrapper\">\n\t\t\t
|
|
101
|
-
style: "\n\t\t\t:host{\n\t\t\t\twidth:100%;\n\t\t\t}\n\t\t\t.checkbox {\n\t\t\t\twidth: auto;\n\t\t\t\tmargin: auto 0.188rem;\n\t\t\t\tcolor: rgba(72, 72, 72, 0.75);\n\t\t\t\tfont-size: 0.813rem;\n\t\t\t\tmargin-top: 0.25rem;\n\t\t\t}\n\t\t\t.checkbox:first-of-type {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t\tinput[type='checkbox']{\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: auto !important;\n\t\t\t\tborder: none;\n\t\t\t\tbackground-color: #f1f4ff;\n\t\t\t\tmargin: 0.
|
|
103
|
+
template: "\n\t\t\t<div class=\"wrapper\">\n\t\t\t</div>",
|
|
104
|
+
style: "\n\t\t\t:host{\n\t\t\t\twidth:100%;\n\t\t\t}\n\t\t\t.checkbox {\n\t\t\t\twidth: auto;\n\t\t\t\tmargin: auto 0.188rem;\n\t\t\t\tcolor: rgba(72, 72, 72, 0.75);\n\t\t\t\tfont-size: 0.813rem;\n\t\t\t\tmargin-top: 0.25rem;\n\t\t\t}\n\t\t\t.checkbox:first-of-type {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t\tinput[type='checkbox']{\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: auto !important;\n\t\t\t\tborder: none;\n\t\t\t\tbackground-color: #f1f4ff;\n\t\t\t\tmargin: 0.125rem;\n\t\t\t\tresize: none;\n\t\t\t}\n\t\t\t.sr-only:not(:focus):not(:active) {\n\t\t\t\tclip: rect(0 0 0 0); \n\t\t\t\tclip-path: inset(50%);\n\t\t\t\theight: 0.063rem;\n\t\t\t\toverflow: hidden;\n\t\t\t\tposition: absolute;\n\t\t\t\twhite-space: nowrap; \n\t\t\t\twidth: 0.063rem;\n\t\t\t}\n\t\t\tfieldset {\n\t\t\t\tborder: none;\n\t\t\t\tpadding: 0;\n\t\t\t}\n\t\t",
|
|
102
105
|
useShadow: true,
|
|
103
106
|
})
|
|
104
107
|
], CheckBoxElement);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBoxElement.js","sourceRoot":"","sources":["../../../src/elements/CheckBoxElement/CheckBoxElement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,qFAAqE;AACrE,yEAAwE;AACxE,6DAAsE;AACtE,mEAAkE;
|
|
1
|
+
{"version":3,"file":"CheckBoxElement.js","sourceRoot":"","sources":["../../../src/elements/CheckBoxElement/CheckBoxElement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,qFAAqE;AACrE,yEAAwE;AACxE,6DAAsE;AACtE,mEAAkE;AA6ClE;IAAqC,mCAAkB;IAQtD;QAAA,YACC,iBAAO,SACP;QARD,sBAAgB,GAAG,4IAIZ,CAAC;;IAIR,CAAC;IAED,sBAAI,kCAAK;aAAT;YACC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,EAAP,CAAO,CAAC,CAAC;QAC/D,CAAC;aAED,UAAU,MAAgB;YACzB,+BAA+B;QAChC,CAAC;;;OAJA;IAMD,sBAAI,kCAAK;aAAT;YACC,IAAI,IAAI,CAAC,QAAQ,EAAE;gBAClB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;aAC7B;iBAAM;gBACN,OAAO,IAAI,CAAC;aACZ;QACF,CAAC;;;OAAA;IAED,2CAAiB,GAAjB;QACC,iBAAM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AI,CAAC,IAAI,qCAAsB,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IACtE,CAAC;IAEM,kCAAQ,GAAf;QACC,IAAI,CAAC,KAAK,CAAC;QACX,IAAI,CAAC,UAAU,CAAC,IAAI,CACnB,IAAI,qCAAsB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAClD,CAAC;IACH,CAAC;IAED,8CAAoB,GAApB;QAAA,iBAMC;QALA,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,CAAC;YACtB,OAAA,CAAC,CAAC,mBAAmB,CAAC,QAAQ,EAAE,KAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;QAAvD,CAAuD,CACvD,CAAC;QAEF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACtB,CAAC;IApFW,eAAe;QA3C3B,IAAA,kCAAa,EAAC;YACd,QAAQ,EAAE,kBAAkB;YAC5B,QAAQ,EAAE,+CAED;YACT,KAAK,EAAE,y0BAmCL;YACF,SAAS,EAAE,IAAI;SACf,CAAC;OACW,eAAe,CAqF3B;IAAD,sBAAC;CAAA,AArFD,CAAqC,uCAAkB,GAqFtD;AArFY,0CAAe"}
|
|
@@ -76,12 +76,16 @@ var RadioButtonGroupElement = /** @class */ (function (_super) {
|
|
|
76
76
|
var _this = this;
|
|
77
77
|
var wrapper = _super.prototype.getChildElement.call(this, '.wrapper');
|
|
78
78
|
var fieldset = wrapper.querySelector('fieldset');
|
|
79
|
-
if (
|
|
80
|
-
fieldset.
|
|
79
|
+
if (!fieldset) {
|
|
80
|
+
fieldset = document.createElement('fieldset');
|
|
81
|
+
wrapper.appendChild(fieldset);
|
|
82
|
+
if (this.label) {
|
|
83
|
+
fieldset.insertAdjacentHTML('beforeend', "<legend class=\"sr-only\">" + this.label + "</legend>");
|
|
84
|
+
}
|
|
85
|
+
this.options.forEach(function (element, index) {
|
|
86
|
+
fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.radioButtonTemplate, _this.name, element, _this.name + "-" + index, "" + (_this.required ? 'required' : '')));
|
|
87
|
+
});
|
|
81
88
|
}
|
|
82
|
-
this.options.forEach(function (element, index) {
|
|
83
|
-
fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.radioButtonTemplate, _this.name, element, _this.name + "-" + index, "" + (_this.required ? 'required' : '')));
|
|
84
|
-
});
|
|
85
89
|
};
|
|
86
90
|
// events
|
|
87
91
|
RadioButtonGroupElement.prototype.change = function ($event) {
|
|
@@ -95,7 +99,7 @@ var RadioButtonGroupElement = /** @class */ (function (_super) {
|
|
|
95
99
|
RadioButtonGroupElement = __decorate([
|
|
96
100
|
(0, custom_element_decorator_1.default)({
|
|
97
101
|
selector: 'radio-group-element',
|
|
98
|
-
template: "\n\t\t\t<div class=\"wrapper\">\n\t\t\t
|
|
102
|
+
template: "\n\t\t\t<div class=\"wrapper\">\n\t\t\t</div>",
|
|
99
103
|
style: "\n\t\t\t:host{\n\t\t\t\twidth:100%;\n\t\t\t}\n\t\t\t.radio-button {\n\t\t\t\twidth: auto;\n\t\t\t\tmargin: auto 0.188rem;\n\t\t\t\tcolor: rgba(72, 72, 72, 0.75);\n\t\t\t\tfont-size: 0.813rem;\n\t\t\t\tmargin-top: 0.25rem;\n\t\t\t}\n\t\t\t.radio-button:first-of-type {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t\tinput{\n\t\t\t\tbox-sizing: border-box;\n\t\t\t\twidth: auto !important;\n\t\t\t\tborder: none;\n\t\t\t\tbackground-color: #f1f4ff;\n\t\t\t\tmargin: 0.2rem;\n\t\t\t\tresize: none;\n\t\t\t}\n\t\t\t.sr-only:not(:focus):not(:active) {\n\t\t\t\tclip: rect(0 0 0 0);\n\t\t\t\tclip-path: inset(50%);\n\t\t\t\theight: 0.063rem;\n\t\t\t\toverflow: hidden;\n\t\t\t\tposition: absolute;\n\t\t\t\twhite-space: nowrap; \n\t\t\t\twidth: 0.063rem;\n\t\t\t}\n\t\t\tfieldset {\n\t\t\t\tborder: none;\n\t\t\t\tpadding: 0;\n\t\t\t}\n\t\t",
|
|
100
104
|
useShadow: true,
|
|
101
105
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButtonGroupElement.js","sourceRoot":"","sources":["../../../src/elements/RadioButtonGroup/RadioButtonGroupElement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,qFAAqE;AACrE,yEAAwE;AACxE,6DAAsE;AACtE,mEAAkE;
|
|
1
|
+
{"version":3,"file":"RadioButtonGroupElement.js","sourceRoot":"","sources":["../../../src/elements/RadioButtonGroup/RadioButtonGroupElement.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,qFAAqE;AACrE,yEAAwE;AACxE,6DAAsE;AACtE,mEAAkE;AA6ClE;IAA6C,2CAAkB;IAQ9D;QAAA,YACC,iBAAO,SACP;QARD,yBAAmB,GAAG,iJAIf,CAAC;;IAIR,CAAC;IAED,sBAAI,0CAAK;aAAT;YACC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,EAAT,CAAS,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,EAAP,CAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,CAAC;aAED,UAAU,KAAa;YACtB,IAAI,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,KAAK,KAAK,KAAK,EAAjB,CAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;YACtE,IAAI,YAAY,EAAE;gBACjB,YAAY,CAAC,YAAY,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;aACzC;QACF,CAAC;;;OAPA;IASD,sBAAI,0CAAK;aAAT;YACC,IAA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AC,OAAO,EAAE,KAAK;gBACnC,QAAQ,CAAC,kBAAkB,CAC1B,WAAW,EACX,uBAAU,CAAC,YAAY,CACtB,KAAI,CAAC,mBAAmB,EACxB,KAAI,CAAC,IAAI,EACT,OAAO,EACJ,KAAI,CAAC,IAAI,SAAI,KAAO,EACvB,MAAG,KAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAE,CACpC,CACD,CAAC;YACH,CAAC,CAAC,CAAC;SACH;IACF,CAAC;IACD,SAAS;IACF,wCAAM,GAAb,UAAc,MAAM;QACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,qCAAsB,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IACtE,CAAC;IAEM,0CAAQ,GAAf;QACC,IAAI,CAAC,KAAK,CAAC;QACX,IAAI,CAAC,UAAU,CAAC,IAAI,CACnB,IAAI,qCAAsB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAClD,CAAC;IACH,CAAC;IAnFW,uBAAuB;QA3CnC,IAAA,kCAAa,EAAC;YACd,QAAQ,EAAE,qBAAqB;YAC/B,QAAQ,EAAE,+CAED;YACT,KAAK,EAAE,6zBAmCL;YACF,SAAS,EAAE,IAAI;SACf,CAAC;OACW,uBAAuB,CAoFnC;IAAD,8BAAC;CAAA,AApFD,CAA6C,uCAAkB,GAoF9D;AApFY,0DAAuB"}
|
package/package.json
CHANGED
|
@@ -7,7 +7,6 @@ import { StringUtil } from '../../framework/Utilities/StringUtil';
|
|
|
7
7
|
selector: 'checkbox-element',
|
|
8
8
|
template: `
|
|
9
9
|
<div class="wrapper">
|
|
10
|
-
<fieldset></fieldset>
|
|
11
10
|
</div>`,
|
|
12
11
|
style: `
|
|
13
12
|
:host{
|
|
@@ -28,7 +27,7 @@ import { StringUtil } from '../../framework/Utilities/StringUtil';
|
|
|
28
27
|
width: auto !important;
|
|
29
28
|
border: none;
|
|
30
29
|
background-color: #f1f4ff;
|
|
31
|
-
margin: 0.
|
|
30
|
+
margin: 0.125rem;
|
|
32
31
|
resize: none;
|
|
33
32
|
}
|
|
34
33
|
.sr-only:not(:focus):not(:active) {
|
|
@@ -89,25 +88,28 @@ export class CheckBoxElement extends CustomInputElement {
|
|
|
89
88
|
|
|
90
89
|
private addCheckBoxes() {
|
|
91
90
|
const wrapper = super.getChildElement('.wrapper');
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
let fieldset = wrapper.querySelector('fieldset');
|
|
92
|
+
if (!fieldset) {
|
|
93
|
+
fieldset = document.createElement('fieldset');
|
|
94
|
+
wrapper.appendChild(fieldset);
|
|
95
|
+
if (this.label) {
|
|
96
|
+
fieldset.insertAdjacentHTML(
|
|
97
|
+
'beforeend',
|
|
98
|
+
`<legend class="sr-only">${this.label}</legend>`,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
this.options.forEach((element, index) => {
|
|
102
|
+
fieldset.insertAdjacentHTML(
|
|
103
|
+
'beforeend',
|
|
104
|
+
StringUtil.StringFormat(
|
|
105
|
+
this.checkboxTemplate,
|
|
106
|
+
this.name,
|
|
107
|
+
element,
|
|
108
|
+
`${this.name}-${index}`,
|
|
109
|
+
),
|
|
110
|
+
);
|
|
111
|
+
});
|
|
99
112
|
}
|
|
100
|
-
this.options.forEach((element, index) => {
|
|
101
|
-
fieldset.insertAdjacentHTML(
|
|
102
|
-
'beforeend',
|
|
103
|
-
StringUtil.StringFormat(
|
|
104
|
-
this.checkboxTemplate,
|
|
105
|
-
this.name,
|
|
106
|
-
element,
|
|
107
|
-
`${this.name}-${index}`,
|
|
108
|
-
),
|
|
109
|
-
);
|
|
110
|
-
});
|
|
111
113
|
}
|
|
112
114
|
// events
|
|
113
115
|
public change($event): void {
|
|
@@ -7,7 +7,6 @@ import { StringUtil } from '../../framework/Utilities/StringUtil';
|
|
|
7
7
|
selector: 'radio-group-element',
|
|
8
8
|
template: `
|
|
9
9
|
<div class="wrapper">
|
|
10
|
-
<fieldset></fieldset>
|
|
11
10
|
</div>`,
|
|
12
11
|
style: `
|
|
13
12
|
:host{
|
|
@@ -95,25 +94,29 @@ export class RadioButtonGroupElement extends CustomInputElement {
|
|
|
95
94
|
|
|
96
95
|
private addRadioButtons() {
|
|
97
96
|
const wrapper = super.getChildElement('.wrapper');
|
|
98
|
-
|
|
99
|
-
if (
|
|
100
|
-
fieldset.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
let fieldset = wrapper.querySelector('fieldset');
|
|
98
|
+
if (!fieldset) {
|
|
99
|
+
fieldset = document.createElement('fieldset');
|
|
100
|
+
wrapper.appendChild(fieldset);
|
|
101
|
+
if (this.label) {
|
|
102
|
+
fieldset.insertAdjacentHTML(
|
|
103
|
+
'beforeend',
|
|
104
|
+
`<legend class="sr-only">${this.label}</legend>`,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
this.options.forEach((element, index) => {
|
|
108
|
+
fieldset.insertAdjacentHTML(
|
|
109
|
+
'beforeend',
|
|
110
|
+
StringUtil.StringFormat(
|
|
111
|
+
this.radioButtonTemplate,
|
|
112
|
+
this.name,
|
|
113
|
+
element,
|
|
114
|
+
`${this.name}-${index}`,
|
|
115
|
+
`${this.required ? 'required' : ''}`,
|
|
116
|
+
),
|
|
117
|
+
);
|
|
118
|
+
});
|
|
104
119
|
}
|
|
105
|
-
this.options.forEach((element, index) => {
|
|
106
|
-
fieldset.insertAdjacentHTML(
|
|
107
|
-
'beforeend',
|
|
108
|
-
StringUtil.StringFormat(
|
|
109
|
-
this.radioButtonTemplate,
|
|
110
|
-
this.name,
|
|
111
|
-
element,
|
|
112
|
-
`${this.name}-${index}`,
|
|
113
|
-
`${this.required ? 'required' : ''}`,
|
|
114
|
-
),
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
120
|
}
|
|
118
121
|
// events
|
|
119
122
|
public change($event): void {
|