MD - Datatable - stopped using setContext

This commit is contained in:
Michael Shanks 2020-02-24 15:59:54 +00:00
parent 0cb9312e75
commit e9ccf25eb8
5 changed files with 14 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<script>
import { onMount, setContext } from "svelte"
import { onMount } from "svelte"
import { MDCDataTable } from "@material/data-table"
import Row from "./DatatableRow.svelte"
import Cell from "./DatatableCell.svelte"
@ -10,13 +10,14 @@
export let onLoad
const cb = new ClassBuilder("data-table")
setContext("BBMD:data-table:cb", cb)
let datatable = null
let instance = null
let tableElement
let initialied = false
$: {
if(tableElement && datatable && !initialied) {
const children = _bb.attachChildren(tableElement)

View File

@ -4,7 +4,7 @@ import ClassBuilder from "../ClassBuilder.js"
export let _bb
const cb = getContext("BBMD:data-table:cb")
const cb = new ClassBuilder("data-table")
let tbody

View File

@ -1,11 +1,12 @@
<script>
import { getContext } from "svelte"
import ClassBuilder from "../ClassBuilder.js"
export let isHeader = false
export let numeric = false
export let _bb
const cb = getContext("BBMD:data-table:cb")
const cb = new ClassBuilder("data-table")
let elementName = isHeader ? "header-cell" : "cell"
let modifiers = { numeric }

View File

@ -1,7 +1,11 @@
<script>
import ClassBuilder from "../ClassBuilder.js"
export let _bb
const cb = new ClassBuilder("data-table")
let thead
$: thead && _bb.attachChildren(thead)

View File

@ -1,5 +1,6 @@
<script>
import { getContext } from "svelte";
import ClassBuilder from "../ClassBuilder.js"
export let onSelect = () => {};
export let isHeader = false;
@ -9,7 +10,7 @@
let row = null;
let selected = false;
const cb = getContext("BBMD:data-table:cb");
const cb = new ClassBuilder("data-table")
let elementName = isHeader ? "header-row" : "row";
let modifiers = {};