vue-devui 1.6.36-alpha.0 → 1.6.36-alpha.2
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/auto-complete/index.es.js +17 -0
- package/auto-complete/index.umd.js +17 -17
- package/breadcrumb/index.es.js +17 -0
- package/breadcrumb/index.umd.js +2 -2
- package/category-search/index.es.js +103 -16
- package/category-search/index.umd.js +23 -23
- package/checkbox/index.es.js +17 -0
- package/checkbox/index.umd.js +13 -13
- package/code-review/index.es.js +17 -0
- package/code-review/index.umd.js +16 -16
- package/data-grid/index.es.js +17 -0
- package/data-grid/index.umd.js +17 -17
- package/date-picker-pro/index.es.js +17 -0
- package/date-picker-pro/index.umd.js +18 -18
- package/dropdown/index.es.js +17 -0
- package/dropdown/index.umd.js +2 -2
- package/editable-select/index.es.js +17 -0
- package/editable-select/index.umd.js +12 -12
- package/editor-md/index.es.js +17 -0
- package/editor-md/index.umd.js +19 -19
- package/form/index.es.js +17 -0
- package/form/index.umd.js +20 -20
- package/input/index.es.js +17 -0
- package/input/index.umd.js +15 -15
- package/input-number/index.es.js +17 -0
- package/input-number/index.umd.js +20 -20
- package/mention/index.es.js +17 -0
- package/mention/index.umd.js +21 -21
- package/modal/index.es.js +17 -0
- package/modal/index.umd.js +2 -2
- package/overlay/index.es.js +17 -0
- package/overlay/index.umd.js +1 -1
- package/package.json +1 -1
- package/pagination/index.es.js +18 -2
- package/pagination/index.umd.js +16 -16
- package/popover/index.es.js +17 -0
- package/popover/index.umd.js +16 -16
- package/radio/index.es.js +17 -0
- package/radio/index.umd.js +20 -20
- package/search/index.es.js +17 -0
- package/search/index.umd.js +14 -14
- package/select/index.es.js +18 -2
- package/select/index.umd.js +15 -15
- package/splitter/index.es.js +17 -0
- package/splitter/index.umd.js +9 -9
- package/switch/index.es.js +17 -0
- package/switch/index.umd.js +20 -20
- package/table/index.es.js +17 -0
- package/table/index.umd.js +9 -9
- package/tag/index.es.js +1 -2
- package/tag/index.umd.js +1 -1
- package/textarea/index.es.js +17 -0
- package/textarea/index.umd.js +21 -21
- package/time-picker/index.es.js +17 -0
- package/time-picker/index.umd.js +18 -18
- package/time-select/index.es.js +18 -2
- package/time-select/index.umd.js +17 -17
- package/tooltip/index.es.js +17 -0
- package/tooltip/index.umd.js +12 -12
- package/tree/index.es.js +17 -0
- package/tree/index.umd.js +13 -13
- package/types/category-search/src/category-search-types.d.ts +11 -0
- package/types/category-search/src/composables/use-category-selected-tags.d.ts +15 -0
- package/types/overlay/src/flexible-overlay/flexible-overlay-types.d.ts +4 -0
- package/types/overlay/src/flexible-overlay/index.d.ts +3 -0
- package/vue-devui.es.js +103 -16
- package/vue-devui.umd.js +71 -71
package/breadcrumb/index.es.js
CHANGED
|
@@ -397,6 +397,10 @@ const flexibleOverlayProps = {
|
|
|
397
397
|
fitOriginWidth: {
|
|
398
398
|
type: Boolean,
|
|
399
399
|
default: false
|
|
400
|
+
},
|
|
401
|
+
autoUpdatePosition: {
|
|
402
|
+
type: Boolean,
|
|
403
|
+
default: false
|
|
400
404
|
}
|
|
401
405
|
};
|
|
402
406
|
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
@@ -424,6 +428,7 @@ function useOverlay(props, emit) {
|
|
|
424
428
|
const arrowRef = ref();
|
|
425
429
|
const overlayWidth = ref(0);
|
|
426
430
|
let originObserver;
|
|
431
|
+
let overlayObserver;
|
|
427
432
|
const styles = computed(() => {
|
|
428
433
|
if (fitOriginWidth.value) {
|
|
429
434
|
return { width: overlayWidth.value + "px" };
|
|
@@ -494,6 +499,15 @@ function useOverlay(props, emit) {
|
|
|
494
499
|
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
495
500
|
originEl && (originObserver == null ? void 0 : originObserver.unobserve(originEl));
|
|
496
501
|
};
|
|
502
|
+
const observeOverlay = () => {
|
|
503
|
+
if (props.autoUpdatePosition && typeof window !== "undefined" && overlayRef.value) {
|
|
504
|
+
overlayObserver = new window.ResizeObserver(updatePosition);
|
|
505
|
+
overlayObserver.observe(overlayRef.value);
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
const unobserveOverlay = () => {
|
|
509
|
+
overlayRef.value && (overlayObserver == null ? void 0 : overlayObserver.unobserve(overlayRef.value));
|
|
510
|
+
};
|
|
497
511
|
watch(
|
|
498
512
|
() => props.modelValue,
|
|
499
513
|
() => {
|
|
@@ -502,10 +516,12 @@ function useOverlay(props, emit) {
|
|
|
502
516
|
window.addEventListener("scroll", scrollCallback, true);
|
|
503
517
|
window.addEventListener("resize", updatePosition);
|
|
504
518
|
observeOrigin();
|
|
519
|
+
nextTick(observeOverlay);
|
|
505
520
|
} else {
|
|
506
521
|
window.removeEventListener("scroll", scrollCallback, true);
|
|
507
522
|
window.removeEventListener("resize", updatePosition);
|
|
508
523
|
unobserveOrigin();
|
|
524
|
+
unobserveOverlay();
|
|
509
525
|
}
|
|
510
526
|
}
|
|
511
527
|
);
|
|
@@ -513,6 +529,7 @@ function useOverlay(props, emit) {
|
|
|
513
529
|
window.removeEventListener("scroll", scrollCallback, true);
|
|
514
530
|
window.removeEventListener("resize", updatePosition);
|
|
515
531
|
unobserveOrigin();
|
|
532
|
+
unobserveOverlay();
|
|
516
533
|
});
|
|
517
534
|
return { arrowRef, overlayRef, styles, updatePosition };
|
|
518
535
|
}
|
package/breadcrumb/index.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(k,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],e):(k=typeof globalThis!="undefined"?globalThis:k||self,e(k.index={},k.Vue,k.dom))})(this,function(k,e,x){"use strict";const I={source:{type:Array,default:[]},separatorIcon:{type:String}},R={showMenu:{type:Boolean,default:!1},menuList:{type:Array},isSearch:{type:Boolean,dafault:!1},to:{type:[String,Object],default:""},replace:{type:Boolean,default:!1}};function L(t,n,o){let a=t;return n&&(a+=`__${n}`),o&&(a+=`--${o}`),a}function T(t,n=!1){const o=n?`.devui-${t}`:`devui-${t}`;return{b:()=>L(o),e:i=>i?L(o,i):"",m:i=>i?L(o,"",i):"",em:(i,r)=>i&&r?L(o,i,r):""}}var de="";const z={visible:{type:Boolean,default:!1},trigger:{type:String,default:"click"},closeScope:{type:String,default:"all"},position:{type:Array,default:()=>["bottom","top","left","right"]},offset:{type:[Number,Object],default:4},shiftOffset:{type:Number},closeOnMouseLeaveMenu:{type:Boolean,default:!1},showAnimation:{type:Boolean,default:!0},overlayClass:{type:String,default:""},destroyOnHide:{type:Boolean,default:!0},teleport:{type:[String,Object],default:"body"},appendToBody:{type:Boolean,default:!0}},$=Symbol("popper-trigger");function j(t){const n=Object.prototype.toString.call(t);return n.includes("object")&&n.includes("HTML")&&n.includes("Element")}function U(t){return t instanceof Element||j(t)?t:t&&typeof t=="object"&&(t.$el instanceof Element||j(t.$el))?t.$el:null}const C=new Map;function P(t,n,o){return t==null||t.addEventListener(n,o),()=>{t==null||t.removeEventListener(n,o)}}const H=({id:t,isOpen:n,origin:o,dropdownRef:a,props:s,emit:l})=>{let u=!1,i=!1;const{trigger:r,closeScope:c,closeOnMouseLeaveMenu:E}=e.toRefs(s),g=w=>{n.value=w,l("toggle",n.value)},b=async(w,N)=>{await new Promise(f=>setTimeout(f,50)),!(w==="origin"&&u||w==="dropdown"&&i)&&(N&&[...C.values()].reverse().forEach(f=>{setTimeout(()=>{var y;(y=f.toggle)==null||y.call(f)},0)}),g(!1))};e.watch([r,o,a],([w,N,f],y,O)=>{const B=U(N),m=[];setTimeout(()=>{m.push(P(document,"click",d=>{d.stopPropagation();const p=[...C.values()];!n.value||c.value==="none"||(f==null?void 0:f.contains(d.target))&&c.value==="blank"||p.some(v=>{var V;return(V=v.toggleEl)==null?void 0:V.contains(d.target)})&&p.some(v=>{var V;return(V=v.menuEl)==null?void 0:V.contains(d.target)})||([...C.values()].reverse().forEach(v=>{setTimeout(()=>{var V,h;(V=v.toggleEl)!=null&&V.contains(d.target)||(h=v.toggle)==null||h.call(v)},0)}),u=!1)}))},0),w==="click"?m.push(P(B,"click",()=>g(!n.value)),P(f,"mouseleave",d=>{var p;E.value&&!((p=C.get(t).child)!=null&&p.contains(d.relatedTarget))&&b("dropdown",!0)})):w==="hover"&&m.push(P(B,"mouseenter",()=>{i=!0,g(!0)}),P(B,"mouseleave",()=>{i=!1,b("origin")}),P(f,"mouseenter",()=>{u=!0,n.value=!0}),P(f,"mouseleave",d=>{var p;u=!1,!(d.relatedTarget&&((B==null?void 0:B.contains(d.relatedTarget))||((p=C.get(t).child)==null?void 0:p.contains(d.relatedTarget))))&&b("dropdown",!0)})),O(()=>m.forEach(d=>d()))})};function W(t,n,o,a,s,l){e.watch(n,(u,i)=>{i!==void 0&&(o.value=u,l("toggle",o.value))},{immediate:!0}),e.watch([o,s],([u,i])=>{var r;if(u){C.set(t,{...C.get(t),menuEl:i,toggle:()=>{o.value=!1,l("toggle",o.value)}});for(const c of C.values())(r=c.menuEl)!=null&&r.contains(a.value)&&(c.child=i)}}),e.onMounted(()=>{C.set(t,{toggleEl:a.value})}),e.onUnmounted(()=>{C.delete(t)})}function q(t,n,o){const{showAnimation:a,overlayClass:s,destroyOnHide:l}=e.toRefs(t),u=e.ref(!1),i=e.ref(!1),r=e.computed(()=>({transformOrigin:n.value==="top"?"0% 100%":"0% 0%",zIndex:"var(--devui-z-index-dropdown, 1052)"})),c=e.computed(()=>({"fade-in-bottom":a.value&&o.value&&n.value==="bottom","fade-in-top":a.value&&o.value&&n.value==="top",[`${s.value}`]:!0})),E=g=>{n.value=g.includes("top")||g.includes("right-end")||g.includes("left-end")?"top":"bottom"};return e.watch(o,g=>{u.value=l.value?g:!0,i.value=g}),{overlayModelValue:u,overlayShowValue:i,styles:r,classes:c,handlePositionChange:E}}const G={modelValue:{type:Boolean,default:!1},lockScroll:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0}};function Y(){if(document.documentElement.scrollHeight>document.documentElement.clientHeight){const t=document.documentElement.scrollTop,n=document.documentElement.getAttribute("style");return document.documentElement.style.position="fixed",document.documentElement.style.top=`-${t}px`,document.documentElement.style.width=document.documentElement.style.width||"100%",document.documentElement.style.overflowY="scroll",()=>{n?document.documentElement.setAttribute("style",n):document.documentElement.removeAttribute("style"),document.documentElement.scrollTop=t}}}function K(t,n){let o;const a=l=>{l.preventDefault(),n.emit("click",l),t.closeOnClickOverlay&&n.emit("update:modelValue",!1)},s=()=>{o==null||o()};return e.watch(()=>t.modelValue,l=>{l?t.lockScroll&&(o=Y()):s()}),e.onUnmounted(s),{onClick:a}}var fe="";e.defineComponent({name:"DFixedOverlay",inheritAttrs:!1,props:G,emits:["update:modelValue","click"],setup(t,n){const{modelValue:o}=e.toRefs(t),a=T("fixed-overlay"),{onClick:s}=K(t,n);return()=>e.createVNode(e.Transition,{name:a.m("fade")},{default:()=>{var l,u;return[o.value&&e.createVNode("div",e.mergeProps({class:a.b()},n.attrs,{onClick:s}),[(u=(l=n.slots).default)==null?void 0:u.call(l)])]}})}});const X={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},shiftOffset:{type:Number},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0},clickEventBubble:{type:Boolean,default:!1},fitOriginWidth:{type:Boolean,default:!1},autoUpdatePosition:{type:Boolean,default:!1}};function J(t,n,o,a){let{x:s,y:l}=n;if(!t){const{width:u,height:i}=a;s&&o.includes("start")&&(s=12),s&&o.includes("end")&&(s=Math.round(u-24)),l&&o.includes("start")&&(l=10),l&&o.includes("end")&&(l=i-14)}return{x:s,y:l}}function Q(t,n){const{fitOriginWidth:o,position:a,showArrow:s}=e.toRefs(t),l=e.ref(),u=e.ref(),i=e.ref(0);let r,c;const E=e.computed(()=>o.value?{width:i.value+"px"}:{}),g=(m,d,p,v)=>{const{x:V,y:h}=J(t.isArrowCenter,p,d,v.getBoundingClientRect()),M={top:"bottom",right:"left",bottom:"top",left:"right"}[d.split("-")[0]];Object.assign(m.style,{left:V?`${V}px`:"",top:h?`${h}px`:"",right:"",bottom:"",[M]:"-4px"})},b=async()=>{const m=t.origin,d=e.unref(l.value),p=e.unref(u.value),[v,...V]=a.value,h=[x.offset(t.offset)];h.push(V.length?x.flip({fallbackPlacements:V}):x.flip()),s.value&&h.push(x.arrow({element:u.value}));const{x:M,y:ie,placement:F,middlewareData:ce}=await x.computePosition(m,d,{strategy:"fixed",placement:v,middleware:h});let se=M,ue=ie;n("positionChange",F),Object.assign(d.style,{top:`${ue}px`,left:`${se}px`}),t.showArrow&&g(p,F,ce.arrow,d)},w=m=>{var p,v;const d=m.target;d!=null&&d.contains((v=(p=t.origin)==null?void 0:p.$el)!=null?v:t.origin)&&b()},N=m=>{i.value=m.getBoundingClientRect().width,b()},f=()=>{var m,d;if(o.value&&typeof window!="undefined"){const p=(d=(m=t.origin)==null?void 0:m.$el)!=null?d:t.origin;p&&(r=new window.ResizeObserver(()=>N(p)),r.observe(p))}},y=()=>{var d,p;const m=(p=(d=t.origin)==null?void 0:d.$el)!=null?p:t.origin;m&&(r==null||r.unobserve(m))},O=()=>{t.autoUpdatePosition&&typeof window!="undefined"&&l.value&&(c=new window.ResizeObserver(b),c.observe(l.value))},B=()=>{l.value&&(c==null||c.unobserve(l.value))};return e.watch(()=>t.modelValue,()=>{t.modelValue&&t.origin?(e.nextTick(b),window.addEventListener("scroll",w,!0),window.addEventListener("resize",b),f(),e.nextTick(O)):(window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",b),y(),B())}),e.onUnmounted(()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",b),y(),B()}),{arrowRef:u,overlayRef:l,styles:E,updatePosition:b}}var pe="";const Z=e.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:X,emits:["update:modelValue","positionChange"],setup(t,{slots:n,attrs:o,emit:a,expose:s}){const l=T("flexible-overlay"),{clickEventBubble:u}=e.toRefs(t),{arrowRef:i,overlayRef:r,styles:c,updatePosition:E}=Q(t,a);return s({updatePosition:E}),()=>{var g;return t.modelValue&&e.createVNode("div",e.mergeProps({ref:r,class:l.b(),style:c.value},o,{onClick:e.withModifiers(()=>({}),[u.value?"":"stop"]),onPointerup:e.withModifiers(()=>({}),["stop"])}),[(g=n.default)==null?void 0:g.call(n),t.showArrow&&e.createVNode("div",{ref:i,class:l.e("arrow")},null)])}}});/**
|
|
2
2
|
* @vue/shared v3.5.22
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
|
-
**/const
|
|
5
|
+
**/const ee=t=>t!==null&&typeof t=="object",te=T("popper-trigger");function D(t){return e.h("span",{class:te.b()},t)}function _(t){for(const n of t){if(ee(n)){if(n.type===e.Comment)continue;return n.type==="svg"||n.type===e.Text?D(n):n.type===e.Fragment?_(n.children):n}return D(n)}return null}var ne=e.defineComponent({name:"DPopperTrigger",setup(t,n){const{slots:o,attrs:a}=n;return()=>{var i;const s=(i=o.default)==null?void 0:i.call(o,a),l=e.inject($);if(!s)return null;const u=_(s);return u?e.withDirectives(e.cloneVNode(u,a),[[{mounted(r){l.value=r},updated(r){l.value=r},unmounted(){l.value=null}}]]):null}}}),me="";let oe=1;var re=e.defineComponent({name:"DDropdown",inheritAttrs:!1,props:z,emits:["toggle"],setup(t,{slots:n,attrs:o,emit:a,expose:s}){const{visible:l,position:u,offset:i,destroyOnHide:r,shiftOffset:c,showAnimation:E,teleport:g}=e.toRefs(t),b=e.ref(),w=e.ref(),N=e.ref(),f=`dropdown_${oe++}`,y=e.ref(!1),O=e.ref("bottom"),B=T("dropdown");e.provide($,b),H({id:f,isOpen:y,origin:b,dropdownRef:w,props:t,emit:a}),W(f,l,y,b,w,a);const{overlayModelValue:m,overlayShowValue:d,styles:p,classes:v,handlePositionChange:V}=q(t,O,y);return e.watch(d,h=>{e.nextTick(()=>{!r.value&&h&&N.value.updatePosition()})}),s({updatePosition:()=>N.value.updatePosition()}),()=>e.createVNode(e.Fragment,null,[e.createVNode(ne,null,{default:()=>{var h;return[(h=n.default)==null?void 0:h.call(n)]}}),e.createVNode(e.Teleport,{to:g.value,disabled:!t.appendToBody},{default:()=>[e.createVNode(e.Transition,{name:E.value?B.m(`fade-${O.value}`):""},{default:()=>[e.withDirectives(e.createVNode(Z,{modelValue:m.value,"onUpdate:modelValue":h=>m.value=h,ref:N,origin:b.value,position:u.value,offset:i.value,shiftOffset:c==null?void 0:c.value,onPositionChange:V,"click-event-bubble":!0,class:v.value,style:p.value},{default:()=>{var h;return[e.createVNode("div",e.mergeProps({ref:w,class:B.e("menu-wrap")},o),[(h=n.menu)==null?void 0:h.call(n)])]}}),[[e.vShow,d.value]])]})]})])}}),A=e.defineComponent({name:"DBreadcrumbItem",components:{DDropdown:re},props:R,setup(t,{slots:n}){var N;const o=e.inject("separatorIcon"),a=T("breadcrumb"),s=t.to?"is-link":"",l=t.showMenu&&((N=t.menuList)==null?void 0:N.length)?a.e("dropdown-title"):"",u=e.ref(null),i=e.getCurrentInstance(),r=i==null?void 0:i.appContext.config.globalProperties.$router,c=e.ref(t.showMenu),E=e.ref(t.menuList||[]),g=()=>{!t.to||!r||(t.replace?r.replace(t.to):r.push(t.to))};e.onMounted(()=>{var f;(f=u.value)==null||f.addEventListener("click",g)}),e.onBeforeUnmount(()=>{var f;(f=u.value)==null||f.removeEventListener("click",g)});const b=()=>e.createVNode("span",{class:a.e("separator")},[o]),w=()=>{var f;return c.value?e.createVNode("div",{class:a.e("item")},[e.createVNode(e.resolveComponent("d-dropdown"),{trigger:"hover","close-scope":"blank"},{default:()=>{var y;return[e.createVNode("span",{class:[s,l]},[(y=n==null?void 0:n.default)==null?void 0:y.call(n),e.createVNode("span",{class:"icon icon-chevron-down"},null)])]},menu:()=>e.createVNode("ul",{class:a.e("item-dropdown")},[E.value.map(y=>y.link?e.createVNode("a",{href:y.link,target:y.target?y.target:"_self"},[e.createVNode("li",{class:a.e("item-dropdown-item")},[y.title])]):e.createVNode("li",{class:a.e("item-dropdown-item")},[e.createVNode("span",{class:s},[y.title])]))])})]):e.createVNode("div",{class:a.e("item")},[e.createVNode("span",{ref:u,class:s},[(f=n==null?void 0:n.default)==null?void 0:f.call(n)]),b()])};return()=>w()}});function ae(t,n,o="default"){var a,s;return(s=n[o])!=null?s:(a=t[o])==null?void 0:a.call(t)}var ge="",S=e.defineComponent({name:"DBreadcrumb",components:{DBreadcrumbItem:A},props:I,setup(t,{slots:n}){var i;const o=(i=ae(n,t,"separatorIcon"))!=null?i:"/";e.provide("separatorIcon",o);const a=T("breadcrumb"),s=r=>e.createVNode(e.resolveComponent("d-breadcrumb-item"),{to:`path: ${r.link}`,replace:r.replace},{default:()=>[r.title]}),l=r=>e.createVNode(e.resolveComponent("d-breadcrumb-item"),{menuList:r.children,showMenu:r.showMenu,to:`path: ${r.link}`,replace:r.replace},{default:()=>[!r.noNavigation&&(!r.linkType||r.linkType==="hrefLink")?e.createVNode("a",{href:r.link,target:r.target?r.target:"_self"},[r.title]):null,r.noNavigation?e.createVNode("span",null,[r.title]):null]}),u=r=>r.map(c=>!c.noNavigation&&c.linkType==="routerLink"?s(c):c.children&&c.children.length>0?l(c):e.createVNode(e.resolveComponent("d-breadcrumb-item"),null,{default:()=>[!c.noNavigation&&(!c.linkType||c.linkType==="hrefLink")?e.createVNode("a",{href:c.link,target:c.target?c.target:"_self"},[c.title]):null,c.noNavigation?e.createVNode("span",null,[c.title]):null]}));return()=>{var r;return e.createVNode("div",{class:a.b()},[t.source&&t.source.length?u(t.source):(r=n==null?void 0:n.default)==null?void 0:r.call(n)])}}}),le={title:"Breadcrumb \u9762\u5305\u5C51",category:"\u5BFC\u822A",status:"100%",install(t){t.component(S.name,S),t.component(A.name,A)}};k.Breadcrumb=S,k.BreadcrumbItem=A,k.breadcrumbItemProps=R,k.breadcrumbProps=I,k.default=le,Object.defineProperties(k,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -445,6 +445,10 @@ const flexibleOverlayProps = {
|
|
|
445
445
|
fitOriginWidth: {
|
|
446
446
|
type: Boolean,
|
|
447
447
|
default: false
|
|
448
|
+
},
|
|
449
|
+
autoUpdatePosition: {
|
|
450
|
+
type: Boolean,
|
|
451
|
+
default: false
|
|
448
452
|
}
|
|
449
453
|
};
|
|
450
454
|
function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
@@ -472,6 +476,7 @@ function useOverlay(props, emit) {
|
|
|
472
476
|
const arrowRef = ref();
|
|
473
477
|
const overlayWidth = ref(0);
|
|
474
478
|
let originObserver;
|
|
479
|
+
let overlayObserver;
|
|
475
480
|
const styles = computed(() => {
|
|
476
481
|
if (fitOriginWidth.value) {
|
|
477
482
|
return { width: overlayWidth.value + "px" };
|
|
@@ -542,6 +547,15 @@ function useOverlay(props, emit) {
|
|
|
542
547
|
const originEl = (_b = (_a = props.origin) == null ? void 0 : _a.$el) != null ? _b : props.origin;
|
|
543
548
|
originEl && (originObserver == null ? void 0 : originObserver.unobserve(originEl));
|
|
544
549
|
};
|
|
550
|
+
const observeOverlay = () => {
|
|
551
|
+
if (props.autoUpdatePosition && typeof window !== "undefined" && overlayRef.value) {
|
|
552
|
+
overlayObserver = new window.ResizeObserver(updatePosition);
|
|
553
|
+
overlayObserver.observe(overlayRef.value);
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
const unobserveOverlay = () => {
|
|
557
|
+
overlayRef.value && (overlayObserver == null ? void 0 : overlayObserver.unobserve(overlayRef.value));
|
|
558
|
+
};
|
|
545
559
|
watch(
|
|
546
560
|
() => props.modelValue,
|
|
547
561
|
() => {
|
|
@@ -550,10 +564,12 @@ function useOverlay(props, emit) {
|
|
|
550
564
|
window.addEventListener("scroll", scrollCallback, true);
|
|
551
565
|
window.addEventListener("resize", updatePosition);
|
|
552
566
|
observeOrigin();
|
|
567
|
+
nextTick(observeOverlay);
|
|
553
568
|
} else {
|
|
554
569
|
window.removeEventListener("scroll", scrollCallback, true);
|
|
555
570
|
window.removeEventListener("resize", updatePosition);
|
|
556
571
|
unobserveOrigin();
|
|
572
|
+
unobserveOverlay();
|
|
557
573
|
}
|
|
558
574
|
}
|
|
559
575
|
);
|
|
@@ -561,6 +577,7 @@ function useOverlay(props, emit) {
|
|
|
561
577
|
window.removeEventListener("scroll", scrollCallback, true);
|
|
562
578
|
window.removeEventListener("resize", updatePosition);
|
|
563
579
|
unobserveOrigin();
|
|
580
|
+
unobserveOverlay();
|
|
564
581
|
});
|
|
565
582
|
return { arrowRef, overlayRef, styles, updatePosition };
|
|
566
583
|
}
|
|
@@ -937,7 +954,6 @@ var Tag = defineComponent({
|
|
|
937
954
|
} = toRefs(props);
|
|
938
955
|
const tagClass = useClass(props);
|
|
939
956
|
const themeColor = useColor(props);
|
|
940
|
-
const tagTitle = titleContent.value || "";
|
|
941
957
|
const isDefaultTag = () => !type4.value && !color.value;
|
|
942
958
|
const handleClick = (e) => {
|
|
943
959
|
emit("click", e);
|
|
@@ -976,7 +992,7 @@ var Tag = defineComponent({
|
|
|
976
992
|
color: contentColor.value,
|
|
977
993
|
backgroundColor: checked.value ? themeColor.value : !color.value ? "" : "var(--devui-base-bg, #ffffff)"
|
|
978
994
|
},
|
|
979
|
-
"title":
|
|
995
|
+
"title": titleContent.value || ""
|
|
980
996
|
}, [(_a = slots.default) == null ? void 0 : _a.call(slots), closeIconEl()])]);
|
|
981
997
|
};
|
|
982
998
|
}
|
|
@@ -1056,6 +1072,13 @@ const categorySearchProps = {
|
|
|
1056
1072
|
inputAutofocus: {
|
|
1057
1073
|
type: Boolean,
|
|
1058
1074
|
default: true
|
|
1075
|
+
},
|
|
1076
|
+
collapseTags: {
|
|
1077
|
+
type: [Boolean, Number],
|
|
1078
|
+
default: false
|
|
1079
|
+
},
|
|
1080
|
+
collapseTagsTooltip: {
|
|
1081
|
+
type: Object
|
|
1059
1082
|
}
|
|
1060
1083
|
};
|
|
1061
1084
|
const categorySearchInjectionKey = Symbol("d-category-search");
|
|
@@ -10412,37 +10435,40 @@ var TextInputMenu = defineComponent({
|
|
|
10412
10435
|
props: typeMenuProps,
|
|
10413
10436
|
emits: ["close"],
|
|
10414
10437
|
setup(props, ctx) {
|
|
10415
|
-
const
|
|
10416
|
-
tag: tag2
|
|
10417
|
-
} = toRefs(props);
|
|
10438
|
+
const formEl = ref();
|
|
10418
10439
|
const {
|
|
10419
10440
|
getTextInputValue
|
|
10420
10441
|
} = inject(categorySearchInjectionKey);
|
|
10421
10442
|
const formData = reactive({
|
|
10422
|
-
text:
|
|
10443
|
+
text: props.tag.value.value
|
|
10423
10444
|
});
|
|
10424
10445
|
const onConfirmClick = () => {
|
|
10425
|
-
|
|
10426
|
-
|
|
10446
|
+
formEl.value.validate((isValid) => {
|
|
10447
|
+
if (isValid) {
|
|
10448
|
+
getTextInputValue(props.tag, formData.text);
|
|
10449
|
+
ctx.emit("close");
|
|
10450
|
+
}
|
|
10451
|
+
});
|
|
10427
10452
|
};
|
|
10428
10453
|
const onCancelClick = () => {
|
|
10429
10454
|
ctx.emit("close");
|
|
10430
10455
|
};
|
|
10431
10456
|
return () => createVNode(resolveComponent("d-form"), {
|
|
10457
|
+
"ref": formEl,
|
|
10432
10458
|
"data": formData,
|
|
10433
10459
|
"pop-position": ["right"]
|
|
10434
10460
|
}, {
|
|
10435
10461
|
default: () => [createVNode(resolveComponent("d-form-item"), {
|
|
10436
10462
|
"field": "text",
|
|
10437
|
-
"rules":
|
|
10463
|
+
"rules": props.tag.validateRules
|
|
10438
10464
|
}, {
|
|
10439
10465
|
default: () => [createVNode(resolveComponent("d-input"), {
|
|
10440
10466
|
"modelValue": formData.text,
|
|
10441
10467
|
"onUpdate:modelValue": ($event) => formData.text = $event,
|
|
10442
10468
|
"autocomplete": "off",
|
|
10443
10469
|
"autofocus": true,
|
|
10444
|
-
"maxlength":
|
|
10445
|
-
"placeholder":
|
|
10470
|
+
"maxlength": props.tag.maxLength,
|
|
10471
|
+
"placeholder": props.tag.placeholder || ""
|
|
10446
10472
|
}, null)]
|
|
10447
10473
|
}), createVNode("div", {
|
|
10448
10474
|
"class": "dp-dropdown-operation-area"
|
|
@@ -10987,6 +11013,7 @@ function useCategorySearch(props, ctx) {
|
|
|
10987
11013
|
currentSelectTag.value.title = setTitle(currentSelectTag.value, currentSelectTag.value.type || "", "");
|
|
10988
11014
|
inputRef.value.openMenu();
|
|
10989
11015
|
props.inputAutofocus && inputRef.value.focus();
|
|
11016
|
+
ctx.emit("selectedCategory", { tag: item });
|
|
10990
11017
|
}, DROPDOWN_ANIMATION_TIMEOUT);
|
|
10991
11018
|
};
|
|
10992
11019
|
const searchKeyChangeEvent = (event) => {
|
|
@@ -11019,6 +11046,7 @@ function useCategorySearch(props, ctx) {
|
|
|
11019
11046
|
innerSearchKey.value = "";
|
|
11020
11047
|
inputRef.value.closeMenu();
|
|
11021
11048
|
chooseCategory(tag2);
|
|
11049
|
+
ctx.emit("selectedCategory", { tag: tag2 });
|
|
11022
11050
|
setTimeout(() => {
|
|
11023
11051
|
isFocus.value = true;
|
|
11024
11052
|
enterSearch.value = false;
|
|
@@ -11464,11 +11492,44 @@ function useCategorySearch(props, ctx) {
|
|
|
11464
11492
|
onSearch
|
|
11465
11493
|
};
|
|
11466
11494
|
}
|
|
11495
|
+
function useCategorySelectedTags(props) {
|
|
11496
|
+
const isCollapseTags = ref(false);
|
|
11497
|
+
const collapseTagsCount = ref(0);
|
|
11498
|
+
const defaultPopoverConfig = {
|
|
11499
|
+
trigger: "hover",
|
|
11500
|
+
position: ["top", "bottom"]
|
|
11501
|
+
};
|
|
11502
|
+
const popoverConfig = ref(defaultPopoverConfig);
|
|
11503
|
+
watch(
|
|
11504
|
+
() => props.collapseTags,
|
|
11505
|
+
(val) => {
|
|
11506
|
+
if (typeof val === "boolean") {
|
|
11507
|
+
isCollapseTags.value = val;
|
|
11508
|
+
collapseTagsCount.value = val ? 1 : 0;
|
|
11509
|
+
}
|
|
11510
|
+
if (typeof val === "number") {
|
|
11511
|
+
isCollapseTags.value = true;
|
|
11512
|
+
collapseTagsCount.value = val;
|
|
11513
|
+
}
|
|
11514
|
+
},
|
|
11515
|
+
{ immediate: true }
|
|
11516
|
+
);
|
|
11517
|
+
watch(
|
|
11518
|
+
() => props.collapseTagsTooltip,
|
|
11519
|
+
(val) => {
|
|
11520
|
+
if (val) {
|
|
11521
|
+
popoverConfig.value = { ...defaultPopoverConfig, ...val };
|
|
11522
|
+
}
|
|
11523
|
+
},
|
|
11524
|
+
{ immediate: true }
|
|
11525
|
+
);
|
|
11526
|
+
return { isCollapseTags, collapseTagsCount, popoverConfig };
|
|
11527
|
+
}
|
|
11467
11528
|
var categorySearch = "";
|
|
11468
11529
|
var CategorySearch = defineComponent({
|
|
11469
11530
|
name: "DCategorySearch",
|
|
11470
11531
|
props: categorySearchProps,
|
|
11471
|
-
emits: ["search", "selectedTagsChange", "createFilter", "clearAll", "searchKeyChange"],
|
|
11532
|
+
emits: ["search", "selectedTagsChange", "selectedCategory", "createFilter", "clearAll", "searchKeyChange"],
|
|
11472
11533
|
setup(props, ctx) {
|
|
11473
11534
|
const {
|
|
11474
11535
|
rootRef,
|
|
@@ -11482,6 +11543,11 @@ var CategorySearch = defineComponent({
|
|
|
11482
11543
|
operationConfig,
|
|
11483
11544
|
onSearch
|
|
11484
11545
|
} = useCategorySearch(props, ctx);
|
|
11546
|
+
const {
|
|
11547
|
+
isCollapseTags,
|
|
11548
|
+
collapseTagsCount,
|
|
11549
|
+
popoverConfig
|
|
11550
|
+
} = useCategorySelectedTags(props);
|
|
11485
11551
|
return () => {
|
|
11486
11552
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
11487
11553
|
return createVNode("div", {
|
|
@@ -11497,10 +11563,31 @@ var CategorySearch = defineComponent({
|
|
|
11497
11563
|
"class": "dp-category-search-line-container"
|
|
11498
11564
|
}, [createVNode("ul", {
|
|
11499
11565
|
"class": "dp-category-search-line"
|
|
11500
|
-
}, [innerSelectedTags.value.map((item) =>
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11566
|
+
}, [innerSelectedTags.value.map((item, index2) => {
|
|
11567
|
+
if (isCollapseTags.value) {
|
|
11568
|
+
return index2 < collapseTagsCount.value && createVNode(CategorySearchTagDropdown, {
|
|
11569
|
+
"item": item,
|
|
11570
|
+
"isJoinLabelType": joinLabelTypes.includes(item.type || "")
|
|
11571
|
+
}, null);
|
|
11572
|
+
} else {
|
|
11573
|
+
return createVNode(CategorySearchTagDropdown, {
|
|
11574
|
+
"item": item,
|
|
11575
|
+
"isJoinLabelType": joinLabelTypes.includes(item.type || "")
|
|
11576
|
+
}, null);
|
|
11577
|
+
}
|
|
11578
|
+
}), isCollapseTags.value && innerSelectedTags.value.length > collapseTagsCount.value && createVNode(Popover, mergeProps({
|
|
11579
|
+
"auto-update-position": true
|
|
11580
|
+
}, popoverConfig.value), {
|
|
11581
|
+
default: () => createVNode(Tag, {
|
|
11582
|
+
"deletable": false
|
|
11583
|
+
}, {
|
|
11584
|
+
default: () => [`+${innerSelectedTags.value.length - collapseTagsCount.value}`]
|
|
11585
|
+
}),
|
|
11586
|
+
content: () => innerSelectedTags.value.map((item, index2) => index2 >= collapseTagsCount.value && createVNode(CategorySearchTagDropdown, {
|
|
11587
|
+
"item": item,
|
|
11588
|
+
"isJoinLabelType": joinLabelTypes.includes(item.type || "")
|
|
11589
|
+
}, null))
|
|
11590
|
+
}), createVNode(CategorySearchInput, {
|
|
11504
11591
|
"ref": inputRef
|
|
11505
11592
|
}, null)])]), showExtendedConfig.value && createVNode("div", {
|
|
11506
11593
|
"class": "dp-category-search-extended-container"
|