@gm-pc/react 1.5.8-alpha.0 → 1.6.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.5.8-alpha.0",
3
+ "version": "1.6.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.5.8-alpha.0",
27
+ "@gm-pc/locales": "^1.6.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": "2322bbcf6228ac009e7bab00d5e1c104e72ad441"
49
+ "gitHead": "d9efc26f098f130d69fa76503951feafce7c7faf"
50
50
  }
@@ -1,4 +1,11 @@
1
- import React, { CSSProperties, ReactNode, useState, useRef, useEffect } from 'react'
1
+ import React, {
2
+ CSSProperties,
3
+ ReactNode,
4
+ useState,
5
+ useRef,
6
+ useEffect,
7
+ useMemo,
8
+ } from 'react'
2
9
  import classNames from 'classnames'
3
10
  import _ from 'lodash'
4
11
  import { Flex, FlexProps } from '../flex'
@@ -15,6 +22,8 @@ interface TabsItem<V extends string | number> {
15
22
  /* 是否可关闭 */
16
23
  closable?: boolean
17
24
  ref?: HTMLDivElement | null
25
+ /** 是否隐藏 */
26
+ hide?: boolean
18
27
  }
19
28
 
20
29
  interface TabsProps<V extends string | number> extends Omit<FlexProps, 'onChange'> {
@@ -43,29 +52,28 @@ interface TabsProps<V extends string | number> extends Omit<FlexProps, 'onChange
43
52
  popverTitle?: string
44
53
  }
45
54
 
46
- function Tabs<V extends string | number = string>(props: TabsProps<V>) {
47
- const {
48
- tabs,
49
- light,
50
- active,
51
- defaultActive,
52
- keep,
53
- onChange,
54
- onClose,
55
- onChangeValidate,
56
- className,
57
- column = true,
58
- activeOnce,
59
- full,
60
- type,
61
- extraAction,
62
- isPopover,
63
- popup,
64
- popoverContent,
65
- popverTitle,
66
- ...rest
67
- } = props
68
-
55
+ function Tabs<V extends string | number = string>({
56
+ tabs,
57
+ light,
58
+ active,
59
+ defaultActive,
60
+ keep,
61
+ onChange,
62
+ onClose,
63
+ onChangeValidate,
64
+ className,
65
+ column = true,
66
+ activeOnce,
67
+ full,
68
+ type,
69
+ extraAction,
70
+ isPopover,
71
+ popup,
72
+ popoverContent,
73
+ popverTitle,
74
+ ...rest
75
+ }: TabsProps<V>) {
76
+ tabs = useMemo(() => tabs.filter((tab) => !tab.hide), [tabs])
69
77
  const editableCard: boolean = type === 'editable-card'
70
78
 
71
79
  const baseTabClassName = `gm-${full ? 'framework-full-' : ''}tabs`