jitz-sharepoint-utilities 1.11.3 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/allTypes.d.ts +1 -0
- package/controls/JitzGrid.tsx +639 -0
- package/controls/JitzImage.tsx +38 -0
- package/controls/JitzPeoplePicker.tsx +419 -0
- package/controls/JitzPersonInfo.tsx +114 -0
- package/controls/JitzPersona.tsx +53 -0
- package/data/context/CommonRepository.ts +287 -0
- package/data/context/JitzContext.ts +33 -0
- package/data/context/JitzSPContext.ts +16 -0
- package/data/context/JitzSPHttpClient.ts +133 -0
- package/data/context/List.ts +429 -0
- package/data/context/Repository.ts +395 -0
- package/data/interfaces/ICommonRepository.ts +7 -0
- package/data/interfaces/IJitzContext.ts +11 -0
- package/data/interfaces/IJitzSPContext.ts +7 -0
- package/data/interfaces/IJitzSPHttpClient.ts +6 -0
- package/data/interfaces/IList.ts +41 -0
- package/data/interfaces/IModels.ts +33 -0
- package/data/interfaces/IRepository.ts +31 -0
- package/lib/common/IModels.d.ts +9 -1
- package/lib/common/IObjects.d.ts +72 -0
- package/lib/common/IObjects.js +30 -0
- package/lib/controls/JitzGrid.d.ts +75 -0
- package/lib/controls/JitzGrid.js +606 -0
- package/lib/controls/JitzImage.d.ts +14 -0
- package/lib/controls/JitzImage.js +37 -0
- package/lib/controls/JitzPeoplePicker.d.ts +49 -0
- package/lib/controls/JitzPeoplePicker.js +311 -0
- package/lib/controls/JitzPersonInfo.d.ts +32 -0
- package/lib/controls/JitzPersonInfo.js +98 -0
- package/lib/controls/JitzPersona.d.ts +23 -0
- package/lib/controls/JitzPersona.js +48 -0
- package/lib/data/Activities.d.ts +6 -0
- package/lib/data/Activities.js +36 -0
- package/lib/data/Attachments.d.ts +6 -0
- package/lib/data/Attachments.js +30 -0
- package/lib/data/Configurations.d.ts +6 -0
- package/lib/data/Configurations.js +30 -0
- package/lib/data/CustomStylesheet.d.ts +6 -0
- package/lib/data/CustomStylesheet.js +30 -0
- package/lib/data/EmailTemplates.d.ts +6 -0
- package/lib/data/EmailTemplates.js +31 -0
- package/lib/data/FAQs.d.ts +6 -0
- package/lib/data/FAQs.js +30 -0
- package/lib/data/HomePageTexts.d.ts +6 -0
- package/lib/data/HomePageTexts.js +30 -0
- package/lib/data/TicketCategories.d.ts +6 -0
- package/lib/data/TicketCategories.js +26 -0
- package/lib/data/TicketComments.d.ts +6 -0
- package/lib/data/TicketComments.js +32 -0
- package/lib/data/TicketPriorities.d.ts +6 -0
- package/lib/data/TicketPriorities.js +31 -0
- package/lib/data/TicketStatuses.d.ts +6 -0
- package/lib/data/TicketStatuses.js +31 -0
- package/lib/data/TicketSubcategories.d.ts +6 -0
- package/lib/data/TicketSubcategories.js +26 -0
- package/lib/data/Tickets.d.ts +6 -0
- package/lib/data/Tickets.js +45 -0
- package/lib/data/context/CommonRepository.d.ts +17 -0
- package/lib/data/context/CommonRepository.js +288 -0
- package/lib/data/context/JitzContext.d.ts +13 -0
- package/lib/data/context/JitzContext.js +80 -0
- package/lib/data/context/JitzSPContext.d.ts +8 -0
- package/lib/data/context/JitzSPContext.js +58 -0
- package/lib/data/context/JitzSPHttpClient.d.ts +14 -0
- package/lib/data/context/JitzSPHttpClient.js +173 -0
- package/lib/data/context/List.d.ts +36 -0
- package/lib/data/context/List.js +450 -0
- package/lib/data/context/Repository.d.ts +19 -0
- package/lib/data/context/Repository.js +421 -0
- package/lib/data/interfaces/ICommonRepository.d.ts +6 -0
- package/lib/data/interfaces/ICommonRepository.js +2 -0
- package/lib/data/interfaces/IJitzContext.d.ts +10 -0
- package/lib/data/interfaces/IJitzContext.js +2 -0
- package/lib/data/interfaces/IJitzSPContext.d.ts +6 -0
- package/lib/data/interfaces/IJitzSPContext.js +2 -0
- package/lib/data/interfaces/IJitzSPHttpClient.d.ts +6 -0
- package/lib/data/interfaces/IJitzSPHttpClient.js +2 -0
- package/lib/data/interfaces/IList.d.ts +25 -0
- package/lib/data/interfaces/IList.js +2 -0
- package/lib/data/interfaces/IModels.d.ts +32 -0
- package/lib/data/interfaces/IModels.js +2 -0
- package/lib/data/interfaces/IRepository.d.ts +14 -0
- package/lib/data/interfaces/IRepository.js +2 -0
- package/lib/jitzSPHttpClient.js +5 -3
- package/lib/repositories/CommonRepository.js +17 -16
- package/lib/repositories/Repository.js +22 -21
- package/lib/services/GraphService.d.ts +10 -0
- package/lib/services/GraphService.js +105 -0
- package/lib/services/UserService.d.ts +1 -1
- package/lib/services/UserService.js +9 -9
- package/lib/services/UtilityService.d.ts +18 -12
- package/lib/services/UtilityService.js +157 -58
- package/package.json +7 -5
@@ -0,0 +1,395 @@
|
|
1
|
+
import IJitzSPContext from "../interfaces/IJitzSPContext";
|
2
|
+
import { IListItemsMetadata, IModel } from "../interfaces/IModels";
|
3
|
+
import { IRepository } from "../interfaces/IRepository";
|
4
|
+
|
5
|
+
export default class Repository<T extends IModel> implements IRepository<T> {
|
6
|
+
private _listEntityType?: string;
|
7
|
+
public context: IJitzSPContext;
|
8
|
+
public listName: string;
|
9
|
+
|
10
|
+
constructor(context: IJitzSPContext, listName: string) {
|
11
|
+
this.context = context;
|
12
|
+
this.listName = listName;
|
13
|
+
}
|
14
|
+
|
15
|
+
public getAll(
|
16
|
+
selectFields?: string,
|
17
|
+
expand?: string,
|
18
|
+
filters?: string,
|
19
|
+
orderBy?: string,
|
20
|
+
top?: number,
|
21
|
+
skip?: number,
|
22
|
+
skipTokenUniqueField?: string,
|
23
|
+
skipTokenUniqueFieldValue?: string
|
24
|
+
): Promise<T[]> {
|
25
|
+
let queryUrlGetAllItems: string =
|
26
|
+
`${this.context.siteUrl}/_api/web/lists/GetByTitle('` +
|
27
|
+
this.listName +
|
28
|
+
`')/items`;
|
29
|
+
|
30
|
+
if (selectFields != null && selectFields != "") {
|
31
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `?$select=` + selectFields;
|
32
|
+
} else {
|
33
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `?$select=*`;
|
34
|
+
}
|
35
|
+
if (orderBy != null && orderBy != "") {
|
36
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `&$orderby=` + orderBy;
|
37
|
+
}
|
38
|
+
if (skip != null && skip != undefined && skip > 0) {
|
39
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `&$skip=` + skip;
|
40
|
+
}
|
41
|
+
if (top != null && top != undefined && top > 0) {
|
42
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `&$top=` + top;
|
43
|
+
}
|
44
|
+
if (expand != null && expand != "") {
|
45
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `&$expand=` + expand;
|
46
|
+
}
|
47
|
+
if (filters != null && filters != "") {
|
48
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `&$filter=` + filters;
|
49
|
+
}
|
50
|
+
if (
|
51
|
+
skipTokenUniqueField != null &&
|
52
|
+
skipTokenUniqueField != undefined &&
|
53
|
+
skipTokenUniqueFieldValue != null &&
|
54
|
+
skipTokenUniqueFieldValue != undefined
|
55
|
+
) {
|
56
|
+
if (skipTokenUniqueField == "Id" || skipTokenUniqueField == "id") {
|
57
|
+
skipTokenUniqueField = "ID";
|
58
|
+
}
|
59
|
+
queryUrlGetAllItems =
|
60
|
+
queryUrlGetAllItems +
|
61
|
+
`&$skiptoken=Paged=TRUE%26p_${skipTokenUniqueField}=${skipTokenUniqueFieldValue}`;
|
62
|
+
}
|
63
|
+
|
64
|
+
return this.context.client
|
65
|
+
.get(queryUrlGetAllItems)
|
66
|
+
.then((response: any) => {
|
67
|
+
if (response.status >= 200 && response.status < 300) {
|
68
|
+
return response.data.d;
|
69
|
+
} else {
|
70
|
+
return Promise.reject(new Error(JSON.stringify(response)));
|
71
|
+
}
|
72
|
+
})
|
73
|
+
.then((data: any) => {
|
74
|
+
// let items: T[] = [];
|
75
|
+
// if (data) {
|
76
|
+
// for (let i = 0; i < data.length; i++) {
|
77
|
+
// let item = data[i];
|
78
|
+
// items.push(item);
|
79
|
+
// }
|
80
|
+
// }
|
81
|
+
return data;
|
82
|
+
})
|
83
|
+
.catch((ex: any) => {
|
84
|
+
console.log("load Items > JitzSPHttpClient.get()...catch:", ex);
|
85
|
+
throw ex;
|
86
|
+
});
|
87
|
+
}
|
88
|
+
|
89
|
+
public getAllFromUrl(url: string): Promise<T[]> {
|
90
|
+
return this.context.client
|
91
|
+
.get(url)
|
92
|
+
.then((response: any) => {
|
93
|
+
if (response.status >= 200 && response.status < 300) {
|
94
|
+
return response.data.d;
|
95
|
+
} else {
|
96
|
+
return Promise.reject(new Error(JSON.stringify(response)));
|
97
|
+
}
|
98
|
+
})
|
99
|
+
.then((data: any) => {
|
100
|
+
// let items: T[] = [];
|
101
|
+
// if (data) {
|
102
|
+
// for (let i = 0; i < data.length; i++) {
|
103
|
+
// let item = data[i];
|
104
|
+
// items.push(item);
|
105
|
+
// }
|
106
|
+
// }
|
107
|
+
return data;
|
108
|
+
})
|
109
|
+
.catch((ex: any) => {
|
110
|
+
console.log("load Items > JitzSPHttpClient.get()...catch:", ex);
|
111
|
+
throw ex;
|
112
|
+
});
|
113
|
+
}
|
114
|
+
|
115
|
+
public async getAllRecursive(
|
116
|
+
selectFields?: string,
|
117
|
+
expand?: string,
|
118
|
+
filters?: string,
|
119
|
+
orderBy?: string,
|
120
|
+
top?: number,
|
121
|
+
maxRecursiveCount = 5
|
122
|
+
): Promise<T[]> {
|
123
|
+
let items: T[] = [];
|
124
|
+
let queryUrlGetAllItems: string =
|
125
|
+
`${this.context.siteUrl}/_api/web/lists/GetByTitle('` +
|
126
|
+
this.listName +
|
127
|
+
`')/items`;
|
128
|
+
|
129
|
+
if (selectFields != null && selectFields != "") {
|
130
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `?$select=` + selectFields;
|
131
|
+
} else {
|
132
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `?$select=*`;
|
133
|
+
}
|
134
|
+
if (expand != null && expand != "") {
|
135
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `&$expand=` + expand;
|
136
|
+
}
|
137
|
+
if (filters != null && filters != "") {
|
138
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `&$filter=` + filters;
|
139
|
+
}
|
140
|
+
if (orderBy != null && orderBy != "") {
|
141
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `&$orderby=` + orderBy;
|
142
|
+
}
|
143
|
+
if (top != null && top != undefined && top > 0) {
|
144
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `&$top=` + top;
|
145
|
+
}
|
146
|
+
|
147
|
+
await this.context.client
|
148
|
+
.get(queryUrlGetAllItems)
|
149
|
+
.then(async (response: any) => {
|
150
|
+
if (response.status >= 200 && response.status < 300) {
|
151
|
+
return await response.data.d;
|
152
|
+
} else {
|
153
|
+
return Promise.reject(new Error(JSON.stringify(response)));
|
154
|
+
}
|
155
|
+
})
|
156
|
+
.then(async (data: any) => {
|
157
|
+
if (data.results) {
|
158
|
+
for (let i = 0; i < data.results.length; i++) {
|
159
|
+
let item = data.results[i];
|
160
|
+
items.push(item);
|
161
|
+
}
|
162
|
+
}
|
163
|
+
let returnItem: IListItemsMetadata<T> = {
|
164
|
+
__next: data.__next,
|
165
|
+
results: items,
|
166
|
+
};
|
167
|
+
if (returnItem.__next != undefined && returnItem.__next.length > 0) {
|
168
|
+
items = await this.recursiveFetch(
|
169
|
+
returnItem.__next,
|
170
|
+
2,
|
171
|
+
maxRecursiveCount,
|
172
|
+
returnItem.results
|
173
|
+
);
|
174
|
+
}
|
175
|
+
})
|
176
|
+
.catch((ex: any) => {
|
177
|
+
console.log("load Items > JitzSPHttpClient.get()...catch:", ex);
|
178
|
+
throw ex;
|
179
|
+
});
|
180
|
+
return items;
|
181
|
+
}
|
182
|
+
|
183
|
+
private async recursiveFetch(
|
184
|
+
url: string,
|
185
|
+
recursiveCount: number = 1,
|
186
|
+
maxRecursiveCount: number = 5,
|
187
|
+
items: T[] = []
|
188
|
+
): Promise<T[]> {
|
189
|
+
items = items || [];
|
190
|
+
await this.context.client
|
191
|
+
.get(url)
|
192
|
+
.then(async (response: any) => {
|
193
|
+
if (response.status >= 200 && response.status < 300) {
|
194
|
+
return await response.data.d;
|
195
|
+
} else {
|
196
|
+
return Promise.reject(new Error(JSON.stringify(response)));
|
197
|
+
}
|
198
|
+
})
|
199
|
+
.then(async (data: any) => {
|
200
|
+
if (data.results) {
|
201
|
+
for (let i = 0; i < data.results.length; i++) {
|
202
|
+
let item = data.results[i];
|
203
|
+
items.push(item);
|
204
|
+
}
|
205
|
+
}
|
206
|
+
let returnItem: IListItemsMetadata<T> = {
|
207
|
+
__next: data.__next,
|
208
|
+
results: items,
|
209
|
+
};
|
210
|
+
|
211
|
+
if (
|
212
|
+
returnItem.__next != undefined &&
|
213
|
+
returnItem.__next.length > 0 &&
|
214
|
+
recursiveCount < maxRecursiveCount
|
215
|
+
) {
|
216
|
+
items = await this.recursiveFetch(
|
217
|
+
returnItem.__next,
|
218
|
+
recursiveCount + 1,
|
219
|
+
maxRecursiveCount,
|
220
|
+
returnItem.results
|
221
|
+
);
|
222
|
+
}
|
223
|
+
})
|
224
|
+
.catch((ex: any) => {
|
225
|
+
console.log("load Items > JitzSPHttpClient.get()...catch:", ex);
|
226
|
+
// throw ex; //Let it continue
|
227
|
+
});
|
228
|
+
return items;
|
229
|
+
}
|
230
|
+
|
231
|
+
public itemsCount(filters?: string) {
|
232
|
+
let queryUrlGetAllItems: string =
|
233
|
+
`${this.context.siteUrl}/_api/web/lists/GetByTitle('` +
|
234
|
+
this.listName +
|
235
|
+
`')/ItemCount`;
|
236
|
+
|
237
|
+
if (filters != null && filters != "") {
|
238
|
+
queryUrlGetAllItems = queryUrlGetAllItems + `?$filter=` + filters;
|
239
|
+
}
|
240
|
+
|
241
|
+
return this.context.client
|
242
|
+
.get(queryUrlGetAllItems)
|
243
|
+
.then((response: any) => {
|
244
|
+
if (response.status >= 200 && response.status < 300) {
|
245
|
+
return response.data.d.ItemCount;
|
246
|
+
} else {
|
247
|
+
return Promise.reject(new Error(JSON.stringify(response)));
|
248
|
+
}
|
249
|
+
})
|
250
|
+
.then((data: any) => {
|
251
|
+
return data;
|
252
|
+
})
|
253
|
+
.catch((ex: any) => {
|
254
|
+
console.log("loadEvents > JitzSPHttpClient.get()...catch:", ex);
|
255
|
+
throw ex;
|
256
|
+
});
|
257
|
+
}
|
258
|
+
|
259
|
+
public async getItemById(
|
260
|
+
id: number,
|
261
|
+
selectFields?: string,
|
262
|
+
expand?: string
|
263
|
+
): Promise<T> {
|
264
|
+
const queryUrl: string =
|
265
|
+
`${this.context.siteUrl}/_api/web/lists/getByTitle('` +
|
266
|
+
this.listName +
|
267
|
+
`')/items(` +
|
268
|
+
id +
|
269
|
+
`)` +
|
270
|
+
`?$select=*${selectFields != undefined ? `,${selectFields}` : ""}` +
|
271
|
+
`${expand != undefined ? `&$expand=${expand}` : ``}`;
|
272
|
+
|
273
|
+
return await this.context.client
|
274
|
+
.get(queryUrl)
|
275
|
+
.then((response: any) => {
|
276
|
+
if (response.status >= 200 && response.status < 300) {
|
277
|
+
return response.data.d;
|
278
|
+
} else {
|
279
|
+
return Promise.reject(new Error(JSON.stringify(response)));
|
280
|
+
}
|
281
|
+
})
|
282
|
+
.then((data: any) => {
|
283
|
+
return data;
|
284
|
+
})
|
285
|
+
.catch((ex: any) => {
|
286
|
+
console.log("loadEvents > JitzSPHttpClient.get()...catch:", ex);
|
287
|
+
throw ex;
|
288
|
+
});
|
289
|
+
}
|
290
|
+
|
291
|
+
public createItem(item: T): Promise<T> {
|
292
|
+
return this.getEntityType().then((entityType) => {
|
293
|
+
item.__metadata = {
|
294
|
+
type: entityType,
|
295
|
+
};
|
296
|
+
var requestUrl = `${this.context.siteUrl}/_api/web/lists/getbytitle('${this.listName}')/items`;
|
297
|
+
return this.context.client
|
298
|
+
.post(requestUrl, item, {
|
299
|
+
Accept: "application/json;odata=nometadata",
|
300
|
+
"Content-type": "application/json;odata=verbose",
|
301
|
+
"odata-version": "",
|
302
|
+
})
|
303
|
+
.then((response: any): Promise<T> => {
|
304
|
+
if (response.status >= 200 && response.status < 300) {
|
305
|
+
var json = response.data.d;
|
306
|
+
return json;
|
307
|
+
} else {
|
308
|
+
return Promise.reject(new Error(JSON.stringify(response)));
|
309
|
+
}
|
310
|
+
});
|
311
|
+
});
|
312
|
+
}
|
313
|
+
|
314
|
+
public updateItem(item: T): Promise<T> {
|
315
|
+
return this.getEntityType().then((entityType) => {
|
316
|
+
item.__metadata = {
|
317
|
+
//etag: "1",
|
318
|
+
type: entityType,
|
319
|
+
};
|
320
|
+
var requestUrl = `${this.context.siteUrl}/_api/web/lists/getbytitle('${this.listName}')/items(${item.Id})`;
|
321
|
+
return this.context.client
|
322
|
+
.post(requestUrl, item, {
|
323
|
+
Accept: "application/json;odata=nometadata",
|
324
|
+
"Content-type": "application/json;odata=verbose",
|
325
|
+
"odata-version": "",
|
326
|
+
"IF-MATCH": "*",
|
327
|
+
"X-HTTP-Method": "MERGE",
|
328
|
+
})
|
329
|
+
.then((response: any) => {
|
330
|
+
if (response.status >= 200 && response.status < 300) {
|
331
|
+
return item;
|
332
|
+
} else {
|
333
|
+
console.log(JSON.stringify(response));
|
334
|
+
return Promise.reject(new Error(JSON.stringify(response)));
|
335
|
+
}
|
336
|
+
});
|
337
|
+
});
|
338
|
+
}
|
339
|
+
|
340
|
+
public deleteItem(id: number): Promise<boolean> {
|
341
|
+
var requestUrl = `${this.context.siteUrl}/_api/web/lists/getbytitle('${this.listName}')/items(${id})`;
|
342
|
+
return this.context.client
|
343
|
+
.post(
|
344
|
+
requestUrl,
|
345
|
+
{},
|
346
|
+
{
|
347
|
+
Accept: "application/json;odata=nometadata",
|
348
|
+
"Content-type": "application/json;odata=verbose",
|
349
|
+
"odata-version": "",
|
350
|
+
"IF-MATCH": "*",
|
351
|
+
"X-HTTP-Method": "DELETE",
|
352
|
+
}
|
353
|
+
)
|
354
|
+
.then((response: any) => {
|
355
|
+
if (response.status >= 200 && response.status < 300) {
|
356
|
+
return true;
|
357
|
+
} else {
|
358
|
+
return Promise.reject(new Error(JSON.stringify(response)));
|
359
|
+
}
|
360
|
+
});
|
361
|
+
}
|
362
|
+
|
363
|
+
private getEntityType(): Promise<string> {
|
364
|
+
return new Promise<string>(
|
365
|
+
(
|
366
|
+
resolve: (listItemEntityTypeName: string) => void,
|
367
|
+
reject: (error: any) => void
|
368
|
+
): void => {
|
369
|
+
if (this._listEntityType) {
|
370
|
+
resolve(this._listEntityType);
|
371
|
+
return;
|
372
|
+
}
|
373
|
+
|
374
|
+
this.context.client
|
375
|
+
.get(
|
376
|
+
`${this.context.siteUrl}/_api/web/lists/getbytitle('${this.listName}')?$select=ListItemEntityTypeFullName`
|
377
|
+
)
|
378
|
+
.then(
|
379
|
+
(
|
380
|
+
response: any
|
381
|
+
): Promise<{ ListItemEntityTypeFullName: string }> => {
|
382
|
+
return response;
|
383
|
+
},
|
384
|
+
(error: any): void => {
|
385
|
+
reject(error);
|
386
|
+
}
|
387
|
+
)
|
388
|
+
.then((response: any): void => {
|
389
|
+
this._listEntityType = response.data.d.ListItemEntityTypeFullName;
|
390
|
+
resolve(this._listEntityType || "");
|
391
|
+
});
|
392
|
+
}
|
393
|
+
);
|
394
|
+
}
|
395
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { WebPartContext } from "@microsoft/sp-webpart-base";
|
2
|
+
import IJitzSPContext from "./IJitzSPContext";
|
3
|
+
import { MSGraphClientV3 } from "@microsoft/sp-http";
|
4
|
+
|
5
|
+
export default interface IJitzContext {
|
6
|
+
spContext: IJitzSPContext;
|
7
|
+
webpartContext: WebPartContext;
|
8
|
+
graphClient: MSGraphClientV3;
|
9
|
+
siteId: string;
|
10
|
+
init: () => void;
|
11
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import { IModel } from "./IModels";
|
2
|
+
import IJitzContext from "../interfaces/IJitzContext";
|
3
|
+
import { IRepository } from "./IRepository";
|
4
|
+
|
5
|
+
export interface IList<T extends IModel> {
|
6
|
+
context: IJitzContext;
|
7
|
+
listName: string;
|
8
|
+
repository: IRepository<T>;
|
9
|
+
getItems(
|
10
|
+
filter?: string,
|
11
|
+
orderby?: string,
|
12
|
+
top?: number,
|
13
|
+
skip?: number
|
14
|
+
): Promise<T[]>;
|
15
|
+
loadMore(): Promise<T[]>;
|
16
|
+
getItemById(id: number): Promise<T>;
|
17
|
+
getItemsRecursive(
|
18
|
+
filters?: string,
|
19
|
+
orderby?: string,
|
20
|
+
top?: number,
|
21
|
+
maxRecursiveCount?: number
|
22
|
+
): Promise<T[]>;
|
23
|
+
getItemsCount(filters?: string): Promise<number>;
|
24
|
+
create(item: T): Promise<T>;
|
25
|
+
update(item: T): Promise<T>;
|
26
|
+
delete(id: number): Promise<boolean>;
|
27
|
+
//New Ones
|
28
|
+
getItemsIndexed(
|
29
|
+
filterQuery?: string,
|
30
|
+
orderby?: string,
|
31
|
+
top?: number
|
32
|
+
): Promise<T[]>;
|
33
|
+
loadMoreIndexed(): Promise<T[]>;
|
34
|
+
_nextPageLink?: string;
|
35
|
+
top: number;
|
36
|
+
indexLimit: number;
|
37
|
+
upperId: number;
|
38
|
+
lowerId: number;
|
39
|
+
filters?: string;
|
40
|
+
orderBy?: string;
|
41
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
export interface IModel {
|
2
|
+
Id?: number;
|
3
|
+
Title?: string;
|
4
|
+
AuthorId?: number;
|
5
|
+
Author?: IPersonOrGroup;
|
6
|
+
__metadata?: {};
|
7
|
+
}
|
8
|
+
|
9
|
+
export interface IListItemsMetadata<T> {
|
10
|
+
__next?: string;
|
11
|
+
results: T[];
|
12
|
+
}
|
13
|
+
|
14
|
+
export interface IEmail {
|
15
|
+
properties: {
|
16
|
+
From?: string;
|
17
|
+
To: { results: string[] };
|
18
|
+
Body: string;
|
19
|
+
Subject: string;
|
20
|
+
__metadata?: {};
|
21
|
+
};
|
22
|
+
}
|
23
|
+
|
24
|
+
export interface IPersonOrGroup {
|
25
|
+
Id: number;
|
26
|
+
Title: string;
|
27
|
+
EMail: string;
|
28
|
+
Email: string;
|
29
|
+
Name: string;
|
30
|
+
LoginName: string;
|
31
|
+
IsGroup: boolean;
|
32
|
+
Groups?: IPersonOrGroup[];
|
33
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import IJitzSPContext from "./IJitzSPContext";
|
2
|
+
import { IModel } from "./IModels";
|
3
|
+
|
4
|
+
export interface IRepository<T extends IModel> {
|
5
|
+
context: IJitzSPContext;
|
6
|
+
listName: string;
|
7
|
+
getAll(
|
8
|
+
selectFields?: string,
|
9
|
+
expand?: string,
|
10
|
+
filters?: string,
|
11
|
+
orderBy?: string,
|
12
|
+
top?: number,
|
13
|
+
skip?: number,
|
14
|
+
skipTokenUniqueField?: string,
|
15
|
+
skipTokenUniqueFieldValue?: string
|
16
|
+
): Promise<T[]>;
|
17
|
+
getAllFromUrl(url: string): Promise<T[]>;
|
18
|
+
itemsCount(filters?: string): Promise<number>;
|
19
|
+
getItemById(id: number, selectFields?: string, expand?: string): Promise<T>;
|
20
|
+
createItem(item: T): Promise<T>;
|
21
|
+
updateItem(item: T): Promise<T>;
|
22
|
+
deleteItem(id: number): Promise<boolean>;
|
23
|
+
getAllRecursive(
|
24
|
+
selectFields?: string,
|
25
|
+
expand?: string,
|
26
|
+
filters?: string,
|
27
|
+
orderBy?: string,
|
28
|
+
top?: number,
|
29
|
+
maxRecursiveCount?: number
|
30
|
+
): any;
|
31
|
+
}
|
package/lib/common/IModels.d.ts
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
export interface IModel {
|
2
|
-
Id
|
2
|
+
Id?: number;
|
3
3
|
Title?: string;
|
4
4
|
AuthorId?: number;
|
5
5
|
Author?: IPersonOrGroup;
|
6
|
+
Created?: string;
|
7
|
+
Modified?: string;
|
6
8
|
__metadata?: {};
|
7
9
|
}
|
10
|
+
export interface IMultiUserFieldId {
|
11
|
+
results: number[];
|
12
|
+
}
|
13
|
+
export interface IMultiUserField {
|
14
|
+
results: IPersonOrGroup[];
|
15
|
+
}
|
8
16
|
export interface IListItemsMetadata<T> {
|
9
17
|
__next: string;
|
10
18
|
results: T[];
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import { IPersona } from "@fluentui/react";
|
2
|
+
export interface IJitzAlertNotificationProps {
|
3
|
+
hideMe: boolean;
|
4
|
+
isDraggable: boolean;
|
5
|
+
title: string;
|
6
|
+
message: string;
|
7
|
+
shouldRedirectOnClose: boolean;
|
8
|
+
onClose?: () => void;
|
9
|
+
}
|
10
|
+
export interface IJitzAlertNotificationState {
|
11
|
+
}
|
12
|
+
export interface IJitzPeoplePickerState {
|
13
|
+
currentPicker?: number | string;
|
14
|
+
delayResults?: boolean;
|
15
|
+
disabled: boolean;
|
16
|
+
selectedItems: any[];
|
17
|
+
}
|
18
|
+
export interface IPeopleSearchProps {
|
19
|
+
JobTitle: string;
|
20
|
+
PictureURL: string;
|
21
|
+
PreferredName: string;
|
22
|
+
}
|
23
|
+
export interface IUserEntityData {
|
24
|
+
IsAltSecIdPresent: string;
|
25
|
+
ObjectId: string;
|
26
|
+
Title: string;
|
27
|
+
Email: string;
|
28
|
+
MobilePhone: string;
|
29
|
+
OtherMails: string;
|
30
|
+
Department: string;
|
31
|
+
}
|
32
|
+
export interface IClientPeoplePickerSearchUser {
|
33
|
+
Key: string;
|
34
|
+
Description: string;
|
35
|
+
DisplayText: string;
|
36
|
+
EntityType: string;
|
37
|
+
Title: string;
|
38
|
+
ProviderDisplayName: string;
|
39
|
+
ProviderName: string;
|
40
|
+
IsResolved: boolean;
|
41
|
+
EntityData: IUserEntityData;
|
42
|
+
MultipleMatches: any[];
|
43
|
+
}
|
44
|
+
export interface IEnsureUser {
|
45
|
+
Email: string;
|
46
|
+
Id: number;
|
47
|
+
IsEmailAuthenticationGuestUser: boolean;
|
48
|
+
IsHiddenInUI: boolean;
|
49
|
+
IsShareByEmailGuestUser: boolean;
|
50
|
+
IsSiteAdmin: boolean;
|
51
|
+
LoginName: string;
|
52
|
+
PrincipalType: number;
|
53
|
+
Title: string;
|
54
|
+
UserId: {
|
55
|
+
NameId: string;
|
56
|
+
NameIdIssuer: string;
|
57
|
+
};
|
58
|
+
}
|
59
|
+
export interface IEnsurableSharePointUser extends IClientPeoplePickerSearchUser, IEnsureUser {
|
60
|
+
imageUrl?: string;
|
61
|
+
}
|
62
|
+
export declare class SharePointUserPersona implements IPersona {
|
63
|
+
private _user;
|
64
|
+
get User(): IEnsurableSharePointUser;
|
65
|
+
set User(user: IEnsurableSharePointUser);
|
66
|
+
constructor(user: IEnsurableSharePointUser);
|
67
|
+
primaryText: string;
|
68
|
+
secondaryText: string;
|
69
|
+
tertiaryText: string;
|
70
|
+
imageUrl: string;
|
71
|
+
imageShouldFadeIn: boolean;
|
72
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SharePointUserPersona = void 0;
|
4
|
+
var SharePointUserPersona = /** @class */ (function () {
|
5
|
+
function SharePointUserPersona(user) {
|
6
|
+
this.User = user;
|
7
|
+
}
|
8
|
+
Object.defineProperty(SharePointUserPersona.prototype, "User", {
|
9
|
+
get: function () {
|
10
|
+
return this._user;
|
11
|
+
},
|
12
|
+
set: function (user) {
|
13
|
+
this._user = user;
|
14
|
+
this.primaryText = user.Title;
|
15
|
+
//this.secondaryText = user.EntityData.Title;
|
16
|
+
//this.tertiaryText = user.EntityData.Department;
|
17
|
+
this.imageShouldFadeIn = true;
|
18
|
+
// if (this.User.Key != undefined)
|
19
|
+
// this.imageUrl = `/_layouts/15/userphoto.aspx?size=S&accountname=${this.User.Key.substr(
|
20
|
+
// this.User.Key.lastIndexOf("|") + 1
|
21
|
+
// )}`;
|
22
|
+
// else
|
23
|
+
// this.imageUrl = `/_layouts/15/userphoto.aspx?size=S&accountname=${this.User.Email}`;
|
24
|
+
},
|
25
|
+
enumerable: false,
|
26
|
+
configurable: true
|
27
|
+
});
|
28
|
+
return SharePointUserPersona;
|
29
|
+
}());
|
30
|
+
exports.SharePointUserPersona = SharePointUserPersona;
|