@gm-pc/react 1.28.0-beta.1 → 1.28.0-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.28.0-beta.1",
3
+ "version": "1.28.0-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.28.0-beta.1",
27
+ "@gm-pc/locales": "^1.28.0-beta.2",
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": "994ee00d0f8515ba21e8522f0e66f717bc0859d9"
51
+ "gitHead": "8e9f3a00a9da2a0d800dafeb65f37d737f84be75"
52
52
  }
@@ -20,8 +20,8 @@ import { getLocale } from '@gm-pc/locales'
20
20
  import { ListBase } from '../list'
21
21
  import { findDOMNode } from 'react-dom'
22
22
  import { ConfigConsumer, ConfigProvider, ConfigProviderProps } from '../config_provider'
23
- import { Checkbox, Switch } from '@gm-pc/react'
24
-
23
+ import { Checkbox } from '../checkbox'
24
+ import { Switch } from '../switch'
25
25
  interface MoreSelectBaseState {
26
26
  searchValue: string
27
27
  loading: boolean
@@ -327,7 +327,8 @@ class MoreSelectBase<V extends string | number = string> extends Component<
327
327
  <Flex alignCenter>
328
328
  <Flex row>
329
329
  <Switch
330
- style={{ width: 48 }}
330
+ size='small'
331
+ style={{ width: 32 }}
331
332
  checked={isFilterDelete}
332
333
  onChange={(open) => {
333
334
  this.setState({
@@ -344,7 +345,7 @@ class MoreSelectBase<V extends string | number = string> extends Component<
344
345
  }}
345
346
  />
346
347
  </Flex>
347
- <span className='gm-margin-left-5'>过滤已删除商品</span>
348
+ <span className='gm-margin-left-5'>过滤已删除数据</span>
348
349
  </Flex>
349
350
  )}
350
351
  </Flex>
@@ -6,6 +6,10 @@
6
6
  border-radius: calc(var(--gm-switch-size-height) / 2);
7
7
  background-color: var(--gm-color-bg-switch);
8
8
 
9
+ &.gm-switch-small {
10
+ --gm-switch-size-height: 16px;
11
+ }
12
+
9
13
  &::before {
10
14
  position: absolute;
11
15
  content: '';
@@ -11,6 +11,7 @@ interface SwitchProps {
11
11
  onChange?(checked: boolean): void
12
12
  className?: string
13
13
  style?: CSSProperties
14
+ size?: 'small' | 'middle'
14
15
  }
15
16
 
16
17
  interface SwitchState {
@@ -26,10 +27,11 @@ class Switch extends Component<SwitchProps, SwitchState> {
26
27
  on: '',
27
28
  off: '',
28
29
  onChange: _.noop,
30
+ size: 'middle',
29
31
  }
30
32
 
31
33
  readonly state: SwitchState = {
32
- checked: this.props.checked,
34
+ checked: !!this.props.checked,
33
35
  labelWidth: null,
34
36
  isReady: false,
35
37
  }
@@ -53,7 +55,7 @@ class Switch extends Component<SwitchProps, SwitchState> {
53
55
  UNSAFE_componentWillReceiveProps(nextProps: Readonly<SwitchProps>) {
54
56
  if ('checked' in nextProps) {
55
57
  this.setState({
56
- checked: nextProps.checked,
58
+ checked: !!nextProps.checked,
57
59
  })
58
60
  }
59
61
  }
@@ -82,6 +84,7 @@ class Switch extends Component<SwitchProps, SwitchState> {
82
84
  disabled,
83
85
  on,
84
86
  off,
87
+ size,
85
88
  ...rest
86
89
  } = this.props
87
90
 
@@ -101,8 +104,9 @@ class Switch extends Component<SwitchProps, SwitchState> {
101
104
  ref={this._inputOffRef}
102
105
  className={classNames('gm-switch gm-switch-' + type, className, {
103
106
  disabled,
107
+ [`gm-switch-${size}`]: size,
104
108
  })}
105
- style={style}
109
+ style={style as any}
106
110
  data-attr={this.state.labelWidth}
107
111
  disabled={disabled}
108
112
  type='checkbox'