Skip to content

Commit 3daff4e

Browse files
author
Tom German
committed
Fixing some warnings/clarity, and enum import issue on ControlsTest webpart.
1 parent ddf9154 commit 3daff4e

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/controls/dynamicForm/DynamicForm.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export class DynamicForm extends React.Component<
210210
}
211211
if (val.fieldType === "Number") {
212212
if (val.showAsPercentage) val.newValue /= 100;
213-
if (this.isEmptyNumOrString(val.newValue) && (val.minimumValue != null || val.maximumValue != null)) {
213+
if (this.isEmptyNumOrString(val.newValue) && (val.minimumValue !== null || val.maximumValue !== null)) {
214214
val.newValue = val.fieldDefaultValue = null;
215215
}
216216
if (!this.isEmptyNumOrString(val.newValue) && (isNaN(Number(val.newValue)) || (val.newValue < val.minimumValue) || (val.newValue > val.maximumValue))) {
@@ -345,7 +345,7 @@ export class DynamicForm extends React.Component<
345345
try {
346346
const contentTypeIdField = "ContentTypeId";
347347
//check if item contenttype is passed, then update the object with content type id, else, pass the object
348-
contentTypeId !== undefined && contentTypeId.startsWith("0x01") ? objects[contentTypeIdField] = contentTypeId : objects;
348+
if (contentTypeId !== undefined && contentTypeId.startsWith("0x01")) objects[contentTypeIdField] = contentTypeId;
349349
const iar = await sp.web.lists.getById(listId).items.add(objects);
350350
if (onSubmitted) {
351351
onSubmitted(
@@ -871,8 +871,8 @@ export class DynamicForm extends React.Component<
871871
return errorMessage;
872872
};
873873

874-
private isEmptyNumOrString(value: string | number) {
875-
if (value == null) return true;
874+
private isEmptyNumOrString(value: string | number): boolean {
875+
if (value === null) return true;
876876
if ((value?.toString().trim().length || 0) === 0) return true;
877877
}
878878
}

src/controls/fieldCollectionData/collectionDataItem/CollectionDataItem.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
366366

367367
private comboboxValidation = (field: ICustomCollectionField, selected: string[] | string): void => {
368368
let isValid = true;
369-
let validation = "";
369+
const validation = "";
370370

371371
if (field.required && (selected === null || selected.length === 0) ) {
372372
isValid = false;
@@ -567,7 +567,11 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
567567
required={field.required}
568568
disabled={disableFieldOnEdit}
569569
onChange={async (event, option, index, value) =>{
570-
field.multiSelect ? this.onValueChangedComboBoxMulti(field.id, option, value) : this.onValueChangedComboBoxSingle(field.id, option, value)
570+
if (field.multiSelect) {
571+
this.onValueChangedComboBoxMulti(field.id, option, value);
572+
} else {
573+
this.onValueChangedComboBoxSingle(field.id, option, value);
574+
}
571575
} }
572576

573577
/>;

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ import {
146146
import {
147147
PeoplePicker,
148148
PrincipalType
149-
} from "../../../PeoplePicker";
149+
} from "../../../controls/peoplepicker";
150150
import { Placeholder } from "../../../Placeholder";
151151
import {
152152
IProgressAction,

0 commit comments

Comments
 (0)