@quidgest/ui 0.5.14 → 0.5.15
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/dist/index.d.ts +139 -55
- package/dist/ui.esm.js +392 -381
- package/dist/ui.esm.js.map +1 -1
- package/dist/ui.js +2 -2
- package/dist/ui.js.map +1 -1
- package/dist/ui.min.js +48 -46
- package/dist/ui.min.js.map +1 -1
- package/dist/ui.scss +1 -1
- package/package.json +1 -1
package/dist/ui.min.js
CHANGED
|
@@ -4,10 +4,10 @@ for(const t in e)o[t]=e[t]
|
|
|
4
4
|
for(const a in t){const r=e[a],i=t[a]
|
|
5
5
|
n(r)&&n(i)?o[a]=l(r,i):o[a]=i}return o}const a="q-defaults"
|
|
6
6
|
function r(e){if(o(e))return
|
|
7
|
-
const n=i(),r=t.ref(e),
|
|
8
|
-
t.provide(a,
|
|
7
|
+
const n=i(),r=t.ref(e),s=t.computed((()=>o(r.value)?n.value:l(n.value,r.value)))
|
|
8
|
+
t.provide(a,s)}function i(){const e=t.inject(a,void 0)
|
|
9
9
|
if(!e)throw new Error("[Quidgest UI] Could not find defaults instance")
|
|
10
|
-
return e}const
|
|
10
|
+
return e}const s={primary:"#00a1f8",primaryLight:"#e5f6ff",primaryDark:"#0079ba",secondary:"#11294d",secondaryLight:"#707f94",secondaryDark:"#040a13",highlight:"#DF640A",background:"#fff",container:"#fff",info:"#17a2b8",infoLight:"#bceff7",infoDark:"#11798a",success:"#28a745",successLight:"#c2f0cd",successDark:"#1e7d34",warning:"#ffa900",warningLight:"#ffeabf",warningDark:"#bf7f00",danger:"#b71c1c",dangerLight:"#f5bebe",dangerDark:"#891515",onBackground:"#1e2436",onPrimary:"#fff",onSecondary:"#fff",onHighlight:"#fff",onSuccess:"#fff",onWarning:"#fff",onDanger:"#fff",onInfo:"#fff"},c={primary:"#018BD2",primaryLight:"#cce7f6",primaryDark:"#006fac",secondary:"#11294d",secondaryLight:"#707f94",secondaryDark:"#040a13",highlight:"#FFAD54",background:"#1e2436",container:"#21323d",info:"#3DB6D1",infoLight:"#5aa2bc",infoDark:"#0c616a",success:"#00C781",successLight:"#6bae78",successDark:"#0f3b16",warning:"#FFD860",warningLight:"#ffd07a",warningDark:"#cc8000",danger:"#FC4B6C",dangerLight:"#FF7A88",dangerDark:"#B21929",onBackground:"#fff",onPrimary:"#fff",onSecondary:"#fff",onHighlight:"#fff",onSuccess:"#fff",onWarning:"#fff",onDanger:"#fff",onInfo:"#fff"}
|
|
11
11
|
function d(e){if(!/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(e))throw new Error("Invalid color format")
|
|
12
12
|
4===e.length&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3])
|
|
13
13
|
return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16)}}function u(e,t){if(t<0||t>100)throw new Error("Amount must be in the range [0, 100]")
|
|
@@ -18,33 +18,33 @@ if(0===t)return e
|
|
|
18
18
|
const o=m(e),n=t/100
|
|
19
19
|
return o.l=o.l-n*o.l,h(o)}function p(e){return`#${e.r.toString(16).padStart(2,"0")}${e.g.toString(16).padStart(2,"0")}${e.b.toString(16).padStart(2,"0")}`}function m(e){const t=e.r/255,o=e.g/255,n=e.b/255,l=Math.max(t,o,n),a=Math.min(t,o,n)
|
|
20
20
|
let r,i=0
|
|
21
|
-
const
|
|
21
|
+
const s=(l+a)/2
|
|
22
22
|
if(l===a)i=r=0
|
|
23
23
|
else{const e=l-a
|
|
24
|
-
switch(r=
|
|
24
|
+
switch(r=s>.5?e/(2-l-a):e/(l+a),l){case t:i=(o-n)/e+(o<n?6:0)
|
|
25
25
|
break
|
|
26
26
|
case o:i=(n-t)/e+2
|
|
27
27
|
break
|
|
28
|
-
case n:i=(t-o)/e+4}i/=6}return{h:Math.round(360*i),s:Math.round(100*r),l:Math.round(100*
|
|
28
|
+
case n:i=(t-o)/e+4}i/=6}return{h:Math.round(360*i),s:Math.round(100*r),l:Math.round(100*s)}}function h(e){const t=e.h/360,o=e.s/100,n=e.l/100
|
|
29
29
|
let l,a,r
|
|
30
30
|
if(0===o)l=a=r=n
|
|
31
31
|
else{const e=n<.5?n*(1+o):n+o-n*o,i=2*n-e
|
|
32
32
|
l=v(i,e,t+1/3),a=v(i,e,t),r=v(i,e,t-1/3)}return{r:Math.round(255*l),g:Math.round(255*a),b:Math.round(255*r)}}function v(e,t,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e}const y="q-theme"
|
|
33
33
|
function g(e,o){let n=null
|
|
34
|
-
if(o)for(const e of o.themes){const t="light"===e.mode?c
|
|
34
|
+
if(o)for(const e of o.themes){const t="light"===e.mode?s:c
|
|
35
35
|
if(e.colors){let t
|
|
36
36
|
for(t in e.colors){const o=e.colors[t]
|
|
37
37
|
if(o&&!t.startsWith("on")&&!t.endsWith("Light")&&!t.endsWith("Dark")){const n=d(o),l=`${t}Light`,a=`${t}Dark`
|
|
38
|
-
l in e.colors||(e.colors[l]=p(u(n,85))),a in e.colors||(e.colors[a]=p(f(n,25)))}}}e.colors=
|
|
39
|
-
n={name:e,mode:"light",colors:
|
|
38
|
+
l in e.colors||(e.colors[l]=p(u(n,85))),a in e.colors||(e.colors[a]=p(f(n,25)))}}}e.colors=b(t,e.colors),e.name===o.defaultTheme&&(n=e)}else{const e="default"
|
|
39
|
+
n={name:e,mode:"light",colors:s},o={defaultTheme:e,themes:[n]}}if(n){const l=t.ref({activeTheme:n.name,themes:o.themes})
|
|
40
40
|
t.watch((()=>l.value.activeTheme),(e=>{const t=l.value.themes.find((t=>t.name===e))
|
|
41
41
|
t&&function(e){let t=document.getElementById(y)
|
|
42
42
|
t||(t=document.createElement("style"),t.type="text/css",t.id=y,document.head.appendChild(t))
|
|
43
43
|
let o,n=":root {\n"
|
|
44
44
|
for(o in e){const t=e[o]
|
|
45
|
-
if(t){n+=` ${
|
|
45
|
+
if(t){n+=` ${k(o)}: ${t};\n`
|
|
46
46
|
const e=d(t)
|
|
47
|
-
n+=` ${
|
|
47
|
+
n+=` ${k(o)}-rgb: ${e.r} ${e.g} ${e.b};\n`}}n+="}",t.textContent=n}(t.colors)}),{immediate:!0}),e.provide(y,l)}}function b(e,t={}){return{...e,...t}}function k(e){return e?`--q-theme-${e.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}`:""}const w=[t.createElementVNode("svg",{viewBox:"25 25 50 50"},[t.createElementVNode("circle",{class:"path",cx:"50",cy:"50",r:"20",fill:"none",stroke:"currentColor","stroke-width":"5","stroke-miterlimit":"10"})],-1)]
|
|
48
48
|
function B(e){const n=e.setup
|
|
49
49
|
return n&&(e.setup=(e,l)=>{const a=function(){const e=t.getCurrentInstance()
|
|
50
50
|
if(!e)throw new Error("[Quidgest UI] useDefaults must be called from inside a setup function")
|
|
@@ -56,11 +56,11 @@ return null==(e=n.value)?void 0:e[o]}))}()
|
|
|
56
56
|
if(o(a.value))return n(e,l)
|
|
57
57
|
const r=t.getCurrentInstance()
|
|
58
58
|
if(null===r)return n(e,l)
|
|
59
|
-
const
|
|
59
|
+
const s=new Proxy(e,{get(e,t){var o
|
|
60
60
|
const n=Reflect.get(e,t),l=null==(o=a.value)?void 0:o[t]
|
|
61
|
-
return"
|
|
61
|
+
return"string"!=typeof t||function(e,t){var o
|
|
62
62
|
return typeof(null==(o=e.props)?void 0:o[t])<"u"}(r.vnode,t)?n:l??n}})
|
|
63
|
-
return n(
|
|
63
|
+
return n(s,l)}),e}const C=B(t.defineComponent({__name:"QSpinnerLoader",props:{size:{default:48}},setup(e){const o=e,n=t.computed((()=>({"font-size":48!==o.size?`${o.size}px`:void 0})))
|
|
64
64
|
return(e,o)=>(t.openBlock(),t.createElementBlock("div",{class:"q-spinner-loader",style:t.normalizeStyle(n.value)},w,4))}})),S=["disabled","onClick"],_={key:0,class:"q-btn__spinner"},E={class:"q-btn__content"},x=B(t.defineComponent({__name:"QButton",props:{active:{type:Boolean},bStyle:{default:"secondary"},label:{default:""},disabled:{type:Boolean},iconOnRight:{type:Boolean},borderless:{type:Boolean},elevated:{type:Boolean},block:{type:Boolean},loading:{type:Boolean},size:{default:"regular"}},emits:["click"],setup(e,{emit:o}){const n=e,l=t.computed((()=>n.disabled||n.loading))
|
|
65
65
|
function a(e){l.value||o("click",e)}const r=t.computed((()=>{const e=t.computed((()=>n.bStyle?`q-btn--${n.bStyle}`:void 0)),o=t.computed((()=>"regular"!==n.size?`q-btn--${n.size}`:void 0))
|
|
66
66
|
return["q-btn",e.value,o.value,{"q-btn--active":n.active,"q-btn--borderless":n.borderless,"q-btn--elevated":n.elevated,"q-btn--block":n.block,"q-btn--loading":n.loading}]}))
|
|
@@ -99,8 +99,8 @@ return(e,a)=>n.icon?(t.openBlock(),t.createBlock(t.unref(I),{key:0,class:"q-icon
|
|
|
99
99
|
return(e,n)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["q-input",`q-input--${o.size}`,{"q-input--readonly":o.readonly,"q-input--disabled":o.disabled}])},[e.$slots.prepend?(t.openBlock(),t.createElementBlock("div",P,[t.renderSlot(e.$slots,"prepend")])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default"),e.$slots.append?(t.openBlock(),t.createElementBlock("div",O,[t.renderSlot(e.$slots,"append")])):t.createCommentVNode("",!0)],2))}})),H={class:"q-line-loader"}
|
|
100
100
|
const U=B(((e,t)=>{const o=e.__vccOpts||e
|
|
101
101
|
for(const[e,n]of t)o[e]=n
|
|
102
|
-
return o})({},[["render",function(e,o){return t.openBlock(),t.createElementBlock("div",H)}]])),j=t.defineComponent({__name:"QList",props:{modelValue:{type:[String,Number,Boolean,Symbol],default:void 0},items:{},groups:{default:()=>[]},itemValue:{default:"key"},itemLabel:{default:"label"},disabled:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:o,emit:n}){const l=e,a=t.ref(l.modelValue),r=t.computed((()=>i.value.length>1?"div":"ul")),i=t.computed((()=>l.groups.length?l.groups:[{title:""}])),
|
|
103
|
-
function
|
|
102
|
+
return o})({},[["render",function(e,o){return t.openBlock(),t.createElementBlock("div",H)}]])),j=t.defineComponent({__name:"QList",props:{modelValue:{type:[String,Number,Boolean,Symbol],default:void 0},items:{},groups:{default:()=>[]},itemValue:{default:"key"},itemLabel:{default:"label"},disabled:{type:Boolean}},emits:["update:modelValue"],setup(e,{expose:o,emit:n}){const l=e,a=t.ref(l.modelValue),r=t.computed((()=>i.value.length>1?"div":"ul")),i=t.computed((()=>l.groups.length?l.groups:[{title:""}])),s=t.ref(null)
|
|
103
|
+
function c(e){a.value=e,n("update:modelValue",e)}function d(){let e=0
|
|
104
104
|
a.value&&(e=l.items.findIndex((e=>e[l.itemValue]===a.value))),p(e)}function u(e){switch(["ArrowDown","ArrowUp","Home","End"].includes(e.key)&&e.preventDefault(),e.key){case"ArrowDown":f("next")
|
|
105
105
|
break
|
|
106
106
|
case"ArrowUp":f("prev")
|
|
@@ -114,32 +114,32 @@ case"first":p(0)
|
|
|
114
114
|
break
|
|
115
115
|
case"last":p(-1)}}function p(e){var t
|
|
116
116
|
null==(t=m().at(e))||t.focus()}function m(){var e
|
|
117
|
-
const t=null==(e=
|
|
118
|
-
return t?Array.from(t).filter((e=>-1!==e.tabIndex)):[]}function h(e){return e?l.items.filter((t=>t.group===e)):l.items}return t.watch((()=>l.modelValue),(e=>{a.value=e})),o({focusItem:p}),(e,o)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.value),{ref_key:"listRef",ref:
|
|
117
|
+
const t=null==(e=s.value)?void 0:e.querySelectorAll("li")
|
|
118
|
+
return t?Array.from(t).filter((e=>-1!==e.tabIndex)):[]}function h(e){return e?l.items.filter((t=>t.group===e)):l.items}return t.watch((()=>l.modelValue),(e=>{a.value=e})),o({focusItem:p}),(e,o)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.value),{ref_key:"listRef",ref:s,class:t.normalizeClass(["q-list",{"q-list--disabled":l.disabled}]),role:"listbox",tabindex:l.disabled?-1:0,onFocus:d,onKeydown:u},{default:t.withCtx((()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.value,(e=>(t.openBlock(),t.createBlock(t.unref(ne),{key:e.id,title:e.title,disabled:e.disabled},{default:t.withCtx((()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h(e.id),(e=>(t.openBlock(),t.createBlock(t.unref(oe),{key:e[l.itemValue],value:e[l.itemValue],label:e[l.itemLabel],icon:e.icon,disabled:l.disabled||e.disabled,selected:a.value===e[l.itemValue],onSelect:c},null,8,["value","label","icon","disabled","selected"])))),128))])),_:2},1032,["title","disabled"])))),128))])),_:1},40,["class","tabindex"]))}}),W=["tabindex","aria-label","aria-selected","onClick"],G={class:"q-list-item__check-container"},K={check:{icon:"check"}},X=t.defineComponent({__name:"QListItem",props:{value:{type:[String,Number,Boolean,Symbol]},label:{},icon:{default:void 0},selected:{type:Boolean,default:!1},highlighted:{type:Boolean,default:!1},icons:{default:()=>K},disabled:{type:Boolean,default:!1}},emits:["select"],setup(e,{emit:o}){const n=e
|
|
119
119
|
function l(){n.disabled||o("select",n.value)}function a(e){"Tab"===e.key&&l(),("Enter"===e.key||" "===e.key)&&(e.preventDefault(),e.stopPropagation(),l())}return(e,o)=>(t.openBlock(),t.createElementBlock("li",{role:"option",tabindex:n.disabled?void 0:-2,class:t.normalizeClass(["q-list-item",{"q-list-item--disabled":n.disabled,"q-list-item--selected":n.selected,"q-list-item--highlighted":n.highlighted}]),"aria-label":n.label,"aria-selected":n.disabled?void 0:n.selected,onKeydown:a,onClick:t.withModifiers(l,["stop","prevent"])},[n.icon?(t.openBlock(),t.createBlock(t.unref(T),t.normalizeProps(t.mergeProps({key:0},n.icon)),null,16)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(n.label)+" ",1),t.createElementVNode("div",G,[n.selected?(t.openBlock(),t.createBlock(t.unref(T),t.mergeProps({key:0},n.icons.check,{class:"q-list-item__check"}),null,16)):t.createCommentVNode("",!0)])],42,W))}})
|
|
120
120
|
let Y=0
|
|
121
|
-
const Z=["aria-labelledby"],J=["id"],ee=t.defineComponent({__name:"QListItemGroup",props:{
|
|
122
|
-
return(e,
|
|
123
|
-
function le(e,t,o="right",n){const l=e.getBoundingClientRect(),a=l.x+window.scrollX,r=l.y+window.scrollY,i=null==t?void 0:t.getBoundingClientRect(),
|
|
121
|
+
const Z=["aria-labelledby"],J=["id"],ee=t.defineComponent({__name:"QListItemGroup",props:{title:{default:""},disabled:{type:Boolean,default:!1}},setup(e){const o=e,n="uid-"+ ++Y
|
|
122
|
+
return(e,l)=>o.title?(t.openBlock(),t.createElementBlock("ul",{key:1,class:"q-list-item-group",role:"group","aria-labelledby":t.unref(n)},[o.title?(t.openBlock(),t.createElementBlock("li",{key:0,id:t.unref(n),class:"q-list-item-group__title",role:"presentation"},t.toDisplayString(o.title),9,J)):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default")],8,Z)):t.renderSlot(e.$slots,"default",{key:0})}}),te=B(j),oe=B(X),ne=B(ee)
|
|
123
|
+
function le(e,t,o="right",n){const l=e.getBoundingClientRect(),a=l.x+window.scrollX,r=l.y+window.scrollY,i=null==t?void 0:t.getBoundingClientRect(),s=(null==i?void 0:i.width)??0,c=(null==i?void 0:i.height)??0
|
|
124
124
|
let d=o
|
|
125
125
|
i&&!ae(l,i,d)&&(d=function(e,t,o){const n={top:["bottom","left","right"],bottom:["top","left","right"],left:["right","top","bottom"],right:["left","top","bottom"]}
|
|
126
126
|
for(const l of n[o])if(ae(e,t,l))return l
|
|
127
127
|
return o}(l,i,d))
|
|
128
128
|
const u={x:0,y:0,placement:d}
|
|
129
|
-
switch(d){case"top":u.x="anchor"===n?a:a+(l.width-
|
|
129
|
+
switch(d){case"top":u.x="anchor"===n?a:a+(l.width-s)/2,u.y=r-c
|
|
130
130
|
break
|
|
131
|
-
case"bottom":u.x="anchor"===n?a:a+(l.width-
|
|
131
|
+
case"bottom":u.x="anchor"===n?a:a+(l.width-s)/2,u.y=r+l.height
|
|
132
132
|
break
|
|
133
|
-
case"left":u.x=a-
|
|
133
|
+
case"left":u.x=a-s,u.y=r+l.height/2-c/2
|
|
134
134
|
break
|
|
135
|
-
case"right":u.x=a+l.width,u.y=r+l.height/2-
|
|
135
|
+
case"right":u.x=a+l.width,u.y=r+l.height/2-c/2}return"anchor"===n&&l.width>=s&&(u.width=l.width),u}function ae(e,t,o){let n=!1,l=!1
|
|
136
136
|
switch(o){case"top":n=ie(e,t),l=e.top>t.height
|
|
137
137
|
break
|
|
138
138
|
case"bottom":n=ie(e,t),l=window.innerHeight-e.top-e.height>t.height
|
|
139
139
|
break
|
|
140
140
|
case"left":n=e.left>t.width,l=re(e,t)
|
|
141
141
|
break
|
|
142
|
-
case"right":n=window.innerWidth-e.left-e.width>t.width,l=re(e,t)}return n&&l}function re(e,t){return window.innerHeight-e.top-e.height/2>t.height/2&&e.top+e.height/2>t.height/2}function ie(e,t){return window.innerWidth-e.left-e.width/2>t.width/2&&e.left+e.width/2>t.width/2}function
|
|
142
|
+
case"right":n=window.innerWidth-e.left-e.width>t.width,l=re(e,t)}return n&&l}function re(e,t){return window.innerHeight-e.top-e.height/2>t.height/2&&e.top+e.height/2>t.height/2}function ie(e,t){return window.innerWidth-e.left-e.width/2>t.width/2&&e.left+e.width/2>t.width/2}function se(e){return"string"==typeof e?document.querySelector(e):e&&"$el"in e?e.$el:e}const ce={key:0,class:"q-overlay__arrow"},de=B(t.defineComponent({inheritAttrs:!1,__name:"QOverlay",props:{modelValue:{type:Boolean},anchor:{},appearance:{default:"regular"},arrow:{type:Boolean,default:!1},attach:{default:"body"},contentClasses:{default:()=>[]},delay:{default:500},disabled:{type:Boolean},offset:{default:8},placement:{default:"right"},spy:{type:Boolean,default:!1},transition:{default:"fade"},trigger:{default:"click"},width:{default:"auto"}},emits:["enter","leave"],setup(e,{emit:o}){const n=e,l=t.computed((()=>["q-overlay",`q-overlay--${a.placement}`,{"q-overlay--inverted":"inverted"===n.appearance},...n.contentClasses])),a=t.reactive({visible:n.modelValue,top:0,left:0,width:0,placement:n.placement}),r=t.computed((()=>a.visible&&!n.disabled))
|
|
143
143
|
t.watch((()=>n.modelValue),(()=>a.visible=n.modelValue))
|
|
144
144
|
const i=t.computed((()=>{let e=0,t=0
|
|
145
145
|
switch(a.placement){case"top":t=-(n.offset||0)
|
|
@@ -149,36 +149,38 @@ break
|
|
|
149
149
|
case"left":e=-(n.offset||0)
|
|
150
150
|
break
|
|
151
151
|
case"right":e=n.offset||0}const o={top:`${a.top+t}px`,left:`${a.left+e}px`}
|
|
152
|
-
return void 0!==a.width&&["top","bottom"].includes(a.placement)&&(o.width=`${a.width}px`),o})),
|
|
153
|
-
function
|
|
154
|
-
if(e){const t=le(e,
|
|
152
|
+
return void 0!==a.width&&["top","bottom"].includes(a.placement)&&(o.width=`${a.width}px`),o})),s=t.ref(null)
|
|
153
|
+
function c(){const e=se(n.anchor)
|
|
154
|
+
if(e){const t=le(e,s.value,n.placement,n.width)
|
|
155
155
|
a.left=t.x,a.top=t.y,a.width=t.width,a.placement=t.placement}}let d,u,f
|
|
156
156
|
function p(){const e="hover"===n.trigger?n.delay:0
|
|
157
|
-
d||(d=window.setTimeout((()=>a.visible=!0),e))}function m(){clearTimeout(d),d=void 0,a.visible=!1}function h(){r.value?m():p()}function v(){
|
|
158
|
-
e&&(window.addEventListener("scroll",
|
|
157
|
+
d||(d=window.setTimeout((()=>a.visible=!0),e))}function m(){clearTimeout(d),d=void 0,a.visible=!1}function h(){r.value?m():p()}function v(){se(n.anchor)?(c(),f=window.setTimeout(v,100)):m()}function y(){t.nextTick((()=>{const e=se(n.anchor)
|
|
158
|
+
e&&(window.addEventListener("scroll",c),window.addEventListener("resize",c),u=new MutationObserver(c),u.observe(e,{attributes:!1,childList:!0,characterData:!0,subtree:!0}),c())})),n.spy&&v()}function g(){window.removeEventListener("scroll",c),window.removeEventListener("resize",c),null==u||u.disconnect(),n.spy&&(clearTimeout(f),f=void 0)}return t.watch([()=>r.value,()=>n.placement],c),t.onBeforeUnmount(g),t.onMounted(c),t.watch((()=>n.disabled),(e=>{e||t.nextTick((()=>{const e=se(n.anchor)
|
|
159
159
|
if(e)switch(n.trigger){case"click":e.addEventListener("click",h)
|
|
160
160
|
break
|
|
161
|
-
case"hover":e.addEventListener("mouseenter",p),e.addEventListener("mouseleave",m)}}))}),{immediate:!0}),t.watch((()=>r.value),(e=>{e?y():g()}),{immediate:!0}),(e,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.renderSlot(e.$slots,"trigger",{open:r.value}),(t.openBlock(),t.createBlock(t.Teleport,{to:n.attach},[t.createVNode(t.Transition,{name:n.transition,appear:"",onEnter:a[0]||(a[0]=e=>o("enter")),onLeave:a[1]||(a[1]=e=>o("leave"))},{default:t.withCtx((()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(l.value),style:t.normalizeStyle(i.value)},[t.createElementVNode("div",{class:t.normalizeClass(["q-overlay__content"]),ref_key:"overlay",ref:
|
|
162
|
-
return(e,n)=>(t.openBlock(),t.createBlock(t.unref(de),{"model-value":o.modelValue,trigger:"click",anchor:o.anchor,arrow:o.arrow,attach:o.attach,"content-classes":["q-popover"],disabled:o.disabled,placement:o.placement,spy:o.spy},{default:t.withCtx((()=>[o.title||e.$slots.header?(t.openBlock(),t.createElementBlock("h3",ue,[t.createTextVNode(t.toDisplayString(o.title)+" ",1),t.renderSlot(e.$slots,"header")])):t.createCommentVNode("",!0),o.text||e.$slots.body?(t.openBlock(),t.createElementBlock("div",fe,[o.html?(t.openBlock(),t.createElementBlock("span",{key:0,innerHTML:o.text},null,8,pe)):(t.openBlock(),t.createElementBlock("span",me,t.toDisplayString(o.text),1)),t.renderSlot(e.$slots,"body")])):t.createCommentVNode("",!0)])),_:3},8,["model-value","anchor","arrow","attach","disabled","placement","spy"]))}}))
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
null
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
null==(
|
|
173
|
-
|
|
174
|
-
|
|
161
|
+
case"hover":e.addEventListener("mouseenter",p),e.addEventListener("mouseleave",m)}}))}),{immediate:!0}),t.watch((()=>r.value),(e=>{e?y():g()}),{immediate:!0}),(e,a)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.renderSlot(e.$slots,"trigger",{open:r.value}),(t.openBlock(),t.createBlock(t.Teleport,{to:n.attach},[t.createVNode(t.Transition,{name:n.transition,appear:"",onEnter:a[0]||(a[0]=e=>o("enter")),onLeave:a[1]||(a[1]=e=>o("leave"))},{default:t.withCtx((()=>[r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(l.value),style:t.normalizeStyle(i.value)},[t.createElementVNode("div",{class:t.normalizeClass(["q-overlay__content"]),ref_key:"overlay",ref:s},[n.arrow?(t.openBlock(),t.createElementBlock("div",ce)):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default")],512)],6)):t.createCommentVNode("",!0)])),_:3},8,["name"])],8,["to"]))],64))}})),ue={key:0,class:"q-popover__header"},fe={key:1,class:"q-popover__body"},pe=["innerHTML"],me={key:1},he=B(t.defineComponent({inheritAttrs:!1,__name:"QPopover",props:{modelValue:{type:Boolean},anchor:{},arrow:{type:Boolean,default:!0},attach:{default:"body"},disabled:{type:Boolean},html:{type:Boolean,default:!0},placement:{default:"right"},spy:{type:Boolean,default:!0},text:{},title:{}},setup(e){const o=e
|
|
162
|
+
return(e,n)=>(t.openBlock(),t.createBlock(t.unref(de),{"model-value":o.modelValue,trigger:"click",anchor:o.anchor,arrow:o.arrow,attach:o.attach,"content-classes":["q-popover"],disabled:o.disabled,placement:o.placement,spy:o.spy},{default:t.withCtx((()=>[o.title||e.$slots.header?(t.openBlock(),t.createElementBlock("h3",ue,[t.createTextVNode(t.toDisplayString(o.title)+" ",1),t.renderSlot(e.$slots,"header")])):t.createCommentVNode("",!0),o.text||e.$slots.body?(t.openBlock(),t.createElementBlock("div",fe,[o.html?(t.openBlock(),t.createElementBlock("span",{key:0,innerHTML:o.text},null,8,pe)):(t.openBlock(),t.createElementBlock("span",me,t.toDisplayString(o.text),1)),t.renderSlot(e.$slots,"body")])):t.createCommentVNode("",!0)])),_:3},8,["model-value","anchor","arrow","attach","disabled","placement","spy"]))}}))
|
|
163
|
+
const ve={mounted(e,t){e.clickOutsideEvent=function(o){const n=o.target
|
|
164
|
+
t.arg?e===n||e.contains(n)||n.closest(t.arg)||t.value(o,e):e===n||e.contains(n)||t.value(o,e)},document.addEventListener("click",e.clickOutsideEvent)},unmounted(e){document.removeEventListener("click",e.clickOutsideEvent)}},ye={key:0,class:"q-select__value"},ge={key:1,class:"q-select__placeholder"},be={placeholder:"Choose..."},ke={chevron:{icon:"chevron-down"},clear:{icon:"close"}},we=B(t.defineComponent({inheritAttrs:!1,__name:"QSelect",props:{modelValue:{type:[String,Number,Boolean,Symbol],default:void 0},clearable:{type:Boolean,default:!1},readonly:{type:Boolean},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icons:{default:()=>ke},items:{},groups:{default:()=>[]},itemValue:{default:"key"},itemLabel:{default:"label"},size:{default:"medium"},texts:{default:()=>be}},emits:["update:modelValue","before-show","before-hide","show","hide"],setup(e,{emit:o}){const n=e,l=function(){const e=t.useAttrs(),o={}
|
|
165
|
+
return"string"==typeof e.class?o.class=e.class.split(" "):Array.isArray(e.class)?o.class=e.class:o.class=[],o}(),a=t.ref(n.modelValue),r=t.ref(!1),i=t.ref(""),s=t.ref(null),c=t.ref(null),d=t.ref(null),u=t.computed((()=>{var e
|
|
166
|
+
return null==(e=n.items)?void 0:e.find((e=>e[n.itemValue]===a.value))})),f=t.computed((()=>u.value?u.value[n.itemLabel]:"")),p=t.computed((()=>n.clearable&&!n.readonly&&!n.disabled&&!n.loading))
|
|
167
|
+
function m(e){a.value=e,o("update:modelValue",e),g()}function h(){p.value&&m(void 0)}function v(){n.readonly||n.disabled||(r.value?g():r.value||(o("before-show"),r.value=!0))}function y(e){var t
|
|
168
|
+
null!=(t=s.value)&&t.$el.contains(e.target)||g()}function g(){r.value&&(o("before-hide"),r.value=!1)}let b
|
|
169
|
+
function k(e){if(e.key&&!n.readonly&&!n.disabled){if(window.clearTimeout(b),["Enter"," ","ArrowDown","ArrowUp","Home","End"].includes(e.key)&&(e.preventDefault(),e.stopPropagation()),["Enter"," "].includes(e.key)&&(r.value=!0),["Escape","Tab"].includes(e.key)&&(r.value?r.value=!1:n.clearable&&"Escape"===e.key&&h()),"Delete"===e.key&&n.clearable&&h(),/^[a-z]$/i.test(e.key)){i.value+=e.key.toLowerCase()
|
|
170
|
+
for(let e=0;e<n.items.length;e++)if(n.items[e][n.itemLabel].toLowerCase().startsWith(i.value)){S(e)
|
|
171
|
+
break}}b=window.setTimeout((function(){i.value=""}),500)}}function w(){var e
|
|
172
|
+
null==(e=c.value)||e.$el.focus(),o("show")}function B(){var e
|
|
173
|
+
null==(e=s.value)||e.$el.focus(),o("hide")}function S(e){var t
|
|
174
|
+
null==(t=c.value)||t.focusItem(e)}return t.watch((()=>n.modelValue),(e=>{a.value=e})),(e,o)=>{var i,g
|
|
175
|
+
return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(R),{ref_key:"inputRef",ref:s,role:"combobox",tabindex:"0",class:t.normalizeClass(["q-select",{"q-select--readonly":n.readonly,"q-select--disabled":n.disabled,"q-select--expanded":r.value},...t.unref(l).class]),readonly:"",disabled:n.disabled,"aria-expanded":r.value,"aria-haspopup":"listbox",size:n.size,onClick:v,onKeydown:t.withModifiers(k,["stop"])},t.createSlots({append:t.withCtx((()=>[p.value&&a.value?(t.openBlock(),t.createBlock(t.unref(T),t.mergeProps({key:0},n.icons.clear,{class:"q-select__clear",onClick:t.withModifiers(h,["stop","prevent"])}),null,16,["onClick"])):t.createCommentVNode("",!0),n.readonly||n.disabled?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(T),t.mergeProps({key:1},n.icons.chevron,{class:"q-select__chevron"}),null,16))])),default:t.withCtx((()=>[a.value?(t.openBlock(),t.createElementBlock("span",ye,t.toDisplayString(f.value),1)):(t.openBlock(),t.createElementBlock("span",ge,t.toDisplayString(e.texts.placeholder),1))])),_:2},[null!=(i=u.value)&&i.icon?{name:"prepend",fn:t.withCtx((()=>{var e
|
|
176
|
+
return[t.createVNode(t.unref(T),t.normalizeProps(t.guardReactiveProps(null==(e=u.value)?void 0:e.icon)),null,16)]})),key:"0"}:void 0]),1032,["class","disabled","aria-expanded","size","onKeydown"]),t.createVNode(t.unref(de),{"model-value":r.value,spy:"",trigger:"manual",placement:"bottom",width:"anchor",offset:2,anchor:null==(g=s.value)?void 0:g.$el,onEnter:w,onLeave:B},{default:t.withCtx((()=>[t.withDirectives((t.openBlock(),t.createElementBlock("div",{ref_key:"contentRef",ref:d,class:"q-select__body"},[t.renderSlot(e.$slots,"body.prepend"),n.loading?(t.openBlock(),t.createBlock(t.unref(C),{key:0,class:"q-select__loader",size:24})):(t.openBlock(),t.createBlock(t.unref(te),{key:1,ref_key:"listRef",ref:c,class:"q-select__items",modelValue:a.value,"onUpdate:modelValue":[o[0]||(o[0]=e=>a.value=e),m],items:n.items,groups:e.groups,"item-label":n.itemLabel,"item-value":n.itemValue,onKeydown:t.withModifiers(k,["stop"])},null,8,["modelValue","items","groups","item-label","item-value","onKeydown"])),t.renderSlot(e.$slots,"body.append")])),[[t.unref(ve),y]])])),_:3},8,["model-value","anchor"])],64)}}})),Be=["innerHTML"],Ce={key:1},Se=B(t.defineComponent({inheritAttrs:!1,__name:"QTooltip",props:{modelValue:{type:Boolean},anchor:{},appearance:{default:"inverted"},arrow:{type:Boolean,default:!0},attach:{default:"body"},delay:{default:500},disabled:{type:Boolean},html:{type:Boolean,default:!0},placement:{default:"right"},text:{},trigger:{default:"hover"}},setup(e){const o=e
|
|
175
177
|
return(e,n)=>(t.openBlock(),t.createBlock(t.unref(de),{"model-value":o.modelValue,anchor:o.anchor,appearance:o.appearance,arrow:o.arrow,attach:o.attach,"content-classes":["q-tooltip"],delay:o.delay,disabled:o.disabled,placement:o.placement,trigger:o.trigger},{default:t.withCtx((()=>[o.html?(t.openBlock(),t.createElementBlock("span",{key:0,innerHTML:o.text},null,8,Be)):(t.openBlock(),t.createElementBlock("span",Ce,t.toDisplayString(o.text),1))])),_:1},8,["model-value","anchor","appearance","arrow","attach","delay","disabled","placement","trigger"]))}}))
|
|
176
178
|
e.QButton=x,e.QButtonGroup=V,e.QButtonToggle=q,e.QIcon=T,e.QIconFont=A,e.QIconImg=F,e.QIconSvg=M,e.QInput=R,e.QLineLoader=U,e.QList=te,e.QListItem=oe,e.QListItemGroup=ne,e.QOverlay=de,e.QPopover=he,e.QSelect=we,e.QSpinnerLoader=C,e.QTooltip=Se,e.clickOutside=ve,e.createFramework=function(e={}){return{install:o=>{const n=e.components||{}
|
|
177
179
|
for(const e in n)o.component(e,n[e])
|
|
178
180
|
const l=e.directives||{}
|
|
179
181
|
for(const e in l)o.directive(e,l[e])
|
|
180
182
|
const r=e.defaults||{}
|
|
181
|
-
o.provide(a,t.ref(r)),g(o,e.themes)}}},e.defaultDarkColorScheme=
|
|
183
|
+
o.provide(a,t.ref(r)),g(o,e.themes)}}},e.defaultDarkColorScheme=c,e.defaultLightColorScheme=s,e.useTheme=function(){const e=t.inject(y)
|
|
182
184
|
if(!e)throw new Error("[Quidgest UI] Could not find theme instance")
|
|
183
185
|
return e},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}))
|
|
184
186
|
//# sourceMappingURL=ui.min.js.map
|