isPromiseLike and resolve partial of Grid.

This commit is contained in:
lchen committed 2026-11-25 17:00:03 +08:00
1 parent ec086e29aa
commit a78ef2df39
7 files changed
+1359 -619

No files matched your search

+6 -5
View File
@@ -1,5 +1,5 @@
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 { r as lang, nullOrEmpty, formatUrl, escapeEmoji, isEmail, isPhone, isPromiseLike } from "../../utility";
import { createBox, appendMedia, fileSupported, insertFile, getMessageSendTo, getMessageStatus, updateCustomerName, createHideMessageTitleButton, createHideMessageCommentTail } from "./lib";
import { Contact, CustomerRecordContact } from "./contact";
import Follower from "./follower";
@@ -764,7 +764,7 @@ export default class CustomerCommunication {
if (typeof option.onOpenSelectCRContacts === 'function') {
const result = option.onOpenSelectCRContacts();
if (typeof result?.then === 'function') {
if (isPromiseLike(result)) {
return result.then(r => {
r.map(c => {
for (let cc of this._var.data.contacts) {
@@ -822,7 +822,7 @@ export default class CustomerCommunication {
}
if (typeof option.onSave === 'function') {
const result = option.onSave(item, true);
if (typeof result?.then === 'function') {
if (isPromiseLike(result)) {
return result.then(r => {
this._var.gridContact.source = r.filter(c => c.Id >= 0).map(c => {
if (c.OptOut || c.OptOut_BC) {
@@ -944,7 +944,7 @@ export default class CustomerCommunication {
}
if (typeof option.onSave === 'function') {
const result = option.onSave(item);
if (typeof result?.then === 'function') {
if (isPromiseLike(result)) {
return result.then(r => {
This._var.gridContact.source = r.filter(c => c.Id >= 0).map(c => {
if (c.OptOut || c.OptOut_BC) {
@@ -1205,9 +1205,10 @@ export default class CustomerCommunication {
onOk: list => {
if (typeof option.onAddFollower === 'function') {
const result = option.onAddFollower(list);
if (typeof result?.then === 'function') {
if (isPromiseLike(result)) {
return result.then(r => {
// this.followers = r;
// TODO: ?? maybe a bug? doing nothing...
return r;
});
}