@aloudata/aloudata-design 2.19.7 → 2.19.9
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.
- package/dist/LogicTree/components/LogicItem/index.js +1 -2
- package/dist/Table/components/Footer/index.js +2 -2
- package/dist/Table/hooks/useRowSelection.d.ts +3 -2
- package/dist/Table/hooks/useRowSelection.js +16 -15
- package/dist/Table/style/index.less +26 -0
- package/dist/ald.min.css +1 -1
- package/package.json +1 -1
|
@@ -327,8 +327,7 @@ export default function LogicItem(_ref) {
|
|
|
327
327
|
size: "small",
|
|
328
328
|
popupMatchSelectWidth: false,
|
|
329
329
|
value: _logicType,
|
|
330
|
-
onChange: onChangeRelation
|
|
331
|
-
disabled: nodes.length <= 1
|
|
330
|
+
onChange: onChangeRelation
|
|
332
331
|
}), /*#__PURE__*/React.createElement(DragPreviewImage, {
|
|
333
332
|
connect: preview,
|
|
334
333
|
src: dargPreviewImg
|
|
@@ -31,8 +31,8 @@ export default function TableFooter(props) {
|
|
|
31
31
|
var btnItems = [{
|
|
32
32
|
key: '$UN_SELECT_ALL$',
|
|
33
33
|
label: t.Table.cancelSelect,
|
|
34
|
-
onClick: function onClick(
|
|
35
|
-
return rowSelectionInfo.unSelectAll(
|
|
34
|
+
onClick: function onClick() {
|
|
35
|
+
return rowSelectionInfo.unSelectAll();
|
|
36
36
|
}
|
|
37
37
|
}].concat(_toConsumableArray(items));
|
|
38
38
|
var rowSelectionNode = isShowRowSelectionInFooter && /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ITableProps } from '../types';
|
|
2
|
+
import { IRowSelection, ITableProps } from '../types';
|
|
3
3
|
export default function useRowSelection<TDataItem extends object>(props: ITableProps<TDataItem> & {
|
|
4
4
|
isExpandable?: boolean;
|
|
5
5
|
flattenData?: TDataItem[];
|
|
6
6
|
}): IRowSelectionInfo<TDataItem>;
|
|
7
|
+
export declare function getCheckboxAllStatus<TDataItem extends object>(data: TDataItem[], selectedRowKeys: string[], rowKey: ITableProps<TDataItem>['rowKey'], getCheckboxProps?: IRowSelection<TDataItem>['getCheckboxProps']): 'all' | 'none' | 'indeterminate';
|
|
7
8
|
export interface IRowSelectionInfo<TDataItem extends object> {
|
|
8
9
|
columns: ITableProps<TDataItem>['columns'];
|
|
9
10
|
isRowSelectionEnabled: boolean;
|
|
10
11
|
getCheckboxAllNode: ((children?: React.ReactNode) => React.ReactNode) | null;
|
|
11
12
|
selectedRowKeys: string[];
|
|
12
13
|
selectedRowKeysInCurrPage: string[];
|
|
13
|
-
unSelectAll: (
|
|
14
|
+
unSelectAll: () => void;
|
|
14
15
|
isShowRowSelectionInFooter: boolean;
|
|
15
16
|
items: {
|
|
16
17
|
key: string;
|
|
@@ -64,11 +64,12 @@ export default function useRowSelection(props) {
|
|
|
64
64
|
}, [getAllSelectedRows, rowSelection]);
|
|
65
65
|
var checkboxAllStatus = getCheckboxAllStatus(allDataForSelection, selectedRowKeys, rowKey, rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.getCheckboxProps);
|
|
66
66
|
var selectAll = useCallback(function () {
|
|
67
|
-
|
|
67
|
+
// 仅选中未禁用项;禁用项不允许进入选中态
|
|
68
|
+
var newKeys = getDataWithoutDisabled(allDataForSelection, rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.getCheckboxProps).map(function (record) {
|
|
68
69
|
return getRowKey(record, rowKey);
|
|
69
70
|
});
|
|
70
71
|
changeSelectedRowKeys(newKeys);
|
|
71
|
-
}, [allDataForSelection, rowKey, changeSelectedRowKeys]);
|
|
72
|
+
}, [allDataForSelection, rowKey, rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.getCheckboxProps, changeSelectedRowKeys]);
|
|
72
73
|
var unSelectAll = useCallback(function () {
|
|
73
74
|
changeSelectedRowKeys([]);
|
|
74
75
|
}, [changeSelectedRowKeys]);
|
|
@@ -176,21 +177,21 @@ export default function useRowSelection(props) {
|
|
|
176
177
|
onChange: changeSelectedRowKeys
|
|
177
178
|
};
|
|
178
179
|
}
|
|
179
|
-
function getCheckboxAllStatus(data, selectedRowKeys, rowKey, getCheckboxProps) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
180
|
+
export function getCheckboxAllStatus(data, selectedRowKeys, rowKey, getCheckboxProps) {
|
|
181
|
+
// 全选状态只由「未禁用」项决定:禁用项无论是否预选都不影响全选/半选/未选的判定,
|
|
182
|
+
// 否则会出现「全部可选项已勾选 + 1 个禁用预选」被错算成 indeterminate,
|
|
183
|
+
// 或者「全部可选项中某项已取消 + 1 个禁用预选」被错算成 all 的情况。
|
|
184
|
+
var enabledData = getDataWithoutDisabled(data, getCheckboxProps);
|
|
185
|
+
if (enabledData.length === 0) {
|
|
186
|
+
return 'none';
|
|
187
|
+
}
|
|
188
|
+
var selectedEnabledCount = enabledData.filter(function (record) {
|
|
189
|
+
return selectedRowKeys.includes(getRowKey(record, rowKey));
|
|
190
|
+
}).length;
|
|
191
|
+
if (selectedEnabledCount === 0) {
|
|
190
192
|
return 'none';
|
|
191
193
|
}
|
|
192
|
-
|
|
193
|
-
if (selectedKeysInData.length === dataWithoutDisabled.length) {
|
|
194
|
+
if (selectedEnabledCount === enabledData.length) {
|
|
194
195
|
return 'all';
|
|
195
196
|
}
|
|
196
197
|
return 'indeterminate';
|
|
@@ -366,6 +366,32 @@
|
|
|
366
366
|
height: 100%;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
+
// 加深 rowSelection checkbox disabled 态的可见度:默认 Checkbox 的 disabled
|
|
370
|
+
// 背景/边框与正常态一致(都是表单底色 + 默认描边),单看一行根本看不出来这是禁
|
|
371
|
+
// 用项。这里仅在 Table 选择列内覆盖,避免影响其他场景。仅处理 unchecked+disabled,
|
|
372
|
+
// checked+disabled 与 indeterminate+disabled 保留组件原本样式。
|
|
373
|
+
//
|
|
374
|
+
// 注:直接用 semantic 层 token 而非 --alias-colors-bg-disabled / --alias-colors-border-disabled,
|
|
375
|
+
// 是因为这两个 alias token 都是 rgba(0,0,0,0.06),边框几乎透明,套上去等于没改 ——
|
|
376
|
+
// 也正是这次 bug 的根因。等设计系统把 disabled alias 加深后再切回 alias 层即可。
|
|
377
|
+
//
|
|
378
|
+
// `[class][class]` 是为了把选择符特异度抬到比 Checkbox/style/index.less 里
|
|
379
|
+
// `.ald-checkbox.ald-checkbox.ant-checkbox-wrapper .ant-checkbox-disabled
|
|
380
|
+
// .ant-checkbox-inner[class][class]` 更高,否则覆盖不掉。
|
|
381
|
+
.ald-table-row-selection-all,
|
|
382
|
+
.ald-table-row-selection-item {
|
|
383
|
+
.ald-checkbox.ant-checkbox-wrapper-disabled {
|
|
384
|
+
.ant-checkbox-disabled:not(.ant-checkbox-checked):not(
|
|
385
|
+
.ant-checkbox-indeterminate
|
|
386
|
+
) {
|
|
387
|
+
.ant-checkbox-inner[class][class] {
|
|
388
|
+
background-color: var(--semantic-neutral-100);
|
|
389
|
+
border-color: var(--semantic-neutral-300);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
369
395
|
/** Footer **/
|
|
370
396
|
.ald-table-footer {
|
|
371
397
|
padding: 16px;
|