@gingkoo/pandora-metabase 1.0.14 → 1.0.16

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 (96) hide show
  1. package/lib/cjs/common/SplitView/index.js +11 -12
  2. package/lib/cjs/components/dialog/custom-column/expression-editor.js +1 -2
  3. package/lib/cjs/components/dialog/custom-column/expressions/suggest.js +1 -1
  4. package/lib/cjs/components/dialog/custom-column/tokenizedI-input.js +1 -2
  5. package/lib/cjs/components/dialog/{select-filter → expression}/index.d.ts +4 -4
  6. package/lib/cjs/components/dialog/{select-filter → expression}/index.js +345 -206
  7. package/lib/cjs/components/dialog/formula-list/enum.d.ts +9 -13
  8. package/lib/cjs/components/dialog/formula-list/enum.js +83 -39
  9. package/lib/cjs/components/dialog/formula-list/index.d.ts +4 -1
  10. package/lib/cjs/components/dialog/formula-list/index.js +110 -126
  11. package/lib/cjs/components/dialog/formula-list/utils.js +77 -46
  12. package/lib/cjs/components/dialog/index.d.ts +2 -2
  13. package/lib/cjs/components/dialog/index.js +20 -20
  14. package/lib/cjs/components/dialog/select-column/index.js +43 -12
  15. package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +54 -0
  16. package/lib/cjs/components/dialog/select-column-multiple/index.js +341 -0
  17. package/lib/cjs/components/dialog/select-column-multiple/index.less +246 -0
  18. package/lib/cjs/components/dialog/select-table/index.js +9 -7
  19. package/lib/cjs/components/icons.js +36 -36
  20. package/lib/cjs/components/metabase/index.js +6 -6
  21. package/lib/cjs/components/metabase/index.less +12 -1
  22. package/lib/cjs/components/modules/components/Wrapper.js +6 -6
  23. package/lib/cjs/components/modules/custom-column.js +12 -14
  24. package/lib/cjs/components/modules/enum/filter-enum.d.ts +34 -0
  25. package/lib/cjs/components/modules/enum/filter-enum.js +137 -0
  26. package/lib/cjs/components/modules/filter.js +43 -460
  27. package/lib/cjs/components/modules/join-data.js +863 -525
  28. package/lib/cjs/components/modules/permission-table.js +4 -0
  29. package/lib/cjs/components/modules/sort.js +102 -91
  30. package/lib/cjs/components/modules/summarize/group-by.js +47 -16
  31. package/lib/cjs/components/modules/summarize/select-index.js +48 -17
  32. package/lib/cjs/components/modules/table-data.js +13 -4
  33. package/lib/cjs/components/popup.js +1 -2
  34. package/lib/cjs/hooks/patch.d.ts +4 -0
  35. package/lib/cjs/hooks/patch.js +464 -0
  36. package/lib/cjs/hooks/use-state.js +73 -138
  37. package/lib/cjs/index.d.ts +0 -1
  38. package/lib/cjs/index.js +3 -21
  39. package/lib/cjs/locale/en.js +9 -2
  40. package/lib/cjs/locale/zh.js +11 -4
  41. package/lib/cjs/store/helper.d.ts +2 -3
  42. package/lib/cjs/store/helper.js +288 -233
  43. package/lib/cjs/store/types.d.ts +94 -71
  44. package/lib/cjs/store/types.js +17 -12
  45. package/lib/cjs/utils.d.ts +3 -3
  46. package/lib/cjs/utils.js +152 -187
  47. package/lib/es/common/SplitView/index.js +10 -10
  48. package/lib/es/components/dialog/custom-column/expressions/suggest.js +1 -1
  49. package/lib/es/components/dialog/{select-filter → expression}/index.d.ts +4 -4
  50. package/lib/es/components/dialog/{select-filter → expression}/index.js +343 -206
  51. package/lib/es/components/dialog/formula-list/enum.d.ts +9 -13
  52. package/lib/es/components/dialog/formula-list/enum.js +82 -38
  53. package/lib/es/components/dialog/formula-list/index.d.ts +4 -1
  54. package/lib/es/components/dialog/formula-list/index.js +115 -131
  55. package/lib/es/components/dialog/formula-list/utils.js +77 -46
  56. package/lib/es/components/dialog/index.d.ts +2 -2
  57. package/lib/es/components/dialog/index.js +3 -3
  58. package/lib/es/components/dialog/select-column/index.js +44 -13
  59. package/lib/es/components/dialog/select-column-multiple/index.d.ts +54 -0
  60. package/lib/es/components/dialog/select-column-multiple/index.js +335 -0
  61. package/lib/es/components/dialog/select-column-multiple/index.less +246 -0
  62. package/lib/es/components/dialog/select-table/index.js +9 -7
  63. package/lib/es/components/icons.js +36 -36
  64. package/lib/es/components/metabase/index.js +6 -6
  65. package/lib/es/components/metabase/index.less +12 -1
  66. package/lib/es/components/modules/components/Wrapper.js +6 -6
  67. package/lib/es/components/modules/custom-column.js +12 -14
  68. package/lib/es/components/modules/enum/filter-enum.d.ts +34 -0
  69. package/lib/es/components/modules/enum/filter-enum.js +131 -0
  70. package/lib/es/components/modules/filter.js +45 -463
  71. package/lib/es/components/modules/join-data.js +865 -527
  72. package/lib/es/components/modules/permission-table.js +4 -0
  73. package/lib/es/components/modules/sort.js +102 -91
  74. package/lib/es/components/modules/summarize/group-by.js +48 -17
  75. package/lib/es/components/modules/summarize/select-index.js +49 -18
  76. package/lib/es/components/modules/table-data.js +13 -4
  77. package/lib/es/hooks/patch.d.ts +4 -0
  78. package/lib/es/hooks/patch.js +457 -0
  79. package/lib/es/hooks/use-state.js +73 -138
  80. package/lib/es/index.d.ts +0 -1
  81. package/lib/es/index.js +1 -1
  82. package/lib/es/locale/en.js +9 -2
  83. package/lib/es/locale/zh.js +11 -4
  84. package/lib/es/store/helper.d.ts +2 -3
  85. package/lib/es/store/helper.js +288 -233
  86. package/lib/es/store/types.d.ts +94 -71
  87. package/lib/es/store/types.js +16 -11
  88. package/lib/es/utils.d.ts +3 -3
  89. package/lib/es/utils.js +154 -190
  90. package/package.json +1 -1
  91. package/lib/cjs/components/modules/filter copy.d.ts +0 -7
  92. package/lib/cjs/components/modules/filter copy.js +0 -178
  93. package/lib/es/components/modules/filter copy.d.ts +0 -7
  94. package/lib/es/components/modules/filter copy.js +0 -171
  95. /package/lib/cjs/components/dialog/{select-filter → expression}/index.less +0 -0
  96. /package/lib/es/components/dialog/{select-filter → expression}/index.less +0 -0
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -10,19 +11,20 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/
10
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  require("./index.less");
13
- var _react = require("react");
14
+ var _react = _interopRequireWildcard(require("react"));
14
15
  var _pandoraIcons = require("@gingkoo/pandora-icons");
15
16
  var _pandora = require("@gingkoo/pandora");
16
17
  var _classnames = _interopRequireDefault(require("classnames"));
17
18
  var _dayjs = _interopRequireDefault(require("dayjs"));
18
19
  var _locale = require("../../../locale");
19
20
  var _enum = require("../../../store/enum");
20
- var _helper = require("../../../store/helper");
21
+ var _types = require("../../../store/types");
21
22
  var _const = require("../const");
22
23
  var _selectList = _interopRequireDefault(require("../select-list"));
23
- var _index2 = require("../index");
24
+ var _selectColumnMultiple = _interopRequireDefault(require("../select-column-multiple"));
24
25
  var _icons = require("../../icons");
25
26
  var _useProvider = require("../../../hooks/use-provider");
27
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
26
28
  /**
27
29
  * 关联模块 选择表字段
28
30
  */
@@ -40,7 +42,7 @@ var typeList = [{
40
42
  label: _enum.SQL_COLUMN_TYPE.STRING
41
43
  }, {
42
44
  key: _enum.SQL_COLUMN_TYPE.FLOAT,
43
- label: _enum.SQL_COLUMN_TYPE.FLOAT
45
+ label: 'NUMBER'
44
46
  }, {
45
47
  key: _enum.SQL_COLUMN_TYPE.DATE,
46
48
  label: _enum.SQL_COLUMN_TYPE.DATE
@@ -52,7 +54,7 @@ var typeList = [{
52
54
  // };
53
55
  // });
54
56
  var SelectFilterColumn = function SelectFilterColumn(_ref) {
55
- var _curColumn$table;
57
+ var _value$lhs;
56
58
  var _ref$data = _ref.data,
57
59
  data = _ref$data === void 0 ? [] : _ref$data,
58
60
  value = _ref.value,
@@ -68,67 +70,95 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
68
70
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
69
71
  curColumn = _useState2[0],
70
72
  setCurColumn = _useState2[1];
71
- var _useState3 = (0, _react.useState)(value.condition),
73
+ var _useState3 = (0, _react.useState)(value.condition || ''),
72
74
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
73
75
  condition = _useState4[0],
74
76
  setCondition = _useState4[1];
75
- var _useState5 = (0, _react.useState)(value.valType || 'string'),
77
+ var _useState5 = (0, _react.useState)(value.rhs || []),
76
78
  _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
77
- valType = _useState6[0],
78
- setValType = _useState6[1];
79
- var _useState7 = (0, _react.useState)(value.val),
79
+ rhsVal = _useState6[0],
80
+ setRhsVal = _useState6[1];
81
+ // const [valType, setValType] = useState<'string' | 'constant' | 'field' | ''>(
82
+ // value.valType || 'string',
83
+ // );
84
+ // const [constantName, setConstantName] = useState<string>(value.constantName || '');
85
+ var _useState7 = (0, _react.useState)((value === null || value === void 0 ? void 0 : value.database_type) || _enum.SQL_COLUMN_TYPE.STRING),
80
86
  _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
81
- curVal = _useState8[0],
82
- setVal = _useState8[1];
83
- var _useState9 = (0, _react.useState)(value.constantName || ''),
84
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
85
- constantName = _useState10[0],
86
- setConstantName = _useState10[1];
87
- var _useState11 = (0, _react.useState)(value.database_type || _enum.SQL_COLUMN_TYPE.STRING),
88
- _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
89
- special_type = _useState12[0],
90
- setSpecial_type = _useState12[1];
91
- var _useState13 = (0, _react.useState)(value.formula || {}),
92
- _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
93
- formula = _useState14[0],
94
- setFormula = _useState14[1];
87
+ special_type = _useState8[0],
88
+ setSpecial_type = _useState8[1];
89
+ var _useState9 = (0, _react.useState)(value.formula || {}),
90
+ _useState0 = (0, _slicedToArray2["default"])(_useState9, 2),
91
+ formula = _useState0[0],
92
+ setFormula = _useState0[1];
95
93
  var store = (0, _useProvider.useStore)();
96
- var _useState15 = (0, _react.useState)(false),
97
- _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
98
- popupVisible = _useState16[0],
99
- setPopupVisible = _useState16[1];
100
- var table2Selected = Boolean((_curColumn$table = curColumn.table2) === null || _curColumn$table === void 0 ? void 0 : _curColumn$table.name);
94
+ var _useState1 = (0, _react.useState)(false),
95
+ _useState10 = (0, _slicedToArray2["default"])(_useState1, 2),
96
+ popupVisible = _useState10[0],
97
+ setPopupVisible = _useState10[1];
98
+ var _useState11 = (0, _react.useState)((value === null || value === void 0 || (_value$lhs = value.lhs) === null || _value$lhs === void 0 ? void 0 : _value$lhs.length) > 0 || false),
99
+ _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
100
+ isNext = _useState12[0],
101
+ setIsNext = _useState12[1];
102
+ var table2Selected = Boolean(rhsVal && (rhsVal === null || rhsVal === void 0 ? void 0 : rhsVal.length) > 0);
101
103
  var disabled = (0, _react.useMemo)(function () {
102
- var _curColumn$table2;
103
104
  if (!condition) return true;
104
105
  if (~['无需结果'].indexOf(condition)) {
105
106
  return false;
106
107
  }
107
- if ((_curColumn$table2 = curColumn.table2) !== null && _curColumn$table2 !== void 0 && _curColumn$table2.id && ~['等于', '不等于', '早于', '晚于'].indexOf(condition)) {
108
- return false;
109
- }
110
108
  if (~['为空', '不为空', '是空的', '不是空的'].indexOf(condition)) {
111
109
  return false;
112
- } else if (~['前', '下一个', '介于之间'].indexOf(condition)) {
113
- if (curVal[0] && curVal[1]) {
114
- return false;
115
- }
116
- } else if (curVal.length && curVal.join(',')) {
117
- return false;
118
110
  }
111
+ var isOk = rhsVal.every(function (v) {
112
+ if (v.type === _types.AtomsTypeEnum.INPUT_STRING || v.type === _types.AtomsTypeEnum.CONSTANT) {
113
+ return v.val;
114
+ }
115
+ if (v.type === _types.AtomsTypeEnum.INPUT_STRING_LIST) {
116
+ return v.val.every(function (vv) {
117
+ return vv;
118
+ });
119
+ }
120
+ if (v.type === _types.AtomsTypeEnum.FIELD) {
121
+ return v.fieldName;
122
+ }
123
+ });
124
+ return !isOk;
125
+ // console.log('🚀 ~ disabled ~ a:', a);
126
+ // if ((rhsVal[0] as AtomsString).val && ~['等于', '不等于', '早于', '晚于'].indexOf(condition)) {
127
+ // return false;
128
+ // }
129
+ // if (~['为空', '不为空', '是空的', '不是空的'].indexOf(condition)) {
130
+ // return false;
131
+ // }
132
+ // else if (~['前', '下一个', '介于之间'].indexOf(condition)) {
133
+ // if ((rhsVal[0] as AtomsStringList).val[0] && (rhsVal[0] as AtomsStringList).val[1]) {
134
+ // return false;
135
+ // }
136
+ // } else if (rhsVal.length && (rhsVal as AtomsString[]).map((v) => v.val).join(',')) {
137
+ // return false;
138
+ // }
119
139
  return true;
120
- }, [curVal, condition, curColumn, isCustom]);
140
+ }, [rhsVal, condition, curColumn]);
121
141
  (0, _react.useEffect)(function () {
122
142
  didUpdate === null || didUpdate === void 0 || didUpdate();
123
143
  }, [condition]);
124
- var getQuotesName = function getQuotesName(name) {
144
+ var getAtomsQuotesName = function getAtomsQuotesName(items) {
145
+ var names = items.map(function (v) {
146
+ if ((v === null || v === void 0 ? void 0 : v.type) === _types.AtomsTypeEnum.FIELD) {
147
+ return v.fieldName;
148
+ } else {
149
+ return v.val;
150
+ }
151
+ });
152
+ return names.join(' || ');
153
+ };
154
+ var getQuotesName = function getQuotesName(items) {
125
155
  var _formula$params, _formula$params2;
156
+ var names = getAtomsQuotesName(items);
126
157
  switch (formula.type) {
127
158
  case 'SUBSTR':
128
- // let str = formula.params?.join(',');
129
- return "SUBSTR(".concat(name, ",").concat(formula === null || formula === void 0 || (_formula$params = formula.params) === null || _formula$params === void 0 ? void 0 : _formula$params[1], ",").concat(formula === null || formula === void 0 || (_formula$params2 = formula.params) === null || _formula$params2 === void 0 ? void 0 : _formula$params2[2], ")");
159
+ return "SUBSTR(".concat(names, ",").concat(formula === null || formula === void 0 || (_formula$params = formula.params) === null || _formula$params === void 0 ? void 0 : _formula$params[1], ",").concat(formula === null || formula === void 0 || (_formula$params2 = formula.params) === null || _formula$params2 === void 0 ? void 0 : _formula$params2[2], ")");
130
160
  default:
131
- return name;
161
+ return names;
132
162
  }
133
163
  };
134
164
  var getText = function getText(v) {
@@ -158,151 +188,147 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
158
188
  }[v];
159
189
  };
160
190
  function generateQuotes(val, curColumn) {
161
- var _val = (0, _slicedToArray2["default"])(val, 2),
162
- _val$ = _val[0],
163
- firstVal = _val$ === void 0 ? '' : _val$,
164
- _val$2 = _val[1],
165
- secondVal = _val$2 === void 0 ? '' : _val$2;
191
+ var _val = val[0];
192
+ var firstVal = '',
193
+ secondVal = '';
194
+ if (_val.type === _types.AtomsTypeEnum.INPUT_STRING) {
195
+ firstVal = _val.val;
196
+ }
197
+ if (_val.type === _types.AtomsTypeEnum.INPUT_STRING_LIST) {
198
+ firstVal = _val.val[0] || '';
199
+ secondVal = _val.val[1] || '';
200
+ }
201
+ // let [first = { val: '', type: AtomsTypeEnum.INPUT }] = val as AtomsString[];
202
+ // let firstVal = first.val || '';
203
+ // let secondVal = second.val || '';
166
204
  var quotes = '';
167
205
  if (condition === '以...开始') {
168
206
  if (_locale.isEn) {
169
- quotes = getQuotesName(curColumn.name) + ' ' + "startWith ".concat(firstVal);
207
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "startWith ".concat(firstVal);
170
208
  } else {
171
- quotes = getQuotesName(curColumn.name) + ' ' + "\u4EE5 ".concat(firstVal, " \u5F00\u59CB");
209
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "\u4EE5 ".concat(firstVal, " \u5F00\u59CB");
172
210
  }
173
211
  } else if (condition === '不以...开始') {
174
212
  if (_locale.isEn) {
175
- quotes = getQuotesName(curColumn.name) + ' ' + "not startWith ".concat(firstVal);
213
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "not startWith ".concat(firstVal);
176
214
  } else {
177
- quotes = getQuotesName(curColumn.name) + ' ' + "\u4E0D\u4EE5 ".concat(firstVal, " \u5F00\u59CB");
215
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "\u4E0D\u4EE5 ".concat(firstVal, " \u5F00\u59CB");
178
216
  }
179
217
  } else if (condition === '以...结束') {
180
218
  if (_locale.isEn) {
181
- quotes = getQuotesName(curColumn.name) + ' ' + "endWith ".concat(firstVal);
219
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "endWith ".concat(firstVal);
182
220
  } else {
183
- quotes = getQuotesName(curColumn.name) + ' ' + "\u4EE5 ".concat(firstVal, " \u7ED3\u675F");
221
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "\u4EE5 ".concat(firstVal, " \u7ED3\u675F");
184
222
  }
185
223
  } else if (condition === '不以...结束') {
186
224
  if (_locale.isEn) {
187
- quotes = getQuotesName(curColumn.name) + ' ' + "not endWith ".concat(firstVal);
225
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "not endWith ".concat(firstVal);
188
226
  } else {
189
- quotes = getQuotesName(curColumn.name) + ' ' + "\u4E0D\u4EE5 ".concat(firstVal, " \u7ED3\u675F");
227
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "\u4E0D\u4EE5 ".concat(firstVal, " \u7ED3\u675F");
190
228
  }
191
229
  } else if (condition === '介于之间') {
192
230
  if (_locale.isEn) {
193
- quotes = getQuotesName(curColumn.name) + ' ' + "Between ".concat(firstVal, " and ").concat(secondVal);
231
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "Between ".concat(firstVal, " and ").concat(secondVal);
194
232
  } else {
195
- quotes = getQuotesName(curColumn.name) + ' ' + "\u4ECB\u4E8E".concat(firstVal, "\u548C").concat(secondVal, "\u4E4B\u95F4");
233
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "\u4ECB\u4E8E".concat(firstVal, "\u548C").concat(secondVal, "\u4E4B\u95F4");
196
234
  }
197
235
  } else if (condition === '前') {
198
236
  if (_locale.isEn) {
199
- quotes = getQuotesName(curColumn.name) + ' ' + "previous ".concat(firstVal).concat(secondVal);
237
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "previous ".concat(firstVal).concat(secondVal);
200
238
  } else {
201
- quotes = getQuotesName(curColumn.name) + ' ' + "\u4E0A\u4E00\u4E2A".concat(firstVal).concat(secondVal);
239
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "\u4E0A\u4E00\u4E2A".concat(firstVal).concat(secondVal);
202
240
  }
203
241
  } else if (condition === '下一个') {
204
242
  if (_locale.isEn) {
205
- quotes = getQuotesName(curColumn.name) + ' ' + "next ".concat(firstVal).concat(secondVal);
243
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "next ".concat(firstVal).concat(secondVal);
206
244
  } else {
207
- quotes = getQuotesName(curColumn.name) + ' ' + "\u4E0B\u4E00\u4E2A".concat(firstVal).concat(secondVal);
245
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "\u4E0B\u4E00\u4E2A".concat(firstVal).concat(secondVal);
208
246
  }
209
247
  } else if (condition === '在') {
210
248
  if (_locale.isEn) {
211
- quotes = getQuotesName(curColumn.name) + ' is ' + firstVal;
249
+ quotes = getQuotesName(curColumn.lhs) + ' is ' + firstVal;
212
250
  } else {
213
- quotes = getQuotesName(curColumn.name) + ' 是 ' + firstVal;
251
+ quotes = getQuotesName(curColumn.lhs) + ' 是 ' + firstVal;
214
252
  }
215
253
  } else if (condition === '是空的') {
216
254
  if (_locale.isEn) {
217
- quotes = getQuotesName(curColumn.name) + ' is empty';
255
+ quotes = getQuotesName(curColumn.lhs) + ' is empty';
218
256
  } else {
219
- quotes = getQuotesName(curColumn.name) + ' 为空';
257
+ quotes = getQuotesName(curColumn.lhs) + ' 为空';
220
258
  }
221
259
  } else if (condition === '不是空的') {
222
260
  if (_locale.isEn) {
223
- quotes = getQuotesName(curColumn.name) + ' not empty';
261
+ quotes = getQuotesName(curColumn.lhs) + ' not empty';
224
262
  } else {
225
- quotes = getQuotesName(curColumn.name) + ' 不为空';
263
+ quotes = getQuotesName(curColumn.lhs) + ' 不为空';
226
264
  }
227
265
  } else if (condition === '当前') {
228
266
  if (firstVal === '天') {
229
267
  if (_locale.isEn) {
230
- quotes = getQuotesName(curColumn.name) + ' ' + "today";
268
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "today";
231
269
  } else {
232
- quotes = getQuotesName(curColumn.name) + ' ' + "\u4ECA\u5929";
270
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "\u4ECA\u5929";
233
271
  }
234
272
  } else {
235
273
  if (_locale.isEn) {
236
- quotes = getQuotesName(curColumn.name) + ' ' + "this is ".concat(firstVal);
274
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "this is ".concat(firstVal);
237
275
  } else {
238
- quotes = getQuotesName(curColumn.name) + ' ' + "\u8FD9\u4E2A".concat(firstVal);
276
+ quotes = getQuotesName(curColumn.lhs) + ' ' + "\u8FD9\u4E2A".concat(firstVal);
239
277
  }
240
278
  }
241
279
  } else if (condition === 'In') {
242
280
  var cond = (0, _locale.__)('filter.within');
243
- quotes = getQuotesName(curColumn.name) + ' ' + cond + ' ' + "(".concat(firstVal, ")");
281
+ quotes = getQuotesName(curColumn.lhs) + ' ' + cond + ' ' + "(".concat(firstVal, ")");
244
282
  } else if (condition === 'Not In') {
245
283
  var _cond = (0, _locale.__)('filter.withnotin');
246
- quotes = getQuotesName(curColumn.name) + ' ' + _cond + ' ' + "(".concat(firstVal, ")");
284
+ quotes = getQuotesName(curColumn.lhs) + ' ' + _cond + ' ' + "(".concat(firstVal, ")");
247
285
  } else {
248
- var _curColumn$table3;
249
286
  var _cond2 = (0, _locale.__)(getText(condition));
250
- if ((_curColumn$table3 = curColumn.table2) !== null && _curColumn$table3 !== void 0 && _curColumn$table3.id) {
251
- quotes = getQuotesName(curColumn.name) + ' ' + _cond2 + ' ' + curColumn.table2.name;
287
+ if (rhsVal !== null && rhsVal !== void 0 && rhsVal.length) {
288
+ quotes = getQuotesName(curColumn.lhs) + ' ' + _cond2 + ' ' + getQuotesName(rhsVal);
252
289
  } else {
253
- quotes = getQuotesName(curColumn.name) + ' ' + _cond2 + ' ' + firstVal;
290
+ quotes = getQuotesName(curColumn.lhs) + ' ' + _cond2 + ' ' + firstVal;
254
291
  }
255
292
  }
256
293
  return quotes;
257
294
  }
258
295
  function addFilter() {
259
296
  if (disabled) return void 0;
260
- var quotes = generateQuotes(curVal, curColumn);
297
+ var quotes = generateQuotes(rhsVal, curColumn);
261
298
  typeof onChange === 'function' && onChange((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, curColumn), {}, {
262
299
  formula: formula,
263
- val: curVal,
264
- // 选择结果 如果有两个 长度就为2
265
- constantName: constantName,
266
- //变量字段
267
- valType: valType,
268
- //是否是选择字段
300
+ rhs: rhsVal,
269
301
  condition: condition,
270
302
  // 选择条件
271
303
  quotes: quotes,
272
304
  // 前端显示用户看的文字
273
- database_type: filterCustomType ? special_type : '',
274
- // 自定义类型
275
- groupSql: curColumn.alias === _helper.SummarizeAlias ? curColumn.sql : ''
305
+ database_type: filterCustomType ? special_type : '' // 自定义类型
306
+ // groupSql: curColumn.alias === SummarizeAlias ? curColumn.sql : '',
276
307
  }));
277
308
  }
278
309
  function goPrevPage() {
279
- setCurColumn({
280
- table: '',
281
- // 表名
282
- tableId: '',
283
- // 表名
284
- tableUuid: '',
285
- // 表名
286
- fieldAlias: '',
287
- fieldUuid: '',
288
- alias: '',
289
- // 表的别名
290
- name: '',
291
- // 字段名
292
- id: '',
293
- // 字段名
294
- sql: '',
295
- datasourceId: '',
296
- datasourceName: '',
297
- database_type: '' // 字段类型
298
- });
299
- setCondition('');
300
- setFormula({});
301
- setVal([]);
310
+ // setCurColumn({
311
+ // lhs: [],
312
+ // rhs: [],
313
+ // database_type: '', // 字段类型
314
+ // condition: '', // 条件 聚合by过来的会有这个
315
+ // quotes: '', // 展示用户看的 组装的文字
316
+ // type: AtomsTypeEnum.EXPRESSION, // 连接类型
317
+ // });
318
+ setIsNext(false);
319
+ // setCondition('');
320
+ // setFormula({});
321
+ // setRhsVal([
322
+ // {
323
+ // val: '',
324
+ // type: AtomsTypeEnum.INPUT,
325
+ // },
326
+ // ]);
302
327
  }
303
328
  function getData(data) {
304
- var database_type = data.database_type;
305
- var columnType = filterCustomType ? special_type : database_type.toUpperCase();
329
+ var _data$database_type = data.database_type,
330
+ database_type = _data$database_type === void 0 ? '' : _data$database_type;
331
+ var columnType = filterCustomType ? special_type : database_type === null || database_type === void 0 ? void 0 : database_type.toUpperCase();
306
332
  var conditions = STRING_LIST;
307
333
  var type = _enum.SQL_GROUP_TYPE.STRING;
308
334
  if (_const.NUMBER_GROUP.includes(columnType)) {
@@ -325,9 +351,16 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
325
351
  };
326
352
  }
327
353
  function renderFilter(type, conditionText) {
328
- var _curVal = (0, _slicedToArray2["default"])(curVal, 2),
329
- firstVal = _curVal[0],
330
- secondVal = _curVal[1];
354
+ var _val = rhsVal[0];
355
+ var firstVal = '',
356
+ secondVal = '';
357
+ if (_val.type === _types.AtomsTypeEnum.INPUT_STRING) {
358
+ firstVal = _val.val;
359
+ }
360
+ if (_val.type === _types.AtomsTypeEnum.INPUT_STRING_LIST) {
361
+ firstVal = _val.val[0] || '';
362
+ secondVal = _val.val[1] || '';
363
+ }
331
364
  if (~['为空', '不为空', '是空的', '不是空的'].indexOf(conditionText)) {
332
365
  return null;
333
366
  } else if (conditionText === '介于之间') {
@@ -342,18 +375,18 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
342
375
  placeholder: (0, _locale.__)('filter.enterANumber'),
343
376
  value: firstVal || '',
344
377
  onInput: function onInput(e) {
345
- var newVal = curVal.slice();
346
- newVal[0] = e.target.value;
347
- setVal(newVal);
378
+ var newVal = rhsVal.slice();
379
+ newVal[0].val[0] = e.target.value;
380
+ setRhsVal(newVal);
348
381
  }
349
382
  }), (0, _jsxRuntime.jsx)(_pandora.Input, {
350
383
  className: 'input',
351
384
  placeholder: (0, _locale.__)('filter.enterANumber'),
352
385
  value: secondVal || '',
353
386
  onInput: function onInput(e) {
354
- var newVal = curVal.slice();
355
- newVal[1] = e.target.value;
356
- setVal(newVal);
387
+ var newVal = rhsVal.slice();
388
+ newVal[0].val[1] = e.target.value;
389
+ setRhsVal(newVal);
357
390
  }
358
391
  })]
359
392
  });
@@ -370,7 +403,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
370
403
  value: firstVal ? [(0, _dayjs["default"])(firstVal !== null && firstVal !== void 0 ? firstVal : undefined), (0, _dayjs["default"])(secondVal !== null && secondVal !== void 0 ? secondVal : undefined)] : [],
371
404
  onChange: function onChange(val) {
372
405
  // @ts-ignore
373
- val && setVal([(0, _dayjs["default"])(val[0]).format('YYYY-MM-DD HH:mm'), (0, _dayjs["default"])(val[1]).format('YYYY-MM-DD HH:mm')]);
406
+ val && setRhsVal([{
407
+ type: _types.AtomsTypeEnum.INPUT_STRING_LIST,
408
+ val: [(0, _dayjs["default"])(val[0]).format('YYYY-MM-DD HH:mm'), (0, _dayjs["default"])(val[1]).format('YYYY-MM-DD HH:mm')]
409
+ }]);
374
410
  }
375
411
  })
376
412
  });
@@ -380,7 +416,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
380
416
  children: (0, _jsxRuntime.jsx)(_pandora.Dropdown, {
381
417
  trigger: ['click'],
382
418
  onChange: function onChange(key) {
383
- setVal([key]);
419
+ setRhsVal([{
420
+ type: _types.AtomsTypeEnum.INPUT_STRING,
421
+ val: key
422
+ }]);
384
423
  },
385
424
  droplist: [{
386
425
  key: '天',
@@ -412,9 +451,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
412
451
  placeholder: (0, _locale.__)('filter.enterANumber'),
413
452
  value: firstVal || '',
414
453
  onInput: function onInput(e) {
415
- var newVal = curVal.slice();
416
- newVal[0] = e.target.value;
417
- setVal(newVal);
454
+ var newVal = rhsVal.slice();
455
+ // (newVal as AtomsStringList[])[0].val[0] = e.target.value;
456
+ newVal[0].val = e.target.value;
457
+ setRhsVal(newVal);
418
458
  }
419
459
  }), (0, _jsxRuntime.jsx)(_pandora.Dropdown, {
420
460
  trigger: ['click'],
@@ -438,9 +478,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
438
478
  label: (0, _locale.__)('filter.year')
439
479
  }],
440
480
  onChange: function onChange(key) {
441
- var newVal = curVal.slice();
442
- newVal[1] = key;
443
- setVal(newVal);
481
+ var newVal = rhsVal.slice();
482
+ newVal[1].val = key;
483
+ // (newVal as AtomsStringList[])[0].val[1] = key;
484
+ setRhsVal(newVal);
444
485
  },
445
486
  children: (0, _jsxRuntime.jsxs)(_pandora.Button, {
446
487
  className: 'operator-btn',
@@ -462,9 +503,19 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
462
503
  value: firstVal ? (0, _dayjs["default"])(firstVal) : '',
463
504
  onChange: function onChange(val) {
464
505
  if (val) {
465
- setVal([(0, _dayjs["default"])(val).format('YYYY-MM-DD HH:mm')]);
506
+ setRhsVal([{
507
+ type: _types.AtomsTypeEnum.INPUT_STRING,
508
+ val: (0, _dayjs["default"])(val).format('YYYY-MM-DD HH:mm')
509
+ }, {
510
+ type: _types.AtomsTypeEnum.INPUT_STRING,
511
+ val: (0, _dayjs["default"])(val).format('YYYY-MM-DD HH:mm')
512
+ }]);
466
513
  } else {
467
- setVal([]);
514
+ setRhsVal([{
515
+ val: '',
516
+ type: _types.AtomsTypeEnum.INPUT_STRING
517
+ }]);
518
+ // setVal([]);
468
519
  }
469
520
  }
470
521
  })
@@ -480,9 +531,15 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
480
531
  value: firstVal ? (0, _dayjs["default"])(firstVal) : '',
481
532
  onChange: function onChange(val) {
482
533
  if (val) {
483
- setVal([(0, _dayjs["default"])(val).format('YYYY-MM-DD HH:mm')]);
534
+ setRhsVal([{
535
+ type: _types.AtomsTypeEnum.INPUT_STRING,
536
+ val: (0, _dayjs["default"])(val).format('YYYY-MM-DD HH:mm')
537
+ }]);
484
538
  } else {
485
- setVal([]);
539
+ setRhsVal([{
540
+ val: '',
541
+ type: _types.AtomsTypeEnum.INPUT_STRING
542
+ }]);
486
543
  }
487
544
  }
488
545
  })
@@ -497,7 +554,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
497
554
  multiple: true,
498
555
  value: options,
499
556
  onChange: function onChange(val) {
500
- setVal([val.join(',')]);
557
+ setRhsVal([{
558
+ type: _types.AtomsTypeEnum.INPUT_STRING,
559
+ val: val.join(',')
560
+ }]);
501
561
  },
502
562
  popupVisible: popupVisible,
503
563
  onBlur: function onBlur() {
@@ -521,9 +581,9 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
521
581
  placeholder: (0, _locale.__)('filter.pleaseEnter'),
522
582
  value: firstVal || '',
523
583
  onInput: function onInput(e) {
524
- var newVal = curVal.slice();
525
- newVal[0] = e.target.value;
526
- setVal(newVal);
584
+ var newVal = rhsVal.slice();
585
+ newVal[0].val = e.target.value;
586
+ setRhsVal(newVal);
527
587
  }
528
588
  })
529
589
  });
@@ -538,25 +598,22 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
538
598
  // 选择变量
539
599
  var selectConstant = function selectConstant(e) {
540
600
  store.setClosable(false);
601
+ var node = e.currentTarget;
602
+ var _type = Number(node.getAttribute('v-type'));
541
603
  store.setPopup2({
542
604
  visible: true,
543
605
  node: e.currentTarget,
544
606
  container: container,
545
607
  content: (0, _jsxRuntime.jsx)(_selectList["default"], {
546
- value: valType,
608
+ value: _type,
547
609
  list: store.constantList || [],
548
610
  onChange: function onChange(val) {
549
611
  closePopup2();
550
- var curObj = store.constantList.filter(function (v) {
551
- return v.value === val;
552
- })[0];
553
- var newVal = curVal.slice();
554
- newVal[0] = val;
555
- setVal(newVal);
556
- setConstantName(curObj.label);
612
+ // let curObj = store.constantList.filter((v: any) => v.value === val)[0];
613
+ var newVal = rhsVal.slice();
614
+ newVal[0].val = val;
615
+ setRhsVal(newVal);
557
616
  store.setClosable(true);
558
- // (newMeta[index] as MetaJoin).expressions[_ind][`${position}_type`] = type;
559
- // store.setMeta(newMeta, groupIndex);
560
617
  }
561
618
  })
562
619
  });
@@ -568,48 +625,85 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
568
625
  node: e.currentTarget,
569
626
  container: container,
570
627
  content: (0, _jsxRuntime.jsx)(_selectList["default"], {
571
- value: valType,
628
+ value: '',
572
629
  list: [{
573
- value: 'string',
630
+ value: _types.AtomsTypeEnum.INPUT_STRING,
574
631
  label: (0, _locale.__)('SqlQueryBuilder.input')
575
632
  }, {
576
- value: 'constant',
633
+ value: _types.AtomsTypeEnum.CONSTANT,
577
634
  label: (0, _locale.__)('customColumn.constant')
578
635
  }, {
579
- value: 'field',
636
+ value: _types.AtomsTypeEnum.FIELD,
580
637
  label: (0, _locale.__)('SqlQueryBuilder.columns')
581
638
  }],
582
639
  onChange: function onChange(type) {
583
640
  closePopup2();
584
- setConstantName('');
585
- setValType(type);
586
- setVal([]);
587
- setCurColumn((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, curColumn), {}, {
588
- table2: null
589
- }));
641
+ if (type === _types.AtomsTypeEnum.INPUT_STRING || type === _types.AtomsTypeEnum.CONSTANT) {
642
+ setRhsVal([{
643
+ val: '',
644
+ type: type
645
+ }]);
646
+ }
647
+ if (type === _types.AtomsTypeEnum.FIELD) {
648
+ setRhsVal([{
649
+ fieldName: '',
650
+ // 字段名
651
+ fieldNameZh: '',
652
+ // 字段中文名
653
+ fieldAlias: '',
654
+ // 别名
655
+ fieldUuid: '',
656
+ // uuid
657
+ fieldId: '',
658
+ // 字段id
659
+ // quotes?: string; // 字段展示的 不知道有没有用
660
+ tableName: '',
661
+ // 表名
662
+ tableNameZh: '',
663
+ tableId: '',
664
+ // 表名
665
+ tableAlias: '',
666
+ // 别名
667
+ tableUuid: '',
668
+ // 表唯一标识
669
+ datasourceName: '',
670
+ // 数据源名
671
+ datasourceId: '',
672
+ // 数据源id
673
+ type: _types.AtomsTypeEnum.FIELD
674
+ }]);
675
+ }
590
676
  store.setClosable(true);
591
- // (newMeta[index] as MetaJoin).expressions[_ind][`${position}_type`] = type;
592
- // store.setMeta(newMeta, groupIndex);
593
677
  }
594
678
  })
595
679
  });
596
680
  };
597
- var nextPage = !!curColumn.name;
598
681
  var selectTable = function selectTable(e) {
599
682
  store.setClosable(false);
683
+ var node = e.currentTarget;
684
+ var _index = Number(node.getAttribute('v-index'));
600
685
  store.setPopup2({
601
686
  visible: true,
602
687
  node: e.currentTarget,
603
688
  container: container,
604
- content: (0, _jsxRuntime.jsx)(_index2.SelectJoinColumn, {
689
+ content: (0, _jsxRuntime.jsx)(_selectColumnMultiple["default"], {
605
690
  data: (0, _toConsumableArray2["default"])(data),
606
- value: value,
691
+ multiple: false,
692
+ value: rhsVal,
607
693
  theme: _enum.ColumnsPopupThemeEnum.purple,
608
694
  didUpdate: didUpdate,
609
- onSelect: function onSelect(record) {
610
- setCurColumn((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, curColumn), {}, {
611
- table2: record
612
- }));
695
+ showNextBtn: true,
696
+ nextBtnText: (0, _locale.__)('metabase.nextOk'),
697
+ onNextStep: function onNextStep() {
698
+ store.setPopup2({
699
+ visible: false
700
+ });
701
+ },
702
+ onSelect: function onSelect(fields, quotes) {
703
+ var newR = (0, _toConsumableArray2["default"])(rhsVal);
704
+ newR = fields;
705
+ // (newR[_index] as AtomsField).quotes = quotes;
706
+ setRhsVal(newR);
613
707
  store.setPopup2({
614
708
  visible: false
615
709
  });
@@ -618,10 +712,10 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
618
712
  })
619
713
  });
620
714
  };
621
- if (nextPage) {
622
- var _curColumn$table4;
715
+ if (isNext) {
716
+ // SQL_GROUP_TYPE
623
717
  var _getData = getData(curColumn),
624
- type = _getData.type,
718
+ fieldType = _getData.type,
625
719
  conditions = _getData.conditions;
626
720
  var menu = conditions.map(function (v) {
627
721
  return {
@@ -632,7 +726,13 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
632
726
  var changeFormula = function changeFormula(val) {
633
727
  var params = [];
634
728
  if (val === 'SUBSTR') {
635
- params[0] = curColumn.name;
729
+ var names = [];
730
+ curColumn.lhs.filter(function (v) {
731
+ return v.type === _types.AtomsTypeEnum.FIELD;
732
+ }).map(function (v) {
733
+ names.push(v.fieldName);
734
+ });
735
+ params[0] = names.join(' || ');
636
736
  }
637
737
  setFormula({
638
738
  type: val,
@@ -666,12 +766,13 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
666
766
  })
667
767
  });
668
768
  };
669
- var getName = function getName(name) {
769
+ var getName = function getName(items) {
670
770
  var _formula$params3, _formula$params4;
771
+ var names = getAtomsQuotesName(items);
671
772
  switch (formula.type) {
672
773
  case 'SUBSTR':
673
774
  return (0, _jsxRuntime.jsxs)("div", {
674
- children: ["SUBSTR(", name, ",", (0, _jsxRuntime.jsx)(_pandora.InputNumber, {
775
+ children: ["SUBSTR(", names, ",", (0, _jsxRuntime.jsx)(_pandora.InputNumber, {
675
776
  className: 'left-info-formula-input',
676
777
  hideControl: true,
677
778
  placeholder: '',
@@ -701,7 +802,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
701
802
  }), ")"]
702
803
  });
703
804
  default:
704
- return name;
805
+ return names;
705
806
  }
706
807
  };
707
808
  return (0, _jsxRuntime.jsxs)("div", {
@@ -713,7 +814,7 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
713
814
  children: [(0, _jsxRuntime.jsxs)("span", {
714
815
  className: 'span-name',
715
816
  onClick: goPrevPage,
716
- children: [(0, _jsxRuntime.jsx)(_icons.LeftArrowIcon, {}), getName(curColumn.name)]
817
+ children: [(0, _jsxRuntime.jsx)(_icons.LeftArrowIcon, {}), getName(curColumn.lhs)]
717
818
  }), leftFormula()]
718
819
  }), (0, _jsxRuntime.jsxs)("div", {
719
820
  className: 'right-info',
@@ -721,7 +822,12 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
721
822
  trigger: ['click'],
722
823
  onChange: function onChange(key) {
723
824
  setCondition('');
724
- setValType('string');
825
+ setCurColumn((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, curColumn), {}, {
826
+ rhs: [{
827
+ val: '',
828
+ type: _types.AtomsTypeEnum.INPUT_STRING
829
+ }]
830
+ }));
725
831
  setTimeout(function () {
726
832
  setSpecial_type(key);
727
833
  }, 0);
@@ -733,15 +839,12 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
733
839
  width: 104,
734
840
  marginRight: 8
735
841
  },
736
- children: [special_type || (0, _locale.__)('filter.selectType'), (0, _jsxRuntime.jsx)(_pandoraIcons.ChevronODown, {})]
842
+ children: [(special_type === _enum.SQL_COLUMN_TYPE.FLOAT ? 'NUMBER' : special_type) || (0, _locale.__)('filter.selectType'), (0, _jsxRuntime.jsx)(_pandoraIcons.ChevronODown, {})]
737
843
  })
738
844
  }), (0, _jsxRuntime.jsx)(_pandora.Dropdown, {
739
845
  trigger: ['click'],
740
846
  onChange: function onChange(key) {
741
- setValType('string');
742
- setCurColumn((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, curColumn), {}, {
743
- table2: null
744
- }));
847
+ setCurColumn((0, _objectSpread2["default"])({}, curColumn));
745
848
  setDefaultVal(key);
746
849
  },
747
850
  droplist: menu,
@@ -756,21 +859,32 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
756
859
  })]
757
860
  }), (0, _jsxRuntime.jsxs)("div", {
758
861
  className: 'content',
759
- children: [(valType === 'field' || !valType) && (0, _jsxRuntime.jsx)("div", {
760
- className: (0, _classnames["default"])("Sqb-TableName purple-name", {
761
- notSelected: !table2Selected
762
- }),
763
- onClick: selectTable,
764
- children: table2Selected ? "".concat((_curColumn$table4 = curColumn.table2) === null || _curColumn$table4 === void 0 ? void 0 : _curColumn$table4.name) : (0, _locale.__)('SqlQueryBuilder.pickTable')
765
- }), valType === 'constant' && (0, _jsxRuntime.jsx)("div", {
766
- className: (0, _classnames["default"])("Sqb-TableName purple-name", {
767
- notSelected: !curVal[0]
768
- }),
769
- onClick: selectConstant,
770
- children: constantName ? "".concat(constantName) : (0, _locale.__)('SqlQueryBuilder.pickConstant')
771
- }), valType === 'string' && (0, _jsxRuntime.jsx)("div", {
772
- className: 'content_l',
773
- children: renderFilter(type, condition)
862
+ children: [rhsVal === null || rhsVal === void 0 ? void 0 : rhsVal.map(function (v, i) {
863
+ if (v.type === _types.AtomsTypeEnum.FIELD) {
864
+ return (0, _jsxRuntime.jsx)("div", {
865
+ className: (0, _classnames["default"])("Sqb-TableName purple-name", {
866
+ notSelected: !v.fieldName
867
+ }),
868
+ "v-index": i,
869
+ onClick: selectTable,
870
+ children: v.fieldName || (0, _locale.__)('SqlQueryBuilder.pickTable')
871
+ }, i);
872
+ }
873
+ if (v.type === _types.AtomsTypeEnum.CONSTANT) {
874
+ return (0, _jsxRuntime.jsx)("div", {
875
+ className: (0, _classnames["default"])("Sqb-TableName purple-name", {
876
+ notSelected: !v.val
877
+ }),
878
+ "v-type": v.type,
879
+ onClick: selectConstant,
880
+ children: v.val ? "".concat(v.val) : (0, _locale.__)('SqlQueryBuilder.pickConstant')
881
+ }, i);
882
+ }
883
+ if (v.type === _types.AtomsTypeEnum.INPUT_STRING || v.type === _types.AtomsTypeEnum.INPUT_STRING_LIST) {
884
+ return (0, _jsxRuntime.jsx)(_react["default"].Fragment, {
885
+ children: renderFilter(fieldType, condition)
886
+ }, i);
887
+ }
774
888
  }), ~['等于', '不等于', '早于', '晚于'].indexOf(condition) ? (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
775
889
  title: (0, _locale.__)('SqlQueryBuilder.switch'),
776
890
  children: (0, _jsxRuntime.jsx)(_pandora.Button, {
@@ -798,29 +912,54 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
798
912
  function setDefaultVal(_condition) {
799
913
  setCondition(_condition);
800
914
  if (~['前', '下一个'].indexOf(_condition)) {
801
- setVal(['30', '天']);
915
+ setRhsVal([{
916
+ val: ['30', '天'],
917
+ type: _types.AtomsTypeEnum.INPUT_STRING_LIST
918
+ }]);
919
+ } else if (~['介于之间'].indexOf(_condition)) {
920
+ setRhsVal([{
921
+ val: ['', ''],
922
+ type: _types.AtomsTypeEnum.INPUT_STRING_LIST
923
+ }]);
802
924
  } else if (~['当前'].indexOf(_condition)) {
803
- setVal(['天']);
925
+ setRhsVal([{
926
+ val: '天',
927
+ type: _types.AtomsTypeEnum.INPUT_STRING
928
+ }]);
804
929
  } else if (~['早于', '晚于', '在'].indexOf(_condition)) {
805
- setVal([(0, _dayjs["default"])().format('YYYY-MM-DD HH:mm')]);
930
+ setRhsVal([{
931
+ val: (0, _dayjs["default"])().format('YYYY-MM-DD HH:mm'),
932
+ type: _types.AtomsTypeEnum.INPUT_STRING
933
+ }]);
806
934
  } else {
807
- setVal([]);
935
+ setRhsVal([{
936
+ val: '',
937
+ type: _types.AtomsTypeEnum.INPUT_STRING
938
+ }]);
808
939
  }
809
940
  }
810
941
  return (0, _jsxRuntime.jsx)("div", {
811
- children: (0, _jsxRuntime.jsx)(_index2.SelectJoinColumn, {
942
+ children: (0, _jsxRuntime.jsx)(_selectColumnMultiple["default"], {
812
943
  data: data,
813
- value: value,
944
+ value: curColumn === null || curColumn === void 0 ? void 0 : curColumn.lhs,
814
945
  theme: _enum.ColumnsPopupThemeEnum.purple,
815
946
  didUpdate: didUpdate,
816
- onSelect: function onSelect(record) {
817
- setCurColumn(record);
947
+ showNextBtn: true,
948
+ onNextStep: function onNextStep() {
949
+ setIsNext(true);
950
+ },
951
+ onSelect: function onSelect(fields, quotes) {
952
+ // const { columns, ...other } = tableInfo;
953
+ setCurColumn((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, curColumn), {}, {
954
+ lhs: fields
955
+ }));
956
+ // setCurColumn(record);
818
957
  /**
819
958
  * 这里默认帮用户选好一部分数据
820
959
  * 不至于让用户每一个都自己选、
821
960
  * 比如说:条件字段 默认我们帮他选好第一个...
822
961
  */
823
- var _getData2 = getData(record),
962
+ var _getData2 = getData(curColumn),
824
963
  conditions = _getData2.conditions;
825
964
  setDefaultVal(conditions[0]);
826
965
  }