@autobusal/common 1.12.0 → 1.14.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/Viewer/types.ts +6 -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':
|
package/Viewer/types.ts
CHANGED
|
@@ -10,7 +10,12 @@ export interface ViewData {
|
|
|
10
10
|
rules?: string
|
|
11
11
|
notice?: string
|
|
12
12
|
url?: string
|
|
13
|
-
|
|
13
|
+
// Edited: Ferjolt Ozuni - Date: 2026-08-01
|
|
14
|
+
// Was `(id: 'string' | 'number')`, i.e. a value that had to literally BE
|
|
15
|
+
// the string "string" or "number" - almost certainly the type names typed
|
|
16
|
+
// by mistake where the types themselves were meant. Every caller was
|
|
17
|
+
// silently working around it by annotating its own parameter as `any`.
|
|
18
|
+
onChange?: (value: string | number) => void
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export interface ActionData {
|