@zat-design/sisyphus-react 3.6.5-beta.5 → 3.6.5-beta.7
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.
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
         | 
| 2 | 
            -
            import { debounce | 
| 2 | 
            +
            import { debounce } from 'lodash';
         | 
| 3 3 | 
             
            import { HOOK_MARK } from 'rc-field-form/es/FieldContext';
         | 
| 4 | 
            +
            import get from 'rc-util/lib/utils/get';
         | 
| 4 5 | 
             
            import warning from 'rc-util/lib/warning';
         | 
| 5 6 | 
             
            import { useState, useEffect, useRef, useMemo } from 'react';
         | 
| 6 7 | 
             
            export function toArray(value) {
         | 
| @@ -419,11 +419,20 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) { | |
| 419 419 | 
             
              }
         | 
| 420 420 | 
             
              var handleChange = function handleChange(newVal, label, extra) {
         | 
| 421 421 | 
             
                // newVal回来得一定是label、value
         | 
| 422 | 
            +
                var _selectList = selectList.map(function (item) {
         | 
| 423 | 
            +
                  var label = item.label;
         | 
| 424 | 
            +
                  var _label = label;
         | 
| 425 | 
            +
                  var regex = /<span class="highlight-search-text">(.*?)<\/span>/g;
         | 
| 426 | 
            +
                  _label = item[label] = label === null || label === void 0 ? void 0 : label.replace(regex, '$1');
         | 
| 427 | 
            +
                  return _objectSpread(_objectSpread({}, item), {}, {
         | 
| 428 | 
            +
                    label: _label
         | 
| 429 | 
            +
                  });
         | 
| 430 | 
            +
                });
         | 
| 422 431 | 
             
                var result = newVal;
         | 
| 423 432 | 
             
                if (props === null || props === void 0 ? void 0 : props.labelInValue) {
         | 
| 424 | 
            -
                  result = getLabelByValue( | 
| 433 | 
            +
                  result = getLabelByValue(_selectList, newVal);
         | 
| 425 434 | 
             
                }
         | 
| 426 | 
            -
                var options = findTreeNode( | 
| 435 | 
            +
                var options = findTreeNode(_selectList, extra === null || extra === void 0 ? void 0 : extra.triggerValue);
         | 
| 427 436 | 
             
                onChange && onChange(result, options, extra);
         | 
| 428 437 | 
             
                // 重置搜索
         | 
| 429 438 | 
             
                showSearch && searchTreeEvent('');
         | 
| @@ -11,6 +11,7 @@ exports.toArray = toArray; | |
| 11 11 | 
             
            var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
         | 
| 12 12 | 
             
            var _lodash = require("lodash");
         | 
| 13 13 | 
             
            var _FieldContext = require("rc-field-form/es/FieldContext");
         | 
| 14 | 
            +
            var _get = _interopRequireDefault(require("rc-util/lib/utils/get"));
         | 
| 14 15 | 
             
            var _warning = _interopRequireDefault(require("rc-util/lib/warning"));
         | 
| 15 16 | 
             
            var _react = require("react");
         | 
| 16 17 | 
             
            function toArray(value) {
         | 
| @@ -62,7 +63,7 @@ function useWatch(dependencies, form, wait) { | |
| 62 63 | 
             
                  registerWatch = _getInternalHooks.registerWatch;
         | 
| 63 64 | 
             
                var callback = function callback(store) {
         | 
| 64 65 | 
             
                  var newValue = namePathsRef.current.map(function (namePath) {
         | 
| 65 | 
            -
                    return (0,  | 
| 66 | 
            +
                    return (0, _get.default)(store, namePath);
         | 
| 66 67 | 
             
                  });
         | 
| 67 68 | 
             
                  var nextValueStr = stringify(newValue);
         | 
| 68 69 | 
             
                  // Compare stringify in case it's nest object
         | 
| @@ -77,7 +78,7 @@ function useWatch(dependencies, form, wait) { | |
| 77 78 | 
             
                }
         | 
| 78 79 | 
             
                var cancelRegister = registerWatch(callback);
         | 
| 79 80 | 
             
                var initialValue = namePathsRef.current.map(function (namePath) {
         | 
| 80 | 
            -
                  return (0,  | 
| 81 | 
            +
                  return (0, _get.default)(getFieldsValue(), namePath);
         | 
| 81 82 | 
             
                });
         | 
| 82 83 | 
             
                setValue(initialValue);
         | 
| 83 84 | 
             
                return cancelRegister;
         | 
| @@ -419,11 +419,20 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) { | |
| 419 419 | 
             
              }
         | 
| 420 420 | 
             
              var handleChange = function handleChange(newVal, label, extra) {
         | 
| 421 421 | 
             
                // newVal回来得一定是label、value
         | 
| 422 | 
            +
                var _selectList = selectList.map(function (item) {
         | 
| 423 | 
            +
                  var label = item.label;
         | 
| 424 | 
            +
                  var _label = label;
         | 
| 425 | 
            +
                  var regex = /<span class="highlight-search-text">(.*?)<\/span>/g;
         | 
| 426 | 
            +
                  _label = item[label] = label === null || label === void 0 ? void 0 : label.replace(regex, '$1');
         | 
| 427 | 
            +
                  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
         | 
| 428 | 
            +
                    label: _label
         | 
| 429 | 
            +
                  });
         | 
| 430 | 
            +
                });
         | 
| 422 431 | 
             
                var result = newVal;
         | 
| 423 432 | 
             
                if (props === null || props === void 0 ? void 0 : props.labelInValue) {
         | 
| 424 | 
            -
                  result = getLabelByValue( | 
| 433 | 
            +
                  result = getLabelByValue(_selectList, newVal);
         | 
| 425 434 | 
             
                }
         | 
| 426 | 
            -
                var options = findTreeNode( | 
| 435 | 
            +
                var options = findTreeNode(_selectList, extra === null || extra === void 0 ? void 0 : extra.triggerValue);
         | 
| 427 436 | 
             
                onChange && onChange(result, options, extra);
         | 
| 428 437 | 
             
                // 重置搜索
         | 
| 429 438 | 
             
                showSearch && searchTreeEvent('');
         |