@orbcharts/core 3.0.3 → 3.0.5
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/LICENSE +200 -200
- package/dist/orbcharts-core.es.js +1896 -1847
- package/dist/orbcharts-core.umd.js +5 -5
- package/dist/src/series/seriesObservables.d.ts +18 -7
- package/dist/src/utils/errorMessage.d.ts +1 -4
- package/lib/core-types.ts +7 -7
- package/package.json +46 -46
- package/src/AbstractChart.ts +57 -57
- package/src/GridChart.ts +24 -24
- package/src/MultiGridChart.ts +24 -24
- package/src/MultiValueChart.ts +24 -24
- package/src/RelationshipChart.ts +24 -24
- package/src/SeriesChart.ts +24 -24
- package/src/TreeChart.ts +24 -24
- package/src/base/createBaseChart.ts +524 -526
- package/src/base/createBasePlugin.ts +154 -154
- package/src/base/validators/chartOptionsValidator.ts +23 -23
- package/src/base/validators/chartParamsValidator.ts +133 -133
- package/src/base/validators/elementValidator.ts +13 -13
- package/src/base/validators/pluginsValidator.ts +14 -14
- package/src/defaults.ts +284 -283
- package/src/defineGridPlugin.ts +3 -3
- package/src/defineMultiGridPlugin.ts +3 -3
- package/src/defineMultiValuePlugin.ts +3 -3
- package/src/defineNoneDataPlugin.ts +4 -4
- package/src/defineRelationshipPlugin.ts +3 -3
- package/src/defineSeriesPlugin.ts +3 -3
- package/src/defineTreePlugin.ts +3 -3
- package/src/grid/computedDataFn.ts +129 -129
- package/src/grid/contextObserverCallback.ts +201 -201
- package/src/grid/dataFormatterValidator.ts +125 -125
- package/src/grid/dataValidator.ts +12 -12
- package/src/grid/gridObservables.ts +694 -718
- package/src/index.ts +20 -20
- package/src/multiGrid/computedDataFn.ts +123 -123
- package/src/multiGrid/contextObserverCallback.ts +75 -75
- package/src/multiGrid/dataFormatterValidator.ts +120 -120
- package/src/multiGrid/dataValidator.ts +12 -12
- package/src/multiGrid/multiGridObservables.ts +357 -401
- package/src/multiValue/computedDataFn.ts +113 -113
- package/src/multiValue/contextObserverCallback.ts +328 -328
- package/src/multiValue/dataFormatterValidator.ts +94 -94
- package/src/multiValue/dataValidator.ts +12 -12
- package/src/multiValue/multiValueObservables.ts +865 -1219
- package/src/relationship/computedDataFn.ts +159 -159
- package/src/relationship/contextObserverCallback.ts +80 -80
- package/src/relationship/dataFormatterValidator.ts +13 -13
- package/src/relationship/dataValidator.ts +13 -13
- package/src/relationship/relationshipObservables.ts +84 -84
- package/src/series/computedDataFn.ts +88 -88
- package/src/series/contextObserverCallback.ts +132 -107
- package/src/series/dataFormatterValidator.ts +46 -46
- package/src/series/dataValidator.ts +12 -12
- package/src/series/seriesObservables.ts +209 -175
- package/src/tree/computedDataFn.ts +129 -129
- package/src/tree/contextObserverCallback.ts +58 -58
- package/src/tree/dataFormatterValidator.ts +13 -13
- package/src/tree/dataValidator.ts +13 -13
- package/src/tree/treeObservables.ts +105 -105
- package/src/utils/commonUtils.ts +55 -55
- package/src/utils/d3Scale.ts +198 -198
- package/src/utils/errorMessage.ts +40 -43
- package/src/utils/index.ts +3 -3
- package/src/utils/observables.ts +308 -293
- package/src/utils/orbchartsUtils.ts +396 -396
- package/src/utils/validator.ts +126 -126
- package/tsconfig.base.json +13 -13
- package/tsconfig.json +2 -2
- package/vite-env.d.ts +6 -6
- package/vite.config.js +22 -22
@@ -1,95 +1,95 @@
|
|
1
|
-
import type { DataFormatterValidator, DataFormatterTypeMap } from '../../lib/core-types'
|
2
|
-
import { validateColumns } from '../utils/validator'
|
3
|
-
|
4
|
-
export const dataFormatterValidator: DataFormatterValidator<'multiValue'> = (dataFormatter: DataFormatterTypeMap<'multiValue'>) => {
|
5
|
-
const result = validateColumns(dataFormatter, {
|
6
|
-
visibleFilter: {
|
7
|
-
toBeTypes: ['Function']
|
8
|
-
},
|
9
|
-
container: {
|
10
|
-
toBeTypes: ['object']
|
11
|
-
},
|
12
|
-
categoryLabels: {
|
13
|
-
toBeTypes: ['string[]']
|
14
|
-
},
|
15
|
-
valueLabels: {
|
16
|
-
toBeTypes: ['string[]']
|
17
|
-
},
|
18
|
-
xAxis: {
|
19
|
-
toBeTypes: ['object']
|
20
|
-
},
|
21
|
-
yAxis: {
|
22
|
-
toBeTypes: ['object']
|
23
|
-
},
|
24
|
-
separateCategory: {
|
25
|
-
toBeTypes: ['boolean']
|
26
|
-
}
|
27
|
-
})
|
28
|
-
if (result.status === 'error') {
|
29
|
-
return result
|
30
|
-
}
|
31
|
-
if (dataFormatter.yAxis) {
|
32
|
-
const valueAxisResult = validateColumns(dataFormatter.yAxis, {
|
33
|
-
scaleDomain: {
|
34
|
-
toBe: '[number | "min" | "auto", number | "max" | "auto"]',
|
35
|
-
test: (value) => Array.isArray(value) && value.length === 2 && (typeof value[0] === 'number' || value[0] === 'min' || value[0] === 'auto') && (typeof value[1] === 'number' || value[1] === 'max' || value[1] === 'auto')
|
36
|
-
},
|
37
|
-
scaleRange: {
|
38
|
-
toBe: '[number, number]',
|
39
|
-
test: (value) => Array.isArray(value) && value.length === 2 && typeof value[0] === 'number' && typeof value[1] === 'number'
|
40
|
-
},
|
41
|
-
label: {
|
42
|
-
toBeTypes: ['string']
|
43
|
-
},
|
44
|
-
valueIndex: {
|
45
|
-
toBeTypes: ['number']
|
46
|
-
}
|
47
|
-
})
|
48
|
-
if (valueAxisResult.status === 'error') {
|
49
|
-
return valueAxisResult
|
50
|
-
}
|
51
|
-
}
|
52
|
-
if (dataFormatter.xAxis) {
|
53
|
-
const groupAxisResult = validateColumns(dataFormatter.xAxis, {
|
54
|
-
scaleDomain: {
|
55
|
-
toBe: '[number | "min" | "auto", number | "max" | "auto"]',
|
56
|
-
test: (value) => Array.isArray(value) && value.length === 2 && (typeof value[0] === 'number' || value[0] === 'min' || value[0] === 'auto') && (typeof value[1] === 'number' || value[1] === 'max' || value[1] === 'auto')
|
57
|
-
},
|
58
|
-
scaleRange: {
|
59
|
-
toBe: '[number, number]',
|
60
|
-
test: (value) => Array.isArray(value) && value.length === 2 && typeof value[0] === 'number' && typeof value[1] === 'number'
|
61
|
-
},
|
62
|
-
label: {
|
63
|
-
toBeTypes: ['string']
|
64
|
-
},
|
65
|
-
valueIndex: {
|
66
|
-
toBeTypes: ['number']
|
67
|
-
}
|
68
|
-
})
|
69
|
-
if (groupAxisResult.status === 'error') {
|
70
|
-
return groupAxisResult
|
71
|
-
}
|
72
|
-
}
|
73
|
-
if (dataFormatter.container) {
|
74
|
-
const containerResult = validateColumns(dataFormatter.container, {
|
75
|
-
columnAmount: {
|
76
|
-
toBeTypes: ['number']
|
77
|
-
},
|
78
|
-
rowAmount: {
|
79
|
-
toBeTypes: ['number']
|
80
|
-
},
|
81
|
-
columnGap: {
|
82
|
-
toBe: '"auto" | number',
|
83
|
-
test: (value: any) => value === 'auto' || typeof value === 'number'
|
84
|
-
},
|
85
|
-
rowGap: {
|
86
|
-
toBe: '"auto" | number',
|
87
|
-
test: (value: any) => value === 'auto' || typeof value === 'number'
|
88
|
-
},
|
89
|
-
})
|
90
|
-
if (containerResult.status === 'error') {
|
91
|
-
return containerResult
|
92
|
-
}
|
93
|
-
}
|
94
|
-
return result
|
1
|
+
import type { DataFormatterValidator, DataFormatterTypeMap } from '../../lib/core-types'
|
2
|
+
import { validateColumns } from '../utils/validator'
|
3
|
+
|
4
|
+
export const dataFormatterValidator: DataFormatterValidator<'multiValue'> = (dataFormatter: DataFormatterTypeMap<'multiValue'>) => {
|
5
|
+
const result = validateColumns(dataFormatter, {
|
6
|
+
visibleFilter: {
|
7
|
+
toBeTypes: ['Function']
|
8
|
+
},
|
9
|
+
container: {
|
10
|
+
toBeTypes: ['object']
|
11
|
+
},
|
12
|
+
categoryLabels: {
|
13
|
+
toBeTypes: ['string[]']
|
14
|
+
},
|
15
|
+
valueLabels: {
|
16
|
+
toBeTypes: ['string[]']
|
17
|
+
},
|
18
|
+
xAxis: {
|
19
|
+
toBeTypes: ['object']
|
20
|
+
},
|
21
|
+
yAxis: {
|
22
|
+
toBeTypes: ['object']
|
23
|
+
},
|
24
|
+
separateCategory: {
|
25
|
+
toBeTypes: ['boolean']
|
26
|
+
}
|
27
|
+
})
|
28
|
+
if (result.status === 'error') {
|
29
|
+
return result
|
30
|
+
}
|
31
|
+
if (dataFormatter.yAxis) {
|
32
|
+
const valueAxisResult = validateColumns(dataFormatter.yAxis, {
|
33
|
+
scaleDomain: {
|
34
|
+
toBe: '[number | "min" | "auto", number | "max" | "auto"]',
|
35
|
+
test: (value) => Array.isArray(value) && value.length === 2 && (typeof value[0] === 'number' || value[0] === 'min' || value[0] === 'auto') && (typeof value[1] === 'number' || value[1] === 'max' || value[1] === 'auto')
|
36
|
+
},
|
37
|
+
scaleRange: {
|
38
|
+
toBe: '[number, number]',
|
39
|
+
test: (value) => Array.isArray(value) && value.length === 2 && typeof value[0] === 'number' && typeof value[1] === 'number'
|
40
|
+
},
|
41
|
+
label: {
|
42
|
+
toBeTypes: ['string']
|
43
|
+
},
|
44
|
+
valueIndex: {
|
45
|
+
toBeTypes: ['number']
|
46
|
+
}
|
47
|
+
})
|
48
|
+
if (valueAxisResult.status === 'error') {
|
49
|
+
return valueAxisResult
|
50
|
+
}
|
51
|
+
}
|
52
|
+
if (dataFormatter.xAxis) {
|
53
|
+
const groupAxisResult = validateColumns(dataFormatter.xAxis, {
|
54
|
+
scaleDomain: {
|
55
|
+
toBe: '[number | "min" | "auto", number | "max" | "auto"]',
|
56
|
+
test: (value) => Array.isArray(value) && value.length === 2 && (typeof value[0] === 'number' || value[0] === 'min' || value[0] === 'auto') && (typeof value[1] === 'number' || value[1] === 'max' || value[1] === 'auto')
|
57
|
+
},
|
58
|
+
scaleRange: {
|
59
|
+
toBe: '[number, number]',
|
60
|
+
test: (value) => Array.isArray(value) && value.length === 2 && typeof value[0] === 'number' && typeof value[1] === 'number'
|
61
|
+
},
|
62
|
+
label: {
|
63
|
+
toBeTypes: ['string']
|
64
|
+
},
|
65
|
+
valueIndex: {
|
66
|
+
toBeTypes: ['number']
|
67
|
+
}
|
68
|
+
})
|
69
|
+
if (groupAxisResult.status === 'error') {
|
70
|
+
return groupAxisResult
|
71
|
+
}
|
72
|
+
}
|
73
|
+
if (dataFormatter.container) {
|
74
|
+
const containerResult = validateColumns(dataFormatter.container, {
|
75
|
+
columnAmount: {
|
76
|
+
toBeTypes: ['number']
|
77
|
+
},
|
78
|
+
rowAmount: {
|
79
|
+
toBeTypes: ['number']
|
80
|
+
},
|
81
|
+
columnGap: {
|
82
|
+
toBe: '"auto" | number',
|
83
|
+
test: (value: any) => value === 'auto' || typeof value === 'number'
|
84
|
+
},
|
85
|
+
rowGap: {
|
86
|
+
toBe: '"auto" | number',
|
87
|
+
test: (value: any) => value === 'auto' || typeof value === 'number'
|
88
|
+
},
|
89
|
+
})
|
90
|
+
if (containerResult.status === 'error') {
|
91
|
+
return containerResult
|
92
|
+
}
|
93
|
+
}
|
94
|
+
return result
|
95
95
|
}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import type { DataValidator, DataTypeMap } from '../../lib/core-types'
|
2
|
-
import { validateColumns } from '../utils/validator'
|
3
|
-
|
4
|
-
export const dataValidator: DataValidator<'multiValue'> = (data: DataTypeMap<'multiValue'>) => {
|
5
|
-
const result = validateColumns({ data }, {
|
6
|
-
data: {
|
7
|
-
toBe: '(DataMultiValueDatum | DataMultiValueValue[])[]',
|
8
|
-
// 畢免資料量過大檢查不完,不深度檢查
|
9
|
-
test: (value) => Array.isArray(value)
|
10
|
-
}
|
11
|
-
})
|
12
|
-
return result
|
1
|
+
import type { DataValidator, DataTypeMap } from '../../lib/core-types'
|
2
|
+
import { validateColumns } from '../utils/validator'
|
3
|
+
|
4
|
+
export const dataValidator: DataValidator<'multiValue'> = (data: DataTypeMap<'multiValue'>) => {
|
5
|
+
const result = validateColumns({ data }, {
|
6
|
+
data: {
|
7
|
+
toBe: '(DataMultiValueDatum | DataMultiValueValue[])[]',
|
8
|
+
// 畢免資料量過大檢查不完,不深度檢查
|
9
|
+
test: (value) => Array.isArray(value)
|
10
|
+
}
|
11
|
+
})
|
12
|
+
return result
|
13
13
|
}
|