Fix parent usages
This commit is contained in:
parent
32170a7409
commit
7c6e9644ca
|
@ -230,7 +230,7 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
|
|
||||||
enrichEmptySettings(
|
enrichEmptySettings(
|
||||||
component: Component,
|
component: Component,
|
||||||
opts: { screen?: Screen; parent?: Component; useDefaultValues?: boolean }
|
opts: { screen?: Screen; parent?: string; useDefaultValues?: boolean }
|
||||||
) {
|
) {
|
||||||
if (!component?._component) {
|
if (!component?._component) {
|
||||||
return
|
return
|
||||||
|
@ -238,7 +238,7 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
const defaultDS = this.getDefaultDatasource()
|
const defaultDS = this.getDefaultDatasource()
|
||||||
const settings = this.getComponentSettings(component._component)
|
const settings = this.getComponentSettings(component._component)
|
||||||
const { parent, screen, useDefaultValues } = opts || {}
|
const { parent, screen, useDefaultValues } = opts || {}
|
||||||
const treeId = parent?._id || component._id
|
const treeId = parent || component._id
|
||||||
if (!screen) {
|
if (!screen) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
createInstance(
|
createInstance(
|
||||||
componentType: string,
|
componentType: string,
|
||||||
presetProps?: Record<string, any>,
|
presetProps?: Record<string, any>,
|
||||||
parent?: Component
|
parent?: string
|
||||||
): Component | null {
|
): Component | null {
|
||||||
const screen = get(selectedScreen)
|
const screen = get(selectedScreen)
|
||||||
if (!screen) {
|
if (!screen) {
|
||||||
|
@ -501,7 +501,7 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
async create(
|
async create(
|
||||||
componentType: string,
|
componentType: string,
|
||||||
presetProps?: Record<string, any>,
|
presetProps?: Record<string, any>,
|
||||||
parent?: Component,
|
parent?: string,
|
||||||
index?: number
|
index?: number
|
||||||
) {
|
) {
|
||||||
const state = get(this.store)
|
const state = get(this.store)
|
||||||
|
@ -517,7 +517,7 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
||||||
// Insert in position if specified
|
// Insert in position if specified
|
||||||
if (parent && index != null) {
|
if (parent && index != null) {
|
||||||
await screenStore.patch((screen: Screen) => {
|
await screenStore.patch((screen: Screen) => {
|
||||||
let parentComponent = findComponent(screen.props, parent._id!)!
|
let parentComponent = findComponent(screen.props, parent)!
|
||||||
if (!parentComponent._children?.length) {
|
if (!parentComponent._children?.length) {
|
||||||
parentComponent._children = [componentInstance]
|
parentComponent._children = [componentInstance]
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue