-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
10,289 additions
and
650 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ react-jwchat 是一个简单的 web 聊天组件。 | |
|
||
```bash | ||
npm install react-jwchat | ||
# or | ||
yarn add react-jwchat | ||
``` | ||
|
||
## 组件 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "./", | ||
"paths": { | ||
"src/*": ["src/*"] | ||
}, | ||
"jsx": "react-jsx" | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Component, CSSProperties, MouseEventHandler } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
interface IProps { | ||
onSend: Function; | ||
me: IContact; | ||
contact: IContact; | ||
style: CSSProperties & { | ||
height: number; | ||
}; | ||
chatList: any[]; | ||
onImage?: Function; | ||
onEarlier?: MouseEventHandler; | ||
} | ||
export interface IContact { | ||
id: number | string; | ||
avatar: string; | ||
nickname: string; | ||
message: string; | ||
date: string; | ||
desc: string; | ||
} | ||
export default class Chat extends Component<IProps, {}> { | ||
static propTypes: { | ||
onSend: PropTypes.Validator<(...args: any[]) => any>; | ||
me: PropTypes.Validator<object>; | ||
contact: PropTypes.Validator<object>; | ||
style: PropTypes.Validator<object>; | ||
}; | ||
static defaultProps: { | ||
style: { | ||
width: number; | ||
height: number; | ||
}; | ||
contact: {}; | ||
me: {}; | ||
chatList: never[]; | ||
onSend: (msg: any) => void; | ||
}; | ||
sendHandle: (msgData: any) => void; | ||
render(): JSX.Element; | ||
} | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// <reference types="react" /> | ||
import { IContact } from '../Chat/Chat'; | ||
interface IProps { | ||
data: IContact; | ||
} | ||
declare function ChatHeader(props: IProps): JSX.Element; | ||
declare namespace ChatHeader { | ||
var propTypes: {}; | ||
} | ||
export default ChatHeader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// <reference types="react" /> | ||
import { IContact } from '../Chat/Chat'; | ||
interface IProps { | ||
me: IContact; | ||
onSend: Function; | ||
onImage?: Function; | ||
height: number; | ||
} | ||
declare type MessageType = 'text' | 'image'; | ||
export declare type TPureMsg = { | ||
type: MessageType; | ||
content: string; | ||
}; | ||
export declare type TMessage = { | ||
_id: string; | ||
date: number; | ||
user: IContact; | ||
message: TPureMsg; | ||
}; | ||
export default function ChatInput({ me, onSend, onImage, height, }: IProps): JSX.Element; | ||
export {}; |
10 changes: 10 additions & 0 deletions
10
lib/types/src/components/ChatRecordList/ChatRecordList.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { CSSProperties, MouseEventHandler } from 'react'; | ||
import { IContact } from '../Chat/Chat'; | ||
interface IProps { | ||
onEarlier?: MouseEventHandler; | ||
data: any[]; | ||
me: IContact; | ||
style?: CSSProperties; | ||
} | ||
declare const ChatRecordList: (props: IProps) => JSX.Element; | ||
export default ChatRecordList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
interface IProps { | ||
tools?: any[]; | ||
onEmojiSelect?: Function; | ||
onImage?: Function; | ||
} | ||
declare function ChatToolBar({ tools, onEmojiSelect, onImage, }: IProps): JSX.Element; | ||
declare namespace ChatToolBar { | ||
var propTypes: { | ||
tools: PropTypes.Requireable<any[]>; | ||
onEmojiSelect: PropTypes.Requireable<(...args: any[]) => any>; | ||
onImage: PropTypes.Validator<(...args: any[]) => any>; | ||
}; | ||
} | ||
export default ChatToolBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { CSSProperties } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
interface IProps { | ||
styles?: CSSProperties; | ||
selected: boolean; | ||
border: boolean; | ||
contact: any; | ||
onClick: Function; | ||
} | ||
declare function ContactItem({ styles, selected, border, contact, onClick, }: IProps): JSX.Element; | ||
declare namespace ContactItem { | ||
var propTypes: { | ||
contact: PropTypes.Validator<object>; | ||
className: PropTypes.Requireable<any>; | ||
style: PropTypes.Requireable<object>; | ||
}; | ||
var defaultProps: { | ||
onClick: () => void; | ||
}; | ||
} | ||
export default ContactItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React, { UIEventHandler } from 'react'; | ||
import { IContact } from '../Chat/Chat'; | ||
interface IProps { | ||
onSelect?: Function; | ||
data: IContact[]; | ||
onScroll: UIEventHandler<HTMLDivElement>; | ||
} | ||
declare const _default: React.ComponentType<IProps & { | ||
data: Object[]; | ||
style?: React.CSSProperties | undefined; | ||
scrollToBottom?: boolean | undefined; | ||
children?: React.ReactNode; | ||
}>; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
interface IProps { | ||
onSelect: Function; | ||
} | ||
declare function EmojiPopover({ onSelect }: IProps): JSX.Element; | ||
declare namespace EmojiPopover { | ||
var propTypes: { | ||
onSelect: PropTypes.Validator<(...args: any[]) => any>; | ||
}; | ||
} | ||
export default EmojiPopover; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
interface IProps { | ||
onImage: Function; | ||
} | ||
declare function ImgPopover({ onImage }: IProps): JSX.Element; | ||
declare namespace ImgPopover { | ||
var propTypes: { | ||
onImage: PropTypes.Validator<(...args: any[]) => any>; | ||
}; | ||
} | ||
export default ImgPopover; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
import { TPureMsg } from '../ChatInput/ChatInput'; | ||
interface IProps { | ||
data: TPureMsg; | ||
isMe: boolean; | ||
} | ||
declare function MsgBubble({ data, isMe }: IProps): JSX.Element; | ||
declare namespace MsgBubble { | ||
var propTypes: { | ||
data: PropTypes.Validator<object>; | ||
isMe: PropTypes.Validator<boolean>; | ||
}; | ||
} | ||
export default MsgBubble; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/// <reference types="react" /> | ||
import PropTypes from 'prop-types'; | ||
import { TMessage } from '../ChatInput/ChatInput'; | ||
import { IContact } from '../Chat/Chat'; | ||
interface IProps { | ||
data: TMessage; | ||
me: IContact; | ||
} | ||
declare function MsgItem({ data, me }: IProps): JSX.Element; | ||
declare namespace MsgItem { | ||
var propTypes: { | ||
data: PropTypes.Validator<object>; | ||
me: PropTypes.Validator<object>; | ||
}; | ||
} | ||
export default MsgItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React, { CSSProperties, ReactNode } from 'react'; | ||
declare type IProps = { | ||
data: Object[]; | ||
style?: CSSProperties; | ||
scrollToBottom?: boolean; | ||
children?: ReactNode; | ||
}; | ||
declare type HOC<InjectedProps, OwnProps> = <P>(Component: React.ComponentType<P & InjectedProps>) => React.ComponentType<P & OwnProps>; | ||
declare const ScrollWrapper: HOC<{}, IProps>; | ||
export default ScrollWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Chat from './Chat/Chat'; | ||
import ContactItem from './ContactItem/ContactItem'; | ||
import ContactList from './ContactList/ContactList'; | ||
export { ContactItem, Chat, ContactList }; |
Oops, something went wrong.