plain-design 1.0.0-beta.6 → 1.0.0-beta.60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (840) hide show
  1. package/README.md +2 -2
  2. package/dist/plain-design.commonjs.min.js +12 -3
  3. package/dist/plain-design.min.css +46 -37
  4. package/dist/plain-design.min.js +12 -3
  5. package/dist/report.html +5 -5
  6. package/package.json +91 -90
  7. package/src/index.ts +1 -1
  8. package/src/packages/build.ts +7 -15
  9. package/src/packages/components/$address/address.utils.ts +31 -31
  10. package/src/packages/components/$address/createAddressService.tsx +184 -184
  11. package/src/packages/components/$address/index.tsx +7 -7
  12. package/src/packages/components/$configuration/index.tsx +58 -58
  13. package/src/packages/components/$dialog/index.tsx +7 -7
  14. package/src/packages/components/$file/index.tsx +212 -212
  15. package/src/packages/components/$image/index.tsx +7 -7
  16. package/src/packages/components/$message/image.service.utils.tsx +161 -161
  17. package/src/packages/components/$message/index.tsx +7 -7
  18. package/src/packages/components/$notice/index.tsx +7 -7
  19. package/src/packages/components/$object/createObjectService.tsx +215 -203
  20. package/src/packages/components/$object/index.ts +5 -5
  21. package/src/packages/components/$object/object.conver.ts +56 -56
  22. package/src/packages/components/$object/object.service.utils.ts +56 -52
  23. package/src/packages/components/$ov/createOvService.ts +86 -86
  24. package/src/packages/components/$ov/index.tsx +5 -5
  25. package/src/packages/components/$ov/ov.utils.ts +11 -11
  26. package/src/packages/components/$previewer/ImagePreviewerFixedContainer.tsx +108 -0
  27. package/src/packages/components/$previewer/image-previewer-fixed-container.scss +18 -0
  28. package/src/packages/components/$previewer/index.tsx +52 -0
  29. package/src/packages/components/$upload/createUploadService.tsx +57 -57
  30. package/src/packages/components/$upload/upload.utils.ts +17 -17
  31. package/src/packages/components/Address/index.tsx +138 -138
  32. package/src/packages/components/AddressCascade/address-cascade.utils.ts +44 -44
  33. package/src/packages/components/AddressCascade/createAddressCascade.hooks.ts +9 -9
  34. package/src/packages/components/AddressCascade/createAddressCascade.multiple.tsx +53 -53
  35. package/src/packages/components/AddressCascade/createAddressCascade.single.tsx +75 -75
  36. package/src/packages/components/AddressCascade/index.tsx +57 -57
  37. package/src/packages/components/Alert/alert.scss +136 -136
  38. package/src/packages/components/Alert/index.tsx +93 -93
  39. package/src/packages/components/Application/application.scss +16 -16
  40. package/src/packages/components/Application/index.tsx +56 -53
  41. package/src/packages/components/Application/service/createApplicationService.tsx +47 -47
  42. package/src/packages/components/Application/service/createApplicationServiceComponent.tsx +41 -41
  43. package/src/packages/components/Application/service/createApplicationServiceManager.tsx +98 -98
  44. package/src/packages/components/Application/service/useApplicationService.tsx +126 -124
  45. package/src/packages/components/Application/theme/theme.ts +282 -260
  46. package/src/packages/components/Application/theme/theme.utils.ts +17 -17
  47. package/src/packages/components/Application/utils/application.utils.ts +27 -26
  48. package/src/packages/components/Application/utils/createServiceReadyObserver.ts +18 -18
  49. package/src/packages/components/ApplicationConfigurationProvider/index.tsx +5 -5
  50. package/src/packages/components/ArrowStep/index.tsx +73 -73
  51. package/src/packages/components/ArrowStepGroup/arrow-step.scss +106 -106
  52. package/src/packages/components/ArrowStepGroup/index.tsx +63 -63
  53. package/src/packages/components/AsyncFormatter/index.tsx +1 -1
  54. package/src/packages/components/AutoLoadingObserver/index.tsx +172 -0
  55. package/src/packages/components/AutoTable/AutoTable.tsx +56 -56
  56. package/src/packages/components/AutoTable/auto-table.scss +432 -399
  57. package/src/packages/components/AutoTable/createTableOptionUser.tsx +75 -75
  58. package/src/packages/components/AutoTable/filter/useTableOption.filter.form.tsx +214 -215
  59. package/src/packages/components/AutoTable/filter/useTableOption.filter.search.tsx +168 -168
  60. package/src/packages/components/AutoTable/filter/useTableOption.filter.state.ts +194 -194
  61. package/src/packages/components/AutoTable/index.tsx +4 -4
  62. package/src/packages/components/AutoTable/setting/useTableOption.setting.all.fitler.tsx +79 -79
  63. package/src/packages/components/AutoTable/setting/useTableOption.setting.cache.tsx +145 -145
  64. package/src/packages/components/AutoTable/setting/useTableOption.setting.config.tsx +218 -218
  65. package/src/packages/components/AutoTable/setting/useTableOption.setting.export.tsx +308 -308
  66. package/src/packages/components/AutoTable/setting/useTableOption.setting.import.tsx +100 -100
  67. package/src/packages/components/AutoTable/setting/useTableOption.setting.senior.filter.tsx +385 -385
  68. package/src/packages/components/AutoTable/setting/useTableOption.setting.senior.sort.tsx +116 -116
  69. package/src/packages/components/AutoTable/setting/useTableOption.setting.tsx +109 -109
  70. package/src/packages/components/AutoTable/setting/useTableOption.setting.utils.ts +40 -40
  71. package/src/packages/components/AutoTable/use/useTableOption.buttons.tsx +239 -227
  72. package/src/packages/components/AutoTable/use/useTableOption.cache.ts +235 -235
  73. package/src/packages/components/AutoTable/use/useTableOption.cache.utils.ts +83 -83
  74. package/src/packages/components/AutoTable/use/useTableOption.check.tsx +80 -80
  75. package/src/packages/components/AutoTable/use/useTableOption.column.popper.tsx +491 -490
  76. package/src/packages/components/AutoTable/use/useTableOption.confirm.tsx +122 -122
  77. package/src/packages/components/AutoTable/use/useTableOption.fill.tsx +153 -152
  78. package/src/packages/components/AutoTable/use/useTableOption.hooks.tsx +140 -132
  79. package/src/packages/components/AutoTable/use/useTableOption.loading.tsx +77 -71
  80. package/src/packages/components/AutoTable/use/useTableOption.methods.tsx +512 -510
  81. package/src/packages/components/AutoTable/use/useTableOption.pagination.tsx +191 -186
  82. package/src/packages/components/AutoTable/use/useTableOption.parent.tsx +131 -131
  83. package/src/packages/components/AutoTable/use/useTableOption.permission.tsx +16 -16
  84. package/src/packages/components/AutoTable/use/useTableOption.render.tsx +34 -34
  85. package/src/packages/components/AutoTable/use/useTableOption.sort.ts +197 -197
  86. package/src/packages/components/AutoTable/use/useTableOption.state.tsx +31 -30
  87. package/src/packages/components/AutoTable/use/useTableOption.table.tsx +78 -78
  88. package/src/packages/components/AutoTable/use/useTableOption.tips.tsx +87 -87
  89. package/src/packages/components/AutoTable/use/useTableOptionKeyboard.tsx +102 -102
  90. package/src/packages/components/AutoTable/utils/AutoModule.ts +10 -10
  91. package/src/packages/components/AutoTable/utils/AutoTable.utils.ts +45 -45
  92. package/src/packages/components/AutoTable/utils/TableOption.space.tsx +199 -195
  93. package/src/packages/components/AutoTable/utils/TableOption.url.ts +153 -153
  94. package/src/packages/components/AutoTable/utils/TableOption.utils.tsx +57 -57
  95. package/src/packages/components/AutoTable/utils/buildPlainDefaultUrlConfig.ts +134 -134
  96. package/src/packages/components/AutoWidthInput/auto-width-input.scss +25 -25
  97. package/src/packages/components/AutoWidthInput/index.tsx +67 -67
  98. package/src/packages/components/Badge/badge.scss +67 -67
  99. package/src/packages/components/Badge/index.tsx +52 -52
  100. package/src/packages/components/Button/button.scss +203 -171
  101. package/src/packages/components/Button/index.tsx +206 -148
  102. package/src/packages/components/ButtonGroup/button-group.scss +73 -73
  103. package/src/packages/components/ButtonGroup/index.tsx +43 -43
  104. package/src/packages/components/Card/card.scss +122 -122
  105. package/src/packages/components/Card/index.tsx +74 -74
  106. package/src/packages/components/Carousel/carousel.scss +391 -0
  107. package/src/packages/components/Carousel/index.tsx +591 -44
  108. package/src/packages/components/CarouselItem/index.tsx +77 -0
  109. package/src/packages/components/Cascade/cascade.scss +111 -111
  110. package/src/packages/components/Cascade/cascade.utils.ts +68 -68
  111. package/src/packages/components/Cascade/createCascadeHooks.ts +12 -12
  112. package/src/packages/components/Cascade/createCascadePopper.tsx +119 -119
  113. package/src/packages/components/Cascade/createCascadeUtils.ts +15 -15
  114. package/src/packages/components/Cascade/createMultipleCascadeRender.tsx +157 -157
  115. package/src/packages/components/Cascade/createSingleCascadeRender.tsx +175 -175
  116. package/src/packages/components/Cascade/index.tsx +106 -106
  117. package/src/packages/components/CascadePanel/cascade-panel.utils.ts +90 -90
  118. package/src/packages/components/CascadePanel/flat/CascadeFlatPanelNode.tsx +56 -56
  119. package/src/packages/components/CascadePanel/flat/cascade-flat-panel.scss +132 -145
  120. package/src/packages/components/CascadePanel/flat/createCascadeFlatRender.tsx +82 -82
  121. package/src/packages/components/CascadePanel/index.tsx +190 -190
  122. package/src/packages/components/CascadePanel/list/CascadeListPanelItem.tsx +93 -93
  123. package/src/packages/components/CascadePanel/list/CascadeListPanelNode.tsx +69 -69
  124. package/src/packages/components/CascadePanel/list/createCascadeListRender.tsx +27 -27
  125. package/src/packages/components/Checkbox/checkbox.scss +77 -73
  126. package/src/packages/components/Checkbox/index.tsx +141 -141
  127. package/src/packages/components/CheckboxGroup/index.tsx +205 -205
  128. package/src/packages/components/CheckboxInner/checkbox-inner.scss +55 -54
  129. package/src/packages/components/CheckboxInner/index.tsx +34 -34
  130. package/src/packages/components/ClientZoom/index.ts +5 -5
  131. package/src/packages/components/Collapse/collapse.scss +44 -44
  132. package/src/packages/components/Collapse/index.tsx +94 -94
  133. package/src/packages/components/CollapseGroup/index.tsx +70 -70
  134. package/src/packages/components/CollapseTransition/index.tsx +184 -184
  135. package/src/packages/components/ColorPicker/ColorPanel.tsx +125 -125
  136. package/src/packages/components/ColorPicker/color-panel.scss +97 -97
  137. package/src/packages/components/ColorPicker/color-picker.scss +58 -58
  138. package/src/packages/components/ColorPicker/index.tsx +131 -131
  139. package/src/packages/components/ColorPicker/sub/ColorAlphaSlider.tsx +43 -43
  140. package/src/packages/components/ColorPicker/sub/ColorHueSlider.tsx +17 -17
  141. package/src/packages/components/ColorPicker/sub/ColorSlider.tsx +163 -163
  142. package/src/packages/components/ColorPicker/sub/ColorSvPanel.tsx +125 -125
  143. package/src/packages/components/ColorPicker/sub/color-alpha-slider.scss +8 -8
  144. package/src/packages/components/ColorPicker/sub/color-hue-slider.scss +3 -3
  145. package/src/packages/components/ColorPicker/sub/color-slider.scss +22 -22
  146. package/src/packages/components/ColorPicker/sub/color-sv-panel.scss +55 -55
  147. package/src/packages/components/ColorPicker/useColorPanelEditor.tsx +119 -119
  148. package/src/packages/components/ColorPicker/useColorPanelHistory.tsx +51 -51
  149. package/src/packages/components/ColorPicker/utils/PlainColor.ts +70 -70
  150. package/src/packages/components/ColorPicker/utils/color-picker.utils.tsx +27 -27
  151. package/src/packages/components/DatePicker/createDateRender.multiple.tsx +188 -188
  152. package/src/packages/components/DatePicker/createDateRender.single.tsx +167 -167
  153. package/src/packages/components/DatePicker/createRangeDateRender.range.tsx +106 -106
  154. package/src/packages/components/DatePicker/createRangeDateRender.separate.tsx +112 -112
  155. package/src/packages/components/DatePicker/date.mixin.scss +73 -73
  156. package/src/packages/components/DatePicker/date.scss +542 -542
  157. package/src/packages/components/DatePicker/date.utils.tsx +397 -397
  158. package/src/packages/components/DatePicker/index.tsx +82 -82
  159. package/src/packages/components/DatePicker/panel/DatePanel.tsx +99 -99
  160. package/src/packages/components/DatePicker/panel/DatePanelDate.tsx +278 -278
  161. package/src/packages/components/DatePicker/panel/DatePanelMonth.tsx +190 -190
  162. package/src/packages/components/DatePicker/panel/DatePanelQuarter.tsx +50 -50
  163. package/src/packages/components/DatePicker/panel/DatePanelRange.tsx +146 -146
  164. package/src/packages/components/DatePicker/panel/DatePanelWeek.tsx +52 -52
  165. package/src/packages/components/DatePicker/panel/DatePanelYear.tsx +100 -100
  166. package/src/packages/components/DatePicker/panel/useDatePanel.tsx +618 -618
  167. package/src/packages/components/DatePicker/panel/useDateWeek.tsx +153 -153
  168. package/src/packages/components/DatePicker/useRangeDateRender.tsx +317 -317
  169. package/src/packages/components/Dialog/dialog.scss +261 -258
  170. package/src/packages/components/Dialog/index.tsx +445 -444
  171. package/src/packages/components/Dialog/useDialogMovable.tsx +72 -72
  172. package/src/packages/components/Dialog/utils/dialog.mouse.ts +16 -16
  173. package/src/packages/components/Dialog/utils/dialog.utils.ts +10 -10
  174. package/src/packages/components/Dropdown/dropdown.public.scss +94 -84
  175. package/src/packages/components/Dropdown/dropdown.scss +13 -13
  176. package/src/packages/components/Dropdown/dropdown.utils.tsx +109 -107
  177. package/src/packages/components/Dropdown/index.tsx +161 -161
  178. package/src/packages/components/DropdownGroup/index.tsx +18 -18
  179. package/src/packages/components/DropdownOption/index.tsx +74 -74
  180. package/src/packages/components/DropdownSeparator/index.tsx +8 -0
  181. package/src/packages/components/Empty/empty.scss +14 -14
  182. package/src/packages/components/Empty/index.tsx +48 -48
  183. package/src/packages/components/FilterFormMultiple/filter-form-multiple.scss +36 -27
  184. package/src/packages/components/FilterFormMultiple/index.tsx +282 -262
  185. package/src/packages/components/FilterFormSingle/index.tsx +173 -168
  186. package/src/packages/components/FilterService/filter/filter.city.tsx +84 -84
  187. package/src/packages/components/FilterService/filter/filter.date.tsx +85 -85
  188. package/src/packages/components/FilterService/filter/filter.datetime.tsx +68 -68
  189. package/src/packages/components/FilterService/filter/filter.district.tsx +85 -85
  190. package/src/packages/components/FilterService/filter/filter.number.tsx +66 -66
  191. package/src/packages/components/FilterService/filter/filter.province.tsx +91 -91
  192. package/src/packages/components/FilterService/filter/filter.select.tsx +66 -66
  193. package/src/packages/components/FilterService/filter/filter.text.tsx +57 -57
  194. package/src/packages/components/FilterService/filter/fitler.object.tsx +115 -115
  195. package/src/packages/components/FilterService/index.tsx +250 -250
  196. package/src/packages/components/FilterService/utils/filter.service.utils.ts +138 -138
  197. package/src/packages/components/FilterService/utils/mergeQueryParam.ts +80 -80
  198. package/src/packages/components/Form/form.scss +219 -169
  199. package/src/packages/components/Form/index.tsx +65 -65
  200. package/src/packages/components/Form/layout/useFormLayout.tsx +300 -266
  201. package/src/packages/components/Form/types/any.tsx +54 -54
  202. package/src/packages/components/Form/types/array.tsx +55 -55
  203. package/src/packages/components/Form/types/arrayjson.tsx +15 -15
  204. package/src/packages/components/Form/types/arraystring.tsx +15 -15
  205. package/src/packages/components/Form/types/date.tsx +72 -72
  206. package/src/packages/components/Form/types/datetime.tsx +8 -8
  207. package/src/packages/components/Form/types/email.tsx +11 -11
  208. package/src/packages/components/Form/types/idcard.tsx +13 -13
  209. package/src/packages/components/Form/types/number.tsx +59 -59
  210. package/src/packages/components/Form/types/phone.tsx +11 -11
  211. package/src/packages/components/Form/types/qq.tsx +11 -11
  212. package/src/packages/components/Form/types/string.tsx +68 -68
  213. package/src/packages/components/Form/types/time.tsx +8 -8
  214. package/src/packages/components/Form/validate/createValidation.tsx +274 -274
  215. package/src/packages/components/Form/validate/useFormItemValidation.tsx +121 -121
  216. package/src/packages/components/Form/validate/useFormValidation.tsx +137 -132
  217. package/src/packages/components/Form/validate/validate.utils.tsx +436 -436
  218. package/src/packages/components/FormCascade/index.tsx +6 -6
  219. package/src/packages/components/FormCheckbox/index.tsx +6 -6
  220. package/src/packages/components/FormCheckboxGroup/index.tsx +6 -6
  221. package/src/packages/components/FormColorPicker/index.tsx +6 -6
  222. package/src/packages/components/FormDatePicker/index.tsx +6 -6
  223. package/src/packages/components/FormInput/index.tsx +6 -6
  224. package/src/packages/components/FormInputNumber/index.tsx +6 -6
  225. package/src/packages/components/FormItem/FormItemValidateMessage.tsx +16 -0
  226. package/src/packages/components/FormItem/createFormEditor.tsx +87 -87
  227. package/src/packages/components/FormItem/index.tsx +127 -114
  228. package/src/packages/components/FormRadio/index.tsx +6 -6
  229. package/src/packages/components/FormRadioGroup/index.tsx +6 -6
  230. package/src/packages/components/FormRate/index.tsx +6 -6
  231. package/src/packages/components/FormSelect/index.tsx +6 -6
  232. package/src/packages/components/FormSlider/index.tsx +6 -6
  233. package/src/packages/components/FormTimePicker/index.tsx +6 -6
  234. package/src/packages/components/FormToggle/index.tsx +6 -6
  235. package/src/packages/components/Formatter/index.tsx +64 -64
  236. package/src/packages/components/Grid/GridCol.tsx +72 -72
  237. package/src/packages/components/Grid/GridRow.tsx +55 -55
  238. package/src/packages/components/Grid/grid.scss +109 -109
  239. package/src/packages/components/Grid/grid.utils.ts +21 -21
  240. package/src/packages/components/GridCol/index.tsx +5 -5
  241. package/src/packages/components/GridRow/index.tsx +5 -5
  242. package/src/packages/components/Icon/icon.registry.tsx +21 -21
  243. package/src/packages/components/Icon/icon.scss +12 -12
  244. package/src/packages/components/Icon/index.tsx +54 -54
  245. package/src/packages/components/Illustration/index.tsx +28 -28
  246. package/src/packages/components/Image/image.scss +333 -333
  247. package/src/packages/components/Image/index.tsx +166 -166
  248. package/src/packages/components/ImagePreviewer/ImagePreviewer.tsx +574 -0
  249. package/src/packages/components/ImagePreviewer/ImagePreviewerButtonBar.tsx +140 -0
  250. package/src/packages/components/ImagePreviewer/ImagePreviewerCarouselImage.tsx +54 -0
  251. package/src/packages/components/ImagePreviewer/ImagePreviewerGallery.tsx +202 -0
  252. package/src/packages/components/ImagePreviewer/PreviewerLoading.tsx +26 -0
  253. package/src/packages/components/ImagePreviewer/image-previewer.scss +244 -0
  254. package/src/packages/components/ImagePreviewer/image-previewer.utils.tsx +135 -0
  255. package/src/packages/components/ImagePreviewer/index.tsx +5 -0
  256. package/src/packages/components/ImagePreviewer/previewer-loading.scss +52 -0
  257. package/src/packages/components/ImageUploader/index.tsx +224 -224
  258. package/src/packages/components/Input/index.scss +412 -400
  259. package/src/packages/components/Input/index.tsx +137 -137
  260. package/src/packages/components/Input/input.utils.ts +118 -118
  261. package/src/packages/components/Input/useMultipleInput.tsx +123 -200
  262. package/src/packages/components/Input/useSingleInput.tsx +43 -43
  263. package/src/packages/components/Input/useSuggestionInput.tsx +218 -218
  264. package/src/packages/components/Input/useTextareaInput.tsx +152 -150
  265. package/src/packages/components/Input/uses/useInputEnterHandler.tsx +72 -72
  266. package/src/packages/components/Input/uses/useInputHooks.tsx +21 -21
  267. package/src/packages/components/Input/uses/useInputMaxLength.tsx +35 -35
  268. package/src/packages/components/Input/uses/useInputSuffixIcon.tsx +63 -63
  269. package/src/packages/components/InputGroup/index.tsx +31 -31
  270. package/src/packages/components/InputGroup/input-group.scss +37 -37
  271. package/src/packages/components/InputNumber/NumberResize.tsx +111 -98
  272. package/src/packages/components/InputNumber/index.tsx +36 -36
  273. package/src/packages/components/InputNumber/input-number.utils.tsx +96 -94
  274. package/src/packages/components/InputNumber/number.scss +86 -77
  275. package/src/packages/components/InputNumber/number.utils.ts +3 -3
  276. package/src/packages/components/InputNumber/useInputNumber.multiple.tsx +121 -121
  277. package/src/packages/components/InputNumber/useInputNumber.public.tsx +477 -458
  278. package/src/packages/components/InputNumber/useInputNumber.single.tsx +137 -137
  279. package/src/packages/components/KeepAlive/KeepAliveCacheItemWrapper.tsx +114 -114
  280. package/src/packages/components/KeepAlive/index.tsx +77 -77
  281. package/src/packages/components/KeepAlive/utils/keepalive.utils.ts +33 -33
  282. package/src/packages/components/KeyboardService/index.ts +214 -214
  283. package/src/packages/components/Layout/index.tsx +31 -0
  284. package/src/packages/components/Layout/layout.scss +227 -0
  285. package/src/packages/components/Layout/layout.utils.ts +3 -0
  286. package/src/packages/components/LayoutSection/index.tsx +67 -0
  287. package/src/packages/components/LayoutSection/useLayoutSectionResizer.tsx +184 -0
  288. package/src/packages/components/List/index.tsx +74 -74
  289. package/src/packages/components/List/list.scss +3 -3
  290. package/src/packages/components/Loading/index.tsx +27 -27
  291. package/src/packages/components/Loading/loading.scss +5 -5
  292. package/src/packages/components/LoadingMask/index.tsx +101 -101
  293. package/src/packages/components/LoadingMask/loading-mask.scss +34 -34
  294. package/src/packages/components/NumberRange/index.tsx +93 -93
  295. package/src/packages/components/Object/createObjectHooks.tsx +13 -13
  296. package/src/packages/components/Object/createObjectRender.multiple.tsx +289 -289
  297. package/src/packages/components/Object/createObjectRender.single.tsx +215 -215
  298. package/src/packages/components/Object/index.tsx +104 -104
  299. package/src/packages/components/Object/object.scss +18 -11
  300. package/src/packages/components/Object/object.utils.ts +54 -54
  301. package/src/packages/components/OuterOperation/index.tsx +5 -5
  302. package/src/packages/components/Ov/index.tsx +23 -23
  303. package/src/packages/components/Ov/ov.utils.ts +9 -9
  304. package/src/packages/components/Ov/usePublicOv.tsx +35 -35
  305. package/src/packages/components/PageRenderList/index.tsx +22 -0
  306. package/src/packages/components/PageThemeUtils/deepmerge.ts +21 -0
  307. package/src/packages/components/PageThemeUtils/index.tsx +258 -127
  308. package/src/packages/components/Pagination/index.tsx +339 -339
  309. package/src/packages/components/Pagination/pagination.scss +126 -125
  310. package/src/packages/components/Plc/index.tsx +4 -4
  311. package/src/packages/components/PlcAddress/index.tsx +4 -4
  312. package/src/packages/components/PlcAddressItem/index.tsx +4 -4
  313. package/src/packages/components/PlcCheck/index.tsx +5 -5
  314. package/src/packages/components/PlcCheckbox/index.tsx +4 -4
  315. package/src/packages/components/PlcColorPicker/index.tsx +4 -4
  316. package/src/packages/components/PlcDate/index.tsx +4 -4
  317. package/src/packages/components/PlcDateRange/index.tsx +4 -4
  318. package/src/packages/components/PlcDraggier/index.tsx +5 -5
  319. package/src/packages/components/PlcExpand/index.tsx +5 -5
  320. package/src/packages/components/PlcGroup/index.tsx +4 -4
  321. package/src/packages/components/PlcImage/index.tsx +80 -80
  322. package/src/packages/components/PlcIndex/index.tsx +5 -5
  323. package/src/packages/components/PlcInput/index.tsx +4 -4
  324. package/src/packages/components/PlcNumber/index.tsx +4 -4
  325. package/src/packages/components/PlcObject/index.tsx +53 -53
  326. package/src/packages/components/PlcOperation/index.tsx +5 -5
  327. package/src/packages/components/PlcOv/index.tsx +31 -21
  328. package/src/packages/components/PlcRate/index.tsx +4 -4
  329. package/src/packages/components/PlcSelect/index.tsx +4 -4
  330. package/src/packages/components/PlcTextarea/index.tsx +4 -4
  331. package/src/packages/components/PlcTime/index.tsx +4 -4
  332. package/src/packages/components/PlcTimeRange/index.tsx +4 -4
  333. package/src/packages/components/PlcToggle/index.tsx +4 -4
  334. package/src/packages/components/PlcTree/index.tsx +5 -5
  335. package/src/packages/components/Popup/PopupProvider.tsx +21 -21
  336. package/src/packages/components/Popup/index.tsx +395 -381
  337. package/src/packages/components/Popup/popup.scss +13 -13
  338. package/src/packages/components/ProgressBar/index.tsx +87 -87
  339. package/src/packages/components/ProgressBar/progress-bar.scss +40 -40
  340. package/src/packages/components/ProgressBar/progress.utils.ts +24 -24
  341. package/src/packages/components/ProgressCircle/index.tsx +188 -188
  342. package/src/packages/components/ProgressCircle/progress-circle.scss +44 -44
  343. package/src/packages/components/ProgressMini/index.tsx +98 -98
  344. package/src/packages/components/ProgressMini/progress-mini.scss +17 -17
  345. package/src/packages/components/Radio/index.tsx +137 -137
  346. package/src/packages/components/Radio/radio.scss +79 -79
  347. package/src/packages/components/RadioGroup/index.tsx +62 -62
  348. package/src/packages/components/RadioInner/index.tsx +31 -31
  349. package/src/packages/components/RadioInner/radio-inner.scss +17 -17
  350. package/src/packages/components/Rate/index.tsx +152 -152
  351. package/src/packages/components/Rate/rate.scss +32 -32
  352. package/src/packages/components/Reference/ReferenceProvider.tsx +13 -13
  353. package/src/packages/components/Reference/index.tsx +57 -57
  354. package/src/packages/components/Scroll/HorizontalScrollbar.tsx +96 -96
  355. package/src/packages/components/Scroll/VerticalScrollbar.tsx +102 -102
  356. package/src/packages/components/Scroll/index.tsx +380 -380
  357. package/src/packages/components/Scroll/scroll.scss +166 -166
  358. package/src/packages/components/Scroll/useAutoScroll.ts +68 -68
  359. package/src/packages/components/Segment/index.tsx +39 -39
  360. package/src/packages/components/Segment/segment.scss +46 -46
  361. package/src/packages/components/SegmentGroup/index.tsx +48 -48
  362. package/src/packages/components/Select/SelectPanel.tsx +78 -75
  363. package/src/packages/components/Select/createMultipleSelectRender.tsx +244 -244
  364. package/src/packages/components/Select/createPublicSelectRender.tsx +405 -405
  365. package/src/packages/components/Select/createSelectOptionDecoder.tsx +43 -43
  366. package/src/packages/components/Select/createSingleSelectRender.tsx +129 -129
  367. package/src/packages/components/Select/decodeSelectRenderNode.tsx +50 -50
  368. package/src/packages/components/Select/index.tsx +85 -85
  369. package/src/packages/components/Select/select.scss +101 -101
  370. package/src/packages/components/Select/select.utils.tsx +247 -247
  371. package/src/packages/components/SelectDisplay/index.tsx +30 -30
  372. package/src/packages/components/SelectGroup/index.tsx +37 -0
  373. package/src/packages/components/SelectOption/index.tsx +72 -72
  374. package/src/packages/components/Slider/index.tsx +123 -123
  375. package/src/packages/components/Slider/slider.scss +128 -128
  376. package/src/packages/components/Slider/slider.utils.tsx +71 -71
  377. package/src/packages/components/Slider/useSlider.range.tsx +208 -208
  378. package/src/packages/components/Slider/useSlider.single.tsx +149 -149
  379. package/src/packages/components/Slider/useSliderDotDragier.tsx +66 -66
  380. package/src/packages/components/SortList/index.tsx +191 -0
  381. package/src/packages/components/SortList/sort-list.scss +11 -0
  382. package/src/packages/components/Space/index.tsx +30 -0
  383. package/src/packages/components/Space/space.scss +26 -0
  384. package/src/packages/components/StackCard/index.tsx +416 -0
  385. package/src/packages/components/StackCard/stack-card.scss +40 -0
  386. package/src/packages/components/StackCardItem/index.tsx +24 -0
  387. package/src/packages/components/Step/index.tsx +120 -120
  388. package/src/packages/components/StepGroup/index.tsx +63 -63
  389. package/src/packages/components/StepGroup/step-group.scss +411 -411
  390. package/src/packages/components/StepGroup/step.utils.ts +44 -44
  391. package/src/packages/components/Tab/index.tsx +42 -42
  392. package/src/packages/components/TabGroup/TabsHeader.tsx +105 -105
  393. package/src/packages/components/TabGroup/TabsInner.tsx +60 -58
  394. package/src/packages/components/TabGroup/header/horizontal/TabsHeaderHorizontal.tsx +94 -94
  395. package/src/packages/components/TabGroup/header/horizontal/TabsHeaderHorizontalCard.tsx +15 -15
  396. package/src/packages/components/TabGroup/header/horizontal/TabsHeaderHorizontalShadow.tsx +15 -15
  397. package/src/packages/components/TabGroup/header/horizontal/TabsHeaderHorizontalText.tsx +66 -66
  398. package/src/packages/components/TabGroup/header/horizontal/tabs-header-card.scss +85 -85
  399. package/src/packages/components/TabGroup/header/horizontal/tabs-header-horizontal.scss +59 -60
  400. package/src/packages/components/TabGroup/header/horizontal/tabs-header-shadow.scss +88 -88
  401. package/src/packages/components/TabGroup/header/horizontal/tabs-header-text.scss +50 -50
  402. package/src/packages/components/TabGroup/header/vertical/TabsHeaderVertical.tsx +24 -24
  403. package/src/packages/components/TabGroup/header/vertical/tabs-header-vertical.scss +116 -116
  404. package/src/packages/components/TabGroup/index.tsx +131 -127
  405. package/src/packages/components/TabGroup/tabs.scss +39 -36
  406. package/src/packages/components/TabGroup/tabs.utils.tsx +22 -22
  407. package/src/packages/components/Table/editor/PlcAddress.tsx +91 -91
  408. package/src/packages/components/Table/editor/PlcAddressItem.tsx +60 -60
  409. package/src/packages/components/Table/editor/PlcCheckbox.tsx +36 -36
  410. package/src/packages/components/Table/editor/PlcColorPicker.tsx +29 -29
  411. package/src/packages/components/Table/editor/PlcDate.tsx +97 -97
  412. package/src/packages/components/Table/editor/PlcDate.utils.tsx +45 -45
  413. package/src/packages/components/Table/editor/PlcDateRange.tsx +73 -73
  414. package/src/packages/components/Table/editor/PlcInput.tsx +21 -21
  415. package/src/packages/components/Table/editor/PlcNumber.tsx +23 -23
  416. package/src/packages/components/Table/editor/PlcRate.tsx +24 -24
  417. package/src/packages/components/Table/editor/PlcSelect.tsx +180 -180
  418. package/src/packages/components/Table/editor/PlcTextarea.tsx +22 -22
  419. package/src/packages/components/Table/editor/PlcTime.tsx +54 -54
  420. package/src/packages/components/Table/editor/PlcTime.utils.ts +15 -15
  421. package/src/packages/components/Table/editor/PlcTimeRange.tsx +66 -66
  422. package/src/packages/components/Table/editor/PlcToggle.tsx +40 -40
  423. package/src/packages/components/Table/index.tsx +4 -4
  424. package/src/packages/components/Table/plc/formatPlcList.tsx +92 -92
  425. package/src/packages/components/Table/plc/group/PlcGroup.tsx +20 -20
  426. package/src/packages/components/Table/plc/plc/Plc.tsx +19 -19
  427. package/src/packages/components/Table/plc/process/copyPlcList.ts +23 -23
  428. package/src/packages/components/Table/plc/process/getPltCellClass.ts +8 -8
  429. package/src/packages/components/Table/plc/process/processAutoFixed.ts +73 -73
  430. package/src/packages/components/Table/plc/process/processHeadPlcList.ts +110 -110
  431. package/src/packages/components/Table/plc/process/processPlcClassAndStyle.ts +43 -43
  432. package/src/packages/components/Table/plc/process/processPlcFixed.ts +81 -81
  433. package/src/packages/components/Table/plc/process/processPlcSort.ts +91 -91
  434. package/src/packages/components/Table/plc/use/useBasePlc.tsx +85 -85
  435. package/src/packages/components/Table/plc/use/useBasePlcGroup.tsx +70 -70
  436. package/src/packages/components/Table/plc/use/usePlc.tsx +136 -136
  437. package/src/packages/components/Table/plc/use/usePlcPropsState.tsx +112 -112
  438. package/src/packages/components/Table/plc/useTablePlc.tsx +226 -226
  439. package/src/packages/components/Table/plc/utils/iteratePlcList.tsx +48 -48
  440. package/src/packages/components/Table/plc/utils/plc.render.ts +122 -122
  441. package/src/packages/components/Table/plc/utils/plc.scope-slots.ts +63 -63
  442. package/src/packages/components/Table/plc/utils/plc.utils.ts +299 -299
  443. package/src/packages/components/Table/standard/PlcCheck/PlcCheck.hooks.tsx +16 -16
  444. package/src/packages/components/Table/standard/PlcCheck/PlcCheck.multiple.tsx +281 -281
  445. package/src/packages/components/Table/standard/PlcCheck/PlcCheck.single.tsx +90 -90
  446. package/src/packages/components/Table/standard/PlcCheck/PlcCheck.tsx +61 -61
  447. package/src/packages/components/Table/standard/PlcCheck/PlcCheck.utils.ts +35 -35
  448. package/src/packages/components/Table/standard/PlcDraggier/PlcDraggier.tsx +55 -55
  449. package/src/packages/components/Table/standard/PlcExclusion.tsx +26 -26
  450. package/src/packages/components/Table/standard/PlcExpand.tsx +198 -206
  451. package/src/packages/components/Table/standard/PlcIndex.tsx +34 -34
  452. package/src/packages/components/Table/standard/PlcOperation/OuterOperation.tsx +209 -208
  453. package/src/packages/components/Table/standard/PlcOperation/PlcOperation.tsx +385 -385
  454. package/src/packages/components/Table/standard/PlcOperation/PlcOperation.utils.tsx +159 -157
  455. package/src/packages/components/Table/standard/PlcOperation/outer-operation.scss +39 -37
  456. package/src/packages/components/Table/standard/PlcOperation/useOperationPermission.ts +53 -53
  457. package/src/packages/components/Table/standard/PlcTree/PlcTree.autoWidth.tsx +52 -52
  458. package/src/packages/components/Table/standard/PlcTree/PlcTree.renderNode.tsx +78 -78
  459. package/src/packages/components/Table/standard/PlcTree/PlcTree.tsx +194 -194
  460. package/src/packages/components/Table/standard/PlcTree/PlcTree.utils.ts +59 -59
  461. package/src/packages/components/Table/standard/PlcTree/PlcTreeHeader.tsx +64 -64
  462. package/src/packages/components/Table/standard/PlcTree/RenderPlcTreeNode.tsx +113 -112
  463. package/src/packages/components/Table/table/Table.tsx +378 -370
  464. package/src/packages/components/Table/table/body/cell.tsx +279 -274
  465. package/src/packages/components/Table/table/body/row.tsx +47 -47
  466. package/src/packages/components/Table/table/body/useCellValue.tsx +136 -132
  467. package/src/packages/components/Table/table/head/head-cell.tsx +94 -94
  468. package/src/packages/components/Table/table/head/useHeadCellResize.ts +79 -79
  469. package/src/packages/components/Table/table/node/useTableNode.tsx +66 -66
  470. package/src/packages/components/Table/table/table.scss +434 -430
  471. package/src/packages/components/Table/table/use/useFixedShadow.ts +48 -48
  472. package/src/packages/components/Table/table/use/useTableDraggier.col.tsx +639 -639
  473. package/src/packages/components/Table/table/use/useTableDraggier.row.tsx +267 -267
  474. package/src/packages/components/Table/table/use/useTableDraggier.tsx +237 -237
  475. package/src/packages/components/Table/table/use/useTableFormEditor.tsx +182 -180
  476. package/src/packages/components/Table/table/use/useTableLoading.tsx +39 -39
  477. package/src/packages/components/Table/table/use/useTableMethods.tsx +65 -65
  478. package/src/packages/components/Table/table/use/useTableModifyEditor.tsx +198 -198
  479. package/src/packages/components/Table/table/use/useTableScroll.tsx +49 -49
  480. package/src/packages/components/Table/table/utils/createTableHooks.ts +68 -66
  481. package/src/packages/components/Table/table/utils/table.utils.ts +283 -278
  482. package/src/packages/components/Table/table/utils/url.utils.ts +23 -23
  483. package/src/packages/components/TableOptionSpace/index.ts +5 -5
  484. package/src/packages/components/TableOptionUtils/index.ts +5 -5
  485. package/src/packages/components/Tag/index.tsx +77 -77
  486. package/src/packages/components/Tag/tag.scss +27 -27
  487. package/src/packages/components/Tag/tag.utils.ts +20 -20
  488. package/src/packages/components/ThemeEditor/index.tsx +201 -0
  489. package/src/packages/components/ThemeEditor/theme-editor.scss +105 -0
  490. package/src/packages/components/ThemePrimaryColors/index.ts +5 -5
  491. package/src/packages/components/TimePicker/createRangeTimeRender.tsx +72 -72
  492. package/src/packages/components/TimePicker/createSeparateRangeTimeRender.tsx +96 -96
  493. package/src/packages/components/TimePicker/createSingleTimeRender.tsx +202 -202
  494. package/src/packages/components/TimePicker/index.tsx +65 -65
  495. package/src/packages/components/TimePicker/panel/TimeBaseColumn.tsx +136 -136
  496. package/src/packages/components/TimePicker/panel/TimeBasePanel.tsx +172 -172
  497. package/src/packages/components/TimePicker/panel/TimePanel.tsx +94 -94
  498. package/src/packages/components/TimePicker/panel/TimeRangePanel.tsx +141 -141
  499. package/src/packages/components/TimePicker/panel/time-base-column.scss +51 -51
  500. package/src/packages/components/TimePicker/panel/time-base-panel.scss +39 -39
  501. package/src/packages/components/TimePicker/panel/time-panel.utils.ts +16 -16
  502. package/src/packages/components/TimePicker/panel/time-range-panel.scss +9 -9
  503. package/src/packages/components/TimePicker/time.scss +10 -10
  504. package/src/packages/components/TimePicker/time.utils.ts +99 -99
  505. package/src/packages/components/TimePicker/useRangeTimeRender.tsx +235 -235
  506. package/src/packages/components/TimePicker/useTimeHooks.ts +11 -11
  507. package/src/packages/components/Toggle/index.tsx +112 -112
  508. package/src/packages/components/Toggle/toggle.scss +147 -147
  509. package/src/packages/components/Tooltip/index.tsx +118 -118
  510. package/src/packages/components/Tooltip/tooltip.scss +5 -5
  511. package/src/packages/components/Transition/index.tsx +133 -133
  512. package/src/packages/components/Tree/RenderTreeNode.tsx +177 -172
  513. package/src/packages/components/Tree/index.tsx +130 -129
  514. package/src/packages/components/Tree/tree.scss +259 -226
  515. package/src/packages/components/TreeCore/TreeCore.type.tsx +138 -136
  516. package/src/packages/components/TreeCore/createTreeCore.tsx +364 -360
  517. package/src/packages/components/TreeCore/createTreeDraggier.tsx +412 -402
  518. package/src/packages/components/TreeCore/createTreeHooks.ts +16 -16
  519. package/src/packages/components/TreeCore/createTreeMethods.tsx +421 -420
  520. package/src/packages/components/TreeCore/createTreeNode.tsx +239 -239
  521. package/src/packages/components/TreeCore/createTreeProps.ts +75 -74
  522. package/src/packages/components/TreeCore/createTreeUtils.ts +140 -140
  523. package/src/packages/components/TreeCore/fromatNodeData.ts +65 -65
  524. package/src/packages/components/TreeNodeWithMenu/index.tsx +91 -0
  525. package/src/packages/components/TreeNodeWithMenu/tree-node-with-menu.scss +39 -0
  526. package/src/packages/components/TreeNodeWithMenu/treeNodeWithMenu.utils.ts +12 -0
  527. package/src/packages/components/Triangle/index.tsx +88 -88
  528. package/src/packages/components/Triangle/triangle.scss +12 -12
  529. package/src/packages/components/Upload/index.tsx +422 -422
  530. package/src/packages/components/Upload/upload.scss +185 -185
  531. package/src/packages/components/VirtualList/index.tsx +72 -63
  532. package/src/packages/components/VirtualList/useVirtualList.tsx +396 -316
  533. package/src/packages/components/VirtualList/virtual-list.scss +49 -35
  534. package/src/packages/components/VirtualTable/index.tsx +201 -201
  535. package/src/packages/components/VirtualTable/virtual-table.scss +179 -180
  536. package/src/packages/components/_Object/index.tsx +5 -5
  537. package/src/packages/components/buildPlainDefaultUrlConfig/index.tsx +5 -5
  538. package/src/packages/components/createAddressService/index.ts +5 -5
  539. package/src/packages/components/createHttp/http.utils.ts +56 -56
  540. package/src/packages/components/createHttp/index.tsx +29 -26
  541. package/src/packages/components/createObjectService/index.tsx +5 -5
  542. package/src/packages/components/createOvService/index.tsx +5 -5
  543. package/src/packages/components/createPlainAddressService/index.tsx +101 -101
  544. package/src/packages/components/createPopup/index.ts +5 -5
  545. package/src/packages/components/createProvider/index.ts +5 -5
  546. package/src/packages/components/createScrollUtils/index.tsx +163 -163
  547. package/src/packages/components/createTableOptionUser/index.tsx +5 -5
  548. package/src/packages/components/createUploadService/index.tsx +5 -5
  549. package/src/packages/components/i18n/index.tsx +5 -5
  550. package/src/packages/components/nextPopupId/index.ts +5 -5
  551. package/src/packages/components/useAutoScrollUtils/auto-scroll-utils.scss +48 -48
  552. package/src/packages/components/useAutoScrollUtils/index.tsx +86 -86
  553. package/src/packages/components/useDialog/DialogService.tsx +227 -215
  554. package/src/packages/components/useDialog/dialog-service.scss +50 -50
  555. package/src/packages/components/useDialog/dialog.service.utils.tsx +88 -88
  556. package/src/packages/components/useDialog/index.tsx +66 -66
  557. package/src/packages/components/useImage/ImageService.tsx +262 -262
  558. package/src/packages/components/useImage/index.tsx +28 -28
  559. package/src/packages/components/useMessage/Message.tsx +75 -71
  560. package/src/packages/components/useMessage/MessageContainer.tsx +64 -64
  561. package/src/packages/components/useMessage/MessageManager.tsx +58 -58
  562. package/src/packages/components/useMessage/index.tsx +51 -51
  563. package/src/packages/components/useMessage/message.scss +149 -145
  564. package/src/packages/components/useMessage/message.service.utils.tsx +43 -43
  565. package/src/packages/components/useNotice/Notice.tsx +91 -91
  566. package/src/packages/components/useNotice/NoticeContainer.tsx +65 -65
  567. package/src/packages/components/useNotice/NoticeManager.tsx +58 -58
  568. package/src/packages/components/useNotice/index.tsx +42 -42
  569. package/src/packages/components/useNotice/noitice.service.utils.tsx +48 -48
  570. package/src/packages/components/useNotice/notice.scss +158 -158
  571. package/src/packages/components/usePageRender/index.tsx +3 -0
  572. package/src/packages/components/usePageRenderContext/index.tsx +8 -0
  573. package/src/packages/components/usePopup/PopupItem.tsx +426 -394
  574. package/src/packages/components/usePopup/index.tsx +1 -1
  575. package/src/packages/components/usePopup/popup-item.scss +229 -221
  576. package/src/packages/components/usePopup/refresh/applyPosition.ts +61 -61
  577. package/src/packages/components/usePopup/refresh/calcPosition.ts +85 -85
  578. package/src/packages/components/usePopup/refresh/refreshArrow.ts +112 -112
  579. package/src/packages/components/usePopup/refresh/refreshPopup.ts +77 -77
  580. package/src/packages/components/usePopup/trigger/useManagerTrigger.click.tsx +56 -56
  581. package/src/packages/components/usePopup/trigger/useManagerTrigger.clickOutside.tsx +44 -44
  582. package/src/packages/components/usePopup/trigger/useManagerTrigger.contextmenu.tsx +59 -59
  583. package/src/packages/components/usePopup/trigger/useManagerTrigger.focus.tsx +30 -30
  584. package/src/packages/components/usePopup/trigger/useManagerTrigger.hover.tsx +60 -60
  585. package/src/packages/components/usePopup/trigger/usePopupTrigger.tsx +56 -56
  586. package/src/packages/components/usePopup/trigger/useReferenceTrigger.tsx +84 -84
  587. package/src/packages/components/usePopup/usePopup.tsx +73 -57
  588. package/src/packages/components/usePopup/usePopupManager.tsx +314 -313
  589. package/src/packages/components/usePopup/utils/closeAllPopper.ts +5 -5
  590. package/src/packages/components/usePopup/utils/createPopperAttrsGetter.ts +5 -5
  591. package/src/packages/components/usePopup/utils/createPopupManagerHooks.tsx +65 -65
  592. package/src/packages/components/usePopup/utils/decodePlacement.ts +16 -16
  593. package/src/packages/components/usePopup/utils/getAvailableDirection.ts +91 -91
  594. package/src/packages/components/usePopup/utils/getBoundary.ts +25 -25
  595. package/src/packages/components/usePopup/utils/getRects.ts +24 -24
  596. package/src/packages/components/usePopup/utils/handleDirection.ts +10 -10
  597. package/src/packages/components/usePopup/utils/ids2map.ts +11 -11
  598. package/src/packages/components/usePopup/utils/popup.utils.ts +236 -235
  599. package/src/packages/components/usePopup/utils/stopPopup.ts +7 -7
  600. package/src/packages/components/usePopupEditor/index.tsx +116 -116
  601. package/src/packages/components/usePopupEditor/popup-editor.utils.ts +15 -15
  602. package/src/packages/components/usePopupManager/index.ts +5 -5
  603. package/src/packages/components/usePopupTrigger/index.tsx +5 -5
  604. package/src/packages/components/useReferenceTrigger/index.tsx +5 -5
  605. package/src/packages/components/useTooltip/index.tsx +188 -176
  606. package/src/packages/components/useWatchAutoClear/index.ts +5 -5
  607. package/src/packages/directives/ClickWave/click-wave.scss +57 -57
  608. package/src/packages/directives/ClickWave/index.tsx +78 -78
  609. package/src/packages/directives/ResizeDetector/index.tsx +100 -100
  610. package/src/packages/entry.tsx +219 -192
  611. package/src/packages/i18n/i18n.utils.ts +265 -148
  612. package/src/packages/i18n/index.ts +5 -4
  613. package/src/packages/i18n/lang/en-us.ts +291 -247
  614. package/src/packages/i18n/lang/zh-cn.ts +298 -254
  615. package/src/packages/index.tsx +5 -5
  616. package/src/packages/styles/application/application.public.scss +8 -8
  617. package/src/packages/styles/application/application.public.transition.scss +90 -90
  618. package/src/packages/styles/global.import.scss +133 -133
  619. package/src/packages/uses/createInputPopperAttrs.ts +60 -60
  620. package/src/packages/uses/useCollapseStyles.tsx +55 -0
  621. package/src/packages/uses/useDragHorizontalScroll.ts +82 -0
  622. package/src/packages/uses/useEdit.ts +89 -85
  623. package/src/packages/uses/useFocusHandler.ts +60 -60
  624. package/src/packages/uses/useFunctionWrapper.ts +29 -29
  625. package/src/packages/uses/useMultipleModel.tsx +63 -63
  626. package/src/packages/uses/useRenderReference.tsx +32 -32
  627. package/src/packages/uses/useStyle.tsx +78 -68
  628. package/src/packages/utils/ClientZoom.ts +50 -50
  629. package/src/packages/utils/ComponentUtils.ts +10 -0
  630. package/src/packages/utils/FixInput.ts +3 -3
  631. package/src/packages/utils/InnerTransition.ts +13 -13
  632. package/src/packages/utils/LoadingText.ts +11 -11
  633. package/src/packages/utils/OpenController.ts +15 -15
  634. package/src/packages/utils/buildCycleIndexList.ts +31 -0
  635. package/src/packages/utils/clearFields.ts +16 -16
  636. package/src/packages/utils/color.utils.ts +189 -189
  637. package/src/packages/utils/combineURL.ts +5 -5
  638. package/src/packages/utils/constant.tsx +5 -5
  639. package/src/packages/utils/createAnimate.ts +45 -45
  640. package/src/packages/utils/createCache.ts +32 -32
  641. package/src/packages/utils/createEffectiveHandler.ts +8 -8
  642. package/src/packages/utils/createError.ts +16 -16
  643. package/src/packages/utils/createFlagManager.ts +34 -34
  644. package/src/packages/utils/createKeyHandler.ts +20 -20
  645. package/src/packages/utils/createProvider.tsx +35 -35
  646. package/src/packages/utils/customDeepClone.ts +15 -15
  647. package/src/packages/utils/deepCloneRenderNode.ts +41 -41
  648. package/src/packages/utils/deepIterateObject.ts +14 -14
  649. package/src/packages/utils/doNothing.ts +3 -3
  650. package/src/packages/utils/findParentElement.ts +12 -12
  651. package/src/packages/utils/findReactElement.tsx +76 -76
  652. package/src/packages/utils/formatServiceOptions.ts +7 -7
  653. package/src/packages/utils/getDeviceInfo.ts +59 -59
  654. package/src/packages/utils/getElement.ts +17 -17
  655. package/src/packages/utils/getElementParents.ts +9 -9
  656. package/src/packages/utils/getElementRect.ts +32 -32
  657. package/src/packages/utils/getRectAutoFormat.ts +9 -0
  658. package/src/packages/utils/getRowEl.ts +33 -33
  659. package/src/packages/utils/getScrollParent.ts +11 -11
  660. package/src/packages/utils/incrementalMerge.ts +8 -8
  661. package/src/packages/utils/inheritSlots.ts +28 -0
  662. package/src/packages/utils/installAllIcons.ts +19 -19
  663. package/src/packages/utils/installAllLazyIcons.ts +17 -17
  664. package/src/packages/utils/isObjectCommonMatch.ts +21 -21
  665. package/src/packages/utils/isSSR.tsx +3 -3
  666. package/src/packages/utils/iterate.ts +53 -53
  667. package/src/packages/utils/notNull.ts +9 -0
  668. package/src/packages/utils/omit.ts +6 -6
  669. package/src/packages/utils/onParentElementsScroll.tsx +26 -26
  670. package/src/packages/utils/pick.ts +11 -11
  671. package/src/packages/utils/plainDate.ts +203 -199
  672. package/src/packages/utils/renderNothing.tsx +1 -1
  673. package/src/packages/utils/runOnce.tsx +14 -14
  674. package/src/packages/utils/type.ts +11 -11
  675. package/src/packages/utils/useMove.tsx +78 -78
  676. package/src/packages/utils/watchEffectAutoClear.ts +28 -16
  677. package/src/packages/components/CarouselGroup/carousel.scss +0 -143
  678. package/src/packages/components/CarouselGroup/index.tsx +0 -274
  679. package/src/pages/data/address.json +0 -39317
  680. package/src/pages/data/data-1.json +0 -754
  681. package/src/pages/data/data-2.json +0 -3006
  682. package/src/pages/data/data-200.json +0 -5206
  683. package/src/pages/data/data-2000.json +0 -51954
  684. package/src/pages/data/data-50.json +0 -2075
  685. package/src/pages/data/data.json +0 -30002
  686. package/src/pages/data/demo.json +0 -1702
  687. package/src/pages/data/mock.database.js +0 -43
  688. package/src/pages/data/mock.js +0 -141
  689. package/src/pages/data/tree.data.json +0 -87
  690. package/src/pages/env/config/local.js +0 -3
  691. package/src/pages/env/config/prod.js +0 -3
  692. package/src/pages/env/config/undefined.js +0 -1
  693. package/src/pages/env/env.d.ts +0 -4
  694. package/src/pages/env/index.ts +0 -1
  695. package/src/pages/history/createHistory.ts +0 -94
  696. package/src/pages/history/history.utils.ts +0 -64
  697. package/src/pages/index/App.tsx +0 -17
  698. package/src/pages/index/Demo/DemoLine.tsx +0 -23
  699. package/src/pages/index/Demo/DemoRow.scss +0 -128
  700. package/src/pages/index/Demo/DemoRow.tsx +0 -71
  701. package/src/pages/index/Demo/DemoRow.utils.ts +0 -23
  702. package/src/pages/index/Demo/DemoRowController.tsx +0 -45
  703. package/src/pages/index/Demo/index.ts +0 -8
  704. package/src/pages/index/app.scss +0 -192
  705. package/src/pages/index/components/AutoTable/AutoHeightAutoRow.tsx +0 -51
  706. package/src/pages/index/components/AutoTable/AutoHeightFixedRow.tsx +0 -50
  707. package/src/pages/index/components/AutoTable/AutoTableBasicUsage.tsx +0 -75
  708. package/src/pages/index/components/AutoTable/AutoTableCascade.tsx +0 -99
  709. package/src/pages/index/components/AutoTable/AutoTableDefaultSearch.tsx +0 -73
  710. package/src/pages/index/components/AutoTable/AutoTableFiles.tsx +0 -26
  711. package/src/pages/index/components/AutoTable/AutoTableFill.tsx +0 -51
  712. package/src/pages/index/components/AutoTable/AutoTableGroupUsage.tsx +0 -71
  713. package/src/pages/index/components/AutoTable/AutoTableObjectPicker.tsx +0 -181
  714. package/src/pages/index/components/AutoTable/AutoTableOvList.tsx +0 -80
  715. package/src/pages/index/components/AutoTable/AutoTableProductList.tsx +0 -98
  716. package/src/pages/index/components/AutoTable/AutoTableRowFormatter.tsx +0 -58
  717. package/src/pages/index/components/AutoTable/FixedHeightAutoRow.tsx +0 -50
  718. package/src/pages/index/components/AutoTable/FixedHeightFixedRow.tsx +0 -49
  719. package/src/pages/index/components/bus/DemoAddress.tsx +0 -181
  720. package/src/pages/index/components/bus/DemoAddressCascade.tsx +0 -132
  721. package/src/pages/index/components/bus/DemoFilter.tsx +0 -184
  722. package/src/pages/index/components/columns/DemoPlcAddress.tsx +0 -161
  723. package/src/pages/index/components/columns/DemoPlcDate.tsx +0 -363
  724. package/src/pages/index/components/columns/DemoPlcSelect.tsx +0 -505
  725. package/src/pages/index/components/columns/DemoPlcTime.tsx +0 -293
  726. package/src/pages/index/components/columns/DemoTableColumns.tsx +0 -88
  727. package/src/pages/index/components/form/DemoFormBasic.tsx +0 -516
  728. package/src/pages/index/components/form/DemoFormBlur.tsx +0 -204
  729. package/src/pages/index/components/form/DemoFormDynamicFields.tsx +0 -54
  730. package/src/pages/index/components/form/DemoFormEditControl.tsx +0 -164
  731. package/src/pages/index/components/form/DemoFormElement.tsx +0 -207
  732. package/src/pages/index/components/form/DemoFormLayout.scss +0 -7
  733. package/src/pages/index/components/form/DemoFormLayout.tsx +0 -311
  734. package/src/pages/index/components/form/DemoFormSimplify.tsx +0 -587
  735. package/src/pages/index/components/form/DemoFormSize.tsx +0 -274
  736. package/src/pages/index/components/form/DemoFormVertical.tsx +0 -280
  737. package/src/pages/index/components/normal/DemoAlert.tsx +0 -66
  738. package/src/pages/index/components/normal/DemoBadge.tsx +0 -53
  739. package/src/pages/index/components/normal/DemoButton.tsx +0 -300
  740. package/src/pages/index/components/normal/DemoCard.tsx +0 -176
  741. package/src/pages/index/components/normal/DemoCarousel.tsx +0 -125
  742. package/src/pages/index/components/normal/DemoCascade.tsx +0 -880
  743. package/src/pages/index/components/normal/DemoCheckbox.scss +0 -24
  744. package/src/pages/index/components/normal/DemoCheckbox.tsx +0 -294
  745. package/src/pages/index/components/normal/DemoCollapse.tsx +0 -104
  746. package/src/pages/index/components/normal/DemoColor.scss +0 -20
  747. package/src/pages/index/components/normal/DemoColor.tsx +0 -82
  748. package/src/pages/index/components/normal/DemoColorPicker.tsx +0 -163
  749. package/src/pages/index/components/normal/DemoDate.tsx +0 -443
  750. package/src/pages/index/components/normal/DemoDialog.tsx +0 -507
  751. package/src/pages/index/components/normal/DemoDropdown.tsx +0 -463
  752. package/src/pages/index/components/normal/DemoGrid.scss +0 -26
  753. package/src/pages/index/components/normal/DemoGrid.tsx +0 -181
  754. package/src/pages/index/components/normal/DemoIcon.tsx +0 -39
  755. package/src/pages/index/components/normal/DemoImage.tsx +0 -122
  756. package/src/pages/index/components/normal/DemoInput.scss +0 -0
  757. package/src/pages/index/components/normal/DemoInput.tsx +0 -790
  758. package/src/pages/index/components/normal/DemoKeepAlive.tsx +0 -505
  759. package/src/pages/index/components/normal/DemoList.scss +0 -15
  760. package/src/pages/index/components/normal/DemoList.tsx +0 -82
  761. package/src/pages/index/components/normal/DemoLoading.tsx +0 -83
  762. package/src/pages/index/components/normal/DemoNumber.tsx +0 -266
  763. package/src/pages/index/components/normal/DemoPagination.tsx +0 -164
  764. package/src/pages/index/components/normal/DemoPopup.tsx +0 -695
  765. package/src/pages/index/components/normal/DemoProgress.tsx +0 -133
  766. package/src/pages/index/components/normal/DemoRadio.scss +0 -16
  767. package/src/pages/index/components/normal/DemoRadio.tsx +0 -188
  768. package/src/pages/index/components/normal/DemoRate.tsx +0 -77
  769. package/src/pages/index/components/normal/DemoScroll.scss +0 -22
  770. package/src/pages/index/components/normal/DemoScroll.tsx +0 -300
  771. package/src/pages/index/components/normal/DemoSegment.tsx +0 -71
  772. package/src/pages/index/components/normal/DemoSelect.tsx +0 -819
  773. package/src/pages/index/components/normal/DemoSlider.tsx +0 -128
  774. package/src/pages/index/components/normal/DemoStep.scss +0 -18
  775. package/src/pages/index/components/normal/DemoStep.tsx +0 -291
  776. package/src/pages/index/components/normal/DemoTab.tsx +0 -338
  777. package/src/pages/index/components/normal/DemoTag.tsx +0 -100
  778. package/src/pages/index/components/normal/DemoTime.tsx +0 -403
  779. package/src/pages/index/components/normal/DemoToggle.tsx +0 -56
  780. package/src/pages/index/components/normal/DemoTooltip.tsx +0 -120
  781. package/src/pages/index/components/normal/DemoTree.tsx +0 -1099
  782. package/src/pages/index/components/normal/DemoUpload.tsx +0 -484
  783. package/src/pages/index/components/normal/DemoVirtualList.tsx +0 -378
  784. package/src/pages/index/components/service/DemoDialogService.tsx +0 -248
  785. package/src/pages/index/components/service/DemoFileService.tsx +0 -110
  786. package/src/pages/index/components/service/DemoMessageService.tsx +0 -100
  787. package/src/pages/index/components/service/DemoNoticeService.tsx +0 -99
  788. package/src/pages/index/components/service/DemoPopupService.tsx +0 -325
  789. package/src/pages/index/components/table/DemoPlcOperation.tsx +0 -307
  790. package/src/pages/index/components/table/DemoTableBasic.tsx +0 -220
  791. package/src/pages/index/components/table/DemoTableCheck.tsx +0 -78
  792. package/src/pages/index/components/table/DemoTableClassAndStyle.scss +0 -18
  793. package/src/pages/index/components/table/DemoTableClassAndStyle.tsx +0 -112
  794. package/src/pages/index/components/table/DemoTableColDraggable.tsx +0 -80
  795. package/src/pages/index/components/table/DemoTableEdit.tsx +0 -136
  796. package/src/pages/index/components/table/DemoTableExpand.tsx +0 -181
  797. package/src/pages/index/components/table/DemoTableFixed.tsx +0 -131
  798. package/src/pages/index/components/table/DemoTableFormatter.tsx +0 -66
  799. package/src/pages/index/components/table/DemoTableOverflowTooltip.tsx +0 -67
  800. package/src/pages/index/components/table/DemoTableRowDraggable.tsx +0 -106
  801. package/src/pages/index/components/table/DemoTableSlots.tsx +0 -153
  802. package/src/pages/index/components/table/DemoTableSpan.tsx +0 -167
  803. package/src/pages/index/components/table/DemoTableTree.tsx +0 -976
  804. package/src/pages/index/components/table/DemoVirtualTable.tsx +0 -274
  805. package/src/pages/index/components/test/DemoI18n.tsx +0 -27
  806. package/src/pages/index/components/test/DemoI18n2.jsx +0 -11
  807. package/src/pages/index/home/AppContent.tsx +0 -69
  808. package/src/pages/index/home/AppHead.tsx +0 -104
  809. package/src/pages/index/home/AppHome.tsx +0 -16
  810. package/src/pages/index/home/AppMenu.tsx +0 -38
  811. package/src/pages/index/home/menus.tsx +0 -217
  812. package/src/pages/index/main.tsx +0 -23
  813. package/src/pages/index/nav/$nav.ts +0 -41
  814. package/src/pages/index/pages.d.ts +0 -6
  815. package/src/pages/libs/iconfont-fontcls/demo.css +0 -539
  816. package/src/pages/libs/iconfont-fontcls/demo_index.html +0 -303
  817. package/src/pages/libs/iconfont-fontcls/iconfont.css +0 -35
  818. package/src/pages/libs/iconfont-fontcls/iconfont.js +0 -1
  819. package/src/pages/libs/iconfont-fontcls/iconfont.json +0 -44
  820. package/src/pages/libs/iconfont-fontcls/iconfont.ttf +0 -0
  821. package/src/pages/libs/iconfont-fontcls/iconfont.woff +0 -0
  822. package/src/pages/libs/iconfont-fontcls/iconfont.woff2 +0 -0
  823. package/src/pages/libs/iconfont-symbol/demo.css +0 -539
  824. package/src/pages/libs/iconfont-symbol/demo_index.html +0 -303
  825. package/src/pages/libs/iconfont-symbol/iconfont.css +0 -35
  826. package/src/pages/libs/iconfont-symbol/iconfont.js +0 -1
  827. package/src/pages/libs/iconfont-symbol/iconfont.json +0 -44
  828. package/src/pages/libs/iconfont-symbol/iconfont.ttf +0 -0
  829. package/src/pages/libs/iconfont-symbol/iconfont.woff +0 -0
  830. package/src/pages/libs/iconfont-symbol/iconfont.woff2 +0 -0
  831. package/src/pages/libs/install.iconfont-fontcls.tsx +0 -11
  832. package/src/pages/libs/install.iconfont-symbol.scss +0 -7
  833. package/src/pages/libs/install.iconfont-symbol.tsx +0 -14
  834. package/src/pages/module/address.ts +0 -27
  835. package/src/pages/module/http.ts +0 -24
  836. package/src/pages/module/index.ts +0 -19
  837. package/src/pages/module/object.ts +0 -5
  838. package/src/pages/module/ov.tsx +0 -13
  839. package/src/pages/module/upload.ts +0 -9
  840. package/src/pages/module/useTableOption.ts +0 -28
@@ -1,639 +1,639 @@
1
- import {createEffects} from "plain-utils/utils/createEffects";
2
- import {useAutoScroll} from "../../../Scroll/useAutoScroll";
3
- import {PlainScroll} from "../../../Scroll";
4
- import {TablePlcFixedType, tPlc, tPlcType} from "../../plc/utils/plc.utils";
5
- import {disabledUserSelect} from "plain-utils/dom/disabledUserSelect";
6
- import {enableUserSelect} from "plain-utils/dom/enableUserSelect";
7
- import {IteratePlcHandleType, iteratePlcList} from "../../plc/utils/iteratePlcList";
8
- import VirtualTable from "../../../VirtualTable";
9
- import {customDeepClone} from "../../../../utils/customDeepClone";
10
- import {addClass} from "plain-utils/dom/addClass";
11
- import {getComponentCls, iMouseEvent, nextIndex, StyleProperties} from "plain-design-composition";
12
- import {iTableHooks} from "../utils/createTableHooks";
13
- import {iElementRect} from "../../../../utils/getRowEl";
14
- import {createEnum} from "plain-utils/utils/createEnum";
15
- import {ClientZoom} from "../../../ClientZoom";
16
-
17
- export function useTableDraggierCol(
18
- {
19
- refs,
20
- hooks,
21
- getScroll,
22
- getHeadPlcListArray,
23
- getBodyPlcListArray,
24
- getPlcListArray,
25
- onChange,
26
- }: {
27
- /*table对子节点/子组件的引用*/
28
- refs: {
29
- /*table根节点dom对象*/
30
- el: HTMLDivElement | null | undefined,
31
- /*virtual table组件实例*/
32
- virtual: typeof VirtualTable.use.class | null | undefined
33
- },
34
- /*table内部钩子*/
35
- hooks: iTableHooks,
36
- /*获取scroll组件实例,实现自动滚动*/
37
- getScroll: () => PlainScroll | null | undefined,
38
- /*用于渲染表头的plc二维数组*/
39
- getHeadPlcListArray: () => tPlcType[][],
40
- /*用于渲染表体的plc数组,这个数组可能是virtual flat plc数组*/
41
- getBodyPlcListArray: () => tPlcType[],
42
- /*顶层的plc数组*/
43
- getPlcListArray: () => tPlcType[],
44
- /*拖拽位置变化动作*/
45
- onChange: (broList: tPlcType[]) => void,
46
- }
47
- ) {
48
-
49
- /*拖拽产生的副作用*/
50
- const { effects: draggierEffects } = createEffects();
51
-
52
- /*自动滚动*/
53
- const autoScroll = useAutoScroll({ vertical: false, getScroll, });
54
-
55
- const shadowTableHandler = (() => {
56
-
57
- let staticState = null as null | {
58
- plc: tPlcType,
59
- start: {
60
- x: number,
61
- y: number,
62
- },
63
- data: null | {
64
- left: number,
65
- table: HTMLTableElement,
66
- cloneTable: HTMLTableElement,
67
- move: {
68
- x: number,
69
- y: number,
70
- },
71
- }
72
- };
73
-
74
- const initDraggierState = () => {
75
- if (!staticState) {return;}
76
-
77
- /*---------------------------------------初始化cloneTable-------------------------------------------*/
78
- const { plc } = staticState;
79
- /*点击的标题plc的level一定是顶层的level*/
80
- let minLevel = plc.level;
81
-
82
- /*找到这个plc的所有子plc*/
83
- const allPlc = !plc.group ? [plc] : (() => {
84
- const list: tPlcType[] = [plc];
85
- iteratePlcList({
86
- plcList: plc.children,
87
- onPlc: (i) => {
88
- list.push(i);
89
- return IteratePlcHandleType.nothing;
90
- },
91
- onGroup: (i) => {
92
- list.push(i);
93
- return IteratePlcHandleType.nothing;
94
- },
95
- });
96
- return list;
97
- })();
98
- /*通过plcKey映射到plc*/
99
- const plcKey2plc = allPlc.reduce((prev, item) => {
100
- prev[item.plcKey] = item;
101
- return prev;
102
- }, {} as Record<string, tPlcType | undefined>);
103
-
104
- /*找到多级标题中,每一层需要保留的列的index*/
105
- const headLevel2indexList = (() => {
106
- const map = {} as Record<number, number[]>;
107
- const headPlcListArray = getHeadPlcListArray();
108
- allPlc.forEach(plc => {
109
- const index = headPlcListArray[plc.level].findIndex(i => i.plcKey === plc.plcKey);
110
- if (!map[plc.level]) {
111
- map[plc.level] = [];
112
- }
113
- map[plc.level].push(index);
114
- if (plc.level <= minLevel) {minLevel = plc.level;}
115
- });
116
- return map;
117
- })();
118
-
119
- /*找到body的列中,需要保留的列的index*/
120
- const bodyIndexList = (() => {
121
- let indexList = [] as number[];
122
- getBodyPlcListArray().forEach((plc, index) => {if (allPlc.findIndex(i => i.plcKey === plc.plcKey) > -1) {indexList.push(index);}});
123
- return indexList;
124
- })();
125
-
126
- /*当前thead中所有的tr,因为可能存在#text节点,这里提前查出来*/
127
- const headTableTrList = Array.from(refs.virtual!.refs.head!.querySelectorAll('thead tr')) as HTMLTableRowElement[];
128
- /*点击的td元素*/
129
- let cell: HTMLTableCellElement | null = null;
130
-
131
- /*最终克隆的table*/
132
- const cloneTable = customDeepClone(refs.el!, (sourceEl) => {
133
- if (sourceEl.tagName === 'TR') {
134
- /*克隆tr,仅保留需要的td*/
135
-
136
- const cloneTr = sourceEl.cloneNode(false) as HTMLTableRowElement;
137
- const tdList = (Array.from(sourceEl.childNodes) as HTMLTableRowElement[]).filter(i => i.tagName === 'TD');
138
- if (sourceEl.parentElement!.tagName === 'THEAD') {
139
- const level = headTableTrList.indexOf(sourceEl as any);
140
- if (!!headLevel2indexList[level]) {
141
- tdList.forEach((td, index) => {
142
- if (headLevel2indexList[level].indexOf(index) > -1) {
143
- cloneTr.appendChild(td.cloneNode(true));
144
- if (level === minLevel) {
145
- cell = td as any;
146
- }
147
- }
148
- });
149
- }
150
- return cloneTr;
151
- } else {
152
- bodyIndexList.forEach(index => {
153
- cloneTr.appendChild(tdList[index].cloneNode(true));
154
- });
155
- return cloneTr;
156
- }
157
- } else if (sourceEl.tagName === 'COLGROUP') {
158
- /*克隆colgorup,仅保留需要的col*/
159
-
160
- const cloneColGroup = sourceEl.cloneNode(false) as HTMLDivElement;
161
- bodyIndexList.forEach(index => {
162
- cloneColGroup.appendChild(sourceEl.childNodes[index].cloneNode(true));
163
- });
164
- return cloneColGroup;
165
- }
166
- return undefined;
167
- });
168
-
169
- const cellRect = cell!.getBoundingClientRect();
170
- const tableRect = refs.el!.getBoundingClientRect();
171
-
172
- /*固定宽度*/
173
- refs.el!.parentElement!.appendChild(cloneTable);
174
- draggierEffects.push(() => refs.el!.parentElement!.removeChild(cloneTable));
175
-
176
- cloneTable.style.width = cellRect.width + 'px';
177
- addClass(cloneTable, 'shadow-draggier-table');
178
- const outerPopperListEl = cloneTable.querySelector(`.${getComponentCls('outer-popper-list')}`);
179
- if (!!outerPopperListEl) {outerPopperListEl.parentElement!.removeChild(outerPopperListEl);}
180
- cloneTable.querySelector('.scroll-wrapper')!.scrollTop = refs.el!.querySelector('.scroll-wrapper')!.scrollTop;
181
-
182
- cloneTable.style.top = tableRect.top + 'px';
183
- cloneTable.style.left = cellRect.left + 'px';
184
- cloneTable.style.opacity = '0.75';
185
-
186
- staticState.data = {
187
- cloneTable: cloneTable as any,
188
- table: refs.el! as any,
189
- left: cellRect.left,
190
- move: {
191
- x: staticState.start.x,
192
- y: staticState.start.y,
193
- },
194
- };
195
-
196
- /*隐藏原始的单元格*/
197
- draggierEffects.push(
198
- hooks.onCellStyle.use(({ plc, styles }) => {
199
- if (!!plcKey2plc[plc.plcKey]) {
200
- styles.opacity = '0';
201
- }
202
- })
203
- );
204
-
205
- /*---------------------------------------禁用页面选择-------------------------------------------*/
206
- /*禁用选中页面文本*/
207
- disabledUserSelect();
208
- draggierEffects.push(() => {enableUserSelect();});
209
-
210
- /*---------------------------------------初始化indicator-------------------------------------------*/
211
-
212
- indicatorHandler.start(staticState.start.x, plc);
213
-
214
- /*---------------------------------------自动滚动-------------------------------------------*/
215
- /*自动滚动*/
216
- if (refs.virtual?.refs.scroll?.refs.wrapper) {
217
- const { scrollWidth, offsetWidth } = refs.virtual.refs.scroll.refs.wrapper;
218
- if (scrollWidth > offsetWidth) {
219
- autoScroll.showHover();
220
- draggierEffects.push(() => {autoScroll.hideHover();});
221
- }
222
- }
223
-
224
- };
225
-
226
- const start = (e: iMouseEvent, plc: tPlcType) => {
227
- const { clientX, clientY } = ClientZoom.getClientPosition(e);
228
- staticState = {
229
- plc,
230
- start: {
231
- x: clientX,
232
- y: clientY,
233
- },
234
- data: null
235
- };
236
- draggierEffects.push(() => {staticState = null;});
237
- };
238
-
239
- const update = (e?: MouseEvent) => {
240
- if (!staticState) {return;}
241
-
242
- const { clientX, clientY } = !e ? { clientX: 0, clientY: 0 } : ClientZoom.getClientPosition(e);
243
-
244
- let isDragging = !!staticState.data;
245
-
246
- if (!isDragging) {
247
- /*拖拽超过一定距离的时候才开始拖拽,避免与点击事件冲突*/
248
- if (!!e && Math.abs(clientX - staticState.start.x) > 5) {
249
- isDragging = true;
250
- initDraggierState();
251
- }
252
- }
253
-
254
- if (!isDragging || !staticState.data) {
255
- /*还没哟开始拖拽,不往下走了*/
256
- return;
257
- }
258
-
259
- if (!!e) {
260
- staticState.data.move = { x: clientX, y: clientY };
261
- }
262
- const { data: { cloneTable, move, table, left }, start } = staticState;
263
- cloneTable.style.top = table.getBoundingClientRect().top + 'px';
264
- cloneTable.style.left = (left + (move.x - start.x)) + 'px';
265
-
266
- indicatorHandler.update(e);
267
- };
268
-
269
- const isDragging = () => !!staticState;
270
-
271
- return { start, update, isDragging };
272
- })();
273
-
274
- /*指示器*/
275
- const indicatorHandler = (() => {
276
- /*指示器大小*/
277
- const indicatorSize = 1;
278
-
279
- /*工具函数*/
280
- const utils = {
281
- /**
282
- * 获取拖拽的数据
283
- * @author 韦胜健
284
- * @date 2022.11.28 21:11
285
- */
286
- getDragData: (left: number): { index: number, dragData: iIndicatorDragData, hover: typeof eIndicatorHoverPart.TYPE } | null => {
287
- for (let i = 0; i < staticState!.dragData!.length; i++) {
288
- const dd = staticState!.dragData![i];
289
- if (left >= dd.left && left <= dd.left + (dd.width || Infinity)) {
290
- return {
291
- index: i,
292
- dragData: dd,
293
- hover: left - dd.left > dd.width / 2 ? eIndicatorHoverPart.right : eIndicatorHoverPart.left
294
- };
295
- }
296
- }
297
- // throw new Error(`Can not get dragData by left:${left}`);
298
- return null;
299
- },
300
- /**
301
- * 刷新indicator定位
302
- * @author 韦胜健
303
- * @date 2022.11.28 21:18
304
- */
305
- refresh() {
306
- if (!staticState) {return;}
307
-
308
- const left = (() => {
309
- /*检查是否落入左固定列区域*/
310
- const fixedLeftList = staticState.broList.filter(i => i.props.fixed === 'left');
311
- if (fixedLeftList.length > 0) {
312
- let fixedLeftWidth = fixedLeftList.reduce((prev, item) => prev + item.getWidth(), 0);
313
- const moveOffsetX = staticState.moveClientX - staticState.scrollRect.left;
314
- if (moveOffsetX <= fixedLeftWidth) {
315
- /*调整为移动到左固定列中*/
316
- return moveOffsetX;
317
- }
318
- }
319
- /*检查是否落入右固定列区域*/
320
- const fixedRightList = staticState.broList.filter(i => i.props.fixed == 'right');
321
- if (fixedRightList.length > 0) {
322
- let fixedRightWidth = fixedRightList.reduce((prev, item) => prev + item.getWidth(), 0);
323
- const moveOffsetX = staticState.moveClientX - staticState.scrollRect.left;
324
- if (moveOffsetX > staticState.scrollRect.width - fixedRightWidth) {
325
- /*调整为移动到右固定列中*/
326
- return refs.virtual!.refs.scroll!.refs.wrapper!.scrollWidth - (staticState.scrollRect.width - moveOffsetX);
327
- }
328
- }
329
-
330
- /*无调整,按照移动的位置决定移动到哪里*/
331
- return (staticState.moveClientX - staticState.scrollRect.left) + (staticState.moveScrollLeft);
332
- })();
333
-
334
- const refreshData = utils.getDragData(left);
335
- if (!refreshData) {return;}
336
-
337
- staticState.refreshData = refreshData;
338
- const { dragData, hover } = staticState.refreshData;
339
-
340
- let indicatorLeft = (hover === eIndicatorHoverPart.left ? dragData.left : dragData.left + dragData.width - indicatorSize) + staticState.scrollRect.left - staticState.moveScrollLeft;
341
-
342
- if (dragData.plc.props.fixed === 'left') {
343
- /*如果是左固定列,调整指示器的位置*/
344
- indicatorLeft += staticState.moveScrollLeft;
345
- } else if (dragData.plc.props.fixed === 'right') {
346
- /*如果是右固定列,调整指示器的位置*/
347
- const { scrollWidth, offsetWidth, scrollLeft } = refs.virtual!.refs.scroll!.refs.wrapper!;
348
- indicatorLeft += scrollLeft - ((scrollWidth - offsetWidth)) - 17;
349
- }
350
-
351
- /*指示器不能越过host容器*/
352
- indicatorLeft = Math.min(Math.max(staticState.scrollRect.left, indicatorLeft), staticState.scrollRect.left + staticState.scrollRect.width - indicatorSize);
353
-
354
- Object.assign(staticState.indicator!.style, { left: `${indicatorLeft}px`, } as StyleProperties);
355
- staticState.indicator!.setAttribute('droppable', dragData.droppable ? 'true' : 'false');
356
- },
357
- };
358
-
359
- /*拖拽状态*/
360
- let staticState = null as null | {
361
- /*拖拽开始时的鼠标x轴坐标*/
362
- startClientX: number,
363
- /*拖拽时的鼠标x轴坐标*/
364
- moveClientX: number,
365
-
366
- /*拖拽开始时指示器left定位*/
367
- startScrollLeft: number,
368
- /*拖拽移动时指示器left定位*/
369
- moveScrollLeft: number,
370
-
371
- /*滚动的父节点*/
372
- scrollParent: HTMLElement,
373
- /*滚动容器位置信息*/
374
- scrollRect: iElementRect,
375
- /*拖拽的指示器节点*/
376
- indicator: HTMLElement,
377
- /*拖拽的数据*/
378
- dragData: iIndicatorDragData[],
379
- /*拖拽时的兄弟列信息*/
380
- broList: tPlcType[],
381
- /*用来刷新的数据*/
382
- refreshData: null | {
383
- /*拖拽放置的目标位置索引*/
384
- index: number,
385
- /*拖拽的数据*/
386
- dragData: iIndicatorDragData,
387
- /*放置的时候处于放置节点的那部分区域*/
388
- hover: typeof eIndicatorHoverPart.TYPE,
389
- }
390
- };
391
-
392
- const start = (startX: number, plc: tPlcType) => {
393
- const { broList, broData } = getDragData(getPlcListArray(), plc);
394
- const tableRect = refs.el!.getBoundingClientRect();
395
-
396
- /*添加指示器*/
397
- const indicator = document.createElement('div');
398
- addClass(indicator, 'plt-col-draggier-indicator');
399
- Object.assign(indicator.style, {
400
- top: `${tableRect.top}px`,
401
- left: `${0}px`,
402
- height: `${tableRect.height}px`,
403
- width: `${indicatorSize}px`,
404
- position: 'fixed',
405
- zIndex: `${nextIndex() + 100}`, // 加100是为了不被 autoScroller 遮住;
406
- pointerEvents: 'none', // indicator只是一个指示的作用,这里设置none为了不挡住autoScroller的鼠标事件
407
- } as StyleProperties);
408
- refs.el!.appendChild(indicator);
409
- draggierEffects.push(() => {refs.el!.removeChild(indicator);});
410
-
411
- /*应用拖拽的位置*/
412
- draggierEffects.push(() => {
413
- if (!staticState?.refreshData) {return;}
414
- const { dragData, hover } = staticState.refreshData;
415
- if (!dragData.droppable) {return;}
416
-
417
- const startPlc = plc;
418
- const endPlc = dragData.plc;
419
- const broList = staticState.broList!;
420
-
421
- const startIndex = broList.indexOf(startPlc);
422
- let endIndex = broList.indexOf(endPlc);
423
- if (startIndex === endIndex) {return;}
424
-
425
- if (startPlc.props.fixed != endPlc.props.fixed) {
426
- startPlc.setPropsState({ fixed: endPlc.props.fixed });
427
- } else {
428
- if (startPlc.props.fixed === 'center') {
429
- if (staticState.moveClientX < staticState.scrollRect.left) {
430
- startPlc.setPropsState({ fixed: TablePlcFixedType.left });
431
- } else if (staticState.moveClientX > staticState.scrollRect.left + staticState.scrollRect.width) {
432
- startPlc.setPropsState({ fixed: TablePlcFixedType.right });
433
- }
434
- }
435
- }
436
-
437
- broList.splice(startIndex, 1);
438
- endIndex = broList.indexOf(endPlc);
439
- endIndex = hover === eIndicatorHoverPart.right ? endIndex + 1 : endIndex;
440
- broList.splice(endIndex, 0, startPlc);
441
-
442
- broList.forEach((plc, index) => plc.setPropsState({ order: index }));
443
- onChange(broList);
444
- });
445
-
446
- /*监听父节点滚动动作*/
447
- const scrollParent = refs.virtual!.refs.scroll!.refs.wrapper!;
448
- const onScroll = () => shadowTableHandler.update();
449
- scrollParent.addEventListener('mousemove', shadowTableHandler.update);
450
- scrollParent.addEventListener('scroll', onScroll);
451
- draggierEffects.push(() => {
452
- scrollParent.removeEventListener('mousemove', shadowTableHandler.update);
453
- scrollParent.removeEventListener('scroll', onScroll);
454
- });
455
-
456
- /*拖拽状态*/
457
- staticState = {
458
- dragData: broData,
459
- broList: broList,
460
- startClientX: startX,
461
- moveClientX: startX,
462
- scrollParent,
463
- scrollRect: scrollParent.parentElement!.getBoundingClientRect(),
464
- startScrollLeft: scrollParent.scrollLeft,
465
- moveScrollLeft: scrollParent.scrollLeft,
466
- indicator,
467
- refreshData: null,
468
- };
469
- /*最后才能销毁拖拽状态*/
470
- draggierEffects.push(() => {staticState = null;});
471
-
472
- /*刷新定位*/
473
- utils.refresh();
474
- };
475
- const update = (e?: MouseEvent) => {
476
- if (!!e) {
477
- const { clientX } = ClientZoom.getClientPosition(e);
478
- staticState!.moveClientX = clientX;
479
- } else {
480
- staticState!.moveScrollLeft = staticState!.scrollParent!.scrollLeft;
481
- }
482
- utils.refresh();
483
- };
484
-
485
- return { start, update, get staticState() {return staticState;} };
486
- })();
487
-
488
- const handler = {
489
- onMousedown: (e: iMouseEvent, plc: tPlcType) => {
490
- if (e.button === 2) {return;}
491
- shadowTableHandler.start(e, plc);
492
-
493
- document.addEventListener('mousemove', shadowTableHandler.update);
494
- document.addEventListener('mouseup', draggierEffects.clear);
495
- draggierEffects.push(() => {
496
- document.removeEventListener('mousemove', shadowTableHandler.update);
497
- document.removeEventListener('mouseup', draggierEffects.clear);
498
- });
499
- },
500
- };
501
-
502
- const isDragging = shadowTableHandler.isDragging;
503
-
504
- return { handler, isDragging };
505
- }
506
-
507
-
508
- interface iIndicatorDragData {
509
- left: number;
510
- width: number;
511
- plc: tPlcType;
512
- droppable: boolean;
513
- }
514
-
515
- const eIndicatorHoverPart = createEnum(['left', 'right'] as const);
516
-
517
-
518
- /**
519
- * 递归遍历plc数组数据
520
- * @author 韦胜健
521
- * @date 2020/9/6 11:24
522
- */
523
- function iteratePlc(plcList: tPlcType[], handler: (plc: tPlcType) => 'stop' | void): void {
524
-
525
- for (let i = 0; i < plcList.length; i++) {
526
- const item = plcList[i];
527
- const flag = handler(item);
528
- if (flag === 'stop') {
529
- return;
530
- } else {
531
- if (item.group) {
532
- iteratePlc(item.children, handler);
533
- }
534
- }
535
- }
536
-
537
- }
538
-
539
- /**
540
- * 或者plc对象的兄弟节点
541
- * @author 韦胜健
542
- * @date 2020/9/6 11:24
543
- */
544
- function getBroPlcList(plcList: tPlcType[], plc: tPlcType): tPlcType[] {
545
-
546
- let broPlcList: tPlcType[] = [];
547
-
548
- if (plcList.indexOf(plc) > -1) {
549
- broPlcList = plcList;
550
- } else {
551
- iteratePlc(plcList, itarPlc => {
552
- if (itarPlc.group) {
553
- if (itarPlc.children.indexOf(plc) > -1) {
554
- broPlcList = itarPlc.children;
555
- return 'stop';
556
- }
557
- }
558
- });
559
- }
560
-
561
- if (broPlcList.length === 0) {
562
- /*内部错误,找不到兄弟节点*/
563
- throw new Error('Internal error! sibling node not found.');
564
- }
565
-
566
- return broPlcList;
567
- }
568
-
569
- /**
570
- * 获取plc的宽度
571
- * @author 韦胜健
572
- * @date 2020/9/6 12:09
573
- */
574
- function getPlcWidth(plc: tPlcType) {
575
- if (!plc.group) {
576
- return Number(plc.props.width);
577
- } else {
578
- return plc.children.reduce((ret: number, item: tPlcType) => {
579
- ret += getPlcWidth(item);
580
- return ret;
581
- }, 0);
582
- }
583
- }
584
-
585
- /**
586
- * 获取plcList中最底层的plc
587
- * @author 韦胜健
588
- * @date 2020/9/6 20:27
589
- */
590
- function getLowestPlcList(plcList: tPlcType[]): tPlc[] {
591
-
592
- return plcList.reduce((ret: tPlc[], plc: tPlcType) => {
593
- if (plc.group) {
594
- ret.push(...getLowestPlcList(plc.children));
595
- } else {
596
- ret.push(plc);
597
- }
598
- return ret;
599
- }, [] as tPlc[]);
600
-
601
- }
602
-
603
- /**
604
- * 获取拖拽所需要的数据
605
- * @author 韦胜健
606
- * @date 2020/9/6 20:41
607
- */
608
- function getDragData(plcList: tPlcType[], plc: tPlcType): {
609
- broData: iIndicatorDragData[],
610
- broList: tPlcType[]
611
- } {
612
-
613
- const broList = getBroPlcList(plcList, plc);
614
-
615
- const broLowestList = getLowestPlcList(broList);
616
- const allLowestList = getLowestPlcList(plcList) as tPlcType[];
617
-
618
- allLowestList.splice(allLowestList.indexOf(broLowestList[0]), broLowestList.length, ...broList);
619
-
620
- const broData: iIndicatorDragData[] = [];
621
- let left = 0;
622
-
623
- allLowestList.forEach(plc => {
624
- const item = {
625
- left,
626
- width: getPlcWidth(plc),
627
- plc,
628
- droppable: broList.indexOf(plc) > -1
629
- };
630
- left += item.width;
631
- broData.push(item);
632
- });
633
-
634
- return {
635
- broList,
636
- broData,
637
- };
638
-
639
- }
1
+ import {createEffects} from "plain-utils/utils/createEffects";
2
+ import {useAutoScroll} from "../../../Scroll/useAutoScroll";
3
+ import {PlainScroll} from "../../../Scroll";
4
+ import {TablePlcFixedType, tPlc, tPlcType} from "../../plc/utils/plc.utils";
5
+ import {disabledUserSelect} from "plain-utils/dom/disabledUserSelect";
6
+ import {enableUserSelect} from "plain-utils/dom/enableUserSelect";
7
+ import {IteratePlcHandleType, iteratePlcList} from "../../plc/utils/iteratePlcList";
8
+ import VirtualTable from "../../../VirtualTable";
9
+ import {customDeepClone} from "../../../../utils/customDeepClone";
10
+ import {addClass} from "plain-utils/dom/addClass";
11
+ import {getComponentCls, iMouseEvent, nextIndex, StyleProperties} from "plain-design-composition";
12
+ import {iTableHooks} from "../utils/createTableHooks";
13
+ import {iElementRect} from "../../../../utils/getRowEl";
14
+ import {createEnum} from "plain-utils/utils/createEnum";
15
+ import {ClientZoom} from "../../../ClientZoom";
16
+
17
+ export function useTableDraggierCol(
18
+ {
19
+ refs,
20
+ hooks,
21
+ getScroll,
22
+ getHeadPlcListArray,
23
+ getBodyPlcListArray,
24
+ getPlcListArray,
25
+ onChange,
26
+ }: {
27
+ /*table对子节点/子组件的引用*/
28
+ refs: {
29
+ /*table根节点dom对象*/
30
+ el: HTMLDivElement | null | undefined,
31
+ /*virtual table组件实例*/
32
+ virtual: typeof VirtualTable.use.class | null | undefined
33
+ },
34
+ /*table内部钩子*/
35
+ hooks: iTableHooks,
36
+ /*获取scroll组件实例,实现自动滚动*/
37
+ getScroll: () => PlainScroll | null | undefined,
38
+ /*用于渲染表头的plc二维数组*/
39
+ getHeadPlcListArray: () => tPlcType[][],
40
+ /*用于渲染表体的plc数组,这个数组可能是virtual flat plc数组*/
41
+ getBodyPlcListArray: () => tPlcType[],
42
+ /*顶层的plc数组*/
43
+ getPlcListArray: () => tPlcType[],
44
+ /*拖拽位置变化动作*/
45
+ onChange: (broList: tPlcType[]) => void,
46
+ }
47
+ ) {
48
+
49
+ /*拖拽产生的副作用*/
50
+ const { effects: draggierEffects } = createEffects();
51
+
52
+ /*自动滚动*/
53
+ const autoScroll = useAutoScroll({ vertical: false, getScroll, });
54
+
55
+ const shadowTableHandler = (() => {
56
+
57
+ let staticState = null as null | {
58
+ plc: tPlcType,
59
+ start: {
60
+ x: number,
61
+ y: number,
62
+ },
63
+ data: null | {
64
+ left: number,
65
+ table: HTMLTableElement,
66
+ cloneTable: HTMLTableElement,
67
+ move: {
68
+ x: number,
69
+ y: number,
70
+ },
71
+ }
72
+ };
73
+
74
+ const initDraggierState = () => {
75
+ if (!staticState) {return;}
76
+
77
+ /*---------------------------------------初始化cloneTable-------------------------------------------*/
78
+ const { plc } = staticState;
79
+ /*点击的标题plc的level一定是顶层的level*/
80
+ let minLevel = plc.level;
81
+
82
+ /*找到这个plc的所有子plc*/
83
+ const allPlc = !plc.group ? [plc] : (() => {
84
+ const list: tPlcType[] = [plc];
85
+ iteratePlcList({
86
+ plcList: plc.children,
87
+ onPlc: (i) => {
88
+ list.push(i);
89
+ return IteratePlcHandleType.nothing;
90
+ },
91
+ onGroup: (i) => {
92
+ list.push(i);
93
+ return IteratePlcHandleType.nothing;
94
+ },
95
+ });
96
+ return list;
97
+ })();
98
+ /*通过plcKey映射到plc*/
99
+ const plcKey2plc = allPlc.reduce((prev, item) => {
100
+ prev[item.plcKey] = item;
101
+ return prev;
102
+ }, {} as Record<string, tPlcType | undefined>);
103
+
104
+ /*找到多级标题中,每一层需要保留的列的index*/
105
+ const headLevel2indexList = (() => {
106
+ const map = {} as Record<number, number[]>;
107
+ const headPlcListArray = getHeadPlcListArray();
108
+ allPlc.forEach(plc => {
109
+ const index = headPlcListArray[plc.level].findIndex(i => i.plcKey === plc.plcKey);
110
+ if (!map[plc.level]) {
111
+ map[plc.level] = [];
112
+ }
113
+ map[plc.level].push(index);
114
+ if (plc.level <= minLevel) {minLevel = plc.level;}
115
+ });
116
+ return map;
117
+ })();
118
+
119
+ /*找到body的列中,需要保留的列的index*/
120
+ const bodyIndexList = (() => {
121
+ let indexList = [] as number[];
122
+ getBodyPlcListArray().forEach((plc, index) => {if (allPlc.findIndex(i => i.plcKey === plc.plcKey) > -1) {indexList.push(index);}});
123
+ return indexList;
124
+ })();
125
+
126
+ /*当前thead中所有的tr,因为可能存在#text节点,这里提前查出来*/
127
+ const headTableTrList = Array.from(refs.virtual!.refs.head!.querySelectorAll('thead tr')) as HTMLTableRowElement[];
128
+ /*点击的td元素*/
129
+ let cell: HTMLTableCellElement | null = null;
130
+
131
+ /*最终克隆的table*/
132
+ const cloneTable = customDeepClone(refs.el!, (sourceEl) => {
133
+ if (sourceEl.tagName === 'TR') {
134
+ /*克隆tr,仅保留需要的td*/
135
+
136
+ const cloneTr = sourceEl.cloneNode(false) as HTMLTableRowElement;
137
+ const tdList = (Array.from(sourceEl.childNodes) as HTMLTableRowElement[]).filter(i => i.tagName === 'TD');
138
+ if (sourceEl.parentElement!.tagName === 'THEAD') {
139
+ const level = headTableTrList.indexOf(sourceEl as any);
140
+ if (!!headLevel2indexList[level]) {
141
+ tdList.forEach((td, index) => {
142
+ if (headLevel2indexList[level].indexOf(index) > -1) {
143
+ cloneTr.appendChild(td.cloneNode(true));
144
+ if (level === minLevel) {
145
+ cell = td as any;
146
+ }
147
+ }
148
+ });
149
+ }
150
+ return cloneTr;
151
+ } else {
152
+ bodyIndexList.forEach(index => {
153
+ cloneTr.appendChild(tdList[index].cloneNode(true));
154
+ });
155
+ return cloneTr;
156
+ }
157
+ } else if (sourceEl.tagName === 'COLGROUP') {
158
+ /*克隆colgorup,仅保留需要的col*/
159
+
160
+ const cloneColGroup = sourceEl.cloneNode(false) as HTMLDivElement;
161
+ bodyIndexList.forEach(index => {
162
+ cloneColGroup.appendChild(sourceEl.childNodes[index].cloneNode(true));
163
+ });
164
+ return cloneColGroup;
165
+ }
166
+ return undefined;
167
+ });
168
+
169
+ const cellRect = cell!.getBoundingClientRect();
170
+ const tableRect = refs.el!.getBoundingClientRect();
171
+
172
+ /*固定宽度*/
173
+ refs.el!.parentElement!.appendChild(cloneTable);
174
+ draggierEffects.push(() => refs.el!.parentElement!.removeChild(cloneTable));
175
+
176
+ cloneTable.style.width = cellRect.width + 'px';
177
+ addClass(cloneTable, 'shadow-draggier-table');
178
+ const outerPopperListEl = cloneTable.querySelector(`.${getComponentCls('outer-popper-list')}`);
179
+ if (!!outerPopperListEl) {outerPopperListEl.parentElement!.removeChild(outerPopperListEl);}
180
+ cloneTable.querySelector('.scroll-wrapper')!.scrollTop = refs.el!.querySelector('.scroll-wrapper')!.scrollTop;
181
+
182
+ cloneTable.style.top = tableRect.top + 'px';
183
+ cloneTable.style.left = cellRect.left + 'px';
184
+ cloneTable.style.opacity = '0.75';
185
+
186
+ staticState.data = {
187
+ cloneTable: cloneTable as any,
188
+ table: refs.el! as any,
189
+ left: cellRect.left,
190
+ move: {
191
+ x: staticState.start.x,
192
+ y: staticState.start.y,
193
+ },
194
+ };
195
+
196
+ /*隐藏原始的单元格*/
197
+ draggierEffects.push(
198
+ hooks.onCellStyle.use(({ plc, styles }) => {
199
+ if (!!plcKey2plc[plc.plcKey]) {
200
+ styles.opacity = '0';
201
+ }
202
+ })
203
+ );
204
+
205
+ /*---------------------------------------禁用页面选择-------------------------------------------*/
206
+ /*禁用选中页面文本*/
207
+ disabledUserSelect();
208
+ draggierEffects.push(() => {enableUserSelect();});
209
+
210
+ /*---------------------------------------初始化indicator-------------------------------------------*/
211
+
212
+ indicatorHandler.start(staticState.start.x, plc);
213
+
214
+ /*---------------------------------------自动滚动-------------------------------------------*/
215
+ /*自动滚动*/
216
+ if (refs.virtual?.refs.scroll?.refs.wrapper) {
217
+ const { scrollWidth, offsetWidth } = refs.virtual.refs.scroll.refs.wrapper;
218
+ if (scrollWidth > offsetWidth) {
219
+ autoScroll.showHover();
220
+ draggierEffects.push(() => {autoScroll.hideHover();});
221
+ }
222
+ }
223
+
224
+ };
225
+
226
+ const start = (e: iMouseEvent, plc: tPlcType) => {
227
+ const { clientX, clientY } = ClientZoom.getClientPosition(e);
228
+ staticState = {
229
+ plc,
230
+ start: {
231
+ x: clientX,
232
+ y: clientY,
233
+ },
234
+ data: null
235
+ };
236
+ draggierEffects.push(() => {staticState = null;});
237
+ };
238
+
239
+ const update = (e?: MouseEvent) => {
240
+ if (!staticState) {return;}
241
+
242
+ const { clientX, clientY } = !e ? { clientX: 0, clientY: 0 } : ClientZoom.getClientPosition(e);
243
+
244
+ let isDragging = !!staticState.data;
245
+
246
+ if (!isDragging) {
247
+ /*拖拽超过一定距离的时候才开始拖拽,避免与点击事件冲突*/
248
+ if (!!e && Math.abs(clientX - staticState.start.x) > 5) {
249
+ isDragging = true;
250
+ initDraggierState();
251
+ }
252
+ }
253
+
254
+ if (!isDragging || !staticState.data) {
255
+ /*还没哟开始拖拽,不往下走了*/
256
+ return;
257
+ }
258
+
259
+ if (!!e) {
260
+ staticState.data.move = { x: clientX, y: clientY };
261
+ }
262
+ const { data: { cloneTable, move, table, left }, start } = staticState;
263
+ cloneTable.style.top = table.getBoundingClientRect().top + 'px';
264
+ cloneTable.style.left = (left + (move.x - start.x)) + 'px';
265
+
266
+ indicatorHandler.update(e);
267
+ };
268
+
269
+ const isDragging = () => !!staticState;
270
+
271
+ return { start, update, isDragging };
272
+ })();
273
+
274
+ /*指示器*/
275
+ const indicatorHandler = (() => {
276
+ /*指示器大小*/
277
+ const indicatorSize = 1;
278
+
279
+ /*工具函数*/
280
+ const utils = {
281
+ /**
282
+ * 获取拖拽的数据
283
+ * @author 韦胜健
284
+ * @date 2022.11.28 21:11
285
+ */
286
+ getDragData: (left: number): { index: number, dragData: iIndicatorDragData, hover: typeof eIndicatorHoverPart.TYPE } | null => {
287
+ for (let i = 0; i < staticState!.dragData!.length; i++) {
288
+ const dd = staticState!.dragData![i];
289
+ if (left >= dd.left && left <= dd.left + (dd.width || Infinity)) {
290
+ return {
291
+ index: i,
292
+ dragData: dd,
293
+ hover: left - dd.left > dd.width / 2 ? eIndicatorHoverPart.right : eIndicatorHoverPart.left
294
+ };
295
+ }
296
+ }
297
+ // throw new Error(`Can not get dragData by left:${left}`);
298
+ return null;
299
+ },
300
+ /**
301
+ * 刷新indicator定位
302
+ * @author 韦胜健
303
+ * @date 2022.11.28 21:18
304
+ */
305
+ refresh() {
306
+ if (!staticState) {return;}
307
+
308
+ const left = (() => {
309
+ /*检查是否落入左固定列区域*/
310
+ const fixedLeftList = staticState.broList.filter(i => i.props.fixed === 'left');
311
+ if (fixedLeftList.length > 0) {
312
+ let fixedLeftWidth = fixedLeftList.reduce((prev, item) => prev + item.getWidth(), 0);
313
+ const moveOffsetX = staticState.moveClientX - staticState.scrollRect.left;
314
+ if (moveOffsetX <= fixedLeftWidth) {
315
+ /*调整为移动到左固定列中*/
316
+ return moveOffsetX;
317
+ }
318
+ }
319
+ /*检查是否落入右固定列区域*/
320
+ const fixedRightList = staticState.broList.filter(i => i.props.fixed == 'right');
321
+ if (fixedRightList.length > 0) {
322
+ let fixedRightWidth = fixedRightList.reduce((prev, item) => prev + item.getWidth(), 0);
323
+ const moveOffsetX = staticState.moveClientX - staticState.scrollRect.left;
324
+ if (moveOffsetX > staticState.scrollRect.width - fixedRightWidth) {
325
+ /*调整为移动到右固定列中*/
326
+ return refs.virtual!.refs.scroll!.refs.wrapper!.scrollWidth - (staticState.scrollRect.width - moveOffsetX);
327
+ }
328
+ }
329
+
330
+ /*无调整,按照移动的位置决定移动到哪里*/
331
+ return (staticState.moveClientX - staticState.scrollRect.left) + (staticState.moveScrollLeft);
332
+ })();
333
+
334
+ const refreshData = utils.getDragData(left);
335
+ if (!refreshData) {return;}
336
+
337
+ staticState.refreshData = refreshData;
338
+ const { dragData, hover } = staticState.refreshData;
339
+
340
+ let indicatorLeft = (hover === eIndicatorHoverPart.left ? dragData.left : dragData.left + dragData.width - indicatorSize) + staticState.scrollRect.left - staticState.moveScrollLeft;
341
+
342
+ if (dragData.plc.props.fixed === 'left') {
343
+ /*如果是左固定列,调整指示器的位置*/
344
+ indicatorLeft += staticState.moveScrollLeft;
345
+ } else if (dragData.plc.props.fixed === 'right') {
346
+ /*如果是右固定列,调整指示器的位置*/
347
+ const { scrollWidth, offsetWidth, scrollLeft } = refs.virtual!.refs.scroll!.refs.wrapper!;
348
+ indicatorLeft += scrollLeft - ((scrollWidth - offsetWidth)) - 17;
349
+ }
350
+
351
+ /*指示器不能越过host容器*/
352
+ indicatorLeft = Math.min(Math.max(staticState.scrollRect.left, indicatorLeft), staticState.scrollRect.left + staticState.scrollRect.width - indicatorSize);
353
+
354
+ Object.assign(staticState.indicator!.style, { left: `${indicatorLeft}px`, } as StyleProperties);
355
+ staticState.indicator!.setAttribute('droppable', dragData.droppable ? 'true' : 'false');
356
+ },
357
+ };
358
+
359
+ /*拖拽状态*/
360
+ let staticState = null as null | {
361
+ /*拖拽开始时的鼠标x轴坐标*/
362
+ startClientX: number,
363
+ /*拖拽时的鼠标x轴坐标*/
364
+ moveClientX: number,
365
+
366
+ /*拖拽开始时指示器left定位*/
367
+ startScrollLeft: number,
368
+ /*拖拽移动时指示器left定位*/
369
+ moveScrollLeft: number,
370
+
371
+ /*滚动的父节点*/
372
+ scrollParent: HTMLElement,
373
+ /*滚动容器位置信息*/
374
+ scrollRect: iElementRect,
375
+ /*拖拽的指示器节点*/
376
+ indicator: HTMLElement,
377
+ /*拖拽的数据*/
378
+ dragData: iIndicatorDragData[],
379
+ /*拖拽时的兄弟列信息*/
380
+ broList: tPlcType[],
381
+ /*用来刷新的数据*/
382
+ refreshData: null | {
383
+ /*拖拽放置的目标位置索引*/
384
+ index: number,
385
+ /*拖拽的数据*/
386
+ dragData: iIndicatorDragData,
387
+ /*放置的时候处于放置节点的那部分区域*/
388
+ hover: typeof eIndicatorHoverPart.TYPE,
389
+ }
390
+ };
391
+
392
+ const start = (startX: number, plc: tPlcType) => {
393
+ const { broList, broData } = getDragData(getPlcListArray(), plc);
394
+ const tableRect = refs.el!.getBoundingClientRect();
395
+
396
+ /*添加指示器*/
397
+ const indicator = document.createElement('div');
398
+ addClass(indicator, 'plt-col-draggier-indicator');
399
+ Object.assign(indicator.style, {
400
+ top: `${tableRect.top}px`,
401
+ left: `${0}px`,
402
+ height: `${tableRect.height}px`,
403
+ width: `${indicatorSize}px`,
404
+ position: 'fixed',
405
+ zIndex: `${nextIndex() + 100}`, // 加100是为了不被 autoScroller 遮住;
406
+ pointerEvents: 'none', // indicator只是一个指示的作用,这里设置none为了不挡住autoScroller的鼠标事件
407
+ } as StyleProperties);
408
+ refs.el!.appendChild(indicator);
409
+ draggierEffects.push(() => {refs.el!.removeChild(indicator);});
410
+
411
+ /*应用拖拽的位置*/
412
+ draggierEffects.push(() => {
413
+ if (!staticState?.refreshData) {return;}
414
+ const { dragData, hover } = staticState.refreshData;
415
+ if (!dragData.droppable) {return;}
416
+
417
+ const startPlc = plc;
418
+ const endPlc = dragData.plc;
419
+ const broList = staticState.broList!;
420
+
421
+ const startIndex = broList.indexOf(startPlc);
422
+ let endIndex = broList.indexOf(endPlc);
423
+ if (startIndex === endIndex) {return;}
424
+
425
+ if (startPlc.props.fixed != endPlc.props.fixed) {
426
+ startPlc.setPropsState({ fixed: endPlc.props.fixed });
427
+ } else {
428
+ if (startPlc.props.fixed === 'center') {
429
+ if (staticState.moveClientX < staticState.scrollRect.left) {
430
+ startPlc.setPropsState({ fixed: TablePlcFixedType.left });
431
+ } else if (staticState.moveClientX > staticState.scrollRect.left + staticState.scrollRect.width) {
432
+ startPlc.setPropsState({ fixed: TablePlcFixedType.right });
433
+ }
434
+ }
435
+ }
436
+
437
+ broList.splice(startIndex, 1);
438
+ endIndex = broList.indexOf(endPlc);
439
+ endIndex = hover === eIndicatorHoverPart.right ? endIndex + 1 : endIndex;
440
+ broList.splice(endIndex, 0, startPlc);
441
+
442
+ broList.forEach((plc, index) => plc.setPropsState({ order: index }));
443
+ onChange(broList);
444
+ });
445
+
446
+ /*监听父节点滚动动作*/
447
+ const scrollParent = refs.virtual!.refs.scroll!.refs.wrapper!;
448
+ const onScroll = () => shadowTableHandler.update();
449
+ scrollParent.addEventListener('mousemove', shadowTableHandler.update);
450
+ scrollParent.addEventListener('scroll', onScroll);
451
+ draggierEffects.push(() => {
452
+ scrollParent.removeEventListener('mousemove', shadowTableHandler.update);
453
+ scrollParent.removeEventListener('scroll', onScroll);
454
+ });
455
+
456
+ /*拖拽状态*/
457
+ staticState = {
458
+ dragData: broData,
459
+ broList: broList,
460
+ startClientX: startX,
461
+ moveClientX: startX,
462
+ scrollParent,
463
+ scrollRect: scrollParent.parentElement!.getBoundingClientRect(),
464
+ startScrollLeft: scrollParent.scrollLeft,
465
+ moveScrollLeft: scrollParent.scrollLeft,
466
+ indicator,
467
+ refreshData: null,
468
+ };
469
+ /*最后才能销毁拖拽状态*/
470
+ draggierEffects.push(() => {staticState = null;});
471
+
472
+ /*刷新定位*/
473
+ utils.refresh();
474
+ };
475
+ const update = (e?: MouseEvent) => {
476
+ if (!!e) {
477
+ const { clientX } = ClientZoom.getClientPosition(e);
478
+ staticState!.moveClientX = clientX;
479
+ } else {
480
+ staticState!.moveScrollLeft = staticState!.scrollParent!.scrollLeft;
481
+ }
482
+ utils.refresh();
483
+ };
484
+
485
+ return { start, update, get staticState() {return staticState;} };
486
+ })();
487
+
488
+ const handler = {
489
+ onMousedown: (e: iMouseEvent, plc: tPlcType) => {
490
+ if (e.button === 2) {return;}
491
+ shadowTableHandler.start(e, plc);
492
+
493
+ document.addEventListener('mousemove', shadowTableHandler.update);
494
+ document.addEventListener('mouseup', draggierEffects.clear);
495
+ draggierEffects.push(() => {
496
+ document.removeEventListener('mousemove', shadowTableHandler.update);
497
+ document.removeEventListener('mouseup', draggierEffects.clear);
498
+ });
499
+ },
500
+ };
501
+
502
+ const isDragging = shadowTableHandler.isDragging;
503
+
504
+ return { handler, isDragging };
505
+ }
506
+
507
+
508
+ interface iIndicatorDragData {
509
+ left: number;
510
+ width: number;
511
+ plc: tPlcType;
512
+ droppable: boolean;
513
+ }
514
+
515
+ const eIndicatorHoverPart = createEnum(['left', 'right'] as const);
516
+
517
+
518
+ /**
519
+ * 递归遍历plc数组数据
520
+ * @author 韦胜健
521
+ * @date 2020/9/6 11:24
522
+ */
523
+ function iteratePlc(plcList: tPlcType[], handler: (plc: tPlcType) => 'stop' | void): void {
524
+
525
+ for (let i = 0; i < plcList.length; i++) {
526
+ const item = plcList[i];
527
+ const flag = handler(item);
528
+ if (flag === 'stop') {
529
+ return;
530
+ } else {
531
+ if (item.group) {
532
+ iteratePlc(item.children, handler);
533
+ }
534
+ }
535
+ }
536
+
537
+ }
538
+
539
+ /**
540
+ * 或者plc对象的兄弟节点
541
+ * @author 韦胜健
542
+ * @date 2020/9/6 11:24
543
+ */
544
+ function getBroPlcList(plcList: tPlcType[], plc: tPlcType): tPlcType[] {
545
+
546
+ let broPlcList: tPlcType[] = [];
547
+
548
+ if (plcList.indexOf(plc) > -1) {
549
+ broPlcList = plcList;
550
+ } else {
551
+ iteratePlc(plcList, itarPlc => {
552
+ if (itarPlc.group) {
553
+ if (itarPlc.children.indexOf(plc) > -1) {
554
+ broPlcList = itarPlc.children;
555
+ return 'stop';
556
+ }
557
+ }
558
+ });
559
+ }
560
+
561
+ if (broPlcList.length === 0) {
562
+ /*内部错误,找不到兄弟节点*/
563
+ throw new Error('Internal error! sibling node not found.');
564
+ }
565
+
566
+ return broPlcList;
567
+ }
568
+
569
+ /**
570
+ * 获取plc的宽度
571
+ * @author 韦胜健
572
+ * @date 2020/9/6 12:09
573
+ */
574
+ function getPlcWidth(plc: tPlcType) {
575
+ if (!plc.group) {
576
+ return Number(plc.props.width);
577
+ } else {
578
+ return plc.children.reduce((ret: number, item: tPlcType) => {
579
+ ret += getPlcWidth(item);
580
+ return ret;
581
+ }, 0);
582
+ }
583
+ }
584
+
585
+ /**
586
+ * 获取plcList中最底层的plc
587
+ * @author 韦胜健
588
+ * @date 2020/9/6 20:27
589
+ */
590
+ function getLowestPlcList(plcList: tPlcType[]): tPlc[] {
591
+
592
+ return plcList.reduce((ret: tPlc[], plc: tPlcType) => {
593
+ if (plc.group) {
594
+ ret.push(...getLowestPlcList(plc.children));
595
+ } else {
596
+ ret.push(plc);
597
+ }
598
+ return ret;
599
+ }, [] as tPlc[]);
600
+
601
+ }
602
+
603
+ /**
604
+ * 获取拖拽所需要的数据
605
+ * @author 韦胜健
606
+ * @date 2020/9/6 20:41
607
+ */
608
+ function getDragData(plcList: tPlcType[], plc: tPlcType): {
609
+ broData: iIndicatorDragData[],
610
+ broList: tPlcType[]
611
+ } {
612
+
613
+ const broList = getBroPlcList(plcList, plc);
614
+
615
+ const broLowestList = getLowestPlcList(broList);
616
+ const allLowestList = getLowestPlcList(plcList) as tPlcType[];
617
+
618
+ allLowestList.splice(allLowestList.indexOf(broLowestList[0]), broLowestList.length, ...broList);
619
+
620
+ const broData: iIndicatorDragData[] = [];
621
+ let left = 0;
622
+
623
+ allLowestList.forEach(plc => {
624
+ const item = {
625
+ left,
626
+ width: getPlcWidth(plc),
627
+ plc,
628
+ droppable: broList.indexOf(plc) > -1
629
+ };
630
+ left += item.width;
631
+ broData.push(item);
632
+ });
633
+
634
+ return {
635
+ broList,
636
+ broData,
637
+ };
638
+
639
+ }