Merge branch 'master' of github.com:budibase/budibase into budi-8349-in-memory-search-parity-testing
This commit is contained in:
commit
59e9658a6a
|
@ -18,14 +18,11 @@
|
||||||
import subjects from "./subjects"
|
import subjects from "./subjects"
|
||||||
import { appStore } from "stores/builder"
|
import { appStore } from "stores/builder"
|
||||||
|
|
||||||
export let explanation
|
|
||||||
export let columnIcon
|
|
||||||
export let columnType
|
|
||||||
export let columnName
|
|
||||||
|
|
||||||
export let tableHref = () => {}
|
export let tableHref = () => {}
|
||||||
|
|
||||||
export let schema
|
export let schema
|
||||||
|
export let name
|
||||||
|
export let explanation
|
||||||
|
export let componentName
|
||||||
|
|
||||||
$: explanationWithPresets = getExplanationWithPresets(
|
$: explanationWithPresets = getExplanationWithPresets(
|
||||||
explanation,
|
explanation,
|
||||||
|
@ -54,14 +51,8 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div bind:this={root} class="tooltipContents">
|
<div bind:this={root} class="tooltipContents">
|
||||||
<Column
|
<Column {name} {schema} {tableHref} {setExplanationSubject} />
|
||||||
{columnName}
|
<Support {componentName} {support} {setExplanationSubject} />
|
||||||
{columnIcon}
|
|
||||||
{columnType}
|
|
||||||
{tableHref}
|
|
||||||
{setExplanationSubject}
|
|
||||||
/>
|
|
||||||
<Support {support} {setExplanationSubject} />
|
|
||||||
{#if messages.includes(messageConstants.stringAsNumber)}
|
{#if messages.includes(messageConstants.stringAsNumber)}
|
||||||
<StringAsNumber {setExplanationSubject} />
|
<StringAsNumber {setExplanationSubject} />
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -84,7 +75,7 @@
|
||||||
|
|
||||||
{#if detailsModalSubject !== subjects.none}
|
{#if detailsModalSubject !== subjects.none}
|
||||||
<DetailsModal
|
<DetailsModal
|
||||||
{columnName}
|
columnName={name}
|
||||||
anchor={root}
|
anchor={root}
|
||||||
{schema}
|
{schema}
|
||||||
subject={detailsModalSubject}
|
subject={detailsModalSubject}
|
||||||
|
|
|
@ -1,69 +1,124 @@
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { Line, InfoWord, DocumentationLink, Text } from "../typography"
|
||||||
Line,
|
import { FieldType } from "@budibase/types"
|
||||||
InfoWord,
|
import { FIELDS } from "constants/backend"
|
||||||
DocumentationLink,
|
|
||||||
Text,
|
|
||||||
Period,
|
|
||||||
} from "../typography"
|
|
||||||
import subjects from "../subjects"
|
import subjects from "../subjects"
|
||||||
|
|
||||||
export let columnName
|
export let schema
|
||||||
export let columnIcon
|
export let name
|
||||||
export let columnType
|
|
||||||
export let tableHref
|
export let tableHref
|
||||||
export let setExplanationSubject
|
export let setExplanationSubject
|
||||||
|
|
||||||
|
const getTypeName = schema => {
|
||||||
|
const fieldDefinition = Object.values(FIELDS).find(
|
||||||
|
f => f.type === schema?.type
|
||||||
|
)
|
||||||
|
|
||||||
|
if (schema?.type === "jsonarray") {
|
||||||
|
return "JSON Array"
|
||||||
|
}
|
||||||
|
if (schema?.type === "options") {
|
||||||
|
return "Options"
|
||||||
|
}
|
||||||
|
|
||||||
|
return fieldDefinition?.name || schema?.type || "Unknown"
|
||||||
|
}
|
||||||
|
|
||||||
|
const getTypeIcon = schema => {
|
||||||
|
const fieldDefinition = Object.values(FIELDS).find(
|
||||||
|
f => f.type === schema?.type
|
||||||
|
)
|
||||||
|
|
||||||
|
if (schema?.type === "jsonarray") {
|
||||||
|
return "BracketsSquare"
|
||||||
|
}
|
||||||
|
|
||||||
|
return fieldDefinition?.icon || "Circle"
|
||||||
|
}
|
||||||
|
|
||||||
const getDocLink = columnType => {
|
const getDocLink = columnType => {
|
||||||
if (columnType === "Number") {
|
if (columnType === FieldType.NUMBER) {
|
||||||
return "https://docs.budibase.com/docs/number"
|
return "https://docs.budibase.com/docs/number"
|
||||||
}
|
}
|
||||||
if (columnType === "Text") {
|
if (columnType === FieldType.STRING) {
|
||||||
return "https://docs.budibase.com/docs/text"
|
return "https://docs.budibase.com/docs/text"
|
||||||
}
|
}
|
||||||
if (columnType === "Attachment") {
|
if (columnType === FieldType.LONGFORM) {
|
||||||
|
return "https://docs.budibase.com/docs/text"
|
||||||
|
}
|
||||||
|
if (columnType === FieldType.ATTACHMENT_SINGLE) {
|
||||||
return "https://docs.budibase.com/docs/attachments"
|
return "https://docs.budibase.com/docs/attachments"
|
||||||
}
|
}
|
||||||
if (columnType === "Multi-select") {
|
if (columnType === FieldType.ATTACHMENTS) {
|
||||||
|
// No distinct multi attachment docs, link to attachment instead
|
||||||
|
return "https://docs.budibase.com/docs/attachments"
|
||||||
|
}
|
||||||
|
if (columnType === FieldType.ARRAY) {
|
||||||
return "https://docs.budibase.com/docs/multi-select"
|
return "https://docs.budibase.com/docs/multi-select"
|
||||||
}
|
}
|
||||||
if (columnType === "JSON") {
|
if (columnType === FieldType.JSON) {
|
||||||
return "https://docs.budibase.com/docs/json"
|
return "https://docs.budibase.com/docs/json"
|
||||||
}
|
}
|
||||||
if (columnType === "Date/Time") {
|
if (columnType === "jsonarray") {
|
||||||
|
return "https://docs.budibase.com/docs/json"
|
||||||
|
}
|
||||||
|
if (columnType === FieldType.DATETIME) {
|
||||||
return "https://docs.budibase.com/docs/datetime"
|
return "https://docs.budibase.com/docs/datetime"
|
||||||
}
|
}
|
||||||
if (columnType === "User") {
|
if (columnType === FieldType.BB_REFERENCE_SINGLE) {
|
||||||
return "https://docs.budibase.com/docs/user"
|
return "https://docs.budibase.com/docs/users-1"
|
||||||
}
|
}
|
||||||
if (columnType === "QR") {
|
if (columnType === FieldType.BB_REFERENCE) {
|
||||||
|
return "https://docs.budibase.com/docs/users-1"
|
||||||
|
}
|
||||||
|
if (columnType === FieldType.BARCODEQR) {
|
||||||
return "https://docs.budibase.com/docs/barcodeqr"
|
return "https://docs.budibase.com/docs/barcodeqr"
|
||||||
}
|
}
|
||||||
if (columnType === "Relationship") {
|
if (columnType === FieldType.LINK) {
|
||||||
return "https://docs.budibase.com/docs/relationships"
|
return "https://docs.budibase.com/docs/relationships"
|
||||||
}
|
}
|
||||||
if (columnType === "Formula") {
|
if (columnType === FieldType.FORMULA) {
|
||||||
return "https://docs.budibase.com/docs/formula"
|
return "https://docs.budibase.com/docs/formula"
|
||||||
}
|
}
|
||||||
if (columnType === "Options") {
|
if (columnType === FieldType.OPTIONS) {
|
||||||
return "https://docs.budibase.com/docs/options"
|
return "https://docs.budibase.com/docs/options"
|
||||||
}
|
}
|
||||||
if (columnType === "BigInt") {
|
if (columnType === FieldType.BOOLEAN) {
|
||||||
// No BigInt docs
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
if (columnType === "Boolean") {
|
|
||||||
return "https://docs.budibase.com/docs/boolean-truefalse"
|
return "https://docs.budibase.com/docs/boolean-truefalse"
|
||||||
}
|
}
|
||||||
if (columnType === "Signature") {
|
if (columnType === FieldType.SIGNATURE_SINGLE) {
|
||||||
// No Signature docs
|
// No Signature docs
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
if (columnType === FieldType.BIGINT) {
|
||||||
|
// No BigInt docs
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
$: docLink = getDocLink(columnType)
|
// NOTE The correct indefinite article is based on the pronounciation of the word it precedes, not the spelling. So simply checking if the word begins with a vowel is not sufficient.
|
||||||
|
|
||||||
|
// e.g., `an honor`, `a user`
|
||||||
|
const getIndefiniteArticle = schema => {
|
||||||
|
const anTypes = [
|
||||||
|
FieldType.OPTIONS,
|
||||||
|
null, // `null` gets parsed as "unknown"
|
||||||
|
undefined, // `undefined` gets parsed as "unknown"
|
||||||
|
]
|
||||||
|
|
||||||
|
if (anTypes.includes(schema?.type)) {
|
||||||
|
return "an"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "a"
|
||||||
|
}
|
||||||
|
|
||||||
|
$: columnTypeName = getTypeName(schema)
|
||||||
|
$: columnIcon = getTypeIcon(schema)
|
||||||
|
$: docLink = getDocLink(schema?.type)
|
||||||
|
$: indefiniteArticle = getIndefiniteArticle(schema)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Line noWrap>
|
<Line noWrap>
|
||||||
|
@ -71,14 +126,14 @@
|
||||||
on:mouseenter={() => setExplanationSubject(subjects.column)}
|
on:mouseenter={() => setExplanationSubject(subjects.column)}
|
||||||
on:mouseleave={() => setExplanationSubject(subjects.none)}
|
on:mouseleave={() => setExplanationSubject(subjects.none)}
|
||||||
href={tableHref}
|
href={tableHref}
|
||||||
text={columnName}
|
text={name}
|
||||||
/>
|
/>
|
||||||
<Text value=" is a " />
|
<Text value={` is ${indefiniteArticle} `} />
|
||||||
<DocumentationLink
|
<DocumentationLink
|
||||||
disabled={docLink === null}
|
disabled={docLink === null}
|
||||||
href={docLink}
|
href={docLink}
|
||||||
icon={columnIcon}
|
icon={columnIcon}
|
||||||
text={`${columnType} column`}
|
text={columnTypeName}
|
||||||
/>
|
/>
|
||||||
<Period />
|
<Text value=" column." />
|
||||||
</Line>
|
</Line>
|
||||||
|
|
|
@ -2,9 +2,16 @@
|
||||||
import { Line, InfoWord, DocumentationLink, Text } from "../typography"
|
import { Line, InfoWord, DocumentationLink, Text } from "../typography"
|
||||||
import subjects from "../subjects"
|
import subjects from "../subjects"
|
||||||
import * as explanation from "../explanation"
|
import * as explanation from "../explanation"
|
||||||
|
import { componentStore } from "stores/builder"
|
||||||
|
|
||||||
export let setExplanationSubject
|
export let setExplanationSubject
|
||||||
export let support
|
export let support
|
||||||
|
export let componentName
|
||||||
|
|
||||||
|
const getComponentDefinition = componentName => {
|
||||||
|
const components = $componentStore.components || {}
|
||||||
|
return components[componentName] || null
|
||||||
|
}
|
||||||
|
|
||||||
const getIcon = support => {
|
const getIcon = support => {
|
||||||
if (support === explanation.support.unsupported) {
|
if (support === explanation.support.unsupported) {
|
||||||
|
@ -39,21 +46,24 @@
|
||||||
$: icon = getIcon(support)
|
$: icon = getIcon(support)
|
||||||
$: color = getColor(support)
|
$: color = getColor(support)
|
||||||
$: text = getText(support)
|
$: text = getText(support)
|
||||||
|
$: componentDefinition = getComponentDefinition(componentName)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Line>
|
{#if componentDefinition}
|
||||||
<InfoWord
|
<Line>
|
||||||
on:mouseenter={() => setExplanationSubject(subjects.support)}
|
<InfoWord
|
||||||
on:mouseleave={() => setExplanationSubject(subjects.none)}
|
on:mouseenter={() => setExplanationSubject(subjects.support)}
|
||||||
{icon}
|
on:mouseleave={() => setExplanationSubject(subjects.none)}
|
||||||
{color}
|
{icon}
|
||||||
{text}
|
{color}
|
||||||
/>
|
{text}
|
||||||
<Text value=" with this " />
|
/>
|
||||||
<DocumentationLink
|
<Text value=" with this " />
|
||||||
href="https://docs.budibase.com/docs/chart"
|
<DocumentationLink
|
||||||
icon="GraphPie"
|
href={componentDefinition.documentationLink}
|
||||||
text="Chart component"
|
icon={componentDefinition.icon}
|
||||||
/>
|
text={componentDefinition.name}
|
||||||
<Text value=" input." />
|
/>
|
||||||
</Line>
|
<Text value=" input." />
|
||||||
|
</Line>
|
||||||
|
{/if}
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
import { Explanation } from "./Explanation"
|
import { Explanation } from "./Explanation"
|
||||||
import { debounce } from "lodash"
|
import { debounce } from "lodash"
|
||||||
import { params } from "@roxi/routify"
|
import { params } from "@roxi/routify"
|
||||||
import { Constants } from "@budibase/frontend-core"
|
|
||||||
import { FIELDS } from "constants/backend"
|
|
||||||
|
|
||||||
export let componentInstance = {}
|
export let componentInstance = {}
|
||||||
export let value = ""
|
export let value = ""
|
||||||
|
@ -60,35 +58,6 @@
|
||||||
const onOptionMouseleave = e => {
|
const onOptionMouseleave = e => {
|
||||||
updateTooltip(e, null)
|
updateTooltip(e, null)
|
||||||
}
|
}
|
||||||
const getOptionIcon = optionKey => {
|
|
||||||
const option = schema[optionKey]
|
|
||||||
if (!option) return ""
|
|
||||||
|
|
||||||
if (option.autocolumn) {
|
|
||||||
return "MagicWand"
|
|
||||||
}
|
|
||||||
const { type, subtype } = option
|
|
||||||
|
|
||||||
const result =
|
|
||||||
typeof Constants.TypeIconMap[type] === "object" && subtype
|
|
||||||
? Constants.TypeIconMap[type][subtype]
|
|
||||||
: Constants.TypeIconMap[type]
|
|
||||||
|
|
||||||
return result || "Text"
|
|
||||||
}
|
|
||||||
|
|
||||||
const getOptionIconTooltip = optionKey => {
|
|
||||||
const option = schema[optionKey]
|
|
||||||
|
|
||||||
const type = option?.type
|
|
||||||
const field = Object.values(FIELDS).find(f => f.type === type)
|
|
||||||
|
|
||||||
if (field) {
|
|
||||||
return field.name
|
|
||||||
}
|
|
||||||
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
|
@ -109,10 +78,9 @@
|
||||||
<Explanation
|
<Explanation
|
||||||
tableHref={`/builder/app/${$params.application}/data/table/${datasource?.tableId}`}
|
tableHref={`/builder/app/${$params.application}/data/table/${datasource?.tableId}`}
|
||||||
schema={schema[currentOption]}
|
schema={schema[currentOption]}
|
||||||
columnIcon={getOptionIcon(currentOption)}
|
name={currentOption}
|
||||||
columnName={currentOption}
|
|
||||||
columnType={getOptionIconTooltip(currentOption)}
|
|
||||||
{explanation}
|
{explanation}
|
||||||
|
componentName={componentInstance._component}
|
||||||
/>
|
/>
|
||||||
</ContextTooltip>
|
</ContextTooltip>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -4,10 +4,8 @@
|
||||||
import { selectedScreen } from "stores/builder"
|
import { selectedScreen } from "stores/builder"
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import { Explanation } from "./Explanation"
|
import { Explanation } from "./Explanation"
|
||||||
import { FIELDS } from "constants/backend"
|
|
||||||
import { params } from "@roxi/routify"
|
import { params } from "@roxi/routify"
|
||||||
import { debounce } from "lodash"
|
import { debounce } from "lodash"
|
||||||
import { Constants } from "@budibase/frontend-core"
|
|
||||||
|
|
||||||
export let componentInstance = {}
|
export let componentInstance = {}
|
||||||
export let value = ""
|
export let value = ""
|
||||||
|
@ -37,40 +35,6 @@
|
||||||
dispatch("change", boundValue)
|
dispatch("change", boundValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getOptionIcon = optionKey => {
|
|
||||||
const option = schema[optionKey]
|
|
||||||
if (!option) return ""
|
|
||||||
|
|
||||||
if (option.autocolumn) {
|
|
||||||
return "MagicWand"
|
|
||||||
}
|
|
||||||
const { type, subtype } = option
|
|
||||||
|
|
||||||
const result =
|
|
||||||
typeof Constants.TypeIconMap[type] === "object" && subtype
|
|
||||||
? Constants.TypeIconMap[type][subtype]
|
|
||||||
: Constants.TypeIconMap[type]
|
|
||||||
|
|
||||||
return result || "Text"
|
|
||||||
}
|
|
||||||
|
|
||||||
const getOptionIconTooltip = optionKey => {
|
|
||||||
const option = schema[optionKey]
|
|
||||||
|
|
||||||
const type = option?.type
|
|
||||||
const field = Object.values(FIELDS).find(f => f.type === type)
|
|
||||||
|
|
||||||
if (field) {
|
|
||||||
return field.name
|
|
||||||
} else if (type === "jsonarray") {
|
|
||||||
// `jsonarray` isn't present in the above FIELDS constant
|
|
||||||
|
|
||||||
return "JSON Array"
|
|
||||||
}
|
|
||||||
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateTooltip = debounce((e, option) => {
|
const updateTooltip = debounce((e, option) => {
|
||||||
if (option == null) {
|
if (option == null) {
|
||||||
contextTooltipVisible = false
|
contextTooltipVisible = false
|
||||||
|
@ -110,10 +74,9 @@
|
||||||
<Explanation
|
<Explanation
|
||||||
tableHref={`/builder/app/${$params.application}/data/table/${datasource?.tableId}`}
|
tableHref={`/builder/app/${$params.application}/data/table/${datasource?.tableId}`}
|
||||||
schema={schema[currentOption]}
|
schema={schema[currentOption]}
|
||||||
columnIcon={getOptionIcon(currentOption)}
|
name={currentOption}
|
||||||
columnName={currentOption}
|
|
||||||
columnType={getOptionIconTooltip(currentOption)}
|
|
||||||
{explanation}
|
{explanation}
|
||||||
|
componentName={componentInstance._component}
|
||||||
/>
|
/>
|
||||||
</ContextTooltip>
|
</ContextTooltip>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -5223,6 +5223,7 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"chartblock": {
|
"chartblock": {
|
||||||
|
"documentationLink": "https://docs.budibase.com/docs/chart",
|
||||||
"block": true,
|
"block": true,
|
||||||
"name": "Chart Block",
|
"name": "Chart Block",
|
||||||
"icon": "GraphPie",
|
"icon": "GraphPie",
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
export let valueUnits
|
export let valueUnits
|
||||||
export let yAxisLabel
|
export let yAxisLabel
|
||||||
export let xAxisLabel
|
export let xAxisLabel
|
||||||
|
export let yAxisUnits
|
||||||
export let curve
|
export let curve
|
||||||
|
|
||||||
// Area
|
// Area
|
||||||
|
@ -85,6 +86,7 @@
|
||||||
valueUnits,
|
valueUnits,
|
||||||
yAxisLabel,
|
yAxisLabel,
|
||||||
xAxisLabel,
|
xAxisLabel,
|
||||||
|
yAxisUnits,
|
||||||
stacked,
|
stacked,
|
||||||
horizontal,
|
horizontal,
|
||||||
curve,
|
curve,
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
xaxis: {
|
xaxis: {
|
||||||
type: labelType,
|
|
||||||
categories,
|
categories,
|
||||||
labels: {
|
labels: {
|
||||||
formatter: xAxisFormatter,
|
formatter: xAxisFormatter,
|
||||||
|
|
|
@ -72,7 +72,6 @@
|
||||||
},
|
},
|
||||||
// We can just always provide the categories to the xaxis and horizontal mode automatically handles "tranposing" the categories to the yaxis, but certain things like labels need to be manually put on a certain axis based on the selected mode. Titles do not need to be handled this way, they are exposed to the user as "X axis" and Y Axis" so flipping them would be confusing.
|
// We can just always provide the categories to the xaxis and horizontal mode automatically handles "tranposing" the categories to the yaxis, but certain things like labels need to be manually put on a certain axis based on the selected mode. Titles do not need to be handled this way, they are exposed to the user as "X axis" and Y Axis" so flipping them would be confusing.
|
||||||
xaxis: {
|
xaxis: {
|
||||||
type: labelType,
|
|
||||||
categories,
|
categories,
|
||||||
labels: {
|
labels: {
|
||||||
formatter: xAxisFormatter,
|
formatter: xAxisFormatter,
|
||||||
|
|
|
@ -66,7 +66,6 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
xaxis: {
|
xaxis: {
|
||||||
type: labelType,
|
|
||||||
categories,
|
categories,
|
||||||
labels: {
|
labels: {
|
||||||
formatter: xAxisFormatter,
|
formatter: xAxisFormatter,
|
||||||
|
|
Loading…
Reference in New Issue