Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the lost branch #136

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@outerbase/astra-ui",
"version": "0.8.11",
"version": "0.8.13",
"type": "module",
"main": "dist/js/index.js",
"module": "dist/js/index.js",
Expand Down
16 changes: 12 additions & 4 deletions src/components/charts/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import type {
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
import { isDate } from '../../lib/format-date.js'
import { OUTERBASE_API_DOMAIN } from '../../variables.js'
import { debounce } from 'lodash-es'

// Register the required components
echarts.use([
Expand Down Expand Up @@ -254,9 +255,7 @@ export default class AstraChart extends ClassifiedElement {

override firstUpdated(_changedProperties: PropertyValueMap<this>) {
super.firstUpdated(_changedProperties)

this.initializeChart()
this.setupResizeObserver()
}

override updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {
Expand Down Expand Up @@ -334,6 +333,13 @@ export default class AstraChart extends ClassifiedElement {

this.chartInstance = echarts.init(this.chartDiv, undefined, { renderer: 'canvas' })
this.chartInstance.setOption(this.getChartOptions())

if (this.resizeObserver) {
this.resizeObserver.disconnect()
delete this.resizeObserver
}

this.setupResizeObserver()
}

private labelFormatter(value: unknown): string {
Expand Down Expand Up @@ -543,7 +549,7 @@ export default class AstraChart extends ClassifiedElement {
}

private setupResizeObserver() {
this.resizeObserver = new ResizeObserver((entries) => {
const onResize = debounce((entries: ResizeObserverEntry[]) => {
for (const entry of entries) {
if (entry.target === this.chartDiv) {
const { width, height } = entry.contentRect
Expand All @@ -556,7 +562,9 @@ export default class AstraChart extends ClassifiedElement {
}
}
}
})
}, 50)

this.resizeObserver = new ResizeObserver(onResize)

if (this.chartDiv) {
this.resizeObserver.observe(this.chartDiv)
Expand Down
4 changes: 1 addition & 3 deletions src/components/charts/composed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ export default class AstraComposedChart extends AstraChart {
// render chart
const showNoDataLabel = (layer?.result === undefined || layer?.result?.length === 0) && layer?.type !== 'text'
const chart = showNoDataLabel ? null : super.render()
const chartSection = html`<div
class=${`h-full w-full flex-1 ${layer?.type === 'table' ? 'border-t border-[#d4d4d4] dark:border-[#404040] z-0' : ''}`}
>
const chartSection = html`<div class=${`h-full w-full flex-1 ${layer?.type === 'table' ? 'z-0' : ''}`}>
${showNoDataLabel
? html`<svg
width="32"
Expand Down
2 changes: 1 addition & 1 deletion src/components/table/core/td.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class TableData extends MutableElement {
'relative focus:z-[1]': true,
'h-[34px] flex items-center justify-center': true,
'border-theme-table-border dark:border-theme-table-border-dark': true,
'backdrop-blur-sm': this.blank || this.pinned,
// 'backdrop-blur-sm': this.blank || this.pinned,
// TODO support odd vs even again
'text-theme-table-content dark:text-theme-table-content-dark': !this.isEditing,
'text-theme-table-cell-mutating-content dark:text-theme-table-cell-mutating-content': this.isEditing,
Expand Down