Linting.
This commit is contained in:
parent
4a30af4082
commit
239079d973
|
@ -11,9 +11,7 @@
|
|||
on:click
|
||||
class:big={subtitle != null}
|
||||
{...$$restProps}>
|
||||
{#if icon}
|
||||
<i class={icon} />
|
||||
{/if}
|
||||
{#if icon}<i class={icon} />{/if}
|
||||
<div class="content">
|
||||
<div class="title">{title}</div>
|
||||
{#if subtitle != null}
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
<script>
|
||||
import groupBy from "lodash/fp/groupBy"
|
||||
import {
|
||||
Button,
|
||||
TextArea,
|
||||
Drawer,
|
||||
Heading,
|
||||
Spacer,
|
||||
} from "@budibase/bbui"
|
||||
import { Button, TextArea, Drawer, Heading, Spacer } from "@budibase/bbui"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
@ -38,7 +32,9 @@
|
|||
<Heading extraSmall>Tables</Heading>
|
||||
<ul>
|
||||
{#each context as { readableBinding }}
|
||||
<li on:click={() => addToText(readableBinding)}>{readableBinding}</li>
|
||||
<li on:click={() => addToText(readableBinding)}>
|
||||
{readableBinding}
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
|
@ -46,7 +42,9 @@
|
|||
<Heading extraSmall>Components</Heading>
|
||||
<ul>
|
||||
{#each instance as { readableBinding }}
|
||||
<li on:click={() => addToText(readableBinding)}>{readableBinding}</li>
|
||||
<li on:click={() => addToText(readableBinding)}>
|
||||
{readableBinding}
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
import iconData from "./icons.js"
|
||||
|
||||
const categories = Object.keys(iconData)
|
||||
const icons = Object.keys(iconData).reduce((acc, cat) => [...acc, ...Object.keys(iconData[cat])], [])
|
||||
|
||||
const icons = Object.keys(iconData).reduce(
|
||||
(acc, cat) => [...acc, ...Object.keys(iconData[cat])],
|
||||
[]
|
||||
)
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -103,20 +103,24 @@
|
|||
</div>
|
||||
|
||||
<Drawer bind:this={bindingDrawer} title="Bindings">
|
||||
<div slot="description"><Body extraSmall grey>Add the objects on the left to enrich your text.</Body></div>
|
||||
<div slot="description">
|
||||
<Body extraSmall grey>
|
||||
Add the objects on the left to enrich your text.
|
||||
</Body>
|
||||
</div>
|
||||
<heading slot="buttons">
|
||||
<Button thin blue on:click={handleClose}>Save</Button>
|
||||
</heading>
|
||||
<div slot="body">
|
||||
<BindingPanel {...handlevalueKey(value)}
|
||||
close={handleClose}
|
||||
on:update={e => (temporaryBindableValue = e.detail)}
|
||||
{bindableProperties} />
|
||||
<BindingPanel
|
||||
{...handlevalueKey(value)}
|
||||
close={handleClose}
|
||||
on:update={e => (temporaryBindableValue = e.detail)}
|
||||
{bindableProperties} />
|
||||
</div>
|
||||
</Drawer>
|
||||
|
||||
<style>
|
||||
|
||||
.property-control {
|
||||
position: relative;
|
||||
display: flex;
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
<script>
|
||||
import { Button, Icon, DropdownMenu, Spacer, Heading, Drawer } from "@budibase/bbui"
|
||||
import {
|
||||
Button,
|
||||
Icon,
|
||||
DropdownMenu,
|
||||
Spacer,
|
||||
Heading,
|
||||
Drawer,
|
||||
} from "@budibase/bbui"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { store, backendUiStore, currentAsset } from "builderStore"
|
||||
import { notifier } from "builderStore/store/notifications"
|
||||
|
@ -91,34 +98,34 @@
|
|||
</div>
|
||||
{#if value.type === 'query'}
|
||||
<i class="ri-settings-5-line" on:click={drawer.show} />
|
||||
<Drawer title={'Query'}>
|
||||
<div slot="buttons">
|
||||
<Button
|
||||
blue
|
||||
thin
|
||||
on:click={() => {
|
||||
notifier.success('Query parameters saved.')
|
||||
handleSelected(value)
|
||||
drawer.hide()
|
||||
}}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
<div class="drawer-contents" slot="body">
|
||||
<IntegrationQueryEditor
|
||||
query={value}
|
||||
schema={fetchDatasourceSchema(value)}
|
||||
editable={false} />
|
||||
<Spacer large />
|
||||
{#if value.parameters.length > 0}
|
||||
<ParameterBuilder
|
||||
bind:customParams={value.queryParams}
|
||||
parameters={queries.find(query => query._id === value._id).parameters}
|
||||
bindings={queryBindableProperties} />
|
||||
{/if}
|
||||
</div>
|
||||
</Drawer>
|
||||
{/if}
|
||||
<Drawer title={'Query'}>
|
||||
<div slot="buttons">
|
||||
<Button
|
||||
blue
|
||||
thin
|
||||
on:click={() => {
|
||||
notifier.success('Query parameters saved.')
|
||||
handleSelected(value)
|
||||
drawer.hide()
|
||||
}}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
<div class="drawer-contents" slot="body">
|
||||
<IntegrationQueryEditor
|
||||
query={value}
|
||||
schema={fetchDatasourceSchema(value)}
|
||||
editable={false} />
|
||||
<Spacer large />
|
||||
{#if value.parameters.length > 0}
|
||||
<ParameterBuilder
|
||||
bind:customParams={value.queryParams}
|
||||
parameters={queries.find(query => query._id === value._id).parameters}
|
||||
bindings={queryBindableProperties} />
|
||||
{/if}
|
||||
</div>
|
||||
</Drawer>
|
||||
{/if}
|
||||
<DropdownMenu bind:this={dropdownRight} anchor={anchorRight}>
|
||||
<div class="dropdown">
|
||||
<div class="title">
|
||||
|
|
|
@ -14,10 +14,10 @@ const saveRowHandler = async (action, context) => {
|
|||
|
||||
const deleteRowHandler = async (action, context) => {
|
||||
const { tableId, revId, rowId } = action.parameters
|
||||
const [ enrichTable, enrichRow, enrichRev ] = await Promise.all([
|
||||
const [enrichTable, enrichRow, enrichRev] = await Promise.all([
|
||||
enrichDataBinding(tableId, context),
|
||||
enrichDataBinding(rowId, context),
|
||||
enrichDataBinding(revId, context)
|
||||
enrichDataBinding(revId, context),
|
||||
])
|
||||
await deleteRow({
|
||||
tableId: enrichTable,
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
<title>{title}</title>
|
||||
<link rel="icon" type="image/png" href={favicon} />
|
||||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet">
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css"
|
||||
rel="stylesheet" />
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
|
|
|
@ -10,6 +10,4 @@
|
|||
export let color = "#000"
|
||||
</script>
|
||||
|
||||
<i
|
||||
style={`color: ${color};`}
|
||||
class={`${icon} ${size}`} />
|
||||
<i style={`color: ${color};`} class={`${icon} ${size}`} />
|
||||
|
|
|
@ -191,4 +191,4 @@ module.exports = {
|
|||
|
||||
// Whether to use watchman for file crawling
|
||||
// watchman: true,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ export default {
|
|||
name: "string-templates",
|
||||
exports: "named",
|
||||
globals: {
|
||||
"fs": "fs",
|
||||
fs: "fs",
|
||||
},
|
||||
},
|
||||
external: ["fs"],
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
const { HelperFunctions } = require("../helpers")
|
||||
const { swapStrings, isAlphaNumeric, FIND_HBS_REGEX, includesAny } = require("../utilities")
|
||||
const {
|
||||
swapStrings,
|
||||
isAlphaNumeric,
|
||||
FIND_HBS_REGEX,
|
||||
includesAny,
|
||||
} = require("../utilities")
|
||||
|
||||
function handleProcessor(string, match, fn) {
|
||||
const output = fn(match)
|
||||
|
@ -27,7 +32,9 @@ function handleSpacesInProperties(statement) {
|
|||
// find all the parts split by spaces
|
||||
const splitBySpaces = statement.split(" ")
|
||||
// remove the excluded elements
|
||||
const propertyParts = splitBySpaces.filter(part => exclusions.indexOf(part) === -1)
|
||||
const propertyParts = splitBySpaces.filter(
|
||||
part => exclusions.indexOf(part) === -1
|
||||
)
|
||||
// rebuild to get the full property
|
||||
const fullProperty = propertyParts.join(" ")
|
||||
// now work out the dot notation layers and split them up
|
||||
|
@ -35,7 +42,12 @@ function handleSpacesInProperties(statement) {
|
|||
// find the layers which need to be wrapped and wrap them
|
||||
for (let layer of propertyLayers) {
|
||||
if (layer.indexOf(" ") !== -1) {
|
||||
statement = swapStrings(statement, statement.indexOf(layer), layer.length, `[${layer}]`)
|
||||
statement = swapStrings(
|
||||
statement,
|
||||
statement.indexOf(layer),
|
||||
layer.length,
|
||||
`[${layer}]`
|
||||
)
|
||||
}
|
||||
}
|
||||
// remove the edge case of double brackets being entered (in-case user already has specified)
|
||||
|
@ -67,7 +79,7 @@ function finalise(statement) {
|
|||
* @param {string} string The string which *may* contain handlebars statements, it is OK if it does not contain any.
|
||||
* @returns {string} The string that was input with processed up handlebars statements as required.
|
||||
*/
|
||||
module.exports.preprocess = (string) => {
|
||||
module.exports.preprocess = string => {
|
||||
let preprocessors = [swapToDotNotation, handleSpacesInProperties, finalise]
|
||||
for (let processor of preprocessors) {
|
||||
// re-run search each time incase previous cleaner update/removed a match
|
||||
|
|
|
@ -12,7 +12,7 @@ const HelperFunctionBuiltin = [
|
|||
"#each",
|
||||
"#with",
|
||||
"lookup",
|
||||
"log"
|
||||
"log",
|
||||
]
|
||||
|
||||
const HelperFunctionNames = {
|
||||
|
@ -27,17 +27,19 @@ const HELPERS = [
|
|||
}),
|
||||
// this help is applied to all statements
|
||||
new Helper(HelperFunctionNames.ALL, value => {
|
||||
let text = new SafeString(unescape(value).replace(/&/g, '&'))
|
||||
let text = new SafeString(unescape(value).replace(/&/g, "&"))
|
||||
if (text == null || typeof text !== "string") {
|
||||
return text
|
||||
}
|
||||
return text.replace(/[<>]/g, tag => {
|
||||
return HTML_SWAPS[tag] || tag
|
||||
})
|
||||
})
|
||||
}),
|
||||
]
|
||||
|
||||
module.exports.HelperFunctions = Object.values(HelperFunctionNames).concat(HelperFunctionBuiltin)
|
||||
module.exports.HelperFunctions = Object.values(HelperFunctionNames).concat(
|
||||
HelperFunctionBuiltin
|
||||
)
|
||||
|
||||
module.exports.registerAll = handlebars => {
|
||||
for (let helper of HELPERS) {
|
||||
|
|
|
@ -30,8 +30,7 @@ module.exports.processObject = async (object, context) => {
|
|||
let val = object[key]
|
||||
if (typeof val === "string") {
|
||||
object[key] = await module.exports.processString(object[key], context)
|
||||
}
|
||||
else if (typeof val === "object") {
|
||||
} else if (typeof val === "object") {
|
||||
object[key] = await module.exports.processObject(object[key], context)
|
||||
}
|
||||
}
|
||||
|
@ -64,8 +63,7 @@ module.exports.processObjectSync = (object, context) => {
|
|||
let val = object[key]
|
||||
if (typeof val === "string") {
|
||||
object[key] = module.exports.processStringSync(object[key], context)
|
||||
}
|
||||
else if (typeof val === "object") {
|
||||
} else if (typeof val === "object") {
|
||||
object[key] = module.exports.processObjectSync(object[key], context)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ const ALPHA_NUMERIC_REGEX = /^[A-Za-z0-9]+$/g
|
|||
|
||||
module.exports.FIND_HBS_REGEX = /{{[^}}]*}}/g
|
||||
|
||||
module.exports.isAlphaNumeric = (char) => {
|
||||
module.exports.isAlphaNumeric = char => {
|
||||
return char.match(ALPHA_NUMERIC_REGEX)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue