/
types.d.ts
65 lines (58 loc) · 1.85 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Types } from "gd-sprest";
import { IWPList, IWPListInfo, IWPListProps, IWPListCfg, IWPListEditForm } from "../list/types";
/**
* ### Search WebPart
*
* The search webpart extends the list webpart, and includes a filterItems method to return items based on the inputed filter text.
*
* ```ts
* import { WebParts } from "gd-sprest-bs";
*
* // Create the webpart
* let wp = WebParts.WebPart({
* elementId: "my-wpSearch",
* cfgElementId: "my-wpSearch-cfg",
* onRenderItems: (wpInfo, items) => {
* // Render the display element
* wpInfo.el.innerHTML = [
* '<h1>List: ' + wpInfo.ListName + '</h1>',
* '<h5>List Items: ' + items.length + '</h5>'
* ].join('\n');
* }
* });
* ```
*/
export const WPSearch: (props: IWPListProps) => IWPSearch;
/**
* Search WebPart Edit Form
*/
export const WPSearchEditForm: (props: IWPSearchEditForm) => IWPSearchEditForm;
/**
* Search WebPart
*/
export interface IWPSearch extends IWPList<IWPSearchCfg, IWPSearchInfo> {
/** The filter items method. */
filterItems: (filterText: string) => Array<Types.SP.IListItemQuery | Types.SP.ListItem>;
}
/**
* Search WebPart Information
*/
export interface IWPSearchInfo extends IWPListInfo<IWPSearchCfg> { }
/**
* Search WebPart Properties
*/
export interface IWPSearchProps extends IWPListProps<IWPSearchInfo, IWPSearchEditForm> {
/** The internal field names to be used for search. These will be appended to the configuration fields. */
searchFields?: Array<{ name: string, type: string }>;
}
/**
* Search WebPart Configuration
*/
export interface IWPSearchCfg extends IWPListCfg {
/** The searchable fields. */
Fields: Array<{ name: string, type: string }>;
}
/**
* Search WebPart Edit Form
*/
export interface IWPSearchEditForm extends IWPListEditForm<IWPSearchCfg, IWPSearchInfo> { }