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