@opentiny/vue-renderless 3.5.0 → 3.6.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.
@@ -1,64 +1,81 @@
1
- import { mountedHandler, beforeUnmountHandler, watchModelValue, onTouchstart, onTouchmove, onTouchend } from './index';
1
+ import { mountedHandler, beforeUnmountHandler, handlerModelValue, onTouchstart, onTouchmove, onTouchend, initPullRefresh, clearPullRefresh } from './index';
2
2
  export var api = ['state'];
3
3
  export var renderless = function renderless(props, _ref, _ref2) {
4
- var computed = _ref.computed,
4
+ var watch = _ref.watch,
5
5
  onMounted = _ref.onMounted,
6
6
  reactive = _ref.reactive,
7
- watch = _ref.watch,
8
7
  onBeforeUnmount = _ref.onBeforeUnmount;
9
- var refs = _ref2.refs,
10
- emit = _ref2.emit;
8
+ var t = _ref2.t,
9
+ refs = _ref2.refs;
11
10
  var api = {};
12
11
  var state = reactive({
13
- replaces: '',
14
- styleObj: {},
12
+ pullUpReplaces: '',
13
+ pullDownReplaces: '',
14
+ refreshStyle: {},
15
15
  translate3d: 0,
16
16
  draggposition: 0,
17
- value: props.modelValue,
18
- checkStatus: false,
19
- headHeight: props.headHeight,
20
- pullingText: props.pullingText,
21
- loosingText: props.loosingText,
22
- successText: props.successText,
17
+ pullUpLoading: false,
18
+ pullDownLoading: false,
19
+ loosingText: '',
20
+ successText: '',
21
+ failedText: '',
22
+ noMoreText: '',
23
+ pullUp: null,
24
+ pullDown: null,
23
25
  successDuration: props.successDuration,
24
- animationDuration: props.animationDuration,
25
- disabled: computed(function () {
26
- return props.disabled;
27
- })
26
+ animationDuration: props.animationDuration
28
27
  });
29
28
  Object.assign(api, {
30
29
  state: state,
31
- onTouchstart: onTouchstart({
32
- state: state
33
- }),
30
+ onTouchstart: onTouchstart(state),
34
31
  onTouchmove: onTouchmove({
35
- refs: refs,
32
+ props: props,
36
33
  state: state
37
34
  }),
38
35
  onTouchend: onTouchend({
39
- emit: emit,
36
+ api: api,
40
37
  props: props,
41
38
  state: state
42
39
  }),
43
40
  mountedHandler: mountedHandler({
44
41
  api: api,
45
- refs: refs,
46
- state: state
42
+ refs: refs
47
43
  }),
48
44
  beforeUnmountHandler: beforeUnmountHandler({
49
45
  api: api,
50
46
  refs: refs
51
- })
47
+ }),
48
+ handlerModelValue: handlerModelValue({
49
+ api: api,
50
+ state: state
51
+ }),
52
+ initPullRefresh: initPullRefresh({
53
+ t: t,
54
+ props: props,
55
+ state: state
56
+ }),
57
+ clearPullRefresh: clearPullRefresh(state)
52
58
  });
53
59
  watch(function () {
54
- return props.modelValue;
60
+ return props.hasMore;
55
61
  }, function (value) {
56
- watchModelValue({
57
- value: value,
62
+ if (!value) {
63
+ state.noMoreText = t('ui.pullRefresh.noMore');
64
+ api.clearPullRefresh();
65
+ }
66
+ });
67
+ onMounted(function () {
68
+ api.mountedHandler({
69
+ api: api,
70
+ refs: refs,
71
+ state: state
72
+ });
73
+ api.initPullRefresh({
74
+ t: t,
75
+ props: props,
58
76
  state: state
59
77
  });
60
78
  });
61
- onMounted(api.mountedHandler);
62
79
  onBeforeUnmount(api.beforeUnmountHandler);
63
80
  return api;
64
81
  };
package/rate/index.js CHANGED
@@ -191,7 +191,7 @@ export var computedDecimalStyle = function computedDecimalStyle(_ref10) {
191
191
  var clipPath = '';
192
192
  var fontSize = '';
193
193
  if (props.disabled) {
194
- width = "".concat(props.modelValue * 100 - Math.floor(props.modelValue) * 100 < 50 ? 0 : 50, "%");
194
+ width = "".concat(props.modelValue * 100 - Math.floor(props.modelValue) * 100 < 50 ? 0 : 100, "%");
195
195
  } else if (props.allowHalf) {
196
196
  var reactSize = props.size ? Math.ceil(parseInt(props.size) / 2) + 'px' : '6px';
197
197
  clip = "rect(0px, ".concat(reactSize, ", ").concat(props.size || '14px', ", 0px)");
package/slider/index.js CHANGED
@@ -221,7 +221,7 @@ var calcCurrentValue = function calcCurrentValue(_ref10) {
221
221
  } else {
222
222
  var step = props.step > 0 ? props.step : 1;
223
223
  var stepValue = (currentValue - props.min) % step;
224
- if (stepValue) {
224
+ if (stepValue > props.step / 10) {
225
225
  currentValue -= stepValue;
226
226
  currentValue += stepValue * 2 > step ? Number(step) : 0;
227
227
  }
package/split/index.js CHANGED
@@ -93,6 +93,7 @@ export var handleMousedown = function handleMousedown(_ref8) {
93
93
  props = _ref8.props,
94
94
  state = _ref8.state;
95
95
  return function (event) {
96
+ if (state.collapsed) return;
96
97
  state.initOffset = state.isHorizontal ? event.pageX : event.pageY;
97
98
  state.oldOffset = props.modelValue;
98
99
  state.isMoving = true;
@@ -119,4 +120,12 @@ export var computeOffset = function computeOffset(_ref9) {
119
120
  state.offset = props.modelValue * 10000 / 100;
120
121
  }
121
122
  };
123
+ };
124
+ export var handleCollapse = function handleCollapse(_ref10) {
125
+ var emit = _ref10.emit,
126
+ state = _ref10.state;
127
+ return function () {
128
+ state.collapsed = !state.collapsed;
129
+ emit('collapsedChange', state.collapsed);
130
+ };
122
131
  };
package/split/vue.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- import { px2percent, getComputedThresholdValue, getleftTopMin, getrightBottomMin, getAnotherOffset, handleMove, handleUp, handleMousedown, computeOffset } from './index';
4
+ import { px2percent, getComputedThresholdValue, getleftTopMin, getrightBottomMin, getAnotherOffset, handleMove, handleUp, handleMousedown, computeOffset, handleCollapse } from './index';
5
5
  import { on, off } from '@opentiny/vue-renderless/common/deps/dom';
6
- export var api = ['state', 'handleMousedown'];
6
+ export var api = ['state', 'handleMousedown', 'handleCollapse'];
7
7
  export var useOffset = function useOffset(_ref) {
8
8
  var nextTick = _ref.nextTick,
9
9
  props = _ref.props,
@@ -89,7 +89,8 @@ export var renderless = function renderless(props, hooks, _ref2) {
89
89
  }),
90
90
  paneClasses: computed(function () {
91
91
  return ["".concat(state.prefix, "-pane"), _defineProperty({}, "".concat(state.prefix, "-pane-moving"), state.isMoving)];
92
- })
92
+ }),
93
+ collapsed: false
93
94
  }, getUseOffset.state));
94
95
  Object.assign(api, _objectSpread(_objectSpread({
95
96
  state: state,
@@ -120,6 +121,10 @@ export var renderless = function renderless(props, hooks, _ref2) {
120
121
  props: props,
121
122
  state: state
122
123
  }),
124
+ handleCollapse: handleCollapse({
125
+ emit: emit,
126
+ state: state
127
+ }),
123
128
  getComputedThresholdValue: getComputedThresholdValue({
124
129
  api: api,
125
130
  props: props,
package/switch/index.js CHANGED
@@ -9,9 +9,12 @@ export var toggle = function toggle(_ref) {
9
9
  if (state.disabled) {
10
10
  return false;
11
11
  }
12
- state.currentValue = state.currentValue === props.trueValue ? props.falseValue : props.trueValue;
13
- emit('update:modelValue', state.currentValue);
14
- emit('change', state.currentValue);
12
+ var change = function change() {
13
+ state.currentValue = state.currentValue === props.trueValue ? props.falseValue : props.trueValue;
14
+ emit('update:modelValue', state.currentValue);
15
+ emit('change', state.currentValue);
16
+ };
17
+ props.beforeChange ? props.beforeChange(change) : change();
15
18
  };
16
19
  };
17
20
  export var computedWarpClasses = function computedWarpClasses(_ref2) {
package/switch/vue.js CHANGED
@@ -54,7 +54,7 @@ export var renderless = function renderless(props, _ref, _ref2) {
54
54
  watch(function () {
55
55
  return props.modelValue;
56
56
  }, function (value) {
57
- state.currentValue = value;
57
+ state.currentValue = typeof props.falseValue !== 'boolean' || typeof props.trueValue !== 'boolean' ? value : Boolean(value);
58
58
  }, {
59
59
  immediate: true
60
60
  });
package/tab-nav/index.js CHANGED
@@ -6,8 +6,7 @@ export var computedNavStyle = function computedNavStyle(state) {
6
6
  var dir = ~[POSITION.Top, POSITION.Bottom].indexOf(state.rootTabs.position) ? 'X' : 'Y';
7
7
  if (state.mode === 'mobile') {
8
8
  return {
9
- transform: "translate".concat(dir, "(").concat(state.lineOffset, "px) translate").concat(dir, "(-50%)"),
10
- width: "".concat(state.lineWidth, "px")
9
+ transform: "translate".concat(dir, "(").concat(state.lineOffset, "px) translate").concat(dir, "(-50%)")
11
10
  };
12
11
  } else {
13
12
  return {
@@ -56,7 +55,6 @@ export var updated = function updated(_ref2) {
56
55
  if (item.classList && item.classList.contains('is-active')) {
57
56
  var line = item.querySelector('.tiny-mobile-tabs__name');
58
57
  state.isActive = true;
59
- state.lineWidth = line.offsetWidth;
60
58
  state.lineOffset = item.offsetLeft + item.offsetWidth / 2;
61
59
  }
62
60
  });
@@ -238,4 +236,29 @@ export var moreTabShow = function moreTabShow(state) {
238
236
  state.showMoreItem = true;
239
237
  }
240
238
  };
239
+ };
240
+ export var expandTabShow = function expandTabShow(_ref8) {
241
+ var api = _ref8.api,
242
+ state = _ref8.state;
243
+ return function () {
244
+ state.showExpandItem = !state.showExpandItem;
245
+ if (state.showExpandItem) {
246
+ api.computedHeaderStyle();
247
+ }
248
+ };
249
+ };
250
+ export var expandTabHide = function expandTabHide(state) {
251
+ return function () {
252
+ return state.showExpandItem = false;
253
+ };
254
+ };
255
+ export var computedHeaderStyle = function computedHeaderStyle(_ref9) {
256
+ var refs = _ref9.refs,
257
+ state = _ref9.state;
258
+ return function () {
259
+ if (refs.nav) {
260
+ state.expandHeaderStyle[state.sizeName] = refs.nav["offset".concat(capitalize(state.sizeName))] + 'px';
261
+ }
262
+ return state.expandHeaderStyle;
263
+ };
241
264
  };
package/tab-nav/vue.js CHANGED
@@ -1,5 +1,5 @@
1
- import { computedNavStyle, computedSizeName, updated, visibilityChangeHandler, windowBlurHandler, windowFocusHandler, scrollToActiveTab, scrollIntoView, mounted, moreTabShow, beforeUnmount, scrollPrev, scrollNext, changeTab, setFocus, removeFocus } from './index';
2
- export var api = ['state', 'setFocus', 'removeFocus', 'scrollPrev', 'scrollNext', 'changeTab', 'scrollToActiveTab', 'scrollIntoView', 'moreTabShow', 'swiperHandle'];
1
+ import { computedNavStyle, computedSizeName, updated, visibilityChangeHandler, windowBlurHandler, windowFocusHandler, scrollToActiveTab, scrollIntoView, mounted, moreTabShow, expandTabShow, expandTabHide, computedHeaderStyle, beforeUnmount, scrollPrev, scrollNext, changeTab, setFocus, removeFocus } from './index';
2
+ export var api = ['state', 'setFocus', 'removeFocus', 'scrollPrev', 'scrollNext', 'changeTab', 'scrollToActiveTab', 'scrollIntoView', 'moreTabShow', 'expandTabShow', 'expandTabHide', 'computedHeaderStyle', 'swiperHandle'];
3
3
  export var renderless = function renderless(props, _ref, _ref2) {
4
4
  var computed = _ref.computed,
5
5
  inject = _ref.inject,
@@ -19,14 +19,16 @@ export var renderless = function renderless(props, _ref, _ref2) {
19
19
  var state = reactive({
20
20
  navOffset: 0,
21
21
  lineOffset: 0,
22
- lineWidth: 0,
23
22
  scrollable: false,
24
23
  isFocus: false,
25
24
  focusable: false,
26
25
  showMoreItem: false,
27
26
  isActive: false,
28
27
  showMoreTabs: props.showMoreTabs,
29
- mode: props._mode || parent.$mode || (tinyMode ? tinyMode.value : 'pc'),
28
+ showExpandItem: false,
29
+ showExpandTabs: props.showExpandTabs,
30
+ expandHeaderStyle: {},
31
+ mode: props._mode || parent.$mode || (tinyMode ? tinyMode : 'pc'),
30
32
  rootTabs: inject('rootTabs'),
31
33
  sizeName: computed(function () {
32
34
  return api.computedSizeName(state);
@@ -40,6 +42,11 @@ export var renderless = function renderless(props, _ref, _ref2) {
40
42
  setFocus: setFocus(state),
41
43
  removeFocus: removeFocus(state),
42
44
  moreTabShow: moreTabShow(state),
45
+ expandTabShow: expandTabShow({
46
+ api: api,
47
+ state: state
48
+ }),
49
+ expandTabHide: expandTabHide(state),
43
50
  scrollPrev: scrollPrev({
44
51
  refs: refs,
45
52
  state: state
@@ -62,6 +69,10 @@ export var renderless = function renderless(props, _ref, _ref2) {
62
69
  parent: parent,
63
70
  refs: refs,
64
71
  state: state
72
+ }),
73
+ computedHeaderStyle: computedHeaderStyle({
74
+ refs: refs,
75
+ state: state
65
76
  })
66
77
  });
67
78
  Object.assign(api, {
package/tabs/index.js CHANGED
@@ -52,7 +52,7 @@ export var calcMorePanes = function calcMorePanes(_ref3) {
52
52
  var el = parent.$el;
53
53
  var tabs = el.querySelectorAll('.tiny-tabs__item');
54
54
  if (tabs && tabs.length) {
55
- var tabsHeaderWidth = el.querySelector('.tiny-tabs__nav-scroll').clientWidth - 76;
55
+ var tabsHeaderWidth = el.querySelector('.tiny-tabs__nav-scroll').clientWidth + 15;
56
56
  var tabsAllWidth = 0;
57
57
  for (var i = 0, length = tabs.length; i < length; i++) {
58
58
  var width = tabs[i].offsetWidth;
@@ -65,15 +65,35 @@ export var calcMorePanes = function calcMorePanes(_ref3) {
65
65
  }
66
66
  };
67
67
  };
68
- export var handleTabClick = function handleTabClick(_ref4) {
69
- var api = _ref4.api,
70
- emit = _ref4.emit;
68
+ export var calcExpandPanes = function calcExpandPanes(_ref4) {
69
+ var parent = _ref4.parent,
70
+ props = _ref4.props,
71
+ state = _ref4.state;
72
+ return function () {
73
+ if (!props.showExpandTabs) {
74
+ return;
75
+ }
76
+ var el = parent.$el;
77
+ var tabsHeader = el.querySelector('.tiny-mobile-tabs__header');
78
+ if (tabsHeader) {
79
+ state.expandPanesWidth = tabsHeader.clientWidth;
80
+ }
81
+ };
82
+ };
83
+ export var handleTabClick = function handleTabClick(_ref5) {
84
+ var api = _ref5.api,
85
+ emit = _ref5.emit,
86
+ props = _ref5.props,
87
+ refs = _ref5.refs;
71
88
  return function (pane, tabName, event) {
72
89
  if (pane.disabled) {
73
90
  return;
74
91
  }
75
92
  api.setCurrentName(tabName);
76
93
  emit('click', pane, event);
94
+ if (props.showExpandTabs) {
95
+ refs.nav && refs.nav.expandTabHide();
96
+ }
77
97
  };
78
98
  };
79
99
  export var handleTabRemove = function handleTabRemove(emit) {
@@ -92,11 +112,11 @@ export var handleTabAdd = function handleTabAdd(emit) {
92
112
  emit('add');
93
113
  };
94
114
  };
95
- export var setCurrentName = function setCurrentName(_ref5) {
96
- var api = _ref5.api,
97
- props = _ref5.props,
98
- refs = _ref5.refs,
99
- state = _ref5.state;
115
+ export var setCurrentName = function setCurrentName(_ref6) {
116
+ var api = _ref6.api,
117
+ props = _ref6.props,
118
+ refs = _ref6.refs,
119
+ state = _ref6.state;
100
120
  return function (value) {
101
121
  api.changeDirection(state.currentName);
102
122
  if (state.currentName !== value && props.beforeLeave) {
@@ -114,18 +134,18 @@ export var setCurrentName = function setCurrentName(_ref5) {
114
134
  }
115
135
  };
116
136
  };
117
- export var changeCurrentName = function changeCurrentName(_ref6) {
118
- var emit = _ref6.emit,
119
- state = _ref6.state;
137
+ export var changeCurrentName = function changeCurrentName(_ref7) {
138
+ var emit = _ref7.emit,
139
+ state = _ref7.state;
120
140
  return function (value) {
121
141
  state.currentName = value;
122
142
  emit('update:modelValue', value);
123
143
  };
124
144
  };
125
- export var created = function created(_ref7) {
126
- var api = _ref7.api,
127
- parent = _ref7.parent,
128
- state = _ref7.state;
145
+ export var created = function created(_ref8) {
146
+ var api = _ref8.api,
147
+ parent = _ref8.parent,
148
+ state = _ref8.state;
129
149
  return function () {
130
150
  if (!state.currentName) {
131
151
  state.currentIndex = 0;
@@ -135,9 +155,9 @@ export var created = function created(_ref7) {
135
155
  parent.$on('tab-nav-update', api.calcPaneInstances.bind(null, true));
136
156
  };
137
157
  };
138
- export var changeDirection = function changeDirection(_ref8) {
139
- var props = _ref8.props,
140
- state = _ref8.state;
158
+ export var changeDirection = function changeDirection(_ref9) {
159
+ var props = _ref9.props,
160
+ state = _ref9.state;
141
161
  return function (currentName) {
142
162
  state.panes.forEach(function (item, index) {
143
163
  if (item.state.paneName === currentName && state.currentIndex !== index) {
@@ -149,21 +169,21 @@ export var changeDirection = function changeDirection(_ref8) {
149
169
  });
150
170
  };
151
171
  };
152
- export var handleTabDragStart = function handleTabDragStart(_ref9) {
153
- var emit = _ref9.emit;
172
+ export var handleTabDragStart = function handleTabDragStart(_ref10) {
173
+ var emit = _ref10.emit;
154
174
  return function (event) {
155
175
  emit('tab-drag-start', event);
156
176
  };
157
177
  };
158
- export var handleTabDragOver = function handleTabDragOver(_ref10) {
159
- var emit = _ref10.emit;
178
+ export var handleTabDragOver = function handleTabDragOver(_ref11) {
179
+ var emit = _ref11.emit;
160
180
  return function (event) {
161
181
  emit('tab-drag-over', event);
162
182
  };
163
183
  };
164
- export var handleTabDragEnd = function handleTabDragEnd(_ref11) {
165
- var state = _ref11.state,
166
- emit = _ref11.emit;
184
+ export var handleTabDragEnd = function handleTabDragEnd(_ref12) {
185
+ var state = _ref12.state,
186
+ emit = _ref12.emit;
167
187
  return function (event) {
168
188
  var oldDraggableIndex = event.oldDraggableIndex,
169
189
  newDraggableIndex = event.newDraggableIndex;
package/tabs/vue.js CHANGED
@@ -1,4 +1,4 @@
1
- import { calcMorePanes, calcPaneInstances, handleTabClick, handleTabAdd, handleTabRemove, setCurrentName, changeCurrentName, created, changeDirection, handleTabDragStart, handleTabDragOver, handleTabDragEnd } from './index';
1
+ import { calcMorePanes, calcExpandPanes, calcPaneInstances, handleTabClick, handleTabAdd, handleTabRemove, setCurrentName, changeCurrentName, created, changeDirection, handleTabDragStart, handleTabDragOver, handleTabDragEnd } from './index';
2
2
  export var api = ['state', 'handleTabAdd', 'calcPaneInstances', 'handleTabRemove', 'handleTabClick', 'handleTabDragStart', 'handleTabDragOver', 'handleTabDragEnd', 'setCurrentName', 'getNavRefs'];
3
3
  var initState = function initState(_ref) {
4
4
  var reactive = _ref.reactive,
@@ -14,7 +14,8 @@ var initState = function initState(_ref) {
14
14
  deltaY: 0,
15
15
  offsetX: 0,
16
16
  offsetY: 0,
17
- direction: ''
17
+ direction: '',
18
+ expandPanesWidth: ''
18
19
  });
19
20
  };
20
21
  var initWatcher = function initWatcher(_ref2) {
@@ -84,6 +85,11 @@ export var renderless = function renderless(props, _ref3, _ref4) {
84
85
  props: props,
85
86
  state: state
86
87
  }),
88
+ calcExpandPanes: calcExpandPanes({
89
+ parent: parent,
90
+ props: props,
91
+ state: state
92
+ }),
87
93
  calcPaneInstances: calcPaneInstances({
88
94
  constants: constants,
89
95
  parent: parent,
@@ -102,7 +108,9 @@ export var renderless = function renderless(props, _ref3, _ref4) {
102
108
  }),
103
109
  handleTabClick: handleTabClick({
104
110
  api: api,
105
- emit: emit
111
+ emit: emit,
112
+ props: props,
113
+ refs: refs
106
114
  }),
107
115
  setCurrentName: setCurrentName({
108
116
  api: api,
@@ -132,10 +140,12 @@ export var renderless = function renderless(props, _ref3, _ref4) {
132
140
  onMounted(function () {
133
141
  api.calcPaneInstances();
134
142
  api.calcMorePanes();
143
+ api.calcExpandPanes();
135
144
  });
136
145
  onUpdated(function () {
137
146
  api.calcPaneInstances();
138
147
  api.calcMorePanes();
148
+ api.calcExpandPanes();
139
149
  });
140
150
  return api;
141
151
  };
package/tag/index.js CHANGED
@@ -1,12 +1,17 @@
1
- export var handleClose = function handleClose(emit) {
1
+ export var handleClose = function handleClose(_ref) {
2
+ var emit = _ref.emit,
3
+ props = _ref.props;
2
4
  return function (event) {
3
5
  event.stopPropagation();
4
- emit('close', event);
6
+ var close = function close() {
7
+ return emit('close', event);
8
+ };
9
+ props.beforeDelete ? props.beforeDelete(close) : close();
5
10
  };
6
11
  };
7
- export var handleClick = function handleClick(_ref) {
8
- var emit = _ref.emit,
9
- parent = _ref.parent;
12
+ export var handleClick = function handleClick(_ref2) {
13
+ var emit = _ref2.emit,
14
+ parent = _ref2.parent;
10
15
  return function (event) {
11
16
  parent.$parent && parent.$parent.tagSelectable && event.stopPropagation();
12
17
  emit('click', event);
package/tag/vue.js CHANGED
@@ -4,7 +4,10 @@ export var renderless = function renderless(props, hooks, _ref) {
4
4
  var emit = _ref.emit,
5
5
  parent = _ref.parent;
6
6
  return {
7
- handleClose: handleClose(emit),
7
+ handleClose: handleClose({
8
+ emit: emit,
9
+ props: props
10
+ }),
8
11
  handleClick: handleClick({
9
12
  emit: emit,
10
13
  parent: parent
package/transfer/index.js CHANGED
@@ -105,22 +105,25 @@ export var addToLeft = function addToLeft(_ref5) {
105
105
  props = _ref5.props,
106
106
  state = _ref5.state;
107
107
  return function (value) {
108
- state.isToLeft = true;
109
- var currentValue = props.modelValue.slice();
110
- if (value === 'all') {
111
- state.rightChecked = state.rightData.map(function (item) {
112
- return item[props.props.key];
113
- });
114
- }
115
- state.rightChecked.forEach(function (item) {
116
- var index = currentValue.indexOf(item);
117
- if (index > -1) {
118
- currentValue.splice(index, 1);
108
+ var change = function change() {
109
+ state.isToLeft = true;
110
+ var currentValue = props.modelValue.slice();
111
+ if (value === 'all') {
112
+ state.rightChecked = state.rightData.map(function (item) {
113
+ return item[props.props.key];
114
+ });
119
115
  }
120
- });
121
- state.rightChecked = state.rightChecked.slice(0);
122
- emit('update:modelValue', currentValue);
123
- emit('change', currentValue, 'left', state.rightChecked);
116
+ state.rightChecked.forEach(function (item) {
117
+ var index = currentValue.indexOf(item);
118
+ if (index > -1) {
119
+ currentValue.splice(index, 1);
120
+ }
121
+ });
122
+ state.rightChecked = state.rightChecked.slice(0);
123
+ emit('update:modelValue', currentValue);
124
+ emit('change', currentValue, 'left', state.rightChecked);
125
+ };
126
+ props.beforeTransfer ? props.beforeTransfer(change) : change();
124
127
  };
125
128
  };
126
129
  export var addToRight = function addToRight(_ref6) {
@@ -130,40 +133,43 @@ export var addToRight = function addToRight(_ref6) {
130
133
  state = _ref6.state,
131
134
  Tree = _ref6.Tree;
132
135
  return function (value) {
133
- state.isToLeft = false;
134
- var currentValue = props.modelValue.slice();
135
- var itemsToBeMoved = [];
136
- var key = props.props.key;
137
- if (props.render && props.render.plugin.name === Tree) {
138
- if (!props.treeOp.checkStrictly) {
139
- currentValue = refs.leftPanel.$refs.plugin.getCheckedKeys();
140
- } else {
141
- state.leftChecked.forEach(function (item) {
142
- return currentValue.indexOf(item) === -1 && currentValue.push(item);
143
- });
144
- }
145
- } else {
146
- if (value === 'all') {
147
- state.leftData.forEach(function (item) {
148
- var itemKey = item[key];
149
- if (props.modelValue.indexOf(itemKey) === -1) {
150
- itemsToBeMoved.push(itemKey);
151
- }
152
- });
153
- state.leftChecked = itemsToBeMoved.slice();
136
+ var change = function change() {
137
+ state.isToLeft = false;
138
+ var currentValue = props.modelValue.slice();
139
+ var itemsToBeMoved = [];
140
+ var key = props.props.key;
141
+ if (props.render && props.render.plugin.name === Tree) {
142
+ if (!props.treeOp.checkStrictly) {
143
+ currentValue = refs.leftPanel.$refs.plugin.getCheckedKeys();
144
+ } else {
145
+ state.leftChecked.forEach(function (item) {
146
+ return currentValue.indexOf(item) === -1 && currentValue.push(item);
147
+ });
148
+ }
154
149
  } else {
155
- props.data.forEach(function (item) {
156
- var itemKey = item[key];
157
- if (state.leftChecked.indexOf(itemKey) > -1 && props.modelValue.indexOf(itemKey) === -1) {
158
- itemsToBeMoved.push(itemKey);
159
- }
160
- });
150
+ if (value === 'all') {
151
+ state.leftData.forEach(function (item) {
152
+ var itemKey = item[key];
153
+ if (props.modelValue.indexOf(itemKey) === -1) {
154
+ itemsToBeMoved.push(itemKey);
155
+ }
156
+ });
157
+ state.leftChecked = itemsToBeMoved.slice();
158
+ } else {
159
+ props.data.forEach(function (item) {
160
+ var itemKey = item[key];
161
+ if (state.leftChecked.indexOf(itemKey) > -1 && props.modelValue.indexOf(itemKey) === -1) {
162
+ itemsToBeMoved.push(itemKey);
163
+ }
164
+ });
165
+ }
166
+ currentValue = props.targetOrder === 'unshift' ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
161
167
  }
162
- currentValue = props.targetOrder === 'unshift' ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
163
- }
164
- state.rightDisabled = false;
165
- emit('update:modelValue', currentValue);
166
- emit('change', currentValue, 'right', state.leftChecked);
168
+ state.rightDisabled = false;
169
+ emit('update:modelValue', currentValue);
170
+ emit('change', currentValue, 'right', state.leftChecked);
171
+ };
172
+ props.beforeTransfer ? props.beforeTransfer(change) : change();
167
173
  };
168
174
  };
169
175
  export var clearQuery = function clearQuery(refs) {