1.12.4 • Published 2 years ago

dashboard-widget-library v1.12.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Dashboard widget library

This is a beta widget library for the NEXPIE IoT dashboard.

📦 Install

npm install dashboard-widget-library
yarn add dashboard-widget-library

🔨 Usage

import { ButtonWidget } from "dashboard-widget-library";

const App = () => (
  <>
    <ButtonWidget title="Button" onClick={() => alert("Button clicked!")}>
      PRESS ME
    </ButtonWidget>
  </>
);

Widget

Property from table below can be use with any widget.

PropertyDescriptionTypeDefault
titleSet title of widget cardstring-
descriptionSet description of widget cardstring-
iconSet icon of widget card,only works with progress switch slider statusReactNode-
hideLabeltoggles rendering value labelbooleanfalse

Button

import { ButtonWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
colorSet background color of Buttonstring-
onClickSet the handler to handle click event(event) => void-
labelSet text on Buttonstring-

Status

import { StatusWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
colorSet background color of status badgestringred
labelSet label of statusstring-

|

Label

import { LabelWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
labelset label of widgetstring-

Switch

import { SwitchWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
colorSet background color of Buttonstring-
labelOnSet label for switch onstring'ON'
labelOffSet label for switch offstring'OFF'
checkedDetermine whether the Switch is checkedbooleanfalse
onChangeTrigger when the checked state is changingfunction(checked: boolean)-
onClickTrigger when clickedfunction(event: Event)-

Progress

import { ProgressWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
strokeColorThe color of progress barstring-
valueTo set the completion valuenumber-
blockToggle progress block stylebooleanfalse
minSet min value of progress barnumber0
maxSet max value of progress barnumber100
thresholdColorSet threshold color of progress bar { min: number, max: number, color: string } -

Maps

import { MapsWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
placesplaces of markerarray ex: {name: string,color: string(optional), latitude: number, longitude: number}-

Tabs

import { TabsWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
optionsoptions of tabsarray ex "A","B","C"-
valuecurrent tab valuestring ex "A"-
onTabChangeexecuted when active tab is changedfunction(activeTab, activeIndex)-

Slider

import { RangeSliderWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
strokeColorThe color of Sliderstring-
valueThe value of slidernumber0
minThe minimum value the slider can slide tonumber0
maxThe maximum value the slider can slide tonumber100
onChangeCallback function that is fired when the user changes the slider's valuefunction(value, percent)-
showPercenttoggle rendering percentage instead of valuebooleanfalse
thresholdColorSet threshold color of slider { min: number, max: number, color: string } -

Text

import { TextWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
labelSet label of widgetstring-
descriptionSet description of widgetstring-

Text Input

import { InputTextWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
defaultValueSet default value of inputstring-
onClickTrigger when clickedfunction(text: string)-

Chart Incomplete

import { ChartWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefaultexample
seriesData record array to be displayedarray-["time", "data1", "data2", ...,"time(n)", "data1(n)", "data2(n)"]

Donut Chart

import { DonutChartWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
seriesData record array to be displayedarray ex { name: "Group A", value: 400 },{ name: "Group B", value: 300 },{ name: "Group C", value: 300 },{ name: "Group D", value: 200 }-
labelLabel of donut chartstring-
colorsColors of dataarray-
hideLegendDisplay legend of chartbooleanfalse

Gauge Incomplete

import { GaugeWidget } from "dashboard-widget-library";
PropertyDescriptionTypeDefault
valuevalue of gaugenumber-
unitunit of valuestring-
strokeColorColor of strokestring-
minThe minimum value of gaugenumber0
maxThe maximum value of gaugenumber100
thresholdColorSet threshold color of slider { min: number, max: number, color: string } -

Table Incomplete

import { TableWidget } from "dashboard-widget-library";
PropertyDescriptionTypeexampleDefault
columnscolumns of tablearray{title: "Name",dataIndex: "name",key: "name",align: "center",},{title: "Operations",dataIndex: "",key: "operations",align:"center",render: ReactNode,},-
datadata to displayarray{ name: "Jack", age: 28, address: "some where else", key: "1" },{ name: "Rose", age: 36, address: "some where", key: "2" },-
headerColorSet table header colorstring--
headerTextColorSet table header text colorstring--
oddColorSet table odd row colorstring--
evenColorSet table even row colorstring--
hoverColorSet table hover colorstring--

License

MIT

1.12.3

2 years ago

1.12.2

2 years ago

1.12.1

2 years ago

1.12.0

3 years ago

1.12.4

2 years ago

1.11.2

3 years ago

1.11.1

3 years ago

1.10.2

3 years ago

1.9.5

3 years ago

1.11.0

3 years ago

1.10.1

3 years ago

1.10.0

3 years ago

1.9.4

3 years ago

1.9.3

3 years ago

1.9.2

3 years ago

1.9.1

3 years ago

1.8.2

3 years ago

1.9.0

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.2.0

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.2.2

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago