@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
@@ -17,7 +17,7 @@
17
17
  :class="tClassPopover + ' ' + classPrefix + '__container ' + (title || body ? classPrefix + '__container--' + modeType : '')"
18
18
  :style="popoverStyle"
19
19
  >
20
- <ContentComp
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
- </ContentComp>
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
- <ContentComp
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
- </ContentComp>
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
- const name = `${prefix}-guide`;
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 uniComponent({
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
- props: {
265
- ...props,
266
- },
267
- data() {
268
- return {
269
- prefix,
270
- classPrefix: name,
271
- visible: false,
272
- iCurrent: -1,
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
- deep: true,
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
- current: {
294
- handler(v) {
295
- this.iCurrent = v;
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
- iCurrent: 'innerInit',
299
- showOverlay: 'innerInit',
300
- },
301
- created() {
302
- that = this;
303
- this.getPlacementResult = this.getPlacement();
304
- },
305
- mounted() {
306
- this.innerInit();
307
- },
308
- methods: {
309
- innerInit: debounce(() => that.init(), 20),
310
- async init() {
311
- const { steps } = this;
312
- const { iCurrent } = this;
313
- const step = steps[iCurrent];
314
- if (!step) {
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
- const modeType = (coalesce(step.mode, this.mode)) === 'dialog' ? 'dialog' : 'popover';
320
- const showOverlay = coalesce(step.showOverlay, this.showOverlay);
321
- this.nonOverlay = !showOverlay;
322
- this.modeType = modeType;
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
- if (modeType === 'popover') {
326
- const rect = await step.element();
327
+ if (modeType === 'popover') {
328
+ const rect = await step.element();
327
329
 
328
- if (!rect) return;
329
- const highlightPadding = rpx2px(coalesce(step.highlightPadding, this.highlightPadding));
330
- const referenceTop = rect.top - highlightPadding;
331
- const referenceRight = systemInfo.windowWidth - rect.right - highlightPadding;
332
- const referenceLeft = rect.left - highlightPadding;
333
- const referenceWidth = rect.width + 2 * highlightPadding;
334
- const referenceHeight = rect.height + 2 * highlightPadding;
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
- const style = {
337
- top: `${referenceTop}px`,
338
- right: `${referenceRight}px`,
339
- left: `${referenceLeft}px`,
340
- width: `${referenceWidth}px`,
341
- height: `${referenceHeight}px`,
342
- };
343
- this.visible = true;
344
- this.referenceStyle = styles(style);
345
- this.title = coalesce(step.title, '');
346
- this.body = coalesce(step.body, '');
347
- this.makeButtonProps(step, 'popover');
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
- const popoverStyle = await this.placementOffset(step, style);
350
- this.popoverStyle = popoverStyle;
351
- } else {
352
- this.visible = true;
353
- this.title = coalesce(step.title, '');
354
- this.body = coalesce(step.body, '');
355
- this.makeButtonProps(step, 'dialog');
356
- }
357
- },
358
- async placementOffset({ placement, offset }, place) {
359
- await nextTick();
360
- const rect = await getRect(this, `.${name}__container`);
361
- const style = this.getPlacementResult[placement]?.(rect, place, offset);
362
- return styles({ position: 'absolute', ...style });
363
- },
364
- makeButtonProps(step, mode) {
365
- const {
366
- tClassSkip,
367
- tClassNext,
368
- tClassBack,
369
- tClassFinish,
370
- } = this;
371
- let skipButton = coalesce(step.skipButtonProps, this.skipButtonProps);
372
- const size = mode === 'popover' ? 'extra-small' : 'medium';
373
- skipButton = {
374
- theme: 'light',
375
- content: '跳过',
376
- size,
377
- ...skipButton,
378
- tClass: `${tClassSkip} ${name}__button ${skipButton?.class || ''}`,
379
- type: 'skip',
380
- };
381
- let nextButton = coalesce(step.nextButtonProps, this.nextButtonProps);
382
- nextButton = {
383
- theme: 'primary',
384
- content: '下一步',
385
- size,
386
- ...nextButton,
387
- tClass: `${tClassNext} ${name}__button ${nextButton?.class || ''}`,
388
- type: 'next',
389
- };
390
- nextButton = { ...nextButton, content: this.buttonContent(nextButton) };
391
- let backButton = coalesce(step.backButtonProps, this.backButtonProps);
392
- backButton = {
393
- theme: 'light',
394
- content: '返回',
395
- size,
396
- ...backButton,
397
- tClass: `${tClassBack} ${name}__button ${backButton?.class || ''}`,
398
- type: 'back',
399
- };
400
- let finishButton = coalesce(step.finishButtonProps, this.finishButtonProps);
401
- finishButton = {
402
- theme: 'primary',
403
- content: '完成',
404
- size,
405
- ...finishButton,
406
- tClass: `${tClassFinish} ${name}__button ${finishButton?.class || ''}`,
407
- type: 'finish',
408
- };
409
- finishButton = { ...finishButton, content: this.buttonContent(finishButton) };
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
- this.skipButton = skipButton;
412
- this.nextButton = nextButton;
413
- this.backButton = backButton;
414
- this.finishButton = finishButton;
415
- },
416
- renderCounter() {
417
- const { steps, iCurrent, counter } = this;
418
- const stepsTotal = steps.length;
419
- const innerCurrent = iCurrent + 1;
420
- const popupSlotCounter = isFunction(counter) ? counter({ total: stepsTotal, current: innerCurrent }) : counter;
421
- return counter ? popupSlotCounter : `(${innerCurrent}/${stepsTotal})`;
422
- },
423
- buttonContent(button) {
424
- const { hideCounter } = this;
425
- return `${button.content.replace(/ \(.*?\)/, '')} ${hideCounter ? '' : this.renderCounter()}`;
426
- },
427
- onTplButtonTap(e, { type }) {
428
- const params = { e, current: this.iCurrent, total: this.steps.length };
429
- switch (type) {
430
- case 'next':
431
- this.$emit('next-step-click', { next: this.iCurrent + 1, ...params });
432
- this.iCurrent = this.iCurrent + 1;
433
- break;
434
- case 'skip':
435
- this.$emit('skip', params);
436
- this.iCurrent = -1;
437
- break;
438
- case 'back':
439
- this.$emit('back', params);
440
- this.iCurrent = 0;
441
- break;
442
- case 'finish':
443
- this.$emit('finish', params);
444
- this.iCurrent = -1;
445
- break;
446
- default:
447
- break;
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
- this.$emit('change', { current: this.iCurrent });
451
- },
452
- getPlacement() {
453
- const space = rpx2px(32);
454
- const offsetLeft = offset => unitConvert(isNumeric(offset?.[0]) ? `${offset?.[0]}rpx` : offset?.[0] || 0);
455
- const offsetTop = offset => unitConvert(isNumeric(offset?.[1]) ? `${offset?.[1]}rpx` : offset?.[1] || 0);
456
- const left = place => parseFloat(place.left);
457
- const right = place => parseFloat(place.right);
458
- const top = place => parseFloat(place.top);
459
- const height = place => parseFloat(place.height);
460
- const width = place => parseFloat(place.width);
461
- return {
462
- center: (rect, place, offset) => ({
463
- top: `${Math.max(height(place) + top(place) + space + offsetTop(offset), 1)}px`,
464
- left: `${Math.max(width(place) / 2 + left(place) - rect.width / 2 + offsetLeft(offset), 1)}px`,
465
- }),
466
- bottom: (rect, place, offset) => ({
467
- top: `${Math.max(height(place) + top(place) + space + offsetTop(offset), 1)}px`,
468
- left: `${Math.max(width(place) / 2 + left(place) - rect.width / 2 + offsetLeft(offset), 1)}px`,
469
- }),
470
- 'bottom-left': (rect, place, offset) => ({
471
- top: `${Math.max(height(place) + top(place) + space + offsetTop(offset), 1)}px`,
472
- left: `${Math.max(left(place) + offsetLeft(offset), 1)}px`,
473
- }),
474
- 'bottom-right': (rect, place, offset) => ({
475
- top: `${Math.max(height(place) + top(place) + space + offsetTop(offset), 1)}px`,
476
- right: `${Math.max(right(place) - offsetLeft(offset), 1)}px`,
477
- }),
478
- left: (rect, place, offset) => ({
479
- top: `${Math.max(height(place) / 2 + top(place) - rect.height / 2 + offsetTop(offset), 1)}px`,
480
- right: `${Math.max(width(place) + right(place) + space - offsetLeft(offset), 1)}px`,
481
- }),
482
- 'left-top': (rect, place, offset) => ({
483
- top: `${Math.max(top(place) + offsetTop(offset), 1)}px`,
484
- right: `${Math.max(width(place) + right(place) + space - offsetLeft(offset), 1)}px`,
485
- }),
486
- 'left-bottom': (rect, place, offset) => ({
487
- top: `${Math.max(top(place) + height(place) - rect.height - offsetTop(offset), 1)}px`,
488
- right: `${Math.max(width(place) + right(place) + space - offsetLeft(offset), 1)}px`,
489
- }),
490
- right: (rect, place, offset) => ({
491
- top: `${Math.max(height(place) / 2 + top(place) - rect.height / 2 + offsetTop(offset), 1)}px`,
492
- left: `${Math.max(left(place) + width(place) + space + offsetLeft(offset), 1)}px`,
493
- }),
494
- 'right-top': (rect, place, offset) => ({
495
- top: `${Math.max(top(place) + offsetTop(offset), 1)}px`,
496
- left: `${Math.max(left(place) + width(place) + space + offsetLeft(offset), 1)}px`,
497
- }),
498
- 'right-bottom': (rect, place, offset) => ({
499
- top: `${Math.max(top(place) + height(place) - rect.height - offsetTop(offset), 1)}px`,
500
- left: `${Math.max(left(place) + width(place) + space + offsetLeft(offset), 1)}px`,
501
- }),
502
- top: (rect, place, offset) => ({
503
- top: `${Math.max(top(place) - rect.height - space + offsetTop(offset), 1)}px`,
504
- left: `${Math.max(width(place) / 2 + left(place) - rect.width / 2 + offsetLeft(offset), 1)}px`,
505
- }),
506
- 'top-left': (rect, place, offset) => ({
507
- top: `${Math.max(top(place) - rect.height - space + offsetTop(offset), 1)}px`,
508
- left: `${Math.max(left(place) + offsetLeft(offset), 1)}px`,
509
- }),
510
- 'top-right': (rect, place, offset) => ({
511
- top: `${Math.max(top(place) - rect.height - space + offsetTop(offset), 1)}px`,
512
- right: `${Math.max(right(place) - offsetLeft(offset), 1)}px`,
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>
@@ -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 | - |