@gingkoo/pandora-metabase 1.0.28 → 1.0.30

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.
@@ -84,9 +84,6 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
84
84
  _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
85
85
  tableList = _useState6[0],
86
86
  setTableList = _useState6[1];
87
- // useEffect(() => {
88
- // setCurTable(tableInfo);
89
- // }, [tableInfo]);
90
87
  (0, _react.useEffect)(function () {
91
88
  // setCurColumn(_value);
92
89
  setValue(_value);
@@ -97,8 +94,15 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
97
94
  }).length) > 0;
98
95
  };
99
96
  (0, _react.useEffect)(function () {
97
+ var tableUuid = curTable;
98
+ var isHas = data.filter(function (v) {
99
+ return v.tableUuid === tableUuid;
100
+ });
101
+ if (isHas.length < 1 && tableUuid !== _helper.SummarizeAlias) {
102
+ tableUuid = data[0].tableUuid;
103
+ }
100
104
  setTableList(data.map(function (v, i) {
101
- var open = !i && !curTable ? true : v.tableUuid === curTable; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
105
+ var open = !i && !tableUuid ? true : v.tableUuid === tableUuid; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
102
106
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, v), {}, {
103
107
  open: open,
104
108
  searchText: '',
@@ -82,12 +82,19 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
82
82
  setTableList = _useState8[1];
83
83
  (0, _react.useEffect)(function () {
84
84
  setValue(_value);
85
- setCurTable(_value.tableUuid);
86
85
  setCurColumn(_value.name);
87
86
  }, [_value]);
88
87
  (0, _react.useEffect)(function () {
88
+ var tableUuid = _value === null || _value === void 0 ? void 0 : _value.tableUuid;
89
+ var isHas = data.filter(function (v) {
90
+ return v.tableUuid === tableUuid;
91
+ });
92
+ if (isHas.length < 1) {
93
+ tableUuid = data[0].tableUuid;
94
+ }
95
+ setCurTable(tableUuid);
89
96
  setTableList(data.map(function (v, i) {
90
- var open = !i && !_value.tableUuid ? true : v.tableUuid === _value.tableUuid; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
97
+ var open = !i && !tableUuid ? true : v.tableUuid === tableUuid; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
91
98
  return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, v), {}, {
92
99
  open: open,
93
100
  searchText: '',
@@ -924,7 +924,15 @@ var JoinData = function JoinData(props) {
924
924
  var newColumns = items.flatMap(function (item) {
925
925
  return item.columns;
926
926
  });
927
- newMeta[index].columns = newColumns;
927
+ newMeta[index].columns = newColumns.map(function (newCol) {
928
+ // 查找旧列中是否有相同 name 的列
929
+ var existingCol = newMeta[index].columns.find(function (oldCol) {
930
+ return oldCol.name === newCol.name;
931
+ });
932
+ // 如果存在,返回旧列;否则返回新列
933
+ return existingCol ? existingCol : newCol;
934
+ });
935
+ // (newMeta[index] as MetaJoin).columns = newColumns;
928
936
  initExpressions();
929
937
  // 关联表变了 下面模块全部删除
930
938
  // newMeta = newMeta.filter((v: MetaListType, i: number) => i <= index);
@@ -55,7 +55,7 @@ var _default = exports["default"] = (0, _index.register)('en', {
55
55
  'SqlQueryBuilder.visualize': 'visualize',
56
56
  'SqlQueryBuilder.selectColumnAll': 'select all',
57
57
  'SqlQueryBuilder.alias': 'alias',
58
- 'SqlQueryBuilder.aliasForRules': 'Please enter a combination of letters, underscores, and numbers, with a length not exceeding 30 bytes',
58
+ 'SqlQueryBuilder.aliasForRules': 'The alias only supports a combination of letters, numbers, and underscores. It must start with a letter and cannot exceed 30 bytes',
59
59
  'customColumn.operator': 'operator',
60
60
  'customColumn.collection': 'collection',
61
61
  'customColumn.field': 'field',
@@ -51,7 +51,7 @@ var _default = exports["default"] = (0, _index.register)('zh', {
51
51
  'SqlQueryBuilder.visualize': '可视化',
52
52
  'SqlQueryBuilder.selectColumnAll': '全选',
53
53
  'SqlQueryBuilder.alias': '别名',
54
- 'SqlQueryBuilder.aliasForRules': '请输入字母加下划线加数字,且长度不能超过30个字节',
54
+ 'SqlQueryBuilder.aliasForRules': '别名只支持字母 + 数字 + 下划线组合,必须是字母开头,且不能超过30个字节',
55
55
  'customColumn.operator': '操作符',
56
56
  'customColumn.collection': '自定义组合',
57
57
  'customColumn.field': '字段',
@@ -78,9 +78,6 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
78
78
  _useState6 = _slicedToArray(_useState5, 2),
79
79
  tableList = _useState6[0],
80
80
  setTableList = _useState6[1];
81
- // useEffect(() => {
82
- // setCurTable(tableInfo);
83
- // }, [tableInfo]);
84
81
  useEffect(function () {
85
82
  // setCurColumn(_value);
86
83
  setValue(_value);
@@ -91,8 +88,15 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
91
88
  }).length) > 0;
92
89
  };
93
90
  useEffect(function () {
91
+ var tableUuid = curTable;
92
+ var isHas = data.filter(function (v) {
93
+ return v.tableUuid === tableUuid;
94
+ });
95
+ if (isHas.length < 1 && tableUuid !== SummarizeAlias) {
96
+ tableUuid = data[0].tableUuid;
97
+ }
94
98
  setTableList(data.map(function (v, i) {
95
- var open = !i && !curTable ? true : v.tableUuid === curTable; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
99
+ var open = !i && !tableUuid ? true : v.tableUuid === tableUuid; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
96
100
  return _objectSpread(_objectSpread({}, v), {}, {
97
101
  open: open,
98
102
  searchText: '',
@@ -74,12 +74,19 @@ var SelectJoinColumn = function SelectJoinColumn(_ref) {
74
74
  setTableList = _useState8[1];
75
75
  useEffect(function () {
76
76
  setValue(_value);
77
- setCurTable(_value.tableUuid);
78
77
  setCurColumn(_value.name);
79
78
  }, [_value]);
80
79
  useEffect(function () {
80
+ var tableUuid = _value === null || _value === void 0 ? void 0 : _value.tableUuid;
81
+ var isHas = data.filter(function (v) {
82
+ return v.tableUuid === tableUuid;
83
+ });
84
+ if (isHas.length < 1) {
85
+ tableUuid = data[0].tableUuid;
86
+ }
87
+ setCurTable(tableUuid);
81
88
  setTableList(data.map(function (v, i) {
82
- var open = !i && !_value.tableUuid ? true : v.tableUuid === _value.tableUuid; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
89
+ var open = !i && !tableUuid ? true : v.tableUuid === tableUuid; // TODO.这里只判断表名相等 没有用了 因为表上面加了一层数据源 先这样吧
83
90
  return _objectSpread(_objectSpread({}, v), {}, {
84
91
  open: open,
85
92
  searchText: '',
@@ -918,7 +918,15 @@ var JoinData = function JoinData(props) {
918
918
  var newColumns = items.flatMap(function (item) {
919
919
  return item.columns;
920
920
  });
921
- newMeta[index].columns = newColumns;
921
+ newMeta[index].columns = newColumns.map(function (newCol) {
922
+ // 查找旧列中是否有相同 name 的列
923
+ var existingCol = newMeta[index].columns.find(function (oldCol) {
924
+ return oldCol.name === newCol.name;
925
+ });
926
+ // 如果存在,返回旧列;否则返回新列
927
+ return existingCol ? existingCol : newCol;
928
+ });
929
+ // (newMeta[index] as MetaJoin).columns = newColumns;
922
930
  initExpressions();
923
931
  // 关联表变了 下面模块全部删除
924
932
  // newMeta = newMeta.filter((v: MetaListType, i: number) => i <= index);
@@ -49,7 +49,7 @@ export default register('en', {
49
49
  'SqlQueryBuilder.visualize': 'visualize',
50
50
  'SqlQueryBuilder.selectColumnAll': 'select all',
51
51
  'SqlQueryBuilder.alias': 'alias',
52
- 'SqlQueryBuilder.aliasForRules': 'Please enter a combination of letters, underscores, and numbers, with a length not exceeding 30 bytes',
52
+ 'SqlQueryBuilder.aliasForRules': 'The alias only supports a combination of letters, numbers, and underscores. It must start with a letter and cannot exceed 30 bytes',
53
53
  'customColumn.operator': 'operator',
54
54
  'customColumn.collection': 'collection',
55
55
  'customColumn.field': 'field',
@@ -45,7 +45,7 @@ export default register('zh', {
45
45
  'SqlQueryBuilder.visualize': '可视化',
46
46
  'SqlQueryBuilder.selectColumnAll': '全选',
47
47
  'SqlQueryBuilder.alias': '别名',
48
- 'SqlQueryBuilder.aliasForRules': '请输入字母加下划线加数字,且长度不能超过30个字节',
48
+ 'SqlQueryBuilder.aliasForRules': '别名只支持字母 + 数字 + 下划线组合,必须是字母开头,且不能超过30个字节',
49
49
  'customColumn.operator': '操作符',
50
50
  'customColumn.collection': '自定义组合',
51
51
  'customColumn.field': '字段',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",