@fc-components/monaco-editor 0.1.5 → 0.1.6
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/monaco-editor.cjs.development.js +12 -19
- package/dist/monaco-editor.cjs.development.js.map +1 -1
- package/dist/monaco-editor.cjs.production.min.js +1 -1
- package/dist/monaco-editor.cjs.production.min.js.map +1 -1
- package/dist/monaco-editor.esm.js +13 -20
- package/dist/monaco-editor.esm.js.map +1 -1
- package/dist/promql/index.d.ts +4 -2
- package/package.json +1 -1
- package/src/promql/index.tsx +25 -18
|
@@ -1990,7 +1990,7 @@ var getStyles = function getStyles(placeholder) {
|
|
|
1990
1990
|
})
|
|
1991
1991
|
};
|
|
1992
1992
|
};
|
|
1993
|
-
|
|
1993
|
+
function PromQLEditor(props) {
|
|
1994
1994
|
var id = uuid.v4();
|
|
1995
1995
|
var _props$size = props.size,
|
|
1996
1996
|
size = _props$size === void 0 ? 'middle' : _props$size,
|
|
@@ -2004,14 +2004,13 @@ var index = /*#__PURE__*/React.forwardRef(function PromQLEditor(props, ref) {
|
|
|
2004
2004
|
enableAutocomplete = _props$enableAutocomp === void 0 ? true : _props$enableAutocomp,
|
|
2005
2005
|
onChange = props.onChange,
|
|
2006
2006
|
onShiftEnter = props.onShiftEnter,
|
|
2007
|
-
onBlur = props.onBlur
|
|
2007
|
+
onBlur = props.onBlur,
|
|
2008
|
+
editorDidMount = props.editorDidMount;
|
|
2008
2009
|
var autocompleteDisposeFun = React.useRef(null);
|
|
2009
2010
|
var containerRef = React.useRef(null);
|
|
2010
2011
|
var dataProviderRef = React.useRef(null);
|
|
2011
|
-
var editorRef = React.useRef(null);
|
|
2012
2012
|
var styles = getStyles(placeholder);
|
|
2013
2013
|
var handleEditorDidMount = function handleEditorDidMount(editor) {
|
|
2014
|
-
editorRef.current = editor;
|
|
2015
2014
|
monaco.editor.defineTheme('n9e-dark', {
|
|
2016
2015
|
base: 'vs-dark',
|
|
2017
2016
|
inherit: true,
|
|
@@ -2119,13 +2118,8 @@ var index = /*#__PURE__*/React.forwardRef(function PromQLEditor(props, ref) {
|
|
|
2119
2118
|
monaco.editor.setModelMarkers(model, 'owner', markers);
|
|
2120
2119
|
}
|
|
2121
2120
|
});
|
|
2121
|
+
editorDidMount == null || editorDidMount(editor);
|
|
2122
2122
|
};
|
|
2123
|
-
React.useEffect(function () {
|
|
2124
|
-
var dataProvider = dataProviderRef.current;
|
|
2125
|
-
if (dataProvider) {
|
|
2126
|
-
dataProvider.setVariablesNames(variablesNames || []);
|
|
2127
|
-
}
|
|
2128
|
-
}, [JSON.stringify(variablesNames)]);
|
|
2129
2123
|
React.useEffect(function () {
|
|
2130
2124
|
// 注册 PromQL 语言
|
|
2131
2125
|
var aliases = monacoPromql.promLanguageDefinition.aliases,
|
|
@@ -2145,13 +2139,12 @@ var index = /*#__PURE__*/React.forwardRef(function PromQLEditor(props, ref) {
|
|
|
2145
2139
|
autocompleteDisposeFun.current == null || autocompleteDisposeFun.current();
|
|
2146
2140
|
};
|
|
2147
2141
|
}, []);
|
|
2148
|
-
React.
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
});
|
|
2142
|
+
React.useEffect(function () {
|
|
2143
|
+
var dataProvider = dataProviderRef.current;
|
|
2144
|
+
if (dataProvider) {
|
|
2145
|
+
dataProvider.setVariablesNames(variablesNames || []);
|
|
2146
|
+
}
|
|
2147
|
+
}, [JSON.stringify(variablesNames)]);
|
|
2155
2148
|
return React__default.createElement("div", {
|
|
2156
2149
|
className: 'ant-input' + (size ? " " + SIZE_MAP[size].className : '')
|
|
2157
2150
|
}, React__default.createElement("div", {
|
|
@@ -2197,7 +2190,7 @@ var index = /*#__PURE__*/React.forwardRef(function PromQLEditor(props, ref) {
|
|
|
2197
2190
|
wordWrap: 'on'
|
|
2198
2191
|
}
|
|
2199
2192
|
})));
|
|
2200
|
-
}
|
|
2193
|
+
}
|
|
2201
2194
|
|
|
2202
|
-
exports.PromQLMonacoEditor =
|
|
2195
|
+
exports.PromQLMonacoEditor = PromQLEditor;
|
|
2203
2196
|
//# sourceMappingURL=monaco-editor.cjs.development.js.map
|