module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "112a"); /******/ }) /************************************************************************/ /******/ ({ /***/ "01be": /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /***/ "0353": /***/ (function(module, exports, __webpack_require__) { "use strict"; var regexpFlags = __webpack_require__("6bf8"); var nativeExec = RegExp.prototype.exec; // This always refers to the native implementation, because the // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, // which loads this file before patching the method. var nativeReplace = String.prototype.replace; var patchedExec = nativeExec; var LAST_INDEX = 'lastIndex'; var UPDATES_LAST_INDEX_WRONG = (function () { var re1 = /a/, re2 = /b*/g; nativeExec.call(re1, 'a'); nativeExec.call(re2, 'a'); return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0; })(); // nonparticipating capturing group, copied from es5-shim's String#split patch. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; if (PATCH) { patchedExec = function exec(str) { var re = this; var lastIndex, reCopy, match, i; if (NPCG_INCLUDED) { reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re)); } if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX]; match = nativeExec.call(re, str); if (UPDATES_LAST_INDEX_WRONG && match) { re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex; } if (NPCG_INCLUDED && match && match.length > 1) { // Fix browsers whose `exec` methods don't consistently return `undefined` // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ // eslint-disable-next-line no-loop-func nativeReplace.call(match[0], reCopy, function () { for (i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undefined) match[i] = undefined; } }); } return match; }; } module.exports = patchedExec; /***/ }), /***/ "0451": /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__("9cff"); var isArray = __webpack_require__("d1cb"); var SPECIES = __webpack_require__("839a")('species'); module.exports = function (original) { var C; if (isArray(original)) { C = original.constructor; // cross-realm fallback if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; if (isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return C === undefined ? Array : C; }; /***/ }), /***/ "0484": /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /***/ "04f4": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _node_modules_mini_css_extract_plugin_0_8_2_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_1_0_1_css_loader_index_js_ref_11_oneOf_1_1_node_modules_vue_loader_15_9_6_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_3_0_0_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_stylus_loader_3_0_2_stylus_loader_index_js_ref_11_oneOf_1_3_node_modules_cache_loader_2_0_1_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_15_9_6_vue_loader_lib_index_js_vue_loader_options_avatar_vue_vue_type_style_index_0_lang_stylus___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("de97"); /* harmony import */ var _node_modules_mini_css_extract_plugin_0_8_2_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_1_0_1_css_loader_index_js_ref_11_oneOf_1_1_node_modules_vue_loader_15_9_6_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_3_0_0_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_stylus_loader_3_0_2_stylus_loader_index_js_ref_11_oneOf_1_3_node_modules_cache_loader_2_0_1_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_15_9_6_vue_loader_lib_index_js_vue_loader_options_avatar_vue_vue_type_style_index_0_lang_stylus___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_0_8_2_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_1_0_1_css_loader_index_js_ref_11_oneOf_1_1_node_modules_vue_loader_15_9_6_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_3_0_0_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_stylus_loader_3_0_2_stylus_loader_index_js_ref_11_oneOf_1_3_node_modules_cache_loader_2_0_1_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_15_9_6_vue_loader_lib_index_js_vue_loader_options_avatar_vue_vue_type_style_index_0_lang_stylus___WEBPACK_IMPORTED_MODULE_0__); /* unused harmony reexport * */ /***/ }), /***/ "05fd": /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__("baa7")('native-function-to-string', Function.toString); /***/ }), /***/ "065d": /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__("bb8b"); var createDesc = __webpack_require__("5edc"); module.exports = __webpack_require__("26df") ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /***/ "065e": /***/ (function(module, exports) { // IE 8- don't enum bug keys module.exports = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); /***/ }), /***/ "0926": /***/ (function(module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (e) { return true; } }; /***/ }), /***/ "0b34": /***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef /***/ }), /***/ "0c29": /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }), /***/ "0c84": /***/ (function(module, exports, __webpack_require__) { "use strict"; var $at = __webpack_require__("1663")(true); // 21.1.3.27 String.prototype[@@iterator]() __webpack_require__("120f")(String, 'String', function (iterated) { this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function () { var O = this._t; var index = this._i; var point; if (index >= O.length) return { value: undefined, done: true }; point = $at(O, index); this._i += point.length; return { value: point, done: false }; }); /***/ }), /***/ "0e15": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _node_modules_mini_css_extract_plugin_0_8_2_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_1_0_1_css_loader_index_js_ref_11_oneOf_1_1_node_modules_vue_loader_15_9_6_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_3_0_0_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_stylus_loader_3_0_2_stylus_loader_index_js_ref_11_oneOf_1_3_node_modules_cache_loader_2_0_1_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_15_9_6_vue_loader_lib_index_js_vue_loader_options_popover_vue_vue_type_style_index_0_lang_stylus___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("d5e9"); /* harmony import */ var _node_modules_mini_css_extract_plugin_0_8_2_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_1_0_1_css_loader_index_js_ref_11_oneOf_1_1_node_modules_vue_loader_15_9_6_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_3_0_0_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_stylus_loader_3_0_2_stylus_loader_index_js_ref_11_oneOf_1_3_node_modules_cache_loader_2_0_1_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_15_9_6_vue_loader_lib_index_js_vue_loader_options_popover_vue_vue_type_style_index_0_lang_stylus___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_0_8_2_mini_css_extract_plugin_dist_loader_js_ref_11_oneOf_1_0_node_modules_css_loader_1_0_1_css_loader_index_js_ref_11_oneOf_1_1_node_modules_vue_loader_15_9_6_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_3_0_0_postcss_loader_src_index_js_ref_11_oneOf_1_2_node_modules_stylus_loader_3_0_2_stylus_loader_index_js_ref_11_oneOf_1_3_node_modules_cache_loader_2_0_1_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_15_9_6_vue_loader_lib_index_js_vue_loader_options_popover_vue_vue_type_style_index_0_lang_stylus___WEBPACK_IMPORTED_MODULE_0__); /* unused harmony reexport * */ /***/ }), /***/ "112a": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // CONCATENATED MODULE: ./node_modules/_@vue_cli-service@3.12.1@@vue/cli-service/lib/commands/build/setPublicPath.js // This file is imported into lib/wc client bundles. if (typeof window !== 'undefined') { if (true) { __webpack_require__("e67d") } var setPublicPath_i if ((setPublicPath_i = window.document.currentScript) && (setPublicPath_i = setPublicPath_i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) { __webpack_require__.p = setPublicPath_i[1] // eslint-disable-line } } // Indicate to webpack that this file can be concatenated /* harmony default export */ var setPublicPath = (null); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.function.name.js var es6_function_name = __webpack_require__("a450"); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/web.dom.iterable.js var web_dom_iterable = __webpack_require__("1bc7"); // 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_); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.regexp.constructor.js var es6_regexp_constructor = __webpack_require__("3269"); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.array.iterator.js var es6_array_iterator = __webpack_require__("25ba"); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es7.object.values.js var es7_object_values = __webpack_require__("b3d7"); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.regexp.to-string.js var es6_regexp_to_string = __webpack_require__("4057"); // CONCATENATED MODULE: ./packages/utils/validate.js function isPlainObject(obj) { return Object.prototype.toString.call(obj) === "[object Object]"; } function isString(str) { return typeof str == "string"; } function isToday(time) { return new Date().getTime() - time < 86400000; } function isEmpty(obj) { if (!obj) return true; if (Array.isArray(obj) && obj.length == 0) return true; if (isPlainObject(obj) && Object.values(obj).length == 0) return true; return false; } function isUrl(str) { var reg = "^((https|http|ftp|rtsp|mms)?://)" + "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" + //ftp的user@ "(([0-9]{1,3}.){3}[0-9]{1,3}" + // IP形式的URL- 199.194.52.184 "|" + // 允许IP和DOMAIN(域名) "([0-9a-z_!~*'()-]+.)*" + // 域名- www. "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]." + // 二级域名 "[a-z]{2,6})" + // first level domain- .com or .museum "(:[0-9]{1,4})?" + // 端口- :80 "((/?)|" + // 如果没有文件名,则不需要斜杠 "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$"; return new RegExp(reg).test(str) ? true : false; } function isFunction(val) { return val && typeof val === "function"; } function isEng(val) { return /^[A-Za-z]+$/.test(val); } // EXTERNAL MODULE: ./node_modules/_regenerator-runtime@0.13.7@regenerator-runtime/runtime.js var runtime = __webpack_require__("6a61"); // CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/asyncToGenerator.js function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.object.keys.js var es6_object_keys = __webpack_require__("32ea"); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es7.array.includes.js var es7_array_includes = __webpack_require__("aa18"); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.string.includes.js var es6_string_includes = __webpack_require__("982e"); // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/popover.vue?vue&type=script&lang=js& var popoverCloseQueue = []; var triggerEvents = { hover: function hover(el) {}, focus: function focus(el) { var _this = this; el.addEventListener("focus", function (e) { _this.changeVisible(); }); el.addEventListener("blur", function (e) { _this.changeVisible(); }); }, click: function click(el) { var _this2 = this; el.addEventListener("click", function (e) { e.stopPropagation(); contextmenu.hide(); _this2.changeVisible(); }); }, contextmenu: function contextmenu(el) { var _this3 = this; el.addEventListener("contextmenu", function (e) { e.preventDefault(); _this3.changeVisible(); }); } }; /* harmony default export */ var popovervue_type_script_lang_js_ = ({ name: "LemonPopover", props: { trigger: { type: String, default: "click", validator: function validator(val) { return Object.keys(triggerEvents).includes(val); } } }, data: function data() { return { popoverStyle: {}, visible: false }; }, created: function created() { document.addEventListener("click", this._documentClickEvent); popoverCloseQueue.push(this.close); }, mounted: function mounted() { triggerEvents[this.trigger].call(this, this.$slots.default[0].elm); }, render: function render() { var h = arguments[0]; return h("span", { "style": "position:relative" }, [h("transition", { "attrs": { "name": "lemon-slide-top" } }, [this.visible && h("div", { "class": "lemon-popover", "ref": "popover", "style": this.popoverStyle, "on": { "click": function click(e) { return e.stopPropagation(); } } }, [h("div", { "class": "lemon-popover__content" }, [this.$slots.content]), h("div", { "class": "lemon-popover__arrow" })])]), this.$slots.default]); }, destroyed: function destroyed() { document.removeEventListener("click", this._documentClickEvent); }, computed: {}, watch: { visible: function () { var _visible = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(val) { var defaultEl, contentEl; return regeneratorRuntime.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: if (!val) { _context.next = 6; break; } _context.next = 3; return this.$nextTick(); case 3: defaultEl = this.$slots.default[0].elm; contentEl = this.$refs.popover; this.popoverStyle = { top: "-".concat(contentEl.offsetHeight + 10, "px"), left: "".concat(defaultEl.offsetWidth / 2 - contentEl.offsetWidth / 2, "px") }; case 6: case "end": return _context.stop(); } } }, _callee, this); })); function visible(_x) { return _visible.apply(this, arguments); } return visible; }() }, methods: { _documentClickEvent: function _documentClickEvent(e) { e.stopPropagation(); if (this.visible) this.close(); }, changeVisible: function changeVisible() { this.visible ? this.close() : this.open(); }, open: function open() { this.closeAll(); this.visible = true; }, closeAll: function closeAll() { popoverCloseQueue.forEach(function (callback) { return callback(); }); }, close: function close() { this.visible = false; } } }); // CONCATENATED MODULE: ./packages/components/popover.vue?vue&type=script&lang=js& /* harmony default export */ var components_popovervue_type_script_lang_js_ = (popovervue_type_script_lang_js_); // EXTERNAL MODULE: ./packages/components/popover.vue?vue&type=style&index=0&lang=stylus& var popovervue_type_style_index_0_lang_stylus_ = __webpack_require__("0e15"); // CONCATENATED MODULE: ./node_modules/_vue-loader@15.9.6@vue-loader/lib/runtime/componentNormalizer.js /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } } // CONCATENATED MODULE: ./packages/components/popover.vue var popover_render, staticRenderFns /* normalize component */ var popover_component = normalizeComponent( components_popovervue_type_script_lang_js_, popover_render, staticRenderFns, false, null, null, null ) /* harmony default export */ var popover = (popover_component.exports); // CONCATENATED MODULE: ./packages/directives/contextmenu.js var contextmenu_popover; var hidePopover = function hidePopover() { if (contextmenu_popover) contextmenu_popover.style.display = "none"; }; var showPopover = function showPopover() { if (contextmenu_popover) contextmenu_popover.style.display = "block"; }; document.addEventListener("click", function (e) { hidePopover(); }); /* harmony default export */ var contextmenu = ({ hide: hidePopover, bind: function bind(el, binding, vnode) { el.addEventListener("contextmenu", function (e) { if (isEmpty(binding.value) || !Array.isArray(binding.value)) return; e.preventDefault(); popover.methods.closeAll(); var component; var visibleItems = []; if (binding.modifiers.message) component = vnode.context;else if (binding.modifiers.contact) component = vnode.child; if (!contextmenu_popover) { contextmenu_popover = document.createElement("div"); contextmenu_popover.className = "lemon-contextmenu"; document.body.appendChild(contextmenu_popover); } contextmenu_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 ? "") : ""; return "
"); } return ""; }).join(""); contextmenu_popover.style.top = "".concat(e.pageY, "px"); contextmenu_popover.style.left = "".concat(e.pageX, "px"); contextmenu_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@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/tabs.vue?vue&type=script&lang=js& /* harmony default export */ var tabsvue_type_script_lang_js_ = ({ name: "LemonTabs", props: { activeIndex: String }, data: function data() { return { active: this.activeIndex }; }, mounted: function mounted() { if (!this.active) { this.active = this.$slots["tab-pane"][0].data.attrs.index; } }, render: function render() { var _this = this; var h = arguments[0]; var pane = []; var nav = []; this.$slots["tab-pane"].map(function (vnode) { var _vnode$data$attrs = vnode.data.attrs, tab = _vnode$data$attrs.tab, index = _vnode$data$attrs.index; pane.push(h("div", { "class": "lemon-tabs-content__pane", "directives": [{ name: "show", value: _this.active == index }] }, [vnode])); nav.push(h("div", { "class": ["lemon-tabs-nav__item", _this.active == index && "lemon-tabs-nav__item--active"], "on": { "click": function click() { return _this._handleNavClick(index); } } }, [tab])); }); return h("div", { "class": "lemon-tabs" }, [h("div", { "class": "lemon-tabs-content" }, [pane]), h("div", { "class": "lemon-tabs-nav" }, [nav])]); }, methods: { _handleNavClick: function _handleNavClick(index) { this.active = index; } } }); // CONCATENATED MODULE: ./packages/components/tabs.vue?vue&type=script&lang=js& /* harmony default export */ var components_tabsvue_type_script_lang_js_ = (tabsvue_type_script_lang_js_); // EXTERNAL MODULE: ./packages/components/tabs.vue?vue&type=style&index=0&lang=stylus& var tabsvue_type_style_index_0_lang_stylus_ = __webpack_require__("3423"); // CONCATENATED MODULE: ./packages/components/tabs.vue var tabs_render, tabs_staticRenderFns /* normalize component */ var tabs_component = normalizeComponent( components_tabsvue_type_script_lang_js_, tabs_render, tabs_staticRenderFns, false, null, null, null ) /* harmony default export */ var tabs = (tabs_component.exports); // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/button.vue?vue&type=script&lang=js& /* harmony default export */ var buttonvue_type_script_lang_js_ = ({ name: "LemonButton", props: { color: { type: String, default: "default" }, disabled: Boolean }, render: function render() { var h = arguments[0]; return h("button", { "class": ["lemon-button", "lemon-button--color-".concat(this.color)], "attrs": { "disabled": this.disabled, "type": "button" }, "on": { "click": this._handleClick } }, [this.$slots.default]); }, methods: { _handleClick: function _handleClick(e) { this.$emit("click", e); } } }); // CONCATENATED MODULE: ./packages/components/button.vue?vue&type=script&lang=js& /* harmony default export */ var components_buttonvue_type_script_lang_js_ = (buttonvue_type_script_lang_js_); // EXTERNAL MODULE: ./packages/components/button.vue?vue&type=style&index=0&lang=stylus& var buttonvue_type_style_index_0_lang_stylus_ = __webpack_require__("1e45"); // CONCATENATED MODULE: ./packages/components/button.vue var button_render, button_staticRenderFns /* normalize component */ var button_component = normalizeComponent( components_buttonvue_type_script_lang_js_, button_render, button_staticRenderFns, false, null, null, null ) /* harmony default export */ var components_button = (button_component.exports); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.number.constructor.js var es6_number_constructor = __webpack_require__("e680"); // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/badge.vue?vue&type=script&lang=js& /* harmony default export */ var badgevue_type_script_lang_js_ = ({ name: "LemonBadge", props: { count: [Number, Boolean], overflowCount: { type: Number, default: 99 } }, render: function render() { var h = arguments[0]; return h("span", { "class": "lemon-badge" }, [this.$slots.default, this.count !== 0 && this.count !== undefined && h("span", { "class": ["lemon-badge__label", this.isDot && "lemon-badge__label--dot"] }, [this.label])]); }, computed: { isDot: function isDot() { return this.count === true; }, label: function label() { if (this.isDot) return ""; return this.count > this.overflowCount ? "".concat(this.overflowCount, "+") : this.count; } }, methods: {} }); // CONCATENATED MODULE: ./packages/components/badge.vue?vue&type=script&lang=js& /* harmony default export */ var components_badgevue_type_script_lang_js_ = (badgevue_type_script_lang_js_); // EXTERNAL MODULE: ./packages/components/badge.vue?vue&type=style&index=0&lang=stylus& var badgevue_type_style_index_0_lang_stylus_ = __webpack_require__("dbdc"); // CONCATENATED MODULE: ./packages/components/badge.vue var badge_render, badge_staticRenderFns /* normalize component */ var badge_component = normalizeComponent( components_badgevue_type_script_lang_js_, badge_render, badge_staticRenderFns, false, null, null, null ) /* harmony default export */ var badge = (badge_component.exports); // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/avatar.vue?vue&type=script&lang=js& /* harmony default export */ var avatarvue_type_script_lang_js_ = ({ name: "LemonAvatar", inject: ["IMUI"], props: { src: String, icon: { type: String, default: "lemon-icon-people" }, circle: { type: Boolean, default: function _default() { return this.IMUI ? this.IMUI.avatarCricle : false; } }, size: { type: Number, default: 32 } }, data: function data() { return { imageFinishLoad: true }; }, render: function render() { var _this = this; var h = arguments[0]; return h("span", { "style": this.style, "class": ["lemon-avatar", { "lemon-avatar--circle": this.circle }], "on": { "click": function click(e) { return _this.$emit("click", e); } } }, [this.imageFinishLoad && h("i", { "class": this.icon }), h("img", { "attrs": { "src": this.src }, "on": { "load": this._handleLoad } })]); }, computed: { style: function style() { var size = "".concat(this.size, "px"); return { width: size, height: size, lineHeight: size, fontSize: "".concat(this.size / 2, "px") }; } }, methods: { _handleLoad: function _handleLoad() { this.imageFinishLoad = false; } } }); // CONCATENATED MODULE: ./packages/components/avatar.vue?vue&type=script&lang=js& /* harmony default export */ var components_avatarvue_type_script_lang_js_ = (avatarvue_type_script_lang_js_); // EXTERNAL MODULE: ./packages/components/avatar.vue?vue&type=style&index=0&lang=stylus& var avatarvue_type_style_index_0_lang_stylus_ = __webpack_require__("04f4"); // CONCATENATED MODULE: ./packages/components/avatar.vue var avatar_render, avatar_staticRenderFns /* normalize component */ var avatar_component = normalizeComponent( components_avatarvue_type_script_lang_js_, avatar_render, avatar_staticRenderFns, false, null, null, null ) /* harmony default export */ var avatar = (avatar_component.exports); // EXTERNAL MODULE: ./node_modules/_@vue_babel-helper-vue-jsx-merge-props@1.2.1@@vue/babel-helper-vue-jsx-merge-props/dist/helper.js var helper = __webpack_require__("4c02"); var helper_default = /*#__PURE__*/__webpack_require__.n(helper); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es7.object.get-own-property-descriptors.js var es7_object_get_own_property_descriptors = __webpack_require__("ac67"); // CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/defineProperty.js function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.regexp.replace.js var es6_regexp_replace = __webpack_require__("8dee"); // CONCATENATED MODULE: ./packages/utils/index.js function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } /** * 使用某个组件上的作用域插槽 * @param {VueComponent} inject * @param {String} slotName * @param {Node} defaultElement * @param {Object} props */ function useScopedSlot(slot, def, props) { return slot ? slot(props) : def; } function padZero(val) { return val < 10 ? "0".concat(val) : val; } function hoursTimeFormat(t) { var date = new Date(t); var nowDate = new Date(); var Y = function Y(t) { return t.getFullYear(); }; var MD = function MD(t) { return "".concat(t.getMonth() + 1, "-").concat(t.getDate()); }; var dateY = Y(date); var nowDateY = Y(nowDate); var format; if (dateY !== nowDateY) { format = "y年m月d日 h:i"; } else if ("".concat(dateY, "-").concat(MD(date)) === "".concat(nowDateY, "-").concat(MD(nowDate))) { format = "h:i"; } else { format = "m月d日 h:i"; } return timeFormat(t, format); } function timeFormat(t, format) { if (!format) format = "y-m-d h:i:s"; if (t) t = new Date(t);else t = new Date(); var formatArr = [t.getFullYear().toString(), padZero((t.getMonth() + 1).toString()), padZero(t.getDate().toString()), padZero(t.getHours().toString()), padZero(t.getMinutes().toString()), padZero(t.getSeconds().toString())]; var reg = "ymdhis"; for (var i = 0; i < formatArr.length; i++) { format = format.replace(reg.charAt(i), formatArr[i]); } return format; } function funCall(event, callback) { if (isFunction(event)) { event(function () { callback(); }); } else { callback(); } } /** * 获取数组相交的值组成新数组 * @param {Array} a * @param {Array} b */ function arrayIntersect(a, b) { return a.filter(function (x) { return b.includes(x); }); } //清除字符串内的所有HTML标签 function clearHtml(str) { return str.replace(/<.*?>/ig, ""); } //清除字符串内的所有HTML标签,除了IMG function clearHtmlExcludeImg(str) { return str.replace(/<(?!img).*?>/ig, ""); } function error(text) { throw new Error(text); } function cloneDeep(obj) { var newobj = _objectSpread({}, obj); for (var key in newobj) { var val = newobj[key]; if (isPlainObject(val)) { newobj[key] = cloneDeep(val); } } return newobj; } function mergeDeep(o1, o2) { for (var key in o2) { if (isPlainObject(o1[key])) { o1[key] = mergeDeep(o1[key], o2[key]); } else { o1[key] = o2[key]; } } return o1; } function formatByte(value) { if (null == value || value == "") { return "0 Bytes"; } var unitArr = ["B", "K", "M", "G", "T", "P", "E", "Z", "Y"]; var index = 0; var srcsize = parseFloat(value); index = Math.floor(Math.log(srcsize) / Math.log(1024)); var size = srcsize / Math.pow(1024, index); size = parseFloat(size.toFixed(2)); return size + unitArr[index]; } function generateUUID() { var d = new Date().getTime(); if (window.performance && typeof window.performance.now === "function") { d += performance.now(); //use high-precision timer if available } var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { var r = (d + Math.random() * 16) % 16 | 0; d = Math.floor(d / 16); return (c == "x" ? r : r & 0x3 | 0x8).toString(16); }); return uuid; } // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/contact.vue?vue&type=script&lang=js& /* 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 {}; }, props: { contact: Object, simple: Boolean, timeFormat: { type: Function, default: function _default(val) { return timeFormat(val, isToday(val) ? "h:i" : "y/m/d"); } } }, render: function render() { var _this = this; var h = arguments[0]; return h("div", { "class": ["lemon-contact", { "lemon-contact--name-center": this.simple }], "on": { "click": function click(e) { return _this._handleClick(e, _this.contact); } } }, [useScopedSlot(this.$scopedSlots.default, this._renderInner(), this.contact)]); }, created: function created() {}, mounted: function mounted() {}, computed: {}, watch: {}, methods: { _renderInner: function _renderInner() { var h = this.$createElement; var contact = this.contact; return [h("lemon-badge", { "attrs": { "count": !this.simple ? contact.unread : 0 }, "class": "lemon-contact__avatar" }, [h("lemon-avatar", { "attrs": { "size": 40, "src": contact.avatar } })]), h("div", { "class": "lemon-contact__inner" }, [h("p", { "class": "lemon-contact__label" }, [h("span", { "class": "lemon-contact__name" }, [contact.displayName]), !this.simple && h("span", { "class": "lemon-contact__time" }, [this.timeFormat(contact.lastSendTime)])]), !this.simple && h("p", { "class": "lemon-contact__content" }, [isString(contact.lastContent) ? h("span", helper_default()([{}, { "domProps": { innerHTML: contact.lastContent } }])) : contact.lastContent])])]; }, _handleClick: function _handleClick(e, data) { this.$emit("click", data); } } }); // CONCATENATED MODULE: ./packages/components/contact.vue?vue&type=script&lang=js& /* harmony default export */ var components_contactvue_type_script_lang_js_ = (contactvue_type_script_lang_js_); // EXTERNAL MODULE: ./packages/components/contact.vue?vue&type=style&index=0&lang=stylus& var contactvue_type_style_index_0_lang_stylus_ = __webpack_require__("909e"); // CONCATENATED MODULE: ./packages/components/contact.vue var contact_render, contact_staticRenderFns /* normalize component */ var contact_component = normalizeComponent( components_contactvue_type_script_lang_js_, contact_render, contact_staticRenderFns, false, null, null, null ) /* harmony default export */ var components_contact = (contact_component.exports); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.string.iterator.js var es6_string_iterator = __webpack_require__("0c84"); // EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.array.from.js var es6_array_from = __webpack_require__("2843"); // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/editor.vue?vue&type=script&lang=js& function editorvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function editorvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { editorvue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { editorvue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var exec = function exec(val) { var command = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "insertHTML"; document.execCommand(command, false, val); }; var selection = window.getSelection(); var lastSelectionRange; var emojiData = []; var isInitTool = false; /* harmony default export */ var editorvue_type_script_lang_js_ = ({ name: "LemonEditor", inject: { IMUI: { from: "IMUI", default: function _default() { return this; } } }, components: {}, props: { tools: { type: Array, default: function _default() { return []; } }, sendText: { type: String, default: "发 送" }, sendKey: { type: Function, default: function _default(e) { return e.keyCode == 13 && e.ctrlKey === true; } } }, data: function data() { this.clipboardBlob = null; return { //剪切板图片URL clipboardUrl: "", submitDisabled: true, proxyTools: [], accept: "" }; }, created: function created() { var _this = this; if (this.tools && this.tools.length > 0) { this.initTools(this.tools); } else { this.initTools([{ name: "emoji" }, { name: "uploadFile" }, { name: "uploadImage" }]); } this.IMUI.$on("change-contact", function () { _this.closeClipboardImage(); }); }, render: function render() { var _this2 = this; var h = arguments[0]; var toolLeft = []; var toolRight = []; this.proxyTools.forEach(function (_ref) { var name = _ref.name, title = _ref.title, render = _ref.render, click = _ref.click, isRight = _ref.isRight; click = click || new Function(); var classes = ["lemon-editor__tool-item", { "lemon-editor__tool-item--right": isRight }]; var node; if (name == "emoji") { node = emojiData.length == 0 ? "" : h("lemon-popover", { "class": "lemon-editor__emoji" }, [h("template", { "slot": "content" }, [_this2._renderEmojiTabs()]), h("div", { "class": classes, "attrs": { "title": title } }, [render()])]); } else { node = h("div", { "class": classes, "on": { "click": click }, "attrs": { "title": title } }, [render()]); } if (isRight) { toolRight.push(node); } else { toolLeft.push(node); } }); return h("div", { "class": "lemon-editor" }, [this.clipboardUrl && h("div", { "class": "lemon-editor__clipboard-image" }, [h("img", { "attrs": { "src": this.clipboardUrl } }), h("div", [h("lemon-button", { "style": { marginRight: "10px" }, "on": { "click": this.closeClipboardImage }, "attrs": { "color": "grey" } }, ["\u53D6\u6D88"]), h("lemon-button", { "on": { "click": this.sendClipboardImage } }, ["\u53D1\u9001\u56FE\u7247"])])]), h("input", { "style": "display:none", "attrs": { "type": "file", "multiple": "multiple", "accept": this.accept }, "ref": "fileInput", "on": { "change": this._handleChangeFile } }), h("div", { "class": "lemon-editor__tool" }, [h("div", { "class": "lemon-editor__tool-left" }, [toolLeft]), h("div", { "class": "lemon-editor__tool-right" }, [toolRight])]), h("div", { "class": "lemon-editor__inner" }, [h("div", { "class": "lemon-editor__input", "ref": "textarea", "attrs": { "contenteditable": "true", "spellcheck": "false" }, "on": { "keyup": this._handleKeyup, "keydown": this._handleKeydown, "paste": this._handlePaste, "click": this._handleClick } })]), h("div", { "class": "lemon-editor__footer" }, [h("div", { "class": "lemon-editor__tip" }, [useScopedSlot(this.IMUI.$scopedSlots["editor-footer"], "使用 ctrl + enter 快捷发送消息")]), h("div", { "class": "lemon-editor__submit" }, [h("lemon-button", { "attrs": { "disabled": this.submitDisabled }, "on": { "click": this._handleSend } }, [this.sendText])])])]); }, methods: { closeClipboardImage: function closeClipboardImage() { this.clipboardUrl = ""; this.clipboardBlob = null; }, sendClipboardImage: function sendClipboardImage() { if (!this.clipboardBlob) return; this.$emit("upload", this.clipboardBlob); this.closeClipboardImage(); }, /** * 初始化工具栏 */ initTools: function initTools(data) { var _this3 = this; var h = this.$createElement; if (!data) return; var defaultTools = [{ name: "emoji", title: "表情", click: null, render: function render(menu) { return h("i", { "class": "lemon-icon-emoji" }); } }, { name: "uploadFile", title: "文件上传", click: function click() { return _this3.selectFile("*"); }, render: function render(menu) { return h("i", { "class": "lemon-icon-folder" }); } }, { name: "uploadImage", title: "图片上传", click: function click() { return _this3.selectFile("image/*"); }, render: function render(menu) { return h("i", { "class": "lemon-icon-image" }); } }]; var tools = []; if (Array.isArray(data)) { var indexMap = { emoji: 0, uploadFile: 1, uploadImage: 2 }; var indexKeys = Object.keys(indexMap); tools = data.map(function (item) { if (indexKeys.includes(item.name)) { return editorvue_type_script_lang_js_objectSpread(editorvue_type_script_lang_js_objectSpread({}, defaultTools[indexMap[item.name]]), item); } return item; }); } else { tools = defaultTools; } this.proxyTools = tools; }, _saveLastRange: function _saveLastRange() { lastSelectionRange = selection.getRangeAt(0); }, _focusLastRange: function _focusLastRange() { this.$refs.textarea.focus(); if (lastSelectionRange) { selection.removeAllRanges(); selection.addRange(lastSelectionRange); } }, _handleClick: function _handleClick() { this._saveLastRange(); }, _renderEmojiTabs: function _renderEmojiTabs() { var _this4 = this; var h = this.$createElement; var renderImageGrid = function renderImageGrid(items) { return items.map(function (item) { return h("img", { "attrs": { "src": item.src, "title": item.title }, "class": "lemon-editor__emoji-item", "on": { "click": function click() { return _this4._handleSelectEmoji(item); } } }); }); }; if (emojiData[0].label) { var nodes = emojiData.map(function (item, index) { return h("div", { "slot": "tab-pane", "attrs": { "index": index, "tab": item.label } }, [renderImageGrid(item.children)]); }); return h("lemon-tabs", { "style": "width: 412px" }, [nodes]); } else { return h("div", { "class": "lemon-tabs-content", "style": "width:406px" }, [renderImageGrid(emojiData)]); } }, _handleSelectEmoji: function _handleSelectEmoji(item) { this._focusLastRange(); exec("/g, "\r\n")
// .replace(/<\/div>|<\/p>/g, "")
// );
return this.IMUI.emojiImageToName(this.$refs.textarea.innerHTML);
},
_checkSubmitDisabled: function _checkSubmitDisabled() {
this.submitDisabled = !clearHtmlExcludeImg(this.$refs.textarea.innerHTML.trim());
},
_handleSend: function _handleSend(e) {
var text = this.getFormatValue();
this.$emit("send", text);
this.clear();
this._checkSubmitDisabled();
},
_handleChangeFile: function _handleChangeFile(e) {
var _this5 = this;
var fileInput = this.$refs.fileInput;
Array.from(fileInput.files).forEach(function (file) {
_this5.$emit("upload", file);
});
fileInput.value = "";
},
clear: function clear() {
this.$refs.textarea.innerHTML = "";
},
initEmoji: function initEmoji(data) {
emojiData = data;
this.$forceUpdate();
},
setValue: function setValue(val) {
this.$refs.textarea.innerHTML = this.IMUI.emojiNameToImage(val);
this._checkSubmitDisabled();
}
}
});
// CONCATENATED MODULE: ./packages/components/editor.vue?vue&type=script&lang=js&
/* harmony default export */ var components_editorvue_type_script_lang_js_ = (editorvue_type_script_lang_js_);
// EXTERNAL MODULE: ./packages/components/editor.vue?vue&type=style&index=0&lang=stylus&
var editorvue_type_style_index_0_lang_stylus_ = __webpack_require__("49c2");
// CONCATENATED MODULE: ./packages/components/editor.vue
var editor_render, editor_staticRenderFns
/* normalize component */
var editor_component = normalizeComponent(
components_editorvue_type_script_lang_js_,
editor_render,
editor_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var editor = (editor_component.exports);
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/messages.vue?vue&type=script&lang=js&
/* harmony default export */ var messagesvue_type_script_lang_js_ = ({
name: "LemonMessages",
components: {},
props: {
//是否隐藏消息发送人昵称
hideName: Boolean,
//是否隐藏显示消息时间
hideTime: Boolean,
reverseUserId: String,
timeRange: {
type: Number,
default: 1
},
timeFormat: {
type: Function,
default: function _default(val) {
return hoursTimeFormat(val);
}
},
messages: {
type: Array,
default: function _default() {
return [];
}
}
},
data: function data() {
return {
_loading: false,
_loadend: false
};
},
render: function render() {
var _this = this;
var h = arguments[0];
return h("div", {
"class": "lemon-messages",
"ref": "wrap",
"on": {
"scroll": this._handleScroll
}
}, [h("div", {
"class": ["lemon-messages__load", "lemon-messages__load--".concat(this._loadend ? "end" : "ing")]
}, [this._loadend ? this._renderLoadEnd() : this._renderLoading()]), this.messages.map(function (message, index) {
var node = [];
var tagName = "lemon-message-".concat(message.type);
var prev = _this.messages[index - 1];
if (prev && _this.msecRange && message.sendTime - prev.sendTime > _this.msecRange) {
node.push(h("lemon-message-event", helper_default()([{}, {
"attrs": {
message: {
id: "__time__",
type: "event",
content: hoursTimeFormat(message.sendTime)
}
}
}])));
}
var attrs;
if (message.type == "event") {
attrs = {
message: message
};
} else {
attrs = {
timeFormat: _this.timeFormat,
message: message,
reverse: _this.reverseUserId == message.fromUser.id,
hideTime: _this.hideTime,
hideName: _this.hideName
};
}
node.push(h(tagName, helper_default()([{
"ref": "message",
"refInFor": true
}, {
"attrs": attrs
}])));
return node;
})]);
},
computed: {
msecRange: function msecRange() {
return this.timeRange * 1000 * 60;
}
},
watch: {},
methods: {
_renderLoading: function _renderLoading() {
var h = this.$createElement;
return h("i", {
"class": "lemon-icon-loading lemonani-spin"
});
},
_renderLoadEnd: function _renderLoadEnd() {
var h = this.$createElement;
return h("span", ["\u6682\u65E0\u66F4\u591A\u6D88\u606F"]);
},
loaded: function loaded() {
this._loadend = true;
this.$forceUpdate();
},
resetLoadState: function resetLoadState() {
this._loading = false;
this._loadend = false;
},
_handleScroll: function () {
var _handleScroll2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(e) {
var _this2 = this;
var target, hst;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
target = e.target;
contextmenu.hide();
if (!(target.scrollTop == 0 && this._loading == false && this._loadend == false)) {
_context2.next = 8;
break;
}
this._loading = true;
_context2.next = 6;
return this.$nextTick();
case 6:
hst = target.scrollHeight;
this.$emit("reach-top", /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(isEnd) {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return _this2.$nextTick();
case 2:
target.scrollTop = target.scrollHeight - hst;
_this2._loading = false;
_this2._loadend = !!isEnd;
case 5:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return function (_x2) {
return _ref.apply(this, arguments);
};
}());
case 8:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function _handleScroll(_x) {
return _handleScroll2.apply(this, arguments);
}
return _handleScroll;
}(),
scrollToBottom: function () {
var _scrollToBottom = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
var wrap;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return this.$nextTick();
case 2:
wrap = this.$refs.wrap;
if (wrap) {
wrap.scrollTop = wrap.scrollHeight;
}
case 4:
case "end":
return _context3.stop();
}
}
}, _callee3, this);
}));
function scrollToBottom() {
return _scrollToBottom.apply(this, arguments);
}
return scrollToBottom;
}()
},
created: function created() {},
mounted: function mounted() {}
});
// CONCATENATED MODULE: ./packages/components/messages.vue?vue&type=script&lang=js&
/* harmony default export */ var components_messagesvue_type_script_lang_js_ = (messagesvue_type_script_lang_js_);
// EXTERNAL MODULE: ./packages/components/messages.vue?vue&type=style&index=0&lang=stylus&
var messagesvue_type_style_index_0_lang_stylus_ = __webpack_require__("436f");
// CONCATENATED MODULE: ./packages/components/messages.vue
var messages_render, messages_staticRenderFns
/* normalize component */
var messages_component = normalizeComponent(
components_messagesvue_type_script_lang_js_,
messages_render,
messages_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var messages = (messages_component.exports);
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/message/basic.vue?vue&type=script&lang=js&
/* harmony default export */ var basicvue_type_script_lang_js_ = ({
name: "lemonMessageBasic",
inject: {
IMUI: {
from: "IMUI",
default: function _default() {
return this;
}
}
},
props: {
contextmenu: Array,
message: {
type: Object,
default: function _default() {
return {};
}
},
timeFormat: {
type: Function,
default: function _default() {
return "";
}
},
reverse: Boolean,
hideName: Boolean,
hideTime: Boolean
},
data: function data() {
return {};
},
render: function render() {
var _this = this;
var h = arguments[0];
var _this$message = this.message,
fromUser = _this$message.fromUser,
status = _this$message.status,
sendTime = _this$message.sendTime;
return h("div", {
"class": ["lemon-message", "lemon-message--status-".concat(status), {
"lemon-message--reverse": this.reverse,
"lemon-message--hide-name": this.hideName
}]
}, [h("div", {
"class": "lemon-message__avatar"
}, [h("lemon-avatar", {
"attrs": {
"size": 36,
"shape": "square",
"src": fromUser.avatar
},
"on": {
"click": function click(e) {
_this._emitClick(e, "avatar");
}
}
})]), h("div", {
"class": "lemon-message__inner"
}, [h("div", {
"class": "lemon-message__title"
}, [h("span", {
"on": {
"click": function click(e) {
_this._emitClick(e, "displayName");
}
}
}, [fromUser.displayName]), this.hideTime == true && h("span", {
"class": "lemon-message__time",
"on": {
"click": function click(e) {
_this._emitClick(e, "sendTime");
}
}
}, [this.timeFormat(sendTime)])]), h("div", {
"class": "lemon-message__content-flex"
}, [h("div", {
"directives": [{
name: "lemon-contextmenu",
value: this.IMUI.contextmenu,
modifiers: {
"message": true
}
}],
"class": "lemon-message__content",
"on": {
"click": function click(e) {
_this._emitClick(e, "content");
}
}
}, [useScopedSlot(this.$scopedSlots["content"], null, this.message)]), h("div", {
"class": "lemon-message__content-after"
}, [useScopedSlot(this.IMUI.$scopedSlots["message-after"], null, this.message)]), h("div", {
"class": "lemon-message__status",
"on": {
"click": function click(e) {
_this._emitClick(e, "status");
}
}
}, [h("i", {
"class": "lemon-icon-loading lemonani-spin"
}), h("i", {
"class": "lemon-icon-prompt",
"attrs": {
"title": "重发消息"
},
"style": {
color: "#ff2525",
cursor: "pointer"
}
})])])])]);
},
created: function created() {},
mounted: function mounted() {},
computed: {},
watch: {},
methods: {
_emitClick: function _emitClick(e, key) {
this.IMUI.$emit("message-click", e, key, this.message, this.IMUI);
}
}
});
// CONCATENATED MODULE: ./packages/components/message/basic.vue?vue&type=script&lang=js&
/* harmony default export */ var message_basicvue_type_script_lang_js_ = (basicvue_type_script_lang_js_);
// EXTERNAL MODULE: ./packages/components/message/basic.vue?vue&type=style&index=0&lang=stylus&
var basicvue_type_style_index_0_lang_stylus_ = __webpack_require__("fbd1");
// CONCATENATED MODULE: ./packages/components/message/basic.vue
var basic_render, basic_staticRenderFns
/* normalize component */
var basic_component = normalizeComponent(
message_basicvue_type_script_lang_js_,
basic_render,
basic_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var basic = (basic_component.exports);
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/message/text.vue?vue&type=script&lang=js&
function textvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function textvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { textvue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { textvue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/* harmony default export */ var textvue_type_script_lang_js_ = ({
name: "lemonMessageText",
inheritAttrs: false,
inject: ["IMUI"],
render: function render() {
var _this = this;
var h = arguments[0];
return h("lemon-message-basic", helper_default()([{
"class": "lemon-message-text"
}, {
"props": textvue_type_script_lang_js_objectSpread({}, this.$attrs)
}, {
"scopedSlots": {
content: function content(props) {
var content = _this.IMUI.emojiNameToImage(props.content);
return h("span", helper_default()([{}, {
"domProps": {
innerHTML: content
}
}]));
}
}
}]));
}
});
// CONCATENATED MODULE: ./packages/components/message/text.vue?vue&type=script&lang=js&
/* harmony default export */ var message_textvue_type_script_lang_js_ = (textvue_type_script_lang_js_);
// EXTERNAL MODULE: ./packages/components/message/text.vue?vue&type=style&index=0&lang=stylus&
var textvue_type_style_index_0_lang_stylus_ = __webpack_require__("16636");
// CONCATENATED MODULE: ./packages/components/message/text.vue
var text_render, text_staticRenderFns
/* normalize component */
var text_component = normalizeComponent(
message_textvue_type_script_lang_js_,
text_render,
text_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var message_text = (text_component.exports);
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/message/image.vue?vue&type=script&lang=js&
function imagevue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function imagevue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { imagevue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { imagevue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/* harmony default export */ var imagevue_type_script_lang_js_ = ({
name: "lemonMessageImage",
inheritAttrs: false,
render: function render() {
var h = arguments[0];
return h("lemon-message-basic", helper_default()([{
"class": "lemon-message-image"
}, {
"props": imagevue_type_script_lang_js_objectSpread({}, this.$attrs)
}, {
"scopedSlots": {
content: function content(props) {
return h("img", {
"attrs": {
"src": props.content
}
});
}
}
}]));
}
});
// CONCATENATED MODULE: ./packages/components/message/image.vue?vue&type=script&lang=js&
/* harmony default export */ var message_imagevue_type_script_lang_js_ = (imagevue_type_script_lang_js_);
// EXTERNAL MODULE: ./packages/components/message/image.vue?vue&type=style&index=0&lang=stylus&
var imagevue_type_style_index_0_lang_stylus_ = __webpack_require__("4d21");
// CONCATENATED MODULE: ./packages/components/message/image.vue
var image_render, image_staticRenderFns
/* normalize component */
var image_component = normalizeComponent(
message_imagevue_type_script_lang_js_,
image_render,
image_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var message_image = (image_component.exports);
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/message/file.vue?vue&type=script&lang=js&
function filevue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function filevue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { filevue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { filevue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/* harmony default export */ var filevue_type_script_lang_js_ = ({
name: "lemonMessageFile",
inheritAttrs: false,
render: function render() {
var h = arguments[0];
return h("lemon-message-basic", helper_default()([{
"class": "lemon-message-file"
}, {
"props": filevue_type_script_lang_js_objectSpread({}, this.$attrs)
}, {
"scopedSlots": {
content: function content(props) {
return [h("div", {
"class": "lemon-message-file__inner"
}, [h("p", {
"class": "lemon-message-file__name"
}, [props.fileName]), h("p", {
"class": "lemon-message-file__byte"
}, [formatByte(props.fileSize)])]), h("div", {
"class": "lemon-message-file__sfx"
}, [h("i", {
"class": "lemon-icon-attah"
})])];
}
}
}]));
}
});
// CONCATENATED MODULE: ./packages/components/message/file.vue?vue&type=script&lang=js&
/* harmony default export */ var message_filevue_type_script_lang_js_ = (filevue_type_script_lang_js_);
// EXTERNAL MODULE: ./packages/components/message/file.vue?vue&type=style&index=0&lang=stylus&
var filevue_type_style_index_0_lang_stylus_ = __webpack_require__("cfab");
// CONCATENATED MODULE: ./packages/components/message/file.vue
var file_render, file_staticRenderFns
/* normalize component */
var file_component = normalizeComponent(
message_filevue_type_script_lang_js_,
file_render,
file_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var file = (file_component.exports);
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/message/event.vue?vue&type=script&lang=js&
/* harmony default export */ var eventvue_type_script_lang_js_ = ({
name: "lemonMessageEvent",
inheritAttrs: false,
inject: ["IMUI"],
render: function render() {
var _this = this;
var h = arguments[0];
var content = this.$attrs.message.content;
return h("div", {
"class": "lemon-message lemon-message-event"
}, [h("span", {
"class": "lemon-message-event__content",
"on": {
"click": function click(e) {
return _this._emitClick(e, "content");
}
}
}, [content])]);
},
methods: {
_emitClick: function _emitClick(e, key) {
this.IMUI.$emit("message-click", e, key, this.$attrs.message, this.IMUI);
}
}
});
// CONCATENATED MODULE: ./packages/components/message/event.vue?vue&type=script&lang=js&
/* harmony default export */ var message_eventvue_type_script_lang_js_ = (eventvue_type_script_lang_js_);
// EXTERNAL MODULE: ./packages/components/message/event.vue?vue&type=style&index=0&lang=stylus&
var eventvue_type_style_index_0_lang_stylus_ = __webpack_require__("ed4b");
// CONCATENATED MODULE: ./packages/components/message/event.vue
var event_render, event_staticRenderFns
/* normalize component */
var event_component = normalizeComponent(
message_eventvue_type_script_lang_js_,
event_render,
event_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var message_event = (event_component.exports);
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.array.find-index.js
var es6_array_find_index = __webpack_require__("a7e5");
// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/arrayLikeToArray.js
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/arrayWithoutHoles.js
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/iterableToArray.js
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
}
// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/unsupportedIterableToArray.js
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/nonIterableSpread.js
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/toConsumableArray.js
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.string.starts-with.js
var es6_string_starts_with = __webpack_require__("d31c");
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.object.assign.js
var es6_object_assign = __webpack_require__("6ba0");
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.array.sort.js
var es6_array_sort = __webpack_require__("3441");
// EXTERNAL MODULE: ./node_modules/_core-js@2.6.12@core-js/modules/es6.array.find.js
var es6_array_find = __webpack_require__("e5b4");
// CONCATENATED MODULE: ./packages/utils/constant.js
var EMIT_AVATAR_CLICK = "avatar-click";
var DEFAULT_MENU_LASTMESSAGES = "messages";
var DEFAULT_MENU_CONTACTS = "contacts";
var DEFAULT_MENUS = [DEFAULT_MENU_LASTMESSAGES, DEFAULT_MENU_CONTACTS];
/**
* 聊天消息类型
*/
var MESSAGE_TYPE = ["voice", "file", "video", "image", "text"];
/**
* 聊天消息状态
*/
var MESSAGE_STATUS = ["going", "succeed", "failed"];
var CONTACT_TYPE = ["many", "single"];
// CONCATENATED MODULE: ./packages/lastContentRender.js
/* harmony default export */ var packages_lastContentRender = ({
file: function file(message) {
return "[文件]";
},
image: function image(message) {
return "[图片]";
},
text: function text(message) {
return this.emojiNameToImage(clearHtml(message.content));
},
event: function event(message) {
return '[通知]';
}
});
// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/classCallCheck.js
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
// CONCATENATED MODULE: ./node_modules/_@babel_runtime@7.12.5@@babel/runtime/helpers/esm/createClass.js
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
// CONCATENATED MODULE: ./packages/utils/cache/memory.js
var memory_MemoryCache = /*#__PURE__*/function () {
function MemoryCache() {
_classCallCheck(this, MemoryCache);
this.table = {};
}
_createClass(MemoryCache, [{
key: "get",
value: function get(key) {
return key ? this.table[key] : this.table;
}
}, {
key: "set",
value: function set(key, val) {
this.table[key] = val;
} // setOnly(key, val) {
// if (!this.has(key)) this.set(key, val);
// }
}, {
key: "remove",
value: function remove(key) {
if (key) {
delete this.table[key];
} else {
this.table = {};
}
}
}, {
key: "has",
value: function has(key) {
return !!this.table[key];
}
}]);
return MemoryCache;
}();
// CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.2@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader/lib??vue-loader-options!./packages/components/index.vue?vue&type=script&lang=js&
function componentsvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function componentsvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { componentsvue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { componentsvue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var allMessages = {};
var emojiMap = {};
var renderDrawerContent = function renderDrawerContent() {};
/* harmony default export */ var componentsvue_type_script_lang_js_ = ({
name: "LemonImui",
provide: function provide() {
return {
IMUI: this
};
},
props: {
width: {
type: String,
default: "850px"
},
height: {
type: String,
default: "580px"
},
theme: {
type: String,
default: "default"
},
simple: {
type: Boolean,
default: false
},
/**
* 消息时间格式化规则
*/
messageTimeFormat: Function,
/**
* 联系人最新消息时间格式化规则
*/
contactTimeFormat: Function,
/**
* 初始化时是否隐藏抽屉
*/
hideDrawer: {
type: Boolean,
default: true
},
/**
* 是否隐藏导航按钮上的头像
*/
hideMenuAvatar: Boolean,
hideMenu: Boolean,
/**
* 是否隐藏消息列表内的联系人名字
*/
hideMessageName: Boolean,
/**
* 是否隐藏消息列表内的发送时间
*/
hideMessageTime: Boolean,
sendKey: Function,
sendText: String,
contextmenu: Array,
contactContextmenu: Array,
avatarCricle: Boolean,
user: {
type: Object,
default: function _default() {
return {};
}
}
},
data: function data() {
this.CacheContactContainer = new memory_MemoryCache();
this.CacheMenuContainer = new memory_MemoryCache();
this.CacheMessageLoaded = new memory_MemoryCache();
this.CacheDraft = new memory_MemoryCache();
return {
drawerVisible: !this.hideDrawer,
currentContactId: null,
currentMessages: [],
activeSidebar: DEFAULT_MENU_LASTMESSAGES,
contacts: [],
menus: [],
editorTools: []
};
},
render: function render() {
return this._renderWrapper([this._renderMenu(), this._renderSidebarMessage(), this._renderSidebarContact(), this._renderContainer(), this._renderDrawer()]);
},
created: function created() {
this.initMenus();
},
mounted: function () {
var _mounted = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return this.$nextTick();
case 2:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
function mounted() {
return _mounted.apply(this, arguments);
}
return mounted;
}(),
computed: {
currentContact: function currentContact() {
var _this = this;
return this.contacts.find(function (item) {
return item.id == _this.currentContactId;
}) || {};
},
currentMenu: function currentMenu() {
var _this2 = this;
return this.menus.find(function (item) {
return item.name == _this2.activeSidebar;
}) || {};
},
currentIsDefSidebar: function currentIsDefSidebar() {
return DEFAULT_MENUS.includes(this.activeSidebar);
},
lastMessages: function lastMessages() {
var data = this.contacts.filter(function (item) {
return !isEmpty(item.lastContent);
});
data.sort(function (a1, a2) {
return a2.lastSendTime - a1.lastSendTime;
});
return data;
}
},
watch: {
activeSidebar: function activeSidebar() {}
},
methods: {
_menuIsContacts: function _menuIsContacts() {
return this.activeSidebar == DEFAULT_MENU_CONTACTS;
},
_menuIsMessages: function _menuIsMessages() {
return this.activeSidebar == DEFAULT_MENU_LASTMESSAGES;
},
_createMessage: function _createMessage(message) {
return componentsvue_type_script_lang_js_objectSpread(componentsvue_type_script_lang_js_objectSpread({}, {
id: generateUUID(),
type: "text",
status: "going",
sendTime: new Date().getTime(),
toContactId: this.currentContactId,
fromUser: componentsvue_type_script_lang_js_objectSpread({}, this.user)
}), message);
},
/**
* 新增一条消息
*/
appendMessage: function appendMessage(message) {
var scrollToBottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (allMessages[message.toContactId] === undefined) {
this.updateContact({
id: message.toContactId,
unread: "+1",
lastSendTime: message.sendTime,
lastContent: this.lastContentRender(message)
});
} else {
this._addMessage(message, message.toContactId, 1);
var updateContact = {
id: message.toContactId,
lastContent: this.lastContentRender(message),
lastSendTime: message.sendTime
};
if (message.toContactId == this.currentContactId) {
if (scrollToBottom == true) {
this.messageViewToBottom();
}
this.CacheDraft.remove(message.toContactId);
} else {
updateContact.unread = "+1";
}
this.updateContact(updateContact);
}
},
_emitSend: function _emitSend(message, next, file) {
var _this3 = this;
this.$emit("send", message, function () {
var replaceMessage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
status: "succeed"
};
next();
_this3.updateMessage(Object.assign(message, replaceMessage));
}, file);
},
_handleSend: function _handleSend(text) {
var _this4 = this;
var message = this._createMessage({
content: text
});
this.appendMessage(message, true);
this._emitSend(message, function () {
_this4.updateContact({
id: message.toContactId,
lastContent: _this4.lastContentRender(message),
lastSendTime: message.sendTime
});
_this4.CacheDraft.remove(message.toContactId);
});
},
_handleUpload: function _handleUpload(file) {
var _this5 = this;
var imageTypes = ["image/gif", "image/jpeg", "image/png"];
var joinMessage;
if (imageTypes.includes(file.type)) {
joinMessage = {
type: "image",
content: URL.createObjectURL(file)
};
} else {
joinMessage = {
type: "file",
fileSize: file.size,
fileName: file.name,
content: ""
};
}
var message = this._createMessage(joinMessage);
this.appendMessage(message, true);
this._emitSend(message, function () {
_this5.updateContact({
id: message.toContactId,
lastContent: _this5.lastContentRender(message),
lastSendTime: message.sendTime
});
}, file);
},
_emitPullMessages: function _emitPullMessages(next) {
var _this6 = this;
this._changeContactLock = true;
this.$emit("pull-messages", this.currentContact, function (messages) {
var isEnd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
_this6._addMessage(messages, _this6.currentContactId, 0);
_this6.CacheMessageLoaded.set(_this6.currentContactId, isEnd);
if (isEnd == true) _this6.$refs.messages.loaded();
_this6.updateCurrentMessages();
_this6._changeContactLock = false;
next(isEnd);
}, this);
},
clearCacheContainer: function clearCacheContainer(name) {
this.CacheContactContainer.remove(name);
this.CacheMenuContainer.remove(name);
},
_renderWrapper: function _renderWrapper(children) {
var h = this.$createElement;
return h("div", {
"style": {
width: this.width,
height: this.height
},
"class": ["lemon-wrapper", "lemon-wrapper--theme-".concat(this.theme), {
"lemon-wrapper--simple": this.simple
}, this.drawerVisible && "lemon-wrapper--drawer-show"]
}, [children]);
},
_renderMenu: function _renderMenu() {
var _this7 = this;
var h = this.$createElement;
var menuItem = this._renderMenuItem();
return h("div", {
"class": "lemon-menu",
"directives": [{
name: "show",
value: !this.hideMenu
}]
}, [h("lemon-avatar", {
"directives": [{
name: "show",
value: !this.hideMenuAvatar
}],
"on": {
"click": function click(e) {
_this7.$emit("menu-avatar-click", e);
}
},
"class": "lemon-menu__avatar",
"attrs": {
"src": this.user.avatar
}
}), menuItem.top, this.$slots.menu, h("div", {
"class": "lemon-menu__bottom"
}, [this.$slots["menu-bottom"], menuItem.bottom])]);
},
_renderMenuAvatar: function _renderMenuAvatar() {
return;
},
_renderMenuItem: function _renderMenuItem() {
var _this8 = this;
var h = this.$createElement;
var top = [];
var bottom = [];
this.menus.forEach(function (item) {
var name = item.name,
title = item.title,
unread = item.unread,
render = item.render,
_click = item.click;
var node = h("div", {
"class": ["lemon-menu__item", {
"lemon-menu__item--active": _this8.activeSidebar == name
}],
"on": {
"click": function click() {
funCall(_click, function () {
if (name) _this8.changeMenu(name);
});
}
},
"attrs": {
"title": title
}
}, [h("lemon-badge", {
"attrs": {
"count": unread
}
}, [render(item)])]);
item.isBottom === true ? bottom.push(node) : top.push(node);
});
return {
top: top,
bottom: bottom
};
},
_renderSidebarMessage: function _renderSidebarMessage() {
var _this9 = this;
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-message-top"], null, this), this.lastMessages.map(function (contact) {
return _this9._renderContact({
contact: contact,
timeFormat: _this9.contactTimeFormat
}, function () {
return _this9.changeContact(contact.id);
}, _this9.$scopedSlots["sidebar-message"]);
})], DEFAULT_MENU_LASTMESSAGES, useScopedSlot(this.$scopedSlots["sidebar-message-fixedtop"], null, this));
},
_renderContact: function _renderContact(props, onClick, slot) {
var _this10 = this;
var h = this.$createElement;
var _props$contact = props.contact,
customClick = _props$contact.click,
renderContainer = _props$contact.renderContainer,
contactId = _props$contact.id;
var click = function click() {
funCall(customClick, function () {
onClick();
_this10._customContainerReady(renderContainer, _this10.CacheContactContainer, contactId);
});
};
return h("lemon-contact", helper_default()([{
"class": {
"lemon-contact--active": this.currentContactId == props.contact.id
},
"directives": [{
name: "lemon-contextmenu",
value: this.contactContextmenu,
modifiers: {
"contact": true
}
}]
}, {
"props": props
}, {
"on": {
"click": click
},
"scopedSlots": {
default: slot
}
}]));
},
_renderSidebarContact: function _renderSidebarContact() {
var _this11 = this;
var h = this.$createElement;
var prevIndex;
return this._renderSidebar([useScopedSlot(this.$scopedSlots["sidebar-contact-top"], null, this), this.contacts.map(function (contact) {
if (!contact.index) return;
contact.index = contact.index.replace(/\[[0-9]*\]/, "");
var node = [contact.index !== prevIndex && h("p", {
"class": "lemon-sidebar__label"
}, [contact.index]), _this11._renderContact({
contact: contact,
simple: true
}, function () {
_this11.changeContact(contact.id);
}, _this11.$scopedSlots["sidebar-contact"])];
prevIndex = contact.index;
return node;
})], DEFAULT_MENU_CONTACTS, useScopedSlot(this.$scopedSlots["sidebar-contact-fixedtop"], null, this));
},
_renderSidebar: function _renderSidebar(children, name, fixedtop) {
var h = this.$createElement;
return h("div", {
"class": "lemon-sidebar",
"directives": [{
name: "show",
value: this.activeSidebar == name
}],
"on": {
"scroll": this._handleSidebarScroll
}
}, [h("div", {
"class": "lemon-sidebar__fixed-top"
}, [fixedtop]), h("div", {
"class": "lemon-sidebar__scroll"
}, [children])]);
},
_renderDrawer: function _renderDrawer() {
var h = this.$createElement;
return this._menuIsMessages() && this.currentContactId ? h("div", {
"class": "lemon-drawer"
}, [renderDrawerContent(), useScopedSlot(this.$scopedSlots.drawer, "", this.currentContact)]) : "";
},
_isContactContainerCache: function _isContactContainerCache(name) {
return name.startsWith("contact#");
},
_renderContainer: function _renderContainer() {
var _this12 = this;
var h = this.$createElement;
var nodes = [];
var cls = "lemon-container";
var curact = this.currentContact;
var defIsShow = true;
for (var name in this.CacheContactContainer.get()) {
var show = curact.id == name && this.currentIsDefSidebar;
defIsShow = !show;
nodes.push(h("div", {
"class": cls,
"directives": [{
name: "show",
value: show
}]
}, [this.CacheContactContainer.get(name)]));
}
for (var _name in this.CacheMenuContainer.get()) {
nodes.push(h("div", {
"class": cls,
"directives": [{
name: "show",
value: this.activeSidebar == _name && !this.currentIsDefSidebar
}]
}, [this.CacheMenuContainer.get(_name)]));
}
nodes.push(h("div", {
"class": cls,
"directives": [{
name: "show",
value: this._menuIsMessages() && defIsShow && curact.id
}]
}, [h("div", {
"class": "lemon-container__title"
}, [h("div", {
"class": "lemon-container__displayname"
}, [useScopedSlot(this.$scopedSlots["message-title"], curact.displayName, curact)])]), h("lemon-messages", {
"ref": "messages",
"attrs": {
"hide-time": this.hideMessageTime,
"hide-name": this.hideMessageName,
"time-format": this.messageTimeFormat,
"reverse-user-id": this.user.id,
"messages": this.currentMessages
},
"on": {
"reach-top": this._emitPullMessages
}
}), h("lemon-editor", {
"ref": "editor",
"attrs": {
"tools": this.editorTools,
"sendText": this.sendText,
"sendKey": this.sendKey
},
"on": {
"send": this._handleSend,
"upload": this._handleUpload
}
})]));
nodes.push(h("div", {
"class": cls,
"directives": [{
name: "show",
value: !curact.id && this.currentIsDefSidebar
}]
}, [this.$slots.cover]));
nodes.push(h("div", {
"class": cls,
"directives": [{
name: "show",
value: this._menuIsContacts() && defIsShow && curact.id
}]
}, [useScopedSlot(this.$scopedSlots["contact-info"], h("div", {
"class": "lemon-contact-info"
}, [h("lemon-avatar", {
"attrs": {
"src": curact.avatar,
"size": 90
}
}), 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() {
contextmenu.hide();
},
_addContact: function _addContact(data, t) {
var type = {
0: "unshift",
1: "push"
}[t];
this.contacts[type](data);
},
_addMessage: function _addMessage(data, contactId, t) {
var _allMessages$contactI;
var type = {
0: "unshift",
1: "push"
}[t];
if (!Array.isArray(data)) data = [data];
allMessages[contactId] = allMessages[contactId] || [];
(_allMessages$contactI = allMessages[contactId])[type].apply(_allMessages$contactI, _toConsumableArray(data));
},
/**
* 设置最新消息DOM
* @param {String} messageType 消息类型
* @param {Function} render 返回消息 vnode
*/
setLastContentRender: function setLastContentRender(messageType, render) {
packages_lastContentRender[messageType] = render;
},
lastContentRender: function lastContentRender(message) {
if (!isFunction(packages_lastContentRender[message.type])) {
console.error("not found '".concat(message.type, "' of the latest message renderer,try to use \u2018setLastContentRender()\u2019"));
return "";
}
return packages_lastContentRender[message.type].call(this, message);
},
/**
* 将字符串内的 EmojiItem.name 替换为 img
* @param {String} str 被替换的字符串
* @return {String} 替换后的字符串
*/
emojiNameToImage: function emojiNameToImage(str) {
return str.replace(/\[!(\w+)\]/gi, function (str, match) {
var file = match;
return emojiMap[file] ? "") : "[!".concat(match, "]");
});
},
emojiImageToName: function emojiImageToName(str) {
return str.replace(/
]*>/gi, "[!$1]");
},
updateCurrentMessages: function updateCurrentMessages() {
if (!allMessages[this.currentContactId]) allMessages[this.currentContactId] = [];
this.currentMessages = allMessages[this.currentContactId];
},
/**
* 将当前聊天窗口滚动到底部
*/
messageViewToBottom: function messageViewToBottom() {
this.$refs.messages.scrollToBottom();
},
/**
* 改变聊天对象
* @param contactId 联系人 id
*/
changeContact: function () {
var _changeContact = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(contactId, menuName) {
var _this13 = this;
var prevCurrentContactId, editorValue, draft;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!menuName) {
_context2.next = 4;
break;
}
this.changeMenu(menuName);
_context2.next = 6;
break;
case 4:
if (!(this._changeContactLock || this.currentContactId == contactId)) {
_context2.next = 6;
break;
}
return _context2.abrupt("return", false);
case 6:
prevCurrentContactId = this.currentContactId; //保存上个聊天目标的草稿
if (prevCurrentContactId) {
editorValue = this.getEditorValue();
if (editorValue) {
this.CacheDraft.set(prevCurrentContactId, editorValue);
this.updateContact({
id: prevCurrentContactId,
lastContent: "[\u8349\u7A3F]".concat(this.lastContentRender({
type: "text",
content: editorValue
}), "")
});
this.setEditorValue("");
}
}
this.currentContactId = contactId;
if (this.currentContactId) {
_context2.next = 11;
break;
}
return _context2.abrupt("return", false);
case 11:
this.$emit("change-contact", this.currentContact, this);
if (!isFunction(this.currentContact.renderContainer)) {
_context2.next = 14;
break;
}
return _context2.abrupt("return");
case 14:
//填充草稿内容
draft = this.CacheDraft.get(contactId) || "";
if (draft) this.setEditorValue(draft);
if (this.CacheMessageLoaded.has(contactId)) {
this.$refs.messages.loaded();
} else {
this.$refs.messages.resetLoadState();
}
if (!allMessages[contactId]) {
this.updateCurrentMessages();
this._emitPullMessages(function (isEnd) {
return _this13.messageViewToBottom();
});
} else {
setTimeout(function () {
_this13.updateCurrentMessages();
_this13.messageViewToBottom();
}, 0);
}
case 18:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function changeContact(_x, _x2) {
return _changeContact.apply(this, arguments);
}
return changeContact;
}(),
/**
* 删除一条聊天消息
* @param messageId 消息 id
* @param contactId 联系人 id
*/
removeMessage: function removeMessage(messageId) {
var message = this.findMessage(messageId);
if (!message) return false;
var index = allMessages[message.toContactId].findIndex(function (_ref) {
var id = _ref.id;
return id == messageId;
});
allMessages[message.toContactId].splice(index, 1);
return true;
},
/**
* 修改聊天一条聊天消息
* @param {Message} data 根据 data.id 查找聊天消息并覆盖传入的值
* @param contactId 联系人 id
*/
updateMessage: function updateMessage(message) {
if (!message.id) return false;
var historyMessage = this.findMessage(message.id);
if (!historyMessage) return false;
historyMessage = Object.assign(historyMessage, message, {
toContactId: historyMessage.toContactId
});
return true;
},
/**
* 手动更新对话消息
* @param {String} messageId 消息ID,如果为空则更新当前聊天窗口的所有消息
*/
forceUpdateMessage: function forceUpdateMessage(messageId) {
if (!messageId) {
this.$refs.messages.$forceUpdate();
} else {
var components = this.$refs.messages.$refs.message;
if (components) {
var messageComponent = components.find(function (com) {
return com.$attrs.message.id == messageId;
});
if (messageComponent) messageComponent.$forceUpdate();
}
}
},
_customContainerReady: function _customContainerReady(render, cacheDrive, key) {
if (isFunction(render) && !cacheDrive.has(key)) {
cacheDrive.set(key, render.call(this));
}
},
/**
* 切换左侧按钮
* @param {String} name 按钮 name
*/
changeMenu: function changeMenu(name) {
if (this._changeContactLock) return false;
this.$emit("change-menu", name);
this.activeSidebar = name;
},
/**
* 初始化编辑框的 Emoji 表情列表,是 Lemon-editor.initEmoji 的代理方法
* @param {Array