Renamed the 'Scanned Code' field type to 'Barcode/QR'. The component is also now listed as 'Barcode/QR Scanner'. Minor fix to include longform text columns in the table csv import list

This commit is contained in:
Dean 2022-10-07 11:00:25 +01:00
parent 4b5fa6a093
commit ad13bbb25c
13 changed files with 23 additions and 19 deletions

View File

@ -138,7 +138,7 @@ const fieldTypeToComponentMap = {
attachment: "attachmentfield",
link: "relationshipfield",
json: "jsonfield",
scannedcode: "codescanner",
barcodeqr: "codescanner",
}
export function makeDatasourceFormComponents(datasource) {

View File

@ -261,7 +261,7 @@
} else {
return [
FIELDS.STRING,
FIELDS.SCANNEDCODE,
FIELDS.BARCODEQR,
FIELDS.LONGFORM,
FIELDS.OPTIONS,
FIELDS.DATETIME,

View File

@ -125,8 +125,12 @@
value: FIELDS.ARRAY.type,
},
{
label: "Scanned Code",
value: FIELDS.SCANNEDCODE.type,
label: "Barcode/QR",
value: FIELDS.BARCODEQR.type,
},
{
label: "Long Form Text",
value: FIELDS.LONGFORM.type,
},
]
</script>

View File

@ -51,7 +51,7 @@ const componentMap = {
"field/link": FormFieldSelect,
"field/array": FormFieldSelect,
"field/json": FormFieldSelect,
"field/scannedcode": FormFieldSelect,
"field/barcodeqr": FormFieldSelect,
// Some validation types are the same as others, so not all types are
// explicitly listed here. e.g. options uses string validation
"validation/string": ValidationEditor,

View File

@ -26,7 +26,7 @@
let entries = Object.entries(schema ?? {})
let types = []
if ((type === "field/options", type === "field/scannedcode")) {
if ((type === "field/options", type === "field/barcodeqr")) {
// allow options to be used on both options and string fields
types = [type, "field/string"]
} else {

View File

@ -8,9 +8,9 @@ export const FIELDS = {
presence: false,
},
},
SCANNEDCODE: {
name: "Scanned Code",
type: "scannedcode",
BARCODEQR: {
name: "Barcode/QR",
type: "barcodeqr",
constraints: {
type: "string",
length: {},
@ -157,7 +157,7 @@ export const ALLOWABLE_STRING_OPTIONS = [
FIELDS.STRING,
FIELDS.OPTIONS,
FIELDS.LONGFORM,
FIELDS.SCANNEDCODE,
FIELDS.BARCODEQR,
]
export const ALLOWABLE_STRING_TYPES = ALLOWABLE_STRING_OPTIONS.map(
opt => opt.type

View File

@ -3158,7 +3158,7 @@
]
},
"codescanner": {
"name": "Code Scanner",
"name": "Barcode/QR Scanner",
"icon": "Camera",
"styles": [
"size"
@ -3169,7 +3169,7 @@
],
"settings": [
{
"type": "field/scannedcode",
"type": "field/barcodeqr",
"label": "Field",
"key": "field",
"required": true

View File

@ -4,7 +4,7 @@
export let field
export let label
export let type = "scannedcode"
export let type = "barcodeqr"
export let disabled = false
export let validation
export let defaultValue = ""

View File

@ -1,6 +1,6 @@
export const FieldTypes = {
STRING: "string",
SCANNEDCODE: "scannedcode",
BARCODEQR: "barcodeqr",
LONGFORM: "longform",
OPTIONS: "options",
NUMBER: "number",

View File

@ -31,7 +31,7 @@ exports.NoEmptyFilterStrings = [
exports.FieldTypes = {
STRING: "string",
SCANNEDCODE: "scannedcode",
BARCODEQR: "barcodeqr",
LONGFORM: "longform",
OPTIONS: "options",
NUMBER: "number",
@ -52,7 +52,7 @@ exports.CanSwitchTypes = [
exports.FieldTypes.STRING,
exports.FieldTypes.OPTIONS,
exports.FieldTypes.LONGFORM,
exports.FieldTypes.SCANNEDCODE,
exports.FieldTypes.BARCODEQR,
],
[exports.FieldTypes.BOOLEAN, exports.FieldTypes.NUMBER],
]

View File

@ -40,7 +40,7 @@ function generateSchema(
case FieldTypes.STRING:
case FieldTypes.OPTIONS:
case FieldTypes.LONGFORM:
case FieldTypes.SCANNEDCODE:
case FieldTypes.BARCODEQR:
schema.text(key)
break
case FieldTypes.NUMBER:

View File

@ -4,7 +4,7 @@ const { FieldTypes } = require("../constants")
const VALIDATORS = {
[FieldTypes.STRING]: () => true,
[FieldTypes.OPTIONS]: () => true,
[FieldTypes.SCANNEDCODE]: () => true,
[FieldTypes.BARCODEQR]: () => true,
[FieldTypes.NUMBER]: attribute => {
// allow not to be present
if (!attribute) {

View File

@ -48,7 +48,7 @@ const TYPE_TRANSFORM_MAP = {
[null]: "",
[undefined]: undefined,
},
[FieldTypes.SCANNEDCODE]: {
[FieldTypes.BARCODEQR]: {
"": "",
[null]: "",
[undefined]: undefined,