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.
@@ -43620,8 +43620,11 @@ function AdminList(props) {
43620
43620
  preserveSelectionAcrossPages = true,
43621
43621
  rowActions = [],
43622
43622
  rowKey,
43623
+ rowSelectable,
43624
+ rowSelectionReason,
43623
43625
  searchFields = [],
43624
43626
  selectable = true,
43627
+ selectedRowKeys: controlledSelectedKeys,
43625
43628
  style,
43626
43629
  toolbar
43627
43630
  } = props;
@@ -43704,6 +43707,40 @@ function AdminList(props) {
43704
43707
  },
43705
43708
  [messageApi, onSelectionChange]
43706
43709
  );
43710
+ (0, import_react21.useEffect)(() => {
43711
+ if (!controlledSelectedKeys) return;
43712
+ const nextKeys = [...controlledSelectedKeys];
43713
+ const nextKeySet = new Set(nextKeys);
43714
+ for (const key of selectedRowsRef.current.keys()) {
43715
+ if (!nextKeySet.has(key)) selectedRowsRef.current.delete(key);
43716
+ }
43717
+ for (const row of rows) {
43718
+ const key = getRowKey(rowKey, row);
43719
+ if (nextKeySet.has(key)) selectedRowsRef.current.set(key, row);
43720
+ }
43721
+ selectedKeysRef.current = nextKeys;
43722
+ setSelectedKeys(nextKeys);
43723
+ }, [controlledSelectedKeys, rowKey, rows]);
43724
+ (0, import_react21.useEffect)(() => {
43725
+ if (!rowSelectable || !selectedKeysRef.current.length || !rows.length) {
43726
+ return;
43727
+ }
43728
+ const disabledKeys = new Set(
43729
+ rows.filter((row) => !rowSelectable(row)).map((row) => getRowKey(rowKey, row))
43730
+ );
43731
+ if (!disabledKeys.size) return;
43732
+ const nextKeys = selectedKeysRef.current.filter(
43733
+ (key) => !disabledKeys.has(key)
43734
+ );
43735
+ if (nextKeys.length === selectedKeysRef.current.length) return;
43736
+ for (const key of disabledKeys) selectedRowsRef.current.delete(key);
43737
+ selectedKeysRef.current = nextKeys;
43738
+ setSelectedKeys(nextKeys);
43739
+ onSelectionChange?.({
43740
+ rowKeys: nextKeys,
43741
+ rows: nextKeys.map((key) => selectedRowsRef.current.get(key)).filter(Boolean)
43742
+ });
43743
+ }, [onSelectionChange, rowKey, rowSelectable, rows]);
43707
43744
  (0, import_react21.useEffect)(() => {
43708
43745
  let active = true;
43709
43746
  setReady(false);
@@ -44687,6 +44724,10 @@ function AdminList(props) {
44687
44724
  rowSelection: selectable ? {
44688
44725
  preserveSelectedRowKeys: preserveSelectionAcrossPages,
44689
44726
  selectedRowKeys: selectedKeys,
44727
+ getCheckboxProps: (row) => ({
44728
+ disabled: rowSelectable ? !rowSelectable(row) : false,
44729
+ title: rowSelectionReason?.(row)
44730
+ }),
44690
44731
  onChange: handleSelectionChange
44691
44732
  } : void 0,
44692
44733
  scroll: { x: "max-content" },