oolib 2.129.5 → 2.129.6
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.
|
@@ -103,7 +103,7 @@ var TextInput = function (props) {
|
|
|
103
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
|
|
104
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
|
|
105
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
|
|
106
|
-
_validationStatus = props.validationStatus, _e = props.displayValidationMsg, displayValidationMsg = _e === void 0 ? true : _e, content = props.content, passValidationErrorToFormValidation = props.passValidationErrorToFormValidation;
|
|
106
|
+
_validationStatus = props.validationStatus, _e = props.displayValidationMsg, displayValidationMsg = _e === void 0 ? true : _e, content = props.content, passValidationErrorToFormValidation = props.passValidationErrorToFormValidation, plugin = props.plugin;
|
|
107
107
|
var theme = (0, styled_components_1.useTheme)();
|
|
108
108
|
var _f = (0, react_1.useState)(_validationStatus), validationStatus = _f[0], setValidationStatus = _f[1];
|
|
109
109
|
(0, react_1.useEffect)(function () {
|
|
@@ -115,9 +115,8 @@ var TextInput = function (props) {
|
|
|
115
115
|
var clearBtnEnabled = !!value && (type !== "url" ? true : (validationStatus === null || validationStatus === void 0 ? void 0 : validationStatus.type) === "success");
|
|
116
116
|
var handleValidate = function (e, onBlur) { return __awaiter(void 0, void 0, void 0, function () {
|
|
117
117
|
var value, res, validationPlugin, pluginResponse;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
switch (_c.label) {
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
121
120
|
case 0:
|
|
122
121
|
onBlur && onBlur(e);
|
|
123
122
|
value = e.target.value;
|
|
@@ -128,13 +127,13 @@ var TextInput = function (props) {
|
|
|
128
127
|
if (!handleValidation) return [3 /*break*/, 2];
|
|
129
128
|
return [4 /*yield*/, handleValidation(value)];
|
|
130
129
|
case 1:
|
|
131
|
-
res =
|
|
130
|
+
res = _a.sent();
|
|
132
131
|
setValidationStatus(res);
|
|
133
|
-
|
|
132
|
+
_a.label = 2;
|
|
134
133
|
case 2:
|
|
135
|
-
validationPlugin = (
|
|
136
|
-
theme.
|
|
137
|
-
|
|
134
|
+
validationPlugin = ((plugin === null || plugin === void 0 ? void 0 : plugin.validation) &&
|
|
135
|
+
theme.pluginConfigs &&
|
|
136
|
+
theme.pluginConfigs.tplBlockPlugins[plugin.validation]);
|
|
138
137
|
if (!validationPlugin) return [3 /*break*/, 4];
|
|
139
138
|
setValidationStatus('loading');
|
|
140
139
|
return [4 /*yield*/, validationPlugin({
|
|
@@ -143,11 +142,11 @@ var TextInput = function (props) {
|
|
|
143
142
|
passValidationErrorToFormValidation: passValidationErrorToFormValidation,
|
|
144
143
|
})];
|
|
145
144
|
case 3:
|
|
146
|
-
pluginResponse =
|
|
145
|
+
pluginResponse = _a.sent();
|
|
147
146
|
console.log({ pluginResponse: pluginResponse });
|
|
148
147
|
if (pluginResponse)
|
|
149
148
|
return [2 /*return*/, pluginResponse];
|
|
150
|
-
|
|
149
|
+
_a.label = 4;
|
|
151
150
|
case 4: return [2 /*return*/];
|
|
152
151
|
}
|
|
153
152
|
});
|