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/overlay/index.es.js
CHANGED
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref, unref, nextTick, mergeProps } from "vue";
|
|
21
|
-
import {
|
|
21
|
+
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
22
22
|
var baseOverlay = "";
|
|
23
23
|
function _isSlot(s) {
|
|
24
24
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
@@ -165,6 +165,9 @@ const flexibleOverlayProps = {
|
|
|
165
165
|
type: [Number, Object],
|
|
166
166
|
default: 8
|
|
167
167
|
},
|
|
168
|
+
shiftOffset: {
|
|
169
|
+
type: Number
|
|
170
|
+
},
|
|
168
171
|
align: {
|
|
169
172
|
type: String,
|
|
170
173
|
default: null
|
|
@@ -210,6 +213,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
210
213
|
function useOverlay(props, emit) {
|
|
211
214
|
const overlayRef = ref();
|
|
212
215
|
const arrowRef = ref();
|
|
216
|
+
let originParent = null;
|
|
213
217
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
214
218
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
215
219
|
const staticSide = {
|
|
@@ -231,7 +235,6 @@ function useOverlay(props, emit) {
|
|
|
231
235
|
const overlayEl = unref(overlayRef.value);
|
|
232
236
|
const arrowEl = unref(arrowRef.value);
|
|
233
237
|
const middleware = [
|
|
234
|
-
shift(),
|
|
235
238
|
offset(props.offset),
|
|
236
239
|
autoPlacement({
|
|
237
240
|
alignment: props.align,
|
|
@@ -239,30 +242,39 @@ function useOverlay(props, emit) {
|
|
|
239
242
|
})
|
|
240
243
|
];
|
|
241
244
|
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
245
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
242
246
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
243
247
|
strategy: "fixed",
|
|
244
248
|
middleware
|
|
245
249
|
});
|
|
250
|
+
let applyX = x;
|
|
251
|
+
let applyY = y;
|
|
252
|
+
if (props.shiftOffset !== void 0) {
|
|
253
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
254
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
255
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
256
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
257
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
258
|
+
}
|
|
246
259
|
emit("positionChange", placement);
|
|
247
|
-
Object.assign(overlayEl.style, { top: `${
|
|
260
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
248
261
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
249
262
|
};
|
|
250
263
|
watch(() => props.modelValue, () => {
|
|
251
|
-
const originParent = getScrollParent(props.origin);
|
|
252
264
|
if (props.modelValue && props.origin) {
|
|
265
|
+
originParent = getScrollParent(props.origin);
|
|
253
266
|
nextTick(updatePosition);
|
|
254
|
-
originParent.addEventListener("scroll", updatePosition);
|
|
267
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
255
268
|
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
256
269
|
window.addEventListener("resize", updatePosition);
|
|
257
270
|
} else {
|
|
258
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
271
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
259
272
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
260
273
|
window.removeEventListener("resize", updatePosition);
|
|
261
274
|
}
|
|
262
275
|
});
|
|
263
276
|
onUnmounted(() => {
|
|
264
|
-
|
|
265
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
277
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
266
278
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
267
279
|
window.removeEventListener("resize", updatePosition);
|
|
268
280
|
});
|
package/overlay/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var z=Object.defineProperty,D=Object.defineProperties;var M=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var A=(l,t,a)=>t in l?z(l,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[t]=a,j=(l,t)=>{for(var a in t||(t={}))q.call(t,a)&&A(l,a,t[a]);if(V)for(var a of V(t))X.call(t,a)&&A(l,a,t[a]);return l},P=(l,t)=>D(l,M(t));(function(l,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue"),require("@floating-ui/dom")):typeof define=="function"&&define.amd?define(["exports","vue","@floating-ui/dom"],t):(l=typeof globalThis!="undefined"?globalThis:l||self,t(l.index={},l.Vue,l.dom))})(this,function(l,t,a){"use strict";var I="";function L(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const N=t.defineComponent({setup(e,i){return()=>{let r;return t.createVNode(t.Teleport,{to:"#d-overlay-anchor"},{default:()=>[t.createVNode(t.Transition,{name:"devui-overlay-fade"},L(r=t.renderSlot(i.slots,"default"))?r:{default:()=>[r]})]})}}}),p={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}},k=P(j({},p),{overlayStyle:{type:[String,Object],default:void 0}}),C=["update:visible","backdropClick"];function F(e,i){const r=t.computed(()=>["devui-overlay-background",e.backgroundClass,e.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),d=t.computed(()=>"devui-overlay"),n=o=>{var c;o.preventDefault(),(c=e.onBackdropClick)==null||c.call(e),e.backdropClose&&i.emit("update:visible",!1)},s=o=>o.cancelBubble=!0;return t.onMounted(()=>{const o=document.body,c=o.style.overflow,f=o.style.position;t.watch([()=>e.visible,()=>e.backgroundBlock],([u,y])=>{if(y){const v=o.getBoundingClientRect().y;u?(o.style.overflowY="scroll",o.style.position=u?"fixed":"",o.style.top=`${v}px`):(o.style.overflowY=c,o.style.position=f,o.style.top="",window.scrollTo(0,-v))}}),t.onUnmounted(()=>{document.body.style.overflow=c})}),{backgroundClass:r,overlayClass:d,handleBackdropClick:n,handleOverlayBubbleCancel:s}}var U="";const m=t.defineComponent({name:"DFixedOverlay",props:k,emits:C,setup(e,i){const{backgroundClass:r,overlayClass:d,handleBackdropClick:n,handleOverlayBubbleCancel:s}=F(e,i);return()=>t.createVNode(N,null,{default:()=>[e.visible&&t.createVNode("div",{class:r.value,style:e.backgroundStyle,onClick:n},[t.createVNode("div",{class:d.value,style:e.overlayStyle,onClick:s},[t.renderSlot(i.slots,"default")])])]})}}),x={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 _(e){const i=/(auto|scroll|hidden)/;for(let r=e;r=r.parentElement;r.parentElement!==document.body){const d=window.getComputedStyle(r);if(i.test(d.overflow+d.overflowX+d.overflowY))return r}return window}function R(e,i,r,d){let{x:n,y:s}=i;if(!e){const{width:o,height:c}=d;n&&r.includes("start")&&(n=12),n&&r.includes("end")&&(n=Math.round(o-24)),s&&r.includes("start")&&(s=10),s&&r.includes("end")&&(s=c-14)}return{x:n,y:s}}function T(e,i){const r=t.ref(),d=t.ref();let n=null;const s=(c,f,u,y)=>{const{x:v,y:w}=R(e.isArrowCenter,u,f,y.getBoundingClientRect()),b={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]];Object.assign(c.style,{left:v?`${v}px`:"",top:w?`${w}px`:"",right:"",bottom:"",[b]:"-4px"})},o=async()=>{const c=e.origin,f=t.unref(r.value),u=t.unref(d.value),y=[a.offset(e.offset),a.autoPlacement({alignment:e.align,allowedPlacements:e.position})];e.showArrow&&y.push(a.arrow({element:u})),e.shiftOffset!==void 0&&y.push(a.shift());const{x:v,y:w,placement:b,middlewareData:B}=await a.computePosition(c,f,{strategy:"fixed",middleware:y});let g=v,O=w;if(e.shiftOffset!==void 0){const{x:E,y:S}=B.shift;E<0&&(g-=e.shiftOffset),E>0&&(g+=e.shiftOffset),S<0&&(O-=e.shiftOffset),S>0&&(O+=e.shiftOffset)}i("positionChange",b),Object.assign(f.style,{top:`${O}px`,left:`${g}px`}),e.showArrow&&s(u,b,B.arrow,f)};return t.watch(()=>e.modelValue,()=>{e.modelValue&&e.origin?(n=_(e.origin),t.nextTick(o),n==null||n.addEventListener("scroll",o),n!==window&&window.addEventListener("scroll",o),window.addEventListener("resize",o)):(n==null||n.removeEventListener("scroll",o),n!==window&&window.removeEventListener("scroll",o),window.removeEventListener("resize",o))}),t.onUnmounted(()=>{n==null||n.removeEventListener("scroll",o),n!==window&&window.removeEventListener("scroll",o),window.removeEventListener("resize",o)}),{arrowRef:d,overlayRef:r,updatePosition:o}}var G="";const h=t.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:x,emits:["update:modelValue","positionChange"],setup(e,{slots:i,attrs:r,emit:d,expose:n}){const{arrowRef:s,overlayRef:o,updatePosition:c}=T(e,d);return n({updatePosition:c}),()=>{var f;return e.modelValue&&t.createVNode("div",t.mergeProps({ref:o,class:"devui-flexible-overlay"},r),[(f=i.default)==null?void 0:f.call(i),e.showArrow&&t.createVNode("div",{ref:s,class:"devui-flexible-overlay-arrow"},null)])}}}),Y=typeof window!="undefined";var $={title:"Overlay \u906E\u7F69\u5C42",category:"\u901A\u7528",status:"100%",install(e){if(e.component(m.name,m),e.component(h.name,h),Y&&!document.getElementById("d-overlay-anchor")){const i=document.createElement("div");i.setAttribute("id","d-overlay-anchor"),i.style.position="fixed",i.style.left="0",i.style.top="0",i.style.zIndex="1000",document.body.appendChild(i)}}};l.FixedOverlay=m,l.FlexibleOverlay=h,l.default=$,l.fixedOverlayProps=k,l.flexibleOverlayProps=x,l.overlayEmits=C,l.overlayProps=p,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-devui",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "DevUI components based on Vite and Vue3",
|
|
6
6
|
"keywords": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"style": "style.css",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@devui-design/icons": "^1.3.0",
|
|
28
|
-
"@floating-ui/dom": "^0.4.
|
|
28
|
+
"@floating-ui/dom": "^0.4.4",
|
|
29
29
|
"@types/lodash-es": "^4.17.4",
|
|
30
30
|
"@vueuse/core": "^7.7.1",
|
|
31
31
|
"async-validator": "^4.0.2",
|
package/pagination/index.es.js
CHANGED
|
@@ -279,25 +279,25 @@ var JumpPage = defineComponent({
|
|
|
279
279
|
totalPages,
|
|
280
280
|
cursor
|
|
281
281
|
} = toRefs(props);
|
|
282
|
-
const inputNum = ref(pageIndex.value);
|
|
283
|
-
watch(() => pageIndex.value, (val) => {
|
|
282
|
+
const inputNum = ref(pageIndex == null ? void 0 : pageIndex.value);
|
|
283
|
+
watch(() => pageIndex == null ? void 0 : pageIndex.value, (val) => {
|
|
284
284
|
inputNum.value = val;
|
|
285
285
|
});
|
|
286
|
-
let curPage = pageIndex.value;
|
|
286
|
+
let curPage = pageIndex == null ? void 0 : pageIndex.value;
|
|
287
287
|
const jumpPageChange = (currentPage) => {
|
|
288
288
|
curPage = +currentPage;
|
|
289
289
|
inputNum.value = currentPage;
|
|
290
290
|
if (isNaN(currentPage)) {
|
|
291
291
|
setTimeout(() => {
|
|
292
|
-
inputNum.value = pageIndex.value;
|
|
292
|
+
inputNum.value = pageIndex == null ? void 0 : pageIndex.value;
|
|
293
293
|
}, 300);
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
const jump = (e) => {
|
|
297
|
-
if (curPage > totalPages.value) {
|
|
297
|
+
if (curPage > (totalPages == null ? void 0 : totalPages.value)) {
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
|
-
if ((e === "btn" || e.key === "Enter") && cursor.value !== curPage) {
|
|
300
|
+
if ((e === "btn" || e.key === "Enter") && (cursor == null ? void 0 : cursor.value) !== curPage) {
|
|
301
301
|
emit("changeCursorEmit", curPage);
|
|
302
302
|
}
|
|
303
303
|
};
|
|
@@ -316,17 +316,18 @@ var JumpPage = defineComponent({
|
|
|
316
316
|
jump,
|
|
317
317
|
showJumpButton
|
|
318
318
|
} = this;
|
|
319
|
+
const inputProps = {
|
|
320
|
+
class: ["devui-pagination-input", size ? "devui-pagination-input-" + size : ""],
|
|
321
|
+
size,
|
|
322
|
+
modelValue: String(inputNum),
|
|
323
|
+
"onUpdate:modelValue": jumpPageChange,
|
|
324
|
+
onKeydown: jump
|
|
325
|
+
};
|
|
319
326
|
return createVNode("div", {
|
|
320
327
|
"class": "devui-jump-container"
|
|
321
328
|
}, [
|
|
322
329
|
goToText,
|
|
323
|
-
createVNode(resolveComponent("d-input"),
|
|
324
|
-
"class": ["devui-pagination-input", size ? "devui-pagination-input-" + size : ""],
|
|
325
|
-
"size": size,
|
|
326
|
-
"modelValue": String(inputNum),
|
|
327
|
-
"onUpdate:modelValue": jumpPageChange,
|
|
328
|
-
"onKeydown": jump
|
|
329
|
-
}, null),
|
|
330
|
+
createVNode(resolveComponent("d-input"), inputProps, null),
|
|
330
331
|
goToText === "\u8DF3\u81F3" && "\u9875",
|
|
331
332
|
showJumpButton && createVNode("div", {
|
|
332
333
|
"class": ["devui-jump-button", size ? "devui-jump-size-" + size : "devui-jump-size-default"],
|
package/pagination/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(d,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(d=typeof globalThis!="undefined"?globalThis:d||self,e(d.index={},d.Vue))})(this,function(d,e){"use strict";const y={pageSize:{type:Number,default:10},total:{type:Number,default:0},pageSizeOptions:{type:Array,default:()=>[5,10,20,50]},pageSizeDirection:{type:Array,default:()=>["centerDown","centerUp"]},pageIndex:{type:Number,default:1},maxItems:{type:Number,default:10},preLink:{type:String,default:"<"},nextLink:{type:String,default:">"},size:{type:String,default:""},canJumpPage:{type:Boolean,default:!1},canChangePageSize:{type:Boolean,default:!1},canViewTotal:{type:Boolean,default:!1},totalItemText:{type:String,default:"\u6240\u6709\u6761\u76EE"},goToText:{type:String,default:"\u8DF3\u81F3"},showJumpButton:{type:Boolean,default:!1},showTruePageIndex:{type:Boolean,default:!1},lite:{type:Boolean,default:!1},showPageSelector:{type:Boolean,default:!0},haveConfigMenu:{type:Boolean,default:!1},autoFixPageIndex:{type:Boolean,default:!0},autoHide:{type:Boolean,default:!1},"onUpdate:pageIndex":{type:Function},"onUpdate:pageSize":{type:Function},onPageIndexChange:{type:Function},onPageSizeChange:{type:Function}},F=(t,a,n)=>{const r=t,s=a;if(s>=n)return[2,n];const o=s-2;let i=r-(o>>1),c=r+(o-1>>1);return i<2&&(i=2,c=s-2),c>n&&(i=n-s+3,c=n),[i,c]};function L(t){return new Array(t||1).fill(0).map((a,n)=>({name:`${n+1}/${t}`,value:n+1}))}function C(t,a,n){document.addEventListener?t&&a&&n&&t.addEventListener(a,n,!1):t&&a&&n&&t.attachEvent("on"+a,n)}function j(t,a,n){document.removeEventListener?t&&a&&n&&t.removeEventListener(a,n,!1):t&&a&&n&&t.detachEvent("on"+a,n)}const M=typeof window!="undefined",g=Symbol("@@clickoutside"),h=new Map;let z,N=0,b=!0;function k(t,a,n){return M&&b&&(b=!1,C(document,"mousedown",r=>{z=r}),C(document,"mouseup",r=>{for(const[s,o]of h)o[g].documentHandler(r,z)})),function(r,s){!n||!a.instance||!r.target||!s.target||t.contains(r.target)||t.contains(s.target)||t===r.target||t[g].bindingFn&&t[g].bindingFn()}}const D={beforeMount:function(t,a,n){N++,h.set(N,t),t[g]={nid:N,documentHandler:k(t,a,n),bindingFn:a.value}},updated:function(t,a,n){t[g].documentHandler=k(t,a,n),t[g].bindingFn=a.value},unmounted:function(t){h.delete(t[g].nid),delete t[g]}};var H=e.defineComponent({directives:{clickoutside:D},props:{currentPageSize:Number,pageSizeChange:Function,pageSizeOptions:Array},setup(){const t=e.ref(null),a=e.ref(!1),n=r=>{a.value=a.value?!1:!!r};return e.onMounted(()=>{C(t.value,"click",n)}),e.onUnmounted(()=>{j(t.value,"click",n)}),{paginationConfig:t,isShowConfig:a,closeConfigMenu:n}},render(){var i;const{closeConfigMenu:t,currentPageSize:a,pageSizeChange:n,pageSizeOptions:r,isShowConfig:s,$slots:o}=this;return e.withDirectives(e.createVNode("div",{class:"devui-pagination-config",ref:"paginationConfig"},[e.createVNode("div",{class:"devui-setup-icon"},[e.createVNode("i",{class:"icon-setting",style:"font-weight: bold;"},null)]),s&&e.createVNode("div",{class:"devui-config-container"},[(i=o.default)==null?void 0:i.call(o),e.createVNode("div",{class:"pagination-config-item"},[e.createVNode("div",{class:"config-item-title"},[e.createTextVNode("\u6BCF\u9875\u6761\u6570")]),e.createVNode("div",{class:"devui-page-number"},[r.map(c=>e.createVNode("div",{class:{choosed:c===a},key:c,onClick:n.bind(null,{value:c})},[c]))])])])]),[[e.resolveDirective("clickoutside"),t]])}});const O={goToText:String,size:{type:String,default:""},pageIndex:Number,showJumpButton:Boolean,totalPages:Number,cursor:Number,onChangeCursorEmit:Function};var J=e.defineComponent({props:O,emits:["changeCursorEmit"],setup(t,{emit:a}){const{pageIndex:n,totalPages:r,cursor:s}=e.toRefs(t),o=e.ref(n==null?void 0:n.value);e.watch(()=>n==null?void 0:n.value,l=>{o.value=l});let i=n==null?void 0:n.value;return{inputNum:o,jumpPageChange:l=>{i=+l,o.value=l,isNaN(l)&&setTimeout(()=>{o.value=n==null?void 0:n.value},300)},jump:l=>{i>(r==null?void 0:r.value)||(l==="btn"||l.key==="Enter")&&(s==null?void 0:s.value)!==i&&a("changeCursorEmit",i)}}},render(){const{goToText:t,size:a,inputNum:n,jumpPageChange:r,jump:s,showJumpButton:o}=this,i={class:["devui-pagination-input",a?"devui-pagination-input-"+a:""],size:a,modelValue:String(n),"onUpdate:modelValue":r,onKeydown:s};return e.createVNode("div",{class:"devui-jump-container"},[t,e.createVNode(e.resolveComponent("d-input"),i,null),t==="\u8DF3\u81F3"&&"\u9875",o&&e.createVNode("div",{class:["devui-jump-button",a?"devui-jump-size-"+a:"devui-jump-size-default"],onClick:s.bind(null,"btn"),title:t},[e.createVNode("div",{class:"devui-pagination-go"},null)])])}});const A={size:{type:String,default:""},preLink:String,nextLink:String,lite:Boolean,cursor:Number,maxItems:Number,totalPages:Number,onChangeCursorEmit:Function,showTruePageIndex:Boolean};var U=e.defineComponent({props:A,emits:["changeCursorEmit"],setup(t,{emit:a}){return{showPageNum:e.computed(()=>F(t.cursor,t.maxItems,t.totalPages)),changeCursor:i=>{if(isNaN(i))return;const c=i<1?1:i>t.totalPages?t.totalPages:i|0;a("changeCursorEmit",c)},prevChange:i=>{if(t.cursor>1){const c=i===-1?t.cursor-1:i;a("changeCursorEmit",c)}},nextChange:i=>{if(t.cursor<t.totalPages){const c=i===-1?t.cursor+1:i;a("changeCursorEmit",c)}}}},render(){const{size:t,preLink:a,nextLink:n,lite:r,changeCursor:s,cursor:o,showPageNum:i,prevChange:c,totalPages:u,nextChange:l,showTruePageIndex:P}=this;return e.createVNode("ul",{class:["devui-pagination-list",t?"devui-pagination-"+t:""]},[e.createVNode("li",{onClick:c.bind(null,-1),class:{"devui-pagination-item":!0,disabled:o<=1}},[e.createVNode("a",{innerHTML:a,class:"devui-pagination-link"},null)]),!r&&e.createVNode(e.Fragment,null,[e.createVNode("li",{onClick:s.bind(null,1),class:{"devui-pagination-item":!0,active:o===1}},[e.createVNode("a",{class:"devui-pagination-link"},[e.createTextVNode("1")])]),i[0]>2&&e.createVNode("li",{onClick:c.bind(null,i[0]-1),class:"devui-pagination-item"},[e.createVNode("a",{class:"devui-pagination-link"},[e.createTextVNode("...")])]),(()=>{const m=[];for(let p=i[0];p<=i[1];p++)m.push(e.createVNode("li",{onClick:s.bind(null,p),key:p,class:{"devui-pagination-item":!0,active:o===p}},[e.createVNode("a",{class:"devui-pagination-link"},[p])]));return m})(),i[1]<u-1&&e.createVNode("li",{onClick:l.bind(null,i[1]+1),class:"devui-pagination-item"},[e.createVNode("a",{class:"devui-pagination-link"},[e.createTextVNode("...")])]),i[1]<u&&e.createVNode("li",{onClick:s.bind(null,u),class:{"devui-pagination-item":!0,active:o===u}},[e.createVNode("a",{class:"devui-pagination-link"},[u])]),P&&o>u&&u>0&&e.createVNode(e.Fragment,null,[o>u+1&&e.createVNode("li",{class:"devui-pagination-item disabled"},[e.createVNode("a",{class:"devui-pagination-link"},[e.createTextVNode("...")])]),e.createVNode("li",{class:"devui-pagination-item disabled active"},[e.createVNode("a",{class:"devui-pagination-link"},[o])])])]),e.createVNode("li",{onClick:l.bind(null,-1),class:{"devui-pagination-item":!0,disabled:o>=u}},[e.createVNode("a",{innerHTML:n,class:"devui-pagination-link"},null)])])}}),X="",V=e.defineComponent({name:"DPagination",components:{ConfigMenu:H,JumpPage:J,PageNumBtn:U},props:y,emits:["pageIndexChange","pageSizeChange","update:pageSize","update:pageIndex"],setup(t,{emit:a}){const n=e.computed(()=>Math.ceil(t.total/t.pageSize)),r=e.computed(()=>L(n.value)),s=e.computed({get(){return!t.showTruePageIndex&&t.pageIndex>n.value?(a("update:pageIndex",n.value||1),n.value||1):t.pageIndex||1},set(l){a("update:pageIndex",l)}}),o=e.computed({get(){return t.pageSize},set(l){a("update:pageSize",l)}}),i=l=>{s.value=l,a("pageIndexChange",l)};return{cursor:s,totalPages:n,changeCursorEmit:i,currentPageSize:o,pageSizeChange:l=>{o.value=l.value,t.autoFixPageIndex&&e.nextTick(()=>{s.value>n.value&&i(n.value)}),a("pageSizeChange",l.value)},litePageOptions:r,litePageIndexChange:l=>{i(l.value)}}},render(){const{total:t,pageIndex:a,pageSizeOptions:n,pageSizeDirection:r,preLink:s,nextLink:o,size:i,canJumpPage:c,canChangePageSize:u,canViewTotal:l,totalItemText:P,goToText:m,maxItems:p,showJumpButton:q,showTruePageIndex:K,lite:f,showPageSelector:v,haveConfigMenu:R,autoHide:G,$slots:S,cursor:x,totalPages:T,currentPageSize:w,pageSizeChange:B,changeCursorEmit:E,litePageOptions:Q,litePageIndexChange:W}=this;return G&&Math.min(...n)>t?null:e.createVNode("div",{class:"devui-pagination"},[u&&!f&&e.createVNode("div",{class:["devui-page-size",i?"devui-page-size-"+i:""]},[e.createVNode(e.resolveComponent("d-select"),{options:n,modelValue:w,onValueChange:B,pageSizeDirection:r},null)]),(!f||f&&v)&&l&&e.createVNode("div",{class:"devui-total-size"},[P,e.createTextVNode(": "),t]),f&&v&&e.createVNode("div",{class:"devui-page-size"},[e.createVNode(e.resolveComponent("d-select"),{options:Q,disabled:t===0,modelValue:x,onValueChange:W,pageSizeDirection:r},null)]),e.createVNode(e.resolveComponent("page-num-btn"),e.mergeProps({cursor:x,totalPages:T,size:i,lite:f,maxItems:p,preLink:s,nextLink:o,showTruePageIndex:K},{onChangeCursorEmit:E}),null),c&&!f&&e.createVNode(e.resolveComponent("jump-page"),e.mergeProps({goToText:m,size:i,pageIndex:a,totalPages:T,cursor:x,showJumpButton:q},{onChangeCursorEmit:E}),null),f&&R&&e.createVNode(e.resolveComponent("config-menu"),{currentPageSize:w,pageSizeChange:B,pageSizeOptions:n},{default:()=>{var I;return[(I=S.default)==null?void 0:I.call(S)]}})])}}),_={title:"Pagination \u5206\u9875",category:"\u5BFC\u822A",status:"100%",install(t){t.component(V.name,V)}};d.Pagination=V,d.default=_,d.paginationProps=y,Object.defineProperty(d,"__esModule",{value:!0}),d[Symbol.toStringTag]="Module"});
|
package/popover/index.es.js
CHANGED
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, ref, unref, nextTick, mergeProps, toRefs, Fragment } from "vue";
|
|
21
|
-
import {
|
|
21
|
+
import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
|
|
22
22
|
var baseOverlay = "";
|
|
23
23
|
function _isSlot(s) {
|
|
24
24
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
@@ -165,6 +165,9 @@ const flexibleOverlayProps = {
|
|
|
165
165
|
type: [Number, Object],
|
|
166
166
|
default: 8
|
|
167
167
|
},
|
|
168
|
+
shiftOffset: {
|
|
169
|
+
type: Number
|
|
170
|
+
},
|
|
168
171
|
align: {
|
|
169
172
|
type: String,
|
|
170
173
|
default: null
|
|
@@ -210,6 +213,7 @@ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
|
|
|
210
213
|
function useOverlay(props, emit) {
|
|
211
214
|
const overlayRef = ref();
|
|
212
215
|
const arrowRef = ref();
|
|
216
|
+
let originParent = null;
|
|
213
217
|
const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
|
|
214
218
|
const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
|
|
215
219
|
const staticSide = {
|
|
@@ -231,7 +235,6 @@ function useOverlay(props, emit) {
|
|
|
231
235
|
const overlayEl = unref(overlayRef.value);
|
|
232
236
|
const arrowEl = unref(arrowRef.value);
|
|
233
237
|
const middleware = [
|
|
234
|
-
shift(),
|
|
235
238
|
offset(props.offset),
|
|
236
239
|
autoPlacement({
|
|
237
240
|
alignment: props.align,
|
|
@@ -239,30 +242,39 @@ function useOverlay(props, emit) {
|
|
|
239
242
|
})
|
|
240
243
|
];
|
|
241
244
|
props.showArrow && middleware.push(arrow({ element: arrowEl }));
|
|
245
|
+
props.shiftOffset !== void 0 && middleware.push(shift());
|
|
242
246
|
const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
|
|
243
247
|
strategy: "fixed",
|
|
244
248
|
middleware
|
|
245
249
|
});
|
|
250
|
+
let applyX = x;
|
|
251
|
+
let applyY = y;
|
|
252
|
+
if (props.shiftOffset !== void 0) {
|
|
253
|
+
const { x: shiftX, y: shiftY } = middlewareData.shift;
|
|
254
|
+
shiftX < 0 && (applyX -= props.shiftOffset);
|
|
255
|
+
shiftX > 0 && (applyX += props.shiftOffset);
|
|
256
|
+
shiftY < 0 && (applyY -= props.shiftOffset);
|
|
257
|
+
shiftY > 0 && (applyY += props.shiftOffset);
|
|
258
|
+
}
|
|
246
259
|
emit("positionChange", placement);
|
|
247
|
-
Object.assign(overlayEl.style, { top: `${
|
|
260
|
+
Object.assign(overlayEl.style, { top: `${applyY}px`, left: `${applyX}px` });
|
|
248
261
|
props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
|
|
249
262
|
};
|
|
250
263
|
watch(() => props.modelValue, () => {
|
|
251
|
-
const originParent = getScrollParent(props.origin);
|
|
252
264
|
if (props.modelValue && props.origin) {
|
|
265
|
+
originParent = getScrollParent(props.origin);
|
|
253
266
|
nextTick(updatePosition);
|
|
254
|
-
originParent.addEventListener("scroll", updatePosition);
|
|
267
|
+
originParent == null ? void 0 : originParent.addEventListener("scroll", updatePosition);
|
|
255
268
|
originParent !== window && window.addEventListener("scroll", updatePosition);
|
|
256
269
|
window.addEventListener("resize", updatePosition);
|
|
257
270
|
} else {
|
|
258
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
271
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
259
272
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
260
273
|
window.removeEventListener("resize", updatePosition);
|
|
261
274
|
}
|
|
262
275
|
});
|
|
263
276
|
onUnmounted(() => {
|
|
264
|
-
|
|
265
|
-
originParent.removeEventListener("scroll", updatePosition);
|
|
277
|
+
originParent == null ? void 0 : originParent.removeEventListener("scroll", updatePosition);
|
|
266
278
|
originParent !== window && window.removeEventListener("scroll", updatePosition);
|
|
267
279
|
window.removeEventListener("resize", updatePosition);
|
|
268
280
|
});
|