Use OG class properties for iOS13 support

This commit is contained in:
Mel O'Hagan 2022-10-05 15:53:06 +01:00
parent aeb0f9af13
commit 9d67418bf2
2 changed files with 71 additions and 69 deletions

View File

@ -1,37 +1,39 @@
export class ApexOptionsBuilder { export class ApexOptionsBuilder {
formatters = { constructor() {
["Default"]: val => (isNaN(val) ? val : Math.round(val * 100) / 100), this.formatters = {
["Thousands"]: val => `${Math.round(val / 1000)}K`, ["Default"]: val => (isNaN(val) ? val : Math.round(val * 100) / 100),
["Millions"]: val => `${Math.round(val / 1000000)}M`, ["Thousands"]: val => `${Math.round(val / 1000)}K`,
} ["Millions"]: val => `${Math.round(val / 1000000)}M`,
options = { }
series: [], this.options = {
legend: { series: [],
show: false, legend: {
position: "top",
horizontalAlign: "right",
showForSingleSeries: true,
showForNullSeries: true,
showForZeroSeries: true,
},
chart: {
toolbar: {
show: false, show: false,
position: "top",
horizontalAlign: "right",
showForSingleSeries: true,
showForNullSeries: true,
showForZeroSeries: true,
}, },
zoom: { chart: {
enabled: false, toolbar: {
show: false,
},
zoom: {
enabled: false,
},
}, },
}, xaxis: {
xaxis: { labels: {
labels: { formatter: this.formatters.Default,
formatter: this.formatters.Default, },
}, },
}, yaxis: {
yaxis: { labels: {
labels: { formatter: this.formatters.Default,
formatter: this.formatters.Default, },
}, },
}, }
} }
setOption(path, value) { setOption(path, value) {

View File

@ -14,52 +14,52 @@ import { convertJSONSchemaToTableSchema } from "../utils/json"
* For other types of datasource, this class is overridden and extended. * For other types of datasource, this class is overridden and extended.
*/ */
export default class DataFetch { export default class DataFetch {
// API client
API = null
// Feature flags
featureStore = writable({
supportsSearch: false,
supportsSort: false,
supportsPagination: false,
})
// Config
options = {
datasource: null,
limit: 10,
// Search config
filter: null,
query: null,
// Sorting config
sortColumn: null,
sortOrder: "ascending",
sortType: null,
// Pagination config
paginate: true,
}
// State of the fetch
store = writable({
rows: [],
info: null,
schema: null,
loading: false,
loaded: false,
query: null,
pageNumber: 0,
cursor: null,
cursors: [],
})
/** /**
* Constructs a new DataFetch instance. * Constructs a new DataFetch instance.
* @param opts the fetch options * @param opts the fetch options
*/ */
constructor(opts) { constructor(opts) {
// API client
this.API = null
// Feature flags
this.featureStore = writable({
supportsSearch: false,
supportsSort: false,
supportsPagination: false,
})
// Config
this.options = {
datasource: null,
limit: 10,
// Search config
filter: null,
query: null,
// Sorting config
sortColumn: null,
sortOrder: "ascending",
sortType: null,
// Pagination config
paginate: true,
}
// State of the fetch
this.store = writable({
rows: [],
info: null,
schema: null,
loading: false,
loaded: false,
query: null,
pageNumber: 0,
cursor: null,
cursors: [],
})
// Merge options with their default values // Merge options with their default values
this.API = opts?.API this.API = opts?.API
this.options = { this.options = {