@wot-ui/ui 1.0.0 → 2.0.0-alpha.4

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 (386) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +134 -0
  3. package/attributes.json +1 -0
  4. package/changelog.md +63 -0
  5. package/common/AbortablePromise.ts +28 -0
  6. package/common/canvasHelper.ts +49 -0
  7. package/common/clickoutside.ts +25 -0
  8. package/common/event.ts +8 -0
  9. package/common/formatDate.ts +68 -0
  10. package/common/interceptor.ts +43 -0
  11. package/common/props.ts +53 -0
  12. package/common/util.ts +836 -0
  13. package/components/wd-action-sheet/index.scss +232 -0
  14. package/components/wd-action-sheet/types.ts +155 -0
  15. package/components/wd-action-sheet/wd-action-sheet.vue +176 -0
  16. package/components/wd-avatar/index.scss +150 -0
  17. package/components/wd-avatar/types.ts +98 -0
  18. package/components/wd-avatar/wd-avatar.vue +184 -0
  19. package/components/wd-avatar-group/index.scss +11 -0
  20. package/components/wd-avatar-group/types.ts +61 -0
  21. package/components/wd-avatar-group/wd-avatar-group.vue +115 -0
  22. package/components/wd-backtop/index.scss +67 -0
  23. package/components/wd-backtop/types.ts +66 -0
  24. package/components/wd-backtop/wd-backtop.vue +57 -0
  25. package/components/wd-badge/index.scss +116 -0
  26. package/components/wd-badge/types.ts +94 -0
  27. package/components/wd-badge/wd-badge.vue +78 -0
  28. package/components/wd-button/index.scss +436 -0
  29. package/components/wd-button/types.ts +204 -0
  30. package/components/wd-button/wd-button.vue +210 -0
  31. package/components/wd-calendar/index.scss +97 -0
  32. package/components/wd-calendar/types.ts +221 -0
  33. package/components/wd-calendar/wd-calendar.vue +339 -0
  34. package/components/wd-calendar-view/index.scss +41 -0
  35. package/components/wd-calendar-view/month/index.scss +144 -0
  36. package/components/wd-calendar-view/month/month.vue +389 -0
  37. package/components/wd-calendar-view/month/types.ts +70 -0
  38. package/components/wd-calendar-view/monthPanel/index.scss +84 -0
  39. package/components/wd-calendar-view/monthPanel/month-panel.vue +541 -0
  40. package/components/wd-calendar-view/monthPanel/types.ts +151 -0
  41. package/components/wd-calendar-view/types.ts +166 -0
  42. package/components/wd-calendar-view/utils.ts +318 -0
  43. package/components/wd-calendar-view/wd-calendar-view.vue +117 -0
  44. package/components/wd-calendar-view/year/index.scss +148 -0
  45. package/components/wd-calendar-view/year/types.ts +74 -0
  46. package/components/wd-calendar-view/year/year.vue +206 -0
  47. package/components/wd-calendar-view/yearPanel/index.scss +42 -0
  48. package/components/wd-calendar-view/yearPanel/types.ts +96 -0
  49. package/components/wd-calendar-view/yearPanel/year-panel.vue +249 -0
  50. package/components/wd-card/index.scss +104 -0
  51. package/components/wd-card/types.ts +47 -0
  52. package/components/wd-card/wd-card.vue +38 -0
  53. package/components/wd-cascader/index.scss +154 -0
  54. package/components/wd-cascader/types.ts +191 -0
  55. package/components/wd-cascader/wd-cascader.vue +589 -0
  56. package/components/wd-cell/index.scss +244 -0
  57. package/components/wd-cell/types.ts +205 -0
  58. package/components/wd-cell/wd-cell.vue +172 -0
  59. package/components/wd-cell-group/index.scss +53 -0
  60. package/components/wd-cell-group/types.ts +97 -0
  61. package/components/wd-cell-group/wd-cell-group.vue +48 -0
  62. package/components/wd-checkbox/index.scss +166 -0
  63. package/components/wd-checkbox/types.ts +118 -0
  64. package/components/wd-checkbox/wd-checkbox.vue +216 -0
  65. package/components/wd-checkbox-group/index.scss +5 -0
  66. package/components/wd-checkbox-group/types.ts +93 -0
  67. package/components/wd-checkbox-group/wd-checkbox-group.vue +148 -0
  68. package/components/wd-circle/index.scss +28 -0
  69. package/components/wd-circle/types.ts +54 -0
  70. package/components/wd-circle/wd-circle.vue +306 -0
  71. package/components/wd-col/index.scss +5 -0
  72. package/components/wd-col/types.ts +16 -0
  73. package/components/wd-col/wd-col.vue +83 -0
  74. package/components/wd-collapse/index.scss +71 -0
  75. package/components/wd-collapse/types.ts +68 -0
  76. package/components/wd-collapse/wd-collapse.vue +165 -0
  77. package/components/wd-collapse-item/index.scss +86 -0
  78. package/components/wd-collapse-item/types.ts +62 -0
  79. package/components/wd-collapse-item/wd-collapse-item.vue +184 -0
  80. package/components/wd-config-provider/index.scss +10 -0
  81. package/components/wd-config-provider/types.ts +2061 -0
  82. package/components/wd-config-provider/wd-config-provider.vue +61 -0
  83. package/components/wd-count-down/index.scss +16 -0
  84. package/components/wd-count-down/types.ts +58 -0
  85. package/components/wd-count-down/utils.ts +52 -0
  86. package/components/wd-count-down/wd-count-down.vue +62 -0
  87. package/components/wd-count-to/index.scss +25 -0
  88. package/components/wd-count-to/types.ts +121 -0
  89. package/components/wd-count-to/wd-count-to.vue +126 -0
  90. package/components/wd-curtain/index.scss +96 -0
  91. package/components/wd-curtain/types.ts +82 -0
  92. package/components/wd-curtain/wd-curtain.vue +172 -0
  93. package/components/wd-datetime-picker/index.scss +133 -0
  94. package/components/wd-datetime-picker/types.ts +198 -0
  95. package/components/wd-datetime-picker/wd-datetime-picker.vue +526 -0
  96. package/components/wd-datetime-picker-view/types.ts +171 -0
  97. package/components/wd-datetime-picker-view/util.ts +30 -0
  98. package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +402 -0
  99. package/components/wd-dialog/index.scss +281 -0
  100. package/components/wd-dialog/index.ts +168 -0
  101. package/components/wd-dialog/types.ts +452 -0
  102. package/components/wd-dialog/wd-dialog.vue +586 -0
  103. package/components/wd-divider/index.scss +122 -0
  104. package/components/wd-divider/types.ts +50 -0
  105. package/components/wd-divider/wd-divider.vue +54 -0
  106. package/components/wd-drop-menu/index.scss +90 -0
  107. package/components/wd-drop-menu/types.ts +38 -0
  108. package/components/wd-drop-menu/wd-drop-menu.vue +168 -0
  109. package/components/wd-drop-menu-item/index.scss +96 -0
  110. package/components/wd-drop-menu-item/types.ts +93 -0
  111. package/components/wd-drop-menu-item/wd-drop-menu-item.vue +205 -0
  112. package/components/wd-empty/index.scss +46 -0
  113. package/components/wd-empty/types.ts +37 -0
  114. package/components/wd-empty/wd-empty.vue +47 -0
  115. package/components/wd-fab/index.scss +124 -0
  116. package/components/wd-fab/types.ts +119 -0
  117. package/components/wd-fab/wd-fab.vue +322 -0
  118. package/components/wd-floating-panel/index.scss +73 -0
  119. package/components/wd-floating-panel/type.ts +32 -0
  120. package/components/wd-floating-panel/wd-floating-panel.vue +142 -0
  121. package/components/wd-form/adapters/zod.ts +56 -0
  122. package/components/wd-form/index.ts +2 -0
  123. package/components/wd-form/types.ts +133 -0
  124. package/components/wd-form/wd-form.vue +121 -0
  125. package/components/wd-form-item/index.scss +26 -0
  126. package/components/wd-form-item/types.ts +134 -0
  127. package/components/wd-form-item/wd-form-item.vue +182 -0
  128. package/components/wd-gap/index.scss +9 -0
  129. package/components/wd-gap/types.ts +26 -0
  130. package/components/wd-gap/wd-gap.vue +38 -0
  131. package/components/wd-grid/index.scss +11 -0
  132. package/components/wd-grid/types.ts +97 -0
  133. package/components/wd-grid/wd-grid.vue +48 -0
  134. package/components/wd-grid-item/index.scss +187 -0
  135. package/components/wd-grid-item/types.ts +98 -0
  136. package/components/wd-grid-item/wd-grid-item.vue +295 -0
  137. package/components/wd-icon/index.scss +46 -0
  138. package/components/wd-icon/types.ts +44 -0
  139. package/components/wd-icon/wd-icon.vue +66 -0
  140. package/components/wd-image-preview/index.scss +94 -0
  141. package/components/wd-image-preview/index.ts +95 -0
  142. package/components/wd-image-preview/types.ts +165 -0
  143. package/components/wd-image-preview/wd-image-preview.vue +233 -0
  144. package/components/wd-img/index.scss +82 -0
  145. package/components/wd-img/types.ts +96 -0
  146. package/components/wd-img/wd-img.vue +91 -0
  147. package/components/wd-img-cropper/index.scss +259 -0
  148. package/components/wd-img-cropper/types.ts +101 -0
  149. package/components/wd-img-cropper/wd-img-cropper.vue +653 -0
  150. package/components/wd-index-anchor/index.scss +34 -0
  151. package/components/wd-index-anchor/type.ts +9 -0
  152. package/components/wd-index-anchor/wd-index-anchor.vue +55 -0
  153. package/components/wd-index-bar/index.scss +68 -0
  154. package/components/wd-index-bar/type.ts +23 -0
  155. package/components/wd-index-bar/wd-index-bar.vue +157 -0
  156. package/components/wd-input/index.scss +129 -0
  157. package/components/wd-input/types.ts +165 -0
  158. package/components/wd-input/wd-input.vue +237 -0
  159. package/components/wd-input-number/index.scss +233 -0
  160. package/components/wd-input-number/types.ts +131 -0
  161. package/components/wd-input-number/wd-input-number.vue +473 -0
  162. package/components/wd-keyboard/constants.ts +81 -0
  163. package/components/wd-keyboard/index.scss +104 -0
  164. package/components/wd-keyboard/key/index.scss +103 -0
  165. package/components/wd-keyboard/key/index.vue +84 -0
  166. package/components/wd-keyboard/key/types.ts +44 -0
  167. package/components/wd-keyboard/types.ts +138 -0
  168. package/components/wd-keyboard/wd-keyboard.vue +236 -0
  169. package/components/wd-loading/index.scss +205 -0
  170. package/components/wd-loading/types.ts +61 -0
  171. package/components/wd-loading/wd-loading.vue +70 -0
  172. package/components/wd-loadmore/index.scss +62 -0
  173. package/components/wd-loadmore/types.ts +42 -0
  174. package/components/wd-loadmore/wd-loadmore.vue +68 -0
  175. package/components/wd-navbar/index.scss +96 -0
  176. package/components/wd-navbar/types.ts +74 -0
  177. package/components/wd-navbar/wd-navbar.vue +136 -0
  178. package/components/wd-navbar-capsule/index.scss +70 -0
  179. package/components/wd-navbar-capsule/types.ts +11 -0
  180. package/components/wd-navbar-capsule/wd-navbar-capsule.vue +48 -0
  181. package/components/wd-notice-bar/index.scss +94 -0
  182. package/components/wd-notice-bar/types.ts +97 -0
  183. package/components/wd-notice-bar/wd-notice-bar.vue +270 -0
  184. package/components/wd-notify/index.scss +114 -0
  185. package/components/wd-notify/index.ts +63 -0
  186. package/components/wd-notify/types.ts +130 -0
  187. package/components/wd-notify/wd-notify.vue +162 -0
  188. package/components/wd-overlay/index.scss +14 -0
  189. package/components/wd-overlay/types.ts +42 -0
  190. package/components/wd-overlay/wd-overlay.vue +55 -0
  191. package/components/wd-pagination/index.scss +71 -0
  192. package/components/wd-pagination/types.ts +69 -0
  193. package/components/wd-pagination/wd-pagination.vue +118 -0
  194. package/components/wd-password-input/index.scss +134 -0
  195. package/components/wd-password-input/types.ts +42 -0
  196. package/components/wd-password-input/wd-password-input.vue +51 -0
  197. package/components/wd-picker/index.scss +72 -0
  198. package/components/wd-picker/types.ts +141 -0
  199. package/components/wd-picker/wd-picker.vue +220 -0
  200. package/components/wd-picker-view/index.scss +93 -0
  201. package/components/wd-picker-view/types.ts +145 -0
  202. package/components/wd-picker-view/useSelection.ts +385 -0
  203. package/components/wd-picker-view/wd-picker-view.vue +227 -0
  204. package/components/wd-popover/index.scss +117 -0
  205. package/components/wd-popover/types.ts +106 -0
  206. package/components/wd-popover/wd-popover.vue +212 -0
  207. package/components/wd-popup/index.scss +89 -0
  208. package/components/wd-popup/types.ts +110 -0
  209. package/components/wd-popup/wd-popup.vue +174 -0
  210. package/components/wd-progress/index.scss +155 -0
  211. package/components/wd-progress/types.ts +94 -0
  212. package/components/wd-progress/wd-progress.vue +249 -0
  213. package/components/wd-radio/index.scss +189 -0
  214. package/components/wd-radio/types.ts +64 -0
  215. package/components/wd-radio/wd-radio.vue +164 -0
  216. package/components/wd-radio-group/index.scss +5 -0
  217. package/components/wd-radio-group/types.ts +70 -0
  218. package/components/wd-radio-group/wd-radio-group.vue +53 -0
  219. package/components/wd-rate/index.scss +57 -0
  220. package/components/wd-rate/types.ts +86 -0
  221. package/components/wd-rate/wd-rate.vue +168 -0
  222. package/components/wd-resize/index.scss +31 -0
  223. package/components/wd-resize/types.ts +14 -0
  224. package/components/wd-resize/wd-resize.vue +157 -0
  225. package/components/wd-root-portal/wd-root-portal.vue +77 -0
  226. package/components/wd-row/index.scss +6 -0
  227. package/components/wd-row/types.ts +36 -0
  228. package/components/wd-row/wd-row.vue +88 -0
  229. package/components/wd-search/index.scss +171 -0
  230. package/components/wd-search/types.ts +107 -0
  231. package/components/wd-search/wd-search.vue +198 -0
  232. package/components/wd-segmented/index.scss +155 -0
  233. package/components/wd-segmented/types.ts +81 -0
  234. package/components/wd-segmented/wd-segmented.vue +169 -0
  235. package/components/wd-select-picker/index.scss +72 -0
  236. package/components/wd-select-picker/types.ts +72 -0
  237. package/components/wd-select-picker/wd-select-picker.vue +371 -0
  238. package/components/wd-sidebar/index.scss +25 -0
  239. package/components/wd-sidebar/types.ts +34 -0
  240. package/components/wd-sidebar/wd-sidebar.vue +57 -0
  241. package/components/wd-sidebar-item/index.scss +91 -0
  242. package/components/wd-sidebar-item/types.ts +28 -0
  243. package/components/wd-sidebar-item/wd-sidebar-item.vue +118 -0
  244. package/components/wd-signature/index.scss +42 -0
  245. package/components/wd-signature/types.ts +295 -0
  246. package/components/wd-signature/wd-signature.vue +664 -0
  247. package/components/wd-skeleton/index.scss +112 -0
  248. package/components/wd-skeleton/types.ts +124 -0
  249. package/components/wd-skeleton/wd-skeleton.vue +110 -0
  250. package/components/wd-slide-verify/index.scss +112 -0
  251. package/components/wd-slide-verify/types.ts +98 -0
  252. package/components/wd-slide-verify/wd-slide-verify.vue +222 -0
  253. package/components/wd-slider/index.scss +485 -0
  254. package/components/wd-slider/types.ts +166 -0
  255. package/components/wd-slider/wd-slider.vue +529 -0
  256. package/components/wd-sort-button/index.scss +126 -0
  257. package/components/wd-sort-button/types.ts +68 -0
  258. package/components/wd-sort-button/wd-sort-button.vue +67 -0
  259. package/components/wd-step/index.scss +366 -0
  260. package/components/wd-step/types.ts +43 -0
  261. package/components/wd-step/wd-step.vue +181 -0
  262. package/components/wd-steps/index.scss +7 -0
  263. package/components/wd-steps/types.ts +50 -0
  264. package/components/wd-steps/wd-steps.vue +39 -0
  265. package/components/wd-sticky/index.scss +9 -0
  266. package/components/wd-sticky/types.ts +13 -0
  267. package/components/wd-sticky/wd-sticky.vue +192 -0
  268. package/components/wd-sticky-box/index.scss +6 -0
  269. package/components/wd-sticky-box/types.ts +20 -0
  270. package/components/wd-sticky-box/wd-sticky-box.vue +157 -0
  271. package/components/wd-swipe-action/index.scss +22 -0
  272. package/components/wd-swipe-action/types.ts +87 -0
  273. package/components/wd-swipe-action/wd-swipe-action.vue +320 -0
  274. package/components/wd-swiper/index.scss +69 -0
  275. package/components/wd-swiper/types.ts +275 -0
  276. package/components/wd-swiper/wd-swiper.vue +332 -0
  277. package/components/wd-swiper-nav/index.scss +179 -0
  278. package/components/wd-swiper-nav/types.ts +42 -0
  279. package/components/wd-swiper-nav/wd-swiper-nav.vue +42 -0
  280. package/components/wd-switch/index.scss +177 -0
  281. package/components/wd-switch/types.ts +93 -0
  282. package/components/wd-switch/wd-switch.vue +107 -0
  283. package/components/wd-tab/index.scss +16 -0
  284. package/components/wd-tab/types.ts +45 -0
  285. package/components/wd-tab/wd-tab.vue +99 -0
  286. package/components/wd-tabbar/index.scss +71 -0
  287. package/components/wd-tabbar/types.ts +79 -0
  288. package/components/wd-tabbar/wd-tabbar.vue +109 -0
  289. package/components/wd-tabbar-item/index.scss +50 -0
  290. package/components/wd-tabbar-item/types.ts +45 -0
  291. package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
  292. package/components/wd-table/index.scss +128 -0
  293. package/components/wd-table/types.ts +160 -0
  294. package/components/wd-table/wd-table.vue +331 -0
  295. package/components/wd-table-column/index.scss +15 -0
  296. package/components/wd-table-column/types.ts +81 -0
  297. package/components/wd-table-column/wd-table-column.vue +198 -0
  298. package/components/wd-tabs/index.scss +332 -0
  299. package/components/wd-tabs/types.ts +155 -0
  300. package/components/wd-tabs/wd-tabs.vue +508 -0
  301. package/components/wd-tag/index.scss +325 -0
  302. package/components/wd-tag/types.ts +90 -0
  303. package/components/wd-tag/wd-tag.vue +158 -0
  304. package/components/wd-text/index.scss +52 -0
  305. package/components/wd-text/types.ts +107 -0
  306. package/components/wd-text/wd-text.vue +141 -0
  307. package/components/wd-textarea/index.scss +112 -0
  308. package/components/wd-textarea/types.ts +151 -0
  309. package/components/wd-textarea/wd-textarea.vue +212 -0
  310. package/components/wd-toast/index.scss +92 -0
  311. package/components/wd-toast/index.ts +97 -0
  312. package/components/wd-toast/types.ts +190 -0
  313. package/components/wd-toast/wd-toast.vue +158 -0
  314. package/components/wd-tooltip/index.scss +77 -0
  315. package/components/wd-tooltip/types.ts +105 -0
  316. package/components/wd-tooltip/wd-tooltip.vue +169 -0
  317. package/components/wd-tour/index.scss +106 -0
  318. package/components/wd-tour/types.ts +268 -0
  319. package/components/wd-tour/wd-tour.vue +518 -0
  320. package/components/wd-transition/index.scss +67 -0
  321. package/components/wd-transition/types.ts +106 -0
  322. package/components/wd-transition/wd-transition.vue +238 -0
  323. package/components/wd-upload/index.scss +204 -0
  324. package/components/wd-upload/types.ts +390 -0
  325. package/components/wd-upload/wd-upload.vue +565 -0
  326. package/components/wd-video-preview/index.scss +54 -0
  327. package/components/wd-video-preview/index.ts +64 -0
  328. package/components/wd-video-preview/types.ts +66 -0
  329. package/components/wd-video-preview/wd-video-preview.vue +141 -0
  330. package/components/wd-watermark/index.scss +21 -0
  331. package/components/wd-watermark/types.ts +130 -0
  332. package/components/wd-watermark/wd-watermark.vue +718 -0
  333. package/components/wot-ui/wot-ui.vue +5 -0
  334. package/composables/index.ts +16 -0
  335. package/composables/useCell.ts +34 -0
  336. package/composables/useChildren.ts +120 -0
  337. package/composables/useConfigProvider.ts +45 -0
  338. package/composables/useCountDown.ts +138 -0
  339. package/composables/useDeviceInfo.ts +136 -0
  340. package/composables/useLockScroll.ts +37 -0
  341. package/composables/useParent.ts +51 -0
  342. package/composables/usePopover.ts +212 -0
  343. package/composables/useQueue.ts +52 -0
  344. package/composables/useRaf.ts +37 -0
  345. package/composables/useTouch.ts +43 -0
  346. package/composables/useTranslate.ts +12 -0
  347. package/composables/useUpload.ts +366 -0
  348. package/global.d.ts +106 -0
  349. package/index.ts +6 -0
  350. package/locale/index.ts +32 -0
  351. package/locale/lang/ar-SA.ts +150 -0
  352. package/locale/lang/de-DE.ts +150 -0
  353. package/locale/lang/en-US.ts +150 -0
  354. package/locale/lang/es-ES.ts +150 -0
  355. package/locale/lang/fr-FR.ts +150 -0
  356. package/locale/lang/ja-JP.ts +150 -0
  357. package/locale/lang/ko-KR.ts +150 -0
  358. package/locale/lang/pt-PT.ts +150 -0
  359. package/locale/lang/ru-RU.ts +150 -0
  360. package/locale/lang/th-TH.ts +150 -0
  361. package/locale/lang/tr-TR.ts +155 -0
  362. package/locale/lang/ug-CN.ts +154 -0
  363. package/locale/lang/vi-VN.ts +89 -0
  364. package/locale/lang/zh-CN.ts +154 -0
  365. package/locale/lang/zh-HK.ts +78 -0
  366. package/locale/lang/zh-TW.ts +78 -0
  367. package/package.json +1 -11
  368. package/styles/iconfont/iconfont.scss +1243 -0
  369. package/styles/mixin/_config.scss +7 -0
  370. package/styles/mixin/_function.scss +44 -0
  371. package/styles/mixin/_mixin.scss +473 -0
  372. package/styles/theme/base/color.scss +210 -0
  373. package/styles/theme/base/font.scss +13 -0
  374. package/styles/theme/base/index.scss +8 -0
  375. package/styles/theme/base/insets.scss +32 -0
  376. package/styles/theme/base/number.scss +36 -0
  377. package/styles/theme/base/opacity.scss +9 -0
  378. package/styles/theme/base/radius.scss +13 -0
  379. package/styles/theme/base/stroke.scss +9 -0
  380. package/styles/theme/base/typography.scss +44 -0
  381. package/styles/theme/dark.scss +101 -0
  382. package/styles/theme/index.scss +16 -0
  383. package/styles/theme/light.scss +101 -0
  384. package/styles/variable.scss +472 -0
  385. package/tags.json +1 -0
  386. package/web-types.json +1 -0
@@ -0,0 +1,586 @@
1
+ <template>
2
+ <wd-popup
3
+ transition="zoom-in"
4
+ v-model="dialogState.show"
5
+ :close-on-click-modal="dialogState.closeOnClickModal"
6
+ :lazy-render="dialogState.lazyRender"
7
+ custom-class="wd-dialog"
8
+ @click-modal="toggleModal('modal')"
9
+ :z-index="dialogState.zIndex"
10
+ :duration="200"
11
+ :root-portal="rootPortal"
12
+ >
13
+ <view :class="rootClass">
14
+ <wd-icon v-if="dialogState.showClose" custom-class="wd-dialog__close" name="close" @click="toggleModal('modal')"></wd-icon>
15
+ <slot name="header" />
16
+ <view :class="bodyClass">
17
+ <slot name="image">
18
+ <image v-if="dialogState.headerImage" mode="widthFix" class="wd-dialog__img" :src="dialogState.headerImage"></image>
19
+ </slot>
20
+ <slot name="title" :icon="dialogState.icon" :title="dialogState.title" :iconProps="dialogState.iconProps">
21
+ <view v-if="dialogState.iconProps?.name || dialogState.title" class="wd-dialog__title">
22
+ <wd-icon
23
+ v-if="dialogState.iconProps?.name"
24
+ :custom-class="`wd-dialog__icon ${iconTypeClass}`"
25
+ :name="dialogState.iconProps.name"
26
+ :color="dialogState.iconProps.color"
27
+ :size="dialogState.iconProps.size"
28
+ ></wd-icon>
29
+ {{ dialogState.title }}
30
+ </view>
31
+ </slot>
32
+ <view class="wd-dialog__content" v-if="dialogState.type === 'prompt' || !!dialogState.msg || $slots.default">
33
+ <slot
34
+ :msg="dialogState.msg"
35
+ :type="dialogState.type"
36
+ :inputValue="inputVal"
37
+ :showErr="dialogState.showErr"
38
+ :inputError="dialogState.inputError"
39
+ >
40
+ <block v-if="dialogState.type === 'prompt'">
41
+ <wd-textarea
42
+ v-if="dialogState.textareaProps"
43
+ v-model="inputVal"
44
+ custom-class="wd-dialog__input"
45
+ v-bind="textareaPropsWithoutModelValue"
46
+ />
47
+ <wd-input v-else v-model="inputVal" custom-class="wd-dialog__input" v-bind="inputPropsWithoutModelValue" />
48
+ <view v-if="dialogState.showErr" class="wd-dialog__input-error">
49
+ {{ dialogState.inputError || translate('inputNoValidate') }}
50
+ </view>
51
+ </block>
52
+ <text v-else class="wd-dialog__content-text">{{ dialogState.msg }}</text>
53
+ </slot>
54
+ </view>
55
+ </view>
56
+ <slot name="actions" :confirm="() => toggleModal('confirm')" :cancel="() => toggleModal('cancel')" :close="() => toggleModal('modal')">
57
+ <view
58
+ :class="`wd-dialog__actions ${dialogState.actionLayout === 'vertical' ? 'wd-dialog__actions--vertical' : ''} ${
59
+ dialogState.actionLayout === 'vertical' || showCancelButton || (dialogState.actions && dialogState.actions.length > 1)
60
+ ? 'wd-dialog__flex'
61
+ : 'wd-dialog__block'
62
+ } ${dialogState.theme === 'text' ? 'is-text' : ''}`"
63
+ >
64
+ <block v-if="customActions && customActions.length">
65
+ <wd-button
66
+ v-for="(btn, index) in customActions"
67
+ :key="index"
68
+ v-bind="getActionButtonProps(btn)"
69
+ @click="handleAction(btn, index)"
70
+ @getuserinfo="(e: any) => handleOpenTypeEvent(btn, 'onGetuserinfo', e)"
71
+ @contact="(e: any) => handleOpenTypeEvent(btn, 'onContact', e)"
72
+ @getphonenumber="(e: any) => handleOpenTypeEvent(btn, 'onGetphonenumber', e)"
73
+ @getrealtimephonenumber="(e: any) => handleOpenTypeEvent(btn, 'onGetrealtimephonenumber', e)"
74
+ @error="(e: any) => handleOpenTypeEvent(btn, 'onError', e)"
75
+ @launchapp="(e: any) => handleOpenTypeEvent(btn, 'onLaunchapp', e)"
76
+ @opensetting="(e: any) => handleOpenTypeEvent(btn, 'onOpensetting', e)"
77
+ @chooseavatar="(e: any) => handleOpenTypeEvent(btn, 'onChooseavatar', e)"
78
+ @agreeprivacyauthorization="(e: any) => handleOpenTypeEvent(btn, 'onAgreeprivacyauthorization', e)"
79
+ custom-class="wd-dialog__actions-btn"
80
+ >
81
+ {{ btn.text }}
82
+ </wd-button>
83
+ </block>
84
+ <block v-else>
85
+ <wd-button
86
+ v-bind="customCancelProps"
87
+ v-if="showCancelButton"
88
+ @click="toggleModal('cancel')"
89
+ @getuserinfo="(e: any) => handleButtonOpenTypeEvent('cancel', 'onGetuserinfo', e)"
90
+ @contact="(e: any) => handleButtonOpenTypeEvent('cancel', 'onContact', e)"
91
+ @getphonenumber="(e: any) => handleButtonOpenTypeEvent('cancel', 'onGetphonenumber', e)"
92
+ @getrealtimephonenumber="(e: any) => handleButtonOpenTypeEvent('cancel', 'onGetrealtimephonenumber', e)"
93
+ @error="(e: any) => handleButtonOpenTypeEvent('cancel', 'onError', e)"
94
+ @launchapp="(e: any) => handleButtonOpenTypeEvent('cancel', 'onLaunchapp', e)"
95
+ @opensetting="(e: any) => handleButtonOpenTypeEvent('cancel', 'onOpensetting', e)"
96
+ @chooseavatar="(e: any) => handleButtonOpenTypeEvent('cancel', 'onChooseavatar', e)"
97
+ @agreeprivacyauthorization="(e: any) => handleButtonOpenTypeEvent('cancel', 'onAgreeprivacyauthorization', e)"
98
+ >
99
+ {{ getCancelText() }}
100
+ </wd-button>
101
+ <wd-button
102
+ v-bind="customConfirmProps"
103
+ v-if="showConfirmButton"
104
+ @click="toggleModal('confirm')"
105
+ @getuserinfo="(e: any) => handleButtonOpenTypeEvent('confirm', 'onGetuserinfo', e)"
106
+ @contact="(e: any) => handleButtonOpenTypeEvent('confirm', 'onContact', e)"
107
+ @getphonenumber="(e: any) => handleButtonOpenTypeEvent('confirm', 'onGetphonenumber', e)"
108
+ @getrealtimephonenumber="(e: any) => handleButtonOpenTypeEvent('confirm', 'onGetrealtimephonenumber', e)"
109
+ @error="(e: any) => handleButtonOpenTypeEvent('confirm', 'onError', e)"
110
+ @launchapp="(e: any) => handleButtonOpenTypeEvent('confirm', 'onLaunchapp', e)"
111
+ @opensetting="(e: any) => handleButtonOpenTypeEvent('confirm', 'onOpensetting', e)"
112
+ @chooseavatar="(e: any) => handleButtonOpenTypeEvent('confirm', 'onChooseavatar', e)"
113
+ @agreeprivacyauthorization="(e: any) => handleButtonOpenTypeEvent('confirm', 'onAgreeprivacyauthorization', e)"
114
+ >
115
+ {{ getConfirmText() }}
116
+ </wd-button>
117
+ </block>
118
+ </view>
119
+ </slot>
120
+ </view>
121
+ </wd-popup>
122
+ </template>
123
+ <script lang="ts">
124
+ export default {
125
+ name: 'wd-dialog',
126
+ options: {
127
+ // #ifndef MP-TOUTIAO
128
+ virtualHost: true,
129
+ // #endif
130
+ addGlobalClass: true,
131
+ styleIsolation: 'shared'
132
+ }
133
+ }
134
+ </script>
135
+
136
+ <script lang="ts" setup>
137
+ import wdPopup from '../wd-popup/wd-popup.vue'
138
+ import wdButton from '../wd-button/wd-button.vue'
139
+ import wdInput from '../wd-input/wd-input.vue'
140
+ import wdTextarea from '../wd-textarea/wd-textarea.vue'
141
+ import { computed, inject, reactive, ref, watch } from 'vue'
142
+ import {
143
+ dialogProps,
144
+ type DialogBeforeConfirm,
145
+ type DialogOptionsWithCallBack,
146
+ type DialogResult,
147
+ type DialogBuiltinIconType,
148
+ DIALOG_BUILTIN_ICON_MAP,
149
+ type DialogAction,
150
+ type DialogButtonOpenTypeEvents,
151
+ OPEN_TYPE_EVENT_KEYS
152
+ } from './types'
153
+ import { defaultOptions, getDialogDefaultOptionKey } from '.'
154
+ import { callInterceptor } from '../../common/interceptor'
155
+ import { deepAssign, isDef, isFunction, isObj, isString, isUndefined, omitBy } from '../../common/util'
156
+ import { useTranslate } from '../../composables/useTranslate'
157
+ import type { ButtonProps, ButtonVariant } from '../wd-button/types'
158
+
159
+ const props = defineProps(dialogProps)
160
+
161
+ const { translate } = useTranslate('dialog')
162
+
163
+ // 当前图标的内置类型(用于添加 class)
164
+ const iconType = ref<string>('')
165
+
166
+ // 图标类型对应的 class
167
+ const iconTypeClass = computed(() => {
168
+ return iconType.value ? `is-${iconType.value}` : ''
169
+ })
170
+
171
+ const rootClass = computed(() => {
172
+ return `wd-dialog__container ${props.customClass}`
173
+ })
174
+
175
+ const bodyClass = computed(() => {
176
+ return `wd-dialog__body ${dialogState.type === 'prompt' ? 'is-prompt' : ''}`
177
+ })
178
+
179
+ const messageOptionKey = getDialogDefaultOptionKey(props.selector)
180
+ const messageOption = inject(messageOptionKey, ref<DialogOptionsWithCallBack>(defaultOptions)) // message选项
181
+
182
+ const inputVal = ref<string | number>('') // 输入框当前值
183
+
184
+ const dialogState = reactive<DialogOptionsWithCallBack>({
185
+ msg: '', // 消息内容
186
+ show: false, // 是否显示弹框
187
+ title: '', // 标题
188
+ closeOnClickModal: false, // 是否支持点击蒙层关闭
189
+ type: 'alert', // 弹框类型
190
+ inputProps: {
191
+ type: 'text',
192
+ modelValue: ''
193
+ }, // 输入框属性
194
+ inputError: '', // 输入框错误提示文案
195
+ showErr: false, // 是否显示错误提示
196
+ zIndex: 99, // 弹窗层级
197
+ lazyRender: true, // 弹层内容懒渲染
198
+ headerImage: '', // 顶部图片
199
+ showClose: false, // 是否显示关闭按钮
200
+ actionLayout: 'horizontal', // 按钮排列方式
201
+ theme: 'button' // 弹窗按钮风格
202
+ })
203
+
204
+ /**
205
+ * 获取确认按钮文本
206
+ * 从 confirmButtonProps 获取(快捷属性已在 index.ts 中合并)
207
+ */
208
+ function getConfirmText(): string {
209
+ const { confirmButtonProps } = dialogState
210
+ if (isString(confirmButtonProps)) {
211
+ return confirmButtonProps
212
+ }
213
+ if (isDef(confirmButtonProps) && isObj(confirmButtonProps) && confirmButtonProps.text) {
214
+ return confirmButtonProps.text as string
215
+ }
216
+ return translate('confirm')
217
+ }
218
+
219
+ /**
220
+ * 获取取消按钮文本
221
+ * 从 cancelButtonProps 获取(快捷属性已在 index.ts 中合并)
222
+ */
223
+ function getCancelText(): string {
224
+ const { cancelButtonProps } = dialogState
225
+ if (isString(cancelButtonProps)) {
226
+ return cancelButtonProps
227
+ }
228
+ if (isDef(cancelButtonProps) && isObj(cancelButtonProps) && cancelButtonProps.text) {
229
+ return cancelButtonProps.text as string
230
+ }
231
+ return translate('cancel')
232
+ }
233
+
234
+ /**
235
+ * 是否显示取消按钮
236
+ * cancelButtonProps 为 null 时隐藏,有值时显示(快捷属性已在 index.ts 中合并)
237
+ */
238
+ const showCancelButton = computed(() => {
239
+ return isDef(dialogState.cancelButtonProps)
240
+ })
241
+
242
+ /**
243
+ * 是否显示确认按钮
244
+ * confirmButtonProps 为 null 时隐藏,其他情况显示
245
+ */
246
+ const showConfirmButton = computed(() => {
247
+ return isDef(dialogState.confirmButtonProps)
248
+ })
249
+
250
+ /**
251
+ * 输入框属性(排除 modelValue,避免覆盖 v-model)
252
+ */
253
+ const inputPropsWithoutModelValue = computed(() => {
254
+ if (!dialogState.inputProps) return {}
255
+ const { modelValue, ...rest } = dialogState.inputProps
256
+ return rest
257
+ })
258
+
259
+ /**
260
+ * 文本域属性(排除 modelValue,避免覆盖 v-model)
261
+ */
262
+ const textareaPropsWithoutModelValue = computed(() => {
263
+ if (!dialogState.textareaProps) return {}
264
+ const { modelValue, ...rest } = dialogState.textareaProps
265
+ return rest
266
+ })
267
+
268
+ /**
269
+ * 自定义 actions 按钮列表(当 theme 为 text 时强制 variant 为 text)
270
+ */
271
+ const customActions = computed(() => {
272
+ if (!dialogState.actions || !dialogState.actions.length) return []
273
+ return dialogState.actions.map((action) => {
274
+ if (dialogState.theme === 'text') {
275
+ return { ...action, variant: 'text' as ButtonVariant }
276
+ }
277
+ return action
278
+ })
279
+ })
280
+
281
+ /**
282
+ * 从按钮配置中提取用于 v-bind 的 props(排除 openType 事件回调和 click)
283
+ * @param btn 按钮配置
284
+ */
285
+ function getActionButtonProps(btn: DialogAction) {
286
+ const result: Record<string, any> = {}
287
+ for (const key in btn) {
288
+ // 排除 openType 事件回调、click 和 text
289
+ if (!OPEN_TYPE_EVENT_KEYS.includes(key as keyof DialogButtonOpenTypeEvents) && key !== 'click' && key !== 'text') {
290
+ result[key] = (btn as any)[key]
291
+ }
292
+ }
293
+ return result
294
+ }
295
+
296
+ /**
297
+ * 处理 actions 按钮的 openType 事件
298
+ * @param btn 按钮配置
299
+ * @param eventName 事件名
300
+ * @param event 事件详情
301
+ */
302
+ function handleOpenTypeEvent(btn: DialogAction, eventName: keyof DialogButtonOpenTypeEvents, event: any) {
303
+ const handler = btn[eventName]
304
+ if (isFunction(handler)) {
305
+ handler(event)
306
+ }
307
+ }
308
+
309
+ /**
310
+ * 处理确认/取消按钮的 openType 事件
311
+ * @param type 按钮类型
312
+ * @param eventName 事件名
313
+ * @param event 事件详情
314
+ */
315
+ function handleButtonOpenTypeEvent(type: 'confirm' | 'cancel', eventName: keyof DialogButtonOpenTypeEvents, event: any) {
316
+ const buttonProps = type === 'confirm' ? dialogState.confirmButtonProps : dialogState.cancelButtonProps
317
+ if (isDef(buttonProps) && isObj(buttonProps)) {
318
+ const handler = (buttonProps as DialogAction)[eventName]
319
+ if (isFunction(handler)) {
320
+ handler(event)
321
+ }
322
+ }
323
+ }
324
+
325
+ /**
326
+ * 确认按钮属性
327
+ */
328
+ const customConfirmProps = computed(() => {
329
+ const defaultProps: Partial<ButtonProps> = {
330
+ block: true
331
+ }
332
+ let buttonProps: Partial<ButtonProps> = { ...defaultProps }
333
+
334
+ const { confirmButtonProps } = dialogState
335
+
336
+ if (isDef(confirmButtonProps) && isObj(confirmButtonProps)) {
337
+ // 从 confirmButtonProps 中排除 text 属性(text 单独处理为按钮文本)
338
+ const { text, ...restProps } = confirmButtonProps
339
+ buttonProps = deepAssign(buttonProps, omitBy(restProps, isUndefined))
340
+ }
341
+
342
+ // 当 theme 为 text 时,强制 variant 为 text,优先于用户传入的类型
343
+ if (dialogState.theme === 'text') {
344
+ buttonProps.variant = 'text'
345
+ }
346
+
347
+ buttonProps.customClass = `${buttonProps.customClass || ''} wd-dialog__actions-btn wd-dialog__actions-btn--confirm`
348
+ return buttonProps
349
+ })
350
+
351
+ /**
352
+ * 取消按钮属性
353
+ */
354
+ const customCancelProps = computed(() => {
355
+ const defaultProps: Partial<ButtonProps> = {
356
+ block: true,
357
+ type: 'info',
358
+ variant: 'plain'
359
+ }
360
+ let buttonProps: Partial<ButtonProps> = { ...defaultProps }
361
+
362
+ const { cancelButtonProps } = dialogState
363
+
364
+ if (isDef(cancelButtonProps) && isObj(cancelButtonProps)) {
365
+ // 从 cancelButtonProps 中排除 text 属性(text 单独处理为按钮文本)
366
+ const { text, ...restProps } = cancelButtonProps
367
+ buttonProps = deepAssign(buttonProps, omitBy(restProps, isUndefined))
368
+ }
369
+
370
+ // 当 theme 为 text 时,强制 variant 为 text,优先于用户传入的类型
371
+ if (dialogState.theme === 'text') {
372
+ buttonProps.variant = 'text'
373
+ }
374
+
375
+ buttonProps.customClass = `${buttonProps.customClass || ''} wd-dialog__actions-btn`
376
+ return buttonProps
377
+ })
378
+
379
+ // 监听options变化展示
380
+ watch(
381
+ () => messageOption.value,
382
+ (newVal: DialogOptionsWithCallBack) => {
383
+ reset(newVal)
384
+ },
385
+ {
386
+ deep: true,
387
+ immediate: true
388
+ }
389
+ )
390
+
391
+ watch(
392
+ () => dialogState.show,
393
+ (newValue) => {
394
+ resetErr(!!newValue)
395
+ },
396
+ {
397
+ deep: true,
398
+ immediate: true
399
+ }
400
+ )
401
+
402
+ /**
403
+ * 点击操作
404
+ * @param action
405
+ */
406
+ function toggleModal(action: 'confirm' | 'cancel' | 'modal') {
407
+ if (action === 'modal' && !dialogState.closeOnClickModal) {
408
+ return
409
+ }
410
+ if (dialogState.type === 'prompt' && action === 'confirm' && !validate()) {
411
+ return
412
+ }
413
+ switch (action) {
414
+ case 'confirm':
415
+ if (dialogState.beforeConfirm) {
416
+ callInterceptor(dialogState.beforeConfirm as DialogBeforeConfirm, {
417
+ args: [inputVal.value],
418
+ done: () =>
419
+ handleConfirm({
420
+ action: action,
421
+ value: inputVal.value
422
+ })
423
+ })
424
+ } else {
425
+ handleConfirm({
426
+ action: action,
427
+ value: inputVal.value
428
+ })
429
+ }
430
+ break
431
+ case 'cancel':
432
+ handleCancel({
433
+ action: action
434
+ })
435
+ break
436
+ default:
437
+ handleCancel({
438
+ action: 'modal'
439
+ })
440
+ break
441
+ }
442
+ }
443
+
444
+ /**
445
+ * @description 处理自定义动作按钮点击
446
+ * @param action 按钮配置
447
+ * @param index 索引
448
+ */
449
+ function handleAction(action: any, index: number) {
450
+ if (action.disabled || action.loading) return
451
+
452
+ // 如果提供了点击回调
453
+ if (isFunction(action.click)) {
454
+ action.click()
455
+ }
456
+
457
+ // 默认关闭弹窗,除非显式指定不关闭(暂未支持 preventClose 属性,默认关闭)
458
+ // 也可以扩展:如果 click 返回 false,则不关闭
459
+ handleConfirm({
460
+ action: 'confirm', // 或者新增 'action' 类型?但 Types 里 action 是必须的且枚举。
461
+ // 为了兼容,这里仍返回 confirm 或者是 context?
462
+ // 稍微 hack 一下,actions 场景下通常用户自己在 click 里处理了业务,这里主要是利用 confirm 回调来关闭
463
+ value: inputVal.value
464
+ })
465
+ }
466
+
467
+ /**
468
+ * 确认回调
469
+ * @param result
470
+ */
471
+ function handleConfirm(result: DialogResult) {
472
+ dialogState.show = false
473
+ if (isFunction(dialogState.success)) {
474
+ dialogState.success(result)
475
+ }
476
+ }
477
+
478
+ /**
479
+ * 取消回调
480
+ * @param result
481
+ */
482
+ function handleCancel(result: DialogResult) {
483
+ dialogState.show = false
484
+ if (isFunction(dialogState.fail)) {
485
+ dialogState.fail(result)
486
+ }
487
+ }
488
+
489
+ /**
490
+ * 如果存在校验规则行为,则进行判断校验是否通过规则。默认不存在校验直接铜鼓。
491
+ */
492
+ function validate() {
493
+ if (dialogState.inputPattern && !dialogState.inputPattern.test(String(inputVal.value))) {
494
+ dialogState.showErr = true
495
+ return false
496
+ }
497
+ if (isFunction(dialogState.inputValidate)) {
498
+ const validateResult = dialogState.inputValidate(inputVal.value!)
499
+ if (!validateResult) {
500
+ dialogState.showErr = true
501
+ return false
502
+ }
503
+ }
504
+ dialogState.showErr = false
505
+ return true
506
+ }
507
+
508
+ /**
509
+ * @description show关闭时,销毁错误提示
510
+ * @param val
511
+ */
512
+ function resetErr(val: boolean) {
513
+ if (val === false) {
514
+ dialogState.showErr = false
515
+ }
516
+ }
517
+
518
+ watch(
519
+ () => inputVal.value,
520
+ (val) => {
521
+ if (val === '') {
522
+ dialogState.showErr = false
523
+ }
524
+ }
525
+ )
526
+
527
+ /**
528
+ * 重置message选项值
529
+ * @param option message选项值
530
+ */
531
+ function reset(option: DialogOptionsWithCallBack) {
532
+ if (option) {
533
+ dialogState.title = isDef(option.title) ? option.title : ''
534
+ dialogState.show = option.show
535
+ dialogState.closeOnClickModal = option.closeOnClickModal
536
+ dialogState.msg = option.msg
537
+ dialogState.type = option.type
538
+ dialogState.inputProps = option.inputProps
539
+ dialogState.textareaProps = option.textareaProps
540
+ // 初始化 inputVal,优先级:inputValue > textareaProps.modelValue > inputProps.modelValue
541
+ if (isDef(option.inputValue)) {
542
+ inputVal.value = option.inputValue!
543
+ } else if (option.textareaProps && isDef(option.textareaProps.modelValue)) {
544
+ inputVal.value = option.textareaProps.modelValue!
545
+ } else if (option.inputProps && isDef(option.inputProps.modelValue)) {
546
+ inputVal.value = option.inputProps.modelValue!
547
+ } else {
548
+ inputVal.value = ''
549
+ }
550
+
551
+ dialogState.inputPattern = option.inputPattern!
552
+ dialogState.inputValidate = option.inputValidate
553
+ dialogState.success = option.success
554
+ dialogState.fail = option.fail
555
+ dialogState.beforeConfirm = option.beforeConfirm
556
+ dialogState.inputError = option.inputError
557
+ dialogState.showErr = option.showErr
558
+ dialogState.zIndex = option.zIndex
559
+ dialogState.lazyRender = option.lazyRender
560
+ // 按钮配置(快捷属性已在 index.ts 中合并)
561
+ dialogState.confirmButtonProps = option.confirmButtonProps
562
+ dialogState.cancelButtonProps = option.cancelButtonProps
563
+ dialogState.headerImage = option.headerImage
564
+ // 图标配置(快捷属性已在 index.ts 中合并到 iconProps)
565
+ // 处理内置图标类型映射
566
+ const iconName = option.iconProps?.name || option.icon
567
+ if (iconName && iconName in DIALOG_BUILTIN_ICON_MAP) {
568
+ const builtinIcon = DIALOG_BUILTIN_ICON_MAP[iconName as DialogBuiltinIconType]
569
+ dialogState.iconProps = { ...option.iconProps, name: builtinIcon }
570
+ iconType.value = iconName // 记录内置类型用于添加 class
571
+ } else {
572
+ dialogState.iconProps = option.iconProps
573
+ iconType.value = '' // 非内置类型,使用默认样式
574
+ }
575
+ dialogState.showClose = option.showClose
576
+ dialogState.actionLayout = option.actionLayout
577
+ dialogState.theme = option.theme
578
+ // 自定义操作按钮
579
+ dialogState.actions = option.actions
580
+ }
581
+ }
582
+ </script>
583
+
584
+ <style lang="scss">
585
+ @use './index.scss';
586
+ </style>
@@ -0,0 +1,122 @@
1
+ @use '../../styles/mixin/mixin' as *;
2
+ @use '../../styles/variable.scss' as *;
3
+
4
+ // 默认文字颜色
5
+ $divider-color-default: var(--wot-divider-color-default, $text-auxiliary) !default;
6
+ // 分割线颜色
7
+ $divider-color-line: var(--wot-divider-color-line, $border-main) !default;
8
+ // 组件水平内边距
9
+ $divider-padding: var(--wot-divider-padding, $padding-zero $padding-extra-loose) !default;
10
+ // 组件垂直外边距
11
+ $divider-margin: var(--wot-divider-margin, $spacing-extra-loose $spacing-zero) !default;
12
+ // 分割线厚度
13
+ $divider-line-height: var(--wot-divider-line-height, $n-3) !default;
14
+ // 内容文字行高
15
+ $divider-size-line-height: var(--wot-divider-size-line-height, $typography-body-line--height-size-main) !default;
16
+ // 纵向分割线高度
17
+ $divider-size-vertical-height: var(--wot-divider-size-vertical-height, $spacing-extra-loose) !default;
18
+ // 纵向分割线宽度
19
+ $divider-size-vertical-line-width: var(--wot-divider-size-vertical-line-width, $n-3) !default;
20
+ // 左对齐模式左侧线段宽度
21
+ $divider-size-content-left-width: var(--wot-divider-size-content-left-width, 10%) !default;
22
+ // 右对齐模式右侧线段宽度
23
+ $divider-size-content-right-width: var(--wot-divider-size-content-right-width, 10%) !default;
24
+ // 默认文字字号
25
+ $divider-font-size-default: var(--wot-divider-font-size-default, $typography-body-size-main) !default;
26
+ // 默认外边距
27
+ $divider-margin-default: var(--wot-divider-margin-default, $spacing-extra-loose) !default;
28
+ // 纵向模式内容间距
29
+ $divider-margin-vertical-content: var(--wot-divider-margin-vertical-content, $spacing-tight) !default;
30
+ // 内容左侧间距
31
+ $divider-margin-content-left: var(--wot-divider-margin-content-left, $spacing-loose) !default;
32
+ // 内容右侧间距
33
+ $divider-margin-content-right: var(--wot-divider-margin-content-right, $spacing-loose) !default;
34
+ // 默认内边距
35
+ $divider-padding-default: var(--wot-divider-padding-default, $spacing-zero) !default;
36
+
37
+ @include b(divider) {
38
+ position: relative;
39
+ display: flex;
40
+ padding: $divider-padding;
41
+ margin: $divider-margin;
42
+ align-items: center;
43
+ color: $divider-color-default;
44
+ font-size: $divider-font-size-default;
45
+
46
+ &::after,
47
+ &::before {
48
+ flex: 1;
49
+ display: block;
50
+ box-sizing: border-box;
51
+ border-style: solid;
52
+ border-color: $divider-color-line;
53
+ border-width: $divider-line-height 0 0;
54
+ }
55
+
56
+ &::before {
57
+ content: '';
58
+ }
59
+
60
+ @include m(center, left, right) {
61
+ &::after {
62
+ content: '';
63
+ margin-left: $divider-margin-content-left;
64
+ }
65
+
66
+ &::before {
67
+ margin-right: $divider-margin-content-right;
68
+ }
69
+ }
70
+
71
+ @include m(left) {
72
+ &::before {
73
+ max-width: $divider-size-content-left-width;
74
+ }
75
+ }
76
+
77
+ @include m(right) {
78
+ &::after {
79
+ max-width: $divider-size-content-right-width;
80
+ }
81
+ }
82
+
83
+ @include when(hairline) {
84
+
85
+ &::before,
86
+ &::after {
87
+ transform: scaleY(0.5);
88
+ }
89
+ }
90
+
91
+ @include when(dashed) {
92
+
93
+ &::before,
94
+ &::after {
95
+ border-style: dashed;
96
+ }
97
+ }
98
+
99
+ @include m(vertical) {
100
+ display: inline-block;
101
+ width: $divider-size-vertical-line-width;
102
+ height: $divider-size-vertical-height;
103
+ margin: $spacing-zero $divider-margin-vertical-content;
104
+ padding: $padding-zero;
105
+ vertical-align: middle;
106
+
107
+ &::before {
108
+ height: 100%;
109
+ border-width: 0 0 0 $divider-size-vertical-line-width;
110
+ }
111
+
112
+ &::after {
113
+ display: none;
114
+ }
115
+
116
+ @include when(hairline) {
117
+ &::before {
118
+ transform: scaleX(0.5);
119
+ }
120
+ }
121
+ }
122
+ }