mgwdev-m365-components 0.0.2 → 0.0.3
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/{dist → lib}/App.d.ts +3 -3
- package/lib/App.js +212 -0
- package/{dist → lib}/components/Test.d.ts +4 -4
- package/lib/components/Test.js +37 -0
- package/lib/components/common/GraphPersona.d.ts +10 -0
- package/lib/components/common/GraphPersona.js +125 -0
- package/lib/components/common/graphEntityPicker/AbstractGraphEntityPicker.d.ts +16 -0
- package/lib/components/common/graphEntityPicker/AbstractGraphEntityPicker.js +117 -0
- package/lib/components/common/graphEntityPicker/ChannelPicker.d.ts +11 -0
- package/lib/components/common/graphEntityPicker/ChannelPicker.js +83 -0
- package/lib/components/common/graphEntityPicker/DrivePicker.d.ts +11 -0
- package/lib/components/common/graphEntityPicker/DrivePicker.js +77 -0
- package/lib/components/common/graphEntityPicker/ListPicker.d.ts +11 -0
- package/lib/components/common/graphEntityPicker/ListPicker.js +77 -0
- package/lib/components/common/graphEntityPicker/PeoplePicker.d.ts +8 -0
- package/lib/components/common/graphEntityPicker/PeoplePicker.js +76 -0
- package/lib/components/common/graphEntityPicker/SitePicker.d.ts +8 -0
- package/lib/components/common/graphEntityPicker/SitePicker.js +73 -0
- package/lib/components/common/graphEntityPicker/TeamPicker.d.ts +8 -0
- package/lib/components/common/graphEntityPicker/TeamPicker.js +77 -0
- package/lib/components/common/graphEntityPicker/index.d.ts +6 -0
- package/lib/components/common/graphEntityPicker/index.js +6 -0
- package/lib/components/common/index.d.ts +2 -0
- package/lib/components/common/index.js +2 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/provisioning/GetSiteTemplate.d.ts +6 -0
- package/lib/components/provisioning/GetSiteTemplate.js +41 -0
- package/lib/components/search/DefaultDocumentCard.d.ts +7 -0
- package/lib/components/search/DefaultDocumentCard.js +59 -0
- package/lib/components/search/M365Search.d.ts +18 -0
- package/lib/components/search/M365Search.js +69 -0
- package/lib/components/search/SearchDefaults.d.ts +1 -0
- package/lib/components/search/SearchDefaults.js +17 -0
- package/lib/components/search/index.d.ts +2 -0
- package/lib/components/search/index.js +2 -0
- package/{dist → lib}/context/AuthenticationContext.d.ts +11 -13
- package/lib/context/AuthenticationContext.js +50 -0
- package/lib/context/DataverseContext.d.ts +13 -0
- package/lib/context/DataverseContext.js +29 -0
- package/{dist → lib}/context/GraphContext.d.ts +11 -11
- package/lib/context/GraphContext.js +26 -0
- package/{dist → lib}/context/SPContext.d.ts +13 -13
- package/lib/context/SPContext.js +30 -0
- package/{dist → lib}/context/index.d.ts +4 -3
- package/lib/context/index.js +4 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/{dist → lib}/main.d.ts +1 -1
- package/lib/main.js +6 -0
- package/lib/model/IEntityWithIdAndDisplayName.d.ts +4 -0
- package/lib/model/IEntityWithIdAndDisplayName.js +1 -0
- package/lib/model/ISearchResult.d.ts +19 -0
- package/lib/model/ISearchResult.js +1 -0
- package/lib/model/index.d.ts +1 -0
- package/lib/model/index.js +1 -0
- package/lib/model/infra/ICacheEntry.d.ts +4 -0
- package/lib/model/infra/ICacheEntry.js +1 -0
- package/lib/service-worker/sw.d.ts +3 -0
- package/lib/service-worker/sw.js +20 -0
- package/lib/services/PersonaService.d.ts +12 -0
- package/lib/services/PersonaService.js +134 -0
- package/lib/utils/FileUtils.d.ts +29 -0
- package/lib/utils/FileUtils.js +200 -0
- package/lib/utils/StringUtils.d.ts +1 -0
- package/lib/utils/StringUtils.js +10 -0
- package/lib/utils/ThumbnailUtils.d.ts +7 -0
- package/lib/utils/ThumbnailUtils.js +92 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +3 -0
- package/package.json +2 -5
- package/dist/components/index.d.ts +0 -0
- package/dist/index.d.ts +0 -1
- package/dist/mwdev-m365-components.es.js +0 -10570
- package/dist/mwdev-m365-components.umd.js +0 -57
- package/dist/vite.svg +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import * as React from "react";
|
|
49
|
+
import { AbstractGraphEntityPicker } from "./AbstractGraphEntityPicker";
|
|
50
|
+
import { useGraph } from "../../../context";
|
|
51
|
+
export function DrivePicker(props) {
|
|
52
|
+
var graphClient = useGraph().graphClient;
|
|
53
|
+
return React.createElement(DrivePickerStandalone, __assign({}, props, { graphClient: graphClient, siteId: props.siteId }));
|
|
54
|
+
}
|
|
55
|
+
export function DrivePickerStandalone(props) {
|
|
56
|
+
var _this = this;
|
|
57
|
+
var getData = function (search) { return __awaiter(_this, void 0, void 0, function () {
|
|
58
|
+
var api, response, result;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
switch (_a.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
api = props.siteId ? "/sites/".concat(props.siteId, "/drives?$select=id,name") : "/me/drives?$select=id,name";
|
|
63
|
+
if (search) {
|
|
64
|
+
api += "&$filter=startswith(name, '".concat(search, "')");
|
|
65
|
+
}
|
|
66
|
+
return [4 /*yield*/, props.graphClient.get(api)];
|
|
67
|
+
case 1:
|
|
68
|
+
response = _a.sent();
|
|
69
|
+
return [4 /*yield*/, response.json()];
|
|
70
|
+
case 2:
|
|
71
|
+
result = _a.sent();
|
|
72
|
+
return [2 /*return*/, result.value.map(function (x) { return ({ id: x.id, displayName: x.name }); })];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); };
|
|
76
|
+
return React.createElement(AbstractGraphEntityPicker, __assign({ additionalKey: "drive-picker-".concat(props.siteId) }, props, { onDataRequested: getData }));
|
|
77
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IAbstractGraphEntityPickerProps } from "./AbstractGraphEntityPicker";
|
|
3
|
+
import { IEntityWithIdAndDisplayName } from "../../../model/IEntityWithIdAndDisplayName";
|
|
4
|
+
import { IHttpClient } from "mgwdev-m365-helpers";
|
|
5
|
+
export declare function ListPickerPicker(props: Partial<IAbstractGraphEntityPickerProps<IEntityWithIdAndDisplayName>> & {
|
|
6
|
+
siteId: string;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
export declare function ListPickerStandalone(props: Partial<IAbstractGraphEntityPickerProps<IEntityWithIdAndDisplayName>> & {
|
|
9
|
+
graphClient: IHttpClient;
|
|
10
|
+
siteId: string;
|
|
11
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import * as React from "react";
|
|
49
|
+
import { AbstractGraphEntityPicker } from "./AbstractGraphEntityPicker";
|
|
50
|
+
import { useGraph } from "../../../context";
|
|
51
|
+
export function ListPickerPicker(props) {
|
|
52
|
+
var graphClient = useGraph().graphClient;
|
|
53
|
+
return React.createElement(ListPickerStandalone, __assign({}, props, { graphClient: graphClient, siteId: props.siteId }));
|
|
54
|
+
}
|
|
55
|
+
export function ListPickerStandalone(props) {
|
|
56
|
+
var _this = this;
|
|
57
|
+
var getData = function (search) { return __awaiter(_this, void 0, void 0, function () {
|
|
58
|
+
var api, response, result;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
switch (_a.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
api = "/sites/".concat(props.siteId, "/lists?$select=id,name");
|
|
63
|
+
if (search) {
|
|
64
|
+
api += "&$filter=startswith(name, '".concat(search, "')");
|
|
65
|
+
}
|
|
66
|
+
return [4 /*yield*/, props.graphClient.get(api)];
|
|
67
|
+
case 1:
|
|
68
|
+
response = _a.sent();
|
|
69
|
+
return [4 /*yield*/, response.json()];
|
|
70
|
+
case 2:
|
|
71
|
+
result = _a.sent();
|
|
72
|
+
return [2 /*return*/, result.value.map(function (x) { return ({ id: x.id, displayName: x.name }); })];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); };
|
|
76
|
+
return React.createElement(AbstractGraphEntityPicker, __assign({ additionalKey: "list-picker-".concat(props.siteId) }, props, { onDataRequested: getData }));
|
|
77
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IAbstractGraphEntityPickerProps } from "./AbstractGraphEntityPicker";
|
|
3
|
+
import { IEntityWithIdAndDisplayName } from "../../../model/IEntityWithIdAndDisplayName";
|
|
4
|
+
import { IHttpClient } from "mgwdev-m365-helpers";
|
|
5
|
+
export declare function PeoplePicker(props: Partial<IAbstractGraphEntityPickerProps<IEntityWithIdAndDisplayName>>): React.JSX.Element;
|
|
6
|
+
export declare function PeoplePickerStandalone(props: Partial<IAbstractGraphEntityPickerProps<IEntityWithIdAndDisplayName>> & {
|
|
7
|
+
graphClient: IHttpClient;
|
|
8
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import * as React from "react";
|
|
49
|
+
import { AbstractGraphEntityPicker } from "./AbstractGraphEntityPicker";
|
|
50
|
+
import { useGraph } from "../../../context";
|
|
51
|
+
import { PeopleProvider } from "mgwdev-m365-helpers";
|
|
52
|
+
import { GraphPersona } from "../GraphPersona";
|
|
53
|
+
export function PeoplePicker(props) {
|
|
54
|
+
var graphClient = useGraph().graphClient;
|
|
55
|
+
return React.createElement(PeoplePickerStandalone, __assign({}, props, { graphClient: graphClient }));
|
|
56
|
+
}
|
|
57
|
+
export function PeoplePickerStandalone(props) {
|
|
58
|
+
var _this = this;
|
|
59
|
+
var peopleProvider = new PeopleProvider(props.graphClient, true, true);
|
|
60
|
+
var getData = function (search) { return __awaiter(_this, void 0, void 0, function () {
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
switch (_a.label) {
|
|
63
|
+
case 0:
|
|
64
|
+
peopleProvider.setQuery(search);
|
|
65
|
+
return [4 /*yield*/, peopleProvider.getData()];
|
|
66
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); };
|
|
70
|
+
return React.createElement(AbstractGraphEntityPicker, __assign({}, props, { additionalKey: "people-picker", onDataRequested: getData, onSuggestionRendering: function (user) {
|
|
71
|
+
if (user.photo) {
|
|
72
|
+
user.photo = "data:image/png;base64,".concat(user.photo.replace('"', "").replace('"', ""));
|
|
73
|
+
}
|
|
74
|
+
return React.createElement(GraphPersona, { showPresence: true, user: user, graphClient: props.graphClient });
|
|
75
|
+
} }));
|
|
76
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IAbstractGraphEntityPickerProps } from "./AbstractGraphEntityPicker";
|
|
3
|
+
import { IEntityWithIdAndDisplayName } from "../../../model/IEntityWithIdAndDisplayName";
|
|
4
|
+
import { IHttpClient } from "mgwdev-m365-helpers";
|
|
5
|
+
export declare function SitePicker(props: Partial<IAbstractGraphEntityPickerProps<IEntityWithIdAndDisplayName>>): React.JSX.Element;
|
|
6
|
+
export declare function SitePickerStandalone(props: Partial<IAbstractGraphEntityPickerProps<IEntityWithIdAndDisplayName>> & {
|
|
7
|
+
graphClient: IHttpClient;
|
|
8
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import * as React from "react";
|
|
49
|
+
import { AbstractGraphEntityPicker } from "./AbstractGraphEntityPicker";
|
|
50
|
+
import { useGraph } from "../../../context";
|
|
51
|
+
import { GraphSearchPagedDataProvider } from "mgwdev-m365-helpers";
|
|
52
|
+
export function SitePicker(props) {
|
|
53
|
+
var graphClient = useGraph().graphClient;
|
|
54
|
+
return React.createElement(SitePickerStandalone, __assign({}, props, { graphClient: graphClient }));
|
|
55
|
+
}
|
|
56
|
+
export function SitePickerStandalone(props) {
|
|
57
|
+
var _this = this;
|
|
58
|
+
var dataProvider = React.useRef(new GraphSearchPagedDataProvider(props.graphClient, ["site"], ["id", "displayName"]));
|
|
59
|
+
var getData = function (search) { return __awaiter(_this, void 0, void 0, function () {
|
|
60
|
+
var results;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
switch (_a.label) {
|
|
63
|
+
case 0:
|
|
64
|
+
dataProvider.current.setQuery(search || "*");
|
|
65
|
+
return [4 /*yield*/, dataProvider.current.getData()];
|
|
66
|
+
case 1:
|
|
67
|
+
results = _a.sent();
|
|
68
|
+
return [2 /*return*/, results];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}); };
|
|
72
|
+
return React.createElement(AbstractGraphEntityPicker, __assign({}, props, { onDataRequested: getData }));
|
|
73
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IAbstractGraphEntityPickerProps } from "./AbstractGraphEntityPicker";
|
|
3
|
+
import { IEntityWithIdAndDisplayName } from "../../../model/IEntityWithIdAndDisplayName";
|
|
4
|
+
import { IHttpClient } from "mgwdev-m365-helpers";
|
|
5
|
+
export declare function TeamPicker(props: Partial<IAbstractGraphEntityPickerProps<IEntityWithIdAndDisplayName>>): React.JSX.Element;
|
|
6
|
+
export declare function TeamPickerStandalone(props: Partial<IAbstractGraphEntityPickerProps<IEntityWithIdAndDisplayName>> & {
|
|
7
|
+
graphClient: IHttpClient;
|
|
8
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import * as React from "react";
|
|
49
|
+
import { AbstractGraphEntityPicker } from "./AbstractGraphEntityPicker";
|
|
50
|
+
import { useGraph } from "../../../context";
|
|
51
|
+
export function TeamPicker(props) {
|
|
52
|
+
var graphClient = useGraph().graphClient;
|
|
53
|
+
return React.createElement(TeamPickerStandalone, __assign({}, props, { graphClient: graphClient }));
|
|
54
|
+
}
|
|
55
|
+
export function TeamPickerStandalone(props) {
|
|
56
|
+
var _this = this;
|
|
57
|
+
var getData = function (search) { return __awaiter(_this, void 0, void 0, function () {
|
|
58
|
+
var api, response, result;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
switch (_a.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
api = "/teams?$select=id,displayName&$top=8";
|
|
63
|
+
if (search) {
|
|
64
|
+
api += "&$filter=startswith(displayName, '".concat(search, "')");
|
|
65
|
+
}
|
|
66
|
+
return [4 /*yield*/, props.graphClient.get(api)];
|
|
67
|
+
case 1:
|
|
68
|
+
response = _a.sent();
|
|
69
|
+
return [4 /*yield*/, response.json()];
|
|
70
|
+
case 2:
|
|
71
|
+
result = _a.sent();
|
|
72
|
+
return [2 /*return*/, result.value];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); };
|
|
76
|
+
return React.createElement(AbstractGraphEntityPicker, __assign({ additionalKey: "team-site-picker" }, props, { onDataRequested: getData }));
|
|
77
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Button } from "@fluentui/react-components";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useSP } from "../../context";
|
|
4
|
+
import { TemplateProvider } from "mgwdev-m365-helpers/lib/services/provisioning/TemplateProvider";
|
|
5
|
+
export function GetSiteTemplate(props) {
|
|
6
|
+
var _a = React.useState(undefined), template = _a[0], setTemplate = _a[1];
|
|
7
|
+
var _b = React.useState(0), progress = _b[0], setProgress = _b[1];
|
|
8
|
+
var _c = React.useState(false), loading = _c[0], setLoading = _c[1];
|
|
9
|
+
var _d = React.useState(""), stage = _d[0], setStage = _d[1];
|
|
10
|
+
var _e = useSP(), spClient = _e.spClient, siteUrl = _e.siteUrl;
|
|
11
|
+
var provider = React.useRef(new TemplateProvider(spClient, siteUrl));
|
|
12
|
+
provider.current.onProgress = function (message, percent) {
|
|
13
|
+
setProgress(percent);
|
|
14
|
+
setStage(message);
|
|
15
|
+
};
|
|
16
|
+
return (React.createElement("div", null,
|
|
17
|
+
React.createElement(Button, { appearance: "primary", onClick: function () {
|
|
18
|
+
setLoading(true);
|
|
19
|
+
setProgress(0);
|
|
20
|
+
setStage("Lists");
|
|
21
|
+
provider.current.getSiteTemplate().then(function (template) {
|
|
22
|
+
setTemplate(template);
|
|
23
|
+
setLoading(false);
|
|
24
|
+
;
|
|
25
|
+
});
|
|
26
|
+
} }, "Get template"),
|
|
27
|
+
React.createElement(Button, { disabled: !template, appearance: "primary", onClick: function () {
|
|
28
|
+
var blob = new Blob([JSON.stringify(template, null, 2)], { type: "application/json" });
|
|
29
|
+
var url = URL.createObjectURL(blob);
|
|
30
|
+
var a = document.createElement('a');
|
|
31
|
+
a.href = url;
|
|
32
|
+
a.download = "template.json";
|
|
33
|
+
document.body.appendChild(a);
|
|
34
|
+
a.click();
|
|
35
|
+
window.URL.revokeObjectURL(url);
|
|
36
|
+
} }, "Download Template")));
|
|
37
|
+
}
|
|
38
|
+
export function GetSiteTemplateContext() {
|
|
39
|
+
var siteUrl = useSP().siteUrl;
|
|
40
|
+
return React.createElement(GetSiteTemplate, { siteUrl: siteUrl });
|
|
41
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IDocumentSearchResult, IGraphSearchResult } from "../../model";
|
|
3
|
+
export interface IDefaultDocumentCardProps {
|
|
4
|
+
document: IGraphSearchResult<IDocumentSearchResult>;
|
|
5
|
+
onClick?: (document: IGraphSearchResult<IDocumentSearchResult>) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const DefaultDocumentCard: (props: IDefaultDocumentCardProps) => React.JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
import { useGraph } from "../../context";
|
|
14
|
+
import { ThumbnailUtils } from "../../utils";
|
|
15
|
+
import { Body1, Button, Caption1, Card, CardFooter, CardHeader, CardPreview, makeStyles, shorthands, tokens } from "@fluentui/react-components";
|
|
16
|
+
import FileUtils from "../../utils/FileUtils";
|
|
17
|
+
var useStyles = makeStyles({
|
|
18
|
+
title: __assign({}, shorthands.margin(0, 0, "12px")),
|
|
19
|
+
description: __assign({}, shorthands.margin(0, 0, "12px")),
|
|
20
|
+
card: {
|
|
21
|
+
width: "20rem",
|
|
22
|
+
maxWidth: "100%",
|
|
23
|
+
height: "fit-content",
|
|
24
|
+
},
|
|
25
|
+
image: {
|
|
26
|
+
width: "20rem",
|
|
27
|
+
height: "7rem",
|
|
28
|
+
},
|
|
29
|
+
text: __assign({}, shorthands.margin(0)),
|
|
30
|
+
imageIconWrapper: {
|
|
31
|
+
width: "20rem!important",
|
|
32
|
+
height: "7rem!important",
|
|
33
|
+
display: "flex!important",
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
backgroundColor: tokens.colorNeutralBackground3,
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
export var DefaultDocumentCard = function (props) {
|
|
40
|
+
var graphClient = useGraph().graphClient;
|
|
41
|
+
var styles = useStyles();
|
|
42
|
+
var _a = React.useState(undefined), thumbnail = _a[0], setThumbnail = _a[1];
|
|
43
|
+
React.useEffect(function () {
|
|
44
|
+
ThumbnailUtils.getThumbnailImageFromGraph(props.document.fields, graphClient).then(function (thumbnail) {
|
|
45
|
+
setThumbnail(thumbnail);
|
|
46
|
+
}).catch(function (error) {
|
|
47
|
+
console.error(error);
|
|
48
|
+
});
|
|
49
|
+
}, []);
|
|
50
|
+
return React.createElement(Card, { className: styles.card },
|
|
51
|
+
React.createElement(CardPreview, null, thumbnail ? React.createElement("img", { src: thumbnail, alt: props.document.fields.title, className: styles.image }) :
|
|
52
|
+
React.createElement("div", { className: styles.imageIconWrapper },
|
|
53
|
+
React.createElement("div", null,
|
|
54
|
+
React.createElement("img", { src: FileUtils.getFileImageUrl(props.document.fields.path), width: "32px", height: "32px", alt: props.document.fields.title })))),
|
|
55
|
+
React.createElement(CardHeader, { image: React.createElement("img", { src: FileUtils.getFileImageUrl(props.document.fields.path), width: "32px", height: "32px", alt: props.document.fields.title }), header: React.createElement(Body1, null,
|
|
56
|
+
React.createElement("b", null, props.document.fields.title)), description: React.createElement(Caption1, null, props.document.fields.author), action: React.createElement(Button, { appearance: "transparent", "aria-label": "More options" }) }),
|
|
57
|
+
React.createElement("p", { className: styles.text }, props.document.fields.description),
|
|
58
|
+
React.createElement(CardFooter, null));
|
|
59
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { IAggregationRequest } from "mgwdev-m365-helpers";
|
|
3
|
+
import { IGraphSearchResult } from "../../model";
|
|
4
|
+
export interface IM365SearchProps<T> {
|
|
5
|
+
onResultRendering?: (result: IGraphSearchResult<T>) => any;
|
|
6
|
+
dataProviderProps?: {
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
initialQuery?: string;
|
|
9
|
+
entityType?: "message" | "event" | "driveItem" | "listItem" | "person" | "chatMessage" | "externalItem";
|
|
10
|
+
queryTemplate?: string;
|
|
11
|
+
selectFields?: string[];
|
|
12
|
+
aggregations?: IAggregationRequest[];
|
|
13
|
+
};
|
|
14
|
+
searchInputComponent?: (props: {
|
|
15
|
+
onSearch: (query: string) => void;
|
|
16
|
+
}) => JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
export declare const M365Search: <T>(props: IM365SearchProps<T>) => React.JSX.Element;
|