UNPKG

13.5 kBTypeScriptView Raw
1import { _SPCollection, _SPInstance, IDeleteable } from "../spqueryable.js";
2export declare class _Fields extends _SPCollection<IFieldInfo[]> {
3 /**
4 * Creates a field based on the specified schema
5 *
6 * @param xml A string or XmlSchemaFieldCreationInformation instance descrbing the field to create
7 */
8 createFieldAsXml(xml: string | IXmlSchemaFieldCreationInformation): Promise<IFieldAddResult>;
9 /**
10 * Gets a field from the collection by id
11 *
12 * @param id The Id of the list
13 */
14 getById(id: string): IField;
15 /**
16 * Gets a field from the collection by title
17 *
18 * @param title The case-sensitive title of the field
19 */
20 getByTitle(title: string): IField;
21 /**
22 * Gets a field from the collection by using internal name or title
23 *
24 * @param name The case-sensitive internal name or title of the field
25 */
26 getByInternalNameOrTitle(name: string): IField;
27 /**
28 * Adds a new field to the collection
29 *
30 * @param title The new field's title
31 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
32 */
33 add(title: string, fieldTypeKind: number, properties?: IFieldCreationProperties): Promise<IFieldAddResult>;
34 /**
35 * Adds a new field to the collection
36 *
37 * @param title The new field's title
38 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
39 */
40 addField(title: string, fieldTypeKind: number, properties?: IAddFieldProperties): Promise<IFieldAddResult>;
41 /**
42 * Adds a new SP.FieldText to the collection
43 *
44 * @param title The field title
45 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
46 */
47 addText(title: string, properties?: IFieldCreationProperties & AddTextProps): Promise<IFieldAddResult>;
48 /**
49 * Adds a new SP.FieldCalculated to the collection
50 *
51 * @param title The field title.
52 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
53 */
54 addCalculated(title: string, properties?: IFieldCreationProperties & AddCalculatedProps): Promise<IFieldAddResult>;
55 /**
56 * Adds a new SP.FieldDateTime to the collection
57 *
58 * @param title The field title
59 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
60 */
61 addDateTime(title: string, properties?: IFieldCreationProperties & AddDateTimeProps): Promise<IFieldAddResult>;
62 /**
63 * Adds a new SP.FieldNumber to the collection
64 *
65 * @param title The field title
66 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
67 */
68 addNumber(title: string, properties?: IFieldCreationProperties & AddNumberProps): Promise<IFieldAddResult>;
69 /**
70 * Adds a new SP.FieldCurrency to the collection
71 *
72 * @param title The field title
73 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
74 */
75 addCurrency(title: string, properties?: IFieldCreationProperties & AddCurrencyProps): Promise<IFieldAddResult>;
76 /**
77 * Adds a new SP.FieldMultiLineText to the collection
78 *
79 * @param title The field title
80 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
81 *
82 */
83 addMultilineText(title: string, properties?: IFieldCreationProperties & AddMultilineTextProps): Promise<IFieldAddResult>;
84 /**
85 * Adds a new SP.FieldUrl to the collection
86 *
87 * @param title The field title
88 */
89 addUrl(title: string, properties?: IFieldCreationProperties & AddUrlProps): Promise<IFieldAddResult>;
90 /** Adds a user field to the colleciton
91 *
92 * @param title The new field's title
93 * @param properties
94 */
95 addUser(title: string, properties?: IFieldCreationProperties & AddUserProps): Promise<IFieldAddResult>;
96 /**
97 * Adds a SP.FieldLookup to the collection
98 *
99 * @param title The new field's title
100 * @param properties Set of additional properties to set on the new field
101 */
102 addLookup(title: string, properties?: IAddFieldProperties): Promise<IFieldAddResult>;
103 /**
104 * Adds a new SP.FieldChoice to the collection
105 *
106 * @param title The field title.
107 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
108 */
109 addChoice(title: string, properties?: IFieldCreationProperties & AddChoiceProps): Promise<IFieldAddResult>;
110 /**
111 * Adds a new SP.FieldMultiChoice to the collection
112 *
113 * @param title The field title.
114 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
115 */
116 addMultiChoice(title: string, properties?: IFieldCreationProperties & AddChoiceProps): Promise<IFieldAddResult>;
117 /**
118 * Adds a new SP.FieldBoolean to the collection
119 *
120 * @param title The field title.
121 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
122 */
123 addBoolean(title: string, properties?: IFieldCreationProperties): Promise<IFieldAddResult>;
124 /**
125 * Creates a secondary (dependent) lookup field, based on the Id of the primary lookup field.
126 *
127 * @param displayName The display name of the new field.
128 * @param primaryLookupFieldId The guid of the primary Lookup Field.
129 * @param showField Which field to show from the lookup list.
130 */
131 addDependentLookupField(displayName: string, primaryLookupFieldId: string, showField: string): Promise<IFieldAddResult>;
132 /**
133 * Adds a new SP.FieldLocation to the collection
134 *
135 * @param title The field title.
136 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
137 */
138 addLocation(title: string, properties?: IFieldCreationProperties): Promise<IFieldAddResult>;
139 /**
140 * Adds a new SP.FieldLocation to the collection
141 *
142 * @param title The field title.
143 * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
144 */
145 addImageField(title: string, properties?: IFieldCreationProperties): Promise<IFieldAddResult>;
146}
147export interface IFields extends _Fields {
148}
149export declare const Fields: import("../spqueryable.js").ISPInvokableFactory<IFields>;
150export declare class _Field extends _SPInstance<IFieldInfo> {
151 delete: (this: import("../spqueryable.js").ISPQueryable<any>) => Promise<void>;
152 /**
153 * Updates this field instance with the supplied properties
154 *
155 * @param properties A plain object hash of values to update for the list
156 * @param fieldType The type value such as SP.FieldLookup. Optional, looked up from the field if not provided
157 */
158 update(properties: any, fieldType?: string): Promise<IFieldUpdateResult>;
159 /**
160 * Sets the value of the ShowInDisplayForm property for this field.
161 */
162 setShowInDisplayForm(show: boolean): Promise<void>;
163 /**
164 * Sets the value of the ShowInEditForm property for this field.
165 */
166 setShowInEditForm(show: boolean): Promise<void>;
167 /**
168 * Sets the value of the ShowInNewForm property for this field.
169 */
170 setShowInNewForm(show: boolean): Promise<void>;
171}
172export interface IField extends _Field, IDeleteable {
173}
174export declare const Field: import("../spqueryable.js").ISPInvokableFactory<IField>;
175/**
176 * This interface defines the result of adding a field
177 */
178export interface IFieldAddResult {
179 data: Partial<IFieldInfo>;
180 field: IField;
181}
182/**
183 * This interface defines the result of updating a field
184 */
185export interface IFieldUpdateResult {
186 data: Partial<IFieldInfo>;
187 field: IField;
188}
189export declare type AddTextProps = {
190 MaxLength?: number;
191};
192export declare type AddCalculatedProps = {
193 DateFormat?: DateTimeFieldFormatType;
194 FieldTypeKind?: number;
195 Formula?: string;
196 OutputType?: FieldTypes;
197};
198export declare type AddDateTimeProps = {
199 DateTimeCalendarType?: CalendarType;
200 DisplayFormat?: DateTimeFieldFormatType;
201 FriendlyDisplayFormat?: DateTimeFieldFriendlyFormatType;
202};
203export declare type AddNumberProps = {
204 MinimumValue?: number;
205 MaximumValue?: number;
206};
207export declare type AddCurrencyProps = AddNumberProps & {
208 CurrencyLocaleId?: number;
209};
210export declare type AddMultilineTextProps = {
211 AllowHyperlink?: boolean;
212 AppendOnly?: boolean;
213 NumberOfLines?: number;
214 RestrictedMode?: boolean;
215 RichText?: boolean;
216};
217export declare type AddUrlProps = {
218 DisplayFormat?: UrlFieldFormatType;
219};
220export declare type AddUserProps = {
221 SelectionMode?: FieldUserSelectionMode;
222};
223export declare type AddChoiceProps = {
224 Choices: string[];
225 EditFormat?: ChoiceFieldFormatType;
226 FillInChoice?: boolean;
227};
228/**
229 * Specifies the type of the field.
230 */
231export declare const enum FieldTypes {
232 Invalid = 0,
233 Integer = 1,
234 Text = 2,
235 Note = 3,
236 DateTime = 4,
237 Counter = 5,
238 Choice = 6,
239 Lookup = 7,
240 Boolean = 8,
241 Number = 9,
242 Currency = 10,
243 URL = 11,
244 Computed = 12,
245 Threading = 13,
246 Guid = 14,
247 MultiChoice = 15,
248 GridChoice = 16,
249 Calculated = 17,
250 File = 18,
251 Attachments = 19,
252 User = 20,
253 Recurrence = 21,
254 CrossProjectLink = 22,
255 ModStat = 23,
256 Error = 24,
257 ContentTypeId = 25,
258 PageSeparator = 26,
259 ThreadIndex = 27,
260 WorkflowStatus = 28,
261 AllDayEvent = 29,
262 WorkflowEventType = 30
263}
264export declare enum DateTimeFieldFormatType {
265 DateOnly = 0,
266 DateTime = 1
267}
268export declare enum DateTimeFieldFriendlyFormatType {
269 Unspecified = 0,
270 Disabled = 1,
271 Relative = 2
272}
273/**
274 * Specifies the control settings while adding a field.
275 */
276export declare const enum AddFieldOptions {
277 /**
278 * Specify that a new field added to the list must also be added to the default content type in the site collection
279 */
280 DefaultValue = 0,
281 /**
282 * Specify that a new field added to the list must also be added to the default content type in the site collection.
283 */
284 AddToDefaultContentType = 1,
285 /**
286 * Specify that a new field must not be added to any other content type
287 */
288 AddToNoContentType = 2,
289 /**
290 * Specify that a new field that is added to the specified list must also be added to all content types in the site collection
291 */
292 AddToAllContentTypes = 4,
293 /**
294 * Specify adding an internal field name hint for the purpose of avoiding possible database locking or field renaming operations
295 */
296 AddFieldInternalNameHint = 8,
297 /**
298 * Specify that a new field that is added to the specified list must also be added to the default list view
299 */
300 AddFieldToDefaultView = 16,
301 /**
302 * Specify to confirm that no other field has the same display name
303 */
304 AddFieldCheckDisplayName = 32
305}
306export interface IXmlSchemaFieldCreationInformation {
307 Options?: AddFieldOptions;
308 SchemaXml: string;
309}
310export declare const enum CalendarType {
311 Gregorian = 1,
312 Japan = 3,
313 Taiwan = 4,
314 Korea = 5,
315 Hijri = 6,
316 Thai = 7,
317 Hebrew = 8,
318 GregorianMEFrench = 9,
319 GregorianArabic = 10,
320 GregorianXLITEnglish = 11,
321 GregorianXLITFrench = 12,
322 KoreaJapanLunar = 14,
323 ChineseLunar = 15,
324 SakaEra = 16,
325 UmAlQura = 23
326}
327export declare enum UrlFieldFormatType {
328 Hyperlink = 0,
329 Image = 1
330}
331export declare enum FieldUserSelectionMode {
332 PeopleAndGroups = 1,
333 PeopleOnly = 0
334}
335export interface IFieldCreationProperties {
336 DefaultFormula?: string;
337 Description?: string;
338 EnforceUniqueValues?: boolean;
339 FieldTypeKind?: number;
340 Group?: string;
341 Hidden?: boolean;
342 Indexed?: boolean;
343 Required?: boolean;
344 Title?: string;
345 ValidationFormula?: string;
346 ValidationMessage?: string;
347}
348export interface IAddFieldProperties {
349 Title?: string;
350 Type?: number;
351 Required?: boolean;
352 IsCompactName?: boolean;
353 LookupListId?: string;
354 LookupWebId?: string;
355 Choices?: string[];
356 LookupFieldName?: string;
357}
358export declare enum ChoiceFieldFormatType {
359 Dropdown = 0,
360 RadioButtons = 1
361}
362export interface IFieldInfo {
363 Choices?: string[];
364 DefaultFormula: string | null;
365 DefaultValue: string | null;
366 Description: string;
367 Direction: string;
368 EnforceUniqueValues: boolean;
369 EntityPropertyName: string;
370 FieldTypeKind: FieldTypes;
371 Filterable: boolean;
372 FromBaseType: boolean;
373 Group: string;
374 Hidden: boolean;
375 Id: string;
376 Indexed: boolean;
377 IndexStatus: number;
378 InternalName: string;
379 JSLink: string;
380 PinnedToFiltersPane: boolean;
381 ReadOnlyField: boolean;
382 Required: boolean;
383 SchemaXml: string;
384 Scope: string;
385 Sealed: boolean;
386 ShowInFiltersPane: number;
387 Sortable: boolean;
388 StaticName: string;
389 Title: string;
390 TypeAsString: string;
391 TypeDisplayName: string;
392 TypeShortDescription: string;
393 ValidationFormula: string | null;
394 ValidationMessage: string | null;
395}
396//# sourceMappingURL=types.d.ts.map
\No newline at end of file