[scss] migrate @import to @use.

[grid] isExpandable.
[popup] showInput, options.
This commit is contained in:
lchen committed 2026-11-16 20:11:07 +08:00
1 parent 409333993b
commit 6de354ad47
27 files changed
+113 -5083

No files matched your search

+29 -10
View File
@@ -610,13 +610,10 @@ export function showAlert(title, message, iconType = 'info', parent = document.b
});
}
export function showInput(title, multiline, message, def, placeholder, buttons, parent = document.body) {
export function showInput(title, multiline, message, options, buttons, parent = document.body) {
const r = typeof GetTextByKey === 'function' ? GetTextByKey : lang;
options ??= {};
return new Promise(resolve => {
let tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));
if (tabIndex < 0) {
tabIndex = 0;
}
const input = multiline ?
createElement('textarea', text => {
text.className = 'ui-text';
@@ -625,12 +622,34 @@ export function showInput(title, multiline, message, def, placeholder, buttons,
input.type = 'text';
input.className = 'ui-input';
});
input.tabIndex = tabIndex + 4;
if (!nullOrEmpty(placeholder)) {
input.placeholder = placeholder;
for (let key of Object.keys(options)) {
switch (key) {
case 'tabIndex':
if (!isNaN(options.tabIndex)) {
input.tabIndex = options.tabIndex;
}
break;
case 'default':
if (!nullOrEmpty(options.default)) {
input.value = options.default;
}
break;
case 'placeholder':
if (!nullOrEmpty(options.placeholder)) {
input.placeholder = options.placeholder;
}
break;
default:
input[key] = options[key];
break;
}
}
if (!nullOrEmpty(def)) {
input.value = def;
if (isNaN(options.tabIndex)) {
let tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));
if (tabIndex < 0) {
tabIndex = 0;
}
input.tabIndex = tabIndex + 4;
}
const popup = new Popup({
title,