oolib 2.119.0 → 2.119.2

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.
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
- export declare const PercentBarChart: ({ data: _data, title, valuePath, display, onClick, colors }: {
2
+ export declare const PercentBarChart: ({ data: _data, title, valuePath, labelPath, onClick, colors }: {
3
3
  data: any;
4
4
  valuePath: string;
5
+ labelPath: string;
5
6
  title?: string;
6
- display: string;
7
7
  onClick?: (name: string) => void;
8
8
  colors?: string[];
9
9
  }) => React.JSX.Element;
@@ -78,15 +78,15 @@ var _dataSample = [
78
78
  { name: "AA+", value: 5.63, Type: 3 },
79
79
  ];
80
80
  var PercentBarChart = function (_a) {
81
- var _b = _a.data, _data = _b === void 0 ? _dataSample : _b, title = _a.title, _c = _a.valuePath, valuePath = _c === void 0 ? "value" : _c, _d = _a.display, display = _d === void 0 ? "name" : _d, onClick = _a.onClick, _e = _a.colors, colors = _e === void 0 ? chartColors : _e;
81
+ var _b = _a.data, _data = _b === void 0 ? _dataSample : _b, title = _a.title, _c = _a.valuePath, valuePath = _c === void 0 ? "value" : _c, _d = _a.labelPath, labelPath = _d === void 0 ? "name" : _d, onClick = _a.onClick, _e = _a.colors, colors = _e === void 0 ? chartColors : _e;
82
82
  var data = (0, react_1.useMemo)(function () {
83
83
  var finalData = __spreadArray([], _data, true);
84
- finalData = finalData.map(function (d, i) { return (__assign(__assign({}, d), { value: d[valuePath], name: d[display], color: (colors)[i % (colors).length] })); });
84
+ finalData = finalData.map(function (d, i) { return (__assign(__assign({}, d), { value: d[valuePath], name: d[labelPath], color: (colors)[i % (colors).length] })); });
85
85
  finalData.sort(function (a, b) {
86
86
  return Number(b.value || 0) - Number(a.value || 0);
87
87
  });
88
88
  return finalData;
89
- }, [_data, display, valuePath]);
89
+ }, [_data, labelPath, valuePath]);
90
90
  var _f = (0, react_1.useState)(undefined), activeBar = _f[0], setActiveBar = _f[1];
91
91
  var changeBarOpacityFn = function (name) {
92
92
  return activeBar && activeBar !== name ? 0.4 : 1;
@@ -102,16 +102,16 @@ var PercentBarChart = function (_a) {
102
102
  bottom: 0,
103
103
  } },
104
104
  react_1.default.createElement(recharts_1.XAxis, { hide: true, type: "number" }),
105
- react_1.default.createElement(recharts_1.YAxis, { hide: true, type: "category", width: 250, dataKey: display }),
106
- react_1.default.createElement(recharts_1.Bar, { style: { cursor: "pointer" }, dataKey: "value", unit: "%", onMouseOver: function (args) { return setActiveBar(args[display]); }, onMouseOut: function () { return setActiveBar(undefined); }, onMouseDown: function (args) {
107
- setActiveBar(args[display]);
108
- onClick(args[display]);
105
+ react_1.default.createElement(recharts_1.YAxis, { hide: true, type: "category", width: 250, dataKey: labelPath }),
106
+ react_1.default.createElement(recharts_1.Bar, { style: { cursor: "pointer" }, dataKey: "value", unit: "%", onMouseOver: function (args) { return setActiveBar(args[labelPath]); }, onMouseOut: function () { return setActiveBar(undefined); }, onMouseDown: function (args) {
107
+ setActiveBar(args[labelPath]);
108
+ onClick(args[labelPath]);
109
109
  } },
110
- react_1.default.createElement(recharts_1.LabelList, { dataKey: display, position: "top", content: function (props) {
110
+ react_1.default.createElement(recharts_1.LabelList, { dataKey: labelPath, position: "top", content: function (props) {
111
111
  return renderCustomizedLabel({
112
112
  y: props.y,
113
113
  value: props.value,
114
- opacity: changeBarOpacityFn(props[display]),
114
+ opacity: changeBarOpacityFn(props[labelPath]),
115
115
  });
116
116
  } }),
117
117
  react_1.default.createElement(recharts_1.LabelList, { dataKey: "value", offset: 0, content: function (props) {
@@ -121,9 +121,9 @@ var PercentBarChart = function (_a) {
121
121
  height: props.height,
122
122
  value: props.value,
123
123
  suffix: "%",
124
- opacity: changeBarOpacityFn(props[display]),
124
+ opacity: changeBarOpacityFn(props[labelPath]),
125
125
  });
126
126
  } }),
127
- data.map(function (entry, index) { return (react_1.default.createElement(recharts_1.Cell, { opacity: changeBarOpacityFn(entry[display]), key: "cell-".concat(index), height: 30, fill: entry.color })); })))))));
127
+ data.map(function (entry, index) { return (react_1.default.createElement(recharts_1.Cell, { opacity: changeBarOpacityFn(entry[labelPath]), key: "cell-".concat(index), height: 30, fill: entry.color })); })))))));
128
128
  };
129
129
  exports.PercentBarChart = PercentBarChart;
@@ -25,10 +25,11 @@ var CheckboxInput = function (_a) {
25
25
  return (react_1.default.createElement(CheckboxButton_1.CheckboxButton, { isSelected: isSelected, disabled: disabled, invert: invert, S: S, className: 'btn',
26
26
  disabled: options.disabled || disabled }));
27
27
  };
28
- var genCheckSquare = function () { return (react_1.default.createElement(CheckSquare, { size: S ? 22.5 : 26, color: invert ? invertGreen : green, style: {
29
- margin: '-7px -2.8px -7px -3.2px',
30
- flexShrink: 0
31
- } })); };
28
+ var genCheckSquare = function () { return (react_1.default.createElement("div", { style: { flexShrink: 0 } },
29
+ react_1.default.createElement(CheckSquare, { size: S ? 22.5 : 26, color: invert ? invertGreen : green, style: {
30
+ margin: '-7px -2.8px -7px -3.2px',
31
+ flexShrink: 0
32
+ } }))); };
32
33
  var genXSquare = function () { return (react_1.default.createElement(XSquare, { size: S ? 21.5 : 26, color: invert ? invertRed : red, style: {
33
34
  margin: '-7px -2.8px -7px -3.2px',
34
35
  flexShrink: 0
@@ -36,14 +37,14 @@ var CheckboxInput = function (_a) {
36
37
  return option.loading
37
38
  ? react_1.default.createElement(TextLoader_1.TextLoader, { style: { width: "8rem", height: "1.5rem" } })
38
39
  : inputStyle === 'tagSelect' ? (react_1.default.createElement(Tags_1.TagSelect, { isSelected: isSelected, invert: invert, disabled: disabled, onClick: function () { return !disabled && onClick(isSelected, option); }, display: option.display, value: option.value, style: { alignSelf: 'flex-start' } })) : (react_1.default.createElement(styled_1.StyledOption, { rightWrongResult: rightWrongResult, isSelected: isSelected, disabled: disabled, invert: invert, S: S, onClick: function () { return !rightWrongResult && !disabled && onClick && onClick(isSelected, option); } },
39
- rightWrongResult
40
+ react_1.default.createElement("div", { style: { flexShrink: 0 } }, rightWrongResult
40
41
  ? ["markCorrect", "revealCorrect"].includes(markingCommand)
41
42
  ? genCheckSquare()
42
43
  : markingCommand === 'markWrong'
43
44
  ? genXSquare()
44
45
  : genCheckboxButton({ disabled: true }) //else rightWrongResult has come in, but this doesnt have to be marked right or wrong
45
46
  : genCheckboxButton() // rightWrongResult has not come in. so gen normal radio button
46
- ,
47
+ ),
47
48
  react_1.default.createElement(SuitableTypo, { bold: rightWrongResult && isSelected, color: disabled && greyColor40, invert: invert }, option.display)));
48
49
  };
49
50
  exports.CheckboxInput = CheckboxInput;
@@ -20,6 +20,6 @@ var PercentBarChart_ = function (args) {
20
20
  console.log("Bar clicked: ".concat(name));
21
21
  };
22
22
  return (react_1.default.createElement("div", null,
23
- react_1.default.createElement(PercentBarChart_1.PercentBarChart, { data: data, display: "name", valuePath: "value", title: "This is PercentBarChart representing the data", onClick: handleBarClick })));
23
+ react_1.default.createElement(PercentBarChart_1.PercentBarChart, { data: data, labelPath: "name", valuePath: "value", title: "This is PercentBarChart representing the data", onClick: handleBarClick })));
24
24
  };
25
25
  exports.PercentBarChart_ = PercentBarChart_;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.119.0",
3
+ "version": "2.119.2",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",