wedux-ui 0.1.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/LICENSE +21 -0
- package/README.md +184 -0
- package/miniprogram_dist/behaviors/formField.js +35 -0
- package/miniprogram_dist/components/avatar/avatar.js +70 -0
- package/miniprogram_dist/components/avatar/avatar.json +4 -0
- package/miniprogram_dist/components/avatar/avatar.scss +68 -0
- package/miniprogram_dist/components/avatar/avatar.wxml +15 -0
- package/miniprogram_dist/components/avatar-group/avatar-group.js +45 -0
- package/miniprogram_dist/components/avatar-group/avatar-group.json +7 -0
- package/miniprogram_dist/components/avatar-group/avatar-group.scss +4 -0
- package/miniprogram_dist/components/avatar-group/avatar-group.wxml +3 -0
- package/miniprogram_dist/components/back-top/back-top.js +68 -0
- package/miniprogram_dist/components/back-top/back-top.json +4 -0
- package/miniprogram_dist/components/back-top/back-top.scss +43 -0
- package/miniprogram_dist/components/back-top/back-top.wxml +10 -0
- package/miniprogram_dist/components/badge/badge.js +100 -0
- package/miniprogram_dist/components/badge/badge.json +4 -0
- package/miniprogram_dist/components/badge/badge.scss +98 -0
- package/miniprogram_dist/components/badge/badge.wxml +11 -0
- package/miniprogram_dist/components/button/button.js +152 -0
- package/miniprogram_dist/components/button/button.json +4 -0
- package/miniprogram_dist/components/button/button.scss +499 -0
- package/miniprogram_dist/components/button/button.wxml +21 -0
- package/miniprogram_dist/components/button-group/button-group.js +51 -0
- package/miniprogram_dist/components/button-group/button-group.json +4 -0
- package/miniprogram_dist/components/button-group/button-group.scss +8 -0
- package/miniprogram_dist/components/button-group/button-group.wxml +3 -0
- package/miniprogram_dist/components/calendar/calendar.js +308 -0
- package/miniprogram_dist/components/calendar/calendar.json +4 -0
- package/miniprogram_dist/components/calendar/calendar.scss +141 -0
- package/miniprogram_dist/components/calendar/calendar.wxml +47 -0
- package/miniprogram_dist/components/card/card.js +44 -0
- package/miniprogram_dist/components/card/card.json +4 -0
- package/miniprogram_dist/components/card/card.scss +143 -0
- package/miniprogram_dist/components/card/card.wxml +31 -0
- package/miniprogram_dist/components/checkbox/checkbox.js +43 -0
- package/miniprogram_dist/components/checkbox/checkbox.json +4 -0
- package/miniprogram_dist/components/checkbox/checkbox.scss +77 -0
- package/miniprogram_dist/components/checkbox/checkbox.wxml +13 -0
- package/miniprogram_dist/components/checkbox-button/checkbox-button.js +43 -0
- package/miniprogram_dist/components/checkbox-button/checkbox-button.json +4 -0
- package/miniprogram_dist/components/checkbox-button/checkbox-button.scss +39 -0
- package/miniprogram_dist/components/checkbox-button/checkbox-button.wxml +8 -0
- package/miniprogram_dist/components/checkbox-group/checkbox-group.js +84 -0
- package/miniprogram_dist/components/checkbox-group/checkbox-group.json +4 -0
- package/miniprogram_dist/components/checkbox-group/checkbox-group.scss +9 -0
- package/miniprogram_dist/components/checkbox-group/checkbox-group.wxml +3 -0
- package/miniprogram_dist/components/color-picker/color-picker.js +348 -0
- package/miniprogram_dist/components/color-picker/color-picker.json +7 -0
- package/miniprogram_dist/components/color-picker/color-picker.scss +383 -0
- package/miniprogram_dist/components/color-picker/color-picker.wxml +232 -0
- package/miniprogram_dist/components/date-picker/date-picker.js +1289 -0
- package/miniprogram_dist/components/date-picker/date-picker.json +7 -0
- package/miniprogram_dist/components/date-picker/date-picker.scss +468 -0
- package/miniprogram_dist/components/date-picker/date-picker.wxml +214 -0
- package/miniprogram_dist/components/divider/divider.js +34 -0
- package/miniprogram_dist/components/divider/divider.json +4 -0
- package/miniprogram_dist/components/divider/divider.scss +75 -0
- package/miniprogram_dist/components/divider/divider.wxml +8 -0
- package/miniprogram_dist/components/drawer/drawer.js +104 -0
- package/miniprogram_dist/components/drawer/drawer.json +4 -0
- package/miniprogram_dist/components/drawer/drawer.scss +171 -0
- package/miniprogram_dist/components/drawer/drawer.wxml +22 -0
- package/miniprogram_dist/components/ellipsis/ellipsis.js +38 -0
- package/miniprogram_dist/components/ellipsis/ellipsis.json +4 -0
- package/miniprogram_dist/components/ellipsis/ellipsis.scss +22 -0
- package/miniprogram_dist/components/ellipsis/ellipsis.wxml +7 -0
- package/miniprogram_dist/components/flex/flex.js +81 -0
- package/miniprogram_dist/components/flex/flex.json +4 -0
- package/miniprogram_dist/components/flex/flex.scss +4 -0
- package/miniprogram_dist/components/flex/flex.wxml +3 -0
- package/miniprogram_dist/components/float-button/float-button.js +78 -0
- package/miniprogram_dist/components/float-button/float-button.json +4 -0
- package/miniprogram_dist/components/float-button/float-button.scss +54 -0
- package/miniprogram_dist/components/float-button/float-button.wxml +9 -0
- package/miniprogram_dist/components/form/form.js +142 -0
- package/miniprogram_dist/components/form/form.json +4 -0
- package/miniprogram_dist/components/form/form.scss +11 -0
- package/miniprogram_dist/components/form/form.wxml +3 -0
- package/miniprogram_dist/components/form/validator.js +220 -0
- package/miniprogram_dist/components/form-item/form-item.js +240 -0
- package/miniprogram_dist/components/form-item/form-item.json +4 -0
- package/miniprogram_dist/components/form-item/form-item.scss +59 -0
- package/miniprogram_dist/components/form-item/form-item.wxml +33 -0
- package/miniprogram_dist/components/gradient-text/gradient-text.js +54 -0
- package/miniprogram_dist/components/gradient-text/gradient-text.json +4 -0
- package/miniprogram_dist/components/gradient-text/gradient-text.scss +7 -0
- package/miniprogram_dist/components/gradient-text/gradient-text.wxml +1 -0
- package/miniprogram_dist/components/h/h.js +60 -0
- package/miniprogram_dist/components/h/h.json +4 -0
- package/miniprogram_dist/components/h/h.scss +53 -0
- package/miniprogram_dist/components/h/h.wxml +1 -0
- package/miniprogram_dist/components/highlight/highlight.js +77 -0
- package/miniprogram_dist/components/highlight/highlight.json +4 -0
- package/miniprogram_dist/components/highlight/highlight.scss +8 -0
- package/miniprogram_dist/components/highlight/highlight.wxml +12 -0
- package/miniprogram_dist/components/infinite-scroll/infinite-scroll.js +31 -0
- package/miniprogram_dist/components/infinite-scroll/infinite-scroll.json +4 -0
- package/miniprogram_dist/components/infinite-scroll/infinite-scroll.scss +31 -0
- package/miniprogram_dist/components/infinite-scroll/infinite-scroll.wxml +12 -0
- package/miniprogram_dist/components/input/input.js +59 -0
- package/miniprogram_dist/components/input/input.json +4 -0
- package/miniprogram_dist/components/input/input.scss +96 -0
- package/miniprogram_dist/components/input/input.wxml +34 -0
- package/miniprogram_dist/components/input-otp/input-otp.js +106 -0
- package/miniprogram_dist/components/input-otp/input-otp.json +4 -0
- package/miniprogram_dist/components/input-otp/input-otp.scss +122 -0
- package/miniprogram_dist/components/input-otp/input-otp.wxml +38 -0
- package/miniprogram_dist/components/layout/layout.js +50 -0
- package/miniprogram_dist/components/layout/layout.json +4 -0
- package/miniprogram_dist/components/layout/layout.scss +10 -0
- package/miniprogram_dist/components/layout/layout.wxml +3 -0
- package/miniprogram_dist/components/layout-content/layout-content.js +47 -0
- package/miniprogram_dist/components/layout-content/layout-content.json +4 -0
- package/miniprogram_dist/components/layout-content/layout-content.scss +5 -0
- package/miniprogram_dist/components/layout-content/layout-content.wxml +13 -0
- package/miniprogram_dist/components/layout-footer/layout-footer.js +59 -0
- package/miniprogram_dist/components/layout-footer/layout-footer.json +4 -0
- package/miniprogram_dist/components/layout-footer/layout-footer.scss +23 -0
- package/miniprogram_dist/components/layout-footer/layout-footer.wxml +16 -0
- package/miniprogram_dist/components/layout-header/layout-header.js +59 -0
- package/miniprogram_dist/components/layout-header/layout-header.json +4 -0
- package/miniprogram_dist/components/layout-header/layout-header.scss +23 -0
- package/miniprogram_dist/components/layout-header/layout-header.wxml +16 -0
- package/miniprogram_dist/components/layout-sider/layout-sider.js +48 -0
- package/miniprogram_dist/components/layout-sider/layout-sider.json +4 -0
- package/miniprogram_dist/components/layout-sider/layout-sider.scss +13 -0
- package/miniprogram_dist/components/layout-sider/layout-sider.wxml +5 -0
- package/miniprogram_dist/components/list/list.js +55 -0
- package/miniprogram_dist/components/list/list.json +4 -0
- package/miniprogram_dist/components/list/list.scss +51 -0
- package/miniprogram_dist/components/list/list.wxml +9 -0
- package/miniprogram_dist/components/list-item/list-item.js +24 -0
- package/miniprogram_dist/components/list-item/list-item.json +4 -0
- package/miniprogram_dist/components/list-item/list-item.scss +51 -0
- package/miniprogram_dist/components/list-item/list-item.wxml +14 -0
- package/miniprogram_dist/components/navigation-bar/navigation-bar.js +77 -0
- package/miniprogram_dist/components/navigation-bar/navigation-bar.json +4 -0
- package/miniprogram_dist/components/navigation-bar/navigation-bar.scss +63 -0
- package/miniprogram_dist/components/navigation-bar/navigation-bar.wxml +35 -0
- package/miniprogram_dist/components/number-animation/number-animation.js +124 -0
- package/miniprogram_dist/components/number-animation/number-animation.json +4 -0
- package/miniprogram_dist/components/number-animation/number-animation.scss +3 -0
- package/miniprogram_dist/components/number-animation/number-animation.wxml +1 -0
- package/miniprogram_dist/components/popover/popover.js +183 -0
- package/miniprogram_dist/components/popover/popover.json +4 -0
- package/miniprogram_dist/components/popover/popover.scss +69 -0
- package/miniprogram_dist/components/popover/popover.wxml +19 -0
- package/miniprogram_dist/components/qr-code/qr-code.js +216 -0
- package/miniprogram_dist/components/qr-code/qr-code.json +4 -0
- package/miniprogram_dist/components/qr-code/qr-code.scss +8 -0
- package/miniprogram_dist/components/qr-code/qr-code.wxml +16 -0
- package/miniprogram_dist/components/radio/radio.js +38 -0
- package/miniprogram_dist/components/radio/radio.json +4 -0
- package/miniprogram_dist/components/radio/radio.scss +50 -0
- package/miniprogram_dist/components/radio/radio.wxml +12 -0
- package/miniprogram_dist/components/radio-button/radio-button.js +39 -0
- package/miniprogram_dist/components/radio-button/radio-button.json +4 -0
- package/miniprogram_dist/components/radio-button/radio-button.scss +39 -0
- package/miniprogram_dist/components/radio-button/radio-button.wxml +8 -0
- package/miniprogram_dist/components/radio-group/radio-group.js +72 -0
- package/miniprogram_dist/components/radio-group/radio-group.json +4 -0
- package/miniprogram_dist/components/radio-group/radio-group.scss +9 -0
- package/miniprogram_dist/components/radio-group/radio-group.wxml +3 -0
- package/miniprogram_dist/components/rate/rate.js +90 -0
- package/miniprogram_dist/components/rate/rate.json +4 -0
- package/miniprogram_dist/components/rate/rate.scss +59 -0
- package/miniprogram_dist/components/rate/rate.wxml +16 -0
- package/miniprogram_dist/components/select/select.js +201 -0
- package/miniprogram_dist/components/select/select.json +7 -0
- package/miniprogram_dist/components/select/select.scss +235 -0
- package/miniprogram_dist/components/select/select.wxml +79 -0
- package/miniprogram_dist/components/stepper/stepper.js +113 -0
- package/miniprogram_dist/components/stepper/stepper.json +4 -0
- package/miniprogram_dist/components/stepper/stepper.scss +73 -0
- package/miniprogram_dist/components/stepper/stepper.wxml +23 -0
- package/miniprogram_dist/components/switch/switch.js +42 -0
- package/miniprogram_dist/components/switch/switch.json +4 -0
- package/miniprogram_dist/components/switch/switch.scss +77 -0
- package/miniprogram_dist/components/switch/switch.wxml +10 -0
- package/miniprogram_dist/components/tab-bar/tab-bar.js +53 -0
- package/miniprogram_dist/components/tab-bar/tab-bar.json +4 -0
- package/miniprogram_dist/components/tab-bar/tab-bar.scss +53 -0
- package/miniprogram_dist/components/tab-bar/tab-bar.wxml +12 -0
- package/miniprogram_dist/components/tag/tag.js +87 -0
- package/miniprogram_dist/components/tag/tag.json +4 -0
- package/miniprogram_dist/components/tag/tag.scss +138 -0
- package/miniprogram_dist/components/tag/tag.wxml +12 -0
- package/miniprogram_dist/components/textarea/textarea.js +46 -0
- package/miniprogram_dist/components/textarea/textarea.json +4 -0
- package/miniprogram_dist/components/textarea/textarea.scss +51 -0
- package/miniprogram_dist/components/textarea/textarea.wxml +20 -0
- package/miniprogram_dist/components/theme-provider/presets.js +101 -0
- package/miniprogram_dist/components/theme-provider/theme-provider.js +34 -0
- package/miniprogram_dist/components/theme-provider/theme-provider.json +4 -0
- package/miniprogram_dist/components/theme-provider/theme-provider.scss +3 -0
- package/miniprogram_dist/components/theme-provider/theme-provider.wxml +3 -0
- package/miniprogram_dist/components/time-picker/time-picker.js +136 -0
- package/miniprogram_dist/components/time-picker/time-picker.json +7 -0
- package/miniprogram_dist/components/time-picker/time-picker.scss +135 -0
- package/miniprogram_dist/components/time-picker/time-picker.wxml +47 -0
- package/miniprogram_dist/components/tooltip/tooltip.js +179 -0
- package/miniprogram_dist/components/tooltip/tooltip.json +4 -0
- package/miniprogram_dist/components/tooltip/tooltip.scss +66 -0
- package/miniprogram_dist/components/tooltip/tooltip.wxml +17 -0
- package/miniprogram_dist/components/tree/tree.js +647 -0
- package/miniprogram_dist/components/tree/tree.json +4 -0
- package/miniprogram_dist/components/tree/tree.scss +178 -0
- package/miniprogram_dist/components/tree/tree.wxml +59 -0
- package/miniprogram_dist/components/tree-select/tree-select.js +260 -0
- package/miniprogram_dist/components/tree-select/tree-select.json +8 -0
- package/miniprogram_dist/components/tree-select/tree-select.scss +250 -0
- package/miniprogram_dist/components/tree-select/tree-select.wxml +118 -0
- package/miniprogram_dist/components/upload/upload.js +387 -0
- package/miniprogram_dist/components/upload/upload.json +4 -0
- package/miniprogram_dist/components/upload/upload.scss +258 -0
- package/miniprogram_dist/components/upload/upload.wxml +142 -0
- package/miniprogram_dist/components/watermark/watermark.js +260 -0
- package/miniprogram_dist/components/watermark/watermark.json +4 -0
- package/miniprogram_dist/components/watermark/watermark.scss +35 -0
- package/miniprogram_dist/components/watermark/watermark.wxml +13 -0
- package/miniprogram_dist/libs/qrcodegen.js +714 -0
- package/miniprogram_dist/libs/seemly.min.js +547 -0
- package/miniprogram_dist/libs/tempo_1_0_0.js +1264 -0
- package/miniprogram_dist/libs/validator_13_56_26.min.js +5282 -0
- package/miniprogram_dist/styles/demo.scss +96 -0
- package/miniprogram_dist/styles/iconfont.scss +91 -0
- package/miniprogram_dist/styles/theme.scss +126 -0
- package/miniprogram_dist/styles/tokens.scss +292 -0
- package/miniprogram_dist/utils/relations.js +21 -0
- package/package.json +25 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
properties: {
|
|
3
|
+
vertical: {
|
|
4
|
+
type: Boolean,
|
|
5
|
+
value: false,
|
|
6
|
+
},
|
|
7
|
+
dashed: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
value: false,
|
|
10
|
+
},
|
|
11
|
+
titlePlacement: {
|
|
12
|
+
type: String,
|
|
13
|
+
value: 'center', // left | center | right
|
|
14
|
+
},
|
|
15
|
+
title: {
|
|
16
|
+
type: String,
|
|
17
|
+
value: '',
|
|
18
|
+
},
|
|
19
|
+
customTitle: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
value: false,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
data: {
|
|
26
|
+
_hasTitle: false,
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
observers: {
|
|
30
|
+
'title, customTitle'(title, customTitle) {
|
|
31
|
+
this.setData({ _hasTitle: !!title || customTitle });
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.w-divider {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
margin: var(--w-divider-spacing) 0;
|
|
5
|
+
color: var(--color-text-primary);
|
|
6
|
+
font-size: var(--font-size-md);
|
|
7
|
+
font-weight: 500;
|
|
8
|
+
|
|
9
|
+
&::before,
|
|
10
|
+
&::after {
|
|
11
|
+
content: '';
|
|
12
|
+
flex: 1;
|
|
13
|
+
border-top: 1rpx solid var(--w-divider-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* No title — single line, hide ::after */
|
|
17
|
+
&:not(.w-divider--with-title) {
|
|
18
|
+
&::after {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* With title */
|
|
24
|
+
&--with-title {
|
|
25
|
+
&::before,
|
|
26
|
+
&::after {
|
|
27
|
+
content: '';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Title placement */
|
|
32
|
+
&--title-left::before {
|
|
33
|
+
flex: none;
|
|
34
|
+
width: 5%;
|
|
35
|
+
min-width: 20rpx;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&--title-right::after {
|
|
39
|
+
flex: none;
|
|
40
|
+
width: 5%;
|
|
41
|
+
min-width: 20rpx;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Dashed — use 2rpx so the dash pattern is visible on real devices */
|
|
45
|
+
&--dashed::before,
|
|
46
|
+
&--dashed::after {
|
|
47
|
+
border-top: 2rpx dashed var(--w-divider-color);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&--dashed.w-divider--vertical {
|
|
51
|
+
border-left: 2rpx dashed var(--w-divider-color);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Vertical */
|
|
55
|
+
&--vertical {
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
align-self: stretch;
|
|
58
|
+
height: auto;
|
|
59
|
+
min-height: 1em;
|
|
60
|
+
margin: 0 var(--spacing-sm);
|
|
61
|
+
vertical-align: middle;
|
|
62
|
+
border-top: 0;
|
|
63
|
+
border-left: 1rpx solid var(--w-divider-color);
|
|
64
|
+
|
|
65
|
+
&::before,
|
|
66
|
+
&::after {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.w-divider__title {
|
|
73
|
+
padding: 0 var(--spacing-md);
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<view
|
|
2
|
+
class="w-divider {{vertical ? 'w-divider--vertical' : ''}} {{dashed ? 'w-divider--dashed' : ''}} {{_hasTitle && !vertical ? 'w-divider--with-title w-divider--title-' + titlePlacement : ''}}"
|
|
3
|
+
>
|
|
4
|
+
<view wx:if="{{_hasTitle && !vertical}}" class="w-divider__title">
|
|
5
|
+
<block wx:if="{{title}}">{{title}}</block>
|
|
6
|
+
<slot wx:else></slot>
|
|
7
|
+
</view>
|
|
8
|
+
</view>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
options: {
|
|
3
|
+
multipleSlots: true,
|
|
4
|
+
},
|
|
5
|
+
|
|
6
|
+
properties: {
|
|
7
|
+
show: { type: Boolean, value: false },
|
|
8
|
+
placement: { type: String, value: 'bottom' },
|
|
9
|
+
width: { type: String, value: '' },
|
|
10
|
+
height: { type: String, value: '' },
|
|
11
|
+
title: { type: String, value: '' },
|
|
12
|
+
closable: { type: Boolean, value: false },
|
|
13
|
+
showMask: { type: Boolean, value: true },
|
|
14
|
+
maskClosable: { type: Boolean, value: true },
|
|
15
|
+
round: { type: Boolean, value: false },
|
|
16
|
+
zIndex: { type: Number, value: 1000 },
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
data: {
|
|
20
|
+
_visible: false,
|
|
21
|
+
_active: false,
|
|
22
|
+
_bodyStyle: '',
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
observers: {
|
|
26
|
+
show(val) {
|
|
27
|
+
if (val) {
|
|
28
|
+
this._open();
|
|
29
|
+
} else if (this.data._visible) {
|
|
30
|
+
this._close();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
'placement, width, height'() {
|
|
34
|
+
this._updateBodyStyle();
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
lifetimes: {
|
|
39
|
+
attached() {
|
|
40
|
+
this._updateBodyStyle();
|
|
41
|
+
},
|
|
42
|
+
detached() {
|
|
43
|
+
if (this._closeTimer) {
|
|
44
|
+
clearTimeout(this._closeTimer);
|
|
45
|
+
this._closeTimer = null;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
methods: {
|
|
51
|
+
_open() {
|
|
52
|
+
if (this._closeTimer) {
|
|
53
|
+
clearTimeout(this._closeTimer);
|
|
54
|
+
this._closeTimer = null;
|
|
55
|
+
}
|
|
56
|
+
this.setData({ _visible: true });
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
this.setData({ _active: true });
|
|
59
|
+
}, 30);
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
_close() {
|
|
63
|
+
this.setData({ _active: false });
|
|
64
|
+
this._closeTimer = setTimeout(() => {
|
|
65
|
+
this.setData({ _visible: false });
|
|
66
|
+
this.triggerEvent('afterleave');
|
|
67
|
+
this._closeTimer = null;
|
|
68
|
+
}, 300);
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
_updateBodyStyle() {
|
|
72
|
+
const { placement, width, height } = this.data;
|
|
73
|
+
const isHorizontal = placement === 'left' || placement === 'right';
|
|
74
|
+
let style = '';
|
|
75
|
+
if (isHorizontal && width) {
|
|
76
|
+
style = `width: ${width};`;
|
|
77
|
+
} else if (!isHorizontal && height) {
|
|
78
|
+
style = `height: ${height};`;
|
|
79
|
+
}
|
|
80
|
+
this.setData({ _bodyStyle: style });
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
handleMaskTap() {
|
|
84
|
+
if (this.data.maskClosable) {
|
|
85
|
+
this.triggerEvent('update:show', { show: false });
|
|
86
|
+
}
|
|
87
|
+
this.triggerEvent('maskclick');
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
handleClose() {
|
|
91
|
+
this.triggerEvent('update:show', { show: false });
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
handlePrevent() {
|
|
95
|
+
// Catch touchmove to prevent background scroll
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
handleTransitionEnd() {
|
|
99
|
+
if (this.data._active) {
|
|
100
|
+
this.triggerEvent('afterenter');
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
@import '../../styles/iconfont.scss';
|
|
2
|
+
|
|
3
|
+
.w-drawer {
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
display: flex;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.w-drawer--active {
|
|
14
|
+
pointer-events: auto;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Placement alignment */
|
|
18
|
+
.w-drawer--bottom {
|
|
19
|
+
align-items: flex-end;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.w-drawer--top {
|
|
23
|
+
align-items: flex-start;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.w-drawer--right {
|
|
27
|
+
justify-content: flex-end;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.w-drawer--left {
|
|
31
|
+
justify-content: flex-start;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Mask */
|
|
35
|
+
.w-drawer__mask {
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 0;
|
|
38
|
+
left: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
background: var(--w-drawer-mask-bg);
|
|
42
|
+
opacity: 0;
|
|
43
|
+
transition: opacity 0.3s;
|
|
44
|
+
pointer-events: auto;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.w-drawer--active .w-drawer__mask {
|
|
48
|
+
opacity: 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Body */
|
|
52
|
+
.w-drawer__body {
|
|
53
|
+
position: relative;
|
|
54
|
+
background: var(--w-drawer-bg);
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
max-height: 100%;
|
|
58
|
+
max-width: 100%;
|
|
59
|
+
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
60
|
+
pointer-events: auto;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Bottom */
|
|
64
|
+
.w-drawer--bottom .w-drawer__body {
|
|
65
|
+
width: 100%;
|
|
66
|
+
transform: translateY(100%);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.w-drawer--bottom.w-drawer--active .w-drawer__body {
|
|
70
|
+
transform: translateY(0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Top */
|
|
74
|
+
.w-drawer--top .w-drawer__body {
|
|
75
|
+
width: 100%;
|
|
76
|
+
transform: translateY(-100%);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.w-drawer--top.w-drawer--active .w-drawer__body {
|
|
80
|
+
transform: translateY(0);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Right */
|
|
84
|
+
.w-drawer--right .w-drawer__body {
|
|
85
|
+
height: 100%;
|
|
86
|
+
transform: translateX(100%);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.w-drawer--right.w-drawer--active .w-drawer__body {
|
|
90
|
+
transform: translateX(0);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Left */
|
|
94
|
+
.w-drawer--left .w-drawer__body {
|
|
95
|
+
height: 100%;
|
|
96
|
+
transform: translateX(-100%);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.w-drawer--left.w-drawer--active .w-drawer__body {
|
|
100
|
+
transform: translateX(0);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Round */
|
|
104
|
+
.w-drawer--round .w-drawer__body {
|
|
105
|
+
overflow: hidden;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.w-drawer--round.w-drawer--bottom .w-drawer__body {
|
|
109
|
+
border-radius: var(--w-drawer-radius) var(--w-drawer-radius) 0 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.w-drawer--round.w-drawer--top .w-drawer__body {
|
|
113
|
+
border-radius: 0 0 var(--w-drawer-radius) var(--w-drawer-radius);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.w-drawer--round.w-drawer--left .w-drawer__body {
|
|
117
|
+
border-radius: 0 var(--w-drawer-radius) var(--w-drawer-radius) 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.w-drawer--round.w-drawer--right .w-drawer__body {
|
|
121
|
+
border-radius: var(--w-drawer-radius) 0 0 var(--w-drawer-radius);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Header */
|
|
125
|
+
.w-drawer__header {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
padding: var(--spacing-md) var(--spacing-lg);
|
|
129
|
+
border-bottom: 1rpx solid var(--color-separator);
|
|
130
|
+
flex-shrink: 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.w-drawer__title {
|
|
134
|
+
flex: 1;
|
|
135
|
+
font-size: var(--font-size-lg);
|
|
136
|
+
font-weight: 500;
|
|
137
|
+
color: var(--color-text-primary);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.w-drawer__close {
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
width: 48rpx;
|
|
145
|
+
height: 48rpx;
|
|
146
|
+
flex-shrink: 0;
|
|
147
|
+
margin-left: var(--spacing-sm);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.w-drawer__close-icon {
|
|
151
|
+
font-size: 32rpx;
|
|
152
|
+
color: var(--color-text-secondary);
|
|
153
|
+
line-height: 1;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* Content */
|
|
157
|
+
.w-drawer__content {
|
|
158
|
+
flex: 1;
|
|
159
|
+
overflow: hidden;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* Footer — auto-hide when slot is empty */
|
|
163
|
+
.w-drawer__footer:empty {
|
|
164
|
+
display: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.w-drawer__footer {
|
|
168
|
+
flex-shrink: 0;
|
|
169
|
+
border-top: 1rpx solid var(--color-separator);
|
|
170
|
+
padding: var(--spacing-md) var(--spacing-lg);
|
|
171
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<view
|
|
2
|
+
wx:if="{{_visible}}"
|
|
3
|
+
class="w-drawer w-drawer--{{placement}} {{_active ? 'w-drawer--active' : ''}} {{round ? 'w-drawer--round' : ''}}"
|
|
4
|
+
style="z-index: {{zIndex}};"
|
|
5
|
+
catchtouchmove="handlePrevent"
|
|
6
|
+
>
|
|
7
|
+
<view wx:if="{{showMask}}" class="w-drawer__mask" bindtap="handleMaskTap"></view>
|
|
8
|
+
<view class="w-drawer__body" style="{{_bodyStyle}}" bindtransitionend="handleTransitionEnd">
|
|
9
|
+
<view wx:if="{{title || closable}}" class="w-drawer__header">
|
|
10
|
+
<view class="w-drawer__title">{{title}}</view>
|
|
11
|
+
<view wx:if="{{closable}}" class="w-drawer__close" bindtap="handleClose">
|
|
12
|
+
<text class="w-drawer__close-icon iconfont icon-close"></text>
|
|
13
|
+
</view>
|
|
14
|
+
</view>
|
|
15
|
+
<view class="w-drawer__content">
|
|
16
|
+
<slot></slot>
|
|
17
|
+
</view>
|
|
18
|
+
<view class="w-drawer__footer">
|
|
19
|
+
<slot name="footer"></slot>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
properties: {
|
|
3
|
+
lineClamp: {
|
|
4
|
+
type: Number,
|
|
5
|
+
value: 1,
|
|
6
|
+
},
|
|
7
|
+
expandTrigger: {
|
|
8
|
+
type: String,
|
|
9
|
+
value: '', // '' | 'click'
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
data: {
|
|
14
|
+
_expanded: false,
|
|
15
|
+
_style: '',
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
observers: {
|
|
19
|
+
'lineClamp, _expanded'(lineClamp, expanded) {
|
|
20
|
+
if (expanded) {
|
|
21
|
+
this.setData({ _style: '' });
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
let style = '';
|
|
25
|
+
if (lineClamp > 1) {
|
|
26
|
+
style = `-webkit-line-clamp: ${lineClamp};`;
|
|
27
|
+
}
|
|
28
|
+
this.setData({ _style: style });
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
methods: {
|
|
33
|
+
onTap() {
|
|
34
|
+
if (this.data.expandTrigger !== 'click') return;
|
|
35
|
+
this.setData({ _expanded: !this.data._expanded });
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.w-ellipsis {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
text-overflow: ellipsis;
|
|
4
|
+
white-space: nowrap;
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
|
|
7
|
+
&--line-clamp {
|
|
8
|
+
display: -webkit-box;
|
|
9
|
+
-webkit-box-orient: vertical;
|
|
10
|
+
white-space: normal;
|
|
11
|
+
word-break: break-all;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&--expanded {
|
|
15
|
+
overflow: visible;
|
|
16
|
+
text-overflow: unset;
|
|
17
|
+
white-space: normal;
|
|
18
|
+
display: block;
|
|
19
|
+
-webkit-line-clamp: unset;
|
|
20
|
+
line-clamp: unset;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const SIZE_MAP = {
|
|
2
|
+
small: 'var(--spacing-sm)',
|
|
3
|
+
medium: 'var(--spacing-md)',
|
|
4
|
+
large: 'var(--spacing-lg)',
|
|
5
|
+
none: '0',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
Component({
|
|
9
|
+
properties: {
|
|
10
|
+
vertical: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
value: false,
|
|
13
|
+
},
|
|
14
|
+
align: {
|
|
15
|
+
type: String,
|
|
16
|
+
value: '', // flex-start | flex-end | center | baseline | stretch
|
|
17
|
+
},
|
|
18
|
+
justify: {
|
|
19
|
+
type: String,
|
|
20
|
+
value: 'flex-start', // flex-start | flex-end | center | space-between | space-around | space-evenly
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
type: null,
|
|
24
|
+
value: 'medium', // 'small' | 'medium' | 'large' | 'none' | number(rpx) | [rowGap, colGap]
|
|
25
|
+
},
|
|
26
|
+
wrap: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
value: true,
|
|
29
|
+
},
|
|
30
|
+
inline: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
value: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
observers: {
|
|
37
|
+
'vertical, align, justify, size, wrap, inline'() {
|
|
38
|
+
this._updateStyle();
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
lifetimes: {
|
|
43
|
+
attached() {
|
|
44
|
+
this._updateStyle();
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
methods: {
|
|
49
|
+
_resolveGap(val) {
|
|
50
|
+
if (Array.isArray(val)) {
|
|
51
|
+
return [this._resolveOne(val[0]), this._resolveOne(val[1])];
|
|
52
|
+
}
|
|
53
|
+
const g = this._resolveOne(val);
|
|
54
|
+
return [g, g];
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
_resolveOne(val) {
|
|
58
|
+
if (typeof val === 'number') return `${val}rpx`;
|
|
59
|
+
return SIZE_MAP[val] || SIZE_MAP.medium;
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
_updateStyle() {
|
|
63
|
+
const { vertical, align, justify, size, wrap, inline } = this.data;
|
|
64
|
+
const [rowGap, colGap] = this._resolveGap(size);
|
|
65
|
+
const parts = [
|
|
66
|
+
`display:${inline ? 'inline-flex' : 'flex'}`,
|
|
67
|
+
`flex-direction:${vertical ? 'column' : 'row'}`,
|
|
68
|
+
`flex-wrap:${wrap ? 'wrap' : 'nowrap'}`,
|
|
69
|
+
`justify-content:${justify}`,
|
|
70
|
+
`row-gap:${rowGap}`,
|
|
71
|
+
`column-gap:${colGap}`,
|
|
72
|
+
];
|
|
73
|
+
if (align) parts.push(`align-items:${align}`);
|
|
74
|
+
this.setData({ _style: parts.join(';') });
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
data: {
|
|
79
|
+
_style: '',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
properties: {
|
|
3
|
+
type: {
|
|
4
|
+
type: String,
|
|
5
|
+
value: 'default', // default | primary
|
|
6
|
+
},
|
|
7
|
+
shape: {
|
|
8
|
+
type: String,
|
|
9
|
+
value: 'circle', // circle | square
|
|
10
|
+
},
|
|
11
|
+
disabled: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
value: false,
|
|
14
|
+
},
|
|
15
|
+
position: {
|
|
16
|
+
type: String,
|
|
17
|
+
value: 'bottom-right', // bottom-right | bottom-left | top-right | top-left
|
|
18
|
+
},
|
|
19
|
+
right: { type: Number, value: -1 },
|
|
20
|
+
bottom: { type: Number, value: -1 },
|
|
21
|
+
left: { type: Number, value: -1 },
|
|
22
|
+
top: { type: Number, value: -1 },
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
data: {
|
|
26
|
+
_style: '',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
lifetimes: {
|
|
30
|
+
ready() {
|
|
31
|
+
this._computeStyle();
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
observers: {
|
|
36
|
+
'position, right, bottom, left, top'() {
|
|
37
|
+
this._computeStyle();
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
methods: {
|
|
42
|
+
_computeStyle() {
|
|
43
|
+
const pos = this.data.position;
|
|
44
|
+
const right = this.data.right;
|
|
45
|
+
const bottom = this.data.bottom;
|
|
46
|
+
const left = this.data.left;
|
|
47
|
+
const top = this.data.top;
|
|
48
|
+
const parts = ['position: fixed', 'z-index: 999'];
|
|
49
|
+
|
|
50
|
+
if (right >= 0) {
|
|
51
|
+
parts.push(`right: ${right}rpx`);
|
|
52
|
+
} else if (left >= 0) {
|
|
53
|
+
parts.push(`left: ${left}rpx`);
|
|
54
|
+
} else if (pos === 'bottom-right' || pos === 'top-right') {
|
|
55
|
+
parts.push('right: 48rpx');
|
|
56
|
+
} else {
|
|
57
|
+
parts.push('left: 48rpx');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (top >= 0) {
|
|
61
|
+
parts.push(`top: ${top}rpx`);
|
|
62
|
+
} else if (bottom >= 0) {
|
|
63
|
+
parts.push(`bottom: ${bottom}rpx`);
|
|
64
|
+
} else if (pos === 'bottom-right' || pos === 'bottom-left') {
|
|
65
|
+
parts.push('bottom: 96rpx');
|
|
66
|
+
} else {
|
|
67
|
+
parts.push('top: 192rpx');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
this.setData({ _style: parts.join('; ') });
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
handleTap() {
|
|
74
|
+
if (this.data.disabled) return;
|
|
75
|
+
this.triggerEvent('tap');
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|