@vunk/plus 1.16.1 → 1.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/bubble-list/index.cjs +1 -1
- package/components/bubble-list/index.mjs +219 -159
- package/components/bubble-list/src/core/index.vue.d.ts +13 -1
- package/components/bubble-list/src/index.vue.d.ts +6 -1
- package/components/text/index.cjs +1 -1
- package/components/text/index.mjs +44 -40
- package/components/text/src/index.vue.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),m=require("@vunk/plus/components/bubble-templates"),$=require("element-plus"),g=require("@vunk/plus/vue-virtual-scroller"),R=require("@element-plus/icons-vue"),x=require("@vueuse/core"),w=require("@vunk/plus/components/scrollbar"),B=require("@vunk/plus/element/bubble"),V=require("../_plugin-vue_export-helper-BHFhmbuH.js"),z=require("@vunk/shared/function"),P=require("@vunk/plus/components/agent-chat-provider"),F={},N={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",width:"704",height:"704",viewBox:"0 0 704 704"};function q(l,i){return e.openBlock(),e.createElementBlock("svg",N,[...i[0]||(i[0]=[e.createStaticVNode('<defs><filter id="master_svg0_62_10054" filterUnits="objectBoundingBox" color-interpolation-filters="sRGB" x="-0.030120481927710843" y="-0.030120481927710843" width="1.0602409638554218" height="1.0602409638554218"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5" result="effect1_foregroundBlur"></feGaussianBlur></filter><linearGradient id="master_svg1_62_10082" x1="0.5" y1="-0.13192443549633026" x2="0.42319029569625854" y2="1.368432641029358"><stop offset="9.145302325487137%" stop-color="currentColor" stop-opacity="1"></stop><stop offset="13.636428117752075%" stop-color="currentColor" stop-opacity="0.07539999485015869"></stop><stop offset="16.968481242656708%" stop-color="currentColor" stop-opacity="0"></stop></linearGradient></defs><g transform="matrix(0,1,-1,0,704,-664)" filter="url(#master_svg0_62_10054)"><path d="M1016,684C1199.359,684,1348,535.359,1348,352C1348,168.641,1199.359,20,1016,20C832.641,20,684,168.641,684,352C684,535.359,832.641,684,1016,684ZM1016,32C1192.731,32,1336,175.269,1336,352C1336,528.731,1192.731,672,1016,672C839.269,672,696,528.731,696,352C696,175.269,839.269,32,1016,32Z" fill-rule="evenodd" fill="url(#master_svg1_62_10082)" fill-opacity="1"></path></g>',2)])])}const A=V._export_sfc(F,[["render",q]]),E={class:"vk-bubble-list-wrapper"},I=e.defineComponent({__name:"index",props:{list:{type:Array,default:()=>[]},autoScroll:{type:Boolean,default:!0},autoScrollThreshold:{type:Number,default:200},maxHeight:{type:String,default:""},alwaysShowScrollbar:{type:Boolean,default:!1},backButtonThreshold:{type:Number,default:80},showBackButton:{type:Boolean,default:!0},backButtonPosition:{type:Object,default:()=>({bottom:"20px",left:"calc(50% - 19px)"})},btnLoading:{type:Boolean,default:!0},btnColor:{type:String,default:"#409EFF"},btnIconSize:{type:Number,default:24},scrollbarAppendTo:{type:null,default:void 0},virtual:{type:Boolean,default:!1},keyField:{type:String,default:"key"}},emits:{complete:null},setup(l,{expose:i}){const r=l,n=e.ref(),a=e.ref(),v=e.ref();function u(){document.documentElement.style.setProperty("--el-bubble-list-max-height",r.maxHeight||"100%"),document.documentElement.style.setProperty("--el-bubble-list-btn-size",`${r.btnIconSize}px`)}e.onMounted(()=>{u(),r.virtual&&e.nextTick(()=>{const o=n.value?.wrapRef;o&&(v.value=o)}),setTimeout(p)}),e.watch(()=>[r.maxHeight,r.btnIconSize],()=>u());const s=e.ref(),S=e.computed(()=>r.showBackButton&&s.value!==void 0&&s.value>r.backButtonThreshold);function p(){const o=n.value?.wrapRef;if(o)return s.value=o.scrollHeight-o.scrollTop-o.clientHeight,s.value}function h(){if(r.virtual){a.value?.scrollToBottom();return}n.value?.scrollToBottom()}function C(){if(r.virtual){a.value?.scrollToItem(0);return}n.value?.scrollToTop()}function T(o){if(r.virtual){a.value?.scrollToItem(o),requestAnimationFrame(()=>{requestAnimationFrame(()=>{a.value?.scrollToItem(o)})});return}const c=n.value?.wrapRef;if(!c)return;const b=c.querySelectorAll(".el-bubble");if(o>=b.length)return;const t=b[o],d=c.getBoundingClientRect(),y=t.getBoundingClientRect();c.scrollTo({top:y.top-d.top+c.scrollTop,behavior:"smooth"})}const k=e.ref();return e.onMounted(()=>{e.nextTick(()=>{k.value=n.value?.wrapRef?.firstElementChild})}),r.autoScroll&&x.useResizeObserver(k,()=>{const o=p();o!==void 0&&o>r.autoScrollThreshold||h()}),i({scrollToTop:C,scrollToBottom:h,scrollToBubble:T}),(o,c)=>{const b=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",E,[l.virtual?(e.openBlock(),e.createElementBlock("div",{key:0,class:"vk-bubble-list-virtual-host",style:e.normalizeStyle({height:l.maxHeight||"100%"})},[e.createVNode(e.unref(w.VkScrollbar),{ref_key:"scrollbarRef",ref:n,class:"vk-bubble-list-virtual-scrollbar",always:l.alwaysShowScrollbar,"hide-after":800,onScroll:p},{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(e.unref(g.DynamicScroller),{key:0,ref_key:"scrollerRef",ref:a,items:l.list,"min-item-size":54,"key-field":l.keyField,"page-mode":!0,"scroll-parent":v.value,class:"vk-bubble-list-dynamic-scroller"},{default:e.withCtx(({item:t,index:d,active:y})=>[e.createVNode(e.unref(g.DynamicScrollerItem),{item:t,active:y,"data-index":d,class:"vk-bubble-list-virtual-item"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.Bubble),{content:t.content,placement:t.placement,loading:t.loading,shape:t.shape,variant:t.variant,"is-markdown":t.isMarkdown,"is-fog":t.isFog,typing:t.typing,"max-width":t.maxWidth,avatar:t.avatar,"avatar-size":t.avatarSize,"avatar-gap":t.avatarGap,"avatar-shape":t.avatarShape,"avatar-src-set":t.avatarSrcSet,"avatar-alt":t.avatarAlt,"avatar-fit":t.avatarFit,"no-style":t.noStyle,class:e.normalizeClass({[`is-${t.role}`]:!0})},e.createSlots({_:2},[o.$slots.avatar?{name:"avatar",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"avatar",{item:t})]),key:"0"}:void 0,o.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"header",{item:t})]),key:"1"}:void 0,o.$slots.content?{name:"content",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"content",{item:t})]),key:"2"}:void 0,o.$slots.footer?{name:"footer",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"footer",{item:t})]),key:"3"}:void 0,o.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"loading",{item:t})]),key:"4"}:void 0]),1032,["content","placement","loading","shape","variant","is-markdown","is-fog","typing","max-width","avatar","avatar-size","avatar-gap","avatar-shape","avatar-src-set","avatar-alt","avatar-fit","no-style","class"])]),_:2},1032,["item","active","data-index"])]),_:3},8,["items","key-field","scroll-parent"])):e.createCommentVNode("",!0)]),_:3},8,["always"])],4)):(e.openBlock(),e.createBlock(e.unref(w.VkScrollbar),{key:1,ref_key:"scrollbarRef",ref:n,class:"vk-bubble-list","append-to":l.scrollbarAppendTo,always:l.alwaysShowScrollbar,"hide-after":800,onScroll:p},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.list,(t,d)=>(e.openBlock(),e.createBlock(e.unref(B.Bubble),{key:t.key||d,content:t.content,placement:t.placement,loading:t.loading,shape:t.shape,variant:t.variant,"is-markdown":t.isMarkdown,"is-fog":t.isFog,typing:t.typing,"max-width":t.maxWidth,avatar:t.avatar,"avatar-size":t.avatarSize,"avatar-gap":t.avatarGap,"avatar-shape":t.avatarShape,"avatar-src-set":t.avatarSrcSet,"avatar-alt":t.avatarAlt,"avatar-fit":t.avatarFit,"no-style":t.noStyle,class:e.normalizeClass({[`is-${t.role}`]:!0})},e.createSlots({_:2},[o.$slots.avatar?{name:"avatar",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"avatar",{item:t})]),key:"0"}:void 0,o.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"header",{item:t})]),key:"1"}:void 0,o.$slots.content?{name:"content",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"content",{item:t})]),key:"2"}:void 0,o.$slots.footer?{name:"footer",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"footer",{item:t})]),key:"3"}:void 0,o.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"loading",{item:t})]),key:"4"}:void 0]),1032,["content","placement","loading","shape","variant","is-markdown","is-fog","typing","max-width","avatar","avatar-size","avatar-gap","avatar-shape","avatar-src-set","avatar-alt","avatar-fit","no-style","class"]))),128))]),_:3},8,["append-to","always"])),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["vk-bubble-list-default-back-button",{"vk-bubble-list-back-to-bottom-solt":o.$slots.backToBottom}]),style:e.normalizeStyle({bottom:l.backButtonPosition.bottom,left:l.backButtonPosition.left}),onClick:h},[e.renderSlot(o.$slots,"backToBottom",{},()=>[e.createVNode(b,{class:"vk-bubble-list-back-to-bottom-icon",style:e.normalizeStyle({color:r.btnColor})},{default:e.withCtx(()=>[e.createVNode(e.unref(R.ArrowDownBold)),r.btnLoading?(e.openBlock(),e.createBlock(A,{key:0,class:"back-to-bottom-loading-svg-bg"})):e.createCommentVNode("",!0)]),_:1},8,["style"])])],6),[[e.vShow,S.value]])])}}}),L={items:{type:Array,default:()=>[]},elRef:{type:Function,default:z.noop},scrollbarAppendTo:null,virtual:{type:Boolean,default:!1},keyField:{type:String,default:"key"},autoScrollThreshold:{type:Number,default:200}},f=e.defineComponent({name:"VkBubbleList",inheritAttrs:!1,__name:"index",props:L,setup(l,{expose:i}){const r=l,n=e.ref();return e.watch(()=>r.elRef,a=>{a&&a(n.value)},{immediate:!0}),i({scrollToTop:()=>n.value?.scrollToTop(),scrollToBottom:()=>n.value?.scrollToBottom(),scrollToBubble:a=>n.value?.scrollToBubble(a)}),(a,v)=>(e.openBlock(),e.createBlock(e.unref(m.VkBubbleRenderTemplates),null,{placeholder:e.withCtx(()=>[e.createVNode(e.unref(m.VkBubbleTemplates))]),default:e.withCtx(()=>[e.renderSlot(a.$slots,"renderer"),e.createVNode(e.unref($.ElAutoResizer),null,{default:e.withCtx(({height:u})=>[e.createVNode(I,e.mergeProps({ref_key:"bubbleListRef",ref:n,"btn-icon-size":18,"max-height":`${u}px`,"scrollbar-append-to":a.scrollbarAppendTo,virtual:a.virtual,"key-field":a.keyField,"auto-scroll-threshold":a.autoScrollThreshold,style:{"--el-bubble-list-max-height":`${u}px`},list:a.items},a.$attrs),e.createSlots({content:e.withCtx(({item:s})=>[e.createVNode(e.unref(m.VkBubbleRenderer),{source:[s]},null,8,["source"])]),_:2},[a.$slots.avatar?{name:"avatar",fn:e.withCtx(s=>[e.renderSlot(a.$slots,"avatar",e.normalizeProps(e.guardReactiveProps(s)))]),key:"0"}:void 0,a.$slots.header?{name:"header",fn:e.withCtx(s=>[e.renderSlot(a.$slots,"header",e.normalizeProps(e.guardReactiveProps(s)))]),key:"1"}:void 0,a.$slots.loading?{name:"loading",fn:e.withCtx(s=>[e.renderSlot(a.$slots,"loading",e.normalizeProps(e.guardReactiveProps(s)))]),key:"2"}:void 0,a.$slots.footer?{name:"footer",fn:e.withCtx(s=>[e.renderSlot(a.$slots,"footer",e.normalizeProps(e.guardReactiveProps(s)))]),key:"3"}:void 0]),1040,["max-height","scrollbar-append-to","virtual","key-field","auto-scroll-threshold","style","list"])]),_:3})]),_:3}))}}),M=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));f.install=l=>{l.component(f.name||"VkBubbleList",f)};Object.defineProperty(exports,"Role",{enumerable:!0,get:()=>P.Role});exports.VkBubbleList=f;exports.__VkBubbleList=M;exports.default=f;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("@vunk/plus/components/bubble-templates"),P=require("element-plus"),B=require("@vunk/plus/vue-virtual-scroller"),F=require("@element-plus/icons-vue"),q=require("@vueuse/core"),S=require("@vunk/plus/components/scrollbar"),C=require("@vunk/plus/element/bubble"),I=require("../_plugin-vue_export-helper-BHFhmbuH.js"),N=require("@vunk/shared/function"),A=require("@vunk/plus/components/agent-chat-provider"),E={},O={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1",width:"704",height:"704",viewBox:"0 0 704 704"};function M(n,f){return e.openBlock(),e.createElementBlock("svg",O,[...f[0]||(f[0]=[e.createStaticVNode('<defs><filter id="master_svg0_62_10054" filterUnits="objectBoundingBox" color-interpolation-filters="sRGB" x="-0.030120481927710843" y="-0.030120481927710843" width="1.0602409638554218" height="1.0602409638554218"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5" result="effect1_foregroundBlur"></feGaussianBlur></filter><linearGradient id="master_svg1_62_10082" x1="0.5" y1="-0.13192443549633026" x2="0.42319029569625854" y2="1.368432641029358"><stop offset="9.145302325487137%" stop-color="currentColor" stop-opacity="1"></stop><stop offset="13.636428117752075%" stop-color="currentColor" stop-opacity="0.07539999485015869"></stop><stop offset="16.968481242656708%" stop-color="currentColor" stop-opacity="0"></stop></linearGradient></defs><g transform="matrix(0,1,-1,0,704,-664)" filter="url(#master_svg0_62_10054)"><path d="M1016,684C1199.359,684,1348,535.359,1348,352C1348,168.641,1199.359,20,1016,20C832.641,20,684,168.641,684,352C684,535.359,832.641,684,1016,684ZM1016,32C1192.731,32,1336,175.269,1336,352C1336,528.731,1192.731,672,1016,672C839.269,672,696,528.731,696,352C696,175.269,839.269,32,1016,32Z" fill-rule="evenodd" fill="url(#master_svg1_62_10082)" fill-opacity="1"></path></g>',2)])])}const H=I._export_sfc(E,[["render",M]]),L={class:"vk-bubble-list-wrapper"},G=e.defineComponent({__name:"index",props:{list:{type:Array,default:()=>[]},autoScroll:{type:Boolean,default:!0},autoScrollThreshold:{type:Number,default:200},maxHeight:{type:String,default:""},alwaysShowScrollbar:{type:Boolean,default:!1},backButtonThreshold:{type:Number,default:80},showBackButton:{type:Boolean,default:!0},backButtonPosition:{type:Object,default:()=>({bottom:"20px",left:"calc(50% - 19px)"})},btnLoading:{type:Boolean,default:!0},btnColor:{type:String,default:"#409EFF"},btnIconSize:{type:Number,default:24},scrollbarAppendTo:{type:null,default:void 0},virtual:{type:Boolean,default:!1},keyField:{type:String,default:"key"}},emits:{complete:null},setup(n,{expose:f}){const s=n,r=e.ref(),a=e.ref(),h=e.ref();function b(){document.documentElement.style.setProperty("--el-bubble-list-max-height",s.maxHeight||"100%"),document.documentElement.style.setProperty("--el-bubble-list-btn-size",`${s.btnIconSize}px`)}e.onMounted(()=>{b(),s.virtual&&e.nextTick(()=>{const o=r.value?.wrapRef;o&&(h.value=o)}),setTimeout(g)}),e.watch(()=>[s.maxHeight,s.btnIconSize],()=>b());const i=e.ref(),T=e.computed(()=>s.showBackButton&&i.value!==void 0&&i.value>s.backButtonThreshold);let p=!1;function g(){const o=r.value?.wrapRef;if(o)return i.value=o.scrollHeight-o.scrollTop-o.clientHeight,i.value}function y(){if(s.virtual){a.value?.scrollToBottom();return}r.value?.scrollToBottom()}function $(){if(s.virtual){a.value?.scrollToItem(0);return}r.value?.scrollToTop()}async function R(o){if(s.virtual){const l=r.value?.wrapRef;if(!l)return;p=!0;try{const d=l.querySelector(`[data-index="${o}"][data-visible="true"] .el-bubble`);if(d){const u=l.getBoundingClientRect(),c=d.getBoundingClientRect();l.scrollTo({top:c.top-u.top+l.scrollTop-24,behavior:"auto"});return}let t=0;for(;t<o;){const u=a.value?.getItemOffset(t+1)??0;l.scrollTo({top:u,behavior:"auto"}),await new Promise(c=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>c())})}),t=Math.min(t+20,o)}for(const u of[1,2]){a.value?.scrollToItem(o),await new Promise(m=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>m())})});const c=l.querySelector(`[data-index="${o}"][data-visible="true"] .el-bubble`);if(c){const m=l.getBoundingClientRect(),z=c.getBoundingClientRect();l.scrollTo({top:z.top-m.top+l.scrollTop-24,behavior:"auto"})}}}finally{p=!1}return}p=!0;try{const l=r.value?.wrapRef;if(!l)return;const d=l.querySelectorAll(".el-bubble");if(o>=d.length)return;const t=d[o],u=l.getBoundingClientRect(),c=t.getBoundingClientRect();l.scrollTo({top:c.top-u.top+l.scrollTop,behavior:"smooth"})}finally{p=!1}}function V(o){return a.value?.getItemOffset(o)}function x(){const o=a.value,l=r.value?.wrapRef;if(!o||!l)return;const d=l.scrollTop,t=l.clientHeight,u=o.findItemIndex(d),c=o.findItemIndex(d+t);return{start:u,end:c}}const w=e.ref();return e.onMounted(()=>{e.nextTick(()=>{w.value=r.value?.wrapRef?.firstElementChild})}),s.autoScroll&&q.useResizeObserver(w,()=>{if(p)return;const o=g();o!==void 0&&o>s.autoScrollThreshold||y()}),f({scrollToTop:$,scrollToBottom:y,scrollToBubble:R,getItemOffset:V,getVisibleRange:x}),(o,l)=>{const d=e.resolveComponent("el-icon");return e.openBlock(),e.createElementBlock("div",L,[n.virtual?(e.openBlock(),e.createElementBlock("div",{key:0,class:"vk-bubble-list-virtual-host",style:e.normalizeStyle({height:n.maxHeight||"100%"})},[e.createVNode(e.unref(S.VkScrollbar),{ref_key:"scrollbarRef",ref:r,class:"vk-bubble-list-virtual-scrollbar",always:n.alwaysShowScrollbar,"hide-after":800,onScroll:g},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createBlock(e.unref(B.DynamicScroller),{key:0,ref_key:"scrollerRef",ref:a,items:n.list,"min-item-size":54,"key-field":n.keyField,"page-mode":!0,"scroll-parent":h.value,class:"vk-bubble-list-dynamic-scroller"},{default:e.withCtx(({item:t,index:u,active:c})=>[e.createVNode(e.unref(B.DynamicScrollerItem),{item:t,active:c,"data-index":u,"data-visible":c,class:"vk-bubble-list-virtual-item"},{default:e.withCtx(()=>[e.createVNode(e.unref(C.Bubble),{content:t.content,placement:t.placement,loading:t.loading,shape:t.shape,variant:t.variant,"is-markdown":t.isMarkdown,"is-fog":t.isFog,typing:t.typing,"max-width":t.maxWidth,avatar:t.avatar,"avatar-size":t.avatarSize,"avatar-gap":t.avatarGap,"avatar-shape":t.avatarShape,"avatar-src-set":t.avatarSrcSet,"avatar-alt":t.avatarAlt,"avatar-fit":t.avatarFit,"no-style":t.noStyle,class:e.normalizeClass({[`is-${t.role}`]:!0})},e.createSlots({_:2},[o.$slots.avatar?{name:"avatar",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"avatar",{item:t})]),key:"0"}:void 0,o.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"header",{item:t})]),key:"1"}:void 0,o.$slots.content?{name:"content",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"content",{item:t})]),key:"2"}:void 0,o.$slots.footer?{name:"footer",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"footer",{item:t})]),key:"3"}:void 0,o.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"loading",{item:t})]),key:"4"}:void 0]),1032,["content","placement","loading","shape","variant","is-markdown","is-fog","typing","max-width","avatar","avatar-size","avatar-gap","avatar-shape","avatar-src-set","avatar-alt","avatar-fit","no-style","class"])]),_:2},1032,["item","active","data-index","data-visible"])]),_:3},8,["items","key-field","scroll-parent"])):e.createCommentVNode("",!0)]),_:3},8,["always"])],4)):(e.openBlock(),e.createBlock(e.unref(S.VkScrollbar),{key:1,ref_key:"scrollbarRef",ref:r,class:"vk-bubble-list","append-to":n.scrollbarAppendTo,always:n.alwaysShowScrollbar,"hide-after":800,onScroll:g},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.list,(t,u)=>(e.openBlock(),e.createBlock(e.unref(C.Bubble),{key:t.key||u,content:t.content,placement:t.placement,loading:t.loading,shape:t.shape,variant:t.variant,"is-markdown":t.isMarkdown,"is-fog":t.isFog,typing:t.typing,"max-width":t.maxWidth,avatar:t.avatar,"avatar-size":t.avatarSize,"avatar-gap":t.avatarGap,"avatar-shape":t.avatarShape,"avatar-src-set":t.avatarSrcSet,"avatar-alt":t.avatarAlt,"avatar-fit":t.avatarFit,"no-style":t.noStyle,class:e.normalizeClass({[`is-${t.role}`]:!0})},e.createSlots({_:2},[o.$slots.avatar?{name:"avatar",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"avatar",{item:t})]),key:"0"}:void 0,o.$slots.header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"header",{item:t})]),key:"1"}:void 0,o.$slots.content?{name:"content",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"content",{item:t})]),key:"2"}:void 0,o.$slots.footer?{name:"footer",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"footer",{item:t})]),key:"3"}:void 0,o.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"loading",{item:t})]),key:"4"}:void 0]),1032,["content","placement","loading","shape","variant","is-markdown","is-fog","typing","max-width","avatar","avatar-size","avatar-gap","avatar-shape","avatar-src-set","avatar-alt","avatar-fit","no-style","class"]))),128))]),_:3},8,["append-to","always"])),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["vk-bubble-list-default-back-button",{"vk-bubble-list-back-to-bottom-solt":o.$slots.backToBottom}]),style:e.normalizeStyle({bottom:n.backButtonPosition.bottom,left:n.backButtonPosition.left}),onClick:y},[e.renderSlot(o.$slots,"backToBottom",{},()=>[e.createVNode(d,{class:"vk-bubble-list-back-to-bottom-icon",style:e.normalizeStyle({color:s.btnColor})},{default:e.withCtx(()=>[e.createVNode(e.unref(F.ArrowDownBold)),s.btnLoading?(e.openBlock(),e.createBlock(H,{key:0,class:"back-to-bottom-loading-svg-bg"})):e.createCommentVNode("",!0)]),_:1},8,["style"])])],6),[[e.vShow,T.value]])])}}}),_={items:{type:Array,default:()=>[]},elRef:{type:Function,default:N.noop},scrollbarAppendTo:null,virtual:{type:Boolean,default:!1},keyField:{type:String,default:"key"},autoScrollThreshold:{type:Number,default:200}},v=e.defineComponent({name:"VkBubbleList",inheritAttrs:!1,__name:"index",props:_,setup(n,{expose:f}){const s=n,r=e.ref();return e.watch(()=>s.elRef,a=>{a&&a(r.value)},{immediate:!0}),f({scrollToTop:()=>r.value?.scrollToTop(),scrollToBottom:()=>r.value?.scrollToBottom(),scrollToBubble:a=>r.value?.scrollToBubble(a),getItemOffset:a=>r.value?.getItemOffset(a),getVisibleRange:()=>r.value?.getVisibleRange()}),(a,h)=>(e.openBlock(),e.createBlock(e.unref(k.VkBubbleRenderTemplates),null,{placeholder:e.withCtx(()=>[e.createVNode(e.unref(k.VkBubbleTemplates))]),default:e.withCtx(()=>[e.renderSlot(a.$slots,"renderer"),e.createVNode(e.unref(P.ElAutoResizer),null,{default:e.withCtx(({height:b})=>[e.createVNode(G,e.mergeProps({ref_key:"bubbleListRef",ref:r,"btn-icon-size":18,"max-height":`${b}px`,"scrollbar-append-to":a.scrollbarAppendTo,virtual:a.virtual,"key-field":a.keyField,"auto-scroll-threshold":a.autoScrollThreshold,style:{"--el-bubble-list-max-height":`${b}px`},list:a.items},a.$attrs),e.createSlots({content:e.withCtx(({item:i})=>[e.createVNode(e.unref(k.VkBubbleRenderer),{source:[i]},null,8,["source"])]),_:2},[a.$slots.avatar?{name:"avatar",fn:e.withCtx(i=>[e.renderSlot(a.$slots,"avatar",e.normalizeProps(e.guardReactiveProps(i)))]),key:"0"}:void 0,a.$slots.header?{name:"header",fn:e.withCtx(i=>[e.renderSlot(a.$slots,"header",e.normalizeProps(e.guardReactiveProps(i)))]),key:"1"}:void 0,a.$slots.loading?{name:"loading",fn:e.withCtx(i=>[e.renderSlot(a.$slots,"loading",e.normalizeProps(e.guardReactiveProps(i)))]),key:"2"}:void 0,a.$slots.footer?{name:"footer",fn:e.withCtx(i=>[e.renderSlot(a.$slots,"footer",e.normalizeProps(e.guardReactiveProps(i)))]),key:"3"}:void 0]),1040,["max-height","scrollbar-append-to","virtual","key-field","auto-scroll-threshold","style","list"])]),_:3})]),_:3}))}}),j=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));v.install=n=>{n.component(v.name||"VkBubbleList",v)};Object.defineProperty(exports,"Role",{enumerable:!0,get:()=>A.Role});exports.VkBubbleList=v;exports.__VkBubbleList=j;exports.default=v;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { openBlock as
|
|
2
|
-
import { VkBubbleRenderTemplates as
|
|
3
|
-
import { ElAutoResizer as
|
|
4
|
-
import { DynamicScroller as
|
|
5
|
-
import { ArrowDownBold as
|
|
6
|
-
import { useResizeObserver as
|
|
7
|
-
import { VkScrollbar as
|
|
8
|
-
import { Bubble as
|
|
9
|
-
import { _ as
|
|
10
|
-
import { noop as
|
|
11
|
-
import { Role as
|
|
12
|
-
const
|
|
1
|
+
import { openBlock as v, createElementBlock as $, createStaticVNode as W, defineComponent as H, ref as y, onMounted as P, nextTick as E, watch as N, computed as Z, resolveComponent as U, normalizeStyle as F, createVNode as b, unref as f, withCtx as o, createBlock as k, normalizeClass as z, createSlots as V, renderSlot as i, createCommentVNode as L, Fragment as J, renderList as K, withDirectives as Q, createElementVNode as X, vShow as Y, mergeProps as ee, normalizeProps as S, guardReactiveProps as T } from "vue";
|
|
2
|
+
import { VkBubbleRenderTemplates as te, VkBubbleRenderer as ae, VkBubbleTemplates as oe } from "@vunk/plus/components/bubble-templates";
|
|
3
|
+
import { ElAutoResizer as le } from "element-plus";
|
|
4
|
+
import { DynamicScroller as re, DynamicScrollerItem as se } from "@vunk/plus/vue-virtual-scroller";
|
|
5
|
+
import { ArrowDownBold as ne } from "@element-plus/icons-vue";
|
|
6
|
+
import { useResizeObserver as ie } from "@vueuse/core";
|
|
7
|
+
import { VkScrollbar as O } from "@vunk/plus/components/scrollbar";
|
|
8
|
+
import { Bubble as G } from "@vunk/plus/element/bubble";
|
|
9
|
+
import { _ as ue } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
10
|
+
import { noop as ce } from "@vunk/shared/function";
|
|
11
|
+
import { Role as Ve } from "@vunk/plus/components/agent-chat-provider";
|
|
12
|
+
const de = {}, fe = {
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
14
|
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
15
15
|
version: "1.1",
|
|
@@ -17,12 +17,12 @@ const se = {}, ne = {
|
|
|
17
17
|
height: "704",
|
|
18
18
|
viewBox: "0 0 704 704"
|
|
19
19
|
};
|
|
20
|
-
function
|
|
21
|
-
return
|
|
22
|
-
|
|
20
|
+
function pe(s, m) {
|
|
21
|
+
return v(), $("svg", fe, [...m[0] || (m[0] = [
|
|
22
|
+
W('<defs><filter id="master_svg0_62_10054" filterUnits="objectBoundingBox" color-interpolation-filters="sRGB" x="-0.030120481927710843" y="-0.030120481927710843" width="1.0602409638554218" height="1.0602409638554218"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5" result="effect1_foregroundBlur"></feGaussianBlur></filter><linearGradient id="master_svg1_62_10082" x1="0.5" y1="-0.13192443549633026" x2="0.42319029569625854" y2="1.368432641029358"><stop offset="9.145302325487137%" stop-color="currentColor" stop-opacity="1"></stop><stop offset="13.636428117752075%" stop-color="currentColor" stop-opacity="0.07539999485015869"></stop><stop offset="16.968481242656708%" stop-color="currentColor" stop-opacity="0"></stop></linearGradient></defs><g transform="matrix(0,1,-1,0,704,-664)" filter="url(#master_svg0_62_10054)"><path d="M1016,684C1199.359,684,1348,535.359,1348,352C1348,168.641,1199.359,20,1016,20C832.641,20,684,168.641,684,352C684,535.359,832.641,684,1016,684ZM1016,32C1192.731,32,1336,175.269,1336,352C1336,528.731,1192.731,672,1016,672C839.269,672,696,528.731,696,352C696,175.269,839.269,32,1016,32Z" fill-rule="evenodd" fill="url(#master_svg1_62_10082)" fill-opacity="1"></path></g>', 2)
|
|
23
23
|
])]);
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const ve = /* @__PURE__ */ ue(de, [["render", pe]]), be = { class: "vk-bubble-list-wrapper" }, me = /* @__PURE__ */ H({
|
|
26
26
|
__name: "index",
|
|
27
27
|
props: {
|
|
28
28
|
list: {
|
|
@@ -90,114 +90,172 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
|
|
|
90
90
|
emits: {
|
|
91
91
|
complete: null
|
|
92
92
|
},
|
|
93
|
-
setup(
|
|
94
|
-
const
|
|
95
|
-
function
|
|
93
|
+
setup(s, { expose: m }) {
|
|
94
|
+
const n = s, r = y(), a = y(), w = y();
|
|
95
|
+
function g() {
|
|
96
96
|
document.documentElement.style.setProperty(
|
|
97
97
|
"--el-bubble-list-max-height",
|
|
98
|
-
|
|
98
|
+
n.maxHeight || "100%"
|
|
99
99
|
), document.documentElement.style.setProperty(
|
|
100
100
|
"--el-bubble-list-btn-size",
|
|
101
|
-
`${
|
|
101
|
+
`${n.btnIconSize}px`
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const t =
|
|
107
|
-
t && (
|
|
108
|
-
}), setTimeout(
|
|
104
|
+
P(() => {
|
|
105
|
+
g(), n.virtual && E(() => {
|
|
106
|
+
const t = r.value?.wrapRef;
|
|
107
|
+
t && (w.value = t);
|
|
108
|
+
}), setTimeout(B);
|
|
109
109
|
}), N(
|
|
110
|
-
() => [
|
|
111
|
-
() =>
|
|
110
|
+
() => [n.maxHeight, n.btnIconSize],
|
|
111
|
+
() => g()
|
|
112
112
|
);
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
const u = y(), q = Z(() => n.showBackButton && u.value !== void 0 && u.value > n.backButtonThreshold);
|
|
114
|
+
let h = !1;
|
|
115
|
+
function B() {
|
|
116
|
+
const t = r.value?.wrapRef;
|
|
116
117
|
if (t)
|
|
117
|
-
return
|
|
118
|
+
return u.value = t.scrollHeight - t.scrollTop - t.clientHeight, u.value;
|
|
118
119
|
}
|
|
119
|
-
function
|
|
120
|
-
if (
|
|
120
|
+
function R() {
|
|
121
|
+
if (n.virtual) {
|
|
121
122
|
a.value?.scrollToBottom();
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
124
|
-
|
|
125
|
+
r.value?.scrollToBottom();
|
|
125
126
|
}
|
|
126
|
-
function
|
|
127
|
-
if (
|
|
127
|
+
function M() {
|
|
128
|
+
if (n.virtual) {
|
|
128
129
|
a.value?.scrollToItem(0);
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
|
-
|
|
132
|
+
r.value?.scrollToTop();
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
async function x(t) {
|
|
135
|
+
if (n.virtual) {
|
|
136
|
+
const l = r.value?.wrapRef;
|
|
137
|
+
if (!l) return;
|
|
138
|
+
h = !0;
|
|
139
|
+
try {
|
|
140
|
+
const p = l.querySelector(
|
|
141
|
+
`[data-index="${t}"][data-visible="true"] .el-bubble`
|
|
142
|
+
);
|
|
143
|
+
if (p) {
|
|
144
|
+
const d = l.getBoundingClientRect(), c = p.getBoundingClientRect();
|
|
145
|
+
l.scrollTo({
|
|
146
|
+
top: c.top - d.top + l.scrollTop - 24,
|
|
147
|
+
behavior: "auto"
|
|
148
|
+
});
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
let e = 0;
|
|
152
|
+
for (; e < t; ) {
|
|
153
|
+
const d = a.value?.getItemOffset(e + 1) ?? 0;
|
|
154
|
+
l.scrollTo({ top: d, behavior: "auto" }), await new Promise((c) => {
|
|
155
|
+
requestAnimationFrame(() => {
|
|
156
|
+
requestAnimationFrame(() => c());
|
|
157
|
+
});
|
|
158
|
+
}), e = Math.min(e + 20, t);
|
|
159
|
+
}
|
|
160
|
+
for (const d of [1, 2]) {
|
|
161
|
+
a.value?.scrollToItem(t), await new Promise((C) => {
|
|
162
|
+
requestAnimationFrame(() => {
|
|
163
|
+
requestAnimationFrame(() => C());
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
const c = l.querySelector(
|
|
167
|
+
`[data-index="${t}"][data-visible="true"] .el-bubble`
|
|
168
|
+
);
|
|
169
|
+
if (c) {
|
|
170
|
+
const C = l.getBoundingClientRect(), _ = c.getBoundingClientRect();
|
|
171
|
+
l.scrollTo({
|
|
172
|
+
top: _.top - C.top + l.scrollTop - 24,
|
|
173
|
+
behavior: "auto"
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
} finally {
|
|
178
|
+
h = !1;
|
|
179
|
+
}
|
|
140
180
|
return;
|
|
141
181
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
182
|
+
h = !0;
|
|
183
|
+
try {
|
|
184
|
+
const l = r.value?.wrapRef;
|
|
185
|
+
if (!l) return;
|
|
186
|
+
const p = l.querySelectorAll(".el-bubble");
|
|
187
|
+
if (t >= p.length) return;
|
|
188
|
+
const e = p[t], d = l.getBoundingClientRect(), c = e.getBoundingClientRect();
|
|
189
|
+
l.scrollTo({
|
|
190
|
+
top: c.top - d.top + l.scrollTop,
|
|
191
|
+
behavior: "smooth"
|
|
192
|
+
});
|
|
193
|
+
} finally {
|
|
194
|
+
h = !1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function D(t) {
|
|
198
|
+
return a.value?.getItemOffset(t);
|
|
199
|
+
}
|
|
200
|
+
function j() {
|
|
201
|
+
const t = a.value, l = r.value?.wrapRef;
|
|
202
|
+
if (!t || !l) return;
|
|
203
|
+
const p = l.scrollTop, e = l.clientHeight, d = t.findItemIndex(p), c = t.findItemIndex(p + e);
|
|
204
|
+
return { start: d, end: c };
|
|
151
205
|
}
|
|
152
|
-
const A =
|
|
153
|
-
return
|
|
154
|
-
|
|
155
|
-
A.value =
|
|
206
|
+
const A = y();
|
|
207
|
+
return P(() => {
|
|
208
|
+
E(() => {
|
|
209
|
+
A.value = r.value?.wrapRef?.firstElementChild;
|
|
156
210
|
});
|
|
157
|
-
}),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
211
|
+
}), n.autoScroll && ie(A, () => {
|
|
212
|
+
if (h) return;
|
|
213
|
+
const t = B();
|
|
214
|
+
t !== void 0 && t > n.autoScrollThreshold || R();
|
|
215
|
+
}), m({
|
|
216
|
+
scrollToTop: M,
|
|
217
|
+
scrollToBottom: R,
|
|
218
|
+
scrollToBubble: x,
|
|
219
|
+
getItemOffset: D,
|
|
220
|
+
getVisibleRange: j
|
|
221
|
+
}), (t, l) => {
|
|
222
|
+
const p = U("el-icon");
|
|
223
|
+
return v(), $("div", be, [
|
|
224
|
+
s.virtual ? (v(), $("div", {
|
|
168
225
|
key: 0,
|
|
169
226
|
class: "vk-bubble-list-virtual-host",
|
|
170
|
-
style:
|
|
227
|
+
style: F({ height: s.maxHeight || "100%" })
|
|
171
228
|
}, [
|
|
172
|
-
|
|
229
|
+
b(f(O), {
|
|
173
230
|
ref_key: "scrollbarRef",
|
|
174
|
-
ref:
|
|
231
|
+
ref: r,
|
|
175
232
|
class: "vk-bubble-list-virtual-scrollbar",
|
|
176
|
-
always:
|
|
233
|
+
always: s.alwaysShowScrollbar,
|
|
177
234
|
"hide-after": 800,
|
|
178
|
-
onScroll:
|
|
235
|
+
onScroll: B
|
|
179
236
|
}, {
|
|
180
237
|
default: o(() => [
|
|
181
|
-
|
|
238
|
+
w.value ? (v(), k(f(re), {
|
|
182
239
|
key: 0,
|
|
183
240
|
ref_key: "scrollerRef",
|
|
184
241
|
ref: a,
|
|
185
|
-
items:
|
|
242
|
+
items: s.list,
|
|
186
243
|
"min-item-size": 54,
|
|
187
|
-
"key-field":
|
|
244
|
+
"key-field": s.keyField,
|
|
188
245
|
"page-mode": !0,
|
|
189
|
-
"scroll-parent":
|
|
246
|
+
"scroll-parent": w.value,
|
|
190
247
|
class: "vk-bubble-list-dynamic-scroller"
|
|
191
248
|
}, {
|
|
192
|
-
default: o(({ item: e, index:
|
|
193
|
-
|
|
249
|
+
default: o(({ item: e, index: d, active: c }) => [
|
|
250
|
+
b(f(se), {
|
|
194
251
|
item: e,
|
|
195
|
-
active:
|
|
196
|
-
"data-index":
|
|
252
|
+
active: c,
|
|
253
|
+
"data-index": d,
|
|
254
|
+
"data-visible": c,
|
|
197
255
|
class: "vk-bubble-list-virtual-item"
|
|
198
256
|
}, {
|
|
199
257
|
default: o(() => [
|
|
200
|
-
|
|
258
|
+
b(f(G), {
|
|
201
259
|
content: e.content,
|
|
202
260
|
placement: e.placement,
|
|
203
261
|
loading: e.loading,
|
|
@@ -215,68 +273,68 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
|
|
|
215
273
|
"avatar-alt": e.avatarAlt,
|
|
216
274
|
"avatar-fit": e.avatarFit,
|
|
217
275
|
"no-style": e.noStyle,
|
|
218
|
-
class:
|
|
276
|
+
class: z({
|
|
219
277
|
[`is-${e.role}`]: !0
|
|
220
278
|
})
|
|
221
|
-
},
|
|
279
|
+
}, V({ _: 2 }, [
|
|
222
280
|
t.$slots.avatar ? {
|
|
223
281
|
name: "avatar",
|
|
224
282
|
fn: o(() => [
|
|
225
|
-
|
|
283
|
+
i(t.$slots, "avatar", { item: e })
|
|
226
284
|
]),
|
|
227
285
|
key: "0"
|
|
228
286
|
} : void 0,
|
|
229
287
|
t.$slots.header ? {
|
|
230
288
|
name: "header",
|
|
231
289
|
fn: o(() => [
|
|
232
|
-
|
|
290
|
+
i(t.$slots, "header", { item: e })
|
|
233
291
|
]),
|
|
234
292
|
key: "1"
|
|
235
293
|
} : void 0,
|
|
236
294
|
t.$slots.content ? {
|
|
237
295
|
name: "content",
|
|
238
296
|
fn: o(() => [
|
|
239
|
-
|
|
297
|
+
i(t.$slots, "content", { item: e })
|
|
240
298
|
]),
|
|
241
299
|
key: "2"
|
|
242
300
|
} : void 0,
|
|
243
301
|
t.$slots.footer ? {
|
|
244
302
|
name: "footer",
|
|
245
303
|
fn: o(() => [
|
|
246
|
-
|
|
304
|
+
i(t.$slots, "footer", { item: e })
|
|
247
305
|
]),
|
|
248
306
|
key: "3"
|
|
249
307
|
} : void 0,
|
|
250
308
|
t.$slots.loading ? {
|
|
251
309
|
name: "loading",
|
|
252
310
|
fn: o(() => [
|
|
253
|
-
|
|
311
|
+
i(t.$slots, "loading", { item: e })
|
|
254
312
|
]),
|
|
255
313
|
key: "4"
|
|
256
314
|
} : void 0
|
|
257
315
|
]), 1032, ["content", "placement", "loading", "shape", "variant", "is-markdown", "is-fog", "typing", "max-width", "avatar", "avatar-size", "avatar-gap", "avatar-shape", "avatar-src-set", "avatar-alt", "avatar-fit", "no-style", "class"])
|
|
258
316
|
]),
|
|
259
317
|
_: 2
|
|
260
|
-
}, 1032, ["item", "active", "data-index"])
|
|
318
|
+
}, 1032, ["item", "active", "data-index", "data-visible"])
|
|
261
319
|
]),
|
|
262
320
|
_: 3
|
|
263
|
-
}, 8, ["items", "key-field", "scroll-parent"])) :
|
|
321
|
+
}, 8, ["items", "key-field", "scroll-parent"])) : L("", !0)
|
|
264
322
|
]),
|
|
265
323
|
_: 3
|
|
266
324
|
}, 8, ["always"])
|
|
267
|
-
], 4)) : (
|
|
325
|
+
], 4)) : (v(), k(f(O), {
|
|
268
326
|
key: 1,
|
|
269
327
|
ref_key: "scrollbarRef",
|
|
270
|
-
ref:
|
|
328
|
+
ref: r,
|
|
271
329
|
class: "vk-bubble-list",
|
|
272
|
-
"append-to":
|
|
273
|
-
always:
|
|
330
|
+
"append-to": s.scrollbarAppendTo,
|
|
331
|
+
always: s.alwaysShowScrollbar,
|
|
274
332
|
"hide-after": 800,
|
|
275
|
-
onScroll:
|
|
333
|
+
onScroll: B
|
|
276
334
|
}, {
|
|
277
335
|
default: o(() => [
|
|
278
|
-
(
|
|
279
|
-
key: e.key ||
|
|
336
|
+
(v(!0), $(J, null, K(s.list, (e, d) => (v(), k(f(G), {
|
|
337
|
+
key: e.key || d,
|
|
280
338
|
content: e.content,
|
|
281
339
|
placement: e.placement,
|
|
282
340
|
loading: e.loading,
|
|
@@ -294,42 +352,42 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
|
|
|
294
352
|
"avatar-alt": e.avatarAlt,
|
|
295
353
|
"avatar-fit": e.avatarFit,
|
|
296
354
|
"no-style": e.noStyle,
|
|
297
|
-
class:
|
|
355
|
+
class: z({
|
|
298
356
|
[`is-${e.role}`]: !0
|
|
299
357
|
})
|
|
300
|
-
},
|
|
358
|
+
}, V({ _: 2 }, [
|
|
301
359
|
t.$slots.avatar ? {
|
|
302
360
|
name: "avatar",
|
|
303
361
|
fn: o(() => [
|
|
304
|
-
|
|
362
|
+
i(t.$slots, "avatar", { item: e })
|
|
305
363
|
]),
|
|
306
364
|
key: "0"
|
|
307
365
|
} : void 0,
|
|
308
366
|
t.$slots.header ? {
|
|
309
367
|
name: "header",
|
|
310
368
|
fn: o(() => [
|
|
311
|
-
|
|
369
|
+
i(t.$slots, "header", { item: e })
|
|
312
370
|
]),
|
|
313
371
|
key: "1"
|
|
314
372
|
} : void 0,
|
|
315
373
|
t.$slots.content ? {
|
|
316
374
|
name: "content",
|
|
317
375
|
fn: o(() => [
|
|
318
|
-
|
|
376
|
+
i(t.$slots, "content", { item: e })
|
|
319
377
|
]),
|
|
320
378
|
key: "2"
|
|
321
379
|
} : void 0,
|
|
322
380
|
t.$slots.footer ? {
|
|
323
381
|
name: "footer",
|
|
324
382
|
fn: o(() => [
|
|
325
|
-
|
|
383
|
+
i(t.$slots, "footer", { item: e })
|
|
326
384
|
]),
|
|
327
385
|
key: "3"
|
|
328
386
|
} : void 0,
|
|
329
387
|
t.$slots.loading ? {
|
|
330
388
|
name: "loading",
|
|
331
389
|
fn: o(() => [
|
|
332
|
-
|
|
390
|
+
i(t.$slots, "loading", { item: e })
|
|
333
391
|
]),
|
|
334
392
|
key: "4"
|
|
335
393
|
} : void 0
|
|
@@ -337,45 +395,45 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
|
|
|
337
395
|
]),
|
|
338
396
|
_: 3
|
|
339
397
|
}, 8, ["append-to", "always"])),
|
|
340
|
-
|
|
341
|
-
class:
|
|
398
|
+
Q(X("div", {
|
|
399
|
+
class: z(["vk-bubble-list-default-back-button", {
|
|
342
400
|
"vk-bubble-list-back-to-bottom-solt": t.$slots.backToBottom
|
|
343
401
|
}]),
|
|
344
|
-
style:
|
|
345
|
-
bottom:
|
|
346
|
-
left:
|
|
402
|
+
style: F({
|
|
403
|
+
bottom: s.backButtonPosition.bottom,
|
|
404
|
+
left: s.backButtonPosition.left
|
|
347
405
|
}),
|
|
348
|
-
onClick:
|
|
406
|
+
onClick: R
|
|
349
407
|
}, [
|
|
350
|
-
|
|
351
|
-
|
|
408
|
+
i(t.$slots, "backToBottom", {}, () => [
|
|
409
|
+
b(p, {
|
|
352
410
|
class: "vk-bubble-list-back-to-bottom-icon",
|
|
353
|
-
style:
|
|
411
|
+
style: F({ color: n.btnColor })
|
|
354
412
|
}, {
|
|
355
413
|
default: o(() => [
|
|
356
|
-
|
|
357
|
-
|
|
414
|
+
b(f(ne)),
|
|
415
|
+
n.btnLoading ? (v(), k(ve, {
|
|
358
416
|
key: 0,
|
|
359
417
|
class: "back-to-bottom-loading-svg-bg"
|
|
360
|
-
})) :
|
|
418
|
+
})) : L("", !0)
|
|
361
419
|
]),
|
|
362
420
|
_: 1
|
|
363
421
|
}, 8, ["style"])
|
|
364
422
|
])
|
|
365
423
|
], 6), [
|
|
366
|
-
[
|
|
424
|
+
[Y, q.value]
|
|
367
425
|
])
|
|
368
426
|
]);
|
|
369
427
|
};
|
|
370
428
|
}
|
|
371
|
-
}),
|
|
429
|
+
}), ye = {
|
|
372
430
|
items: {
|
|
373
431
|
type: Array,
|
|
374
432
|
default: () => []
|
|
375
433
|
},
|
|
376
434
|
elRef: {
|
|
377
435
|
type: Function,
|
|
378
|
-
default:
|
|
436
|
+
default: ce
|
|
379
437
|
},
|
|
380
438
|
scrollbarAppendTo: null,
|
|
381
439
|
virtual: {
|
|
@@ -394,73 +452,75 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
|
|
|
394
452
|
type: Number,
|
|
395
453
|
default: 200
|
|
396
454
|
}
|
|
397
|
-
},
|
|
455
|
+
}, I = /* @__PURE__ */ H({
|
|
398
456
|
name: "VkBubbleList",
|
|
399
457
|
inheritAttrs: !1,
|
|
400
458
|
__name: "index",
|
|
401
|
-
props:
|
|
402
|
-
setup(
|
|
403
|
-
const
|
|
404
|
-
return N(() =>
|
|
405
|
-
a && a(
|
|
406
|
-
}, { immediate: !0 }),
|
|
407
|
-
scrollToTop: () =>
|
|
408
|
-
scrollToBottom: () =>
|
|
409
|
-
scrollToBubble: (a) =>
|
|
410
|
-
|
|
459
|
+
props: ye,
|
|
460
|
+
setup(s, { expose: m }) {
|
|
461
|
+
const n = s, r = y();
|
|
462
|
+
return N(() => n.elRef, (a) => {
|
|
463
|
+
a && a(r.value);
|
|
464
|
+
}, { immediate: !0 }), m({
|
|
465
|
+
scrollToTop: () => r.value?.scrollToTop(),
|
|
466
|
+
scrollToBottom: () => r.value?.scrollToBottom(),
|
|
467
|
+
scrollToBubble: (a) => r.value?.scrollToBubble(a),
|
|
468
|
+
getItemOffset: (a) => r.value?.getItemOffset(a),
|
|
469
|
+
getVisibleRange: () => r.value?.getVisibleRange()
|
|
470
|
+
}), (a, w) => (v(), k(f(te), null, {
|
|
411
471
|
placeholder: o(() => [
|
|
412
|
-
|
|
472
|
+
b(f(oe))
|
|
413
473
|
]),
|
|
414
474
|
default: o(() => [
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
default: o(({ height:
|
|
418
|
-
|
|
475
|
+
i(a.$slots, "renderer"),
|
|
476
|
+
b(f(le), null, {
|
|
477
|
+
default: o(({ height: g }) => [
|
|
478
|
+
b(me, ee({
|
|
419
479
|
ref_key: "bubbleListRef",
|
|
420
|
-
ref:
|
|
480
|
+
ref: r,
|
|
421
481
|
"btn-icon-size": 18,
|
|
422
|
-
"max-height": `${
|
|
482
|
+
"max-height": `${g}px`,
|
|
423
483
|
"scrollbar-append-to": a.scrollbarAppendTo,
|
|
424
484
|
virtual: a.virtual,
|
|
425
485
|
"key-field": a.keyField,
|
|
426
486
|
"auto-scroll-threshold": a.autoScrollThreshold,
|
|
427
487
|
style: {
|
|
428
|
-
"--el-bubble-list-max-height": `${
|
|
488
|
+
"--el-bubble-list-max-height": `${g}px`
|
|
429
489
|
},
|
|
430
490
|
list: a.items
|
|
431
|
-
}, a.$attrs),
|
|
432
|
-
content: o(({ item:
|
|
433
|
-
|
|
434
|
-
source: [
|
|
491
|
+
}, a.$attrs), V({
|
|
492
|
+
content: o(({ item: u }) => [
|
|
493
|
+
b(f(ae), {
|
|
494
|
+
source: [u]
|
|
435
495
|
}, null, 8, ["source"])
|
|
436
496
|
]),
|
|
437
497
|
_: 2
|
|
438
498
|
}, [
|
|
439
499
|
a.$slots.avatar ? {
|
|
440
500
|
name: "avatar",
|
|
441
|
-
fn: o((
|
|
442
|
-
|
|
501
|
+
fn: o((u) => [
|
|
502
|
+
i(a.$slots, "avatar", S(T(u)))
|
|
443
503
|
]),
|
|
444
504
|
key: "0"
|
|
445
505
|
} : void 0,
|
|
446
506
|
a.$slots.header ? {
|
|
447
507
|
name: "header",
|
|
448
|
-
fn: o((
|
|
449
|
-
|
|
508
|
+
fn: o((u) => [
|
|
509
|
+
i(a.$slots, "header", S(T(u)))
|
|
450
510
|
]),
|
|
451
511
|
key: "1"
|
|
452
512
|
} : void 0,
|
|
453
513
|
a.$slots.loading ? {
|
|
454
514
|
name: "loading",
|
|
455
|
-
fn: o((
|
|
456
|
-
|
|
515
|
+
fn: o((u) => [
|
|
516
|
+
i(a.$slots, "loading", S(T(u)))
|
|
457
517
|
]),
|
|
458
518
|
key: "2"
|
|
459
519
|
} : void 0,
|
|
460
520
|
a.$slots.footer ? {
|
|
461
521
|
name: "footer",
|
|
462
|
-
fn: o((
|
|
463
|
-
|
|
522
|
+
fn: o((u) => [
|
|
523
|
+
i(a.$slots, "footer", S(T(u)))
|
|
464
524
|
]),
|
|
465
525
|
key: "3"
|
|
466
526
|
} : void 0
|
|
@@ -472,15 +532,15 @@ const ue = /* @__PURE__ */ le(se, [["render", ie]]), ce = { class: "vk-bubble-li
|
|
|
472
532
|
_: 3
|
|
473
533
|
}));
|
|
474
534
|
}
|
|
475
|
-
}),
|
|
535
|
+
}), Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
476
536
|
__proto__: null
|
|
477
537
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
478
|
-
|
|
479
|
-
|
|
538
|
+
I.install = (s) => {
|
|
539
|
+
s.component(I.name || "VkBubbleList", I);
|
|
480
540
|
};
|
|
481
541
|
export {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
542
|
+
Ve as Role,
|
|
543
|
+
I as VkBubbleList,
|
|
544
|
+
Fe as __VkBubbleList,
|
|
545
|
+
I as default
|
|
486
546
|
};
|
|
@@ -2,7 +2,17 @@ import type { __VkAgentChatProvider } from '@vunk/plus/components/agent-chat-pro
|
|
|
2
2
|
import type { PropType, TeleportProps } from 'vue';
|
|
3
3
|
declare function scrollToBottom(): void;
|
|
4
4
|
declare function scrollToTop(): void;
|
|
5
|
-
declare function scrollToBubble(index: number): void
|
|
5
|
+
declare function scrollToBubble(index: number): Promise<void>;
|
|
6
|
+
/** 获取指定 index 在内容空间中的偏移量(像素),未测量过的 item 返回估算值 */
|
|
7
|
+
declare function getItemOffset(index: number): number | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* 获取当前可见范围(index 区间),用于大纲导航高亮当前项。
|
|
10
|
+
* 基于 findItemIndex + getItemOffset 估算,非实时精确值。
|
|
11
|
+
*/
|
|
12
|
+
declare function getVisibleRange(): {
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
} | undefined;
|
|
6
16
|
declare var __VLS_33: {
|
|
7
17
|
item: __VkAgentChatProvider.BubbleItem;
|
|
8
18
|
}, __VLS_36: {
|
|
@@ -119,6 +129,8 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
119
129
|
scrollToTop: typeof scrollToTop;
|
|
120
130
|
scrollToBottom: typeof scrollToBottom;
|
|
121
131
|
scrollToBubble: typeof scrollToBubble;
|
|
132
|
+
getItemOffset: typeof getItemOffset;
|
|
133
|
+
getVisibleRange: typeof getVisibleRange;
|
|
122
134
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
123
135
|
complete: ((...args: unknown[]) => void) & ((...args: any[]) => void);
|
|
124
136
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -58,7 +58,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
58
58
|
}>, {
|
|
59
59
|
scrollToTop: () => void;
|
|
60
60
|
scrollToBottom: () => void;
|
|
61
|
-
scrollToBubble: (index: number) => void
|
|
61
|
+
scrollToBubble: (index: number) => Promise<void>;
|
|
62
|
+
getItemOffset: (index: number) => number;
|
|
63
|
+
getVisibleRange: () => {
|
|
64
|
+
start: number;
|
|
65
|
+
end: number;
|
|
66
|
+
};
|
|
62
67
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
68
|
items: {
|
|
64
69
|
type: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),k=require("@vunk/core/components/wrapper"),n=require("element-plus"),v=require("@vunk/core/shared/utils-vue"),C=v.bindPropsFactory(n.textProps),_=v.bindPropsFactory(n.useTooltipProps),b={...n.textProps,...n.useTooltipProps},c=e.defineComponent({name:"ElText",inheritAttrs:!1,__name:"index",props:b,setup(u){const o=u,T=C(o),x=_(o,["content"]),f=t=>t===void 0,s=e.ref(),P=n.useFormSize(),r=n.useNamespace("text"),d=e.ref(!1),p=e.ref(""),y=e.computed(()=>[r.b(),r.m(o.type),r.m(P.value),r.is("truncated",o.truncated),r.is("line-clamp",!f(o.lineClamp))]);function m(){p.value=s.value?.textContent??""}function g(){if(e.useAttrs().title)return;let a=!1;if(o.truncated){const l=s.value?.offsetWidth,i=s.value?.scrollWidth;l&&i&&i>l&&(a=!0)}else if(!f(o.lineClamp)){const l=s.value?.offsetHeight,i=s.value?.scrollHeight;l&&i&&i>l&&(a=!0)}d.value=a}function h(){m(),g()}return e.onMounted(h),e.onUpdated(h),(t,a)=>(e.openBlock(),e.createBlock(e.unref(k.VkWrapper),e.mergeProps({is:e.unref(n.ElTooltip),show:d.value,content:p.value},e.unref(x),{onBeforeShow:m}),e.createSlots({default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.tag),e.mergeProps({ref_key:"textRef",ref:s,class:y.value,style:{"-webkit-line-clamp":t.lineClamp}},{...e.unref(T),...t.$attrs}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16,["class","style"]))]),_:2},[t.$slots.content?{name:"content",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"content",{content:p.value})]),key:"0"}:void 0]),1040,["is","show","content"]))}}),S=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));c.install=u=>{u.component(c.name||"VkText",c)};exports.VkText=c;exports.__VkText=S;exports.default=c;
|
|
@@ -1,53 +1,59 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { VkWrapper as
|
|
3
|
-
import { textProps as
|
|
4
|
-
import { bindPropsFactory as
|
|
5
|
-
const
|
|
6
|
-
...
|
|
7
|
-
...
|
|
8
|
-
},
|
|
1
|
+
import { defineComponent as V, ref as p, computed as W, onMounted as $, onUpdated as z, openBlock as T, createBlock as x, unref as i, mergeProps as y, createSlots as A, withCtx as u, resolveDynamicComponent as H, renderSlot as k, useAttrs as j } from "vue";
|
|
2
|
+
import { VkWrapper as E } from "@vunk/core/components/wrapper";
|
|
3
|
+
import { textProps as C, useTooltipProps as P, useFormSize as F, useNamespace as M, ElTooltip as O } from "element-plus";
|
|
4
|
+
import { bindPropsFactory as _ } from "@vunk/core/shared/utils-vue";
|
|
5
|
+
const R = _(C), U = _(P), D = {
|
|
6
|
+
...C,
|
|
7
|
+
...P
|
|
8
|
+
}, f = /* @__PURE__ */ V({
|
|
9
9
|
name: "ElText",
|
|
10
10
|
inheritAttrs: !1,
|
|
11
11
|
__name: "index",
|
|
12
|
-
props:
|
|
12
|
+
props: D,
|
|
13
13
|
setup(a) {
|
|
14
|
-
const e = a,
|
|
14
|
+
const e = a, g = R(e), b = U(e, ["content"]), d = (t) => t === void 0, o = p(), S = F(), n = M("text"), m = p(!1), c = p(""), w = W(() => [
|
|
15
15
|
n.b(),
|
|
16
16
|
n.m(e.type),
|
|
17
|
-
n.m(
|
|
17
|
+
n.m(S.value),
|
|
18
18
|
n.is("truncated", e.truncated),
|
|
19
|
-
n.is("line-clamp", !
|
|
19
|
+
n.is("line-clamp", !d(e.lineClamp))
|
|
20
20
|
]);
|
|
21
|
-
function
|
|
22
|
-
|
|
21
|
+
function h() {
|
|
22
|
+
c.value = o.value?.textContent ?? "";
|
|
23
|
+
}
|
|
24
|
+
function B() {
|
|
25
|
+
if (j().title)
|
|
23
26
|
return;
|
|
24
|
-
let
|
|
27
|
+
let r = !1;
|
|
25
28
|
if (e.truncated) {
|
|
26
29
|
const s = o.value?.offsetWidth, l = o.value?.scrollWidth;
|
|
27
|
-
s && l && l > s && (
|
|
28
|
-
} else if (!
|
|
30
|
+
s && l && l > s && (r = !0);
|
|
31
|
+
} else if (!d(e.lineClamp)) {
|
|
29
32
|
const s = o.value?.offsetHeight, l = o.value?.scrollHeight;
|
|
30
|
-
s && l && l > s && (
|
|
33
|
+
s && l && l > s && (r = !0);
|
|
31
34
|
}
|
|
32
|
-
|
|
35
|
+
m.value = r;
|
|
36
|
+
}
|
|
37
|
+
function v() {
|
|
38
|
+
h(), B();
|
|
33
39
|
}
|
|
34
|
-
return
|
|
35
|
-
is:
|
|
36
|
-
show:
|
|
37
|
-
content:
|
|
38
|
-
},
|
|
39
|
-
default:
|
|
40
|
-
(
|
|
40
|
+
return $(v), z(v), (t, r) => (T(), x(i(E), y({
|
|
41
|
+
is: i(O),
|
|
42
|
+
show: m.value,
|
|
43
|
+
content: c.value
|
|
44
|
+
}, i(b), { onBeforeShow: h }), A({
|
|
45
|
+
default: u(() => [
|
|
46
|
+
(T(), x(H(t.tag), y({
|
|
41
47
|
ref_key: "textRef",
|
|
42
48
|
ref: o,
|
|
43
|
-
class:
|
|
49
|
+
class: w.value,
|
|
44
50
|
style: { "-webkit-line-clamp": t.lineClamp }
|
|
45
51
|
}, {
|
|
46
|
-
...
|
|
52
|
+
...i(g),
|
|
47
53
|
...t.$attrs
|
|
48
54
|
}), {
|
|
49
|
-
default:
|
|
50
|
-
|
|
55
|
+
default: u(() => [
|
|
56
|
+
k(t.$slots, "default")
|
|
51
57
|
]),
|
|
52
58
|
_: 3
|
|
53
59
|
}, 16, ["class", "style"]))
|
|
@@ -56,23 +62,21 @@ const F = P(y), M = P(k), O = {
|
|
|
56
62
|
}, [
|
|
57
63
|
t.$slots.content ? {
|
|
58
64
|
name: "content",
|
|
59
|
-
fn:
|
|
60
|
-
|
|
61
|
-
content: o.value?.textContent
|
|
62
|
-
})
|
|
65
|
+
fn: u(() => [
|
|
66
|
+
k(t.$slots, "content", { content: c.value })
|
|
63
67
|
]),
|
|
64
68
|
key: "0"
|
|
65
69
|
} : void 0
|
|
66
70
|
]), 1040, ["is", "show", "content"]));
|
|
67
71
|
}
|
|
68
|
-
}),
|
|
72
|
+
}), I = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
69
73
|
__proto__: null
|
|
70
74
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
71
|
-
|
|
72
|
-
a.component(
|
|
75
|
+
f.install = (a) => {
|
|
76
|
+
a.component(f.name || "VkText", f);
|
|
73
77
|
};
|
|
74
78
|
export {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
f as VkText,
|
|
80
|
+
I as __VkText,
|
|
81
|
+
f as default
|
|
78
82
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
declare var
|
|
1
|
+
declare var __VLS_18: {}, __VLS_21: {
|
|
2
2
|
content: string;
|
|
3
3
|
};
|
|
4
4
|
type __VLS_Slots = {} & {
|
|
5
|
-
default?: (props: typeof
|
|
5
|
+
default?: (props: typeof __VLS_18) => any;
|
|
6
6
|
} & {
|
|
7
|
-
content?: (props: typeof
|
|
7
|
+
content?: (props: typeof __VLS_21) => any;
|
|
8
8
|
};
|
|
9
9
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
10
10
|
showArrow: import("element-plus/es/utils/vue/props/types.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
|