arbor-dashboard 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,2 +1,15 @@
1
- # data.responsive_charting_dashboards
2
- An npm package of responsive charting components for data visualisation
1
+ # 🚀 Welcome to your new awesome project!
2
+
3
+ This project has been created using **webpack-cli**, you can now run
4
+
5
+ ```
6
+ npm run build
7
+ ```
8
+
9
+ or
10
+
11
+ ```
12
+ yarn build
13
+ ```
14
+
15
+ to bundle your application
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "arbor-dashboard",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "A tool to create responsive dashboards with charts",
5
- "main": "index.ts",
6
- "types": "index.d.ts",
5
+ "main": "src/index.ts",
6
+ "types": "src/index.d.ts",
7
7
  "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "build": "webpack --mode=production --node-env=production",
10
+ "build:dev": "webpack --mode=development",
11
+ "build:prod": "webpack --mode=production --node-env=production",
12
+ "watch": "webpack --watch"
9
13
  },
10
14
  "repository": {
11
15
  "type": "git",
@@ -34,10 +38,22 @@
34
38
  },
35
39
  "devDependencies": {
36
40
  "@eslint/js": "^9.13.0",
41
+ "@types/react": "^18.3.12",
42
+ "@types/react-grid-layout": "^1.3.5",
43
+ "@webpack-cli/generators": "^3.0.7",
44
+ "css-loader": "^7.1.2",
37
45
  "eslint": "^9.13.0",
38
46
  "eslint-plugin-react": "^7.37.1",
39
47
  "globals": "^15.11.0",
48
+ "html-webpack-plugin": "^5.6.3",
49
+ "mini-css-extract-plugin": "^2.9.2",
40
50
  "prettier": "^3.3.3",
41
- "typescript-eslint": "^8.11.0"
51
+ "sass": "^1.81.0",
52
+ "sass-loader": "^16.0.3",
53
+ "style-loader": "^4.0.0",
54
+ "ts-loader": "^9.5.1",
55
+ "typescript-eslint": "^8.11.0",
56
+ "webpack": "^5.96.1",
57
+ "webpack-cli": "^5.1.4"
42
58
  }
43
59
  }
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import {transformChartData} from './transformChartData';
4
4
  import {useQuery} from '@tanstack/react-query';
5
5
  import {httpGet} from '../../HttpRequest/HttpRequest';
6
- import {BarChartProps} from 'responsiveChartingDashboardsTypes';
6
+ import {BarChartProps} from '../../index.d';
7
7
 
8
8
  export const BarChart = ({dataUrl, authToken, testEnv}: BarChartProps) => {
9
9
  const {data} = useQuery({
@@ -8,7 +8,7 @@ import React from 'react';
8
8
  import {transformChartData} from './transformChartData';
9
9
  import {useQuery} from '@tanstack/react-query';
10
10
  import {httpGet} from '../../HttpRequest/HttpRequest';
11
- import {HeatMapProps} from 'responsiveChartingDashboardsTypes';
11
+ import {HeatMapProps} from '../../index.d';
12
12
 
13
13
  export const HeatMap = ({dataUrl, authToken, testEnv}: HeatMapProps) => {
14
14
  const {data} = useQuery({
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import {transformChartData} from './transformChartData';
4
4
  import {useQuery} from '@tanstack/react-query';
5
5
  import {httpGet} from '../../HttpRequest/HttpRequest';
6
- import {LineChartProps} from 'responsiveChartingDashboardsTypes';
6
+ import {LineChartProps} from '../../index.d';
7
7
 
8
8
  export const LineChart = ({dataUrl, authToken, testEnv}: LineChartProps) => {
9
9
  const {data} = useQuery({
@@ -1,6 +1,6 @@
1
1
  import {BarDatum} from '@nivo/bar';
2
2
  import {HeatMapDatum, HeatMapSerie} from '@nivo/heatmap';
3
- import {ApiResponse, Data, LineData} from 'responsiveChartingDashboardsTypes';
3
+ import {ApiResponse, Data, LineData} from '../../index.d';
4
4
 
5
5
  export const transformChartData = <T extends Data>(
6
6
  data: ApiResponse<T>,
@@ -6,7 +6,7 @@ import {MoveIcon} from '../../Icons';
6
6
  import {LineChart} from '../Charts/LineChart';
7
7
  import {HeatMap} from '../Charts/HeatMap';
8
8
  import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
9
- import {DashboardProps} from 'responsiveChartingDashboardsTypes';
9
+ import {DashboardProps} from '../../index.d';
10
10
 
11
11
  const ResponsiveGridLayout = WidthProvider(Responsive);
12
12
 
package/src/index.d.ts ADDED
@@ -0,0 +1,96 @@
1
+ export interface BarChartProps {
2
+ dataUrl: string;
3
+ authToken: string;
4
+ testEnv: boolean;
5
+ }
6
+ export interface LineChartProps {
7
+ dataUrl: string;
8
+ authToken: string;
9
+ testEnv: boolean;
10
+ }
11
+ export interface HeatMapProps {
12
+ dataUrl: string;
13
+ authToken: string;
14
+ testEnv: boolean;
15
+ }
16
+ export interface DashboardProps {
17
+ layoutConfig: string;
18
+ authToken: string;
19
+ }
20
+ type Query = {
21
+ limit: number;
22
+ measures: string[];
23
+ dimensions: string[];
24
+ filters: {
25
+ member: string;
26
+ operator: string;
27
+ values: string[];
28
+ }[];
29
+ timeDimensions: {
30
+ dimension: string;
31
+ granularity: string;
32
+ }[];
33
+ timezone: string;
34
+ rowLimit: number;
35
+ };
36
+
37
+ export interface Data {
38
+ [key: string]: string | number;
39
+ }
40
+
41
+ export interface ApiResponse<T> {
42
+ query: Query;
43
+ data: T[];
44
+ lastRefreshTime: string;
45
+ annotation: {
46
+ measures: {
47
+ [key: string]: {
48
+ title: string;
49
+ shortTitle: string;
50
+ description: string;
51
+ type: string;
52
+ meta: {
53
+ user_roles: string[];
54
+ };
55
+ drillMembers: string[];
56
+ drillMembersGrouped: {
57
+ measures: string[];
58
+ dimensions: string[];
59
+ };
60
+ };
61
+ };
62
+ dimensions: {
63
+ [key: string]: {
64
+ title: string;
65
+ shortTitle: string;
66
+ type: string;
67
+ };
68
+ };
69
+ segments: {};
70
+ timeDimensions: {
71
+ [key: string]: {
72
+ title: string;
73
+ shortTitle: string;
74
+ description: string;
75
+ type: string;
76
+ meta: {
77
+ user_roles: string[];
78
+ };
79
+ };
80
+ };
81
+ };
82
+ dataSource: string;
83
+ dbType: string;
84
+ extDbType: string;
85
+ external: boolean;
86
+ slowQuery: boolean;
87
+ total: number | null;
88
+ }
89
+
90
+ export interface LineData {
91
+ id: string | number;
92
+ data: Array<{
93
+ x: number | string | Date;
94
+ y: number | string | Date;
95
+ }>;
96
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export {Dashboard} from './Components/Dashboard/Dashboard';
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowSyntheticDefaultImports": true,
4
+ "noImplicitAny": true,
5
+ "module": "NodeNext",
6
+ "target": "es5",
7
+ "allowJs": true,
8
+ "jsx": "react",
9
+ "moduleResolution": "nodenext"
10
+ },
11
+ "files": ["src/index.ts"]
12
+ }
@@ -0,0 +1,60 @@
1
+ // Generated using webpack-cli https://github.com/webpack/webpack-cli
2
+
3
+ const path = require('path');
4
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
5
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6
+
7
+ const isProduction = process.env.NODE_ENV == 'production';
8
+
9
+ const stylesHandler = MiniCssExtractPlugin.loader;
10
+
11
+ const config = {
12
+ target: 'web',
13
+ entry: './src/index.ts',
14
+ output: {
15
+ path: path.resolve(__dirname, 'dist'),
16
+ filename: 'arbor-dashboard.js',
17
+ library: 'arbor-dashboard',
18
+ libraryTarget: 'umd',
19
+ globalObject: 'this',
20
+ umdNamedDefine: true,
21
+ },
22
+ plugins: [
23
+ new MiniCssExtractPlugin(),
24
+
25
+ // Add your plugins here
26
+ // Learn more about plugins from https://webpack.js.org/configuration/plugins/
27
+ ],
28
+ module: {
29
+ rules: [
30
+ {
31
+ test: /\.(ts|tsx)$/i,
32
+ loader: 'ts-loader',
33
+ exclude: ['/node_modules/'],
34
+ },
35
+ {
36
+ test: /\.s[ac]ss$/i,
37
+ use: [stylesHandler, 'css-loader', 'sass-loader'],
38
+ },
39
+ {
40
+ test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
41
+ type: 'asset',
42
+ },
43
+
44
+ // Add your rules for custom modules here
45
+ // Learn more about loaders from https://webpack.js.org/loaders/
46
+ ],
47
+ },
48
+ resolve: {
49
+ extensions: ['.tsx', '.ts', '.jsx', '.js', '...'],
50
+ },
51
+ };
52
+
53
+ module.exports = () => {
54
+ if (isProduction) {
55
+ config.mode = 'production';
56
+ } else {
57
+ config.mode = 'development';
58
+ }
59
+ return config;
60
+ };
package/index.d.ts DELETED
@@ -1,98 +0,0 @@
1
- declare module 'responsiveChartingDashboardsTypes' {
2
- export interface BarChartProps {
3
- dataUrl: string;
4
- authToken: string;
5
- testEnv: boolean;
6
- }
7
- export interface LineChartProps {
8
- dataUrl: string;
9
- authToken: string;
10
- testEnv: boolean;
11
- }
12
- export interface HeatMapProps {
13
- dataUrl: string;
14
- authToken: string;
15
- testEnv: boolean;
16
- }
17
- export interface DashboardProps {
18
- layoutConfig: string;
19
- authToken: string;
20
- }
21
- type Query = {
22
- limit: number;
23
- measures: string[];
24
- dimensions: string[];
25
- filters: {
26
- member: string;
27
- operator: string;
28
- values: string[];
29
- }[];
30
- timeDimensions: {
31
- dimension: string;
32
- granularity: string;
33
- }[];
34
- timezone: string;
35
- rowLimit: number;
36
- };
37
-
38
- export interface Data {
39
- [key: string]: string | number;
40
- }
41
-
42
- export interface ApiResponse<T> {
43
- query: Query;
44
- data: T[];
45
- lastRefreshTime: string;
46
- annotation: {
47
- measures: {
48
- [key: string]: {
49
- title: string;
50
- shortTitle: string;
51
- description: string;
52
- type: string;
53
- meta: {
54
- user_roles: string[];
55
- };
56
- drillMembers: string[];
57
- drillMembersGrouped: {
58
- measures: string[];
59
- dimensions: string[];
60
- };
61
- };
62
- };
63
- dimensions: {
64
- [key: string]: {
65
- title: string;
66
- shortTitle: string;
67
- type: string;
68
- };
69
- };
70
- segments: {};
71
- timeDimensions: {
72
- [key: string]: {
73
- title: string;
74
- shortTitle: string;
75
- description: string;
76
- type: string;
77
- meta: {
78
- user_roles: string[];
79
- };
80
- };
81
- };
82
- };
83
- dataSource: string;
84
- dbType: string;
85
- extDbType: string;
86
- external: boolean;
87
- slowQuery: boolean;
88
- total: number | null;
89
- }
90
-
91
- export interface LineData {
92
- id: string | number;
93
- data: Array<{
94
- x: number | string | Date;
95
- y: number | string | Date;
96
- }>;
97
- }
98
- }
package/index.ts DELETED
@@ -1 +0,0 @@
1
- export {Dashboard} from './src/Components/Dashboard/Dashboard';