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.
Files changed (174) hide show
  1. package/README.md +9 -0
  2. package/auto-complete/index.es.js +132 -58
  3. package/auto-complete/index.umd.js +5 -3
  4. package/auto-complete/style.css +1 -1
  5. package/avatar/index.es.js +77 -81
  6. package/avatar/index.umd.js +1 -1
  7. package/button/index.es.js +23 -15
  8. package/button/index.umd.js +1 -1
  9. package/button/style.css +1 -1
  10. package/card/index.es.js +3 -6
  11. package/card/index.umd.js +1 -1
  12. package/checkbox/index.es.js +5 -11
  13. package/checkbox/index.umd.js +1 -1
  14. package/comment/index.es.js +4 -6
  15. package/comment/index.umd.js +1 -1
  16. package/countdown/index.es.js +3 -6
  17. package/countdown/index.umd.js +1 -1
  18. package/{tag-input → date-picker}/index.d.ts +0 -0
  19. package/date-picker/index.es.js +1151 -0
  20. package/date-picker/index.umd.js +1 -0
  21. package/date-picker/package.json +7 -0
  22. package/date-picker/style.css +1 -0
  23. package/drawer/index.d.ts +7 -0
  24. package/drawer/index.es.js +236 -0
  25. package/drawer/index.umd.js +1 -0
  26. package/{tag-input → drawer}/package.json +1 -1
  27. package/drawer/style.css +1 -0
  28. package/dropdown/index.d.ts +7 -0
  29. package/dropdown/index.es.js +716 -0
  30. package/dropdown/index.umd.js +1 -0
  31. package/dropdown/package.json +7 -0
  32. package/dropdown/style.css +1 -0
  33. package/editable-select/index.es.js +2 -5
  34. package/editable-select/index.umd.js +1 -1
  35. package/form/index.d.ts +7 -0
  36. package/form/index.es.js +7888 -0
  37. package/form/index.umd.js +27 -0
  38. package/form/package.json +7 -0
  39. package/form/style.css +1 -0
  40. package/grid/index.es.js +30 -36
  41. package/grid/index.umd.js +1 -1
  42. package/image-preview/index.es.js +19 -19
  43. package/image-preview/index.umd.js +1 -1
  44. package/input/index.es.js +2 -5
  45. package/input/index.umd.js +1 -1
  46. package/input-number/index.d.ts +7 -0
  47. package/input-number/index.es.js +229 -0
  48. package/input-number/index.umd.js +1 -0
  49. package/input-number/package.json +7 -0
  50. package/input-number/style.css +1 -0
  51. package/layout/index.es.js +9 -22
  52. package/layout/index.umd.js +1 -1
  53. package/loading/index.es.js +40 -25
  54. package/loading/index.umd.js +1 -1
  55. package/modal/index.es.js +70 -50
  56. package/modal/index.umd.js +1 -1
  57. package/notification/index.es.js +100 -10
  58. package/notification/index.umd.js +1 -1
  59. package/notification/style.css +1 -1
  60. package/nuxt/components/Column.js +3 -0
  61. package/nuxt/components/DatePicker.js +3 -0
  62. package/nuxt/components/Drawer.js +3 -0
  63. package/nuxt/components/DrawerService.js +3 -0
  64. package/nuxt/components/Dropdown.js +3 -0
  65. package/nuxt/components/DropdownMenu.js +3 -0
  66. package/nuxt/components/DropdownPropsKey.js +3 -0
  67. package/nuxt/components/Form.js +3 -0
  68. package/nuxt/components/FormControl.js +3 -0
  69. package/nuxt/components/FormItem.js +3 -0
  70. package/nuxt/components/FormLabel.js +3 -0
  71. package/nuxt/components/FormOperation.js +3 -0
  72. package/nuxt/components/InputNumber.js +3 -0
  73. package/nuxt/components/LoadingOptions.js +3 -0
  74. package/nuxt/components/Select.js +3 -0
  75. package/nuxt/components/StickSlider.js +3 -0
  76. package/nuxt/components/Tab.js +3 -0
  77. package/nuxt/components/Table.js +3 -0
  78. package/nuxt/components/Tabs.js +3 -0
  79. package/nuxt/components/Tooltip.js +3 -0
  80. package/nuxt/components/autoCompleteProps.js +3 -0
  81. package/nuxt/components/avatarProps.js +3 -0
  82. package/nuxt/components/cardProps.js +3 -0
  83. package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
  84. package/nuxt/components/checkboxGroupProps.js +3 -0
  85. package/nuxt/components/checkboxProps.js +3 -0
  86. package/nuxt/components/colProps.js +3 -0
  87. package/nuxt/components/colPropsBaseClass.js +3 -0
  88. package/nuxt/components/colPropsBaseStyle.js +3 -0
  89. package/nuxt/components/commentProps.js +3 -0
  90. package/nuxt/components/countdownProps.js +3 -0
  91. package/nuxt/components/dropdownMenuProps.js +3 -0
  92. package/nuxt/components/editableSelectProps.js +3 -0
  93. package/nuxt/components/imagePreviewProps.js +3 -0
  94. package/nuxt/components/inputProps.js +3 -0
  95. package/nuxt/components/loadingProps.js +3 -0
  96. package/nuxt/components/modalProps.js +3 -0
  97. package/nuxt/components/progressProps.js +3 -0
  98. package/nuxt/components/rateProps.js +3 -0
  99. package/nuxt/components/readTipProps.js +3 -0
  100. package/nuxt/components/resultProps.js +3 -0
  101. package/nuxt/components/rowProps.js +3 -0
  102. package/nuxt/components/screenSizes.js +3 -0
  103. package/nuxt/components/skeletonProps.js +3 -0
  104. package/nuxt/components/sliderProps.js +3 -0
  105. package/nuxt/components/splitterProps.js +3 -0
  106. package/nuxt/components/statisticProps.js +3 -0
  107. package/nuxt/components/switchProps.js +3 -0
  108. package/nuxt/components/tabsProps.js +3 -0
  109. package/nuxt/components/textareaProps.js +3 -0
  110. package/nuxt/components/timeAxisProps.js +3 -0
  111. package/nuxt/components/tooltipProps.js +3 -0
  112. package/overlay/index.es.js +20 -8
  113. package/overlay/index.umd.js +1 -1
  114. package/package.json +2 -2
  115. package/pagination/index.es.js +14 -13
  116. package/pagination/index.umd.js +1 -1
  117. package/popover/index.es.js +20 -8
  118. package/popover/index.umd.js +12 -12
  119. package/progress/index.es.js +33 -35
  120. package/progress/index.umd.js +3 -3
  121. package/rate/index.es.js +31 -41
  122. package/rate/index.umd.js +1 -1
  123. package/read-tip/index.es.js +34 -34
  124. package/read-tip/index.umd.js +1 -1
  125. package/read-tip/style.css +1 -1
  126. package/result/index.es.js +2 -5
  127. package/result/index.umd.js +1 -1
  128. package/search/index.es.js +11 -11
  129. package/search/index.umd.js +8 -8
  130. package/select/index.d.ts +7 -0
  131. package/select/index.es.js +696 -0
  132. package/select/index.umd.js +1 -0
  133. package/select/package.json +7 -0
  134. package/select/style.css +1 -0
  135. package/skeleton/index.es.js +9 -12
  136. package/skeleton/index.umd.js +1 -1
  137. package/slider/index.es.js +1 -4
  138. package/slider/index.umd.js +1 -1
  139. package/splitter/index.es.js +23 -14
  140. package/splitter/index.umd.js +15 -15
  141. package/statistic/index.es.js +7 -18
  142. package/statistic/index.umd.js +1 -1
  143. package/style.css +1 -1
  144. package/switch/index.es.js +4 -7
  145. package/switch/index.umd.js +1 -1
  146. package/switch/style.css +1 -1
  147. package/table/index.d.ts +7 -0
  148. package/table/index.es.js +2376 -0
  149. package/table/index.umd.js +1 -0
  150. package/table/package.json +7 -0
  151. package/table/style.css +1 -0
  152. package/tabs/index.d.ts +7 -0
  153. package/tabs/index.es.js +194 -0
  154. package/tabs/index.umd.js +1 -0
  155. package/tabs/package.json +7 -0
  156. package/tabs/style.css +1 -0
  157. package/textarea/index.es.js +2 -5
  158. package/textarea/index.umd.js +1 -1
  159. package/timeline/index.es.js +10 -16
  160. package/timeline/index.umd.js +1 -1
  161. package/tooltip/index.d.ts +7 -0
  162. package/tooltip/index.es.js +5847 -0
  163. package/tooltip/index.umd.js +27 -0
  164. package/tooltip/package.json +7 -0
  165. package/tooltip/style.css +1 -0
  166. package/upload/index.es.js +160 -67
  167. package/upload/index.umd.js +1 -1
  168. package/upload/style.css +1 -1
  169. package/vue-devui.es.js +16936 -24821
  170. package/vue-devui.umd.js +24 -22
  171. package/nuxt/components/TagInput.js +0 -3
  172. package/tag-input/index.es.js +0 -331
  173. package/tag-input/index.umd.js +0 -1
  174. package/tag-input/style.css +0 -1
@@ -0,0 +1,3 @@
1
+ import '../../table/style.css'
2
+
3
+ export { Column as default } from '../../table/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../date-picker/style.css'
2
+
3
+ export { DatePicker as default } from '../../date-picker/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../drawer/style.css'
2
+
3
+ export { Drawer as default } from '../../drawer/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../drawer/style.css'
2
+
3
+ export { DrawerService as default } from '../../drawer/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../dropdown/style.css'
2
+
3
+ export { Dropdown as default } from '../../dropdown/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../dropdown/style.css'
2
+
3
+ export { DropdownMenu as default } from '../../dropdown/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../auto-complete/style.css'
2
+
3
+ export { DropdownPropsKey as default } from '../../auto-complete/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../form/style.css'
2
+
3
+ export { Form as default } from '../../form/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../form/style.css'
2
+
3
+ export { FormControl as default } from '../../form/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../form/style.css'
2
+
3
+ export { FormItem as default } from '../../form/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../form/style.css'
2
+
3
+ export { FormLabel as default } from '../../form/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../form/style.css'
2
+
3
+ export { FormOperation as default } from '../../form/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../input-number/style.css'
2
+
3
+ export { InputNumber as default } from '../../input-number/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../loading/style.css'
2
+
3
+ export { LoadingOptions as default } from '../../loading/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../select/style.css'
2
+
3
+ export { Select as default } from '../../select/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../date-picker/style.css'
2
+
3
+ export { StickSlider as default } from '../../date-picker/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tabs/style.css'
2
+
3
+ export { Tab as default } from '../../tabs/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../table/style.css'
2
+
3
+ export { Table as default } from '../../table/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tabs/style.css'
2
+
3
+ export { Tabs as default } from '../../tabs/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tooltip/style.css'
2
+
3
+ export { Tooltip as default } from '../../tooltip/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../auto-complete/style.css'
2
+
3
+ export { autoCompleteProps as default } from '../../auto-complete/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../avatar/style.css'
2
+
3
+ export { avatarProps as default } from '../../avatar/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../card/style.css'
2
+
3
+ export { cardProps as default } from '../../card/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../checkbox/style.css'
2
+
3
+ export { checkboxGroupInjectionKey as default } from '../../checkbox/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../checkbox/style.css'
2
+
3
+ export { checkboxGroupProps as default } from '../../checkbox/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../checkbox/style.css'
2
+
3
+ export { checkboxProps as default } from '../../checkbox/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../grid/style.css'
2
+
3
+ export { colProps as default } from '../../grid/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../grid/style.css'
2
+
3
+ export { colPropsBaseClass as default } from '../../grid/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../grid/style.css'
2
+
3
+ export { colPropsBaseStyle as default } from '../../grid/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../comment/style.css'
2
+
3
+ export { commentProps as default } from '../../comment/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../countdown/style.css'
2
+
3
+ export { countdownProps as default } from '../../countdown/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../dropdown/style.css'
2
+
3
+ export { dropdownMenuProps as default } from '../../dropdown/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../editable-select/style.css'
2
+
3
+ export { editableSelectProps as default } from '../../editable-select/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../image-preview/style.css'
2
+
3
+ export { imagePreviewProps as default } from '../../image-preview/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../input/style.css'
2
+
3
+ export { inputProps as default } from '../../input/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../loading/style.css'
2
+
3
+ export { loadingProps as default } from '../../loading/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../modal/style.css'
2
+
3
+ export { modalProps as default } from '../../modal/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../progress/style.css'
2
+
3
+ export { progressProps as default } from '../../progress/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../rate/style.css'
2
+
3
+ export { rateProps as default } from '../../rate/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../read-tip/style.css'
2
+
3
+ export { readTipProps as default } from '../../read-tip/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../result/style.css'
2
+
3
+ export { resultProps as default } from '../../result/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../grid/style.css'
2
+
3
+ export { rowProps as default } from '../../grid/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../grid/style.css'
2
+
3
+ export { screenSizes as default } from '../../grid/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../skeleton/style.css'
2
+
3
+ export { skeletonProps as default } from '../../skeleton/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../slider/style.css'
2
+
3
+ export { sliderProps as default } from '../../slider/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../splitter/style.css'
2
+
3
+ export { splitterProps as default } from '../../splitter/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../statistic/style.css'
2
+
3
+ export { statisticProps as default } from '../../statistic/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../switch/style.css'
2
+
3
+ export { switchProps as default } from '../../switch/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tabs/style.css'
2
+
3
+ export { tabsProps as default } from '../../tabs/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../textarea/style.css'
2
+
3
+ export { textareaProps as default } from '../../textarea/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../timeline/style.css'
2
+
3
+ export { timeAxisProps as default } from '../../timeline/index.es.js'
@@ -0,0 +1,3 @@
1
+ import '../../tooltip/style.css'
2
+
3
+ export { tooltipProps as default } from '../../tooltip/index.es.js'
@@ -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 { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
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: `${y}px`, left: `${x}px` });
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
- const originParent = getScrollParent(props.origin);
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
  });
@@ -1 +1 @@
1
- var _=Object.defineProperty,R=Object.defineProperties;var T=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var x=(n,e,a)=>e in n?_(n,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[e]=a,B=(n,e)=>{for(var a in e||(e={}))$.call(e,a)&&x(n,a,e[a]);if(O)for(var a of O(e))z.call(e,a)&&x(n,a,e[a]);return n},E=(n,e)=>R(n,T(e));(function(n,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):(n=typeof globalThis!="undefined"?globalThis:n||self,e(n.index={},n.Vue,n.dom))})(this,function(n,e,a){"use strict";var D="";function P(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const S=e.defineComponent({setup(t,l){return()=>{let r;return e.createVNode(e.Teleport,{to:"#d-overlay-anchor"},{default:()=>[e.createVNode(e.Transition,{name:"devui-overlay-fade"},P(r=e.renderSlot(l.slots,"default"))?r:{default:()=>[r]})]})}}}),g={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}},p=E(B({},g),{overlayStyle:{type:[String,Object],default:void 0}}),h=["update:visible","backdropClick"];function V(t,l){const r=e.computed(()=>["devui-overlay-background",t.backgroundClass,t.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),s=e.computed(()=>"devui-overlay"),c=o=>{var d;o.preventDefault(),(d=t.onBackdropClick)==null||d.call(t),t.backdropClose&&l.emit("update:visible",!1)},i=o=>o.cancelBubble=!0;return e.onMounted(()=>{const o=document.body,d=o.style.overflow,u=o.style.position;e.watch([()=>t.visible,()=>t.backgroundBlock],([f,v])=>{if(v){const y=o.getBoundingClientRect().y;f?(o.style.overflowY="scroll",o.style.position=f?"fixed":"",o.style.top=`${y}px`):(o.style.overflowY=d,o.style.position=u,o.style.top="",window.scrollTo(0,-y))}}),e.onUnmounted(()=>{document.body.style.overflow=d})}),{backgroundClass:r,overlayClass:s,handleBackdropClick:c,handleOverlayBubbleCancel:i}}var M="";const b=e.defineComponent({name:"DFixedOverlay",props:p,emits:h,setup(t,l){const{backgroundClass:r,overlayClass:s,handleBackdropClick:c,handleOverlayBubbleCancel:i}=V(t,l);return()=>e.createVNode(S,null,{default:()=>[t.visible&&e.createVNode("div",{class:r.value,style:t.backgroundStyle,onClick:c},[e.createVNode("div",{class:s.value,style:t.overlayStyle,onClick:i},[e.renderSlot(l.slots,"default")])])]})}}),k={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 C(t){const l=/(auto|scroll|hidden)/;for(let r=t;r=r.parentElement;r.parentElement!==document.body){const s=window.getComputedStyle(r);if(l.test(s.overflow+s.overflowX+s.overflowY))return r}return window}function A(t,l,r,s){let{x:c,y:i}=l;if(!t){const{width:o,height:d}=s;c&&r.includes("start")&&(c=12),c&&r.includes("end")&&(c=Math.round(o-24)),i&&r.includes("start")&&(i=10),i&&r.includes("end")&&(i=d-14)}return{x:c,y:i}}function j(t,l){const r=e.ref(),s=e.ref(),c=(o,d,u,f)=>{const{x:v,y}=A(t.isArrowCenter,u,d,f.getBoundingClientRect()),w={top:"bottom",right:"left",bottom:"top",left:"right"}[d.split("-")[0]];Object.assign(o.style,{left:v?`${v}px`:"",top:y?`${y}px`:"",right:"",bottom:"",[w]:"-4px"})},i=async()=>{const o=t.origin,d=e.unref(r.value),u=e.unref(s.value),f=[a.shift(),a.offset(t.offset),a.autoPlacement({alignment:t.align,allowedPlacements:t.position})];t.showArrow&&f.push(a.arrow({element:u}));const{x:v,y,placement:w,middlewareData:F}=await a.computePosition(o,d,{strategy:"fixed",middleware:f});l("positionChange",w),Object.assign(d.style,{top:`${y}px`,left:`${v}px`}),t.showArrow&&c(u,w,F.arrow,d)};return e.watch(()=>t.modelValue,()=>{const o=C(t.origin);t.modelValue&&t.origin?(e.nextTick(i),o.addEventListener("scroll",i),o!==window&&window.addEventListener("scroll",i),window.addEventListener("resize",i)):(o.removeEventListener("scroll",i),o!==window&&window.removeEventListener("scroll",i),window.removeEventListener("resize",i))}),e.onUnmounted(()=>{const o=C(t.origin);o.removeEventListener("scroll",i),o!==window&&window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}),{arrowRef:s,overlayRef:r,updatePosition:i}}var q="";const m=e.defineComponent({name:"DFlexibleOverlay",inheritAttrs:!1,props:k,emits:["update:modelValue","positionChange"],setup(t,{slots:l,attrs:r,emit:s,expose:c}){const{arrowRef:i,overlayRef:o,updatePosition:d}=j(t,s);return c({updatePosition:d}),()=>{var u;return t.modelValue&&e.createVNode("div",e.mergeProps({ref:o,class:"devui-flexible-overlay"},r),[(u=l.default)==null?void 0:u.call(l),t.showArrow&&e.createVNode("div",{ref:i,class:"devui-flexible-overlay-arrow"},null)])}}}),L=typeof window!="undefined";var N={title:"Overlay \u906E\u7F69\u5C42",category:"\u901A\u7528",status:"100%",install(t){if(t.component(b.name,b),t.component(m.name,m),L&&!document.getElementById("d-overlay-anchor")){const l=document.createElement("div");l.setAttribute("id","d-overlay-anchor"),l.style.position="fixed",l.style.left="0",l.style.top="0",l.style.zIndex="1000",document.body.appendChild(l)}}};n.FixedOverlay=b,n.FlexibleOverlay=m,n.default=N,n.fixedOverlayProps=p,n.flexibleOverlayProps=k,n.overlayEmits=h,n.overlayProps=g,Object.defineProperty(n,"__esModule",{value:!0}),n[Symbol.toStringTag]="Module"});
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.2",
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.0",
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",
@@ -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"],
@@ -1 +1 @@
1
- (function(u,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis!="undefined"?globalThis:u||self,e(u.index={},u.Vue))})(this,function(u,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:"&lt;"},nextLink:{type:String,default:"&gt;"},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.value);e.watch(()=>n.value,l=>{o.value=l});let i=n.value;return{inputNum:o,jumpPageChange:l=>{i=+l,o.value=l,isNaN(l)&&setTimeout(()=>{o.value=n.value},300)},jump:l=>{i>r.value||(l==="btn"||l.key==="Enter")&&s.value!==i&&a("changeCursorEmit",i)}}},render(){const{goToText:t,size:a,inputNum:n,jumpPageChange:r,jump:s,showJumpButton:o}=this;return e.createVNode("div",{class:"devui-jump-container"},[t,e.createVNode(e.resolveComponent("d-input"),{class:["devui-pagination-input",a?"devui-pagination-input-"+a:""],size:a,modelValue:String(n),"onUpdate:modelValue":r,onKeydown:s},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:d,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]<d-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]<d&&e.createVNode("li",{onClick:s.bind(null,d),class:{"devui-pagination-item":!0,active:o===d}},[e.createVNode("a",{class:"devui-pagination-link"},[d])]),P&&o>d&&d>0&&e.createVNode(e.Fragment,null,[o>d+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>=d}},[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:d,canViewTotal:l,totalItemText:P,goToText:m,maxItems:p,showJumpButton:q,showTruePageIndex:K,lite:f,showPageSelector:v,haveConfigMenu:R,autoHide:G,$slots:x,cursor:S,totalPages:T,currentPageSize:I,pageSizeChange:w,changeCursorEmit:B,litePageOptions:Q,litePageIndexChange:W}=this;return G&&Math.min(...n)>t?null:e.createVNode("div",{class:"devui-pagination"},[d&&!f&&e.createVNode("div",{class:["devui-page-size",i?"devui-page-size-"+i:""]},[e.createVNode(e.resolveComponent("d-select"),{options:n,modelValue:I,onValueChange:w,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:S,onValueChange:W,pageSizeDirection:r},null)]),e.createVNode(e.resolveComponent("page-num-btn"),e.mergeProps({cursor:S,totalPages:T,size:i,lite:f,maxItems:p,preLink:s,nextLink:o,showTruePageIndex:K},{onChangeCursorEmit:B}),null),c&&!f&&e.createVNode(e.resolveComponent("jump-page"),e.mergeProps({goToText:m,size:i,pageIndex:a,totalPages:T,cursor:S,showJumpButton:q},{onChangeCursorEmit:B}),null),f&&R&&e.createVNode(e.resolveComponent("config-menu"),{currentPageSize:I,pageSizeChange:w,pageSizeOptions:n},{default:()=>{var E;return[(E=x.default)==null?void 0:E.call(x)]}})])}}),_={title:"Pagination \u5206\u9875",category:"\u5BFC\u822A",status:"100%",install(t){t.component(V.name,V)}};u.Pagination=V,u.default=_,u.paginationProps=y,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
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:"&lt;"},nextLink:{type:String,default:"&gt;"},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"});
@@ -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 { shift, offset, autoPlacement, arrow, computePosition } from "@floating-ui/dom";
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: `${y}px`, left: `${x}px` });
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
- const originParent = getScrollParent(props.origin);
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
  });