@apexhub/apex-ui-react-source 0.0.0-stage → 1.2.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/LICENSE +21 -0
- package/README.md +97 -2
- package/bin/apex-ui-react-source.mjs +717 -0
- package/dist/files/AGENTS.md +89 -0
- package/dist/files/LICENSE +21 -0
- package/dist/files/_assets/adapt-to-page.raw.ts +3 -0
- package/dist/files/_assets/adapt-to-page.url.ts +3 -0
- package/dist/files/_assets/calendar.raw.ts +3 -0
- package/dist/files/_assets/doc-format.raw.ts +3 -0
- package/dist/files/_assets/docx-format.raw.ts +3 -0
- package/dist/files/_assets/full-screen.raw.ts +3 -0
- package/dist/files/_assets/full-screen.url.ts +3 -0
- package/dist/files/_assets/gif-format.raw.ts +3 -0
- package/dist/files/_assets/jpeg-format.raw.ts +3 -0
- package/dist/files/_assets/jpg-format.raw.ts +3 -0
- package/dist/files/_assets/ofd-format.raw.ts +3 -0
- package/dist/files/_assets/one-to-one.raw.ts +3 -0
- package/dist/files/_assets/one-to-one.url.ts +3 -0
- package/dist/files/_assets/pdf-format.raw.ts +3 -0
- package/dist/files/_assets/png-format.raw.ts +3 -0
- package/dist/files/_assets/rotate-left.raw.ts +3 -0
- package/dist/files/_assets/rotate-left.url.ts +3 -0
- package/dist/files/_assets/rotate-right.raw.ts +3 -0
- package/dist/files/_assets/rotate-right.url.ts +3 -0
- package/dist/files/_assets/table-empty.url.ts +3 -0
- package/dist/files/_assets/txt-format.raw.ts +3 -0
- package/dist/files/_assets/upload-file-doc-20.raw.ts +3 -0
- package/dist/files/_assets/upload-file-docx-20.raw.ts +3 -0
- package/dist/files/_assets/upload-file-gif-20.raw.ts +3 -0
- package/dist/files/_assets/upload-file-jpeg-20.raw.ts +3 -0
- package/dist/files/_assets/upload-file-jpg-20.raw.ts +3 -0
- package/dist/files/_assets/upload-file-ofd-20.raw.ts +3 -0
- package/dist/files/_assets/upload-file-pdf-20.raw.ts +3 -0
- package/dist/files/_assets/upload-file-png-20.raw.ts +3 -0
- package/dist/files/_assets/upload-file-txt-20.raw.ts +3 -0
- package/dist/files/_assets/upload-file-xlsx-20.raw.ts +3 -0
- package/dist/files/_assets/xlsx-format.raw.ts +3 -0
- package/dist/files/_assets/zoom-in.raw.ts +3 -0
- package/dist/files/_assets/zoom-in.url.ts +3 -0
- package/dist/files/_assets/zoom-out.raw.ts +3 -0
- package/dist/files/_assets/zoom-out.url.ts +3 -0
- package/dist/files/_headless/dismiss-intent.ts +1 -0
- package/dist/files/_headless/placement.ts +1 -0
- package/dist/files/_headless/use-embedded-scroll-lock-guard.ts +47 -0
- package/dist/files/_headless/use-floating-overlay.tsx +3 -0
- package/dist/files/_namespace/constants.ts +23 -0
- package/dist/files/_namespace/index.ts +1 -0
- package/dist/files/_overlay/auto-update-anchored-overlay.ts +11 -0
- package/dist/files/_overlay/collision-boundary.ts +78 -0
- package/dist/files/_overlay/dismiss-intent.ts +107 -0
- package/dist/files/_overlay/get-overlay-root.ts +157 -0
- package/dist/files/_overlay/index.ts +57 -0
- package/dist/files/_overlay/observe-anchor-lifecycle.ts +72 -0
- package/dist/files/_overlay/overlay-theme.ts +91 -0
- package/dist/files/_overlay/overlay-trigger.ts +100 -0
- package/dist/files/_overlay/overlay.css +29 -0
- package/dist/files/_overlay/placement.ts +18 -0
- package/dist/files/_overlay/resolve-portal-container.ts +13 -0
- package/dist/files/_overlay/use-anchored-overlay.tsx +493 -0
- package/dist/files/_overlay/zIndex.ts +17 -0
- package/dist/files/_tags/MaxTagList.tsx +336 -0
- package/dist/files/_tags/OverflowTagPopover.tsx +315 -0
- package/dist/files/_tags/get-max-tag-display.ts +26 -0
- package/dist/files/_tags/index.ts +15 -0
- package/dist/files/_tags/resolve-max-tag-popover.ts +28 -0
- package/dist/files/_tags/tags.css +126 -0
- package/dist/files/_tags/types.ts +46 -0
- package/dist/files/_tags/use-responsive-max-tag-count.ts +165 -0
- package/dist/files/alert/Alert.tsx +100 -0
- package/dist/files/alert/alert.css +85 -0
- package/dist/files/alert/index.ts +2 -0
- package/dist/files/alert/interface.ts +59 -0
- package/dist/files/alert/llm.txt +160 -0
- package/dist/files/alert/tokens.txt +44 -0
- package/dist/files/alert/variants.ts +17 -0
- package/dist/files/apex-env.d.ts +2 -0
- package/dist/files/apex-provider/ApexProvider.tsx +53 -0
- package/dist/files/apex-provider/apex-provider.css +0 -0
- package/dist/files/apex-provider/context.ts +17 -0
- package/dist/files/apex-provider/index.ts +18 -0
- package/dist/files/apex-provider/interface.ts +181 -0
- package/dist/files/apex-provider/llm.txt +367 -0
- package/dist/files/apex-provider/localeKind.ts +20 -0
- package/dist/files/auto-complete/AutoComplete.tsx +419 -0
- package/dist/files/auto-complete/auto-complete.css +108 -0
- package/dist/files/auto-complete/auto-complete.stories.css +17 -0
- package/dist/files/auto-complete/index.ts +8 -0
- package/dist/files/auto-complete/interface.ts +77 -0
- package/dist/files/auto-complete/llm.txt +374 -0
- package/dist/files/auto-complete/tokens.txt +77 -0
- package/dist/files/auto-complete/variants.ts +19 -0
- package/dist/files/avatar/Avatar.tsx +277 -0
- package/dist/files/avatar/avatar.css +159 -0
- package/dist/files/avatar/index.ts +2 -0
- package/dist/files/avatar/interface.ts +147 -0
- package/dist/files/avatar/llm.txt +195 -0
- package/dist/files/avatar/tokens.txt +38 -0
- package/dist/files/avatar/use-responsive-size.ts +66 -0
- package/dist/files/avatar/variants.ts +41 -0
- package/dist/files/breadcrumb/Breadcrumb.stories.css +5 -0
- package/dist/files/breadcrumb/Breadcrumb.tsx +238 -0
- package/dist/files/breadcrumb/BreadcrumbLink.tsx +63 -0
- package/dist/files/breadcrumb/BreadcrumbSeparatorIcon.tsx +30 -0
- package/dist/files/breadcrumb/breadcrumb.css +113 -0
- package/dist/files/breadcrumb/index.ts +12 -0
- package/dist/files/breadcrumb/interface.ts +81 -0
- package/dist/files/breadcrumb/llm.txt +249 -0
- package/dist/files/breadcrumb/tokens.txt +193 -0
- package/dist/files/breadcrumb/variants.ts +8 -0
- package/dist/files/button/Button.tsx +235 -0
- package/dist/files/button/button.css +261 -0
- package/dist/files/button/index.ts +2 -0
- package/dist/files/button/interface.ts +145 -0
- package/dist/files/button/llm.txt +254 -0
- package/dist/files/button/tokens.txt +470 -0
- package/dist/files/button/variants.ts +89 -0
- package/dist/files/card/Card.tsx +63 -0
- package/dist/files/card/card.css +66 -0
- package/dist/files/card/index.ts +2 -0
- package/dist/files/card/interface.ts +25 -0
- package/dist/files/card/llm.txt +93 -0
- package/dist/files/card/tokens.txt +27 -0
- package/dist/files/cascader/Cascader.tsx +955 -0
- package/dist/files/cascader/_adapter/locale.ts +4 -0
- package/dist/files/cascader/cascader-data.ts +354 -0
- package/dist/files/cascader/cascader.css +382 -0
- package/dist/files/cascader/index.ts +16 -0
- package/dist/files/cascader/interface.ts +358 -0
- package/dist/files/cascader/llm.txt +897 -0
- package/dist/files/cascader/tokens.txt +253 -0
- package/dist/files/cascader/variants.ts +35 -0
- package/dist/files/checkbox/Checkbox.tsx +477 -0
- package/dist/files/checkbox/checkbox.css +196 -0
- package/dist/files/checkbox/index.ts +9 -0
- package/dist/files/checkbox/interface.ts +162 -0
- package/dist/files/checkbox/llm.txt +326 -0
- package/dist/files/checkbox/tokens.txt +28 -0
- package/dist/files/checkbox/variants.ts +29 -0
- package/dist/files/clear/Clear.tsx +49 -0
- package/dist/files/clear/clear.css +60 -0
- package/dist/files/clear/index.ts +2 -0
- package/dist/files/clear/interface.ts +8 -0
- package/dist/files/collapse/Collapse.tsx +163 -0
- package/dist/files/collapse/collapse.css +174 -0
- package/dist/files/collapse/index.ts +2 -0
- package/dist/files/collapse/interface.ts +132 -0
- package/dist/files/collapse/llm.txt +328 -0
- package/dist/files/collapse/tokens.txt +84 -0
- package/dist/files/core/date-picker/index.ts +191 -0
- package/dist/files/core/form/index.ts +212 -0
- package/dist/files/core/index.ts +11 -0
- package/dist/files/core/input-number/index.ts +112 -0
- package/dist/files/core/namespace/index.ts +14 -0
- package/dist/files/core/overlay/index.ts +40 -0
- package/dist/files/core/pagination/index.ts +128 -0
- package/dist/files/core/table/access.ts +37 -0
- package/dist/files/core/table/columns.ts +4 -0
- package/dist/files/core/table/data-model.ts +58 -0
- package/dist/files/core/table/fixed-offset.ts +29 -0
- package/dist/files/core/table/grouped-header.ts +24 -0
- package/dist/files/core/table/index.ts +11 -0
- package/dist/files/core/table/merge.ts +132 -0
- package/dist/files/core/table/pagination.ts +51 -0
- package/dist/files/core/table/rowModel.ts +4 -0
- package/dist/files/core/table/types.ts +14 -0
- package/dist/files/core/typography/index.ts +125 -0
- package/dist/files/core/upload/file-type.ts +160 -0
- package/dist/files/core/upload/format-size.ts +17 -0
- package/dist/files/core/upload/index.ts +19 -0
- package/dist/files/core/upload/limits.ts +76 -0
- package/dist/files/core/utils/cn.ts +6 -0
- package/dist/files/core/utils/index.ts +2 -0
- package/dist/files/core/utils/svg.ts +101 -0
- package/dist/files/date-picker/DatePicker.tsx +601 -0
- package/dist/files/date-picker/RangePicker.tsx +1047 -0
- package/dist/files/date-picker/Trigger.tsx +115 -0
- package/dist/files/date-picker/_adapter/calendar.ts +136 -0
- package/dist/files/date-picker/_adapter/disable.ts +89 -0
- package/dist/files/date-picker/_adapter/format.ts +54 -0
- package/dist/files/date-picker/_adapter/keymap.ts +17 -0
- package/dist/files/date-picker/_adapter/locale.ts +4 -0
- package/dist/files/date-picker/_adapter/presets.ts +30 -0
- package/dist/files/date-picker/_adapter/range.ts +44 -0
- package/dist/files/date-picker/_adapter/types.ts +29 -0
- package/dist/files/date-picker/context.ts +60 -0
- package/dist/files/date-picker/date-picker.css +1093 -0
- package/dist/files/date-picker/index.ts +26 -0
- package/dist/files/date-picker/interface.ts +135 -0
- package/dist/files/date-picker/llm.txt +422 -0
- package/dist/files/date-picker/panels/DatePanel.tsx +110 -0
- package/dist/files/date-picker/panels/DecadePanel.tsx +49 -0
- package/dist/files/date-picker/panels/Footer.tsx +109 -0
- package/dist/files/date-picker/panels/Header.tsx +228 -0
- package/dist/files/date-picker/panels/MonthPanel.tsx +83 -0
- package/dist/files/date-picker/panels/Panel.tsx +339 -0
- package/dist/files/date-picker/panels/QuarterPanel.tsx +70 -0
- package/dist/files/date-picker/panels/TimePanel.tsx +171 -0
- package/dist/files/date-picker/panels/WeekPanel.tsx +145 -0
- package/dist/files/date-picker/panels/YearPanel.tsx +89 -0
- package/dist/files/date-picker/panels/time-panel-utils.ts +33 -0
- package/dist/files/date-picker/tokens.txt +171 -0
- package/dist/files/date-picker/variants.ts +20 -0
- package/dist/files/divider/Divider.tsx +80 -0
- package/dist/files/divider/divider.css +66 -0
- package/dist/files/divider/index.ts +7 -0
- package/dist/files/divider/interface.ts +58 -0
- package/dist/files/divider/llm.txt +158 -0
- package/dist/files/divider/tokens.txt +22 -0
- package/dist/files/drawer/Drawer.tsx +491 -0
- package/dist/files/drawer/drawer.css +201 -0
- package/dist/files/drawer/index.ts +13 -0
- package/dist/files/drawer/interface.ts +172 -0
- package/dist/files/drawer/llm.txt +374 -0
- package/dist/files/drawer/tokens.txt +71 -0
- package/dist/files/drawer/variants.ts +14 -0
- package/dist/files/dropdown/Dropdown.tsx +629 -0
- package/dist/files/dropdown/dropdown.css +243 -0
- package/dist/files/dropdown/index.ts +12 -0
- package/dist/files/dropdown/interface.ts +91 -0
- package/dist/files/dropdown/lib.ts +78 -0
- package/dist/files/dropdown/llm.txt +427 -0
- package/dist/files/dropdown/tokens.txt +59 -0
- package/dist/files/form/Form.tsx +229 -0
- package/dist/files/form/FormItem.tsx +526 -0
- package/dist/files/form/_adapter/bindField.ts +189 -0
- package/dist/files/form/_adapter/compileRules.ts +185 -0
- package/dist/files/form/_adapter/controlStatus.ts +23 -0
- package/dist/files/form/_adapter/deriveStatus.ts +42 -0
- package/dist/files/form/_adapter/instance.ts +281 -0
- package/dist/files/form/_adapter/messages.ts +15 -0
- package/dist/files/form/_adapter/types.ts +82 -0
- package/dist/files/form/_adapter/validationMeta.ts +29 -0
- package/dist/files/form/_adapter/validationTransaction.ts +69 -0
- package/dist/files/form/context.ts +38 -0
- package/dist/files/form/form.css +268 -0
- package/dist/files/form/index.ts +13 -0
- package/dist/files/form/interface.ts +99 -0
- package/dist/files/form/llm.txt +346 -0
- package/dist/files/form/tokens.txt +26 -0
- package/dist/files/form/useForm.ts +150 -0
- package/dist/files/form/utils.ts +28 -0
- package/dist/files/form/variants.ts +30 -0
- package/dist/files/global.css +8 -0
- package/dist/files/grid/Col.tsx +104 -0
- package/dist/files/grid/Grid.tsx +18 -0
- package/dist/files/grid/Row.tsx +129 -0
- package/dist/files/grid/grid.css +990 -0
- package/dist/files/grid/index.ts +12 -0
- package/dist/files/grid/interface.ts +109 -0
- package/dist/files/grid/llm.txt +419 -0
- package/dist/files/grid/useBreakpoint.ts +67 -0
- package/dist/files/icon/Icon.tsx +16 -0
- package/dist/files/icon/icon.css +26 -0
- package/dist/files/icon/icons-map.ts +1 -0
- package/dist/files/icon/index.ts +2 -0
- package/dist/files/icon/interface.ts +9 -0
- package/dist/files/icons/ActionIcons.tsx +105 -0
- package/dist/files/icons/AlertCloseIcon.tsx +21 -0
- package/dist/files/icons/CalendarIcon.tsx +6 -0
- package/dist/files/icons/CaretIcons.tsx +43 -0
- package/dist/files/icons/FileFormatIcons.tsx +27 -0
- package/dist/files/icons/Icons.tsx +10 -0
- package/dist/files/icons/MagnifyingGlassIcon.tsx +26 -0
- package/dist/files/icons/MessageIcons.tsx +111 -0
- package/dist/files/icons/NavigationIcons.tsx +126 -0
- package/dist/files/icons/PreviewIcons.tsx +18 -0
- package/dist/files/icons/StarIcons.tsx +71 -0
- package/dist/files/icons/UploadIcons.tsx +167 -0
- package/dist/files/icons/XCloseIcon.tsx +26 -0
- package/dist/files/icons/createAssetIcon.tsx +64 -0
- package/dist/files/icons/icons.css +4 -0
- package/dist/files/icons/index.ts +36 -0
- package/dist/files/icons/interface.ts +9 -0
- package/dist/files/icons/registry.ts +94 -0
- package/dist/files/image/Image.tsx +328 -0
- package/dist/files/image/ImageActionIcons.tsx +60 -0
- package/dist/files/image/ImagePreview.tsx +684 -0
- package/dist/files/image/_adapter/locale.ts +4 -0
- package/dist/files/image/image.css +451 -0
- package/dist/files/image/index.ts +7 -0
- package/dist/files/image/interface.ts +139 -0
- package/dist/files/image/llm.txt +429 -0
- package/dist/files/image/tokens.txt +28 -0
- package/dist/files/input/Input.tsx +261 -0
- package/dist/files/input/icons.tsx +3 -0
- package/dist/files/input/index.ts +12 -0
- package/dist/files/input/input-clear.stories.css +12 -0
- package/dist/files/input/input-size.ts +36 -0
- package/dist/files/input/input.css +366 -0
- package/dist/files/input/interface.ts +204 -0
- package/dist/files/input/lib.ts +51 -0
- package/dist/files/input/llm.txt +419 -0
- package/dist/files/input/tokens.txt +136 -0
- package/dist/files/input/variants.ts +17 -0
- package/dist/files/input-number/InputNumber.tsx +510 -0
- package/dist/files/input-number/icons.tsx +28 -0
- package/dist/files/input-number/index.ts +15 -0
- package/dist/files/input-number/input-number.css +440 -0
- package/dist/files/input-number/interface.ts +269 -0
- package/dist/files/input-number/lib.ts +128 -0
- package/dist/files/input-number/llm.txt +484 -0
- package/dist/files/input-number/tokens.txt +159 -0
- package/dist/files/input-number/variants.ts +27 -0
- package/dist/files/layout/Layout.tsx +360 -0
- package/dist/files/layout/index.ts +21 -0
- package/dist/files/layout/interface.ts +106 -0
- package/dist/files/layout/layout.css +278 -0
- package/dist/files/layout/llm.txt +296 -0
- package/dist/files/layout/tokens.txt +29 -0
- package/dist/files/llms-theme.txt +32 -0
- package/dist/files/llms.txt +895 -0
- package/dist/files/locale/en_US.ts +167 -0
- package/dist/files/locale/zh_CN.ts +166 -0
- package/dist/files/menu/Menu.stories.shared.tsx +85 -0
- package/dist/files/menu/Menu.tsx +713 -0
- package/dist/files/menu/demo/menu-sliding-panel.css +71 -0
- package/dist/files/menu/demo/use-sliding-panel.ts +35 -0
- package/dist/files/menu/icons.tsx +92 -0
- package/dist/files/menu/index.ts +17 -0
- package/dist/files/menu/interface.ts +229 -0
- package/dist/files/menu/lib.ts +160 -0
- package/dist/files/menu/llm.txt +686 -0
- package/dist/files/menu/menu.css +455 -0
- package/dist/files/menu/tokens.txt +87 -0
- package/dist/files/message/Message.tsx +217 -0
- package/dist/files/message/index.ts +2 -0
- package/dist/files/message/interface.ts +149 -0
- package/dist/files/message/lib/constants.ts +18 -0
- package/dist/files/message/lib/helpers.ts +26 -0
- package/dist/files/message/lib/motion.ts +117 -0
- package/dist/files/message/lib/store.ts +72 -0
- package/dist/files/message/llm.txt +301 -0
- package/dist/files/message/message.css +178 -0
- package/dist/files/message/tokens.txt +25 -0
- package/dist/files/modal/Modal.tsx +547 -0
- package/dist/files/modal/_adapter/locale.ts +4 -0
- package/dist/files/modal/index.ts +16 -0
- package/dist/files/modal/interface.ts +368 -0
- package/dist/files/modal/lib/ConfirmDialog.tsx +229 -0
- package/dist/files/modal/lib/confirm.tsx +112 -0
- package/dist/files/modal/lib/confirmIcons.tsx +21 -0
- package/dist/files/modal/lib/useModal.tsx +130 -0
- package/dist/files/modal/llm.txt +586 -0
- package/dist/files/modal/modal-padding.stories.css +22 -0
- package/dist/files/modal/modal.css +322 -0
- package/dist/files/modal/tokens.txt +96 -0
- package/dist/files/modal/variants.ts +41 -0
- package/dist/files/notification/Notification.tsx +354 -0
- package/dist/files/notification/index.ts +8 -0
- package/dist/files/notification/interface.ts +140 -0
- package/dist/files/notification/lib/constants.ts +40 -0
- package/dist/files/notification/lib/helpers.ts +31 -0
- package/dist/files/notification/lib/motion.ts +148 -0
- package/dist/files/notification/lib/store.ts +149 -0
- package/dist/files/notification/llm.txt +386 -0
- package/dist/files/notification/notification.css +416 -0
- package/dist/files/notification/tokens.txt +79 -0
- package/dist/files/pagination/PageButton.tsx +48 -0
- package/dist/files/pagination/PageSizeChanger.tsx +42 -0
- package/dist/files/pagination/Pagination.tsx +308 -0
- package/dist/files/pagination/QuickJumper.tsx +52 -0
- package/dist/files/pagination/TotalText.tsx +28 -0
- package/dist/files/pagination/_adapter/calculate.ts +33 -0
- package/dist/files/pagination/_adapter/locale.ts +4 -0
- package/dist/files/pagination/_adapter/responsive.ts +22 -0
- package/dist/files/pagination/_adapter/types.ts +27 -0
- package/dist/files/pagination/context.ts +15 -0
- package/dist/files/pagination/index.ts +3 -0
- package/dist/files/pagination/interface.ts +55 -0
- package/dist/files/pagination/llm.txt +204 -0
- package/dist/files/pagination/pagination.css +241 -0
- package/dist/files/pagination/tokens.txt +33 -0
- package/dist/files/pagination/useResizeObserver.ts +40 -0
- package/dist/files/pagination/variants.ts +3 -0
- package/dist/files/popover/Popover.tsx +353 -0
- package/dist/files/popover/index.ts +2 -0
- package/dist/files/popover/interface.ts +124 -0
- package/dist/files/popover/llm.txt +235 -0
- package/dist/files/popover/placement.ts +39 -0
- package/dist/files/popover/popover.css +65 -0
- package/dist/files/popover/popover.stories.css +42 -0
- package/dist/files/popover/tokens.txt +28 -0
- package/dist/files/progress/Progress.tsx +213 -0
- package/dist/files/progress/index.ts +4 -0
- package/dist/files/progress/interface.ts +89 -0
- package/dist/files/progress/llm.txt +277 -0
- package/dist/files/progress/progress.css +192 -0
- package/dist/files/progress/tokens.txt +83 -0
- package/dist/files/radio/Radio.tsx +315 -0
- package/dist/files/radio/context.tsx +16 -0
- package/dist/files/radio/helpers.ts +163 -0
- package/dist/files/radio/index.ts +13 -0
- package/dist/files/radio/interface.ts +207 -0
- package/dist/files/radio/llm.txt +344 -0
- package/dist/files/radio/radio.css +137 -0
- package/dist/files/radio/tokens.txt +21 -0
- package/dist/files/radio/variants.ts +20 -0
- package/dist/files/rate/Rate.tsx +199 -0
- package/dist/files/rate/RateItem.tsx +113 -0
- package/dist/files/rate/StarFilled.tsx +19 -0
- package/dist/files/rate/index.ts +11 -0
- package/dist/files/rate/interface.ts +116 -0
- package/dist/files/rate/lib.ts +72 -0
- package/dist/files/rate/llm.txt +237 -0
- package/dist/files/rate/rate.css +126 -0
- package/dist/files/rate/tokens.txt +20 -0
- package/dist/files/rate/variants.ts +19 -0
- package/dist/files/scrollbar.css +148 -0
- package/dist/files/select/Select.tsx +1366 -0
- package/dist/files/select/_adapter/locale.ts +4 -0
- package/dist/files/select/index.ts +17 -0
- package/dist/files/select/interface.ts +494 -0
- package/dist/files/select/llm.txt +828 -0
- package/dist/files/select/select-overflow.stories.css +3 -0
- package/dist/files/select/select.css +443 -0
- package/dist/files/select/tokens.txt +160 -0
- package/dist/files/select/variants.ts +63 -0
- package/dist/files/skeleton/Skeleton.tsx +345 -0
- package/dist/files/skeleton/index.ts +19 -0
- package/dist/files/skeleton/interface.ts +101 -0
- package/dist/files/skeleton/llm.txt +274 -0
- package/dist/files/skeleton/skeleton.css +171 -0
- package/dist/files/skeleton/tokens.txt +15 -0
- package/dist/files/skeleton/variants.ts +40 -0
- package/dist/files/spin/Spin.tsx +197 -0
- package/dist/files/spin/index.ts +2 -0
- package/dist/files/spin/interface.ts +69 -0
- package/dist/files/spin/llm.txt +294 -0
- package/dist/files/spin/spin.css +111 -0
- package/dist/files/spin/tokens.txt +21 -0
- package/dist/files/spin/variants.ts +19 -0
- package/dist/files/steps/Steps.tsx +211 -0
- package/dist/files/steps/index.ts +11 -0
- package/dist/files/steps/interface.ts +155 -0
- package/dist/files/steps/lib.ts +46 -0
- package/dist/files/steps/llm.txt +296 -0
- package/dist/files/steps/steps.css +268 -0
- package/dist/files/steps/tokens.txt +30 -0
- package/dist/files/steps/variants.ts +15 -0
- package/dist/files/switch/Switch.tsx +131 -0
- package/dist/files/switch/index.ts +2 -0
- package/dist/files/switch/interface.ts +92 -0
- package/dist/files/switch/llm.txt +212 -0
- package/dist/files/switch/switch.css +198 -0
- package/dist/files/switch/tokens.txt +38 -0
- package/dist/files/switch/variants.ts +15 -0
- package/dist/files/table/Table.stories.css +56 -0
- package/dist/files/table/Table.tsx +481 -0
- package/dist/files/table/_adapter/locale.ts +4 -0
- package/dist/files/table/constants.ts +7 -0
- package/dist/files/table/context.ts +46 -0
- package/dist/files/table/hooks/useColumnControl.ts +135 -0
- package/dist/files/table/hooks/useColumns.ts +87 -0
- package/dist/files/table/hooks/useExpandable.tsx +271 -0
- package/dist/files/table/hooks/useOverlayScrollbar.ts +304 -0
- package/dist/files/table/hooks/usePagination.ts +110 -0
- package/dist/files/table/hooks/useRowSelection.tsx +250 -0
- package/dist/files/table/hooks/useScrollShadow.ts +66 -0
- package/dist/files/table/hooks/useSkeletonRowCount.ts +78 -0
- package/dist/files/table/hooks/useTableLayoutScale.ts +38 -0
- package/dist/files/table/hooks/useTableModel.ts +91 -0
- package/dist/files/table/index.ts +24 -0
- package/dist/files/table/interface.ts +407 -0
- package/dist/files/table/llm.txt +1050 -0
- package/dist/files/table/parts/TableBody.tsx +396 -0
- package/dist/files/table/parts/TableCell.tsx +123 -0
- package/dist/files/table/parts/TableColgroup.tsx +35 -0
- package/dist/files/table/parts/TableEmpty.tsx +48 -0
- package/dist/files/table/parts/TableEmptyIllustration.tsx +27 -0
- package/dist/files/table/parts/TableHeader.tsx +102 -0
- package/dist/files/table/parts/TablePagination.tsx +46 -0
- package/dist/files/table/parts/TableRow.tsx +42 -0
- package/dist/files/table/parts/TableScrollbars.tsx +79 -0
- package/dist/files/table/parts/TableSkeleton.tsx +47 -0
- package/dist/files/table/parts/TableSummary.tsx +121 -0
- package/dist/files/table/table.css +850 -0
- package/dist/files/table/tokenScopes.ts +28 -0
- package/dist/files/table/tokens.txt +94 -0
- package/dist/files/table/utils/computeMergeGrid.ts +41 -0
- package/dist/files/table/utils/dataModel.ts +45 -0
- package/dist/files/table/utils/getCellValue.ts +7 -0
- package/dist/files/table/utils/getGroupedHeaderSpan.ts +73 -0
- package/dist/files/table/utils/getRowKey.ts +31 -0
- package/dist/files/table/utils/paginationState.ts +31 -0
- package/dist/files/table/utils/prefixSvgIds.ts +6 -0
- package/dist/files/table/utils/scaleFixedOffset.ts +19 -0
- package/dist/files/tabs/Tabs.tsx +140 -0
- package/dist/files/tabs/index.ts +2 -0
- package/dist/files/tabs/interface.ts +117 -0
- package/dist/files/tabs/llm.txt +305 -0
- package/dist/files/tabs/tabs.css +299 -0
- package/dist/files/tabs/tokens.txt +78 -0
- package/dist/files/tabs/variants.ts +51 -0
- package/dist/files/tag/Tag.tsx +180 -0
- package/dist/files/tag/index.ts +8 -0
- package/dist/files/tag/interface.ts +68 -0
- package/dist/files/tag/llm.txt +301 -0
- package/dist/files/tag/tag.css +96 -0
- package/dist/files/tag/tokens.txt +76 -0
- package/dist/files/tag/variants.ts +71 -0
- package/dist/files/theme/aliases.css +217 -0
- package/dist/files/theme/component-tokens.css +2211 -0
- package/dist/files/theme/index.css +4 -0
- package/dist/files/theme/primitives.css +182 -0
- package/dist/files/theme/static.css +13 -0
- package/dist/files/tooltip/Tooltip.tsx +362 -0
- package/dist/files/tooltip/index.ts +7 -0
- package/dist/files/tooltip/interface.ts +118 -0
- package/dist/files/tooltip/llm.txt +308 -0
- package/dist/files/tooltip/placement.ts +51 -0
- package/dist/files/tooltip/tokens.txt +22 -0
- package/dist/files/tooltip/tooltip.css +78 -0
- package/dist/files/tree/Tree.tsx +1069 -0
- package/dist/files/tree/constants.ts +2 -0
- package/dist/files/tree/index.ts +22 -0
- package/dist/files/tree/interface.ts +447 -0
- package/dist/files/tree/llm.txt +501 -0
- package/dist/files/tree/tokens.txt +36 -0
- package/dist/files/tree/tree-data.ts +260 -0
- package/dist/files/tree/tree.css +231 -0
- package/dist/files/tree/variants.ts +25 -0
- package/dist/files/tree-select/TreeSelect.tsx +864 -0
- package/dist/files/tree-select/_adapter/locale.ts +4 -0
- package/dist/files/tree-select/index.ts +23 -0
- package/dist/files/tree-select/interface.ts +415 -0
- package/dist/files/tree-select/llm.txt +754 -0
- package/dist/files/tree-select/tokens.txt +174 -0
- package/dist/files/tree-select/tree-select-data.ts +294 -0
- package/dist/files/tree-select/tree-select.css +303 -0
- package/dist/files/tree-select/variants.ts +42 -0
- package/dist/files/typography/Typography.tsx +739 -0
- package/dist/files/typography/_adapter/locale.ts +4 -0
- package/dist/files/typography/canvasTextMeasure.ts +148 -0
- package/dist/files/typography/index.ts +21 -0
- package/dist/files/typography/interface.ts +154 -0
- package/dist/files/typography/llm.txt +412 -0
- package/dist/files/typography/tokens.txt +60 -0
- package/dist/files/typography/typography.css +312 -0
- package/dist/files/typography/useEllipsisSuffix.ts +245 -0
- package/dist/files/typography/variants.ts +24 -0
- package/dist/files/upload/Upload.stories.css +54 -0
- package/dist/files/upload/Upload.stories.shared.ts +21 -0
- package/dist/files/upload/Upload.tsx +1108 -0
- package/dist/files/upload/UploadActionIcons.tsx +13 -0
- package/dist/files/upload/UploadFileIcon.tsx +52 -0
- package/dist/files/upload/_adapter/locale.ts +4 -0
- package/dist/files/upload/constants.ts +46 -0
- package/dist/files/upload/index.ts +38 -0
- package/dist/files/upload/interface.ts +302 -0
- package/dist/files/upload/lib/file-type.ts +60 -0
- package/dist/files/upload/lib/format-size.ts +6 -0
- package/dist/files/upload/lib/limits.ts +46 -0
- package/dist/files/upload/llm.txt +705 -0
- package/dist/files/upload/tokens.txt +201 -0
- package/dist/files/upload/upload.css +460 -0
- package/dist/files/utils/cn.ts +16 -0
- package/dist/files/utils/env.ts +16 -0
- package/dist/files/utils/normalizeRawSvg.ts +12 -0
- package/dist/manifest.json +580 -0
- package/package.json +41 -3
|
@@ -0,0 +1,1050 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
> Table:需要以行列形式展示、浏览结构化数据(列表、台账、报表)时。
|
|
4
|
+
|
|
5
|
+
版本:`1.2.0`。组件源码在本目录,属于当前项目。
|
|
6
|
+
|
|
7
|
+
公开导出:`Table`、`TableSummary`。
|
|
8
|
+
|
|
9
|
+
以下 API 属于 Apex UI;不要据 antd 的同名组件推断额外属性或默认值。默认值列的空缺表示未声明,不代表 `false`。
|
|
10
|
+
|
|
11
|
+
## 快速开始
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Table } from '@/components/apex/table'
|
|
15
|
+
|
|
16
|
+
const columns = [
|
|
17
|
+
{ key: 'name', title: '姓名' },
|
|
18
|
+
{ key: 'age', title: '年龄', align: 'right' as const, width: 80 },
|
|
19
|
+
{ key: 'address', title: '地址' },
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const data = [
|
|
23
|
+
{ key: '1', name: '张伟', age: 32, address: '北京市朝阳区' },
|
|
24
|
+
{ key: '2', name: '李娜', age: 28, address: '上海市浦东新区' },
|
|
25
|
+
{ key: '3', name: '王芳', age: 45, address: '广州市天河区' },
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
export default () => <Table columns={columns} data={data} />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 何时使用
|
|
32
|
+
|
|
33
|
+
- 需要以行列形式展示、浏览结构化数据(列表、台账、报表)时。
|
|
34
|
+
- 需要分页、行选择、展开子行、固定列或虚拟滚动等表格能力时。
|
|
35
|
+
- 若只需简单键值对展示或卡片列表,不必强行使用 Table。
|
|
36
|
+
|
|
37
|
+
## API
|
|
38
|
+
|
|
39
|
+
仅使用类型定义支持的属性;原生属性、ref 目标和事件签名因组件而异。关联类型用于解释字段结构;只有「导出类型」中的名称可从包根导入。
|
|
40
|
+
|
|
41
|
+
通用透传:
|
|
42
|
+
- `className` / `style` / `ref` → 包裹根 `<div>`
|
|
43
|
+
- `id` / `aria-label` 等 HTML 标准属性 → 内层 `<table>`
|
|
44
|
+
|
|
45
|
+
### Table
|
|
46
|
+
|
|
47
|
+
泛型参数:`<RecordType = Record<string, unknown>>`。
|
|
48
|
+
|
|
49
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
50
|
+
| --- | --- | --- | --- | --- |
|
|
51
|
+
| className | 追加到包裹根节点;组件内部已含 `apex-table`、`apex-default-table`、`apex-container-table`。<br>请追加而非整类替换,否则 `--table-fill-*` 等 token 可能失效。 | `string` | 否 | — |
|
|
52
|
+
| columns | 列定义 | `TableColumn<RecordType>[]` | 否 | `[]` |
|
|
53
|
+
| data | 数据;空数组渲染空态 | `RecordType[]` | 否 | `[]` |
|
|
54
|
+
| rowKey | 行键,映射到 TanStack `getRowId` | `RowKey<RecordType>` | 否 | `'key'` |
|
|
55
|
+
| loading | 加载态;普通表格用 3 行骨架占位,`scroll.y` / `flexHeight` 场景按表体可用高度自动填满。<br>骨架行高跟随 `size`(`--table-size-height-content` + block padding,视觉 28/32/40),加载时替换数据行。 | `boolean` | 否 | `false` |
|
|
56
|
+
| size | 尺寸;`small` / `medium` / `large` 对应 token 的 sm / md / la。<br>单元格内容区最小高度为 `--table-size-height-content`,加上 `--table-spacing-padding-y` 后视觉下限 28/32/40。<br>表体可继续被内容撑高,不锁死行高。<br>字号全 size 一致:表头 `text-*-body`(14/20),内容 `text-*-caption`(12/18)。<br>非 `ellipsis` 纯文本列可多行撑高;`ellipsis` 纯文本列保持单行截断。<br>- `small` — 紧凑<br>- `medium` — 标准<br>- `large` — 宽松(默认) | `"small" \| "medium" \| "large"` | 否 | `'large'` |
|
|
57
|
+
| showHeader | 是否渲染 `<thead>` | `boolean` | 否 | `true` |
|
|
58
|
+
| rowClassName | 行 className | `string \| ((record: RecordType, index: number) => string)` | 否 | — |
|
|
59
|
+
| onRow | 行原生属性透传 | `(record: RecordType, index: number) => React.HTMLAttributes<HTMLTableRowElement>` | 否 | — |
|
|
60
|
+
| pagination | 分页配置;`false` 关闭分页区 | `false \| TablePaginationConfig` | 否 | — |
|
|
61
|
+
| scroll | 内置滚动容器配置;设置后由 table 内部容器负责滚动。 | `TableScrollConfig` | 否 | — |
|
|
62
|
+
| flexHeight | 填充父容器高度:根节点变为 flex 列并占满父级可用高度,表体在内部容器纵向滚动、表头吸顶,分页固定在底部。<br>需父级为受限高度的 flex 容器(或给 Table 定高 / `flex: 1`)。<br>与 `scroll.y` 互斥,同时设置时以 `flexHeight` 为准(忽略 `scroll.y` 的 `max-height`)。 | `boolean` | 否 | `false` |
|
|
63
|
+
| virtual | 虚拟滚动:仅渲染可视窗口内的行,适用于大量数据。<br>需配合 `scroll.y` 或 `flexHeight` 提供受限高度容器;无受限高度时自动降级为非虚拟。<br>与 `mergeRows` / `cellSpan` 纵向合并不兼容(虚拟开启时跳过合并)。 | `boolean \| TableVirtualConfig` | 否 | `false` |
|
|
64
|
+
| rowSelection | 行选择配置;省略则不渲染选择列 | `TableRowSelection<RecordType>` | 否 | — |
|
|
65
|
+
| expandable | 行分组 / 展开配置;省略则不启用展开能力 | `TableExpandableConfig<RecordType>` | 否 | — |
|
|
66
|
+
| summary | 总结栏渲染函数。返回 `Table.Summary` 复合组件树,组件将其渲染为 `<tfoot>`。<br>入参 `currentData` 为当前页数据(开启分页时为分页切片)。 | `(currentData: RecordType[]) => React.ReactNode` | 否 | — |
|
|
67
|
+
| emptyText | 自定义空态内容(单表级)。<br>优先级:`emptyText` prop > `ApexProvider` 的 `locale.Table.emptyText` > 内置默认文案。 | `React.ReactNode` | 否 | — |
|
|
68
|
+
| hiddenColumnKeys | 受控隐藏列的 key 数组(列显隐机制)。<br>仅提供受控机制;触发器 UI / 持久化由消费方实现。prefix 列(选择 / 展开)不受影响。 | `Key[]` | 否 | — |
|
|
69
|
+
| defaultHiddenColumnKeys | 非受控初始隐藏列 key 数组。 | `Key[]` | 否 | `[]` |
|
|
70
|
+
| onHiddenColumnKeysChange | 隐藏列变化回调 | `(hiddenKeys: Key[]) => void` | 否 | — |
|
|
71
|
+
| columnOrder | 受控列顺序(按列 key 排列;列排序机制)。<br>**仅平铺列支持**:多级表头(含 `children` 的分组列)场景不支持列排序,显隐仍可用。<br>prefix 列(选择 / 展开)恒定排在最前,不进入此数组。 | `Key[]` | 否 | — |
|
|
72
|
+
| defaultColumnOrder | 非受控初始列顺序 | `Key[]` | 否 | — |
|
|
73
|
+
| onColumnOrderChange | 列顺序变化回调 | `(columnOrder: Key[]) => void` | 否 | — |
|
|
74
|
+
| ref | 包裹根 div 的 ref(React 19 直接作为 prop) | `React.Ref<HTMLDivElement>` | 否 | — |
|
|
75
|
+
|
|
76
|
+
### TableEllipsisConfig
|
|
77
|
+
|
|
78
|
+
列截断配置,与 `TypographyEllipsisConfig` 一致(`boolean | TypographyEllipsisConfig`)。
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
type TableEllipsisConfig = boolean | TypographyEllipsisConfig
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### TableRowSelection
|
|
85
|
+
|
|
86
|
+
泛型参数:`<RecordType = Record<string, unknown>>`。
|
|
87
|
+
|
|
88
|
+
行选择配置。受控 / 非受控双轨;变化时同步触发 `onChange`。
|
|
89
|
+
|
|
90
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
91
|
+
| --- | --- | --- | --- | --- |
|
|
92
|
+
| type | 选中模式 | `"checkbox" \| "radio"` | 否 | `'checkbox'` |
|
|
93
|
+
| selectedRowKeys | 受控已选 row key 数组 | `Key[]` | 否 | — |
|
|
94
|
+
| defaultSelectedRowKeys | 非受控初始已选 row key 数组 | `Key[]` | 否 | `[]` |
|
|
95
|
+
| columnWidth | 选择列宽 | `number \| string` | 否 | `48(`showIndex` 为 true)/ 40(`showIndex` 为 false)` |
|
|
96
|
+
| hideSelectAll | 是否隐藏全选 checkbox(仅 `checkbox` 模式) | `boolean` | 否 | `false` |
|
|
97
|
+
| showIndex | 是否将序号与选择列合并:默认显示序号,行 hover / 已选 / 键盘焦点时切换为选择控件。<br>序号按当前页连续编号(分页时为全局序号:`(current - 1) * pageSize + index + 1`)。 | `boolean` | 否 | `true` |
|
|
98
|
+
| fixed | 固定选择列方向;须配合 `scroll.x` 与数字 `columnWidth` 使用 | `"left" \| "right"` | 否 | — |
|
|
99
|
+
| onChange | 选中变化回调 | `(selectedRowKeys: Key[], selectedRows: RecordType[]) => void` | 否 | — |
|
|
100
|
+
| getCheckboxProps | 单行禁用配置 | `(record: RecordType) => { disabled?: boolean }` | 否 | — |
|
|
101
|
+
|
|
102
|
+
### TableExpandIconProps
|
|
103
|
+
|
|
104
|
+
泛型参数:`<RecordType = Record<string, unknown>>`。
|
|
105
|
+
|
|
106
|
+
展开图标 render props(面板 / 树形共用)。
|
|
107
|
+
|
|
108
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
109
|
+
| --- | --- | --- | --- | --- |
|
|
110
|
+
| expanded | — | `boolean` | 是 | — |
|
|
111
|
+
| onExpand | — | `(event: React.MouseEvent<HTMLElement>) => void` | 是 | — |
|
|
112
|
+
| record | — | `RecordType` | 是 | — |
|
|
113
|
+
|
|
114
|
+
### TableExpandableConfig
|
|
115
|
+
|
|
116
|
+
泛型参数:`<RecordType = Record<string, unknown>>`。
|
|
117
|
+
|
|
118
|
+
行分组 / 展开配置。
|
|
119
|
+
|
|
120
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
121
|
+
| --- | --- | --- | --- | --- |
|
|
122
|
+
| childrenColumnName | 嵌套子行字段名(树形模式) | `string` | 否 | `'children'` |
|
|
123
|
+
| columnTitle | 展开列表头 | `React.ReactNode` | 否 | — |
|
|
124
|
+
| columnWidth | 展开列宽(面板模式) | `number \| string` | 否 | `48` |
|
|
125
|
+
| indentSize | 树形缩进像素(树形模式) | `number` | 否 | `15` |
|
|
126
|
+
| expandedRowKeys | 受控已展开 row key 数组 | `Key[]` | 否 | — |
|
|
127
|
+
| defaultExpandedRowKeys | 非受控初始已展开 row key 数组 | `Key[]` | 否 | `[]` |
|
|
128
|
+
| expandedRowRender | 展开行自定义面板(面板模式) | `( record: RecordType, index: number, indent: number, expanded: boolean, ) => React.ReactNode` | 否 | — |
|
|
129
|
+
| expandIcon | 自定义展开图标 | `(props: TableExpandIconProps<RecordType>) => React.ReactNode` | 否 | — |
|
|
130
|
+
| expandRowByClick | 点击整行展开/收起(面板模式) | `boolean` | 否 | `false` |
|
|
131
|
+
| rowExpandable | 行是否可展开 | `(record: RecordType) => boolean` | 否 | — |
|
|
132
|
+
| showExpandColumn | 是否显示展开列(面板模式) | `boolean` | 否 | `true` |
|
|
133
|
+
| expandedRowClassName | 展开面板行 className | `string \| ((record: RecordType, index: number, indent: number) => string)` | 否 | — |
|
|
134
|
+
| fixed | 固定展开列方向(面板模式) | `"left" \| "right"` | 否 | — |
|
|
135
|
+
| onExpand | 展开/收起单行回调 | `(expanded: boolean, record: RecordType) => void` | 否 | — |
|
|
136
|
+
| onExpandedRowsChange | 已展开 keys 变化回调 | `(expandedKeys: Key[]) => void` | 否 | — |
|
|
137
|
+
|
|
138
|
+
### TableColumn
|
|
139
|
+
|
|
140
|
+
泛型参数:`<RecordType = Record<string, unknown>>`。
|
|
141
|
+
|
|
142
|
+
单列定义。
|
|
143
|
+
|
|
144
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
145
|
+
| --- | --- | --- | --- | --- |
|
|
146
|
+
| key | 列标识;数组形式表示深路径 | `DataIndex` | 否 | — |
|
|
147
|
+
| title | 表头单元格 | `React.ReactNode` | 否 | — |
|
|
148
|
+
| renderHeader | 自定义列头渲染回调。返回值作为表头内容,优先级高于 `title`。<br>入参为当前列定义(含已声明的 `title` / `key` / `align` 等),便于在默认标题外附加图标/排序/操作。<br>分组列(含 `children`)同样适用,渲染其父表头。<br>注:参数采用非泛型列定义,避免列类型对 `RecordType` 不变(invariant)。 | `(column: TableColumn) => React.ReactNode` | 否 | — |
|
|
149
|
+
| render | 自定义单元格 | `(text: unknown, record: RecordType, index: number) => React.ReactNode` | 否 | — |
|
|
150
|
+
| align | 单元格对齐 | `"left" \| "right" \| "center"` | 否 | `'left'` |
|
|
151
|
+
| className | 列 className(写到 td/th 上) | `string` | 否 | — |
|
|
152
|
+
| width | 列宽 | `string \| number` | 否 | — |
|
|
153
|
+
| minWidth | 列最小宽 | `number` | 否 | `50` |
|
|
154
|
+
| ellipsis | 截断模式,API 与 `Typography.Text` 的 `ellipsis` 一致。<br>- `true`:单行截断,Table 层默认溢出 Tooltip(等价 `{ rows: 1, tooltip: true }`)。<br>- `{ rows: 1 }`:单行截断,**无**默认 Tooltip;`\n` 折叠为空格,不启用硬换行。<br>- `{ rows: N }` 当 **N ≥ 2**:多行 `-webkit-line-clamp`;`\n` 计入视觉行数。<br>含 `\n` 且需控行高时推荐 `{ rows: 2, tooltip: true }` 起(见 `index.md` D15)。<br>- 对象形态可细调 `tooltip`、`rows`、`position` 等。<br>仅对**纯文本**(string / number)内容生效;当 `render` 返回 ReactNode(组件)时<br>自动转为**弹性高度**:不截断、行高随内容自适应。 | `TableEllipsisConfig` | 否 | `false` |
|
|
155
|
+
| onCell | 单元格原生属性透传(不承载合并语义)。 | `(record: RecordType, rowIndex: number) => React.HTMLAttributes<HTMLTableCellElement>` | 否 | — |
|
|
156
|
+
| mergeRows | 纵向合并相邻相同值。`true` 按列取值比较;函数返回分组键比较。<br>组件自动计算 `rowSpan` 并跳过被覆盖格。与 `cellSpan` 同时存在时以 `cellSpan` 为准。 | `boolean \| ((record: RecordType, index: number) => Key)` | 否 | — |
|
|
157
|
+
| cellSpan | 不规则 / 横向合并逃生口。仅在起点返回 `rowSpan` / `colSpan`。<br>跨度仅接受有限正整数;非法值按 `1` 处理,超出范围时分别截断到当前页剩余行数<br>和剩余可见叶子列数。组件按占位矩阵自动跳过被覆盖格。 | `( record: RecordType, index: number, ) => { rowSpan?: number; colSpan?: number } \| undefined` | 否 | — |
|
|
158
|
+
| colSpan | 表头同行内叶子列横向合并跨度。仅接受有限正整数;非法值按 `1` 处理,<br>超出范围时截断到剩余可见叶子列数。起点列声明即可,被覆盖列自动跳过。 | `number` | 否 | — |
|
|
159
|
+
| children | 多级表头:带 `children` 即为分组列,`title` 作父表头;仅叶子列承载数据与 body 合并。 | `TableColumn<RecordType>[]` | 否 | — |
|
|
160
|
+
| fixed | 固定列方向。固定列必须提供数字 `width`(像素),且需配合 `scroll.x` 使用。 | `"left" \| "right"` | 否 | — |
|
|
161
|
+
|
|
162
|
+
### TablePaginationConfig
|
|
163
|
+
|
|
164
|
+
分页配置,与 Apex `PaginationProps` 完全对齐。
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
等价写法:`TablePaginationConfig` ≡ `PaginationProps`
|
|
168
|
+
|
|
169
|
+
### TableVirtualConfig
|
|
170
|
+
|
|
171
|
+
虚拟滚动配置。
|
|
172
|
+
|
|
173
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
174
|
+
| --- | --- | --- | --- | --- |
|
|
175
|
+
| itemSize | 预估行高(px),用于初始定位;实际高度由动态测量校正。<br>默认按 `size` 推导:small=28 / medium=32 / large=40 | `number` | 否 | — |
|
|
176
|
+
| overscan | 视口外预渲染行数 | `number` | 否 | `6` |
|
|
177
|
+
|
|
178
|
+
### TableSummaryFixed
|
|
179
|
+
|
|
180
|
+
总结栏固定位置。`true` 等价于 `'bottom'`。
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
type TableSummaryFixed = boolean | 'top' | 'bottom'
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### TableSummaryProps
|
|
187
|
+
|
|
188
|
+
`Table.Summary` 根节点 props。
|
|
189
|
+
|
|
190
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
191
|
+
| --- | --- | --- | --- | --- |
|
|
192
|
+
| fixed | 总结栏位置。`true` 或 `'bottom'` 时钉在表体容器底部(需 `scroll.y` / `flexHeight` / `virtual`);内容不够高时合计与数据行之间留白。`'top'` 为吸顶。 | `TableSummaryFixed` | 否 | `false` |
|
|
193
|
+
| className | 追加 className | `string` | 否 | — |
|
|
194
|
+
| children | — | `React.ReactNode` | 否 | — |
|
|
195
|
+
|
|
196
|
+
### TableSummaryRowProps
|
|
197
|
+
|
|
198
|
+
继承:`React.HTMLAttributes<HTMLTableRowElement>`;本节列出新增或重声明字段。
|
|
199
|
+
|
|
200
|
+
`Table.Summary.Row` props。
|
|
201
|
+
|
|
202
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
203
|
+
| --- | --- | --- | --- | --- |
|
|
204
|
+
| children | — | `React.ReactNode` | 否 | — |
|
|
205
|
+
|
|
206
|
+
### TableSummaryCellProps
|
|
207
|
+
|
|
208
|
+
继承:`React.HTMLAttributes<HTMLTableCellElement>`;本节列出新增或重声明字段。
|
|
209
|
+
|
|
210
|
+
`Table.Summary.Cell` props。
|
|
211
|
+
|
|
212
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
213
|
+
| --- | --- | --- | --- | --- |
|
|
214
|
+
| index | 对应叶子列索引(含选择列 / 展开列等 prefix 列)。 | `number` | 是 | — |
|
|
215
|
+
| colSpan | 横向合并跨度(>= 2)。 | `number` | 否 | — |
|
|
216
|
+
| rowSpan | 纵向合并跨度(>= 2)。 | `number` | 否 | — |
|
|
217
|
+
| align | 单元格对齐;未指定时继承对应叶子列的 `align`。 | `"left" \| "right" \| "center"` | 否 | `'left'` |
|
|
218
|
+
| children | — | `React.ReactNode` | 否 | — |
|
|
219
|
+
|
|
220
|
+
### TableScrollConfig
|
|
221
|
+
|
|
222
|
+
内置滚动容器配置。
|
|
223
|
+
|
|
224
|
+
| 属性 | 说明 | 类型 | 必填 | 默认值 |
|
|
225
|
+
| --- | --- | --- | --- | --- |
|
|
226
|
+
| x | 横向滚动宽度;设置后,表格内部容器负责横向滚动。 | `number \| string` | 否 | — |
|
|
227
|
+
| y | 纵向滚动高度;设置后,表格内部容器负责纵向滚动,表头吸顶。 | `number \| string` | 否 | — |
|
|
228
|
+
|
|
229
|
+
### Key
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
type Key = string | number
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### DataIndex
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
type DataIndex = string | readonly string[]
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### AlignValue
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
type AlignValue = 'left' | 'center' | 'right'
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### RowKey
|
|
248
|
+
|
|
249
|
+
泛型参数:`<RecordType>`。
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
type RowKey<RecordType> = string | keyof RecordType | ((record: RecordType, index: number) => Key)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
其他组件的类型不在此展开:`TypographyEllipsisConfig` 见 `../typography/llm.txt`、`PaginationProps` 见 `../pagination/llm.txt`。
|
|
256
|
+
|
|
257
|
+
### 导出类型
|
|
258
|
+
|
|
259
|
+
类型从本组件目录导入:`AlignValue`、`DataIndex`、`EllipsisConfig`、`Key`、`PaginationState`、`RowKey`、`TableColumn`、`TablePaginationConfig`、`TableProps`、`TableRowSelection`、`TableSummaryCellProps`、`TableSummaryFixed`、`TableSummaryLeafColumn`、`TableSummaryProps`、`TableSummaryRowProps`、`TableVirtualConfig`(与上文子类型配合使用)。
|
|
260
|
+
|
|
261
|
+
## 代码演示
|
|
262
|
+
|
|
263
|
+
### 尺寸
|
|
264
|
+
|
|
265
|
+
通过 `size` 切换密度:表头最小高度 `small`(28px)/ `medium`(32px)/ `large`(40px,默认);表体行高由内容撑开。字号在各档保持一致:表头 14px、内容 12px。
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
import { Table } from '@/components/apex/table'
|
|
269
|
+
|
|
270
|
+
const columns = [{ key: 'name', title: '姓名' }]
|
|
271
|
+
|
|
272
|
+
const data = [{ key: '1', name: '示例' }]
|
|
273
|
+
|
|
274
|
+
export default () => (
|
|
275
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
|
|
276
|
+
<Table columns={columns} data={data} size="small" />
|
|
277
|
+
<Table columns={columns} data={data} size="medium" />
|
|
278
|
+
<Table columns={columns} data={data} size="large" />
|
|
279
|
+
</div>
|
|
280
|
+
)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### 加载中
|
|
284
|
+
|
|
285
|
+
`loading` 为 `true` 时显示骨架屏加载态。骨架行高跟随 `size`,各行列宽保持一致,固定高度与自适应高度表格都能完整填充内容区。
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
import { Table } from '@/components/apex/table'
|
|
289
|
+
|
|
290
|
+
const columns = [
|
|
291
|
+
{ key: 'name', title: '姓名' },
|
|
292
|
+
{ key: 'status', title: '状态' },
|
|
293
|
+
]
|
|
294
|
+
|
|
295
|
+
const data = [{ key: '1', name: '加载中示例', status: '处理中' }]
|
|
296
|
+
|
|
297
|
+
export default () => <Table columns={columns} data={data} loading />
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### 空数据
|
|
301
|
+
|
|
302
|
+
`data` 为空数组时渲染空态;可用 `emptyText` 覆盖默认文案或传入自定义节点。
|
|
303
|
+
|
|
304
|
+
```tsx
|
|
305
|
+
import { Table } from '@/components/apex/table'
|
|
306
|
+
|
|
307
|
+
const columns = [
|
|
308
|
+
{ key: 'name', title: '姓名' },
|
|
309
|
+
{ key: 'age', title: '年龄' },
|
|
310
|
+
{ key: 'address', title: '地址' },
|
|
311
|
+
]
|
|
312
|
+
|
|
313
|
+
export default () => <Table columns={columns} data={[]} />
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### 自定义空态
|
|
317
|
+
|
|
318
|
+
`emptyText` 支持任意 `自定义节点`,可嵌入操作按钮或插画。
|
|
319
|
+
|
|
320
|
+
```tsx
|
|
321
|
+
import { Button } from '@/components/apex/button'
|
|
322
|
+
import { Table } from '@/components/apex/table'
|
|
323
|
+
|
|
324
|
+
const columns = [
|
|
325
|
+
{ key: 'name', title: '姓名' },
|
|
326
|
+
{ key: 'age', title: '年龄', align: 'right' as const, width: 80 },
|
|
327
|
+
{ key: 'address', title: '地址' },
|
|
328
|
+
]
|
|
329
|
+
|
|
330
|
+
export default () => (
|
|
331
|
+
<Table
|
|
332
|
+
columns={columns}
|
|
333
|
+
data={[]}
|
|
334
|
+
emptyText={
|
|
335
|
+
<div style={{ padding: '24px 0' }}>
|
|
336
|
+
<p style={{ margin: 0 }}>暂无符合条件的记录</p>
|
|
337
|
+
<Button type="primary" style={{ marginTop: 8 }}>
|
|
338
|
+
去创建
|
|
339
|
+
</Button>
|
|
340
|
+
</div>
|
|
341
|
+
}
|
|
342
|
+
/>
|
|
343
|
+
)
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### 分页
|
|
347
|
+
|
|
348
|
+
通过 `pagination` 配置分页;设为 `false` 可关闭分页区。内嵌分页器保留 Pagination 自身的 36px 高度与容器留白,开启 `showSizeChanger` 或 `showQuickJumper` 时仍与独立 Pagination 保持一致。
|
|
349
|
+
|
|
350
|
+
```tsx
|
|
351
|
+
import { Table } from '@/components/apex/table'
|
|
352
|
+
|
|
353
|
+
const columns = [
|
|
354
|
+
{ key: 'name', title: '姓名' },
|
|
355
|
+
{ key: 'age', title: '年龄', align: 'right' as const, width: 80 },
|
|
356
|
+
{ key: 'address', title: '地址' },
|
|
357
|
+
]
|
|
358
|
+
|
|
359
|
+
const data = Array.from({ length: 23 }, (_, i) => ({
|
|
360
|
+
key: String(i + 1),
|
|
361
|
+
name: `用户 ${i + 1}`,
|
|
362
|
+
age: 20 + (i % 30),
|
|
363
|
+
address: `城市 ${i + 1} 区`,
|
|
364
|
+
}))
|
|
365
|
+
|
|
366
|
+
export default () => (
|
|
367
|
+
<Table
|
|
368
|
+
columns={columns}
|
|
369
|
+
data={data}
|
|
370
|
+
pagination={{ defaultPageSize: 10, showSizeChanger: true }}
|
|
371
|
+
/>
|
|
372
|
+
)
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### 纵向滚动
|
|
376
|
+
|
|
377
|
+
通过 `scroll.y` 限制表体高度,由表格内部容器负责纵向滚动,表头吸顶。
|
|
378
|
+
|
|
379
|
+
```tsx
|
|
380
|
+
import { Table } from '@/components/apex/table'
|
|
381
|
+
|
|
382
|
+
const columns = [
|
|
383
|
+
{ key: 'name', title: '姓名' },
|
|
384
|
+
{ key: 'age', title: '年龄', align: 'right' as const, width: 80 },
|
|
385
|
+
{ key: 'address', title: '地址' },
|
|
386
|
+
]
|
|
387
|
+
|
|
388
|
+
const data = Array.from({ length: 50 }, (_, i) => ({
|
|
389
|
+
key: String(i + 1),
|
|
390
|
+
name: `用户 ${String(i + 1).padStart(3, '0')}`,
|
|
391
|
+
age: 18 + (i % 50),
|
|
392
|
+
address: `城市 ${(i % 10) + 1} 区 街道 ${i + 1} 号`,
|
|
393
|
+
}))
|
|
394
|
+
|
|
395
|
+
export default () => (
|
|
396
|
+
<Table columns={columns} data={data} size="small" pagination={false} scroll={{ y: 300 }} />
|
|
397
|
+
)
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### 横向滚动
|
|
401
|
+
|
|
402
|
+
当列总宽超出容器时,通过 `scroll.x` 开启横向滚动;固定列须配合 `scroll.x` 与数字 `width` 使用。
|
|
403
|
+
|
|
404
|
+
```tsx
|
|
405
|
+
import { Table } from '@/components/apex/table'
|
|
406
|
+
|
|
407
|
+
const columns = [
|
|
408
|
+
{ key: 'id', title: 'ID', width: 80 },
|
|
409
|
+
{ key: 'name', title: '姓名', width: 120 },
|
|
410
|
+
{ key: 'age', title: '年龄', align: 'right' as const, width: 80 },
|
|
411
|
+
{ key: 'email', title: '邮箱', width: 200 },
|
|
412
|
+
{ key: 'department', title: '部门', width: 140 },
|
|
413
|
+
{ key: 'city', title: '城市', width: 120 },
|
|
414
|
+
{ key: 'address', title: '地址', width: 240 },
|
|
415
|
+
{ key: 'status', title: '状态', width: 100 },
|
|
416
|
+
]
|
|
417
|
+
|
|
418
|
+
const data = Array.from({ length: 8 }, (_, index) => ({
|
|
419
|
+
key: String(index + 1),
|
|
420
|
+
id: index + 1,
|
|
421
|
+
name: `用户 ${String(index + 1).padStart(3, '0')}`,
|
|
422
|
+
age: 22 + (index % 20),
|
|
423
|
+
email: `user${index + 1}@example.com`,
|
|
424
|
+
department: `部门 ${(index % 4) + 1}`,
|
|
425
|
+
city: `城市 ${(index % 5) + 1}`,
|
|
426
|
+
address: `街道 ${index + 1} 号`,
|
|
427
|
+
status: index % 2 === 0 ? '在职' : '离职',
|
|
428
|
+
}))
|
|
429
|
+
|
|
430
|
+
export default () => (
|
|
431
|
+
<Table
|
|
432
|
+
columns={columns}
|
|
433
|
+
data={data}
|
|
434
|
+
size="small"
|
|
435
|
+
pagination={false}
|
|
436
|
+
scroll={{ x: 1100 }}
|
|
437
|
+
style={{ width: 600 }}
|
|
438
|
+
/>
|
|
439
|
+
)
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### 行选择
|
|
443
|
+
|
|
444
|
+
配置 `rowSelection` 开启多选或单选列。默认将**序号与选择列合并**:单元格显示行号,鼠标悬停当前行(或已选 / 键盘焦点)时切换为复选框;点击即可选中。设 `showIndex: false` 可恢复为始终显示选择控件。分页开启时序号为全局连续编号。
|
|
445
|
+
|
|
446
|
+
```tsx
|
|
447
|
+
import { Table } from '@/components/apex/table'
|
|
448
|
+
|
|
449
|
+
import { useState } from 'react'
|
|
450
|
+
|
|
451
|
+
const columns = [
|
|
452
|
+
{ key: 'name', title: '姓名' },
|
|
453
|
+
{ key: 'age', title: '年龄', align: 'right' as const, width: 80 },
|
|
454
|
+
{ key: 'address', title: '地址' },
|
|
455
|
+
]
|
|
456
|
+
|
|
457
|
+
const data = [
|
|
458
|
+
{ key: '1', name: '张伟', age: 32, address: '北京市朝阳区' },
|
|
459
|
+
{ key: '2', name: '李娜', age: 28, address: '上海市浦东新区' },
|
|
460
|
+
{ key: '3', name: '王芳', age: 45, address: '广州市天河区' },
|
|
461
|
+
]
|
|
462
|
+
|
|
463
|
+
export default () => {
|
|
464
|
+
const [selectedKeys, setSelectedKeys] = useState<Array<string | number>>(['2'])
|
|
465
|
+
|
|
466
|
+
return (
|
|
467
|
+
<Table
|
|
468
|
+
columns={columns}
|
|
469
|
+
data={data}
|
|
470
|
+
rowSelection={{
|
|
471
|
+
selectedRowKeys: selectedKeys,
|
|
472
|
+
onChange: (nextKeys) => setSelectedKeys(nextKeys),
|
|
473
|
+
}}
|
|
474
|
+
/>
|
|
475
|
+
)
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### 固定选择列
|
|
480
|
+
|
|
481
|
+
`rowSelection.fixed` 可将选择列固定在左侧或右侧;须配合 `scroll.x` 与数字 `columnWidth` 使用。与 `column.fixed: 'left'` 叠加时,选择列始终在最左并参与偏移计算。
|
|
482
|
+
|
|
483
|
+
本例设置 `rowSelection.showIndex: false`,复选框始终显示,无需悬停行。
|
|
484
|
+
|
|
485
|
+
```tsx
|
|
486
|
+
import { Button } from '@/components/apex/button'
|
|
487
|
+
import { Table } from '@/components/apex/table'
|
|
488
|
+
|
|
489
|
+
import { useState } from 'react'
|
|
490
|
+
|
|
491
|
+
const columns = [
|
|
492
|
+
{ key: 'name', title: '姓名', width: 100, fixed: 'left' as const },
|
|
493
|
+
{ key: 'department', title: '部门', width: 100 },
|
|
494
|
+
{ key: 'city', title: '城市', width: 100 },
|
|
495
|
+
{ key: 'phone', title: '电话', width: 160 },
|
|
496
|
+
{ key: 'email', title: '邮箱', width: 200 },
|
|
497
|
+
{
|
|
498
|
+
key: 'action',
|
|
499
|
+
title: '操作',
|
|
500
|
+
width: 80,
|
|
501
|
+
align: 'center' as const,
|
|
502
|
+
fixed: 'right' as const,
|
|
503
|
+
render: () => (
|
|
504
|
+
<Button
|
|
505
|
+
type="text"
|
|
506
|
+
size="small"
|
|
507
|
+
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 0 }}
|
|
508
|
+
>
|
|
509
|
+
编辑
|
|
510
|
+
</Button>
|
|
511
|
+
),
|
|
512
|
+
},
|
|
513
|
+
]
|
|
514
|
+
|
|
515
|
+
const data = Array.from({ length: 8 }, (_, i) => ({
|
|
516
|
+
key: String(i + 1),
|
|
517
|
+
name: `用户 ${i + 1}`,
|
|
518
|
+
department: '研发部',
|
|
519
|
+
city: '上海',
|
|
520
|
+
phone: '13800000000',
|
|
521
|
+
email: `user${i + 1}@example.com`,
|
|
522
|
+
}))
|
|
523
|
+
|
|
524
|
+
export default () => {
|
|
525
|
+
const [selectedKeys, setSelectedKeys] = useState<Array<string | number>>([])
|
|
526
|
+
|
|
527
|
+
return (
|
|
528
|
+
<div style={{ width: 700 }}>
|
|
529
|
+
<Table
|
|
530
|
+
columns={columns}
|
|
531
|
+
data={data}
|
|
532
|
+
scroll={{ x: 900 }}
|
|
533
|
+
pagination={false}
|
|
534
|
+
rowSelection={{
|
|
535
|
+
fixed: 'left',
|
|
536
|
+
showIndex: false,
|
|
537
|
+
columnWidth: 48,
|
|
538
|
+
selectedRowKeys: selectedKeys,
|
|
539
|
+
onChange: (keys) => setSelectedKeys(keys),
|
|
540
|
+
}}
|
|
541
|
+
/>
|
|
542
|
+
</div>
|
|
543
|
+
)
|
|
544
|
+
}
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
### 文本截断与 Tooltip
|
|
548
|
+
|
|
549
|
+
纯文本列设置 `ellipsis: { tooltip: true }` 时,内容溢出后 hover 弹出 Tooltip 显示完整文本。
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
import { Table } from '@/components/apex/table'
|
|
553
|
+
|
|
554
|
+
const columns = [
|
|
555
|
+
{ key: 'name', title: '姓名', width: 80 },
|
|
556
|
+
{
|
|
557
|
+
key: 'address',
|
|
558
|
+
title: '地址',
|
|
559
|
+
width: 120,
|
|
560
|
+
ellipsis: { tooltip: true },
|
|
561
|
+
},
|
|
562
|
+
]
|
|
563
|
+
|
|
564
|
+
const data = [
|
|
565
|
+
{
|
|
566
|
+
key: '1',
|
|
567
|
+
name: '张伟',
|
|
568
|
+
address:
|
|
569
|
+
'北京市朝阳区某某街道某某社区某某大厦 1234 号楼 5678 室(超长地址用于触发截断与 Tooltip)',
|
|
570
|
+
},
|
|
571
|
+
]
|
|
572
|
+
|
|
573
|
+
export default () => (
|
|
574
|
+
<div style={{ width: 240 }}>
|
|
575
|
+
<Table columns={columns} data={data} pagination={false} />
|
|
576
|
+
</div>
|
|
577
|
+
)
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### 列显隐
|
|
581
|
+
|
|
582
|
+
通过 `hiddenColumnKeys` / 列显隐变化事件 受控隐藏列;选择列、展开列不受影响。
|
|
583
|
+
|
|
584
|
+
```tsx
|
|
585
|
+
import { Button } from '@/components/apex/button'
|
|
586
|
+
import { Table } from '@/components/apex/table'
|
|
587
|
+
|
|
588
|
+
import { useState } from 'react'
|
|
589
|
+
|
|
590
|
+
const columns = [
|
|
591
|
+
{ key: 'name', title: '姓名' },
|
|
592
|
+
{ key: 'age', title: '年龄', align: 'right' as const, width: 80 },
|
|
593
|
+
{ key: 'address', title: '地址' },
|
|
594
|
+
]
|
|
595
|
+
|
|
596
|
+
const data = [
|
|
597
|
+
{ key: '1', name: '张伟', age: 32, address: '北京市朝阳区' },
|
|
598
|
+
{ key: '2', name: '李娜', age: 28, address: '上海市浦东新区' },
|
|
599
|
+
]
|
|
600
|
+
|
|
601
|
+
export default () => {
|
|
602
|
+
const [hidden, setHidden] = useState<Array<string | number>>(['age'])
|
|
603
|
+
|
|
604
|
+
return (
|
|
605
|
+
<div>
|
|
606
|
+
<Button
|
|
607
|
+
style={{ marginBottom: 12 }}
|
|
608
|
+
onClick={() =>
|
|
609
|
+
setHidden((prev) =>
|
|
610
|
+
prev.includes('age') ? prev.filter((k) => k !== 'age') : [...prev, 'age'],
|
|
611
|
+
)
|
|
612
|
+
}
|
|
613
|
+
>
|
|
614
|
+
切换「年龄」列
|
|
615
|
+
</Button>
|
|
616
|
+
<Table
|
|
617
|
+
columns={columns}
|
|
618
|
+
data={data}
|
|
619
|
+
pagination={false}
|
|
620
|
+
hiddenColumnKeys={hidden}
|
|
621
|
+
onHiddenColumnKeysChange={setHidden}
|
|
622
|
+
/>
|
|
623
|
+
</div>
|
|
624
|
+
)
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### 自定义渲染
|
|
629
|
+
|
|
630
|
+
通过 `column.render` 自定义单元格内容。
|
|
631
|
+
|
|
632
|
+
```tsx
|
|
633
|
+
import type { TableColumn } from '@/components/apex/table'
|
|
634
|
+
|
|
635
|
+
import { Button } from '@/components/apex/button'
|
|
636
|
+
import { Table } from '@/components/apex/table'
|
|
637
|
+
import { Tag } from '@/components/apex/tag'
|
|
638
|
+
|
|
639
|
+
type OrderRecord = {
|
|
640
|
+
key: string
|
|
641
|
+
order: string
|
|
642
|
+
customer: string
|
|
643
|
+
amount: number
|
|
644
|
+
status: 'paid' | 'pending' | 'refunded'
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
const data: OrderRecord[] = [
|
|
648
|
+
{ key: '1', order: 'SO-202605-001', customer: '张伟', amount: 1280, status: 'paid' },
|
|
649
|
+
{ key: '2', order: 'SO-202605-002', customer: '李娜', amount: 599, status: 'pending' },
|
|
650
|
+
{ key: '3', order: 'SO-202605-003', customer: '王芳', amount: 8800, status: 'paid' },
|
|
651
|
+
{ key: '4', order: 'SO-202605-004', customer: '陈晨', amount: 320, status: 'refunded' },
|
|
652
|
+
]
|
|
653
|
+
|
|
654
|
+
const statusMeta: Record<
|
|
655
|
+
OrderRecord['status'],
|
|
656
|
+
{ label: string; color: 'success' | 'warning' | 'error' }
|
|
657
|
+
> = {
|
|
658
|
+
paid: { label: '已支付', color: 'success' },
|
|
659
|
+
pending: { label: '待支付', color: 'warning' },
|
|
660
|
+
refunded: { label: '已退款', color: 'error' },
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
const columns: TableColumn<OrderRecord>[] = [
|
|
664
|
+
{ key: 'order', title: '订单号' },
|
|
665
|
+
{ key: 'customer', title: '客户' },
|
|
666
|
+
{
|
|
667
|
+
key: 'amount',
|
|
668
|
+
title: '金额',
|
|
669
|
+
align: 'right',
|
|
670
|
+
render: (value) => `¥ ${(value as number).toLocaleString('zh-CN')}`,
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
key: 'status',
|
|
674
|
+
title: '状态',
|
|
675
|
+
render: (value) => {
|
|
676
|
+
const meta = statusMeta[value as OrderRecord['status']]
|
|
677
|
+
return <Tag color={meta.color}>{meta.label}</Tag>
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
key: 'action',
|
|
682
|
+
title: '操作',
|
|
683
|
+
align: 'right',
|
|
684
|
+
render: (_value, record) => <Button type="link">查看 {record.order}</Button>,
|
|
685
|
+
},
|
|
686
|
+
]
|
|
687
|
+
|
|
688
|
+
export default () => <Table columns={columns} data={data} />
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
### 自定义渲染 (multiple-tags)
|
|
692
|
+
|
|
693
|
+
单元格内可放置多个 `Tag`。表格单元格统一通过 `--table-padding-y` 提供上下间距,自定义 `render` 容器无需重复补 padding;多个 Tag 之间使用 `gap` 控制间距。Tag 默认 `max-width` 为 180,长文案会单行省略,hover 可查看完整内容。
|
|
694
|
+
|
|
695
|
+
```tsx
|
|
696
|
+
import type { TableColumn } from '@/components/apex/table'
|
|
697
|
+
|
|
698
|
+
import { Table } from '@/components/apex/table'
|
|
699
|
+
import { Tag } from '@/components/apex/tag'
|
|
700
|
+
|
|
701
|
+
type ProductRecord = {
|
|
702
|
+
key: string
|
|
703
|
+
name: string
|
|
704
|
+
tags: Array<{ label: string; color: 'brand' | 'success' | 'warning' | 'error' | 'default' }>
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
const LONG_TAG_LABELS = {
|
|
708
|
+
priority: '高优先级紧急处理事项:需在本周内完成跨部门评审并同步相关方确认结果',
|
|
709
|
+
region: '华东大区(含上海、杭州、南京、苏州、无锡及周边城市)重点客户专项运营',
|
|
710
|
+
category: '企业级数据中台与智能分析平台解决方案 / 含实时数仓与权限治理模块',
|
|
711
|
+
} as const
|
|
712
|
+
|
|
713
|
+
const data: ProductRecord[] = [
|
|
714
|
+
{
|
|
715
|
+
key: '1',
|
|
716
|
+
name: '洞察分析平台',
|
|
717
|
+
tags: [
|
|
718
|
+
{ label: LONG_TAG_LABELS.priority, color: 'error' },
|
|
719
|
+
{ label: LONG_TAG_LABELS.region, color: 'brand' },
|
|
720
|
+
{ label: LONG_TAG_LABELS.category, color: 'success' },
|
|
721
|
+
],
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
key: '2',
|
|
725
|
+
name: '客户成功工作台',
|
|
726
|
+
tags: [
|
|
727
|
+
{ label: LONG_TAG_LABELS.region, color: 'brand' },
|
|
728
|
+
{ label: '季度复盘待办:整理本月续约风险清单并同步客户成功经理', color: 'warning' },
|
|
729
|
+
{ label: LONG_TAG_LABELS.category, color: 'default' },
|
|
730
|
+
],
|
|
731
|
+
},
|
|
732
|
+
{
|
|
733
|
+
key: '3',
|
|
734
|
+
name: '权限治理中心',
|
|
735
|
+
tags: [
|
|
736
|
+
{ label: LONG_TAG_LABELS.priority, color: 'error' },
|
|
737
|
+
{ label: '安全合规专项:完成敏感字段脱敏策略评审与灰度发布计划', color: 'warning' },
|
|
738
|
+
],
|
|
739
|
+
},
|
|
740
|
+
]
|
|
741
|
+
|
|
742
|
+
const columns: TableColumn<ProductRecord>[] = [
|
|
743
|
+
{ key: 'name', title: '产品', width: 140 },
|
|
744
|
+
{
|
|
745
|
+
key: 'tags',
|
|
746
|
+
title: '标签',
|
|
747
|
+
render: (_value, record) => (
|
|
748
|
+
<div
|
|
749
|
+
style={{
|
|
750
|
+
display: 'flex',
|
|
751
|
+
flexWrap: 'wrap',
|
|
752
|
+
gap: 8,
|
|
753
|
+
alignItems: 'center',
|
|
754
|
+
}}
|
|
755
|
+
>
|
|
756
|
+
{record.tags.map((tag) => (
|
|
757
|
+
<Tag key={tag.label} color={tag.color}>
|
|
758
|
+
{tag.label}
|
|
759
|
+
</Tag>
|
|
760
|
+
))}
|
|
761
|
+
</div>
|
|
762
|
+
),
|
|
763
|
+
},
|
|
764
|
+
]
|
|
765
|
+
|
|
766
|
+
export default () => <Table columns={columns} data={data} pagination={false} />
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
### 自定义渲染 (max-tag-count)
|
|
770
|
+
|
|
771
|
+
固定列宽场景下可配置最多展示个数(如下例 `maxTagCount = 2`):Tag 竖排,超出部分在末行右侧以 `+N` 折叠;hover `+N` 弹出全部 Tag。
|
|
772
|
+
|
|
773
|
+
```tsx
|
|
774
|
+
import type { TableColumn } from '@/components/apex/table'
|
|
775
|
+
|
|
776
|
+
import { Popover } from '@/components/apex/popover'
|
|
777
|
+
import { Table } from '@/components/apex/table'
|
|
778
|
+
import { Tag } from '@/components/apex/tag'
|
|
779
|
+
|
|
780
|
+
type ToolRecord = {
|
|
781
|
+
key: string
|
|
782
|
+
name: string
|
|
783
|
+
tools: string[]
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
const MAX_TAG_COUNT = 2
|
|
787
|
+
|
|
788
|
+
const data: ToolRecord[] = [
|
|
789
|
+
{
|
|
790
|
+
key: '1',
|
|
791
|
+
name: '张伟',
|
|
792
|
+
tools: [
|
|
793
|
+
'Adobe Illustrator (熟练掌握)',
|
|
794
|
+
'ChatGPT (熟练掌握,可独立完成复杂提示词工程)',
|
|
795
|
+
'Figma (熟练掌握)',
|
|
796
|
+
],
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
key: '2',
|
|
800
|
+
name: '李娜',
|
|
801
|
+
tools: ['Adobe Firefly (熟练掌握,含生成式填充与扩展工作流)'],
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
key: '3',
|
|
805
|
+
name: '王芳',
|
|
806
|
+
tools: [
|
|
807
|
+
'Adobe After Effects (熟练掌握)',
|
|
808
|
+
'Adobe Firefly (熟练掌握)',
|
|
809
|
+
'Premiere Pro (熟练掌握)',
|
|
810
|
+
'DaVinci Resolve (熟练掌握)',
|
|
811
|
+
'Blender (一般掌握)',
|
|
812
|
+
'Cinema 4D (一般掌握)',
|
|
813
|
+
'Midjourney (熟练掌握)',
|
|
814
|
+
'Runway (一般掌握)',
|
|
815
|
+
],
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
key: '4',
|
|
819
|
+
name: '陈晨',
|
|
820
|
+
tools: ['Adobe Photoshop'],
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
key: '5',
|
|
824
|
+
name: '赵敏',
|
|
825
|
+
tools: ['Adobe Illustrator (熟练掌握,含品牌视觉与图标体系)'],
|
|
826
|
+
},
|
|
827
|
+
]
|
|
828
|
+
|
|
829
|
+
function AllToolsPopoverContent({ tools }: { tools: string[] }) {
|
|
830
|
+
return (
|
|
831
|
+
<div
|
|
832
|
+
style={{
|
|
833
|
+
display: 'flex',
|
|
834
|
+
flexWrap: 'wrap',
|
|
835
|
+
gap: 8,
|
|
836
|
+
maxWidth: 320,
|
|
837
|
+
maxHeight: 256,
|
|
838
|
+
overflow: 'auto',
|
|
839
|
+
}}
|
|
840
|
+
>
|
|
841
|
+
{tools.map((label) => (
|
|
842
|
+
<Tag key={label} variant="outlined">
|
|
843
|
+
{label}
|
|
844
|
+
</Tag>
|
|
845
|
+
))}
|
|
846
|
+
</div>
|
|
847
|
+
)
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
function ToolExperienceTags({ tools }: { tools: string[] }) {
|
|
851
|
+
const visible = tools.slice(0, MAX_TAG_COUNT)
|
|
852
|
+
const overflowCount = tools.length - visible.length
|
|
853
|
+
const showOverflow = overflowCount > 0
|
|
854
|
+
|
|
855
|
+
return (
|
|
856
|
+
<div
|
|
857
|
+
style={{
|
|
858
|
+
display: 'flex',
|
|
859
|
+
flexDirection: 'column',
|
|
860
|
+
gap: 8,
|
|
861
|
+
width: '100%',
|
|
862
|
+
minWidth: 0,
|
|
863
|
+
// 让 Tag 跟随列宽截断,而不是锁定默认 180
|
|
864
|
+
['--tag-width-max' as string]: '100%',
|
|
865
|
+
}}
|
|
866
|
+
>
|
|
867
|
+
{visible.map((label, index) => {
|
|
868
|
+
const isLast = index === visible.length - 1
|
|
869
|
+
if (!(isLast && showOverflow)) {
|
|
870
|
+
return (
|
|
871
|
+
<Tag key={label} variant="outlined" style={{ width: '100%', minWidth: 0 }}>
|
|
872
|
+
{label}
|
|
873
|
+
</Tag>
|
|
874
|
+
)
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
return (
|
|
878
|
+
<div
|
|
879
|
+
key={label}
|
|
880
|
+
style={{
|
|
881
|
+
display: 'flex',
|
|
882
|
+
alignItems: 'center',
|
|
883
|
+
gap: 8,
|
|
884
|
+
width: '100%',
|
|
885
|
+
minWidth: 0,
|
|
886
|
+
}}
|
|
887
|
+
>
|
|
888
|
+
<Tag variant="outlined" style={{ flex: '1 1 auto', minWidth: 0 }}>
|
|
889
|
+
{label}
|
|
890
|
+
</Tag>
|
|
891
|
+
<Popover
|
|
892
|
+
trigger="hover"
|
|
893
|
+
placement="top"
|
|
894
|
+
content={<AllToolsPopoverContent tools={tools} />}
|
|
895
|
+
>
|
|
896
|
+
<Tag variant="outlined" style={{ flexShrink: 0 }}>
|
|
897
|
+
+{overflowCount}
|
|
898
|
+
</Tag>
|
|
899
|
+
</Popover>
|
|
900
|
+
</div>
|
|
901
|
+
)
|
|
902
|
+
})}
|
|
903
|
+
</div>
|
|
904
|
+
)
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
const columns: TableColumn<ToolRecord>[] = [
|
|
908
|
+
{ key: 'name', title: '姓名', width: 100 },
|
|
909
|
+
{
|
|
910
|
+
key: 'tools',
|
|
911
|
+
title: '工具经验',
|
|
912
|
+
width: 220,
|
|
913
|
+
render: (_value, record) => <ToolExperienceTags tools={record.tools} />,
|
|
914
|
+
},
|
|
915
|
+
]
|
|
916
|
+
|
|
917
|
+
export default () => <Table columns={columns} data={data} pagination={false} />
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
### 行展开
|
|
921
|
+
|
|
922
|
+
通过 `expandable.expandedRowRender` 在行下方渲染展开面板;数据含嵌套 子内容 字段时自动切换为树形模式。
|
|
923
|
+
|
|
924
|
+
```tsx
|
|
925
|
+
import { Table } from '@/components/apex/table'
|
|
926
|
+
|
|
927
|
+
const columns = [
|
|
928
|
+
{ key: 'name', title: '姓名' },
|
|
929
|
+
{ key: 'address', title: '地址' },
|
|
930
|
+
]
|
|
931
|
+
|
|
932
|
+
const data = [
|
|
933
|
+
{ key: '1', name: '张伟', address: '北京市朝阳区', description: '北京市朝阳区建国路 88 号' },
|
|
934
|
+
{
|
|
935
|
+
key: '2',
|
|
936
|
+
name: '李娜',
|
|
937
|
+
address: '上海市浦东新区',
|
|
938
|
+
description: '上海市浦东新区世纪大道 100 号',
|
|
939
|
+
},
|
|
940
|
+
{ key: '3', name: '王芳', address: '广州市天河区', description: '广州市天河区体育西路 66 号' },
|
|
941
|
+
]
|
|
942
|
+
|
|
943
|
+
export default () => (
|
|
944
|
+
<Table
|
|
945
|
+
columns={columns}
|
|
946
|
+
data={data}
|
|
947
|
+
expandable={{
|
|
948
|
+
expandedRowRender: (record) => <div>详细信息:{record.description}</div>,
|
|
949
|
+
}}
|
|
950
|
+
/>
|
|
951
|
+
)
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
### 虚拟滚动
|
|
955
|
+
|
|
956
|
+
大数据量时开启 `virtual`,需配合 `scroll.y` 或 `flexHeight` 提供受限高度;无受限高度时自动降级。
|
|
957
|
+
|
|
958
|
+
```tsx
|
|
959
|
+
import { Table } from '@/components/apex/table'
|
|
960
|
+
|
|
961
|
+
const columns = [
|
|
962
|
+
{ key: 'name', title: '姓名', width: 120 },
|
|
963
|
+
{ key: 'age', title: '年龄', align: 'right' as const, width: 80 },
|
|
964
|
+
{ key: 'address', title: '地址' },
|
|
965
|
+
]
|
|
966
|
+
|
|
967
|
+
const data = Array.from({ length: 200 }, (_, index) => ({
|
|
968
|
+
key: String(index + 1),
|
|
969
|
+
name: `用户 ${String(index + 1).padStart(3, '0')}`,
|
|
970
|
+
age: 18 + (index % 50),
|
|
971
|
+
address: `城市 ${(index % 10) + 1} 区`,
|
|
972
|
+
}))
|
|
973
|
+
|
|
974
|
+
export default () => (
|
|
975
|
+
<Table
|
|
976
|
+
columns={columns}
|
|
977
|
+
data={data}
|
|
978
|
+
size="small"
|
|
979
|
+
pagination={false}
|
|
980
|
+
scroll={{ y: 320 }}
|
|
981
|
+
virtual
|
|
982
|
+
/>
|
|
983
|
+
)
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
### 总结栏
|
|
987
|
+
|
|
988
|
+
通过 `summary` 渲染 `Table.Summary` 复合组件,在表尾展示合计行。
|
|
989
|
+
|
|
990
|
+
```tsx
|
|
991
|
+
import { Table } from '@/components/apex/table'
|
|
992
|
+
|
|
993
|
+
const columns = [
|
|
994
|
+
{ key: 'name', title: '姓名' },
|
|
995
|
+
{ key: 'age', title: '年龄', align: 'right' as const, width: 80 },
|
|
996
|
+
{ key: 'address', title: '地址' },
|
|
997
|
+
]
|
|
998
|
+
|
|
999
|
+
const data = [
|
|
1000
|
+
{ key: '1', name: '张伟', age: 32, address: '北京市朝阳区' },
|
|
1001
|
+
{ key: '2', name: '李娜', age: 28, address: '上海市浦东新区' },
|
|
1002
|
+
{ key: '3', name: '王芳', age: 45, address: '广州市天河区' },
|
|
1003
|
+
]
|
|
1004
|
+
|
|
1005
|
+
export default () => (
|
|
1006
|
+
<Table
|
|
1007
|
+
columns={columns}
|
|
1008
|
+
data={data}
|
|
1009
|
+
pagination={false}
|
|
1010
|
+
summary={(currentData) => {
|
|
1011
|
+
const totalAge = currentData.reduce((sum, row) => sum + row.age, 0)
|
|
1012
|
+
return (
|
|
1013
|
+
<Table.Summary>
|
|
1014
|
+
<Table.Summary.Row>
|
|
1015
|
+
<Table.Summary.Cell index={0}>合计</Table.Summary.Cell>
|
|
1016
|
+
<Table.Summary.Cell index={1} align="right">
|
|
1017
|
+
{totalAge}
|
|
1018
|
+
</Table.Summary.Cell>
|
|
1019
|
+
<Table.Summary.Cell index={2}>共 {currentData.length} 人</Table.Summary.Cell>
|
|
1020
|
+
</Table.Summary.Row>
|
|
1021
|
+
</Table.Summary>
|
|
1022
|
+
)
|
|
1023
|
+
}}
|
|
1024
|
+
/>
|
|
1025
|
+
)
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
## DOM 结构
|
|
1029
|
+
|
|
1030
|
+
源码声明的静态 `data-slot`:`table-element`、`table-scroll-shell`、`table-scroll`、`table-empty-fixed`、`table-summary-wrap`、`table-element-summary`、`table-container`、`table`、`table-header-wrap`、`table-element-header`、`table-expand-trigger`、`table-selection-cell`、`table-selection-index`、`table-selection-all`、`table-selection-radio`、`table-selection-checkbox`、`table-virtual-spacer`、`table-expanded-row`、`table-expanded-cell`、`table-tbody`、`table-cell-head`、`table-cell`、`table-col`、`table-row-empty`、`table-cell-empty`、`table-empty-image`、`table-thead`、`table-row`、`table-pagination`、`table-scrollbar`、`table-scrollbar-track-y`、`table-scrollbar-thumb-y`、`table-scrollbar-track-x`、`table-scrollbar-thumb-x`、`table-skeleton-row`、`table-skeleton-cell`、`table-summary`、`table-summary-row`、`table-summary-cell`。具体节点随模式和状态出现,不表示固定嵌套顺序。
|
|
1031
|
+
|
|
1032
|
+
## 样式定制
|
|
1033
|
+
|
|
1034
|
+
优先使用本组件公开的尺寸、类型和状态属性。换肤与变量覆盖方式见 [主题指南](../llms-theme.txt)。
|
|
1035
|
+
|
|
1036
|
+
需要定制具体样式时再读取 [Token 明细](./tokens.txt),其中包含用途、定义值及适用作用域。常规组件使用无需加载该文件。
|
|
1037
|
+
|
|
1038
|
+
## FAQ
|
|
1039
|
+
|
|
1040
|
+
### 为什么设置了 `ellipsis` 但没有 Tooltip?
|
|
1041
|
+
|
|
1042
|
+
`ellipsis.tooltip` 仅对**纯文本**(`string` / `number`)列生效;若 `render` 返回自定义 ReactNode,列会改为弹性行高而不截断。Tooltip 也仅在内容**实际溢出**时弹出。
|
|
1043
|
+
|
|
1044
|
+
### `emptyText` 和 ApexProvider 的 locale 谁优先?
|
|
1045
|
+
|
|
1046
|
+
单表 `emptyText` prop 优先于 `ApexProvider` 的 `locale.Table.emptyText`,再其次才是内置默认文案。
|
|
1047
|
+
|
|
1048
|
+
### 列显隐会隐藏选择列吗?
|
|
1049
|
+
|
|
1050
|
+
不会。`hiddenColumnKeys` 仅作用于数据列;行选择列、展开列等 prefix 列始终保留。
|