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

@ -1,4 +1,4 @@
import { createElement, setTooltip, createIcon } from "../../ui";
import { createElement, setTooltip, createIcon, requestAnimationFrame } from "../../ui";
import { r as lang, nullOrEmpty, escapeHtml, escapeEmoji } from "../../utility";
import { createBox, appendMedia, createHideMessageTitleButton, createHideMessageCommentTail } from "./lib";
@ -12,6 +12,8 @@ export default class CustomerRecordComment {
const getText = opt?.getText;
if (typeof getText === 'function') {
r = getText;
} else if (typeof GetTextByKey === 'function') {
r = GetTextByKey;
}
}
@ -179,6 +181,6 @@ export default class CustomerRecordComment {
this._var.lastTop = this._var.message.scrollTop;
}
this._var.message.replaceChildren(...children);
setTimeout(() => this._var.message.scrollTop = keep ? this._var.lastTop : this._var.message.scrollHeight, 0);
requestAnimationFrame(() => this._var.message.scrollTop = keep ? this._var.lastTop : this._var.message.scrollHeight);
}
}

View File

@ -1,4 +1,4 @@
import { Grid, Dropdown, createElement, createCheckbox, Popup, showAlert } from "../../ui";
import { Grid, Dropdown, createElement, createCheckbox, Popup, showAlert, requestAnimationFrame } from "../../ui";
import { isEmail, nullOrEmpty, r as lang } from "../../utility";
let r = lang;
@ -11,6 +11,8 @@ export class Contact {
const getText = option?.getText;
if (typeof getText === 'function') {
r = getText;
} else if (typeof GetTextByKey === 'function') {
r = GetTextByKey;
}
}
@ -143,7 +145,7 @@ export class Contact {
contactNotes
};
const result = await popup.show(parent);
setTimeout(() => contactName.focus());
requestAnimationFrame(() => contactName.focus());
return result;
}
@ -204,6 +206,8 @@ export class CustomerRecordContact {
const getText = option?.getText;
if (typeof getText === 'function') {
r = getText;
} else if (typeof GetTextByKey === 'function') {
r = GetTextByKey;
}
}

View File

@ -1,4 +1,4 @@
import { Grid, GridColumn, createElement, setTooltip, createIcon, createCheckbox, createRadiobox, showAlert, showConfirm, Popup } from "../../ui";
import { Grid, GridColumn, createElement, setTooltip, createIcon, createCheckbox, createRadiobox, showAlert, showConfirm, Popup, requestAnimationFrame } from "../../ui";
import { r as lang, nullOrEmpty, formatUrl, escapeEmoji, isEmail, isPhone } from "../../utility";
import { createBox, appendMedia, fileSupported, insertFile, getMessageSendTo, getMessageStatus, updateCustomerName, createHideMessageTitleButton, createHideMessageCommentTail } from "./lib";
import { Contact, CustomerRecordContact } from "./contact";
@ -41,6 +41,8 @@ export default class CustomerCommunication {
const getText = opt?.getText;
if (typeof getText === 'function') {
r = getText;
} else if (typeof GetTextByKey === 'function') {
r = GetTextByKey;
}
}
@ -1015,11 +1017,11 @@ export default class CustomerCommunication {
{ key: 'ok', text: r('P_WO_OK', 'OK') },
{ key: 'cancel', text: r('P_WO_CANCEL', 'Cancel') }
]
).then(result => {
if (result?.key === 'ok') {
const isRecord = result.popup.container.querySelector('.radio-customer-record>input').checked;
).then(r => {
if (r.result === 'ok') {
const isRecord = r.popup.container.querySelector('.radio-customer-record>input').checked;
if (typeof option.onDelete === 'function') {
option.onDelete(result.key, this, isRecord);
option.onDelete(r.result, this, isRecord);
}
const index = grid.source.indexOf(this);
if (index >= 0) {
@ -1075,10 +1077,10 @@ export default class CustomerCommunication {
showConfirm(r('P_CU_REMOVECONTACT', 'Remove Contact'), r('P_CU_REMOVEFROMWORKORDER', 'You are removing {name} from work order.\n\nDo you want to Continue?').replace('{name}', this.Name), [
{ key: 'continue', text: r('P_JS_CONTINUE', 'Continue') },
{ key: 'cancel', text: r('P_WO_CANCEL', 'Cancel') }
]).then(result => {
if (result?.key === 'continue') {
]).then(r => {
if (r.result === 'continue') {
if (typeof option.onDelete === 'function') {
option.onDelete(result.key, this);
option.onDelete(r.result, this);
}
const index = gridWo.source.indexOf(this);
if (index >= 0) {
@ -1122,14 +1124,11 @@ export default class CustomerCommunication {
{ key: 'skip', text: r('P_CUSTOMER_SKIPTHISSTEP', 'Skip This Step') }
]
).then(r => {
if (r == null) {
return;
}
if (r.key === 'add') {
if (r.result === 'add') {
if (typeof option.onAddCompany === 'function') {
option.onAddCompany.call(this);
}
} else {
} else if (r.key === 'skip') {
editContacts();
}
});
@ -1328,6 +1327,6 @@ export default class CustomerCommunication {
this._var.lastTop = this._var.message.scrollTop;
}
this._var.message.replaceChildren(...children);
setTimeout(() => this._var.message.scrollTop = keep ? this._var.lastTop : this._var.message.scrollHeight, 0);
requestAnimationFrame(() => this._var.message.scrollTop = keep ? this._var.lastTop : this._var.message.scrollHeight);
}
}

View File

@ -11,6 +11,8 @@ export default class Follower {
const getText = option?.getText;
if (typeof getText === 'function') {
r = getText;
} else if (typeof GetTextByKey === 'function') {
r = GetTextByKey;
}
}

View File

@ -1,4 +1,4 @@
import { createElement, setTooltip, createIcon } from "../../ui";
import { createElement, setTooltip, createIcon, requestAnimationFrame } from "../../ui";
import { r as lang, nullOrEmpty, escapeHtml, escapeEmoji } from "../../utility";
import { createBox, appendMedia } from "./lib";
import { fileSupported, insertFile, getMessageSendTo, getMessageStatus, updateCustomerName, createHideMessageTitleButton, createHideMessageCommentTail } from "./lib";
@ -19,6 +19,8 @@ export default class InternalComment {
const getText = opt?.getText;
if (typeof getText === 'function') {
r = getText;
} else if (typeof GetTextByKey === 'function') {
r = GetTextByKey;
}
}
@ -336,6 +338,6 @@ export default class InternalComment {
this._var.lastTop = this._var.message.scrollTop;
}
this._var.message.replaceChildren(...children);
setTimeout(() => this._var.message.scrollTop = keep ? this._var.lastTop : this._var.message.scrollHeight, 0);
requestAnimationFrame(() => this._var.message.scrollTop = keep ? this._var.lastTop : this._var.message.scrollHeight);
}
}

View File

@ -122,7 +122,7 @@
>.title-functions {
flex: 0 0 auto;
display: flex;
padding: 4px;
padding: 0 4px;
>label {
margin: 0 4px;