feature: drag support in sort panel.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { createElement, setTooltip, createIcon } from "../../ui";
|
||||
import { r as lang, nullOrEmpty, escapeHtml, escapeEmoji } from "../../utility";
|
||||
import { createBox, appendMedia } from "./lib";
|
||||
import { fileSupported, insertFile, getMessageSendTo, getMessageStatus, updateCustomerName } from "./lib";
|
||||
import { fileSupported, insertFile, getMessageSendTo, getMessageStatus, updateCustomerName, createHideMessageTitleButton, createHideMessageCommentTail } from "./lib";
|
||||
|
||||
let r = lang;
|
||||
|
||||
@@ -32,7 +32,9 @@ export default class InternalComment {
|
||||
}
|
||||
}
|
||||
|
||||
get messageHidden() { return this._var.option.showCommentHidden }
|
||||
/**
|
||||
* @param {boolean} flag
|
||||
*/
|
||||
set messageHidden(flag) {
|
||||
const el = this._var.container.querySelector('.msgadminsetting');
|
||||
if (el == null) {
|
||||
@@ -123,26 +125,7 @@ export default class InternalComment {
|
||||
div.className = 'title-module';
|
||||
div.innerText = r('P_WO_INTERNALCOMMENTS', 'Internal Comments');
|
||||
},
|
||||
createElement('span', span => {
|
||||
if (option.userIsAdmin) {
|
||||
span.className = 'msgadminsetting sbutton iconnotview';
|
||||
span.style.padding = '0px 0px 0px 5px';
|
||||
span.addEventListener('click', function () {
|
||||
if (!option.showMessageHidden) {
|
||||
this.classList.remove('iconnotview');
|
||||
this.classList.add('iconview');
|
||||
option.showMessageHidden = true;
|
||||
container.querySelectorAll('.msgsetting').forEach(x => x.style.display = '');
|
||||
}
|
||||
else {
|
||||
this.classList.remove('iconview');
|
||||
this.classList.add('iconnotview');
|
||||
option.showMessageHidden = false;
|
||||
container.querySelectorAll('.msgsetting').forEach(x => x.style.display = 'none');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
createHideMessageTitleButton(this, 'showMessageHidden')
|
||||
)
|
||||
), []
|
||||
);
|
||||
@@ -278,7 +261,7 @@ export default class InternalComment {
|
||||
return this._var.container = container;
|
||||
}
|
||||
|
||||
load(data, func) {
|
||||
load(data, func, hisFunc, keep) {
|
||||
const children = [];
|
||||
if (data?.length > 0) {
|
||||
this._var.comments = data;
|
||||
@@ -289,8 +272,15 @@ export default class InternalComment {
|
||||
this._var.contactsUpdated = true;
|
||||
}
|
||||
}
|
||||
const lastVisible = this._var.option.showMessageHidden;
|
||||
for (let comment of data) {
|
||||
const div = createElement('div', 'item-div');
|
||||
if (comment.Hidden) {
|
||||
div.classList.add('hidden-content');
|
||||
if (!lastVisible) {
|
||||
div.style.display = 'none';
|
||||
}
|
||||
}
|
||||
const sendto = getMessageSendTo(comment, null, null, r)
|
||||
div.appendChild(createElement('div', div => {
|
||||
div.className = 'item-poster';
|
||||
@@ -333,37 +323,19 @@ export default class InternalComment {
|
||||
}
|
||||
div.append(
|
||||
content,
|
||||
createElement('div', div => {
|
||||
div.className = 'item-time';
|
||||
},
|
||||
createElement('span', span => {
|
||||
span.className = 'msgsetting sbutton ' + (comment.Hidden ? 'iconnotview' : 'iconview');
|
||||
span.style.padding = '0px 0px 0px 5px';
|
||||
span.style.fontSize = '12px';
|
||||
span.style.display = this._var.option.showMessageHidden ? '' : 'none';
|
||||
span.addEventListener('click', function () {
|
||||
if (this.classList.contains('iconview')) {
|
||||
func(comment.Id, true);
|
||||
this.classList.remove('iconview');
|
||||
this.classList.add('iconnotview');
|
||||
} else {
|
||||
func(comment.Id, false);
|
||||
this.classList.remove('iconnotview');
|
||||
this.classList.add('iconview');
|
||||
}
|
||||
});
|
||||
}),
|
||||
createElement('span', span => {
|
||||
span.innerText = comment.TimeStr;
|
||||
})
|
||||
)
|
||||
createHideMessageCommentTail(
|
||||
this, 'showMessageHidden',
|
||||
comment, 'TimeStr',
|
||||
func, hisFunc)
|
||||
);
|
||||
children.push(div);
|
||||
}
|
||||
children[0].style.marginTop = '0';
|
||||
}
|
||||
if (this._var.message.children.length > 0) {
|
||||
this._var.lastTop = this._var.message.scrollTop;
|
||||
}
|
||||
this._var.message.replaceChildren(...children);
|
||||
this._var.message.scrollTop = this._var.message.scrollHeight
|
||||
// setTimeout(() => this._var.message.scrollTop = this._var.message.scrollHeight, 0);
|
||||
setTimeout(() => this._var.message.scrollTop = keep ? this._var.lastTop : this._var.message.scrollHeight, 0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user