UNPKG

weiyun-ui

Version:

UI library For Vue

2 lines 14.6 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("wy-chat",[],e):"object"==typeof exports?exports["wy-chat"]=e():t["wy-chat"]=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=588)}({10:function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},101:function(t,e,n){var r=n(6),o=n(58).set;t.exports=function(t,e,n){var i,c=e.constructor;return c!==n&&"function"==typeof c&&(i=c.prototype)!==n.prototype&&r(i)&&o&&o(t,i),t}},102:function(t,e,n){var r=n(3),o=n(19),i=n(8),c=n(105),a="["+c+"]",u=RegExp("^"+a+a+"*"),s=RegExp(a+a+"*$"),f=function(t,e,n){var o={},a=i((function(){return!!c[t]()||"​…"!="​…"[t]()})),u=o[t]=a?e(l):c[t];n&&(o[n]=u),r(r.P+r.F*a,"String",o)},l=f.trim=function(t,e){return t=String(o(t)),1&e&&(t=t.replace(u,"")),2&e&&(t=t.replace(s,"")),t};t.exports=f},105:function(t,e){t.exports="\t\n\v\f\r   ᠎              \u2028\u2029\ufeff"},11:function(t,e,n){var r=n(7),o=n(22);t.exports=n(4)?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},12:function(t,e,n){var r=n(45),o=n(19);t.exports=function(t){return r(o(t))}},13:function(t,e){var n=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},14:function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},15:function(t,e,n){var r=n(29);t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},16:function(t,e,n){var r=n(26),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},18:function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},19:function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},2:function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},20:function(t,e,n){var r=n(47),o=n(35);t.exports=Object.keys||function(t){return r(t,o)}},21:function(t,e){t.exports=!1},22:function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},24:function(t,e,n){var r=n(6);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},25:function(t,e,n){var r=n(13),o=n(2),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:n(21)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},26:function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},27:function(t,e,n){"use strict";function r(t,e,n,r,o,i,c,a){var u,s="function"==typeof t?t.options:t;if(e&&(s.render=e,s.staticRenderFns=n,s._compiled=!0),r&&(s.functional=!0),i&&(s._scopeId="data-v-"+i),c?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(c)},s._ssrRegister=u):o&&(u=a?function(){o.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:o),u)if(s.functional){s._injectStyles=u;var f=s.render;s.render=function(t,e){return u.call(e),f(t,e)}}else{var l=s.beforeCreate;s.beforeCreate=l?[].concat(l,u):[u]}return{exports:t,options:s}}n.d(e,"a",(function(){return r}))},29:function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},3:function(t,e,n){var r=n(2),o=n(13),i=n(11),c=n(9),a=n(15),u=function(t,e,n){var s,f,l,p,v=t&u.F,d=t&u.G,h=t&u.S,_=t&u.P,y=t&u.B,m=d?r:h?r[e]||(r[e]={}):(r[e]||{}).prototype,g=d?o:o[e]||(o[e]={}),b=g.prototype||(g.prototype={});for(s in d&&(n=e),n)l=((f=!v&&m&&void 0!==m[s])?m:n)[s],p=y&&f?a(l,r):_&&"function"==typeof l?a(Function.call,l):l,m&&c(m,s,l,t&u.U),g[s]!=l&&i(g,s,p),_&&b[s]!=l&&(b[s]=l)};r.core=o,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},30:function(t,e,n){var r=n(34),o=n(22),i=n(12),c=n(24),a=n(10),u=n(41),s=Object.getOwnPropertyDescriptor;e.f=n(4)?s:function(t,e){if(t=i(t),e=c(e,!0),u)try{return s(t,e)}catch(t){}if(a(t,e))return o(!r.f.call(t,e),t[e])}},31:function(t,e,n){var r=n(7).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||n(4)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(t){return""}}})},32:function(t,e,n){var r=n(5),o=n(57),i=n(35),c=n(37)("IE_PROTO"),a=function(){},u=function(){var t,e=n(33)("iframe"),r=i.length;for(e.style.display="none",n(42).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;r--;)delete u.prototype[i[r]];return u()};t.exports=Object.create||function(t,e){var n;return null!==t?(a.prototype=r(t),n=new a,a.prototype=null,n[c]=t):n=u(),void 0===e?n:o(n,e)}},33:function(t,e,n){var r=n(6),o=n(2).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},34:function(t,e){e.f={}.propertyIsEnumerable},35:function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},36:function(t,e,n){var r=n(47),o=n(35).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},37:function(t,e,n){var r=n(25)("keys"),o=n(18);t.exports=function(t){return r[t]||(r[t]=o(t))}},383:function(t,e,n){},384:function(t,e,n){},4:function(t,e,n){t.exports=!n(8)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},41:function(t,e,n){t.exports=!n(4)&&!n(8)((function(){return 7!=Object.defineProperty(n(33)("div"),"a",{get:function(){return 7}}).a}))},42:function(t,e,n){var r=n(2).document;t.exports=r&&r.documentElement},45:function(t,e,n){var r=n(14);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},452:function(t,e,n){"use strict";n(383)},453:function(t,e,n){"use strict";n(384)},47:function(t,e,n){var r=n(10),o=n(12),i=n(52)(!1),c=n(37)("IE_PROTO");t.exports=function(t,e){var n,a=o(t),u=0,s=[];for(n in a)n!=c&&r(a,n)&&s.push(n);for(;e.length>u;)r(a,n=e[u++])&&(~i(s,n)||s.push(n));return s}},49:function(t,e,n){var r=n(26),o=Math.max,i=Math.min;t.exports=function(t,e){return(t=r(t))<0?o(t+e,0):i(t,e)}},5:function(t,e,n){var r=n(6);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},52:function(t,e,n){var r=n(12),o=n(16),i=n(49);t.exports=function(t){return function(e,n,c){var a,u=r(e),s=o(u.length),f=i(c,s);if(t&&n!=n){for(;s>f;)if((a=u[f++])!=a)return!0}else for(;s>f;f++)if((t||f in u)&&u[f]===n)return t||f||0;return!t&&-1}}},57:function(t,e,n){var r=n(7),o=n(5),i=n(20);t.exports=n(4)?Object.defineProperties:function(t,e){o(t);for(var n,c=i(e),a=c.length,u=0;a>u;)r.f(t,n=c[u++],e[n]);return t}},58:function(t,e,n){var r=n(6),o=n(5),i=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(15)(Function.call,n(30).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return i(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:i}},588:function(t,e,n){"use strict";n.r(e);n(31);var r=function(){var t=this,e=t._self._c;return e("div",{staticClass:"wy-chat_container"},[e("div",{ref:"chatContentRef",staticClass:"wy-chat_content"},t._l(t.localChatList,(function(n,r){return e("div",{key:r,staticClass:"wy-chat_item-wrap"},[n.create_user_name!==t.currentUserName?e("div",{staticClass:"wy-chat_item-left"},[e("div",{staticClass:"wy-chat_item-header"},[e("div",{staticClass:"wy-chat_item-avatar"},[n.create_user_avatar?e("img",{attrs:{src:n.create_user_avatar,alt:""}}):n.from_desc?e("span",[t._v(t._s(n.from_desc.substr(0,1)))]):t._e()]),e("div",{staticClass:"wy-chat_item-name"},[t._v("\n "+t._s(n.create_user_name)+"\n ")]),e("div",{staticClass:"wy-chat_item-time"},[t._v("\n "+t._s(n.create_time)+"\n ")])]),e("div",{staticClass:"wy-chat_item-content"},[t._v(t._s(n.remark))])]):e("div",{staticClass:"wy-chat_item-right"},[e("div",{staticClass:"wy-chat_item-header"},[e("div",{staticClass:"wy-chat_item-time"},[t._v("\n "+t._s(n.create_time)+"\n ")]),e("div",{staticClass:"wy-chat_item-avatar"},[n.create_user_avatar?e("img",{attrs:{src:n.create_user_avatar,alt:""}}):n.from_desc?e("span",[t._v("Y")]):t._e()])]),e("div",{staticClass:"wy-chat_item-content"},[t._v(t._s(n.remark))]),n.to_desc&&n.to_desc.length?e("div",{staticClass:"wy-chat_item-to-desc"},[t._v("\n 可见人员:"+t._s(n.to_desc.join(", "))+"\n ")]):t._e()])])})),0),t.receiverList&&t.receiverList.length?e("div",{staticClass:"wy-chat_choose-receiver"},[e("span",{staticClass:"wy-chat_choose-receiver__title"},[t._v("接收对象:")]),e("el-checkbox-group",{attrs:{size:"small"},model:{value:t.receivers,callback:function(e){t.receivers=e},expression:"receivers"}},t._l(t.receiverList,(function(n,r){return e("el-checkbox",{key:r,attrs:{border:"",label:n.value}},[t._v(t._s(n.label))])})),1)],1):t._e(),e("div",{staticClass:"wy-chat_input"},[e("div",{staticClass:"wy-chat_input-wrap"},[e("el-input",{staticClass:"wy-chat_input-wrap__input",attrs:{placeholder:"请输入内容",type:"textarea",rows:3,maxlength:"1000","show-word-limit":!0,resize:"none"},model:{value:t.chatInput,callback:function(e){t.chatInput=e},expression:"chatInput"}})],1),e("el-button",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"wy-chat_input-wrap__btn",attrs:{type:"primary",size:"medium"},on:{click:t.sendMessage}},[t._v("发送")])],1)])};r._withStripped=!0;n(73);var o={name:"wy-chat",props:{chatList:{type:Array,default:function(){}},receiverList:{type:Array,default:function(){}},currentUserName:{type:String,default:""},reduceHeight:{type:Number,default:200}},data:function(){return{localChatList:[],chatInput:"",receivers:[],loading:!1}},methods:{bottomScroll:function(){var t=this;this.$nextTick((function(){var e=t.$refs.chatContentRef;e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}))},sendMessage:function(){var t=this;this.loading=!0,this.$emit("sendMessage",{content:this.chatInput,receivers:this.receivers},(function(){t.chatInput="",t.receivers=[],t.loading=!1}))}},watch:{chatList:{handler:function(t,e){this.localChatList=t,this.bottomScroll()},deep:!0,immediate:!0}},created:function(){document.documentElement.style.setProperty("--chat-reduce-height",this.reduceHeight+"px"),this.localChatList=this.chatList,this.bottomScroll()},mounted:function(){},computed:{},beforeDestroy:function(){}},i=(n(452),n(453),n(27)),c=Object(i.a)(o,r,[],!1,null,"c40a998c",null).exports;c.install=function(t){t.component(c.name,c)};e.default=c},6:function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},68:function(t,e,n){t.exports=n(25)("native-function-to-string",Function.toString)},7:function(t,e,n){var r=n(5),o=n(41),i=n(24),c=Object.defineProperty;e.f=n(4)?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return c(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},73:function(t,e,n){"use strict";var r=n(2),o=n(10),i=n(14),c=n(101),a=n(24),u=n(8),s=n(36).f,f=n(30).f,l=n(7).f,p=n(102).trim,v=r.Number,d=v,h=v.prototype,_="Number"==i(n(32)(h)),y="trim"in String.prototype,m=function(t){var e=a(t,!1);if("string"==typeof e&&e.length>2){var n,r,o,i=(e=y?e.trim():p(e,3)).charCodeAt(0);if(43===i||45===i){if(88===(n=e.charCodeAt(2))||120===n)return NaN}else if(48===i){switch(e.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+e}for(var c,u=e.slice(2),s=0,f=u.length;s<f;s++)if((c=u.charCodeAt(s))<48||c>o)return NaN;return parseInt(u,r)}}return+e};if(!v(" 0o1")||!v("0b1")||v("+0x1")){v=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof v&&(_?u((function(){h.valueOf.call(n)})):"Number"!=i(n))?c(new d(m(e)),n,v):m(e)};for(var g,b=n(4)?s(d):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;b.length>x;x++)o(d,g=b[x])&&!o(v,g)&&l(v,g,f(d,g));v.prototype=h,h.constructor=v,n(9)(r,"Number",v)}},8:function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},9:function(t,e,n){var r=n(2),o=n(11),i=n(10),c=n(18)("src"),a=n(68),u=(""+a).split("toString");n(13).inspectSource=function(t){return a.call(t)},(t.exports=function(t,e,n,a){var s="function"==typeof n;s&&(i(n,"name")||o(n,"name",e)),t[e]!==n&&(s&&(i(n,c)||o(n,c,t[e]?""+t[e]:u.join(String(e)))),t===r?t[e]=n:a?t[e]?t[e]=n:o(t,e,n):(delete t[e],o(t,e,n)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[c]||a.call(this)}))}}).default})); //# sourceMappingURL=index.js.map