@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
59 lines (54 loc) • 2.52 kB
TypeScript
/// <reference types="react" />
/**
* 2020-09-28: getFunctions.ts intro
*
* The first 3 functions in this file were pulled from PivotTiles.tsx.
* They are used for fetching items, finding select and expand columns.
*
* Here's how they are used in PivotTiles.tsx
*
let selectCols: string = "*";
let expandThese = "";
let allColumns = this.getKeysLike(this.props,"col","Begins");
let expColumns = this.getExpandColumns(allColumns);
let selColumns = this.getSelectColumns(allColumns);
selColumns.length > 0 ? selectCols += "," + selColumns.join(",") : selectCols = selectCols;
if (expColumns.length > 0) { expandThese = expColumns.join(","); }
web.lists.getByTitle(useTileList).items
.select(selectCols).expand(expandThese).filter(restFilter).orderBy(restSort,true).getAll()
*/
/**
* getKeysLike function takes an object like "props"
* looks for specific keys that begin with a string like 'col'
* and returns those keys back in an array.
* Use case: Look for props that begin with 'col' which will then return all the known or mapped static column names
* @param thisProps
* @param findMe
* @param findOp
*/
export declare function getKeysLike(thisProps: any, findMe: string, findOp: string): any[];
/**
* getSelectColumns function will take an array of column names (string format)
* and return an array of the columns that need to be added to the select variable in getItems
* It pushes the entire expanded name like: Created/ID
* @param lookupColumns
*/
/**
* NOTE All this should be gotten from npmFunctions!!!!
* Lists/getFunctions.ts
*
*/
export declare function getSelectColumns(lookupColumns: string[], DoNotExpandColumnsIn?: string[]): string[];
export declare function getLinkColumns(lookupColumns: string[], DoNotExpandColumnsIn?: string[]): string[];
export declare function getFuncColumns(lookupColumns: string[], DoNotExpandColumnsIn?: string[]): {
all: string[];
actual: string[];
funcErrors: JSX.Element[];
};
/**
* getExpandColumns function will take an array of column names (string format)
* and return an array of the columns that need to be added to the expand variable in getItems
* It pushes the just the column name: It finds: Created/ID and returns just Created
* @param lookupColumns
*/
export declare function getExpandColumns(lookupColumns: string[], DoNotExpandColumnsIn?: string[]): string[];