@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.
Files changed (2) hide show
  1. package/Viewer/Data.tsx +19 -1
  2. 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
- return <input type="checkbox" value={ 1 } defaultChecked={ Number(item.value) === 1 } { ...refs(item.name, Validate(String(item.rules), t)) } />;
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':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/common",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"