mui-spfx-controls
Version:
SPFx component library built with MUI
64 lines • 2.8 kB
TypeScript
import { WebPartContext } from '@microsoft/sp-webpart-base';
import { IFieldInfo } from '@pnp/sp/fields';
import { IListInfo } from '@pnp/sp/lists';
/**
* Service class for interacting with SharePoint lists.
*/
declare class ListService {
private readonly sp;
private readonly list;
/**
* Initializes the ListService instance.
* @param {WebPartContext} context - The SharePoint WebPart context.
* @param {string} listId - The ID of the SharePoint list.
*/
constructor(context: WebPartContext, listId: string);
/**
* Checks if a field is visible and not hidden.
* @param {IFieldInfo} field - The field information.
* @returns {boolean} True if the field is not hidden, otherwise false.
*/
private checkCustomFieldType;
/**
* Retrieves the total item count of the list.
* @returns {Promise<number>} The total number of items in the list.
*/
private getListSize;
/**
* Fetches all lists available in the SharePoint site.
* @returns {Promise<IListInfo[]>} A list of SharePoint lists.
*/
getLists(): Promise<IListInfo[]>;
/**
* Retrieves fields from the specified list, optionally filtering by internal names.
* @param {string[]} [fieldInternalNames] - Optional array of field internal names to filter.
* @returns {Promise<IFieldInfo[]>} A list of field information objects.
*/
getListFields(fieldInternalNames?: string[]): Promise<IFieldInfo[]>;
/**
* Retrieves list items with specified fields, filters, and sorting options.
* @param {IFieldInfo[]} fields - The fields to include.
* @param {string} [filter] - Optional OData filter query.
* @param {string} [orderBy] - Optional sorting field.
* @param {number} [top] - Optional limit on number of records.
* @returns {Promise<any[]>} The list items.
*/
getListItems(fields: IFieldInfo[], filter?: string, orderBy?: string, top?: number): Promise<any[]>;
/**
* Creates a new list item with specified values.
* @param {Record<string, any>} value - The values for the new item.
* @returns {Promise<Record<string, any>>} The created list item.
* @throws {Error} If the user lacks AddListItems permission.
*/
createListItem(value: Record<string, any>): Promise<Record<string, any>>;
/**
* Updates an existing list item by ID.
* @param {number} id - The ID of the list item.
* @param {Record<string, any>} newRow - The updated values.
* @returns {Promise<void>} Resolves when the update is successful.
* @throws {Error} If the user lacks EditListItems permission.
*/
updateListItem(id: number, newRow: Record<string, any>): Promise<void>;
}
export { ListService };
//# sourceMappingURL=ListService.d.ts.map