(
state: ComponentsState,
payload: {
parentName: string
type: ComponentType
rootParentType?: ComponentType
testId?: string
},
)
| 147 | }) |
| 148 | }, |
| 149 | addComponent( |
| 150 | state: ComponentsState, |
| 151 | payload: { |
| 152 | parentName: string |
| 153 | type: ComponentType |
| 154 | rootParentType?: ComponentType |
| 155 | testId?: string |
| 156 | }, |
| 157 | ): ComponentsState { |
| 158 | return produce(state, (draftState: ComponentsState) => { |
| 159 | const id = payload.testId || generateId() |
| 160 | const { form, ...defaultProps } = DEFAULT_PROPS[payload.type] || {} |
| 161 | draftState.selectedId = id |
| 162 | draftState.components[payload.parentName].children.push(id) |
| 163 | draftState.components[id] = { |
| 164 | id, |
| 165 | props: defaultProps || {}, |
| 166 | children: [], |
| 167 | type: payload.type, |
| 168 | parent: payload.parentName, |
| 169 | rootParentType: payload.rootParentType || payload.type, |
| 170 | } |
| 171 | }) |
| 172 | }, |
| 173 | addMetaComponent( |
| 174 | state: ComponentsState, |
| 175 | payload: { components: IComponents; root: string; parent: string }, |
nothing calls this directly
no test coverage detected