oolib 2.129.3 → 2.129.5

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.
@@ -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[theme.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
  }); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.129.3",
3
+ "version": "2.129.5",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",