@opentiny/vue-renderless 3.11.0-alpha.0 → 3.11.1

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 (59) hide show
  1. package/anchor/index.js +4 -1
  2. package/color-picker/alpha-select/index.js +2 -6
  3. package/color-picker/alpha-select/vue.js +10 -8
  4. package/color-picker/color-select/index.js +2 -6
  5. package/color-picker/color-select/vue.js +9 -19
  6. package/color-picker/vue.js +1 -2
  7. package/color-select-panel/alpha-select/index.js +2 -6
  8. package/color-select-panel/alpha-select/vue.js +11 -9
  9. package/color-select-panel/hue-select/index.js +2 -6
  10. package/color-select-panel/hue-select/vue.js +9 -19
  11. package/color-select-panel/index.js +5 -1
  12. package/color-select-panel/vue.js +19 -24
  13. package/common/deps/fastdom/singleton.js +1 -1
  14. package/common/deps/popper.js +15 -8
  15. package/common/deps/popup-manager.js +1 -0
  16. package/common/event.js +8 -1
  17. package/common/index.js +1 -1
  18. package/common/runtime.js +1 -1
  19. package/dialog-box/index.js +2 -2
  20. package/form/index.js +22 -0
  21. package/form/vue.js +9 -0
  22. package/form-item/index.js +24 -0
  23. package/form-item/vue.js +11 -2
  24. package/grid/utils/dom.js +2 -1
  25. package/image/index.js +38 -3
  26. package/image/vue.js +7 -2
  27. package/image-viewer/index.js +326 -41
  28. package/image-viewer/vue.js +63 -18
  29. package/nav-menu/index.js +96 -14
  30. package/nav-menu/vue.js +18 -8
  31. package/package.json +1 -1
  32. package/picker/vue.js +1 -1
  33. package/popover/vue.js +8 -3
  34. package/rich-text-edtior/index.js +4 -0
  35. package/rich-text-edtior/vue.js +14 -14
  36. package/search/index.js +4 -1
  37. package/search/vue.js +3 -3
  38. package/tabbar/index.js +35 -2
  39. package/tabbar/vue.js +35 -9
  40. package/tabbar-item/index.js +10 -5
  41. package/tabbar-item/vue.js +13 -8
  42. package/tag/index.js +1 -1
  43. package/types/anchor.type.d.mts +4 -0
  44. package/types/file-upload.type.d.mts +1 -1
  45. package/types/form-item.type.d.mts +1 -1
  46. package/types/{form.type-7fc7c2ad.d.ts → form.type-1e2e9272.d.ts} +31 -11
  47. package/types/form.type.d.mts +1 -1
  48. package/types/image.type.d.mts +37 -4
  49. package/types/nav-menu.type.d.mts +7 -1
  50. package/types/popover.type.d.mts +1 -0
  51. package/types/shared.type.d.mts +5 -5
  52. package/types/upload-dragger.type.d.mts +1 -1
  53. package/types/{upload-list.type-4dfd7aba.d.ts → upload-list.type-b934f279.d.ts} +8 -1
  54. package/types/upload-list.type.d.mts +1 -1
  55. package/types/upload.type.d.mts +1 -1
  56. package/upload/index.js +23 -0
  57. package/upload/vue.js +3 -0
  58. package/user/index.js +2 -1
  59. package/user/vue.js +1 -1
package/anchor/index.js CHANGED
@@ -30,10 +30,13 @@ const updateSkidPosition = ({ vm, state, emit }) => {
30
30
  const { currentLink } = state;
31
31
  const activeEl = vm.$refs[currentLink];
32
32
  const { skidRef, maskRef, anchorRef } = vm.$refs;
33
- if (!activeEl || !anchorRef) {
33
+ if (!activeEl) {
34
34
  return;
35
35
  }
36
36
  emit("onChange", currentLink);
37
+ if (!anchorRef || !skidRef || !maskRef) {
38
+ return;
39
+ }
37
40
  const { offsetHeight, offsetWidth } = activeEl;
38
41
  const { top: linkTitleClientTop, left: linkTitleClientLeft } = activeEl.getBoundingClientRect();
39
42
  const { top: anchorClientTop, left: anchorClientLeft } = anchorRef.getBoundingClientRect();
@@ -1,8 +1,6 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  const calcLeftByAlpha = (wrapper, thumb, alpha) => {
3
- return Math.round(
4
- alpha * (wrapper.offsetWidth - thumb.offsetWidth / 2) / 100
5
- );
3
+ return Math.round(alpha * (wrapper.offsetWidth - thumb.offsetWidth / 2) / 100);
6
4
  };
7
5
  const updateThumb = (alpha, thumb, wrapper) => {
8
6
  thumb.style.left = `${calcLeftByAlpha(wrapper, thumb, alpha)}px`;
@@ -13,9 +11,7 @@ const onDrag = (event, bar, thumb, alpha) => {
13
11
  let left = clientX - rect.left;
14
12
  left = Math.max(thumb.value.offsetWidth / 2, left);
15
13
  left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
16
- alpha.value = Math.round(
17
- (left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100
18
- );
14
+ alpha.value = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100);
19
15
  };
20
16
  export {
21
17
  calcLeftByAlpha,
@@ -14,13 +14,16 @@ const renderless = (props, context, { emit }) => {
14
14
  const alphaWrapper = context.ref();
15
15
  const alphaThumb = context.ref();
16
16
  const alpha = context.ref(color.get("a"));
17
- context.watch(() => props.color, (hex2) => {
18
- color.reset(hex2);
19
- const [rr2, gg2, bb2] = color.getRGB();
20
- r.value = rr2;
21
- g.value = gg2;
22
- b.value = bb2;
23
- });
17
+ context.watch(
18
+ () => props.color,
19
+ (hex2) => {
20
+ color.reset(hex2);
21
+ const [rr2, gg2, bb2] = color.getRGB();
22
+ r.value = rr2;
23
+ g.value = gg2;
24
+ b.value = bb2;
25
+ }
26
+ );
24
27
  context.watch(alpha, (newAlpha) => {
25
28
  updateThumb(newAlpha, alphaThumb.value, alphaWrapper.value);
26
29
  emit("alpha-update", alpha.value);
@@ -34,7 +37,6 @@ const renderless = (props, context, { emit }) => {
34
37
  });
35
38
  const api2 = {
36
39
  state,
37
- color: props.color,
38
40
  slider,
39
41
  alphaWrapper,
40
42
  alphaThumb
@@ -18,9 +18,7 @@ const updatePosition = (event, rect, cursor) => {
18
18
  const calcSaturation = (x, width) => x / width;
19
19
  const calcBrightness = (y, height) => 100 - y / height * 100;
20
20
  const getThumbTop = (wrapper, thumb, hue) => {
21
- return Math.round(
22
- hue * (wrapper.offsetHeight - thumb.offsetHeight / 2) / 360
23
- );
21
+ return Math.round(hue * (wrapper.offsetHeight - thumb.offsetHeight / 2) / 360);
24
22
  };
25
23
  const resetCursor = (s, v, wrapper, cursor, thumb, color, h) => {
26
24
  const { width, height } = wrapper.value.getBoundingClientRect();
@@ -53,9 +51,7 @@ const updateThumb = (bar, thumb, h, emit) => {
53
51
  top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
54
52
  top = Math.max(thumb.value.offsetHeight / 2, top);
55
53
  thumb.value.style.top = `${top}px`;
56
- h.value = Math.round(
57
- (top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360
58
- );
54
+ h.value = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
59
55
  emit("hue-update", h.value);
60
56
  };
61
57
  };
@@ -1,12 +1,7 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  import { draggable } from "../utils/use-drag";
3
3
  import Color from "../utils/color";
4
- import {
5
- getThumbTop,
6
- resetCursor,
7
- updateThumb,
8
- updateCursor
9
- } from "./index";
4
+ import { getThumbTop, resetCursor, updateThumb, updateCursor } from "./index";
10
5
  const api = ["state", "cursor", "wrapper", "bar", "thumb"];
11
6
  const renderless = (props, context, { emit }) => {
12
7
  const cursor = context.ref();
@@ -22,10 +17,13 @@ const renderless = (props, context, { emit }) => {
22
17
  background
23
18
  });
24
19
  const api2 = { state, cursor, wrapper, bar, thumb };
25
- context.watch(() => props.color, (newColor) => {
26
- color.reset(newColor);
27
- resetCursor(color.get("s"), color.get("v"), wrapper, cursor, thumb, color, h);
28
- });
20
+ context.watch(
21
+ () => props.color,
22
+ (newColor) => {
23
+ color.reset(newColor);
24
+ resetCursor(color.get("s"), color.get("v"), wrapper, cursor, thumb, color, h);
25
+ }
26
+ );
29
27
  context.onMounted(() => {
30
28
  const update = {
31
29
  thumb: updateThumb(bar, thumb, h, emit),
@@ -33,15 +31,7 @@ const renderless = (props, context, { emit }) => {
33
31
  };
34
32
  const thumbTop = getThumbTop(wrapper.value, thumb.value, h.value);
35
33
  thumb.value.style.top = `${thumbTop}px`;
36
- resetCursor(
37
- color.get("s"),
38
- color.get("v"),
39
- wrapper,
40
- cursor,
41
- thumb,
42
- color,
43
- h
44
- );
34
+ resetCursor(color.get("s"), color.get("v"), wrapper, cursor, thumb, color, h);
45
35
  draggable(wrapper.value, {
46
36
  drag(event) {
47
37
  update.cursor(color, event);
@@ -52,8 +52,7 @@ const renderless = (props, context, { emit }) => {
52
52
  onConfirm: onConfirm(hex, triggerBg, res, emit, isShow),
53
53
  onCancel: onCancel(res, triggerBg, emit, isShow, hex, color),
54
54
  onAlphaUpdate: update,
55
- cursor,
56
- alpha: props.alpha
55
+ cursor
57
56
  };
58
57
  return api2;
59
58
  };
@@ -1,8 +1,6 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  const calcLeftByAlpha = (wrapper, thumb, alpha) => {
3
- return Math.round(
4
- alpha * (wrapper.offsetWidth - thumb.offsetWidth / 2) / 100
5
- );
3
+ return Math.round(alpha * (wrapper.offsetWidth - thumb.offsetWidth / 2) / 100);
6
4
  };
7
5
  const updateThumb = (alpha, thumb, wrapper) => {
8
6
  thumb.style.left = `${calcLeftByAlpha(wrapper, thumb, alpha)}px`;
@@ -13,9 +11,7 @@ const onDrag = (event, bar, thumb, alpha) => {
13
11
  let left = clientX - rect.left;
14
12
  left = Math.max(thumb.value.offsetWidth / 2, left);
15
13
  left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
16
- alpha.value = Math.round(
17
- (left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100
18
- );
14
+ alpha.value = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100);
19
15
  };
20
16
  export {
21
17
  calcLeftByAlpha,
@@ -14,14 +14,17 @@ const renderless = (props, context, { emit }) => {
14
14
  const alphaWrapper = context.ref();
15
15
  const alphaThumb = context.ref();
16
16
  const alpha = context.ref(color.get("a"));
17
- context.watch(() => props.color, (hex2) => {
18
- color.reset(hex2);
19
- const [rr2, gg2, bb2] = color.getRGB();
20
- r.value = rr2;
21
- g.value = gg2;
22
- b.value = bb2;
23
- alpha.value = color.get("a");
24
- });
17
+ context.watch(
18
+ () => props.color,
19
+ (hex2) => {
20
+ color.reset(hex2);
21
+ const [rr2, gg2, bb2] = color.getRGB();
22
+ r.value = rr2;
23
+ g.value = gg2;
24
+ b.value = bb2;
25
+ alpha.value = color.get("a");
26
+ }
27
+ );
25
28
  context.watch(alpha, (newAlpha) => {
26
29
  updateThumb(newAlpha, alphaThumb.value, alphaWrapper.value);
27
30
  emit("alpha-update", alpha.value);
@@ -35,7 +38,6 @@ const renderless = (props, context, { emit }) => {
35
38
  });
36
39
  const api2 = {
37
40
  state,
38
- color: props.color,
39
41
  slider,
40
42
  alphaWrapper,
41
43
  alphaThumb
@@ -18,9 +18,7 @@ const updatePosition = (event, rect, cursor) => {
18
18
  const calcSaturation = (x, width) => x / width;
19
19
  const calcBrightness = (y, height) => 100 - y / height * 100;
20
20
  const getThumbTop = (wrapper, thumb, hue) => {
21
- return Math.round(
22
- hue * (wrapper.offsetHeight - thumb.offsetHeight / 2) / 360
23
- );
21
+ return Math.round(hue * (wrapper.offsetHeight - thumb.offsetHeight / 2) / 360);
24
22
  };
25
23
  const resetCursor = (s, v, wrapper, cursor, thumb, color, h) => {
26
24
  const { width, height } = wrapper.value.getBoundingClientRect();
@@ -53,9 +51,7 @@ const updateThumb = (bar, thumb, h, emit) => {
53
51
  top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
54
52
  top = Math.max(thumb.value.offsetHeight / 2, top);
55
53
  thumb.value.style.top = `${top}px`;
56
- h.value = Math.round(
57
- (top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360
58
- );
54
+ h.value = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
59
55
  emit("hue-update", h.value);
60
56
  };
61
57
  };
@@ -1,12 +1,7 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  import { draggable } from "../utils/use-drag";
3
3
  import Color from "../utils/color";
4
- import {
5
- getThumbTop,
6
- resetCursor,
7
- updateThumb,
8
- updateCursor
9
- } from "./index";
4
+ import { getThumbTop, resetCursor, updateThumb, updateCursor } from "./index";
10
5
  const api = ["state", "cursor", "wrapper", "bar", "thumb"];
11
6
  const renderless = (props, context, { emit }) => {
12
7
  const cursor = context.ref();
@@ -22,10 +17,13 @@ const renderless = (props, context, { emit }) => {
22
17
  background
23
18
  });
24
19
  const api2 = { state, cursor, wrapper, bar, thumb };
25
- context.watch(() => props.color, (newColor) => {
26
- color.reset(newColor);
27
- resetCursor(color.get("s"), color.get("v"), wrapper, cursor, thumb, color, h);
28
- });
20
+ context.watch(
21
+ () => props.color,
22
+ (newColor) => {
23
+ color.reset(newColor);
24
+ resetCursor(color.get("s"), color.get("v"), wrapper, cursor, thumb, color, h);
25
+ }
26
+ );
29
27
  context.onMounted(() => {
30
28
  const update = {
31
29
  thumb: updateThumb(bar, thumb, h, emit),
@@ -33,15 +31,7 @@ const renderless = (props, context, { emit }) => {
33
31
  };
34
32
  const thumbTop = getThumbTop(wrapper.value, thumb.value, h.value);
35
33
  thumb.value.style.top = `${thumbTop}px`;
36
- resetCursor(
37
- color.get("s"),
38
- color.get("v"),
39
- wrapper,
40
- cursor,
41
- thumb,
42
- color,
43
- h
44
- );
34
+ resetCursor(color.get("s"), color.get("v"), wrapper, cursor, thumb, color, h);
45
35
  draggable(wrapper.value, {
46
36
  drag(event) {
47
37
  update.cursor(color, event);
@@ -4,7 +4,11 @@ const onConfirm = (hex, triggerBg, res, emit, stack, enableHistory) => {
4
4
  hex.value = res.value;
5
5
  triggerBg.value = res.value;
6
6
  if (enableHistory) {
7
- const itemIdx = Math.max(stack.value.indexOf(res.value), stack.value.indexOf(res.value.toLowerCase()), stack.value.indexOf(res.value.toUpperCase()));
7
+ const itemIdx = Math.max(
8
+ stack.value.indexOf(res.value),
9
+ stack.value.indexOf(res.value.toLowerCase()),
10
+ stack.value.indexOf(res.value.toUpperCase())
11
+ );
8
12
  if (itemIdx !== -1) {
9
13
  stack.value.splice(itemIdx, 1);
10
14
  }
@@ -1,13 +1,6 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import Color from "./utils/color";
3
- import {
4
- onConfirm,
5
- onCancel,
6
- onHSVUpdate,
7
- onAlphaUpdate,
8
- handleHistoryClick,
9
- handlePredefineClick
10
- } from ".";
3
+ import { onConfirm, onCancel, onHSVUpdate, onAlphaUpdate, handleHistoryClick, handlePredefineClick } from ".";
11
4
  const api = [
12
5
  "state",
13
6
  "changeVisible",
@@ -19,8 +12,7 @@ const api = [
19
12
  "onCancel",
20
13
  "onAlphaUpdate",
21
14
  "onHistoryClick",
22
- "onPredefineColorClick",
23
- "alpha"
15
+ "onPredefineColorClick"
24
16
  ];
25
17
  const renderless = (props, context, { emit }) => {
26
18
  var _a, _b, _c, _d, _e, _f;
@@ -30,12 +22,8 @@ const renderless = (props, context, { emit }) => {
30
22
  const triggerBg = context.ref((_c = modelValue == null ? void 0 : modelValue.value) != null ? _c : "transparent");
31
23
  const isShow = context.ref((_d = visible == null ? void 0 : visible.value) != null ? _d : false);
32
24
  const cursor = context.ref();
33
- const stack = context.ref(
34
- [...(_e = history == null ? void 0 : history.value) != null ? _e : []]
35
- );
36
- const predefineStack = context.ref(
37
- [...(_f = predefine == null ? void 0 : predefine.value) != null ? _f : []]
38
- );
25
+ const stack = context.ref([...(_e = history == null ? void 0 : history.value) != null ? _e : []]);
26
+ const predefineStack = context.ref([...(_f = predefine == null ? void 0 : predefine.value) != null ? _f : []]);
39
27
  const enableHistory = history == null ? void 0 : history.value;
40
28
  const enablePredefineColor = predefine == null ? void 0 : predefine.value;
41
29
  const changeVisible = (state2) => {
@@ -54,12 +42,20 @@ const renderless = (props, context, { emit }) => {
54
42
  enableHistory,
55
43
  enablePredefineColor
56
44
  });
57
- context.watch(predefine, (newPredefine) => {
58
- predefineStack.value = [...newPredefine];
59
- }, { deep: true });
60
- context.watch(history, (newHistory) => {
61
- stack.value = [...newHistory];
62
- }, { deep: true });
45
+ context.watch(
46
+ predefine,
47
+ (newPredefine) => {
48
+ predefineStack.value = [...newPredefine];
49
+ },
50
+ { deep: true }
51
+ );
52
+ context.watch(
53
+ history,
54
+ (newHistory) => {
55
+ stack.value = [...newHistory];
56
+ },
57
+ { deep: true }
58
+ );
63
59
  context.watch(modelValue, (newValue) => {
64
60
  hex.value = newValue;
65
61
  res.value = newValue;
@@ -81,8 +77,7 @@ const renderless = (props, context, { emit }) => {
81
77
  onAlphaUpdate: update,
82
78
  onHistoryClick: handleHistoryClick(hex, res, color),
83
79
  onPredefineColorClick: handlePredefineClick(hex, res, color),
84
- cursor,
85
- alpha: props.alpha
80
+ cursor
86
81
  };
87
82
  return api2;
88
83
  };
@@ -64,7 +64,7 @@ class FastDom {
64
64
  }
65
65
  extend(props) {
66
66
  if (!props || typeof props !== "object")
67
- throw new Error("[AUI][FastDom] expected object");
67
+ throw new Error("[TINY][FastDom] expected object");
68
68
  const child = Object.create(this);
69
69
  mixin(child, props);
70
70
  child.fastdom = this;
@@ -85,14 +85,17 @@ const getScrollParent = (el) => {
85
85
  };
86
86
  const getOffsetRectRelativeToCustomParent = (el, parent, fixed) => {
87
87
  let { top, left, width, height } = getBoundingClientRect(el);
88
- let parentRect = getBoundingClientRect(parent);
89
88
  if (fixed) {
90
- let { scrollTop, scrollLeft } = getScrollParent(parent);
91
- parentRect.top += scrollTop;
92
- parentRect.bottom += scrollTop;
93
- parentRect.left += scrollLeft;
94
- parentRect.right += scrollLeft;
89
+ return {
90
+ top,
91
+ left,
92
+ bottom: top + height,
93
+ right: left + width,
94
+ width,
95
+ height
96
+ };
95
97
  }
98
+ let parentRect = getBoundingClientRect(parent);
96
99
  let rect = {
97
100
  top: top - parentRect.top,
98
101
  left: left - parentRect.left,
@@ -137,6 +140,9 @@ const getAllScrollParents = (el, parents = []) => {
137
140
  const parent = el.parentNode;
138
141
  if (parent) {
139
142
  isScrollElement(parent) && parents.push(parent);
143
+ if (getStyleComputedProperty(parent, "position") === "fixed") {
144
+ return parents;
145
+ }
140
146
  return getAllScrollParents(parent, parents);
141
147
  }
142
148
  return parents;
@@ -483,10 +489,11 @@ class Popper {
483
489
  let isFixed2 = data.offsets.popper.position === "fixed";
484
490
  let scrollTop = isFixed2 ? 0 : getScrollTopValue(scrollParent);
485
491
  let scrollLeft = isFixed2 ? 0 : getScrollLeftValue(scrollParent);
492
+ const viewportWindow = PopupManager.viewportWindow || window;
486
493
  boundaries = {
487
494
  top: 0 - (offsetParentRect.top - scrollTop),
488
- right: window.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
489
- bottom: window.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
495
+ right: viewportWindow.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
496
+ bottom: viewportWindow.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
490
497
  left: 0 - (offsetParentRect.left - scrollLeft)
491
498
  };
492
499
  } else {
@@ -30,6 +30,7 @@ const PopupManager = {
30
30
  // 当前是否有Modal
31
31
  popLockClass: "popup-parent--hidden",
32
32
  oldBodyBorder: "",
33
+ viewportWindow: null,
33
34
  fixBodyBorder() {
34
35
  const barWidth = window.innerWidth - document.documentElement.clientWidth;
35
36
  if (barWidth) {
package/common/event.js CHANGED
@@ -13,6 +13,13 @@ const emitEvent = (emit, name, ...args) => {
13
13
  }
14
14
  return !cancel;
15
15
  };
16
+ const getActualTarget = (e) => {
17
+ if (!e || !e.target) {
18
+ return null;
19
+ }
20
+ return e.target.shadowRoot && e.composed ? e.composedPath()[0] || e.target : e.target;
21
+ };
16
22
  export {
17
- emitEvent
23
+ emitEvent,
24
+ getActualTarget
18
25
  };
package/common/index.js CHANGED
@@ -224,7 +224,7 @@ const CASCADER = {
224
224
  PropsHover: "hoverThreshold",
225
225
  MenuConnector: "cascader-menu-"
226
226
  };
227
- const version = "3.11.0-alpha.0";
227
+ const version = "3.11.0";
228
228
  const log = (data, type = "log") => {
229
229
  uLog.logger[type](data);
230
230
  };
package/common/runtime.js CHANGED
@@ -22,7 +22,7 @@ import vuePopup from "./deps/vue-popup";
22
22
  import validate from "./validate";
23
23
  import memorize from "./deps/memorize";
24
24
  import * as common from ".";
25
- const version = "3.11.0-alpha.0";
25
+ const version = "3.11.0";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
@@ -193,8 +193,8 @@ const handleDrag = ({ parent, props, state, emit }) => (event) => {
193
193
  }
194
194
  let offsetWidth = modalBoxElem.offsetWidth;
195
195
  let offsetHeight = modalBoxElem.offsetHeight;
196
- let maxX = visibleWidth - offsetWidth;
197
- let maxY = visibleHeight - offsetHeight;
196
+ let maxX = Math.max(visibleWidth - offsetWidth, 0);
197
+ let maxY = Math.max(visibleHeight - offsetHeight, 0);
198
198
  let left = event2.clientX - disX;
199
199
  let top = event2.clientY - disY;
200
200
  left = left < 0 ? 0 : left > maxX ? maxX : left;
package/form/index.js CHANGED
@@ -24,6 +24,25 @@ const computedHideRequiredAsterisk = ({ props, designConfig }) => () => {
24
24
  var _a, _b;
25
25
  return (_b = (_a = props.hideRequiredAsterisk) != null ? _a : designConfig == null ? void 0 : designConfig.hideRequiredAsterisk) != null ? _b : false;
26
26
  };
27
+ const computedValidateIcon = ({ props, designConfig }) => () => {
28
+ var _a, _b, _c;
29
+ return (_c = (_b = props.validateIcon) != null ? _b : (_a = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _a.validateIcon) != null ? _c : null;
30
+ };
31
+ const computedIsErrorInline = ({ props, designConfig }) => () => {
32
+ if (props.messageType) {
33
+ return props.messageType === "inline";
34
+ }
35
+ if (typeof props.inlineMessage === "boolean") {
36
+ return props.inlineMessage;
37
+ }
38
+ return (designConfig == null ? void 0 : designConfig.messageType) === "inline" || false;
39
+ };
40
+ const computedIsErrorBlock = ({ props, designConfig }) => () => {
41
+ if (props.messageType) {
42
+ return props.messageType === "block";
43
+ }
44
+ return (designConfig == null ? void 0 : designConfig.messageType) === "block" || false;
45
+ };
27
46
  const created = ({ parent, state }) => () => {
28
47
  parent.$on("form:addField", (field) => {
29
48
  if (field) {
@@ -166,6 +185,9 @@ export {
166
185
  clearValidate,
167
186
  computedAutoLabelWidth,
168
187
  computedHideRequiredAsterisk,
188
+ computedIsErrorBlock,
189
+ computedIsErrorInline,
190
+ computedValidateIcon,
169
191
  created,
170
192
  deregisterLabelWidth,
171
193
  getLabelWidthIndex,
package/form/vue.js CHANGED
@@ -3,6 +3,9 @@ import {
3
3
  watchRules,
4
4
  computedAutoLabelWidth,
5
5
  computedHideRequiredAsterisk,
6
+ computedValidateIcon,
7
+ computedIsErrorInline,
8
+ computedIsErrorBlock,
6
9
  created,
7
10
  resetFields,
8
11
  clearValidate,
@@ -41,6 +44,9 @@ const renderless = (props, { computed, inject, provide, reactive, watch, onBefor
41
44
  potentialLabelWidthArr: [],
42
45
  autoLabelWidth: computed(() => api2.computedAutoLabelWidth()),
43
46
  hideRequiredAsterisk: computed(() => api2.computedHideRequiredAsterisk()),
47
+ validateIcon: computed(() => api2.computedValidateIcon()),
48
+ isErrorInline: computed(() => api2.computedIsErrorInline()),
49
+ isErrorBlock: computed(() => api2.computedIsErrorBlock()),
44
50
  isDisplayOnly: computed(() => props.displayOnly),
45
51
  hasRequired: computed(() => {
46
52
  if (props.rules) {
@@ -61,6 +67,9 @@ const renderless = (props, { computed, inject, provide, reactive, watch, onBefor
61
67
  updateTip: updateTip({ props, state }),
62
68
  computedAutoLabelWidth: computedAutoLabelWidth({ state }),
63
69
  computedHideRequiredAsterisk: computedHideRequiredAsterisk({ props, designConfig }),
70
+ computedValidateIcon: computedValidateIcon({ props, designConfig }),
71
+ computedIsErrorInline: computedIsErrorInline({ props, designConfig }),
72
+ computedIsErrorBlock: computedIsErrorBlock({ props, designConfig }),
64
73
  created: created({ parent, state }),
65
74
  resetFields: resetFields({ props, state }),
66
75
  clearValidate: clearValidate(state),
@@ -16,6 +16,27 @@ const watchValidateStatus = (state) => (value) => {
16
16
  state.validateState = value;
17
17
  };
18
18
  const computedGetValidateType = ({ props, state }) => () => props.validateType || (state.formInstance ? state.formInstance.validateType : "");
19
+ const computedValidateIcon = ({ props, state }) => () => {
20
+ var _a, _b, _c, _d;
21
+ return (_d = (_c = props.validateIcon) != null ? _c : (_b = (_a = state == null ? void 0 : state.formInstance) == null ? void 0 : _a.state) == null ? void 0 : _b.validateIcon) != null ? _d : null;
22
+ };
23
+ const computedIsErrorInline = ({ props, state }) => () => {
24
+ var _a, _b, _c;
25
+ if (props.messageType) {
26
+ return props.messageType === "inline";
27
+ }
28
+ if (typeof props.inlineMessage === "boolean") {
29
+ return props.inlineMessage;
30
+ }
31
+ return (_c = (_b = (_a = state == null ? void 0 : state.formInstance) == null ? void 0 : _a.state) == null ? void 0 : _b.isErrorInline) != null ? _c : false;
32
+ };
33
+ const computedIsErrorBlock = ({ props, state }) => () => {
34
+ var _a, _b, _c;
35
+ if (props.messageType) {
36
+ return props.messageType === "block";
37
+ }
38
+ return (_c = (_b = (_a = state == null ? void 0 : state.formInstance) == null ? void 0 : _a.state) == null ? void 0 : _b.isErrorBlock) != null ? _c : false;
39
+ };
19
40
  const computedLabelStyle = ({ props, state }) => () => {
20
41
  const result = { width: "" };
21
42
  if (state.form.labelPosition === POSITION.Top) {
@@ -343,8 +364,11 @@ export {
343
364
  computedFieldValue,
344
365
  computedForm,
345
366
  computedGetValidateType,
367
+ computedIsErrorBlock,
368
+ computedIsErrorInline,
346
369
  computedIsRequired,
347
370
  computedLabelStyle,
371
+ computedValidateIcon,
348
372
  computedValueStyle,
349
373
  getDisplayedValue,
350
374
  getFilteredRule,
package/form-item/vue.js CHANGED
@@ -21,6 +21,9 @@ import {
21
21
  computedIsRequired,
22
22
  computedFieldValue,
23
23
  computedGetValidateType,
24
+ computedValidateIcon,
25
+ computedIsErrorInline,
26
+ computedIsErrorBlock,
24
27
  updateTip,
25
28
  wrapValidate,
26
29
  getDisplayedValue,
@@ -85,12 +88,15 @@ const initState = ({
85
88
  isDisplayOnly: computed(() => state.formInstance.displayOnly),
86
89
  labelPosition: computed(() => state.formInstance.labelPosition),
87
90
  hideRequiredAsterisk: computed(() => state.formInstance.state.hideRequiredAsterisk),
91
+ // isErrorInline: computed(() => state.formInstance.state.isErrorInline),
88
92
  labelSuffix: computed(() => state.formInstance.labelSuffix),
89
93
  labelWidth: computed(() => state.formInstance.labelWidth),
90
94
  showMessage: computed(() => state.formInstance.showMessage),
91
- inlineMessage: computed(() => state.formInstance.inlineMessage),
92
95
  sizeClass: computed(() => state.formItemSize),
93
- getValidateType: computed(() => api2.computedGetValidateType())
96
+ getValidateType: computed(() => api2.computedGetValidateType()),
97
+ validateIcon: computed(() => api2.computedValidateIcon()),
98
+ isErrorInline: computed(() => api2.computedIsErrorInline()),
99
+ isErrorBlock: computed(() => api2.computedIsErrorBlock())
94
100
  });
95
101
  return state;
96
102
  };
@@ -108,6 +114,9 @@ const initApi = ({ api: api2, state, dispatch, broadcast, refs, props, constants
108
114
  computedForm: computedForm({ constants, instance, state }),
109
115
  computedFieldValue: computedFieldValue({ props, state }),
110
116
  computedGetValidateType: computedGetValidateType({ props, state }),
117
+ computedValidateIcon: computedValidateIcon({ props, state }),
118
+ computedIsErrorInline: computedIsErrorInline({ props, state }),
119
+ computedIsErrorBlock: computedIsErrorBlock({ props, state }),
111
120
  clearValidate: clearValidate(state),
112
121
  getRules: getRules({ props, state }),
113
122
  updateComputedLabelWidth: updateComputedLabelWidth(state),
package/grid/utils/dom.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  import { getRowid } from "./common";
3
3
  import { hasClass } from "../../common/deps/dom";
4
+ import { getActualTarget } from "../../common/event";
4
5
  import { arrayIndexOf } from "../static";
5
6
  const ATTR_NAME = "data-rowid";
6
7
  const CELL_CLS = ".tiny-grid-cell";
@@ -107,7 +108,7 @@ const getDomNode = () => {
107
108
  };
108
109
  const getEventTargetNode = (event, container, queryCls) => {
109
110
  let targetEl;
110
- let target = event.target;
111
+ let target = getActualTarget(event);
111
112
  while (target && target.nodeType && target !== document) {
112
113
  if (queryCls && hasClass(target, queryCls)) {
113
114
  targetEl = target;