@sis-cc/dotstatsuite-components 20.6.0 → 21.0.1

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 (161) hide show
  1. package/.gitlab-ci.yml +4 -5
  2. package/README.md +1 -17
  3. package/package.json +20 -14
  4. package/src/bridge-d3-react/src/react-chart-factory.js +1 -2
  5. package/src/rules/src/factories/sample-series.js +1 -1
  6. package/src/rules/src/index.js +14 -13
  7. package/src/rules/src/observation-formater.js +0 -1
  8. package/src/rules/src/properties/focus.js +3 -3
  9. package/src/rules/src/sdmx-data/index.js +2 -0
  10. package/src/viewer/src/index.js +4 -5
  11. package/src/viewer/src/legends/AxisLegend.js +0 -7
  12. package/src/viewer/src/legends/FocusLegend.js +2 -10
  13. package/src/viewer/src/legends/Legend.js +0 -6
  14. package/src/viewer/src/legends/SeriesLegend.js +0 -7
  15. package/vite.config.mjs +51 -0
  16. package/lib/app.js +0 -22
  17. package/lib/bridge-d3-react/src/app.js +0 -98
  18. package/lib/bridge-d3-react/src/index.js +0 -33
  19. package/lib/bridge-d3-react/src/mock-choro.js +0 -41
  20. package/lib/bridge-d3-react/src/react-chart-factory.js +0 -103
  21. package/lib/index.js +0 -41
  22. package/lib/rules/src/chart/getAxisOptions.js +0 -206
  23. package/lib/rules/src/chart/getBaseOptions.js +0 -51
  24. package/lib/rules/src/chart/getChartOptions.js +0 -106
  25. package/lib/rules/src/chart/getGridOptions.js +0 -21
  26. package/lib/rules/src/chart/getTooltipOptions.js +0 -84
  27. package/lib/rules/src/constants.js +0 -68
  28. package/lib/rules/src/date.js +0 -180
  29. package/lib/rules/src/dimension-utils.js +0 -67
  30. package/lib/rules/src/factories/choro-series.js +0 -99
  31. package/lib/rules/src/factories/sample-focus.js +0 -64
  32. package/lib/rules/src/factories/sample-series.js +0 -90
  33. package/lib/rules/src/factories/scatter-dimension.js +0 -72
  34. package/lib/rules/src/factories/scatter-focus.js +0 -77
  35. package/lib/rules/src/factories/scatter-series.js +0 -145
  36. package/lib/rules/src/factories/stacked-dimension.js +0 -42
  37. package/lib/rules/src/factories/stacked-series.js +0 -166
  38. package/lib/rules/src/factories/symbol-dimension.js +0 -69
  39. package/lib/rules/src/factories/symbol-series.js +0 -119
  40. package/lib/rules/src/factories/timeline-focus.js +0 -38
  41. package/lib/rules/src/factories/timeline-series.js +0 -121
  42. package/lib/rules/src/get-values-enhanced.js +0 -141
  43. package/lib/rules/src/header/getDefaultSubtitle.js +0 -50
  44. package/lib/rules/src/header/getHeaderUnits.js +0 -26
  45. package/lib/rules/src/header/getSubtitleFlags.js +0 -53
  46. package/lib/rules/src/header/getTitleFlags.js +0 -24
  47. package/lib/rules/src/header/index.js +0 -41
  48. package/lib/rules/src/index.js +0 -714
  49. package/lib/rules/src/layout.js +0 -98
  50. package/lib/rules/src/observation-formater.js +0 -112
  51. package/lib/rules/src/preparators/enhanceObservations.js +0 -142
  52. package/lib/rules/src/preparators/formatValue.js +0 -83
  53. package/lib/rules/src/preparators/getObservations.js +0 -27
  54. package/lib/rules/src/preparators/getReportingYearStart.js +0 -52
  55. package/lib/rules/src/properties/errors.js +0 -31
  56. package/lib/rules/src/properties/focus.js +0 -90
  57. package/lib/rules/src/properties/getAvailableChartTypes.js +0 -30
  58. package/lib/rules/src/properties/getHeaderProps.js +0 -83
  59. package/lib/rules/src/properties/getInformationsStateFromNewProps.js +0 -61
  60. package/lib/rules/src/properties/getObservationsType.js +0 -31
  61. package/lib/rules/src/properties/getStringifiedSubtitle.js +0 -18
  62. package/lib/rules/src/properties/index.js +0 -401
  63. package/lib/rules/src/properties/information.js +0 -79
  64. package/lib/rules/src/properties/linear.js +0 -158
  65. package/lib/rules/src/properties/scatter.js +0 -174
  66. package/lib/rules/src/properties/stacked.js +0 -133
  67. package/lib/rules/src/properties/symbol.js +0 -96
  68. package/lib/rules/src/properties/utils.js +0 -126
  69. package/lib/rules/src/sdmx-data/index.js +0 -55
  70. package/lib/rules/src/table/factories/getCellValue.js +0 -57
  71. package/lib/rules/src/table/index.js +0 -14
  72. package/lib/rules/src/v8-transformer.js +0 -184
  73. package/lib/rules/test/extractSdmxArtefacts.js +0 -37
  74. package/lib/rules/test/get-values-enhanced.test.js +0 -128
  75. package/lib/rules/test/oecd-HEALTH_PROT-parsed.js +0 -303
  76. package/lib/rules/test/scatter-property.js +0 -403
  77. package/lib/rules/test/stacked-property.js +0 -244
  78. package/lib/rules/test/symbol-property.js +0 -234
  79. package/lib/rules/test/v8-transformer.test.js +0 -82
  80. package/lib/rules2/src/applyHierarchicalCodesToDim.js +0 -175
  81. package/lib/rules2/src/combinedValuesDisplay.js +0 -71
  82. package/lib/rules2/src/constants.js +0 -11
  83. package/lib/rules2/src/duplicateObservations.js +0 -39
  84. package/lib/rules2/src/enhanceObservations.js +0 -103
  85. package/lib/rules2/src/getAdvAttrSeriesAtCoordinates.js +0 -39
  86. package/lib/rules2/src/getAttributesSeries.js +0 -40
  87. package/lib/rules2/src/getCombinationDefinitions.js +0 -72
  88. package/lib/rules2/src/getDataflowAttributes.js +0 -34
  89. package/lib/rules2/src/getDataflowTooltipAttributesIds.js +0 -38
  90. package/lib/rules2/src/getDimensionValuesIndexes.js +0 -19
  91. package/lib/rules2/src/getHCodelistsRefsInData.js +0 -49
  92. package/lib/rules2/src/getHeaderCombinations.js +0 -51
  93. package/lib/rules2/src/getHeaderCoordinates.js +0 -18
  94. package/lib/rules2/src/getHeaderSubtitle.js +0 -41
  95. package/lib/rules2/src/getHeaderTitle.js +0 -29
  96. package/lib/rules2/src/getMSDInformations.js +0 -43
  97. package/lib/rules2/src/getManyValuesDimensions.js +0 -39
  98. package/lib/rules2/src/getMetadataCoordinates.js +0 -40
  99. package/lib/rules2/src/getMetadataStructureFromData.js +0 -23
  100. package/lib/rules2/src/getNotDisplayedIds.js +0 -58
  101. package/lib/rules2/src/getOneValueDimensions.js +0 -48
  102. package/lib/rules2/src/getSeriesCombinations.js +0 -33
  103. package/lib/rules2/src/hasCellMetadata.js +0 -22
  104. package/lib/rules2/src/hierarchiseDimensionWithAdvancedHierarchy2.js +0 -65
  105. package/lib/rules2/src/hierarchiseDimensionWithNativeHierarchy2.js +0 -39
  106. package/lib/rules2/src/index.js +0 -443
  107. package/lib/rules2/src/parseAttributes.js +0 -51
  108. package/lib/rules2/src/parseCombinations.js +0 -96
  109. package/lib/rules2/src/parseHierarchicalCodelist.js +0 -57
  110. package/lib/rules2/src/parseMetadataSeries.js +0 -119
  111. package/lib/rules2/src/prepareData.js +0 -113
  112. package/lib/rules2/src/refineAttributes.js +0 -32
  113. package/lib/rules2/src/refineDimensions.js +0 -38
  114. package/lib/rules2/src/refineMetadataCoordinates.js +0 -35
  115. package/lib/rules2/src/refineTimePeriod.js +0 -154
  116. package/lib/rules2/src/sdmx3.0DataFormatPatch.js +0 -20
  117. package/lib/rules2/src/table/declineObservationsOverAttributes.js +0 -43
  118. package/lib/rules2/src/table/getCells.js +0 -90
  119. package/lib/rules2/src/table/getCellsAttributesIds.js +0 -63
  120. package/lib/rules2/src/table/getCellsMetadataCoordinates.js +0 -30
  121. package/lib/rules2/src/table/getCombinationDimensionsData.js +0 -48
  122. package/lib/rules2/src/table/getCuratedCells.js +0 -28
  123. package/lib/rules2/src/table/getFlagsAndNotes.js +0 -30
  124. package/lib/rules2/src/table/getIndexedCombinationsByDisplay.js +0 -31
  125. package/lib/rules2/src/table/getLayout.js +0 -105
  126. package/lib/rules2/src/table/getLayoutData2.js +0 -269
  127. package/lib/rules2/src/table/getSortedLayoutIndexes.js +0 -136
  128. package/lib/rules2/src/table/getTableLabelAccessor.js +0 -20
  129. package/lib/rules2/src/table/getTableLayoutIds.js +0 -365
  130. package/lib/rules2/src/table/getTableProps.js +0 -96
  131. package/lib/rules2/src/table/parseSeriesIndexesHierarchies.js +0 -124
  132. package/lib/rules2/src/table/parseValueHierarchy.js +0 -63
  133. package/lib/rules2/src/table/refineLayoutSize2.js +0 -293
  134. package/lib/rules2/src/utils.js +0 -48
  135. package/lib/viewer/mocks/bar.js +0 -21
  136. package/lib/viewer/mocks/gpp-symbol.js +0 -55
  137. package/lib/viewer/mocks/gpp-time.js +0 -1023
  138. package/lib/viewer/mocks/row.js +0 -26
  139. package/lib/viewer/mocks/scatter.js +0 -84
  140. package/lib/viewer/mocks/stack.js +0 -93
  141. package/lib/viewer/src/app/leg.js +0 -101
  142. package/lib/viewer/src/app/nodata-res.js +0 -40
  143. package/lib/viewer/src/app/nodata-sized.js +0 -41
  144. package/lib/viewer/src/app/one-table-cell.js +0 -75
  145. package/lib/viewer/src/app/table.js +0 -300
  146. package/lib/viewer/src/app/use-case-1.js +0 -60
  147. package/lib/viewer/src/app/use-case-2.js +0 -82
  148. package/lib/viewer/src/app/use-case-3.js +0 -52
  149. package/lib/viewer/src/app.js +0 -162
  150. package/lib/viewer/src/chart.js +0 -82
  151. package/lib/viewer/src/chartUtils/options.js +0 -30
  152. package/lib/viewer/src/chartUtils/series.js +0 -63
  153. package/lib/viewer/src/footer.js +0 -54
  154. package/lib/viewer/src/header.js +0 -29
  155. package/lib/viewer/src/index.js +0 -243
  156. package/lib/viewer/src/legends/AxisLegend.js +0 -84
  157. package/lib/viewer/src/legends/ChartLegends.js +0 -100
  158. package/lib/viewer/src/legends/FocusLegend.js +0 -89
  159. package/lib/viewer/src/legends/Legend.js +0 -88
  160. package/lib/viewer/src/legends/SeriesLegend.js +0 -108
  161. package/lib/viewer/src/utils.js +0 -36
package/.gitlab-ci.yml CHANGED
@@ -5,13 +5,14 @@ stages:
5
5
  - publish
6
6
 
7
7
  variables:
8
- NODE_VERSION: node:18-alpine
8
+ NODE_VERSION: node:24-alpine
9
9
 
10
10
  setup:
11
11
  stage: setup
12
12
  image: $NODE_VERSION
13
13
  script:
14
14
  - yarn
15
+ - yarn peers
15
16
  artifacts:
16
17
  paths:
17
18
  - node_modules/
@@ -23,7 +24,7 @@ test:
23
24
  - chmod +x ./node_modules/web-component-env/src/wce-test
24
25
  script:
25
26
  - yarn test
26
- coverage: /All files\s*.\[0m \|.\[31;1m\s*([\d\.]+)/
27
+ coverage: '/All files\s*\|\s*(\d+\.\d+)%/'
27
28
  dependencies:
28
29
  - setup
29
30
 
@@ -32,9 +33,7 @@ build:
32
33
  image: $NODE_VERSION
33
34
  artifacts:
34
35
  paths:
35
- - lib/
36
- before_script:
37
- - chmod +x ./node_modules/web-component-env/src/wce-build
36
+ - dist/
38
37
  script:
39
38
  - yarn build
40
39
 
package/README.md CHANGED
@@ -1,19 +1,3 @@
1
1
  # dotstatsuite-components
2
2
 
3
- This library regroup a set of React components that were originally separated in their own git repositories.
4
- Those components are:
5
- - [bridge-d3-react](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/bridge-d3-react/README.md)
6
- - [chart](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/chart/README.md)
7
- - [rules](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/rules/README.md)
8
- - [rules-driver](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/rules-driver/README.md)
9
- - [share](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-components/blob/master/src/share/README.md)
10
-
11
- Unlike other libraries as [dotstatsuite-ui-components](https://gitlab.com/sis-cc/.stat-suite/dotstatsuite-ui-components), this library doesn't focus only on UI design, but also on data parsing and deduced behaviour, like the visualisation charts.
12
-
13
- ## setup
14
-
15
- - install: `npm i @sis-cc/dotstatsuite-components`
16
-
17
- ## usage
18
-
19
- see individuals readme files of the components
3
+ Set components based on React.
package/package.json CHANGED
@@ -1,31 +1,33 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-components",
3
3
  "description": "Set components based on React.",
4
- "version": "20.6.0",
5
- "main": "lib/index.js",
4
+ "version": "21.0.1",
6
5
  "type": "module",
6
+ "module": "./dist/dotstatsuite-components.js",
7
+ "engines": {
8
+ "node": ">=18"
9
+ },
7
10
  "author": "OECD",
8
11
  "license": "MIT",
9
12
  "scripts": {
10
- "build": "wce build",
11
- "start": "wce start",
13
+ "peers": "install-peers --force-run",
14
+ "build": "vite build",
12
15
  "test": "wce test"
13
16
  },
14
17
  "devDependencies": {
15
- "web-component-env": "^2.0.0"
18
+ "@rollup/plugin-replace": "^6.0.2",
19
+ "@sis-cc/dotstatsuite-d3-charts": "^9.2.0",
20
+ "@vitejs/plugin-react": "^4.3.3",
21
+ "install-peers-cli": "^2.2.0",
22
+ "ramda": "^0.26.1",
23
+ "rollup-plugin-visualizer": "^6.0.3",
24
+ "vite": "^5.4.9",
25
+ "web-component-env": "^2.9.10"
16
26
  },
17
27
  "dependencies": {
18
28
  "@react-hook/size": "^2.1.1",
19
- "@sis-cc/dotstatsuite-d3-charts": "^9.1.2",
20
- "@sis-cc/dotstatsuite-sdmxjs": "^10.1.0",
21
- "@sis-cc/dotstatsuite-visions": "^12.8.0",
22
- "date-fns": "^1.30.1",
23
29
  "lodash": "^4.17.2",
24
- "lodash.compose": "^2.4.1",
25
- "memoizee": "^0.4.4",
26
- "numeral": "^2.0.6",
27
- "prop-types": "^15.6.2",
28
- "ramda": "^0.26.1"
30
+ "memoizee": "^0.4.4"
29
31
  },
30
32
  "peerDependencies": {
31
33
  "@emotion/react": "^11",
@@ -33,6 +35,10 @@
33
35
  "@mui/icons-material": "^5",
34
36
  "@mui/material": "^5",
35
37
  "@mui/styles": "^5",
38
+ "@sis-cc/dotstatsuite-sdmxjs": "~10.1.0",
39
+ "@sis-cc/dotstatsuite-visions": "~12.27.0",
40
+ "date-fns": "^1.30.1",
41
+ "numeral": "^2.0.6",
36
42
  "react": "^18",
37
43
  "react-dom": "^18"
38
44
  }
@@ -1,5 +1,4 @@
1
1
  import React, { Component } from 'react';
2
- import { isFunction, cloneDeep } from 'lodash';
3
2
 
4
3
  export default D3Chart => class ReactChart extends Component {
5
4
  constructor(props) {
@@ -48,7 +47,7 @@ export default D3Chart => class ReactChart extends Component {
48
47
 
49
48
  componentWillUnmount() {
50
49
  super.componentWillUnmount && super.componentWillUnmount();
51
-
50
+
52
51
  this.chart && this.chart.destroy && this.chart.destroy(this.refs.chart);
53
52
  }
54
53
 
@@ -1,4 +1,4 @@
1
- import { get, map, reduce, sortBy, head, isEmpty, isFunction, isNil, split } from 'lodash';
1
+ import { map, sortBy, head, isEmpty, isNil, split } from 'lodash';
2
2
  import { categoryDisplay } from '../dimension-utils';
3
3
  import { getFormatedObservation } from '../observation-formater';
4
4
 
@@ -3,7 +3,6 @@ import {
3
3
  filter, find, includes, isArray, findIndex, isEqual
4
4
  } from 'lodash';
5
5
  import * as R from 'ramda';
6
- import compose from 'lodash.compose';
7
6
  import memoizee from 'memoizee';
8
7
  import __sampleSeries from './factories/sample-series';
9
8
  import __sampleFocus from './factories/sample-focus';
@@ -29,7 +28,7 @@ export const freqQ = FREQ_Q;
29
28
  export const freqM = FREQ_M;
30
29
 
31
30
  // --------------------------------------------------------------------------------extractSdmxErrors
32
- const _extractSdmxErrors = (data) => compose(
31
+ const _extractSdmxErrors = (data) => R.compose(
33
32
  (errors) => map(errors, (error) => ({ label: error.code, description: error.message })),
34
33
  (data) => get(data, 'errors', [])
35
34
  );
@@ -85,15 +84,15 @@ export const getDimensionValues = (dimension) => get(dimension, 'values', []);
85
84
  const _splitDimensions = (data) => {
86
85
  const { dimensions } = extractSdmxArtefacts(data);
87
86
  const [value, values] = partition(
88
- reject(dimensions, compose(isEmpty, getDimensionValues)),
89
- compose((values) => size(values) === 1, getDimensionValues)
87
+ reject(dimensions, R.compose(isEmpty, getDimensionValues)),
88
+ R.compose((values) => size(values) === 1, getDimensionValues)
90
89
  );
91
90
  return { value, values };
92
91
  }
93
92
  export const splitDimensions = memoizee(_splitDimensions);
94
93
 
95
94
  // ------------------------------------------------------------------dimensionsWithValuesIndexedById
96
- const _dimensionsWithValuesIndexedById = (data) => compose(
95
+ const _dimensionsWithValuesIndexedById = (data) => R.compose(
97
96
  (dimensionsWithValues) => keyBy(dimensionsWithValues, 'id'),
98
97
  (split) => split.values,
99
98
  splitDimensions
@@ -212,11 +211,11 @@ const _source = (data, config, meta) => {
212
211
  return null;
213
212
  const source = get(config, 'source', null);
214
213
  if (source && !(isEmpty(source)))
215
- return source;
214
+ return source;
216
215
  const artefacts = extractSdmxArtefacts(data);
217
216
  const uri = get(artefacts, 'source');
218
- if (!uri)
219
- return get(config, 'defaultSource', null);
217
+ if (!uri)
218
+ return get(config, 'defaultSource', null);
220
219
  const match = uri.match(/(^http.*)\/SDMX-JSON\/data\/([^\/]+)\//);
221
220
  if (size(match) !== 3)
222
221
  return null;
@@ -232,20 +231,20 @@ const _focus = (data, type, dimension, _display) => {
232
231
  case 'RowChart': case 'BarChart':
233
232
  case 'HorizontalSymbolChart': case 'VerticalSymbolChart':
234
233
  case 'StackedBarChart': case 'StackedRowChart':
235
- return compose(
234
+ return R.compose(
236
235
  (datapoints) => map(datapoints, (dp) => ({ label: dp.category, value: dp.key })),
237
236
  (series) => series[0].datapoints,
238
237
  series
239
238
  )(data, type, null, dimension, null, display);
240
239
  case 'TimelineChart':
241
- return compose(
240
+ return R.compose(
242
241
  (series) => map(series, (serie) => ({ label: serie.category, value: serie.key })),
243
242
  series
244
243
  )(data, type, null, dimension, null, display)
245
244
  case 'ScatterChart':
246
245
  const id = get(dimension, 'id');
247
246
  if (isNil(id)) return [];
248
- const dimensions = compose(
247
+ const dimensions = R.compose(
249
248
  (dimensions) => omit(dimensions, id),
250
249
  dimensionsWithValuesIndexedById
251
250
  )(data);
@@ -324,7 +323,7 @@ export const headerUprsLabel = display => uprAttributes => {
324
323
  ).join(', ');
325
324
  }
326
325
 
327
- export const getUprs = (data, display) => compose(
326
+ export const getUprs = (data, display) => R.compose(
328
327
  headerUprsLabel(parseDisplay(display)),
329
328
  uprAttributesWithOneRelevantValue,
330
329
  ({ attributes }) => uprAttributes(attributes),
@@ -338,7 +337,7 @@ const _header = (data, _title, _subtitle, _display) => {
338
337
  return ({
339
338
  title,
340
339
  subtitle: isArray(subtitle) ? subtitle : [subtitle],
341
- uprs: compose(
340
+ uprs: R.compose(
342
341
  headerUprsLabel(display),
343
342
  uprAttributesWithOneRelevantValue,
344
343
  ({ attributes }) => uprAttributes(attributes),
@@ -395,3 +394,5 @@ export { isSharedLayoutCompatible } from './layout';
395
394
 
396
395
  export { getObservations } from './preparators/getObservations';
397
396
 
397
+ export const getFlags = R.identity;
398
+ export const prepareData = R.identity;
@@ -1,7 +1,6 @@
1
1
  import memoizee from 'memoizee';
2
2
  import numeral from 'numeral';
3
3
  import * as R from 'ramda';
4
- import { isNan } from 'lodash';
5
4
  import { extractSdmxArtefacts } from './';
6
5
 
7
6
  export const DEFAULT_PREFSCALE_ATTR_IDS = ["PREF_SCALE"];
@@ -1,7 +1,7 @@
1
1
  import * as R from 'ramda';
2
2
  import { extractSdmxArtefacts, focus } from '../';
3
- import { BAR, ROW, SCATTER, TIMELINE, TYPES } from '../constants';
4
- import { toSingularity, hasFocus } from './utils';
3
+ import { BAR, ROW, TIMELINE } from '../constants';
4
+ import { hasFocus } from './utils';
5
5
 
6
6
  const sampleFocusTypes = { [BAR]: BAR, [ROW]: ROW, [TIMELINE]: TIMELINE };
7
7
 
@@ -63,7 +63,7 @@ export const focusStateFromNewProps = ({ data, display, type }, singularity, sta
63
63
 
64
64
  export const sampleFocusStateFromNewProps = (props, state) => {
65
65
  if (!R.has(props.type, sampleFocusTypes) || R.isNil(props.data)) {
66
- return ({}); //no changes
66
+ return ({}); //no changes
67
67
  }
68
68
  return focusStateFromNewProps(props, null, state);
69
69
  };
@@ -35,3 +35,5 @@ export const getIsHidden = annotations => R.pipe(
35
35
  R.find(R.propEq('type', NOT_DISPLAYED)),
36
36
  R.complement(R.isNil)
37
37
  )(annotations);
38
+
39
+ export const getFullName = R.identity;
@@ -1,6 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import * as R from 'ramda';
3
- import cx from 'classnames';
4
3
  import useSize from '@react-hook/size';
5
4
  import { Loading, NoData, TableHtml5 } from '@sis-cc/dotstatsuite-visions';
6
5
  import { makeStyles, useTheme } from '@mui/styles';
@@ -72,10 +71,10 @@ const Viewer = ({ type, targets={}, width, ...rest }) => {
72
71
  return (
73
72
  <div
74
73
  {...(targets.viewer ? { ref: targets.viewer } : {})}
75
- className={cx(classes.container, {
76
- [classes.tableContainer]: type === 'table',
77
- [classes.chartContainer]: type !== 'table'
78
- })}
74
+ className={[
75
+ classes.container,
76
+ type === 'table' ? classes.tableContainer : classes.chartContainer
77
+ ]}
79
78
  >
80
79
  <Header
81
80
  target={targets.header}
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import * as R from 'ramda';
4
3
  import makeStyles from '@mui/styles/makeStyles';
5
4
  import { SCATTER } from '../../../rules/src/constants';
@@ -39,10 +38,4 @@ const AxisLegend = ({ axis, data, type }) => {
39
38
  }
40
39
  };
41
40
 
42
- AxisLegend.propTypes = {
43
- axis: PropTypes.string.isRequired,
44
- data: PropTypes.object.isRequired,
45
- type: PropTypes.string.isRequired,
46
- };
47
-
48
41
  export default AxisLegend;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import * as R from 'ramda';
4
3
  import Legend from './Legend';
5
4
  import { SCATTER, TIMELINE } from '../../../rules/src/constants';
@@ -22,11 +21,11 @@ const FocusLegend = ({ data, options, type, width }) => {
22
21
  if (width < REDUCED_THRESHOLD) {
23
22
  return null;
24
23
  }
25
-
24
+
26
25
  const itemRenderer = R.pipe(
27
26
  R.when(R.always(type === SCATTER), R.always(scatterRenderer)),
28
27
  R.when(R.always(type === TIMELINE), R.always(lineRenderer)),
29
- )(null);
28
+ )(null);
30
29
 
31
30
  const getItemLabel = R.ifElse(
32
31
  R.equals(SCATTER),
@@ -61,11 +60,4 @@ const FocusLegend = ({ data, options, type, width }) => {
61
60
  return (<Legend items={items} itemRenderer={itemRenderer} />);
62
61
  }
63
62
 
64
- FocusLegend.propTypes = {
65
- data: PropTypes.object,
66
- options: PropTypes.object,
67
- type: PropTypes.string,
68
- width: PropTypes.number
69
- };
70
-
71
63
  export default FocusLegend;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import * as R from 'ramda';
4
3
  import makeStyles from '@mui/styles/makeStyles';
5
4
  import { getFontFromTheme } from '../utils';
@@ -44,9 +43,4 @@ const Legend = ({ items, itemRenderer }) => {
44
43
  return (<div className={classes.legend} >{legendEntries}</div>);
45
44
  };
46
45
 
47
- Legend.propTypes = {
48
- itemRenderer: PropTypes.func,
49
- items: PropTypes.array
50
- };
51
-
52
46
  export default Legend;
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import * as R from 'ramda';
4
3
  import Legend from './Legend';
5
4
  import { H_SYMBOL, STACKED_BAR, STACKED_ROW, V_SYMBOL } from '../../../rules/src/constants';
@@ -76,10 +75,4 @@ const SeriesLegend = ({ data, options, type }) => {
76
75
  );
77
76
  };
78
77
 
79
- SeriesLegend.propTypes = {
80
- data: PropTypes.object,
81
- options: PropTypes.object,
82
- type: PropTypes.string,
83
- };
84
-
85
78
  export default SeriesLegend;
@@ -0,0 +1,51 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import { visualizer } from "rollup-plugin-visualizer";
4
+ import replace from '@rollup/plugin-replace';
5
+ import { dependencies, peerDependencies } from './package.json';
6
+
7
+ export default defineConfig({
8
+ plugins: [
9
+ react(),
10
+ visualizer({
11
+ open: false, // auto-open in browser
12
+ gzipSize: true,
13
+ brotliSize: true,
14
+ }),
15
+ replace({
16
+ preventAssignment: true,
17
+ delimiters: ['', ''],
18
+ values: {
19
+ 'var d3_document = this.document;':
20
+ 'var d3_document = globalThis.document;',
21
+ 'this[d3_vendorSymbol(this, "requestAnimationFrame")]':
22
+ 'globalThis[d3_vendorSymbol(globalThis, "requestAnimationFrame")]',
23
+ 'this.navigator && /WebKit/.test(this.navigator.userAgent)':
24
+ 'globalThis.navigator && /WebKit/.test(globalThis.navigator.userAgent)',
25
+ },
26
+ })
27
+ ],
28
+ build: {
29
+ minify: false,
30
+ lib: {
31
+ entry: 'src/index.js',
32
+ name: '@sis-cc/dotstatsuite-components',
33
+ formats: ['es'],
34
+ },
35
+ rollupOptions: {
36
+ external: (id) => {
37
+ const externals = [
38
+ ...Object.keys(peerDependencies || {}),
39
+ ...Object.keys(dependencies || {}),
40
+ ];
41
+ return externals.some(pkg => id === pkg || id.startsWith(pkg + '/'));
42
+ },
43
+ },
44
+ },
45
+ // can be removed when all jsx files will have .jsx extension
46
+ esbuild: {
47
+ loader: 'jsx',
48
+ include: /src\/.*\.jsx?$/,
49
+ exclude: [],
50
+ }
51
+ });
package/lib/app.js DELETED
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- var _react = require('react');
4
-
5
- var _react2 = _interopRequireDefault(_react);
6
-
7
- var _client = require('react-dom/client');
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
- var container = document.getElementById('root');
12
- var root = (0, _client.createRoot)(container);
13
-
14
- var App = function App() {
15
- return _react2.default.createElement(
16
- _react.StrictMode,
17
- null,
18
- 'I\'m not groot, I\'m component'
19
- );
20
- };
21
-
22
- root.render(_react2.default.createElement(App, null));
@@ -1,98 +0,0 @@
1
- 'use strict';
2
-
3
- var _extends2 = require('babel-runtime/helpers/extends');
4
-
5
- var _extends3 = _interopRequireDefault(_extends2);
6
-
7
- var _size2 = require('lodash/size');
8
-
9
- var _size3 = _interopRequireDefault(_size2);
10
-
11
- var _range2 = require('lodash/range');
12
-
13
- var _range3 = _interopRequireDefault(_range2);
14
-
15
- var _map2 = require('lodash/map');
16
-
17
- var _map3 = _interopRequireDefault(_map2);
18
-
19
- var _react = require('react');
20
-
21
- var _react2 = _interopRequireDefault(_react);
22
-
23
- var _reactDom = require('react-dom');
24
-
25
- var _ = require('./');
26
-
27
- var _mockChoro = require('./mock-choro');
28
-
29
- var _mockChoro2 = _interopRequireDefault(_mockChoro);
30
-
31
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32
-
33
- function _render(id, chart) {
34
- var root = document.createElement('div');
35
- root.id = id;
36
- document.getElementById('root').appendChild(root);
37
- (0, _reactDom.render)(chart, root);
38
- }
39
-
40
- var datapoints = [{ label: 'label1', x: -90, y: -4 }, { label: 'label2', x: 110, y: 10 }, { label: 'label3', x: 120, y: 14 }, { label: 'label4', x: 137, y: 22 }, { label: 'label5', x: 155, y: 36 }, { label: 'label6', x: 268, y: 37, baselineIndex: 0 }, { label: 'label7', x: 320, y: 41, highlightIndex: 0 }, { label: 'label8', x: 569, y: 89, highlightIndex: 1 }];
41
-
42
- var barData = [{ datapoints: datapoints }];
43
- var rowData = [{ datapoints: (0, _map3.default)(datapoints, function (dp) {
44
- return (0, _extends3.default)({}, dp, { x: dp.y, y: dp.x });
45
- }) }];
46
- var scatterData = [{ datapoints: (0, _map3.default)(datapoints, function (dp) {
47
- return (0, _extends3.default)({}, dp, { x: dp.y });
48
- }) }];
49
- var lineFuncs = [function (x) {
50
- return 10 * x + 7;
51
- }, function (x) {
52
- return x * 2 + 4;
53
- }, function (x) {
54
- return x * .3 + 20;
55
- }, function (x) {
56
- return x * 4 + 14;
57
- }, function (x) {
58
- return x * .8 - 4;
59
- }, function (x) {
60
- return Math.pow(x, .5) + 5;
61
- }, function (x) {
62
- return x * (x / 40);
63
- }, function (x) {
64
- return x * (x / 40) * (x / 40);
65
- }];
66
- var lineData = (0, _map3.default)((0, _range3.default)((0, _size3.default)(lineFuncs)), function (r, i) {
67
- return {
68
- datapoints: (0, _map3.default)((0, _range3.default)(50), function (j) {
69
- return { x: 2 * j + 1, y: lineFuncs[i % (0, _size3.default)(lineFuncs)](2 * j + 1) };
70
- }),
71
- baselineIndex: i == 0 ? i : -1,
72
- highlightIndex: i == 2 || i == 7 ? i : -1
73
- };
74
- });
75
- var options = {
76
- base: {
77
- width: 800,
78
- height: 400,
79
- isAnnotated: true
80
- },
81
- legend: {
82
- choropleth: {
83
- width: 300,
84
- height: 50
85
- }
86
- }
87
- };
88
- var log = function log(options) {
89
- return console.log(options);
90
- };
91
-
92
- _render('root1', _react2.default.createElement(_.BarChart, { options: options, data: barData, getInitialOptions: log }));
93
- _render('root2', _react2.default.createElement(_.RowChart, { options: options, data: rowData }));
94
- _render('root3', _react2.default.createElement(_.ScatterChart, { options: options, data: scatterData }));
95
- _render('root4', _react2.default.createElement(_.LineChart, { options: options, data: lineData }));
96
- _render('root5', _react2.default.createElement(_.TimelineChart, { options: options, data: lineData }));
97
- _render('root6', _react2.default.createElement(_.ChoroplethChart, { options: options, data: _mockChoro2.default }));
98
- _render('root7', _react2.default.createElement(_.ChoroplethLegend, { options: options, data: _mockChoro2.default }));
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ChoroplethLegend = exports.ChoroplethChart = exports.StackedRowChart = exports.StackedBarChart = exports.HorizontalSymbolChart = exports.VerticalSymbolChart = exports.TimelineChart = exports.SymbolChart = exports.LineChart = exports.ScatterChart = exports.RowChart = exports.BarChart = undefined;
7
-
8
- var _react = require('react');
9
-
10
- var _reactChartFactory = require('./react-chart-factory');
11
-
12
- var _reactChartFactory2 = _interopRequireDefault(_reactChartFactory);
13
-
14
- var _dotstatsuiteD3Charts = require('@sis-cc/dotstatsuite-d3-charts');
15
-
16
- var rcwCharts = _interopRequireWildcard(_dotstatsuiteD3Charts);
17
-
18
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- var BarChart = exports.BarChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.BarChart));
23
- var RowChart = exports.RowChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.RowChart));
24
- var ScatterChart = exports.ScatterChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.ScatterChart));
25
- var LineChart = exports.LineChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.LineChart));
26
- var SymbolChart = exports.SymbolChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.SymbolChart));
27
- var TimelineChart = exports.TimelineChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.TimelineChart));
28
- var VerticalSymbolChart = exports.VerticalSymbolChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.VerticalSymbolChart));
29
- var HorizontalSymbolChart = exports.HorizontalSymbolChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.HorizontalSymbolChart));
30
- var StackedBarChart = exports.StackedBarChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.StackedBarChart));
31
- var StackedRowChart = exports.StackedRowChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.StackedRowChart));
32
- var ChoroplethChart = exports.ChoroplethChart = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.ChoroplethChart));
33
- var ChoroplethLegend = exports.ChoroplethLegend = (0, _react.createFactory)((0, _reactChartFactory2.default)(rcwCharts.ChoroplethLegend));