@rockshin/tao-ui 0.0.59 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/component-manifest.json +1 -1
- package/dist/components/affix/affix.css +1 -1
- package/dist/components/affix/affix.d.ts +1 -0
- package/dist/components/affix/affix.js +18 -17
- package/dist/components/alert/alert.css +123 -119
- package/dist/components/alert/alert.js +78 -188
- package/dist/components/app/app-modals.js +49 -98
- package/dist/components/app/app-notices.d.ts +2 -2
- package/dist/components/app/app-notices.js +294 -243
- package/dist/components/app/app-types.d.ts +6 -3
- package/dist/components/app/app.css +185 -183
- package/dist/components/app/app.js +1 -1
- package/dist/components/auto-complete/auto-complete.css +30 -28
- package/dist/components/auto-complete/auto-complete.d.ts +3 -1
- package/dist/components/auto-complete/auto-complete.js +2 -1
- package/dist/components/badge/badge.js +42 -127
- package/dist/components/border-beam/border-beam.css +1 -1
- package/dist/components/border-beam/border-beam.d.ts +1 -0
- package/dist/components/border-beam/border-beam.js +1 -0
- package/dist/components/breadcrumb/breadcrumb.css +123 -120
- package/dist/components/breadcrumb/breadcrumb.js +160 -265
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +52 -151
- package/dist/components/calendar/calendar.js +28 -27
- package/dist/components/card/card-tabs.d.ts +56 -5
- package/dist/components/card/card-tabs.js +214 -468
- package/dist/components/card/card.d.ts +1 -2
- package/dist/components/card/card.js +64 -226
- package/dist/components/carousel/carousel.css +1 -1
- package/dist/components/carousel/carousel.d.ts +59 -4
- package/dist/components/carousel/carousel.js +299 -243
- package/dist/components/cascader/cascader.css +186 -184
- package/dist/components/cascader/cascader.d.ts +3 -1
- package/dist/components/cascader/cascader.js +29 -34
- package/dist/components/checkbox/checkbox.css +93 -90
- package/dist/components/checkbox/checkbox.d.ts +1 -1
- package/dist/components/checkbox/checkbox.js +171 -499
- package/dist/components/collapse/collapse-panels.js +145 -400
- package/dist/components/collapse/collapse.css +172 -170
- package/dist/components/collapse/collapse.d.ts +1 -1
- package/dist/components/collapse/collapse.js +62 -181
- package/dist/components/color-picker/color-picker.css +1 -1
- package/dist/components/color-picker/color-picker.js +418 -981
- package/dist/components/context-menu/context-menu.css +4 -4
- package/dist/components/context-menu/context-menu.d.ts +3 -1
- package/dist/components/context-menu/context-menu.js +54 -135
- package/dist/components/date-picker/calendar/calendar-grid.js +41 -41
- package/dist/components/date-picker/calendar/calendar-header.js +171 -337
- package/dist/components/date-picker/calendar/month-grid.js +33 -103
- package/dist/components/date-picker/calendar/time-panel.js +84 -209
- package/dist/components/date-picker/calendar/year-grid.js +36 -105
- package/dist/components/date-picker/date-localization.js +1 -1
- package/dist/components/date-picker/date-picker.css +599 -642
- package/dist/components/date-picker/date-picker.d.ts +2 -1
- package/dist/components/date-picker/date-picker.js +96 -105
- package/dist/components/date-picker/presets.js +12 -37
- package/dist/components/date-picker/range-picker.d.ts +2 -1
- package/dist/components/date-picker/range-picker.js +222 -255
- package/dist/components/date-picker/types.d.ts +2 -1
- package/dist/components/descriptions/descriptions.css +1 -1
- package/dist/components/descriptions/descriptions.js +30 -39
- package/dist/components/drawer/drawer.css +202 -200
- package/dist/components/drawer/drawer.js +28 -34
- package/dist/components/dropdown/dropdown-core.d.ts +32 -0
- package/dist/components/dropdown/dropdown-core.js +156 -0
- package/dist/components/dropdown/dropdown.css +38 -36
- package/dist/components/dropdown/dropdown.d.ts +4 -30
- package/dist/components/dropdown/dropdown.js +91 -271
- package/dist/components/empty/empty.css +30 -28
- package/dist/components/empty/empty.js +81 -236
- package/dist/components/float-button/float-button.css +1 -1
- package/dist/components/float-button/float-button.js +38 -48
- package/dist/components/form/field-control.js +2 -3
- package/dist/components/form/form-item.js +67 -129
- package/dist/components/form/form.css +36 -34
- package/dist/components/form/form.d.ts +1 -1
- package/dist/components/form/form.js +29 -100
- package/dist/components/form/index.d.ts +1 -1
- package/dist/components/form/use-form.js +48 -66
- package/dist/components/form-actions/form-actions.d.ts +1 -0
- package/dist/components/form-actions/form-actions.js +10 -36
- package/dist/components/form-field/form-field-view.d.ts +1 -0
- package/dist/components/form-field/form-field-view.js +81 -288
- package/dist/components/form-field/form-field.js +13 -31
- package/dist/components/form-field/form.css +74 -72
- package/dist/components/form-section/form-section.d.ts +1 -0
- package/dist/components/form-section/form-section.js +38 -91
- package/dist/components/image/image-icons.js +16 -31
- package/dist/components/image/image.css +1 -1
- package/dist/components/image/image.js +298 -911
- package/dist/components/input/base-input.d.ts +3 -1
- package/dist/components/input/base-input.js +8 -7
- package/dist/components/input/input-shared.css +62 -60
- package/dist/components/input/input-shared.d.ts +1 -1
- package/dist/components/input/input-shared.js +56 -100
- package/dist/components/input/input.css +222 -220
- package/dist/components/input/otp.d.ts +2 -1
- package/dist/components/input/otp.js +143 -324
- package/dist/components/input/password.js +12 -67
- package/dist/components/input/search.js +13 -13
- package/dist/components/input-number/input-number.d.ts +4 -2
- package/dist/components/input-number/input-number.js +30 -137
- package/dist/components/list/list-pagination.css +107 -105
- package/dist/components/list/list-pagination.d.ts +56 -5
- package/dist/components/list/list-pagination.js +249 -316
- package/dist/components/list/list.css +179 -177
- package/dist/components/list/list.js +170 -604
- package/dist/components/listy/listy.css +55 -53
- package/dist/components/listy/listy.d.ts +43 -4
- package/dist/components/listy/listy.js +198 -216
- package/dist/components/masonry/masonry.css +1 -1
- package/dist/components/masonry/masonry.d.ts +1 -0
- package/dist/components/masonry/masonry.js +90 -244
- package/dist/components/mentions/mentions.css +153 -151
- package/dist/components/mentions/mentions.d.ts +53 -11
- package/dist/components/mentions/mentions.js +291 -75
- package/dist/components/menu/menu-render.d.ts +7 -0
- package/dist/components/menu/menu-render.js +156 -302
- package/dist/components/menu/menu.css +142 -140
- package/dist/components/modal/confirm-dialog.js +19 -24
- package/dist/components/modal/modal.css +165 -162
- package/dist/components/modal/modal.js +285 -731
- package/dist/components/modal/use-modal.js +25 -25
- package/dist/components/pagination/pagination.css +134 -131
- package/dist/components/pagination/pagination.d.ts +4 -3
- package/dist/components/pagination/pagination.js +138 -281
- package/dist/components/popconfirm/popconfirm.css +38 -36
- package/dist/components/popconfirm/popconfirm.js +105 -288
- package/dist/components/popover/popover.css +89 -87
- package/dist/components/popover/popover.js +189 -469
- package/dist/components/progress/progress.css +153 -151
- package/dist/components/progress/progress.js +34 -43
- package/dist/components/qr-code/qr-code.css +36 -34
- package/dist/components/qr-code/qr-code.js +83 -277
- package/dist/components/radio/radio.css +95 -92
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +114 -376
- package/dist/components/rate/rate.css +80 -78
- package/dist/components/rate/rate.d.ts +34 -6
- package/dist/components/rate/rate.js +160 -244
- package/dist/components/result/result.css +59 -57
- package/dist/components/result/result.d.ts +1 -0
- package/dist/components/result/result.js +118 -291
- package/dist/components/scroll-area/scroll-area.css +160 -148
- package/dist/components/scroll-area/scroll-area.js +284 -488
- package/dist/components/segmented/segmented.css +1 -1
- package/dist/components/segmented/segmented.js +59 -58
- package/dist/components/select/mobile-select.css +166 -164
- package/dist/components/select/mobile-select.js +48 -131
- package/dist/components/select/select-icons.js +59 -128
- package/dist/components/select/select-model.js +1 -1
- package/dist/components/select/select-searchable-list.js +19 -19
- package/dist/components/select/select-tags.js +70 -156
- package/dist/components/select/select-types.d.ts +2 -1
- package/dist/components/select/select.css +509 -506
- package/dist/components/select/select.d.ts +1 -0
- package/dist/components/select/select.js +67 -65
- package/dist/components/select/use-select-selection.js +181 -261
- package/dist/components/skeleton/skeleton.css +105 -103
- package/dist/components/skeleton/skeleton.js +140 -399
- package/dist/components/slider/slider.css +160 -158
- package/dist/components/slider/slider.d.ts +45 -6
- package/dist/components/slider/slider.js +359 -74
- package/dist/components/sonner/index.d.ts +1 -1
- package/dist/components/sonner/sonner.css +190 -182
- package/dist/components/sonner/sonner.js +12 -11
- package/dist/components/spinner/spinner.css +80 -76
- package/dist/components/spinner/spinner.d.ts +1 -1
- package/dist/components/spinner/spinner.js +75 -219
- package/dist/components/splitter/splitter.css +157 -154
- package/dist/components/splitter/splitter.js +271 -448
- package/dist/components/statistic/statistic.css +1 -1
- package/dist/components/statistic/statistic.js +121 -406
- package/dist/components/status-icon/status-icon.js +14 -26
- package/dist/components/steps/steps-icons.js +63 -100
- package/dist/components/steps/steps.css +817 -807
- package/dist/components/steps/steps.d.ts +1 -1
- package/dist/components/steps/steps.js +38 -94
- package/dist/components/steps/use-display-steps.js +21 -54
- package/dist/components/switch/switch-touch.css +17 -15
- package/dist/components/switch/switch.css +192 -190
- package/dist/components/switch/switch.js +63 -196
- package/dist/components/table/table-filter.d.ts +3 -1
- package/dist/components/table/table-filter.js +72 -133
- package/dist/components/table/table-icons.js +77 -152
- package/dist/components/table/table-summary.js +30 -77
- package/dist/components/table/table-types.d.ts +2 -1
- package/dist/components/table/table.css +468 -465
- package/dist/components/table/table.js +86 -84
- package/dist/components/table/use-table-data.js +137 -248
- package/dist/components/tabs/tabs.css +123 -120
- package/dist/components/tabs/tabs.d.ts +4 -3
- package/dist/components/tabs/tabs.js +157 -322
- package/dist/components/tag/tag.css +231 -221
- package/dist/components/tag/tag.js +110 -248
- package/dist/components/textarea/textarea.css +2 -1
- package/dist/components/textarea/textarea.d.ts +3 -1
- package/dist/components/textarea/textarea.js +16 -15
- package/dist/components/time-picker/time-picker.d.ts +1 -0
- package/dist/components/time-picker/time-picker.js +91 -221
- package/dist/components/timeline/timeline.css +1 -1
- package/dist/components/timeline/timeline.js +17 -17
- package/dist/components/tooltip/tooltip.css +79 -77
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +111 -263
- package/dist/components/tour/tour.css +1 -1
- package/dist/components/tour/tour.d.ts +59 -6
- package/dist/components/tour/tour.js +343 -622
- package/dist/components/transfer/transfer-list.js +19 -19
- package/dist/components/transfer/transfer-parts.js +63 -139
- package/dist/components/transfer/transfer.css +192 -190
- package/dist/components/transfer/transfer.js +57 -56
- package/dist/components/tree/tree-check.js +25 -32
- package/dist/components/tree/tree-keyboard.js +1 -1
- package/dist/components/tree/tree.css +204 -200
- package/dist/components/tree/tree.js +139 -277
- package/dist/components/tree-select/select-engine.css +200 -197
- package/dist/components/tree-select/select-engine.js +11 -38
- package/dist/components/tree-select/tree-select.css +21 -19
- package/dist/components/tree-select/tree-select.d.ts +3 -1
- package/dist/components/tree-select/tree-select.js +12 -10
- package/dist/components/upload/upload.js +193 -308
- package/dist/components/watermark/watermark-context.js +8 -14
- package/dist/components/watermark/watermark.css +1 -1
- package/dist/components/watermark/watermark.js +209 -400
- package/dist/docs/components/stack.doc.js +1 -1
- package/dist/docs/components/table.doc.js +1 -1
- package/dist/entries/affix.d.ts +0 -2
- package/dist/entries/affix.js +0 -2
- package/dist/entries/alert.d.ts +0 -2
- package/dist/entries/alert.js +0 -2
- package/dist/entries/app.d.ts +0 -2
- package/dist/entries/app.js +0 -2
- package/dist/entries/auto-complete.d.ts +0 -2
- package/dist/entries/auto-complete.js +0 -2
- package/dist/entries/avatar.d.ts +0 -2
- package/dist/entries/avatar.js +0 -2
- package/dist/entries/badge.d.ts +0 -2
- package/dist/entries/badge.js +0 -2
- package/dist/entries/border-beam.d.ts +0 -2
- package/dist/entries/border-beam.js +0 -2
- package/dist/entries/breadcrumb.d.ts +0 -2
- package/dist/entries/breadcrumb.js +0 -2
- package/dist/entries/button.d.ts +0 -2
- package/dist/entries/button.js +0 -2
- package/dist/entries/calendar.d.ts +0 -2
- package/dist/entries/calendar.js +0 -2
- package/dist/entries/card.d.ts +0 -2
- package/dist/entries/card.js +0 -2
- package/dist/entries/carousel.d.ts +0 -2
- package/dist/entries/carousel.js +0 -2
- package/dist/entries/cascader.d.ts +0 -2
- package/dist/entries/cascader.js +0 -2
- package/dist/entries/checkbox.d.ts +0 -2
- package/dist/entries/checkbox.js +0 -2
- package/dist/entries/collapse.d.ts +0 -2
- package/dist/entries/collapse.js +0 -2
- package/dist/entries/color-picker.d.ts +0 -2
- package/dist/entries/color-picker.js +0 -2
- package/dist/entries/context-menu.d.ts +0 -2
- package/dist/entries/context-menu.js +0 -2
- package/dist/entries/date-picker.d.ts +0 -2
- package/dist/entries/date-picker.js +0 -2
- package/dist/entries/descriptions.d.ts +0 -2
- package/dist/entries/descriptions.js +0 -2
- package/dist/entries/divider.d.ts +0 -2
- package/dist/entries/divider.js +0 -2
- package/dist/entries/drawer.d.ts +0 -2
- package/dist/entries/drawer.js +0 -2
- package/dist/entries/dropdown.d.ts +0 -2
- package/dist/entries/dropdown.js +0 -2
- package/dist/entries/empty.d.ts +0 -2
- package/dist/entries/empty.js +0 -2
- package/dist/entries/float-button.d.ts +0 -2
- package/dist/entries/float-button.js +0 -2
- package/dist/entries/form-actions.d.ts +0 -2
- package/dist/entries/form-actions.js +0 -2
- package/dist/entries/form-field.d.ts +0 -2
- package/dist/entries/form-field.js +0 -2
- package/dist/entries/form-layout.d.ts +0 -2
- package/dist/entries/form-layout.js +0 -2
- package/dist/entries/form-section.d.ts +0 -2
- package/dist/entries/form-section.js +0 -2
- package/dist/entries/form.d.ts +1 -3
- package/dist/entries/form.js +0 -2
- package/dist/entries/image.d.ts +0 -2
- package/dist/entries/image.js +0 -2
- package/dist/entries/input-number.d.ts +0 -2
- package/dist/entries/input-number.js +0 -2
- package/dist/entries/input.d.ts +1 -3
- package/dist/entries/input.js +0 -2
- package/dist/entries/list.d.ts +0 -2
- package/dist/entries/list.js +0 -2
- package/dist/entries/listy.d.ts +0 -2
- package/dist/entries/listy.js +0 -2
- package/dist/entries/masonry.d.ts +0 -2
- package/dist/entries/masonry.js +0 -2
- package/dist/entries/mentions.d.ts +0 -2
- package/dist/entries/mentions.js +0 -2
- package/dist/entries/modal.d.ts +0 -2
- package/dist/entries/modal.js +0 -2
- package/dist/entries/number-input.d.ts +0 -2
- package/dist/entries/number-input.js +0 -2
- package/dist/entries/pagination.d.ts +0 -2
- package/dist/entries/pagination.js +0 -2
- package/dist/entries/popconfirm.d.ts +0 -2
- package/dist/entries/popconfirm.js +0 -2
- package/dist/entries/popover.d.ts +0 -2
- package/dist/entries/popover.js +0 -2
- package/dist/entries/progress.d.ts +0 -2
- package/dist/entries/progress.js +0 -2
- package/dist/entries/provider.d.ts +1 -3
- package/dist/entries/provider.js +1 -3
- package/dist/entries/qr-code.d.ts +0 -2
- package/dist/entries/qr-code.js +0 -2
- package/dist/entries/radio.d.ts +0 -2
- package/dist/entries/radio.js +0 -2
- package/dist/entries/range-picker.d.ts +0 -2
- package/dist/entries/range-picker.js +0 -2
- package/dist/entries/rate.d.ts +0 -2
- package/dist/entries/rate.js +0 -2
- package/dist/entries/result.d.ts +0 -2
- package/dist/entries/result.js +0 -2
- package/dist/entries/scroll-area.d.ts +0 -2
- package/dist/entries/scroll-area.js +0 -2
- package/dist/entries/segmented.d.ts +0 -2
- package/dist/entries/segmented.js +0 -2
- package/dist/entries/select.d.ts +0 -2
- package/dist/entries/select.js +0 -2
- package/dist/entries/skeleton.d.ts +0 -2
- package/dist/entries/skeleton.js +0 -2
- package/dist/entries/slider.d.ts +0 -2
- package/dist/entries/slider.js +0 -2
- package/dist/entries/sonner.d.ts +0 -2
- package/dist/entries/sonner.js +0 -2
- package/dist/entries/spinner.d.ts +0 -2
- package/dist/entries/spinner.js +0 -2
- package/dist/entries/splitter.d.ts +0 -2
- package/dist/entries/splitter.js +0 -2
- package/dist/entries/stack.d.ts +0 -2
- package/dist/entries/stack.js +0 -2
- package/dist/entries/statistic.d.ts +0 -2
- package/dist/entries/statistic.js +0 -2
- package/dist/entries/steps.d.ts +0 -2
- package/dist/entries/steps.js +0 -2
- package/dist/entries/switch.d.ts +0 -2
- package/dist/entries/switch.js +0 -2
- package/dist/entries/table.d.ts +0 -2
- package/dist/entries/table.js +0 -2
- package/dist/entries/tabs.d.ts +0 -2
- package/dist/entries/tabs.js +0 -2
- package/dist/entries/tag.d.ts +0 -2
- package/dist/entries/tag.js +0 -2
- package/dist/entries/textarea.d.ts +0 -2
- package/dist/entries/textarea.js +0 -2
- package/dist/entries/time-picker.d.ts +0 -2
- package/dist/entries/time-picker.js +0 -2
- package/dist/entries/timeline.d.ts +0 -2
- package/dist/entries/timeline.js +0 -2
- package/dist/entries/tooltip.d.ts +0 -2
- package/dist/entries/tooltip.js +0 -2
- package/dist/entries/tour.d.ts +0 -2
- package/dist/entries/tour.js +0 -2
- package/dist/entries/transfer.d.ts +0 -2
- package/dist/entries/transfer.js +0 -2
- package/dist/entries/tree-select.d.ts +0 -2
- package/dist/entries/tree-select.js +0 -2
- package/dist/entries/tree.d.ts +0 -2
- package/dist/entries/tree.js +0 -2
- package/dist/entries/upload.d.ts +0 -2
- package/dist/entries/upload.js +0 -2
- package/dist/entries/watermark.d.ts +0 -2
- package/dist/entries/watermark.js +0 -2
- package/dist/index.d.ts +5 -7
- package/dist/index.js +2 -4
- package/dist/layouts/form-layout/form-layout.d.ts +1 -0
- package/dist/layouts/form-layout/form-layout.js +10 -36
- package/dist/layouts/stack/layout.css +46 -44
- package/dist/layouts/stack/stack.d.ts +1 -0
- package/dist/layouts/stack/stack.js +16 -69
- package/dist/locales/ar-EG.js +25 -2
- package/dist/locales/create-locale.d.ts +1 -2
- package/dist/locales/create-locale.js +0 -28
- package/dist/locales/de-DE.js +25 -2
- package/dist/locales/en-US.js +24 -1
- package/dist/locales/es-ES.js +25 -2
- package/dist/locales/fr-FR.js +25 -2
- package/dist/locales/hi-IN.js +25 -2
- package/dist/locales/id-ID.js +25 -2
- package/dist/locales/index.d.ts +10 -10
- package/dist/locales/index.js +9 -9
- package/dist/locales/it-IT.js +25 -2
- package/dist/locales/ja-JP.js +25 -2
- package/dist/locales/ko-KR.js +25 -2
- package/dist/locales/pt-BR.js +25 -2
- package/dist/locales/ru-RU.js +25 -2
- package/dist/locales/th-TH.js +25 -2
- package/dist/locales/tr-TR.js +25 -2
- package/dist/locales/vi-VN.js +25 -2
- package/dist/locales/zh-CN.js +25 -2
- package/dist/locales/zh-TW.js +25 -2
- package/dist/number-input/number-input.js +24 -81
- package/dist/number-input/use-number-input.d.ts +1 -0
- package/dist/number-input/use-number-input.js +47 -43
- package/dist/provider/locale.d.ts +1 -1
- package/dist/provider/tao-context.d.ts +38 -0
- package/dist/provider/tao-context.js +92 -0
- package/dist/provider/tao-portal-scope.d.ts +14 -0
- package/dist/provider/tao-portal-scope.js +54 -0
- package/dist/provider/tao-provider.d.ts +5 -55
- package/dist/provider/tao-provider.js +94 -364
- package/dist/theme/control.css +106 -122
- package/dist/theme/theme.css +4 -2
- package/dist/utils/dialog-content.js +55 -210
- package/dist/utils/overlay.js +15 -30
- package/dist/utils/rc-compat.d.ts +13 -0
- package/dist/utils/rc-compat.js +48 -0
- package/dist/utils/refs.js +5 -19
- package/package.json +10 -16
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Children, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Children, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
3
|
import { useCommittedRef } from "../../utils/refs.js";
|
|
5
4
|
import { cx } from "../../utils/semantic.js";
|
|
6
5
|
import "./splitter.css";
|
|
@@ -53,470 +52,335 @@ function allocateSizes(panels, previous, available) {
|
|
|
53
52
|
}
|
|
54
53
|
return next;
|
|
55
54
|
}
|
|
56
|
-
function CollapseIcon(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
function CollapseIcon({ direction }) {
|
|
56
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
57
|
+
width: "12",
|
|
58
|
+
height: "12",
|
|
59
|
+
viewBox: "0 0 12 12",
|
|
60
|
+
fill: "none",
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
focusable: "false",
|
|
63
|
+
"data-tao-collapse-direction": direction,
|
|
64
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
62
65
|
d: "M7.5 2.5L4 6l3.5 3.5",
|
|
63
66
|
stroke: "currentColor",
|
|
64
67
|
strokeWidth: "1.5",
|
|
65
68
|
strokeLinecap: "round",
|
|
66
69
|
strokeLinejoin: "round"
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
} else t1 = $[0];
|
|
70
|
-
let t2;
|
|
71
|
-
if ($[1] !== direction) {
|
|
72
|
-
t2 = /*#__PURE__*/ jsx("svg", {
|
|
73
|
-
width: "12",
|
|
74
|
-
height: "12",
|
|
75
|
-
viewBox: "0 0 12 12",
|
|
76
|
-
fill: "none",
|
|
77
|
-
"aria-hidden": "true",
|
|
78
|
-
focusable: "false",
|
|
79
|
-
"data-tao-collapse-direction": direction,
|
|
80
|
-
children: t1
|
|
81
|
-
});
|
|
82
|
-
$[1] = direction;
|
|
83
|
-
$[2] = t2;
|
|
84
|
-
} else t2 = $[2];
|
|
85
|
-
return t2;
|
|
70
|
+
})
|
|
71
|
+
});
|
|
86
72
|
}
|
|
87
73
|
function Panel(_props) {
|
|
88
74
|
return null;
|
|
89
75
|
}
|
|
90
|
-
function Splitter(
|
|
91
|
-
const $ = c(82);
|
|
92
|
-
const { orientation: t1, onResize, onResizeEnd, onResizeStart, className, classNames, styles, children } = t0;
|
|
93
|
-
const orientation = void 0 === t1 ? "horizontal" : t1;
|
|
76
|
+
function Splitter({ orientation = 'horizontal', onResize, onResizeEnd, onResizeStart, className, classNames, styles, children }) {
|
|
94
77
|
const { locale } = useTaoConfig();
|
|
95
78
|
const containerRef = useRef(null);
|
|
96
|
-
|
|
97
|
-
if ($[0] !== children) {
|
|
79
|
+
const { panels, panelChildren } = useMemo(()=>{
|
|
98
80
|
const nextPanels = [];
|
|
99
81
|
const nextPanelChildren = [];
|
|
100
82
|
const childArray = Children.toArray(children);
|
|
101
|
-
for (const child of childArray)if (child &&
|
|
83
|
+
for (const child of childArray)if (child && 'object' == typeof child && 'type' in child) {
|
|
102
84
|
const panelChild = child;
|
|
103
85
|
if (panelChild.type === Panel && panelChild.props) {
|
|
104
86
|
nextPanels.push(panelChild.props);
|
|
105
87
|
nextPanelChildren.push(panelChild.props.children);
|
|
106
88
|
}
|
|
107
89
|
}
|
|
108
|
-
|
|
90
|
+
return {
|
|
109
91
|
panels: nextPanels,
|
|
110
92
|
panelChildren: nextPanelChildren
|
|
111
93
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const { panels, panelChildren } = t2;
|
|
94
|
+
}, [
|
|
95
|
+
children
|
|
96
|
+
]);
|
|
116
97
|
const panelCount = panels.length;
|
|
117
|
-
const isHorizontal =
|
|
118
|
-
|
|
119
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
120
|
-
t3 = [];
|
|
121
|
-
$[2] = t3;
|
|
122
|
-
} else t3 = $[2];
|
|
123
|
-
const [sizes, setSizes] = useState(t3);
|
|
98
|
+
const isHorizontal = 'horizontal' === orientation;
|
|
99
|
+
const [sizes, setSizes] = useState([]);
|
|
124
100
|
const [containerSize, setContainerSize] = useState(0);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
useEffect(t4, t5);
|
|
151
|
-
let t6;
|
|
152
|
-
let t7;
|
|
153
|
-
if ($[6] !== containerSize || $[7] !== panelCount || $[8] !== panels || $[9] !== sizes) {
|
|
154
|
-
t6 = ()=>{
|
|
155
|
-
if (containerSize <= 0 || 0 === panelCount) return;
|
|
156
|
-
const available = Math.max(0, containerSize - (panelCount - 1));
|
|
157
|
-
const next = allocateSizes(panels, sizes, available);
|
|
158
|
-
if (next.length !== sizes.length || next.some((size, i)=>Math.abs(size - sizes[i]) > 0.001)) setSizes(next);
|
|
159
|
-
};
|
|
160
|
-
t7 = [
|
|
161
|
-
containerSize,
|
|
162
|
-
panelCount,
|
|
163
|
-
panels,
|
|
164
|
-
sizes
|
|
165
|
-
];
|
|
166
|
-
$[6] = containerSize;
|
|
167
|
-
$[7] = panelCount;
|
|
168
|
-
$[8] = panels;
|
|
169
|
-
$[9] = sizes;
|
|
170
|
-
$[10] = t6;
|
|
171
|
-
$[11] = t7;
|
|
172
|
-
} else {
|
|
173
|
-
t6 = $[10];
|
|
174
|
-
t7 = $[11];
|
|
175
|
-
}
|
|
176
|
-
useEffect(t6, t7);
|
|
101
|
+
useEffect(()=>{
|
|
102
|
+
const el = containerRef.current;
|
|
103
|
+
if (!el) return;
|
|
104
|
+
const observer = new ResizeObserver((entries)=>{
|
|
105
|
+
const entry = entries[0];
|
|
106
|
+
if (!entry) return;
|
|
107
|
+
const total = isHorizontal ? entry.contentRect.width : entry.contentRect.height;
|
|
108
|
+
setContainerSize(total);
|
|
109
|
+
});
|
|
110
|
+
observer.observe(el);
|
|
111
|
+
return ()=>observer.disconnect();
|
|
112
|
+
}, [
|
|
113
|
+
isHorizontal
|
|
114
|
+
]);
|
|
115
|
+
useEffect(()=>{
|
|
116
|
+
if (containerSize <= 0 || 0 === panelCount) return;
|
|
117
|
+
const available = Math.max(0, containerSize - (panelCount - 1));
|
|
118
|
+
const next = allocateSizes(panels, sizes, available);
|
|
119
|
+
if (next.length !== sizes.length || next.some((size, i)=>Math.abs(size - sizes[i]) > 0.001)) setSizes(next);
|
|
120
|
+
}, [
|
|
121
|
+
containerSize,
|
|
122
|
+
panelCount,
|
|
123
|
+
panels,
|
|
124
|
+
sizes
|
|
125
|
+
]);
|
|
177
126
|
const activeDrag = useRef(null);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
127
|
+
useEffect(()=>()=>activeDrag.current?.cleanup(), [
|
|
128
|
+
orientation,
|
|
129
|
+
panelCount
|
|
130
|
+
]);
|
|
131
|
+
useEffect(()=>{
|
|
132
|
+
const drag = activeDrag.current;
|
|
133
|
+
if (drag && !canResizeBetween(panels, drag.index)) drag.cleanup();
|
|
134
|
+
}, [
|
|
135
|
+
panels
|
|
136
|
+
]);
|
|
137
|
+
const resizePanels = useCallback((index, delta, startSizes)=>{
|
|
138
|
+
const draggerSpace = (panelCount - 1) * 1;
|
|
139
|
+
const available = containerSize - draggerSpace;
|
|
140
|
+
const leftIdx = index;
|
|
141
|
+
const rightIdx = index + 1;
|
|
142
|
+
const leftMin = parseSize(panels[leftIdx].min, available) ?? 0;
|
|
143
|
+
const leftMax = parseSize(panels[leftIdx].max, available);
|
|
144
|
+
const rightMin = parseSize(panels[rightIdx].min, available) ?? 0;
|
|
145
|
+
const rightMax = parseSize(panels[rightIdx].max, available);
|
|
146
|
+
const total = startSizes[leftIdx] + startSizes[rightIdx];
|
|
147
|
+
let newLeft = startSizes[leftIdx] + delta;
|
|
148
|
+
newLeft = Math.max(newLeft, leftMin);
|
|
149
|
+
if (void 0 !== leftMax) newLeft = Math.min(newLeft, leftMax);
|
|
150
|
+
if (void 0 !== rightMin) newLeft = Math.min(newLeft, total - rightMin);
|
|
151
|
+
if (void 0 !== rightMax) newLeft = Math.max(newLeft, total - rightMax);
|
|
152
|
+
newLeft = Math.max(0, Math.min(newLeft, total));
|
|
153
|
+
const next = [
|
|
154
|
+
...startSizes
|
|
188
155
|
];
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
156
|
+
next[leftIdx] = newLeft;
|
|
157
|
+
next[rightIdx] = total - newLeft;
|
|
158
|
+
return next;
|
|
159
|
+
}, [
|
|
160
|
+
containerSize,
|
|
161
|
+
panelCount,
|
|
162
|
+
panels
|
|
163
|
+
]);
|
|
164
|
+
const dragSettings = useCommittedRef({
|
|
165
|
+
resizePanels,
|
|
166
|
+
onResize,
|
|
167
|
+
onResizeEnd
|
|
168
|
+
});
|
|
169
|
+
const handleDragStart = useCallback((index, e)=>{
|
|
170
|
+
if (0 !== e.button) return;
|
|
171
|
+
e.preventDefault();
|
|
172
|
+
activeDrag.current?.cleanup();
|
|
173
|
+
const pos = isHorizontal ? e.clientX : e.clientY;
|
|
174
|
+
const ownerDocument = e.currentTarget.ownerDocument;
|
|
175
|
+
const pointerId = e.pointerId;
|
|
176
|
+
const sign = isHorizontal && 'rtl' === getComputedStyle(containerRef.current).direction ? -1 : 1;
|
|
177
|
+
const startSizes = [
|
|
178
|
+
...sizes
|
|
203
179
|
];
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if ($[19] !== containerSize || $[20] !== panelCount || $[21] !== panels) {
|
|
214
|
-
t12 = (index, delta, startSizes)=>{
|
|
215
|
-
const draggerSpace = (panelCount - 1) * 1;
|
|
216
|
-
const available_0 = containerSize - draggerSpace;
|
|
217
|
-
const leftIdx = index;
|
|
218
|
-
const rightIdx = index + 1;
|
|
219
|
-
const leftMin = parseSize(panels[leftIdx].min, available_0) ?? 0;
|
|
220
|
-
const leftMax = parseSize(panels[leftIdx].max, available_0);
|
|
221
|
-
const rightMin = parseSize(panels[rightIdx].min, available_0) ?? 0;
|
|
222
|
-
const rightMax = parseSize(panels[rightIdx].max, available_0);
|
|
223
|
-
const total_0 = startSizes[leftIdx] + startSizes[rightIdx];
|
|
224
|
-
let newLeft = startSizes[leftIdx] + delta;
|
|
225
|
-
newLeft = Math.max(newLeft, leftMin);
|
|
226
|
-
if (void 0 !== leftMax) newLeft = Math.min(newLeft, leftMax);
|
|
227
|
-
if (void 0 !== rightMin) newLeft = Math.min(newLeft, total_0 - rightMin);
|
|
228
|
-
if (void 0 !== rightMax) newLeft = Math.max(newLeft, total_0 - rightMax);
|
|
229
|
-
newLeft = Math.max(0, Math.min(newLeft, total_0));
|
|
230
|
-
const next_0 = [
|
|
231
|
-
...startSizes
|
|
232
|
-
];
|
|
233
|
-
next_0[leftIdx] = newLeft;
|
|
234
|
-
next_0[rightIdx] = total_0 - newLeft;
|
|
235
|
-
return next_0;
|
|
236
|
-
};
|
|
237
|
-
$[19] = containerSize;
|
|
238
|
-
$[20] = panelCount;
|
|
239
|
-
$[21] = panels;
|
|
240
|
-
$[22] = t12;
|
|
241
|
-
} else t12 = $[22];
|
|
242
|
-
const resizePanels = t12;
|
|
243
|
-
let t13;
|
|
244
|
-
if ($[23] !== onResize || $[24] !== onResizeEnd || $[25] !== resizePanels) {
|
|
245
|
-
t13 = {
|
|
246
|
-
resizePanels,
|
|
247
|
-
onResize,
|
|
248
|
-
onResizeEnd
|
|
249
|
-
};
|
|
250
|
-
$[23] = onResize;
|
|
251
|
-
$[24] = onResizeEnd;
|
|
252
|
-
$[25] = resizePanels;
|
|
253
|
-
$[26] = t13;
|
|
254
|
-
} else t13 = $[26];
|
|
255
|
-
const dragSettings = useCommittedRef(t13);
|
|
256
|
-
let t14;
|
|
257
|
-
if ($[27] !== dragSettings || $[28] !== isHorizontal || $[29] !== onResizeStart || $[30] !== sizes) {
|
|
258
|
-
t14 = (index_0, e)=>{
|
|
259
|
-
if (0 !== e.button) return;
|
|
260
|
-
e.preventDefault();
|
|
261
|
-
activeDrag.current?.cleanup();
|
|
262
|
-
const pos = isHorizontal ? e.clientX : e.clientY;
|
|
263
|
-
const ownerDocument = e.currentTarget.ownerDocument;
|
|
264
|
-
const pointerId = e.pointerId;
|
|
265
|
-
const sign = isHorizontal && "rtl" === getComputedStyle(containerRef.current).direction ? -1 : 1;
|
|
266
|
-
const startSizes_0 = [
|
|
267
|
-
...sizes
|
|
268
|
-
];
|
|
269
|
-
let currentSizes = startSizes_0;
|
|
270
|
-
const handleMove = (ev)=>{
|
|
271
|
-
if (ev.pointerId !== pointerId) return;
|
|
272
|
-
const delta_0 = ((isHorizontal ? ev.clientX : ev.clientY) - pos) * sign;
|
|
273
|
-
const next_1 = dragSettings.current.resizePanels(index_0, delta_0, startSizes_0);
|
|
274
|
-
currentSizes = next_1;
|
|
275
|
-
setSizes(next_1);
|
|
276
|
-
dragSettings.current.onResize?.([
|
|
277
|
-
...next_1
|
|
278
|
-
]);
|
|
279
|
-
};
|
|
280
|
-
const cleanup = ()=>{
|
|
281
|
-
ownerDocument.removeEventListener("pointermove", handleMove);
|
|
282
|
-
ownerDocument.removeEventListener("pointerup", handleEnd);
|
|
283
|
-
ownerDocument.removeEventListener("pointercancel", handleEnd);
|
|
284
|
-
activeDrag.current = null;
|
|
285
|
-
};
|
|
286
|
-
const handleEnd = (ev_0)=>{
|
|
287
|
-
if (ev_0.pointerId !== pointerId) return;
|
|
288
|
-
cleanup();
|
|
289
|
-
dragSettings.current.onResizeEnd?.([
|
|
290
|
-
...currentSizes
|
|
291
|
-
]);
|
|
292
|
-
};
|
|
293
|
-
activeDrag.current = {
|
|
294
|
-
index: index_0,
|
|
295
|
-
cleanup
|
|
296
|
-
};
|
|
297
|
-
ownerDocument.addEventListener("pointermove", handleMove);
|
|
298
|
-
ownerDocument.addEventListener("pointerup", handleEnd);
|
|
299
|
-
ownerDocument.addEventListener("pointercancel", handleEnd);
|
|
300
|
-
onResizeStart?.([
|
|
301
|
-
...sizes
|
|
180
|
+
let currentSizes = startSizes;
|
|
181
|
+
const handleMove = (ev)=>{
|
|
182
|
+
if (ev.pointerId !== pointerId) return;
|
|
183
|
+
const delta = ((isHorizontal ? ev.clientX : ev.clientY) - pos) * sign;
|
|
184
|
+
const next = dragSettings.current.resizePanels(index, delta, startSizes);
|
|
185
|
+
currentSizes = next;
|
|
186
|
+
setSizes(next);
|
|
187
|
+
dragSettings.current.onResize?.([
|
|
188
|
+
...next
|
|
302
189
|
]);
|
|
303
190
|
};
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
} else t14 = $[31];
|
|
310
|
-
const handleDragStart = t14;
|
|
311
|
-
let t15;
|
|
312
|
-
if ($[32] !== isHorizontal || $[33] !== onResize || $[34] !== onResizeEnd || $[35] !== onResizeStart || $[36] !== resizePanels || $[37] !== sizes) {
|
|
313
|
-
t15 = (index_1, event)=>{
|
|
314
|
-
if (event.defaultPrevented || event.target !== event.currentTarget) return;
|
|
315
|
-
const rtl = "rtl" === getComputedStyle(event.currentTarget).direction;
|
|
316
|
-
const growKey = isHorizontal ? rtl ? "ArrowLeft" : "ArrowRight" : "ArrowDown";
|
|
317
|
-
const shrinkKey = isHorizontal ? rtl ? "ArrowRight" : "ArrowLeft" : "ArrowUp";
|
|
318
|
-
if (event.key !== growKey && event.key !== shrinkKey) return;
|
|
319
|
-
event.preventDefault();
|
|
320
|
-
const delta_1 = event.key === growKey ? 10 : -10;
|
|
321
|
-
const next_2 = resizePanels(index_1, delta_1, sizes);
|
|
322
|
-
if (next_2[index_1] === sizes[index_1] && next_2[index_1 + 1] === sizes[index_1 + 1]) return;
|
|
323
|
-
onResizeStart?.([
|
|
324
|
-
...sizes
|
|
325
|
-
]);
|
|
326
|
-
setSizes(next_2);
|
|
327
|
-
onResize?.([
|
|
328
|
-
...next_2
|
|
329
|
-
]);
|
|
330
|
-
onResizeEnd?.([
|
|
331
|
-
...next_2
|
|
332
|
-
]);
|
|
191
|
+
const cleanup = ()=>{
|
|
192
|
+
ownerDocument.removeEventListener('pointermove', handleMove);
|
|
193
|
+
ownerDocument.removeEventListener('pointerup', handleEnd);
|
|
194
|
+
ownerDocument.removeEventListener('pointercancel', handleEnd);
|
|
195
|
+
activeDrag.current = null;
|
|
333
196
|
};
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
$[37] = sizes;
|
|
340
|
-
$[38] = t15;
|
|
341
|
-
} else t15 = $[38];
|
|
342
|
-
const handleDraggerKeyDown = t15;
|
|
343
|
-
let t16;
|
|
344
|
-
if ($[39] !== containerSize || $[40] !== panelCount || $[41] !== panels || $[42] !== sizes) {
|
|
345
|
-
t16 = (index_2, direction)=>{
|
|
346
|
-
const draggerSpace_0 = (panelCount - 1) * 1;
|
|
347
|
-
const available_1 = containerSize - draggerSpace_0;
|
|
348
|
-
const targetIdx = "start" === direction ? index_2 : index_2 + 1;
|
|
349
|
-
const adjacentIdx = "start" === direction ? index_2 + 1 : index_2;
|
|
350
|
-
const next_3 = [
|
|
351
|
-
...sizes
|
|
352
|
-
];
|
|
353
|
-
const isCollapsed = next_3[targetIdx] <= 0;
|
|
354
|
-
const target = panels[targetIdx];
|
|
355
|
-
const adjacent = panels[adjacentIdx];
|
|
356
|
-
const adjacentMax = parseSize(adjacent.max, available_1);
|
|
357
|
-
if (isCollapsed) {
|
|
358
|
-
const adjacentMin = parseSize(adjacent.min, available_1) ?? 0;
|
|
359
|
-
const targetMin = parseSize(target.min, available_1) ?? 0;
|
|
360
|
-
const targetMax = parseSize(target.max, available_1) ?? 1 / 0;
|
|
361
|
-
const minTake = Math.max(targetMin, next_3[adjacentIdx] - (adjacentMax ?? 1 / 0));
|
|
362
|
-
const maxTake = Math.min(targetMax, next_3[adjacentIdx] - adjacentMin);
|
|
363
|
-
if (maxTake < minTake || maxTake <= 0) return;
|
|
364
|
-
const def = parseSize(target.defaultSize, available_1);
|
|
365
|
-
const expandTo = def && def > 0 ? def : available_1 / panelCount;
|
|
366
|
-
const take = Math.max(minTake, Math.min(expandTo, maxTake));
|
|
367
|
-
next_3[targetIdx] = take;
|
|
368
|
-
next_3[adjacentIdx] = next_3[adjacentIdx] - take;
|
|
369
|
-
} else {
|
|
370
|
-
if (void 0 !== adjacentMax && next_3[adjacentIdx] + next_3[targetIdx] > adjacentMax) return;
|
|
371
|
-
next_3[adjacentIdx] = next_3[adjacentIdx] + next_3[targetIdx];
|
|
372
|
-
next_3[targetIdx] = 0;
|
|
373
|
-
}
|
|
374
|
-
return next_3;
|
|
375
|
-
};
|
|
376
|
-
$[39] = containerSize;
|
|
377
|
-
$[40] = panelCount;
|
|
378
|
-
$[41] = panels;
|
|
379
|
-
$[42] = sizes;
|
|
380
|
-
$[43] = t16;
|
|
381
|
-
} else t16 = $[43];
|
|
382
|
-
const getCollapseSizes = t16;
|
|
383
|
-
let t17;
|
|
384
|
-
if ($[44] !== onResize || $[45] !== onResizeEnd) {
|
|
385
|
-
t17 = (next_4)=>{
|
|
386
|
-
setSizes(next_4);
|
|
387
|
-
onResize?.([
|
|
388
|
-
...next_4
|
|
389
|
-
]);
|
|
390
|
-
onResizeEnd?.([
|
|
391
|
-
...next_4
|
|
197
|
+
const handleEnd = (ev)=>{
|
|
198
|
+
if (ev.pointerId !== pointerId) return;
|
|
199
|
+
cleanup();
|
|
200
|
+
dragSettings.current.onResizeEnd?.([
|
|
201
|
+
...currentSizes
|
|
392
202
|
]);
|
|
393
203
|
};
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
204
|
+
activeDrag.current = {
|
|
205
|
+
index,
|
|
206
|
+
cleanup
|
|
207
|
+
};
|
|
208
|
+
ownerDocument.addEventListener('pointermove', handleMove);
|
|
209
|
+
ownerDocument.addEventListener('pointerup', handleEnd);
|
|
210
|
+
ownerDocument.addEventListener('pointercancel', handleEnd);
|
|
211
|
+
onResizeStart?.([
|
|
212
|
+
...sizes
|
|
213
|
+
]);
|
|
214
|
+
}, [
|
|
215
|
+
dragSettings,
|
|
216
|
+
isHorizontal,
|
|
217
|
+
onResizeStart,
|
|
218
|
+
sizes
|
|
219
|
+
]);
|
|
220
|
+
const handleDraggerKeyDown = useCallback((index, event)=>{
|
|
221
|
+
if (event.defaultPrevented || event.target !== event.currentTarget) return;
|
|
222
|
+
const rtl = 'rtl' === getComputedStyle(event.currentTarget).direction;
|
|
223
|
+
const growKey = isHorizontal ? rtl ? 'ArrowLeft' : 'ArrowRight' : 'ArrowDown';
|
|
224
|
+
const shrinkKey = isHorizontal ? rtl ? 'ArrowRight' : 'ArrowLeft' : 'ArrowUp';
|
|
225
|
+
if (event.key !== growKey && event.key !== shrinkKey) return;
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
const delta = event.key === growKey ? 10 : -10;
|
|
228
|
+
const next = resizePanels(index, delta, sizes);
|
|
229
|
+
if (next[index] === sizes[index] && next[index + 1] === sizes[index + 1]) return;
|
|
230
|
+
onResizeStart?.([
|
|
231
|
+
...sizes
|
|
232
|
+
]);
|
|
233
|
+
setSizes(next);
|
|
234
|
+
onResize?.([
|
|
235
|
+
...next
|
|
236
|
+
]);
|
|
237
|
+
onResizeEnd?.([
|
|
238
|
+
...next
|
|
239
|
+
]);
|
|
240
|
+
}, [
|
|
241
|
+
isHorizontal,
|
|
242
|
+
onResize,
|
|
243
|
+
onResizeEnd,
|
|
244
|
+
onResizeStart,
|
|
245
|
+
resizePanels,
|
|
246
|
+
sizes
|
|
247
|
+
]);
|
|
248
|
+
const getCollapseSizes = useCallback((index, direction)=>{
|
|
249
|
+
const draggerSpace = (panelCount - 1) * 1;
|
|
250
|
+
const available = containerSize - draggerSpace;
|
|
251
|
+
const targetIdx = 'start' === direction ? index : index + 1;
|
|
252
|
+
const adjacentIdx = 'start' === direction ? index + 1 : index;
|
|
253
|
+
const next = [
|
|
254
|
+
...sizes
|
|
255
|
+
];
|
|
256
|
+
const isCollapsed = next[targetIdx] <= 0;
|
|
257
|
+
const target = panels[targetIdx];
|
|
258
|
+
const adjacent = panels[adjacentIdx];
|
|
259
|
+
const adjacentMax = parseSize(adjacent.max, available);
|
|
260
|
+
if (isCollapsed) {
|
|
261
|
+
const adjacentMin = parseSize(adjacent.min, available) ?? 0;
|
|
262
|
+
const targetMin = parseSize(target.min, available) ?? 0;
|
|
263
|
+
const targetMax = parseSize(target.max, available) ?? 1 / 0;
|
|
264
|
+
const minTake = Math.max(targetMin, next[adjacentIdx] - (adjacentMax ?? 1 / 0));
|
|
265
|
+
const maxTake = Math.min(targetMax, next[adjacentIdx] - adjacentMin);
|
|
266
|
+
if (maxTake < minTake || maxTake <= 0) return;
|
|
267
|
+
const def = parseSize(target.defaultSize, available);
|
|
268
|
+
const expandTo = def && def > 0 ? def : available / panelCount;
|
|
269
|
+
const take = Math.max(minTake, Math.min(expandTo, maxTake));
|
|
270
|
+
next[targetIdx] = take;
|
|
271
|
+
next[adjacentIdx] -= take;
|
|
272
|
+
} else {
|
|
273
|
+
if (void 0 !== adjacentMax && next[adjacentIdx] + next[targetIdx] > adjacentMax) return;
|
|
274
|
+
next[adjacentIdx] += next[targetIdx];
|
|
275
|
+
next[targetIdx] = 0;
|
|
276
|
+
}
|
|
277
|
+
return next;
|
|
278
|
+
}, [
|
|
279
|
+
panelCount,
|
|
280
|
+
containerSize,
|
|
281
|
+
panels,
|
|
282
|
+
sizes
|
|
283
|
+
]);
|
|
284
|
+
const handleCollapse = (next)=>{
|
|
285
|
+
setSizes(next);
|
|
286
|
+
onResize?.([
|
|
287
|
+
...next
|
|
288
|
+
]);
|
|
289
|
+
onResizeEnd?.([
|
|
290
|
+
...next
|
|
291
|
+
]);
|
|
292
|
+
};
|
|
293
|
+
function getDraggerCollapse(index) {
|
|
294
|
+
const leftPanel = panels[index];
|
|
295
|
+
const rightPanel = panels[index + 1];
|
|
296
|
+
let startCollapsible = false;
|
|
297
|
+
let endCollapsible = false;
|
|
298
|
+
if (true === leftPanel.collapsible) startCollapsible = true;
|
|
299
|
+
else if ('object' == typeof leftPanel.collapsible) {
|
|
300
|
+
if (leftPanel.collapsible.end) startCollapsible = true;
|
|
301
|
+
}
|
|
302
|
+
if (true === rightPanel.collapsible) endCollapsible = true;
|
|
303
|
+
else if ('object' == typeof rightPanel.collapsible) {
|
|
304
|
+
if (rightPanel.collapsible.start) endCollapsible = true;
|
|
305
|
+
}
|
|
306
|
+
return {
|
|
307
|
+
start: startCollapsible,
|
|
308
|
+
end: endCollapsible
|
|
418
309
|
};
|
|
419
|
-
$[47] = panels;
|
|
420
|
-
$[48] = t18;
|
|
421
|
-
} else t18 = $[48];
|
|
422
|
-
const getDraggerCollapse = t18;
|
|
423
|
-
if (sizes.length !== panelCount) {
|
|
424
|
-
const t19 = classNames?.root;
|
|
425
|
-
let t20;
|
|
426
|
-
if ($[49] !== className || $[50] !== t19) {
|
|
427
|
-
t20 = cx(t19, className);
|
|
428
|
-
$[49] = className;
|
|
429
|
-
$[50] = t19;
|
|
430
|
-
$[51] = t20;
|
|
431
|
-
} else t20 = $[51];
|
|
432
|
-
const t21 = styles?.root;
|
|
433
|
-
let t22;
|
|
434
|
-
if ($[52] !== orientation || $[53] !== t20 || $[54] !== t21) {
|
|
435
|
-
t22 = /*#__PURE__*/ jsx("div", {
|
|
436
|
-
ref: containerRef,
|
|
437
|
-
"data-tao-splitter": "",
|
|
438
|
-
"data-tao-orientation": orientation,
|
|
439
|
-
className: t20,
|
|
440
|
-
style: t21
|
|
441
|
-
});
|
|
442
|
-
$[52] = orientation;
|
|
443
|
-
$[53] = t20;
|
|
444
|
-
$[54] = t21;
|
|
445
|
-
$[55] = t22;
|
|
446
|
-
} else t22 = $[55];
|
|
447
|
-
return t22;
|
|
448
310
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
311
|
+
if (sizes.length !== panelCount) return /*#__PURE__*/ jsx("div", {
|
|
312
|
+
ref: containerRef,
|
|
313
|
+
"data-tao-splitter": "",
|
|
314
|
+
"data-tao-orientation": orientation,
|
|
315
|
+
className: cx(classNames?.root, className),
|
|
316
|
+
style: styles?.root
|
|
317
|
+
});
|
|
318
|
+
return /*#__PURE__*/ jsx("div", {
|
|
319
|
+
ref: containerRef,
|
|
320
|
+
"data-tao-splitter": "",
|
|
321
|
+
"data-tao-orientation": orientation,
|
|
322
|
+
className: cx(classNames?.root, className),
|
|
323
|
+
style: styles?.root,
|
|
324
|
+
children: panels.map((panel, i)=>{
|
|
461
325
|
const sizeStyle = isHorizontal ? {
|
|
462
|
-
width: sizes[
|
|
326
|
+
width: sizes[i],
|
|
463
327
|
flexShrink: 0,
|
|
464
328
|
flexGrow: 0
|
|
465
329
|
} : {
|
|
466
|
-
height: sizes[
|
|
330
|
+
height: sizes[i],
|
|
467
331
|
flexShrink: 0,
|
|
468
332
|
flexGrow: 0
|
|
469
333
|
};
|
|
470
|
-
const
|
|
471
|
-
const draggerResizable = canResizeBetween(panels,
|
|
472
|
-
const
|
|
473
|
-
const pairSize = sizes[
|
|
474
|
-
const nextMin = parseSize(panels[
|
|
475
|
-
const nextMax = parseSize(panels[
|
|
476
|
-
const valueMin = Math.max(parseSize(panel.min,
|
|
477
|
-
const valueMax = Math.min(parseSize(panel.max,
|
|
334
|
+
const isCollapsed = sizes[i] <= 0;
|
|
335
|
+
const draggerResizable = canResizeBetween(panels, i);
|
|
336
|
+
const available = containerSize - (panelCount - 1);
|
|
337
|
+
const pairSize = sizes[i] + (sizes[i + 1] ?? 0);
|
|
338
|
+
const nextMin = parseSize(panels[i + 1]?.min, available) ?? 0;
|
|
339
|
+
const nextMax = parseSize(panels[i + 1]?.max, available) ?? pairSize;
|
|
340
|
+
const valueMin = Math.max(parseSize(panel.min, available) ?? 0, pairSize - nextMax);
|
|
341
|
+
const valueMax = Math.min(parseSize(panel.max, available) ?? pairSize, pairSize - nextMin);
|
|
478
342
|
return /*#__PURE__*/ jsxs("div", {
|
|
479
343
|
style: {
|
|
480
|
-
display:
|
|
344
|
+
display: 'contents'
|
|
481
345
|
},
|
|
482
346
|
children: [
|
|
483
347
|
/*#__PURE__*/ jsx("div", {
|
|
484
348
|
"data-tao-splitter-panel": "",
|
|
485
|
-
"data-tao-collapsed":
|
|
349
|
+
"data-tao-collapsed": isCollapsed || void 0,
|
|
486
350
|
className: cx(classNames?.panel, panel.className),
|
|
487
351
|
style: {
|
|
488
352
|
...sizeStyle,
|
|
489
353
|
...styles?.panel,
|
|
490
354
|
...panel.style
|
|
491
355
|
},
|
|
492
|
-
children: panelChildren[
|
|
356
|
+
children: panelChildren[i]
|
|
493
357
|
}),
|
|
494
|
-
|
|
358
|
+
i < panelCount - 1 && /*#__PURE__*/ jsxs("div", {
|
|
495
359
|
"data-tao-splitter-dragger": "",
|
|
496
360
|
"data-tao-orientation": orientation,
|
|
497
361
|
role: "separator",
|
|
498
|
-
"aria-label": locale.messages.resizePanels(
|
|
499
|
-
"aria-orientation": isHorizontal ?
|
|
500
|
-
"aria-valuemin": Math.round(Math.min(valueMin, sizes[
|
|
501
|
-
"aria-valuemax": Math.round(Math.max(valueMax, sizes[
|
|
502
|
-
"aria-valuenow": Math.round(sizes[
|
|
362
|
+
"aria-label": locale.messages.resizePanels(i + 1, i + 2),
|
|
363
|
+
"aria-orientation": isHorizontal ? 'vertical' : 'horizontal',
|
|
364
|
+
"aria-valuemin": Math.round(Math.min(valueMin, sizes[i])),
|
|
365
|
+
"aria-valuemax": Math.round(Math.max(valueMax, sizes[i])),
|
|
366
|
+
"aria-valuenow": Math.round(sizes[i]),
|
|
503
367
|
tabIndex: draggerResizable ? 0 : void 0,
|
|
504
368
|
className: cx(classNames?.dragger),
|
|
505
369
|
style: styles?.dragger,
|
|
506
|
-
onPointerDown: (
|
|
507
|
-
if (draggerResizable) handleDragStart(
|
|
370
|
+
onPointerDown: (e)=>{
|
|
371
|
+
if (draggerResizable) handleDragStart(i, e);
|
|
508
372
|
},
|
|
509
|
-
onKeyDown: (
|
|
510
|
-
if (draggerResizable) handleDraggerKeyDown(
|
|
373
|
+
onKeyDown: (event)=>{
|
|
374
|
+
if (draggerResizable) handleDraggerKeyDown(i, event);
|
|
511
375
|
},
|
|
512
376
|
children: [
|
|
513
377
|
/*#__PURE__*/ jsx("div", {
|
|
514
378
|
"data-tao-splitter-dragger-bar": ""
|
|
515
379
|
}),
|
|
516
380
|
(()=>{
|
|
517
|
-
const { start, end } = getDraggerCollapse(
|
|
518
|
-
const
|
|
519
|
-
const endSizes = end ? getCollapseSizes(
|
|
381
|
+
const { start, end } = getDraggerCollapse(i);
|
|
382
|
+
const startSizes = start ? getCollapseSizes(i, 'start') : void 0;
|
|
383
|
+
const endSizes = end ? getCollapseSizes(i, 'end') : void 0;
|
|
520
384
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
521
385
|
children: [
|
|
522
386
|
start && /*#__PURE__*/ jsx("button", {
|
|
@@ -525,11 +389,11 @@ function Splitter(t0) {
|
|
|
525
389
|
"data-tao-collapse-direction": "start",
|
|
526
390
|
"data-tao-orientation": orientation,
|
|
527
391
|
"aria-label": locale.messages.collapsePanel,
|
|
528
|
-
disabled: !
|
|
529
|
-
onPointerDown:
|
|
530
|
-
onClick: ()=>
|
|
392
|
+
disabled: !startSizes,
|
|
393
|
+
onPointerDown: (event)=>event.stopPropagation(),
|
|
394
|
+
onClick: ()=>startSizes && handleCollapse(startSizes),
|
|
531
395
|
children: /*#__PURE__*/ jsx(CollapseIcon, {
|
|
532
|
-
direction: sizes[
|
|
396
|
+
direction: sizes[i] <= 0 ? 'end' : 'start',
|
|
533
397
|
orientation: orientation
|
|
534
398
|
})
|
|
535
399
|
}),
|
|
@@ -540,10 +404,10 @@ function Splitter(t0) {
|
|
|
540
404
|
"data-tao-orientation": orientation,
|
|
541
405
|
"aria-label": locale.messages.collapsePanel,
|
|
542
406
|
disabled: !endSizes,
|
|
543
|
-
onPointerDown:
|
|
407
|
+
onPointerDown: (event)=>event.stopPropagation(),
|
|
544
408
|
onClick: ()=>endSizes && handleCollapse(endSizes),
|
|
545
409
|
children: /*#__PURE__*/ jsx(CollapseIcon, {
|
|
546
|
-
direction: sizes[
|
|
410
|
+
direction: sizes[i + 1] <= 0 ? 'start' : 'end',
|
|
547
411
|
orientation: orientation
|
|
548
412
|
})
|
|
549
413
|
})
|
|
@@ -553,50 +417,9 @@ function Splitter(t0) {
|
|
|
553
417
|
]
|
|
554
418
|
})
|
|
555
419
|
]
|
|
556
|
-
},
|
|
557
|
-
})
|
|
558
|
-
|
|
559
|
-
$[60] = classNames?.panel;
|
|
560
|
-
$[61] = containerSize;
|
|
561
|
-
$[62] = getCollapseSizes;
|
|
562
|
-
$[63] = getDraggerCollapse;
|
|
563
|
-
$[64] = handleCollapse;
|
|
564
|
-
$[65] = handleDragStart;
|
|
565
|
-
$[66] = handleDraggerKeyDown;
|
|
566
|
-
$[67] = isHorizontal;
|
|
567
|
-
$[68] = locale;
|
|
568
|
-
$[69] = orientation;
|
|
569
|
-
$[70] = panelChildren;
|
|
570
|
-
$[71] = panelCount;
|
|
571
|
-
$[72] = panels;
|
|
572
|
-
$[73] = sizes;
|
|
573
|
-
$[74] = styles?.dragger;
|
|
574
|
-
$[75] = styles?.panel;
|
|
575
|
-
$[76] = t22;
|
|
576
|
-
} else t22 = $[76];
|
|
577
|
-
let t23;
|
|
578
|
-
if ($[77] !== orientation || $[78] !== t20 || $[79] !== t21 || $[80] !== t22) {
|
|
579
|
-
t23 = /*#__PURE__*/ jsx("div", {
|
|
580
|
-
ref: containerRef,
|
|
581
|
-
"data-tao-splitter": "",
|
|
582
|
-
"data-tao-orientation": orientation,
|
|
583
|
-
className: t20,
|
|
584
|
-
style: t21,
|
|
585
|
-
children: t22
|
|
586
|
-
});
|
|
587
|
-
$[77] = orientation;
|
|
588
|
-
$[78] = t20;
|
|
589
|
-
$[79] = t21;
|
|
590
|
-
$[80] = t22;
|
|
591
|
-
$[81] = t23;
|
|
592
|
-
} else t23 = $[81];
|
|
593
|
-
return t23;
|
|
594
|
-
}
|
|
595
|
-
function _temp2(event_2) {
|
|
596
|
-
return event_2.stopPropagation();
|
|
597
|
-
}
|
|
598
|
-
function _temp(event_1) {
|
|
599
|
-
return event_1.stopPropagation();
|
|
420
|
+
}, i);
|
|
421
|
+
})
|
|
422
|
+
});
|
|
600
423
|
}
|
|
601
424
|
Splitter.Panel = Panel;
|
|
602
425
|
export { Panel, Splitter };
|