@baishuyun/ui-base 6.28.1 → 6.29.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.
Files changed (52) hide show
  1. package/dist/Amap/index.js +1 -1
  2. package/dist/Calendar/{Calendar-CbWlQ_kl.js → Calendar-DHRiaiXw.js} +1 -1
  3. package/dist/Calendar/index.js +3 -3
  4. package/dist/Card/index.js +1 -1
  5. package/dist/CheckBox/index.js +1 -1
  6. package/dist/ColorPicker/index.js +1 -1
  7. package/dist/ConfigProvider/index.js +1 -1
  8. package/dist/DatePicker/{DatePicker-C8ds9tlu.js → DatePicker-BfyiYmTl.js} +1 -1
  9. package/dist/DatePicker/{DatePickerPanel-v5utod1B.js → DatePickerPanel-D8qVQZ0a.js} +1 -1
  10. package/dist/DatePicker/index.js +2 -2
  11. package/dist/DropDown/index.js +1 -1
  12. package/dist/Editor/index.js +1 -1
  13. package/dist/FieldCard/index.js +1 -1
  14. package/dist/Gantt/index.js +2 -2
  15. package/dist/Icon/index.js +1 -1
  16. package/dist/InputTag/index.js +1 -1
  17. package/dist/Kanban/index.js +1 -1
  18. package/dist/Loading/index.js +1 -1
  19. package/dist/Modal/index.js +1 -1
  20. package/dist/NotFoundContent/index.js +1 -1
  21. package/dist/Overlay/index.js +1 -1
  22. package/dist/Radio/index.js +1 -1
  23. package/dist/ScrollBar/index.js +1 -1
  24. package/dist/Segmented/index.js +1 -1
  25. package/dist/Select/index.js +1 -1
  26. package/dist/Table/Table-BmPAWvbO.js +1078 -0
  27. package/dist/Table/index.js +4 -3
  28. package/dist/Tabs/index.js +1 -1
  29. package/dist/Tooltip/index.js +1 -1
  30. package/dist/Tree/index.js +1 -1
  31. package/dist/components/Table/HierarchyCell/HierarchyCell.d.ts +3 -0
  32. package/dist/components/Table/HierarchyCell/hierarchyTreeLayout.d.ts +27 -0
  33. package/dist/components/Table/HierarchyCell/index.d.ts +4 -0
  34. package/dist/components/Table/HierarchyCell/interface.d.ts +46 -0
  35. package/dist/components/Table/components/HeaderCell.d.ts +1 -3
  36. package/dist/components/Table/components/TableHeader.d.ts +1 -0
  37. package/dist/components/Table/constants.d.ts +4 -1
  38. package/dist/components/Table/hooks/index.d.ts +3 -1
  39. package/dist/components/Table/hooks/useTableColumnWidths.d.ts +22 -0
  40. package/dist/components/Table/hooks/useTableViewport.d.ts +21 -0
  41. package/dist/components/Table/hooks/useTableVirtual.d.ts +6 -0
  42. package/dist/components/Table/index.d.ts +2 -0
  43. package/dist/components/Table/interface.d.ts +1 -1
  44. package/dist/components/Table/utils/flattenColumns.d.ts +0 -2
  45. package/dist/components/Table/utils/tableUtils.d.ts +12 -0
  46. package/dist/components/index.d.ts +2 -1
  47. package/dist/index.js +6 -6
  48. package/dist/style.css +1 -1
  49. package/dist/vendors/{version-MwpV49PV.js → version-BovtV-fV.js} +1 -1
  50. package/package.json +1 -1
  51. package/dist/Table/Table-zYD3a8yk.js +0 -808
  52. package/dist/components/Table/utils/index.d.ts +0 -3
@@ -1,6 +1,7 @@
1
- import "../vendors/version-MwpV49PV.js";
1
+ import "../vendors/version-BovtV-fV.js";
2
2
  import "../ScrollBar/style-D26azwz6.js";
3
+ import "../Icon/Icon-CcKDWNGy.js";
3
4
  import "../vendors/LocaleContext-CsTLO_Y2.js";
4
5
  import "../vendors/useLocale-3oUjPb-k.js";
5
- import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g } from "./Table-zYD3a8yk.js";
6
- export { o as COLUMN_DEFAULTS, a as DEFAULT_CONFIG, e as TABLE_DOM, h as Table, h as default, t as TableBody, c as calculateFixedOffset, g as expandLeafColumns, d as getCellRowspan, r as getColumnsWidth, i as getRowKey, m as processRowspan, u as resolveTableThemeVars, n as shouldRenderCell, f as sortData, l as splitFixedColumns, p as useColumnResize, s as useTableVirtual };
6
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, p as f, r as p, s as m, t as h, u as g, v as _, y as v } from "./Table-BmPAWvbO.js";
7
+ export { e as COLUMN_DEFAULTS, _ as DEFAULT_CONFIG, h as HierarchyCell, v as TABLE_DOM, p as Table, p as default, m as TableBody, u as buildHierarchyTreeMeta, r as calculateFixedOffset, i as expandLeafColumns, n as getCellRowspan, f as getColumnsWidth, l as getRowKey, c as processRowspan, s as resolveTableThemeVars, g as shouldRenderCell, o as sortData, a as splitFixedColumns, t as useColumnResize, d as useTableVirtual };
@@ -1,4 +1,4 @@
1
- import "../vendors/version-MwpV49PV.js";
1
+ import "../vendors/version-BovtV-fV.js";
2
2
  import "../Icon/Icon-CcKDWNGy.js";
3
3
  import "../vendors/LocaleContext-CsTLO_Y2.js";
4
4
  import "../Overlay/OverlayContext-CVSFoyqN.js";
@@ -1,4 +1,4 @@
1
- import "../vendors/version-MwpV49PV.js";
1
+ import "../vendors/version-BovtV-fV.js";
2
2
  import "../Overlay/OverlayContext-CVSFoyqN.js";
3
3
  import "../vendors/useLatchedPopupPortalRoot-CC6af8t-.js";
4
4
  import { n as e, t } from "./Tooltip-N06Os8rG.js";
@@ -1,4 +1,4 @@
1
- import "../vendors/version-MwpV49PV.js";
1
+ import "../vendors/version-BovtV-fV.js";
2
2
  import "../Icon/Icon-CcKDWNGy.js";
3
3
  import { t as e } from "../vendors/Tree-f0FxoFIC.js";
4
4
  import "../CheckBox/CheckBox-DOdRLFKI.js";
@@ -0,0 +1,3 @@
1
+ import { HierarchyProps } from './interface';
2
+ declare const HierarchyCell: (props: HierarchyProps) => import("react").JSX.Element;
3
+ export default HierarchyCell;
@@ -0,0 +1,27 @@
1
+ import { HierarchyGutterBridgeStyle, HierarchyRailSegment, HierarchyRowMeta, HierarchyTreeLayout } from './interface';
2
+ export declare const HIERARCHY_TREE_LAYOUT: {
3
+ axisOffset: number;
4
+ arrowSize: number;
5
+ branchContinueOffset: number;
6
+ branchEndOffset: number;
7
+ iconOffset: number;
8
+ levelStep: number;
9
+ prefixOffset: number;
10
+ textGap: number;
11
+ textOffset: number;
12
+ };
13
+ export declare const getHierarchyTreeLayout: (depth?: number) => HierarchyTreeLayout;
14
+ export declare const buildHierarchyTreeMeta: (depths: number[]) => HierarchyRowMeta[];
15
+ export declare const getHierarchyTreeRailSegment: ({ rowIndex, subtreeEndIndex, type, }: {
16
+ rowIndex: number;
17
+ subtreeEndIndex: number;
18
+ type?: "ancestor" | "current";
19
+ }) => HierarchyRailSegment;
20
+ export declare const getHierarchyGutterBridgeStyle: ({ depth, hasChildren, previousDepth, rowIndex, rowMeta, treeMeta, }: {
21
+ depth?: number;
22
+ hasChildren?: boolean;
23
+ previousDepth?: number;
24
+ rowIndex?: number;
25
+ rowMeta?: HierarchyRowMeta | null;
26
+ treeMeta?: HierarchyRowMeta[];
27
+ }) => HierarchyGutterBridgeStyle;
@@ -0,0 +1,4 @@
1
+ export { default } from './HierarchyCell';
2
+ export { default as HierarchyCell } from './HierarchyCell';
3
+ export { buildHierarchyTreeMeta } from './hierarchyTreeLayout';
4
+ export type { HierarchyLoadMore, HierarchyProps, HierarchyRowMeta } from './interface';
@@ -0,0 +1,46 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ export interface HierarchyRowMeta {
3
+ ancestorIndices: number[];
4
+ subtreeEndIndex: number;
5
+ }
6
+ export interface HierarchyLoadMore {
7
+ label: ReactNode;
8
+ loading?: boolean;
9
+ onClick: () => void;
10
+ }
11
+ export interface HierarchyTreeLayout {
12
+ axisCenter: number;
13
+ arrowLeft: number;
14
+ prefixWidth: number;
15
+ textOffset: number;
16
+ }
17
+ export interface HierarchyRailSegment {
18
+ top: number | string;
19
+ bottom: number | string;
20
+ }
21
+ export type HierarchyDataProps = {
22
+ loadMore?: undefined;
23
+ rowIndex: number;
24
+ /** 上一可见行的深度,首行为 -1。用来画槽底横线 */
25
+ previousDepth?: number;
26
+ rowMeta: HierarchyRowMeta;
27
+ /** 整表元数据,与可见行下标对齐 */
28
+ treeMeta: HierarchyRowMeta[];
29
+ hasChildren?: boolean;
30
+ expanded?: boolean;
31
+ /** 子节点加载中时,箭头位置显示转圈,不显示展开按钮 */
32
+ loading?: boolean;
33
+ onToggle?: () => void;
34
+ };
35
+ type HierarchyLoadMoreProps = {
36
+ /** 传入后只画加载更多,不画引导线、箭头和 children */
37
+ loadMore: HierarchyLoadMore;
38
+ };
39
+ export type HierarchyProps = {
40
+ /** 当前行深度,从 0 开始。树槽宽度只由它决定 */
41
+ depth: number;
42
+ /** 字段内容。加载更多行不使用 */
43
+ children?: ReactNode;
44
+ } & (HierarchyDataProps | HierarchyLoadMoreProps);
45
+ export type HierarchyGutterBridgeStyle = Pick<CSSProperties, 'left' | 'width'> | null;
46
+ export {};
@@ -1,9 +1,7 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { ColumnConfig } from '../interface';
3
3
  export interface HeaderCellProps {
4
- column: ColumnConfig & {
5
- index?: number;
6
- };
4
+ column: ColumnConfig;
7
5
  style?: CSSProperties;
8
6
  className?: string;
9
7
  onResizeStart?: (columnKey: string, startWidth: number, startX: number) => void;
@@ -5,6 +5,7 @@ export interface TableHeaderProps {
5
5
  height?: number;
6
6
  resizingColumn?: string | null;
7
7
  onResizeStart?: (columnKey: string, startWidth: number, startX: number) => void;
8
+ resizable?: boolean;
8
9
  disabledResizeColumns?: string[];
9
10
  totalColumnsWidth?: number;
10
11
  needSpacer?: boolean;
@@ -16,6 +16,10 @@ export declare const COLUMN_DEFAULTS: {
16
16
  MIN_WIDTH: number;
17
17
  MAX_WIDTH: number;
18
18
  };
19
+ export declare const ROW_HEIGHT_STYLES: Record<'low' | 'middle' | 'high' | 'auto', {
20
+ className: string;
21
+ height: number | 'auto';
22
+ }>;
19
23
  export declare const SORT_DIRECTION: {
20
24
  readonly ASC: "asc";
21
25
  readonly DESC: "desc";
@@ -26,4 +30,3 @@ export declare const TABLE_DOM: {
26
30
  readonly wrapper: "custom-table-wrapper";
27
31
  readonly body: "custom-table-body";
28
32
  };
29
- export default DEFAULT_CONFIG;
@@ -1,2 +1,4 @@
1
- export { useTableVirtual } from './useTableVirtual';
1
+ export { useTableVirtual, sliceTableData } from './useTableVirtual';
2
2
  export { useColumnResize } from './useColumnResize';
3
+ export { useTableColumnWidths } from './useTableColumnWidths';
4
+ export { useTableViewport } from './useTableViewport';
@@ -0,0 +1,22 @@
1
+ import { RefObject } from 'react';
2
+ import { ColumnConfig, TableProps } from '../interface';
3
+ /**
4
+ * 拖拽宽度由表格自己保持。
5
+ * 传入的 width 数字变了,或和当前拖拽宽度相同,才让位给 props。
6
+ * 数字没变时保留拖拽结果,避免父组件重渲染把列宽弹回去。
7
+ */
8
+ export declare function useTableColumnWidths({ columns, scrollRef, minColumnWidth, maxColumnWidth, onColumnResize, onColumnResizeEnd, }: {
9
+ columns: ColumnConfig[];
10
+ scrollRef: RefObject<HTMLDivElement | null>;
11
+ minColumnWidth?: number;
12
+ maxColumnWidth?: number;
13
+ onColumnResize?: TableProps['onColumnResize'];
14
+ onColumnResizeEnd?: TableProps['onColumnResizeEnd'];
15
+ }): {
16
+ sizedColumns: ColumnConfig[];
17
+ flatColumns: ColumnConfig[];
18
+ isResizing: boolean;
19
+ resizingColumn: string | undefined;
20
+ handleResizeStart: (this: unknown, columnKey: string, startWidth: number, startX: number) => void;
21
+ resizeHandleRef: RefObject<HTMLDivElement>;
22
+ };
@@ -0,0 +1,21 @@
1
+ import { RefObject } from 'react';
2
+ import { OverlayScrollbarOptions } from '../interface';
3
+ /** 滚动容器尺寸、表头高度,以及表体在视口里剩下的高度 */
4
+ export declare function useTableViewport({ scrollRef, tableHeaderRef, bordered, hasFooter, headerRowSpan, dataSourceLength, overlayScrollbarOptions, }: {
5
+ scrollRef: RefObject<HTMLDivElement | null>;
6
+ tableHeaderRef: RefObject<HTMLDivElement | null>;
7
+ bordered: boolean;
8
+ hasFooter: boolean;
9
+ headerRowSpan?: number;
10
+ dataSourceLength: number;
11
+ overlayScrollbarOptions?: OverlayScrollbarOptions;
12
+ }): {
13
+ elementWidth: number;
14
+ hasYScroll: boolean;
15
+ scrollOffset: {
16
+ left: number;
17
+ top: number;
18
+ };
19
+ headerHeight: number;
20
+ bodyMinHeight: number | undefined;
21
+ };
@@ -18,3 +18,9 @@ export declare function useTableVirtual(rows: Record<string, unknown>[], options
18
18
  clearRowHeightCache: (this: unknown, rowIds?: string | number | (string | number)[] | undefined) => void;
19
19
  isDynamicHeight: boolean;
20
20
  };
21
+ /** 虚拟滚动只切当前窗口;未开启时给每行补 dataIndex。dataProcessor 吃切完的结果 */
22
+ export declare function sliceTableData(dataSource: Record<string, unknown>[], virtualRows: Array<{
23
+ index: number;
24
+ }>, virtualEnabled: boolean, dataProcessor?: (rows: Record<string, unknown>[]) => Record<string, unknown>[]): Record<string, unknown>[] | {
25
+ dataIndex: number;
26
+ }[];
@@ -8,3 +8,5 @@ export { processRowspan, shouldRenderCell, getCellRowspan } from './utils/proces
8
8
  export { getRowKey, calculateFixedOffset, splitFixedColumns, getColumnsWidth, expandLeafColumns, sortData, } from './utils/tableUtils';
9
9
  export { useTableVirtual, useColumnResize } from './hooks';
10
10
  export { TABLE_DOM, DEFAULT_CONFIG, COLUMN_DEFAULTS } from './constants';
11
+ export { HierarchyCell, buildHierarchyTreeMeta } from './HierarchyCell';
12
+ export type { HierarchyLoadMore, HierarchyProps, HierarchyRowMeta } from './HierarchyCell';
@@ -39,7 +39,7 @@ export interface OverlayScrollbarOptions {
39
39
  }
40
40
  /** Table 组件级颜色 token(命名对齐 Calendar / antd 习惯) */
41
41
  export interface TableTheme {
42
- /** 整体边框色(单元格分隔线、行底边、固定列遮罩等),默认 #e0e0e0 */
42
+ /** 外框、单元格分隔线、行底边和固定列遮罩,默认 #e0e0e0 */
43
43
  colorBorder?: string;
44
44
  /** 表头单元格背景,默认 #f5f7fa */
45
45
  colorBgHeader?: string;
@@ -4,8 +4,6 @@ type HeaderCell = ColumnConfig & {
4
4
  rowSpan?: number;
5
5
  isParent?: boolean;
6
6
  isLeaf?: boolean;
7
- isPlaceholder?: boolean;
8
- displayIndex?: number;
9
7
  };
10
8
  /**
11
9
  * 扁平化列配置,计算多级表头的 colspan 和 rowspan
@@ -19,4 +19,16 @@ export declare const splitFixedColumns: (columns: ColumnConfig[]) => {
19
19
  rightFixedColumns: ColumnConfig[];
20
20
  };
21
21
  export declare const getColumnsWidth: (columns: ColumnConfig[], defaultWidth?: number) => number;
22
+ /** 把拖拽中的列宽写回列树;没有覆盖时返回原数组 */
23
+ export declare const applyColumnWidths: (columns: ColumnConfig[], overrides: Record<string, number>) => ColumnConfig[];
24
+ /** 固定列拆分、总宽和是否需要撑开空白列 */
25
+ export declare const getTableColumnLayout: (columns: ColumnConfig[], elementWidth: number) => {
26
+ fixedLeftWidth: number;
27
+ fixedRightWidth: number;
28
+ totalColumnsWidth: number;
29
+ needSpacer: boolean;
30
+ leftFixedColumns: ColumnConfig[];
31
+ normalColumns: ColumnConfig[];
32
+ rightFixedColumns: ColumnConfig[];
33
+ };
22
34
  export {};
@@ -38,6 +38,7 @@ export { default as DatePicker } from './DatePicker';
38
38
  export type { DatePickerProps, DatePickerTheme, PickerType } from './DatePicker';
39
39
  export { default as Table } from './Table';
40
40
  export type { TableProps, TableTheme, ColumnConfig, HeaderRenderApi } from './Table';
41
- export { processRowspan, shouldRenderCell, getCellRowspan, getRowKey, calculateFixedOffset, splitFixedColumns, getColumnsWidth, expandLeafColumns, sortData, useTableVirtual, useColumnResize, resolveTableThemeVars, } from './Table';
41
+ export { processRowspan, shouldRenderCell, getCellRowspan, getRowKey, calculateFixedOffset, splitFixedColumns, getColumnsWidth, expandLeafColumns, sortData, useTableVirtual, useColumnResize, resolveTableThemeVars, HierarchyCell, buildHierarchyTreeMeta, } from './Table';
42
+ export type { HierarchyLoadMore, HierarchyProps, HierarchyRowMeta } from './Table';
42
43
  export { default as FieldCard } from './FieldCard';
43
44
  export type { FieldCardCheckProps, FieldCardCoverFit, FieldCardCoverLayout, FieldCardCoverPosition, FieldCardCoverShape, FieldCardExtraProps, FieldCardFooterProps, FieldCardLayout, FieldCardMetaProps, FieldCardProps, FieldCardSize, FieldCardSkeletonProps, FieldCardTheme, } from './FieldCard';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./vendors/version-MwpV49PV.js";
1
+ import "./vendors/version-BovtV-fV.js";
2
2
  import "./ScrollBar/style-D26azwz6.js";
3
3
  import { t as e } from "./Icon/Icon-CcKDWNGy.js";
4
4
  import "./vendors/LocaleContext-CsTLO_Y2.js";
@@ -29,10 +29,10 @@ import { t as O } from "./DropDown/DropDown-B3VFy5GF.js";
29
29
  import { t as k } from "./Loading/Loading-Dm4i0lYd.js";
30
30
  import "./NotFoundContent/index.js";
31
31
  import { t as A } from "./InputTag/InputTag-C1WA6sDA.js";
32
- import { t as j } from "./Calendar/Calendar-CbWlQ_kl.js";
33
- import { t as M } from "./DatePicker/DatePicker-C8ds9tlu.js";
32
+ import { t as j } from "./Calendar/Calendar-DHRiaiXw.js";
33
+ import { t as M } from "./DatePicker/DatePicker-BfyiYmTl.js";
34
34
  import "./DatePicker/pickerLocale-Brf7_Tnd.js";
35
- import { c as N, d as P, f as F, i as I, l as L, m as R, n as z, o as B, p as V, r as H, s as U, t as W, u as G } from "./Table/Table-zYD3a8yk.js";
36
- import { t as K } from "./FieldCard/FieldCard-CCv4nLpH.js";
35
+ import { a as N, c as P, d as F, f as I, g as L, h as R, i as z, l as B, m as V, n as H, o as U, p as W, r as G, t as K, u as q } from "./Table/Table-BmPAWvbO.js";
36
+ import { t as J } from "./FieldCard/FieldCard-CCv4nLpH.js";
37
37
  import "overlayscrollbars/overlayscrollbars.css";
38
- export { u as Amap, d as AmapCircle, l as AmapMarker, p as AmapMarkerCluster, f as AmapProvider, j as Calendar, m as Card, S as Checkbox, g as ColorPicker, n as ConfigProvider, M as DatePicker, O as DropDown, K as FieldCard, e as Icon, A as InputTag, k as Loading, t as LocalTheme, h as Modal, w as NotFoundContent, o as OVERLAY_Z_BASE, a as OVERLAY_Z_STEP, i as OverlayProvider, C as Radio, C as Ratio, T as ScrollBar, _ as Segmented, b as Select, D as TabSelect, W as Table, E as Tabs, y as Tooltip, v as TooltipFloatingContext, x as Tree, L as calculateFixedOffset, G as expandLeafColumns, B as getCellRowspan, P as getColumnsWidth, F as getRowKey, U as processRowspan, z as resolveTableThemeVars, N as shouldRenderCell, V as sortData, R as splitFixedColumns, s as useAmap, H as useColumnResize, c as useCurrentLocation, r as useOverlayZIndex, I as useTableVirtual };
38
+ export { u as Amap, d as AmapCircle, l as AmapMarker, p as AmapMarkerCluster, f as AmapProvider, j as Calendar, m as Card, S as Checkbox, g as ColorPicker, n as ConfigProvider, M as DatePicker, O as DropDown, J as FieldCard, K as HierarchyCell, e as Icon, A as InputTag, k as Loading, t as LocalTheme, h as Modal, w as NotFoundContent, o as OVERLAY_Z_BASE, a as OVERLAY_Z_STEP, i as OverlayProvider, C as Radio, C as Ratio, T as ScrollBar, _ as Segmented, b as Select, D as TabSelect, G as Table, E as Tabs, y as Tooltip, v as TooltipFloatingContext, x as Tree, H as buildHierarchyTreeMeta, F as calculateFixedOffset, I as expandLeafColumns, P as getCellRowspan, W as getColumnsWidth, V as getRowKey, B as processRowspan, z as resolveTableThemeVars, q as shouldRenderCell, R as sortData, L as splitFixedColumns, s as useAmap, N as useColumnResize, c as useCurrentLocation, r as useOverlayZIndex, U as useTableVirtual };