@bit-sun/business-component 4.0.12-alpha.12 → 4.0.12-alpha.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.0.12-alpha.12",
3
+ "version": "4.0.12-alpha.17",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -2,6 +2,19 @@
2
2
  @primary-color: #005cff;
3
3
 
4
4
  .search_select {
5
+ // 选择器 隐藏滚动条 横向滑动
6
+ .ant-select-selector{
7
+ height: 24px;
8
+ overflow: hidden;
9
+ .ant-select-selection-overflow{
10
+ height: 40px;
11
+ flex-wrap: nowrap;
12
+ overflow-x: auto;
13
+ }
14
+ .ant-select-selection-overflow-item {
15
+ align-self: auto;
16
+ }
17
+ }
5
18
  &_show {
6
19
  display: flex;
7
20
 
@@ -300,3 +313,11 @@
300
313
  height: 300px !important;
301
314
  }
302
315
  }
316
+
317
+ .searchSelectMaxTagToolTip {
318
+ .ant-tooltip-inner {
319
+ max-height: 72px;
320
+ overflow-x: auto;
321
+ padding: 0px;
322
+ }
323
+ }
@@ -92,6 +92,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
92
92
 
93
93
  const [items, setItems] = useState([]);
94
94
  const [selectOpen, setSelectOpen] = useState(false);
95
+ const [isMaxTagsOpen, setIsMaxTagsOpen] = useState(false);
95
96
  const [scrollPage, setScrollPage] = useState(1);
96
97
  const [itemsTotal, setItemsTotal] = useState(0);
97
98
  const [fetching, setFetching] = useState(false);
@@ -922,6 +923,9 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
922
923
  }
923
924
 
924
925
  const onDropdownVisibleChange = (visible) => {
926
+ // 阻止maxTagPlaceholder点击事件触发下拉框展示事件
927
+ if(isMaxTagsOpen && !selectOpen) return;
928
+
925
929
  setSelectOpen(visible);
926
930
  // 关闭下拉框 如果首次本身就不展示数据的 没有选中数据-需要清空查询数据源; 首次展示的默认展示
927
931
  if (!visible && !value?.length) {
@@ -995,15 +999,33 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
995
999
  onChange(newValue);
996
1000
  }
997
1001
  return (
998
- <Tooltip title={selectedValues.map((i: any) => (
999
- <Tag
1000
- closable={true}
1001
- onClose={(e) => onClose(e, i)}
1002
- style={{ marginRight: 3, background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
1003
- >
1004
- {i.label}
1005
- </Tag>
1006
- ))}>
1002
+ <Tooltip
1003
+ overlayClassName='searchSelectMaxTagToolTip'
1004
+ destroyTooltipOnHide
1005
+ placement="topRight"
1006
+ autoAdjustOverflow={false}
1007
+ title={(
1008
+ <div
1009
+ style={{ margin: '6px 8px 0px' }}
1010
+ onMouseEnter={() => {
1011
+ setIsMaxTagsOpen(true)
1012
+ }}
1013
+ onMouseLeave={() => {
1014
+ setIsMaxTagsOpen(false)
1015
+ }}
1016
+ >
1017
+ {selectedValues.map((i: any) => (
1018
+ <Tag
1019
+ closable={true}
1020
+ onClose={(e) => onClose(e, i)}
1021
+ style={{ margin: '0px 3px 3px 0px', background: '#f5f5f5', height: '24px', border: '1px solid #f0f0f0' }}
1022
+ >
1023
+ {i.label}
1024
+ </Tag>
1025
+ ))}
1026
+ </div>
1027
+ )}
1028
+ >
1007
1029
  {`+ ${selectedValues?.length}`}
1008
1030
  </Tooltip>
1009
1031
  )
@@ -47,9 +47,12 @@ export const getCurrentSRKs = (selectMode: any,labelInValue:boolean,value: any)
47
47
  }
48
48
 
49
49
  export const getRenderSource = (currentSRKs: any, items: any) => {
50
+ // 判空处理
51
+ if(!currentSRKs?.length) return items||[];
52
+
50
53
  // 创建映射对象 用于记录原始选中顺序
51
54
  const orderMap = new Map<number, number>();
52
- currentSRKs.forEach((value: any, index: number) => {
55
+ currentSRKs?.forEach((value: any, index: number) => {
53
56
  orderMap.set(value, index);
54
57
  });
55
58