Skip to content

Commit

Permalink
fix RadioButtonGroup ts
Browse files Browse the repository at this point in the history
  • Loading branch information
FredericHeem committed Dec 19, 2024
1 parent 8ec7604 commit 91d5fbd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default (context: Context) => {
name: "check",
required: true,
value: inputState,
oninput: (event: any) => (inputState.val = event.target.value),
oninput: ({ target }) => (inputState.val = target.value),
})
)
),
Expand Down
7 changes: 5 additions & 2 deletions bau-ui/radioButtonGroup/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ declare module "@grucloud/bau-ui/radioButtonGroup" {
export type RadioButtonGroupProps = {
name: string;
value?: any;
oninput?: (event) => any;
oninput?: ({ target }: { target: HTMLInputElement }) => void;
radios: RadioItem[];
} & DefaultDesignProps;

type Component = import("../bau-ui").Component<RadioButtonGroupProps>;
type Component = import("../bau-ui").Component<
RadioButtonGroupProps,
HTMLInputElement
>;

export default function (context: any, option?: ComponentOption): Component;
}
20 changes: 8 additions & 12 deletions bau/examples/bau-ts-test/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,7 @@ const TestDerived = () => {
input({
placeholder: "Enter username",
value: inputState,
oninput: ({ target }: { target: HTMLInputElement }) =>
(inputState.val = target.value),
oninput: ({ target }) => (inputState.val = target.value),
}),
button(
{
Expand All @@ -532,8 +531,7 @@ const TestDerivedSideEffect = () => {
input({
placeholder: "Enter username",
value: inputState,
oninput: ({ target }: { target: HTMLInputElement }) =>
(inputState.val = target.value),
oninput: ({ target }) => (inputState.val = target.value),
})
);
};
Expand Down Expand Up @@ -753,8 +751,7 @@ const TestInputOninput = () => {
input({
placeholder: "Enter username",
value: inputState,
oninput: ({ target }: { target: HTMLInputElement }) =>
(inputState.val = target.value),
oninput: ({ target }) => (inputState.val = target.value),
}),
button(
{
Expand All @@ -776,8 +773,7 @@ const TestInputSearch = () => {
type: "search",
placeholder: "Search...",
value: inputState,
oninput: ({ target }: { target: HTMLInputElement }) =>
(inputState.val = target.value),
oninput: ({ target }) => (inputState.val = target.value),
}),
button(
{
Expand Down Expand Up @@ -820,7 +816,7 @@ const TestEventHandlingKeyUp = () => {
input({
type: "search",
size: 25,
onkeyup: ({ target, key }: { key: string; target: HTMLInputElement }) => {
onkeyup: ({ target, key }) => {
if (key == "Enter") {
alert(target.value);
}
Expand All @@ -838,8 +834,7 @@ const TestInputCheckboxOninput = () => {
input({
type: "checkbox",
checked: checkedState,
oninput: ({ target }: { target: HTMLInputElement }) =>
(checkedState.val = target.checked),
oninput: ({ target }) => (checkedState.val = target.checked),
}),
div("Is checked: ", () => (checkedState.val ? "Checked" : "Not Checked"))
);
Expand Down Expand Up @@ -1048,10 +1043,11 @@ input({
type: "text",
oninput: (event) => {
console.log(event.data);
console.log(event.target);
},
onchange: (event) => {
console.log(event.target.value);
}
},
});

const app = document.getElementById("app");
Expand Down
3 changes: 1 addition & 2 deletions doc/BauDerive.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ const TestDerived = () => {
input({
placeholder: "Enter username",
value: inputState,
oninput: ({ target }: { target: HTMLInputElement }) =>
(inputState.val = target.value),
oninput: ({ target }) => (inputState.val = target.value),
}),
button(
{
Expand Down
6 changes: 2 additions & 4 deletions doc/BauEventHandling.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ const TestInputOninput = () => {
input({
placeholder: "Enter username",
value: inputState,
oninput: ({ target }: { target: HTMLInputElement }) =>
(inputState.val = target.value),
oninput: ({ target }) => (inputState.val = target.value),
}),
button(
{
Expand Down Expand Up @@ -149,8 +148,7 @@ const TestInputCheckboxOninput = () => {
input({
type: "checkbox",
checked: checkedState,
oninput: ({ target }: { target: HTMLInputElement }) =>
(checkedState.val = target.checked),
oninput: ({ target }) => (checkedState.val = target.checked),
}),
div("Is checked: ", () => (checkedState.val ? "Checked" : "Not Checked"))
);
Expand Down

0 comments on commit 91d5fbd

Please sign in to comment.