Fix lint warnings
This commit is contained in:
parent
f0c3e8b4ff
commit
046feb1f98
|
@ -1,5 +1,4 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { autobind } from 'office-ui-fabric-react/lib/Utilities';
|
|
||||||
import { IFieldConfiguration } from './IFieldConfiguration';
|
import { IFieldConfiguration } from './IFieldConfiguration';
|
||||||
import { IListFormProps } from './IListFormProps';
|
import { IListFormProps } from './IListFormProps';
|
||||||
import { IListFormState } from './IListFormState';
|
import { IListFormState } from './IListFormState';
|
||||||
|
@ -233,8 +232,7 @@ class ListForm extends React.Component<IListFormProps, IListFormState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
private readSchema = async (listUrl: string, formType: ControlMode): Promise<void> => {
|
||||||
private async readSchema(listUrl: string, formType: ControlMode): Promise<void> {
|
|
||||||
try {
|
try {
|
||||||
if (!listUrl) {
|
if (!listUrl) {
|
||||||
this.setState({ ...this.state, isLoadingSchema: false, fieldsSchema: null, errors: [strings.ConfigureListMessage] });
|
this.setState({ ...this.state, isLoadingSchema: false, fieldsSchema: null, errors: [strings.ConfigureListMessage] });
|
||||||
|
@ -293,8 +291,7 @@ class ListForm extends React.Component<IListFormProps, IListFormState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
private readData = async (listUrl: string, formType: ControlMode, id?: number): Promise<void> => {
|
||||||
private async readData(listUrl: string, formType: ControlMode, id?: number): Promise<void> {
|
|
||||||
try {
|
try {
|
||||||
if ((formType === ControlMode.New) || !id) {
|
if ((formType === ControlMode.New) || !id) {
|
||||||
const data = this.state.fieldsSchema
|
const data = this.state.fieldsSchema
|
||||||
|
@ -333,8 +330,7 @@ class ListForm extends React.Component<IListFormProps, IListFormState> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
private valueChanged = async (fieldName: string, newValue: any) => {
|
||||||
private async valueChanged(fieldName: string, newValue: any) {
|
|
||||||
let schema = this.state.fieldsSchema.filter((item) => item.InternalName === fieldName)[0];
|
let schema = this.state.fieldsSchema.filter((item) => item.InternalName === fieldName)[0];
|
||||||
if (schema.Type == "User" || schema.Type === "UserMulti") {
|
if (schema.Type == "User" || schema.Type === "UserMulti") {
|
||||||
for (let i = 0; i < newValue.length; i++) {
|
for (let i = 0; i < newValue.length; i++) {
|
||||||
|
|
|
@ -24,8 +24,6 @@ export interface IDateFormFieldState {
|
||||||
export default class DateFormField extends React.Component<IDateFormFieldProps, IDateFormFieldState> {
|
export default class DateFormField extends React.Component<IDateFormFieldProps, IDateFormFieldState> {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this._createComboBoxHours = this._createComboBoxHours.bind(this);
|
|
||||||
this._createComboBoxMinutes = this._createComboBoxMinutes.bind(this);
|
|
||||||
this.state = {
|
this.state = {
|
||||||
date: null,
|
date: null,
|
||||||
hours: 0,
|
hours: 0,
|
||||||
|
@ -38,7 +36,7 @@ export default class DateFormField extends React.Component<IDateFormFieldProps,
|
||||||
if (this.props.value && prevProps.value != this.props.value) {
|
if (this.props.value && prevProps.value != this.props.value) {
|
||||||
let momentDate = this.props.fieldSchema.DisplayFormat == 1 ?
|
let momentDate = this.props.fieldSchema.DisplayFormat == 1 ?
|
||||||
moment(this.props.value, moment.localeData(this.props.locale).longDateFormat('LT')) :
|
moment(this.props.value, moment.localeData(this.props.locale).longDateFormat('LT')) :
|
||||||
moment(this.props.value, moment.localeData(this.props.locale).longDateFormat('L'))
|
moment(this.props.value, moment.localeData(this.props.locale).longDateFormat('L'));
|
||||||
this.setState({
|
this.setState({
|
||||||
hours: momentDate.hour(),
|
hours: momentDate.hour(),
|
||||||
minutes: momentDate.minute(),
|
minutes: momentDate.minute(),
|
||||||
|
@ -148,18 +146,18 @@ export default class DateFormField extends React.Component<IDateFormFieldProps,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _parseDateString(inputDate: string): Date {
|
private _parseDateString = (inputDate: string): Date => {
|
||||||
if (!inputDate) {
|
if (!inputDate) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let momentDate = this.props.fieldSchema.DisplayFormat == 1 ?
|
let momentDate = this.props.fieldSchema.DisplayFormat == 1 ?
|
||||||
moment(inputDate, moment.localeData(this.props.locale).longDateFormat('LT')) :
|
moment(inputDate, moment.localeData(this.props.locale).longDateFormat('LT')) :
|
||||||
moment(inputDate, moment.localeData(this.props.locale).longDateFormat('L'))
|
moment(inputDate, moment.localeData(this.props.locale).longDateFormat('L'));
|
||||||
return momentDate.toDate()
|
return momentDate.toDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _createComboBoxHours(): IComboBoxOption[] {
|
private _createComboBoxHours = (): IComboBoxOption[] => {
|
||||||
let results = new Array<IComboBoxOption>();
|
let results = new Array<IComboBoxOption>();
|
||||||
if (this.props.fieldSchema.HoursOptions) {
|
if (this.props.fieldSchema.HoursOptions) {
|
||||||
results = this.props.fieldSchema.HoursOptions.map((item, index) => {
|
results = this.props.fieldSchema.HoursOptions.map((item, index) => {
|
||||||
|
@ -171,7 +169,7 @@ export default class DateFormField extends React.Component<IDateFormFieldProps,
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
private _createComboBoxMinutes(): IComboBoxOption[] {
|
private _createComboBoxMinutes = (): IComboBoxOption[] => {
|
||||||
let results = new Array<IComboBoxOption>();
|
let results = new Array<IComboBoxOption>();
|
||||||
for (var i = 0; i < 60; i++) {
|
for (var i = 0; i < 60; i++) {
|
||||||
results.push({
|
results.push({
|
||||||
|
@ -181,5 +179,4 @@ export default class DateFormField extends React.Component<IDateFormFieldProps,
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue