function getMixedSelect()

in src/setter/mixed-setter/index.tsx [36:54]


function getMixedSelect(field) {
  const path = field.path || [];
  if(path.length) {
    const key = `_unsafe_MixedSetter${dash}${path[path.length-1]}${dash}select`
    const newPath = [...path];
    newPath.splice(path.length - 1, 1, key);
    const newKey = field.node.getPropValue(newPath.join('.'))
    if(newKey) return newKey;
    // 兼容下以前的问题情况,如果捕获到,获取 oldUnsafeKey 取值并将其直接置空
    const oldUnsafeKey = `_unsafe_MixedSetter${dash}${path.join(dash)}${dash}select`;
    const oldUsedSetter = field.node.getPropValue(oldUnsafeKey);
    if(oldUsedSetter) {
      field.node.setPropValue(newPath.join('.'), oldUsedSetter);
      field.node.setPropValue(oldUnsafeKey, undefined);
    }
    return oldUsedSetter;
  }
  return undefined;
}