PR feedback, signature to signature single
This commit is contained in:
parent
c45ae63742
commit
37dd75823f
|
@ -364,7 +364,7 @@
|
|||
value.customType !== "cron" &&
|
||||
value.customType !== "triggerSchema" &&
|
||||
value.customType !== "automationFields" &&
|
||||
value.type !== "signature" &&
|
||||
value.type !== "signature_single" &&
|
||||
value.type !== "attachment" &&
|
||||
value.type !== "attachment_single"
|
||||
)
|
||||
|
@ -457,7 +457,7 @@
|
|||
value={inputData[key]}
|
||||
options={Object.keys(table?.schema || {})}
|
||||
/>
|
||||
{:else if value.type === "attachment" || value.type === "signature"}
|
||||
{:else if value.type === "attachment" || value.type === "signature_single"}
|
||||
<div class="attachment-field-wrapper">
|
||||
<div class="label-wrapper">
|
||||
<Label>{label}</Label>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
let attachmentTypes = [
|
||||
FieldType.ATTACHMENTS,
|
||||
FieldType.ATTACHMENT_SINGLE,
|
||||
FieldType.SIGNATURE,
|
||||
FieldType.SIGNATURE_SINGLE,
|
||||
]
|
||||
|
||||
$: {
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
return clone
|
||||
})
|
||||
|
||||
let attachmentTypes = [
|
||||
FieldType.ATTACHMENTS,
|
||||
FieldType.ATTACHMENT_SINGLE,
|
||||
FieldType.SIGNATURE_SINGLE,
|
||||
]
|
||||
|
||||
function schemaHasOptions(schema) {
|
||||
return !!schema.constraints?.inclusion?.length
|
||||
}
|
||||
|
@ -30,7 +36,7 @@
|
|||
|
||||
if (
|
||||
(schema.type === FieldType.ATTACHMENT_SINGLE ||
|
||||
schema.type === FieldType.SIGNATURE) &&
|
||||
schema.type === FieldType.SIGNATURE_SINGLE) &&
|
||||
Object.keys(keyValueObj).length === 0
|
||||
) {
|
||||
return []
|
||||
|
@ -101,7 +107,7 @@
|
|||
on:change={e => onChange(e, field)}
|
||||
useLabel={false}
|
||||
/>
|
||||
{:else if schema.type === FieldType.ATTACHMENTS || schema.type === FieldType.ATTACHMENT_SINGLE || schema.type === FieldType.SIGNATURE}
|
||||
{:else if attachmentTypes.includes(schema.type)}
|
||||
<div class="attachment-field-spacinng">
|
||||
<KeyValueBuilder
|
||||
on:change={e =>
|
||||
|
@ -109,7 +115,7 @@
|
|||
{
|
||||
detail:
|
||||
schema.type === FieldType.ATTACHMENT_SINGLE ||
|
||||
schema.type === FieldType.SIGNATURE
|
||||
schema.type === FieldType.SIGNATURE_SINGLE
|
||||
? e.detail.length > 0
|
||||
? {
|
||||
url: e.detail[0].name,
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
}}
|
||||
maximum={1}
|
||||
/>
|
||||
{:else if type === "signature"}
|
||||
{:else if type === "signature_single"}
|
||||
<div class="signature">
|
||||
<Label>{label}</Label>
|
||||
<div class="sig-wrap" class:display={value}>
|
||||
|
|
|
@ -9,7 +9,7 @@ const MAX_DEPTH = 1
|
|||
const TYPES_TO_SKIP = [
|
||||
FieldType.FORMULA,
|
||||
FieldType.LONGFORM,
|
||||
FieldType.SIGNATURE,
|
||||
FieldType.SIGNATURE_SINGLE,
|
||||
FieldType.ATTACHMENTS,
|
||||
//https://github.com/Budibase/budibase/issues/3030
|
||||
FieldType.INTERNAL,
|
||||
|
|
|
@ -412,7 +412,7 @@
|
|||
FIELDS.FORMULA,
|
||||
FIELDS.JSON,
|
||||
FIELDS.BARCODEQR,
|
||||
FIELDS.SIGNATURE,
|
||||
FIELDS.SIGNATURE_SINGLE,
|
||||
FIELDS.BIGINT,
|
||||
FIELDS.AUTO,
|
||||
]
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
},
|
||||
{
|
||||
label: "Signature",
|
||||
value: FieldType.SIGNATURE,
|
||||
value: FieldType.SIGNATURE_SINGLE,
|
||||
},
|
||||
{
|
||||
label: "Attachment list",
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
let attachmentTypes = [
|
||||
FieldType.ATTACHMENT_SINGLE,
|
||||
FieldType.ATTACHMENTS,
|
||||
FieldType.SIGNATURE,
|
||||
FieldType.SIGNATURE_SINGLE,
|
||||
]
|
||||
|
||||
$: readableValue = runtimeToReadableBinding(bindings, value)
|
||||
|
@ -111,7 +111,7 @@
|
|||
boolean: isValidBoolean,
|
||||
attachment: false,
|
||||
attachment_single: false,
|
||||
signature: false,
|
||||
signature_single: false,
|
||||
}
|
||||
|
||||
const isValid = value => {
|
||||
|
@ -133,7 +133,7 @@
|
|||
"bigint",
|
||||
"barcodeqr",
|
||||
"attachment",
|
||||
"signature",
|
||||
"signature_single",
|
||||
"attachment_single",
|
||||
].includes(type)
|
||||
) {
|
||||
|
|
|
@ -76,7 +76,7 @@ const componentMap = {
|
|||
"field/array": FormFieldSelect,
|
||||
"field/json": FormFieldSelect,
|
||||
"field/barcodeqr": FormFieldSelect,
|
||||
"field/signature": FormFieldSelect,
|
||||
"field/signature_single": FormFieldSelect,
|
||||
"field/bb_reference": FormFieldSelect,
|
||||
// Some validation types are the same as others, so not all types are
|
||||
// explicitly listed here. e.g. options uses string validation
|
||||
|
@ -87,7 +87,7 @@ const componentMap = {
|
|||
"validation/datetime": ValidationEditor,
|
||||
"validation/attachment": ValidationEditor,
|
||||
"validation/attachment_single": ValidationEditor,
|
||||
"validation/signature": ValidationEditor,
|
||||
"validation/signature_single": ValidationEditor,
|
||||
"validation/link": ValidationEditor,
|
||||
"validation/bb_reference": ValidationEditor,
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ export const FieldTypeToComponentMap = {
|
|||
[FieldType.BOOLEAN]: "booleanfield",
|
||||
[FieldType.LONGFORM]: "longformfield",
|
||||
[FieldType.DATETIME]: "datetimefield",
|
||||
[FieldType.SIGNATURE]: "signaturefield",
|
||||
[FieldType.SIGNATURE_SINGLE]: "signaturesinglefield",
|
||||
[FieldType.ATTACHMENTS]: "attachmentfield",
|
||||
[FieldType.ATTACHMENT_SINGLE]: "attachmentsinglefield",
|
||||
[FieldType.LINK]: "relationshipfield",
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
Constraints.MaxUploadSize,
|
||||
],
|
||||
["attachment_single"]: [Constraints.Required, Constraints.MaxUploadSize],
|
||||
["signature"]: [Constraints.Required],
|
||||
["signature_single"]: [Constraints.Required],
|
||||
["link"]: [
|
||||
Constraints.Required,
|
||||
Constraints.Contains,
|
||||
|
|
|
@ -127,9 +127,9 @@ export const FIELDS = {
|
|||
presence: false,
|
||||
},
|
||||
},
|
||||
SIGNATURE: {
|
||||
SIGNATURE_SINGLE: {
|
||||
name: "Signature",
|
||||
type: FieldType.SIGNATURE,
|
||||
type: FieldType.SIGNATURE_SINGLE,
|
||||
icon: "AnnotatePen",
|
||||
constraints: {
|
||||
presence: false,
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
"multifieldselect",
|
||||
"s3upload",
|
||||
"codescanner",
|
||||
"signaturefield",
|
||||
"signaturesinglefield",
|
||||
"bbreferencesinglefield",
|
||||
"bbreferencefield"
|
||||
]
|
||||
|
|
|
@ -4107,7 +4107,7 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"signaturefield": {
|
||||
"signaturesinglefield": {
|
||||
"name": "Signature",
|
||||
"icon": "AnnotatePen",
|
||||
"styles": ["size"],
|
||||
|
@ -4117,7 +4117,7 @@
|
|||
},
|
||||
"settings": [
|
||||
{
|
||||
"type": "field/signature",
|
||||
"type": "field/signature_single",
|
||||
"label": "Field",
|
||||
"key": "field",
|
||||
"required": true
|
||||
|
@ -4150,7 +4150,7 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"type": "validation/signature",
|
||||
"type": "validation/signature_single",
|
||||
"label": "Validation",
|
||||
"key": "validation"
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
[FieldType.BOOLEAN]: "booleanfield",
|
||||
[FieldType.LONGFORM]: "longformfield",
|
||||
[FieldType.DATETIME]: "datetimefield",
|
||||
[FieldType.SIGNATURE]: "signaturefield",
|
||||
[FieldType.SIGNATURE_SINGLE]: "signaturesinglefield",
|
||||
[FieldType.ATTACHMENTS]: "attachmentfield",
|
||||
[FieldType.ATTACHMENT_SINGLE]: "attachmentsinglefield",
|
||||
[FieldType.LINK]: "relationshipfield",
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
{validation}
|
||||
{span}
|
||||
{helpText}
|
||||
type="signature"
|
||||
type="signature_single"
|
||||
bind:fieldState
|
||||
bind:fieldApi
|
||||
bind:fieldSchema
|
||||
|
|
|
@ -16,6 +16,6 @@ export { default as formstep } from "./FormStep.svelte"
|
|||
export { default as jsonfield } from "./JSONField.svelte"
|
||||
export { default as s3upload } from "./S3Upload.svelte"
|
||||
export { default as codescanner } from "./CodeScannerField.svelte"
|
||||
export { default as signaturefield } from "./SignatureField.svelte"
|
||||
export { default as signaturesinglefield } from "./SignatureField.svelte"
|
||||
export { default as bbreferencefield } from "./BBReferenceField.svelte"
|
||||
export { default as bbreferencesinglefield } from "./BBReferenceSingleField.svelte"
|
||||
|
|
|
@ -201,7 +201,10 @@ const parseType = (value, type) => {
|
|||
}
|
||||
|
||||
// Parse attachment/signature single, treating no key as null
|
||||
if (type === FieldTypes.ATTACHMENT_SINGLE || type === FieldTypes.SIGNATURE) {
|
||||
if (
|
||||
type === FieldTypes.ATTACHMENT_SINGLE ||
|
||||
type === FieldTypes.SIGNATURE_SINGLE
|
||||
) {
|
||||
if (!value?.key) {
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
export let readonly = false
|
||||
export let api
|
||||
export let invertX = false
|
||||
export let invertY = false
|
||||
|
||||
const { API, notifications, props } = getContext("grid")
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ const TypeComponentMap = {
|
|||
[FieldType.OPTIONS]: OptionsCell,
|
||||
[FieldType.DATETIME]: DateCell,
|
||||
[FieldType.BARCODEQR]: TextCell,
|
||||
[FieldType.SIGNATURE]: SignatureCell,
|
||||
[FieldType.SIGNATURE_SINGLE]: SignatureCell,
|
||||
[FieldType.LONGFORM]: LongFormCell,
|
||||
[FieldType.ARRAY]: MultiSelectCell,
|
||||
[FieldType.NUMBER]: NumberCell,
|
||||
|
|
|
@ -121,7 +121,7 @@ export const TypeIconMap = {
|
|||
[FieldType.OPTIONS]: "Dropdown",
|
||||
[FieldType.DATETIME]: "Calendar",
|
||||
[FieldType.BARCODEQR]: "Camera",
|
||||
[FieldType.SIGNATURE]: "AnnotatePen",
|
||||
[FieldType.SIGNATURE_SINGLE]: "AnnotatePen",
|
||||
[FieldType.LONGFORM]: "TextAlignLeft",
|
||||
[FieldType.ARRAY]: "Duplicate",
|
||||
[FieldType.NUMBER]: "123",
|
||||
|
|
|
@ -310,7 +310,7 @@ describe.each([
|
|||
constraints: { type: "array", presence: false },
|
||||
}
|
||||
const signature: FieldSchema = {
|
||||
type: FieldType.SIGNATURE,
|
||||
type: FieldType.SIGNATURE_SINGLE,
|
||||
name: "signature",
|
||||
constraints: { presence: false },
|
||||
}
|
||||
|
@ -982,7 +982,7 @@ describe.each([
|
|||
await coreAttachmentEnrichment(
|
||||
{
|
||||
signature: {
|
||||
type: FieldType.SIGNATURE,
|
||||
type: FieldType.SIGNATURE_SINGLE,
|
||||
name: "signature",
|
||||
constraints: { presence: false },
|
||||
},
|
||||
|
|
|
@ -114,7 +114,7 @@ export async function sendAutomationAttachmentsToStorage(
|
|||
if (
|
||||
schema?.type === FieldType.ATTACHMENTS ||
|
||||
schema?.type === FieldType.ATTACHMENT_SINGLE ||
|
||||
schema?.type === FieldType.SIGNATURE
|
||||
schema?.type === FieldType.SIGNATURE_SINGLE
|
||||
) {
|
||||
attachmentRows[prop] = value
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ function generateSchema(
|
|||
break
|
||||
case FieldType.ATTACHMENTS:
|
||||
case FieldType.ATTACHMENT_SINGLE:
|
||||
case FieldType.SIGNATURE:
|
||||
case FieldType.SIGNATURE_SINGLE:
|
||||
case FieldType.AUTO:
|
||||
case FieldType.JSON:
|
||||
case FieldType.INTERNAL:
|
||||
|
|
|
@ -72,7 +72,7 @@ const isTypeAllowed: Record<FieldType, boolean> = {
|
|||
[FieldType.JSON]: false,
|
||||
[FieldType.INTERNAL]: false,
|
||||
[FieldType.BIGINT]: false,
|
||||
[FieldType.SIGNATURE]: false,
|
||||
[FieldType.SIGNATURE_SINGLE]: false,
|
||||
}
|
||||
|
||||
const ALLOWED_TYPES = Object.entries(isTypeAllowed)
|
||||
|
|
|
@ -381,7 +381,7 @@ function copyExistingPropsOver(
|
|||
case FieldType.ARRAY:
|
||||
case FieldType.ATTACHMENTS:
|
||||
case FieldType.ATTACHMENT_SINGLE:
|
||||
case FieldType.SIGNATURE:
|
||||
case FieldType.SIGNATURE_SINGLE:
|
||||
case FieldType.JSON:
|
||||
case FieldType.BB_REFERENCE:
|
||||
case FieldType.BB_REFERENCE_SINGLE:
|
||||
|
|
|
@ -69,7 +69,7 @@ export async function updateAttachmentColumns(prodAppId: string, db: Database) {
|
|||
)
|
||||
} else if (
|
||||
(columnType === FieldType.ATTACHMENT_SINGLE ||
|
||||
columnType === FieldType.SIGNATURE) &&
|
||||
columnType === FieldType.SIGNATURE_SINGLE) &&
|
||||
row[column]
|
||||
) {
|
||||
row[column] = rewriteAttachmentUrl(prodAppId, row[column])
|
||||
|
|
|
@ -33,7 +33,7 @@ export async function getRowsWithAttachments(appId: string, table: Table) {
|
|||
if (
|
||||
column.type === FieldType.ATTACHMENTS ||
|
||||
column.type === FieldType.ATTACHMENT_SINGLE ||
|
||||
column.type === FieldType.SIGNATURE
|
||||
column.type === FieldType.SIGNATURE_SINGLE
|
||||
) {
|
||||
attachmentCols.push(key)
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ const FieldTypeMap: Record<FieldType, SQLiteType> = {
|
|||
[FieldType.BARCODEQR]: SQLiteType.BLOB,
|
||||
[FieldType.ATTACHMENTS]: SQLiteType.BLOB,
|
||||
[FieldType.ATTACHMENT_SINGLE]: SQLiteType.BLOB,
|
||||
[FieldType.SIGNATURE]: SQLiteType.BLOB,
|
||||
[FieldType.SIGNATURE_SINGLE]: SQLiteType.BLOB,
|
||||
[FieldType.ARRAY]: SQLiteType.BLOB,
|
||||
[FieldType.LINK]: SQLiteType.BLOB,
|
||||
[FieldType.BIGINT]: SQLiteType.TEXT,
|
||||
|
|
|
@ -85,7 +85,7 @@ describe("should be able to re-write attachment URLs", () => {
|
|||
const { rows, db } = await coreBehaviour(
|
||||
{
|
||||
signature: {
|
||||
type: FieldType.SIGNATURE,
|
||||
type: FieldType.SIGNATURE_SINGLE,
|
||||
name: "signature",
|
||||
},
|
||||
otherCol: {
|
||||
|
|
|
@ -32,7 +32,7 @@ export class AttachmentCleanup {
|
|||
if (
|
||||
type !== FieldType.ATTACHMENTS &&
|
||||
type !== FieldType.ATTACHMENT_SINGLE &&
|
||||
type !== FieldType.SIGNATURE
|
||||
type !== FieldType.SIGNATURE_SINGLE
|
||||
) {
|
||||
return []
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ export class AttachmentCleanup {
|
|||
if (
|
||||
schema.type !== FieldType.ATTACHMENTS &&
|
||||
schema.type !== FieldType.ATTACHMENT_SINGLE &&
|
||||
schema.type !== FieldType.SIGNATURE
|
||||
schema.type !== FieldType.SIGNATURE_SINGLE
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ export class AttachmentCleanup {
|
|||
if (
|
||||
schema.type !== FieldType.ATTACHMENTS &&
|
||||
schema.type !== FieldType.ATTACHMENT_SINGLE &&
|
||||
schema.type !== FieldType.SIGNATURE
|
||||
schema.type !== FieldType.SIGNATURE_SINGLE
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ export class AttachmentCleanup {
|
|||
if (
|
||||
schema.type !== FieldType.ATTACHMENTS &&
|
||||
schema.type !== FieldType.ATTACHMENT_SINGLE &&
|
||||
schema.type !== FieldType.SIGNATURE
|
||||
schema.type !== FieldType.SIGNATURE_SINGLE
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ export async function inputProcessing(
|
|||
}
|
||||
} else if (
|
||||
field.type === FieldType.ATTACHMENT_SINGLE ||
|
||||
field.type === FieldType.SIGNATURE
|
||||
field.type === FieldType.SIGNATURE_SINGLE
|
||||
) {
|
||||
const attachment = clonedRow[key]
|
||||
if (attachment?.url) {
|
||||
|
@ -234,7 +234,7 @@ export async function outputProcessing<T extends Row[] | Row>(
|
|||
if (
|
||||
column.type === FieldType.ATTACHMENTS ||
|
||||
column.type === FieldType.ATTACHMENT_SINGLE ||
|
||||
column.type === FieldType.SIGNATURE
|
||||
column.type === FieldType.SIGNATURE_SINGLE
|
||||
) {
|
||||
for (let row of enriched) {
|
||||
if (row[property] == null) {
|
||||
|
|
|
@ -35,7 +35,11 @@ const mockedDeleteFiles = objectStore.deleteFiles as jest.MockedFunction<
|
|||
|
||||
const rowGenerators: [
|
||||
string,
|
||||
FieldType.ATTACHMENT_SINGLE | FieldType.ATTACHMENTS | FieldType.SIGNATURE,
|
||||
(
|
||||
| FieldType.ATTACHMENT_SINGLE
|
||||
| FieldType.ATTACHMENTS
|
||||
| FieldType.SIGNATURE_SINGLE
|
||||
),
|
||||
string,
|
||||
(fileKey?: string) => Row
|
||||
][] = [
|
||||
|
@ -71,7 +75,7 @@ const rowGenerators: [
|
|||
],
|
||||
[
|
||||
"row with a single signature column",
|
||||
FieldType.SIGNATURE,
|
||||
FieldType.SIGNATURE_SINGLE,
|
||||
"signature",
|
||||
function rowWithSignature(): Row {
|
||||
return {
|
||||
|
@ -102,7 +106,7 @@ describe.each(rowGenerators)(
|
|||
},
|
||||
signature: {
|
||||
name: "signature",
|
||||
type: FieldType.SIGNATURE,
|
||||
type: FieldType.SIGNATURE_SINGLE,
|
||||
constraints: {},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -152,7 +152,7 @@ export function parse(rows: Rows, schema: TableSchema): Rows {
|
|||
} else if (
|
||||
(columnType === FieldType.ATTACHMENTS ||
|
||||
columnType === FieldType.ATTACHMENT_SINGLE ||
|
||||
columnType === FieldType.SIGNATURE) &&
|
||||
columnType === FieldType.SIGNATURE_SINGLE) &&
|
||||
typeof columnData === "string"
|
||||
) {
|
||||
parsedRow[columnName] = parseCsvExport(columnData)
|
||||
|
|
|
@ -15,7 +15,7 @@ const allowDisplayColumnByType: Record<FieldType, boolean> = {
|
|||
[FieldType.ARRAY]: false,
|
||||
[FieldType.ATTACHMENTS]: false,
|
||||
[FieldType.ATTACHMENT_SINGLE]: false,
|
||||
[FieldType.SIGNATURE]: false,
|
||||
[FieldType.SIGNATURE_SINGLE]: false,
|
||||
[FieldType.LINK]: false,
|
||||
[FieldType.JSON]: false,
|
||||
[FieldType.BB_REFERENCE]: false,
|
||||
|
@ -34,11 +34,10 @@ const allowSortColumnByType: Record<FieldType, boolean> = {
|
|||
[FieldType.BIGINT]: true,
|
||||
[FieldType.BOOLEAN]: true,
|
||||
[FieldType.JSON]: true,
|
||||
|
||||
[FieldType.FORMULA]: false,
|
||||
[FieldType.ATTACHMENTS]: false,
|
||||
[FieldType.ATTACHMENT_SINGLE]: false,
|
||||
[FieldType.SIGNATURE]: false,
|
||||
[FieldType.SIGNATURE_SINGLE]: false,
|
||||
[FieldType.ARRAY]: false,
|
||||
[FieldType.LINK]: false,
|
||||
[FieldType.BB_REFERENCE]: false,
|
||||
|
|
|
@ -97,7 +97,7 @@ export enum FieldType {
|
|||
* a JSON type, called Signature within Budibase. This type functions much the same as ATTACHMENTS but restricted
|
||||
* only to signatures.
|
||||
*/
|
||||
SIGNATURE = "signature",
|
||||
SIGNATURE_SINGLE = "signature_single",
|
||||
/**
|
||||
* a string type, this allows representing very large integers, but they are held/managed within Budibase as
|
||||
* strings. When stored in external databases Budibase will attempt to use a real big integer type and depend
|
||||
|
|
Loading…
Reference in New Issue