Ensure field type is preserved if it contains a slash. Some additional refactoring
This commit is contained in:
parent
cbdf7c8bd1
commit
6809bd72ed
|
@ -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])
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
on:change={handleUpdate}
|
||||
disabled={fieldState.disabled}
|
||||
{allowManualEntry}
|
||||
{scanText}
|
||||
scanButtonText={scanText}
|
||||
/>
|
||||
{/if}
|
||||
</Field>
|
||||
|
|
Loading…
Reference in New Issue