@autobusal/common 1.12.0 → 1.13.0
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/Viewer/Data.tsx +19 -1
- package/package.json +1 -1
package/Viewer/Data.tsx
CHANGED
|
@@ -32,7 +32,25 @@ const Data = ({ id, item, refs, t, onUpdate }: Props): (JSX.Element | null) => {
|
|
|
32
32
|
|
|
33
33
|
switch (item.type) {
|
|
34
34
|
case 'checkbox':
|
|
35
|
-
|
|
35
|
+
// Edited: Ferjolt Ozuni - Date: 2026-08-01
|
|
36
|
+
// Honour item.onChange, which only 'select' supported before (see
|
|
37
|
+
// Items/Dropdown). Without it a checkbox could not drive which OTHER
|
|
38
|
+
// fields are shown - the caller's handler simply never fired - so a
|
|
39
|
+
// form like "enable analytics, then ask for the container id" had no
|
|
40
|
+
// way to reveal the second field. Reports the CHECKED state rather
|
|
41
|
+
// than the input's value attribute, which is the constant 1 and would
|
|
42
|
+
// tell the caller nothing.
|
|
43
|
+
return (
|
|
44
|
+
<input
|
|
45
|
+
type="checkbox"
|
|
46
|
+
value={ 1 }
|
|
47
|
+
defaultChecked={ Number(item.value) === 1 }
|
|
48
|
+
{ ...refs(item.name, {
|
|
49
|
+
...Validate(String(item.rules), t),
|
|
50
|
+
...(item.onChange ? { onChange: (event: any) => item.onChange!(event.target.checked ? 1 : 0) } : {})
|
|
51
|
+
}) }
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
36
54
|
|
|
37
55
|
case 'checkbox-list':
|
|
38
56
|
case 'checkbox-list-all':
|