niuma-ui 1.1.12 → 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/CHANGELOG.md +17 -18
- package/README.en.md +12 -9
- package/README.md +13 -10
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/RsAlert.css +111 -0
- package/dist/components/RsAlert.d.ts +32 -0
- package/dist/components/RsAlert.impl.js +83 -0
- package/dist/components/RsAlert.js +8 -0
- package/dist/components/RsAvatar.css +60 -0
- package/dist/components/RsAvatar.d.ts +30 -0
- package/dist/components/RsAvatar.impl.js +59 -0
- package/dist/components/RsAvatar.js +7 -0
- package/dist/components/RsBadge.css +41 -0
- package/dist/components/RsBadge.d.ts +18 -0
- package/dist/components/RsBadge.impl.js +13 -0
- package/dist/components/RsBadge.js +8 -0
- package/dist/components/RsBreadcrumb.css +37 -0
- package/dist/components/RsBreadcrumb.d.ts +11 -0
- package/dist/components/RsBreadcrumb.impl.js +26 -0
- package/dist/components/RsBreadcrumb.js +7 -0
- package/dist/components/RsBreadcrumbItems.d.ts +8 -0
- package/dist/components/RsBreadcrumbItems.impl.js +40 -0
- package/dist/components/RsBreadcrumbItems.js +5 -0
- package/dist/components/RsButton.css +298 -0
- package/dist/components/RsButton.d.ts +56 -0
- package/dist/components/RsButton.impl.js +244 -0
- package/dist/components/RsButton.js +8 -0
- package/dist/components/RsCalendarGrid.css +99 -0
- package/dist/components/RsCalendarGrid.d.ts +30 -0
- package/dist/components/RsCalendarGrid.impl.js +182 -0
- package/dist/components/RsCalendarGrid.js +8 -0
- package/dist/components/RsCard.css +282 -0
- package/dist/components/RsCard.d.ts +78 -0
- package/dist/components/RsCard.impl.js +104 -0
- package/dist/components/RsCard.js +7 -0
- package/dist/components/RsCheckbox.css +104 -0
- package/dist/components/RsCheckbox.d.ts +36 -0
- package/dist/components/RsCheckbox.impl.js +86 -0
- package/dist/components/RsCheckbox.js +7 -0
- package/dist/components/RsCodeBlock.css +102 -0
- package/dist/components/RsCodeBlock.d.ts +34 -0
- package/dist/components/RsCodeBlock.impl.js +173 -0
- package/dist/components/RsCodeBlock.js +8 -0
- package/dist/components/RsCodeEditor.css +214 -0
- package/dist/components/RsCodeEditor.d.ts +88 -0
- package/dist/components/RsCodeEditor.impl.js +308 -0
- package/dist/components/RsCodeEditor.js +8 -0
- package/dist/components/RsConfigProvider.css +7 -0
- package/dist/components/RsConfigProvider.d.ts +36 -0
- package/dist/components/RsConfigProvider.impl.js +49 -0
- package/dist/components/RsConfigProvider.js +8 -0
- package/dist/components/RsConfirmDialog.css +118 -0
- package/dist/components/RsConfirmDialog.d.ts +72 -0
- package/dist/components/RsConfirmDialog.impl.js +207 -0
- package/dist/components/RsConfirmDialog.js +7 -0
- package/dist/components/RsContainer.css +94 -0
- package/dist/components/RsContainer.d.ts +52 -0
- package/dist/components/RsContainer.impl.js +99 -0
- package/dist/components/RsContainer.js +8 -0
- package/dist/components/RsContextMenu.css +178 -0
- package/dist/components/RsContextMenu.d.ts +35 -0
- package/dist/components/RsContextMenu.impl.js +81 -0
- package/dist/components/RsContextMenu.js +7 -0
- package/dist/components/RsContextMenuItems.d.ts +11 -0
- package/dist/components/RsContextMenuItems.impl.js +90 -0
- package/dist/components/RsContextMenuItems.js +5 -0
- package/dist/components/RsDatePicker-1.css +157 -0
- package/dist/components/RsDatePicker.css +100 -0
- package/dist/components/RsDatePicker.d.ts +72 -0
- package/dist/components/RsDatePicker.impl.js +719 -0
- package/dist/components/RsDatePicker.js +10 -0
- package/dist/components/RsDateTimePicker.d.ts +50 -0
- package/dist/components/RsDateTimePicker.impl.js +70 -0
- package/dist/components/RsDateTimePicker.js +5 -0
- package/dist/components/RsDescriptions.css +86 -0
- package/dist/components/RsDescriptions.d.ts +34 -0
- package/dist/components/RsDescriptions.impl.js +69 -0
- package/dist/components/RsDescriptions.js +7 -0
- package/dist/components/RsDescriptionsItem.d.ts +21 -0
- package/dist/components/RsDescriptionsItem.impl.js +26 -0
- package/dist/components/RsDescriptionsItem.js +5 -0
- package/dist/components/RsDialog.css +298 -0
- package/dist/components/RsDialog.d.ts +143 -0
- package/dist/components/RsDialog.impl.js +410 -0
- package/dist/components/RsDialog.js +7 -0
- package/dist/components/RsDivider.css +51 -0
- package/dist/components/RsDivider.d.ts +20 -0
- package/dist/components/RsDivider.impl.js +31 -0
- package/dist/components/RsDivider.js +8 -0
- package/dist/components/RsDrawer.css +368 -0
- package/dist/components/RsDrawer.d.ts +104 -0
- package/dist/components/RsDrawer.impl.js +497 -0
- package/dist/components/RsDrawer.js +7 -0
- package/dist/components/RsDropdown.css +157 -0
- package/dist/components/RsDropdown.d.ts +34 -0
- package/dist/components/RsDropdown.impl.js +100 -0
- package/dist/components/RsDropdown.js +7 -0
- package/dist/components/RsDropdownItems.d.ts +15 -0
- package/dist/components/RsDropdownItems.impl.js +99 -0
- package/dist/components/RsDropdownItems.js +5 -0
- package/dist/components/RsDynamicTags.css +148 -0
- package/dist/components/RsDynamicTags.d.ts +71 -0
- package/dist/components/RsDynamicTags.impl.js +313 -0
- package/dist/components/RsDynamicTags.js +8 -0
- package/dist/components/RsEmpty.css +52 -0
- package/dist/components/RsEmpty.d.ts +32 -0
- package/dist/components/RsEmpty.impl.js +43 -0
- package/dist/components/RsEmpty.js +7 -0
- package/dist/components/RsForm.css +30 -0
- package/dist/components/RsForm.d.ts +80 -0
- package/dist/components/RsForm.impl.js +188 -0
- package/dist/components/RsForm.js +8 -0
- package/dist/components/RsFormItem.css +52 -0
- package/dist/components/RsFormItem.d.ts +78 -0
- package/dist/components/RsFormItem.impl.js +288 -0
- package/dist/components/RsFormItem.js +8 -0
- package/dist/components/RsFormItemControl.d.ts +21 -0
- package/dist/components/RsFormItemControl.impl.js +19 -0
- package/dist/components/RsFormItemControl.js +5 -0
- package/dist/components/RsFormList.d.ts +23 -0
- package/dist/components/RsFormList.impl.js +86 -0
- package/dist/components/RsFormList.js +5 -0
- package/dist/components/RsIcon.css +14 -0
- package/dist/components/RsIcon.d.ts +24 -0
- package/dist/components/RsIcon.impl.js +77 -0
- package/dist/components/RsIcon.js +8 -0
- package/dist/components/RsInput.css +528 -0
- package/dist/components/RsInput.d.ts +147 -0
- package/dist/components/RsInput.impl.js +439 -0
- package/dist/components/RsInput.js +8 -0
- package/dist/components/RsInputNumber.css +163 -0
- package/dist/components/RsInputNumber.d.ts +88 -0
- package/dist/components/RsInputNumber.impl.js +375 -0
- package/dist/components/RsInputNumber.js +8 -0
- package/dist/components/RsLabel.css +33 -0
- package/dist/components/RsLabel.d.ts +25 -0
- package/dist/components/RsLabel.impl.js +45 -0
- package/dist/components/RsLabel.js +8 -0
- package/dist/components/RsLink.css +45 -0
- package/dist/components/RsLink.d.ts +25 -0
- package/dist/components/RsLink.impl.js +59 -0
- package/dist/components/RsLink.js +7 -0
- package/dist/components/RsLoading.css +106 -0
- package/dist/components/RsLoading.d.ts +24 -0
- package/dist/components/RsLoading.impl.js +72 -0
- package/dist/components/RsLoading.js +7 -0
- package/dist/components/RsLoadingBar.css +20 -0
- package/dist/components/RsLoadingBar.d.ts +31 -0
- package/dist/components/RsLoadingBar.impl.js +111 -0
- package/dist/components/RsLoadingBar.js +8 -0
- package/dist/components/RsMarkdown.css +214 -0
- package/dist/components/RsMarkdown.d.ts +36 -0
- package/dist/components/RsMarkdown.impl.js +139 -0
- package/dist/components/RsMarkdown.js +7 -0
- package/dist/components/RsMenu.css +200 -0
- package/dist/components/RsMenu.d.ts +28 -0
- package/dist/components/RsMenu.impl.js +108 -0
- package/dist/components/RsMenu.js +7 -0
- package/dist/components/RsMenuItems.d.ts +25 -0
- package/dist/components/RsMenuItems.impl.js +282 -0
- package/dist/components/RsMenuItems.js +5 -0
- package/dist/components/RsMonacoEditor.css +28 -0
- package/dist/components/RsMonacoEditor.d.ts +105 -0
- package/dist/components/RsMonacoEditor.impl.js +353 -0
- package/dist/components/RsMonacoEditor.js +8 -0
- package/dist/components/RsPagination.css +83 -0
- package/dist/components/RsPagination.d.ts +44 -0
- package/dist/components/RsPagination.impl.js +208 -0
- package/dist/components/RsPagination.js +8 -0
- package/dist/components/RsPopover.css +24 -0
- package/dist/components/RsPopover.d.ts +43 -0
- package/dist/components/RsPopover.impl.js +71 -0
- package/dist/components/RsPopover.js +7 -0
- package/dist/components/RsProseEditor.css +19 -0
- package/dist/components/RsProseEditor.d.ts +38 -0
- package/dist/components/RsProseEditor.impl.js +137 -0
- package/dist/components/RsProseEditor.js +8 -0
- package/dist/components/RsRadio.css +19 -0
- package/dist/components/RsRadio.d.ts +34 -0
- package/dist/components/RsRadio.impl.js +66 -0
- package/dist/components/RsRadio.js +7 -0
- package/dist/components/RsRadioItem.css +90 -0
- package/dist/components/RsRadioItem.d.ts +23 -0
- package/dist/components/RsRadioItem.impl.js +55 -0
- package/dist/components/RsRadioItem.js +7 -0
- package/dist/components/RsScrollbar.css +68 -0
- package/dist/components/RsScrollbar.d.ts +31 -0
- package/dist/components/RsScrollbar.impl.js +81 -0
- package/dist/components/RsScrollbar.js +7 -0
- package/dist/components/RsSelect.css +233 -0
- package/dist/components/RsSelect.d.ts +148 -0
- package/dist/components/RsSelect.impl.js +506 -0
- package/dist/components/RsSelect.js +8 -0
- package/dist/components/RsSidebar.css +61 -0
- package/dist/components/RsSidebar.d.ts +44 -0
- package/dist/components/RsSidebar.impl.js +63 -0
- package/dist/components/RsSidebar.js +8 -0
- package/dist/components/RsSidebarGroup.css +15 -0
- package/dist/components/RsSidebarGroup.d.ts +17 -0
- package/dist/components/RsSidebarGroup.impl.js +22 -0
- package/dist/components/RsSidebarGroup.js +8 -0
- package/dist/components/RsSidebarItem.css +45 -0
- package/dist/components/RsSidebarItem.d.ts +20 -0
- package/dist/components/RsSidebarItem.impl.js +41 -0
- package/dist/components/RsSidebarItem.js +8 -0
- package/dist/components/RsSplitPane.css +183 -0
- package/dist/components/RsSplitPane.d.ts +51 -0
- package/dist/components/RsSplitPane.impl.js +408 -0
- package/dist/components/RsSplitPane.js +7 -0
- package/dist/components/RsStatCard.css +51 -0
- package/dist/components/RsStatCard.d.ts +26 -0
- package/dist/components/RsStatCard.impl.js +41 -0
- package/dist/components/RsStatCard.js +8 -0
- package/dist/components/RsSteps.css +83 -0
- package/dist/components/RsSteps.d.ts +22 -0
- package/dist/components/RsSteps.impl.js +55 -0
- package/dist/components/RsSteps.js +8 -0
- package/dist/components/RsSwitch.css +101 -0
- package/dist/components/RsSwitch.d.ts +41 -0
- package/dist/components/RsSwitch.impl.js +92 -0
- package/dist/components/RsSwitch.js +7 -0
- package/dist/components/RsTable.d.ts +139 -0
- package/dist/components/RsTable.impl.js +676 -0
- package/dist/components/RsTable.js +5 -0
- package/dist/components/RsTabs.css +616 -0
- package/dist/components/RsTabs.d.ts +92 -0
- package/dist/components/RsTabs.impl.js +526 -0
- package/dist/components/RsTabs.js +7 -0
- package/dist/components/RsTag.css +94 -0
- package/dist/components/RsTag.d.ts +33 -0
- package/dist/components/RsTag.impl.js +70 -0
- package/dist/components/RsTag.js +8 -0
- package/dist/components/RsTerminal.css +119 -0
- package/dist/components/RsTerminal.d.ts +85 -0
- package/dist/components/RsTerminal.impl.js +525 -0
- package/dist/components/RsTerminal.js +8 -0
- package/dist/components/RsTimePicker-1.css +98 -0
- package/dist/components/RsTimePicker.css +106 -0
- package/dist/components/RsTimePicker.d.ts +41 -0
- package/dist/components/RsTimePicker.impl.js +374 -0
- package/dist/components/RsTimePicker.js +10 -0
- package/dist/components/RsTimePickerColumns.css +104 -0
- package/dist/components/RsTimePickerColumns.d.ts +30 -0
- package/dist/components/RsTimePickerColumns.impl.js +172 -0
- package/dist/components/RsTimePickerColumns.js +8 -0
- package/dist/components/RsToaster.css +329 -0
- package/dist/components/RsToaster.d.ts +17 -0
- package/dist/components/RsToaster.impl.js +67 -0
- package/dist/components/RsToaster.js +7 -0
- package/dist/components/RsToolbar.css +61 -0
- package/dist/components/RsToolbar.d.ts +43 -0
- package/dist/components/RsToolbar.impl.js +57 -0
- package/dist/components/RsToolbar.js +7 -0
- package/dist/components/RsTooltip.css +59 -0
- package/dist/components/RsTooltip.d.ts +47 -0
- package/dist/components/RsTooltip.impl.js +88 -0
- package/dist/components/RsTooltip.js +7 -0
- package/dist/components/RsTooltipProvider.d.ts +26 -0
- package/dist/components/RsTooltipProvider.impl.js +32 -0
- package/dist/components/RsTooltipProvider.js +5 -0
- package/dist/components/RsTree.css +308 -0
- package/dist/components/RsTree.d.ts +131 -0
- package/dist/components/RsTree.impl.js +762 -0
- package/dist/components/RsTree.js +8 -0
- package/dist/components/RsUpload.css +191 -0
- package/dist/components/RsUpload.d.ts +38 -0
- package/dist/components/RsUpload.impl.js +198 -0
- package/dist/components/RsUpload.js +8 -0
- package/dist/components/RsVNodeHost.d.ts +18 -0
- package/dist/components/RsVNodeHost.impl.js +18 -0
- package/dist/components/RsVNodeHost.js +5 -0
- package/dist/components/RsVirtualList.css +29 -0
- package/dist/components/RsVirtualList.d.ts +37 -0
- package/dist/components/RsVirtualList.impl.js +138 -0
- package/dist/components/RsVirtualList.js +8 -0
- package/dist/components/avatar-utils.d.ts +11 -0
- package/dist/components/avatar-utils.js +13 -0
- package/dist/components/breadcrumb-utils.d.ts +12 -0
- package/dist/components/breadcrumb-utils.js +12 -0
- package/dist/components/button-utils.d.ts +17 -0
- package/dist/components/button-utils.js +13 -0
- package/dist/components/class-utils.d.ts +2 -0
- package/dist/components/code-editor-utils.d.ts +33 -0
- package/dist/components/code-editor-utils.js +64 -0
- package/dist/components/code-mirror-completion.d.ts +5 -0
- package/dist/components/code-mirror-completion.js +37 -0
- package/dist/components/code-mirror-diagnostics.d.ts +6 -0
- package/dist/components/code-mirror-diagnostics.js +35 -0
- package/dist/components/code-mirror-ghost.d.ts +8 -0
- package/dist/components/code-mirror-ghost.js +133 -0
- package/dist/components/code-mirror-inline-edit.d.ts +11 -0
- package/dist/components/code-mirror-inline-edit.js +51 -0
- package/dist/components/code-mirror-intel.d.ts +22 -0
- package/dist/components/code-mirror-intel.js +62 -0
- package/dist/components/code-mirror-lang.d.ts +10 -0
- package/dist/components/code-mirror-lang.js +113 -0
- package/dist/components/context-menu-utils.d.ts +21 -0
- package/dist/components/context-menu-utils.js +8 -0
- package/dist/components/date-picker-utils.d.ts +115 -0
- package/dist/components/date-picker-utils.js +270 -0
- package/dist/components/date-range-validation.d.ts +15 -0
- package/dist/components/date-range-validation.js +16 -0
- package/dist/components/date-validation.d.ts +15 -0
- package/dist/components/date-validation.js +46 -0
- package/dist/components/descriptions-utils.d.ts +18 -0
- package/dist/components/descriptions-utils.js +4 -0
- package/dist/components/dialog-utils.d.ts +95 -0
- package/dist/components/dialog-utils.js +58 -0
- package/dist/components/dialog-viewport.d.ts +14 -0
- package/dist/components/dialog-viewport.js +38 -0
- package/dist/components/dialog-window.d.ts +45 -0
- package/dist/components/dialog-window.js +275 -0
- package/dist/components/drawer-utils.d.ts +37 -0
- package/dist/components/drawer-utils.js +59 -0
- package/dist/components/dropdown-utils.d.ts +13 -0
- package/dist/components/dropdown-utils.js +12 -0
- package/dist/components/form-item-control.d.ts +7 -0
- package/dist/components/form-item-control.js +46 -0
- package/dist/components/form-path.d.ts +29 -0
- package/dist/components/form-path.js +78 -0
- package/dist/components/form-rules.d.ts +82 -0
- package/dist/components/form-rules.js +130 -0
- package/dist/components/form-utils.d.ts +120 -0
- package/dist/components/form-utils.js +67 -0
- package/dist/components/input-number-utils.d.ts +36 -0
- package/dist/components/input-number-utils.js +74 -0
- package/dist/components/input-rules.d.ts +15 -0
- package/dist/components/input-rules.js +59 -0
- package/dist/components/loading-utils.d.ts +6 -0
- package/dist/components/markdown-utils.d.ts +16 -0
- package/dist/components/markdown-utils.js +143 -0
- package/dist/components/menu-utils.d.ts +16 -0
- package/dist/components/menu-utils.js +29 -0
- package/dist/components/overlay-utils.d.ts +23 -0
- package/dist/components/overlay-utils.js +17 -0
- package/dist/components/pagination-utils.d.ts +9 -0
- package/dist/components/pagination-utils.js +53 -0
- package/dist/components/popover-utils.d.ts +6 -0
- package/dist/components/radio-utils.d.ts +9 -0
- package/dist/components/radio-utils.js +4 -0
- package/dist/components/reka.d.ts +2 -0
- package/dist/components/reka.js +2 -0
- package/dist/components/resolve-radius.d.ts +9 -0
- package/dist/components/resolve-radius.js +18 -0
- package/dist/components/resolve-size.d.ts +10 -0
- package/dist/components/resolve-size.js +20 -0
- package/dist/components/scrollbar-utils.d.ts +3 -0
- package/dist/components/scrollbar-utils.js +7 -0
- package/dist/components/select-utils.d.ts +83 -0
- package/dist/components/select-utils.js +211 -0
- package/dist/components/split-pane-utils.d.ts +74 -0
- package/dist/components/split-pane-utils.js +135 -0
- package/dist/components/steps-utils.d.ts +12 -0
- package/dist/components/steps-utils.js +12 -0
- package/dist/components/table/RsTableBody.d.ts +47 -0
- package/dist/components/table/RsTableBody.impl.js +312 -0
- package/dist/components/table/RsTableBody.js +5 -0
- package/dist/components/table/RsTableBodyRow.d.ts +149 -0
- package/dist/components/table/RsTableBodyRow.impl.js +438 -0
- package/dist/components/table/RsTableBodyRow.js +5 -0
- package/dist/components/table/RsTableCell.d.ts +59 -0
- package/dist/components/table/RsTableCell.impl.js +213 -0
- package/dist/components/table/RsTableCell.js +5 -0
- package/dist/components/table/RsTableCellContent.d.ts +19 -0
- package/dist/components/table/RsTableCellContent.js +25 -0
- package/dist/components/table/RsTableCellEditor.d.ts +46 -0
- package/dist/components/table/RsTableCellEditor.impl.js +341 -0
- package/dist/components/table/RsTableCellEditor.js +5 -0
- package/dist/components/table/RsTableColGroup.d.ts +18 -0
- package/dist/components/table/RsTableColGroup.impl.js +58 -0
- package/dist/components/table/RsTableColGroup.js +5 -0
- package/dist/components/table/RsTableEditGutter.d.ts +17 -0
- package/dist/components/table/RsTableEditGutter.impl.js +52 -0
- package/dist/components/table/RsTableEditGutter.js +5 -0
- package/dist/components/table/RsTableHeader.d.ts +22 -0
- package/dist/components/table/RsTableHeader.impl.js +184 -0
- package/dist/components/table/RsTableHeader.js +5 -0
- package/dist/components/table/RsTableHeaderFilter.css +24 -0
- package/dist/components/table/RsTableHeaderFilter.d.ts +19 -0
- package/dist/components/table/RsTableHeaderFilter.impl.js +102 -0
- package/dist/components/table/RsTableHeaderFilter.js +8 -0
- package/dist/components/table/RsTableRowStatus.css +30 -0
- package/dist/components/table/RsTableRowStatus.d.ts +14 -0
- package/dist/components/table/RsTableRowStatus.impl.js +44 -0
- package/dist/components/table/RsTableRowStatus.js +8 -0
- package/dist/components/table/RsTableSummaryRow.d.ts +37 -0
- package/dist/components/table/RsTableSummaryRow.impl.js +57 -0
- package/dist/components/table/RsTableSummaryRow.js +5 -0
- package/dist/components/table/rs-table-api.d.ts +65 -0
- package/dist/components/table/rs-table-api.js +22 -0
- package/dist/components/table/rs-table-compat-matrix.d.ts +24 -0
- package/dist/components/table/rs-table-compat-matrix.js +64 -0
- package/dist/components/table/rs-table-echarts-adapter.d.ts +47 -0
- package/dist/components/table/rs-table-echarts-adapter.js +49 -0
- package/dist/components/table/rs-table-feature-host.d.ts +61 -0
- package/dist/components/table/rs-table-feature-host.js +97 -0
- package/dist/components/table/rs-table-grid-nav.d.ts +22 -0
- package/dist/components/table/rs-table-grid-nav.js +80 -0
- package/dist/components/table/rs-table-header-types.d.ts +45 -0
- package/dist/components/table/rs-table-module-registry.d.ts +37 -0
- package/dist/components/table/rs-table-module-registry.js +51 -0
- package/dist/components/table/rs-table-props.d.ts +315 -0
- package/dist/components/table/rs-table-props.js +64 -0
- package/dist/components/table/rs-table-view-context.d.ts +218 -0
- package/dist/components/table/rs-table-view-context.js +47 -0
- package/dist/components/table/table-chart-utils.d.ts +62 -0
- package/dist/components/table/table-chart-utils.js +91 -0
- package/dist/components/table/table-context-menu.d.ts +13 -0
- package/dist/components/table/table-context-menu.js +30 -0
- package/dist/components/table/table-edit-utils.d.ts +94 -0
- package/dist/components/table/table-edit-utils.js +282 -0
- package/dist/components/table/table-features.d.ts +149 -0
- package/dist/components/table/table-features.js +119 -0
- package/dist/components/table/table-keys.d.ts +5 -0
- package/dist/components/table/table-keys.js +6 -0
- package/dist/components/table/table-summary-utils.d.ts +90 -0
- package/dist/components/table/table-summary-utils.js +97 -0
- package/dist/components/table-drag.d.ts +39 -0
- package/dist/components/table-drag.js +130 -0
- package/dist/components/table-utils.d.ts +440 -0
- package/dist/components/table-utils.js +722 -0
- package/dist/components/tabs-utils.d.ts +71 -0
- package/dist/components/tabs-utils.js +147 -0
- package/dist/components/terminal-utils.d.ts +59 -0
- package/dist/components/terminal-utils.js +210 -0
- package/dist/components/terminal-wheel.d.ts +24 -0
- package/dist/components/terminal-wheel.js +42 -0
- package/dist/components/time-picker-utils.d.ts +51 -0
- package/dist/components/time-picker-utils.js +158 -0
- package/dist/components/time-range-validation.d.ts +11 -0
- package/dist/components/time-range-validation.js +15 -0
- package/dist/components/time-validation.d.ts +11 -0
- package/dist/components/time-validation.js +22 -0
- package/dist/components/tree-utils.d.ts +112 -0
- package/dist/components/tree-utils.js +310 -0
- package/dist/components/upload-utils.d.ts +26 -0
- package/dist/components/upload-utils.js +177 -0
- package/dist/components/use-rs-select.d.ts +78 -0
- package/dist/components/use-rs-select.js +266 -0
- package/dist/components/virtual-list-utils.d.ts +7 -0
- package/dist/components/virtual-list-utils.js +28 -0
- package/dist/composables/assembleRsTableApi.d.ts +34 -0
- package/dist/composables/assembleRsTableApi.js +26 -0
- package/dist/composables/bindRsTableViewContext.d.ts +73 -0
- package/dist/composables/bindRsTableViewContext.js +104 -0
- package/dist/composables/createRsDialog.d.ts +77 -0
- package/dist/composables/createRsDialog.js +263 -0
- package/dist/composables/createRsTableEditEmitBridge.d.ts +16 -0
- package/dist/composables/createRsTableEditEmitBridge.js +25 -0
- package/dist/composables/useClickOutside.d.ts +2 -0
- package/dist/composables/useRsConfig.d.ts +26 -0
- package/dist/composables/useRsConfig.js +55 -0
- package/dist/composables/useRsI18n.d.ts +9 -0
- package/dist/composables/useRsI18n.js +25 -0
- package/dist/composables/useRsLoadingBar.d.ts +13 -0
- package/dist/composables/useRsLoadingBar.js +30 -0
- package/dist/composables/useRsTable.d.ts +61 -0
- package/dist/composables/useRsTable.js +57 -0
- package/dist/composables/useRsTableA11y.d.ts +35 -0
- package/dist/composables/useRsTableA11y.js +34 -0
- package/dist/composables/useRsTableChartBridge.d.ts +37 -0
- package/dist/composables/useRsTableChartBridge.js +47 -0
- package/dist/composables/useRsTableColumnLayout.d.ts +75 -0
- package/dist/composables/useRsTableColumnLayout.js +250 -0
- package/dist/composables/useRsTableColumnResize.d.ts +35 -0
- package/dist/composables/useRsTableColumnResize.js +182 -0
- package/dist/composables/useRsTableColumnVirtual.d.ts +76 -0
- package/dist/composables/useRsTableColumnVirtual.js +116 -0
- package/dist/composables/useRsTableColumns.d.ts +70 -0
- package/dist/composables/useRsTableColumns.js +132 -0
- package/dist/composables/useRsTableContextMenu.d.ts +83 -0
- package/dist/composables/useRsTableContextMenu.js +152 -0
- package/dist/composables/useRsTableCore.d.ts +177 -0
- package/dist/composables/useRsTableCore.js +164 -0
- package/dist/composables/useRsTableEditActions.d.ts +129 -0
- package/dist/composables/useRsTableEditActions.js +376 -0
- package/dist/composables/useRsTableEditLayer.d.ts +228 -0
- package/dist/composables/useRsTableEditLayer.js +146 -0
- package/dist/composables/useRsTableEngine.d.ts +115 -0
- package/dist/composables/useRsTableEngine.js +225 -0
- package/dist/composables/useRsTableGridKeyboard.d.ts +38 -0
- package/dist/composables/useRsTableGridKeyboard.js +70 -0
- package/dist/composables/useRsTableHeadless.d.ts +138 -0
- package/dist/composables/useRsTableHeadless.js +105 -0
- package/dist/composables/useRsTableInteraction.d.ts +145 -0
- package/dist/composables/useRsTableInteraction.js +249 -0
- package/dist/composables/useRsTableScrollHost.d.ts +25 -0
- package/dist/composables/useRsTableScrollHost.js +42 -0
- package/dist/composables/useRsTableScrollLayout.d.ts +42 -0
- package/dist/composables/useRsTableScrollLayout.js +195 -0
- package/dist/composables/useRsTableSelectionSource.d.ts +38 -0
- package/dist/composables/useRsTableSelectionSource.js +57 -0
- package/dist/composables/useRsTableShell.d.ts +380 -0
- package/dist/composables/useRsTableShell.js +237 -0
- package/dist/composables/useRsTableShellChrome.d.ts +126 -0
- package/dist/composables/useRsTableShellChrome.js +110 -0
- package/dist/composables/useRsTableSummary.d.ts +44 -0
- package/dist/composables/useRsTableSummary.js +52 -0
- package/dist/composables/useRsTableViewProvide.d.ts +111 -0
- package/dist/composables/useRsTableViewProvide.js +93 -0
- package/dist/composables/useRsTableVirtual.d.ts +75 -0
- package/dist/composables/useRsTableVirtual.js +83 -0
- package/dist/composables/useRsTabsNav.d.ts +33 -0
- package/dist/composables/useRsTabsNav.js +137 -0
- package/dist/composables/useRsToast.d.ts +15 -0
- package/dist/composables/useRsToast.js +30 -0
- package/dist/composables/useTableCellTooltip.d.ts +28 -0
- package/dist/composables/useTableCellTooltip.js +177 -0
- package/dist/composables/useTableEdit.d.ts +63 -0
- package/dist/composables/useTableEdit.js +176 -0
- package/dist/composables/useTableRowHighlight.d.ts +14 -0
- package/dist/composables/useTableRowHighlight.js +35 -0
- package/dist/dev/vite-codemirror-deps.d.ts +20 -0
- package/dist/dev/vite-codemirror-deps.js +16 -0
- package/dist/dev/vite-xterm-deps.d.ts +8 -0
- package/dist/dev/vite-xterm-deps.js +3 -0
- package/dist/icons/custom/api.d.ts +37 -0
- package/dist/icons/custom/api.js +56 -0
- package/dist/icons/custom/clickhouse.d.ts +37 -0
- package/dist/icons/custom/clickhouse.js +61 -0
- package/dist/icons/custom/dameng.d.ts +37 -0
- package/dist/icons/custom/dameng.js +81 -0
- package/dist/icons/custom/ftp.d.ts +37 -0
- package/dist/icons/custom/ftp.js +62 -0
- package/dist/icons/custom/kingbase.d.ts +37 -0
- package/dist/icons/custom/kingbase.js +61 -0
- package/dist/icons/custom/mongodb.d.ts +37 -0
- package/dist/icons/custom/mongodb.js +59 -0
- package/dist/icons/custom/mysql.d.ts +37 -0
- package/dist/icons/custom/mysql.js +60 -0
- package/dist/icons/custom/oracle.d.ts +37 -0
- package/dist/icons/custom/oracle.js +61 -0
- package/dist/icons/custom/postgres.d.ts +37 -0
- package/dist/icons/custom/postgres.js +61 -0
- package/dist/icons/custom/redis.d.ts +38 -0
- package/dist/icons/custom/redis.js +60 -0
- package/dist/icons/custom/sqlite.d.ts +37 -0
- package/dist/icons/custom/sqlite.js +59 -0
- package/dist/icons/custom/sqlserver.d.ts +37 -0
- package/dist/icons/custom/sqlserver.js +61 -0
- package/dist/icons/custom/vastbase.d.ts +37 -0
- package/dist/icons/custom/vastbase.js +67 -0
- package/dist/icons/lucide.d.ts +7 -0
- package/dist/icons/lucide.js +74 -0
- package/dist/icons/registry.d.ts +3 -0
- package/dist/icons/registry.js +31 -0
- package/dist/index.d.ts +209 -0
- package/dist/index.js +156 -0
- package/dist/lib/iso-local-datetime.d.ts +17 -0
- package/dist/lib/iso-local-datetime.js +103 -0
- package/dist/lib/rs-dayjs.d.ts +15 -0
- package/dist/lib/rs-dayjs.js +41 -0
- package/dist/locale/interpolate.d.ts +14 -0
- package/dist/locale/interpolate.js +24 -0
- package/dist/locale/messages.d.ts +7 -0
- package/dist/locale/messages.js +407 -0
- package/dist/locale/types.d.ts +3 -0
- package/dist/locale/types.js +4 -0
- package/dist/monaco/debug-decorations.d.ts +21 -0
- package/dist/monaco/debug-decorations2.js +44 -0
- package/dist/monaco/index.d.ts +5 -0
- package/dist/monaco/languages/index.d.ts +3 -0
- package/dist/monaco/languages/mongodb-shell.d.ts +7 -0
- package/dist/monaco/languages/mongodb-shell.js +222 -0
- package/dist/monaco/languages/types.d.ts +30 -0
- package/dist/monaco/languages/types.js +25 -0
- package/dist/monaco/setup.d.ts +9 -0
- package/dist/monaco/setup.js +53 -0
- package/dist/styles.css +2005 -0
- package/dist/theme/apply.d.ts +6 -0
- package/dist/theme/apply.js +10 -0
- package/dist/theme/css-token.d.ts +27 -0
- package/dist/theme/css-token.js +72 -0
- package/dist/theme/presets.d.ts +7 -0
- package/dist/theme/presets.js +74 -0
- package/dist/theme/types.d.ts +97 -0
- package/dist/theme/types.js +65 -0
- package/dist/utils/rs-clipboard.d.ts +17 -0
- package/dist/utils/rs-clipboard.js +187 -0
- package/dist/vite-plugins/monaco-zh-nls.d.ts +2 -0
- package/dist/vite-plugins/monaco-zh-nls.js +92 -0
- package/dist/vite-plugins/silence-antlr-parse-console.d.ts +9 -0
- package/dist/vite-plugins/silence-antlr-parse-console.js +26 -0
- package/package.json +38 -15
- package/src/__tests__/RsBadge.spec.ts +0 -40
- package/src/__tests__/RsBreadcrumb.spec.ts +0 -172
- package/src/__tests__/RsButton.spec.ts +0 -188
- package/src/__tests__/RsCalendarGrid.spec.ts +0 -101
- package/src/__tests__/RsCard.spec.ts +0 -256
- package/src/__tests__/RsCheckbox.spec.ts +0 -36
- package/src/__tests__/RsCodeEditor.spec.ts +0 -111
- package/src/__tests__/RsConfirmDialog.spec.ts +0 -285
- package/src/__tests__/RsContainer.spec.ts +0 -89
- package/src/__tests__/RsContextMenu.spec.ts +0 -130
- package/src/__tests__/RsDatePicker.spec.ts +0 -109
- package/src/__tests__/RsDateTimePicker.spec.ts +0 -80
- package/src/__tests__/RsDescriptions.spec.ts +0 -50
- package/src/__tests__/RsDialog.spec.ts +0 -595
- package/src/__tests__/RsDrawer.spec.ts +0 -292
- package/src/__tests__/RsDropdown.spec.ts +0 -135
- package/src/__tests__/RsDynamicTags.spec.ts +0 -52
- package/src/__tests__/RsEmpty.spec.ts +0 -99
- package/src/__tests__/RsForm.spec.ts +0 -417
- package/src/__tests__/RsFormItem.spec.ts +0 -478
- package/src/__tests__/RsFormList.spec.ts +0 -109
- package/src/__tests__/RsIcon.spec.ts +0 -258
- package/src/__tests__/RsInput.spec.ts +0 -377
- package/src/__tests__/RsInputNumber.spec.ts +0 -151
- package/src/__tests__/RsLabel.spec.ts +0 -106
- package/src/__tests__/RsLink.spec.ts +0 -49
- package/src/__tests__/RsLoading.spec.ts +0 -84
- package/src/__tests__/RsMarkdown.spec.ts +0 -180
- package/src/__tests__/RsMenu.spec.ts +0 -511
- package/src/__tests__/RsNewComponents.spec.ts +0 -17
- package/src/__tests__/RsPagination.spec.ts +0 -223
- package/src/__tests__/RsPopover.spec.ts +0 -140
- package/src/__tests__/RsScrollbar.spec.ts +0 -53
- package/src/__tests__/RsSelect.spec.ts +0 -850
- package/src/__tests__/RsSidebar.spec.ts +0 -119
- package/src/__tests__/RsSplitPane.spec.ts +0 -177
- package/src/__tests__/RsStatCard.spec.ts +0 -79
- package/src/__tests__/RsSteps.spec.ts +0 -125
- package/src/__tests__/RsSwitch.spec.ts +0 -74
- package/src/__tests__/RsTable.a11y.spec.ts +0 -83
- package/src/__tests__/RsTable.dom-baseline.spec.ts +0 -87
- package/src/__tests__/RsTable.perf.spec.ts +0 -122
- package/src/__tests__/RsTable.spec.ts +0 -1207
- package/src/__tests__/RsTable.ssr.spec.ts +0 -71
- package/src/__tests__/RsTable.summary.spec.ts +0 -45
- package/src/__tests__/RsTabs.spec.ts +0 -426
- package/src/__tests__/RsTerminal.spec.ts +0 -218
- package/src/__tests__/RsTimePicker.spec.ts +0 -97
- package/src/__tests__/RsToaster.spec.ts +0 -95
- package/src/__tests__/RsToolbar.spec.ts +0 -75
- package/src/__tests__/RsTooltip.spec.ts +0 -154
- package/src/__tests__/RsTree.spec.ts +0 -573
- package/src/__tests__/RsUpload.spec.ts +0 -216
- package/src/__tests__/RsVirtualList.spec.ts +0 -77
- package/src/__tests__/createRsDialog.spec.ts +0 -158
- package/src/__tests__/css-token.spec.ts +0 -51
- package/src/__tests__/date-picker-utils.spec.ts +0 -119
- package/src/__tests__/dialog-utils.spec.ts +0 -43
- package/src/__tests__/dialog-viewport.spec.ts +0 -38
- package/src/__tests__/form-path.spec.ts +0 -46
- package/src/__tests__/form-rules.spec.ts +0 -139
- package/src/__tests__/iso-local-datetime.spec.ts +0 -58
- package/src/__tests__/perf-budgets.ts +0 -32
- package/src/__tests__/rs-clipboard.spec.ts +0 -142
- package/src/__tests__/rs-select-model.types.spec.ts +0 -28
- package/src/__tests__/rs-table-api.spec.ts +0 -206
- package/src/__tests__/rs-table-compat-matrix.spec.ts +0 -108
- package/src/__tests__/rs-table-echarts-adapter.spec.ts +0 -43
- package/src/__tests__/rs-table-grid-nav.spec.ts +0 -63
- package/src/__tests__/rs-table-isolation.spec.ts +0 -158
- package/src/__tests__/rs-table-slots.types.spec.ts +0 -20
- package/src/__tests__/setup.ts +0 -12
- package/src/__tests__/split-pane-utils.spec.ts +0 -157
- package/src/__tests__/table-chart-utils.spec.ts +0 -88
- package/src/__tests__/table-drag.spec.ts +0 -35
- package/src/__tests__/table-edit-utils.spec.ts +0 -194
- package/src/__tests__/table-summary-utils.spec.ts +0 -62
- package/src/__tests__/table-utils.spec.ts +0 -410
- package/src/__tests__/theme.spec.ts +0 -49
- package/src/__tests__/tree-utils.spec.ts +0 -234
- package/src/__tests__/useRsTableColumnResize.spec.ts +0 -25
- package/src/__tests__/useRsTableCore.perf.spec.ts +0 -170
- package/src/__tests__/useTableCellTooltip.spec.ts +0 -101
- package/src/components/RsAlert.vue +0 -212
- package/src/components/RsAvatar.vue +0 -115
- package/src/components/RsBadge.vue +0 -59
- package/src/components/RsBreadcrumb.vue +0 -65
- package/src/components/RsBreadcrumbItems.vue +0 -36
- package/src/components/RsButton.vue +0 -596
- package/src/components/RsCalendarGrid.vue +0 -318
- package/src/components/RsCard.vue +0 -421
- package/src/components/RsCheckbox.vue +0 -189
- package/src/components/RsCodeBlock.vue +0 -327
- package/src/components/RsCodeEditor.vue +0 -597
- package/src/components/RsConfigProvider.vue +0 -92
- package/src/components/RsConfirmDialog.vue +0 -365
- package/src/components/RsContainer.vue +0 -235
- package/src/components/RsContextMenu.vue +0 -277
- package/src/components/RsContextMenuItems.vue +0 -77
- package/src/components/RsDatePicker.vue +0 -1033
- package/src/components/RsDateTimePicker.vue +0 -67
- package/src/components/RsDescriptions.vue +0 -186
- package/src/components/RsDescriptionsItem.vue +0 -32
- package/src/components/RsDialog.vue +0 -813
- package/src/components/RsDivider.vue +0 -89
- package/src/components/RsDrawer.vue +0 -979
- package/src/components/RsDropdown.vue +0 -283
- package/src/components/RsDropdownItems.vue +0 -90
- package/src/components/RsDynamicTags.vue +0 -531
- package/src/components/RsEmpty.vue +0 -107
- package/src/components/RsForm.vue +0 -287
- package/src/components/RsFormItem.vue +0 -423
- package/src/components/RsFormItemControl.vue +0 -21
- package/src/components/RsFormList.vue +0 -117
- package/src/components/RsIcon.vue +0 -104
- package/src/components/RsInput.vue +0 -1508
- package/src/components/RsInputNumber.vue +0 -582
- package/src/components/RsLabel.vue +0 -69
- package/src/components/RsLink.vue +0 -106
- package/src/components/RsLoading.vue +0 -171
- package/src/components/RsLoadingBar.vue +0 -151
- package/src/components/RsMarkdown.vue +0 -348
- package/src/components/RsMenu.vue +0 -314
- package/src/components/RsMenuItems.vue +0 -263
- package/src/components/RsMonacoEditor.vue +0 -567
- package/src/components/RsPagination.vue +0 -263
- package/src/components/RsPopover.vue +0 -79
- package/src/components/RsProseEditor.vue +0 -160
- package/src/components/RsRadio.vue +0 -81
- package/src/components/RsRadioItem.vue +0 -156
- package/src/components/RsScrollbar.vue +0 -171
- package/src/components/RsSelect.vue +0 -786
- package/src/components/RsSidebar.vue +0 -121
- package/src/components/RsSidebarGroup.vue +0 -32
- package/src/components/RsSidebarItem.vue +0 -72
- package/src/components/RsSplitPane.vue +0 -714
- package/src/components/RsStatCard.vue +0 -85
- package/src/components/RsSteps.vue +0 -138
- package/src/components/RsSwitch.vue +0 -192
- package/src/components/RsTable.vue +0 -762
- package/src/components/RsTabs.vue +0 -1283
- package/src/components/RsTag.vue +0 -191
- package/src/components/RsTerminal.vue +0 -840
- package/src/components/RsTimePicker.vue +0 -617
- package/src/components/RsTimePickerColumns.vue +0 -285
- package/src/components/RsToaster.vue +0 -436
- package/src/components/RsToolbar.vue +0 -135
- package/src/components/RsTooltip.vue +0 -151
- package/src/components/RsTooltipProvider.vue +0 -30
- package/src/components/RsTree.vue +0 -1270
- package/src/components/RsUpload.vue +0 -412
- package/src/components/RsVNodeHost.vue +0 -20
- package/src/components/RsVirtualList.vue +0 -217
- package/src/components/avatar-utils.ts +0 -19
- package/src/components/breadcrumb-utils.ts +0 -19
- package/src/components/button-utils.ts +0 -39
- package/src/components/class-utils.ts +0 -29
- package/src/components/code-editor-utils.ts +0 -106
- package/src/components/code-mirror-completion.ts +0 -40
- package/src/components/code-mirror-diagnostics.ts +0 -52
- package/src/components/code-mirror-ghost.ts +0 -158
- package/src/components/code-mirror-inline-edit.ts +0 -55
- package/src/components/code-mirror-intel.ts +0 -81
- package/src/components/code-mirror-lang.ts +0 -128
- package/src/components/context-menu-utils.ts +0 -26
- package/src/components/date-picker-utils.ts +0 -475
- package/src/components/date-range-validation.ts +0 -29
- package/src/components/date-validation.ts +0 -38
- package/src/components/descriptions-utils.ts +0 -24
- package/src/components/dialog-utils.ts +0 -183
- package/src/components/dialog-viewport.ts +0 -48
- package/src/components/dialog-window.ts +0 -318
- package/src/components/drawer-utils.ts +0 -109
- package/src/components/dropdown-utils.ts +0 -31
- package/src/components/form-item-control.ts +0 -55
- package/src/components/form-path.ts +0 -92
- package/src/components/form-rules.ts +0 -311
- package/src/components/form-utils.ts +0 -219
- package/src/components/input-number-utils.ts +0 -128
- package/src/components/input-rules.ts +0 -84
- package/src/components/loading-utils.ts +0 -8
- package/src/components/markdown-utils.ts +0 -174
- package/src/components/menu-utils.ts +0 -59
- package/src/components/overlay-utils.ts +0 -50
- package/src/components/pagination-utils.ts +0 -38
- package/src/components/popover-utils.ts +0 -8
- package/src/components/radio-utils.ts +0 -12
- package/src/components/reka.ts +0 -111
- package/src/components/resolve-radius.ts +0 -22
- package/src/components/resolve-size.ts +0 -29
- package/src/components/scrollbar-utils.ts +0 -10
- package/src/components/select-utils.ts +0 -372
- package/src/components/split-pane-utils.ts +0 -254
- package/src/components/steps-utils.ts +0 -22
- package/src/components/table/RsTableBody.vue +0 -217
- package/src/components/table/RsTableBodyRow.vue +0 -376
- package/src/components/table/RsTableCell.vue +0 -239
- package/src/components/table/RsTableCellContent.ts +0 -18
- package/src/components/table/RsTableCellEditor.vue +0 -352
- package/src/components/table/RsTableColGroup.vue +0 -41
- package/src/components/table/RsTableEditGutter.vue +0 -54
- package/src/components/table/RsTableHeader.vue +0 -158
- package/src/components/table/RsTableHeaderFilter.vue +0 -107
- package/src/components/table/RsTableRowStatus.vue +0 -69
- package/src/components/table/RsTableSummaryRow.vue +0 -52
- package/src/components/table/rs-table-api.ts +0 -99
- package/src/components/table/rs-table-compat-matrix.ts +0 -71
- package/src/components/table/rs-table-echarts-adapter.ts +0 -81
- package/src/components/table/rs-table-feature-host.ts +0 -178
- package/src/components/table/rs-table-grid-nav.ts +0 -122
- package/src/components/table/rs-table-header-types.ts +0 -47
- package/src/components/table/rs-table-module-registry.ts +0 -72
- package/src/components/table/rs-table-props.ts +0 -340
- package/src/components/table/rs-table-view-context.ts +0 -258
- package/src/components/table/table-chart-utils.ts +0 -165
- package/src/components/table/table-context-menu.ts +0 -53
- package/src/components/table/table-edit-utils.ts +0 -496
- package/src/components/table/table-features.ts +0 -284
- package/src/components/table/table-keys.ts +0 -12
- package/src/components/table/table-summary-utils.ts +0 -194
- package/src/components/table-drag.ts +0 -215
- package/src/components/table-utils.ts +0 -1400
- package/src/components/tabs-utils.ts +0 -247
- package/src/components/terminal-utils.ts +0 -323
- package/src/components/terminal-wheel.ts +0 -74
- package/src/components/time-picker-utils.ts +0 -240
- package/src/components/time-range-validation.ts +0 -23
- package/src/components/time-validation.ts +0 -20
- package/src/components/tree-utils.ts +0 -518
- package/src/components/upload-utils.ts +0 -177
- package/src/components/use-rs-select.ts +0 -451
- package/src/components/virtual-list-utils.ts +0 -30
- package/src/composables/assembleRsTableApi.ts +0 -79
- package/src/composables/bindRsTableViewContext.ts +0 -269
- package/src/composables/createRsDialog.ts +0 -408
- package/src/composables/createRsTableEditEmitBridge.ts +0 -38
- package/src/composables/useClickOutside.ts +0 -22
- package/src/composables/useRsConfig.ts +0 -98
- package/src/composables/useRsI18n.ts +0 -33
- package/src/composables/useRsLoadingBar.ts +0 -36
- package/src/composables/useRsTable.ts +0 -134
- package/src/composables/useRsTableA11y.ts +0 -52
- package/src/composables/useRsTableChartBridge.ts +0 -79
- package/src/composables/useRsTableColumnLayout.ts +0 -320
- package/src/composables/useRsTableColumnResize.ts +0 -244
- package/src/composables/useRsTableColumnVirtual.ts +0 -180
- package/src/composables/useRsTableColumns.ts +0 -200
- package/src/composables/useRsTableContextMenu.ts +0 -257
- package/src/composables/useRsTableCore.ts +0 -258
- package/src/composables/useRsTableEditActions.ts +0 -606
- package/src/composables/useRsTableEditLayer.ts +0 -251
- package/src/composables/useRsTableEngine.ts +0 -357
- package/src/composables/useRsTableGridKeyboard.ts +0 -123
- package/src/composables/useRsTableHeadless.ts +0 -145
- package/src/composables/useRsTableInteraction.ts +0 -433
- package/src/composables/useRsTableScrollHost.ts +0 -75
- package/src/composables/useRsTableScrollLayout.ts +0 -255
- package/src/composables/useRsTableSelectionSource.ts +0 -89
- package/src/composables/useRsTableShell.ts +0 -416
- package/src/composables/useRsTableShellChrome.ts +0 -170
- package/src/composables/useRsTableSummary.ts +0 -113
- package/src/composables/useRsTableViewProvide.ts +0 -263
- package/src/composables/useRsTableVirtual.ts +0 -154
- package/src/composables/useRsTabsNav.ts +0 -191
- package/src/composables/useRsToast.ts +0 -48
- package/src/composables/useTableCellTooltip.ts +0 -240
- package/src/composables/useTableEdit.ts +0 -271
- package/src/composables/useTableRowHighlight.ts +0 -50
- package/src/dev/vite-codemirror-deps.ts +0 -20
- package/src/dev/vite-xterm-deps.ts +0 -8
- package/src/icons/custom/api.ts +0 -54
- package/src/icons/custom/clickhouse.ts +0 -52
- package/src/icons/custom/dameng.ts +0 -83
- package/src/icons/custom/ftp.ts +0 -61
- package/src/icons/custom/kingbase.ts +0 -52
- package/src/icons/custom/mongodb.ts +0 -50
- package/src/icons/custom/mysql.ts +0 -51
- package/src/icons/custom/oracle.ts +0 -52
- package/src/icons/custom/postgres.ts +0 -52
- package/src/icons/custom/redis.ts +0 -51
- package/src/icons/custom/sqlite.ts +0 -50
- package/src/icons/custom/sqlserver.ts +0 -52
- package/src/icons/custom/vastbase.ts +0 -57
- package/src/icons/lucide.ts +0 -94
- package/src/icons/registry.ts +0 -35
- package/src/index.ts +0 -813
- package/src/lib/iso-local-datetime.ts +0 -152
- package/src/lib/rs-dayjs.ts +0 -56
- package/src/locale/interpolate.ts +0 -32
- package/src/locale/messages.ts +0 -408
- package/src/locale/types.ts +0 -5
- package/src/monaco/debug-decorations.ts +0 -70
- package/src/monaco/index.ts +0 -23
- package/src/monaco/languages/index.ts +0 -22
- package/src/monaco/languages/mongodb-shell.ts +0 -125
- package/src/monaco/languages/types.ts +0 -59
- package/src/monaco/setup.ts +0 -101
- package/src/styles.css +0 -1364
- package/src/theme/apply.ts +0 -12
- package/src/theme/css-token.ts +0 -107
- package/src/theme/presets.ts +0 -73
- package/src/theme/types.ts +0 -149
- package/src/utils/rs-clipboard.ts +0 -272
- package/src/vite-env.d.ts +0 -7
- package/vite-plugins/monaco-zh-nls.ts +0 -101
- package/vite-plugins/silence-antlr-parse-console.ts +0 -29
- /package/{src → dist}/components/table/rs-table.css +0 -0
- /package/{src → dist}/monaco/debug-decorations.css +0 -0
- /package/{src → dist}/theme/brand.example.css +0 -0
|
@@ -1,1400 +0,0 @@
|
|
|
1
|
-
import type { VNodeChild } from 'vue'
|
|
2
|
-
|
|
3
|
-
export type RsTableColumnAlign = 'left' | 'center' | 'right'
|
|
4
|
-
export type RsTableColumnFixed = 'left' | 'right'
|
|
5
|
-
export type RsTableSortOrder = 'asc' | 'desc' | null
|
|
6
|
-
/**
|
|
7
|
-
* 行选择模式:
|
|
8
|
-
* - checkbox / radio:左侧选择列
|
|
9
|
-
* - row:无选择列,点击行多选(Ctrl/Cmd 切换、Shift 范围)
|
|
10
|
-
*/
|
|
11
|
-
export type RsTableSelectionType = 'checkbox' | 'radio' | 'row'
|
|
12
|
-
export type RsTableSize = 'sm' | 'md' | 'lg'
|
|
13
|
-
|
|
14
|
-
/** 行数据最小约束:任意非原始类型对象(interface / type 均可) */
|
|
15
|
-
export type RsTableRowData = object
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 可选约定字段(非强制)。
|
|
19
|
-
* - 未传 `rowKey` 时,`resolveRowKey` 依次回退 `id` → `key` → 行索引
|
|
20
|
-
* - `disabled === true` 时行不可选
|
|
21
|
-
*/
|
|
22
|
-
export interface RsTableRowConvention {
|
|
23
|
-
id?: string | number
|
|
24
|
-
key?: string | number
|
|
25
|
-
disabled?: boolean
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 行字段访问器:列 key( keyof 字符串键)、任意路径字符串、或自定义函数。
|
|
30
|
-
* 用于 `rowKey`、`groupBy` 等配置。
|
|
31
|
-
*/
|
|
32
|
-
export type RsTableFieldAccessor<T extends RsTableRowData = RsTableRowData> =
|
|
33
|
-
| Extract<keyof T, string>
|
|
34
|
-
| string
|
|
35
|
-
| ((row: T) => string)
|
|
36
|
-
|
|
37
|
-
/** 行唯一键配置 */
|
|
38
|
-
export type RsTableRowKey<T extends RsTableRowData = RsTableRowData> = RsTableFieldAccessor<T>
|
|
39
|
-
|
|
40
|
-
/** 分组字段配置 */
|
|
41
|
-
export type RsTableGroupBy<T extends RsTableRowData = RsTableRowData> = RsTableFieldAccessor<T>
|
|
42
|
-
|
|
43
|
-
/** 单元格 render 返回值(文本、数字或 Vue VNode) */
|
|
44
|
-
export type RsTableCellRenderResult = VNodeChild
|
|
45
|
-
|
|
46
|
-
/** 单元格编辑/展示值类型 */
|
|
47
|
-
export type RsTableCellValueType =
|
|
48
|
-
| 'text'
|
|
49
|
-
| 'number'
|
|
50
|
-
| 'date'
|
|
51
|
-
| 'datetime'
|
|
52
|
-
| 'boolean'
|
|
53
|
-
| 'select'
|
|
54
|
-
| 'textarea'
|
|
55
|
-
|
|
56
|
-
/** 列级编辑器选项(仅编辑挂载时读取,不影响展示路径)。 */
|
|
57
|
-
export interface RsTableColumnEditorOptions {
|
|
58
|
-
/**
|
|
59
|
-
* select:选项列表;也可按行返回(如外键引用表随 schema 变化)。
|
|
60
|
-
* 函数形式在进入编辑态时按当前行解析。
|
|
61
|
-
*/
|
|
62
|
-
options?:
|
|
63
|
-
| import('./select-utils').RsSelectOptions
|
|
64
|
-
| ((row: RsTableRowData, index: number) => import('./select-utils').RsSelectOptions)
|
|
65
|
-
/** select:可搜索 */
|
|
66
|
-
searchable?: boolean
|
|
67
|
-
/**
|
|
68
|
-
* select:允许搜索框手输自定义值(Enter / 「使用 xxx」)。
|
|
69
|
-
* 适合类型名、厂商扩展类型等预设列表外的输入。
|
|
70
|
-
*/
|
|
71
|
-
creatable?: boolean
|
|
72
|
-
/**
|
|
73
|
-
* select:多选。草稿仍为字符串,选项间以 `, ` 拼接;
|
|
74
|
-
* 多选时在下拉关闭时提交(避免每点一项就结束编辑)。
|
|
75
|
-
*/
|
|
76
|
-
multiple?: boolean
|
|
77
|
-
/** select / date:可清空;表格单元格 select 默认 false(仅选择,无清除 X) */
|
|
78
|
-
clearable?: boolean
|
|
79
|
-
/** number:最小值(对齐 InputNumber min) */
|
|
80
|
-
min?: number
|
|
81
|
-
/** number:最大值 */
|
|
82
|
-
max?: number
|
|
83
|
-
/** number:步进 */
|
|
84
|
-
step?: number | string
|
|
85
|
-
/** number:小数位 */
|
|
86
|
-
precision?: number
|
|
87
|
-
/** number:是否显示步进按钮;inline 单元格默认 false */
|
|
88
|
-
controls?: boolean
|
|
89
|
-
/** datetime:是否含秒 */
|
|
90
|
-
withSeconds?: boolean
|
|
91
|
-
/** datetime:时区策略(utc 提交时补 Z) */
|
|
92
|
-
timezone?: 'local' | 'utc'
|
|
93
|
-
/** textarea:可见行数 */
|
|
94
|
-
rows?: number
|
|
95
|
-
/**
|
|
96
|
-
* 编辑呈现:inline 为单元格内编辑;dialog 由外层弹窗承接(大字段)。
|
|
97
|
-
* 为 dialog 时表格不进入行内编辑态,改为发出 cellEditDialog。
|
|
98
|
-
*/
|
|
99
|
-
presentation?: 'inline' | 'dialog'
|
|
100
|
-
/** 进入编辑时光标策略覆盖 */
|
|
101
|
-
focusMode?: 'end' | 'select' | 'start'
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** 已按行解析后的编辑器选项(options 仅为列表,供单元格编辑器使用)。 */
|
|
105
|
-
export type RsTableColumnEditorOptionsResolved = Omit<RsTableColumnEditorOptions, 'options'> & {
|
|
106
|
-
options?: import('./select-utils').RsSelectOptions
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function readConvention(row: object): Partial<RsTableRowConvention> {
|
|
110
|
-
const record = row as Record<string, unknown>
|
|
111
|
-
const result: Partial<RsTableRowConvention> = {}
|
|
112
|
-
const { id, key, disabled } = record
|
|
113
|
-
if (typeof id === 'string' || typeof id === 'number') result.id = id
|
|
114
|
-
if (typeof key === 'string' || typeof key === 'number') result.key = key
|
|
115
|
-
if (typeof disabled === 'boolean') result.disabled = disabled
|
|
116
|
-
return result
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function formatComparableValue(value: unknown): string {
|
|
120
|
-
if (value === null || value === undefined) return ''
|
|
121
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
122
|
-
return String(value)
|
|
123
|
-
}
|
|
124
|
-
if (value instanceof Date) return value.toISOString()
|
|
125
|
-
return JSON.stringify(value)
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function readRowKeyFallback(row: object): string | undefined {
|
|
129
|
-
const { id, key } = readConvention(row)
|
|
130
|
-
if (typeof id === 'string' || typeof id === 'number') return String(id)
|
|
131
|
-
if (typeof key === 'string' || typeof key === 'number') return String(key)
|
|
132
|
-
return undefined
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export interface RsTableSortState {
|
|
136
|
-
key: string
|
|
137
|
-
order: Exclude<RsTableSortOrder, null>
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface RsTableColumn<T extends RsTableRowData = Record<string, unknown>> {
|
|
141
|
-
key: string
|
|
142
|
-
title: string
|
|
143
|
-
dataIndex?: Extract<keyof T, string> | string
|
|
144
|
-
width?: number | string
|
|
145
|
-
minWidth?: number | string
|
|
146
|
-
align?: RsTableColumnAlign
|
|
147
|
-
sortable?: boolean
|
|
148
|
-
sorter?: (left: T, right: T) => number
|
|
149
|
-
/** 表头显示筛选图标,配合表格 `columnFilters` 使用 */
|
|
150
|
-
filterable?: boolean
|
|
151
|
-
/** 自定义列筛选;默认对单元格值做包含匹配 */
|
|
152
|
-
filter?: (value: unknown, row: T, query: string) => boolean
|
|
153
|
-
fixed?: RsTableColumnFixed
|
|
154
|
-
ellipsis?: boolean
|
|
155
|
-
/**
|
|
156
|
-
* 格子里看不到的额外提示(always)。不要重复可见文本。
|
|
157
|
-
* 可见文本被截断时的提示用 `ellipsis`:只量表格自身省略容器。
|
|
158
|
-
*/
|
|
159
|
-
tooltip?: (row: T, index: number) => string | null | undefined
|
|
160
|
-
/** 表头原生 title(宽表勿逐列挂 RsTooltip,避免成百实例) */
|
|
161
|
-
headerTip?: string
|
|
162
|
-
/** 是否允许行内编辑;也可在表格级设置 editable */
|
|
163
|
-
editable?: boolean | ((row: T, index: number) => boolean)
|
|
164
|
-
/** 单元格值类型,控制行内编辑控件(默认 text) */
|
|
165
|
-
valueType?: RsTableCellValueType
|
|
166
|
-
/** 编辑器附加选项(select options 等);仅进入编辑态时使用 */
|
|
167
|
-
editorOptions?: RsTableColumnEditorOptions
|
|
168
|
-
/** 展示格式化 */
|
|
169
|
-
formatter?: (value: unknown, row: T, index: number) => string
|
|
170
|
-
/** 编辑输入解析 */
|
|
171
|
-
parser?: (input: string, row: T, index: number) => unknown
|
|
172
|
-
/** 编辑校验,返回错误文案;支持异步 */
|
|
173
|
-
validator?: (
|
|
174
|
-
value: unknown,
|
|
175
|
-
row: T,
|
|
176
|
-
index: number,
|
|
177
|
-
) => string | null | Promise<string | null>
|
|
178
|
-
/** 是否允许 NULL(覆盖表格 allowNull) */
|
|
179
|
-
nullable?: boolean
|
|
180
|
-
/** 空字符串提交为 null(需 nullable) */
|
|
181
|
-
emptyAsNull?: boolean
|
|
182
|
-
/** 提交时机 */
|
|
183
|
-
commitOn?: 'blur' | 'enter' | 'change' | 'manual'
|
|
184
|
-
/** 进入编辑的触发方式 */
|
|
185
|
-
editTrigger?: 'click' | 'dblclick'
|
|
186
|
-
/**
|
|
187
|
-
* 自定义单元格展示内容(string / number / VNode 等 `VNodeChild`)。
|
|
188
|
-
* 仅影响展示层;排序、筛选、编辑、复制仍读取 `dataIndex` / `key` 字段。
|
|
189
|
-
* 纯文本格式化请优先用 `formatter`。
|
|
190
|
-
*/
|
|
191
|
-
render?: (row: T, index: number) => RsTableCellRenderResult
|
|
192
|
-
/**
|
|
193
|
-
* 列汇总(footer / 分组小计)。配合表格 `summaryMode`:
|
|
194
|
-
* - client:对当前 viewRows 做本地聚合
|
|
195
|
-
* - server:展示 `summaryData[column.key]`
|
|
196
|
-
*/
|
|
197
|
-
summary?: import('./table/table-summary-utils').RsTableColumnSummary<T>
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export type RsTableSelectAllState = 'checked' | 'indeterminate' | 'unchecked'
|
|
201
|
-
|
|
202
|
-
export type RsTableRowEntry<T extends RsTableRowData = Record<string, unknown>> =
|
|
203
|
-
| {
|
|
204
|
-
type: 'row'
|
|
205
|
-
row: T
|
|
206
|
-
rowIndex: number
|
|
207
|
-
/** 树表深度(根为 0);非树表为 undefined */
|
|
208
|
-
depth?: number
|
|
209
|
-
/** 树表:是否有可展开子节点 */
|
|
210
|
-
hasChildren?: boolean
|
|
211
|
-
/** 树表:父行 key;根为 null */
|
|
212
|
-
parentKey?: string | null
|
|
213
|
-
/** 树表:展平时确定的稳定行 key(优先于重新 resolve) */
|
|
214
|
-
treeKey?: string
|
|
215
|
-
}
|
|
216
|
-
| { type: 'group'; key: string; label: string }
|
|
217
|
-
| { type: 'expand'; row: T; rowIndex: number; rowKey: string }
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* 树形表格配置。
|
|
221
|
-
* 与 detail 展开(`expandable`)互斥:树表在数据列内缩进展开,不插入 `#expand` 明细行。
|
|
222
|
-
*/
|
|
223
|
-
export interface RsTableTreeConfig<T extends RsTableRowData = RsTableRowData> {
|
|
224
|
-
/** 子节点字段名,默认 `children` */
|
|
225
|
-
childrenField?: string
|
|
226
|
-
/** 叶子标记字段名,默认 `isLeaf`;为 true 时不可展开 */
|
|
227
|
-
isLeafField?: string
|
|
228
|
-
/**
|
|
229
|
-
* 展示缩进与展开按钮的列 key;
|
|
230
|
-
* 缺省为第一列(`columns[0].key`)。
|
|
231
|
-
*/
|
|
232
|
-
expandColumnKey?: string
|
|
233
|
-
/**
|
|
234
|
-
* 是否自动将展开列设为 `fixed: 'left'`(避免横向滚动 / 列虚拟时丢失展开钮)。
|
|
235
|
-
* @default true
|
|
236
|
-
*/
|
|
237
|
-
fixExpandColumn?: boolean
|
|
238
|
-
/** 每一层缩进像素;缺省按表格 size(sm/md/lg → 16/20/24) */
|
|
239
|
-
indent?: number
|
|
240
|
-
/**
|
|
241
|
-
* 仅在首次有数据时展开全部可展开节点(非受控)。
|
|
242
|
-
* 若同时提供非空 `defaultExpandedRowKeys`,则以后者为准且不再全开。
|
|
243
|
-
*/
|
|
244
|
-
defaultExpandAll?: boolean
|
|
245
|
-
/**
|
|
246
|
-
* 勾选是否父子独立。
|
|
247
|
-
* - `true`(默认):与平面表一致,只切换当前行
|
|
248
|
-
* - `false`:父子联动,父级可呈半选
|
|
249
|
-
*/
|
|
250
|
-
checkStrictly?: boolean
|
|
251
|
-
/**
|
|
252
|
-
* 懒加载:无子节点且非叶子时仍显示展开按钮;
|
|
253
|
-
* 首次展开时调用 `loadData`。
|
|
254
|
-
*/
|
|
255
|
-
lazy?: boolean
|
|
256
|
-
/**
|
|
257
|
-
* 懒加载回调。可直接改 `row[childrenField]`,或返回子节点数组由表格写入。
|
|
258
|
-
* 使用 bivarianceHack:具体行类型的 treeConfig 可赋给更宽泛的 treeConfig prop(如 RsGrid)。
|
|
259
|
-
*/
|
|
260
|
-
loadData?: {
|
|
261
|
-
bivarianceHack(row: T, key: string): void | T[] | Promise<void | T[]>
|
|
262
|
-
}['bivarianceHack']
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/** 树表节点索引(供级联勾选 / 半选) */
|
|
266
|
-
export interface RsTableTreeNodeIndex {
|
|
267
|
-
parentKey: string | null
|
|
268
|
-
childrenKeys: string[]
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export type RsTableTreeCheckState = 'checked' | 'indeterminate' | 'unchecked'
|
|
272
|
-
|
|
273
|
-
export const TABLE_ROW_HEIGHT = {
|
|
274
|
-
sm: 33,
|
|
275
|
-
md: 41,
|
|
276
|
-
lg: 48,
|
|
277
|
-
group: 36,
|
|
278
|
-
expand: 80,
|
|
279
|
-
} as const
|
|
280
|
-
|
|
281
|
-
export interface RsTableFixedCellStyle {
|
|
282
|
-
fixed: RsTableColumnFixed
|
|
283
|
-
left?: number
|
|
284
|
-
right?: number
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
export function getCellValue<T extends RsTableRowData>(row: T, column: RsTableColumn<T>): unknown {
|
|
288
|
-
return row[(column.dataIndex ?? column.key) as keyof T]
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export type RsTableCellTooltipMode = 'overflow' | 'always'
|
|
292
|
-
|
|
293
|
-
export function columnUsesSharedTooltip<T extends RsTableRowData>(column: RsTableColumn<T>): boolean {
|
|
294
|
-
return Boolean(column.ellipsis || column.tooltip)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
export function resolveCellTooltipMode<T extends RsTableRowData>(
|
|
298
|
-
column: RsTableColumn<T>,
|
|
299
|
-
): RsTableCellTooltipMode | null {
|
|
300
|
-
if (column.tooltip) return 'always'
|
|
301
|
-
if (column.ellipsis) return 'overflow'
|
|
302
|
-
return null
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export function resolveCellTooltipText<T extends RsTableRowData>(
|
|
306
|
-
column: RsTableColumn<T>,
|
|
307
|
-
row: T,
|
|
308
|
-
index: number,
|
|
309
|
-
): string {
|
|
310
|
-
if (column.tooltip) {
|
|
311
|
-
const tip = column.tooltip(row, index)
|
|
312
|
-
if (tip != null && tip !== '') return String(tip)
|
|
313
|
-
return ''
|
|
314
|
-
}
|
|
315
|
-
const value = getCellValue(row, column)
|
|
316
|
-
if (column.formatter) {
|
|
317
|
-
return column.formatter(value, row, index)
|
|
318
|
-
}
|
|
319
|
-
if (value == null) return ''
|
|
320
|
-
if (typeof value === 'object') {
|
|
321
|
-
try {
|
|
322
|
-
return JSON.stringify(value)
|
|
323
|
-
} catch {
|
|
324
|
-
return Object.prototype.toString.call(value)
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return String(value)
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
export function compareTableValues(a: unknown, b: unknown): number {
|
|
331
|
-
if (a === b) return 0
|
|
332
|
-
if (a === undefined || a === null) return -1
|
|
333
|
-
if (b === undefined || b === null) return 1
|
|
334
|
-
if (typeof a === 'number' && typeof b === 'number') return a - b
|
|
335
|
-
return formatComparableValue(a).localeCompare(formatComparableValue(b))
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export function toggleSortState(current: RsTableSortState | null, key: string): RsTableSortState | null {
|
|
339
|
-
if (current?.key !== key) return { key, order: 'asc' }
|
|
340
|
-
if (current.order === 'asc') return { key, order: 'desc' }
|
|
341
|
-
return null
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
export function toggleMultiSortState(
|
|
345
|
-
sorts: readonly RsTableSortState[],
|
|
346
|
-
key: string,
|
|
347
|
-
maxSort = 3,
|
|
348
|
-
): RsTableSortState[] {
|
|
349
|
-
const existingIndex = sorts.findIndex((item) => item.key === key)
|
|
350
|
-
if (existingIndex < 0) {
|
|
351
|
-
const next = [...sorts, { key, order: 'asc' as const }]
|
|
352
|
-
return next.length > maxSort ? next.slice(next.length - maxSort) : next
|
|
353
|
-
}
|
|
354
|
-
const existing = sorts[existingIndex]
|
|
355
|
-
if (!existing) return [...sorts]
|
|
356
|
-
if (existing.order === 'asc') {
|
|
357
|
-
return sorts.map((item, index) => (index === existingIndex ? { key, order: 'desc' as const } : item))
|
|
358
|
-
}
|
|
359
|
-
return sorts.filter((_, index) => index !== existingIndex)
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export function getSortOrderForKey(sorts: readonly RsTableSortState[], key: string): RsTableSortOrder {
|
|
363
|
-
return sorts.find((item) => item.key === key)?.order ?? null
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
export function getSortPriorityForKey(sorts: readonly RsTableSortState[], key: string): number {
|
|
367
|
-
const index = sorts.findIndex((item) => item.key === key)
|
|
368
|
-
return index >= 0 ? index + 1 : 0
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
export function compareTableRowsBySort<T extends RsTableRowData>(
|
|
372
|
-
left: T,
|
|
373
|
-
right: T,
|
|
374
|
-
column: RsTableColumn<T>,
|
|
375
|
-
order: Exclude<RsTableSortOrder, null>,
|
|
376
|
-
): number {
|
|
377
|
-
const direction = order === 'asc' ? 1 : -1
|
|
378
|
-
if (column.sorter) return column.sorter(left, right) * direction
|
|
379
|
-
return compareTableValues(getCellValue(left, column), getCellValue(right, column)) * direction
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
export function sortTableRows<T extends RsTableRowData>(
|
|
383
|
-
rows: readonly T[],
|
|
384
|
-
columns: readonly RsTableColumn<T>[],
|
|
385
|
-
sort: RsTableSortState | null,
|
|
386
|
-
): T[] {
|
|
387
|
-
if (!sort) return rows as T[]
|
|
388
|
-
const column = columns.find((item) => item.key === sort.key)
|
|
389
|
-
if (!column) return rows as T[]
|
|
390
|
-
return [...rows].sort((left, right) => compareTableRowsBySort(left, right, column, sort.order))
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
export function sortTableRowsMulti<T extends RsTableRowData>(
|
|
394
|
-
rows: readonly T[],
|
|
395
|
-
columns: readonly RsTableColumn<T>[],
|
|
396
|
-
sorts: readonly RsTableSortState[],
|
|
397
|
-
): T[] {
|
|
398
|
-
if (sorts.length === 0) return rows as T[]
|
|
399
|
-
return [...rows].sort((left, right) => {
|
|
400
|
-
for (const sort of sorts) {
|
|
401
|
-
const column = columns.find((item) => item.key === sort.key)
|
|
402
|
-
if (!column) continue
|
|
403
|
-
const compare = compareTableRowsBySort(left, right, column, sort.order)
|
|
404
|
-
if (compare !== 0) return compare
|
|
405
|
-
}
|
|
406
|
-
return 0
|
|
407
|
-
})
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
export function filterTableRows<T extends RsTableRowData>(
|
|
411
|
-
rows: readonly T[],
|
|
412
|
-
query: string,
|
|
413
|
-
columns: readonly RsTableColumn<T>[],
|
|
414
|
-
keys?: string[],
|
|
415
|
-
): T[] {
|
|
416
|
-
const trimmed = query.trim()
|
|
417
|
-
if (!trimmed) return rows as T[]
|
|
418
|
-
const searchKeys = keys ?? columns.map((column) => column.key)
|
|
419
|
-
const lower = trimmed.toLowerCase()
|
|
420
|
-
return rows.filter((row) =>
|
|
421
|
-
searchKeys.some((key) => {
|
|
422
|
-
const column = columns.find((item) => item.key === key)
|
|
423
|
-
const value = column ? getCellValue(row, column) : row[key as keyof T]
|
|
424
|
-
return formatComparableValue(value).toLowerCase().includes(lower)
|
|
425
|
-
}),
|
|
426
|
-
)
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
export function filterTableRowsByColumnFilters<T extends RsTableRowData>(
|
|
430
|
-
rows: readonly T[],
|
|
431
|
-
columns: readonly RsTableColumn<T>[],
|
|
432
|
-
filters: Record<string, string>,
|
|
433
|
-
): T[] {
|
|
434
|
-
const active = Object.entries(filters)
|
|
435
|
-
.map(([key, query]) => [key, query.trim()] as const)
|
|
436
|
-
.filter(([, query]) => query.length > 0)
|
|
437
|
-
if (!active.length) return rows as T[]
|
|
438
|
-
|
|
439
|
-
const columnMap = new Map(columns.map((column) => [column.key, column]))
|
|
440
|
-
return rows.filter((row) =>
|
|
441
|
-
active.every(([key, query]) => {
|
|
442
|
-
const column = columnMap.get(key)
|
|
443
|
-
if (!column) return true
|
|
444
|
-
const value = getCellValue(row, column)
|
|
445
|
-
if (column.filter) return column.filter(value, row, query)
|
|
446
|
-
const lower = query.toLowerCase()
|
|
447
|
-
return formatComparableValue(value).toLowerCase().includes(lower)
|
|
448
|
-
}),
|
|
449
|
-
)
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
export function isColumnFilterActive(filters: Record<string, string>, key: string): boolean {
|
|
453
|
-
return Boolean(filters[key]?.trim())
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
export function resolveGroupKey<T extends RsTableRowData>(
|
|
457
|
-
row: T,
|
|
458
|
-
groupBy: RsTableGroupBy<T>,
|
|
459
|
-
): string {
|
|
460
|
-
if (typeof groupBy === 'function') return groupBy(row)
|
|
461
|
-
return String(row[groupBy as keyof T] ?? '')
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
export function groupTableRows<T extends RsTableRowData>(
|
|
465
|
-
rows: readonly T[],
|
|
466
|
-
groupBy: RsTableGroupBy<T>,
|
|
467
|
-
labelFormatter?: (key: string) => string,
|
|
468
|
-
): RsTableRowEntry<T>[] {
|
|
469
|
-
const result: RsTableRowEntry<T>[] = []
|
|
470
|
-
let lastKey: string | null = null
|
|
471
|
-
rows.forEach((row, rowIndex) => {
|
|
472
|
-
const key = resolveGroupKey(row, groupBy)
|
|
473
|
-
if (key !== lastKey) {
|
|
474
|
-
result.push({ type: 'group', key, label: labelFormatter?.(key) ?? key })
|
|
475
|
-
lastKey = key
|
|
476
|
-
}
|
|
477
|
-
result.push({ type: 'row', row, rowIndex })
|
|
478
|
-
})
|
|
479
|
-
return result
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
export function resolveColumnOrder<T extends RsTableRowData>(
|
|
483
|
-
columns: readonly RsTableColumn<T>[],
|
|
484
|
-
order?: readonly string[],
|
|
485
|
-
): string[] {
|
|
486
|
-
const keys = columns.map((column) => column.key)
|
|
487
|
-
if (!order?.length) return keys
|
|
488
|
-
const valid = order.filter((key) => keys.includes(key))
|
|
489
|
-
const missing = keys.filter((key) => !valid.includes(key))
|
|
490
|
-
return [...valid, ...missing]
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
export function resolveOrderedColumns<T extends RsTableRowData>(
|
|
494
|
-
columns: readonly RsTableColumn<T>[],
|
|
495
|
-
order?: readonly string[],
|
|
496
|
-
): RsTableColumn<T>[] {
|
|
497
|
-
const map = new Map(columns.map((column) => [column.key, column]))
|
|
498
|
-
return resolveColumnOrder(columns, order)
|
|
499
|
-
.map((key) => map.get(key))
|
|
500
|
-
.filter((column): column is RsTableColumn<T> => column !== undefined)
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
export function reorderColumnKeys(order: readonly string[], dragKey: string, dropKey: string): string[] {
|
|
504
|
-
if (dragKey === dropKey) return [...order]
|
|
505
|
-
const next = order.filter((key) => key !== dragKey)
|
|
506
|
-
const dropIndex = next.indexOf(dropKey)
|
|
507
|
-
if (dropIndex < 0) return [...order]
|
|
508
|
-
next.splice(dropIndex, 0, dragKey)
|
|
509
|
-
return next
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
export type RsTableRowDropPosition = 'before' | 'after' | 'into'
|
|
513
|
-
|
|
514
|
-
export function reorderTableRows<T>(
|
|
515
|
-
rows: readonly T[],
|
|
516
|
-
dragIndex: number,
|
|
517
|
-
dropIndex: number,
|
|
518
|
-
position: RsTableRowDropPosition,
|
|
519
|
-
): T[] {
|
|
520
|
-
if (dragIndex < 0 || dropIndex < 0 || dragIndex === dropIndex) return [...rows]
|
|
521
|
-
const next = [...rows]
|
|
522
|
-
const [moved] = next.splice(dragIndex, 1)
|
|
523
|
-
if (moved === undefined) return [...rows]
|
|
524
|
-
let targetIndex = dropIndex
|
|
525
|
-
if (dragIndex < dropIndex) targetIndex -= 1
|
|
526
|
-
if (position === 'after') targetIndex += 1
|
|
527
|
-
next.splice(targetIndex, 0, moved)
|
|
528
|
-
return next
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
export function buildTableEntries<T extends RsTableRowData>(
|
|
532
|
-
rows: readonly T[],
|
|
533
|
-
columns: readonly RsTableColumn<T>[],
|
|
534
|
-
options: {
|
|
535
|
-
sort?: RsTableSortState | null
|
|
536
|
-
sorts?: readonly RsTableSortState[]
|
|
537
|
-
multiSort?: boolean
|
|
538
|
-
filterText?: string
|
|
539
|
-
filterKeys?: string[]
|
|
540
|
-
columnFilters?: Record<string, string>
|
|
541
|
-
groupBy?: RsTableGroupBy<T>
|
|
542
|
-
groupLabel?: (key: string) => string
|
|
543
|
-
remoteSort?: boolean
|
|
544
|
-
} = {},
|
|
545
|
-
): RsTableRowEntry<T>[] {
|
|
546
|
-
let processed: readonly T[] = rows
|
|
547
|
-
const filterText = options.filterText ?? ''
|
|
548
|
-
if (filterText.trim()) {
|
|
549
|
-
processed = filterTableRows(processed, filterText, columns, options.filterKeys)
|
|
550
|
-
}
|
|
551
|
-
const columnFilters = options.columnFilters ?? {}
|
|
552
|
-
if (Object.values(columnFilters).some((q) => q.trim())) {
|
|
553
|
-
processed = filterTableRowsByColumnFilters(processed, columns, columnFilters)
|
|
554
|
-
}
|
|
555
|
-
if (!options.remoteSort) {
|
|
556
|
-
if (options.multiSort && options.sorts?.length) {
|
|
557
|
-
processed = sortTableRowsMulti(processed, columns, options.sorts)
|
|
558
|
-
} else if (options.sort) {
|
|
559
|
-
processed = sortTableRows(processed, columns, options.sort)
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
if (options.groupBy) {
|
|
563
|
-
const groupBy = options.groupBy
|
|
564
|
-
processed = [...processed].sort((left, right) =>
|
|
565
|
-
compareTableValues(resolveGroupKey(left, groupBy), resolveGroupKey(right, groupBy)),
|
|
566
|
-
)
|
|
567
|
-
return groupTableRows(processed, groupBy, options.groupLabel)
|
|
568
|
-
}
|
|
569
|
-
return processed.map((row, rowIndex) => ({ type: 'row' as const, row, rowIndex }))
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
export function injectExpandRows<T extends RsTableRowData>(
|
|
573
|
-
entries: readonly RsTableRowEntry<T>[],
|
|
574
|
-
expandedKeys: ReadonlySet<string>,
|
|
575
|
-
rowKey?: RsTableRowKey<T>,
|
|
576
|
-
rowExpandable?: (row: T, index: number) => boolean,
|
|
577
|
-
): RsTableRowEntry<T>[] {
|
|
578
|
-
const result: RsTableRowEntry<T>[] = []
|
|
579
|
-
for (const entry of entries) {
|
|
580
|
-
result.push(entry)
|
|
581
|
-
if (entry.type !== 'row') continue
|
|
582
|
-
if (rowExpandable && !rowExpandable(entry.row, entry.rowIndex)) continue
|
|
583
|
-
const key = resolveRowKey(entry.row, entry.rowIndex, rowKey)
|
|
584
|
-
if (expandedKeys.has(key)) {
|
|
585
|
-
result.push({ type: 'expand', row: entry.row, rowIndex: entry.rowIndex, rowKey: key })
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
return result
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
export function toggleExpandedRowKeys(keys: readonly string[], key: string): string[] {
|
|
592
|
-
const next = new Set(keys)
|
|
593
|
-
if (next.has(key)) next.delete(key)
|
|
594
|
-
else next.add(key)
|
|
595
|
-
return [...next]
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
/** 读取树表子节点数组(非数组视为无子节点) */
|
|
599
|
-
export function getTableTreeChildren<T extends RsTableRowData>(
|
|
600
|
-
row: T,
|
|
601
|
-
childrenField = 'children',
|
|
602
|
-
): T[] {
|
|
603
|
-
const value = (row as Record<string, unknown>)[childrenField]
|
|
604
|
-
return Array.isArray(value) ? (value as T[]) : []
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
/** 是否为叶子(显式 isLeaf 优先) */
|
|
608
|
-
export function getTableTreeIsLeaf<T extends RsTableRowData>(
|
|
609
|
-
row: T,
|
|
610
|
-
isLeafField = 'isLeaf',
|
|
611
|
-
): boolean {
|
|
612
|
-
return Boolean((row as Record<string, unknown>)[isLeafField])
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
/** 是否可展开:非叶子且(有子节点,或懒加载) */
|
|
616
|
-
export function hasTableTreeChildren<T extends RsTableRowData>(
|
|
617
|
-
row: T,
|
|
618
|
-
options: { childrenField?: string; isLeafField?: string; lazy?: boolean } = {},
|
|
619
|
-
): boolean {
|
|
620
|
-
const childrenField = options.childrenField ?? 'children'
|
|
621
|
-
const isLeafField = options.isLeafField ?? 'isLeaf'
|
|
622
|
-
if (getTableTreeIsLeaf(row, isLeafField)) return false
|
|
623
|
-
if (getTableTreeChildren(row, childrenField).length > 0) return true
|
|
624
|
-
return Boolean(options.lazy)
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* 解析树表行 key。
|
|
629
|
-
* 有 `rowKey` 时走 `resolveRowKey`;否则用路径回退(避免兄弟下标跨分支碰撞)。
|
|
630
|
-
* 树表强烈建议显式传 `rowKey`。
|
|
631
|
-
*/
|
|
632
|
-
export function resolveTableTreeRowKey<T extends RsTableRowData>(
|
|
633
|
-
row: T,
|
|
634
|
-
index: number,
|
|
635
|
-
parentKey: string | null,
|
|
636
|
-
rowKey?: RsTableRowKey<T>,
|
|
637
|
-
): string {
|
|
638
|
-
if (rowKey !== undefined && rowKey !== null && rowKey !== '') {
|
|
639
|
-
return resolveRowKey(row, index, rowKey)
|
|
640
|
-
}
|
|
641
|
-
return parentKey == null ? `tree:${index}` : `${parentKey}/${index}`
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
/** 是否配置了可用的稳定 rowKey(字段名或函数) */
|
|
645
|
-
export function hasStableTableTreeRowKey<T extends RsTableRowData>(
|
|
646
|
-
rowKey?: RsTableRowKey<T>,
|
|
647
|
-
): boolean {
|
|
648
|
-
return rowKey !== undefined && rowKey !== null && rowKey !== ''
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/** 收集所有可展开节点 key(用于 defaultExpandAll) */
|
|
652
|
-
export function collectTableTreeExpandableKeys<T extends RsTableRowData>(
|
|
653
|
-
rows: readonly T[],
|
|
654
|
-
options: {
|
|
655
|
-
childrenField?: string
|
|
656
|
-
isLeafField?: string
|
|
657
|
-
lazy?: boolean
|
|
658
|
-
rowKey?: RsTableRowKey<T>
|
|
659
|
-
} = {},
|
|
660
|
-
): string[] {
|
|
661
|
-
const childrenField = options.childrenField ?? 'children'
|
|
662
|
-
const keys: string[] = []
|
|
663
|
-
const walk = (items: readonly T[], parentKey: string | null) => {
|
|
664
|
-
items.forEach((row, index) => {
|
|
665
|
-
const key = resolveTableTreeRowKey(row, index, parentKey, options.rowKey)
|
|
666
|
-
if (hasTableTreeChildren(row, options)) {
|
|
667
|
-
keys.push(key)
|
|
668
|
-
walk(getTableTreeChildren(row, childrenField), key)
|
|
669
|
-
}
|
|
670
|
-
})
|
|
671
|
-
}
|
|
672
|
-
walk(rows, null)
|
|
673
|
-
return keys
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
/** 构建整棵树的 parent/children key 索引(级联勾选) */
|
|
677
|
-
export function buildTableTreeNodeIndex<T extends RsTableRowData>(
|
|
678
|
-
rows: readonly T[],
|
|
679
|
-
options: {
|
|
680
|
-
childrenField?: string
|
|
681
|
-
isLeafField?: string
|
|
682
|
-
lazy?: boolean
|
|
683
|
-
rowKey?: RsTableRowKey<T>
|
|
684
|
-
} = {},
|
|
685
|
-
): Map<string, RsTableTreeNodeIndex> {
|
|
686
|
-
const childrenField = options.childrenField ?? 'children'
|
|
687
|
-
const map = new Map<string, RsTableTreeNodeIndex>()
|
|
688
|
-
const walk = (items: readonly T[], parentKey: string | null) => {
|
|
689
|
-
for (let i = 0; i < items.length; i += 1) {
|
|
690
|
-
const row = items[i] as T
|
|
691
|
-
const key = resolveTableTreeRowKey(row, i, parentKey, options.rowKey)
|
|
692
|
-
const children = getTableTreeChildren(row, childrenField)
|
|
693
|
-
const childrenKeys = hasTableTreeChildren(row, options)
|
|
694
|
-
? children.map((child, childIndex) =>
|
|
695
|
-
resolveTableTreeRowKey(child, childIndex, key, options.rowKey),
|
|
696
|
-
)
|
|
697
|
-
: []
|
|
698
|
-
map.set(key, { parentKey, childrenKeys })
|
|
699
|
-
if (children.length > 0) walk(children, key)
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
walk(rows, null)
|
|
703
|
-
return map
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
export function collectTableTreeDescendantKeys(
|
|
707
|
-
key: string,
|
|
708
|
-
index: ReadonlyMap<string, RsTableTreeNodeIndex>,
|
|
709
|
-
): string[] {
|
|
710
|
-
const entry = index.get(key)
|
|
711
|
-
if (!entry) return []
|
|
712
|
-
const result: string[] = []
|
|
713
|
-
for (const childKey of entry.childrenKeys) {
|
|
714
|
-
result.push(childKey, ...collectTableTreeDescendantKeys(childKey, index))
|
|
715
|
-
}
|
|
716
|
-
return result
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
export function resolveTableTreeCheckState(
|
|
720
|
-
key: string,
|
|
721
|
-
checkedKeys: ReadonlySet<string>,
|
|
722
|
-
index: ReadonlyMap<string, RsTableTreeNodeIndex>,
|
|
723
|
-
checkStrictly: boolean,
|
|
724
|
-
): RsTableTreeCheckState {
|
|
725
|
-
if (checkStrictly) return checkedKeys.has(key) ? 'checked' : 'unchecked'
|
|
726
|
-
if (checkedKeys.size === 0) return 'unchecked'
|
|
727
|
-
|
|
728
|
-
const entry = index.get(key)
|
|
729
|
-
if (!entry || entry.childrenKeys.length === 0) {
|
|
730
|
-
return checkedKeys.has(key) ? 'checked' : 'unchecked'
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
const childStates = entry.childrenKeys.map((childKey) =>
|
|
734
|
-
resolveTableTreeCheckState(childKey, checkedKeys, index, checkStrictly),
|
|
735
|
-
)
|
|
736
|
-
|
|
737
|
-
if (childStates.every((state) => state === 'checked')) return 'checked'
|
|
738
|
-
if (childStates.some((state) => state === 'checked' || state === 'indeterminate')) {
|
|
739
|
-
return 'indeterminate'
|
|
740
|
-
}
|
|
741
|
-
return 'unchecked'
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
export function collectTableTreeHalfCheckedKeys(
|
|
745
|
-
index: ReadonlyMap<string, RsTableTreeNodeIndex>,
|
|
746
|
-
checkedKeys: ReadonlySet<string>,
|
|
747
|
-
checkStrictly: boolean,
|
|
748
|
-
): string[] {
|
|
749
|
-
if (checkStrictly || checkedKeys.size === 0) return []
|
|
750
|
-
const half: string[] = []
|
|
751
|
-
for (const key of index.keys()) {
|
|
752
|
-
if (resolveTableTreeCheckState(key, checkedKeys, index, checkStrictly) === 'indeterminate') {
|
|
753
|
-
half.push(key)
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
return half
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
/** 切换树表勾选;`checkStrictly=false` 时父子联动 */
|
|
760
|
-
export function toggleTableTreeCheck(
|
|
761
|
-
key: string,
|
|
762
|
-
checkedKeys: ReadonlySet<string>,
|
|
763
|
-
index: ReadonlyMap<string, RsTableTreeNodeIndex>,
|
|
764
|
-
checkStrictly: boolean,
|
|
765
|
-
): string[] {
|
|
766
|
-
const next = new Set(checkedKeys)
|
|
767
|
-
const current = resolveTableTreeCheckState(key, next, index, checkStrictly)
|
|
768
|
-
const shouldCheck = current !== 'checked'
|
|
769
|
-
|
|
770
|
-
if (checkStrictly) {
|
|
771
|
-
if (shouldCheck) next.add(key)
|
|
772
|
-
else next.delete(key)
|
|
773
|
-
return [...next]
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
for (const id of [key, ...collectTableTreeDescendantKeys(key, index)]) {
|
|
777
|
-
if (shouldCheck) next.add(id)
|
|
778
|
-
else next.delete(id)
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
let parentKey = index.get(key)?.parentKey ?? null
|
|
782
|
-
while (parentKey) {
|
|
783
|
-
const parent = index.get(parentKey)
|
|
784
|
-
if (!parent) break
|
|
785
|
-
const allChecked = parent.childrenKeys.every(
|
|
786
|
-
(childKey) => resolveTableTreeCheckState(childKey, next, index, false) === 'checked',
|
|
787
|
-
)
|
|
788
|
-
if (allChecked) next.add(parentKey)
|
|
789
|
-
else next.delete(parentKey)
|
|
790
|
-
parentKey = parent.parentKey
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
return [...next]
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
/**
|
|
797
|
-
* 树过滤:匹配节点或其后代匹配时保留该节点,并裁剪子树。
|
|
798
|
-
* 与 RsTree `filterTreeNodes` 语义一致(保留祖先路径)。
|
|
799
|
-
*/
|
|
800
|
-
export function filterTableTreeRows<T extends RsTableRowData>(
|
|
801
|
-
rows: readonly T[],
|
|
802
|
-
query: string,
|
|
803
|
-
columns: readonly RsTableColumn<T>[],
|
|
804
|
-
options: {
|
|
805
|
-
childrenField?: string
|
|
806
|
-
filterKeys?: string[]
|
|
807
|
-
columnFilters?: Record<string, string>
|
|
808
|
-
} = {},
|
|
809
|
-
): T[] {
|
|
810
|
-
const childrenField = options.childrenField ?? 'children'
|
|
811
|
-
const trimmed = query.trim()
|
|
812
|
-
const columnFilters = options.columnFilters ?? {}
|
|
813
|
-
const hasColumnFilters = Object.values(columnFilters).some((q) => q.trim())
|
|
814
|
-
if (!trimmed && !hasColumnFilters) return rows as T[]
|
|
815
|
-
|
|
816
|
-
const matchesSelf = (row: T): boolean => {
|
|
817
|
-
let ok = true
|
|
818
|
-
if (trimmed) {
|
|
819
|
-
const filtered = filterTableRows([row], trimmed, columns, options.filterKeys)
|
|
820
|
-
ok = filtered.length > 0
|
|
821
|
-
}
|
|
822
|
-
if (ok && hasColumnFilters) {
|
|
823
|
-
const filtered = filterTableRowsByColumnFilters([row], columns, columnFilters)
|
|
824
|
-
ok = filtered.length > 0
|
|
825
|
-
}
|
|
826
|
-
return ok
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
const walk = (items: readonly T[]): T[] => {
|
|
830
|
-
const result: T[] = []
|
|
831
|
-
for (const row of items) {
|
|
832
|
-
const children = getTableTreeChildren(row, childrenField)
|
|
833
|
-
const nextChildren = children.length ? walk(children) : []
|
|
834
|
-
if (matchesSelf(row) || nextChildren.length > 0) {
|
|
835
|
-
result.push(
|
|
836
|
-
nextChildren.length || children.length
|
|
837
|
-
? ({ ...row, [childrenField]: nextChildren } as T)
|
|
838
|
-
: row,
|
|
839
|
-
)
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
return result
|
|
843
|
-
}
|
|
844
|
-
return walk(rows)
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
/** 树排序:仅对同级节点排序,递归处理子树 */
|
|
848
|
-
export function sortTableTreeRows<T extends RsTableRowData>(
|
|
849
|
-
rows: readonly T[],
|
|
850
|
-
columns: readonly RsTableColumn<T>[],
|
|
851
|
-
options: {
|
|
852
|
-
childrenField?: string
|
|
853
|
-
sort?: RsTableSortState | null
|
|
854
|
-
sorts?: readonly RsTableSortState[]
|
|
855
|
-
multiSort?: boolean
|
|
856
|
-
},
|
|
857
|
-
): T[] {
|
|
858
|
-
const childrenField = options.childrenField ?? 'children'
|
|
859
|
-
let sorted: T[]
|
|
860
|
-
if (options.multiSort && options.sorts?.length) {
|
|
861
|
-
sorted = sortTableRowsMulti(rows, columns, options.sorts)
|
|
862
|
-
} else if (options.sort) {
|
|
863
|
-
sorted = sortTableRows(rows, columns, options.sort)
|
|
864
|
-
} else {
|
|
865
|
-
sorted = rows as T[]
|
|
866
|
-
}
|
|
867
|
-
return sorted.map((row) => {
|
|
868
|
-
const children = getTableTreeChildren(row, childrenField)
|
|
869
|
-
if (!children.length) return row
|
|
870
|
-
return {
|
|
871
|
-
...row,
|
|
872
|
-
[childrenField]: sortTableTreeRows(children, columns, options),
|
|
873
|
-
} as T
|
|
874
|
-
})
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
/**
|
|
878
|
-
* 按展开 key 展平可见树行为表格 row entries(不含 detail expand 行)。
|
|
879
|
-
*/
|
|
880
|
-
export function flattenVisibleTableTreeEntries<T extends RsTableRowData>(
|
|
881
|
-
rows: readonly T[],
|
|
882
|
-
expandedKeys: ReadonlySet<string>,
|
|
883
|
-
options: {
|
|
884
|
-
childrenField?: string
|
|
885
|
-
isLeafField?: string
|
|
886
|
-
lazy?: boolean
|
|
887
|
-
rowKey?: RsTableRowKey<T>
|
|
888
|
-
} = {},
|
|
889
|
-
): Extract<RsTableRowEntry<T>, { type: 'row' }>[] {
|
|
890
|
-
const childrenField = options.childrenField ?? 'children'
|
|
891
|
-
const result: Extract<RsTableRowEntry<T>, { type: 'row' }>[] = []
|
|
892
|
-
|
|
893
|
-
const walk = (items: readonly T[], depth: number, parentKey: string | null) => {
|
|
894
|
-
items.forEach((row, index) => {
|
|
895
|
-
const key = resolveTableTreeRowKey(row, index, parentKey, options.rowKey)
|
|
896
|
-
const hasChildren = hasTableTreeChildren(row, options)
|
|
897
|
-
const rowIndex = result.length
|
|
898
|
-
result.push({
|
|
899
|
-
type: 'row',
|
|
900
|
-
row,
|
|
901
|
-
rowIndex,
|
|
902
|
-
depth,
|
|
903
|
-
hasChildren,
|
|
904
|
-
parentKey,
|
|
905
|
-
treeKey: key,
|
|
906
|
-
})
|
|
907
|
-
if (hasChildren && expandedKeys.has(key)) {
|
|
908
|
-
walk(getTableTreeChildren(row, childrenField), depth + 1, key)
|
|
909
|
-
}
|
|
910
|
-
})
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
walk(rows, 0, null)
|
|
914
|
-
return result
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
* 树表入口构建:过滤 → 同级排序 → 按展开状态展平。
|
|
919
|
-
* 不支持与 `groupBy` / detail `expandable` 同时使用。
|
|
920
|
-
*/
|
|
921
|
-
export function buildTableTreeEntries<T extends RsTableRowData>(
|
|
922
|
-
rows: readonly T[],
|
|
923
|
-
columns: readonly RsTableColumn<T>[],
|
|
924
|
-
expandedKeys: ReadonlySet<string>,
|
|
925
|
-
options: {
|
|
926
|
-
tree: RsTableTreeConfig<T>
|
|
927
|
-
rowKey?: RsTableRowKey<T>
|
|
928
|
-
sort?: RsTableSortState | null
|
|
929
|
-
sorts?: readonly RsTableSortState[]
|
|
930
|
-
multiSort?: boolean
|
|
931
|
-
filterText?: string
|
|
932
|
-
filterKeys?: string[]
|
|
933
|
-
columnFilters?: Record<string, string>
|
|
934
|
-
remoteSort?: boolean
|
|
935
|
-
},
|
|
936
|
-
): RsTableRowEntry<T>[] {
|
|
937
|
-
const childrenField = options.tree.childrenField ?? 'children'
|
|
938
|
-
let processed: readonly T[] = rows
|
|
939
|
-
|
|
940
|
-
const filterText = options.filterText ?? ''
|
|
941
|
-
const columnFilters = options.columnFilters ?? {}
|
|
942
|
-
if (filterText.trim() || Object.values(columnFilters).some((q) => q.trim())) {
|
|
943
|
-
processed = filterTableTreeRows(processed, filterText, columns, {
|
|
944
|
-
childrenField,
|
|
945
|
-
filterKeys: options.filterKeys,
|
|
946
|
-
columnFilters,
|
|
947
|
-
})
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
if (!options.remoteSort && (options.sort || (options.multiSort && options.sorts?.length))) {
|
|
951
|
-
processed = sortTableTreeRows(processed, columns, {
|
|
952
|
-
childrenField,
|
|
953
|
-
sort: options.sort,
|
|
954
|
-
sorts: options.sorts,
|
|
955
|
-
multiSort: options.multiSort,
|
|
956
|
-
})
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
return flattenVisibleTableTreeEntries(processed, expandedKeys, {
|
|
960
|
-
childrenField,
|
|
961
|
-
isLeafField: options.tree.isLeafField,
|
|
962
|
-
lazy: options.tree.lazy,
|
|
963
|
-
rowKey: options.rowKey,
|
|
964
|
-
})
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
/** 按表格 size 解析树缩进默认值 */
|
|
968
|
-
export function resolveTableTreeIndent(size: RsTableSize = 'md', custom?: number): number {
|
|
969
|
-
if (custom !== undefined) return custom
|
|
970
|
-
if (size === 'sm') return 16
|
|
971
|
-
if (size === 'lg') return 24
|
|
972
|
-
return 20
|
|
973
|
-
}
|
|
974
|
-
|
|
975
|
-
export function resolveTableSize(compact: boolean, size: RsTableSize = 'md'): RsTableSize {
|
|
976
|
-
if (compact) return 'sm'
|
|
977
|
-
return size
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
export function resolveTableRowHeight(size: RsTableSize = 'md', custom?: number): number {
|
|
981
|
-
if (custom !== undefined) return custom
|
|
982
|
-
return TABLE_ROW_HEIGHT[size]
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
export function resolveTableVirtualEnabled(options: {
|
|
986
|
-
virtual?: boolean
|
|
987
|
-
infinite?: boolean
|
|
988
|
-
virtualOnInfinite?: boolean
|
|
989
|
-
}): boolean {
|
|
990
|
-
if (options.virtual) return true
|
|
991
|
-
if (options.infinite && options.virtualOnInfinite !== false) return true
|
|
992
|
-
return false
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
export function isNearScrollBottom(
|
|
996
|
-
scrollTop: number,
|
|
997
|
-
scrollHeight: number,
|
|
998
|
-
clientHeight: number,
|
|
999
|
-
distance = 80,
|
|
1000
|
-
): boolean {
|
|
1001
|
-
return scrollHeight - scrollTop - clientHeight <= distance
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
export function entryHeight<T extends RsTableRowData>(
|
|
1005
|
-
entry: RsTableRowEntry<T>,
|
|
1006
|
-
rowHeight: number,
|
|
1007
|
-
groupRowHeight = TABLE_ROW_HEIGHT.group,
|
|
1008
|
-
expandRowHeight = TABLE_ROW_HEIGHT.expand,
|
|
1009
|
-
): number {
|
|
1010
|
-
if (entry.type === 'group') return groupRowHeight
|
|
1011
|
-
if (entry.type === 'expand') return expandRowHeight
|
|
1012
|
-
return rowHeight
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
export function resolveScrollWidth(scrollX?: number | string, _columns?: readonly RsTableColumn[]): string | undefined {
|
|
1016
|
-
if (scrollX === undefined) return undefined
|
|
1017
|
-
if (typeof scrollX === 'number') return `${scrollX}px`
|
|
1018
|
-
return scrollX
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
export function resolveLeadingColumnWidth(options: {
|
|
1022
|
-
selectable?: boolean
|
|
1023
|
-
showIndex?: boolean
|
|
1024
|
-
showEditGutter?: boolean
|
|
1025
|
-
gutterWidth?: number
|
|
1026
|
-
indexWidth?: number
|
|
1027
|
-
expandable?: boolean
|
|
1028
|
-
rowDraggable?: boolean
|
|
1029
|
-
}): number {
|
|
1030
|
-
let width = 0
|
|
1031
|
-
if (options.rowDraggable) width += 40
|
|
1032
|
-
if (options.expandable) width += 40
|
|
1033
|
-
if (options.selectable) width += 40
|
|
1034
|
-
if (options.showEditGutter) width += options.gutterWidth ?? 32
|
|
1035
|
-
else if (options.showIndex) width += options.indexWidth ?? 48
|
|
1036
|
-
return width
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
export function resolveFixedColumnStyles<T extends RsTableRowData>(
|
|
1040
|
-
columns: readonly RsTableColumn<T>[],
|
|
1041
|
-
widths: Record<string, number | string>,
|
|
1042
|
-
options: {
|
|
1043
|
-
selectable?: boolean
|
|
1044
|
-
showIndex?: boolean
|
|
1045
|
-
showEditGutter?: boolean
|
|
1046
|
-
gutterWidth?: number
|
|
1047
|
-
indexWidth?: number
|
|
1048
|
-
expandable?: boolean
|
|
1049
|
-
rowDraggable?: boolean
|
|
1050
|
-
} = {},
|
|
1051
|
-
): Map<string, RsTableFixedCellStyle> {
|
|
1052
|
-
const result = new Map<string, RsTableFixedCellStyle>()
|
|
1053
|
-
const leading = resolveLeadingColumnWidth(options)
|
|
1054
|
-
let leftOffset = leading
|
|
1055
|
-
|
|
1056
|
-
for (const column of columns) {
|
|
1057
|
-
if (column.fixed !== 'left') continue
|
|
1058
|
-
result.set(column.key, { fixed: 'left', left: leftOffset })
|
|
1059
|
-
leftOffset += parseColumnWidth(widths[column.key] ?? column.width)
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
let rightOffset = 0
|
|
1063
|
-
for (let index = columns.length - 1; index >= 0; index -= 1) {
|
|
1064
|
-
const column = columns[index]
|
|
1065
|
-
if (column?.fixed !== 'right') continue
|
|
1066
|
-
result.set(column.key, { fixed: 'right', right: rightOffset })
|
|
1067
|
-
rightOffset += parseColumnWidth(widths[column.key] ?? column.width)
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
return result
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
export function fixedCellStyle(
|
|
1074
|
-
style?: RsTableFixedCellStyle,
|
|
1075
|
-
options?: { header?: boolean },
|
|
1076
|
-
): Record<string, string> | undefined {
|
|
1077
|
-
if (!style) return undefined
|
|
1078
|
-
const result: Record<string, string> = {
|
|
1079
|
-
position: 'sticky',
|
|
1080
|
-
zIndex: options?.header ? '4' : '2',
|
|
1081
|
-
}
|
|
1082
|
-
if (options?.header) result.top = '0'
|
|
1083
|
-
if (style.fixed === 'left' && style.left !== undefined) {
|
|
1084
|
-
result.left = `${style.left}px`
|
|
1085
|
-
return result
|
|
1086
|
-
}
|
|
1087
|
-
if (style.fixed === 'right' && style.right !== undefined) {
|
|
1088
|
-
result.right = `${style.right}px`
|
|
1089
|
-
return result
|
|
1090
|
-
}
|
|
1091
|
-
return undefined
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
export function selectRowKeys(
|
|
1095
|
-
selectedKeys: readonly string[],
|
|
1096
|
-
key: string,
|
|
1097
|
-
selectionType: RsTableSelectionType,
|
|
1098
|
-
): string[] {
|
|
1099
|
-
if (selectionType === 'radio') return [key]
|
|
1100
|
-
return toggleRowSelection(selectedKeys, key)
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
/** 行点击多选(plain / Ctrl·Cmd / Shift),供 selectionType=`row` 使用。 */
|
|
1104
|
-
export function selectRowKeysByClick(
|
|
1105
|
-
selectedKeys: readonly string[],
|
|
1106
|
-
key: string,
|
|
1107
|
-
options: {
|
|
1108
|
-
toggle: boolean
|
|
1109
|
-
range: boolean
|
|
1110
|
-
/** 有序行键(当前可见数据顺序),用于 Shift 范围选 */
|
|
1111
|
-
orderedKeys: readonly string[]
|
|
1112
|
-
/** Shift 范围的锚点行键 */
|
|
1113
|
-
anchorKey?: string | null
|
|
1114
|
-
},
|
|
1115
|
-
): string[] {
|
|
1116
|
-
if (options.range && options.orderedKeys.length > 0) {
|
|
1117
|
-
const anchor = options.anchorKey && options.orderedKeys.includes(options.anchorKey)
|
|
1118
|
-
? options.anchorKey
|
|
1119
|
-
: key
|
|
1120
|
-
const from = options.orderedKeys.indexOf(anchor)
|
|
1121
|
-
const to = options.orderedKeys.indexOf(key)
|
|
1122
|
-
if (from < 0 || to < 0) return [key]
|
|
1123
|
-
const start = Math.min(from, to)
|
|
1124
|
-
const end = Math.max(from, to)
|
|
1125
|
-
return options.orderedKeys.slice(start, end + 1)
|
|
1126
|
-
}
|
|
1127
|
-
if (options.toggle) return toggleRowSelection(selectedKeys, key)
|
|
1128
|
-
return [key]
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
export function sliceVirtualTableEntries<T extends RsTableRowData>(
|
|
1132
|
-
entries: readonly RsTableRowEntry<T>[],
|
|
1133
|
-
scrollTop: number,
|
|
1134
|
-
viewportHeight: number,
|
|
1135
|
-
rowHeight: number,
|
|
1136
|
-
groupRowHeight = TABLE_ROW_HEIGHT.group,
|
|
1137
|
-
overscan = 4,
|
|
1138
|
-
expandRowHeight = TABLE_ROW_HEIGHT.expand,
|
|
1139
|
-
): {
|
|
1140
|
-
entries: RsTableRowEntry<T>[]
|
|
1141
|
-
paddingTop: number
|
|
1142
|
-
paddingBottom: number
|
|
1143
|
-
} {
|
|
1144
|
-
if (entries.length === 0) return { entries: [], paddingTop: 0, paddingBottom: 0 }
|
|
1145
|
-
const model = buildVirtualHeightModel(entries, rowHeight, groupRowHeight, expandRowHeight)
|
|
1146
|
-
return sliceVirtualHeightModel(model, scrollTop, viewportHeight, rowHeight, overscan)
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
/** 预计算行高前缀和,供虚拟滚动复用,避免每次 scroll 全量 map/reduce */
|
|
1150
|
-
export function buildVirtualHeightModel<T extends RsTableRowData>(
|
|
1151
|
-
entries: readonly RsTableRowEntry<T>[],
|
|
1152
|
-
rowHeight: number,
|
|
1153
|
-
groupRowHeight = TABLE_ROW_HEIGHT.group,
|
|
1154
|
-
expandRowHeight = TABLE_ROW_HEIGHT.expand,
|
|
1155
|
-
): {
|
|
1156
|
-
entries: readonly RsTableRowEntry<T>[]
|
|
1157
|
-
prefix: number[]
|
|
1158
|
-
total: number
|
|
1159
|
-
} {
|
|
1160
|
-
const prefix = new Array<number>(entries.length + 1)
|
|
1161
|
-
prefix[0] = 0
|
|
1162
|
-
for (let index = 0; index < entries.length; index += 1) {
|
|
1163
|
-
prefix[index + 1] = prefix[index] + entryHeight(entries[index], rowHeight, groupRowHeight, expandRowHeight)
|
|
1164
|
-
}
|
|
1165
|
-
return { entries, prefix, total: prefix[entries.length] ?? 0 }
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
function findVirtualStartIndex(prefix: readonly number[], targetTop: number): number {
|
|
1169
|
-
let low = 0
|
|
1170
|
-
let high = prefix.length - 2
|
|
1171
|
-
while (low < high) {
|
|
1172
|
-
const mid = Math.floor((low + high) / 2)
|
|
1173
|
-
if ((prefix[mid + 1] ?? 0) <= targetTop) low = mid + 1
|
|
1174
|
-
else high = mid
|
|
1175
|
-
}
|
|
1176
|
-
return low
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
export function sliceVirtualHeightModel<T extends RsTableRowData>(
|
|
1180
|
-
model: {
|
|
1181
|
-
entries: readonly RsTableRowEntry<T>[]
|
|
1182
|
-
prefix: readonly number[]
|
|
1183
|
-
total: number
|
|
1184
|
-
},
|
|
1185
|
-
scrollTop: number,
|
|
1186
|
-
viewportHeight: number,
|
|
1187
|
-
rowHeight: number,
|
|
1188
|
-
overscan = 4,
|
|
1189
|
-
): {
|
|
1190
|
-
entries: RsTableRowEntry<T>[]
|
|
1191
|
-
paddingTop: number
|
|
1192
|
-
paddingBottom: number
|
|
1193
|
-
} {
|
|
1194
|
-
const { entries, prefix, total } = model
|
|
1195
|
-
if (entries.length === 0) return { entries: [], paddingTop: 0, paddingBottom: 0 }
|
|
1196
|
-
|
|
1197
|
-
const overscanPx = overscan * rowHeight
|
|
1198
|
-
const targetTop = Math.max(0, scrollTop - overscanPx)
|
|
1199
|
-
const start = findVirtualStartIndex(prefix, targetTop)
|
|
1200
|
-
const paddingTop = prefix[start] ?? 0
|
|
1201
|
-
|
|
1202
|
-
const maxVisible = viewportHeight + overscanPx * 2
|
|
1203
|
-
let end = start
|
|
1204
|
-
while (end < entries.length && (prefix[end] ?? 0) - paddingTop < maxVisible) {
|
|
1205
|
-
end += 1
|
|
1206
|
-
}
|
|
1207
|
-
if (end === start) end = Math.min(start + 1, entries.length)
|
|
1208
|
-
|
|
1209
|
-
const renderedBottom = prefix[end] ?? total
|
|
1210
|
-
const paddingBottom = Math.max(0, total - renderedBottom)
|
|
1211
|
-
|
|
1212
|
-
return {
|
|
1213
|
-
entries: entries.slice(start, end) as RsTableRowEntry<T>[],
|
|
1214
|
-
paddingTop,
|
|
1215
|
-
paddingBottom,
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
/** 列像素宽:优先已测量/配置 widths,其次 column.width / minWidth */
|
|
1220
|
-
export function resolveColumnPixelWidth<T extends RsTableRowData>(
|
|
1221
|
-
column: RsTableColumn<T>,
|
|
1222
|
-
widths?: Record<string, number | string>,
|
|
1223
|
-
fallback = 120,
|
|
1224
|
-
): number {
|
|
1225
|
-
const fromMap = widths?.[column.key]
|
|
1226
|
-
if (fromMap !== undefined) return parseColumnWidth(fromMap, fallback)
|
|
1227
|
-
return parseColumnWidth(column.width ?? column.minWidth, fallback)
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
/**
|
|
1231
|
-
* 横向列虚拟切片(仅针对可横滚的流体列)。
|
|
1232
|
-
* 调用方负责:冻结列始终实体渲染;`scrollLeft` 为相对流体区起点的偏移
|
|
1233
|
-
* (即容器 scrollLeft 减去前缀列与左冻结列宽度)。
|
|
1234
|
-
*/
|
|
1235
|
-
export function sliceVirtualColumns<T extends RsTableRowData>(
|
|
1236
|
-
columns: readonly RsTableColumn<T>[],
|
|
1237
|
-
options: {
|
|
1238
|
-
scrollLeft: number
|
|
1239
|
-
viewportWidth: number
|
|
1240
|
-
getWidth: (column: RsTableColumn<T>) => number
|
|
1241
|
-
overscan?: number
|
|
1242
|
-
},
|
|
1243
|
-
): {
|
|
1244
|
-
columns: RsTableColumn<T>[]
|
|
1245
|
-
paddingLeft: number
|
|
1246
|
-
paddingRight: number
|
|
1247
|
-
startIndex: number
|
|
1248
|
-
endIndex: number
|
|
1249
|
-
} {
|
|
1250
|
-
const n = columns.length
|
|
1251
|
-
if (n === 0) {
|
|
1252
|
-
return { columns: [], paddingLeft: 0, paddingRight: 0, startIndex: 0, endIndex: 0 }
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
const overscan = options.overscan ?? 2
|
|
1256
|
-
const prefix: number[] = new Array(n + 1)
|
|
1257
|
-
prefix[0] = 0
|
|
1258
|
-
for (let i = 0; i < n; i += 1) {
|
|
1259
|
-
prefix[i + 1] = (prefix[i] ?? 0) + Math.max(1, options.getWidth(columns[i]!))
|
|
1260
|
-
}
|
|
1261
|
-
const total = prefix[n] ?? 0
|
|
1262
|
-
|
|
1263
|
-
const viewLeft = Math.max(0, options.scrollLeft)
|
|
1264
|
-
const viewRight = viewLeft + Math.max(1, options.viewportWidth)
|
|
1265
|
-
|
|
1266
|
-
let start = 0
|
|
1267
|
-
while (start < n && (prefix[start + 1] ?? 0) <= viewLeft) start += 1
|
|
1268
|
-
start = Math.max(0, start - overscan)
|
|
1269
|
-
|
|
1270
|
-
let end = start
|
|
1271
|
-
while (end < n && (prefix[end] ?? 0) < viewRight) end += 1
|
|
1272
|
-
end = Math.min(n, Math.max(end + overscan, start + 1))
|
|
1273
|
-
|
|
1274
|
-
return {
|
|
1275
|
-
columns: columns.slice(start, end) as RsTableColumn<T>[],
|
|
1276
|
-
paddingLeft: prefix[start] ?? 0,
|
|
1277
|
-
paddingRight: Math.max(0, total - (prefix[end] ?? total)),
|
|
1278
|
-
startIndex: start,
|
|
1279
|
-
endIndex: end,
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
export function resolveRowKey<T extends RsTableRowData>(row: T, index: number, rowKey?: RsTableRowKey<T>): string {
|
|
1284
|
-
if (typeof rowKey === 'function') return rowKey(row)
|
|
1285
|
-
if (rowKey) return String(row[rowKey as keyof T])
|
|
1286
|
-
return readRowKeyFallback(row) ?? String(index)
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
export function resolveEntryKey<T extends RsTableRowData>(
|
|
1290
|
-
entry: RsTableRowEntry<T>,
|
|
1291
|
-
rowKey?: RsTableRowKey<T>,
|
|
1292
|
-
): string {
|
|
1293
|
-
if (entry.type === 'group') return `group:${entry.key}`
|
|
1294
|
-
if (entry.type === 'expand') return `expand:${entry.rowKey}`
|
|
1295
|
-
if (entry.treeKey) return entry.treeKey
|
|
1296
|
-
return resolveRowKey(entry.row, entry.rowIndex, rowKey)
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
export function resolveColumnStyle<T extends RsTableRowData = Record<string, unknown>>(
|
|
1300
|
-
column: RsTableColumn<T>,
|
|
1301
|
-
widths?: Record<string, number | string>,
|
|
1302
|
-
): Record<string, string> | undefined {
|
|
1303
|
-
const style: Record<string, string> = {}
|
|
1304
|
-
const width = widths?.[column.key] ?? column.width
|
|
1305
|
-
if (width !== undefined) {
|
|
1306
|
-
style.width = typeof width === 'number' ? `${width}px` : width
|
|
1307
|
-
}
|
|
1308
|
-
if (column.minWidth !== undefined) {
|
|
1309
|
-
style.minWidth = typeof column.minWidth === 'number' ? `${column.minWidth}px` : column.minWidth
|
|
1310
|
-
}
|
|
1311
|
-
return Object.keys(style).length ? style : undefined
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
export function clampColumnWidth(width: number, min = 48, max = 640): number {
|
|
1315
|
-
return Math.min(max, Math.max(min, width))
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
export function parseColumnWidth(width: number | string | undefined, fallback = 120): number {
|
|
1319
|
-
if (typeof width === 'number') return width
|
|
1320
|
-
if (typeof width === 'string' && width.endsWith('px')) return Number.parseInt(width, 10) || fallback
|
|
1321
|
-
return fallback
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
export function createInitialColumnWidths<T extends RsTableRowData>(
|
|
1325
|
-
columns: readonly RsTableColumn<T>[],
|
|
1326
|
-
overrides?: Record<string, number | string>,
|
|
1327
|
-
options?: { forceAll?: boolean },
|
|
1328
|
-
): Record<string, number> {
|
|
1329
|
-
const result: Record<string, number> = {}
|
|
1330
|
-
for (const column of columns) {
|
|
1331
|
-
const override = overrides?.[column.key]
|
|
1332
|
-
if (typeof override === 'number') {
|
|
1333
|
-
result[column.key] = override
|
|
1334
|
-
continue
|
|
1335
|
-
}
|
|
1336
|
-
if (typeof override === 'string' && override.endsWith('px')) {
|
|
1337
|
-
result[column.key] = Number.parseInt(override, 10) || parseColumnWidth(column.width)
|
|
1338
|
-
continue
|
|
1339
|
-
}
|
|
1340
|
-
if (typeof column.width === 'number') {
|
|
1341
|
-
result[column.key] = column.width
|
|
1342
|
-
continue
|
|
1343
|
-
}
|
|
1344
|
-
// resizable 模式下,确保所有列都有显式宽度,避免 table-layout:auto 重分配
|
|
1345
|
-
if (options?.forceAll) {
|
|
1346
|
-
result[column.key] = parseColumnWidth(column.width ?? column.minWidth)
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
return result
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
export function isTableRowDisabled<T extends RsTableRowData>(row: T): boolean {
|
|
1353
|
-
return readConvention(row).disabled === true
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
export function resolveSelectableRowKeys<T extends RsTableRowData>(
|
|
1357
|
-
rows: readonly T[],
|
|
1358
|
-
rowKey?: RsTableRowKey<T>,
|
|
1359
|
-
rowSelectable?: (row: T, index: number) => boolean,
|
|
1360
|
-
): string[] {
|
|
1361
|
-
return rows
|
|
1362
|
-
.map((row, index) => ({ row, index }))
|
|
1363
|
-
.filter(({ row, index }) => {
|
|
1364
|
-
if (isTableRowDisabled(row)) return false
|
|
1365
|
-
return rowSelectable ? rowSelectable(row, index) : true
|
|
1366
|
-
})
|
|
1367
|
-
.map(({ row, index }) => resolveRowKey(row, index, rowKey))
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
export function resolveSelectAllState(
|
|
1371
|
-
selectedKeys: readonly string[],
|
|
1372
|
-
allKeys: readonly string[],
|
|
1373
|
-
): RsTableSelectAllState {
|
|
1374
|
-
if (allKeys.length === 0) return 'unchecked'
|
|
1375
|
-
const selectedCount = allKeys.filter((key) => selectedKeys.includes(key)).length
|
|
1376
|
-
if (selectedCount === 0) return 'unchecked'
|
|
1377
|
-
if (selectedCount === allKeys.length) return 'checked'
|
|
1378
|
-
return 'indeterminate'
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
export function toggleRowSelection(selectedKeys: readonly string[], key: string): string[] {
|
|
1382
|
-
const next = new Set(selectedKeys)
|
|
1383
|
-
if (next.has(key)) next.delete(key)
|
|
1384
|
-
else next.add(key)
|
|
1385
|
-
return [...next]
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
export function toggleSelectAll(
|
|
1389
|
-
selectedKeys: readonly string[],
|
|
1390
|
-
allKeys: readonly string[],
|
|
1391
|
-
select: boolean,
|
|
1392
|
-
): string[] {
|
|
1393
|
-
const next = new Set(selectedKeys)
|
|
1394
|
-
if (select) {
|
|
1395
|
-
for (const key of allKeys) next.add(key)
|
|
1396
|
-
} else {
|
|
1397
|
-
for (const key of allKeys) next.delete(key)
|
|
1398
|
-
}
|
|
1399
|
-
return [...next]
|
|
1400
|
-
}
|