vegarringdal / simple-html

MIT License
3 stars 0 forks source link

@simple-html/grid

Package: npm i @simple-html/grid -D

Only lit-html as dependency

V.5.0.0 will soon be release, currently on next while I use it in a application to see missing features/stuff I need use the application

Sample:

API docs:

Source code: (have minimal sample of usage)

BundlePhobia: (bundle size)

Minimal code sample

import './index.css';
import { GridInterface, GridElement, GridConfig, Datasource } from '@simple-html/grid';
import "@simple-html/grid/dist/grid.css";

/**
 * create datasource
 */
const datasource = new Datasource();

// add data
datasource.setData([
    { firstname: 'first1', lastname: 'last1' },
    { firstname: 'first2', lastname: 'last2' },
    { firstname: 'first3', lastname: 'last3' }
]);

/**
 * create gridConfig
 */
const gridConfig: GridConfig = {
    columnsCenter: [
        {
            rows: ['firstname'],
            width: 100
        },
        {
            rows: ['lastname'],
            width: 100
        }
    ],
    attributes: [
        {
            attribute: 'firstname'
        },
        {
            attribute: 'lastname'
        }
    ]
};

/**
 * create interface and add gridconfig and datasource to it
 */
const gridInterface = new GridInterface(gridConfig, datasource);

/**
 * create element for the grid
 */
const element = document.createElement('simple-html-grid') as GridElement;
element.style.width = '100%';
element.style.height = '100%';
element.style.display = 'flex';
element.classList.add('simple-html-grid');
element.connectInterface(gridInterface);

document.body.appendChild(element);

5.0.0 Info / Progress

TODO / Features

Need for version "5.0.0":

Wanted/considering (some will be part of 5.0.0)

Dev

Release

Will make github action

Update demo