4.4.9 • Published 3 years ago

db-viewer-component v4.4.9

Weekly downloads
18
License
MIT
Repository
github
Last release
3 years ago

NPM npm CI

db-viewer-component

Database schema viewer web component. This web component can be used to view interactive database diagrams. See an example.

Note: This component doesn't work on old browsers that don't support web components.

Usage

In the case of webpack, import the package in your main js file.

import 'db-viewer-component';

in html:

<db-viewer src="/awesome-schema.json"></db-viewer>

The schema for viewer can be specified either with src attribute as shown above or by schema property of db-viwer html object like this:

document.querySelector('db-viewer').schema = awesomeSchema;

The json schema for db-veiwer schema can be found here. An example of schema can be found here.

A simple usage example can be found here. An example usage with the React can be found here. An example usage with the Svelte can be found here.

API

Attributes

NameDescription
srcViewer-schema url. It should follow this json schema. An example of schema can be found here.
disable-table-movementIf this attribute exist. Table movement will be disabled.
viewportViewport positioning strategy on initial load. Can be "noChange", "centerByTablesWeight", "center" or "centerByTables".

Events

NameDescriptionevent.detail
tableClickClicking on a table.{tableName, pos: {x, y}, width, height}
tableDblClickDouble clicking on a table.{tableName, pos: {x, y}, width, height}
tableContextMenuRight clicking on a table.{tableName, pos: {x, y}, width, height}
tableMoveMoving table.{tableName, pos: {x, y}, width, height}
tableMoveEndMoving table ends.{tableName, pos: {x, y}, width, height}
relationClickClicking on a relation.{fromTable, toTable, fromColumn, toColumn}
relationDblClickDouble clicking in a relation.{fromTable, toTable, fromColumn, toColumn}
relationContextMenuRight clikc on a realtion.{fromTable, toTable, fromColumn, toColumn}
zoomInZooming in view
zoomOutZooming out view
loadSchema file has been successfully fetched from server.
readyDb viewer component has been loaded.
viewportClickClicking on the viewport.{x, y}

Properties

NameDescription
schemaGet and set schema for viewer. This will override the html src attribute. Note: src attribute accepts the address of viewer-schema and schema property accepts javascript object as viewer-schema. The viwer-schema should follow this json schema. Note the only way that db-viewer can alter the schema is by adding position of tables.
srcSet viewer-schema url. It should follow this json schema. An example of schema can be found here. It has the same effect as the src attribute.
scrollLeftGet and set scrolling position from left.
scrollTopGet and set scrolling position from top.
disableTableMovementDisables table movement if true.
viewportViewport positioning strategy on initial load. Can be "noChange", "centerByTablesWeight", "center" or "centerByTables".

Methods

NameDescriptionArguments
getTablePosGet position of table.table name
setTablePosSet position of table.table name, x cord, y cord
zoomInZoom in view.
zoomOutZoom out view.
getZoomGet amount of zoom

Styles

Styles can be applied by the following CSS variables. Name | Description --- | --- --table-boarder-color | Table border color --viewer-background-color | Viewer background color --relation-color | Relation color | --relation-color-highlight | Relation color on mouse hover --font-family | Font --color | Text color

To run

  1. yarn
  2. yarn start
  3. Navigate to http://localhost:9998
4.4.9

3 years ago

4.4.8

3 years ago

4.4.7

3 years ago

4.4.6

3 years ago

4.4.1

3 years ago

4.4.2

3 years ago

4.4.4

3 years ago

4.4.0

3 years ago

4.3.9

3 years ago

4.3.12

3 years ago

4.3.11

3 years ago

4.3.10

3 years ago

4.3.8

3 years ago

4.3.7

4 years ago

4.3.6

4 years ago

4.3.4

4 years ago

4.3.2

4 years ago

4.2.2

4 years ago

4.2.1

4 years ago

4.2.0

4 years ago

4.1.8

4 years ago

4.1.7

4 years ago

4.1.4

4 years ago

4.1.3

4 years ago

4.1.5

4 years ago

4.1.0

4 years ago

4.1.2

4 years ago

4.1.1

4 years ago

4.0.4

4 years ago

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.8.0

4 years ago

3.7.8

4 years ago

3.7.7

4 years ago

3.7.5

4 years ago

3.7.6

4 years ago

3.7.4

4 years ago

3.7.3

4 years ago

3.7.2

4 years ago

3.7.1

4 years ago

3.7.0

4 years ago

3.6.6

5 years ago

3.6.5

5 years ago

3.6.4

5 years ago

3.6.3

5 years ago

3.6.2

5 years ago

3.6.1

5 years ago

3.6.0

5 years ago

3.5.0

5 years ago

3.4.3

5 years ago

3.4.2

5 years ago

3.4.1

5 years ago

3.4.0

5 years ago

3.3.1

5 years ago

3.3.0

5 years ago

3.2.0

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.0.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.22

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago