@gingkoo/pandora-metabase 1.0.158-alpha.12 → 1.0.158-alpha.14

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.
Files changed (31) hide show
  1. package/lib/cjs/components/dialog/formula-list/index.js +1 -0
  2. package/lib/cjs/components/metabase/index.js +69 -63
  3. package/lib/cjs/components/modules/join-data.js +2 -0
  4. package/lib/cjs/components/modules/table-data.js +2 -0
  5. package/lib/cjs/components/sql-syntax-confirm.d.ts +1 -1
  6. package/lib/cjs/components/sql-syntax-confirm.js +12 -6
  7. package/lib/cjs/hooks/use-state.js +50 -17
  8. package/lib/cjs/index.js +1 -3
  9. package/lib/cjs/locale/en.js +2 -0
  10. package/lib/cjs/locale/zh.js +2 -0
  11. package/lib/cjs/types.d.ts +1 -1
  12. package/lib/cjs/utils/transformSql.d.ts +2 -0
  13. package/lib/cjs/utils/transformSql.js +188 -76
  14. package/lib/es/components/dialog/formula-list/index.js +1 -0
  15. package/lib/es/components/metabase/index.js +69 -63
  16. package/lib/es/components/modules/join-data.js +2 -0
  17. package/lib/es/components/modules/table-data.js +2 -0
  18. package/lib/es/components/sql-syntax-confirm.d.ts +1 -1
  19. package/lib/es/components/sql-syntax-confirm.js +12 -6
  20. package/lib/es/hooks/use-state.js +50 -17
  21. package/lib/es/index.js +1 -3
  22. package/lib/es/locale/en.js +2 -0
  23. package/lib/es/locale/zh.js +2 -0
  24. package/lib/es/types.d.ts +1 -1
  25. package/lib/es/utils/transformSql.d.ts +2 -0
  26. package/lib/es/utils/transformSql.js +188 -76
  27. package/package.json +2 -1
  28. package/lib/cjs/components/dialog/diff-viewer/index copy.d.ts +0 -10
  29. package/lib/cjs/components/dialog/diff-viewer/index copy.js +0 -139
  30. package/lib/es/components/dialog/diff-viewer/index copy.d.ts +0 -10
  31. package/lib/es/components/dialog/diff-viewer/index copy.js +0 -132
@@ -2778,6 +2778,7 @@ var FormulaList = (0, _react.forwardRef)(function (props, ref) {
2778
2778
  notExistsColumns: exitData,
2779
2779
  fieldEnableAlias: false,
2780
2780
  toolbar: _toolbar,
2781
+ subToolbar: subToolbar,
2781
2782
  btnText: (0, _locale.__)('SqlQueryBuilder.confirm'),
2782
2783
  value: (0, _cloneDeep["default"])(_value),
2783
2784
  onOk: function onOk(newList) {
@@ -91,7 +91,7 @@ var Metabase = function Metabase(props) {
91
91
  _props$sqlDialect = props.sqlDialect,
92
92
  sqlDialect = _props$sqlDialect === void 0 ? 'mysql' : _props$sqlDialect,
93
93
  _props$sqlValidationE = props.sqlValidationEnabled,
94
- sqlValidationEnabled = _props$sqlValidationE === void 0 ? false : _props$sqlValidationE,
94
+ sqlValidationEnabled = _props$sqlValidationE === void 0 ? true : _props$sqlValidationE,
95
95
  _props$sqlValidationQ = props.sqlValidationQueryKind,
96
96
  sqlValidationQueryKind = _props$sqlValidationQ === void 0 ? 'query' : _props$sqlValidationQ;
97
97
  var store = (0, _useProvider.useStore)();
@@ -126,64 +126,63 @@ var Metabase = function Metabase(props) {
126
126
  return;
127
127
  }
128
128
  }
129
- var doms = store.popupContainer.current.querySelectorAll('.isError');
130
- var isSqlError = store.popupContainer.current.querySelectorAll('.isSqlError');
131
- var checkDomIssues = function checkDomIssues() {
132
- if (doms.length) {
133
- _pandora.Modal.confirm({
134
- title: (0, _locale.__)('metabase.prompt'),
135
- content: (0, _locale.__)('metabase.validationFailed'),
136
- onOk: function () {
137
- var _onOk = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee() {
138
- return _regenerator["default"].wrap(function (_context) {
139
- while (1) switch (_context.prev = _context.next) {
140
- case 0:
141
- _context.next = 1;
142
- return onSave();
143
- case 1:
144
- case "end":
145
- return _context.stop();
146
- }
147
- }, _callee);
148
- }));
149
- function onOk() {
150
- return _onOk.apply(this, arguments);
151
- }
152
- return onOk;
153
- }()
154
- });
155
- return;
156
- }
157
- onSave();
158
- };
159
- var checkFormulaIssues = function checkFormulaIssues() {
160
- if (isSqlError.length) {
161
- _pandora.Modal.confirm({
162
- title: (0, _locale.__)('metabase.prompt'),
163
- content: (0, _locale.__)('metabase.validationFormulaSave'),
164
- onOk: checkDomIssues
165
- });
166
- return;
167
- }
168
- checkDomIssues();
169
- };
170
- if (sqlValidationEnabled) {
171
- var sqlMetaList = (0, _utils.normalizeLegacySummarizeForSave)((0, _utils.splitByUnion)(store.metaList));
172
- var sqlValidation = (0, _transformSql.validateMetabaseConfig)(sqlMetaList, sqlDialect, {
173
- queryKind: sqlValidationQueryKind
129
+ var container = store.popupContainer.current;
130
+ var doms = container ? container.querySelectorAll('.isError') : [];
131
+ var isSqlError = container ? container.querySelectorAll('.isSqlError') : [];
132
+ var extraMessages = [];
133
+ if (isSqlError.length) extraMessages.push((0, _locale.__)('metabase.sqlErrorFormula'));
134
+ if (doms.length) extraMessages.push((0, _locale.__)('metabase.sqlErrorUi'));
135
+ var sqlIssues = sqlValidationEnabled ? (0, _transformSql.validateMetabaseConfig)((0, _utils.normalizeLegacySummarizeForSave)((0, _utils.splitByUnion)(store.metaList)), sqlDialect, {
136
+ queryKind: sqlValidationQueryKind
137
+ }).issues : [];
138
+ var confirmSave = function () {
139
+ var _ref = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee() {
140
+ return _regenerator["default"].wrap(function (_context) {
141
+ while (1) switch (_context.prev = _context.next) {
142
+ case 0:
143
+ _context.next = 1;
144
+ return onSave();
145
+ case 1:
146
+ case "end":
147
+ return _context.stop();
148
+ }
149
+ }, _callee);
150
+ }));
151
+ return function confirmSave() {
152
+ return _ref.apply(this, arguments);
153
+ };
154
+ }();
155
+ if (sqlIssues.length) {
156
+ var hasConfigIssue = sqlIssues.some(function (issue) {
157
+ return issue.severity === 'error';
174
158
  });
175
- if (sqlValidation.issues.length) {
176
- var hasConfigIssue = sqlValidation.issues.some(function (issue) {
177
- return issue.severity === 'error';
178
- });
179
- (0, _sqlSyntaxConfirm.confirmSyntaxIssues)(sqlValidation.issues, checkFormulaIssues, hasConfigIssue ? 'metabase.validationConfigSave' : 'metabase.validationSqlSave');
180
- return;
181
- }
159
+ (0, _sqlSyntaxConfirm.confirmSyntaxIssues)(sqlIssues, confirmSave, hasConfigIssue ? 'metabase.validationConfigSave' : 'metabase.validationSqlSave', extraMessages);
160
+ return;
161
+ }
162
+ if (extraMessages.length > 1) {
163
+ (0, _sqlSyntaxConfirm.confirmSyntaxIssues)([], confirmSave, 'metabase.validationConfigSave', extraMessages);
164
+ return;
165
+ }
166
+ if (isSqlError.length) {
167
+ _pandora.Modal.confirm({
168
+ title: (0, _locale.__)('metabase.prompt'),
169
+ content: (0, _locale.__)('metabase.validationFormulaSave'),
170
+ onOk: confirmSave
171
+ });
172
+ return;
173
+ }
174
+ if (doms.length) {
175
+ _pandora.Modal.confirm({
176
+ title: (0, _locale.__)('metabase.prompt'),
177
+ content: (0, _locale.__)('metabase.validationFailed'),
178
+ onOk: confirmSave
179
+ });
180
+ return;
182
181
  }
183
- checkFormulaIssues();
182
+ confirmSave();
184
183
  };
185
184
  var onSave = function () {
186
- var _ref = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2() {
185
+ var _ref2 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2() {
187
186
  var intercept, _metaList;
188
187
  return _regenerator["default"].wrap(function (_context2) {
189
188
  while (1) switch (_context2.prev = _context2.next) {
@@ -191,12 +190,19 @@ var Metabase = function Metabase(props) {
191
190
  intercept = false;
192
191
  _metaList = (0, _utils.normalizeLegacySummarizeForSave)((0, _utils.splitByUnion)(store.metaList));
193
192
  _metaList[0].patchVersion = '1.1.0';
194
- store.metaList.map(function (v) {
195
- var _v$list;
196
- var firstTableName = (_v$list = v.list) === null || _v$list === void 0 || (_v$list = _v$list[0]) === null || _v$list === void 0 || (_v$list = _v$list.table) === null || _v$list === void 0 ? void 0 : _v$list.name;
197
- if (v.type !== 'union' && !firstTableName) {
193
+ store.metaList.forEach(function (v) {
194
+ var _dataMeta$table, _dataMeta$subquery;
195
+ if (v.type === 'union') return;
196
+ var dataMeta = (v.list || []).find(function (item) {
197
+ if ((item === null || item === void 0 ? void 0 : item.type) !== 'data') return false;
198
+ return !item.hidden;
199
+ });
200
+ if (!dataMeta) return;
201
+ var hasTable = Boolean((_dataMeta$table = dataMeta.table) === null || _dataMeta$table === void 0 ? void 0 : _dataMeta$table.name);
202
+ var hasSubquery = Boolean(dataMeta.isSubquery && ((_dataMeta$subquery = dataMeta.subquery) === null || _dataMeta$subquery === void 0 ? void 0 : _dataMeta$subquery.length));
203
+ if (!hasTable && !hasSubquery) {
198
204
  intercept = true;
199
- return _pandora.Toast.warning((0, _locale.__)('data.pleaseSelectDataTable'));
205
+ _pandora.Toast.warning((0, _locale.__)('data.pleaseSelectDataTable'));
200
206
  }
201
207
  });
202
208
  if (!(saveLoading || intercept)) {
@@ -217,7 +223,7 @@ var Metabase = function Metabase(props) {
217
223
  }, _callee2);
218
224
  }));
219
225
  return function onSave() {
220
- return _ref.apply(this, arguments);
226
+ return _ref2.apply(this, arguments);
221
227
  };
222
228
  }();
223
229
  (0, _react.useEffect)(function () {
@@ -326,7 +332,7 @@ var Metabase = function Metabase(props) {
326
332
  className: 'Sqb-fun-btns',
327
333
  children: copy()
328
334
  }), store.metaList.map(function (v, index) {
329
- var _v$list2;
335
+ var _v$list;
330
336
  if (v.type === 'union' && v.union) {
331
337
  return (0, _jsxRuntime.jsx)("div", {
332
338
  className: (0, _classnames["default"])("Sqb-list"),
@@ -343,7 +349,7 @@ var Metabase = function Metabase(props) {
343
349
  className: (0, _classnames["default"])("Sqb-list"),
344
350
  onMouseDownCapture: stopReadonlyInteraction,
345
351
  onClickCapture: stopReadonlyInteraction,
346
- children: v === null || v === void 0 || (_v$list2 = v.list) === null || _v$list2 === void 0 ? void 0 : _v$list2.map(function (meta) {
352
+ children: v === null || v === void 0 || (_v$list = v.list) === null || _v$list === void 0 ? void 0 : _v$list.map(function (meta) {
347
353
  var metaType = meta.type,
348
354
  metaKey = meta.metaKey,
349
355
  hidden = meta.hidden;
@@ -1038,6 +1038,8 @@ var JoinData = function JoinData(props) {
1038
1038
  isExit: isExit,
1039
1039
  isSubquery: true,
1040
1040
  toolbar: _toolbar,
1041
+ subToolbar: subToolbar,
1042
+ sqlValidationQueryKind: 'query',
1041
1043
  btnText: (0, _locale.__)('SqlQueryBuilder.confirm'),
1042
1044
  value: (0, _cloneDeep["default"])(val),
1043
1045
  onOk: function onOk(newList) {
@@ -226,6 +226,8 @@ var TableData = function TableData(props) {
226
226
  isExit: isExit,
227
227
  isSubquery: true,
228
228
  toolbar: _toolbar,
229
+ subToolbar: subToolbar,
230
+ sqlValidationQueryKind: 'query',
229
231
  btnText: (0, _locale.__)('SqlQueryBuilder.confirm'),
230
232
  value: (0, _cloneDeep["default"])(val),
231
233
  onOk: function onOk(newList) {
@@ -1,5 +1,5 @@
1
1
  import { SqlValidationIssue } from '../utils/transformSql';
2
- export declare const confirmSyntaxIssues: (issues: SqlValidationIssue[] | undefined, onOk: () => void | Promise<void>, descriptionKey?: string) => void | Promise<void>;
2
+ export declare const confirmSyntaxIssues: (issues: SqlValidationIssue[] | undefined, onOk: () => void | Promise<void>, descriptionKey?: string, extraMessages?: string[]) => void | Promise<void>;
3
3
  export declare const toSyntaxIssues: (result?: {
4
4
  isError?: boolean;
5
5
  issues?: SqlValidationIssue[];
@@ -32,15 +32,16 @@ var getIssuePath = function getIssuePath(issue) {
32
32
  }).join(' > ');
33
33
  };
34
34
  var renderIssues = function renderIssues(issues, descriptionKey) {
35
+ var extraMessages = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
35
36
  return (0, _jsxRuntime.jsxs)("div", {
36
37
  children: [(0, _jsxRuntime.jsx)("div", {
37
38
  children: (0, _locale.__)(descriptionKey)
38
- }), (0, _jsxRuntime.jsx)("ul", {
39
+ }), issues.length || extraMessages.length ? (0, _jsxRuntime.jsxs)("ul", {
39
40
  style: {
40
41
  margin: '8px 0 0',
41
42
  paddingLeft: 20
42
43
  },
43
- children: issues.map(function (issue) {
44
+ children: [issues.map(function (issue) {
44
45
  var issuePath = getIssuePath(issue);
45
46
  var key = "".concat(issue.code, "-").concat((issue.path || []).map(function (item) {
46
47
  var _item$metaKey, _item$index;
@@ -49,20 +50,25 @@ var renderIssues = function renderIssues(issues, descriptionKey) {
49
50
  return (0, _jsxRuntime.jsxs)("li", {
50
51
  children: [issuePath ? "".concat(issuePath, "\uFF1A") : '', getIssueMessage(issue.code)]
51
52
  }, key);
52
- })
53
- })]
53
+ }), extraMessages.map(function (message, index) {
54
+ return (0, _jsxRuntime.jsx)("li", {
55
+ children: message
56
+ }, "extra-".concat(index));
57
+ })]
58
+ }) : null]
54
59
  });
55
60
  };
56
61
  var confirmSyntaxIssues = exports.confirmSyntaxIssues = function confirmSyntaxIssues() {
57
62
  var issues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
58
63
  var onOk = arguments.length > 1 ? arguments[1] : undefined;
59
64
  var descriptionKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'metabase.validationSqlSave';
60
- if (!issues.length) {
65
+ var extraMessages = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
66
+ if (!issues.length && !extraMessages.length) {
61
67
  return onOk();
62
68
  }
63
69
  _pandora.Modal.confirm({
64
70
  title: (0, _locale.__)('metabase.prompt'),
65
- content: renderIssues(issues, descriptionKey),
71
+ content: renderIssues(issues, descriptionKey, extraMessages),
66
72
  onOk: onOk
67
73
  });
68
74
  };
@@ -506,15 +506,21 @@ var useStore = function useStore() {
506
506
  }
507
507
  return _context7.abrupt("return", tables);
508
508
  case 1:
509
- _context7.next = 2;
509
+ if (!(typeof fetchDatasetFn.current !== 'function')) {
510
+ _context7.next = 2;
511
+ break;
512
+ }
513
+ return _context7.abrupt("return", []);
514
+ case 2:
515
+ _context7.next = 3;
510
516
  return fetchDatasetFn.current(datasourceId, {
511
517
  isExit: isExit
512
518
  });
513
- case 2:
519
+ case 3:
514
520
  _tables = _context7.sent;
515
521
  setDataset(datasourceId, _tables);
516
522
  return _context7.abrupt("return", _tables);
517
- case 3:
523
+ case 4:
518
524
  case "end":
519
525
  return _context7.stop();
520
526
  }
@@ -550,19 +556,26 @@ var useStore = function useStore() {
550
556
  _isExit = _args8.length > 5 && _args8[5] !== undefined ? _args8[5] : isExit;
551
557
  _table$alias = table.alias, alias = _table$alias === void 0 ? '' : _table$alias, datasourceName = table.datasourceName, did = table.datasourceId, column = table.column, extra = (0, _objectWithoutProperties2["default"])(table, _excluded);
552
558
  tableName = table.name;
553
- columns = getColumns(tableName);
559
+ columns = getColumns(tableName, datasourceId, _isExit);
554
560
  if (columns.length) {
555
- _context8.next = 2;
561
+ _context8.next = 3;
556
562
  break;
557
563
  }
558
- _context8.next = 1;
564
+ if (!(typeof fetchColumnsFn.current !== 'function')) {
565
+ _context8.next = 1;
566
+ break;
567
+ }
568
+ typeof callback === 'function' && callback(oldColumns);
569
+ return _context8.abrupt("return", oldColumns);
570
+ case 1:
571
+ _context8.next = 2;
559
572
  return fetchColumnsFn.current(extra, datasourceId, {
560
573
  isExit: _isExit
561
574
  });
562
- case 1:
563
- columns = _context8.sent;
564
- setColumns(tableName, columns);
565
575
  case 2:
576
+ columns = _context8.sent;
577
+ setColumns(tableName, columns, datasourceId, _isExit);
578
+ case 3:
566
579
  _columns = (_columns2 = columns) === null || _columns2 === void 0 ? void 0 : _columns2.map(function (v) {
567
580
  var _ref9, _obj$fieldAlias;
568
581
  var obj = oldColumns.find(function (oldColumn) {
@@ -576,7 +589,7 @@ var useStore = function useStore() {
576
589
  });
577
590
  });
578
591
  typeof callback === 'function' && callback(_columns);
579
- case 3:
592
+ case 4:
580
593
  case "end":
581
594
  return _context8.stop();
582
595
  }
@@ -597,7 +610,8 @@ var useStore = function useStore() {
597
610
  oldData,
598
611
  newData,
599
612
  isChange,
600
- _args9 = arguments;
613
+ _args9 = arguments,
614
+ _t;
601
615
  return _regenerator["default"].wrap(function (_context9) {
602
616
  while (1) switch (_context9.prev = _context9.next) {
603
617
  case 0:
@@ -628,25 +642,35 @@ var useStore = function useStore() {
628
642
  case 2:
629
643
  oldData = (0, _utils.splitByUnion)(prevMeta);
630
644
  newData = (0, _utils.splitByUnion)(newMeta);
645
+ if (!(typeof fetchChangeFn.current === 'function')) {
646
+ _context9.next = 4;
647
+ break;
648
+ }
631
649
  _context9.next = 3;
632
650
  return fetchChangeFn.current(oldData, changeObj, {
633
651
  isExit: isExit
634
652
  }, newData);
635
653
  case 3:
636
- isChange = _context9.sent;
654
+ _t = _context9.sent;
655
+ _context9.next = 5;
656
+ break;
657
+ case 4:
658
+ _t = true;
659
+ case 5:
660
+ isChange = _t;
637
661
  if (!(isChange === false)) {
638
- _context9.next = 4;
662
+ _context9.next = 6;
639
663
  break;
640
664
  }
641
665
  if (requestId === metaRequestRef.current && metaRevisionRef.current === prevRevision) {
642
666
  _setMeta(prevMeta);
643
667
  }
644
668
  return _context9.abrupt("return");
645
- case 4:
669
+ case 6:
646
670
  if (requestId === metaRequestRef.current && metaRevisionRef.current === prevRevision) {
647
671
  _setMeta(newMeta);
648
672
  }
649
- case 5:
673
+ case 7:
650
674
  case "end":
651
675
  return _context9.stop();
652
676
  }
@@ -978,18 +1002,27 @@ var useStore = function useStore() {
978
1002
  });
979
1003
  setMeta(_metaList, groupIndex);
980
1004
  };
1005
+ var getColumnsCacheKey = function getColumnsCacheKey(tableId) {
1006
+ var datasourceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1007
+ var exitMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1008
+ return "".concat(datasourceId || '', "::").concat(tableId || '', "::").concat(exitMode ? 'exit' : 'main');
1009
+ };
981
1010
  var setColumns = function setColumns(tableId, columns) {
1011
+ var datasourceId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
1012
+ var exitMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
982
1013
  var _columns = columns === null || columns === void 0 ? void 0 : columns.map(function (v) {
983
1014
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, v), {}, {
984
1015
  fieldUuid: v.fieldUuid || (0, _helper.uuidv4)('field')
985
1016
  });
986
1017
  });
987
1018
  var map = (0, _objectSpread2["default"])({}, _cacheColumnsMap);
988
- map[tableId] = _columns;
1019
+ map[getColumnsCacheKey(tableId, datasourceId, exitMode)] = _columns;
989
1020
  set_cacheColumnsMap(map);
990
1021
  };
991
1022
  var getColumns = function getColumns(tableId) {
992
- return _cacheColumnsMap[tableId] || [];
1023
+ var datasourceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
1024
+ var exitMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1025
+ return _cacheColumnsMap[getColumnsCacheKey(tableId, datasourceId, exitMode)] || [];
993
1026
  };
994
1027
  var setDataset = function setDataset(datasourceId, tables) {
995
1028
  var map = (0, _objectSpread2["default"])({}, _cacheSource2TableMap);
package/lib/cjs/index.js CHANGED
@@ -112,9 +112,7 @@ var SqlVisionBuilder = _react["default"].forwardRef(function (props, ref) {
112
112
  getColumns && store.setFetchColumnsFn(getColumns);
113
113
  onChange && store.setFetchChangeFn(onChange);
114
114
  getModuleDiffCode && store.setFetchDiffFn(getModuleDiffCode);
115
- store.setFetchFormulaSqlFn(getFormulaSqlCode);
116
- store.setFetchFormulaDiffFn(getFormulaDiffCode);
117
- }, []);
115
+ }, [getTables, getColumns, onChange, getModuleDiffCode]);
118
116
  (0, _react.useEffect)(function () {
119
117
  store.setFetchFormulaSqlFn(getFormulaSqlCode);
120
118
  store.setFetchFormulaDiffFn(getFormulaDiffCode);
@@ -232,6 +232,8 @@ var _default = exports["default"] = (0, _index.register)('en', {
232
232
  'metabase.sqlErrorDuplicateLogicalOperator': 'Duplicate logical operator (for example AND AND or OR OR)',
233
233
  'metabase.sqlErrorAndOr': 'Incomplete AND / OR group (missing operator or condition)',
234
234
  'metabase.sqlErrorUnterminatedQuote': 'Unterminated string or identifier quote',
235
+ 'metabase.sqlErrorFormula': 'The formula configuration is incorrect',
236
+ 'metabase.sqlErrorUi': 'A field or module failed validation',
235
237
  'metabase.prompt': 'Prompt',
236
238
  'metabase.copy': 'Copy',
237
239
  'metabase.copySuccess': 'Copy success',
@@ -232,6 +232,8 @@ var _default = exports["default"] = (0, _index.register)('zh', {
232
232
  'metabase.sqlErrorDuplicateLogicalOperator': '逻辑操作符重复(例如 AND AND 或 OR OR)',
233
233
  'metabase.sqlErrorAndOr': 'AND / OR 结构不完整(缺少连接符或条件)',
234
234
  'metabase.sqlErrorUnterminatedQuote': '字符串或标识符引号未闭合',
235
+ 'metabase.sqlErrorFormula': '公式配置有误',
236
+ 'metabase.sqlErrorUi': '字段或模块配置校验未通过',
235
237
  'metabase.prompt': '提示',
236
238
  'metabase.copy': '复制',
237
239
  'metabase.copySuccess': '复制成功',
@@ -2,7 +2,7 @@ import type { MetaListType, ToolbarType, FormulaTemplatesItem, ChangeType, Formu
2
2
  import { UnionEnum } from './store/enum';
3
3
  import { DataType } from './components/dialog/select-column-multiple';
4
4
  export type SqlDialect = 'mysql' | 'oracle' | 'sqlserver';
5
- export type SqlValidationQueryKind = 'query' | 'exists' | 'scalar';
5
+ export type SqlValidationQueryKind = 'query' | 'exists' | 'scalar' | 'fragment';
6
6
  export interface MetaListProps {
7
7
  name: string;
8
8
  type: 'group' | 'union';
@@ -24,12 +24,14 @@ export interface SqlValidationResult {
24
24
  }
25
25
  export declare const validateSqlSyntax: (sql: string, options?: {
26
26
  completeQuery?: boolean;
27
+ dialect?: SqlDialect;
27
28
  }) => {
28
29
  isError: boolean;
29
30
  issues: SqlValidationIssue[];
30
31
  };
31
32
  export declare const validateSql: (sql: string, options?: {
32
33
  completeQuery?: boolean;
34
+ dialect?: SqlDialect;
33
35
  }) => {
34
36
  isError: boolean;
35
37
  issues: SqlValidationIssue[];