sync
This commit is contained in:
@@ -3,6 +3,10 @@ import { createElement } from "../functions";
|
||||
import { createIcon } from "./icon";
|
||||
|
||||
function fillCheckbox(container, type = 'fa-regular', label, tabindex = -1, charactor = 'check', title) {
|
||||
const checkIcon = createIcon(type, charactor);
|
||||
checkIcon.classList.add('ui-check-icon');
|
||||
const indeterminateIcon = createIcon(type, 'grip-lines');
|
||||
indeterminateIcon.classList.add('ui-indeterminate-icon')
|
||||
container.appendChild(
|
||||
createElement('layer', layer => {
|
||||
layer.className = 'ui-check-inner';
|
||||
@@ -18,7 +22,7 @@ function fillCheckbox(container, type = 'fa-regular', label, tabindex = -1, char
|
||||
if (tabindex >= 0) {
|
||||
layer.tabIndex = tabindex;
|
||||
}
|
||||
}, createIcon(type, charactor))
|
||||
}, checkIcon, indeterminateIcon)
|
||||
);
|
||||
if (label instanceof Element) {
|
||||
container.appendChild(label);
|
||||
@@ -68,6 +72,9 @@ export function createCheckbox(opts = {}) {
|
||||
if (opts.checked === true) {
|
||||
input.checked = true;
|
||||
}
|
||||
if (opts.indeterminate === true) {
|
||||
input.indeterminate = true;
|
||||
}
|
||||
if (opts.enabled === false) {
|
||||
input.disabled = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user