@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
package/dist/guide/guide.vue
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
:class="tClassPopover + ' ' + classPrefix + '__container ' + (title || body ? classPrefix + '__container--' + modeType : '')"
|
|
18
18
|
:style="popoverStyle"
|
|
19
19
|
>
|
|
20
|
-
<
|
|
20
|
+
<content-comp
|
|
21
21
|
:title="title"
|
|
22
22
|
:body="body"
|
|
23
23
|
:current="iCurrent"
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
<template #body-6>
|
|
103
103
|
<slot name="body-6" />
|
|
104
104
|
</template>
|
|
105
|
-
</
|
|
105
|
+
</content-comp>
|
|
106
106
|
</view>
|
|
107
107
|
</view>
|
|
108
108
|
</t-overlay>
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
>
|
|
118
118
|
<view :class="tClass + ' ' + classPrefix">
|
|
119
119
|
<view :class="tClassPopover + ' ' + classPrefix + '__container ' + (title || body ? classPrefix + '__container--' + modeType : '')">
|
|
120
|
-
<
|
|
120
|
+
<content-comp
|
|
121
121
|
:title="title"
|
|
122
122
|
:body="body"
|
|
123
123
|
:current="iCurrent"
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
<template #body-6>
|
|
203
203
|
<slot name="body-6" />
|
|
204
204
|
</template>
|
|
205
|
-
</
|
|
205
|
+
</content-comp>
|
|
206
206
|
</view>
|
|
207
207
|
</view>
|
|
208
208
|
</t-popup>
|
|
@@ -211,7 +211,6 @@
|
|
|
211
211
|
|
|
212
212
|
<script>
|
|
213
213
|
import TOverlay from '../overlay/overlay';
|
|
214
|
-
import TButton from '../button/button';
|
|
215
214
|
import TPopup from '../popup/popup';
|
|
216
215
|
import { uniComponent } from '../common/src/index';
|
|
217
216
|
import props from './props';
|
|
@@ -222,299 +221,304 @@ import ContentComp from './content.vue';
|
|
|
222
221
|
|
|
223
222
|
import useCustomNavbar from '../mixins/using-custom-navbar';
|
|
224
223
|
|
|
225
|
-
|
|
224
|
+
import usingConfig from '../mixins/using-config';
|
|
225
|
+
const componentName = 'guide';
|
|
226
|
+
const name = `${prefix}-${componentName}`;
|
|
226
227
|
|
|
227
228
|
let that;
|
|
228
229
|
|
|
229
|
-
export default
|
|
230
|
-
name,
|
|
231
|
-
options: {
|
|
232
|
-
styleIsolation: 'shared',
|
|
233
|
-
},
|
|
234
|
-
controlledProps: [
|
|
235
|
-
{
|
|
236
|
-
key: 'current',
|
|
237
|
-
event: 'change',
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
externalClasses: [
|
|
241
|
-
`${prefix}-class`,
|
|
242
|
-
`${prefix}-class-reference`,
|
|
243
|
-
`${prefix}-class-popover`,
|
|
244
|
-
|
|
245
|
-
`${prefix}-class-tooltip`,
|
|
246
|
-
`${prefix}-class-title`,
|
|
247
|
-
`${prefix}-class-body`,
|
|
248
|
-
`${prefix}-class-footer`,
|
|
249
|
-
|
|
250
|
-
`${prefix}-class-skip`,
|
|
251
|
-
`${prefix}-class-next`,
|
|
252
|
-
`${prefix}-class-back`,
|
|
253
|
-
`${prefix}-class-finish`,
|
|
254
|
-
],
|
|
255
|
-
mixins: [
|
|
256
|
-
useCustomNavbar,
|
|
257
|
-
],
|
|
230
|
+
export default {
|
|
258
231
|
components: {
|
|
259
232
|
TOverlay,
|
|
260
|
-
TButton,
|
|
261
233
|
TPopup,
|
|
262
234
|
ContentComp,
|
|
263
235
|
},
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
referenceStyle: '',
|
|
274
|
-
popoverStyle: '',
|
|
275
|
-
title: '',
|
|
276
|
-
body: '',
|
|
277
|
-
nonOverlay: false,
|
|
278
|
-
modeType: '',
|
|
279
|
-
|
|
280
|
-
skipButton: {},
|
|
281
|
-
backButton: {},
|
|
282
|
-
nextButton: {},
|
|
283
|
-
finishButton: {},
|
|
284
|
-
};
|
|
285
|
-
},
|
|
286
|
-
watch: {
|
|
287
|
-
steps: {
|
|
288
|
-
handler() {
|
|
289
|
-
this.innerInit();
|
|
236
|
+
...uniComponent({
|
|
237
|
+
name,
|
|
238
|
+
options: {
|
|
239
|
+
styleIsolation: 'shared',
|
|
240
|
+
},
|
|
241
|
+
controlledProps: [
|
|
242
|
+
{
|
|
243
|
+
key: 'current',
|
|
244
|
+
event: 'change',
|
|
290
245
|
},
|
|
291
|
-
|
|
246
|
+
],
|
|
247
|
+
externalClasses: [
|
|
248
|
+
`${prefix}-class`,
|
|
249
|
+
`${prefix}-class-reference`,
|
|
250
|
+
`${prefix}-class-popover`,
|
|
251
|
+
|
|
252
|
+
`${prefix}-class-tooltip`,
|
|
253
|
+
`${prefix}-class-title`,
|
|
254
|
+
`${prefix}-class-body`,
|
|
255
|
+
`${prefix}-class-footer`,
|
|
256
|
+
|
|
257
|
+
`${prefix}-class-skip`,
|
|
258
|
+
`${prefix}-class-next`,
|
|
259
|
+
`${prefix}-class-back`,
|
|
260
|
+
`${prefix}-class-finish`,
|
|
261
|
+
],
|
|
262
|
+
mixins: [
|
|
263
|
+
useCustomNavbar,
|
|
264
|
+
usingConfig({ componentName }),
|
|
265
|
+
],
|
|
266
|
+
props: {
|
|
267
|
+
...props,
|
|
292
268
|
},
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
269
|
+
data() {
|
|
270
|
+
return {
|
|
271
|
+
prefix,
|
|
272
|
+
classPrefix: name,
|
|
273
|
+
visible: false,
|
|
274
|
+
iCurrent: -1,
|
|
275
|
+
referenceStyle: '',
|
|
276
|
+
popoverStyle: '',
|
|
277
|
+
title: '',
|
|
278
|
+
body: '',
|
|
279
|
+
nonOverlay: false,
|
|
280
|
+
modeType: '',
|
|
281
|
+
|
|
282
|
+
skipButton: {},
|
|
283
|
+
backButton: {},
|
|
284
|
+
nextButton: {},
|
|
285
|
+
finishButton: {},
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
watch: {
|
|
289
|
+
steps: {
|
|
290
|
+
handler() {
|
|
291
|
+
this.innerInit();
|
|
292
|
+
},
|
|
293
|
+
deep: true,
|
|
294
|
+
},
|
|
295
|
+
current: {
|
|
296
|
+
handler(v) {
|
|
297
|
+
this.iCurrent = v;
|
|
298
|
+
},
|
|
296
299
|
},
|
|
300
|
+
iCurrent: 'innerInit',
|
|
301
|
+
showOverlay: 'innerInit',
|
|
297
302
|
},
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
this.visible = false;
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
303
|
+
created() {
|
|
304
|
+
that = this;
|
|
305
|
+
this.getPlacementResult = this.getPlacement();
|
|
306
|
+
},
|
|
307
|
+
mounted() {
|
|
308
|
+
this.innerInit();
|
|
309
|
+
},
|
|
310
|
+
methods: {
|
|
311
|
+
innerInit: debounce(() => that.init(), 20),
|
|
312
|
+
async init() {
|
|
313
|
+
const { steps } = this;
|
|
314
|
+
const { iCurrent } = this;
|
|
315
|
+
const step = steps[iCurrent];
|
|
316
|
+
if (!step) {
|
|
317
|
+
this.visible = false;
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
318
320
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
const modeType = (coalesce(step.mode, this.mode)) === 'dialog' ? 'dialog' : 'popover';
|
|
322
|
+
const showOverlay = coalesce(step.showOverlay, this.showOverlay);
|
|
323
|
+
this.nonOverlay = !showOverlay;
|
|
324
|
+
this.modeType = modeType;
|
|
323
325
|
|
|
324
326
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
+
if (modeType === 'popover') {
|
|
328
|
+
const rect = await step.element();
|
|
327
329
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
330
|
+
if (!rect) return;
|
|
331
|
+
const highlightPadding = rpx2px(coalesce(step.highlightPadding, this.highlightPadding));
|
|
332
|
+
const referenceTop = rect.top - highlightPadding;
|
|
333
|
+
const referenceRight = systemInfo.windowWidth - rect.right - highlightPadding;
|
|
334
|
+
const referenceLeft = rect.left - highlightPadding;
|
|
335
|
+
const referenceWidth = rect.width + 2 * highlightPadding;
|
|
336
|
+
const referenceHeight = rect.height + 2 * highlightPadding;
|
|
335
337
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
338
|
+
const style = {
|
|
339
|
+
top: `${referenceTop}px`,
|
|
340
|
+
right: `${referenceRight}px`,
|
|
341
|
+
left: `${referenceLeft}px`,
|
|
342
|
+
width: `${referenceWidth}px`,
|
|
343
|
+
height: `${referenceHeight}px`,
|
|
344
|
+
};
|
|
345
|
+
this.visible = true;
|
|
346
|
+
this.referenceStyle = styles(style);
|
|
347
|
+
this.title = coalesce(step.title, '');
|
|
348
|
+
this.body = coalesce(step.body, '');
|
|
349
|
+
this.makeButtonProps(step, 'popover');
|
|
348
350
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
351
|
+
const popoverStyle = await this.placementOffset(step, style);
|
|
352
|
+
this.popoverStyle = popoverStyle;
|
|
353
|
+
} else {
|
|
354
|
+
this.visible = true;
|
|
355
|
+
this.title = coalesce(step.title, '');
|
|
356
|
+
this.body = coalesce(step.body, '');
|
|
357
|
+
this.makeButtonProps(step, 'dialog');
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
async placementOffset({ placement, offset }, place) {
|
|
361
|
+
await nextTick();
|
|
362
|
+
const rect = await getRect(this, `.${name}__container`);
|
|
363
|
+
const style = this.getPlacementResult[placement]?.(rect, place, offset);
|
|
364
|
+
return styles({ position: 'absolute', ...style });
|
|
365
|
+
},
|
|
366
|
+
makeButtonProps(step, mode) {
|
|
367
|
+
const {
|
|
368
|
+
tClassSkip,
|
|
369
|
+
tClassNext,
|
|
370
|
+
tClassBack,
|
|
371
|
+
tClassFinish,
|
|
372
|
+
globalConfig,
|
|
373
|
+
} = this;
|
|
374
|
+
let skipButton = coalesce(step.skipButtonProps, this.skipButtonProps);
|
|
375
|
+
const size = mode === 'popover' ? 'extra-small' : 'medium';
|
|
376
|
+
skipButton = {
|
|
377
|
+
theme: 'light',
|
|
378
|
+
content: globalConfig.skip,
|
|
379
|
+
size,
|
|
380
|
+
...skipButton,
|
|
381
|
+
tClass: `${tClassSkip} ${name}__button ${skipButton?.class || ''}`,
|
|
382
|
+
type: 'skip',
|
|
383
|
+
};
|
|
384
|
+
let nextButton = coalesce(step.nextButtonProps, this.nextButtonProps);
|
|
385
|
+
nextButton = {
|
|
386
|
+
theme: 'primary',
|
|
387
|
+
content: globalConfig.next,
|
|
388
|
+
size,
|
|
389
|
+
...nextButton,
|
|
390
|
+
tClass: `${tClassNext} ${name}__button ${nextButton?.class || ''}`,
|
|
391
|
+
type: 'next',
|
|
392
|
+
};
|
|
393
|
+
nextButton = { ...nextButton, content: this.buttonContent(nextButton) };
|
|
394
|
+
let backButton = coalesce(step.backButtonProps, this.backButtonProps);
|
|
395
|
+
backButton = {
|
|
396
|
+
theme: 'light',
|
|
397
|
+
content: globalConfig.back,
|
|
398
|
+
size,
|
|
399
|
+
...backButton,
|
|
400
|
+
tClass: `${tClassBack} ${name}__button ${backButton?.class || ''}`,
|
|
401
|
+
type: 'back',
|
|
402
|
+
};
|
|
403
|
+
let finishButton = coalesce(step.finishButtonProps, this.finishButtonProps);
|
|
404
|
+
finishButton = {
|
|
405
|
+
theme: 'primary',
|
|
406
|
+
content: globalConfig.finish,
|
|
407
|
+
size,
|
|
408
|
+
...finishButton,
|
|
409
|
+
tClass: `${tClassFinish} ${name}__button ${finishButton?.class || ''}`,
|
|
410
|
+
type: 'finish',
|
|
411
|
+
};
|
|
412
|
+
finishButton = { ...finishButton, content: this.buttonContent(finishButton) };
|
|
410
413
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
414
|
+
this.skipButton = skipButton;
|
|
415
|
+
this.nextButton = nextButton;
|
|
416
|
+
this.backButton = backButton;
|
|
417
|
+
this.finishButton = finishButton;
|
|
418
|
+
},
|
|
419
|
+
renderCounter() {
|
|
420
|
+
const { steps, iCurrent, counter } = this;
|
|
421
|
+
const stepsTotal = steps.length;
|
|
422
|
+
const innerCurrent = iCurrent + 1;
|
|
423
|
+
const popupSlotCounter = isFunction(counter) ? counter({ total: stepsTotal, current: innerCurrent }) : counter;
|
|
424
|
+
return counter ? popupSlotCounter : `(${innerCurrent}/${stepsTotal})`;
|
|
425
|
+
},
|
|
426
|
+
buttonContent(button) {
|
|
427
|
+
const { hideCounter } = this;
|
|
428
|
+
return `${button.content.replace(/ \(.*?\)/, '')} ${hideCounter ? '' : this.renderCounter()}`;
|
|
429
|
+
},
|
|
430
|
+
onTplButtonTap(e, { type }) {
|
|
431
|
+
const params = { e, current: this.iCurrent, total: this.steps.length };
|
|
432
|
+
switch (type) {
|
|
433
|
+
case 'next':
|
|
434
|
+
this.$emit('next-step-click', { next: this.iCurrent + 1, ...params });
|
|
435
|
+
this.iCurrent = this.iCurrent + 1;
|
|
436
|
+
break;
|
|
437
|
+
case 'skip':
|
|
438
|
+
this.$emit('skip', params);
|
|
439
|
+
this.iCurrent = -1;
|
|
440
|
+
break;
|
|
441
|
+
case 'back':
|
|
442
|
+
this.$emit('back', params);
|
|
443
|
+
this.iCurrent = 0;
|
|
444
|
+
break;
|
|
445
|
+
case 'finish':
|
|
446
|
+
this.$emit('finish', params);
|
|
447
|
+
this.iCurrent = -1;
|
|
448
|
+
break;
|
|
449
|
+
default:
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
449
452
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
453
|
+
this.$emit('change', { current: this.iCurrent });
|
|
454
|
+
},
|
|
455
|
+
getPlacement() {
|
|
456
|
+
const space = rpx2px(32);
|
|
457
|
+
const offsetLeft = offset => unitConvert(isNumeric(offset?.[0]) ? `${offset?.[0]}rpx` : offset?.[0] || 0);
|
|
458
|
+
const offsetTop = offset => unitConvert(isNumeric(offset?.[1]) ? `${offset?.[1]}rpx` : offset?.[1] || 0);
|
|
459
|
+
const left = place => parseFloat(place.left);
|
|
460
|
+
const right = place => parseFloat(place.right);
|
|
461
|
+
const top = place => parseFloat(place.top);
|
|
462
|
+
const height = place => parseFloat(place.height);
|
|
463
|
+
const width = place => parseFloat(place.width);
|
|
464
|
+
return {
|
|
465
|
+
center: (rect, place, offset) => ({
|
|
466
|
+
top: `${Math.max(height(place) + top(place) + space + offsetTop(offset), 1)}px`,
|
|
467
|
+
left: `${Math.max(width(place) / 2 + left(place) - rect.width / 2 + offsetLeft(offset), 1)}px`,
|
|
468
|
+
}),
|
|
469
|
+
bottom: (rect, place, offset) => ({
|
|
470
|
+
top: `${Math.max(height(place) + top(place) + space + offsetTop(offset), 1)}px`,
|
|
471
|
+
left: `${Math.max(width(place) / 2 + left(place) - rect.width / 2 + offsetLeft(offset), 1)}px`,
|
|
472
|
+
}),
|
|
473
|
+
'bottom-left': (rect, place, offset) => ({
|
|
474
|
+
top: `${Math.max(height(place) + top(place) + space + offsetTop(offset), 1)}px`,
|
|
475
|
+
left: `${Math.max(left(place) + offsetLeft(offset), 1)}px`,
|
|
476
|
+
}),
|
|
477
|
+
'bottom-right': (rect, place, offset) => ({
|
|
478
|
+
top: `${Math.max(height(place) + top(place) + space + offsetTop(offset), 1)}px`,
|
|
479
|
+
right: `${Math.max(right(place) - offsetLeft(offset), 1)}px`,
|
|
480
|
+
}),
|
|
481
|
+
left: (rect, place, offset) => ({
|
|
482
|
+
top: `${Math.max(height(place) / 2 + top(place) - rect.height / 2 + offsetTop(offset), 1)}px`,
|
|
483
|
+
right: `${Math.max(width(place) + right(place) + space - offsetLeft(offset), 1)}px`,
|
|
484
|
+
}),
|
|
485
|
+
'left-top': (rect, place, offset) => ({
|
|
486
|
+
top: `${Math.max(top(place) + offsetTop(offset), 1)}px`,
|
|
487
|
+
right: `${Math.max(width(place) + right(place) + space - offsetLeft(offset), 1)}px`,
|
|
488
|
+
}),
|
|
489
|
+
'left-bottom': (rect, place, offset) => ({
|
|
490
|
+
top: `${Math.max(top(place) + height(place) - rect.height - offsetTop(offset), 1)}px`,
|
|
491
|
+
right: `${Math.max(width(place) + right(place) + space - offsetLeft(offset), 1)}px`,
|
|
492
|
+
}),
|
|
493
|
+
right: (rect, place, offset) => ({
|
|
494
|
+
top: `${Math.max(height(place) / 2 + top(place) - rect.height / 2 + offsetTop(offset), 1)}px`,
|
|
495
|
+
left: `${Math.max(left(place) + width(place) + space + offsetLeft(offset), 1)}px`,
|
|
496
|
+
}),
|
|
497
|
+
'right-top': (rect, place, offset) => ({
|
|
498
|
+
top: `${Math.max(top(place) + offsetTop(offset), 1)}px`,
|
|
499
|
+
left: `${Math.max(left(place) + width(place) + space + offsetLeft(offset), 1)}px`,
|
|
500
|
+
}),
|
|
501
|
+
'right-bottom': (rect, place, offset) => ({
|
|
502
|
+
top: `${Math.max(top(place) + height(place) - rect.height - offsetTop(offset), 1)}px`,
|
|
503
|
+
left: `${Math.max(left(place) + width(place) + space + offsetLeft(offset), 1)}px`,
|
|
504
|
+
}),
|
|
505
|
+
top: (rect, place, offset) => ({
|
|
506
|
+
top: `${Math.max(top(place) - rect.height - space + offsetTop(offset), 1)}px`,
|
|
507
|
+
left: `${Math.max(width(place) / 2 + left(place) - rect.width / 2 + offsetLeft(offset), 1)}px`,
|
|
508
|
+
}),
|
|
509
|
+
'top-left': (rect, place, offset) => ({
|
|
510
|
+
top: `${Math.max(top(place) - rect.height - space + offsetTop(offset), 1)}px`,
|
|
511
|
+
left: `${Math.max(left(place) + offsetLeft(offset), 1)}px`,
|
|
512
|
+
}),
|
|
513
|
+
'top-right': (rect, place, offset) => ({
|
|
514
|
+
top: `${Math.max(top(place) - rect.height - space + offsetTop(offset), 1)}px`,
|
|
515
|
+
right: `${Math.max(right(place) - offsetLeft(offset), 1)}px`,
|
|
516
|
+
}),
|
|
517
|
+
};
|
|
518
|
+
},
|
|
515
519
|
},
|
|
516
|
-
},
|
|
517
|
-
}
|
|
520
|
+
}),
|
|
521
|
+
};
|
|
518
522
|
|
|
519
523
|
</script>
|
|
520
524
|
<style scoped src="./guide.css"></style>
|
package/dist/icon/README.md
CHANGED
|
@@ -75,8 +75,6 @@ import TIcon from '@tdesign/uniapp/icon/icon.vue';
|
|
|
75
75
|
|
|
76
76
|
{{ iconImage }}
|
|
77
77
|
|
|
78
|
-
<td-icons-view framework-content/>
|
|
79
|
-
|
|
80
78
|
## API
|
|
81
79
|
|
|
82
80
|
### Icon Props
|
|
@@ -105,5 +103,5 @@ t-class | 根节点样式类
|
|
|
105
103
|
|
|
106
104
|
组件提供了下列 CSS 变量,可用于自定义样式。
|
|
107
105
|
| 名称 | 默认值 | 描述 |
|
|
108
|
-
| -- | -- | -- |
|
|
109
|
-
| ant: norma | ant: norma | - |
|
|
106
|
+
| -- | -- | -- |
|
|
107
|
+
| ant: norma | ant: norma | - |
|