增加右键菜单配置
增加setEditorValue、getEditorValue方法 修改updateContact传参 修复只选择表情发送按钮是灰色的问题 修复send之后toContactId丢失的问题
This commit is contained in:
1 parent
f56dc40075
commit
3603d0c03b
23 files changed
+825
-184
No files matched your search
Vendored
+195
-57
@@ -3187,6 +3187,13 @@ module.exports = {
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "8bbf":
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = require("vue");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "8e60":
|
||||
@@ -5566,7 +5573,7 @@ var tabs_render, staticRenderFns
|
||||
|
||||
/* normalize component */
|
||||
|
||||
var component = normalizeComponent(
|
||||
var tabs_component = normalizeComponent(
|
||||
components_tabsvue_type_script_lang_js_,
|
||||
tabs_render,
|
||||
staticRenderFns,
|
||||
@@ -5577,7 +5584,7 @@ var component = normalizeComponent(
|
||||
|
||||
)
|
||||
|
||||
/* harmony default export */ var tabs = (component.exports);
|
||||
/* harmony default export */ var tabs = (tabs_component.exports);
|
||||
// EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
|
||||
var runtime = __webpack_require__("96cf");
|
||||
|
||||
@@ -5712,7 +5719,7 @@ var triggerEvents = {
|
||||
"style": "position:relative"
|
||||
}, [h("transition", {
|
||||
"attrs": {
|
||||
"name": "slide-top"
|
||||
"name": "lemon-slide-top"
|
||||
}
|
||||
}, [this.visible && h("div", {
|
||||
"class": "lemon-popover",
|
||||
@@ -6184,6 +6191,10 @@ function arrayIntersect(a, b) {
|
||||
|
||||
function clearHtml(str) {
|
||||
return str.replace(/<.*?>/ig, "");
|
||||
} //清除字符串内的所有HTML标签,除了IMG
|
||||
|
||||
function clearHtmlExcludeImg(str) {
|
||||
return str.replace(/<(?!img).*?>/ig, "");
|
||||
}
|
||||
function error(text) {
|
||||
throw new Error(text);
|
||||
@@ -6249,6 +6260,14 @@ function generateUUID() {
|
||||
/* harmony default export */ var contactvue_type_script_lang_js_ = ({
|
||||
name: "LemonContact",
|
||||
components: {},
|
||||
inject: {
|
||||
IMUI: {
|
||||
from: 'IMUI',
|
||||
default: function _default() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
return {};
|
||||
},
|
||||
@@ -6283,24 +6302,16 @@ function generateUUID() {
|
||||
watch: {},
|
||||
methods: {
|
||||
_renderInner: function _renderInner() {
|
||||
var _this2 = this;
|
||||
|
||||
var h = this.$createElement;
|
||||
var contact = this.contact;
|
||||
return [h("lemon-badge", {
|
||||
"attrs": {
|
||||
"count": !this.simple ? contact.unread : 0,
|
||||
"native-on-click": function nativeOnClick(e) {
|
||||
return _this2._handleBubbleClick(e, contact);
|
||||
}
|
||||
"count": !this.simple ? contact.unread : 0
|
||||
},
|
||||
"class": "lemon-contact__avatar"
|
||||
}, [h("lemon-avatar", {
|
||||
"attrs": {
|
||||
"size": 40,
|
||||
"native-on-click": function nativeOnClick(e) {
|
||||
return _this2._handleAvatarClick(e, contact);
|
||||
},
|
||||
"src": contact.avatar
|
||||
}
|
||||
})]), h("div", {
|
||||
@@ -6321,14 +6332,6 @@ function generateUUID() {
|
||||
},
|
||||
_handleClick: function _handleClick(e, data) {
|
||||
this.$emit("click", data);
|
||||
},
|
||||
_handleAvatarClick: function _handleAvatarClick(e, data) {
|
||||
e.stopPropagation();
|
||||
this.$emit("avatar-click", data);
|
||||
},
|
||||
_handleBubbleClick: function _handleBubbleClick(e, data) {
|
||||
e.stopPropagation();
|
||||
this.$emit("bubble-click", data);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -6662,6 +6665,8 @@ var isInitTool = false;
|
||||
|
||||
exec("<img emoji-name=\"".concat(item.name, "\" src=\"").concat(item.src, "\"></img>"));
|
||||
|
||||
this._checkSubmitDisabled();
|
||||
|
||||
this._saveLastRange();
|
||||
},
|
||||
selectFile: function () {
|
||||
@@ -6724,7 +6729,7 @@ var isInitTool = false;
|
||||
return toEmojiName(this.$refs.textarea.innerHTML);
|
||||
},
|
||||
_checkSubmitDisabled: function _checkSubmitDisabled() {
|
||||
this.submitDisabled = !this.$refs.textarea.innerText.trim();
|
||||
this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
|
||||
},
|
||||
_handleSend: function _handleSend(e) {
|
||||
var text = this.getFormatValue();
|
||||
@@ -6748,6 +6753,11 @@ var isInitTool = false;
|
||||
initEmoji: function initEmoji(data) {
|
||||
emojiData = data;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
setValue: function setValue(val) {
|
||||
this.$refs.textarea.innerHTML = val;
|
||||
|
||||
this._checkSubmitDisabled();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -6777,6 +6787,86 @@ var editor_component = normalizeComponent(
|
||||
)
|
||||
|
||||
/* harmony default export */ var editor = (editor_component.exports);
|
||||
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
||||
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
|
||||
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
|
||||
|
||||
// CONCATENATED MODULE: ./packages/directives/dropdown.js
|
||||
|
||||
|
||||
|
||||
var dropdown_popover;
|
||||
|
||||
var hidePopover = function hidePopover() {
|
||||
if (dropdown_popover) dropdown_popover.style.display = 'none';
|
||||
};
|
||||
|
||||
var showPopover = function showPopover() {
|
||||
if (dropdown_popover) dropdown_popover.style.display = 'block';
|
||||
};
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
hidePopover();
|
||||
});
|
||||
/* harmony default export */ var dropdown = ({
|
||||
hide: hidePopover,
|
||||
bind: function bind(el, binding, vnode) {
|
||||
el.addEventListener('contextmenu', function (e) {
|
||||
if (isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
||||
e.preventDefault();
|
||||
var component;
|
||||
var visibleItems = [];
|
||||
if (binding.modifiers.message) component = vnode.context;else if (binding.modifiers.contact) component = vnode.child;
|
||||
|
||||
if (!dropdown_popover) {
|
||||
dropdown_popover = document.createElement('div');
|
||||
dropdown_popover.className = 'lemon-dropdown';
|
||||
document.body.appendChild(dropdown_popover);
|
||||
}
|
||||
|
||||
dropdown_popover.innerHTML = binding.value.map(function (item) {
|
||||
var visible;
|
||||
|
||||
if (isFunction(item.visible)) {
|
||||
visible = item.visible(component);
|
||||
} else {
|
||||
visible = item.visible === undefined ? true : item.visible;
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
visibleItems.push(item);
|
||||
var icon = item.icon ? "<i class=\"lemon-dropdown__icon ".concat(item.icon, "\"></i>") : '';
|
||||
return "<div style=\"color:".concat(item.color, "\" title=\"").concat(item.text, "\" class=\"lemon-dropdown__item\">").concat(icon, "<span>").concat(item.text, "</span></div>");
|
||||
}
|
||||
|
||||
return '';
|
||||
}).join("");
|
||||
dropdown_popover.style.top = "".concat(e.pageY, "px");
|
||||
dropdown_popover.style.left = "".concat(e.pageX, "px");
|
||||
dropdown_popover.childNodes.forEach(function (node, index) {
|
||||
var _visibleItems$index = visibleItems[index],
|
||||
click = _visibleItems$index.click,
|
||||
_render = _visibleItems$index.render;
|
||||
node.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
if (isFunction(click)) click(e, component, hidePopover);
|
||||
});
|
||||
|
||||
if (isFunction(_render)) {
|
||||
var ins = external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({
|
||||
render: function render(h) {
|
||||
return _render(h, component, hidePopover);
|
||||
}
|
||||
});
|
||||
var renderComponent = new ins().$mount();
|
||||
node.querySelector('span').innerHTML = renderComponent.$el.outerHTML;
|
||||
}
|
||||
});
|
||||
showPopover();
|
||||
});
|
||||
},
|
||||
inserted: function inserted(el, binding, vnode) {}
|
||||
});
|
||||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/messages.vue?vue&type=script&lang=js&
|
||||
|
||||
|
||||
@@ -6784,6 +6874,7 @@ var editor_component = normalizeComponent(
|
||||
|
||||
|
||||
|
||||
|
||||
/* harmony default export */ var messagesvue_type_script_lang_js_ = ({
|
||||
name: "LemonMessages",
|
||||
components: {},
|
||||
@@ -6907,17 +6998,18 @@ var editor_component = normalizeComponent(
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
target = e.target;
|
||||
dropdown.hide();
|
||||
|
||||
if (!(target.scrollTop == 0 && this._loading == false && this._loadend == false)) {
|
||||
_context2.next = 7;
|
||||
_context2.next = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
this._loading = true;
|
||||
_context2.next = 5;
|
||||
_context2.next = 6;
|
||||
return this.$nextTick();
|
||||
|
||||
case 5:
|
||||
case 6:
|
||||
hst = target.scrollHeight;
|
||||
this.$emit("reach-top",
|
||||
/*#__PURE__*/
|
||||
@@ -6950,7 +7042,7 @@ var editor_component = normalizeComponent(
|
||||
};
|
||||
}());
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
@@ -7040,6 +7132,7 @@ var messages_component = normalizeComponent(
|
||||
}
|
||||
},
|
||||
props: {
|
||||
contextmenu: Array,
|
||||
message: {
|
||||
type: Object,
|
||||
default: function _default() {
|
||||
@@ -7105,6 +7198,13 @@ var messages_component = normalizeComponent(
|
||||
}, [this.timeFormat(sendTime)])]), h("div", {
|
||||
"class": "lemon-message__content-flex"
|
||||
}, [h("div", {
|
||||
"directives": [{
|
||||
name: "dropdown",
|
||||
value: this.IMUI.contextmenu,
|
||||
modifiers: {
|
||||
"message": true
|
||||
}
|
||||
}],
|
||||
"class": "lemon-message__content",
|
||||
"on": {
|
||||
"click": function click(e) {
|
||||
@@ -7131,7 +7231,7 @@ var messages_component = normalizeComponent(
|
||||
color: "#ff2525",
|
||||
cursor: "pointer"
|
||||
}
|
||||
}), this._renderStatue(status)])])])]);
|
||||
})])])])]);
|
||||
},
|
||||
created: function created() {},
|
||||
mounted: function mounted() {},
|
||||
@@ -7140,22 +7240,6 @@ var messages_component = normalizeComponent(
|
||||
methods: {
|
||||
_emitClick: function _emitClick(e, key) {
|
||||
this.IMUI.$emit("message-click", e, key, this.message, this.IMUI);
|
||||
},
|
||||
_renderStatue: function _renderStatue(status) {// if (status == "going") {
|
||||
// return <i class="lemon-icon-loading lemonani-spin" />;
|
||||
// } else if (status == "failed") {
|
||||
// return (
|
||||
// <i
|
||||
// class="lemon-icon-prompt"
|
||||
// title="重发消息"
|
||||
// style={{
|
||||
// color: "#ff2525",
|
||||
// cursor: "pointer"
|
||||
// }}
|
||||
// />
|
||||
// );
|
||||
// }
|
||||
// return;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -7617,6 +7701,7 @@ function componentsvue_type_script_lang_js_objectSpread(target) { for (var i = 1
|
||||
|
||||
|
||||
|
||||
|
||||
var allMessages = {};
|
||||
var emojiMap = {};
|
||||
|
||||
@@ -7682,6 +7767,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
hideMessageTime: Boolean,
|
||||
sendKey: Function,
|
||||
sendText: String,
|
||||
contextmenu: Array,
|
||||
contactContextmenu: Array,
|
||||
user: {
|
||||
type: Object,
|
||||
default: function _default() {
|
||||
@@ -7790,7 +7877,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
var scrollToBottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
|
||||
if (allMessages[message.toContactId] === undefined) {
|
||||
this.updateContact(message.toContactId, {
|
||||
this.updateContact({
|
||||
id: message.toContactId,
|
||||
unread: "+1",
|
||||
lastSendTime: message.sendTime,
|
||||
lastContent: this.lastContentRender(message)
|
||||
@@ -7799,6 +7887,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
this._addMessage(message, message.toContactId, 1);
|
||||
|
||||
var updateContact = {
|
||||
id: message.toContactId,
|
||||
lastContent: this.lastContentRender(message),
|
||||
lastSendTime: message.sendTime
|
||||
};
|
||||
@@ -7811,7 +7900,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
updateContact.unread = '+1';
|
||||
}
|
||||
|
||||
this.updateContact(message.toContactId, updateContact);
|
||||
this.updateContact(updateContact);
|
||||
}
|
||||
},
|
||||
_emitSend: function _emitSend(message, next, file) {
|
||||
@@ -7836,7 +7925,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
this.appendMessage(message, true);
|
||||
|
||||
this._emitSend(message, function () {
|
||||
_this4.updateContact(message.toContactId, {
|
||||
_this4.updateContact({
|
||||
id: message.toContactId,
|
||||
lastContent: _this4.lastContentRender(message),
|
||||
lastSendTime: message.sendTime
|
||||
});
|
||||
@@ -7867,7 +7957,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
this.appendMessage(message, true);
|
||||
|
||||
this._emitSend(message, function () {
|
||||
_this5.updateContact(message.toContactId, {
|
||||
_this5.updateContact({
|
||||
id: message.toContactId,
|
||||
lastContent: _this5.lastContentRender(message),
|
||||
lastSendTime: message.sendTime
|
||||
});
|
||||
@@ -8012,7 +8103,14 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
return h("lemon-contact", helper_default()([{
|
||||
"class": {
|
||||
"lemon-contact--active": this.currentContactId == props.contact.id
|
||||
}
|
||||
},
|
||||
"directives": [{
|
||||
name: "dropdown",
|
||||
value: this.contactContextmenu,
|
||||
modifiers: {
|
||||
"contact": true
|
||||
}
|
||||
}]
|
||||
}, {
|
||||
"props": props
|
||||
}, {
|
||||
@@ -8051,7 +8149,10 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
"directives": [{
|
||||
name: "show",
|
||||
value: this.activeSidebar == name
|
||||
}]
|
||||
}],
|
||||
"on": {
|
||||
"scroll": this._handleSidebarScroll
|
||||
}
|
||||
}, [children]);
|
||||
},
|
||||
_renderDrawer: function _renderDrawer() {
|
||||
@@ -8151,12 +8252,22 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
}), h("h4", [curact.displayName]), h("lemon-button", {
|
||||
"on": {
|
||||
"click": function click() {
|
||||
if (isEmpty(curact.lastContent)) {
|
||||
_this12.updateContact({
|
||||
id: curact.id,
|
||||
lastContent: ' '
|
||||
});
|
||||
}
|
||||
|
||||
_this12.changeContact(curact.id, DEFAULT_MENU_LASTMESSAGES);
|
||||
}
|
||||
}
|
||||
}, ["\u53D1\u9001\u6D88\u606F"])]), curact)]));
|
||||
return nodes;
|
||||
},
|
||||
_handleSidebarScroll: function _handleSidebarScroll() {
|
||||
dropdown.hide();
|
||||
},
|
||||
_addContact: function _addContact(data, t) {
|
||||
var type = {
|
||||
0: "unshift",
|
||||
@@ -8252,16 +8363,25 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
|
||||
case 6:
|
||||
this.currentContactId = contactId;
|
||||
|
||||
if (this.currentContactId) {
|
||||
_context2.next = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt("return", false);
|
||||
|
||||
case 9:
|
||||
this.$emit("change-contact", this.currentContact, this);
|
||||
|
||||
if (!isFunction(this.currentContact.renderContainer)) {
|
||||
_context2.next = 10;
|
||||
_context2.next = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt("return");
|
||||
|
||||
case 10:
|
||||
case 12:
|
||||
if (this.CacheMessageLoaded.has(contactId)) {
|
||||
this.$refs.messages.loaded();
|
||||
} else {
|
||||
@@ -8282,7 +8402,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
}, 0);
|
||||
}
|
||||
|
||||
case 12:
|
||||
case 14:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
@@ -8320,10 +8440,11 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
*/
|
||||
updateMessage: function updateMessage(message) {
|
||||
if (!message.id) return false;
|
||||
delete message.toContactId;
|
||||
var historyMessage = this.findMessage(message.id);
|
||||
if (!historyMessage) return false;
|
||||
historyMessage = Object.assign(historyMessage, message);
|
||||
historyMessage = Object.assign(historyMessage, message, {
|
||||
toContactId: historyMessage.toContactId
|
||||
});
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -8495,11 +8616,11 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
|
||||
/**
|
||||
* 修改联系人数据
|
||||
* @param {Contact} data 修改的数据,根据 data.id 查找联系人并覆盖传入的值
|
||||
* @param {Contact} data 修改的数据,根据 Contact.id 查找联系人并覆盖传入的值
|
||||
*/
|
||||
updateContact: function updateContact(contactId, data) {
|
||||
updateContact: function updateContact(data) {
|
||||
var contactId = data.id;
|
||||
delete data.id;
|
||||
delete data.toContactId;
|
||||
var index = this.findContactIndexById(contactId);
|
||||
|
||||
if (index !== -1) {
|
||||
@@ -8543,6 +8664,12 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
if (message) return message;
|
||||
}
|
||||
},
|
||||
findContact: function findContact(contactId) {
|
||||
return this.getContacts().find(function (_ref4) {
|
||||
var id = _ref4.id;
|
||||
return id == contactId;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回所有联系人
|
||||
@@ -8558,6 +8685,12 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
getCurrentMessages: function getCurrentMessages() {
|
||||
return this.currentMessages;
|
||||
},
|
||||
setEditorValue: function setEditorValue(val) {
|
||||
this.$refs.editor.setValue(this.replaceEmojiName(val));
|
||||
},
|
||||
getEditorValue: function getEditorValue() {
|
||||
return this.$refs.editor.getFormatValue();
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回所有消息
|
||||
@@ -8608,6 +8741,10 @@ var components_component = normalizeComponent(
|
||||
// EXTERNAL MODULE: ./packages/styles/common/index.styl
|
||||
var common = __webpack_require__("6a2b");
|
||||
|
||||
// CONCATENATED MODULE: ./packages/directives/index.js
|
||||
|
||||
|
||||
external_commonjs_vue_commonjs2_vue_root_Vue_default.a.directive('dropdown', dropdown);
|
||||
// CONCATENATED MODULE: ./packages/index.js
|
||||
|
||||
|
||||
@@ -8626,7 +8763,8 @@ var common = __webpack_require__("6a2b");
|
||||
|
||||
|
||||
|
||||
var version = "0.1";
|
||||
|
||||
var version = "1.4.2";
|
||||
var packages_components = [components, components_contact, messages, editor, avatar, badge, components_button, popover, tabs, basic, message_text, message_image, file, message_event];
|
||||
|
||||
var install = function install(Vue) {
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
.lemon-tabs{background:#f6f6f6}.lemon-tabs-content{padding:15px}.lemon-tabs-content,.lemon-tabs-content__pane{width:100%;height:100%}.lemon-tabs-nav{display:-webkit-box;display:-ms-flexbox;display:flex;background:#eee}.lemon-tabs-nav__item{line-height:38px;padding:0 15px;cursor:pointer;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1)}.lemon-tabs-nav__item--active{background:#f6f6f6}.lemon-popover{border:1px solid #eee;font-size:14px;font-variant:tabular-nums;line-height:1.5;color:rgba(0,0,0,.65);z-index:10;background-color:#fff;border-radius:4px;-webkit-box-shadow:0 2px 8px rgba(0,0,0,.15);box-shadow:0 2px 8px rgba(0,0,0,.15);position:absolute;-webkit-transform-origin:50% 150%;transform-origin:50% 150%}.lemon-popover__content{padding:15px;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;z-index:1}.lemon-popover__arrow{left:50%;-webkit-transform:translateX(-50%) rotate(45deg);transform:translateX(-50%) rotate(45deg);position:absolute;z-index:0;bottom:-4px;-webkit-box-shadow:3px 3px 7px rgba(0,0,0,.07);box-shadow:3px 3px 7px rgba(0,0,0,.07);width:8px;height:8px;background:#fff}.slide-top-enter-active,.slide-top-leave-active{-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1)}.slide-top-enter,.slide-top-leave-to{-webkit-transform:translateY(-10px) scale(.8);transform:translateY(-10px) scale(.8);opacity:0}.lemon-button{outline:none;line-height:1.499;display:inline-block;font-weight:400;text-align:center;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid #ddd;-webkit-box-sizing:border-box;box-sizing:border-box;white-space:nowrap;padding:0 15px;font-size:14px;border-radius:4px;height:32px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);color:rgba(0,0,0,.65);background-color:#fff;-webkit-box-shadow:0 2px 0 rgba(0,0,0,.015);box-shadow:0 2px 0 rgba(0,0,0,.015);text-shadow:0 -1px 0 rgba(0,0,0,.12)}.lemon-button:hover:not([disabled]){border-color:#666;color:#333}.lemon-button:active{background-color:#ddd}.lemon-button[disabled]{cursor:not-allowed;color:#aaa;background:#eee}.lemon-badge{position:relative;display:inline-block}.lemon-badge__label{border-radius:10px;background:#f5222d;color:#fff;text-align:center;font-size:12px;font-weight:400;white-space:nowrap;-webkit-box-shadow:0 0 0 1px #fff;box-shadow:0 0 0 1px #fff;z-index:10;position:absolute;-webkit-transform:translateX(50%);transform:translateX(50%);-webkit-transform-origin:100%;transform-origin:100%;display:inline-block;padding:0 4px;height:18px;line-height:17px;min-width:10px;top:-4px;right:6px}.lemon-badge__label--dot{width:10px;height:10px;min-width:auto;padding:0;top:-3px;right:2px}.lemon-avatar{font-variant:tabular-nums;line-height:1.5;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;list-style:none;display:inline-block;text-align:center;background:#ccc;color:hsla(0,0%,100%,.7);white-space:nowrap;position:relative;overflow:hidden;vertical-align:middle;border-radius:4px}.lemon-avatar img{width:100%;height:100%;display:block}.lemon-contact{padding:10px 14px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;background:#efefef;text-align:left}.lemon-contact p{margin:0}.lemon-contact--active{background:#bebdbd}.lemon-contact:hover:not(.lemon-contact--active){background:#e3e3e3}.lemon-contact:hover:not(.lemon-contact--active) .el-badge__content{border-color:#ddd}.lemon-contact__avatar{float:left;margin-right:10px}.lemon-contact__avatar img{display:block}.lemon-contact__avatar .ant-badge-count{display:inline-block;padding:0 4px;height:18px;line-height:18px;min-width:18px;top:-4px;right:7px}.lemon-contact__label{display:-webkit-box;display:-ms-flexbox;display:flex}.lemon-contact__time{font-size:12px;line-height:18px;padding-left:6px;color:#999;white-space:nowrap}.lemon-contact__name{display:block;width:100%}.lemon-contact__content,.lemon-contact__name{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.lemon-contact__content{font-size:12px;color:#999;padding-top:3px;height:14px;line-height:14px}.lemon-contact__content img{height:14px;display:inline-block;vertical-align:top;margin:0 1px}.lemon-contact--name-center .lemon-contact__label{padding-bottom:0;line-height:38px}.lemon-editor{height:200px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.lemon-editor,.lemon-editor__tool{display:-webkit-box;display:-ms-flexbox;display:flex}.lemon-editor__tool{height:40px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:0 5px}.lemon-editor__tooLine truncated
|
||||
.lemon-tabs{background:#f6f6f6}.lemon-tabs-content{padding:15px}.lemon-tabs-content,.lemon-tabs-content__pane{width:100%;height:100%}.lemon-tabs-nav{display:-webkit-box;display:-ms-flexbox;display:flex;background:#eee}.lemon-tabs-nav__item{line-height:38px;padding:0 15px;cursor:pointer;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1)}.lemon-tabs-nav__item--active{background:#f6f6f6}.lemon-popover{border:1px solid #eee;font-size:14px;font-variant:tabular-nums;line-height:1.5;color:rgba(0,0,0,.65);z-index:10;background-color:#fff;border-radius:4px;-webkit-box-shadow:0 2px 8px rgba(0,0,0,.08);box-shadow:0 2px 8px rgba(0,0,0,.08);position:absolute;-webkit-transform-origin:50% 150%;transform-origin:50% 150%}.lemon-popover__content{padding:15px;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;z-index:1}.lemon-popover__arrow{left:50%;-webkit-transform:translateX(-50%) rotate(45deg);transform:translateX(-50%) rotate(45deg);position:absolute;z-index:0;bottom:-4px;-webkit-box-shadow:3px 3px 7px rgba(0,0,0,.07);box-shadow:3px 3px 7px rgba(0,0,0,.07);width:8px;height:8px;background:#fff}.lemon-slide-top-enter-active,.lemon-slide-top-leave-active{-webkit-transition:all .2s cubic-bezier(.645,.045,.355,1);transition:all .2s cubic-bezier(.645,.045,.355,1)}.lemon-slide-top-enter,.lemon-slide-top-leave-to{-webkit-transform:translateY(-10px) scale(.8);transform:translateY(-10px) scale(.8);opacity:0}.lemon-button{outline:none;line-height:1.499;display:inline-block;font-weight:400;text-align:center;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid #ddd;-webkit-box-sizing:border-box;box-sizing:border-box;white-space:nowrap;padding:0 15px;font-size:14px;border-radius:4px;height:32px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);color:rgba(0,0,0,.65);background-color:#fff;-webkit-box-shadow:0 2px 0 rgba(0,0,0,.015);box-shadow:0 2px 0 rgba(0,0,0,.015);text-shadow:0 -1px 0 rgba(0,0,0,.12)}.lemon-button:hover:not([disabled]){border-color:#666;color:#333}.lemon-button:active{background-color:#ddd}.lemon-button[disabled]{cursor:not-allowed;color:#aaa;background:#eee}.lemon-badge{position:relative;display:inline-block}.lemon-badge__label{border-radius:10px;background:#f5222d;color:#fff;text-align:center;font-size:12px;font-weight:400;white-space:nowrap;-webkit-box-shadow:0 0 0 1px #fff;box-shadow:0 0 0 1px #fff;z-index:10;position:absolute;-webkit-transform:translateX(50%);transform:translateX(50%);-webkit-transform-origin:100%;transform-origin:100%;display:inline-block;padding:0 4px;height:18px;line-height:17px;min-width:10px;top:-4px;right:6px}.lemon-badge__label--dot{width:10px;height:10px;min-width:auto;padding:0;top:-3px;right:2px}.lemon-avatar{font-variant:tabular-nums;line-height:1.5;-webkit-box-sizing:border-box;box-sizing:border-box;margin:0;padding:0;list-style:none;display:inline-block;text-align:center;background:#ccc;color:hsla(0,0%,100%,.7);white-space:nowrap;position:relative;overflow:hidden;vertical-align:middle;border-radius:4px}.lemon-avatar img{width:100%;height:100%;display:block}.lemon-contact{padding:10px 14px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;background:#efefef;text-align:left}.lemon-contact p{margin:0}.lemon-contact--active{background:#bebdbd}.lemon-contact:hover:not(.lemon-contact--active){background:#e3e3e3}.lemon-contact:hover:not(.lemon-contact--active) .el-badge__content{border-color:#ddd}.lemon-contact__avatar{float:left;margin-right:10px}.lemon-contact__avatar img{display:block}.lemon-contact__avatar .ant-badge-count{display:inline-block;padding:0 4px;height:18px;line-height:18px;min-width:18px;top:-4px;right:7px}.lemon-contact__label{display:-webkit-box;display:-ms-flexbox;display:flex}.lemon-contact__time{font-size:12px;line-height:18px;padding-left:6px;color:#999;white-space:nowrap}.lemon-contact__name{display:block;width:100%}.lemon-contact__content,.lemon-contact__name{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.lemon-contact__content{font-size:12px;color:#999;padding-top:3px;height:14px;line-height:14px}.lemon-contact__content img{height:14px;display:inline-block;vertical-align:top;margin:0 1px}.lemon-contact--name-center .lemon-contact__label{padding-bottom:0;line-height:38px}.lemon-editor{height:200px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.lemon-editor,.lemon-editor__tool{display:-webkit-box;display:-ms-flexbox;display:flex}.lemon-editor__tool{height:40px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;padding:Line truncated
|
||||
Vendored
+199
-61
@@ -1,13 +1,13 @@
|
||||
(function webpackUniversalModuleDefinition(root, factory) {
|
||||
if(typeof exports === 'object' && typeof module === 'object')
|
||||
module.exports = factory();
|
||||
module.exports = factory(require("vue"));
|
||||
else if(typeof define === 'function' && define.amd)
|
||||
define([], factory);
|
||||
else if(typeof exports === 'object')
|
||||
exports["index"] = factory();
|
||||
exports["index"] = factory(require("vue"));
|
||||
else
|
||||
root["index"] = factory();
|
||||
})((typeof self !== 'undefined' ? self : this), function() {
|
||||
root["index"] = factory(root["Vue"]);
|
||||
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__8bbf__) {
|
||||
return /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
@@ -3196,6 +3196,13 @@ module.exports = {
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "8bbf":
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = __WEBPACK_EXTERNAL_MODULE__8bbf__;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "8e60":
|
||||
@@ -5575,7 +5582,7 @@ var tabs_render, staticRenderFns
|
||||
|
||||
/* normalize component */
|
||||
|
||||
var component = normalizeComponent(
|
||||
var tabs_component = normalizeComponent(
|
||||
components_tabsvue_type_script_lang_js_,
|
||||
tabs_render,
|
||||
staticRenderFns,
|
||||
@@ -5586,7 +5593,7 @@ var component = normalizeComponent(
|
||||
|
||||
)
|
||||
|
||||
/* harmony default export */ var tabs = (component.exports);
|
||||
/* harmony default export */ var tabs = (tabs_component.exports);
|
||||
// EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
|
||||
var runtime = __webpack_require__("96cf");
|
||||
|
||||
@@ -5721,7 +5728,7 @@ var triggerEvents = {
|
||||
"style": "position:relative"
|
||||
}, [h("transition", {
|
||||
"attrs": {
|
||||
"name": "slide-top"
|
||||
"name": "lemon-slide-top"
|
||||
}
|
||||
}, [this.visible && h("div", {
|
||||
"class": "lemon-popover",
|
||||
@@ -6193,6 +6200,10 @@ function arrayIntersect(a, b) {
|
||||
|
||||
function clearHtml(str) {
|
||||
return str.replace(/<.*?>/ig, "");
|
||||
} //清除字符串内的所有HTML标签,除了IMG
|
||||
|
||||
function clearHtmlExcludeImg(str) {
|
||||
return str.replace(/<(?!img).*?>/ig, "");
|
||||
}
|
||||
function error(text) {
|
||||
throw new Error(text);
|
||||
@@ -6258,6 +6269,14 @@ function generateUUID() {
|
||||
/* harmony default export */ var contactvue_type_script_lang_js_ = ({
|
||||
name: "LemonContact",
|
||||
components: {},
|
||||
inject: {
|
||||
IMUI: {
|
||||
from: 'IMUI',
|
||||
default: function _default() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
return {};
|
||||
},
|
||||
@@ -6292,24 +6311,16 @@ function generateUUID() {
|
||||
watch: {},
|
||||
methods: {
|
||||
_renderInner: function _renderInner() {
|
||||
var _this2 = this;
|
||||
|
||||
var h = this.$createElement;
|
||||
var contact = this.contact;
|
||||
return [h("lemon-badge", {
|
||||
"attrs": {
|
||||
"count": !this.simple ? contact.unread : 0,
|
||||
"native-on-click": function nativeOnClick(e) {
|
||||
return _this2._handleBubbleClick(e, contact);
|
||||
}
|
||||
"count": !this.simple ? contact.unread : 0
|
||||
},
|
||||
"class": "lemon-contact__avatar"
|
||||
}, [h("lemon-avatar", {
|
||||
"attrs": {
|
||||
"size": 40,
|
||||
"native-on-click": function nativeOnClick(e) {
|
||||
return _this2._handleAvatarClick(e, contact);
|
||||
},
|
||||
"src": contact.avatar
|
||||
}
|
||||
})]), h("div", {
|
||||
@@ -6330,14 +6341,6 @@ function generateUUID() {
|
||||
},
|
||||
_handleClick: function _handleClick(e, data) {
|
||||
this.$emit("click", data);
|
||||
},
|
||||
_handleAvatarClick: function _handleAvatarClick(e, data) {
|
||||
e.stopPropagation();
|
||||
this.$emit("avatar-click", data);
|
||||
},
|
||||
_handleBubbleClick: function _handleBubbleClick(e, data) {
|
||||
e.stopPropagation();
|
||||
this.$emit("bubble-click", data);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -6671,6 +6674,8 @@ var isInitTool = false;
|
||||
|
||||
exec("<img emoji-name=\"".concat(item.name, "\" src=\"").concat(item.src, "\"></img>"));
|
||||
|
||||
this._checkSubmitDisabled();
|
||||
|
||||
this._saveLastRange();
|
||||
},
|
||||
selectFile: function () {
|
||||
@@ -6733,7 +6738,7 @@ var isInitTool = false;
|
||||
return toEmojiName(this.$refs.textarea.innerHTML);
|
||||
},
|
||||
_checkSubmitDisabled: function _checkSubmitDisabled() {
|
||||
this.submitDisabled = !this.$refs.textarea.innerText.trim();
|
||||
this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
|
||||
},
|
||||
_handleSend: function _handleSend(e) {
|
||||
var text = this.getFormatValue();
|
||||
@@ -6757,6 +6762,11 @@ var isInitTool = false;
|
||||
initEmoji: function initEmoji(data) {
|
||||
emojiData = data;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
setValue: function setValue(val) {
|
||||
this.$refs.textarea.innerHTML = val;
|
||||
|
||||
this._checkSubmitDisabled();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -6786,6 +6796,86 @@ var editor_component = normalizeComponent(
|
||||
)
|
||||
|
||||
/* harmony default export */ var editor = (editor_component.exports);
|
||||
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
||||
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
|
||||
var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
|
||||
|
||||
// CONCATENATED MODULE: ./packages/directives/dropdown.js
|
||||
|
||||
|
||||
|
||||
var dropdown_popover;
|
||||
|
||||
var hidePopover = function hidePopover() {
|
||||
if (dropdown_popover) dropdown_popover.style.display = 'none';
|
||||
};
|
||||
|
||||
var showPopover = function showPopover() {
|
||||
if (dropdown_popover) dropdown_popover.style.display = 'block';
|
||||
};
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
hidePopover();
|
||||
});
|
||||
/* harmony default export */ var dropdown = ({
|
||||
hide: hidePopover,
|
||||
bind: function bind(el, binding, vnode) {
|
||||
el.addEventListener('contextmenu', function (e) {
|
||||
if (isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
||||
e.preventDefault();
|
||||
var component;
|
||||
var visibleItems = [];
|
||||
if (binding.modifiers.message) component = vnode.context;else if (binding.modifiers.contact) component = vnode.child;
|
||||
|
||||
if (!dropdown_popover) {
|
||||
dropdown_popover = document.createElement('div');
|
||||
dropdown_popover.className = 'lemon-dropdown';
|
||||
document.body.appendChild(dropdown_popover);
|
||||
}
|
||||
|
||||
dropdown_popover.innerHTML = binding.value.map(function (item) {
|
||||
var visible;
|
||||
|
||||
if (isFunction(item.visible)) {
|
||||
visible = item.visible(component);
|
||||
} else {
|
||||
visible = item.visible === undefined ? true : item.visible;
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
visibleItems.push(item);
|
||||
var icon = item.icon ? "<i class=\"lemon-dropdown__icon ".concat(item.icon, "\"></i>") : '';
|
||||
return "<div style=\"color:".concat(item.color, "\" title=\"").concat(item.text, "\" class=\"lemon-dropdown__item\">").concat(icon, "<span>").concat(item.text, "</span></div>");
|
||||
}
|
||||
|
||||
return '';
|
||||
}).join("");
|
||||
dropdown_popover.style.top = "".concat(e.pageY, "px");
|
||||
dropdown_popover.style.left = "".concat(e.pageX, "px");
|
||||
dropdown_popover.childNodes.forEach(function (node, index) {
|
||||
var _visibleItems$index = visibleItems[index],
|
||||
click = _visibleItems$index.click,
|
||||
_render = _visibleItems$index.render;
|
||||
node.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
if (isFunction(click)) click(e, component, hidePopover);
|
||||
});
|
||||
|
||||
if (isFunction(_render)) {
|
||||
var ins = external_commonjs_vue_commonjs2_vue_root_Vue_default.a.extend({
|
||||
render: function render(h) {
|
||||
return _render(h, component, hidePopover);
|
||||
}
|
||||
});
|
||||
var renderComponent = new ins().$mount();
|
||||
node.querySelector('span').innerHTML = renderComponent.$el.outerHTML;
|
||||
}
|
||||
});
|
||||
showPopover();
|
||||
});
|
||||
},
|
||||
inserted: function inserted(el, binding, vnode) {}
|
||||
});
|
||||
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/messages.vue?vue&type=script&lang=js&
|
||||
|
||||
|
||||
@@ -6793,6 +6883,7 @@ var editor_component = normalizeComponent(
|
||||
|
||||
|
||||
|
||||
|
||||
/* harmony default export */ var messagesvue_type_script_lang_js_ = ({
|
||||
name: "LemonMessages",
|
||||
components: {},
|
||||
@@ -6916,17 +7007,18 @@ var editor_component = normalizeComponent(
|
||||
switch (_context2.prev = _context2.next) {
|
||||
case 0:
|
||||
target = e.target;
|
||||
dropdown.hide();
|
||||
|
||||
if (!(target.scrollTop == 0 && this._loading == false && this._loadend == false)) {
|
||||
_context2.next = 7;
|
||||
_context2.next = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
this._loading = true;
|
||||
_context2.next = 5;
|
||||
_context2.next = 6;
|
||||
return this.$nextTick();
|
||||
|
||||
case 5:
|
||||
case 6:
|
||||
hst = target.scrollHeight;
|
||||
this.$emit("reach-top",
|
||||
/*#__PURE__*/
|
||||
@@ -6959,7 +7051,7 @@ var editor_component = normalizeComponent(
|
||||
};
|
||||
}());
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
@@ -7049,6 +7141,7 @@ var messages_component = normalizeComponent(
|
||||
}
|
||||
},
|
||||
props: {
|
||||
contextmenu: Array,
|
||||
message: {
|
||||
type: Object,
|
||||
default: function _default() {
|
||||
@@ -7114,6 +7207,13 @@ var messages_component = normalizeComponent(
|
||||
}, [this.timeFormat(sendTime)])]), h("div", {
|
||||
"class": "lemon-message__content-flex"
|
||||
}, [h("div", {
|
||||
"directives": [{
|
||||
name: "dropdown",
|
||||
value: this.IMUI.contextmenu,
|
||||
modifiers: {
|
||||
"message": true
|
||||
}
|
||||
}],
|
||||
"class": "lemon-message__content",
|
||||
"on": {
|
||||
"click": function click(e) {
|
||||
@@ -7140,7 +7240,7 @@ var messages_component = normalizeComponent(
|
||||
color: "#ff2525",
|
||||
cursor: "pointer"
|
||||
}
|
||||
}), this._renderStatue(status)])])])]);
|
||||
})])])])]);
|
||||
},
|
||||
created: function created() {},
|
||||
mounted: function mounted() {},
|
||||
@@ -7149,22 +7249,6 @@ var messages_component = normalizeComponent(
|
||||
methods: {
|
||||
_emitClick: function _emitClick(e, key) {
|
||||
this.IMUI.$emit("message-click", e, key, this.message, this.IMUI);
|
||||
},
|
||||
_renderStatue: function _renderStatue(status) {// if (status == "going") {
|
||||
// return <i class="lemon-icon-loading lemonani-spin" />;
|
||||
// } else if (status == "failed") {
|
||||
// return (
|
||||
// <i
|
||||
// class="lemon-icon-prompt"
|
||||
// title="重发消息"
|
||||
// style={{
|
||||
// color: "#ff2525",
|
||||
// cursor: "pointer"
|
||||
// }}
|
||||
// />
|
||||
// );
|
||||
// }
|
||||
// return;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -7626,6 +7710,7 @@ function componentsvue_type_script_lang_js_objectSpread(target) { for (var i = 1
|
||||
|
||||
|
||||
|
||||
|
||||
var allMessages = {};
|
||||
var emojiMap = {};
|
||||
|
||||
@@ -7691,6 +7776,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
hideMessageTime: Boolean,
|
||||
sendKey: Function,
|
||||
sendText: String,
|
||||
contextmenu: Array,
|
||||
contactContextmenu: Array,
|
||||
user: {
|
||||
type: Object,
|
||||
default: function _default() {
|
||||
@@ -7799,7 +7886,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
var scrollToBottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
|
||||
if (allMessages[message.toContactId] === undefined) {
|
||||
this.updateContact(message.toContactId, {
|
||||
this.updateContact({
|
||||
id: message.toContactId,
|
||||
unread: "+1",
|
||||
lastSendTime: message.sendTime,
|
||||
lastContent: this.lastContentRender(message)
|
||||
@@ -7808,6 +7896,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
this._addMessage(message, message.toContactId, 1);
|
||||
|
||||
var updateContact = {
|
||||
id: message.toContactId,
|
||||
lastContent: this.lastContentRender(message),
|
||||
lastSendTime: message.sendTime
|
||||
};
|
||||
@@ -7820,7 +7909,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
updateContact.unread = '+1';
|
||||
}
|
||||
|
||||
this.updateContact(message.toContactId, updateContact);
|
||||
this.updateContact(updateContact);
|
||||
}
|
||||
},
|
||||
_emitSend: function _emitSend(message, next, file) {
|
||||
@@ -7845,7 +7934,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
this.appendMessage(message, true);
|
||||
|
||||
this._emitSend(message, function () {
|
||||
_this4.updateContact(message.toContactId, {
|
||||
_this4.updateContact({
|
||||
id: message.toContactId,
|
||||
lastContent: _this4.lastContentRender(message),
|
||||
lastSendTime: message.sendTime
|
||||
});
|
||||
@@ -7876,7 +7966,8 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
this.appendMessage(message, true);
|
||||
|
||||
this._emitSend(message, function () {
|
||||
_this5.updateContact(message.toContactId, {
|
||||
_this5.updateContact({
|
||||
id: message.toContactId,
|
||||
lastContent: _this5.lastContentRender(message),
|
||||
lastSendTime: message.sendTime
|
||||
});
|
||||
@@ -8021,7 +8112,14 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
return h("lemon-contact", helper_default()([{
|
||||
"class": {
|
||||
"lemon-contact--active": this.currentContactId == props.contact.id
|
||||
}
|
||||
},
|
||||
"directives": [{
|
||||
name: "dropdown",
|
||||
value: this.contactContextmenu,
|
||||
modifiers: {
|
||||
"contact": true
|
||||
}
|
||||
}]
|
||||
}, {
|
||||
"props": props
|
||||
}, {
|
||||
@@ -8060,7 +8158,10 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
"directives": [{
|
||||
name: "show",
|
||||
value: this.activeSidebar == name
|
||||
}]
|
||||
}],
|
||||
"on": {
|
||||
"scroll": this._handleSidebarScroll
|
||||
}
|
||||
}, [children]);
|
||||
},
|
||||
_renderDrawer: function _renderDrawer() {
|
||||
@@ -8160,12 +8261,22 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
}), h("h4", [curact.displayName]), h("lemon-button", {
|
||||
"on": {
|
||||
"click": function click() {
|
||||
if (isEmpty(curact.lastContent)) {
|
||||
_this12.updateContact({
|
||||
id: curact.id,
|
||||
lastContent: ' '
|
||||
});
|
||||
}
|
||||
|
||||
_this12.changeContact(curact.id, DEFAULT_MENU_LASTMESSAGES);
|
||||
}
|
||||
}
|
||||
}, ["\u53D1\u9001\u6D88\u606F"])]), curact)]));
|
||||
return nodes;
|
||||
},
|
||||
_handleSidebarScroll: function _handleSidebarScroll() {
|
||||
dropdown.hide();
|
||||
},
|
||||
_addContact: function _addContact(data, t) {
|
||||
var type = {
|
||||
0: "unshift",
|
||||
@@ -8261,16 +8372,25 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
|
||||
case 6:
|
||||
this.currentContactId = contactId;
|
||||
|
||||
if (this.currentContactId) {
|
||||
_context2.next = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt("return", false);
|
||||
|
||||
case 9:
|
||||
this.$emit("change-contact", this.currentContact, this);
|
||||
|
||||
if (!isFunction(this.currentContact.renderContainer)) {
|
||||
_context2.next = 10;
|
||||
_context2.next = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context2.abrupt("return");
|
||||
|
||||
case 10:
|
||||
case 12:
|
||||
if (this.CacheMessageLoaded.has(contactId)) {
|
||||
this.$refs.messages.loaded();
|
||||
} else {
|
||||
@@ -8291,7 +8411,7 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
}, 0);
|
||||
}
|
||||
|
||||
case 12:
|
||||
case 14:
|
||||
case "end":
|
||||
return _context2.stop();
|
||||
}
|
||||
@@ -8329,10 +8449,11 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
*/
|
||||
updateMessage: function updateMessage(message) {
|
||||
if (!message.id) return false;
|
||||
delete message.toContactId;
|
||||
var historyMessage = this.findMessage(message.id);
|
||||
if (!historyMessage) return false;
|
||||
historyMessage = Object.assign(historyMessage, message);
|
||||
historyMessage = Object.assign(historyMessage, message, {
|
||||
toContactId: historyMessage.toContactId
|
||||
});
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -8504,11 +8625,11 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
|
||||
/**
|
||||
* 修改联系人数据
|
||||
* @param {Contact} data 修改的数据,根据 data.id 查找联系人并覆盖传入的值
|
||||
* @param {Contact} data 修改的数据,根据 Contact.id 查找联系人并覆盖传入的值
|
||||
*/
|
||||
updateContact: function updateContact(contactId, data) {
|
||||
updateContact: function updateContact(data) {
|
||||
var contactId = data.id;
|
||||
delete data.id;
|
||||
delete data.toContactId;
|
||||
var index = this.findContactIndexById(contactId);
|
||||
|
||||
if (index !== -1) {
|
||||
@@ -8552,6 +8673,12 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
if (message) return message;
|
||||
}
|
||||
},
|
||||
findContact: function findContact(contactId) {
|
||||
return this.getContacts().find(function (_ref4) {
|
||||
var id = _ref4.id;
|
||||
return id == contactId;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回所有联系人
|
||||
@@ -8567,6 +8694,12 @@ var renderDrawerContent = function renderDrawerContent() {};
|
||||
getCurrentMessages: function getCurrentMessages() {
|
||||
return this.currentMessages;
|
||||
},
|
||||
setEditorValue: function setEditorValue(val) {
|
||||
this.$refs.editor.setValue(this.replaceEmojiName(val));
|
||||
},
|
||||
getEditorValue: function getEditorValue() {
|
||||
return this.$refs.editor.getFormatValue();
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回所有消息
|
||||
@@ -8617,6 +8750,10 @@ var components_component = normalizeComponent(
|
||||
// EXTERNAL MODULE: ./packages/styles/common/index.styl
|
||||
var common = __webpack_require__("6a2b");
|
||||
|
||||
// CONCATENATED MODULE: ./packages/directives/index.js
|
||||
|
||||
|
||||
external_commonjs_vue_commonjs2_vue_root_Vue_default.a.directive('dropdown', dropdown);
|
||||
// CONCATENATED MODULE: ./packages/index.js
|
||||
|
||||
|
||||
@@ -8635,7 +8772,8 @@ var common = __webpack_require__("6a2b");
|
||||
|
||||
|
||||
|
||||
var version = "0.1";
|
||||
|
||||
var version = "1.4.2";
|
||||
var packages_components = [components, components_contact, messages, editor, avatar, badge, components_button, popover, tabs, basic, message_text, message_image, file, message_event];
|
||||
|
||||
var install = function install(Vue) {
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["index"]=e():t["index"]=e()})("undefined"!==typeof self?self:this,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"01f9":function(t,e,n){"use strict";var r=n("2d00"),i=n("5ca1"),o=n("2aba"),c=n("32e9"),a=n("84f2"),s=n("41a0"),u=n("7f20"),f=n("38fd"),l=n("2b4c")("iterator"),d=!([].keys&&"next"in[].keys()),h="@@iterator",p="keys",v="values",m=function(){return this};t.exports=function(t,e,n,g,y,b,x){s(n,e,g);var _,w,S,O=function(t){if(!d&&t in E)return E[t];switch(t){case p:return function(){return new n(this,t)};case v:return function(){return new n(this,t)}}return function(){return new n(this,t)}},C=e+" Iterator",j=y==v,k=!1,E=t.prototype,T=E[l]||E[h]||y&&E[y],M=T||O(y),I=y?j?O("entries"):M:void 0,P="Array"==e&&E.entries||T;if(P&&(S=f(P.call(new t)),S!==Object.prototype&&S.next&&(u(S,C,!0),r||"function"==typeof S[l]||c(S,l,m))),j&&T&&T.name!==v&&(k=!0,M=function(){return T.call(this)}),r&&!x||!d&&!k&&E[l]||c(E,l,M),a[e]=M,a[C]=m,y)if(_={values:j?M:O(v),keys:b?M:O(p),entries:I},x)for(w in _)w in E||o(E,w,_[w]);else i(i.P+i.F*(d||k),e,_);return _}},"02f4":function(t,e,n){var r=n("4588"),i=n("be13");t.exports=function(t){return function(e,n){var o,c,a=String(i(e)),s=r(n),u=a.length;return s<0||s>=u?t?"":void 0:(o=a.charCodeAt(s),o<55296||o>56319||s+1===u||(c=a.charCodeAt(s+1))<56320||c>57343?t?a.charAt(s):o:t?a.slice(s,s+2):c-56320+(o-55296<<10)+65536)}}},"0390":function(t,e,n){"use strict";var r=n("02f4")(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},"04f4":function(t,e,n){"use strict";var r=n("26f7"),i=n.n(r);i.a},"07e3":function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},"0a49":function(t,e,n){var r=n("9b43"),i=n("626a"),o=n("4bf8"),c=n("9def"),a=n("cd1c");t.exports=function(t,e){var n=1==t,s=2==t,u=3==t,f=4==t,l=6==t,d=5==t||l,h=e||a;return function(e,a,p){for(var v,m,g=o(e),y=i(g),b=r(a,p,3),x=c(y.length),_=0,w=n?h(e,x):s?h(e,0):void 0;x>_;_++)if((d||_ in y)&&(v=y[_],m=b(v,_,g),t))if(n)w[_]=m;else if(m)switch(t){case 3:return!0;case 5:return v;case 6:return _;case 2:w.push(v)}else if(f)return!1;return l?-1:u||f?f:w}}},"0af2":function(t,e,n){},"0bfb":function(t,e,n){"use strict";var r=n("cb7c");t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},"0d58":function(t,e,n){var r=n("ce10"),i=n("e11e");t.exports=Object.keys||function(t){return r(t,i)}},"0e15":function(t,e,n){"use strict";var r=n("9768"),i=n.n(r);i.a},"0fc9":function(t,e,n){var r=n("3a38"),i=Math.max,o=Math.min;t.exports=function(t,e){return t=r(t),t<0?i(t+e,0):o(t,e)}},1021:function(t,e,n){},"107a":function(t,e,n){},1169:function(t,e,n){var r=n("2d95");t.exports=Array.isArray||function(t){return"Array"==r(t)}},1173:function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},"11e9":function(t,e,n){var r=n("52a7"),i=n("4630"),o=n("6821"),c=n("6a99"),a=n("69a8"),s=n("c69a"),u=Object.getOwnPropertyDescriptor;e.f=n("9e1e")?u:function(t,e){if(t=o(t),e=c(e,!0),s)try{return u(t,e)}catch(n){}if(a(t,e))return i(!r.f.call(t,e),t[e])}},1495:function(t,e,n){var r=n("86cc"),i=n("cb7c"),o=n("0d58");t.exports=n("9e1e")?Object.defineProperties:function(t,e){i(t);var n,c=o(e),a=c.length,s=0;while(a>s)r.f(t,n=c[s++],e[n]);return t}},"15cf":function(t,e,n){},1654:function(t,e,n){"use strict";var r=n("71c1")(!0);n("30f1")(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},1663:function(t,e,n){"use strict";var r=n("e86c"),i=n.n(r);i.a},1691:function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},"1af6":function(t,e,n){var r=n("63b6");r(r.S,"Array",{isArray:n("9003")})},"1bc3":function(t,eLine truncated
|
||||
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["index"]=e(require("vue")):t["index"]=e(t["Vue"])})("undefined"!==typeof self?self:this,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"01f9":function(t,e,n){"use strict";var r=n("2d00"),i=n("5ca1"),o=n("2aba"),c=n("32e9"),a=n("84f2"),s=n("41a0"),u=n("7f20"),f=n("38fd"),l=n("2b4c")("iterator"),d=!([].keys&&"next"in[].keys()),h="@@iterator",p="keys",v="values",m=function(){return this};t.exports=function(t,e,n,g,y,b,x){s(n,e,g);var _,w,S,O=function(t){if(!d&&t in M)return M[t];switch(t){case p:return function(){return new n(this,t)};case v:return function(){return new n(this,t)}}return function(){return new n(this,t)}},C=e+" Iterator",j=y==v,E=!1,M=t.prototype,k=M[l]||M[h]||y&&M[y],T=k||O(y),I=y?j?O("entries"):T:void 0,L="Array"==e&&M.entries||k;if(L&&(S=f(L.call(new t)),S!==Object.prototype&&S.next&&(u(S,C,!0),r||"function"==typeof S[l]||c(S,l,m))),j&&k&&k.name!==v&&(E=!0,T=function(){return k.call(this)}),r&&!x||!d&&!E&&M[l]||c(M,l,T),a[e]=T,a[C]=m,y)if(_={values:j?T:O(v),keys:b?T:O(p),entries:I},x)for(w in _)w in M||o(M,w,_[w]);else i(i.P+i.F*(d||E),e,_);return _}},"02f4":function(t,e,n){var r=n("4588"),i=n("be13");t.exports=function(t){return function(e,n){var o,c,a=String(i(e)),s=r(n),u=a.length;return s<0||s>=u?t?"":void 0:(o=a.charCodeAt(s),o<55296||o>56319||s+1===u||(c=a.charCodeAt(s+1))<56320||c>57343?t?a.charAt(s):o:t?a.slice(s,s+2):c-56320+(o-55296<<10)+65536)}}},"0390":function(t,e,n){"use strict";var r=n("02f4")(!0);t.exports=function(t,e,n){return e+(n?r(t,e).length:1)}},"04f4":function(t,e,n){"use strict";var r=n("26f7"),i=n.n(r);i.a},"07e3":function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},"0a49":function(t,e,n){var r=n("9b43"),i=n("626a"),o=n("4bf8"),c=n("9def"),a=n("cd1c");t.exports=function(t,e){var n=1==t,s=2==t,u=3==t,f=4==t,l=6==t,d=5==t||l,h=e||a;return function(e,a,p){for(var v,m,g=o(e),y=i(g),b=r(a,p,3),x=c(y.length),_=0,w=n?h(e,x):s?h(e,0):void 0;x>_;_++)if((d||_ in y)&&(v=y[_],m=b(v,_,g),t))if(n)w[_]=m;else if(m)switch(t){case 3:return!0;case 5:return v;case 6:return _;case 2:w.push(v)}else if(f)return!1;return l?-1:u||f?f:w}}},"0af2":function(t,e,n){},"0bfb":function(t,e,n){"use strict";var r=n("cb7c");t.exports=function(){var t=r(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},"0d58":function(t,e,n){var r=n("ce10"),i=n("e11e");t.exports=Object.keys||function(t){return r(t,i)}},"0e15":function(t,e,n){"use strict";var r=n("9768"),i=n.n(r);i.a},"0fc9":function(t,e,n){var r=n("3a38"),i=Math.max,o=Math.min;t.exports=function(t,e){return t=r(t),t<0?i(t+e,0):o(t,e)}},1021:function(t,e,n){},"107a":function(t,e,n){},1169:function(t,e,n){var r=n("2d95");t.exports=Array.isArray||function(t){return"Array"==r(t)}},1173:function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},"11e9":function(t,e,n){var r=n("52a7"),i=n("4630"),o=n("6821"),c=n("6a99"),a=n("69a8"),s=n("c69a"),u=Object.getOwnPropertyDescriptor;e.f=n("9e1e")?u:function(t,e){if(t=o(t),e=c(e,!0),s)try{return u(t,e)}catch(n){}if(a(t,e))return i(!r.f.call(t,e),t[e])}},1495:function(t,e,n){var r=n("86cc"),i=n("cb7c"),o=n("0d58");t.exports=n("9e1e")?Object.defineProperties:function(t,e){i(t);var n,c=o(e),a=c.length,s=0;while(a>s)r.f(t,n=c[s++],e[n]);return t}},"15cf":function(t,e,n){},1654:function(t,e,n){"use strict";var r=n("71c1")(!0);n("30f1")(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})})},1663:function(t,e,n){"use strict";var r=n("e86c"),i=n.n(r);i.a},1691:function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},"1af6":function(t,e,n){var r=n("63b6");r(r.S,"Array",{isALine truncated
|
||||
Reference in new issue
Block a user