@tdesign/uniapp 0.7.2 → 0.8.0

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 (199) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +32 -2
  3. package/dist/action-sheet/README.md +1 -1
  4. package/dist/action-sheet/action-sheet.vue +158 -150
  5. package/dist/action-sheet/props.ts +2 -2
  6. package/dist/action-sheet/type.ts +1 -1
  7. package/dist/avatar/avatar.vue +89 -87
  8. package/dist/avatar-group/avatar-group.vue +69 -67
  9. package/dist/back-top/back-top.vue +60 -58
  10. package/dist/badge/badge.vue +69 -59
  11. package/dist/button/button.vue +121 -116
  12. package/dist/button/props.ts +2 -2
  13. package/dist/button/type.ts +1 -1
  14. package/dist/calendar/calendar-header.vue +4 -4
  15. package/dist/calendar/calendar.vue +308 -297
  16. package/dist/calendar/template.vue +1 -1
  17. package/dist/cascader/README.en-US.md +2 -1
  18. package/dist/cascader/README.md +2 -1
  19. package/dist/cascader/cascader.vue +340 -328
  20. package/dist/cascader/props.ts +6 -1
  21. package/dist/cascader/type.ts +6 -0
  22. package/dist/cell/cell.vue +127 -121
  23. package/dist/cell-group/cell-group.vue +32 -30
  24. package/dist/check-tag/check-tag.vue +73 -71
  25. package/dist/checkbox/README.en-US.md +6 -6
  26. package/dist/checkbox/README.md +5 -5
  27. package/dist/checkbox/checkbox.vue +127 -127
  28. package/dist/checkbox/props.ts +6 -6
  29. package/dist/checkbox/type.ts +6 -4
  30. package/dist/checkbox-group/checkbox-group.vue +175 -173
  31. package/dist/checkbox-group/props.ts +6 -6
  32. package/dist/checkbox-group/type.ts +6 -4
  33. package/dist/col/col.vue +26 -24
  34. package/dist/collapse/collapse.vue +83 -81
  35. package/dist/collapse-panel/collapse-panel.vue +121 -119
  36. package/dist/collapse-panel/props.ts +4 -4
  37. package/dist/collapse-panel/type.ts +2 -2
  38. package/dist/color-picker/README.md +1 -1
  39. package/dist/color-picker/color-picker.vue +324 -322
  40. package/dist/color-picker/props.ts +2 -2
  41. package/dist/color-picker/template.vue +14 -10
  42. package/dist/common/common.ts +1 -0
  43. package/dist/common/style/theme/index.css +57 -61
  44. package/dist/common/utils.js +7 -2
  45. package/dist/common/validator.js +172 -0
  46. package/dist/config-provider/README.en-US.md +184 -0
  47. package/dist/config-provider/README.md +234 -0
  48. package/dist/config-provider/config-provider.vue +105 -0
  49. package/dist/config-provider/config-store.js +70 -0
  50. package/dist/config-provider/props.ts +16 -0
  51. package/dist/config-provider/reactive-state.js +39 -0
  52. package/dist/config-provider/type.ts +401 -0
  53. package/dist/config-provider/use-config.js +29 -0
  54. package/dist/config-provider/utils.js +29 -0
  55. package/dist/count-down/count-down.vue +98 -97
  56. package/dist/date-time-picker/date-time-picker.vue +410 -395
  57. package/dist/demo/demo.vue +1 -0
  58. package/dist/dialog/dialog.vue +176 -173
  59. package/dist/divider/divider.vue +38 -36
  60. package/dist/draggable/draggable.vue +60 -58
  61. package/dist/drawer/README.md +1 -1
  62. package/dist/drawer/drawer.vue +48 -46
  63. package/dist/dropdown-item/dropdown-item.vue +209 -207
  64. package/dist/dropdown-item/props.ts +4 -4
  65. package/dist/dropdown-item/type.ts +3 -3
  66. package/dist/dropdown-menu/dropdown-menu.vue +93 -99
  67. package/dist/empty/empty.vue +43 -42
  68. package/dist/fab/fab.vue +88 -86
  69. package/dist/footer/footer.vue +36 -34
  70. package/dist/form/README.en-US.md +17 -24
  71. package/dist/form/README.md +18 -25
  72. package/dist/form/form.css +1 -166
  73. package/dist/form/form.vue +251 -236
  74. package/dist/form/props.ts +2 -21
  75. package/dist/form/type.ts +7 -70
  76. package/dist/form-item/README.en-US.md +4 -5
  77. package/dist/form-item/README.md +4 -5
  78. package/dist/form-item/form-item.css +69 -96
  79. package/dist/form-item/form-item.vue +315 -336
  80. package/dist/form-item/form-model.ts +125 -173
  81. package/dist/form-item/props.ts +4 -17
  82. package/dist/form-item/type.ts +43 -1
  83. package/dist/grid/grid.vue +53 -51
  84. package/dist/grid-item/grid-item.vue +121 -119
  85. package/dist/guide/README.md +1 -1
  86. package/dist/guide/guide.vue +281 -277
  87. package/dist/icon/README.md +2 -4
  88. package/dist/icon/icon.vue +78 -76
  89. package/dist/image/README.md +1 -1
  90. package/dist/image/image.vue +103 -101
  91. package/dist/image-viewer/image-viewer.vue +160 -158
  92. package/dist/image-viewer/props.ts +2 -2
  93. package/dist/image-viewer/type.ts +1 -1
  94. package/dist/index.js +3 -0
  95. package/dist/indexes/indexes.vue +264 -267
  96. package/dist/indexes-anchor/indexes-anchor.vue +41 -41
  97. package/dist/input/input.vue +192 -192
  98. package/dist/input/props.ts +6 -6
  99. package/dist/input/type.ts +3 -3
  100. package/dist/link/link.vue +73 -71
  101. package/dist/loading/loading.vue +59 -59
  102. package/dist/locale/ar_KW.ts +157 -0
  103. package/dist/locale/en_US.ts +146 -0
  104. package/dist/locale/it_IT.ts +145 -0
  105. package/dist/locale/ja_JP.ts +132 -0
  106. package/dist/locale/ko_KR.ts +132 -0
  107. package/dist/locale/ru_RU.ts +157 -0
  108. package/dist/locale/zh_CN.ts +133 -0
  109. package/dist/locale/zh_TW.ts +132 -0
  110. package/dist/message/message.vue +181 -173
  111. package/dist/message/props.ts +2 -2
  112. package/dist/message/type.ts +1 -1
  113. package/dist/message-item/message-item.vue +192 -184
  114. package/dist/mixins/using-config.js +39 -0
  115. package/dist/navbar/navbar.vue +201 -199
  116. package/dist/notice-bar/notice-bar.vue +175 -171
  117. package/dist/notice-bar/props.ts +2 -2
  118. package/dist/notice-bar/type.ts +1 -1
  119. package/dist/npm/dayjs/esm/locale/ar.js +81 -0
  120. package/dist/npm/dayjs/esm/locale/it.js +39 -0
  121. package/dist/overlay/overlay.vue +50 -48
  122. package/dist/picker/picker.vue +168 -161
  123. package/dist/picker-item/picker-item.vue +269 -269
  124. package/dist/popover/README.md +1 -1
  125. package/dist/popover/popover.vue +262 -261
  126. package/dist/popover/props.ts +4 -4
  127. package/dist/popover/type.ts +2 -2
  128. package/dist/popup/popup.vue +46 -45
  129. package/dist/progress/README.md +1 -1
  130. package/dist/progress/progress.vue +76 -76
  131. package/dist/pull-down-refresh/props.ts +2 -2
  132. package/dist/pull-down-refresh/pull-down-refresh.vue +240 -234
  133. package/dist/pull-down-refresh/type.ts +1 -1
  134. package/dist/qrcode/README.md +1 -1
  135. package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.vue +340 -338
  136. package/dist/qrcode/components/qrcode-status/qrcode-status.vue +6 -6
  137. package/dist/qrcode/qrcode.vue +93 -87
  138. package/dist/radio/props.ts +6 -6
  139. package/dist/radio/radio.vue +118 -120
  140. package/dist/radio/type.ts +3 -3
  141. package/dist/radio-group/props.ts +4 -4
  142. package/dist/radio-group/radio-group.vue +136 -134
  143. package/dist/radio-group/type.ts +4 -4
  144. package/dist/rate/computed.js +2 -2
  145. package/dist/rate/props.ts +4 -4
  146. package/dist/rate/rate.vue +155 -154
  147. package/dist/rate/type.ts +2 -2
  148. package/dist/result/result.vue +41 -39
  149. package/dist/row/row.vue +38 -36
  150. package/dist/scroll-view/scroll-view.vue +24 -22
  151. package/dist/search/props.ts +2 -2
  152. package/dist/search/search.vue +127 -125
  153. package/dist/search/type.ts +1 -1
  154. package/dist/side-bar/side-bar.vue +57 -55
  155. package/dist/side-bar-item/side-bar-item.vue +86 -86
  156. package/dist/skeleton/skeleton.vue +126 -124
  157. package/dist/slider/README.md +1 -1
  158. package/dist/slider/props.ts +2 -2
  159. package/dist/slider/slider.vue +457 -457
  160. package/dist/slider/type.ts +1 -1
  161. package/dist/step-item/step-item.vue +77 -75
  162. package/dist/stepper/props.ts +2 -2
  163. package/dist/stepper/stepper.vue +168 -149
  164. package/dist/stepper/type.ts +1 -1
  165. package/dist/steps/props.ts +2 -2
  166. package/dist/steps/steps.vue +83 -81
  167. package/dist/steps/type.ts +1 -1
  168. package/dist/sticky/sticky.vue +104 -102
  169. package/dist/swipe-cell/swipe-cell.vue +91 -89
  170. package/dist/swiper/README.md +1 -1
  171. package/dist/swiper/swiper.vue +91 -89
  172. package/dist/swiper-nav/swiper-nav.vue +38 -36
  173. package/dist/switch/props.ts +2 -2
  174. package/dist/switch/switch.vue +62 -62
  175. package/dist/switch/type.ts +1 -1
  176. package/dist/tab-bar/tab-bar.vue +88 -86
  177. package/dist/tab-bar-item/tab-bar-item.vue +85 -82
  178. package/dist/tab-panel/tab-panel.vue +66 -64
  179. package/dist/tabs/tabs.vue +294 -287
  180. package/dist/tag/tag.vue +79 -77
  181. package/dist/textarea/props.ts +6 -6
  182. package/dist/textarea/textarea.vue +127 -126
  183. package/dist/textarea/type.ts +3 -3
  184. package/dist/toast/toast.vue +107 -106
  185. package/dist/transition/transition.vue +30 -28
  186. package/dist/tree-select/tree-select.vue +151 -151
  187. package/dist/types/config-provider.d.ts +7 -0
  188. package/dist/types/index.d.ts +2 -0
  189. package/dist/types/popover.d.ts +7 -0
  190. package/dist/upload/README.en-US.md +13 -14
  191. package/dist/upload/README.md +11 -12
  192. package/dist/upload/props.ts +2 -4
  193. package/dist/upload/type.ts +12 -11
  194. package/dist/upload/upload.css +1 -1
  195. package/dist/upload/upload.vue +672 -512
  196. package/dist/watermark/watermark.vue +151 -149
  197. package/global.d.ts +2 -0
  198. package/package.json +16 -2
  199. package/dist/form/form-item-props.ts +0 -56
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <view
3
3
  :class="classPrefix"
4
- :style="tools._style(['height:' + tools.addUnit(height), customStyle])"
4
+ :style="'' + tools._style([`height:${tools.addUnit(height)}`, customStyle])"
5
5
  >
6
6
  <t-scroll-view
7
7
  v-for="(item, level) in treeOptions"
8
8
  :key="level"
9
9
  :t-class="getScrollViewTClass(level)"
10
- :class="getScrollViewClass(level)"
10
+ :class="'' + getScrollViewClass(level)"
11
11
  :scroll-into-view="scrollIntoView && scrollIntoView[level] ? 'scroll-to-' + scrollIntoView[level] : ''"
12
12
  >
13
13
  <t-side-bar
@@ -28,14 +28,14 @@
28
28
  />
29
29
  </t-side-bar>
30
30
 
31
- <block v-else-if="level != leafLevel">
31
+ <template v-else-if="level != leafLevel">
32
32
  <view
33
33
  v-for="(treeItem, index) in treeOptions[level]"
34
34
  :key="`view-${level}-${index}`"
35
35
  :data-level="level"
36
36
  :data-value="treeItem.value"
37
37
  :class="
38
- tools.cls(classPrefix + '__item', [
38
+ '' + tools.cls(classPrefix + '__item', [
39
39
  ['active', treeItem.value === innerValue[level]],
40
40
  ['disabled', treeItem.disabled]
41
41
  ]) +
@@ -49,7 +49,7 @@
49
49
  {{ treeItem.label }}
50
50
  </view>
51
51
  </view>
52
- </block>
52
+ </template>
53
53
 
54
54
  <t-radio-group
55
55
  v-else-if="!multiple"
@@ -124,26 +124,7 @@ import { canUseVirtualHost } from '../common/version';
124
124
 
125
125
  const name = `${prefix}-tree-select`;
126
126
 
127
- export default uniComponent({
128
- name,
129
- options: {
130
- styleIsolation: 'shared',
131
- },
132
- controlledProps: [
133
- {
134
- key: 'value',
135
- event: 'change',
136
- },
137
- ],
138
- externalClasses: [
139
- `${prefix}-class`,
140
- `${prefix}-class-left-column`,
141
- `${prefix}-class-left-item`,
142
- `${prefix}-class-middle-item`,
143
- `${prefix}-class-right-column`,
144
- `${prefix}-class-right-item`,
145
- `${prefix}-class-right-item-label`,
146
- ],
127
+ export default {
147
128
  components: {
148
129
  TRadio,
149
130
  TRadioGroup,
@@ -153,164 +134,183 @@ export default uniComponent({
153
134
  TSideBarItem,
154
135
  TScrollView,
155
136
  },
156
- props: {
157
- ...props,
158
- },
159
- data() {
160
- return {
161
- prefix,
162
- classPrefix: name,
163
- scrollIntoView: null,
164
- tools,
165
-
166
- innerValue: coalesce(this.value, this.defaultValue),
167
- treeOptions: [],
168
- };
169
- },
170
- computed: {
171
-
172
- },
173
- watch: {
174
- value: {
175
- handler() {
176
- this.buildTreeOptions();
177
- },
178
- deep: true,
179
- immediate: true,
180
- },
137
+ ...uniComponent({
138
+ name,
181
139
  options: {
182
- handler() {
183
- this.buildTreeOptions();
140
+ styleIsolation: 'shared',
141
+ },
142
+ controlledProps: [
143
+ {
144
+ key: 'value',
145
+ event: 'change',
184
146
  },
185
- deep: true,
186
- immediate: true,
147
+ ],
148
+ externalClasses: [
149
+ `${prefix}-class`,
150
+ `${prefix}-class-left-column`,
151
+ `${prefix}-class-left-item`,
152
+ `${prefix}-class-middle-item`,
153
+ `${prefix}-class-right-column`,
154
+ `${prefix}-class-right-item`,
155
+ `${prefix}-class-right-item-label`,
156
+ ],
157
+ props: {
158
+ ...props,
159
+ },
160
+ data() {
161
+ return {
162
+ prefix,
163
+ classPrefix: name,
164
+ scrollIntoView: null,
165
+ tools,
166
+
167
+ innerValue: coalesce(this.value, this.defaultValue),
168
+ treeOptions: [],
169
+ leafLevel: -1,
170
+ };
187
171
  },
188
- keys: {
189
- handler() {
190
- this.buildTreeOptions();
172
+ watch: {
173
+ value: {
174
+ handler() {
175
+ this.buildTreeOptions();
176
+ },
177
+ deep: true,
178
+ immediate: true,
179
+ },
180
+ options: {
181
+ handler() {
182
+ this.buildTreeOptions();
183
+ },
184
+ deep: true,
185
+ immediate: true,
186
+ },
187
+ keys: {
188
+ handler() {
189
+ this.buildTreeOptions();
190
+ },
191
+ deep: true,
192
+ immediate: true,
191
193
  },
192
- deep: true,
193
- immediate: true,
194
+ multiple: 'buildTreeOptions',
194
195
  },
195
- multiple: 'buildTreeOptions',
196
- },
197
- mounted() {
198
- nextTick().then(() => {
199
- this.getScrollIntoView('init');
200
- });
201
- },
202
- methods: {
203
- getTreeClass,
204
- buildTreeOptions() {
205
- const { options, innerValue: value, customValue, multiple, keys } = this;
196
+ mounted() {
197
+ nextTick().then(() => {
198
+ this.getScrollIntoView('init');
199
+ });
200
+ },
201
+ methods: {
202
+ getTreeClass,
203
+ buildTreeOptions() {
204
+ const { options, innerValue: value, customValue, multiple, keys } = this;
206
205
 
207
- if (!options.length) return;
206
+ if (!options.length) return;
208
207
 
209
- const treeOptions = [];
208
+ const treeOptions = [];
210
209
 
211
- let level = -1;
212
- let currentNode = { children: options };
210
+ let level = -1;
211
+ let currentNode = { children: options };
213
212
 
214
- while (currentNode?.children) {
215
- level += 1;
216
- const currentLevelOptions = currentNode.children.map(item => ({
217
- label: item[keys?.label || 'label'],
218
- value: item[keys?.value || 'value'],
219
- disabled: item[keys?.disabled || 'disabled'],
220
- children: item[keys?.children || 'children'],
221
- }));
213
+ while (currentNode?.children) {
214
+ level += 1;
215
+ const currentLevelOptions = currentNode.children.map(item => ({
216
+ label: item[keys?.label || 'label'],
217
+ value: item[keys?.value || 'value'],
218
+ disabled: item[keys?.disabled || 'disabled'],
219
+ children: item[keys?.children || 'children'],
220
+ }));
222
221
 
223
- treeOptions.push(currentLevelOptions);
222
+ treeOptions.push(currentLevelOptions);
224
223
 
225
- const currentValue = coalesce(customValue?.[level], value?.[level]);
226
- currentNode = currentValue
227
- ? coalesce(currentLevelOptions.find(child => child.value === currentValue), currentLevelOptions[0])
228
- : currentLevelOptions[0];
229
- }
224
+ const currentValue = coalesce(customValue?.[level], value?.[level]);
225
+ currentNode = currentValue
226
+ ? coalesce(currentLevelOptions.find(child => child.value === currentValue), currentLevelOptions[0])
227
+ : currentLevelOptions[0];
228
+ }
230
229
 
231
- const depth = getTreeDepth(options, keys?.children);
230
+ const depth = getTreeDepth(options, keys?.children);
232
231
 
233
- // 补齐 treeOptions 长度到 depth
234
- while (treeOptions.length < depth) {
235
- treeOptions.push([]);
236
- level += 1;
237
- }
232
+ // 补齐 treeOptions 长度到 depth
233
+ while (treeOptions.length < depth) {
234
+ treeOptions.push([]);
235
+ level += 1;
236
+ }
238
237
 
239
- const leafLevel = Math.max(0, level);
240
- const innerValue = customValue
238
+ const leafLevel = Math.max(0, level);
239
+ const innerValue = customValue
241
240
  || treeOptions.map((levelOptions, idx) => {
242
241
  const isLastLevel = idx === treeOptions.length - 1;
243
242
  const defaultValue = isLastLevel && multiple ? [levelOptions[0]?.value] : levelOptions[0]?.value;
244
243
  return coalesce(value?.[idx], defaultValue);
245
244
  });
246
245
 
247
- this.innerValue = innerValue;
248
- this.leafLevel = leafLevel;
249
- this.treeOptions = treeOptions;
250
- },
246
+ this.innerValue = innerValue;
247
+ this.leafLevel = leafLevel;
248
+ this.treeOptions = treeOptions;
249
+ },
251
250
 
252
- getScrollIntoView(status) {
253
- const { innerValue: value, customValue, scrollIntoView } = this;
254
- if (status === 'init') {
255
- const innerValue = customValue || value;
256
- const scrollIntoView = Array.isArray(innerValue)
257
- ? innerValue.map(item => (Array.isArray(item) ? item[0] : item))
258
- : [innerValue];
251
+ getScrollIntoView(status) {
252
+ const { innerValue: value, customValue, scrollIntoView } = this;
253
+ if (status === 'init') {
254
+ const innerValue = customValue || value;
255
+ const scrollIntoView = Array.isArray(innerValue)
256
+ ? innerValue.map(item => (Array.isArray(item) ? item[0] : item))
257
+ : [innerValue];
259
258
 
260
- this.scrollIntoView = scrollIntoView;
261
- } else {
262
- if (scrollIntoView === null) return;
263
- this.scrollIntoView = null;
264
- }
265
- },
259
+ this.scrollIntoView = scrollIntoView;
260
+ } else {
261
+ if (scrollIntoView === null) return;
262
+ this.scrollIntoView = null;
263
+ }
264
+ },
266
265
 
267
- onRootChange(e) {
268
- const { innerValue } = this;
269
- const { value: itemValue } = e;
266
+ onRootChange(e) {
267
+ const { innerValue } = this;
268
+ const { value: itemValue } = e;
270
269
 
271
- this.getScrollIntoView('none');
272
- innerValue[0] = itemValue;
270
+ this.getScrollIntoView('none');
271
+ innerValue[0] = itemValue;
273
272
 
274
- this._trigger('change', { value: innerValue, level: 0 });
275
- },
273
+ this._trigger('change', { value: innerValue, level: 0 });
274
+ },
276
275
 
277
- handleTreeClick(e) {
278
- const { level, value: itemValue } = e.currentTarget.dataset;
279
- const { innerValue } = this;
276
+ handleTreeClick(e) {
277
+ const { level, value: itemValue } = e.currentTarget.dataset;
278
+ const { innerValue } = this;
280
279
 
281
- innerValue[level] = itemValue;
282
- this.getScrollIntoView('none');
283
- this._trigger('change', { value: innerValue, level: 1 });
284
- },
280
+ innerValue[level] = itemValue;
281
+ this.getScrollIntoView('none');
282
+ this._trigger('change', { value: innerValue, level: 1 });
283
+ },
285
284
 
286
- handleChange({ level, type, value }) {
287
- const { innerValue } = this;
285
+ handleChange({ level, type, value }) {
286
+ const { innerValue } = this;
288
287
 
289
- if (type === 'multiple') {
290
- if (!isDef(innerValue[level])) {
291
- innerValue[level] = [];
288
+ if (type === 'multiple') {
289
+ if (!isDef(innerValue[level])) {
290
+ innerValue[level] = [];
291
+ }
292
+ const index = innerValue[level].indexOf(value);
293
+ index === -1 ? innerValue[level].push(value) : innerValue[level].splice(index, 1);
294
+ } else {
295
+ innerValue[level] = value;
292
296
  }
293
- const index = innerValue[level].indexOf(value);
294
- index === -1 ? innerValue[level].push(value) : innerValue[level].splice(index, 1);
295
- } else {
296
- innerValue[level] = value;
297
- }
298
297
 
299
- this.getScrollIntoView('none');
300
- this._trigger('change', { value: innerValue, level });
301
- },
298
+ this.getScrollIntoView('none');
299
+ this._trigger('change', { value: innerValue, level });
300
+ },
302
301
 
303
- getScrollViewTClass(level) {
304
- return canUseVirtualHost() ? this.getScrollViewRealClass(level) : '';
305
- },
306
- getScrollViewClass(level) {
307
- return !canUseVirtualHost() ? this.getScrollViewRealClass(level) : '';
308
- },
309
- getScrollViewRealClass(level) {
310
- const { classPrefix, leafLevel, treeOptions, tClass } = this;
311
- return `${tools.cls(`${classPrefix}__column`, [getTreeClass(leafLevel - level, treeOptions.length)])} ${tClass}`;
302
+ getScrollViewTClass(level) {
303
+ return canUseVirtualHost() ? this.getScrollViewRealClass(level) : '';
304
+ },
305
+ getScrollViewClass(level) {
306
+ return !canUseVirtualHost() ? this.getScrollViewRealClass(level) : '';
307
+ },
308
+ getScrollViewRealClass(level) {
309
+ const { classPrefix, leafLevel, treeOptions, tClass } = this;
310
+ return `${tools.cls(`${classPrefix}__column`, [getTreeClass(leafLevel - level, treeOptions.length)])} ${tClass}`;
311
+ },
312
312
  },
313
- },
314
- });
313
+ }),
314
+ };
315
315
  </script>
316
316
  <style scoped src="./tree-select.css"></style>
@@ -0,0 +1,7 @@
1
+ import type { TransformEventHandlers, ExtractNonOnProps } from '../common/common';
2
+ import type { TdConfigProviderProps } from '../config-provider/type';
3
+
4
+ export type ConfigProviderProps = ExtractNonOnProps<TdConfigProviderProps>;
5
+ export type ConfigProviderEmits = TransformEventHandlers<TdConfigProviderProps, true>;
6
+ declare const ConfigProviderComponent: import('vue').DefineComponent<ConfigProviderProps, {}, {}, {}, {}, {}, {}, ConfigProviderEmits, any>;
7
+ export default ConfigProviderComponent;
@@ -15,6 +15,7 @@ export * from '../col/type';
15
15
  export * from '../collapse/type';
16
16
  export * from '../collapse-panel/type';
17
17
  export * from '../color-picker/type';
18
+ export * from '../config-provider/type';
18
19
  export * from '../count-down/type';
19
20
  export * from '../date-time-picker/type';
20
21
  export * from '../dialog/type';
@@ -43,6 +44,7 @@ export * from '../notice-bar/type';
43
44
  export * from '../overlay/type';
44
45
  export * from '../picker/type';
45
46
  export * from '../picker-item/type';
47
+ export * from '../popover/type';
46
48
  export * from '../popup/type';
47
49
  export * from '../progress/type';
48
50
  export * from '../pull-down-refresh/type';
@@ -0,0 +1,7 @@
1
+ import type { TransformEventHandlers, ExtractNonOnProps } from '../common/common';
2
+ import type { TdPopoverProps } from '../popover/type';
3
+
4
+ export type PopoverProps = ExtractNonOnProps<TdPopoverProps>;
5
+ export type PopoverEmits = TransformEventHandlers<TdPopoverProps, true>;
6
+ declare const PopoverComponent: import('vue').DefineComponent<PopoverProps, {}, {}, {}, {}, {}, {}, PopoverEmits, any>;
7
+ export default PopoverComponent;
@@ -9,36 +9,35 @@ name | type | default | description | required
9
9
  custom-style | Object | - | CSS(Cascading Style Sheets) | N
10
10
  add-btn | Boolean | true | \- | N
11
11
  add-content | String | - | \- | N
12
- allow-upload-duplicate-file | Boolean | false | allow to upload duplicate name files | N
13
- config | Object | - | Typescript:`UploadMpConfig` `type UploadMpConfig = ImageConfig \| VideoConfig` `interface ImageConfig { count?: number; sizeType?: Array<SizeTypeValues>; sourceType?: Array<SourceTypeValues> }` `type SizeTypeValues = 'original' \| 'compressed'` `type SourceTypeValues = 'album' \| 'camera'` `interface VideoConfig { sourceType?: Array<SourceTypeValues>; compressed?: boolean; maxDuration?: number; camera?: 'back' \| 'front' }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
12
+ config | Object | - | Typescript: `UploadMpConfig` `type UploadMpConfig = UploadImageConfig \| UploadVideoConfig` `interface UploadImageConfig { count?: number; sizeType?: Array<SizeTypeValues>; sourceType?: Array<SourceTypeValues> }` `type SizeTypeValues = 'original' \| 'compressed'` `type SourceTypeValues = 'album' \| 'camera'` `interface UploadVideoConfig { sourceType?: Array<SourceTypeValues>; compressed?: boolean; maxDuration?: number; camera?: 'back' \| 'front' }`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
14
13
  disabled | Boolean | undefined | make upload to be disabled | N
15
- draggable | Boolean / Object | - | Typescript:`boolean \| {vibrate?: boolean; collisionVibrate?: boolean}` | N
16
- files | Array | - | `v-model:files` is supported。Typescript:`Array<UploadFile>` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
17
- default-files | Array | - | uncontrolled property。Typescript:`Array<UploadFile>` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
18
- grid-config | Object | - | Typescript:`{column?: number; width?: number; height?: number;}` | N
14
+ draggable | Boolean / Object | - | Typescript: `boolean \| {vibrate?: boolean; collisionVibrate?: boolean}` | N
15
+ files | Array | - | `v-model:files` is supported。Typescript: `Array<UploadFile>` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
16
+ default-files | Array | - | uncontrolled property。Typescript: `Array<UploadFile>` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
17
+ grid-config | Object | - | Typescript: `{column?: number; width?: number; height?: number;}` | N
19
18
  gutter | Number | 16 | \- | N
20
- image-props | Object | - | Typescript:`ImageProps`,[Image API Documents](./image?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
19
+ image-props | Object | - | Typescript: `ImageProps`,[Image API Documents](./image?tab=api)。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
21
20
  max | Number | 0 | max count of files limit | N
22
- media-type | Array | ['image', 'video'] | Typescript:`Array<MediaType>` `type MediaType = 'image' \| 'video'`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
21
+ media-type | Array | ['image', 'video'] | Typescript: `Array<MediaType>` `type MediaType = 'image' \| 'video'`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
23
22
  preview | Boolean | true | \- | N
24
23
  remove-btn | Boolean | true | \- | N
25
- request-method | Function | - | Typescript:`any` | N
26
- size-limit | Number / Object | - | files size limit。Typescript:`number \| SizeLimitObj` `interface SizeLimitObj { size: number; unit: SizeUnit ; message?: string }` `type SizeUnitArray = ['B', 'KB', 'MB', 'GB']` `type SizeUnit = SizeUnitArray[number]`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
24
+ request-method | Function | - | Typescript: `(files: UploadFile \| UploadFile[]) => Promise<RequestMethodResponse>` `interface RequestMethodResponse { status: 'success' \| 'fail'; error?: string; response: { url?: string; files?: UploadFile[]; [key: string]: any } }`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
25
+ size-limit | Number / Object | - | files size limit。Typescript: `number \| SizeLimitObj` `interface SizeLimitObj { size: number; unit: SizeUnit ; message?: string }` `type SizeUnitArray = ['B', 'KB', 'MB', 'GB']` `type SizeUnit = SizeUnitArray[number]`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
27
26
  source | String | media | options: media/messageFile | N
28
- transition | Object | `{backTransition: true, duration: 300, timingFunction: 'ease'}` | Typescript:`Transition` `interface Transition { backTransition?: boolean, duration?: number, timingFunction?: string }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
27
+ transition | Object | { backTransition: true, duration: 300, timingFunction: 'ease' } | Typescript: `Transition` `interface Transition { backTransition?: boolean, duration?: number, timingFunction?: string }`。[see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
29
28
 
30
29
  ### Upload Events
31
30
 
32
31
  name | params | description
33
32
  -- | -- | --
34
- add | `(context: { files: MediaContext })` | \-
33
+ add | `(context: { files: MediaContext })` | [see more ts definition](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts)。<br/>`type MediaContext = VideoContext[] \| ImageContext[]`<br/><br/>`interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }`<br/><br/>`interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number }`<br/>
35
34
  click | `(context: { index: number; file: VideoContext \| ImageContext })` | \-
36
35
  complete | \- | \-
37
36
  drop | `(context: { files: MediaContext }) ` | \-
38
37
  fail | \- | \-
39
38
  remove | `(context: { index: number; file: UploadFile })` | \-
40
39
  select-change | `(context: { files: MediaContext[]; currentSelectedFiles: MediaContext[] })` | \-
41
- success | `(context: { files: MediaContext })` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts)。<br/>`type MediaContext = VideoContext[] \| ImageContext[]`<br/><br/>`interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }`<br/><br/>`interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number }`<br/>
40
+ success | `(context: { files: MediaContext })` | \-
42
41
 
43
42
  ### Upload Slots
44
43
 
@@ -56,7 +55,7 @@ Name | Default Value | Description
56
55
  --td-upload-add-disabled-bg-color | @bg-color-component-disabled | -
57
56
  --td-upload-add-icon-disabled-color | @text-color-disabled | -
58
57
  --td-upload-add-icon-size | 56rpx | -
59
- --td-upload-disabled-mask | rgba(0, 0.6) | -
58
+ --td-upload-disabled-mask | rgba(0, 0, 0, 0.6) | -
60
59
  --td-upload-drag-transition-duration | --td-upload-drag-transition-duration | -
61
60
  --td-upload-drag-transition-timing-function | --td-upload-drag-transition-timing-function | -
62
61
  --td-upload-drag-z-index | 999 | -
@@ -62,36 +62,35 @@ import TUpload from '@tdesign/uniapp/upload/upload.vue';
62
62
  custom-style | Object | - | 自定义样式 | N
63
63
  add-btn | Boolean | true | 添加按钮 | N
64
64
  add-content | String | - | 添加按钮内容 | N
65
- allow-upload-duplicate-file | Boolean | false | 是否允许重复上传相同文件名的文件 | N
66
- config | Object | - | 图片上传配置,视频上传配置,文件上传配置等,包含图片尺寸、图片来源、视频来源、视频拍摄最长时间等。更多细节查看小程序官网。[图片上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)。[视频上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html)。TS 类型:`UploadMpConfig` `type UploadMpConfig = ImageConfig \| VideoConfig` `interface ImageConfig { count?: number; sizeType?: Array<SizeTypeValues>; sourceType?: Array<SourceTypeValues> }` `type SizeTypeValues = 'original' \| 'compressed'` `type SourceTypeValues = 'album' \| 'camera'` `interface VideoConfig { sourceType?: Array<SourceTypeValues>; compressed?: boolean; maxDuration?: number; camera?: 'back' \| 'front' }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
65
+ config | Object | - | 图片上传配置,视频上传配置,文件上传配置等,包含图片尺寸、图片来源、视频来源、视频拍摄最长时间等。更多细节查看小程序官网。[图片上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)。[视频上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html)。TS 类型:`UploadMpConfig` `type UploadMpConfig = UploadImageConfig \| UploadVideoConfig` `interface UploadImageConfig { count?: number; sizeType?: Array<SizeTypeValues>; sourceType?: Array<SourceTypeValues> }` `type SizeTypeValues = 'original' \| 'compressed'` `type SourceTypeValues = 'album' \| 'camera'` `interface UploadVideoConfig { sourceType?: Array<SourceTypeValues>; compressed?: boolean; maxDuration?: number; camera?: 'back' \| 'front' }`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
67
66
  disabled | Boolean | undefined | 是否禁用组件 | N
68
67
  draggable | Boolean / Object | - | 是否支持拖拽排序。长按时是否振动,碰撞时是否振动。示例一:`true`。示例二:`{ vibrate: true, collisionVibrate: true }`。TS 类型:`boolean \| {vibrate?: boolean; collisionVibrate?: boolean}` | N
69
- files | Array | - | 已上传文件列表。支持语法糖 `v-model:files`。TS 类型:`Array<UploadFile>` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
70
- default-files | Array | - | 已上传文件列表。非受控属性。TS 类型:`Array<UploadFile>` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
68
+ files | Array | - | 已上传文件列表。支持语法糖 `v-model:files`。TS 类型:`Array<UploadFile>` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
69
+ default-files | Array | - | 已上传文件列表。非受控属性。TS 类型:`Array<UploadFile>` `interface UploadFile { url: string; name?: string; size?: number; type?: 'image' \| 'video'; percent?: number; status: 'loading' \| 'reload' \| 'failed' \| 'done' }`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
71
70
  grid-config | Object | - | upload组件每行上传图片列数以及图片的宽度和高度。TS 类型:`{column?: number; width?: number; height?: number;}` | N
72
71
  gutter | Number | 16 | 预览窗格的 `gutter` 大小,单位 rpx | N
73
- image-props | Object | - | 透传 Image 组件全部属性。TS 类型:`ImageProps`,[Image API Documents](./image?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
72
+ image-props | Object | - | 透传 Image 组件全部属性。TS 类型:`ImageProps`,[Image API Documents](./image?tab=api)。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
74
73
  max | Number | 0 | 用于控制文件上传数量,值为 0 则不限制 | N
75
- media-type | Array | ['image', 'video'] | 支持上传的文件类型,图片或视频。TS 类型:`Array<MediaType>` `type MediaType = 'image' \| 'video'`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
74
+ media-type | Array | ['image', 'video'] | 支持上传的文件类型,图片或视频。TS 类型:`Array<MediaType>` `type MediaType = 'image' \| 'video'`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
76
75
  preview | Boolean | true | 是否支持图片预览,文件没有预览 | N
77
76
  remove-btn | Boolean | true | 移除按钮 | N
78
- request-method | Function | - | 自定义上传方法。TS 类型:`any` | N
79
- size-limit | Number / Object | - | 图片文件大小限制,默认单位 KB。可选单位有:`'B' \| 'KB' \| 'MB' \| 'GB'`。示例一:`1000`。示例二:`{ size: 2, unit: 'MB', message: '图片大小不超过 {sizeLimit} MB' }`。TS 类型:`number \| SizeLimitObj` `interface SizeLimitObj { size: number; unit: SizeUnit ; message?: string }` `type SizeUnitArray = ['B', 'KB', 'MB', 'GB']` `type SizeUnit = SizeUnitArray[number]`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
77
+ request-method | Function | - | 自定义上传方法。TS 类型:`(files: UploadFile \| UploadFile[]) => Promise<RequestMethodResponse>` `interface RequestMethodResponse { status: 'success' \| 'fail'; error?: string; response: { url?: string; files?: UploadFile[]; [key: string]: any } }`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
78
+ size-limit | Number / Object | - | 图片文件大小限制,默认单位 KB。可选单位有:`'B' \| 'KB' \| 'MB' \| 'GB'`。示例一:`1000`。示例二:`{ size: 2, unit: 'MB', message: '图片大小不超过 {sizeLimit} MB' }`。TS 类型:`number \| SizeLimitObj` `interface SizeLimitObj { size: number; unit: SizeUnit ; message?: string }` `type SizeUnitArray = ['B', 'KB', 'MB', 'GB']` `type SizeUnit = SizeUnitArray[number]`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
80
79
  source | String | media | 来源。可选项:media/messageFile | N
81
- transition | Object | `{backTransition: true, duration: 300, timingFunction: 'ease'}` | 拖拽位置移动时的过渡参数,`duration`单位为ms。TS 类型:`Transition` `interface Transition { backTransition?: boolean, duration?: number, timingFunction?: string }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts) | N
80
+ transition | Object | { backTransition: true, duration: 300, timingFunction: 'ease' } | 拖拽位置移动时的过渡参数,`duration`单位为ms。TS 类型:`Transition` `interface Transition { backTransition?: boolean, duration?: number, timingFunction?: string }`。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts) | N
82
81
 
83
82
  ### Upload Events
84
83
 
85
84
  名称 | 参数 | 描述
86
85
  -- | -- | --
87
- add | `(context: { files: MediaContext })` | 选择后触发,仅包含本次选择的照片;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述
86
+ add | `(context: { files: MediaContext })` | 选择后触发,仅包含本次选择的照片;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述。[详细类型定义](https://github.com/tencent/tdesign-miniprogram/blob/develop/packages/uniapp-components/upload/type.ts)。<br/>`type MediaContext = VideoContext[] \| ImageContext[]`<br/><br/>`interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }`<br/><br/>`interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number }`<br/>
88
87
  click | `(context: { index: number; file: VideoContext \| ImageContext })` | 点击已选文件时触发;常用于重新上传
89
88
  complete | \- | 上传成功或失败后触发
90
89
  drop | `(context: { files: MediaContext }) ` | 拖拽结束后触发,包含所有上传的文件(拖拽后的文件顺序);`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size` 选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述
91
90
  fail | \- | 上传失败后触发
92
91
  remove | `(context: { index: number; file: UploadFile })` | 移除文件时触发
93
92
  select-change | `(context: { files: MediaContext[]; currentSelectedFiles: MediaContext[] })` | 选择文件或图片之后,上传之前,触发该事件。<br />`files` 表示之前已经上传完成的文件列表。<br />`currentSelectedFiles` 表示本次上传选中的文件列表
94
- success | `(context: { files: MediaContext })` | 上传成功后触发,包含所有上传的文件;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/upload/type.ts)。<br/>`type MediaContext = VideoContext[] \| ImageContext[]`<br/><br/>`interface VideoContext { name?: string; type?: string; url?: string; duration?: number; size?: number; width?: number; height?: number; thumb: string; progress: number }`<br/><br/>`interface ImageContext { name: string; type: string; url: string; size: number; width: number; height: number; progress: number }`<br/>
93
+ success | `(context: { files: MediaContext })` | 上传成功后触发,包含所有上传的文件;`url` 表示选定视频的临时文件路径 (本地路径)。`duration` 表示选定视频的时间长度。`size`选定视频的数据量大小。更多描述参考 wx.chooseMedia 小程序官网描述
95
94
 
96
95
  ### Upload Slots
97
96
 
@@ -109,7 +108,7 @@ add-content | 自定义 `add-content` 显示内容
109
108
  --td-upload-add-disabled-bg-color | @bg-color-component-disabled | -
110
109
  --td-upload-add-icon-disabled-color | @text-color-disabled | -
111
110
  --td-upload-add-icon-size | 56rpx | -
112
- --td-upload-disabled-mask | rgba(0, 0.6) | -
111
+ --td-upload-disabled-mask | rgba(0, 0, 0, 0.6) | -
113
112
  --td-upload-drag-transition-duration | --td-upload-drag-transition-duration | -
114
113
  --td-upload-drag-transition-timing-function | --td-upload-drag-transition-timing-function | -
115
114
  --td-upload-drag-z-index | 999 | -
@@ -15,16 +15,14 @@ export default {
15
15
  addContent: {
16
16
  type: String,
17
17
  },
18
- /** 是否允许重复上传相同文件名的文件 */
19
- allowUploadDuplicateFile: Boolean,
20
18
  /** 图片上传配置,视频上传配置,文件上传配置等,包含图片尺寸、图片来源、视频来源、视频拍摄最长时间等。更多细节查看小程序官网。[图片上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)。[视频上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html) */
21
19
  config: {
22
20
  type: Object,
23
21
  },
24
22
  /** 是否禁用组件 */
25
23
  disabled: {
26
- type: Boolean,
27
- default: undefined,
24
+ type: [Boolean, null],
25
+ default: null as TdUploadProps['disabled'],
28
26
  },
29
27
  /** 是否支持拖拽排序。长按时是否振动,碰撞时是否振动。示例一:`true`。示例二:`{ vibrate: true, collisionVibrate: true }` */
30
28
  draggable: {
@@ -16,11 +16,6 @@ export interface TdUploadProps {
16
16
  * 添加按钮内容
17
17
  */
18
18
  addContent?: string;
19
- /**
20
- * 是否允许重复上传相同文件名的文件
21
- * @default false
22
- */
23
- allowUploadDuplicateFile?: boolean;
24
19
  /**
25
20
  * 图片上传配置,视频上传配置,文件上传配置等,包含图片尺寸、图片来源、视频来源、视频拍摄最长时间等。更多细节查看小程序官网。[图片上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)。[视频上传](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html)
26
21
  */
@@ -28,7 +23,7 @@ export interface TdUploadProps {
28
23
  /**
29
24
  * 是否禁用组件
30
25
  */
31
- disabled?: boolean;
26
+ disabled?: boolean | null;
32
27
  /**
33
28
  * 是否支持拖拽排序。长按时是否振动,碰撞时是否振动。示例一:`true`。示例二:`{ vibrate: true, collisionVibrate: true }`
34
29
  */
@@ -77,7 +72,7 @@ export interface TdUploadProps {
77
72
  /**
78
73
  * 自定义上传方法
79
74
  */
80
- requestMethod?: any;
75
+ requestMethod?: (files: UploadFile | UploadFile[]) => Promise<RequestMethodResponse>;
81
76
  /**
82
77
  * 图片文件大小限制,默认单位 KB。可选单位有:`'B' | 'KB' | 'MB' | 'GB'`。示例一:`1000`。示例二:`{ size: 2, unit: 'MB', message: '图片大小不超过 {sizeLimit} MB' }`
83
78
  */
@@ -89,7 +84,7 @@ export interface TdUploadProps {
89
84
  source?: 'media' | 'messageFile';
90
85
  /**
91
86
  * 拖拽位置移动时的过渡参数,`duration`单位为ms
92
- * @default `{backTransition: true, duration: 300, timingFunction: 'ease'}`
87
+ * @default { backTransition: true, duration: 300, timingFunction: 'ease' }
93
88
  */
94
89
  transition?: Transition;
95
90
  /**
@@ -126,9 +121,9 @@ export interface TdUploadProps {
126
121
  onSuccess?: (context: { files: MediaContext }) => void;
127
122
  }
128
123
 
129
- export type UploadMpConfig = ImageConfig | VideoConfig;
124
+ export type UploadMpConfig = UploadImageConfig | UploadVideoConfig;
130
125
 
131
- export interface ImageConfig {
126
+ export interface UploadImageConfig {
132
127
  count?: number;
133
128
  sizeType?: Array<SizeTypeValues>;
134
129
  sourceType?: Array<SourceTypeValues>;
@@ -138,7 +133,7 @@ export type SizeTypeValues = 'original' | 'compressed';
138
133
 
139
134
  export type SourceTypeValues = 'album' | 'camera';
140
135
 
141
- export interface VideoConfig {
136
+ export interface UploadVideoConfig {
142
137
  sourceType?: Array<SourceTypeValues>;
143
138
  compressed?: boolean;
144
139
  maxDuration?: number;
@@ -156,6 +151,12 @@ export interface UploadFile {
156
151
 
157
152
  export type MediaType = 'image' | 'video';
158
153
 
154
+ export interface RequestMethodResponse {
155
+ status: 'success' | 'fail';
156
+ error?: string;
157
+ response: { url?: string; files?: UploadFile[]; [key: string]: any };
158
+ }
159
+
159
160
  export interface SizeLimitObj {
160
161
  size: number;
161
162
  unit: SizeUnit;