@fc-components/monaco-editor 0.1.19 → 0.1.21
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 +32 -8
- 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 +32 -8
- package/dist/monaco-editor.esm.js.map +1 -1
- package/dist/promql/index.d.ts +1 -0
- package/dist/sql/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/promql/index.tsx +7 -1
- package/src/sql/index.tsx +18 -2
package/dist/promql/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type * as monacoTypes from 'monaco-editor/esm/vs/editor/editor.api';
|
|
3
3
|
import type { DataProviderParams } from './types';
|
|
4
4
|
interface PromQLEditorProps {
|
|
5
|
+
className?: string;
|
|
5
6
|
size?: 'small' | 'middle' | 'large';
|
|
6
7
|
theme?: 'light' | 'dark';
|
|
7
8
|
value?: string;
|
package/dist/sql/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type * as monacoTypes from 'monaco-editor/esm/vs/editor/editor.api';
|
|
3
3
|
interface SqlEditorProps {
|
|
4
|
+
maxHeight?: number | string;
|
|
5
|
+
fontSize?: number;
|
|
4
6
|
size?: 'small' | 'middle' | 'large';
|
|
5
7
|
theme?: 'light' | 'dark';
|
|
6
8
|
value?: string;
|
package/package.json
CHANGED
package/src/promql/index.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import type { DataProviderParams } from './types';
|
|
|
14
14
|
import { validateQuery } from './validation';
|
|
15
15
|
|
|
16
16
|
interface PromQLEditorProps {
|
|
17
|
+
className?: string;
|
|
17
18
|
size?: 'small' | 'middle' | 'large';
|
|
18
19
|
theme?: 'light' | 'dark';
|
|
19
20
|
value?: string;
|
|
@@ -88,6 +89,7 @@ const getStyles = (placeholder?: string) => {
|
|
|
88
89
|
export default function PromQLEditor(props: PromQLEditorProps & DataProviderParams) {
|
|
89
90
|
const id = uuidv4();
|
|
90
91
|
const {
|
|
92
|
+
className = '',
|
|
91
93
|
size = 'middle',
|
|
92
94
|
theme = 'light',
|
|
93
95
|
value,
|
|
@@ -344,8 +346,12 @@ export default function PromQLEditor(props: PromQLEditorProps & DataProviderPara
|
|
|
344
346
|
'ant-input' +
|
|
345
347
|
(size ? ` ${SIZE_MAP[size].className}` : '') +
|
|
346
348
|
(disabled ? ` ant-input-disabled ${containerDisabledClassName}` : '') +
|
|
347
|
-
(readOnly ? ` ${containerReadOnlyClassName}` : '')
|
|
349
|
+
(readOnly ? ` ${containerReadOnlyClassName}` : '') +
|
|
350
|
+
` ${className}`
|
|
348
351
|
}
|
|
352
|
+
style={{
|
|
353
|
+
display: 'block',
|
|
354
|
+
}}
|
|
349
355
|
>
|
|
350
356
|
<div ref={containerRef}>
|
|
351
357
|
<MonacoEditor
|
package/src/sql/index.tsx
CHANGED
|
@@ -4,12 +4,12 @@ import * as monaco from 'monaco-editor';
|
|
|
4
4
|
import type * as monacoTypes from 'monaco-editor/esm/vs/editor/editor.api';
|
|
5
5
|
import { v4 as uuidv4 } from 'uuid';
|
|
6
6
|
import { css } from '@emotion/css';
|
|
7
|
-
|
|
8
7
|
import { language, languageConfiguration } from './sql';
|
|
9
8
|
import { getSqlCompletionProvider } from './completion/getCompletionProvider';
|
|
10
|
-
// import { validateSql } from './validation';
|
|
11
9
|
|
|
12
10
|
interface SqlEditorProps {
|
|
11
|
+
maxHeight?: number | string;
|
|
12
|
+
fontSize?: number;
|
|
13
13
|
size?: 'small' | 'middle' | 'large';
|
|
14
14
|
theme?: 'light' | 'dark';
|
|
15
15
|
value?: string;
|
|
@@ -31,22 +31,26 @@ const SIZE_MAP: Record<
|
|
|
31
31
|
className: string;
|
|
32
32
|
top: number;
|
|
33
33
|
bottom: number;
|
|
34
|
+
minHeight: number;
|
|
34
35
|
}
|
|
35
36
|
> = {
|
|
36
37
|
small: {
|
|
37
38
|
className: 'ant-input-sm',
|
|
38
39
|
top: 1,
|
|
39
40
|
bottom: 1,
|
|
41
|
+
minHeight: 24,
|
|
40
42
|
},
|
|
41
43
|
middle: {
|
|
42
44
|
className: 'ant-input-md',
|
|
43
45
|
top: 1,
|
|
44
46
|
bottom: 1,
|
|
47
|
+
minHeight: 32,
|
|
45
48
|
},
|
|
46
49
|
large: {
|
|
47
50
|
className: 'ant-input-lg',
|
|
48
51
|
top: 3,
|
|
49
52
|
bottom: 2,
|
|
53
|
+
minHeight: 40,
|
|
50
54
|
},
|
|
51
55
|
};
|
|
52
56
|
|
|
@@ -71,6 +75,8 @@ const containerReadOnlyClassName = css`
|
|
|
71
75
|
export default function SqlEditor(props: SqlEditorProps) {
|
|
72
76
|
const id = uuidv4();
|
|
73
77
|
const {
|
|
78
|
+
maxHeight,
|
|
79
|
+
fontSize,
|
|
74
80
|
size = 'middle',
|
|
75
81
|
theme = 'light',
|
|
76
82
|
value = '',
|
|
@@ -225,6 +231,12 @@ export default function SqlEditor(props: SqlEditorProps) {
|
|
|
225
231
|
(disabled ? ` ant-input-disabled ${containerDisabledClassName}` : '') +
|
|
226
232
|
(readOnly ? ` ${containerReadOnlyClassName}` : '')
|
|
227
233
|
}
|
|
234
|
+
style={{
|
|
235
|
+
resize: 'vertical',
|
|
236
|
+
overflow: 'auto',
|
|
237
|
+
minHeight: SIZE_MAP[size].minHeight,
|
|
238
|
+
maxHeight,
|
|
239
|
+
}}
|
|
228
240
|
>
|
|
229
241
|
<div ref={containerRef}>
|
|
230
242
|
<MonacoEditor
|
|
@@ -245,9 +257,12 @@ export default function SqlEditor(props: SqlEditorProps) {
|
|
|
245
257
|
readOnly: readOnly || disabled,
|
|
246
258
|
scrollBeyondLastLine: false,
|
|
247
259
|
smoothScrolling: true,
|
|
260
|
+
fontSize,
|
|
261
|
+
lineHeight: 24,
|
|
248
262
|
tabSize: 2,
|
|
249
263
|
wordWrap: 'on',
|
|
250
264
|
automaticLayout: true,
|
|
265
|
+
fixedOverflowWidgets: true,
|
|
251
266
|
glyphMargin: false,
|
|
252
267
|
lineNumbers: 'off',
|
|
253
268
|
lineNumbersMinChars: 0,
|
|
@@ -258,6 +273,7 @@ export default function SqlEditor(props: SqlEditorProps) {
|
|
|
258
273
|
placeholder: placeholder,
|
|
259
274
|
renderLineHighlight: 'none',
|
|
260
275
|
occurrencesHighlight: 'off',
|
|
276
|
+
scrollbar: { vertical: 'hidden', horizontal: 'hidden', alwaysConsumeMouseWheel: false },
|
|
261
277
|
}}
|
|
262
278
|
/>
|
|
263
279
|
</div>
|