1.0.0 • Published 28 days ago

@acryps/page-data-table v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
28 days ago

page data table

Create complex data entry tables with ease

  • Supports shortcuts to switch between cells, fields and rows
  • Smart paste from spreadsheet applications like Excel or Google Docs
  • Simple, yet expandable API

usage

Extend the DataTable class and use your component in a page component. You can extend all of the functions of the DataTable or just use the default implementation. The functions are documented in code.

We do not provide default styles, except for styles required for the table to render as a table. Include them from source/index.scss.

export class BookPricesComponent extends Component {
	books: Book[];
	editions: Edition[];

	async onload() {
		this.books = // get your books
		this.editions = // get your variants, like hardcover, e-book and pocket book
	}

	render() {
		return <ui-books>
			<ui-title>Book Prices</ui-title>

			{new BookPriceTable(books, editions)}
		</ui-books>;
	}
}

class BookPriceTable extends DataTable<Edition, Book> {
	renderColumnHeader(edition: Edition) {
		return edition.name;
	}

	renderRowHeaders(book: Book) {
		return [
			book.name,
			new AuthorComponent(book.author)
		];
	}

	renderCell(edition: Edition, book: Book) {
		let bookEdition = option.standards.find(standard => standard.standardsAgencyId == agency.id) ?? new StandardizedOptionViewModel();

		const nameField = <input 
			type='number'
			$ui-value={bookEdition.price} 
			ui-change={() => save()}
			ui-target='price'
		/>;
		
		const productCodeField = <input 
			type='text'
			$ui-value={bookEdition.isbn} 
			ui-change={() => save()}
			ui-target='isbn'
		/>

		const save = async () => {
			// save the changes
		};

		return [nameField, productCodeField];
	}
}
1.0.0

28 days ago

0.0.20

6 months ago

0.0.21

6 months ago

0.0.19

7 months ago

0.0.18

7 months ago

0.0.17

7 months ago

0.0.16

7 months ago

0.0.15

7 months ago

0.0.14

7 months ago

0.0.13

7 months ago

0.0.12

7 months ago

0.0.11

7 months ago

0.0.10

7 months ago

0.0.9

7 months ago

0.0.8

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago

0.0.0

7 months ago