This commit is contained in:
mike12345567 2021-04-29 19:10:02 +01:00
parent 4ed611fb73
commit 87e846054b
3 changed files with 17 additions and 19 deletions

View File

@ -1,7 +1,7 @@
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
import { get } from "svelte/store" import { get } from "svelte/store"
import { findComponent, findComponentPath } from "./storeUtils" import { findComponent, findComponentPath } from "./storeUtils"
import {currentAssetId, store} from "builderStore" import { store } from "builderStore"
import { tables as tablesStore, queries as queriesStores } from "stores/backend" import { tables as tablesStore, queries as queriesStores } from "stores/backend"
import { makePropSafe } from "@budibase/string-templates" import { makePropSafe } from "@budibase/string-templates"
import { TableNames } from "../constants" import { TableNames } from "../constants"

View File

@ -8,23 +8,23 @@
Toggle, Toggle,
Radio, Radio,
} from "@budibase/bbui" } from "@budibase/bbui"
import {cloneDeep} from "lodash/fp" import { cloneDeep } from "lodash/fp"
import {tables} from "stores/backend" import { tables } from "stores/backend"
import {TableNames, UNEDITABLE_USER_FIELDS} from "constants" import { TableNames, UNEDITABLE_USER_FIELDS } from "constants"
import { import {
FIELDS, FIELDS,
AUTO_COLUMN_SUB_TYPES, AUTO_COLUMN_SUB_TYPES,
RelationshipTypes, RelationshipTypes,
} from "constants/backend" } from "constants/backend"
import {getAutoColumnInformation, buildAutoColumn} from "builderStore/utils" import { getAutoColumnInformation, buildAutoColumn } from "builderStore/utils"
import {notifier} from "builderStore/store/notifications" import { notifier } from "builderStore/store/notifications"
import ValuesList from "components/common/ValuesList.svelte" import ValuesList from "components/common/ValuesList.svelte"
import DatePicker from "components/common/DatePicker.svelte" import DatePicker from "components/common/DatePicker.svelte"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import {truncate} from "lodash" import { truncate } from "lodash"
import ModalBindableInput from "components/common/ModalBindableInput.svelte" import ModalBindableInput from "components/common/ModalBindableInput.svelte"
import {getBindings} from "components/backend/DataTable/formula" import { getBindings } from "components/backend/DataTable/formula"
const AUTO_TYPE = "auto" const AUTO_TYPE = "auto"
const FORMULA_TYPE = FIELDS.FORMULA.type const FORMULA_TYPE = FIELDS.FORMULA.type
@ -70,7 +70,8 @@
field.subtype !== AUTO_COLUMN_SUB_TYPES.CREATED_BY && field.subtype !== AUTO_COLUMN_SUB_TYPES.CREATED_BY &&
field.subtype !== AUTO_COLUMN_SUB_TYPES.UPDATED_BY && field.subtype !== AUTO_COLUMN_SUB_TYPES.UPDATED_BY &&
field.type !== FORMULA_TYPE field.type !== FORMULA_TYPE
$: canBeDisplay = field.type !== LINK_TYPE && $: canBeDisplay =
field.type !== LINK_TYPE &&
field.type !== AUTO_TYPE && field.type !== AUTO_TYPE &&
field.type !== FORMULA_TYPE field.type !== FORMULA_TYPE
$: canBeRequired = $: canBeRequired =
@ -121,7 +122,7 @@
function onChangeRequired(e) { function onChangeRequired(e) {
const req = e.target.checked const req = e.target.checked
field.constraints.presence = req ? {allowEmpty: false} : false field.constraints.presence = req ? { allowEmpty: false } : false
required = req required = req
} }
@ -129,7 +130,7 @@
const isPrimary = e.target.checked const isPrimary = e.target.checked
// primary display is always required // primary display is always required
if (isPrimary) { if (isPrimary) {
field.constraints.presence = {allowEmpty: false} field.constraints.presence = { allowEmpty: false }
} }
} }
@ -163,8 +164,8 @@
if (!linkTable) { if (!linkTable) {
return null return null
} }
const thisName = truncate(table.name, {length: 14}), const thisName = truncate(table.name, { length: 14 }),
linkName = truncate(linkTable.name, {length: 14}) linkName = truncate(linkTable.name, { length: 14 })
return [ return [
{ {
name: `Many ${thisName} rows → many ${linkName} rows`, name: `Many ${thisName} rows → many ${linkName} rows`,
@ -298,7 +299,7 @@
value={field.formula} value={field.formula}
on:change={e => (field.formula = e.detail)} on:change={e => (field.formula = e.detail)}
bindings={getBindings({ table })} bindings={getBindings({ table })}
serverSide=true /> serverSide="true" />
{:else if field.type === AUTO_TYPE} {:else if field.type === AUTO_TYPE}
<Select label="Auto Column Type" thin secondary bind:value={field.subtype}> <Select label="Auto Column Type" thin secondary bind:value={field.subtype}>
<option value="">Choose a subtype</option> <option value="">Choose a subtype</option>

View File

@ -45,10 +45,7 @@
</div> </div>
</div> </div>
<Modal bind:this={bindingModal} width="50%"> <Modal bind:this={bindingModal} width="50%">
<ModalContent <ModalContent {title} onConfirm={saveBinding} bind:disabled={invalid}>
{title}
onConfirm={saveBinding}
bind:disabled={invalid}>
<Body extraSmall grey> <Body extraSmall grey>
Add the objects on the left to enrich your text. Add the objects on the left to enrich your text.
</Body> </Body>
@ -56,7 +53,7 @@
this={panel} this={panel}
serverSide serverSide
value={readableValue} value={readableValue}
bind:validity={validity} bind:validity
on:update={event => (tempValue = event.detail)} on:update={event => (tempValue = event.detail)}
bindableProperties={bindings} /> bindableProperties={bindings} />
</ModalContent> </ModalContent>