zartui 2.1.6 → 2.1.8
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/es/action-sheet/index.js +15 -26
- package/es/area/index.js +5 -41
- package/es/avatar/index.js +3 -16
- package/es/back-top/index.js +4 -19
- package/es/badge/index.js +4 -12
- package/es/button/index.js +20 -40
- package/es/calendar/components/Header.js +3 -12
- package/es/calendar/components/Month.js +12 -65
- package/es/calendar/index.js +23 -94
- package/es/calendar/types.js +9 -15
- package/es/calendar/utils.js +5 -16
- package/es/cascader/index.js +4 -37
- package/es/cell/index.js +19 -37
- package/es/cell-group/index.js +5 -8
- package/es/checkbox/index.js +4 -11
- package/es/checkbox-group/index.js +4 -9
- package/es/col/index.js +6 -11
- package/es/collapse/index.js +2 -5
- package/es/collapse-item/index.js +19 -35
- package/es/count-down/index.js +2 -15
- package/es/count-down/utils.js +3 -10
- package/es/datetime-picker/DatePicker.js +12 -70
- package/es/datetime-picker/TimePicker.js +10 -23
- package/es/datetime-picker/index.js +2 -26
- package/es/datetime-picker/shared.js +5 -21
- package/es/datetime-picker/utils.js +0 -5
- package/es/dialog/Dialog.js +6 -21
- package/es/dialog/index.js +0 -16
- package/es/divider/index.js +5 -6
- package/es/dropdown-item/index.js +13 -39
- package/es/dropdown-menu/index.js +4 -9
- package/es/empty/images/Developing.js +0 -3
- package/es/empty/images/EmptyInterface.js +0 -3
- package/es/empty/images/EmptyResult.js +0 -3
- package/es/empty/images/FindNull.js +0 -3
- package/es/empty/images/NetworkError.js +0 -3
- package/es/empty/images/NotFound.js +0 -3
- package/es/empty/images/ReportSuccess.js +0 -3
- package/es/empty/images/Restricted.js +0 -3
- package/es/empty/images/ServerError.js +0 -3
- package/es/empty/index.js +3 -11
- package/es/field/index.js +21 -86
- package/es/fold-dialog/index.js +5 -20
- package/es/form/index.js +2 -18
- package/es/grid/index.js +2 -6
- package/es/grid-item/index.js +18 -30
- package/es/hierarchy-select/breadcrumb.js +2 -6
- package/es/hierarchy-select/index.js +4 -14
- package/es/hierarchy-select/markList.js +5 -30
- package/es/hierarchy-select/svg/SubIcon.js +0 -1
- package/es/icon/index.js +9 -13
- package/es/image/index.js +3 -19
- package/es/image-preview/ImagePreview.js +4 -8
- package/es/image-preview/ImagePreviewItem.js +14 -30
- package/es/image-preview/index.js +0 -12
- package/es/image-preview/shared.js +2 -4
- package/es/index-anchor/index.js +2 -6
- package/es/index-bar/IndexIndicate.js +0 -1
- package/es/index-bar/index.js +7 -28
- package/es/index.js +1 -4
- package/es/info/index.js +6 -8
- package/es/list/index.js +11 -27
- package/es/loading/index.js +7 -15
- package/es/locale/index.js +0 -2
- package/es/media-picker/index.js +35 -128
- package/es/media-picker/media-util.js +2 -5
- package/es/media-picker/type.js +9 -14
- package/es/media-picker/wx-util.js +0 -1
- package/es/media-player/index.js +7 -19
- package/es/mixins/bind-event.js +0 -3
- package/es/mixins/checkbox.js +5 -11
- package/es/mixins/click-outside.js +0 -2
- package/es/mixins/close-on-popstate.js +0 -1
- package/es/mixins/field.js +0 -2
- package/es/mixins/popup/index.js +12 -28
- package/es/mixins/popup/overlay.js +1 -11
- package/es/mixins/portal.js +2 -8
- package/es/mixins/relation.js +0 -8
- package/es/mixins/slots.js +1 -4
- package/es/mixins/touch.js +4 -9
- package/es/multiple-picker/MultiplePickerOptions.js +3 -20
- package/es/multiple-picker/index.js +5 -17
- package/es/nav-bar/index.js +4 -12
- package/es/notice-bar/index.js +10 -28
- package/es/number-keyboard/Key.js +2 -10
- package/es/number-keyboard/index.js +4 -19
- package/es/overlay/index.js +5 -8
- package/es/password-input/index.js +10 -16
- package/es/picker/PickerColumn.js +21 -56
- package/es/picker/index.js +12 -45
- package/es/popover/index.js +65 -90
- package/es/popup/index.js +5 -21
- package/es/pull-refresh/index.js +10 -29
- package/es/radio/index.js +2 -4
- package/es/radio-group/index.js +2 -4
- package/es/rate/index.js +12 -26
- package/es/row/index.js +3 -9
- package/es/search/index.js +9 -15
- package/es/signature/bezier.js +13 -20
- package/es/signature/force-landscape.js +0 -5
- package/es/signature/index.js +5 -24
- package/es/signature/point.js +1 -6
- package/es/signature/throttle.js +1 -10
- package/es/skeleton/index.js +5 -15
- package/es/slider/index.js +19 -55
- package/es/step/index.js +5 -12
- package/es/stepper/index.js +11 -39
- package/es/steps/index.js +2 -4
- package/es/sticky/index.js +8 -50
- package/es/swipe/index.js +19 -62
- package/es/swipe-cell/index.js +7 -23
- package/es/swipe-item/index.js +10 -19
- package/es/switch/index.js +8 -10
- package/es/switch/shared.js +1 -0
- package/es/switch-cell/index.js +7 -7
- package/es/tab/index.js +4 -15
- package/es/tabbar/index.js +4 -14
- package/es/tabbar-item/index.js +7 -15
- package/es/table/index.js +5 -28
- package/es/table/type.js +3 -4
- package/es/tabs/Content.js +5 -9
- package/es/tabs/Title.js +11 -20
- package/es/tabs/index.js +16 -51
- package/es/tabs/utils.js +0 -8
- package/es/tag/index.js +13 -17
- package/es/text-ellipsis/index.js +25 -42
- package/es/timeline/index.js +2 -25
- package/es/toast/Toast.js +11 -23
- package/es/toast/index.js +6 -33
- package/es/toast/lock-click.js +0 -2
- package/es/uploader/index.js +11 -62
- package/es/uploader/utils.js +0 -10
- package/es/utils/constant.js +2 -1
- package/es/utils/create/bem.js +1 -5
- package/es/utils/create/component.js +4 -8
- package/es/utils/create/i18n.js +0 -2
- package/es/utils/deep-assign.js +0 -4
- package/es/utils/deep-clone.js +0 -3
- package/es/utils/dom/event.js +2 -5
- package/es/utils/dom/node.js +0 -1
- package/es/utils/dom/raf.js +7 -6
- package/es/utils/dom/reset-scroll.js +2 -1
- package/es/utils/dom/scroll.js +8 -17
- package/es/utils/dom/style.js +3 -2
- package/es/utils/easings.js +2 -4
- package/es/utils/format/date-util.js +54 -122
- package/es/utils/format/number.js +2 -11
- package/es/utils/format/string.js +0 -3
- package/es/utils/format/unit.js +2 -12
- package/es/utils/functional.js +6 -9
- package/es/utils/getScroll.js +0 -5
- package/es/utils/index.js +3 -5
- package/es/utils/interceptor.js +2 -4
- package/es/utils/media/image-util.js +7 -19
- package/es/utils/raf.js +4 -12
- package/es/utils/router.js +7 -6
- package/es/utils/scrollTo.js +10 -15
- package/es/utils/validate/number.js +2 -2
- package/es/utils/vnodes.js +2 -8
- package/lib/action-sheet/index.js +12 -37
- package/lib/area/index.js +7 -48
- package/lib/avatar/index.js +5 -21
- package/lib/back-top/index.js +6 -28
- package/lib/badge/index.js +6 -18
- package/lib/button/index.js +20 -52
- package/lib/calendar/FastForwardImg.js +2 -3
- package/lib/calendar/SlowForwardImg.js +2 -3
- package/lib/calendar/components/Header.js +5 -21
- package/lib/calendar/components/Month.js +14 -74
- package/lib/calendar/index.js +23 -109
- package/lib/calendar/types.js +11 -22
- package/lib/calendar/utils.js +18 -46
- package/lib/cascader/index.js +6 -49
- package/lib/cell/index.js +19 -50
- package/lib/cell/shared.js +2 -3
- package/lib/cell-group/index.js +6 -17
- package/lib/checkbox/index.js +6 -17
- package/lib/checkbox-group/index.js +6 -16
- package/lib/col/index.js +8 -17
- package/lib/collapse/index.js +4 -11
- package/lib/collapse-item/index.js +20 -46
- package/lib/count-down/index.js +4 -22
- package/lib/count-down/utils.js +5 -17
- package/lib/datetime-picker/DatePicker.js +14 -84
- package/lib/datetime-picker/TimePicker.js +12 -33
- package/lib/datetime-picker/index.js +7 -41
- package/lib/datetime-picker/shared.js +9 -35
- package/lib/datetime-picker/utils.js +2 -11
- package/lib/dialog/Dialog.js +8 -31
- package/lib/dialog/index.js +1 -24
- package/lib/divider/index.js +6 -14
- package/lib/dropdown-item/index.js +14 -52
- package/lib/dropdown-menu/index.js +6 -18
- package/lib/empty/context.js +2 -3
- package/lib/empty/images/Developing.js +2 -9
- package/lib/empty/images/EmptyInterface.js +2 -9
- package/lib/empty/images/EmptyResult.js +2 -9
- package/lib/empty/images/FindNull.js +2 -9
- package/lib/empty/images/NetworkError.js +2 -9
- package/lib/empty/images/NotFound.js +2 -9
- package/lib/empty/images/ReportSuccess.js +2 -9
- package/lib/empty/images/Restricted.js +2 -9
- package/lib/empty/images/ServerError.js +2 -9
- package/lib/empty/index.js +5 -26
- package/lib/field/ClearIcon.js +2 -3
- package/lib/field/SearchIcon.js +2 -3
- package/lib/field/index.js +22 -99
- package/lib/fold-dialog/index.js +7 -25
- package/lib/form/index.js +4 -24
- package/lib/grid/index.js +4 -13
- package/lib/grid-item/index.js +19 -40
- package/lib/hierarchy-select/breadcrumb.js +5 -13
- package/lib/hierarchy-select/index.js +7 -25
- package/lib/hierarchy-select/markList.js +8 -39
- package/lib/hierarchy-select/svg/SubIcon.js +2 -4
- package/lib/icon/index.js +9 -21
- package/lib/image/index.js +4 -25
- package/lib/image-preview/ImagePreview.js +2 -19
- package/lib/image-preview/ImagePreviewItem.js +15 -39
- package/lib/image-preview/index.js +1 -18
- package/lib/image-preview/shared.js +3 -8
- package/lib/index-anchor/index.js +4 -14
- package/lib/index-bar/IndexIndicate.js +2 -4
- package/lib/index-bar/index.js +9 -40
- package/lib/index.js +5 -164
- package/lib/info/index.js +7 -16
- package/lib/lazyload/index.js +1 -5
- package/lib/list/index.js +12 -36
- package/lib/loading/index.js +8 -23
- package/lib/locale/index.js +2 -10
- package/lib/locale/lang/de-DE-formal.js +2 -3
- package/lib/locale/lang/de-DE.js +2 -3
- package/lib/locale/lang/en-US.js +2 -3
- package/lib/locale/lang/es-ES.js +2 -3
- package/lib/locale/lang/fr-FR.js +2 -3
- package/lib/locale/lang/ja-JP.js +2 -3
- package/lib/locale/lang/nb-NO.js +2 -3
- package/lib/locale/lang/ro-RO.js +2 -3
- package/lib/locale/lang/th-TH.js +2 -3
- package/lib/locale/lang/tr-TR.js +2 -3
- package/lib/locale/lang/zh-CN.js +2 -3
- package/lib/locale/lang/zh-HK.js +2 -3
- package/lib/locale/lang/zh-TW.js +2 -3
- package/lib/media-picker/image/DefaultAudioIcon.js +2 -3
- package/lib/media-picker/image/DefaultDocIcon.js +2 -3
- package/lib/media-picker/image/DefaultExcelIcon.js +2 -3
- package/lib/media-picker/image/DefaultFileIcon.js +2 -3
- package/lib/media-picker/image/DefaultPdfIcon.js +2 -3
- package/lib/media-picker/image/DefaultPptIcon.js +2 -3
- package/lib/media-picker/image/DefaultTextIcon.js +2 -3
- package/lib/media-picker/image/DefaultVideoIcon.js +2 -3
- package/lib/media-picker/image/DeleteIcon.js +2 -3
- package/lib/media-picker/image/Img64.js +4 -7
- package/lib/media-picker/image/PickFileIcon.js +2 -3
- package/lib/media-picker/image/PickPhotoIcon.js +2 -3
- package/lib/media-picker/image/ReUpload.js +2 -3
- package/lib/media-picker/image/TakeAudioIcon.js +2 -3
- package/lib/media-picker/image/TakePhotoIcon.js +2 -3
- package/lib/media-picker/image/TakeVideoIcon.js +2 -3
- package/lib/media-picker/index.js +33 -172
- package/lib/media-picker/media-util.js +9 -22
- package/lib/media-picker/type.js +10 -18
- package/lib/media-picker/wx-util.js +4 -15
- package/lib/media-player/index.js +8 -27
- package/lib/mixins/bind-event.js +1 -6
- package/lib/mixins/checkbox.js +8 -21
- package/lib/mixins/click-outside.js +3 -8
- package/lib/mixins/close-on-popstate.js +2 -7
- package/lib/mixins/field.js +2 -5
- package/lib/mixins/popup/context.js +2 -3
- package/lib/mixins/popup/index.js +12 -38
- package/lib/mixins/popup/overlay.js +3 -25
- package/lib/mixins/portal.js +2 -9
- package/lib/mixins/relation.js +0 -11
- package/lib/mixins/slots.js +3 -8
- package/lib/mixins/touch.js +6 -14
- package/lib/multiple-picker/MultiplePickerOptions.js +4 -26
- package/lib/multiple-picker/index.js +7 -29
- package/lib/multiple-picker/shared.js +3 -5
- package/lib/nav-bar/index.js +6 -19
- package/lib/notice-bar/CloseIcon.js +2 -3
- package/lib/notice-bar/MenuIcon.js +2 -3
- package/lib/notice-bar/NoticeIcon.js +2 -3
- package/lib/notice-bar/OpenIcon.js +2 -3
- package/lib/notice-bar/TipIcon.js +2 -3
- package/lib/notice-bar/WarningIcon.js +2 -3
- package/lib/notice-bar/index.js +12 -43
- package/lib/number-keyboard/CollapseIcon.js +2 -3
- package/lib/number-keyboard/DeleteIcon.js +2 -3
- package/lib/number-keyboard/Key.js +4 -20
- package/lib/number-keyboard/index.js +6 -29
- package/lib/overlay/index.js +6 -18
- package/lib/password-input/index.js +11 -25
- package/lib/picker/PickerColumn.js +24 -71
- package/lib/picker/index.js +14 -59
- package/lib/picker/shared.js +3 -5
- package/lib/popover/index.js +65 -104
- package/lib/popup/index.js +7 -30
- package/lib/pull-refresh/index.js +11 -38
- package/lib/radio/index.js +4 -10
- package/lib/radio-group/index.js +4 -11
- package/lib/rate/index.js +13 -34
- package/lib/row/index.js +5 -15
- package/lib/search/index.js +8 -23
- package/lib/signature/bezier.js +14 -25
- package/lib/signature/force-landscape.js +5 -19
- package/lib/signature/index.js +8 -34
- package/lib/signature/point.js +2 -11
- package/lib/signature/throttle.js +1 -11
- package/lib/skeleton/index.js +6 -23
- package/lib/slider/index.js +21 -66
- package/lib/step/index.js +7 -21
- package/lib/stepper/index.js +12 -49
- package/lib/steps/index.js +4 -10
- package/lib/sticky/index.js +10 -62
- package/lib/swipe/index.js +21 -73
- package/lib/swipe-cell/index.js +9 -32
- package/lib/swipe-item/index.js +12 -27
- package/lib/switch/index.js +9 -17
- package/lib/switch/shared.js +3 -4
- package/lib/switch-cell/index.js +7 -18
- package/lib/tab/index.js +6 -24
- package/lib/tabbar/index.js +6 -22
- package/lib/tabbar-item/index.js +7 -24
- package/lib/table/index.js +7 -38
- package/lib/table/type.js +3 -5
- package/lib/tabs/Content.js +7 -18
- package/lib/tabs/Title.js +13 -27
- package/lib/tabs/index.js +17 -68
- package/lib/tabs/utils.js +0 -13
- package/lib/tag/index.js +13 -25
- package/lib/text-ellipsis/index.js +27 -49
- package/lib/timeline/index.js +4 -35
- package/lib/timeline/svg/current.js +2 -3
- package/lib/timeline/svg/pass.js +2 -3
- package/lib/toast/Toast.js +12 -33
- package/lib/toast/index.js +7 -40
- package/lib/toast/lock-click.js +0 -3
- package/lib/toast/svg/SuccessIcon.js +2 -3
- package/lib/toast/svg/WarnIcon.js +2 -3
- package/lib/uploader/index.js +12 -75
- package/lib/uploader/utils.js +4 -21
- package/lib/utils/constant.js +12 -21
- package/lib/utils/create/bem.js +1 -6
- package/lib/utils/create/component.js +6 -17
- package/lib/utils/create/i18n.js +0 -8
- package/lib/utils/create/index.js +0 -4
- package/lib/utils/deep-assign.js +0 -6
- package/lib/utils/deep-clone.js +0 -5
- package/lib/utils/device.js +1 -3
- package/lib/utils/dom/event.js +5 -14
- package/lib/utils/dom/node.js +0 -2
- package/lib/utils/dom/raf.js +9 -13
- package/lib/utils/dom/reset-scroll.js +2 -4
- package/lib/utils/dom/scroll.js +16 -37
- package/lib/utils/dom/style.js +3 -3
- package/lib/utils/easings.js +2 -5
- package/lib/utils/format/date-util.js +88 -203
- package/lib/utils/format/number.js +4 -15
- package/lib/utils/format/string.js +0 -5
- package/lib/utils/format/unit.js +2 -16
- package/lib/utils/functional.js +7 -15
- package/lib/utils/getScroll.js +1 -8
- package/lib/utils/index.js +10 -26
- package/lib/utils/interceptor.js +2 -6
- package/lib/utils/media/image-util.js +10 -28
- package/lib/utils/raf.js +4 -13
- package/lib/utils/router.js +10 -13
- package/lib/utils/scrollTo.js +12 -24
- package/lib/utils/validate/date.js +0 -2
- package/lib/utils/validate/email.js +0 -1
- package/lib/utils/validate/mobile.js +0 -1
- package/lib/utils/validate/number.js +3 -5
- package/lib/utils/validate/system.js +0 -3
- package/lib/utils/vnodes.js +2 -9
- package/lib/zart.js +2325 -4752
- package/lib/zart.min.js +7 -1
- package/package.json +1 -1
package/lib/table/index.js
CHANGED
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
exports.__esModule = true;
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
|
|
10
7
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
8
|
var _index = _interopRequireDefault(require("../icon/index"));
|
|
13
|
-
|
|
14
9
|
var _index2 = _interopRequireDefault(require("../text-ellipsis/index"));
|
|
15
|
-
|
|
16
10
|
var _type = require("./type");
|
|
17
|
-
|
|
18
11
|
var _createNamespace = (0, _utils.createNamespace)('table'),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
createComponent = _createNamespace[0],
|
|
13
|
+
bem = _createNamespace[1];
|
|
22
14
|
var BODY_CELL_SLOTS_NAME = 'bodyCell';
|
|
23
|
-
|
|
24
|
-
var _default = createComponent({
|
|
15
|
+
var _default = exports.default = createComponent({
|
|
25
16
|
props: {
|
|
26
17
|
headList: {
|
|
27
18
|
type: Array,
|
|
@@ -62,30 +53,25 @@ var _default = createComponent({
|
|
|
62
53
|
},
|
|
63
54
|
formatColumns: function formatColumns() {
|
|
64
55
|
var _this = this;
|
|
65
|
-
|
|
66
56
|
var columns = [];
|
|
67
57
|
var left = 0;
|
|
68
58
|
this.headList.forEach(function (element, index) {
|
|
69
59
|
var column = {};
|
|
70
60
|
var preColumn = _this.headList[index - 1];
|
|
71
61
|
var nextColumn = _this.headList[index + 1];
|
|
72
|
-
|
|
73
62
|
if (element.sorter && element.defaultSortOrder) {
|
|
74
63
|
_this.sortOrder = element.defaultSortOrder || '';
|
|
75
64
|
_this.sortKey = element.key;
|
|
76
65
|
}
|
|
77
|
-
|
|
78
66
|
if (preColumn) {
|
|
79
67
|
left += Number(preColumn.width.split('px')[0]);
|
|
80
68
|
column.left = left + "px";
|
|
81
69
|
} else {
|
|
82
70
|
column.left = 0;
|
|
83
71
|
}
|
|
84
|
-
|
|
85
72
|
if (element.fixed && !nextColumn.fixed) {
|
|
86
73
|
column.lastFixLeft = true;
|
|
87
74
|
}
|
|
88
|
-
|
|
89
75
|
columns.push((0, _extends2.default)({}, element, column));
|
|
90
76
|
});
|
|
91
77
|
return columns;
|
|
@@ -94,7 +80,7 @@ var _default = createComponent({
|
|
|
94
80
|
methods: {
|
|
95
81
|
onScroll: function onScroll(_ref) {
|
|
96
82
|
var currentTarget = _ref.currentTarget,
|
|
97
|
-
|
|
83
|
+
scrollLeft = _ref.scrollLeft;
|
|
98
84
|
var mergedScrollLeft = typeof scrollLeft === 'number' ? scrollLeft : currentTarget.scrollLeft;
|
|
99
85
|
this.pingedLeft = mergedScrollLeft > 0;
|
|
100
86
|
},
|
|
@@ -102,11 +88,9 @@ var _default = createComponent({
|
|
|
102
88
|
if (!type) {
|
|
103
89
|
return _type.SortOrderEnum.ASCEND;
|
|
104
90
|
}
|
|
105
|
-
|
|
106
91
|
if (type === _type.SortOrderEnum.ASCEND) {
|
|
107
92
|
return _type.SortOrderEnum.DESCEND;
|
|
108
93
|
}
|
|
109
|
-
|
|
110
94
|
return '';
|
|
111
95
|
},
|
|
112
96
|
onHeaderClick: function onHeaderClick(data) {
|
|
@@ -120,12 +104,9 @@ var _default = createComponent({
|
|
|
120
104
|
},
|
|
121
105
|
getHead: function getHead(colData) {
|
|
122
106
|
var _this2 = this;
|
|
123
|
-
|
|
124
107
|
var h = this.$createElement;
|
|
125
|
-
|
|
126
108
|
var _ref2 = this,
|
|
127
|
-
|
|
128
|
-
|
|
109
|
+
slots = _ref2.slots;
|
|
129
110
|
if ((colData == null ? void 0 : colData.colSpan) !== 0) {
|
|
130
111
|
return h("th", {
|
|
131
112
|
"class": bem({
|
|
@@ -176,14 +157,11 @@ var _default = createComponent({
|
|
|
176
157
|
onClick: function onClick() {},
|
|
177
158
|
getElement: function getElement(rowData, colData, rowIndex) {
|
|
178
159
|
var h = this.$createElement;
|
|
179
|
-
|
|
180
160
|
var _ref3 = this,
|
|
181
|
-
|
|
182
|
-
|
|
161
|
+
slots = _ref3.slots;
|
|
183
162
|
if (rowData[colData.key] && rowData[colData.key].id && slots("data" + rowData[colData.key].id)) {
|
|
184
163
|
return slots("data" + rowData[colData.key].id)[0];
|
|
185
164
|
}
|
|
186
|
-
|
|
187
165
|
var slotProps = {
|
|
188
166
|
column: colData,
|
|
189
167
|
record: rowData,
|
|
@@ -191,11 +169,9 @@ var _default = createComponent({
|
|
|
191
169
|
index: rowIndex
|
|
192
170
|
};
|
|
193
171
|
var bodyCellSlots = slots(BODY_CELL_SLOTS_NAME, slotProps);
|
|
194
|
-
|
|
195
172
|
if (bodyCellSlots && bodyCellSlots.length) {
|
|
196
173
|
return bodyCellSlots[0];
|
|
197
174
|
}
|
|
198
|
-
|
|
199
175
|
return colData.ellipsis ? h(_index2.default, {
|
|
200
176
|
"attrs": {
|
|
201
177
|
"content": rowData[colData.key],
|
|
@@ -205,17 +181,13 @@ var _default = createComponent({
|
|
|
205
181
|
},
|
|
206
182
|
getBody: function getBody(rowData, rowIndex) {
|
|
207
183
|
var _this3 = this;
|
|
208
|
-
|
|
209
184
|
var h = this.$createElement;
|
|
210
185
|
return h("tr", [this.formatColumns.map(function (colData) {
|
|
211
186
|
var _additionalCellProps, _additionalCellProps2, _additionalCellProps3, _additionalCellProps4, _additionalCellProps5, _additionalCellProps6;
|
|
212
|
-
|
|
213
187
|
var additionalCellProps;
|
|
214
|
-
|
|
215
188
|
if (colData.customCell) {
|
|
216
189
|
additionalCellProps = colData.customCell(rowData, rowIndex);
|
|
217
190
|
}
|
|
218
|
-
|
|
219
191
|
var style = (0, _extends2.default)({}, colData.style);
|
|
220
192
|
style.left = colData.fixed ? colData.left : '';
|
|
221
193
|
return ((_additionalCellProps = additionalCellProps) == null ? void 0 : _additionalCellProps.rowSpan) !== 0 && ((_additionalCellProps2 = additionalCellProps) == null ? void 0 : _additionalCellProps2.colSpan) !== 0 && h("td", {
|
|
@@ -239,7 +211,6 @@ var _default = createComponent({
|
|
|
239
211
|
},
|
|
240
212
|
render: function render(h) {
|
|
241
213
|
var _this4 = this;
|
|
242
|
-
|
|
243
214
|
return h("div", {
|
|
244
215
|
"class": bem({
|
|
245
216
|
fixed: this.fixed,
|
|
@@ -269,6 +240,4 @@ var _default = createComponent({
|
|
|
269
240
|
return _this4.getBody(rowData, rowIndex);
|
|
270
241
|
})])])]);
|
|
271
242
|
}
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
exports.default = _default;
|
|
243
|
+
});
|
package/lib/table/type.js
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.SortOrderEnum = void 0;
|
|
5
|
-
var SortOrderEnum
|
|
6
|
-
exports.SortOrderEnum = SortOrderEnum;
|
|
7
|
-
|
|
8
|
-
(function (SortOrderEnum) {
|
|
5
|
+
var SortOrderEnum = exports.SortOrderEnum = /*#__PURE__*/function (SortOrderEnum) {
|
|
9
6
|
SortOrderEnum["ASCEND"] = "ascend";
|
|
10
7
|
SortOrderEnum["DESCEND"] = "descend";
|
|
11
|
-
|
|
8
|
+
return SortOrderEnum;
|
|
9
|
+
}({});
|
package/lib/tabs/Content.js
CHANGED
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
exports.__esModule = true;
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
|
|
10
7
|
var _utils = require("../utils");
|
|
11
|
-
|
|
12
8
|
var _touch = require("../mixins/touch");
|
|
13
|
-
|
|
14
9
|
var _createNamespace = (0, _utils.createNamespace)('tabs'),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
createComponent = _createNamespace[0],
|
|
11
|
+
bem = _createNamespace[1];
|
|
18
12
|
var MIN_SWIPE_DISTANCE = 50;
|
|
19
|
-
|
|
20
|
-
var _default = createComponent({
|
|
13
|
+
var _default = exports.default = createComponent({
|
|
21
14
|
mixins: [_touch.TouchMixin],
|
|
22
15
|
props: {
|
|
23
16
|
count: Number,
|
|
@@ -50,10 +43,10 @@ var _default = createComponent({
|
|
|
50
43
|
// watch swipe touch end
|
|
51
44
|
onTouchEnd: function onTouchEnd() {
|
|
52
45
|
var direction = this.direction,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/* istanbul ignore else */
|
|
46
|
+
deltaX = this.deltaX,
|
|
47
|
+
currentIndex = this.currentIndex;
|
|
56
48
|
|
|
49
|
+
/* istanbul ignore else */
|
|
57
50
|
if (direction === 'horizontal' && this.offsetX >= MIN_SWIPE_DISTANCE) {
|
|
58
51
|
/* istanbul ignore else */
|
|
59
52
|
if (deltaX > 0 && currentIndex !== 0) {
|
|
@@ -65,14 +58,12 @@ var _default = createComponent({
|
|
|
65
58
|
},
|
|
66
59
|
genChildren: function genChildren() {
|
|
67
60
|
var h = this.$createElement;
|
|
68
|
-
|
|
69
61
|
if (this.animated) {
|
|
70
62
|
return h("div", {
|
|
71
63
|
"class": bem('track'),
|
|
72
64
|
"style": this.style
|
|
73
65
|
}, [this.slots()]);
|
|
74
66
|
}
|
|
75
|
-
|
|
76
67
|
return this.slots();
|
|
77
68
|
}
|
|
78
69
|
},
|
|
@@ -85,6 +76,4 @@ var _default = createComponent({
|
|
|
85
76
|
"on": (0, _extends2.default)({}, this.listeners)
|
|
86
77
|
}, [this.genChildren()]);
|
|
87
78
|
}
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
exports.default = _default;
|
|
79
|
+
});
|
package/lib/tabs/Title.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
exports.__esModule = true;
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _utils = require("../utils");
|
|
9
|
-
|
|
10
7
|
var _info = _interopRequireDefault(require("../info"));
|
|
11
|
-
|
|
12
8
|
var _createNamespace = (0, _utils.createNamespace)('tab'),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _default = createComponent({
|
|
9
|
+
createComponent = _createNamespace[0],
|
|
10
|
+
bem = _createNamespace[1];
|
|
11
|
+
var _default = exports.default = createComponent({
|
|
17
12
|
props: {
|
|
18
13
|
dot: Boolean,
|
|
19
14
|
type: String,
|
|
@@ -40,12 +35,12 @@ var _default = createComponent({
|
|
|
40
35
|
style: function style() {
|
|
41
36
|
var style = {};
|
|
42
37
|
var color = this.color,
|
|
43
|
-
|
|
44
|
-
var isCard = this.type === 'card';
|
|
38
|
+
isActive = this.isActive;
|
|
39
|
+
var isCard = this.type === 'card';
|
|
45
40
|
|
|
41
|
+
// card theme color
|
|
46
42
|
if (color && isCard) {
|
|
47
43
|
style.borderColor = color;
|
|
48
|
-
|
|
49
44
|
if (!this.disabled) {
|
|
50
45
|
if (isActive) {
|
|
51
46
|
style.backgroundColor = color;
|
|
@@ -54,27 +49,23 @@ var _default = createComponent({
|
|
|
54
49
|
}
|
|
55
50
|
}
|
|
56
51
|
}
|
|
57
|
-
|
|
58
52
|
var titleColor = isActive ? this.activeColor : this.inactiveColor;
|
|
59
|
-
|
|
60
53
|
if (titleColor) {
|
|
61
54
|
style.color = titleColor;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
}
|
|
56
|
+
// 可滚动的tabs,不对元素宽度进行限制
|
|
65
57
|
if (!this.scrollable) {
|
|
66
58
|
style.maxWidth = this.maxWidth;
|
|
67
59
|
} else {
|
|
68
60
|
// tab之间的padding距离
|
|
69
|
-
var OPTIONS_LABEL_PADDING = 24;
|
|
70
|
-
|
|
71
|
-
var LIMIT_WORDS_LEN = 7;
|
|
72
|
-
|
|
61
|
+
var OPTIONS_LABEL_PADDING = 24;
|
|
62
|
+
// 限制最大展示7个字
|
|
63
|
+
var LIMIT_WORDS_LEN = 7;
|
|
64
|
+
// 根据实际是否激活状态,设置其字体宽度
|
|
73
65
|
var FONT_SIZE = isActive ? 16 : 14;
|
|
74
66
|
var scrollAbleWidth = OPTIONS_LABEL_PADDING + LIMIT_WORDS_LEN * FONT_SIZE + 'px';
|
|
75
67
|
style.maxWidth = scrollAbleWidth;
|
|
76
68
|
}
|
|
77
|
-
|
|
78
69
|
return style;
|
|
79
70
|
}
|
|
80
71
|
},
|
|
@@ -89,7 +80,6 @@ var _default = createComponent({
|
|
|
89
80
|
ellipsis: true
|
|
90
81
|
})
|
|
91
82
|
}, [this.slots() || this.title]);
|
|
92
|
-
|
|
93
83
|
if (this.dot || (0, _utils.isDef)(this.info) && this.info !== '') {
|
|
94
84
|
return h("span", {
|
|
95
85
|
"class": bem('text-wrapper')
|
|
@@ -100,7 +90,6 @@ var _default = createComponent({
|
|
|
100
90
|
}
|
|
101
91
|
})]);
|
|
102
92
|
}
|
|
103
|
-
|
|
104
93
|
return Text;
|
|
105
94
|
},
|
|
106
95
|
mutation: function mutation() {
|
|
@@ -111,7 +100,6 @@ var _default = createComponent({
|
|
|
111
100
|
if (!this.$refs.dom) {
|
|
112
101
|
return;
|
|
113
102
|
}
|
|
114
|
-
|
|
115
103
|
this.mutationObserver = new MutationObserver(this.mutation);
|
|
116
104
|
this.mutationObserver.observe(this.$refs.dom, {
|
|
117
105
|
characterData: true,
|
|
@@ -141,6 +129,4 @@ var _default = createComponent({
|
|
|
141
129
|
"style": this.style
|
|
142
130
|
}, [this.genText()]), this.slots('suffix')]);
|
|
143
131
|
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
exports.default = _default;
|
|
132
|
+
});
|
package/lib/tabs/index.js
CHANGED
|
@@ -1,53 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
exports.__esModule = true;
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _utils = require("../utils");
|
|
9
|
-
|
|
10
7
|
var _utils2 = require("./utils");
|
|
11
|
-
|
|
12
8
|
var _router = require("../utils/router");
|
|
13
|
-
|
|
14
9
|
var _style = require("../utils/dom/style");
|
|
15
|
-
|
|
16
10
|
var _event = require("../utils/dom/event");
|
|
17
|
-
|
|
18
11
|
var _unit = require("../utils/format/unit");
|
|
19
|
-
|
|
20
12
|
var _constant = require("../utils/constant");
|
|
21
|
-
|
|
22
13
|
var _interceptor = require("../utils/interceptor");
|
|
23
|
-
|
|
24
14
|
var _scroll = require("../utils/dom/scroll");
|
|
25
|
-
|
|
26
15
|
var _relation = require("../mixins/relation");
|
|
27
|
-
|
|
28
16
|
var _bindEvent = require("../mixins/bind-event");
|
|
29
|
-
|
|
30
17
|
var _Title = _interopRequireDefault(require("./Title"));
|
|
31
|
-
|
|
32
18
|
var _sticky = _interopRequireDefault(require("../sticky"));
|
|
33
|
-
|
|
34
19
|
var _Content = _interopRequireDefault(require("./Content"));
|
|
35
|
-
|
|
36
20
|
// Utils
|
|
21
|
+
|
|
37
22
|
// Mixins
|
|
23
|
+
|
|
38
24
|
// Components
|
|
39
|
-
var _createNamespace = (0, _utils.createNamespace)('tabs'),
|
|
40
|
-
createComponent = _createNamespace[0],
|
|
41
|
-
bem = _createNamespace[1];
|
|
42
25
|
|
|
43
|
-
var
|
|
26
|
+
var _createNamespace = (0, _utils.createNamespace)('tabs'),
|
|
27
|
+
createComponent = _createNamespace[0],
|
|
28
|
+
bem = _createNamespace[1];
|
|
29
|
+
var _default2 = exports.default = createComponent({
|
|
44
30
|
mixins: [(0, _relation.ParentMixin)('ztTabs'), (0, _bindEvent.BindEventMixin)(function (bind) {
|
|
45
31
|
if (!this.scroller) {
|
|
46
32
|
this.scroller = (0, _scroll.getScroller)(this.$el);
|
|
47
33
|
}
|
|
48
|
-
|
|
49
34
|
bind(window, 'resize', this.resize, true);
|
|
50
|
-
|
|
51
35
|
if (this.scrollspy) {
|
|
52
36
|
bind(this.scroller, 'scroll', this.onScroll, true);
|
|
53
37
|
}
|
|
@@ -128,7 +112,6 @@ var _default2 = createComponent({
|
|
|
128
112
|
},
|
|
129
113
|
currentName: function currentName() {
|
|
130
114
|
var activeTab = this.children[this.currentIndex];
|
|
131
|
-
|
|
132
115
|
if (activeTab) {
|
|
133
116
|
return activeTab.computedName;
|
|
134
117
|
}
|
|
@@ -140,7 +123,6 @@ var _default2 = createComponent({
|
|
|
140
123
|
if (this.sticky) {
|
|
141
124
|
return this.offsetTopPx + this.tabHeight;
|
|
142
125
|
}
|
|
143
|
-
|
|
144
126
|
return 0;
|
|
145
127
|
}
|
|
146
128
|
},
|
|
@@ -153,7 +135,6 @@ var _default2 = createComponent({
|
|
|
153
135
|
},
|
|
154
136
|
children: function children() {
|
|
155
137
|
var _this = this;
|
|
156
|
-
|
|
157
138
|
this.setCurrentIndexByName(this.active);
|
|
158
139
|
this.setLine();
|
|
159
140
|
this.$nextTick(function () {
|
|
@@ -162,8 +143,9 @@ var _default2 = createComponent({
|
|
|
162
143
|
},
|
|
163
144
|
currentIndex: function currentIndex() {
|
|
164
145
|
this.scrollIntoView();
|
|
165
|
-
this.setLine();
|
|
146
|
+
this.setLine();
|
|
166
147
|
|
|
148
|
+
// scroll to correct position
|
|
167
149
|
if (this.stickyFixed && !this.scrollspy) {
|
|
168
150
|
(0, _scroll.setRootScrollTop)(Math.ceil((0, _scroll.getElementTop)(this.$el) - this.offsetTopPx));
|
|
169
151
|
}
|
|
@@ -178,9 +160,9 @@ var _default2 = createComponent({
|
|
|
178
160
|
},
|
|
179
161
|
mounted: function mounted() {
|
|
180
162
|
var _this2 = this;
|
|
163
|
+
this.init();
|
|
181
164
|
|
|
182
|
-
|
|
183
|
-
|
|
165
|
+
// https://github.com/youzan/vant/issues/7959
|
|
184
166
|
if (this.vanPopup) {
|
|
185
167
|
this.vanPopup.onReopen(function () {
|
|
186
168
|
_this2.setLine();
|
|
@@ -198,26 +180,21 @@ var _default2 = createComponent({
|
|
|
198
180
|
},
|
|
199
181
|
init: function init() {
|
|
200
182
|
var _this3 = this;
|
|
201
|
-
|
|
202
183
|
this.$nextTick(function () {
|
|
203
184
|
_this3.inited = true;
|
|
204
185
|
_this3.tabHeight = (0, _scroll.getVisibleHeight)(_this3.$refs.wrap);
|
|
205
|
-
|
|
206
186
|
_this3.scrollIntoView(true);
|
|
207
187
|
});
|
|
208
188
|
},
|
|
209
189
|
// update nav bar style
|
|
210
190
|
setLine: function setLine() {
|
|
211
191
|
var _this4 = this;
|
|
212
|
-
|
|
213
192
|
var shouldAnimate = this.inited;
|
|
214
193
|
this.$nextTick(function () {
|
|
215
194
|
var titles = _this4.$refs.titles;
|
|
216
|
-
|
|
217
195
|
if (!titles || !titles[_this4.currentIndex] || _this4.type !== 'line' || (0, _style.isHidden)(_this4.$el)) {
|
|
218
196
|
return;
|
|
219
197
|
}
|
|
220
|
-
|
|
221
198
|
var title = titles[_this4.currentIndex].$el;
|
|
222
199
|
var lineHeight = _this4.lineHeight;
|
|
223
200
|
var left = title.offsetLeft + title.offsetWidth / 2;
|
|
@@ -226,17 +203,14 @@ var _default2 = createComponent({
|
|
|
226
203
|
backgroundColor: _this4.color,
|
|
227
204
|
transform: "translateX(" + left + "px) translateX(-50%)"
|
|
228
205
|
};
|
|
229
|
-
|
|
230
206
|
if (shouldAnimate) {
|
|
231
207
|
lineStyle.transitionDuration = _this4.duration + "s";
|
|
232
208
|
}
|
|
233
|
-
|
|
234
209
|
if ((0, _utils.isDef)(lineHeight)) {
|
|
235
210
|
var height = (0, _utils.addUnit)(lineHeight);
|
|
236
211
|
lineStyle.height = height;
|
|
237
212
|
lineStyle.borderRadius = height;
|
|
238
213
|
}
|
|
239
|
-
|
|
240
214
|
_this4.lineStyle = lineStyle;
|
|
241
215
|
});
|
|
242
216
|
},
|
|
@@ -250,19 +224,15 @@ var _default2 = createComponent({
|
|
|
250
224
|
},
|
|
251
225
|
setCurrentIndex: function setCurrentIndex(currentIndex) {
|
|
252
226
|
var newIndex = this.findAvailableTab(currentIndex);
|
|
253
|
-
|
|
254
227
|
if (!(0, _utils.isDef)(newIndex)) {
|
|
255
228
|
return;
|
|
256
229
|
}
|
|
257
|
-
|
|
258
230
|
var newTab = this.children[newIndex];
|
|
259
231
|
var newName = newTab.computedName;
|
|
260
232
|
var shouldEmitChange = this.currentIndex !== null;
|
|
261
233
|
this.currentIndex = newIndex;
|
|
262
|
-
|
|
263
234
|
if (newName !== this.active) {
|
|
264
235
|
this.$emit('input', newName);
|
|
265
|
-
|
|
266
236
|
if (shouldEmitChange) {
|
|
267
237
|
this.$emit('change', newName, newTab.title);
|
|
268
238
|
}
|
|
@@ -270,24 +240,20 @@ var _default2 = createComponent({
|
|
|
270
240
|
},
|
|
271
241
|
findAvailableTab: function findAvailableTab(index) {
|
|
272
242
|
var diff = index < this.currentIndex ? -1 : 1;
|
|
273
|
-
|
|
274
243
|
while (index >= 0 && index < this.children.length) {
|
|
275
244
|
if (!this.children[index].disabled) {
|
|
276
245
|
return index;
|
|
277
246
|
}
|
|
278
|
-
|
|
279
247
|
index += diff;
|
|
280
248
|
}
|
|
281
249
|
},
|
|
282
250
|
// emit event when clicked
|
|
283
251
|
onClick: function onClick(item, index) {
|
|
284
252
|
var _this5 = this;
|
|
285
|
-
|
|
286
253
|
var _this$children$index = this.children[index],
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
254
|
+
title = _this$children$index.title,
|
|
255
|
+
disabled = _this$children$index.disabled,
|
|
256
|
+
computedName = _this$children$index.computedName;
|
|
291
257
|
if (disabled) {
|
|
292
258
|
this.$emit('disabled', computedName, title);
|
|
293
259
|
} else {
|
|
@@ -296,7 +262,6 @@ var _default2 = createComponent({
|
|
|
296
262
|
args: [computedName],
|
|
297
263
|
done: function done() {
|
|
298
264
|
_this5.setCurrentIndex(index);
|
|
299
|
-
|
|
300
265
|
_this5.scrollToCurrentContent();
|
|
301
266
|
}
|
|
302
267
|
});
|
|
@@ -307,11 +272,9 @@ var _default2 = createComponent({
|
|
|
307
272
|
// scroll active tab into view
|
|
308
273
|
scrollIntoView: function scrollIntoView(immediate) {
|
|
309
274
|
var titles = this.$refs.titles;
|
|
310
|
-
|
|
311
275
|
if (!this.scrollable || !titles || !titles[this.currentIndex]) {
|
|
312
276
|
return;
|
|
313
277
|
}
|
|
314
|
-
|
|
315
278
|
var nav = this.$refs.nav;
|
|
316
279
|
var title = titles[this.currentIndex].$el;
|
|
317
280
|
var to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
|
|
@@ -324,24 +287,19 @@ var _default2 = createComponent({
|
|
|
324
287
|
// @exposed-api
|
|
325
288
|
scrollTo: function scrollTo(name) {
|
|
326
289
|
var _this6 = this;
|
|
327
|
-
|
|
328
290
|
this.$nextTick(function () {
|
|
329
291
|
_this6.setCurrentIndexByName(name);
|
|
330
|
-
|
|
331
292
|
_this6.scrollToCurrentContent(true);
|
|
332
293
|
});
|
|
333
294
|
},
|
|
334
295
|
scrollToCurrentContent: function scrollToCurrentContent(immediate) {
|
|
335
296
|
var _this7 = this;
|
|
336
|
-
|
|
337
297
|
if (immediate === void 0) {
|
|
338
298
|
immediate = false;
|
|
339
299
|
}
|
|
340
|
-
|
|
341
300
|
if (this.scrollspy) {
|
|
342
301
|
var target = this.children[this.currentIndex];
|
|
343
302
|
var el = target == null ? void 0 : target.$el;
|
|
344
|
-
|
|
345
303
|
if (el) {
|
|
346
304
|
var to = (0, _scroll.getElementTop)(el, this.scroller) - this.scrollOffset;
|
|
347
305
|
this.lockScroll = true;
|
|
@@ -359,29 +317,24 @@ var _default2 = createComponent({
|
|
|
359
317
|
},
|
|
360
318
|
getCurrentIndexOnScroll: function getCurrentIndexOnScroll() {
|
|
361
319
|
var children = this.children;
|
|
362
|
-
|
|
363
320
|
for (var index = 0; index < children.length; index++) {
|
|
364
321
|
var top = (0, _scroll.getVisibleTop)(children[index].$el);
|
|
365
|
-
|
|
366
322
|
if (top > this.scrollOffset) {
|
|
367
323
|
return index === 0 ? 0 : index - 1;
|
|
368
324
|
}
|
|
369
325
|
}
|
|
370
|
-
|
|
371
326
|
return children.length - 1;
|
|
372
327
|
}
|
|
373
328
|
},
|
|
374
329
|
render: function render() {
|
|
375
330
|
var _this8 = this,
|
|
376
|
-
|
|
377
|
-
|
|
331
|
+
_ref;
|
|
378
332
|
var h = arguments[0];
|
|
379
333
|
var type = this.type,
|
|
380
|
-
|
|
381
|
-
|
|
334
|
+
animated = this.animated,
|
|
335
|
+
scrollable = this.scrollable;
|
|
382
336
|
var Nav = this.children.map(function (item, index) {
|
|
383
337
|
var _item$badge;
|
|
384
|
-
|
|
385
338
|
return h(_Title.default, {
|
|
386
339
|
"ref": "titles",
|
|
387
340
|
"refInFor": true,
|
|
@@ -421,11 +374,9 @@ var _default2 = createComponent({
|
|
|
421
374
|
var wrapStyle = {
|
|
422
375
|
borderBottom: 'none'
|
|
423
376
|
};
|
|
424
|
-
|
|
425
377
|
if (type !== 'card' && this.divider) {
|
|
426
378
|
wrapStyle.borderBottom = '1px solid #eee';
|
|
427
379
|
}
|
|
428
|
-
|
|
429
380
|
var Wrap = h("div", {
|
|
430
381
|
"ref": "wrap",
|
|
431
382
|
"class": [bem('wrap', {
|
|
@@ -467,6 +418,4 @@ var _default2 = createComponent({
|
|
|
467
418
|
}
|
|
468
419
|
}, [this.slots()])]);
|
|
469
420
|
}
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
exports.default = _default2;
|
|
421
|
+
});
|
package/lib/tabs/utils.js
CHANGED
|
@@ -3,51 +3,38 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.scrollLeftTo = scrollLeftTo;
|
|
5
5
|
exports.scrollTopTo = scrollTopTo;
|
|
6
|
-
|
|
7
6
|
var _raf = require("../utils/dom/raf");
|
|
8
|
-
|
|
9
7
|
var _scroll = require("../utils/dom/scroll");
|
|
10
|
-
|
|
11
8
|
var scrollLeftRafId;
|
|
12
|
-
|
|
13
9
|
function scrollLeftTo(scroller, to, duration) {
|
|
14
10
|
(0, _raf.cancelRaf)(scrollLeftRafId);
|
|
15
11
|
var count = 0;
|
|
16
12
|
var from = scroller.scrollLeft;
|
|
17
13
|
var frames = duration === 0 ? 1 : Math.round(duration * 1000 / 16);
|
|
18
|
-
|
|
19
14
|
function animate() {
|
|
20
15
|
scroller.scrollLeft += (to - from) / frames;
|
|
21
|
-
|
|
22
16
|
if (++count < frames) {
|
|
23
17
|
scrollLeftRafId = (0, _raf.raf)(animate);
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
|
-
|
|
27
20
|
animate();
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function scrollTopTo(scroller, to, duration, callback) {
|
|
31
23
|
var current = (0, _scroll.getScrollTop)(scroller);
|
|
32
24
|
var isDown = current < to;
|
|
33
25
|
var frames = duration === 0 ? 1 : Math.round(duration * 1000 / 16);
|
|
34
26
|
var step = (to - current) / frames;
|
|
35
|
-
|
|
36
27
|
function animate() {
|
|
37
28
|
current += step;
|
|
38
|
-
|
|
39
29
|
if (isDown && current > to || !isDown && current < to) {
|
|
40
30
|
current = to;
|
|
41
31
|
}
|
|
42
|
-
|
|
43
32
|
(0, _scroll.setScrollTop)(scroller, current);
|
|
44
|
-
|
|
45
33
|
if (isDown && current < to || !isDown && current > to) {
|
|
46
34
|
(0, _raf.raf)(animate);
|
|
47
35
|
} else if (callback) {
|
|
48
36
|
(0, _raf.raf)(callback);
|
|
49
37
|
}
|
|
50
38
|
}
|
|
51
|
-
|
|
52
39
|
animate();
|
|
53
40
|
}
|