@10yun/cv-mobile-ui 0.4.2 → 0.4.3

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.
Files changed (166) hide show
  1. package/package.json +1 -1
  2. package/ui-uni/amap-wx/js/util.js +166 -158
  3. package/ui-uni/page-foot/page-foot.vue +38 -0
  4. package/ui-uni/page-head/page-head.vue +16 -0
  5. package/ui-uni/product.vue +52 -52
  6. package/ui-uni/u-charts/u-charts.js +743 -1092
  7. package/ui-uni/u-link/u-link.vue +59 -0
  8. package/ui-uni/uni-badge/uni-badge.vue +250 -0
  9. package/ui-uni/uni-calendar/calendar.js +546 -0
  10. package/ui-uni/uni-calendar/uni-calendar-item.vue +171 -0
  11. package/ui-uni/uni-calendar/uni-calendar.vue +504 -0
  12. package/{ui-cv/cv-calendar → ui-uni/uni-calendar}/util.js +0 -0
  13. package/ui-uni/uni-card/uni-card.vue +420 -0
  14. package/ui-uni/uni-col/uni-col.vue +2968 -0
  15. package/ui-uni/uni-collapse/uni-collapse.vue +146 -0
  16. package/ui-uni/uni-collapse-item/uni-collapse-item.vue +378 -0
  17. package/ui-uni/uni-combox/uni-combox.vue +237 -0
  18. package/ui-uni/uni-countdown/uni-countdown.vue +234 -0
  19. package/ui-uni/uni-data-checkbox/uni-data-checkbox.vue +792 -0
  20. package/{ui-cv/cv-data-indexed-list → ui-uni/uni-data-indexed-list}/clientdb.js +0 -0
  21. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list-item.vue +142 -0
  22. package/ui-uni/uni-data-indexed-list/uni-data-indexed-list.vue +364 -0
  23. package/{ui-cv/cv-data-picker → ui-uni/uni-data-picker}/keypress.js +0 -0
  24. package/ui-uni/uni-data-picker/uni-data-picker.vue +468 -0
  25. package/{ui-cv/cv-data-pickerview/cv-data-picker.js → ui-uni/uni-data-pickerview/uni-data-picker.js} +0 -0
  26. package/ui-uni/uni-data-pickerview/uni-data-pickerview.vue +298 -0
  27. package/{ui-cv/cv-dateformat → ui-uni/uni-dateformat}/date-format.js +0 -0
  28. package/ui-uni/uni-dateformat/uni-dateformat.vue +88 -0
  29. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar-item.vue +0 -0
  30. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/calendar.js +0 -0
  31. package/ui-uni/uni-datetime-picker/calendar.vue +747 -0
  32. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/keypress.js +0 -0
  33. package/ui-uni/uni-datetime-picker/time-picker.vue +899 -0
  34. package/ui-uni/uni-datetime-picker/uni-datetime-picker.vue +874 -0
  35. package/{ui-cv/cv-datetime-picker → ui-uni/uni-datetime-picker}/util.js +0 -0
  36. package/ui-uni/uni-drawer/keypress.js +45 -0
  37. package/ui-uni/uni-drawer/uni-drawer.vue +178 -0
  38. package/{ui-cv/cv-easyinput → ui-uni/uni-easyinput}/common.js +0 -0
  39. package/ui-uni/uni-easyinput/uni-easyinput.vue +438 -0
  40. package/ui-uni/uni-fab/uni-fab.vue +443 -0
  41. package/{ui-cv/cv-fab/cv-fab.vue.bak → ui-uni/uni-fab/uni-fab.vue.bak} +2 -2
  42. package/ui-uni/uni-fav/uni-fav.vue +136 -0
  43. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/choose-and-upload-file.js +0 -0
  44. package/ui-uni/uni-file-picker/uni-file-picker.vue +614 -0
  45. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-file.vue +0 -0
  46. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/upload-image.vue +0 -0
  47. package/{ui-cv/cv-file-picker → ui-uni/uni-file-picker}/utils.js +0 -0
  48. package/ui-uni/uni-forms/uni-forms.vue +467 -0
  49. package/ui-uni/uni-forms/validate.js +486 -0
  50. package/ui-uni/uni-forms-item/uni-forms-item.vue +500 -0
  51. package/{ui-cv/cv-goods-nav/cv-goods-nav.vue → ui-uni/uni-goods-nav/uni-goods-nav.vue} +1 -1
  52. package/ui-uni/uni-grid/uni-grid.vue +141 -0
  53. package/ui-uni/uni-grid-item/uni-grid-item.vue +123 -0
  54. package/ui-uni/uni-group/uni-group.vue +123 -0
  55. package/ui-uni/uni-icons/icons.js +132 -0
  56. package/ui-uni/uni-icons/uni-icons.vue +72 -0
  57. package/{ui-cv/cv-icon2 → ui-uni/uni-icons}/uni.ttf +0 -0
  58. package/ui-uni/uni-indexed-list/uni-indexed-list-item.vue +142 -0
  59. package/ui-uni/uni-indexed-list/uni-indexed-list.vue +357 -0
  60. package/ui-uni/uni-link/uni-link.vue +117 -0
  61. package/ui-uni/uni-list/uni-list.vue +107 -0
  62. package/ui-uni/uni-list/uni-refresh.vue +65 -0
  63. package/{ui-cv/cv-list → ui-uni/uni-list}/uni-refresh.wxs +0 -0
  64. package/ui-uni/uni-list-ad/uni-list-ad.vue +106 -0
  65. package/{ui-cv/cv-list-chat/cv-list-chat.scss → ui-uni/uni-list-chat/uni-list-chat.scss} +0 -0
  66. package/{ui-cv/cv-list-chat/cv-list-chat.vue → ui-uni/uni-list-chat/uni-list-chat.vue} +0 -0
  67. package/ui-uni/uni-list-item/uni-list-item.vue +428 -0
  68. package/ui-uni/uni-load-more/uni-load-more.vue +366 -0
  69. package/ui-uni/uni-nav-bar/uni-nav-bar.vue +244 -0
  70. package/{ui-cv/cv-nav-bar/cv-status-bar.vue → ui-uni/uni-nav-bar/uni-status-bar.vue} +0 -0
  71. package/ui-uni/uni-notice-bar/uni-notice-bar.vue +394 -0
  72. package/ui-uni/uni-number-box/uni-number-box.vue +224 -0
  73. package/ui-uni/uni-pagination/uni-pagination.vue +376 -0
  74. package/{ui-cv/cv-popup → ui-uni/uni-popup}/keypress.js +0 -0
  75. package/{ui-cv/cv-popup → ui-uni/uni-popup}/popup.js +0 -0
  76. package/ui-uni/uni-popup/uni-popup.vue +412 -0
  77. package/{ui-cv/cv-popup-dialog → ui-uni/uni-popup-dialog}/keypress.js +0 -0
  78. package/{ui-cv/cv-popup-dialog/cv-popup-dialog.vue → ui-uni/uni-popup-dialog/uni-popup-dialog.vue} +0 -0
  79. package/ui-uni/uni-popup-message/uni-popup-message.vue +143 -0
  80. package/{ui-cv/cv-popup-share/cv-popup-share.vue → ui-uni/uni-popup-share/uni-popup-share.vue} +0 -0
  81. package/ui-uni/uni-rate/uni-rate.vue +357 -0
  82. package/ui-uni/uni-row/uni-row.vue +155 -0
  83. package/ui-uni/uni-search-bar/uni-search-bar.vue +262 -0
  84. package/{ui-cv/cv-section/cv-section.vue → ui-uni/uni-section/uni-section.vue} +0 -0
  85. package/{ui-cv/cv-segmented-control/cv-segmented-control.vue → ui-uni/uni-segmented-control/uni-segmented-control.vue} +0 -0
  86. package/{ui-cv/cv-status-bar/cv-status-bar.vue → ui-uni/uni-status-bar/uni-status-bar.vue} +0 -0
  87. package/ui-uni/uni-steps/uni-steps.vue +250 -0
  88. package/{ui-cv/cv-swipe-action/cv-swipe-action.vue → ui-uni/uni-swipe-action/uni-swipe-action.vue} +0 -0
  89. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/bindingx.js +0 -0
  90. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/index.wxs +0 -0
  91. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/isPC.js +0 -0
  92. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpalipay.js +0 -0
  93. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpother.js +0 -0
  94. package/{ui-cv/cv-swipe-action-item → ui-uni/uni-swipe-action-item}/mpwxs.js +0 -0
  95. package/{ui-cv/cv-swipe-action-item/cv-swipe-action-item.vue → ui-uni/uni-swipe-action-item/uni-swipe-action-item.vue} +0 -0
  96. package/ui-uni/uni-swiper-dot/uni-swiper-dot.vue +205 -0
  97. package/ui-uni/uni-table/uni-table.vue +455 -0
  98. package/ui-uni/uni-tag/uni-tag.vue +283 -0
  99. package/ui-uni/uni-tbody/uni-tbody.vue +30 -0
  100. package/ui-uni/uni-td/uni-td.vue +88 -0
  101. package/{ui-cv/cv-test/cv-test.vue → ui-uni/uni-test/uni-test.vue} +0 -0
  102. package/{ui-cv/cv-th → ui-uni/uni-th}/filter-dropdown.vue +0 -0
  103. package/ui-uni/uni-th/uni-th.vue +259 -0
  104. package/ui-uni/uni-thead/uni-thead.vue +114 -0
  105. package/ui-uni/uni-title/uni-title.vue +171 -0
  106. package/{ui-cv/cv-tr → ui-uni/uni-tr}/table-checkbox.vue +0 -0
  107. package/ui-uni/uni-tr/uni-tr.vue +156 -0
  108. package/{ui-cv/cv-transition → ui-uni/uni-transition}/createAnimation.js +0 -0
  109. package/ui-uni/uni-transition/uni-transition.vue +287 -0
  110. package/ui-cv/cv-badge/cv-badge.vue +0 -249
  111. package/ui-cv/cv-calendar/calendar.js +0 -963
  112. package/ui-cv/cv-calendar/cv-calendar-item.vue +0 -198
  113. package/ui-cv/cv-calendar/cv-calendar.vue +0 -508
  114. package/ui-cv/cv-card/cv-card.vue +0 -427
  115. package/ui-cv/cv-col/cv-col.vue +0 -2965
  116. package/ui-cv/cv-collapse/cv-collapse.vue +0 -146
  117. package/ui-cv/cv-collapse-item/cv-collapse-item.vue +0 -395
  118. package/ui-cv/cv-combox/cv-combox.vue +0 -250
  119. package/ui-cv/cv-countdown/cv-countdown.vue +0 -245
  120. package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +0 -841
  121. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +0 -154
  122. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +0 -376
  123. package/ui-cv/cv-data-picker/cv-data-picker.vue +0 -486
  124. package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +0 -304
  125. package/ui-cv/cv-dateformat/cv-dateformat.vue +0 -86
  126. package/ui-cv/cv-datetime-picker/calendar.vue +0 -761
  127. package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +0 -958
  128. package/ui-cv/cv-datetime-picker/time-picker.vue +0 -907
  129. package/ui-cv/cv-drawer/cv-drawer.vue +0 -185
  130. package/ui-cv/cv-drawer/keypress.js +0 -45
  131. package/ui-cv/cv-easyinput/cv-easyinput.vue +0 -514
  132. package/ui-cv/cv-fab/cv-fab.vue +0 -465
  133. package/ui-cv/cv-fav/cv-fav.vue +0 -150
  134. package/ui-cv/cv-file-picker/cv-file-picker.vue +0 -619
  135. package/ui-cv/cv-form-base/cv-form-base.vue +0 -470
  136. package/ui-cv/cv-form-base/validate.js +0 -477
  137. package/ui-cv/cv-grid-group/cv-grid-group.vue +0 -148
  138. package/ui-cv/cv-grid-item/cv-grid-item.vue +0 -132
  139. package/ui-cv/cv-icon2/cv-icon2.vue +0 -78
  140. package/ui-cv/cv-icon2/icons.js +0 -132
  141. package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +0 -154
  142. package/ui-cv/cv-indexed-list/cv-indexed-list.vue +0 -371
  143. package/ui-cv/cv-link2/cv-link2.vue +0 -130
  144. package/ui-cv/cv-list/cv-list.vue +0 -107
  145. package/ui-cv/cv-list/cv-refresh.vue +0 -65
  146. package/ui-cv/cv-list-ad/cv-list-ad.vue +0 -113
  147. package/ui-cv/cv-list-item/cv-list-item.vue +0 -449
  148. package/ui-cv/cv-nav-bar/cv-nav-bar.vue +0 -256
  149. package/ui-cv/cv-notice-bar/cv-notice-bar.vue +0 -453
  150. package/ui-cv/cv-number-box/cv-number-box.vue +0 -223
  151. package/ui-cv/cv-pagination/cv-pagination.vue +0 -397
  152. package/ui-cv/cv-popup/cv-popup.vue +0 -429
  153. package/ui-cv/cv-popup-message/cv-popup-message.vue +0 -143
  154. package/ui-cv/cv-row/cv-row.vue +0 -157
  155. package/ui-cv/cv-search-bar/cv-search-bar.vue +0 -280
  156. package/ui-cv/cv-steps/cv-steps.vue +0 -293
  157. package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +0 -255
  158. package/ui-cv/cv-table/cv-table.vue +0 -460
  159. package/ui-cv/cv-tag/cv-tag.vue +0 -276
  160. package/ui-cv/cv-tbody/cv-tbody.vue +0 -28
  161. package/ui-cv/cv-td/cv-td.vue +0 -93
  162. package/ui-cv/cv-th/cv-th.vue +0 -270
  163. package/ui-cv/cv-thead/cv-thead.vue +0 -114
  164. package/ui-cv/cv-title/cv-title.vue +0 -168
  165. package/ui-cv/cv-tr/cv-tr.vue +0 -166
  166. package/ui-cv/cv-transition/cv-transition.vue +0 -279
@@ -1,114 +0,0 @@
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">
14
- <slot></slot>
15
- </view>
16
- <!-- #endif -->
17
- </template>
18
-
19
- <script>
20
- import tableCheckbox from '../uni-tr/table-checkbox.vue';
21
- export default {
22
- name: 'cvThead',
23
- components: {
24
- tableCheckbox
25
- },
26
- options: {
27
- virtualHost: true
28
- },
29
- data() {
30
- return {
31
- border: false,
32
- selection: false,
33
- rowspan: 1,
34
- indeterminate: false,
35
- checked: false
36
- };
37
- },
38
- created() {
39
- this.root = this.getTable();
40
- // #ifdef H5
41
- this.root.theadChildren = this;
42
- // #endif
43
- this.border = this.root.border;
44
- this.selection = this.root.type;
45
- },
46
- methods: {
47
- init(self) {
48
- this.rowspan++;
49
- },
50
- checkboxSelected(e) {
51
- this.indeterminate = false;
52
- const backIndexData = this.root.backIndexData;
53
- const data = this.root.trChildren.filter((v) => !v.disabled && v.keyValue);
54
- if (backIndexData.length === data.length) {
55
- this.checked = false;
56
- this.root.clearSelection();
57
- } else {
58
- this.checked = true;
59
- this.root.selectionAll();
60
- }
61
- },
62
- /**
63
- * 获取父元素实例
64
- */
65
- getTable(name = 'uniTable') {
66
- let parent = this.$parent;
67
- let parentName = parent.$options.name;
68
- while (parentName !== name) {
69
- parent = parent.$parent;
70
- if (!parent) return false;
71
- parentName = parent.$options.name;
72
- }
73
- return parent;
74
- }
75
- }
76
- };
77
- </script>
78
-
79
- <style scoped>
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 #ebeef5 solid;
105
- font-size: 14px;
106
- }
107
-
108
- .tr-table--border {
109
- border-right: 1px #ebeef5 solid;
110
- }
111
-
112
- /* #ifndef APP-NVUE */
113
- /* #endif */
114
- </style>
@@ -1,168 +0,0 @@
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: 'cvTitle',
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
- computed: {
54
- textAlign() {
55
- let align = 'center';
56
- switch (this.align) {
57
- case 'left':
58
- align = 'flex-start';
59
- break;
60
- case 'center':
61
- align = 'center';
62
- break;
63
- case 'right':
64
- align = 'flex-end';
65
- break;
66
- }
67
- return align;
68
- }
69
- },
70
- watch: {
71
- title(newVal) {
72
- if (this.isOpenStat()) {
73
- // 上报数据
74
- if (uni.report) {
75
- uni.report('title', this.title);
76
- }
77
- }
78
- }
79
- },
80
- mounted() {
81
- if (this.isOpenStat()) {
82
- // 上报数据
83
- if (uni.report) {
84
- uni.report('title', this.title);
85
- }
86
- }
87
- },
88
- methods: {
89
- isOpenStat() {
90
- if (this.stat === '') {
91
- this.isStat = false;
92
- }
93
- let stat_type = (typeof this.stat === 'boolean' && this.stat) || (typeof this.stat === 'string' && this.stat !== '');
94
- if (this.type === '') {
95
- this.isStat = true;
96
- if (this.stat.toString() === 'false') {
97
- this.isStat = false;
98
- }
99
- }
100
-
101
- if (this.type !== '') {
102
- this.isStat = true;
103
- if (stat_type) {
104
- this.isStat = true;
105
- } else {
106
- this.isStat = false;
107
- }
108
- }
109
- return this.isStat;
110
- }
111
- }
112
- };
113
- </script>
114
-
115
- <style scoped>
116
- /* .uni-title {
117
-
118
- } */
119
- .uni-title__box {
120
- /* #ifndef APP-NVUE */
121
- display: flex;
122
- /* #endif */
123
- flex-direction: column;
124
- align-items: flex-start;
125
- justify-content: center;
126
- padding: 8px 0;
127
- flex: 1;
128
- }
129
-
130
- .uni-title__base {
131
- font-size: 15px;
132
- color: #333;
133
- font-weight: 500;
134
- }
135
-
136
- .uni-h1 {
137
- font-size: 20px;
138
- color: #333;
139
- font-weight: bold;
140
- }
141
-
142
- .uni-h2 {
143
- font-size: 18px;
144
- color: #333;
145
- font-weight: bold;
146
- }
147
-
148
- .uni-h3 {
149
- font-size: 16px;
150
- color: #333;
151
- font-weight: bold;
152
- /* font-weight: 400; */
153
- }
154
-
155
- .uni-h4 {
156
- font-size: 14px;
157
- color: #333;
158
- font-weight: bold;
159
- /* font-weight: 300; */
160
- }
161
-
162
- .uni-h5 {
163
- font-size: 12px;
164
- color: #333;
165
- font-weight: bold;
166
- /* font-weight: 200; */
167
- }
168
- </style>
@@ -1,166 +0,0 @@
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
6
- :checked="checked"
7
- :indeterminate="indeterminate"
8
- :disabled="disabled"
9
- @checkboxSelected="checkboxSelected"
10
- ></table-checkbox>
11
- </th>
12
- <slot></slot>
13
- <!-- <uni-th class="th-fixed">123</uni-th> -->
14
- </tr>
15
- <!-- #endif -->
16
- <!-- #ifndef H5 -->
17
- <view class="uni-table-tr">
18
- <view v-if="selection === 'selection'" class="checkbox" :class="{ 'tr-table--border': border }">
19
- <table-checkbox
20
- :checked="checked"
21
- :indeterminate="indeterminate"
22
- :disabled="disabled"
23
- @checkboxSelected="checkboxSelected"
24
- ></table-checkbox>
25
- </view>
26
- <slot></slot>
27
- </view>
28
- <!-- #endif -->
29
- </template>
30
-
31
- <script>
32
- import tableCheckbox from './table-checkbox.vue';
33
- /**
34
- * Tr 表格行组件
35
- * @description 表格行组件 仅包含 th,td 组件
36
- * @tutorial https://ext.dcloud.net.cn/plugin?id=
37
- */
38
- export default {
39
- name: 'cvTr',
40
- components: {
41
- tableCheckbox
42
- },
43
- props: {
44
- disabled: {
45
- type: Boolean,
46
- default: false
47
- },
48
- keyValue: {
49
- type: [String, Number],
50
- default: ''
51
- }
52
- },
53
- options: {
54
- virtualHost: true
55
- },
56
- data() {
57
- return {
58
- value: false,
59
- border: false,
60
- selection: false,
61
- widthThArr: [],
62
- ishead: true,
63
- checked: false,
64
- indeterminate: false
65
- };
66
- },
67
- created() {
68
- this.root = this.getTable();
69
- this.head = this.getTable('uniThead');
70
- if (this.head) {
71
- this.ishead = false;
72
- this.head.init(this);
73
- }
74
- this.border = this.root.border;
75
- this.selection = this.root.type;
76
- this.root.trChildren.push(this);
77
- const rowData = this.root.data.find((v) => v[this.root.rowKey] === this.keyValue);
78
- if (rowData) {
79
- this.rowData = rowData;
80
- }
81
- this.root.isNodata();
82
- },
83
- mounted() {
84
- if (this.widthThArr.length > 0) {
85
- const selectionWidth = this.selection === 'selection' ? 50 : 0;
86
- this.root.minWidth = this.widthThArr.reduce((a, b) => Number(a) + Number(b)) + selectionWidth;
87
- }
88
- },
89
- // #ifndef VUE3
90
- destroyed() {
91
- const index = this.root.trChildren.findIndex((i) => i === this);
92
- this.root.trChildren.splice(index, 1);
93
- this.root.isNodata();
94
- },
95
- // #endif
96
- // #ifdef VUE3
97
- unmounted() {
98
- const index = this.root.trChildren.findIndex((i) => i === this);
99
- this.root.trChildren.splice(index, 1);
100
- this.root.isNodata();
101
- },
102
- // #endif
103
- methods: {
104
- minWidthUpdate(width) {
105
- this.widthThArr.push(width);
106
- },
107
- // 选中
108
- checkboxSelected(e) {
109
- let rootData = this.root.data.find((v) => v[this.root.rowKey] === this.keyValue);
110
- this.checked = e.checked;
111
- this.root.check(rootData || this, e.checked, rootData ? this.keyValue : null);
112
- },
113
- change(e) {
114
- this.root.trChildren.forEach((item) => {
115
- if (item === this) {
116
- this.root.check(this, e.detail.value.length > 0 ? true : false);
117
- }
118
- });
119
- },
120
- /**
121
- * 获取父元素实例
122
- */
123
- getTable(name = 'uniTable') {
124
- let parent = this.$parent;
125
- let parentName = parent.$options.name;
126
- while (parentName !== name) {
127
- parent = parent.$parent;
128
- if (!parent) return false;
129
- parentName = parent.$options.name;
130
- }
131
- return parent;
132
- }
133
- }
134
- };
135
- </script>
136
-
137
- <style scoped>
138
- .uni-table-tr {
139
- /* #ifndef APP-NVUE */
140
- display: table-row;
141
- transition: all 0.3s;
142
- box-sizing: border-box;
143
- /* #endif */
144
- }
145
-
146
- .checkbox {
147
- padding: 0 8px;
148
- width: 26px;
149
- padding-left: 12px;
150
- /* #ifndef APP-NVUE */
151
- display: table-cell;
152
- vertical-align: middle;
153
- /* #endif */
154
- color: #333;
155
- font-weight: 500;
156
- border-bottom: 1px #ebeef5 solid;
157
- font-size: 14px;
158
- }
159
-
160
- .tr-table--border {
161
- border-right: 1px #ebeef5 solid;
162
- }
163
-
164
- /* #ifndef APP-NVUE */
165
- /* #endif */
166
- </style>
@@ -1,279 +0,0 @@
1
- <template>
2
- <view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick">
3
- <slot></slot>
4
- </view>
5
- </template>
6
-
7
- <script>
8
- import { createAnimation } from './createAnimation';
9
-
10
- /**
11
- * Transition 过渡动画
12
- * @description 简单过渡动画组件
13
- * @tutorial https://ext.dcloud.net.cn/plugin?id=985
14
- * @property {Boolean} show = [false|true] 控制组件显示或隐藏
15
- * @property {Array|String} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 过渡动画类型
16
- * @value fade 渐隐渐出过渡
17
- * @value slide-top 由上至下过渡
18
- * @value slide-right 由右至左过渡
19
- * @value slide-bottom 由下至上过渡
20
- * @value slide-left 由左至右过渡
21
- * @value zoom-in 由小到大过渡
22
- * @value zoom-out 由大到小过渡
23
- * @property {Number} duration 过渡动画持续时间
24
- * @property {Object} styles 组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red`
25
- */
26
- export default {
27
- name: 'cvTransition',
28
- emits: ['click', 'change'],
29
- props: {
30
- show: {
31
- type: Boolean,
32
- default: false
33
- },
34
- modeClass: {
35
- type: [Array, String],
36
- default() {
37
- return 'fade';
38
- }
39
- },
40
- duration: {
41
- type: Number,
42
- default: 300
43
- },
44
- styles: {
45
- type: Object,
46
- default() {
47
- return {};
48
- }
49
- },
50
- customClass: {
51
- type: String,
52
- default: ''
53
- }
54
- },
55
- data() {
56
- return {
57
- isShow: false,
58
- transform: '',
59
- opacity: 1,
60
- animationData: {},
61
- durationTime: 300,
62
- config: {}
63
- };
64
- },
65
- watch: {
66
- show: {
67
- handler(newVal) {
68
- if (newVal) {
69
- this.open();
70
- } else {
71
- // 避免上来就执行 close,导致动画错乱
72
- if (this.isShow) {
73
- this.close();
74
- }
75
- }
76
- },
77
- immediate: true
78
- }
79
- },
80
- computed: {
81
- // 生成样式数据
82
- stylesObject() {
83
- let styles = {
84
- ...this.styles,
85
- 'transition-duration': this.duration / 1000 + 's'
86
- };
87
- let transform = '';
88
- for (let i in styles) {
89
- let line = this.toLine(i);
90
- transform += line + ':' + styles[i] + ';';
91
- }
92
- return transform;
93
- },
94
- // 初始化动画条件
95
- transformStyles() {
96
- return 'transform:' + this.transform + ';' + 'opacity:' + this.opacity + ';' + this.stylesObject;
97
- }
98
- },
99
- created() {
100
- // 动画默认配置
101
- this.config = {
102
- duration: this.duration,
103
- timingFunction: 'ease',
104
- transformOrigin: '50% 50%',
105
- delay: 0
106
- };
107
- this.durationTime = this.duration;
108
- },
109
- methods: {
110
- /**
111
- * ref 触发 初始化动画
112
- */
113
- init(obj = {}) {
114
- if (obj.duration) {
115
- this.durationTime = obj.duration;
116
- }
117
- this.animation = createAnimation(Object.assign(this.config, obj));
118
- },
119
- /**
120
- * 点击组件触发回调
121
- */
122
- onClick() {
123
- this.$emit('click', {
124
- detail: this.isShow
125
- });
126
- },
127
- /**
128
- * ref 触发 动画分组
129
- * @param {Object} obj
130
- */
131
- step(obj, config = {}) {
132
- if (!this.animation) return;
133
- for (let i in obj) {
134
- try {
135
- if (typeof obj[i] === 'object') {
136
- this.animation[i](...obj[i]);
137
- } else {
138
- this.animation[i](obj[i]);
139
- }
140
- } catch (e) {
141
- console.error(`方法 ${i} 不存在`);
142
- }
143
- }
144
- this.animation.step(config);
145
- return this;
146
- },
147
- /**
148
- * ref 触发 执行动画
149
- */
150
- run(fn) {
151
- if (!this.animation) return;
152
- this.animation.run(fn);
153
- },
154
- // 开始过度动画
155
- open() {
156
- clearTimeout(this.timer);
157
- this.transform = '';
158
- this.isShow = true;
159
- let { opacity, transform } = this.styleInit(false);
160
- if (typeof opacity !== 'undefined') {
161
- this.opacity = opacity;
162
- }
163
- this.transform = transform;
164
- // 确保动态样式已经生效后,执行动画,如果不加 nextTick ,会导致 wx 动画执行异常
165
- this.$nextTick(() => {
166
- // TODO 定时器保证动画完全执行,目前有些问题,后面会取消定时器
167
- this.timer = setTimeout(() => {
168
- this.animation = createAnimation(this.config, this);
169
- this.tranfromInit(false).step();
170
- this.animation.run();
171
- this.$emit('change', {
172
- detail: this.isShow
173
- });
174
- }, 20);
175
- });
176
- },
177
- // 关闭过度动画
178
- close(type) {
179
- if (!this.animation) return;
180
- this.tranfromInit(true)
181
- .step()
182
- .run(() => {
183
- this.isShow = false;
184
- this.animationData = null;
185
- this.animation = null;
186
- let { opacity, transform } = this.styleInit(false);
187
- this.opacity = opacity || 1;
188
- this.transform = transform;
189
- this.$emit('change', {
190
- detail: this.isShow
191
- });
192
- });
193
- },
194
- // 处理动画开始前的默认样式
195
- styleInit(type) {
196
- let styles = {
197
- transform: ''
198
- };
199
- let buildStyle = (type, mode) => {
200
- if (mode === 'fade') {
201
- styles.opacity = this.animationType(type)[mode];
202
- } else {
203
- styles.transform += this.animationType(type)[mode] + ' ';
204
- }
205
- };
206
- if (typeof this.modeClass === 'string') {
207
- buildStyle(type, this.modeClass);
208
- } else {
209
- this.modeClass.forEach((mode) => {
210
- buildStyle(type, mode);
211
- });
212
- }
213
- return styles;
214
- },
215
- // 处理内置组合动画
216
- tranfromInit(type) {
217
- let buildTranfrom = (type, mode) => {
218
- let aniNum = null;
219
- if (mode === 'fade') {
220
- aniNum = type ? 0 : 1;
221
- } else {
222
- aniNum = type ? '-100%' : '0';
223
- if (mode === 'zoom-in') {
224
- aniNum = type ? 0.8 : 1;
225
- }
226
- if (mode === 'zoom-out') {
227
- aniNum = type ? 1.2 : 1;
228
- }
229
- if (mode === 'slide-right') {
230
- aniNum = type ? '100%' : '0';
231
- }
232
- if (mode === 'slide-bottom') {
233
- aniNum = type ? '100%' : '0';
234
- }
235
- }
236
- this.animation[this.animationMode()[mode]](aniNum);
237
- };
238
- if (typeof this.modeClass === 'string') {
239
- buildTranfrom(type, this.modeClass);
240
- } else {
241
- this.modeClass.forEach((mode) => {
242
- buildTranfrom(type, mode);
243
- });
244
- }
245
-
246
- return this.animation;
247
- },
248
- animationType(type) {
249
- return {
250
- fade: type ? 1 : 0,
251
- 'slide-top': `translateY(${type ? '0' : '-100%'})`,
252
- 'slide-right': `translateX(${type ? '0' : '100%'})`,
253
- 'slide-bottom': `translateY(${type ? '0' : '100%'})`,
254
- 'slide-left': `translateX(${type ? '0' : '-100%'})`,
255
- 'zoom-in': `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
256
- 'zoom-out': `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
257
- };
258
- },
259
- // 内置动画类型与实际动画对应字典
260
- animationMode() {
261
- return {
262
- fade: 'opacity',
263
- 'slide-top': 'translateY',
264
- 'slide-right': 'translateX',
265
- 'slide-bottom': 'translateY',
266
- 'slide-left': 'translateX',
267
- 'zoom-in': 'scale',
268
- 'zoom-out': 'scale'
269
- };
270
- },
271
- // 驼峰转中横线
272
- toLine(name) {
273
- return name.replace(/([A-Z])/g, '-$1').toLowerCase();
274
- }
275
- }
276
- };
277
- </script>
278
-
279
- <style scoped></style>