sibvisions / reactUI

A generic react UI for JVx applications.
Apache License 2.0
3 stars 2 forks source link

number editor not working #479

Closed rjahn closed 4 months ago

rjahn commented 5 months ago

Open Contacts(DB) of features user

Click on a record and:

UIEditorNumber.tsx:415 Warning: Failed prop type: Invalid prop `value` of type `string` supplied to `InputNumber`, expected `number`.
    at InputNumber (http://localhost:3000/static/js/bundle.js:15970:5)
    at UIEditorNumber (http://localhost:3000/static/js/bundle.js:17234:66)
    at Editor (http://localhost:3000/static/js/bundle.js:36981:13)
    at CellEditorWrapper (http://localhost:3000/static/js/bundle.js:13383:222)
    at div
    at FormLayout (http://localhost:3000/static/js/bundle.js:21140:72)
    at Layout (http://localhost:3000/static/js/bundle.js:22326:13)
    at div
    at div
    at UIGroupPanel (http://localhost:3000/static/js/bundle.js:25254:160)
    at div
    at FormLayout (http://localhost:3000/static/js/bundle.js:21140:72)
    at Layout (http://localhost:3000/static/js/bundle.js:22326:13)
    at div
    at UIPanel (http://localhost:3000/static/js/bundle.js:25546:160)
    at div
    at BorderLayout (http://localhost:3000/static/js/bundle.js:20236:5)
    at Layout (http://localhost:3000/static/js/bundle.js:22326:13)
    at div
    at UIScrollPanel (http://localhost:3000/static/js/bundle.js:26112:160)
    at div
    at BorderLayout (http://localhost:3000/static/js/bundle.js:20236:5)
    at Layout (http://localhost:3000/static/js/bundle.js:22326:13)
    at div
    at UIPanel (http://localhost:3000/static/js/bundle.js:25546:160)
    at div
    at BorderLayout (http://localhost:3000/static/js/bundle.js:20236:5)
    at Layout (http://localhost:3000/static/js/bundle.js:22326:13)
    at div
    at UIPanel (http://localhost:3000/static/js/bundle.js:25546:160)
    at div
    at ResizeHandler (http://localhost:3000/static/js/bundle.js:5572:68)
    at WorkScreen (http://localhost:3000/static/js/bundle.js:6457:68)
    at ScreenManager (http://localhost:3000/static/js/bundle.js:5847:68)
    at ResizeProvider (http://localhost:3000/static/js/bundle.js:36070:20)
    at div
    at div
    at UIManager (http://localhost:3000/static/js/bundle.js:6045:64)
    at Route (http://localhost:3000/static/js/bundle.js:257226:29)
    at Switch (http://localhost:3000/static/js/bundle.js:257395:29)
    at PopupContextProvider (http://localhost:3000/static/js/bundle.js:38993:5)
    at AppWrapper (http://localhost:3000/static/js/bundle.js:74:68)
    at ErrorBoundary (http://localhost:3000/static/js/bundle.js:252795:37)
    at ReactUI (http://localhost:3000/static/js/bundle.js:638:68)
    at EmbedProvider (http://localhost:3000/static/js/bundle.js:35980:18)
    at AppProvider (http://localhost:3000/static/js/bundle.js:35305:76)
    at Router (http://localhost:3000/static/js/bundle.js:256898:30)
    at HashRouter (http://localhost:3000/static/js/bundle.js:255629:35)
    at MiddleMan (http://localhost:3000/static/js/bundle.js:387:29)
printWarning @ react-jsx-dev-runtime.development.js:117
error @ react-jsx-dev-runtime.development.js:93
checkPropTypes @ react-jsx-dev-runtime.development.js:620
validatePropTypes @ react-jsx-dev-runtime.development.js:1072
jsxWithValidation @ react-jsx-dev-runtime.development.js:1192
UIEditorNumber @ UIEditorNumber.tsx:415
renderWithHooks @ react-dom.development.js:14985
mountIndeterminateComponent @ react-dom.development.js:17811
beginWork @ react-dom.development.js:19049
beginWork$1 @ react-dom.development.js:23940
performUnitOfWork @ react-dom.development.js:22776
workLoopSync @ react-dom.development.js:22707
renderRootSync @ react-dom.development.js:22670
performSyncWorkOnRoot @ react-dom.development.js:22293
(anonymous) @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
scheduleUpdateOnFiber @ react-dom.development.js:21893
dispatchAction @ react-dom.development.js:16139
(anonymous) @ useComponents.tsx:245
(anonymous) @ ContentStore.tsx:331
updateContent @ ContentStore.tsx:331
openScreen @ Server.ts:412
generic @ Server.ts:459
responseHandler @ BaseServer.ts:515
responseHandler @ Server.ts:267
(anonymous) @ BaseServer.ts:331
Promise.then (async)
(anonymous) @ BaseServer.ts:331
sendRequest @ BaseServer.ts:212
reqFunc @ BaseServer.ts:385
advanceRequestQueue @ BaseServer.ts:418
(anonymous) @ BaseServer.ts:420
Promise.finally (async)
advanceRequestQueue @ BaseServer.ts:418
(anonymous) @ BaseServer.ts:420
Promise.finally (async)
advanceRequestQueue @ BaseServer.ts:418
(anonymous) @ BaseServer.ts:420
Promise.finally (async)
advanceRequestQueue @ BaseServer.ts:418
(anonymous) @ BaseServer.ts:395
sendRequest @ BaseServer.ts:212
onFocusGained @ FocusUtil.ts:30
handleFocusGained @ FocusUtil.ts:54
(anonymous) @ UITable.tsx:1483
setTimeout (async)
onFocus @ UITable.tsx:1481
callCallback @ react-dom.development.js:3945
invokeGuardedCallbackDev @ react-dom.development.js:3994
invokeGuardedCallback @ react-dom.development.js:4056
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:4070
executeDispatch @ react-dom.development.js:8243
processDispatchQueueItemsInOrder @ react-dom.development.js:8275
processDispatchQueue @ react-dom.development.js:8288
dispatchEventsForPlugins @ react-dom.development.js:8299
(anonymous) @ react-dom.development.js:8508
batchedEventUpdates$1 @ react-dom.development.js:22396
batchedEventUpdates @ react-dom.development.js:3745
dispatchEventForPluginEventSystem @ react-dom.development.js:8507
attemptToDispatchEvent @ react-dom.development.js:6005
dispatchEvent @ react-dom.development.js:5924
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
discreteUpdates$1 @ react-dom.development.js:22413
discreteUpdates @ react-dom.development.js:3756
dispatchDiscreteEvent @ react-dom.development.js:5889
useProperties.tsx:39 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
    at UIPanel (http://localhost:3000/static/js/bundle.js:25546:160)
gimmixAT commented 5 months ago

should be fixed in master_04_03_2024 via e140346c9524d369b2dd2c7152e5df1cfc3f1cbf & 7ed0484d2db319675243f48f9e9305da45615dfc

rjahn commented 5 months ago

exception is gone!

Another console log occurs if you press a letter instead of a digit:

UIEditorNumber.tsx:355 Uncaught SyntaxError: Cannot convert 1456n to a BigInt (at UIEditorNumber.tsx:355:1)
    at BigInt (<anonymous>)
    at getDecimalValue (UIEditorNumber.tsx:355:1)
    at isExceedingDecimalLength (UIEditorNumber.tsx:364:1)
    at HTMLInputElement.<anonymous> (UIEditorNumber.tsx:377:1)

We shouldn't throw an error in this case because no problem occurs.

gimmixAT commented 5 months ago

in which branch? this should actually be already fixed in both master & master_04_03 by 7ed0484d2db319675243f48f9e9305da45615dfc and 85af4bcf973f46243eb1ad9fc4d7a5795247e946 respectively

rjahn commented 5 months ago

hm... the conversion problem is not reproducable. I tried with both branches. It occured with master_04_03 branch. Maybe a caching problem... I'll keep an eye on cache in future tests.

There's still a problem with numbers:

Enter 1 into the field social security nr and leave the field -> 0001 (the field is a max 4 digit number)

Enter 2345 behind 1 -> endless typing possible. Enter 2345 behind first 0 -> no endless typing possible Enter 2345 behind second 0 -> 3 leading 0 occur and endless typing possible.

There's something wrong with number of allowed digits?

The metadata controls the digit count, but client implementation is buggy :(

gimmixAT commented 5 months ago

The amount of allowed digits should be handled better now. -> 8340d7288ea68bcf3712064b79216e6e030a40b6 One problem that still exists and will be a tricky to solve is that negative values with leading zeros don't really work the way the formatting is currently implemented. They are added as a prefix to the PR NumberInput but that results in numbers like -13 being displayed as 0-13

rjahn commented 5 months ago

All solutions are welcome.

gimmixAT commented 4 months ago

I reworked the number input a bit and it seems to be working now. Are there any Numberinputs other than the SSNr I could test? Especially with decimal numbers and / or specific formats?

rjahn commented 4 months ago

much better. Only thing is that it looks like an input mask if you enter 1 and 0001 is shown. The output format is good but is it possible to hide the format while editing?

gimmixAT commented 4 months ago

formatting is now hidden during editing -> d5625ed8ec334188e96e42ff95d7c392f479fc83