oolib 2.129.2 → 2.129.4

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.
@@ -130,22 +130,22 @@ var PercentBarChart = function (_a) {
130
130
  bottom: 0,
131
131
  } },
132
132
  react_1.default.createElement(recharts_1.XAxis, { hide: true, type: "number" }),
133
- react_1.default.createElement(recharts_1.YAxis, { hide: true, type: "category", width: 250, dataKey: labelPath }),
133
+ react_1.default.createElement(recharts_1.YAxis, { hide: true, type: "category", width: 250, dataKey: 'name' }),
134
134
  react_1.default.createElement(recharts_1.Bar, __assign({ radius: [2, 4, 4, 2], style: onClick ? { cursor: "pointer" } : {}, dataKey: "percentage" }, (onClick
135
135
  ? {
136
- onMouseOver: function (args) { return setActiveBar(args[labelPath]); },
136
+ onMouseOver: function (args) { return setActiveBar(args['name']); },
137
137
  onMouseOut: function () { return setActiveBar(undefined); },
138
138
  onMouseDown: function (args) {
139
- setActiveBar(args[labelPath]);
140
- onClick(args[labelPath]);
139
+ setActiveBar(args['name']);
140
+ onClick(args['name']);
141
141
  },
142
142
  }
143
143
  : {})),
144
- react_1.default.createElement(recharts_1.LabelList, { dataKey: labelPath, position: "top", content: function (props) {
144
+ react_1.default.createElement(recharts_1.LabelList, { dataKey: 'name', position: "top", content: function (props) {
145
145
  return renderCustomizedLabel({
146
146
  y: props.y,
147
147
  value: props.value,
148
- opacity: changeBarOpacityFn(props[labelPath]),
148
+ opacity: changeBarOpacityFn(props['name']),
149
149
  });
150
150
  } }),
151
151
  react_1.default.createElement(recharts_1.LabelList, { dataKey: "percentage_count", offset: 0, content: function (props) {
@@ -157,9 +157,9 @@ var PercentBarChart = function (_a) {
157
157
  value: props.value, //here value is the percentage
158
158
  showCount: showCount,
159
159
  suffix: valueSuffix,
160
- opacity: changeBarOpacityFn(props[labelPath]),
160
+ opacity: changeBarOpacityFn(props['name']),
161
161
  });
162
162
  } }),
163
- data.map(function (entry, index) { return (react_1.default.createElement(recharts_1.Cell, { opacity: changeBarOpacityFn(entry[labelPath]), key: "cell-".concat(index), height: configs.barHeight, fill: entry.color })); })))))));
163
+ data.map(function (entry, index) { return (react_1.default.createElement(recharts_1.Cell, { opacity: changeBarOpacityFn(entry['name']), key: "cell-".concat(index), height: configs.barHeight, fill: entry.color })); })))))));
164
164
  };
165
165
  exports.PercentBarChart = PercentBarChart;
@@ -92,6 +92,7 @@ var _EXPORTS_1 = require("../../utils/_EXPORTS");
92
92
  var LoadersAndProgress_1 = require("../LoadersAndProgress");
93
93
  var OKELink_1 = require("../OKELink");
94
94
  var utilsOolib_1 = require("../../utilsOolib");
95
+ var styled_components_1 = require("styled-components");
95
96
  var DisplayIcon = function (_a) {
96
97
  var icon = _a.icon, onClick = _a.onClick, size = _a.size;
97
98
  var IconComp = icons_1.icons[icon];
@@ -102,7 +103,8 @@ var TextInput = function (props) {
102
103
  actionBtn = props.actionBtn, clearBtn = props.clearBtn, className = props.className, maxLength = props.maxLength, DEPRECATED_maxNumLimiter = props.maxNumLimiter, forceFocus = props.forceFocus, //sometimes, when some other elem is clicked, we wanna trigger focus on the textinput. eg. when on mobile, the search icon is clicked on the listingpage
103
104
  _d = props.validateOnlyOnBlur, //sometimes, when some other elem is clicked, we wanna trigger focus on the textinput. eg. when on mobile, the search icon is clicked on the listingpage
104
105
  validateOnlyOnBlur = _d === void 0 ? false : _d, //for example, in the login form we want validation to only run, once the text input is blurred. else it can be irritating
105
- _validationStatus = props.validationStatus, _e = props.displayValidationMsg, displayValidationMsg = _e === void 0 ? true : _e;
106
+ _validationStatus = props.validationStatus, _e = props.displayValidationMsg, displayValidationMsg = _e === void 0 ? true : _e, content = props.content, passValidationErrorToFormValidation = props.passValidationErrorToFormValidation;
107
+ var theme = (0, styled_components_1.useTheme)();
106
108
  var _f = (0, react_1.useState)(_validationStatus), validationStatus = _f[0], setValidationStatus = _f[1];
107
109
  (0, react_1.useEffect)(function () {
108
110
  setValidationStatus(_validationStatus);
@@ -112,9 +114,10 @@ var TextInput = function (props) {
112
114
  var actionBtnEnabaled = !!value && (type !== "url" ? true : (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success");
113
115
  var clearBtnEnabled = !!value && (type !== "url" ? true : (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success");
114
116
  var handleValidate = function (e, onBlur) { return __awaiter(void 0, void 0, void 0, function () {
115
- var value, res;
116
- return __generator(this, function (_a) {
117
- switch (_a.label) {
117
+ var value, res, validationPlugin, pluginResponse;
118
+ var _a, _b;
119
+ return __generator(this, function (_c) {
120
+ switch (_c.label) {
118
121
  case 0:
119
122
  onBlur && onBlur(e);
120
123
  value = e.target.value;
@@ -125,10 +128,27 @@ var TextInput = function (props) {
125
128
  if (!handleValidation) return [3 /*break*/, 2];
126
129
  return [4 /*yield*/, handleValidation(value)];
127
130
  case 1:
128
- res = _a.sent();
131
+ res = _c.sent();
129
132
  setValidationStatus(res);
130
- _a.label = 2;
131
- case 2: return [2 /*return*/];
133
+ _c.label = 2;
134
+ case 2:
135
+ validationPlugin = (theme.componentPluginConfigs &&
136
+ theme.getTenant &&
137
+ ((_b = (_a = theme.componentPluginConfigs[getTenant()]) === null || _a === void 0 ? void 0 : _a.TextInput) === null || _b === void 0 ? void 0 : _b.validationPlugin));
138
+ if (!validationPlugin) return [3 /*break*/, 4];
139
+ setValidationStatus('loading');
140
+ return [4 /*yield*/, validationPlugin({
141
+ value: value,
142
+ content: content,
143
+ passValidationErrorToFormValidation: passValidationErrorToFormValidation,
144
+ })];
145
+ case 3:
146
+ pluginResponse = _c.sent();
147
+ console.log({ pluginResponse: pluginResponse });
148
+ if (pluginResponse)
149
+ return [2 /*return*/, pluginResponse];
150
+ _c.label = 4;
151
+ case 4: return [2 /*return*/];
132
152
  }
133
153
  });
134
154
  }); };
@@ -10,16 +10,16 @@ exports.default = {
10
10
  title: "Components/PercentBarChart",
11
11
  };
12
12
  var data = [
13
- { name: "Great food", value: 72.3, Type: 0 },
14
- { name: "Great Ambience", value: 10.1, Type: 1 },
15
- { name: "Great Music", value: 9.87, Type: 2 },
16
- { name: "Great Cocktails", value: 5.63, Type: 3 },
13
+ { display: "Great food", value: 72, },
14
+ { display: "Great Ambience", value: 10, },
15
+ { display: "Great Music", value: 9, },
16
+ { display: "Great Cocktails", value: 5, },
17
17
  ];
18
18
  var PercentBarChart_ = function (args) {
19
19
  var handleBarClick = function (name) {
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, labelPath: "name", valuePath: "value", title: "This is PercentBarChart representing the data" })));
23
+ react_1.default.createElement(PercentBarChart_1.PercentBarChart, { data: data, labelPath: "display", valuePath: "value", title: "This is PercentBarChart representing the data" })));
24
24
  };
25
25
  exports.PercentBarChart_ = PercentBarChart_;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.129.2",
3
+ "version": "2.129.4",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",