Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
feat: upgrade to 2.7 version
Browse files Browse the repository at this point in the history
Signed-off-by: csonchen <cson_chensheng@163.com>
  • Loading branch information
csonchen committed Apr 25, 2023
1 parent 9e348e9 commit 52ce906
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 78 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"rc-time-picker": "^3.7.1",
"rc-tree": "2.1.0",
"react-addons-css-transition-group": "^15.6.2",
"react-bootstrap": "^1.6.6",
"react-bootstrap": "^2.7.4",
"react-dev-utils": "^11.0.4",
"react-draggable": "^4.4.5",
"react-ios-switch": "^0.1.19",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const defaultProps: DropdownDefaultProps = {
};

const Dropdown = (props: DropdownProps) => {
const { customToggle, pullRight, className, id, title, children } = props;
const { customToggle, className, id, title, children } = props;
return (
<BootstrapDropdown id={id} className={className} pullRight={pullRight}>
<BootstrapDropdown id={id} className={className}>
{customToggle && title}
{!customToggle && title && <BootstrapDropdown.Toggle>{title}</BootstrapDropdown.Toggle>}
<BootstrapDropdown.Menu>{children}</BootstrapDropdown.Menu>
Expand Down
10 changes: 5 additions & 5 deletions src/components/DropdownButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const DropdownButton = (props: DropdownButtonProps) => {
if (onToggle) onToggle(isOpen);
};

const { bsStyle, id, onSelect, bsSize, title, menu, children, componentClass, open } = props;
const { bsStyle, id, onSelect, title, menu, children, componentClass, open } = props;

const prevMenu = usePrevious(menu);
const isDifferentMenu = prevMenu !== menu;
Expand All @@ -126,13 +126,13 @@ const DropdownButton = (props: DropdownButtonProps) => {
const containerClassName = getContainerClass();
return (
<BootstrapDropdownButton
{...boolProps}
bsStyle={bsStyle}
{...(boolProps as any)}
variant={bsStyle}
id={id}
onSelect={onSelect}
title={title}
bsSize={bsSize}
onToggle={isOpen => getOnToggle(isOpen)}
// bsSize={bsSize}
onToggle={(isOpen: boolean) => getOnToggle(isOpen)}
componentClass={componentClass}
className={containerClassName}
open={props.hasOwnProperty('open') ? open : buttonOpen}
Expand Down
2 changes: 1 addition & 1 deletion src/components/InputDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const InputDropdown = (props: InputDropdownProps) => {
return (
<DropdownButton
id={uuid()}
{...rest}
{...(rest as any)}
componentClass={Button}
onSelect={handleSelect}
title={getTitle()}
Expand Down
23 changes: 19 additions & 4 deletions src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Modal as BaseModal,
// ModalHeader,
// ModalTitle,
ModalBody,
// ModalBody,
ModalFooter,
Button,
} from 'react-bootstrap';
Expand Down Expand Up @@ -75,9 +75,22 @@ const Modal: React.FC<ModalProps> = props => {
return draggable && preventDragByTitle ? { position: 'absolute' } : {};
}, [draggable, preventDragByTitle]);

return (
<BaseModal show={show}>
<BaseModal.Header closeButton>
<BaseModal.Title>Modal heading</BaseModal.Title>
</BaseModal.Header>
<BaseModal.Body>Woohoo, you're reading this text in a modal!</BaseModal.Body>
<BaseModal.Footer>
<Button variant="secondary">Close</Button>
<Button variant="primary">Save Changes</Button>
</BaseModal.Footer>
</BaseModal>
);

return (
<BaseModal
bsSize={bsSize}
// bsSize={bsSize}
className="Modal"
dialogClassName={dialogClassName}
style={style}
Expand All @@ -95,7 +108,7 @@ const Modal: React.FC<ModalProps> = props => {
{draggable && <div className="drag-handle" />}
<div>
{!hideHeader && (
<BaseModal.Header translate="" key="header" closeButton>
<BaseModal.Header key="header" closeButton>
<BaseModal.Title style={modalTitleStyle}>{title}</BaseModal.Title>
{draggable && preventDragByTitle ? (
<BaseModal.Title style={draggableHiddenTitleStyle}>{title}</BaseModal.Title>
Expand All @@ -104,7 +117,9 @@ const Modal: React.FC<ModalProps> = props => {
)}
</div>

<ModalBody key="body">{children}</ModalBody>
<BaseModal.Body key="body">
<div>{children}</div>
</BaseModal.Body>
{!hideFooter && (
<ModalFooter key="footer">
<Button type="submit" disabled={loading} variant={okStyle} onClick={onOk}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/RangePicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default class RangePicker extends React.PureComponent<RangePickerProps, R
<div className="RangePicker__duration">
{ranges.map(({ title, value }) => {
return (
<Button bsStyle="link" key={value} onClick={() => this.handleRangeClick(value)}>
<Button key={value} onClick={() => this.handleRangeClick(value)}>
{this.lang === 'en' ? value : title}
</Button>
);
Expand Down
11 changes: 4 additions & 7 deletions src/components/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ const Tabs: React.FC<TabsProps> = props => {
<Tab.Container
id="tabs-with-dropdown"
defaultActiveKey={TabsPan[eventKeyName]}
{...restProps}
unmountOnExit={unmountOnExit}
{...(restProps as any)}
>
<div>
<Nav variant="tabs">
{tabsFrontList.map((tab, idx) => (
<NavItem
title={typeof tab['title'] === 'string' ? tab['title'] : undefined}
key={eventKeyName ? tab[eventKeyName] : idx}
eventKey={eventKeyName ? tab[eventKeyName] : idx}
// eventKey={eventKeyName ? tab[eventKeyName] : idx}
>
{tab.title}
</NavItem>
Expand All @@ -82,11 +83,7 @@ const Tabs: React.FC<TabsProps> = props => {
</NavDropdown>
)}
</Nav>
<Tab.Content
unmountOnExit={unmountOnExit}
mountOnEnter={mountOnEnter}
animation={animation}
>
<Tab.Content>
{tabs.map((tab, idx) => (
<Tab.Pane
key={eventKeyName ? tab[eventKeyName] : idx}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const Tooltip: React.FC<TooltipProps> = props => {
onMouseEnter={handleShow}
onMouseLeave={handleHide}
>
{children}
<div>{children}</div>
</BaseTooltip>
</Overlay>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/VirtualSelectBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class VirtualSelectBox<T> extends React.Component<
return (
<FormControl
className="SelectBox__search"
bsSize="sm"
// bsSize="sm"
type="text"
value={this.state.search}
placeholder="请输入名称搜索"
Expand Down
27 changes: 25 additions & 2 deletions stories/Modal.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { storiesOf } from '@storybook/react';
import { Modal, Button, DatePicker } from '../src';
import { Button } from '../src';
import { Modal } from 'react-bootstrap';

const ModalPicker = () => {
const [show, setShow] = React.useState(false);
Expand All @@ -11,7 +12,29 @@ const ModalPicker = () => {
<Button variant="primary" onClick={handleClick}>
<span>打开对话框</span>
</Button>

<Modal
// animation={true}
show={show}
size="lg"
aria-labelledby="contained-modal-title-vcenter"
centered
>
<Modal.Header closeButton>
<Modal.Title id="contained-modal-title-vcenter">Modal heading</Modal.Title>
</Modal.Header>
<Modal.Body>
<h4>Centered Modal</h4>
<p>
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis
in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
</p>
</Modal.Body>
<Modal.Footer>
<Button onClick={handleHide}>Close</Button>
</Modal.Footer>
</Modal>
{/* <Modal
title="弹出框时间选择器"
show={show}
onHide={handleHide}
Expand All @@ -20,7 +43,7 @@ const ModalPicker = () => {
preventDragByTitle
>
<DatePicker defaultValue="2019-08-13 12:02:53" />
</Modal>
</Modal> */}
</div>
);
};
Expand Down
Loading

0 comments on commit 52ce906

Please sign in to comment.