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,106 @@
|
|
|
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
|
+
length: { type: Number, value: 6 },
|
|
15
|
+
mask: { type: Boolean, value: false },
|
|
16
|
+
disabled: { type: Boolean, value: false },
|
|
17
|
+
readonly: { type: Boolean, value: false },
|
|
18
|
+
size: { type: String, value: '' },
|
|
19
|
+
status: { type: String, value: '' },
|
|
20
|
+
gap: { type: Number, value: 0 },
|
|
21
|
+
placeholder: { type: String, value: '' },
|
|
22
|
+
type: { type: String, value: 'number' },
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
data: {
|
|
26
|
+
_focused: false,
|
|
27
|
+
_slots: [],
|
|
28
|
+
_cursorIndex: 0,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
observers: {
|
|
32
|
+
'value, length': function (value, length) {
|
|
33
|
+
this._syncSlots(value, length);
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
lifetimes: {
|
|
38
|
+
attached() {
|
|
39
|
+
this._syncSlots(this.data.value, this.data.length);
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
methods: {
|
|
44
|
+
_syncSlots(value, length) {
|
|
45
|
+
const str = (value || '').slice(0, length);
|
|
46
|
+
const slots = [];
|
|
47
|
+
for (let i = 0; i < length; i++) {
|
|
48
|
+
slots.push(str[i] || '');
|
|
49
|
+
}
|
|
50
|
+
this.setData({ _slots: slots });
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
_doUpdateValue(newValue) {
|
|
54
|
+
const str = newValue.slice(0, this.data.length);
|
|
55
|
+
this.triggerEvent('update:value', { value: str });
|
|
56
|
+
|
|
57
|
+
this._notifyChange();
|
|
58
|
+
|
|
59
|
+
if (str.length === this.data.length) {
|
|
60
|
+
this.triggerEvent('finish', { value: str });
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
handleTap() {
|
|
65
|
+
if (this._isDisabled() || this.data.readonly) return;
|
|
66
|
+
this.setData({ _focused: true });
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
handleInput(e) {
|
|
70
|
+
let val = e.detail.value || '';
|
|
71
|
+
// Filter to allowed length
|
|
72
|
+
val = val.slice(0, this.data.length);
|
|
73
|
+
this._doUpdateValue(val);
|
|
74
|
+
// Update cursor position for visual feedback
|
|
75
|
+
this.setData({ _cursorIndex: val.length });
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
handleFocus() {
|
|
79
|
+
const cursorPos = (this.data.value || '').length;
|
|
80
|
+
this.setData({
|
|
81
|
+
_focused: true,
|
|
82
|
+
_cursorIndex: Math.min(cursorPos, this.data.length),
|
|
83
|
+
});
|
|
84
|
+
this.triggerEvent('focus');
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
handleBlur() {
|
|
88
|
+
this.setData({ _focused: false });
|
|
89
|
+
this.triggerEvent('blur');
|
|
90
|
+
this._notifyBlur();
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
// Public method
|
|
94
|
+
focusOnChar(charIndex) {
|
|
95
|
+
this.setData({
|
|
96
|
+
_focused: true,
|
|
97
|
+
_cursorIndex: charIndex,
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
clear() {
|
|
102
|
+
this._doUpdateValue('');
|
|
103
|
+
this.setData({ _focused: true, _cursorIndex: 0 });
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
.w-input-otp {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--spacing-sm);
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.w-input-otp__slot {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
width: var(--size-otp-slot);
|
|
13
|
+
height: var(--size-otp-slot);
|
|
14
|
+
background: var(--color-input-bg);
|
|
15
|
+
border: 2rpx solid var(--color-input-border);
|
|
16
|
+
border-radius: var(--radius-md);
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
transition: border-color 0.2s;
|
|
19
|
+
position: relative;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.w-input-otp__slot--focus {
|
|
23
|
+
border-color: var(--color-input-border-focus);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.w-input-otp__slot--filled {
|
|
27
|
+
border-color: var(--color-text-secondary);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.w-input-otp__char {
|
|
31
|
+
font-size: var(--font-size-xl);
|
|
32
|
+
color: var(--color-text-primary);
|
|
33
|
+
line-height: 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.w-input-otp__placeholder {
|
|
37
|
+
font-size: var(--font-size-xl);
|
|
38
|
+
color: var(--color-text-placeholder);
|
|
39
|
+
line-height: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.w-input-otp__mask-dot {
|
|
43
|
+
width: 16rpx;
|
|
44
|
+
height: 16rpx;
|
|
45
|
+
border-radius: 50%;
|
|
46
|
+
background: var(--color-text-primary);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.w-input-otp__cursor {
|
|
50
|
+
width: 2rpx;
|
|
51
|
+
height: 40rpx;
|
|
52
|
+
background: var(--color-brand);
|
|
53
|
+
animation: w-otp-blink 1s step-end infinite;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@keyframes w-otp-blink {
|
|
57
|
+
0%,
|
|
58
|
+
100% {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
}
|
|
61
|
+
50% {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Hidden input - positioned off-screen but still focusable */
|
|
67
|
+
.w-input-otp__hidden {
|
|
68
|
+
position: absolute;
|
|
69
|
+
left: -9999rpx;
|
|
70
|
+
width: 1rpx;
|
|
71
|
+
height: 1rpx;
|
|
72
|
+
opacity: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* Size variants */
|
|
76
|
+
.w-input-otp--size-medium .w-input-otp__slot {
|
|
77
|
+
--size-otp-slot: 88rpx;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.w-input-otp--size-small .w-input-otp__slot {
|
|
81
|
+
--size-otp-slot: 72rpx;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.w-input-otp--size-small .w-input-otp__char,
|
|
85
|
+
.w-input-otp--size-small .w-input-otp__placeholder {
|
|
86
|
+
font-size: var(--font-size-lg);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.w-input-otp--size-small .w-input-otp__cursor {
|
|
90
|
+
height: 32rpx;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.w-input-otp--size-large .w-input-otp__slot {
|
|
94
|
+
--size-otp-slot: 104rpx;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.w-input-otp--size-large .w-input-otp__char,
|
|
98
|
+
.w-input-otp--size-large .w-input-otp__placeholder {
|
|
99
|
+
font-size: var(--font-size-h4);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.w-input-otp--size-large .w-input-otp__cursor {
|
|
103
|
+
height: 48rpx;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Disabled */
|
|
107
|
+
.w-input-otp--disabled {
|
|
108
|
+
opacity: 0.6;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.w-input-otp--disabled .w-input-otp__slot {
|
|
112
|
+
background: var(--color-input-bg-disabled);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Status */
|
|
116
|
+
.w-input-otp--error .w-input-otp__slot {
|
|
117
|
+
border-color: var(--color-input-border-error);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.w-input-otp--warning .w-input-otp__slot {
|
|
121
|
+
border-color: var(--color-input-border-warning);
|
|
122
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<view
|
|
2
|
+
class="w-input-otp w-input-otp--size-{{size || _formItemSize || 'medium'}} {{(disabled || _formItemDisabled) ? 'w-input-otp--disabled' : ''}} {{readonly ? 'w-input-otp--readonly' : ''}} {{status === 'error' ? 'w-input-otp--error' : ''}} {{status === 'warning' ? 'w-input-otp--warning' : ''}}"
|
|
3
|
+
style="{{gap ? 'gap: ' + gap + 'rpx;' : ''}}"
|
|
4
|
+
bindtap="handleTap"
|
|
5
|
+
>
|
|
6
|
+
<view
|
|
7
|
+
wx:for="{{_slots}}"
|
|
8
|
+
wx:key="index"
|
|
9
|
+
class="w-input-otp__slot {{_focused && _cursorIndex === index ? 'w-input-otp__slot--focus' : ''}} {{item ? 'w-input-otp__slot--filled' : ''}}"
|
|
10
|
+
>
|
|
11
|
+
<block wx:if="{{mask && item}}">
|
|
12
|
+
<view class="w-input-otp__mask-dot"></view>
|
|
13
|
+
</block>
|
|
14
|
+
<block wx:elif="{{item}}">
|
|
15
|
+
<text class="w-input-otp__char">{{item}}</text>
|
|
16
|
+
</block>
|
|
17
|
+
<block wx:elif="{{!_focused && placeholder}}">
|
|
18
|
+
<text class="w-input-otp__placeholder">{{placeholder}}</text>
|
|
19
|
+
</block>
|
|
20
|
+
<view
|
|
21
|
+
wx:if="{{_focused && _cursorIndex === index && !item}}"
|
|
22
|
+
class="w-input-otp__cursor"
|
|
23
|
+
></view>
|
|
24
|
+
</view>
|
|
25
|
+
|
|
26
|
+
<!-- Hidden input captures all keyboard events -->
|
|
27
|
+
<input
|
|
28
|
+
class="w-input-otp__hidden"
|
|
29
|
+
value="{{value}}"
|
|
30
|
+
type="{{type}}"
|
|
31
|
+
focus="{{_focused}}"
|
|
32
|
+
maxlength="{{length}}"
|
|
33
|
+
disabled="{{disabled || _formItemDisabled || readonly}}"
|
|
34
|
+
bindinput="handleInput"
|
|
35
|
+
bindfocus="handleFocus"
|
|
36
|
+
bindblur="handleBlur"
|
|
37
|
+
/>
|
|
38
|
+
</view>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
properties: {
|
|
3
|
+
hasSider: {
|
|
4
|
+
type: Boolean,
|
|
5
|
+
value: false,
|
|
6
|
+
},
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
relations: {
|
|
10
|
+
'../layout-header/layout-header': {
|
|
11
|
+
type: 'descendant',
|
|
12
|
+
},
|
|
13
|
+
'../layout-content/layout-content': {
|
|
14
|
+
type: 'descendant',
|
|
15
|
+
},
|
|
16
|
+
'../layout-footer/layout-footer': {
|
|
17
|
+
type: 'descendant',
|
|
18
|
+
},
|
|
19
|
+
'../layout-sider/layout-sider': {
|
|
20
|
+
type: 'descendant',
|
|
21
|
+
linked() {
|
|
22
|
+
this._updateHasSider();
|
|
23
|
+
},
|
|
24
|
+
linkChanged() {
|
|
25
|
+
this._updateHasSider();
|
|
26
|
+
},
|
|
27
|
+
unlinked() {
|
|
28
|
+
this._updateHasSider();
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
data: {
|
|
34
|
+
_hasSider: false,
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
observers: {
|
|
38
|
+
hasSider(val) {
|
|
39
|
+
this.setData({ _hasSider: val });
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
methods: {
|
|
44
|
+
_updateHasSider() {
|
|
45
|
+
const siders = this.getRelationNodes('../layout-sider/layout-sider');
|
|
46
|
+
const hasSider = this.data.hasSider || (siders && siders.length > 0);
|
|
47
|
+
this.setData({ _hasSider: hasSider });
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
options: {
|
|
3
|
+
virtualHost: true,
|
|
4
|
+
},
|
|
5
|
+
|
|
6
|
+
properties: {
|
|
7
|
+
scrollY: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
value: true,
|
|
10
|
+
},
|
|
11
|
+
scrollX: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
value: false,
|
|
14
|
+
},
|
|
15
|
+
scrollTop: {
|
|
16
|
+
type: Number,
|
|
17
|
+
},
|
|
18
|
+
scrollIntoView: {
|
|
19
|
+
type: String,
|
|
20
|
+
value: '',
|
|
21
|
+
},
|
|
22
|
+
scrollWithAnimation: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
value: false,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
relations: {
|
|
29
|
+
'../layout/layout': {
|
|
30
|
+
type: 'ancestor',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
methods: {
|
|
35
|
+
_onScroll(e) {
|
|
36
|
+
this.triggerEvent('scroll', e.detail);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
_onScrollToLower(e) {
|
|
40
|
+
this.triggerEvent('scrolltolower', e.detail);
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
_onScrollToUpper(e) {
|
|
44
|
+
this.triggerEvent('scrolltoupper', e.detail);
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<scroll-view
|
|
2
|
+
class="w-layout-content"
|
|
3
|
+
scroll-y="{{scrollY}}"
|
|
4
|
+
scroll-x="{{scrollX}}"
|
|
5
|
+
scroll-top="{{scrollTop}}"
|
|
6
|
+
scroll-into-view="{{scrollIntoView}}"
|
|
7
|
+
scroll-with-animation="{{scrollWithAnimation}}"
|
|
8
|
+
bindscroll="_onScroll"
|
|
9
|
+
bindscrolltolower="_onScrollToLower"
|
|
10
|
+
bindscrolltoupper="_onScrollToUpper"
|
|
11
|
+
>
|
|
12
|
+
<slot></slot>
|
|
13
|
+
</scroll-view>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
options: {
|
|
3
|
+
virtualHost: true,
|
|
4
|
+
},
|
|
5
|
+
|
|
6
|
+
properties: {
|
|
7
|
+
position: {
|
|
8
|
+
type: String,
|
|
9
|
+
value: 'fixed',
|
|
10
|
+
},
|
|
11
|
+
bordered: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
value: false,
|
|
14
|
+
},
|
|
15
|
+
safeArea: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
value: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
relations: {
|
|
22
|
+
'../layout/layout': {
|
|
23
|
+
type: 'ancestor',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
data: {
|
|
28
|
+
_placeholderHeight: 0,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
lifetimes: {
|
|
32
|
+
ready() {
|
|
33
|
+
if (this.data.position === 'fixed') {
|
|
34
|
+
this._measureHeight();
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
observers: {
|
|
40
|
+
'position, bordered, safeArea'() {
|
|
41
|
+
if (this.data.position === 'fixed') {
|
|
42
|
+
setTimeout(() => this._measureHeight(), 50);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
methods: {
|
|
48
|
+
_measureHeight() {
|
|
49
|
+
this.createSelectorQuery()
|
|
50
|
+
.select('.w-layout-footer')
|
|
51
|
+
.boundingClientRect((rect) => {
|
|
52
|
+
if (rect) {
|
|
53
|
+
this.setData({ _placeholderHeight: rect.height });
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
.exec();
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.w-layout-footer {
|
|
2
|
+
background: var(--layout-footer-bg);
|
|
3
|
+
|
|
4
|
+
&__placeholder {
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&__fixed {
|
|
9
|
+
position: fixed;
|
|
10
|
+
bottom: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
right: 0;
|
|
13
|
+
z-index: var(--layout-z-index);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&--bordered {
|
|
17
|
+
border-top: 1rpx solid var(--layout-border-color);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&--safe-area {
|
|
21
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<block wx:if="{{position === 'fixed'}}">
|
|
2
|
+
<view class="w-layout-footer__fixed">
|
|
3
|
+
<view
|
|
4
|
+
class="w-layout-footer {{bordered ? 'w-layout-footer--bordered' : ''}} {{safeArea ? 'w-layout-footer--safe-area' : ''}}"
|
|
5
|
+
>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</view>
|
|
8
|
+
</view>
|
|
9
|
+
<view class="w-layout-footer__placeholder" style="height: {{_placeholderHeight}}px"></view>
|
|
10
|
+
</block>
|
|
11
|
+
<view
|
|
12
|
+
wx:else
|
|
13
|
+
class="w-layout-footer {{bordered ? 'w-layout-footer--bordered' : ''}} {{safeArea ? 'w-layout-footer--safe-area' : ''}}"
|
|
14
|
+
>
|
|
15
|
+
<slot></slot>
|
|
16
|
+
</view>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
options: {
|
|
3
|
+
virtualHost: true,
|
|
4
|
+
},
|
|
5
|
+
|
|
6
|
+
properties: {
|
|
7
|
+
position: {
|
|
8
|
+
type: String,
|
|
9
|
+
value: 'fixed',
|
|
10
|
+
},
|
|
11
|
+
bordered: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
value: false,
|
|
14
|
+
},
|
|
15
|
+
safeArea: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
value: false,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
relations: {
|
|
22
|
+
'../layout/layout': {
|
|
23
|
+
type: 'ancestor',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
data: {
|
|
28
|
+
_placeholderHeight: 0,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
lifetimes: {
|
|
32
|
+
ready() {
|
|
33
|
+
if (this.data.position === 'fixed') {
|
|
34
|
+
this._measureHeight();
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
observers: {
|
|
40
|
+
'position, bordered, safeArea'() {
|
|
41
|
+
if (this.data.position === 'fixed') {
|
|
42
|
+
setTimeout(() => this._measureHeight(), 50);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
methods: {
|
|
48
|
+
_measureHeight() {
|
|
49
|
+
this.createSelectorQuery()
|
|
50
|
+
.select('.w-layout-header')
|
|
51
|
+
.boundingClientRect((rect) => {
|
|
52
|
+
if (rect) {
|
|
53
|
+
this.setData({ _placeholderHeight: rect.height });
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
.exec();
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.w-layout-header {
|
|
2
|
+
background: var(--layout-header-bg);
|
|
3
|
+
|
|
4
|
+
&__placeholder {
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&__fixed {
|
|
9
|
+
position: fixed;
|
|
10
|
+
top: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
right: 0;
|
|
13
|
+
z-index: var(--layout-z-index);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&--bordered {
|
|
17
|
+
border-bottom: 1rpx solid var(--layout-border-color);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&--safe-area {
|
|
21
|
+
padding-top: env(safe-area-inset-top);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<block wx:if="{{position === 'fixed'}}">
|
|
2
|
+
<view class="w-layout-header__placeholder" style="height: {{_placeholderHeight}}px"></view>
|
|
3
|
+
<view class="w-layout-header__fixed">
|
|
4
|
+
<view
|
|
5
|
+
class="w-layout-header {{bordered ? 'w-layout-header--bordered' : ''}} {{safeArea ? 'w-layout-header--safe-area' : ''}}"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</view>
|
|
9
|
+
</view>
|
|
10
|
+
</block>
|
|
11
|
+
<view
|
|
12
|
+
wx:else
|
|
13
|
+
class="w-layout-header {{bordered ? 'w-layout-header--bordered' : ''}} {{safeArea ? 'w-layout-header--safe-area' : ''}}"
|
|
14
|
+
>
|
|
15
|
+
<slot></slot>
|
|
16
|
+
</view>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
options: {
|
|
3
|
+
virtualHost: true,
|
|
4
|
+
},
|
|
5
|
+
|
|
6
|
+
properties: {
|
|
7
|
+
width: {
|
|
8
|
+
type: Number,
|
|
9
|
+
value: 160,
|
|
10
|
+
},
|
|
11
|
+
bordered: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
value: false,
|
|
14
|
+
},
|
|
15
|
+
scrollY: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
value: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
relations: {
|
|
22
|
+
'../layout/layout': {
|
|
23
|
+
type: 'ancestor',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
data: {
|
|
28
|
+
_style: '',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
observers: {
|
|
32
|
+
width(val) {
|
|
33
|
+
this.setData({ _style: `width: ${val}rpx` });
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
lifetimes: {
|
|
38
|
+
attached() {
|
|
39
|
+
this.setData({ _style: `width: ${this.data.width}rpx` });
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
methods: {
|
|
44
|
+
_onScroll(e) {
|
|
45
|
+
this.triggerEvent('scroll', e.detail);
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|