1.0.3 • Published 15 days ago

city-dashboard-component v1.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
15 days ago

City Dashboard Component

Requirements

This component was designed for Vue version 3 or above. Please install via npm version 20 or above.

Installation

  1. Install the package via npm.
npm i city-dashboard-component
  1. Import the stylesheet to main.js.
import "city-dashboard-component/style.css";
  1. Import the component globally or locally in any Vue component.
import { DashboardComponent } from "city-dashboard-component";

// If global
app.component("DashboardComponent", DashboardComponent);

Modes

  • Default: The default form of this component with a chart in the middle.
  • Large: Slightly larger height than default mode.
  • Half: Half the height of default mode.
  • Map: Adds a toggle and collapse mode.
  • HalfMap: Half the height of map mode when expanded.
  • Preview: No chart in the middle but only descriptions.

Props

This component follows the configuration of Taipei City Dashboard. Please refer to its documentation for more information.

PropTypeDefaultDescription
configObject<ComponentConfig>None. Required.Component Config. Refer to Taipei City Dashboard's docs for the complete list of parameters available.
modeEnum"default"Must be one of "default", "large", "map", "half", "halfmap", "preview"
favoriteBtnBooleanfalseWhether to show a favorite button
isFavoriteBooleanfalseWhether the component is liked
deleteBtnBooleanfalseWhether to show a delete button
addBtnBooleanfalseWhether to show an add button
infoBtnBooleanfalseWhether to show an info button
infoBtnTextString"組件資訊"The text of the info button
toggleDisableBooleanfalseWhether to disable the toggle in map mode
footerBooleantrueWhether to show the footer
styleObject{}Override the wrapper styles of the component

Events

This component follows the configuration of Taipei City Dashboard. Please refer to its documentation for more information.

EventRequired PropsFired WhenParameters
favoritefavoriteBtnThe favorite button is clickedid<Number>
deletedeleteBtnThe delete button is clickedid<Number>
addaddBtnThe add button is clickedid<Number>
infoinfoBtnThe info button is clickedconfig<ComponentConfig>
togglemode<"map", "halfmap">The toggle button is clickedvalue<Boolean>, map_config<MapConfig[]>
filterByParammode<"map", "halfmap">, config has map filter in param modeWhen the chart is clicked and no filter is present.map_filter<MapFilter>, map_config<MapConfig[]>, x<string or null>, y<string or null>
filterByLayermode<"map", "halfmap">, config has map filter in layer modeWhen the chart is clicked and no filter is present.map_config<MapConfig[]>, x<string or null>
clearByParamFiltermode<"map", "halfmap">, config has map filter in param modeWhen the chart is clicked and a filter is present.map_config<MapConfig[]>
clearByLayerFiltermode<"map", "halfmap">, config has map filter in layer modeWhen the chart is clicked and a filter is present.map_config<MapConfig[]>
flymode<"map", "halfmap">, config specifies DistrictChartWhen the chart is clicked.location<{lng, lat}>

Example

Screenshot 2024-04-19 at 9 53 39 AM

<script setup>
import { ref } from "vue"
import { DashboardComponent } from "city-dashboard-component"

const config = {...} // Please refer to Taipei City Dashboard Docs
const isFavorite = ref(false);

function showMoreInfo(config) {
  // a function to open a dialog to show more info about the component
}
</script>

<template>
  <DashboardComponent
      mode="default"
      :config="config"
      :info-btn="true"
      :favorite-btn="true"
      :is-favorite="isFavorite"
      @favorite="
        (id) => {
          console.log(id);
          isFavorite = !isFavorite
        }
      "
      @info="
        (config) => {
          showMoreInfo(config);
        }
      "
  />
</template>

For more examples, please refer to Taipei City Dashboard or its GitHub repository.

© 2023-2024 Igor Ho, One Premium Ltd.

1.0.3

15 days ago

1.0.2

18 days ago

1.0.1

18 days ago

0.2.1

20 days ago

0.2.0

20 days ago

0.2.2

19 days ago

0.1.1

21 days ago

1.0.0

22 days ago

0.1.0

22 days ago

0.0.3

26 days ago

0.0.2

26 days ago

0.0.8

25 days ago

0.0.5

26 days ago

0.0.4

26 days ago

0.0.7

26 days ago

0.0.6

26 days ago

0.0.1

1 month ago

0.0.0

1 month ago