@vtj/materials 0.10.6 → 0.10.7

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 (77) 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 +2 -2
  4. package/dist/assets/ui/index.umd.js +2 -2
  5. package/dist/assets/uni-h5/index.umd.js +3 -3
  6. package/dist/assets/uni-ui/index.umd.js +3 -3
  7. package/dist/assets/vant/index.umd.js +2 -2
  8. package/dist/deps/@vtj/charts/index.umd.js +2 -2
  9. package/dist/deps/@vtj/icons/index.umd.js +2 -2
  10. package/dist/deps/@vtj/ui/index.umd.js +3 -3
  11. package/dist/deps/@vtj/utils/index.umd.js +20 -20
  12. package/dist/deps/@vueuse/core/index.iife.min.js +1 -1
  13. package/dist/deps/uni-ui/index.umd.js +1 -1
  14. package/dist/deps/uni-ui/style.css +1 -1
  15. package/package.json +7 -7
  16. package/src/uni-h5/components/input.ts +2 -2
  17. package/src/uni-h5/components/scrollView.ts +3 -3
  18. package/src/uni-h5/components/video.ts +1 -1
  19. package/src/uni-ui/components/badge.ts +1 -5
  20. package/src/uni-ui/components/breadcrumb.ts +1 -20
  21. package/src/uni-ui/components/collapse.ts +22 -23
  22. package/src/uni-ui/components/grid.ts +0 -9
  23. package/src/uni-ui/components/group.ts +1 -10
  24. package/src/uni-ui/components/index.ts +4 -4
  25. package/src/uni-ui/components/popup.ts +10 -2
  26. package/src/uni-ui/components/swiperDot.ts +21 -7
  27. package/src/uni-ui/components/table.ts +9 -3
  28. package/src/uni-ui/components/transition.ts +10 -1
  29. package/src/uni-ui/index.ts +19 -44
  30. package/src/uni-ui/lib/uni-collapse/uni-collapse.vue +153 -0
  31. package/src/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +425 -0
  32. package/src/uni-ui/lib/uni-data-picker/keypress.js +45 -0
  33. package/src/uni-ui/lib/uni-data-picker/uni-data-picker.vue +604 -0
  34. package/src/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +622 -0
  35. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +76 -0
  36. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +335 -0
  37. package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +181 -170
  38. package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +977 -939
  39. package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +1024 -932
  40. package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +15 -17
  41. package/src/uni-ui/lib/uni-datetime-picker/util.js +419 -392
  42. package/src/uni-ui/lib/uni-fav/i18n/en.json +4 -0
  43. package/src/uni-ui/lib/uni-fav/i18n/index.js +8 -0
  44. package/src/uni-ui/lib/uni-fav/i18n/zh-Hans.json +4 -0
  45. package/src/uni-ui/lib/uni-fav/i18n/zh-Hant.json +4 -0
  46. package/src/uni-ui/lib/uni-fav/uni-fav.vue +170 -0
  47. package/src/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +280 -0
  48. package/src/uni-ui/lib/uni-file-picker/uni-file-picker.vue +668 -0
  49. package/src/uni-ui/lib/uni-file-picker/upload-file.vue +325 -0
  50. package/src/uni-ui/lib/uni-file-picker/upload-image.vue +292 -0
  51. package/src/uni-ui/lib/uni-file-picker/utils.js +110 -0
  52. package/src/uni-ui/lib/uni-grid/uni-grid.vue +148 -0
  53. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +152 -128
  54. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +50 -50
  55. package/src/uni-ui/lib/uni-load-more/i18n/en.json +5 -0
  56. package/src/uni-ui/lib/uni-load-more/i18n/index.js +8 -0
  57. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hans.json +5 -0
  58. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hant.json +5 -0
  59. package/src/uni-ui/lib/uni-load-more/uni-load-more.vue +456 -0
  60. package/src/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +484 -0
  61. package/src/uni-ui/lib/uni-popup/uni-popup.vue +4 -4
  62. package/src/uni-ui/lib/uni-popup-message/uni-popup-message.vue +149 -0
  63. package/src/uni-ui/lib/uni-rate/uni-rate.vue +362 -343
  64. package/src/uni-ui/lib/uni-row/uni-row.vue +193 -0
  65. package/src/uni-ui/lib/uni-search-bar/i18n/en.json +4 -0
  66. package/src/uni-ui/lib/uni-search-bar/i18n/index.js +8 -0
  67. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hans.json +4 -0
  68. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hant.json +4 -0
  69. package/src/uni-ui/lib/uni-search-bar/uni-search-bar.vue +339 -0
  70. package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +294 -285
  71. package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +8 -9
  72. package/src/uni-ui/lib/uni-th/filter-dropdown.vue +551 -503
  73. package/src/uni-ui/lib/uni-tr/table-checkbox.vue +165 -163
  74. package/src/uni-ui/lib/uni-tr/uni-tr.vue +6 -6
  75. package/src/uni-ui/lib/uni-transition/createAnimation.js +131 -0
  76. package/src/uni-ui/lib/uni-transition/uni-transition.vue +310 -0
  77. package/src/version.ts +2 -2
@@ -0,0 +1,425 @@
1
+ <template>
2
+ <view class="uni-collapse-item">
3
+ <!-- onClick(!isOpen) -->
4
+ <view
5
+ @click="onClick(!isOpen)"
6
+ class="uni-collapse-item__title"
7
+ :class="{
8
+ 'is-open': isOpen && titleBorder === 'auto',
9
+ 'uni-collapse-item-border': titleBorder !== 'none'
10
+ }">
11
+ <view class="uni-collapse-item__title-wrap">
12
+ <slot name="title">
13
+ <view
14
+ class="uni-collapse-item__title-box"
15
+ :class="{ 'is-disabled': disabled }">
16
+ <image
17
+ v-if="thumb"
18
+ :src="thumb"
19
+ class="uni-collapse-item__title-img" />
20
+ <text class="uni-collapse-item__title-text">{{ title }}</text>
21
+ </view>
22
+ </slot>
23
+ </view>
24
+ <view
25
+ v-if="showArrow"
26
+ :class="{
27
+ 'uni-collapse-item__title-arrow-active': isOpen,
28
+ 'uni-collapse-item--animation': showAnimation === true
29
+ }"
30
+ class="uni-collapse-item__title-arrow">
31
+ <uni-icons
32
+ :color="disabled ? '#ddd' : '#bbb'"
33
+ size="14"
34
+ type="bottom" />
35
+ </view>
36
+ </view>
37
+ <view
38
+ class="uni-collapse-item__wrap"
39
+ :class="{ 'is--transition': showAnimation }"
40
+ :style="{ height: (isOpen ? height : 0) + 'px' }">
41
+ <view
42
+ :id="elId"
43
+ ref="collapse--hook"
44
+ class="uni-collapse-item__wrap-content"
45
+ :class="{
46
+ open: isheight,
47
+ 'uni-collapse-item--border': border && isOpen
48
+ }">
49
+ <slot></slot>
50
+ </view>
51
+ </view>
52
+ </view>
53
+ </template>
54
+
55
+ <script>
56
+ // #ifdef APP-NVUE
57
+ const dom = weex.requireModule('dom');
58
+ // #endif
59
+ /**
60
+ * CollapseItem 折叠面板子组件
61
+ * @description 折叠面板子组件
62
+ * @property {String} title 标题文字
63
+ * @property {String} thumb 标题左侧缩略图
64
+ * @property {String} name 唯一标志符
65
+ * @property {Boolean} open = [true|false] 是否展开组件
66
+ * @property {Boolean} titleBorder = [true|false] 是否显示标题分隔线
67
+ * @property {String} border = ['auto'|'show'|'none'] 是否显示分隔线
68
+ * @property {Boolean} disabled = [true|false] 是否展开面板
69
+ * @property {Boolean} showAnimation = [true|false] 开启动画
70
+ * @property {Boolean} showArrow = [true|false] 是否显示右侧箭头
71
+ */
72
+ export default {
73
+ name: 'uniCollapseItem',
74
+ props: {
75
+ // 列表标题
76
+ title: {
77
+ type: String,
78
+ default: ''
79
+ },
80
+ name: {
81
+ type: [Number, String],
82
+ default: ''
83
+ },
84
+ // 是否禁用
85
+ disabled: {
86
+ type: Boolean,
87
+ default: false
88
+ },
89
+ // #ifdef APP-PLUS
90
+ // 是否显示动画,app 端默认不开启动画,卡顿严重
91
+ showAnimation: {
92
+ type: Boolean,
93
+ default: false
94
+ },
95
+ // #endif
96
+ // #ifndef APP-PLUS
97
+ // 是否显示动画
98
+ showAnimation: {
99
+ type: Boolean,
100
+ default: true
101
+ },
102
+ // #endif
103
+ // 是否展开
104
+ open: {
105
+ type: Boolean,
106
+ default: false
107
+ },
108
+ // 缩略图
109
+ thumb: {
110
+ type: String,
111
+ default: ''
112
+ },
113
+ // 标题分隔线显示类型
114
+ titleBorder: {
115
+ type: String,
116
+ default: 'auto'
117
+ },
118
+ border: {
119
+ type: Boolean,
120
+ default: true
121
+ },
122
+ showArrow: {
123
+ type: Boolean,
124
+ default: true
125
+ }
126
+ },
127
+ data() {
128
+ // TODO 随机生生元素ID,解决百度小程序获取同一个元素位置信息的bug
129
+ const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`;
130
+ return {
131
+ isOpen: false,
132
+ isheight: null,
133
+ height: 0,
134
+ elId,
135
+ nameSync: 0
136
+ };
137
+ },
138
+ watch: {
139
+ open(val) {
140
+ this.isOpen = val;
141
+ this.onClick(val, 'init');
142
+ }
143
+ },
144
+ updated(e) {
145
+ this.$nextTick(() => {
146
+ this.init(true);
147
+ });
148
+ },
149
+ created() {
150
+ this.collapse = this.getCollapse();
151
+ this.oldHeight = 0;
152
+ this.onClick(this.open, 'init');
153
+ },
154
+ // #ifndef VUE3
155
+ // TODO vue2
156
+ // destroyed() {
157
+ // if (this.__isUnmounted) return
158
+ // this.uninstall()
159
+ // },
160
+ // #endif
161
+ // #ifdef VUE3
162
+ // TODO vue3
163
+ unmounted() {
164
+ this.__isUnmounted = true;
165
+ this.uninstall();
166
+ },
167
+ // #endif
168
+ mounted() {
169
+ if (!this.collapse) return;
170
+ if (this.name !== '') {
171
+ this.nameSync = this.name;
172
+ } else {
173
+ this.nameSync = this.collapse.childrens.length + '';
174
+ }
175
+ if (this.collapse.names.indexOf(this.nameSync) === -1) {
176
+ this.collapse.names.push(this.nameSync);
177
+ } else {
178
+ console.warn(`name 值 ${this.nameSync} 重复`);
179
+ }
180
+ if (this.collapse.childrens.indexOf(this) === -1) {
181
+ this.collapse.childrens.push(this);
182
+ }
183
+ this.init();
184
+ },
185
+ methods: {
186
+ init(type) {
187
+ // #ifndef APP-NVUE
188
+ this.getCollapseHeight(type);
189
+ // #endif
190
+ // #ifdef APP-NVUE
191
+ // this.getNvueHwight(type);
192
+ // #endif
193
+ },
194
+ uninstall() {
195
+ if (this.collapse) {
196
+ this.collapse.childrens.forEach((item, index) => {
197
+ if (item === this) {
198
+ this.collapse.childrens.splice(index, 1);
199
+ }
200
+ });
201
+ this.collapse.names.forEach((item, index) => {
202
+ if (item === this.nameSync) {
203
+ this.collapse.names.splice(index, 1);
204
+ }
205
+ });
206
+ }
207
+ },
208
+ onClick(isOpen, type) {
209
+ if (this.disabled) return;
210
+ this.isOpen = isOpen;
211
+ if (this.isOpen && this.collapse) {
212
+ this.collapse.setAccordion(this);
213
+ }
214
+ if (type !== 'init') {
215
+ this.collapse.onChange(isOpen, this);
216
+ }
217
+ },
218
+ getCollapseHeight(type, index = 0) {
219
+ const views = uni.createSelectorQuery().in(this);
220
+ views
221
+ .select(`#${this.elId}`)
222
+ .fields(
223
+ {
224
+ size: true
225
+ },
226
+ (data) => {
227
+ // TODO 百度中可能获取不到节点信息 ,需要循环获取
228
+ if (index >= 10) return;
229
+ if (!data) {
230
+ index++;
231
+ this.getCollapseHeight(false, index);
232
+ return;
233
+ }
234
+ // #ifdef APP-NVUE
235
+ // this.height = data.height + 1
236
+ // #endif
237
+ // #ifndef APP-NVUE
238
+ this.height = data.height;
239
+ // #endif
240
+ this.isheight = true;
241
+ if (type) return;
242
+ this.onClick(this.isOpen, 'init');
243
+ }
244
+ )
245
+ .exec();
246
+ },
247
+ getNvueHwight(type) {
248
+ const result = dom.getComponentRect(
249
+ this.$refs['collapse--hook'],
250
+ (option) => {
251
+ if (option && option.result && option.size) {
252
+ // #ifdef APP-NVUE
253
+ this.height = option.size.height + 1;
254
+ // #endif
255
+ // #ifndef APP-NVUE
256
+ this.height = option.size.height;
257
+ // #endif
258
+ this.isheight = true;
259
+ if (type) return;
260
+ this.onClick(this.open, 'init');
261
+ }
262
+ }
263
+ );
264
+ },
265
+ /**
266
+ * 获取父元素实例
267
+ */
268
+ getCollapse(name = 'uniCollapse') {
269
+ let parent = this.$parent;
270
+ let parentName = parent.$options.name;
271
+ while (parentName !== name) {
272
+ parent = parent.$parent;
273
+ if (!parent) return false;
274
+ parentName = parent.$options.name;
275
+ }
276
+ return parent;
277
+ }
278
+ }
279
+ };
280
+ </script>
281
+
282
+ <style lang="scss">
283
+ .uni-collapse-item {
284
+ /* #ifndef APP-NVUE */
285
+ box-sizing: border-box;
286
+
287
+ /* #endif */
288
+ &__title {
289
+ /* #ifndef APP-NVUE */
290
+ display: flex;
291
+ width: 100%;
292
+ box-sizing: border-box;
293
+ /* #endif */
294
+ flex-direction: row;
295
+ align-items: center;
296
+ transition: border-bottom-color 0.3s;
297
+
298
+ // transition-property: border-bottom-color;
299
+ // transition-duration: 5s;
300
+ &-wrap {
301
+ width: 100%;
302
+ flex: 1;
303
+ }
304
+
305
+ &-box {
306
+ padding: 0 15px;
307
+ /* #ifndef APP-NVUE */
308
+ display: flex;
309
+ width: 100%;
310
+ box-sizing: border-box;
311
+ /* #endif */
312
+ flex-direction: row;
313
+ justify-content: space-between;
314
+ align-items: center;
315
+ height: 48px;
316
+ line-height: 48px;
317
+ background-color: #fff;
318
+ color: #303133;
319
+ font-size: 13px;
320
+ font-weight: 500;
321
+ /* #ifdef H5 */
322
+ cursor: pointer;
323
+ outline: none;
324
+
325
+ /* #endif */
326
+ &.is-disabled {
327
+ .uni-collapse-item__title-text {
328
+ color: #999;
329
+ }
330
+ }
331
+ }
332
+
333
+ &.uni-collapse-item-border {
334
+ border-bottom: 1px solid #ebeef5;
335
+ }
336
+
337
+ &.is-open {
338
+ border-bottom-color: transparent;
339
+ }
340
+
341
+ &-img {
342
+ height: 22px;
343
+ width: 22px;
344
+ margin-right: 10px;
345
+ }
346
+
347
+ &-text {
348
+ flex: 1;
349
+ font-size: 14px;
350
+ /* #ifndef APP-NVUE */
351
+ white-space: nowrap;
352
+ color: inherit;
353
+ /* #endif */
354
+ /* #ifdef APP-NVUE */
355
+ lines: 1;
356
+ /* #endif */
357
+ overflow: hidden;
358
+ text-overflow: ellipsis;
359
+ }
360
+
361
+ &-arrow {
362
+ /* #ifndef APP-NVUE */
363
+ display: flex;
364
+ box-sizing: border-box;
365
+ /* #endif */
366
+ align-items: center;
367
+ justify-content: center;
368
+ width: 20px;
369
+ height: 20px;
370
+ margin-right: 10px;
371
+ transform: rotate(0deg);
372
+
373
+ &-active {
374
+ transform: rotate(-180deg);
375
+ }
376
+ }
377
+ }
378
+
379
+ &__wrap {
380
+ /* #ifndef APP-NVUE */
381
+ will-change: height;
382
+ box-sizing: border-box;
383
+ /* #endif */
384
+ background-color: #fff;
385
+ overflow: hidden;
386
+ position: relative;
387
+ height: 0;
388
+
389
+ &.is--transition {
390
+ // transition: all 0.3s;
391
+ transition-property: height, border-bottom-width;
392
+ transition-duration: 0.3s;
393
+ /* #ifndef APP-NVUE */
394
+ will-change: height;
395
+ /* #endif */
396
+ }
397
+
398
+ &-content {
399
+ position: absolute;
400
+ font-size: 13px;
401
+ color: #303133;
402
+ // transition: height 0.3s;
403
+ border-bottom-color: transparent;
404
+ border-bottom-style: solid;
405
+ border-bottom-width: 0;
406
+
407
+ &.uni-collapse-item--border {
408
+ border-bottom-width: 1px;
409
+ border-bottom-color: red;
410
+ border-bottom-color: #ebeef5;
411
+ }
412
+
413
+ &.open {
414
+ position: relative;
415
+ }
416
+ }
417
+ }
418
+
419
+ &--animation {
420
+ transition-property: transform;
421
+ transition-duration: 0.3s;
422
+ transition-timing-function: ease;
423
+ }
424
+ }
425
+ </style>
@@ -0,0 +1,45 @@
1
+ // #ifdef H5
2
+ export default {
3
+ name: 'Keypress',
4
+ props: {
5
+ disable: {
6
+ type: Boolean,
7
+ default: false
8
+ }
9
+ },
10
+ mounted () {
11
+ const keyNames = {
12
+ esc: ['Esc', 'Escape'],
13
+ tab: 'Tab',
14
+ enter: 'Enter',
15
+ space: [' ', 'Spacebar'],
16
+ up: ['Up', 'ArrowUp'],
17
+ left: ['Left', 'ArrowLeft'],
18
+ right: ['Right', 'ArrowRight'],
19
+ down: ['Down', 'ArrowDown'],
20
+ delete: ['Backspace', 'Delete', 'Del']
21
+ }
22
+ const listener = ($event) => {
23
+ if (this.disable) {
24
+ return
25
+ }
26
+ const keyName = Object.keys(keyNames).find(key => {
27
+ const keyName = $event.key
28
+ const value = keyNames[key]
29
+ return value === keyName || (Array.isArray(value) && value.includes(keyName))
30
+ })
31
+ if (keyName) {
32
+ // 避免和其他按键事件冲突
33
+ setTimeout(() => {
34
+ this.$emit(keyName, {})
35
+ }, 0)
36
+ }
37
+ }
38
+ document.addEventListener('keyup', listener)
39
+ this.$once('hook:beforeDestroy', () => {
40
+ document.removeEventListener('keyup', listener)
41
+ })
42
+ },
43
+ render: () => {}
44
+ }
45
+ // #endif