@pnp/spfx-controls-react 3.7.0-beta.1939354 → 3.7.0-beta.1948936
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/lib/common/telemetry/version.js +1 -1
- package/lib/controls/listPicker/IListPicker.d.ts +2 -2
- package/lib/controls/listPicker/IListPicker.d.ts.map +1 -1
- package/lib/controls/monacoEditor/Error.d.ts +7 -0
- package/lib/controls/monacoEditor/Error.d.ts.map +1 -0
- package/lib/controls/monacoEditor/Error.js +12 -0
- package/lib/controls/monacoEditor/Error.js.map +1 -0
- package/lib/controls/monacoEditor/IMonacoEditorProps.d.ts +25 -0
- package/lib/controls/monacoEditor/IMonacoEditorProps.d.ts.map +1 -0
- package/lib/controls/monacoEditor/IMonacoEditorProps.js +14 -0
- package/lib/controls/monacoEditor/IMonacoEditorProps.js.map +1 -0
- package/lib/controls/monacoEditor/MonacoEditor.d.ts +4 -0
- package/lib/controls/monacoEditor/MonacoEditor.d.ts.map +1 -0
- package/lib/controls/monacoEditor/MonacoEditor.js +77 -0
- package/lib/controls/monacoEditor/MonacoEditor.js.map +1 -0
- package/lib/controls/monacoEditor/index.d.ts +3 -0
- package/lib/controls/monacoEditor/index.d.ts.map +1 -0
- package/lib/controls/monacoEditor/index.js +3 -0
- package/lib/controls/monacoEditor/index.js.map +1 -0
- package/lib/controls/monacoEditor/useMonaco.d.ts +11 -0
- package/lib/controls/monacoEditor/useMonaco.d.ts.map +1 -0
- package/lib/controls/monacoEditor/useMonaco.js +81 -0
- package/lib/controls/monacoEditor/useMonaco.js.map +1 -0
- package/lib/controls/monacoEditor/useMonacoEditorStyles.d.ts +8 -0
- package/lib/controls/monacoEditor/useMonacoEditorStyles.d.ts.map +1 -0
- package/lib/controls/monacoEditor/useMonacoEditorStyles.js +13 -0
- package/lib/controls/monacoEditor/useMonacoEditorStyles.js.map +1 -0
- package/package.json +4 -1
- package/release/webpack-stats/sp-dev-fx-controls-react.stats.json +1572 -1542
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var version = "3.7.0-beta.
|
|
1
|
+
export var version = "3.7.0-beta.1948936";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LibsOrderBy } from "../../services/ISPService";
|
|
2
|
-
import { BaseComponentContext } from '@microsoft/sp-component-base';
|
|
3
1
|
import { IDropdownOption } from "office-ui-fabric-react/lib/Dropdown";
|
|
2
|
+
import { BaseComponentContext } from "@microsoft/sp-component-base";
|
|
3
|
+
import { LibsOrderBy } from "../../services/ISPService";
|
|
4
4
|
export interface IListPickerProps {
|
|
5
5
|
/**
|
|
6
6
|
* The web part context
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IListPicker.d.ts","sourceRoot":"","sources":["../../../src/controls/listPicker/IListPicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"IListPicker.d.ts","sourceRoot":"","sources":["../../../src/controls/listPicker/IListPicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B;;MAEE;IACF,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;MAEE;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;MAEE;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;MAEE;IACF,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC;;MAEE;IACF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;MAEE;IACF,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;MAGE;IACF,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC;;MAEE;IACF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;MAEE;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;MAEE;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;MAEE;IACF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;MAEE;IACF,kBAAkB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IAC3D;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;MAEE;IACF,aAAa,CAAC,EAAE,MAAM,CAAC;IACrB;;IAEA;IACC,aAAa,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;MAEE;IACF,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B;;MAEE;IACF,OAAO,EAAE,OAAO,CAAC;IACjB;;MAEE;IACF,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../../src/controls/monacoEditor/Error.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAatD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Stack } from "office-ui-fabric-react/lib/components/Stack";
|
|
2
|
+
import { MessageBarType, MessageBar } from "office-ui-fabric-react/lib/MessageBar";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export var Error = function (props) {
|
|
5
|
+
var error = props.error, show = props.show;
|
|
6
|
+
return (React.createElement(React.Fragment, null,
|
|
7
|
+
"(show && error) ?",
|
|
8
|
+
React.createElement(Stack, { horizontal: true, horizontalAlign: "start" },
|
|
9
|
+
React.createElement(MessageBar, { isMultiline: true, messageBarType: MessageBarType.error }, error.message)),
|
|
10
|
+
": null;"));
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=Error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Error.js","sourceRoot":"","sources":["../../../src/controls/monacoEditor/Error.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,6CAA6C,CAAC;AACpE,OAAO,EAAE,cAAc,EAAG,UAAU,EAAC,MAAM,uCAAuC,CAAC;AACnF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,CAAC,IAAM,KAAK,GAAyC,UAAC,KAA2C;IAC7F,IAAA,KAAK,GAAW,KAAK,MAAhB,EAAE,IAAI,GAAK,KAAK,KAAV,CAAW;IAC9B,OAAO,CACL;;QAEE,oBAAC,KAAK,IAAC,UAAU,QAAC,eAAe,EAAC,OAAO;YACvC,oBAAC,UAAU,IAAC,WAAW,QAAC,cAAc,EAAE,cAAc,CAAC,KAAK,IACzD,KAAK,CAAC,OAAO,CACH,CACP;kBAEP,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as monaco from "monaco-editor";
|
|
2
|
+
export declare enum Elanguages {
|
|
3
|
+
typescript = "typescript",
|
|
4
|
+
javascript = "javascript",
|
|
5
|
+
css = "css",
|
|
6
|
+
html = "html",
|
|
7
|
+
json = "json",
|
|
8
|
+
xml = "xml",
|
|
9
|
+
markdown = "markdown",
|
|
10
|
+
less = "less",
|
|
11
|
+
scss = "scss",
|
|
12
|
+
handlebars = "handlebars"
|
|
13
|
+
}
|
|
14
|
+
export interface IMonacoEditorProps {
|
|
15
|
+
value: string;
|
|
16
|
+
theme?: string;
|
|
17
|
+
readOnly?: boolean;
|
|
18
|
+
showLineNumbers?: boolean;
|
|
19
|
+
showMiniMap?: boolean;
|
|
20
|
+
onValueChange?: (newValue: string, validationErrors: string[]) => void;
|
|
21
|
+
language: string | Elanguages;
|
|
22
|
+
jsonDiagnosticsOptions?: monaco.languages.json.DiagnosticsOptions;
|
|
23
|
+
jscriptDiagnosticsOptions?: monaco.languages.typescript.DiagnosticsOptions;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=IMonacoEditorProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMonacoEditorProps.d.ts","sourceRoot":"","sources":["../../../src/controls/monacoEditor/IMonacoEditorProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,oBAAY,UAAU;IAClB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,UAAU,eAAe;CAG5B;AACD,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,EAAE,KAAK,IAAI,CAAC;IACpE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,kBAAkB,CAAC;IAClE,yBAAyB,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC;CAE5E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export var Elanguages;
|
|
2
|
+
(function (Elanguages) {
|
|
3
|
+
Elanguages["typescript"] = "typescript";
|
|
4
|
+
Elanguages["javascript"] = "javascript";
|
|
5
|
+
Elanguages["css"] = "css";
|
|
6
|
+
Elanguages["html"] = "html";
|
|
7
|
+
Elanguages["json"] = "json";
|
|
8
|
+
Elanguages["xml"] = "xml";
|
|
9
|
+
Elanguages["markdown"] = "markdown";
|
|
10
|
+
Elanguages["less"] = "less";
|
|
11
|
+
Elanguages["scss"] = "scss";
|
|
12
|
+
Elanguages["handlebars"] = "handlebars";
|
|
13
|
+
})(Elanguages || (Elanguages = {}));
|
|
14
|
+
//# sourceMappingURL=IMonacoEditorProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IMonacoEditorProps.js","sourceRoot":"","sources":["../../../src/controls/monacoEditor/IMonacoEditorProps.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,UAaX;AAbD,WAAY,UAAU;IAClB,uCAAyB,CAAA;IACzB,uCAAyB,CAAA;IACzB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,mCAAqB,CAAA;IACrB,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,uCAAyB,CAAA;AAG7B,CAAC,EAbW,UAAU,KAAV,UAAU,QAarB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MonacoEditor.d.ts","sourceRoot":"","sources":["../../../src/controls/monacoEditor/MonacoEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAO1D,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CA6FpE,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { isEmpty } from "lodash";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Elanguages } from ".";
|
|
4
|
+
import { useMonacoEditorStyles } from "./useMonacoEditorStyles";
|
|
5
|
+
import { EStatus, useMonaco } from "./useMonaco";
|
|
6
|
+
import { Spinner, SpinnerSize } from "office-ui-fabric-react/lib/Spinner";
|
|
7
|
+
import { Stack } from "office-ui-fabric-react/lib/Stack";
|
|
8
|
+
import { Error } from "./Error";
|
|
9
|
+
export var MonacoEditor = function (props) {
|
|
10
|
+
var _a = props || {}, value = _a.value, onValueChange = _a.onValueChange, theme = _a.theme, readOnly = _a.readOnly, showLineNumbers = _a.showLineNumbers, showMiniMap = _a.showMiniMap, language = _a.language, jsonDiagnosticsOptions = _a.jsonDiagnosticsOptions, jscriptDiagnosticsOptions = _a.jscriptDiagnosticsOptions;
|
|
11
|
+
var containerRef = React.useRef(null);
|
|
12
|
+
var editorRef = React.useRef(null);
|
|
13
|
+
var controlClasses = useMonacoEditorStyles().controlClasses;
|
|
14
|
+
var _b = useMonaco(), monaco = _b.monaco, status = _b.status, error = _b.error;
|
|
15
|
+
var onDidChangeModelContent = React.useCallback(function (e) {
|
|
16
|
+
if (editorRef.current) {
|
|
17
|
+
var currentValue = editorRef.current.getValue();
|
|
18
|
+
if (currentValue !== value) {
|
|
19
|
+
var validationErrors = [];
|
|
20
|
+
try {
|
|
21
|
+
if (language === Elanguages.json) {
|
|
22
|
+
var jsonParsed = JSON.parse(currentValue);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
validationErrors.push(e.message);
|
|
27
|
+
}
|
|
28
|
+
console.log(currentValue);
|
|
29
|
+
onValueChange(currentValue, validationErrors);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, [onValueChange]);
|
|
33
|
+
React.useEffect(function () {
|
|
34
|
+
if (status != EStatus.LOADED)
|
|
35
|
+
return;
|
|
36
|
+
if (!isEmpty(jsonDiagnosticsOptions) && language === Elanguages.json) {
|
|
37
|
+
monaco.languages.json.jsonDefaults.setDiagnosticsOptions(jsonDiagnosticsOptions);
|
|
38
|
+
}
|
|
39
|
+
if (!isEmpty(jscriptDiagnosticsOptions) && language === Elanguages.javascript) {
|
|
40
|
+
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions(jscriptDiagnosticsOptions);
|
|
41
|
+
}
|
|
42
|
+
monaco.editor.onDidCreateModel(function (m) {
|
|
43
|
+
m.updateOptions({
|
|
44
|
+
tabSize: 2,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//Create the MonacoEditor
|
|
48
|
+
editorRef.current = monaco.editor.create(containerRef.current, {
|
|
49
|
+
value: value,
|
|
50
|
+
scrollBeyondLastLine: false,
|
|
51
|
+
theme: theme,
|
|
52
|
+
language: language,
|
|
53
|
+
folding: true,
|
|
54
|
+
readOnly: readOnly,
|
|
55
|
+
lineNumbersMinChars: 4,
|
|
56
|
+
lineNumbers: showLineNumbers ? "on" : "off",
|
|
57
|
+
minimap: {
|
|
58
|
+
enabled: showMiniMap,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
editorRef.current.onDidChangeModelContent(onDidChangeModelContent);
|
|
62
|
+
return function () {
|
|
63
|
+
var _a;
|
|
64
|
+
(_a = editorRef === null || editorRef === void 0 ? void 0 : editorRef.current) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
65
|
+
};
|
|
66
|
+
}, [jsonDiagnosticsOptions, jscriptDiagnosticsOptions, monaco]);
|
|
67
|
+
if (status === EStatus.LOADING) {
|
|
68
|
+
return (React.createElement(Stack, { horizontal: true, horizontalAlign: "center", tokens: { padding: 25 } },
|
|
69
|
+
React.createElement(Spinner, { size: SpinnerSize.medium })));
|
|
70
|
+
}
|
|
71
|
+
if (status === EStatus.ERROR) {
|
|
72
|
+
return React.createElement(Error, { error: error, show: true });
|
|
73
|
+
}
|
|
74
|
+
return (React.createElement(React.Fragment, null,
|
|
75
|
+
React.createElement("div", { ref: containerRef, className: controlClasses.containerStyles })));
|
|
76
|
+
};
|
|
77
|
+
//# sourceMapping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|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/controls/monacoEditor/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMonaco.d.ts","sourceRoot":"","sources":["../../../src/controls/monacoEditor/useMonaco.ts"],"names":[],"mappings":"AAIA,oBAAY,OAAO;IACjB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,KAAK,IAAA;CACN;AAED,eAAO,MAAM,SAAS;;;;CAyBrB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
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;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { useState, useEffect } from "react";
|
|
38
|
+
import loader from "@monaco-editor/loader";
|
|
39
|
+
var CDN_PATH_TO_MONACO_EDITOR = "https://cdn.jsdelivr.net/npm/monaco-editor@0.32.1/min/vs";
|
|
40
|
+
export var EStatus;
|
|
41
|
+
(function (EStatus) {
|
|
42
|
+
EStatus[EStatus["LOADING"] = 0] = "LOADING";
|
|
43
|
+
EStatus[EStatus["LOADED"] = 1] = "LOADED";
|
|
44
|
+
EStatus[EStatus["ERROR"] = 2] = "ERROR";
|
|
45
|
+
})(EStatus || (EStatus = {}));
|
|
46
|
+
export var useMonaco = function () {
|
|
47
|
+
var _a = useState(undefined), monaco = _a[0], setMonaco = _a[1];
|
|
48
|
+
var _b = useState(EStatus.LOADING), status = _b[0], setStatus = _b[1];
|
|
49
|
+
var _c = useState(undefined), error = _c[0], setError = _c[1];
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
var monacoObj, error_1;
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
switch (_a.label) {
|
|
55
|
+
case 0:
|
|
56
|
+
_a.trys.push([0, 2, , 3]);
|
|
57
|
+
loader.config({ paths: { vs: CDN_PATH_TO_MONACO_EDITOR } });
|
|
58
|
+
return [4 /*yield*/, loader.init()];
|
|
59
|
+
case 1:
|
|
60
|
+
monacoObj = _a.sent();
|
|
61
|
+
setStatus(EStatus.LOADED);
|
|
62
|
+
setMonaco(monacoObj);
|
|
63
|
+
return [3 /*break*/, 3];
|
|
64
|
+
case 2:
|
|
65
|
+
error_1 = _a.sent();
|
|
66
|
+
setStatus(EStatus.ERROR);
|
|
67
|
+
setMonaco(undefined);
|
|
68
|
+
setError(error_1);
|
|
69
|
+
return [3 /*break*/, 3];
|
|
70
|
+
case 3: return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}); })();
|
|
74
|
+
}, []);
|
|
75
|
+
return {
|
|
76
|
+
monaco: monaco,
|
|
77
|
+
status: status,
|
|
78
|
+
error: error,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=useMonaco.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMonaco.js","sourceRoot":"","sources":["../../../src/controls/monacoEditor/useMonaco.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,MAAkB,MAAM,uBAAuB,CAAC;AAEvD,IAAM,yBAAyB,GAAG,0DA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,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { mergeStyleSets } from "office-ui-fabric-react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export var useMonacoEditorStyles = function () {
|
|
4
|
+
var controlClasses = React.useMemo(function () {
|
|
5
|
+
return mergeStyleSets({
|
|
6
|
+
containerStyles: {
|
|
7
|
+
height: "800px",
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
}, []);
|
|
11
|
+
return { controlClasses: controlClasses };
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useMonacoEditorStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMonacoEditorStyles.js","sourceRoot":"","sources":["../../../src/controls/monacoEditor/useMonacoEditorStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,IAAM,qBAAqB,GAAG;IACnC,IAAM,cAAc,GAAI,KAAK,CAAC,OAAO,CAAC;QAClC,OAAO,cAAc,CAAC;YACpB,eAAe,EAAC;gBACd,MAAM,EAAE,OAAO;aAChB;SACF,CAAC,CAAC;IACP,CAAC,EAAC,EAAE,CAAC,CAAC;IAEN,OAAO,EAAC,cAAc,gBAAA,EAAE,CAAC;AAC3B,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnp/spfx-controls-react",
|
|
3
3
|
"description": "Reusable React controls for SharePoint Framework solutions",
|
|
4
|
-
"version": "3.7.0-beta.
|
|
4
|
+
"version": "3.7.0-beta.1948936",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "gulp build",
|
|
7
7
|
"clean": "gulp clean",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@microsoft/sp-office-ui-fabric-core": "1.14.0",
|
|
35
35
|
"@microsoft/sp-property-pane": "1.14.0",
|
|
36
36
|
"@microsoft/sp-webpart-base": "1.14.0",
|
|
37
|
+
"@monaco-editor/loader": "^1.2.0",
|
|
37
38
|
"@pnp/sp": "2.5.0",
|
|
38
39
|
"@pnp/telemetry-js": "2.0.0",
|
|
39
40
|
"@popperjs/core": "2.5.4",
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"he": "^1.2.0",
|
|
49
50
|
"lodash": "4.17.21",
|
|
50
51
|
"markdown-it": "^12.3.2",
|
|
52
|
+
"monaco-editor": "^0.32.1",
|
|
51
53
|
"office-ui-fabric-react": "7.174.1",
|
|
52
54
|
"react": "16.13.1",
|
|
53
55
|
"react-accessible-accordion": "^3.3.3",
|
|
@@ -96,6 +98,7 @@
|
|
|
96
98
|
"spfx-fast-serve-helpers": "~1.13.0",
|
|
97
99
|
"ts-jest": "^25.5.1",
|
|
98
100
|
"tslib": "2.0.0",
|
|
101
|
+
"tslint-microsoft-contrib": "6.2.0",
|
|
99
102
|
"webpack-bundle-analyzer": "^4.1.0"
|
|
100
103
|
},
|
|
101
104
|
"repository": {
|