Remove deprecated props, fix warnings, remove old code

This commit is contained in:
Andrew Kingston 2020-11-30 15:05:36 +00:00
parent 3ee9fee10c
commit ce18e253ba
11 changed files with 7 additions and 343 deletions

View File

@ -15,8 +15,6 @@ export class Component extends BaseStructure {
selected: {}, selected: {},
}, },
_code: "", _code: "",
className: "",
onLoad: [],
type: "", type: "",
_instanceName: "", _instanceName: "",
_children: [], _children: [],

View File

@ -1,127 +0,0 @@
<script>
import { keys, map, includes, filter } from "lodash/fp"
import EventEditorModal from "./EventEditorModal.svelte"
import { Modal } from "@budibase/bbui"
export const EVENT_TYPE = "event"
export let component
let events = []
let selectedEvent = null
let modal
$: {
events = Object.keys(component)
// TODO: use real events
.filter(propName => ["onChange", "onClick", "onLoad"].includes(propName))
.map(propName => ({
name: propName,
handlers: component[propName] || [],
}))
}
const openModal = event => {
selectedEvent = event
modal.show()
}
</script>
<button class="newevent" on:click={() => openModal()}>
<i class="icon ri-add-circle-fill" />
Create New Event
</button>
<div class="root">
<form on:submit|preventDefault class="form-root">
{#each events as event, index}
{#if event.handlers.length > 0}
<div
class:selected={selectedEvent && selectedEvent.index === index}
class="handler-container budibase__nav-item"
on:click={() => openModal({ ...event, index })}>
<span class="event-name">{event.name}</span>
<span class="edit-text">EDIT</span>
</div>
{/if}
{/each}
</form>
</div>
<Modal bind:this={modal} width="600px">
<EventEditorModal eventOptions={events} event={selectedEvent} />
</Modal>
<style>
.root {
font-size: 10pt;
width: 100%;
}
.newevent {
cursor: pointer;
border: 1px solid var(--grey-4);
border-radius: 3px;
width: 100%;
padding: 8px 16px;
margin: 0px 0px 12px 0px;
display: flex;
justify-content: center;
align-items: center;
background: var(--background);
color: var(--ink);
font-size: 14px;
font-weight: 500;
transition: all 2ms;
}
.newevent:hover {
background: var(--grey-1);
}
.icon {
color: var(--ink);
font-size: 16px;
margin-right: 4px;
}
.form-root {
display: flex;
flex-wrap: wrap;
}
header {
display: flex;
align-items: center;
justify-content: space-between;
}
.handler-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
border: 2px solid var(--grey-1);
height: 80px;
width: 100%;
}
.event-name {
margin-top: 5px;
font-weight: bold;
font-size: 16px;
color: rgba(22, 48, 87, 0.6);
align-self: end;
}
.edit-text {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
align-self: end;
justify-self: end;
font-size: 10px;
color: rgba(35, 65, 105, 0.4);
}
.selected {
color: var(--blue);
background: var(--grey-1) !important;
}
</style>

View File

@ -1,53 +0,0 @@
<script>
import { Input, DataList, Select } from "@budibase/bbui"
import { automationStore, allScreens } from "builderStore"
export let parameter
let isOpen = false
const capitalize = s => {
if (typeof s !== "string") return ""
return s.charAt(0).toUpperCase() + s.slice(1)
}
</script>
<div class="handler-option">
{#if parameter.name === 'automation'}<span>{parameter.name}</span>{/if}
{#if parameter.name === 'automation'}
<Select on:change bind:value={parameter.value}>
<option value="" />
{#each $automationStore.automations.filter(wf => wf.live) as automation}
<option value={automation._id}>{automation.name}</option>
{/each}
</Select>
{:else if parameter.name === 'url'}
<DataList on:change bind:value={parameter.value}>
<option value="" />
{#each $allScreens as screen}
<option value={screen.routing.route}>
{screen.props._instanceName}
</option>
{/each}
</DataList>
{:else}
<Input
name={parameter.name}
label={capitalize(parameter.name)}
on:change
value={parameter.value} />
{/if}
</div>
<style>
.handler-option {
display: flex;
flex-direction: column;
}
span {
font-size: 18px;
margin-bottom: 10px;
font-weight: 500;
}
</style>

View File

@ -4,7 +4,7 @@
import Component from "./Component.svelte" import Component from "./Component.svelte"
// Keep route params up to date // Keep route params up to date
export let params export let params = {}
$: routeStore.actions.setRouteParams(params || {}) $: routeStore.actions.setRouteParams(params || {})
// Get the screen definition for the current route // Get the screen definition for the current route

View File

@ -31,8 +31,6 @@ const MAIN = {
selected: {}, selected: {},
}, },
_code: "", _code: "",
className: "",
onLoad: [],
type: "div", type: "div",
_appId: "inst_app_80b_f158d4057d2c4bedb0042d42fda8abaf", _appId: "inst_app_80b_f158d4057d2c4bedb0042d42fda8abaf",
_instanceName: "Header", _instanceName: "Header",
@ -58,12 +56,6 @@ const MAIN = {
_code: "", _code: "",
logoUrl: logoUrl:
"https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg", "https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg",
title: "",
backgroundColor: "",
color: "",
borderWidth: "",
borderColor: "",
borderStyle: "",
_appId: "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394", _appId: "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
_instanceName: "Navigation", _instanceName: "Navigation",
_children: [ _children: [
@ -88,11 +80,6 @@ const MAIN = {
url: "/", url: "/",
openInNewTab: false, openInNewTab: false,
text: "Home", text: "Home",
color: "",
hoverColor: "",
underline: false,
fontSize: "",
fontFamily: "initial",
_appId: "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394", _appId: "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
_instanceName: "Home Link", _instanceName: "Home Link",
_children: [], _children: [],
@ -143,8 +130,6 @@ const MAIN = {
selected: {}, selected: {},
}, },
_code: "", _code: "",
className: "",
onLoad: [],
}, },
} }
@ -181,13 +166,7 @@ const UNAUTHENTICATED = {
selected: {}, selected: {},
}, },
_code: "", _code: "",
loginRedirect: "",
usernameLabel: "Username",
passwordLabel: "Password",
loginButtonLabel: "Login",
buttonClass: "",
_instanceName: "Login", _instanceName: "Login",
inputClass: "",
_children: [], _children: [],
title: "Log in to {{ name }}", title: "Log in to {{ name }}",
buttonText: "Log In", buttonText: "Log In",
@ -213,8 +192,6 @@ const UNAUTHENTICATED = {
selected: {}, selected: {},
}, },
_code: "", _code: "",
className: "",
onLoad: [],
}, },
} }

View File

@ -19,8 +19,6 @@ exports.HOME_SCREEN = {
selected: {}, selected: {},
}, },
_code: "", _code: "",
className: "",
onLoad: [],
type: "div", type: "div",
_children: [ _children: [
{ {
@ -35,7 +33,6 @@ exports.HOME_SCREEN = {
selected: {}, selected: {},
}, },
_code: "", _code: "",
className: "",
text: "Welcome to your Budibase App 👋", text: "Welcome to your Budibase App 👋",
type: "h2", type: "h2",
_appId: "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394", _appId: "inst_cf8ace4_69efc0d72e6f443db2d4c902c14d9394",
@ -61,8 +58,6 @@ exports.HOME_SCREEN = {
selected: {}, selected: {},
}, },
_code: "", _code: "",
className: "",
onLoad: [],
type: "div", type: "div",
_appId: "inst_app_2cc_ca3383f896034e9295345c05f7dfca0c", _appId: "inst_app_2cc_ca3383f896034e9295345c05f7dfca0c",
_instanceName: "Video Container", _instanceName: "Video Container",

View File

@ -18,13 +18,7 @@
"description": "A basic header navigation component", "description": "A basic header navigation component",
"children": true, "children": true,
"props": { "props": {
"logoUrl": "string", "logoUrl": "string"
"title": "string",
"backgroundColor": "string",
"color": "string",
"borderWidth": "string",
"borderColor": "string",
"borderStyle": "string"
} }
}, },
"button": { "button": {
@ -32,7 +26,6 @@
"description": "an html <button />", "description": "an html <button />",
"props": { "props": {
"text": "string", "text": "string",
"className": "string",
"disabled": "bool", "disabled": "bool",
"onClick": "event" "onClick": "event"
}, },
@ -65,23 +58,8 @@
"name": "Login Control", "name": "Login Control",
"description": "A control that accepts username, password an also handles password resets", "description": "A control that accepts username, password an also handles password resets",
"props": { "props": {
"logo": "asset", "logo": "string",
"loginRedirect": "string",
"title": "string", "title": "string",
"usernameLabel": {
"type": "string",
"default": "Username"
},
"passwordLabel": {
"type": "string",
"default": "Password"
},
"loginButtonLabel": {
"type": "string",
"default": "Login"
},
"buttonClass": "string",
"inputClass": "string",
"buttonText": "string" "buttonText": "string"
}, },
"tags": [ "tags": [
@ -96,7 +74,6 @@
"bindable": "value", "bindable": "value",
"description": "An HTML input", "description": "An HTML input",
"props": { "props": {
"value": "string",
"type": { "type": {
"type": "options", "type": "options",
"options": [ "options": [
@ -122,27 +99,15 @@
"week" "week"
], ],
"default": "text" "default": "text"
}, }
"onChange": "event",
"className": "string"
}, },
"tags": [ "tags": [
"form" "form"
] ]
}, },
"option": {
"name": "Option",
"description": "An HTML <option>, to be used with <select>",
"children": false,
"props": {
"value": "string",
"text": "string"
}
},
"text": { "text": {
"name": "Text", "name": "Text",
"description": "stylable block of text", "description": "stylable block of text",
"children": false,
"props": { "props": {
"text": "string", "text": "string",
"type": { "type": {
@ -155,16 +120,6 @@
"container" "container"
] ]
}, },
"textfield": {
"name": "Textfield",
"description": "A component that allows the user to input text.",
"props": {
"label": "string",
"type": "string",
"value": "string",
"onchange": "event"
}
},
"richtext": { "richtext": {
"name": "Rich Text", "name": "Rich Text",
"description": "A component that allows the user to enter long form text.", "description": "A component that allows the user to enter long form text.",
@ -186,17 +141,6 @@
} }
} }
}, },
"datatable": {
"description": "an HTML table that fetches data from a table or view and displays it.",
"data": true,
"props": {
"datasource": "tables",
"stripeColor": "string",
"borderColor": "string",
"backgroundColor": "string",
"color": "string"
}
},
"datagrid": { "datagrid": {
"name": "Grid", "name": "Grid",
"description": "a datagrid component with functionality to add, remove and edit rows.", "description": "a datagrid component with functionality to add, remove and edit rows.",
@ -238,21 +182,6 @@
"data": true, "data": true,
"props": {} "props": {}
}, },
"datalist": {
"description": "A configurable data list that attaches to your backend tables.",
"data": true,
"props": {
"table": "tables",
"layout": {
"type": "options",
"default": "list",
"options": [
"list",
"grid"
]
}
}
},
"list": { "list": {
"name": "Repeater", "name": "Repeater",
"description": "A configurable data list that attaches to your backend tables.", "description": "A configurable data list that attaches to your backend tables.",
@ -656,8 +585,7 @@
"description": "Date Picker", "description": "Date Picker",
"bindable": "value", "bindable": "value",
"props": { "props": {
"placeholder": "string", "placeholder": "string"
"value": "string"
} }
}, },
"link": { "link": {
@ -666,36 +594,13 @@
"props": { "props": {
"url": "string", "url": "string",
"openInNewTab": "bool", "openInNewTab": "bool",
"text": "string", "text": "string"
"color": "string",
"hoverColor": "string",
"underline": "bool",
"fontSize": "string",
"fontFamily": {
"type": "options",
"default": "initial",
"styleBindingProperty": "font-family",
"options": [
"initial",
"Times New Roman",
"Georgia",
"Arial",
"Arial Black",
"Comic Sans MS",
"Impact",
"Lucida Sans Unicode"
]
}
} }
}, },
"image": { "image": {
"description": "an HTML <img> tag", "description": "an HTML <img> tag",
"props": { "props": {
"url": "string", "url": "string"
"className": "string",
"description": "string",
"height": "string",
"width": "string"
} }
}, },
"container": { "container": {
@ -703,8 +608,6 @@
"children": true, "children": true,
"description": "An element that contains and lays out other elements. e.g. <div>, <header> etc", "description": "An element that contains and lays out other elements. e.g. <div>, <header> etc",
"props": { "props": {
"className": "string",
"onLoad": "event",
"type": { "type": {
"type": "options", "type": "options",
"options": [ "options": [
@ -736,7 +639,6 @@
"name": "Heading", "name": "Heading",
"description": "An HTML H1 - H6 tag", "description": "An HTML H1 - H6 tag",
"props": { "props": {
"className": "string",
"text": "string", "text": "string",
"type": { "type": {
"type": "options", "type": "options",
@ -752,19 +654,5 @@
} }
}, },
"tags": [] "tags": []
},
"thead": {
"name": "Table Head",
"description": "an HTML <thead> tab",
"props": {
"className": "string"
}
},
"tbody": {
"name": "Table Body",
"description": "an HTML <tbody> tab",
"props": {
"className": "string"
}
} }
} }

View File

@ -4,7 +4,6 @@
const { styleable } = getContext("sdk") const { styleable } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
export let className = ""
export let type = "div" export let type = "div"
</script> </script>

View File

@ -5,7 +5,6 @@
const component = getContext("component") const component = getContext("component")
export let logoUrl export let logoUrl
export let title
const logOut = () => { const logOut = () => {
authStore.actions.logOut() authStore.actions.logOut()
@ -18,7 +17,6 @@
{#if logoUrl} {#if logoUrl}
<img class="logo" alt="logo" src={logoUrl} height="48" /> <img class="logo" alt="logo" src={logoUrl} height="48" />
{/if} {/if}
{#if title}<span>{title}</span>{/if}
</a> </a>
<div class="nav__controls"> <div class="nav__controls">
<div on:click={logOut}>Log out</div> <div on:click={logOut}>Log out</div>

View File

@ -1,10 +0,0 @@
<script>
import Input from "./Input.svelte"
export let _bb
export let label = ""
export let value = ""
export let onchange = () => {}
</script>
<Input type="text" {_bb} {label} {value} {onchange} />

View File

@ -5,7 +5,6 @@ export { default as container } from "./Container.svelte"
export { default as text } from "./Text.svelte" export { default as text } from "./Text.svelte"
export { default as heading } from "./Heading.svelte" export { default as heading } from "./Heading.svelte"
export { default as input } from "./Input.svelte" export { default as input } from "./Input.svelte"
export { default as textfield } from "./Textfield.svelte"
export { default as richtext } from "./RichText.svelte" export { default as richtext } from "./RichText.svelte"
export { default as button } from "./Button.svelte" export { default as button } from "./Button.svelte"
export { default as login } from "./Login.svelte" export { default as login } from "./Login.svelte"