@patternfly-java/charts 0.0.2 → 0.0.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@patternfly-java/charts",
3
3
  "private": false,
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "description": "Web Components wrapper around PatternFly React Charts",
6
6
  "homepage": "https://patternfly-java.github.io/",
7
7
  "repository": {
@@ -15,7 +15,7 @@
15
15
  "keywords": ["java", "gwt", "j2cl", "patternfly", "elemento"],
16
16
  "author": "Harald Pehl <harald.pehl@gmail.com>",
17
17
  "type": "module",
18
- "source": "src/js/index.js",
18
+ "source": "src/charts.js",
19
19
  "scripts": {
20
20
  "build": "parcel build src/charts.js --no-cache --no-optimize",
21
21
  "dev": "parcel serve demo.html --port 5173 --no-cache",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "lit": "^3.3.1",
30
- "react": "^19.2.1",
31
- "react-dom": "^19.2.1",
30
+ "react": "^19.2.3",
31
+ "react-dom": "^19.2.3",
32
32
  "hoist-non-react-statics": "^3.3.2",
33
33
  "@patternfly/react-charts": "^8.4.0",
34
34
  "@patternfly/react-styles": "^6.4.0",
package/src/charts.js CHANGED
@@ -13,10 +13,18 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import './components/pf-chart-donut.js';
17
- import './components/pf-chart-donut-utilization.js';
18
- import './components/pf-chart-bullet.js';
19
16
 
20
- export { PfChartDonut } from './components/pf-chart-donut.js';
21
- export { PfChartDonutUtilization } from './components/pf-chart-donut-utilization.js';
22
- export { PfChartBullet } from './components/pf-chart-bullet.js';
17
+ // Base class for J2CL JsInterop base class
18
+ class ChartElement extends HTMLElement {
19
+ }
20
+ window.ChartElement = ChartElement;
21
+
22
+ import './components/pfj-chart-donut.js';
23
+ import './components/pfj-chart-donut-utilization.js';
24
+ import './components/pfj-chart-donut-threshold.js';
25
+ import './components/pfj-chart-bullet.js';
26
+
27
+ export {ChartDonutWebComponent} from './components/pfj-chart-donut.js';
28
+ export {ChartDonutUtilizationWebComponent} from './components/pfj-chart-donut-utilization.js';
29
+ export {ChartDonutThresholdWebComponent} from './components/pfj-chart-donut-threshold.js';
30
+ export {ChartBulletWebComponent} from './components/pfj-chart-bullet.js';
@@ -0,0 +1,107 @@
1
+ /*
2
+ * Copyright 2023 Red Hat
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import {parseAttrValue, ReactWrapperElement} from '../react-wrapper.js';
17
+ import {ChartBullet} from '@patternfly/react-charts/victory';
18
+
19
+ export class ChartBulletWebComponent extends ReactWrapperElement {
20
+
21
+ constructor() {
22
+ super();
23
+ this._comparativeErrorMeasureData = undefined;
24
+ this._comparativeWarningMeasureData = undefined;
25
+ this._primaryDotMeasureData = undefined;
26
+ this._primarySegmentedMeasureData = undefined;
27
+ this._qualitativeRangeData = undefined;
28
+ }
29
+
30
+ getReactComponent() {
31
+ const extraProps = {};
32
+ if (this._comparativeErrorMeasureData && typeof this._comparativeErrorMeasureData !== 'string') {
33
+ extraProps.comparativeErrorMeasureData = this._comparativeErrorMeasureData;
34
+ } else if (this.getAttribute('comparative-error-measure-data')) {
35
+ extraProps.thresholds = parseAttrValue('comparative-error-measure-data', this.getAttribute('comparative-error-measure-data'));
36
+ }
37
+ if (this._comparativeWarningMeasureData && typeof this._comparativeWarningMeasureData !== 'string') {
38
+ extraProps.comparativeWarningMeasureData = this._comparativeWarningMeasureData;
39
+ } else if (this.getAttribute('comparative-warning-measure-data')) {
40
+ extraProps.thresholds = parseAttrValue('comparative-warning-measure-data', this.getAttribute('comparative-warning-measure-data'));
41
+ }
42
+ if (this._primaryDotMeasureData && typeof this._primaryDotMeasureData !== 'string') {
43
+ extraProps.primaryDotMeasureData = this._primaryDotMeasureData;
44
+ } else if (this.getAttribute('primary-dot-measure-data')) {
45
+ extraProps.thresholds = parseAttrValue('primary-dot-measure-data', this.getAttribute('primary-dot-measure-data'));
46
+ }
47
+ if (this._primarySegmentedMeasureData && typeof this._primarySegmentedMeasureData !== 'string') {
48
+ extraProps.primarySegmentedMeasureData = this._primarySegmentedMeasureData;
49
+ } else if (this.getAttribute('primary-segmented-measure-data')) {
50
+ extraProps.thresholds = parseAttrValue('primary-segmented-measure-data', this.getAttribute('primary-segmented-measure-data'));
51
+ }
52
+ if (this._qualitativeRangeData && typeof this._qualitativeRangeData !== 'string') {
53
+ extraProps.qualitativeRangeData = this._qualitativeRangeData;
54
+ } else if (this.getAttribute('qualitative-range-data')) {
55
+ extraProps.thresholds = parseAttrValue('qualitative-range-data', this.getAttribute('qualitative-range-data'));
56
+ }
57
+
58
+ return [ChartBullet, extraProps];
59
+ }
60
+
61
+ get comparativeErrorMeasureData() {
62
+ return this._comparativeErrorMeasureData;
63
+ }
64
+
65
+ set comparativeErrorMeasureData(value) {
66
+ this._comparativeErrorMeasureData = value;
67
+ this._notifyChange();
68
+ }
69
+
70
+ get comparativeWarningMeasureData() {
71
+ return this._comparativeWarningMeasureData;
72
+ }
73
+
74
+ set comparativeWarningMeasureData(value) {
75
+ this._comparativeWarningMeasureData = value;
76
+ this._notifyChange();
77
+ }
78
+
79
+ get primaryDotMeasureData() {
80
+ return this._primaryDotMeasureData;
81
+ }
82
+
83
+ set primaryDotMeasureData(value) {
84
+ this._primaryDotMeasureData = value;
85
+ this._notifyChange();
86
+ }
87
+
88
+ get primarySegmentedMeasureData() {
89
+ return this._primarySegmentedMeasureData;
90
+ }
91
+
92
+ set primarySegmentedMeasureData(value) {
93
+ this._primarySegmentedMeasureData = value;
94
+ this._notifyChange();
95
+ }
96
+
97
+ get qualitativeRangeData() {
98
+ return this._qualitativeRangeData;
99
+ }
100
+
101
+ set qualitativeRangeData(value) {
102
+ this._qualitativeRangeData = value;
103
+ this._notifyChange();
104
+ }
105
+ }
106
+
107
+ customElements.define('pfj-chart-bullet', ChartBulletWebComponent);
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright 2023 Red Hat
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import {ReactWrapperElement} from '../react-wrapper.js';
17
+ import {ChartDonutThreshold} from '@patternfly/react-charts/victory';
18
+
19
+ export class ChartDonutThresholdWebComponent extends ReactWrapperElement {
20
+
21
+ getReactComponent() {
22
+ return [ChartDonutThreshold, {}];
23
+ }
24
+ }
25
+
26
+ customElements.define('pfj-chart-donut-threshold', ChartDonutThresholdWebComponent);
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Copyright 2023 Red Hat
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import {parseAttrValue, ReactWrapperElement} from '../react-wrapper.js';
17
+ import {ChartDonutUtilization} from '@patternfly/react-charts/victory';
18
+
19
+ export class ChartDonutUtilizationWebComponent extends ReactWrapperElement {
20
+
21
+ constructor() {
22
+ super();
23
+ this._thresholds = undefined;
24
+ }
25
+
26
+ getReactComponent() {
27
+ const extraProps = {};
28
+ if (this._thresholds && typeof this._thresholds !== 'string') {
29
+ extraProps.thresholds = this._thresholds;
30
+ } else if (this.getAttribute('thresholds')) {
31
+ extraProps.thresholds = parseAttrValue('thresholds', this.getAttribute('thresholds'));
32
+ }
33
+ return [ChartDonutUtilization, extraProps];
34
+ }
35
+
36
+ get thresholds() {
37
+ return this._thresholds;
38
+ }
39
+
40
+ set thresholds(value) {
41
+ this._thresholds = value;
42
+ this._notifyChange();
43
+ }
44
+ }
45
+
46
+ customElements.define('pfj-chart-donut-utilization', ChartDonutUtilizationWebComponent);
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright 2023 Red Hat
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import {ReactWrapperElement} from '../react-wrapper.js';
17
+ import {ChartDonut} from '@patternfly/react-charts/victory';
18
+
19
+ export class ChartDonutWebComponent extends ReactWrapperElement {
20
+
21
+ getReactComponent() {
22
+ return [ChartDonut, {}];
23
+ }
24
+ }
25
+
26
+ customElements.define('pfj-chart-donut', ChartDonutWebComponent);