@budibase/frontend-core 2.23.11 → 2.24.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 +5 -5
- package/src/api/backups.js +0 -3
- package/src/components/grid/cells/AttachmentCell.svelte +27 -28
- package/src/components/grid/cells/BBReferenceCell.svelte +6 -3
- package/src/components/grid/cells/DateCell.svelte +90 -60
- package/src/components/grid/cells/GridCell.svelte +3 -0
- package/src/components/grid/cells/HeaderCell.svelte +99 -102
- package/src/components/grid/cells/LongFormCell.svelte +30 -34
- package/src/components/grid/cells/OptionsCell.svelte +20 -35
- package/src/components/grid/cells/RelationshipCell.svelte +17 -64
- package/src/components/grid/controls/HideColumnsButton.svelte +1 -0
- package/src/components/grid/controls/MigrationModal.svelte +7 -3
- package/src/components/grid/layout/Grid.svelte +13 -7
- package/src/components/grid/layout/GridScrollWrapper.svelte +4 -0
- package/src/components/grid/layout/NewColumnButton.svelte +23 -21
- package/src/components/grid/layout/NewRow.svelte +6 -1
- package/src/components/grid/lib/constants.js +9 -4
- package/src/components/grid/lib/utils.js +7 -0
- package/src/components/grid/overlays/GridPopover.svelte +71 -0
- package/src/components/grid/overlays/KeyboardManager.svelte +1 -0
- package/src/components/grid/overlays/MenuOverlay.svelte +68 -66
- package/src/components/grid/overlays/PopoverOverlay.svelte +9 -0
- package/src/components/grid/overlays/ResizeOverlay.svelte +2 -0
- package/src/components/grid/overlays/ScrollOverlay.svelte +10 -14
- package/src/components/grid/stores/columns.js +44 -20
- package/src/components/grid/stores/menu.js +2 -2
- package/src/components/grid/stores/reorder.js +26 -16
- package/src/components/grid/stores/resize.js +13 -2
- package/src/components/grid/stores/rows.js +41 -8
- package/src/components/grid/stores/ui.js +1 -1
- package/src/components/grid/stores/viewport.js +4 -5
- package/src/constants.js +3 -3
- package/src/utils/rows.js +4 -0
|
@@ -196,6 +196,20 @@ export const createActions = context => {
|
|
|
196
196
|
// Handles validation errors from the rows API and updates local validation
|
|
197
197
|
// state, storing error messages against relevant cells
|
|
198
198
|
const handleValidationError = (rowId, error) => {
|
|
199
|
+
// If the server doesn't reply with a valid error, assume that the source
|
|
200
|
+
// of the error is the focused cell's column
|
|
201
|
+
if (!error?.json?.validationErrors && error?.message) {
|
|
202
|
+
const focusedColumn = get(focusedCellId)?.split("-")[1]
|
|
203
|
+
if (focusedColumn) {
|
|
204
|
+
error = {
|
|
205
|
+
json: {
|
|
206
|
+
validationErrors: {
|
|
207
|
+
[focusedColumn]: error.message,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
199
213
|
if (error?.json?.validationErrors) {
|
|
200
214
|
// Normal validation errors
|
|
201
215
|
const keys = Object.keys(error.json.validationErrors)
|
|
@@ -214,11 +228,19 @@ export const createActions = context => {
|
|
|
214
228
|
|
|
215
229
|
// Process errors for columns that we have
|
|
216
230
|
for (let column of erroredColumns) {
|
|
231
|
+
// Ensure we have a valid error to display
|
|
232
|
+
let err = error.json.validationErrors[column]
|
|
233
|
+
if (Array.isArray(err)) {
|
|
234
|
+
err = err[0]
|
|
235
|
+
}
|
|
236
|
+
if (typeof err !== "string" || !err.length) {
|
|
237
|
+
error = "Something went wrong"
|
|
238
|
+
}
|
|
239
|
+
// Set error against the cell
|
|
217
240
|
validation.actions.setError(
|
|
218
241
|
`${rowId}-${column}`,
|
|
219
|
-
|
|
242
|
+
Helpers.capitalise(err)
|
|
220
243
|
)
|
|
221
|
-
|
|
222
244
|
// Ensure the column is visible
|
|
223
245
|
const index = $columns.findIndex(x => x.name === column)
|
|
224
246
|
if (index !== -1 && !$columns[index].visible) {
|
|
@@ -523,6 +545,7 @@ export const initialise = context => {
|
|
|
523
545
|
previousFocusedCellId,
|
|
524
546
|
rows,
|
|
525
547
|
validation,
|
|
548
|
+
focusedCellId,
|
|
526
549
|
} = context
|
|
527
550
|
|
|
528
551
|
// Wipe the row change cache when changing row
|
|
@@ -537,12 +560,22 @@ export const initialise = context => {
|
|
|
537
560
|
|
|
538
561
|
// Ensure any unsaved changes are saved when changing cell
|
|
539
562
|
previousFocusedCellId.subscribe(async id => {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
563
|
+
if (!id) {
|
|
564
|
+
return
|
|
565
|
+
}
|
|
566
|
+
// Stop if we changed row
|
|
567
|
+
const oldRowId = id.split("-")[0]
|
|
568
|
+
const oldColumn = id.split("-")[1]
|
|
569
|
+
const newRowId = get(focusedCellId)?.split("-")[0]
|
|
570
|
+
if (oldRowId !== newRowId) {
|
|
571
|
+
return
|
|
572
|
+
}
|
|
573
|
+
// Otherwise we just changed cell in the same row
|
|
574
|
+
const hasChanges = oldColumn in (get(rowChangeCache)[oldRowId] || {})
|
|
575
|
+
const hasErrors = validation.actions.rowHasErrors(oldRowId)
|
|
576
|
+
const isSavingChanges = get(inProgressChanges)[oldRowId]
|
|
577
|
+
if (oldRowId && !hasErrors && hasChanges && !isSavingChanges) {
|
|
578
|
+
await rows.actions.applyRowChanges(oldRowId)
|
|
546
579
|
}
|
|
547
580
|
})
|
|
548
581
|
}
|
|
@@ -98,7 +98,7 @@ export const deriveStores = context => {
|
|
|
98
98
|
|
|
99
99
|
// Derive whether we should use the compact UI, depending on width
|
|
100
100
|
const compact = derived([stickyColumn, width], ([$stickyColumn, $width]) => {
|
|
101
|
-
return ($stickyColumn?.width || 0) + $width + GutterWidth <
|
|
101
|
+
return ($stickyColumn?.width || 0) + $width + GutterWidth < 800
|
|
102
102
|
})
|
|
103
103
|
|
|
104
104
|
return {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { derived } from "svelte/store"
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
MaxCellRenderWidthOverflow,
|
|
3
|
+
MaxCellRenderOverflow,
|
|
5
4
|
MinColumnWidth,
|
|
6
5
|
ScrollBarSize,
|
|
7
6
|
} from "../lib/constants"
|
|
@@ -95,11 +94,11 @@ export const deriveStores = context => {
|
|
|
95
94
|
|
|
96
95
|
// Compute the last row index with space to render popovers below it
|
|
97
96
|
const minBottom =
|
|
98
|
-
$height - ScrollBarSize * 3 -
|
|
97
|
+
$height - ScrollBarSize * 3 - MaxCellRenderOverflow + offset
|
|
99
98
|
const lastIdx = Math.floor(minBottom / $rowHeight)
|
|
100
99
|
|
|
101
100
|
// Compute the first row index with space to render popovers above it
|
|
102
|
-
const minTop =
|
|
101
|
+
const minTop = MaxCellRenderOverflow + offset
|
|
103
102
|
const firstIdx = Math.ceil(minTop / $rowHeight)
|
|
104
103
|
|
|
105
104
|
// Use the greater of the two indices so that we prefer content below,
|
|
@@ -117,7 +116,7 @@ export const deriveStores = context => {
|
|
|
117
116
|
let inversionIdx = $visibleColumns.length
|
|
118
117
|
for (let i = $visibleColumns.length - 1; i >= 0; i--, inversionIdx--) {
|
|
119
118
|
const rightEdge = $visibleColumns[i].left + $visibleColumns[i].width
|
|
120
|
-
if (rightEdge +
|
|
119
|
+
if (rightEdge + MaxCellRenderOverflow <= cutoff) {
|
|
121
120
|
break
|
|
122
121
|
}
|
|
123
122
|
}
|
package/src/constants.js
CHANGED
|
@@ -4,7 +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,
|
|
7
|
+
import { FieldType, BBReferenceFieldSubType } from "@budibase/types"
|
|
8
8
|
|
|
9
9
|
// Cookie names
|
|
10
10
|
export const Cookies = {
|
|
@@ -134,7 +134,7 @@ export const TypeIconMap = {
|
|
|
134
134
|
[FieldType.USER]: "User",
|
|
135
135
|
[FieldType.USERS]: "UserGroup",
|
|
136
136
|
[FieldType.BB_REFERENCE]: {
|
|
137
|
-
[
|
|
138
|
-
[
|
|
137
|
+
[BBReferenceFieldSubType.USER]: "User",
|
|
138
|
+
[BBReferenceFieldSubType.USERS]: "UserGroup",
|
|
139
139
|
},
|
|
140
140
|
}
|
package/src/utils/rows.js
CHANGED