@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.
@@ -3666,11 +3666,19 @@ var getSqlCompletionProvider = function getSqlCompletionProvider() {
3666
3666
  };
3667
3667
  };
3668
3668
 
3669
+ var _templateObject$2;
3669
3670
  function formatSql(sql) {
3670
3671
  try {
3671
3672
  return sqlFormatter.format(sql, {
3672
3673
  tabWidth: 2,
3673
- keywordCase: 'upper'
3674
+ keywordCase: 'upper',
3675
+ // Treat custom $__ prefixed macros (like $__timeFilter, $__timeRange, etc.)
3676
+ // as parameter placeholders so the formatter doesn't choke on them.
3677
+ paramTypes: {
3678
+ custom: [{
3679
+ regex: String.raw(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["$__[a-zA-Z_][a-zA-Z0-9_]*"], ["\\$__[a-zA-Z_][a-zA-Z0-9_]*"])))
3680
+ }]
3681
+ }
3674
3682
  });
3675
3683
  } catch (_unused) {
3676
3684
  // If formatting fails, return the original SQL
@@ -3678,7 +3686,7 @@ function formatSql(sql) {
3678
3686
  }
3679
3687
  }
3680
3688
 
3681
- var _templateObject$2, _templateObject2$2, _templateObject3;
3689
+ var _templateObject$3, _templateObject2$2, _templateObject3;
3682
3690
  var SQL_LANG_ID = 'sql';
3683
3691
  var SIZE_MAP$2 = {
3684
3692
  small: {
@@ -3704,7 +3712,7 @@ var themeMap$2 = {
3704
3712
  light: 'sql-light',
3705
3713
  dark: 'sql-dark'
3706
3714
  };
3707
- var containerDisabledClassName$2 = /*#__PURE__*/css.css(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"])));
3715
+ var containerDisabledClassName$2 = /*#__PURE__*/css.css(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"])));
3708
3716
  var containerReadOnlyClassName$2 = /*#__PURE__*/css.css(_templateObject2$2 || (_templateObject2$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important;\n }\n"])));
3709
3717
  var formatBtnClassName = /*#__PURE__*/css.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"])));
3710
3718
  var SqlEditor = /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -3915,7 +3923,15 @@ var SqlEditor = /*#__PURE__*/React.forwardRef(function (props, ref) {
3915
3923
  alwaysConsumeMouseWheel: false
3916
3924
  }
3917
3925
  }
3918
- })), enableFormat && (renderFormatButton ? renderFormatButton(handleFormat) : React__default.createElement("button", {
3926
+ })), enableFormat && (renderFormatButton ? React__default.createElement("div", {
3927
+ style: {
3928
+ position: 'absolute',
3929
+ top: 4,
3930
+ right: 4,
3931
+ zIndex: 10
3932
+ },
3933
+ onClick: handleFormat
3934
+ }, renderFormatButton(handleFormat)) : React__default.createElement("button", {
3919
3935
  onClick: handleFormat,
3920
3936
  className: formatBtnClassName,
3921
3937
  title: 'Format SQL',
@@ -5610,7 +5626,7 @@ function countDoubleQuotesOutsideBlockComments(line) {
5610
5626
  return (withoutBlockComments.match(/"/g) || []).length;
5611
5627
  }
5612
5628
 
5613
- var _templateObject$3, _templateObject2$3;
5629
+ var _templateObject$4, _templateObject2$3;
5614
5630
  var EXPR_LANG_ID$1 = 'expr';
5615
5631
  var SIZE_MAP$3 = {
5616
5632
  small: {
@@ -5636,7 +5652,7 @@ var themeMap$3 = {
5636
5652
  light: 'expr-light',
5637
5653
  dark: 'expr-dark'
5638
5654
  };
5639
- var containerDisabledClassName$3 = /*#__PURE__*/css.css(_templateObject$3 || (_templateObject$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"])));
5655
+ var containerDisabledClassName$3 = /*#__PURE__*/css.css(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor {\n user-select: none;\n pointer-events: none;\n }\n"])));
5640
5656
  var containerReadOnlyClassName$3 = /*#__PURE__*/css.css(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .monaco-editor .cursors-layer > .cursor {\n opacity: 0 !important;\n }\n"])));
5641
5657
  function ExprEditor(props) {
5642
5658
  var id = uuid.v4();