add: getText compatibility.

add: `AssetSelector` and `TemplateSelector`.
add: `popup-selector` style class.
add: `ui.resolvePopup` function.
add: `switch` in checkbox.
add: `GridColumn.filterTemplate` supports.
add: add `action` callback in `createIcon`.
change: replace `setTimeout(..., 0)` with `requestAnimationFrame`.
change: Popup result structure adjustment ({ result: any, popup: Popup }).
change: complete add work order flow.
change: reduce Popup title height.
fix: Grid column sort in number.
This commit is contained in:
2024-06-21 17:28:11 +08:00
parent 1a7aa1ab66
commit 5baf00de64
34 changed files with 1772 additions and 365 deletions

View File

@ -62,7 +62,7 @@ export function createRadiobox(opts = {}) {
}
export function createCheckbox(opts = {}) {
const container = createElement('label', 'ui-check-wrapper',
const container = createElement('label', opts.switch ? 'ui-switch' : 'ui-check-wrapper',
createElement('input', input => {
input.setAttribute('type', 'checkbox');
if (opts.checked === true) {
@ -86,7 +86,23 @@ export function createCheckbox(opts = {}) {
if (opts.enabled === false) {
container.classList.add('disabled');
}
if (opts.checkedNode != null && opts.uncheckedNode != null) {
if (opts.switch) {
const label = opts.label;
if (label instanceof Element) {
container.appendChild(label);
} else {
container.appendChild(
createElement('span', span => {
if (label != null && String(label).length > 0) {
span.innerText = label;
}
if (opts.title != null) {
span.title = opts.title;
}
})
);
}
} else if (opts.checkedNode != null && opts.uncheckedNode != null) {
container.classList.add('ui-check-image-wrapper');
let height = opts.imageHeight;
if (isNaN(height) || height <= 0) {