@devgateway/dvz-wp-commons 1.2.0 → 1.3.0

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 (51) hide show
  1. package/build/APIConfig.cjs +479 -0
  2. package/build/APIConfig.d.ts +12 -0
  3. package/build/APIConfig.js +367 -283
  4. package/build/APIutils.cjs +54 -0
  5. package/build/APIutils.js +7 -1
  6. package/build/Blocks.cjs +672 -0
  7. package/build/Blocks.d.ts +14 -1
  8. package/build/Blocks.js +523 -330
  9. package/build/CSVSourceConfig.cjs +99 -0
  10. package/build/CSVSourceConfig.js +63 -46
  11. package/build/ChartColors.cjs +593 -0
  12. package/build/ChartColors.d.ts +0 -1
  13. package/build/ChartColors.js +430 -366
  14. package/build/ChartLegends.cjs +157 -0
  15. package/build/ChartLegends.d.ts +0 -1
  16. package/build/ChartLegends.js +173 -54
  17. package/build/ChartMeasures.cjs +192 -0
  18. package/build/ChartMeasures.d.ts +0 -1
  19. package/build/ChartMeasures.js +197 -109
  20. package/build/Constants.cjs +21 -0
  21. package/build/Constants.js +3 -1
  22. package/build/DataFilters.cjs +176 -0
  23. package/build/DataFilters.js +100 -89
  24. package/build/Format.cjs +1038 -0
  25. package/build/Format.js +428 -378
  26. package/build/MapCSVSourceConfig.cjs +36 -0
  27. package/build/MapCSVSourceConfig.js +19 -8
  28. package/build/Measures.cjs +196 -0
  29. package/build/Measures.js +204 -108
  30. package/build/MobileConfigUtils.cjs +92 -0
  31. package/build/MobileConfigUtils.js +19 -8
  32. package/build/Tooltip.cjs +63 -0
  33. package/build/Tooltip.d.ts +1 -3
  34. package/build/Tooltip.js +27 -51
  35. package/build/Util.cjs +29 -0
  36. package/build/Util.js +7 -7
  37. package/build/hooks/index.cjs +1 -0
  38. package/build/hooks/index.js +0 -3
  39. package/build/icons/Chart.cjs +49 -0
  40. package/build/icons/Chart.d.ts +1 -2
  41. package/build/icons/Chart.js +10 -11
  42. package/build/icons/Generic.cjs +24 -0
  43. package/build/icons/Generic.d.ts +1 -2
  44. package/build/icons/Generic.js +25 -4
  45. package/build/icons/index.cjs +19 -0
  46. package/build/icons/index.js +2 -2
  47. package/build/index.cjs +225 -0
  48. package/build/index.d.ts +1 -1
  49. package/build/index.js +47 -16
  50. package/package.json +16 -7
  51. package/build/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ module.exports = exports.CSVConfig = void 0;
7
+ var _components = require("@wordpress/components");
8
+ var _i18n = require("@wordpress/i18n");
9
+ var _Format = _interopRequireDefault(require("./Format.cjs"));
10
+ var _Util = require("./Util.cjs");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ const defaultFormat = {
13
+ "style": "percent",
14
+ "minimumFractionDigits": 1,
15
+ "maximumFractionDigits": 1,
16
+ "currency": "USD"
17
+ };
18
+ const CSVConfig = ({
19
+ attributes: {
20
+ csv,
21
+ panelStatus,
22
+ measures,
23
+ type
24
+ },
25
+ setAttributes
26
+ }) => {
27
+ const onFormatChange = (format, field) => {
28
+ const app = "csv";
29
+ const uMs = measures ? JSON.parse(JSON.stringify(measures)) : {};
30
+ if (!uMs[app]) {
31
+ uMs[app] = {
32
+ allowSelection: false,
33
+ format: Object.assign({}, defaultFormat),
34
+ customFormat: Object.assign({}, {
35
+ ...defaultFormat
36
+ }),
37
+ selected: false
38
+ };
39
+ }
40
+ uMs[app][field] = format;
41
+ setAttributes({
42
+ measures: uMs
43
+ });
44
+ };
45
+ const onUseCustomAxisFormatChange = value => {
46
+ const app = "csv";
47
+ const uMs = measures ? JSON.parse(JSON.stringify(measures)) : {};
48
+ if (uMs[app]) {
49
+ uMs[app].useCustomAxisFormat = value;
50
+ if (!uMs[app].customFormat) {
51
+ uMs[app].customFormat = Object.assign({}, {
52
+ ...defaultFormat
53
+ });
54
+ }
55
+ setAttributes({
56
+ measures: uMs
57
+ });
58
+ } else {
59
+ uMs[app] = {
60
+ allowSelection: false,
61
+ format: Object.assign({}, {
62
+ ...defaultFormat
63
+ }),
64
+ customFormat: Object.assign({}, {
65
+ ...defaultFormat
66
+ }),
67
+ selected: false
68
+ };
69
+ uMs[app].useCustomAxisFormat = value;
70
+ setAttributes({
71
+ measures: uMs
72
+ });
73
+ }
74
+ };
75
+ return [/* @__PURE__ */React.createElement(_components.PanelBody, {
76
+ initialOpen: false,
77
+ title: (0, _i18n.__)("CSV Configuration"),
78
+ onToggle: e => (0, _Util.togglePanel)("csv_cfg", panelStatus, setAttributes)
79
+ }, /* @__PURE__ */React.createElement(_components.PanelRow, null, /* @__PURE__ */React.createElement(_components.TextareaControl, {
80
+ label: (0, _i18n.__)("CSV Data"),
81
+ value: csv,
82
+ onChange: csv2 => setAttributes({
83
+ csv: csv2
84
+ })
85
+ })), /* @__PURE__ */React.createElement(_Format.default, {
86
+ hiddenCustomAxisFormat: type == "radar" || type == "big-number",
87
+ format: measures["csv"] && measures["csv"].format ? measures["csv"].format : {},
88
+ customFormat: measures["csv"] && measures["csv"].customFormat ? measures["csv"].customFormat : {},
89
+ useCustomAxisFormat: measures["csv"] ? measures["csv"].useCustomAxisFormat : false,
90
+ onFormatChange: (newFormat, field) => {
91
+ onFormatChange(newFormat, field);
92
+ },
93
+ onUseCustomAxisFormatChange: value => {
94
+ onUseCustomAxisFormatChange(value);
95
+ }
96
+ }))];
97
+ };
98
+ exports.CSVConfig = CSVConfig;
99
+ module.exports = CSVConfig;
@@ -1,53 +1,70 @@
1
- import { PanelBody, PanelRow, TextareaControl } from '@wordpress/components';
2
- import { __ } from '@wordpress/i18n';
3
- import Format from "./Format";
4
- import { togglePanel } from "./Util";
1
+ import { PanelBody, PanelRow, TextareaControl } from "@wordpress/components";
2
+ import { __ } from "@wordpress/i18n";
3
+ import Format from "./Format.js";
4
+ import { togglePanel } from "./Util.js";
5
5
  const defaultFormat = {
6
- "style": "percent", "minimumFractionDigits": 1, "maximumFractionDigits": 1, "currency": "USD"
6
+ "style": "percent",
7
+ "minimumFractionDigits": 1,
8
+ "maximumFractionDigits": 1,
9
+ "currency": "USD"
7
10
  };
8
11
  export const CSVConfig = ({ attributes: { csv, panelStatus, measures, type }, setAttributes }) => {
9
- const onFormatChange = (format, field) => {
10
- const app = "csv";
11
- const uMs = measures ? JSON.parse(JSON.stringify(measures)) : {};
12
- if (!uMs[app]) {
13
- uMs[app] = {
14
- allowSelection: false,
15
- format: Object.assign({}, defaultFormat),
16
- customFormat: Object.assign({}, { ...defaultFormat }),
17
- selected: false
18
- };
12
+ const onFormatChange = (format, field) => {
13
+ const app = "csv";
14
+ const uMs = measures ? JSON.parse(JSON.stringify(measures)) : {};
15
+ if (!uMs[app]) {
16
+ uMs[app] = { allowSelection: false, format: Object.assign({}, defaultFormat), customFormat: Object.assign({}, { ...defaultFormat }), selected: false };
17
+ }
18
+ uMs[app][field] = format;
19
+ setAttributes({ measures: uMs });
20
+ };
21
+ const onUseCustomAxisFormatChange = (value) => {
22
+ const app = "csv";
23
+ const uMs = measures ? JSON.parse(JSON.stringify(measures)) : {};
24
+ if (uMs[app]) {
25
+ uMs[app].useCustomAxisFormat = value;
26
+ if (!uMs[app].customFormat) {
27
+ uMs[app].customFormat = Object.assign({}, { ...defaultFormat });
28
+ }
29
+ setAttributes({ measures: uMs });
30
+ } else {
31
+ uMs[app] = { allowSelection: false, format: Object.assign({}, { ...defaultFormat }), customFormat: Object.assign({}, { ...defaultFormat }), selected: false };
32
+ uMs[app].useCustomAxisFormat = value;
33
+ setAttributes({ measures: uMs });
34
+ }
35
+ };
36
+ return [
37
+ /* @__PURE__ */ React.createElement(
38
+ PanelBody,
39
+ {
40
+ initialOpen: false,
41
+ title: __("CSV Configuration"),
42
+ onToggle: (e) => togglePanel("csv_cfg", panelStatus, setAttributes)
43
+ },
44
+ /* @__PURE__ */ React.createElement(PanelRow, null, /* @__PURE__ */ React.createElement(
45
+ TextareaControl,
46
+ {
47
+ label: __("CSV Data"),
48
+ value: csv,
49
+ onChange: (csv2) => setAttributes({ csv: csv2 })
19
50
  }
20
- uMs[app][field] = format;
21
- setAttributes({ measures: uMs });
22
- };
23
- const onUseCustomAxisFormatChange = (value) => {
24
- const app = "csv";
25
- const uMs = measures ? JSON.parse(JSON.stringify(measures)) : {};
26
- if (uMs[app]) {
27
- uMs[app].useCustomAxisFormat = value;
28
- if (!uMs[app].customFormat) {
29
- uMs[app].customFormat = Object.assign({}, { ...defaultFormat });
30
- }
31
- setAttributes({ measures: uMs });
51
+ )),
52
+ /* @__PURE__ */ React.createElement(
53
+ Format,
54
+ {
55
+ hiddenCustomAxisFormat: type == "radar" || type == "big-number",
56
+ format: measures["csv"] && measures["csv"].format ? measures["csv"].format : {},
57
+ customFormat: measures["csv"] && measures["csv"].customFormat ? measures["csv"].customFormat : {},
58
+ useCustomAxisFormat: measures["csv"] ? measures["csv"].useCustomAxisFormat : false,
59
+ onFormatChange: (newFormat, field) => {
60
+ onFormatChange(newFormat, field);
61
+ },
62
+ onUseCustomAxisFormatChange: (value) => {
63
+ onUseCustomAxisFormatChange(value);
64
+ }
32
65
  }
33
- else {
34
- uMs[app] = {
35
- allowSelection: false,
36
- format: Object.assign({}, { ...defaultFormat }),
37
- customFormat: Object.assign({}, { ...defaultFormat }),
38
- selected: false
39
- };
40
- uMs[app].useCustomAxisFormat = value;
41
- setAttributes({ measures: uMs });
42
- }
43
- };
44
- return ([React.createElement(PanelBody, { initialOpen: false, title: __("CSV Configuration"), onToggle: e => togglePanel("csv_cfg", panelStatus, setAttributes) },
45
- React.createElement(PanelRow, null,
46
- React.createElement(TextareaControl, { label: __("CSV Data"), value: csv, onChange: (csv) => setAttributes({ csv }) })),
47
- React.createElement(Format, { hiddenCustomAxisFormat: type == 'radar' || type == 'big-number', format: measures["csv"] && measures["csv"].format ? measures["csv"].format : {}, customFormat: measures["csv"] && measures["csv"].customFormat ? measures["csv"].customFormat : {}, useCustomAxisFormat: measures["csv"] ? measures["csv"].useCustomAxisFormat : false, onFormatChange: (newFormat, field) => {
48
- onFormatChange(newFormat, field);
49
- }, onUseCustomAxisFormatChange: value => {
50
- onUseCustomAxisFormatChange(value);
51
- } }))]);
66
+ )
67
+ )
68
+ ];
52
69
  };
53
70
  export default CSVConfig;