@opentiny/vue-renderless 3.8.3 → 3.9.0

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 (65) hide show
  1. package/action-sheet/index.js +1 -1
  2. package/action-sheet/vue.js +12 -12
  3. package/alert/index.js +2 -2
  4. package/alert/vue.js +3 -3
  5. package/anchor/index.js +40 -23
  6. package/anchor/vue.js +5 -2
  7. package/button-group/index.js +6 -0
  8. package/button-group/vue.js +10 -5
  9. package/carousel/index.js +18 -20
  10. package/carousel/vue.js +29 -5
  11. package/carousel-item/index.js +2 -1
  12. package/carousel-item/vue.js +14 -2
  13. package/cascader/index.js +110 -11
  14. package/cascader/vue.js +35 -12
  15. package/chart-heatmap/index.js +12 -12
  16. package/checkbox/index.js +19 -6
  17. package/checkbox/vue.js +38 -20
  18. package/common/bigInt.js +2 -1
  19. package/common/browser.js +43 -37
  20. package/common/deps/ResizeObserver.js +2 -2
  21. package/common/deps/popper.js +26 -24
  22. package/common/index.js +1 -1
  23. package/common/runtime.js +1 -1
  24. package/common/validate/util.js +3 -2
  25. package/drawer/index.js +16 -1
  26. package/drawer/vue.js +14 -3
  27. package/dropdown-item/mf.js +1 -1
  28. package/dropdown-menu/index.js +3 -0
  29. package/dropdown-menu/vue.js +20 -2
  30. package/file-upload/index.js +0 -1
  31. package/grid/utils/column.js +1 -0
  32. package/grid/utils/dom.js +2 -2
  33. package/image/vue.js +12 -1
  34. package/input/index.js +15 -3
  35. package/input/vue.js +34 -8
  36. package/ip-address/index.js +4 -4
  37. package/month-table/index.js +5 -2
  38. package/numeric/index.js +6 -3
  39. package/numeric/vue.js +1 -1
  40. package/package.json +8 -1
  41. package/pager/vue.js +2 -2
  42. package/popconfirm/index.js +1 -0
  43. package/popconfirm/vue.js +4 -2
  44. package/popover/index.js +19 -12
  45. package/popover/vue.js +15 -5
  46. package/progress/index.js +44 -6
  47. package/progress/vue.js +15 -4
  48. package/radio/index.js +2 -0
  49. package/radio/vue.js +3 -0
  50. package/record/index.js +166 -59
  51. package/record/vue.js +31 -14
  52. package/roles/index.js +5 -5
  53. package/roles/vue.js +1 -1
  54. package/slider/index.js +3 -1
  55. package/steps/index.js +8 -0
  56. package/steps/vue.js +3 -2
  57. package/switch/vue.js +9 -2
  58. package/tabs-mf/vue-bar.js +1 -1
  59. package/text-popup/vue.js +2 -1
  60. package/time-line/index.js +8 -0
  61. package/time-line/vue.js +2 -1
  62. package/tooltip/index.js +35 -25
  63. package/tooltip/vue.js +1 -1
  64. package/tree/index.js +1 -1
  65. package/user-head/vue.js +8 -1
@@ -8,6 +8,13 @@ const getStatus = ({ state, t }) => (value) => {
8
8
  const status = state.current - value;
9
9
  return status > 0 ? t("ui.steps.done") : status === 0 ? t("ui.steps.doing") : t("ui.steps.wait");
10
10
  };
11
+ const computedSpace = ({ props }) => {
12
+ const { space } = props;
13
+ if (/^\d+$/.test(space)) {
14
+ return `${space}px`;
15
+ }
16
+ return space;
17
+ };
11
18
  const handleClick = ({ emit, state }) => ({ index, node }) => {
12
19
  if (!node.disabled) {
13
20
  emit("click", state.isReverse ? state.nodes.length - index - 1 : index, node);
@@ -47,6 +54,7 @@ export {
47
54
  computedCurrent,
48
55
  computedData,
49
56
  computedIsReverse,
57
+ computedSpace,
50
58
  computedStackNodes,
51
59
  getDate,
52
60
  getStatus,
package/time-line/vue.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { handleClick, getStatusCls, getStatus, computedData, getDate, computedCurrent, computedIsReverse, changeStatus, computedStackNodes } from "./index";
2
+ import { handleClick, getStatusCls, getStatus, computedData, getDate, computedCurrent, computedIsReverse, changeStatus, computedStackNodes, computedSpace } from "./index";
3
3
  const api = ["state", "handleClick", "getStatusCls", "getStatus", "getDate", "changeStatus"];
4
4
  const renderless = (props, { computed, reactive }, { t, emit, constants }) => {
5
5
  const api2 = {};
@@ -8,6 +8,7 @@ const renderless = (props, { computed, reactive }, { t, emit, constants }) => {
8
8
  current: computed(() => api2.computedCurrent()),
9
9
  isReverse: computed(() => api2.computedIsReverse()),
10
10
  stackNodes: computed(() => state.showAll ? state.nodes : api2.computedStackNodes()),
11
+ computedSpace: computed(() => computedSpace({ props })),
11
12
  showData: false,
12
13
  showAll: false
13
14
  });
package/tooltip/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import debounce from "../common/deps/debounce";
3
3
  import { on, off, addClass, removeClass } from "../common/deps/dom";
4
- const show = ({ api, state, props }) => () => {
4
+ const show = ({ api, state, props }) => (event) => {
5
+ const defaultDelay = 200;
6
+ const delay = event && event.type === "mouseenter" ? defaultDelay : 0;
5
7
  if (props.visible === "auto") {
6
8
  const { clientWidth, scrollWidth } = state.referenceElm;
7
9
  if (scrollWidth <= clientWidth) {
@@ -9,7 +11,7 @@ const show = ({ api, state, props }) => () => {
9
11
  }
10
12
  }
11
13
  api.setExpectedState(true);
12
- api.handleShowPopper();
14
+ api.handleShowPopper(delay);
13
15
  };
14
16
  const hide = (api) => () => {
15
17
  api.setExpectedState(false);
@@ -23,17 +25,18 @@ const handleBlur = ({ api, state }) => () => {
23
25
  state.focusing = false;
24
26
  api.hide();
25
27
  };
26
- const removeFocusing = (state) => () => {
28
+ const removeFocusing = ({ api, state }) => () => {
27
29
  state.focusing = false;
30
+ api.show();
28
31
  };
29
- const handleShowPopper = ({ props, state }) => () => {
32
+ const handleShowPopper = ({ props, state }) => (delay) => {
30
33
  if (!state.expectedState || props.manual) {
31
34
  return;
32
35
  }
33
36
  clearTimeout(state.timeout);
34
37
  state.timeout = setTimeout(() => {
35
38
  state.showPopper = true;
36
- }, props.openDelay);
39
+ }, props.openDelay || delay);
37
40
  if (props.hideAfter > 0) {
38
41
  state.timeoutPending = setTimeout(() => {
39
42
  state.showPopper = false;
@@ -53,6 +56,19 @@ const handleClosePopper = ({ api, props, state }) => () => {
53
56
  api.doDestroy();
54
57
  }
55
58
  };
59
+ const handleDocumentClick = ({ props, api, state, popperVmRef }) => (event) => {
60
+ if (props.manual)
61
+ return;
62
+ const reference = state.referenceElm;
63
+ const $el = popperVmRef.popper;
64
+ if (!$el || !reference || $el.contains(event.target) || reference.contains(event.target)) {
65
+ return;
66
+ }
67
+ if (state.showPopper) {
68
+ api.setExpectedState(false);
69
+ api.debounceClose();
70
+ }
71
+ };
56
72
  const setExpectedState = ({ api, state }) => (value) => {
57
73
  if (state.expectedState === false) {
58
74
  clearTimeout(api.timeoutPending);
@@ -63,12 +79,18 @@ const destroyed = ({ state, api }) => () => {
63
79
  const reference = state.referenceElm;
64
80
  state.showPopper = false;
65
81
  if (reference && reference.nodeType === 1) {
82
+ off(document, "click", api.handleDocumentClick);
66
83
  off(reference, "mouseenter", api.show);
67
84
  off(reference, "mouseleave", api.hide);
68
85
  off(reference, "focus", api.focusHandler);
69
86
  off(reference, "blur", api.handleBlur);
70
87
  off(reference, "click", api.removeFocusing);
71
88
  }
89
+ state.poppers.forEach((popper, i) => {
90
+ typeof popper.$destroy === "function" && popper.$destroy();
91
+ state.poppers[i] = null;
92
+ });
93
+ state.poppers.length = 0;
72
94
  };
73
95
  const debounceClose = ({ api, props }) => debounce(props.closeDelay, () => {
74
96
  api.handleClosePopper();
@@ -106,12 +128,20 @@ const bindEvent = ({ api, state, vm }) => (reference) => {
106
128
  state.referenceElm = referenceElm;
107
129
  referenceElm.setAttribute("aria-describedby", state.tooltipId);
108
130
  referenceElm.setAttribute("tabindex", state.tabindex);
131
+ on(document, "click", api.handleDocumentClick);
109
132
  on(referenceElm, "mouseenter", api.show);
110
133
  on(referenceElm, "mouseleave", api.hide);
111
134
  on(referenceElm, "focus", api.focusHandler);
112
135
  on(referenceElm, "blur", api.handleBlur);
113
136
  on(referenceElm, "click", api.removeFocusing);
114
137
  };
138
+ const observeCallback = ({ state, popperVmRef }) => (mutationsList) => {
139
+ for (let mutation of mutationsList) {
140
+ if (mutation.type === "attributes" && mutation.attributeName === "x-placement") {
141
+ state.xPlacement = popperVmRef.popper.getAttribute("x-placement") || "bottom";
142
+ }
143
+ }
144
+ };
115
145
  const bindPopper = ({ vm, refs, nextTick, popperVmRef }) => (el) => {
116
146
  nextTick(() => vm.bindEvent(el));
117
147
  if (vm.popperVM) {
@@ -128,26 +158,6 @@ const bindPopper = ({ vm, refs, nextTick, popperVmRef }) => (el) => {
128
158
  });
129
159
  }
130
160
  };
131
- const observeCallback = ({ state, popperVmRef }) => (mutationsList) => {
132
- for (let mutation of mutationsList) {
133
- if (mutation.type === "attributes" && mutation.attributeName === "x-placement") {
134
- state.xPlacement = popperVmRef.popper.getAttribute("x-placement") || "bottom";
135
- }
136
- }
137
- };
138
- const handleDocumentClick = ({ props, api, state, popperVmRef }) => (event) => {
139
- if (props.manual)
140
- return;
141
- const reference = state.referenceElm;
142
- const $el = popperVmRef.popper;
143
- if (!$el || !reference || $el.contains(event.target) || reference.contains(event.target)) {
144
- return;
145
- }
146
- if (state.showPopper) {
147
- api.setExpectedState(false);
148
- api.debounceClose();
149
- }
150
- };
151
161
  export {
152
162
  bindEvent,
153
163
  bindPopper,
package/tooltip/vue.js CHANGED
@@ -66,7 +66,7 @@ const renderless = (props, { watch, toRefs, reactive, onBeforeUnmount, onDeactiv
66
66
  destroyed: destroyed({ state, api: api2 }),
67
67
  bindPopper: bindPopper({ vm, refs, nextTick, popperVmRef }),
68
68
  watchFocusing: watchFocusing(state),
69
- removeFocusing: removeFocusing(state),
69
+ removeFocusing: removeFocusing({ api: api2, state }),
70
70
  handleBlur: handleBlur({ api: api2, state }),
71
71
  handleFocus: handleFocus({ api: api2, state }),
72
72
  debounceClose: debounceClose({ api: api2, props }),
package/tree/index.js CHANGED
@@ -354,7 +354,7 @@ const initTabIndex = ({ vm, state }) => () => {
354
354
  };
355
355
  const handleKeydown = ({ vm, state }) => (event2) => {
356
356
  const currentItem = event2.target;
357
- if (!currentItem.className.includes("tiny-tree-node")) {
357
+ if (!JSON.stringify(currentItem.className).includes("tiny-tree-node")) {
358
358
  return;
359
359
  }
360
360
  const keyCode = event2.keyCode;
package/user-head/vue.js CHANGED
@@ -1,5 +1,12 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { computedMessage, computedStyle, computedFontSize, computedLabel, getInternalValue, computedSize } from "./index";
2
+ import {
3
+ computedMessage,
4
+ computedStyle,
5
+ computedFontSize,
6
+ computedLabel,
7
+ getInternalValue,
8
+ computedSize
9
+ } from "./index";
3
10
  const api = ["state"];
4
11
  const renderless = (props, { reactive, computed }) => {
5
12
  const api2 = {