@farris/ui-vue 1.0.0-beta.1 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.esm.js +93 -0
- package/accordion/index.umd.js +1 -0
- package/accordion/package.json +7 -0
- package/accordion/style.css +1 -0
- package/avatar/index.esm.js +94 -0
- package/avatar/index.umd.js +1 -0
- package/avatar/package.json +7 -0
- package/avatar/style.css +1 -0
- package/button/index.esm.js +206 -0
- package/button/index.umd.js +1 -0
- package/button/package.json +7 -0
- package/button-edit/index.esm.js +300 -0
- package/button-edit/index.umd.js +1 -0
- package/button-edit/package.json +7 -0
- package/checkbox/index.esm.js +97 -0
- package/checkbox/index.umd.js +1 -0
- package/checkbox/package.json +7 -0
- package/combo-list/index.esm.js +457 -0
- package/combo-list/index.umd.js +1 -0
- package/combo-list/package.json +7 -0
- package/data-grid/index.esm.js +1536 -0
- package/data-grid/index.umd.js +1 -0
- package/data-grid/package.json +7 -0
- package/data-grid/style.css +1 -0
- package/date-picker/index.esm.js +1479 -0
- package/date-picker/index.umd.js +1 -0
- package/date-picker/package.json +7 -0
- package/date-picker/style.css +1 -0
- package/farris.all.esm.js +6378 -0
- package/farris.all.umd.js +1 -0
- package/list-view/index.esm.js +144 -0
- package/list-view/index.umd.js +1 -0
- package/list-view/package.json +7 -0
- package/list-view/style.css +1 -0
- package/message-box/index.esm.js +499 -0
- package/message-box/index.umd.js +1 -0
- package/message-box/package.json +7 -0
- package/modal/index.esm.js +165 -0
- package/modal/index.umd.js +1 -0
- package/modal/package.json +7 -0
- package/notify/index.esm.js +187 -0
- package/notify/index.umd.js +1 -0
- package/notify/package.json +7 -0
- package/notify/style.css +1 -0
- package/package.json +4 -4
- package/pagination/index.esm.js +334 -0
- package/pagination/index.umd.js +1 -0
- package/pagination/package.json +7 -0
- package/pagination/style.css +1 -0
- package/popover/index.esm.js +83 -0
- package/popover/index.umd.js +1 -0
- package/popover/package.json +7 -0
- package/popover/style.css +1 -0
- package/radio-group/index.esm.js +79 -0
- package/radio-group/index.umd.js +1 -0
- package/radio-group/package.json +7 -0
- package/section/index.esm.js +70 -0
- package/section/index.umd.js +1 -0
- package/section/package.json +7 -0
- package/switch/index.esm.js +78 -0
- package/switch/index.umd.js +1 -0
- package/switch/package.json +7 -0
- package/tabs/index.esm.js +385 -0
- package/tabs/index.umd.js +1 -0
- package/tabs/package.json +7 -0
- package/tabs/style.css +1 -0
- package/text/index.esm.js +33 -0
- package/text/index.umd.js +1 -0
- package/text/package.json +7 -0
- package/tooltip/index.esm.js +195 -0
- package/tooltip/index.umd.js +1 -0
- package/tooltip/package.json +7 -0
- package/tooltip/style.css +1 -0
- package/src/index.esm.js +0 -10535
- package/src/index.umd.js +0 -8
- /package/{src/style.css → style.css} +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { ref as v, computed as T, defineComponent as L, onMounted as M, createVNode as P, reactive as O, createApp as z, onUnmounted as V, mergeProps as k } from "vue";
|
|
2
|
+
const C = {
|
|
3
|
+
content: { type: String },
|
|
4
|
+
width: { type: Number },
|
|
5
|
+
customClass: { type: String },
|
|
6
|
+
placement: { type: String, default: "top" },
|
|
7
|
+
reference: { type: Object, require: !0 },
|
|
8
|
+
horizontalRelative: { type: String, defatul: "" },
|
|
9
|
+
verticalRelative: { type: String, defatul: "" }
|
|
10
|
+
};
|
|
11
|
+
function R(i, m) {
|
|
12
|
+
const p = /* @__PURE__ */ new Map([
|
|
13
|
+
["top", "bottom"],
|
|
14
|
+
["bottom", "top"],
|
|
15
|
+
["left", "right"],
|
|
16
|
+
["right", "left"]
|
|
17
|
+
]), l = /* @__PURE__ */ new Map([
|
|
18
|
+
["top", "height"],
|
|
19
|
+
["bottom", "height"],
|
|
20
|
+
["left", "width"],
|
|
21
|
+
["right", "width"]
|
|
22
|
+
]);
|
|
23
|
+
function f(t, o) {
|
|
24
|
+
const c = p.get(o) || o;
|
|
25
|
+
return t.replace(o, c);
|
|
26
|
+
}
|
|
27
|
+
function s(t, o, c, e, a) {
|
|
28
|
+
let u = t;
|
|
29
|
+
const n = t.split("-")[0], r = l.get(n), d = e[r] + a[r];
|
|
30
|
+
return Math.abs(c[n] - o[n]) < d && (u = f(t, n)), u;
|
|
31
|
+
}
|
|
32
|
+
return { adjustPlacement: s };
|
|
33
|
+
}
|
|
34
|
+
function $(i, m) {
|
|
35
|
+
function l(s, t, o) {
|
|
36
|
+
let c = !1, e = o;
|
|
37
|
+
return (t === "left" || t === "top") && o <= s[t] && (c = !0, e = s[t] + 6), (t === "right" || t === "bottom") && o >= s[t] && (c = !0, e = s[t] - 6), { overBound: c, fixedValue: e };
|
|
38
|
+
}
|
|
39
|
+
function f(s, t, o, c, e, a, u) {
|
|
40
|
+
let n = t.tooltip.left, r = t.tooltip.top, d = t.arrow.left, g = t.arrow.top;
|
|
41
|
+
const b = s.split("-")[0];
|
|
42
|
+
if (["top", "bottom"].includes(b)) {
|
|
43
|
+
const A = l(o, "left", t.tooltip.left), j = l(o, "right", t.tooltip.left + e.width);
|
|
44
|
+
n = A.overBound ? A.fixedValue : j.overBound ? j.fixedValue - e.width : t.tooltip.left, d = A.overBound ? e.width - (n + e.width - c.right) - u.width : j.overBound ? c.left - n : t.arrow.left;
|
|
45
|
+
}
|
|
46
|
+
const x = l(o, "top", t.tooltip.top), h = l(o, "bottom", t.tooltip.top + e.height);
|
|
47
|
+
return r = x.overBound ? x.fixedValue : h.overBound ? h.fixedValue - e.height : t.tooltip.top, g = x.overBound ? t.arrow.top : h.overBound ? e.height - (r + e.height - c.top) : t.arrow.top, { arrow: { left: d, top: g }, tooltip: { left: n, top: r } };
|
|
48
|
+
}
|
|
49
|
+
return { adjustPosition: f };
|
|
50
|
+
}
|
|
51
|
+
function D(i, m) {
|
|
52
|
+
function l(t, o, c, e, a) {
|
|
53
|
+
const u = t.split("-"), n = u[0], r = u[1] || "middle", d = ["top", "bottom"].includes(n) ? r === "middle" ? (e.width - a.width) / 2 : r === "right" ? e.width - a.width - 6 : 6 : 0, g = ["left", "right"].includes(n) ? r === "middle" ? (e.height - a.height) / 2 : r === "bottom" ? e.height - a.height - 6 : 6 : 0, y = n === "left" ? e.width + a.width : 0, b = n === "top" ? e.height + a.height : 0;
|
|
54
|
+
return { left: y + d, top: b + g, right: 0 };
|
|
55
|
+
}
|
|
56
|
+
function f(t, o, c, e, a) {
|
|
57
|
+
const u = t.split("-"), n = u[0], r = u[1] || "middle", d = (c.width - e.width) / 2, g = (c.height - e.height) / 2, y = n === "right" ? o.right : o.left, b = n === "bottom" ? o.bottom : o.top, x = n === "top" ? 0 - g - e.height - a.height : n === "bottom" ? 0 - g + a.height : 0, h = ["left", "right"].includes(n) ? r === "middle" ? (o.height - e.height) / 2 : r === "bottom" ? o.height - e.height : 0 : 0, w = n === "left" ? 0 - d - e.width - a.width : n === "right" ? 0 - d + a.width : 0, E = ["top", "bottom"].includes(n) ? r === "middle" ? (o.width - e.width) / 2 : r === "right" ? o.width - e.width : 0 : 0, A = b + x + h;
|
|
58
|
+
return { left: y + w + E, top: A };
|
|
59
|
+
}
|
|
60
|
+
function s(t, o, c, e, a) {
|
|
61
|
+
const u = f(t, o, c, e, a);
|
|
62
|
+
return { arrow: l(t, o, c, e, a), tooltip: u };
|
|
63
|
+
}
|
|
64
|
+
return { calculate: s };
|
|
65
|
+
}
|
|
66
|
+
function H(i, m) {
|
|
67
|
+
const p = v(i.horizontalRelative), l = v(i.verticalRelative);
|
|
68
|
+
function f(t) {
|
|
69
|
+
return typeof t == "string" ? document.querySelector(t) : t;
|
|
70
|
+
}
|
|
71
|
+
function s() {
|
|
72
|
+
let t = document.documentElement.clientWidth, o = document.documentElement.clientHeight, c = 0, e = 0, a = 0, u = 0, n = o - c, r = t - e;
|
|
73
|
+
return p.value && ({ left: e, right: t, x: a, width: r } = f(p.value).getBoundingClientRect()), l.value && ({ bottom: o, top: c, y: u, height: n } = f(l.value).getBoundingClientRect()), { top: c, left: e, right: t, bottom: o, height: n, width: r, x: a, y: u };
|
|
74
|
+
}
|
|
75
|
+
return { getRelativeElementBound: s };
|
|
76
|
+
}
|
|
77
|
+
function G(i, m, p, l, f, s) {
|
|
78
|
+
const t = v(i.placement), { getRelativeElementBound: o } = H(i), { calculate: c } = D(), { adjustPlacement: e } = R(), { adjustPosition: a } = $(), u = T(() => t.value.split("-")[0]), n = T(() => {
|
|
79
|
+
const r = o();
|
|
80
|
+
t.value = e(t.value, r, p, l, s);
|
|
81
|
+
const d = c(t.value, p, l, f, s);
|
|
82
|
+
return a(
|
|
83
|
+
t.value,
|
|
84
|
+
d,
|
|
85
|
+
r,
|
|
86
|
+
p,
|
|
87
|
+
l,
|
|
88
|
+
f,
|
|
89
|
+
s
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
return { tooltipPlacement: u, tooltipPosition: n };
|
|
93
|
+
}
|
|
94
|
+
const S = L({
|
|
95
|
+
name: "FTooltip",
|
|
96
|
+
props: C,
|
|
97
|
+
emits: ["click"],
|
|
98
|
+
setup(i, m) {
|
|
99
|
+
const p = v(!0), l = v(), f = v(), s = v(), t = v(i.placement.split("-")[0]), o = T(() => {
|
|
100
|
+
const h = {
|
|
101
|
+
tooltip: !0,
|
|
102
|
+
show: !0
|
|
103
|
+
}, w = `bs-tooltip-${t.value}`;
|
|
104
|
+
return h[w] = !0, h;
|
|
105
|
+
}), {
|
|
106
|
+
scrollLeft: c,
|
|
107
|
+
scrollTop: e
|
|
108
|
+
} = document.documentElement, a = T(() => p.value), u = T(() => i.content), n = v("0px"), r = v("0px");
|
|
109
|
+
v("");
|
|
110
|
+
const d = T(() => ({
|
|
111
|
+
left: n.value,
|
|
112
|
+
top: r.value
|
|
113
|
+
})), g = v(""), y = v(""), b = T(() => ({
|
|
114
|
+
left: g.value,
|
|
115
|
+
top: y.value
|
|
116
|
+
}));
|
|
117
|
+
M(() => {
|
|
118
|
+
if (l.value && f.value && s.value && i.reference) {
|
|
119
|
+
const {
|
|
120
|
+
tooltipPlacement: h,
|
|
121
|
+
tooltipPosition: w
|
|
122
|
+
} = G(i, m, i.reference.getBoundingClientRect(), f.value.getBoundingClientRect(), s.value.getBoundingClientRect(), l.value.getBoundingClientRect());
|
|
123
|
+
n.value = `${w.value.tooltip.left + c}px`, r.value = `${w.value.tooltip.top + e}px`, g.value = `${w.value.arrow.left}px`, y.value = `${w.value.arrow.top}px`, t.value = h.value;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
function x(h) {
|
|
127
|
+
m.emit("click", h);
|
|
128
|
+
}
|
|
129
|
+
return () => P("div", {
|
|
130
|
+
ref: f,
|
|
131
|
+
class: o.value,
|
|
132
|
+
style: d.value,
|
|
133
|
+
onClick: x
|
|
134
|
+
}, [P("div", {
|
|
135
|
+
ref: l,
|
|
136
|
+
class: "arrow",
|
|
137
|
+
style: b.value
|
|
138
|
+
}, null), P("div", {
|
|
139
|
+
ref: s,
|
|
140
|
+
class: "tooltip-inner"
|
|
141
|
+
}, [P("div", {
|
|
142
|
+
class: "tooltip-tmpl"
|
|
143
|
+
}, [a.value && P("div", {
|
|
144
|
+
class: "tooltip-text",
|
|
145
|
+
innerHTML: u.value
|
|
146
|
+
}, null)])])]);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
function N(i, m) {
|
|
150
|
+
const p = document.createElement("div"), l = z({
|
|
151
|
+
setup() {
|
|
152
|
+
return V(() => {
|
|
153
|
+
document.body.removeChild(p);
|
|
154
|
+
}), () => P(S, k(i, {
|
|
155
|
+
onClick: l.unmount
|
|
156
|
+
}), null);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
return document.body.appendChild(p), l.mount(p), l;
|
|
160
|
+
}
|
|
161
|
+
function X(i) {
|
|
162
|
+
const m = O({
|
|
163
|
+
...i
|
|
164
|
+
});
|
|
165
|
+
return N(m);
|
|
166
|
+
}
|
|
167
|
+
const Y = {
|
|
168
|
+
mounted: (i, m, p) => {
|
|
169
|
+
let l;
|
|
170
|
+
const f = Object.assign({
|
|
171
|
+
content: "This is a tooltip",
|
|
172
|
+
width: 100,
|
|
173
|
+
customClass: "",
|
|
174
|
+
placement: "top",
|
|
175
|
+
reference: i
|
|
176
|
+
}, m.value);
|
|
177
|
+
i.addEventListener("mouseenter", (s) => {
|
|
178
|
+
s.stopPropagation(), l || (l = X(f));
|
|
179
|
+
}), i.addEventListener("mouseleave", (s) => {
|
|
180
|
+
s.stopPropagation(), l && (l.unmount(), l = null);
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
unMounted: (i, m, p) => {
|
|
184
|
+
}
|
|
185
|
+
}, I = {
|
|
186
|
+
install(i) {
|
|
187
|
+
i.component(S.name, S), i.directive("tooltip", Y);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
export {
|
|
191
|
+
S as Tooltip,
|
|
192
|
+
Y as TooltipDirective,
|
|
193
|
+
I as default,
|
|
194
|
+
C as tooltipProps
|
|
195
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(w,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],o):(w=typeof globalThis<"u"?globalThis:w||self,o(w.tooltip={},w.Vue))})(this,function(w,o){"use strict";const S={content:{type:String},width:{type:Number},customClass:{type:String},placement:{type:String,default:"top"},reference:{type:Object,require:!0},horizontalRelative:{type:String,defatul:""},verticalRelative:{type:String,defatul:""}},$="";function O(c,g){const f=new Map([["top","bottom"],["bottom","top"],["left","right"],["right","left"]]),l=new Map([["top","height"],["bottom","height"],["left","width"],["right","width"]]);function d(t,n){const r=f.get(n)||n;return t.replace(n,r)}function a(t,n,r,e,u){let p=t;const i=t.split("-")[0],s=l.get(i),h=e[s]+u[s];return Math.abs(r[i]-n[i])<h&&(p=d(t,i)),p}return{adjustPlacement:a}}function E(c,g){function l(a,t,n){let r=!1,e=n;return(t==="left"||t==="top")&&n<=a[t]&&(r=!0,e=a[t]+6),(t==="right"||t==="bottom")&&n>=a[t]&&(r=!0,e=a[t]-6),{overBound:r,fixedValue:e}}function d(a,t,n,r,e,u,p){let i=t.tooltip.left,s=t.tooltip.top,h=t.arrow.left,v=t.arrow.top;const x=a.split("-")[0];if(["top","bottom"].includes(x)){const P=l(n,"left",t.tooltip.left),A=l(n,"right",t.tooltip.left+e.width);i=P.overBound?P.fixedValue:A.overBound?A.fixedValue-e.width:t.tooltip.left,h=P.overBound?e.width-(i+e.width-r.right)-p.width:A.overBound?r.left-i:t.arrow.left}const T=l(n,"top",t.tooltip.top),m=l(n,"bottom",t.tooltip.top+e.height);return s=T.overBound?T.fixedValue:m.overBound?m.fixedValue-e.height:t.tooltip.top,v=T.overBound?t.arrow.top:m.overBound?e.height-(s+e.height-r.top):t.arrow.top,{arrow:{left:h,top:v},tooltip:{left:i,top:s}}}return{adjustPosition:d}}function L(c,g){function l(t,n,r,e,u){const p=t.split("-"),i=p[0],s=p[1]||"middle",h=["top","bottom"].includes(i)?s==="middle"?(e.width-u.width)/2:s==="right"?e.width-u.width-6:6:0,v=["left","right"].includes(i)?s==="middle"?(e.height-u.height)/2:s==="bottom"?e.height-u.height-6:6:0,b=i==="left"?e.width+u.width:0,x=i==="top"?e.height+u.height:0;return{left:b+h,top:x+v,right:0}}function d(t,n,r,e,u){const p=t.split("-"),i=p[0],s=p[1]||"middle",h=(r.width-e.width)/2,v=(r.height-e.height)/2,b=i==="right"?n.right:n.left,x=i==="bottom"?n.bottom:n.top,T=i==="top"?0-v-e.height-u.height:i==="bottom"?0-v+u.height:0,m=["left","right"].includes(i)?s==="middle"?(n.height-e.height)/2:s==="bottom"?n.height-e.height:0:0,y=i==="left"?0-h-e.width-u.width:i==="right"?0-h+u.width:0,M=["top","bottom"].includes(i)?s==="middle"?(n.width-e.width)/2:s==="right"?n.width-e.width:0:0,P=x+T+m;return{left:b+y+M,top:P}}function a(t,n,r,e,u){const p=d(t,n,r,e,u);return{arrow:l(t,n,r,e,u),tooltip:p}}return{calculate:a}}function z(c,g){const f=o.ref(c.horizontalRelative),l=o.ref(c.verticalRelative);function d(t){return typeof t=="string"?document.querySelector(t):t}function a(){let t=document.documentElement.clientWidth,n=document.documentElement.clientHeight,r=0,e=0,u=0,p=0,i=n-r,s=t-e;return f.value&&({left:e,right:t,x:u,width:s}=d(f.value).getBoundingClientRect()),l.value&&({bottom:n,top:r,y:p,height:i}=d(l.value).getBoundingClientRect()),{top:r,left:e,right:t,bottom:n,height:i,width:s,x:u,y:p}}return{getRelativeElementBound:a}}function N(c,g,f,l,d,a){const t=o.ref(c.placement),{getRelativeElementBound:n}=z(c),{calculate:r}=L(),{adjustPlacement:e}=O(),{adjustPosition:u}=E(),p=o.computed(()=>t.value.split("-")[0]),i=o.computed(()=>{const s=n();t.value=e(t.value,s,f,l,a);const h=r(t.value,f,l,d,a);return u(t.value,h,s,f,l,d,a)});return{tooltipPlacement:p,tooltipPosition:i}}const j=o.defineComponent({name:"FTooltip",props:S,emits:["click"],setup(c,g){const f=o.ref(!0),l=o.ref(),d=o.ref(),a=o.ref(),t=o.ref(c.placement.split("-")[0]),n=o.computed(()=>{const m={tooltip:!0,show:!0},y=`bs-tooltip-${t.value}`;return m[y]=!0,m}),{scrollLeft:r,scrollTop:e}=document.documentElement,u=o.computed(()=>f.value),p=o.computed(()=>c.content),i=o.ref("0px"),s=o.ref("0px");o.ref("");const h=o.computed(()=>({left:i.value,top:s.value})),v=o.ref(""),b=o.ref(""),x=o.computed(()=>({left:v.value,top:b.value}));o.onMounted(()=>{if(l.value&&d.value&&a.value&&c.reference){const{tooltipPlacement:m,tooltipPosition:y}=N(c,g,c.reference.getBoundingClientRect(),d.value.getBoundingClientRect(),a.value.getBoundingClientRect(),l.value.getBoundingClientRect());i.value=`${y.value.tooltip.left+r}px`,s.value=`${y.value.tooltip.top+e}px`,v.value=`${y.value.arrow.left}px`,b.value=`${y.value.arrow.top}px`,t.value=m.value}});function T(m){g.emit("click",m)}return()=>o.createVNode("div",{ref:d,class:n.value,style:h.value,onClick:T},[o.createVNode("div",{ref:l,class:"arrow",style:x.value},null),o.createVNode("div",{ref:a,class:"tooltip-inner"},[o.createVNode("div",{class:"tooltip-tmpl"},[u.value&&o.createVNode("div",{class:"tooltip-text",innerHTML:p.value},null)])])])}});function k(c,g){const f=document.createElement("div"),l=o.createApp({setup(){return o.onUnmounted(()=>{document.body.removeChild(f)}),()=>o.createVNode(j,o.mergeProps(c,{onClick:l.unmount}),null)}});return document.body.appendChild(f),l.mount(f),l}function C(c){const g=o.reactive({...c});return k(g)}const V={mounted:(c,g,f)=>{let l;const d=Object.assign({content:"This is a tooltip",width:100,customClass:"",placement:"top",reference:c},g.value);c.addEventListener("mouseenter",a=>{a.stopPropagation(),l||(l=C(d))}),c.addEventListener("mouseleave",a=>{a.stopPropagation(),l&&(l.unmount(),l=null)})},unMounted:(c,g,f)=>{}},R={install(c){c.component(j.name,j),c.directive("tooltip",V)}};w.Tooltip=j,w.TooltipDirective=V,w.default=R,w.tooltipProps=S,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.f-tooltip-bottom .arrow,.f-tooltip-top .arrow{left:50%}.f-tooltip-left .arrow,.f-tooltip-right .arrow{top:25%}
|