1.0.0 • Published 2 years ago

@ks-web-components/ks-widget v1.0.0

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

ks-widget

Smart component that uses an adapter to fetch data, passes it to the corresponding mapper to transform it, and picks the right component for the catalog to use the corresponding visualization and card wrapper.

npm npm bundle size

Usage

npm install @ks-web-components/ks-widget

Live Example

Attributes

export interface GraphqlAdapterProps {
  config: {
    clientUrl: string
    queryString: string
  }
  tag: 'ks-graphql-adapter'
}

export interface StaticAdapterProps {
  config: {
    data: unknown
  }
  tag: 'ks-static-adapter'
}

export type AdapterProps = GraphqlAdapterProps | StaticAdapterProps

export interface DataMapperProps {
  config: DataMapperConfig
  tag: 'ks-data-mapper'
}

export interface HighchartsMapperProps {
  config: {
    prefix?: string
    seriesGroup?: LeafData
    x?: LeafData
    y?: LeafData
  }
  preset: string
  tag: 'ks-highcharts-mapper'
}

export type MapperProps = DataMapperProps | HighchartsMapperProps

export interface ContentProps {
  properties: Record<string, unknown>
  tag: string
}

export interface WidgetProps {
  name: string
  adapter?: AdapterProps
  mapper?: MapperProps
  content: ContentProps
}
PropertyAttributeTypeDefaultDescription
datadataJSONData to inject to the content
contentcontentContentPropsWhich component to use from the catalog and their properties
mappermapperMapperPropsPossible configuration and tag for the mapper
adapteradapterAdapterProps{ tag: 'ks-static-adapter', config: { data: [] } }Possible configuration and tag for the adapter

Element API

NameDescription
refreshRefresh the content of the component
resizeResize the card
setLoadingUpdate the loding state of the widget
setContentTagChange the content tag property
1.0.0

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.19

2 years ago

1.0.0-rc.1

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago