@tdesign/uniapp 0.0.1-alpha.1 → 0.7.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 (700) hide show
  1. package/CHANGELOG.md +204 -0
  2. package/LICENSE +9 -0
  3. package/README.md +144 -0
  4. package/dist/.eslintrc.js +30 -0
  5. package/dist/action-sheet/README.en-US.md +60 -0
  6. package/dist/action-sheet/README.md +131 -0
  7. package/dist/action-sheet/action-sheet.css +162 -0
  8. package/dist/action-sheet/action-sheet.vue +350 -0
  9. package/dist/action-sheet/computed.js +15 -0
  10. package/dist/action-sheet/index.d.ts +11 -0
  11. package/dist/action-sheet/index.js +13 -0
  12. package/dist/action-sheet/props.ts +86 -0
  13. package/dist/action-sheet/show.d.ts +28 -0
  14. package/dist/action-sheet/show.js +33 -0
  15. package/dist/action-sheet/type.ts +93 -0
  16. package/dist/avatar/README.en-US.md +102 -0
  17. package/dist/avatar/README.md +152 -0
  18. package/dist/avatar/avatar.css +77 -0
  19. package/dist/avatar/avatar.vue +200 -0
  20. package/dist/avatar/computed.js +30 -0
  21. package/dist/avatar/props.ts +54 -0
  22. package/dist/avatar/type.ts +58 -0
  23. package/dist/avatar-group/avatar-group.css +187 -0
  24. package/dist/avatar-group/avatar-group.vue +121 -0
  25. package/dist/avatar-group/props.ts +44 -0
  26. package/dist/avatar-group/type.ts +38 -0
  27. package/dist/back-top/README.en-US.md +49 -0
  28. package/dist/back-top/README.md +67 -0
  29. package/dist/back-top/back-top.css +65 -0
  30. package/dist/back-top/back-top.vue +122 -0
  31. package/dist/back-top/props.ts +48 -0
  32. package/dist/back-top/type.ts +42 -0
  33. package/dist/badge/README.en-US.md +54 -0
  34. package/dist/badge/README.md +85 -0
  35. package/dist/badge/badge.css +140 -0
  36. package/dist/badge/badge.vue +134 -0
  37. package/dist/badge/computed.js +63 -0
  38. package/dist/badge/props.ts +55 -0
  39. package/dist/badge/type.ts +60 -0
  40. package/dist/button/README.en-US.md +238 -0
  41. package/dist/button/README.md +229 -0
  42. package/dist/button/button.css +514 -0
  43. package/dist/button/button.vue +244 -0
  44. package/dist/button/props.ts +207 -0
  45. package/dist/button/type.ts +192 -0
  46. package/dist/calendar/README.en-US.md +63 -0
  47. package/dist/calendar/README.md +113 -0
  48. package/dist/calendar/calendar-header.props.js +42 -0
  49. package/dist/calendar/calendar-header.vue +98 -0
  50. package/dist/calendar/calendar.css +205 -0
  51. package/dist/calendar/calendar.vue +454 -0
  52. package/dist/calendar/computed.js +42 -0
  53. package/dist/calendar/props.ts +113 -0
  54. package/dist/calendar/template.props.js +57 -0
  55. package/dist/calendar/template.vue +261 -0
  56. package/dist/calendar/type.ts +141 -0
  57. package/dist/calendar/utils.js +16 -0
  58. package/dist/cascader/README.en-US.md +56 -0
  59. package/dist/cascader/README.md +96 -0
  60. package/dist/cascader/cascader.css +102 -0
  61. package/dist/cascader/cascader.vue +519 -0
  62. package/dist/cascader/props.ts +73 -0
  63. package/dist/cascader/type.ts +77 -0
  64. package/dist/cell/README.en-US.md +116 -0
  65. package/dist/cell/README.md +147 -0
  66. package/dist/cell/cell.css +94 -0
  67. package/dist/cell/cell.vue +260 -0
  68. package/dist/cell/props.ts +87 -0
  69. package/dist/cell/type.ts +82 -0
  70. package/dist/cell-group/cell-group.css +44 -0
  71. package/dist/cell-group/cell-group.vue +69 -0
  72. package/dist/cell-group/props.ts +25 -0
  73. package/dist/cell-group/type.ts +23 -0
  74. package/dist/check-tag/check-tag.css +197 -0
  75. package/dist/check-tag/check-tag.vue +149 -0
  76. package/dist/check-tag/props.ts +67 -0
  77. package/dist/check-tag/type.ts +63 -0
  78. package/dist/checkbox/README.en-US.md +103 -0
  79. package/dist/checkbox/README.md +158 -0
  80. package/dist/checkbox/checkbox.css +174 -0
  81. package/dist/checkbox/checkbox.vue +238 -0
  82. package/dist/checkbox/props.ts +90 -0
  83. package/dist/checkbox/type.ts +96 -0
  84. package/dist/checkbox-group/checkbox-group.css +0 -0
  85. package/dist/checkbox-group/checkbox-group.vue +261 -0
  86. package/dist/checkbox-group/props.ts +58 -0
  87. package/dist/checkbox-group/type.ts +72 -0
  88. package/dist/col/README.en-US.md +31 -0
  89. package/dist/col/README.md +60 -0
  90. package/dist/col/col.css +149 -0
  91. package/dist/col/col.vue +58 -0
  92. package/dist/col/computed.js +14 -0
  93. package/dist/col/props.ts +16 -0
  94. package/dist/col/type.ts +16 -0
  95. package/dist/collapse/README.en-US.md +82 -0
  96. package/dist/collapse/README.md +119 -0
  97. package/dist/collapse/collapse.css +5 -0
  98. package/dist/collapse/collapse.vue +119 -0
  99. package/dist/collapse/props.ts +42 -0
  100. package/dist/collapse/type.ts +46 -0
  101. package/dist/collapse-panel/collapse-panel.css +154 -0
  102. package/dist/collapse-panel/collapse-panel.vue +238 -0
  103. package/dist/collapse-panel/props.ts +48 -0
  104. package/dist/collapse-panel/type.ts +41 -0
  105. package/dist/color-picker/README.en-US.md +62 -0
  106. package/dist/color-picker/README.md +110 -0
  107. package/dist/color-picker/color-picker.css +271 -0
  108. package/dist/color-picker/color-picker.vue +501 -0
  109. package/dist/color-picker/constants.ts +26 -0
  110. package/dist/color-picker/props.ts +75 -0
  111. package/dist/color-picker/template.props.js +58 -0
  112. package/dist/color-picker/template.vue +198 -0
  113. package/dist/color-picker/type.ts +96 -0
  114. package/dist/color-picker/utils.js +1 -0
  115. package/dist/common/bus.js +84 -0
  116. package/dist/common/canvas/index.js +53 -0
  117. package/dist/common/common.ts +173 -0
  118. package/dist/common/config.js +9 -0
  119. package/dist/common/dom/index.js +1 -0
  120. package/dist/common/dom/select-component.js +26 -0
  121. package/dist/common/event/dynamic.js +10 -0
  122. package/dist/common/functional/mixin.js +51 -0
  123. package/dist/common/relation/index.js +6 -0
  124. package/dist/common/relation/parent-map.js +26 -0
  125. package/dist/common/relation/relation.js +213 -0
  126. package/dist/common/route.js +13 -0
  127. package/dist/common/runtime/index.js +5 -0
  128. package/dist/common/runtime/relation.js +0 -0
  129. package/dist/common/runtime/wxs-polyfill.js +16 -0
  130. package/dist/common/shared/calendar/index.js +128 -0
  131. package/dist/common/shared/calendar/type.ts +14 -0
  132. package/dist/common/shared/color-picker/cmyk.js +78 -0
  133. package/dist/common/shared/color-picker/color.js +428 -0
  134. package/dist/common/shared/color-picker/gradient.js +180 -0
  135. package/dist/common/shared/color-picker/index.js +3 -0
  136. package/dist/common/shared/date.js +46 -0
  137. package/dist/common/shared/qrcode/qrcodegen.js +884 -0
  138. package/dist/common/shared/qrcode/utils.js +124 -0
  139. package/dist/common/src/control.js +66 -0
  140. package/dist/common/src/flatTool.js +99 -0
  141. package/dist/common/src/index.js +4 -0
  142. package/dist/common/src/instantiationDecorator.js +251 -0
  143. package/dist/common/src/superComponent.js +5 -0
  144. package/dist/common/style/_variables.less +232 -0
  145. package/dist/common/style/base.less +4 -0
  146. package/dist/common/style/icons.css +0 -0
  147. package/dist/common/style/index.css +13 -0
  148. package/dist/common/style/mixins/_border.less +34 -0
  149. package/dist/common/style/mixins/_clearfix.less +7 -0
  150. package/dist/common/style/mixins/_cursor.less +6 -0
  151. package/dist/common/style/mixins/_ellipsis.less +15 -0
  152. package/dist/common/style/mixins/_hairline.less +55 -0
  153. package/dist/common/style/mixins/_index.less +6 -0
  154. package/dist/common/style/mixins/_other.less +14 -0
  155. package/dist/common/style/theme/index.css +519 -0
  156. package/dist/common/style/theme/index.less +11 -0
  157. package/dist/common/style/theme/raw/_components.less +30 -0
  158. package/dist/common/style/theme/raw/_dark.less +178 -0
  159. package/dist/common/style/theme/raw/_font.less +90 -0
  160. package/dist/common/style/theme/raw/_light.less +182 -0
  161. package/dist/common/style/theme/raw/_radius.less +10 -0
  162. package/dist/common/style/theme/raw/_spacer.less +11 -0
  163. package/dist/common/style/utilities/index.css +13 -0
  164. package/dist/common/utils.js +358 -0
  165. package/dist/common/utils.wxs.js +139 -0
  166. package/dist/common/validator.js +38 -0
  167. package/dist/common/version.js +66 -0
  168. package/dist/common/wechat.js +22 -0
  169. package/dist/count-down/README.en-US.md +50 -0
  170. package/dist/count-down/README.md +76 -0
  171. package/dist/count-down/computed.js +3 -0
  172. package/dist/count-down/count-down.css +110 -0
  173. package/dist/count-down/count-down.vue +166 -0
  174. package/dist/count-down/props.ts +62 -0
  175. package/dist/count-down/type.ts +64 -0
  176. package/dist/count-down/utils.js +72 -0
  177. package/dist/date-time-picker/README.en-US.md +61 -0
  178. package/dist/date-time-picker/README.md +105 -0
  179. package/dist/date-time-picker/date-time-picker.css +4 -0
  180. package/dist/date-time-picker/date-time-picker.vue +570 -0
  181. package/dist/date-time-picker/locale/dayjs.js +81 -0
  182. package/dist/date-time-picker/locale/en.js +12 -0
  183. package/dist/date-time-picker/locale/ja.js +12 -0
  184. package/dist/date-time-picker/locale/ko.js +12 -0
  185. package/dist/date-time-picker/locale/ru.js +12 -0
  186. package/dist/date-time-picker/locale/tc.js +12 -0
  187. package/dist/date-time-picker/locale/zh.js +12 -0
  188. package/dist/date-time-picker/props.ts +114 -0
  189. package/dist/date-time-picker/type.ts +134 -0
  190. package/dist/demo/demo.vue +97 -0
  191. package/dist/demo/index.css +46 -0
  192. package/dist/demo-header/demo-header.vue +60 -0
  193. package/dist/demo-header/index.css +0 -0
  194. package/dist/demo-navbar/demo-navbar.vue +42 -0
  195. package/dist/dialog/README.en-US.md +69 -0
  196. package/dist/dialog/README.md +120 -0
  197. package/dist/dialog/computed.js +15 -0
  198. package/dist/dialog/dialog.css +102 -0
  199. package/dist/dialog/dialog.vue +422 -0
  200. package/dist/dialog/index.d.ts +42 -0
  201. package/dist/dialog/index.js +90 -0
  202. package/dist/dialog/props.ts +94 -0
  203. package/dist/dialog/type.ts +97 -0
  204. package/dist/divider/README.en-US.md +40 -0
  205. package/dist/divider/README.md +64 -0
  206. package/dist/divider/divider.css +56 -0
  207. package/dist/divider/divider.vue +79 -0
  208. package/dist/divider/props.ts +33 -0
  209. package/dist/divider/type.ts +27 -0
  210. package/dist/draggable/draggable.css +16 -0
  211. package/dist/draggable/draggable.vue +92 -0
  212. package/dist/draggable/props.js +19 -0
  213. package/dist/drawer/README.en-US.md +54 -0
  214. package/dist/drawer/README.md +80 -0
  215. package/dist/drawer/drawer.css +62 -0
  216. package/dist/drawer/drawer.vue +144 -0
  217. package/dist/drawer/props.ts +72 -0
  218. package/dist/drawer/type.ts +81 -0
  219. package/dist/dropdown-item/computed.js +6 -0
  220. package/dist/dropdown-item/dropdown-item.css +97 -0
  221. package/dist/dropdown-item/dropdown-item.vue +403 -0
  222. package/dist/dropdown-item/props.ts +71 -0
  223. package/dist/dropdown-item/type.ts +76 -0
  224. package/dist/dropdown-menu/README.en-US.md +95 -0
  225. package/dist/dropdown-menu/README.md +125 -0
  226. package/dist/dropdown-menu/dropdown-menu.css +59 -0
  227. package/dist/dropdown-menu/dropdown-menu.vue +188 -0
  228. package/dist/dropdown-menu/props.ts +44 -0
  229. package/dist/dropdown-menu/type.ts +41 -0
  230. package/dist/empty/README.en-US.md +39 -0
  231. package/dist/empty/README.md +69 -0
  232. package/dist/empty/empty.css +21 -0
  233. package/dist/empty/empty.vue +140 -0
  234. package/dist/empty/props.ts +20 -0
  235. package/dist/empty/type.ts +20 -0
  236. package/dist/fab/README.en-US.md +37 -0
  237. package/dist/fab/README.md +81 -0
  238. package/dist/fab/fab.css +9 -0
  239. package/dist/fab/fab.vue +238 -0
  240. package/dist/fab/props.ts +54 -0
  241. package/dist/fab/type.ts +57 -0
  242. package/dist/footer/README.en-US.md +33 -0
  243. package/dist/footer/README.md +61 -0
  244. package/dist/footer/footer.css +47 -0
  245. package/dist/footer/footer.vue +117 -0
  246. package/dist/footer/props.ts +23 -0
  247. package/dist/footer/type.ts +34 -0
  248. package/dist/form/README.en-US.md +137 -0
  249. package/dist/form/README.md +146 -0
  250. package/dist/form/form-item-props.ts +56 -0
  251. package/dist/form/form.css +169 -0
  252. package/dist/form/form.vue +287 -0
  253. package/dist/form/props.ts +109 -0
  254. package/dist/form/type.ts +387 -0
  255. package/dist/form-item/README.en-US.md +37 -0
  256. package/dist/form-item/README.md +37 -0
  257. package/dist/form-item/form-item.css +120 -0
  258. package/dist/form-item/form-item.vue +396 -0
  259. package/dist/form-item/form-model.ts +198 -0
  260. package/dist/form-item/props.ts +64 -0
  261. package/dist/form-item/type.ts +7 -0
  262. package/dist/grid/README.en-US.md +92 -0
  263. package/dist/grid/README.md +143 -0
  264. package/dist/grid/grid.css +13 -0
  265. package/dist/grid/grid.vue +94 -0
  266. package/dist/grid/props.ts +43 -0
  267. package/dist/grid/type.ts +43 -0
  268. package/dist/grid-item/README.en-US.md +65 -0
  269. package/dist/grid-item/README.md +65 -0
  270. package/dist/grid-item/grid-item.css +103 -0
  271. package/dist/grid-item/grid-item.vue +292 -0
  272. package/dist/grid-item/props.ts +63 -0
  273. package/dist/grid-item/type.ts +56 -0
  274. package/dist/guide/README.en-US.md +103 -0
  275. package/dist/guide/README.md +140 -0
  276. package/dist/guide/content.vue +325 -0
  277. package/dist/guide/guide.css +64 -0
  278. package/dist/guide/guide.vue +544 -0
  279. package/dist/guide/props.ts +98 -0
  280. package/dist/guide/type.ts +174 -0
  281. package/dist/icon/README.en-US.md +32 -0
  282. package/dist/icon/README.md +109 -0
  283. package/dist/icon/icon.css +7073 -0
  284. package/dist/icon/icon.vue +121 -0
  285. package/dist/icon/props.ts +35 -0
  286. package/dist/icon/type.ts +32 -0
  287. package/dist/image/README.en-US.md +51 -0
  288. package/dist/image/README.md +86 -0
  289. package/dist/image/image.css +44 -0
  290. package/dist/image/image.vue +207 -0
  291. package/dist/image/props.ts +71 -0
  292. package/dist/image/type.ts +85 -0
  293. package/dist/image-viewer/README.en-US.md +49 -0
  294. package/dist/image-viewer/README.md +78 -0
  295. package/dist/image-viewer/computed.js +4 -0
  296. package/dist/image-viewer/image-viewer.css +75 -0
  297. package/dist/image-viewer/image-viewer.vue +317 -0
  298. package/dist/image-viewer/props.ts +69 -0
  299. package/dist/image-viewer/type.ts +76 -0
  300. package/dist/indexes/README.en-US.md +76 -0
  301. package/dist/indexes/README.md +105 -0
  302. package/dist/indexes/computed.js +4 -0
  303. package/dist/indexes/indexes-anchor-props.ts +12 -0
  304. package/dist/indexes/indexes.css +50 -0
  305. package/dist/indexes/indexes.vue +371 -0
  306. package/dist/indexes/props.ts +40 -0
  307. package/dist/indexes/type.ts +38 -0
  308. package/dist/indexes-anchor/README.en-US.md +24 -0
  309. package/dist/indexes-anchor/README.md +28 -0
  310. package/dist/indexes-anchor/indexes-anchor.css +49 -0
  311. package/dist/indexes-anchor/indexes-anchor.vue +73 -0
  312. package/dist/indexes-anchor/props.ts +12 -0
  313. package/dist/indexes-anchor/type.ts +12 -0
  314. package/dist/input/README.en-US.md +121 -0
  315. package/dist/input/README.md +190 -0
  316. package/dist/input/computed.js +13 -0
  317. package/dist/input/input.css +161 -0
  318. package/dist/input/input.vue +407 -0
  319. package/dist/input/props.ts +247 -0
  320. package/dist/input/type.ts +237 -0
  321. package/dist/input/utils.js +38 -0
  322. package/dist/link/README.en-US.md +67 -0
  323. package/dist/link/README.md +115 -0
  324. package/dist/link/link.css +118 -0
  325. package/dist/link/link.vue +175 -0
  326. package/dist/link/props.ts +65 -0
  327. package/dist/link/type.ts +62 -0
  328. package/dist/loading/README.en-US.md +49 -0
  329. package/dist/loading/README.md +96 -0
  330. package/dist/loading/loading.css +203 -0
  331. package/dist/loading/loading.vue +157 -0
  332. package/dist/loading/props.ts +68 -0
  333. package/dist/loading/type.ts +70 -0
  334. package/dist/message/README.en-US.md +69 -0
  335. package/dist/message/README.md +105 -0
  336. package/dist/message/config.js +10 -0
  337. package/dist/message/index.d.ts +17 -0
  338. package/dist/message/index.js +39 -0
  339. package/dist/message/message.css +0 -0
  340. package/dist/message/message.interface.ts +30 -0
  341. package/dist/message/message.vue +275 -0
  342. package/dist/message/props.ts +101 -0
  343. package/dist/message/type.ts +101 -0
  344. package/dist/message-item/computed.js +23 -0
  345. package/dist/message-item/index.js +40 -0
  346. package/dist/message-item/message-item.css +63 -0
  347. package/dist/message-item/message-item.vue +353 -0
  348. package/dist/mixins/page-scroll.js +115 -0
  349. package/dist/mixins/skyline.js +12 -0
  350. package/dist/mixins/theme-change.js +16 -0
  351. package/dist/mixins/touch.js +29 -0
  352. package/dist/mixins/transition.js +133 -0
  353. package/dist/mixins/using-custom-navbar.js +38 -0
  354. package/dist/navbar/README.en-US.md +76 -0
  355. package/dist/navbar/README.md +121 -0
  356. package/dist/navbar/navbar.css +106 -0
  357. package/dist/navbar/navbar.vue +293 -0
  358. package/dist/navbar/props.ts +75 -0
  359. package/dist/navbar/type.ts +76 -0
  360. package/dist/notice-bar/README.en-US.md +62 -0
  361. package/dist/notice-bar/README.md +116 -0
  362. package/dist/notice-bar/notice-bar.css +75 -0
  363. package/dist/notice-bar/notice-bar.vue +326 -0
  364. package/dist/notice-bar/props.ts +71 -0
  365. package/dist/notice-bar/type.ts +71 -0
  366. package/dist/npm/dayjs/esm/constant.js +25 -0
  367. package/dist/npm/dayjs/esm/index.js +541 -0
  368. package/dist/npm/dayjs/esm/locale/en.js +12 -0
  369. package/dist/npm/dayjs/esm/locale/ja.js +45 -0
  370. package/dist/npm/dayjs/esm/locale/ko.js +45 -0
  371. package/dist/npm/dayjs/esm/locale/ru.js +99 -0
  372. package/dist/npm/dayjs/esm/locale/zh-cn.js +67 -0
  373. package/dist/npm/dayjs/esm/locale/zh-tw.js +65 -0
  374. package/dist/npm/dayjs/esm/plugin/localeData/index.js +114 -0
  375. package/dist/npm/dayjs/esm/plugin/localizedFormat/index.js +20 -0
  376. package/dist/npm/dayjs/esm/plugin/localizedFormat/utils.js +20 -0
  377. package/dist/npm/dayjs/esm/utils.js +58 -0
  378. package/dist/npm/tinycolor2/esm/tinycolor.js +1180 -0
  379. package/dist/overlay/README.en-US.md +34 -0
  380. package/dist/overlay/README.md +54 -0
  381. package/dist/overlay/overlay.css +17 -0
  382. package/dist/overlay/overlay.vue +105 -0
  383. package/dist/overlay/props.ts +37 -0
  384. package/dist/overlay/type.ts +42 -0
  385. package/dist/picker/README.en-US.md +77 -0
  386. package/dist/picker/README.md +112 -0
  387. package/dist/picker/picker.css +71 -0
  388. package/dist/picker/picker.vue +315 -0
  389. package/dist/picker/props.ts +95 -0
  390. package/dist/picker/type.ts +114 -0
  391. package/dist/picker-item/README.en-US.md +25 -0
  392. package/dist/picker-item/README.md +25 -0
  393. package/dist/picker-item/picker-item.css +32 -0
  394. package/dist/picker-item/picker-item.vue +446 -0
  395. package/dist/picker-item/props.ts +18 -0
  396. package/dist/picker-item/type.ts +23 -0
  397. package/dist/popover/README.en-US.md +55 -0
  398. package/dist/popover/README.md +85 -0
  399. package/dist/popover/popover.css +271 -0
  400. package/dist/popover/popover.vue +352 -0
  401. package/dist/popover/props.ts +58 -0
  402. package/dist/popover/type.ts +61 -0
  403. package/dist/popup/README.en-US.md +53 -0
  404. package/dist/popup/README.md +82 -0
  405. package/dist/popup/computed.js +14 -0
  406. package/dist/popup/popup.css +80 -0
  407. package/dist/popup/popup.vue +141 -0
  408. package/dist/popup/props.ts +67 -0
  409. package/dist/popup/type.ts +72 -0
  410. package/dist/progress/README.en-US.md +52 -0
  411. package/dist/progress/README.md +87 -0
  412. package/dist/progress/computed.js +81 -0
  413. package/dist/progress/progress.css +136 -0
  414. package/dist/progress/progress.vue +259 -0
  415. package/dist/progress/props.ts +55 -0
  416. package/dist/progress/type.ts +50 -0
  417. package/dist/progress/utils.js +19 -0
  418. package/dist/pull-down-refresh/README.en-US.md +60 -0
  419. package/dist/pull-down-refresh/README.md +83 -0
  420. package/dist/pull-down-refresh/props.ts +112 -0
  421. package/dist/pull-down-refresh/pull-down-refresh.css +29 -0
  422. package/dist/pull-down-refresh/pull-down-refresh.vue +366 -0
  423. package/dist/pull-down-refresh/type.ts +118 -0
  424. package/dist/qrcode/README.en-US.md +40 -0
  425. package/dist/qrcode/README.md +97 -0
  426. package/dist/qrcode/components/qrcode-canvas/props.ts +48 -0
  427. package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.css +7 -0
  428. package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.vue +413 -0
  429. package/dist/qrcode/components/qrcode-status/props.ts +22 -0
  430. package/dist/qrcode/components/qrcode-status/qrcode-status.css +25 -0
  431. package/dist/qrcode/components/qrcode-status/qrcode-status.vue +94 -0
  432. package/dist/qrcode/components/qrcode-status/type.ts +25 -0
  433. package/dist/qrcode/hooks/useQRCode.js +25 -0
  434. package/dist/qrcode/props.ts +66 -0
  435. package/dist/qrcode/qrcode.css +31 -0
  436. package/dist/qrcode/qrcode.vue +144 -0
  437. package/dist/qrcode/type.ts +66 -0
  438. package/dist/radio/README.en-US.md +104 -0
  439. package/dist/radio/README.md +148 -0
  440. package/dist/radio/props.ts +86 -0
  441. package/dist/radio/radio.css +177 -0
  442. package/dist/radio/radio.vue +227 -0
  443. package/dist/radio/type.ts +89 -0
  444. package/dist/radio-group/props.ts +68 -0
  445. package/dist/radio-group/radio-group.css +0 -0
  446. package/dist/radio-group/radio-group.vue +205 -0
  447. package/dist/radio-group/type.ts +79 -0
  448. package/dist/rate/README.en-US.md +50 -0
  449. package/dist/rate/README.md +107 -0
  450. package/dist/rate/computed.js +66 -0
  451. package/dist/rate/props.ts +85 -0
  452. package/dist/rate/rate.css +81 -0
  453. package/dist/rate/rate.vue +276 -0
  454. package/dist/rate/type.ts +79 -0
  455. package/dist/result/README.en-US.md +47 -0
  456. package/dist/result/README.md +88 -0
  457. package/dist/result/props.ts +36 -0
  458. package/dist/result/result.css +35 -0
  459. package/dist/result/result.vue +128 -0
  460. package/dist/result/type.ts +31 -0
  461. package/dist/row/computed.js +13 -0
  462. package/dist/row/props.ts +12 -0
  463. package/dist/row/row.css +6 -0
  464. package/dist/row/row.vue +63 -0
  465. package/dist/row/type.ts +12 -0
  466. package/dist/script/postinstall.js +46 -0
  467. package/dist/scroll-view/scroll-view.css +0 -0
  468. package/dist/scroll-view/scroll-view.vue +52 -0
  469. package/dist/search/README.en-US.md +88 -0
  470. package/dist/search/README.md +126 -0
  471. package/dist/search/computed.js +3 -0
  472. package/dist/search/props.ts +171 -0
  473. package/dist/search/search.css +75 -0
  474. package/dist/search/search.vue +285 -0
  475. package/dist/search/type.ts +165 -0
  476. package/dist/side-bar/README.en-US.md +58 -0
  477. package/dist/side-bar/README.md +89 -0
  478. package/dist/side-bar/props.ts +26 -0
  479. package/dist/side-bar/side-bar-item-props.ts +27 -0
  480. package/dist/side-bar/side-bar.css +14 -0
  481. package/dist/side-bar/side-bar.vue +84 -0
  482. package/dist/side-bar/type.ts +24 -0
  483. package/dist/side-bar-item/props.ts +27 -0
  484. package/dist/side-bar-item/side-bar-item.css +66 -0
  485. package/dist/side-bar-item/side-bar-item.vue +168 -0
  486. package/dist/side-bar-item/type.ts +32 -0
  487. package/dist/skeleton/README.en-US.md +44 -0
  488. package/dist/skeleton/README.md +82 -0
  489. package/dist/skeleton/props.ts +41 -0
  490. package/dist/skeleton/skeleton.css +77 -0
  491. package/dist/skeleton/skeleton.vue +211 -0
  492. package/dist/skeleton/type.ts +44 -0
  493. package/dist/slider/README.en-US.md +63 -0
  494. package/dist/slider/README.md +127 -0
  495. package/dist/slider/computed.js +9 -0
  496. package/dist/slider/props.ts +79 -0
  497. package/dist/slider/slider.css +239 -0
  498. package/dist/slider/slider.vue +719 -0
  499. package/dist/slider/tool.js +43 -0
  500. package/dist/slider/type.ts +81 -0
  501. package/dist/step-item/computed.js +4 -0
  502. package/dist/step-item/props.ts +36 -0
  503. package/dist/step-item/step-item.css +182 -0
  504. package/dist/step-item/step-item.vue +175 -0
  505. package/dist/step-item/type.ts +33 -0
  506. package/dist/stepper/README.en-US.md +49 -0
  507. package/dist/stepper/README.md +90 -0
  508. package/dist/stepper/props.ts +88 -0
  509. package/dist/stepper/stepper.css +105 -0
  510. package/dist/stepper/stepper.vue +223 -0
  511. package/dist/stepper/type.ts +79 -0
  512. package/dist/steps/README.en-US.md +99 -0
  513. package/dist/steps/README.md +157 -0
  514. package/dist/steps/props.ts +63 -0
  515. package/dist/steps/steps.css +19 -0
  516. package/dist/steps/steps.vue +122 -0
  517. package/dist/steps/type.ts +44 -0
  518. package/dist/sticky/README.en-US.md +32 -0
  519. package/dist/sticky/README.md +66 -0
  520. package/dist/sticky/props.ts +30 -0
  521. package/dist/sticky/sticky.css +3 -0
  522. package/dist/sticky/sticky.vue +144 -0
  523. package/dist/sticky/type.ts +31 -0
  524. package/dist/swipe-cell/README.en-US.md +29 -0
  525. package/dist/swipe-cell/README.md +66 -0
  526. package/dist/swipe-cell/computed.js +166 -0
  527. package/dist/swipe-cell/props.ts +39 -0
  528. package/dist/swipe-cell/swipe-cell.css +31 -0
  529. package/dist/swipe-cell/swipe-cell.vue +245 -0
  530. package/dist/swipe-cell/type.ts +48 -0
  531. package/dist/swiper/README.en-US.md +89 -0
  532. package/dist/swiper/README.md +139 -0
  533. package/dist/swiper/computed.js +29 -0
  534. package/dist/swiper/props.ts +117 -0
  535. package/dist/swiper/swiper.css +21 -0
  536. package/dist/swiper/swiper.vue +193 -0
  537. package/dist/swiper/type.ts +112 -0
  538. package/dist/swiper-nav/props.ts +49 -0
  539. package/dist/swiper-nav/swiper-nav.css +130 -0
  540. package/dist/swiper-nav/swiper-nav.vue +93 -0
  541. package/dist/swiper-nav/type.ts +45 -0
  542. package/dist/switch/README.en-US.md +70 -0
  543. package/dist/switch/README.md +104 -0
  544. package/dist/switch/props.ts +53 -0
  545. package/dist/switch/switch.css +123 -0
  546. package/dist/switch/switch.vue +122 -0
  547. package/dist/switch/type.ts +51 -0
  548. package/dist/tab-bar/README.en-US.md +58 -0
  549. package/dist/tab-bar/README.md +104 -0
  550. package/dist/tab-bar/props.ts +62 -0
  551. package/dist/tab-bar/tab-bar.css +42 -0
  552. package/dist/tab-bar/tab-bar.vue +141 -0
  553. package/dist/tab-bar/type.ts +56 -0
  554. package/dist/tab-bar-item/props.ts +25 -0
  555. package/dist/tab-bar-item/tab-bar-item.css +117 -0
  556. package/dist/tab-bar-item/tab-bar-item.vue +222 -0
  557. package/dist/tab-bar-item/type.ts +32 -0
  558. package/dist/tab-panel/props.ts +34 -0
  559. package/dist/tab-panel/tab-panel.css +15 -0
  560. package/dist/tab-panel/tab-panel.vue +100 -0
  561. package/dist/tab-panel/type.ts +42 -0
  562. package/dist/tabs/README.en-US.md +89 -0
  563. package/dist/tabs/README.md +198 -0
  564. package/dist/tabs/computed.js +26 -0
  565. package/dist/tabs/props.ts +80 -0
  566. package/dist/tabs/tabs.css +183 -0
  567. package/dist/tabs/tabs.vue +494 -0
  568. package/dist/tabs/type.ts +77 -0
  569. package/dist/tag/README.en-US.md +113 -0
  570. package/dist/tag/README.md +151 -0
  571. package/dist/tag/props.ts +70 -0
  572. package/dist/tag/tag.css +208 -0
  573. package/dist/tag/tag.vue +161 -0
  574. package/dist/tag/type.ts +54 -0
  575. package/dist/tdesign-uniapp/tdesign-uniapp.vue +11 -0
  576. package/dist/textarea/README.en-US.md +78 -0
  577. package/dist/textarea/README.md +132 -0
  578. package/dist/textarea/computed.js +14 -0
  579. package/dist/textarea/props.ts +152 -0
  580. package/dist/textarea/textarea.css +67 -0
  581. package/dist/textarea/textarea.vue +227 -0
  582. package/dist/textarea/type.ts +167 -0
  583. package/dist/toast/README.en-US.md +51 -0
  584. package/dist/toast/README.md +78 -0
  585. package/dist/toast/index.d.ts +20 -0
  586. package/dist/toast/index.js +27 -0
  587. package/dist/toast/props.ts +68 -0
  588. package/dist/toast/toast.css +73 -0
  589. package/dist/toast/toast.vue +213 -0
  590. package/dist/toast/type.ts +64 -0
  591. package/dist/transition/README.en-US.md +13 -0
  592. package/dist/transition/README.md +45 -0
  593. package/dist/transition/props.js +22 -0
  594. package/dist/transition/transition.css +14 -0
  595. package/dist/transition/transition.vue +51 -0
  596. package/dist/tree-select/README.en-US.md +48 -0
  597. package/dist/tree-select/README.md +78 -0
  598. package/dist/tree-select/computed.js +6 -0
  599. package/dist/tree-select/props.ts +42 -0
  600. package/dist/tree-select/tree-select.css +44 -0
  601. package/dist/tree-select/tree-select.vue +319 -0
  602. package/dist/tree-select/type.ts +49 -0
  603. package/dist/tsconfig.eslint.json +13 -0
  604. package/dist/types/action-sheet.d.ts +7 -0
  605. package/dist/types/avatar-group.d.ts +7 -0
  606. package/dist/types/avatar.d.ts +7 -0
  607. package/dist/types/back-top.d.ts +7 -0
  608. package/dist/types/badge.d.ts +7 -0
  609. package/dist/types/button.d.ts +7 -0
  610. package/dist/types/calendar.d.ts +7 -0
  611. package/dist/types/cascader.d.ts +7 -0
  612. package/dist/types/cell-group.d.ts +7 -0
  613. package/dist/types/cell.d.ts +7 -0
  614. package/dist/types/check-tag.d.ts +7 -0
  615. package/dist/types/checkbox-group.d.ts +7 -0
  616. package/dist/types/checkbox.d.ts +7 -0
  617. package/dist/types/col.d.ts +7 -0
  618. package/dist/types/collapse-panel.d.ts +7 -0
  619. package/dist/types/collapse.d.ts +7 -0
  620. package/dist/types/color-picker.d.ts +7 -0
  621. package/dist/types/count-down.d.ts +7 -0
  622. package/dist/types/date-time-picker.d.ts +7 -0
  623. package/dist/types/dialog.d.ts +7 -0
  624. package/dist/types/divider.d.ts +7 -0
  625. package/dist/types/drawer.d.ts +7 -0
  626. package/dist/types/dropdown-item.d.ts +7 -0
  627. package/dist/types/dropdown-menu.d.ts +7 -0
  628. package/dist/types/empty.d.ts +7 -0
  629. package/dist/types/fab.d.ts +7 -0
  630. package/dist/types/footer.d.ts +7 -0
  631. package/dist/types/form-item.d.ts +7 -0
  632. package/dist/types/form.d.ts +7 -0
  633. package/dist/types/grid-item.d.ts +7 -0
  634. package/dist/types/grid.d.ts +7 -0
  635. package/dist/types/guide.d.ts +7 -0
  636. package/dist/types/icon.d.ts +7 -0
  637. package/dist/types/image-viewer.d.ts +7 -0
  638. package/dist/types/image.d.ts +7 -0
  639. package/dist/types/index.d.ts +77 -0
  640. package/dist/types/indexes-anchor.d.ts +7 -0
  641. package/dist/types/indexes.d.ts +7 -0
  642. package/dist/types/input.d.ts +7 -0
  643. package/dist/types/link.d.ts +7 -0
  644. package/dist/types/loading.d.ts +7 -0
  645. package/dist/types/message.d.ts +7 -0
  646. package/dist/types/navbar.d.ts +7 -0
  647. package/dist/types/notice-bar.d.ts +7 -0
  648. package/dist/types/overlay.d.ts +7 -0
  649. package/dist/types/picker-item.d.ts +7 -0
  650. package/dist/types/picker.d.ts +7 -0
  651. package/dist/types/popup.d.ts +7 -0
  652. package/dist/types/progress.d.ts +7 -0
  653. package/dist/types/pull-down-refresh.d.ts +7 -0
  654. package/dist/types/qrcode.d.ts +7 -0
  655. package/dist/types/radio-group.d.ts +7 -0
  656. package/dist/types/radio.d.ts +7 -0
  657. package/dist/types/rate.d.ts +7 -0
  658. package/dist/types/result.d.ts +7 -0
  659. package/dist/types/row.d.ts +7 -0
  660. package/dist/types/search.d.ts +7 -0
  661. package/dist/types/side-bar-item.d.ts +7 -0
  662. package/dist/types/side-bar.d.ts +7 -0
  663. package/dist/types/skeleton.d.ts +7 -0
  664. package/dist/types/slider.d.ts +7 -0
  665. package/dist/types/step-item.d.ts +7 -0
  666. package/dist/types/stepper.d.ts +7 -0
  667. package/dist/types/steps.d.ts +7 -0
  668. package/dist/types/sticky.d.ts +7 -0
  669. package/dist/types/swipe-cell.d.ts +7 -0
  670. package/dist/types/swiper-nav.d.ts +7 -0
  671. package/dist/types/swiper.d.ts +7 -0
  672. package/dist/types/switch.d.ts +7 -0
  673. package/dist/types/tab-bar-item.d.ts +7 -0
  674. package/dist/types/tab-bar.d.ts +7 -0
  675. package/dist/types/tab-panel.d.ts +7 -0
  676. package/dist/types/tabs.d.ts +7 -0
  677. package/dist/types/tag.d.ts +7 -0
  678. package/dist/types/textarea.d.ts +7 -0
  679. package/dist/types/toast.d.ts +7 -0
  680. package/dist/types/tree-select.d.ts +7 -0
  681. package/dist/types/upload.d.ts +7 -0
  682. package/dist/types/watermark.d.ts +7 -0
  683. package/dist/upload/README.en-US.md +63 -0
  684. package/dist/upload/README.md +116 -0
  685. package/dist/upload/drag.computed.js +227 -0
  686. package/dist/upload/props.ts +136 -0
  687. package/dist/upload/type.ts +197 -0
  688. package/dist/upload/upload.computed.js +13 -0
  689. package/dist/upload/upload.css +116 -0
  690. package/dist/upload/upload.vue +887 -0
  691. package/dist/watermark/README.en-US.md +63 -0
  692. package/dist/watermark/README.md +115 -0
  693. package/dist/watermark/props.ts +82 -0
  694. package/dist/watermark/type.ts +121 -0
  695. package/dist/watermark/utils/generateBase64Url.js +360 -0
  696. package/dist/watermark/utils/randomMovingStyle.js +27 -0
  697. package/dist/watermark/watermark.css +28 -0
  698. package/dist/watermark/watermark.vue +200 -0
  699. package/global.d.ts +84 -0
  700. package/package.json +504 -8
@@ -0,0 +1,31 @@
1
+ /* eslint-disable */
2
+
3
+ /**
4
+ * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5
+ * */
6
+
7
+ export interface TdStickyProps {
8
+ /**
9
+ * 函数返回容器对应的 NodesRef 节点,将对应节点指定为组件的外部容器,滚动时组件会始终保持在容器范围内,当组件即将超出容器底部时,会返回原位置
10
+ */
11
+ container?: Function;
12
+ /**
13
+ * 是否禁用组件
14
+ * @default false
15
+ */
16
+ disabled?: boolean;
17
+ /**
18
+ * 吸顶时与顶部的距离,单位`px`
19
+ * @default 0
20
+ */
21
+ offsetTop?: string | number;
22
+ /**
23
+ * 吸顶时的 z-index
24
+ * @default 99
25
+ */
26
+ zIndex?: number;
27
+ /**
28
+ * 滚动时触发,scrollTop: 距离顶部位置,isFixed: 是否吸顶
29
+ */
30
+ onScroll?: (context: { scrollTop: number; isFixed: boolean }) => void;
31
+ }
@@ -0,0 +1,29 @@
1
+ :: BASE_DOC ::
2
+
3
+ ## API
4
+
5
+ ### SwipeCell Props
6
+
7
+ name | type | default | description | required
8
+ -- | -- | -- | -- | --
9
+ custom-style | Object | - | CSS(Cascading Style Sheets) | N
10
+ disabled | Boolean | - | \- | N
11
+ left | Array | - | Typescript:`Array<SwipeActionItem>` | N
12
+ opened | Boolean / Array | false | Typescript:`boolean \| Array<boolean>` | N
13
+ right | Array | - | Typescript:`Array<SwipeActionItem>` `interface SwipeActionItem {text?: string; icon?: string \| object, className?: string; style?: string; onClick?: () => void; [key: string]: any }`。[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/swipe-cell/type.ts) | N
14
+
15
+ ### SwipeCell Events
16
+
17
+ name | params | description
18
+ -- | -- | --
19
+ click | `(action: SwipeActionItem, source: SwipeSource)` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/swipe-cell/type.ts)。<br/>`type SwipeSource = 'left' \| 'right'`<br/>
20
+ dragend | \- | \-
21
+ dragstart | \- | \-
22
+
23
+ ### SwipeCell Slots
24
+
25
+ name | Description
26
+ -- | --
27
+ \- | \-
28
+ left | \-
29
+ right | \-
@@ -0,0 +1,66 @@
1
+ ---
2
+ title: SwipeCell 滑动操作
3
+ description: 用于承载列表中的更多操作,通过左右滑动来展示,按钮的宽度固定高度根据列表高度而变化。
4
+ spline: message
5
+ isComponent: true
6
+ ---
7
+
8
+
9
+
10
+ ## 引入
11
+
12
+ 可在 `main.ts` 或在需要使用的页面或组件中引入。
13
+
14
+ ```js
15
+ import TSwipeCell from '@tdesign/uniapp/swipe-cell/swipe-cell.vue';
16
+ ```
17
+
18
+ ### 组件类型
19
+
20
+ 左滑单操作
21
+
22
+ {{ left }}
23
+
24
+ 右滑单操作
25
+
26
+ {{ right }}
27
+
28
+ 左右滑操作
29
+
30
+ {{ double }}
31
+
32
+ 带图标的滑动操作
33
+
34
+ {{ icon }}
35
+
36
+ ## FAQ
37
+ ### `SwipeCell` 组件在真机上无法滑动?
38
+ 移除全局配置项: "componentFramework": "glass-easel",详情见: [issue 2524](https://github.com/Tencent/tdesign-miniprogram/issues/2524)。如需使用 `skyline render`,建议页面级粒度开启。
39
+
40
+ ## API
41
+
42
+ ### SwipeCell Props
43
+
44
+ 名称 | 类型 | 默认值 | 描述 | 必传
45
+ -- | -- | -- | -- | --
46
+ custom-style | Object | - | 自定义样式 | N
47
+ disabled | Boolean | - | 是否禁用滑动 | N
48
+ left | Array | - | 左侧滑动操作项。所有行为同 `right`。TS 类型:`Array<SwipeActionItem>` | N
49
+ opened | Boolean / Array | false | 操作项是否呈现为打开态,值为数组时表示分别控制左右滑动的展开和收起状态。TS 类型:`boolean \| Array<boolean>` | N
50
+ right | Array | - | 右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。`right.text` 表示操作文本,`right.className` 表示操作项类名,`right.style` 表示操作项样式,`right.onClick` 表示点击操作项后执行的回调函数。示例:`[{ text: '删除', icon: 'delete', style: 'background-color: red', onClick: () => {} }]`。TS 类型:`Array<SwipeActionItem>` `interface SwipeActionItem {text?: string; icon?: string \| object, className?: string; style?: string; onClick?: () => void; [key: string]: any }`。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/swipe-cell/type.ts) | N
51
+
52
+ ### SwipeCell Events
53
+
54
+ 名称 | 参数 | 描述
55
+ -- | -- | --
56
+ click | `(action: SwipeActionItem, source: SwipeSource)` | 操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/packages/uniapp-components/swipe-cell/type.ts)。<br/>`type SwipeSource = 'left' \| 'right'`<br/>
57
+ dragend | \- | 滑动结束事件
58
+ dragstart | \- | 滑动开始事件
59
+
60
+ ### SwipeCell Slots
61
+
62
+ 名称 | 描述
63
+ -- | --
64
+ \- | 默认插槽,自定义内容区域内容
65
+ left | 左侧滑动操作项
66
+ right | 右侧滑动操作项
@@ -0,0 +1,166 @@
1
+ import _ from '../common/utils.wxs';
2
+
3
+ const THRESHOLD = 0.3;
4
+ const MIN_DISTANCE = 10;
5
+
6
+
7
+ export function initRightWidth() {
8
+ initOpen.call(this, this);
9
+ }
10
+
11
+ export function initLeftWidth() {
12
+ initOpen.call(this, this);
13
+ }
14
+
15
+ function initOpen(context) {
16
+ const { state } = context;
17
+ if (typeof state.opened === 'boolean') {
18
+ // opened 为 boolean 类型,判断默认打开
19
+ if (state.opened && state.rightWidth > 0) {
20
+ swipeMove.call(this, -state.rightWidth);
21
+ } else if (state.opened && state.leftWidth > 0) {
22
+ swipeMove.call(this, state.leftWidth);
23
+ }
24
+ }
25
+
26
+ if (Array.isArray(state.opened)) {
27
+ // opened为array类型,判断默认打开,同时设定左右action时优先打开右边
28
+ if (state.opened[1] && state.rightWidth > 0) {
29
+ swipeMove.call(this, -state.rightWidth);
30
+ } else if (state.opened[0] && state.leftWidth > 0) {
31
+ swipeMove.call(this, state.leftWidth);
32
+ }
33
+ }
34
+ }
35
+
36
+ const resetTouchStatus = function () {
37
+ const { state } = this;
38
+ state.direction = '';
39
+ state.deltaX = 0;
40
+ state.deltaY = 0;
41
+ state.offsetX = 0;
42
+ state.offsetY = 0;
43
+ };
44
+
45
+ const touchMove = function (event) {
46
+ const touchPoint = event.touches[0];
47
+ const { state } = this;
48
+
49
+ state.deltaX = +touchPoint.clientX - state.startX;
50
+ state.deltaY = +touchPoint.clientY - state.startY;
51
+ state.offsetX = Math.abs(state.deltaX);
52
+ state.offsetY = Math.abs(state.deltaY);
53
+ state.direction = state.direction || getDirection(state.offsetX, state.offsetY);
54
+ };
55
+
56
+ const getDirection = function (x, y) {
57
+ if (x > y && x > MIN_DISTANCE) {
58
+ return 'horizontal';
59
+ }
60
+ if (y > x && y > MIN_DISTANCE) {
61
+ return 'vertical';
62
+ }
63
+ return '';
64
+ };
65
+
66
+ const range = function (num, min, max) {
67
+ return Math.min(Math.max(num, min), max);
68
+ };
69
+
70
+ function swipeMove(_offset = 0) {
71
+ const { state } = this;
72
+ state.offset = range(_offset, -state.rightWidth, +state.leftWidth);
73
+ const transform = `translate3d(${state.offset}px, 0, 0)`;
74
+ // const transition = state.dragging ? 'none' : 'transform .6s cubic-bezier(0.18, 0.89, 0.32, 1)';
75
+ const transition = 'transform .6s cubic-bezier(0.18, 0.89, 0.32, 1)';
76
+
77
+ this.wrapperStyle = _._style({
78
+ '-webkit-transform': transform,
79
+ '-webkit-transition': transition,
80
+ transform,
81
+ transition,
82
+ });
83
+ }
84
+
85
+ const close = function () {
86
+ swipeMove.call(this, 0);
87
+ };
88
+
89
+ export function onCloseChange() {
90
+ if (this.closed) {
91
+ close.call(this);
92
+ }
93
+ }
94
+
95
+ export function onOpenedChange() {
96
+ if (!this.state.opened) {
97
+ close.call(this);
98
+ }
99
+ }
100
+
101
+ const touchStart = function (event) {
102
+ resetTouchStatus.call(this);
103
+ const { state } = this;
104
+ state.startOffset = state.offset;
105
+ const touchPoint = event.touches[0];
106
+
107
+ state.startX = touchPoint.clientX;
108
+ state.startY = touchPoint.clientY;
109
+ this.closeOther();
110
+ };
111
+
112
+ export function startDrag(event) {
113
+ this.catchMove();
114
+ touchStart.call(this, event);
115
+ }
116
+
117
+ export function onDrag(event) {
118
+ touchMove.call(this, event);
119
+ const { state } = this;
120
+
121
+ if (state.direction === 'vertical') {
122
+ this.onSkipMove();
123
+ }
124
+ if (state.direction !== 'horizontal') {
125
+ return;
126
+ }
127
+ if (!state.dragging) {
128
+ this.$emit('dragstart');
129
+ }
130
+ state.dragging = true;
131
+ swipeMove.call(this, state.startOffset + state.deltaX);
132
+ return false;
133
+ }
134
+
135
+ const open = function (position) {
136
+ const { state } = this;
137
+ const _offset = position === 'left' ? +state.leftWidth : -state.rightWidth;
138
+ this.open({ position });
139
+ swipeMove.call(this, _offset);
140
+ };
141
+
142
+ export function endDrag() {
143
+ const { state } = this;
144
+ state.dragging = false;
145
+ // 左/右侧有可滑动区域,且当前不是已open状态,且滑动幅度超过阈值时open左/右侧(滚动到该侧的最边上)
146
+ if (
147
+ +state.rightWidth > 0
148
+ && -state.startOffset < +state.rightWidth
149
+ && -state.offset > +state.rightWidth * THRESHOLD
150
+ ) {
151
+ open.call(this, 'right');
152
+ } else if (
153
+ +state.leftWidth > 0
154
+ && state.startOffset < +state.leftWidth
155
+ && state.offset > +state.leftWidth * THRESHOLD
156
+ ) {
157
+ open.call(this, 'left');
158
+ } else {
159
+ // 仅在有发生侧滑的情况下自动关闭(由js控制是否异步关闭)
160
+ if (state.startOffset !== state.offset) {
161
+ close.call(this);
162
+ }
163
+ }
164
+ this.$emit('dragend');
165
+ }
166
+
@@ -0,0 +1,39 @@
1
+ /* eslint-disable */
2
+
3
+ /**
4
+ * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5
+ * */
6
+
7
+ import type { TdSwipeCellProps } from './type';
8
+ export default {
9
+ /** 是否禁用滑动 */
10
+ disabled: Boolean,
11
+ /** 左侧滑动操作项。所有行为同 `right` */
12
+ left: {
13
+ type: Array,
14
+ },
15
+ /** 操作项是否呈现为打开态,值为数组时表示分别控制左右滑动的展开和收起状态 */
16
+ opened: {
17
+ type: [Boolean, Array],
18
+ default: false as TdSwipeCellProps['opened'],
19
+ },
20
+ /** 右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。`right.text` 表示操作文本,`right.className` 表示操作项类名,`right.style` 表示操作项样式,`right.onClick` 表示点击操作项后执行的回调函数。示例:`[{ text: '删除', icon: 'delete', style: 'background-color: red', onClick: () => {} }]` */
21
+ right: {
22
+ type: Array,
23
+ },
24
+ /** 操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件) */
25
+ onClick: {
26
+ type: Function,
27
+ default: () => ({}),
28
+ },
29
+ /** 滑动结束事件 */
30
+ onDragend: {
31
+ type: Function,
32
+ default: () => ({}),
33
+ },
34
+ /** 滑动开始事件 */
35
+ onDragstart: {
36
+ type: Function,
37
+ default: () => ({}),
38
+ },
39
+ };
@@ -0,0 +1,31 @@
1
+ .t-swipe-cell {
2
+ position: relative;
3
+ overflow: hidden;
4
+ }
5
+ .t-swipe-cell__left,
6
+ .t-swipe-cell__right {
7
+ position: absolute;
8
+ top: 0;
9
+ height: 100%;
10
+ }
11
+ .t-swipe-cell__left {
12
+ left: 0;
13
+ transform: translate3d(-100%, 0, 0);
14
+ }
15
+ .t-swipe-cell__right {
16
+ right: 0;
17
+ transform: translate3d(100%, 0, 0);
18
+ }
19
+ .t-swipe-cell__content {
20
+ display: inline-flex;
21
+ justify-content: center;
22
+ align-items: center;
23
+ padding: 0 var(--td-spacer-2, 32rpx);
24
+ }
25
+ :deep(.t-swipe-cell__icon) {
26
+ font-size: var(--td-font-size-xl, 40rpx);
27
+ }
28
+ :deep(.t-swipe-cell__icon) + .t-swipe-cell__text:not(:empty) {
29
+ margin-left: var(--td-spacer, 16rpx);
30
+ font: var(--td-font-body-medium, 28rpx / 44rpx var(--td-font-family, PingFang SC, Microsoft YaHei, Arial Regular));
31
+ }
@@ -0,0 +1,245 @@
1
+ <template>
2
+ <view
3
+ :class="tClass + ' ' + classPrefix"
4
+ :style="tools._style([customStyle])"
5
+ data-key="cell"
6
+ :opened="state.opened"
7
+ :left-width="state.leftWidth"
8
+ :right-width="state.rightWidth"
9
+ @click="onTap"
10
+ @touchstart="parseEventDynamicCode($event, disabled || 'startDrag')"
11
+ @touchmove="parseEventDynamicCode($event, skipMove ? '' : disabled || 'onDrag')"
12
+ @touchend="parseEventDynamicCode($event, skipMove ? '' : disabled || 'endDrag')"
13
+ @touchcancel="parseEventDynamicCode($event, disabled || 'endDrag')"
14
+ >
15
+ <view
16
+ id="wrapper"
17
+ ref="wrapper"
18
+ :style="wrapperStyle"
19
+ >
20
+ <view
21
+ :class="classPrefix + '__left'"
22
+ data-key="left"
23
+ >
24
+ <slot name="left" />
25
+ <view
26
+ v-for="(item, index) in left"
27
+ :key="index"
28
+ :class="classPrefix + '__content ' + item.className"
29
+ :style="item.style"
30
+ :data-action="item"
31
+ @click.stop="onActionTap(item, 'left')"
32
+ >
33
+ <block
34
+ v-if="item.icon"
35
+ >
36
+ <t-icon
37
+ :custom-style="item.icon.style || ''"
38
+ :t-class="classPrefix + '__icon'"
39
+ :prefix="item.icon.prefix"
40
+ :name="item.icon.name || item.icon"
41
+ :size="item.icon.size"
42
+ :color="item.icon.color"
43
+ :aria-hidden="!!item.icon.ariaHidden"
44
+ :aria-label="item.icon.ariaLabel"
45
+ :aria-role="item.icon.ariaRole"
46
+ />
47
+ </block>
48
+
49
+ <text
50
+ v-if="item.text"
51
+ :class="classPrefix + '__text'"
52
+ >
53
+ {{ item.text }}
54
+ </text>
55
+ </view>
56
+ </view>
57
+ <slot />
58
+ <view
59
+ :class="classPrefix + '__right'"
60
+ data-key="right"
61
+ >
62
+ <slot name="right" />
63
+ <view
64
+ v-for="(item, index) in right"
65
+ :key="index"
66
+ :class="classPrefix + '__content ' + item.className"
67
+ :style="item.style"
68
+ :data-action="item"
69
+ @click.stop="onActionTap(item, 'right')"
70
+ >
71
+ <block
72
+ v-if="item.icon"
73
+ >
74
+ <t-icon
75
+ :custom-style="item.icon.style || ''"
76
+ :t-class="classPrefix + '__icon'"
77
+ :prefix="item.icon.prefix"
78
+ :name="item.icon.name || item.icon"
79
+ :size="item.icon.size"
80
+ :color="item.icon.color"
81
+ :aria-hidden="!!item.icon.ariaHidden"
82
+ :aria-label="item.icon.ariaLabel"
83
+ :aria-role="item.icon.ariaRole"
84
+ />
85
+ </block>
86
+
87
+ <text
88
+ v-if="item.text"
89
+ :class="classPrefix + '__text'"
90
+ >
91
+ {{ item.text }}
92
+ </text>
93
+ </view>
94
+ </view>
95
+ </view>
96
+ </view>
97
+ </template>
98
+ <script>
99
+ import TIcon from '../icon/icon';
100
+ import { uniComponent } from '../common/src/index';
101
+ import { prefix } from '../common/config';
102
+ import props from './props';
103
+ import { getRect } from '../common/utils';
104
+ import { getObserver } from '../common/wechat';
105
+ import {
106
+ initLeftWidth,
107
+ initRightWidth,
108
+ startDrag,
109
+ onDrag,
110
+ endDrag,
111
+ onCloseChange,
112
+ onOpenedChange,
113
+ } from './computed';
114
+ import tools from '../common/utils.wxs';
115
+ import { parseEventDynamicCode } from '../common/event/dynamic';
116
+
117
+ let ARRAY = [];
118
+
119
+
120
+ const name = `${prefix}-swipe-cell`;
121
+
122
+ const ContainerClass = `.${name}`;
123
+
124
+ const makeMethods = () => [
125
+ [initLeftWidth, 'initLeftWidth'],
126
+ [initRightWidth, 'initRightWidth'],
127
+ [startDrag, 'startDrag'],
128
+ [onDrag, 'onDrag'],
129
+ [endDrag, 'endDrag'],
130
+ [onCloseChange, 'onCloseChange'],
131
+ [onOpenedChange, 'onOpenedChange'],
132
+ ].reduce((acc, item) => {
133
+ const func = item[0];
134
+ return {
135
+ ...acc,
136
+ [item[1]](...args) {
137
+ func.call(this, ...args);
138
+ },
139
+ };
140
+ }, {});
141
+
142
+
143
+ export default uniComponent({
144
+ name,
145
+ options: {
146
+ styleIsolation: 'shared',
147
+ },
148
+ externalClasses: [
149
+ `${prefix}-class`,
150
+ ],
151
+ components: {
152
+ TIcon,
153
+ },
154
+ props: {
155
+ ...props,
156
+ },
157
+ emits: ['click', 'dragend', 'dragstart'],
158
+ data() {
159
+ return {
160
+ prefix,
161
+ wrapperStyle: '',
162
+ closed: true,
163
+ classPrefix: name,
164
+ skipMove: false,
165
+ tools,
166
+
167
+ state: {
168
+ leftWidth: 0,
169
+ rightWidth: 0,
170
+ offset: 0,
171
+ startOffset: 0,
172
+ opened: this.opened,
173
+ },
174
+ };
175
+ },
176
+ watch: {
177
+ left: 'setSwipeWidth',
178
+ right: 'setSwipeWidth',
179
+ 'state.leftWidth': 'initLeftWidth',
180
+ 'state.rightWidth': 'initRightWidth',
181
+ 'state.opened': 'onOpenedChange',
182
+ opened: {
183
+ handler(v) {
184
+ this.state.opened = v;
185
+ },
186
+ immediate: true,
187
+ },
188
+ },
189
+ mounted() {
190
+ ARRAY.push(this);
191
+ this.setSwipeWidth();
192
+ },
193
+ beforeUnMount() {
194
+ ARRAY = ARRAY.filter(e => e !== this);
195
+ },
196
+ methods: {
197
+ ...makeMethods(),
198
+ parseEventDynamicCode,
199
+ setSwipeWidth() {
200
+ Promise.all([getRect(this, `${ContainerClass}__left`), getRect(this, `${ContainerClass}__right`)]).then(([leftRect, rightRect]) => {
201
+ if (leftRect.width === 0 && rightRect.width === 0 && !this._hasObserved) {
202
+ this._hasObserved = true;
203
+ getObserver(this, `.${name}`).then(() => {
204
+ this.setSwipeWidth();
205
+ });
206
+ }
207
+ this.state.leftWidth = leftRect.width;
208
+ this.state.rightWidth = rightRect.width;
209
+ });
210
+ },
211
+
212
+ onSkipMove() {
213
+ this.skipMove = true;
214
+ },
215
+
216
+ catchMove() {
217
+ this.skipMove = false;
218
+ },
219
+
220
+ open() {
221
+ this.state.opened = true;
222
+ },
223
+
224
+ close() {
225
+ this.state.opened = false;
226
+ },
227
+
228
+ closeOther() {
229
+ ARRAY.filter(item => item !== this).forEach(item => item.close());
230
+ },
231
+
232
+ onTap() {
233
+ this.close();
234
+ },
235
+
236
+ onActionTap(action, source) {
237
+ this.$emit('click', action, source);
238
+ },
239
+ },
240
+ });
241
+ </script>
242
+ <style scoped>
243
+ @import './swipe-cell.css';
244
+
245
+ </style>
@@ -0,0 +1,48 @@
1
+ /* eslint-disable */
2
+
3
+ /**
4
+ * 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5
+ * */
6
+
7
+ export interface TdSwipeCellProps {
8
+ /**
9
+ * 是否禁用滑动
10
+ */
11
+ disabled?: boolean;
12
+ /**
13
+ * 左侧滑动操作项。所有行为同 `right`
14
+ */
15
+ left?: Array<SwipeActionItem>;
16
+ /**
17
+ * 操作项是否呈现为打开态,值为数组时表示分别控制左右滑动的展开和收起状态
18
+ * @default false
19
+ */
20
+ opened?: boolean | Array<boolean>;
21
+ /**
22
+ * 右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。`right.text` 表示操作文本,`right.className` 表示操作项类名,`right.style` 表示操作项样式,`right.onClick` 表示点击操作项后执行的回调函数。示例:`[{ text: '删除', icon: 'delete', style: 'background-color: red', onClick: () => {} }]`
23
+ */
24
+ right?: Array<SwipeActionItem>;
25
+ /**
26
+ * 操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)
27
+ */
28
+ onClick?: (action: SwipeActionItem, source: SwipeSource) => void;
29
+ /**
30
+ * 滑动结束事件
31
+ */
32
+ onDragend?: () => void;
33
+ /**
34
+ * 滑动开始事件
35
+ */
36
+ onDragstart?: () => void;
37
+ }
38
+
39
+ export interface SwipeActionItem {
40
+ text?: string;
41
+ icon?: string | object;
42
+ className?: string;
43
+ style?: string;
44
+ onClick?: () => void;
45
+ [key: string]: any;
46
+ }
47
+
48
+ export type SwipeSource = 'left' | 'right';