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