Fix chart placeholder, fix spectrum colours and begin work on pagination component
This commit is contained in:
parent
889f5f8175
commit
c2cc99ef2c
|
@ -345,7 +345,7 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.wrapper {
|
.wrapper {
|
||||||
background-color: var(--spectrum-alias-background-color-secondary);
|
background-color: var(--spectrum-alias-background-color-default);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
@ -389,7 +389,7 @@
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
background-color: var(--spectrum-alias-background-color-secondary);
|
background-color: var(--spectrum-alias-background-color-default);
|
||||||
border-bottom: 1px solid
|
border-bottom: 1px solid
|
||||||
var(--spectrum-table-border-color, var(--spectrum-alias-border-color-mid));
|
var(--spectrum-table-border-color, var(--spectrum-alias-border-color-mid));
|
||||||
}
|
}
|
||||||
|
@ -462,10 +462,6 @@
|
||||||
tbody tr.hidden {
|
tbody tr.hidden {
|
||||||
height: calc(var(--row-height) + 1px);
|
height: calc(var(--row-height) + 1px);
|
||||||
}
|
}
|
||||||
tbody tr.offset {
|
|
||||||
background-color: red;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
td {
|
td {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
|
|
|
@ -3,20 +3,34 @@
|
||||||
import { makePropSafe } from "@budibase/string-templates"
|
import { makePropSafe } from "@budibase/string-templates"
|
||||||
import { currentAsset, store } from "builderStore"
|
import { currentAsset, store } from "builderStore"
|
||||||
import { findComponentPath } from "builderStore/storeUtils"
|
import { findComponentPath } from "builderStore/storeUtils"
|
||||||
|
import { createEventDispatcher, onMount } from "svelte"
|
||||||
|
|
||||||
export let value
|
export let value
|
||||||
|
export let onChange
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
const getValue = component => `{{ literal ${makePropSafe(component._id)} }}`
|
||||||
|
|
||||||
$: path = findComponentPath($currentAsset.props, $store.selectedComponentId)
|
$: path = findComponentPath($currentAsset.props, $store.selectedComponentId)
|
||||||
$: providers = path.filter(
|
$: providers = path.filter(
|
||||||
component =>
|
component =>
|
||||||
component._component === "@budibase/standard-components/dataprovider"
|
component._component === "@budibase/standard-components/dataprovider"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Set initial value to closest data provider
|
||||||
|
onMount(() => {
|
||||||
|
const valid = value && providers.find(x => getValue(x) === value) != null
|
||||||
|
if (!valid && providers.length) {
|
||||||
|
dispatch("change", getValue(providers[providers.length - 1]))
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
{value}
|
{value}
|
||||||
|
placeholder={null}
|
||||||
on:change
|
on:change
|
||||||
options={providers}
|
options={providers}
|
||||||
getOptionLabel={component => component._instanceName}
|
getOptionLabel={component => component._instanceName}
|
||||||
getOptionValue={component => `{{ literal ${makePropSafe(component._id)} }}`}
|
getOptionValue={getValue}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -7,12 +7,12 @@ html, body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.spectrum--light {
|
.spectrum--light {
|
||||||
--spectrum-alias-background-color-primary: var(--spectrum-global-color-gray-75);
|
/*--spectrum-alias-background-color-primary: var(--spectrum-global-color-gray-75);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
--background: var(--spectrum-alias-background-color-primary);
|
--background: var(--spectrum-alias-background-color-primary);
|
||||||
--background-alt: var(--spectrum-alias-background-color-secondary);
|
--background-alt: var(--spectrum-alias-background-color-default);
|
||||||
--border-light: 1px solid var(--spectrum-global-color-gray-300);
|
--border-light: 1px solid var(--spectrum-global-color-gray-300);
|
||||||
--border-dark: 1px solid var(--spectrum-global-color-gray-400);
|
--border-dark: 1px solid var(--spectrum-global-color-gray-400);
|
||||||
--ink: var(--spectrum-alias-text-color);
|
--ink: var(--spectrum-alias-text-color);
|
||||||
|
|
|
@ -1558,5 +1558,18 @@
|
||||||
"context": {
|
"context": {
|
||||||
"type": "schema"
|
"type": "schema"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"pagination": {
|
||||||
|
"name": "Pagination Control",
|
||||||
|
"icon": "",
|
||||||
|
"styleable": true,
|
||||||
|
"hasChildren": "false",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "dataProvider",
|
||||||
|
"label": "Provider",
|
||||||
|
"key": "dataProviderId"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<script>
|
||||||
|
import { getContext } from "svelte"
|
||||||
|
|
||||||
|
export let dataProviderId
|
||||||
|
|
||||||
|
const component = getContext("component")
|
||||||
|
const { styleable, ActionTypes, builderStore } = getContext("sdk")
|
||||||
|
const dataContext = getContext("context")
|
||||||
|
|
||||||
|
$: dataProviderContext = dataContext?.[dataProviderId]
|
||||||
|
$: pageNumber = dataProviderContext?.pageNumber ?? 1
|
||||||
|
$: hasPrevPage = dataProviderContext?.hasPrevPage ?? false
|
||||||
|
$: hasNextPage = dataProviderContext?.hasNextPage ?? false
|
||||||
|
$: prevPage = dataContext?.[`${dataProviderId}_${ActionTypes.PrevPage}`]
|
||||||
|
$: nextPage = dataContext?.[`${dataProviderId}_${ActionTypes.NextPage}`]
|
||||||
|
$: hasValidContext = dataProviderContext != null && nextPage != null
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if hasValidContext}
|
||||||
|
<div>
|
||||||
|
Page {pageNumber}
|
||||||
|
</div>
|
||||||
|
{:else if builderStore.inBuilder}
|
||||||
|
<div>Choose a data provider to control with this pagination component.</div>
|
||||||
|
{/if}
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
{#if options}
|
{#if options}
|
||||||
<div use:chart={options} use:styleable={$component.styles} />
|
<div use:chart={options} use:styleable={$component.styles} />
|
||||||
{:else if builderStore.inBuilder}
|
{:else if $builderStore.inBuilder}
|
||||||
<div use:styleable={$component.styles}>
|
<div class="placeholder" use:styleable={$component.styles}>
|
||||||
Use the settings panel to build your chart -->
|
Use the settings panel to build your chart.
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
@ -21,4 +21,10 @@
|
||||||
display: flex !important;
|
display: flex !important;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
div :global(.apexcharts-yaxis-label, .apexcharts-xaxis-label) {
|
||||||
|
fill: #aaa;
|
||||||
|
}
|
||||||
|
div.placeholder {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue