Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.10.0 #1291

Merged
merged 38 commits into from
Aug 24, 2022
Merged

3.10.0 #1291

Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
612884e
Added the possibility to override field rendering for individual fiel…
Jul 10, 2022
5469bce
Fix compatibility with SPFX 1.15 and minor eslint issues
stevebeauge Jul 12, 2022
779278e
3.10.0
AJIXuMuK Jul 12, 2022
579c569
prep for next version
AJIXuMuK Jul 12, 2022
5a637a5
pre-commit
AJIXuMuK Jul 12, 2022
58aeee0
Merge remote-tracking branch 'upstream/dev' into features/upgrade-to-…
stevebeauge Jul 13, 2022
6e75c5a
new parameter and the parsing of parent information for terms.
ekapic-vista Jul 20, 2022
6c8278d
unused import removal
ekapic-vista Jul 20, 2022
540f45a
Merge branch 'fullMetadataTermPathDisplay' of https://github.com/ekap…
ekapic-vista Jul 20, 2022
b7c6ba0
typo
ekapic-vista Jul 20, 2022
732c2a0
clear date onchange trigger
milanholemans Jul 30, 2022
de4a4b6
Merge pull request #1259 from bjdekker/feat-dynamic-form-children
AJIXuMuK Aug 3, 2022
8a5838c
Merge pull request #1270 from ekapic/fullMetadataTermPathDisplay
AJIXuMuK Aug 3, 2022
80d2564
docs for field overrides
AJIXuMuK Aug 3, 2022
601f9c7
changelog
AJIXuMuK Aug 3, 2022
1260a3c
pre-commit
AJIXuMuK Aug 3, 2022
42a817e
bump lodash
AJIXuMuK Aug 3, 2022
6ac5358
bump moment
AJIXuMuK Aug 3, 2022
16c3046
changelog
AJIXuMuK Aug 3, 2022
c022ec6
pre-commit
AJIXuMuK Aug 3, 2022
89d25b7
Merge pull request #1278 from milanholemans/datepicker-onchangecleardate
AJIXuMuK Aug 3, 2022
8b7663d
bump terser
AJIXuMuK Aug 3, 2022
d841693
changelog
AJIXuMuK Aug 3, 2022
2ba9c17
pre-commit
AJIXuMuK Aug 3, 2022
efaf9b0
merge dev
AJIXuMuK Aug 3, 2022
ea4c4b1
in the process of updating to 1.15.2
AJIXuMuK Aug 4, 2022
e53f9a4
Theme Provider
AJIXuMuK Aug 5, 2022
f0c35c3
React no deprecated + TreeView.tsx
AJIXuMuK Aug 5, 2022
aef5604
wip
AJIXuMuK Aug 5, 2022
26ef7ef
wip
AJIXuMuK Aug 6, 2022
c1f3d70
wip
AJIXuMuK Aug 7, 2022
3d326b4
wip
AJIXuMuK Aug 7, 2022
4bec615
wip
AJIXuMuK Aug 8, 2022
86faaf5
wip
AJIXuMuK Aug 9, 2022
257c74a
all warnings are resolved
AJIXuMuK Aug 10, 2022
b41277c
Merge branch 'stevebeauge-features/upgrade-to-spfx-1.15' into dev
AJIXuMuK Aug 10, 2022
c0f1bbd
changelog
AJIXuMuK Aug 10, 2022
7bf34cb
pre-commit
AJIXuMuK Aug 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
AJIXuMuK committed Aug 8, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 4bec615512bd525fdae3df78054a318f8f3af687
1 change: 0 additions & 1 deletion src/controls/fieldCollectionData/FieldCollectionData.tsx
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@ import { Panel, PanelType } from 'office-ui-fabric-react/lib/components/Panel';
import { Label } from 'office-ui-fabric-react/lib/components/Label';
import { CollectionDataViewer } from './collectionDataViewer';
import { IFieldCollectionDataProps, IFieldCollectionDataState } from "./IFieldCollectionData";
// import FieldErrorMessage from '../errorMessage/FieldErrorMessage';
import * as strings from 'ControlStrings';
import { MessageBar, MessageBarType } from 'office-ui-fabric-react/lib/MessageBar';

15 changes: 12 additions & 3 deletions src/controls/fieldCollectionData/ICustomCollectionField.ts
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ export interface ICustomCollectionField {
/**
* Default value for the field
*/
defaultValue?: any;
defaultValue?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Field will start to validate after users stop typing for `deferredValidationTime` milliseconds. Default: 200ms.
*/
@@ -50,12 +50,21 @@ export interface ICustomCollectionField {
* - If valid, it returns empty string.
* - If invalid, the field will show a red border
*/
onGetErrorMessage?: (value: any, index: number, currentItem: any) => string | Promise<string>;
onGetErrorMessage?: (value: any, index: number, currentItem: any) => string | Promise<string>; // eslint-disable-line @typescript-eslint/no-explicit-any

/**
* Custom field rendering support
*/
onCustomRender?: (field: ICustomCollectionField, value: any, onUpdate: (fieldId: string, value: any) => void, item: any, rowUniqueId: string, onCustomFieldValidation: (fieldId: string, errorMessage: string) => void) => JSX.Element;
onCustomRender?: (
field: ICustomCollectionField,
/* eslint-disable @typescript-eslint/no-explicit-any */
value: any,
onUpdate: (fieldId: string, value: any) => void,
item: any,
/* eslint-enable @typescript-eslint/no-explicit-any */
rowUniqueId: string,
onCustomFieldValidation: (fieldId: string, errorMessage: string) => void
) => JSX.Element;
}

export enum CustomCollectionFieldType {
8 changes: 4 additions & 4 deletions src/controls/fieldCollectionData/IFieldCollectionData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ICustomCollectionField } from ".";
import { ICustomCollectionField } from "./ICustomCollectionField";

export interface IFieldCollectionDataProps {
/**
@@ -40,7 +40,7 @@ export interface IFieldCollectionDataProps {
/**
* The collection data value.
*/
value: any[];
value: any[]; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Specify if you want to enable sorting
*/
@@ -72,9 +72,9 @@ export interface IFieldCollectionDataProps {
/**
* Allows you to show Search Box and specify own filtering logic.
*/
executeFiltering?: (searchFilter: string, item: any) => boolean;
executeFiltering?: (searchFilter: string, item: any) => boolean; // eslint-disable-line @typescript-eslint/no-explicit-any

onChanged: (value: any[]) => void;
onChanged: (value: any[]) => void; // eslint-disable-line @typescript-eslint/no-explicit-any
}

export interface IFieldCollectionDataState {
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
import * as React from 'react';
import styles from '../FieldCollectionData.module.scss';
import { ICollectionDataItemProps, ICollectionDataItemState } from '.';
import { ICollectionDataItemProps } from './ICollectionDataItemProps';
import { ICollectionDataItemState } from './ICollectionDataItemState';
import { TextField } from 'office-ui-fabric-react/lib/components/TextField';
import { Icon } from 'office-ui-fabric-react/lib/components/Icon';
import { Link } from 'office-ui-fabric-react/lib/components/Link';
import { Checkbox } from 'office-ui-fabric-react/lib/components/Checkbox';
import * as strings from 'ControlStrings';
import { ICustomCollectionField, CustomCollectionFieldType, FieldValidator } from '..';
import { CustomCollectionFieldType, ICustomCollectionField } from '../ICustomCollectionField';
import { Dropdown, IDropdownOption } from 'office-ui-fabric-react/lib/components/Dropdown';
import { Callout, DirectionalHint } from 'office-ui-fabric-react/lib/components/Callout';
import { CollectionIconField } from '../collectionIconField';
import { clone, findIndex, sortBy } from '@microsoft/sp-lodash-subset';
import { CollectionNumberField } from '../collectionNumberField';
import { Guid } from '@microsoft/sp-core-library';
import { FieldValidator } from '../FieldValidator';

export class CollectionDataItem extends React.Component<ICollectionDataItemProps, ICollectionDataItemState> {
private emptyItem: any = null;
private emptyItem: any = null; // eslint-disable-line @typescript-eslint/no-explicit-any
private validation: FieldValidator = {};
private calloutCellRef: HTMLElement;

constructor(props: ICollectionDataItemProps) {
super(props);

// Create an empty item with all properties
let emptyItem = this.generateEmptyItem();
const emptyItem = this.generateEmptyItem();

this.state = {
crntItem: clone(this.props.item) || { ...emptyItem },
@@ -51,7 +53,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Update the item value on the field change
*/
private onValueChanged = (fieldId: string, value: any): void => {
private onValueChanged = (fieldId: string, value: any): void => { // eslint-disable-line @typescript-eslint/no-explicit-any
this.setState((prevState: ICollectionDataItemState): ICollectionDataItemState => {
const { crntItem } = prevState;
// Update the changed field
@@ -67,7 +69,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Perform all required field checks at once
*/
private doAllFieldChecks() {
private doAllFieldChecks(): void {
const { crntItem } = this.state;

// Check if current item is valid
@@ -90,7 +92,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Check if all values of the required fields are provided
*/
private checkAllRequiredFieldsValid(item: any): boolean {
private checkAllRequiredFieldsValid(item: any): boolean { // eslint-disable-line @typescript-eslint/no-explicit-any
// Get all the required fields
const requiredFields = this.props.fields.filter(f => f.required);
// Check all the required field values
@@ -106,7 +108,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
* Check if any of the fields contain a value
* @param item
*/
private checkAnyFieldContainsValue(item: any): boolean {
private checkAnyFieldContainsValue(item: any): boolean { // eslint-disable-line @typescript-eslint/no-explicit-any
const { fields } = this.props;
for (const field of fields) {
if (typeof item[field.id] !== "undefined" && item[field.id] !== null && item[field.id] !== "") {
@@ -119,7 +121,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Check if the add action needs to be disabled
*/
private disableAdd(item: any) {
private disableAdd(item: any): boolean { // eslint-disable-line @typescript-eslint/no-explicit-any
return !this.checkAllRequiredFieldsValid(item) || !this.checkAnyFieldContainsValue(item) || !this.checkAllFieldsAreValid() || !this.props.fAddItem;
}

@@ -141,7 +143,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Add the current row to the collection
*/
private addRow = () => {
private addRow = (): void => {
if (this.props.fAddItem) {
const { crntItem } = this.state;
// Check if all the fields are correctly provided
@@ -150,7 +152,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
this.checkAllFieldsAreValid()) {
this.props.fAddItem(crntItem);
// Clear all field values
let emptyItem = this.generateEmptyItem();
const emptyItem = this.generateEmptyItem();
this.setState({
crntItem: { ...emptyItem }
});
@@ -161,7 +163,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Add the current row to the collection
*/
private updateItem = () => {
private updateItem = (): void => {
const { crntItem } = this.state;
const isValid = this.checkAllRequiredFieldsValid(crntItem) && this.checkAnyFieldContainsValue(crntItem) && this.checkAllFieldsAreValid();

@@ -181,7 +183,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Delete the item from the collection
*/
private deleteRow = () => {
private deleteRow = (): void => {
if (this.props.fDeleteItem) {
this.props.fDeleteItem(this.props.index);
}
@@ -193,7 +195,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
* @param field
* @param value
*/
private fieldValidation = async (field: ICustomCollectionField, value: any): Promise<string> => {
private fieldValidation = async (field: ICustomCollectionField, value: any): Promise<string> => { // eslint-disable-line @typescript-eslint/no-explicit-any
let validation = "";
// Do the custom validation check
if (field.onGetErrorMessage) {
@@ -213,7 +215,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Custom field validation
*/
private onCustomFieldValidation = (fieldId: string, errorMsg: string) => {
private onCustomFieldValidation = (fieldId: string, errorMsg: string): void => {
console.log(fieldId, errorMsg);
if (fieldId) {
this.validation[fieldId] = errorMsg === "";
@@ -229,7 +231,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
* @param value
* @param item
*/
private urlFieldValidation = async (field: ICustomCollectionField, value: any, item: any): Promise<string> => {
private urlFieldValidation = async (field: ICustomCollectionField, value: any, item: any): Promise<string> => { // eslint-disable-line @typescript-eslint/no-explicit-any
let isValid = true;
let validation = "";

@@ -240,7 +242,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
isValid = validation === "";
} else {
// Check if entered value is a valid URL
const regEx: RegExp = /(http|https)?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/;
const regEx: RegExp = /(http|https)?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/;
isValid = (value === null || value.length === 0 || regEx.test(value));
validation = isValid ? "" : strings.InvalidUrlError;
}
@@ -260,9 +262,10 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
* @param field
* @param message
*/
private errorCalloutHandler(fieldId: string, message: string) {
private errorCalloutHandler(fieldId: string, message: string): void {
this.setState((prevState: ICollectionDataItemState) => {
let { crntItem, errorMsgs } = prevState;
const { crntItem } = prevState;
let errorMsgs = prevState.errorMsgs;

// Get the current field
const fieldIdx = findIndex(this.props.fields, f => f.id === fieldId);
@@ -322,13 +325,13 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Toggle the error callout
*/
private toggleErrorCallout = () => {
private toggleErrorCallout = (): void => {
this.setState((prevState: ICollectionDataItemState) => ({
showCallout: !prevState.showCallout
}));
}

private hideErrorCallout = () => {
private hideErrorCallout = (): void => {
this.setState({
showCallout: false
});
@@ -340,7 +343,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
* @param field
* @param item
*/
private renderField(field: ICustomCollectionField, item: any) {
private renderField(field: ICustomCollectionField, item: any): JSX.Element { // eslint-disable-line @typescript-eslint/no-explicit-any
const disableFieldOnEdit: boolean = field.disableEdit && !!this.props.fUpdateItem;

switch (field.type) {
@@ -399,7 +402,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
* Retrieve all dropdown options
*/
private getSortingOptions(): IDropdownOption[] {
let opts: IDropdownOption[] = [];
const opts: IDropdownOption[] = [];
const { totalItems } = this.props;
for (let i = 1; i <= totalItems; i++) {
opts.push({
@@ -413,9 +416,9 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
/**
* Creates an empty item with a unique id
*/
private generateEmptyItem(): any {
private generateEmptyItem(): any { // eslint-disable-line @typescript-eslint/no-explicit-any
// Create an empty item with all properties
let emptyItem: any = {};
const emptyItem: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
emptyItem.uniqueId = Guid.newGuid().toString();

for (const field of this.props.fields) {
@@ -447,7 +450,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
}
{
(this.props.sortingEnabled && this.props.totalItems === null) && (
<span className={`${styles.tableCell}`}></span>
<span className={`${styles.tableCell}`} />
)
}
{
@@ -457,7 +460,7 @@ export class CollectionDataItem extends React.Component<ICollectionDataItemProps
}

<span className={styles.tableCell}>
<span ref={ref => this.calloutCellRef = ref}>
<span ref={ref => { this.calloutCellRef = ref; }}>
<Link title={strings.CollectionDataItemShowErrorsLabel}
className={styles.errorCalloutLink}
disabled={!this.state.errorMsgs || this.state.errorMsgs.length === 0}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { ICustomCollectionField } from "..";
import { ICustomCollectionField } from "../ICustomCollectionField";

export interface ICollectionDataItemProps {
fields: ICustomCollectionField[];
index?: number;
item?: any;
item?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
sortingEnabled?: boolean;
totalItems?: number;
disableItemDeletion?: boolean;

/* eslint-disable @typescript-eslint/no-explicit-any */
fAddItem?: (item: any) => void;
fAddInCreation?: (item: any) => void;
fUpdateItem?: (idx: number, item: any) => void;
/* eslint-enable @typescript-eslint/no-explicit-any */
fDeleteItem?: (idx: number) => void;
fValidation?: (idx: number, isValid: boolean) => void;
fOnSorting?: (oldIdx: number, newIdx: number) => void;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ErrorMsg } from ".";
import { ErrorMsg } from "./ErrorMsg";

export interface ICollectionDataItemState {
crntItem: any;
crntItem: any; // eslint-disable-line @typescript-eslint/no-explicit-any
errorMsgs?: ErrorMsg[];
showCallout?: boolean;
}
Loading