fix dropdown issue, add autoprefix for scss

This commit is contained in:
2023-03-31 22:19:51 +08:00
parent 41b1bbd7d6
commit 9677f6a82d
18 changed files with 2738 additions and 133 deletions

View File

@ -7,7 +7,7 @@ function fillCheckbox(container, type, label) {
container.appendChild(layer);
if (label instanceof HTMLElement) {
container.appendChild(label);
} else if (label != null && label.length > 0) {
} else if (label?.length > 0) {
const span = document.createElement('span');
span.innerText = label;
container.appendChild(span);
@ -75,7 +75,7 @@ function resolveCheckbox(container, legacy) {
if (e != null) {
if (e.tagName === 'LABEL') {
label = e;
} else if (e.tagName === 'SPAN' && e.getAttribute('data-lgid') != null) {
} else if (e.tagName === 'SPAN' && e.dataset.lgid != null) {
text = e.innerText;
e.style.display = 'none';
}
@ -86,7 +86,7 @@ function resolveCheckbox(container, legacy) {
if (e != null) {
if (e.tagName === 'LABEL') {
label = e;
} else if (text == null && e.tagName === 'SPAN' && e.getAttribute('data-lgid') != null) {
} else if (text == null && e.tagName === 'SPAN' && e.dataset.lgid != null) {
text = e.innerText;
e.style.display = 'none';
}
@ -114,18 +114,18 @@ function resolveCheckbox(container, legacy) {
box.classList.add('checkbox-image');
}
} else {
const type = box.getAttribute('data-type') || 'fa-regular';
const label = box.getAttribute('data-label');
const type = box.dataset.type || 'fa-regular';
const label = box.dataset.label;
fillCheckbox(box, type, label)
box.removeAttribute('data-type');
box.removeAttribute('data-label');
}
const input = document.createElement('input');
const id = box.getAttribute('data-id');
if (id != null && id.length > 0) {
const id = box.dataset.id;
if (id?.length > 0) {
input.id = id;
}
if (box.getAttribute('data-checked') != null) {
if (box.dataset.checked != null) {
input.checked = true;
}
input.setAttribute('type', 'checkbox');