shineout 3.7.5 → 3.7.6-beta.2

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.
package/cjs/index.js CHANGED
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.7.5'
525
+ version: '3.7.6-beta.2'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12234,7 +12234,7 @@ var handleStyle = function handleStyle(style) {
12234
12234
  };
12235
12235
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12236
12236
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12237
- /* harmony default export */ var version = ('3.7.5');
12237
+ /* harmony default export */ var version = ('3.7.6-beta.2');
12238
12238
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12239
12239
 
12240
12240
 
@@ -27656,6 +27656,7 @@ var textarea_input = objectSpread2_default()(objectSpread2_default()(objectSprea
27656
27656
  color: src.textareaPlaceholderColor
27657
27657
  },
27658
27658
  width: '100%',
27659
+ height: '100%',
27659
27660
  background: 'transparent',
27660
27661
  border: '0',
27661
27662
  margin: '0',
@@ -39991,6 +39992,7 @@ var VirtualList = function VirtualList(props) {
39991
39992
 
39992
39993
 
39993
39994
 
39995
+
39994
39996
  function getHighlightText(_ref) {
39995
39997
  var nodeList = _ref.nodeList,
39996
39998
  searchWords = _ref.searchWords,
@@ -39999,22 +40001,31 @@ function getHighlightText(_ref) {
39999
40001
  if (!enable || !searchWords) {
40000
40002
  return nodeList;
40001
40003
  }
40002
- var transformNode = function transformNode(node) {
40003
- var _node$props;
40004
- if (node && typeof ((_node$props = node.props) === null || _node$props === void 0 ? void 0 : _node$props.children) === 'string') {
40005
- return /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement)(node, undefined, /*#__PURE__*/(0,jsx_runtime.jsx)(HighlightText, {
40006
- textToHighlight: node.props.children,
40004
+
40005
+ // 递归转换节点
40006
+ var transformNode = function transformNode(node, index) {
40007
+ // 如果是合法的 React 元素
40008
+ if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().isValidElement(node) && node.props && node.props.children) {
40009
+ // 对 children 递归调用 getHighlightText 进行转换
40010
+ var transformedChildren = getHighlightText({
40011
+ nodeList: node.props.children,
40007
40012
  searchWords: searchWords,
40008
- highlightClassName: highlightClassName
40009
- }));
40013
+ highlightClassName: highlightClassName,
40014
+ enable: enable
40015
+ });
40016
+ return /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.cloneElement)(node, objectSpread2_default()(objectSpread2_default()({}, node.props), {}, {
40017
+ key: index
40018
+ }), transformedChildren);
40010
40019
  }
40011
- if (node && typeof node === 'string') {
40020
+ // 如果节点为字符串,则直接高亮替换
40021
+ if (typeof node === 'string') {
40012
40022
  return /*#__PURE__*/(0,jsx_runtime.jsx)(HighlightText, {
40013
40023
  textToHighlight: node,
40014
40024
  searchWords: searchWords,
40015
40025
  highlightClassName: highlightClassName
40016
40026
  });
40017
40027
  }
40028
+ // 其他情况直接返回原节点
40018
40029
  return node;
40019
40030
  };
40020
40031
  return isArray(nodeList) ? nodeList.map(transformNode) : transformNode(nodeList);
@@ -40030,8 +40041,7 @@ function HighlightText(_ref2) {
40030
40041
  searchWords = searchWords.slice(0, 500);
40031
40042
  }
40032
40043
 
40033
- // 注意这里的括号,这里使用了带capture group功能的正则,来split字符串
40034
- // 从而在strArr中可以保留匹配文本
40044
+ // capture group 的正则用于 split 保留匹配文本
40035
40045
  var re = new RegExp("(".concat(escapeRegExp(searchWords), ")"), 'i');
40036
40046
  var strArr = textToHighlight.split(re);
40037
40047
  return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
@@ -71659,7 +71669,7 @@ var upload_interface = __webpack_require__(8821);
71659
71669
 
71660
71670
 
71661
71671
  /* harmony default export */ var src_0 = ({
71662
- version: '3.7.5'
71672
+ version: '3.7.6-beta.2'
71663
71673
  });
71664
71674
  }();
71665
71675
  /******/ return __webpack_exports__;