@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,78 @@
|
|
|
1
|
+
import { defineComponent as y, toRefs as C, ref as k, computed as a, createVNode as l } from "vue";
|
|
2
|
+
const b = {
|
|
3
|
+
modelValue: { type: Boolean, default: !1 },
|
|
4
|
+
disable: { type: Boolean },
|
|
5
|
+
onBackground: { type: String },
|
|
6
|
+
offBackground: { type: String },
|
|
7
|
+
onColor: { type: String },
|
|
8
|
+
offColor: { type: String },
|
|
9
|
+
onLabel: { type: String },
|
|
10
|
+
offLabel: { type: String },
|
|
11
|
+
size: { type: String, default: "medium" }
|
|
12
|
+
}, r = y({
|
|
13
|
+
name: "FSwitch",
|
|
14
|
+
props: b,
|
|
15
|
+
emits: ["update:modelValue"],
|
|
16
|
+
setup(o, u) {
|
|
17
|
+
const {
|
|
18
|
+
disable: c,
|
|
19
|
+
size: s,
|
|
20
|
+
onLabel: e,
|
|
21
|
+
offLabel: t
|
|
22
|
+
} = C(o), n = k(o.modelValue);
|
|
23
|
+
function i() {
|
|
24
|
+
return "";
|
|
25
|
+
}
|
|
26
|
+
function d() {
|
|
27
|
+
return "";
|
|
28
|
+
}
|
|
29
|
+
function m() {
|
|
30
|
+
return "";
|
|
31
|
+
}
|
|
32
|
+
const p = a(() => ({
|
|
33
|
+
switch: !0,
|
|
34
|
+
"f-cmp-switch": !0,
|
|
35
|
+
checked: n.value,
|
|
36
|
+
disabled: c.value,
|
|
37
|
+
"switch-large": s.value === "large",
|
|
38
|
+
"switch-medium": s.value === "medium",
|
|
39
|
+
"switch-small": s.value === "small"
|
|
40
|
+
})), h = a(() => ({
|
|
41
|
+
outline: "none",
|
|
42
|
+
"backgroud-color": i(),
|
|
43
|
+
"border-color": d()
|
|
44
|
+
})), g = a(() => ({
|
|
45
|
+
background: m()
|
|
46
|
+
})), v = a(() => (e == null ? void 0 : e.value) || (t == null ? void 0 : t.value));
|
|
47
|
+
function f(S, B = !0) {
|
|
48
|
+
c.value || (n.value = !n.value, u.emit("update:modelValue", n.value));
|
|
49
|
+
}
|
|
50
|
+
function w(S) {
|
|
51
|
+
f();
|
|
52
|
+
}
|
|
53
|
+
return () => l("span", {
|
|
54
|
+
tabindex: "0",
|
|
55
|
+
role: "button",
|
|
56
|
+
class: p.value,
|
|
57
|
+
style: h.value,
|
|
58
|
+
onClick: w
|
|
59
|
+
}, [v.value && l("span", {
|
|
60
|
+
class: "switch-pane"
|
|
61
|
+
}, [l("span", {
|
|
62
|
+
class: "switch-label-checked"
|
|
63
|
+
}, [e == null ? void 0 : e.value]), l("span", {
|
|
64
|
+
class: "switch-label-unchecked"
|
|
65
|
+
}, [t == null ? void 0 : t.value])]), l("small", {
|
|
66
|
+
style: g.value
|
|
67
|
+
}, [u.slots.default && u.slots.default()])]);
|
|
68
|
+
}
|
|
69
|
+
}), z = {
|
|
70
|
+
install(o) {
|
|
71
|
+
o.component(r.name, r);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
r as Switch,
|
|
76
|
+
z as default,
|
|
77
|
+
b as switchProps
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.switch={},t.Vue))})(this,function(t,e){"use strict";const c={modelValue:{type:Boolean,default:!1},disable:{type:Boolean},onBackground:{type:String},offBackground:{type:String},onColor:{type:String},offColor:{type:String},onLabel:{type:String},offLabel:{type:String},size:{type:String,default:"medium"}},i=e.defineComponent({name:"FSwitch",props:c,emits:["update:modelValue"],setup(l,s){const{disable:r,size:u,onLabel:o,offLabel:n}=e.toRefs(l),a=e.ref(l.modelValue);function p(){return""}function m(){return""}function f(){return""}const h=e.computed(()=>({switch:!0,"f-cmp-switch":!0,checked:a.value,disabled:r.value,"switch-large":u.value==="large","switch-medium":u.value==="medium","switch-small":u.value==="small"})),g=e.computed(()=>({outline:"none","backgroud-color":p(),"border-color":m()})),w=e.computed(()=>({background:f()})),S=e.computed(()=>(o==null?void 0:o.value)||(n==null?void 0:n.value));function y(C,k=!0){r.value||(a.value=!a.value,s.emit("update:modelValue",a.value))}function v(C){y()}return()=>e.createVNode("span",{tabindex:"0",role:"button",class:h.value,style:g.value,onClick:v},[S.value&&e.createVNode("span",{class:"switch-pane"},[e.createVNode("span",{class:"switch-label-checked"},[o==null?void 0:o.value]),e.createVNode("span",{class:"switch-label-unchecked"},[n==null?void 0:n.value])]),e.createVNode("small",{style:w.value},[s.slots.default&&s.slots.default()])])}}),d={install(l){l.component(i.name,i)}};t.Switch=i,t.default=d,t.switchProps=c,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { defineComponent as H, shallowRef as D, ref as w, computed as p, provide as ne, onMounted as M, nextTick as S, createVNode as s, Fragment as oe, withDirectives as ie, vModelText as ue, createTextVNode as re, inject as de, getCurrentInstance as ce, onUnmounted as fe, watch as ve } from "vue";
|
|
2
|
+
const pe = {
|
|
3
|
+
tabType: { type: String, default: "default" },
|
|
4
|
+
autoTitleWidth: { type: Boolean, default: !1 },
|
|
5
|
+
titleLength: { type: Number, default: 7 },
|
|
6
|
+
position: { type: String, default: "top" },
|
|
7
|
+
showDropDwon: { type: Boolean, default: !1 },
|
|
8
|
+
showTooltips: { type: Boolean, default: !1 },
|
|
9
|
+
scrollStep: { type: Number, default: 10 },
|
|
10
|
+
autoResize: { type: Boolean, default: !1 },
|
|
11
|
+
closeable: { type: Boolean, default: !1 },
|
|
12
|
+
selectedTab: { type: String, default: "" },
|
|
13
|
+
width: { type: Number },
|
|
14
|
+
height: { type: Number },
|
|
15
|
+
searchBoxVisible: { type: Boolean, default: !0 },
|
|
16
|
+
titleWidth: { type: Number, default: 0 },
|
|
17
|
+
customClass: { type: String, default: "" },
|
|
18
|
+
activeId: { type: String },
|
|
19
|
+
fill: { type: Boolean, default: !1 }
|
|
20
|
+
};
|
|
21
|
+
function be(t, m, o) {
|
|
22
|
+
function i(u) {
|
|
23
|
+
const f = u.value.findIndex((g) => g.props.show !== !1 && !o.value && !g.props.disabled);
|
|
24
|
+
!o.value && f !== -1 && (o.value = u.value[f].props.id);
|
|
25
|
+
}
|
|
26
|
+
function b(u) {
|
|
27
|
+
return { width: `${u.tabWidth}px` };
|
|
28
|
+
}
|
|
29
|
+
function h(u) {
|
|
30
|
+
return {
|
|
31
|
+
"nav-item": !0,
|
|
32
|
+
"d-none": u.show !== void 0 ? !u.show : !1,
|
|
33
|
+
"f-state-active": u.id === o.value,
|
|
34
|
+
"f-state-disable": u.disabled
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function a(u) {
|
|
38
|
+
return {
|
|
39
|
+
"nav-link": !0,
|
|
40
|
+
"tabs-text-truncate": !0,
|
|
41
|
+
active: u.id === o.value,
|
|
42
|
+
disabled: u.disabled
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function c(u) {
|
|
46
|
+
return {
|
|
47
|
+
"st-tab-text": !0,
|
|
48
|
+
"farris-title-auto": t.autoTitleWidth
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function T(u) {
|
|
52
|
+
var g;
|
|
53
|
+
if (t.autoTitleWidth)
|
|
54
|
+
return;
|
|
55
|
+
const f = (g = u.value) == null ? void 0 : g.querySelectorAll(".st-tab-text");
|
|
56
|
+
if (!!f)
|
|
57
|
+
for (let y = 0; y < f.length; y++) {
|
|
58
|
+
const k = f[y].parentNode;
|
|
59
|
+
f[y].scrollWidth > k.offsetWidth ? f[y].classList.contains("farris-title-text-custom") || f[y].classList.add("farris-title-text-custom") : f[y].classList.remove("farris-title-text-custom");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function B(u, f) {
|
|
63
|
+
const g = o.value;
|
|
64
|
+
o.value = f, m.emit("tabChange", {
|
|
65
|
+
prevId: g,
|
|
66
|
+
nextId: o.value
|
|
67
|
+
}), u.preventDefault(), u.stopPropagation();
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
setActiveId: i,
|
|
71
|
+
getTabStyle: b,
|
|
72
|
+
getTabClass: h,
|
|
73
|
+
getTabNavLinkClass: a,
|
|
74
|
+
getTabTextClass: c,
|
|
75
|
+
changeTitleStyle: T,
|
|
76
|
+
selectTabByTabId: B
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const V = H({
|
|
80
|
+
name: "FTabs",
|
|
81
|
+
props: pe,
|
|
82
|
+
emits: ["tabChange", "tabRemove"],
|
|
83
|
+
setup(t, m) {
|
|
84
|
+
const o = D(), i = D(), b = w(!0), h = w(!0), a = w([]), c = w(t.activeId), T = p(() => {
|
|
85
|
+
const e = a.value.find((l) => l.props.id === c.value);
|
|
86
|
+
return e == null ? void 0 : e.slots;
|
|
87
|
+
}), B = p(() => {
|
|
88
|
+
const e = a.value.find((n) => n.props.id === c.value);
|
|
89
|
+
return (e == null ? void 0 : e.props.toolbarPosition) === "inHead";
|
|
90
|
+
}), u = w("atuo"), f = w(""), {
|
|
91
|
+
setActiveId: g,
|
|
92
|
+
getTabStyle: y,
|
|
93
|
+
getTabClass: k,
|
|
94
|
+
getTabNavLinkClass: U,
|
|
95
|
+
getTabTextClass: q,
|
|
96
|
+
changeTitleStyle: E,
|
|
97
|
+
selectTabByTabId: I
|
|
98
|
+
} = be(t, m, c), x = () => {
|
|
99
|
+
var l;
|
|
100
|
+
const e = (l = i.value) == null ? void 0 : l.parentElement;
|
|
101
|
+
!e || !i.value || (e.offsetWidth < i.value.scrollWidth ? b.value = !1 : b.value = !0);
|
|
102
|
+
}, N = (e) => {
|
|
103
|
+
e.preventDefault(), e.stopPropagation();
|
|
104
|
+
}, W = (e, l) => {
|
|
105
|
+
if (!i.value)
|
|
106
|
+
return;
|
|
107
|
+
const n = i.value.scrollLeft, r = i.value.scrollWidth - i.value.offsetWidth;
|
|
108
|
+
if (l > 0) {
|
|
109
|
+
if (i.value.scrollLeft >= r)
|
|
110
|
+
return;
|
|
111
|
+
i.value.scrollLeft = n + t.scrollStep + e;
|
|
112
|
+
} else if (l < 0) {
|
|
113
|
+
if (i.value.scrollLeft <= 0)
|
|
114
|
+
return;
|
|
115
|
+
i.value.scrollLeft = n - t.scrollStep - e;
|
|
116
|
+
}
|
|
117
|
+
}, P = (e) => {
|
|
118
|
+
if (b.value || !i.value)
|
|
119
|
+
return;
|
|
120
|
+
const l = i.value.querySelectorAll(".nav-item"), {
|
|
121
|
+
parentElement: n
|
|
122
|
+
} = i.value, r = l[e];
|
|
123
|
+
if (r && n) {
|
|
124
|
+
const d = n.getBoundingClientRect().left, v = n.getBoundingClientRect().right, L = r.getBoundingClientRect().left, C = r.getBoundingClientRect().right;
|
|
125
|
+
L < d ? W(d - L, -1) : v < C && W(C - v, 1);
|
|
126
|
+
}
|
|
127
|
+
}, j = (e) => {
|
|
128
|
+
a.value.findIndex((n) => n.props.id === e.props.id) === -1 && a.value.push(e), S(() => {
|
|
129
|
+
x();
|
|
130
|
+
});
|
|
131
|
+
}, z = (e) => {
|
|
132
|
+
a.value.findIndex((n) => n.props.id === e.props.id) !== -1 && (a.value.forEach((n) => {
|
|
133
|
+
n.props.id === e.props.id && (n = e);
|
|
134
|
+
}), S(() => {
|
|
135
|
+
E(i), x();
|
|
136
|
+
}));
|
|
137
|
+
};
|
|
138
|
+
function R(e, l, n = !1) {
|
|
139
|
+
a.value.findIndex((r) => r.props.id === l), a.value = a.value.filter((r) => r.props.id !== l), c.value === l && (c.value = "", g(a)), N(e), S(() => {
|
|
140
|
+
E(i), x(), n && (h.value = !0);
|
|
141
|
+
const r = a.value.findIndex((d) => d.props.id === c.value);
|
|
142
|
+
P(r), m.emit("tabRemove", {
|
|
143
|
+
removeIndex: r,
|
|
144
|
+
removeId: l,
|
|
145
|
+
activeId: c.value
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
ne("tabs", {
|
|
150
|
+
activeId: c,
|
|
151
|
+
addTab: j,
|
|
152
|
+
updateTab: z,
|
|
153
|
+
tabs: a
|
|
154
|
+
});
|
|
155
|
+
const O = p(() => t.fill || t.tabType === "fill"), _ = p(() => t.tabType === "pills"), $ = p(() => ({
|
|
156
|
+
"farris-tabs-header": !0,
|
|
157
|
+
"farris-tabs-inHead": B.value,
|
|
158
|
+
"farris-tabs-inContent": !B.value,
|
|
159
|
+
"farris-tabs-nav-fill": O.value,
|
|
160
|
+
"farris-tabs-nav-pills": _.value
|
|
161
|
+
})), G = p(() => ({
|
|
162
|
+
width: B.value && t.titleWidth ? `${t.titleWidth}%` : ""
|
|
163
|
+
})), J = p(() => ({
|
|
164
|
+
btn: !0,
|
|
165
|
+
"sc-nav-btn": !0,
|
|
166
|
+
"px-1": !0,
|
|
167
|
+
"sc-nav-lr": !0,
|
|
168
|
+
"d-none": b.value
|
|
169
|
+
})), K = p(() => ({
|
|
170
|
+
"btn-group": !0,
|
|
171
|
+
"sc-nav-btn": !0,
|
|
172
|
+
dropdown: !0,
|
|
173
|
+
"d-none": b.value
|
|
174
|
+
})), Q = p(() => ({
|
|
175
|
+
"dropdown-menu": !0,
|
|
176
|
+
"tabs-pt28": t.searchBoxVisible,
|
|
177
|
+
show: !h.value
|
|
178
|
+
})), X = p(() => ({
|
|
179
|
+
btn: !0,
|
|
180
|
+
"sc-nav-rg": !0,
|
|
181
|
+
"d-none": b.value
|
|
182
|
+
})), Y = () => ({
|
|
183
|
+
width: u.value
|
|
184
|
+
}), Z = (e) => ({
|
|
185
|
+
"dropdown-item": !0,
|
|
186
|
+
"text-truncate": !0,
|
|
187
|
+
"px-2": !0,
|
|
188
|
+
disabled: e.props.disabled,
|
|
189
|
+
active: e.props.id === c.value,
|
|
190
|
+
"d-none": e.props.show !== !0
|
|
191
|
+
}), ee = (e, l) => {
|
|
192
|
+
if (l.disabled)
|
|
193
|
+
return;
|
|
194
|
+
I(e, l.id);
|
|
195
|
+
const n = a.value.findIndex((r) => r.props.id === l.id);
|
|
196
|
+
h.value = !0, S(() => {
|
|
197
|
+
x(), P(n);
|
|
198
|
+
});
|
|
199
|
+
}, A = p(() => {
|
|
200
|
+
var l, n;
|
|
201
|
+
let e = [];
|
|
202
|
+
return t.searchBoxVisible ? e = (l = a.value) == null ? void 0 : l.filter((r) => r.props.title.includes(f.value)) : e = (n = a.value) == null ? void 0 : n.slice(), e;
|
|
203
|
+
}), te = p(() => ({
|
|
204
|
+
spacer: !0,
|
|
205
|
+
"f-utils-fill": !0,
|
|
206
|
+
"spacer-sides-dropdown": !b.value
|
|
207
|
+
})), le = p(() => ({
|
|
208
|
+
nav: !0,
|
|
209
|
+
"farris-nav-tabs": !0,
|
|
210
|
+
"flex-nowrap": !0,
|
|
211
|
+
"nav-fill": t.fill || t.tabType === "fill",
|
|
212
|
+
"nav-pills": t.tabType === "pills",
|
|
213
|
+
"flex-row": t.position === "top" || t.position === "bottom",
|
|
214
|
+
"flex-column": t.position === "left" || t.position === "right"
|
|
215
|
+
})), se = p(() => ({
|
|
216
|
+
"farris-tabs": !0,
|
|
217
|
+
"flex-column": t.position === "top",
|
|
218
|
+
"flex-column-reverse": t.position === "bottom",
|
|
219
|
+
"flex-row": t.position === "left",
|
|
220
|
+
"flex-row-reverse": t.position === "right"
|
|
221
|
+
})), ae = (e, l) => {
|
|
222
|
+
I(e, l), S(() => {
|
|
223
|
+
x();
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
return M(() => {
|
|
227
|
+
S(() => {
|
|
228
|
+
E(i), window.addEventListener("click", (e) => {
|
|
229
|
+
var l;
|
|
230
|
+
h.value || (l = o.value) != null && l.contains(e.target) || (h.value = !0);
|
|
231
|
+
}), window.addEventListener("resize", (e) => {
|
|
232
|
+
x();
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
}), () => {
|
|
236
|
+
var e, l, n, r;
|
|
237
|
+
return s(oe, null, [s("div", {
|
|
238
|
+
class: se.value,
|
|
239
|
+
ref: o
|
|
240
|
+
}, [s("div", {
|
|
241
|
+
class: $.value
|
|
242
|
+
}, [s("div", {
|
|
243
|
+
class: "farris-tabs-title scroll-tabs",
|
|
244
|
+
style: G.value
|
|
245
|
+
}, [s("button", {
|
|
246
|
+
title: "left-arrow-button",
|
|
247
|
+
type: "button",
|
|
248
|
+
class: J.value,
|
|
249
|
+
onClick: () => {
|
|
250
|
+
W(0, -1);
|
|
251
|
+
}
|
|
252
|
+
}, null), s("div", {
|
|
253
|
+
class: te.value,
|
|
254
|
+
style: "width:100%"
|
|
255
|
+
}, [s("ul", {
|
|
256
|
+
class: le.value,
|
|
257
|
+
ref: i
|
|
258
|
+
}, [a.value.map((d) => {
|
|
259
|
+
const v = d.props, L = d.slots.title;
|
|
260
|
+
return s("li", {
|
|
261
|
+
class: k(v),
|
|
262
|
+
style: y(v)
|
|
263
|
+
}, [s("a", {
|
|
264
|
+
class: U(v),
|
|
265
|
+
onClick: (C) => ae(C, v.id)
|
|
266
|
+
}, [L ? L() : s("span", {
|
|
267
|
+
class: q(v),
|
|
268
|
+
title: v.title
|
|
269
|
+
}, [v.title]), v.removeable && s("span", {
|
|
270
|
+
class: "st-drop-close",
|
|
271
|
+
onClick: (C) => R(C, v.id)
|
|
272
|
+
}, [s("i", {
|
|
273
|
+
class: "f-icon f-icon-close"
|
|
274
|
+
}, null)])])]);
|
|
275
|
+
})])]), s("div", {
|
|
276
|
+
class: K.value
|
|
277
|
+
}, [s("button", {
|
|
278
|
+
title: "right-arrow-button",
|
|
279
|
+
type: "button",
|
|
280
|
+
class: X.value,
|
|
281
|
+
onClick: () => {
|
|
282
|
+
W(0, 1);
|
|
283
|
+
}
|
|
284
|
+
}, null), s("button", {
|
|
285
|
+
title: "toggle-button",
|
|
286
|
+
class: "btn dropdown-toggle-split dropdown-toggle",
|
|
287
|
+
onClick: () => {
|
|
288
|
+
h.value = !1;
|
|
289
|
+
}
|
|
290
|
+
}, null), s("div", {
|
|
291
|
+
class: Q.value
|
|
292
|
+
}, [t.searchBoxVisible && s("div", {
|
|
293
|
+
onClick: (d) => N(d),
|
|
294
|
+
class: "pb-1 tabs-li-absolute"
|
|
295
|
+
}, [ie(s("input", {
|
|
296
|
+
title: "search-box",
|
|
297
|
+
type: "text",
|
|
298
|
+
class: "form-control k-textbox",
|
|
299
|
+
"onUpdate:modelValue": (d) => f.value = d
|
|
300
|
+
}, null), [[ue, f.value]]), s("span", {
|
|
301
|
+
class: "f-icon f-icon-page-title-query tabs-icon-search"
|
|
302
|
+
}, null)]), A.value.length ? s("ul", {
|
|
303
|
+
class: "tab-dropdown-menu--items",
|
|
304
|
+
style: Y()
|
|
305
|
+
}, [A.value.map((d) => s("li", {
|
|
306
|
+
class: Z(d),
|
|
307
|
+
onClick: (v) => ee(v, d.props)
|
|
308
|
+
}, [d.props.removeable && s("span", {
|
|
309
|
+
class: "float-right st-drop-close",
|
|
310
|
+
onClick: (v) => R(v, d.props.id, !0)
|
|
311
|
+
}, [s("i", {
|
|
312
|
+
class: "f-icon f-icon-close"
|
|
313
|
+
}, null)]), s("a", {
|
|
314
|
+
class: "dropdown-title"
|
|
315
|
+
}, [d.props.title])]))]) : s("div", {
|
|
316
|
+
class: "dropdown-no-data"
|
|
317
|
+
}, [re("\u6CA1\u6709\u76F8\u5173\u6570\u636E")])])])]), T.value && s("div", {
|
|
318
|
+
class: "farris-tabs-toolbar"
|
|
319
|
+
}, [(l = (e = T.value) == null ? void 0 : e.toolbarExtra) == null ? void 0 : l.call(e)])]), s("div", {
|
|
320
|
+
class: "farris-tabs-content"
|
|
321
|
+
}, [(r = (n = m.slots).default) == null ? void 0 : r.call(n)])])]);
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
}), he = {
|
|
325
|
+
tabWidth: { type: Number, default: -1 },
|
|
326
|
+
id: { type: String, default: "" },
|
|
327
|
+
customTitleClass: { type: String, default: "" },
|
|
328
|
+
titleOverflow: { type: Boolean, default: !1 },
|
|
329
|
+
title: { type: String, default: "" },
|
|
330
|
+
selected: { type: Boolean, default: !1 },
|
|
331
|
+
disabled: { type: Boolean, default: !1 },
|
|
332
|
+
removeable: { type: Boolean, default: !1 },
|
|
333
|
+
show: { type: Boolean, default: !0 },
|
|
334
|
+
toolbar: { type: Object },
|
|
335
|
+
toolbarPosition: { type: String, default: "inContent" }
|
|
336
|
+
}, F = H({
|
|
337
|
+
name: "FTabPage",
|
|
338
|
+
props: he,
|
|
339
|
+
emits: [],
|
|
340
|
+
setup(t, m) {
|
|
341
|
+
const o = de("tabs");
|
|
342
|
+
ce();
|
|
343
|
+
const i = w(!0), b = {
|
|
344
|
+
slots: m.slots,
|
|
345
|
+
props: t
|
|
346
|
+
};
|
|
347
|
+
M(() => {
|
|
348
|
+
const a = o == null ? void 0 : o.tabs.value.findIndex((c) => c.props.id === t.id);
|
|
349
|
+
!a || a === -1 ? o == null || o.addTab(b) : a > -1 && (i.value = !1, console.warn(`\u5DF2\u7ECF\u5B58\u5728id\u4E3A${t.id}\u7684\u9875\u7B7E\u5566`));
|
|
350
|
+
}), fe(() => {
|
|
351
|
+
});
|
|
352
|
+
function h() {
|
|
353
|
+
return {
|
|
354
|
+
display: (t == null ? void 0 : t.id) === (o == null ? void 0 : o.activeId.value) ? "" : "none"
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
return ve(() => t, (a) => {
|
|
358
|
+
o == null || o.updateTab({
|
|
359
|
+
props: a,
|
|
360
|
+
slots: m.slots
|
|
361
|
+
});
|
|
362
|
+
}, {
|
|
363
|
+
immediate: !0,
|
|
364
|
+
deep: !0
|
|
365
|
+
}), () => {
|
|
366
|
+
var c, T;
|
|
367
|
+
const a = (T = (c = m.slots).default) == null ? void 0 : T.call(c);
|
|
368
|
+
return i.value ? s("div", {
|
|
369
|
+
class: "farris-tab-page",
|
|
370
|
+
style: h()
|
|
371
|
+
}, [a]) : null;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
}), ge = {
|
|
375
|
+
install(t) {
|
|
376
|
+
t.component(V.name, V), t.component(F.name, F);
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
export {
|
|
380
|
+
F as TabPage,
|
|
381
|
+
V as Tabs,
|
|
382
|
+
ge as default,
|
|
383
|
+
he as tabPageProps,
|
|
384
|
+
pe as tabsProps
|
|
385
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(b,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(b=typeof globalThis<"u"?globalThis:b||self,e(b.tabs={},b.Vue))})(this,function(b,e){"use strict";const L={tabType:{type:String,default:"default"},autoTitleWidth:{type:Boolean,default:!1},titleLength:{type:Number,default:7},position:{type:String,default:"top"},showDropDwon:{type:Boolean,default:!1},showTooltips:{type:Boolean,default:!1},scrollStep:{type:Number,default:10},autoResize:{type:Boolean,default:!1},closeable:{type:Boolean,default:!1},selectedTab:{type:String,default:""},width:{type:Number},height:{type:Number},searchBoxVisible:{type:Boolean,default:!0},titleWidth:{type:Number,default:0},customClass:{type:String,default:""},activeId:{type:String},fill:{type:Boolean,default:!1}},oe="";function M(l,h,n){function i(r){const f=r.value.findIndex(g=>g.props.show!==!1&&!n.value&&!g.props.disabled);!n.value&&f!==-1&&(n.value=r.value[f].props.id)}function m(r){return{width:`${r.tabWidth}px`}}function v(r){return{"nav-item":!0,"d-none":r.show!==void 0?!r.show:!1,"f-state-active":r.id===n.value,"f-state-disable":r.disabled}}function o(r){return{"nav-link":!0,"tabs-text-truncate":!0,active:r.id===n.value,disabled:r.disabled}}function u(r){return{"st-tab-text":!0,"farris-title-auto":l.autoTitleWidth}}function y(r){var g;if(l.autoTitleWidth)return;const f=(g=r.value)==null?void 0:g.querySelectorAll(".st-tab-text");if(!!f)for(let T=0;T<f.length;T++){const k=f[T].parentNode;f[T].scrollWidth>k.offsetWidth?f[T].classList.contains("farris-title-text-custom")||f[T].classList.add("farris-title-text-custom"):f[T].classList.remove("farris-title-text-custom")}}function C(r,f){const g=n.value;n.value=f,h.emit("tabChange",{prevId:g,nextId:n.value}),r.preventDefault(),r.stopPropagation()}return{setActiveId:i,getTabStyle:m,getTabClass:v,getTabNavLinkClass:o,getTabTextClass:u,changeTitleStyle:y,selectTabByTabId:C}}const S=e.defineComponent({name:"FTabs",props:L,emits:["tabChange","tabRemove"],setup(l,h){const n=e.shallowRef(),i=e.shallowRef(),m=e.ref(!0),v=e.ref(!0),o=e.ref([]),u=e.ref(l.activeId),y=e.computed(()=>{const t=o.value.find(a=>a.props.id===u.value);return t==null?void 0:t.slots}),C=e.computed(()=>{const t=o.value.find(s=>s.props.id===u.value);return(t==null?void 0:t.props.toolbarPosition)==="inHead"}),r=e.ref("atuo"),f=e.ref(""),{setActiveId:g,getTabStyle:T,getTabClass:k,getTabNavLinkClass:H,getTabTextClass:j,changeTitleStyle:P,selectTabByTabId:E}=M(l,h,u),x=()=>{var a;const t=(a=i.value)==null?void 0:a.parentElement;!t||!i.value||(t.offsetWidth<i.value.scrollWidth?m.value=!1:m.value=!0)},I=t=>{t.preventDefault(),t.stopPropagation()},V=(t,a)=>{if(!i.value)return;const s=i.value.scrollLeft,d=i.value.scrollWidth-i.value.offsetWidth;if(a>0){if(i.value.scrollLeft>=d)return;i.value.scrollLeft=s+l.scrollStep+t}else if(a<0){if(i.value.scrollLeft<=0)return;i.value.scrollLeft=s-l.scrollStep-t}},R=t=>{if(m.value||!i.value)return;const a=i.value.querySelectorAll(".nav-item"),{parentElement:s}=i.value,d=a[t];if(d&&s){const c=s.getBoundingClientRect().left,p=s.getBoundingClientRect().right,N=d.getBoundingClientRect().left,w=d.getBoundingClientRect().right;N<c?V(c-N,-1):p<w&&V(w-p,1)}},q=t=>{o.value.findIndex(s=>s.props.id===t.props.id)===-1&&o.value.push(t),e.nextTick(()=>{x()})},U=t=>{o.value.findIndex(s=>s.props.id===t.props.id)!==-1&&(o.value.forEach(s=>{s.props.id===t.props.id&&(s=t)}),e.nextTick(()=>{P(i),x()}))};function A(t,a,s=!1){o.value.findIndex(d=>d.props.id===a),o.value=o.value.filter(d=>d.props.id!==a),u.value===a&&(u.value="",g(o)),I(t),e.nextTick(()=>{P(i),x(),s&&(v.value=!0);const d=o.value.findIndex(c=>c.props.id===u.value);R(d),h.emit("tabRemove",{removeIndex:d,removeId:a,activeId:u.value})})}e.provide("tabs",{activeId:u,addTab:q,updateTab:U,tabs:o});const _=e.computed(()=>l.fill||l.tabType==="fill"),O=e.computed(()=>l.tabType==="pills"),z=e.computed(()=>({"farris-tabs-header":!0,"farris-tabs-inHead":C.value,"farris-tabs-inContent":!C.value,"farris-tabs-nav-fill":_.value,"farris-tabs-nav-pills":O.value})),$=e.computed(()=>({width:C.value&&l.titleWidth?`${l.titleWidth}%`:""})),G=e.computed(()=>({btn:!0,"sc-nav-btn":!0,"px-1":!0,"sc-nav-lr":!0,"d-none":m.value})),J=e.computed(()=>({"btn-group":!0,"sc-nav-btn":!0,dropdown:!0,"d-none":m.value})),K=e.computed(()=>({"dropdown-menu":!0,"tabs-pt28":l.searchBoxVisible,show:!v.value})),Q=e.computed(()=>({btn:!0,"sc-nav-rg":!0,"d-none":m.value})),X=()=>({width:r.value}),Y=t=>({"dropdown-item":!0,"text-truncate":!0,"px-2":!0,disabled:t.props.disabled,active:t.props.id===u.value,"d-none":t.props.show!==!0}),Z=(t,a)=>{if(a.disabled)return;E(t,a.id);const s=o.value.findIndex(d=>d.props.id===a.id);v.value=!0,e.nextTick(()=>{x(),R(s)})},D=e.computed(()=>{var a,s;let t=[];return l.searchBoxVisible?t=(a=o.value)==null?void 0:a.filter(d=>d.props.title.includes(f.value)):t=(s=o.value)==null?void 0:s.slice(),t}),ee=e.computed(()=>({spacer:!0,"f-utils-fill":!0,"spacer-sides-dropdown":!m.value})),te=e.computed(()=>({nav:!0,"farris-nav-tabs":!0,"flex-nowrap":!0,"nav-fill":l.fill||l.tabType==="fill","nav-pills":l.tabType==="pills","flex-row":l.position==="top"||l.position==="bottom","flex-column":l.position==="left"||l.position==="right"})),le=e.computed(()=>({"farris-tabs":!0,"flex-column":l.position==="top","flex-column-reverse":l.position==="bottom","flex-row":l.position==="left","flex-row-reverse":l.position==="right"})),ae=(t,a)=>{E(t,a),e.nextTick(()=>{x()})};return e.onMounted(()=>{e.nextTick(()=>{P(i),window.addEventListener("click",t=>{var a;v.value||(a=n.value)!=null&&a.contains(t.target)||(v.value=!0)}),window.addEventListener("resize",t=>{x()})})}),()=>{var t,a,s,d;return e.createVNode(e.Fragment,null,[e.createVNode("div",{class:le.value,ref:n},[e.createVNode("div",{class:z.value},[e.createVNode("div",{class:"farris-tabs-title scroll-tabs",style:$.value},[e.createVNode("button",{title:"left-arrow-button",type:"button",class:G.value,onClick:()=>{V(0,-1)}},null),e.createVNode("div",{class:ee.value,style:"width:100%"},[e.createVNode("ul",{class:te.value,ref:i},[o.value.map(c=>{const p=c.props,N=c.slots.title;return e.createVNode("li",{class:k(p),style:T(p)},[e.createVNode("a",{class:H(p),onClick:w=>ae(w,p.id)},[N?N():e.createVNode("span",{class:j(p),title:p.title},[p.title]),p.removeable&&e.createVNode("span",{class:"st-drop-close",onClick:w=>A(w,p.id)},[e.createVNode("i",{class:"f-icon f-icon-close"},null)])])])})])]),e.createVNode("div",{class:J.value},[e.createVNode("button",{title:"right-arrow-button",type:"button",class:Q.value,onClick:()=>{V(0,1)}},null),e.createVNode("button",{title:"toggle-button",class:"btn dropdown-toggle-split dropdown-toggle",onClick:()=>{v.value=!1}},null),e.createVNode("div",{class:K.value},[l.searchBoxVisible&&e.createVNode("div",{onClick:c=>I(c),class:"pb-1 tabs-li-absolute"},[e.withDirectives(e.createVNode("input",{title:"search-box",type:"text",class:"form-control k-textbox","onUpdate:modelValue":c=>f.value=c},null),[[e.vModelText,f.value]]),e.createVNode("span",{class:"f-icon f-icon-page-title-query tabs-icon-search"},null)]),D.value.length?e.createVNode("ul",{class:"tab-dropdown-menu--items",style:X()},[D.value.map(c=>e.createVNode("li",{class:Y(c),onClick:p=>Z(p,c.props)},[c.props.removeable&&e.createVNode("span",{class:"float-right st-drop-close",onClick:p=>A(p,c.props.id,!0)},[e.createVNode("i",{class:"f-icon f-icon-close"},null)]),e.createVNode("a",{class:"dropdown-title"},[c.props.title])]))]):e.createVNode("div",{class:"dropdown-no-data"},[e.createTextVNode("\u6CA1\u6709\u76F8\u5173\u6570\u636E")])])])]),y.value&&e.createVNode("div",{class:"farris-tabs-toolbar"},[(a=(t=y.value)==null?void 0:t.toolbarExtra)==null?void 0:a.call(t)])]),e.createVNode("div",{class:"farris-tabs-content"},[(d=(s=h.slots).default)==null?void 0:d.call(s)])])])}}}),W={tabWidth:{type:Number,default:-1},id:{type:String,default:""},customTitleClass:{type:String,default:""},titleOverflow:{type:Boolean,default:!1},title:{type:String,default:""},selected:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},removeable:{type:Boolean,default:!1},show:{type:Boolean,default:!0},toolbar:{type:Object},toolbarPosition:{type:String,default:"inContent"}},B=e.defineComponent({name:"FTabPage",props:W,emits:[],setup(l,h){const n=e.inject("tabs");e.getCurrentInstance();const i=e.ref(!0),m={slots:h.slots,props:l};e.onMounted(()=>{const o=n==null?void 0:n.tabs.value.findIndex(u=>u.props.id===l.id);!o||o===-1?n==null||n.addTab(m):o>-1&&(i.value=!1,console.warn(`\u5DF2\u7ECF\u5B58\u5728id\u4E3A${l.id}\u7684\u9875\u7B7E\u5566`))}),e.onUnmounted(()=>{});function v(){return{display:(l==null?void 0:l.id)===(n==null?void 0:n.activeId.value)?"":"none"}}return e.watch(()=>l,o=>{n==null||n.updateTab({props:o,slots:h.slots})},{immediate:!0,deep:!0}),()=>{var u,y;const o=(y=(u=h.slots).default)==null?void 0:y.call(u);return i.value?e.createVNode("div",{class:"farris-tab-page",style:v()},[o]):null}}}),F={install(l){l.component(S.name,S),l.component(B.name,B)}};b.TabPage=B,b.Tabs=S,b.default=F,b.tabPageProps=W,b.tabsProps=L,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/tabs/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.farris-tabs .st-drop-close{line-height:1}.farris-tabs .tabs-li-absolute{padding:4px;margin:0;position:relative}.farris-tabs .farris-tabs-header .dropdown-menu{right:0;left:auto;min-height:80px}.farris-tabs .tabs-li-absolute input{line-height:26px;height:26px;padding-right:24px}.farris-tabs .tabs-icon-search{position:absolute;right:4px;top:50%;font-size:14px;padding:0 4px;width:auto;height:24px;line-height:1;color:#00000040;margin-top:-12px;line-height:20px}.farris-tabs .dropdown-no-data{height:26px;line-height:26px;text-align:center;padding-top:5px}.farris-tabs .farris-tabs-header .farris-tabs-title.scroll-tabs .spacer .farris-nav-tabs .nav-item{flex-shrink:0}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineComponent as i, ref as e, computed as l, createVNode as p } from "vue";
|
|
2
|
+
const v = {
|
|
3
|
+
modelValue: { type: String, default: "" }
|
|
4
|
+
}, s = i({
|
|
5
|
+
name: "FText",
|
|
6
|
+
props: v,
|
|
7
|
+
emits: ["update:modelValue"],
|
|
8
|
+
setup(o, d) {
|
|
9
|
+
const n = e(!0), t = e(!0), r = e(""), a = e(0), u = e(0), x = e(o.modelValue), c = l(() => ({
|
|
10
|
+
"f-form-control-text": !n.value,
|
|
11
|
+
"f-form-context-textarea": n,
|
|
12
|
+
"f-component-text-auto-size": t.value
|
|
13
|
+
})), m = l(() => ({
|
|
14
|
+
textalign: r.value,
|
|
15
|
+
height: !t.value && a.value > 0 ? `${a.value}px` : "",
|
|
16
|
+
"min-height": !t.value && a.value > 0 ? `${a.value}px` : "",
|
|
17
|
+
"max-height": !t.value && u.value > 0 ? `${u.value}px` : ""
|
|
18
|
+
}));
|
|
19
|
+
return l(() => ""), () => p("span", {
|
|
20
|
+
class: c.value,
|
|
21
|
+
style: m.value
|
|
22
|
+
}, [x.value]);
|
|
23
|
+
}
|
|
24
|
+
}), h = {
|
|
25
|
+
install(o) {
|
|
26
|
+
o.component(s.name, s);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
s as Text,
|
|
31
|
+
h as default,
|
|
32
|
+
v as textProps
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.text={},t.Vue))})(this,function(t,e){"use strict";const a={modelValue:{type:String,default:""}},l=e.defineComponent({name:"FText",props:a,emits:["update:modelValue"],setup(u,p){const s=e.ref(!0),n=e.ref(!0),f=e.ref(""),o=e.ref(0),i=e.ref(0),c=e.ref(u.modelValue),d=e.computed(()=>({"f-form-control-text":!s.value,"f-form-context-textarea":s,"f-component-text-auto-size":n.value})),m=e.computed(()=>({textalign:f.value,height:!n.value&&o.value>0?`${o.value}px`:"","min-height":!n.value&&o.value>0?`${o.value}px`:"","max-height":!n.value&&i.value>0?`${i.value}px`:""}));return e.computed(()=>""),()=>e.createVNode("span",{class:d.value,style:m.value},[c.value])}}),r={install(u){u.component(l.name,l)}};t.Text=l,t.default=r,t.textProps=a,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|