vue-devui 1.0.0-beta.18 → 1.0.0-beta.19

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 (161) hide show
  1. package/README.md +200 -187
  2. package/accordion/index.es.js +221 -6
  3. package/accordion/index.umd.js +1 -1
  4. package/alert/index.es.js +28 -30
  5. package/alert/index.umd.js +1 -1
  6. package/auto-complete/index.es.js +131 -269
  7. package/auto-complete/index.umd.js +1 -1
  8. package/auto-complete/style.css +1 -1
  9. package/back-top/index.es.js +4 -2
  10. package/badge/index.es.js +13 -19
  11. package/badge/index.umd.js +1 -1
  12. package/badge/style.css +1 -1
  13. package/breadcrumb/index.es.js +2 -1
  14. package/button/index.es.js +39 -40
  15. package/button/index.umd.js +1 -1
  16. package/carousel/index.es.js +38 -53
  17. package/carousel/index.umd.js +1 -1
  18. package/cascader/index.es.js +16 -8
  19. package/cascader/style.css +1 -1
  20. package/color-picker/index.es.js +97 -89
  21. package/color-picker/index.umd.js +7 -7
  22. package/countdown/index.es.js +2 -1
  23. package/date-picker/index.es.js +40 -57
  24. package/date-picker/index.umd.js +1 -1
  25. package/date-picker/style.css +1 -1
  26. package/drawer/index.es.js +162 -5741
  27. package/drawer/index.umd.js +1 -27
  28. package/drawer/style.css +1 -1
  29. package/dropdown/index.es.js +459 -301
  30. package/dropdown/index.umd.js +1 -1
  31. package/dropdown/style.css +1 -1
  32. package/editable-select/index.es.js +6 -3
  33. package/form/index.es.js +1953 -1550
  34. package/form/index.umd.js +18 -18
  35. package/form/style.css +1 -1
  36. package/fullscreen/index.es.js +112 -133
  37. package/fullscreen/index.umd.js +1 -1
  38. package/fullscreen/style.css +1 -1
  39. package/icon/index.es.js +39 -57
  40. package/icon/index.umd.js +1 -1
  41. package/image-preview/index.es.js +2 -1
  42. package/input/style.css +1 -1
  43. package/input-icon/index.es.js +38 -37
  44. package/input-icon/index.umd.js +1 -1
  45. package/input-icon/style.css +1 -1
  46. package/input-number/index.es.js +46 -57
  47. package/input-number/index.umd.js +1 -1
  48. package/input-number/style.css +1 -1
  49. package/{time-axis → list}/index.d.ts +0 -0
  50. package/list/index.es.js +39 -0
  51. package/list/index.umd.js +1 -0
  52. package/{toast → list}/package.json +1 -1
  53. package/list/style.css +1 -0
  54. package/modal/index.es.js +300 -934
  55. package/modal/index.umd.js +1 -1
  56. package/modal/style.css +1 -1
  57. package/{toast → notification}/index.d.ts +0 -0
  58. package/notification/index.es.js +284 -0
  59. package/notification/index.umd.js +1 -0
  60. package/notification/package.json +7 -0
  61. package/notification/style.css +1 -0
  62. package/nuxt/components/DropdownMenu.js +3 -0
  63. package/nuxt/components/IFileOptions.js +3 -0
  64. package/nuxt/components/IUploadOptions.js +3 -0
  65. package/nuxt/components/List.js +3 -0
  66. package/nuxt/components/ListItem.js +3 -0
  67. package/nuxt/components/Notification.js +3 -0
  68. package/nuxt/components/NotificationService.js +3 -0
  69. package/nuxt/components/PanelBody.js +3 -0
  70. package/nuxt/components/PanelFooter.js +3 -0
  71. package/nuxt/components/PanelHeader.js +3 -0
  72. package/nuxt/components/Timeline.js +3 -0
  73. package/nuxt/components/TimelineItem.js +3 -0
  74. package/nuxt/components/UploadStatus.js +3 -0
  75. package/nuxt/components/alertProps.js +3 -0
  76. package/nuxt/components/badgeProps.js +3 -0
  77. package/nuxt/components/dropdownMenuProps.js +3 -0
  78. package/nuxt/components/fixedOverlayProps.js +3 -0
  79. package/nuxt/components/flexibleOverlayProps.js +3 -0
  80. package/nuxt/components/fullscreenProps.js +3 -0
  81. package/nuxt/components/iconProps.js +2 -0
  82. package/nuxt/components/notificationProps.js +3 -0
  83. package/nuxt/components/overlayEmits.js +3 -0
  84. package/nuxt/components/overlayProps.js +3 -0
  85. package/nuxt/components/paginationProps.js +3 -0
  86. package/nuxt/components/panelProps.js +3 -0
  87. package/nuxt/components/popoverProps.js +3 -0
  88. package/nuxt/components/searchProps.js +3 -0
  89. package/nuxt/components/tooltipProps.js +3 -0
  90. package/nuxt/components/uploadProps.js +3 -0
  91. package/overlay/index.es.js +152 -198
  92. package/overlay/index.umd.js +1 -1
  93. package/overlay/style.css +1 -1
  94. package/package.json +40 -87
  95. package/pagination/index.es.js +10 -12
  96. package/pagination/index.umd.js +1 -1
  97. package/panel/index.es.js +45 -32
  98. package/panel/index.umd.js +1 -1
  99. package/popover/index.es.js +5954 -201
  100. package/popover/index.umd.js +27 -1
  101. package/popover/style.css +1 -1
  102. package/read-tip/index.es.js +6 -3
  103. package/result/index.es.js +38 -53
  104. package/result/index.umd.js +1 -1
  105. package/ripple/index.es.js +9 -5
  106. package/search/index.es.js +19 -29
  107. package/search/index.umd.js +6 -6
  108. package/search/style.css +1 -1
  109. package/select/index.es.js +42 -42
  110. package/select/index.umd.js +1 -1
  111. package/select/style.css +1 -1
  112. package/skeleton/index.es.js +17 -17
  113. package/skeleton/index.umd.js +1 -1
  114. package/slider/index.es.js +2 -1
  115. package/splitter/index.es.js +5814 -98
  116. package/splitter/index.umd.js +27 -1
  117. package/splitter/style.css +1 -1
  118. package/status/index.es.js +1 -4
  119. package/status/index.umd.js +1 -1
  120. package/status/style.css +1 -1
  121. package/steps-guide/index.es.js +6 -3
  122. package/style.css +1 -1
  123. package/table/index.es.js +456 -299
  124. package/table/index.umd.js +1 -1
  125. package/table/style.css +1 -1
  126. package/tabs/index.es.js +3 -4
  127. package/tabs/index.umd.js +1 -1
  128. package/tag/index.es.js +2 -1
  129. package/tag-input/index.es.js +4 -2
  130. package/textarea/style.css +1 -1
  131. package/time-picker/index.es.js +43 -42
  132. package/time-picker/index.umd.js +1 -1
  133. package/timeline/index.d.ts +7 -0
  134. package/{time-axis → timeline}/index.es.js +65 -78
  135. package/timeline/index.umd.js +1 -0
  136. package/{time-axis → timeline}/package.json +1 -1
  137. package/timeline/style.css +1 -0
  138. package/tooltip/index.es.js +5804 -94
  139. package/tooltip/index.umd.js +27 -1
  140. package/tooltip/style.css +1 -1
  141. package/transfer/index.es.js +440 -165
  142. package/transfer/index.umd.js +17 -17
  143. package/transfer/style.css +1 -1
  144. package/tree/index.es.js +12 -7
  145. package/tree/index.umd.js +10 -10
  146. package/tree-select/index.es.js +10 -6
  147. package/tree-select/index.umd.js +1 -1
  148. package/upload/index.es.js +335 -6068
  149. package/upload/index.umd.js +1 -27
  150. package/upload/style.css +1 -1
  151. package/vue-devui.es.js +2555 -2799
  152. package/vue-devui.umd.js +16 -16
  153. package/nuxt/components/TimeAxis.js +0 -3
  154. package/nuxt/components/TimeAxisItem.js +0 -3
  155. package/nuxt/components/Toast.js +0 -3
  156. package/nuxt/components/ToastService.js +0 -3
  157. package/time-axis/index.umd.js +0 -1
  158. package/time-axis/style.css +0 -1
  159. package/toast/index.es.js +0 -5918
  160. package/toast/index.umd.js +0 -27
  161. package/toast/style.css +0 -1
@@ -17,8 +17,9 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, createVNode, Teleport, Transition, renderSlot, isVNode, computed, onMounted, watch, onUnmounted, withDirectives, vShow, ref, reactive, toRef, isRef } from "vue";
21
- var overlay = "";
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";
22
+ var baseOverlay = "";
22
23
  function _isSlot(s) {
23
24
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
24
25
  }
@@ -65,28 +66,13 @@ const overlayProps = {
65
66
  default: true
66
67
  }
67
68
  };
68
- const overlayEmits = ["update:visible", "backdropClick"];
69
69
  const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
70
70
  overlayStyle: {
71
71
  type: [String, Object],
72
72
  default: void 0
73
73
  }
74
74
  });
75
- const flexibleOverlayProps = __spreadValues({
76
- origin: {
77
- type: Object,
78
- require: true
79
- },
80
- position: {
81
- type: Object,
82
- default: () => ({
83
- originX: "left",
84
- originY: "top",
85
- overlayX: "left",
86
- overlayY: "top"
87
- })
88
- }
89
- }, overlayProps);
75
+ const overlayEmits = ["update:visible", "backdropClick"];
90
76
  function useOverlayLogic(props, ctx) {
91
77
  const backgroundClass = computed(() => {
92
78
  return [
@@ -137,6 +123,7 @@ function useOverlayLogic(props, ctx) {
137
123
  handleOverlayBubbleCancel
138
124
  };
139
125
  }
126
+ var fixedOverlay = "";
140
127
  const FixedOverlay = defineComponent({
141
128
  name: "DFixedOverlay",
142
129
  props: fixedOverlayProps,
@@ -149,7 +136,7 @@ const FixedOverlay = defineComponent({
149
136
  handleOverlayBubbleCancel
150
137
  } = useOverlayLogic(props, ctx);
151
138
  return () => createVNode(CommonOverlay, null, {
152
- default: () => [withDirectives(createVNode("div", {
139
+ default: () => [props.visible && createVNode("div", {
153
140
  "class": backgroundClass.value,
154
141
  "style": props.backgroundStyle,
155
142
  "onClick": handleBackdropClick
@@ -157,203 +144,170 @@ const FixedOverlay = defineComponent({
157
144
  "class": overlayClass.value,
158
145
  "style": props.overlayStyle,
159
146
  "onClick": handleOverlayBubbleCancel
160
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
147
+ }, [renderSlot(ctx.slots, "default")])])]
161
148
  });
162
149
  }
163
150
  });
164
- function isComponent(target) {
165
- return !!(target == null ? void 0 : target.$el);
166
- }
167
- function getElement(element) {
168
- if (element instanceof Element) {
169
- return element;
170
- }
171
- if (element && typeof element === "object" && element.$el instanceof Element) {
172
- return element.$el;
173
- }
174
- return null;
175
- }
176
- const FlexibleOverlay = defineComponent({
177
- name: "DFlexibleOverlay",
178
- props: flexibleOverlayProps,
179
- emits: overlayEmits,
180
- setup(props, ctx) {
181
- const overlayRef = ref(null);
182
- const positionedStyle = reactive({
183
- position: "absolute"
184
- });
185
- onMounted(async () => {
186
- const handleRectChange = (position, rect, origin) => {
187
- const point = calculatePosition(position, rect, origin);
188
- positionedStyle.left = `${point.x}px`;
189
- positionedStyle.top = `${point.y}px`;
190
- };
191
- const locationElements = computed(() => {
192
- const overlay2 = overlayRef.value;
193
- const origin = getOrigin(props.origin);
194
- if (!overlay2 || !origin) {
195
- return;
196
- }
197
- return {
198
- origin,
199
- overlay: overlay2
200
- };
201
- });
202
- const visibleRef = toRef(props, "visible");
203
- const positionRef = toRef(props, "position");
204
- watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
205
- if (!visible || !locationElements2) {
206
- return;
207
- }
208
- const {
209
- origin,
210
- overlay: overlay2
211
- } = locationElements2;
212
- handleRectChange(position, overlay2.getBoundingClientRect(), origin);
213
- const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
214
- onInvalidate(() => {
215
- unsubscriptions.forEach((fn) => fn());
216
- });
217
- });
218
- });
219
- const {
220
- backgroundClass,
221
- overlayClass,
222
- handleBackdropClick,
223
- handleOverlayBubbleCancel
224
- } = useOverlayLogic(props, ctx);
225
- return () => createVNode(CommonOverlay, null, {
226
- default: () => [withDirectives(createVNode("div", {
227
- "style": props.backgroundStyle,
228
- "class": backgroundClass.value,
229
- "onClick": handleBackdropClick
230
- }, [createVNode("div", {
231
- "ref": overlayRef,
232
- "class": overlayClass.value,
233
- "style": positionedStyle,
234
- "onClick": handleOverlayBubbleCancel
235
- }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
236
- });
237
- }
238
- });
239
- function getOrigin(origin) {
240
- if (origin instanceof Element) {
241
- return origin;
242
- }
243
- if (isRef(origin)) {
244
- return getElement(origin.value);
245
- }
246
- if (isComponent(origin)) {
247
- return getElement(origin);
248
- }
249
- return origin;
250
- }
251
- function calculatePosition(position, rect, origin) {
252
- const originRect = getOriginRect(origin);
253
- const originPoint = getOriginRelativePoint(originRect, position);
254
- return getOverlayPoint(originPoint, rect, position);
255
- }
256
- function getOriginRect(origin) {
257
- if (origin instanceof Element) {
258
- return origin.getBoundingClientRect();
259
- }
260
- const width = origin.width || 0;
261
- const height = origin.height || 0;
262
- return {
263
- top: origin.y,
264
- bottom: origin.y + height,
265
- left: origin.x,
266
- right: origin.x + width,
267
- height,
268
- width
269
- };
270
- }
271
- function getOverlayPoint(originPoint, rect, position) {
272
- let x;
273
- const {
274
- width,
275
- height
276
- } = rect;
277
- if (position.overlayX == "center") {
278
- x = originPoint.x - width / 2;
279
- } else {
280
- x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
151
+ const flexibleOverlayProps = {
152
+ modelValue: {
153
+ type: Boolean,
154
+ default: false
155
+ },
156
+ origin: {
157
+ type: Object,
158
+ require: true
159
+ },
160
+ position: {
161
+ type: Array,
162
+ default: ["bottom"]
163
+ },
164
+ offset: {
165
+ type: [Number, Object],
166
+ default: 8
167
+ },
168
+ align: {
169
+ type: String,
170
+ default: null
171
+ },
172
+ showArrow: {
173
+ type: Boolean,
174
+ default: false
175
+ },
176
+ isArrowCenter: {
177
+ type: Boolean,
178
+ default: true
281
179
  }
282
- let y;
283
- if (position.overlayY == "center") {
284
- y = originPoint.y - height / 2;
285
- } else {
286
- y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
180
+ };
181
+ function getScrollParent(element) {
182
+ const overflowRegex = /(auto|scroll|hidden)/;
183
+ for (let parent = element; parent = parent.parentElement; parent.parentElement !== document.body) {
184
+ const style = window.getComputedStyle(parent);
185
+ if (overflowRegex.test(style.overflow + style.overflowX + style.overflowY)) {
186
+ return parent;
187
+ }
287
188
  }
288
- return {
289
- x,
290
- y
291
- };
189
+ return window;
292
190
  }
293
- function getOriginRelativePoint(originRect, position) {
294
- let x;
295
- if (position.originX == "center") {
296
- x = originRect.left + originRect.width / 2;
297
- } else {
298
- const startX = originRect.left;
299
- const endX = originRect.right;
300
- x = position.originX == "left" ? startX : endX;
301
- }
302
- let y;
303
- if (position.originY == "center") {
304
- y = originRect.top + originRect.height / 2;
305
- } else {
306
- y = position.originY == "top" ? originRect.top : originRect.bottom;
191
+ function adjustArrowPosition(isArrowCenter, point, placement, originRect) {
192
+ let { x, y } = point;
193
+ if (!isArrowCenter) {
194
+ const { width, height } = originRect;
195
+ if (x && placement.includes("start")) {
196
+ x = 12;
197
+ }
198
+ if (x && placement.includes("end")) {
199
+ x = Math.round(width - 24);
200
+ }
201
+ if (y && placement.includes("start")) {
202
+ y = 10;
203
+ }
204
+ if (y && placement.includes("end")) {
205
+ y = height - 14;
206
+ }
307
207
  }
308
- return {
309
- x,
310
- y
311
- };
208
+ return { x, y };
312
209
  }
313
- function subscribeLayoutEvent(event) {
314
- window.addEventListener("scroll", event, true);
315
- window.addEventListener("resize", event);
316
- window.addEventListener("orientationchange", event);
317
- return () => {
318
- window.removeEventListener("scroll", event, true);
319
- window.removeEventListener("resize", event);
320
- window.removeEventListener("orientationchange", event);
210
+ function useOverlay(props, emit) {
211
+ const overlayRef = ref();
212
+ const arrowRef = ref();
213
+ const updateArrowPosition = (arrowEl, placement, point, overlayEl) => {
214
+ const { x, y } = adjustArrowPosition(props.isArrowCenter, point, placement, overlayEl.getBoundingClientRect());
215
+ const staticSide = {
216
+ top: "bottom",
217
+ right: "left",
218
+ bottom: "top",
219
+ left: "right"
220
+ }[placement.split("-")[0]];
221
+ Object.assign(arrowEl.style, {
222
+ left: x ? `${x}px` : "",
223
+ top: y ? `${y}px` : "",
224
+ right: "",
225
+ bottom: "",
226
+ [staticSide]: "-4px"
227
+ });
321
228
  };
322
- }
323
- function subscribeOverlayResize(overlay2, callback) {
324
- if (overlay2 instanceof Element) {
325
- const resizeObserver = new ResizeObserver(callback);
326
- resizeObserver.observe(overlay2);
327
- return () => resizeObserver.disconnect();
328
- }
329
- return () => {
229
+ const updatePosition = async () => {
230
+ const hostEl = props.origin;
231
+ const overlayEl = unref(overlayRef.value);
232
+ const arrowEl = unref(arrowRef.value);
233
+ const middleware = [
234
+ shift(),
235
+ offset(props.offset),
236
+ autoPlacement({
237
+ alignment: props.align,
238
+ allowedPlacements: props.position
239
+ })
240
+ ];
241
+ props.showArrow && middleware.push(arrow({ element: arrowEl }));
242
+ const { x, y, placement, middlewareData } = await computePosition(hostEl, overlayEl, {
243
+ strategy: "fixed",
244
+ middleware
245
+ });
246
+ emit("positionChange", placement);
247
+ Object.assign(overlayEl.style, { top: `${y}px`, left: `${x}px` });
248
+ props.showArrow && updateArrowPosition(arrowEl, placement, middlewareData.arrow, overlayEl);
330
249
  };
250
+ watch(() => props.modelValue, () => {
251
+ const originParent = getScrollParent(props.origin);
252
+ if (props.modelValue && props.origin) {
253
+ nextTick(updatePosition);
254
+ originParent.addEventListener("scroll", updatePosition);
255
+ originParent !== window && window.addEventListener("scroll", updatePosition);
256
+ window.addEventListener("resize", updatePosition);
257
+ } else {
258
+ originParent.removeEventListener("scroll", updatePosition);
259
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
260
+ window.removeEventListener("resize", updatePosition);
261
+ }
262
+ });
263
+ onUnmounted(() => {
264
+ const originParent = getScrollParent(props.origin);
265
+ originParent.removeEventListener("scroll", updatePosition);
266
+ originParent !== window && window.removeEventListener("scroll", updatePosition);
267
+ window.removeEventListener("resize", updatePosition);
268
+ });
269
+ return { arrowRef, overlayRef, updatePosition };
331
270
  }
332
- function subscribeOriginResize(origin, callback) {
333
- if (origin instanceof Element) {
334
- const observer = new MutationObserver(callback);
335
- observer.observe(origin, {
336
- attributeFilter: ["style"]
271
+ var flexibleOverlay = "";
272
+ const FlexibleOverlay = defineComponent({
273
+ name: "DFlexibleOverlay",
274
+ inheritAttrs: false,
275
+ props: flexibleOverlayProps,
276
+ emits: ["update:modelValue", "positionChange"],
277
+ setup(props, {
278
+ slots,
279
+ attrs,
280
+ emit,
281
+ expose
282
+ }) {
283
+ const {
284
+ arrowRef,
285
+ overlayRef,
286
+ updatePosition
287
+ } = useOverlay(props, emit);
288
+ expose({
289
+ updatePosition
337
290
  });
338
- return () => observer.disconnect();
291
+ return () => {
292
+ var _a;
293
+ return props.modelValue && createVNode("div", mergeProps({
294
+ "ref": overlayRef,
295
+ "class": "devui-flexible-overlay"
296
+ }, attrs), [(_a = slots.default) == null ? void 0 : _a.call(slots), props.showArrow && createVNode("div", {
297
+ "ref": arrowRef,
298
+ "class": "devui-flexible-overlay-arrow"
299
+ }, null)]);
300
+ };
339
301
  }
340
- return () => {
341
- };
342
- }
302
+ });
343
303
  const inBrowser = typeof window !== "undefined";
344
- FlexibleOverlay.install = function(app) {
345
- app.component(FlexibleOverlay.name, FlexibleOverlay);
346
- };
347
- FixedOverlay.install = function(app) {
348
- app.component(FixedOverlay.name, FixedOverlay);
349
- };
350
304
  var index = {
351
305
  title: "Overlay \u906E\u7F69\u5C42",
352
306
  category: "\u901A\u7528",
353
307
  status: "100%",
354
308
  install(app) {
355
- app.use(FixedOverlay);
356
- app.use(FlexibleOverlay);
309
+ app.component(FixedOverlay.name, FixedOverlay);
310
+ app.component(FlexibleOverlay.name, FlexibleOverlay);
357
311
  if (inBrowser && !document.getElementById("d-overlay-anchor")) {
358
312
  const overlayAnchor = document.createElement("div");
359
313
  overlayAnchor.setAttribute("id", "d-overlay-anchor");
@@ -365,4 +319,4 @@ var index = {
365
319
  }
366
320
  }
367
321
  };
368
- export { FixedOverlay, FlexibleOverlay, index as default };
322
+ export { FixedOverlay, FlexibleOverlay, index as default, fixedOverlayProps, flexibleOverlayProps, overlayEmits, overlayProps };
@@ -1 +1 @@
1
- var J=Object.defineProperty,K=Object.defineProperties;var Q=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable;var F=(l,t,a)=>t in l?J(l,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):l[t]=a,B=(l,t)=>{for(var a in t||(t={}))W.call(t,a)&&F(l,a,t[a]);if(V)for(var a of V(t))Z.call(t,a)&&F(l,a,t[a]);return l},N=(l,t)=>K(l,Q(t));(function(l,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(l=typeof globalThis!="undefined"?globalThis:l||self,t(l.index={},l.Vue))})(this,function(l,t){"use strict";var a="";function L(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!t.isVNode(e)}const x=t.defineComponent({setup(e,n){return()=>{let o;return t.createVNode(t.Teleport,{to:"#d-overlay-anchor"},{default:()=>[t.createVNode(t.Transition,{name:"devui-overlay-fade"},L(o=t.renderSlot(n.slots,"default"))?o:{default:()=>[o]})]})}}}),E={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}},S=["update:visible","backdropClick"],X=N(B({},E),{overlayStyle:{type:[String,Object],default:void 0}}),Y=B({origin:{type:Object,require:!0},position:{type:Object,default:()=>({originX:"left",originY:"top",overlayX:"left",overlayY:"top"})}},E);function R(e,n){const o=t.computed(()=>["devui-overlay-background",e.backgroundClass,e.hasBackdrop?"devui-overlay-background__color":"devui-overlay-background__disabled"]),i=t.computed(()=>"devui-overlay"),c=r=>{var d;r.preventDefault(),(d=e.onBackdropClick)==null||d.call(e),e.backdropClose&&n.emit("update:visible",!1)},s=r=>r.cancelBubble=!0;return t.onMounted(()=>{const r=document.body,d=r.style.overflow,f=r.style.position;t.watch([()=>e.visible,()=>e.backgroundBlock],([p,w])=>{if(w){const C=r.getBoundingClientRect().y;p?(r.style.overflowY="scroll",r.style.position=p?"fixed":"",r.style.top=`${C}px`):(r.style.overflowY=d,r.style.position=f,r.style.top="",window.scrollTo(0,-C))}}),t.onUnmounted(()=>{document.body.style.overflow=d})}),{backgroundClass:o,overlayClass:i,handleBackdropClick:c,handleOverlayBubbleCancel:s}}const v=t.defineComponent({name:"DFixedOverlay",props:X,emits:S,setup(e,n){const{backgroundClass:o,overlayClass:i,handleBackdropClick:c,handleOverlayBubbleCancel:s}=R(e,n);return()=>t.createVNode(x,null,{default:()=>[t.withDirectives(t.createVNode("div",{class:o.value,style:e.backgroundStyle,onClick:c},[t.createVNode("div",{class:i.value,style:e.overlayStyle,onClick:s},[t.renderSlot(n.slots,"default")])]),[[t.vShow,e.visible]])]})}});function _(e){return!!(e==null?void 0:e.$el)}function j(e){return e instanceof Element?e:e&&typeof e=="object"&&e.$el instanceof Element?e.$el:null}const h=t.defineComponent({name:"DFlexibleOverlay",props:Y,emits:S,setup(e,n){const o=t.ref(null),i=t.reactive({position:"absolute"});t.onMounted(async()=>{const f=(u,y,b)=>{const g=T(u,y,b);i.left=`${g.x}px`,i.top=`${g.y}px`},p=t.computed(()=>{const u=o.value,y=z(e.origin);if(!(!u||!y))return{origin:y,overlay:u}}),w=t.toRef(e,"visible"),C=t.toRef(e,"position");t.watch([p,w,C],async([u,y,b],g,G)=>{if(!y||!u)return;const{origin:m,overlay:k}=u;f(b,k.getBoundingClientRect(),m);const H=[P(()=>f(b,k.getBoundingClientRect(),m)),A(k,O=>f(b,O[0].contentRect,m)),q(m,()=>f(b,k.getBoundingClientRect(),m))];G(()=>{H.forEach(O=>O())})})});const{backgroundClass:c,overlayClass:s,handleBackdropClick:r,handleOverlayBubbleCancel:d}=R(e,n);return()=>t.createVNode(x,null,{default:()=>[t.withDirectives(t.createVNode("div",{style:e.backgroundStyle,class:c.value,onClick:r},[t.createVNode("div",{ref:o,class:s.value,style:i,onClick:d},[t.renderSlot(n.slots,"default")])]),[[t.vShow,e.visible]])]})}});function z(e){return e instanceof Element?e:t.isRef(e)?j(e.value):_(e)?j(e):e}function T(e,n,o){const i=$(o),c=M(i,e);return D(c,n,e)}function $(e){if(e instanceof Element)return e.getBoundingClientRect();const n=e.width||0,o=e.height||0;return{top:e.y,bottom:e.y+o,left:e.x,right:e.x+n,height:o,width:n}}function D(e,n,o){let i;const{width:c,height:s}=n;o.overlayX=="center"?i=e.x-c/2:i=o.overlayX=="left"?e.x:e.x-c;let r;return o.overlayY=="center"?r=e.y-s/2:r=o.overlayY=="top"?e.y:e.y-s,{x:i,y:r}}function M(e,n){let o;if(n.originX=="center")o=e.left+e.width/2;else{const c=e.left,s=e.right;o=n.originX=="left"?c:s}let i;return n.originY=="center"?i=e.top+e.height/2:i=n.originY=="top"?e.top:e.bottom,{x:o,y:i}}function P(e){return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)}}function A(e,n){if(e instanceof Element){const o=new ResizeObserver(n);return o.observe(e),()=>o.disconnect()}return()=>{}}function q(e,n){if(e instanceof Element){const o=new MutationObserver(n);return o.observe(e,{attributeFilter:["style"]}),()=>o.disconnect()}return()=>{}}const I=typeof window!="undefined";h.install=function(e){e.component(h.name,h)},v.install=function(e){e.component(v.name,v)};var U={title:"Overlay \u906E\u7F69\u5C42",category:"\u901A\u7528",status:"100%",install(e){if(e.use(v),e.use(h),I&&!document.getElementById("d-overlay-anchor")){const n=document.createElement("div");n.setAttribute("id","d-overlay-anchor"),n.style.position="fixed",n.style.left="0",n.style.top="0",n.style.zIndex="1000",document.body.appendChild(n)}}};l.FixedOverlay=v,l.FlexibleOverlay=h,l.default=U,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
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"});
package/overlay/style.css CHANGED
@@ -1 +1 @@
1
- .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}@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}
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}
package/package.json CHANGED
@@ -1,87 +1,40 @@
1
- {
2
- "name": "vue-devui",
3
- "version": "1.0.0-beta.18",
4
- "license": "MIT",
5
- "description": "DevUI components based on Vite and Vue3",
6
- "keywords": [
7
- "frontend",
8
- "typescript",
9
- "ui-component",
10
- "components",
11
- "vue-components",
12
- "vue",
13
- "vue3",
14
- "vite",
15
- "jsx",
16
- "devui"
17
- ],
18
- "main": "vue-devui.umd.js",
19
- "module": "vue-devui.es.js",
20
- "style": "style.css",
21
- "scripts": {
22
- "dev": "pnpm generate:theme && vitepress dev docs",
23
- "build": "pnpm generate:theme && node --max-old-space-size=4096 node_modules/vitepress/bin/vitepress.js build docs && cp public/* docs/.vitepress/dist/assets",
24
- "build:lib": "pnpm predev && pnpm build:components && pnpm copy",
25
- "test": "jest --config jest.config.js",
26
- "build:components": "node ./devui-cli/index.js build",
27
- "generate:theme": "node ./devui-cli/index.js generate:theme",
28
- "generate:dts": "node ./devui-cli/index.js generate:dts",
29
- "copy": "cp package.json build && cp ../../README.md build && cd build && mkdir theme && cd ../ && cp devui/theme/theme.scss build/theme",
30
- "cli:create": "node ./devui-cli/index.js create -t component",
31
- "predev": "node ./devui-cli/index.js create -t vue-devui --ignore-parse-error",
32
- "prebuild": "node ./devui-cli/index.js create -t vue-devui --ignore-parse-error",
33
- "cli": "devui"
34
- },
35
- "dependencies": {
36
- "@devui-design/icons": "^1.3.0",
37
- "@types/lodash-es": "^4.17.4",
38
- "async-validator": "^4.0.2",
39
- "devui-theme": "workspace:^0.0.1",
40
- "fs-extra": "^10.0.0",
41
- "lodash": "^4.17.21",
42
- "lodash-es": "^4.17.20",
43
- "mitt": "^3.0.0",
44
- "vue": "^3.1.1",
45
- "vue-router": "^4.0.3"
46
- },
47
- "devDependencies": {
48
- "@babel/parser": "^7.15.5",
49
- "@babel/preset-env": "^7.14.5",
50
- "@babel/preset-typescript": "^7.14.5",
51
- "@babel/traverse": "^7.15.4",
52
- "@commitlint/cli": "^11.0.0",
53
- "@commitlint/config-conventional": "^11.0.0",
54
- "@docsearch/css": "^3.0.0-alpha.50",
55
- "@docsearch/js": "^3.0.0-alpha.50",
56
- "@types/chalk": "^2.2.0",
57
- "@types/commander": "^2.12.2",
58
- "@types/jest": "^26.0.23",
59
- "@types/ora": "^3.2.0",
60
- "@typescript-eslint/eslint-plugin": "^4.27.0",
61
- "@typescript-eslint/parser": "^4.27.0",
62
- "@vitejs/plugin-vue": "^1.3.0",
63
- "@vitejs/plugin-vue-jsx": "^1.1.0",
64
- "@vue/babel-plugin-jsx": "^1.0.6",
65
- "@vue/compiler-sfc": "^3.0.5",
66
- "@vue/test-utils": "^2.0.0-rc.9",
67
- "@vuedx/typecheck": "^0.4.1",
68
- "@vuedx/typescript-plugin-vue": "^0.4.1",
69
- "babel-jest": "^27.0.2",
70
- "chalk": "^4.1.2",
71
- "commander": "^8.1.0",
72
- "devui-cli": "workspace:^0.0.2",
73
- "inquirer": "^8.1.2",
74
- "jest": "^27.0.4",
75
- "ora": "^5.4.1",
76
- "patch-vue-directive-ssr": "^0.0.1",
77
- "sass": "^1.32.2",
78
- "shelljs": "^0.8.4",
79
- "typescript": "^4.3.2",
80
- "vite": "^2.4.4",
81
- "vite-plugin-md": "^0.6.0",
82
- "vite-svg-loader": "^2.2.0",
83
- "vitepress": "0.20.1",
84
- "vitepress-theme-demoblock": "1.3.2",
85
- "vue-tsc": "^0.2.2"
86
- }
87
- }
1
+ {
2
+ "name": "vue-devui",
3
+ "version": "1.0.0-beta.19",
4
+ "license": "MIT",
5
+ "description": "DevUI components based on Vite and Vue3",
6
+ "keywords": [
7
+ "frontend",
8
+ "typescript",
9
+ "ui-component",
10
+ "components",
11
+ "vue-components",
12
+ "vue",
13
+ "vue3",
14
+ "vite",
15
+ "jsx",
16
+ "devui"
17
+ ],
18
+ "homepage": "https://vue-devui.github.io/",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git@github.com:DevCloudFE/vue-devui.git"
22
+ },
23
+ "main": "vue-devui.umd.js",
24
+ "module": "vue-devui.es.js",
25
+ "style": "style.css",
26
+ "dependencies": {
27
+ "@devui-design/icons": "^1.3.0",
28
+ "@floating-ui/dom": "^0.4.0",
29
+ "@types/lodash-es": "^4.17.4",
30
+ "@vueuse/core": "^7.7.1",
31
+ "async-validator": "^4.0.2",
32
+ "devui-theme": "^0.0.1",
33
+ "fs-extra": "^10.0.0",
34
+ "lodash": "^4.17.21",
35
+ "lodash-es": "^4.17.20",
36
+ "mitt": "^3.0.0",
37
+ "vue": "^3.1.1",
38
+ "vue-router": "^4.0.3"
39
+ }
40
+ }