@10yun/cv-mobile-ui 0.5.19 → 0.5.21

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 (137) hide show
  1. package/other/mpvue-picker/mpvuePicker.vue +402 -0
  2. package/{uni-ui/lib → other}/mpvue-picker/style.css +0 -1
  3. package/{uni-ui/lib → other}/tab-nvue/style.css +0 -1
  4. package/other/uParse/components/style.css +1 -0
  5. package/other/uParse/components/wxParseAudio.vue +1 -0
  6. package/other/uParse/components/wxParseImg.vue +86 -0
  7. package/other/uParse/components/wxParseTable.vue +54 -0
  8. package/other/uParse/components/wxParseTemplate0.vue +98 -0
  9. package/other/uParse/components/wxParseTemplate1.vue +81 -0
  10. package/other/uParse/components/wxParseTemplate10.vue +81 -0
  11. package/other/uParse/components/wxParseTemplate11.vue +79 -0
  12. package/other/uParse/components/wxParseTemplate2.vue +81 -0
  13. package/other/uParse/components/wxParseTemplate3.vue +81 -0
  14. package/other/uParse/components/wxParseTemplate4.vue +81 -0
  15. package/other/uParse/components/wxParseTemplate5.vue +81 -0
  16. package/other/uParse/components/wxParseTemplate6.vue +81 -0
  17. package/other/uParse/components/wxParseTemplate7.vue +81 -0
  18. package/other/uParse/components/wxParseTemplate8.vue +81 -0
  19. package/other/uParse/components/wxParseTemplate9.vue +81 -0
  20. package/other/uParse/components/wxParseVideo.vue +14 -0
  21. package/other/uParse/editor.css +495 -0
  22. package/{uni-ui/lib/uParse/src → other/uParse}/libs/html2json.js +19 -22
  23. package/{uni-ui/lib/uParse/src → other/uParse}/libs/htmlparser.js +12 -5
  24. package/{uni-ui/lib/uParse/src → other/uParse}/libs/wxDiscode.js +2 -2
  25. package/other/uParse/wxParse.vue +196 -0
  26. package/package.json +1 -1
  27. package/plugins/map/amqp-wx.js +173 -0
  28. package/{uni-ui/lib/mpvueGestureLock/index.vue → ui-cv/components/cv-draw-gesture-lock/cv-draw-gesture-lock.vue} +4 -1
  29. package/ui-cv/components/cv-draw-gesture-lock/gestureLock.js +169 -0
  30. package/{uni-ui/lib/mpvueGestureLock → ui-cv/components/cv-draw-gesture-lock}/style.css +0 -1
  31. package/{uni-ui/lib/mpvue-citypicker → ui-cv/components/cv-geo-region}/style.css +0 -1
  32. package/ui-cv/components/cv-grid-item/cv-grid-item.vue +1 -1
  33. package/uni-ui/lib/uni-badge/uni-badge.vue +150 -1
  34. package/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue +37 -1
  35. package/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue +83 -1
  36. package/uni-ui/lib/uni-calendar/uni-calendar-item.vue +122 -1
  37. package/uni-ui/lib/uni-calendar/uni-calendar.vue +366 -1
  38. package/uni-ui/lib/uni-card/uni-card.vue +124 -1
  39. package/uni-ui/lib/uni-col/uni-col.vue +1 -1
  40. package/uni-ui/lib/uni-collapse/uni-collapse.vue +135 -1
  41. package/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +266 -1
  42. package/uni-ui/lib/uni-combox/uni-combox.vue +1 -1
  43. package/uni-ui/lib/uni-countdown/uni-countdown.vue +239 -1
  44. package/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue +487 -1
  45. package/uni-ui/lib/uni-data-picker/uni-data-picker.vue +530 -1
  46. package/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +157 -150
  47. package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +166 -1
  48. package/uni-ui/lib/uni-data-select/uni-data-select.vue +289 -1
  49. package/uni-ui/lib/uni-datetime-picker/calendar-item.vue +70 -1
  50. package/uni-ui/lib/uni-datetime-picker/calendar.vue +629 -1
  51. package/uni-ui/lib/uni-datetime-picker/time-picker.vue +741 -1
  52. package/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +847 -1
  53. package/uni-ui/lib/uni-drawer/uni-drawer.vue +115 -1
  54. package/uni-ui/lib/uni-easyinput/uni-easyinput.vue +515 -1
  55. package/uni-ui/lib/uni-fab/uni-fab.vue +257 -1
  56. package/uni-ui/lib/uni-fav/uni-fav.vue +123 -1
  57. package/uni-ui/lib/uni-file-picker/uni-file-picker.vue +642 -1
  58. package/uni-ui/lib/uni-file-picker/upload-file.vue +177 -1
  59. package/uni-ui/lib/uni-file-picker/upload-image.vue +176 -1
  60. package/uni-ui/lib/uni-forms/uni-forms.vue +375 -1
  61. package/uni-ui/lib/uni-forms-item/uni-forms-item.vue +429 -1
  62. package/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +129 -1
  63. package/uni-ui/lib/uni-grid/uni-grid.vue +115 -1
  64. package/uni-ui/lib/uni-grid-item/uni-grid-item.vue +78 -1
  65. package/uni-ui/lib/uni-group/uni-group.vue +85 -1
  66. package/uni-ui/lib/uni-icons/uni-icons.vue +85 -1
  67. package/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +68 -1
  68. package/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +294 -1
  69. package/uni-ui/lib/uni-list/uni-list.vue +81 -1
  70. package/uni-ui/lib/uni-list-ad/uni-list-ad.vue +77 -1
  71. package/uni-ui/lib/uni-list-chat/uni-list-chat.vue +294 -1
  72. package/uni-ui/lib/uni-list-item/uni-list-item.vue +346 -1
  73. package/uni-ui/lib/uni-load-more/uni-load-more.vue +172 -1
  74. package/uni-ui/lib/uni-nav-bar/uni-nav-bar.vue +205 -1
  75. package/uni-ui/lib/uni-nav-bar/uni-status-bar.vue +18 -1
  76. package/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +331 -1
  77. package/uni-ui/lib/uni-number-box/uni-number-box.vue +166 -1
  78. package/uni-ui/lib/uni-pagination/uni-pagination.vue +323 -1
  79. package/uni-ui/lib/uni-popup/uni-popup.vue +1 -1
  80. package/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +173 -1
  81. package/uni-ui/lib/uni-popup-message/uni-popup-message.vue +74 -1
  82. package/uni-ui/lib/uni-popup-share/uni-popup-share.vue +106 -1
  83. package/uni-ui/lib/uni-rate/uni-rate.vue +322 -1
  84. package/uni-ui/lib/uni-row/uni-row.vue +1 -1
  85. package/uni-ui/lib/uni-search-bar/uni-search-bar.vue +236 -1
  86. package/uni-ui/lib/uni-section/uni-section.vue +109 -1
  87. package/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue +103 -1
  88. package/uni-ui/lib/uni-status-bar/uni-status-bar.vue +1 -1
  89. package/uni-ui/lib/uni-steps/uni-steps.vue +120 -1
  90. package/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +226 -3
  91. package/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue +167 -1
  92. package/uni-ui/lib/uni-table/uni-table.vue +297 -1
  93. package/uni-ui/lib/uni-tag/uni-tag.vue +100 -1
  94. package/uni-ui/lib/uni-td/uni-td.vue +78 -1
  95. package/uni-ui/lib/uni-th/filter-dropdown.vue +1 -1
  96. package/uni-ui/lib/uni-th/uni-th.vue +224 -1
  97. package/uni-ui/lib/uni-thead/uni-thead.vue +77 -1
  98. package/uni-ui/lib/uni-tr/table-checkbox.vue +79 -1
  99. package/uni-ui/lib/uni-tr/uni-tr.vue +135 -1
  100. package/uni-ui/lib/amap-wx/js/util.js +0 -181
  101. package/uni-ui/lib/marked/index.js +0 -1
  102. package/uni-ui/lib/mpvue-citypicker/city-data/area.js +0 -12542
  103. package/uni-ui/lib/mpvue-citypicker/city-data/city.js +0 -1503
  104. package/uni-ui/lib/mpvue-citypicker/city-data/province.js +0 -139
  105. package/uni-ui/lib/mpvue-picker/mpvuePicker.vue +0 -3
  106. package/uni-ui/lib/mpvueGestureLock/gestureLock.js +0 -175
  107. package/uni-ui/lib/uParse/src/components/style.css +0 -2
  108. package/uni-ui/lib/uParse/src/components/wxParseAudio.vue +0 -1
  109. package/uni-ui/lib/uParse/src/components/wxParseImg.vue +0 -1
  110. package/uni-ui/lib/uParse/src/components/wxParseTable.vue +0 -3
  111. package/uni-ui/lib/uParse/src/components/wxParseTemplate0.vue +0 -1
  112. package/uni-ui/lib/uParse/src/components/wxParseTemplate1.vue +0 -1
  113. package/uni-ui/lib/uParse/src/components/wxParseTemplate10.vue +0 -1
  114. package/uni-ui/lib/uParse/src/components/wxParseTemplate11.vue +0 -1
  115. package/uni-ui/lib/uParse/src/components/wxParseTemplate2.vue +0 -1
  116. package/uni-ui/lib/uParse/src/components/wxParseTemplate3.vue +0 -1
  117. package/uni-ui/lib/uParse/src/components/wxParseTemplate4.vue +0 -1
  118. package/uni-ui/lib/uParse/src/components/wxParseTemplate5.vue +0 -1
  119. package/uni-ui/lib/uParse/src/components/wxParseTemplate6.vue +0 -1
  120. package/uni-ui/lib/uParse/src/components/wxParseTemplate7.vue +0 -1
  121. package/uni-ui/lib/uParse/src/components/wxParseTemplate8.vue +0 -1
  122. package/uni-ui/lib/uParse/src/components/wxParseTemplate9.vue +0 -1
  123. package/uni-ui/lib/uParse/src/components/wxParseVideo.vue +0 -1
  124. package/uni-ui/lib/uParse/src/editor.css +0 -495
  125. package/uni-ui/lib/uParse/src/wxParse.vue +0 -1
  126. /package/{uni-ui/lib → other}/api-set-tabbar.nvue +0 -0
  127. /package/{uni-ui/lib → other}/mpvue-echarts/src/echarts.vue +0 -0
  128. /package/{uni-ui/lib → other}/mpvue-echarts/src/style.css +0 -0
  129. /package/{uni-ui/lib → other}/mpvue-echarts/src/wx-canvas.js +0 -0
  130. /package/{uni-ui/lib → other}/product.vue +0 -0
  131. /package/{uni-ui/lib → other}/style.css +0 -0
  132. /package/{uni-ui/lib → other}/tab-nvue/mediaList.vue +0 -0
  133. /package/{uni-ui/lib → other}/u-charts/u-charts.js +0 -0
  134. /package/{uni-ui/lib/uParse/src → other/uParse}/wxParse.css +0 -0
  135. /package/{uni-ui/lib/amap-wx → plugins/map}/lib/amap-wx.js +0 -0
  136. /package/{uni-ui/lib/mpvue-citypicker → ui-cv/components/cv-geo-region}/mpvueCityPicker.vue +0 -0
  137. /package/{uni-ui/lib/marked → ui-cv/components/cv-markdown-show}/lib/marked.js +0 -0
@@ -1 +1,224 @@
1
- <template>
2
1
  <!-- #ifdef H5 -->
3
2
  <th
4
3
  :rowspan="rowspan"
5
4
  :colspan="colspan"
6
5
  class="uni-table-th"
7
6
  :class="{ 'table--border': border }"
8
7
  :style="{ width: customWidth + 'px', 'text-align': align }"
9
8
  >
10
9
  <view class="uni-table-th-row">
11
10
  <view class="uni-table-th-content" :style="{ 'justify-content': contentAlign }" @click="sort">
12
11
  <slot></slot>
13
12
  <view v-if="sortable" class="arrow-box">
14
13
  <text class="arrow up" :class="{ active: ascending }" @click.stop="ascendingFn"></text>
15
14
  <text class="arrow down" :class="{ active: descending }" @click.stop="descendingFn"></text>
16
15
  </view>
17
16
  </view>
18
17
  <dropdown
19
18
  v-if="filterType || filterData.length"
20
19
  :filterDefaultValue="filterDefaultValue"
21
20
  :filterData="filterData"
22
21
  :filterType="filterType"
23
22
  @change="ondropdown"
24
23
  ></dropdown>
25
24
  </view>
26
25
  </th>
27
26
  <!-- #endif -->
28
27
  <!-- #ifndef H5 -->
29
28
  <view class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }">
30
29
  <slot></slot>
31
30
  </view>
32
31
  <!-- #endif -->
33
32
  * Th 表头
34
33
  * @description 表格内的表头单元格组件
35
34
  * @tutorial https://ext.dcloud.net.cn/plugin?id=3270
36
35
  * @property {Number | String} width 单元格宽度(支持纯数字、携带单位px或rpx)
37
36
  * @property {Boolean} sortable 是否启用排序
38
37
  * @property {Number} align = [left|center|right] 单元格对齐方式
39
38
  * @value left 单元格文字左侧对齐
40
39
  * @value center 单元格文字居中
41
40
  * @value right 单元格文字右侧对齐
42
41
  * @property {Array} filterData 筛选数据
43
42
  * @property {String} filterType [search|select] 筛选类型
44
43
  * @value search 关键字搜素
45
44
  * @value select 条件选择
46
45
  * @event {Function} sort-change 排序触发事件
47
46
  */
48
47
  name: 'uniTh',
49
48
  options: {
50
49
  virtualHost: true
51
50
  },
52
51
  components: {
53
52
  // #ifdef H5
54
53
  dropdown
55
54
  // #endif
56
55
  },
57
56
  emits: ['sort-change', 'filter-change'],
58
57
  props: {
59
58
  width: {
60
59
  type: [String, Number],
61
60
  default: ''
62
61
  },
63
62
  align: {
64
63
  type: String,
65
64
  default: 'left'
66
65
  },
67
66
  rowspan: {
68
67
  type: [Number, String],
69
68
  default: 1
70
69
  },
71
70
  colspan: {
72
71
  type: [Number, String],
73
72
  default: 1
74
73
  },
75
74
  sortable: {
76
75
  type: Boolean,
77
76
  default: false
78
77
  },
79
78
  filterType: {
80
79
  type: String,
81
80
  default: ''
82
81
  },
83
82
  filterData: {
84
83
  type: Array,
85
84
  default() {
86
85
  return [];
87
86
  }
88
87
  },
89
88
  filterDefaultValue: {
90
89
  type: [Array, String],
91
90
  default() {
92
91
  return '';
93
92
  }
94
93
  }
95
94
  },
96
95
  data() {
97
96
  return {
98
97
  border: false,
99
98
  ascending: false,
100
99
  descending: false
101
100
  };
102
101
  },
103
102
  computed: {
104
103
  // 根据props中的width属性 自动匹配当前th的宽度(px)
105
104
  customWidth() {
106
105
  if (typeof this.width === 'number') {
107
106
  return this.width;
108
107
  } else if (typeof this.width === 'string') {
109
108
  let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g);
110
109
  let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g);
111
110
  let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g);
112
111
  if (this.width.match(regexHaveUnitPx) !== null) {
113
112
  // 携带了 px
114
113
  return this.width.replace('px', '');
115
114
  } else if (this.width.match(regexHaveUnitRpx) !== null) {
116
115
  // 携带了 rpx
117
116
  let numberRpx = Number(this.width.replace('rpx', ''));
118
117
  let widthCoe = uni.getSystemInfoSync().screenWidth / 750;
119
118
  return Math.round(numberRpx * widthCoe);
120
119
  } else if (this.width.match(regexHaveNotUnit) !== null) {
121
120
  // 未携带 rpx或px 的纯数字 String
122
121
  return this.width;
123
122
  } else {
124
123
  // 不符合格式
125
124
  return '';
126
125
  }
127
126
  } else {
128
127
  return '';
129
128
  }
130
129
  },
131
130
  contentAlign() {
132
131
  let align = 'left';
133
132
  switch (this.align) {
134
133
  case 'left':
135
134
  align = 'flex-start';
136
135
  break;
137
136
  case 'center':
138
137
  align = 'center';
139
138
  break;
140
139
  case 'right':
141
140
  align = 'flex-end';
142
141
  break;
143
142
  }
144
143
  return align;
145
144
  }
146
145
  },
147
146
  created() {
148
147
  this.root = this.getTable('uniTable');
149
148
  this.rootTr = this.getTable('uniTr');
150
149
  this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140);
151
150
  this.border = this.root.border;
152
151
  this.root.thChildren.push(this);
153
152
  },
154
153
  methods: {
155
154
  sort() {
156
155
  if (!this.sortable) return;
157
156
  this.clearOther();
158
157
  if (!this.ascending && !this.descending) {
159
158
  this.ascending = true;
160
159
  this.$emit('sort-change', { order: 'ascending' });
161
160
  return;
162
161
  }
163
162
  if (this.ascending && !this.descending) {
164
163
  this.ascending = false;
165
164
  this.descending = true;
166
165
  this.$emit('sort-change', { order: 'descending' });
167
166
  return;
168
167
  }
169
168
  if (!this.ascending && this.descending) {
170
169
  this.ascending = false;
171
170
  this.descending = false;
172
171
  this.$emit('sort-change', { order: null });
173
172
  }
174
173
  },
175
174
  ascendingFn() {
176
175
  this.clearOther();
177
176
  this.ascending = !this.ascending;
178
177
  this.descending = false;
179
178
  this.$emit('sort-change', { order: this.ascending ? 'ascending' : null });
180
179
  },
181
180
  descendingFn() {
182
181
  this.clearOther();
183
182
  this.descending = !this.descending;
184
183
  this.ascending = false;
185
184
  this.$emit('sort-change', { order: this.descending ? 'descending' : null });
186
185
  },
187
186
  clearOther() {
188
187
  this.root.thChildren.map((item) => {
189
188
  if (item !== this) {
190
189
  item.ascending = false;
191
190
  item.descending = false;
192
191
  }
193
192
  return item;
194
193
  });
195
194
  },
196
195
  ondropdown(e) {
197
196
  this.$emit('filter-change', e);
198
197
  },
199
198
  /**
200
199
  * 获取父元素实例
201
200
  */
202
201
  getTable(name) {
203
202
  let parent = this.$parent;
204
203
  let parentName = parent.$options.name;
205
204
  while (parentName !== name) {
206
205
  parent = parent.$parent;
207
206
  if (!parent) return false;
208
207
  parentName = parent.$options.name;
209
208
  }
210
209
  return parent;
211
210
  }
212
211
  }
212
+ <template>
213
+ <!-- #ifdef H5 -->
214
+ <th
215
+ :rowspan="rowspan"
216
+ :colspan="colspan"
217
+ class="uni-table-th"
218
+ :class="{ 'table--border': border }"
219
+ :style="{ width: customWidth + 'px', 'text-align': align }"
220
+ >
221
+ <view class="uni-table-th-row">
222
+ <view class="uni-table-th-content" :style="{ 'justify-content': contentAlign }" @click="sort">
223
+ <slot></slot>
224
+ <view v-if="sortable" class="arrow-box">
225
+ <text class="arrow up" :class="{ active: ascending }" @click.stop="ascendingFn"></text>
226
+ <text class="arrow down" :class="{ active: descending }" @click.stop="descendingFn"></text>
227
+ </view>
228
+ </view>
229
+ <dropdown
230
+ v-if="filterType || filterData.length"
231
+ :filterDefaultValue="filterDefaultValue"
232
+ :filterData="filterData"
233
+ :filterType="filterType"
234
+ @change="ondropdown"
235
+ ></dropdown>
236
+ </view>
237
+ </th>
238
+ <!-- #endif -->
239
+ <!-- #ifndef H5 -->
240
+ <view class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }">
241
+ <slot></slot>
242
+ </view>
243
+ <!-- #endif -->
244
+ </template>
245
+ <script>
246
+ // #ifdef H5
247
+ import dropdown from './filter-dropdown.vue';
248
+ // #endif
249
+ /**
250
+ * Th 表头
251
+ * @description 表格内的表头单元格组件
252
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=3270
253
+ * @property {Number | String} width 单元格宽度(支持纯数字、携带单位px或rpx)
254
+ * @property {Boolean} sortable 是否启用排序
255
+ * @property {Number} align = [left|center|right] 单元格对齐方式
256
+ * @value left 单元格文字左侧对齐
257
+ * @value center 单元格文字居中
258
+ * @value right 单元格文字右侧对齐
259
+ * @property {Array} filterData 筛选数据
260
+ * @property {String} filterType [search|select] 筛选类型
261
+ * @value search 关键字搜素
262
+ * @value select 条件选择
263
+ * @event {Function} sort-change 排序触发事件
264
+ */
265
+ export default {
266
+ name: 'uniTh',
267
+ options: {
268
+ virtualHost: true
269
+ },
270
+ components: {
271
+ // #ifdef H5
272
+ dropdown
273
+ // #endif
274
+ },
275
+ emits: ['sort-change', 'filter-change'],
276
+ props: {
277
+ width: {
278
+ type: [String, Number],
279
+ default: ''
280
+ },
281
+ align: {
282
+ type: String,
283
+ default: 'left'
284
+ },
285
+ rowspan: {
286
+ type: [Number, String],
287
+ default: 1
288
+ },
289
+ colspan: {
290
+ type: [Number, String],
291
+ default: 1
292
+ },
293
+ sortable: {
294
+ type: Boolean,
295
+ default: false
296
+ },
297
+ filterType: {
298
+ type: String,
299
+ default: ''
300
+ },
301
+ filterData: {
302
+ type: Array,
303
+ default() {
304
+ return [];
305
+ }
306
+ },
307
+ filterDefaultValue: {
308
+ type: [Array, String],
309
+ default() {
310
+ return '';
311
+ }
312
+ }
313
+ },
314
+ data() {
315
+ return {
316
+ border: false,
317
+ ascending: false,
318
+ descending: false
319
+ };
320
+ },
321
+ computed: {
322
+ // 根据props中的width属性 自动匹配当前th的宽度(px)
323
+ customWidth() {
324
+ if (typeof this.width === 'number') {
325
+ return this.width;
326
+ } else if (typeof this.width === 'string') {
327
+ let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g);
328
+ let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g);
329
+ let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g);
330
+ if (this.width.match(regexHaveUnitPx) !== null) {
331
+ // 携带了 px
332
+ return this.width.replace('px', '');
333
+ } else if (this.width.match(regexHaveUnitRpx) !== null) {
334
+ // 携带了 rpx
335
+ let numberRpx = Number(this.width.replace('rpx', ''));
336
+ let widthCoe = uni.getSystemInfoSync().screenWidth / 750;
337
+ return Math.round(numberRpx * widthCoe);
338
+ } else if (this.width.match(regexHaveNotUnit) !== null) {
339
+ // 未携带 rpx或px 的纯数字 String
340
+ return this.width;
341
+ } else {
342
+ // 不符合格式
343
+ return '';
344
+ }
345
+ } else {
346
+ return '';
347
+ }
348
+ },
349
+ contentAlign() {
350
+ let align = 'left';
351
+ switch (this.align) {
352
+ case 'left':
353
+ align = 'flex-start';
354
+ break;
355
+ case 'center':
356
+ align = 'center';
357
+ break;
358
+ case 'right':
359
+ align = 'flex-end';
360
+ break;
361
+ }
362
+ return align;
363
+ }
364
+ },
365
+ created() {
366
+ this.root = this.getTable('uniTable');
367
+ this.rootTr = this.getTable('uniTr');
368
+ this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140);
369
+ this.border = this.root.border;
370
+ this.root.thChildren.push(this);
371
+ },
372
+ methods: {
373
+ sort() {
374
+ if (!this.sortable) return;
375
+ this.clearOther();
376
+ if (!this.ascending && !this.descending) {
377
+ this.ascending = true;
378
+ this.$emit('sort-change', { order: 'ascending' });
379
+ return;
380
+ }
381
+ if (this.ascending && !this.descending) {
382
+ this.ascending = false;
383
+ this.descending = true;
384
+ this.$emit('sort-change', { order: 'descending' });
385
+ return;
386
+ }
387
+ if (!this.ascending && this.descending) {
388
+ this.ascending = false;
389
+ this.descending = false;
390
+ this.$emit('sort-change', { order: null });
391
+ }
392
+ },
393
+ ascendingFn() {
394
+ this.clearOther();
395
+ this.ascending = !this.ascending;
396
+ this.descending = false;
397
+ this.$emit('sort-change', { order: this.ascending ? 'ascending' : null });
398
+ },
399
+ descendingFn() {
400
+ this.clearOther();
401
+ this.descending = !this.descending;
402
+ this.ascending = false;
403
+ this.$emit('sort-change', { order: this.descending ? 'descending' : null });
404
+ },
405
+ clearOther() {
406
+ this.root.thChildren.map((item) => {
407
+ if (item !== this) {
408
+ item.ascending = false;
409
+ item.descending = false;
410
+ }
411
+ return item;
412
+ });
413
+ },
414
+ ondropdown(e) {
415
+ this.$emit('filter-change', e);
416
+ },
417
+ /**
418
+ * 获取父元素实例
419
+ */
420
+ getTable(name) {
421
+ let parent = this.$parent;
422
+ let parentName = parent.$options.name;
423
+ while (parentName !== name) {
424
+ parent = parent.$parent;
425
+ if (!parent) return false;
426
+ parentName = parent.$options.name;
427
+ }
428
+ return parent;
429
+ }
430
+ }
431
+ };
432
+ </script>
433
+ <style>
434
+ @import 'style.css';
435
+ </style>
@@ -1 +1,77 @@
1
- <template>
2
1
  <!-- #ifdef H5 -->
3
2
  <thead class="uni-table-thead">
4
3
  <tr class="uni-table-tr">
5
4
  <th :rowspan="rowspan" colspan="1" class="checkbox" :class="{ 'tr-table--border': border }">
6
5
  <table-checkbox :indeterminate="indeterminate" :checked="checked" @checkboxSelected="checkboxSelected"></table-checkbox>
7
6
  </th>
8
7
  </tr>
9
8
  <slot></slot>
10
9
  </thead>
11
10
  <!-- #endif -->
12
11
  <!-- #ifndef H5 -->
13
12
  <view class="uni-table-thead"><slot></slot></view>
14
13
  <!-- #endif -->
15
14
  name: 'uniThead',
16
15
  components: {
17
16
  tableCheckbox
18
17
  },
19
18
  options: {
20
19
  virtualHost: true
21
20
  },
22
21
  data() {
23
22
  return {
24
23
  border: false,
25
24
  selection: false,
26
25
  rowspan: 1,
27
26
  indeterminate: false,
28
27
  checked: false
29
28
  };
30
29
  },
31
30
  created() {
32
31
  this.root = this.getTable();
33
32
  // #ifdef H5
34
33
  this.root.theadChildren = this;
35
34
  // #endif
36
35
  this.border = this.root.border;
37
36
  this.selection = this.root.type;
38
37
  },
39
38
  methods: {
40
39
  init(self) {
41
40
  this.rowspan++;
42
41
  },
43
42
  checkboxSelected(e) {
44
43
  this.indeterminate = false;
45
44
  const backIndexData = this.root.backIndexData;
46
45
  const data = this.root.trChildren.filter((v) => !v.disabled && v.keyValue);
47
46
  if (backIndexData.length === data.length) {
48
47
  this.checked = false;
49
48
  this.root.clearSelection();
50
49
  } else {
51
50
  this.checked = true;
52
51
  this.root.selectionAll();
53
52
  }
54
53
  },
55
54
  /**
56
55
  * 获取父元素实例
57
56
  */
58
57
  getTable(name = 'uniTable') {
59
58
  let parent = this.$parent;
60
59
  let parentName = parent.$options.name;
61
60
  while (parentName !== name) {
62
61
  parent = parent.$parent;
63
62
  if (!parent) return false;
64
63
  parentName = parent.$options.name;
65
64
  }
66
65
  return parent;
67
66
  }
68
67
  }
68
+ <template>
69
+ <!-- #ifdef H5 -->
70
+ <thead class="uni-table-thead">
71
+ <tr class="uni-table-tr">
72
+ <th :rowspan="rowspan" colspan="1" class="checkbox" :class="{ 'tr-table--border': border }">
73
+ <table-checkbox :indeterminate="indeterminate" :checked="checked" @checkboxSelected="checkboxSelected"></table-checkbox>
74
+ </th>
75
+ </tr>
76
+ <slot></slot>
77
+ </thead>
78
+ <!-- #endif -->
79
+ <!-- #ifndef H5 -->
80
+ <view class="uni-table-thead"><slot></slot></view>
81
+ <!-- #endif -->
82
+ </template>
83
+ <script>
84
+ import tableCheckbox from '../uni-tr/table-checkbox.vue';
85
+ export default {
86
+ name: 'uniThead',
87
+ components: {
88
+ tableCheckbox
89
+ },
90
+ options: {
91
+ virtualHost: true
92
+ },
93
+ data() {
94
+ return {
95
+ border: false,
96
+ selection: false,
97
+ rowspan: 1,
98
+ indeterminate: false,
99
+ checked: false
100
+ };
101
+ },
102
+ created() {
103
+ this.root = this.getTable();
104
+ // #ifdef H5
105
+ this.root.theadChildren = this;
106
+ // #endif
107
+ this.border = this.root.border;
108
+ this.selection = this.root.type;
109
+ },
110
+ methods: {
111
+ init(self) {
112
+ this.rowspan++;
113
+ },
114
+ checkboxSelected(e) {
115
+ this.indeterminate = false;
116
+ const backIndexData = this.root.backIndexData;
117
+ const data = this.root.trChildren.filter((v) => !v.disabled && v.keyValue);
118
+ if (backIndexData.length === data.length) {
119
+ this.checked = false;
120
+ this.root.clearSelection();
121
+ } else {
122
+ this.checked = true;
123
+ this.root.selectionAll();
124
+ }
125
+ },
126
+ /**
127
+ * 获取父元素实例
128
+ */
129
+ getTable(name = 'uniTable') {
130
+ let parent = this.$parent;
131
+ let parentName = parent.$options.name;
132
+ while (parentName !== name) {
133
+ parent = parent.$parent;
134
+ if (!parent) return false;
135
+ parentName = parent.$options.name;
136
+ }
137
+ return parent;
138
+ }
139
+ }
140
+ };
141
+ </script>
142
+ <style>
143
+ @import 'style.css';
144
+ </style>