@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,4 @@
1
+ {
2
+ "uni-fav.collect": "collect",
3
+ "uni-fav.collected": "collected"
4
+ }
@@ -0,0 +1,8 @@
1
+ import en from './en.json'
2
+ import zhHans from './zh-Hans.json'
3
+ import zhHant from './zh-Hant.json'
4
+ export default {
5
+ en,
6
+ 'zh-Hans': zhHans,
7
+ 'zh-Hant': zhHant
8
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "uni-fav.collect": "收藏",
3
+ "uni-fav.collected": "已收藏"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "uni-fav.collect": "收藏",
3
+ "uni-fav.collected": "已收藏"
4
+ }
@@ -0,0 +1,170 @@
1
+ <template>
2
+ <view
3
+ :class="[circle === true || circle === 'true' ? 'uni-fav--circle' : '']"
4
+ :style="[{ backgroundColor: checked ? bgColorChecked : bgColor }]"
5
+ @click="onClick"
6
+ class="uni-fav">
7
+ <!-- #ifdef MP-ALIPAY -->
8
+ <!-- <view class="uni-fav-star" v-if="!checked && (star === true || star === 'true')">
9
+ <uni-icons :color="fgColor" :style="{color: checked ? fgColorChecked : fgColor}" size="14" type="star-filled" />
10
+ </view> -->
11
+ <!-- #endif -->
12
+ <!-- #ifndef MP-ALIPAY -->
13
+ <uni-icons
14
+ :color="fgColor"
15
+ :style="{ color: checked ? fgColorChecked : fgColor }"
16
+ class="uni-fav-star"
17
+ size="14"
18
+ type="star-filled"
19
+ v-if="!checked && (star === true || star === 'true')" />
20
+ <!-- #endif -->
21
+ <text
22
+ :style="{ color: checked ? fgColorChecked : fgColor }"
23
+ class="uni-fav-text"
24
+ >{{ checked ? contentFav : contentDefault }}</text
25
+ >
26
+ </view>
27
+ </template>
28
+
29
+ <script>
30
+ /**
31
+ * Fav 收藏按钮
32
+ * @description 用于收藏功能,可点击切换选中、不选中的状态
33
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=864
34
+ * @property {Boolean} star = [true|false] 按钮是否带星星
35
+ * @property {String} bgColor 未收藏时的背景色
36
+ * @property {String} bgColorChecked 已收藏时的背景色
37
+ * @property {String} fgColor 未收藏时的文字颜色
38
+ * @property {String} fgColorChecked 已收藏时的文字颜色
39
+ * @property {Boolean} circle = [true|false] 是否为圆角
40
+ * @property {Boolean} checked = [true|false] 是否为已收藏
41
+ * @property {Object} contentText = [true|false] 收藏按钮文字
42
+ * @property {Boolean} stat 是否开启统计功能
43
+ * @event {Function} click 点击 fav按钮触发事件
44
+ * @example <uni-fav :checked="true"/>
45
+ */
46
+
47
+ import { initVueI18n } from '@dcloudio/uni-i18n';
48
+ import messages from './i18n/index.js';
49
+ const { t } = initVueI18n(messages);
50
+
51
+ export default {
52
+ name: 'UniFav',
53
+ // TODO 兼容 vue3,需要注册事件
54
+ emits: ['click'],
55
+ props: {
56
+ star: {
57
+ type: [Boolean, String],
58
+ default: true
59
+ },
60
+ bgColor: {
61
+ type: String,
62
+ default: '#eeeeee'
63
+ },
64
+ fgColor: {
65
+ type: String,
66
+ default: '#666666'
67
+ },
68
+ bgColorChecked: {
69
+ type: String,
70
+ default: '#007aff'
71
+ },
72
+ fgColorChecked: {
73
+ type: String,
74
+ default: '#FFFFFF'
75
+ },
76
+ circle: {
77
+ type: [Boolean, String],
78
+ default: false
79
+ },
80
+ checked: {
81
+ type: Boolean,
82
+ default: false
83
+ },
84
+ contentText: {
85
+ type: Object,
86
+ default() {
87
+ return {
88
+ contentDefault: '',
89
+ contentFav: ''
90
+ };
91
+ }
92
+ },
93
+ stat: {
94
+ type: Boolean,
95
+ default: false
96
+ }
97
+ },
98
+ computed: {
99
+ contentDefault() {
100
+ return this.contentText.contentDefault || t('uni-fav.collect');
101
+ },
102
+ contentFav() {
103
+ return this.contentText.contentFav || t('uni-fav.collected');
104
+ }
105
+ },
106
+ watch: {
107
+ checked() {
108
+ if (uni.report && this.stat) {
109
+ if (this.checked) {
110
+ uni.report('收藏', '收藏');
111
+ } else {
112
+ uni.report('取消收藏', '取消收藏');
113
+ }
114
+ }
115
+ }
116
+ },
117
+ methods: {
118
+ onClick() {
119
+ this.$emit('click');
120
+ }
121
+ }
122
+ };
123
+ </script>
124
+
125
+ <style lang="scss">
126
+ $fav-height: 25px;
127
+
128
+ .uni-fav {
129
+ /* #ifndef APP-NVUE */
130
+ display: flex;
131
+ /* #endif */
132
+ flex-direction: row;
133
+ align-items: center;
134
+ justify-content: center;
135
+ width: 60px;
136
+ height: $fav-height;
137
+ line-height: $fav-height;
138
+ text-align: center;
139
+ border-radius: 3px;
140
+ /* #ifdef H5 */
141
+ cursor: pointer;
142
+ /* #endif */
143
+ }
144
+
145
+ .uni-fav--circle {
146
+ border-radius: 30px;
147
+ }
148
+
149
+ .uni-fav-star {
150
+ /* #ifndef APP-NVUE */
151
+ display: flex;
152
+ /* #endif */
153
+ height: $fav-height;
154
+ line-height: 24px;
155
+ margin-right: 3px;
156
+ align-items: center;
157
+ justify-content: center;
158
+ }
159
+
160
+ .uni-fav-text {
161
+ /* #ifndef APP-NVUE */
162
+ display: flex;
163
+ /* #endif */
164
+ height: $fav-height;
165
+ line-height: $fav-height;
166
+ align-items: center;
167
+ justify-content: center;
168
+ font-size: 12px;
169
+ }
170
+ </style>
@@ -0,0 +1,280 @@
1
+ 'use strict';
2
+
3
+ const ERR_MSG_OK = 'chooseAndUploadFile:ok';
4
+ const ERR_MSG_FAIL = 'chooseAndUploadFile:fail';
5
+
6
+ function chooseImage(opts) {
7
+ const {
8
+ count,
9
+ sizeType = ['original', 'compressed'],
10
+ sourceType,
11
+ extension
12
+ } = opts;
13
+ return new Promise((resolve, reject) => {
14
+ // 微信由于旧接口不再维护,针对微信小程序平台改用chooseMedia接口
15
+ // #ifdef MP-WEIXIN
16
+ // uni.chooseMedia({
17
+ // count,
18
+ // sizeType,
19
+ // sourceType,
20
+ // mediaType: ['image'],
21
+ // extension,
22
+ // success(res) {
23
+ // res.tempFiles.forEach(item => {
24
+ // item.path = item.tempFilePath;
25
+ // })
26
+ // resolve(normalizeChooseAndUploadFileRes(res, 'image'));
27
+ // },
28
+ // fail(res) {
29
+ // reject({
30
+ // errMsg: res.errMsg.replace('chooseImage:fail', ERR_MSG_FAIL),
31
+ // });
32
+ // },
33
+ // })
34
+ // #endif
35
+ // #ifndef MP-WEIXIN
36
+ uni.chooseImage({
37
+ count,
38
+ sizeType,
39
+ sourceType,
40
+ extension,
41
+ success(res) {
42
+ resolve(normalizeChooseAndUploadFileRes(res, 'image'));
43
+ },
44
+ fail(res) {
45
+ reject({
46
+ errMsg: res.errMsg.replace('chooseImage:fail', ERR_MSG_FAIL)
47
+ });
48
+ }
49
+ });
50
+ // #endif
51
+ });
52
+ }
53
+
54
+ function chooseVideo(opts) {
55
+ const { count, camera, compressed, maxDuration, sourceType, extension } =
56
+ opts;
57
+ return new Promise((resolve, reject) => {
58
+ // 微信由于旧接口不再维护,针对微信小程序平台改用chooseMedia接口
59
+ // #ifdef MP-WEIXIN
60
+ // uni.chooseMedia({
61
+ // count,
62
+ // compressed,
63
+ // maxDuration,
64
+ // sourceType,
65
+ // extension,
66
+ // mediaType: ['video'],
67
+ // success(res) {
68
+ // const { tempFiles } = res;
69
+ // resolve(
70
+ // normalizeChooseAndUploadFileRes(
71
+ // {
72
+ // errMsg: 'chooseVideo:ok',
73
+ // tempFiles: tempFiles.map((item) => {
74
+ // return {
75
+ // name: item.name || '',
76
+ // path: item.tempFilePath,
77
+ // thumbTempFilePath: item.thumbTempFilePath,
78
+ // size: item.size,
79
+ // type: (res.tempFile && res.tempFile.type) || '',
80
+ // width: item.width,
81
+ // height: item.height,
82
+ // duration: item.duration,
83
+ // fileType: 'video',
84
+ // cloudPath: ''
85
+ // };
86
+ // })
87
+ // },
88
+ // 'video'
89
+ // )
90
+ // );
91
+ // },
92
+ // fail(res) {
93
+ // reject({
94
+ // errMsg: res.errMsg.replace('chooseVideo:fail', ERR_MSG_FAIL)
95
+ // });
96
+ // }
97
+ // });
98
+ // #endif
99
+ // #ifndef MP-WEIXIN
100
+ uni.chooseVideo({
101
+ camera,
102
+ compressed,
103
+ maxDuration,
104
+ sourceType,
105
+ extension,
106
+ success(res) {
107
+ const { tempFilePath, duration, size, height, width } = res;
108
+ resolve(
109
+ normalizeChooseAndUploadFileRes(
110
+ {
111
+ errMsg: 'chooseVideo:ok',
112
+ tempFilePaths: [tempFilePath],
113
+ tempFiles: [
114
+ {
115
+ name: (res.tempFile && res.tempFile.name) || '',
116
+ path: tempFilePath,
117
+ size,
118
+ type: (res.tempFile && res.tempFile.type) || '',
119
+ width,
120
+ height,
121
+ duration,
122
+ fileType: 'video',
123
+ cloudPath: ''
124
+ }
125
+ ]
126
+ },
127
+ 'video'
128
+ )
129
+ );
130
+ },
131
+ fail(res) {
132
+ reject({
133
+ errMsg: res.errMsg.replace('chooseVideo:fail', ERR_MSG_FAIL)
134
+ });
135
+ }
136
+ });
137
+ // #endif
138
+ });
139
+ }
140
+
141
+ function chooseAll(opts) {
142
+ const { count, extension } = opts;
143
+ return new Promise((resolve, reject) => {
144
+ let chooseFile = uni.chooseFile;
145
+ if (
146
+ typeof wx !== 'undefined' &&
147
+ typeof wx.chooseMessageFile === 'function'
148
+ ) {
149
+ chooseFile = wx.chooseMessageFile;
150
+ }
151
+ if (typeof chooseFile !== 'function') {
152
+ return reject({
153
+ errMsg:
154
+ ERR_MSG_FAIL + ' 请指定 type 类型,该平台仅支持选择 image 或 video。'
155
+ });
156
+ }
157
+ chooseFile({
158
+ type: 'all',
159
+ count,
160
+ extension,
161
+ success(res) {
162
+ resolve(normalizeChooseAndUploadFileRes(res));
163
+ },
164
+ fail(res) {
165
+ reject({
166
+ errMsg: res.errMsg.replace('chooseFile:fail', ERR_MSG_FAIL)
167
+ });
168
+ }
169
+ });
170
+ });
171
+ }
172
+
173
+ function normalizeChooseAndUploadFileRes(res, fileType) {
174
+ res.tempFiles.forEach((item, index) => {
175
+ if (!item.name) {
176
+ item.name = item.path.substring(item.path.lastIndexOf('/') + 1);
177
+ }
178
+ if (fileType) {
179
+ item.fileType = fileType;
180
+ }
181
+ item.cloudPath =
182
+ Date.now() +
183
+ '_' +
184
+ index +
185
+ item.name.substring(item.name.lastIndexOf('.'));
186
+ });
187
+ if (!res.tempFilePaths) {
188
+ res.tempFilePaths = res.tempFiles.map((file) => file.path);
189
+ }
190
+ return res;
191
+ }
192
+
193
+ function uploadCloudFiles(files, max = 5, onUploadProgress) {
194
+ files = JSON.parse(JSON.stringify(files));
195
+ const len = files.length;
196
+ let count = 0;
197
+ let self = this;
198
+ return new Promise((resolve) => {
199
+ while (count < max) {
200
+ next();
201
+ }
202
+
203
+ function next() {
204
+ let cur = count++;
205
+ if (cur >= len) {
206
+ !files.find((item) => !item.url && !item.errMsg) && resolve(files);
207
+ return;
208
+ }
209
+ const fileItem = files[cur];
210
+ const index = self.files.findIndex((v) => v.uuid === fileItem.uuid);
211
+ fileItem.url = '';
212
+ delete fileItem.errMsg;
213
+
214
+ uniCloud
215
+ .uploadFile({
216
+ filePath: fileItem.path,
217
+ cloudPath: fileItem.cloudPath,
218
+ fileType: fileItem.fileType,
219
+ onUploadProgress: (res) => {
220
+ res.index = index;
221
+ onUploadProgress && onUploadProgress(res);
222
+ }
223
+ })
224
+ .then((res) => {
225
+ fileItem.url = res.fileID;
226
+ fileItem.index = index;
227
+ if (cur < len) {
228
+ next();
229
+ }
230
+ })
231
+ .catch((res) => {
232
+ fileItem.errMsg = res.errMsg || res.message;
233
+ fileItem.index = index;
234
+ if (cur < len) {
235
+ next();
236
+ }
237
+ });
238
+ }
239
+ });
240
+ }
241
+
242
+ function uploadFiles(choosePromise, { onChooseFile, onUploadProgress }) {
243
+ return choosePromise
244
+ .then((res) => {
245
+ if (onChooseFile) {
246
+ const customChooseRes = onChooseFile(res);
247
+ if (typeof customChooseRes !== 'undefined') {
248
+ return Promise.resolve(customChooseRes).then((chooseRes) =>
249
+ typeof chooseRes === 'undefined' ? res : chooseRes
250
+ );
251
+ }
252
+ }
253
+ return res;
254
+ })
255
+ .then((res) => {
256
+ if (res === false) {
257
+ return {
258
+ errMsg: ERR_MSG_OK,
259
+ tempFilePaths: [],
260
+ tempFiles: []
261
+ };
262
+ }
263
+ return res;
264
+ });
265
+ }
266
+
267
+ function chooseAndUploadFile(
268
+ opts = {
269
+ type: 'all'
270
+ }
271
+ ) {
272
+ if (opts.type === 'image') {
273
+ return uploadFiles(chooseImage(opts), opts);
274
+ } else if (opts.type === 'video') {
275
+ return uploadFiles(chooseVideo(opts), opts);
276
+ }
277
+ return uploadFiles(chooseAll(opts), opts);
278
+ }
279
+
280
+ export { chooseAndUploadFile, uploadCloudFiles };