@farris/ui-vue 1.8.5-beta.3 → 1.8.5-beta.4

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.
Files changed (61) hide show
  1. package/components/batch-editor/index.esm.js +6850 -6840
  2. package/components/batch-editor/index.umd.cjs +20 -20
  3. package/components/button/index.esm.js +6852 -6842
  4. package/components/button/index.umd.cjs +20 -20
  5. package/components/button-edit/index.esm.js +140 -140
  6. package/components/button-edit/index.umd.cjs +1 -1
  7. package/components/button-group/index.esm.js +46 -45
  8. package/components/button-group/index.umd.cjs +1 -1
  9. package/components/common/index.esm.js +16 -12
  10. package/components/common/index.umd.cjs +1 -1
  11. package/components/component/index.esm.js +411 -411
  12. package/components/component/index.umd.cjs +2 -2
  13. package/components/data-view/index.esm.js +6500 -6487
  14. package/components/data-view/index.umd.cjs +21 -21
  15. package/components/designer-canvas/index.esm.js +269 -269
  16. package/components/designer-canvas/index.umd.cjs +1 -1
  17. package/components/expression-editor/index.esm.js +458 -458
  18. package/components/expression-editor/index.umd.cjs +2 -2
  19. package/components/filter-condition-editor/index.esm.js +386 -386
  20. package/components/filter-condition-editor/index.umd.cjs +1 -1
  21. package/components/flow-canvas/index.esm.js +1100 -1100
  22. package/components/flow-canvas/index.umd.cjs +7 -7
  23. package/components/mapping-editor/index.esm.js +243 -243
  24. package/components/mapping-editor/index.umd.cjs +2 -2
  25. package/components/message-box/index.esm.js +82 -82
  26. package/components/message-box/index.umd.cjs +1 -1
  27. package/components/modal/index.esm.js +76 -76
  28. package/components/modal/index.umd.cjs +1 -1
  29. package/components/order/index.esm.js +139 -138
  30. package/components/order/index.umd.cjs +1 -1
  31. package/components/query-solution/index.esm.js +891 -891
  32. package/components/query-solution/index.umd.cjs +1 -1
  33. package/components/response-toolbar/index.esm.js +151 -149
  34. package/components/response-toolbar/index.umd.cjs +1 -1
  35. package/components/schema-selector/index.esm.js +947 -941
  36. package/components/schema-selector/index.umd.cjs +6 -6
  37. package/components/section/index.esm.js +121 -121
  38. package/components/section/index.umd.cjs +2 -2
  39. package/components/sort-condition-editor/index.esm.js +539 -539
  40. package/components/sort-condition-editor/index.umd.cjs +1 -1
  41. package/components/tabs/index.esm.js +448 -442
  42. package/components/tabs/index.umd.cjs +1 -1
  43. package/designer/button-edit/index.esm.js +97 -97
  44. package/designer/button-edit/index.umd.cjs +1 -1
  45. package/designer/data-grid/index.esm.js +6483 -6470
  46. package/designer/data-grid/index.umd.cjs +21 -21
  47. package/designer/farris-designer.all.esm.js +1891 -1885
  48. package/designer/farris-designer.all.umd.cjs +14 -14
  49. package/designer/radio-group/index.esm.js +183 -183
  50. package/designer/radio-group/index.umd.cjs +2 -2
  51. package/designer/response-toolbar/index.esm.js +558 -556
  52. package/designer/response-toolbar/index.umd.cjs +1 -1
  53. package/designer/tabs/index.esm.js +416 -416
  54. package/designer/tabs/index.umd.cjs +2 -2
  55. package/farris.all.esm.js +9133 -9119
  56. package/farris.all.umd.cjs +35 -35
  57. package/package.json +1 -1
  58. package/types/common/index.d.ts +1 -0
  59. package/types/common/utils/attrs.d.ts +26 -0
  60. package/types/modal/src/composition/type.d.ts +2 -0
  61. package/types/tabs/src/composition/types.d.ts +2 -0
@@ -1 +1 @@
1
- (function(y,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("../common/index.umd.js"),require("vue"),require("../locale/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","../common/index.umd.js","vue","../locale/index.umd.js"],g):(y=typeof globalThis<"u"?globalThis:y||self,g(y["response-toolbar"]={},y.common,y.Vue,y.locale))})(this,function(y,g,n,pe){"use strict";var ke=Object.defineProperty;var De=(y,g,n)=>g in y?ke(y,g,{enumerable:!0,configurable:!0,writable:!0,value:n}):y[g]=n;var h=(y,g,n)=>De(y,typeof g!="symbol"?g+"":g,n);const re={id:{type:String,default:""},customClass:{type:String,default:""},alignment:{Type:String,default:"right"},items:{Type:Array,default:[]},visible:{type:Boolean,default:!0},buttonSize:{type:String,default:""},moreButtonClass:{type:String,default:"btn-secondary"}};class ie{constructor(l){h(this,"id","");h(this,"class","btn-secondary");h(this,"icon","");h(this,"groupId","");h(this,"order",-1);h(this,"asDropDownTop",!1);h(this,"text","");h(this,"visible",!0);h(this,"shown",!0);h(this,"responsed",!1);h(this,"tipsEnable",!1);h(this,"tipsText","");h(this,"width",0);h(this,"dropdownClass","");h(this,"onClick",()=>{});h(this,"options");var w,p;this.options=l;const a=["id","class","icon","groupId","order","asDropDownTop","text","isDP","visible","responsed","width","tipsEnable","tipsText","dropdownClass","onClick"];Object.keys(l).filter(x=>a.indexOf(x)>-1).forEach(x=>{x==="visible"?this[x]=l[x]===void 0?!0:l[x]:this[x]=l[x]}),this.shown=this.visible,(w=l.appearance)!=null&&w.class&&(this.class=(p=l.appearance)==null?void 0:p.class),this.class||(this.class="btn-secondary")}get enable(){return Object.keys(this.options).indexOf("disabled")>-1?!this.options.disabled:n.computed(()=>!0)}setWidth(l){this.width=parseInt(l,10)}getWidth(){return this.visible?this.width:!1}}class de extends ie{constructor(l){super(l)}}function ce(){function c(l){const a=[];return l.reduce((w,p)=>(p.children&&p.children.length>0?w.push(new U(p)):w.push(new de(p)),w),a),a}return{buildResponseToolbarItems:c}}const{buildResponseToolbarItems:fe}=ce();class U extends ie{constructor(a){super(a);h(this,"placement","");h(this,"visible",!0);h(this,"dropdownClass","");h(this,"menuClass","");h(this,"split",!1);h(this,"children",[]);h(this,"expanded",!1);h(this,"shown",!0);const w=["visible","icon","isDP","class","dropdownClass","menuClass","placement","split","expanded"];Object.keys(a).filter(p=>w.indexOf(p)>-1).forEach(p=>{p==="visible"?this[p]=a[p]===void 0?!0:a[p]:this[p]=a[p]}),this.shown=this.visible,a.children&&a.children.length&&(this.children=fe(a.children))}}function he(){function c(a){const w={"f-icon":!0};if(a.icon){const p=a.icon.trim().split(" ");p&&p.length&&p.reduce((x,V)=>(x[V]=!0,x),w)}return w}function l(a){return!!(a.icon&&a.icon.trim())}return{iconClass:c,shouldShowIcon:l}}function be(c,l){function a(o){const e={"dropdown-menu":!0};return g.getCustomClass(e,o.menuClass)}function w(o){const e={disabled:!o.enable,"dropdown-submenu":!0,"f-rt-dropdown":!0,"text-truncate":!0};return g.getCustomClass(e,o.dropdownClass)}function p(o){const e={disabled:!o.enable,"dropdown-item":!0,"f-rt-btn":!0,"text-truncate":!0};return g.getCustomClass(e,o.dropdownClass)}function x(o){const e={disabled:!o.enable,"dropdown-item":!0,"f-rt-btn":!0,"text-truncate":!0,"f-rt-toggle":!o.split,"btn-icontext":!!(o.icon&&o.icon.trim()),"dropdown-toggle":!o.split,"btn-secondary":!0};return g.getCustomClass(e,o.dropdownClass)}function V(o){const e={"f-rt-btn":!0,"text-truncate":!0,"btn-icontext":!!(o.icon&&o.icon.trim()),"d-block":!0};return g.getCustomClass(e,o.dropdownClass)}let j;const C=new Map;let _="";function S(o){_="#"+o}function O(o,e,u){o.stopPropagation();const r=u?u.id:"__top_item__";if(e.children&&e.children.length&&(e.expanded=!e.expanded,e.expanded)){if(C.has(r)&&C.get(r)!==e){const b=C.get(r);b&&(b.expanded=!1,C.delete(r))}C.set(r,e)}}function A(o,e){document.body.click(),e.enable&&(o.stopPropagation(),typeof e.onClick=="function"&&e.onClick(o,e.id),c.emit("click",o,e.id))}function $(o,e){const u=o.target;u.className.indexOf("dropdown-item")<0||(u.title=u.scrollWidth>u.clientWidth?e:"")}function Y(o,e,u){if(e.tipsEnable&&e.tipsText){const r=n.reactive({content:e.tipsText,enable:e.tipsEnable});return n.withDirectives(n.createVNode("li",{class:p(e),id:e.id,key:e.id+"_"+u,onClick:b=>A(b,e)},[n.createVNode("span",{class:V(e)},[l.shouldShowIcon(e)&&n.createVNode("i",{class:l.iconClass(e)},null),e.text])]),[[n.resolveDirective("tooltip"),r]])}return n.createVNode("li",{class:p(e),id:e.id,onClick:r=>A(r,e)},[n.createVNode("span",{class:V(e),onMouseenter:r=>$(r,e.text)},[l.shouldShowIcon(e)&&n.createVNode("i",{class:l.iconClass(e)},null),e.text])])}function s(o,e,u){e.enable&&(typeof e.onClick=="function"&&u.onClick(o,e.id),c.emit("click",o,e.id),u.split||O(o,e,u))}function f(o,e,u){o&&o.stopPropagation(),O(o,e,u)}function v(o,e){o.stopPropagation();const u=e.id;if(e.children&&e.children.length&&e.expanded&&C.has(u)){const r=C.get(u);r&&(r.expanded=!1,C.delete(u))}}function H(o,e,u){if(e.tipsEnable&&e.tipsText){const r=n.reactive({content:e.tipsText,enable:e.tipsEnable});return n.createVNode("li",{class:w(e),id:e.id,key:e.id+"_"+u,onClick:b=>s(b,e,o)},[n.withDirectives(n.createVNode("span",{class:x(e)},[l.shouldShowIcon(e)&&n.createVNode("i",{class:l.iconClass(e)},null),e.text]),[[n.resolveDirective("tooltip"),r]]),e.split&&n.createVNode("span",{class:"dropdown-toggle dropdown-toggle-split f-rt-toggle",onClick:b=>f(b,e,o)},null),j(e,e)])}return n.createVNode("li",{class:w(e),id:e.id,onClick:r=>s(r,e,o),onMouseenter:r=>$(r,e.text)},[n.createVNode("span",{class:x(e)},[l.shouldShowIcon(e)&&n.createVNode("i",{class:l.iconClass(e)},null),e.text]),e.split&&n.createVNode("span",{class:"dropdown-toggle dropdown-toggle-split f-rt-toggle",onClick:r=>f(r,e,o)},null),j(e,e)])}function te(o){return o.children.filter(e=>e.visible).map((e,u)=>e.children&&e.children.length?H(o,e,u):Y(o,e,u))}function ne(o,e){if(!o)return 1080;let u=-1;const r=o.children.length;for(let b=0;b<r;b++)if(o.children[b].id===e){u=b;break}return 1080+r-u}function oe(o,e,u){var q,Z;const r={display:o.expanded?"block":"none",position:"fixed",maxWidth:"300px",minWidth:"120px",zIndex:1080,overflowY:"auto",maxHeight:"none"},b=document.querySelector(_);if(!b)return r;const F=n.getCurrentInstance();let N=(Z=(q=F==null?void 0:F.exposed)==null?void 0:q.elementRef.value)==null?void 0:Z.querySelector("#"+e);if(N||(N=b==null?void 0:b.querySelector("#"+e)),!N)return r;const le=window.innerWidth,W=window.innerHeight,T=N==null?void 0:N.getClientRects();if(N&&T&&T.length){const{top:E,width:J,left:I,right:m,height:z}=T[0],L=Math.ceil(z+E);r.top=`${L}px`,r.left=`${I}px`;const Q=o.id+"_menu",P=(N==null?void 0:N.querySelector("#"+Q))||(b==null?void 0:b.querySelector("#"+Q))||null;if(P){P.style.visibility="hidden",P.style.display="block";const G=P.offsetHeight;r.zIndex=o.expanded?ne(b,Q):1080,r.display==="block"&&(P.style.display="block");const t=P.getBoundingClientRect();if(u){r.top=`${E-6}px`;const i=Math.ceil(J+I);r.left=`${i}px`}le-I-J<t.width&&(r.left=`${(u?I:m)-t.width}px`),W-E-z<G?E>G?(r.top=`${E-G-6}px`,r.maxHeight=`${E-16}px`):(r.maxHeight=`${W-L}px`,E>W-E-z&&(r.top="10px",r.maxHeight=`${E-16}px`)):r.maxHeight=`${W-L}px`,P.style.visibility="visible"}}return r}j=function(o,e){const u=e?e.id:o.id;return n.createVNode(n.Teleport,{to:_,disabled:!o.expanded},{default:()=>[n.createVNode("ul",{class:a(o),style:oe(o,u,e),id:o.id+"_menu",onWheel:r=>v(r,o)},[te(o)])]})};function se(){C.forEach(o=>{o.expanded=!1}),C.clear()}return{renderDropdownMenu:j,clearAllDropDownMenu:se,updateContainerId:S}}function ge(c,l,a){const w=n.ref(c.alignment),{renderDropdownMenu:p,clearAllDropDownMenu:x,updateContainerId:V}=be(l,a);function j(s){const f={"btn-group":!0,"f-rt-dropdown":!0,"f-btn-ml":w.value==="right"||w.value==="center","f-btn-mr":w.value==="left"};return g.getCustomClass(f,s.dropdownClass)}function C(s){const f={btn:!0,disabled:!s.enable,"f-rt-btn":!0,"btn-icontext":!!(s.icon&&s.icon.trim())&&s.text,"f-rt-toggle":!s.split,"dropdown-toggle":!s.split,"f-btn-icon":s.icon&&!s.text};return g.getCustomClass(f,s.class)}function _(s){const f={btn:!0,"dropdown-toggle":!0,"dropdown-toggle-split":!0};return g.getCustomClass(f,s.class)}function S(s){return s.split?{display:"flex"}:{display:"flex","border-radius":"6px"}}function O(s,f){s.stopPropagation();const v=f.expanded;document.body.click(),typeof f.onClick=="function"&&f.onClick(s,f.id),l.emit("click",s,f.id),f.split||(f.expanded=!v)}function A(s,f){s.stopPropagation();const v=f.expanded;document.body.click(),f.expanded=!v}function $(s,f=!0){if(s.tipsEnable&&s.tipsText){const v=n.reactive({content:s.tipsText,enable:s.tipsEnable});return n.createVNode("div",{id:s.id,class:j(s)},[n.withDirectives(n.createVNode("div",{class:C(s),style:S(s),onClick:H=>s.enable&&O(H,s)},[a.shouldShowIcon(s)&&n.createVNode("i",{class:a.iconClass(s)},null),s.text&&n.createVNode("span",null,[s.text])]),[[n.resolveDirective("tooltip"),v]]),s.split&&n.createVNode("button",{class:_(s),style:"border-radius:0 6px 6px 0;",onClick:H=>A(H,s)},null),f&&p(s)])}return n.createVNode("div",{id:s.id,class:j(s)},[n.createVNode("div",{class:C(s),style:S(s),onClick:v=>s.enable&&O(v,s)},[a.shouldShowIcon(s)&&n.createVNode("i",{class:a.iconClass(s)},null),s.text&&n.createVNode("span",null,[s.text])]),s.split&&n.createVNode("button",{class:_(s),style:"border-radius:0 6px 6px 0;",onClick:v=>A(v,s)},null),f&&p(s)])}function Y(){x()}return{renderToolbarDropdown:$,clearAllDropDown:Y,updateContainerId:V}}const{buildResponseToolbarItems:ae}=ce(),ue=n.defineComponent({name:"FResponseToolbar",props:re,emits:["click"],setup(c,l){const a=n.ref(ae(c.items)),w=n.ref(),p=n.ref(),x=n.ref(),V=g.isMobilePhone(),j={id:"__more_buttons__",text:V?"":pe.LocaleService.getLocaleValue("responseToolbar.more"),icon:V?"f-icon-more-horizontal":""},C=n.ref(new U(j)),_=Object.assign({},j,{id:j.id+"width"}),S=n.ref(-1),O=he();let A=!1;const{guid:$,uuid:Y}=g.useGuid(),s=c.id?c.id:"toolbar-"+$(),f=n.ref(),v="dropdown-container-"+s+"-"+Y(4),{renderToolbarDropdown:H,clearAllDropDown:te,updateContainerId:ne}=ge(c,l,O);ne(v);const oe=n.computed(()=>C.value.children.length>0),se=n.computed(()=>c.visible?C.value.children.length>0?!0:a.value.findIndex(t=>t.shown&&t.children&&t.children.length>0)>-1:!1);function o(){c.visible&&!f.value&&document&&(f.value=document.createElement("div"),f.value.id=v,document.body.appendChild(f.value))}o();function e(){f.value&&document.body.contains(f.value)&&(document.body.removeChild(f.value),f.value=null)}n.watch(se,(t,i)=>{t?o():e()});const u=n.computed(()=>{const t={"f-toolbar":!0,"f-response-toolbar":!0,"position-relative":!0,"f-response-toolbar-sm":c.buttonSize==="sm","f-response-toolbar-lg":c.buttonSize==="lg","d-none":!c.visible,"is-mobile":V};return g.getCustomClass(t,c.customClass)}),r=n.computed(()=>({"w-100":!0,"d-flex":!0,"flex-nowrap":!0,"justify-content-end":c.alignment==="right","justify-content-start":c.alignment==="left","justify-content-center":c.alignment==="center"}));function b(t){t&&t.target.closest("ul.dropdown-menu")&&t.type==="wheel"||(a.value.filter(i=>i.children&&i.children.length>0).forEach(i=>{i.expanded=!1}),C.value.expanded=!1,te())}function F(t,i){var k;const d={btn:!0,"f-rt-btn":!0,"f-btn-ml":c.alignment==="right"||i>0&&c.alignment==="center","f-btn-mr":c.alignment==="left","btn-icontext":!!(t.icon&&t.icon.trim())},D=((k=t==null?void 0:t.appearance)==null?void 0:k.class)||t.class||"btn-secondary";return g.getCustomClass(d,D)}function N(t,i){document.body.click(),typeof i.onClick=="function"&&i.onClick(t,i.id),l.emit("click",t,i.id)}function le(t,i){if(t.tipsEnable&&t.tipsText){const d=n.reactive({content:t.tipsText,enable:t.tipsEnable});return n.withDirectives(n.createVNode("button",{type:"button",class:F(t,i),id:t.id,disabled:!t.enable,onClick:D=>N(D,t)},[O.shouldShowIcon(t)&&n.createVNode("i",{class:O.iconClass(t)},null),t.text]),[[n.resolveDirective("tooltip"),d]])}return n.createVNode("button",{type:"button",class:F(t,i),id:t.id,disabled:!t.enable,onClick:d=>N(d,t)},[O.shouldShowIcon(t)&&n.createVNode("i",{class:O.iconClass(t)},null),t.text])}let W=new Map,T=[];function q(t){const i=Math.ceil(parseFloat(getComputedStyle(t).getPropertyValue("margin-left"))),d=Math.ceil(parseFloat(getComputedStyle(t).getPropertyValue("margin-right")));return(i||0)+t.getBoundingClientRect().width+(d||0)}function Z(t,i,d){if(i<S.value){let D=d-1;for(;D>=0;D--){const k=t[D],R=q(k);if(i+=R,i>=S.value)break}d=D}return i-=S.value,d=d<0?0:d,{start:d,space:i}}function E(t){const i=x.value;let d=t;const k=Array.from(i.children).filter(B=>B.id!=="__more_buttons__"),R=k.length;let ee=!1,M=0;for(;M<R;M++){const B=k[M],X=q(B);if(X<=d)d-=X;else{const K=Z(k,d,M);M=K.start,d=K.space,ee=!0;break}}if(!ee&&T.length>0){const B=Z(k,d,M);M=B.start,d=B.space}const Ce=T.length>0;for(;M<R;M++){const B=k[M],X=q(B);W.set(B.id,!0);const K=T.find(ye=>ye.id===B.id);K?K.width=X:T[Ce?"unshift":"push"]({id:B.id,width:X})}return d}function J(){W=new Map,T=[]}function I(t=!1){const i=Object.assign({},C.value);i.children=[];const d=new U(i),D=a.value.reduce((k,R)=>{const ee=c.items.find(M=>M.id===R.id);return t?(d.children.push(R),R.shown=!1,k):(W.has(R.id)?(d.children.push(R),R.shown=!1):R.shown=ee.visible!==!1,k.push(R),k)},[]);C.value=d,a.value=D}function m(t){if(V){J(),I(!0);return}let i=E(t);if(T.length){let d=0;for(;d<T.length;d++){const D=c.items.find(k=>k.id===T[d].id);if(D&&D.visible!==!1){const k=T[d].width;if(i>=k||d===T.length-1&&i+S.value>=k)i-=k;else break}}for(let D=0;D<d;D++)W.delete(T[D].id);T.splice(0,d-1)}I()}function z(){if(w.value&&S.value<0){const t=w.value.querySelector("#"+_.id);if(!t)return;t.getBoundingClientRect().width===0?S.value=-1:S.value=q(t)}}function L(t=-1){if(t===0||!x.value||!p.value)return;t<0&&(t=p.value.getBoundingClientRect().width),t=Math.ceil(t);const i=Math.ceil(x.value.getBoundingClientRect().width);if(V){m(t),b();return}(t>=0&&t<i||T.length)&&(z(),m(t),b())}function Q(){return S.value<0&&n.createVNode("div",{style:"position:fixed;top:-40px;visibility:hidden;"},[H(new U(_))])}const P=new ResizeObserver(t=>{if(t.length){if(V)return;const d=t[0].contentRect.width;L(d)}});function G(){p.value&&!A&&(P.observe(p.value),A=!0)}return n.onMounted(()=>{z(),L(),G(),document.body.addEventListener("click",b),document.body.addEventListener("wheel",b)}),n.onUnmounted(()=>{P.disconnect(),e(),document.body.removeEventListener("click",b),document.body.removeEventListener("wheel",b)}),n.watch(()=>c.items,()=>{a.value=ae(c.items),C.value.children=[],n.nextTick(()=>{z(),J(),L()})},{deep:!0}),n.watch(()=>c.visible,t=>{t&&n.nextTick(()=>{z(),L(),G()})}),l.expose({elementRef:w}),()=>n.createVNode("div",{class:u.value,id:s,ref:w,style:{"overflow-y":S.value<0?"hidden":"initial"}},[c.visible&&Q(),c.visible&&n.createVNode("div",{ref:p,class:r.value},[n.createVNode("div",{ref:x,class:"d-inline-block f-response-content",style:"white-space: nowrap;"},[a.value.filter(t=>t.shown).map((t,i)=>t.children&&t.children.length>0?H(t):le(t,i)),oe.value&&H(C.value)])])])}});class we{constructor(l,a){h(this,"id");h(this,"name");h(this,"presetId",[]);h(this,"responsedIndex",[]);h(this,"width");this.id=l,this.name=a,this.width=0}setWidth(l){this.width=parseInt(l+"",10)}getWidth(){return this.width}setPreset(l){Array.isArray(l)?this.presetId=this.presetId.concat(l):this.presetId.push(l)}delPreset(){this.presetId=[]}removeResponsed(l){this.responsedIndex.splice(l,1)}setResponsed(l){Array.isArray(l)?this.responsedIndex=this.responsedIndex.concat(l):this.responsedIndex.push(l)}isResponsing(){return this.responsedIndex.length>0}isResponsed(){return this.presetId.length===this.responsedIndex.length}}const xe=g.withInstall(ue);y.FResponseToolbar=ue,y.ResponseToolbarDropDownItem=U,y.ResponseToolbarGroup=we,y.ResponseToolbarItem=de,y.default=xe,y.responseToolbarProps=re,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(y,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("../common/index.umd.js"),require("vue"),require("../locale/index.umd.js")):typeof define=="function"&&define.amd?define(["exports","../common/index.umd.js","vue","../locale/index.umd.js"],p):(y=typeof globalThis<"u"?globalThis:y||self,p(y["response-toolbar"]={},y.common,y.Vue,y.locale))})(this,function(y,p,n,pe){"use strict";var De=Object.defineProperty;var ke=(y,p,n)=>p in y?De(y,p,{enumerable:!0,configurable:!0,writable:!0,value:n}):y[p]=n;var b=(y,p,n)=>ke(y,typeof p!="symbol"?p+"":p,n);const re={id:{type:String,default:""},customClass:{type:String,default:""},alignment:{Type:String,default:"right"},items:{Type:Array,default:[]},visible:{type:Boolean,default:!0},buttonSize:{type:String,default:""},moreButtonClass:{type:String,default:"btn-secondary"}};class ie{constructor(l){b(this,"id","");b(this,"class","btn-secondary");b(this,"icon","");b(this,"groupId","");b(this,"order",-1);b(this,"asDropDownTop",!1);b(this,"text","");b(this,"visible",!0);b(this,"shown",!0);b(this,"responsed",!1);b(this,"tipsEnable",!1);b(this,"tipsText","");b(this,"width",0);b(this,"dropdownClass","");b(this,"onClick",()=>{});b(this,"options");var w,f;this.options=l;const c=["id","class","icon","groupId","order","asDropDownTop","text","isDP","visible","responsed","width","tipsEnable","tipsText","dropdownClass","onClick"];Object.keys(l).filter(x=>c.indexOf(x)>-1).forEach(x=>{x==="visible"?this[x]=l[x]===void 0?!0:l[x]:this[x]=l[x]}),this.shown=this.visible,(w=l.appearance)!=null&&w.class&&(this.class=(f=l.appearance)==null?void 0:f.class),this.class||(this.class="btn-secondary")}get enable(){return Object.keys(this.options).indexOf("disabled")>-1?!this.options.disabled:n.computed(()=>!0)}setWidth(l){this.width=parseInt(l,10)}getWidth(){return this.visible?this.width:!1}}class de extends ie{constructor(l){super(l)}}function ae(){function a(l){const c=[];return l.reduce((w,f)=>(f.children&&f.children.length>0?w.push(new U(f)):w.push(new de(f)),w),c),c}return{buildResponseToolbarItems:a}}const{buildResponseToolbarItems:fe}=ae();class U extends ie{constructor(c){super(c);b(this,"placement","");b(this,"visible",!0);b(this,"dropdownClass","");b(this,"menuClass","");b(this,"split",!1);b(this,"children",[]);b(this,"expanded",!1);b(this,"shown",!0);const w=["visible","icon","isDP","class","dropdownClass","menuClass","placement","split","expanded"];Object.keys(c).filter(f=>w.indexOf(f)>-1).forEach(f=>{f==="visible"?this[f]=c[f]===void 0?!0:c[f]:this[f]=c[f]}),this.shown=this.visible,c.children&&c.children.length&&(this.children=fe(c.children))}}function he(){function a(c){const w={"f-icon":!0};if(c.icon){const f=c.icon.trim().split(" ");f&&f.length&&f.reduce((x,N)=>(x[N]=!0,x),w)}return w}function l(c){return!!(c.icon&&c.icon.trim())}return{iconClass:a,shouldShowIcon:l}}function be(a,l){function c(o){const e={"dropdown-menu":!0};return p.getCustomClass(e,o.menuClass)}function w(o){const e={disabled:!o.enable,"dropdown-submenu":!0,"f-rt-dropdown":!0,"text-truncate":!0};return p.getCustomClass(e,o.dropdownClass)}function f(o){const e={disabled:!o.enable,"dropdown-item":!0,"f-rt-btn":!0,"text-truncate":!0};return p.getCustomClass(e,o.dropdownClass)}function x(o){const e={disabled:!o.enable,"dropdown-item":!0,"f-rt-btn":!0,"text-truncate":!0,"f-rt-toggle":!o.split,"btn-icontext":!!(o.icon&&o.icon.trim()),"dropdown-toggle":!o.split,"btn-secondary":!0};return p.getCustomClass(e,o.dropdownClass)}function N(o){const e={"f-rt-btn":!0,"text-truncate":!0,"btn-icontext":!!(o.icon&&o.icon.trim()),"d-block":!0};return p.getCustomClass(e,o.dropdownClass)}let M;const C=new Map;let _="";function S(o){_="#"+o}function j(o,e,u){o.stopPropagation();const r=u?u.id:"__top_item__";if(e.children&&e.children.length&&(e.expanded=!e.expanded,e.expanded)){if(C.has(r)&&C.get(r)!==e){const g=C.get(r);g&&(g.expanded=!1,C.delete(r))}C.set(r,e)}}function W(o,e){document.body.click(),e.enable&&(o.stopPropagation(),typeof e.onClick=="function"&&e.onClick(o,e.id),a.emit("click",o,e.id))}function F(o,e){const u=o.target;u.className.indexOf("dropdown-item")<0||(u.title=u.scrollWidth>u.clientWidth?e:"")}function Y(o,e,u){if(e.tipsEnable&&e.tipsText){const r=n.reactive({content:e.tipsText,enable:e.tipsEnable});return n.withDirectives(n.createVNode("li",n.mergeProps(p.extractDataAttrs(e.options),{class:f(e),id:e.id,key:e.id+"_"+u,onClick:g=>W(g,e)}),[n.createVNode("span",{class:N(e)},[l.shouldShowIcon(e)&&n.createVNode("i",{class:l.iconClass(e)},null),e.text])]),[[n.resolveDirective("tooltip"),r]])}return n.createVNode("li",n.mergeProps(p.extractDataAttrs(e.options),{class:f(e),id:e.id,onClick:r=>W(r,e)}),[n.createVNode("span",{class:N(e),onMouseenter:r=>F(r,e.text)},[l.shouldShowIcon(e)&&n.createVNode("i",{class:l.iconClass(e)},null),e.text])])}function s(o,e,u){e.enable&&(typeof e.onClick=="function"&&u.onClick(o,e.id),a.emit("click",o,e.id),u.split||j(o,e,u))}function h(o,e,u){o&&o.stopPropagation(),j(o,e,u)}function V(o,e){o.stopPropagation();const u=e.id;if(e.children&&e.children.length&&e.expanded&&C.has(u)){const r=C.get(u);r&&(r.expanded=!1,C.delete(u))}}function H(o,e,u){if(e.tipsEnable&&e.tipsText){const r=n.reactive({content:e.tipsText,enable:e.tipsEnable});return n.createVNode("li",n.mergeProps(p.extractDataAttrs(e.options),{class:w(e),id:e.id,key:e.id+"_"+u,onClick:g=>s(g,e,o)}),[n.withDirectives(n.createVNode("span",{class:x(e)},[l.shouldShowIcon(e)&&n.createVNode("i",{class:l.iconClass(e)},null),e.text]),[[n.resolveDirective("tooltip"),r]]),e.split&&n.createVNode("span",{class:"dropdown-toggle dropdown-toggle-split f-rt-toggle",onClick:g=>h(g,e,o)},null),M(e,e)])}return n.createVNode("li",n.mergeProps(p.extractDataAttrs(e.options),{class:w(e),id:e.id,onClick:r=>s(r,e,o),onMouseenter:r=>F(r,e.text)}),[n.createVNode("span",{class:x(e)},[l.shouldShowIcon(e)&&n.createVNode("i",{class:l.iconClass(e)},null),e.text]),e.split&&n.createVNode("span",{class:"dropdown-toggle dropdown-toggle-split f-rt-toggle",onClick:r=>h(r,e,o)},null),M(e,e)])}function te(o){return o.children.filter(e=>e.visible).map((e,u)=>e.children&&e.children.length?H(o,e,u):Y(o,e,u))}function ne(o,e){if(!o)return 1080;let u=-1;const r=o.children.length;for(let g=0;g<r;g++)if(o.children[g].id===e){u=g;break}return 1080+r-u}function oe(o,e,u){var q,Z;const r={display:o.expanded?"block":"none",position:"fixed",maxWidth:"300px",minWidth:"120px",zIndex:1080,overflowY:"auto",maxHeight:"none"},g=document.querySelector(_);if(!g)return r;const I=n.getCurrentInstance();let R=(Z=(q=I==null?void 0:I.exposed)==null?void 0:q.elementRef.value)==null?void 0:Z.querySelector("#"+e);if(R||(R=g==null?void 0:g.querySelector("#"+e)),!R)return r;const le=window.innerWidth,A=window.innerHeight,T=R==null?void 0:R.getClientRects();if(R&&T&&T.length){const{top:O,width:J,left:$,right:m,height:z}=T[0],L=Math.ceil(z+O);r.top=`${L}px`,r.left=`${$}px`;const Q=o.id+"_menu",B=(R==null?void 0:R.querySelector("#"+Q))||(g==null?void 0:g.querySelector("#"+Q))||null;if(B){B.style.visibility="hidden",B.style.display="block";const G=B.offsetHeight;r.zIndex=o.expanded?ne(g,Q):1080,r.display==="block"&&(B.style.display="block");const t=B.getBoundingClientRect();if(u){r.top=`${O-6}px`;const i=Math.ceil(J+$);r.left=`${i}px`}le-$-J<t.width&&(r.left=`${(u?$:m)-t.width}px`),A-O-z<G?O>G?(r.top=`${O-G-6}px`,r.maxHeight=`${O-16}px`):(r.maxHeight=`${A-L}px`,O>A-O-z&&(r.top="10px",r.maxHeight=`${O-16}px`)):r.maxHeight=`${A-L}px`,B.style.visibility="visible"}}return r}M=function(o,e){const u=e?e.id:o.id;return n.createVNode(n.Teleport,{to:_,disabled:!o.expanded},{default:()=>[n.createVNode("ul",{class:c(o),style:oe(o,u,e),id:o.id+"_menu",onWheel:r=>V(r,o)},[te(o)])]})};function se(){C.forEach(o=>{o.expanded=!1}),C.clear()}return{renderDropdownMenu:M,clearAllDropDownMenu:se,updateContainerId:S}}function ge(a,l,c){const w=n.ref(a.alignment),{renderDropdownMenu:f,clearAllDropDownMenu:x,updateContainerId:N}=be(l,c);function M(s){const h={"btn-group":!0,"f-rt-dropdown":!0,"f-btn-ml":w.value==="right"||w.value==="center","f-btn-mr":w.value==="left"};return p.getCustomClass(h,s.dropdownClass)}function C(s){const h={btn:!0,disabled:!s.enable,"f-rt-btn":!0,"btn-icontext":!!(s.icon&&s.icon.trim())&&s.text,"f-rt-toggle":!s.split,"dropdown-toggle":!s.split,"f-btn-icon":s.icon&&!s.text};return p.getCustomClass(h,s.class)}function _(s){const h={btn:!0,"dropdown-toggle":!0,"dropdown-toggle-split":!0};return p.getCustomClass(h,s.class)}function S(s){return s.split?{display:"flex"}:{display:"flex","border-radius":"6px"}}function j(s,h){s.stopPropagation();const V=h.expanded;document.body.click(),typeof h.onClick=="function"&&h.onClick(s,h.id),l.emit("click",s,h.id),h.split||(h.expanded=!V)}function W(s,h){s.stopPropagation();const V=h.expanded;document.body.click(),h.expanded=!V}function F(s,h=!0){if(s.tipsEnable&&s.tipsText){const V=n.reactive({content:s.tipsText,enable:s.tipsEnable});return n.createVNode("div",{id:s.id,class:M(s)},[n.withDirectives(n.createVNode("div",{class:C(s),style:S(s),onClick:H=>s.enable&&j(H,s)},[c.shouldShowIcon(s)&&n.createVNode("i",{class:c.iconClass(s)},null),s.text&&n.createVNode("span",null,[s.text])]),[[n.resolveDirective("tooltip"),V]]),s.split&&n.createVNode("button",{class:_(s),style:"border-radius:0 6px 6px 0;",onClick:H=>W(H,s)},null),h&&f(s)])}return n.createVNode("div",{id:s.id,class:M(s)},[n.createVNode("div",{class:C(s),style:S(s),onClick:V=>s.enable&&j(V,s)},[c.shouldShowIcon(s)&&n.createVNode("i",{class:c.iconClass(s)},null),s.text&&n.createVNode("span",null,[s.text])]),s.split&&n.createVNode("button",{class:_(s),style:"border-radius:0 6px 6px 0;",onClick:V=>W(V,s)},null),h&&f(s)])}function Y(){x()}return{renderToolbarDropdown:F,clearAllDropDown:Y,updateContainerId:N}}const{buildResponseToolbarItems:ce}=ae(),ue=n.defineComponent({name:"FResponseToolbar",props:re,emits:["click"],setup(a,l){const c=n.ref(ce(a.items)),w=n.ref(),f=n.ref(),x=n.ref(),N=p.isMobilePhone(),M={id:"__more_buttons__",text:N?"":pe.LocaleService.getLocaleValue("responseToolbar.more"),icon:N?"f-icon-more-horizontal":""},C=n.ref(new U(M)),_=Object.assign({},M,{id:M.id+"width"}),S=n.ref(-1),j=he();let W=!1;const{guid:F,uuid:Y}=p.useGuid(),s=a.id?a.id:"toolbar-"+F(),h=n.ref(),V="dropdown-container-"+s+"-"+Y(4),{renderToolbarDropdown:H,clearAllDropDown:te,updateContainerId:ne}=ge(a,l,j);ne(V);const oe=n.computed(()=>C.value.children.length>0),se=n.computed(()=>a.visible?C.value.children.length>0?!0:c.value.findIndex(t=>t.shown&&t.children&&t.children.length>0)>-1:!1);function o(){a.visible&&!h.value&&document&&(h.value=document.createElement("div"),h.value.id=V,document.body.appendChild(h.value))}o();function e(){h.value&&document.body.contains(h.value)&&(document.body.removeChild(h.value),h.value=null)}n.watch(se,(t,i)=>{t?o():e()});const u=n.computed(()=>{const t={"f-toolbar":!0,"f-response-toolbar":!0,"position-relative":!0,"f-response-toolbar-sm":a.buttonSize==="sm","f-response-toolbar-lg":a.buttonSize==="lg","d-none":!a.visible,"is-mobile":N};return p.getCustomClass(t,a.customClass)}),r=n.computed(()=>({"w-100":!0,"d-flex":!0,"flex-nowrap":!0,"justify-content-end":a.alignment==="right","justify-content-start":a.alignment==="left","justify-content-center":a.alignment==="center"}));function g(t){t&&t.target.closest("ul.dropdown-menu")&&t.type==="wheel"||(c.value.filter(i=>i.children&&i.children.length>0).forEach(i=>{i.expanded=!1}),C.value.expanded=!1,te())}function I(t,i){var D;const d={btn:!0,"f-rt-btn":!0,"f-btn-ml":a.alignment==="right"||i>0&&a.alignment==="center","f-btn-mr":a.alignment==="left","btn-icontext":!!(t.icon&&t.icon.trim())},k=((D=t==null?void 0:t.appearance)==null?void 0:D.class)||t.class||"btn-secondary";return p.getCustomClass(d,k)}function R(t,i){document.body.click(),typeof i.onClick=="function"&&i.onClick(t,i.id),l.emit("click",t,i.id)}function le(t,i){if(t.tipsEnable&&t.tipsText){const d=n.reactive({content:t.tipsText,enable:t.tipsEnable});return n.withDirectives(n.createVNode("button",n.mergeProps({type:"button"},p.extractDataAttrs(t.options),{class:I(t,i),id:t.id,disabled:!t.enable,onClick:k=>R(k,t)}),[j.shouldShowIcon(t)&&n.createVNode("i",{class:j.iconClass(t)},null),t.text]),[[n.resolveDirective("tooltip"),d]])}return n.createVNode("button",n.mergeProps({type:"button"},p.extractDataAttrs(t.options),{class:I(t,i),id:t.id,disabled:!t.enable,onClick:d=>R(d,t)}),[j.shouldShowIcon(t)&&n.createVNode("i",{class:j.iconClass(t)},null),t.text])}let A=new Map,T=[];function q(t){const i=Math.ceil(parseFloat(getComputedStyle(t).getPropertyValue("margin-left"))),d=Math.ceil(parseFloat(getComputedStyle(t).getPropertyValue("margin-right")));return(i||0)+t.getBoundingClientRect().width+(d||0)}function Z(t,i,d){if(i<S.value){let k=d-1;for(;k>=0;k--){const D=t[k],v=q(D);if(i+=v,i>=S.value)break}d=k}return i-=S.value,d=d<0?0:d,{start:d,space:i}}function O(t){const i=x.value;let d=t;const D=Array.from(i.children).filter(E=>E.id!=="__more_buttons__"),v=D.length;let ee=!1,P=0;for(;P<v;P++){const E=D[P],X=q(E);if(X<=d)d-=X;else{const K=Z(D,d,P);P=K.start,d=K.space,ee=!0;break}}if(!ee&&T.length>0){const E=Z(D,d,P);P=E.start,d=E.space}const Ce=T.length>0;for(;P<v;P++){const E=D[P],X=q(E);A.set(E.id,!0);const K=T.find(ye=>ye.id===E.id);K?K.width=X:T[Ce?"unshift":"push"]({id:E.id,width:X})}return d}function J(){A=new Map,T=[]}function $(t=!1){const i=Object.assign({},C.value);i.children=[];const d=new U(i),k=c.value.reduce((D,v)=>{const ee=a.items.find(P=>P.id===v.id);return t?(d.children.push(v),v.shown=!1,D):(A.has(v.id)?(d.children.push(v),v.shown=!1):v.shown=ee.visible!==!1,D.push(v),D)},[]);C.value=d,c.value=k}function m(t){if(N){J(),$(!0);return}let i=O(t);if(T.length){let d=0;for(;d<T.length;d++){const k=a.items.find(D=>D.id===T[d].id);if(k&&k.visible!==!1){const D=T[d].width;if(i>=D||d===T.length-1&&i+S.value>=D)i-=D;else break}}for(let k=0;k<d;k++)A.delete(T[k].id);T.splice(0,d-1)}$()}function z(){if(w.value&&S.value<0){const t=w.value.querySelector("#"+_.id);if(!t)return;t.getBoundingClientRect().width===0?S.value=-1:S.value=q(t)}}function L(t=-1){if(t===0||!x.value||!f.value)return;t<0&&(t=f.value.getBoundingClientRect().width),t=Math.ceil(t);const i=Math.ceil(x.value.getBoundingClientRect().width);if(N){m(t),g();return}(t>=0&&t<i||T.length)&&(z(),m(t),g())}function Q(){return S.value<0&&n.createVNode("div",{style:"position:fixed;top:-40px;visibility:hidden;"},[H(new U(_))])}const B=new ResizeObserver(t=>{if(t.length){if(N)return;const d=t[0].contentRect.width;L(d)}});function G(){f.value&&!W&&(B.observe(f.value),W=!0)}return n.onMounted(()=>{z(),L(),G(),document.body.addEventListener("click",g),document.body.addEventListener("wheel",g)}),n.onUnmounted(()=>{B.disconnect(),e(),document.body.removeEventListener("click",g),document.body.removeEventListener("wheel",g)}),n.watch(()=>a.items,()=>{c.value=ce(a.items),C.value.children=[],n.nextTick(()=>{z(),J(),L()})},{deep:!0}),n.watch(()=>a.visible,t=>{t&&n.nextTick(()=>{z(),L(),G()})}),l.expose({elementRef:w}),()=>n.createVNode("div",n.mergeProps(p.extractDataAttrs(l.attrs),{class:u.value,id:s,ref:w,style:{"overflow-y":S.value<0?"hidden":"initial"}}),[a.visible&&Q(),a.visible&&n.createVNode("div",{ref:f,class:r.value},[n.createVNode("div",{ref:x,class:"d-inline-block f-response-content",style:"white-space: nowrap;"},[c.value.filter(t=>t.shown).map((t,i)=>t.children&&t.children.length>0?H(t):le(t,i)),oe.value&&H(C.value)])])])}});class we{constructor(l,c){b(this,"id");b(this,"name");b(this,"presetId",[]);b(this,"responsedIndex",[]);b(this,"width");this.id=l,this.name=c,this.width=0}setWidth(l){this.width=parseInt(l+"",10)}getWidth(){return this.width}setPreset(l){Array.isArray(l)?this.presetId=this.presetId.concat(l):this.presetId.push(l)}delPreset(){this.presetId=[]}removeResponsed(l){this.responsedIndex.splice(l,1)}setResponsed(l){Array.isArray(l)?this.responsedIndex=this.responsedIndex.concat(l):this.responsedIndex.push(l)}isResponsing(){return this.responsedIndex.length>0}isResponsed(){return this.presetId.length===this.responsedIndex.length}}const xe=p.withInstall(ue);y.FResponseToolbar=ue,y.ResponseToolbarDropDownItem=U,y.ResponseToolbarGroup=we,y.ResponseToolbarItem=de,y.default=xe,y.responseToolbarProps=re,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});