(updates, config)
| 139 | }; |
| 140 | |
| 141 | const updateObject = (updates, config) => { |
| 142 | Object.keys(updates).forEach(k => { |
| 143 | if (Object.prototype.hasOwnProperty.call(updates, k)) { |
| 144 | const update = updates[k]; |
| 145 | const correspondingConfig = config.value?.find(v => v.name === k); |
| 146 | if (!correspondingConfig) { |
| 147 | config.value = config.value || []; // 确保 config.value 是数组 |
| 148 | config.value.push({ |
| 149 | id: uuidv4(), |
| 150 | name: k, |
| 151 | from: FROM_TYPE.INPUT, |
| 152 | type: getTypeFromUpdates(update), |
| 153 | value: update, |
| 154 | }); |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | // 如果类型是reference,则不进行修改。 |
| 159 | if (String(correspondingConfig.from ?? "").toLowerCase() === FROM_TYPE.REFERENCE.toLowerCase()) { |
| 160 | return; |
| 161 | } |
| 162 | |
| 163 | updateConfig(correspondingConfig, update); |
| 164 | } |
| 165 | }); |
| 166 | }; |
| 167 | |
| 168 | /** |
| 169 | * 获取画布数据. |
no test coverage detected