@opentiny/vue-renderless 3.5.0 → 3.6.0-alpha.1

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.
@@ -0,0 +1,120 @@
1
+ import { created, handleClick, confirm, reset, wheelChange, clickWheelItem, loadDefault } from './index';
2
+ export var api = ['state', 'created', 'handleClick', 'confirm', 'reset', 'wheelChange', 'clickWheelItem', 'loadDefault'];
3
+ var initState = function initState(reactive) {
4
+ var state = reactive({
5
+ dataSource: [],
6
+ wheelData: [],
7
+ headerIndex: -1,
8
+ showWheel: false,
9
+ labelLevelsInfo: [],
10
+ labelsStyle: [],
11
+ wheelIndex: [],
12
+ wheelText: '',
13
+ headerInfo: [],
14
+ defaultSelectedIndexs: [],
15
+ defaultSelectedArray: []
16
+ });
17
+ return state;
18
+ };
19
+ var initApi = function initApi(_ref) {
20
+ var api = _ref.api,
21
+ props = _ref.props,
22
+ state = _ref.state,
23
+ emit = _ref.emit,
24
+ nextTick = _ref.nextTick,
25
+ refs = _ref.refs;
26
+ Object.assign(api, {
27
+ state: state,
28
+ created: created({
29
+ props: props,
30
+ state: state,
31
+ refs: refs,
32
+ nextTick: nextTick
33
+ }),
34
+ handleClick: handleClick({
35
+ api: api,
36
+ props: props,
37
+ state: state
38
+ }),
39
+ confirm: confirm({
40
+ state: state,
41
+ emit: emit
42
+ }),
43
+ reset: reset({
44
+ api: api,
45
+ props: props,
46
+ state: state,
47
+ emit: emit
48
+ }),
49
+ wheelChange: wheelChange(state),
50
+ clickWheelItem: clickWheelItem({
51
+ state: state,
52
+ emit: emit
53
+ }),
54
+ loadDefault: loadDefault({
55
+ props: props,
56
+ state: state
57
+ })
58
+ });
59
+ };
60
+ var initWatch = function initWatch(_ref2) {
61
+ var watch = _ref2.watch,
62
+ props = _ref2.props,
63
+ state = _ref2.state,
64
+ refs = _ref2.refs,
65
+ nextTick = _ref2.nextTick;
66
+ watch(function () {
67
+ return props.dataSource;
68
+ }, function () {
69
+ api.created({
70
+ props: props,
71
+ state: state,
72
+ refs: refs,
73
+ nextTick: nextTick
74
+ });
75
+ });
76
+ watch(function () {
77
+ return props.defaultSelectedArray;
78
+ }, function () {
79
+ api.created({
80
+ props: props,
81
+ state: state,
82
+ refs: refs,
83
+ nextTick: nextTick
84
+ });
85
+ });
86
+ };
87
+ export var renderless = function renderless(props, _ref3, _ref4) {
88
+ var onMounted = _ref3.onMounted,
89
+ reactive = _ref3.reactive,
90
+ watch = _ref3.watch;
91
+ var emit = _ref4.emit,
92
+ nextTick = _ref4.nextTick,
93
+ refs = _ref4.refs;
94
+ var api = {};
95
+ var state = initState(reactive);
96
+ initApi({
97
+ api: api,
98
+ props: props,
99
+ state: state,
100
+ emit: emit,
101
+ nextTick: nextTick,
102
+ refs: refs
103
+ });
104
+ initWatch({
105
+ watch: watch,
106
+ props: props,
107
+ state: state,
108
+ refs: refs,
109
+ nextTick: nextTick
110
+ });
111
+ onMounted(function () {
112
+ api.created({
113
+ props: props,
114
+ state: state,
115
+ refs: refs,
116
+ nextTick: nextTick
117
+ });
118
+ });
119
+ return api;
120
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.5.0",
3
+ "version": "3.6.0-alpha.1",
4
4
  "description": "@opentiny/vue-renderless",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,76 +1,116 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
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
+ 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; }
1
4
  import { on, off } from '@opentiny/vue-renderless/common/deps/dom';
2
- export var onTouchstart = function onTouchstart(_ref) {
3
- var state = _ref.state;
5
+ export var initPullRefresh = function initPullRefresh(_ref) {
6
+ var t = _ref.t,
7
+ props = _ref.props,
8
+ state = _ref.state;
9
+ return function () {
10
+ var _props$loosingText, _props$successText, _props$failedText;
11
+ var defaultOption = {
12
+ pullingUpText: t('ui.pullRefresh.pullingUp'),
13
+ pullingDownText: t('ui.pullRefresh.pullingDown'),
14
+ pullUpDisabled: false,
15
+ pullDownDisabled: false,
16
+ headHeight: 50,
17
+ footHeight: 50
18
+ };
19
+ state.pullUp = _objectSpread(_objectSpread({}, defaultOption), props.pullUp);
20
+ state.pullDown = _objectSpread(_objectSpread({}, defaultOption), props.pullDown);
21
+ state.refreshStyle = {
22
+ paddingTop: state.pullDown.headHeight + 'px',
23
+ paddingBottom: state.pullUp.footHeight + 'px'
24
+ };
25
+ state.loosingText = (_props$loosingText = props.loosingText) !== null && _props$loosingText !== void 0 ? _props$loosingText : t('ui.pullRefresh.loosing');
26
+ state.successText = (_props$successText = props.successText) !== null && _props$successText !== void 0 ? _props$successText : t('ui.pullRefresh.success');
27
+ state.failedText = (_props$failedText = props.failedText) !== null && _props$failedText !== void 0 ? _props$failedText : t('ui.pullRefresh.failed');
28
+ };
29
+ };
30
+ export var onTouchstart = function onTouchstart(state) {
4
31
  return function (event) {
5
32
  state.draggposition = event.touches[0].clientY;
6
33
  };
7
34
  };
8
- export var onTouchmove = function onTouchmove(_ref2) {
9
- var refs = _ref2.refs,
10
- state = _ref2.state;
35
+ export var onTouchmove = function onTouchmove(state) {
11
36
  return function (event) {
12
- if (!state.disabled) {
13
- if (event.touches[0].clientY < state.draggposition || refs.track.parentNode.scrollTop > 10) {
14
- return;
37
+ if (event.touches[0].clientY < state.draggposition) {
38
+ if (!state.pullUp.pullUpDisabled) {
39
+ state.translate3d = (event.touches[0].clientY - state.draggposition) / 2;
40
+ state.pullUpReplaces = Math.abs(state.translate3d) > state.pullUp.footHeight ? state.loosingText : state.pullUp.pullingUpText;
41
+ state.pullDownReplaces = '';
15
42
  }
16
- state.replaces = state.pullingText;
17
- state.animationDuration = 0;
18
- state.translate3d = (event.touches[0].clientY - state.draggposition) / 2;
19
- state.styleObj = {
20
- 'transition-duration': '0ms',
21
- transform: 'translate3d(0px,' + state.translate3d + 'px,0px)'
22
- };
23
- state.checkStatus = false;
24
- if (state.translate3d > state.headHeight) {
25
- state.replaces = state.loosingText;
26
- } else {
27
- state.replaces = state.pullingText;
43
+ } else {
44
+ if (!state.pullDown.pullDownDisabled) {
45
+ state.translate3d = (event.touches[0].clientY - state.draggposition) / 2;
46
+ state.pullDownReplaces = Math.abs(state.translate3d) > state.pullDown.headHeight ? state.loosingText : state.pullDown.pullingDownText;
47
+ state.pullUpReplaces = '';
28
48
  }
29
49
  }
50
+ state.animationDuration = 0;
51
+ state.pullUpLoading = false;
52
+ state.pullDownLoading = false;
30
53
  };
31
54
  };
32
- export var onTouchend = function onTouchend(_ref3) {
33
- var emit = _ref3.emit,
34
- props = _ref3.props,
35
- state = _ref3.state;
55
+ export var onTouchend = function onTouchend(_ref2) {
56
+ var api = _ref2.api,
57
+ props = _ref2.props,
58
+ state = _ref2.state;
36
59
  return function () {
37
60
  state.animationDuration = props.animationDuration;
38
- if (state.translate3d >= state.headHeight) {
39
- state.translate3d = state.headHeight;
40
- state.checkStatus = true;
41
- state.styleObj = {
42
- 'transition-duration': state.animationDuration + 'ms',
43
- transform: 'translate3d(0px,' + state.translate3d + 'px,0px)'
44
- };
45
- emit('update:modelValue', true);
46
- emit('refresh');
61
+ if (Math.abs(state.translate3d) >= state.pullDown.headHeight || Math.abs(state.translate3d) >= state.pullUp.footHeight) {
62
+ if (state.translate3d >= 0) {
63
+ state.translate3d = state.pullDown.headHeight;
64
+ var handler = state.pullDown.handler;
65
+ var pullDownPromise = handler && handler();
66
+ state.pullDownLoading = true;
67
+ if (pullDownPromise !== null && pullDownPromise !== void 0 && pullDownPromise.then) {
68
+ pullDownPromise.then(function () {
69
+ api.handlerModelValue('down', 'success');
70
+ }, function (e) {
71
+ console.log(e);
72
+ api.handlerModelValue('down', 'failed');
73
+ });
74
+ return;
75
+ }
76
+ console.error(new Error('handler down is not promise'));
77
+ } else {
78
+ state.translate3d = -state.pullUp.footHeight;
79
+ var _handler = state.pullUp.handler;
80
+ var pullUpPromise = _handler && _handler();
81
+ state.pullUpLoading = true;
82
+ if (pullUpPromise !== null && pullUpPromise !== void 0 && pullUpPromise.then) {
83
+ pullUpPromise.then(function () {
84
+ api.handlerModelValue('up', 'success');
85
+ }, function (e) {
86
+ console.log(e);
87
+ api.handlerModelValue('up', 'failed');
88
+ });
89
+ return;
90
+ }
91
+ console.error(new Error('handler up is not promise'));
92
+ }
93
+ api.clearPullRefresh();
47
94
  } else {
48
- state.styleObj = {
49
- 'transition-duration': state.animationDuration + 'ms'
50
- };
51
- state.translate3d = 0;
52
- state.checkStatus = false;
53
- state.replaces = '';
95
+ state.pullUpLoading = false;
96
+ state.pullDownLoading = false;
97
+ api.clearPullRefresh();
54
98
  }
55
99
  };
56
100
  };
57
- export var mountedHandler = function mountedHandler(_ref4) {
58
- var api = _ref4.api,
59
- refs = _ref4.refs,
60
- state = _ref4.state;
101
+ export var mountedHandler = function mountedHandler(_ref3) {
102
+ var api = _ref3.api,
103
+ refs = _ref3.refs;
61
104
  return function () {
62
- state.styleObj = {
63
- 'transition-duration': state.animationDuration + 'ms'
64
- };
65
105
  var track = refs.track;
66
106
  on(track, 'touchstart', api.onTouchstart);
67
107
  on(track, 'touchmove', api.onTouchmove);
68
108
  on(track, 'touchend', api.onTouchend);
69
109
  };
70
110
  };
71
- export var beforeUnmountHandler = function beforeUnmountHandler(_ref5) {
72
- var api = _ref5.api,
73
- refs = _ref5.refs;
111
+ export var beforeUnmountHandler = function beforeUnmountHandler(_ref4) {
112
+ var api = _ref4.api,
113
+ refs = _ref4.refs;
74
114
  return function () {
75
115
  var track = refs.track;
76
116
  off(track, 'touchstart', api.onTouchstart);
@@ -78,27 +118,26 @@ export var beforeUnmountHandler = function beforeUnmountHandler(_ref5) {
78
118
  off(track, 'touchend', api.onTouchend);
79
119
  };
80
120
  };
81
- export var watchModelValue = function watchModelValue(_ref6) {
82
- var value = _ref6.value,
83
- state = _ref6.state;
84
- if (!value) {
85
- if (state.successText) {
86
- state.checkStatus = false;
87
- state.replaces = state.successText;
88
- setTimeout(function () {
89
- state.translate3d = 0;
90
- state.styleObj = {
91
- 'transition-duration': state.animationDuration + 'ms'
92
- };
93
- state.replaces = '';
94
- }, state.successDuration);
121
+ export var handlerModelValue = function handlerModelValue(_ref5) {
122
+ var api = _ref5.api,
123
+ state = _ref5.state;
124
+ return function (value, result) {
125
+ state.pullUpLoading = false;
126
+ state.pullDownLoading = false;
127
+ if (value === 'down') {
128
+ state.pullDownReplaces = state["".concat(result, "Text")];
95
129
  } else {
96
- state.translate3d = 0;
97
- state.checkStatus = false;
98
- state.replaces = '';
99
- state.styleObj = {
100
- 'transition-duration': state.animationDuration + 'ms'
101
- };
130
+ state.pullUpReplaces = state["".concat(result, "Text")];
102
131
  }
103
- }
132
+ setTimeout(function () {
133
+ api.clearPullRefresh();
134
+ }, state.successDuration);
135
+ };
136
+ };
137
+ export var clearPullRefresh = function clearPullRefresh(state) {
138
+ return function () {
139
+ state.translate3d = 0;
140
+ state.pullUpReplaces = '';
141
+ state.pullDownReplaces = '';
142
+ };
104
143
  };
@@ -1,64 +1,69 @@
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
4
  var computed = _ref.computed,
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
+ pullUp: null,
23
+ pullDown: null,
23
24
  successDuration: props.successDuration,
24
- animationDuration: props.animationDuration,
25
- disabled: computed(function () {
26
- return props.disabled;
27
- })
25
+ animationDuration: props.animationDuration
28
26
  });
29
27
  Object.assign(api, {
30
28
  state: state,
31
- onTouchstart: onTouchstart({
32
- state: state
33
- }),
34
- onTouchmove: onTouchmove({
35
- refs: refs,
36
- state: state
37
- }),
29
+ onTouchstart: onTouchstart(state),
30
+ onTouchmove: onTouchmove(state),
38
31
  onTouchend: onTouchend({
39
- emit: emit,
32
+ api: api,
40
33
  props: props,
41
34
  state: state
42
35
  }),
43
36
  mountedHandler: mountedHandler({
44
37
  api: api,
45
- refs: refs,
46
- state: state
38
+ refs: refs
47
39
  }),
48
40
  beforeUnmountHandler: beforeUnmountHandler({
49
41
  api: api,
50
42
  refs: refs
51
- })
43
+ }),
44
+ handlerModelValue: handlerModelValue({
45
+ api: api,
46
+ state: state
47
+ }),
48
+ initPullRefresh: initPullRefresh({
49
+ t: t,
50
+ props: props,
51
+ state: state
52
+ }),
53
+ clearPullRefresh: clearPullRefresh(state)
52
54
  });
53
- watch(function () {
54
- return props.modelValue;
55
- }, function (value) {
56
- watchModelValue({
57
- value: value,
55
+ onMounted(function () {
56
+ api.mountedHandler({
57
+ api: api,
58
+ refs: refs,
59
+ state: state
60
+ });
61
+ api.initPullRefresh({
62
+ t: t,
63
+ props: props,
58
64
  state: state
59
65
  });
60
66
  });
61
- onMounted(api.mountedHandler);
62
67
  onBeforeUnmount(api.beforeUnmountHandler);
63
68
  return api;
64
69
  };
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, {