@vtj/materials 0.13.16 → 0.13.18

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 (127) hide show
  1. package/dist/assets/antdv/index.umd.js +2 -2
  2. package/dist/assets/charts/index.umd.js +2 -2
  3. package/dist/assets/element/index.umd.js +3 -3
  4. package/dist/assets/icons/index.umd.js +2 -2
  5. package/dist/assets/ui/index.umd.js +2 -2
  6. package/dist/assets/uni-h5/index.umd.js +2 -2
  7. package/dist/assets/uni-ui/index.umd.js +2 -2
  8. package/dist/assets/vant/index.umd.js +2 -2
  9. package/dist/deps/@vtj/charts/index.umd.js +2 -2
  10. package/dist/deps/@vtj/icons/index.umd.js +2 -2
  11. package/dist/deps/@vtj/ui/index.umd.js +4 -4
  12. package/dist/deps/@vtj/ui/style.css +1 -1
  13. package/dist/deps/@vtj/utils/index.umd.js +28 -33
  14. package/dist/deps/@vueuse/core/index.iife.min.js +1 -1
  15. package/dist/deps/element-plus/index.css +1 -1
  16. package/dist/deps/element-plus/index.full.min.js +14 -14
  17. package/dist/deps/element-plus/zh-cn.js +1 -1
  18. package/dist/deps/uni-app/index.umd.js +1 -1
  19. package/dist/deps/uni-h5/index.umd.js +8 -8
  20. package/dist/deps/uni-h5/style.css +1 -1
  21. package/dist/deps/uni-h5-vue/index.umd.js +1 -1
  22. package/dist/deps/uni-ui/index.umd.js +1 -1
  23. package/dist/deps/uni-ui/style.css +1 -1
  24. package/dist/deps/vue/vue.global.js +88 -53
  25. package/dist/deps/vue/vue.global.prod.js +9 -9
  26. package/package.json +12 -12
  27. package/src/antdv/image.ts +1 -1
  28. package/src/element/image.ts +1 -1
  29. package/src/element/virtualizedTable.ts +6 -6
  30. package/src/manifest.json +69 -0
  31. package/src/pages/index.vue +2 -0
  32. package/src/pages.json +19 -0
  33. package/src/uni-ui/index.ts +88 -58
  34. package/src/{uni-ui/lib/uni.scss → uni.scss} +4 -0
  35. package/src/version.ts +2 -2
  36. package/src/uni-ui/lib/uni-col/uni-col.vue +0 -324
  37. package/src/uni-ui/lib/uni-collapse/uni-collapse.vue +0 -153
  38. package/src/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +0 -425
  39. package/src/uni-ui/lib/uni-data-picker/keypress.js +0 -45
  40. package/src/uni-ui/lib/uni-data-picker/uni-data-picker.vue +0 -604
  41. package/src/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +0 -622
  42. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +0 -76
  43. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +0 -335
  44. package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +0 -590
  45. package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +0 -188
  46. package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +0 -985
  47. package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +0 -22
  48. package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +0 -8
  49. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hans.json +0 -22
  50. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hant.json +0 -22
  51. package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +0 -1032
  52. package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +0 -1230
  53. package/src/uni-ui/lib/uni-datetime-picker/util.js +0 -448
  54. package/src/uni-ui/lib/uni-easyinput/common.js +0 -54
  55. package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +0 -790
  56. package/src/uni-ui/lib/uni-fav/i18n/en.json +0 -4
  57. package/src/uni-ui/lib/uni-fav/i18n/index.js +0 -8
  58. package/src/uni-ui/lib/uni-fav/i18n/zh-Hans.json +0 -4
  59. package/src/uni-ui/lib/uni-fav/i18n/zh-Hant.json +0 -4
  60. package/src/uni-ui/lib/uni-fav/uni-fav.vue +0 -170
  61. package/src/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +0 -280
  62. package/src/uni-ui/lib/uni-file-picker/uni-file-picker.vue +0 -668
  63. package/src/uni-ui/lib/uni-file-picker/upload-file.vue +0 -325
  64. package/src/uni-ui/lib/uni-file-picker/upload-image.vue +0 -292
  65. package/src/uni-ui/lib/uni-file-picker/utils.js +0 -110
  66. package/src/uni-ui/lib/uni-forms/uni-forms.vue +0 -416
  67. package/src/uni-ui/lib/uni-forms/utils.js +0 -293
  68. package/src/uni-ui/lib/uni-forms/validate.js +0 -486
  69. package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +0 -630
  70. package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +0 -6
  71. package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +0 -8
  72. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +0 -6
  73. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +0 -6
  74. package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +0 -231
  75. package/src/uni-ui/lib/uni-grid/uni-grid.vue +0 -148
  76. package/src/uni-ui/lib/uni-icons/uni-icons.uvue +0 -91
  77. package/src/uni-ui/lib/uni-icons/uni-icons.vue +0 -114
  78. package/src/uni-ui/lib/uni-icons/uniicons.css +0 -664
  79. package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
  80. package/src/uni-ui/lib/uni-icons/uniicons_file.ts +0 -664
  81. package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +0 -649
  82. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +0 -168
  83. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +0 -404
  84. package/src/uni-ui/lib/uni-list/uni-list.vue +0 -123
  85. package/src/uni-ui/lib/uni-list/uni-refresh.vue +0 -65
  86. package/src/uni-ui/lib/uni-list/uni-refresh.wxs +0 -87
  87. package/src/uni-ui/lib/uni-load-more/i18n/en.json +0 -5
  88. package/src/uni-ui/lib/uni-load-more/i18n/index.js +0 -8
  89. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hans.json +0 -5
  90. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hant.json +0 -5
  91. package/src/uni-ui/lib/uni-load-more/uni-load-more.vue +0 -456
  92. package/src/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +0 -484
  93. package/src/uni-ui/lib/uni-popup/i18n/en.json +0 -7
  94. package/src/uni-ui/lib/uni-popup/i18n/index.js +0 -8
  95. package/src/uni-ui/lib/uni-popup/i18n/zh-Hans.json +0 -7
  96. package/src/uni-ui/lib/uni-popup/i18n/zh-Hant.json +0 -7
  97. package/src/uni-ui/lib/uni-popup/keypress.js +0 -45
  98. package/src/uni-ui/lib/uni-popup/popup.js +0 -26
  99. package/src/uni-ui/lib/uni-popup/uni-popup.uvue +0 -90
  100. package/src/uni-ui/lib/uni-popup/uni-popup.vue +0 -552
  101. package/src/uni-ui/lib/uni-popup-dialog/keypress.js +0 -45
  102. package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +0 -324
  103. package/src/uni-ui/lib/uni-popup-message/uni-popup-message.vue +0 -149
  104. package/src/uni-ui/lib/uni-rate/uni-rate.vue +0 -380
  105. package/src/uni-ui/lib/uni-row/uni-row.vue +0 -193
  106. package/src/uni-ui/lib/uni-search-bar/i18n/en.json +0 -4
  107. package/src/uni-ui/lib/uni-search-bar/i18n/index.js +0 -8
  108. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hans.json +0 -4
  109. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hant.json +0 -4
  110. package/src/uni-ui/lib/uni-search-bar/uni-search-bar.vue +0 -339
  111. package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +0 -311
  112. package/src/uni-ui/lib/uni-swipe-action-item/isPC.js +0 -12
  113. package/src/uni-ui/lib/uni-swipe-action-item/mpalipay.js +0 -195
  114. package/src/uni-ui/lib/uni-swipe-action-item/mpother.js +0 -260
  115. package/src/uni-ui/lib/uni-swipe-action-item/mpwxs.js +0 -84
  116. package/src/uni-ui/lib/uni-swipe-action-item/render.js +0 -270
  117. package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +0 -493
  118. package/src/uni-ui/lib/uni-swipe-action-item/wx.wxs +0 -341
  119. package/src/uni-ui/lib/uni-table/uni-table.vue +0 -496
  120. package/src/uni-ui/lib/uni-td/uni-td.vue +0 -99
  121. package/src/uni-ui/lib/uni-th/filter-dropdown.vue +0 -559
  122. package/src/uni-ui/lib/uni-th/uni-th.vue +0 -322
  123. package/src/uni-ui/lib/uni-tr/table-checkbox.vue +0 -181
  124. package/src/uni-ui/lib/uni-tr/uni-tr.vue +0 -208
  125. package/src/uni-ui/lib/uni-transition/createAnimation.js +0 -131
  126. package/src/uni-ui/lib/uni-transition/uni-transition.vue +0 -310
  127. package/src/uni-ui/polyfill.ts +0 -41
@@ -1,322 +0,0 @@
1
- <template>
2
- <!-- #ifdef H5 -->
3
- <th
4
- :rowspan="rowspan"
5
- :colspan="colspan"
6
- class="uni-table-th"
7
- :class="{ 'table--border': border }"
8
- :style="{ width: customWidth + 'px', 'text-align': align }">
9
- <view class="uni-table-th-row">
10
- <view
11
- class="uni-table-th-content"
12
- :style="{ 'justify-content': contentAlign }"
13
- @click="sort">
14
- <slot></slot>
15
- <view v-if="sortable" class="arrow-box">
16
- <text
17
- class="arrow up"
18
- :class="{ active: ascending }"
19
- @click.stop="ascendingFn"></text>
20
- <text
21
- class="arrow down"
22
- :class="{ active: descending }"
23
- @click.stop="descendingFn"></text>
24
- </view>
25
- </view>
26
- <dropdown
27
- v-if="filterType || filterData.length"
28
- :filterDefaultValue="filterDefaultValue"
29
- :filterData="filterData"
30
- :filterType="filterType"
31
- @change="ondropdown"></dropdown>
32
- </view>
33
- </th>
34
- <!-- #endif -->
35
- <!-- #ifndef H5 -->
36
- <!-- <view class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }"><slot></slot></view> -->
37
- <!-- #endif -->
38
- </template>
39
-
40
- <script>
41
- // #ifdef H5
42
- import dropdown from './filter-dropdown.vue';
43
- // #endif
44
- /**
45
- * Th 表头
46
- * @description 表格内的表头单元格组件
47
- * @tutorial https://ext.dcloud.net.cn/plugin?id=3270
48
- * @property {Number | String} width 单元格宽度(支持纯数字、携带单位px或rpx)
49
- * @property {Boolean} sortable 是否启用排序
50
- * @property {Number} align = [left|center|right] 单元格对齐方式
51
- * @value left 单元格文字左侧对齐
52
- * @value center 单元格文字居中
53
- * @value right 单元格文字右侧对齐
54
- * @property {Array} filterData 筛选数据
55
- * @property {String} filterType [search|select] 筛选类型
56
- * @value search 关键字搜素
57
- * @value select 条件选择
58
- * @event {Function} sort-change 排序触发事件
59
- */
60
- export default {
61
- name: 'uniTh',
62
- options: {
63
- // #ifdef MP-TOUTIAO
64
- virtualHost: false,
65
- // #endif
66
- // #ifndef MP-TOUTIAO
67
- virtualHost: true
68
- // #endif
69
- },
70
- components: {
71
- // #ifdef H5
72
- dropdown
73
- // #endif
74
- },
75
- emits: ['sort-change', 'filter-change'],
76
- props: {
77
- width: {
78
- type: [String, Number],
79
- default: ''
80
- },
81
- align: {
82
- type: String,
83
- default: 'left'
84
- },
85
- rowspan: {
86
- type: [Number, String],
87
- default: 1
88
- },
89
- colspan: {
90
- type: [Number, String],
91
- default: 1
92
- },
93
- sortable: {
94
- type: Boolean,
95
- default: false
96
- },
97
- filterType: {
98
- type: String,
99
- default: ''
100
- },
101
- filterData: {
102
- type: Array,
103
- default() {
104
- return [];
105
- }
106
- },
107
- filterDefaultValue: {
108
- type: [Array, String],
109
- default() {
110
- return '';
111
- }
112
- }
113
- },
114
- data() {
115
- return {
116
- border: false,
117
- ascending: false,
118
- descending: false
119
- };
120
- },
121
- computed: {
122
- // 根据props中的width属性 自动匹配当前th的宽度(px)
123
- customWidth() {
124
- if (typeof this.width === 'number') {
125
- return this.width;
126
- } else if (typeof this.width === 'string') {
127
- let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g);
128
- let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g);
129
- let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g);
130
- if (this.width.match(regexHaveUnitPx) !== null) {
131
- // 携带了 px
132
- return this.width.replace('px', '');
133
- } else if (this.width.match(regexHaveUnitRpx) !== null) {
134
- // 携带了 rpx
135
- let numberRpx = Number(this.width.replace('rpx', ''));
136
- // #ifdef MP-WEIXIN
137
- let widthCoe = uni.getWindowInfo().screenWidth / 750;
138
- // #endif
139
- // #ifndef MP-WEIXIN
140
- // let widthCoe = uni.getSystemInfoSync().screenWidth / 750
141
- // #endif
142
- return Math.round(numberRpx * widthCoe);
143
- } else if (this.width.match(regexHaveNotUnit) !== null) {
144
- // 未携带 rpx或px 的纯数字 String
145
- return this.width;
146
- } else {
147
- // 不符合格式
148
- return '';
149
- }
150
- } else {
151
- return '';
152
- }
153
- },
154
- contentAlign() {
155
- let align = 'left';
156
- switch (this.align) {
157
- case 'left':
158
- align = 'flex-start';
159
- break;
160
- case 'center':
161
- align = 'center';
162
- break;
163
- case 'right':
164
- align = 'flex-end';
165
- break;
166
- }
167
- return align;
168
- }
169
- },
170
- created() {
171
- this.root = this.getTable('uniTable');
172
- this.rootTr = this.getTable('uniTr');
173
- this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140);
174
- this.border = this.root.border;
175
- this.root.thChildren.push(this);
176
- },
177
- methods: {
178
- sort() {
179
- if (!this.sortable) return;
180
- this.clearOther();
181
- if (!this.ascending && !this.descending) {
182
- this.ascending = true;
183
- this.$emit('sort-change', { order: 'ascending' });
184
- return;
185
- }
186
- if (this.ascending && !this.descending) {
187
- this.ascending = false;
188
- this.descending = true;
189
- this.$emit('sort-change', { order: 'descending' });
190
- return;
191
- }
192
-
193
- if (!this.ascending && this.descending) {
194
- this.ascending = false;
195
- this.descending = false;
196
- this.$emit('sort-change', { order: null });
197
- }
198
- },
199
- ascendingFn() {
200
- this.clearOther();
201
- this.ascending = !this.ascending;
202
- this.descending = false;
203
- this.$emit('sort-change', {
204
- order: this.ascending ? 'ascending' : null
205
- });
206
- },
207
- descendingFn() {
208
- this.clearOther();
209
- this.descending = !this.descending;
210
- this.ascending = false;
211
- this.$emit('sort-change', {
212
- order: this.descending ? 'descending' : null
213
- });
214
- },
215
- clearOther() {
216
- this.root.thChildren.map((item) => {
217
- if (item !== this) {
218
- item.ascending = false;
219
- item.descending = false;
220
- }
221
- return item;
222
- });
223
- },
224
- ondropdown(e) {
225
- this.$emit('filter-change', e);
226
- },
227
- /**
228
- * 获取父元素实例
229
- */
230
- getTable(name) {
231
- let parent = this.$parent;
232
- let parentName = parent.$options.name;
233
- while (parentName !== name) {
234
- parent = parent.$parent;
235
- if (!parent) return false;
236
- parentName = parent.$options.name;
237
- }
238
- return parent;
239
- }
240
- }
241
- };
242
- </script>
243
-
244
- <style lang="scss">
245
- $border-color: #ebeef5;
246
- $uni-primary: #007aff !default;
247
-
248
- .uni-table-th {
249
- padding: 12px 10px;
250
- /* #ifndef APP-NVUE */
251
- display: table-cell;
252
- box-sizing: border-box;
253
- /* #endif */
254
- font-size: 14px;
255
- font-weight: bold;
256
- color: #909399;
257
- border-bottom: 1px $border-color solid;
258
- }
259
-
260
- .uni-table-th-row {
261
- /* #ifndef APP-NVUE */
262
- display: flex;
263
- /* #endif */
264
- flex-direction: row;
265
- }
266
-
267
- .table--border {
268
- border-right: 1px $border-color solid;
269
- }
270
- .uni-table-th-content {
271
- display: flex;
272
- align-items: center;
273
- flex: 1;
274
- }
275
- .arrow-box {
276
- }
277
- .arrow {
278
- display: block;
279
- position: relative;
280
- width: 10px;
281
- height: 8px;
282
- // border: 1px red solid;
283
- left: 5px;
284
- overflow: hidden;
285
- cursor: pointer;
286
- }
287
- .down {
288
- top: 3px;
289
- ::after {
290
- content: '';
291
- width: 8px;
292
- height: 8px;
293
- position: absolute;
294
- left: 2px;
295
- top: -5px;
296
- transform: rotate(45deg);
297
- background-color: #ccc;
298
- }
299
- &.active {
300
- ::after {
301
- background-color: $uni-primary;
302
- }
303
- }
304
- }
305
- .up {
306
- ::after {
307
- content: '';
308
- width: 8px;
309
- height: 8px;
310
- position: absolute;
311
- left: 2px;
312
- top: 5px;
313
- transform: rotate(45deg);
314
- background-color: #ccc;
315
- }
316
- &.active {
317
- ::after {
318
- background-color: $uni-primary;
319
- }
320
- }
321
- }
322
- </style>
@@ -1,181 +0,0 @@
1
- <template>
2
- <view class="uni-table-checkbox" @click="selected">
3
- <view
4
- v-if="!indeterminate"
5
- class="checkbox__inner"
6
- :class="{ 'is-checked': isChecked, 'is-disable': isDisabled }">
7
- <view class="checkbox__inner-icon"></view>
8
- </view>
9
- <view v-else class="checkbox__inner checkbox--indeterminate">
10
- <view class="checkbox__inner-icon"></view>
11
- </view>
12
- </view>
13
- </template>
14
-
15
- <script>
16
- export default {
17
- name: 'TableCheckbox',
18
- emits: ['checkboxSelected'],
19
- props: {
20
- indeterminate: {
21
- type: Boolean,
22
- default: false
23
- },
24
- checked: {
25
- type: [Boolean, String],
26
- default: false
27
- },
28
- disabled: {
29
- type: Boolean,
30
- default: false
31
- },
32
- index: {
33
- type: Number,
34
- default: -1
35
- },
36
- cellData: {
37
- type: Object,
38
- default() {
39
- return {};
40
- }
41
- }
42
- },
43
- watch: {
44
- checked(newVal) {
45
- if (typeof this.checked === 'boolean') {
46
- this.isChecked = newVal;
47
- } else {
48
- this.isChecked = true;
49
- }
50
- },
51
- indeterminate(newVal) {
52
- this.isIndeterminate = newVal;
53
- }
54
- },
55
- data() {
56
- return {
57
- isChecked: false,
58
- isDisabled: false,
59
- isIndeterminate: false
60
- };
61
- },
62
- created() {
63
- if (typeof this.checked === 'boolean') {
64
- this.isChecked = this.checked;
65
- }
66
- this.isDisabled = this.disabled;
67
- },
68
- methods: {
69
- selected() {
70
- if (this.isDisabled) return;
71
- this.isIndeterminate = false;
72
- this.isChecked = !this.isChecked;
73
- this.$emit('checkboxSelected', {
74
- checked: this.isChecked,
75
- data: this.cellData
76
- });
77
- }
78
- }
79
- };
80
- </script>
81
-
82
- <style lang="scss">
83
- $uni-primary: #007aff !default;
84
- $border-color: #dcdfe6;
85
- $disable: 0.4;
86
-
87
- .uni-table-checkbox {
88
- display: flex;
89
- flex-direction: row;
90
- align-items: center;
91
- justify-content: center;
92
- position: relative;
93
- margin: 5px 0;
94
- cursor: pointer;
95
-
96
- // 多选样式
97
- .checkbox__inner {
98
- /* #ifndef APP-NVUE */
99
- flex-shrink: 0;
100
- box-sizing: border-box;
101
- /* #endif */
102
- position: relative;
103
- width: 16px;
104
- height: 16px;
105
- border: 1px solid $border-color;
106
- border-radius: 2px;
107
- background-color: #fff;
108
- z-index: 1;
109
-
110
- .checkbox__inner-icon {
111
- position: absolute;
112
- /* #ifdef APP-NVUE */
113
- top: 2px;
114
- /* #endif */
115
- /* #ifndef APP-NVUE */
116
- top: 2px;
117
- /* #endif */
118
- left: 5px;
119
- height: 7px;
120
- width: 3px;
121
- border: 1px solid #fff;
122
- border-left: 0;
123
- border-top: 0;
124
- opacity: 0;
125
- transform-origin: center;
126
- transform: rotate(45deg);
127
- box-sizing: content-box;
128
- }
129
-
130
- &.checkbox--indeterminate {
131
- border-color: $uni-primary;
132
- background-color: $uni-primary;
133
-
134
- .checkbox__inner-icon {
135
- position: absolute;
136
- opacity: 1;
137
- transform: rotate(0deg);
138
- height: 2px;
139
- top: 0;
140
- bottom: 0;
141
- margin: auto;
142
- left: 0px;
143
- right: 0px;
144
- bottom: 0;
145
- width: auto;
146
- border: none;
147
- border-radius: 2px;
148
- transform: scale(0.5);
149
- background-color: #fff;
150
- }
151
- }
152
- &:hover {
153
- border-color: $uni-primary;
154
- }
155
- // 禁用
156
- &.is-disable {
157
- /* #ifdef H5 */
158
- cursor: not-allowed;
159
- /* #endif */
160
- background-color: #f2f6fc;
161
- border-color: $border-color;
162
- }
163
-
164
- // 选中
165
- &.is-checked {
166
- border-color: $uni-primary;
167
- background-color: $uni-primary;
168
-
169
- .checkbox__inner-icon {
170
- opacity: 1;
171
- transform: rotate(45deg);
172
- }
173
-
174
- // 选中禁用
175
- &.is-disable {
176
- opacity: $disable;
177
- }
178
- }
179
- }
180
- }
181
- </style>
@@ -1,208 +0,0 @@
1
- <template>
2
- <!-- #ifdef H5 -->
3
- <!-- <tr class="uni-table-tr">
4
- <th
5
- v-if="selection === 'selection' && ishead"
6
- class="checkbox"
7
- :class="{ 'tr-table--border': border }">
8
- <table-checkbox
9
- :checked="checked"
10
- :indeterminate="indeterminate"
11
- :disabled="disabled"
12
- @checkboxSelected="checkboxSelected"></table-checkbox>
13
- </th>
14
- <slot></slot> -->
15
- <!-- <uni-th class="th-fixed">123</uni-th> -->
16
- <!-- </tr> -->
17
- <!-- #endif -->
18
- <!-- #ifndef H5 -->
19
- <view class="uni-table-tr">
20
- <view
21
- v-if="selection === 'selection'"
22
- class="checkbox"
23
- :class="{ 'tr-table--border': border }">
24
- <table-checkbox
25
- :checked="checked"
26
- :indeterminate="indeterminate"
27
- :disabled="disabled"
28
- @checkboxSelected="checkboxSelected"></table-checkbox>
29
- </view>
30
- <slot></slot>
31
- </view>
32
- <!-- #endif -->
33
- </template>
34
-
35
- <script>
36
- import tableCheckbox from './table-checkbox.vue';
37
- /**
38
- * Tr 表格行组件
39
- * @description 表格行组件 仅包含 th,td 组件
40
- * @tutorial https://ext.dcloud.net.cn/plugin?id=
41
- */
42
- export default {
43
- name: 'uniTr',
44
- components: {
45
- tableCheckbox
46
- },
47
- props: {
48
- disabled: {
49
- type: Boolean,
50
- default: false
51
- },
52
- keyValue: {
53
- type: [String, Number],
54
- default: ''
55
- }
56
- },
57
- options: {
58
- // #ifdef MP-TOUTIAO
59
- // virtualHost: false,
60
- // #endif
61
- // #ifndef MP-TOUTIAO
62
- virtualHost: true
63
- // #endif
64
- },
65
- data() {
66
- return {
67
- value: false,
68
- border: false,
69
- selection: false,
70
- widthThArr: [],
71
- ishead: true,
72
- checked: false,
73
- indeterminate: false
74
- };
75
- },
76
- created() {
77
- this.root = this.getTable();
78
- this.head = this.getTable('uniThead');
79
- if (this.head) {
80
- this.ishead = false;
81
- this.head.init(this);
82
- }
83
- this.border = this.root.border;
84
- this.selection = this.root.type;
85
- this.root.trChildren.push(this);
86
- const rowData = this.root.data.find(
87
- (v) => v[this.root.rowKey] === this.keyValue
88
- );
89
- if (rowData) {
90
- this.rowData = rowData;
91
- }
92
- this.root.isNodata();
93
- },
94
- mounted() {
95
- if (this.widthThArr.length > 0) {
96
- const selectionWidth = this.selection === 'selection' ? 50 : 0;
97
- this.root.minWidth =
98
- Number(this.widthThArr.reduce((a, b) => Number(a) + Number(b))) +
99
- selectionWidth;
100
- }
101
- },
102
- // #ifndef VUE3
103
- // destroyed() {
104
- // const index = this.root.trChildren.findIndex((i) => i === this);
105
- // this.root.trChildren.splice(index, 1);
106
- // this.root.isNodata();
107
- // },
108
- // #endif
109
- // #ifdef VUE3
110
- unmounted() {
111
- const index = this.root.trChildren.findIndex((i) => i === this);
112
- this.root.trChildren.splice(index, 1);
113
- this.root.isNodata();
114
- },
115
- // #endif
116
- methods: {
117
- minWidthUpdate(width) {
118
- this.widthThArr.push(width);
119
- if (this.widthThArr.length > 0) {
120
- const selectionWidth = this.selection === 'selection' ? 50 : 0;
121
- this.root.minWidth =
122
- Number(this.widthThArr.reduce((a, b) => Number(a) + Number(b))) +
123
- selectionWidth;
124
- }
125
- },
126
- // 选中
127
- checkboxSelected(e) {
128
- let rootData = this.root.data.find(
129
- (v) => v[this.root.rowKey] === this.keyValue
130
- );
131
- this.checked = e.checked;
132
- this.root.check(
133
- rootData || this,
134
- e.checked,
135
- rootData ? this.keyValue : null
136
- );
137
- },
138
- change(e) {
139
- this.root.trChildren.forEach((item) => {
140
- if (item === this) {
141
- this.root.check(this, e.detail.value.length > 0 ? true : false);
142
- }
143
- });
144
- },
145
- /**
146
- * 获取父元素实例
147
- */
148
- getTable(name = 'uniTable') {
149
- let parent = this.$parent;
150
- let parentName = parent.$options.name;
151
- while (parentName !== name) {
152
- parent = parent.$parent;
153
- if (!parent) return false;
154
- parentName = parent.$options.name;
155
- }
156
- return parent;
157
- }
158
- }
159
- };
160
- </script>
161
-
162
- <style lang="scss">
163
- $border-color: #ebeef5;
164
-
165
- .uni-table-tr {
166
- /* #ifndef APP-NVUE */
167
- display: table-row;
168
- transition: all 0.3s;
169
- box-sizing: border-box;
170
- /* #endif */
171
- }
172
-
173
- .checkbox {
174
- padding: 0 8px;
175
- width: 26px;
176
- padding-left: 12px;
177
- /* #ifndef APP-NVUE */
178
- display: table-cell;
179
- vertical-align: middle;
180
- /* #endif */
181
- color: #333;
182
- font-weight: 500;
183
- border-bottom: 1px $border-color solid;
184
- font-size: 14px;
185
- // text-align: center;
186
- }
187
-
188
- .tr-table--border {
189
- border-right: 1px $border-color solid;
190
- }
191
-
192
- /* #ifndef APP-NVUE */
193
- .uni-table-tr {
194
- ::v-deep .uni-table-th {
195
- &.table--border:last-child {
196
- // border-right: none;
197
- }
198
- }
199
-
200
- ::v-deep .uni-table-td {
201
- &.table--border:last-child {
202
- // border-right: none;
203
- }
204
- }
205
- }
206
-
207
- /* #endif */
208
- </style>