@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,11 +1,4 @@
1
- export declare enum OptionsTypeEnum {
2
- NOT_EXISTS = "notExists",// 输入框
3
- INPUT = "input",// 输入框
4
- FIELD = "field",// 字段
5
- OPERATOR = "operator",// 运算符
6
- EXPRESSION = "expression",// 公式
7
- OTHER = "other"
8
- }
1
+ import { AtomsTypeEnum } from '../../../store/types';
9
2
  export declare enum FunctionEnum {
10
3
  LOWER = "lower",
11
4
  UPPER = "upper",
@@ -35,9 +28,12 @@ export declare enum FunctionEnum {
35
28
  'COALESCE' = "coalesce"
36
29
  }
37
30
  export declare const operatorList: string[];
38
- export declare const otherList: string[];
39
- export declare const functionList: string[];
40
- export declare const customTypes: {
41
- value: OptionsTypeEnum;
31
+ export declare const customTypes: ({
32
+ value: AtomsTypeEnum;
33
+ label: any;
34
+ children?: undefined;
35
+ } | {
36
+ value: AtomsTypeEnum;
42
37
  label: any;
43
- }[];
38
+ children: string[];
39
+ })[];
@@ -1,14 +1,14 @@
1
1
  import { __ } from '../../../locale';
2
- export var OptionsTypeEnum;
3
- (function (OptionsTypeEnum) {
4
- // CONSTANT = 'constant', // 常量
5
- OptionsTypeEnum["NOT_EXISTS"] = "notExists";
6
- OptionsTypeEnum["INPUT"] = "input";
7
- OptionsTypeEnum["FIELD"] = "field";
8
- OptionsTypeEnum["OPERATOR"] = "operator";
9
- OptionsTypeEnum["EXPRESSION"] = "expression";
10
- OptionsTypeEnum["OTHER"] = "other";
11
- })(OptionsTypeEnum || (OptionsTypeEnum = {}));
2
+ import { AtomsTypeEnum } from '../../../store/types';
3
+ // export enum OptionsTypeEnum {
4
+ // // CONSTANT = 'constant', // 常量
5
+ // NOT_EXISTS = 'notExists', // 输入框
6
+ // INPUT = 'input', // 输入框
7
+ // FIELD = 'field', // 字段
8
+ // OPERATOR = 'operator', // 运算符
9
+ // EXPRESSION = 'expression', // 公式
10
+ // OTHER = 'other', // 其他
11
+ // }
12
12
  export var FunctionEnum;
13
13
  (function (FunctionEnum) {
14
14
  FunctionEnum["LOWER"] = "lower";
@@ -41,33 +41,77 @@ export var FunctionEnum;
41
41
  // OTHER
42
42
  FunctionEnum["COALESCE"] = "coalesce";
43
43
  })(FunctionEnum || (FunctionEnum = {}));
44
- export var operatorList = ['+', '-', '*', '/', '!=', '<=', '>=', '<', '>', '=', 'not', 'and', 'or', '(', ')', ',', 'DESC', 'ASC', 'OVER', 'PARTITION BY', 'ORDER BY'];
45
- export var otherList = ['case', 'when', 'then', 'else', 'end', 'RANK()', 'DENSE_RANK()', 'ROW_NUMBER()'];
46
- export var functionList = ['lower', 'upper', 'substring', 'regex-match-first', 'concat', 'replace', 'trim', 'rtrim', 'ltrim', 'length',
47
- // number
48
- 'abs', 'floor', 'ceil', 'round', 'sqrt', 'power', 'log', 'exp',
49
- // boolean
50
- 'contains', 'ends-with', 'starts-with', 'between', 'time-interval', 'is-null', 'is-empty',
51
- // other
52
- 'coalesce'];
53
- export var customTypes = [{
54
- value: OptionsTypeEnum.FIELD,
44
+ export var operatorList = ['and', 'or', '(', ')', ',', '+', '-', '*', '/', '!=', '<=', '>=', '<', '>', '=', 'case', 'when', 'then', 'else', 'end', 'DESC', 'ASC', 'OVER', 'PARTITION BY', 'ORDER BY', 'RANK()', 'DENSE_RANK()', 'ROW_NUMBER()'];
45
+ // export const otherList = [
46
+ // 'case',
47
+ // 'when',
48
+ // 'then',
49
+ // 'else',
50
+ // 'end',
51
+ // 'RANK()',
52
+ // 'DENSE_RANK()',
53
+ // 'ROW_NUMBER()',
54
+ // ];
55
+ // export const functionList = [
56
+ // 'lower',
57
+ // 'upper',
58
+ // 'substring',
59
+ // 'regex-match-first',
60
+ // 'concat',
61
+ // 'replace',
62
+ // 'trim',
63
+ // 'rtrim',
64
+ // 'ltrim',
65
+ // 'length',
66
+ // // number
67
+ // 'abs',
68
+ // 'floor',
69
+ // 'ceil',
70
+ // 'round',
71
+ // 'sqrt',
72
+ // 'power',
73
+ // 'log',
74
+ // 'exp',
75
+ // // boolean
76
+ // 'contains',
77
+ // 'ends-with',
78
+ // 'starts-with',
79
+ // 'between',
80
+ // 'time-interval',
81
+ // 'is-null',
82
+ // 'is-empty',
83
+ // // other
84
+ // 'coalesce',
85
+ // ];
86
+ export var customTypes = [
87
+ // 字段
88
+ {
89
+ value: AtomsTypeEnum.FIELD,
55
90
  label: __('customColumn.field')
56
- }, {
57
- value: OptionsTypeEnum.INPUT,
58
- label: __('SqlQueryBuilder.input')
59
- }, {
60
- value: OptionsTypeEnum.OPERATOR,
61
- label: __('customColumn.operator')
62
- }, {
63
- value: OptionsTypeEnum.EXPRESSION,
91
+ },
92
+ // 表达式
93
+ {
94
+ value: AtomsTypeEnum.EXPRESSION,
64
95
  label: __('customColumn.expression')
65
- }, {
66
- value: OptionsTypeEnum.OTHER,
67
- label: __('customColumn.other')
68
- }
69
- // {
70
- // value: OptionsTypeEnum.NOT_EXISTS,
71
- // label: 'NOT_EXISTS',
72
- // },
73
- ];
96
+ },
97
+ // 输入框
98
+ {
99
+ value: AtomsTypeEnum.INPUT_STRING,
100
+ label: __('SqlQueryBuilder.input')
101
+ },
102
+ // 数字输入框
103
+ {
104
+ value: AtomsTypeEnum.INPUT_NUMBER,
105
+ label: __('SqlQueryBuilder.numberInput')
106
+ },
107
+ // 数字输入框
108
+ {
109
+ value: AtomsTypeEnum.CONSTANT,
110
+ label: __('customColumn.constant')
111
+ },
112
+ // 连接符
113
+ {
114
+ value: AtomsTypeEnum.OPERATOR,
115
+ label: __('customColumn.operator'),
116
+ children: operatorList
117
+ }];
@@ -1,6 +1,9 @@
1
1
  import React from 'react';
2
+ import { AtomsItem } from '../../../store/types';
2
3
  interface PropsType {
3
- value: any[];
4
+ customTypes?: any[];
5
+ operatorList?: string[];
6
+ value: AtomsItem[];
4
7
  data: any;
5
8
  exitData?: any;
6
9
  isCustom?: boolean;
@@ -4,21 +4,23 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
4
4
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
5
  var _excluded = ["notExistsToolbar", "toolbar"];
6
6
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
7
- import { useState, useMemo, forwardRef } from 'react';
7
+ import { useEffect, useState, forwardRef } from 'react';
8
8
  import cx from 'classnames';
9
9
  // import './index.less';
10
10
  import Metabase from '../../../index';
11
11
  import { __ } from '../../../locale';
12
12
  import isEqual from 'lodash/isEqual';
13
13
  import { getTemplate } from './utils';
14
- import { OptionsTypeEnum, customTypes, otherList, operatorList } from './enum';
15
- import { Select, Input, Modal2 } from '@gingkoo/pandora';
14
+ import { customTypes, operatorList } from './enum';
15
+ import { AtomsTypeEnum } from '../../../store/types';
16
+ import { ColumnsPopupThemeEnum } from '../../../store/enum';
17
+ import { Select, Input, Modal2, InputNumber } from '@gingkoo/pandora';
16
18
  import cloneDeep from 'lodash/cloneDeep';
17
- import { SummarizeAlias } from '../../../store/helper';
18
- import { uuidv4 } from '../../../utils/helper';
19
+ import { getTemItem } from '../../../store/helper';
19
20
  import { buildSqlQuery } from '../../../utils';
20
21
  import { AddIcon, CloseIcon } from '../../icons';
21
- import { SelectFilter, SelectJoinColumn } from '../../dialog';
22
+ import { Expression, SelectColumnMultiple } from '../../dialog';
23
+ import SelectList from '../../dialog/select-list';
22
24
  import arrow from './arrow.svg';
23
25
  import { useStore } from '../../../hooks/use-provider';
24
26
  var FormulaList = forwardRef(function (props, ref) {
@@ -26,7 +28,11 @@ var FormulaList = forwardRef(function (props, ref) {
26
28
  data = props.data,
27
29
  isCustom = props.isCustom,
28
30
  exitData = props.exitData,
29
- onChange = props.onChange;
31
+ onChange = props.onChange,
32
+ _props$customTypes = props.customTypes,
33
+ _customTypes = _props$customTypes === void 0 ? customTypes : _props$customTypes,
34
+ _props$operatorList = props.operatorList,
35
+ _operatorList = _props$operatorList === void 0 ? operatorList : _props$operatorList;
30
36
  var _useState = useState(value || []),
31
37
  _useState2 = _slicedToArray(_useState, 2),
32
38
  caseList = _useState2[0],
@@ -40,17 +46,8 @@ var FormulaList = forwardRef(function (props, ref) {
40
46
  setInd = _useState4[1];
41
47
  var store = useStore();
42
48
  var filterCustomType = store.filterCustomType;
43
- var filterCase = useMemo(function () {
49
+ useEffect(function () {
44
50
  onChange === null || onChange === void 0 || onChange(caseList);
45
- var hasCase = caseList.some(function (item) {
46
- return item.type === OptionsTypeEnum.OTHER && item.operator === 'case';
47
- });
48
- if (hasCase) {
49
- return otherList.filter(function (item) {
50
- return item !== 'case';
51
- });
52
- }
53
- return otherList;
54
51
  }, [caseList]);
55
52
  function closePopup() {
56
53
  store.setPopup({
@@ -63,20 +60,14 @@ var FormulaList = forwardRef(function (props, ref) {
63
60
  visible: true,
64
61
  node: e.currentTarget,
65
62
  container: ref === null || ref === void 0 ? void 0 : ref.current,
66
- content: _jsx(SelectJoinColumn, {
63
+ content: _jsx(SelectColumnMultiple, {
67
64
  data: data,
68
- value: val,
69
- // theme={ColumnsPopupThemeEnum.greenGrass}
70
- isGroup: true,
71
- // @ts-ignore
72
- onGroup: function onGroup(data) {
73
- var _data = cloneDeep(data);
74
- if (_data.alias != SummarizeAlias) {
75
- _data.fieldAlias = _data.name;
76
- _data.fieldUuid = uuidv4('field');
77
- }
65
+ multiple: false,
66
+ value: [val],
67
+ theme: ColumnsPopupThemeEnum.skyBlue,
68
+ onSelect: function onSelect(fields, quotes) {
78
69
  var _caseList = caseList.slice();
79
- _caseList[i].expression = _data;
70
+ _caseList[i] = fields[0];
80
71
  setCaseList(_caseList);
81
72
  closePopup();
82
73
  }
@@ -86,8 +77,8 @@ var FormulaList = forwardRef(function (props, ref) {
86
77
  // 常量
87
78
  var handleConstant = function handleConstant(val, i) {
88
79
  var _caseList = caseList.slice();
89
- var oldType = _caseList[i].operator;
90
- _caseList[i].operator = val;
80
+ var oldType = _caseList[i].val;
81
+ _caseList[i].val = val;
91
82
  _caseList = getTemplate(oldType, val, _caseList, i);
92
83
  setCaseList(_caseList);
93
84
  };
@@ -97,20 +88,14 @@ var FormulaList = forwardRef(function (props, ref) {
97
88
  visible: true,
98
89
  node: e.currentTarget,
99
90
  container: ref === null || ref === void 0 ? void 0 : ref.current,
100
- content: _jsx(SelectFilter, {
101
- isCustom: isCustom,
91
+ content: _jsx(Expression, {
102
92
  filterCustomType: filterCustomType,
103
- container: ref === null || ref === void 0 ? void 0 : ref.current,
104
93
  data: data,
105
- value: val,
94
+ container: ref === null || ref === void 0 ? void 0 : ref.current,
95
+ value: val || {},
106
96
  onChange: function onChange(data) {
107
- var _data = cloneDeep(data);
108
- if (_data.alias != SummarizeAlias) {
109
- _data.fieldAlias = _data.name;
110
- _data.fieldUuid = uuidv4('field');
111
- }
112
97
  var _caseList = caseList.slice();
113
- _caseList[i].expression = _data;
98
+ _caseList[i] = data;
114
99
  setCaseList(_caseList);
115
100
  closePopup();
116
101
  }
@@ -126,13 +111,9 @@ var FormulaList = forwardRef(function (props, ref) {
126
111
  closePopup();
127
112
  }
128
113
  // 添加
129
- var addOperator = function addOperator(val, index, position) {
114
+ var addOperator = function addOperator(type, index, position) {
130
115
  var _caseList = caseList.slice() || [];
131
- var temItem = {
132
- operator: '',
133
- type: val,
134
- expression: ''
135
- };
116
+ var temItem = getTemItem(type);
136
117
  if (position === 'add') {
137
118
  _caseList.push(temItem);
138
119
  } else if (position === 'before') {
@@ -152,14 +133,14 @@ var FormulaList = forwardRef(function (props, ref) {
152
133
  notExistsToolbar = _store$preProps.notExistsToolbar,
153
134
  toolbar = _store$preProps.toolbar,
154
135
  other = _objectWithoutProperties(_store$preProps, _excluded);
155
- var _value = ((_caseList$i = caseList[i]) === null || _caseList$i === void 0 || (_caseList$i = _caseList$i.expression) === null || _caseList$i === void 0 ? void 0 : _caseList$i.notExists) || [];
156
- var oldList = cloneDeep(((_caseList$i2 = caseList[i]) === null || _caseList$i2 === void 0 || (_caseList$i2 = _caseList$i2.expression) === null || _caseList$i2 === void 0 ? void 0 : _caseList$i2.notExists) || []);
136
+ var _value = ((_caseList$i = caseList[i]) === null || _caseList$i === void 0 ? void 0 : _caseList$i.notExists) || [];
137
+ var oldList = cloneDeep(((_caseList$i2 = caseList[i]) === null || _caseList$i2 === void 0 ? void 0 : _caseList$i2.notExists) || []);
157
138
  var _toolbar = notExistsToolbar || toolbar;
158
139
  _toolbar = _toolbar.filter(function (v) {
159
140
  return v !== 'group';
160
141
  }); // 子查询不需要分组
161
142
  var o = Modal2.openModal({
162
- title: 'NOT EXISTS',
143
+ title: caseList[i].type,
163
144
  transparentMask: true,
164
145
  content: _jsx(_Fragment, {
165
146
  children: _jsx(Metabase, _objectSpread(_objectSpread({}, other), {}, {
@@ -178,24 +159,10 @@ var FormulaList = forwardRef(function (props, ref) {
178
159
  }
179
160
  var expression = {
180
161
  notExists: cloneDeep(newList),
181
- quotes: buildSqlQuery(newList, 'NOT EXISTS'),
182
- condition: '',
183
- table: '',
184
- tableId: '',
185
- fieldUuid: uuidv4('field'),
186
- // 字段唯一id
187
- fieldAlias: '',
188
- //字段别名
189
- tableUuid: uuidv4('table'),
190
- alias: '',
191
- name: '',
192
- id: '',
193
- database_type: '',
194
- val: [],
195
- datasourceId: '',
196
- datasourceName: ''
162
+ quotes: buildSqlQuery(newList, caseList[i].type),
163
+ type: caseList[i].type
197
164
  };
198
- caseList[i].expression = expression;
165
+ caseList[i] = expression;
199
166
  onChange === null || onChange === void 0 || onChange(caseList);
200
167
  setCaseList(_toConsumableArray(caseList));
201
168
  o.close();
@@ -210,16 +177,34 @@ var FormulaList = forwardRef(function (props, ref) {
210
177
  onClose: function onClose() {}
211
178
  });
212
179
  };
180
+ function selectConstant(e) {
181
+ var node = e.currentTarget;
182
+ var _ind = Number(node.getAttribute('v-index'));
183
+ var _val = node.getAttribute('v-val');
184
+ store.setPopup({
185
+ visible: true,
186
+ node: e.currentTarget,
187
+ container: ref === null || ref === void 0 ? void 0 : ref.current,
188
+ content: _jsx(SelectList, {
189
+ value: _val,
190
+ list: store.constantList || [],
191
+ onChange: function onChange(val) {
192
+ closePopup();
193
+ handleConstant(val, _ind);
194
+ }
195
+ })
196
+ });
197
+ }
213
198
  // 分段
214
199
  var itemDom = function itemDom(v, index) {
215
200
  var type = v.type;
216
- if (v.type === OptionsTypeEnum.NOT_EXISTS) {
201
+ if (v.type === AtomsTypeEnum.NOT_EXISTS || v.type === AtomsTypeEnum.EXISTS) {
217
202
  return _jsxs("div", {
218
203
  className: "Sqb-TableName purple-name",
219
204
  onClick: function onClick(e) {
220
205
  return showNotExists(index);
221
206
  },
222
- children: ["not exitis ( * )", _jsx("span", {
207
+ children: [v.type, " ( * )", _jsx("span", {
223
208
  style: {
224
209
  fontSize: 0
225
210
  },
@@ -229,17 +214,16 @@ var FormulaList = forwardRef(function (props, ref) {
229
214
  children: _jsx(CloseIcon, {})
230
215
  })]
231
216
  }, index);
232
- } else if (type === OptionsTypeEnum.FIELD) {
233
- var _v$expression, _v$expression2;
217
+ } else if (type === AtomsTypeEnum.FIELD) {
234
218
  // 字段
235
219
  return _jsxs("div", {
236
220
  className: cx("Sqb-TableName ", {
237
- notSelected: !((_v$expression = v.expression) !== null && _v$expression !== void 0 && _v$expression.quotes)
221
+ notSelected: !(v !== null && v !== void 0 && v.fieldName)
238
222
  }),
239
223
  onClick: function onClick(e) {
240
- return handleField(e, index, v.expression);
224
+ return handleField(e, index, v);
241
225
  },
242
- children: [!((_v$expression2 = v.expression) !== null && _v$expression2 !== void 0 && _v$expression2.quotes) && __('customColumn.selectField'), v.expression.quotes, _jsx("span", {
226
+ children: [!(v !== null && v !== void 0 && v.fieldName) && __('customColumn.selectField'), v.fieldName, _jsx("span", {
243
227
  style: {
244
228
  fontSize: 0
245
229
  },
@@ -249,13 +233,13 @@ var FormulaList = forwardRef(function (props, ref) {
249
233
  children: _jsx(CloseIcon, {})
250
234
  })]
251
235
  });
252
- } else if (type === OptionsTypeEnum.INPUT) {
236
+ } else if (type === AtomsTypeEnum.INPUT_STRING) {
253
237
  // 输入框
254
238
  return _jsxs("div", {
255
239
  className: cx("Sqb-TableName notSelected "),
256
240
  children: [_jsx(Input, {
257
241
  className: ':Sqb-Custom-input',
258
- value: v.operator,
242
+ value: v.val,
259
243
  placeholder: __('SqlQueryBuilder.pleaseEnter'),
260
244
  size: 'large',
261
245
  onChange: function onChange(val) {
@@ -271,19 +255,41 @@ var FormulaList = forwardRef(function (props, ref) {
271
255
  children: _jsx(CloseIcon, {})
272
256
  })]
273
257
  });
274
- } else if (type === OptionsTypeEnum.OPERATOR) {
258
+ } else if (type === AtomsTypeEnum.INPUT_NUMBER) {
259
+ // 输入框
260
+ return _jsxs("div", {
261
+ className: cx("Sqb-TableName notSelected "),
262
+ children: [_jsx(InputNumber, {
263
+ className: ':sqb-Custom-input',
264
+ value: v.val,
265
+ placeholder: __('SqlQueryBuilder.pleaseEnter'),
266
+ size: 'large',
267
+ onChange: function onChange(val) {
268
+ handleConstant(val, index);
269
+ }
270
+ }), _jsx("span", {
271
+ style: {
272
+ fontSize: 0
273
+ },
274
+ onClick: function onClick(e) {
275
+ return handleDel(e, index);
276
+ },
277
+ children: _jsx(CloseIcon, {})
278
+ })]
279
+ });
280
+ } else if (type === AtomsTypeEnum.OPERATOR) {
275
281
  //连接符
276
282
  return _jsx(Select, {
277
283
  triggerProps: {
278
284
  clickToClose: true
279
285
  },
280
- value: v.operator,
286
+ value: v.val,
281
287
  triggerElement: function triggerElement(value) {
282
288
  return _jsxs("div", {
283
289
  className: cx("Sqb-TableName Sqb-TableName-OPERATOR", {
284
- notSelected: !v.operator
290
+ notSelected: !v.val
285
291
  }),
286
- children: [!v.operator && __('customColumn.selectOperator'), v.operator, _jsx("span", {
292
+ children: [!v.val && __('customColumn.selectOperator'), v.val, _jsx("span", {
287
293
  style: {
288
294
  fontSize: 0
289
295
  },
@@ -297,24 +303,34 @@ var FormulaList = forwardRef(function (props, ref) {
297
303
  onChange: function onChange(val) {
298
304
  handleConstant(val, index);
299
305
  },
300
- children: operatorList.map(function (option, index) {
306
+ children: _operatorList.map(function (option, index) {
301
307
  return _jsx(Select.Option, {
302
308
  value: option,
303
309
  children: option
304
310
  }, index + '' + ind);
305
311
  })
306
312
  });
307
- } else if (type === OptionsTypeEnum.EXPRESSION) {
308
- var _v$expression3;
313
+ } else if (type === AtomsTypeEnum.CONSTANT) {
314
+ //常量
315
+ return _jsx("div", {
316
+ className: cx("Sqb-TableName", {
317
+ notSelected: !v.val
318
+ }),
319
+ "v-index": index,
320
+ "v-val": v.val,
321
+ onClick: selectConstant,
322
+ children: v.val ? v.val : __('SqlQueryBuilder.pickConstant')
323
+ }, index);
324
+ } else if (type === AtomsTypeEnum.EXPRESSION) {
309
325
  // 表达式
310
326
  return _jsxs("div", {
311
327
  className: cx("Sqb-TableName purple-name", {
312
- notSelected: !((_v$expression3 = v.expression) !== null && _v$expression3 !== void 0 && _v$expression3.quotes)
328
+ notSelected: !v.quotes
313
329
  }),
314
330
  onClick: function onClick(e) {
315
- return handleExpression(e, index, v.expression);
331
+ return handleExpression(e, index, v);
316
332
  },
317
- children: [!v.expression.quotes && __('customColumn.selectExpression'), v.expression.quotes, _jsx("span", {
333
+ children: [!v.quotes && __('customColumn.selectExpression'), v.quotes, _jsx("span", {
318
334
  style: {
319
335
  fontSize: 0
320
336
  },
@@ -324,45 +340,12 @@ var FormulaList = forwardRef(function (props, ref) {
324
340
  children: _jsx(CloseIcon, {})
325
341
  })]
326
342
  });
327
- } else if (type === OptionsTypeEnum.OTHER) {
328
- // 其他
329
- return _jsx(Select, {
330
- triggerProps: {
331
- clickToClose: true
332
- },
333
- value: v.operator,
334
- triggerElement: function triggerElement(value) {
335
- return _jsxs("div", {
336
- className: cx("Sqb-TableName Sqb-TableName-OTHER", {
337
- notSelected: !v.operator
338
- }),
339
- children: [!v.operator && __('customColumn.selectOtherSyntax'), v.operator, _jsx("span", {
340
- style: {
341
- fontSize: 0
342
- },
343
- onClick: function onClick(e) {
344
- return handleDel(e, index);
345
- },
346
- children: _jsx(CloseIcon, {})
347
- })]
348
- });
349
- },
350
- onChange: function onChange(val) {
351
- handleConstant(val, index);
352
- },
353
- children: filterCase.map(function (option, index) {
354
- return _jsx(Select.Option, {
355
- value: option,
356
- children: option
357
- }, index + '' + ind);
358
- })
359
- });
360
343
  } else {
361
344
  return _jsx(Select, {
362
345
  triggerProps: {
363
346
  clickToClose: true
364
347
  },
365
- value: v.operator,
348
+ value: v.val,
366
349
  triggerElement: function triggerElement(value) {
367
350
  return _jsxs("div", {
368
351
  className: cx("Sqb-TableName ", {
@@ -382,7 +365,7 @@ var FormulaList = forwardRef(function (props, ref) {
382
365
  onChange: function onChange(val) {
383
366
  addOperator(val, index, '');
384
367
  },
385
- children: customTypes.map(function (option, index) {
368
+ children: _customTypes.map(function (option, index) {
386
369
  return _jsx(Select.Option, {
387
370
  value: option.value,
388
371
  children: option.label
@@ -419,7 +402,7 @@ var FormulaList = forwardRef(function (props, ref) {
419
402
  "v-index": i,
420
403
  "v-type": 'before',
421
404
  onClick: function onClick() {
422
- addOperator('', i, 'before');
405
+ addOperator(AtomsTypeEnum.UNKNOWN, i, 'before');
423
406
  },
424
407
  children: _jsx("img", {
425
408
  src: arrow
@@ -429,7 +412,7 @@ var FormulaList = forwardRef(function (props, ref) {
429
412
  onChange: function onChange(val) {
430
413
  addOperator(val, i, 'before');
431
414
  },
432
- children: customTypes.map(function (option, index) {
415
+ children: _customTypes.map(function (option, index) {
433
416
  return _jsx(Select.Option, {
434
417
  value: option.value,
435
418
  children: option.label
@@ -456,7 +439,7 @@ var FormulaList = forwardRef(function (props, ref) {
456
439
  "v-index": i,
457
440
  "v-type": 'after',
458
441
  onClick: function onClick() {
459
- addOperator('', i, 'after');
442
+ addOperator(AtomsTypeEnum.UNKNOWN, i, 'after');
460
443
  },
461
444
  children: _jsx("img", {
462
445
  src: arrow
@@ -466,7 +449,7 @@ var FormulaList = forwardRef(function (props, ref) {
466
449
  onChange: function onChange(val, option) {
467
450
  addOperator(val, i, 'after');
468
451
  },
469
- children: customTypes.map(function (option, index) {
452
+ children: _customTypes.map(function (option, index) {
470
453
  return _jsx(Select.Option, {
471
454
  value: option.value,
472
455
  children: option.label
@@ -474,7 +457,7 @@ var FormulaList = forwardRef(function (props, ref) {
474
457
  })
475
458
  })]
476
459
  }, i);
477
- }), !value || Array.from(caseList).length < 1 && _jsx(Select, {
460
+ }), Array.from(caseList).length < 1 && _jsx(Select, {
478
461
  trigger: 'click',
479
462
  triggerProps: {
480
463
  clickToClose: true
@@ -491,7 +474,7 @@ var FormulaList = forwardRef(function (props, ref) {
491
474
  onChange: function onChange(val) {
492
475
  addOperator(val, -1, 'add');
493
476
  },
494
- children: customTypes.map(function (option, index) {
477
+ children: _customTypes.map(function (option, index) {
495
478
  return _jsx(Select.Option, {
496
479
  value: option.value,
497
480
  children: option.label
@@ -501,11 +484,12 @@ var FormulaList = forwardRef(function (props, ref) {
501
484
  }), _jsxs("p", {
502
485
  className: 'Sqb-NotebookCell-preview',
503
486
  children: ["\u9884\u89C8\uFF1A", caseList.map(function (v, i) {
504
- if (v.expression) {
505
- var _v$expression4;
506
- return v === null || v === void 0 || (_v$expression4 = v.expression) === null || _v$expression4 === void 0 ? void 0 : _v$expression4.quotes;
487
+ if (v !== null && v !== void 0 && v.quotes) {
488
+ return v === null || v === void 0 ? void 0 : v.quotes;
489
+ } else if (v !== null && v !== void 0 && v.fieldName) {
490
+ return v === null || v === void 0 ? void 0 : v.fieldName;
507
491
  } else {
508
- return v.operator;
492
+ return v.val;
509
493
  }
510
494
  }).join(' ')]
511
495
  })]