Format with prettier
This commit is contained in:
parent
a93757a8d9
commit
add4162000
|
@ -31,7 +31,9 @@ Cypress.Commands.add("createApp", name => {
|
||||||
.then($body => {
|
.then($body => {
|
||||||
if ($body.find("input[name=apiKey]").length) {
|
if ($body.find("input[name=apiKey]").length) {
|
||||||
// input was found, do something else here
|
// input was found, do something else here
|
||||||
cy.get("input[name=apiKey]").type(name).should("have.value", name)
|
cy.get("input[name=apiKey]")
|
||||||
|
.type(name)
|
||||||
|
.should("have.value", name)
|
||||||
cy.contains("Next").click()
|
cy.contains("Next").click()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -42,8 +44,12 @@ Cypress.Commands.add("createApp", name => {
|
||||||
|
|
||||||
cy.contains("Next").click()
|
cy.contains("Next").click()
|
||||||
|
|
||||||
cy.get("input[name=username]").click().type("test")
|
cy.get("input[name=username]")
|
||||||
cy.get("input[name=password]").click().type("test")
|
.click()
|
||||||
|
.type("test")
|
||||||
|
cy.get("input[name=password]")
|
||||||
|
.click()
|
||||||
|
.type("test")
|
||||||
cy.contains("Submit").click()
|
cy.contains("Submit").click()
|
||||||
cy.get("[data-cy=new-table]", {
|
cy.get("[data-cy=new-table]", {
|
||||||
timeout: 20000,
|
timeout: 20000,
|
||||||
|
@ -61,8 +67,12 @@ Cypress.Commands.add("createTable", tableName => {
|
||||||
// Enter table name
|
// Enter table name
|
||||||
cy.get("[data-cy=new-table]").click()
|
cy.get("[data-cy=new-table]").click()
|
||||||
cy.get(".modal").within(() => {
|
cy.get(".modal").within(() => {
|
||||||
cy.get("input").first().type(tableName)
|
cy.get("input")
|
||||||
cy.get(".buttons").contains("Create").click()
|
.first()
|
||||||
|
.type(tableName)
|
||||||
|
cy.get(".buttons")
|
||||||
|
.contains("Create")
|
||||||
|
.click()
|
||||||
})
|
})
|
||||||
cy.contains(tableName).should("be.visible")
|
cy.contains(tableName).should("be.visible")
|
||||||
})
|
})
|
||||||
|
@ -74,7 +84,9 @@ Cypress.Commands.add("addColumn", (tableName, columnName, type) => {
|
||||||
|
|
||||||
// Configure column
|
// Configure column
|
||||||
cy.get(".menu-container").within(() => {
|
cy.get(".menu-container").within(() => {
|
||||||
cy.get("input").first().type(columnName)
|
cy.get("input")
|
||||||
|
.first()
|
||||||
|
.type(columnName)
|
||||||
// Unset table display column
|
// Unset table display column
|
||||||
cy.contains("display column").click()
|
cy.contains("display column").click()
|
||||||
cy.get("select").select(type)
|
cy.get("select").select(type)
|
||||||
|
@ -87,11 +99,15 @@ Cypress.Commands.add("addRow", values => {
|
||||||
|
|
||||||
cy.get(".modal").within(() => {
|
cy.get(".modal").within(() => {
|
||||||
for (let i = 0; i < values.length; i++) {
|
for (let i = 0; i < values.length; i++) {
|
||||||
cy.get("input").eq(i).type(values[i])
|
cy.get("input")
|
||||||
|
.eq(i)
|
||||||
|
.type(values[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
cy.get(".buttons").contains("Create").click()
|
cy.get(".buttons")
|
||||||
|
.contains("Create")
|
||||||
|
.click()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -100,12 +116,20 @@ Cypress.Commands.add("createUser", (username, password, accessLevel) => {
|
||||||
cy.get(".toprightnav > .settings").click()
|
cy.get(".toprightnav > .settings").click()
|
||||||
cy.contains("Users").click()
|
cy.contains("Users").click()
|
||||||
|
|
||||||
cy.get("[name=Name]").first().type(username)
|
cy.get("[name=Name]")
|
||||||
cy.get("[name=Password]").first().type(password)
|
.first()
|
||||||
cy.get("select").first().select(accessLevel)
|
.type(username)
|
||||||
|
cy.get("[name=Password]")
|
||||||
|
.first()
|
||||||
|
.type(password)
|
||||||
|
cy.get("select")
|
||||||
|
.first()
|
||||||
|
.select(accessLevel)
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
cy.get(".inputs").contains("Create").click()
|
cy.get(".inputs")
|
||||||
|
.contains("Create")
|
||||||
|
.click()
|
||||||
})
|
})
|
||||||
|
|
||||||
Cypress.Commands.add("addHeadlineComponent", text => {
|
Cypress.Commands.add("addHeadlineComponent", text => {
|
||||||
|
@ -131,9 +155,13 @@ Cypress.Commands.add("navigateToFrontend", () => {
|
||||||
Cypress.Commands.add("createScreen", (screenName, route) => {
|
Cypress.Commands.add("createScreen", (screenName, route) => {
|
||||||
cy.get("[data-cy=new-screen]").click()
|
cy.get("[data-cy=new-screen]").click()
|
||||||
cy.get(".modal").within(() => {
|
cy.get(".modal").within(() => {
|
||||||
cy.get("input").eq(0).type(screenName)
|
cy.get("input")
|
||||||
|
.eq(0)
|
||||||
|
.type(screenName)
|
||||||
if (route) {
|
if (route) {
|
||||||
cy.get("input").eq(1).type(route)
|
cy.get("input")
|
||||||
|
.eq(1)
|
||||||
|
.type(route)
|
||||||
}
|
}
|
||||||
cy.contains("Create Screen").click()
|
cy.contains("Create Screen").click()
|
||||||
})
|
})
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
$: automationCount = $automationStore.automations?.length ?? 0
|
$: automationCount = $automationStore.automations?.length ?? 0
|
||||||
|
|
||||||
function onSelect(block) {
|
function onSelect(block) {
|
||||||
automationStore.update((state) => {
|
automationStore.update(state => {
|
||||||
state.selectedBlock = block
|
state.selectedBlock = block
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
let popover
|
let popover
|
||||||
$: selectedTab = selectedIndex == null ? null : tabs[selectedIndex].value
|
$: selectedTab = selectedIndex == null ? null : tabs[selectedIndex].value
|
||||||
$: anchor = selectedIndex === -1 ? null : anchors[selectedIndex]
|
$: anchor = selectedIndex === -1 ? null : anchors[selectedIndex]
|
||||||
$: blocks = sortBy((entry) => entry[1].name)(
|
$: blocks = sortBy(entry => entry[1].name)(
|
||||||
Object.entries($automationStore.blockDefinitions[selectedTab] ?? {})
|
Object.entries($automationStore.blockDefinitions[selectedTab] ?? {})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
$: selected = $automationStore.selectedBlock?.id === block.id
|
$: selected = $automationStore.selectedBlock?.id === block.id
|
||||||
$: steps =
|
$: steps =
|
||||||
$automationStore.selectedAutomation?.automation?.definition?.steps ?? []
|
$automationStore.selectedAutomation?.automation?.definition?.steps ?? []
|
||||||
$: blockIdx = steps.findIndex((step) => step.id === block.id)
|
$: blockIdx = steps.findIndex(step => step.id === block.id)
|
||||||
$: allowDeleteTrigger = !steps.length
|
$: allowDeleteTrigger = !steps.length
|
||||||
|
|
||||||
function deleteStep() {
|
function deleteStep() {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
if (automation.trigger) {
|
if (automation.trigger) {
|
||||||
allSteps = [automation.trigger, ...allSteps]
|
allSteps = [automation.trigger, ...allSteps]
|
||||||
}
|
}
|
||||||
const blockIdx = allSteps.findIndex((step) => step.id === block.id)
|
const blockIdx = allSteps.findIndex(step => step.id === block.id)
|
||||||
|
|
||||||
// Extract all outputs from all previous steps as available bindings
|
// Extract all outputs from all previous steps as available bindings
|
||||||
let bindings = []
|
let bindings = []
|
||||||
|
|
|
@ -6,9 +6,7 @@
|
||||||
export let value
|
export let value
|
||||||
export let bindings
|
export let bindings
|
||||||
|
|
||||||
$: table = $backendUiStore.tables.find(
|
$: table = $backendUiStore.tables.find(table => table._id === value?.tableId)
|
||||||
(table) => table._id === value?.tableId
|
|
||||||
)
|
|
||||||
$: schemaFields = Object.entries(table?.schema ?? {})
|
$: schemaFields = Object.entries(table?.schema ?? {})
|
||||||
|
|
||||||
// Ensure any nullish tableId values get set to empty string so
|
// Ensure any nullish tableId values get set to empty string so
|
||||||
|
|
|
@ -22,12 +22,12 @@
|
||||||
$backendUiStore.selectedTable.primaryDisplay == null ||
|
$backendUiStore.selectedTable.primaryDisplay == null ||
|
||||||
$backendUiStore.selectedTable.primaryDisplay === field.name
|
$backendUiStore.selectedTable.primaryDisplay === field.name
|
||||||
$: tableOptions = $backendUiStore.tables.filter(
|
$: tableOptions = $backendUiStore.tables.filter(
|
||||||
(table) => table._id !== $backendUiStore.draftTable._id
|
table => table._id !== $backendUiStore.draftTable._id
|
||||||
)
|
)
|
||||||
$: required = !!field?.constraints?.presence || primaryDisplay
|
$: required = !!field?.constraints?.presence || primaryDisplay
|
||||||
|
|
||||||
async function saveColumn() {
|
async function saveColumn() {
|
||||||
backendUiStore.update((state) => {
|
backendUiStore.update(state => {
|
||||||
backendUiStore.actions.tables.saveField({
|
backendUiStore.actions.tables.saveField({
|
||||||
originalName,
|
originalName,
|
||||||
field,
|
field,
|
||||||
|
|
|
@ -69,9 +69,8 @@
|
||||||
const fileArray = Array.from(evt.target.files)
|
const fileArray = Array.from(evt.target.files)
|
||||||
if (fileArray.some(file => file.size >= FILE_SIZE_LIMIT)) {
|
if (fileArray.some(file => file.size >= FILE_SIZE_LIMIT)) {
|
||||||
notifier.danger(
|
notifier.danger(
|
||||||
`Files cannot exceed ${
|
`Files cannot exceed ${FILE_SIZE_LIMIT /
|
||||||
FILE_SIZE_LIMIT / BYTES_IN_MB
|
BYTES_IN_MB}MB. Please try again with smaller files.`
|
||||||
}MB. Please try again with smaller files.`
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
function checkValid(evt) {
|
function checkValid(evt) {
|
||||||
const tableName = evt.target.value
|
const tableName = evt.target.value
|
||||||
if ($backendUiStore.models?.some((model) => model.name === tableName)) {
|
if ($backendUiStore.models?.some(model => model.name === tableName)) {
|
||||||
error = `Table with name ${tableName} already exists. Please choose another name.`
|
error = `Table with name ${tableName} already exists. Please choose another name.`
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@
|
||||||
|
|
||||||
// Create auto screens
|
// Create auto screens
|
||||||
const screens = screenTemplates($store, [table])
|
const screens = screenTemplates($store, [table])
|
||||||
.filter((template) => defaultScreens.includes(template.id))
|
.filter(template => defaultScreens.includes(template.id))
|
||||||
.map((template) => template.create())
|
.map(template => template.create())
|
||||||
for (let screen of screens) {
|
for (let screen of screens) {
|
||||||
// Record the table that created this screen so we can link it later
|
// Record the table that created this screen so we can link it later
|
||||||
screen.autoTableId = table._id
|
screen.autoTableId = table._id
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create autolink to newly created list page
|
// Create autolink to newly created list page
|
||||||
const listPage = screens.find((screen) =>
|
const listPage = screens.find(screen =>
|
||||||
screen.props._instanceName.endsWith("List")
|
screen.props._instanceName.endsWith("List")
|
||||||
)
|
)
|
||||||
await store.createLink(listPage.route, table.name)
|
await store.createLink(listPage.route, table.name)
|
||||||
|
|
|
@ -9,9 +9,8 @@
|
||||||
|
|
||||||
function handleFileTooLarge(fileSizeLimit) {
|
function handleFileTooLarge(fileSizeLimit) {
|
||||||
notifier.danger(
|
notifier.danger(
|
||||||
`Files cannot exceed ${
|
`Files cannot exceed ${fileSizeLimit /
|
||||||
fileSizeLimit / BYTES_IN_MB
|
BYTES_IN_MB}MB. Please try again with smaller files.`
|
||||||
}MB. Please try again with smaller files.`
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
let isApiKeyValid
|
let isApiKeyValid
|
||||||
let lastApiKey
|
let lastApiKey
|
||||||
let fetchApiKeyPromise
|
let fetchApiKeyPromise
|
||||||
const validateApiKey = async (apiKey) => {
|
const validateApiKey = async apiKey => {
|
||||||
if (!apiKey) return false
|
if (!apiKey) return false
|
||||||
|
|
||||||
// make sure we only fetch once, unless API Key is changed
|
// make sure we only fetch once, unless API Key is changed
|
||||||
|
@ -121,7 +121,9 @@
|
||||||
const fullSchema = Object.assign({}, ...validationSchemas)
|
const fullSchema = Object.assign({}, ...validationSchemas)
|
||||||
|
|
||||||
// Check full form schema
|
// Check full form schema
|
||||||
const formIsValid = await object().shape(fullSchema).isValid(values)
|
const formIsValid = await object()
|
||||||
|
.shape(fullSchema)
|
||||||
|
.isValid(values)
|
||||||
fullFormIsValid = formIsValid
|
fullFormIsValid = formIsValid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
return props
|
return props
|
||||||
}
|
}
|
||||||
|
|
||||||
const getComponentTypeName = (component) => {
|
const getComponentTypeName = component => {
|
||||||
let [componentName] = component._component.match(/[a-z]*$/)
|
let [componentName] = component._component.match(/[a-z]*$/)
|
||||||
return componentName || "element"
|
return componentName || "element"
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$: stylesheetLinks = pipe($store.pages.stylesheets, [
|
$: stylesheetLinks = pipe($store.pages.stylesheets, [
|
||||||
map((s) => `<link rel="stylesheet" href="${s}"/>`),
|
map(s => `<link rel="stylesheet" href="${s}"/>`),
|
||||||
join("\n"),
|
join("\n"),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
export let categories = []
|
export let categories = []
|
||||||
export let selectedCategory = {}
|
export let selectedCategory = {}
|
||||||
export let onClick = (category) => {}
|
export let onClick = category => {}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
|
|
|
@ -18,27 +18,27 @@
|
||||||
!component || !getComponentDefinition($store, component._component).children
|
!component || !getComponentDefinition($store, component._component).children
|
||||||
$: noPaste = !$store.componentToPaste
|
$: noPaste = !$store.componentToPaste
|
||||||
|
|
||||||
const lastPartOfName = (c) => (c ? last(c._component.split("/")) : "")
|
const lastPartOfName = c => (c ? last(c._component.split("/")) : "")
|
||||||
|
|
||||||
const hideDropdown = () => {
|
const hideDropdown = () => {
|
||||||
dropdown.hide()
|
dropdown.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectComponent = (component) => {
|
const selectComponent = component => {
|
||||||
store.selectComponent(component)
|
store.selectComponent(component)
|
||||||
const path = store.getPathToComponent(component)
|
const path = store.getPathToComponent(component)
|
||||||
$goto(`./:page/:screen/${path}`)
|
$goto(`./:page/:screen/${path}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const moveUpComponent = () => {
|
const moveUpComponent = () => {
|
||||||
store.update((s) => {
|
store.update(s => {
|
||||||
const parent = getParent(s.currentPreviewItem.props, component)
|
const parent = getParent(s.currentPreviewItem.props, component)
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
const currentIndex = parent._children.indexOf(component)
|
const currentIndex = parent._children.indexOf(component)
|
||||||
if (currentIndex === 0) return s
|
if (currentIndex === 0) return s
|
||||||
|
|
||||||
const newChildren = parent._children.filter((c) => c !== component)
|
const newChildren = parent._children.filter(c => c !== component)
|
||||||
newChildren.splice(currentIndex - 1, 0, component)
|
newChildren.splice(currentIndex - 1, 0, component)
|
||||||
parent._children = newChildren
|
parent._children = newChildren
|
||||||
}
|
}
|
||||||
|
@ -50,14 +50,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const moveDownComponent = () => {
|
const moveDownComponent = () => {
|
||||||
store.update((s) => {
|
store.update(s => {
|
||||||
const parent = getParent(s.currentPreviewItem.props, component)
|
const parent = getParent(s.currentPreviewItem.props, component)
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
const currentIndex = parent._children.indexOf(component)
|
const currentIndex = parent._children.indexOf(component)
|
||||||
if (currentIndex === parent._children.length - 1) return s
|
if (currentIndex === parent._children.length - 1) return s
|
||||||
|
|
||||||
const newChildren = parent._children.filter((c) => c !== component)
|
const newChildren = parent._children.filter(c => c !== component)
|
||||||
newChildren.splice(currentIndex + 1, 0, component)
|
newChildren.splice(currentIndex + 1, 0, component)
|
||||||
parent._children = newChildren
|
parent._children = newChildren
|
||||||
}
|
}
|
||||||
|
@ -74,11 +74,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteComponent = () => {
|
const deleteComponent = () => {
|
||||||
store.update((state) => {
|
store.update(state => {
|
||||||
const parent = getParent(state.currentPreviewItem.props, component)
|
const parent = getParent(state.currentPreviewItem.props, component)
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent._children = parent._children.filter((c) => c !== component)
|
parent._children = parent._children.filter(c => c !== component)
|
||||||
selectComponent(parent)
|
selectComponent(parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
store.storeComponentForCopy(component, cut)
|
store.storeComponentForCopy(component, cut)
|
||||||
}
|
}
|
||||||
|
|
||||||
const pasteComponent = (mode) => {
|
const pasteComponent = mode => {
|
||||||
// lives in store - also used by drag drop
|
// lives in store - also used by drag drop
|
||||||
store.pasteComponent(component, mode)
|
store.pasteComponent(component, mode)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
$: componentPropDefinition =
|
$: componentPropDefinition =
|
||||||
flattenedPanel.find(
|
flattenedPanel.find(
|
||||||
//use for getting controls for each component property
|
//use for getting controls for each component property
|
||||||
(c) => c._component === componentInstance._component
|
c => c._component === componentInstance._component
|
||||||
) || {}
|
) || {}
|
||||||
|
|
||||||
$: panelDefinition =
|
$: panelDefinition =
|
||||||
|
@ -48,8 +48,8 @@
|
||||||
|
|
||||||
function flattenComponents(props) {
|
function flattenComponents(props) {
|
||||||
const components = []
|
const components = []
|
||||||
props.forEach((comp) =>
|
props.forEach(comp =>
|
||||||
walkProps(comp, (c) => {
|
walkProps(comp, c => {
|
||||||
if ("_component" in c) {
|
if ("_component" in c) {
|
||||||
components.push(c)
|
components.push(c)
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CategoryTab
|
<CategoryTab
|
||||||
onClick={(category) => (selectedCategory = category)}
|
onClick={category => (selectedCategory = category)}
|
||||||
{categories}
|
{categories}
|
||||||
{selectedCategory} />
|
{selectedCategory} />
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onComponentChosen = (component) => {
|
const onComponentChosen = component => {
|
||||||
store.addChildComponent(component._component, component.presetProps)
|
store.addChildComponent(component._component, component.presetProps)
|
||||||
const path = store.getPathToComponent($store.currentComponentInfo)
|
const path = store.getPathToComponent($store.currentComponentInfo)
|
||||||
$goto(`./:page/:screen/${path}`)
|
$goto(`./:page/:screen/${path}`)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
let confirmDeleteDialog
|
let confirmDeleteDialog
|
||||||
let componentToDelete = ""
|
let componentToDelete = ""
|
||||||
|
|
||||||
const normalizedName = (name) =>
|
const normalizedName = name =>
|
||||||
pipe(name, [
|
pipe(name, [
|
||||||
trimCharsStart("./"),
|
trimCharsStart("./"),
|
||||||
trimCharsStart("~/"),
|
trimCharsStart("~/"),
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
trimChars(" "),
|
trimChars(" "),
|
||||||
])
|
])
|
||||||
|
|
||||||
const changeScreen = (screen) => {
|
const changeScreen = screen => {
|
||||||
store.setCurrentScreen(screen.props._instanceName)
|
store.setCurrentScreen(screen.props._instanceName)
|
||||||
$goto(`./:page/${screen.props._instanceName}`)
|
$goto(`./:page/${screen.props._instanceName}`)
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,12 +33,12 @@
|
||||||
let dropUnderComponent
|
let dropUnderComponent
|
||||||
let componentToDrop
|
let componentToDrop
|
||||||
|
|
||||||
const capitalise = (s) => s.substring(0, 1).toUpperCase() + s.substring(1)
|
const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1)
|
||||||
const get_name = (s) => (!s ? "" : last(s.split("/")))
|
const get_name = s => (!s ? "" : last(s.split("/")))
|
||||||
const get_capitalised_name = (name) => pipe(name, [get_name, capitalise])
|
const get_capitalised_name = name => pipe(name, [get_name, capitalise])
|
||||||
const isScreenslot = (name) => name === "##builtin/screenslot"
|
const isScreenslot = name => name === "##builtin/screenslot"
|
||||||
|
|
||||||
const selectComponent = (component) => {
|
const selectComponent = component => {
|
||||||
// Set current component
|
// Set current component
|
||||||
store.selectComponent(component)
|
store.selectComponent(component)
|
||||||
|
|
||||||
|
@ -49,21 +49,21 @@
|
||||||
$goto(`./:page/:screen/${path}`)
|
$goto(`./:page/:screen/${path}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const dragstart = (component) => (e) => {
|
const dragstart = component => e => {
|
||||||
e.dataTransfer.dropEffect = "move"
|
e.dataTransfer.dropEffect = "move"
|
||||||
dragDropStore.update((s) => {
|
dragDropStore.update(s => {
|
||||||
s.componentToDrop = component
|
s.componentToDrop = component
|
||||||
return s
|
return s
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const dragover = (component, index) => (e) => {
|
const dragover = (component, index) => e => {
|
||||||
const canHaveChildrenButIsEmpty =
|
const canHaveChildrenButIsEmpty =
|
||||||
getComponentDefinition($store, component._component).children &&
|
getComponentDefinition($store, component._component).children &&
|
||||||
component._children.length === 0
|
component._children.length === 0
|
||||||
|
|
||||||
e.dataTransfer.dropEffect = "copy"
|
e.dataTransfer.dropEffect = "copy"
|
||||||
dragDropStore.update((s) => {
|
dragDropStore.update(s => {
|
||||||
const isBottomHalf = e.offsetY > e.currentTarget.offsetHeight / 2
|
const isBottomHalf = e.offsetY > e.currentTarget.offsetHeight / 2
|
||||||
s.targetComponent = component
|
s.targetComponent = component
|
||||||
// only allow dropping inside when container type
|
// only allow dropping inside when container type
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
$dragDropStore.dropPosition
|
$dragDropStore.dropPosition
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
dragDropStore.update((s) => {
|
dragDropStore.update(s => {
|
||||||
s.dropPosition = ""
|
s.dropPosition = ""
|
||||||
s.targetComponent = null
|
s.targetComponent = null
|
||||||
s.componentToDrop = null
|
s.componentToDrop = null
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const dragend = () => {
|
const dragend = () => {
|
||||||
dragDropStore.update((s) => {
|
dragDropStore.update(s => {
|
||||||
s.dropPosition = ""
|
s.dropPosition = ""
|
||||||
s.targetComponent = null
|
s.targetComponent = null
|
||||||
s.componentToDrop = null
|
s.componentToDrop = null
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
let propGroup = null
|
let propGroup = null
|
||||||
let currentGroup
|
let currentGroup
|
||||||
|
|
||||||
const getProperties = (name) => panelDefinition[name]
|
const getProperties = name => panelDefinition[name]
|
||||||
|
|
||||||
function onChange(category) {
|
function onChange(category) {
|
||||||
selectedCategory = category
|
selectedCategory = category
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
return [
|
return [
|
||||||
...$store.screens
|
...$store.screens
|
||||||
.filter(
|
.filter(
|
||||||
(screen) =>
|
screen =>
|
||||||
screen.props._component.endsWith("/rowdetail") ||
|
screen.props._component.endsWith("/rowdetail") ||
|
||||||
screen.route.endsWith(":id")
|
screen.route.endsWith(":id")
|
||||||
)
|
)
|
||||||
.map((screen) => ({
|
.map(screen => ({
|
||||||
name: screen.props._instanceName,
|
name: screen.props._instanceName,
|
||||||
url: screen.route,
|
url: screen.route,
|
||||||
sort: screen.props._component,
|
sort: screen.props._component,
|
||||||
|
|
|
@ -18,19 +18,19 @@
|
||||||
$: actions = event || []
|
$: actions = event || []
|
||||||
$: selectedActionComponent =
|
$: selectedActionComponent =
|
||||||
selectedAction &&
|
selectedAction &&
|
||||||
actionTypes.find((t) => t.name === selectedAction[EVENT_TYPE_MEMBER_NAME])
|
actionTypes.find(t => t.name === selectedAction[EVENT_TYPE_MEMBER_NAME])
|
||||||
.component
|
.component
|
||||||
|
|
||||||
const updateEventHandler = (updatedHandler, index) => {
|
const updateEventHandler = (updatedHandler, index) => {
|
||||||
actions[index] = updatedHandler
|
actions[index] = updatedHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
const deleteAction = (index) => {
|
const deleteAction = index => {
|
||||||
actions.splice(index, 1)
|
actions.splice(index, 1)
|
||||||
actions = actions
|
actions = actions
|
||||||
}
|
}
|
||||||
|
|
||||||
const addAction = (actionType) => () => {
|
const addAction = actionType => () => {
|
||||||
const newAction = {
|
const newAction = {
|
||||||
parameters: {},
|
parameters: {},
|
||||||
[EVENT_TYPE_MEMBER_NAME]: actionType.name,
|
[EVENT_TYPE_MEMBER_NAME]: actionType.name,
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
addActionDropdown.hide()
|
addActionDropdown.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectAction = (action) => () => {
|
const selectAction = action => () => {
|
||||||
selectedAction = action
|
selectedAction = action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
let isOpen = false
|
let isOpen = false
|
||||||
|
|
||||||
const capitalize = (s) => {
|
const capitalize = s => {
|
||||||
if (typeof s !== "string") return ""
|
if (typeof s !== "string") return ""
|
||||||
return s.charAt(0).toUpperCase() + s.slice(1)
|
return s.charAt(0).toUpperCase() + s.slice(1)
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
{#if parameter.name === 'automation'}
|
{#if parameter.name === 'automation'}
|
||||||
<Select on:change bind:value={parameter.value}>
|
<Select on:change bind:value={parameter.value}>
|
||||||
<option value="" />
|
<option value="" />
|
||||||
{#each $automationStore.automations.filter((wf) => wf.live) as automation}
|
{#each $automationStore.automations.filter(wf => wf.live) as automation}
|
||||||
<option value={automation._id}>{automation.name}</option>
|
<option value={automation._id}>{automation.name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
export let value = ""
|
export let value = ""
|
||||||
export let text = ""
|
export let text = ""
|
||||||
export let icon = ""
|
export let icon = ""
|
||||||
export let onClick = (value) => {}
|
export let onClick = value => {}
|
||||||
export let selected = false
|
export let selected = false
|
||||||
|
|
||||||
$: useIcon = !!icon
|
$: useIcon = !!icon
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
function findIconByTerm(term) {
|
function findIconByTerm(term) {
|
||||||
const r = new RegExp(`\^${term}`, "i")
|
const r = new RegExp(`\^${term}`, "i")
|
||||||
return icons.filter((i) => r.test(i.label))
|
return icons.filter(i => r.test(i.label))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function switchLetter(letter) {
|
async function switchLetter(letter) {
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
|
|
||||||
async function findIconOnPage() {
|
async function findIconOnPage() {
|
||||||
loading = true
|
loading = true
|
||||||
const iconIdx = filteredIcons.findIndex((i) => i.value === value)
|
const iconIdx = filteredIcons.findIndex(i => i.value === value)
|
||||||
if (iconIdx !== -1) {
|
if (iconIdx !== -1) {
|
||||||
currentPage = Math.ceil(iconIdx / maxIconsPerPage)
|
currentPage = Math.ceil(iconIdx / maxIconsPerPage)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
export let options = []
|
export let options = []
|
||||||
export let value = ""
|
export let value = ""
|
||||||
export let styleBindingProperty
|
export let styleBindingProperty
|
||||||
export let onChange = (value) => {}
|
export let onChange = value => {}
|
||||||
|
|
||||||
let open = null
|
let open = null
|
||||||
let rotate = ""
|
let rotate = ""
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
let scrollTop = 0
|
let scrollTop = 0
|
||||||
let containerEl = null
|
let containerEl = null
|
||||||
|
|
||||||
const handleStyleBind = (value) =>
|
const handleStyleBind = value =>
|
||||||
!!styleBindingProperty ? { style: `${styleBindingProperty}: ${value}` } : {}
|
!!styleBindingProperty ? { style: `${styleBindingProperty}: ${value}` } : {}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
@ -95,10 +95,10 @@
|
||||||
width: `${width}px`,
|
width: `${width}px`,
|
||||||
})
|
})
|
||||||
|
|
||||||
$: isOptionsObject = options.every((o) => typeof o === "object")
|
$: isOptionsObject = options.every(o => typeof o === "object")
|
||||||
|
|
||||||
$: selectedOption = isOptionsObject
|
$: selectedOption = isOptionsObject
|
||||||
? options.find((o) => o.value === value)
|
? options.find(o => o.value === value)
|
||||||
: {}
|
: {}
|
||||||
|
|
||||||
$: if (open && selectMenu) {
|
$: if (open && selectMenu) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
const dragDropStore = writable({})
|
const dragDropStore = writable({})
|
||||||
|
|
||||||
const lastPartOfName = (c) =>
|
const lastPartOfName = c =>
|
||||||
c && last(c.name ? c.name.split("/") : c._component.split("/"))
|
c && last(c.name ? c.name.split("/") : c._component.split("/"))
|
||||||
|
|
||||||
$: _layout = {
|
$: _layout = {
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
if (!$store.currentPageName)
|
if (!$store.currentPageName)
|
||||||
store.setCurrentPage($params.page ? $params.page : "main")
|
store.setCurrentPage($params.page ? $params.page : "main")
|
||||||
|
|
||||||
const changePage = (id) => {
|
const changePage = id => {
|
||||||
store.setCurrentPage(id)
|
store.setCurrentPage(id)
|
||||||
$goto(`./${id}/page-layout`)
|
$goto(`./${id}/page-layout`)
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//Incase the component has a different value key name
|
//Incase the component has a different value key name
|
||||||
const handlevalueKey = (value) =>
|
const handlevalueKey = value =>
|
||||||
props.valueKey ? { [props.valueKey]: safeValue() } : { value: safeValue() }
|
props.valueKey ? { [props.valueKey]: safeValue() } : { value: safeValue() }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@
|
||||||
this={control}
|
this={control}
|
||||||
{componentInstance}
|
{componentInstance}
|
||||||
{...handlevalueKey(value)}
|
{...handlevalueKey(value)}
|
||||||
on:change={(val) => handleChange(key, val)}
|
on:change={val => handleChange(key, val)}
|
||||||
onChange={(val) => handleChange(key, val)}
|
onChange={val => handleChange(key, val)}
|
||||||
{...props}
|
{...props}
|
||||||
name={key} />
|
name={key} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
<BindingDropdown
|
<BindingDropdown
|
||||||
{...handlevalueKey(value)}
|
{...handlevalueKey(value)}
|
||||||
close={dropdown.hide}
|
close={dropdown.hide}
|
||||||
on:update={(e) => (temporaryBindableValue = e.detail)}
|
on:update={e => (temporaryBindableValue = e.detail)}
|
||||||
{bindableProperties} />
|
{bindableProperties} />
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
const deleteScreen = () => {
|
const deleteScreen = () => {
|
||||||
store.deleteScreens(screen, $store.currentPageName)
|
store.deleteScreens(screen, $store.currentPageName)
|
||||||
// update the page if required
|
// update the page if required
|
||||||
store.update((state) => {
|
store.update(state => {
|
||||||
if (state.currentPreviewItem.name === screen.name) {
|
if (state.currentPreviewItem.name === screen.name) {
|
||||||
store.setCurrentPage($store.currentPageName)
|
store.setCurrentPage($store.currentPageName)
|
||||||
$goto(`./:page/page-layout`)
|
$goto(`./:page/page-layout`)
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
const getUrls = () => {
|
const getUrls = () => {
|
||||||
const urls = [
|
const urls = [
|
||||||
...$store.screens
|
...$store.screens
|
||||||
.filter((screen) => !screen.props._component.endsWith("/rowdetail"))
|
.filter(screen => !screen.props._component.endsWith("/rowdetail"))
|
||||||
.map((screen) => ({
|
.map(screen => ({
|
||||||
name: screen.props._instanceName,
|
name: screen.props._instanceName,
|
||||||
url: screen.route,
|
url: screen.route,
|
||||||
sort: screen.props._component,
|
sort: screen.props._component,
|
||||||
|
@ -33,12 +33,12 @@
|
||||||
tables: $backendUiStore.tables,
|
tables: $backendUiStore.tables,
|
||||||
})
|
})
|
||||||
|
|
||||||
const detailScreens = $store.screens.filter((screen) =>
|
const detailScreens = $store.screens.filter(screen =>
|
||||||
screen.props._component.endsWith("/rowdetail")
|
screen.props._component.endsWith("/rowdetail")
|
||||||
)
|
)
|
||||||
|
|
||||||
for (let detailScreen of detailScreens) {
|
for (let detailScreen of detailScreens) {
|
||||||
const idBinding = bindableProperties.find((p) => {
|
const idBinding = bindableProperties.find(p => {
|
||||||
if (
|
if (
|
||||||
p.type === "context" &&
|
p.type === "context" &&
|
||||||
p.runtimeBinding.endsWith("._id") &&
|
p.runtimeBinding.endsWith("._id") &&
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
let pageScreenProps = ["title", "favicon", "description", "route"]
|
let pageScreenProps = ["title", "favicon", "description", "route"]
|
||||||
let duplicateName = false
|
let duplicateName = false
|
||||||
|
|
||||||
const propExistsOnComponentDef = (prop) =>
|
const propExistsOnComponentDef = prop =>
|
||||||
pageScreenProps.includes(prop) || prop in componentDefinition.props
|
pageScreenProps.includes(prop) || prop in componentDefinition.props
|
||||||
|
|
||||||
function handleChange(key, data) {
|
function handleChange(key, data) {
|
||||||
|
@ -47,10 +47,10 @@
|
||||||
$: isPage = screenOrPageInstance && screenOrPageInstance.favicon
|
$: isPage = screenOrPageInstance && screenOrPageInstance.favicon
|
||||||
$: screenOrPageDefinition = isPage ? pageDefinition : screenDefinition
|
$: screenOrPageDefinition = isPage ? pageDefinition : screenDefinition
|
||||||
|
|
||||||
const isDuplicateName = (name) => {
|
const isDuplicateName = name => {
|
||||||
let duplicate = false
|
let duplicate = false
|
||||||
|
|
||||||
const lookForDuplicate = (rootPops) => {
|
const lookForDuplicate = rootPops => {
|
||||||
walkProps(rootPops, (inst, cancel) => {
|
walkProps(rootPops, (inst, cancel) => {
|
||||||
if (inst._instanceName === name && inst._id !== componentInstance._id) {
|
if (inst._instanceName === name && inst._id !== componentInstance._id) {
|
||||||
duplicate = true
|
duplicate = true
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
dropdownRight.hide()
|
dropdownRight.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
$: tables = $backendUiStore.tables.map((m) => ({
|
$: tables = $backendUiStore.tables.map(m => ({
|
||||||
label: m.name,
|
label: m.name,
|
||||||
name: `all_${m._id}`,
|
name: `all_${m._id}`,
|
||||||
tableId: m._id,
|
tableId: m._id,
|
||||||
|
@ -39,8 +39,8 @@
|
||||||
})
|
})
|
||||||
|
|
||||||
$: links = bindableProperties
|
$: links = bindableProperties
|
||||||
.filter((x) => x.fieldSchema.type === "link")
|
.filter(x => x.fieldSchema.type === "link")
|
||||||
.map((property) => ({
|
.map(property => ({
|
||||||
label: property.readableBinding,
|
label: property.readableBinding,
|
||||||
fieldName: property.fieldSchema.name,
|
fieldName: property.fieldSchema.name,
|
||||||
name: `all_${property.fieldSchema.tableId}`,
|
name: `all_${property.fieldSchema.tableId}`,
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
// e.g. if one of your screens is selected on front end, then
|
// e.g. if one of your screens is selected on front end, then
|
||||||
// you browse to backend, when you click frontend, you will be
|
// you browse to backend, when you click frontend, you will be
|
||||||
// brought back to the same screen
|
// brought back to the same screen
|
||||||
const topItemNavigate = (path) => () => {
|
const topItemNavigate = path => () => {
|
||||||
const activeTopNav = $layout.children.find((c) => $isActive(c.path))
|
const activeTopNav = $layout.children.find(c => $isActive(c.path))
|
||||||
if (!activeTopNav) return
|
if (!activeTopNav) return
|
||||||
store.update((state) => {
|
store.update(state => {
|
||||||
if (!state.previousTopNavPath) state.previousTopNavPath = {}
|
if (!state.previousTopNavPath) state.previousTopNavPath = {}
|
||||||
state.previousTopNavPath[
|
state.previousTopNavPath[
|
||||||
activeTopNav.path
|
activeTopNav.path
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
settingsView.show()
|
settingsView.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastPartOfName = (c) => (c ? last(c.split("/")) : "")
|
const lastPartOfName = c => (c ? last(c.split("/")) : "")
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- routify:options index=1 -->
|
<!-- routify:options index=1 -->
|
||||||
|
|
|
@ -8,9 +8,8 @@
|
||||||
|
|
||||||
function handleFileTooLarge(fileSizeLimit) {
|
function handleFileTooLarge(fileSizeLimit) {
|
||||||
alert(
|
alert(
|
||||||
`Files cannot exceed ${
|
`Files cannot exceed ${fileSizeLimit /
|
||||||
fileSizeLimit / BYTES_IN_MB
|
BYTES_IN_MB}MB. Please try again with smaller files.`
|
||||||
}MB. Please try again with smaller files.`
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue