@pnkx-lib/ui 1.9.258 → 1.9.259
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/es/fields/Input.js +31 -18
- package/package.json +1 -1
package/es/fields/Input.js
CHANGED
|
@@ -1250,18 +1250,40 @@ const Input = (props) => {
|
|
|
1250
1250
|
const errorMessage = get(errors, name)?.message;
|
|
1251
1251
|
const inputRef = useRef(null);
|
|
1252
1252
|
const [isComposing, setIsComposing] = useState(false);
|
|
1253
|
-
console.log(" isComposing:", isComposing);
|
|
1254
1253
|
//! Function
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1254
|
+
const handleChange = useCallback(
|
|
1255
|
+
(e) => {
|
|
1256
|
+
onChange?.(e);
|
|
1257
|
+
afterOnChange?.(e.target.value);
|
|
1258
|
+
},
|
|
1259
|
+
[onChange, afterOnChange, isComposing]
|
|
1260
|
+
);
|
|
1261
|
+
const handleCompositionStart = useCallback(() => {
|
|
1262
|
+
setIsComposing(true);
|
|
1263
|
+
}, []);
|
|
1264
|
+
const handleCompositionEnd = useCallback(
|
|
1265
|
+
(e) => {
|
|
1266
|
+
setIsComposing(false);
|
|
1267
|
+
console.log("vvvvv", e.currentTarget.value);
|
|
1268
|
+
const syntheticEvent = {
|
|
1269
|
+
target: {
|
|
1270
|
+
value: e.currentTarget.value,
|
|
1271
|
+
name
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
console.log(" syntheticEvent:", syntheticEvent);
|
|
1260
1275
|
setTimeout(() => {
|
|
1261
|
-
|
|
1276
|
+
handleChange(syntheticEvent);
|
|
1262
1277
|
}, 0);
|
|
1263
|
-
|
|
1264
|
-
|
|
1278
|
+
const input = inputRef.current?.input;
|
|
1279
|
+
if (input) {
|
|
1280
|
+
setTimeout(() => {
|
|
1281
|
+
input.scrollLeft = input.scrollWidth;
|
|
1282
|
+
}, 0);
|
|
1283
|
+
}
|
|
1284
|
+
},
|
|
1285
|
+
[handleChange, name]
|
|
1286
|
+
);
|
|
1265
1287
|
const renderErrorMessage = () => {
|
|
1266
1288
|
if (!errorMessage) return null;
|
|
1267
1289
|
return /* @__PURE__ */ jsx(
|
|
@@ -1288,15 +1310,6 @@ const Input = (props) => {
|
|
|
1288
1310
|
}
|
|
1289
1311
|
return node;
|
|
1290
1312
|
};
|
|
1291
|
-
const handleChange = useCallback(
|
|
1292
|
-
(e) => {
|
|
1293
|
-
console.log(" ccccc:", e.target.value);
|
|
1294
|
-
if (isComposing) return;
|
|
1295
|
-
onChange?.(e);
|
|
1296
|
-
afterOnChange?.(e.target.value);
|
|
1297
|
-
},
|
|
1298
|
-
[onChange, afterOnChange, isComposing]
|
|
1299
|
-
);
|
|
1300
1313
|
const renderInput = () => {
|
|
1301
1314
|
const isNumberInput = type === "number" || type === "money";
|
|
1302
1315
|
if (isNumberInput) {
|