@orbcharts/core 3.0.4 → 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.
Files changed (69) hide show
  1. package/LICENSE +200 -200
  2. package/dist/orbcharts-core.es.js +1685 -1636
  3. package/dist/orbcharts-core.umd.js +4 -4
  4. package/dist/src/series/seriesObservables.d.ts +18 -7
  5. package/lib/core-types.ts +7 -7
  6. package/package.json +46 -46
  7. package/src/AbstractChart.ts +57 -57
  8. package/src/GridChart.ts +24 -24
  9. package/src/MultiGridChart.ts +24 -24
  10. package/src/MultiValueChart.ts +24 -24
  11. package/src/RelationshipChart.ts +24 -24
  12. package/src/SeriesChart.ts +24 -24
  13. package/src/TreeChart.ts +24 -24
  14. package/src/base/createBaseChart.ts +524 -524
  15. package/src/base/createBasePlugin.ts +154 -154
  16. package/src/base/validators/chartOptionsValidator.ts +23 -23
  17. package/src/base/validators/chartParamsValidator.ts +133 -133
  18. package/src/base/validators/elementValidator.ts +13 -13
  19. package/src/base/validators/pluginsValidator.ts +14 -14
  20. package/src/defaults.ts +284 -283
  21. package/src/defineGridPlugin.ts +3 -3
  22. package/src/defineMultiGridPlugin.ts +3 -3
  23. package/src/defineMultiValuePlugin.ts +3 -3
  24. package/src/defineNoneDataPlugin.ts +4 -4
  25. package/src/defineRelationshipPlugin.ts +3 -3
  26. package/src/defineSeriesPlugin.ts +3 -3
  27. package/src/defineTreePlugin.ts +3 -3
  28. package/src/grid/computedDataFn.ts +129 -129
  29. package/src/grid/contextObserverCallback.ts +201 -201
  30. package/src/grid/dataFormatterValidator.ts +125 -125
  31. package/src/grid/dataValidator.ts +12 -12
  32. package/src/grid/gridObservables.ts +694 -718
  33. package/src/index.ts +20 -20
  34. package/src/multiGrid/computedDataFn.ts +123 -123
  35. package/src/multiGrid/contextObserverCallback.ts +75 -75
  36. package/src/multiGrid/dataFormatterValidator.ts +120 -120
  37. package/src/multiGrid/dataValidator.ts +12 -12
  38. package/src/multiGrid/multiGridObservables.ts +357 -401
  39. package/src/multiValue/computedDataFn.ts +113 -113
  40. package/src/multiValue/contextObserverCallback.ts +328 -328
  41. package/src/multiValue/dataFormatterValidator.ts +94 -94
  42. package/src/multiValue/dataValidator.ts +12 -12
  43. package/src/multiValue/multiValueObservables.ts +865 -1219
  44. package/src/relationship/computedDataFn.ts +159 -159
  45. package/src/relationship/contextObserverCallback.ts +80 -80
  46. package/src/relationship/dataFormatterValidator.ts +13 -13
  47. package/src/relationship/dataValidator.ts +13 -13
  48. package/src/relationship/relationshipObservables.ts +84 -84
  49. package/src/series/computedDataFn.ts +88 -88
  50. package/src/series/contextObserverCallback.ts +132 -107
  51. package/src/series/dataFormatterValidator.ts +46 -46
  52. package/src/series/dataValidator.ts +12 -12
  53. package/src/series/seriesObservables.ts +209 -175
  54. package/src/tree/computedDataFn.ts +129 -129
  55. package/src/tree/contextObserverCallback.ts +58 -58
  56. package/src/tree/dataFormatterValidator.ts +13 -13
  57. package/src/tree/dataValidator.ts +13 -13
  58. package/src/tree/treeObservables.ts +105 -105
  59. package/src/utils/commonUtils.ts +55 -55
  60. package/src/utils/d3Scale.ts +198 -198
  61. package/src/utils/errorMessage.ts +40 -40
  62. package/src/utils/index.ts +3 -3
  63. package/src/utils/observables.ts +308 -293
  64. package/src/utils/orbchartsUtils.ts +396 -396
  65. package/src/utils/validator.ts +126 -126
  66. package/tsconfig.base.json +13 -13
  67. package/tsconfig.json +2 -2
  68. package/vite-env.d.ts +6 -6
  69. package/vite.config.js +22 -22
@@ -1,159 +1,159 @@
1
- import type {
2
- DataRelationshipObj,
3
- DataRelationshipList,
4
- Node,
5
- Edge,
6
- ComputedDataFn,
7
- ComputedDataRelationship,
8
- ComputedNode,
9
- ComputedEdge
10
- } from '../../lib/core-types'
11
- import { createDefaultCategoryLabel, seriesColorPredicate } from '../utils/orbchartsUtils'
12
-
13
- export const computedDataFn: ComputedDataFn<'relationship'> = (context) => {
14
- const { data, dataFormatter, chartParams } = context
15
-
16
- const defaultCategoryLabel = createDefaultCategoryLabel()
17
-
18
- let computedNodes: ComputedNode[] = []
19
- let computedEdges: ComputedEdge[] = []
20
-
21
- try {
22
- // -- 取得nodes和edges資料 --
23
- let nodes: Node[] = []
24
- let edges: Edge[] = []
25
- if ((data as DataRelationshipObj).nodes) {
26
- nodes = (data as DataRelationshipObj).nodes
27
- edges = (data as DataRelationshipObj).edges
28
- } else if ((data as DataRelationshipList)[0]) {
29
- nodes = (data as DataRelationshipList)[0]
30
- edges = (data as DataRelationshipList)[1]
31
- } else {
32
- // 無值直接回傳
33
- return {
34
- nodes: [],
35
- edges: []
36
- } as ComputedDataRelationship
37
- }
38
-
39
- const categoryLabels = (() => {
40
- // 先使用 dataFormatter.categoryLabels
41
- const CategoryLabelsSet = new Set(dataFormatter.categoryLabels)
42
- // 再加入 datum 中的 categoryLabel
43
- for (let datum of nodes) {
44
- const categoryLabel = datum.categoryLabel ?? defaultCategoryLabel
45
- CategoryLabelsSet.add(categoryLabel) // 不重覆
46
- }
47
- for (let datum of edges) {
48
- const categoryLabel = datum.categoryLabel ?? defaultCategoryLabel
49
- CategoryLabelsSet.add(categoryLabel) // 不重覆
50
- }
51
- return Array.from(CategoryLabelsSet)
52
- })()
53
-
54
- // <categoryLabel, categoryIndex>
55
- const CategoryIndexMap = new Map<string, number>(
56
- categoryLabels.map((label, index) => [label, index])
57
- )
58
-
59
- // -- nodes --
60
- computedNodes = nodes.map((node, i) => {
61
- const categoryLabel = node.categoryLabel ?? defaultCategoryLabel
62
- const categoryIndex = CategoryIndexMap.get(categoryLabel) ?? 0
63
-
64
- const computedNode: ComputedNode = {
65
- id: node.id,
66
- index: i,
67
- label: node.label ?? '',
68
- description: node.description ?? '',
69
- data: node.data ?? {},
70
- value: node.value ?? 0,
71
- categoryIndex,
72
- categoryLabel,
73
- color: seriesColorPredicate(categoryIndex, chartParams),
74
- // startNodes: [], // 後面再取得資料
75
- // startNodeIds: [], // 後面再取得資料
76
- // endNodes: [], // 後面再取得資料
77
- // endNodeIds: [], // 後面再取得資料
78
- visible: true // 先給預設值
79
- }
80
-
81
- computedNode.visible = dataFormatter.visibleFilter(computedNode, context)
82
-
83
- return computedNode
84
- })
85
-
86
- const NodesMap: Map<string, ComputedNode> = new Map(computedNodes.map(d => [d.id, d]))
87
-
88
- // const StartNodesMap: Map<string, ComputedNode[]> = (function () {
89
- // const _StartNodesMap = new Map()
90
- // computedEdges.forEach(edge => {
91
- // const startNodes: ComputedNode[] = _StartNodesMap.get(edge.endNodeId) ?? []
92
- // startNodes.push(edge.startNode)
93
- // _StartNodesMap.set(edge.endNodeId, startNodes)
94
- // })
95
- // return _StartNodesMap
96
- // })()
97
-
98
- // const EndNodesMap: Map<string, ComputedNode[]> = (function () {
99
- // const _EndNodesMap = new Map()
100
- // computedEdges.forEach(edge => {
101
- // const endNodes: ComputedNode[] = _EndNodesMap.get(edge.startNodeId) ?? []
102
- // endNodes.push(edge.endNode)
103
- // _EndNodesMap.set(edge.startNodeId, endNodes)
104
- // })
105
- // return _EndNodesMap
106
- // })()
107
-
108
- // -- edges --
109
- computedEdges = edges
110
- .map((edge, i) => {
111
- const startNode = NodesMap.get(edge.start)
112
- const endNode = NodesMap.get(edge.end)
113
- return {
114
- edge,
115
- startNode,
116
- endNode
117
- }
118
- })
119
- .filter(({ edge }) => {
120
- const startNode = NodesMap.get(edge.start)
121
- const endNode = NodesMap.get(edge.end)
122
- return startNode != null && endNode != null
123
- })
124
- .map(({ edge, startNode, endNode }, i) => {
125
- const categoryLabel = edge.categoryLabel ?? defaultCategoryLabel
126
- // const startNode = NodesMap.get(edge.start)
127
- // const endNode = NodesMap.get(edge.end)
128
-
129
- const computedEdge: ComputedEdge = {
130
- id: edge.id,
131
- index: i,
132
- label: edge.label ?? '',
133
- description: edge.description ?? '',
134
- data: edge.data ?? {},
135
- value: edge.value ?? 0,
136
- categoryIndex: CategoryIndexMap.get(categoryLabel),
137
- categoryLabel,
138
- color: seriesColorPredicate(i, chartParams),
139
- startNode,
140
- // startNodeId: edge.start,
141
- endNode,
142
- // endNodeId: edge.end,
143
- visible: startNode.visible && endNode.visible
144
- }
145
-
146
- return computedEdge
147
- })
148
-
149
-
150
- } catch (e) {
151
- // console.error(e)
152
- throw Error(e)
153
- }
154
-
155
- return {
156
- nodes: computedNodes,
157
- edges: computedEdges
158
- }
159
- }
1
+ import type {
2
+ DataRelationshipObj,
3
+ DataRelationshipList,
4
+ Node,
5
+ Edge,
6
+ ComputedDataFn,
7
+ ComputedDataRelationship,
8
+ ComputedNode,
9
+ ComputedEdge
10
+ } from '../../lib/core-types'
11
+ import { createDefaultCategoryLabel, seriesColorPredicate } from '../utils/orbchartsUtils'
12
+
13
+ export const computedDataFn: ComputedDataFn<'relationship'> = (context) => {
14
+ const { data, dataFormatter, chartParams } = context
15
+
16
+ const defaultCategoryLabel = createDefaultCategoryLabel()
17
+
18
+ let computedNodes: ComputedNode[] = []
19
+ let computedEdges: ComputedEdge[] = []
20
+
21
+ try {
22
+ // -- 取得nodes和edges資料 --
23
+ let nodes: Node[] = []
24
+ let edges: Edge[] = []
25
+ if ((data as DataRelationshipObj).nodes) {
26
+ nodes = (data as DataRelationshipObj).nodes
27
+ edges = (data as DataRelationshipObj).edges
28
+ } else if ((data as DataRelationshipList)[0]) {
29
+ nodes = (data as DataRelationshipList)[0]
30
+ edges = (data as DataRelationshipList)[1]
31
+ } else {
32
+ // 無值直接回傳
33
+ return {
34
+ nodes: [],
35
+ edges: []
36
+ } as ComputedDataRelationship
37
+ }
38
+
39
+ const categoryLabels = (() => {
40
+ // 先使用 dataFormatter.categoryLabels
41
+ const CategoryLabelsSet = new Set(dataFormatter.categoryLabels)
42
+ // 再加入 datum 中的 categoryLabel
43
+ for (let datum of nodes) {
44
+ const categoryLabel = datum.categoryLabel ?? defaultCategoryLabel
45
+ CategoryLabelsSet.add(categoryLabel) // 不重覆
46
+ }
47
+ for (let datum of edges) {
48
+ const categoryLabel = datum.categoryLabel ?? defaultCategoryLabel
49
+ CategoryLabelsSet.add(categoryLabel) // 不重覆
50
+ }
51
+ return Array.from(CategoryLabelsSet)
52
+ })()
53
+
54
+ // <categoryLabel, categoryIndex>
55
+ const CategoryIndexMap = new Map<string, number>(
56
+ categoryLabels.map((label, index) => [label, index])
57
+ )
58
+
59
+ // -- nodes --
60
+ computedNodes = nodes.map((node, i) => {
61
+ const categoryLabel = node.categoryLabel ?? defaultCategoryLabel
62
+ const categoryIndex = CategoryIndexMap.get(categoryLabel) ?? 0
63
+
64
+ const computedNode: ComputedNode = {
65
+ id: node.id,
66
+ index: i,
67
+ label: node.label ?? '',
68
+ description: node.description ?? '',
69
+ data: node.data ?? {},
70
+ value: node.value ?? 0,
71
+ categoryIndex,
72
+ categoryLabel,
73
+ color: seriesColorPredicate(categoryIndex, chartParams),
74
+ // startNodes: [], // 後面再取得資料
75
+ // startNodeIds: [], // 後面再取得資料
76
+ // endNodes: [], // 後面再取得資料
77
+ // endNodeIds: [], // 後面再取得資料
78
+ visible: true // 先給預設值
79
+ }
80
+
81
+ computedNode.visible = dataFormatter.visibleFilter(computedNode, context)
82
+
83
+ return computedNode
84
+ })
85
+
86
+ const NodesMap: Map<string, ComputedNode> = new Map(computedNodes.map(d => [d.id, d]))
87
+
88
+ // const StartNodesMap: Map<string, ComputedNode[]> = (function () {
89
+ // const _StartNodesMap = new Map()
90
+ // computedEdges.forEach(edge => {
91
+ // const startNodes: ComputedNode[] = _StartNodesMap.get(edge.endNodeId) ?? []
92
+ // startNodes.push(edge.startNode)
93
+ // _StartNodesMap.set(edge.endNodeId, startNodes)
94
+ // })
95
+ // return _StartNodesMap
96
+ // })()
97
+
98
+ // const EndNodesMap: Map<string, ComputedNode[]> = (function () {
99
+ // const _EndNodesMap = new Map()
100
+ // computedEdges.forEach(edge => {
101
+ // const endNodes: ComputedNode[] = _EndNodesMap.get(edge.startNodeId) ?? []
102
+ // endNodes.push(edge.endNode)
103
+ // _EndNodesMap.set(edge.startNodeId, endNodes)
104
+ // })
105
+ // return _EndNodesMap
106
+ // })()
107
+
108
+ // -- edges --
109
+ computedEdges = edges
110
+ .map((edge, i) => {
111
+ const startNode = NodesMap.get(edge.start)
112
+ const endNode = NodesMap.get(edge.end)
113
+ return {
114
+ edge,
115
+ startNode,
116
+ endNode
117
+ }
118
+ })
119
+ .filter(({ edge }) => {
120
+ const startNode = NodesMap.get(edge.start)
121
+ const endNode = NodesMap.get(edge.end)
122
+ return startNode != null && endNode != null
123
+ })
124
+ .map(({ edge, startNode, endNode }, i) => {
125
+ const categoryLabel = edge.categoryLabel ?? defaultCategoryLabel
126
+ // const startNode = NodesMap.get(edge.start)
127
+ // const endNode = NodesMap.get(edge.end)
128
+
129
+ const computedEdge: ComputedEdge = {
130
+ id: edge.id,
131
+ index: i,
132
+ label: edge.label ?? '',
133
+ description: edge.description ?? '',
134
+ data: edge.data ?? {},
135
+ value: edge.value ?? 0,
136
+ categoryIndex: CategoryIndexMap.get(categoryLabel),
137
+ categoryLabel,
138
+ color: seriesColorPredicate(i, chartParams),
139
+ startNode,
140
+ // startNodeId: edge.start,
141
+ endNode,
142
+ // endNodeId: edge.end,
143
+ visible: startNode.visible && endNode.visible
144
+ }
145
+
146
+ return computedEdge
147
+ })
148
+
149
+
150
+ } catch (e) {
151
+ // console.error(e)
152
+ throw Error(e)
153
+ }
154
+
155
+ return {
156
+ nodes: computedNodes,
157
+ edges: computedEdges
158
+ }
159
+ }
@@ -1,80 +1,80 @@
1
- import { map, shareReplay } from 'rxjs'
2
- import type { ContextObserverCallback } from '../../lib/core-types'
3
- import { highlightObservable, categoryDataMapObservable, textSizePxObservable } from '../utils/observables'
4
- import {
5
- categoryLabelsObservable,
6
- NodeMapObservable,
7
- EdgeMapObservable,
8
- relationshipVisibleComputedDataObservable
9
- } from './relationshipObservables'
10
-
11
- export const contextObserverCallback: ContextObserverCallback<'relationship'> = ({ subject, observer }) => {
12
-
13
- const textSizePx$ = textSizePxObservable(observer.fullChartParams$).pipe(
14
- shareReplay(1)
15
- )
16
-
17
- const relationshipHighlightNodes$ = highlightObservable({
18
- datumList$: observer.computedData$.pipe(map(data => data.nodes)),
19
- fullChartParams$: observer.fullChartParams$,
20
- event$: subject.event$
21
- }).pipe(
22
- shareReplay(1)
23
- )
24
-
25
- const relationshipHighlightEdges$ = highlightObservable({
26
- datumList$: observer.computedData$.pipe(map(data => data.edges)),
27
- fullChartParams$: observer.fullChartParams$,
28
- event$: subject.event$
29
- }).pipe(
30
- shareReplay(1)
31
- )
32
-
33
- const CategoryNodeMap$ = categoryDataMapObservable({
34
- datumList$: observer.computedData$.pipe(map(data => data.nodes))
35
- }).pipe(
36
- shareReplay(1)
37
- )
38
-
39
- const CategoryEdgeMap$ = categoryDataMapObservable({
40
- datumList$: observer.computedData$.pipe(map(data => data.edges))
41
- }).pipe(
42
- shareReplay(1)
43
- )
44
-
45
- const NodeMap$ = NodeMapObservable(observer.computedData$).pipe(
46
- shareReplay(1)
47
- )
48
-
49
- const EdgeMap$ = EdgeMapObservable(observer.computedData$).pipe(
50
- shareReplay(1)
51
- )
52
-
53
- const categoryLabels$ = categoryLabelsObservable(CategoryNodeMap$, CategoryEdgeMap$).pipe(
54
- shareReplay(1)
55
- )
56
-
57
- const visibleComputedData$ = relationshipVisibleComputedDataObservable({
58
- computedData$: observer.computedData$,
59
- NodeMap$
60
- }).pipe(
61
- shareReplay(1)
62
- )
63
-
64
- return {
65
- fullParams$: observer.fullParams$,
66
- fullChartParams$: observer.fullChartParams$,
67
- fullDataFormatter$: observer.fullDataFormatter$,
68
- computedData$: observer.computedData$,
69
- layout$: observer.layout$,
70
- textSizePx$,
71
- relationshipHighlightNodes$,
72
- relationshipHighlightEdges$,
73
- categoryLabels$,
74
- CategoryNodeMap$,
75
- CategoryEdgeMap$,
76
- NodeMap$,
77
- EdgeMap$,
78
- visibleComputedData$
79
- }
80
- }
1
+ import { map, shareReplay } from 'rxjs'
2
+ import type { ContextObserverCallback } from '../../lib/core-types'
3
+ import { highlightObservable, categoryDataMapObservable, textSizePxObservable } from '../utils/observables'
4
+ import {
5
+ categoryLabelsObservable,
6
+ NodeMapObservable,
7
+ EdgeMapObservable,
8
+ relationshipVisibleComputedDataObservable
9
+ } from './relationshipObservables'
10
+
11
+ export const contextObserverCallback: ContextObserverCallback<'relationship'> = ({ subject, observer }) => {
12
+
13
+ const textSizePx$ = textSizePxObservable(observer.fullChartParams$).pipe(
14
+ shareReplay(1)
15
+ )
16
+
17
+ const relationshipHighlightNodes$ = highlightObservable({
18
+ datumList$: observer.computedData$.pipe(map(data => data.nodes)),
19
+ fullChartParams$: observer.fullChartParams$,
20
+ event$: subject.event$
21
+ }).pipe(
22
+ shareReplay(1)
23
+ )
24
+
25
+ const relationshipHighlightEdges$ = highlightObservable({
26
+ datumList$: observer.computedData$.pipe(map(data => data.edges)),
27
+ fullChartParams$: observer.fullChartParams$,
28
+ event$: subject.event$
29
+ }).pipe(
30
+ shareReplay(1)
31
+ )
32
+
33
+ const CategoryNodeMap$ = categoryDataMapObservable({
34
+ datumList$: observer.computedData$.pipe(map(data => data.nodes))
35
+ }).pipe(
36
+ shareReplay(1)
37
+ )
38
+
39
+ const CategoryEdgeMap$ = categoryDataMapObservable({
40
+ datumList$: observer.computedData$.pipe(map(data => data.edges))
41
+ }).pipe(
42
+ shareReplay(1)
43
+ )
44
+
45
+ const NodeMap$ = NodeMapObservable(observer.computedData$).pipe(
46
+ shareReplay(1)
47
+ )
48
+
49
+ const EdgeMap$ = EdgeMapObservable(observer.computedData$).pipe(
50
+ shareReplay(1)
51
+ )
52
+
53
+ const categoryLabels$ = categoryLabelsObservable(CategoryNodeMap$, CategoryEdgeMap$).pipe(
54
+ shareReplay(1)
55
+ )
56
+
57
+ const visibleComputedData$ = relationshipVisibleComputedDataObservable({
58
+ computedData$: observer.computedData$,
59
+ NodeMap$
60
+ }).pipe(
61
+ shareReplay(1)
62
+ )
63
+
64
+ return {
65
+ fullParams$: observer.fullParams$,
66
+ fullChartParams$: observer.fullChartParams$,
67
+ fullDataFormatter$: observer.fullDataFormatter$,
68
+ computedData$: observer.computedData$,
69
+ layout$: observer.layout$,
70
+ textSizePx$,
71
+ relationshipHighlightNodes$,
72
+ relationshipHighlightEdges$,
73
+ categoryLabels$,
74
+ CategoryNodeMap$,
75
+ CategoryEdgeMap$,
76
+ NodeMap$,
77
+ EdgeMap$,
78
+ visibleComputedData$
79
+ }
80
+ }
@@ -1,14 +1,14 @@
1
- import type { DataFormatterValidator, DataFormatterTypeMap } from '../../lib/core-types'
2
- import { validateColumns } from '../utils/validator'
3
-
4
- export const dataFormatterValidator: DataFormatterValidator<'relationship'> = (dataFormatter: DataFormatterTypeMap<'relationship'>) => {
5
- const result = validateColumns(dataFormatter, {
6
- visibleFilter: {
7
- toBeTypes: ['Function']
8
- },
9
- categoryLabels: {
10
- toBeTypes: ['string[]']
11
- }
12
- })
13
- return result
1
+ import type { DataFormatterValidator, DataFormatterTypeMap } from '../../lib/core-types'
2
+ import { validateColumns } from '../utils/validator'
3
+
4
+ export const dataFormatterValidator: DataFormatterValidator<'relationship'> = (dataFormatter: DataFormatterTypeMap<'relationship'>) => {
5
+ const result = validateColumns(dataFormatter, {
6
+ visibleFilter: {
7
+ toBeTypes: ['Function']
8
+ },
9
+ categoryLabels: {
10
+ toBeTypes: ['string[]']
11
+ }
12
+ })
13
+ return result
14
14
  }
@@ -1,14 +1,14 @@
1
- import type { DataValidator, DataTypeMap } from '../../lib/core-types'
2
- import { validateColumns } from '../utils/validator'
3
- import { isPlainObject } from '../utils'
4
-
5
- export const dataValidator: DataValidator<'relationship'> = (data: DataTypeMap<'relationship'>) => {
6
- const result = validateColumns({ data }, {
7
- data: {
8
- toBe: 'DataRelationshipObj | DataRelationshipList',
9
- // 畢免資料量過大檢查不完,不深度檢查
10
- test: (value) => isPlainObject(value) || Array.isArray(value)
11
- }
12
- })
13
- return result
1
+ import type { DataValidator, DataTypeMap } from '../../lib/core-types'
2
+ import { validateColumns } from '../utils/validator'
3
+ import { isPlainObject } from '../utils'
4
+
5
+ export const dataValidator: DataValidator<'relationship'> = (data: DataTypeMap<'relationship'>) => {
6
+ const result = validateColumns({ data }, {
7
+ data: {
8
+ toBe: 'DataRelationshipObj | DataRelationshipList',
9
+ // 畢免資料量過大檢查不完,不深度檢查
10
+ test: (value) => isPlainObject(value) || Array.isArray(value)
11
+ }
12
+ })
13
+ return result
14
14
  }