-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from SharePoint/dev
Merge for 1.9.0 release
- Loading branch information
Showing
24 changed files
with
308 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const version: string = "1.8.0"; | ||
export const version: string = "1.9.0"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/propertyFields/collectionData/collectionNumberField/CollectionNumberField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import * as React from 'react'; | ||
import styles from '../PropertyFieldCollectionDataHost.module.scss'; | ||
import { ICollectionNumberFieldProps, ICollectionNumberFieldState } from '.'; | ||
import { ICustomCollectionField } from '..'; | ||
|
||
export class CollectionNumberField extends React.Component<ICollectionNumberFieldProps, ICollectionNumberFieldState> { | ||
constructor(props: ICollectionNumberFieldProps) { | ||
super(props); | ||
|
||
this.state = { | ||
errorMessage: '' | ||
}; | ||
} | ||
|
||
/** | ||
* componentWillMount lifecycle hook | ||
*/ | ||
public componentWillMount(): void { | ||
this.valueChange(this.props.field, this.props.item[this.props.field.id]); | ||
} | ||
|
||
/** | ||
* Value change event handler | ||
* | ||
* @param field | ||
* @param value | ||
*/ | ||
private valueChange = async (field: ICustomCollectionField, value: string | number) => { | ||
const inputVal = typeof value === "string" ? parseInt(value) : value; | ||
const validation = await this.props.fValidation(field, inputVal); | ||
// Update the error message | ||
this.setState({ | ||
errorMessage: validation | ||
}); | ||
} | ||
|
||
/** | ||
* Default React render method | ||
*/ | ||
public render(): React.ReactElement<ICollectionNumberFieldProps> { | ||
return ( | ||
<div className={`${styles.numberField} ${this.state.errorMessage ? styles.invalidField : ""}`}> | ||
<input type="number" | ||
role="spinbutton" | ||
placeholder={this.props.field.placeholder || this.props.field.title} | ||
aria-valuemax="99999" | ||
aria-valuemin="-999999" | ||
aria-valuenow={this.props.item[this.props.field.id] || ''} | ||
aria-invalid={!!this.state.errorMessage} | ||
value={this.props.item[this.props.field.id] || ''} | ||
onChange={(ev) => this.valueChange(this.props.field, ev.target.value)} /> | ||
</div> | ||
); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/propertyFields/collectionData/collectionNumberField/ICollectionNumberFieldProps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ICustomCollectionField } from ".."; | ||
|
||
export interface ICollectionNumberFieldProps { | ||
field: ICustomCollectionField; | ||
item: any; | ||
|
||
fOnValueChange: (fieldId: string, value: any) => void; | ||
fValidation: (field: ICustomCollectionField, value: any) => Promise<string>; | ||
} |
3 changes: 3 additions & 0 deletions
3
src/propertyFields/collectionData/collectionNumberField/ICollectionNumberFieldState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface ICollectionNumberFieldState { | ||
errorMessage: string; | ||
} |
3 changes: 3 additions & 0 deletions
3
src/propertyFields/collectionData/collectionNumberField/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './CollectionNumberField'; | ||
export * from './ICollectionNumberFieldProps'; | ||
export * from './ICollectionNumberFieldState'; |
Oops, something went wrong.