1
0
Fork 0
mirror of synced 2024-06-01 18:20:18 +12:00

Ensure field type is preserved if it contains a slash. Some additional refactoring

This commit is contained in:
Dean 2022-10-10 14:20:06 +01:00
parent cbdf7c8bd1
commit 6809bd72ed
3 changed files with 5 additions and 6 deletions

View file

@ -24,16 +24,16 @@
const getOptions = (schema, type) => {
let entries = Object.entries(schema ?? {})
let types = []
if ((type === "field/options", type === "field/barcode/qr")) {
if (type === "field/options" || type === "field/barcode/qr") {
// allow options to be used on both options and string fields
types = [type, "field/string"]
} else {
types = [type]
}
types = types.map(type => type.split("/")[1])
types = types.map(type => type.slice(type.indexOf("/") + 1))
entries = entries.filter(entry => types.includes(entry[1].type))
return entries.map(entry => entry[0])
}

View file

@ -2,13 +2,12 @@
import { ModalContent, Modal, Icon, ActionButton } from "@budibase/bbui"
import { Input, Button, StatusLight } from "@budibase/bbui"
import { Html5Qrcode } from "html5-qrcode"
import { createEventDispatcher } from "svelte"
export let value
export let disabled = false
export let allowManualEntry = false
export let scanButtonText = "Scan code"
import { createEventDispatcher } from "svelte"
const dispatch = createEventDispatcher()
let videoEle

View file

@ -41,7 +41,7 @@
on:change={handleUpdate}
disabled={fieldState.disabled}
{allowManualEntry}
{scanText}
scanButtonText={scanText}
/>
{/if}
</Field>