@gingkoo/pandora-metabase 1.0.129 → 1.0.131

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 (65) hide show
  1. package/lib/cjs/components/dialog/expression/index.js +0 -1
  2. package/lib/cjs/components/dialog/formula-list/utils.js +0 -3
  3. package/lib/cjs/components/dialog/select-column/index.js +2 -2
  4. package/lib/cjs/components/dialog/select-column-multiple/index.d.ts +0 -1
  5. package/lib/cjs/components/dialog/select-column-multiple/index.js +44 -19
  6. package/lib/cjs/components/dialog/select-join-column/index.js +23 -7
  7. package/lib/cjs/components/dialog/select-join-column-multiple/index.js +15 -6
  8. package/lib/cjs/components/dialog/select-permission-table/index.js +2 -2
  9. package/lib/cjs/components/dialog/select-summarize/index.js +1 -3
  10. package/lib/cjs/components/dialog/select-table/index.d.ts +1 -2
  11. package/lib/cjs/components/dialog/select-table/index.js +230 -210
  12. package/lib/cjs/components/dialog/select-table/index.less +51 -36
  13. package/lib/cjs/components/metabase/index.js +34 -16
  14. package/lib/cjs/components/modules/components/item-name.js +0 -1
  15. package/lib/cjs/components/modules/custom-column.js +3 -7
  16. package/lib/cjs/components/modules/filter.js +3 -6
  17. package/lib/cjs/components/modules/join-data.js +41 -87
  18. package/lib/cjs/components/modules/permission-table.js +5 -9
  19. package/lib/cjs/components/modules/sort.js +1 -2
  20. package/lib/cjs/components/modules/summarize/group-by.js +1 -8
  21. package/lib/cjs/components/modules/summarize/select-index.js +1 -4
  22. package/lib/cjs/components/modules/table-data.js +28 -44
  23. package/lib/cjs/hooks/use-state.js +22 -147
  24. package/lib/cjs/index.js +1 -7
  25. package/lib/cjs/locale/en.js +1 -0
  26. package/lib/cjs/locale/zh.js +1 -0
  27. package/lib/cjs/store/types.d.ts +4 -5
  28. package/lib/cjs/types.d.ts +0 -8
  29. package/lib/cjs/utils/helper.d.ts +4 -0
  30. package/lib/cjs/utils/helper.js +102 -1
  31. package/lib/cjs/utils/transformSql.js +0 -2
  32. package/lib/cjs/utils.js +38 -18
  33. package/lib/es/components/dialog/expression/index.js +0 -1
  34. package/lib/es/components/dialog/formula-list/utils.js +0 -3
  35. package/lib/es/components/dialog/select-column/index.js +3 -3
  36. package/lib/es/components/dialog/select-column-multiple/index.d.ts +0 -1
  37. package/lib/es/components/dialog/select-column-multiple/index.js +45 -21
  38. package/lib/es/components/dialog/select-join-column/index.js +24 -8
  39. package/lib/es/components/dialog/select-join-column-multiple/index.js +16 -7
  40. package/lib/es/components/dialog/select-permission-table/index.js +3 -3
  41. package/lib/es/components/dialog/select-summarize/index.js +1 -3
  42. package/lib/es/components/dialog/select-table/index.d.ts +1 -2
  43. package/lib/es/components/dialog/select-table/index.js +232 -212
  44. package/lib/es/components/dialog/select-table/index.less +51 -36
  45. package/lib/es/components/metabase/index.js +34 -16
  46. package/lib/es/components/modules/components/item-name.js +0 -1
  47. package/lib/es/components/modules/custom-column.js +3 -7
  48. package/lib/es/components/modules/filter.js +3 -6
  49. package/lib/es/components/modules/join-data.js +42 -88
  50. package/lib/es/components/modules/permission-table.js +6 -10
  51. package/lib/es/components/modules/sort.js +1 -2
  52. package/lib/es/components/modules/summarize/group-by.js +1 -8
  53. package/lib/es/components/modules/summarize/select-index.js +1 -4
  54. package/lib/es/components/modules/table-data.js +29 -45
  55. package/lib/es/hooks/use-state.js +23 -148
  56. package/lib/es/index.js +1 -7
  57. package/lib/es/locale/en.js +1 -0
  58. package/lib/es/locale/zh.js +1 -0
  59. package/lib/es/store/types.d.ts +4 -5
  60. package/lib/es/types.d.ts +0 -8
  61. package/lib/es/utils/helper.d.ts +4 -0
  62. package/lib/es/utils/helper.js +101 -0
  63. package/lib/es/utils/transformSql.js +0 -2
  64. package/lib/es/utils.js +39 -19
  65. package/package.json +1 -1
@@ -28,7 +28,7 @@
28
28
  color: #4c5773;
29
29
  margin-top: 0;
30
30
  margin-bottom: 0;
31
- font-size: 13px;
31
+ font-size: 14px;
32
32
  font-weight: 600;
33
33
  }
34
34
  &:not(.disabled):hover,
@@ -61,24 +61,23 @@
61
61
  padding: 0.5rem;
62
62
  display: flex;
63
63
  align-items: center;
64
+ justify-content: space-between;
65
+ gap: 8px;
64
66
  color: #949aab;
65
67
  border-bottom: 1px solid #f0f0f0;
66
68
  .left-info {
67
- flex: 1;
69
+ min-width: 0;
68
70
  padding: 0.5rem 0.5rem 0.5rem 0;
69
71
  display: flex;
70
72
  align-items: center;
71
- flex-wrap: wrap;
72
- gap: 0.5rem;
73
- .Sqb-DatasourceType-radio {
74
- margin-left: auto;
75
- }
76
- > span {
73
+ flex: 1 1 auto;
74
+ span {
77
75
  font-weight: 900;
78
76
  font-size: 16px;
79
77
  color: #4c5773;
80
78
  display: flex;
81
79
  align-items: center;
80
+ min-width: 0;
82
81
  cursor: pointer;
83
82
  font-family: 'Lato', sans-serif;
84
83
  line-height: 1;
@@ -101,11 +100,18 @@
101
100
  .Sqb-List-section {
102
101
  }
103
102
 
104
- .Sqb-List-title {
103
+ .Sqb-List-title-with-filter {
105
104
  display: flex;
106
105
  align-items: center;
107
106
  justify-content: space-between;
108
- gap: 0.75rem;
107
+ gap: 10px;
108
+ }
109
+
110
+ .Sqb-List-title-text {
111
+ flex: 1 1 auto;
112
+ min-width: 80px;
113
+ word-break: break-word;
114
+ word-wrap: anywhere;
109
115
  }
110
116
 
111
117
  .Sqb-List-item {
@@ -179,34 +185,43 @@
179
185
  }
180
186
  }
181
187
  }
182
- }
183
-
184
- .Sqb-DatasourceType-radio {
185
- display: flex;
186
- align-items: center;
187
- flex-wrap: wrap;
188
- gap: 0.375rem;
189
- justify-content: flex-end;
190
- }
191
188
 
192
- .Sqb-DatasourceType-radio-item {
193
- display: inline-flex;
194
- align-items: center;
195
- gap: 2px;
196
- color: #4c5773;
197
- cursor: pointer;
198
- font-size: 13px !important;
199
- font-weight: 600;
200
- line-height: 1.2;
201
-
202
- span {
203
- font-size: 13px !important;
204
- line-height: 15px;
189
+ .Sqb-TableType-tag-group {
190
+ display: inline-flex;
191
+ flex-wrap: wrap;
192
+ justify-content: flex-end;
193
+ gap: 4px;
194
+ max-width: 55%;
195
+ margin-left: auto;
205
196
  }
206
197
 
207
- input {
208
- margin: 0;
209
- width: 13px;
210
- height: 13px;
198
+ .Sqb-TableType-filter-tag.pd-Tag {
199
+ max-width: 150px;
200
+ height: 18px;
201
+ margin: 0 !important;
202
+ padding: 0 6px;
203
+ border: 1px solid #dce0e8;
204
+ background-color: #fff;
205
+ color: #5f6b85;
206
+ font-size: 12px;
207
+ line-height: 16px;
208
+ cursor: pointer;
209
+
210
+ .pd-Tag-content {
211
+ overflow: hidden;
212
+ text-overflow: ellipsis;
213
+ white-space: nowrap;
214
+ }
215
+
216
+ &:hover {
217
+ border-color: #509ee3;
218
+ color: #509ee3;
219
+ }
220
+
221
+ &.pd-Tag-checked {
222
+ border-color: #509ee3;
223
+ background-color: #e8f4ff;
224
+ color: #509ee3;
225
+ }
211
226
  }
212
227
  }
@@ -55,16 +55,9 @@ var Metabase = function Metabase(props) {
55
55
  var doms = store.popupContainer.current.querySelectorAll('.isError');
56
56
  var isSqlError = store.popupContainer.current.querySelectorAll('.isSqlError');
57
57
  if (isSqlError.length) {
58
- Modal.error({
59
- title: __('metabase.prompt'),
60
- content: __('metabase.validationFilter')
61
- });
62
- return;
63
- }
64
- if (doms.length) {
65
58
  Modal.confirm({
66
59
  title: __('metabase.prompt'),
67
- content: __('metabase.validationFailed'),
60
+ content: __('metabase.validationFormulaSave'),
68
61
  onOk: function () {
69
62
  var _onOk = _asyncToGenerator(_regeneratorRuntime.mark(function _callee() {
70
63
  return _regeneratorRuntime.wrap(function (_context) {
@@ -84,15 +77,40 @@ var Metabase = function Metabase(props) {
84
77
  return onOk;
85
78
  }()
86
79
  });
80
+ return;
81
+ }
82
+ if (doms.length) {
83
+ Modal.confirm({
84
+ title: __('metabase.prompt'),
85
+ content: __('metabase.validationFailed'),
86
+ onOk: function () {
87
+ var _onOk2 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2() {
88
+ return _regeneratorRuntime.wrap(function (_context2) {
89
+ while (1) switch (_context2.prev = _context2.next) {
90
+ case 0:
91
+ _context2.next = 1;
92
+ return onSave();
93
+ case 1:
94
+ case "end":
95
+ return _context2.stop();
96
+ }
97
+ }, _callee2);
98
+ }));
99
+ function onOk() {
100
+ return _onOk2.apply(this, arguments);
101
+ }
102
+ return onOk;
103
+ }()
104
+ });
87
105
  } else {
88
106
  onSave();
89
107
  }
90
108
  };
91
109
  var onSave = function () {
92
- var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2() {
110
+ var _ref = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3() {
93
111
  var intercept, _metaList;
94
- return _regeneratorRuntime.wrap(function (_context2) {
95
- while (1) switch (_context2.prev = _context2.next) {
112
+ return _regeneratorRuntime.wrap(function (_context3) {
113
+ while (1) switch (_context3.prev = _context3.next) {
96
114
  case 0:
97
115
  intercept = false;
98
116
  _metaList = normalizeLegacySummarizeForSave(splitByUnion(store.metaList));
@@ -106,21 +124,21 @@ var Metabase = function Metabase(props) {
106
124
  }
107
125
  });
108
126
  if (!(saveLoading || intercept)) {
109
- _context2.next = 1;
127
+ _context3.next = 1;
110
128
  break;
111
129
  }
112
- return _context2.abrupt("return", null);
130
+ return _context3.abrupt("return", null);
113
131
  case 1:
114
132
  setSaveLoading(true);
115
- _context2.next = 2;
133
+ _context3.next = 2;
116
134
  return onOk === null || onOk === void 0 ? void 0 : onOk(_metaList);
117
135
  case 2:
118
136
  setSaveLoading(false);
119
137
  case 3:
120
138
  case "end":
121
- return _context2.stop();
139
+ return _context3.stop();
122
140
  }
123
- }, _callee2);
141
+ }, _callee3);
124
142
  }));
125
143
  return function onSave() {
126
144
  return _ref.apply(this, arguments);
@@ -7,7 +7,6 @@ var ItemName = function ItemName(props) {
7
7
  isError = props.isError,
8
8
  message = props.message;
9
9
  return _jsx(Badge, {
10
- offset: [-8, 0],
11
10
  count: isError ? _jsx(Tooltip, {
12
11
  title: message || __('metabase.verify'),
13
12
  children: _jsx(Button, {
@@ -127,7 +127,6 @@ var CustomColumn = function CustomColumn(props) {
127
127
  alias: prevGroupBy.alias,
128
128
  datasourceId: '',
129
129
  datasourceName: '',
130
- datasourceType: '',
131
130
  columns: []
132
131
  };
133
132
  if (prevGroupBy !== null && prevGroupBy !== void 0 && (_prevGroupBy$group = prevGroupBy.group) !== null && _prevGroupBy$group !== void 0 && _prevGroupBy$group.length) {
@@ -171,8 +170,7 @@ var CustomColumn = function CustomColumn(props) {
171
170
  tableUuid: v.table2.tableUuid || uuidv4('table'),
172
171
  columns: v.columns,
173
172
  datasourceId: v.table2.datasourceId,
174
- datasourceName: v.table2.datasourceName,
175
- datasourceType: v.table2.datasourceType
173
+ datasourceName: v.table2.datasourceName
176
174
  });
177
175
  }));
178
176
  }
@@ -186,8 +184,7 @@ var CustomColumn = function CustomColumn(props) {
186
184
  tableUuid: v.table.tableUuid || uuidv4('table'),
187
185
  columns: v.columns,
188
186
  datasourceId: mainTable.table.datasourceId,
189
- datasourceName: mainTable.table.datasourceName,
190
- datasourceType: mainTable.table.datasourceType
187
+ datasourceName: mainTable.table.datasourceName
191
188
  });
192
189
  } else if (v.type === TypeEnum.joinData) {
193
190
  return _objectSpread(_objectSpread({}, v.table2), {}, {
@@ -197,8 +194,7 @@ var CustomColumn = function CustomColumn(props) {
197
194
  tableUuid: v.table2.tableUuid || uuidv4('table'),
198
195
  columns: v.columns,
199
196
  datasourceId: v.table2.datasourceId,
200
- datasourceName: v.table2.datasourceName,
201
- datasourceType: v.table2.datasourceType
197
+ datasourceName: v.table2.datasourceName
202
198
  });
203
199
  } else {
204
200
  return {
@@ -82,8 +82,7 @@ var Filter = function Filter(props) {
82
82
  tableUuid: v.table2.tableUuid || uuidv4('table'),
83
83
  columns: v.columns,
84
84
  datasourceId: v.table2.datasourceId,
85
- datasourceName: v.table2.datasourceName,
86
- datasourceType: v.table2.datasourceType
85
+ datasourceName: v.table2.datasourceName
87
86
  };
88
87
  }));
89
88
  }
@@ -98,8 +97,7 @@ var Filter = function Filter(props) {
98
97
  tableUuid: v.table.tableUuid || uuidv4('table'),
99
98
  columns: v.columns,
100
99
  datasourceId: mainTable.table.datasourceId,
101
- datasourceName: mainTable.table.datasourceName,
102
- datasourceType: mainTable.table.datasourceType
100
+ datasourceName: mainTable.table.datasourceName
103
101
  };
104
102
  } else if (v.type === TypeEnum.joinData) {
105
103
  return {
@@ -110,8 +108,7 @@ var Filter = function Filter(props) {
110
108
  tableUuid: v.table2.tableUuid || uuidv4('table'),
111
109
  columns: v.columns,
112
110
  datasourceId: v.table2.datasourceId,
113
- datasourceName: v.table2.datasourceName,
114
- datasourceType: v.table2.datasourceType
111
+ datasourceName: v.table2.datasourceName
115
112
  };
116
113
  } else {
117
114
  return {