@opentiny/vue-renderless 3.16.1 → 3.17.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 (96) hide show
  1. package/action-sheet/index.js +0 -1
  2. package/base-select/index.js +1510 -0
  3. package/base-select/vue.js +555 -0
  4. package/breadcrumb-item/vue.js +4 -2
  5. package/card/index.js +15 -0
  6. package/card/vue.js +6 -3
  7. package/carousel/index.js +89 -17
  8. package/carousel/vue.js +29 -24
  9. package/carousel-item/index.js +24 -9
  10. package/carousel-item/vue.js +10 -9
  11. package/cascader/vue.js +2 -1
  12. package/cascader-panel/index.js +8 -1
  13. package/cascader-panel/vue.js +1 -1
  14. package/cascader-select/column-index.js +11 -6
  15. package/cascader-select/column.js +8 -5
  16. package/cascader-select/usePicker.js +3 -2
  17. package/checkbox/index.js +0 -17
  18. package/checkbox/vue.js +4 -10
  19. package/collapse-item/vue.js +4 -2
  20. package/common/deps/clickoutside.js +15 -8
  21. package/common/deps/popper.js +15 -1
  22. package/common/deps/throttle.js +7 -0
  23. package/common/deps/touch-emulator.js +1 -1
  24. package/common/deps/tree-model/node.js +1 -0
  25. package/common/deps/tree-model/tree-store.js +4 -1
  26. package/common/deps/useEventListener.js +9 -2
  27. package/common/deps/useInstanceSlots.js +22 -0
  28. package/common/deps/useRelation.js +72 -0
  29. package/common/deps/vue-popper.js +1 -0
  30. package/common/function.js +28 -0
  31. package/common/index.js +1 -1
  32. package/common/runtime.js +1 -1
  33. package/common/type.js +2 -0
  34. package/dialog-box/index.js +0 -22
  35. package/dialog-box/vue.js +1 -4
  36. package/drawer/index.js +27 -29
  37. package/drawer/vue.js +6 -10
  38. package/file-upload/index.js +1 -1
  39. package/fluent-editor/index.js +679 -0
  40. package/fluent-editor/options.js +234 -0
  41. package/fluent-editor/vue.js +192 -0
  42. package/form/index.js +5 -1
  43. package/grid/utils/column.js +4 -2
  44. package/grid/utils/common.js +18 -29
  45. package/grid/utils/event.js +14 -9
  46. package/guide/index.js +6 -5
  47. package/guide/vue.js +2 -2
  48. package/input/index.js +32 -2
  49. package/input/vue.js +21 -2
  50. package/nav-menu/index.js +1 -1
  51. package/numeric/index.js +4 -1
  52. package/option/vue.js +6 -6
  53. package/package.json +1 -1
  54. package/picker/mb.js +6 -1
  55. package/picker/vue.js +2 -1
  56. package/select/index.js +65 -40
  57. package/select/vue.js +1 -1
  58. package/split/index.js +16 -9
  59. package/split/vue.js +7 -2
  60. package/statistic/index.js +7 -0
  61. package/tabs-mf/index.js +116 -13
  62. package/tabs-mf/vue-bar.js +6 -0
  63. package/tabs-mf/vue-nav-item.js +1 -1
  64. package/tabs-mf/vue.js +42 -7
  65. package/tag-group/vue.js +7 -1
  66. package/time/index.js +1 -1
  67. package/time-line/index.js +2 -2
  68. package/time-line/vue.js +4 -13
  69. package/timeline-item/index.js +5 -5
  70. package/timeline-item/vue.js +13 -6
  71. package/tree/index.js +29 -2
  72. package/tree/vue.js +5 -2
  73. package/tree-node/vue.js +2 -1
  74. package/types/cascader-menu.type.d.ts +1 -1
  75. package/types/cascader-node.type.d.ts +1 -1
  76. package/types/{cascader-panel.type-2bd03be3.d.ts → cascader-panel.type-8f58e628.d.ts} +1 -1
  77. package/types/cascader-panel.type.d.ts +1 -1
  78. package/types/cascader.type.d.ts +1 -1
  79. package/types/collapse-item.type.d.ts +3 -0
  80. package/types/dialog-box.type.d.ts +2 -6
  81. package/types/drawer.type.d.ts +28 -30
  82. package/types/form-item.type.d.ts +1 -1
  83. package/types/{form.type-8e30b25c.d.ts → form.type-33aa784a.d.ts} +4 -0
  84. package/types/form.type.d.ts +1 -1
  85. package/types/input.type.d.ts +4 -0
  86. package/types/ip-address.type.d.ts +1 -6
  87. package/types/numeric.type.d.ts +1 -0
  88. package/types/search.type.d.ts +1 -3
  89. package/types/{time-line.type-1b501c41.d.ts → time-line.type-9fb16096.d.ts} +7 -5
  90. package/types/time-line.type.d.ts +1 -1
  91. package/types/timeline-item.type.d.ts +1 -1
  92. package/user/index.js +10 -4
  93. package/year-table/index.js +5 -3
  94. package/year-table/vue.js +1 -1
  95. package/common/deps/letter-only.js +0 -19
  96. package/common/deps/number-only.js +0 -20
package/carousel/index.js CHANGED
@@ -2,6 +2,7 @@ import "../chunk-G2ADBYYC.js";
2
2
  import throttle from "../common/deps/throttle";
3
3
  import { getDirection } from "../common/deps/touch";
4
4
  import { POSITION } from "../common";
5
+ import emulate from "../common/deps/touch-emulator";
5
6
  const handleMouseEnter = ({ api, state }) => () => {
6
7
  state.hover = true;
7
8
  api.pauseTimer();
@@ -39,12 +40,19 @@ const resetItemPosition = (state) => (oldIndex) => {
39
40
  });
40
41
  }
41
42
  };
42
- const playSlides = ({ props, state }) => () => {
43
+ const playSlides = ({ api, props, state }) => () => {
44
+ let newIndex;
45
+ let oldIndex = state.activeIndex;
43
46
  if (state.activeIndex < state.items.length - 1) {
44
- state.activeIndex++;
47
+ newIndex = state.activeIndex + 1;
45
48
  } else if (props.loop) {
46
- state.activeIndex = 0;
49
+ newIndex = 0;
47
50
  }
51
+ api.canActive(newIndex, oldIndex).then((result) => {
52
+ if (result) {
53
+ state.activeIndex = newIndex;
54
+ }
55
+ });
48
56
  };
49
57
  const pauseTimer = (state) => () => clearInterval(state.timer);
50
58
  const startTimer = ({ api, props, state }) => () => {
@@ -66,25 +74,55 @@ const setActiveItem = ({ api, props, state }) => (index) => {
66
74
  }
67
75
  const length = state.items.length;
68
76
  const oldIndex = state.activeIndex;
77
+ let newIndex;
69
78
  if (index < 0) {
70
- state.activeIndex = props.loop ? length - 1 : 0;
79
+ newIndex = props.loop ? length - 1 : 0;
71
80
  } else if (index >= length) {
72
- state.activeIndex = props.loop ? 0 : length - 1;
81
+ newIndex = props.loop ? 0 : length - 1;
73
82
  } else {
74
- state.activeIndex = index;
83
+ newIndex = index;
75
84
  }
76
- if (oldIndex === state.activeIndex) {
77
- api.resetItemPosition(oldIndex);
85
+ const nextProcess = () => {
86
+ state.activeIndex = newIndex;
87
+ if (oldIndex === state.activeIndex) {
88
+ api.resetItemPosition(oldIndex);
89
+ }
90
+ };
91
+ if (newIndex === oldIndex) {
92
+ nextProcess();
93
+ } else {
94
+ api.canActive(newIndex, oldIndex).then((result) => {
95
+ if (result) {
96
+ nextProcess();
97
+ }
98
+ });
78
99
  }
79
100
  };
101
+ const canActive = (props) => (newIndex, oldIndex) => {
102
+ return new Promise((resolve) => {
103
+ if (typeof props.beforeSwipe === "function") {
104
+ resolve(props.beforeSwipe(newIndex, oldIndex));
105
+ } else {
106
+ resolve(true);
107
+ }
108
+ }).then((result) => result !== false);
109
+ };
80
110
  const prev = ({ api, state }) => () => api.setActiveItem(state.activeIndex - 1);
81
111
  const next = ({ api, state }) => () => api.setActiveItem(state.activeIndex + 1);
82
- const handleIndicatorClick = (state) => (index) => {
83
- state.activeIndex = index;
112
+ const handleIndicatorClick = ({ api, state }) => (index) => {
113
+ api.canActive(index, state.activeIndex).then((result) => {
114
+ if (result) {
115
+ state.activeIndex = index;
116
+ }
117
+ });
84
118
  };
85
- const handleIndicatorHover = ({ props, state }) => (index) => {
119
+ const handleIndicatorHover = ({ api, props, state }) => (index) => {
86
120
  if (props.trigger === "hover" && index !== state.activeIndex) {
87
- state.activeIndex = index;
121
+ api.canActive(index, state.activeIndex).then((result) => {
122
+ if (result) {
123
+ state.activeIndex = index;
124
+ }
125
+ });
88
126
  }
89
127
  };
90
128
  const watchItems = ({ props, api }) => (value) => {
@@ -113,20 +151,26 @@ const computedStyle = ({ props }) => () => {
113
151
  }
114
152
  }
115
153
  };
116
- const onComplete = ({ count, emit, props, state }) => (total) => {
154
+ const onComplete = ({ api, count, emit, props, state }) => (total) => {
117
155
  if (count++ === total) {
118
156
  state.completed = true;
119
157
  if (props.initialIndex < state.items.length && props.initialIndex >= 0) {
120
- state.activeIndex = props.initialIndex;
158
+ api.canActive(props.initialIndex, state.activeIndex).then((result) => {
159
+ if (result) {
160
+ state.activeIndex = props.initialIndex;
161
+ }
162
+ });
121
163
  }
122
164
  emit("complete");
123
165
  }
124
166
  };
125
- const touchstart = ({ state, api }) => (event) => {
167
+ const touchstart = ({ props, state, api }) => (event) => {
126
168
  if (state.items.length <= 1 || ~state.noTouchNode.indexOf(event.target.nodeName))
127
169
  return;
128
- event.preventDefault();
129
- event.stopPropagation();
170
+ if (!props.swipeable) {
171
+ event.preventDefault();
172
+ event.stopPropagation();
173
+ }
130
174
  resetTouchStatus(state);
131
175
  api.pauseTimer();
132
176
  state.itemsTranslate = state.items.map((item) => item.state.translate);
@@ -188,7 +232,34 @@ function resetTouchStatus(state) {
188
232
  state.offsetPos.X = 0;
189
233
  state.offsetPos.Y = 0;
190
234
  }
235
+ const simulateTouch = ({ props, vm }) => () => {
236
+ if (props.swipeable && vm.$refs.carousel) {
237
+ emulate();
238
+ vm.$refs.carousel.setAttribute("data-tiny-touch-simulate-container", "");
239
+ }
240
+ };
241
+ const computedHasButtons = ({ props, state, mode }) => () => {
242
+ if (props.lite) {
243
+ return false;
244
+ } else if (mode === "mobile-first") {
245
+ return props.arrow !== "never" && state.items.length > 1;
246
+ } else if (mode === "pc") {
247
+ return props.arrow !== "never";
248
+ }
249
+ };
250
+ const computedHasIndicators = ({ props, state, mode }) => () => {
251
+ if (props.lite) {
252
+ return false;
253
+ } else if (mode === "mobile-first") {
254
+ return props.indicatorPosition !== "none" && state.items.length > 1;
255
+ } else if (mode === "pc") {
256
+ return props.indicatorPosition !== "none";
257
+ }
258
+ };
191
259
  export {
260
+ canActive,
261
+ computedHasButtons,
262
+ computedHasIndicators,
192
263
  computedHasLabel,
193
264
  computedStyle,
194
265
  handleButtonEnter,
@@ -205,6 +276,7 @@ export {
205
276
  prev,
206
277
  resetItemPosition,
207
278
  setActiveItem,
279
+ simulateTouch,
208
280
  startTimer,
209
281
  throttledArrowClick,
210
282
  throttledIndicatorHover,
package/carousel/vue.js CHANGED
@@ -24,7 +24,11 @@ import {
24
24
  touchstart,
25
25
  touchmove,
26
26
  touchend,
27
- computedStyle
27
+ computedStyle,
28
+ simulateTouch,
29
+ computedHasButtons,
30
+ computedHasIndicators,
31
+ canActive
28
32
  } from "./index";
29
33
  import { addResizeListener, removeResizeListener } from "../common/deps/resize-event";
30
34
  const api = [
@@ -86,26 +90,28 @@ const initState = ({ reactive, computed, api: api2 }) => {
86
90
  moveDisable: false,
87
91
  noTouchNode: ["svg", "BUTTON", "path", "g"],
88
92
  style: computed(() => api2.computedStyle()),
89
- hasLabel: computed(() => api2.computedHasLabel(state.items))
93
+ hasLabel: computed(() => api2.computedHasLabel(state.items)),
94
+ hasButtons: computed(() => api2.computedHasButtons()),
95
+ hasIndicators: computed(() => api2.computedHasIndicators())
90
96
  });
91
97
  return state;
92
98
  };
93
- const initApi = ({ vm, api: api2, state, props, emit }) => {
99
+ const initApi = ({ vm, api: api2, state, props, emit, mode }) => {
94
100
  Object.assign(api2, {
95
101
  state,
96
102
  computedHasLabel,
97
- touchend: touchend({ state, api: api2 }),
98
- touchstart: touchstart({ state, api: api2 }),
103
+ touchend: touchend({ props, state, api: api2 }),
104
+ touchstart: touchstart({ props, state, api: api2 }),
99
105
  touchmove: touchmove({ props, state, vm }),
100
- playSlides: playSlides({ props, state }),
101
- onComplete: onComplete({ count: 0, emit, props, state }),
106
+ playSlides: playSlides({ api: api2, props, state }),
107
+ onComplete: onComplete({ api: api2, count: 0, emit, props, state }),
102
108
  pauseTimer: pauseTimer(state),
103
109
  itemInStage: itemInStage(state),
104
110
  resetItemPosition: resetItemPosition(state),
105
111
  watchItems: watchItems({ api: api2, props }),
106
112
  handleButtonLeave: handleButtonLeave(state),
107
- handleIndicatorClick: handleIndicatorClick(state),
108
- handleIndicatorHover: handleIndicatorHover({ props, state }),
113
+ handleIndicatorClick: handleIndicatorClick({ api: api2, state }),
114
+ handleIndicatorHover: handleIndicatorHover({ api: api2, props, state }),
109
115
  watchActiveIndex: watchActiveIndex({ api: api2, emit }),
110
116
  watchAutoplay: watchAutoplay(api2),
111
117
  startTimer: startTimer({ api: api2, props, state }),
@@ -117,7 +123,11 @@ const initApi = ({ vm, api: api2, state, props, emit }) => {
117
123
  handleMouseLeave: handleMouseLeave({ api: api2, state }),
118
124
  throttledIndicatorHover: throttledIndicatorHover(api2),
119
125
  handleButtonEnter: handleButtonEnter({ api: api2, state }),
120
- computedStyle: computedStyle({ props })
126
+ computedStyle: computedStyle({ props }),
127
+ simulateTouch: simulateTouch({ props, vm }),
128
+ computedHasButtons: computedHasButtons({ props, state, mode }),
129
+ computedHasIndicators: computedHasIndicators({ props, state, mode }),
130
+ canActive: canActive(props)
121
131
  });
122
132
  };
123
133
  const initWatch = ({ watch, props, api: api2, state }) => {
@@ -127,18 +137,20 @@ const initWatch = ({ watch, props, api: api2, state }) => {
127
137
  () => api2.setActiveItem(state.activeIndex)
128
138
  );
129
139
  };
130
- const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch }, { vm, parent, emit, constants, childrenHandler }) => {
140
+ const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, provide }, { vm, parent, emit, mode }) => {
131
141
  const api2 = {};
132
142
  const state = initState({ reactive, computed, api: api2 });
133
- initApi({ vm, api: api2, state, props, emit });
134
- const { updateItems } = useItems({ api: api2, vm, onMounted, state, watch, constants, childrenHandler, parent });
143
+ initApi({ vm, api: api2, state, props, emit, mode });
144
+ const { updateItems } = useItems({ api: api2, vm, onMounted, state, watch });
135
145
  api2.updateItems = updateItems;
136
146
  useActiveIndex({ api: api2, parent, props, state, watch });
137
147
  useResizeListener({ api: api2, onBeforeUnmount, onMounted, parent });
148
+ provide("CarouselVm", vm);
138
149
  initWatch({ watch, props, api: api2, state });
139
150
  onMounted(() => {
140
151
  api2.startTimer();
141
152
  api2.onComplete(state.items.length);
153
+ api2.simulateTouch();
142
154
  });
143
155
  parent.$on("updateItems", api2.updateItems);
144
156
  parent.$on("complete", () => {
@@ -146,18 +158,11 @@ const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, wat
146
158
  });
147
159
  return api2;
148
160
  };
149
- const useItems = ({ api: api2, onMounted, state, watch, constants, childrenHandler, parent }) => {
150
- const updateItems = () => {
151
- let $children = [];
152
- $children = parent.$children && parent.$children[0].$children.filter((child) => {
153
- return child.$el.classList && Array.from(child.$el.classList).includes("tiny-carousel__item");
154
- });
155
- if (!$children.length) {
156
- childrenHandler(({ options, vm }) => {
157
- options.name === constants.CHILD_NAME && $children.push(vm);
158
- });
161
+ const useItems = ({ api: api2, onMounted, state, watch }) => {
162
+ const updateItems = (carouselItemVm) => {
163
+ if (carouselItemVm && !state.items.includes(carouselItemVm)) {
164
+ state.items.push(carouselItemVm);
159
165
  }
160
- state.items = $children;
161
166
  };
162
167
  watch(
163
168
  () => state.items,
@@ -21,10 +21,10 @@ const calculateTranslate = ({ CARD_SCALE, state }) => ({ activeIndex, index, par
21
21
  }
22
22
  return (3 + CARD_SCALE) * parentWidth / 4;
23
23
  };
24
- const translateItem = ({ api, CARD_SCALE, parent, state }) => ({ activeIndex, index, oldIndex }) => {
25
- const parentHeight = parent.$parent.$el.offsetHeight;
26
- const parentWidth = parent.$parent.$el.offsetWidth;
27
- const vnode = parent.$parent;
24
+ const translateItem = ({ api, CARD_SCALE, parent, state, carouselParent }) => ({ activeIndex, index, oldIndex }) => {
25
+ const parentHeight = carouselParent.$el.offsetHeight;
26
+ const parentWidth = carouselParent.$el.offsetWidth;
27
+ const vnode = carouselParent;
28
28
  const length = vnode.state.items.length;
29
29
  const { TYPE_CARD, TYPE_VERTICAL } = parent.$constants;
30
30
  if (vnode.type !== TYPE_CARD && oldIndex !== void 0) {
@@ -45,26 +45,41 @@ const translateItem = ({ api, CARD_SCALE, parent, state }) => ({ activeIndex, in
45
45
  state.scale = state.active ? 1 : CARD_SCALE;
46
46
  } else {
47
47
  state.active = index === activeIndex;
48
- state.translate = vnode.type === TYPE_VERTICAL ? parentHeight * (index - activeIndex) : parentWidth * (index - activeIndex);
48
+ if (length === 2 && !state.active) {
49
+ state.translate = vnode.type === TYPE_VERTICAL ? -parentHeight : -parentWidth;
50
+ } else {
51
+ state.translate = vnode.type === TYPE_VERTICAL ? parentHeight * (index - activeIndex) : parentWidth * (index - activeIndex);
52
+ }
49
53
  }
50
54
  state.ready = true;
51
55
  };
52
- const handleItemClick = ({ state, parent }) => () => {
53
- const vnode = parent.$parent;
56
+ const handleItemClick = ({ state, parent, carouselParent }) => () => {
57
+ const vnode = carouselParent;
54
58
  if (vnode && vnode.type === parent.$constants.TYPE_CARD) {
55
59
  const index = vnode.state.items.findIndex((item) => item.state.translate === state.translate);
56
60
  vnode.setActiveItem(index);
57
61
  }
58
62
  };
59
- const computedTransform = ({ parent, TYPE_VERTICAL, mode, state }) => () => {
60
- const TRANSLATE = parent.$parent.type === TYPE_VERTICAL ? `translateY(${state.translate + state.delta}px) scale(${state.scale})` : `translateX(${state.translate + state.delta}px) scale(${state.scale})`;
63
+ const computedTransform = ({ carouselParent, TYPE_VERTICAL, mode, state }) => () => {
64
+ const TRANSLATE = carouselParent.type === TYPE_VERTICAL ? `translateY(${state.translate + state.delta}px) scale(${state.scale})` : `translateX(${state.translate + state.delta}px) scale(${state.scale})`;
61
65
  const style = mode === "mobile-first" ? { width: "100%", height: "100%" } : {};
66
+ moveItemBack(carouselParent, state, TYPE_VERTICAL);
62
67
  return __spreadValues({
63
68
  msTransform: TRANSLATE,
64
69
  webkitTransform: TRANSLATE,
65
70
  transform: TRANSLATE
66
71
  }, style);
67
72
  };
73
+ const moveItemBack = (parent, state, TYPE_VERTICAL) => {
74
+ if (!parent || !parent.$el)
75
+ return;
76
+ const length = parent.state.items.length;
77
+ setTimeout(() => {
78
+ if (length === 2 && !state.active) {
79
+ state.translate = parent.type === TYPE_VERTICAL ? parent.$el.offsetHeight : parent.$el.offsetWidth;
80
+ }
81
+ }, 300);
82
+ };
68
83
  const resetAnimatingMf = (state) => () => {
69
84
  state.animatingMf = false;
70
85
  };
@@ -27,10 +27,11 @@ const api = [
27
27
  "resetAnimatingMf",
28
28
  "setDelta"
29
29
  ];
30
- const renderless = (props, { computed, onMounted, onUnmounted, reactive }, { parent, dispatch, mode }) => {
30
+ const renderless = (props, { computed, onMounted, onUnmounted, reactive, inject }, { parent, dispatch, mode, vm }) => {
31
31
  const api2 = {};
32
32
  const CARD_SCALE = parent.$constants.CARD_SCALE;
33
33
  const TYPE_VERTICAL = parent.$constants.TYPE_VERTICAL;
34
+ const carouselParent = inject("CarouselVm");
34
35
  const state = reactive({
35
36
  scale: 1,
36
37
  translate: 0,
@@ -41,29 +42,29 @@ const renderless = (props, { computed, onMounted, onUnmounted, reactive }, { par
41
42
  animating: false,
42
43
  animatingMf: false,
43
44
  isOblique: false,
44
- carouselParent: parent.$parent,
45
+ carouselParent,
45
46
  hasTitle: computed(() => !!props.title),
46
- moving: computed(() => parent.$parent.state.moving),
47
- animate: computed(() => Math.abs(parent.$parent.state.delta) > 0 ? !state.animatingMf : state.animating),
47
+ moving: computed(() => carouselParent.state.moving),
48
+ animate: computed(() => Math.abs(carouselParent.state.delta) > 0 ? !state.animatingMf : state.animating),
48
49
  getTransform: computed(() => api2.computedTransform()),
49
50
  delta: 0
50
51
  });
51
52
  Object.assign(api2, {
52
53
  state,
53
54
  processIndex,
54
- handleItemClick: handleItemClick({ state, parent }),
55
- computedTransform: computedTransform({ parent, TYPE_VERTICAL, mode, state }),
55
+ handleItemClick: handleItemClick({ state, parent, carouselParent }),
56
+ computedTransform: computedTransform({ carouselParent, TYPE_VERTICAL, mode, state }),
56
57
  calculateTranslate: calculateTranslate({ CARD_SCALE, state }),
57
- translateItem: translateItem({ api: api2, CARD_SCALE, parent, state }),
58
+ translateItem: translateItem({ api: api2, CARD_SCALE, parent, state, carouselParent }),
58
59
  setDelta: setDelta({ state }),
59
60
  resetAnimatingMf: resetAnimatingMf(state)
60
61
  });
61
62
  onMounted(() => {
62
- dispatch("Carousel", "updateItems", []);
63
+ dispatch("Carousel", "updateItems", [vm]);
63
64
  dispatch("Carousel", "complete", []);
64
65
  });
65
66
  onUnmounted(() => {
66
- parent.$parent && parent.$parent.updateItems();
67
+ carouselParent && carouselParent.updateItems();
67
68
  });
68
69
  return api2;
69
70
  };
package/cascader/vue.js CHANGED
@@ -56,7 +56,8 @@ const api = [
56
56
  "toggleDropDownVisible",
57
57
  "handleKeyDown",
58
58
  "handleMouseenter",
59
- "handleMouseleave"
59
+ "handleMouseleave",
60
+ "computePresentContent"
60
61
  ];
61
62
  const initState = ({
62
63
  reactive,
@@ -144,7 +144,13 @@ const handleExpand = ({ emit, state }) => (node, silent) => {
144
144
  const handleCheckChange = (state) => (value) => {
145
145
  state.checkedValue = value;
146
146
  };
147
- const lazyLoad = ({ api, $parent, state, Store }) => (currentNode, onFullfiled) => {
147
+ const lazyLoad = ({
148
+ api,
149
+ $parent,
150
+ state,
151
+ Store,
152
+ emit
153
+ }) => (currentNode, onFullfiled) => {
148
154
  let node = currentNode;
149
155
  if (!node) {
150
156
  node = node || { root: true, level: 0 };
@@ -157,6 +163,7 @@ const lazyLoad = ({ api, $parent, state, Store }) => (currentNode, onFullfiled)
157
163
  dataList && dataList.length && state.store.appendNodes(dataList, parent);
158
164
  node.loading = false;
159
165
  node.loaded = true;
166
+ emit("load-data", dataList);
160
167
  if (Array.isArray(state.checkedValue)) {
161
168
  const nodeValue = state.checkedValue[state.loadCount++];
162
169
  const valueKey = state.config.value;
@@ -100,7 +100,7 @@ const initApi = ({
100
100
  syncMenuState: syncMenuState({ api: api2, nextTick, state }),
101
101
  syncMultiCheckState: syncMultiCheckState({ api: api2, state }),
102
102
  calculateCheckedNodePaths: calculateCheckedNodePaths({ api: api2, state }),
103
- lazyLoad: lazyLoad({ api: api2, $parent: parent, state, Store }),
103
+ lazyLoad: lazyLoad({ api: api2, $parent: parent, state, Store, emit }),
104
104
  syncCheckedValue: syncCheckedValue({ api: api2, props, state }),
105
105
  focusNode: focusNode(api2),
106
106
  checkNode: checkNode(api2),
@@ -103,7 +103,7 @@ const setMove = ({ state, props, api }) => (move, type, time) => {
103
103
  let endMove = Math.round(updateMove / +optionHeight) * +optionHeight;
104
104
  let deg = `${(Math.abs(Math.round(endMove / +optionHeight)) + 1) * state.rotation}deg`;
105
105
  api.setTransform(type, deg, endMove, time);
106
- state.currIndex = Math.abs(Math.round(endMove / +optionHeight)) + 1;
106
+ state.currIndex = state.defaultIndex = Math.abs(Math.round(endMove / +optionHeight)) + 1;
107
107
  } else {
108
108
  let deg = 0;
109
109
  let currentDeg = (-updateMove / +optionHeight + 1) * state.rotation;
@@ -112,7 +112,7 @@ const setMove = ({ state, props, api }) => (move, type, time) => {
112
112
  deg = clamp(currentDeg, minDeg, maxDeg);
113
113
  if (minDeg < deg && deg < maxDeg) {
114
114
  api.setTransform(null, deg + "deg", updateMove, void 0);
115
- state.currIndex = Math.abs(Math.round(updateMove / +optionHeight)) + 1;
115
+ state.currIndex = state.defaultIndex = Math.abs(Math.round(updateMove / +optionHeight)) + 1;
116
116
  }
117
117
  }
118
118
  };
@@ -121,16 +121,21 @@ const setChooseValue = ({ props, state, emit }) => () => {
121
121
  };
122
122
  const modifyStatus = ({ state, props, api }) => (type) => {
123
123
  const { column } = props;
124
- let index = column.findIndex((columnItem) => columnItem[props.fieldNames.value] === props.value);
125
- state.currIndex = index === -1 ? 1 : index + 1;
124
+ const value = isEffectVal(props.value) ? props.value : props.defaultValue;
125
+ const currentIndex = isEffectVal(props.value) ? "currIndex" : "defaultIndex";
126
+ let index = column.findIndex((columnItem) => columnItem[props.fieldNames.value] === value);
127
+ state[currentIndex] = index === -1 ? 1 : index + 1;
126
128
  let move = index === -1 ? 0 : index * +props.optionHeight;
127
129
  type && api.setChooseValue();
128
130
  api.setMove(-move);
129
131
  };
130
- const OptionStyle = ({ state }) => (option, column, offset) => {
131
- const currentIndex = state.currIndex - 1;
132
+ const OptionStyle = ({ props, state }) => (option, column, offset) => {
133
+ const currentIndex = isEffectVal(props.value) ? state.currIndex - 1 : state.defaultIndex - 1;
132
134
  return option === column[currentIndex + offset] || option === column[currentIndex - offset];
133
135
  };
136
+ const isEffectVal = (val) => {
137
+ return val || val === 0;
138
+ };
134
139
  export {
135
140
  OptionStyle,
136
141
  clamp,
@@ -40,6 +40,7 @@ const renderless = (props, { reactive, computed, watch, ref, onMounted }, { emit
40
40
  lastTime: 0
41
41
  },
42
42
  currIndex: 1,
43
+ defaultIndex: 1,
43
44
  transformY: 0,
44
45
  scrollDistance: 0,
45
46
  rotation: 20,
@@ -73,7 +74,7 @@ const renderless = (props, { reactive, computed, watch, ref, onMounted }, { emit
73
74
  Object.assign(api2, {
74
75
  state,
75
76
  touch,
76
- OptionStyle: OptionStyle({ state }),
77
+ OptionStyle: OptionStyle({ props, state }),
77
78
  setRollerStyle: setRollerStyle({ state }),
78
79
  isHidden: isHidden({ state }),
79
80
  onTouchStart: onTouchStart({ state, props, touch, vm }),
@@ -100,10 +101,12 @@ const renderless = (props, { reactive, computed, watch, ref, onMounted }, { emit
100
101
  }
101
102
  );
102
103
  watch(
103
- () => props.value,
104
- () => {
105
- state.transformY = 0;
106
- api2.modifyStatus(false);
104
+ () => [props.value, props.defaultValue],
105
+ (val) => {
106
+ if ((val || val === 0) && props.visible) {
107
+ state.transformY = 0;
108
+ api2.modifyStatus(false);
109
+ }
107
110
  },
108
111
  {
109
112
  deep: true
@@ -131,7 +131,7 @@ const change = ({ api, state, columnFieldNames, columnsList }) => () => {
131
131
  });
132
132
  };
133
133
  const columnsTypeComputed = ({ state, computed, columnFieldNames }) => computed(() => {
134
- const firstColumn = state.formattedColumns[0];
134
+ const firstColumn = state.formattedColumns && state.formattedColumns[0];
135
135
  const fields = columnFieldNames.value;
136
136
  if (firstColumn) {
137
137
  if (Array.isArray(firstColumn)) {
@@ -173,7 +173,8 @@ const sliceValue = (min, max) => {
173
173
  const validArr = (arr) => Array.isArray(arr) && arr.length;
174
174
  const validProps = ({ props }) => () => {
175
175
  const { modelValue, options } = props;
176
- return validArr(modelValue) && validArr(options) && modelValue.length === options.length;
176
+ const isSameLen = modelValue && modelValue.length ? modelValue.length === options.length : true;
177
+ return Array.isArray(modelValue) && Array.isArray(options) && isSameLen;
177
178
  };
178
179
  const parseType = ({ props }) => (values) => {
179
180
  const { valueType } = props;
package/checkbox/index.js CHANGED
@@ -124,21 +124,6 @@ const computedShowText = ({ props }) => () => {
124
124
  return props.label;
125
125
  }
126
126
  };
127
- const handleLabelMouseenter = ({ state, vm }) => (e) => {
128
- const label = e.target;
129
- if (label && label.scrollWidth > label.offsetWidth) {
130
- const tooltip = vm.$refs.tooltip;
131
- tooltip.state.referenceElm = label;
132
- tooltip.state.popperElm && (tooltip.state.popperElm.style.display = "none");
133
- tooltip.doDestroy();
134
- state.tooltipVisible = true;
135
- state.displayedValue = label.textContent;
136
- setTimeout(tooltip.updatePopper, 20);
137
- }
138
- };
139
- const handleMouseleave = (state) => () => {
140
- state.tooltipVisible = false;
141
- };
142
127
  export {
143
128
  addToStore,
144
129
  computedCheckboxSize,
@@ -156,8 +141,6 @@ export {
156
141
  computedShowText,
157
142
  computedStore,
158
143
  handleChange,
159
- handleLabelMouseenter,
160
- handleMouseleave,
161
144
  mounted,
162
145
  removeFromStore,
163
146
  toggleEvent
package/checkbox/vue.js CHANGED
@@ -18,11 +18,9 @@ import {
18
18
  mounted,
19
19
  toggleEvent,
20
20
  computedIsShowText,
21
- computedShowText,
22
- handleLabelMouseenter,
23
- handleMouseleave
21
+ computedShowText
24
22
  } from "./index";
25
- const api = ["state", "handleChange", "computedStore", "handleLabelMouseenter", "handleMouseleave"];
23
+ const api = ["state", "handleChange", "computedStore"];
26
24
  const initState = ({ reactive, computed, parent, api: api2, inject, props }) => {
27
25
  const state = reactive({
28
26
  size: computed(() => props.size || inject("size", null) || (parent.tinyForm || {}).size),
@@ -51,9 +49,7 @@ const initState = ({ reactive, computed, parent, api: api2, inject, props }) =>
51
49
  }),
52
50
  showText: computed(() => api2.computedShowText()),
53
51
  isShowText: computed(() => api2.computedIsShowText()),
54
- shape: inject("shape", null) || props.shape,
55
- tooltipVisible: false,
56
- displayedValue: ""
52
+ shape: inject("shape", null) || props.shape
57
53
  });
58
54
  return state;
59
55
  };
@@ -89,9 +85,7 @@ const initApi = ({
89
85
  handleChange: handleChange({ state, props, emit, nextTick, dispatch, constants }),
90
86
  computedDisplayLabel: computedDisplayLabel({ state, props, t }),
91
87
  computedIsShowText: computedIsShowText({ props }),
92
- computedShowText: computedShowText({ props }),
93
- handleLabelMouseenter: handleLabelMouseenter({ state, vm }),
94
- handleMouseleave: handleMouseleave(state)
88
+ computedShowText: computedShowText({ props })
95
89
  });
96
90
  };
97
91
  const renderless = (props, { computed, onMounted, onBeforeUnmount, reactive, watch, inject }, { vm, parent, emit, constants, nextTick, dispatch, t }) => {
@@ -2,7 +2,8 @@ import "../chunk-G2ADBYYC.js";
2
2
  import { handleFocus, handleEnterClick, handleHeaderClick } from "./index";
3
3
  import { guid } from "../common/string";
4
4
  const api = ["state", "isActive", "handleFocus", "handleEnterClick", "handleHeaderClick"];
5
- const renderless = (props, { computed, reactive }, { parent, constants, dispatch }) => {
5
+ const renderless = (props, { computed, reactive }, { parent, constants, dispatch, designConfig }) => {
6
+ var _a;
6
7
  const _constants = parent.collapse._constants;
7
8
  const componentName = _constants.COMPONENT_NAME.Collapse;
8
9
  const eventName = _constants.EVENT_NAME.CollapseItemClick;
@@ -12,7 +13,8 @@ const renderless = (props, { computed, reactive }, { parent, constants, dispatch
12
13
  focusing: false,
13
14
  contentHeight: 0,
14
15
  contentWrapStyle: { height: "auto", display: "block" },
15
- isActive: computed(() => parent.collapse.state.activeNames.includes(props.name))
16
+ isActive: computed(() => parent.collapse.state.activeNames.includes(props.name)),
17
+ arrowIcon: props.expandIcon || ((_a = designConfig == null ? void 0 : designConfig.icons) == null ? void 0 : _a.arrowIcon) || "IconChevronRight"
16
18
  });
17
19
  const api2 = {
18
20
  state,