vue-devui 1.0.0-rc.0 → 1.0.0-rc.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/README.md +55 -113
- package/alert/index.es.js +28 -30
- package/alert/index.umd.js +1 -1
- package/auto-complete/index.es.js +143 -103
- package/auto-complete/index.umd.js +5 -1
- package/auto-complete/style.css +1 -1
- package/avatar/index.es.js +77 -81
- package/avatar/index.umd.js +1 -1
- package/badge/index.es.js +1 -1
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.es.js +43 -43
- package/button/index.umd.js +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 +2 -5
- package/comment/index.umd.js +1 -1
- package/countdown/index.es.js +5 -7
- package/countdown/index.umd.js +1 -1
- package/editable-select/index.es.js +124 -168
- package/editable-select/index.umd.js +1 -1
- package/fullscreen/index.es.js +13 -16
- package/fullscreen/index.umd.js +1 -1
- package/grid/index.es.js +30 -36
- package/grid/index.umd.js +1 -1
- package/icon/index.es.js +39 -57
- package/icon/index.umd.js +1 -1
- package/image-preview/index.es.js +21 -20
- package/image-preview/index.umd.js +1 -1
- package/input/index.es.js +2 -5
- package/input/index.umd.js +1 -1
- package/layout/index.es.js +6 -21
- package/layout/index.umd.js +1 -1
- package/loading/index.es.js +20 -12
- package/loading/index.umd.js +1 -1
- package/modal/index.es.js +135 -122
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.es.js +38 -40
- package/notification/index.umd.js +1 -1
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/alertProps.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/editableSelectProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +2 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.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/searchProps.js +3 -0
- package/nuxt/components/skeletonProps.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/tagInputProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/overlay/index.es.js +49 -42
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +8 -43
- package/pagination/index.es.js +24 -25
- package/pagination/index.umd.js +1 -1
- package/panel/index.es.js +45 -32
- package/panel/index.umd.js +1 -1
- package/popover/index.es.js +51 -44
- package/popover/index.umd.js +12 -12
- package/popover/style.css +1 -1
- package/progress/index.es.js +34 -36
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.es.js +11 -11
- package/radio/index.umd.js +1 -1
- package/radio/style.css +1 -1
- package/rate/index.es.js +4 -7
- package/rate/index.umd.js +1 -1
- package/read-tip/index.es.js +8 -8
- package/read-tip/index.umd.js +1 -1
- package/result/index.es.js +40 -58
- package/result/index.umd.js +1 -1
- package/ripple/index.es.js +47 -42
- package/ripple/index.umd.js +1 -1
- package/search/index.es.js +13 -16
- package/search/index.umd.js +8 -8
- package/skeleton/index.es.js +20 -23
- package/skeleton/index.umd.js +1 -1
- package/slider/index.es.js +60 -59
- package/slider/index.umd.js +1 -1
- package/splitter/index.es.js +223 -171
- package/splitter/index.umd.js +13 -13
- package/splitter/style.css +1 -1
- package/statistic/index.es.js +7 -18
- package/statistic/index.umd.js +1 -1
- package/status/index.es.js +1 -4
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/style.css +1 -1
- package/switch/index.es.js +3 -6
- package/switch/index.umd.js +1 -1
- package/tag/index.es.js +15 -18
- package/tag/index.umd.js +1 -1
- package/tag/style.css +1 -1
- package/tag-input/index.es.js +7 -8
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.es.js +2 -5
- package/textarea/index.umd.js +1 -1
- package/{accordion → timeline}/index.d.ts +0 -0
- package/{time-axis → timeline}/index.es.js +64 -83
- package/timeline/index.umd.js +1 -0
- package/{anchor → timeline}/package.json +1 -1
- package/timeline/style.css +1 -0
- package/upload/index.es.js +98 -97
- package/upload/index.umd.js +1 -1
- package/vue-devui.es.js +12477 -24991
- package/vue-devui.umd.js +24 -20
- package/accordion/index.es.js +0 -720
- package/accordion/index.umd.js +0 -1
- package/accordion/package.json +0 -7
- package/accordion/style.css +0 -1
- package/anchor/index.d.ts +0 -7
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/back-top/index.d.ts +0 -7
- package/back-top/index.es.js +0 -128
- package/back-top/index.umd.js +0 -1
- package/back-top/package.json +0 -7
- package/back-top/style.css +0 -1
- package/breadcrumb/index.d.ts +0 -7
- package/breadcrumb/index.es.js +0 -127
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/package.json +0 -7
- package/breadcrumb/style.css +0 -1
- package/carousel/index.d.ts +0 -7
- package/carousel/index.es.js +0 -329
- package/carousel/index.umd.js +0 -1
- package/carousel/package.json +0 -7
- package/carousel/style.css +0 -1
- package/cascader/index.d.ts +0 -7
- package/cascader/index.es.js +0 -5963
- package/cascader/index.umd.js +0 -27
- package/cascader/package.json +0 -7
- package/cascader/style.css +0 -1
- package/color-picker/index.d.ts +0 -7
- package/color-picker/index.es.js +0 -8187
- package/color-picker/index.umd.js +0 -27
- package/color-picker/package.json +0 -7
- package/color-picker/style.css +0 -1
- package/date-picker/index.d.ts +0 -7
- package/date-picker/index.es.js +0 -1171
- package/date-picker/index.umd.js +0 -1
- package/date-picker/package.json +0 -7
- package/date-picker/style.css +0 -1
- package/dragdrop/index.d.ts +0 -7
- package/dragdrop/index.es.js +0 -157
- package/dragdrop/index.umd.js +0 -1
- package/dragdrop/package.json +0 -7
- package/drawer/index.d.ts +0 -7
- package/drawer/index.es.js +0 -234
- package/drawer/index.umd.js +0 -1
- package/drawer/package.json +0 -7
- package/drawer/style.css +0 -1
- package/dropdown/index.d.ts +0 -7
- package/dropdown/index.es.js +0 -638
- package/dropdown/index.umd.js +0 -1
- package/dropdown/package.json +0 -7
- package/dropdown/style.css +0 -1
- package/form/index.d.ts +0 -7
- package/form/index.es.js +0 -7865
- package/form/index.umd.js +0 -27
- package/form/package.json +0 -7
- package/form/style.css +0 -1
- package/gantt/index.d.ts +0 -7
- package/gantt/index.es.js +0 -523
- package/gantt/index.umd.js +0 -1
- package/gantt/package.json +0 -7
- package/gantt/style.css +0 -1
- package/input-icon/index.d.ts +0 -7
- package/input-icon/index.es.js +0 -331
- package/input-icon/index.umd.js +0 -1
- package/input-icon/package.json +0 -7
- package/input-icon/style.css +0 -1
- package/input-number/index.d.ts +0 -7
- package/input-number/index.es.js +0 -240
- package/input-number/index.umd.js +0 -1
- package/input-number/package.json +0 -7
- package/input-number/style.css +0 -1
- package/list/index.d.ts +0 -7
- package/list/index.es.js +0 -39
- package/list/index.umd.js +0 -1
- package/list/package.json +0 -7
- package/list/style.css +0 -1
- package/nav-sprite/index.d.ts +0 -7
- package/nav-sprite/index.es.js +0 -68
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/nuxt/components/Accordion.js +0 -3
- package/nuxt/components/Anchor.js +0 -3
- package/nuxt/components/BackTop.js +0 -3
- package/nuxt/components/Breadcrumb.js +0 -3
- package/nuxt/components/Carousel.js +0 -3
- package/nuxt/components/CarouselItem.js +0 -3
- package/nuxt/components/Cascader.js +0 -3
- package/nuxt/components/ColorPicker.js +0 -3
- package/nuxt/components/Column.js +0 -3
- package/nuxt/components/DatePicker.js +0 -3
- package/nuxt/components/Drawer.js +0 -3
- package/nuxt/components/DrawerService.js +0 -3
- package/nuxt/components/Dropdown.js +0 -3
- package/nuxt/components/DropdownMenu.js +0 -3
- package/nuxt/components/Form.js +0 -3
- package/nuxt/components/FormControl.js +0 -3
- package/nuxt/components/FormItem.js +0 -3
- package/nuxt/components/FormLabel.js +0 -3
- package/nuxt/components/FormOperation.js +0 -3
- package/nuxt/components/Gantt.js +0 -3
- package/nuxt/components/InputIcon.js +0 -3
- package/nuxt/components/InputNumber.js +0 -3
- package/nuxt/components/List.js +0 -3
- package/nuxt/components/ListItem.js +0 -3
- package/nuxt/components/NavSprite.js +0 -2
- package/nuxt/components/QuadrantDiagram.js +0 -3
- package/nuxt/components/Select.js +0 -3
- package/nuxt/components/StepsGuide.js +0 -3
- package/nuxt/components/StickSlider.js +0 -3
- package/nuxt/components/Sticky.js +0 -2
- package/nuxt/components/Table.js +0 -3
- package/nuxt/components/Tabs.js +0 -3
- package/nuxt/components/TimeAxis.js +0 -3
- package/nuxt/components/TimeAxisItem.js +0 -3
- package/nuxt/components/TimePicker.js +0 -3
- package/nuxt/components/Tooltip.js +0 -3
- package/nuxt/components/Transfer.js +0 -3
- package/nuxt/components/Tree.js +0 -3
- package/nuxt/components/TreeSelect.js +0 -3
- package/nuxt/components/dropdownMenuProps.js +0 -3
- package/nuxt/components/tooltipProps.js +0 -3
- package/quadrant-diagram/index.d.ts +0 -7
- package/quadrant-diagram/index.es.js +0 -5728
- package/quadrant-diagram/index.umd.js +0 -27
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/select/index.d.ts +0 -7
- package/select/index.es.js +0 -706
- package/select/index.umd.js +0 -1
- package/select/package.json +0 -7
- package/select/style.css +0 -1
- package/steps-guide/index.d.ts +0 -7
- package/steps-guide/index.es.js +0 -239
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.d.ts +0 -7
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/sticky/package.json +0 -7
- package/table/index.d.ts +0 -7
- package/table/index.es.js +0 -1969
- package/table/index.umd.js +0 -1
- package/table/package.json +0 -7
- package/table/style.css +0 -1
- package/tabs/index.d.ts +0 -7
- package/tabs/index.es.js +0 -194
- package/tabs/index.umd.js +0 -1
- package/tabs/package.json +0 -7
- package/tabs/style.css +0 -1
- package/time-axis/index.d.ts +0 -7
- package/time-axis/index.umd.js +0 -1
- package/time-axis/package.json +0 -7
- package/time-axis/style.css +0 -1
- package/time-picker/index.d.ts +0 -7
- package/time-picker/index.es.js +0 -1237
- package/time-picker/index.umd.js +0 -1
- package/time-picker/package.json +0 -7
- package/time-picker/style.css +0 -1
- package/tooltip/index.d.ts +0 -7
- package/tooltip/index.es.js +0 -5828
- package/tooltip/index.umd.js +0 -27
- package/tooltip/package.json +0 -7
- package/tooltip/style.css +0 -1
- package/transfer/index.d.ts +0 -7
- package/transfer/index.es.js +0 -7608
- package/transfer/index.umd.js +0 -27
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree/index.d.ts +0 -7
- package/tree/index.es.js +0 -6490
- package/tree/index.umd.js +0 -27
- package/tree/package.json +0 -7
- package/tree/style.css +0 -1
- package/tree-select/index.d.ts +0 -7
- package/tree-select/index.es.js +0 -623
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
package/loading/index.es.js
CHANGED
|
@@ -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);
|
|
@@ -196,13 +196,14 @@ const removeAttribute = (el) => {
|
|
|
196
196
|
el.removeAttribute("loadingtemplateref");
|
|
197
197
|
};
|
|
198
198
|
const handleProps = (el, vprops) => {
|
|
199
|
+
var _a;
|
|
199
200
|
const props = __spreadValues(__spreadValues({}, new LoadingProps()), vprops);
|
|
200
201
|
const loadingTemplateRef = props.loadingTemplateRef;
|
|
201
202
|
const loadingInstance = createComponent(loadingConstructor$1, __spreadValues({}, props), loadingTemplateRef ? () => loadingTemplateRef : null);
|
|
202
203
|
el.style.position = props.positionType;
|
|
203
204
|
el.options = props;
|
|
204
205
|
el.instance = loadingInstance;
|
|
205
|
-
el.mask = loadingInstance.proxy.$el;
|
|
206
|
+
el.mask = (_a = loadingInstance == null ? void 0 : loadingInstance.proxy) == null ? void 0 : _a.$el;
|
|
206
207
|
};
|
|
207
208
|
const loadingDirective = {
|
|
208
209
|
mounted: function(el, binding, vnode) {
|
|
@@ -222,25 +223,32 @@ const loadingConstructor = defineComponent(Loading);
|
|
|
222
223
|
const cacheTarget = /* @__PURE__ */ new WeakMap();
|
|
223
224
|
const loading = {
|
|
224
225
|
open(options = {}) {
|
|
226
|
+
var _a, _b, _c;
|
|
225
227
|
const parent = options.target || document.body;
|
|
226
228
|
if (cacheTarget.has(parent)) {
|
|
227
229
|
return cacheTarget.get(parent);
|
|
228
230
|
}
|
|
229
|
-
parent.style
|
|
231
|
+
if (parent.style) {
|
|
232
|
+
parent.style.position = options.positionType;
|
|
233
|
+
}
|
|
230
234
|
const isFull = document.body === parent;
|
|
231
235
|
options = __spreadValues(__spreadValues({}, new LoadingProps()), options);
|
|
232
236
|
const instance = createComponent(loadingConstructor, __spreadProps(__spreadValues({}, options), {
|
|
233
237
|
isFull
|
|
234
238
|
}), options.loadingTemplateRef ? () => options.loadingTemplateRef : null);
|
|
235
239
|
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
|
-
|
|
240
|
+
(_a = instance == null ? void 0 : instance.proxy) == null ? void 0 : _a.open();
|
|
241
|
+
parent.appendChild((_b = instance == null ? void 0 : instance.proxy) == null ? void 0 : _b.$el);
|
|
242
|
+
const close = (_c = instance == null ? void 0 : instance.proxy) == null ? void 0 : _c.close;
|
|
243
|
+
if (instance) {
|
|
244
|
+
instance.loadingInstance = instance == null ? void 0 : instance.proxy;
|
|
245
|
+
if (instance.loadingInstance) {
|
|
246
|
+
instance.loadingInstance.close = (...args) => {
|
|
247
|
+
cacheTarget.delete(parent);
|
|
248
|
+
close == null ? void 0 : close(...args);
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
244
252
|
return instance;
|
|
245
253
|
}
|
|
246
254
|
};
|
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 m=(i,t,s)=>t in i?_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s,c=(i,t)=>{for(var s in t||(t={}))F.call(t,s)&&m(i,s,t[s]);if(P)for(var s of P(t))I.call(t,s)&&m(i,s,t[s]);return i},L=(i,t)=>D(i,B(t));var d=(i,t,s)=>(m(i,typeof t!="symbol"?t+"":t,s),s);(function(i,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(i=typeof globalThis!="undefined"?globalThis:i||self,t(i.index={},i.Vue))})(this,function(i,t){"use strict";class s{constructor(){d(this,"top","50%");d(this,"left","50%")}}const C={message:String,backdrop:Boolean,view:{type:Object,default:()=>new s},zIndex:Number,isFull:{type:Boolean,default:!1}};class y{constructor(){d(this,"target");d(this,"message");d(this,"loadingTemplateRef");d(this,"backdrop",!0);d(this,"positionType","relative");d(this,"view",new s);d(this,"zIndex")}}var $="",v=t.defineComponent({name:"DLoading",inheritAttrs:!1,props:C,setup(e){const n={top:e.view.top,left:e.view.left,zIndex:e.zIndex};e.message||(n.background="none");const r=t.ref(!1);return{style:n,isShow:r,open:()=>{r.value=!0},close:()=>{r.value=!1}}},render(){var p;const{isShow:e,isFull:n,backdrop:r,style:o,message:a,$slots:l}=this;return e&&t.createVNode("div",{class:["devui-loading-contanier",n?"devui-loading--full":""]},[((p=l.default)==null?void 0:p.call(l))||t.createVNode("div",{class:"devui-loading-wrapper"},[r?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 b=Symbol("dev_component_container");function h(e,n,r=null){const o=t.h(e,c({},n),r),a=document.createElement("div");return o[b]=a,t.render(o,a),o.component}function O(e){t.render(null,e==null?void 0:e.vnode[b])}const j=t.defineComponent(v),u=new WeakSet,g=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},w=e=>Object.prototype.toString.call(e).slice(8,-1).toLowerCase(),z=e=>{switch(w(e)){case"promise":return[e];case"array":return e.some(r=>w(r)!=="promise")?(console.error(new TypeError("Binding values should all be of type Promise")),"error"):e;default:return!1}},T=e=>{u.delete(e),e.instance.proxy.close(),O(e.instance)},N=(e,n)=>{if(n.value){const r=z(n.value);if(r==="error")return;e.instance.proxy.open(),e.appendChild(e.mask),u.add(e),r&&Promise.all(r).catch(o=>{console.error(new Error("Promise handling errors"),o)}).finally(()=>{T(e)})}else T(e)},x=e=>{e.removeAttribute("zindex"),e.removeAttribute("positiontype"),e.removeAttribute("backdrop"),e.removeAttribute("message"),e.removeAttribute("view"),e.removeAttribute("loadingtemplateref")},A=(e,n)=>{var l;const r=c(c({},new y),n),o=r.loadingTemplateRef,a=h(j,c({},r),o?()=>o:null);e.style.position=r.positionType,e.options=r,e.instance=a,e.mask=(l=a==null?void 0:a.proxy)==null?void 0:l.$el},S={mounted:function(e,n,r){A(e,r.props),x(e),!g(n.value)&&N(e,n)},updated:function(e,n,r){!g(n.value)&&u.has(e)||g(n.value)&&!u.has(e)||(!u.has(e)&&A(e,r.props),x(e),N(e,n))}},E=t.defineComponent(v),f=new WeakMap,V={open(e={}){var l,p,k;const n=e.target||document.body;if(f.has(n))return f.get(n);n.style&&(n.style.position=e.positionType);const r=document.body===n;e=c(c({},new y),e);const o=h(E,L(c({},e),{isFull:r}),e.loadingTemplateRef?()=>e.loadingTemplateRef:null);f.set(n,o),(l=o==null?void 0:o.proxy)==null||l.open(),n.appendChild((p=o==null?void 0:o.proxy)==null?void 0:p.$el);const a=(k=o==null?void 0:o.proxy)==null?void 0:k.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",S),e.config.globalProperties.$loadingService=V}};i.Loading=S,i.LoadingService=V,i.default=M,Object.defineProperty(i,"__esModule",{value:!0}),i[Symbol.toStringTag]="Module"});
|
package/modal/index.es.js
CHANGED
|
@@ -33,8 +33,8 @@ var __publicField = (obj, key, value) => {
|
|
|
33
33
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
return value;
|
|
35
35
|
};
|
|
36
|
-
import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref,
|
|
37
|
-
import { offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
|
|
36
|
+
import { defineComponent, toRefs, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref, unref, nextTick, mergeProps, h, render } from "vue";
|
|
37
|
+
import { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
|
|
38
38
|
const modalProps = {
|
|
39
39
|
modelValue: {
|
|
40
40
|
type: Boolean,
|
|
@@ -56,56 +56,54 @@ const modalProps = {
|
|
|
56
56
|
type: Function
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
+
const iconProps = {
|
|
60
|
+
name: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "",
|
|
63
|
+
required: true
|
|
64
|
+
},
|
|
65
|
+
size: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "inherit"
|
|
68
|
+
},
|
|
69
|
+
color: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "inherit"
|
|
72
|
+
},
|
|
73
|
+
classPrefix: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: "icon"
|
|
76
|
+
}
|
|
77
|
+
};
|
|
59
78
|
var Icon = defineComponent({
|
|
60
79
|
name: "DIcon",
|
|
61
|
-
props:
|
|
62
|
-
name: {
|
|
63
|
-
type: String,
|
|
64
|
-
required: true
|
|
65
|
-
},
|
|
66
|
-
size: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: "inherit"
|
|
69
|
-
},
|
|
70
|
-
color: {
|
|
71
|
-
type: String,
|
|
72
|
-
default: "inherit"
|
|
73
|
-
},
|
|
74
|
-
classPrefix: {
|
|
75
|
-
type: String,
|
|
76
|
-
default: "icon"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
80
|
+
props: iconProps,
|
|
79
81
|
setup(props) {
|
|
80
|
-
return __spreadValues({}, props);
|
|
81
|
-
},
|
|
82
|
-
render() {
|
|
83
82
|
const {
|
|
84
83
|
name,
|
|
85
84
|
size,
|
|
86
85
|
color,
|
|
87
86
|
classPrefix
|
|
88
|
-
} =
|
|
89
|
-
return
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
87
|
+
} = toRefs(props);
|
|
88
|
+
return () => {
|
|
89
|
+
return /^((https?):)?\/\//.test(name.value) ? createVNode("img", {
|
|
90
|
+
"src": name.value,
|
|
91
|
+
"alt": name.value.split("/")[name.value.split("/").length - 1],
|
|
92
|
+
"style": {
|
|
93
|
+
width: size.value,
|
|
94
|
+
verticalAlign: "text-bottom"
|
|
95
|
+
}
|
|
96
|
+
}, null) : createVNode("i", {
|
|
97
|
+
"class": `${classPrefix.value} ${classPrefix.value}-${name.value}`,
|
|
98
|
+
"style": {
|
|
99
|
+
fontSize: size.value,
|
|
100
|
+
color: color.value
|
|
101
|
+
}
|
|
102
|
+
}, null);
|
|
103
|
+
};
|
|
103
104
|
}
|
|
104
105
|
});
|
|
105
|
-
|
|
106
|
-
app.component(Icon.name, Icon);
|
|
107
|
-
};
|
|
108
|
-
var overlay = "";
|
|
106
|
+
var baseOverlay = "";
|
|
109
107
|
function _isSlot(s) {
|
|
110
108
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
111
109
|
}
|
|
@@ -152,43 +150,13 @@ const overlayProps = {
|
|
|
152
150
|
default: true
|
|
153
151
|
}
|
|
154
152
|
};
|
|
155
|
-
const overlayEmits = ["update:visible", "backdropClick"];
|
|
156
153
|
const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
|
|
157
154
|
overlayStyle: {
|
|
158
155
|
type: [String, Object],
|
|
159
156
|
default: void 0
|
|
160
157
|
}
|
|
161
158
|
});
|
|
162
|
-
const
|
|
163
|
-
modelValue: {
|
|
164
|
-
type: Boolean,
|
|
165
|
-
default: false
|
|
166
|
-
},
|
|
167
|
-
origin: {
|
|
168
|
-
type: Object,
|
|
169
|
-
require: true
|
|
170
|
-
},
|
|
171
|
-
position: {
|
|
172
|
-
type: Array,
|
|
173
|
-
default: ["bottom"]
|
|
174
|
-
},
|
|
175
|
-
offset: {
|
|
176
|
-
type: [Number, Object],
|
|
177
|
-
default: 8
|
|
178
|
-
},
|
|
179
|
-
align: {
|
|
180
|
-
type: String,
|
|
181
|
-
default: null
|
|
182
|
-
},
|
|
183
|
-
showArrow: {
|
|
184
|
-
type: Boolean,
|
|
185
|
-
default: false
|
|
186
|
-
},
|
|
187
|
-
isArrowCenter: {
|
|
188
|
-
type: Boolean,
|
|
189
|
-
default: true
|
|
190
|
-
}
|
|
191
|
-
};
|
|
159
|
+
const overlayEmits = ["update:visible", "backdropClick"];
|
|
192
160
|
function useOverlayLogic(props, ctx) {
|
|
193
161
|
const backgroundClass = computed(() => {
|
|
194
162
|
return [
|
|
@@ -239,6 +207,7 @@ function useOverlayLogic(props, ctx) {
|
|
|
239
207
|
handleOverlayBubbleCancel
|
|
240
208
|
};
|
|
241
209
|
}
|
|
210
|
+
var fixedOverlay = "";
|
|
242
211
|
const FixedOverlay = defineComponent({
|
|
243
212
|
name: "DFixedOverlay",
|
|
244
213
|
props: fixedOverlayProps,
|
|
@@ -263,6 +232,36 @@ const FixedOverlay = defineComponent({
|
|
|
263
232
|
});
|
|
264
233
|
}
|
|
265
234
|
});
|
|
235
|
+
const flexibleOverlayProps = {
|
|
236
|
+
modelValue: {
|
|
237
|
+
type: Boolean,
|
|
238
|
+
default: false
|
|
239
|
+
},
|
|
240
|
+
origin: {
|
|
241
|
+
type: Object,
|
|
242
|
+
require: true
|
|
243
|
+
},
|
|
244
|
+
position: {
|
|
245
|
+
type: Array,
|
|
246
|
+
default: ["bottom"]
|
|
247
|
+
},
|
|
248
|
+
offset: {
|
|
249
|
+
type: [Number, Object],
|
|
250
|
+
default: 8
|
|
251
|
+
},
|
|
252
|
+
align: {
|
|
253
|
+
type: String,
|
|
254
|
+
default: null
|
|
255
|
+
},
|
|
256
|
+
showArrow: {
|
|
257
|
+
type: Boolean,
|
|
258
|
+
default: false
|
|
259
|
+
},
|
|
260
|
+
isArrowCenter: {
|
|
261
|
+
type: Boolean,
|
|
262
|
+
default: true
|
|
263
|
+
}
|
|
264
|
+
};
|
|
266
265
|
function getScrollParent(element) {
|
|
267
266
|
const overflowRegex = /(auto|scroll|hidden)/;
|
|
268
267
|
for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
|
|
@@ -295,6 +294,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
295
294
|
function useOverlay(props, emit) {
|
|
296
295
|
const overlayRef = ref();
|
|
297
296
|
const arrowRef = ref();
|
|
297
|
+
let originParent = null;
|
|
298
298
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
299
299
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
300
300
|
const staticSide = {
|
|
@@ -316,6 +316,7 @@ function useOverlay(props, emit) {
|
|
|
316
316
|
const overlayEl = unref(overlayRef.value);
|
|
317
317
|
const arrowEl = unref(arrowRef.value);
|
|
318
318
|
const middleware = [
|
|
319
|
+
shift(),
|
|
319
320
|
offset(props.offset),
|
|
320
321
|
autoPlacement({
|
|
321
322
|
alignment: props.align,
|
|
@@ -332,25 +333,24 @@ function useOverlay(props, emit) {
|
|
|
332
333
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
333
334
|
};
|
|
334
335
|
watch(() => props.modelValue, () => {
|
|
335
|
-
const originParent = getScrollParent(props.origin);
|
|
336
336
|
if (props.modelValue && props.origin) {
|
|
337
|
+
originParent = getScrollParent(props.origin);
|
|
337
338
|
nextTick(updatePosition);
|
|
338
|
-
originParent.addEventListener("scroll", updatePosition);
|
|
339
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
339
340
|
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
340
341
|
window.addEventListener("resize", updatePosition);
|
|
341
342
|
} else {
|
|
342
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
343
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
343
344
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
344
345
|
window.removeEventListener("resize", updatePosition);
|
|
345
346
|
}
|
|
346
347
|
});
|
|
347
348
|
onUnmounted(() => {
|
|
348
|
-
|
|
349
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
349
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
350
350
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
351
351
|
window.removeEventListener("resize", updatePosition);
|
|
352
352
|
});
|
|
353
|
-
return { arrowRef, overlayRef };
|
|
353
|
+
return { arrowRef, overlayRef, updatePosition };
|
|
354
354
|
}
|
|
355
355
|
var flexibleOverlay = "";
|
|
356
356
|
defineComponent({
|
|
@@ -361,12 +361,17 @@ defineComponent({
|
|
|
361
361
|
setup(props, {
|
|
362
362
|
slots,
|
|
363
363
|
attrs,
|
|
364
|
-
emit
|
|
364
|
+
emit,
|
|
365
|
+
expose
|
|
365
366
|
}) {
|
|
366
367
|
const {
|
|
367
368
|
arrowRef,
|
|
368
|
-
overlayRef
|
|
369
|
+
overlayRef,
|
|
370
|
+
updatePosition
|
|
369
371
|
} = useOverlay(props, emit);
|
|
372
|
+
expose({
|
|
373
|
+
updatePosition
|
|
374
|
+
});
|
|
370
375
|
return () => {
|
|
371
376
|
var _a;
|
|
372
377
|
return props.modelValue && createVNode("div", mergeProps({
|
|
@@ -441,36 +446,39 @@ var Modal = defineComponent({
|
|
|
441
446
|
expose({
|
|
442
447
|
handleVisibleChange
|
|
443
448
|
});
|
|
444
|
-
return () =>
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
449
|
+
return () => {
|
|
450
|
+
const fixedOverlayProps2 = {
|
|
451
|
+
visible: modelValue.value,
|
|
452
|
+
"onUpdate:visible": handleVisibleChange,
|
|
453
|
+
"background-class": "devui-modal-mask",
|
|
454
|
+
"background-block": lockScroll.value,
|
|
455
|
+
"backdrop-close": closeOnClickOverlay.value
|
|
456
|
+
};
|
|
457
|
+
return createVNode(FixedOverlay, fixedOverlayProps2, {
|
|
458
|
+
default: () => [createVNode(Transition, {
|
|
459
|
+
"name": "devui-modal-wipe"
|
|
460
|
+
}, {
|
|
461
|
+
default: () => {
|
|
462
|
+
var _a;
|
|
463
|
+
return [createVNode("div", mergeProps({
|
|
464
|
+
"class": "devui-modal"
|
|
465
|
+
}, attrs), [createVNode(Icon, {
|
|
466
|
+
"name": "close",
|
|
467
|
+
"class": "btn-close",
|
|
468
|
+
"size": "var(--devui-font-size-md,12px)",
|
|
469
|
+
"onClick": () => handleVisibleChange(false)
|
|
470
|
+
}, null), slots.header ? slots.header() : title.value && createVNode(Header, null, {
|
|
471
|
+
default: () => [title.value]
|
|
472
|
+
}), createVNode(Body, null, {
|
|
473
|
+
default: () => {
|
|
474
|
+
var _a2;
|
|
475
|
+
return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
|
|
476
|
+
}
|
|
477
|
+
}), (_a = slots.footer) == null ? void 0 : _a.call(slots)])];
|
|
478
|
+
}
|
|
479
|
+
})]
|
|
480
|
+
});
|
|
481
|
+
};
|
|
474
482
|
}
|
|
475
483
|
});
|
|
476
484
|
var Footer = defineComponent({
|
|
@@ -510,31 +518,36 @@ class ModalService extends CommonModalService {
|
|
|
510
518
|
const anchor = document.createElement("div");
|
|
511
519
|
this.anchorContainer.appendChild(anchor);
|
|
512
520
|
const _a = props, { header, content, footer } = _a, resProps = __objRest(_a, ["header", "content", "footer"]);
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
hide();
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
const renderOrigin = (props2, onUpdateModelValue = needHideOrNot) => {
|
|
519
|
-
return this.renderModal(anchor, __spreadProps(__spreadValues({}, props2), {
|
|
521
|
+
const renderOrigin = (propsValue, onUpdateModelValue) => {
|
|
522
|
+
return this.renderModal(anchor, __spreadProps(__spreadValues({}, propsValue), {
|
|
520
523
|
modelValue: true,
|
|
521
524
|
"onUpdate:modelValue": onUpdateModelValue
|
|
522
525
|
}), { header, default: content, footer });
|
|
523
526
|
};
|
|
524
527
|
const hide = () => {
|
|
525
|
-
var _a2, _b;
|
|
528
|
+
var _a2, _b, _c;
|
|
529
|
+
const innerNeedHideOrNot = (value) => {
|
|
530
|
+
if (!value) {
|
|
531
|
+
hide();
|
|
532
|
+
}
|
|
533
|
+
};
|
|
526
534
|
renderOrigin(resProps, (value) => {
|
|
527
535
|
if (!value) {
|
|
528
536
|
this.renderModal(anchor, __spreadProps(__spreadValues({}, resProps), { modelValue: false }));
|
|
529
537
|
this.renderNull(anchor);
|
|
530
538
|
} else {
|
|
531
|
-
renderOrigin(resProps);
|
|
539
|
+
renderOrigin(resProps, innerNeedHideOrNot);
|
|
532
540
|
}
|
|
533
541
|
});
|
|
534
|
-
(_b = (_a2 = vm.component.exposed).handleVisibleChange) == null ? void 0 :
|
|
542
|
+
(_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);
|
|
543
|
+
};
|
|
544
|
+
const needHideOrNot = (value) => {
|
|
545
|
+
if (!value) {
|
|
546
|
+
hide();
|
|
547
|
+
}
|
|
535
548
|
};
|
|
536
549
|
this.renderModal(anchor, { modelValue: false });
|
|
537
|
-
vm = renderOrigin(resProps);
|
|
550
|
+
vm = renderOrigin(resProps, needHideOrNot);
|
|
538
551
|
return { hide };
|
|
539
552
|
}
|
|
540
553
|
}
|
package/modal/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var J=Object.defineProperty,Q=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var C=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var N=(a,e,d)=>e in a?J(a,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):a[e]=d,k=(a,e)=>{for(var d in e||(e={}))M.call(e,d)&&N(a,d,e[d]);if(C)for(var d of C(e))P.call(e,d)&&N(a,d,e[d]);return a},V=(a,e)=>Q(a,W(e));var A=(a,e)=>{var d={};for(var p in a)M.call(a,p)&&e.indexOf(p)<0&&(d[p]=a[p]);if(a!=null&&C)for(var p of C(a))e.indexOf(p)<0&&P.call(a,p)&&(d[p]=a[p]);return d};var j=(a,e,d)=>(N(a,typeof e!="symbol"?e+"":e,d),d);(function(a,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):(a=typeof globalThis!="undefined"?globalThis:a||self,e(a.index={},a.Vue,a.dom))})(this,function(a,e,d){"use strict";const p={modelValue:{type:Boolean,default:!1},title:{type:String,default:""},lockScroll:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0},beforeClose:{type:Function}},D={name:{type:String,default:"",required:!0},size:{type:String,default:"inherit"},color:{type:String,default:"inherit"},classPrefix:{type:String,default:"icon"}};var L=e.defineComponent({name:"DIcon",props:D,setup(o){const{name:t,size:n,color:i,classPrefix:l}=e.toRefs(o);return()=>/^((https?):)?\/\//.test(t.value)?e.createVNode("img",{src:t.value,alt:t.value.split("/")[t.value.split("/").length-1],style:{width:n.value,verticalAlign:"text-bottom"}},null):e.createVNode("i",{class:`${l.value} ${l.value}-${t.value}`,style:{fontSize:n.value,color:i.value}},null)}}),Z="";function R(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!e.isVNode(o)}const T=e.defineComponent({setup(o,t){return()=>{let n;return e.createVNode(e.Teleport,{to:"#d-overlay-anchor"},{default:()=>[e.createVNode(e.Transition,{name:"devui-overlay-fade"},R(n=e.renderSlot(t.slots,"default"))?n:{default:()=>[n]})]})}}}),_=V(k({},{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}}),z=["update:visible","backdropClick"];function F(o,t){const n=e.computed(()=>["devui-overlay-background",o.backgroundClass,o.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),i=e.computed(()=>"devui-overlay"),l=r=>{var c;r.preventDefault(),(c=o.onBackdropClick)==null||c.call(o),o.backdropClose&&t.emit("update:visible",!1)},u=r=>r.cancelBubble=!0;return e.onMounted(()=>{const r=document.body,c=r.style.overflow,s=r.style.position;e.watch([()=>o.visible,()=>o.backgroundBlock],([m,v])=>{if(v){const f=r.getBoundingClientRect().y;m?(r.style.overflowY="scroll",r.style.position=m?"fixed":"",r.style.top=`${f}px`):(r.style.overflowY=c,r.style.position=s,r.style.top="",window.scrollTo(0,-f))}}),e.onUnmounted(()=>{document.body.style.overflow=c})}),{backgroundClass:n,overlayClass:i,handleBackdropClick:l,handleOverlayBubbleCancel:u}}var te="";const $=e.defineComponent({name:"DFixedOverlay",props:_,emits:z,setup(o,t){const{backgroundClass:n,overlayClass:i,handleBackdropClick:l,handleOverlayBubbleCancel:u}=F(o,t);return()=>e.createVNode(T,null,{default:()=>[o.visible&&e.createVNode("div",{class:n.value,style:o.backgroundStyle,onClick:l},[e.createVNode("div",{class:i.value,style:o.overlayStyle,onClick:u},[e.renderSlot(t.slots,"default")])])]})}}),q={modelValue:{type:Boolean,default:!1},origin:{type:Object,require:!0},position:{type:Array,default:["bottom"]},offset:{type:[Number,Object],default:8},align:{type:String,default:null},showArrow:{type:Boolean,default:!1},isArrowCenter:{type:Boolean,default:!0}};function H(o){const t=/(auto|scroll|hidden)/;for(let n=o;n=n.parentElement;n.parentElement!==document.body){const i=window.getComputedStyle(n);if(t.test(i.overflow+i.overflowX+i.overflowY))return n}return window}function I(o,t,n,i){let{x:l,y:u}=t;if(!o){const{width:r,height:c}=i;l&&n.includes("start")&&(l=12),l&&n.includes("end")&&(l=Math.round(r-24)),u&&n.includes("start")&&(u=10),u&&n.includes("end")&&(u=c-14)}return{x:l,y:u}}function U(o,t){const n=e.ref(),i=e.ref();let l=null;const u=(c,s,m,v)=>{const{x:f,y}=I(o.isArrowCenter,m,s,v.getBoundingClientRect()),b={top:"bottom",right:"left",bottom:"top",left:"right"}[s.split("-")[0]];Object.assign(c.style,{left:f?`${f}px`:"",top:y?`${y}px`:"",right:"",bottom:"",[b]:"-4px"})},r=async()=>{const c=o.origin,s=e.unref(n.value),m=e.unref(i.value),v=[d.shift(),d.offset(o.offset),d.autoPlacement({alignment:o.align,allowedPlacements:o.position})];o.showArrow&&v.push(d.arrow({element:m}));const{x:f,y,placement:b,middlewareData:g}=await d.computePosition(c,s,{strategy:"fixed",middleware:v});t("positionChange",b),Object.assign(s.style,{top:`${y}px`,left:`${f}px`}),o.showArrow&&u(m,b,g.arrow,s)};return e.watch(()=>o.modelValue,()=>{o.modelValue&&o.origin?(l=H(o.origin),e.nextTick(r),l==null||l.addEventListener("scroll",r),l!==window&&window.addEventListener("scroll",r),window.addEventListener("resize",r)):(l==null||l.removeEventListener("scroll",r),l!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r))}),e.onUnmounted(()=>{l==null||l.removeEventListener("scroll",r),l!==window&&window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}),{arrowRef:i,overlayRef:n,updatePosition:r}}var oe="";e.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:q,emits:["update:modelValue","positionChange"],setup(o,{slots:t,attrs:n,emit:i,expose:l}){const{arrowRef:u,overlayRef:r,updatePosition:c}=U(o,i);return l({updatePosition:c}),()=>{var s;return o.modelValue&&e.createVNode("div",e.mergeProps({ref:r,class:"devui-flexible-overlay"},n),[(s=t.default)==null?void 0:s.call(t),o.showArrow&&e.createVNode("div",{ref:u,class:"devui-flexible-overlay-arrow"},null)])}}});const Y=typeof window!="undefined";function K(o,t){function n(){t("update:modelValue",!1)}function i(l){l||(o.beforeClose?o.beforeClose(n):n())}return{handleVisibleChange:i}}var O=e.defineComponent({name:"DModalHeader",setup(o,{slots:t}){return()=>{var n;return e.createVNode("div",{class:"devui-modal-header"},[(n=t.default)==null?void 0:n.call(t)])}}}),x=e.defineComponent({name:"DModalBody",setup(o,{slots:t}){return()=>{var n;return e.createVNode("div",{class:"devui-modal-body"},[(n=t.default)==null?void 0:n.call(t)])}}}),ne="",w=e.defineComponent({name:"DModal",inheritAttrs:!1,props:p,emits:["update:modelValue"],setup(o,{slots:t,attrs:n,emit:i,expose:l}){const{modelValue:u,lockScroll:r,closeOnClickOverlay:c,title:s}=e.toRefs(o),{handleVisibleChange:m}=K(o,i);return l({handleVisibleChange:m}),()=>{const v={visible:u.value,"onUpdate:visible":m,"background-class":"devui-modal-mask","background-block":r.value,"backdrop-close":c.value};return e.createVNode($,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(L,{name:"close",class:"btn-close",size:"var(--devui-font-size-md,12px)",onClick:()=>m(!1)},null),t.header?t.header():s.value&&e.createVNode(O,null,{default:()=>[s.value]}),e.createVNode(x,null,{default:()=>{var y;return[(y=t.default)==null?void 0:y.call(t)]}}),(f=t.footer)==null?void 0:f.call(t)])]}})]})}}}),E=e.defineComponent({name:"DModalFooter",setup(o,{slots:t}){return()=>{var n;return e.createVNode("div",{class:"devui-modal-footer"},[(n=t.default)==null?void 0:n.call(t)])}}});class X{constructor(t){this.anchorContainer=t}renderModal(t,n,i){const l=e.h(this.component(),n,i);return e.render(l,t),l}renderNull(t){setTimeout(()=>{e.render(null,t)},500)}}let h;class B extends X{component(){return w}open(t={}){const n=document.createElement("div");this.anchorContainer.appendChild(n);const v=t,{header:i,content:l,footer:u}=v,r=A(v,["header","content","footer"]),c=(f,y)=>this.renderModal(n,V(k({},f),{modelValue:!0,"onUpdate:modelValue":y}),{header:i,default:l,footer:u}),s=()=>{var y,b,g;const f=S=>{S||s()};c(r,S=>{S?c(r,f):(this.renderModal(n,V(k({},r),{modelValue:!1})),this.renderNull(n))}),(g=(b=(y=h==null?void 0:h.component)==null?void 0:y.exposed)==null?void 0:b.handleVisibleChange)==null||g.call(b,!1)},m=f=>{f||s()};return this.renderModal(n,{modelValue:!1}),h=c(r,m),{hide:s}}}j(B,"token","MODAL_SERVICE_TOKEN");var G={title:"Modal \u5F39\u7A97",category:"\u53CD\u9988",status:"100%",install(o){if(o.component(w.name,w),o.component(O.name,O),o.component(x.name,x),o.component(E.name,E),!Y)return;let t=document.getElementById("d-modal-anchors-container");t||(t=document.createElement("div"),t.setAttribute("id","d-modal-anchors-container"),document.body.appendChild(t)),o.provide(B.token,new B(t))}};a.Modal=w,a.default=G,Object.defineProperty(a,"__esModule",{value:!0}),a[Symbol.toStringTag]="Module"});
|
package/modal/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
@keyframes d-overlay-fade{0%{opacity:0}to{opacity:1}}.devui-overlay-fade-enter{opacity:0}.devui-overlay-fade-enter-active{animation-name:d-overlay-fade;animation-duration:.3s}.devui-overlay-fade-leave{opacity:1}.devui-overlay-fade-leave-active{animation-name:d-overlay-fade;animation-duration:.3s;animation-direction:reverse}.devui-overlay-background{position:fixed;top:0;left:0;height:100vh;width:100vw;display:flex}.devui-overlay-background__color{background:rgba(0,0,0,.4)}.devui-overlay-background .devui-overlay{position:relative;z-index:1000;pointer-events:auto}.devui-overlay-background__disabled{pointer-events:none}.devui-flexible-overlay{position:fixed;border-radius:var(--devui-border-radius, 2px);background-color:var(--devui-connected-overlay-bg, #ffffff);box-shadow:var(--devui-shadow-connected-overlay, 0 2px 8px 0) var(--devui-shadow, rgba(0, 0, 0, .2));z-index:1000}.devui-flexible-overlay-arrow{position:absolute;width:8px;height:8px;transform:rotate(45deg);background-color:inherit}.devui-modal-mask{justify-content:center;align-items:center;background-color:var(--devui-shadow, rgba(0, 0, 0, .2))}.devui-modal{position:relative;width:300px;background-color:var(--devui-global-bg-normal, #ffffff)}.devui-modal .btn-close{position:absolute;right:20px;top:20px;width:20px;height:20px;line-height:20px;text-align:center;color:#000;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.devui-modal .btn-close:hover{color:var(--devui-icon-fill-active-hover, #526ecc);background-color:var(--devui-list-item-hover-bg, #f2f5fc)}.devui-modal-content{background:var(--devui-fullscreen-overlay-bg, #ffffff);border-radius:var(--devui-border-radius, 2px)}.devui-modal-header{width:100%;height:56px;padding:32px 32px 0;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;box-sizing:border-box;border:none;user-select:none}.devui-modal-header .header-alert-icon{display:inline-block;vertical-align:middle;margin-right:8px;line-height:16px;text-align:center}.devui-modal-body{padding:20px 32px;font-size:var(--devui-font-size, 12px);color:var(--devui-text-weak, #575d6c);box-sizing:border-box}.devui-modal-footer{width:100%;border-top:none;text-align:center;padding:0 32px 24px;box-sizing:border-box}.devui-modal-footer>*{margin:0 4px}@keyframes wipe-in-out{0%{opacity:.2;transform:translateY(-24px)}to{opacity:1;transform:translateY(0)}}.devui-modal-wipe-enter-from{opacity:.2}.devui-modal-wipe-enter-active{animation-name:wipe-in-out;animation-duration:.3s}.devui-modal-wipe-leave-to{opacity:1}.devui-modal-wipe-leave-active{animation-name:wipe-in-out;animation-duration:.3s;animation-direction:reverse}
|