@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.
- package/CHANGELOG.md +31 -0
- package/README.md +32 -2
- 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/README.en-US.md +6 -6
- package/dist/checkbox/README.md +5 -5
- package/dist/checkbox/checkbox.vue +127 -127
- package/dist/checkbox/props.ts +6 -6
- package/dist/checkbox/type.ts +6 -4
- package/dist/checkbox-group/checkbox-group.vue +175 -173
- package/dist/checkbox-group/props.ts +6 -6
- package/dist/checkbox-group/type.ts +6 -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 +57 -61
- 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 +176 -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 +16 -2
- package/dist/form/form-item-props.ts +0 -56
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
|
-
:style="tools._style([customStyle])"
|
|
3
|
+
:style="'' + tools._style([customStyle])"
|
|
4
4
|
:class="[
|
|
5
5
|
tClass,
|
|
6
6
|
tools.cls(classPrefix, [['hairline--top-bottom', border], theme])
|
|
@@ -21,97 +21,99 @@ import { ParentMixin, RELATION_MAP } from '../common/relation';
|
|
|
21
21
|
const name = `${prefix}-collapse`;
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
export default
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
],
|
|
32
|
-
options: {
|
|
33
|
-
styleIsolation: 'shared',
|
|
34
|
-
},
|
|
35
|
-
externalClasses: [`${prefix}-class`],
|
|
36
|
-
mixins: [ParentMixin(RELATION_MAP.CollapsePanel)],
|
|
37
|
-
props: {
|
|
38
|
-
...props,
|
|
39
|
-
},
|
|
40
|
-
emits: [
|
|
41
|
-
'update:value',
|
|
42
|
-
],
|
|
43
|
-
data() {
|
|
44
|
-
return {
|
|
45
|
-
prefix,
|
|
46
|
-
classPrefix: name,
|
|
47
|
-
tools,
|
|
48
|
-
border: false,
|
|
49
|
-
dataValue: coalesce(this.value, this.defaultValue),
|
|
50
|
-
mounted: false,
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
watch: {
|
|
54
|
-
value: {
|
|
55
|
-
handler(value) {
|
|
56
|
-
this.dataValue = value;
|
|
24
|
+
export default {
|
|
25
|
+
...uniComponent({
|
|
26
|
+
name,
|
|
27
|
+
controlledProps: [
|
|
28
|
+
{
|
|
29
|
+
key: 'value',
|
|
30
|
+
event: 'change',
|
|
57
31
|
},
|
|
58
|
-
|
|
32
|
+
],
|
|
33
|
+
options: {
|
|
34
|
+
styleIsolation: 'shared',
|
|
59
35
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
immediate: true,
|
|
65
|
-
deep: true,
|
|
36
|
+
externalClasses: [`${prefix}-class`],
|
|
37
|
+
mixins: [ParentMixin(RELATION_MAP.CollapsePanel)],
|
|
38
|
+
props: {
|
|
39
|
+
...props,
|
|
66
40
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
41
|
+
emits: [
|
|
42
|
+
'update:value',
|
|
43
|
+
],
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
prefix,
|
|
47
|
+
classPrefix: name,
|
|
48
|
+
tools,
|
|
49
|
+
border: false,
|
|
50
|
+
dataValue: coalesce(this.value, this.defaultValue),
|
|
51
|
+
mounted: false,
|
|
52
|
+
};
|
|
72
53
|
},
|
|
54
|
+
watch: {
|
|
55
|
+
value: {
|
|
56
|
+
handler(value) {
|
|
57
|
+
this.dataValue = value;
|
|
58
|
+
},
|
|
59
|
+
immediate: true,
|
|
60
|
+
},
|
|
61
|
+
dataValue: {
|
|
62
|
+
handler() {
|
|
63
|
+
this.waitUntilMounted(this.updateExpanded);
|
|
64
|
+
},
|
|
65
|
+
immediate: true,
|
|
66
|
+
deep: true,
|
|
67
|
+
},
|
|
68
|
+
expandMutex: {
|
|
69
|
+
handler() {
|
|
70
|
+
this.waitUntilMounted(this.updateExpanded);
|
|
71
|
+
},
|
|
72
|
+
immediate: true,
|
|
73
|
+
},
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
setTimeout(() => {
|
|
81
|
-
this.mounted = true;
|
|
82
|
-
}, interval);
|
|
83
|
-
},
|
|
84
|
-
methods: {
|
|
85
|
-
waitUntilMounted(cb) {
|
|
86
|
-
if (this.mounted) {
|
|
87
|
-
cb.call(this);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
75
|
+
},
|
|
76
|
+
mounted() {
|
|
77
|
+
let interval = 0;
|
|
78
|
+
// #ifdef APP-PLUS
|
|
79
|
+
interval = 33;
|
|
80
|
+
// #endif
|
|
90
81
|
setTimeout(() => {
|
|
91
|
-
|
|
92
|
-
},
|
|
82
|
+
this.mounted = true;
|
|
83
|
+
}, interval);
|
|
93
84
|
},
|
|
85
|
+
methods: {
|
|
86
|
+
waitUntilMounted(cb) {
|
|
87
|
+
if (this.mounted) {
|
|
88
|
+
cb.call(this);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
cb.call(this);
|
|
93
|
+
}, 33);
|
|
94
|
+
},
|
|
94
95
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
updateExpanded() {
|
|
97
|
+
this.children?.forEach((e) => {
|
|
98
|
+
e.updateExpanded(this.dataValue);
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
switch(panelValue) {
|
|
102
|
+
const { expandMutex, dataValue: activeValues } = this;
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
let value = [];
|
|
105
|
+
const hit = activeValues?.indexOf(panelValue);
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
if (hit > -1) {
|
|
108
|
+
value = activeValues.filter(item => item !== panelValue);
|
|
109
|
+
} else {
|
|
110
|
+
value = expandMutex ? [panelValue] : activeValues.concat(panelValue);
|
|
111
|
+
}
|
|
111
112
|
|
|
112
|
-
|
|
113
|
+
this._trigger('change', { value });
|
|
114
|
+
},
|
|
113
115
|
},
|
|
114
|
-
},
|
|
115
|
-
}
|
|
116
|
+
}),
|
|
117
|
+
};
|
|
116
118
|
</script>
|
|
117
119
|
<style scoped src="./collapse.css"></style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
|
-
:style="tools._style([customStyle])"
|
|
3
|
+
:style="'' + tools._style([customStyle])"
|
|
4
4
|
:class="[
|
|
5
5
|
classPrefix + ' ' + classPrefix + '--' + placement,
|
|
6
6
|
tClass
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
:animation="animation"
|
|
65
65
|
:aria-hidden="expanded ? '' : true"
|
|
66
66
|
>
|
|
67
|
-
<view :class="tools.cls(classPrefix + '__content', [['disabled', ultimateDisabled], ['expanded', expanded], placement]) + ' ' + tClassContent">
|
|
67
|
+
<view :class="'' + tools.cls(classPrefix + '__content', [['disabled', ultimateDisabled], ['expanded', expanded], placement]) + ' ' + tClassContent">
|
|
68
68
|
{{ content }}
|
|
69
69
|
<slot />
|
|
70
70
|
<slot name="content" />
|
|
@@ -85,152 +85,154 @@ import { ChildrenMixin, RELATION_MAP } from '../common/relation';
|
|
|
85
85
|
const name = `${prefix}-collapse-panel`;
|
|
86
86
|
const DISABLED_COLOR = 'var(--td-text-color-disabled, var(--td-font-gray-4, rgba(0, 0, 0, .26)))';
|
|
87
87
|
|
|
88
|
-
export default
|
|
89
|
-
name,
|
|
90
|
-
options: {
|
|
91
|
-
styleIsolation: 'shared',
|
|
92
|
-
},
|
|
93
|
-
externalClasses: [
|
|
94
|
-
`${prefix}-class`,
|
|
95
|
-
`${prefix}-class-content`,
|
|
96
|
-
`${prefix}-class-header`,
|
|
97
|
-
],
|
|
98
|
-
mixins: [ChildrenMixin(RELATION_MAP.CollapsePanel)],
|
|
88
|
+
export default {
|
|
99
89
|
components: {
|
|
100
90
|
TCell,
|
|
101
91
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
prefix,
|
|
108
|
-
expanded: false,
|
|
109
|
-
classPrefix: name,
|
|
110
|
-
classBasePrefix: prefix,
|
|
111
|
-
ultimateExpandIcon: false,
|
|
112
|
-
ultimateDisabled: false,
|
|
113
|
-
tools,
|
|
114
|
-
animation: null,
|
|
115
|
-
};
|
|
116
|
-
},
|
|
117
|
-
computed: {
|
|
118
|
-
titleCustomStyle() {
|
|
119
|
-
return tools._style({
|
|
120
|
-
fontSize: 'var(--td-collapse-title-font-size, var(--td-font-size-m, 16px))',
|
|
121
|
-
color: this.ultimateDisabled && DISABLED_COLOR,
|
|
122
|
-
});
|
|
92
|
+
...uniComponent({
|
|
93
|
+
name,
|
|
94
|
+
options: {
|
|
95
|
+
styleIsolation: 'shared',
|
|
123
96
|
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
97
|
+
externalClasses: [
|
|
98
|
+
`${prefix}-class`,
|
|
99
|
+
`${prefix}-class-content`,
|
|
100
|
+
`${prefix}-class-header`,
|
|
101
|
+
],
|
|
102
|
+
mixins: [ChildrenMixin(RELATION_MAP.CollapsePanel)],
|
|
103
|
+
props: {
|
|
104
|
+
...props,
|
|
129
105
|
},
|
|
130
|
-
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
106
|
+
data() {
|
|
107
|
+
return {
|
|
108
|
+
prefix,
|
|
109
|
+
expanded: false,
|
|
110
|
+
classPrefix: name,
|
|
111
|
+
classBasePrefix: prefix,
|
|
112
|
+
ultimateExpandIcon: false,
|
|
113
|
+
ultimateDisabled: false,
|
|
114
|
+
tools,
|
|
115
|
+
animation: null,
|
|
116
|
+
};
|
|
134
117
|
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
118
|
+
computed: {
|
|
119
|
+
titleCustomStyle() {
|
|
120
|
+
return tools._style({
|
|
121
|
+
fontSize: 'var(--td-collapse-title-font-size, var(--td-font-size-m, 16px))',
|
|
122
|
+
color: this.ultimateDisabled && DISABLED_COLOR,
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
noteCustomStyle() {
|
|
126
|
+
return tools._style({
|
|
127
|
+
color: this.ultimateDisabled && DISABLED_COLOR,
|
|
128
|
+
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
rightIconCustomStyle() {
|
|
132
|
+
return tools._style({
|
|
133
|
+
color: this.ultimateDisabled && DISABLED_COLOR,
|
|
134
|
+
});
|
|
140
135
|
},
|
|
141
|
-
immediate: true,
|
|
142
136
|
},
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
watch: {
|
|
138
|
+
disabled: {
|
|
139
|
+
handler(e) {
|
|
140
|
+
this.ultimateDisabled = !!e;
|
|
141
|
+
},
|
|
142
|
+
immediate: true,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
methods: {
|
|
146
|
+
updateExpanded(activeValues = []) {
|
|
147
|
+
if (!this[RELATION_MAP.CollapsePanel]) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
const { value } = this;
|
|
152
|
+
const { defaultExpandAll } = this[RELATION_MAP.CollapsePanel];
|
|
153
|
+
const expanded = defaultExpandAll ? !this.expanded : activeValues?.includes(value);
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
if (expanded === this.expanded) return;
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
this.expanded = expanded;
|
|
158
|
+
this.updateStyle(expanded);
|
|
159
|
+
},
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
updateStyle(expanded) {
|
|
162
|
+
return getRect(this, `.${name}__content`)
|
|
163
|
+
.then(rect => rect.height)
|
|
164
|
+
.then((height) => {
|
|
165
|
+
const animation = uni.createAnimation({
|
|
166
|
+
duration: 0,
|
|
167
|
+
timingFunction: 'ease-in-out',
|
|
168
|
+
});
|
|
168
169
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
animation
|
|
181
|
-
.height(height)
|
|
182
|
-
.top(1)
|
|
183
|
-
.step({ duration: 17 })
|
|
184
|
-
.height(0)
|
|
185
|
-
.step({ duration: 300 });
|
|
186
|
-
doAnimation = true;
|
|
187
|
-
// #endif
|
|
188
|
-
|
|
189
|
-
if (!doAnimation) {
|
|
170
|
+
if (expanded) {
|
|
171
|
+
animation
|
|
172
|
+
.height(height)
|
|
173
|
+
.top(0)
|
|
174
|
+
.step({ duration: 300 })
|
|
175
|
+
.height('auto')
|
|
176
|
+
.step();
|
|
177
|
+
} else {
|
|
178
|
+
let doAnimation = false;
|
|
179
|
+
|
|
180
|
+
// #ifdef H5 || APP-PLUS
|
|
190
181
|
animation
|
|
191
182
|
.height(height)
|
|
192
183
|
.top(1)
|
|
193
|
-
.step({ duration:
|
|
184
|
+
.step({ duration: 17 })
|
|
194
185
|
.height(0)
|
|
195
186
|
.step({ duration: 300 });
|
|
187
|
+
doAnimation = true;
|
|
188
|
+
// #endif
|
|
189
|
+
|
|
190
|
+
if (!doAnimation) {
|
|
191
|
+
animation
|
|
192
|
+
.height(height)
|
|
193
|
+
.top(1)
|
|
194
|
+
.step({ duration: 1 })
|
|
195
|
+
.height(0)
|
|
196
|
+
.step({ duration: 300 });
|
|
197
|
+
}
|
|
196
198
|
}
|
|
197
|
-
}
|
|
198
199
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
this.animation = animation.export();
|
|
201
|
+
});
|
|
202
|
+
},
|
|
202
203
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
onClick() {
|
|
205
|
+
const { ultimateDisabled } = this;
|
|
206
|
+
const { value } = this;
|
|
206
207
|
|
|
207
208
|
|
|
208
|
-
|
|
209
|
+
if (ultimateDisabled) return;
|
|
209
210
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
211
|
+
if (this[RELATION_MAP.CollapsePanel].defaultExpandAll) {
|
|
212
|
+
this.updateExpanded();
|
|
213
|
+
} else {
|
|
214
|
+
this[RELATION_MAP.CollapsePanel].switch(value);
|
|
215
|
+
}
|
|
216
|
+
},
|
|
216
217
|
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
innerAfterLinked() {
|
|
219
|
+
const { dataValue, expandIcon, disabled } = this[RELATION_MAP.CollapsePanel];
|
|
219
220
|
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
this.ultimateExpandIcon = this.expandIcon == null ? expandIcon : this.expandIcon;
|
|
222
|
+
this.ultimateDisabled = this.disabled == null ? disabled : this.disabled;
|
|
222
223
|
|
|
223
224
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
let interval = 0;
|
|
226
|
+
// #ifdef APP-PLUS
|
|
227
|
+
interval = 33;
|
|
228
|
+
// #endif
|
|
229
|
+
setTimeout(() => {
|
|
230
|
+
this.updateExpanded(dataValue);
|
|
231
|
+
}, interval);
|
|
232
|
+
},
|
|
231
233
|
},
|
|
232
|
-
},
|
|
233
|
-
}
|
|
234
|
+
}),
|
|
235
|
+
};
|
|
234
236
|
|
|
235
237
|
</script>
|
|
236
238
|
<style scoped src="./collapse-panel.css"></style>
|
|
@@ -12,13 +12,13 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
/** 禁止当前面板展开,优先级大于 Collapse 的同名属性 */
|
|
14
14
|
disabled: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default:
|
|
15
|
+
type: [Boolean, null],
|
|
16
|
+
default: null as TdCollapsePanelProps['disabled'],
|
|
17
17
|
},
|
|
18
18
|
/** 当前折叠面板展开图标,优先级大于 Collapse 的同名属性 */
|
|
19
19
|
expandIcon: {
|
|
20
|
-
type: Boolean,
|
|
21
|
-
default:
|
|
20
|
+
type: [Boolean, null],
|
|
21
|
+
default: null as TdCollapsePanelProps['expandIcon'],
|
|
22
22
|
},
|
|
23
23
|
/** 面板头内容 */
|
|
24
24
|
header: {
|
|
@@ -12,11 +12,11 @@ export interface TdCollapsePanelProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* 禁止当前面板展开,优先级大于 Collapse 的同名属性
|
|
14
14
|
*/
|
|
15
|
-
disabled?: boolean;
|
|
15
|
+
disabled?: boolean | null;
|
|
16
16
|
/**
|
|
17
17
|
* 当前折叠面板展开图标,优先级大于 Collapse 的同名属性
|
|
18
18
|
*/
|
|
19
|
-
expandIcon?: boolean;
|
|
19
|
+
expandIcon?: boolean | null;
|
|
20
20
|
/**
|
|
21
21
|
* 面板头内容
|
|
22
22
|
*/
|