optimize style sheets, support tabIndex in popup

This commit is contained in:
2023-04-21 10:59:56 +08:00
parent cbdb2c7868
commit c4316e7e52
16 changed files with 235 additions and 199 deletions

View File

@ -10,14 +10,17 @@ class Contact {
}
async show(parent = document.body) {
const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;
const c = this.#option.contact;
const contactName = createElement('input', input => {
input.type = 'text';
input.tabIndex = 1;
input.className = 'ui-input';
input.tabIndex = tabIndex + 1;
input.maxLength = 200;
input.autocomplete = 'off';
});
const preferences = new Dropdown({ tabindex: 2 });
const preferences = new Dropdown({ tabindex: tabIndex + 2 });
preferences.source = [
{ value: '0', text: r('text', 'Text') },
{ value: '1', text: r('email', 'Email') },
@ -25,23 +28,22 @@ class Contact {
];
const contactEmail = createElement('input', input => {
input.type = 'email';
input.tabIndex = 3;
input.className = 'ui-input';
input.tabIndex = tabIndex + 3;
input.maxLength = 100;
input.autocomplete = 'off';
});
const contactMobile = createElement('input', input => {
input.type = 'tel';
input.tabIndex = 4;
input.className = 'ui-input';
input.tabIndex = tabIndex + 4;
input.maxLength = 50;
input.autocomplete = 'off';
});
const checkOpt = createCheckbox({
customerAttributes: {
tabindex: 5
}
});
const checkOpt = createCheckbox({ tabindex: tabIndex + 5 });
const contactNotes = createElement('textarea', txt => {
txt.tabIndex = 6;
txt.className = 'ui-text';
txt.tabIndex = tabIndex + 6;
txt.maxLength = 2000;
txt.style.height = '100px';
});
@ -49,6 +51,7 @@ class Contact {
if (this.#option.company) {
buttons.push({
text: c == null ? r('addContactRecord', 'Add Contact Record') : r('editContactRecord', 'Edit Contact Record'),
// tabindex: tabIndex + 7,
trigger: () => {
const item = this.prepare();
if (item == null) {
@ -64,6 +67,7 @@ class Contact {
buttons.push(
{
text: r('workOrderOnly', 'Work Order Only'),
// tabindex: tabIndex + 8,
trigger: () => {
const item = this.prepare();
if (item == null) {
@ -76,7 +80,10 @@ class Contact {
}
}
},
{ text: r('cancel', 'Cancel') }
{
text: r('cancel', 'Cancel'),
// tabindex: tabIndex + 9
}
);
const popup = createPopup(
c == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact'),