@opentiny/vue-renderless 3.8.4 → 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 (56) hide show
  1. package/alert/index.js +2 -2
  2. package/alert/vue.js +3 -3
  3. package/anchor/index.js +28 -19
  4. package/anchor/vue.js +3 -2
  5. package/button-group/index.js +6 -0
  6. package/button-group/vue.js +8 -3
  7. package/carousel/index.js +18 -20
  8. package/carousel/vue.js +29 -5
  9. package/carousel-item/index.js +2 -1
  10. package/carousel-item/vue.js +14 -2
  11. package/cascader/index.js +110 -11
  12. package/cascader/vue.js +35 -12
  13. package/chart-heatmap/index.js +12 -12
  14. package/checkbox/index.js +19 -6
  15. package/checkbox/vue.js +38 -20
  16. package/common/bigInt.js +2 -1
  17. package/common/browser.js +43 -37
  18. package/common/deps/ResizeObserver.js +2 -2
  19. package/common/deps/popper.js +26 -24
  20. package/common/validate/util.js +2 -2
  21. package/drawer/index.js +16 -1
  22. package/drawer/vue.js +14 -3
  23. package/dropdown-menu/index.js +3 -0
  24. package/dropdown-menu/vue.js +20 -2
  25. package/grid/utils/dom.js +2 -2
  26. package/image/vue.js +12 -1
  27. package/input/index.js +15 -3
  28. package/input/vue.js +34 -8
  29. package/ip-address/index.js +4 -4
  30. package/month-table/index.js +5 -2
  31. package/numeric/index.js +6 -3
  32. package/numeric/vue.js +1 -1
  33. package/package.json +8 -1
  34. package/popconfirm/index.js +1 -0
  35. package/popconfirm/vue.js +4 -2
  36. package/popover/index.js +19 -12
  37. package/popover/vue.js +15 -5
  38. package/progress/index.js +44 -6
  39. package/progress/vue.js +15 -4
  40. package/radio/index.js +2 -0
  41. package/radio/vue.js +3 -0
  42. package/record/index.js +166 -59
  43. package/record/vue.js +31 -14
  44. package/roles/index.js +5 -5
  45. package/roles/vue.js +1 -1
  46. package/slider/index.js +3 -1
  47. package/steps/index.js +8 -0
  48. package/steps/vue.js +3 -2
  49. package/tabs-mf/vue-bar.js +1 -1
  50. package/text-popup/vue.js +2 -1
  51. package/time-line/index.js +8 -0
  52. package/time-line/vue.js +2 -1
  53. package/tooltip/index.js +35 -25
  54. package/tooltip/vue.js +1 -1
  55. package/tree/index.js +1 -1
  56. package/user-head/vue.js +8 -1
package/record/index.js CHANGED
@@ -95,31 +95,91 @@ class Record {
95
95
  onMediaProgress && onMediaProgress(this.analyser, this.audioContext);
96
96
  }
97
97
  }
98
- const toogleRecord = ({ state, api, emit, constants }) => () => {
99
- if (state.record.status === constants.STATUS.READY) {
100
- !state.recorder && (state.recorder = new Record({
101
- onMediaProgress: api.renderAudioGraph,
102
- onstop: (file) => emit("confirm", file)
103
- }));
104
- state.recorder.start().then((isSuccess) => {
105
- if (!isSuccess) {
106
- return emit("error");
107
- }
108
- state.record.status = constants.STATUS.RECORDING;
109
- });
110
- } else if (state.record.status === constants.STATUS.PAUSE) {
111
- state.record.status = constants.STATUS.RECORDING;
112
- state.recorder.resume();
98
+ const calcRecordTime = ({ state }) => (recording = false) => {
99
+ state.record.now = Date.now();
100
+ if (!state.record.fn) {
101
+ state.record.fn = () => {
102
+ const cur = Date.now();
103
+ state.record.currentTime += (cur - state.record.now) / 1e3;
104
+ state.record.now = cur;
105
+ };
106
+ }
107
+ if (!recording) {
108
+ state.record.timer = setInterval(state.record.fn, 1e3);
109
+ } else {
110
+ clearInterval(state.record.timer);
111
+ state.record.timer = null;
112
+ state.record.fn();
113
+ }
114
+ };
115
+ const toogleRecord = ({ state, api, emit, constants, props }) => ($event) => {
116
+ const { READY, RECORDING, PAUSE } = constants.STATUS;
117
+ if (props.isHwh5) {
118
+ if (state.record.status === READY) {
119
+ api.triggerClick($event, constants.HWH5_STATUS.START, () => state.record.status = RECORDING);
120
+ } else if (state.record.status === PAUSE) {
121
+ api.triggerClick($event, constants.HWH5_STATUS.CONTINUE, () => state.record.status = RECORDING);
122
+ } else {
123
+ api.triggerClick($event, constants.HWH5_STATUS.PAUSE, () => state.record.status = PAUSE);
124
+ }
125
+ } else {
126
+ if (state.record.status === READY) {
127
+ !state.recorder && (state.recorder = new Record({
128
+ onMediaProgress: (analyser, audioContext) => {
129
+ state.record.currentTime = audioContext.currentTime;
130
+ state.voiceNum = calcVoice(analyser);
131
+ },
132
+ onstop: (file) => emit("confirm", file)
133
+ }));
134
+ state.recorder.start().then((isSuccess) => {
135
+ if (!isSuccess) {
136
+ return emit("error");
137
+ }
138
+ state.record.status = RECORDING;
139
+ });
140
+ } else if (state.record.status === PAUSE) {
141
+ state.record.status = RECORDING;
142
+ state.recorder.resume();
143
+ } else {
144
+ state.record.status = PAUSE;
145
+ state.recorder.pause();
146
+ }
147
+ }
148
+ };
149
+ const handleConfirm = ({ state, emit, props, constants, api }) => ($event) => {
150
+ if (props.isHwh5) {
151
+ api.triggerClick($event, constants.HWH5_STATUS.CANCEL, () => emit("update:modelValue", false));
113
152
  } else {
114
- state.record.status = constants.STATUS.PAUSE;
115
- state.recorder.pause();
153
+ state.isClickConfirm = true;
154
+ emit("update:modelValue", false);
116
155
  }
117
156
  };
118
- const handleConfirm = ({ state, emit }) => () => {
119
- state.isClickConfirm = true;
120
- emit("update:modelValue", false);
157
+ const handleCancel = ({ emit, props, constants, api, state }) => ($event) => {
158
+ if (props.isHwh5) {
159
+ api.triggerClick($event, constants.HWH5_STATUS.CANCEL, () => emit("update:modelValue", false));
160
+ } else {
161
+ state.isClickConfirm = true;
162
+ emit("update:modelValue", false);
163
+ }
164
+ };
165
+ const triggerClick = ({ state }) => ($event, type, cb) => {
166
+ const res = state.listeners["trigger-click"] && state.listeners["trigger-click"]($event, type);
167
+ if (res && res.then) {
168
+ res.then(() => cb && cb());
169
+ } else {
170
+ cb && cb();
171
+ }
121
172
  };
122
173
  const watchModelValue = ({ api }) => (value) => !value && api.resetRecord();
174
+ const watchRecordStatus = ({ api, props, constants, state }) => (val) => {
175
+ if (val === constants.STATUS.RECORDING) {
176
+ props.isHwh5 && api.calcRecordTime();
177
+ api.renderAudioGraph();
178
+ } else if (val === constants.STATUS.PAUSE) {
179
+ props.isHwh5 && api.calcRecordTime(true);
180
+ }
181
+ cancelAnimationFrame(state.handlerId);
182
+ };
123
183
  const calcVoice = (analyser) => {
124
184
  const dataArray = new Uint8Array(analyser.fftSize);
125
185
  analyser.getByteTimeDomainData(dataArray);
@@ -130,61 +190,108 @@ const calcVoice = (analyser) => {
130
190
  lowValue += dataArray[i] < 128 ? 128 - dataArray[i] : 0;
131
191
  }
132
192
  let voiceNum = 1;
133
- const voiceMatch = [0, 100, 500, 1e3, 1e4];
134
- const ismatch = voiceMatch.some((val2, idx) => {
135
- if (highValue <= val2) {
136
- return voiceNum = idx + 1 + (val2 === 0 ? lowValue / 1e3 : highValue / val2);
193
+ const voiceMatch = [0, 500, 1e3, 5e3, 1e4];
194
+ const ismatch = voiceMatch.some((val, idx) => {
195
+ if (highValue <= val) {
196
+ return voiceNum = idx + 1 + (val === 0 ? lowValue / 1e3 : highValue / val);
137
197
  }
138
198
  });
139
199
  !ismatch && (voiceNum = 6);
140
- const val = voiceNum * 5;
141
- let result = [-val, 2 * val, -3 * val];
142
- return result.concat(
143
- result.slice().reverse().map((times) => -times)
144
- );
200
+ return voiceNum;
201
+ };
202
+ const getOptions = ({ canvasCtx, width }) => {
203
+ const createStrokeStyle = ({ canvasCtx: canvasCtx2, width: width2, colors = [] }) => {
204
+ const grd = canvasCtx2.createLinearGradient(0, 0, width2, 0);
205
+ colors.forEach(({ n, color }) => grd.addColorStop(n, color));
206
+ return grd;
207
+ };
208
+ const optionList = [
209
+ { q: 0, a: 8, w: 1 / 35, speed: -0.05 },
210
+ { q: 4, a: 7, w: 1 / 35, speed: -0.1 },
211
+ { q: 10, a: 6, w: 1 / 35, speed: -0.3 }
212
+ ];
213
+ const colorOptions = [
214
+ [
215
+ { n: 0, color: "rgba(0, 109, 213, 0)" },
216
+ { n: 0.5, color: "rgba(0, 109, 213, 0.8)" },
217
+ { n: 1, color: "rgba(0, 109, 213, 0)" }
218
+ ],
219
+ [
220
+ { n: 0, color: "rgba(0, 14, 215, 0)" },
221
+ { n: 0.5, color: "rgba(0, 14, 215, 0.4)" },
222
+ { n: 1, color: "rgba(0, 14, 215, 0)" }
223
+ ],
224
+ [
225
+ { n: 0, color: "rgba(0, 109, 213, 0)" },
226
+ { n: 0.5, color: "rgba(0, 109, 213, 0.3)" },
227
+ { n: 1, color: "rgba(0, 109, 213, 0)" }
228
+ ]
229
+ ];
230
+ optionList.forEach((option, i) => {
231
+ option.strokeStyle = createStrokeStyle({
232
+ canvasCtx,
233
+ width,
234
+ colors: colorOptions[i]
235
+ });
236
+ });
237
+ return optionList;
145
238
  };
146
- const renderAudioGraph = ({ vm, state }) => (analyser, audioContext) => {
147
- state.record.currentTime = audioContext.currentTime;
148
- let canvas = vm.$refs.canvas;
149
- if (canvas) {
150
- const height = canvas.offsetHeight;
151
- const width = canvas.offsetWidth;
152
- canvas.height = height;
153
- canvas.width = width;
154
- const canvasCtx = canvas.getContext("2d");
155
- canvasCtx.clearRect(0, 0, width, height);
156
- canvasCtx.fillStyle = "#fff";
157
- canvasCtx.fillRect(0, 0, width, height);
158
- canvasCtx.lineWidth = 1;
159
- const grd = canvasCtx.createLinearGradient(0, 0, width, 0);
160
- grd.addColorStop(0, "rgba(0, 103, 209, 0.1)");
161
- grd.addColorStop(0.5, "rgba(0, 103, 209, 1)");
162
- grd.addColorStop(1, "rgba(0, 103, 209, 0.1)");
163
- canvasCtx.strokeStyle = grd;
164
- let x = 0;
165
- canvasCtx.beginPath();
166
- canvasCtx.moveTo(x, height / 2);
167
- const tops = calcVoice(analyser);
168
- const space = width / 12;
169
- for (let j = 0; j < 6; j++) {
170
- canvasCtx.quadraticCurveTo(x += space, height / 2 - tops[j], x += space, height / 2);
239
+ const renderAudioGraph = ({ vm, nextTick, state, props }) => () => {
240
+ nextTick(() => {
241
+ let canvas = vm.$refs.canvas;
242
+ if (canvas) {
243
+ const height = canvas.offsetHeight;
244
+ const width = canvas.offsetWidth;
245
+ canvas.height = height;
246
+ canvas.width = width;
247
+ const canvasCtx = canvas.getContext("2d");
248
+ const optionList = getOptions({ canvasCtx, width });
249
+ const draw = () => {
250
+ state.handlerId = requestAnimationFrame(draw);
251
+ let voiceNum = 1;
252
+ if (!props.isHwh5 && state.voiceNum) {
253
+ voiceNum = state.voiceNum.toFixed(1);
254
+ }
255
+ canvasCtx.clearRect(0, 0, width, height);
256
+ canvasCtx.fillStyle = "#fff";
257
+ canvasCtx.fillRect(0, 0, width, height);
258
+ optionList.forEach((option) => {
259
+ const { a, w, speed, strokeStyle } = option;
260
+ canvasCtx.lineWidth = 1;
261
+ canvasCtx.strokeStyle = strokeStyle;
262
+ let x = 0;
263
+ canvasCtx.beginPath();
264
+ canvasCtx.moveTo(x, height / 2);
265
+ option.q += speed;
266
+ for (let x2 = 0; x2 <= width; x2++) {
267
+ const y = a * voiceNum * Math.sin(w * x2 + option.q) + height / 2;
268
+ canvasCtx.lineTo(x2, y);
269
+ }
270
+ canvasCtx.stroke();
271
+ });
272
+ };
273
+ draw();
171
274
  }
172
- canvasCtx.lineTo(width, height / 2);
173
- canvasCtx.stroke();
174
- }
275
+ });
175
276
  };
176
277
  const resetRecord = ({ state, constants }) => () => {
177
278
  state.record.status = constants.STATUS.READY;
178
279
  state.record.currentTime = 0;
179
- state.isClickConfirm && state.recorder && state.recorder.stop();
280
+ state.isClickConfirm && state.recorder && state.recorder.recorder && state.recorder.stop();
180
281
  state.isClickConfirm = false;
282
+ clearInterval(state.record.timer);
283
+ state.record.timer = null;
181
284
  };
182
285
  const unmounted = ({ api }) => () => api.resetRecord();
183
286
  export {
287
+ calcRecordTime,
288
+ handleCancel,
184
289
  handleConfirm,
185
290
  renderAudioGraph,
186
291
  resetRecord,
187
292
  toogleRecord,
293
+ triggerClick,
188
294
  unmounted,
189
- watchModelValue
295
+ watchModelValue,
296
+ watchRecordStatus
190
297
  };
package/record/vue.js CHANGED
@@ -1,8 +1,20 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { toogleRecord, handleConfirm, watchModelValue, renderAudioGraph, unmounted, resetRecord } from "./index";
3
- const api = ["state", "toogleRecord", "handleConfirm"];
4
- const initState = ({ api: api2, reactive, computed }) => {
2
+ import {
3
+ toogleRecord,
4
+ handleConfirm,
5
+ watchModelValue,
6
+ renderAudioGraph,
7
+ unmounted,
8
+ resetRecord,
9
+ handleCancel,
10
+ triggerClick,
11
+ watchRecordStatus,
12
+ calcRecordTime
13
+ } from "./index";
14
+ const api = ["state", "toogleRecord", "handleConfirm", "handleCancel"];
15
+ const initState = ({ vm, api: api2, reactive, computed }) => {
5
16
  const state = reactive({
17
+ listeners: vm.$listeners,
6
18
  record: {
7
19
  status: "ready",
8
20
  currentTime: 0
@@ -17,25 +29,30 @@ const initState = ({ api: api2, reactive, computed }) => {
17
29
  Object.assign(api2, { state });
18
30
  return state;
19
31
  };
20
- const initApi = ({ api: api2, state, emit, vm, constants }) => {
32
+ const initApi = ({ api: api2, state, emit, vm, constants, props, nextTick }) => {
21
33
  Object.assign(api2, {
22
- toogleRecord: toogleRecord({ state, api: api2, emit, constants }),
23
- handleConfirm: handleConfirm({ state, emit }),
34
+ toogleRecord: toogleRecord({ state, api: api2, emit, constants, props }),
35
+ handleConfirm: handleConfirm({ state, emit, props, constants, api: api2 }),
24
36
  watchModelValue: watchModelValue({ api: api2 }),
25
- renderAudioGraph: renderAudioGraph({ vm, state }),
37
+ renderAudioGraph: renderAudioGraph({ vm, nextTick, state, props }),
26
38
  unmounted: unmounted({ api: api2 }),
27
- resetRecord: resetRecord({ state, constants })
39
+ resetRecord: resetRecord({ state, constants }),
40
+ handleCancel: handleCancel({ emit, props, constants, api: api2, state }),
41
+ triggerClick: triggerClick({ state }),
42
+ watchRecordStatus: watchRecordStatus({ api: api2, props, constants, state }),
43
+ calcRecordTime: calcRecordTime({ state })
28
44
  });
29
45
  };
30
- const initWatch = ({ watch, props, api: api2 }) => {
46
+ const initWatch = ({ watch, props, api: api2, state }) => {
31
47
  watch(() => props.modelValue, api2.watchModelValue, { immediate: true });
48
+ watch(() => state.record.status, api2.watchRecordStatus);
32
49
  };
33
- const renderless = (props, { reactive, watch, computed, onUnmounted }, { emit, vm, constants }) => {
50
+ const renderless = (props, { reactive, watch, computed, onUnmounted, nextTick }, { emit, vm, constants }) => {
34
51
  const api2 = {};
35
- const state = initState({ api: api2, reactive, computed });
36
- initApi({ api: api2, state, emit, vm, constants });
37
- initWatch({ watch, props, api: api2 });
38
- onUnmounted(() => api2.unmounted);
52
+ const state = initState({ vm, api: api2, reactive, computed });
53
+ initApi({ api: api2, state, emit, vm, constants, props, nextTick });
54
+ initWatch({ watch, props, api: api2, state });
55
+ onUnmounted(api2.unmounted);
39
56
  return api2;
40
57
  };
41
58
  export {
package/roles/index.js CHANGED
@@ -37,15 +37,15 @@ const changeRole = ({ constants, emit, props, service, state }) => ({ roleId })
37
37
  });
38
38
  });
39
39
  };
40
- const initService = (service) => {
40
+ const initService = (service, props) => {
41
41
  const { base = {}, common = {}, pushCustomized } = service || {};
42
42
  const noopFn = () => Promise.resolve(null);
43
43
  const commonNoopFn = () => Promise.reject(new Error("[Tiny Error][Roles] This component depends on @opentiny/vue-service"));
44
44
  return {
45
- getEnvInfoSync: base.getEnvInfoSync || commonNoopFn,
46
- getChangeRoleUrl: common.getChangeRoleUrl || commonNoopFn,
47
- getCustomized: common.getCustomized || noopFn,
48
- pushCustomized: pushCustomized || noopFn
45
+ getEnvInfoSync: props.getEnvInfoSync || base.getEnvInfoSync || commonNoopFn,
46
+ getChangeRoleUrl: props.getChangeRoleUrl || common.getChangeRoleUrl || commonNoopFn,
47
+ getCustomized: props.getCustomized || common.getCustomized || noopFn,
48
+ pushCustomized: props.pushCustomized || pushCustomized || noopFn
49
49
  };
50
50
  };
51
51
  export {
package/roles/vue.js CHANGED
@@ -2,7 +2,7 @@ import "../chunk-PKUHTIDK.js";
2
2
  import { showList, show, hide, getRoleList, changeRole, initService } from "./index";
3
3
  const api = ["state", "showList", "show", "hide", "changeRole"];
4
4
  const renderless = (props, { computed, reactive }, { emit, service, constants }) => {
5
- const $service = initService(service);
5
+ const $service = initService(service, props);
6
6
  let api2 = {};
7
7
  const state = reactive({
8
8
  currentRole: "",
package/slider/index.js CHANGED
@@ -9,7 +9,7 @@ const bindEvent = (api) => () => {
9
9
  };
10
10
  const unBindEvent = (api) => () => off(window, "resize", api.bindResize);
11
11
  const bindResize = ({ parent, props, state }) => () => {
12
- const handleEl = parent.$el.firstElementChild;
12
+ const handleEl = parent.$el.querySelector("div[role=tiny-slider]");
13
13
  state.sliderSize = handleEl["client" + (props.vertical ? "Height" : "Width")];
14
14
  state.sliderOffset = handleEl.getBoundingClientRect();
15
15
  };
@@ -307,10 +307,12 @@ const watchActiveValue = ({ api, emit, props, state }) => (newValue, oldValue) =
307
307
  const watchModelValue = ({ api, state }) => (value) => {
308
308
  if (!state.innerTrigger) {
309
309
  api.initSlider(value);
310
+ api.setActiveButtonValue(value);
310
311
  } else {
311
312
  state.innerTrigger = false;
312
313
  if (!state.isDouble) {
313
314
  api.initSlider(value);
315
+ api.setActiveButtonValue(value);
314
316
  }
315
317
  }
316
318
  };
package/steps/index.js CHANGED
@@ -23,8 +23,16 @@ const computedRightNodePos = ({ state, props }) => () => {
23
23
  right: -(index + 1) * 4 + "px"
24
24
  }));
25
25
  };
26
+ const computedSpace = ({ props }) => {
27
+ const { space } = props;
28
+ if (/^\d+$/.test(space)) {
29
+ return `${space}px`;
30
+ }
31
+ return space;
32
+ };
26
33
  export {
27
34
  computedRightNodePos,
35
+ computedSpace,
28
36
  isVisibleHandler,
29
37
  updateStartIndex
30
38
  };
package/steps/vue.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { updateStartIndex, isVisibleHandler, computedRightNodePos } from "./index";
2
+ import { updateStartIndex, isVisibleHandler, computedRightNodePos, computedSpace } from "./index";
3
3
  const api = ["state", "isVisibleHandler"];
4
4
  const renderless = (props, { reactive, watch, computed }) => {
5
5
  const state = reactive({
6
6
  startIndex: 0,
7
7
  endIndex: computed(() => state.startIndex + props.visibleNum),
8
- rightNodePositions: computed(() => api2.computedRightNodePos())
8
+ rightNodePositions: computed(() => api2.computedRightNodePos()),
9
+ computedSpace: computed(() => computedSpace({ props }))
9
10
  });
10
11
  const api2 = {
11
12
  updateStartIndex: updateStartIndex({ state, props }),
@@ -2,9 +2,9 @@ import "../chunk-PKUHTIDK.js";
2
2
  import { addResizeListener, removeResizeListener } from "../common/deps/resize-event";
3
3
  import { wheelListener, getBoundRect, handleClickDropdownItem, key, emitAdd } from "./index";
4
4
  import { getAddWheelListener } from "./wheel";
5
- const { addWheelListener, removeWheelListener } = getAddWheelListener(window, document);
6
5
  const api = ["state", "wheelListener", "handleClickDropdownItem", "key", "emitAdd"];
7
6
  const renderless = (props, { onMounted, onBeforeUnmount, reactive, watch, inject, computed }, { vm }) => {
7
+ const { addWheelListener, removeWheelListener } = getAddWheelListener(window, document);
8
8
  const tabs = inject("tabs", null);
9
9
  const state = reactive({
10
10
  moreList: [],
package/text-popup/vue.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { computedWidth, watchValue, mounted, onFocus, onBlur, onInput, separteText, jointText } from "./index";
3
3
  const api = ["state", "onFocus", "onBlur", "onInput"];
4
- const renderless = (props, { computed, onMounted, reactive, watch }, { emit, nextTick, refs }) => {
4
+ const renderless = (props, { computed, onMounted, reactive, watch, inject }, { emit, nextTick, refs }) => {
5
5
  const api2 = {};
6
6
  const state = reactive({
7
+ showAutoWidth: inject("showAutoWidth", null),
7
8
  type: "input",
8
9
  textAreaValue: "",
9
10
  text: null,
@@ -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 = {