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:
parent
e251c914ff
commit
c09154b03e
|
@ -138,7 +138,7 @@ const fieldTypeToComponentMap = {
|
||||||
attachment: "attachmentfield",
|
attachment: "attachmentfield",
|
||||||
link: "relationshipfield",
|
link: "relationshipfield",
|
||||||
json: "jsonfield",
|
json: "jsonfield",
|
||||||
scannedcode: "codescanner",
|
barcodeqr: "codescanner",
|
||||||
}
|
}
|
||||||
|
|
||||||
export function makeDatasourceFormComponents(datasource) {
|
export function makeDatasourceFormComponents(datasource) {
|
||||||
|
|
|
@ -261,7 +261,7 @@
|
||||||
} else {
|
} else {
|
||||||
return [
|
return [
|
||||||
FIELDS.STRING,
|
FIELDS.STRING,
|
||||||
FIELDS.SCANNEDCODE,
|
FIELDS.BARCODEQR,
|
||||||
FIELDS.LONGFORM,
|
FIELDS.LONGFORM,
|
||||||
FIELDS.OPTIONS,
|
FIELDS.OPTIONS,
|
||||||
FIELDS.DATETIME,
|
FIELDS.DATETIME,
|
||||||
|
|
|
@ -125,8 +125,12 @@
|
||||||
value: FIELDS.ARRAY.type,
|
value: FIELDS.ARRAY.type,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Scanned Code",
|
label: "Barcode/QR",
|
||||||
value: FIELDS.SCANNEDCODE.type,
|
value: FIELDS.BARCODEQR.type,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Long Form Text",
|
||||||
|
value: FIELDS.LONGFORM.type,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -51,7 +51,7 @@ const componentMap = {
|
||||||
"field/link": FormFieldSelect,
|
"field/link": FormFieldSelect,
|
||||||
"field/array": FormFieldSelect,
|
"field/array": FormFieldSelect,
|
||||||
"field/json": FormFieldSelect,
|
"field/json": FormFieldSelect,
|
||||||
"field/scannedcode": FormFieldSelect,
|
"field/barcodeqr": FormFieldSelect,
|
||||||
// Some validation types are the same as others, so not all types are
|
// Some validation types are the same as others, so not all types are
|
||||||
// explicitly listed here. e.g. options uses string validation
|
// explicitly listed here. e.g. options uses string validation
|
||||||
"validation/string": ValidationEditor,
|
"validation/string": ValidationEditor,
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
let entries = Object.entries(schema ?? {})
|
let entries = Object.entries(schema ?? {})
|
||||||
|
|
||||||
let types = []
|
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
|
// allow options to be used on both options and string fields
|
||||||
types = [type, "field/string"]
|
types = [type, "field/string"]
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,9 +8,9 @@ export const FIELDS = {
|
||||||
presence: false,
|
presence: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
SCANNEDCODE: {
|
BARCODEQR: {
|
||||||
name: "Scanned Code",
|
name: "Barcode/QR",
|
||||||
type: "scannedcode",
|
type: "barcodeqr",
|
||||||
constraints: {
|
constraints: {
|
||||||
type: "string",
|
type: "string",
|
||||||
length: {},
|
length: {},
|
||||||
|
@ -157,7 +157,7 @@ export const ALLOWABLE_STRING_OPTIONS = [
|
||||||
FIELDS.STRING,
|
FIELDS.STRING,
|
||||||
FIELDS.OPTIONS,
|
FIELDS.OPTIONS,
|
||||||
FIELDS.LONGFORM,
|
FIELDS.LONGFORM,
|
||||||
FIELDS.SCANNEDCODE,
|
FIELDS.BARCODEQR,
|
||||||
]
|
]
|
||||||
export const ALLOWABLE_STRING_TYPES = ALLOWABLE_STRING_OPTIONS.map(
|
export const ALLOWABLE_STRING_TYPES = ALLOWABLE_STRING_OPTIONS.map(
|
||||||
opt => opt.type
|
opt => opt.type
|
||||||
|
|
|
@ -3158,7 +3158,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"codescanner": {
|
"codescanner": {
|
||||||
"name": "Code Scanner",
|
"name": "Barcode/QR Scanner",
|
||||||
"icon": "Camera",
|
"icon": "Camera",
|
||||||
"styles": [
|
"styles": [
|
||||||
"size"
|
"size"
|
||||||
|
@ -3169,7 +3169,7 @@
|
||||||
],
|
],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"type": "field/scannedcode",
|
"type": "field/barcodeqr",
|
||||||
"label": "Field",
|
"label": "Field",
|
||||||
"key": "field",
|
"key": "field",
|
||||||
"required": true
|
"required": true
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
export let field
|
export let field
|
||||||
export let label
|
export let label
|
||||||
export let type = "scannedcode"
|
export let type = "barcodeqr"
|
||||||
export let disabled = false
|
export let disabled = false
|
||||||
export let validation
|
export let validation
|
||||||
export let defaultValue = ""
|
export let defaultValue = ""
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export const FieldTypes = {
|
export const FieldTypes = {
|
||||||
STRING: "string",
|
STRING: "string",
|
||||||
SCANNEDCODE: "scannedcode",
|
BARCODEQR: "barcodeqr",
|
||||||
LONGFORM: "longform",
|
LONGFORM: "longform",
|
||||||
OPTIONS: "options",
|
OPTIONS: "options",
|
||||||
NUMBER: "number",
|
NUMBER: "number",
|
||||||
|
|
|
@ -31,7 +31,7 @@ exports.NoEmptyFilterStrings = [
|
||||||
|
|
||||||
exports.FieldTypes = {
|
exports.FieldTypes = {
|
||||||
STRING: "string",
|
STRING: "string",
|
||||||
SCANNEDCODE: "scannedcode",
|
BARCODEQR: "barcodeqr",
|
||||||
LONGFORM: "longform",
|
LONGFORM: "longform",
|
||||||
OPTIONS: "options",
|
OPTIONS: "options",
|
||||||
NUMBER: "number",
|
NUMBER: "number",
|
||||||
|
@ -52,7 +52,7 @@ exports.CanSwitchTypes = [
|
||||||
exports.FieldTypes.STRING,
|
exports.FieldTypes.STRING,
|
||||||
exports.FieldTypes.OPTIONS,
|
exports.FieldTypes.OPTIONS,
|
||||||
exports.FieldTypes.LONGFORM,
|
exports.FieldTypes.LONGFORM,
|
||||||
exports.FieldTypes.SCANNEDCODE,
|
exports.FieldTypes.BARCODEQR,
|
||||||
],
|
],
|
||||||
[exports.FieldTypes.BOOLEAN, exports.FieldTypes.NUMBER],
|
[exports.FieldTypes.BOOLEAN, exports.FieldTypes.NUMBER],
|
||||||
]
|
]
|
||||||
|
|
|
@ -40,7 +40,7 @@ function generateSchema(
|
||||||
case FieldTypes.STRING:
|
case FieldTypes.STRING:
|
||||||
case FieldTypes.OPTIONS:
|
case FieldTypes.OPTIONS:
|
||||||
case FieldTypes.LONGFORM:
|
case FieldTypes.LONGFORM:
|
||||||
case FieldTypes.SCANNEDCODE:
|
case FieldTypes.BARCODEQR:
|
||||||
schema.text(key)
|
schema.text(key)
|
||||||
break
|
break
|
||||||
case FieldTypes.NUMBER:
|
case FieldTypes.NUMBER:
|
||||||
|
|
|
@ -4,7 +4,7 @@ const { FieldTypes } = require("../constants")
|
||||||
const VALIDATORS = {
|
const VALIDATORS = {
|
||||||
[FieldTypes.STRING]: () => true,
|
[FieldTypes.STRING]: () => true,
|
||||||
[FieldTypes.OPTIONS]: () => true,
|
[FieldTypes.OPTIONS]: () => true,
|
||||||
[FieldTypes.SCANNEDCODE]: () => true,
|
[FieldTypes.BARCODEQR]: () => true,
|
||||||
[FieldTypes.NUMBER]: attribute => {
|
[FieldTypes.NUMBER]: attribute => {
|
||||||
// allow not to be present
|
// allow not to be present
|
||||||
if (!attribute) {
|
if (!attribute) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ const TYPE_TRANSFORM_MAP = {
|
||||||
[null]: "",
|
[null]: "",
|
||||||
[undefined]: undefined,
|
[undefined]: undefined,
|
||||||
},
|
},
|
||||||
[FieldTypes.SCANNEDCODE]: {
|
[FieldTypes.BARCODEQR]: {
|
||||||
"": "",
|
"": "",
|
||||||
[null]: "",
|
[null]: "",
|
||||||
[undefined]: undefined,
|
[undefined]: undefined,
|
||||||
|
|
Loading…
Reference in New Issue