taro-uno-ui 1.0.1 → 1.0.2
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 +67 -30
- package/dist/js/{index-CDFsvu80.js → index-QpKiGsEQ.js} +39026 -28023
- package/dist/js/index-QpKiGsEQ.js.map +1 -0
- package/dist/js/{index-JffnTUrv.js → index-nnTHNhwl.js} +38743 -27720
- package/dist/js/index-nnTHNhwl.js.map +1 -0
- package/package.json +4 -4
- package/dist/js/index-CDFsvu80.js.map +0 -1
- package/dist/js/index-DFdcksbe.js +0 -1165
- package/dist/js/index-DFdcksbe.js.map +0 -1
- package/dist/js/index-DXRIkWX1.js +0 -1148
- package/dist/js/index-DXRIkWX1.js.map +0 -1
- package/dist/js/index-JffnTUrv.js.map +0 -1
- package/dist/utils/http/request.d.ts +0 -280
- package/src/app.config.ts +0 -55
- package/src/app.scss +0 -508
- package/src/app.tsx +0 -44
- package/src/components/basic/Button/Button.styles.ts +0 -130
- package/src/components/basic/Button/Button.test.tsx +0 -154
- package/src/components/basic/Button/Button.tsx +0 -133
- package/src/components/basic/Button/Button.types.ts +0 -81
- package/src/components/basic/Button/index.tsx +0 -6
- package/src/components/basic/Divider/Divider.styles.ts +0 -488
- package/src/components/basic/Divider/Divider.test.tsx +0 -551
- package/src/components/basic/Divider/Divider.tsx +0 -392
- package/src/components/basic/Divider/Divider.types.ts +0 -261
- package/src/components/basic/Divider/index.tsx +0 -25
- package/src/components/basic/Icon/Icon.data.ts +0 -474
- package/src/components/basic/Icon/Icon.styles.ts +0 -359
- package/src/components/basic/Icon/Icon.test.tsx +0 -357
- package/src/components/basic/Icon/Icon.tsx +0 -167
- package/src/components/basic/Icon/Icon.types.ts +0 -210
- package/src/components/basic/Icon/IconManager.ts +0 -229
- package/src/components/basic/Icon/index.tsx +0 -22
- package/src/components/basic/Text/Text.styles.ts +0 -500
- package/src/components/basic/Text/Text.test.tsx +0 -299
- package/src/components/basic/Text/Text.tsx +0 -340
- package/src/components/basic/Text/Text.types.ts +0 -329
- package/src/components/basic/Text/index.tsx +0 -27
- package/src/components/basic/Typography/Typography.styles.ts +0 -347
- package/src/components/basic/Typography/Typography.tsx +0 -207
- package/src/components/basic/Typography/Typography.types.ts +0 -296
- package/src/components/basic/Typography/index.tsx +0 -14
- package/src/components/basic/Video/Video.styles.ts +0 -777
- package/src/components/basic/Video/Video.test.tsx +0 -490
- package/src/components/basic/Video/Video.tsx +0 -1468
- package/src/components/basic/Video/Video.types.ts +0 -500
- package/src/components/basic/Video/index.tsx +0 -26
- package/src/components/basic/index.tsx +0 -300
- package/src/components/common/ErrorBoundary.tsx +0 -87
- package/src/components/common/LazyComponent.tsx +0 -247
- package/src/components/common/ResponsiveContainer.tsx +0 -93
- package/src/components/common/ResponsiveGrid.tsx +0 -183
- package/src/components/common/SecurityProvider.tsx +0 -98
- package/src/components/common/ThemeProvider.tsx +0 -115
- package/src/components/common/VirtualList.tsx +0 -350
- package/src/components/common/__tests__/ErrorBoundary.test.tsx +0 -249
- package/src/components/common/index.tsx +0 -32
- package/src/components/display/Avatar/Avatar.styles.ts +0 -62
- package/src/components/display/Avatar/Avatar.test.tsx +0 -390
- package/src/components/display/Avatar/Avatar.tsx +0 -66
- package/src/components/display/Avatar/Avatar.types.ts +0 -40
- package/src/components/display/Avatar/index.ts +0 -3
- package/src/components/display/Badge/Badge.tsx +0 -29
- package/src/components/display/Badge/Badge.types.ts +0 -29
- package/src/components/display/Badge/index.ts +0 -2
- package/src/components/display/Calendar/Calendar.styles.ts +0 -255
- package/src/components/display/Calendar/Calendar.test.tsx +0 -42
- package/src/components/display/Calendar/Calendar.tsx +0 -358
- package/src/components/display/Calendar/Calendar.types.ts +0 -91
- package/src/components/display/Calendar/index.ts +0 -3
- package/src/components/display/Card/Card.styles.ts +0 -89
- package/src/components/display/Card/Card.test.tsx +0 -182
- package/src/components/display/Card/Card.tsx +0 -135
- package/src/components/display/Card/Card.types.ts +0 -55
- package/src/components/display/Card/index.ts +0 -3
- package/src/components/display/Carousel/Carousel.styles.ts +0 -206
- package/src/components/display/Carousel/Carousel.tsx +0 -290
- package/src/components/display/Carousel/Carousel.types.ts +0 -57
- package/src/components/display/Carousel/index.ts +0 -3
- package/src/components/display/List/List.styles.ts +0 -79
- package/src/components/display/List/List.tsx +0 -114
- package/src/components/display/List/List.types.ts +0 -68
- package/src/components/display/List/index.ts +0 -3
- package/src/components/display/Rate/Rate.styles.ts +0 -254
- package/src/components/display/Rate/Rate.tsx +0 -324
- package/src/components/display/Rate/Rate.types.ts +0 -112
- package/src/components/display/Rate/index.ts +0 -20
- package/src/components/display/Table/Table.styles.ts +0 -269
- package/src/components/display/Table/Table.test.tsx +0 -345
- package/src/components/display/Table/Table.tsx +0 -426
- package/src/components/display/Table/Table.types.ts +0 -256
- package/src/components/display/Table/index.tsx +0 -16
- package/src/components/display/Tag/Tag.styles.ts +0 -197
- package/src/components/display/Tag/Tag.test.tsx +0 -541
- package/src/components/display/Tag/Tag.tsx +0 -139
- package/src/components/display/Tag/Tag.types.ts +0 -49
- package/src/components/display/Tag/index.ts +0 -3
- package/src/components/display/Timeline/Timeline.styles.ts +0 -211
- package/src/components/display/Timeline/Timeline.tsx +0 -220
- package/src/components/display/Timeline/Timeline.types.ts +0 -56
- package/src/components/display/Timeline/index.ts +0 -3
- package/src/components/display/index.tsx +0 -147
- package/src/components/feedback/Loading/Loading.styles.ts +0 -117
- package/src/components/feedback/Loading/Loading.test.tsx +0 -534
- package/src/components/feedback/Loading/Loading.tsx +0 -132
- package/src/components/feedback/Loading/Loading.types.ts +0 -33
- package/src/components/feedback/Loading/index.ts +0 -6
- package/src/components/feedback/Message/Message.styles.ts +0 -41
- package/src/components/feedback/Message/Message.test.tsx +0 -234
- package/src/components/feedback/Message/Message.tsx +0 -96
- package/src/components/feedback/Message/Message.types.ts +0 -37
- package/src/components/feedback/Message/index.ts +0 -6
- package/src/components/feedback/Modal/Modal.styles.ts +0 -21
- package/src/components/feedback/Modal/Modal.test.tsx +0 -11
- package/src/components/feedback/Modal/Modal.tsx +0 -269
- package/src/components/feedback/Modal/Modal.types.ts +0 -151
- package/src/components/feedback/Modal/index.tsx +0 -11
- package/src/components/feedback/Notification/Notification.styles.ts +0 -453
- package/src/components/feedback/Notification/Notification.test.tsx +0 -401
- package/src/components/feedback/Notification/Notification.tsx +0 -347
- package/src/components/feedback/Notification/Notification.types.ts +0 -339
- package/src/components/feedback/Notification/NotificationManager.tsx +0 -405
- package/src/components/feedback/Notification/index.ts +0 -40
- package/src/components/feedback/Notification/index.tsx +0 -154
- package/src/components/feedback/Progress/Progress.styles.ts +0 -469
- package/src/components/feedback/Progress/Progress.test.simple.tsx +0 -14
- package/src/components/feedback/Progress/Progress.test.tsx +0 -312
- package/src/components/feedback/Progress/Progress.tsx +0 -488
- package/src/components/feedback/Progress/Progress.types.ts +0 -163
- package/src/components/feedback/Progress/index.ts +0 -3
- package/src/components/feedback/Progress/index.tsx +0 -38
- package/src/components/feedback/Progress/utils/animation.ts +0 -193
- package/src/components/feedback/Progress/utils/index.ts +0 -26
- package/src/components/feedback/Progress/utils/progress-calculator.ts +0 -199
- package/src/components/feedback/Result/Result.styles.ts +0 -139
- package/src/components/feedback/Result/Result.tsx +0 -221
- package/src/components/feedback/Result/Result.types.ts +0 -128
- package/src/components/feedback/Result/index.tsx +0 -3
- package/src/components/feedback/Toast/Toast.styles.ts +0 -17
- package/src/components/feedback/Toast/Toast.test.tsx +0 -10
- package/src/components/feedback/Toast/Toast.tsx +0 -384
- package/src/components/feedback/Toast/Toast.types.ts +0 -86
- package/src/components/feedback/Toast/index.tsx +0 -3
- package/src/components/feedback/Tooltip/Tooltip.examples.tsx +0 -435
- package/src/components/feedback/Tooltip/Tooltip.styles.ts +0 -340
- package/src/components/feedback/Tooltip/Tooltip.test.tsx +0 -446
- package/src/components/feedback/Tooltip/Tooltip.tsx +0 -302
- package/src/components/feedback/Tooltip/Tooltip.types.ts +0 -166
- package/src/components/feedback/Tooltip/index.ts +0 -3
- package/src/components/feedback/Tooltip/index.tsx +0 -246
- package/src/components/feedback/index.tsx +0 -176
- package/src/components/form/Cascader/Cascader.styles.ts +0 -526
- package/src/components/form/Cascader/Cascader.test.tsx +0 -77
- package/src/components/form/Cascader/Cascader.tsx +0 -581
- package/src/components/form/Cascader/Cascader.types.ts +0 -581
- package/src/components/form/Cascader/hooks/index.ts +0 -3
- package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +0 -19
- package/src/components/form/Cascader/hooks/useCascaderOptions.ts +0 -127
- package/src/components/form/Cascader/hooks/useCascaderState.ts +0 -139
- package/src/components/form/Cascader/index.ts +0 -25
- package/src/components/form/Cascader/utils/formatDisplayValue.ts +0 -19
- package/src/components/form/Cascader/utils/index.ts +0 -1
- package/src/components/form/Checkbox/Checkbox.styles.ts +0 -607
- package/src/components/form/Checkbox/Checkbox.test.tsx +0 -1140
- package/src/components/form/Checkbox/Checkbox.tsx +0 -489
- package/src/components/form/Checkbox/Checkbox.types.ts +0 -472
- package/src/components/form/Checkbox/CheckboxGroup.tsx +0 -444
- package/src/components/form/Checkbox/index.tsx +0 -27
- package/src/components/form/DatePicker/DatePicker.styles.ts +0 -393
- package/src/components/form/DatePicker/DatePicker.test.tsx +0 -407
- package/src/components/form/DatePicker/DatePicker.tsx +0 -376
- package/src/components/form/DatePicker/DatePicker.types.ts +0 -250
- package/src/components/form/DatePicker/index.tsx +0 -15
- package/src/components/form/Form/Form.styles.ts +0 -357
- package/src/components/form/Form/Form.test.tsx +0 -122
- package/src/components/form/Form/Form.tsx +0 -257
- package/src/components/form/Form/Form.types.ts +0 -422
- package/src/components/form/Form/index.tsx +0 -31
- package/src/components/form/Form/useFormLogic.ts +0 -497
- package/src/components/form/Input/Input.styles.ts +0 -445
- package/src/components/form/Input/Input.test.tsx +0 -494
- package/src/components/form/Input/Input.tsx +0 -305
- package/src/components/form/Input/Input.types.ts +0 -297
- package/src/components/form/Input/index.tsx +0 -26
- package/src/components/form/Input/useInputLogic.test.ts +0 -82
- package/src/components/form/Input/useInputLogic.ts +0 -260
- package/src/components/form/InputNumber/InputNumber.styles.ts +0 -716
- package/src/components/form/InputNumber/InputNumber.tsx +0 -402
- package/src/components/form/InputNumber/InputNumber.types.ts +0 -336
- package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +0 -24
- package/src/components/form/InputNumber/components/InputNumberControls.tsx +0 -33
- package/src/components/form/InputNumber/components/index.ts +0 -2
- package/src/components/form/InputNumber/hooks/index.ts +0 -4
- package/src/components/form/InputNumber/hooks/useInputNumberState.ts +0 -313
- package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +0 -148
- package/src/components/form/InputNumber/index.ts +0 -25
- package/src/components/form/Radio/Radio.styles.ts +0 -451
- package/src/components/form/Radio/Radio.test.tsx +0 -547
- package/src/components/form/Radio/Radio.tsx +0 -277
- package/src/components/form/Radio/Radio.types.ts +0 -414
- package/src/components/form/Radio/index.tsx +0 -21
- package/src/components/form/Select/Select.styles.ts +0 -518
- package/src/components/form/Select/Select.test.tsx +0 -648
- package/src/components/form/Select/Select.tsx +0 -474
- package/src/components/form/Select/Select.types.ts +0 -429
- package/src/components/form/Select/index.tsx +0 -30
- package/src/components/form/Slider/Slider.styles.ts +0 -139
- package/src/components/form/Slider/Slider.test.tsx +0 -553
- package/src/components/form/Slider/Slider.tsx +0 -312
- package/src/components/form/Slider/Slider.types.ts +0 -110
- package/src/components/form/Slider/index.tsx +0 -3
- package/src/components/form/Switch/Switch.styles.ts +0 -534
- package/src/components/form/Switch/Switch.test.tsx +0 -345
- package/src/components/form/Switch/Switch.tsx +0 -458
- package/src/components/form/Switch/Switch.types.ts +0 -386
- package/src/components/form/Switch/index.tsx +0 -26
- package/src/components/form/Textarea/Textarea.styles.ts +0 -592
- package/src/components/form/Textarea/Textarea.test.tsx +0 -1075
- package/src/components/form/Textarea/Textarea.tsx +0 -608
- package/src/components/form/Textarea/Textarea.types.ts +0 -374
- package/src/components/form/Textarea/index.tsx +0 -26
- package/src/components/form/TimePicker/TimePicker.styles.ts +0 -434
- package/src/components/form/TimePicker/TimePicker.test.tsx +0 -306
- package/src/components/form/TimePicker/TimePicker.tsx +0 -250
- package/src/components/form/TimePicker/TimePicker.types.ts +0 -385
- package/src/components/form/TimePicker/index.ts +0 -21
- package/src/components/form/Transfer/Transfer.styles.ts +0 -490
- package/src/components/form/Transfer/Transfer.test.tsx +0 -316
- package/src/components/form/Transfer/Transfer.tsx +0 -414
- package/src/components/form/Transfer/Transfer.types.ts +0 -565
- package/src/components/form/Transfer/components/TransferItem.tsx +0 -94
- package/src/components/form/Transfer/components/TransferList.tsx +0 -298
- package/src/components/form/Transfer/components/TransferOperations.tsx +0 -81
- package/src/components/form/Transfer/components/TransferPagination.tsx +0 -139
- package/src/components/form/Transfer/components/TransferSearch.tsx +0 -85
- package/src/components/form/Transfer/components/index.ts +0 -6
- package/src/components/form/Transfer/hooks/index.ts +0 -3
- package/src/components/form/Transfer/hooks/useTransferData.ts +0 -202
- package/src/components/form/Transfer/hooks/useTransferState.ts +0 -120
- package/src/components/form/Transfer/index.ts +0 -27
- package/src/components/form/Upload/Upload.styles.ts +0 -145
- package/src/components/form/Upload/Upload.test.tsx +0 -10
- package/src/components/form/Upload/Upload.tsx +0 -498
- package/src/components/form/Upload/Upload.types.ts +0 -200
- package/src/components/form/Upload/index.tsx +0 -12
- package/src/components/form/index.tsx +0 -152
- package/src/components/index.tsx +0 -145
- package/src/components/layout/Affix/Affix.styles.ts +0 -42
- package/src/components/layout/Affix/Affix.test.tsx +0 -10
- package/src/components/layout/Affix/Affix.tsx +0 -83
- package/src/components/layout/Affix/Affix.types.ts +0 -29
- package/src/components/layout/Affix/index.tsx +0 -3
- package/src/components/layout/Col/Col.styles.ts +0 -185
- package/src/components/layout/Col/Col.test.tsx +0 -537
- package/src/components/layout/Col/Col.tsx +0 -97
- package/src/components/layout/Col/Col.types.ts +0 -59
- package/src/components/layout/Col/index.tsx +0 -3
- package/src/components/layout/Container/Container.styles.ts +0 -163
- package/src/components/layout/Container/Container.test.tsx +0 -380
- package/src/components/layout/Container/Container.tsx +0 -123
- package/src/components/layout/Container/Container.types.ts +0 -63
- package/src/components/layout/Container/index.tsx +0 -3
- package/src/components/layout/Grid/Grid.styles.ts +0 -183
- package/src/components/layout/Grid/Grid.test.tsx +0 -637
- package/src/components/layout/Grid/Grid.tsx +0 -123
- package/src/components/layout/Grid/Grid.types.ts +0 -78
- package/src/components/layout/Grid/index.tsx +0 -3
- package/src/components/layout/Layout/Content.tsx +0 -30
- package/src/components/layout/Layout/Footer.tsx +0 -30
- package/src/components/layout/Layout/Header.tsx +0 -30
- package/src/components/layout/Layout/Layout.styles.ts +0 -84
- package/src/components/layout/Layout/Layout.test.tsx +0 -10
- package/src/components/layout/Layout/Layout.tsx +0 -28
- package/src/components/layout/Layout/Layout.types.ts +0 -58
- package/src/components/layout/Layout/Sider.tsx +0 -44
- package/src/components/layout/Layout/index.tsx +0 -22
- package/src/components/layout/Row/Row.styles.ts +0 -159
- package/src/components/layout/Row/Row.test.tsx +0 -467
- package/src/components/layout/Row/Row.tsx +0 -111
- package/src/components/layout/Row/Row.types.ts +0 -60
- package/src/components/layout/Row/index.tsx +0 -3
- package/src/components/layout/Space/Space.styles.ts +0 -255
- package/src/components/layout/Space/Space.test.tsx +0 -682
- package/src/components/layout/Space/Space.tsx +0 -203
- package/src/components/layout/Space/Space.types.ts +0 -92
- package/src/components/layout/Space/index.tsx +0 -12
- package/src/components/layout/index.tsx +0 -78
- package/src/components/navigation/Menu/Menu.constants.ts +0 -69
- package/src/components/navigation/Menu/Menu.stories.tsx +0 -107
- package/src/components/navigation/Menu/Menu.styles.ts +0 -767
- package/src/components/navigation/Menu/Menu.tsx +0 -352
- package/src/components/navigation/Menu/Menu.types.ts +0 -231
- package/src/components/navigation/Menu/Menu.utils.ts +0 -187
- package/src/components/navigation/Menu/MenuItem.tsx +0 -124
- package/src/components/navigation/Menu/SubMenu.tsx +0 -150
- package/src/components/navigation/Menu/index.tsx +0 -59
- package/src/components/navigation/NavBar/NavBar.styles.ts +0 -129
- package/src/components/navigation/NavBar/NavBar.test.tsx +0 -287
- package/src/components/navigation/NavBar/NavBar.tsx +0 -228
- package/src/components/navigation/NavBar/NavBar.types.ts +0 -54
- package/src/components/navigation/NavBar/index.tsx +0 -3
- package/src/components/navigation/Pagination/Pagination.styles.ts +0 -187
- package/src/components/navigation/Pagination/Pagination.test.tsx +0 -672
- package/src/components/navigation/Pagination/Pagination.tsx +0 -395
- package/src/components/navigation/Pagination/Pagination.types.ts +0 -87
- package/src/components/navigation/Pagination/index.ts +0 -24
- package/src/components/navigation/Pagination/index.tsx +0 -9
- package/src/components/navigation/Steps/Step.tsx +0 -36
- package/src/components/navigation/Steps/Steps.styles.ts +0 -169
- package/src/components/navigation/Steps/Steps.test.tsx +0 -14
- package/src/components/navigation/Steps/Steps.tsx +0 -112
- package/src/components/navigation/Steps/Steps.types.ts +0 -47
- package/src/components/navigation/Steps/index.tsx +0 -3
- package/src/components/navigation/Tabs/Tabs.styles.ts +0 -199
- package/src/components/navigation/Tabs/Tabs.test.tsx +0 -662
- package/src/components/navigation/Tabs/Tabs.tsx +0 -253
- package/src/components/navigation/Tabs/Tabs.types.ts +0 -115
- package/src/components/navigation/Tabs/index.tsx +0 -3
- package/src/components/navigation/index.tsx +0 -88
- package/src/constants/index.ts +0 -785
- package/src/hooks/index.ts +0 -60
- package/src/hooks/types.ts +0 -9
- package/src/hooks/useAsync.ts +0 -64
- package/src/hooks/useClickOutside.ts +0 -52
- package/src/hooks/useCounter.ts +0 -87
- package/src/hooks/useDebounce.ts +0 -150
- package/src/hooks/useDeepCompareEffect.ts +0 -88
- package/src/hooks/useEventHandling.ts +0 -444
- package/src/hooks/useEventListener.ts +0 -77
- package/src/hooks/useLifecycle.ts +0 -399
- package/src/hooks/useMediaQuery.ts +0 -75
- package/src/hooks/useMutation.ts +0 -233
- package/src/hooks/usePerformance.ts +0 -378
- package/src/hooks/usePerformanceMonitor.ts +0 -348
- package/src/hooks/usePlatform.ts +0 -64
- package/src/hooks/usePrevious.ts +0 -25
- package/src/hooks/useRequest.test.ts +0 -11
- package/src/hooks/useRequest.ts +0 -140
- package/src/hooks/useStateManagement.ts +0 -300
- package/src/hooks/useStorage.ts +0 -169
- package/src/hooks/useStyle.ts +0 -543
- package/src/hooks/useTheme.ts +0 -347
- package/src/hooks/useToggle.ts +0 -54
- package/src/hooks/useVirtualScroll.ts +0 -331
- package/src/index.ts +0 -323
- package/src/platform/index.ts +0 -1188
- package/src/providers/AppProvider.test.tsx +0 -63
- package/src/providers/AppProvider.tsx +0 -155
- package/src/providers/index.ts +0 -1
- package/src/theme/ThemeProvider.tsx +0 -279
- package/src/theme/ThemeProvider.types.ts +0 -26
- package/src/theme/animations.tsx +0 -660
- package/src/theme/defaults.ts +0 -188
- package/src/theme/design-system.ts +0 -562
- package/src/theme/design-tokens.ts +0 -1122
- package/src/theme/generated/dark-theme.scss +0 -120
- package/src/theme/generated/tokens.css +0 -441
- package/src/theme/generated/tokens.scss +0 -384
- package/src/theme/index.ts +0 -99
- package/src/theme/responsive.tsx +0 -195
- package/src/theme/styles/mixins.scss +0 -612
- package/src/theme/styles/variables.scss +0 -295
- package/src/theme/styles.ts +0 -403
- package/src/theme/tokens/colors.ts +0 -256
- package/src/theme/tokens/effects.ts +0 -260
- package/src/theme/tokens/index.ts +0 -217
- package/src/theme/tokens/spacing.ts +0 -137
- package/src/theme/tokens/typography.ts +0 -186
- package/src/theme/types.ts +0 -188
- package/src/theme/useThemeUtils.ts +0 -313
- package/src/theme/utils.ts +0 -501
- package/src/theme/variables.ts +0 -602
- package/src/types/accessibility.ts +0 -50
- package/src/types/button.ts +0 -560
- package/src/types/component-props.ts +0 -322
- package/src/types/env.d.ts +0 -20
- package/src/types/glob.d.ts +0 -4
- package/src/types/index.ts +0 -427
- package/src/types/modules.d.ts +0 -40
- package/src/types/standardized-components.ts +0 -550
- package/src/types/taro-adapter.d.ts +0 -174
- package/src/types/taro-components.d.ts +0 -73
- package/src/types/utils.ts +0 -400
- package/src/utils/__tests__/inputValidator.test.ts +0 -338
- package/src/utils/__tests__/responsiveUtils.test.ts +0 -311
- package/src/utils/__tests__/xssProtection.test.ts +0 -268
- package/src/utils/abort-controller.ts +0 -48
- package/src/utils/cache.ts +0 -79
- package/src/utils/createNamespace.ts +0 -24
- package/src/utils/environment.ts +0 -115
- package/src/utils/error-handler.ts +0 -88
- package/src/utils/errorLogger.ts +0 -193
- package/src/utils/formatUtils.ts +0 -412
- package/src/utils/http/error-codes.ts +0 -314
- package/src/utils/http/http-client.test.ts +0 -63
- package/src/utils/http/http-client.ts +0 -161
- package/src/utils/http/request-cache.ts +0 -127
- package/src/utils/http/request.ts +0 -954
- package/src/utils/http/taro-adapter.test.ts +0 -74
- package/src/utils/http/taro-adapter.ts +0 -24
- package/src/utils/http/types.ts +0 -414
- package/src/utils/http/web-adapter.ts +0 -33
- package/src/utils/index.ts +0 -112
- package/src/utils/inputValidator.ts +0 -264
- package/src/utils/performance/performance.ts +0 -839
- package/src/utils/responsiveUtils.ts +0 -348
- package/src/utils/rtl-support.ts +0 -354
- package/src/utils/security/api-security.ts +0 -394
- package/src/utils/security/xss-protection.ts +0 -69
- package/src/utils/securityHeaders.ts +0 -308
- package/src/utils/typeHelpers.ts +0 -16
- package/src/utils/types/dataProcessing.ts +0 -544
- package/src/utils/types/typeHelpers.ts +0 -197
- package/src/utils/xssProtection.ts +0 -468
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import { View } from '@tarojs/components';
|
|
3
|
-
import { gridStyles } from './Grid.styles';
|
|
4
|
-
import type { GridProps, GridRef, GridAlign, GridJustify, GridGap, GridCols } from './Grid.types';
|
|
5
|
-
|
|
6
|
-
/** Grid组件 */
|
|
7
|
-
export const GridComponent = forwardRef<GridRef, GridProps>((props, ref) => {
|
|
8
|
-
const {
|
|
9
|
-
children,
|
|
10
|
-
cols = 1,
|
|
11
|
-
rows,
|
|
12
|
-
gap = 'default',
|
|
13
|
-
rowGap,
|
|
14
|
-
columnGap,
|
|
15
|
-
align = 'stretch',
|
|
16
|
-
justify = 'start',
|
|
17
|
-
className,
|
|
18
|
-
style,
|
|
19
|
-
onClick,
|
|
20
|
-
} = props;
|
|
21
|
-
|
|
22
|
-
const gridRef = useRef<any>(null);
|
|
23
|
-
const [internalCols, setInternalCols] = useState<GridCols>(cols);
|
|
24
|
-
const [internalAlign, setInternalAlign] = useState<GridAlign>(align);
|
|
25
|
-
const [internalJustify, setInternalJustify] = useState<GridJustify>(justify);
|
|
26
|
-
const [internalGap, setInternalGap] = useState<GridGap>(gap);
|
|
27
|
-
const [internalRowGap, setInternalRowGap] = useState(rowGap);
|
|
28
|
-
const [internalColumnGap, setInternalColumnGap] = useState(columnGap);
|
|
29
|
-
|
|
30
|
-
// 更新内部状态
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
setInternalCols(cols);
|
|
33
|
-
}, [cols]);
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
setInternalAlign(align);
|
|
37
|
-
}, [align]);
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
setInternalJustify(justify);
|
|
41
|
-
}, [justify]);
|
|
42
|
-
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
setInternalGap(gap);
|
|
45
|
-
}, [gap]);
|
|
46
|
-
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
setInternalRowGap(rowGap);
|
|
49
|
-
}, [rowGap]);
|
|
50
|
-
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
setInternalColumnGap(columnGap);
|
|
53
|
-
}, [columnGap]);
|
|
54
|
-
|
|
55
|
-
// 处理点击事件
|
|
56
|
-
const handleClick = useCallback(
|
|
57
|
-
(event: any) => {
|
|
58
|
-
onClick?.(event);
|
|
59
|
-
},
|
|
60
|
-
[onClick],
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
// 计算样式
|
|
64
|
-
const gridStyle = gridStyles['getBaseStyle']({
|
|
65
|
-
cols: internalCols,
|
|
66
|
-
rows,
|
|
67
|
-
gap: internalGap,
|
|
68
|
-
rowGap: internalRowGap,
|
|
69
|
-
columnGap: internalColumnGap,
|
|
70
|
-
align: internalAlign,
|
|
71
|
-
justify: internalJustify,
|
|
72
|
-
style: style || {},
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// 计算类名
|
|
76
|
-
const gridClassName = gridStyles['getClassName']({
|
|
77
|
-
cols: internalCols,
|
|
78
|
-
align: internalAlign,
|
|
79
|
-
justify: internalJustify,
|
|
80
|
-
gap: internalGap,
|
|
81
|
-
className: className || '',
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// 暴露给外部的引用方法
|
|
85
|
-
React.useImperativeHandle(
|
|
86
|
-
ref,
|
|
87
|
-
() => ({
|
|
88
|
-
element: gridRef.current,
|
|
89
|
-
getCols: () => internalCols,
|
|
90
|
-
getAlign: () => internalAlign,
|
|
91
|
-
getJustify: () => internalJustify,
|
|
92
|
-
getGap: () => internalGap,
|
|
93
|
-
setCols: (newCols: GridCols) => {
|
|
94
|
-
setInternalCols(newCols);
|
|
95
|
-
},
|
|
96
|
-
setAlign: (newAlign: GridAlign) => {
|
|
97
|
-
setInternalAlign(newAlign);
|
|
98
|
-
},
|
|
99
|
-
setJustify: (newJustify: GridJustify) => {
|
|
100
|
-
setInternalJustify(newJustify);
|
|
101
|
-
},
|
|
102
|
-
setGap: (newGap: GridGap) => {
|
|
103
|
-
setInternalGap(newGap);
|
|
104
|
-
},
|
|
105
|
-
scrollIntoView: (options?: ScrollIntoViewOptions) => {
|
|
106
|
-
gridRef.current?.scrollIntoView(options);
|
|
107
|
-
},
|
|
108
|
-
}),
|
|
109
|
-
[internalCols, internalAlign, internalJustify, internalGap],
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<View ref={gridRef} className={gridClassName} style={{ ...gridStyle, ...style }} onClick={handleClick}>
|
|
114
|
-
{children}
|
|
115
|
-
</View>
|
|
116
|
-
);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
/** Grid组件显示名称 */
|
|
120
|
-
GridComponent.displayName = 'Grid';
|
|
121
|
-
|
|
122
|
-
/** 导出Grid组件 */
|
|
123
|
-
export const Grid = GridComponent;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import type { ITouchEvent } from '@tarojs/components';
|
|
3
|
-
import { BaseComponentProps, Size, CSSUnit } from '../../../types';
|
|
4
|
-
|
|
5
|
-
/** Grid组件对齐方式 */
|
|
6
|
-
export type GridAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
7
|
-
|
|
8
|
-
/** Grid组件对齐方式 */
|
|
9
|
-
export type GridJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
10
|
-
|
|
11
|
-
/** Grid组件间距 */
|
|
12
|
-
export type GridGap =
|
|
13
|
-
| Size
|
|
14
|
-
| number
|
|
15
|
-
| `${number}${CSSUnit}`
|
|
16
|
-
| [Size | number | `${number}${CSSUnit}`, Size | number | `${number}${CSSUnit}`];
|
|
17
|
-
|
|
18
|
-
/** Grid组件列数 */
|
|
19
|
-
export type GridCols = string | number | `${number}`;
|
|
20
|
-
|
|
21
|
-
/** Grid组件引用 */
|
|
22
|
-
export interface GridRef {
|
|
23
|
-
/** 获取元素引用 */
|
|
24
|
-
element: any;
|
|
25
|
-
/** 获取当前列数 */
|
|
26
|
-
getCols: () => GridCols;
|
|
27
|
-
/** 获取当前对齐方式 */
|
|
28
|
-
getAlign: () => GridAlign;
|
|
29
|
-
/** 获取当前对齐方式 */
|
|
30
|
-
getJustify: () => GridJustify;
|
|
31
|
-
/** 获取当前间距 */
|
|
32
|
-
getGap: () => GridGap;
|
|
33
|
-
/** 设置列数 */
|
|
34
|
-
setCols: (_cols: GridCols) => void;
|
|
35
|
-
/** 设置对齐方式 */
|
|
36
|
-
setAlign: (_align: GridAlign) => void;
|
|
37
|
-
/** 设置对齐方式 */
|
|
38
|
-
setJustify: (_justify: GridJustify) => void;
|
|
39
|
-
/** 设置间距 */
|
|
40
|
-
setGap: (_gap: GridGap) => void;
|
|
41
|
-
/** 滚动到视图 */
|
|
42
|
-
scrollIntoView: (options?: ScrollIntoViewOptions) => void;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Grid组件属性 */
|
|
46
|
-
export interface GridProps extends BaseComponentProps {
|
|
47
|
-
/** 子元素 */
|
|
48
|
-
children?: ReactNode;
|
|
49
|
-
/** 列数 */
|
|
50
|
-
cols?: GridCols;
|
|
51
|
-
/** 行数 */
|
|
52
|
-
rows?: number | undefined;
|
|
53
|
-
/** 间距 */
|
|
54
|
-
gap?: GridGap;
|
|
55
|
-
/** 垂直间距 */
|
|
56
|
-
rowGap?: Size | number | `${number}${CSSUnit}` | undefined;
|
|
57
|
-
/** 水平间距 */
|
|
58
|
-
columnGap?: Size | number | `${number}${CSSUnit}` | undefined;
|
|
59
|
-
/** 对齐方式 */
|
|
60
|
-
align?: GridAlign;
|
|
61
|
-
/** 对齐方式 */
|
|
62
|
-
justify?: GridJustify;
|
|
63
|
-
/** 点击事件 */
|
|
64
|
-
onClick?: (_event: ITouchEvent) => void;
|
|
65
|
-
/** 子元素悬停事件 */
|
|
66
|
-
onItemHover?: (_index: number, event: ITouchEvent) => void;
|
|
67
|
-
/** 子元素点击事件 */
|
|
68
|
-
onItemClick?: (_index: number, event: ITouchEvent) => void;
|
|
69
|
-
/** 响应式断点 */
|
|
70
|
-
responsive?: {
|
|
71
|
-
xs?: Partial<GridProps>;
|
|
72
|
-
sm?: Partial<GridProps>;
|
|
73
|
-
md?: Partial<GridProps>;
|
|
74
|
-
lg?: Partial<GridProps>;
|
|
75
|
-
xl?: Partial<GridProps>;
|
|
76
|
-
xxl?: Partial<GridProps>;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
2
|
-
import { View } from '@tarojs/components';
|
|
3
|
-
import { LayoutContentProps, LayoutContentRef } from './Layout.types';
|
|
4
|
-
import { getContentStyle } from './Layout.styles';
|
|
5
|
-
|
|
6
|
-
export const LayoutContent = forwardRef<LayoutContentRef, LayoutContentProps>(
|
|
7
|
-
({ className, style, children, ...props }, ref) => {
|
|
8
|
-
const contentRef = React.useRef<any>(null);
|
|
9
|
-
|
|
10
|
-
useImperativeHandle(ref, () => ({
|
|
11
|
-
getContent: () => contentRef.current,
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
|
-
const contentStyle = getContentStyle(style);
|
|
15
|
-
const finalStyle = {
|
|
16
|
-
...contentStyle,
|
|
17
|
-
...style,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<View ref={contentRef} className={className} style={finalStyle} {...props}>
|
|
22
|
-
{children}
|
|
23
|
-
</View>
|
|
24
|
-
);
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
LayoutContent.displayName = 'LayoutContent';
|
|
29
|
-
|
|
30
|
-
export default LayoutContent;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
2
|
-
import { View } from '@tarojs/components';
|
|
3
|
-
import { LayoutFooterProps, LayoutFooterRef } from './Layout.types';
|
|
4
|
-
import { getFooterStyle } from './Layout.styles';
|
|
5
|
-
|
|
6
|
-
export const LayoutFooter = forwardRef<LayoutFooterRef, LayoutFooterProps>(
|
|
7
|
-
({ className, style, children, ...props }, ref) => {
|
|
8
|
-
const footerRef = React.useRef<any>(null);
|
|
9
|
-
|
|
10
|
-
useImperativeHandle(ref, () => ({
|
|
11
|
-
getFooter: () => footerRef.current,
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
|
-
const footerStyle = getFooterStyle(style);
|
|
15
|
-
const finalStyle = {
|
|
16
|
-
...footerStyle,
|
|
17
|
-
...style,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<View ref={footerRef} className={className} style={finalStyle} {...props}>
|
|
22
|
-
{children}
|
|
23
|
-
</View>
|
|
24
|
-
);
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
LayoutFooter.displayName = 'LayoutFooter';
|
|
29
|
-
|
|
30
|
-
export default LayoutFooter;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
2
|
-
import { View } from '@tarojs/components';
|
|
3
|
-
import { LayoutHeaderProps, LayoutHeaderRef } from './Layout.types';
|
|
4
|
-
import { getHeaderStyle } from './Layout.styles';
|
|
5
|
-
|
|
6
|
-
export const LayoutHeader = forwardRef<LayoutHeaderRef, LayoutHeaderProps>(
|
|
7
|
-
({ className, style, children, ...props }, ref) => {
|
|
8
|
-
const headerRef = React.useRef<any>(null);
|
|
9
|
-
|
|
10
|
-
useImperativeHandle(ref, () => ({
|
|
11
|
-
getHeader: () => headerRef.current,
|
|
12
|
-
}));
|
|
13
|
-
|
|
14
|
-
const headerStyle = getHeaderStyle(style);
|
|
15
|
-
const finalStyle = {
|
|
16
|
-
...headerStyle,
|
|
17
|
-
...style,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<View ref={headerRef} className={className} style={finalStyle} {...props}>
|
|
22
|
-
{children}
|
|
23
|
-
</View>
|
|
24
|
-
);
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
LayoutHeader.displayName = 'LayoutHeader';
|
|
29
|
-
|
|
30
|
-
export default LayoutHeader;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export const layoutStyles = {
|
|
2
|
-
layout: {
|
|
3
|
-
display: 'flex' as const,
|
|
4
|
-
flexDirection: 'column' as const,
|
|
5
|
-
flex: 1,
|
|
6
|
-
minHeight: '100vh',
|
|
7
|
-
backgroundColor: '#f0f2f5',
|
|
8
|
-
},
|
|
9
|
-
layoutHasSider: {
|
|
10
|
-
flexDirection: 'row' as const,
|
|
11
|
-
},
|
|
12
|
-
header: {
|
|
13
|
-
height: 64,
|
|
14
|
-
padding: '0 50px',
|
|
15
|
-
lineHeight: '64px',
|
|
16
|
-
background: '#001529',
|
|
17
|
-
color: '#fff',
|
|
18
|
-
position: 'relative' as const,
|
|
19
|
-
zIndex: 10,
|
|
20
|
-
},
|
|
21
|
-
content: {
|
|
22
|
-
flex: 1,
|
|
23
|
-
padding: 24,
|
|
24
|
-
minHeight: 280,
|
|
25
|
-
background: '#fff',
|
|
26
|
-
margin: '24px',
|
|
27
|
-
borderRadius: 2,
|
|
28
|
-
},
|
|
29
|
-
footer: {
|
|
30
|
-
padding: '24px 50px',
|
|
31
|
-
color: 'rgba(0, 0, 0, 0.45)',
|
|
32
|
-
textAlign: 'center' as const,
|
|
33
|
-
background: '#f0f2f5',
|
|
34
|
-
},
|
|
35
|
-
sider: {
|
|
36
|
-
background: '#001529',
|
|
37
|
-
transition: 'all 0.2s',
|
|
38
|
-
overflow: 'auto' as const,
|
|
39
|
-
height: '100vh',
|
|
40
|
-
position: 'fixed' as const,
|
|
41
|
-
left: 0,
|
|
42
|
-
top: 0,
|
|
43
|
-
bottom: 0,
|
|
44
|
-
},
|
|
45
|
-
siderCollapsed: {
|
|
46
|
-
width: 80,
|
|
47
|
-
},
|
|
48
|
-
siderExpanded: {
|
|
49
|
-
width: 200,
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const getLayoutStyle = (hasSider?: boolean) => {
|
|
54
|
-
const style = { ...layoutStyles.layout };
|
|
55
|
-
if (hasSider) {
|
|
56
|
-
Object.assign(style, layoutStyles.layoutHasSider);
|
|
57
|
-
}
|
|
58
|
-
return style;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const getHeaderStyle = (customStyle?: React.CSSProperties) => {
|
|
62
|
-
return { ...layoutStyles.header, ...customStyle };
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const getContentStyle = (customStyle?: React.CSSProperties) => {
|
|
66
|
-
return { ...layoutStyles.content, ...customStyle };
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const getFooterStyle = (customStyle?: React.CSSProperties) => {
|
|
70
|
-
return { ...layoutStyles.footer, ...customStyle };
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export const getSiderStyle = (collapsed?: boolean, width?: number | string, customStyle?: React.CSSProperties) => {
|
|
74
|
-
const style: React.CSSProperties = { ...layoutStyles.sider };
|
|
75
|
-
if (collapsed) {
|
|
76
|
-
Object.assign(style, layoutStyles.siderCollapsed);
|
|
77
|
-
} else {
|
|
78
|
-
Object.assign(style, layoutStyles.siderExpanded);
|
|
79
|
-
}
|
|
80
|
-
if (width) {
|
|
81
|
-
style.width = width;
|
|
82
|
-
}
|
|
83
|
-
return { ...style, ...customStyle };
|
|
84
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { Layout } from './Layout'
|
|
4
|
-
|
|
5
|
-
describe('Layout', () => {
|
|
6
|
-
it('renders children', () => {
|
|
7
|
-
render(<Layout><div>内容区域</div></Layout>)
|
|
8
|
-
expect(screen.getByText('内容区域')).toBeInTheDocument()
|
|
9
|
-
})
|
|
10
|
-
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
2
|
-
import { View } from '@tarojs/components';
|
|
3
|
-
import { LayoutProps, LayoutRef } from './Layout.types';
|
|
4
|
-
import { getLayoutStyle } from './Layout.styles';
|
|
5
|
-
|
|
6
|
-
export const Layout = forwardRef<LayoutRef, LayoutProps>(({ className, style, children, hasSider, ...props }, ref) => {
|
|
7
|
-
const layoutRef = React.useRef<any>(null);
|
|
8
|
-
|
|
9
|
-
useImperativeHandle(ref, () => ({
|
|
10
|
-
getLayout: () => layoutRef.current,
|
|
11
|
-
}));
|
|
12
|
-
|
|
13
|
-
const layoutStyle = getLayoutStyle(hasSider);
|
|
14
|
-
const finalStyle = {
|
|
15
|
-
...layoutStyle,
|
|
16
|
-
...style,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<View ref={layoutRef} className={className} style={finalStyle} {...props}>
|
|
21
|
-
{children}
|
|
22
|
-
</View>
|
|
23
|
-
);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
Layout.displayName = 'Layout';
|
|
27
|
-
|
|
28
|
-
export default Layout;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ViewProps } from '@tarojs/components';
|
|
3
|
-
|
|
4
|
-
export interface LayoutProps extends ViewProps {
|
|
5
|
-
className?: string;
|
|
6
|
-
style?: React.CSSProperties;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
hasSider?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface LayoutHeaderProps extends ViewProps {
|
|
12
|
-
className?: string;
|
|
13
|
-
style?: React.CSSProperties;
|
|
14
|
-
children?: ReactNode;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface LayoutContentProps extends ViewProps {
|
|
18
|
-
className?: string;
|
|
19
|
-
style?: React.CSSProperties;
|
|
20
|
-
children?: ReactNode;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface LayoutFooterProps extends ViewProps {
|
|
24
|
-
className?: string;
|
|
25
|
-
style?: React.CSSProperties;
|
|
26
|
-
children?: ReactNode;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface LayoutSiderProps extends ViewProps {
|
|
30
|
-
className?: string;
|
|
31
|
-
style?: React.CSSProperties;
|
|
32
|
-
children?: ReactNode;
|
|
33
|
-
width?: number | string;
|
|
34
|
-
collapsed?: boolean;
|
|
35
|
-
collapsedWidth?: number | string;
|
|
36
|
-
onCollapse?: (_collapsed: boolean) => void;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface LayoutRef {
|
|
40
|
-
getLayout: () => HTMLDivElement | null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface LayoutHeaderRef {
|
|
44
|
-
getHeader: () => HTMLDivElement | null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface LayoutContentRef {
|
|
48
|
-
getContent: () => HTMLDivElement | null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface LayoutFooterRef {
|
|
52
|
-
getFooter: () => HTMLDivElement | null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface LayoutSiderRef {
|
|
56
|
-
getSider: () => HTMLDivElement | null;
|
|
57
|
-
toggleCollapse: () => void;
|
|
58
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useImperativeHandle, useState, useCallback } from 'react';
|
|
2
|
-
import { View } from '@tarojs/components';
|
|
3
|
-
import { LayoutSiderProps, LayoutSiderRef } from './Layout.types';
|
|
4
|
-
import { getSiderStyle } from './Layout.styles';
|
|
5
|
-
|
|
6
|
-
export const LayoutSider = forwardRef<LayoutSiderRef, LayoutSiderProps>(
|
|
7
|
-
({ className, style, children, width = 200, collapsed = false, collapsedWidth = 80, onCollapse, ...props }, ref) => {
|
|
8
|
-
const [isCollapsed, setIsCollapsed] = useState(collapsed);
|
|
9
|
-
const siderRef = React.useRef<any>(null);
|
|
10
|
-
|
|
11
|
-
const toggleCollapse = useCallback(() => {
|
|
12
|
-
const newCollapsed = !isCollapsed;
|
|
13
|
-
setIsCollapsed(newCollapsed);
|
|
14
|
-
onCollapse?.(newCollapsed);
|
|
15
|
-
}, [isCollapsed, onCollapse]);
|
|
16
|
-
|
|
17
|
-
useImperativeHandle(ref, () => ({
|
|
18
|
-
getSider: () => siderRef.current,
|
|
19
|
-
toggleCollapse,
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
React.useEffect(() => {
|
|
23
|
-
setIsCollapsed(collapsed);
|
|
24
|
-
}, [collapsed]);
|
|
25
|
-
|
|
26
|
-
const currentWidth = isCollapsed ? collapsedWidth : width;
|
|
27
|
-
|
|
28
|
-
const siderStyle = getSiderStyle(isCollapsed, currentWidth, style);
|
|
29
|
-
const finalStyle = {
|
|
30
|
-
...siderStyle,
|
|
31
|
-
...style,
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<View ref={siderRef} className={className} style={finalStyle} {...props}>
|
|
36
|
-
{children}
|
|
37
|
-
</View>
|
|
38
|
-
);
|
|
39
|
-
},
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
LayoutSider.displayName = 'LayoutSider';
|
|
43
|
-
|
|
44
|
-
export default LayoutSider;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export { Layout } from './Layout';
|
|
2
|
-
export { LayoutHeader } from './Header';
|
|
3
|
-
export { LayoutContent } from './Content';
|
|
4
|
-
export { LayoutFooter } from './Footer';
|
|
5
|
-
export { LayoutSider } from './Sider';
|
|
6
|
-
export type {
|
|
7
|
-
LayoutProps,
|
|
8
|
-
LayoutRef,
|
|
9
|
-
LayoutHeaderProps,
|
|
10
|
-
LayoutContentProps,
|
|
11
|
-
LayoutFooterProps,
|
|
12
|
-
LayoutSiderProps,
|
|
13
|
-
} from './Layout.types';
|
|
14
|
-
export type { LayoutHeaderRef, LayoutContentRef, LayoutFooterRef, LayoutSiderRef } from './Layout.types';
|
|
15
|
-
export {
|
|
16
|
-
layoutStyles,
|
|
17
|
-
getLayoutStyle,
|
|
18
|
-
getHeaderStyle,
|
|
19
|
-
getContentStyle,
|
|
20
|
-
getFooterStyle,
|
|
21
|
-
getSiderStyle,
|
|
22
|
-
} from './Layout.styles';
|