@gingkoo/pandora-metabase 1.0.158-alpha.6 → 1.0.158-alpha.7

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 (25) hide show
  1. package/lib/cjs/components/dialog/column-type-label/index.d.ts +8 -0
  2. package/lib/cjs/components/dialog/column-type-label/index.js +22 -0
  3. package/lib/cjs/components/dialog/column-type-label/index.less +17 -0
  4. package/lib/cjs/components/dialog/select-column/index.js +7 -1
  5. package/lib/cjs/components/dialog/select-column/index.less +6 -1
  6. package/lib/cjs/components/dialog/select-column-multiple/index.js +7 -3
  7. package/lib/cjs/components/dialog/select-column-multiple/index.less +10 -0
  8. package/lib/cjs/components/dialog/select-join-column/index.js +7 -3
  9. package/lib/cjs/components/dialog/select-join-column/index.less +10 -0
  10. package/lib/cjs/components/dialog/select-join-column-multiple/index.js +7 -3
  11. package/lib/cjs/components/dialog/select-join-column-multiple/index.less +10 -0
  12. package/lib/cjs/store/types.d.ts +1 -0
  13. package/lib/es/components/dialog/column-type-label/index.d.ts +8 -0
  14. package/lib/es/components/dialog/column-type-label/index.js +16 -0
  15. package/lib/es/components/dialog/column-type-label/index.less +17 -0
  16. package/lib/es/components/dialog/select-column/index.js +7 -1
  17. package/lib/es/components/dialog/select-column/index.less +6 -1
  18. package/lib/es/components/dialog/select-column-multiple/index.js +7 -3
  19. package/lib/es/components/dialog/select-column-multiple/index.less +10 -0
  20. package/lib/es/components/dialog/select-join-column/index.js +7 -3
  21. package/lib/es/components/dialog/select-join-column/index.less +10 -0
  22. package/lib/es/components/dialog/select-join-column-multiple/index.js +7 -3
  23. package/lib/es/components/dialog/select-join-column-multiple/index.less +10 -0
  24. package/lib/es/store/types.d.ts +1 -0
  25. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import './index.less';
2
+ import React from 'react';
3
+ import { MetaData_ColumnsType } from '../../../store/types';
4
+ interface PropsType {
5
+ column: Pick<MetaData_ColumnsType, 'database_type' | 'database_length'>;
6
+ }
7
+ declare const ColumnTypeLabel: ({ column }: PropsType) => React.JSX.Element | null;
8
+ export default ColumnTypeLabel;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ require("./index.less");
9
+ var ColumnTypeLabel = function ColumnTypeLabel(_ref) {
10
+ var column = _ref.column;
11
+ var databaseType = String(column.database_type || '').trim();
12
+ var databaseLength = column.database_length;
13
+ var hasLength = databaseLength !== undefined && databaseLength !== null && "".concat(databaseLength).trim() !== '';
14
+ if (!databaseType) return null;
15
+ var label = hasLength ? "".concat(databaseType, "(").concat(databaseLength, ")") : databaseType;
16
+ return (0, _jsxRuntime.jsx)("span", {
17
+ className: 'Sqb-ColumnTypeLabel',
18
+ title: label,
19
+ children: label
20
+ });
21
+ };
22
+ var _default = exports["default"] = ColumnTypeLabel;
@@ -0,0 +1,17 @@
1
+ .Sqb-ColumnTypeLabel {
2
+ flex: 0 0 auto;
3
+ margin-left: auto;
4
+ padding-left: 12px;
5
+ color: #949aab;
6
+ font-size: 12px;
7
+ font-weight: 400;
8
+ line-height: 20px;
9
+ white-space: nowrap;
10
+ }
11
+
12
+ .Sqb-List-item:hover,
13
+ .Sqb-List-item.active {
14
+ .Sqb-ColumnTypeLabel {
15
+ color: rgba(255, 255, 255, 0.82);
16
+ }
17
+ }
@@ -22,6 +22,7 @@ var _icons = require("../../icons");
22
22
  var _useProvider = require("../../../hooks/use-provider");
23
23
  var _helper = require("../../../utils/helper");
24
24
  var _utils = require("../../../utils");
25
+ var _columnTypeLabel = _interopRequireDefault(require("../column-type-label"));
25
26
  var SelectColumn = function SelectColumn(_ref) {
26
27
  var _ref$data = _ref.data,
27
28
  data = _ref$data === void 0 ? [] : _ref$data,
@@ -233,7 +234,12 @@ var SelectColumn = function SelectColumn(_ref) {
233
234
  children: (0, _jsxRuntime.jsx)(_icons.SelectIcon, {})
234
235
  }) : (0, _jsxRuntime.jsx)("div", {
235
236
  className: 'no-select mr-2'
236
- }), v.name, v.name_zh ? " \uFF08".concat(v.name_zh, "\uFF09") : '', v.fieldAlias ? " as ".concat(v.fieldAlias) : '', store.fieldEnableAlias && !readonly && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
237
+ }), (0, _jsxRuntime.jsxs)("span", {
238
+ className: 'Sqb-SelectColumn-name',
239
+ children: [v.name, v.name_zh ? " \uFF08".concat(v.name_zh, "\uFF09") : '', v.fieldAlias ? " as ".concat(v.fieldAlias) : '']
240
+ }), (0, _jsxRuntime.jsx)(_columnTypeLabel["default"], {
241
+ column: v
242
+ }), store.fieldEnableAlias && !readonly && (0, _jsxRuntime.jsx)(_pandora.Tooltip, {
237
243
  title: (0, _locale.__)('SqlQueryBuilder.alias'),
238
244
  children: (0, _jsxRuntime.jsx)(_pandora.Button, {
239
245
  className: ':Sqb-TableName-as',
@@ -37,9 +37,14 @@
37
37
  }
38
38
  .Sqb-TableName-as {
39
39
  // font-size: 16px;
40
- margin-left: auto;
40
+ margin-left: 8px;
41
41
  }
42
42
  }
43
+ .Sqb-SelectColumn-name {
44
+ flex: 1 1 auto;
45
+ min-width: 0;
46
+ overflow-wrap: anywhere;
47
+ }
43
48
  .Sqb-SelectColumn--header {
44
49
  position: sticky;
45
50
  top: 0;
@@ -20,6 +20,7 @@ var _helper = require("../../../store/helper");
20
20
  var _types = require("../../../store/types");
21
21
  var _locale = require("../../../locale");
22
22
  var _const = require("../const");
23
+ var _columnTypeLabel = _interopRequireDefault(require("../column-type-label"));
23
24
  var _useProvider = require("../../../hooks/use-provider");
24
25
  var _helper2 = require("../../../utils/helper");
25
26
  var _icons = require("../../icons");
@@ -509,11 +510,14 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
509
510
  children: [(0, _jsxRuntime.jsx)("span", {
510
511
  className: 'List-item-icon',
511
512
  children: IconMap[special_type || database_type] || (0, _jsxRuntime.jsx)(_icons.LetterAaIcon, {})
512
- }), (0, _jsxRuntime.jsx)("div", {
513
- children: (0, _jsxRuntime.jsxs)("h4", {
513
+ }), (0, _jsxRuntime.jsxs)("div", {
514
+ className: 'List-item-content',
515
+ children: [(0, _jsxRuntime.jsxs)("h4", {
514
516
  className: 'List-item-title ml-2',
515
517
  children: [(0, _helper2.replaceTpl)(store.fieldNameTpl, v), v.fieldAlias ? " as ".concat(v.fieldAlias) : '']
516
- })
518
+ }), (0, _jsxRuntime.jsx)(_columnTypeLabel["default"], {
519
+ column: v
520
+ })]
517
521
  })]
518
522
  })
519
523
  })
@@ -23,6 +23,16 @@
23
23
  align-items: center;
24
24
  color: #b8bbc3;
25
25
  }
26
+ .List-item-content {
27
+ display: flex;
28
+ align-items: center;
29
+ min-width: 0;
30
+ width: 100%;
31
+ .List-item-title {
32
+ flex: 1 1 auto;
33
+ min-width: 0;
34
+ }
35
+ }
26
36
  .List-item-title {
27
37
  word-break: break-word;
28
38
  word-wrap: anywhere;
@@ -17,6 +17,7 @@ var _enum = require("../../../store/enum");
17
17
  var _helper = require("../../../store/helper");
18
18
  var _locale = require("../../../locale");
19
19
  var _const = require("../const");
20
+ var _columnTypeLabel = _interopRequireDefault(require("../column-type-label"));
20
21
  var _useProvider = require("../../../hooks/use-provider");
21
22
  var _helper2 = require("../../../utils/helper");
22
23
  var _icons = require("../../icons");
@@ -315,11 +316,14 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
315
316
  children: [(0, _jsxRuntime.jsx)("span", {
316
317
  className: 'List-item-icon',
317
318
  children: IconMap[special_type || database_type] || (0, _jsxRuntime.jsx)(_icons.LetterAaIcon, {})
318
- }), (0, _jsxRuntime.jsx)("div", {
319
- children: (0, _jsxRuntime.jsx)("h4", {
319
+ }), (0, _jsxRuntime.jsxs)("div", {
320
+ className: 'List-item-content',
321
+ children: [(0, _jsxRuntime.jsx)("h4", {
320
322
  className: 'List-item-title ml-2',
321
323
  children: (0, _helper2.replaceTpl)(store.fieldNameTpl, v)
322
- })
324
+ }), (0, _jsxRuntime.jsx)(_columnTypeLabel["default"], {
325
+ column: v
326
+ })]
323
327
  })]
324
328
  }), OPEN_GROUP && isGroup && groupe !== _enum.SQL_GROUP_TYPE.STRING && (0, _jsxRuntime.jsx)(_pandora.Popover, {
325
329
  placement: 'rt',
@@ -23,6 +23,16 @@
23
23
  align-items: center;
24
24
  color: #b8bbc3;
25
25
  }
26
+ .List-item-content {
27
+ display: flex;
28
+ align-items: center;
29
+ min-width: 0;
30
+ width: 100%;
31
+ .List-item-title {
32
+ flex: 1 1 auto;
33
+ min-width: 0;
34
+ }
35
+ }
26
36
  .List-item-title {
27
37
  word-break: break-word;
28
38
  word-wrap: anywhere;
@@ -17,6 +17,7 @@ var _enum = require("../../../store/enum");
17
17
  var _helper = require("../../../store/helper");
18
18
  var _locale = require("../../../locale");
19
19
  var _const = require("../const");
20
+ var _columnTypeLabel = _interopRequireDefault(require("../column-type-label"));
20
21
  var _useProvider = require("../../../hooks/use-provider");
21
22
  var _helper2 = require("../../../utils/helper");
22
23
  var _icons = require("../../icons");
@@ -251,11 +252,14 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
251
252
  children: [(0, _jsxRuntime.jsx)("span", {
252
253
  className: 'List-item-icon',
253
254
  children: IconMap[special_type || database_type] || (0, _jsxRuntime.jsx)(_icons.LetterAaIcon, {})
254
- }), (0, _jsxRuntime.jsx)("div", {
255
- children: (0, _jsxRuntime.jsx)("h4", {
255
+ }), (0, _jsxRuntime.jsxs)("div", {
256
+ className: 'List-item-content',
257
+ children: [(0, _jsxRuntime.jsx)("h4", {
256
258
  className: 'List-item-title ml-2',
257
259
  children: (0, _helper2.replaceTpl)(store.fieldNameTpl, v)
258
- })
260
+ }), (0, _jsxRuntime.jsx)(_columnTypeLabel["default"], {
261
+ column: v
262
+ })]
259
263
  })]
260
264
  })
261
265
  })
@@ -23,6 +23,16 @@
23
23
  align-items: center;
24
24
  color: #b8bbc3;
25
25
  }
26
+ .List-item-content {
27
+ display: flex;
28
+ align-items: center;
29
+ min-width: 0;
30
+ width: 100%;
31
+ .List-item-title {
32
+ flex: 1 1 auto;
33
+ min-width: 0;
34
+ }
35
+ }
26
36
  .List-item-title {
27
37
  word-break: break-word;
28
38
  word-wrap: anywhere;
@@ -202,6 +202,7 @@ export interface MetaData_ColumnsType {
202
202
  tableUuid?: string;
203
203
  realName?: string;
204
204
  database_type: SQL_COLUMN_TYPE | '';
205
+ database_length?: number | string;
205
206
  special_type: SpecialType | '';
206
207
  datasourceId: string;
207
208
  datasourceName: string;
@@ -0,0 +1,8 @@
1
+ import './index.less';
2
+ import React from 'react';
3
+ import { MetaData_ColumnsType } from '../../../store/types';
4
+ interface PropsType {
5
+ column: Pick<MetaData_ColumnsType, 'database_type' | 'database_length'>;
6
+ }
7
+ declare const ColumnTypeLabel: ({ column }: PropsType) => React.JSX.Element | null;
8
+ export default ColumnTypeLabel;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import './index.less';
3
+ var ColumnTypeLabel = function ColumnTypeLabel(_ref) {
4
+ var column = _ref.column;
5
+ var databaseType = String(column.database_type || '').trim();
6
+ var databaseLength = column.database_length;
7
+ var hasLength = databaseLength !== undefined && databaseLength !== null && "".concat(databaseLength).trim() !== '';
8
+ if (!databaseType) return null;
9
+ var label = hasLength ? "".concat(databaseType, "(").concat(databaseLength, ")") : databaseType;
10
+ return _jsx("span", {
11
+ className: 'Sqb-ColumnTypeLabel',
12
+ title: label,
13
+ children: label
14
+ });
15
+ };
16
+ export default ColumnTypeLabel;
@@ -0,0 +1,17 @@
1
+ .Sqb-ColumnTypeLabel {
2
+ flex: 0 0 auto;
3
+ margin-left: auto;
4
+ padding-left: 12px;
5
+ color: #949aab;
6
+ font-size: 12px;
7
+ font-weight: 400;
8
+ line-height: 20px;
9
+ white-space: nowrap;
10
+ }
11
+
12
+ .Sqb-List-item:hover,
13
+ .Sqb-List-item.active {
14
+ .Sqb-ColumnTypeLabel {
15
+ color: rgba(255, 255, 255, 0.82);
16
+ }
17
+ }
@@ -16,6 +16,7 @@ import { useStore } from '../../../hooks/use-provider';
16
16
  import { getColumnIdFirstKey, isSameColumnByIdFirst, uuidv4 } from '../../../utils/helper';
17
17
  import { changeFieldAlias, isValidSQLAlias } from '../../../utils';
18
18
  import { SearchIcon } from '../../icons';
19
+ import ColumnTypeLabel from '../column-type-label';
19
20
  var SelectColumn = function SelectColumn(_ref) {
20
21
  var _ref$data = _ref.data,
21
22
  data = _ref$data === void 0 ? [] : _ref$data,
@@ -227,7 +228,12 @@ var SelectColumn = function SelectColumn(_ref) {
227
228
  children: _jsx(SelectIcon, {})
228
229
  }) : _jsx("div", {
229
230
  className: 'no-select mr-2'
230
- }), v.name, v.name_zh ? " \uFF08".concat(v.name_zh, "\uFF09") : '', v.fieldAlias ? " as ".concat(v.fieldAlias) : '', store.fieldEnableAlias && !readonly && _jsx(Tooltip, {
231
+ }), _jsxs("span", {
232
+ className: 'Sqb-SelectColumn-name',
233
+ children: [v.name, v.name_zh ? " \uFF08".concat(v.name_zh, "\uFF09") : '', v.fieldAlias ? " as ".concat(v.fieldAlias) : '']
234
+ }), _jsx(ColumnTypeLabel, {
235
+ column: v
236
+ }), store.fieldEnableAlias && !readonly && _jsx(Tooltip, {
231
237
  title: __('SqlQueryBuilder.alias'),
232
238
  children: _jsx(Button, {
233
239
  className: ':Sqb-TableName-as',
@@ -37,9 +37,14 @@
37
37
  }
38
38
  .Sqb-TableName-as {
39
39
  // font-size: 16px;
40
- margin-left: auto;
40
+ margin-left: 8px;
41
41
  }
42
42
  }
43
+ .Sqb-SelectColumn-name {
44
+ flex: 1 1 auto;
45
+ min-width: 0;
46
+ overflow-wrap: anywhere;
47
+ }
43
48
  .Sqb-SelectColumn--header {
44
49
  position: sticky;
45
50
  top: 0;
@@ -14,6 +14,7 @@ import { SummarizeAlias } from '../../../store/helper';
14
14
  import { AtomsTypeEnum } from '../../../store/types';
15
15
  import { __ } from '../../../locale';
16
16
  import { NUMBER_GROUP, DATE_GROUP } from '../const';
17
+ import ColumnTypeLabel from '../column-type-label';
17
18
  import { useStore } from '../../../hooks/use-provider';
18
19
  import { replaceTpl, mergeNameAlias, uuidv4 } from '../../../utils/helper';
19
20
  import { SearchIcon, TableIcon, CircleIcon, LetterAaIcon, CalendarIcon, WellIcon, ForeignKeyIcon, UpArrowIcon2, DownArrowIcon2 } from '../../icons';
@@ -503,11 +504,14 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
503
504
  children: [_jsx("span", {
504
505
  className: 'List-item-icon',
505
506
  children: IconMap[special_type || database_type] || _jsx(LetterAaIcon, {})
506
- }), _jsx("div", {
507
- children: _jsxs("h4", {
507
+ }), _jsxs("div", {
508
+ className: 'List-item-content',
509
+ children: [_jsxs("h4", {
508
510
  className: 'List-item-title ml-2',
509
511
  children: [replaceTpl(store.fieldNameTpl, v), v.fieldAlias ? " as ".concat(v.fieldAlias) : '']
510
- })
512
+ }), _jsx(ColumnTypeLabel, {
513
+ column: v
514
+ })]
511
515
  })]
512
516
  })
513
517
  })
@@ -23,6 +23,16 @@
23
23
  align-items: center;
24
24
  color: #b8bbc3;
25
25
  }
26
+ .List-item-content {
27
+ display: flex;
28
+ align-items: center;
29
+ min-width: 0;
30
+ width: 100%;
31
+ .List-item-title {
32
+ flex: 1 1 auto;
33
+ min-width: 0;
34
+ }
35
+ }
26
36
  .List-item-title {
27
37
  word-break: break-word;
28
38
  word-wrap: anywhere;
@@ -10,6 +10,7 @@ import { ColumnsPopupThemeEnum, SQL_GROUP_TYPE } from '../../../store/enum';
10
10
  import { SummarizeAlias } from '../../../store/helper';
11
11
  import { __ } from '../../../locale';
12
12
  import { NUMBER_GROUP, DATE_GROUP } from '../const';
13
+ import ColumnTypeLabel from '../column-type-label';
13
14
  import { useStore } from '../../../hooks/use-provider';
14
15
  import { getColumnIdFirstKey, isSameColumnByIdName, replaceTpl, mergeNameAlias } from '../../../utils/helper';
15
16
  import { SearchIcon, TableIcon, CircleIcon, LetterAaIcon, CalendarIcon, WellIcon, ForeignKeyIcon, UpArrowIcon2, DownArrowIcon2, RightArrowIcon } from '../../icons';
@@ -308,11 +309,14 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
308
309
  children: [_jsx("span", {
309
310
  className: 'List-item-icon',
310
311
  children: IconMap[special_type || database_type] || _jsx(LetterAaIcon, {})
311
- }), _jsx("div", {
312
- children: _jsx("h4", {
312
+ }), _jsxs("div", {
313
+ className: 'List-item-content',
314
+ children: [_jsx("h4", {
313
315
  className: 'List-item-title ml-2',
314
316
  children: replaceTpl(store.fieldNameTpl, v)
315
- })
317
+ }), _jsx(ColumnTypeLabel, {
318
+ column: v
319
+ })]
316
320
  })]
317
321
  }), OPEN_GROUP && isGroup && groupe !== SQL_GROUP_TYPE.STRING && _jsx(Popover, {
318
322
  placement: 'rt',
@@ -23,6 +23,16 @@
23
23
  align-items: center;
24
24
  color: #b8bbc3;
25
25
  }
26
+ .List-item-content {
27
+ display: flex;
28
+ align-items: center;
29
+ min-width: 0;
30
+ width: 100%;
31
+ .List-item-title {
32
+ flex: 1 1 auto;
33
+ min-width: 0;
34
+ }
35
+ }
26
36
  .List-item-title {
27
37
  word-break: break-word;
28
38
  word-wrap: anywhere;
@@ -10,6 +10,7 @@ import { ColumnsPopupThemeEnum, SQL_GROUP_TYPE } from '../../../store/enum';
10
10
  import { SummarizeAlias } from '../../../store/helper';
11
11
  import { __ } from '../../../locale';
12
12
  import { NUMBER_GROUP, DATE_GROUP } from '../const';
13
+ import ColumnTypeLabel from '../column-type-label';
13
14
  import { useStore } from '../../../hooks/use-provider';
14
15
  import { getColumnIdFirstKey, isSameColumnByIdName, replaceTpl, mergeNameAlias } from '../../../utils/helper';
15
16
  import { SearchIcon, TableIcon, CircleIcon, LetterAaIcon, CalendarIcon, WellIcon, ForeignKeyIcon, UpArrowIcon2, DownArrowIcon2 } from '../../icons';
@@ -244,11 +245,14 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
244
245
  children: [_jsx("span", {
245
246
  className: 'List-item-icon',
246
247
  children: IconMap[special_type || database_type] || _jsx(LetterAaIcon, {})
247
- }), _jsx("div", {
248
- children: _jsx("h4", {
248
+ }), _jsxs("div", {
249
+ className: 'List-item-content',
250
+ children: [_jsx("h4", {
249
251
  className: 'List-item-title ml-2',
250
252
  children: replaceTpl(store.fieldNameTpl, v)
251
- })
253
+ }), _jsx(ColumnTypeLabel, {
254
+ column: v
255
+ })]
252
256
  })]
253
257
  })
254
258
  })
@@ -23,6 +23,16 @@
23
23
  align-items: center;
24
24
  color: #b8bbc3;
25
25
  }
26
+ .List-item-content {
27
+ display: flex;
28
+ align-items: center;
29
+ min-width: 0;
30
+ width: 100%;
31
+ .List-item-title {
32
+ flex: 1 1 auto;
33
+ min-width: 0;
34
+ }
35
+ }
26
36
  .List-item-title {
27
37
  word-break: break-word;
28
38
  word-wrap: anywhere;
@@ -202,6 +202,7 @@ export interface MetaData_ColumnsType {
202
202
  tableUuid?: string;
203
203
  realName?: string;
204
204
  database_type: SQL_COLUMN_TYPE | '';
205
+ database_length?: number | string;
205
206
  special_type: SpecialType | '';
206
207
  datasourceId: string;
207
208
  datasourceName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "1.0.158-alpha.6",
3
+ "version": "1.0.158-alpha.7",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",