@baishuyun/ui-base 6.28.0 → 6.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/Amap/index.js +1 -1
  2. package/dist/Calendar/{Calendar-QAOCYl0o.js → Calendar-DPF0ecD9.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-C72BeWs_.js → DatePicker-Hn_P6uYt.js} +1 -1
  9. package/dist/DatePicker/{DatePickerPanel-CeQjC3c4.js → DatePickerPanel-Bl83l0FK.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/{FieldCard-wwg7WBOx.js → FieldCard-CCv4nLpH.js} +63 -61
  14. package/dist/FieldCard/index.js +2 -2
  15. package/dist/Gantt/index.js +2 -2
  16. package/dist/Icon/index.js +1 -1
  17. package/dist/InputTag/index.js +1 -1
  18. package/dist/Kanban/index.js +2 -2
  19. package/dist/Loading/index.js +1 -1
  20. package/dist/Modal/index.js +1 -1
  21. package/dist/NotFoundContent/index.js +1 -1
  22. package/dist/Overlay/index.js +1 -1
  23. package/dist/Radio/index.js +1 -1
  24. package/dist/ScrollBar/index.js +1 -1
  25. package/dist/Segmented/index.js +1 -1
  26. package/dist/Select/index.js +1 -1
  27. package/dist/Table/{Table-zYD3a8yk.js → Table-Cfj7bTb2.js} +355 -282
  28. package/dist/Table/index.js +2 -2
  29. package/dist/Tabs/index.js +1 -1
  30. package/dist/Tooltip/index.js +1 -1
  31. package/dist/Tree/index.js +1 -1
  32. package/dist/components/FieldCard/FieldCard.d.ts +1 -1
  33. package/dist/components/FieldCard/interface.d.ts +0 -2
  34. package/dist/components/Table/components/HeaderCell.d.ts +1 -3
  35. package/dist/components/Table/components/TableHeader.d.ts +1 -0
  36. package/dist/components/Table/constants.d.ts +4 -1
  37. package/dist/components/Table/hooks/index.d.ts +3 -1
  38. package/dist/components/Table/hooks/useTableColumnWidths.d.ts +22 -0
  39. package/dist/components/Table/hooks/useTableViewport.d.ts +21 -0
  40. package/dist/components/Table/hooks/useTableVirtual.d.ts +6 -0
  41. package/dist/components/Table/interface.d.ts +1 -1
  42. package/dist/components/Table/utils/flattenColumns.d.ts +0 -2
  43. package/dist/components/Table/utils/tableUtils.d.ts +12 -0
  44. package/dist/components/index.d.ts +2 -0
  45. package/dist/index.js +6 -5
  46. package/dist/style.css +1 -1
  47. package/dist/vendors/{version-DYjHCEjG.js → version-C6z7Jrt6.js} +1 -1
  48. package/package.json +1 -1
  49. package/dist/components/Table/utils/index.d.ts +0 -3
@@ -1,6 +1,6 @@
1
- import "../vendors/version-DYjHCEjG.js";
1
+ import "../vendors/version-C6z7Jrt6.js";
2
2
  import "../ScrollBar/style-D26azwz6.js";
3
3
  import "../vendors/LocaleContext-CsTLO_Y2.js";
4
4
  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";
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-Cfj7bTb2.js";
6
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 };
@@ -1,4 +1,4 @@
1
- import "../vendors/version-DYjHCEjG.js";
1
+ import "../vendors/version-C6z7Jrt6.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-DYjHCEjG.js";
1
+ import "../vendors/version-C6z7Jrt6.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-DYjHCEjG.js";
1
+ import "../vendors/version-C6z7Jrt6.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";
@@ -4,6 +4,6 @@ export declare const FieldCard: (({ title, selected, cover, coverPlaceholder, co
4
4
  Meta: ({ label, value, icon }: FieldCardMetaProps) => import("react").JSX.Element;
5
5
  Check: ({ className, children, ...rest }: FieldCardCheckProps) => import("react").JSX.Element;
6
6
  Footer: ({ className, children, onClick, onPointerDown, ...rest }: FieldCardFooterProps) => import("react").JSX.Element;
7
- Extra: ({ menus, onMenuClick, onMenuItemClick, dropDownProps, className, children, onClick, onPointerDown, onMouseDown, ...rest }: FieldCardExtraProps) => import("react").JSX.Element | null;
7
+ Extra: ({ menus, onMenuClick, dropDownProps, className, children, onClick, onPointerDown, onMouseDown, ...rest }: FieldCardExtraProps) => import("react").JSX.Element | null;
8
8
  };
9
9
  export default FieldCard;
@@ -69,8 +69,6 @@ export interface FieldCardExtraProps extends Omit<ButtonHTMLAttributes<HTMLButto
69
69
  menus?: MenuItemType[];
70
70
  /** 菜单项点击回调 */
71
71
  onMenuClick?: (menuItem: MenuItemType) => void;
72
- /** 兼容透传菜单项点击回调 */
73
- onMenuItemClick?: (menuItem: MenuItemType) => void;
74
72
  /** 点击按钮本身时的原生事件回调(已自动阻止事件冒泡) */
75
73
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
76
74
  /** 透传给 DropDown 的配置属性 */
@@ -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
+ }[];
@@ -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 {};
@@ -39,3 +39,5 @@ 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
41
  export { processRowspan, shouldRenderCell, getCellRowspan, getRowKey, calculateFixedOffset, splitFixedColumns, getColumnsWidth, expandLeafColumns, sortData, useTableVirtual, useColumnResize, resolveTableThemeVars, } from './Table';
42
+ export { default as FieldCard } from './FieldCard';
43
+ 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-DYjHCEjG.js";
1
+ import "./vendors/version-C6z7Jrt6.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,9 +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-QAOCYl0o.js";
33
- import { t as M } from "./DatePicker/DatePicker-C72BeWs_.js";
32
+ import { t as j } from "./Calendar/Calendar-DPF0ecD9.js";
33
+ import { t as M } from "./DatePicker/DatePicker-Hn_P6uYt.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";
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-Cfj7bTb2.js";
36
+ import { t as K } from "./FieldCard/FieldCard-CCv4nLpH.js";
36
37
  import "overlayscrollbars/overlayscrollbars.css";
37
- 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, 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, 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 };