@fc-components/monaco-editor 0.3.3 → 0.3.5
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 +22 -6
- 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 +22 -6
- 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 +3 -1
|
@@ -3660,11 +3660,19 @@ var getSqlCompletionProvider = function getSqlCompletionProvider() {
|
|
|
3660
3660
|
};
|
|
3661
3661
|
};
|
|
3662
3662
|
|
|
3663
|
+
var _templateObject$2;
|
|
3663
3664
|
function formatSql(sql) {
|
|
3664
3665
|
try {
|
|
3665
3666
|
return format(sql, {
|
|
3666
3667
|
tabWidth: 2,
|
|
3667
|
-
keywordCase: 'upper'
|
|
3668
|
+
keywordCase: 'upper',
|
|
3669
|
+
// Treat custom $__ prefixed macros (like $__timeFilter, $__timeRange, etc.)
|
|
3670
|
+
// as parameter placeholders so the formatter doesn't choke on them.
|
|
3671
|
+
paramTypes: {
|
|
3672
|
+
custom: [{
|
|
3673
|
+
regex: String.raw(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["$__[a-zA-Z_][a-zA-Z0-9_]*"], ["\\$__[a-zA-Z_][a-zA-Z0-9_]*"])))
|
|
3674
|
+
}]
|
|
3675
|
+
}
|
|
3668
3676
|
});
|
|
3669
3677
|
} catch (_unused) {
|
|
3670
3678
|
// If formatting fails, return the original SQL
|
|
@@ -3672,7 +3680,7 @@ function formatSql(sql) {
|
|
|
3672
3680
|
}
|
|
3673
3681
|
}
|
|
3674
3682
|
|
|
3675
|
-
var _templateObject$
|
|
3683
|
+
var _templateObject$3, _templateObject2$2, _templateObject3;
|
|
3676
3684
|
var SQL_LANG_ID = 'sql';
|
|
3677
3685
|
var SIZE_MAP$2 = {
|
|
3678
3686
|
small: {
|
|
@@ -3698,7 +3706,7 @@ var themeMap$2 = {
|
|
|
3698
3706
|
light: 'sql-light',
|
|
3699
3707
|
dark: 'sql-dark'
|
|
3700
3708
|
};
|
|
3701
|
-
var containerDisabledClassName$2 = /*#__PURE__*/css(_templateObject$
|
|
3709
|
+
var containerDisabledClassName$2 = /*#__PURE__*/css(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"])));
|
|
3702
3710
|
var containerReadOnlyClassName$2 = /*#__PURE__*/css(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important;\n }\n"])));
|
|
3703
3711
|
var formatBtnClassName = /*#__PURE__*/css(_templateObject3 || (_templateObject3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n top: 4px;\n right: 4px;\n z-index: 10;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n padding: 0;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n color: inherit;\n opacity: 1;\n transition: opacity 0.15s;\n\n &:hover {\n background: var(--format-btn-hover-bg, rgba(128, 128, 128, 0.15));\n }\n"])));
|
|
3704
3712
|
var SqlEditor = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
@@ -3909,7 +3917,15 @@ var SqlEditor = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
3909
3917
|
alwaysConsumeMouseWheel: false
|
|
3910
3918
|
}
|
|
3911
3919
|
}
|
|
3912
|
-
})), enableFormat && (renderFormatButton ?
|
|
3920
|
+
})), enableFormat && (renderFormatButton ? React.createElement("div", {
|
|
3921
|
+
style: {
|
|
3922
|
+
position: 'absolute',
|
|
3923
|
+
top: 4,
|
|
3924
|
+
right: 4,
|
|
3925
|
+
zIndex: 10
|
|
3926
|
+
},
|
|
3927
|
+
onClick: handleFormat
|
|
3928
|
+
}, renderFormatButton(handleFormat)) : React.createElement("button", {
|
|
3913
3929
|
onClick: handleFormat,
|
|
3914
3930
|
className: formatBtnClassName,
|
|
3915
3931
|
title: 'Format SQL',
|
|
@@ -5604,7 +5620,7 @@ function countDoubleQuotesOutsideBlockComments(line) {
|
|
|
5604
5620
|
return (withoutBlockComments.match(/"/g) || []).length;
|
|
5605
5621
|
}
|
|
5606
5622
|
|
|
5607
|
-
var _templateObject$
|
|
5623
|
+
var _templateObject$4, _templateObject2$3;
|
|
5608
5624
|
var EXPR_LANG_ID$1 = 'expr';
|
|
5609
5625
|
var SIZE_MAP$3 = {
|
|
5610
5626
|
small: {
|
|
@@ -5630,7 +5646,7 @@ var themeMap$3 = {
|
|
|
5630
5646
|
light: 'expr-light',
|
|
5631
5647
|
dark: 'expr-dark'
|
|
5632
5648
|
};
|
|
5633
|
-
var containerDisabledClassName$3 = /*#__PURE__*/css(_templateObject$
|
|
5649
|
+
var containerDisabledClassName$3 = /*#__PURE__*/css(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"])));
|
|
5634
5650
|
var containerReadOnlyClassName$3 = /*#__PURE__*/css(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important;\n }\n"])));
|
|
5635
5651
|
function ExprEditor(props) {
|
|
5636
5652
|
var id = v4();
|