Merge branch 'develop' of github.com:Budibase/budibase into design-collab

This commit is contained in:
Andrew Kingston 2023-07-04 10:17:51 +01:00
commit f3ecbca6b4
19 changed files with 66 additions and 57 deletions

View File

@ -1,5 +1,5 @@
{
"version": "2.7.37-alpha.4",
"version": "2.7.37-alpha.10",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -182,6 +182,15 @@
indexes,
})
dispatch("updatecolumns")
if (
saveColumn.type === LINK_TYPE &&
saveColumn.relationshipType === RelationshipTypes.MANY_TO_MANY
) {
// Fetching the new tables
tables.fetch()
// Fetching the new relationships
datasources.fetch()
}
if (originalName) {
notifications.success("Column updated successfully")
} else {

View File

@ -68,6 +68,7 @@
on:blur={() => dispatch("blur")}
{placeholder}
{error}
options={allOptions}
/>
{#if !disabled}
<div class="icon" on:click={bindingDrawer.show}>

View File

@ -20,6 +20,7 @@ import ValidationEditor from "./controls/ValidationEditor/ValidationEditor.svelt
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import ColumnEditor from "./controls/ColumnEditor/ColumnEditor.svelte"
import BasicColumnEditor from "./controls/ColumnEditor/BasicColumnEditor.svelte"
import GridColumnEditor from "./controls/ColumnEditor/GridColumnEditor.svelte"
import BarButtonList from "./controls/BarButtonList.svelte"
import FieldConfiguration from "./controls/FieldConfiguration/FieldConfiguration.svelte"
@ -47,6 +48,7 @@ const componentMap = {
fieldConfiguration: FieldConfiguration,
columns: ColumnEditor,
"columns/basic": BasicColumnEditor,
"columns/grid": GridColumnEditor,
"field/sortable": SortableFieldSelect,
"field/string": FormFieldSelect,
"field/number": FormFieldSelect,

View File

@ -43,7 +43,9 @@
title="Destination"
placeholder="/screen"
value={parameters.url}
on:change={value => (parameters.url = value.detail)}
on:change={value => {
parameters.url = value.detail ? value.detail.trim() : value.detail
}}
{bindings}
options={urlOptions}
appendBindingsAsOptions={false}
@ -55,7 +57,9 @@
title="Destination"
placeholder="/url"
value={parameters.url}
on:change={value => (parameters.url = value.detail)}
on:change={value => {
parameters.url = value.detail ? value.detail.trim() : value.detail
}}
{bindings}
/>
<div />

View File

@ -18,6 +18,7 @@
export let options = []
export let schema = {}
export let allowCellEditing = true
export let allowReorder = true
const flipDurationMs = 150
let dragDisabled = true
@ -110,6 +111,7 @@
{#each columns as column (column.id)}
<div class="column" animate:flip={{ duration: flipDurationMs }}>
<div
class:hide={!allowReorder}
class="handle"
aria-label="drag-handle"
style={dragDisabled ? "cursor: grab" : "cursor: grabbing"}
@ -193,6 +195,9 @@
display: grid;
place-items: center;
}
.handle.hide {
visibility: hidden;
}
.wide {
grid-column: 2 / -1;
}

View File

@ -13,6 +13,7 @@
export let componentInstance
export let value = []
export let allowCellEditing = true
export let allowReorder = true
const dispatch = createEventDispatcher()
@ -85,6 +86,7 @@
{options}
{schema}
{allowCellEditing}
{allowReorder}
/>
</Drawer>

View File

@ -0,0 +1,10 @@
<script>
import ColumnEditor from "./ColumnEditor.svelte"
</script>
<ColumnEditor
{...$$props}
on:change
allowCellEditing={false}
allowReorder={false}
/>

View File

@ -5248,7 +5248,7 @@
"required": true
},
{
"type": "columns/basic",
"type": "columns/grid",
"label": "Columns",
"key": "columns",
"dependsOn": "table"
@ -5274,7 +5274,7 @@
{
"type": "select",
"label": "Row height",
"key": "initialRowHeight",
"key": "fixedRowHeight",
"placeholder": "Default",
"options": [
{

View File

@ -12,7 +12,7 @@
export let initialFilter = null
export let initialSortColumn = null
export let initialSortOrder = null
export let initialRowHeight = null
export let fixedRowHeight = null
export let columns = null
const component = getContext("component")
@ -47,7 +47,7 @@
{initialFilter}
{initialSortColumn}
{initialSortOrder}
{initialRowHeight}
{fixedRowHeight}
{columnWhitelist}
{schemaOverrides}
showControls={false}

View File

@ -8,7 +8,8 @@
SmallRowHeight,
} from "../lib/constants"
const { stickyColumn, columns, rowHeight, table } = getContext("grid")
const { stickyColumn, columns, rowHeight, table, fixedRowHeight } =
getContext("grid")
// Some constants for column width options
const smallColSize = 120
@ -86,6 +87,7 @@
<div class="options">
{#each rowSizeOptions as option}
<ActionButton
disabled={$fixedRowHeight}
quiet
selected={$rowHeight === option.size}
on:click={() => changeRowHeight(option.size)}
@ -118,15 +120,15 @@
<style>
.content {
padding: 12px;
display: flex;
flex-direction: column;
gap: 16px;
}
.size {
display: flex;
flex-direction: column;
gap: 8px;
}
.size:first-child {
margin-bottom: 16px;
}
.options {
display: flex;
align-items: center;

View File

@ -43,7 +43,7 @@
export let initialFilter = null
export let initialSortColumn = null
export let initialSortOrder = null
export let initialRowHeight = null
export let fixedRowHeight = null
export let notifySuccess = null
export let notifyError = null
@ -90,7 +90,7 @@
initialFilter,
initialSortColumn,
initialSortOrder,
initialRowHeight,
fixedRowHeight,
notifySuccess,
notifyError,
})

View File

@ -10,7 +10,7 @@ export const createStores = context => {
const initialSortColumn = getProp("initialSortColumn")
const initialSortOrder = getProp("initialSortOrder")
const initialFilter = getProp("initialFilter")
const initialRowHeight = getProp("initialRowHeight")
const fixedRowHeight = getProp("fixedRowHeight")
const schemaOverrides = getProp("schemaOverrides")
const columnWhitelist = getProp("columnWhitelist")
const notifySuccess = getProp("notifySuccess")
@ -22,7 +22,7 @@ export const createStores = context => {
initialSortColumn,
initialSortOrder,
initialFilter,
initialRowHeight,
fixedRowHeight,
schemaOverrides,
columnWhitelist,
notifySuccess,

View File

@ -245,8 +245,7 @@ export const deriveStores = context => {
focusedCellId.set(`${rowId}-${erroredColumns[0]}`)
}
} else {
// Some other error - just update the current cell
validation.actions.setError(get(focusedCellId), error?.message || "Error")
get(notifications).error(error?.message || "An unknown error occurred")
}
}

View File

@ -14,7 +14,7 @@ export const createStores = context => {
const focusedCellAPI = writable(null)
const selectedRows = writable({})
const hoveredRowId = writable(null)
const rowHeight = writable(props.initialRowHeight || DefaultRowHeight)
const rowHeight = writable(props.fixedRowHeight || DefaultRowHeight)
const previousFocusedRowId = writable(null)
const gridFocused = writable(false)
const isDragging = writable(false)
@ -134,7 +134,7 @@ export const initialise = context => {
hoveredRowId,
table,
rowHeight,
initialRowHeight,
fixedRowHeight,
} = context
// Ensure we clear invalid rows from state if they disappear
@ -187,13 +187,15 @@ export const initialise = context => {
}
})
// Pull row height from table
// Pull row height from table as long as we don't have a fixed height
table.subscribe($table => {
rowHeight.set($table?.rowHeight || DefaultRowHeight)
if (!get(fixedRowHeight)) {
rowHeight.set($table?.rowHeight || DefaultRowHeight)
}
})
// Reset row height when initial row height prop changes
initialRowHeight.subscribe(height => {
fixedRowHeight.subscribe(height => {
if (height) {
rowHeight.set(height)
} else {

View File

@ -75,7 +75,7 @@
],
"numArgs": 2,
"example": "{{ multiply 10 5 }} -> 50",
"description": "<p>Return the product of <code>a</code> times <code>b</code>.</p>\n"
"description": "<p>Multiply number <code>a</code> by number <code>b</code>.</p>\n"
},
"plus": {
"args": [
@ -128,15 +128,6 @@
"numArgs": 1,
"example": "{{ sum [1, 2, 3] }} -> 6",
"description": "<p>Returns the sum of all numbers in the given array.</p>\n"
},
"times": {
"args": [
"a",
"b"
],
"numArgs": 2,
"example": "{{ times 10 5 }} -> 50",
"description": "<p>Multiply number <code>a</code> by number <code>b</code>.</p>\n"
}
},
"array": {
@ -497,19 +488,9 @@
"str"
],
"numArgs": 1,
"example": "{{ escape 'https://myurl?Hello%20There' }} -> https://myurl?Hello+There",
"example": "{{ decodeURI 'https://myurl?Hello%20There' }} -> https://myurl?=Hello There",
"description": "<p>Decode a Uniform Resource Identifier (URI) component.</p>\n"
},
"url_encode": {
"args": [],
"numArgs": 0,
"description": "<p>Alias for <a href=\"#encodeuri\">encodeURI</a>.</p>\n"
},
"url_decode": {
"args": [],
"numArgs": 0,
"description": "<p>Alias for <a href=\"#decodeuri\">decodeURI</a>.</p>\n"
},
"urlResolve": {
"args": [
"base",
@ -625,7 +606,7 @@
"length"
],
"numArgs": 2,
"example": "{{ellipsis 'foo bar baz' 7}} -> foo bar…",
"example": "{{ellipsis 'foo bar baz', 7}} -> foo bar…",
"description": "<p>Truncates a string to the specified <code>length</code>, and appends it with an elipsis, <code>…</code>.</p>\n"
},
"hyphenate": {
@ -1219,4 +1200,4 @@
"description": "<p>Produce a humanized duration left/until given an amount of time and the type of time measurement.</p>\n"
}
}
}
}

View File

@ -25,7 +25,7 @@
"manifest": "node ./scripts/gen-collection-info.js"
},
"dependencies": {
"@budibase/handlebars-helpers": "^0.11.8",
"@budibase/handlebars-helpers": "^0.11.9",
"dayjs": "^1.10.4",
"handlebars": "^4.7.6",
"handlebars-utils": "^1.0.6",

View File

@ -9,8 +9,8 @@ const marked = require("marked")
* full list of supported helpers can be found here:
* https://github.com/budibase/handlebars-helpers
*/
const DIRECTORY = fs.existsSync("node_modules") ? "." : ".."
const { join } = require("path")
const DIRECTORY = join(__dirname, "..", "..", "..")
const COLLECTIONS = [
"math",
"array",
@ -20,7 +20,7 @@ const COLLECTIONS = [
"comparison",
"object",
]
const FILENAME = `${DIRECTORY}/manifest.json`
const FILENAME = join(__dirname, "..", "manifest.json")
const outputJSON = {}
const ADDED_HELPERS = {
date: {

View File

@ -48,14 +48,6 @@ describe("test the math helpers", () => {
})
expect(parseInt(output)).toBe(2)
})
it("should be able to times", async () => {
const output = await processString("{{times a b}}", {
a: 5,
b: 5,
})
expect(parseInt(output)).toBe(25)
})
})
describe("test the array helpers", () => {