function convertOptions(options, _ref, internalValueField) {
  var fieldValue = _ref.value,
      fieldChildren = _ref.children;

  function injectValue(list) {
    var parentValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
    return (list || []).map(function (option) {
      var _objectSpread2;

      var newValue = option[fieldValue];

      if (parentValue) {
        newValue = connectValue([parentValue, option[fieldValue]]);
      } else if (typeof newValue === 'number') {
        // Since we will convert all the value to string, we need get this
        newValue = String(newValue);
      }

      var cloneOption = _objectSpread(_objectSpread({}, option), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, internalValueField, newValue), _defineProperty(_objectSpread2, "node", option), _objectSpread2));

      if (cloneOption[fieldChildren]) {
        cloneOption[fieldChildren] = injectValue(cloneOption[fieldChildren], newValue);
      }

      return cloneOption;
    });
  }

  return injectValue(options);
}
/**
 * Fill options with fully value by path to avoid nest entity with same value.
 * Which means we need another round to get origin node back!
 * This is slow perf on large list. We should abandon same value in nest in future.
 */
Fill options with fully value by path to avoid nest entity with same value.
Which means we need another round to get origin node back.
This is slow perf on large list. We should abandon same value in nest in future.
Fill options with fully value by path to avoid nest entity with same value . Which means we need another round to get origin node back . This is slow perf on large list . We should abandon same value in nest in future .
function convertOptions(options, _ref, internalValueField) {
  var fieldValue = _ref.value,
      fieldChildren = _ref.children;
  function injectValue(list) {
    var parentValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
    return (list || []).map(function (option) {
      var _objectSpread2;
      var newValue = option[fieldValue];
      if (parentValue) {
        newValue = connectValue([parentValue, option[fieldValue]]);
      } else if (typeof newValue === 'number') {
        newValue = String(newValue);
      }
      var cloneOption = _objectSpread(_objectSpread({}, option), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, internalValueField, newValue), _defineProperty(_objectSpread2, "node", option), _objectSpread2));
      if (cloneOption[fieldChildren]) {
        cloneOption[fieldChildren] = injectValue(cloneOption[fieldChildren], newValue);
      }
      return cloneOption;
    });
  }
  return injectValue(options);
}
function convertOptions ( options , _ref , internalValueField ) { var fieldValue = _ref . value , fieldChildren = _ref . children ; function injectValue ( list ) { var parentValue = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : '' ; return ( list || [ ] ) . map ( function ( option ) { var _objectSpread2 ; var newValue = option [ fieldValue ] ; if ( parentValue ) { newValue = connectValue ( [ parentValue , option [ fieldValue ] ] ) ; } else if ( typeof newValue === 'number' ) { newValue = String ( newValue ) ; } var cloneOption = _objectSpread ( _objectSpread ( { } , option ) , { } , ( _objectSpread2 = { } , _defineProperty ( _objectSpread2 , internalValueField , newValue ) , _defineProperty ( _objectSpread2 , "node" , option ) , _objectSpread2 ) ) ; if ( cloneOption [ fieldChildren ] ) { cloneOption [ fieldChildren ] = injectValue ( cloneOption [ fieldChildren ] , newValue ) ; } return cloneOption ; } ) ; } return injectValue ( options ) ; }
Fill options with fully value by path to avoid nest entity with same value.
Fill options with fully value by path to avoid nest entity with same value .
// Since we will convert all the value to string, we need get this