export const showConfigModal=(state,action)=>{
  const res=Object.assign({},state);
  res.visible = true;
  return res;
};

export const closeConfigModal=(state,action)=>{
  const res=Object.assign({},state);
  res.visible = false;
  return res;
};

export const confirmType=(state,action)=>{
  const res=Object.assign({},state);
  const configs = action.confirmType;
  res.mode = configs[0];
  for(let i in configs){
    if(configs[i]!==null&&configs[i]!==undefined){
      res.typeConfig[i] = configs[i];
    }
  }
  //res.typeConfig = Object.assign({},res.typeConfig,action.confirmType);
  return res;
};

export const setReadMode=(state,action)=>{
  const res=Object.assign({},state);
  res.readMode = action.readMode||(action.readConfig&&action.readConfig[0]);
  if(action.readConfig){
    res.readConfig = action.readConfig;
  }
  res.isPreIcss = action.isPreIcss||false
  return res;
};