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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (316) 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/usePopupManager.tsx +2 -1
  133. package/src/packages/components/usePopup/utils/popup.utils.ts +2 -1
  134. package/src/packages/components/usePopupManager/index.ts +5 -0
  135. package/src/packages/components/usePopupTrigger/index.tsx +5 -0
  136. package/src/packages/components/useReferenceTrigger/index.tsx +5 -0
  137. package/src/packages/components/useTooltip/index.tsx +2 -0
  138. package/src/packages/components/useWatchAutoClear/index.ts +5 -0
  139. package/src/packages/entry.tsx +48 -2
  140. package/src/packages/i18n/lang/en-us.ts +36 -0
  141. package/src/packages/i18n/lang/zh-cn.ts +36 -0
  142. package/src/packages/uses/useDragHorizontalScroll.ts +82 -0
  143. package/src/packages/uses/useEdit.ts +5 -1
  144. package/src/packages/uses/useStyle.tsx +10 -2
  145. package/src/packages/utils/ClientZoom.ts +24 -2
  146. package/src/packages/utils/ComponentUtils.ts +10 -0
  147. package/src/packages/utils/buildCycleIndexList.ts +31 -0
  148. package/src/packages/utils/getDeviceInfo.ts +44 -44
  149. package/src/packages/utils/getRectAutoFormat.ts +9 -0
  150. package/src/packages/utils/inheritSlots.ts +28 -0
  151. package/src/packages/utils/notNull.ts +9 -0
  152. package/src/packages/utils/useMove.tsx +10 -4
  153. package/src/packages/components/CarouselGroup/carousel.scss +0 -143
  154. package/src/packages/components/CarouselGroup/index.tsx +0 -274
  155. package/src/pages/data/address.json +0 -39317
  156. package/src/pages/data/data-1.json +0 -754
  157. package/src/pages/data/data-2.json +0 -3006
  158. package/src/pages/data/data-200.json +0 -5206
  159. package/src/pages/data/data-2000.json +0 -51954
  160. package/src/pages/data/data-50.json +0 -2075
  161. package/src/pages/data/data.json +0 -30002
  162. package/src/pages/data/demo.json +0 -1702
  163. package/src/pages/data/mock.database.js +0 -43
  164. package/src/pages/data/mock.js +0 -141
  165. package/src/pages/data/tree.data.json +0 -87
  166. package/src/pages/env/config/local.js +0 -3
  167. package/src/pages/env/config/prod.js +0 -3
  168. package/src/pages/env/config/undefined.js +0 -1
  169. package/src/pages/env/env.d.ts +0 -4
  170. package/src/pages/env/index.ts +0 -1
  171. package/src/pages/history/createHistory.ts +0 -94
  172. package/src/pages/history/history.utils.ts +0 -64
  173. package/src/pages/index/App.tsx +0 -17
  174. package/src/pages/index/Demo/DemoLine.tsx +0 -23
  175. package/src/pages/index/Demo/DemoRow.scss +0 -128
  176. package/src/pages/index/Demo/DemoRow.tsx +0 -71
  177. package/src/pages/index/Demo/DemoRow.utils.ts +0 -23
  178. package/src/pages/index/Demo/DemoRowController.tsx +0 -45
  179. package/src/pages/index/Demo/index.ts +0 -8
  180. package/src/pages/index/app.scss +0 -192
  181. package/src/pages/index/components/AutoTable/AutoHeightAutoRow.tsx +0 -51
  182. package/src/pages/index/components/AutoTable/AutoHeightFixedRow.tsx +0 -50
  183. package/src/pages/index/components/AutoTable/AutoTableBasicUsage.tsx +0 -75
  184. package/src/pages/index/components/AutoTable/AutoTableCascade.tsx +0 -99
  185. package/src/pages/index/components/AutoTable/AutoTableDefaultSearch.tsx +0 -73
  186. package/src/pages/index/components/AutoTable/AutoTableFiles.tsx +0 -26
  187. package/src/pages/index/components/AutoTable/AutoTableFill.tsx +0 -51
  188. package/src/pages/index/components/AutoTable/AutoTableGroupUsage.tsx +0 -71
  189. package/src/pages/index/components/AutoTable/AutoTableObjectPicker.tsx +0 -181
  190. package/src/pages/index/components/AutoTable/AutoTableOvList.tsx +0 -80
  191. package/src/pages/index/components/AutoTable/AutoTableProductList.tsx +0 -98
  192. package/src/pages/index/components/AutoTable/AutoTableRowFormatter.tsx +0 -58
  193. package/src/pages/index/components/AutoTable/FixedHeightAutoRow.tsx +0 -50
  194. package/src/pages/index/components/AutoTable/FixedHeightFixedRow.tsx +0 -49
  195. package/src/pages/index/components/bus/DemoAddress.tsx +0 -181
  196. package/src/pages/index/components/bus/DemoAddressCascade.tsx +0 -132
  197. package/src/pages/index/components/bus/DemoFilter.tsx +0 -184
  198. package/src/pages/index/components/columns/DemoPlcAddress.tsx +0 -161
  199. package/src/pages/index/components/columns/DemoPlcDate.tsx +0 -363
  200. package/src/pages/index/components/columns/DemoPlcSelect.tsx +0 -505
  201. package/src/pages/index/components/columns/DemoPlcTime.tsx +0 -293
  202. package/src/pages/index/components/columns/DemoTableColumns.tsx +0 -88
  203. package/src/pages/index/components/form/DemoFormBasic.tsx +0 -516
  204. package/src/pages/index/components/form/DemoFormBlur.tsx +0 -204
  205. package/src/pages/index/components/form/DemoFormDynamicFields.tsx +0 -54
  206. package/src/pages/index/components/form/DemoFormEditControl.tsx +0 -164
  207. package/src/pages/index/components/form/DemoFormElement.tsx +0 -207
  208. package/src/pages/index/components/form/DemoFormLayout.scss +0 -7
  209. package/src/pages/index/components/form/DemoFormLayout.tsx +0 -311
  210. package/src/pages/index/components/form/DemoFormSimplify.tsx +0 -587
  211. package/src/pages/index/components/form/DemoFormSize.tsx +0 -274
  212. package/src/pages/index/components/form/DemoFormVertical.tsx +0 -280
  213. package/src/pages/index/components/normal/DemoAlert.tsx +0 -66
  214. package/src/pages/index/components/normal/DemoBadge.tsx +0 -53
  215. package/src/pages/index/components/normal/DemoButton.tsx +0 -300
  216. package/src/pages/index/components/normal/DemoCard.tsx +0 -176
  217. package/src/pages/index/components/normal/DemoCarousel.tsx +0 -125
  218. package/src/pages/index/components/normal/DemoCascade.tsx +0 -880
  219. package/src/pages/index/components/normal/DemoCheckbox.scss +0 -24
  220. package/src/pages/index/components/normal/DemoCheckbox.tsx +0 -294
  221. package/src/pages/index/components/normal/DemoCollapse.tsx +0 -104
  222. package/src/pages/index/components/normal/DemoColor.scss +0 -20
  223. package/src/pages/index/components/normal/DemoColor.tsx +0 -82
  224. package/src/pages/index/components/normal/DemoColorPicker.tsx +0 -163
  225. package/src/pages/index/components/normal/DemoDate.tsx +0 -443
  226. package/src/pages/index/components/normal/DemoDialog.tsx +0 -507
  227. package/src/pages/index/components/normal/DemoDropdown.tsx +0 -463
  228. package/src/pages/index/components/normal/DemoGrid.scss +0 -26
  229. package/src/pages/index/components/normal/DemoGrid.tsx +0 -181
  230. package/src/pages/index/components/normal/DemoIcon.tsx +0 -39
  231. package/src/pages/index/components/normal/DemoImage.tsx +0 -122
  232. package/src/pages/index/components/normal/DemoInput.scss +0 -0
  233. package/src/pages/index/components/normal/DemoInput.tsx +0 -790
  234. package/src/pages/index/components/normal/DemoKeepAlive.tsx +0 -505
  235. package/src/pages/index/components/normal/DemoList.scss +0 -15
  236. package/src/pages/index/components/normal/DemoList.tsx +0 -82
  237. package/src/pages/index/components/normal/DemoLoading.tsx +0 -83
  238. package/src/pages/index/components/normal/DemoNumber.tsx +0 -266
  239. package/src/pages/index/components/normal/DemoPagination.tsx +0 -164
  240. package/src/pages/index/components/normal/DemoPopup.tsx +0 -695
  241. package/src/pages/index/components/normal/DemoProgress.tsx +0 -133
  242. package/src/pages/index/components/normal/DemoRadio.scss +0 -16
  243. package/src/pages/index/components/normal/DemoRadio.tsx +0 -188
  244. package/src/pages/index/components/normal/DemoRate.tsx +0 -77
  245. package/src/pages/index/components/normal/DemoScroll.scss +0 -22
  246. package/src/pages/index/components/normal/DemoScroll.tsx +0 -300
  247. package/src/pages/index/components/normal/DemoSegment.tsx +0 -71
  248. package/src/pages/index/components/normal/DemoSelect.tsx +0 -819
  249. package/src/pages/index/components/normal/DemoSlider.tsx +0 -128
  250. package/src/pages/index/components/normal/DemoStep.scss +0 -18
  251. package/src/pages/index/components/normal/DemoStep.tsx +0 -291
  252. package/src/pages/index/components/normal/DemoTab.tsx +0 -338
  253. package/src/pages/index/components/normal/DemoTag.tsx +0 -100
  254. package/src/pages/index/components/normal/DemoTime.tsx +0 -403
  255. package/src/pages/index/components/normal/DemoToggle.tsx +0 -56
  256. package/src/pages/index/components/normal/DemoTooltip.tsx +0 -120
  257. package/src/pages/index/components/normal/DemoTree.tsx +0 -1099
  258. package/src/pages/index/components/normal/DemoUpload.tsx +0 -484
  259. package/src/pages/index/components/normal/DemoVirtualList.tsx +0 -378
  260. package/src/pages/index/components/service/DemoDialogService.tsx +0 -248
  261. package/src/pages/index/components/service/DemoFileService.tsx +0 -110
  262. package/src/pages/index/components/service/DemoMessageService.tsx +0 -100
  263. package/src/pages/index/components/service/DemoNoticeService.tsx +0 -99
  264. package/src/pages/index/components/service/DemoPopupService.tsx +0 -322
  265. package/src/pages/index/components/table/DemoPlcOperation.tsx +0 -307
  266. package/src/pages/index/components/table/DemoTableBasic.tsx +0 -220
  267. package/src/pages/index/components/table/DemoTableCheck.tsx +0 -78
  268. package/src/pages/index/components/table/DemoTableClassAndStyle.scss +0 -18
  269. package/src/pages/index/components/table/DemoTableClassAndStyle.tsx +0 -112
  270. package/src/pages/index/components/table/DemoTableColDraggable.tsx +0 -80
  271. package/src/pages/index/components/table/DemoTableEdit.tsx +0 -136
  272. package/src/pages/index/components/table/DemoTableExpand.tsx +0 -181
  273. package/src/pages/index/components/table/DemoTableFixed.tsx +0 -131
  274. package/src/pages/index/components/table/DemoTableFormatter.tsx +0 -66
  275. package/src/pages/index/components/table/DemoTableOverflowTooltip.tsx +0 -67
  276. package/src/pages/index/components/table/DemoTableRowDraggable.tsx +0 -106
  277. package/src/pages/index/components/table/DemoTableSlots.tsx +0 -153
  278. package/src/pages/index/components/table/DemoTableSpan.tsx +0 -167
  279. package/src/pages/index/components/table/DemoTableTree.tsx +0 -976
  280. package/src/pages/index/components/table/DemoVirtualTable.tsx +0 -274
  281. package/src/pages/index/components/test/DemoI18n.tsx +0 -27
  282. package/src/pages/index/components/test/DemoI18n2.jsx +0 -11
  283. package/src/pages/index/home/AppContent.tsx +0 -69
  284. package/src/pages/index/home/AppHead.tsx +0 -104
  285. package/src/pages/index/home/AppHome.tsx +0 -16
  286. package/src/pages/index/home/AppMenu.tsx +0 -38
  287. package/src/pages/index/home/menus.tsx +0 -217
  288. package/src/pages/index/main.tsx +0 -23
  289. package/src/pages/index/nav/$nav.ts +0 -41
  290. package/src/pages/index/pages.d.ts +0 -6
  291. package/src/pages/libs/iconfont-fontcls/demo.css +0 -539
  292. package/src/pages/libs/iconfont-fontcls/demo_index.html +0 -303
  293. package/src/pages/libs/iconfont-fontcls/iconfont.css +0 -35
  294. package/src/pages/libs/iconfont-fontcls/iconfont.js +0 -1
  295. package/src/pages/libs/iconfont-fontcls/iconfont.json +0 -44
  296. package/src/pages/libs/iconfont-fontcls/iconfont.ttf +0 -0
  297. package/src/pages/libs/iconfont-fontcls/iconfont.woff +0 -0
  298. package/src/pages/libs/iconfont-fontcls/iconfont.woff2 +0 -0
  299. package/src/pages/libs/iconfont-symbol/demo.css +0 -539
  300. package/src/pages/libs/iconfont-symbol/demo_index.html +0 -303
  301. package/src/pages/libs/iconfont-symbol/iconfont.css +0 -35
  302. package/src/pages/libs/iconfont-symbol/iconfont.js +0 -1
  303. package/src/pages/libs/iconfont-symbol/iconfont.json +0 -44
  304. package/src/pages/libs/iconfont-symbol/iconfont.ttf +0 -0
  305. package/src/pages/libs/iconfont-symbol/iconfont.woff +0 -0
  306. package/src/pages/libs/iconfont-symbol/iconfont.woff2 +0 -0
  307. package/src/pages/libs/install.iconfont-fontcls.tsx +0 -11
  308. package/src/pages/libs/install.iconfont-symbol.scss +0 -7
  309. package/src/pages/libs/install.iconfont-symbol.tsx +0 -14
  310. package/src/pages/module/address.ts +0 -27
  311. package/src/pages/module/http.ts +0 -24
  312. package/src/pages/module/index.ts +0 -19
  313. package/src/pages/module/object.ts +0 -5
  314. package/src/pages/module/ov.tsx +0 -13
  315. package/src/pages/module/upload.ts +0 -9
  316. package/src/pages/module/useTableOption.ts +0 -28
@@ -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,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
- }
@@ -1,274 +0,0 @@
1
- import {classnames, computed, designComponent, getComponentCls, onMounted, reactive, useClasses, useCollect, useModel, useRefs, useStyles, watch} from "plain-design-composition";
2
- import {unit} from "plain-utils/string/unit";
3
- import {throttle} from "plain-utils/utils/throttle";
4
- import Icon from "../Icon";
5
- import {Carousel} from "../Carousel";
6
- import './carousel.scss';
7
-
8
- export const CarouselGroup = designComponent({
9
- name: 'carousel-group',
10
- props: {
11
- modelValue: { type: [String, Number] }, // 双向绑定值
12
- height: { type: [Number, String], default: 225 }, // 轮播高度
13
- autoplay: { type: Number, default: 3000 }, // 自定播放时间,为0则取消自动播放
14
- disabledOperator: { type: Boolean }, // 禁用前后按钮
15
- disabledIndicator: { type: Boolean }, // 禁用指示器
16
- indicatorTrigger: { type: String, default: 'click' }, // 指示器激活触发器:click。hover
17
- vertical: { type: Boolean }, // 轮播方向为纵向
18
- card: { type: Boolean }, // 卡片形式的切换
19
- cardScale: { type: Number, default: 0.64 }, // 卡片形式轮播的时候,缩小比例
20
- },
21
- inheritPropsType: HTMLDivElement,
22
- scopeSlots: {
23
- indicator: (scope: { val: string, index: number, active: boolean }) => {},
24
- },
25
- slots: ['cover', 'default'],
26
- emits: {
27
- onUpdateModelValue: (val: string | number | undefined | null) => true,
28
- },
29
- setup({ props, slots, scopeSlots, event: { emit } }) {
30
-
31
- /*子元素*/
32
- const items = CarouselCollector.parent();
33
-
34
- const { refs, onRef } = useRefs({
35
- el: HTMLDivElement
36
- });
37
- const state = reactive({
38
- width: 0, // 容器宽度
39
- height: 0, // 容器高度
40
- autoplayTimer: null as null | number, // 自动播放定时器
41
- prevActiveIndex: null as null | number, // 上一个激活的index,当元素个数为3时,需要通过这个属性优化动画
42
- });
43
-
44
- /*双向绑定值*/
45
- const model = useModel(() => props.modelValue, emit.onUpdateModelValue);
46
- /*子元素val数组*/
47
- const vals = computed(() => items.map(item => String(item.itemVal)!));
48
- /*当前激活的元素的val值*/
49
- const activeVal = computed(() => {
50
- if (vals.value.length === 0) {
51
- return null;
52
- }
53
- if (model.value != null) {
54
- return String(model.value);
55
- } else {
56
- return vals.value[0];
57
- }
58
- });
59
- /*当前激活的元素的val的在 数组中的索引*/
60
- const activeIndex = computed(() => {
61
- if (!activeVal.value) {
62
- return 0;
63
- }
64
- return vals.value.indexOf(activeVal.value);
65
- });
66
-
67
- /*实际渲染的,排序过的val数组*/
68
- const sortVals = computed(() => {
69
- const valArray = vals.value;
70
- let prev = valArray.slice(0, activeIndex.value);
71
- let next = valArray.slice(activeIndex.value + 1);
72
-
73
- if (Math.abs(prev.length - next.length) > 1) {
74
- if (prev.length > next.length) {
75
- while (prev.length - next.length > 1) {
76
- next.push(prev.shift()!);
77
- }
78
- } else {
79
- while (next.length - prev.length > 1) {
80
- prev.unshift(next.pop()!);
81
- }
82
- }
83
- }
84
- return [...prev, activeVal.value, ...next];
85
- });
86
-
87
- const classes = useClasses(() => [
88
- getComponentCls('carousel-group'),
89
- {
90
- 'carousel-vertical': props.vertical,
91
- 'carousel-card': props.card,
92
- }
93
- ]);
94
- const styles = useStyles(style => {
95
- style.height = unit(props.height);
96
- });
97
-
98
- const utils = {
99
- /**
100
- * 子元素的左偏移位置
101
- * @author 韦胜健
102
- * @date 2020/11/22 23:19
103
- */
104
- getItemStyles: (val: any) => {
105
- if (!state.width) {
106
- return null;
107
- }
108
- /*当前val在sortVals中的索引*/
109
- const sortIndex = sortVals.value.indexOf(String(val));
110
- /*激活val在sortVals中的索引*/
111
- const activeSortIndex = sortVals.value.indexOf(String(activeVal.value));
112
-
113
- /*当前val与激活val在sortVal的间距*/
114
- let duration = sortIndex - activeSortIndex;
115
-
116
- const style = {
117
- zIndex: sortVals.value.length - Math.abs(duration),
118
- } as any;
119
-
120
- if (!props.vertical) {
121
- if (!props.card) {
122
- /*非卡片形式的轮播*/
123
- style.transform = `translateX(${duration * state.width}px)`;
124
- } else {
125
- style.width = `${props.cardScale * 100}%`;
126
- style.height = `${props.cardScale * 100}%`;
127
-
128
- /*卡片轮播*/
129
- let left = duration * state.width * (props.cardScale) + (state.width * (1 - props.cardScale) / 2);
130
- left += (sortIndex > activeSortIndex ? -1 : 1) * Math.abs(sortIndex - activeSortIndex) * state.width * 0.125;
131
- style.transform = `translateX(${left}px) translateY(${state.height * ((1 - props.cardScale) / 2)}px) scale(${sortIndex === activeSortIndex ? '1' : '0.83'})`;
132
- }
133
- } else {
134
- /*纵向非卡片形式的轮播*/
135
- style.transform = `translateY(${duration * state.height}px)`;
136
- }
137
-
138
- return style;
139
- },
140
- /**
141
- * 重置自动播放定时器
142
- * @author 韦胜健
143
- * @date 2020/11/22 23:19
144
- */
145
- resetAutoplayTimer: (autoplay: number | null) => {
146
- /*无论怎么样都要清理掉定时器*/
147
- if (!!state.autoplayTimer) {
148
- clearInterval(state.autoplayTimer);
149
- state.autoplayTimer = null;
150
- }
151
- /*如果autoplay有值,重新设定一个自动播放定时器*/
152
- if (!!autoplay) {
153
- state.autoplayTimer = setInterval(methods.next, autoplay) as any as number;
154
- }
155
- },
156
- /**
157
- * 子元素是否需要动画(当元素为3时,只有prevActiveIndex以及activeIndex的元素需要动画,另一个需要立刻移动到对应的位置)
158
- * @author 韦胜健
159
- * @date 2020/11/22 23:20
160
- */
161
- isAnimating: (val: any) => {
162
- if (vals.value.length !== 3 && !props.card) {
163
- return true;
164
- }
165
- let index = vals.value.indexOf(val);
166
- return index === state.prevActiveIndex || index === activeIndex.value;
167
- },
168
- };
169
-
170
- const methods = {
171
- /**
172
- * 显示上一个元素
173
- * @author 韦胜健
174
- * @date 2020/11/22 23:21
175
- */
176
- prev: () => {
177
- state.prevActiveIndex = activeIndex.value;
178
- model.value = sortVals.value[sortVals.value.indexOf(activeVal.value) - 1]!;
179
- },
180
- /**
181
- * 显示下一个元素
182
- * @author 韦胜健
183
- * @date 2020/11/22 23:21
184
- */
185
- next: () => {
186
- state.prevActiveIndex = activeIndex.value;
187
- model.value = sortVals.value[sortVals.value.indexOf(activeVal.value) + 1]!;
188
- },
189
- /**
190
- * 显示特定元素
191
- * @author 韦胜健
192
- * @date 2020/11/22 23:21
193
- */
194
- show: (val: any) => {
195
- state.prevActiveIndex = activeIndex.value;
196
- model.value = val;
197
-
198
- utils.resetAutoplayTimer(props.autoplay);
199
- },
200
- };
201
-
202
- const handler = {
203
- onPrev: throttle(() => {
204
- utils.resetAutoplayTimer(props.autoplay);
205
- methods.prev();
206
- }, 500, { trailing: true, leading: true }),
207
- onNext: throttle(() => {
208
- utils.resetAutoplayTimer(props.autoplay);
209
- methods.next();
210
- }, 500, { trailing: true, leading: true }),
211
- onIndicator: (index: number) => {
212
- methods.show(vals.value[index]);
213
- },
214
- };
215
-
216
- onMounted(() => {
217
- state.width = refs.el!.offsetWidth;
218
- state.height = refs.el!.offsetHeight;
219
- });
220
-
221
- watch(() => props.autoplay, utils.resetAutoplayTimer, { immediate: true });
222
-
223
- return {
224
- refer: {
225
- refs,
226
- utils,
227
- methods,
228
- },
229
- render: () => (
230
- <div className={classes.value} style={styles.value} ref={onRef.el}>
231
- {slots.default()}
232
- {slots.cover.isExist() && <div className="carousel-cover">
233
- {slots.cover()}
234
- </div>}
235
-
236
- {!props.disabledOperator && <div className="carousel-operator">
237
- <div className="carousel-operator-btn carousel-operator-prev" onClick={handler.onPrev}>
238
- <Icon icon="pi-left"/>
239
- </div>
240
- <div className="carousel-operator-btn carousel-operator-next" onClick={handler.onNext}>
241
- <Icon icon="pi-right"/>
242
- </div>
243
- </div>}
244
-
245
- {!props.disabledIndicator && <div className="carousel-indicator">
246
- {items.map((item, index) => (
247
- scopeSlots.indicator({ val: String(item.itemVal), index, active: index === activeIndex.value }, (
248
- <div
249
- {...{
250
- [props.indicatorTrigger === 'hover' ? 'onMouseEnter' : 'onClick']: () => handler.onIndicator(index)
251
- }}
252
- className={classnames(
253
- [
254
- 'carousel-indicator-item',
255
- {
256
- 'carousel-indicator-item-active': index === activeIndex.value,
257
- }
258
- ]
259
- )} key={index}/>
260
- ))
261
- ))}
262
- </div>}
263
- </div>
264
- )
265
- };
266
- },
267
- });
268
-
269
- export default CarouselGroup;
270
-
271
- export const CarouselCollector = useCollect(() => ({
272
- parent: CarouselGroup,
273
- child: Carousel,
274
- }));