UNPKG

13.7 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 & AddMultiChoiceProps): 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};
228export declare type AddMultiChoiceProps = {
229 Choices: string[];
230 FillInChoice?: boolean;
231};
232/**
233 * Specifies the type of the field.
234 */
235export declare const enum FieldTypes {
236 Invalid = 0,
237 Integer = 1,
238 Text = 2,
239 Note = 3,
240 DateTime = 4,
241 Counter = 5,
242 Choice = 6,
243 Lookup = 7,
244 Boolean = 8,
245 Number = 9,
246 Currency = 10,
247 URL = 11,
248 Computed = 12,
249 Threading = 13,
250 Guid = 14,
251 MultiChoice = 15,
252 GridChoice = 16,
253 Calculated = 17,
254 File = 18,
255 Attachments = 19,
256 User = 20,
257 Recurrence = 21,
258 CrossProjectLink = 22,
259 ModStat = 23,
260 Error = 24,
261 ContentTypeId = 25,
262 PageSeparator = 26,
263 ThreadIndex = 27,
264 WorkflowStatus = 28,
265 AllDayEvent = 29,
266 WorkflowEventType = 30,
267 Location = 33,
268 Image = 34
269}
270export declare enum DateTimeFieldFormatType {
271 DateOnly = 0,
272 DateTime = 1
273}
274export declare enum DateTimeFieldFriendlyFormatType {
275 Unspecified = 0,
276 Disabled = 1,
277 Relative = 2
278}
279/**
280 * Specifies the control settings while adding a field.
281 */
282export declare const enum AddFieldOptions {
283 /**
284 * Specify that a new field added to the list must also be added to the default content type in the site collection
285 */
286 DefaultValue = 0,
287 /**
288 * Specify that a new field added to the list must also be added to the default content type in the site collection.
289 */
290 AddToDefaultContentType = 1,
291 /**
292 * Specify that a new field must not be added to any other content type
293 */
294 AddToNoContentType = 2,
295 /**
296 * Specify that a new field that is added to the specified list must also be added to all content types in the site collection
297 */
298 AddToAllContentTypes = 4,
299 /**
300 * Specify adding an internal field name hint for the purpose of avoiding possible database locking or field renaming operations
301 */
302 AddFieldInternalNameHint = 8,
303 /**
304 * Specify that a new field that is added to the specified list must also be added to the default list view
305 */
306 AddFieldToDefaultView = 16,
307 /**
308 * Specify to confirm that no other field has the same display name
309 */
310 AddFieldCheckDisplayName = 32
311}
312export interface IXmlSchemaFieldCreationInformation {
313 Options?: AddFieldOptions;
314 SchemaXml: string;
315}
316export declare const enum CalendarType {
317 Gregorian = 1,
318 Japan = 3,
319 Taiwan = 4,
320 Korea = 5,
321 Hijri = 6,
322 Thai = 7,
323 Hebrew = 8,
324 GregorianMEFrench = 9,
325 GregorianArabic = 10,
326 GregorianXLITEnglish = 11,
327 GregorianXLITFrench = 12,
328 KoreaJapanLunar = 14,
329 ChineseLunar = 15,
330 SakaEra = 16,
331 UmAlQura = 23
332}
333export declare enum UrlFieldFormatType {
334 Hyperlink = 0,
335 Image = 1
336}
337export declare enum FieldUserSelectionMode {
338 PeopleAndGroups = 1,
339 PeopleOnly = 0
340}
341export interface IFieldCreationProperties {
342 DefaultFormula?: string;
343 Description?: string;
344 EnforceUniqueValues?: boolean;
345 FieldTypeKind?: number;
346 Group?: string;
347 Hidden?: boolean;
348 Indexed?: boolean;
349 Required?: boolean;
350 Title?: string;
351 ValidationFormula?: string;
352 ValidationMessage?: string;
353}
354export interface IAddFieldProperties {
355 Title?: string;
356 Type?: number;
357 Required?: boolean;
358 IsCompactName?: boolean;
359 LookupListId?: string;
360 LookupWebId?: string;
361 Choices?: string[];
362 LookupFieldName?: string;
363}
364export declare enum ChoiceFieldFormatType {
365 Dropdown = 0,
366 RadioButtons = 1
367}
368export interface IFieldInfo {
369 Choices?: string[];
370 DefaultFormula: string | null;
371 DefaultValue: string | null;
372 Description: string;
373 Direction: string;
374 EnforceUniqueValues: boolean;
375 EntityPropertyName: string;
376 FieldTypeKind: FieldTypes;
377 Filterable: boolean;
378 FromBaseType: boolean;
379 Group: string;
380 Hidden: boolean;
381 Id: string;
382 Indexed: boolean;
383 IndexStatus: number;
384 InternalName: string;
385 JSLink: string;
386 PinnedToFiltersPane: boolean;
387 ReadOnlyField: boolean;
388 Required: boolean;
389 SchemaXml: string;
390 Scope: string;
391 Sealed: boolean;
392 ShowInFiltersPane: number;
393 Sortable: boolean;
394 StaticName: string;
395 Title: string;
396 TypeAsString: string;
397 TypeDisplayName: string;
398 TypeShortDescription: string;
399 ValidationFormula: string | null;
400 ValidationMessage: string | null;
401}
402//# sourceMappingURL=types.d.ts.map
\No newline at end of file