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.
Files changed (231) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +184 -0
  3. package/miniprogram_dist/behaviors/formField.js +35 -0
  4. package/miniprogram_dist/components/avatar/avatar.js +70 -0
  5. package/miniprogram_dist/components/avatar/avatar.json +4 -0
  6. package/miniprogram_dist/components/avatar/avatar.scss +68 -0
  7. package/miniprogram_dist/components/avatar/avatar.wxml +15 -0
  8. package/miniprogram_dist/components/avatar-group/avatar-group.js +45 -0
  9. package/miniprogram_dist/components/avatar-group/avatar-group.json +7 -0
  10. package/miniprogram_dist/components/avatar-group/avatar-group.scss +4 -0
  11. package/miniprogram_dist/components/avatar-group/avatar-group.wxml +3 -0
  12. package/miniprogram_dist/components/back-top/back-top.js +68 -0
  13. package/miniprogram_dist/components/back-top/back-top.json +4 -0
  14. package/miniprogram_dist/components/back-top/back-top.scss +43 -0
  15. package/miniprogram_dist/components/back-top/back-top.wxml +10 -0
  16. package/miniprogram_dist/components/badge/badge.js +100 -0
  17. package/miniprogram_dist/components/badge/badge.json +4 -0
  18. package/miniprogram_dist/components/badge/badge.scss +98 -0
  19. package/miniprogram_dist/components/badge/badge.wxml +11 -0
  20. package/miniprogram_dist/components/button/button.js +152 -0
  21. package/miniprogram_dist/components/button/button.json +4 -0
  22. package/miniprogram_dist/components/button/button.scss +499 -0
  23. package/miniprogram_dist/components/button/button.wxml +21 -0
  24. package/miniprogram_dist/components/button-group/button-group.js +51 -0
  25. package/miniprogram_dist/components/button-group/button-group.json +4 -0
  26. package/miniprogram_dist/components/button-group/button-group.scss +8 -0
  27. package/miniprogram_dist/components/button-group/button-group.wxml +3 -0
  28. package/miniprogram_dist/components/calendar/calendar.js +308 -0
  29. package/miniprogram_dist/components/calendar/calendar.json +4 -0
  30. package/miniprogram_dist/components/calendar/calendar.scss +141 -0
  31. package/miniprogram_dist/components/calendar/calendar.wxml +47 -0
  32. package/miniprogram_dist/components/card/card.js +44 -0
  33. package/miniprogram_dist/components/card/card.json +4 -0
  34. package/miniprogram_dist/components/card/card.scss +143 -0
  35. package/miniprogram_dist/components/card/card.wxml +31 -0
  36. package/miniprogram_dist/components/checkbox/checkbox.js +43 -0
  37. package/miniprogram_dist/components/checkbox/checkbox.json +4 -0
  38. package/miniprogram_dist/components/checkbox/checkbox.scss +77 -0
  39. package/miniprogram_dist/components/checkbox/checkbox.wxml +13 -0
  40. package/miniprogram_dist/components/checkbox-button/checkbox-button.js +43 -0
  41. package/miniprogram_dist/components/checkbox-button/checkbox-button.json +4 -0
  42. package/miniprogram_dist/components/checkbox-button/checkbox-button.scss +39 -0
  43. package/miniprogram_dist/components/checkbox-button/checkbox-button.wxml +8 -0
  44. package/miniprogram_dist/components/checkbox-group/checkbox-group.js +84 -0
  45. package/miniprogram_dist/components/checkbox-group/checkbox-group.json +4 -0
  46. package/miniprogram_dist/components/checkbox-group/checkbox-group.scss +9 -0
  47. package/miniprogram_dist/components/checkbox-group/checkbox-group.wxml +3 -0
  48. package/miniprogram_dist/components/color-picker/color-picker.js +348 -0
  49. package/miniprogram_dist/components/color-picker/color-picker.json +7 -0
  50. package/miniprogram_dist/components/color-picker/color-picker.scss +383 -0
  51. package/miniprogram_dist/components/color-picker/color-picker.wxml +232 -0
  52. package/miniprogram_dist/components/date-picker/date-picker.js +1289 -0
  53. package/miniprogram_dist/components/date-picker/date-picker.json +7 -0
  54. package/miniprogram_dist/components/date-picker/date-picker.scss +468 -0
  55. package/miniprogram_dist/components/date-picker/date-picker.wxml +214 -0
  56. package/miniprogram_dist/components/divider/divider.js +34 -0
  57. package/miniprogram_dist/components/divider/divider.json +4 -0
  58. package/miniprogram_dist/components/divider/divider.scss +75 -0
  59. package/miniprogram_dist/components/divider/divider.wxml +8 -0
  60. package/miniprogram_dist/components/drawer/drawer.js +104 -0
  61. package/miniprogram_dist/components/drawer/drawer.json +4 -0
  62. package/miniprogram_dist/components/drawer/drawer.scss +171 -0
  63. package/miniprogram_dist/components/drawer/drawer.wxml +22 -0
  64. package/miniprogram_dist/components/ellipsis/ellipsis.js +38 -0
  65. package/miniprogram_dist/components/ellipsis/ellipsis.json +4 -0
  66. package/miniprogram_dist/components/ellipsis/ellipsis.scss +22 -0
  67. package/miniprogram_dist/components/ellipsis/ellipsis.wxml +7 -0
  68. package/miniprogram_dist/components/flex/flex.js +81 -0
  69. package/miniprogram_dist/components/flex/flex.json +4 -0
  70. package/miniprogram_dist/components/flex/flex.scss +4 -0
  71. package/miniprogram_dist/components/flex/flex.wxml +3 -0
  72. package/miniprogram_dist/components/float-button/float-button.js +78 -0
  73. package/miniprogram_dist/components/float-button/float-button.json +4 -0
  74. package/miniprogram_dist/components/float-button/float-button.scss +54 -0
  75. package/miniprogram_dist/components/float-button/float-button.wxml +9 -0
  76. package/miniprogram_dist/components/form/form.js +142 -0
  77. package/miniprogram_dist/components/form/form.json +4 -0
  78. package/miniprogram_dist/components/form/form.scss +11 -0
  79. package/miniprogram_dist/components/form/form.wxml +3 -0
  80. package/miniprogram_dist/components/form/validator.js +220 -0
  81. package/miniprogram_dist/components/form-item/form-item.js +240 -0
  82. package/miniprogram_dist/components/form-item/form-item.json +4 -0
  83. package/miniprogram_dist/components/form-item/form-item.scss +59 -0
  84. package/miniprogram_dist/components/form-item/form-item.wxml +33 -0
  85. package/miniprogram_dist/components/gradient-text/gradient-text.js +54 -0
  86. package/miniprogram_dist/components/gradient-text/gradient-text.json +4 -0
  87. package/miniprogram_dist/components/gradient-text/gradient-text.scss +7 -0
  88. package/miniprogram_dist/components/gradient-text/gradient-text.wxml +1 -0
  89. package/miniprogram_dist/components/h/h.js +60 -0
  90. package/miniprogram_dist/components/h/h.json +4 -0
  91. package/miniprogram_dist/components/h/h.scss +53 -0
  92. package/miniprogram_dist/components/h/h.wxml +1 -0
  93. package/miniprogram_dist/components/highlight/highlight.js +77 -0
  94. package/miniprogram_dist/components/highlight/highlight.json +4 -0
  95. package/miniprogram_dist/components/highlight/highlight.scss +8 -0
  96. package/miniprogram_dist/components/highlight/highlight.wxml +12 -0
  97. package/miniprogram_dist/components/infinite-scroll/infinite-scroll.js +31 -0
  98. package/miniprogram_dist/components/infinite-scroll/infinite-scroll.json +4 -0
  99. package/miniprogram_dist/components/infinite-scroll/infinite-scroll.scss +31 -0
  100. package/miniprogram_dist/components/infinite-scroll/infinite-scroll.wxml +12 -0
  101. package/miniprogram_dist/components/input/input.js +59 -0
  102. package/miniprogram_dist/components/input/input.json +4 -0
  103. package/miniprogram_dist/components/input/input.scss +96 -0
  104. package/miniprogram_dist/components/input/input.wxml +34 -0
  105. package/miniprogram_dist/components/input-otp/input-otp.js +106 -0
  106. package/miniprogram_dist/components/input-otp/input-otp.json +4 -0
  107. package/miniprogram_dist/components/input-otp/input-otp.scss +122 -0
  108. package/miniprogram_dist/components/input-otp/input-otp.wxml +38 -0
  109. package/miniprogram_dist/components/layout/layout.js +50 -0
  110. package/miniprogram_dist/components/layout/layout.json +4 -0
  111. package/miniprogram_dist/components/layout/layout.scss +10 -0
  112. package/miniprogram_dist/components/layout/layout.wxml +3 -0
  113. package/miniprogram_dist/components/layout-content/layout-content.js +47 -0
  114. package/miniprogram_dist/components/layout-content/layout-content.json +4 -0
  115. package/miniprogram_dist/components/layout-content/layout-content.scss +5 -0
  116. package/miniprogram_dist/components/layout-content/layout-content.wxml +13 -0
  117. package/miniprogram_dist/components/layout-footer/layout-footer.js +59 -0
  118. package/miniprogram_dist/components/layout-footer/layout-footer.json +4 -0
  119. package/miniprogram_dist/components/layout-footer/layout-footer.scss +23 -0
  120. package/miniprogram_dist/components/layout-footer/layout-footer.wxml +16 -0
  121. package/miniprogram_dist/components/layout-header/layout-header.js +59 -0
  122. package/miniprogram_dist/components/layout-header/layout-header.json +4 -0
  123. package/miniprogram_dist/components/layout-header/layout-header.scss +23 -0
  124. package/miniprogram_dist/components/layout-header/layout-header.wxml +16 -0
  125. package/miniprogram_dist/components/layout-sider/layout-sider.js +48 -0
  126. package/miniprogram_dist/components/layout-sider/layout-sider.json +4 -0
  127. package/miniprogram_dist/components/layout-sider/layout-sider.scss +13 -0
  128. package/miniprogram_dist/components/layout-sider/layout-sider.wxml +5 -0
  129. package/miniprogram_dist/components/list/list.js +55 -0
  130. package/miniprogram_dist/components/list/list.json +4 -0
  131. package/miniprogram_dist/components/list/list.scss +51 -0
  132. package/miniprogram_dist/components/list/list.wxml +9 -0
  133. package/miniprogram_dist/components/list-item/list-item.js +24 -0
  134. package/miniprogram_dist/components/list-item/list-item.json +4 -0
  135. package/miniprogram_dist/components/list-item/list-item.scss +51 -0
  136. package/miniprogram_dist/components/list-item/list-item.wxml +14 -0
  137. package/miniprogram_dist/components/navigation-bar/navigation-bar.js +77 -0
  138. package/miniprogram_dist/components/navigation-bar/navigation-bar.json +4 -0
  139. package/miniprogram_dist/components/navigation-bar/navigation-bar.scss +63 -0
  140. package/miniprogram_dist/components/navigation-bar/navigation-bar.wxml +35 -0
  141. package/miniprogram_dist/components/number-animation/number-animation.js +124 -0
  142. package/miniprogram_dist/components/number-animation/number-animation.json +4 -0
  143. package/miniprogram_dist/components/number-animation/number-animation.scss +3 -0
  144. package/miniprogram_dist/components/number-animation/number-animation.wxml +1 -0
  145. package/miniprogram_dist/components/popover/popover.js +183 -0
  146. package/miniprogram_dist/components/popover/popover.json +4 -0
  147. package/miniprogram_dist/components/popover/popover.scss +69 -0
  148. package/miniprogram_dist/components/popover/popover.wxml +19 -0
  149. package/miniprogram_dist/components/qr-code/qr-code.js +216 -0
  150. package/miniprogram_dist/components/qr-code/qr-code.json +4 -0
  151. package/miniprogram_dist/components/qr-code/qr-code.scss +8 -0
  152. package/miniprogram_dist/components/qr-code/qr-code.wxml +16 -0
  153. package/miniprogram_dist/components/radio/radio.js +38 -0
  154. package/miniprogram_dist/components/radio/radio.json +4 -0
  155. package/miniprogram_dist/components/radio/radio.scss +50 -0
  156. package/miniprogram_dist/components/radio/radio.wxml +12 -0
  157. package/miniprogram_dist/components/radio-button/radio-button.js +39 -0
  158. package/miniprogram_dist/components/radio-button/radio-button.json +4 -0
  159. package/miniprogram_dist/components/radio-button/radio-button.scss +39 -0
  160. package/miniprogram_dist/components/radio-button/radio-button.wxml +8 -0
  161. package/miniprogram_dist/components/radio-group/radio-group.js +72 -0
  162. package/miniprogram_dist/components/radio-group/radio-group.json +4 -0
  163. package/miniprogram_dist/components/radio-group/radio-group.scss +9 -0
  164. package/miniprogram_dist/components/radio-group/radio-group.wxml +3 -0
  165. package/miniprogram_dist/components/rate/rate.js +90 -0
  166. package/miniprogram_dist/components/rate/rate.json +4 -0
  167. package/miniprogram_dist/components/rate/rate.scss +59 -0
  168. package/miniprogram_dist/components/rate/rate.wxml +16 -0
  169. package/miniprogram_dist/components/select/select.js +201 -0
  170. package/miniprogram_dist/components/select/select.json +7 -0
  171. package/miniprogram_dist/components/select/select.scss +235 -0
  172. package/miniprogram_dist/components/select/select.wxml +79 -0
  173. package/miniprogram_dist/components/stepper/stepper.js +113 -0
  174. package/miniprogram_dist/components/stepper/stepper.json +4 -0
  175. package/miniprogram_dist/components/stepper/stepper.scss +73 -0
  176. package/miniprogram_dist/components/stepper/stepper.wxml +23 -0
  177. package/miniprogram_dist/components/switch/switch.js +42 -0
  178. package/miniprogram_dist/components/switch/switch.json +4 -0
  179. package/miniprogram_dist/components/switch/switch.scss +77 -0
  180. package/miniprogram_dist/components/switch/switch.wxml +10 -0
  181. package/miniprogram_dist/components/tab-bar/tab-bar.js +53 -0
  182. package/miniprogram_dist/components/tab-bar/tab-bar.json +4 -0
  183. package/miniprogram_dist/components/tab-bar/tab-bar.scss +53 -0
  184. package/miniprogram_dist/components/tab-bar/tab-bar.wxml +12 -0
  185. package/miniprogram_dist/components/tag/tag.js +87 -0
  186. package/miniprogram_dist/components/tag/tag.json +4 -0
  187. package/miniprogram_dist/components/tag/tag.scss +138 -0
  188. package/miniprogram_dist/components/tag/tag.wxml +12 -0
  189. package/miniprogram_dist/components/textarea/textarea.js +46 -0
  190. package/miniprogram_dist/components/textarea/textarea.json +4 -0
  191. package/miniprogram_dist/components/textarea/textarea.scss +51 -0
  192. package/miniprogram_dist/components/textarea/textarea.wxml +20 -0
  193. package/miniprogram_dist/components/theme-provider/presets.js +101 -0
  194. package/miniprogram_dist/components/theme-provider/theme-provider.js +34 -0
  195. package/miniprogram_dist/components/theme-provider/theme-provider.json +4 -0
  196. package/miniprogram_dist/components/theme-provider/theme-provider.scss +3 -0
  197. package/miniprogram_dist/components/theme-provider/theme-provider.wxml +3 -0
  198. package/miniprogram_dist/components/time-picker/time-picker.js +136 -0
  199. package/miniprogram_dist/components/time-picker/time-picker.json +7 -0
  200. package/miniprogram_dist/components/time-picker/time-picker.scss +135 -0
  201. package/miniprogram_dist/components/time-picker/time-picker.wxml +47 -0
  202. package/miniprogram_dist/components/tooltip/tooltip.js +179 -0
  203. package/miniprogram_dist/components/tooltip/tooltip.json +4 -0
  204. package/miniprogram_dist/components/tooltip/tooltip.scss +66 -0
  205. package/miniprogram_dist/components/tooltip/tooltip.wxml +17 -0
  206. package/miniprogram_dist/components/tree/tree.js +647 -0
  207. package/miniprogram_dist/components/tree/tree.json +4 -0
  208. package/miniprogram_dist/components/tree/tree.scss +178 -0
  209. package/miniprogram_dist/components/tree/tree.wxml +59 -0
  210. package/miniprogram_dist/components/tree-select/tree-select.js +260 -0
  211. package/miniprogram_dist/components/tree-select/tree-select.json +8 -0
  212. package/miniprogram_dist/components/tree-select/tree-select.scss +250 -0
  213. package/miniprogram_dist/components/tree-select/tree-select.wxml +118 -0
  214. package/miniprogram_dist/components/upload/upload.js +387 -0
  215. package/miniprogram_dist/components/upload/upload.json +4 -0
  216. package/miniprogram_dist/components/upload/upload.scss +258 -0
  217. package/miniprogram_dist/components/upload/upload.wxml +142 -0
  218. package/miniprogram_dist/components/watermark/watermark.js +260 -0
  219. package/miniprogram_dist/components/watermark/watermark.json +4 -0
  220. package/miniprogram_dist/components/watermark/watermark.scss +35 -0
  221. package/miniprogram_dist/components/watermark/watermark.wxml +13 -0
  222. package/miniprogram_dist/libs/qrcodegen.js +714 -0
  223. package/miniprogram_dist/libs/seemly.min.js +547 -0
  224. package/miniprogram_dist/libs/tempo_1_0_0.js +1264 -0
  225. package/miniprogram_dist/libs/validator_13_56_26.min.js +5282 -0
  226. package/miniprogram_dist/styles/demo.scss +96 -0
  227. package/miniprogram_dist/styles/iconfont.scss +91 -0
  228. package/miniprogram_dist/styles/theme.scss +126 -0
  229. package/miniprogram_dist/styles/tokens.scss +292 -0
  230. package/miniprogram_dist/utils/relations.js +21 -0
  231. package/package.json +25 -0
@@ -0,0 +1,235 @@
1
+ @import '../../styles/iconfont.scss';
2
+
3
+ /* Trigger */
4
+ .w-select__trigger {
5
+ display: flex;
6
+ align-items: center;
7
+ min-height: var(--size-input-height);
8
+ padding: 0 var(--spacing-md);
9
+ background: var(--color-input-bg);
10
+ border: 2rpx solid var(--color-input-border);
11
+ border-radius: var(--radius-md);
12
+ box-sizing: border-box;
13
+ transition: border-color 0.2s;
14
+ gap: var(--spacing-xs);
15
+ }
16
+
17
+ .w-select--has-tags {
18
+ flex-wrap: wrap;
19
+ padding: var(--spacing-xs) var(--spacing-md) var(--spacing-xs) var(--spacing-xs);
20
+ }
21
+
22
+ .w-select--size-medium .w-select__trigger,
23
+ .w-select--size-medium.w-select__trigger {
24
+ min-height: var(--size-input-height-md);
25
+ }
26
+
27
+ .w-select--size-small .w-select__trigger,
28
+ .w-select--size-small.w-select__trigger {
29
+ min-height: var(--size-input-height-sm);
30
+ padding: 0 var(--spacing-sm);
31
+ font-size: var(--font-size-sm);
32
+ }
33
+
34
+ .w-select--disabled {
35
+ background: var(--color-input-bg-disabled);
36
+ opacity: 0.6;
37
+ }
38
+
39
+ .w-select--error {
40
+ border-color: var(--color-input-border-error);
41
+ }
42
+
43
+ .w-select--warning {
44
+ border-color: var(--color-input-border-warning);
45
+ }
46
+
47
+ .w-select__text {
48
+ flex: 1;
49
+ min-width: 0;
50
+ color: var(--color-text-primary);
51
+ font-size: inherit;
52
+ overflow: hidden;
53
+ text-overflow: ellipsis;
54
+ white-space: nowrap;
55
+ }
56
+
57
+ .w-select__placeholder {
58
+ flex: 1;
59
+ min-width: 0;
60
+ color: var(--color-text-placeholder);
61
+ font-size: inherit;
62
+ }
63
+
64
+ .w-select__icon {
65
+ flex-shrink: 0;
66
+ display: flex;
67
+ align-items: center;
68
+ }
69
+
70
+ .w-select__arrow-icon {
71
+ font-size: 28rpx;
72
+ color: var(--color-text-secondary);
73
+ line-height: 1;
74
+ }
75
+
76
+ .w-select__clear {
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+ width: 36rpx;
81
+ height: 36rpx;
82
+ flex-shrink: 0;
83
+ }
84
+
85
+ .w-select__clear-icon {
86
+ width: 28rpx;
87
+ height: 28rpx;
88
+ border-radius: 50%;
89
+ background: var(--color-text-placeholder);
90
+ display: flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+ font-size: 16rpx;
94
+ color: var(--color-bg-elevated);
95
+ line-height: 1;
96
+ }
97
+
98
+ /* Tags */
99
+ .w-select__tags {
100
+ display: flex;
101
+ flex-wrap: wrap;
102
+ flex: 1;
103
+ min-width: 0;
104
+ gap: var(--spacing-xs);
105
+ }
106
+
107
+ .w-select__tag {
108
+ display: inline-flex;
109
+ align-items: center;
110
+ height: var(--size-tag-height-sm);
111
+ padding: 0 var(--spacing-sm);
112
+ background: var(--color-bg-base);
113
+ border-radius: var(--radius-sm);
114
+ font-size: 22rpx;
115
+ color: var(--color-text-primary);
116
+ gap: 4rpx;
117
+ max-width: 240rpx;
118
+ }
119
+
120
+ .w-select__tag-text {
121
+ overflow: hidden;
122
+ text-overflow: ellipsis;
123
+ white-space: nowrap;
124
+ }
125
+
126
+ .w-select__tag-close {
127
+ display: flex;
128
+ align-items: center;
129
+ justify-content: center;
130
+ flex-shrink: 0;
131
+ width: 24rpx;
132
+ height: 24rpx;
133
+ }
134
+
135
+ .w-select__tag-close-icon {
136
+ width: 20rpx;
137
+ height: 20rpx;
138
+ border-radius: 50%;
139
+ background: var(--color-text-placeholder);
140
+ display: flex;
141
+ align-items: center;
142
+ justify-content: center;
143
+ font-size: 12rpx;
144
+ color: var(--color-bg-elevated);
145
+ line-height: 1;
146
+ }
147
+
148
+ /* Panel */
149
+ .w-select__panel {
150
+ background: var(--color-bg-elevated);
151
+ padding-bottom: env(safe-area-inset-bottom);
152
+ }
153
+
154
+ .w-select__header {
155
+ display: flex;
156
+ align-items: center;
157
+ justify-content: space-between;
158
+ padding: var(--spacing-md) var(--spacing-lg);
159
+ border-bottom: 1rpx solid var(--color-separator);
160
+ }
161
+
162
+ .w-select__btn {
163
+ font-size: var(--font-size-md);
164
+ color: var(--color-text-secondary);
165
+ min-width: 80rpx;
166
+ }
167
+
168
+ .w-select__btn--primary {
169
+ color: var(--color-brand);
170
+ font-weight: 500;
171
+ text-align: right;
172
+ }
173
+
174
+ .w-select__title {
175
+ font-size: var(--font-size-lg);
176
+ font-weight: 500;
177
+ color: var(--color-text-primary);
178
+ }
179
+
180
+ /* Picker (single) */
181
+ .w-select__picker {
182
+ width: 100%;
183
+ height: 528rpx;
184
+ }
185
+
186
+ .w-select__indicator {
187
+ height: 88rpx;
188
+ }
189
+
190
+ .w-select__item {
191
+ display: flex;
192
+ align-items: center;
193
+ justify-content: center;
194
+ height: 88rpx;
195
+ font-size: var(--font-size-xl);
196
+ color: var(--color-text-primary);
197
+ }
198
+
199
+ /* List (multiple) */
200
+ .w-select__list {
201
+ max-height: 528rpx;
202
+ }
203
+
204
+ .w-select__option {
205
+ display: flex;
206
+ align-items: center;
207
+ padding: var(--spacing-md) var(--spacing-lg);
208
+ gap: var(--spacing-md);
209
+ }
210
+
211
+ .w-select__option--active {
212
+ background: var(--color-press-overlay-light);
213
+ }
214
+
215
+ .w-select__dot {
216
+ width: 36rpx;
217
+ height: 36rpx;
218
+ border-radius: 50%;
219
+ border: 2rpx solid var(--color-text-placeholder);
220
+ box-sizing: border-box;
221
+ flex-shrink: 0;
222
+ transition:
223
+ background 0.2s,
224
+ border-color 0.2s;
225
+ }
226
+
227
+ .w-select__dot--selected {
228
+ background: var(--color-brand);
229
+ border-color: var(--color-brand);
230
+ }
231
+
232
+ .w-select__option-label {
233
+ font-size: var(--font-size-lg);
234
+ color: var(--color-text-primary);
235
+ }
@@ -0,0 +1,79 @@
1
+ <view class="w-select">
2
+ <view
3
+ class="w-select__trigger w-select--size-{{size || _formItemSize || 'medium'}} {{(disabled || _formItemDisabled) ? 'w-select--disabled' : ''}} {{readonly ? 'w-select--readonly' : ''}} {{status === 'error' ? 'w-select--error' : ''}} {{status === 'warning' ? 'w-select--warning' : ''}} {{multiple && _selectedTags.length ? 'w-select--has-tags' : ''}}"
4
+ bindtap="handleTap"
5
+ >
6
+ <!-- 多选:标签展示 -->
7
+ <view wx:if="{{multiple && _selectedTags.length}}" class="w-select__tags">
8
+ <view wx:for="{{_selectedTags}}" wx:key="value" class="w-select__tag">
9
+ <text class="w-select__tag-text">{{item.label}}</text>
10
+ <view
11
+ wx:if="{{!disabled && !_formItemDisabled && !readonly}}"
12
+ class="w-select__tag-close"
13
+ catchtap="handleTagRemove"
14
+ data-value="{{item.value}}"
15
+ >
16
+ <text class="w-select__tag-close-icon iconfont icon-close"></text>
17
+ </view>
18
+ </view>
19
+ </view>
20
+ <!-- 多选:占位符 -->
21
+ <text wx:elif="{{multiple}}" class="w-select__placeholder">{{placeholder}}</text>
22
+ <!-- 单选:文本展示 -->
23
+ <text wx:elif="{{_displayText}}" class="w-select__text">{{_displayText}}</text>
24
+ <text wx:else class="w-select__placeholder">{{placeholder}}</text>
25
+
26
+ <view
27
+ wx:if="{{clearable && (multiple ? _selectedTags.length : _displayText) && !disabled && !_formItemDisabled && !readonly}}"
28
+ class="w-select__clear"
29
+ catchtap="handleTriggerClear"
30
+ >
31
+ <text class="w-select__clear-icon iconfont icon-close"></text>
32
+ </view>
33
+ <view wx:else class="w-select__icon">
34
+ <text class="w-select__arrow-icon iconfont icon-down"></text>
35
+ </view>
36
+ </view>
37
+
38
+ <w-drawer show="{{_visible}}" placement="bottom" round bind:update:show="handleCancel">
39
+ <view class="w-select__panel">
40
+ <view class="w-select__header">
41
+ <view wx:if="{{clearable}}" class="w-select__btn" bindtap="handleClear">清除</view>
42
+ <view wx:else class="w-select__btn" bindtap="handleCancel">取消</view>
43
+ <view class="w-select__title">{{title || '请选择'}}</view>
44
+ <view class="w-select__btn w-select__btn--primary" bindtap="handleConfirm">确定</view>
45
+ </view>
46
+
47
+ <!-- 单选:滚轮 -->
48
+ <picker-view
49
+ wx:if="{{!multiple}}"
50
+ class="w-select__picker"
51
+ value="{{_pickerValue}}"
52
+ indicator-class="w-select__indicator"
53
+ bindchange="handlePickerChange"
54
+ >
55
+ <picker-view-column>
56
+ <view wx:for="{{options}}" wx:key="value" class="w-select__item">{{item.label}}</view>
57
+ </picker-view-column>
58
+ </picker-view>
59
+
60
+ <!-- 多选:勾选列表 -->
61
+ <scroll-view wx:else class="w-select__list" scroll-y>
62
+ <view
63
+ wx:for="{{options}}"
64
+ wx:key="value"
65
+ class="w-select__option"
66
+ hover-class="w-select__option--active"
67
+ hover-stay-time="70"
68
+ bindtap="handleOptionTap"
69
+ data-value="{{item.value}}"
70
+ >
71
+ <view
72
+ class="w-select__dot {{_selectedMap[item.value] ? 'w-select__dot--selected' : ''}}"
73
+ ></view>
74
+ <text class="w-select__option-label">{{item.label}}</text>
75
+ </view>
76
+ </scroll-view>
77
+ </view>
78
+ </w-drawer>
79
+ </view>
@@ -0,0 +1,113 @@
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: Number, value: 0 },
14
+ min: { type: Number, value: 0 },
15
+ max: { type: Number, value: Infinity },
16
+ step: { type: Number, value: 1 },
17
+ size: { type: String, value: '' },
18
+ disabled: { type: Boolean, value: false },
19
+ decimalLength: { type: Number, value: 0 },
20
+ },
21
+
22
+ data: {
23
+ _displayValue: '0',
24
+ _minusDisabled: false,
25
+ _plusDisabled: false,
26
+ _disabled: false,
27
+ },
28
+
29
+ observers: {
30
+ 'value, min, max, decimalLength': function (value, min, max, decimalLength) {
31
+ const clamped = Math.min(Math.max(value, min), max);
32
+ this.setData({
33
+ _displayValue: decimalLength > 0 ? clamped.toFixed(decimalLength) : String(clamped),
34
+ _minusDisabled: clamped <= min,
35
+ _plusDisabled: clamped >= max,
36
+ });
37
+ },
38
+ 'disabled, _formItemDisabled': function (disabled, formDisabled) {
39
+ this.setData({ _disabled: disabled || formDisabled });
40
+ },
41
+ },
42
+
43
+ methods: {
44
+ _add(offset) {
45
+ if (this._isDisabled()) return;
46
+ const { value, min, max, step, decimalLength } = this.data;
47
+ const factor = Math.pow(10, decimalLength);
48
+ const newVal = Math.round(value * factor + offset * step * factor) / factor;
49
+ const clamped = Math.min(Math.max(newVal, min), max);
50
+ if (clamped !== value) {
51
+ this.triggerEvent('update:value', { value: clamped });
52
+ this._notifyChange();
53
+ }
54
+ },
55
+
56
+ handleMinus() {
57
+ if (this.data._minusDisabled || this._isDisabled()) {
58
+ this.triggerEvent('overlimit', { type: 'minus' });
59
+ return;
60
+ }
61
+ this._add(-1);
62
+ },
63
+
64
+ handlePlus() {
65
+ if (this.data._plusDisabled || this._isDisabled()) {
66
+ this.triggerEvent('overlimit', { type: 'plus' });
67
+ return;
68
+ }
69
+ this._add(1);
70
+ },
71
+
72
+ _startLongPress(type) {
73
+ this._longPressTimer = setTimeout(() => {
74
+ this._longPressInterval = setInterval(() => {
75
+ if (type === 'minus') {
76
+ this.handleMinus();
77
+ } else {
78
+ this.handlePlus();
79
+ }
80
+ }, 100);
81
+ }, 350);
82
+ },
83
+
84
+ _stopLongPress() {
85
+ clearTimeout(this._longPressTimer);
86
+ clearInterval(this._longPressInterval);
87
+ this._longPressTimer = null;
88
+ this._longPressInterval = null;
89
+ },
90
+
91
+ onMinusTouchStart() {
92
+ this.handleMinus();
93
+ if (!this.data._minusDisabled && !this._isDisabled()) {
94
+ this._startLongPress('minus');
95
+ }
96
+ },
97
+
98
+ onPlusTouchStart() {
99
+ this.handlePlus();
100
+ if (!this.data._plusDisabled && !this._isDisabled()) {
101
+ this._startLongPress('plus');
102
+ }
103
+ },
104
+
105
+ onTouchEnd() {
106
+ this._stopLongPress();
107
+ },
108
+ },
109
+
110
+ detached() {
111
+ this._stopLongPress();
112
+ },
113
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "styleIsolation": "apply-shared"
4
+ }
@@ -0,0 +1,73 @@
1
+ @import '../../styles/iconfont.scss';
2
+
3
+ .w-stepper {
4
+ display: inline-flex;
5
+ align-items: center;
6
+ vertical-align: middle;
7
+ }
8
+
9
+ .w-stepper__minus,
10
+ .w-stepper__plus {
11
+ display: flex;
12
+ align-items: center;
13
+ justify-content: center;
14
+ width: var(--w-stepper-btn-width);
15
+ height: var(--w-stepper-height);
16
+ background: var(--w-stepper-bg);
17
+ font-size: var(--w-stepper-font-size);
18
+ color: var(--w-stepper-text);
19
+ transition: opacity 0.2s;
20
+
21
+ &:active {
22
+ opacity: 0.6;
23
+ }
24
+ }
25
+
26
+ .w-stepper__minus {
27
+ border-radius: var(--w-stepper-radius) 0 0 var(--w-stepper-radius);
28
+ }
29
+
30
+ .w-stepper__plus {
31
+ border-radius: 0 var(--w-stepper-radius) var(--w-stepper-radius) 0;
32
+ }
33
+
34
+ .w-stepper__minus--disabled,
35
+ .w-stepper__plus--disabled {
36
+ opacity: 0.3;
37
+
38
+ &:active {
39
+ opacity: 0.3;
40
+ }
41
+ }
42
+
43
+ .w-stepper__input {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ width: var(--w-stepper-input-width);
48
+ height: var(--w-stepper-height);
49
+ background: var(--w-stepper-bg);
50
+ font-size: var(--w-stepper-font-size);
51
+ color: var(--w-stepper-text);
52
+ margin: 0 2rpx;
53
+ }
54
+
55
+ /* Small size */
56
+ .w-stepper--size-small .w-stepper__minus,
57
+ .w-stepper--size-small .w-stepper__plus {
58
+ width: var(--w-stepper-btn-width-sm);
59
+ height: var(--w-stepper-height-sm);
60
+ font-size: var(--w-stepper-font-size-sm);
61
+ }
62
+
63
+ .w-stepper--size-small .w-stepper__input {
64
+ width: var(--w-stepper-input-width-sm);
65
+ height: var(--w-stepper-height-sm);
66
+ font-size: var(--w-stepper-font-size-sm);
67
+ }
68
+
69
+ /* Disabled */
70
+ .w-stepper--disabled {
71
+ opacity: 0.4;
72
+ pointer-events: none;
73
+ }
@@ -0,0 +1,23 @@
1
+ <view
2
+ class="w-stepper w-stepper--size-{{size || _formItemSize || 'medium'}} {{_disabled ? 'w-stepper--disabled' : ''}}"
3
+ >
4
+ <view
5
+ class="w-stepper__minus {{(_minusDisabled || _disabled) ? 'w-stepper__minus--disabled' : ''}}"
6
+ bindtouchstart="onMinusTouchStart"
7
+ bindtouchend="onTouchEnd"
8
+ bindtouchcancel="onTouchEnd"
9
+ >
10
+ <view class="iconfont icon-minus"></view>
11
+ </view>
12
+ <view class="w-stepper__input">
13
+ <text>{{_displayValue}}</text>
14
+ </view>
15
+ <view
16
+ class="w-stepper__plus {{(_plusDisabled || _disabled) ? 'w-stepper__plus--disabled' : ''}}"
17
+ bindtouchstart="onPlusTouchStart"
18
+ bindtouchend="onTouchEnd"
19
+ bindtouchcancel="onTouchEnd"
20
+ >
21
+ <view class="iconfont icon-plus"></view>
22
+ </view>
23
+ </view>
@@ -0,0 +1,42 @@
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
+ checked: { type: Boolean, value: false },
14
+ disabled: { type: Boolean, value: false },
15
+ size: { type: String, value: '' },
16
+ checkedColor: { type: String, value: '' },
17
+ checkedText: { type: String, value: '' },
18
+ uncheckedText: { type: String, value: '' },
19
+ },
20
+
21
+ data: {
22
+ _trackStyle: '',
23
+ },
24
+
25
+ observers: {
26
+ 'checked, checkedColor'(checked, checkedColor) {
27
+ let style = '';
28
+ if (checked && checkedColor) {
29
+ style = `background-color: ${checkedColor};`;
30
+ }
31
+ this.setData({ _trackStyle: style });
32
+ },
33
+ },
34
+
35
+ methods: {
36
+ handleTap() {
37
+ if (this._isDisabled()) return;
38
+ this.triggerEvent('update:checked', { checked: !this.data.checked });
39
+ this._notifyChange();
40
+ },
41
+ },
42
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": true,
3
+ "styleIsolation": "apply-shared"
4
+ }
@@ -0,0 +1,77 @@
1
+ .w-switch {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ vertical-align: middle;
5
+ }
6
+
7
+ .w-switch__track {
8
+ position: relative;
9
+ display: flex;
10
+ align-items: center;
11
+ width: var(--w-switch-width);
12
+ height: var(--w-switch-height);
13
+ border-radius: calc(var(--w-switch-height) / 2);
14
+ background: var(--w-switch-bg);
15
+ transition: background-color 0.2s;
16
+ box-sizing: border-box;
17
+ padding: 0 8rpx;
18
+ }
19
+
20
+ .w-switch--size-small .w-switch__track {
21
+ width: var(--w-switch-width-sm);
22
+ height: var(--w-switch-height-sm);
23
+ padding: 0 6rpx;
24
+ }
25
+
26
+ .w-switch__thumb {
27
+ position: absolute;
28
+ top: 4rpx;
29
+ left: 4rpx;
30
+ width: calc(var(--w-switch-height) - 8rpx);
31
+ height: calc(var(--w-switch-height) - 8rpx);
32
+ border-radius: 50%;
33
+ background: #ffffff;
34
+ transition: transform 0.2s;
35
+ box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2);
36
+ }
37
+
38
+ .w-switch--size-small .w-switch__thumb {
39
+ width: calc(var(--w-switch-height-sm) - 8rpx);
40
+ height: calc(var(--w-switch-height-sm) - 8rpx);
41
+ }
42
+
43
+ .w-switch--checked .w-switch__track {
44
+ background: var(--w-switch-checked-bg);
45
+ }
46
+
47
+ .w-switch--checked .w-switch__thumb {
48
+ transform: translateX(calc(var(--w-switch-width) - var(--w-switch-height)));
49
+ }
50
+
51
+ .w-switch--size-small.w-switch--checked .w-switch__thumb {
52
+ transform: translateX(calc(var(--w-switch-width-sm) - var(--w-switch-height-sm)));
53
+ }
54
+
55
+ .w-switch--disabled {
56
+ opacity: 0.4;
57
+ pointer-events: none;
58
+ }
59
+
60
+ .w-switch__text {
61
+ font-size: 20rpx;
62
+ color: #ffffff;
63
+ position: relative;
64
+ z-index: 1;
65
+ white-space: nowrap;
66
+ }
67
+
68
+ .w-switch--checked .w-switch__text {
69
+ margin-right: auto;
70
+ margin-left: 4rpx;
71
+ }
72
+
73
+ .w-switch:not(.w-switch--checked) .w-switch__text {
74
+ margin-left: auto;
75
+ margin-right: 4rpx;
76
+ color: var(--color-text-secondary);
77
+ }
@@ -0,0 +1,10 @@
1
+ <view
2
+ class="w-switch w-switch--size-{{size || _formItemSize || 'medium'}} {{checked ? 'w-switch--checked' : ''}} {{(disabled || _formItemDisabled) ? 'w-switch--disabled' : ''}}"
3
+ bindtap="handleTap"
4
+ >
5
+ <view class="w-switch__track" style="{{_trackStyle}}">
6
+ <view class="w-switch__text" wx:if="{{checked && checkedText}}">{{checkedText}}</view>
7
+ <view class="w-switch__text" wx:elif="{{!checked && uncheckedText}}">{{uncheckedText}}</view>
8
+ <view class="w-switch__thumb"></view>
9
+ </view>
10
+ </view>