@budibase/frontend-core 2.22.17 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@budibase/frontend-core",
3
- "version": "2.22.17",
3
+ "version": "2.23.0",
4
4
  "description": "Budibase frontend core libraries used in builder and client",
5
5
  "author": "Budibase",
6
6
  "license": "MPL-2.0",
7
7
  "svelte": "src/index.js",
8
8
  "dependencies": {
9
- "@budibase/bbui": "2.22.17",
10
- "@budibase/shared-core": "2.22.17",
11
- "@budibase/types": "2.22.17",
9
+ "@budibase/bbui": "2.23.0",
10
+ "@budibase/shared-core": "2.23.0",
11
+ "@budibase/types": "2.23.0",
12
12
  "dayjs": "^1.10.8",
13
13
  "lodash": "4.17.21",
14
14
  "socket.io-client": "^4.6.1"
15
15
  },
16
- "gitHead": "49af7cfeb796003e470adf1126aefcfec3f3135f"
16
+ "gitHead": "2c4277877da1c0053f7e41ea7156758a1ef844a4"
17
17
  }
@@ -10,6 +10,7 @@
10
10
  export let invertX = false
11
11
  export let invertY = false
12
12
  export let schema
13
+ export let maximum
13
14
 
14
15
  const { API, notifications } = getContext("grid")
15
16
  const imageExtensions = ["png", "tiff", "gif", "raw", "jpg", "jpeg"]
@@ -98,7 +99,7 @@
98
99
  {value}
99
100
  compact
100
101
  on:change={e => onChange(e.detail)}
101
- maximum={schema.constraints?.length?.maximum}
102
+ maximum={maximum || schema.constraints?.length?.maximum}
102
103
  {processFiles}
103
104
  {deleteAttachments}
104
105
  {handleFileTooLarge}
@@ -0,0 +1,22 @@
1
+ <script>
2
+ import AttachmentCell from "./AttachmentCell.svelte"
3
+
4
+ export let value
5
+ export let onChange
6
+ export let api
7
+
8
+ $: arrayValue = (!Array.isArray(value) && value ? [value] : value) || []
9
+
10
+ $: onFileChange = value => {
11
+ value = value[0] || null
12
+ onChange(value)
13
+ }
14
+ </script>
15
+
16
+ <AttachmentCell
17
+ bind:api
18
+ {...$$restProps}
19
+ maximum={1}
20
+ value={arrayValue}
21
+ onChange={onFileChange}
22
+ />
@@ -11,6 +11,7 @@ import BooleanCell from "../cells/BooleanCell.svelte"
11
11
  import FormulaCell from "../cells/FormulaCell.svelte"
12
12
  import JSONCell from "../cells/JSONCell.svelte"
13
13
  import AttachmentCell from "../cells/AttachmentCell.svelte"
14
+ import AttachmentSingleCell from "../cells/AttachmentSingleCell.svelte"
14
15
  import BBReferenceCell from "../cells/BBReferenceCell.svelte"
15
16
 
16
17
  const TypeComponentMap = {
@@ -22,7 +23,8 @@ const TypeComponentMap = {
22
23
  [FieldType.ARRAY]: MultiSelectCell,
23
24
  [FieldType.NUMBER]: NumberCell,
24
25
  [FieldType.BOOLEAN]: BooleanCell,
25
- [FieldType.ATTACHMENT]: AttachmentCell,
26
+ [FieldType.ATTACHMENTS]: AttachmentCell,
27
+ [FieldType.ATTACHMENT_SINGLE]: AttachmentSingleCell,
26
28
  [FieldType.LINK]: RelationshipCell,
27
29
  [FieldType.FORMULA]: FormulaCell,
28
30
  [FieldType.JSON]: JSONCell,
@@ -1,4 +1,4 @@
1
- import { FieldType, FieldTypeSubtypes } from "@budibase/types"
1
+ import { TypeIconMap } from "../../../constants"
2
2
 
3
3
  export const getColor = (idx, opacity = 0.3) => {
4
4
  if (idx == null || idx === -1) {
@@ -7,26 +7,6 @@ export const getColor = (idx, opacity = 0.3) => {
7
7
  return `hsla(${((idx + 1) * 222) % 360}, 90%, 75%, ${opacity})`
8
8
  }
9
9
 
10
- const TypeIconMap = {
11
- [FieldType.STRING]: "Text",
12
- [FieldType.OPTIONS]: "Dropdown",
13
- [FieldType.DATETIME]: "Date",
14
- [FieldType.BARCODEQR]: "Camera",
15
- [FieldType.LONGFORM]: "TextAlignLeft",
16
- [FieldType.ARRAY]: "Dropdown",
17
- [FieldType.NUMBER]: "123",
18
- [FieldType.BOOLEAN]: "Boolean",
19
- [FieldType.ATTACHMENT]: "AppleFiles",
20
- [FieldType.LINK]: "DataCorrelated",
21
- [FieldType.FORMULA]: "Calculator",
22
- [FieldType.JSON]: "Brackets",
23
- [FieldType.BIGINT]: "TagBold",
24
- [FieldType.BB_REFERENCE]: {
25
- [FieldTypeSubtypes.BB_REFERENCE.USER]: "User",
26
- [FieldTypeSubtypes.BB_REFERENCE.USERS]: "UserGroup",
27
- },
28
- }
29
-
30
10
  export const getColumnIcon = column => {
31
11
  if (column.schema.autocolumn) {
32
12
  return "MagicWand"
package/src/constants.js CHANGED
@@ -4,6 +4,7 @@
4
4
  export { OperatorOptions, SqlNumberTypeRangeMap } from "@budibase/shared-core"
5
5
  export { Feature as Features } from "@budibase/types"
6
6
  import { BpmCorrelationKey } from "@budibase/shared-core"
7
+ import { FieldType, FieldTypeSubtypes } from "@budibase/types"
7
8
 
8
9
  // Cookie names
9
10
  export const Cookies = {
@@ -113,3 +114,27 @@ export const ContextScopes = {
113
114
  Local: "local",
114
115
  Global: "global",
115
116
  }
117
+
118
+ export const TypeIconMap = {
119
+ [FieldType.STRING]: "Text",
120
+ [FieldType.OPTIONS]: "Dropdown",
121
+ [FieldType.DATETIME]: "Calendar",
122
+ [FieldType.BARCODEQR]: "Camera",
123
+ [FieldType.LONGFORM]: "TextAlignLeft",
124
+ [FieldType.ARRAY]: "Duplicate",
125
+ [FieldType.NUMBER]: "123",
126
+ [FieldType.BOOLEAN]: "Boolean",
127
+ [FieldType.ATTACHMENTS]: "Attach",
128
+ [FieldType.ATTACHMENT_SINGLE]: "Attach",
129
+ [FieldType.LINK]: "DataCorrelated",
130
+ [FieldType.FORMULA]: "Calculator",
131
+ [FieldType.JSON]: "Brackets",
132
+ [FieldType.BIGINT]: "TagBold",
133
+ [FieldType.AUTO]: "MagicWand",
134
+ [FieldType.USER]: "User",
135
+ [FieldType.USERS]: "UserGroup",
136
+ [FieldType.BB_REFERENCE]: {
137
+ [FieldTypeSubtypes.BB_REFERENCE.USER]: "User",
138
+ [FieldTypeSubtypes.BB_REFERENCE.USERS]: "UserGroup",
139
+ },
140
+ }