Renames
This commit is contained in:
parent
2dc3a693a8
commit
4ea8b60b3b
|
@ -452,7 +452,7 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
createInstance(
|
createInstance(
|
||||||
componentName: string,
|
componentType: string,
|
||||||
presetProps: any,
|
presetProps: any,
|
||||||
parent: any
|
parent: any
|
||||||
): Component | null {
|
): Component | null {
|
||||||
|
@ -461,11 +461,13 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
throw "A valid screen must be selected"
|
throw "A valid screen must be selected"
|
||||||
}
|
}
|
||||||
|
|
||||||
const definition = this.getDefinition(componentName)
|
const definition = this.getDefinition(componentType)
|
||||||
if (!definition) {
|
if (!definition) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let componentName = `New ${definition.friendlyName || definition.name}`
|
||||||
|
|
||||||
// Generate basic component structure
|
// Generate basic component structure
|
||||||
let instance: Component = {
|
let instance: Component = {
|
||||||
_id: Helpers.uuid(),
|
_id: Helpers.uuid(),
|
||||||
|
@ -475,7 +477,7 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
hover: {},
|
hover: {},
|
||||||
active: {},
|
active: {},
|
||||||
},
|
},
|
||||||
_instanceName: `New ${definition.friendlyName || definition.name}`,
|
_instanceName: componentName,
|
||||||
...presetProps,
|
...presetProps,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +502,7 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add step name to form steps
|
// Add step name to form steps
|
||||||
if (componentName.endsWith("/formstep")) {
|
if (componentType.endsWith("/formstep")) {
|
||||||
const parentForm = findClosestMatchingComponent(
|
const parentForm = findClosestMatchingComponent(
|
||||||
screen.props,
|
screen.props,
|
||||||
get(selectedComponent)?._id,
|
get(selectedComponent)?._id,
|
||||||
|
@ -529,14 +531,14 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async create(
|
async create(
|
||||||
componentName: string,
|
componentType: string,
|
||||||
presetProps: any,
|
presetProps: any,
|
||||||
parent: Component,
|
parent: Component,
|
||||||
index: number
|
index: number
|
||||||
) {
|
) {
|
||||||
const state = get(this.store)
|
const state = get(this.store)
|
||||||
const componentInstance = this.createInstance(
|
const componentInstance = this.createInstance(
|
||||||
componentName,
|
componentType,
|
||||||
presetProps,
|
presetProps,
|
||||||
parent
|
parent
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue