@tdesign/uniapp 0.8.1 → 0.9.1
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 +31 -0
- package/dist/action-sheet/README.en-US.md +4 -3
- package/dist/action-sheet/README.md +4 -3
- package/dist/action-sheet/action-sheet.vue +16 -12
- package/dist/action-sheet/computed.js +1 -1
- package/dist/action-sheet/props.ts +5 -0
- package/dist/action-sheet/type.ts +6 -1
- package/dist/avatar/README.en-US.md +1 -1
- package/dist/avatar/README.md +1 -1
- package/dist/avatar/avatar.vue +10 -9
- package/dist/avatar-group/avatar-group.vue +4 -4
- package/dist/back-top/README.en-US.md +1 -1
- package/dist/back-top/README.md +1 -1
- package/dist/back-top/back-top.vue +5 -4
- package/dist/badge/README.en-US.md +2 -1
- package/dist/badge/README.md +2 -1
- package/dist/badge/badge.css +1 -1
- package/dist/badge/badge.vue +4 -2
- package/dist/button/README.en-US.md +1 -1
- package/dist/button/README.md +1 -1
- package/dist/button/button.vue +17 -11
- package/dist/calendar/README.en-US.md +1 -1
- package/dist/calendar/README.md +1 -1
- package/dist/calendar/calendar-header.vue +2 -1
- package/dist/calendar/calendar.vue +15 -9
- package/dist/calendar/template.vue +12 -9
- package/dist/cascader/README.en-US.md +1 -1
- package/dist/cascader/README.md +1 -1
- package/dist/cascader/cascader.vue +8 -8
- package/dist/cell/README.en-US.md +1 -1
- package/dist/cell/README.md +1 -1
- package/dist/cell/cell.vue +34 -36
- package/dist/cell-group/cell-group.vue +5 -3
- package/dist/check-tag/check-tag.vue +6 -3
- package/dist/checkbox/README.en-US.md +1 -1
- package/dist/checkbox/README.md +1 -1
- package/dist/checkbox/checkbox.vue +5 -4
- package/dist/checkbox-group/checkbox-group.vue +5 -3
- package/dist/col/col.vue +7 -3
- package/dist/collapse/README.en-US.md +1 -1
- package/dist/collapse/README.md +1 -1
- package/dist/collapse/collapse.vue +6 -4
- package/dist/collapse-panel/collapse-panel.vue +15 -6
- package/dist/color-picker/README.en-US.md +1 -1
- package/dist/color-picker/README.md +1 -1
- package/dist/color-picker/color-picker.vue +9 -7
- package/dist/color-picker/template.vue +2 -1
- package/dist/common/canvas/index.js +1 -1
- package/dist/common/shared/color-picker/color.js +1 -0
- package/dist/common/src/instantiationDecorator.js +1 -1
- package/dist/common/style/theme/index-light.css +282 -0
- package/dist/common/style/theme/index-light.less +9 -0
- package/dist/common/style/theme/raw/_components-light.less +8 -0
- package/dist/common/style/theme/raw/_light-only.less +181 -0
- package/dist/common/version.js +1 -1
- package/dist/config-provider/config-provider.vue +3 -1
- package/dist/count-down/README.en-US.md +1 -1
- package/dist/count-down/README.md +1 -1
- package/dist/count-down/count-down.vue +5 -3
- package/dist/date-time-picker/README.en-US.md +1 -1
- package/dist/date-time-picker/README.md +1 -1
- package/dist/date-time-picker/date-time-picker.vue +8 -6
- package/dist/date-time-picker/locale/dayjs.js +6 -6
- package/dist/demo-navbar/demo-navbar.vue +1 -1
- package/dist/dialog/README.en-US.md +1 -1
- package/dist/dialog/README.md +1 -1
- package/dist/dialog/dialog.vue +10 -7
- package/dist/dialog/index.js +2 -1
- package/dist/divider/README.en-US.md +1 -1
- package/dist/divider/README.md +1 -1
- package/dist/divider/divider.vue +4 -2
- package/dist/draggable/draggable.vue +5 -2
- package/dist/drawer/README.en-US.md +1 -1
- package/dist/drawer/README.md +1 -1
- package/dist/drawer/drawer.vue +7 -5
- package/dist/dropdown-item/dropdown-item.vue +16 -11
- package/dist/dropdown-menu/README.en-US.md +1 -1
- package/dist/dropdown-menu/README.md +1 -1
- package/dist/dropdown-menu/dropdown-menu.vue +11 -9
- package/dist/empty/README.en-US.md +1 -1
- package/dist/empty/README.md +1 -1
- package/dist/empty/empty.vue +5 -4
- package/dist/fab/README.en-US.md +1 -1
- package/dist/fab/README.md +1 -1
- package/dist/fab/fab.vue +9 -6
- package/dist/fab/props.ts +1 -1
- package/dist/fab/type.ts +1 -1
- package/dist/footer/README.en-US.md +1 -1
- package/dist/footer/README.md +1 -1
- package/dist/footer/footer.vue +8 -7
- package/dist/form/README.en-US.md +3 -1
- package/dist/form/README.md +3 -1
- package/dist/form/form.vue +4 -2
- package/dist/form/props.ts +9 -0
- package/dist/form/type.ts +5 -0
- package/dist/form-item/README.en-US.md +2 -1
- package/dist/form-item/README.md +2 -1
- package/dist/form-item/form-item.css +2 -2
- package/dist/form-item/form-item.vue +36 -27
- package/dist/form-item/props.ts +8 -0
- package/dist/form-item/type.ts +4 -0
- package/dist/grid/README.en-US.md +1 -1
- package/dist/grid/README.md +1 -1
- package/dist/grid/grid.vue +4 -3
- package/dist/grid-item/README.en-US.md +1 -1
- package/dist/grid-item/README.md +1 -1
- package/dist/grid-item/grid-item.vue +8 -6
- package/dist/guide/README.en-US.md +1 -1
- package/dist/guide/README.md +1 -1
- package/dist/guide/guide.vue +8 -7
- package/dist/icon/icon.vue +5 -2
- package/dist/image/README.en-US.md +1 -1
- package/dist/image/README.md +1 -1
- package/dist/image/image.vue +6 -5
- package/dist/image-viewer/README.en-US.md +4 -3
- package/dist/image-viewer/README.md +4 -3
- package/dist/image-viewer/image-viewer.css +12 -0
- package/dist/image-viewer/image-viewer.vue +84 -21
- package/dist/image-viewer/props.ts +5 -0
- package/dist/image-viewer/type.ts +6 -1
- package/dist/indexes/README.en-US.md +1 -1
- package/dist/indexes/README.md +1 -1
- package/dist/indexes/computed.js +6 -2
- package/dist/indexes/indexes.css +7 -2
- package/dist/indexes/indexes.vue +8 -5
- package/dist/indexes/props.ts +5 -0
- package/dist/indexes/type.ts +5 -0
- package/dist/indexes-anchor/README.en-US.md +1 -1
- package/dist/indexes-anchor/README.md +1 -1
- package/dist/indexes-anchor/indexes-anchor.vue +5 -3
- package/dist/input/README.en-US.md +1 -1
- package/dist/input/README.md +1 -1
- package/dist/input/input.vue +9 -7
- package/dist/link/README.en-US.md +1 -1
- package/dist/link/README.md +1 -1
- package/dist/link/link.vue +6 -3
- package/dist/loading/README.en-US.md +1 -1
- package/dist/loading/README.md +1 -1
- package/dist/loading/loading.vue +4 -2
- package/dist/message/index.js +2 -1
- package/dist/message/message.vue +4 -3
- package/dist/message-item/index.js +1 -1
- package/dist/message-item/message-item.vue +7 -5
- package/dist/mixins/page-scroll.js +1 -1
- package/dist/mixins/using-config.js +1 -1
- package/dist/mixins/using-custom-navbar.js +1 -1
- package/dist/navbar/README.en-US.md +1 -1
- package/dist/navbar/README.md +2 -2
- package/dist/navbar/navbar.vue +5 -4
- package/dist/notice-bar/README.en-US.md +1 -1
- package/dist/notice-bar/README.md +1 -1
- package/dist/notice-bar/notice-bar.vue +4 -3
- package/dist/overlay/README.en-US.md +1 -1
- package/dist/overlay/README.md +1 -1
- package/dist/overlay/overlay.vue +6 -3
- package/dist/picker/README.en-US.md +1 -1
- package/dist/picker/README.md +1 -1
- package/dist/picker/picker.vue +11 -9
- package/dist/picker-item/README.en-US.md +1 -1
- package/dist/picker-item/README.md +1 -1
- package/dist/picker-item/picker-item.vue +6 -5
- package/dist/popover/README.en-US.md +1 -1
- package/dist/popover/README.md +1 -1
- package/dist/popover/popover.vue +8 -5
- package/dist/popup/README.en-US.md +1 -1
- package/dist/popup/README.md +1 -1
- package/dist/popup/popup.vue +8 -5
- package/dist/progress/README.en-US.md +1 -1
- package/dist/progress/README.md +1 -1
- package/dist/progress/progress.vue +5 -4
- package/dist/pull-down-refresh/README.en-US.md +1 -1
- package/dist/pull-down-refresh/README.md +1 -1
- package/dist/pull-down-refresh/pull-down-refresh.vue +7 -5
- package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.vue +8 -7
- package/dist/qrcode/components/qrcode-status/qrcode-status.vue +2 -1
- package/dist/qrcode/qrcode.vue +5 -3
- package/dist/radio/README.en-US.md +1 -1
- package/dist/radio/README.md +1 -1
- package/dist/radio/radio.vue +5 -4
- package/dist/radio-group/radio-group.vue +5 -4
- package/dist/rate/README.en-US.md +1 -1
- package/dist/rate/README.md +1 -1
- package/dist/rate/rate.vue +8 -5
- package/dist/result/README.en-US.md +1 -1
- package/dist/result/README.md +1 -1
- package/dist/result/result.vue +5 -4
- package/dist/row/row.vue +7 -3
- package/dist/scroll-view/scroll-view.vue +1 -1
- package/dist/search/README.en-US.md +1 -1
- package/dist/search/README.md +1 -1
- package/dist/search/search.css +5 -0
- package/dist/search/search.vue +21 -21
- package/dist/segmented/README.en-US.md +42 -0
- package/dist/segmented/README.md +75 -0
- package/dist/segmented/props.ts +31 -0
- package/dist/segmented/segmented.css +66 -0
- package/dist/segmented/segmented.vue +177 -0
- package/dist/segmented/type.ts +41 -0
- package/dist/side-bar/README.en-US.md +1 -1
- package/dist/side-bar/README.md +1 -1
- package/dist/side-bar/side-bar.vue +5 -3
- package/dist/side-bar-item/side-bar-item.vue +7 -6
- package/dist/skeleton/README.en-US.md +1 -1
- package/dist/skeleton/README.md +1 -1
- package/dist/skeleton/skeleton.vue +6 -3
- package/dist/slider/README.en-US.md +1 -1
- package/dist/slider/README.md +1 -1
- package/dist/slider/slider.vue +7 -5
- package/dist/step-item/step-item.vue +5 -4
- package/dist/stepper/README.en-US.md +1 -1
- package/dist/stepper/README.md +1 -1
- package/dist/stepper/stepper.vue +5 -3
- package/dist/steps/README.en-US.md +1 -1
- package/dist/steps/README.md +1 -1
- package/dist/steps/steps.vue +5 -3
- package/dist/sticky/sticky.vue +4 -3
- package/dist/swipe-cell/swipe-cell.vue +7 -5
- package/dist/swiper/README.en-US.md +1 -1
- package/dist/swiper/README.md +1 -1
- package/dist/swiper/swiper.vue +7 -5
- package/dist/swiper-nav/swiper-nav.vue +6 -3
- package/dist/switch/README.en-US.md +1 -1
- package/dist/switch/README.md +1 -1
- package/dist/switch/switch.vue +5 -4
- package/dist/tab-bar/README.en-US.md +1 -1
- package/dist/tab-bar/README.md +1 -1
- package/dist/tab-bar/tab-bar.vue +5 -3
- package/dist/tab-bar-item/tab-bar-item.vue +10 -10
- package/dist/tab-panel/tab-panel.vue +5 -3
- package/dist/table/README.en-US.md +72 -0
- package/dist/table/README.md +117 -0
- package/dist/table/base-table-props.ts +105 -0
- package/dist/table/props.ts +94 -0
- package/dist/table/table.css +251 -0
- package/dist/table/table.vue +582 -0
- package/dist/table/type.ts +180 -0
- package/dist/tabs/README.en-US.md +1 -1
- package/dist/tabs/README.md +1 -1
- package/dist/tabs/tabs.css +4 -0
- package/dist/tabs/tabs.vue +11 -9
- package/dist/tag/README.en-US.md +1 -1
- package/dist/tag/README.md +1 -1
- package/dist/tag/tag.vue +6 -3
- package/dist/textarea/README.en-US.md +1 -1
- package/dist/textarea/README.md +1 -1
- package/dist/textarea/textarea.vue +6 -3
- package/dist/theme-light.css +282 -0
- package/dist/theme-light.css.d.ts +2 -0
- package/dist/theme-light.less +1 -0
- package/dist/theme-light.less.d.ts +2 -0
- package/dist/toast/README.en-US.md +1 -1
- package/dist/toast/README.md +1 -1
- package/dist/toast/toast.vue +8 -7
- package/dist/transition/transition.vue +2 -2
- package/dist/tree-select/README.en-US.md +1 -1
- package/dist/tree-select/README.md +1 -1
- package/dist/tree-select/tree-select.vue +14 -9
- package/dist/types/action-sheet.d.ts +1 -1
- package/dist/types/avatar-group.d.ts +1 -1
- package/dist/types/avatar.d.ts +1 -1
- package/dist/types/back-top.d.ts +1 -1
- package/dist/types/badge.d.ts +1 -1
- package/dist/types/button.d.ts +1 -1
- package/dist/types/calendar.d.ts +1 -1
- package/dist/types/cascader.d.ts +1 -1
- package/dist/types/cell-group.d.ts +1 -1
- package/dist/types/cell.d.ts +1 -1
- package/dist/types/check-tag.d.ts +1 -1
- package/dist/types/checkbox-group.d.ts +1 -1
- package/dist/types/checkbox.d.ts +1 -1
- package/dist/types/col.d.ts +1 -1
- package/dist/types/collapse-panel.d.ts +1 -1
- package/dist/types/collapse.d.ts +1 -1
- package/dist/types/color-picker.d.ts +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/segmented.d.ts +7 -0
- package/dist/types/table.d.ts +7 -0
- package/dist/upload/README.en-US.md +1 -1
- package/dist/upload/README.md +1 -1
- package/dist/upload/upload.vue +32 -32
- package/dist/watermark/README.en-US.md +1 -1
- package/dist/watermark/README.md +1 -1
- package/dist/watermark/utils/generateBase64Url.js +6 -6
- package/dist/watermark/watermark.vue +4 -3
- package/global.d.ts +2 -0
- package/package.json +33 -9
- package/{dist/script → script}/postinstall.js +18 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
|
|
5
|
+
* */
|
|
6
|
+
|
|
7
|
+
import type { TdSegmentedProps } from './type';
|
|
8
|
+
export default {
|
|
9
|
+
/** 是否撑满父元素宽度 */
|
|
10
|
+
block: Boolean,
|
|
11
|
+
/** 是否禁用 */
|
|
12
|
+
disabled: Boolean,
|
|
13
|
+
/** 数据化配置选项内容 */
|
|
14
|
+
options: {
|
|
15
|
+
type: Object,
|
|
16
|
+
default: (): TdSegmentedProps['options'] => [],
|
|
17
|
+
},
|
|
18
|
+
/** 当前选中的值 */
|
|
19
|
+
value: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
},
|
|
22
|
+
/** 当前选中的值,非受控属性 */
|
|
23
|
+
defaultValue: {
|
|
24
|
+
type: [String, Number],
|
|
25
|
+
},
|
|
26
|
+
/** 选项值发生变化时触发 */
|
|
27
|
+
onChange: {
|
|
28
|
+
type: Function,
|
|
29
|
+
default: () => ({}),
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.t-segmented {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
padding: calc(var(--td-spacer, 16rpx) / 4);
|
|
4
|
+
background-color: var(--td-segmented-bg-color, var(--td-bg-color-component-disabled, var(--td-gray-color-2, #eeeeee)));
|
|
5
|
+
border-radius: calc(var(--td-spacer, 16rpx) / 2);
|
|
6
|
+
}
|
|
7
|
+
.t-segmented--block {
|
|
8
|
+
display: flex;
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
.t-segmented--block .t-segmented__item {
|
|
12
|
+
flex: 1;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
}
|
|
15
|
+
.t-segmented--block .t-segmented__item-inner {
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
text-overflow: ellipsis;
|
|
18
|
+
}
|
|
19
|
+
.t-segmented__group {
|
|
20
|
+
position: relative;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: stretch;
|
|
23
|
+
justify-items: flex-start;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
.t-segmented__thumb {
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
height: 100%;
|
|
31
|
+
background-color: var(--td-segmented-item-active-bg, var(--td-bg-color-container, var(--td-font-white-1, #ffffff)));
|
|
32
|
+
border-radius: calc(var(--td-spacer, 16rpx) / 2);
|
|
33
|
+
transition: var(--td-segmented-transition, all var(--td-anim-duration-base, 0.2s) var(--td-anim-time-fn-easing, cubic-bezier(0.38, 0, 0.24, 1)));
|
|
34
|
+
will-change: transform, width;
|
|
35
|
+
}
|
|
36
|
+
.t-segmented__item {
|
|
37
|
+
position: relative;
|
|
38
|
+
z-index: 1;
|
|
39
|
+
flex: none;
|
|
40
|
+
padding: calc(var(--td-spacer-1, 24rpx) / 4) var(--td-spacer-1, 24rpx);
|
|
41
|
+
text-align: center;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
font: var(--td-segmented-item-label-font, var(--td-font-body-medium, 28rpx / 44rpx var(--td-font-family, PingFang SC, Microsoft YaHei, Arial Regular)));
|
|
44
|
+
color: var(--td-segmented-item-color, var(--td-text-color-primary, var(--td-font-gray-1, rgba(0, 0, 0, 0.9))));
|
|
45
|
+
}
|
|
46
|
+
.t-segmented__item-inner {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
}
|
|
52
|
+
:deep(.t-segmented__item-icon:not(:empty)) {
|
|
53
|
+
margin-right: calc(var(--td-spacer, 16rpx) / 2);
|
|
54
|
+
}
|
|
55
|
+
.t-segmented__item-icon {
|
|
56
|
+
font-size: var(--td-font-size-m, 32rpx);
|
|
57
|
+
}
|
|
58
|
+
.t-segmented__item--active {
|
|
59
|
+
font-weight: 600;
|
|
60
|
+
color: var(--td-segmented-item-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));
|
|
61
|
+
}
|
|
62
|
+
.t-segmented__item--disabled {
|
|
63
|
+
cursor: not-allowed;
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
color: var(--td-segmented-item-disabled-color, var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, 0.26))));
|
|
66
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="'' + tools.cls(classPrefix, [['block', block]]) + ' ' + tClass"
|
|
4
|
+
:style="'' + tools._style([customStyle])"
|
|
5
|
+
>
|
|
6
|
+
<view :class="classPrefix + '__group'">
|
|
7
|
+
<!-- thumb 动画背景 -->
|
|
8
|
+
<view
|
|
9
|
+
:class="classPrefix + '__thumb ' + tClassThumb"
|
|
10
|
+
:style="thumbStyle"
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
<!-- 选项列表 -->
|
|
14
|
+
<view
|
|
15
|
+
v-for="(item, index) in segmentItems"
|
|
16
|
+
:key="index"
|
|
17
|
+
:class="'' + tools.cls(classPrefix + '__item', [
|
|
18
|
+
['active', index === activeIndex],
|
|
19
|
+
['disabled', disabled || item.disabled]
|
|
20
|
+
]) + ' ' + classPrefix + '-item-' + index + ' ' + tClassItem"
|
|
21
|
+
@click="handleSelect(index)"
|
|
22
|
+
>
|
|
23
|
+
<view :class="classPrefix + '__item-inner'">
|
|
24
|
+
<block
|
|
25
|
+
v-if="item.icon"
|
|
26
|
+
name="icon"
|
|
27
|
+
>
|
|
28
|
+
<t-icon
|
|
29
|
+
:name="item.icon.name || item.icon"
|
|
30
|
+
:t-class="classPrefix + '__item-icon'"
|
|
31
|
+
/>
|
|
32
|
+
</block>
|
|
33
|
+
<span
|
|
34
|
+
v-if="item.label"
|
|
35
|
+
:class="classPrefix + '__item-label'"
|
|
36
|
+
>{{ item.label }}</span>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
</view>
|
|
40
|
+
</view>
|
|
41
|
+
</template>
|
|
42
|
+
<script>
|
|
43
|
+
import { prefix } from '../common/config';
|
|
44
|
+
import { uniComponent } from '../common/src/index';
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
import { calcIcon, getRect, coalesce } from '../common/utils';
|
|
48
|
+
import tools from '../common/utils.wxs';
|
|
49
|
+
import TIcon from '../icon/icon';
|
|
50
|
+
|
|
51
|
+
import props from './props';
|
|
52
|
+
|
|
53
|
+
const name = `${prefix}-segmented`;
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
components: {
|
|
57
|
+
TIcon,
|
|
58
|
+
},
|
|
59
|
+
...uniComponent({
|
|
60
|
+
name,
|
|
61
|
+
options: {
|
|
62
|
+
styleIsolation: 'shared',
|
|
63
|
+
},
|
|
64
|
+
controlledProps: [
|
|
65
|
+
{
|
|
66
|
+
key: 'value',
|
|
67
|
+
event: 'change',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
externalClasses: [
|
|
71
|
+
`${prefix}-class`,
|
|
72
|
+
`${prefix}-class-thumb`,
|
|
73
|
+
`${prefix}-class-item`,
|
|
74
|
+
],
|
|
75
|
+
props: {
|
|
76
|
+
...props,
|
|
77
|
+
},
|
|
78
|
+
emits: ['change'],
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
prefix,
|
|
82
|
+
classPrefix: name,
|
|
83
|
+
tools,
|
|
84
|
+
segmentItems: [],
|
|
85
|
+
activeIndex: -1,
|
|
86
|
+
thumbStyle: '',
|
|
87
|
+
|
|
88
|
+
dataValue: coalesce(this.value, this.defaultValue),
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
watch: {
|
|
92
|
+
options: {
|
|
93
|
+
handler(newOptions) {
|
|
94
|
+
this.updateOptions(newOptions);
|
|
95
|
+
},
|
|
96
|
+
immediate: true,
|
|
97
|
+
},
|
|
98
|
+
value: {
|
|
99
|
+
handler(val) {
|
|
100
|
+
this.dataValue = val;
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
dataValue: {
|
|
104
|
+
handler() {
|
|
105
|
+
this.updateActiveIndex();
|
|
106
|
+
},
|
|
107
|
+
immediate: true,
|
|
108
|
+
},
|
|
109
|
+
segmentItems() {
|
|
110
|
+
this.updateActiveIndex();
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
mounted() {
|
|
114
|
+
this.$nextTick(() => {
|
|
115
|
+
this.updateThumb();
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
methods: {
|
|
119
|
+
updateOptions(options) {
|
|
120
|
+
if (!options?.length) return;
|
|
121
|
+
const segmentItems = options.map((option) => {
|
|
122
|
+
if (typeof option === 'string' || typeof option === 'number') {
|
|
123
|
+
return { value: option, label: String(option) };
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
...option,
|
|
127
|
+
label: option.label ?? String(option.value),
|
|
128
|
+
icon: option.icon ? calcIcon(option.icon) : null,
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
this.segmentItems = segmentItems;
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
updateActiveIndex() {
|
|
135
|
+
const { dataValue, segmentItems } = this;
|
|
136
|
+
let activeIndex = -1;
|
|
137
|
+
if (dataValue != null) {
|
|
138
|
+
activeIndex = segmentItems.findIndex(item => item.value === dataValue);
|
|
139
|
+
}
|
|
140
|
+
if (activeIndex === this.activeIndex) return;
|
|
141
|
+
this.activeIndex = activeIndex;
|
|
142
|
+
this.$nextTick(() => {
|
|
143
|
+
this.updateThumb();
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
updateThumb() {
|
|
148
|
+
const { activeIndex, classPrefix } = this;
|
|
149
|
+
if (activeIndex < 0) return;
|
|
150
|
+
const groupClass = `.${classPrefix}__group`;
|
|
151
|
+
const itemClass = `.${classPrefix}-item-${activeIndex}`;
|
|
152
|
+
Promise.all([
|
|
153
|
+
getRect(this, itemClass),
|
|
154
|
+
getRect(this, groupClass),
|
|
155
|
+
]).then(([itemRect, groupRect]) => {
|
|
156
|
+
if (itemRect && groupRect) {
|
|
157
|
+
const left = itemRect.left - groupRect.left;
|
|
158
|
+
this.thumbStyle = `width: ${itemRect.width}px; transform: translateX(${left}px);`;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
handleSelect(index) {
|
|
164
|
+
const { segmentItems, activeIndex, disabled, options } = this;
|
|
165
|
+
const item = segmentItems[index];
|
|
166
|
+
if (disabled || !item || item.disabled) return;
|
|
167
|
+
if (index === activeIndex) return;
|
|
168
|
+
this._trigger('change', {
|
|
169
|
+
value: item.value,
|
|
170
|
+
selectedOption: options[index],
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
}),
|
|
175
|
+
};
|
|
176
|
+
</script>
|
|
177
|
+
<style scoped src="./segmented.css"></style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
|
|
5
|
+
* */
|
|
6
|
+
|
|
7
|
+
export interface TdSegmentedProps {
|
|
8
|
+
/**
|
|
9
|
+
* 是否撑满父元素宽度
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
block?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 是否禁用
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 数据化配置选项内容
|
|
19
|
+
* @default []
|
|
20
|
+
*/
|
|
21
|
+
options?: string[] | number[] | SegmentedItem[];
|
|
22
|
+
/**
|
|
23
|
+
* 当前选中的值
|
|
24
|
+
*/
|
|
25
|
+
value?: string | number;
|
|
26
|
+
/**
|
|
27
|
+
* 当前选中的值,非受控属性
|
|
28
|
+
*/
|
|
29
|
+
defaultValue?: string | number;
|
|
30
|
+
/**
|
|
31
|
+
* 选项值发生变化时触发
|
|
32
|
+
*/
|
|
33
|
+
onChange?: (context: { value: string | number; selectedOption: SegmentedItem }) => void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface SegmentedItem {
|
|
37
|
+
value: string | number;
|
|
38
|
+
label?: string;
|
|
39
|
+
icon?: string | object;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
}
|
|
@@ -44,7 +44,7 @@ name | Description
|
|
|
44
44
|
### CSS Variables
|
|
45
45
|
|
|
46
46
|
The component provides the following CSS variables, which can be used to customize styles.
|
|
47
|
-
Name | Default Value | Description
|
|
47
|
+
Name | Default Value | Description
|
|
48
48
|
-- | -- | --
|
|
49
49
|
--td-side-bar-bg-color | @bg-color-secondarycontainer | -
|
|
50
50
|
--td-side-bar-height | 100% | -
|
package/dist/side-bar/README.md
CHANGED
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
</view>
|
|
9
9
|
</template>
|
|
10
10
|
<script>
|
|
11
|
-
import { uniComponent } from '../common/src/index';
|
|
12
11
|
import { prefix } from '../common/config';
|
|
12
|
+
import { ParentMixin, RELATION_MAP } from '../common/relation';
|
|
13
|
+
import { uniComponent } from '../common/src/index';
|
|
13
14
|
import { coalesce } from '../common/utils';
|
|
14
|
-
|
|
15
|
+
|
|
15
16
|
import tools from '../common/utils.wxs';
|
|
16
|
-
|
|
17
|
+
|
|
18
|
+
import props from './props';
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
const name = `${prefix}-side-bar`;
|
|
@@ -68,12 +68,13 @@
|
|
|
68
68
|
</template>
|
|
69
69
|
<script>
|
|
70
70
|
import TBadge from '../badge/badge';
|
|
71
|
-
import TIcon from '../icon/icon';
|
|
72
|
-
import { uniComponent } from '../common/src/index';
|
|
73
71
|
import { prefix } from '../common/config';
|
|
74
|
-
import props from './props';
|
|
75
|
-
import tools from '../common/utils.wxs';
|
|
76
72
|
import { ChildrenMixin, RELATION_MAP } from '../common/relation';
|
|
73
|
+
import { uniComponent } from '../common/src/index';
|
|
74
|
+
import tools from '../common/utils.wxs';
|
|
75
|
+
import TIcon from '../icon/icon';
|
|
76
|
+
|
|
77
|
+
import props from './props';
|
|
77
78
|
|
|
78
79
|
|
|
79
80
|
const name = `${prefix}-side-bar-item`;
|
|
@@ -118,8 +119,8 @@ export default {
|
|
|
118
119
|
|
|
119
120
|
return tools._style([
|
|
120
121
|
{
|
|
121
|
-
fontSize: 'var(--td-side-bar-icon-size,
|
|
122
|
-
marginRight: '
|
|
122
|
+
fontSize: 'var(--td-side-bar-icon-size, 40rpx)',
|
|
123
|
+
marginRight: '4rpx',
|
|
123
124
|
},
|
|
124
125
|
this.innerIcon.style || '',
|
|
125
126
|
]);
|
|
@@ -30,7 +30,7 @@ t-class-row | \-
|
|
|
30
30
|
### CSS Variables
|
|
31
31
|
|
|
32
32
|
The component provides the following CSS variables, which can be used to customize styles.
|
|
33
|
-
Name | Default Value | Description
|
|
33
|
+
Name | Default Value | Description
|
|
34
34
|
-- | -- | --
|
|
35
35
|
--td-skeleton-circle-border-radius | @skeleton-circle-border-radius | -
|
|
36
36
|
--td-skeleton-animation-flashed | rgba(90%, 90%, 90%, 0.3) | -
|
package/dist/skeleton/README.md
CHANGED
|
@@ -70,7 +70,7 @@ t-class-row | 列样式类
|
|
|
70
70
|
### CSS Variables
|
|
71
71
|
|
|
72
72
|
组件提供了下列 CSS 变量,可用于自定义样式。
|
|
73
|
-
名称 | 默认值 | 描述
|
|
73
|
+
名称 | 默认值 | 描述
|
|
74
74
|
-- | -- | --
|
|
75
75
|
--td-skeleton-circle-border-radius | @skeleton-circle-border-radius | -
|
|
76
76
|
--td-skeleton-animation-flashed | rgba(90%, 90%, 90%, 0.3) | -
|
|
@@ -35,12 +35,15 @@
|
|
|
35
35
|
</view>
|
|
36
36
|
</template>
|
|
37
37
|
<script>
|
|
38
|
-
import { uniComponent } from '../common/src/index';
|
|
39
38
|
import { prefix } from '../common/config';
|
|
40
|
-
import
|
|
39
|
+
import { uniComponent } from '../common/src/index';
|
|
40
|
+
|
|
41
|
+
|
|
41
42
|
import { classNames } from '../common/utils';
|
|
42
|
-
import { isInteger, isNumeric } from '../common/validator';
|
|
43
43
|
import tools from '../common/utils.wxs';
|
|
44
|
+
import { isInteger, isNumeric } from '../common/validator';
|
|
45
|
+
|
|
46
|
+
import props from './props';
|
|
44
47
|
|
|
45
48
|
|
|
46
49
|
const name = `${prefix}-skeleton`;
|
|
@@ -43,7 +43,7 @@ t-class-cursor | \-
|
|
|
43
43
|
### CSS Variables
|
|
44
44
|
|
|
45
45
|
The component provides the following CSS variables, which can be used to customize styles.
|
|
46
|
-
Name | Default Value | Description
|
|
46
|
+
Name | Default Value | Description
|
|
47
47
|
-- | -- | --
|
|
48
48
|
--td-slider-active-color | @brand-color | -
|
|
49
49
|
--td-slider-bar-height | 8rpx | -
|
package/dist/slider/README.md
CHANGED
package/dist/slider/slider.vue
CHANGED
|
@@ -191,16 +191,18 @@
|
|
|
191
191
|
</view>
|
|
192
192
|
</template>
|
|
193
193
|
<script>
|
|
194
|
-
import
|
|
194
|
+
import Bus from '../common/bus';
|
|
195
195
|
import { prefix } from '../common/config';
|
|
196
|
-
import {
|
|
197
|
-
import props from './props';
|
|
196
|
+
import { uniComponent } from '../common/src/index';
|
|
198
197
|
import { getRect, coalesce, nextTick } from '../common/utils';
|
|
199
|
-
import Bus from '../common/bus';
|
|
200
198
|
import tools from '../common/utils.wxs';
|
|
201
|
-
|
|
199
|
+
|
|
202
200
|
import { isString, isFunction } from '../common/validator';
|
|
203
201
|
|
|
202
|
+
import { getValue } from './computed.js';
|
|
203
|
+
import props from './props';
|
|
204
|
+
import { trimSingleValue, trimValue } from './tool';
|
|
205
|
+
|
|
204
206
|
|
|
205
207
|
const name = `${prefix}-slider`;
|
|
206
208
|
|
|
@@ -79,13 +79,14 @@
|
|
|
79
79
|
</view>
|
|
80
80
|
</template>
|
|
81
81
|
<script>
|
|
82
|
-
import TIcon from '../icon/icon';
|
|
83
|
-
import { uniComponent } from '../common/src/index';
|
|
84
82
|
import { prefix } from '../common/config';
|
|
85
|
-
import
|
|
83
|
+
import { ChildrenMixin, RELATION_MAP } from '../common/relation';
|
|
84
|
+
import { uniComponent } from '../common/src/index';
|
|
86
85
|
import tools from '../common/utils.wxs';
|
|
86
|
+
import TIcon from '../icon/icon';
|
|
87
|
+
|
|
87
88
|
import { getAriaLabel } from './computed.js';
|
|
88
|
-
import
|
|
89
|
+
import props from './props';
|
|
89
90
|
|
|
90
91
|
|
|
91
92
|
const name = `${prefix}-steps-item`;
|
|
@@ -40,7 +40,7 @@ t-class-plus | \-
|
|
|
40
40
|
### CSS Variables
|
|
41
41
|
|
|
42
42
|
The component provides the following CSS variables, which can be used to customize styles.
|
|
43
|
-
Name | Default Value | Description
|
|
43
|
+
Name | Default Value | Description
|
|
44
44
|
-- | -- | --
|
|
45
45
|
--td-stepper-input-disabled-bg | @bg-color-component-disabled | -
|
|
46
46
|
--td-stepper-input-disabled-color | @text-color-disabled | -
|
package/dist/stepper/README.md
CHANGED
package/dist/stepper/stepper.vue
CHANGED
|
@@ -48,12 +48,14 @@
|
|
|
48
48
|
</view>
|
|
49
49
|
</template>
|
|
50
50
|
<script>
|
|
51
|
-
import TIcon from '../icon/icon';
|
|
52
|
-
import { uniComponent } from '../common/src/index';
|
|
53
51
|
import { prefix } from '../common/config';
|
|
52
|
+
import { uniComponent } from '../common/src/index';
|
|
54
53
|
import { coalesce, nextTick } from '../common/utils';
|
|
55
|
-
|
|
54
|
+
|
|
56
55
|
import tools from '../common/utils.wxs';
|
|
56
|
+
import TIcon from '../icon/icon';
|
|
57
|
+
|
|
58
|
+
import props from './props';
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
const name = `${prefix}-stepper`;
|
|
@@ -69,7 +69,7 @@ t-class-title | \-
|
|
|
69
69
|
### CSS Variables
|
|
70
70
|
|
|
71
71
|
The component provides the following CSS variables, which can be used to customize styles.
|
|
72
|
-
Name | Default Value | Description
|
|
72
|
+
Name | Default Value | Description
|
|
73
73
|
-- | -- | --
|
|
74
74
|
--td-step-item-circle-size | 44rpx | -
|
|
75
75
|
--td-step-item-circle-text-font | @font-body-medium | -
|
package/dist/steps/README.md
CHANGED
package/dist/steps/steps.vue
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
</view>
|
|
8
8
|
</template>
|
|
9
9
|
<script>
|
|
10
|
-
import { uniComponent } from '../common/src/index';
|
|
11
10
|
import { prefix } from '../common/config';
|
|
12
|
-
import props from './props';
|
|
13
|
-
import tools from '../common/utils.wxs';
|
|
14
11
|
import { ParentMixin, RELATION_MAP } from '../common/relation';
|
|
12
|
+
import { uniComponent } from '../common/src/index';
|
|
13
|
+
|
|
14
|
+
import tools from '../common/utils.wxs';
|
|
15
|
+
|
|
16
|
+
import props from './props';
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
const name = `${prefix}-steps`;
|
package/dist/sticky/sticky.vue
CHANGED
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
</view>
|
|
13
13
|
</template>
|
|
14
14
|
<script>
|
|
15
|
-
import { uniComponent } from '../common/src/index';
|
|
16
|
-
import props from './props';
|
|
17
15
|
import { prefix } from '../common/config';
|
|
18
|
-
import
|
|
16
|
+
import { uniComponent } from '../common/src/index';
|
|
19
17
|
import { getRect, nextTick } from '../common/utils';
|
|
20
18
|
import tools from '../common/utils.wxs';
|
|
19
|
+
import pageScrollMixin from '../mixins/page-scroll';
|
|
20
|
+
|
|
21
|
+
import props from './props';
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
const name = `${prefix}-sticky`;
|
|
@@ -96,12 +96,14 @@
|
|
|
96
96
|
</view>
|
|
97
97
|
</template>
|
|
98
98
|
<script>
|
|
99
|
-
import TIcon from '../icon/icon';
|
|
100
|
-
import { uniComponent } from '../common/src/index';
|
|
101
99
|
import { prefix } from '../common/config';
|
|
102
|
-
import
|
|
100
|
+
import { parseEventDynamicCode } from '../common/event/dynamic';
|
|
101
|
+
import { uniComponent } from '../common/src/index';
|
|
103
102
|
import { getRect } from '../common/utils';
|
|
103
|
+
import tools from '../common/utils.wxs';
|
|
104
104
|
import { getObserver } from '../common/wechat';
|
|
105
|
+
import TIcon from '../icon/icon';
|
|
106
|
+
|
|
105
107
|
import {
|
|
106
108
|
initLeftWidth,
|
|
107
109
|
initRightWidth,
|
|
@@ -111,8 +113,8 @@ import {
|
|
|
111
113
|
onCloseChange,
|
|
112
114
|
onOpenedChange,
|
|
113
115
|
} from './computed';
|
|
114
|
-
import
|
|
115
|
-
|
|
116
|
+
import props from './props';
|
|
117
|
+
|
|
116
118
|
|
|
117
119
|
let ARRAY = [];
|
|
118
120
|
|
|
@@ -72,7 +72,7 @@ t-class | \-
|
|
|
72
72
|
### CSS Variables
|
|
73
73
|
|
|
74
74
|
The component provides the following CSS variables, which can be used to customize styles.
|
|
75
|
-
Name | Default Value | Description
|
|
75
|
+
Name | Default Value | Description
|
|
76
76
|
-- | -- | --
|
|
77
77
|
--td-swiper-item-padding | 0 | -
|
|
78
78
|
--td-swiper-radius | @radius-large | -
|
package/dist/swiper/README.md
CHANGED
package/dist/swiper/swiper.vue
CHANGED
|
@@ -67,14 +67,16 @@
|
|
|
67
67
|
</view>
|
|
68
68
|
</template>
|
|
69
69
|
<script>
|
|
70
|
-
import TSwiperNav from '../swiper-nav/swiper-nav';
|
|
71
|
-
import TImage from '../image/image';
|
|
72
|
-
import { uniComponent } from '../common/src/index';
|
|
73
70
|
import { prefix } from '../common/config';
|
|
74
|
-
import
|
|
71
|
+
import { ParentMixin, RELATION_MAP } from '../common/relation';
|
|
72
|
+
import { uniComponent } from '../common/src/index';
|
|
75
73
|
import tools from '../common/utils.wxs';
|
|
74
|
+
import TImage from '../image/image';
|
|
75
|
+
import TSwiperNav from '../swiper-nav/swiper-nav';
|
|
76
|
+
|
|
76
77
|
import { isPrev, isNext, getImageClass } from './computed.js';
|
|
77
|
-
import
|
|
78
|
+
import props from './props';
|
|
79
|
+
|
|
78
80
|
|
|
79
81
|
const name = `${prefix}-swiper`;
|
|
80
82
|
|