From d226e65a18e5ba33597bb5a0ffb39859ddc16199 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 28 Jun 2024 12:54:46 +0100 Subject: [PATCH 1/4] Fix weird behaviour when adding rows if you have multiple pages of data --- packages/frontend-core/src/components/grid/layout/NewRow.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend-core/src/components/grid/layout/NewRow.svelte b/packages/frontend-core/src/components/grid/layout/NewRow.svelte index 1da8f7a63e..0b27a5d135 100644 --- a/packages/frontend-core/src/components/grid/layout/NewRow.svelte +++ b/packages/frontend-core/src/components/grid/layout/NewRow.svelte @@ -103,7 +103,7 @@ // If we don't have a next page then we're at the bottom and can scroll to // the max available offset - else { + if (!$hasNextPage) { scroll.update(state => ({ ...state, top: $maxScrollTop, From 7a4336a4a0f566f68aeb6ad3f2f1f249bbd31b78 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 28 Jun 2024 13:19:35 +0100 Subject: [PATCH 2/4] Quick fix to allow case sensitive versions of the prohibited columns, this is allowed on the backend and many apps like this exist, there isn't really any reason to disallow this anymore. --- .../backend/DataTable/modals/CreateEditColumn.svelte | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index d79eedd194..e1ef6f1036 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -495,11 +495,7 @@ newError.name = `Column name cannot start with an underscore.` } else if (fieldInfo.name && !fieldInfo.name.match(ValidColumnNameRegex)) { newError.name = `Illegal character; must be alpha-numeric.` - } else if ( - prohibited.some( - name => fieldInfo?.name?.toLowerCase() === name.toLowerCase() - ) - ) { + } else if (prohibited.some(name => fieldInfo?.name === name)) { newError.name = `${prohibited.join( ", " )} are not allowed as column names - case insensitive.` From 55440dca4a57d33dd62375a3c068279ccf8ecf4f Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 28 Jun 2024 12:30:09 +0000 Subject: [PATCH 3/4] Bump version to 2.29.4 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 32b7d8f766..c218525324 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.29.3", + "version": "2.29.4", "npmClient": "yarn", "packages": [ "packages/*", From c417a5e627a78c35e1b781ef1d3f0486b5ebaf4d Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 28 Jun 2024 14:18:15 +0100 Subject: [PATCH 4/4] Replace multiple spaces in bindings with one space (#14018) * replace multiple spaces in bindings with one space * add some tests and update regex to account for strings * update regex to character based approach * simplify regex to only look for spaces after {{ --------- Co-authored-by: Michael Drury --- .../src/processors/preprocessor.ts | 4 ++++ packages/string-templates/test/basic.spec.ts | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/packages/string-templates/src/processors/preprocessor.ts b/packages/string-templates/src/processors/preprocessor.ts index 010c259e12..5e96336e32 100644 --- a/packages/string-templates/src/processors/preprocessor.ts +++ b/packages/string-templates/src/processors/preprocessor.ts @@ -7,6 +7,7 @@ export const PreprocessorNames = { SWAP_TO_DOT: "swap-to-dot-notation", FIX_FUNCTIONS: "fix-functions", FINALISE: "finalise", + NORMALIZE_SPACES: "normalize-spaces", } class Preprocessor { @@ -50,6 +51,9 @@ export const processors = [ return statement }), + new Preprocessor(PreprocessorNames.NORMALIZE_SPACES, (statement: string) => { + return statement.replace(/{{(\s{2,})/g, "{{ ") + }), new Preprocessor( PreprocessorNames.FINALISE, (statement: string, opts: { noHelpers: any }) => { diff --git a/packages/string-templates/test/basic.spec.ts b/packages/string-templates/test/basic.spec.ts index ddea54c2bf..24a19131f4 100644 --- a/packages/string-templates/test/basic.spec.ts +++ b/packages/string-templates/test/basic.spec.ts @@ -320,3 +320,21 @@ describe("should leave HBS blocks if not found using option", () => { expect(output).toBe("{{ a }}, 1") }) }) + +describe("check multiple space behaviour", () => { + it("should remove whitespace and use the helper correctly", async () => { + const output = await processString("{{ add num1 num2 }}", { + num1: 1, + num2: 2, + }) + expect(output).toEqual("3") + }) + + it("should ensure that whitespace within a string is respected", async () => { + const output = await processString("{{ trimRight 'test string ' }}", { + num1: 1, + num2: 2, + }) + expect(output).toEqual("test string") + }) +})