Merge branch 'develop' of github.com:Budibase/budibase into develop
This commit is contained in:
commit
6414614312
|
@ -9,6 +9,7 @@
|
||||||
export let text = null
|
export let text = null
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
export let error = null
|
export let error = null
|
||||||
|
export let size = "M"
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const onChange = e => {
|
const onChange = e => {
|
||||||
|
@ -18,5 +19,5 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Field {label} {labelPosition} {error}>
|
<Field {label} {labelPosition} {error}>
|
||||||
<Checkbox {error} {disabled} {text} {value} on:change={onChange} />
|
<Checkbox {error} {disabled} {text} {value} {size} on:change={onChange} />
|
||||||
</Field>
|
</Field>
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
export let id = null
|
export let id = null
|
||||||
export let text = null
|
export let text = null
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
|
export let size = null
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const onChange = event => {
|
const onChange = event => {
|
||||||
|
@ -16,7 +17,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<label
|
<label
|
||||||
class="spectrum-Checkbox spectrum-Checkbox--sizeM spectrum-Checkbox--emphasized"
|
class="spectrum-Checkbox spectrum-Checkbox--size{size} spectrum-Checkbox--emphasized"
|
||||||
class:is-invalid={!!error}
|
class:is-invalid={!!error}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
|
|
|
@ -27,6 +27,7 @@ module.exports.definition = {
|
||||||
requestMethod: "POST",
|
requestMethod: "POST",
|
||||||
url: "http://",
|
url: "http://",
|
||||||
requestBody: "{}",
|
requestBody: "{}",
|
||||||
|
headers: "{}",
|
||||||
},
|
},
|
||||||
schema: {
|
schema: {
|
||||||
inputs: {
|
inputs: {
|
||||||
|
@ -45,6 +46,11 @@ module.exports.definition = {
|
||||||
title: "JSON Body",
|
title: "JSON Body",
|
||||||
customType: "wide",
|
customType: "wide",
|
||||||
},
|
},
|
||||||
|
headers: {
|
||||||
|
type: "string",
|
||||||
|
title: "Headers",
|
||||||
|
customType: "wide",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
required: ["requestMethod", "url"],
|
required: ["requestMethod", "url"],
|
||||||
},
|
},
|
||||||
|
@ -65,7 +71,7 @@ module.exports.definition = {
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.run = async function ({ inputs }) {
|
module.exports.run = async function ({ inputs }) {
|
||||||
let { requestMethod, url, requestBody } = inputs
|
let { requestMethod, url, requestBody, headers } = inputs
|
||||||
if (!url.startsWith("http")) {
|
if (!url.startsWith("http")) {
|
||||||
url = `http://${url}`
|
url = `http://${url}`
|
||||||
}
|
}
|
||||||
|
@ -84,6 +90,15 @@ module.exports.run = async function ({ inputs }) {
|
||||||
request.headers = {
|
request.headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (headers && headers.length !== 0) {
|
||||||
|
try {
|
||||||
|
const customHeaders = JSON.parse(headers)
|
||||||
|
request.headers = { ...request.headers, ...customHeaders }
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1868,7 +1868,6 @@
|
||||||
"booleanfield": {
|
"booleanfield": {
|
||||||
"name": "Checkbox",
|
"name": "Checkbox",
|
||||||
"icon": "Checkmark",
|
"icon": "Checkmark",
|
||||||
"styles": ["size"],
|
|
||||||
"illegalChildren": ["section"],
|
"illegalChildren": ["section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
|
@ -1886,6 +1885,30 @@
|
||||||
"label": "Text",
|
"label": "Text",
|
||||||
"key": "text"
|
"key": "text"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "select",
|
||||||
|
"label": "Size",
|
||||||
|
"key": "size",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"label": "Small",
|
||||||
|
"value": "S"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Medium",
|
||||||
|
"value": "M"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Large",
|
||||||
|
"value": "L"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Extra large",
|
||||||
|
"value": "XL"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"defaultValue": "M"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"label": "Disabled",
|
"label": "Disabled",
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
export let label
|
export let label
|
||||||
export let text
|
export let text
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
|
export let size
|
||||||
let fieldState
|
let fieldState
|
||||||
let fieldApi
|
let fieldApi
|
||||||
</script>
|
</script>
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
disabled={$fieldState.disabled}
|
disabled={$fieldState.disabled}
|
||||||
error={$fieldState.error}
|
error={$fieldState.error}
|
||||||
id={$fieldState.fieldId}
|
id={$fieldState.fieldId}
|
||||||
|
{size}
|
||||||
on:change={e => fieldApi.setValue(e.detail)}
|
on:change={e => fieldApi.setValue(e.detail)}
|
||||||
{text}
|
{text}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue