@gm-pc/react 1.8.8 → 1.9.2-beta.2

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.8.8",
3
+ "version": "1.9.2-beta.2",
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.8.8",
27
+ "@gm-pc/locales": "^1.9.2-beta.2",
28
28
  "big.js": "^6.0.1",
29
29
  "classnames": "^2.2.5",
30
30
  "lodash": "^4.17.19",
@@ -46,5 +46,5 @@
46
46
  "react-dom": "^16.14.0",
47
47
  "react-window": "^1.8.5"
48
48
  },
49
- "gitHead": "5f590a574045fa5259a021b3aff181a4ab0a5d0f"
49
+ "gitHead": "f99ad9c66bd178f107535136d9938422fb756fda"
50
50
  }
@@ -202,6 +202,23 @@ class MoreSelectBase<V extends string | number = string> extends Component<
202
202
  return filterData
203
203
  }
204
204
 
205
+ private _renderEmpty = (): ReactNode => {
206
+ const { renderEmpty } = this.props
207
+
208
+ if (typeof renderEmpty === 'function') {
209
+ const result = renderEmpty(this.state.searchValue)
210
+ if (result !== undefined) {
211
+ return result
212
+ }
213
+ }
214
+
215
+ return (
216
+ <Flex alignCenter justifyCenter className='gm-bg gm-padding-5 gm-text-desc'>
217
+ {getLocale('没有数据')}
218
+ </Flex>
219
+ )
220
+ }
221
+
205
222
  private _renderList = (): ReactNode => {
206
223
  const {
207
224
  selected = [],
@@ -234,11 +251,7 @@ class MoreSelectBase<V extends string | number = string> extends Component<
234
251
  <Loading size='20px' />
235
252
  </Flex>
236
253
  )}
237
- {!loading && !filterData.length && (
238
- <Flex alignCenter justifyCenter className='gm-bg gm-padding-5 gm-text-desc'>
239
- {getLocale('没有数据')}
240
- </Flex>
241
- )}
254
+ {!loading && !filterData.length && this._renderEmpty()}
242
255
  {!loading && !!filterData.length && (
243
256
  <ListBase
244
257
  selected={selected.map((v) => v.value)}
@@ -38,6 +38,13 @@ interface MoreSelectCommonProps<V extends string | number = string> {
38
38
  /** 自定义popup底部渲染 */
39
39
  renderCustomizedBottom?(ref: React.RefObject<Popover>): ReactNode
40
40
 
41
+ /**
42
+ * 自定义“空状态”渲染
43
+ *
44
+ * 若函数返回 undefined 则使用默认的空状态
45
+ */
46
+ renderEmpty?(searchValue?: string): ReactNode
47
+
41
48
  listHeight?: string
42
49
  isGroupList?: boolean
43
50
  popoverType?: 'focus' | 'realFocus'