vue-devui 1.0.0-rc.2 → 1.0.0-rc.5
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/README.md +9 -0
- package/auto-complete/index.es.js +132 -58
- package/auto-complete/index.umd.js +5 -3
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +77 -81
- package/avatar/index.umd.js +1 -1
- package/button/index.es.js +23 -15
- package/button/index.umd.js +1 -1
- package/button/style.css +1 -1
- package/card/index.es.js +3 -6
- package/card/index.umd.js +1 -1
- package/checkbox/index.es.js +5 -11
- package/checkbox/index.umd.js +1 -1
- package/comment/index.es.js +4 -6
- package/comment/index.umd.js +1 -1
- package/countdown/index.es.js +3 -6
- package/countdown/index.umd.js +1 -1
- package/{tag-input → date-picker}/index.d.ts +0 -0
- package/date-picker/index.es.js +1151 -0
- package/date-picker/index.umd.js +1 -0
- package/date-picker/package.json +7 -0
- package/date-picker/style.css +1 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +236 -0
- package/drawer/index.umd.js +1 -0
- package/{tag-input → drawer}/package.json +1 -1
- package/drawer/style.css +1 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +716 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.es.js +2 -5
- package/editable-select/index.umd.js +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +7888 -0
- package/form/index.umd.js +27 -0
- package/form/package.json +7 -0
- package/form/style.css +1 -0
- package/grid/index.es.js +30 -36
- package/grid/index.umd.js +1 -1
- package/image-preview/index.es.js +19 -19
- package/image-preview/index.umd.js +1 -1
- package/input/index.es.js +2 -5
- package/input/index.umd.js +1 -1
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +229 -0
- package/input-number/index.umd.js +1 -0
- package/input-number/package.json +7 -0
- package/input-number/style.css +1 -0
- package/layout/index.es.js +9 -22
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +40 -25
- package/loading/index.umd.js +1 -1
- package/modal/index.es.js +70 -50
- package/modal/index.umd.js +1 -1
- package/notification/index.es.js +100 -10
- package/notification/index.umd.js +1 -1
- package/notification/style.css +1 -1
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/DrawerService.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/DropdownMenu.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/commentProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/dropdownMenuProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/readTipProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/tooltipProps.js +3 -0
- package/overlay/index.es.js +20 -8
- package/overlay/index.umd.js +1 -1
- package/package.json +2 -2
- package/pagination/index.es.js +14 -13
- package/pagination/index.umd.js +1 -1
- package/popover/index.es.js +20 -8
- package/popover/index.umd.js +12 -12
- package/progress/index.es.js +33 -35
- package/progress/index.umd.js +3 -3
- package/rate/index.es.js +31 -41
- package/rate/index.umd.js +1 -1
- package/read-tip/index.es.js +34 -34
- package/read-tip/index.umd.js +1 -1
- package/read-tip/style.css +1 -1
- package/result/index.es.js +2 -5
- package/result/index.umd.js +1 -1
- package/search/index.es.js +11 -11
- package/search/index.umd.js +8 -8
- package/select/index.d.ts +7 -0
- package/select/index.es.js +696 -0
- package/select/index.umd.js +1 -0
- package/select/package.json +7 -0
- package/select/style.css +1 -0
- package/skeleton/index.es.js +9 -12
- package/skeleton/index.umd.js +1 -1
- package/slider/index.es.js +1 -4
- package/slider/index.umd.js +1 -1
- package/splitter/index.es.js +23 -14
- package/splitter/index.umd.js +15 -15
- package/statistic/index.es.js +7 -18
- package/statistic/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +4 -7
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +2376 -0
- package/table/index.umd.js +1 -0
- package/table/package.json +7 -0
- package/table/style.css +1 -0
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +194 -0
- package/tabs/index.umd.js +1 -0
- package/tabs/package.json +7 -0
- package/tabs/style.css +1 -0
- package/textarea/index.es.js +2 -5
- package/textarea/index.umd.js +1 -1
- package/timeline/index.es.js +10 -16
- package/timeline/index.umd.js +1 -1
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +5847 -0
- package/tooltip/index.umd.js +27 -0
- package/tooltip/package.json +7 -0
- package/tooltip/style.css +1 -0
- package/upload/index.es.js +160 -67
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +16936 -24821
- package/vue-devui.umd.js +24 -22
- package/nuxt/components/TagInput.js +0 -3
- package/tag-input/index.es.js +0 -331
- package/tag-input/index.umd.js +0 -1
- package/tag-input/style.css +0 -1
package/loading/index.es.js
CHANGED
|
@@ -28,7 +28,7 @@ class View {
|
|
|
28
28
|
__publicField(this, "left", "50%");
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const loadingProps = {
|
|
32
32
|
message: String,
|
|
33
33
|
backdrop: Boolean,
|
|
34
34
|
view: {
|
|
@@ -41,7 +41,7 @@ const componentProps = {
|
|
|
41
41
|
default: false
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
class
|
|
44
|
+
class LoadingOptions {
|
|
45
45
|
constructor() {
|
|
46
46
|
__publicField(this, "target");
|
|
47
47
|
__publicField(this, "message");
|
|
@@ -56,7 +56,7 @@ var loading$1 = "";
|
|
|
56
56
|
var Loading = defineComponent({
|
|
57
57
|
name: "DLoading",
|
|
58
58
|
inheritAttrs: false,
|
|
59
|
-
props:
|
|
59
|
+
props: loadingProps,
|
|
60
60
|
setup(props) {
|
|
61
61
|
const style = {
|
|
62
62
|
top: props.view.top,
|
|
@@ -115,8 +115,8 @@ var Loading = defineComponent({
|
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
const COMPONENT_CONTAINER_SYMBOL = Symbol("dev_component_container");
|
|
118
|
-
function createComponent(
|
|
119
|
-
const vnode = h(
|
|
118
|
+
function createComponent(component, props, children = null) {
|
|
119
|
+
const vnode = h(component, __spreadValues({}, props), children);
|
|
120
120
|
const container = document.createElement("div");
|
|
121
121
|
vnode[COMPONENT_CONTAINER_SYMBOL] = container;
|
|
122
122
|
render(vnode, container);
|
|
@@ -128,14 +128,18 @@ function unmountComponent(ComponnetInstance) {
|
|
|
128
128
|
const loadingConstructor$1 = defineComponent(Loading);
|
|
129
129
|
const cacheInstance = /* @__PURE__ */ new WeakSet();
|
|
130
130
|
const isEmpty = (val) => {
|
|
131
|
-
if (!val)
|
|
131
|
+
if (!val) {
|
|
132
132
|
return true;
|
|
133
|
-
|
|
133
|
+
}
|
|
134
|
+
if (Array.isArray(val)) {
|
|
134
135
|
return val.length === 0;
|
|
135
|
-
|
|
136
|
+
}
|
|
137
|
+
if (val instanceof Set || val instanceof Map) {
|
|
136
138
|
return val.size === 0;
|
|
137
|
-
|
|
139
|
+
}
|
|
140
|
+
if (val instanceof Promise) {
|
|
138
141
|
return false;
|
|
142
|
+
}
|
|
139
143
|
if (typeof val === "object") {
|
|
140
144
|
try {
|
|
141
145
|
return Object.keys(val).length === 0;
|
|
@@ -169,11 +173,13 @@ const unmount = (el) => {
|
|
|
169
173
|
unmountComponent(el.instance);
|
|
170
174
|
};
|
|
171
175
|
const toggleLoading = (el, binding) => {
|
|
176
|
+
var _a, _b, _c;
|
|
172
177
|
if (binding.value) {
|
|
173
178
|
const vals = isPromise(binding.value);
|
|
174
|
-
if (vals === "error")
|
|
179
|
+
if (vals === "error") {
|
|
175
180
|
return;
|
|
176
|
-
|
|
181
|
+
}
|
|
182
|
+
(_c = (_b = (_a = el == null ? void 0 : el.instance) == null ? void 0 : _a.proxy) == null ? void 0 : _b.open) == null ? void 0 : _c.call(_b);
|
|
177
183
|
el.appendChild(el.mask);
|
|
178
184
|
cacheInstance.add(el);
|
|
179
185
|
if (vals) {
|
|
@@ -196,13 +202,14 @@ const removeAttribute = (el) => {
|
|
|
196
202
|
el.removeAttribute("loadingtemplateref");
|
|
197
203
|
};
|
|
198
204
|
const handleProps = (el, vprops) => {
|
|
199
|
-
|
|
205
|
+
var _a;
|
|
206
|
+
const props = __spreadValues(__spreadValues({}, new LoadingOptions()), vprops);
|
|
200
207
|
const loadingTemplateRef = props.loadingTemplateRef;
|
|
201
208
|
const loadingInstance = createComponent(loadingConstructor$1, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
|
|
202
209
|
el.style.position = props.positionType;
|
|
203
210
|
el.options = props;
|
|
204
211
|
el.instance = loadingInstance;
|
|
205
|
-
el.mask = loadingInstance.proxy.$el;
|
|
212
|
+
el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
|
|
206
213
|
};
|
|
207
214
|
const loadingDirective = {
|
|
208
215
|
mounted: function(el, binding, vnode) {
|
|
@@ -211,8 +218,9 @@ const loadingDirective = {
|
|
|
211
218
|
!isEmpty(binding.value) && toggleLoading(el, binding);
|
|
212
219
|
},
|
|
213
220
|
updated: function(el, binding, vnode) {
|
|
214
|
-
if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el))
|
|
221
|
+
if (!isEmpty(binding.value) && cacheInstance.has(el) || isEmpty(binding.value) && !cacheInstance.has(el)) {
|
|
215
222
|
return;
|
|
223
|
+
}
|
|
216
224
|
!cacheInstance.has(el) && handleProps(el, vnode.props);
|
|
217
225
|
removeAttribute(el);
|
|
218
226
|
toggleLoading(el, binding);
|
|
@@ -222,25 +230,32 @@ const loadingConstructor = defineComponent(Loading);
|
|
|
222
230
|
const cacheTarget = /* @__PURE__ */ new WeakMap();
|
|
223
231
|
const loading = {
|
|
224
232
|
open(options = {}) {
|
|
233
|
+
var _a, _b, _c;
|
|
225
234
|
const parent = options.target || document.body;
|
|
226
235
|
if (cacheTarget.has(parent)) {
|
|
227
236
|
return cacheTarget.get(parent);
|
|
228
237
|
}
|
|
229
|
-
parent.style
|
|
238
|
+
if (parent.style) {
|
|
239
|
+
parent.style.position = options.positionType;
|
|
240
|
+
}
|
|
230
241
|
const isFull = document.body === parent;
|
|
231
|
-
options = __spreadValues(__spreadValues({}, new
|
|
242
|
+
options = __spreadValues(__spreadValues({}, new LoadingOptions()), options);
|
|
232
243
|
const instance = createComponent(loadingConstructor, __spreadProps(__spreadValues({}, options), {
|
|
233
244
|
isFull
|
|
234
245
|
}), options.loadingTemplateRef ? () => options.loadingTemplateRef : null);
|
|
235
246
|
cacheTarget.set(parent, instance);
|
|
236
|
-
instance.proxy.open();
|
|
237
|
-
parent.appendChild(instance.proxy.$el);
|
|
238
|
-
const close = instance.proxy.close;
|
|
239
|
-
instance
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
247
|
+
(_a = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a.open();
|
|
248
|
+
parent.appendChild((_b = instance == null ? void 0 : instance.proxy) == null ? void 0 : _b.$el);
|
|
249
|
+
const close = (_c = instance == null ? void 0 : instance.proxy) == null ? void 0 : _c.close;
|
|
250
|
+
if (instance) {
|
|
251
|
+
instance.loadingInstance = instance == null ? void 0 : instance.proxy;
|
|
252
|
+
if (instance.loadingInstance) {
|
|
253
|
+
instance.loadingInstance.close = (...args) => {
|
|
254
|
+
cacheTarget.delete(parent);
|
|
255
|
+
close == null ? void 0 : close(...args);
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
244
259
|
return instance;
|
|
245
260
|
}
|
|
246
261
|
};
|
|
@@ -253,4 +268,4 @@ var index = {
|
|
|
253
268
|
app.config.globalProperties.$loadingService = loading;
|
|
254
269
|
}
|
|
255
270
|
};
|
|
256
|
-
export { loadingDirective as Loading, loading as LoadingService, index as default };
|
|
271
|
+
export { loadingDirective as Loading, LoadingOptions, loading as LoadingService, index as default, loadingProps };
|
package/loading/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _=Object.defineProperty,D=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var y=(r,t,s)=>t in r?_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,c=(r,t)=>{for(var s in t||(t={}))F.call(t,s)&&y(r,s,t[s]);if(P)for(var s of P(t))I.call(t,s)&&y(r,s,t[s]);return r},O=(r,t)=>D(r,B(t));var l=(r,t,s)=>(y(r,typeof t!="symbol"?t+"":t,s),s);(function(r,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(r=typeof globalThis!="undefined"?globalThis:r||self,t(r.index={},r.Vue))})(this,function(r,t){"use strict";class s{constructor(){l(this,"top","50%");l(this,"left","50%")}}const v={message:String,backdrop:Boolean,view:{type:Object,default:()=>new s},zIndex:Number,isFull:{type:Boolean,default:!1}};class g{constructor(){l(this,"target");l(this,"message");l(this,"loadingTemplateRef");l(this,"backdrop",!0);l(this,"positionType","relative");l(this,"view",new s);l(this,"zIndex")}}var $="",b=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:v,setup(e){const n={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(n.background="none");const i=t.ref(!1);return{style:n,isShow:i,open:()=>{i.value=!0},close:()=>{i.value=!1}}},render(){var u;const{isShow:e,isFull:n,backdrop:i,style:o,message:a,$slots:d}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((u=d.default)==null?void 0:u.call(d))||t.createVNode("div",{class:"devui-loading-wrapper"},[i?t.createVNode("div",{class:"devui-loading-mask"},null):null,t.createVNode("div",{style:o,class:"devui-loading-area"},[t.createVNode("div",{class:"devui-busy-default-spinner"},[t.createVNode("div",{class:"devui-loading-bar1"},null),t.createVNode("div",{class:"devui-loading-bar2"},null),t.createVNode("div",{class:"devui-loading-bar3"},null),t.createVNode("div",{class:"devui-loading-bar4"},null)]),a?t.createVNode("span",{class:"devui-loading-text"},[a]):null])])])}});const h=Symbol("dev_component_container");function w(e,n,i=null){const o=t.h(e,c({},n),i),a=document.createElement("div");return o[h]=a,t.render(o,a),o.component}function C(e){t.render(null,e==null?void 0:e.vnode[h])}const j=t.defineComponent(b),p=new WeakSet,m=e=>{if(!e)return!0;if(Array.isArray(e))return e.length===0;if(e instanceof Set||e instanceof Map)return e.size===0;if(e instanceof Promise)return!1;if(typeof e=="object")try{return Object.keys(e).length===0}catch{return!1}return!1},T=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),z=e=>{switch(T(e)){case"promise":return[e];case"array":return e.some(i=>T(i)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},N=e=>{p.delete(e),e.instance.proxy.close(),C(e.instance)},A=(e,n)=>{var i,o,a;if(n.value){const d=z(n.value);if(d==="error")return;(a=(o=(i=e==null?void 0:e.instance)==null?void 0:i.proxy)==null?void 0:o.open)==null||a.call(o),e.appendChild(e.mask),p.add(e),d&&Promise.all(d).catch(u=>{console.error(new Error("Promise handling errors"),u)}).finally(()=>{N(e)})}else N(e)},x=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},S=(e,n)=>{var d;const i=c(c({},new g),n),o=i.loadingTemplateRef,a=w(j,c({},i),o?()=>o:null);e.style.position=i.positionType,e.options=i,e.instance=a,e.mask=(d=a==null?void 0:a.proxy)==null?void 0:d.$el},V={mounted:function(e,n,i){S(e,i.props),x(e),!m(n.value)&&A(e,n)},updated:function(e,n,i){!m(n.value)&&p.has(e)||m(n.value)&&!p.has(e)||(!p.has(e)&&S(e,i.props),x(e),A(e,n))}},E=t.defineComponent(b),f=new WeakMap,k={open(e={}){var d,u,L;const n=e.target||document.body;if(f.has(n))return f.get(n);n.style&&(n.style.position=e.positionType);const i=document.body===n;e=c(c({},new g),e);const o=w(E,O(c({},e),{isFull:i}),e.loadingTemplateRef?()=>e.loadingTemplateRef:null);f.set(n,o),(d=o==null?void 0:o.proxy)==null||d.open(),n.appendChild((u=o==null?void 0:o.proxy)==null?void 0:u.$el);const a=(L=o==null?void 0:o.proxy)==null?void 0:L.close;return o&&(o.loadingInstance=o==null?void 0:o.proxy,o.loadingInstance&&(o.loadingInstance.close=(...R)=>{f.delete(n),a==null||a(...R)})),o}};var M={title:"Loading \u52A0\u8F7D\u63D0\u793A",category:"\u53CD\u9988",status:"100%",install(e){e.directive("dLoading",V),e.config.globalProperties.$loadingService=k}};r.Loading=V,r.LoadingOptions=g,r.LoadingService=k,r.default=M,r.loadingProps=v,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"});
|
package/modal/index.es.js
CHANGED
|
@@ -34,7 +34,7 @@ var __publicField = (obj, key, value) => {
|
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
36
|
import { defineComponent, toRefs, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref, unref, nextTick, mergeProps, h, render } from "vue";
|
|
37
|
-
import {
|
|
37
|
+
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
38
38
|
const modalProps = {
|
|
39
39
|
modelValue: {
|
|
40
40
|
type: Boolean,
|
|
@@ -249,6 +249,9 @@ const flexibleOverlayProps = {
|
|
|
249
249
|
type: [Number, Object],
|
|
250
250
|
default: 8
|
|
251
251
|
},
|
|
252
|
+
shiftOffset: {
|
|
253
|
+
type: Number
|
|
254
|
+
},
|
|
252
255
|
align: {
|
|
253
256
|
type: String,
|
|
254
257
|
default: null
|
|
@@ -294,6 +297,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
294
297
|
function useOverlay(props, emit) {
|
|
295
298
|
const overlayRef = ref();
|
|
296
299
|
const arrowRef = ref();
|
|
300
|
+
let originParent = null;
|
|
297
301
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
298
302
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
299
303
|
const staticSide = {
|
|
@@ -315,7 +319,6 @@ function useOverlay(props, emit) {
|
|
|
315
319
|
const overlayEl = unref(overlayRef.value);
|
|
316
320
|
const arrowEl = unref(arrowRef.value);
|
|
317
321
|
const middleware = [
|
|
318
|
-
shift(),
|
|
319
322
|
offset(props.offset),
|
|
320
323
|
autoPlacement({
|
|
321
324
|
alignment: props.align,
|
|
@@ -323,30 +326,39 @@ function useOverlay(props, emit) {
|
|
|
323
326
|
})
|
|
324
327
|
];
|
|
325
328
|
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
329
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
326
330
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
327
331
|
strategy: "fixed",
|
|
328
332
|
middleware
|
|
329
333
|
});
|
|
334
|
+
let applyX = x;
|
|
335
|
+
let applyY = y;
|
|
336
|
+
if (props.shiftOffset !== void 0) {
|
|
337
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
338
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
339
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
340
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
341
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
342
|
+
}
|
|
330
343
|
emit("positionChange", placement);
|
|
331
|
-
Object.assign(overlayEl.style, { top: `${
|
|
344
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
332
345
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
333
346
|
};
|
|
334
347
|
watch(() => props.modelValue, () => {
|
|
335
|
-
const originParent = getScrollParent(props.origin);
|
|
336
348
|
if (props.modelValue && props.origin) {
|
|
349
|
+
originParent = getScrollParent(props.origin);
|
|
337
350
|
nextTick(updatePosition);
|
|
338
|
-
originParent.addEventListener("scroll", updatePosition);
|
|
351
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
339
352
|
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
340
353
|
window.addEventListener("resize", updatePosition);
|
|
341
354
|
} else {
|
|
342
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
355
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
343
356
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
344
357
|
window.removeEventListener("resize", updatePosition);
|
|
345
358
|
}
|
|
346
359
|
});
|
|
347
360
|
onUnmounted(() => {
|
|
348
|
-
|
|
349
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
361
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
350
362
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
351
363
|
window.removeEventListener("resize", updatePosition);
|
|
352
364
|
});
|
|
@@ -446,36 +458,39 @@ var Modal = defineComponent({
|
|
|
446
458
|
expose({
|
|
447
459
|
handleVisibleChange
|
|
448
460
|
});
|
|
449
|
-
return () =>
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
461
|
+
return () => {
|
|
462
|
+
const fixedOverlayProps2 = {
|
|
463
|
+
visible: modelValue.value,
|
|
464
|
+
"onUpdate:visible": handleVisibleChange,
|
|
465
|
+
"background-class": "devui-modal-mask",
|
|
466
|
+
"background-block": lockScroll.value,
|
|
467
|
+
"backdrop-close": closeOnClickOverlay.value
|
|
468
|
+
};
|
|
469
|
+
return createVNode(FixedOverlay, fixedOverlayProps2, {
|
|
470
|
+
default: () => [createVNode(Transition, {
|
|
471
|
+
"name": "devui-modal-wipe"
|
|
472
|
+
}, {
|
|
473
|
+
default: () => {
|
|
474
|
+
var _a;
|
|
475
|
+
return [createVNode("div", mergeProps({
|
|
476
|
+
"class": "devui-modal"
|
|
477
|
+
}, attrs), [createVNode(Icon, {
|
|
478
|
+
"name": "close",
|
|
479
|
+
"class": "btn-close",
|
|
480
|
+
"size": "var(--devui-font-size-md,12px)",
|
|
481
|
+
"onClick": () => handleVisibleChange(false)
|
|
482
|
+
}, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
|
|
483
|
+
default: () => [title.value]
|
|
484
|
+
}), createVNode(Body, null, {
|
|
485
|
+
default: () => {
|
|
486
|
+
var _a2;
|
|
487
|
+
return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
|
|
488
|
+
}
|
|
489
|
+
}), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
|
|
490
|
+
}
|
|
491
|
+
})]
|
|
492
|
+
});
|
|
493
|
+
};
|
|
479
494
|
}
|
|
480
495
|
});
|
|
481
496
|
var Footer = defineComponent({
|
|
@@ -515,31 +530,36 @@ class ModalService extends CommonModalService {
|
|
|
515
530
|
const anchor = document.createElement("div");
|
|
516
531
|
this.anchorContainer.appendChild(anchor);
|
|
517
532
|
const _a = props, { header, content, footer } = _a, resProps = __objRest(_a, ["header", "content", "footer"]);
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
hide();
|
|
521
|
-
}
|
|
522
|
-
};
|
|
523
|
-
const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
|
|
524
|
-
return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
|
|
533
|
+
const renderOrigin = (propsValue, onUpdateModelValue) => {
|
|
534
|
+
return this.renderModal(anchor, __spreadProps(__spreadValues({}, propsValue), {
|
|
525
535
|
modelValue: true,
|
|
526
536
|
"onUpdate:modelValue": onUpdateModelValue
|
|
527
537
|
}), { header, default: content, footer });
|
|
528
538
|
};
|
|
529
539
|
const hide = () => {
|
|
530
|
-
var _a2, _b;
|
|
540
|
+
var _a2, _b, _c;
|
|
541
|
+
const innerNeedHideOrNot = (value) => {
|
|
542
|
+
if (!value) {
|
|
543
|
+
hide();
|
|
544
|
+
}
|
|
545
|
+
};
|
|
531
546
|
renderOrigin(resProps, (value) => {
|
|
532
547
|
if (!value) {
|
|
533
548
|
this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
|
|
534
549
|
this.renderNull(anchor);
|
|
535
550
|
} else {
|
|
536
|
-
renderOrigin(resProps);
|
|
551
|
+
renderOrigin(resProps, innerNeedHideOrNot);
|
|
537
552
|
}
|
|
538
553
|
});
|
|
539
|
-
(_b = (_a2 = vm.component.exposed).handleVisibleChange) == null ? void 0 :
|
|
554
|
+
(_c = (_b = (_a2 = vm == null ? void 0 : vm.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.handleVisibleChange) == null ? void 0 : _c.call(_b, false);
|
|
555
|
+
};
|
|
556
|
+
const needHideOrNot = (value) => {
|
|
557
|
+
if (!value) {
|
|
558
|
+
hide();
|
|
559
|
+
}
|
|
540
560
|
};
|
|
541
561
|
this.renderModal(anchor, { modelValue: false });
|
|
542
|
-
vm = renderOrigin(resProps);
|
|
562
|
+
vm = renderOrigin(resProps, needHideOrNot);
|
|
543
563
|
return { hide };
|
|
544
564
|
}
|
|
545
565
|
}
|
|
@@ -565,4 +585,4 @@ var index = {
|
|
|
565
585
|
app.provide(ModalService.token, new ModalService(anchorsContainer));
|
|
566
586
|
}
|
|
567
587
|
};
|
|
568
|
-
export { Modal, index as default };
|
|
588
|
+
export { Modal, index as default, modalProps };
|
package/modal/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Z=Object.defineProperty,ee=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var k=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var E=(r,e,d)=>e in r?Z(r,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):r[e]=d,O=(r,e)=>{for(var d in e||(e={}))j.call(e,d)&&E(r,d,e[d]);if(k)for(var d of k(e))D.call(e,d)&&E(r,d,e[d]);return r},V=(r,e)=>ee(r,te(e));var L=(r,e)=>{var d={};for(var m in r)j.call(r,m)&&e.indexOf(m)<0&&(d[m]=r[m]);if(r!=null&&k)for(var m of k(r))e.indexOf(m)<0&&D.call(r,m)&&(d[m]=r[m]);return d};var R=(r,e,d)=>(E(r,typeof e!="symbol"?e+"":e,d),d);(function(r,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],e):(r=typeof globalThis!="undefined"?globalThis:r||self,e(r.index={},r.Vue,r.dom))})(this,function(r,e,d){"use strict";const m={modelValue:{type:Boolean,default:!1},title:{type:String,default:""},lockScroll:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0},beforeClose:{type:Function}},T={name:{type:String,default:"",required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}};var _=e.defineComponent({name:"DIcon",props:T,setup(t){const{name:o,size:n,color:i,classPrefix:l}=e.toRefs(t);return()=>/^((https?):)?\/\//.test(o.value)?e.createVNode("img",{src:o.value,alt:o.value.split("/")[o.value.split("/").length-1],style:{width:n.value,verticalAlign:"text-bottom"}},null):e.createVNode("i",{class:`${l.value} ${l.value}-${o.value}`,style:{fontSize:n.value,color:i.value}},null)}}),oe="";function z(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const F=e.defineComponent({setup(t,o){return()=>{let n;return e.createVNode(e.Teleport,{to:"#d-overlay-anchor"},{default:()=>[e.createVNode(e.Transition,{name:"devui-overlay-fade"},z(n=e.renderSlot(o.slots,"default"))?n:{default:()=>[n]})]})}}}),$=V(O({},{visible:{type:Boolean},backgroundBlock:{type:Boolean,default:!1},backgroundClass:{type:String,default:""},backgroundStyle:{type:[String,Object]},onBackdropClick:{type:Function},backdropClose:{type:Boolean,default:!0},hasBackdrop:{type:Boolean,default:!0}}),{overlayStyle:{type:[String,Object],default:void 0}}),Y=["update:visible","backdropClick"];function q(t,o){const n=e.computed(()=>["devui-overlay-background",t.backgroundClass,t.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),i=e.computed(()=>"devui-overlay"),l=a=>{var s;a.preventDefault(),(s=t.onBackdropClick)==null||s.call(t),t.backdropClose&&o.emit("update:visible",!1)},u=a=>a.cancelBubble=!0;return e.onMounted(()=>{const a=document.body,s=a.style.overflow,c=a.style.position;e.watch([()=>t.visible,()=>t.backgroundBlock],([y,v])=>{if(v){const f=a.getBoundingClientRect().y;y?(a.style.overflowY="scroll",a.style.position=y?"fixed":"",a.style.top=`${f}px`):(a.style.overflowY=s,a.style.position=c,a.style.top="",window.scrollTo(0,-f))}}),e.onUnmounted(()=>{document.body.style.overflow=s})}),{backgroundClass:n,overlayClass:i,handleBackdropClick:l,handleOverlayBubbleCancel:u}}var le="";const H=e.defineComponent({name:"DFixedOverlay",props:$,emits:Y,setup(t,o){const{backgroundClass:n,overlayClass:i,handleBackdropClick:l,handleOverlayBubbleCancel:u}=q(t,o);return()=>e.createVNode(F,null,{default:()=>[t.visible&&e.createVNode("div",{class:n.value,style:t.backgroundStyle,onClick:l},[e.createVNode("div",{class:i.value,style:t.overlayStyle,onClick:u},[e.renderSlot(o.slots,"default")])])]})}}),I={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},shiftOffset:{type:Number},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function U(t){const o=/(auto|scroll|hidden)/;for(let n=t;n=n.parentElement;n.parentElement!==document.body){const i=window.getComputedStyle(n);if(o.test(i.overflow+i.overflowX+i.overflowY))return n}return window}function X(t,o,n,i){let{x:l,y:u}=o;if(!t){const{width:a,height:s}=i;l&&n.includes("start")&&(l=12),l&&n.includes("end")&&(l=Math.round(a-24)),u&&n.includes("start")&&(u=10),u&&n.includes("end")&&(u=s-14)}return{x:l,y:u}}function K(t,o){const n=e.ref(),i=e.ref();let l=null;const u=(s,c,y,v)=>{const{x:f,y:p}=X(t.isArrowCenter,y,c,v.getBoundingClientRect()),h={top:"bottom",right:"left",bottom:"top",left:"right"}[c.split("-")[0]];Object.assign(s.style,{left:f?`${f}px`:"",top:p?`${p}px`:"",right:"",bottom:"",[h]:"-4px"})},a=async()=>{const s=t.origin,c=e.unref(n.value),y=e.unref(i.value),v=[d.offset(t.offset),d.autoPlacement({alignment:t.align,allowedPlacements:t.position})];t.showArrow&&v.push(d.arrow({element:y})),t.shiftOffset!==void 0&&v.push(d.shift());const{x:f,y:p,placement:h,middlewareData:w}=await d.computePosition(s,c,{strategy:"fixed",middleware:v});let b=f,S=p;if(t.shiftOffset!==void 0){const{x:P,y:A}=w.shift;P<0&&(b-=t.shiftOffset),P>0&&(b+=t.shiftOffset),A<0&&(S-=t.shiftOffset),A>0&&(S+=t.shiftOffset)}o("positionChange",h),Object.assign(c.style,{top:`${S}px`,left:`${b}px`}),t.showArrow&&u(y,h,w.arrow,c)};return e.watch(()=>t.modelValue,()=>{t.modelValue&&t.origin?(l=U(t.origin),e.nextTick(a),l==null||l.addEventListener("scroll",a),l!==window&&window.addEventListener("scroll",a),window.addEventListener("resize",a)):(l==null||l.removeEventListener("scroll",a),l!==window&&window.removeEventListener("scroll",a),window.removeEventListener("resize",a))}),e.onUnmounted(()=>{l==null||l.removeEventListener("scroll",a),l!==window&&window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}),{arrowRef:i,overlayRef:n,updatePosition:a}}var ae="";e.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:I,emits:["update:modelValue","positionChange"],setup(t,{slots:o,attrs:n,emit:i,expose:l}){const{arrowRef:u,overlayRef:a,updatePosition:s}=K(t,i);return l({updatePosition:s}),()=>{var c;return t.modelValue&&e.createVNode("div",e.mergeProps({ref:a,class:"devui-flexible-overlay"},n),[(c=o.default)==null?void 0:c.call(o),t.showArrow&&e.createVNode("div",{ref:u,class:"devui-flexible-overlay-arrow"},null)])}}});const G=typeof window!="undefined";function J(t,o){function n(){o("update:modelValue",!1)}function i(l){l||(t.beforeClose?t.beforeClose(n):n())}return{handleVisibleChange:i}}var x=e.defineComponent({name:"DModalHeader",setup(t,{slots:o}){return()=>{var n;return e.createVNode("div",{class:"devui-modal-header"},[(n=o.default)==null?void 0:n.call(o)])}}}),B=e.defineComponent({name:"DModalBody",setup(t,{slots:o}){return()=>{var n;return e.createVNode("div",{class:"devui-modal-body"},[(n=o.default)==null?void 0:n.call(o)])}}}),re="",g=e.defineComponent({name:"DModal",inheritAttrs:!1,props:m,emits:["update:modelValue"],setup(t,{slots:o,attrs:n,emit:i,expose:l}){const{modelValue:u,lockScroll:a,closeOnClickOverlay:s,title:c}=e.toRefs(t),{handleVisibleChange:y}=J(t,i);return l({handleVisibleChange:y}),()=>{const v={visible:u.value,"onUpdate:visible":y,"background-class":"devui-modal-mask","background-block":a.value,"backdrop-close":s.value};return e.createVNode(H,v,{default:()=>[e.createVNode(e.Transition,{name:"devui-modal-wipe"},{default:()=>{var f;return[e.createVNode("div",e.mergeProps({class:"devui-modal"},n),[e.createVNode(_,{name:"close",class:"btn-close",size:"var(--devui-font-size-md,12px)",onClick:()=>y(!1)},null),o.header?o.header():c.value&&e.createVNode(x,null,{default:()=>[c.value]}),e.createVNode(B,null,{default:()=>{var p;return[(p=o.default)==null?void 0:p.call(o)]}}),(f=o.footer)==null?void 0:f.call(o)])]}})]})}}}),M=e.defineComponent({name:"DModalFooter",setup(t,{slots:o}){return()=>{var n;return e.createVNode("div",{class:"devui-modal-footer"},[(n=o.default)==null?void 0:n.call(o)])}}});class Q{constructor(o){this.anchorContainer=o}renderModal(o,n,i){const l=e.h(this.component(),n,i);return e.render(l,o),l}renderNull(o){setTimeout(()=>{e.render(null,o)},500)}}let C;class N extends Q{component(){return g}open(o={}){const n=document.createElement("div");this.anchorContainer.appendChild(n);const v=o,{header:i,content:l,footer:u}=v,a=L(v,["header","content","footer"]),s=(f,p)=>this.renderModal(n,V(O({},f),{modelValue:!0,"onUpdate:modelValue":p}),{header:i,default:l,footer:u}),c=()=>{var p,h,w;const f=b=>{b||c()};s(a,b=>{b?s(a,f):(this.renderModal(n,V(O({},a),{modelValue:!1})),this.renderNull(n))}),(w=(h=(p=C==null?void 0:C.component)==null?void 0:p.exposed)==null?void 0:h.handleVisibleChange)==null||w.call(h,!1)},y=f=>{f||c()};return this.renderModal(n,{modelValue:!1}),C=s(a,y),{hide:c}}}R(N,"token","MODAL_SERVICE_TOKEN");var W={title:"Modal \u5F39\u7A97",category:"\u53CD\u9988",status:"100%",install(t){if(t.component(g.name,g),t.component(x.name,x),t.component(B.name,B),t.component(M.name,M),!G)return;let o=document.getElementById("d-modal-anchors-container");o||(o=document.createElement("div"),o.setAttribute("id","d-modal-anchors-container"),document.body.appendChild(o)),t.provide(N.token,new N(o))}};r.Modal=g,r.default=W,r.modalProps=m,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"});
|
package/notification/index.es.js
CHANGED
|
@@ -100,6 +100,105 @@ var Close = defineComponent({
|
|
|
100
100
|
}, null)]);
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
+
function SuccessIcon() {
|
|
104
|
+
return createVNode("svg", {
|
|
105
|
+
"width": "16px",
|
|
106
|
+
"height": "16px",
|
|
107
|
+
"viewBox": "0 0 16 16",
|
|
108
|
+
"version": "1.1",
|
|
109
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
110
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
111
|
+
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
112
|
+
"id": "path-s",
|
|
113
|
+
"points": "6.53553391 9.77817459 12.1923882 4.12132034 13.6066017 5.53553391 6.53553391 12.6066017 3 9.07106781 4.41421356 7.65685425 6.53553391 9.77817459"
|
|
114
|
+
}, null)]), createVNode("g", {
|
|
115
|
+
"id": "correct",
|
|
116
|
+
"stroke": "none",
|
|
117
|
+
"stroke-width": "1",
|
|
118
|
+
"fill": "none",
|
|
119
|
+
"fill-rule": "evenodd"
|
|
120
|
+
}, [createVNode("mask", {
|
|
121
|
+
"id": "mask-2",
|
|
122
|
+
"fill": "white"
|
|
123
|
+
}, [createVNode("use", {
|
|
124
|
+
"xlink:href": "#path-s"
|
|
125
|
+
}, null)]), createVNode("use", {
|
|
126
|
+
"id": "Mask",
|
|
127
|
+
"class": "devui-notification-image-success-path",
|
|
128
|
+
"xlink:href": "#path-s"
|
|
129
|
+
}, null)])]);
|
|
130
|
+
}
|
|
131
|
+
function WarningIcon() {
|
|
132
|
+
return createVNode("svg", {
|
|
133
|
+
"width": "16px",
|
|
134
|
+
"height": "16px",
|
|
135
|
+
"viewBox": "0 0 16 16",
|
|
136
|
+
"version": "1.1",
|
|
137
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
138
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
139
|
+
}, [createVNode("g", {
|
|
140
|
+
"stroke": "none",
|
|
141
|
+
"stroke-width": "1",
|
|
142
|
+
"fill": "none",
|
|
143
|
+
"fill-rule": "evenodd"
|
|
144
|
+
}, [createVNode("path", {
|
|
145
|
+
"class": "devui-icon-warning-outer",
|
|
146
|
+
"d": "M8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 Z"
|
|
147
|
+
}, null), createVNode("path", {
|
|
148
|
+
"class": "devui-icon-warning-inner",
|
|
149
|
+
"stroke-width": "0.3",
|
|
150
|
+
"fill-rule": "nonzero",
|
|
151
|
+
"d": "M8.87894737,13 L7.08947368,13 L7.08947368,11.2105263 L8.87894737,11.2105263 L8.87894737,13 Z M8.62102372,9.86842105 L7.32800539,9.86842105 L7,4.5 L8.96842105,4.5 L8.62102372,9.86842105 Z"
|
|
152
|
+
}, null)])]);
|
|
153
|
+
}
|
|
154
|
+
function InfoIcon() {
|
|
155
|
+
return createVNode("svg", {
|
|
156
|
+
"width": "16px",
|
|
157
|
+
"height": "16px",
|
|
158
|
+
"viewBox": "0 0 16 16",
|
|
159
|
+
"version": "1.1",
|
|
160
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
161
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
162
|
+
}, [createVNode("g", {
|
|
163
|
+
"id": "info",
|
|
164
|
+
"stroke": "none",
|
|
165
|
+
"stroke-width": "1",
|
|
166
|
+
"fill": "none",
|
|
167
|
+
"fill-rule": "evenodd"
|
|
168
|
+
}, [createVNode("path", {
|
|
169
|
+
"class": "devui-notification-image-info-path",
|
|
170
|
+
"d": "M7,13 L7,6 L9,6 L9,13 L7,13 Z M7,5 L7,3 L9,3 L9,5 L7,5 Z",
|
|
171
|
+
"id": "info"
|
|
172
|
+
}, null)])]);
|
|
173
|
+
}
|
|
174
|
+
function ErrorIcon() {
|
|
175
|
+
return createVNode("svg", {
|
|
176
|
+
"width": "16px",
|
|
177
|
+
"height": "16px",
|
|
178
|
+
"viewBox": "0 0 16 16",
|
|
179
|
+
"version": "1.1",
|
|
180
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
181
|
+
"xmlns:xlink": "http://www.w3.org/1999/xlink"
|
|
182
|
+
}, [createVNode("defs", null, [createVNode("polygon", {
|
|
183
|
+
"id": "path-e",
|
|
184
|
+
"points": "8.07106781 6.65685425 10.8994949 3.82842712 12.3137085 5.24264069 9.48528137 8.07106781 12.3137085 10.8994949 10.8994949 12.3137085 8.07106781 9.48528137 5.24264069 12.3137085 3.82842712 10.8994949 6.65685425 8.07106781 3.82842712 5.24264069 5.24264069 3.82842712"
|
|
185
|
+
}, null)]), createVNode("g", {
|
|
186
|
+
"id": "error",
|
|
187
|
+
"stroke": "none",
|
|
188
|
+
"stroke-width": "1",
|
|
189
|
+
"fill": "none",
|
|
190
|
+
"fill-rule": "evenodd"
|
|
191
|
+
}, [createVNode("mask", {
|
|
192
|
+
"id": "mask-2",
|
|
193
|
+
"fill": "white"
|
|
194
|
+
}, [createVNode("use", {
|
|
195
|
+
"xlink:href": "#path-e"
|
|
196
|
+
}, null)]), createVNode("use", {
|
|
197
|
+
"id": "Mask",
|
|
198
|
+
"class": "devui-notification-image-error-path",
|
|
199
|
+
"xlink:href": "#path-e"
|
|
200
|
+
}, null)])]);
|
|
201
|
+
}
|
|
103
202
|
var TypeIcon = defineComponent({
|
|
104
203
|
props: {
|
|
105
204
|
type: {
|
|
@@ -115,18 +214,9 @@ var TypeIcon = defineComponent({
|
|
|
115
214
|
"devui-notification-image": true,
|
|
116
215
|
[`devui-notification-image-${type.value}`]: true
|
|
117
216
|
}));
|
|
118
|
-
const severityIconMap = {
|
|
119
|
-
info: "info-o",
|
|
120
|
-
success: "right-o",
|
|
121
|
-
warning: "warning-o",
|
|
122
|
-
error: "error-o"
|
|
123
|
-
};
|
|
124
217
|
return () => createVNode("span", {
|
|
125
218
|
"class": classes.value
|
|
126
|
-
}, [type.value !== "normal" && createVNode(
|
|
127
|
-
"name": severityIconMap[type.value],
|
|
128
|
-
"size": "16px"
|
|
129
|
-
}, null)]);
|
|
219
|
+
}, [type.value && type.value !== "normal" && (type.value === "success" && createVNode(SuccessIcon, null, null) || type.value === "info" && createVNode(InfoIcon, null, null) || type.value === "warning" && createVNode(WarningIcon, null, null) || type.value === "error" && createVNode(ErrorIcon, null, null))]);
|
|
130
220
|
}
|
|
131
221
|
});
|
|
132
222
|
function useNotification(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var B=Object.defineProperty,R=Object.defineProperties;var Z=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var V=(i,e,l)=>e in i?B(i,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[e]=l,m=(i,e)=>{for(var l in e||(e={}))A.call(e,l)&&V(i,l,e[l]);if(w)for(var l of w(e))E.call(e,l)&&V(i,l,e[l]);return i},g=(i,e)=>R(i,Z(e));(function(i,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.index={},i.Vue))})(this,function(i,e){"use strict";const l={modelValue:{type:Boolean,default:!1},title:{type:String,default:""},type:{type:String,default:"normal"},duration:{type:Number,default:3e3},onClose:{type:Function}},N={name:{type:String,default:"",required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}};var x=e.defineComponent({name:"DIcon",props:N,setup(n){const{name:t,size:o,color:a,classPrefix:r}=e.toRefs(n);return()=>/^((https?):)?\/\//.test(t.value)?e.createVNode("img",{src:t.value,alt:t.value.split("/")[t.value.split("/").length-1],style:{width:o.value,verticalAlign:"text-bottom"}},null):e.createVNode("i",{class:`${r.value} ${r.value}-${t.value}`,style:{fontSize:o.value,color:a.value}},null)}}),y=e.defineComponent({emits:["click"],setup(n,{emit:t}){return()=>e.createVNode("div",{class:"devui-notification-icon-close",onClick:o=>t("click",o)},[e.createVNode(x,{name:"close",size:"14px"},null)])}});function k(){return e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[e.createVNode("defs",null,[e.createVNode("polygon",{id:"path-s",points:"6.53553391 9.77817459 12.1923882 4.12132034 13.6066017 5.53553391 6.53553391 12.6066017 3 9.07106781 4.41421356 7.65685425 6.53553391 9.77817459"},null)]),e.createVNode("g",{id:"correct",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("mask",{id:"mask-2",fill:"white"},[e.createVNode("use",{"xlink:href":"#path-s"},null)]),e.createVNode("use",{id:"Mask",class:"devui-notification-image-success-path","xlink:href":"#path-s"},null)])])}function v(){return e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{class:"devui-icon-warning-outer",d:"M8.96244623,0.57254229 L15.8714442,13.4101975 C16.1549662,13.9370117 15.9538562,14.5918482 15.4222523,14.8728158 C15.2642579,14.9563203 15.0879506,15 14.9088903,15 L1.09089441,15 C0.488410063,15 0,14.5159904 0,13.9189343 C0,13.7414873 0.0440768395,13.5667684 0.128340519,13.4101975 L7.03733844,0.57254229 C7.32086049,0.0457280838 7.98165058,-0.153569987 8.51325441,0.127397589 C8.70423071,0.228333932 8.8605922,0.383286648 8.96244623,0.57254229 Z"},null),e.createVNode("path",{class:"devui-icon-warning-inner","stroke-width":"0.3","fill-rule":"nonzero",d:"M8.87894737,13 L7.08947368,13 L7.08947368,11.2105263 L8.87894737,11.2105263 L8.87894737,13 Z M8.62102372,9.86842105 L7.32800539,9.86842105 L7,4.5 L8.96842105,4.5 L8.62102372,9.86842105 Z"},null)])])}function L(){return e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[e.createVNode("g",{id:"info",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{class:"devui-notification-image-info-path",d:"M7,13 L7,6 L9,6 L9,13 L7,13 Z M7,5 L7,3 L9,3 L9,5 L7,5 Z",id:"info"},null)])])}function C(){return e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[e.createVNode("defs",null,[e.createVNode("polygon",{id:"path-e",points:"8.07106781 6.65685425 10.8994949 3.82842712 12.3137085 5.24264069 9.48528137 8.07106781 12.3137085 10.8994949 10.8994949 12.3137085 8.07106781 9.48528137 5.24264069 12.3137085 3.82842712 10.8994949 6.65685425 8.07106781 3.82842712 5.24264069 5.24264069 3.82842712"},null)]),e.createVNode("g",{id:"error",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("mask",{id:"mask-2",fill:"white"},[e.createVNode("use",{"xlink:href":"#path-e"},null)]),e.createVNode("use",{id:"Mask",class:"devui-notification-image-error-path","xlink:href":"#path-e"},null)])])}var S=e.defineComponent({props:{type:{type:String,default:"normal"}},setup(n){const{type:t}=e.toRefs(n),o=e.computed(()=>({"devui-notification-image":!0,[`devui-notification-image-${t.value}`]:!0}));return()=>e.createVNode("span",{class:o.value},[t.value&&t.value!=="normal"&&(t.value==="success"&&e.createVNode(k,null,null)||t.value==="info"&&e.createVNode(L,null,null)||t.value==="warning"&&e.createVNode(v,null,null)||t.value==="error"&&e.createVNode(C,null,null))])}});function T(n){return{classes:e.computed(()=>({"devui-notification-item-container":!0,[`devui-notification-message-${n.type}`]:!0}))}}function M(n,t){let o=null,a;const r=()=>{var s;clearTimeout(o),o=null,(s=n.onClose)==null||s.call(n),t("update:modelValue",!1)},c=()=>{o&&(clearTimeout(o),o=null)},u=()=>{if(!n.modelValue){const s=n.duration-(Date.now()-a);o=setTimeout(r,s)}},f=()=>{t("destroy")};return e.watch(()=>n.modelValue,s=>{s&&(a=Date.now(),n.duration&&(o=setTimeout(r,n.duration)))}),{interrupt:c,removeReset:u,close:r,handleDestroy:f}}var _="",d=e.defineComponent({name:"DNotification",props:l,emits:["update:modelValue","destroy"],setup(n,{emit:t,slots:o}){const{modelValue:a,title:r,type:c}=e.toRefs(n),{classes:u}=T(n),{interrupt:f,removeReset:s,close:j,handleDestroy:z}=M(n,t);return()=>e.createVNode(e.Transition,{name:"notification-fade",onAfterLeave:z},{default:()=>{var h;return[a.value&&e.createVNode("div",{class:"devui-notification"},[e.createVNode("div",{class:u.value,onMouseenter:f,onMouseleave:s},[e.createVNode("div",{class:"devui-notification-item"},[e.createVNode(y,{onClick:j},null),r.value&&e.createVNode(S,{type:c.value},null),e.createVNode("div",{class:"devui-notification-message"},[e.createVNode("span",{class:"devui-notification-title"},[r.value]),e.createVNode("span",{class:"devui-notification-content"},[(h=o.default)==null?void 0:h.call(o)])])])])])]}})}});function b(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!e.isVNode(n)}const I={modelValue:!1,duration:3e3,type:"normal"};function D(n,t){const o=document.createElement("div"),a=e.createApp({setup(){return e.onUnmounted(()=>{document.body.removeChild(o)}),()=>e.createVNode(d,e.mergeProps(n,{onDestroy:a.unmount}),b(t)?t:{default:()=>[t]})}});return document.body.appendChild(o),a.mount(o),a}function P(n,t){n.modelValue=!1,t==null||t()}class p{static open(t){const o=t.onClose||null,a=t.content;let r;delete t.content;const c=e.reactive(g(m(m({},I),t),{onClose:()=>{P(c,o)}}));D(c,a),c.modelValue=!0,clearTimeout(r),t.duration&&(r=setTimeout(c.onClose,t.duration))}}var $={title:"Notification \u5168\u5C40\u901A\u77E5",category:"\u53CD\u9988",status:"100%",install(n){n.component(d.name,d),n.config.globalProperties.$notificationService=p}};i.Notification=d,i.NotificationService=p,i.default=$,i.notificationProps=l,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
|
package/notification/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-notification{position:fixed;top:50px;right:20px;width:20em;word-break:normal;word-wrap:break-word;z-index:1060}.devui-notification a:link,.devui-notification a:visited{color:var(--devui-link-light, #96adfa)}.devui-notification a:hover,.devui-notification a:active{color:var(--devui-link-light-active, #beccfa)}.devui-notification-item-container{position:relative;margin:0 0 8px;opacity:.95;filter:alpha(opacity=95);box-shadow:var(--devui-shadow-length-feedback-overlay, 0 4px 16px 0) var(--devui-shadow, rgba(0, 0, 0, .2));border-radius:var(--devui-border-radius-feedback, 4px);color:var(--devui-feedback-overlay-text, #dfe1e6);background-color:var(--devui-feedback-overlay-bg, #464d6e)}.devui-notification-item{position:relative;display:block;padding:12px 16px}.devui-notification-icon-close{position:absolute;top:7px;right:10px;cursor:pointer}.devui-notification-icon-close i.icon{color:var(--devui-light-text, #ffffff)!important}.devui-notification-title{font-size:var(--devui-font-size-card-title, 14px);padding:0 0 calc(.5em - 2px) 0;display:block;font-weight:700}.devui-notification-image{position:absolute;display:inline-block;width:16px;height:16px;border-radius:50%;left:16px;top:14px;padding:0;line-height:1}.devui-notification-image.devui-notification-image-
|
|
1
|
+
.devui-notification{position:fixed;top:50px;right:20px;width:20em;word-break:normal;word-wrap:break-word;z-index:1060}.devui-notification a:link,.devui-notification a:visited{color:var(--devui-link-light, #96adfa)}.devui-notification a:hover,.devui-notification a:active{color:var(--devui-link-light-active, #beccfa)}.devui-notification-item-container{position:relative;margin:0 0 8px;opacity:.95;filter:alpha(opacity=95);box-shadow:var(--devui-shadow-length-feedback-overlay, 0 4px 16px 0) var(--devui-shadow, rgba(0, 0, 0, .2));border-radius:var(--devui-border-radius-feedback, 4px);color:var(--devui-feedback-overlay-text, #dfe1e6);background-color:var(--devui-feedback-overlay-bg, #464d6e)}.devui-notification-item{position:relative;display:block;padding:12px 16px}.devui-notification-icon-close{position:absolute;top:7px;right:10px;cursor:pointer}.devui-notification-icon-close i.icon{color:var(--devui-light-text, #ffffff)!important}.devui-notification-title{font-size:var(--devui-font-size-card-title, 14px);padding:0 0 calc(.5em - 2px) 0;display:block;font-weight:700}.devui-notification-image{position:absolute;display:inline-block;width:16px;height:16px;border-radius:50%;left:16px;top:14px;padding:0;line-height:1}.devui-notification-image.devui-notification-image-warning path.devui-icon-warning-outer{fill:var(--devui-warning-line, #fa9841)}.devui-notification-image.devui-notification-image-warning path.devui-icon-warning-inner{fill:var(--devui-light-text, #ffffff);stroke:var(--devui-light-text, #ffffff)}.devui-notification-image.devui-notification-image-info{background-color:var(--devui-info, #5e7ce0)}.devui-notification-image.devui-notification-image-error{background-color:var(--devui-danger, #f66f6a)}.devui-notification-image.devui-notification-image-success{background-color:var(--devui-success, #50d4ab)}.devui-notification-image .devui-notification-image-info-path,.devui-notification-image .devui-notification-image-error-path,.devui-notification-image .devui-notification-image-success-path{fill:var(--devui-light-text, #ffffff)}.devui-notification-message{margin-left:20px}.devui-notification-message .devui-notification-content{font-size:var(--devui-font-size, 12px);margin-top:4px}.devui-notification-message-common .devui-notification-message{margin-left:0}.devui-notification-message p{font-size:var(--devui-font-size, 12px);margin-top:4px}.notification-fade-enter-active,.notification-fade-leave-active{transition:transform var(--devui-animation-duration-slow, .3s) var(--devui-animation-ease-in-out, cubic-bezier(.5, .05, .5, .95))}.notification-fade-enter-from,.notification-fade-leave-to{transform:translate(100%)}
|