From add416200011477123fe583a1628c6ddfc548d72 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 27 Oct 2020 15:28:13 +0000 Subject: [PATCH] Format with prettier --- packages/builder/cypress/support/commands.js | 56 ++++++++++++++----- .../AutomationBuilder.svelte | 2 +- .../AutomationBuilder/BlockList.svelte | 2 +- .../FlowChart/FlowItem.svelte | 2 +- .../SetupPanel/AutomationBlockSetup.svelte | 2 +- .../automation/SetupPanel/RowSelector.svelte | 4 +- .../popovers/CreateEditColumnPopover.svelte | 4 +- .../TableNavigator/TableDataImport.svelte | 7 +-- .../modals/CreateTableModal.svelte | 8 +-- .../src/components/common/Dropzone.svelte | 5 +- .../components/start/CreateAppModal.svelte | 6 +- .../AppPreview/CurrentItemPreview.svelte | 4 +- .../userInterface/CategoryTab.svelte | 2 +- .../ComponentDropdownMenu.svelte | 18 +++--- .../ComponentPropertiesPanel.svelte | 8 +-- .../ComponentSelectionList.svelte | 2 +- .../userInterface/ComponentsHierarchy.svelte | 4 +- .../ComponentsHierarchyChildren.svelte | 22 ++++---- .../userInterface/DesignView.svelte | 2 +- .../userInterface/DetailScreenSelect.svelte | 4 +- .../EventsEditor/EventEditorModal.svelte | 8 +-- .../EventsEditor/StateBindingCascader.svelte | 4 +- .../userInterface/FlatButton.svelte | 2 +- .../IconSelect/IconSelect.svelte | 4 +- .../userInterface/OptionSelect.svelte | 8 +-- .../userInterface/PageLayout.svelte | 2 +- .../components/userInterface/PagesList.svelte | 2 +- .../userInterface/PropertyControl.svelte | 8 +-- .../userInterface/ScreenDropdownMenu.svelte | 2 +- .../userInterface/ScreenSelect.svelte | 8 +-- .../userInterface/SettingsView.svelte | 6 +- .../userInterface/TableViewSelect.svelte | 6 +- .../src/pages/[application]/_reset.svelte | 6 +- .../pages/[application]/design/_layout.svelte | 2 +- .../src/attachments/Dropzone.svelte | 5 +- 35 files changed, 131 insertions(+), 106 deletions(-) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index fdc0b2f49c..2587e9475e 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -31,7 +31,9 @@ Cypress.Commands.add("createApp", name => { .then($body => { if ($body.find("input[name=apiKey]").length) { // 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() } }) @@ -42,8 +44,12 @@ Cypress.Commands.add("createApp", name => { cy.contains("Next").click() - cy.get("input[name=username]").click().type("test") - cy.get("input[name=password]").click().type("test") + cy.get("input[name=username]") + .click() + .type("test") + cy.get("input[name=password]") + .click() + .type("test") cy.contains("Submit").click() cy.get("[data-cy=new-table]", { timeout: 20000, @@ -61,8 +67,12 @@ Cypress.Commands.add("createTable", tableName => { // Enter table name cy.get("[data-cy=new-table]").click() cy.get(".modal").within(() => { - cy.get("input").first().type(tableName) - cy.get(".buttons").contains("Create").click() + cy.get("input") + .first() + .type(tableName) + cy.get(".buttons") + .contains("Create") + .click() }) cy.contains(tableName).should("be.visible") }) @@ -74,7 +84,9 @@ Cypress.Commands.add("addColumn", (tableName, columnName, type) => { // Configure column cy.get(".menu-container").within(() => { - cy.get("input").first().type(columnName) + cy.get("input") + .first() + .type(columnName) // Unset table display column cy.contains("display column").click() cy.get("select").select(type) @@ -87,11 +99,15 @@ Cypress.Commands.add("addRow", values => { cy.get(".modal").within(() => { 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 - 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.contains("Users").click() - cy.get("[name=Name]").first().type(username) - cy.get("[name=Password]").first().type(password) - cy.get("select").first().select(accessLevel) + cy.get("[name=Name]") + .first() + .type(username) + cy.get("[name=Password]") + .first() + .type(password) + cy.get("select") + .first() + .select(accessLevel) // Save - cy.get(".inputs").contains("Create").click() + cy.get(".inputs") + .contains("Create") + .click() }) Cypress.Commands.add("addHeadlineComponent", text => { @@ -131,9 +155,13 @@ Cypress.Commands.add("navigateToFrontend", () => { Cypress.Commands.add("createScreen", (screenName, route) => { cy.get("[data-cy=new-screen]").click() cy.get(".modal").within(() => { - cy.get("input").eq(0).type(screenName) + cy.get("input") + .eq(0) + .type(screenName) if (route) { - cy.get("input").eq(1).type(route) + cy.get("input") + .eq(1) + .type(route) } cy.contains("Create Screen").click() }) diff --git a/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte b/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte index ddb86174e2..9f9401a738 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte @@ -9,7 +9,7 @@ $: automationCount = $automationStore.automations?.length ?? 0 function onSelect(block) { - automationStore.update((state) => { + automationStore.update(state => { state.selectedBlock = block return state }) diff --git a/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte b/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte index 7f477d7105..cc38928408 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/BlockList.svelte @@ -33,7 +33,7 @@ let popover $: selectedTab = selectedIndex == null ? null : tabs[selectedIndex].value $: anchor = selectedIndex === -1 ? null : anchors[selectedIndex] - $: blocks = sortBy((entry) => entry[1].name)( + $: blocks = sortBy(entry => entry[1].name)( Object.entries($automationStore.blockDefinitions[selectedTab] ?? {}) ) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 85fdcf1a1d..a96e85d582 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -9,7 +9,7 @@ $: selected = $automationStore.selectedBlock?.id === block.id $: 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 function deleteStep() { diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 9165c8411a..c2a8b10395 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -22,7 +22,7 @@ if (automation.trigger) { 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 let bindings = [] diff --git a/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte b/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte index 6ee77a5004..117f00d1a3 100644 --- a/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte +++ b/packages/builder/src/components/automation/SetupPanel/RowSelector.svelte @@ -6,9 +6,7 @@ export let value export let bindings - $: table = $backendUiStore.tables.find( - (table) => table._id === value?.tableId - ) + $: table = $backendUiStore.tables.find(table => table._id === value?.tableId) $: schemaFields = Object.entries(table?.schema ?? {}) // Ensure any nullish tableId values get set to empty string so diff --git a/packages/builder/src/components/backend/DataTable/popovers/CreateEditColumnPopover.svelte b/packages/builder/src/components/backend/DataTable/popovers/CreateEditColumnPopover.svelte index a852707993..80e8df72f0 100644 --- a/packages/builder/src/components/backend/DataTable/popovers/CreateEditColumnPopover.svelte +++ b/packages/builder/src/components/backend/DataTable/popovers/CreateEditColumnPopover.svelte @@ -22,12 +22,12 @@ $backendUiStore.selectedTable.primaryDisplay == null || $backendUiStore.selectedTable.primaryDisplay === field.name $: tableOptions = $backendUiStore.tables.filter( - (table) => table._id !== $backendUiStore.draftTable._id + table => table._id !== $backendUiStore.draftTable._id ) $: required = !!field?.constraints?.presence || primaryDisplay async function saveColumn() { - backendUiStore.update((state) => { + backendUiStore.update(state => { backendUiStore.actions.tables.saveField({ originalName, field, diff --git a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte index f6e4c34c3c..d328df4b40 100644 --- a/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte +++ b/packages/builder/src/components/backend/TableNavigator/TableDataImport.svelte @@ -69,16 +69,15 @@ const fileArray = Array.from(evt.target.files) if (fileArray.some(file => file.size >= FILE_SIZE_LIMIT)) { notifier.danger( - `Files cannot exceed ${ - FILE_SIZE_LIMIT / BYTES_IN_MB - }MB. Please try again with smaller files.` + `Files cannot exceed ${FILE_SIZE_LIMIT / + BYTES_IN_MB}MB. Please try again with smaller files.` ) return } // Read CSV as plain text to upload alongside schema let reader = new FileReader() - reader.addEventListener("load", function (e) { + reader.addEventListener("load", function(e) { csvString = e.target.result files = fileArray validateCSV() diff --git a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte index e77fec709f..146f881b2b 100644 --- a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte +++ b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte @@ -23,7 +23,7 @@ function checkValid(evt) { 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.` return } @@ -49,8 +49,8 @@ // Create auto screens const screens = screenTemplates($store, [table]) - .filter((template) => defaultScreens.includes(template.id)) - .map((template) => template.create()) + .filter(template => defaultScreens.includes(template.id)) + .map(template => template.create()) for (let screen of screens) { // Record the table that created this screen so we can link it later screen.autoTableId = table._id @@ -67,7 +67,7 @@ } // Create autolink to newly created list page - const listPage = screens.find((screen) => + const listPage = screens.find(screen => screen.props._instanceName.endsWith("List") ) await store.createLink(listPage.route, table.name) diff --git a/packages/builder/src/components/common/Dropzone.svelte b/packages/builder/src/components/common/Dropzone.svelte index 0a040f8873..be93829084 100644 --- a/packages/builder/src/components/common/Dropzone.svelte +++ b/packages/builder/src/components/common/Dropzone.svelte @@ -9,9 +9,8 @@ function handleFileTooLarge(fileSizeLimit) { notifier.danger( - `Files cannot exceed ${ - fileSizeLimit / BYTES_IN_MB - }MB. Please try again with smaller files.` + `Files cannot exceed ${fileSizeLimit / + BYTES_IN_MB}MB. Please try again with smaller files.` ) } diff --git a/packages/builder/src/components/start/CreateAppModal.svelte b/packages/builder/src/components/start/CreateAppModal.svelte index 64d84a723f..4118c2b9e7 100644 --- a/packages/builder/src/components/start/CreateAppModal.svelte +++ b/packages/builder/src/components/start/CreateAppModal.svelte @@ -22,7 +22,7 @@ let isApiKeyValid let lastApiKey let fetchApiKeyPromise - const validateApiKey = async (apiKey) => { + const validateApiKey = async apiKey => { if (!apiKey) return false // make sure we only fetch once, unless API Key is changed @@ -121,7 +121,9 @@ const fullSchema = Object.assign({}, ...validationSchemas) // Check full form schema - const formIsValid = await object().shape(fullSchema).isValid(values) + const formIsValid = await object() + .shape(fullSchema) + .isValid(values) fullFormIsValid = formIsValid } } diff --git a/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte b/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte index a565a925e4..fd7270cdfa 100644 --- a/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte +++ b/packages/builder/src/components/userInterface/AppPreview/CurrentItemPreview.svelte @@ -16,7 +16,7 @@ return props } - const getComponentTypeName = (component) => { + const getComponentTypeName = component => { let [componentName] = component._component.match(/[a-z]*$/) return componentName || "element" } @@ -144,7 +144,7 @@ } $: stylesheetLinks = pipe($store.pages.stylesheets, [ - map((s) => ``), + map(s => ``), join("\n"), ]) diff --git a/packages/builder/src/components/userInterface/CategoryTab.svelte b/packages/builder/src/components/userInterface/CategoryTab.svelte index 00ed5e82ab..ba3f4e920d 100644 --- a/packages/builder/src/components/userInterface/CategoryTab.svelte +++ b/packages/builder/src/components/userInterface/CategoryTab.svelte @@ -1,7 +1,7 @@
diff --git a/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte b/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte index 033eaa27d4..a15d59cc7e 100644 --- a/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte +++ b/packages/builder/src/components/userInterface/ComponentDropdownMenu.svelte @@ -18,27 +18,27 @@ !component || !getComponentDefinition($store, component._component).children $: noPaste = !$store.componentToPaste - const lastPartOfName = (c) => (c ? last(c._component.split("/")) : "") + const lastPartOfName = c => (c ? last(c._component.split("/")) : "") const hideDropdown = () => { dropdown.hide() } - const selectComponent = (component) => { + const selectComponent = component => { store.selectComponent(component) const path = store.getPathToComponent(component) $goto(`./:page/:screen/${path}`) } const moveUpComponent = () => { - store.update((s) => { + store.update(s => { const parent = getParent(s.currentPreviewItem.props, component) if (parent) { const currentIndex = parent._children.indexOf(component) 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) parent._children = newChildren } @@ -50,14 +50,14 @@ } const moveDownComponent = () => { - store.update((s) => { + store.update(s => { const parent = getParent(s.currentPreviewItem.props, component) if (parent) { const currentIndex = parent._children.indexOf(component) 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) parent._children = newChildren } @@ -74,11 +74,11 @@ } const deleteComponent = () => { - store.update((state) => { + store.update(state => { const parent = getParent(state.currentPreviewItem.props, component) if (parent) { - parent._children = parent._children.filter((c) => c !== component) + parent._children = parent._children.filter(c => c !== component) selectComponent(parent) } @@ -92,7 +92,7 @@ store.storeComponentForCopy(component, cut) } - const pasteComponent = (mode) => { + const pasteComponent = mode => { // lives in store - also used by drag drop store.pasteComponent(component, mode) } diff --git a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte index 7b1c794610..475b864542 100644 --- a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte +++ b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte @@ -20,7 +20,7 @@ $: componentPropDefinition = flattenedPanel.find( //use for getting controls for each component property - (c) => c._component === componentInstance._component + c => c._component === componentInstance._component ) || {} $: panelDefinition = @@ -48,8 +48,8 @@ function flattenComponents(props) { const components = [] - props.forEach((comp) => - walkProps(comp, (c) => { + props.forEach(comp => + walkProps(comp, c => { if ("_component" in c) { components.push(c) } @@ -64,7 +64,7 @@ (selectedCategory = category)} + onClick={category => (selectedCategory = category)} {categories} {selectedCategory} /> diff --git a/packages/builder/src/components/userInterface/ComponentSelectionList.svelte b/packages/builder/src/components/userInterface/ComponentSelectionList.svelte index 8ed8917495..f43faf033d 100644 --- a/packages/builder/src/components/userInterface/ComponentSelectionList.svelte +++ b/packages/builder/src/components/userInterface/ComponentSelectionList.svelte @@ -24,7 +24,7 @@ } } - const onComponentChosen = (component) => { + const onComponentChosen = component => { store.addChildComponent(component._component, component.presetProps) const path = store.getPathToComponent($store.currentComponentInfo) $goto(`./:page/:screen/${path}`) diff --git a/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte b/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte index 0911a80558..48fe72f8d6 100644 --- a/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte +++ b/packages/builder/src/components/userInterface/ComponentsHierarchy.svelte @@ -23,7 +23,7 @@ let confirmDeleteDialog let componentToDelete = "" - const normalizedName = (name) => + const normalizedName = name => pipe(name, [ trimCharsStart("./"), trimCharsStart("~/"), @@ -31,7 +31,7 @@ trimChars(" "), ]) - const changeScreen = (screen) => { + const changeScreen = screen => { store.setCurrentScreen(screen.props._instanceName) $goto(`./:page/${screen.props._instanceName}`) } diff --git a/packages/builder/src/components/userInterface/ComponentsHierarchyChildren.svelte b/packages/builder/src/components/userInterface/ComponentsHierarchyChildren.svelte index 193ec7e49f..d854c9b906 100644 --- a/packages/builder/src/components/userInterface/ComponentsHierarchyChildren.svelte +++ b/packages/builder/src/components/userInterface/ComponentsHierarchyChildren.svelte @@ -33,12 +33,12 @@ let dropUnderComponent let componentToDrop - const capitalise = (s) => s.substring(0, 1).toUpperCase() + s.substring(1) - const get_name = (s) => (!s ? "" : last(s.split("/"))) - const get_capitalised_name = (name) => pipe(name, [get_name, capitalise]) - const isScreenslot = (name) => name === "##builtin/screenslot" + const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1) + const get_name = s => (!s ? "" : last(s.split("/"))) + const get_capitalised_name = name => pipe(name, [get_name, capitalise]) + const isScreenslot = name => name === "##builtin/screenslot" - const selectComponent = (component) => { + const selectComponent = component => { // Set current component store.selectComponent(component) @@ -49,21 +49,21 @@ $goto(`./:page/:screen/${path}`) } - const dragstart = (component) => (e) => { + const dragstart = component => e => { e.dataTransfer.dropEffect = "move" - dragDropStore.update((s) => { + dragDropStore.update(s => { s.componentToDrop = component return s }) } - const dragover = (component, index) => (e) => { + const dragover = (component, index) => e => { const canHaveChildrenButIsEmpty = getComponentDefinition($store, component._component).children && component._children.length === 0 e.dataTransfer.dropEffect = "copy" - dragDropStore.update((s) => { + dragDropStore.update(s => { const isBottomHalf = e.offsetY > e.currentTarget.offsetHeight / 2 s.targetComponent = component // only allow dropping inside when container type @@ -102,7 +102,7 @@ $dragDropStore.dropPosition ) } - dragDropStore.update((s) => { + dragDropStore.update(s => { s.dropPosition = "" s.targetComponent = null s.componentToDrop = null @@ -111,7 +111,7 @@ } const dragend = () => { - dragDropStore.update((s) => { + dragDropStore.update(s => { s.dropPosition = "" s.targetComponent = null s.componentToDrop = null diff --git a/packages/builder/src/components/userInterface/DesignView.svelte b/packages/builder/src/components/userInterface/DesignView.svelte index 989eaef53b..cbb532fcae 100644 --- a/packages/builder/src/components/userInterface/DesignView.svelte +++ b/packages/builder/src/components/userInterface/DesignView.svelte @@ -12,7 +12,7 @@ let propGroup = null let currentGroup - const getProperties = (name) => panelDefinition[name] + const getProperties = name => panelDefinition[name] function onChange(category) { selectedCategory = category diff --git a/packages/builder/src/components/userInterface/DetailScreenSelect.svelte b/packages/builder/src/components/userInterface/DetailScreenSelect.svelte index 6928a72e9d..224ba3e386 100644 --- a/packages/builder/src/components/userInterface/DetailScreenSelect.svelte +++ b/packages/builder/src/components/userInterface/DetailScreenSelect.svelte @@ -15,11 +15,11 @@ return [ ...$store.screens .filter( - (screen) => + screen => screen.props._component.endsWith("/rowdetail") || screen.route.endsWith(":id") ) - .map((screen) => ({ + .map(screen => ({ name: screen.props._instanceName, url: screen.route, sort: screen.props._component, diff --git a/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte b/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte index e3cc645eb0..2fc19bd6b8 100644 --- a/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte +++ b/packages/builder/src/components/userInterface/EventsEditor/EventEditorModal.svelte @@ -18,19 +18,19 @@ $: actions = event || [] $: selectedActionComponent = selectedAction && - actionTypes.find((t) => t.name === selectedAction[EVENT_TYPE_MEMBER_NAME]) + actionTypes.find(t => t.name === selectedAction[EVENT_TYPE_MEMBER_NAME]) .component const updateEventHandler = (updatedHandler, index) => { actions[index] = updatedHandler } - const deleteAction = (index) => { + const deleteAction = index => { actions.splice(index, 1) actions = actions } - const addAction = (actionType) => () => { + const addAction = actionType => () => { const newAction = { parameters: {}, [EVENT_TYPE_MEMBER_NAME]: actionType.name, @@ -41,7 +41,7 @@ addActionDropdown.hide() } - const selectAction = (action) => () => { + const selectAction = action => () => { selectedAction = action } diff --git a/packages/builder/src/components/userInterface/EventsEditor/StateBindingCascader.svelte b/packages/builder/src/components/userInterface/EventsEditor/StateBindingCascader.svelte index 6f1cf298c6..483780a2c5 100644 --- a/packages/builder/src/components/userInterface/EventsEditor/StateBindingCascader.svelte +++ b/packages/builder/src/components/userInterface/EventsEditor/StateBindingCascader.svelte @@ -6,7 +6,7 @@ let isOpen = false - const capitalize = (s) => { + const capitalize = s => { if (typeof s !== "string") return "" return s.charAt(0).toUpperCase() + s.slice(1) } @@ -17,7 +17,7 @@ {#if parameter.name === 'automation'} diff --git a/packages/builder/src/components/userInterface/FlatButton.svelte b/packages/builder/src/components/userInterface/FlatButton.svelte index 3ae8eebca3..0d7cd280d7 100644 --- a/packages/builder/src/components/userInterface/FlatButton.svelte +++ b/packages/builder/src/components/userInterface/FlatButton.svelte @@ -3,7 +3,7 @@ export let value = "" export let text = "" export let icon = "" - export let onClick = (value) => {} + export let onClick = value => {} export let selected = false $: useIcon = !!icon diff --git a/packages/builder/src/components/userInterface/IconSelect/IconSelect.svelte b/packages/builder/src/components/userInterface/IconSelect/IconSelect.svelte index 9fac2642d7..fe3a029716 100644 --- a/packages/builder/src/components/userInterface/IconSelect/IconSelect.svelte +++ b/packages/builder/src/components/userInterface/IconSelect/IconSelect.svelte @@ -50,7 +50,7 @@ function findIconByTerm(term) { 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) { @@ -65,7 +65,7 @@ async function findIconOnPage() { loading = true - const iconIdx = filteredIcons.findIndex((i) => i.value === value) + const iconIdx = filteredIcons.findIndex(i => i.value === value) if (iconIdx !== -1) { currentPage = Math.ceil(iconIdx / maxIconsPerPage) } diff --git a/packages/builder/src/components/userInterface/OptionSelect.svelte b/packages/builder/src/components/userInterface/OptionSelect.svelte index d1fbfecff7..d9f5964b30 100644 --- a/packages/builder/src/components/userInterface/OptionSelect.svelte +++ b/packages/builder/src/components/userInterface/OptionSelect.svelte @@ -6,7 +6,7 @@ export let options = [] export let value = "" export let styleBindingProperty - export let onChange = (value) => {} + export let onChange = value => {} let open = null let rotate = "" @@ -23,7 +23,7 @@ let scrollTop = 0 let containerEl = null - const handleStyleBind = (value) => + const handleStyleBind = value => !!styleBindingProperty ? { style: `${styleBindingProperty}: ${value}` } : {} onMount(() => { @@ -95,10 +95,10 @@ width: `${width}px`, }) - $: isOptionsObject = options.every((o) => typeof o === "object") + $: isOptionsObject = options.every(o => typeof o === "object") $: selectedOption = isOptionsObject - ? options.find((o) => o.value === value) + ? options.find(o => o.value === value) : {} $: if (open && selectMenu) { diff --git a/packages/builder/src/components/userInterface/PageLayout.svelte b/packages/builder/src/components/userInterface/PageLayout.svelte index a8e36aa1ff..c6ac3b5290 100644 --- a/packages/builder/src/components/userInterface/PageLayout.svelte +++ b/packages/builder/src/components/userInterface/PageLayout.svelte @@ -13,7 +13,7 @@ const dragDropStore = writable({}) - const lastPartOfName = (c) => + const lastPartOfName = c => c && last(c.name ? c.name.split("/") : c._component.split("/")) $: _layout = { diff --git a/packages/builder/src/components/userInterface/PagesList.svelte b/packages/builder/src/components/userInterface/PagesList.svelte index 13351c94e4..51fcce3889 100644 --- a/packages/builder/src/components/userInterface/PagesList.svelte +++ b/packages/builder/src/components/userInterface/PagesList.svelte @@ -21,7 +21,7 @@ if (!$store.currentPageName) store.setCurrentPage($params.page ? $params.page : "main") - const changePage = (id) => { + const changePage = id => { store.setCurrentPage(id) $goto(`./${id}/page-layout`) } diff --git a/packages/builder/src/components/userInterface/PropertyControl.svelte b/packages/builder/src/components/userInterface/PropertyControl.svelte index e47d5e17a3..823dcf6183 100644 --- a/packages/builder/src/components/userInterface/PropertyControl.svelte +++ b/packages/builder/src/components/userInterface/PropertyControl.svelte @@ -78,7 +78,7 @@ } //Incase the component has a different value key name - const handlevalueKey = (value) => + const handlevalueKey = value => props.valueKey ? { [props.valueKey]: safeValue() } : { value: safeValue() } @@ -89,8 +89,8 @@ this={control} {componentInstance} {...handlevalueKey(value)} - on:change={(val) => handleChange(key, val)} - onChange={(val) => handleChange(key, val)} + on:change={val => handleChange(key, val)} + onChange={val => handleChange(key, val)} {...props} name={key} />
@@ -109,7 +109,7 @@ (temporaryBindableValue = e.detail)} + on:update={e => (temporaryBindableValue = e.detail)} {bindableProperties} /> {/if} diff --git a/packages/builder/src/components/userInterface/ScreenDropdownMenu.svelte b/packages/builder/src/components/userInterface/ScreenDropdownMenu.svelte index b288c4ee75..7fd8f9de43 100644 --- a/packages/builder/src/components/userInterface/ScreenDropdownMenu.svelte +++ b/packages/builder/src/components/userInterface/ScreenDropdownMenu.svelte @@ -14,7 +14,7 @@ const deleteScreen = () => { store.deleteScreens(screen, $store.currentPageName) // update the page if required - store.update((state) => { + store.update(state => { if (state.currentPreviewItem.name === screen.name) { store.setCurrentPage($store.currentPageName) $goto(`./:page/page-layout`) diff --git a/packages/builder/src/components/userInterface/ScreenSelect.svelte b/packages/builder/src/components/userInterface/ScreenSelect.svelte index fb2a24a94e..748570595a 100644 --- a/packages/builder/src/components/userInterface/ScreenSelect.svelte +++ b/packages/builder/src/components/userInterface/ScreenSelect.svelte @@ -18,8 +18,8 @@ const getUrls = () => { const urls = [ ...$store.screens - .filter((screen) => !screen.props._component.endsWith("/rowdetail")) - .map((screen) => ({ + .filter(screen => !screen.props._component.endsWith("/rowdetail")) + .map(screen => ({ name: screen.props._instanceName, url: screen.route, sort: screen.props._component, @@ -33,12 +33,12 @@ tables: $backendUiStore.tables, }) - const detailScreens = $store.screens.filter((screen) => + const detailScreens = $store.screens.filter(screen => screen.props._component.endsWith("/rowdetail") ) for (let detailScreen of detailScreens) { - const idBinding = bindableProperties.find((p) => { + const idBinding = bindableProperties.find(p => { if ( p.type === "context" && p.runtimeBinding.endsWith("._id") && diff --git a/packages/builder/src/components/userInterface/SettingsView.svelte b/packages/builder/src/components/userInterface/SettingsView.svelte index be07eebcea..2aacbd261b 100644 --- a/packages/builder/src/components/userInterface/SettingsView.svelte +++ b/packages/builder/src/components/userInterface/SettingsView.svelte @@ -18,7 +18,7 @@ let pageScreenProps = ["title", "favicon", "description", "route"] let duplicateName = false - const propExistsOnComponentDef = (prop) => + const propExistsOnComponentDef = prop => pageScreenProps.includes(prop) || prop in componentDefinition.props function handleChange(key, data) { @@ -47,10 +47,10 @@ $: isPage = screenOrPageInstance && screenOrPageInstance.favicon $: screenOrPageDefinition = isPage ? pageDefinition : screenDefinition - const isDuplicateName = (name) => { + const isDuplicateName = name => { let duplicate = false - const lookForDuplicate = (rootPops) => { + const lookForDuplicate = rootPops => { walkProps(rootPops, (inst, cancel) => { if (inst._instanceName === name && inst._id !== componentInstance._id) { duplicate = true diff --git a/packages/builder/src/components/userInterface/TableViewSelect.svelte b/packages/builder/src/components/userInterface/TableViewSelect.svelte index 8adfaaf2a0..7813a57e5e 100644 --- a/packages/builder/src/components/userInterface/TableViewSelect.svelte +++ b/packages/builder/src/components/userInterface/TableViewSelect.svelte @@ -14,7 +14,7 @@ dropdownRight.hide() } - $: tables = $backendUiStore.tables.map((m) => ({ + $: tables = $backendUiStore.tables.map(m => ({ label: m.name, name: `all_${m._id}`, tableId: m._id, @@ -39,8 +39,8 @@ }) $: links = bindableProperties - .filter((x) => x.fieldSchema.type === "link") - .map((property) => ({ + .filter(x => x.fieldSchema.type === "link") + .map(property => ({ label: property.readableBinding, fieldName: property.fieldSchema.name, name: `all_${property.fieldSchema.tableId}`, diff --git a/packages/builder/src/pages/[application]/_reset.svelte b/packages/builder/src/pages/[application]/_reset.svelte index a39fd0ce62..ba242769ec 100644 --- a/packages/builder/src/pages/[application]/_reset.svelte +++ b/packages/builder/src/pages/[application]/_reset.svelte @@ -30,10 +30,10 @@ // e.g. if one of your screens is selected on front end, then // you browse to backend, when you click frontend, you will be // brought back to the same screen - const topItemNavigate = (path) => () => { - const activeTopNav = $layout.children.find((c) => $isActive(c.path)) + const topItemNavigate = path => () => { + const activeTopNav = $layout.children.find(c => $isActive(c.path)) if (!activeTopNav) return - store.update((state) => { + store.update(state => { if (!state.previousTopNavPath) state.previousTopNavPath = {} state.previousTopNavPath[ activeTopNav.path diff --git a/packages/builder/src/pages/[application]/design/_layout.svelte b/packages/builder/src/pages/[application]/design/_layout.svelte index c4f4375427..13f2b4ee53 100644 --- a/packages/builder/src/pages/[application]/design/_layout.svelte +++ b/packages/builder/src/pages/[application]/design/_layout.svelte @@ -27,7 +27,7 @@ settingsView.show() } - const lastPartOfName = (c) => (c ? last(c.split("/")) : "") + const lastPartOfName = c => (c ? last(c.split("/")) : "") diff --git a/packages/standard-components/src/attachments/Dropzone.svelte b/packages/standard-components/src/attachments/Dropzone.svelte index ffa12ab178..5f6e8056b7 100644 --- a/packages/standard-components/src/attachments/Dropzone.svelte +++ b/packages/standard-components/src/attachments/Dropzone.svelte @@ -8,9 +8,8 @@ function handleFileTooLarge(fileSizeLimit) { alert( - `Files cannot exceed ${ - fileSizeLimit / BYTES_IN_MB - }MB. Please try again with smaller files.` + `Files cannot exceed ${fileSizeLimit / + BYTES_IN_MB}MB. Please try again with smaller files.` ) }