bhd-components 0.10.13 → 0.10.15

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.
@@ -135,6 +135,7 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
135
135
  },
136
136
  clickFn: ()=>{
137
137
  if (textValue.trim().length === 0) return;
138
+ if (!canSendMsg) return;
138
139
  sendMsg(textValue);
139
140
  }
140
141
  });
@@ -187,14 +188,17 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
187
188
  // 如果只按了 Enter,则阻止默认行为并发送消息
188
189
  e.preventDefault();
189
190
  // 在这里添加发送消息的逻辑
191
+ if (!canSendMsg) return;
190
192
  sendMsg(textValue);
191
193
  }
192
194
  };
193
195
  // 发现消息
194
196
  const sendMsg = (value)=>{
195
- if (value.trim().length === 0) return;
196
- if (!canSendMsg) return;
197
197
  console.log("发送消息:", value);
198
+ if (value.trim().length === 0) {
199
+ throw new Error("消息不能为空");
200
+ return;
201
+ }
198
202
  apiRef.contentApi.addMsg({
199
203
  id: guidGenerator(),
200
204
  createTime: new Date().getTime(),
@@ -46,7 +46,7 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
46
46
  const { getList, coverRenderText, msgAction = [
47
47
  "copy",
48
48
  "reference"
49
- ], coverRenderReferences, onRecordMessage = ()=>{}, onVoteChange = ()=>{}, onRefresh = ()=>{}, helloMsg, fileCustomRender = {} } = contentConfig;
49
+ ], coverRenderReferences, onRecordMessage = ()=>{}, onVoteChange = ()=>{}, onRefresh = ()=>{}, helloMsg, fileCustomRender = {}, onSendedHelloMsg = ()=>{} } = contentConfig;
50
50
  const loadMoreProps = contentConfig.loadMore || true;
51
51
  const virtuosoRef = useRef(null);
52
52
  const [loading, setLoading] = useState(false); // 是否加载中
@@ -127,6 +127,7 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
127
127
  source: null,
128
128
  fileList: []
129
129
  });
130
+ onSendedHelloMsg();
130
131
  }
131
132
  });
132
133
  let removeFn = delegate(wrapperRef.current, "click", `.${styles.copyCode}`, (event, target)=>{
@@ -68,6 +68,7 @@ export interface contentConfigProps {
68
68
  fileBottomRender?: (item: dataItemType) => React.ReactNode;
69
69
  fileRender?: (item: dataItemType) => React.ReactNode;
70
70
  };
71
+ onSendedHelloMsg?:()=>void;//发送招呼语之后
71
72
  }
72
73
 
73
74
  // content props
@@ -139,6 +139,7 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
139
139
  },
140
140
  clickFn: function() {
141
141
  if (textValue.trim().length === 0) return;
142
+ if (!canSendMsg) return;
142
143
  sendMsg(textValue);
143
144
  }
144
145
  });
@@ -191,14 +192,17 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
191
192
  // 如果只按了 Enter,则阻止默认行为并发送消息
192
193
  e.preventDefault();
193
194
  // 在这里添加发送消息的逻辑
195
+ if (!canSendMsg) return;
194
196
  sendMsg(textValue);
195
197
  }
196
198
  };
197
199
  // 发现消息
198
200
  var sendMsg = function(value) {
199
- if (value.trim().length === 0) return;
200
- if (!canSendMsg) return;
201
201
  console.log("发送消息:", value);
202
+ if (value.trim().length === 0) {
203
+ throw new Error("消息不能为空");
204
+ return;
205
+ }
202
206
  apiRef.contentApi.addMsg({
203
207
  id: guidGenerator(),
204
208
  createTime: new Date().getTime(),
@@ -50,7 +50,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
50
50
  var getList = contentConfig.getList, coverRenderText = contentConfig.coverRenderText, _contentConfig_msgAction = contentConfig.msgAction, msgAction = _contentConfig_msgAction === void 0 ? [
51
51
  "copy",
52
52
  "reference"
53
- ] : _contentConfig_msgAction, coverRenderReferences = contentConfig.coverRenderReferences, _contentConfig_onRecordMessage = contentConfig.onRecordMessage, onRecordMessage = _contentConfig_onRecordMessage === void 0 ? function() {} : _contentConfig_onRecordMessage, _contentConfig_onVoteChange = contentConfig.onVoteChange, onVoteChange = _contentConfig_onVoteChange === void 0 ? function() {} : _contentConfig_onVoteChange, _contentConfig_onRefresh = contentConfig.onRefresh, onRefresh = _contentConfig_onRefresh === void 0 ? function() {} : _contentConfig_onRefresh, helloMsg = contentConfig.helloMsg, _contentConfig_fileCustomRender = contentConfig.fileCustomRender, fileCustomRender = _contentConfig_fileCustomRender === void 0 ? {} : _contentConfig_fileCustomRender;
53
+ ] : _contentConfig_msgAction, coverRenderReferences = contentConfig.coverRenderReferences, _contentConfig_onRecordMessage = contentConfig.onRecordMessage, onRecordMessage = _contentConfig_onRecordMessage === void 0 ? function() {} : _contentConfig_onRecordMessage, _contentConfig_onVoteChange = contentConfig.onVoteChange, onVoteChange = _contentConfig_onVoteChange === void 0 ? function() {} : _contentConfig_onVoteChange, _contentConfig_onRefresh = contentConfig.onRefresh, onRefresh = _contentConfig_onRefresh === void 0 ? function() {} : _contentConfig_onRefresh, helloMsg = contentConfig.helloMsg, _contentConfig_fileCustomRender = contentConfig.fileCustomRender, fileCustomRender = _contentConfig_fileCustomRender === void 0 ? {} : _contentConfig_fileCustomRender, _contentConfig_onSendedHelloMsg = contentConfig.onSendedHelloMsg, onSendedHelloMsg = _contentConfig_onSendedHelloMsg === void 0 ? function() {} : _contentConfig_onSendedHelloMsg;
54
54
  var loadMoreProps = contentConfig.loadMore || true;
55
55
  var virtuosoRef = useRef(null);
56
56
  var _useState = _sliced_to_array(useState(false), 2), loading = _useState[0], setLoading = _useState[1]; // 是否加载中
@@ -133,6 +133,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
133
133
  source: null,
134
134
  fileList: []
135
135
  });
136
+ onSendedHelloMsg();
136
137
  }
137
138
  });
138
139
  var removeFn = delegate(wrapperRef.current, "click", ".".concat(styles.copyCode), function(event, target) {
@@ -68,6 +68,7 @@ export interface contentConfigProps {
68
68
  fileBottomRender?: (item: dataItemType) => React.ReactNode;
69
69
  fileRender?: (item: dataItemType) => React.ReactNode;
70
70
  };
71
+ onSendedHelloMsg?:()=>void;//发送招呼语之后
71
72
  }
72
73
 
73
74
  // content props
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.10.13",
3
+ "version": "0.10.15",
4
4
  "description": "组件功能描述",
5
5
  "config": {
6
6
  "commitizen": {