@gingkoo/pandora-metabase 1.0.43 → 1.0.44

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.
@@ -10,6 +10,8 @@ var _jsxRuntime = require("react/jsx-runtime");
10
10
  require("./index.less");
11
11
  var _react = require("react");
12
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
+ var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
14
+ var _locale = require("../../../locale");
13
15
  var _icons = require("../../icons");
14
16
  /**
15
17
  * 选择表弹框
@@ -26,22 +28,45 @@ var SelectPermissionTable = function SelectPermissionTable(_ref) {
26
28
  onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
27
29
  didUpdate = _ref.didUpdate;
28
30
  var _useState = (0, _react.useState)(data.slice()),
29
- _useState2 = (0, _slicedToArray2["default"])(_useState, 1),
30
- datasource = _useState2[0];
31
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
32
+ datasource = _useState2[0],
33
+ setDatasource = _useState2[1];
31
34
  (0, _react.useEffect)(function () {
32
35
  didUpdate === null || didUpdate === void 0 || didUpdate();
33
36
  }, [datasource]);
37
+ function onInput(e) {
38
+ var val = e.target.value;
39
+ var newList = (0, _cloneDeep["default"])(data.slice());
40
+ setDatasource(newList.filter(function (v) {
41
+ return ~(v.datasourceName + '.' + (v.alias || v.name)).toLocaleLowerCase().indexOf(val.toLocaleLowerCase());
42
+ }));
43
+ }
34
44
  return (0, _jsxRuntime.jsx)("div", {
35
45
  className: (0, _classnames["default"])("Sqb-SelectTable--box pb-2 pt-2"),
36
46
  children: (0, _jsxRuntime.jsx)("div", {
37
47
  style: {
38
48
  width: 300
39
49
  },
40
- children: (0, _jsxRuntime.jsx)("div", {
50
+ children: (0, _jsxRuntime.jsxs)("div", {
41
51
  style: {
42
52
  width: '100%'
43
53
  },
44
- children: Array.isArray(datasource) && datasource.map(function (v) {
54
+ children: [(0, _jsxRuntime.jsx)("div", {
55
+ className: (0, _classnames["default"])("Sqb-List-section"),
56
+ children: (0, _jsxRuntime.jsxs)("div", {
57
+ className: (0, _classnames["default"])("Sqb-List-search m-2 rounded-lg"),
58
+ children: [(0, _jsxRuntime.jsx)("span", {
59
+ className: 'px-2',
60
+ children: (0, _jsxRuntime.jsx)(_icons.SearchIcon, {})
61
+ }), (0, _jsxRuntime.jsx)("input", {
62
+ autoFocus: true,
63
+ type: 'text',
64
+ className: 'p-2',
65
+ placeholder: (0, _locale.__)('data.search'),
66
+ onInput: onInput
67
+ })]
68
+ })
69
+ }), Array.isArray(datasource) && datasource.map(function (v) {
45
70
  return (0, _jsxRuntime.jsx)("div", {
46
71
  className: (0, _classnames["default"])("Sqb-List-section"),
47
72
  children: (0, _jsxRuntime.jsx)("div", {
@@ -65,7 +90,7 @@ var SelectPermissionTable = function SelectPermissionTable(_ref) {
65
90
  })
66
91
  })
67
92
  }, v.alias || v.name);
68
- })
93
+ })]
69
94
  })
70
95
  })
71
96
  });
@@ -189,6 +189,7 @@ var SelectTable = function SelectTable(_ref) {
189
189
  className: 'px-2',
190
190
  children: (0, _jsxRuntime.jsx)(_icons.SearchIcon, {})
191
191
  }), (0, _jsxRuntime.jsx)("input", {
192
+ autoFocus: true,
192
193
  type: 'text',
193
194
  className: 'p-2',
194
195
  placeholder: (0, _locale.__)('data.search'),
@@ -1226,7 +1226,6 @@ var JoinData = function JoinData(props) {
1226
1226
  var index = (0, _utils.findIndex)(store.metaList[groupIndex].list, meta);
1227
1227
  var newMeta = store.metaList[groupIndex].list.slice();
1228
1228
  var item = (0, _dialog.getTemplateItem)(type);
1229
- console.log('🚀 ~ addExpression ~ item:', item);
1230
1229
  if (type === _types.AtomsTypeEnum.JOIN_DEFAULT) {
1231
1230
  item = {
1232
1231
  lhs: [{
@@ -8,7 +8,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  import './index.less';
9
9
  import { useState, useEffect } from 'react';
10
10
  import cx from 'classnames';
11
- import { TableIcon } from '../../icons';
11
+ import cloneDeep from 'lodash/cloneDeep';
12
+ import { __ } from '../../../locale';
13
+ import { TableIcon, SearchIcon } from '../../icons';
12
14
  var PrevResult = 'Previous results';
13
15
  var SelectPermissionTable = function SelectPermissionTable(_ref) {
14
16
  var _ref$data = _ref.data,
@@ -18,22 +20,45 @@ var SelectPermissionTable = function SelectPermissionTable(_ref) {
18
20
  onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
19
21
  didUpdate = _ref.didUpdate;
20
22
  var _useState = useState(data.slice()),
21
- _useState2 = _slicedToArray(_useState, 1),
22
- datasource = _useState2[0];
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ datasource = _useState2[0],
25
+ setDatasource = _useState2[1];
23
26
  useEffect(function () {
24
27
  didUpdate === null || didUpdate === void 0 || didUpdate();
25
28
  }, [datasource]);
29
+ function onInput(e) {
30
+ var val = e.target.value;
31
+ var newList = cloneDeep(data.slice());
32
+ setDatasource(newList.filter(function (v) {
33
+ return ~(v.datasourceName + '.' + (v.alias || v.name)).toLocaleLowerCase().indexOf(val.toLocaleLowerCase());
34
+ }));
35
+ }
26
36
  return _jsx("div", {
27
37
  className: cx("Sqb-SelectTable--box pb-2 pt-2"),
28
38
  children: _jsx("div", {
29
39
  style: {
30
40
  width: 300
31
41
  },
32
- children: _jsx("div", {
42
+ children: _jsxs("div", {
33
43
  style: {
34
44
  width: '100%'
35
45
  },
36
- children: Array.isArray(datasource) && datasource.map(function (v) {
46
+ children: [_jsx("div", {
47
+ className: cx("Sqb-List-section"),
48
+ children: _jsxs("div", {
49
+ className: cx("Sqb-List-search m-2 rounded-lg"),
50
+ children: [_jsx("span", {
51
+ className: 'px-2',
52
+ children: _jsx(SearchIcon, {})
53
+ }), _jsx("input", {
54
+ autoFocus: true,
55
+ type: 'text',
56
+ className: 'p-2',
57
+ placeholder: __('data.search'),
58
+ onInput: onInput
59
+ })]
60
+ })
61
+ }), Array.isArray(datasource) && datasource.map(function (v) {
37
62
  return _jsx("div", {
38
63
  className: cx("Sqb-List-section"),
39
64
  children: _jsx("div", {
@@ -57,7 +82,7 @@ var SelectPermissionTable = function SelectPermissionTable(_ref) {
57
82
  })
58
83
  })
59
84
  }, v.alias || v.name);
60
- })
85
+ })]
61
86
  })
62
87
  })
63
88
  });
@@ -182,6 +182,7 @@ var SelectTable = function SelectTable(_ref) {
182
182
  className: 'px-2',
183
183
  children: _jsx(SearchIcon, {})
184
184
  }), _jsx("input", {
185
+ autoFocus: true,
185
186
  type: 'text',
186
187
  className: 'p-2',
187
188
  placeholder: __('data.search'),
@@ -1221,7 +1221,6 @@ var JoinData = function JoinData(props) {
1221
1221
  var index = findIndex(store.metaList[groupIndex].list, meta);
1222
1222
  var newMeta = store.metaList[groupIndex].list.slice();
1223
1223
  var item = getTemplateItem(type);
1224
- console.log('🚀 ~ addExpression ~ item:', item);
1225
1224
  if (type === AtomsTypeEnum.JOIN_DEFAULT) {
1226
1225
  item = {
1227
1226
  lhs: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",