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,59 @@
|
|
|
1
|
+
.w-form-item {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.w-form-item--left {
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
|
|
9
|
+
.w-form-item__label {
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.w-form-item__content {
|
|
14
|
+
flex: 1;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.w-form-item__label {
|
|
20
|
+
font-size: var(--font-size-form-label);
|
|
21
|
+
color: var(--color-text-primary);
|
|
22
|
+
margin-bottom: var(--size-form-label-gap);
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 4rpx;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.w-form-item--left .w-form-item__label {
|
|
29
|
+
margin-bottom: 0;
|
|
30
|
+
margin-right: var(--size-form-label-gap);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.w-form-item__require {
|
|
34
|
+
color: var(--color-danger);
|
|
35
|
+
font-size: var(--font-size-form-label);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.w-form-item__content {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.w-form-item__feedback {
|
|
44
|
+
font-size: var(--font-size-form-feedback);
|
|
45
|
+
margin-top: 8rpx;
|
|
46
|
+
line-height: 1.4;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.w-form-item__feedback--error {
|
|
50
|
+
color: var(--color-form-feedback-error);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.w-form-item__feedback--warning {
|
|
54
|
+
color: var(--color-form-feedback-warning);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.w-form-item__feedback--success {
|
|
58
|
+
color: var(--color-success);
|
|
59
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<view
|
|
2
|
+
class="w-form-item w-form-item--{{_formLabelPlacement}} {{(validationStatus || _validationStatus) === 'error' ? 'w-form-item--error' : ''}} {{(validationStatus || _validationStatus) === 'warning' ? 'w-form-item--warning' : ''}}"
|
|
3
|
+
>
|
|
4
|
+
<view
|
|
5
|
+
wx:if="{{_formShowLabel}}"
|
|
6
|
+
class="w-form-item__label"
|
|
7
|
+
style="{{_formLabelPlacement === 'left' ? 'width: ' + (labelWidth || _formLabelWidth || '160rpx') + ';' : ''}}"
|
|
8
|
+
>
|
|
9
|
+
<span
|
|
10
|
+
wx:if="{{_formShowRequireMark && _isRequired && (requireMarkPlacement || _formRequireMarkPlacement) === 'left'}}"
|
|
11
|
+
class="w-form-item__require"
|
|
12
|
+
>
|
|
13
|
+
*
|
|
14
|
+
</span>
|
|
15
|
+
<text wx:if="{{label}}">{{label}}</text>
|
|
16
|
+
<slot wx:else name="label"></slot>
|
|
17
|
+
<span
|
|
18
|
+
wx:if="{{_formShowRequireMark && _isRequired && (requireMarkPlacement || _formRequireMarkPlacement) !== 'left'}}"
|
|
19
|
+
class="w-form-item__require"
|
|
20
|
+
>
|
|
21
|
+
*
|
|
22
|
+
</span>
|
|
23
|
+
</view>
|
|
24
|
+
<view class="w-form-item__content">
|
|
25
|
+
<slot></slot>
|
|
26
|
+
<view
|
|
27
|
+
wx:if="{{(showFeedback !== null ? showFeedback : _formShowFeedback) && (feedback || _validationMessage)}}"
|
|
28
|
+
class="w-form-item__feedback w-form-item__feedback--{{validationStatus || _validationStatus || 'error'}}"
|
|
29
|
+
>
|
|
30
|
+
{{feedback || _validationMessage}}
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
</view>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
properties: {
|
|
3
|
+
type: {
|
|
4
|
+
type: String,
|
|
5
|
+
value: 'primary', // primary | info | success | warning | error
|
|
6
|
+
},
|
|
7
|
+
size: {
|
|
8
|
+
type: String,
|
|
9
|
+
value: '', // sm | md | lg | xl or custom value like '48rpx'
|
|
10
|
+
},
|
|
11
|
+
gradient: {
|
|
12
|
+
type: String,
|
|
13
|
+
value: '', // custom CSS gradient, e.g. 'linear-gradient(90deg, red, blue)'
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
data: {
|
|
18
|
+
_style: '',
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
observers: {
|
|
22
|
+
'type, size, gradient'(type, size, gradient) {
|
|
23
|
+
const parts = [];
|
|
24
|
+
|
|
25
|
+
// gradient or type-based color
|
|
26
|
+
if (gradient) {
|
|
27
|
+
parts.push(`background-image: ${gradient}`);
|
|
28
|
+
} else {
|
|
29
|
+
const colorMap = {
|
|
30
|
+
primary: 'linear-gradient(135deg, var(--color-brand), #05a34e)',
|
|
31
|
+
info: 'linear-gradient(135deg, var(--color-info), #0790d4)',
|
|
32
|
+
success: 'linear-gradient(135deg, var(--color-success), #5a9400)',
|
|
33
|
+
warning: 'linear-gradient(135deg, var(--color-warning), #e08520)',
|
|
34
|
+
error: 'linear-gradient(135deg, var(--color-danger), #d43030)',
|
|
35
|
+
};
|
|
36
|
+
const bg = colorMap[type] || colorMap.primary;
|
|
37
|
+
parts.push(`background-image: ${bg}`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// font size
|
|
41
|
+
if (size) {
|
|
42
|
+
const sizeMap = {
|
|
43
|
+
sm: 'var(--font-size-sm)',
|
|
44
|
+
md: 'var(--font-size-md)',
|
|
45
|
+
lg: 'var(--font-size-lg)',
|
|
46
|
+
xl: 'var(--font-size-xl)',
|
|
47
|
+
};
|
|
48
|
+
parts.push(`font-size: ${sizeMap[size] || size}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.setData({ _style: parts.join('; ') });
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<text class="w-gradient-text" style="{{_style}}"><slot></slot></text>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
properties: {
|
|
3
|
+
level: {
|
|
4
|
+
type: Number,
|
|
5
|
+
value: 1, // 1–6
|
|
6
|
+
},
|
|
7
|
+
type: {
|
|
8
|
+
type: String,
|
|
9
|
+
value: 'default', // default / primary / info / success / warning / error
|
|
10
|
+
},
|
|
11
|
+
prefix: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
value: false,
|
|
14
|
+
},
|
|
15
|
+
alignText: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
value: false,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
data: {
|
|
22
|
+
_class: '',
|
|
23
|
+
_style: '',
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
observers: {
|
|
27
|
+
'level, type, prefix, alignText'(level, type, prefix, alignText) {
|
|
28
|
+
const lvl = level < 1 ? 1 : level > 6 ? 6 : level;
|
|
29
|
+
|
|
30
|
+
const cls = ['w-h', `w-h--${lvl}`];
|
|
31
|
+
if (type !== 'default') cls.push(`w-h--${type}`);
|
|
32
|
+
if (prefix) {
|
|
33
|
+
cls.push('w-h--prefix');
|
|
34
|
+
if (alignText) cls.push('w-h--align-text');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const parts = [];
|
|
38
|
+
// type color
|
|
39
|
+
const colorMap = {
|
|
40
|
+
primary: 'var(--color-brand)',
|
|
41
|
+
info: 'var(--color-info)',
|
|
42
|
+
success: 'var(--color-success)',
|
|
43
|
+
warning: 'var(--color-warning)',
|
|
44
|
+
error: 'var(--color-danger)',
|
|
45
|
+
};
|
|
46
|
+
if (colorMap[type]) {
|
|
47
|
+
parts.push(`color: ${colorMap[type]}`);
|
|
48
|
+
}
|
|
49
|
+
// prefix bar color follows type
|
|
50
|
+
if (prefix && colorMap[type]) {
|
|
51
|
+
parts.push(`--h-bar-color: ${colorMap[type]}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this.setData({
|
|
55
|
+
_class: cls.join(' '),
|
|
56
|
+
_style: parts.join('; '),
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.w-h {
|
|
2
|
+
color: var(--color-text-primary);
|
|
3
|
+
font-weight: 600;
|
|
4
|
+
margin: 0;
|
|
5
|
+
line-height: 1.4;
|
|
6
|
+
--h-bar-color: var(--color-h-bar);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.w-h--1 {
|
|
10
|
+
font-size: var(--font-size-h1);
|
|
11
|
+
font-weight: 700;
|
|
12
|
+
}
|
|
13
|
+
.w-h--2 {
|
|
14
|
+
font-size: var(--font-size-h2);
|
|
15
|
+
font-weight: 700;
|
|
16
|
+
}
|
|
17
|
+
.w-h--3 {
|
|
18
|
+
font-size: var(--font-size-h3);
|
|
19
|
+
}
|
|
20
|
+
.w-h--4 {
|
|
21
|
+
font-size: var(--font-size-h4);
|
|
22
|
+
}
|
|
23
|
+
.w-h--5 {
|
|
24
|
+
font-size: var(--font-size-h5);
|
|
25
|
+
}
|
|
26
|
+
.w-h--6 {
|
|
27
|
+
font-size: var(--font-size-h6);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Prefix bar */
|
|
31
|
+
.w-h--prefix {
|
|
32
|
+
position: relative;
|
|
33
|
+
padding-left: calc(var(--size-h-bar-width) + var(--spacing-md));
|
|
34
|
+
|
|
35
|
+
&::before {
|
|
36
|
+
content: '';
|
|
37
|
+
position: absolute;
|
|
38
|
+
left: 0;
|
|
39
|
+
top: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
width: var(--size-h-bar-width);
|
|
42
|
+
border-radius: calc(var(--size-h-bar-width) / 2);
|
|
43
|
+
background-color: var(--h-bar-color);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.w-h--align-text {
|
|
48
|
+
padding-left: 0;
|
|
49
|
+
|
|
50
|
+
&::before {
|
|
51
|
+
left: calc(-1 * (var(--size-h-bar-width) + var(--spacing-md)));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<view class="{{_class}}" style="{{_style}}"><slot></slot></view>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
properties: {
|
|
3
|
+
text: {
|
|
4
|
+
type: String,
|
|
5
|
+
value: '',
|
|
6
|
+
},
|
|
7
|
+
patterns: {
|
|
8
|
+
type: Array,
|
|
9
|
+
value: [],
|
|
10
|
+
},
|
|
11
|
+
caseSensitive: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
value: false,
|
|
14
|
+
},
|
|
15
|
+
autoEscape: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
value: true,
|
|
18
|
+
},
|
|
19
|
+
highlightClass: {
|
|
20
|
+
type: String,
|
|
21
|
+
value: '',
|
|
22
|
+
},
|
|
23
|
+
highlightStyle: {
|
|
24
|
+
type: String,
|
|
25
|
+
value: '',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
data: {
|
|
30
|
+
_segments: [],
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
observers: {
|
|
34
|
+
'text, patterns, caseSensitive, autoEscape': function (
|
|
35
|
+
text,
|
|
36
|
+
patterns,
|
|
37
|
+
caseSensitive,
|
|
38
|
+
autoEscape,
|
|
39
|
+
) {
|
|
40
|
+
if (!text || !patterns || patterns.length === 0) {
|
|
41
|
+
this.setData({ _segments: text ? [{ text, isMatch: false }] : [] });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
46
|
+
|
|
47
|
+
const pattern = patterns
|
|
48
|
+
.filter((w) => w)
|
|
49
|
+
.map((w) => (autoEscape ? escapeRegExp(w) : w))
|
|
50
|
+
.join('|');
|
|
51
|
+
|
|
52
|
+
if (!pattern) {
|
|
53
|
+
this.setData({ _segments: [{ text, isMatch: false }] });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const regex = new RegExp(`(${pattern})`, caseSensitive ? 'g' : 'gi');
|
|
58
|
+
const segments = [];
|
|
59
|
+
let lastIndex = 0;
|
|
60
|
+
|
|
61
|
+
for (const match of text.matchAll(regex)) {
|
|
62
|
+
const { index } = match;
|
|
63
|
+
if (index > lastIndex) {
|
|
64
|
+
segments.push({ text: text.slice(lastIndex, index), isMatch: false });
|
|
65
|
+
}
|
|
66
|
+
segments.push({ text: match[0], isMatch: true });
|
|
67
|
+
lastIndex = index + match[0].length;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (lastIndex < text.length) {
|
|
71
|
+
segments.push({ text: text.slice(lastIndex), isMatch: false });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this.setData({ _segments: segments });
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<text class="w-highlight">
|
|
2
|
+
<block wx:for="{{_segments}}" wx:key="index">
|
|
3
|
+
<text
|
|
4
|
+
wx:if="{{item.isMatch}}"
|
|
5
|
+
class="w-highlight__mark {{highlightClass}}"
|
|
6
|
+
style="{{highlightStyle}}"
|
|
7
|
+
>
|
|
8
|
+
{{item.text}}
|
|
9
|
+
</text>
|
|
10
|
+
<block wx:else>{{item.text}}</block>
|
|
11
|
+
</block>
|
|
12
|
+
</text>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
properties: {
|
|
3
|
+
distance: {
|
|
4
|
+
type: Number,
|
|
5
|
+
value: 50,
|
|
6
|
+
},
|
|
7
|
+
loading: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
value: false,
|
|
10
|
+
},
|
|
11
|
+
finished: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
value: false,
|
|
14
|
+
},
|
|
15
|
+
loadingText: {
|
|
16
|
+
type: String,
|
|
17
|
+
value: '加载中...',
|
|
18
|
+
},
|
|
19
|
+
finishedText: {
|
|
20
|
+
type: String,
|
|
21
|
+
value: '没有更多了',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
methods: {
|
|
26
|
+
onScrollToLower() {
|
|
27
|
+
if (this.data.loading || this.data.finished) return;
|
|
28
|
+
this.triggerEvent('load');
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.w-infinite-scroll {
|
|
2
|
+
height: 100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.w-infinite-scroll__tip {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
padding: var(--spacing-lg) 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.w-infinite-scroll__spinner {
|
|
13
|
+
width: 32rpx;
|
|
14
|
+
height: 32rpx;
|
|
15
|
+
border: 3rpx solid rgba(0, 0, 0, 0.15);
|
|
16
|
+
border-top-color: var(--color-text-secondary);
|
|
17
|
+
border-radius: 50%;
|
|
18
|
+
margin-right: var(--spacing-sm);
|
|
19
|
+
animation: w-infinite-scroll-spin 0.8s linear infinite;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.w-infinite-scroll__text {
|
|
23
|
+
font-size: var(--font-size-sm);
|
|
24
|
+
color: var(--color-text-secondary);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@keyframes w-infinite-scroll-spin {
|
|
28
|
+
to {
|
|
29
|
+
transform: rotate(360deg);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<scroll-view
|
|
2
|
+
class="w-infinite-scroll"
|
|
3
|
+
scroll-y
|
|
4
|
+
lower-threshold="{{distance}}"
|
|
5
|
+
bindscrolltolower="onScrollToLower"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
<view class="w-infinite-scroll__tip" wx:if="{{loading || finished}}">
|
|
9
|
+
<view class="w-infinite-scroll__spinner" wx:if="{{loading}}" />
|
|
10
|
+
<text class="w-infinite-scroll__text">{{loading ? loadingText : finishedText}}</text>
|
|
11
|
+
</view>
|
|
12
|
+
</scroll-view>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const formField = require('../../behaviors/formField');
|
|
2
|
+
|
|
3
|
+
Component({
|
|
4
|
+
behaviors: ['wx://form-field', formField],
|
|
5
|
+
|
|
6
|
+
relations: {
|
|
7
|
+
'../form-item/form-item': {
|
|
8
|
+
type: 'ancestor',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
properties: {
|
|
13
|
+
value: { type: String, value: '' },
|
|
14
|
+
type: { type: String, value: 'text' },
|
|
15
|
+
password: { type: Boolean, value: false },
|
|
16
|
+
placeholder: { type: String, value: '' },
|
|
17
|
+
disabled: { type: Boolean, value: false },
|
|
18
|
+
readonly: { type: Boolean, value: false },
|
|
19
|
+
maxlength: { type: Number, value: 140 },
|
|
20
|
+
clearable: { type: Boolean, value: false },
|
|
21
|
+
showWordLimit: { type: Boolean, value: false },
|
|
22
|
+
size: { type: String, value: '' },
|
|
23
|
+
status: { type: String, value: '' },
|
|
24
|
+
round: { type: Boolean, value: false },
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
data: {
|
|
28
|
+
_focused: false,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
methods: {
|
|
32
|
+
handleInput(e) {
|
|
33
|
+
const val = e.detail.value;
|
|
34
|
+
this.triggerEvent('update:value', { value: val });
|
|
35
|
+
this._notifyChange();
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
handleFocus(e) {
|
|
39
|
+
this.setData({ _focused: true });
|
|
40
|
+
this.triggerEvent('focus', e.detail);
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
handleBlur(e) {
|
|
44
|
+
this.setData({ _focused: false });
|
|
45
|
+
this.triggerEvent('blur', e.detail);
|
|
46
|
+
this._notifyBlur();
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
handleConfirm(e) {
|
|
50
|
+
this.triggerEvent('confirm', e.detail);
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
handleClear() {
|
|
54
|
+
this.triggerEvent('update:value', { value: '' });
|
|
55
|
+
this.triggerEvent('clear');
|
|
56
|
+
this._notifyChange();
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@import '../../styles/iconfont.scss';
|
|
2
|
+
|
|
3
|
+
.w-input {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: var(--w-input-height);
|
|
9
|
+
padding: 0 var(--spacing-md);
|
|
10
|
+
background: var(--w-input-bg);
|
|
11
|
+
border: 2rpx solid var(--w-input-border);
|
|
12
|
+
border-radius: var(--w-input-radius);
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
transition: border-color 0.2s;
|
|
15
|
+
gap: var(--spacing-xs);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.w-input--size-medium {
|
|
19
|
+
height: var(--w-input-height-md);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.w-input--size-small {
|
|
23
|
+
height: var(--w-input-height-sm);
|
|
24
|
+
padding: 0 var(--spacing-sm);
|
|
25
|
+
font-size: var(--font-size-sm);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.w-input--round {
|
|
29
|
+
border-radius: var(--radius-full);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.w-input--focus {
|
|
33
|
+
border-color: var(--w-input-border-focus);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.w-input--disabled {
|
|
37
|
+
background: var(--color-input-bg-disabled);
|
|
38
|
+
opacity: 0.6;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.w-input--error {
|
|
42
|
+
border-color: var(--color-input-border-error);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.w-input--warning {
|
|
46
|
+
border-color: var(--color-input-border-warning);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.w-input__native {
|
|
50
|
+
flex: 1;
|
|
51
|
+
min-width: 0;
|
|
52
|
+
height: 100%;
|
|
53
|
+
font-size: inherit;
|
|
54
|
+
color: var(--color-text-primary);
|
|
55
|
+
background: transparent;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.w-input__placeholder {
|
|
59
|
+
color: var(--color-text-placeholder);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.w-input__prefix,
|
|
63
|
+
.w-input__suffix {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
flex-shrink: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.w-input__clear {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
width: 36rpx;
|
|
74
|
+
height: 36rpx;
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.w-input__clear-icon {
|
|
79
|
+
width: 28rpx;
|
|
80
|
+
height: 28rpx;
|
|
81
|
+
border-radius: 50%;
|
|
82
|
+
background: var(--color-text-placeholder);
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
font-size: 16rpx;
|
|
87
|
+
color: var(--color-bg-elevated);
|
|
88
|
+
line-height: 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.w-input__count {
|
|
92
|
+
font-size: var(--font-size-sm);
|
|
93
|
+
color: var(--color-text-secondary);
|
|
94
|
+
flex-shrink: 0;
|
|
95
|
+
margin-left: var(--spacing-xs);
|
|
96
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<view
|
|
2
|
+
class="w-input w-input--size-{{size || _formItemSize || 'medium'}} {{round ? 'w-input--round' : ''}} {{(disabled || _formItemDisabled) ? 'w-input--disabled' : ''}} {{readonly ? 'w-input--readonly' : ''}} {{_focused ? 'w-input--focus' : ''}} {{status === 'error' ? 'w-input--error' : ''}} {{status === 'warning' ? 'w-input--warning' : ''}}"
|
|
3
|
+
>
|
|
4
|
+
<view class="w-input__prefix" wx:if="{{true}}">
|
|
5
|
+
<slot name="prefix"></slot>
|
|
6
|
+
</view>
|
|
7
|
+
<input
|
|
8
|
+
class="w-input__native"
|
|
9
|
+
value="{{value}}"
|
|
10
|
+
type="{{type}}"
|
|
11
|
+
password="{{password}}"
|
|
12
|
+
placeholder="{{placeholder}}"
|
|
13
|
+
placeholder-class="w-input__placeholder"
|
|
14
|
+
disabled="{{disabled || _formItemDisabled || readonly}}"
|
|
15
|
+
maxlength="{{maxlength}}"
|
|
16
|
+
bindinput="handleInput"
|
|
17
|
+
bindfocus="handleFocus"
|
|
18
|
+
bindblur="handleBlur"
|
|
19
|
+
bindconfirm="handleConfirm"
|
|
20
|
+
/>
|
|
21
|
+
<view
|
|
22
|
+
wx:if="{{clearable && value && !disabled && !_formItemDisabled && !readonly}}"
|
|
23
|
+
class="w-input__clear"
|
|
24
|
+
bindtap="handleClear"
|
|
25
|
+
>
|
|
26
|
+
<text class="w-input__clear-icon iconfont icon-close"></text>
|
|
27
|
+
</view>
|
|
28
|
+
<view class="w-input__suffix" wx:if="{{true}}">
|
|
29
|
+
<slot name="suffix"></slot>
|
|
30
|
+
</view>
|
|
31
|
+
<view wx:if="{{showWordLimit && maxlength > 0}}" class="w-input__count">
|
|
32
|
+
{{value.length}}/{{maxlength}}
|
|
33
|
+
</view>
|
|
34
|
+
</view>
|