@cdc/core 4.25.3-6 → 4.25.3

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 (38) hide show
  1. package/components/AdvancedEditor/AdvancedEditor.tsx +11 -9
  2. package/components/DataTable/DataTable.tsx +34 -20
  3. package/components/DataTable/components/ChartHeader.tsx +1 -1
  4. package/components/DataTable/helpers/getChartCellValue.ts +11 -5
  5. package/components/DataTable/helpers/getDataSeriesColumns.ts +7 -3
  6. package/components/DataTable/helpers/mapCellMatrix.tsx +64 -33
  7. package/components/DataTable/helpers/tests/mapCellMatrix.test.ts +80 -0
  8. package/components/EditorPanel/DataTableEditor.tsx +28 -18
  9. package/components/EditorPanel/Inputs.tsx +2 -1
  10. package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +23 -0
  11. package/components/Filters/Filters.tsx +20 -8
  12. package/components/Layout/components/Visualization/visualizations.scss +1 -1
  13. package/components/MediaControls.jsx +14 -7
  14. package/components/elements/Button.jsx +4 -2
  15. package/dist/cove-main.css +98 -151
  16. package/dist/cove-main.css.map +1 -1
  17. package/helpers/DataTransform.ts +2 -2
  18. package/helpers/addValuesToFilters.ts +1 -1
  19. package/helpers/coveUpdateWorker.ts +12 -7
  20. package/helpers/formatConfigBeforeSave.ts +30 -8
  21. package/helpers/isRightAlignedTableValue.js +5 -1
  22. package/helpers/isSolr.ts +13 -0
  23. package/helpers/labelHash.ts +21 -0
  24. package/helpers/pivotData.ts +14 -7
  25. package/helpers/tests/formatConfigBeforeSave.test.ts +68 -0
  26. package/helpers/tests/pivotData.test.ts +23 -19
  27. package/helpers/ver/4.25.3.ts +20 -0
  28. package/helpers/ver/tests/versionNeedsUpdate.test.ts +28 -0
  29. package/package.json +2 -2
  30. package/styles/_global-variables.scss +2 -1
  31. package/styles/_global.scss +18 -9
  32. package/styles/base.scss +42 -0
  33. package/styles/filters.scss +5 -11
  34. package/styles/v2/components/button.scss +48 -12
  35. package/styles/v2/themes/_color-definitions.scss +1 -4
  36. package/types/General.ts +0 -1
  37. package/types/Table.ts +2 -0
  38. package/helpers/isSolr.js +0 -13
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
2
  // import html2pdf from 'html2pdf.js'
3
- import html2canvas from 'html2canvas'
4
3
 
5
4
  const buttonText = {
6
5
  pdf: 'Download PDF',
@@ -76,12 +75,20 @@ const generateMedia = (state, type, elementToCapture) => {
76
75
 
77
76
  switch (type) {
78
77
  case 'image':
79
- html2canvas(baseSvg, {
80
- ignoreElements: el =>
81
- el.className?.indexOf && el.className.search(/download-buttons|download-links|data-table-container/) !== -1
82
- }).then(canvas => {
83
- saveImageAs(canvas.toDataURL(), filename + '.png')
84
- })
78
+ const downloadImage = async () => {
79
+ import(/* webpackChunkName: "html2canvas" */ 'html2canvas').then(mod => {
80
+ mod
81
+ .default(baseSvg, {
82
+ ignoreElements: el =>
83
+ el.className?.indexOf &&
84
+ el.className.search(/download-buttons|download-links|data-table-container/) !== -1
85
+ })
86
+ .then(canvas => {
87
+ saveImageAs(canvas.toDataURL(), filename + '.png')
88
+ })
89
+ })
90
+ }
91
+ downloadImage()
85
92
  return
86
93
  case 'pdf':
87
94
  // let opt = {
@@ -16,6 +16,7 @@ const Button = ({
16
16
  active = false,
17
17
  onClick,
18
18
  children,
19
+ secondary,
19
20
  ...attributes
20
21
  }) => {
21
22
  const buttonRef = useRef(null)
@@ -33,7 +34,8 @@ const Button = ({
33
34
  (flexCenter || 'loader' === role ? ' cove-button--flex-center' : '') +
34
35
  (fluid ? ' fluid' : '') +
35
36
  (loading ? ' loading' : '') +
36
- (attributes.className ? ' ' + attributes.className : ''),
37
+ (attributes.className ? ' ' + attributes.className : '') +
38
+ (secondary ? ' secondary' : ''),
37
39
  onMouseOver: () => setButtonState('in'),
38
40
  onMouseOut: () => setButtonState('out'),
39
41
  onFocus: () => setButtonState('in'),
@@ -89,7 +91,7 @@ const Button = ({
89
91
  {...attributesObj}
90
92
  onClick={e => {
91
93
  e.preventDefault()
92
- return loading || onClick()
94
+ return loading || onClick(e)
93
95
  }}
94
96
  disabled={loading || attributesObj.disabled}
95
97
  ref={buttonRef}