@aloudata/aloudata-design 2.19.8 → 2.19.10

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.
@@ -22,6 +22,11 @@ export interface ISelectProps<ValueType = any, OptionType extends BaseOptionType
22
22
  dropdownClassName?: string;
23
23
  popupClassName?: string;
24
24
  placement?: PlacementType;
25
+ /**
26
+ * 空间不足时自动计算下拉面板最大高度并启用内部滚动,继承自 dropdown。
27
+ * 透传至底层 Dropdown 的 size middleware,避免短视口下面板溢出浏览器。
28
+ */
29
+ allowOverlap?: boolean;
25
30
  labelInValue?: boolean;
26
31
  options?: OptionType[];
27
32
  menu?: SelectMenuProps;
@@ -150,6 +150,8 @@ export default function Panel(props) {
150
150
  width: panelwidth
151
151
  }
152
152
  }, multiple ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
153
+ className: 'ald-member-picker-inner'
154
+ }, /*#__PURE__*/React.createElement("div", {
153
155
  className: "ald-member-picker-member-selection-wrapper"
154
156
  }, renderDropdown()), /*#__PURE__*/React.createElement(SelectedMemberTags, {
155
157
  className: 'ald-member-picker-selected-member-tags',
@@ -159,7 +161,7 @@ export default function Panel(props) {
159
161
  lockedIds: lockedIds,
160
162
  userList: dataList,
161
163
  renderSelectedTag: renderSelectedTag
162
- }), /*#__PURE__*/React.createElement(SelectorFooter, {
164
+ })), /*#__PURE__*/React.createElement(SelectorFooter, {
163
165
  className: 'ald-member-picker-selector-footer',
164
166
  onCancel: onCancel,
165
167
  onOk: function onOk() {
@@ -35,6 +35,7 @@ import { EMemberPicker } from "./interface";
35
35
  import { isUser, isUserGroup } from "./utils/getUsersWithUserId";
36
36
  import AldSelect from "../AldSelect";
37
37
  var Component = function Component(props) {
38
+ var _props$allowOverlap;
38
39
  var _useContext = useContext(LocaleContext),
39
40
  locale = _useContext.locale;
40
41
  var t = getTranslator(locale);
@@ -63,6 +64,8 @@ var Component = function Component(props) {
63
64
  renderItem = props.renderItem,
64
65
  renderSelectedTag = props.renderSelectedTag,
65
66
  restProps = _objectWithoutProperties(props, _excluded);
67
+ // 自适应高度开关:默认开启,consumer 可显式传 allowOverlap={false} 关闭
68
+ var allowOverlap = (_props$allowOverlap = props.allowOverlap) !== null && _props$allowOverlap !== void 0 ? _props$allowOverlap : false;
66
69
  var _ConfigProvider$useGe = ConfigProvider.useGetUserList(),
67
70
  getUsersByIds = _ConfigProvider$useGe.getUsersByIds,
68
71
  getUsersByKeywords = _ConfigProvider$useGe.getUsersByKeywords;
@@ -263,6 +266,8 @@ var Component = function Component(props) {
263
266
  return /*#__PURE__*/React.createElement(AldSelect, _extends({
264
267
  prefix: propPrefix
265
268
  }, restProps, {
269
+ // 默认开启自适应高度,短视口下面板不再溢出浏览器
270
+ allowOverlap: allowOverlap,
266
271
  size: size,
267
272
  className: classNames('ald-member-picker-select', className),
268
273
  value: selectedUserList.map(function (item) {
@@ -322,7 +327,9 @@ var Component = function Component(props) {
322
327
  }
323
328
  _onClear === null || _onClear === void 0 ? void 0 : _onClear();
324
329
  },
325
- popupClassName: classNames('ald-member-picker-popup', props.popupClassName),
330
+ popupClassName: classNames('ald-member-picker-popup',
331
+ // allowOverlap 开启时去掉列表固定高度,让面板高度由浮层 max-height 兜底
332
+ allowOverlap && 'ald-member-picker-popup-adaptive', props.popupClassName),
326
333
  mode: mode,
327
334
  options: selectedUserList.map(function (item) {
328
335
  if (item.type === EUserType.USER_GROUP) return {
@@ -354,7 +361,11 @@ var Component = function Component(props) {
354
361
  placeholder: placeholder,
355
362
  dropdownRender: function dropdownRender() {
356
363
  return /*#__PURE__*/React.createElement("div", {
357
- ref: triggerRef
364
+ ref: triggerRef,
365
+ className: classNames({
366
+ // 自适应高度 flex 链:把浮层高度透传给面板
367
+ 'ald-member-picker-popup-body': allowOverlap
368
+ })
358
369
  }, /*#__PURE__*/React.createElement(Panel, {
359
370
  type: type,
360
371
  footer: footer,
@@ -31,6 +31,12 @@
31
31
  }
32
32
  }
33
33
 
34
+ // 上半区:选择列 + 已选列并排(footer 由 wrapper 排在其下方)
35
+ .ald-member-picker-inner {
36
+ display: flex;
37
+ width: 100%;
38
+ }
39
+
34
40
  .ald-member-picker-member-selection-wrapper {
35
41
  width: 50%;
36
42
  border-right: 1px solid var(--border-default);
@@ -84,6 +90,96 @@
84
90
  height: 260px;
85
91
  }
86
92
 
93
+ // allowOverlap 自适应高度:把浮层 size middleware 的 max-height 沿 flex 链传到列表。
94
+ // 面板上下分区——上半区(inner) flex 占满剩余高度、footer 固定最下,仅列表/已选内部滚动。
95
+ .ald-member-picker-popup-adaptive {
96
+ display: flex;
97
+ flex-direction: column;
98
+
99
+ // SelectTrigger 的 popup 容器
100
+ .beta-ald-select-popup {
101
+ flex: 1;
102
+ min-height: 0;
103
+ display: flex;
104
+ flex-direction: column;
105
+ max-height: 430px;
106
+ }
107
+
108
+ // dropdownRender 包裹层(triggerRef)
109
+ .ald-member-picker-popup-body {
110
+ flex: 1;
111
+ min-height: 0;
112
+ display: flex;
113
+ flex-direction: column;
114
+ }
115
+
116
+ // 面板根:flex 列,上半区占满、footer 固定底部
117
+ .ald-member-picker-wrapper {
118
+ flex: 1;
119
+ min-height: 0;
120
+ display: flex;
121
+ flex-direction: column;
122
+ flex-wrap: nowrap;
123
+ }
124
+
125
+ // 上半区:撑满剩余高度
126
+ .ald-member-picker-inner {
127
+ flex: 1;
128
+ min-height: 0;
129
+ }
130
+
131
+ // footer:自然高度,固定最下方
132
+ .ald-member-picker-selector-footer {
133
+ flex: 0 0 auto;
134
+ }
135
+
136
+ // 左侧选择列:撑满并把高度传给 Tabs
137
+ .ald-member-picker-member-selection-wrapper {
138
+ min-height: 0;
139
+ display: flex;
140
+ flex-direction: column;
141
+ }
142
+
143
+ // antd Tabs 撑满,把高度透传到 tabpane
144
+ .ald-member-tabs.ant-tabs {
145
+ flex: 1;
146
+ min-height: 0;
147
+ display: flex;
148
+ flex-direction: column;
149
+
150
+ .ant-tabs-content-holder {
151
+ flex: 1;
152
+ min-height: 0;
153
+ }
154
+
155
+ .ant-tabs-content {
156
+ height: 100%;
157
+ }
158
+
159
+ .ant-tabs-tabpane {
160
+ height: 100%;
161
+ }
162
+ }
163
+
164
+ .ald-member-picker-member-list-wrap {
165
+ height: 100%;
166
+ min-height: 0;
167
+ }
168
+
169
+ // 列表去掉固定高度,flex 撑满剩余空间,内部滚动(user-list 类已是 flex:1)
170
+ .ald-member-picker-member-list {
171
+ height: auto !important;
172
+ min-height: 0;
173
+ }
174
+
175
+ // 右侧"已选"列:撑满 + 内部滚动
176
+ .ald-member-picker-selected-member-tags-wrap {
177
+ min-height: 0;
178
+ max-height: none;
179
+ overflow: hidden;
180
+ }
181
+ }
182
+
87
183
  .ald-member-picker-selected-member-tags-wrap {
88
184
  width: 50%;
89
185
  max-height: 377px;
@@ -357,7 +453,7 @@
357
453
  }
358
454
 
359
455
  .ald-member-selected-member-wrapper {
360
- height: calc(100% - 24px);
456
+ height: calc(100% - 32px) !important;
361
457
  }
362
458
 
363
459
  .ald-member-picker-ban-badge {
@@ -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(e) {
35
- return rowSelectionInfo.unSelectAll(e);
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: (e: React.MouseEvent) => void;
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
- var newKeys = allDataForSelection.map(function (record) {
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
- var selectedKeysInData = data.map(function (record) {
181
- var key = getRowKey(record, rowKey);
182
- if (selectedRowKeys.includes(key)) {
183
- return key;
184
- }
185
- return null;
186
- }).filter(function (key) {
187
- return key !== null;
188
- });
189
- if (selectedKeysInData.length === 0) {
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
- var dataWithoutDisabled = getDataWithoutDisabled(data, getCheckboxProps);
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;