UNPKG

@mikezimm/npmfunctions

Version:
230 lines (229 loc) 9.29 kB
import { UrlFieldFormatType } from "@pnp/sp/presets/all"; import { IFieldInfo, ChoiceFieldFormatType, DateTimeFieldFormatType, CalendarType, DateTimeFieldFriendlyFormatType, FieldUserSelectionMode, IFieldCreationProperties } from "@pnp/sp/fields/types"; import "@pnp/sp/lists"; import { IListInfo } from './listTypes'; export declare const minInfinity: number; export declare const maxInfinity: number; export interface MyListDef { title: string; desc?: string; template?: number; enableContentTypes?: boolean; additionalSettings?: Partial<IListInfo>; } export interface MyFieldDef { kind: number | null; type: string | null; vType: string; label: string; } export declare const cCount: MyFieldDef; export declare const cInt: MyFieldDef; export declare const cText: MyFieldDef; export declare const cMText: MyFieldDef; export declare const cDate: MyFieldDef; export declare const cChoice: MyFieldDef; export declare const cLook: MyFieldDef; export declare const cDLook: MyFieldDef; export declare const cBool: MyFieldDef; export declare const cNumb: MyFieldDef; export declare const cCurr: MyFieldDef; export declare const cURL: MyFieldDef; export declare const cMChoice: MyFieldDef; export declare const cCalcN: MyFieldDef; export declare const cCalcT: MyFieldDef; export declare const cUser: MyFieldDef; export declare const cMUser: MyFieldDef; export declare const cLocal: MyFieldDef; export declare const cModStatus: MyFieldDef; export declare const cSLook: MyFieldDef; export declare const cComputed: MyFieldDef; export declare const myFieldDefs: MyFieldDef[]; export declare type IMyFieldTypes = IBaseField | ITextField | IMultiLineTextField | INumberField | IXMLField | IBooleanField | ICalculatedField | IDateTimeField | ICurrencyField | IUserField | ILookupField | IChoiceField | IMultiChoiceField | IDepLookupField | ILocationField; /** * Adds a new SP.FieldText to the collection * * @param title The field title * @param maxLength The maximum number of characters allowed in the value of the field. * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) */ export declare type changes = 'create' | 'changes1' | 'changes2' | 'changes3' | 'changesFinal' | 'setForm'; /** * Had to add type any to keys to get error to go away */ export interface IBaseField extends Partial<IFieldInfo> { [key: string]: string | IFieldCreationProperties | MyFieldDef | boolean | any | undefined; fieldType: MyFieldDef; name: string; onCreateProps?: IFieldCreationProperties; showNew?: boolean; showEdit?: boolean; showDisplay?: boolean; title?: string; onCreateChanges?: IFieldCreationProperties; changes1?: IFieldCreationProperties; changes2?: IFieldCreationProperties; changes3?: IFieldCreationProperties; changesFinal?: IFieldCreationProperties; } export interface IXMLField extends IBaseField { xml: string; } export interface ITextField extends IBaseField { maxLength?: number; } /** * Adds a new SP.FieldMultiLineText to the collection * * @param title The field title * @param numberOfLines Specifies the number of lines of text to display for the field. * @param richText Specifies whether the field supports rich formatting. * @param restrictedMode Specifies whether the field supports a subset of rich formatting. * @param appendOnly Specifies whether all changes to the value of the field are displayed in list forms. * @param allowHyperlink Specifies whether a hyperlink is allowed as a value of the field. * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) * */ export interface IMultiLineTextField extends IBaseField { numberOfLines?: number; richText?: boolean; restrictedMode?: boolean; appendOnly?: boolean; allowHyperlink?: boolean; } /** * Adds a new SP.FieldNumber to the collection * * @param title The field title * @param minValue The field's minimum value * @param maxValue The field's maximum value * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) */ export interface INumberField extends IBaseField { minValue?: number; maxValue?: number; } /** * Adds a new SP.FieldBoolean to the collection * * @param title The field title. * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) */ export interface IBooleanField extends IBaseField { } /** * Adds a new SP.FieldCalculated to the collection * * @param title The field title. * @param formula The formula for the field. * @param dateFormat The date and time format that is displayed in the field. * @param outputType Specifies the output format for the field. Represents a FieldType value. * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) */ export interface ICalculatedField extends IBaseField { formula: string; dateFormat?: DateTimeFieldFormatType; } /** * Adds a new SP.FieldDateTime to the collection * * @param title The field title * @param displayFormat The format of the date and time that is displayed in the field. * @param calendarType Specifies the calendar type of the field. * @param friendlyDisplayFormat The type of friendly display format that is used in the field. * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) */ export interface IDateTimeField extends IBaseField { displayFormat?: DateTimeFieldFormatType; calendarType?: CalendarType; friendlyDisplayFormat?: DateTimeFieldFriendlyFormatType; } /** * Adds a new SP.FieldCurrency to the collection * * @param title The field title * @param minValue The field's minimum value * @param maxValue The field's maximum value * @param currencyLocalId Specifies the language code identifier (LCID) used to format the value of the field * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) */ export interface ICurrencyField extends IBaseField { minValue?: number; maxValue?: number; currencyLocalId?: number; } /** * Adds a new SP.FieldUrl to the collection * @param title The field title */ export interface IURLField extends IBaseField { displayFormat?: UrlFieldFormatType; } /** Adds a user field to the colleciton * * @param title The new field's title * @param selectionMode The selection mode of the field * @param selectionGroup Value that specifies the identifier of the SharePoint group whose members can be selected as values of the field * @param properties */ export interface IUserField extends IBaseField { selectionMode: FieldUserSelectionMode; } /** * Adds a SP.FieldLookup to the collection * * @param title The new field's title * @param lookupListId The guid id of the list where the source of the lookup is found * @param lookupFieldName The internal name of the field in the source list * @param properties Set of additional properties to set on the new field */ export interface ILookupField extends IBaseField { lookupListId: string; lookupFieldName: string; } /** * Adds a new SP.FieldChoice to the collection * * @param title The field title. * @param choices The choices for the field. * @param format The display format of the available options for the field. * @param fillIn Specifies whether the field allows fill-in values. * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) */ export interface IChoiceField extends IBaseField { choices: string[]; format?: ChoiceFieldFormatType; fillIn?: boolean; FillInChoice?: boolean; } /** * Adds a new SP.FieldMultiChoice to the collection * * @param title The field title. * @param choices The choices for the field. * @param fillIn Specifies whether the field allows fill-in values. * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) */ export interface IMultiChoiceField extends IBaseField { choices: string[]; fillIn?: boolean; } /** * Creates a secondary (dependent) lookup field, based on the Id of the primary lookup field. * * @param displayName The display name of the new field. * @param primaryLookupFieldId The guid of the primary Lookup Field. * @param showField Which field to show from the lookup list. */ export interface IDepLookupField extends IBaseField { primaryLookupFieldId: string; showField: string; } /** * Adds a new SP.FieldLocation to the collection * * @param title The field title. * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) */ export interface ILocationField extends IBaseField { }