jitz-sharepoint-utilities 2.0.11 → 2.0.14

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.
Files changed (60) hide show
  1. package/data/context/Repository.ts +1 -1
  2. package/package.json +1 -1
  3. package/lib/common/IModels.d.ts +0 -40
  4. package/lib/common/IModels.js +0 -2
  5. package/lib/common/IObjects.d.ts +0 -72
  6. package/lib/common/IObjects.js +0 -30
  7. package/lib/controls/JitzGrid.d.ts +0 -75
  8. package/lib/controls/JitzGrid.js +0 -606
  9. package/lib/controls/JitzImage.d.ts +0 -14
  10. package/lib/controls/JitzImage.js +0 -37
  11. package/lib/controls/JitzPeoplePicker.d.ts +0 -49
  12. package/lib/controls/JitzPeoplePicker.js +0 -311
  13. package/lib/controls/JitzPersonInfo.d.ts +0 -32
  14. package/lib/controls/JitzPersonInfo.js +0 -98
  15. package/lib/controls/JitzPersona.d.ts +0 -23
  16. package/lib/controls/JitzPersona.js +0 -48
  17. package/lib/data/context/CommonRepository.d.ts +0 -17
  18. package/lib/data/context/CommonRepository.js +0 -287
  19. package/lib/data/context/JitzContext.d.ts +0 -13
  20. package/lib/data/context/JitzContext.js +0 -80
  21. package/lib/data/context/JitzSPContext.d.ts +0 -8
  22. package/lib/data/context/JitzSPContext.js +0 -58
  23. package/lib/data/context/JitzSPHttpClient.d.ts +0 -14
  24. package/lib/data/context/JitzSPHttpClient.js +0 -173
  25. package/lib/data/context/List.d.ts +0 -39
  26. package/lib/data/context/List.js +0 -492
  27. package/lib/data/context/Repository.d.ts +0 -22
  28. package/lib/data/context/Repository.js +0 -486
  29. package/lib/data/interfaces/ICommonRepository.d.ts +0 -6
  30. package/lib/data/interfaces/ICommonRepository.js +0 -2
  31. package/lib/data/interfaces/IJitzContext.d.ts +0 -10
  32. package/lib/data/interfaces/IJitzContext.js +0 -2
  33. package/lib/data/interfaces/IJitzSPContext.d.ts +0 -6
  34. package/lib/data/interfaces/IJitzSPContext.js +0 -2
  35. package/lib/data/interfaces/IJitzSPHttpClient.d.ts +0 -6
  36. package/lib/data/interfaces/IJitzSPHttpClient.js +0 -2
  37. package/lib/data/interfaces/IList.d.ts +0 -26
  38. package/lib/data/interfaces/IList.js +0 -2
  39. package/lib/data/interfaces/IModels.d.ts +0 -32
  40. package/lib/data/interfaces/IModels.js +0 -2
  41. package/lib/data/interfaces/IRepository.d.ts +0 -17
  42. package/lib/data/interfaces/IRepository.js +0 -2
  43. package/lib/jitzHttpClient.d.ts +0 -11
  44. package/lib/jitzHttpClient.js +0 -37
  45. package/lib/jitzSPHttpClient.d.ts +0 -30
  46. package/lib/jitzSPHttpClient.js +0 -193
  47. package/lib/repositories/CommonRepository.d.ts +0 -17
  48. package/lib/repositories/CommonRepository.js +0 -288
  49. package/lib/repositories/ICommonRepository.d.ts +0 -6
  50. package/lib/repositories/ICommonRepository.js +0 -2
  51. package/lib/repositories/IRepository.d.ts +0 -13
  52. package/lib/repositories/IRepository.js +0 -2
  53. package/lib/repositories/Repository.d.ts +0 -18
  54. package/lib/repositories/Repository.js +0 -394
  55. package/lib/services/GraphService.d.ts +0 -10
  56. package/lib/services/GraphService.js +0 -105
  57. package/lib/services/UserService.d.ts +0 -15
  58. package/lib/services/UserService.js +0 -202
  59. package/lib/services/UtilityService.d.ts +0 -29
  60. package/lib/services/UtilityService.js +0 -254
@@ -1,606 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
54
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
55
- if (ar || !(i in from)) {
56
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
57
- ar[i] = from[i];
58
- }
59
- }
60
- return to.concat(ar || Array.prototype.slice.call(from));
61
- };
62
- Object.defineProperty(exports, "__esModule", { value: true });
63
- exports.JitzGrid = exports.DisplayMode = exports.SortOrder = void 0;
64
- var React = require("react");
65
- var UtilityService_1 = require("../services/UtilityService");
66
- var react_1 = require("@fluentui/react");
67
- var SortOrder;
68
- (function (SortOrder) {
69
- SortOrder["Asc"] = "asc";
70
- SortOrder["Desc"] = "desc";
71
- })(SortOrder || (exports.SortOrder = SortOrder = {}));
72
- var DisplayMode;
73
- (function (DisplayMode) {
74
- DisplayMode["Grid"] = "Grid";
75
- DisplayMode["Tile"] = "Tile";
76
- })(DisplayMode || (exports.DisplayMode = DisplayMode = {}));
77
- var JitzGrid = /** @class */ (function (_super) {
78
- __extends(JitzGrid, _super);
79
- function JitzGrid(props) {
80
- var _this = _super.call(this, props) || this;
81
- _this._getSelectedItems = function () {
82
- if (_this.props.onItemSelect != undefined) {
83
- _this.props.onItemSelect(_this._selection.getSelection());
84
- }
85
- return {};
86
- };
87
- _this.getSortOrderString = function (sortOrder, isPreviousNavigation) {
88
- if (sortOrder == SortOrder.Asc) {
89
- return isPreviousNavigation ? "desc" : "asc";
90
- }
91
- else {
92
- return isPreviousNavigation ? "asc" : "desc";
93
- }
94
- };
95
- _this.initalLoad = function () { return __awaiter(_this, void 0, void 0, function () {
96
- var list, data, items, rawShowingData_1;
97
- var _this = this;
98
- return __generator(this, function (_a) {
99
- switch (_a.label) {
100
- case 0: return [4 /*yield*/, this.setState({
101
- items: [],
102
- showingItems: [],
103
- rawData: [],
104
- showingRawData: [],
105
- })];
106
- case 1:
107
- _a.sent();
108
- list = this.props.list;
109
- data = [];
110
- items = [];
111
- return [4 /*yield*/, list
112
- .getItems(this.props.filterQuery, this.props.orderBy, this.props.pageSize || 100)
113
- .then(function (results) {
114
- data = results;
115
- _this.setState({ isItIndexedSearch: false });
116
- })
117
- .catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
118
- return __generator(this, function (_a) {
119
- switch (_a.label) {
120
- case 0: return [4 /*yield*/, list.getItemsIndexed(this.props.filterQuery, this.props.orderBy, this.props.pageSize || 100)];
121
- case 1:
122
- data = _a.sent();
123
- this.setState({ isItIndexedSearch: true });
124
- return [2 /*return*/];
125
- }
126
- });
127
- }); })];
128
- case 2:
129
- _a.sent();
130
- if (this.props.displayFields != undefined) {
131
- rawShowingData_1 = [];
132
- data.map(function (record) {
133
- var item = {};
134
- if (_this.props.displayFields != undefined) {
135
- _this.props.displayFields.map(function (field) {
136
- if (_this.hasKey(record, field)) {
137
- item[field] =
138
- typeof record[field] == "object"
139
- ? JSON.stringify(record[field])
140
- : record[field]; // works fine!
141
- }
142
- });
143
- items.push(item);
144
- rawShowingData_1.push(record);
145
- }
146
- });
147
- this.setState({
148
- items: items,
149
- showingItems: items,
150
- rawData: items,
151
- showingRawData: rawShowingData_1,
152
- columns: this._buildColumns(items),
153
- list: list,
154
- hasNextPage: (list._nextPageLink != undefined &&
155
- list._nextPageLink.length > 0) ||
156
- list.lowerId > 0,
157
- }, function () { });
158
- }
159
- return [2 /*return*/];
160
- }
161
- });
162
- }); };
163
- _this.loadMore = function () { return __awaiter(_this, void 0, void 0, function () {
164
- var list, data, items_1, rawShowingData_2, _a;
165
- var _this = this;
166
- return __generator(this, function (_b) {
167
- switch (_b.label) {
168
- case 0:
169
- _b.trys.push([0, 7, , 8]);
170
- list = this.state.list;
171
- data = [];
172
- if (!this.state.isItIndexedSearch) return [3 /*break*/, 2];
173
- return [4 /*yield*/, list.loadMoreIndexed()];
174
- case 1:
175
- data = _b.sent();
176
- return [3 /*break*/, 4];
177
- case 2: return [4 /*yield*/, list.loadMore()];
178
- case 3:
179
- data = _b.sent();
180
- _b.label = 4;
181
- case 4:
182
- if (!(this.props.displayFields != undefined)) return [3 /*break*/, 6];
183
- items_1 = [];
184
- rawShowingData_2 = [];
185
- data.map(function (record) {
186
- var item = {};
187
- if (_this.props.displayFields != undefined) {
188
- _this.props.displayFields.map(function (field) {
189
- if (_this.hasKey(record, field)) {
190
- item[field] =
191
- typeof record[field] == "object"
192
- ? JSON.stringify(record[field])
193
- : record[field]; // works fine!
194
- }
195
- });
196
- items_1.push(item);
197
- rawShowingData_2.push(record);
198
- }
199
- });
200
- if (data.length == 0) {
201
- //TODO: No more records message
202
- }
203
- return [4 /*yield*/, this.setState({
204
- items: __spreadArray(__spreadArray([], this.state.items, true), items_1, true),
205
- showingItems: __spreadArray(__spreadArray([], this.state.showingItems, true), items_1, true),
206
- rawData: items_1,
207
- showingRawData: __spreadArray(__spreadArray([], this.state.showingRawData, true), rawShowingData_2, true),
208
- list: list,
209
- hasNextPage: (list._nextPageLink != undefined &&
210
- list._nextPageLink.length > 0) ||
211
- list.lowerId > 0,
212
- }, function () { })];
213
- case 5:
214
- _b.sent();
215
- _b.label = 6;
216
- case 6: return [3 /*break*/, 8];
217
- case 7:
218
- _a = _b.sent();
219
- return [3 /*break*/, 8];
220
- case 8: return [2 /*return*/];
221
- }
222
- });
223
- }); };
224
- _this.downloadData = function () { return __awaiter(_this, void 0, void 0, function () {
225
- var items_2, data, _a;
226
- var _this = this;
227
- return __generator(this, function (_b) {
228
- switch (_b.label) {
229
- case 0:
230
- _b.trys.push([0, 3, , 4]);
231
- return [4 /*yield*/, this.setState({ downloading: true })];
232
- case 1:
233
- _b.sent();
234
- return [4 /*yield*/, this.initiateDownload()];
235
- case 2:
236
- _b.sent();
237
- items_2 = [];
238
- data = this.state.exportData;
239
- data.map(function (record) {
240
- var item = {};
241
- if (_this.props.exportFields != undefined) {
242
- _this.props.exportFields.map(function (field) {
243
- if (_this.hasKey(record, field)) {
244
- if (typeof record[field] == "object") {
245
- if (record[field] == null || record[field] == undefined) {
246
- item[field] = "";
247
- }
248
- else if (record[field].EMail != undefined) {
249
- if (record[field].Title != undefined) {
250
- item[field + "_Title"] = record[field].Title || "";
251
- }
252
- item[field + "_Email"] = record[field].EMail || "";
253
- }
254
- else if (record[field].Name != undefined) {
255
- item[field + "_Name"] = record[field].Name || "";
256
- }
257
- }
258
- else {
259
- item[field] = record[field];
260
- }
261
- // item[field] =
262
- // typeof record[field] == "object"
263
- // ? JSON.stringify(record[field])
264
- // : record[field]; // works fine!
265
- }
266
- else if (field.indexOf("/") > 0) {
267
- var lookUpField = field.split("/")[0];
268
- var lookUpValueColumn = field.split("/")[1];
269
- if (typeof record[lookUpField] == "object") {
270
- item[field] = record[lookUpField][lookUpValueColumn];
271
- }
272
- }
273
- });
274
- items_2.push(item);
275
- }
276
- });
277
- UtilityService_1.default.exportJsonAsExcelSheet(items_2, this.props.downloadFileName || "export");
278
- return [3 /*break*/, 4];
279
- case 3:
280
- _a = _b.sent();
281
- return [3 /*break*/, 4];
282
- case 4:
283
- this.setState({ downloading: false });
284
- return [2 /*return*/];
285
- }
286
- });
287
- }); };
288
- _this.initiateDownload = function () { return __awaiter(_this, void 0, void 0, function () {
289
- var list, data, items;
290
- var _this = this;
291
- return __generator(this, function (_a) {
292
- switch (_a.label) {
293
- case 0:
294
- list = this.props.list;
295
- data = [];
296
- items = [];
297
- return [4 /*yield*/, list
298
- .getItems(this.props.filterQuery, this.props.orderBy, 5000)
299
- .then(function (results) {
300
- data = results;
301
- _this.setState({ isItIndexedDownload: false });
302
- })
303
- .catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
304
- return __generator(this, function (_a) {
305
- switch (_a.label) {
306
- case 0: return [4 /*yield*/, list.getItemsIndexed(this.props.filterQuery, this.props.orderBy, 5000)];
307
- case 1:
308
- data = _a.sent();
309
- this.setState({ isItIndexedDownload: true });
310
- return [2 /*return*/];
311
- }
312
- });
313
- }); })];
314
- case 1:
315
- _a.sent();
316
- return [4 /*yield*/, this.setState({
317
- exportData: data,
318
- hasNextPageToDownload: (list._nextPageLink != undefined && list._nextPageLink.length > 0) ||
319
- list.lowerId > 0,
320
- })];
321
- case 2:
322
- _a.sent();
323
- if (!(this.state.hasNextPageToDownload === true)) return [3 /*break*/, 4];
324
- return [4 /*yield*/, this.continueDownload(list)];
325
- case 3:
326
- _a.sent();
327
- _a.label = 4;
328
- case 4: return [2 /*return*/];
329
- }
330
- });
331
- }); };
332
- _this.continueDownload = function (list) { return __awaiter(_this, void 0, void 0, function () {
333
- var data, _a;
334
- return __generator(this, function (_b) {
335
- switch (_b.label) {
336
- case 0:
337
- _b.trys.push([0, 8, , 9]);
338
- data = [];
339
- if (!this.state.isItIndexedDownload) return [3 /*break*/, 2];
340
- return [4 /*yield*/, list.loadMoreIndexed()];
341
- case 1:
342
- data = _b.sent();
343
- return [3 /*break*/, 4];
344
- case 2: return [4 /*yield*/, list.loadMore()];
345
- case 3:
346
- data = _b.sent();
347
- _b.label = 4;
348
- case 4: return [4 /*yield*/, this.setState({
349
- exportData: __spreadArray(__spreadArray([], this.state.exportData, true), data, true),
350
- hasNextPageToDownload: (list._nextPageLink != undefined && list._nextPageLink.length > 0) ||
351
- list.lowerId > 0,
352
- })];
353
- case 5:
354
- _b.sent();
355
- if (!(this.state.hasNextPageToDownload === true)) return [3 /*break*/, 7];
356
- return [4 /*yield*/, this.continueDownload(list)];
357
- case 6:
358
- _b.sent();
359
- _b.label = 7;
360
- case 7: return [3 /*break*/, 9];
361
- case 8:
362
- _a = _b.sent();
363
- return [3 /*break*/, 9];
364
- case 9: return [2 /*return*/];
365
- }
366
- });
367
- }); };
368
- _this.itemSelected = function (item, index) { };
369
- _this._buildColumns = function (items) {
370
- var columns = [];
371
- if (items != null && items.length > 0) {
372
- columns = (0, react_1.buildColumns)(items);
373
- }
374
- else if (_this.state.items != null &&
375
- _this.state.items != undefined &&
376
- _this.state.items.length > 0) {
377
- columns = (0, react_1.buildColumns)(_this.state.items);
378
- }
379
- var idIndex = 0;
380
- columns.map(function (raw, i) {
381
- raw.name = raw.name.split("_").join(" ");
382
- raw.name = raw.name.replace(/\b\w/g, function (l) {
383
- return l.toUpperCase();
384
- });
385
- if (raw.name == "Id") {
386
- idIndex = i;
387
- }
388
- });
389
- // columns = columns.filter(matchedColumns => matchedColumns.name != "Id" && matchedColumns.name !="ID");
390
- if (_this.props.modifyColumns != undefined &&
391
- _this.props.modifyColumns != null) {
392
- columns = _this.props.modifyColumns(columns);
393
- }
394
- return columns;
395
- };
396
- _this._renderItemColumn = function (item, index, column) {
397
- if (_this.state.showingRawData != null &&
398
- _this.state.showingRawData != undefined &&
399
- _this.state.showingRawData.length > 0) {
400
- if (column != undefined && column.fieldName != undefined) {
401
- var fieldContent = item[column.fieldName];
402
- if (_this.props.renderCustomColumns != undefined &&
403
- _this.props.renderCustomColumns != undefined) {
404
- return _this.props.renderCustomColumns(fieldContent, column.key, _this.state.showingRawData[index || 0]);
405
- }
406
- else {
407
- return React.createElement("span", null, fieldContent);
408
- }
409
- }
410
- }
411
- };
412
- _this._onColumnClick = function (event, column) {
413
- var columns = _this.state.columns;
414
- var items = _this.state.items;
415
- if (column != undefined && column.fieldName != undefined) {
416
- var isSortedDescending_1 = column.isSortedDescending;
417
- // If we've sorted this column, flip it.
418
- if (column.isSorted) {
419
- isSortedDescending_1 = !isSortedDescending_1;
420
- }
421
- // Sort the items.
422
- items = items.concat([]).sort(function (a, b) {
423
- var firstValue = column.fieldName != undefined ? a[column.fieldName] : undefined;
424
- var secondValue = column.fieldName != undefined ? b[column.fieldName] : undefined;
425
- if (isSortedDescending_1) {
426
- return firstValue > secondValue ? -1 : 1;
427
- }
428
- else {
429
- return firstValue > secondValue ? 1 : -1;
430
- }
431
- });
432
- // Reset the items and columns to match the state.
433
- _this.setState({
434
- items: items,
435
- columns: columns.map(function (col) {
436
- col.isSorted = col.key === column.key;
437
- if (col.isSorted) {
438
- col.isSortedDescending = isSortedDescending_1;
439
- }
440
- return col;
441
- }),
442
- });
443
- }
444
- };
445
- _this._onItemInvoked = function (item, index) {
446
- if (_this.props.onItemInvoked != undefined &&
447
- _this.props.onItemInvoked != null) {
448
- _this.props.onItemInvoked(item, index);
449
- }
450
- };
451
- var item = {};
452
- if (props.displayFields) {
453
- props.displayFields.map(function (field) {
454
- item[field] = "";
455
- });
456
- }
457
- _this.state = {
458
- list: _this.props.list,
459
- listForDownload: _this.props.list,
460
- items: [],
461
- showingItems: [],
462
- rawData: [],
463
- showingRawData: [],
464
- exportData: [],
465
- totalCount: 0,
466
- columns: [],
467
- displayMode: props.displayMode || DisplayMode.Tile,
468
- filterQuery: props.filterQuery,
469
- isItIndexedSearch: false,
470
- isItIndexedDownload: false,
471
- processing: false,
472
- downloading: false,
473
- hasNextPage: false,
474
- hasNextPageToDownload: false,
475
- };
476
- _this._selection = new react_1.Selection({
477
- onSelectionChanged: function () {
478
- return _this.setState({ selectedItems: _this._getSelectedItems() });
479
- },
480
- });
481
- return _this;
482
- }
483
- // private hasKey<O>(obj: O, key: keyof any): key is keyof O {
484
- // return key in obj;
485
- // }
486
- JitzGrid.prototype.hasKey = function (obj, key) {
487
- return key in obj;
488
- };
489
- JitzGrid.prototype.componentDidMount = function () {
490
- this.initalLoad();
491
- };
492
- JitzGrid.prototype.componentWillReceiveProps = function (nextProps) {
493
- return __awaiter(this, void 0, void 0, function () {
494
- return __generator(this, function (_a) {
495
- switch (_a.label) {
496
- case 0:
497
- if (!(nextProps.filterQuery != this.state.filterQuery)) return [3 /*break*/, 2];
498
- return [4 /*yield*/, this.setState({ filterQuery: nextProps.filterQuery })];
499
- case 1:
500
- _a.sent();
501
- this.initalLoad();
502
- _a.label = 2;
503
- case 2: return [2 /*return*/];
504
- }
505
- });
506
- });
507
- };
508
- JitzGrid.prototype.render = function () {
509
- var _this = this;
510
- return (React.createElement("div", { className: "ms-Grid", dir: "ltr" },
511
- this.props.hasExport == true &&
512
- this.state.showingItems != undefined &&
513
- this.state.showingItems.length > 0 && (React.createElement("div", { className: "ms-Grid-row" },
514
- React.createElement("div", { className: "ms-Grid-col ms-sm12 ms-md12 ms-lg12" },
515
- React.createElement(react_1.CommandBar, { farItems: [
516
- {
517
- key: "grid",
518
- text: "",
519
- title: "Grid View",
520
- disabled: this.state.displayMode === DisplayMode.Grid,
521
- iconProps: { iconName: "Table" },
522
- onClick: function () {
523
- _this.setState({ displayMode: DisplayMode.Grid });
524
- },
525
- },
526
- {
527
- key: "tile",
528
- text: "",
529
- title: "Tile View",
530
- disabled: this.state.displayMode === DisplayMode.Tile,
531
- iconProps: { iconName: "Tiles" },
532
- onClick: function () {
533
- _this.setState({ displayMode: DisplayMode.Tile });
534
- },
535
- },
536
- {
537
- key: "export",
538
- text: "",
539
- title: "Download",
540
- iconProps: { iconName: "Download" },
541
- onClick: function () {
542
- _this.downloadData();
543
- },
544
- },
545
- ], items: [
546
- {
547
- key: "total",
548
- text: "Showing ".concat(this.state.items.length, " records"),
549
- title: "Showing ".concat(this.state.items.length, " records"),
550
- onClick: function () { },
551
- },
552
- // {
553
- // key: "loadMore",
554
- // text: "Try to get more older records",
555
- // title: "Try to get more older records",
556
- // iconProps: { iconName: "DoubleChevronDown" },
557
- // onClick: () => {
558
- // if (this.state.processing != true)
559
- // this.setState({ processing: true }, async () => {
560
- // await this.loadMore();
561
- // this.setState({ processing: false });
562
- // });
563
- // },
564
- // },
565
- ] }),
566
- this.state.downloading && React.createElement(react_1.Spinner, { label: "Please wait..." })))),
567
- (this.state.showingItems == undefined ||
568
- this.state.showingItems.length > 0) && (React.createElement("div", { className: "ms-Grid-row" },
569
- React.createElement("div", { className: "ms-Grid-col ms-sm12 ms-md12 ms-lg12" },
570
- this.state.displayMode === DisplayMode.Grid && (React.createElement(react_1.DetailsList, { items: this.state.showingItems != undefined
571
- ? this.state.showingItems
572
- : [], setKey: "Id", columns: this.state.columns, onRenderItemColumn: this._renderItemColumn, onColumnHeaderClick: this._onColumnClick, onItemInvoked: this._onItemInvoked, onShouldVirtualize: function () { return false; }, onColumnHeaderContextMenu: this._onColumnHeaderContextMenu, onActiveItemChanged: function (item, index) {
573
- _this.itemSelected(item, index);
574
- }, selectionMode: this.props.selectionMode || react_1.SelectionMode.none, selection: this._selection })),
575
- this.state.displayMode === DisplayMode.Tile &&
576
- this.state.showingItems != undefined &&
577
- this.state.showingItems.length > 0 &&
578
- this.state.showingItems.map(function (item) {
579
- return _this.props.tileComponent != undefined ? (_this.props.tileComponent(item)) : (React.createElement(React.Fragment, null));
580
- })))),
581
- (this.state.showingItems == undefined ||
582
- this.state.showingItems.length == 0) && (React.createElement("div", { className: "ms-Grid-row" },
583
- React.createElement("div", { className: "ms-Grid-col ms-sm12 ms-md12 ms-lg12 centralizeContent ".concat(this.props.noRecordsMessageCssClass || "") }, this.props.noRecordsMessage || "No records found"))),
584
- React.createElement("div", { className: "ms-Grid-row" },
585
- React.createElement("div", { className: "ms-Grid-col ms-sm12 ms-md12 ms-lg12 centralizeContent loadMoreGrid ".concat(this.props.noRecordsMessageCssClass || "") },
586
- this.state.processing !== true && this.state.hasNextPage && (React.createElement(react_1.ActionButton, { iconProps: { iconName: "DoubleChevronDown" }, onClick: function () {
587
- _this.setState({ processing: true }, function () { return __awaiter(_this, void 0, void 0, function () {
588
- return __generator(this, function (_a) {
589
- switch (_a.label) {
590
- case 0: return [4 /*yield*/, this.loadMore()];
591
- case 1:
592
- _a.sent();
593
- this.setState({ processing: false });
594
- return [2 /*return*/];
595
- }
596
- });
597
- }); });
598
- } }, "Try to get more older records")),
599
- this.state.processing && React.createElement(react_1.Spinner, { label: "Please wait..." })))));
600
- };
601
- JitzGrid.prototype._onColumnHeaderContextMenu = function (column, ev) {
602
- // console.log(`column ${column!.key} contextmenu opened.`);
603
- };
604
- return JitzGrid;
605
- }(React.Component));
606
- exports.JitzGrid = JitzGrid;
@@ -1,14 +0,0 @@
1
- import * as React from "react";
2
- export interface IJitzImageProps {
3
- email?: string;
4
- siteUrl: string;
5
- width?: number;
6
- height?: number;
7
- className?: string;
8
- }
9
- export interface IJitzImageState {
10
- }
11
- export declare class JitzImage1 extends React.Component<IJitzImageProps, IJitzImageState> {
12
- constructor(props: IJitzImageProps, state: IJitzImageState);
13
- render(): React.ReactElement<IJitzImageProps>;
14
- }
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.JitzImage1 = void 0;
19
- var React = require("react");
20
- var react_1 = require("@fluentui/react");
21
- var JitzImage1 = /** @class */ (function (_super) {
22
- __extends(JitzImage1, _super);
23
- function JitzImage1(props, state) {
24
- var _this = _super.call(this, props) || this;
25
- _this.state = {};
26
- return _this;
27
- }
28
- JitzImage1.prototype.render = function () {
29
- var _this = this;
30
- return (React.createElement(react_1.Image, { src: "".concat(encodeURIComponent(this.props.email || "")), alt: "", onError: function (e) {
31
- e.target.onerror = null;
32
- e.target.src = "".concat(_this.props.siteUrl, "/_layouts/15/userphoto.aspx?size=L&accountname=").concat(_this.props.email);
33
- }, width: this.props.width, height: this.props.height, className: this.props.className }));
34
- };
35
- return JitzImage1;
36
- }(React.Component));
37
- exports.JitzImage1 = JitzImage1;