zartui 2.0.30 → 2.0.32
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/cell/index.less +2 -2
- package/es/dialog/index.css +1 -1
- package/es/dialog/index.less +1 -0
- package/es/field/index.js +6 -0
- package/es/index.js +1 -1
- package/es/popup/index.js +17 -6
- package/es/search/index.css +1 -1
- package/es/search/index.less +0 -1
- package/es/style/var.less +2 -6
- package/es/table/index.css +1 -1
- package/es/table/index.js +198 -36
- package/es/table/index.less +35 -15
- package/lib/7893e51cf0a4877dac80.worker.js +10 -0
- package/lib/be09b519a460e229fd8d.worker.js +2527 -0
- package/lib/cell/index.less +2 -2
- package/lib/dialog/index.css +1 -1
- package/lib/dialog/index.less +1 -0
- package/lib/field/index.js +6 -0
- package/lib/index.css +1 -1
- package/lib/index.js +1 -1
- package/lib/popup/index.js +18 -6
- package/lib/search/index.css +1 -1
- package/lib/search/index.less +0 -1
- package/lib/style/var.less +2 -6
- package/lib/table/index.css +1 -1
- package/lib/table/index.js +198 -36
- package/lib/table/index.less +35 -15
- package/lib/zart.js +27382 -133862
- package/lib/zart.min.js +4 -4
- package/package.json +1 -1
- package/lib/a037f57fc4d92a8a1f1e.worker.js +0 -60600
- package/lib/b7cf90b4775181215df7.worker.js +0 -10
package/es/cell/index.less
CHANGED
package/es/dialog/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.zt-dialog{position:fixed;top:45%;left:50%;width:350px;overflow:hidden;font-size:16px;background-color:#fff;border-radius:12px;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:.3s;transition:.3s;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}.zt-dialog__header{padding-top:24px;font-weight:700;line-height:24px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;word-break:break-all;padding-left:16px;padding-right:16px}.zt-dialog__header--isolated{padding:24px 0}.zt-dialog__header--custom-title{height:44px;padding-left:0;padding-right:0;padding-top:0}.zt-dialog__content{text-align:center;word-break:break-all;font-size:0}.zt-dialog__message{max-height:60vh;padding:24px 16px;overflow-y:auto;font-size:16px;line-height:20px;color:rgba(45,75,115,.6);display:inline-block;text-align:left;white-space:pre-wrap;word-wrap:break-word;-webkit-overflow-scrolling:touch}.zt-dialog__message--has-title{padding-top:8px;font-size:14px}.zt-dialog__message--left{text-align:left}.zt-dialog__message--right{text-align:right}.zt-dialog__footer{overflow:hidden;-webkit-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;height:44px;padding:0 32px 24px;position:relative;box-sizing:content-box}.zt-dialog-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.zt-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}.zt-dialog__cancel{background:#fff}.zt-dialog__confirm--with-cancel.zt-dialog__confirm.zt-button{margin-left:8px}
|
|
1
|
+
.zt-dialog{position:fixed;top:45%;left:50%;width:350px;max-width:90%;overflow:hidden;font-size:16px;background-color:#fff;border-radius:12px;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:.3s;transition:.3s;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}.zt-dialog__header{padding-top:24px;font-weight:700;line-height:24px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;word-break:break-all;padding-left:16px;padding-right:16px}.zt-dialog__header--isolated{padding:24px 0}.zt-dialog__header--custom-title{height:44px;padding-left:0;padding-right:0;padding-top:0}.zt-dialog__content{text-align:center;word-break:break-all;font-size:0}.zt-dialog__message{max-height:60vh;padding:24px 16px;overflow-y:auto;font-size:16px;line-height:20px;color:rgba(45,75,115,.6);display:inline-block;text-align:left;white-space:pre-wrap;word-wrap:break-word;-webkit-overflow-scrolling:touch}.zt-dialog__message--has-title{padding-top:8px;font-size:14px}.zt-dialog__message--left{text-align:left}.zt-dialog__message--right{text-align:right}.zt-dialog__footer{overflow:hidden;-webkit-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;height:44px;padding:0 32px 24px;position:relative;box-sizing:content-box}.zt-dialog-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.zt-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}.zt-dialog__cancel{background:#fff}.zt-dialog__confirm--with-cancel.zt-dialog__confirm.zt-button{margin-left:8px}
|
package/es/dialog/index.less
CHANGED
package/es/field/index.js
CHANGED
|
@@ -100,6 +100,12 @@ export default createComponent({
|
|
|
100
100
|
this.resetValidation();
|
|
101
101
|
this.validateWithTrigger('onChange');
|
|
102
102
|
this.$nextTick(this.adjustSize);
|
|
103
|
+
},
|
|
104
|
+
autosize: {
|
|
105
|
+
deep: true,
|
|
106
|
+
handler: function handler() {
|
|
107
|
+
this.$nextTick(this.adjustSize);
|
|
108
|
+
}
|
|
103
109
|
}
|
|
104
110
|
},
|
|
105
111
|
mounted: function mounted() {
|
package/es/index.js
CHANGED
|
@@ -76,7 +76,7 @@ import Tag from './tag';
|
|
|
76
76
|
import Timeline from './timeline';
|
|
77
77
|
import Toast from './toast';
|
|
78
78
|
import Uploader from './uploader';
|
|
79
|
-
var version = '2.0.
|
|
79
|
+
var version = '2.0.32';
|
|
80
80
|
|
|
81
81
|
function install(Vue) {
|
|
82
82
|
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, PdfViewerV2, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader];
|
package/es/popup/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createNamespace, isDef } from '../utils';
|
|
2
2
|
import { PopupMixin } from '../mixins/popup';
|
|
3
3
|
import Icon from '../icon';
|
|
4
|
+
import { unitToPx } from "../utils/format/unit";
|
|
4
5
|
|
|
5
6
|
var _createNamespace = createNamespace('popup'),
|
|
6
7
|
createComponent = _createNamespace[0],
|
|
@@ -42,6 +43,15 @@ export default createComponent({
|
|
|
42
43
|
type: Number,
|
|
43
44
|
default: 60
|
|
44
45
|
},
|
|
46
|
+
// 控制滑动区域的高度,滑动的最小高
|
|
47
|
+
minDragHeight: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: '40px'
|
|
50
|
+
},
|
|
51
|
+
maxDragHeight: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: '85vh'
|
|
54
|
+
},
|
|
45
55
|
sliderShow: {
|
|
46
56
|
type: Boolean,
|
|
47
57
|
default: false
|
|
@@ -69,7 +79,6 @@ export default createComponent({
|
|
|
69
79
|
},
|
|
70
80
|
data: function data() {
|
|
71
81
|
return {
|
|
72
|
-
positionY: 0,
|
|
73
82
|
timerId: null,
|
|
74
83
|
contentStyle: "height:" + this.sliderContentHeight + "px;",
|
|
75
84
|
touchHeight: 0,
|
|
@@ -96,14 +105,15 @@ export default createComponent({
|
|
|
96
105
|
}
|
|
97
106
|
|
|
98
107
|
var h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
99
|
-
|
|
108
|
+
var touchAreaHeight = unitToPx(this.minDragHeight);
|
|
109
|
+
var positionY = event.touches[0].clientY;
|
|
100
110
|
this.timerId = setTimeout(function () {
|
|
101
|
-
if (
|
|
111
|
+
if (positionY === 0 || positionY < h - unitToPx(_this2.maxDragHeight)) {
|
|
102
112
|
return;
|
|
103
113
|
}
|
|
104
114
|
|
|
105
|
-
_this2.touchHeight =
|
|
106
|
-
_this2.contentStyle = "height:" + (h - _this2.touchHeight -
|
|
115
|
+
_this2.touchHeight = positionY - touchAreaHeight > h - touchAreaHeight ? h - touchAreaHeight + _this2.touchPoint : positionY;
|
|
116
|
+
_this2.contentStyle = "height:" + (h - _this2.touchHeight - touchAreaHeight + _this2.touchPoint) + "px;";
|
|
107
117
|
}, 10);
|
|
108
118
|
},
|
|
109
119
|
endMove: function endMove() {
|
|
@@ -152,7 +162,8 @@ export default createComponent({
|
|
|
152
162
|
"touchmove": this.move,
|
|
153
163
|
"touchend": this.endMove,
|
|
154
164
|
"touchstart": this.startMove
|
|
155
|
-
}
|
|
165
|
+
},
|
|
166
|
+
"style": "height:" + this.minDragHeight
|
|
156
167
|
}, [h("div", {
|
|
157
168
|
"class": bem('slider-bar')
|
|
158
169
|
})]), h("div", {
|
package/es/search/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.zt-search{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;box-sizing:border-box;padding:8px 16px;background-color:#f5faff}.zt-search__content{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-flex:1;-webkit-flex:1;flex:1;background-color:rgba(45,75,115,.04);border:1px solid transparent;border-radius:2px;box-shadow:inset 4px 4px 8px 0 rgba(45,75,115,.1);background-clip:padding-box;position:relative}.zt-search__content::before{content:'';position:absolute;top:0;right:0;left:0;bottom:0;z-index:-1;margin:-1px;border-radius:inherit;background:-webkit-linear-gradient(#fff,rgba(255,255,255,.4));background:linear-gradient(#fff,rgba(255,255,255,.4))}.zt-search__content--round{border-radius:999px}.zt-search__label{padding:8px 0 8px 12px;color:rgba(0,0,0,.6);font-weight:400;font-size:14px;line-height:20px}.zt-search .zt-field__root{background-color:transparent;padding:0}.zt-search .zt-field__label{margin-right:0}.zt-search .zt-cell__title.zt-field__label{-webkit-box-flex:unset;-webkit-flex:unset;flex:unset}.zt-search .zt-cell{-webkit-box-flex:1;-webkit-flex:1;flex:1;padding:8px 12px;background:0 0;line-height:20px;font-size:14px;font-weight:400}.zt-search .zt-cell__left-icon{color:#969799}.zt-search .zt-field{margin:0}.zt-search .zt-field__control{color:#2d4b73}.zt-search--show-action{padding-right:0}.zt-search input{caret-color:#0091fa}.zt-search input::-webkit-search-cancel-button,.zt-search input::-webkit-search-decoration,.zt-search input::-webkit-search-results-button,.zt-search input::-webkit-search-results-decoration{display:none}.zt-search input::-webkit-input-placeholder{color:rgba(45,75,115,.2)}.zt-search input::placeholder{color:rgba(45,75,115,.2)}.zt-search__action{padding:0 16px 0 12px;color:#0091fa;font-size:
|
|
1
|
+
.zt-search{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;box-sizing:border-box;padding:8px 16px;background-color:#f5faff}.zt-search__content{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-flex:1;-webkit-flex:1;flex:1;background-color:rgba(45,75,115,.04);border:1px solid transparent;border-radius:2px;box-shadow:inset 4px 4px 8px 0 rgba(45,75,115,.1);background-clip:padding-box;position:relative}.zt-search__content::before{content:'';position:absolute;top:0;right:0;left:0;bottom:0;z-index:-1;margin:-1px;border-radius:inherit;background:-webkit-linear-gradient(#fff,rgba(255,255,255,.4));background:linear-gradient(#fff,rgba(255,255,255,.4))}.zt-search__content--round{border-radius:999px}.zt-search__label{padding:8px 0 8px 12px;color:rgba(0,0,0,.6);font-weight:400;font-size:14px;line-height:20px}.zt-search .zt-field__root{background-color:transparent;padding:0}.zt-search .zt-field__label{margin-right:0}.zt-search .zt-cell__title.zt-field__label{-webkit-box-flex:unset;-webkit-flex:unset;flex:unset}.zt-search .zt-cell{-webkit-box-flex:1;-webkit-flex:1;flex:1;padding:8px 12px;background:0 0;line-height:20px;font-size:14px;font-weight:400}.zt-search .zt-cell__left-icon{color:#969799}.zt-search .zt-field{margin:0}.zt-search .zt-field__control{color:#2d4b73}.zt-search--show-action{padding-right:0}.zt-search input{caret-color:#0091fa}.zt-search input::-webkit-search-cancel-button,.zt-search input::-webkit-search-decoration,.zt-search input::-webkit-search-results-button,.zt-search input::-webkit-search-results-decoration{display:none}.zt-search input::-webkit-input-placeholder{color:rgba(45,75,115,.2)}.zt-search input::placeholder{color:rgba(45,75,115,.2)}.zt-search__action{padding:0 16px 0 12px;color:#0091fa;font-size:14px;height:28px;cursor:pointer;-webkit-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center}
|
package/es/search/index.less
CHANGED
package/es/style/var.less
CHANGED
|
@@ -282,7 +282,6 @@
|
|
|
282
282
|
@cell-label-font-size: @font-size-md;
|
|
283
283
|
@cell-label-line-height: @line-height-sm;
|
|
284
284
|
@cell-label-margin-top: 10px;
|
|
285
|
-
@cell-value-color: @black;
|
|
286
285
|
@cell-icon-size: 16px;
|
|
287
286
|
@cell-right-icon-color: @gray-6;
|
|
288
287
|
@cell-large-vertical-padding: @padding-sm;
|
|
@@ -785,7 +784,7 @@
|
|
|
785
784
|
@search-left-icon-color: @gray-6;
|
|
786
785
|
@search-action-padding: 0 @padding-md 0 @padding-sm;
|
|
787
786
|
@search-action-text-color: @blue;
|
|
788
|
-
@search-action-font-size: @font-size-
|
|
787
|
+
@search-action-font-size: @font-size-md;
|
|
789
788
|
@search-action-height: 28px;
|
|
790
789
|
@search-input-caret-color: #0091FA;
|
|
791
790
|
@search-cell-padding: 8px 12px;
|
|
@@ -1060,14 +1059,11 @@
|
|
|
1060
1059
|
@backtop-box-shadow: 0 4px 8px 0 rgba(0,0,0,0.20);
|
|
1061
1060
|
|
|
1062
1061
|
// Table
|
|
1062
|
+
@table-border-radius: @border-radius-lg;
|
|
1063
1063
|
@table-head-height: 40px;
|
|
1064
1064
|
@table-head-font-size: 14px;
|
|
1065
|
-
@table-head-color: #000;
|
|
1066
|
-
@table-head-background: #fafafa;
|
|
1067
1065
|
@table-row-height: 40px;
|
|
1068
1066
|
@table-row-font-size: 14px;
|
|
1069
|
-
@table-row-color: #000;
|
|
1070
|
-
@table-row-background: #fff;
|
|
1071
1067
|
|
|
1072
1068
|
// Fold-Dialog
|
|
1073
1069
|
@foldDialog-padding: 0 16px 12px 16px;
|
package/es/table/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.zt-table{position:relative}.zt-table__normal-box{display:-webkit-box;display:-webkit-flex;display:flex;overflow-x:scroll}.zt-
|
|
1
|
+
.zt-table{position:relative;border-radius:8px;scrollbar-width:none;-ms-overflow-style:none}.zt-table::-webkit-scrollbar{display:none;width:0;height:0}.zt-table__normal-box{display:-webkit-box;display:-webkit-flex;display:flex;overflow-x:scroll;position:relative}.zt-table__fixed-left-box{display:-webkit-box;display:-webkit-flex;display:flex;position:absolute;top:0;left:-1px;z-index:2}.zt-table__fixed-right-box{display:-webkit-box;display:-webkit-flex;display:flex;position:absolute;top:0;right:-1px;z-index:2}.zt-table__fixed-left-box.shadow::after{content:"";position:absolute;top:0;right:-10px;width:10px;height:100%;opacity:.06;background-image:-webkit-linear-gradient(left,#000 0,rgba(0,0,0,0) 100%);background-image:linear-gradient(90deg,#000 0,rgba(0,0,0,0) 100%)}.zt-table__fixed-right-box.shadow::before{content:"";position:absolute;top:0;left:-10px;width:10px;height:100%;opacity:.06;background-image:-webkit-linear-gradient(left,#000 0,rgba(0,0,0,0) 100%);background-image:linear-gradient(90deg,#000 0,rgba(0,0,0,0) 100%)}.zt-table__head{-webkit-flex-shrink:0;flex-shrink:0}.zt-table__head-item{height:40px;font-weight:600;font-size:14px;text-align:center;line-height:40px}.zt-table__table-data{height:40px;font-size:14px;text-align:center;line-height:40px}.zt-table.zt-table--no-border .zt-table__fixed-head::after,.zt-table.zt-table--no-border .zt-table__head-item::after,.zt-table.zt-table--no-border .zt-table__head::after,.zt-table.zt-table--no-border .zt-table__normal-box::after,.zt-table.zt-table--no-border .zt-table__table-data::after{border:none}
|
package/es/table/index.js
CHANGED
|
@@ -18,22 +18,51 @@ export default createComponent({
|
|
|
18
18
|
dataList: {
|
|
19
19
|
type: Array,
|
|
20
20
|
default: []
|
|
21
|
+
},
|
|
22
|
+
outline: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: true
|
|
25
|
+
},
|
|
26
|
+
headColor: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "#000"
|
|
29
|
+
},
|
|
30
|
+
headBackground: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "#fafafa"
|
|
33
|
+
},
|
|
34
|
+
dataColor: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "#000"
|
|
37
|
+
},
|
|
38
|
+
dataBackground: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "#fff"
|
|
41
|
+
},
|
|
42
|
+
hideTableHead: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
21
45
|
}
|
|
22
46
|
},
|
|
23
47
|
data: function data() {
|
|
24
48
|
return defaultData();
|
|
25
49
|
},
|
|
26
50
|
computed: {
|
|
27
|
-
|
|
51
|
+
fixedColumnLeft: function fixedColumnLeft() {
|
|
28
52
|
return this.headList.filter(function (v) {
|
|
29
|
-
return v.
|
|
53
|
+
return v.fixedLeft;
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
fixedColumnRight: function fixedColumnRight() {
|
|
57
|
+
return this.headList.filter(function (v) {
|
|
58
|
+
return v.fixedRight;
|
|
30
59
|
});
|
|
31
60
|
},
|
|
32
61
|
resortHeadList: function resortHeadList() {
|
|
33
62
|
// 对表头数组重新排序,需要固定的表头向左对齐
|
|
34
|
-
return this.
|
|
35
|
-
return !v.
|
|
36
|
-
}));
|
|
63
|
+
return this.fixedColumnLeft.concat(this.headList.filter(function (v) {
|
|
64
|
+
return !v.fixedLeft && !v.fixedRight;
|
|
65
|
+
})).concat(this.fixedColumnRight);
|
|
37
66
|
},
|
|
38
67
|
hasSummary: function hasSummary() {
|
|
39
68
|
return this.headList.filter(function (v) {
|
|
@@ -42,23 +71,55 @@ export default createComponent({
|
|
|
42
71
|
}
|
|
43
72
|
},
|
|
44
73
|
mounted: function mounted() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
74
|
+
var columnTotalWidth = 0;
|
|
75
|
+
this.headList.forEach(function (v, i) {
|
|
76
|
+
var dom = document.getElementById("tableHead" + i);
|
|
77
|
+
|
|
78
|
+
if (dom) {
|
|
79
|
+
columnTotalWidth += dom.clientWidth || 0;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
var box = document.getElementById("normalBoxID");
|
|
83
|
+
var boxWidth = 0;
|
|
84
|
+
|
|
85
|
+
if (box) {
|
|
86
|
+
boxWidth = box.clientWidth;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (this.fixedColumnLeft && this.fixedColumnLeft.length || this.fixedColumnRight && this.fixedColumnRight.length) {
|
|
90
|
+
// 当表格横向出现滚动时,给固定列加一个box-shadow
|
|
91
|
+
var fixedBoxRight = document.getElementById("fixedRightBoxID");
|
|
92
|
+
|
|
93
|
+
if (fixedBoxRight && columnTotalWidth > boxWidth) {
|
|
94
|
+
fixedBoxRight.classList.add("shadow");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (box) {
|
|
98
|
+
box.addEventListener("scroll", function (e) {
|
|
99
|
+
var fixedBoxLeft = document.getElementById("fixedLeftBoxID");
|
|
100
|
+
|
|
101
|
+
if (fixedBoxLeft) {
|
|
102
|
+
if (e && e.target && e.target.scrollLeft > 0) {
|
|
103
|
+
fixedBoxLeft.classList.add("shadow");
|
|
104
|
+
} else {
|
|
105
|
+
fixedBoxLeft.classList.remove("shadow");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (fixedBoxRight) {
|
|
110
|
+
if (e && e.target && e.target.scrollLeft + e.target.clientWidth >= columnTotalWidth - 1) {
|
|
111
|
+
fixedBoxRight.classList.remove("shadow");
|
|
112
|
+
} else {
|
|
113
|
+
fixedBoxRight.classList.add("shadow");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
57
118
|
} // 获取需固定列的实际宽度,用于设置绝对定位元素的宽度
|
|
58
119
|
|
|
59
120
|
|
|
60
|
-
var
|
|
61
|
-
if (v.
|
|
121
|
+
var fixedLeftIndexList = this.headList.map(function (v, i) {
|
|
122
|
+
if (v.fixedLeft) {
|
|
62
123
|
return "tableHead" + i;
|
|
63
124
|
} else {
|
|
64
125
|
return "";
|
|
@@ -67,44 +128,130 @@ export default createComponent({
|
|
|
67
128
|
return v !== "";
|
|
68
129
|
});
|
|
69
130
|
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
var fixedDom = document.getElementById("
|
|
131
|
+
if (fixedLeftIndexList.length > 0) {
|
|
132
|
+
fixedLeftIndexList.forEach(function (current, index) {
|
|
133
|
+
var fixedDom = document.getElementById("fixedHeadLeft" + index);
|
|
73
134
|
var normalDom = document.getElementById(current);
|
|
74
|
-
|
|
135
|
+
|
|
136
|
+
if (fixedDom && normalDom) {
|
|
137
|
+
fixedDom.style.width = normalDom.offsetWidth + "px";
|
|
138
|
+
}
|
|
75
139
|
}, 0);
|
|
140
|
+
} // 获取需固定列的实际宽度,用于设置绝对定位元素的宽度
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
var fixedRightIndexList = this.headList.map(function (v, i) {
|
|
144
|
+
if (v.fixedRight) {
|
|
145
|
+
return "tableHead" + i;
|
|
146
|
+
} else {
|
|
147
|
+
return "";
|
|
148
|
+
}
|
|
149
|
+
}).filter(function (v) {
|
|
150
|
+
return v !== "";
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
if (fixedRightIndexList.length > 0) {
|
|
154
|
+
fixedRightIndexList.forEach(function (current, index) {
|
|
155
|
+
var fixedDom = document.getElementById("fixedHeadRight" + index);
|
|
156
|
+
var normalDom = document.getElementById(current);
|
|
157
|
+
|
|
158
|
+
if (fixedDom && normalDom) {
|
|
159
|
+
fixedDom.style.width = normalDom.offsetWidth + "px";
|
|
160
|
+
}
|
|
161
|
+
}, 0); // 当存在右侧固定列,且列宽度不足以撑满容器时,将最后一列宽度拉长到填满
|
|
162
|
+
|
|
163
|
+
if (columnTotalWidth < boxWidth) {
|
|
164
|
+
var lastColumn = document.getElementById("tableHead" + (this.headList.length - 1));
|
|
165
|
+
|
|
166
|
+
if (lastColumn) {
|
|
167
|
+
lastColumn.classList.add("widen");
|
|
168
|
+
lastColumn.style.width = "unset";
|
|
169
|
+
lastColumn.style.flex = "1";
|
|
170
|
+
}
|
|
171
|
+
}
|
|
76
172
|
}
|
|
77
173
|
},
|
|
78
174
|
watch: {},
|
|
79
175
|
methods: {
|
|
80
176
|
genColumn: function genColumn(headObj, index, isFixed) {
|
|
81
177
|
var h = this.$createElement;
|
|
178
|
+
|
|
179
|
+
var _ref = this,
|
|
180
|
+
slots = _ref.slots,
|
|
181
|
+
hideTableHead = _ref.hideTableHead;
|
|
182
|
+
|
|
183
|
+
var headItemStyle = {
|
|
184
|
+
color: this.headColor,
|
|
185
|
+
background: this.headBackground
|
|
186
|
+
};
|
|
187
|
+
var dataStyle = {
|
|
188
|
+
color: this.dataColor,
|
|
189
|
+
background: this.dataBackground
|
|
190
|
+
};
|
|
191
|
+
var idName = "tableHead" + index;
|
|
192
|
+
|
|
193
|
+
if (isFixed === "left") {
|
|
194
|
+
idName = "fixedHeadLeft" + index;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (isFixed === "right") {
|
|
198
|
+
idName = "fixedHeadRight" + index;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
var headRender = slots("head" + headObj.id) || headObj.label;
|
|
202
|
+
|
|
203
|
+
if ((headObj.fixedLeft || headObj.fixedRight) && !isFixed) {
|
|
204
|
+
// 被固定列遮住的列不显示内容
|
|
205
|
+
headRender = "";
|
|
206
|
+
}
|
|
207
|
+
|
|
82
208
|
return h("div", {
|
|
83
209
|
"class": [bem(isFixed ? "fixed-head" : "head"), isFixed ? BORDER_SURROUND : BORDER_RIGHT],
|
|
84
210
|
"attrs": {
|
|
85
|
-
"id":
|
|
211
|
+
"id": idName
|
|
86
212
|
},
|
|
87
213
|
"style": isFixed ? "" : headObj.width ? "width:" + headObj.width + ";" : ""
|
|
88
214
|
}, [h("div", {
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
215
|
+
"directives": [{
|
|
216
|
+
name: "show",
|
|
217
|
+
value: !hideTableHead
|
|
218
|
+
}],
|
|
219
|
+
"class": [bem("head-item"), BORDER_TOP_BOTTOM],
|
|
220
|
+
"style": headItemStyle
|
|
221
|
+
}, [headRender]), this.dataList.map(function (data) {
|
|
222
|
+
var hide = (headObj.fixedLeft || headObj.fixedRight) && !isFixed;
|
|
223
|
+
|
|
224
|
+
if (hide) {
|
|
225
|
+
// 被固定列遮住的列不显示内容
|
|
226
|
+
return h("div", {
|
|
227
|
+
"class": [bem("table-data"), BORDER_BOTTOM],
|
|
228
|
+
"style": dataStyle
|
|
229
|
+
});
|
|
230
|
+
} else if (data[headObj.key] && data[headObj.key].id && slots("data" + data[headObj.key].id)) {
|
|
231
|
+
return slots("data" + data[headObj.key].id);
|
|
232
|
+
} else {
|
|
233
|
+
return h("div", {
|
|
234
|
+
"class": [bem("table-data"), BORDER_BOTTOM],
|
|
235
|
+
"style": dataStyle
|
|
236
|
+
}, [data[headObj.key]]);
|
|
237
|
+
}
|
|
94
238
|
}), this.hasSummary ? headObj.showSummary ? h("div", {
|
|
95
|
-
"class": [bem("head-item"), BORDER_BOTTOM]
|
|
239
|
+
"class": [bem("head-item"), BORDER_BOTTOM],
|
|
240
|
+
"style": headItemStyle
|
|
96
241
|
}, [this.dataList.reduce(function (prev, curr) {
|
|
97
242
|
return prev + curr[headObj.key];
|
|
98
243
|
}, 0)]) : h("div", {
|
|
99
|
-
"class": [bem("head-item"), BORDER_BOTTOM]
|
|
244
|
+
"class": [bem("head-item"), BORDER_BOTTOM],
|
|
245
|
+
"style": headItemStyle
|
|
100
246
|
}, [headObj.summaryLabel || ""]) : ""]);
|
|
101
247
|
}
|
|
102
248
|
},
|
|
103
249
|
render: function render(h) {
|
|
104
250
|
var _this = this;
|
|
105
251
|
|
|
252
|
+
var showFixed = this.dataList && this.dataList.length;
|
|
106
253
|
return h("div", {
|
|
107
|
-
"class": bem()
|
|
254
|
+
"class": bem(["", this.outline ? "" : "no-border"])
|
|
108
255
|
}, [h("div", {
|
|
109
256
|
"attrs": {
|
|
110
257
|
"id": "normalBoxID"
|
|
@@ -113,12 +260,27 @@ export default createComponent({
|
|
|
113
260
|
}, [this.resortHeadList.map(function (x, i) {
|
|
114
261
|
return _this.genColumn(x, i);
|
|
115
262
|
})]), h("div", {
|
|
263
|
+
"directives": [{
|
|
264
|
+
name: "show",
|
|
265
|
+
value: showFixed
|
|
266
|
+
}],
|
|
267
|
+
"attrs": {
|
|
268
|
+
"id": "fixedLeftBoxID"
|
|
269
|
+
},
|
|
270
|
+
"class": bem("fixed-left-box")
|
|
271
|
+
}, [this.fixedColumnLeft.map(function (x, i) {
|
|
272
|
+
return _this.genColumn(x, i, "left");
|
|
273
|
+
})]), h("div", {
|
|
274
|
+
"directives": [{
|
|
275
|
+
name: "show",
|
|
276
|
+
value: showFixed
|
|
277
|
+
}],
|
|
116
278
|
"attrs": {
|
|
117
|
-
"id": "
|
|
279
|
+
"id": "fixedRightBoxID"
|
|
118
280
|
},
|
|
119
|
-
"class": bem("fixed-box")
|
|
120
|
-
}, [this.
|
|
121
|
-
return _this.genColumn(x, i,
|
|
281
|
+
"class": bem("fixed-right-box")
|
|
282
|
+
}, [this.fixedColumnRight.map(function (x, i) {
|
|
283
|
+
return _this.genColumn(x, i, "right");
|
|
122
284
|
})])]);
|
|
123
285
|
}
|
|
124
286
|
});
|
package/es/table/index.less
CHANGED
|
@@ -1,26 +1,35 @@
|
|
|
1
1
|
@import '../style/var';
|
|
2
2
|
.zt-table {
|
|
3
3
|
position: relative;
|
|
4
|
+
border-radius: @table-border-radius;
|
|
5
|
+
scrollbar-width: none; /* firefox */
|
|
6
|
+
-ms-overflow-style: none; /* IE 10+ */
|
|
7
|
+
&::-webkit-scrollbar {
|
|
8
|
+
display: none;
|
|
9
|
+
width: 0;
|
|
10
|
+
height: 0;
|
|
11
|
+
}
|
|
4
12
|
&__normal-box {
|
|
5
13
|
display: flex;
|
|
6
14
|
overflow-x: scroll;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
background-color: unset;
|
|
10
|
-
height: 4px;
|
|
11
|
-
}
|
|
12
|
-
&::-webkit-scrollbar-thumb{
|
|
13
|
-
background-color: rgba(0,0,0,.1);
|
|
14
|
-
}
|
|
15
|
+
position: relative;
|
|
16
|
+
|
|
15
17
|
}
|
|
16
|
-
&__fixed-box {
|
|
18
|
+
&__fixed-left-box {
|
|
17
19
|
display: flex;
|
|
18
20
|
position: absolute;
|
|
19
21
|
top: 0;
|
|
20
|
-
left:
|
|
22
|
+
left: -1px;
|
|
21
23
|
z-index: 2;
|
|
22
24
|
}
|
|
23
|
-
&__fixed-box
|
|
25
|
+
&__fixed-right-box {
|
|
26
|
+
display: flex;
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 0;
|
|
29
|
+
right: -1px;
|
|
30
|
+
z-index: 2;
|
|
31
|
+
}
|
|
32
|
+
&__fixed-left-box.shadow::after {
|
|
24
33
|
content: "";
|
|
25
34
|
position: absolute;
|
|
26
35
|
top: 0;
|
|
@@ -30,6 +39,16 @@
|
|
|
30
39
|
opacity: 0.06;
|
|
31
40
|
background-image: linear-gradient(90deg, #000000 0%, rgba(0,0,0,0.00) 100%);
|
|
32
41
|
}
|
|
42
|
+
&__fixed-right-box.shadow::before {
|
|
43
|
+
content: "";
|
|
44
|
+
position: absolute;
|
|
45
|
+
top: 0;
|
|
46
|
+
left: -10px;
|
|
47
|
+
width: 10px;
|
|
48
|
+
height: 100%;
|
|
49
|
+
opacity: 0.06;
|
|
50
|
+
background-image: linear-gradient(90deg, #000000 0%, rgba(0,0,0,0.00) 100%);
|
|
51
|
+
}
|
|
33
52
|
&__head {
|
|
34
53
|
flex-shrink: 0;
|
|
35
54
|
}
|
|
@@ -37,17 +56,18 @@
|
|
|
37
56
|
height: @table-head-height;
|
|
38
57
|
font-weight: 600;
|
|
39
58
|
font-size: @table-head-font-size;
|
|
40
|
-
color: @table-head-color;
|
|
41
59
|
text-align: center;
|
|
42
60
|
line-height: @table-head-height;
|
|
43
|
-
background: @table-head-background;
|
|
44
61
|
}
|
|
45
62
|
&__table-data {
|
|
46
63
|
height: @table-row-height;
|
|
47
64
|
font-size: @table-row-font-size;
|
|
48
|
-
color: @table-row-color;
|
|
49
65
|
text-align: center;
|
|
50
66
|
line-height: @table-row-height;
|
|
51
|
-
|
|
67
|
+
}
|
|
68
|
+
&.zt-table--no-border {
|
|
69
|
+
.zt-table__normal-box::after, .zt-table__fixed-head::after, .zt-table__head::after, .zt-table__head-item::after, .zt-table__table-data::after {
|
|
70
|
+
border: none;
|
|
71
|
+
}
|
|
52
72
|
}
|
|
53
73
|
}
|