plain-design 1.0.0-beta.3 → 1.0.0-beta.5

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