Skip to content

Commit

Permalink
refactor(chart): move components to widgets folder, change export type
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwangyihao committed Oct 6, 2024
1 parent 001781e commit fecc3f6
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 42 deletions.
16 changes: 1 addition & 15 deletions extensions/chart/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
export * from './utils'
export * from './baseChart'
export * from './chartData.vue'
export { default as ChartData } from './chartData.vue'
export * from './chartDataset.vue'
export { default as ChartDataset } from './chartDataset.vue'
export * from './barChart.vue'
export { default as BarChart } from './barChart.vue'
export * from './lineChart.vue'
export { default as LineChart } from './lineChart.vue'
export * from './scatterChart.vue'
export { default as ScatterChart } from './scatterChart.vue'
export * from './bubbleChart.vue'
export { default as BubbleChart } from './bubbleChart.vue'
export * from './mixedChart.vue'
export { default as MixedChart } from './mixedChart.vue'
export * from './widgets'
4 changes: 3 additions & 1 deletion extensions/chart/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * as ChartUtil from './chartUtil'
import * as ChartUtil from './chartUtil'

export { ChartUtil }
6 changes: 3 additions & 3 deletions extensions/chart/src/utils/useSimpleChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { defineWidget } from '@vue-motion/core'
import type { Ref } from 'vue'
import { inject, provide, ref, unref } from 'vue'

import type { BaseSimpleChartData, BaseSimpleChartOptions } from '../baseSimpleChart.vue'
import type { ChartLayoutConfig } from '../chartLayout.vue'
import type { MixedChartData } from '../mixedChart.vue'
import type { BaseSimpleChartData, BaseSimpleChartOptions } from '../widgets/baseSimpleChart.vue'

Check failure on line 5 in extensions/chart/src/utils/useSimpleChart.ts

View workflow job for this annotation

GitHub Actions / type-check

Module '"*.vue"' has no exported member 'BaseSimpleChartData'. Did you mean to use 'import BaseSimpleChartData from "*.vue"' instead?

Check failure on line 5 in extensions/chart/src/utils/useSimpleChart.ts

View workflow job for this annotation

GitHub Actions / type-check

Module '"*.vue"' has no exported member 'BaseSimpleChartOptions'. Did you mean to use 'import BaseSimpleChartOptions from "*.vue"' instead?
import type { ChartLayoutConfig } from '../widgets/chartLayout.vue'

Check failure on line 6 in extensions/chart/src/utils/useSimpleChart.ts

View workflow job for this annotation

GitHub Actions / type-check

Module '"*.vue"' has no exported member 'ChartLayoutConfig'. Did you mean to use 'import ChartLayoutConfig from "*.vue"' instead?
import type { MixedChartData } from '../widgets/mixedChart.vue'

Check failure on line 7 in extensions/chart/src/utils/useSimpleChart.ts

View workflow job for this annotation

GitHub Actions / type-check

Module '"*.vue"' has no exported member 'MixedChartData'. Did you mean to use 'import MixedChartData from "*.vue"' instead?

export function useSimpleChart<T extends BaseSimpleChartOptions>(props: T) {
const options = defineWidget<T>(props)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
import { onMounted, ref, watchEffect } from 'vue'
import type { BaseSimpleChartOptions } from './baseSimpleChart.vue'
import { useSimpleChart } from '../utils/useSimpleChart.ts'
import type { BaseChartStyle, Color } from '..'
import { ColorEnum, DataUtil } from '..'
import BaseSimpleChart from './baseSimpleChart.vue'
import { useSimpleChart } from './utils/useSimpleChart.ts'
import type { BaseChartStyle, Color } from '.'
import { ColorEnum, DataUtil } from '.'
import type { BaseSimpleChartOptions } from './baseSimpleChart.vue'
/**
* BarChart style.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { DateTime, DateTimeUnit } from 'luxon'

import type { WidgetOptions } from '@vue-motion/lib'
import type { ReturnWidget } from '@vue-motion/core'
import type { BarChartStyle, ChartDataOptions, DateTimeWithDuration } from '..'
import type { LineChartStyle } from './lineChart.vue'

Check failure on line 6 in extensions/chart/src/widgets/baseChart.ts

View workflow job for this annotation

GitHub Actions / type-check

Module '"*.vue"' has no exported member 'LineChartStyle'. Did you mean to use 'import LineChartStyle from "*.vue"' instead?
import type { BarChartStyle, ChartDataOptions, DateTimeWithDuration } from '.'
// import type { default as ChartLayout } from './chartLayout'
// import type { ChartDataUnit } from './chartDataUnit'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import type { Growable } from '@vue-motion/lib'
import { widget } from '@vue-motion/lib'
import type { DateTime } from 'luxon'
import { withDefaults } from 'vue'
import { useSimpleChart } from '../utils/useSimpleChart.ts'
import type { BaseChartDataSet, BaseChartOptions, ChartStyle } from '..'
import ChartLayout from './chartLayout.vue'
import type { BaseChartOptions, ChartStyle } from './baseChart.ts'
import type { BaseChartDataSet } from './chartDataset.vue'
import { useSimpleChart } from './utils/useSimpleChart.ts'
/**
* BaseSimpleChartOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useSimpleChart } from './utils/useSimpleChart.ts'
import type { LineChartOptions } from '.'
import { LineChart } from '.'
import { useSimpleChart } from '../utils/useSimpleChart.ts'
import type { LineChartOptions } from '..'
import { LineChart } from '..'
export interface BubbleChartOptions extends LineChartOptions {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { defineWidget } from '@vue-motion/core'
import type { Ref } from 'vue'
import { inject } from 'vue'
import type { BaseChartDataSet, ChartStyle } from '.'
import type { BaseChartDataSet, ChartStyle } from '..'
export interface ChartDataOptions extends WidgetOptions {
index?: number | DateTimeWithDuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { defineWidget } from '@vue-motion/core'
import type { Ref } from 'vue'
import { inject, provide, ref, unref } from 'vue'
import type { ChartDataOptions, ChartStyle } from '..'
import type { BaseSimpleChartData } from './baseSimpleChart.vue'
import type { ChartDataOptions, ChartStyle } from '.'
export interface ChartDatasetOptions extends WidgetOptions {
label: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { type Ref, inject, ref, watchEffect } from 'vue'
import type { DateTimeUnit } from 'luxon'
import { DateTime } from 'luxon'
import stringWidth from 'string-width'
import type { BaseChartOptions, Color, DateTimeFormatOptions } from '..'
import { ColorEnum, DataUtil } from '..'
import type { BaseSimpleChartData } from './baseSimpleChart.vue'
import type { BaseChartOptions, Color, DateTimeFormatOptions } from '.'
import { ColorEnum, DataUtil } from '.'
export interface ChartLayoutOptions extends BaseChartOptions, Growable {
}
Expand Down
15 changes: 15 additions & 0 deletions extensions/chart/src/widgets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export * from './baseChart.ts'
export type { ChartDataOptions, DateTimeWithDuration } from './chartData.vue'

Check failure on line 2 in extensions/chart/src/widgets/index.ts

View workflow job for this annotation

GitHub Actions / type-check

Module '"*.vue"' has no exported member 'ChartDataOptions'. Did you mean to use 'import ChartDataOptions from "*.vue"' instead?

Check failure on line 2 in extensions/chart/src/widgets/index.ts

View workflow job for this annotation

GitHub Actions / type-check

Module '"*.vue"' has no exported member 'DateTimeWithDuration'. Did you mean to use 'import DateTimeWithDuration from "*.vue"' instead?
export { default as ChartData } from './chartData.vue'
export type { ChartDatasetOptions, BaseChartDataSet } from './chartDataset.vue'
export { default as ChartDataset } from './chartDataset.vue'
export type { BarChartStyle, BarChartOptions } from './barChart.vue'
export { default as BarChart } from './barChart.vue'
export type { LineChartStyle, LineChartOptions } from './lineChart.vue'
export { default as LineChart } from './lineChart.vue'
export type { ScatterChartOptions } from './scatterChart.vue'
export { default as ScatterChart } from './scatterChart.vue'
export type { BubbleChartOptions } from './bubbleChart.vue'
export { default as BubbleChart } from './bubbleChart.vue'
export type { MixedChartData, MixedChartOptions } from './mixedChart.vue'
export { default as MixedChart } from './mixedChart.vue'
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup lang="ts">
import { onMounted, ref, watchEffect } from 'vue'
import type { BaseSimpleChartOptions } from './baseSimpleChart.vue'
import { useSimpleChart } from '../utils/useSimpleChart.ts'
import { bezierControlPoints } from '../utils/bezierControlPoints.ts'
import type { BaseChartStyle, Color } from '..'
import { ColorEnum, DataUtil } from '..'
import BaseSimpleChart from './baseSimpleChart.vue'
import { useSimpleChart } from './utils/useSimpleChart.ts'
import { bezierControlPoints } from './utils/bezierControlPoints.ts'
import type { BaseChartStyle, Color } from '.'
import { ColorEnum, DataUtil } from '.'
import type { BaseSimpleChartOptions } from './baseSimpleChart.vue'
/**
* LineChart style.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { useSimpleChart } from './utils/useSimpleChart.ts'
import type { LineChartOptions } from '.'
import { LineChart } from '.'
import { useSimpleChart } from '../utils/useSimpleChart.ts'
import type { LineChartOptions } from '..'
import { LineChart } from '..'
export interface ScatterChartOptions extends LineChartOptions {
}
Expand Down

0 comments on commit fecc3f6

Please sign in to comment.