@fc-components/monaco-editor 0.3.4 → 0.3.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.
@@ -3669,7 +3669,7 @@ var getSqlCompletionProvider = function getSqlCompletionProvider() {
3669
3669
  var _templateObject$2;
3670
3670
  function formatSql(sql) {
3671
3671
  try {
3672
- return sqlFormatter.format(sql, {
3672
+ var formatted = sqlFormatter.format(sql, {
3673
3673
  tabWidth: 2,
3674
3674
  keywordCase: 'upper',
3675
3675
  // Treat custom $__ prefixed macros (like $__timeFilter, $__timeRange, etc.)
@@ -3680,6 +3680,9 @@ function formatSql(sql) {
3680
3680
  }]
3681
3681
  }
3682
3682
  });
3683
+ // sql-formatter treats $__xxx as a placeholder and inserts a space before '('.
3684
+ // Remove that extra space so $__timeFilter( stays intact as a function call.
3685
+ return formatted.replace(/(\$__[a-zA-Z_][a-zA-Z0-9_]*)\s+\(/g, '$1(');
3683
3686
  } catch (_unused) {
3684
3687
  // If formatting fails, return the original SQL
3685
3688
  return sql;
@@ -3923,7 +3926,15 @@ var SqlEditor = /*#__PURE__*/React.forwardRef(function (props, ref) {
3923
3926
  alwaysConsumeMouseWheel: false
3924
3927
  }
3925
3928
  }
3926
- })), enableFormat && (renderFormatButton ? renderFormatButton(handleFormat) : React__default.createElement("button", {
3929
+ })), enableFormat && (renderFormatButton ? React__default.createElement("div", {
3930
+ style: {
3931
+ position: 'absolute',
3932
+ top: 4,
3933
+ right: 4,
3934
+ zIndex: 10
3935
+ },
3936
+ onClick: handleFormat
3937
+ }, renderFormatButton(handleFormat)) : React__default.createElement("button", {
3927
3938
  onClick: handleFormat,
3928
3939
  className: formatBtnClassName,
3929
3940
  title: 'Format SQL',