bhd-components 0.9.22 → 0.9.24

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.
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare const Component: {
3
+ (props: any): React.JSX.Element;
4
+ Search(props: any): React.JSX.Element;
5
+ TextArea(props: any): React.JSX.Element;
6
+ Password: React.ForwardRefExoticComponent<import("antd/es/input").PasswordProps & React.RefAttributes<import("antd").InputRef>>;
7
+ Group: React.FC<import("antd/es/input").GroupProps>;
8
+ };
9
+ export default Component;
@@ -0,0 +1,74 @@
1
+ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
+ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
+ import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
4
+ import { useState, useEffect, useRef } from 'react';
5
+ import { Input } from 'antd';
6
+ import React from 'react';
7
+ function BaseHOC(key) {
8
+ return function(props) {
9
+ const { defaultValue, value, onChange, onPressEnter } = props;
10
+ const hasValue = props.hasOwnProperty('value');
11
+ // 用户切换到底是显示 value 还是 input
12
+ // 不能直接用 isOnComposition 原因是,这个值发生变化不会触发重新渲染
13
+ // 不能只使用 flag 原因是,setFlag 是异步的
14
+ const [flag, setFlag] = useState(false);
15
+ // 非中文输入时候显示 value。中文输入的时候显示 input
16
+ const [input, setInput] = useState(hasValue ? value : defaultValue);
17
+ useEffect(function() {
18
+ if (hasValue && input !== value) {
19
+ setInput(value);
20
+ }
21
+ }, [
22
+ value
23
+ ]);
24
+ const isOnCompositionRef = useRef(false);
25
+ function handleChange(e) {
26
+ setInput(e.target.value);
27
+ if (isOnCompositionRef.current) return;
28
+ onChange && onChange(e);
29
+ }
30
+ function handleComposition(e) {
31
+ console.log("e.type", e.type);
32
+ if ('compositionend' === e.type) {
33
+ isOnCompositionRef.current = false;
34
+ handleChange(e);
35
+ } else {
36
+ isOnCompositionRef.current = true;
37
+ }
38
+ if (flag !== isOnCompositionRef.current) {
39
+ setFlag(isOnCompositionRef.current);
40
+ }
41
+ }
42
+ let Component = Input;
43
+ if (key) {
44
+ //@ts-ignore
45
+ Component = Input[key];
46
+ }
47
+ function handlePressEnter(e) {
48
+ console.log("isOnCompositionisOnComposition", isOnCompositionRef.current);
49
+ setInput(e.target.value);
50
+ if (isOnCompositionRef.current) return;
51
+ onPressEnter && onPressEnter(e);
52
+ }
53
+ return /*#__PURE__*/ _jsx(Component, _object_spread_props(_object_spread({}, props), {
54
+ value: hasValue && !flag ? value : input,
55
+ onCompositionStart: handleComposition,
56
+ onCompositionUpdate: handleComposition,
57
+ onCompositionEnd: handleComposition,
58
+ onChange: handleChange,
59
+ onPressEnter: handlePressEnter
60
+ }));
61
+ };
62
+ }
63
+ const Component = function(props) {
64
+ return BaseHOC()(props);
65
+ };
66
+ Component.Search = function(props) {
67
+ return BaseHOC('Search')(props);
68
+ };
69
+ Component.TextArea = function(props) {
70
+ return BaseHOC('TextArea')(props);
71
+ };
72
+ Component.Password = Input.Password;
73
+ Component.Group = Input.Group;
74
+ export default Component;
@@ -49,7 +49,7 @@ const BhdSelect = (props)=>{
49
49
  let list = [];
50
50
  list = children.filter((item)=>{
51
51
  if (props.filterOption == undefined) {
52
- return item.props[search_label].includes(filterValue);
52
+ return item.props[search_label] ? String(item.props[search_label]).includes(filterValue) : false;
53
53
  } else {
54
54
  if (typeof props.filterOption === "function") {
55
55
  return props.filterOption(filterValue, item);
@@ -2,12 +2,13 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
3
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
4
4
  import React, { useEffect, useState, useRef } from "react";
5
- import { Modal, Drawer, Input, Tooltip } from "antd";
5
+ import { Modal, Drawer, Tooltip } from "antd";
6
6
  import message from '../message';
7
7
  import ViewImage from "../viewImage";
8
8
  // import html2canvas from "html2canvas";
9
9
  import cssStyle from "./index.module.less";
10
10
  import cssStyleOnline from "./index2.module.less";
11
+ import Input from "../bhdEnterInput";
11
12
  let styles = cssStyle;
12
13
  if (false) {
13
14
  styles = cssStyleOnline;
@@ -400,16 +401,29 @@ const CustomerService = (props)=>{
400
401
  getHistoryMessage(pageNum, 1);
401
402
  }
402
403
  }
404
+ // //复制代码功能
405
+ // let chat_content = document.getElementById('chat_content');
406
+ // if(chat_content){
407
+ // chat_content = document.getElementById('chat_content');
408
+ // delegate(chat_content, 'click', `.${styles.copyCode}`, (event:any, target:any) => {
409
+ // findCopyContent(event);
410
+ // });
411
+ // }
412
+ }, [
413
+ roomId
414
+ ]);
415
+ useEffect(()=>{
403
416
  //复制代码功能
404
- let chat_content = document.getElementById('chat_content');
417
+ let chat_content = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
405
418
  if (chat_content) {
406
- chat_content = document.getElementById('chat_content');
419
+ chat_content = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
407
420
  delegate(chat_content, 'click', `.${styles.copyCode}`, (event, target)=>{
408
421
  findCopyContent(event);
409
422
  });
410
423
  }
411
424
  }, [
412
- roomId
425
+ roomId,
426
+ showType
413
427
  ]);
414
428
  //进入页面,发送打招呼信息
415
429
  useEffect(()=>{
package/es2017/index.d.ts CHANGED
@@ -81,3 +81,4 @@ export { default as BhdSelect } from "./bhdSelect";
81
81
  export { default as BhdAppLayout } from "./bhdAppLayout";
82
82
  export { default as CustomerService } from "./customerService";
83
83
  export { default as BhdDatePicker } from "./bhdDatePicker";
84
+ export { default as BhdEnterInput } from "./bhdEnterInput";
package/es2017/index.js CHANGED
@@ -86,3 +86,4 @@ export { default as BhdSelect } from "./bhdSelect"; //封装 bhdSelect
86
86
  export { default as BhdAppLayout } from "./bhdAppLayout"; //封装 BhdAppLayout
87
87
  export { default as CustomerService } from "./customerService"; //封装 智能客服
88
88
  export { default as BhdDatePicker } from "./bhdDatePicker"; //封装 日历组件
89
+ export { default as BhdEnterInput } from "./bhdEnterInput"; //封装 Input
@@ -438,7 +438,8 @@ class ViewImage extends React.Component {
438
438
  });
439
439
  _define_property(this, "imgErr", ()=>{
440
440
  this.setState({
441
- imgError: true
441
+ imgError: true,
442
+ actionCloseFlag: 1 //报错时关闭按钮固定右上角
442
443
  }, ()=>{
443
444
  this.moveActionClose();
444
445
  });
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare const Component: {
3
+ (props: any): React.JSX.Element;
4
+ Search(props: any): React.JSX.Element;
5
+ TextArea(props: any): React.JSX.Element;
6
+ Password: React.ForwardRefExoticComponent<import("antd/es/input").PasswordProps & React.RefAttributes<import("antd").InputRef>>;
7
+ Group: React.FC<import("antd/es/input").GroupProps>;
8
+ };
9
+ export default Component;
@@ -0,0 +1,75 @@
1
+ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
+ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
+ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
+ import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
5
+ import { useState, useEffect, useRef } from "react";
6
+ import { Input } from "antd";
7
+ import React from "react";
8
+ function BaseHOC(key) {
9
+ return function(props) {
10
+ var handleChange = function handleChange(e) {
11
+ setInput(e.target.value);
12
+ if (isOnCompositionRef.current) return;
13
+ onChange && onChange(e);
14
+ };
15
+ var handleComposition = function handleComposition(e) {
16
+ console.log("e.type", e.type);
17
+ if ("compositionend" === e.type) {
18
+ isOnCompositionRef.current = false;
19
+ handleChange(e);
20
+ } else {
21
+ isOnCompositionRef.current = true;
22
+ }
23
+ if (flag !== isOnCompositionRef.current) {
24
+ setFlag(isOnCompositionRef.current);
25
+ }
26
+ };
27
+ var handlePressEnter = function handlePressEnter(e) {
28
+ console.log("isOnCompositionisOnComposition", isOnCompositionRef.current);
29
+ setInput(e.target.value);
30
+ if (isOnCompositionRef.current) return;
31
+ onPressEnter && onPressEnter(e);
32
+ };
33
+ var defaultValue = props.defaultValue, value = props.value, onChange = props.onChange, onPressEnter = props.onPressEnter;
34
+ var hasValue = props.hasOwnProperty("value");
35
+ // 用户切换到底是显示 value 还是 input
36
+ // 不能直接用 isOnComposition 原因是,这个值发生变化不会触发重新渲染
37
+ // 不能只使用 flag 原因是,setFlag 是异步的
38
+ var _useState = _sliced_to_array(useState(false), 2), flag = _useState[0], setFlag = _useState[1];
39
+ // 非中文输入时候显示 value。中文输入的时候显示 input
40
+ var _useState1 = _sliced_to_array(useState(hasValue ? value : defaultValue), 2), input = _useState1[0], setInput = _useState1[1];
41
+ useEffect(function() {
42
+ if (hasValue && input !== value) {
43
+ setInput(value);
44
+ }
45
+ }, [
46
+ value
47
+ ]);
48
+ var isOnCompositionRef = useRef(false);
49
+ var Component = Input;
50
+ if (key) {
51
+ //@ts-ignore
52
+ Component = Input[key];
53
+ }
54
+ return /*#__PURE__*/ _jsx(Component, _object_spread_props(_object_spread({}, props), {
55
+ value: hasValue && !flag ? value : input,
56
+ onCompositionStart: handleComposition,
57
+ onCompositionUpdate: handleComposition,
58
+ onCompositionEnd: handleComposition,
59
+ onChange: handleChange,
60
+ onPressEnter: handlePressEnter
61
+ }));
62
+ };
63
+ }
64
+ var Component = function Component(props) {
65
+ return BaseHOC()(props);
66
+ };
67
+ Component.Search = function(props) {
68
+ return BaseHOC("Search")(props);
69
+ };
70
+ Component.TextArea = function(props) {
71
+ return BaseHOC("TextArea")(props);
72
+ };
73
+ Component.Password = Input.Password;
74
+ Component.Group = Input.Group;
75
+ export default Component;
@@ -52,7 +52,7 @@ var BhdSelect = function(props) {
52
52
  var list = [];
53
53
  list = children.filter(function(item) {
54
54
  if (props.filterOption == undefined) {
55
- return item.props[search_label].includes(filterValue);
55
+ return item.props[search_label] ? String(item.props[search_label]).includes(filterValue) : false;
56
56
  } else {
57
57
  if (typeof props.filterOption === "function") {
58
58
  return props.filterOption(filterValue, item);
@@ -6,12 +6,13 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
6
6
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
7
7
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
8
8
  import React, { useEffect, useState, useRef } from "react";
9
- import { Modal, Drawer, Input, Tooltip } from "antd";
9
+ import { Modal, Drawer, Tooltip } from "antd";
10
10
  import message from "../message";
11
11
  import ViewImage from "../viewImage";
12
12
  // import html2canvas from "html2canvas";
13
13
  import cssStyle from "./index.module.less";
14
14
  import cssStyleOnline from "./index2.module.less";
15
+ import Input from "../bhdEnterInput";
15
16
  var styles = cssStyle;
16
17
  if (false) {
17
18
  styles = cssStyleOnline;
@@ -405,16 +406,29 @@ var CustomerService = function(props) {
405
406
  getHistoryMessage(pageNum, 1);
406
407
  }
407
408
  }
409
+ // //复制代码功能
410
+ // let chat_content = document.getElementById('chat_content');
411
+ // if(chat_content){
412
+ // chat_content = document.getElementById('chat_content');
413
+ // delegate(chat_content, 'click', `.${styles.copyCode}`, (event:any, target:any) => {
414
+ // findCopyContent(event);
415
+ // });
416
+ // }
417
+ }, [
418
+ roomId
419
+ ]);
420
+ useEffect(function() {
408
421
  //复制代码功能
409
- var chat_content = document.getElementById("chat_content");
422
+ var chat_content = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
410
423
  if (chat_content) {
411
- chat_content = document.getElementById("chat_content");
424
+ chat_content = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
412
425
  delegate(chat_content, "click", ".".concat(styles.copyCode), function(event, target) {
413
426
  findCopyContent(event);
414
427
  });
415
428
  }
416
429
  }, [
417
- roomId
430
+ roomId,
431
+ showType
418
432
  ]);
419
433
  //进入页面,发送打招呼信息
420
434
  useEffect(function() {
package/esm/index.d.ts CHANGED
@@ -81,3 +81,4 @@ export { default as BhdSelect } from "./bhdSelect";
81
81
  export { default as BhdAppLayout } from "./bhdAppLayout";
82
82
  export { default as CustomerService } from "./customerService";
83
83
  export { default as BhdDatePicker } from "./bhdDatePicker";
84
+ export { default as BhdEnterInput } from "./bhdEnterInput";
package/esm/index.js CHANGED
@@ -86,3 +86,4 @@ export { default as BhdSelect } from "./bhdSelect"; //封装 bhdSelect
86
86
  export { default as BhdAppLayout } from "./bhdAppLayout"; //封装 BhdAppLayout
87
87
  export { default as CustomerService } from "./customerService"; //封装 智能客服
88
88
  export { default as BhdDatePicker } from "./bhdDatePicker"; //封装 日历组件
89
+ export { default as BhdEnterInput } from "./bhdEnterInput"; //封装 Input
@@ -340,7 +340,8 @@ var ViewImage = /*#__PURE__*/ function(_React_Component) {
340
340
  });
341
341
  _define_property(_assert_this_initialized(_this), "imgErr", function() {
342
342
  _this.setState({
343
- imgError: true
343
+ imgError: true,
344
+ actionCloseFlag: 1 //报错时关闭按钮固定右上角
344
345
  }, function() {
345
346
  _this.moveActionClose();
346
347
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.9.22",
3
+ "version": "0.9.24",
4
4
  "description": "组件功能描述",
5
5
  "config": {
6
6
  "commitizen": {