@devgateway/dvz-wp-commons 1.1.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 (65) hide show
  1. package/build/APIConfig.cjs +479 -0
  2. package/build/APIConfig.d.ts +31 -42
  3. package/build/APIConfig.js +366 -277
  4. package/build/APIutils.cjs +54 -0
  5. package/build/APIutils.d.ts +3 -3
  6. package/build/APIutils.js +11 -1
  7. package/build/Blocks.cjs +672 -0
  8. package/build/Blocks.d.ts +42 -65
  9. package/build/Blocks.js +524 -346
  10. package/build/CSVSourceConfig.cjs +99 -0
  11. package/build/CSVSourceConfig.d.ts +2 -3
  12. package/build/CSVSourceConfig.js +63 -41
  13. package/build/ChartColors.cjs +593 -0
  14. package/build/ChartColors.d.ts +4 -46
  15. package/build/ChartColors.js +431 -380
  16. package/build/ChartLegends.cjs +157 -0
  17. package/build/ChartLegends.d.ts +1 -33
  18. package/build/ChartLegends.js +173 -69
  19. package/build/ChartMeasures.cjs +192 -0
  20. package/build/ChartMeasures.d.ts +1 -23
  21. package/build/ChartMeasures.js +195 -108
  22. package/build/Constants.cjs +21 -0
  23. package/build/Constants.d.ts +18 -15
  24. package/build/Constants.js +3 -1
  25. package/build/DataFilters.cjs +176 -0
  26. package/build/DataFilters.d.ts +1 -12
  27. package/build/DataFilters.js +100 -93
  28. package/build/Format.cjs +1038 -0
  29. package/build/Format.d.ts +8 -10
  30. package/build/Format.js +428 -379
  31. package/build/MapCSVSourceConfig.cjs +36 -0
  32. package/build/MapCSVSourceConfig.d.ts +7 -9
  33. package/build/MapCSVSourceConfig.js +19 -9
  34. package/build/Measures.cjs +196 -0
  35. package/build/Measures.d.ts +1 -24
  36. package/build/Measures.js +208 -119
  37. package/build/MobileConfigUtils.cjs +92 -0
  38. package/build/MobileConfigUtils.d.ts +6 -6
  39. package/build/MobileConfigUtils.js +39 -32
  40. package/build/Tooltip.cjs +63 -0
  41. package/build/Tooltip.d.ts +1 -3
  42. package/build/Tooltip.js +27 -51
  43. package/build/Util.cjs +29 -0
  44. package/build/Util.d.ts +5 -6
  45. package/build/Util.js +9 -9
  46. package/build/hooks/index.cjs +1 -0
  47. package/build/hooks/index.js +0 -3
  48. package/build/icons/Chart.cjs +49 -0
  49. package/build/icons/Chart.d.ts +1 -2
  50. package/build/icons/Chart.js +10 -11
  51. package/build/icons/Generic.cjs +24 -0
  52. package/build/icons/Generic.d.ts +1 -2
  53. package/build/icons/Generic.js +25 -4
  54. package/build/icons/index.cjs +19 -0
  55. package/build/icons/index.d.ts +2 -2
  56. package/build/icons/index.js +2 -2
  57. package/build/index.cjs +225 -0
  58. package/build/index.d.ts +16 -18
  59. package/build/index.js +47 -19
  60. package/package.json +39 -30
  61. package/build/post-type.d.ts +0 -193
  62. package/build/post-type.js +0 -12
  63. package/build/tsconfig.tsbuildinfo +0 -1
  64. package/build/types.d.ts +0 -349
  65. package/build/types.js +0 -33
@@ -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,5 +1,4 @@
1
- import React from 'react';
2
- export declare const CSVConfig: ({ attributes: { csv, panelStatus, measures, type }, setAttributes }: {
1
+ export function CSVConfig({ attributes: { csv, panelStatus, measures, type }, setAttributes }: {
3
2
  attributes: {
4
3
  csv: any;
5
4
  panelStatus: any;
@@ -7,5 +6,5 @@ export declare const CSVConfig: ({ attributes: { csv, panelStatus, measures, typ
7
6
  type: any;
8
7
  };
9
8
  setAttributes: any;
10
- }) => React.JSX.Element[];
9
+ }): import("react").JSX.Element[];
11
10
  export default CSVConfig;
@@ -1,48 +1,70 @@
1
- import React from 'react';
2
- import { PanelBody, PanelRow, TextareaControl } from '@wordpress/components';
3
- import { __ } from '@wordpress/i18n';
4
- import Format from "./Format";
5
- 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";
6
5
  const defaultFormat = {
7
- "style": "percent",
8
- "minimumFractionDigits": 1,
9
- "maximumFractionDigits": 1,
10
- "currency": "USD"
6
+ "style": "percent",
7
+ "minimumFractionDigits": 1,
8
+ "maximumFractionDigits": 1,
9
+ "currency": "USD"
11
10
  };
12
11
  export const CSVConfig = ({ attributes: { csv, panelStatus, measures, type }, setAttributes }) => {
13
- const onFormatChange = (format, field) => {
14
- const app = "csv";
15
- const uMs = measures ? JSON.parse(JSON.stringify(measures)) : {};
16
- if (!uMs[app]) {
17
- uMs[app] = { allowSelection: false, format: Object.assign({}, defaultFormat), customFormat: Object.assign({}, { ...defaultFormat }), selected: false };
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 })
18
50
  }
19
- uMs[app][field] = format;
20
- setAttributes({ measures: uMs });
21
- };
22
- const onUseCustomAxisFormatChange = (value) => {
23
- const app = "csv";
24
- const uMs = measures ? JSON.parse(JSON.stringify(measures)) : {};
25
- if (uMs[app]) {
26
- uMs[app].useCustomAxisFormat = value;
27
- if (!uMs[app].customFormat) {
28
- uMs[app].customFormat = Object.assign({}, { ...defaultFormat });
29
- }
30
- 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
+ }
31
65
  }
32
- else {
33
- uMs[app] = { allowSelection: false, format: Object.assign({}, { ...defaultFormat }), customFormat: Object.assign({}, { ...defaultFormat }), selected: false };
34
- uMs[app].useCustomAxisFormat = value;
35
- setAttributes({ measures: uMs });
36
- }
37
- };
38
- return ([React.createElement(PanelBody, { initialOpen: false, title: __("CSV Configuration"), onToggle: e => togglePanel("csv_cfg", panelStatus, setAttributes) },
39
- React.createElement(PanelRow, null,
40
- React.createElement(TextareaControl, { label: __("CSV Data"), value: csv, onChange: (csv) => setAttributes({ csv }) })),
41
- 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) => {
42
- onFormatChange(newFormat, field);
43
- }, onUseCustomAxisFormatChange: value => {
44
- onUseCustomAxisFormatChange(value);
45
- } }))
46
- ]);
66
+ )
67
+ )
68
+ ];
47
69
  };
48
70
  export default CSVConfig;