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,4 +1,4 @@
1
- import {ComponentPropsType, computed, designComponent, getComponentCls, onBeforeUnmount, PropType, reactive, RenderNode, useClassCache, useModel, useStyleCache, watch, watchEffect} from "plain-design-composition";
1
+ import {ComponentPropsType, computed, designComponent, Fragment, getComponentCls, onBeforeUnmount, PropType, reactive, RenderNode, useClassCache, useModel, useStyleCache, watch, watchEffect} from "plain-design-composition";
2
2
  import {iPopupAnimation, iPopupCustomOption, iPopupDefaultOption, iPopupPlacement, iPopupTrigger, iPopupUseOption, PopupItemProvide} from "../usePopup/utils/popup.utils";
3
3
  import {Reference} from "../Reference";
4
4
  import {usePopup} from "../usePopup";
@@ -34,7 +34,8 @@ export const Popup = designComponent({
34
34
  beforeHide: { type: Function as PropType<iPopupCustomOption['beforeHide']> }, // 隐藏之前处理动作,返回false则阻止隐藏
35
35
  destroyOnClose: { type: Boolean, default: true, }, // 是否在关闭的时候销毁内容
36
36
  type: { type: String as PropType<iPopupDefaultOption['type']> }, // 类型,在打开一个popup的时候,会将同类型的popup自动关闭
37
- to: { type: String as PropType<iPopupDefaultOption['to']> }, // 挂载到某个dom节点下
37
+ appendToBody: { type: Boolean as PropType<iPopupDefaultOption['appendToBody']>, default: true }, // 挂载到某个dom节点下
38
+ transformRefreshOnScroll: { type: Boolean as PropType<iPopupDefaultOption['transformRefreshOnScroll']>, default: true },// scroll的时候refresh使用transform来优化
38
39
  offset: { type: Number as PropType<iPopupDefaultOption['offset']> }, // 在direction方向上的距离
39
40
  autoSwitchDirection: { type: Boolean as PropType<iPopupDefaultOption['autoSwitchDirection']>, default: true },// 当空间不够时,是否自动切换direction
40
41
  size: { type: String as PropType<iPopupDefaultOption['size']> }, // popup内容尺寸
@@ -139,7 +140,9 @@ export const Popup = designComponent({
139
140
  const reference = computed(() => {
140
141
  let reference: any = props.reference || state.getReference();
141
142
  if (!!reference) {
142
- if (typeof reference === "function") {reference = reference();}
143
+ if (typeof reference === "function") {
144
+ reference = reference();
145
+ }
143
146
  if (!!reference && !!reference.$el) {
144
147
  reference = reference.$el;
145
148
  }
@@ -155,7 +158,9 @@ export const Popup = designComponent({
155
158
  const stickyReference = computed(() => {
156
159
  let reference: any = props.stickyReference;
157
160
  if (!!reference) {
158
- if (typeof reference === "function") {reference = reference();}
161
+ if (typeof reference === "function") {
162
+ reference = reference();
163
+ }
159
164
  if (!!reference && !!reference.$el) {
160
165
  reference = reference.$el;
161
166
  }
@@ -226,7 +231,8 @@ export const Popup = designComponent({
226
231
  noPadding: props.noPadding,
227
232
  destroyOnClose: props.destroyOnClose,
228
233
  type: props.type,
229
- to: props.to,
234
+ appendToBody: props.appendToBody,
235
+ transformRefreshOnScroll: props.transformRefreshOnScroll,
230
236
  offset: props.offset,
231
237
  autoSwitchDirection: props.autoSwitchDirection,
232
238
  refreshOnScroll: props.refreshOnScroll,
@@ -266,12 +272,16 @@ export const Popup = designComponent({
266
272
  },
267
273
  /*开启之前检查,如果已经禁用则禁止显示*/
268
274
  beforeShow: () => {
269
- if (props.disabled || props.readonly) {return false;}
275
+ if (props.disabled || props.readonly) {
276
+ return false;
277
+ }
270
278
  return props.beforeShow?.();
271
279
  },
272
280
  /*关闭之前检查,如果已经禁用则禁止关闭*/
273
281
  beforeHide: () => {
274
- if (props.disabled || props.readonly) {return false;}
282
+ if (props.disabled || props.readonly) {
283
+ return false;
284
+ }
275
285
  return props.beforeHide?.();
276
286
  },
277
287
 
@@ -284,7 +294,7 @@ export const Popup = designComponent({
284
294
  {(slots.head.isExist() || !!props.title) && (
285
295
  <div className="popper-head">{slots.head(typeof props.title === "function" ? props.title() : props.title)}</div>
286
296
  )}
287
- {slots.popper(typeof props.message === "function" ? props.message() : props.message)}
297
+ <Fragment key="popper">{slots.popper(typeof props.message === "function" ? props.message() : props.message)}</Fragment>
288
298
  </div>
289
299
  );
290
300
 
@@ -346,14 +356,18 @@ export const Popup = designComponent({
346
356
  */
347
357
  if (!!model.value) {
348
358
  const unwatch = watch(() => reference.value, reference => {
349
- if (!reference) {return;}
359
+ if (!reference) {
360
+ return;
361
+ }
350
362
  unwatch();
351
363
  $popup.show(state.getOption());
352
364
  });
353
365
  }
354
366
 
355
367
  onBeforeUnmount(
356
- watch(() => props.watchData, () => {$popup.update(state.getOption());})
368
+ watch(() => props.watchData, () => {
369
+ $popup.update(state.getOption());
370
+ })
357
371
  );
358
372
 
359
373
  const refresh = () => {
@@ -32,7 +32,7 @@
32
32
  text-align: right;
33
33
 
34
34
  span {
35
- color: white;
35
+ color: plv(pbfc);
36
36
  }
37
37
  }
38
38
  }
@@ -5,6 +5,7 @@ import {Icon} from "../Icon";
5
5
  import './rate.scss';
6
6
  import {EditProps, useEdit} from "../../uses/useEdit";
7
7
  import {StyleProps, ThemeStatus, useStyle} from "../../uses/useStyle";
8
+ import {ClientZoom} from "../ClientZoom";
8
9
 
9
10
  export const Rate = designComponent({
10
11
  name: 'rate',
@@ -79,7 +80,8 @@ export const Rate = designComponent({
79
80
 
80
81
  const methods = {
81
82
  reset: (e: MouseEvent | iMouseEvent) => {
82
- let dur = e.clientX - (elLeft.value || 0);
83
+ const { clientX } = ClientZoom.getClientPosition(e);
84
+ let dur = clientX - (elLeft.value || 0);
83
85
  let start = 0;
84
86
  let end = totalWidth.value;
85
87
  let step = end / props.count;
@@ -5,6 +5,7 @@ import {enableUserSelect} from "plain-utils/dom/enableUserSelect";
5
5
  import {Scroll} from "./index";
6
6
  import {delay} from "plain-utils/utils/delay";
7
7
  import Tooltip from "../Tooltip";
8
+ import {ClientZoom} from "../ClientZoom";
8
9
 
9
10
  export const HorizontalScrollbar = designComponent({
10
11
  props: {
@@ -41,15 +42,17 @@ export const HorizontalScrollbar = designComponent({
41
42
  state.scrollLeft = (e.target as HTMLElement).scrollLeft;
42
43
  },
43
44
  onMousedown: (e: iMouseEvent) => {
45
+ const { clientX } = ClientZoom.getClientPosition(e);
44
46
  scroll.freezeState.isDragging = true;
45
47
  dragState.left = left.value;
46
- dragState.clientX = e.clientX;
48
+ dragState.clientX = clientX;
47
49
  document.addEventListener('mousemove', handler.onMousemove);
48
50
  document.addEventListener('mouseup', handler.onMouseup);
49
51
  disabledUserSelect();
50
52
  },
51
53
  onMousemove: (e: MouseEvent) => {
52
- let deltaX = e.clientX - dragState.clientX;
54
+ const { clientX } = ClientZoom.getClientPosition(e);
55
+ let deltaX = clientX - dragState.clientX;
53
56
  const left = dragState.left + deltaX;
54
57
  let scrollLeft = left * (scroll.state.contentWidth - scroll.state.hostWidth) / (scroll.state.hostWidth - width.value);
55
58
  scrollLeft = Math.max(0, Math.min(scrollLeft, scroll.state.contentWidth - scroll.state.hostWidth));
@@ -66,7 +69,8 @@ export const HorizontalScrollbar = designComponent({
66
69
  enableUserSelect();
67
70
 
68
71
  if (scroll.props.scrollAfterDragEnd) {
69
- let deltaX = e.clientX - dragState.clientX;
72
+ const { clientX } = ClientZoom.getClientPosition(e);
73
+ let deltaX = clientX - dragState.clientX;
70
74
  const left = dragState.left + deltaX;
71
75
  scroll.refs.wrapper!.scrollLeft = left * (scroll.state.contentWidth - scroll.state.hostWidth) / (scroll.state.hostWidth - width.value);
72
76
  }
@@ -5,6 +5,7 @@ import {enableUserSelect} from "plain-utils/dom/enableUserSelect";
5
5
  import {Scroll} from "./index";
6
6
  import {delay} from "plain-utils/utils/delay";
7
7
  import Tooltip from "../Tooltip";
8
+ import {ClientZoom} from "../ClientZoom";
8
9
 
9
10
  export const VerticalScrollbar = designComponent({
10
11
  props: {
@@ -46,15 +47,17 @@ export const VerticalScrollbar = designComponent({
46
47
  state.scrollTop = (e.target as HTMLElement).scrollTop;
47
48
  },
48
49
  onMousedown: (e: iMouseEvent) => {
50
+ const { clientY } = ClientZoom.getClientPosition(e);
49
51
  scroll.freezeState.isDragging = true;
50
52
  dragState.top = top.value;
51
- dragState.clientY = e.clientY;
53
+ dragState.clientY = clientY;
52
54
  document.addEventListener('mousemove', handler.onMousemove);
53
55
  document.addEventListener('mouseup', handler.onMouseup);
54
56
  disabledUserSelect();
55
57
  },
56
58
  onMousemove: (e: MouseEvent) => {
57
- let deltaY = e.clientY - dragState.clientY;
59
+ const { clientY } = ClientZoom.getClientPosition(e);
60
+ let deltaY = clientY - dragState.clientY;
58
61
  let top = dragState.top + deltaY;
59
62
  let scrollTop = top * (scroll.state.contentHeight - scroll.state.hostHeight) / (scroll.state.hostHeight - height.value);
60
63
  scrollTop = Math.max(0, Math.min(scrollTop, scroll.state.contentHeight - scroll.state.hostHeight));
@@ -72,7 +75,8 @@ export const VerticalScrollbar = designComponent({
72
75
  enableUserSelect();
73
76
 
74
77
  if (scroll.props.scrollAfterDragEnd) {
75
- let deltaY = e.clientY - dragState.clientY;
78
+ const { clientY } = ClientZoom.getClientPosition(e);
79
+ let deltaY = clientY - dragState.clientY;
76
80
  let top = dragState.top + deltaY;
77
81
  scroll.refs.wrapper!.scrollTop = top * (scroll.state.contentHeight - scroll.state.hostHeight) / (scroll.state.hostHeight - height.value);
78
82
  }
@@ -78,9 +78,9 @@ export const Scroll = designComponent({
78
78
  set isDragging(val: boolean) {
79
79
  this._isDragging = val;
80
80
  if (val) {
81
- refs.host!.setAttribute('is-dragging', '');
81
+ refs.host?.setAttribute('is-dragging', '');
82
82
  } else {
83
- refs.host!.removeAttribute('is-dragging');
83
+ refs.host?.removeAttribute('is-dragging');
84
84
  }
85
85
  },
86
86
  };
@@ -215,9 +215,9 @@ export const Scroll = designComponent({
215
215
  * @date 2020/12/15 10:16
216
216
  */
217
217
  disableListTransition: (() => {
218
- const disabledQueueAnimation = debounce(() => refs.host!.removeAttribute('virtual-scrolling'), 300, true);
218
+ const disabledQueueAnimation = debounce(() => refs.host?.removeAttribute('virtual-scrolling'), 300, true);
219
219
  return () => {
220
- refs.host!.setAttribute('virtual-scrolling', '');
220
+ refs.host?.setAttribute('virtual-scrolling', '');
221
221
  disabledQueueAnimation();
222
222
  };
223
223
  })(),
@@ -227,9 +227,9 @@ export const Scroll = designComponent({
227
227
  * @date 2022.10.28 21:34
228
228
  */
229
229
  disableInnerTransition: (() => {
230
- const disabledQueueAnimation = debounce(() => refs.host!.removeAttribute('disable-all-transition'), 300, true);
230
+ const disabledQueueAnimation = debounce(() => refs.host?.removeAttribute('disable-all-transition'), 300, true);
231
231
  return () => {
232
- refs.host!.setAttribute('disable-all-transition', '');
232
+ refs.host?.setAttribute('disable-all-transition', '');
233
233
  disabledQueueAnimation();
234
234
  };
235
235
  })()
@@ -236,7 +236,7 @@ export function createPublicSelectRender(
236
236
  const { virtualRowSize } = props;
237
237
  return virtualRowSize == null ? SelectDefaultVirtualRowSize[styleComputed.value.size] : virtualRowSize;
238
238
  })()}>
239
- {{ default: ({ item, index }: { item: iSelectOptionProps, index: number }) => <SelectOption {...item} index={index} key={index}/> }}
239
+ {{ default: ({ item, index, vIndex }: { item: iSelectOptionProps, index: number, vIndex: number }) => <SelectOption {...item} index={index} key={vIndex}/> }}
240
240
  </VirtualList>
241
241
  </div>) : (
242
242
  matchOptionPropsList.map((i, index) => (<SelectOption {...i} index={index}/>))
@@ -47,7 +47,7 @@
47
47
  transition: all 300ms ease;
48
48
  opacity: 0;
49
49
  background-color: rgba(black, 0.8);
50
- color: white;
50
+ color: #ffffff;
51
51
  padding: 3px 6px;
52
52
  line-height: initial;
53
53
  position: absolute;
@@ -3,6 +3,7 @@ import {disabledUserSelect} from "plain-utils/dom/disabledUserSelect";
3
3
  import {enableUserSelect} from "plain-utils/dom/enableUserSelect";
4
4
  import {iMouseEvent, reactive} from "plain-design-composition";
5
5
  import {iSliderHooks} from "./slider.utils";
6
+ import {ClientZoom} from "../ClientZoom";
6
7
 
7
8
  export function useSliderDotDraggier<InitialState>(
8
9
  hooks: iSliderHooks,
@@ -24,10 +25,11 @@ export function useSliderDotDraggier<InitialState>(
24
25
 
25
26
  const handler = {
26
27
  onMousedown: (e: iMouseEvent) => {
28
+ const { clientX, clientY } = ClientZoom.getClientPosition(e);
27
29
  staticState = {
28
30
  start: {
29
- x: e.clientX,
30
- y: e.clientY,
31
+ x: clientX,
32
+ y: clientY,
31
33
  },
32
34
  state: getInitialState(),
33
35
  };
@@ -46,8 +48,9 @@ export function useSliderDotDraggier<InitialState>(
46
48
  },
47
49
  onMousemove: (e: MouseEvent) => {
48
50
  if (!staticState) {return;}
49
- const durX = e.clientX - staticState.start.x;
50
- const durY = e.clientY - staticState.start.y;
51
+ const { clientX, clientY } = ClientZoom.getClientPosition(e);
52
+ const durX = clientX - staticState.start.x;
53
+ const durY = clientY - staticState.start.y;
51
54
  handleDraggier({
52
55
  durX,
53
56
  durY,
@@ -0,0 +1,191 @@
1
+ import {computed, CSSProperties, designComponent, getComponentCls, iHTMLDivElement, iMouseEvent, PropType, reactive, useClasses, useModel, useRefs} from "plain-design-composition";
2
+ import './sort-list.scss';
3
+ import {createEffects} from "plain-utils/utils/createEffects";
4
+ import {addWindowListener} from "plain-utils/dom/addWindowListener";
5
+ import {getRectAutoFormat} from "../../utils/getRectAutoFormat";
6
+ import {iElementRect} from "../../utils/getRowEl";
7
+
8
+ export const SortList = designComponent({
9
+ name: 'sort-list',
10
+ props: {
11
+ modelValue: { type: Array as PropType<any[]> },
12
+ col: { type: Number, default: 1 },
13
+ space: { type: Number, default: 0 },
14
+ },
15
+ emits: {
16
+ onUpdateModelValue: (val: any[]) => true,
17
+ onDragStart: (data: { item: any, index: number, e: iMouseEvent }) => true,
18
+ },
19
+ scopeSlots: {
20
+ default: (data: { item: any, index: number }) => true,
21
+ },
22
+ setup({ props, scopeSlots, event: { emit } }) {
23
+
24
+ const { refs, onRef } = useRefs({ el: iHTMLDivElement });
25
+
26
+ const model = useModel(() => props.modelValue || [], emit.onUpdateModelValue);
27
+
28
+ const isHorizontal = computed(() => props.col > 1);
29
+
30
+ const classes = useClasses(() => [
31
+ getComponentCls('sort-list'),
32
+ ]);
33
+
34
+ const draggier = (() => {
35
+
36
+ const draggierState = reactive({
37
+ isDragging: false,
38
+ });
39
+
40
+ const mousedown = (e: iMouseEvent, item: any, index: number) => {
41
+ emit.onDragStart({ item, index, e });
42
+
43
+ const { effects: draggierEffects } = createEffects();
44
+ const staticState = {
45
+ start: {
46
+ x: e.clientX,
47
+ y: e.clientY,
48
+ left: 0,
49
+ top: 0,
50
+ },
51
+ siblingRects: (() => {
52
+ const sortItemElements = Array.from(refs.el!.querySelectorAll('.sort-item')) as HTMLElement[];
53
+ return sortItemElements.map((el, index) => {
54
+ return {
55
+ index,
56
+ rects: getRectAutoFormat(el)
57
+ };
58
+ });
59
+ })(),
60
+ dropData: null as null | {
61
+ itemRect: { index: number, rects: Omit<iElementRect, 'right' | 'bottom'> },
62
+ pos: 'prev' | 'next'
63
+ }
64
+ };
65
+ const sourceElement = (e.currentTarget as HTMLElement);
66
+ const sourceRect = getRectAutoFormat(sourceElement);
67
+ staticState.start.left = sourceRect.left;
68
+ staticState.start.top = sourceRect.top;
69
+ let shadowElement: HTMLElement | null = null;
70
+ let indicator: HTMLDivElement | null = null;
71
+ const indicatorSize = 2;
72
+
73
+ draggierEffects.push(addWindowListener('mouseup', draggierEffects.clear));
74
+ draggierEffects.push(addWindowListener('mousemove', (e) => {
75
+ const durX = e.clientX - staticState.start.x;
76
+ const durY = e.clientY - staticState.start.y;
77
+
78
+ if (!draggierState.isDragging) {
79
+ if (Math.abs(durX) > 5 || Math.abs(durY) > 5) {
80
+ draggierState.isDragging = true;
81
+ draggierEffects.push(() => {draggierState.isDragging = false;});
82
+
83
+ shadowElement = sourceElement.cloneNode(true) as HTMLElement;
84
+ shadowElement.style.boxSizing = 'border-box';
85
+ shadowElement.style.position = 'fixed';
86
+ shadowElement.style.top = sourceRect.top + 'px';
87
+ shadowElement.style.left = sourceRect.left + 'px';
88
+ shadowElement.style.height = sourceRect.height + 'px';
89
+ shadowElement.style.width = sourceRect.width + 'px';
90
+ shadowElement.style.opacity = '0.5';
91
+ shadowElement.style.zIndex = '2';
92
+ refs.el!.appendChild(shadowElement);
93
+ draggierEffects.push(() => {refs.el!.removeChild(shadowElement!);});
94
+
95
+ sourceElement.style.opacity = "0";
96
+ draggierEffects.push(() => sourceElement.style.opacity = "");
97
+
98
+ indicator = document.createElement('div') as HTMLDivElement;
99
+ indicator.style.position = 'fixed';
100
+ indicator.style.zIndex = '3';
101
+ refs.el!.appendChild(indicator);
102
+ draggierEffects.push(() => {refs.el!.removeChild(indicator!);});
103
+
104
+ draggierEffects.push(() => {
105
+ if (!staticState.dropData) {return;}
106
+ if (staticState.dropData.itemRect.index === index) {return;}
107
+ let currentIndex = index;
108
+ let targetIndex = staticState.dropData.itemRect.index + (staticState.dropData.pos === 'prev' ? 0 : 1);
109
+ const newData = [...model.value];
110
+ const removeData = newData.splice(currentIndex, 1);
111
+ newData.splice(targetIndex > currentIndex ? targetIndex - 1 : targetIndex, 0, ...removeData);
112
+ model.value = newData;
113
+ });
114
+ }
115
+ }
116
+ if (!draggierState.isDragging || !shadowElement || !indicator) {
117
+ return;
118
+ }
119
+
120
+ shadowElement.style.top = `${Math.ceil(staticState.start.top + durY)}px`;
121
+ shadowElement.style.left = `${Math.ceil(staticState.start.left + durX)}px`;
122
+
123
+ const matchItemRect = staticState.siblingRects.find(i => {
124
+ return e.clientY > i.rects.top && e.clientY < i.rects.top + i.rects.height && e.clientX > i.rects.left && e.clientX < i.rects.left + i.rects.width;
125
+ });
126
+ if (!matchItemRect) {
127
+ staticState.dropData = null;
128
+ indicator.style.display = 'none';
129
+ } else {
130
+ staticState.dropData = {
131
+ itemRect: matchItemRect,
132
+ pos: (() => {
133
+ if (isHorizontal.value) {
134
+ return e.clientX > matchItemRect.rects.left + matchItemRect.rects.width / 2 ? 'next' : 'prev';
135
+ } else {
136
+ return e.clientY > matchItemRect.rects.top + matchItemRect.rects.height / 2 ? 'next' : 'prev';
137
+ }
138
+ })()
139
+ };
140
+ indicator.style.display = 'block';
141
+ indicator.style.backgroundColor = 'black';
142
+ if (isHorizontal.value) {
143
+ indicator.style.top = matchItemRect.rects.top + 'px';
144
+ indicator.style.height = matchItemRect.rects.height + 'px';
145
+ indicator.style.left = matchItemRect.rects.left + (staticState.dropData.pos === 'prev' ? (-indicatorSize / 2 - props.space / 2) : (matchItemRect.rects.width + props.space / 2 - indicatorSize / 2)) + 'px';
146
+ indicator.style.width = indicatorSize + 'px';
147
+ } else {
148
+ indicator.style.left = matchItemRect.rects.left + 'px';
149
+ indicator.style.width = matchItemRect.rects.width + 'px';
150
+ indicator.style.top = matchItemRect.rects.top + (staticState.dropData.pos === 'prev' ? (-indicatorSize / 2 - props.space / 2) : (matchItemRect.rects.height + props.space / 2 - indicatorSize / 2)) + 'px';
151
+ indicator.style.height = indicatorSize + 'px';
152
+ }
153
+ }
154
+ }));
155
+ };
156
+
157
+ return { mousedown };
158
+ })();
159
+
160
+ return () => (
161
+ <div
162
+ className={classes.value}
163
+ data-direction={isHorizontal.value ? 'horizontal' : 'vertical'}
164
+ ref={onRef.el}
165
+ >
166
+ {model.value.map((item, index) => {
167
+ const styles = {} as CSSProperties;
168
+ if (props.col !== 1) {
169
+ styles.width = `calc((100% - ${(props.col - 1) * props.space}px) / ${props.col})`;
170
+ if ((index + 1) % props.col !== 0) {
171
+ styles.marginRight = props.space + 'px';
172
+ }
173
+ } else {
174
+ styles.width = '100%';
175
+ }
176
+ styles.marginBottom = props.space + 'px';
177
+ return (
178
+ <div
179
+ className="sort-item"
180
+ style={styles}
181
+ key={index}
182
+ onMouseDown={e => draggier.mousedown(e, item, index)}
183
+ >
184
+ {scopeSlots.default({ item, index }, null)}
185
+ </div>
186
+ );
187
+ })}
188
+ </div>
189
+ );
190
+ },
191
+ });
@@ -0,0 +1,11 @@
1
+ @include comp(sort-list) {
2
+ user-select: none;
3
+ &[data-direction=horizontal] {
4
+ display: flex;
5
+ flex-wrap: wrap;
6
+ }
7
+ &[data-direction=vertical] {
8
+ display: flex;
9
+ flex-direction: column;
10
+ }
11
+ }