This commit is contained in:
Gerard Burns 2024-05-14 11:24:51 +01:00
parent 2e238f814c
commit bb69e0c1c9
8 changed files with 33 additions and 22 deletions

View File

@ -63,7 +63,7 @@
return null
}
$: docLink = getDocLink(columnType);
$: docLink = getDocLink(columnType)
</script>
<Line noWrap>

View File

@ -7,7 +7,14 @@
export let disabled = false
</script>
<a class:disabled tabindex="0" {href} rel="noopener noreferrer" target="_blank" class="link">
<a
class:disabled
tabindex="0"
{href}
rel="noopener noreferrer"
target="_blank"
class="link"
>
<Icon size="XS" name={icon} />
<span class="text">
<slot>
@ -53,7 +60,7 @@
color: var(--blue);
}
.disabled :global(svg){
.disabled :global(svg) {
color: var(--grey-6);
}
</style>

View File

@ -83,7 +83,7 @@ export class AppMetaStore extends BudiStore {
syncClientTypeSupportPresets(typeSupportPresets) {
this.update(state => ({
...state,
typeSupportPresets
typeSupportPresets,
}))
}

View File

@ -103,7 +103,7 @@ export class ComponentStore extends BudiStore {
this.update(state => ({
...state,
components,
customComponents
customComponents,
}))
// Sync client features to app store

View File

@ -94,7 +94,9 @@ describe("Application Meta Store", () => {
it("Sync type support information to state", async ctx => {
ctx.test.appStore.syncClientTypeSupportPresets({ preset: "information" })
expect(ctx.test.store.typeSupportPresets).toStrictEqual({ preset: "information" })
expect(ctx.test.store.typeSupportPresets).toStrictEqual({
preset: "information",
})
})
it("Sync component feature flags to state", async ctx => {

View File

@ -55,7 +55,11 @@
</script>
{#key optionsCopy?.customColor}
<div class:hide={noData} use:styleable={$component.styles} bind:this={chartElement} />
<div
class:hide={noData}
use:styleable={$component.styles}
bind:this={chartElement}
/>
{#if $builderStore.inBuilder && noData}
<div
class="component-placeholder"

View File

@ -5,19 +5,19 @@ export const formatters = {
["Datetime"]: val => new Date(val).toLocaleString(),
}
export const parsePalette = (paletteName) => {
export const parsePalette = paletteName => {
if (paletteName === "Custom") {
// return null in this case so that the palette option doesn't get consumed by Apex Charts
return null;
return null
}
const [_, number] = paletteName.split(" ");
const [_, number] = paletteName.split(" ")
return `palette${number}`
}
// Deep clone which copies function references
export const cloneDeep = (value) => {
export const cloneDeep = value => {
const typesToNaiveCopy = ["string", "boolean", "number", "function", "symbol"]
if (value === null) {
@ -29,7 +29,7 @@ export const cloneDeep = (value) => {
}
if (typesToNaiveCopy.includes(typeof value)) {
return value;
return value
}
if (Array.isArray(value)) {
@ -44,7 +44,7 @@ export const cloneDeep = (value) => {
cloneObject[key] = cloneDeep(childValue)
})
return cloneObject;
return cloneObject
}
throw `Unsupported value: "${value}" of type: "${typeof value}"`

View File

@ -1,14 +1,12 @@
import { expect, describe, it, vi } from "vitest"
import {
cloneDeep,
} from "./utils"
import { cloneDeep } from "./utils"
describe("utils", () => {
let context;
let context
beforeEach(() => {
vi.clearAllMocks()
context = {};
context = {}
})
describe("cloneDeep", () => {
@ -20,14 +18,14 @@ describe("utils", () => {
num: 123,
bool: true,
sym: Symbol("test"),
func: () => "some value"
func: () => "some value",
}
context.cloneValue = cloneDeep(context.value);
});
context.cloneValue = cloneDeep(context.value)
})
it("to clone the object and not copy object references", () => {
expect(context.cloneValue.obj.one).toEqual(1)
expect(context.cloneValue.obj.two).toEqual(2)
});
})
})
})