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