@tdesign/uniapp 0.7.3 → 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.
- package/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/dist/action-sheet/README.md +1 -1
- package/dist/action-sheet/action-sheet.vue +158 -150
- package/dist/action-sheet/props.ts +2 -2
- package/dist/action-sheet/type.ts +1 -1
- package/dist/avatar/avatar.vue +89 -87
- package/dist/avatar-group/avatar-group.vue +69 -67
- package/dist/back-top/back-top.vue +60 -58
- package/dist/badge/badge.vue +69 -59
- package/dist/button/button.vue +121 -116
- package/dist/button/props.ts +2 -2
- package/dist/button/type.ts +1 -1
- package/dist/calendar/calendar-header.vue +4 -4
- package/dist/calendar/calendar.vue +308 -297
- package/dist/calendar/template.vue +1 -1
- package/dist/cascader/README.en-US.md +2 -1
- package/dist/cascader/README.md +2 -1
- package/dist/cascader/cascader.vue +340 -328
- package/dist/cascader/props.ts +6 -1
- package/dist/cascader/type.ts +6 -0
- package/dist/cell/cell.vue +127 -121
- package/dist/cell-group/cell-group.vue +32 -30
- package/dist/check-tag/check-tag.vue +73 -71
- package/dist/checkbox/checkbox.vue +127 -127
- package/dist/checkbox/props.ts +6 -6
- package/dist/checkbox/type.ts +3 -3
- package/dist/checkbox-group/checkbox-group.vue +175 -173
- package/dist/checkbox-group/props.ts +6 -6
- package/dist/checkbox-group/type.ts +4 -4
- package/dist/col/col.vue +26 -24
- package/dist/collapse/collapse.vue +83 -81
- package/dist/collapse-panel/collapse-panel.vue +121 -119
- package/dist/collapse-panel/props.ts +4 -4
- package/dist/collapse-panel/type.ts +2 -2
- package/dist/color-picker/README.md +1 -1
- package/dist/color-picker/color-picker.vue +324 -322
- package/dist/color-picker/props.ts +2 -2
- package/dist/color-picker/template.vue +14 -10
- package/dist/common/common.ts +1 -0
- package/dist/common/style/theme/index.css +5 -5
- package/dist/common/utils.js +7 -2
- package/dist/common/validator.js +172 -0
- package/dist/config-provider/README.en-US.md +184 -0
- package/dist/config-provider/README.md +234 -0
- package/dist/config-provider/config-provider.vue +105 -0
- package/dist/config-provider/config-store.js +70 -0
- package/dist/config-provider/props.ts +16 -0
- package/dist/config-provider/reactive-state.js +39 -0
- package/dist/config-provider/type.ts +401 -0
- package/dist/config-provider/use-config.js +29 -0
- package/dist/config-provider/utils.js +29 -0
- package/dist/count-down/count-down.vue +98 -97
- package/dist/date-time-picker/date-time-picker.vue +410 -395
- package/dist/demo/demo.vue +1 -0
- package/dist/dialog/dialog.vue +175 -173
- package/dist/divider/divider.vue +38 -36
- package/dist/draggable/draggable.vue +60 -58
- package/dist/drawer/README.md +1 -1
- package/dist/drawer/drawer.vue +48 -46
- package/dist/dropdown-item/dropdown-item.vue +209 -207
- package/dist/dropdown-item/props.ts +4 -4
- package/dist/dropdown-item/type.ts +3 -3
- package/dist/dropdown-menu/dropdown-menu.vue +93 -99
- package/dist/empty/empty.vue +43 -42
- package/dist/fab/fab.vue +88 -86
- package/dist/footer/footer.vue +36 -34
- package/dist/form/README.en-US.md +17 -24
- package/dist/form/README.md +18 -25
- package/dist/form/form.css +1 -166
- package/dist/form/form.vue +251 -236
- package/dist/form/props.ts +2 -21
- package/dist/form/type.ts +7 -70
- package/dist/form-item/README.en-US.md +4 -5
- package/dist/form-item/README.md +4 -5
- package/dist/form-item/form-item.css +69 -96
- package/dist/form-item/form-item.vue +315 -336
- package/dist/form-item/form-model.ts +125 -173
- package/dist/form-item/props.ts +4 -17
- package/dist/form-item/type.ts +43 -1
- package/dist/grid/grid.vue +53 -51
- package/dist/grid-item/grid-item.vue +121 -119
- package/dist/guide/README.md +1 -1
- package/dist/guide/guide.vue +281 -277
- package/dist/icon/README.md +2 -4
- package/dist/icon/icon.vue +78 -76
- package/dist/image/README.md +1 -1
- package/dist/image/image.vue +103 -101
- package/dist/image-viewer/image-viewer.vue +160 -158
- package/dist/image-viewer/props.ts +2 -2
- package/dist/image-viewer/type.ts +1 -1
- package/dist/index.js +3 -0
- package/dist/indexes/indexes.vue +264 -267
- package/dist/indexes-anchor/indexes-anchor.vue +41 -41
- package/dist/input/input.vue +192 -192
- package/dist/input/props.ts +6 -6
- package/dist/input/type.ts +3 -3
- package/dist/link/link.vue +73 -71
- package/dist/loading/loading.vue +59 -59
- package/dist/locale/ar_KW.ts +157 -0
- package/dist/locale/en_US.ts +146 -0
- package/dist/locale/it_IT.ts +145 -0
- package/dist/locale/ja_JP.ts +132 -0
- package/dist/locale/ko_KR.ts +132 -0
- package/dist/locale/ru_RU.ts +157 -0
- package/dist/locale/zh_CN.ts +133 -0
- package/dist/locale/zh_TW.ts +132 -0
- package/dist/message/message.vue +181 -173
- package/dist/message/props.ts +2 -2
- package/dist/message/type.ts +1 -1
- package/dist/message-item/message-item.vue +192 -184
- package/dist/mixins/using-config.js +39 -0
- package/dist/navbar/navbar.vue +201 -199
- package/dist/notice-bar/notice-bar.vue +175 -171
- package/dist/notice-bar/props.ts +2 -2
- package/dist/notice-bar/type.ts +1 -1
- package/dist/npm/dayjs/esm/locale/ar.js +81 -0
- package/dist/npm/dayjs/esm/locale/it.js +39 -0
- package/dist/overlay/overlay.vue +50 -48
- package/dist/picker/picker.vue +168 -161
- package/dist/picker-item/picker-item.vue +269 -269
- package/dist/popover/README.md +1 -1
- package/dist/popover/popover.vue +262 -261
- package/dist/popover/props.ts +4 -4
- package/dist/popover/type.ts +2 -2
- package/dist/popup/popup.vue +46 -45
- package/dist/progress/README.md +1 -1
- package/dist/progress/progress.vue +76 -76
- package/dist/pull-down-refresh/props.ts +2 -2
- package/dist/pull-down-refresh/pull-down-refresh.vue +240 -234
- package/dist/pull-down-refresh/type.ts +1 -1
- package/dist/qrcode/README.md +1 -1
- package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.vue +340 -338
- package/dist/qrcode/components/qrcode-status/qrcode-status.vue +6 -6
- package/dist/qrcode/qrcode.vue +93 -87
- package/dist/radio/props.ts +6 -6
- package/dist/radio/radio.vue +118 -120
- package/dist/radio/type.ts +3 -3
- package/dist/radio-group/props.ts +4 -4
- package/dist/radio-group/radio-group.vue +136 -134
- package/dist/radio-group/type.ts +4 -4
- package/dist/rate/computed.js +2 -2
- package/dist/rate/props.ts +4 -4
- package/dist/rate/rate.vue +155 -154
- package/dist/rate/type.ts +2 -2
- package/dist/result/result.vue +41 -39
- package/dist/row/row.vue +38 -36
- package/dist/scroll-view/scroll-view.vue +24 -22
- package/dist/search/props.ts +2 -2
- package/dist/search/search.vue +127 -125
- package/dist/search/type.ts +1 -1
- package/dist/side-bar/side-bar.vue +57 -55
- package/dist/side-bar-item/side-bar-item.vue +86 -86
- package/dist/skeleton/skeleton.vue +126 -124
- package/dist/slider/README.md +1 -1
- package/dist/slider/props.ts +2 -2
- package/dist/slider/slider.vue +457 -457
- package/dist/slider/type.ts +1 -1
- package/dist/step-item/step-item.vue +77 -75
- package/dist/stepper/props.ts +2 -2
- package/dist/stepper/stepper.vue +168 -149
- package/dist/stepper/type.ts +1 -1
- package/dist/steps/props.ts +2 -2
- package/dist/steps/steps.vue +83 -81
- package/dist/steps/type.ts +1 -1
- package/dist/sticky/sticky.vue +104 -102
- package/dist/swipe-cell/swipe-cell.vue +91 -89
- package/dist/swiper/README.md +1 -1
- package/dist/swiper/swiper.vue +91 -89
- package/dist/swiper-nav/swiper-nav.vue +38 -36
- package/dist/switch/props.ts +2 -2
- package/dist/switch/switch.vue +62 -62
- package/dist/switch/type.ts +1 -1
- package/dist/tab-bar/tab-bar.vue +88 -86
- package/dist/tab-bar-item/tab-bar-item.vue +85 -82
- package/dist/tab-panel/tab-panel.vue +66 -64
- package/dist/tabs/tabs.vue +294 -287
- package/dist/tag/tag.vue +79 -77
- package/dist/textarea/props.ts +6 -6
- package/dist/textarea/textarea.vue +127 -126
- package/dist/textarea/type.ts +3 -3
- package/dist/toast/toast.vue +107 -106
- package/dist/transition/transition.vue +30 -28
- package/dist/tree-select/tree-select.vue +151 -151
- package/dist/types/config-provider.d.ts +7 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/popover.d.ts +7 -0
- package/dist/upload/README.en-US.md +13 -14
- package/dist/upload/README.md +11 -12
- package/dist/upload/props.ts +2 -4
- package/dist/upload/type.ts +12 -11
- package/dist/upload/upload.css +1 -1
- package/dist/upload/upload.vue +672 -512
- package/dist/watermark/watermark.vue +151 -149
- package/global.d.ts +2 -0
- package/package.json +15 -3
- 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([
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
|
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
|
-
|
|
157
|
-
|
|
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
|
-
|
|
183
|
-
|
|
140
|
+
styleIsolation: 'shared',
|
|
141
|
+
},
|
|
142
|
+
controlledProps: [
|
|
143
|
+
{
|
|
144
|
+
key: 'value',
|
|
145
|
+
event: 'change',
|
|
184
146
|
},
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
193
|
-
immediate: true,
|
|
194
|
+
multiple: 'buildTreeOptions',
|
|
194
195
|
},
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
206
|
+
if (!options.length) return;
|
|
208
207
|
|
|
209
|
-
|
|
208
|
+
const treeOptions = [];
|
|
210
209
|
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
let level = -1;
|
|
211
|
+
let currentNode = { children: options };
|
|
213
212
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
222
|
+
treeOptions.push(currentLevelOptions);
|
|
224
223
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
230
|
+
const depth = getTreeDepth(options, keys?.children);
|
|
232
231
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
232
|
+
// 补齐 treeOptions 长度到 depth
|
|
233
|
+
while (treeOptions.length < depth) {
|
|
234
|
+
treeOptions.push([]);
|
|
235
|
+
level += 1;
|
|
236
|
+
}
|
|
238
237
|
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
246
|
+
this.innerValue = innerValue;
|
|
247
|
+
this.leafLevel = leafLevel;
|
|
248
|
+
this.treeOptions = treeOptions;
|
|
249
|
+
},
|
|
251
250
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
259
|
+
this.scrollIntoView = scrollIntoView;
|
|
260
|
+
} else {
|
|
261
|
+
if (scrollIntoView === null) return;
|
|
262
|
+
this.scrollIntoView = null;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
266
265
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
266
|
+
onRootChange(e) {
|
|
267
|
+
const { innerValue } = this;
|
|
268
|
+
const { value: itemValue } = e;
|
|
270
269
|
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
this.getScrollIntoView('none');
|
|
271
|
+
innerValue[0] = itemValue;
|
|
273
272
|
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
this._trigger('change', { value: innerValue, level: 0 });
|
|
274
|
+
},
|
|
276
275
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
276
|
+
handleTreeClick(e) {
|
|
277
|
+
const { level, value: itemValue } = e.currentTarget.dataset;
|
|
278
|
+
const { innerValue } = this;
|
|
280
279
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
280
|
+
innerValue[level] = itemValue;
|
|
281
|
+
this.getScrollIntoView('none');
|
|
282
|
+
this._trigger('change', { value: innerValue, level: 1 });
|
|
283
|
+
},
|
|
285
284
|
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
handleChange({ level, type, value }) {
|
|
286
|
+
const { innerValue } = this;
|
|
288
287
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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
|
-
|
|
300
|
-
|
|
301
|
-
|
|
298
|
+
this.getScrollIntoView('none');
|
|
299
|
+
this._trigger('change', { value: innerValue, level });
|
|
300
|
+
},
|
|
302
301
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
16
|
-
files | Array | - | `v-model:files` is supported。Typescript
|
|
17
|
-
default-files | Array | - | uncontrolled property。Typescript
|
|
18
|
-
grid-config | Object | - | Typescript
|
|
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
|
|
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
|
|
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
|
|
26
|
-
size-limit | Number / Object | - | files size limit。Typescript
|
|
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 |
|
|
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 })` |
|
|
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 | -
|
package/dist/upload/README.md
CHANGED
|
@@ -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
|
-
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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 类型:`
|
|
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/
|
|
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 |
|
|
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
|
|
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 | -
|
package/dist/upload/props.ts
CHANGED
|
@@ -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:
|
|
24
|
+
type: [Boolean, null],
|
|
25
|
+
default: null as TdUploadProps['disabled'],
|
|
28
26
|
},
|
|
29
27
|
/** 是否支持拖拽排序。长按时是否振动,碰撞时是否振动。示例一:`true`。示例二:`{ vibrate: true, collisionVibrate: true }` */
|
|
30
28
|
draggable: {
|
package/dist/upload/type.ts
CHANGED
|
@@ -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?:
|
|
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
|
|
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 =
|
|
124
|
+
export type UploadMpConfig = UploadImageConfig | UploadVideoConfig;
|
|
130
125
|
|
|
131
|
-
export interface
|
|
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
|
|
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;
|