@tplc/wot 0.0.1

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 (328) hide show
  1. package/components/common/AbortablePromise.ts +36 -0
  2. package/components/common/abstracts/_config.scss +7 -0
  3. package/components/common/abstracts/_function.scss +76 -0
  4. package/components/common/abstracts/_mixin.scss +339 -0
  5. package/components/common/abstracts/variable.scss +1346 -0
  6. package/components/common/base64.ts +30 -0
  7. package/components/common/canvasHelper.ts +49 -0
  8. package/components/common/clickoutside.ts +34 -0
  9. package/components/common/dayjs.ts +157 -0
  10. package/components/common/event.ts +8 -0
  11. package/components/common/props.ts +51 -0
  12. package/components/common/util.ts +751 -0
  13. package/components/composables/useCell.ts +13 -0
  14. package/components/composables/useChildren.ts +122 -0
  15. package/components/composables/useCountDown.ts +138 -0
  16. package/components/composables/useLockScroll.ts +39 -0
  17. package/components/composables/useParent.ts +41 -0
  18. package/components/composables/usePopover.ts +193 -0
  19. package/components/composables/useQueue.ts +52 -0
  20. package/components/composables/useRaf.ts +37 -0
  21. package/components/composables/useTouch.ts +44 -0
  22. package/components/composables/useTranslate.ts +22 -0
  23. package/components/wd-action-sheet/index.scss +204 -0
  24. package/components/wd-action-sheet/types.ts +128 -0
  25. package/components/wd-action-sheet/wd-action-sheet.vue +174 -0
  26. package/components/wd-backtop/index.scss +25 -0
  27. package/components/wd-backtop/types.ts +37 -0
  28. package/components/wd-backtop/wd-backtop.vue +48 -0
  29. package/components/wd-badge/index.scss +59 -0
  30. package/components/wd-badge/types.ts +53 -0
  31. package/components/wd-badge/wd-badge.vue +69 -0
  32. package/components/wd-button/index.scss +340 -0
  33. package/components/wd-button/types.ts +112 -0
  34. package/components/wd-button/wd-button.vue +176 -0
  35. package/components/wd-calendar/index.scss +244 -0
  36. package/components/wd-calendar/types.ts +235 -0
  37. package/components/wd-calendar/wd-calendar.vue +456 -0
  38. package/components/wd-calendar-view/index.scss +9 -0
  39. package/components/wd-calendar-view/month/index.scss +151 -0
  40. package/components/wd-calendar-view/month/month.vue +391 -0
  41. package/components/wd-calendar-view/month/types.ts +19 -0
  42. package/components/wd-calendar-view/monthPanel/index.scss +89 -0
  43. package/components/wd-calendar-view/monthPanel/month-panel.vue +388 -0
  44. package/components/wd-calendar-view/monthPanel/types.ts +48 -0
  45. package/components/wd-calendar-view/types.ts +134 -0
  46. package/components/wd-calendar-view/utils.ts +451 -0
  47. package/components/wd-calendar-view/wd-calendar-view.vue +111 -0
  48. package/components/wd-calendar-view/year/index.scss +148 -0
  49. package/components/wd-calendar-view/year/types.ts +19 -0
  50. package/components/wd-calendar-view/year/year.vue +220 -0
  51. package/components/wd-calendar-view/yearPanel/index.scss +24 -0
  52. package/components/wd-calendar-view/yearPanel/types.ts +38 -0
  53. package/components/wd-calendar-view/yearPanel/year-panel.vue +140 -0
  54. package/components/wd-card/index.scss +70 -0
  55. package/components/wd-card/types.ts +30 -0
  56. package/components/wd-card/wd-card.vue +40 -0
  57. package/components/wd-cell/index.scss +189 -0
  58. package/components/wd-cell/types.ts +96 -0
  59. package/components/wd-cell/wd-cell.vue +135 -0
  60. package/components/wd-cell-group/index.scss +55 -0
  61. package/components/wd-cell-group/types.ts +41 -0
  62. package/components/wd-cell-group/wd-cell-group.vue +45 -0
  63. package/components/wd-checkbox/index.scss +285 -0
  64. package/components/wd-checkbox/types.ts +68 -0
  65. package/components/wd-checkbox/wd-checkbox.vue +185 -0
  66. package/components/wd-checkbox-group/index.scss +20 -0
  67. package/components/wd-checkbox-group/types.ts +59 -0
  68. package/components/wd-checkbox-group/wd-checkbox-group.vue +103 -0
  69. package/components/wd-circle/index.scss +18 -0
  70. package/components/wd-circle/types.ts +54 -0
  71. package/components/wd-circle/wd-circle.vue +318 -0
  72. package/components/wd-col/index.scss +19 -0
  73. package/components/wd-col/types.ts +15 -0
  74. package/components/wd-col/wd-col.vue +91 -0
  75. package/components/wd-col-picker/index.scss +241 -0
  76. package/components/wd-col-picker/types.ts +170 -0
  77. package/components/wd-col-picker/wd-col-picker.vue +550 -0
  78. package/components/wd-collapse/index.scss +55 -0
  79. package/components/wd-collapse/types.ts +63 -0
  80. package/components/wd-collapse/wd-collapse.vue +160 -0
  81. package/components/wd-collapse-item/index.scss +79 -0
  82. package/components/wd-collapse-item/types.ts +36 -0
  83. package/components/wd-collapse-item/wd-collapse-item.vue +182 -0
  84. package/components/wd-config-provider/types.ts +1023 -0
  85. package/components/wd-config-provider/wd-config-provider.vue +82 -0
  86. package/components/wd-count-down/index.scss +14 -0
  87. package/components/wd-count-down/types.ts +41 -0
  88. package/components/wd-count-down/utils.ts +52 -0
  89. package/components/wd-count-down/wd-count-down.vue +60 -0
  90. package/components/wd-count-to/index.scss +6 -0
  91. package/components/wd-count-to/types.ts +110 -0
  92. package/components/wd-count-to/wd-count-to.vue +134 -0
  93. package/components/wd-curtain/index.scss +80 -0
  94. package/components/wd-curtain/types.ts +45 -0
  95. package/components/wd-curtain/wd-curtain.vue +174 -0
  96. package/components/wd-datetime-picker/index.scss +243 -0
  97. package/components/wd-datetime-picker/types.ts +225 -0
  98. package/components/wd-datetime-picker/wd-datetime-picker.vue +827 -0
  99. package/components/wd-datetime-picker-view/index.scss +0 -0
  100. package/components/wd-datetime-picker-view/types.ts +137 -0
  101. package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +514 -0
  102. package/components/wd-divider/index.scss +32 -0
  103. package/components/wd-divider/types.ts +12 -0
  104. package/components/wd-divider/wd-divider.vue +29 -0
  105. package/components/wd-drop-menu/index.scss +89 -0
  106. package/components/wd-drop-menu/types.ts +38 -0
  107. package/components/wd-drop-menu/wd-drop-menu.vue +128 -0
  108. package/components/wd-drop-menu-item/index.scss +66 -0
  109. package/components/wd-drop-menu-item/types.ts +78 -0
  110. package/components/wd-drop-menu-item/wd-drop-menu-item.vue +230 -0
  111. package/components/wd-fab/index.scss +115 -0
  112. package/components/wd-fab/types.ts +61 -0
  113. package/components/wd-fab/wd-fab.vue +257 -0
  114. package/components/wd-form/index.scss +10 -0
  115. package/components/wd-form/types.ts +93 -0
  116. package/components/wd-form/wd-form.vue +185 -0
  117. package/components/wd-form-item/index.scss +17 -0
  118. package/components/wd-form-item/types.ts +22 -0
  119. package/components/wd-form-item/wd-form-item.vue +65 -0
  120. package/components/wd-gap/index.scss +9 -0
  121. package/components/wd-gap/types.ts +23 -0
  122. package/components/wd-gap/wd-gap.vue +39 -0
  123. package/components/wd-grid/index.scss +9 -0
  124. package/components/wd-grid/types.ts +54 -0
  125. package/components/wd-grid/wd-grid.vue +107 -0
  126. package/components/wd-grid-item/index.scss +137 -0
  127. package/components/wd-grid-item/types.ts +74 -0
  128. package/components/wd-grid-item/wd-grid-item.vue +181 -0
  129. package/components/wd-icon/index.scss +1222 -0
  130. package/components/wd-icon/types.ts +21 -0
  131. package/components/wd-icon/wd-icon.vue +53 -0
  132. package/components/wd-icon/wd-icons.ttf +0 -0
  133. package/components/wd-img/index.scss +19 -0
  134. package/components/wd-img/types.ts +53 -0
  135. package/components/wd-img/wd-img.vue +76 -0
  136. package/components/wd-img-cropper/index.scss +227 -0
  137. package/components/wd-img-cropper/types.ts +87 -0
  138. package/components/wd-img-cropper/wd-img-cropper.vue +659 -0
  139. package/components/wd-index-anchor/index.scss +34 -0
  140. package/components/wd-index-anchor/type.ts +9 -0
  141. package/components/wd-index-anchor/wd-index-anchor.vue +57 -0
  142. package/components/wd-index-bar/index.scss +39 -0
  143. package/components/wd-index-bar/type.ts +28 -0
  144. package/components/wd-index-bar/wd-index-bar.vue +158 -0
  145. package/components/wd-input/index.scss +326 -0
  146. package/components/wd-input/types.ts +182 -0
  147. package/components/wd-input/wd-input.vue +327 -0
  148. package/components/wd-input-number/index.scss +132 -0
  149. package/components/wd-input-number/types.ts +78 -0
  150. package/components/wd-input-number/wd-input-number.vue +221 -0
  151. package/components/wd-loading/index.scss +34 -0
  152. package/components/wd-loading/types.ts +31 -0
  153. package/components/wd-loading/wd-loading.vue +90 -0
  154. package/components/wd-loadmore/index.scss +39 -0
  155. package/components/wd-loadmore/types.ts +24 -0
  156. package/components/wd-loadmore/wd-loadmore.vue +53 -0
  157. package/components/wd-message-box/index.scss +121 -0
  158. package/components/wd-message-box/index.ts +95 -0
  159. package/components/wd-message-box/types.ts +116 -0
  160. package/components/wd-message-box/wd-message-box.vue +326 -0
  161. package/components/wd-navbar/index.scss +103 -0
  162. package/components/wd-navbar/types.ts +52 -0
  163. package/components/wd-navbar/wd-navbar.vue +142 -0
  164. package/components/wd-navbar-capsule/index.scss +65 -0
  165. package/components/wd-navbar-capsule/types.ts +0 -0
  166. package/components/wd-navbar-capsule/wd-navbar-capsule.vue +31 -0
  167. package/components/wd-notice-bar/index.scss +86 -0
  168. package/components/wd-notice-bar/types.ts +56 -0
  169. package/components/wd-notice-bar/wd-notice-bar.vue +223 -0
  170. package/components/wd-notify/index.scss +34 -0
  171. package/components/wd-notify/index.ts +59 -0
  172. package/components/wd-notify/types.ts +62 -0
  173. package/components/wd-notify/wd-notify.vue +83 -0
  174. package/components/wd-number-keyboard/index.scss +78 -0
  175. package/components/wd-number-keyboard/key/index.scss +79 -0
  176. package/components/wd-number-keyboard/key/index.vue +76 -0
  177. package/components/wd-number-keyboard/key/types.ts +11 -0
  178. package/components/wd-number-keyboard/types.ts +79 -0
  179. package/components/wd-number-keyboard/wd-number-keyboard.vue +173 -0
  180. package/components/wd-overlay/index.scss +17 -0
  181. package/components/wd-overlay/types.ts +25 -0
  182. package/components/wd-overlay/wd-overlay.vue +46 -0
  183. package/components/wd-pagination/index.scss +57 -0
  184. package/components/wd-pagination/types.ts +41 -0
  185. package/components/wd-pagination/wd-pagination.vue +121 -0
  186. package/components/wd-password-input/index.scss +123 -0
  187. package/components/wd-password-input/types.ts +48 -0
  188. package/components/wd-password-input/wd-password-input.vue +58 -0
  189. package/components/wd-picker/index.scss +216 -0
  190. package/components/wd-picker/types.ts +186 -0
  191. package/components/wd-picker/wd-picker.vue +409 -0
  192. package/components/wd-picker-view/index.scss +91 -0
  193. package/components/wd-picker-view/types.ts +162 -0
  194. package/components/wd-picker-view/wd-picker-view.vue +361 -0
  195. package/components/wd-popover/index.scss +123 -0
  196. package/components/wd-popover/types.ts +69 -0
  197. package/components/wd-popover/wd-popover.vue +216 -0
  198. package/components/wd-popup/index.scss +112 -0
  199. package/components/wd-popup/types.ts +68 -0
  200. package/components/wd-popup/wd-popup.vue +227 -0
  201. package/components/wd-progress/index.scss +62 -0
  202. package/components/wd-progress/types.ts +40 -0
  203. package/components/wd-progress/wd-progress.vue +201 -0
  204. package/components/wd-radio/index.scss +300 -0
  205. package/components/wd-radio/types.ts +42 -0
  206. package/components/wd-radio/wd-radio.vue +136 -0
  207. package/components/wd-radio-group/index.scss +23 -0
  208. package/components/wd-radio-group/types.ts +36 -0
  209. package/components/wd-radio-group/wd-radio-group.vue +54 -0
  210. package/components/wd-rate/index.scss +24 -0
  211. package/components/wd-rate/types.ts +91 -0
  212. package/components/wd-rate/wd-rate.vue +131 -0
  213. package/components/wd-resize/index.scss +26 -0
  214. package/components/wd-resize/types.ts +6 -0
  215. package/components/wd-resize/wd-resize.vue +155 -0
  216. package/components/wd-row/index.scss +10 -0
  217. package/components/wd-row/types.ts +16 -0
  218. package/components/wd-row/wd-row.vue +63 -0
  219. package/components/wd-search/index.scss +148 -0
  220. package/components/wd-search/types.ts +83 -0
  221. package/components/wd-search/wd-search.vue +237 -0
  222. package/components/wd-segmented/index.scss +97 -0
  223. package/components/wd-segmented/types.ts +68 -0
  224. package/components/wd-segmented/wd-segmented.vue +143 -0
  225. package/components/wd-select-picker/index.scss +177 -0
  226. package/components/wd-select-picker/types.ts +116 -0
  227. package/components/wd-select-picker/wd-select-picker.vue +486 -0
  228. package/components/wd-sidebar/index.scss +25 -0
  229. package/components/wd-sidebar/types.ts +28 -0
  230. package/components/wd-sidebar/wd-sidebar.vue +41 -0
  231. package/components/wd-sidebar-item/index.scss +93 -0
  232. package/components/wd-sidebar-item/types.ts +31 -0
  233. package/components/wd-sidebar-item/wd-sidebar-item.vue +114 -0
  234. package/components/wd-skeleton/index.scss +101 -0
  235. package/components/wd-skeleton/index.ts +1 -0
  236. package/components/wd-skeleton/types.ts +69 -0
  237. package/components/wd-skeleton/wd-skeleton.vue +135 -0
  238. package/components/wd-slider/index.scss +91 -0
  239. package/components/wd-slider/types.ts +104 -0
  240. package/components/wd-slider/wd-slider.vue +377 -0
  241. package/components/wd-sort-button/index.scss +86 -0
  242. package/components/wd-sort-button/types.ts +43 -0
  243. package/components/wd-sort-button/wd-sort-button.vue +76 -0
  244. package/components/wd-status-tip/index.scss +37 -0
  245. package/components/wd-status-tip/types.ts +59 -0
  246. package/components/wd-status-tip/wd-status-tip.vue +94 -0
  247. package/components/wd-step/index.scss +236 -0
  248. package/components/wd-step/types.ts +33 -0
  249. package/components/wd-step/wd-step.vue +151 -0
  250. package/components/wd-steps/index.scss +10 -0
  251. package/components/wd-steps/types.ts +59 -0
  252. package/components/wd-steps/wd-steps.vue +37 -0
  253. package/components/wd-sticky/index.scss +9 -0
  254. package/components/wd-sticky/types.ts +13 -0
  255. package/components/wd-sticky/wd-sticky.vue +190 -0
  256. package/components/wd-sticky-box/index.scss +6 -0
  257. package/components/wd-sticky-box/types.ts +20 -0
  258. package/components/wd-sticky-box/wd-sticky-box.vue +154 -0
  259. package/components/wd-swipe-action/index.scss +22 -0
  260. package/components/wd-swipe-action/types.ts +43 -0
  261. package/components/wd-swipe-action/wd-swipe-action.vue +307 -0
  262. package/components/wd-swiper/index.scss +23 -0
  263. package/components/wd-swiper/types.ts +189 -0
  264. package/components/wd-swiper/wd-swiper.vue +202 -0
  265. package/components/wd-swiper-nav/index.scss +153 -0
  266. package/components/wd-swiper-nav/types.ts +42 -0
  267. package/components/wd-swiper-nav/wd-swiper-nav.vue +37 -0
  268. package/components/wd-switch/index.scss +58 -0
  269. package/components/wd-switch/types.ts +56 -0
  270. package/components/wd-switch/wd-switch.vue +83 -0
  271. package/components/wd-tab/index.scss +8 -0
  272. package/components/wd-tab/types.ts +20 -0
  273. package/components/wd-tab/wd-tab.vue +100 -0
  274. package/components/wd-tabbar/index.scss +57 -0
  275. package/components/wd-tabbar/types.ts +88 -0
  276. package/components/wd-tabbar/wd-tabbar.vue +104 -0
  277. package/components/wd-tabbar-item/index.scss +52 -0
  278. package/components/wd-tabbar-item/types.ts +51 -0
  279. package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
  280. package/components/wd-table/index.scss +132 -0
  281. package/components/wd-table/types.ts +69 -0
  282. package/components/wd-table/wd-table.vue +255 -0
  283. package/components/wd-table-col/index.scss +44 -0
  284. package/components/wd-table-col/types.ts +54 -0
  285. package/components/wd-table-col/wd-table-col.vue +149 -0
  286. package/components/wd-tabs/index.scss +280 -0
  287. package/components/wd-tabs/types.ts +71 -0
  288. package/components/wd-tabs/wd-tabs.vue +528 -0
  289. package/components/wd-tag/index.scss +115 -0
  290. package/components/wd-tag/types.ts +81 -0
  291. package/components/wd-tag/wd-tag.vue +154 -0
  292. package/components/wd-text/index.scss +34 -0
  293. package/components/wd-text/types.ts +98 -0
  294. package/components/wd-text/wd-text.vue +138 -0
  295. package/components/wd-textarea/index.scss +343 -0
  296. package/components/wd-textarea/types.ts +298 -0
  297. package/components/wd-textarea/wd-textarea.vue +303 -0
  298. package/components/wd-toast/index.scss +66 -0
  299. package/components/wd-toast/index.ts +109 -0
  300. package/components/wd-toast/types.ts +76 -0
  301. package/components/wd-toast/wd-toast.vue +212 -0
  302. package/components/wd-tooltip/index.scss +61 -0
  303. package/components/wd-tooltip/types.ts +102 -0
  304. package/components/wd-tooltip/wd-tooltip.vue +167 -0
  305. package/components/wd-transition/index.scss +91 -0
  306. package/components/wd-transition/types.ts +89 -0
  307. package/components/wd-transition/wd-transition.vue +221 -0
  308. package/components/wd-upload/index.scss +173 -0
  309. package/components/wd-upload/types.ts +378 -0
  310. package/components/wd-upload/utils.ts +152 -0
  311. package/components/wd-upload/wd-upload.vue +737 -0
  312. package/components/wd-video-preview/index.scss +34 -0
  313. package/components/wd-video-preview/types.ts +32 -0
  314. package/components/wd-video-preview/wd-video-preview.vue +76 -0
  315. package/components/wd-watermark/index.scss +18 -0
  316. package/components/wd-watermark/types.ts +82 -0
  317. package/components/wd-watermark/wd-watermark.vue +592 -0
  318. package/components/wot-design-uni/wot-design-uni.vue +14 -0
  319. package/global.d.ts +108 -0
  320. package/index.ts +30 -0
  321. package/locale/index.ts +41 -0
  322. package/locale/lang/en-US.ts +128 -0
  323. package/locale/lang/th-TH.ts +127 -0
  324. package/locale/lang/vi-VN.ts +89 -0
  325. package/locale/lang/zh-CN.ts +127 -0
  326. package/locale/lang/zh-HK.ts +84 -0
  327. package/locale/lang/zh-TW.ts +84 -0
  328. package/package.json +20 -0
@@ -0,0 +1,204 @@
1
+ @import '../common/abstracts/variable';
2
+ @import '../common/abstracts/mixin';
3
+
4
+ .wot-theme-dark {
5
+ @include b(action-sheet) {
6
+ color: $-dark-color;
7
+ background-color: $-dark-background2;
8
+
9
+ @include e(action) {
10
+ color: $-dark-color;
11
+ background: $-dark-background2;
12
+
13
+ &:not(.wd-action-sheet__action--disabled):not(.wd-action-sheet__action--loading):active {
14
+ background: $-dark-background4;
15
+ }
16
+
17
+ @include m(disabled) {
18
+ color: $-dark-color-gray;
19
+ }
20
+ }
21
+
22
+ @include e(subname) {
23
+ color: $-dark-color3;
24
+ }
25
+
26
+ @include e(cancel) {
27
+ color: $-dark-color;
28
+ background: $-dark-background4;
29
+
30
+ &:active {
31
+ background: $-dark-background5;
32
+ }
33
+ }
34
+
35
+ :deep(.wd-action-sheet__close) {
36
+ color: $-dark-color3;
37
+ }
38
+
39
+ @include e(panel-title) {
40
+ color: $-dark-color;
41
+ }
42
+
43
+ @include e(header) {
44
+ color: $-dark-color;
45
+ }
46
+ }
47
+ }
48
+
49
+ :deep(.wd-action-sheet__popup) {
50
+ border-radius: $-action-sheet-radius $-action-sheet-radius 0 0;
51
+ }
52
+
53
+ @include b(action-sheet) {
54
+ padding-bottom: 1px;
55
+ background-color: $-color-white;
56
+
57
+ @include edeep(popup) {
58
+ border-radius: $-action-sheet-radius $-action-sheet-radius 0 0;
59
+ }
60
+
61
+ @include e(actions) {
62
+ max-height: 50vh;
63
+ padding: 8px 0;
64
+ overflow-y: auto;
65
+ -webkit-overflow-scrolling: touch;
66
+ }
67
+
68
+ @include e(action) {
69
+ position: relative;
70
+ display: block;
71
+ width: 100%;
72
+ height: $-action-sheet-action-height;
73
+ font-size: $-action-sheet-fs;
74
+ line-height: $-action-sheet-action-height;
75
+ color: $-action-sheet-color;
76
+ text-align: center;
77
+ background: $-action-sheet-bg;
78
+ border: none;
79
+ outline: none;
80
+
81
+ &:after {
82
+ display: none;
83
+ }
84
+
85
+ &:not(&--disabled):not(&--loading):active {
86
+ background: $-action-sheet-active-color;
87
+ }
88
+
89
+ @include m(disabled) {
90
+ color: $-action-sheet-disabled-color;
91
+ cursor: not-allowed;
92
+ }
93
+
94
+ @include m(loading) {
95
+ display: flex;
96
+ align-items: center;
97
+ justify-content: center;
98
+ line-height: initial;
99
+ }
100
+ }
101
+
102
+ @include edeep(action-loading) {
103
+ width: $-action-sheet-loading-size;
104
+ height: $-action-sheet-loading-size;
105
+ }
106
+
107
+ @include e(name) {
108
+ display: inline-block;
109
+ }
110
+
111
+ @include e(subname) {
112
+ display: inline-block;
113
+ margin-left: 4px;
114
+ font-size: $-action-sheet-subname-fs;
115
+ color: $-action-sheet-subname-color;
116
+ }
117
+
118
+ @include e(cancel) {
119
+ display: block;
120
+ width: calc(100% - 48px);
121
+ padding: 0;
122
+ margin: 0 auto 24px;
123
+ font-size: $-action-sheet-fs;
124
+ font-weight: $-action-sheet-weight;
125
+ line-height: $-action-sheet-cancel-height;
126
+ color: $-action-sheet-cancel-color;
127
+ text-align: center;
128
+ background: $-action-sheet-cancel-bg;
129
+ border: none;
130
+ border-radius: $-action-sheet-cancel-radius;
131
+ outline: none;
132
+
133
+ &:active {
134
+ background: $-action-sheet-active-color;
135
+ }
136
+
137
+ &:after {
138
+ display: none;
139
+ }
140
+ }
141
+
142
+ @include e(header) {
143
+ position: relative;
144
+ height: $-action-sheet-title-height;
145
+ font-size: $-action-sheet-title-fs;
146
+ font-weight: $-action-sheet-weight;
147
+ line-height: $-action-sheet-title-height;
148
+ color: $-action-sheet-color;
149
+ text-align: center;
150
+ }
151
+
152
+ @include edeep(close) {
153
+ position: absolute;
154
+ top: $-action-sheet-close-top;
155
+ right: $-action-sheet-close-right;
156
+ font-size: $-action-sheet-close-fs;
157
+ line-height: 1.1;
158
+ color: $-action-sheet-close-color;
159
+ transform: rotate(-45deg);
160
+ }
161
+
162
+ @include e(panels) {
163
+ height: 84px;
164
+ overflow-y: hidden;
165
+
166
+ &:first-of-type {
167
+ margin-top: 20px;
168
+ }
169
+
170
+ &:last-of-type {
171
+ margin-bottom: 12px;
172
+ }
173
+ }
174
+
175
+ @include e(panels-content) {
176
+ display: flex;
177
+ overflow-x: auto;
178
+ -webkit-overflow-scrolling: touch;
179
+ }
180
+
181
+ @include e(panel) {
182
+ display: inline-block;
183
+ flex: 0 0 auto;
184
+ width: 88px;
185
+ padding: $-action-sheet-panel-padding;
186
+ }
187
+
188
+ @include e(panel-img) {
189
+ display: block;
190
+ width: $-action-sheet-panel-img-fs;
191
+ height: $-action-sheet-panel-img-fs;
192
+ margin: 0 auto;
193
+ margin-bottom: 7px;
194
+ border-radius: $-action-sheet-panel-img-radius;
195
+ }
196
+
197
+ @include e(panel-title) {
198
+ font-size: $-action-sheet-subname-fs;
199
+ line-height: 1.2;
200
+ color: $-action-sheet-color;
201
+ text-align: center;
202
+ @include lineEllipsis;
203
+ }
204
+ }
@@ -0,0 +1,128 @@
1
+ /*
2
+ * @Author: weisheng
3
+ * @Date: 2024-03-18 11:22:03
4
+ * @LastEditTime: 2024-04-04 22:35:25
5
+ * @LastEditors: weisheng
6
+ * @Description:
7
+ * @FilePath: /wot-design-uni/src/uni_modules/wot-design-uni/components/wd-action-sheet/types.ts
8
+ * 记得注释
9
+ */
10
+ import type { ExtractPropTypes } from 'vue'
11
+ import {
12
+ baseProps,
13
+ makeArrayProp,
14
+ makeBooleanProp,
15
+ makeNumberProp,
16
+ makeRequiredProp,
17
+ makeStringProp,
18
+ } from '../common/props'
19
+
20
+ export type Action = {
21
+ /**
22
+ * 选项名称
23
+ */
24
+ name: string
25
+ /**
26
+ * 描述信息
27
+ */
28
+ subname: string
29
+ /**
30
+ * 颜色
31
+ */
32
+ color: string
33
+ /**
34
+ * 禁用
35
+ */
36
+ disabled: boolean
37
+ /**
38
+ * 加载中状态
39
+ */
40
+ loading: boolean
41
+ }
42
+
43
+ export type Panel = {
44
+ /**
45
+ * 图片地址
46
+ */
47
+ iconUrl: string
48
+ /**
49
+ * 标题内容
50
+ */
51
+ title: string
52
+ }
53
+
54
+ export const actionSheetProps = {
55
+ ...baseProps,
56
+ /**
57
+ * header 头部样式
58
+ * @default ''
59
+ * @type {string}
60
+ */
61
+ customHeaderClass: makeStringProp(''),
62
+ /**
63
+ * 设置菜单显示隐藏
64
+ * @default false
65
+ * @type {boolean}
66
+ */
67
+ modelValue: { ...makeBooleanProp(false), ...makeRequiredProp(Boolean) },
68
+ /**
69
+ * 菜单选项
70
+ * @default []
71
+ * @type {Action[]}
72
+ */
73
+ actions: makeArrayProp<Action>(),
74
+ /**
75
+ * 自定义面板项,可以为字符串数组,也可以为对象数组,如果为二维数组,则为多行展示
76
+ * @default []
77
+ * @type {Array<Panel | Panel[]>}
78
+ */
79
+ panels: makeArrayProp<Panel | Panel[]>(),
80
+ /**
81
+ * 标题
82
+ * @type {string}
83
+ */
84
+ title: String,
85
+ /**
86
+ * 取消按钮文案
87
+ * @type {string}
88
+ */
89
+ cancelText: String,
90
+ /**
91
+ * 点击选项后是否关闭菜单
92
+ * @default true
93
+ * @type {boolean}
94
+ */
95
+ closeOnClickAction: makeBooleanProp(true),
96
+ /**
97
+ * 点击遮罩是否关闭
98
+ * @default true
99
+ * @type {boolean}
100
+ */
101
+ closeOnClickModal: makeBooleanProp(true),
102
+ /**
103
+ * 弹框动画持续时间
104
+ * @default 200
105
+ * @type {number}
106
+ */
107
+ duration: makeNumberProp(200),
108
+ /**
109
+ * 菜单层级
110
+ * @default 10
111
+ * @type {number}
112
+ */
113
+ zIndex: makeNumberProp(10),
114
+ /**
115
+ * 弹层内容懒渲染,触发展示时才渲染内容
116
+ * @default true
117
+ * @type {boolean}
118
+ */
119
+ lazyRender: makeBooleanProp(true),
120
+ /**
121
+ * 弹出面板是否设置底部安全距离(iphone X 类型的机型)
122
+ * @default true
123
+ * @type {boolean}
124
+ */
125
+ safeAreaInsetBottom: makeBooleanProp(true),
126
+ }
127
+
128
+ export type ActionSheetProps = ExtractPropTypes<typeof actionSheetProps>
@@ -0,0 +1,174 @@
1
+ <template>
2
+ <view>
3
+ <wd-popup
4
+ custom-class="wd-action-sheet__popup"
5
+ :custom-style="`${(actions && actions.length) || (panels && panels.length) ? 'background: transparent;' : ''}`"
6
+ v-model="showPopup"
7
+ :duration="duration"
8
+ position="bottom"
9
+ :close-on-click-modal="closeOnClickModal"
10
+ :safe-area-inset-bottom="safeAreaInsetBottom"
11
+ :lazy-render="lazyRender"
12
+ @enter="handleOpen"
13
+ @close="close"
14
+ @after-enter="handleOpened"
15
+ @after-leave="handleClosed"
16
+ @click-modal="handleClickModal"
17
+ :z-index="zIndex"
18
+ >
19
+ <view
20
+ :class="`wd-action-sheet ${customClass}`"
21
+ :style="`${
22
+ (actions && actions.length) || (panels && panels.length)
23
+ ? 'margin: 0 10px calc(var(--window-bottom) + 10px) 10px; border-radius: 16px;'
24
+ : 'margin-bottom: var(--window-bottom);'
25
+ } ${customStyle}`"
26
+ >
27
+ <view v-if="title" :class="`wd-action-sheet__header ${customHeaderClass}`">
28
+ {{ title }}
29
+ <wd-icon custom-class="wd-action-sheet__close" name="add" @click="close" />
30
+ </view>
31
+ <view class="wd-action-sheet__actions" v-if="actions && actions.length">
32
+ <button
33
+ v-for="(action, rowIndex) in actions"
34
+ :key="rowIndex"
35
+ :class="`wd-action-sheet__action ${action.disabled ? 'wd-action-sheet__action--disabled' : ''} ${
36
+ action.loading ? 'wd-action-sheet__action--loading' : ''
37
+ }`"
38
+ :style="`color: ${action.color}`"
39
+ @click="select(rowIndex, 'action')"
40
+ >
41
+ <wd-loading custom-class="`wd-action-sheet__action-loading" v-if="action.loading" />
42
+ <view v-else class="wd-action-sheet__name">{{ action.name }}</view>
43
+ <view v-if="!action.loading && action.subname" class="wd-action-sheet__subname">
44
+ {{ action.subname }}
45
+ </view>
46
+ </button>
47
+ </view>
48
+ <view v-if="formatPanels && formatPanels.length">
49
+ <view
50
+ v-for="(panel, rowIndex) in formatPanels"
51
+ :key="rowIndex"
52
+ class="wd-action-sheet__panels"
53
+ >
54
+ <view class="wd-action-sheet__panels-content">
55
+ <view
56
+ v-for="(col, colIndex) in panel"
57
+ :key="colIndex"
58
+ class="wd-action-sheet__panel"
59
+ @click="select(rowIndex, 'panels', colIndex)"
60
+ >
61
+ <image class="wd-action-sheet__panel-img" :src="(col as any).iconUrl" />
62
+ <view class="wd-action-sheet__panel-title">{{ (col as any).title }}</view>
63
+ </view>
64
+ </view>
65
+ </view>
66
+ </view>
67
+ <slot />
68
+ <button v-if="cancelText" class="wd-action-sheet__cancel" @click="handleCancel">
69
+ {{ cancelText }}
70
+ </button>
71
+ </view>
72
+ </wd-popup>
73
+ </view>
74
+ </template>
75
+ <script lang="ts">
76
+ export default {
77
+ name: 'wd-action-sheet',
78
+ options: {
79
+ addGlobalClass: true,
80
+ virtualHost: true,
81
+ styleIsolation: 'shared',
82
+ },
83
+ }
84
+ </script>
85
+
86
+ <script lang="ts" setup>
87
+ import { watch, ref } from 'vue'
88
+ import { actionSheetProps, type Panel } from './types'
89
+ import { isArray } from '../common/util'
90
+
91
+ const props = defineProps(actionSheetProps)
92
+ const emit = defineEmits([
93
+ 'select',
94
+ 'click-modal',
95
+ 'cancel',
96
+ 'closed',
97
+ 'close',
98
+ 'open',
99
+ 'opened',
100
+ 'update:modelValue',
101
+ ])
102
+
103
+ const formatPanels = ref<Array<Panel> | Array<Panel[]>>([])
104
+
105
+ const showPopup = ref<boolean>(false)
106
+
107
+ watch(() => props.panels, computedValue, { deep: true, immediate: true })
108
+
109
+ watch(
110
+ () => props.modelValue,
111
+ (newValue) => {
112
+ showPopup.value = newValue
113
+ },
114
+ { deep: true, immediate: true },
115
+ )
116
+
117
+ function isPanelArray() {
118
+ return props.panels.length && !isArray(props.panels[0])
119
+ }
120
+ function computedValue() {
121
+ formatPanels.value = isPanelArray() ? [props.panels as Panel[]] : (props.panels as Panel[][])
122
+ }
123
+
124
+ function select(rowIndex: number, type: 'action' | 'panels', colIndex?: number) {
125
+ if (type === 'action') {
126
+ if (props.actions[rowIndex].disabled || props.actions[rowIndex].loading) {
127
+ return
128
+ }
129
+ emit('select', {
130
+ item: props.actions[rowIndex],
131
+ index: rowIndex,
132
+ })
133
+ } else if (isPanelArray()) {
134
+ emit('select', {
135
+ item: props.panels[Number(colIndex)],
136
+ index: colIndex,
137
+ })
138
+ } else {
139
+ emit('select', {
140
+ item: (props.panels as Panel[][])[rowIndex][Number(colIndex)],
141
+ rowIndex,
142
+ colIndex,
143
+ })
144
+ }
145
+ close()
146
+ }
147
+ function handleClickModal() {
148
+ emit('click-modal')
149
+ if (props.closeOnClickModal) {
150
+ close()
151
+ }
152
+ }
153
+ function handleCancel() {
154
+ emit('cancel')
155
+ close()
156
+ }
157
+ function close() {
158
+ emit('update:modelValue', false)
159
+ emit('close')
160
+ }
161
+ function handleOpen() {
162
+ emit('open')
163
+ }
164
+ function handleOpened() {
165
+ emit('opened')
166
+ }
167
+ function handleClosed() {
168
+ emit('closed')
169
+ }
170
+ </script>
171
+
172
+ <style lang="scss" scoped>
173
+ @import './index';
174
+ </style>
@@ -0,0 +1,25 @@
1
+ @import '../common/abstracts/variable';
2
+ @import '../common/abstracts/mixin';
3
+
4
+ @include b(backtop) {
5
+ position: fixed;
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ width: 40px;
10
+ height: 40px;
11
+ color: $-color-gray-8;
12
+ background-color: $-backtop-bg;
13
+
14
+ @include edeep(backicon) {
15
+ font-size: $-backtop-icon-size;
16
+ }
17
+
18
+ @include when(circle) {
19
+ border-radius: 50%;
20
+ }
21
+
22
+ @include when(square) {
23
+ border-radius: 4px;
24
+ }
25
+ }
@@ -0,0 +1,37 @@
1
+ import { baseProps, makeNumberProp, makeRequiredProp, makeStringProp } from '../common/props'
2
+
3
+ export const backtopProps = {
4
+ ...baseProps,
5
+ /**
6
+ * 页面滚动距离
7
+ */
8
+ scrollTop: makeRequiredProp(Number),
9
+ /**
10
+ * 距离顶部多少距离时显示
11
+ */
12
+ top: makeNumberProp(300),
13
+ /**
14
+ * 返回顶部滚动时间
15
+ */
16
+ duration: makeNumberProp(100),
17
+ /**
18
+ * 层级
19
+ */
20
+ zIndex: makeNumberProp(10),
21
+ /**
22
+ * icon样式
23
+ */
24
+ iconStyle: makeStringProp(''),
25
+ /**
26
+ * 形状
27
+ */
28
+ shape: makeStringProp('circle'),
29
+ /**
30
+ * 距离屏幕底部距离
31
+ */
32
+ bottom: makeNumberProp(100),
33
+ /**
34
+ * 距离屏幕右边距离
35
+ */
36
+ right: makeNumberProp(20),
37
+ }
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <wd-transition :show="show" name="fade">
3
+ <view
4
+ :class="`wd-backtop ${customClass} is-${shape}`"
5
+ :style="`z-index: ${zIndex}; bottom: ${bottom}px; right: ${right}px; ${customStyle}`"
6
+ @click="handleBacktop"
7
+ >
8
+ <slot v-if="$slots.default"></slot>
9
+ <wd-icon
10
+ v-else
11
+ custom-class="wd-backtop__backicon"
12
+ name="backtop"
13
+ :custom-style="iconStyle"
14
+ />
15
+ </view>
16
+ </wd-transition>
17
+ </template>
18
+
19
+ <script lang="ts">
20
+ export default {
21
+ name: 'wd-backtop',
22
+ options: {
23
+ addGlobalClass: true,
24
+ virtualHost: true,
25
+ styleIsolation: 'shared',
26
+ },
27
+ }
28
+ </script>
29
+
30
+ <script lang="ts" setup>
31
+ import { computed } from 'vue'
32
+ import { backtopProps } from './types'
33
+
34
+ const props = defineProps(backtopProps)
35
+
36
+ const show = computed(() => props.scrollTop > props.top)
37
+
38
+ function handleBacktop() {
39
+ uni.pageScrollTo({
40
+ scrollTop: 0,
41
+ duration: props.duration,
42
+ })
43
+ }
44
+ </script>
45
+
46
+ <style lang="scss" scoped>
47
+ @import './index';
48
+ </style>
@@ -0,0 +1,59 @@
1
+ @import './../common/abstracts/_mixin';
2
+ @import './../common/abstracts/variable';
3
+
4
+ .wot-theme-dark {
5
+ @include b(badge) {
6
+ @include e(content) {
7
+ border-color: $-dark-background2;
8
+ }
9
+ }
10
+ }
11
+
12
+ @include b(badge) {
13
+ position: relative;
14
+ display: inline-block;
15
+ vertical-align: middle;
16
+
17
+ @include e(content) {
18
+ display: inline-block;
19
+ height: $-badge-height;
20
+ padding: $-badge-padding;
21
+ font-size: $-badge-fs;
22
+ font-weight: 500;
23
+ line-height: $-badge-height;
24
+ color: $-badge-color;
25
+ text-align: center;
26
+ white-space: nowrap;
27
+ background-color: $-badge-bg;
28
+ border: $-badge-border;
29
+ border-radius: calc($-badge-height / 2 + 2px);
30
+
31
+ @include when(fixed) {
32
+ position: absolute;
33
+ transform: translateY(-50%) translateX(50%);
34
+ }
35
+
36
+ @include when(dot) {
37
+ width: $-badge-dot-size;
38
+ height: $-badge-dot-size;
39
+ padding: 0;
40
+ border-radius: 50%;
41
+ }
42
+
43
+ @each $type in (primary, success, warning, info, danger) {
44
+ @include m($type) {
45
+ @if $type == primary {
46
+ background-color: $-badge-primary;
47
+ } @else if $type == success {
48
+ background-color: $-badge-success;
49
+ } @else if $type == warning {
50
+ background-color: $-badge-warning;
51
+ } @else if $type == info {
52
+ background-color: $-badge-info;
53
+ } @else {
54
+ background-color: $-badge-danger;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }