Skip to content

Commit 7f20db3

Browse files
chore(tsconfig): update TypeScript configuration#119
1 parent 9fa411b commit 7f20db3

File tree

10 files changed

+52
-25
lines changed

10 files changed

+52
-25
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"description": "",
66
"exports": {
77
".": {
8+
"types": "./dist/types/index.d.ts",
89
"import": "./dist/vue-pivottable.es.js",
9-
"require": "./dist/vue-pivottable.umd.js",
10-
"types": "./dist/types/index.d.ts"
10+
"require": "./dist/vue-pivottable.umd.js"
1111
},
1212
"./dist/": "./dist/",
1313
"./package.json": "./package.json"

packages/lazy-table-renderer/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"description": "",
66
"exports": {
77
".": {
8+
"types": "./dist/types/index.d.ts",
89
"import": "./dist/lazy-table-renderer.es.js",
9-
"require": "./dist/lazy-table-renderer.umd.js",
10-
"types": "./dist/types/index.d.ts"
10+
"require": "./dist/lazy-table-renderer.umd.js"
1111
},
1212
"./dist/": "./dist/",
1313
"./package.json": "./package.json"

packages/lazy-table-renderer/tsconfig.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./dist",
5-
"declaration": true,
6-
"declarationMap": true
4+
"noEmit": true,
5+
"baseUrl": ".",
6+
"paths": {
7+
"vue-pivottable": ["../../src"]
8+
}
79
},
810
"include": ["src/**/*"],
911
"exclude": ["dist", "node_modules"]

packages/plotly-renderer/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"type": "module",
55
"exports": {
66
".": {
7+
"types": "./dist/types/index.d.ts",
78
"import": "./dist/plotly-renderer.es.js",
8-
"require": "./dist/plotly-renderer.umd.js",
9-
"types": "./dist/types/index.d.ts"
9+
"require": "./dist/plotly-renderer.umd.js"
1010
},
1111
"./dist/": "./dist/",
1212
"./package.json": "./package.json"

packages/plotly-renderer/tsconfig.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "./dist",
5-
"declaration": true,
6-
"declarationMap": true,
7-
"noImplicitAny": false,
4+
"noEmit": true,
5+
"baseUrl": ".",
86
"paths": {
97
"vue-pivottable": ["../../src"]
108
}

packages/plotly-renderer/vite.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineConfig } from 'vite'
2-
import path, { resolve } from 'path'
2+
import { resolve } from 'path'
33
import dts from 'vite-plugin-dts'
44
import vue from '@vitejs/plugin-vue'
55

@@ -38,7 +38,8 @@ export default defineConfig(() => {
3838
},
3939
resolve: {
4040
alias: {
41-
'vue-plotly': path.resolve(__dirname, 'node_modules/vue-plotly')
41+
'vue-pivottable': resolve(__dirname, '../../src'),
42+
'vue-plotly': resolve(__dirname, 'node_modules/vue-plotly')
4243
}
4344
}
4445
}

src/composables/useProvidePivotData.js

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ export function providePivotData(props) {
77
const error = ref(null)
88

99
const pivotData = computed(() => {
10-
try { return new PivotData(props) } catch (err) {
10+
try {
11+
return new PivotData(props)
12+
} catch (err) {
1113
console.error(err.stack)
1214
error.value = 'An error occurred computing the PivotTable results.'
1315
return null
@@ -35,7 +37,9 @@ export function providePivotData(props) {
3537
})
3638

3739
const allColorScales = computed(() => {
38-
const values = rowKeys.value.reduce((acc, r) => { return acc.concat(colKeys.value.map((c) => getAggregator(r, c).value())) }, [])
40+
const values = rowKeys.value.reduce((acc, r) => {
41+
return acc.concat(colKeys.value.map((c) => getAggregator(r, c).value()))
42+
}, [])
3943
return colorScaleGenerator(values)
4044
})
4145
const rowColorScales = computed(() =>
@@ -56,7 +60,13 @@ export function providePivotData(props) {
5660
)
5761

5862
const valueCellColors = (rowKey, colKey, value) => {
59-
if (props.heatmapMode === 'full') { return allColorScales.value(value) } else if (props.heatmapMode === 'row') { return rowColorScales.value[rowKey](value) } else if (props.heatmapMode === 'col') { return colColorScales.value[colKey](value) }
63+
if (props.heatmapMode === 'full') {
64+
return allColorScales.value(value)
65+
} else if (props.heatmapMode === 'row') {
66+
return rowColorScales.value[rowKey](value)
67+
} else if (props.heatmapMode === 'col') {
68+
return colColorScales.value[colKey](value)
69+
}
6070
return {}
6171
}
6272
const rowTotalValues = colKeys.value.map((x) => getAggregator([], x).value())
@@ -76,15 +86,27 @@ export function providePivotData(props) {
7686
let x
7787
if (i !== 0) {
7888
let noDraw = true
79-
for (x = 0; x <= j; x++) { if (arr[i - 1][x] !== arr[i][x]) { noDraw = false } }
80-
if (noDraw) { return -1 }
89+
for (x = 0; x <= j; x++) {
90+
if (arr[i - 1][x] !== arr[i][x]) {
91+
noDraw = false
92+
}
93+
}
94+
if (noDraw) {
95+
return -1
96+
}
8197
}
8298

8399
let len = 0
84100
while (i + len < arr.length) {
85101
let stop = false
86-
for (x = 0; x <= j; x++) { if (arr[i][x] !== arr[i + len][x]) { stop = true } }
87-
if (stop) { break }
102+
for (x = 0; x <= j; x++) {
103+
if (arr[i][x] !== arr[i + len][x]) {
104+
stop = true
105+
}
106+
}
107+
if (stop) {
108+
break
109+
}
88110
len++
89111
}
90112
return len
@@ -109,4 +131,6 @@ export function providePivotData(props) {
109131
return pivotDataContext
110132
}
111133

112-
export function useProvidePivotData() { return inject(PIVOT_DATA_KEY) }
134+
export function useProvidePivotData() {
135+
return inject(PIVOT_DATA_KEY)
136+
}

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { VuePivottable, VuePivottableUi } from './components'
22
import TableRenderer from './components/pivottable/renderer'
33
import * as PivotUtilities from './helper'
44
export * from './composables/index.js'
5+
import type { Component } from 'vue'
56

6-
const Renderer = {
7+
const Renderer: Record<string, Component> = {
78
...TableRenderer
89
}
910

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99
/* Bundler mode */
1010
"moduleResolution": "node",
11-
"allowImportingTsExtensions": true,
1211
"resolveJsonModule": true,
1312
"isolatedModules": true,
1413
"noEmit": true,
1514
"jsx": "preserve",
1615

1716
/* Linting */
1817
"strict": true,
18+
"noImplicitAny": false,
1919
"noUnusedLocals": true,
2020
"noUnusedParameters": true,
2121
"noFallthroughCasesInSwitch": true,

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import vue from '@vitejs/plugin-vue'
33
import { resolve } from 'path'
44
import dts from 'vite-plugin-dts'
55
import { viteStaticCopy } from 'vite-plugin-static-copy'
6+
67
export default defineConfig({
78
plugins: [
89
vue(),

0 commit comments

Comments
 (0)