arthub-table 0.2.15 → 0.2.16

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.
@@ -599,6 +599,14 @@ export interface DataGridCallbacks {
599
599
  data: any;
600
600
  selectedRowIds: string[];
601
601
  }) => void;
602
+ /** 最大可选行数(超过此数量时阻止勾选并触发 onSelectionLimitExceeded 回调),不设置则不限制 */
603
+ maxSelectedRows?: number;
604
+ /** 勾选超限回调(当勾选操作将导致选中数量超过 maxSelectedRows 时触发) */
605
+ onSelectionLimitExceeded?: (info: {
606
+ currentCount: number;
607
+ attemptCount: number;
608
+ limit: number;
609
+ }) => void;
602
610
  /**
603
611
  * Cell value transformer callback.
604
612
  * Called by Cell.drawWithViewer() before passing data to viewer.draw().
@@ -732,6 +732,14 @@ export interface DataGridOptions {
732
732
  data: any;
733
733
  selectedRowIds: string[];
734
734
  }) => void;
735
+ /** 最大可选行数(超过此数量时阻止勾选并触发 onSelectionLimitExceeded 回调),不设置则不限制 */
736
+ maxSelectedRows?: number;
737
+ /** 勾选超限回调(当勾选操作将导致选中数量超过 maxSelectedRows 时触发) */
738
+ onSelectionLimitExceeded?: (info: {
739
+ currentCount: number;
740
+ attemptCount: number;
741
+ limit: number;
742
+ }) => void;
735
743
  /**
736
744
  /** Cell value transformer callback.
737
745
  * Called by Cell.drawWithViewer() before passing data to viewer.draw().
@@ -793,6 +801,8 @@ declare class DataGrid {
793
801
  edgeScroller: EdgeScroller;
794
802
  rowIdMap: Map<string, number>;
795
803
  selectedRowIds: Set<string>;
804
+ selectedGroupIds: Set<string>;
805
+ _groupSelectedRowIds: Map<string, string[]>;
796
806
  lastSelectedRowIndex: number;
797
807
  /** Footer 行高度(showFooter 为 false 时返回 0) */
798
808
  get footerHeight(): number;
@@ -966,6 +976,14 @@ declare class DataGrid {
966
976
  data: any;
967
977
  selectedRowIds: string[];
968
978
  }) => void;
979
+ /** 最大可选行数(超过此数量时阻止勾选) */
980
+ maxSelectedRows?: number;
981
+ /** 勾选超限回调 */
982
+ onSelectionLimitExceeded?: (info: {
983
+ currentCount: number;
984
+ attemptCount: number;
985
+ limit: number;
986
+ }) => void;
969
987
  /** 折叠所有任务回调 */
970
988
  onCollapseAll?: () => void;
971
989
  /** 展开所有任务回调 */
@@ -2276,6 +2294,12 @@ declare class DataGrid {
2276
2294
  */
2277
2295
  private ensureRowIds;
2278
2296
  syncGroupCheckedState(): void;
2297
+ /**
2298
+ * 受控模式下:计算组头应有的 checked 状态,如果与当前不一致则通过回调通知外部修改。
2299
+ * 逻辑与 syncGroupCheckedState 的计算一致,但不直接修改 data.checked 和 selectedGroupIds,
2300
+ * 而是通过 onGroupCheckboxChange 回调让外部决定是否更新。
2301
+ */
2302
+ private _notifyGroupCheckedChanges;
2279
2303
  /**
2280
2304
  * 折叠所有任务(受控模式下触发 onCollapseAll 回调,由外部操作 tableTaskList 后刷新)
2281
2305
  */
@@ -293,6 +293,14 @@ declare class GroupRow extends Context {
293
293
  * @returns 变更后该组内所有行的 rowId 数组
294
294
  */
295
295
  private selectGroupRows;
296
+ /**
297
+ * 计算该组下将新增的选中行数(不含已选中的行)
298
+ * 用于 maxSelectedRows 前置校验
299
+ *
300
+ * @param groupId - 组头行的 ID
301
+ * @returns 该组内尚未选中的普通行数量
302
+ */
303
+ private countGroupRows;
296
304
  /**
297
305
  * Placeholder methods for compatibility with Row interface
298
306
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arthub-table",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "High-performance canvas-based table/grid component for Vue 3 with TypeScript support, featuring virtual scrolling, cell viewers, grouped rows, and nested grids.",
5
5
  "main": "dist/arthub-table.common.js",
6
6
  "module": "dist/arthub-table.umd.min.js",