Merge branch 'master' into update-handlebars-helpers-package
This commit is contained in:
commit
de7e44dbe7
|
@ -6,7 +6,7 @@
|
||||||
import { Helpers } from "@budibase/bbui"
|
import { Helpers } from "@budibase/bbui"
|
||||||
import { derived, writable } from "svelte/store"
|
import { derived, writable } from "svelte/store"
|
||||||
import { Utils } from "@budibase/frontend-core"
|
import { Utils } from "@budibase/frontend-core"
|
||||||
import { cloneDeep } from "lodash"
|
import { cloneDeep, isEqual } from "lodash"
|
||||||
|
|
||||||
export let componentInstance
|
export let componentInstance
|
||||||
export let componentBindings
|
export let componentBindings
|
||||||
|
@ -21,21 +21,32 @@
|
||||||
const currentStep = derived(multiStepStore, state => state.currentStep)
|
const currentStep = derived(multiStepStore, state => state.currentStep)
|
||||||
const componentType = "@budibase/standard-components/multistepformblockstep"
|
const componentType = "@budibase/standard-components/multistepformblockstep"
|
||||||
|
|
||||||
|
let cachedValue
|
||||||
|
let cachedInstance = {}
|
||||||
|
|
||||||
|
$: if (!isEqual(cachedValue, value)) {
|
||||||
|
cachedValue = value
|
||||||
|
}
|
||||||
|
|
||||||
|
$: if (!isEqual(componentInstance, cachedInstance)) {
|
||||||
|
cachedInstance = componentInstance
|
||||||
|
}
|
||||||
|
|
||||||
setContext("multi-step-form-block", multiStepStore)
|
setContext("multi-step-form-block", multiStepStore)
|
||||||
|
|
||||||
$: stepCount = value?.length || 0
|
$: stepCount = cachedValue?.length || 0
|
||||||
$: updateStore(stepCount)
|
$: updateStore(stepCount)
|
||||||
$: dataSource = getDatasourceForProvider($currentAsset, componentInstance)
|
$: dataSource = getDatasourceForProvider($currentAsset, cachedInstance)
|
||||||
$: emitCurrentStep($currentStep)
|
$: emitCurrentStep($currentStep)
|
||||||
$: stepLabel = getStepLabel($multiStepStore)
|
$: stepLabel = getStepLabel($multiStepStore)
|
||||||
$: stepDef = getDefinition(stepLabel)
|
$: stepDef = getDefinition(stepLabel)
|
||||||
$: stepSettings = value?.[$currentStep] || {}
|
$: stepSettings = cachedValue?.[$currentStep] || {}
|
||||||
$: defaults = Utils.buildMultiStepFormBlockDefaultProps({
|
$: defaults = Utils.buildMultiStepFormBlockDefaultProps({
|
||||||
_id: componentInstance._id,
|
_id: cachedInstance._id,
|
||||||
stepCount: $multiStepStore.stepCount,
|
stepCount: $multiStepStore.stepCount,
|
||||||
currentStep: $multiStepStore.currentStep,
|
currentStep: $multiStepStore.currentStep,
|
||||||
actionType: componentInstance.actionType,
|
actionType: cachedInstance.actionType,
|
||||||
dataSource: componentInstance.dataSource,
|
dataSource: cachedInstance.dataSource,
|
||||||
})
|
})
|
||||||
$: stepInstance = {
|
$: stepInstance = {
|
||||||
_id: Helpers.uuid(),
|
_id: Helpers.uuid(),
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
$: definition = store.actions.components.getDefinition(component?._component)
|
$: definition = store.actions.components.getDefinition(component?._component)
|
||||||
$: noPaste = !$store.componentToPaste
|
$: noPaste = !$store.componentToPaste
|
||||||
$: isBlock = definition?.block === true
|
$: isBlock = definition?.block === true
|
||||||
|
$: canEject = !(definition?.ejectable === false)
|
||||||
|
|
||||||
const keyboardEvent = (key, ctrlKey = false) => {
|
const keyboardEvent = (key, ctrlKey = false) => {
|
||||||
document.dispatchEvent(
|
document.dispatchEvent(
|
||||||
|
@ -32,7 +33,7 @@
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
{#if isBlock}
|
{#if isBlock && canEject}
|
||||||
<MenuItem
|
<MenuItem
|
||||||
icon="Export"
|
icon="Export"
|
||||||
keyBind="Ctrl+E"
|
keyBind="Ctrl+E"
|
||||||
|
|
|
@ -32,8 +32,15 @@
|
||||||
await store.actions.components.paste(component, "below")
|
await store.actions.components.paste(component, "below")
|
||||||
},
|
},
|
||||||
["Ctrl+e"]: component => {
|
["Ctrl+e"]: component => {
|
||||||
|
const definition = store.actions.components.getDefinition(
|
||||||
|
component._component
|
||||||
|
)
|
||||||
|
const isBlock = definition?.block === true
|
||||||
|
const canEject = !(definition?.ejectable === false)
|
||||||
|
if (isBlock && canEject) {
|
||||||
componentToEject = component
|
componentToEject = component
|
||||||
confirmEjectDialog.show()
|
confirmEjectDialog.show()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
["Ctrl+Enter"]: () => {
|
["Ctrl+Enter"]: () => {
|
||||||
$goto(`./:componentId/new`)
|
$goto(`./:componentId/new`)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b1c10c2daf808d103724c324256cbff67f33fb46
|
Subproject commit 8c466d6ef2a0c09b843ef63276793ab5af2e96f7
|
Loading…
Reference in New Issue