remove old chart inputs
This commit is contained in:
parent
a94953289e
commit
0249912154
|
@ -9,10 +9,8 @@ import TableSelect from "./controls/TableSelect.svelte"
|
|||
import ColorPicker from "./controls/ColorPicker.svelte"
|
||||
import { IconSelect } from "./controls/IconSelect"
|
||||
import FieldSelect from "./controls/FieldSelect.svelte"
|
||||
import ChartFieldSelect from "./controls/ChartFieldSelect.svelte"
|
||||
import SortableFieldSelect from "./controls/SortableFieldSelect.svelte"
|
||||
import MultiFieldSelect from "./controls/MultiFieldSelect.svelte"
|
||||
import ChartMultiFieldSelect from "./controls/ChartMultiFieldSelect.svelte"
|
||||
import SearchFieldSelect from "./controls/SearchFieldSelect.svelte"
|
||||
import SchemaSelect from "./controls/SchemaSelect.svelte"
|
||||
import SectionSelect from "./controls/SectionSelect.svelte"
|
||||
|
@ -48,9 +46,7 @@ const componentMap = {
|
|||
color: ColorPicker,
|
||||
icon: IconSelect,
|
||||
field: FieldSelect,
|
||||
chartfield: ChartFieldSelect,
|
||||
multifield: MultiFieldSelect,
|
||||
chartmultifield: ChartMultiFieldSelect,
|
||||
searchfield: SearchFieldSelect,
|
||||
options: OptionsEditor,
|
||||
schema: SchemaSelect,
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
<script>
|
||||
import { Select } from "@budibase/bbui"
|
||||
import {
|
||||
getDatasourceForProvider,
|
||||
getSchemaForDatasource,
|
||||
} from "dataBinding"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
export let componentInstance = {}
|
||||
export let value = ""
|
||||
export let placeholder
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
$: datasource = getDatasourceForProvider($selectedScreen, componentInstance)
|
||||
$: schema = getSchemaForDatasource($selectedScreen, datasource).schema
|
||||
$: options = Object.keys(schema || {}).filter(key => {
|
||||
return (
|
||||
schema[key].type !== "json" &&
|
||||
schema[key].type !== "array" &&
|
||||
schema[key].type !== "attachment" &&
|
||||
schema[key].type !== "barcodeqr" &&
|
||||
schema[key].type !== "link" &&
|
||||
schema[key].type !== "bb_reference"
|
||||
);
|
||||
});
|
||||
$: boundValue = getValidValue(value, options)
|
||||
|
||||
const getValidValue = (value, options) => {
|
||||
// Reset value if there aren't any options
|
||||
if (!Array.isArray(options)) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Reset value if the value isn't found in the options
|
||||
if (options.indexOf(value) === -1) {
|
||||
return null
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
const onChange = value => {
|
||||
boundValue = getValidValue(value.detail, options)
|
||||
dispatch("change", boundValue)
|
||||
}
|
||||
|
||||
$: {
|
||||
console.log(options, schema);
|
||||
}
|
||||
</script>
|
||||
|
||||
<Select {placeholder} value={boundValue} on:change={onChange} {options} />
|
|
@ -1,48 +0,0 @@
|
|||
<script>
|
||||
import { Multiselect } from "@budibase/bbui"
|
||||
import { getDatasourceForProvider, getSchemaForDatasource } from "dataBinding"
|
||||
import { selectedScreen } from "stores/builder"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
export let componentInstance = {}
|
||||
export let value = ""
|
||||
export let placeholder
|
||||
export let fieldValidator
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
$: datasource = getDatasourceForProvider($selectedScreen, componentInstance)
|
||||
$: schema = getSchemaForDatasource($selectedScreen, datasource).schema
|
||||
|
||||
const getOptions = (schema, fieldValidator) => {
|
||||
if (fieldValidator != null) {
|
||||
return Object.keys(schema || {})
|
||||
}
|
||||
}
|
||||
|
||||
$: options = Object.keys(schema || {}).filter(key => {
|
||||
return (
|
||||
schema[key].type !== "json" &&
|
||||
schema[key].type !== "array" &&
|
||||
schema[key].type !== "attachment" &&
|
||||
schema[key].type !== "barcodeqr" &&
|
||||
schema[key].type !== "link" &&
|
||||
schema[key].type !== "bb_reference"
|
||||
);
|
||||
});
|
||||
$: boundValue = getValidOptions(value, options)
|
||||
|
||||
const getValidOptions = (selectedOptions, allOptions) => {
|
||||
// Fix the hardcoded default string value
|
||||
if (!Array.isArray(selectedOptions)) {
|
||||
selectedOptions = []
|
||||
}
|
||||
return selectedOptions.filter(val => allOptions.indexOf(val) !== -1)
|
||||
}
|
||||
|
||||
const setValue = value => {
|
||||
boundValue = getValidOptions(value.detail, options)
|
||||
dispatch("change", boundValue)
|
||||
}
|
||||
</script>
|
||||
|
||||
<Multiselect {placeholder} value={boundValue} on:change={setValue} {options} />
|
|
@ -10,8 +10,8 @@
|
|||
return "None"
|
||||
}
|
||||
|
||||
const epoch = Date.parse(isoString);
|
||||
const date = new Date(epoch);
|
||||
const unixTime = Date.parse(isoString);
|
||||
const date = new Date(unixTime);
|
||||
|
||||
return date.toLocaleString();
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
text: xAxisLabel
|
||||
}
|
||||
},
|
||||
// Providing `type: "datetime"` normally makes Apex Charts parse epochs nicely with no additonal config, but bar charts in horizontal mode don't have a default setting for parsing the labels of dates, and will just spit out the unix epoch value. It also doesn't seem to respect any date based formatting properties passed in. So we'll just manualy format the labels, the chart still sorts the dates correctly in any case
|
||||
// Providing `type: "datetime"` normally makes Apex Charts parse unix time nicely with no additonal config, but bar charts in horizontal mode don't have a default setting for parsing the labels of dates, and will just spit out the unix time value. It also doesn't seem to respect any date based formatting properties passed in. So we'll just manualy format the labels, the chart still sorts the dates correctly in any case
|
||||
yaxis: {
|
||||
labels: {
|
||||
formatter: yAxisFormatter
|
||||
|
|
|
@ -63,14 +63,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
const getValueAsUnixEpoch = (dataprovider, dateColumn, row) => {
|
||||
const getValueAsUnixTime = (dataprovider, dateColumn, row) => {
|
||||
const value = row[dateColumn]
|
||||
|
||||
if (dataProvider?.schema?.[dateColumn]?.type === 'datetime') {
|
||||
return Date.parse(value);
|
||||
}
|
||||
|
||||
// Unix epoch
|
||||
if (typeof value === "number") {
|
||||
return value;
|
||||
}
|
||||
|
@ -122,7 +121,7 @@
|
|||
const close = parseFloat(row[closeColumn])
|
||||
|
||||
return [
|
||||
getValueAsUnixEpoch(dataProvider, dateColumn, row),
|
||||
getValueAsUnixTime(dataProvider, dateColumn, row),
|
||||
isNaN(open) ? 0 : open,
|
||||
isNaN(high) ? 0 : high,
|
||||
isNaN(low) ? 0 : low,
|
||||
|
|
Loading…
Reference in New Issue