@farris/ui-vue 1.0.0-beta.2 → 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/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 → farris.all.esm.js} +0 -0
- /package/{src/index.umd.js → farris.all.umd.js} +0 -0
- /package/{src/style.css → style.css} +0 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { defineComponent as J, ref as t, computed as s, watch as K, createVNode as e, Teleport as L } from "vue";
|
|
2
|
+
const Q = {
|
|
3
|
+
class: { type: String, default: "" },
|
|
4
|
+
title: { type: String, default: "" },
|
|
5
|
+
width: { type: Number, default: 500 },
|
|
6
|
+
height: { type: Number, default: 320 },
|
|
7
|
+
buttons: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: []
|
|
10
|
+
},
|
|
11
|
+
modelValue: { type: Boolean, default: !1 },
|
|
12
|
+
showHeader: { type: Boolean, default: !0 },
|
|
13
|
+
showButtons: { type: Boolean, default: !0 }
|
|
14
|
+
}, p = J({
|
|
15
|
+
name: "FModal",
|
|
16
|
+
props: Q,
|
|
17
|
+
emits: ["update:modelValue"],
|
|
18
|
+
setup(a, v) {
|
|
19
|
+
const f = t(a.width), b = t(a.height), c = t(a.modelValue), y = t(""), C = t(a.class), u = t(!0), i = t(a.showHeader), h = t(""), j = t(!0), x = t(!1), O = t(!1), g = t(""), w = t(""), S = t(""), B = t(a.showButtons), V = t(a.title);
|
|
20
|
+
function d(l, o) {
|
|
21
|
+
c.value = !1, v.emit("update:modelValue", !1);
|
|
22
|
+
}
|
|
23
|
+
const $ = [{
|
|
24
|
+
text: "\u53D6\u6D88",
|
|
25
|
+
class: "btn btn-light",
|
|
26
|
+
handle: (l) => {
|
|
27
|
+
d();
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
text: "\u786E\u5B9A",
|
|
31
|
+
class: "btn btn-primary",
|
|
32
|
+
handle: (l) => {
|
|
33
|
+
d();
|
|
34
|
+
}
|
|
35
|
+
}], r = t(a.buttons && a.buttons.length ? a.buttons : $), z = s(() => !!h.value), H = s(() => !!B.value && !!r.value);
|
|
36
|
+
t(), t(), K(() => a.modelValue, () => {
|
|
37
|
+
c.value = a.modelValue;
|
|
38
|
+
});
|
|
39
|
+
const M = t(!1), A = s(() => c.value), F = s(() => {
|
|
40
|
+
const l = {
|
|
41
|
+
modal: !0,
|
|
42
|
+
"farris-modal": !0
|
|
43
|
+
};
|
|
44
|
+
return l["f-modal-fitContent"] = u.value, l;
|
|
45
|
+
}), k = s(() => ({
|
|
46
|
+
display: A.value ? "block" : "none !important"
|
|
47
|
+
})), D = s(() => {
|
|
48
|
+
const l = {
|
|
49
|
+
"modal-dialog": !0
|
|
50
|
+
};
|
|
51
|
+
return C.value.split(" ").reduce((n, m) => (n[m] = !0, n), l), l;
|
|
52
|
+
}), I = s(() => ({
|
|
53
|
+
position: "absolute",
|
|
54
|
+
top: "50%",
|
|
55
|
+
left: "50%",
|
|
56
|
+
width: `${f.value}px`,
|
|
57
|
+
height: u.value ? "auto" : `${b.value}px`,
|
|
58
|
+
"margin-left": `${0 - f.value / 2}px`,
|
|
59
|
+
"margin-top": u.value ? "auto" : `${0 - b.value / 2}px`
|
|
60
|
+
})), N = s(() => ({
|
|
61
|
+
"modal-content": !0,
|
|
62
|
+
"modal-content-has-header": i.value
|
|
63
|
+
})), _ = s(() => ({
|
|
64
|
+
display: i.value ? "" : "none"
|
|
65
|
+
})), E = s(() => ({
|
|
66
|
+
"f-icon": !0,
|
|
67
|
+
modal_maximize: !0,
|
|
68
|
+
modalrevert: M.value
|
|
69
|
+
})), R = s(() => ({
|
|
70
|
+
height: "10px",
|
|
71
|
+
"z-index": 1,
|
|
72
|
+
display: i.value ? "none" : ""
|
|
73
|
+
})), T = s(() => ({
|
|
74
|
+
"modal-body": !0,
|
|
75
|
+
"f-utils-flex-column": g.value === "iframe"
|
|
76
|
+
}));
|
|
77
|
+
function P() {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
const q = s(() => {
|
|
81
|
+
const l = {
|
|
82
|
+
textAlgin: S.value
|
|
83
|
+
}, o = P();
|
|
84
|
+
return Object.assign(l, o);
|
|
85
|
+
});
|
|
86
|
+
function G(l) {
|
|
87
|
+
}
|
|
88
|
+
return () => e(L, {
|
|
89
|
+
to: "body"
|
|
90
|
+
}, {
|
|
91
|
+
default: () => {
|
|
92
|
+
var l, o;
|
|
93
|
+
return [e("div", {
|
|
94
|
+
class: F.value,
|
|
95
|
+
style: k.value
|
|
96
|
+
}, [e("div", {
|
|
97
|
+
id: y.value,
|
|
98
|
+
class: D.value,
|
|
99
|
+
style: I.value
|
|
100
|
+
}, [e("div", {
|
|
101
|
+
class: N.value
|
|
102
|
+
}, [e("div", {
|
|
103
|
+
ref: "modalHeaderRef",
|
|
104
|
+
class: "modal-header",
|
|
105
|
+
style: _.value
|
|
106
|
+
}, [e("div", {
|
|
107
|
+
class: "modal-title"
|
|
108
|
+
}, [z.value && e("span", {
|
|
109
|
+
class: h.value,
|
|
110
|
+
style: "margin-right: 8px"
|
|
111
|
+
}, null), e("span", {
|
|
112
|
+
class: "modal-title-label"
|
|
113
|
+
}, [V.value])]), e("div", {
|
|
114
|
+
class: "actions"
|
|
115
|
+
}, [e("ul", null, [O.value && e("li", {
|
|
116
|
+
class: "f-btn-icon f-bare"
|
|
117
|
+
}, [e("span", {
|
|
118
|
+
class: "f-icon modal_minimize"
|
|
119
|
+
}, null)]), x.value && e("li", {
|
|
120
|
+
onClick: G,
|
|
121
|
+
class: "f-btn-icon f-bare"
|
|
122
|
+
}, [e("span", {
|
|
123
|
+
class: E.value
|
|
124
|
+
}, null)]), j.value && e("li", {
|
|
125
|
+
class: "f-btn-icon f-bare",
|
|
126
|
+
onClick: (n) => d()
|
|
127
|
+
}, [e("span", {
|
|
128
|
+
class: "f-icon modal_close"
|
|
129
|
+
}, null)])])])]), e("div", {
|
|
130
|
+
ref: "dragableElementRef",
|
|
131
|
+
class: "f-utils-absolute-all",
|
|
132
|
+
style: R.value
|
|
133
|
+
}, null), e("div", {
|
|
134
|
+
class: T.value
|
|
135
|
+
}, [(o = (l = v.slots).default) == null ? void 0 : o.call(l), g.value === "iframe" && e("iframe", {
|
|
136
|
+
title: y.value,
|
|
137
|
+
class: "f-utils-fill",
|
|
138
|
+
width: "100%",
|
|
139
|
+
frameborder: "0",
|
|
140
|
+
src: w.value
|
|
141
|
+
}, null)]), H.value && e("div", {
|
|
142
|
+
class: "modal-footer",
|
|
143
|
+
style: q.value
|
|
144
|
+
}, [r.value && r.value.map((n) => e("button", {
|
|
145
|
+
type: "button",
|
|
146
|
+
class: n.class,
|
|
147
|
+
onClick: (m) => {
|
|
148
|
+
n.handle && n.handle(m);
|
|
149
|
+
}
|
|
150
|
+
}, [!!n.iconClass && e("span", {
|
|
151
|
+
class: n.iconClass
|
|
152
|
+
}, [n.text]), !n.iconClass && e("span", null, [n.text])]))])])])])];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}), W = {
|
|
157
|
+
install(a) {
|
|
158
|
+
a.component(p.name, p);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
export {
|
|
162
|
+
p as FModal,
|
|
163
|
+
W as default,
|
|
164
|
+
Q as modalProps
|
|
165
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.modal={},o.Vue))})(this,function(o,e){"use strict";const m={class:{type:String,default:""},title:{type:String,default:""},width:{type:Number,default:500},height:{type:Number,default:320},buttons:{type:Array,default:[]},modelValue:{type:Boolean,default:!1},showHeader:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!0}},n=e.defineComponent({name:"FModal",props:m,emits:["update:modelValue"],setup(l,b){const y=e.ref(l.width),h=e.ref(l.height),c=e.ref(l.modelValue),p=e.ref(""),C=e.ref(l.class),d=e.ref(!0),r=e.ref(l.showHeader),V=e.ref(""),j=e.ref(!0),O=e.ref(!1),x=e.ref(!1),g=e.ref(""),w=e.ref(""),S=e.ref(""),B=e.ref(l.showButtons),M=e.ref(l.title);function i(t,s){c.value=!1,b.emit("update:modelValue",!1)}const $=[{text:"\u53D6\u6D88",class:"btn btn-light",handle:t=>{i()}},{text:"\u786E\u5B9A",class:"btn btn-primary",handle:t=>{i()}}],u=e.ref(l.buttons&&l.buttons.length?l.buttons:$),z=e.computed(()=>!!V.value),F=e.computed(()=>!!B.value&&!!u.value);e.ref(),e.ref(),e.watch(()=>l.modelValue,()=>{c.value=l.modelValue});const H=e.ref(!1),A=e.computed(()=>c.value),T=e.computed(()=>{const t={modal:!0,"farris-modal":!0};return t["f-modal-fitContent"]=d.value,t}),_=e.computed(()=>({display:A.value?"block":"none !important"})),k=e.computed(()=>{const t={"modal-dialog":!0};return C.value.split(" ").reduce((a,f)=>(a[f]=!0,a),t),t}),v=e.computed(()=>({position:"absolute",top:"50%",left:"50%",width:`${y.value}px`,height:d.value?"auto":`${h.value}px`,"margin-left":`${0-y.value/2}px`,"margin-top":d.value?"auto":`${0-h.value/2}px`})),D=e.computed(()=>({"modal-content":!0,"modal-content-has-header":r.value})),I=e.computed(()=>({display:r.value?"":"none"})),P=e.computed(()=>({"f-icon":!0,modal_maximize:!0,modalrevert:H.value})),E=e.computed(()=>({height:"10px","z-index":1,display:r.value?"none":""})),R=e.computed(()=>({"modal-body":!0,"f-utils-flex-column":g.value==="iframe"}));function q(){return{}}const G=e.computed(()=>{const t={textAlgin:S.value},s=q();return Object.assign(t,s)});function J(t){}return()=>e.createVNode(e.Teleport,{to:"body"},{default:()=>{var t,s;return[e.createVNode("div",{class:T.value,style:_.value},[e.createVNode("div",{id:p.value,class:k.value,style:v.value},[e.createVNode("div",{class:D.value},[e.createVNode("div",{ref:"modalHeaderRef",class:"modal-header",style:I.value},[e.createVNode("div",{class:"modal-title"},[z.value&&e.createVNode("span",{class:V.value,style:"margin-right: 8px"},null),e.createVNode("span",{class:"modal-title-label"},[M.value])]),e.createVNode("div",{class:"actions"},[e.createVNode("ul",null,[x.value&&e.createVNode("li",{class:"f-btn-icon f-bare"},[e.createVNode("span",{class:"f-icon modal_minimize"},null)]),O.value&&e.createVNode("li",{onClick:J,class:"f-btn-icon f-bare"},[e.createVNode("span",{class:P.value},null)]),j.value&&e.createVNode("li",{class:"f-btn-icon f-bare",onClick:a=>i()},[e.createVNode("span",{class:"f-icon modal_close"},null)])])])]),e.createVNode("div",{ref:"dragableElementRef",class:"f-utils-absolute-all",style:E.value},null),e.createVNode("div",{class:R.value},[(s=(t=b.slots).default)==null?void 0:s.call(t),g.value==="iframe"&&e.createVNode("iframe",{title:p.value,class:"f-utils-fill",width:"100%",frameborder:"0",src:w.value},null)]),F.value&&e.createVNode("div",{class:"modal-footer",style:G.value},[u.value&&u.value.map(a=>e.createVNode("button",{type:"button",class:a.class,onClick:f=>{a.handle&&a.handle(f)}},[!!a.iconClass&&e.createVNode("span",{class:a.iconClass},[a.text]),!a.iconClass&&e.createVNode("span",null,[a.text])]))])])])])]}})}}),N={install(l){l.component(n.name,n)}};o.FModal=n,o.default=N,o.modalProps=m,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { defineComponent as w, ref as b, computed as u, watch as $, createVNode as n, Fragment as x, reactive as k, createApp as B, onUnmounted as j, mergeProps as M } from "vue";
|
|
2
|
+
const H = {
|
|
3
|
+
limit: { type: Number, default: 5 },
|
|
4
|
+
showCloseButton: { type: Boolean, default: !0 },
|
|
5
|
+
position: { type: String, default: "top-center" },
|
|
6
|
+
timeout: { type: Number, default: 3e3 },
|
|
7
|
+
theme: { type: String, default: "bootstrap" },
|
|
8
|
+
left: { type: Number },
|
|
9
|
+
right: { type: Number },
|
|
10
|
+
top: { type: Number },
|
|
11
|
+
bottom: { type: Number },
|
|
12
|
+
id: { type: String },
|
|
13
|
+
animate: { type: String, default: "fadeIn" },
|
|
14
|
+
toasts: { type: Array },
|
|
15
|
+
options: { type: Object }
|
|
16
|
+
}, L = {
|
|
17
|
+
animate: { type: String, default: "fadeIn" },
|
|
18
|
+
options: { type: Object }
|
|
19
|
+
};
|
|
20
|
+
const T = w({
|
|
21
|
+
name: "Toast",
|
|
22
|
+
props: L,
|
|
23
|
+
emits: ["close", "click"],
|
|
24
|
+
setup: (e, l) => {
|
|
25
|
+
const a = b(e.animate), i = "fadeOut", t = u(() => e.options), r = b(!1), m = u(() => {
|
|
26
|
+
const s = {
|
|
27
|
+
animated: r.value,
|
|
28
|
+
toast: !0
|
|
29
|
+
};
|
|
30
|
+
return s[e.animate] = !1, s[i] = r.value, s[t.value.type] = !0, t.value.theme && (s[t.value.theme] = !0), s;
|
|
31
|
+
}), p = u(() => {
|
|
32
|
+
const S = `f-icon-${t.value && t.value.type ? t.value.type.replace("toasty-type-", "") : "default"}`, O = {
|
|
33
|
+
"f-icon": !0
|
|
34
|
+
};
|
|
35
|
+
return O[S] = !0, O;
|
|
36
|
+
}), f = u(() => t.value.title || t.value.msg), y = u(() => t.value.title && t.value.msg), h = u(() => !t.value.title && t.value.msg), g = u(() => !0), o = u(() => !!t.value.buttons || !!l.slots.default);
|
|
37
|
+
function c(s) {
|
|
38
|
+
s.stopPropagation(), s.preventDefault(), r.value = !1, setTimeout(() => {
|
|
39
|
+
l.emit("close", t.value);
|
|
40
|
+
}, 200);
|
|
41
|
+
}
|
|
42
|
+
function d(s, v) {
|
|
43
|
+
}
|
|
44
|
+
function I(s) {
|
|
45
|
+
return `f-preten-link ${s.customClass ? s.customClass : ""}`;
|
|
46
|
+
}
|
|
47
|
+
$(a, () => {
|
|
48
|
+
a.value;
|
|
49
|
+
});
|
|
50
|
+
const N = () => {
|
|
51
|
+
var s;
|
|
52
|
+
return n(x, null, [n("div", {
|
|
53
|
+
class: "after-toast-msg text-right"
|
|
54
|
+
}, [!l.slots.default && ((s = t.value.buttons) == null ? void 0 : s.map((v) => n("span", {
|
|
55
|
+
class: I(v),
|
|
56
|
+
onClick: (S) => void 0
|
|
57
|
+
}, [v.text]))), l.slots.default && l.slots.default()])]);
|
|
58
|
+
};
|
|
59
|
+
return () => n("div", {
|
|
60
|
+
class: m.value
|
|
61
|
+
}, [g.value && n("button", {
|
|
62
|
+
title: "close",
|
|
63
|
+
class: "toast-close f-btn-icon f-bare",
|
|
64
|
+
onClick: c
|
|
65
|
+
}, [n("span", {
|
|
66
|
+
class: "f-icon modal_close"
|
|
67
|
+
}, null)]), f.value && n("section", {
|
|
68
|
+
class: "modal-tips"
|
|
69
|
+
}, [n("div", {
|
|
70
|
+
class: "float-left modal-tips-iconwrap"
|
|
71
|
+
}, [n("span", {
|
|
72
|
+
class: p
|
|
73
|
+
}, null)]), n("div", {
|
|
74
|
+
class: "modal-tips-content"
|
|
75
|
+
}, [y.value && n(x, null, [n("h5", {
|
|
76
|
+
class: "toast-title modal-tips-title",
|
|
77
|
+
innerHTML: t.value.title
|
|
78
|
+
}, null), n("p", {
|
|
79
|
+
class: "toast-msg",
|
|
80
|
+
innerHTML: t.value.msg
|
|
81
|
+
}, null), o.value && N()]), h.value && (t.value.buttons ? n("div", {
|
|
82
|
+
class: "toast-title-btns-wrapper d-flex"
|
|
83
|
+
}, [n("h5", {
|
|
84
|
+
class: "toast-title modal-tips-title only-toast-msg",
|
|
85
|
+
innerHTML: t.value.msg
|
|
86
|
+
}, null), n("div", {
|
|
87
|
+
class: "after-toast-title text-right ml-auto"
|
|
88
|
+
}, [N()])]) : n("h5", {
|
|
89
|
+
class: "toast-title modal-tips-title only-toast-msg",
|
|
90
|
+
innerHTML: t.value.msg
|
|
91
|
+
}, null))])])]);
|
|
92
|
+
}
|
|
93
|
+
}), C = w({
|
|
94
|
+
name: "Notify",
|
|
95
|
+
props: H,
|
|
96
|
+
emits: ["close", "empty"],
|
|
97
|
+
setup(e, l) {
|
|
98
|
+
const a = u(() => ({
|
|
99
|
+
"farris-notify": !0
|
|
100
|
+
})), i = {
|
|
101
|
+
left: 12,
|
|
102
|
+
right: 12,
|
|
103
|
+
top: 136,
|
|
104
|
+
bottom: 12
|
|
105
|
+
}, t = b(e.toasts || []), r = u(() => {
|
|
106
|
+
const o = {
|
|
107
|
+
left: e.position.indexOf("left") > -1 ? `${e.left ? e.left : i.left}px` : "",
|
|
108
|
+
right: e.position.indexOf("right") > -1 ? `${e.right ? e.right : i.right}px` : "",
|
|
109
|
+
top: e.position.indexOf("top") > -1 ? `${e.top ? e.top : i.top}px` : "",
|
|
110
|
+
bottom: e.position.indexOf("bottom") > -1 ? `${e.bottom ? e.bottom : i.bottom}px` : ""
|
|
111
|
+
};
|
|
112
|
+
return e.position.indexOf("center") && (o.left = "50%", o.transform = "translate(-50%, -50%)"), o;
|
|
113
|
+
});
|
|
114
|
+
function m(o) {
|
|
115
|
+
l.emit("close");
|
|
116
|
+
}
|
|
117
|
+
function p(o) {
|
|
118
|
+
t.value.length >= e.limit && t.value.shift(), t.value.push(o);
|
|
119
|
+
}
|
|
120
|
+
function f(o) {
|
|
121
|
+
o && o.onRemove && o.onRemove.call(o);
|
|
122
|
+
}
|
|
123
|
+
function y(o) {
|
|
124
|
+
const c = t.value.findIndex((d) => d.id === o);
|
|
125
|
+
if (c > -1) {
|
|
126
|
+
const d = t.value[c];
|
|
127
|
+
f(d), t.value.splice(c, 1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function h() {
|
|
131
|
+
t.value.forEach((o) => f(o)), t.value.length = 0, l.emit("empty");
|
|
132
|
+
}
|
|
133
|
+
l.expose({
|
|
134
|
+
addToast: p,
|
|
135
|
+
clear: y,
|
|
136
|
+
clearAll: h,
|
|
137
|
+
closeToast: m
|
|
138
|
+
});
|
|
139
|
+
function g(o, c) {
|
|
140
|
+
m();
|
|
141
|
+
}
|
|
142
|
+
return () => n("div", {
|
|
143
|
+
id: e.id,
|
|
144
|
+
class: a.value,
|
|
145
|
+
style: r.value
|
|
146
|
+
}, [t.value.map((o) => n(T, {
|
|
147
|
+
options: o,
|
|
148
|
+
animate: e.animate,
|
|
149
|
+
onClose: (c) => g()
|
|
150
|
+
}, null))]);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
function P(e, l) {
|
|
154
|
+
const a = document.createElement("div");
|
|
155
|
+
a.style.display = "contents";
|
|
156
|
+
const i = B({
|
|
157
|
+
setup() {
|
|
158
|
+
return j(() => {
|
|
159
|
+
document.body.removeChild(a);
|
|
160
|
+
}), () => n(C, M(e, {
|
|
161
|
+
onClose: i.unmount
|
|
162
|
+
}), null);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
return document.body.appendChild(a), i.mount(a), i;
|
|
166
|
+
}
|
|
167
|
+
class R {
|
|
168
|
+
static show(l) {
|
|
169
|
+
const a = k({
|
|
170
|
+
...l
|
|
171
|
+
});
|
|
172
|
+
P(a);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const E = {
|
|
176
|
+
install(e) {
|
|
177
|
+
e.component(C.name, C), e.component(T.name, T), e.provide("NotifyService", R);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
export {
|
|
181
|
+
C as Notify,
|
|
182
|
+
R as NotifyService,
|
|
183
|
+
T as Toast,
|
|
184
|
+
E as default,
|
|
185
|
+
H as notifyProps,
|
|
186
|
+
L as toastProps
|
|
187
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.notify={},s.Vue))})(this,function(s,t){"use strict";const v={limit:{type:Number,default:5},showCloseButton:{type:Boolean,default:!0},position:{type:String,default:"top-center"},timeout:{type:Number,default:3e3},theme:{type:String,default:"bootstrap"},left:{type:Number},right:{type:Number},top:{type:Number},bottom:{type:Number},id:{type:String},animate:{type:String,default:"fadeIn"},toasts:{type:Array},options:{type:Object}},V={animate:{type:String,default:"fadeIn"},options:{type:Object}},j="",d=t.defineComponent({name:"Toast",props:V,emits:["close","click"],setup:(o,l)=>{const i=t.ref(o.animate),c="fadeOut",e=t.computed(()=>o.options),r=t.ref(!1),m=t.computed(()=>{const a={animated:r.value,toast:!0};return a[o.animate]=!1,a[c]=r.value,a[e.value.type]=!0,e.value.theme&&(a[e.value.theme]=!0),a}),g=t.computed(()=>{const O=`f-icon-${e.value&&e.value.type?e.value.type.replace("toasty-type-",""):"default"}`,w={"f-icon":!0};return w[O]=!0,w}),p=t.computed(()=>e.value.title||e.value.msg),N=t.computed(()=>e.value.title&&e.value.msg),b=t.computed(()=>!e.value.title&&e.value.msg),T=t.computed(()=>!0),n=t.computed(()=>!!e.value.buttons||!!l.slots.default);function u(a){a.stopPropagation(),a.preventDefault(),r.value=!1,setTimeout(()=>{l.emit("close",e.value)},200)}function y(a,h){}function x(a){return`f-preten-link ${a.customClass?a.customClass:""}`}t.watch(i,()=>{i.value});const S=()=>{var a;return t.createVNode(t.Fragment,null,[t.createVNode("div",{class:"after-toast-msg text-right"},[!l.slots.default&&((a=e.value.buttons)==null?void 0:a.map(h=>t.createVNode("span",{class:x(h),onClick:O=>void 0},[h.text]))),l.slots.default&&l.slots.default()])])};return()=>t.createVNode("div",{class:m.value},[T.value&&t.createVNode("button",{title:"close",class:"toast-close f-btn-icon f-bare",onClick:u},[t.createVNode("span",{class:"f-icon modal_close"},null)]),p.value&&t.createVNode("section",{class:"modal-tips"},[t.createVNode("div",{class:"float-left modal-tips-iconwrap"},[t.createVNode("span",{class:g},null)]),t.createVNode("div",{class:"modal-tips-content"},[N.value&&t.createVNode(t.Fragment,null,[t.createVNode("h5",{class:"toast-title modal-tips-title",innerHTML:e.value.title},null),t.createVNode("p",{class:"toast-msg",innerHTML:e.value.msg},null),n.value&&S()]),b.value&&(e.value.buttons?t.createVNode("div",{class:"toast-title-btns-wrapper d-flex"},[t.createVNode("h5",{class:"toast-title modal-tips-title only-toast-msg",innerHTML:e.value.msg},null),t.createVNode("div",{class:"after-toast-title text-right ml-auto"},[S()])]):t.createVNode("h5",{class:"toast-title modal-tips-title only-toast-msg",innerHTML:e.value.msg},null))])])])}}),f=t.defineComponent({name:"Notify",props:v,emits:["close","empty"],setup(o,l){const i=t.computed(()=>({"farris-notify":!0})),c={left:12,right:12,top:136,bottom:12},e=t.ref(o.toasts||[]),r=t.computed(()=>{const n={left:o.position.indexOf("left")>-1?`${o.left?o.left:c.left}px`:"",right:o.position.indexOf("right")>-1?`${o.right?o.right:c.right}px`:"",top:o.position.indexOf("top")>-1?`${o.top?o.top:c.top}px`:"",bottom:o.position.indexOf("bottom")>-1?`${o.bottom?o.bottom:c.bottom}px`:""};return o.position.indexOf("center")&&(n.left="50%",n.transform="translate(-50%, -50%)"),n});function m(n){l.emit("close")}function g(n){e.value.length>=o.limit&&e.value.shift(),e.value.push(n)}function p(n){n&&n.onRemove&&n.onRemove.call(n)}function N(n){const u=e.value.findIndex(y=>y.id===n);if(u>-1){const y=e.value[u];p(y),e.value.splice(u,1)}}function b(){e.value.forEach(n=>p(n)),e.value.length=0,l.emit("empty")}l.expose({addToast:g,clear:N,clearAll:b,closeToast:m});function T(n,u){m()}return()=>t.createVNode("div",{id:o.id,class:i.value,style:r.value},[e.value.map(n=>t.createVNode(d,{options:n,animate:o.animate,onClose:u=>T()},null))])}});function I(o,l){const i=document.createElement("div");i.style.display="contents";const c=t.createApp({setup(){return t.onUnmounted(()=>{document.body.removeChild(i)}),()=>t.createVNode(f,t.mergeProps(o,{onClose:c.unmount}),null)}});return document.body.appendChild(i),c.mount(i),c}class C{static show(l){const i=t.reactive({...l});I(i)}}const $={install(o){o.component(f.name,f),o.component(d.name,d),o.provide("NotifyService",C)}};s.Notify=f,s.NotifyService=C,s.Toast=d,s.default=$,s.notifyProps=v,s.toastProps=V,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/notify/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.toast-title-beforeshow{opacity:0}@-webkit-keyframes farrisMoveUpIn{0%{transform:translateY(-100%);transform-origin:0 0;opacity:0}to{transform:translateY(0);transform-origin:0 0;opacity:1}}@keyframes farrisMoveUpIn{0%{transform:translateY(-100%);transform-origin:0 0;opacity:0}to{transform:translateY(0);transform-origin:0 0;opacity:1}}@-webkit-keyframes farrisMoveUpOut{0%{transform:translateY(0);transform-origin:0 0;opacity:1}to{transform:translateY(-100%);transform-origin:0 0;opacity:0}}@keyframes farrisMoveUpOut{0%{transform:translateY(0);transform-origin:0 0;opacity:1}to{transform:translateY(-100%);transform-origin:0 0;opacity:0}}.toast.fadeIn{-webkit-animation:farrisMoveUpIn .2s linear;animation:farrisMoveUpIn .2s linear}.toast.fadeOut{-webkit-animation:farrisMoveUpOut .2s linear;animation:farrisMoveUpOut .2s linear}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farris/ui-vue",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Farris Vue, a Farris Design based Vue3 component library.",
|
|
7
7
|
"keywords": [
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "git@gitee.com:ubml/farris-vue.git"
|
|
18
18
|
},
|
|
19
|
-
"main": "./
|
|
20
|
-
"module": "./
|
|
21
|
-
"style": "./
|
|
19
|
+
"main": "./farris.all.umd.js",
|
|
20
|
+
"module": "./farris.all.esm.js",
|
|
21
|
+
"style": "./style.css",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@types/lodash-es": "^4.17.4",
|
|
24
24
|
"@vue/shared": "^3.2.0",
|