@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,179 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-table-checkbox" @click="selected">
|
|
3
|
+
<view v-if="!indeterminate" class="checkbox__inner" :class="{'is-checked':isChecked,'is-disable':isDisabled}">
|
|
4
|
+
<view class="checkbox__inner-icon"></view>
|
|
5
|
+
</view>
|
|
6
|
+
<view v-else class="checkbox__inner checkbox--indeterminate">
|
|
7
|
+
<view class="checkbox__inner-icon"></view>
|
|
8
|
+
</view>
|
|
9
|
+
</view>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: 'TableCheckbox',
|
|
15
|
+
emits:['checkboxSelected'],
|
|
16
|
+
props: {
|
|
17
|
+
indeterminate: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
checked: {
|
|
22
|
+
type: [Boolean,String],
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
disabled: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
index: {
|
|
30
|
+
type: Number,
|
|
31
|
+
default: -1
|
|
32
|
+
},
|
|
33
|
+
cellData: {
|
|
34
|
+
type: Object,
|
|
35
|
+
default () {
|
|
36
|
+
return {}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
watch:{
|
|
41
|
+
checked(newVal){
|
|
42
|
+
if(typeof this.checked === 'boolean'){
|
|
43
|
+
this.isChecked = newVal
|
|
44
|
+
}else{
|
|
45
|
+
this.isChecked = true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
indeterminate(newVal){
|
|
49
|
+
this.isIndeterminate = newVal
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
isChecked: false,
|
|
55
|
+
isDisabled: false,
|
|
56
|
+
isIndeterminate:false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
created() {
|
|
60
|
+
if(typeof this.checked === 'boolean'){
|
|
61
|
+
this.isChecked = this.checked
|
|
62
|
+
}
|
|
63
|
+
this.isDisabled = this.disabled
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
selected() {
|
|
67
|
+
if (this.isDisabled) return
|
|
68
|
+
this.isIndeterminate = false
|
|
69
|
+
this.isChecked = !this.isChecked
|
|
70
|
+
this.$emit('checkboxSelected', {
|
|
71
|
+
checked: this.isChecked,
|
|
72
|
+
data: this.cellData
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<style lang="scss">
|
|
80
|
+
$uni-primary: #007aff !default;
|
|
81
|
+
$border-color: #DCDFE6;
|
|
82
|
+
$disable:0.4;
|
|
83
|
+
|
|
84
|
+
.uni-table-checkbox {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: row;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
position: relative;
|
|
90
|
+
margin: 5px 0;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
|
|
93
|
+
// 多选样式
|
|
94
|
+
.checkbox__inner {
|
|
95
|
+
/* #ifndef APP-NVUE */
|
|
96
|
+
flex-shrink: 0;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
/* #endif */
|
|
99
|
+
position: relative;
|
|
100
|
+
width: 16px;
|
|
101
|
+
height: 16px;
|
|
102
|
+
border: 1px solid $border-color;
|
|
103
|
+
border-radius: 2px;
|
|
104
|
+
background-color: #fff;
|
|
105
|
+
z-index: 1;
|
|
106
|
+
|
|
107
|
+
.checkbox__inner-icon {
|
|
108
|
+
position: absolute;
|
|
109
|
+
/* #ifdef APP-NVUE */
|
|
110
|
+
top: 2px;
|
|
111
|
+
/* #endif */
|
|
112
|
+
/* #ifndef APP-NVUE */
|
|
113
|
+
top: 2px;
|
|
114
|
+
/* #endif */
|
|
115
|
+
left: 5px;
|
|
116
|
+
height: 7px;
|
|
117
|
+
width: 3px;
|
|
118
|
+
border: 1px solid #fff;
|
|
119
|
+
border-left: 0;
|
|
120
|
+
border-top: 0;
|
|
121
|
+
opacity: 0;
|
|
122
|
+
transform-origin: center;
|
|
123
|
+
transform: rotate(45deg);
|
|
124
|
+
box-sizing: content-box;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&.checkbox--indeterminate {
|
|
128
|
+
border-color: $uni-primary;
|
|
129
|
+
background-color: $uni-primary;
|
|
130
|
+
|
|
131
|
+
.checkbox__inner-icon {
|
|
132
|
+
position: absolute;
|
|
133
|
+
opacity: 1;
|
|
134
|
+
transform: rotate(0deg);
|
|
135
|
+
height: 2px;
|
|
136
|
+
top: 0;
|
|
137
|
+
bottom: 0;
|
|
138
|
+
margin: auto;
|
|
139
|
+
left: 0px;
|
|
140
|
+
right: 0px;
|
|
141
|
+
bottom: 0;
|
|
142
|
+
width: auto;
|
|
143
|
+
border: none;
|
|
144
|
+
border-radius: 2px;
|
|
145
|
+
transform: scale(0.5);
|
|
146
|
+
background-color: #fff;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
&:hover{
|
|
150
|
+
border-color: $uni-primary;
|
|
151
|
+
}
|
|
152
|
+
// 禁用
|
|
153
|
+
&.is-disable {
|
|
154
|
+
/* #ifdef H5 */
|
|
155
|
+
cursor: not-allowed;
|
|
156
|
+
/* #endif */
|
|
157
|
+
background-color: #F2F6FC;
|
|
158
|
+
border-color: $border-color;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// 选中
|
|
162
|
+
&.is-checked {
|
|
163
|
+
border-color: $uni-primary;
|
|
164
|
+
background-color: $uni-primary;
|
|
165
|
+
|
|
166
|
+
.checkbox__inner-icon {
|
|
167
|
+
opacity: 1;
|
|
168
|
+
transform: rotate(45deg);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 选中禁用
|
|
172
|
+
&.is-disable {
|
|
173
|
+
opacity: $disable;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
</style>
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef H5 -->
|
|
3
|
+
<tr class="uni-table-tr">
|
|
4
|
+
<th v-if="selection === 'selection' && ishead" class="checkbox" :class="{ 'tr-table--border': border }">
|
|
5
|
+
<table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
|
|
6
|
+
</th>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
<!-- <uni-th class="th-fixed">123</uni-th> -->
|
|
9
|
+
</tr>
|
|
10
|
+
<!-- #endif -->
|
|
11
|
+
<!-- #ifndef H5 -->
|
|
12
|
+
<view class="uni-table-tr">
|
|
13
|
+
<view v-if="selection === 'selection' " class="checkbox" :class="{ 'tr-table--border': border }">
|
|
14
|
+
<table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
|
|
15
|
+
</view>
|
|
16
|
+
<slot></slot>
|
|
17
|
+
</view>
|
|
18
|
+
<!-- #endif -->
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import tableCheckbox from './table-checkbox.vue'
|
|
23
|
+
/**
|
|
24
|
+
* Tr 表格行组件
|
|
25
|
+
* @description 表格行组件 仅包含 th,td 组件
|
|
26
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=
|
|
27
|
+
*/
|
|
28
|
+
export default {
|
|
29
|
+
name: 'uniTr',
|
|
30
|
+
components: { tableCheckbox },
|
|
31
|
+
props: {
|
|
32
|
+
disabled: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false
|
|
35
|
+
},
|
|
36
|
+
keyValue: {
|
|
37
|
+
type: [String, Number],
|
|
38
|
+
default: ''
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
options: {
|
|
42
|
+
virtualHost: true
|
|
43
|
+
},
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
value: false,
|
|
47
|
+
border: false,
|
|
48
|
+
selection: false,
|
|
49
|
+
widthThArr: [],
|
|
50
|
+
ishead: true,
|
|
51
|
+
checked: false,
|
|
52
|
+
indeterminate:false
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
created() {
|
|
56
|
+
this.root = this.getTable()
|
|
57
|
+
this.head = this.getTable('uniThead')
|
|
58
|
+
if (this.head) {
|
|
59
|
+
this.ishead = false
|
|
60
|
+
this.head.init(this)
|
|
61
|
+
}
|
|
62
|
+
this.border = this.root.border
|
|
63
|
+
this.selection = this.root.type
|
|
64
|
+
this.root.trChildren.push(this)
|
|
65
|
+
const rowData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue)
|
|
66
|
+
if(rowData){
|
|
67
|
+
this.rowData = rowData
|
|
68
|
+
}
|
|
69
|
+
this.root.isNodata()
|
|
70
|
+
},
|
|
71
|
+
mounted() {
|
|
72
|
+
if (this.widthThArr.length > 0) {
|
|
73
|
+
const selectionWidth = this.selection === 'selection' ? 50 : 0
|
|
74
|
+
this.root.minWidth = this.widthThArr.reduce((a, b) => Number(a) + Number(b)) + selectionWidth
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
// #ifndef VUE3
|
|
78
|
+
destroyed() {
|
|
79
|
+
const index = this.root.trChildren.findIndex(i => i === this)
|
|
80
|
+
this.root.trChildren.splice(index, 1)
|
|
81
|
+
this.root.isNodata()
|
|
82
|
+
},
|
|
83
|
+
// #endif
|
|
84
|
+
// #ifdef VUE3
|
|
85
|
+
unmounted() {
|
|
86
|
+
const index = this.root.trChildren.findIndex(i => i === this)
|
|
87
|
+
this.root.trChildren.splice(index, 1)
|
|
88
|
+
this.root.isNodata()
|
|
89
|
+
},
|
|
90
|
+
// #endif
|
|
91
|
+
methods: {
|
|
92
|
+
minWidthUpdate(width) {
|
|
93
|
+
this.widthThArr.push(width)
|
|
94
|
+
},
|
|
95
|
+
// 选中
|
|
96
|
+
checkboxSelected(e) {
|
|
97
|
+
let rootData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue)
|
|
98
|
+
this.checked = e.checked
|
|
99
|
+
this.root.check(rootData||this, e.checked,rootData? this.keyValue:null)
|
|
100
|
+
},
|
|
101
|
+
change(e) {
|
|
102
|
+
this.root.trChildren.forEach(item => {
|
|
103
|
+
if (item === this) {
|
|
104
|
+
this.root.check(this, e.detail.value.length > 0 ? true : false)
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
},
|
|
108
|
+
/**
|
|
109
|
+
* 获取父元素实例
|
|
110
|
+
*/
|
|
111
|
+
getTable(name = 'uniTable') {
|
|
112
|
+
let parent = this.$parent
|
|
113
|
+
let parentName = parent.$options.name
|
|
114
|
+
while (parentName !== name) {
|
|
115
|
+
parent = parent.$parent
|
|
116
|
+
if (!parent) return false
|
|
117
|
+
parentName = parent.$options.name
|
|
118
|
+
}
|
|
119
|
+
return parent
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<style lang="scss">
|
|
126
|
+
$border-color: #ebeef5;
|
|
127
|
+
|
|
128
|
+
.uni-table-tr {
|
|
129
|
+
/* #ifndef APP-NVUE */
|
|
130
|
+
display: table-row;
|
|
131
|
+
transition: all 0.3s;
|
|
132
|
+
box-sizing: border-box;
|
|
133
|
+
/* #endif */
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.checkbox {
|
|
137
|
+
padding: 0 8px;
|
|
138
|
+
width: 26px;
|
|
139
|
+
padding-left: 12px;
|
|
140
|
+
/* #ifndef APP-NVUE */
|
|
141
|
+
display: table-cell;
|
|
142
|
+
vertical-align: middle;
|
|
143
|
+
/* #endif */
|
|
144
|
+
color: #333;
|
|
145
|
+
font-weight: 500;
|
|
146
|
+
border-bottom: 1px $border-color solid;
|
|
147
|
+
font-size: 14px;
|
|
148
|
+
// text-align: center;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.tr-table--border {
|
|
152
|
+
border-right: 1px $border-color solid;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* #ifndef APP-NVUE */
|
|
156
|
+
.uni-table-tr {
|
|
157
|
+
::v-deep .uni-table-th {
|
|
158
|
+
&.table--border:last-child {
|
|
159
|
+
// border-right: none;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
::v-deep .uni-table-td {
|
|
164
|
+
&.table--border:last-child {
|
|
165
|
+
// border-right: none;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* #endif */
|
|
171
|
+
</style>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// const defaultOption = {
|
|
2
|
+
// duration: 300,
|
|
3
|
+
// timingFunction: 'linear',
|
|
4
|
+
// delay: 0,
|
|
5
|
+
// transformOrigin: '50% 50% 0'
|
|
6
|
+
// }
|
|
7
|
+
// #ifdef APP-NVUE
|
|
8
|
+
const nvueAnimation = uni.requireNativePlugin('animation')
|
|
9
|
+
// #endif
|
|
10
|
+
class MPAnimation {
|
|
11
|
+
constructor(options, _this) {
|
|
12
|
+
this.options = options
|
|
13
|
+
// 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误
|
|
14
|
+
this.animation = uni.createAnimation({
|
|
15
|
+
...options
|
|
16
|
+
})
|
|
17
|
+
this.currentStepAnimates = {}
|
|
18
|
+
this.next = 0
|
|
19
|
+
this.$ = _this
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_nvuePushAnimates(type, args) {
|
|
24
|
+
let aniObj = this.currentStepAnimates[this.next]
|
|
25
|
+
let styles = {}
|
|
26
|
+
if (!aniObj) {
|
|
27
|
+
styles = {
|
|
28
|
+
styles: {},
|
|
29
|
+
config: {}
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
styles = aniObj
|
|
33
|
+
}
|
|
34
|
+
if (animateTypes1.includes(type)) {
|
|
35
|
+
if (!styles.styles.transform) {
|
|
36
|
+
styles.styles.transform = ''
|
|
37
|
+
}
|
|
38
|
+
let unit = ''
|
|
39
|
+
if(type === 'rotate'){
|
|
40
|
+
unit = 'deg'
|
|
41
|
+
}
|
|
42
|
+
styles.styles.transform += `${type}(${args+unit}) `
|
|
43
|
+
} else {
|
|
44
|
+
styles.styles[type] = `${args}`
|
|
45
|
+
}
|
|
46
|
+
this.currentStepAnimates[this.next] = styles
|
|
47
|
+
}
|
|
48
|
+
_animateRun(styles = {}, config = {}) {
|
|
49
|
+
let ref = this.$.$refs['ani'].ref
|
|
50
|
+
if (!ref) return
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
nvueAnimation.transition(ref, {
|
|
53
|
+
styles,
|
|
54
|
+
...config
|
|
55
|
+
}, res => {
|
|
56
|
+
resolve()
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_nvueNextAnimate(animates, step = 0, fn) {
|
|
62
|
+
let obj = animates[step]
|
|
63
|
+
if (obj) {
|
|
64
|
+
let {
|
|
65
|
+
styles,
|
|
66
|
+
config
|
|
67
|
+
} = obj
|
|
68
|
+
this._animateRun(styles, config).then(() => {
|
|
69
|
+
step += 1
|
|
70
|
+
this._nvueNextAnimate(animates, step, fn)
|
|
71
|
+
})
|
|
72
|
+
} else {
|
|
73
|
+
this.currentStepAnimates = {}
|
|
74
|
+
typeof fn === 'function' && fn()
|
|
75
|
+
this.isEnd = true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
step(config = {}) {
|
|
80
|
+
// #ifndef APP-NVUE
|
|
81
|
+
this.animation.step(config)
|
|
82
|
+
// #endif
|
|
83
|
+
// #ifdef APP-NVUE
|
|
84
|
+
this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config)
|
|
85
|
+
this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin
|
|
86
|
+
this.next++
|
|
87
|
+
// #endif
|
|
88
|
+
return this
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
run(fn) {
|
|
92
|
+
// #ifndef APP-NVUE
|
|
93
|
+
this.$.animationData = this.animation.export()
|
|
94
|
+
this.$.timer = setTimeout(() => {
|
|
95
|
+
typeof fn === 'function' && fn()
|
|
96
|
+
}, this.$.durationTime)
|
|
97
|
+
// #endif
|
|
98
|
+
// #ifdef APP-NVUE
|
|
99
|
+
this.isEnd = false
|
|
100
|
+
let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref
|
|
101
|
+
if(!ref) return
|
|
102
|
+
this._nvueNextAnimate(this.currentStepAnimates, 0, fn)
|
|
103
|
+
this.next = 0
|
|
104
|
+
// #endif
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d',
|
|
110
|
+
'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY',
|
|
111
|
+
'translateZ'
|
|
112
|
+
]
|
|
113
|
+
const animateTypes2 = ['opacity', 'backgroundColor']
|
|
114
|
+
const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom']
|
|
115
|
+
animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => {
|
|
116
|
+
MPAnimation.prototype[type] = function(...args) {
|
|
117
|
+
// #ifndef APP-NVUE
|
|
118
|
+
this.animation[type](...args)
|
|
119
|
+
// #endif
|
|
120
|
+
// #ifdef APP-NVUE
|
|
121
|
+
this._nvuePushAnimates(type, args)
|
|
122
|
+
// #endif
|
|
123
|
+
return this
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
export function createAnimation(option, _this) {
|
|
128
|
+
if(!_this) return
|
|
129
|
+
clearTimeout(_this.timer)
|
|
130
|
+
return new MPAnimation(option, _this)
|
|
131
|
+
}
|