@gm-pc/react 1.28.0-beta.0 → 1.28.0-beta.1

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": "@gm-pc/react",
3
- "version": "1.28.0-beta.0",
3
+ "version": "1.28.0-beta.1",
4
4
  "description": "观麦前端基础组件库",
5
5
  "author": "liyatang <liyatang@qq.com>",
6
6
  "homepage": "https://github.com/gmfe/gm-pc#readme",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@gm-common/hooks": "^2.10.0",
26
26
  "@gm-common/tool": "^2.10.0",
27
- "@gm-pc/locales": "^1.28.0-beta.0",
27
+ "@gm-pc/locales": "^1.28.0-beta.1",
28
28
  "big.js": "^6.0.1",
29
29
  "classnames": "^2.2.5",
30
30
  "lodash": "^4.17.19",
@@ -48,5 +48,5 @@
48
48
  "react-router-dom": "^5.2.0",
49
49
  "react-window": "^1.8.5"
50
50
  },
51
- "gitHead": "107461a0dd5c644e10482ed5f3ed8638fee436cc"
51
+ "gitHead": "994ee00d0f8515ba21e8522f0e66f717bc0859d9"
52
52
  }
@@ -46,7 +46,7 @@ class MoreSelectBase<V extends string | number = string> extends Component<
46
46
  loading: false,
47
47
  willActiveIndex: this.props.isKeyboard ? 0 : null,
48
48
  isCheckedAll: false,
49
- isFilterDelete: false,
49
+ isFilterDelete: true,
50
50
  displayCount: 0,
51
51
  }
52
52
 
@@ -71,15 +71,14 @@ class MoreSelectBase<V extends string | number = string> extends Component<
71
71
  }
72
72
 
73
73
  componentDidMount() {
74
- const { maxTagCount } = this.props
74
+ const { maxTagCount, tagItemWidth = 80, omittedTagWidth = 45 } = this.props
75
75
  if (maxTagCount === 'responsive' && this._selectionRef.current) {
76
76
  // HACK: 首次计算
77
77
  setTimeout(() => {
78
78
  if (this._selectionRef.current) {
79
79
  const { width } = this._selectionRef.current.getBoundingClientRect()
80
- const omittedTagWidth = 50 // for "+N..."
81
80
  const availableWidth = width - omittedTagWidth
82
- const newDisplayCount = Math.floor(availableWidth / 80)
81
+ const newDisplayCount = Math.floor(availableWidth / tagItemWidth)
83
82
  if (this.state.displayCount !== newDisplayCount) {
84
83
  this.setState({ displayCount: newDisplayCount > 0 ? newDisplayCount : 0 })
85
84
  }
@@ -90,12 +89,11 @@ class MoreSelectBase<V extends string | number = string> extends Component<
90
89
  for (const entry of entries) {
91
90
  const { width } = entry.contentRect
92
91
  // Estimate item width, let's say 80px.
93
- const omittedTagWidth = 50 // for "+N..."
94
92
  const availableWidth = width - omittedTagWidth
95
- const newDisplayCount = Math.floor(availableWidth / 80)
93
+ const newDisplayCount = Math.floor(availableWidth / tagItemWidth)
96
94
 
97
95
  if (this.state.displayCount !== newDisplayCount) {
98
- this.setState({ displayCount: newDisplayCount > 0 ? newDisplayCount : 0 })
96
+ this.setState({ displayCount: newDisplayCount })
99
97
  }
100
98
  }
101
99
  })
@@ -300,9 +298,8 @@ class MoreSelectBase<V extends string | number = string> extends Component<
300
298
  return (
301
299
  <Flex
302
300
  justifyBetween
303
- className='tw-p-[8px]'
301
+ className='tw-p-[8px] gm-more-select-default-bottom'
304
302
  alignCenter
305
- style={{ borderTop: '1px solid #aeaeae' }}
306
303
  >
307
304
  {isShowCheckedAll && (
308
305
  <Checkbox
@@ -323,7 +320,7 @@ class MoreSelectBase<V extends string | number = string> extends Component<
323
320
  }
324
321
  }}
325
322
  >
326
- 全选
323
+ 全选({availableData.length})
327
324
  </Checkbox>
328
325
  )}
329
326
  {isShowDeletedSwitch && (
@@ -464,7 +461,6 @@ class MoreSelectBase<V extends string | number = string> extends Component<
464
461
  children,
465
462
  maxTagCount,
466
463
  maxTagPlaceholder,
467
- isRenderDefaultBottom = false,
468
464
  } = this.props
469
465
 
470
466
  // 处理 maxTagCount 逻辑
@@ -12,6 +12,12 @@ class MoreSelect<V = any> extends Component<MoreSelectProps<V>> {
12
12
  renderListFilterType: 'default',
13
13
  popoverType: 'focus',
14
14
  onKeyDown: _.noop,
15
+ /** 是否展示全选以及过滤已删除商品 */
16
+ isRenderDefaultBottom: false,
17
+ /** 是否展示已删除商品 */
18
+ isShowDeletedSwitch: true,
19
+ /** 是否展示全选 */
20
+ isShowCheckedAll: true,
15
21
  }
16
22
 
17
23
  private _moreSelectBaseRef = createRef<MoreSelectBase>()
@@ -70,3 +70,7 @@
70
70
  }
71
71
  }
72
72
  }
73
+
74
+ .gm-more-select-default-bottom {
75
+ border-top: 1px solid var(--gm-color-border);
76
+ }
@@ -73,6 +73,17 @@ interface MoreSelectCommonProps<V extends string | number = string> {
73
73
  omittedValues: MoreSelectDataItem<V>[],
74
74
  omittedCount: number
75
75
  ) => ReactNode
76
+
77
+ /** 是否展示全选以及过滤已删除商品 */
78
+ isRenderDefaultBottom?: boolean
79
+ /** 是否展示已删除商品 */
80
+ isShowDeletedSwitch?: boolean
81
+ /** 是否展示全选 */
82
+ isShowCheckedAll?: boolean
83
+ /** 当设置 maxTagCount 的时候的宽度, 根据这个去计算显示内容 */
84
+ tagItemWidth?: number
85
+ /** +N 显示的宽度 */
86
+ omittedTagWidth?: number
76
87
  }
77
88
 
78
89
  interface MoreSelectBaseProps<V extends string | number = string>