Bladeren bron

chore: add elementType to Checkbox,Radio,Avatar (#1080)

走鹃 3 jaren geleden
bovenliggende
commit
33b2b94457
3 gewijzigde bestanden met toevoegingen van 8 en 2 verwijderingen
  1. 3 1
      packages/semi-ui/avatar/index.tsx
  2. 3 1
      packages/semi-ui/checkbox/checkbox.tsx
  3. 2 0
      packages/semi-ui/radio/radio.tsx

+ 3 - 1
packages/semi-ui/avatar/index.tsx

@@ -31,6 +31,7 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
         onMouseLeave: noop,
     };
 
+    static elementType: string;
     static propTypes = {
         children: PropTypes.node,
         color: PropTypes.oneOf(colorSet),
@@ -192,7 +193,7 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
             const finalProps = clickable ? { ...props, ...a11yFocusProps } : props;
             content = (
                 <span className={`${prefixCls}-content`}>
-                    <span {...finalProps}  x-semi-prop="children">{children}</span>
+                    <span {...finalProps} x-semi-prop="children">{children}</span>
                 </span>
             );
         }
@@ -234,3 +235,4 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
         );
     }
 }
+Avatar.elementType = 'Avatar';

+ 3 - 1
packages/semi-ui/checkbox/checkbox.tsx

@@ -81,6 +81,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
         onMouseLeave: noop,
         type: 'default',
     };
+    static elementType: string;
+
     checkboxEntity: CheckboxInner;
     context: CheckboxContextType;
 
@@ -288,6 +290,6 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
         );
     }
 }
-
+Checkbox.elementType = 'Checkbox';
 
 export default Checkbox;

+ 2 - 0
packages/semi-ui/radio/radio.tsx

@@ -92,6 +92,7 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
         mode: '',
         type: 'default'
     };
+    static elementType: string;
 
     radioEntity: RadioInner;
     context!: RadioContextValue;
@@ -317,5 +318,6 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
         );
     }
 }
+Radio.elementType = 'Radio';
 
 export default Radio;