z-react-ui
Version:
z-react-ui,是一款基于 Dumi,由 React + TypeScript 开发的组件库 🎉。
43 lines (39 loc) • 1.75 kB
JavaScript
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
import { usePrefixCls } from '@/_hooks';
import classNames from 'classnames';
import { ChatList, SendMsg } from 'z-react-ui'; // #----------- 上: ts类型定义 ----------- 分割线 ----------- 下: JS代码 -----------
var defaultFieldNames = {};
var ChatPanel = function ChatPanel(_ref, ref) {
var dataSource = _ref.dataSource,
_ref$fieldNames = _ref.fieldNames,
fieldNames = _ref$fieldNames === void 0 ? defaultFieldNames : _ref$fieldNames,
loginId = _ref.loginId,
loadMore = _ref.loadMore,
isLoading = _ref.isLoading,
hasMore = _ref.hasMore,
msgTypeManage = _ref.msgTypeManage,
reachedTopThreshold = _ref.reachedTopThreshold,
props = _objectWithoutProperties(_ref, ["dataSource", "fieldNames", "loginId", "loadMore", "isLoading", "hasMore", "msgTypeManage", "reachedTopThreshold"]);
var prefixCls = usePrefixCls('chat-panel');
var chatListRef = useRef();
useImperativeHandle(ref, function () {
return {
chatListRearchBottom: chatListRef.current.chatListRearchBottom
};
}, []);
return /*#__PURE__*/React.createElement("div", {
className: classNames(prefixCls)
}, /*#__PURE__*/React.createElement(ChatList, {
dataSource: dataSource,
loginId: loginId,
loadMore: loadMore,
isLoading: isLoading,
hasMore: hasMore,
fieldNames: fieldNames,
msgTypeManage: msgTypeManage,
reachedTopThreshold: reachedTopThreshold,
ref: chatListRef
}), /*#__PURE__*/React.createElement(SendMsg, Object.assign({}, props)));
};
export default /*#__PURE__*/forwardRef(ChatPanel);