@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.
- package/build/APIConfig.cjs +479 -0
- package/build/APIConfig.d.ts +31 -42
- package/build/APIConfig.js +366 -277
- package/build/APIutils.cjs +54 -0
- package/build/APIutils.d.ts +3 -3
- package/build/APIutils.js +11 -1
- package/build/Blocks.cjs +672 -0
- package/build/Blocks.d.ts +42 -65
- package/build/Blocks.js +524 -346
- package/build/CSVSourceConfig.cjs +99 -0
- package/build/CSVSourceConfig.d.ts +2 -3
- package/build/CSVSourceConfig.js +63 -41
- package/build/ChartColors.cjs +593 -0
- package/build/ChartColors.d.ts +4 -46
- package/build/ChartColors.js +431 -380
- package/build/ChartLegends.cjs +157 -0
- package/build/ChartLegends.d.ts +1 -33
- package/build/ChartLegends.js +173 -69
- package/build/ChartMeasures.cjs +192 -0
- package/build/ChartMeasures.d.ts +1 -23
- package/build/ChartMeasures.js +195 -108
- package/build/Constants.cjs +21 -0
- package/build/Constants.d.ts +18 -15
- package/build/Constants.js +3 -1
- package/build/DataFilters.cjs +176 -0
- package/build/DataFilters.d.ts +1 -12
- package/build/DataFilters.js +100 -93
- package/build/Format.cjs +1038 -0
- package/build/Format.d.ts +8 -10
- package/build/Format.js +428 -379
- package/build/MapCSVSourceConfig.cjs +36 -0
- package/build/MapCSVSourceConfig.d.ts +7 -9
- package/build/MapCSVSourceConfig.js +19 -9
- package/build/Measures.cjs +196 -0
- package/build/Measures.d.ts +1 -24
- package/build/Measures.js +208 -119
- package/build/MobileConfigUtils.cjs +92 -0
- package/build/MobileConfigUtils.d.ts +6 -6
- package/build/MobileConfigUtils.js +39 -32
- package/build/Tooltip.cjs +63 -0
- package/build/Tooltip.d.ts +1 -3
- package/build/Tooltip.js +27 -51
- package/build/Util.cjs +29 -0
- package/build/Util.d.ts +5 -6
- package/build/Util.js +9 -9
- package/build/hooks/index.cjs +1 -0
- package/build/hooks/index.js +0 -3
- package/build/icons/Chart.cjs +49 -0
- package/build/icons/Chart.d.ts +1 -2
- package/build/icons/Chart.js +10 -11
- package/build/icons/Generic.cjs +24 -0
- package/build/icons/Generic.d.ts +1 -2
- package/build/icons/Generic.js +25 -4
- package/build/icons/index.cjs +19 -0
- package/build/icons/index.d.ts +2 -2
- package/build/icons/index.js +2 -2
- package/build/index.cjs +225 -0
- package/build/index.d.ts +16 -18
- package/build/index.js +47 -19
- package/package.json +39 -30
- package/build/post-type.d.ts +0 -193
- package/build/post-type.js +0 -12
- package/build/tsconfig.tsbuildinfo +0 -1
- package/build/types.d.ts +0 -349
- 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
|
-
|
|
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
|
-
})
|
|
9
|
+
}): import("react").JSX.Element[];
|
|
11
10
|
export default CSVConfig;
|
package/build/CSVSourceConfig.js
CHANGED
|
@@ -1,48 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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;
|