Skip to content

Commit 87c8c1d

Browse files
committed
fix: update DataViewer to FlatbreadTable in ds-selector
1 parent 0f2dad5 commit 87c8c1d

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

src/components/dataset-selector.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DataViewer } from "../viewer.js"
1+
import { FlatbreadTable } from "../viewer.js"
22

33

44
export class DatasetSelector extends HTMLElement {
@@ -27,7 +27,7 @@ export class DatasetSelector extends HTMLElement {
2727
static get observedAttributes() {
2828
// Combine our attributes with DataViewer's
2929
const ownAttributes = ["src"]
30-
return [...ownAttributes, ...DataViewer.observedAttributes]
30+
return [...ownAttributes, ...FlatbreadTable.observedAttributes]
3131
}
3232

3333
connectedCallback() {
@@ -39,29 +39,29 @@ export class DatasetSelector extends HTMLElement {
3939
attributeChangedCallback(name, oldValue, newValue) {
4040
if (name === "src" && oldValue !== newValue) {
4141
this.loadSpecFromSrc(newValue)
42-
} else if (this.dataViewer && DataViewer.observedAttributes.includes(name)) {
42+
} else if (this.flatbreadTable && FlatbreadTable.observedAttributes.includes(name)) {
4343
// Forward DataViewer attributes
4444
if (newValue !== null) {
45-
this.dataViewer.setAttribute(name, newValue)
45+
this.flatbreadTable.setAttribute(name, newValue)
4646
} else {
47-
this.dataViewer.removeAttribute(name)
47+
this.flatbreadTable.removeAttribute(name)
4848
}
4949
}
5050
}
5151

5252
disconnectedCallback() {
53-
if (this.dataViewer) {
54-
this.dataViewer.remove()
53+
if (this.flatbreadTable) {
54+
this.flatbreadTable.remove()
5555
}
5656
}
5757

5858
forwardInitialAttributes() {
59-
if (!this.dataViewer) return
59+
if (!this.flatbreadTable) return
6060

61-
DataViewer.observedAttributes.forEach(attr => {
61+
FlatbreadTable.observedAttributes.forEach(attr => {
6262
if (attr === 'src') return
6363
if (this.hasAttribute(attr)) {
64-
this.dataViewer.setAttribute(attr, this.getAttribute(attr))
64+
this.flatbreadTable.setAttribute(attr, this.getAttribute(attr))
6565
}
6666
})
6767
}
@@ -192,24 +192,24 @@ export class DatasetSelector extends HTMLElement {
192192

193193
// Access to the underlying DataViewer
194194
getViewer() {
195-
return this.dataViewer
195+
return this.flatbreadTable
196196
}
197197

198198
// Access to the underlying data
199199
getViewerData() {
200-
return this.dataViewer ? this.dataViewer.data : null
200+
return this.flatbreadTable ? this.flatbreadTable.data : null
201201
}
202202

203203
setViewerData(data) {
204-
if (this.dataViewer) {
205-
this.dataViewer.data = data
204+
if (this.flatbreadTable) {
205+
this.flatbreadTable.data = data
206206
}
207207
}
208208

209209
// Update specific parts of the data
210210
updateViewerValues(newValues) {
211-
if (this.dataViewer && this.dataViewer.data) {
212-
this.dataViewer.data.values = newValues
211+
if (this.flatbreadTable && this.flatbreadTable.data) {
212+
this.flatbreadTable.data.values = newValues
213213
}
214214
}
215215

@@ -249,7 +249,7 @@ export class DatasetSelector extends HTMLElement {
249249
const dataset = this.findMatchingDataset()
250250

251251
if (!dataset) {
252-
this.dataViewer.data = { values: [], columns: [], index: [] }
252+
this.flatbreadTable.data = { values: [], columns: [], index: [] }
253253
return
254254
}
255255

@@ -274,19 +274,19 @@ export class DatasetSelector extends HTMLElement {
274274
}
275275
}
276276

277-
this.dataViewer.data = dataset.data
277+
this.flatbreadTable.data = dataset.data
278278

279279
// Apply global options first
280280
if (this.globalOptions) {
281281
for (const [key, value] of Object.entries(this.globalOptions)) {
282-
this.dataViewer.setAttribute(key, value)
282+
this.flatbreadTable.setAttribute(key, value)
283283
}
284284
}
285285

286286
// Apply options if specified
287287
if (dataset.options) {
288288
for (const [key, value] of Object.entries(dataset.options)) {
289-
this.dataViewer.setAttribute(key, value)
289+
this.flatbreadTable.setAttribute(key, value)
290290
}
291291
}
292292
}
@@ -454,7 +454,7 @@ export class DatasetSelector extends HTMLElement {
454454
// Create and append the data-viewer
455455
const viewer = document.createElement("flatbread-table")
456456
this.shadowRoot.querySelector(".viewer-container").appendChild(viewer)
457-
this.dataViewer = viewer
457+
this.flatbreadTable = viewer
458458
this.forwardInitialAttributes()
459459
}
460460
}

0 commit comments

Comments
 (0)