add document, fix tooltip position issue

This commit is contained in:
2023-03-30 17:26:59 +08:00
parent f5bc42fa20
commit 5406eea20e
15 changed files with 432 additions and 117 deletions

View File

@ -18,6 +18,9 @@ function createCheckbox(opts) {
container.className = 'checkbox-wrapper';
const input = document.createElement('input');
input.setAttribute('type', 'checkbox');
if (opts.checked === true) {
input.checked = true;
}
if (typeof opts.onchange === 'function') {
input.addEventListener('change', opts.onchange);
}
@ -64,6 +67,13 @@ function resolveCheckbox(container) {
box.removeAttribute('data-label');
}
const input = document.createElement('input');
const id = box.getAttribute('data-id');
if (id != null && id.length > 0) {
input.id = id;
}
if (box.getAttribute('data-checked') != null) {
input.checked = true;
}
input.setAttribute('type', 'checkbox');
box.insertBefore(input, box.firstChild);
}