openxiangda 1.0.216 → 1.0.217

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.
@@ -44382,8 +44382,11 @@ function AdminList(props) {
44382
44382
  preserveSelectionAcrossPages = true,
44383
44383
  rowActions = [],
44384
44384
  rowKey,
44385
+ rowSelectable,
44386
+ rowSelectionReason,
44385
44387
  searchFields = [],
44386
44388
  selectable = true,
44389
+ selectedRowKeys: controlledSelectedKeys,
44387
44390
  style,
44388
44391
  toolbar
44389
44392
  } = props;
@@ -44466,6 +44469,40 @@ function AdminList(props) {
44466
44469
  },
44467
44470
  [messageApi, onSelectionChange]
44468
44471
  );
44472
+ useEffect14(() => {
44473
+ if (!controlledSelectedKeys) return;
44474
+ const nextKeys = [...controlledSelectedKeys];
44475
+ const nextKeySet = new Set(nextKeys);
44476
+ for (const key of selectedRowsRef.current.keys()) {
44477
+ if (!nextKeySet.has(key)) selectedRowsRef.current.delete(key);
44478
+ }
44479
+ for (const row of rows) {
44480
+ const key = getRowKey(rowKey, row);
44481
+ if (nextKeySet.has(key)) selectedRowsRef.current.set(key, row);
44482
+ }
44483
+ selectedKeysRef.current = nextKeys;
44484
+ setSelectedKeys(nextKeys);
44485
+ }, [controlledSelectedKeys, rowKey, rows]);
44486
+ useEffect14(() => {
44487
+ if (!rowSelectable || !selectedKeysRef.current.length || !rows.length) {
44488
+ return;
44489
+ }
44490
+ const disabledKeys = new Set(
44491
+ rows.filter((row) => !rowSelectable(row)).map((row) => getRowKey(rowKey, row))
44492
+ );
44493
+ if (!disabledKeys.size) return;
44494
+ const nextKeys = selectedKeysRef.current.filter(
44495
+ (key) => !disabledKeys.has(key)
44496
+ );
44497
+ if (nextKeys.length === selectedKeysRef.current.length) return;
44498
+ for (const key of disabledKeys) selectedRowsRef.current.delete(key);
44499
+ selectedKeysRef.current = nextKeys;
44500
+ setSelectedKeys(nextKeys);
44501
+ onSelectionChange?.({
44502
+ rowKeys: nextKeys,
44503
+ rows: nextKeys.map((key) => selectedRowsRef.current.get(key)).filter(Boolean)
44504
+ });
44505
+ }, [onSelectionChange, rowKey, rowSelectable, rows]);
44469
44506
  useEffect14(() => {
44470
44507
  let active = true;
44471
44508
  setReady(false);
@@ -45449,6 +45486,10 @@ function AdminList(props) {
45449
45486
  rowSelection: selectable ? {
45450
45487
  preserveSelectedRowKeys: preserveSelectionAcrossPages,
45451
45488
  selectedRowKeys: selectedKeys,
45489
+ getCheckboxProps: (row) => ({
45490
+ disabled: rowSelectable ? !rowSelectable(row) : false,
45491
+ title: rowSelectionReason?.(row)
45492
+ }),
45452
45493
  onChange: handleSelectionChange
45453
45494
  } : void 0,
45454
45495
  scroll: { x: "max-content" },