@fc-components/monaco-editor 0.3.2 → 0.3.4
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 +17 -9
- 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 +17 -9
- package/dist/monaco-editor.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/sql/format.ts +5 -0
- package/src/sql/index.tsx +5 -7
package/package.json
CHANGED
package/src/sql/format.ts
CHANGED
|
@@ -5,6 +5,11 @@ export function formatSql(sql: string): string {
|
|
|
5
5
|
return format(sql, {
|
|
6
6
|
tabWidth: 2,
|
|
7
7
|
keywordCase: 'upper',
|
|
8
|
+
// Treat custom $__ prefixed macros (like $__timeFilter, $__timeRange, etc.)
|
|
9
|
+
// as parameter placeholders so the formatter doesn't choke on them.
|
|
10
|
+
paramTypes: {
|
|
11
|
+
custom: [{ regex: String.raw`\$__[a-zA-Z_][a-zA-Z0-9_]*` }],
|
|
12
|
+
},
|
|
8
13
|
});
|
|
9
14
|
} catch {
|
|
10
15
|
// If formatting fails, return the original SQL
|
package/src/sql/index.tsx
CHANGED
|
@@ -98,11 +98,10 @@ const formatBtnClassName = css`
|
|
|
98
98
|
border-radius: 4px;
|
|
99
99
|
cursor: pointer;
|
|
100
100
|
color: inherit;
|
|
101
|
-
opacity:
|
|
101
|
+
opacity: 1;
|
|
102
102
|
transition: opacity 0.15s;
|
|
103
103
|
|
|
104
104
|
&:hover {
|
|
105
|
-
opacity: 1;
|
|
106
105
|
background: var(--format-btn-hover-bg, rgba(128, 128, 128, 0.15));
|
|
107
106
|
}
|
|
108
107
|
`;
|
|
@@ -344,19 +343,18 @@ const SqlEditor = forwardRef<SqlEditorHandle, SqlEditorProps>((props, ref) => {
|
|
|
344
343
|
title='Format SQL'
|
|
345
344
|
style={
|
|
346
345
|
{
|
|
347
|
-
'--format-btn-hover-bg':
|
|
348
|
-
theme === 'dark' ? 'rgba(255,255,255,0.2)' : 'rgba(128,128,128,0.15)',
|
|
346
|
+
'--format-btn-hover-bg': theme === 'dark' ? 'rgba(255,255,255,0.2)' : 'rgba(128,128,128,0.15)',
|
|
349
347
|
} as React.CSSProperties
|
|
350
348
|
}
|
|
351
349
|
>
|
|
352
350
|
<svg
|
|
353
351
|
xmlns='http://www.w3.org/2000/svg'
|
|
354
|
-
width='
|
|
355
|
-
height='
|
|
352
|
+
width='12'
|
|
353
|
+
height='12'
|
|
356
354
|
viewBox='0 0 24 24'
|
|
357
355
|
fill='none'
|
|
358
356
|
stroke='currentColor'
|
|
359
|
-
strokeWidth='
|
|
357
|
+
strokeWidth='1'
|
|
360
358
|
strokeLinecap='round'
|
|
361
359
|
strokeLinejoin='round'
|
|
362
360
|
>
|