@kengic/uni 0.3.2-beta.10
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/README.md +1 -0
- package/dist/index.css +1 -0
- package/dist/kengic-uni.js +5 -0
- package/dist/src/consts/i18n/en.d.ts +45 -0
- package/dist/src/consts/i18n/index.d.ts +90 -0
- package/dist/src/consts/i18n/zh_CN.d.ts +45 -0
- package/dist/src/consts/index.d.ts +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/kg.util.d.ts +5 -0
- package/dist/uni-ui/index.ts +11 -0
- package/dist/uni-ui/uni-badge/uni-badge.vue +253 -0
- package/dist/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +41 -0
- package/dist/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +121 -0
- package/dist/uni-ui/uni-calendar/calendar.js +546 -0
- package/dist/uni-ui/uni-calendar/i18n/en.json +12 -0
- package/dist/uni-ui/uni-calendar/i18n/index.js +8 -0
- package/dist/uni-ui/uni-calendar/i18n/zh-Hans.json +12 -0
- package/dist/uni-ui/uni-calendar/i18n/zh-Hant.json +12 -0
- package/dist/uni-ui/uni-calendar/uni-calendar-item.vue +187 -0
- package/dist/uni-ui/uni-calendar/uni-calendar.vue +566 -0
- package/dist/uni-ui/uni-calendar/util.js +360 -0
- package/dist/uni-ui/uni-card/uni-card.vue +281 -0
- package/dist/uni-ui/uni-col/uni-col.vue +317 -0
- package/dist/uni-ui/uni-collapse/uni-collapse.vue +147 -0
- package/dist/uni-ui/uni-collapse-item/uni-collapse-item.vue +402 -0
- package/dist/uni-ui/uni-combox/uni-combox.vue +294 -0
- package/dist/uni-ui/uni-countdown/i18n/en.json +6 -0
- package/dist/uni-ui/uni-countdown/i18n/index.js +8 -0
- package/dist/uni-ui/uni-countdown/i18n/zh-Hans.json +6 -0
- package/dist/uni-ui/uni-countdown/i18n/zh-Hant.json +6 -0
- package/dist/uni-ui/uni-countdown/uni-countdown.vue +267 -0
- package/dist/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +821 -0
- package/dist/uni-ui/uni-data-picker/keypress.js +45 -0
- package/dist/uni-ui/uni-data-picker/uni-data-picker.vue +551 -0
- package/dist/uni-ui/uni-data-pickerview/uni-data-picker.js +622 -0
- package/dist/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +323 -0
- package/dist/uni-ui/uni-data-select/uni-data-select.vue +517 -0
- package/dist/uni-ui/uni-dateformat/date-format.js +200 -0
- package/dist/uni-ui/uni-dateformat/uni-dateformat.vue +88 -0
- package/dist/uni-ui/uni-datetime-picker/calendar-item.vue +177 -0
- package/dist/uni-ui/uni-datetime-picker/calendar.vue +928 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/en.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/index.js +8 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +22 -0
- package/dist/uni-ui/uni-datetime-picker/time-picker.vue +934 -0
- package/dist/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1026 -0
- package/dist/uni-ui/uni-datetime-picker/util.js +403 -0
- package/dist/uni-ui/uni-drawer/keypress.js +45 -0
- package/dist/uni-ui/uni-drawer/uni-drawer.vue +181 -0
- package/dist/uni-ui/uni-easyinput/common.js +56 -0
- package/dist/uni-ui/uni-easyinput/uni-easyinput.vue +660 -0
- package/dist/uni-ui/uni-fab/uni-fab.vue +491 -0
- package/dist/uni-ui/uni-fav/i18n/en.json +4 -0
- package/dist/uni-ui/uni-fav/i18n/index.js +8 -0
- package/dist/uni-ui/uni-fav/i18n/zh-Hans.json +4 -0
- package/dist/uni-ui/uni-fav/i18n/zh-Hant.json +4 -0
- package/dist/uni-ui/uni-fav/uni-fav.vue +161 -0
- package/dist/uni-ui/uni-file-picker/choose-and-upload-file.js +224 -0
- package/dist/uni-ui/uni-file-picker/uni-file-picker.vue +667 -0
- package/dist/uni-ui/uni-file-picker/upload-file.vue +325 -0
- package/dist/uni-ui/uni-file-picker/upload-image.vue +292 -0
- package/dist/uni-ui/uni-file-picker/utils.js +109 -0
- package/dist/uni-ui/uni-forms/uni-forms.vue +398 -0
- package/dist/uni-ui/uni-forms/utils.js +293 -0
- package/dist/uni-ui/uni-forms/validate.js +486 -0
- package/dist/uni-ui/uni-forms-item/uni-forms-item.vue +601 -0
- package/dist/uni-ui/uni-goods-nav/i18n/en.json +6 -0
- package/dist/uni-ui/uni-goods-nav/i18n/index.js +8 -0
- package/dist/uni-ui/uni-goods-nav/i18n/zh-Hans.json +6 -0
- package/dist/uni-ui/uni-goods-nav/i18n/zh-Hant.json +6 -0
- package/dist/uni-ui/uni-goods-nav/uni-goods-nav.vue +229 -0
- package/dist/uni-ui/uni-grid/uni-grid.vue +143 -0
- package/dist/uni-ui/uni-grid-item/uni-grid-item.vue +129 -0
- package/dist/uni-ui/uni-group/uni-group.vue +134 -0
- package/dist/uni-ui/uni-icons/icons.js +1169 -0
- package/dist/uni-ui/uni-icons/uni-icons.vue +96 -0
- package/dist/uni-ui/uni-icons/uniicons.css +663 -0
- package/dist/uni-ui/uni-icons/uniicons.ttf +0 -0
- package/dist/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +144 -0
- package/dist/uni-ui/uni-indexed-list/uni-indexed-list.vue +367 -0
- package/dist/uni-ui/uni-link/uni-link.vue +128 -0
- package/dist/uni-ui/uni-list/uni-list.vue +123 -0
- package/dist/uni-ui/uni-list/uni-refresh.vue +65 -0
- package/dist/uni-ui/uni-list/uni-refresh.wxs +87 -0
- package/dist/uni-ui/uni-list-ad/uni-list-ad.vue +107 -0
- package/dist/uni-ui/uni-list-chat/uni-list-chat.scss +58 -0
- package/dist/uni-ui/uni-list-chat/uni-list-chat.vue +593 -0
- package/dist/uni-ui/uni-list-item/uni-list-item.vue +534 -0
- package/dist/uni-ui/uni-load-more/i18n/en.json +5 -0
- package/dist/uni-ui/uni-load-more/i18n/index.js +8 -0
- package/dist/uni-ui/uni-load-more/i18n/zh-Hans.json +5 -0
- package/dist/uni-ui/uni-load-more/i18n/zh-Hant.json +5 -0
- package/dist/uni-ui/uni-load-more/uni-load-more.vue +399 -0
- package/dist/uni-ui/uni-nav-bar/uni-nav-bar.vue +357 -0
- package/dist/uni-ui/uni-nav-bar/uni-status-bar.vue +24 -0
- package/dist/uni-ui/uni-notice-bar/uni-notice-bar.vue +426 -0
- package/dist/uni-ui/uni-number-box/uni-number-box.vue +221 -0
- package/dist/uni-ui/uni-pagination/i18n/en.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/es.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/fr.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/index.js +12 -0
- package/dist/uni-ui/uni-pagination/i18n/zh-Hans.json +5 -0
- package/dist/uni-ui/uni-pagination/i18n/zh-Hant.json +5 -0
- package/dist/uni-ui/uni-pagination/uni-pagination.vue +465 -0
- package/dist/uni-ui/uni-popup/i18n/en.json +7 -0
- package/dist/uni-ui/uni-popup/i18n/index.js +9 -0
- package/dist/uni-ui/uni-popup/i18n/zh-Hans.json +7 -0
- package/dist/uni-ui/uni-popup/i18n/zh-Hant.json +7 -0
- package/dist/uni-ui/uni-popup/keypress.js +45 -0
- package/dist/uni-ui/uni-popup/popup.js +23 -0
- package/dist/uni-ui/uni-popup/uni-popup.vue +464 -0
- package/dist/uni-ui/uni-popup-dialog/keypress.js +45 -0
- package/dist/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +275 -0
- package/dist/uni-ui/uni-popup-message/uni-popup-message.vue +143 -0
- package/dist/uni-ui/uni-popup-share/uni-popup-share.vue +187 -0
- package/dist/uni-ui/uni-rate/uni-rate.vue +365 -0
- package/dist/uni-ui/uni-row/uni-row.vue +190 -0
- package/dist/uni-ui/uni-scss/changelog.md +8 -0
- package/dist/uni-ui/uni-scss/index.scss +1 -0
- package/dist/uni-ui/uni-scss/package.json +82 -0
- package/dist/uni-ui/uni-scss/readme.md +4 -0
- package/dist/uni-ui/uni-scss/styles/index.scss +7 -0
- package/dist/uni-ui/uni-scss/styles/setting/_border.scss +3 -0
- package/dist/uni-ui/uni-scss/styles/setting/_color.scss +66 -0
- package/dist/uni-ui/uni-scss/styles/setting/_radius.scss +55 -0
- package/dist/uni-ui/uni-scss/styles/setting/_space.scss +56 -0
- package/dist/uni-ui/uni-scss/styles/setting/_styles.scss +167 -0
- package/dist/uni-ui/uni-scss/styles/setting/_text.scss +24 -0
- package/dist/uni-ui/uni-scss/styles/setting/_variables.scss +146 -0
- package/dist/uni-ui/uni-scss/styles/tools/functions.scss +19 -0
- package/dist/uni-ui/uni-scss/theme.scss +31 -0
- package/dist/uni-ui/uni-scss/variables.scss +62 -0
- package/dist/uni-ui/uni-search-bar/i18n/en.json +4 -0
- package/dist/uni-ui/uni-search-bar/i18n/index.js +8 -0
- package/dist/uni-ui/uni-search-bar/i18n/zh-Hans.json +4 -0
- package/dist/uni-ui/uni-search-bar/i18n/zh-Hant.json +4 -0
- package/dist/uni-ui/uni-search-bar/uni-search-bar.vue +298 -0
- package/dist/uni-ui/uni-section/uni-section.vue +167 -0
- package/dist/uni-ui/uni-segmented-control/uni-segmented-control.vue +145 -0
- package/dist/uni-ui/uni-steps/uni-steps.vue +269 -0
- package/dist/uni-ui/uni-swipe-action/uni-swipe-action.vue +60 -0
- package/dist/uni-ui/uni-swipe-action-item/bindingx.js +302 -0
- package/dist/uni-ui/uni-swipe-action-item/isPC.js +12 -0
- package/dist/uni-ui/uni-swipe-action-item/mpalipay.js +195 -0
- package/dist/uni-ui/uni-swipe-action-item/mpother.js +260 -0
- package/dist/uni-ui/uni-swipe-action-item/mpwxs.js +84 -0
- package/dist/uni-ui/uni-swipe-action-item/render.js +270 -0
- package/dist/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +347 -0
- package/dist/uni-ui/uni-swipe-action-item/wx.wxs +341 -0
- package/dist/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +218 -0
- package/dist/uni-ui/uni-table/uni-table.vue +455 -0
- package/dist/uni-ui/uni-tag/uni-tag.vue +252 -0
- package/dist/uni-ui/uni-tbody/uni-tbody.vue +29 -0
- package/dist/uni-ui/uni-td/uni-td.vue +90 -0
- package/dist/uni-ui/uni-th/filter-dropdown.vue +511 -0
- package/dist/uni-ui/uni-th/uni-th.vue +285 -0
- package/dist/uni-ui/uni-thead/uni-thead.vue +129 -0
- package/dist/uni-ui/uni-title/uni-title.vue +171 -0
- package/dist/uni-ui/uni-tooltip/uni-tooltip.vue +68 -0
- package/dist/uni-ui/uni-tr/table-checkbox.vue +179 -0
- package/dist/uni-ui/uni-tr/uni-tr.vue +171 -0
- package/dist/uni-ui/uni-transition/createAnimation.js +131 -0
- package/dist/uni-ui/uni-transition/uni-transition.vue +281 -0
- package/package.json +90 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef H5 -->
|
|
3
|
+
<th :rowspan="rowspan" :colspan="colspan" class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }">
|
|
4
|
+
<view class="uni-table-th-row">
|
|
5
|
+
<view class="uni-table-th-content" :style="{ 'justify-content': contentAlign }" @click="sort">
|
|
6
|
+
<slot></slot>
|
|
7
|
+
<view v-if="sortable" class="arrow-box">
|
|
8
|
+
<text class="arrow up" :class="{ active: ascending }" @click.stop="ascendingFn"></text>
|
|
9
|
+
<text class="arrow down" :class="{ active: descending }" @click.stop="descendingFn"></text>
|
|
10
|
+
</view>
|
|
11
|
+
</view>
|
|
12
|
+
<dropdown v-if="filterType || filterData.length" :filterDefaultValue="filterDefaultValue" :filterData="filterData" :filterType="filterType" @change="ondropdown"></dropdown>
|
|
13
|
+
</view>
|
|
14
|
+
</th>
|
|
15
|
+
<!-- #endif -->
|
|
16
|
+
<!-- #ifndef H5 -->
|
|
17
|
+
<view class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }"><slot></slot></view>
|
|
18
|
+
<!-- #endif -->
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
// #ifdef H5
|
|
23
|
+
import dropdown from './filter-dropdown.vue'
|
|
24
|
+
// #endif
|
|
25
|
+
/**
|
|
26
|
+
* Th 表头
|
|
27
|
+
* @description 表格内的表头单元格组件
|
|
28
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=3270
|
|
29
|
+
* @property {Number | String} width 单元格宽度(支持纯数字、携带单位px或rpx)
|
|
30
|
+
* @property {Boolean} sortable 是否启用排序
|
|
31
|
+
* @property {Number} align = [left|center|right] 单元格对齐方式
|
|
32
|
+
* @value left 单元格文字左侧对齐
|
|
33
|
+
* @value center 单元格文字居中
|
|
34
|
+
* @value right 单元格文字右侧对齐
|
|
35
|
+
* @property {Array} filterData 筛选数据
|
|
36
|
+
* @property {String} filterType [search|select] 筛选类型
|
|
37
|
+
* @value search 关键字搜素
|
|
38
|
+
* @value select 条件选择
|
|
39
|
+
* @event {Function} sort-change 排序触发事件
|
|
40
|
+
*/
|
|
41
|
+
export default {
|
|
42
|
+
name: 'uniTh',
|
|
43
|
+
options: {
|
|
44
|
+
virtualHost: true
|
|
45
|
+
},
|
|
46
|
+
components: {
|
|
47
|
+
// #ifdef H5
|
|
48
|
+
dropdown
|
|
49
|
+
// #endif
|
|
50
|
+
},
|
|
51
|
+
emits:['sort-change','filter-change'],
|
|
52
|
+
props: {
|
|
53
|
+
width: {
|
|
54
|
+
type: [String, Number],
|
|
55
|
+
default: ''
|
|
56
|
+
},
|
|
57
|
+
align: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: 'left'
|
|
60
|
+
},
|
|
61
|
+
rowspan: {
|
|
62
|
+
type: [Number, String],
|
|
63
|
+
default: 1
|
|
64
|
+
},
|
|
65
|
+
colspan: {
|
|
66
|
+
type: [Number, String],
|
|
67
|
+
default: 1
|
|
68
|
+
},
|
|
69
|
+
sortable: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
filterType: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: ""
|
|
76
|
+
},
|
|
77
|
+
filterData: {
|
|
78
|
+
type: Array,
|
|
79
|
+
default () {
|
|
80
|
+
return []
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
filterDefaultValue: {
|
|
84
|
+
type: [Array,String],
|
|
85
|
+
default () {
|
|
86
|
+
return ""
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
data() {
|
|
91
|
+
return {
|
|
92
|
+
border: false,
|
|
93
|
+
ascending: false,
|
|
94
|
+
descending: false
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
computed: {
|
|
98
|
+
// 根据props中的width属性 自动匹配当前th的宽度(px)
|
|
99
|
+
customWidth(){
|
|
100
|
+
if(typeof this.width === 'number'){
|
|
101
|
+
return this.width
|
|
102
|
+
} else if(typeof this.width === 'string') {
|
|
103
|
+
let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g)
|
|
104
|
+
let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g)
|
|
105
|
+
let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g)
|
|
106
|
+
if (this.width.match(regexHaveUnitPx) !== null) { // 携带了 px
|
|
107
|
+
return this.width.replace('px', '')
|
|
108
|
+
} else if (this.width.match(regexHaveUnitRpx) !== null) { // 携带了 rpx
|
|
109
|
+
let numberRpx = Number(this.width.replace('rpx', ''))
|
|
110
|
+
let widthCoe = uni.getSystemInfoSync().screenWidth / 750
|
|
111
|
+
return Math.round(numberRpx * widthCoe)
|
|
112
|
+
} else if (this.width.match(regexHaveNotUnit) !== null) { // 未携带 rpx或px 的纯数字 String
|
|
113
|
+
return this.width
|
|
114
|
+
} else { // 不符合格式
|
|
115
|
+
return ''
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
return ''
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
contentAlign() {
|
|
122
|
+
let align = 'left'
|
|
123
|
+
switch (this.align) {
|
|
124
|
+
case 'left':
|
|
125
|
+
align = 'flex-start'
|
|
126
|
+
break
|
|
127
|
+
case 'center':
|
|
128
|
+
align = 'center'
|
|
129
|
+
break
|
|
130
|
+
case 'right':
|
|
131
|
+
align = 'flex-end'
|
|
132
|
+
break
|
|
133
|
+
}
|
|
134
|
+
return align
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
created() {
|
|
138
|
+
this.root = this.getTable('uniTable')
|
|
139
|
+
this.rootTr = this.getTable('uniTr')
|
|
140
|
+
this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140)
|
|
141
|
+
this.border = this.root.border
|
|
142
|
+
this.root.thChildren.push(this)
|
|
143
|
+
},
|
|
144
|
+
methods: {
|
|
145
|
+
sort() {
|
|
146
|
+
if (!this.sortable) return
|
|
147
|
+
this.clearOther()
|
|
148
|
+
if (!this.ascending && !this.descending) {
|
|
149
|
+
this.ascending = true
|
|
150
|
+
this.$emit('sort-change', { order: 'ascending' })
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
if (this.ascending && !this.descending) {
|
|
154
|
+
this.ascending = false
|
|
155
|
+
this.descending = true
|
|
156
|
+
this.$emit('sort-change', { order: 'descending' })
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (!this.ascending && this.descending) {
|
|
161
|
+
this.ascending = false
|
|
162
|
+
this.descending = false
|
|
163
|
+
this.$emit('sort-change', { order: null })
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
ascendingFn() {
|
|
167
|
+
this.clearOther()
|
|
168
|
+
this.ascending = !this.ascending
|
|
169
|
+
this.descending = false
|
|
170
|
+
this.$emit('sort-change', { order: this.ascending ? 'ascending' : null })
|
|
171
|
+
},
|
|
172
|
+
descendingFn() {
|
|
173
|
+
this.clearOther()
|
|
174
|
+
this.descending = !this.descending
|
|
175
|
+
this.ascending = false
|
|
176
|
+
this.$emit('sort-change', { order: this.descending ? 'descending' : null })
|
|
177
|
+
},
|
|
178
|
+
clearOther() {
|
|
179
|
+
this.root.thChildren.map(item => {
|
|
180
|
+
if (item !== this) {
|
|
181
|
+
item.ascending = false
|
|
182
|
+
item.descending = false
|
|
183
|
+
}
|
|
184
|
+
return item
|
|
185
|
+
})
|
|
186
|
+
},
|
|
187
|
+
ondropdown(e) {
|
|
188
|
+
this.$emit("filter-change", e)
|
|
189
|
+
},
|
|
190
|
+
/**
|
|
191
|
+
* 获取父元素实例
|
|
192
|
+
*/
|
|
193
|
+
getTable(name) {
|
|
194
|
+
let parent = this.$parent
|
|
195
|
+
let parentName = parent.$options.name
|
|
196
|
+
while (parentName !== name) {
|
|
197
|
+
parent = parent.$parent
|
|
198
|
+
if (!parent) return false
|
|
199
|
+
parentName = parent.$options.name
|
|
200
|
+
}
|
|
201
|
+
return parent
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
<style lang="scss">
|
|
208
|
+
$border-color: #ebeef5;
|
|
209
|
+
$uni-primary: #007aff !default;
|
|
210
|
+
|
|
211
|
+
.uni-table-th {
|
|
212
|
+
padding: 12px 10px;
|
|
213
|
+
/* #ifndef APP-NVUE */
|
|
214
|
+
display: table-cell;
|
|
215
|
+
box-sizing: border-box;
|
|
216
|
+
/* #endif */
|
|
217
|
+
font-size: 14px;
|
|
218
|
+
font-weight: bold;
|
|
219
|
+
color: #909399;
|
|
220
|
+
border-bottom: 1px $border-color solid;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.uni-table-th-row {
|
|
224
|
+
/* #ifndef APP-NVUE */
|
|
225
|
+
display: flex;
|
|
226
|
+
/* #endif */
|
|
227
|
+
flex-direction: row;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.table--border {
|
|
231
|
+
border-right: 1px $border-color solid;
|
|
232
|
+
}
|
|
233
|
+
.uni-table-th-content {
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
flex: 1;
|
|
237
|
+
}
|
|
238
|
+
.arrow-box {
|
|
239
|
+
}
|
|
240
|
+
.arrow {
|
|
241
|
+
display: block;
|
|
242
|
+
position: relative;
|
|
243
|
+
width: 10px;
|
|
244
|
+
height: 8px;
|
|
245
|
+
// border: 1px red solid;
|
|
246
|
+
left: 5px;
|
|
247
|
+
overflow: hidden;
|
|
248
|
+
cursor: pointer;
|
|
249
|
+
}
|
|
250
|
+
.down {
|
|
251
|
+
top: 3px;
|
|
252
|
+
::after {
|
|
253
|
+
content: '';
|
|
254
|
+
width: 8px;
|
|
255
|
+
height: 8px;
|
|
256
|
+
position: absolute;
|
|
257
|
+
left: 2px;
|
|
258
|
+
top: -5px;
|
|
259
|
+
transform: rotate(45deg);
|
|
260
|
+
background-color: #ccc;
|
|
261
|
+
}
|
|
262
|
+
&.active {
|
|
263
|
+
::after {
|
|
264
|
+
background-color: $uni-primary;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
.up {
|
|
269
|
+
::after {
|
|
270
|
+
content: '';
|
|
271
|
+
width: 8px;
|
|
272
|
+
height: 8px;
|
|
273
|
+
position: absolute;
|
|
274
|
+
left: 2px;
|
|
275
|
+
top: 5px;
|
|
276
|
+
transform: rotate(45deg);
|
|
277
|
+
background-color: #ccc;
|
|
278
|
+
}
|
|
279
|
+
&.active {
|
|
280
|
+
::after {
|
|
281
|
+
background-color: $uni-primary;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
</style>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef H5 -->
|
|
3
|
+
<thead class="uni-table-thead">
|
|
4
|
+
<tr class="uni-table-tr">
|
|
5
|
+
<th :rowspan="rowspan" colspan="1" class="checkbox" :class="{ 'tr-table--border': border }">
|
|
6
|
+
<table-checkbox :indeterminate="indeterminate" :checked="checked" @checkboxSelected="checkboxSelected"></table-checkbox>
|
|
7
|
+
</th>
|
|
8
|
+
</tr>
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</thead>
|
|
11
|
+
<!-- #endif -->
|
|
12
|
+
<!-- #ifndef H5 -->
|
|
13
|
+
<view class="uni-table-thead"><slot></slot></view>
|
|
14
|
+
<!-- #endif -->
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import tableCheckbox from '../uni-tr/table-checkbox.vue'
|
|
19
|
+
export default {
|
|
20
|
+
name: 'uniThead',
|
|
21
|
+
components: {
|
|
22
|
+
tableCheckbox
|
|
23
|
+
},
|
|
24
|
+
options: {
|
|
25
|
+
virtualHost: true
|
|
26
|
+
},
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
border: false,
|
|
30
|
+
selection: false,
|
|
31
|
+
rowspan: 1,
|
|
32
|
+
indeterminate: false,
|
|
33
|
+
checked: false
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
created() {
|
|
37
|
+
this.root = this.getTable()
|
|
38
|
+
// #ifdef H5
|
|
39
|
+
this.root.theadChildren = this
|
|
40
|
+
// #endif
|
|
41
|
+
this.border = this.root.border
|
|
42
|
+
this.selection = this.root.type
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
init(self) {
|
|
46
|
+
this.rowspan++
|
|
47
|
+
},
|
|
48
|
+
checkboxSelected(e) {
|
|
49
|
+
this.indeterminate = false
|
|
50
|
+
const backIndexData = this.root.backIndexData
|
|
51
|
+
const data = this.root.trChildren.filter(v => !v.disabled && v.keyValue)
|
|
52
|
+
if (backIndexData.length === data.length) {
|
|
53
|
+
this.checked = false
|
|
54
|
+
this.root.clearSelection()
|
|
55
|
+
} else {
|
|
56
|
+
this.checked = true
|
|
57
|
+
this.root.selectionAll()
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* 获取父元素实例
|
|
62
|
+
*/
|
|
63
|
+
getTable(name = 'uniTable') {
|
|
64
|
+
let parent = this.$parent
|
|
65
|
+
let parentName = parent.$options.name
|
|
66
|
+
while (parentName !== name) {
|
|
67
|
+
parent = parent.$parent
|
|
68
|
+
if (!parent) return false
|
|
69
|
+
parentName = parent.$options.name
|
|
70
|
+
}
|
|
71
|
+
return parent
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style lang="scss">
|
|
78
|
+
$border-color: #ebeef5;
|
|
79
|
+
|
|
80
|
+
.uni-table-thead {
|
|
81
|
+
display: table-header-group;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.uni-table-tr {
|
|
85
|
+
/* #ifndef APP-NVUE */
|
|
86
|
+
display: table-row;
|
|
87
|
+
transition: all 0.3s;
|
|
88
|
+
box-sizing: border-box;
|
|
89
|
+
/* #endif */
|
|
90
|
+
border: 1px red solid;
|
|
91
|
+
background-color: #fafafa;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.checkbox {
|
|
95
|
+
padding: 0 8px;
|
|
96
|
+
width: 26px;
|
|
97
|
+
padding-left: 12px;
|
|
98
|
+
/* #ifndef APP-NVUE */
|
|
99
|
+
display: table-cell;
|
|
100
|
+
vertical-align: middle;
|
|
101
|
+
/* #endif */
|
|
102
|
+
color: #333;
|
|
103
|
+
font-weight: 500;
|
|
104
|
+
border-bottom: 1px $border-color solid;
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
// text-align: center;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.tr-table--border {
|
|
110
|
+
border-right: 1px $border-color solid;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* #ifndef APP-NVUE */
|
|
114
|
+
.uni-table-tr {
|
|
115
|
+
::v-deep .uni-table-th {
|
|
116
|
+
&.table--border:last-child {
|
|
117
|
+
// border-right: none;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
::v-deep .uni-table-td {
|
|
122
|
+
&.table--border:last-child {
|
|
123
|
+
// border-right: none;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* #endif */
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-title__box" :style="{'align-items':textAlign}">
|
|
3
|
+
<text class="uni-title__base" :class="['uni-'+type]" :style="{'color':color}">{{title}}</text>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
/**
|
|
9
|
+
* Title 标题
|
|
10
|
+
* @description 标题,通常用于记录页面标题,使用当前组件,uni-app 如果开启统计,将会自动统计页面标题
|
|
11
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=1066
|
|
12
|
+
* @property {String} type = [h1|h2|h3|h4|h5] 标题类型
|
|
13
|
+
* @value h1 一级标题
|
|
14
|
+
* @value h2 二级标题
|
|
15
|
+
* @value h3 三级标题
|
|
16
|
+
* @value h4 四级标题
|
|
17
|
+
* @value h5 五级标题
|
|
18
|
+
* @property {String} title 标题内容
|
|
19
|
+
* @property {String} align = [left|center|right] 对齐方式
|
|
20
|
+
* @value left 做对齐
|
|
21
|
+
* @value center 居中对齐
|
|
22
|
+
* @value right 右对齐
|
|
23
|
+
* @property {String} color 字体颜色
|
|
24
|
+
* @property {Boolean} stat = [true|false] 是否开启统计功能呢,如不填写type值,默认为开启,填写 type 属性,默认为关闭
|
|
25
|
+
*/
|
|
26
|
+
export default {
|
|
27
|
+
name:"UniTitle",
|
|
28
|
+
props: {
|
|
29
|
+
type: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ''
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
37
|
+
align: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'left'
|
|
40
|
+
},
|
|
41
|
+
color: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '#333333'
|
|
44
|
+
},
|
|
45
|
+
stat: {
|
|
46
|
+
type: [Boolean, String],
|
|
47
|
+
default: ''
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
computed: {
|
|
56
|
+
textAlign() {
|
|
57
|
+
let align = 'center';
|
|
58
|
+
switch (this.align) {
|
|
59
|
+
case 'left':
|
|
60
|
+
align = 'flex-start'
|
|
61
|
+
break;
|
|
62
|
+
case 'center':
|
|
63
|
+
align = 'center'
|
|
64
|
+
break;
|
|
65
|
+
case 'right':
|
|
66
|
+
align = 'flex-end'
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
return align
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
watch: {
|
|
73
|
+
title(newVal) {
|
|
74
|
+
if (this.isOpenStat()) {
|
|
75
|
+
// 上报数据
|
|
76
|
+
if (uni.report) {
|
|
77
|
+
uni.report('title', this.title)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
mounted() {
|
|
83
|
+
if (this.isOpenStat()) {
|
|
84
|
+
// 上报数据
|
|
85
|
+
if (uni.report) {
|
|
86
|
+
uni.report('title', this.title)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
methods: {
|
|
91
|
+
isOpenStat() {
|
|
92
|
+
if (this.stat === '') {
|
|
93
|
+
this.isStat = false
|
|
94
|
+
}
|
|
95
|
+
let stat_type = (typeof(this.stat) === 'boolean' && this.stat) || (typeof(this.stat) === 'string' && this.stat !==
|
|
96
|
+
'')
|
|
97
|
+
if (this.type === "") {
|
|
98
|
+
this.isStat = true
|
|
99
|
+
if (this.stat.toString() === 'false') {
|
|
100
|
+
this.isStat = false
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (this.type !== '') {
|
|
105
|
+
this.isStat = true
|
|
106
|
+
if (stat_type) {
|
|
107
|
+
this.isStat = true
|
|
108
|
+
} else {
|
|
109
|
+
this.isStat = false
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return this.isStat
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<style>
|
|
119
|
+
/* .uni-title {
|
|
120
|
+
|
|
121
|
+
} */
|
|
122
|
+
.uni-title__box {
|
|
123
|
+
/* #ifndef APP-NVUE */
|
|
124
|
+
display: flex;
|
|
125
|
+
/* #endif */
|
|
126
|
+
flex-direction: column;
|
|
127
|
+
align-items: flex-start;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
padding: 8px 0;
|
|
130
|
+
flex: 1;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.uni-title__base {
|
|
134
|
+
font-size: 15px;
|
|
135
|
+
color: #333;
|
|
136
|
+
font-weight: 500;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.uni-h1 {
|
|
140
|
+
font-size: 20px;
|
|
141
|
+
color: #333;
|
|
142
|
+
font-weight: bold;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.uni-h2 {
|
|
146
|
+
font-size: 18px;
|
|
147
|
+
color: #333;
|
|
148
|
+
font-weight: bold;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.uni-h3 {
|
|
152
|
+
font-size: 16px;
|
|
153
|
+
color: #333;
|
|
154
|
+
font-weight: bold;
|
|
155
|
+
/* font-weight: 400; */
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.uni-h4 {
|
|
159
|
+
font-size: 14px;
|
|
160
|
+
color: #333;
|
|
161
|
+
font-weight: bold;
|
|
162
|
+
/* font-weight: 300; */
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.uni-h5 {
|
|
166
|
+
font-size: 12px;
|
|
167
|
+
color: #333;
|
|
168
|
+
font-weight: bold;
|
|
169
|
+
/* font-weight: 200; */
|
|
170
|
+
}
|
|
171
|
+
</style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-tooltip">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<view v-if="content || $slots.content" class="uni-tooltip-popup">
|
|
5
|
+
<slot name="content">
|
|
6
|
+
{{content}}
|
|
7
|
+
</slot>
|
|
8
|
+
</view>
|
|
9
|
+
</view>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
/**
|
|
15
|
+
* Tooltip 提示文字
|
|
16
|
+
* @description 常用于展示鼠标 hover 时的提示信息。
|
|
17
|
+
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-tooltip
|
|
18
|
+
* @property {String} content 弹出层显示的内容
|
|
19
|
+
* @property {String} placement出现位置, 目前只支持 left
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: "uni-tooltip",
|
|
25
|
+
data() {
|
|
26
|
+
return {
|
|
27
|
+
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
content: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: ''
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
placement: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'bottom'
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style>
|
|
45
|
+
.uni-tooltip {
|
|
46
|
+
position: relative;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.uni-tooltip-popup {
|
|
51
|
+
z-index: 1;
|
|
52
|
+
display: none;
|
|
53
|
+
position: absolute;
|
|
54
|
+
left: 0;
|
|
55
|
+
background-color: #333;
|
|
56
|
+
border-radius: 8px;
|
|
57
|
+
color: #fff;
|
|
58
|
+
font-size: 12px;
|
|
59
|
+
text-align: left;
|
|
60
|
+
line-height: 16px;
|
|
61
|
+
padding: 12px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
.uni-tooltip:hover .uni-tooltip-popup {
|
|
66
|
+
display: block;
|
|
67
|
+
}
|
|
68
|
+
</style>
|