@opentiny/vue-renderless 3.1.0-alpha.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.
- package/action-sheet/index.js +28 -0
- package/action-sheet/vue.js +29 -0
- package/alert/index.js +23 -0
- package/alert/vue.js +37 -0
- package/autocomplete/index.js +175 -0
- package/autocomplete/vue.js +171 -0
- package/avatar/index.js +29 -0
- package/avatar/vue.js +24 -0
- package/badge/index.js +16 -0
- package/badge/vue.js +30 -0
- package/breadcrumb/vue.js +4 -0
- package/breadcrumb-item/vue.js +24 -0
- package/bulletin-board/index.js +21 -0
- package/bulletin-board/vue.js +36 -0
- package/button/index.js +19 -0
- package/button/vue.js +43 -0
- package/button-group/index.js +25 -0
- package/button-group/vue.js +51 -0
- package/calendar/index.js +279 -0
- package/calendar/vue.js +124 -0
- package/card-template/index.js +39 -0
- package/card-template/vue.js +34 -0
- package/carousel/index.js +206 -0
- package/carousel/vue.js +222 -0
- package/carousel-item/index.js +93 -0
- package/carousel-item/vue.js +57 -0
- package/cascader/index.js +511 -0
- package/cascader/vue.js +342 -0
- package/cascader-menu/index.js +41 -0
- package/cascader-menu/vue.js +36 -0
- package/cascader-node/index.js +63 -0
- package/cascader-node/vue.js +62 -0
- package/cascader-panel/index.js +359 -0
- package/cascader-panel/node.js +199 -0
- package/cascader-panel/store.js +80 -0
- package/cascader-panel/vue.js +217 -0
- package/checkbox/index.js +145 -0
- package/checkbox/vue.js +139 -0
- package/checkbox-button/index.js +102 -0
- package/checkbox-button/vue.js +150 -0
- package/checkbox-group/index.js +12 -0
- package/checkbox-group/vue.js +33 -0
- package/col/index.js +132 -0
- package/col/vue.js +34 -0
- package/collapse/index.js +45 -0
- package/collapse/vue.js +35 -0
- package/collapse-item/index.js +38 -0
- package/collapse-item/vue.js +48 -0
- package/common/array.js +120 -0
- package/common/bigInt.js +352 -0
- package/common/browser.js +69 -0
- package/common/dataset/index.js +135 -0
- package/common/date.js +352 -0
- package/common/decimal.js +203 -0
- package/common/deps/ResizeObserver.js +474 -0
- package/common/deps/after-leave.js +25 -0
- package/common/deps/clickoutside.js +61 -0
- package/common/deps/date-util.js +262 -0
- package/common/deps/date.js +308 -0
- package/common/deps/debounce.js +4 -0
- package/common/deps/dom.js +190 -0
- package/common/deps/fullscreen/apis.js +157 -0
- package/common/deps/fullscreen/screenfull.js +106 -0
- package/common/deps/letter-only.js +15 -0
- package/common/deps/memorize.js +149 -0
- package/common/deps/number-only.js +16 -0
- package/common/deps/popper.js +713 -0
- package/common/deps/popup-manager.js +179 -0
- package/common/deps/repeat-click.js +24 -0
- package/common/deps/requestAnimationFrame.js +25 -0
- package/common/deps/resize-event.js +29 -0
- package/common/deps/scroll-into-view.js +29 -0
- package/common/deps/scrollbar-width.js +25 -0
- package/common/deps/throttle.js +34 -0
- package/common/deps/touch.js +33 -0
- package/common/deps/tree-model/node.js +586 -0
- package/common/deps/tree-model/tree-store.js +377 -0
- package/common/deps/tree-model/util.js +14 -0
- package/common/deps/upload-ajax.js +71 -0
- package/common/deps/vue-emitter.js +30 -0
- package/common/deps/vue-popper.js +291 -0
- package/common/deps/vue-popup.js +211 -0
- package/common/event.js +17 -0
- package/common/index.js +288 -0
- package/common/object.js +228 -0
- package/common/runtime.js +52 -0
- package/common/string.js +446 -0
- package/common/type.js +65 -0
- package/common/validate/index.js +6 -0
- package/common/validate/messages.js +68 -0
- package/common/validate/rules/enum.js +8 -0
- package/common/validate/rules/index.js +14 -0
- package/common/validate/rules/pattern.js +16 -0
- package/common/validate/rules/range.js +62 -0
- package/common/validate/rules/required.js +13 -0
- package/common/validate/rules/type.js +110 -0
- package/common/validate/rules/whitespace.js +6 -0
- package/common/validate/schema.js +323 -0
- package/common/validate/util.js +198 -0
- package/common/validate/validations/array.js +25 -0
- package/common/validate/validations/date.js +35 -0
- package/common/validate/validations/enum.js +24 -0
- package/common/validate/validations/float.js +24 -0
- package/common/validate/validations/index.js +42 -0
- package/common/validate/validations/integer.js +24 -0
- package/common/validate/validations/method.js +23 -0
- package/common/validate/validations/number.js +27 -0
- package/common/validate/validations/pattern.js +23 -0
- package/common/validate/validations/required.js +15 -0
- package/common/validate/validations/string.js +29 -0
- package/common/validate/validations/type.js +25 -0
- package/common/xss.js +325 -0
- package/container/index.js +110 -0
- package/container/vue.js +63 -0
- package/credit-card/index.js +107 -0
- package/credit-card/vue.js +117 -0
- package/credit-card-form/index.js +143 -0
- package/credit-card-form/vue.js +150 -0
- package/crop/index.js +297 -0
- package/crop/vue.js +191 -0
- package/date-panel/index.js +584 -0
- package/date-panel/vue.js +319 -0
- package/date-picker/index.js +301 -0
- package/date-picker/vue.js +169 -0
- package/date-range/index.js +463 -0
- package/date-range/vue.js +297 -0
- package/date-table/index.js +457 -0
- package/date-table/vue.js +151 -0
- package/detail-page/index.js +135 -0
- package/detail-page/vue.js +145 -0
- package/dialog-box/index.js +268 -0
- package/dialog-box/vue.js +226 -0
- package/drop-times/index.js +23 -0
- package/drop-times/vue.js +28 -0
- package/dropdown/index.js +259 -0
- package/dropdown/vue.js +107 -0
- package/dropdown-item/index.js +155 -0
- package/dropdown-item/vue.js +124 -0
- package/dropdown-menu/index.js +148 -0
- package/dropdown-menu/vue.js +44 -0
- package/exception/index.js +13 -0
- package/exception/vue.js +25 -0
- package/fall-menu/index.js +121 -0
- package/fall-menu/vue.js +90 -0
- package/file-upload/index.js +1940 -0
- package/file-upload/vue.js +458 -0
- package/floatbar/index.js +10 -0
- package/floatbar/vue.js +17 -0
- package/form/index.js +186 -0
- package/form/vue.js +69 -0
- package/form-item/index.js +364 -0
- package/form-item/vue.js +210 -0
- package/fullscreen/index.js +138 -0
- package/fullscreen/vue.js +77 -0
- package/grid/core/index.js +3 -0
- package/grid/core/interceptor.js +38 -0
- package/grid/core/storeMap.js +19 -0
- package/grid/plugins/export.js +169 -0
- package/grid/plugins/exportExcel.js +749 -0
- package/grid/plugins/header.js +58 -0
- package/grid/plugins/resize.js +82 -0
- package/grid/static/array/arrayEach.js +12 -0
- package/grid/static/array/arrayIndexOf.js +11 -0
- package/grid/static/array/eachTree.js +32 -0
- package/grid/static/array/every.js +2 -0
- package/grid/static/array/filterTree.js +16 -0
- package/grid/static/array/find.js +3 -0
- package/grid/static/array/findTree.js +46 -0
- package/grid/static/array/helperCreateIterateHandle.js +59 -0
- package/grid/static/array/helperCreateTreeFunc.js +18 -0
- package/grid/static/array/includes.js +5 -0
- package/grid/static/array/lastArrayEach.js +6 -0
- package/grid/static/array/map.js +23 -0
- package/grid/static/array/mapTree.js +33 -0
- package/grid/static/array/slice.js +10 -0
- package/grid/static/array/sortBy.js +69 -0
- package/grid/static/array/sum.js +28 -0
- package/grid/static/array/toArray.js +7 -0
- package/grid/static/array/toTreeArray.js +24 -0
- package/grid/static/base/clear.js +44 -0
- package/grid/static/base/clone.js +18 -0
- package/grid/static/base/destructuring.js +18 -0
- package/grid/static/base/each.js +9 -0
- package/grid/static/base/eqNull.js +6 -0
- package/grid/static/base/findIndexOf.js +10 -0
- package/grid/static/base/get.js +42 -0
- package/grid/static/base/has.js +60 -0
- package/grid/static/base/hasOwnProp.js +4 -0
- package/grid/static/base/helperCreateGetObjects.js +26 -0
- package/grid/static/base/helperCreateInInObjectString.js +7 -0
- package/grid/static/base/helperCreateInTypeof.js +6 -0
- package/grid/static/base/helperCreateIndexOf.js +21 -0
- package/grid/static/base/helperCreateiterateIndexOf.js +21 -0
- package/grid/static/base/helperDefaultCompare.js +4 -0
- package/grid/static/base/helperDeleteProperty.js +8 -0
- package/grid/static/base/helperEqualCompare.js +60 -0
- package/grid/static/base/helperGetHGSKeys.js +4 -0
- package/grid/static/base/indexOf.js +3 -0
- package/grid/static/base/isArray.js +3 -0
- package/grid/static/base/isBoolean.js +4 -0
- package/grid/static/base/isDate.js +3 -0
- package/grid/static/base/isEmpty.js +8 -0
- package/grid/static/base/isEqual.js +11 -0
- package/grid/static/base/isFunction.js +4 -0
- package/grid/static/base/isNaN.js +5 -0
- package/grid/static/base/isNull.js +4 -0
- package/grid/static/base/isNumber.js +4 -0
- package/grid/static/base/isObject.js +5 -0
- package/grid/static/base/isPlainObject.js +2 -0
- package/grid/static/base/isRegExp.js +3 -0
- package/grid/static/base/isSet.js +5 -0
- package/grid/static/base/isString.js +4 -0
- package/grid/static/base/isUndefined.js +4 -0
- package/grid/static/base/keys.js +3 -0
- package/grid/static/base/lastEach.js +9 -0
- package/grid/static/base/remove.js +44 -0
- package/grid/static/base/set.js +43 -0
- package/grid/static/base/toJSONString.js +4 -0
- package/grid/static/base/toStringJSON.js +13 -0
- package/grid/static/base/uniqueId.js +5 -0
- package/grid/static/browse/browse.js +54 -0
- package/grid/static/function/property.js +7 -0
- package/grid/static/function/throttle.js +43 -0
- package/grid/static/index.js +55 -0
- package/grid/static/number/helperCreateToNumber.js +12 -0
- package/grid/static/number/toNumber.js +3 -0
- package/grid/static/object/assign.js +41 -0
- package/grid/static/object/extend.js +3 -0
- package/grid/static/object/lastObjectEach.js +8 -0
- package/grid/static/object/objectEach.js +11 -0
- package/grid/static/object/objectMap.js +20 -0
- package/grid/static/object/values.js +9 -0
- package/grid/static/static/staticDocument.js +4 -0
- package/grid/static/static/staticHGKeyRE.js +2 -0
- package/grid/static/static/staticParseInt.js +2 -0
- package/grid/static/static/staticStrUndefined.js +2 -0
- package/grid/static/static/staticWindow.js +4 -0
- package/grid/static/string/template.js +12 -0
- package/grid/static/string/toString.js +12 -0
- package/grid/utils/column.js +72 -0
- package/grid/utils/common.js +155 -0
- package/grid/utils/dom.js +213 -0
- package/grid/utils/event.js +40 -0
- package/grid/utils/index.js +5 -0
- package/image/index.js +187 -0
- package/image/vue.js +142 -0
- package/image-viewer/index.js +469 -0
- package/image-viewer/vue.js +243 -0
- package/input/index.js +319 -0
- package/input/vue.js +319 -0
- package/ip-address/index.js +370 -0
- package/ip-address/vue.js +185 -0
- package/layout/vue.js +4 -0
- package/link/index.js +10 -0
- package/link/vue.js +26 -0
- package/link-menu/index.js +146 -0
- package/link-menu/vue.js +138 -0
- package/list/index.js +13 -0
- package/list/vue.js +17 -0
- package/loading/index.js +29 -0
- package/loading/vue.js +28 -0
- package/milestone/index.js +92 -0
- package/milestone/vue.js +31 -0
- package/mini-picker/index.js +227 -0
- package/mini-picker/vue.js +142 -0
- package/modal/index.js +866 -0
- package/modal/vue.js +130 -0
- package/month-range/index.js +169 -0
- package/month-range/vue.js +104 -0
- package/month-table/index.js +232 -0
- package/month-table/vue.js +72 -0
- package/nav-menu/index.js +457 -0
- package/nav-menu/vue.js +187 -0
- package/notify/index.js +91 -0
- package/notify/vue.js +67 -0
- package/numeric/index.js +419 -0
- package/numeric/vue.js +218 -0
- package/option/index.js +79 -0
- package/option/vue.js +219 -0
- package/option-group/index.js +18 -0
- package/option-group/vue.js +37 -0
- package/package.json +179 -0
- package/pager-item/index.js +122 -0
- package/pager-item/vue.js +52 -0
- package/panel/index.js +30 -0
- package/panel/vue.js +26 -0
- package/picker/index.js +1039 -0
- package/picker/timezone.js +974 -0
- package/picker/vue.js +415 -0
- package/picker-column/index.js +261 -0
- package/picker-column/vue.js +163 -0
- package/pop-upload/index.js +324 -0
- package/pop-upload/vue.js +292 -0
- package/popeditor/index.js +884 -0
- package/popeditor/vue.js +368 -0
- package/popover/index.js +203 -0
- package/popover/vue.js +174 -0
- package/popup/index.js +139 -0
- package/popup/vue.js +129 -0
- package/progress/index.js +174 -0
- package/progress/vue.js +118 -0
- package/pull-refresh/index.js +104 -0
- package/pull-refresh/vue.js +64 -0
- package/radio/index.js +83 -0
- package/radio/vue.js +99 -0
- package/radio-button/index.js +58 -0
- package/radio-button/vue.js +70 -0
- package/radio-group/index.js +51 -0
- package/radio-group/vue.js +34 -0
- package/rate/index.js +254 -0
- package/rate/vue.js +158 -0
- package/row/index.js +19 -0
- package/row/vue.js +24 -0
- package/scroll-text/index.js +24 -0
- package/scroll-text/vue.js +31 -0
- package/scrollbar/index.js +127 -0
- package/scrollbar/vue-bar.js +49 -0
- package/scrollbar/vue.js +43 -0
- package/search/index.js +110 -0
- package/search/vue.js +110 -0
- package/select/index.js +1766 -0
- package/select/vue.js +693 -0
- package/select-dropdown/index.js +23 -0
- package/select-dropdown/vue.js +122 -0
- package/slide-bar/index.js +94 -0
- package/slide-bar/vue.js +58 -0
- package/slider/index.js +434 -0
- package/slider/vue.js +172 -0
- package/split/index.js +122 -0
- package/split/vue.js +131 -0
- package/steps/vue.js +4 -0
- package/switch/index.js +45 -0
- package/switch/vue.js +62 -0
- package/tab-bar/index.js +51 -0
- package/tab-bar/vue.js +16 -0
- package/tab-dropdown/index.js +11 -0
- package/tab-dropdown/vue.js +17 -0
- package/tab-item/index.js +37 -0
- package/tab-item/vue.js +49 -0
- package/tab-nav/index.js +247 -0
- package/tab-nav/vue.js +106 -0
- package/tabbar/index.js +32 -0
- package/tabbar/vue.js +54 -0
- package/tabbar-item/index.js +55 -0
- package/tabbar-item/vue.js +53 -0
- package/table/index.js +111 -0
- package/table/vue.js +66 -0
- package/tabs/index.js +174 -0
- package/tabs/vue.js +141 -0
- package/tag/index.js +14 -0
- package/tag/vue.js +13 -0
- package/tall-storage/index.js +161 -0
- package/tall-storage/vue-storage-box.js +25 -0
- package/tall-storage/vue.js +38 -0
- package/text-popup/index.js +75 -0
- package/text-popup/vue.js +64 -0
- package/time/index.js +121 -0
- package/time/vue.js +124 -0
- package/time-line/index.js +60 -0
- package/time-line/vue.js +49 -0
- package/time-panel/index.js +189 -0
- package/time-panel/scrollIntoView.js +23 -0
- package/time-panel/vue.js +110 -0
- package/time-range/index.js +199 -0
- package/time-range/vue.js +129 -0
- package/time-spinner/index.js +175 -0
- package/time-spinner/vue.js +122 -0
- package/toggle-menu/index.js +104 -0
- package/toggle-menu/vue.js +74 -0
- package/tooltip/index.js +171 -0
- package/tooltip/vue.js +133 -0
- package/top-box/index.js +81 -0
- package/top-box/vue.js +77 -0
- package/transfer/index.js +296 -0
- package/transfer/vue.js +138 -0
- package/transfer-panel/index.js +364 -0
- package/transfer-panel/vue.js +258 -0
- package/tree/index.js +642 -0
- package/tree/vue.js +268 -0
- package/tree-menu/index.js +124 -0
- package/tree-menu/vue.js +60 -0
- package/tree-node/index.js +271 -0
- package/tree-node/vue.js +211 -0
- package/upload/index.js +324 -0
- package/upload/vue.js +93 -0
- package/upload-dragger/index.js +50 -0
- package/upload-dragger/vue.js +27 -0
- package/upload-list/index.js +55 -0
- package/upload-list/vue.js +48 -0
- package/user-contact/index.js +13 -0
- package/user-contact/vue.js +20 -0
- package/user-head/index.js +71 -0
- package/user-head/vue.js +47 -0
- package/wizard/index.js +123 -0
- package/wizard/vue.js +45 -0
- package/year-table/index.js +40 -0
- package/year-table/vue.js +23 -0
package/slider/vue.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { bindKeyDown, bindMouseDown, bindMouseMove, bindMouseUp, bindEvent, unBindEvent, bindResize, setTipStyle, getActiveButtonIndex, setActiveButtonValue, setBarStyle, setButtonStyle, initSlider, calculateValue, changeActiveValue, formatTipValue, getActiveButtonValue, displayTip, hideTip, autoSlider, customBeforeAppearHook, customAppearHook, customAfterAppearHook, watchActiveValue, watchModelValue } from './index';
|
|
2
|
+
export var api = ['state', 'bindKeyDown', 'bindMouseDown', 'bindMouseMove', 'bindMouseUp', 'bindEvent', 'unBindEvent', 'bindResize', 'setTipStyle', 'getActiveButtonIndex', 'setActiveButtonValue', 'setBarStyle', 'setButtonStyle', 'initSlider', 'calculateValue', 'changeActiveValue', 'formatTipValue', 'getActiveButtonValue', 'displayTip', 'hideTip', 'autoSlider', 'customBeforeAppearHook', 'customAppearHook', 'customAfterAppearHook'];
|
|
3
|
+
var initState = function initState(_ref) {
|
|
4
|
+
var reactive = _ref.reactive,
|
|
5
|
+
computed = _ref.computed,
|
|
6
|
+
props = _ref.props,
|
|
7
|
+
api = _ref.api,
|
|
8
|
+
parent = _ref.parent;
|
|
9
|
+
var state = reactive({
|
|
10
|
+
tipStyle: {},
|
|
11
|
+
barStyle: {},
|
|
12
|
+
moveStyle: [],
|
|
13
|
+
isDrag: false,
|
|
14
|
+
sliderSize: 0,
|
|
15
|
+
showTip: false,
|
|
16
|
+
activeValue: 0,
|
|
17
|
+
activeIndex: 0,
|
|
18
|
+
isDouble: false,
|
|
19
|
+
leftBtnValue: 0,
|
|
20
|
+
sliderOffset: {},
|
|
21
|
+
rightBtnValue: 0,
|
|
22
|
+
leftBtnStyle: {},
|
|
23
|
+
leftBtnPercent: 0,
|
|
24
|
+
leftBtnShow: true,
|
|
25
|
+
rightBtnStyle: '',
|
|
26
|
+
rightBtnPercent: 0,
|
|
27
|
+
rightBtnShow: false,
|
|
28
|
+
innerTrigger: false,
|
|
29
|
+
rangeDiff: computed(function () {
|
|
30
|
+
return props.max - props.min;
|
|
31
|
+
}),
|
|
32
|
+
tipValue: computed(function () {
|
|
33
|
+
return api.formatTipValue(state.activeValue);
|
|
34
|
+
}),
|
|
35
|
+
formDisabled: computed(function () {
|
|
36
|
+
return (parent.tinyForm || {}).disabled;
|
|
37
|
+
}),
|
|
38
|
+
disabled: computed(function () {
|
|
39
|
+
return props.disabled || state.formDisabled;
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
return state;
|
|
43
|
+
};
|
|
44
|
+
export var renderless = function renderless(props, _ref2, _ref3) {
|
|
45
|
+
var computed = _ref2.computed,
|
|
46
|
+
onBeforeUnmount = _ref2.onBeforeUnmount,
|
|
47
|
+
onMounted = _ref2.onMounted,
|
|
48
|
+
reactive = _ref2.reactive,
|
|
49
|
+
watch = _ref2.watch,
|
|
50
|
+
inject = _ref2.inject;
|
|
51
|
+
var parent = _ref3.parent,
|
|
52
|
+
constants = _ref3.constants,
|
|
53
|
+
nextTick = _ref3.nextTick,
|
|
54
|
+
emit = _ref3.emit,
|
|
55
|
+
mode = _ref3.mode;
|
|
56
|
+
var api = {};
|
|
57
|
+
var state = initState({
|
|
58
|
+
reactive: reactive,
|
|
59
|
+
computed: computed,
|
|
60
|
+
props: props,
|
|
61
|
+
api: api,
|
|
62
|
+
parent: parent
|
|
63
|
+
});
|
|
64
|
+
parent.tinyForm = parent.tinyForm || inject('form', null);
|
|
65
|
+
Object.assign(api, {
|
|
66
|
+
state: state,
|
|
67
|
+
hideTip: hideTip(state),
|
|
68
|
+
formatTipValue: formatTipValue(props),
|
|
69
|
+
setBarStyle: setBarStyle({
|
|
70
|
+
props: props,
|
|
71
|
+
state: state
|
|
72
|
+
}),
|
|
73
|
+
changeActiveValue: changeActiveValue(state),
|
|
74
|
+
bindResize: bindResize({
|
|
75
|
+
parent: parent,
|
|
76
|
+
props: props,
|
|
77
|
+
state: state
|
|
78
|
+
}),
|
|
79
|
+
setButtonStyle: setButtonStyle({
|
|
80
|
+
props: props,
|
|
81
|
+
state: state
|
|
82
|
+
}),
|
|
83
|
+
calculateValue: calculateValue({
|
|
84
|
+
props: props,
|
|
85
|
+
state: state
|
|
86
|
+
}),
|
|
87
|
+
getActiveButtonValue: getActiveButtonValue(state),
|
|
88
|
+
getActiveButtonIndex: getActiveButtonIndex({
|
|
89
|
+
constants: constants,
|
|
90
|
+
mode: mode,
|
|
91
|
+
state: state
|
|
92
|
+
}),
|
|
93
|
+
setTipStyle: setTipStyle({
|
|
94
|
+
constants: constants,
|
|
95
|
+
mode: mode,
|
|
96
|
+
emit: emit,
|
|
97
|
+
parent: parent,
|
|
98
|
+
props: props,
|
|
99
|
+
state: state
|
|
100
|
+
}),
|
|
101
|
+
customAfterAppearHook: customAfterAppearHook({
|
|
102
|
+
state: state,
|
|
103
|
+
props: props
|
|
104
|
+
}),
|
|
105
|
+
customBeforeAppearHook: customBeforeAppearHook(props),
|
|
106
|
+
customAppearHook: customAppearHook(),
|
|
107
|
+
bindEvent: bindEvent(api),
|
|
108
|
+
autoSlider: autoSlider(api),
|
|
109
|
+
unBindEvent: unBindEvent(api),
|
|
110
|
+
displayTip: displayTip({
|
|
111
|
+
api: api,
|
|
112
|
+
nextTick: nextTick,
|
|
113
|
+
state: state
|
|
114
|
+
}),
|
|
115
|
+
bindKeyDown: bindKeyDown({
|
|
116
|
+
api: api,
|
|
117
|
+
props: props,
|
|
118
|
+
state: state
|
|
119
|
+
}),
|
|
120
|
+
bindMouseUp: bindMouseUp({
|
|
121
|
+
api: api,
|
|
122
|
+
emit: emit,
|
|
123
|
+
state: state
|
|
124
|
+
}),
|
|
125
|
+
bindMouseMove: bindMouseMove({
|
|
126
|
+
api: api,
|
|
127
|
+
nextTick: nextTick,
|
|
128
|
+
state: state
|
|
129
|
+
}),
|
|
130
|
+
bindMouseDown: bindMouseDown({
|
|
131
|
+
api: api,
|
|
132
|
+
constants: constants,
|
|
133
|
+
mode: mode,
|
|
134
|
+
emit: emit,
|
|
135
|
+
state: state
|
|
136
|
+
}),
|
|
137
|
+
setActiveButtonValue: setActiveButtonValue({
|
|
138
|
+
api: api,
|
|
139
|
+
emit: emit,
|
|
140
|
+
props: props,
|
|
141
|
+
state: state
|
|
142
|
+
}),
|
|
143
|
+
initSlider: initSlider({
|
|
144
|
+
api: api,
|
|
145
|
+
props: props,
|
|
146
|
+
state: state
|
|
147
|
+
}),
|
|
148
|
+
watchModelValue: watchModelValue({
|
|
149
|
+
api: api,
|
|
150
|
+
state: state
|
|
151
|
+
}),
|
|
152
|
+
watchActiveValue: watchActiveValue({
|
|
153
|
+
api: api,
|
|
154
|
+
emit: emit,
|
|
155
|
+
props: props,
|
|
156
|
+
state: state
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
watch(function () {
|
|
160
|
+
return props.modelValue;
|
|
161
|
+
}, api.watchModelValue, {
|
|
162
|
+
immediate: true
|
|
163
|
+
});
|
|
164
|
+
watch(function () {
|
|
165
|
+
return state.activeValue;
|
|
166
|
+
}, api.watchActiveValue, {
|
|
167
|
+
immediate: true
|
|
168
|
+
});
|
|
169
|
+
onMounted(api.bindEvent);
|
|
170
|
+
onBeforeUnmount(api.unBindEvent);
|
|
171
|
+
return api;
|
|
172
|
+
};
|
package/split/index.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export var px2percent = function px2percent(_ref) {
|
|
2
|
+
var numerator = _ref.numerator,
|
|
3
|
+
denominator = _ref.denominator;
|
|
4
|
+
return parseFloat(numerator) / parseFloat(denominator);
|
|
5
|
+
};
|
|
6
|
+
export var getComputedThresholdValue = function getComputedThresholdValue(_ref2) {
|
|
7
|
+
var api = _ref2.api,
|
|
8
|
+
props = _ref2.props,
|
|
9
|
+
refs = _ref2.refs,
|
|
10
|
+
state = _ref2.state;
|
|
11
|
+
return function (type) {
|
|
12
|
+
var size = refs.outerWrapper[state.offsetSize];
|
|
13
|
+
if (state.valueIsPx) {
|
|
14
|
+
return typeof props[type] === 'string' ? props[type] : size * props[type];
|
|
15
|
+
} else {
|
|
16
|
+
return typeof props[type] === 'string' ? api.px2percent({
|
|
17
|
+
numerator: props[type],
|
|
18
|
+
denominator: size
|
|
19
|
+
}) : props[type];
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export var getleftTopMin = function getleftTopMin(state) {
|
|
24
|
+
return function (_ref3) {
|
|
25
|
+
var oldvalue = _ref3.oldvalue,
|
|
26
|
+
newvalue = _ref3.newvalue;
|
|
27
|
+
return state.valueIsPx ? "".concat(Math.min(parseFloat(oldvalue), parseFloat(newvalue)), "px") : Math.min(oldvalue, newvalue);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export var getrightBottomMin = function getrightBottomMin(state) {
|
|
31
|
+
return function (_ref4) {
|
|
32
|
+
var oldvalue = _ref4.oldvalue,
|
|
33
|
+
newvalue = _ref4.newvalue;
|
|
34
|
+
return state.valueIsPx ? "".concat(Math.max(parseFloat(oldvalue), parseFloat(newvalue)), "px") : Math.max(oldvalue, newvalue);
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export var getAnotherOffset = function getAnotherOffset(_ref5) {
|
|
38
|
+
var refs = _ref5.refs,
|
|
39
|
+
state = _ref5.state;
|
|
40
|
+
return function (value) {
|
|
41
|
+
return state.valueIsPx ? "".concat(refs.outerWrapper[state.offsetSize] - parseFloat(value), "px") : 1 - value;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export var handleMove = function handleMove(_ref6) {
|
|
45
|
+
var api = _ref6.api,
|
|
46
|
+
emit = _ref6.emit,
|
|
47
|
+
props = _ref6.props,
|
|
48
|
+
refs = _ref6.refs,
|
|
49
|
+
state = _ref6.state;
|
|
50
|
+
return function (event) {
|
|
51
|
+
var pageOffset = state.isHorizontal ? event.pageX : event.pageY;
|
|
52
|
+
var offset = pageOffset - state.initOffset;
|
|
53
|
+
var outerWidth = refs.outerWrapper[state.offsetSize];
|
|
54
|
+
var value = state.valueIsPx ? "".concat(parseFloat(state.oldOffset) + offset, "px") : api.px2percent({
|
|
55
|
+
numerator: outerWidth * state.oldOffset + offset,
|
|
56
|
+
denominator: outerWidth
|
|
57
|
+
});
|
|
58
|
+
var anotherValue = api.getAnotherOffset(value);
|
|
59
|
+
if (parseFloat(value) <= parseFloat(state.computedleftTopMin)) {
|
|
60
|
+
value = api.getrightBottomMin({
|
|
61
|
+
oldvalue: value,
|
|
62
|
+
newvalue: state.computedleftTopMin
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (parseFloat(anotherValue) <= parseFloat(state.computedrightBottomMin)) {
|
|
66
|
+
value = api.getAnotherOffset(api.getrightBottomMin({
|
|
67
|
+
oldvalue: anotherValue,
|
|
68
|
+
newvalue: state.computedrightBottomMin
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
event.atMin = props.modelValue === state.computedleftTopMin;
|
|
72
|
+
event.atMax = state.valueIsPx ? api.getAnotherOffset(props.modelValue) === state.computedrightBottomMin : api.getAnotherOffset(props.modelValue).toFixed(5) === state.computedrightBottomMin.toFixed(5);
|
|
73
|
+
emit('update:modelValue', value);
|
|
74
|
+
emit('moving', event);
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export var handleUp = function handleUp(_ref7) {
|
|
78
|
+
var api = _ref7.api,
|
|
79
|
+
emit = _ref7.emit,
|
|
80
|
+
off = _ref7.off,
|
|
81
|
+
state = _ref7.state;
|
|
82
|
+
return function () {
|
|
83
|
+
state.isMoving = false;
|
|
84
|
+
off(document, 'mousemove', api.handleMove);
|
|
85
|
+
off(document, 'mouseup', api.handleUp);
|
|
86
|
+
emit('moveend');
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export var handleMousedown = function handleMousedown(_ref8) {
|
|
90
|
+
var api = _ref8.api,
|
|
91
|
+
emit = _ref8.emit,
|
|
92
|
+
on = _ref8.on,
|
|
93
|
+
props = _ref8.props,
|
|
94
|
+
state = _ref8.state;
|
|
95
|
+
return function (event) {
|
|
96
|
+
state.initOffset = state.isHorizontal ? event.pageX : event.pageY;
|
|
97
|
+
state.oldOffset = props.modelValue;
|
|
98
|
+
state.isMoving = true;
|
|
99
|
+
on(document, 'mousemove', api.handleMove);
|
|
100
|
+
on(document, 'mouseup', api.handleUp);
|
|
101
|
+
emit('movestart');
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export var computeOffset = function computeOffset(_ref9) {
|
|
105
|
+
var api = _ref9.api,
|
|
106
|
+
nextTick = _ref9.nextTick,
|
|
107
|
+
props = _ref9.props,
|
|
108
|
+
refs = _ref9.refs,
|
|
109
|
+
state = _ref9.state;
|
|
110
|
+
return function () {
|
|
111
|
+
if (state.valueIsPx) {
|
|
112
|
+
nextTick(function () {
|
|
113
|
+
state.offset = api.px2percent({
|
|
114
|
+
numerator: props.modelValue,
|
|
115
|
+
denominator: refs.outerWrapper && refs.outerWrapper[state.offsetSize]
|
|
116
|
+
}) * 10000 / 100;
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
state.offset = props.modelValue * 10000 / 100;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
package/split/vue.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
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; }
|
|
4
|
+
import { px2percent, getComputedThresholdValue, getleftTopMin, getrightBottomMin, getAnotherOffset, handleMove, handleUp, handleMousedown, computeOffset } from './index';
|
|
5
|
+
import { on, off } from '@opentiny/vue-renderless/common/deps/dom';
|
|
6
|
+
export var api = ['state', 'handleMousedown'];
|
|
7
|
+
export var useOffset = function useOffset(_ref) {
|
|
8
|
+
var nextTick = _ref.nextTick,
|
|
9
|
+
props = _ref.props,
|
|
10
|
+
refs = _ref.refs,
|
|
11
|
+
constants = _ref.constants,
|
|
12
|
+
hooks = _ref.hooks;
|
|
13
|
+
var api = {};
|
|
14
|
+
var computed = hooks.computed,
|
|
15
|
+
onMounted = hooks.onMounted,
|
|
16
|
+
onUnmounted = hooks.onUnmounted,
|
|
17
|
+
reactive = hooks.reactive,
|
|
18
|
+
toRefs = hooks.toRefs,
|
|
19
|
+
watch = hooks.watch;
|
|
20
|
+
var state = reactive({
|
|
21
|
+
offset: 0,
|
|
22
|
+
anotherOffset: computed(function () {
|
|
23
|
+
return 100 - state.offset;
|
|
24
|
+
}),
|
|
25
|
+
valueIsPx: computed(function () {
|
|
26
|
+
return typeof props.modelValue === 'string';
|
|
27
|
+
}),
|
|
28
|
+
isHorizontal: computed(function () {
|
|
29
|
+
return props.mode === constants.HORIZONTAL;
|
|
30
|
+
}),
|
|
31
|
+
offsetSize: computed(function () {
|
|
32
|
+
return state.isHorizontal ? 'offsetWidth' : 'offsetHeight';
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
Object.assign(api, {
|
|
36
|
+
px2percent: px2percent,
|
|
37
|
+
computeOffset: computeOffset({
|
|
38
|
+
api: api,
|
|
39
|
+
nextTick: nextTick,
|
|
40
|
+
props: props,
|
|
41
|
+
refs: refs,
|
|
42
|
+
state: state
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
watch(function () {
|
|
46
|
+
return props.modelValue;
|
|
47
|
+
}, api.computeOffset, {
|
|
48
|
+
immediate: true
|
|
49
|
+
});
|
|
50
|
+
onMounted(function () {
|
|
51
|
+
on(window, 'resize', api.computeOffset);
|
|
52
|
+
});
|
|
53
|
+
onUnmounted(function () {
|
|
54
|
+
off(window, 'resize', api.computeOffset);
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
api: api,
|
|
58
|
+
state: toRefs(state)
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export var renderless = function renderless(props, hooks, _ref2) {
|
|
62
|
+
var refs = _ref2.refs,
|
|
63
|
+
nextTick = _ref2.nextTick,
|
|
64
|
+
emit = _ref2.emit,
|
|
65
|
+
constants = _ref2.constants;
|
|
66
|
+
var api = {};
|
|
67
|
+
var computed = hooks.computed,
|
|
68
|
+
reactive = hooks.reactive;
|
|
69
|
+
var getUseOffset = useOffset({
|
|
70
|
+
nextTick: nextTick,
|
|
71
|
+
props: props,
|
|
72
|
+
refs: refs,
|
|
73
|
+
constants: constants,
|
|
74
|
+
hooks: hooks
|
|
75
|
+
});
|
|
76
|
+
var state = reactive(_objectSpread({
|
|
77
|
+
oldOffset: 0,
|
|
78
|
+
initOffset: 0,
|
|
79
|
+
isMoving: false,
|
|
80
|
+
prefix: constants.PREFIX,
|
|
81
|
+
computedleftTopMin: computed(function () {
|
|
82
|
+
return api.getComputedThresholdValue('leftTopMin');
|
|
83
|
+
}),
|
|
84
|
+
computedrightBottomMin: computed(function () {
|
|
85
|
+
return api.getComputedThresholdValue('rightBottomMin');
|
|
86
|
+
}),
|
|
87
|
+
wrapperClasses: computed(function () {
|
|
88
|
+
return ["".concat(state.prefix, "-wrapper"), state.isMoving ? 'no-select' : ''];
|
|
89
|
+
}),
|
|
90
|
+
paneClasses: computed(function () {
|
|
91
|
+
return ["".concat(state.prefix, "-pane"), _defineProperty({}, "".concat(state.prefix, "-pane-moving"), state.isMoving)];
|
|
92
|
+
})
|
|
93
|
+
}, getUseOffset.state));
|
|
94
|
+
Object.assign(api, _objectSpread(_objectSpread({
|
|
95
|
+
state: state,
|
|
96
|
+
getleftTopMin: getleftTopMin(state),
|
|
97
|
+
getrightBottomMin: getrightBottomMin(state)
|
|
98
|
+
}, getUseOffset.api), {}, {
|
|
99
|
+
handleUp: handleUp({
|
|
100
|
+
api: api,
|
|
101
|
+
emit: emit,
|
|
102
|
+
off: off,
|
|
103
|
+
state: state
|
|
104
|
+
}),
|
|
105
|
+
getAnotherOffset: getAnotherOffset({
|
|
106
|
+
refs: refs,
|
|
107
|
+
state: state
|
|
108
|
+
}),
|
|
109
|
+
handleMove: handleMove({
|
|
110
|
+
api: api,
|
|
111
|
+
emit: emit,
|
|
112
|
+
props: props,
|
|
113
|
+
refs: refs,
|
|
114
|
+
state: state
|
|
115
|
+
}),
|
|
116
|
+
handleMousedown: handleMousedown({
|
|
117
|
+
api: api,
|
|
118
|
+
emit: emit,
|
|
119
|
+
on: on,
|
|
120
|
+
props: props,
|
|
121
|
+
state: state
|
|
122
|
+
}),
|
|
123
|
+
getComputedThresholdValue: getComputedThresholdValue({
|
|
124
|
+
api: api,
|
|
125
|
+
props: props,
|
|
126
|
+
refs: refs,
|
|
127
|
+
state: state
|
|
128
|
+
})
|
|
129
|
+
}));
|
|
130
|
+
return api;
|
|
131
|
+
};
|
package/steps/vue.js
ADDED
package/switch/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { isNull } from '@opentiny/vue-renderless/common/type';
|
|
3
|
+
export var toggle = function toggle(_ref) {
|
|
4
|
+
var emit = _ref.emit,
|
|
5
|
+
props = _ref.props,
|
|
6
|
+
state = _ref.state;
|
|
7
|
+
return function (event) {
|
|
8
|
+
event.preventDefault();
|
|
9
|
+
if (state.disabled) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
state.currentValue = state.currentValue === props.trueValue ? props.falseValue : props.trueValue;
|
|
13
|
+
emit('update:modelValue', state.currentValue);
|
|
14
|
+
emit('change', state.currentValue);
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export var computedWarpClasses = function computedWarpClasses(_ref2) {
|
|
18
|
+
var prefixCls = _ref2.prefixCls,
|
|
19
|
+
props = _ref2.props,
|
|
20
|
+
state = _ref2.state;
|
|
21
|
+
return function () {
|
|
22
|
+
var _ref3;
|
|
23
|
+
return ["".concat(prefixCls), (_ref3 = {}, _defineProperty(_ref3, "".concat(prefixCls, "-checked"), state.currentValue === props.trueValue), _defineProperty(_ref3, "".concat(prefixCls, "-disabled"), state.disabled), _defineProperty(_ref3, "mini", props.mini), _defineProperty(_ref3, "disabled", state.disabled), _ref3)];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export var computedInnerClasses = function computedInnerClasses(_ref4) {
|
|
27
|
+
var prefixCls = _ref4.prefixCls;
|
|
28
|
+
return function () {
|
|
29
|
+
return "".concat(prefixCls, "-inner");
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export var computedStyle = function computedStyle(_ref5) {
|
|
33
|
+
var props = _ref5.props,
|
|
34
|
+
state = _ref5.state;
|
|
35
|
+
return function () {
|
|
36
|
+
var size = '';
|
|
37
|
+
if (!isNull(props.modelValue)) {
|
|
38
|
+
size = typeof props.modelValue === 'number' ? "".concat(props.modelValue, "px") : props.modelValue;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
fontSize: size,
|
|
42
|
+
backgroundColor: props.trueValue === state.currentValue ? props.activeColor : props.inactiveColor
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
package/switch/vue.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { toggle, computedWarpClasses, computedInnerClasses, computedStyle } from './index';
|
|
2
|
+
export var api = ['toggle', 'state'];
|
|
3
|
+
export var renderless = function renderless(props, _ref, _ref2) {
|
|
4
|
+
var computed = _ref.computed,
|
|
5
|
+
watch = _ref.watch,
|
|
6
|
+
reactive = _ref.reactive,
|
|
7
|
+
inject = _ref.inject;
|
|
8
|
+
var parent = _ref2.parent,
|
|
9
|
+
constants = _ref2.constants,
|
|
10
|
+
mode = _ref2.mode,
|
|
11
|
+
emit = _ref2.emit;
|
|
12
|
+
var prefixCls = constants.prefixcls(mode);
|
|
13
|
+
parent.tinyForm = parent.tinyForm || inject('form', null);
|
|
14
|
+
var api = {
|
|
15
|
+
computedInnerClasses: computedInnerClasses({
|
|
16
|
+
prefixCls: prefixCls
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
var state = reactive({
|
|
20
|
+
currentValue: props.modelValue,
|
|
21
|
+
innerClasses: computed(function () {
|
|
22
|
+
return api.computedInnerClasses();
|
|
23
|
+
}),
|
|
24
|
+
wrapClasses: computed(function () {
|
|
25
|
+
return api.computedWarpClasses();
|
|
26
|
+
}),
|
|
27
|
+
style: computed(function () {
|
|
28
|
+
return api.computedStyle();
|
|
29
|
+
}),
|
|
30
|
+
formDisabled: computed(function () {
|
|
31
|
+
return (parent.tinyForm || {}).disabled;
|
|
32
|
+
}),
|
|
33
|
+
disabled: computed(function () {
|
|
34
|
+
return props.disabled || state.formDisabled;
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
Object.assign(api, {
|
|
38
|
+
state: state,
|
|
39
|
+
computedStyle: computedStyle({
|
|
40
|
+
props: props,
|
|
41
|
+
state: state
|
|
42
|
+
}),
|
|
43
|
+
computedWarpClasses: computedWarpClasses({
|
|
44
|
+
prefixCls: prefixCls,
|
|
45
|
+
props: props,
|
|
46
|
+
state: state
|
|
47
|
+
}),
|
|
48
|
+
toggle: toggle({
|
|
49
|
+
emit: emit,
|
|
50
|
+
props: props,
|
|
51
|
+
state: state
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
watch(function () {
|
|
55
|
+
return props.modelValue;
|
|
56
|
+
}, function (value) {
|
|
57
|
+
state.currentValue = value;
|
|
58
|
+
}, {
|
|
59
|
+
immediate: true
|
|
60
|
+
});
|
|
61
|
+
return api;
|
|
62
|
+
};
|
package/tab-bar/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { POSITION } from '@opentiny/vue-renderless/common';
|
|
2
|
+
import { capitalize } from '@opentiny/vue-renderless/common/string';
|
|
3
|
+
export var computedBarStyle = function computedBarStyle(parent) {
|
|
4
|
+
return function (props, state) {
|
|
5
|
+
var style = {};
|
|
6
|
+
var offset = 0;
|
|
7
|
+
var tabSize = 0;
|
|
8
|
+
var sizeName = ~[POSITION.Top, POSITION.Bottom].indexOf(state.rootTabs.position) ? 'width' : 'height';
|
|
9
|
+
var sizeDir = sizeName === 'width' ? 'x' : 'y';
|
|
10
|
+
props.tabs.every(function (_ref) {
|
|
11
|
+
var state = _ref.state;
|
|
12
|
+
var $el = parent.$refs["tabs-".concat(state.paneName)];
|
|
13
|
+
if (!$el) return false;
|
|
14
|
+
if (!state.active) {
|
|
15
|
+
if ($el["client".concat(capitalize(sizeName))] === 0) {
|
|
16
|
+
var unactive = $el.cloneNode(true);
|
|
17
|
+
document.body.appendChild(unactive);
|
|
18
|
+
var unactiveSty = window.getComputedStyle(unactive);
|
|
19
|
+
offset += parseFloat(unactiveSty.width) - parseFloat(unactiveSty.paddingRight);
|
|
20
|
+
document.body.removeChild(unactive);
|
|
21
|
+
} else {
|
|
22
|
+
offset += $el["client".concat(capitalize(sizeName))];
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
} else {
|
|
26
|
+
var copyEl = $el.cloneNode(true);
|
|
27
|
+
var eleStyle = window.getComputedStyle(copyEl);
|
|
28
|
+
tabSize = $el["client".concat(capitalize(sizeName))];
|
|
29
|
+
if (tabSize === 0) {
|
|
30
|
+
document.body.appendChild(copyEl);
|
|
31
|
+
tabSize = parseFloat(eleStyle.width) - parseFloat(eleStyle.paddingLeft) - parseFloat(eleStyle.paddingRight);
|
|
32
|
+
document.body.removeChild(copyEl);
|
|
33
|
+
} else {
|
|
34
|
+
if (sizeName === 'width') {
|
|
35
|
+
document.body.appendChild(copyEl);
|
|
36
|
+
tabSize -= parseFloat(eleStyle.paddingRight);
|
|
37
|
+
document.body.removeChild(copyEl);
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
});
|
|
44
|
+
var transform = "translate".concat(capitalize(sizeDir), "(").concat(offset, "px)");
|
|
45
|
+
style[sizeName] = tabSize + 'px';
|
|
46
|
+
style.transform = transform;
|
|
47
|
+
style.msTransform = transform;
|
|
48
|
+
style.webkitTransform = transform;
|
|
49
|
+
return style;
|
|
50
|
+
};
|
|
51
|
+
};
|
package/tab-bar/vue.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { computedBarStyle } from './index';
|
|
2
|
+
export var api = ['state', 'computedBarStyle'];
|
|
3
|
+
export var renderless = function renderless(props, _ref, _ref2) {
|
|
4
|
+
var inject = _ref.inject,
|
|
5
|
+
reactive = _ref.reactive;
|
|
6
|
+
var parent = _ref2.parent;
|
|
7
|
+
var state = reactive({
|
|
8
|
+
rootTabs: inject('rootTabs'),
|
|
9
|
+
barStyle: {}
|
|
10
|
+
});
|
|
11
|
+
var api = {
|
|
12
|
+
state: state,
|
|
13
|
+
computedBarStyle: computedBarStyle(parent)
|
|
14
|
+
};
|
|
15
|
+
return api;
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var handleClick = function handleClick(state) {
|
|
2
|
+
return function (name) {
|
|
3
|
+
state.rootTabs.setCurrentName(name);
|
|
4
|
+
state.hide = true;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export var setDropdownTabs = function setDropdownTabs(state) {
|
|
8
|
+
return function (data) {
|
|
9
|
+
state.dropdownTabs = data;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { handleClick, setDropdownTabs } from './index';
|
|
2
|
+
export var api = ['state', 'handleClick', ' setDropdownTabs'];
|
|
3
|
+
export var renderless = function renderless(props, _ref) {
|
|
4
|
+
var inject = _ref.inject,
|
|
5
|
+
reactive = _ref.reactive;
|
|
6
|
+
var state = reactive({
|
|
7
|
+
hide: true,
|
|
8
|
+
dropdownTabs: props.tabs || [],
|
|
9
|
+
rootTabs: inject('rootTabs')
|
|
10
|
+
});
|
|
11
|
+
var api = {
|
|
12
|
+
state: state,
|
|
13
|
+
handleClick: handleClick(state),
|
|
14
|
+
setDropdownTabs: setDropdownTabs(state)
|
|
15
|
+
};
|
|
16
|
+
return api;
|
|
17
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export var computedIsClosable = function computedIsClosable(_ref) {
|
|
2
|
+
var parent = _ref.parent,
|
|
3
|
+
props = _ref.props;
|
|
4
|
+
return function () {
|
|
5
|
+
return props.withClose || parent.withClose;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export var computedActive = function computedActive(_ref2) {
|
|
9
|
+
var parent = _ref2.parent,
|
|
10
|
+
nextTick = _ref2.nextTick,
|
|
11
|
+
props = _ref2.props,
|
|
12
|
+
state = _ref2.state;
|
|
13
|
+
return function () {
|
|
14
|
+
var active = parent.state.currentName === (props.name || state.index);
|
|
15
|
+
if (active) {
|
|
16
|
+
state.loaded = true;
|
|
17
|
+
nextTick(function () {
|
|
18
|
+
state.animateShow = true;
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
state.animateShow = false;
|
|
22
|
+
}
|
|
23
|
+
return active;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export var computedPaneName = function computedPaneName(_ref3) {
|
|
27
|
+
var props = _ref3.props,
|
|
28
|
+
state = _ref3.state;
|
|
29
|
+
return function () {
|
|
30
|
+
return props.name || state.index;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export var watchTitle = function watchTitle(parent) {
|
|
34
|
+
return function () {
|
|
35
|
+
return parent.$emit('tab-nav-update');
|
|
36
|
+
};
|
|
37
|
+
};
|