plain-design 1.0.0-beta.4 → 1.0.0-beta.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (318) hide show
  1. package/dist/plain-design.commonjs.min.js +3 -3
  2. package/dist/plain-design.min.css +37 -29
  3. package/dist/plain-design.min.js +3 -3
  4. package/dist/report.html +5 -5
  5. package/package.json +9 -8
  6. package/src/packages/build.ts +2 -10
  7. package/src/packages/components/$object/createObjectService.tsx +31 -20
  8. package/src/packages/components/$object/object.service.utils.ts +7 -3
  9. package/src/packages/components/$previewer/ImagePreviewerFixedContainer.tsx +108 -0
  10. package/src/packages/components/$previewer/image-previewer-fixed-container.scss +18 -0
  11. package/src/packages/components/$previewer/index.tsx +52 -0
  12. package/src/packages/components/Alert/alert.scss +3 -3
  13. package/src/packages/components/Application/service/useApplicationService.tsx +2 -0
  14. package/src/packages/components/Application/theme/theme.ts +3 -3
  15. package/src/packages/components/ArrowStepGroup/arrow-step.scss +4 -4
  16. package/src/packages/components/AutoTable/filter/useTableOption.filter.form.tsx +1 -0
  17. package/src/packages/components/AutoTable/use/useTableOption.methods.tsx +2 -0
  18. package/src/packages/components/AutoTable/use/useTableOption.state.tsx +1 -0
  19. package/src/packages/components/AutoTable/use/useTableOption.table.tsx +3 -3
  20. package/src/packages/components/AutoTable/utils/TableOption.space.tsx +4 -0
  21. package/src/packages/components/Badge/badge.scss +1 -1
  22. package/src/packages/components/Button/button.scss +2 -2
  23. package/src/packages/components/Card/card.scss +1 -1
  24. package/src/packages/components/Carousel/carousel.scss +391 -0
  25. package/src/packages/components/Carousel/index.tsx +569 -22
  26. package/src/packages/components/CarouselItem/index.tsx +77 -0
  27. package/src/packages/components/CascadePanel/list/CascadeListPanelItem.tsx +3 -3
  28. package/src/packages/components/CheckboxInner/checkbox-inner.scss +1 -1
  29. package/src/packages/components/ColorPicker/sub/ColorSlider.tsx +8 -5
  30. package/src/packages/components/ColorPicker/sub/ColorSvPanel.tsx +7 -4
  31. package/src/packages/components/DatePicker/date.scss +1 -1
  32. package/src/packages/components/Dialog/dialog.scss +1 -1
  33. package/src/packages/components/Dialog/index.tsx +4 -3
  34. package/src/packages/components/Dialog/useDialogMovable.tsx +7 -4
  35. package/src/packages/components/Dialog/utils/dialog.mouse.ts +4 -2
  36. package/src/packages/components/Dropdown/dropdown.public.scss +10 -0
  37. package/src/packages/components/Dropdown/dropdown.utils.tsx +3 -1
  38. package/src/packages/components/Dropdown/index.tsx +2 -2
  39. package/src/packages/components/DropdownOption/index.tsx +3 -3
  40. package/src/packages/components/DropdownSeparator/index.tsx +8 -0
  41. package/src/packages/components/FilterFormMultiple/index.tsx +31 -10
  42. package/src/packages/components/Image/image.scss +3 -3
  43. package/src/packages/components/ImagePreviewer/ImagePreviewer.tsx +574 -0
  44. package/src/packages/components/ImagePreviewer/ImagePreviewerButtonBar.tsx +140 -0
  45. package/src/packages/components/ImagePreviewer/ImagePreviewerCarouselImage.tsx +54 -0
  46. package/src/packages/components/ImagePreviewer/ImagePreviewerGallery.tsx +202 -0
  47. package/src/packages/components/ImagePreviewer/PreviewerLoading.tsx +26 -0
  48. package/src/packages/components/ImagePreviewer/image-previewer.scss +244 -0
  49. package/src/packages/components/ImagePreviewer/image-previewer.utils.tsx +135 -0
  50. package/src/packages/components/ImagePreviewer/index.tsx +5 -0
  51. package/src/packages/components/ImagePreviewer/previewer-loading.scss +52 -0
  52. package/src/packages/components/Input/index.scss +2 -2
  53. package/src/packages/components/Input/useMultipleInput.tsx +2 -76
  54. package/src/packages/components/Input/useTextareaInput.tsx +10 -5
  55. package/src/packages/components/Input/uses/useInputHooks.tsx +11 -11
  56. package/src/packages/components/InputNumber/NumberResize.tsx +20 -3
  57. package/src/packages/components/InputNumber/input-number.utils.tsx +7 -5
  58. package/src/packages/components/InputNumber/number.scss +10 -1
  59. package/src/packages/components/InputNumber/useInputNumber.public.tsx +25 -6
  60. package/src/packages/components/Layout/index.tsx +31 -0
  61. package/src/packages/components/Layout/layout.scss +227 -0
  62. package/src/packages/components/Layout/layout.utils.ts +3 -0
  63. package/src/packages/components/LayoutSection/index.tsx +67 -0
  64. package/src/packages/components/LayoutSection/useLayoutSectionResizer.tsx +184 -0
  65. package/src/packages/components/LoadingMask/index.tsx +1 -1
  66. package/src/packages/components/PageThemeUtils/index.tsx +54 -14
  67. package/src/packages/components/Pagination/pagination.scss +2 -2
  68. package/src/packages/components/PlcOv/index.tsx +14 -4
  69. package/src/packages/components/Popup/index.tsx +24 -10
  70. package/src/packages/components/ProgressBar/progress-bar.scss +1 -1
  71. package/src/packages/components/Rate/index.tsx +3 -1
  72. package/src/packages/components/Scroll/HorizontalScrollbar.tsx +7 -3
  73. package/src/packages/components/Scroll/VerticalScrollbar.tsx +7 -3
  74. package/src/packages/components/Scroll/index.tsx +6 -6
  75. package/src/packages/components/Select/createPublicSelectRender.tsx +1 -1
  76. package/src/packages/components/Slider/slider.scss +1 -1
  77. package/src/packages/components/Slider/useSliderDotDragier.tsx +7 -4
  78. package/src/packages/components/SortList/index.tsx +191 -0
  79. package/src/packages/components/SortList/sort-list.scss +11 -0
  80. package/src/packages/components/StackCard/index.tsx +416 -0
  81. package/src/packages/components/StackCard/stack-card.scss +40 -0
  82. package/src/packages/components/StackCardItem/index.tsx +24 -0
  83. package/src/packages/components/StepGroup/step-group.scss +9 -9
  84. package/src/packages/components/TabGroup/TabsInner.tsx +5 -3
  85. package/src/packages/components/TabGroup/header/horizontal/tabs-header-horizontal.scss +0 -1
  86. package/src/packages/components/TabGroup/index.tsx +5 -1
  87. package/src/packages/components/TabGroup/tabs.scss +3 -0
  88. package/src/packages/components/Table/standard/PlcExpand.tsx +12 -20
  89. package/src/packages/components/Table/standard/PlcOperation/PlcOperation.tsx +1 -1
  90. package/src/packages/components/Table/standard/PlcOperation/outer-operation.scss +2 -0
  91. package/src/packages/components/Table/standard/PlcTree/RenderPlcTreeNode.tsx +2 -1
  92. package/src/packages/components/Table/table/Table.tsx +10 -3
  93. package/src/packages/components/Table/table/body/row.tsx +1 -1
  94. package/src/packages/components/Table/table/body/useCellValue.tsx +10 -6
  95. package/src/packages/components/Table/table/head/useHeadCellResize.ts +8 -3
  96. package/src/packages/components/Table/table/table.scss +2 -1
  97. package/src/packages/components/Table/table/use/useTableDraggier.col.tsx +10 -5
  98. package/src/packages/components/Table/table/use/useTableDraggier.row.tsx +12 -7
  99. package/src/packages/components/Table/table/use/useTableFormEditor.tsx +1 -1
  100. package/src/packages/components/Table/table/use/useTableModifyEditor.tsx +1 -1
  101. package/src/packages/components/Table/table/utils/createTableHooks.ts +4 -2
  102. package/src/packages/components/Table/table/utils/table.utils.ts +6 -1
  103. package/src/packages/components/ThemeEditor/index.tsx +173 -0
  104. package/src/packages/components/ThemeEditor/theme-editor.scss +105 -0
  105. package/src/packages/components/ThemePrimaryColors/index.ts +5 -0
  106. package/src/packages/components/Tree/RenderTreeNode.tsx +8 -3
  107. package/src/packages/components/Tree/index.tsx +4 -3
  108. package/src/packages/components/Tree/tree.scss +42 -9
  109. package/src/packages/components/TreeCore/TreeCore.type.tsx +2 -0
  110. package/src/packages/components/TreeCore/createTreeCore.tsx +5 -1
  111. package/src/packages/components/TreeCore/createTreeDraggier.tsx +70 -56
  112. package/src/packages/components/TreeCore/createTreeMethods.tsx +1 -0
  113. package/src/packages/components/TreeCore/createTreeProps.ts +2 -1
  114. package/src/packages/components/TreeNodeWithMenu/index.tsx +91 -0
  115. package/src/packages/components/TreeNodeWithMenu/tree-node-with-menu.scss +39 -0
  116. package/src/packages/components/TreeNodeWithMenu/treeNodeWithMenu.utils.ts +12 -0
  117. package/src/packages/components/VirtualList/index.tsx +15 -6
  118. package/src/packages/components/VirtualList/useVirtualList.tsx +182 -107
  119. package/src/packages/components/VirtualList/virtual-list.scss +31 -17
  120. package/src/packages/components/VirtualTable/index.tsx +7 -7
  121. package/src/packages/components/VirtualTable/virtual-table.scss +1 -2
  122. package/src/packages/components/createProvider/index.ts +5 -0
  123. package/src/packages/components/nextPopupId/index.ts +5 -0
  124. package/src/packages/components/useDialog/DialogService.tsx +13 -1
  125. package/src/packages/components/useDialog/index.tsx +1 -1
  126. package/src/packages/components/useImage/ImageService.tsx +7 -4
  127. package/src/packages/components/useMessage/Message.tsx +5 -1
  128. package/src/packages/components/useMessage/message.scss +5 -1
  129. package/src/packages/components/useNotice/notice.scss +2 -2
  130. package/src/packages/components/usePopup/PopupItem.tsx +45 -26
  131. package/src/packages/components/usePopup/popup-item.scss +5 -1
  132. package/src/packages/components/usePopup/usePopup.tsx +23 -7
  133. package/src/packages/components/usePopup/usePopupManager.tsx +2 -1
  134. package/src/packages/components/usePopup/utils/popup.utils.ts +2 -1
  135. package/src/packages/components/usePopupManager/index.ts +5 -0
  136. package/src/packages/components/usePopupTrigger/index.tsx +5 -0
  137. package/src/packages/components/useReferenceTrigger/index.tsx +5 -0
  138. package/src/packages/components/useTooltip/index.tsx +10 -2
  139. package/src/packages/components/useWatchAutoClear/index.ts +5 -0
  140. package/src/packages/entry.tsx +48 -2
  141. package/src/packages/i18n/lang/en-us.ts +36 -0
  142. package/src/packages/i18n/lang/zh-cn.ts +36 -0
  143. package/src/packages/uses/useDragHorizontalScroll.ts +82 -0
  144. package/src/packages/uses/useEdit.ts +5 -1
  145. package/src/packages/uses/useStyle.tsx +10 -2
  146. package/src/packages/utils/ClientZoom.ts +24 -2
  147. package/src/packages/utils/ComponentUtils.ts +10 -0
  148. package/src/packages/utils/buildCycleIndexList.ts +31 -0
  149. package/src/packages/utils/getDeviceInfo.ts +44 -44
  150. package/src/packages/utils/getRectAutoFormat.ts +9 -0
  151. package/src/packages/utils/inheritSlots.ts +28 -0
  152. package/src/packages/utils/notNull.ts +9 -0
  153. package/src/packages/utils/useMove.tsx +10 -4
  154. package/src/packages/utils/watchEffectAutoClear.ts +19 -7
  155. package/src/packages/components/CarouselGroup/carousel.scss +0 -143
  156. package/src/packages/components/CarouselGroup/index.tsx +0 -274
  157. package/src/pages/data/address.json +0 -39317
  158. package/src/pages/data/data-1.json +0 -754
  159. package/src/pages/data/data-2.json +0 -3006
  160. package/src/pages/data/data-200.json +0 -5206
  161. package/src/pages/data/data-2000.json +0 -51954
  162. package/src/pages/data/data-50.json +0 -2075
  163. package/src/pages/data/data.json +0 -30002
  164. package/src/pages/data/demo.json +0 -1702
  165. package/src/pages/data/mock.database.js +0 -43
  166. package/src/pages/data/mock.js +0 -141
  167. package/src/pages/data/tree.data.json +0 -87
  168. package/src/pages/env/config/local.js +0 -3
  169. package/src/pages/env/config/prod.js +0 -3
  170. package/src/pages/env/config/undefined.js +0 -1
  171. package/src/pages/env/env.d.ts +0 -4
  172. package/src/pages/env/index.ts +0 -1
  173. package/src/pages/history/createHistory.ts +0 -94
  174. package/src/pages/history/history.utils.ts +0 -64
  175. package/src/pages/index/App.tsx +0 -17
  176. package/src/pages/index/Demo/DemoLine.tsx +0 -23
  177. package/src/pages/index/Demo/DemoRow.scss +0 -128
  178. package/src/pages/index/Demo/DemoRow.tsx +0 -71
  179. package/src/pages/index/Demo/DemoRow.utils.ts +0 -23
  180. package/src/pages/index/Demo/DemoRowController.tsx +0 -45
  181. package/src/pages/index/Demo/index.ts +0 -8
  182. package/src/pages/index/app.scss +0 -192
  183. package/src/pages/index/components/AutoTable/AutoHeightAutoRow.tsx +0 -51
  184. package/src/pages/index/components/AutoTable/AutoHeightFixedRow.tsx +0 -50
  185. package/src/pages/index/components/AutoTable/AutoTableBasicUsage.tsx +0 -75
  186. package/src/pages/index/components/AutoTable/AutoTableCascade.tsx +0 -99
  187. package/src/pages/index/components/AutoTable/AutoTableDefaultSearch.tsx +0 -73
  188. package/src/pages/index/components/AutoTable/AutoTableFiles.tsx +0 -26
  189. package/src/pages/index/components/AutoTable/AutoTableFill.tsx +0 -51
  190. package/src/pages/index/components/AutoTable/AutoTableGroupUsage.tsx +0 -71
  191. package/src/pages/index/components/AutoTable/AutoTableObjectPicker.tsx +0 -181
  192. package/src/pages/index/components/AutoTable/AutoTableOvList.tsx +0 -80
  193. package/src/pages/index/components/AutoTable/AutoTableProductList.tsx +0 -98
  194. package/src/pages/index/components/AutoTable/AutoTableRowFormatter.tsx +0 -58
  195. package/src/pages/index/components/AutoTable/FixedHeightAutoRow.tsx +0 -50
  196. package/src/pages/index/components/AutoTable/FixedHeightFixedRow.tsx +0 -49
  197. package/src/pages/index/components/bus/DemoAddress.tsx +0 -181
  198. package/src/pages/index/components/bus/DemoAddressCascade.tsx +0 -132
  199. package/src/pages/index/components/bus/DemoFilter.tsx +0 -184
  200. package/src/pages/index/components/columns/DemoPlcAddress.tsx +0 -161
  201. package/src/pages/index/components/columns/DemoPlcDate.tsx +0 -363
  202. package/src/pages/index/components/columns/DemoPlcSelect.tsx +0 -505
  203. package/src/pages/index/components/columns/DemoPlcTime.tsx +0 -293
  204. package/src/pages/index/components/columns/DemoTableColumns.tsx +0 -88
  205. package/src/pages/index/components/form/DemoFormBasic.tsx +0 -516
  206. package/src/pages/index/components/form/DemoFormBlur.tsx +0 -204
  207. package/src/pages/index/components/form/DemoFormDynamicFields.tsx +0 -54
  208. package/src/pages/index/components/form/DemoFormEditControl.tsx +0 -164
  209. package/src/pages/index/components/form/DemoFormElement.tsx +0 -207
  210. package/src/pages/index/components/form/DemoFormLayout.scss +0 -7
  211. package/src/pages/index/components/form/DemoFormLayout.tsx +0 -311
  212. package/src/pages/index/components/form/DemoFormSimplify.tsx +0 -587
  213. package/src/pages/index/components/form/DemoFormSize.tsx +0 -274
  214. package/src/pages/index/components/form/DemoFormVertical.tsx +0 -280
  215. package/src/pages/index/components/normal/DemoAlert.tsx +0 -66
  216. package/src/pages/index/components/normal/DemoBadge.tsx +0 -53
  217. package/src/pages/index/components/normal/DemoButton.tsx +0 -300
  218. package/src/pages/index/components/normal/DemoCard.tsx +0 -176
  219. package/src/pages/index/components/normal/DemoCarousel.tsx +0 -125
  220. package/src/pages/index/components/normal/DemoCascade.tsx +0 -880
  221. package/src/pages/index/components/normal/DemoCheckbox.scss +0 -24
  222. package/src/pages/index/components/normal/DemoCheckbox.tsx +0 -294
  223. package/src/pages/index/components/normal/DemoCollapse.tsx +0 -104
  224. package/src/pages/index/components/normal/DemoColor.scss +0 -20
  225. package/src/pages/index/components/normal/DemoColor.tsx +0 -82
  226. package/src/pages/index/components/normal/DemoColorPicker.tsx +0 -163
  227. package/src/pages/index/components/normal/DemoDate.tsx +0 -443
  228. package/src/pages/index/components/normal/DemoDialog.tsx +0 -507
  229. package/src/pages/index/components/normal/DemoDropdown.tsx +0 -463
  230. package/src/pages/index/components/normal/DemoGrid.scss +0 -26
  231. package/src/pages/index/components/normal/DemoGrid.tsx +0 -181
  232. package/src/pages/index/components/normal/DemoIcon.tsx +0 -39
  233. package/src/pages/index/components/normal/DemoImage.tsx +0 -122
  234. package/src/pages/index/components/normal/DemoInput.scss +0 -0
  235. package/src/pages/index/components/normal/DemoInput.tsx +0 -790
  236. package/src/pages/index/components/normal/DemoKeepAlive.tsx +0 -505
  237. package/src/pages/index/components/normal/DemoList.scss +0 -15
  238. package/src/pages/index/components/normal/DemoList.tsx +0 -82
  239. package/src/pages/index/components/normal/DemoLoading.tsx +0 -83
  240. package/src/pages/index/components/normal/DemoNumber.tsx +0 -266
  241. package/src/pages/index/components/normal/DemoPagination.tsx +0 -164
  242. package/src/pages/index/components/normal/DemoPopup.tsx +0 -695
  243. package/src/pages/index/components/normal/DemoProgress.tsx +0 -133
  244. package/src/pages/index/components/normal/DemoRadio.scss +0 -16
  245. package/src/pages/index/components/normal/DemoRadio.tsx +0 -188
  246. package/src/pages/index/components/normal/DemoRate.tsx +0 -77
  247. package/src/pages/index/components/normal/DemoScroll.scss +0 -22
  248. package/src/pages/index/components/normal/DemoScroll.tsx +0 -300
  249. package/src/pages/index/components/normal/DemoSegment.tsx +0 -71
  250. package/src/pages/index/components/normal/DemoSelect.tsx +0 -819
  251. package/src/pages/index/components/normal/DemoSlider.tsx +0 -128
  252. package/src/pages/index/components/normal/DemoStep.scss +0 -18
  253. package/src/pages/index/components/normal/DemoStep.tsx +0 -291
  254. package/src/pages/index/components/normal/DemoTab.tsx +0 -338
  255. package/src/pages/index/components/normal/DemoTag.tsx +0 -100
  256. package/src/pages/index/components/normal/DemoTime.tsx +0 -403
  257. package/src/pages/index/components/normal/DemoToggle.tsx +0 -56
  258. package/src/pages/index/components/normal/DemoTooltip.tsx +0 -120
  259. package/src/pages/index/components/normal/DemoTree.tsx +0 -1099
  260. package/src/pages/index/components/normal/DemoUpload.tsx +0 -484
  261. package/src/pages/index/components/normal/DemoVirtualList.tsx +0 -378
  262. package/src/pages/index/components/service/DemoDialogService.tsx +0 -248
  263. package/src/pages/index/components/service/DemoFileService.tsx +0 -110
  264. package/src/pages/index/components/service/DemoMessageService.tsx +0 -100
  265. package/src/pages/index/components/service/DemoNoticeService.tsx +0 -99
  266. package/src/pages/index/components/service/DemoPopupService.tsx +0 -322
  267. package/src/pages/index/components/table/DemoPlcOperation.tsx +0 -307
  268. package/src/pages/index/components/table/DemoTableBasic.tsx +0 -220
  269. package/src/pages/index/components/table/DemoTableCheck.tsx +0 -78
  270. package/src/pages/index/components/table/DemoTableClassAndStyle.scss +0 -18
  271. package/src/pages/index/components/table/DemoTableClassAndStyle.tsx +0 -112
  272. package/src/pages/index/components/table/DemoTableColDraggable.tsx +0 -80
  273. package/src/pages/index/components/table/DemoTableEdit.tsx +0 -136
  274. package/src/pages/index/components/table/DemoTableExpand.tsx +0 -181
  275. package/src/pages/index/components/table/DemoTableFixed.tsx +0 -131
  276. package/src/pages/index/components/table/DemoTableFormatter.tsx +0 -66
  277. package/src/pages/index/components/table/DemoTableOverflowTooltip.tsx +0 -67
  278. package/src/pages/index/components/table/DemoTableRowDraggable.tsx +0 -106
  279. package/src/pages/index/components/table/DemoTableSlots.tsx +0 -153
  280. package/src/pages/index/components/table/DemoTableSpan.tsx +0 -167
  281. package/src/pages/index/components/table/DemoTableTree.tsx +0 -976
  282. package/src/pages/index/components/table/DemoVirtualTable.tsx +0 -274
  283. package/src/pages/index/components/test/DemoI18n.tsx +0 -27
  284. package/src/pages/index/components/test/DemoI18n2.jsx +0 -11
  285. package/src/pages/index/home/AppContent.tsx +0 -69
  286. package/src/pages/index/home/AppHead.tsx +0 -104
  287. package/src/pages/index/home/AppHome.tsx +0 -16
  288. package/src/pages/index/home/AppMenu.tsx +0 -38
  289. package/src/pages/index/home/menus.tsx +0 -217
  290. package/src/pages/index/main.tsx +0 -23
  291. package/src/pages/index/nav/$nav.ts +0 -41
  292. package/src/pages/index/pages.d.ts +0 -6
  293. package/src/pages/libs/iconfont-fontcls/demo.css +0 -539
  294. package/src/pages/libs/iconfont-fontcls/demo_index.html +0 -303
  295. package/src/pages/libs/iconfont-fontcls/iconfont.css +0 -35
  296. package/src/pages/libs/iconfont-fontcls/iconfont.js +0 -1
  297. package/src/pages/libs/iconfont-fontcls/iconfont.json +0 -44
  298. package/src/pages/libs/iconfont-fontcls/iconfont.ttf +0 -0
  299. package/src/pages/libs/iconfont-fontcls/iconfont.woff +0 -0
  300. package/src/pages/libs/iconfont-fontcls/iconfont.woff2 +0 -0
  301. package/src/pages/libs/iconfont-symbol/demo.css +0 -539
  302. package/src/pages/libs/iconfont-symbol/demo_index.html +0 -303
  303. package/src/pages/libs/iconfont-symbol/iconfont.css +0 -35
  304. package/src/pages/libs/iconfont-symbol/iconfont.js +0 -1
  305. package/src/pages/libs/iconfont-symbol/iconfont.json +0 -44
  306. package/src/pages/libs/iconfont-symbol/iconfont.ttf +0 -0
  307. package/src/pages/libs/iconfont-symbol/iconfont.woff +0 -0
  308. package/src/pages/libs/iconfont-symbol/iconfont.woff2 +0 -0
  309. package/src/pages/libs/install.iconfont-fontcls.tsx +0 -11
  310. package/src/pages/libs/install.iconfont-symbol.scss +0 -7
  311. package/src/pages/libs/install.iconfont-symbol.tsx +0 -14
  312. package/src/pages/module/address.ts +0 -27
  313. package/src/pages/module/http.ts +0 -24
  314. package/src/pages/module/index.ts +0 -19
  315. package/src/pages/module/object.ts +0 -5
  316. package/src/pages/module/ov.tsx +0 -13
  317. package/src/pages/module/upload.ts +0 -9
  318. package/src/pages/module/useTableOption.ts +0 -28
@@ -1,8 +1,10 @@
1
+ import {iMouseEvent} from 'plain-design-composition';
2
+
1
3
  export const ClientZoom = (() => {
2
4
  let zoom: '' | number = '';
3
5
  return {
4
- get: () => {
5
- return zoom;
6
+ get: (): number => {
7
+ return zoom === '' ? 1 : zoom;
6
8
  },
7
9
  set: (_zoom: number | null) => {
8
10
  const __zoom = _zoom == null ? '' : _zoom;
@@ -24,5 +26,25 @@ export const ClientZoom = (() => {
24
26
  };
25
27
  }
26
28
  },
29
+ getClientPosition: (e: iMouseEvent | MouseEvent): { clientX: number, clientY: number, offsetX: number, offsetY: number, } => {
30
+ const { clientX, clientY, offsetX, offsetY } = 'nativeEvent' in e ? e.nativeEvent : e;
31
+ return {
32
+ clientX: ClientZoom.formatClientValue(clientX),
33
+ clientY: ClientZoom.formatClientValue(clientY),
34
+ offsetX: ClientZoom.formatClientValue(offsetX),
35
+ offsetY: ClientZoom.formatClientValue(offsetY),
36
+ };
37
+ },
38
+ formatClientValue: (val: number) => {
39
+ return ClientZoom.zoomPosition(val);
40
+ },
41
+ zoomPosition(val: number) {
42
+ const zoom = ClientZoom.get();
43
+ return Number((val / zoom).toFixed(2));
44
+ },
45
+ zoomSize(val: number) {
46
+ const zoom = ClientZoom.get();
47
+ return Number((val * zoom).toFixed(2));
48
+ },
27
49
  };
28
50
  })();
@@ -0,0 +1,10 @@
1
+ export const ComponentUtils = {
2
+ /**
3
+ * 适配taro ui的一些写法
4
+ * @author 韦胜健
5
+ * @date 2024/1/3 16:48
6
+ */
7
+ getElInfo: async (selector: string) => {
8
+ return document.querySelector(selector)!.getBoundingClientRect();
9
+ },
10
+ };
@@ -0,0 +1,31 @@
1
+ export function buildCycleIndexList({ length, current }: { length: number, current: number }) {
2
+
3
+ const sourceList = new Array(length).fill(null).map((_, index) => index);
4
+ const cycleIndexList = (() => {
5
+
6
+ if (sourceList.length <= 2) {
7
+ return sourceList;
8
+ }
9
+
10
+ const leftList = sourceList.slice(0, current);
11
+ const rightList = sourceList.slice(current + 1);
12
+
13
+ while (Math.abs(leftList.length - rightList.length) >= 2) {
14
+ if (leftList.length > rightList.length) {
15
+ rightList.push(leftList.shift()!);
16
+ } else {
17
+ leftList.unshift(rightList.pop()!);
18
+ }
19
+ }
20
+ return [...leftList, current, ...rightList];
21
+ })();
22
+
23
+ const currentIndexInCycle = cycleIndexList.indexOf(current);
24
+
25
+ const index2distance = cycleIndexList.reduce((prev, item, cycleIndex) => {
26
+ prev[item] = cycleIndex - currentIndexInCycle;
27
+ return prev;
28
+ }, {} as Record<number, number>);
29
+
30
+ return { cycleIndexList, currentIndexInCycle, index2distance };
31
+ }
@@ -9,50 +9,50 @@ interface iDeviceInfo {
9
9
  osType: typeof eOsType.TYPE,
10
10
  }
11
11
 
12
- export const getDeviceInfo = (() => {
13
- let info: iDeviceInfo | null = null;
14
-
15
- return () => {
16
- if (isSSR()) {
17
- throw new Error('服务端渲染的情况下不可以获取设备信息');
18
- }
19
- if (!info) {
20
- const userAgent = navigator.userAgent;
21
-
22
- info = {
23
- deviceType: (() => {
24
- const isMobile = /Mobile|Android|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
25
- if (isMobile) {
26
- return eDeviceType.mobile;
27
- }
28
- if (/iPad|Android/i.test(userAgent) && !isMobile) {
29
- return eDeviceType.tablet;
30
- }
31
- return eDeviceType.desktop;
32
- })(),
33
- osType: (() => {
34
- if (/Win/i.test(userAgent)) {
35
- return eOsType.win;
36
- }
37
- if (/Mac/i.test(userAgent)) {
38
- return eOsType.mac;
39
- }
40
- if (/Linux/i.test(userAgent)) {
41
- return eOsType.linux;
42
- }
43
- if (/iPad|iPhone|iPod/.test(userAgent) && !(window as any).MSStream) {
44
- return eOsType.ios;
45
- }
46
- if (/Android/.test(userAgent)) {
47
- return eOsType.android;
48
- }
49
- return 'unknown';
50
- })()
51
- };
52
- }
53
- return info;
54
- };
55
- })();
12
+ let info: iDeviceInfo | null = null;
13
+
14
+ export const getDeviceInfo = () => {
15
+ if (isSSR()) {
16
+ throw new Error('服务端渲染的情况下不可以获取设备信息');
17
+ }
18
+ if (!info) {
19
+ const userAgent = navigator.userAgent;
20
+
21
+ info = {
22
+ deviceType: (() => {
23
+ const isMobile = /Mobile|Android|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent);
24
+ if (isMobile) {
25
+ return eDeviceType.mobile;
26
+ }
27
+ if (/iPad|Android/i.test(userAgent) && !isMobile) {
28
+ return eDeviceType.tablet;
29
+ }
30
+ return eDeviceType.desktop;
31
+ })(),
32
+ osType: (() => {
33
+ if (/Win/i.test(userAgent)) {
34
+ return eOsType.win;
35
+ }
36
+ if (/Mac/i.test(userAgent)) {
37
+ return eOsType.mac;
38
+ }
39
+ if (/Linux/i.test(userAgent)) {
40
+ return eOsType.linux;
41
+ }
42
+ if (/iPad|iPhone|iPod/.test(userAgent) && !(window as any).MSStream) {
43
+ return eOsType.ios;
44
+ }
45
+ if (/Android/.test(userAgent)) {
46
+ return eOsType.android;
47
+ }
48
+ return 'unknown';
49
+ })()
50
+ };
51
+ }
52
+ return info;
53
+ };
54
+
55
+ export const clearDeviceInfo = () => {info = null;};
56
56
 
57
57
  export const isPC = () => getDeviceInfo().deviceType === eDeviceType.desktop;
58
58
 
@@ -0,0 +1,9 @@
1
+ export function getRectAutoFormat(el: HTMLElement) {
2
+ const { top, left, height, width } = el.getBoundingClientRect();
3
+ return {
4
+ top: Number(top.toFixed(0)),
5
+ left: Number(left.toFixed(0)),
6
+ height: Number(height.toFixed(0)),
7
+ width: Number(width.toFixed(0)),
8
+ };
9
+ }
@@ -0,0 +1,28 @@
1
+ import {RenderNode} from "plain-design-composition";
2
+
3
+ export function inheritSlots<
4
+ Slots extends Record<string, (() => RenderNode) & { isExist: () => boolean }>,
5
+ ScopeSlots extends Record<string, ((...args: any[]) => RenderNode) & { isExist: () => boolean }>,
6
+ >(
7
+ {
8
+ slots,
9
+ scopeSlots,
10
+ defaultSlots,
11
+ defaultScopeSlots,
12
+ }: {
13
+ slots?: Slots,
14
+ scopeSlots?: ScopeSlots,
15
+ defaultSlots?: { [k in keyof Slots]: Omit<Slots[k], 'isExist'> },
16
+ defaultScopeSlots?: { [k in keyof ScopeSlots]: Omit<ScopeSlots[k], 'isExist'> },
17
+ }
18
+ ) {
19
+ const ret = {} as any;
20
+
21
+ !!defaultSlots && Object.entries(defaultSlots).forEach(([key, val]) => {ret[key] = val;});
22
+ !!defaultScopeSlots && Object.entries(defaultScopeSlots).forEach(([key, val]) => {ret[key] = val;});
23
+
24
+ !!slots && Object.keys(slots).forEach((k: keyof Slots) => {if (slots[k].isExist()) {ret[k] = () => slots[k]();}});
25
+ !!scopeSlots && Object.keys(scopeSlots).forEach((k: keyof ScopeSlots) => {if (scopeSlots[k].isExist()) {ret[k] = (...args: any[]) => scopeSlots[k](...args);}});
26
+
27
+ return ret;
28
+ }
@@ -0,0 +1,9 @@
1
+ export function notNull<T, D>(val: T, defaultValue: D | (() => D)): Exclude<T, null | undefined> | D {
2
+ // @ts-ignore
3
+ return val != null ? val : (typeof defaultValue === "function" ? defaultValue() : defaultValue);
4
+ }
5
+
6
+ export function notNullFunction<T, D>(val: T, defaultValue: D): Exclude<T, null | undefined> | D {
7
+ // @ts-ignore
8
+ return val != null ? val : defaultValue;
9
+ }
@@ -1,6 +1,7 @@
1
1
  import {createEffects} from "plain-utils/utils/createEffects";
2
2
  import {watch} from "plain-design-composition";
3
3
  import {removeUnit} from "plain-utils/string/removeUnit";
4
+ import {ClientZoom} from "../components/ClientZoom";
4
5
 
5
6
  export function useMove(
6
7
  {
@@ -26,6 +27,8 @@ export function useMove(
26
27
 
27
28
  const onMousedown = (e: MouseEvent) => {
28
29
 
30
+ const { clientX, clientY } = ClientZoom.getClientPosition(e);
31
+
29
32
  const { effects: draggierEffects } = createEffects();
30
33
 
31
34
  const el = e.currentTarget as HTMLElement;
@@ -35,16 +38,19 @@ export function useMove(
35
38
  const dragState = {
36
39
  isDragging: false,
37
40
  start: {
38
- x: e.clientX,
39
- y: e.clientY,
41
+ x: clientX,
42
+ y: clientY,
40
43
  left: Number(removeUnit(style.left) || 0),
41
44
  top: Number(removeUnit(style.top) || 0),
42
45
  }
43
46
  };
44
47
 
45
48
  const onMousemove = (e: MouseEvent) => {
46
- const durX = e.clientX - dragState.start.x;
47
- const durY = e.clientY - dragState.start.y;
49
+
50
+ const { clientX, clientY } = ClientZoom.getClientPosition(e);
51
+
52
+ const durX = clientX - dragState.start.x;
53
+ const durY = clientY - dragState.start.y;
48
54
 
49
55
  if (!dragState.isDragging) {
50
56
  if (durX >= 5 || durY >= 5) {
@@ -1,4 +1,5 @@
1
- import {onBeforeUnmount, SimpleFunction, watch} from "plain-design-composition";
1
+ import {onBeforeUnmount, watch} from "plain-design-composition";
2
+ import {createEffects} from "plain-utils/utils/createEffects";
2
3
 
3
4
  /**
4
5
  * watch函数封装,支持清理副作用
@@ -6,11 +7,22 @@ import {onBeforeUnmount, SimpleFunction, watch} from "plain-design-composition";
6
7
  * @date 2022.7.3 13:15
7
8
  */
8
9
  export function useWatchAutoClear<T>(watcher: () => T, handler: (newVal: T, oldVal: undefined | T) => (() => void)) {
9
- let clear: SimpleFunction | null = null;
10
- watch(() => watcher(), (newVal, oldVal) => {
11
- clear?.();
12
- clear = handler(newVal, oldVal);
13
- }, { immediate: true });
14
10
 
15
- onBeforeUnmount(() => clear?.());
11
+ const { effects: setupEffects } = createEffects();
12
+ const { effects: watchEffects } = createEffects();
13
+
14
+ setupEffects.push(
15
+ watch(() => watcher(), (newVal, oldVal) => {
16
+ watchEffects.clear();
17
+ watchEffects.push(
18
+ handler(newVal, oldVal)
19
+ );
20
+ }, { immediate: true })
21
+ );
22
+
23
+ onBeforeUnmount(() => {
24
+ setupEffects.clear();
25
+ watchEffects.clear();
26
+ });
16
27
  }
28
+
@@ -1,143 +0,0 @@
1
- @include prefix(carousel-group) {
2
- position: relative;
3
-
4
- &:not(.carousel-vertical) {
5
- overflow-x: hidden;
6
- }
7
-
8
- .#{componentName(carousel)}, .carousel-cover, .carousel-operator, .carousel-indicator {
9
- position: absolute;
10
- top: 0;
11
- left: 0;
12
- right: 0;
13
- bottom: 0;
14
- pointer-events: none;
15
-
16
- &.carousel-cover, &.carousel-operator, &.carousel-indicator {
17
- z-index: 99;
18
- }
19
- }
20
-
21
- .#{componentName(carousel)} {
22
- &.carousel-animating {
23
- transition: transform ease 600ms;
24
- }
25
-
26
- pointer-events: auto;
27
- }
28
-
29
- .carousel-cover {
30
- pointer-events: auto;
31
- }
32
-
33
- .carousel-operator {
34
- display: flex;
35
- align-items: center;
36
- justify-content: space-between;
37
- padding: 0 20px;
38
-
39
- .carousel-operator-btn {
40
- transition: background-color 300ms linear;
41
- cursor: pointer;
42
- pointer-events: auto;
43
- background-color: rgba(#ffffff, 0.45);
44
- color: white;
45
- width: 36px;
46
- height: 36px;
47
- border-radius: 36px;
48
- display: flex;
49
- align-items: center;
50
- justify-content: center;
51
- user-select: none;
52
-
53
- &:hover:not(:active) {
54
- background-color: rgba(#ffffff, 0.65);
55
- }
56
- }
57
- }
58
-
59
- .carousel-indicator {
60
- top: initial;
61
- display: flex;
62
- align-items: center;
63
- justify-content: center;
64
- padding: 20px;
65
- flex-wrap: nowrap;
66
-
67
- .carousel-indicator-item {
68
- pointer-events: auto;
69
- width: 20px;
70
- height: 2px;
71
- background-color: plv(background-color);
72
- opacity: 0.6;
73
- transition: all 200ms linear;
74
- cursor: pointer;
75
-
76
- &:not(:last-child) {
77
- margin-right: 8px;
78
- }
79
-
80
- &.carousel-indicator-item-active {
81
- opacity: 1;
82
- width: 30px;
83
- height: 4px;
84
- }
85
-
86
- &:hover {
87
- opacity: 0.8;
88
- }
89
- }
90
- }
91
-
92
- &.carousel-vertical {
93
- overflow-y: hidden;
94
-
95
- .carousel-operator {
96
- flex-direction: column;
97
- padding: 20px;
98
- align-items: flex-end;
99
-
100
- .carousel-operator-btn:nth-child(1) {
101
- transform: rotate(90deg);
102
- }
103
-
104
- .carousel-operator-btn:nth-child(2) {
105
- transform: rotate(90deg);
106
- }
107
- }
108
-
109
- .carousel-indicator {
110
- flex-direction: column;
111
- padding: 20px 36px;
112
- left: initial;
113
- top: 0;
114
-
115
- .carousel-indicator-item {
116
- height: 8px;
117
- width: 2px;
118
- margin-right: 0;
119
-
120
- &.carousel-indicator-item-active {
121
- height: 16px;
122
- width: 4px;
123
- }
124
-
125
- &:not(:last-child) {
126
- margin-bottom: 4px;
127
- }
128
- }
129
- }
130
- }
131
-
132
- &.carousel-card {
133
- .#{componentName(carousel)} {
134
- right: initial;
135
- }
136
-
137
- .carousel-indicator {
138
- .carousel-indicator-item {
139
- background-color: rgba(black, 0.5);
140
- }
141
- }
142
- }
143
- }