@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
@@ -6,15 +6,18 @@ const nameSpace = "@@clickoutsideContext";
6
6
  let startClick;
7
7
  let seed = 0;
8
8
  if (!isServer) {
9
- on(document, "mousedown", (event) => startClick = event);
9
+ on(document, "mousedown", (event) => {
10
+ startClick = event;
11
+ nodeList.filter((node) => node[nameSpace].mousedownTrigger).forEach((node) => node[nameSpace].documentHandler(event, startClick));
12
+ });
10
13
  on(document, "mouseup", (event) => {
11
- nodeList.forEach((node) => node[nameSpace].documentHandler(event, startClick));
12
- startClick = void 0;
14
+ nodeList.filter((node) => !node[nameSpace].mousedownTrigger).forEach((node) => node[nameSpace].documentHandler(event, startClick));
15
+ startClick = null;
13
16
  });
14
17
  }
15
18
  const createDocumentHandler = (el, binding, vnode) => function(mouseup = {}, mousedown = {}) {
16
19
  let popperElm = vnode.context.popperElm || vnode.context.state && vnode.context.state.popperElm;
17
- if (!mouseup || !mouseup.target || !mousedown || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target || popperElm && (popperElm.contains(mouseup.target) || popperElm.contains(mousedown.target))) {
20
+ if (!(mouseup == null ? void 0 : mouseup.target) || !(mousedown == null ? void 0 : mousedown.target) || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target || popperElm && (popperElm.contains(mouseup.target) || popperElm.contains(mousedown.target))) {
18
21
  return;
19
22
  }
20
23
  if (binding.expression && el[nameSpace].methodName && vnode.context[el[nameSpace].methodName]) {
@@ -27,17 +30,21 @@ var clickoutside_default = {
27
30
  bind: (el, binding, vnode) => {
28
31
  nodeList.push(el);
29
32
  const id = seed++;
33
+ const { modifiers, expression, value } = binding;
30
34
  el[nameSpace] = {
31
35
  id,
32
36
  documentHandler: createDocumentHandler(el, binding, vnode),
33
- methodName: binding.expression,
34
- bindingFn: binding.value
37
+ methodName: expression,
38
+ bindingFn: value,
39
+ mousedownTrigger: modifiers.mousedown
35
40
  };
36
41
  },
37
42
  update: (el, binding, vnode) => {
43
+ const { modifiers, expression, value } = binding;
38
44
  el[nameSpace].documentHandler = createDocumentHandler(el, binding, vnode);
39
- el[nameSpace].methodName = binding.expression;
40
- el[nameSpace].bindingFn = binding.value;
45
+ el[nameSpace].methodName = expression;
46
+ el[nameSpace].bindingFn = value;
47
+ el[nameSpace].mousedownTrigger = modifiers.mousedown;
41
48
  },
42
49
  unbind: (el) => {
43
50
  if (el.nodeType !== Node.ELEMENT_NODE) {
@@ -186,6 +186,13 @@ const getOffsetRect = (el) => {
186
186
  const stopFn = (ev) => {
187
187
  ev.stopPropagation();
188
188
  };
189
+ const resizeOb = new ResizeObserver((entries) => {
190
+ entries.forEach((entry) => {
191
+ if (entry.target.popperVm && entry.contentRect.height > 50) {
192
+ entry.target.popperVm.update();
193
+ }
194
+ });
195
+ });
189
196
  class Popper {
190
197
  constructor(reference, popper, options) {
191
198
  this.modifiers = {};
@@ -201,6 +208,10 @@ class Popper {
201
208
  this._popper.setAttribute("x-placement", this._options.placement);
202
209
  this.state.position = this._getPopperPositionByRefernce(this._reference);
203
210
  setStyle(this._popper, { position: this.state.position, top: 0 });
211
+ if (this._popper) {
212
+ this._popper.popperVm = this;
213
+ resizeOb.observe(this._popper);
214
+ }
204
215
  this.update();
205
216
  this._setupEventListeners();
206
217
  }
@@ -295,6 +306,9 @@ class Popper {
295
306
  }
296
307
  // 校正popper的位置在boundaries 的内部
297
308
  preventOverflow(data) {
309
+ if (this._options.ignoreBoundaries) {
310
+ return data;
311
+ }
298
312
  let order = this._options.preventOverflowOrder;
299
313
  let popper = getPopperClientRect(data.offsets.popper);
300
314
  let check = {
@@ -498,7 +512,7 @@ class Popper {
498
512
  };
499
513
  on(window, "resize", this.state.updateBoundFn);
500
514
  if (this._options.boundariesElement !== "window") {
501
- let target = getScrollParent(this._reference);
515
+ let target = this._options.scrollParent || getScrollParent(this._reference);
502
516
  const customTargets = [];
503
517
  if ((_b = (_a = target == null ? void 0 : target.dataset) == null ? void 0 : _a.tag) == null ? void 0 : _b.includes("-form")) {
504
518
  customTargets.push(target);
@@ -31,6 +31,13 @@ function throttle_default(delay, noTrailing, callback, debounceMode) {
31
31
  timeoutID = setTimeout(debounceMode ? clear : exec, isUndMode ? delay - elapsed : delay);
32
32
  }
33
33
  }
34
+ function cancel() {
35
+ if (timeoutID) {
36
+ clearTimeout(timeoutID);
37
+ timeoutID = null;
38
+ }
39
+ }
40
+ wrapper._cancel = cancel;
34
41
  return wrapper;
35
42
  }
36
43
  export {
@@ -3,7 +3,7 @@ let emulated = false;
3
3
  let initiated = false;
4
4
  let eventTarget = null;
5
5
  let mouseTarget = null;
6
- const matches = Element.prototype.matches || Element.prototype.webkitMatchesSelector;
6
+ const matches = Element.prototype.matches;
7
7
  const closest = (el, s) => {
8
8
  do {
9
9
  if (matches.call(el, s))
@@ -227,6 +227,7 @@ class Node {
227
227
  child.level = this.level + 1;
228
228
  insertNode({ arr: this.childNodes, index, item: child });
229
229
  this.updateLeafState();
230
+ return child;
230
231
  }
231
232
  insertBefore(child, beforeNode) {
232
233
  let index;
@@ -90,7 +90,10 @@ class TreeStore {
90
90
  }
91
91
  append(data, parentData, index) {
92
92
  const parentNode = parentData ? this.getNode(parentData) : this.root;
93
- parentNode && parentNode.insertChild({ data }, index);
93
+ if (parentNode) {
94
+ const child = parentNode.insertChild({ data }, index);
95
+ data._isNewNode && this.registerNode(child);
96
+ }
94
97
  }
95
98
  setDefaultCheckedKey(newValue) {
96
99
  if (newValue !== this.defaultCheckedKeys) {
@@ -2,7 +2,10 @@ import "../../chunk-G2ADBYYC.js";
2
2
  import { on, off, isServer } from "./dom";
3
3
  const onMountedOrActivated = ({ onMounted, onActivated, nextTick }) => (hook) => {
4
4
  let mounted;
5
- onMounted(() => (hook(), nextTick(() => mounted = true)));
5
+ onMounted(() => {
6
+ hook();
7
+ nextTick(() => mounted = true);
8
+ });
6
9
  onActivated(() => mounted && hook());
7
10
  };
8
11
  const useEventListener = ({ unref, isRef, watch, nextTick, onMounted, onUnmounted, onActivated, onDeactivated }) => (type, listener, options = {}) => {
@@ -34,7 +37,10 @@ const useEventListener = ({ unref, isRef, watch, nextTick, onMounted, onUnmounte
34
37
  onMountedOrActivated({ onMounted, onActivated, nextTick })(() => add(target));
35
38
  let stopWatch;
36
39
  if (isRef(target)) {
37
- stopWatch = watch(target, (val, oldVal) => (remove(oldVal), add(val)));
40
+ stopWatch = watch(target, (val, oldVal) => {
41
+ remove(oldVal);
42
+ add(val);
43
+ });
38
44
  }
39
45
  return () => {
40
46
  stopWatch && stopWatch();
@@ -43,5 +49,6 @@ const useEventListener = ({ unref, isRef, watch, nextTick, onMounted, onUnmounte
43
49
  };
44
50
  };
45
51
  export {
52
+ onMountedOrActivated,
46
53
  useEventListener
47
54
  };
@@ -0,0 +1,22 @@
1
+ import "../../chunk-G2ADBYYC.js";
2
+ const useInstanceSlots = ({ getCurrentInstance, isVue2, nextTick, onUnmounted }) => () => {
3
+ const publicInstance = getCurrentInstance().proxy;
4
+ if (!isVue2) {
5
+ Object.defineProperty(publicInstance, "$scopedSlots", { configurable: true, value: null });
6
+ }
7
+ Object.defineProperty(publicInstance, "instanceSlots", {
8
+ configurable: true,
9
+ get: () => publicInstance.$scopedSlots || publicInstance.$slots
10
+ });
11
+ onUnmounted(() => {
12
+ nextTick(() => {
13
+ if (!isVue2) {
14
+ delete publicInstance.$scopedSlots;
15
+ }
16
+ delete publicInstance.instanceSlots;
17
+ });
18
+ });
19
+ };
20
+ export {
21
+ useInstanceSlots
22
+ };
@@ -0,0 +1,72 @@
1
+ import "../../chunk-G2ADBYYC.js";
2
+ import { noop } from "../function";
3
+ import { onMountedOrActivated as createHook } from "./useEventListener";
4
+ const useRelation = ({ getCurrentInstance, inject, markRaw, nextTick, onMounted, onActivated, onUnmounted, provide, reactive, toRef }) => ({ relationKey, relationContainer, onChange, childrenKey } = {}) => {
5
+ if (!relationKey) {
6
+ throw new Error("[TINY Error]<relationKey> must exist.");
7
+ }
8
+ const instance = getCurrentInstance();
9
+ const state = reactive({ children: [] });
10
+ const injectValue = inject(relationKey, null);
11
+ let callbacks = [];
12
+ if (injectValue) {
13
+ const { link: link2, unlink: unlink2, callbacks: injectCbs, childrenKey: injectKey } = injectValue;
14
+ callbacks = injectCbs;
15
+ childrenKey = childrenKey || injectKey || "instanceChildren";
16
+ link2(instance);
17
+ onUnmounted(() => unlink2(instance));
18
+ } else {
19
+ childrenKey = childrenKey || "instanceChildren";
20
+ const onMountedOrActivated = createHook({ onMounted, onActivated, nextTick });
21
+ const changeHandler = onChange ? () => nextTick(onChange) : noop;
22
+ let relationMO;
23
+ nextTick(() => {
24
+ const targetNode = typeof relationContainer === "function" ? relationContainer() : relationContainer;
25
+ if (targetNode) {
26
+ relationMO = new MutationObserver((mutationList, observer) => {
27
+ const flattenNodes = [];
28
+ flattenChildNodes(targetNode.childNodes, flattenNodes);
29
+ callbacks.forEach((callback) => callback(flattenNodes, mutationList, observer));
30
+ changeHandler();
31
+ });
32
+ relationMO.observe(targetNode, { attributes: true, childList: true, subtree: true });
33
+ }
34
+ });
35
+ onMountedOrActivated(() => changeHandler());
36
+ onUnmounted(() => {
37
+ if (relationMO) {
38
+ relationMO.disconnect();
39
+ relationMO = null;
40
+ }
41
+ callbacks = null;
42
+ });
43
+ }
44
+ const link = (child) => state.children.push(markRaw(child.proxy));
45
+ const unlink = (child) => {
46
+ const index = state.children.indexOf(child.proxy);
47
+ if (index > -1) {
48
+ state.children.splice(index, 1);
49
+ }
50
+ };
51
+ callbacks.push((flattenNodes) => sortPublicInstances(state.children, flattenNodes));
52
+ provide(relationKey, { link, unlink, callbacks, childrenKey });
53
+ Object.defineProperty(instance.proxy, childrenKey, { configurable: true, get: () => state.children });
54
+ onUnmounted(() => delete instance.proxy[childrenKey]);
55
+ return { children: toRef(state, "children") };
56
+ };
57
+ const flattenChildNodes = (childNodes, result) => {
58
+ if (childNodes.length) {
59
+ childNodes.forEach((childNode) => {
60
+ result.push(childNode);
61
+ if (childNode.childNodes) {
62
+ flattenChildNodes(childNode.childNodes, result);
63
+ }
64
+ });
65
+ }
66
+ };
67
+ const sortPublicInstances = (instances, flattenNodes) => {
68
+ instances.sort((a, b) => flattenNodes.indexOf(a.$el) - flattenNodes.indexOf(b.$el));
69
+ };
70
+ export {
71
+ useRelation
72
+ };
@@ -119,6 +119,7 @@ var vue_popper_default = (options) => {
119
119
  }
120
120
  const popperJS = state.popperJS;
121
121
  if (popperJS) {
122
+ popperJS._reference = getReference({ state, props, vm, slots });
122
123
  popperJS.update();
123
124
  if (popperJS._popper && popperElmOrTrue !== true) {
124
125
  popperJS._popper.style.zIndex = nextZIndex(popperJS._reference);
@@ -0,0 +1,28 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { isPromise } from "./type";
3
+ const noop = () => {
4
+ };
5
+ const callInterceptor = (interceptor, { args = [], done, canceled, error }) => {
6
+ if (interceptor) {
7
+ const returnVal = interceptor(...args);
8
+ if (isPromise(returnVal)) {
9
+ returnVal.then((value) => {
10
+ if (value) {
11
+ done();
12
+ } else if (canceled) {
13
+ canceled();
14
+ }
15
+ }).catch(error || noop);
16
+ } else if (returnVal) {
17
+ done();
18
+ } else if (canceled) {
19
+ canceled();
20
+ }
21
+ } else {
22
+ done();
23
+ }
24
+ };
25
+ export {
26
+ callInterceptor,
27
+ noop
28
+ };
package/common/index.js CHANGED
@@ -237,7 +237,7 @@ const CASCADER = {
237
237
  PropsHover: "hoverThreshold",
238
238
  MenuConnector: "cascader-menu-"
239
239
  };
240
- const version = "3.16.1";
240
+ const version = "3.17.0";
241
241
  const log = (data, type = "log") => {
242
242
  uLog.logger[type](data);
243
243
  };
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.16.1";
25
+ const version = "3.17.0";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
package/common/type.js CHANGED
@@ -47,6 +47,7 @@ const isNumeric = (value) => value - parseFloat(value) >= 0;
47
47
  const isDate = (value) => typeOf(value) === "date";
48
48
  const isSame = (x, y) => x === y || typeof x === "number" && typeof y === "number" && isNaN(x) && isNaN(y);
49
49
  const isRegExp = (value) => typeOf(value) === "regExp";
50
+ const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
50
51
  export {
51
52
  hasOwn,
52
53
  isDate,
@@ -57,6 +58,7 @@ export {
57
58
  isNumeric,
58
59
  isObject,
59
60
  isPlainObject,
61
+ isPromise,
60
62
  isRegExp,
61
63
  isSame,
62
64
  toString,
@@ -35,27 +35,6 @@ const computedStyle = ({ props, state, designConfig }) => () => {
35
35
  }
36
36
  return style;
37
37
  };
38
- const computedBodyStyle = ({ vm, props, state }) => () => {
39
- const style = {
40
- maxHeight: ""
41
- };
42
- const headerHeight = vm.$refs.header && vm.$refs.header.offsetHeight || 0;
43
- const footerHeight = vm.$refs.footer && vm.$refs.footer.offsetHeight || 0;
44
- let { maxHeight } = props;
45
- if (state.isFull || props.rightSlide) {
46
- if (vm.$slots.footer) {
47
- style.maxHeight = `calc(100vh - ${headerHeight + footerHeight}px)`;
48
- } else {
49
- style.maxHeight = `calc(100vh - ${headerHeight}px)`;
50
- }
51
- } else {
52
- style.maxHeight = "65vh";
53
- }
54
- if (maxHeight && !state.isFull) {
55
- style.maxHeight = "none";
56
- }
57
- return style;
58
- };
59
38
  const watchVisible = ({
60
39
  api,
61
40
  constants,
@@ -282,7 +261,6 @@ export {
282
261
  afterLeave,
283
262
  computedAddUnit,
284
263
  computedAnimationName,
285
- computedBodyStyle,
286
264
  computedStyle,
287
265
  handleCancel,
288
266
  handleClose,
package/dialog-box/vue.js CHANGED
@@ -20,7 +20,6 @@ import {
20
20
  handleDrag,
21
21
  showScrollbar,
22
22
  hideScrollbar,
23
- computedBodyStyle,
24
23
  toggleFullScreen
25
24
  } from "./index";
26
25
  import usePopup from "../common/deps/vue-popup";
@@ -59,7 +58,6 @@ const initState = ({
59
58
  dragable: false,
60
59
  isFull: props.fullscreen,
61
60
  style: computed(() => api2.computedStyle()),
62
- bodyStyle: computed(() => api2.computedBodyStyle()),
63
61
  animationName: computed(() => api2.computedAnimationName()),
64
62
  current,
65
63
  dragStyle: null
@@ -113,7 +111,6 @@ const initApi = ({
113
111
  state
114
112
  }),
115
113
  computedStyle: computedStyle({ state, props, designConfig }),
116
- computedBodyStyle: computedBodyStyle({ vm, props, state }),
117
114
  mounted: mounted({ api: api2, parent, props }),
118
115
  unMounted: unMounted({ api: api2, parent, props }),
119
116
  computedAnimationName: computedAnimationName({ constants, props }),
@@ -148,7 +145,7 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, toRefs, react
148
145
  useBreakpoint
149
146
  }) => {
150
147
  const api2 = {};
151
- const lockScrollClass = constants.scrollLockClass(mode);
148
+ const lockScrollClass = constants.SCROLL_LOCK_CLASS(mode);
152
149
  let state = initState({ reactive, computed, api: api2, emitter, props, useBreakpoint });
153
150
  const usePopups = usePopup({
154
151
  api: api2,
package/drawer/index.js CHANGED
@@ -14,17 +14,19 @@ const computedWidth = ({
14
14
  return props.width || ((_a = designConfig == null ? void 0 : designConfig.constants) == null ? void 0 : _a.DEFAULT_WIDTH) || constants.DEFAULT_WIDTH;
15
15
  };
16
16
  const close = ({ api }) => (force = false) => {
17
- api.handleClose("close", force);
17
+ api.handleClose("close", typeof force === "boolean" ? force : false);
18
18
  };
19
- const watchVisible = ({ state }) => (bool) => {
20
- setTimeout(() => {
21
- state.toggle = bool;
22
- }, 0);
19
+ const watchVisible = ({ state, api }) => (value) => {
20
+ value ? api.open() : api.close();
23
21
  };
24
- const watchToggle = ({ emit }) => (bool) => {
25
- setTimeout(() => {
26
- emit("update:visible", bool);
27
- }, 0);
22
+ const open = ({ state, emit, vm }) => () => {
23
+ if (!state.visible) {
24
+ setTimeout(() => {
25
+ state.visible = true;
26
+ emit("open", vm);
27
+ emit("update:visible", true);
28
+ }, 0);
29
+ }
28
30
  };
29
31
  const confirm = ({ api }) => () => {
30
32
  api.handleClose("confirm");
@@ -35,14 +37,17 @@ const handleClose = ({ emit, props, state }) => (type, force) => {
35
37
  if (isMaskNotClosable || isBlockClose) {
36
38
  return;
37
39
  }
38
- if (type !== "confirm") {
39
- state.toggle = false;
40
+ if (state.visible) {
41
+ state.visible = false;
42
+ setTimeout(() => {
43
+ emit("update:visible", false);
44
+ emit(["close", "confirm"].includes(type) ? type : "close");
45
+ }, 200);
40
46
  }
41
- emit(["close", "confirm"].includes(type) ? type : "close");
42
47
  };
43
- const mousedown = ({ state, vm }) => (event2) => {
44
- event2.preventDefault();
45
- const touch = event2.touches ? event2.touches[0] : event2;
48
+ const mousedown = ({ state, vm }) => (event) => {
49
+ event.preventDefault();
50
+ const touch = event.touches ? event.touches[0] : event;
46
51
  const drawerBox = vm.$refs.drawerBox;
47
52
  state.dragEvent.isDrag = true;
48
53
  state.dragEvent.x = touch.clientX;
@@ -50,18 +55,18 @@ const mousedown = ({ state, vm }) => (event2) => {
50
55
  state.dragEvent.offsetWidth = drawerBox.offsetWidth;
51
56
  state.dragEvent.offsetHeight = drawerBox.offsetHeight;
52
57
  };
53
- const mousemove = ({ state, props }) => debounce(1, (event2) => {
58
+ const mousemove = ({ state, props }) => debounce(1, (event) => {
54
59
  if (!state.dragEvent.isDrag) {
55
60
  return;
56
61
  }
57
- event2.preventDefault();
62
+ event.preventDefault();
58
63
  const { placement } = props;
59
64
  const {
60
65
  dragEvent: { x, y, offsetWidth, offsetHeight }
61
66
  } = state;
62
- const { touches, targetTouches, changedTouches } = event2;
67
+ const { touches, targetTouches, changedTouches } = event;
63
68
  const touch = touches && touches[0] || targetTouches && targetTouches[0] || changedTouches && changedTouches[0];
64
- const { clientX, clientY } = touch || event2;
69
+ const { clientX, clientY } = touch || event;
65
70
  const offsetX = clientX - x;
66
71
  const offsetY = clientY - y;
67
72
  if (placement === "left") {
@@ -76,11 +81,10 @@ const mousemove = ({ state, props }) => debounce(1, (event2) => {
76
81
  state.height = height > 10 ? height : 10;
77
82
  }
78
83
  });
79
- const mouseup = ({ state }) => () => {
84
+ const mouseup = ({ state }) => (event) => {
80
85
  if (!state.dragEvent.isDrag) {
81
86
  return;
82
87
  }
83
- ;
84
88
  event.preventDefault();
85
89
  state.dragEvent.isDrag = false;
86
90
  };
@@ -108,11 +112,6 @@ const showScrollbar = (lockScrollClass) => () => {
108
112
  const hideScrollbar = (lockScrollClass) => () => {
109
113
  removeClass(document.body, lockScrollClass);
110
114
  };
111
- const watchVisibleNotImmediate = ({ api, props }) => (visible) => {
112
- if (props.lockScroll) {
113
- visible ? api.showScrollbar() : api.hideScrollbar();
114
- }
115
- };
116
115
  export {
117
116
  addDragEvent,
118
117
  close,
@@ -123,9 +122,8 @@ export {
123
122
  mousedown,
124
123
  mousemove,
125
124
  mouseup,
125
+ open,
126
126
  removeDragEvent,
127
127
  showScrollbar,
128
- watchToggle,
129
- watchVisible,
130
- watchVisibleNotImmediate
128
+ watchVisible
131
129
  };
package/drawer/vue.js CHANGED
@@ -2,7 +2,6 @@ import "../chunk-G2ADBYYC.js";
2
2
  import {
3
3
  close,
4
4
  watchVisible,
5
- watchToggle,
6
5
  confirm,
7
6
  mousedown,
8
7
  mouseup,
@@ -11,17 +10,17 @@ import {
11
10
  removeDragEvent,
12
11
  showScrollbar,
13
12
  hideScrollbar,
14
- watchVisibleNotImmediate,
15
13
  handleClose,
16
- computedWidth
14
+ computedWidth,
15
+ open
17
16
  } from "./index";
18
- const api = ["state", "close", "confirm", "handleClose"];
17
+ const api = ["state", "close", "confirm", "handleClose", "open"];
19
18
  const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { emit, vm, mode, constants, designConfig }) => {
20
19
  var _a;
21
20
  const lockScrollClass = constants.SCROLL_LOCK_CLASS(mode);
22
21
  const api2 = {};
23
22
  const state = reactive({
24
- toggle: false,
23
+ visible: false,
25
24
  width: 0,
26
25
  height: 0,
27
26
  dragEvent: { x: 0, y: 0, isDrag: false, offsetWidth: 0, offsetHeight: 0 },
@@ -30,6 +29,7 @@ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, comput
30
29
  });
31
30
  Object.assign(api2, {
32
31
  state,
32
+ open: open({ state, emit, vm }),
33
33
  confirm: confirm({ api: api2 }),
34
34
  close: close({ api: api2 }),
35
35
  handleClose: handleClose({ emit, props, state }),
@@ -38,17 +38,14 @@ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, comput
38
38
  mouseup: mouseup({ state }),
39
39
  addDragEvent: addDragEvent({ api: api2, vm }),
40
40
  removeDragEvent: removeDragEvent({ api: api2, vm }),
41
- watchVisible: watchVisible({ state }),
42
- watchToggle: watchToggle({ emit }),
41
+ watchVisible: watchVisible({ state, api: api2 }),
43
42
  showScrollbar: showScrollbar(lockScrollClass),
44
43
  hideScrollbar: hideScrollbar(lockScrollClass),
45
- watchVisibleNotImmediate: watchVisibleNotImmediate({ api: api2, props }),
46
44
  computedWidth: computedWidth({ state, designConfig, props, constants })
47
45
  });
48
46
  onMounted(() => {
49
47
  props.dragable && api2.addDragEvent();
50
48
  if (props.lockScroll && props.visible) {
51
- ;
52
49
  api2.showScrollbar();
53
50
  }
54
51
  });
@@ -57,7 +54,6 @@ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, comput
57
54
  props.lockScroll && api2.hideScrollbar();
58
55
  });
59
56
  watch(() => props.visible, api2.watchVisible, { immediate: true });
60
- watch(() => state.toggle, api2.watchToggle);
61
57
  watch(
62
58
  () => props.width,
63
59
  () => state.width = 0
@@ -576,7 +576,7 @@ const handleSuccess = ({
576
576
  const file = api.getFile(rawFile);
577
577
  const status = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.status;
578
578
  const { STATUS_SPECIAL_CHARACTERS, NOT_SUPPORT_SPECIAL_CHARACTERS } = constants.EDM;
579
- delete file.cancelToken;
579
+ file && delete file.cancelToken;
580
580
  if (props.edm.upload && file && res.data && status !== 200) {
581
581
  if (status === STATUS_SPECIAL_CHARACTERS) {
582
582
  Modal.message({