don't run over all historical cells

This commit is contained in:
Martin McKeaveney 2024-10-02 16:11:52 +01:00
parent b3afbd57be
commit 2c5fe77740
3 changed files with 109 additions and 3 deletions

View File

@ -0,0 +1,106 @@
<script>
import { onMount } from "svelte"
import { clickOutside } from "@budibase/bbui"
import GridPopover from "../overlays/GridPopover.svelte"
export let value
export let focused = false
export let api
let textarea
let isOpen = false
let anchor
$: {
if (!focused) {
isOpen = false
}
}
const onKeyDown = () => {
return isOpen
}
const open = async () => {
isOpen = true
}
const close = () => {
textarea?.blur()
isOpen = false
}
onMount(() => {
api = {
focus: () => open(),
blur: () => close(),
isActive: () => isOpen,
onKeyDown,
}
})
</script>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
class="long-form-cell"
on:click={open}
bind:this={anchor}
>
<div class="value">
{value || ""}
</div>
</div>
{#if isOpen}
<GridPopover {anchor} on:close={close}>
<textarea
disabled
bind:this={textarea}
value={value || ""}
on:wheel|stopPropagation
spellcheck="false"
use:clickOutside={close}
/>
</GridPopover>
{/if}
<style>
.long-form-cell {
flex: 1 1 auto;
padding: var(--cell-padding);
align-self: stretch;
display: flex;
align-items: flex-start;
overflow: hidden;
}
.long-form-cell.editable:hover {
cursor: text;
}
.value {
display: -webkit-box;
-webkit-line-clamp: var(--content-lines);
-webkit-box-orient: vertical;
overflow: hidden;
line-height: 20px;
}
textarea {
border: none;
width: 320px;
flex: 1 1 auto;
height: var(--max-cell-render-overflow);
padding: var(--cell-padding);
margin: 0;
background: var(--cell-background);
font-size: var(--cell-font-size);
font-family: var(--font-sans);
color: inherit;
z-index: 1;
resize: none;
line-height: 20px;
overflow: auto;
}
textarea:focus {
outline: none;
}
</style>

View File

@ -9,6 +9,7 @@ import TextCell from "../cells/TextCell.svelte"
import LongFormCell from "../cells/LongFormCell.svelte" import LongFormCell from "../cells/LongFormCell.svelte"
import BooleanCell from "../cells/BooleanCell.svelte" import BooleanCell from "../cells/BooleanCell.svelte"
import FormulaCell from "../cells/FormulaCell.svelte" import FormulaCell from "../cells/FormulaCell.svelte"
import AICell from "../cells/AICell.svelte"
import JSONCell from "../cells/JSONCell.svelte" import JSONCell from "../cells/JSONCell.svelte"
import AttachmentCell from "../cells/AttachmentCell.svelte" import AttachmentCell from "../cells/AttachmentCell.svelte"
import AttachmentSingleCell from "../cells/AttachmentSingleCell.svelte" import AttachmentSingleCell from "../cells/AttachmentSingleCell.svelte"
@ -30,7 +31,7 @@ const TypeComponentMap = {
[FieldType.ATTACHMENT_SINGLE]: AttachmentSingleCell, [FieldType.ATTACHMENT_SINGLE]: AttachmentSingleCell,
[FieldType.LINK]: RelationshipCell, [FieldType.LINK]: RelationshipCell,
[FieldType.FORMULA]: FormulaCell, [FieldType.FORMULA]: FormulaCell,
[FieldType.AI]: LongFormCell, [FieldType.AI]: AICell,
[FieldType.JSON]: JSONCell, [FieldType.JSON]: JSONCell,
[FieldType.BB_REFERENCE]: BBReferenceCell, [FieldType.BB_REFERENCE]: BBReferenceCell,
[FieldType.BB_REFERENCE_SINGLE]: BBReferenceSingleCell, [FieldType.BB_REFERENCE_SINGLE]: BBReferenceSingleCell,

View File

@ -16,7 +16,6 @@ import { EventType, updateLinks } from "../../../../db/linkedRows"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
import isEqual from "lodash/isEqual" import isEqual from "lodash/isEqual"
import { import {
runAIColumnChecks,
runStaticFormulaChecks, runStaticFormulaChecks,
} from "../../../../api/controllers/table/bulkFormula" } from "../../../../api/controllers/table/bulkFormula"
import { context } from "@budibase/backend-core" import { context } from "@budibase/backend-core"
@ -136,7 +135,7 @@ export async function save(
} }
// has to run after, make sure it has _id // has to run after, make sure it has _id
await runStaticFormulaChecks(table, { oldTable, deletion: false }) await runStaticFormulaChecks(table, { oldTable, deletion: false })
await runAIColumnChecks(table, { oldTable, deletion: false }) // await runAIColumnChecks(table, { oldTable, deletion: false })
return { table } return { table }
} }