Skip to content

Commit a84f609

Browse files
Merge pull request #109 from SimplrJS/dev
Dev to master.
2 parents 81501b8 + 22b3caa commit a84f609

File tree

13 files changed

+66
-15
lines changed

13 files changed

+66
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<a href="https://github.com/SimplrJS">
3-
<img width="200" src="https://user-images.githubusercontent.com/7989797/27303346-34a5d6fa-5543-11e7-91e8-5b34287d0bc8.png" />
3+
<img width="200" src="https://user-images.githubusercontent.com/7989797/27446299-b93aa76c-5785-11e7-8ef6-475f858e3291.png" />
44
</a>
55
</div>
66
<h1 align="center">@simplr/react-forms</h1>

packages/react-forms-dom/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<a href="https://github.com/SimplrJS">
3-
<img width="200" src="https://user-images.githubusercontent.com/7989797/27303346-34a5d6fa-5543-11e7-91e8-5b34287d0bc8.png" />
3+
<img width="200" src="https://user-images.githubusercontent.com/7989797/27446299-b93aa76c-5785-11e7-8ef6-475f858e3291.png" />
44
</a>
55
</div>
66
<p align="center">

packages/react-forms-dom/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@simplr/react-forms-dom",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"description": "DOM components for @simplr/react-forms.",
55
"repository": "SimplrJS/react-forms",
66
"homepage": "https://github.com/SimplrJS/react-forms",

packages/react-forms-dom/src/abstractions/base-form-button.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import { Iterable } from "immutable";
44

55
import { BaseContainer, BaseContainerProps } from "@simplr/react-forms";
66

7-
export interface BaseFormButtonProps extends BaseContainerProps, React.HTMLProps<HTMLButtonElement> {
7+
export interface BaseFormButtonProps extends BaseContainerProps {
88
disableOnError?: boolean;
99
disableOnBusy?: boolean;
1010
disableOnPristine?: boolean;
1111
busy?: boolean;
1212
disabled?: boolean;
1313
busyClassName?: string;
14+
style?: React.CSSProperties;
15+
className?: string;
1416
}
1517

1618
export interface BaseFormButtonState {
@@ -117,5 +119,19 @@ export abstract class BaseFormButton<TProps extends BaseFormButtonProps, TState
117119
return className.length > 0 ? className : undefined;
118120
}
119121

122+
protected GetHTMLProps(props: BaseFormButtonProps): {} {
123+
const {
124+
disableOnError,
125+
disableOnBusy,
126+
disableOnPristine,
127+
busy,
128+
busyClassName,
129+
formId,
130+
...restProps
131+
} = props;
132+
133+
return restProps;
134+
}
135+
120136
public abstract render(): JSX.Element | null;
121137
}

packages/react-forms-dom/src/components/clear.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import {
55
BaseFormButtonProps,
66
BaseFormButtonStateRecord
77
} from "../abstractions/base-form-button";
8+
import { HTMLElementProps } from "../contracts/field";
89

9-
export interface ClearProps extends BaseFormButtonProps {
10+
export interface ClearProps extends BaseFormButtonProps, HTMLElementProps<HTMLButtonElement> {
1011
fieldIds?: string[];
12+
13+
ref?: React.Ref<Clear>;
1114
}
1215

1316
export class Clear extends BaseFormButton<ClearProps, BaseFormButtonStateRecord> {
@@ -20,14 +23,24 @@ export class Clear extends BaseFormButton<ClearProps, BaseFormButtonStateRecord>
2023
}
2124
}
2225

26+
protected GetHTMLProps(props: ClearProps): {} {
27+
const filteredProps = super.GetHTMLProps(props) as ClearProps;
28+
const {
29+
fieldIds,
30+
...restProps
31+
} = filteredProps;
32+
33+
return restProps;
34+
}
35+
2336
public render(): JSX.Element {
24-
// TODO: Pass all other props.
2537
return <button
2638
type="button"
2739
className={this.ClassName}
2840
style={this.InlineStyles}
2941
disabled={this.Disabled}
3042
onClick={this.OnButtonClick}
43+
{...this.GetHTMLProps(this.props) }
3144
>
3245
{this.props.children}
3346
</button>;

packages/react-forms-dom/src/components/fields-array.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ import {
44
FieldsArrayState as CoreState
55
} from "@simplr/react-forms/contracts";
66
import { BaseFieldsArray } from "@simplr/react-forms";
7+
import { HTMLElementProps } from "../contracts/field";
78

8-
export type FieldsArrayProps = CoreProps;
9+
export interface FieldsArrayProps extends CoreProps, HTMLElementProps<HTMLDivElement> {
10+
name: string;
11+
12+
ref?: React.Ref<FieldsArray>;
13+
}
914

1015
export type FieldsArrayState = CoreState;
1116

packages/react-forms-dom/src/components/fields-group.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ import {
44
FieldsGroupState as CoreState
55
} from "@simplr/react-forms/contracts";
66
import { BaseFieldsGroup } from "@simplr/react-forms";
7+
import { HTMLElementProps } from "../contracts/field";
78

8-
export type FieldsGroupProps = CoreProps;
9+
export interface FieldsGroupProps extends CoreProps, HTMLElementProps<HTMLDivElement> {
10+
name: string;
11+
12+
ref?: React.Ref<FieldsGroup>;
13+
}
914

1015
export type FieldsGroupState = CoreState;
1116

packages/react-forms-dom/src/components/reset.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import {
55
BaseFormButtonProps,
66
BaseFormButtonStateRecord
77
} from "../abstractions/base-form-button";
8+
import { HTMLElementProps } from "../contracts/field";
89

9-
export interface ResetProps extends BaseFormButtonProps {
10+
export interface ResetProps extends BaseFormButtonProps, HTMLElementProps<HTMLButtonElement> {
1011
fieldIds?: string[];
12+
13+
ref?: React.Ref<Reset>;
1114
}
1215

1316
export class Reset extends BaseFormButton<ResetProps, BaseFormButtonStateRecord> {
@@ -20,14 +23,24 @@ export class Reset extends BaseFormButton<ResetProps, BaseFormButtonStateRecord>
2023
}
2124
}
2225

26+
protected GetHTMLProps(props: ResetProps): {} {
27+
const filteredProps = super.GetHTMLProps(props) as ResetProps;
28+
const {
29+
fieldIds,
30+
...restProps
31+
} = filteredProps;
32+
33+
return restProps;
34+
}
35+
2336
public render(): JSX.Element {
24-
// TODO: Pass all other props.
2537
return <button
2638
type="button"
2739
className={this.ClassName}
2840
style={this.InlineStyles}
2941
disabled={this.Disabled}
3042
onClick={this.OnButtonClick}
43+
{...this.GetHTMLProps(this.props) }
3144
>
3245
{this.props.children}
3346
</button>;

packages/react-forms-validation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<a href="https://github.com/SimplrJS">
3-
<img width="200" src="https://user-images.githubusercontent.com/7989797/27303346-34a5d6fa-5543-11e7-91e8-5b34287d0bc8.png" />
3+
<img width="200" src="https://user-images.githubusercontent.com/7989797/27446299-b93aa76c-5785-11e7-8ef6-475f858e3291.png" />
44
</a>
55
</div>
66
<p align="center">

packages/react-forms-validation/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@simplr/react-forms-validation",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"description": "Validation library for @simplr/react-forms.",
55
"repository": "SimplrJS/react-forms",
66
"homepage": "https://github.com/SimplrJS/react-forms",

0 commit comments

Comments
 (0)