@gingkoo/pandora-metabase 1.0.95 → 1.0.97

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.
@@ -21,6 +21,8 @@ import SelectColumnMultiple from '../select-column-multiple';
21
21
  import { LeftArrowIcon } from '../../icons';
22
22
  import { useStore } from '../../../hooks/use-provider';
23
23
  import cloneDeep from 'lodash/cloneDeep';
24
+ import { getConstantLabel } from '../formula-list/utils';
25
+ import ItemName from '../../modules/components/item-name';
24
26
  var RangePicker = DatePicker.RangePicker;
25
27
  var NUMBER_LIST = ['等于', '不等于', '大于', '小于', '介于之间', '大于或等于', '小于或等于', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
26
28
  var STRING_LIST = ['等于', '不等于', '包含', '不包含', '为空', '不为空', '以...开始', '以...结束', '不以...开始', '不以...结束', 'In', 'Not In', '正则匹配'];
@@ -594,19 +596,20 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
594
596
  var selectConstant = function selectConstant(e) {
595
597
  store.setClosable(false);
596
598
  var node = e.currentTarget;
597
- var _type = Number(node.getAttribute('v-type'));
599
+ var _val = node.getAttribute('v-val');
598
600
  store.setPopup2({
599
601
  visible: true,
600
602
  node: e.currentTarget,
601
603
  container: container,
602
604
  content: _jsx(SelectList, {
603
- value: _type,
605
+ value: _val,
604
606
  list: store.constantList || [],
605
607
  onChange: function onChange(val) {
606
608
  closePopup2();
607
609
  // let curObj = store.constantList.filter((v: any) => v.value === val)[0];
608
610
  var newVal = rhsVal.slice();
609
- newVal[0].val = val;
611
+ newVal[0].id = val;
612
+ newVal[0].val = getConstantLabel(store.constantList, val);
610
613
  setRhsVal(newVal);
611
614
  store.setClosable(true);
612
615
  }
@@ -866,13 +869,17 @@ var SelectFilterColumn = function SelectFilterColumn(_ref) {
866
869
  }, i);
867
870
  }
868
871
  if (v.type === AtomsTypeEnum.CONSTANT) {
869
- return _jsx("div", {
870
- className: cx("Sqb-TableName purple-name", {
871
- notSelected: !v.val
872
- }),
873
- "v-type": v.type,
874
- onClick: selectConstant,
875
- children: v.val ? "".concat(v.val) : __('SqlQueryBuilder.pickConstant')
872
+ return _jsx(ItemName, {
873
+ isError: !!(v.id || v.val) && !getConstantLabel(store.constantList, v.id || v.val),
874
+ message: "\u5E38\u91CF\u4E22\u5931",
875
+ children: _jsx("div", {
876
+ className: cx("Sqb-TableName purple-name", {
877
+ notSelected: !v.val
878
+ }),
879
+ "v-val": v.id || v.val,
880
+ onClick: selectConstant,
881
+ children: getConstantLabel(store.constantList, v.id || v.val, v.val) || __('SqlQueryBuilder.pickConstant')
882
+ }, i)
876
883
  }, i);
877
884
  }
878
885
  if (v.type === AtomsTypeEnum.INPUT_STRING || v.type === AtomsTypeEnum.INPUT_STRING_LIST) {
@@ -79,5 +79,8 @@ export var getQuotes = function getQuotes(fun, _args, formulaList) {
79
79
  };
80
80
  export var formulaIsError = function formulaIsError(fun, formulaList) {
81
81
  var obj = fun.id ? formulaList[fun.id] : formulaList[fun.name];
82
+ if (!fun.name && !fun.quotes) {
83
+ return false;
84
+ }
82
85
  return !(obj !== null && obj !== void 0 && obj.name);
83
86
  };
@@ -749,7 +749,7 @@ var FormulaList = forwardRef(function (props, ref) {
749
749
  } else if (type === AtomsTypeEnum.CONSTANT) {
750
750
  //常量
751
751
  return _jsx(ItemName, {
752
- isError: (v.id || v.val) && !getConstantLabel(store.constantList, v.id || v.val),
752
+ isError: !!(v.id || v.val) && !getConstantLabel(store.constantList, v.id || v.val),
753
753
  message: "\u5E38\u91CF\u4E22\u5931",
754
754
  children: _jsxs("div", {
755
755
  className: cx("Sqb-TableName", {
@@ -101,7 +101,7 @@ var Metabase = function Metabase(props) {
101
101
  case 0:
102
102
  intercept = false; // 是否返回
103
103
  _metaList = splitByUnion(store.metaList);
104
- _metaList[0].patchVersion = '1.0.0';
104
+ _metaList[0].patchVersion = '1.1.0';
105
105
  store.metaList.map(function (v) {
106
106
  var _v$list;
107
107
  if (v.type !== 'union' && !((_v$list = v.list) === null || _v$list === void 0 ? void 0 : _v$list[0]).table.name) {
@@ -14,6 +14,7 @@ import Metabase from '../../index';
14
14
  import isEqual from 'lodash/isEqual';
15
15
  import cloneDeep from 'lodash/cloneDeep';
16
16
  import { uuidv4, getAlias, mergeNameAlias } from '../../utils/helper';
17
+ import { getConstantLabel } from '../dialog/formula-list/utils';
17
18
  import { __ } from '../../locale';
18
19
  import { findIndex, getSubColumns } from '../../utils';
19
20
  import { TypeEnum, ColumnsPopupThemeEnum, JoinEnum, SQL_COLUMN_TYPE } from '../../store/enum';
@@ -985,6 +986,8 @@ var JoinData = function JoinData(props) {
985
986
  var index = findIndex(store.metaList[groupIndex].list, meta);
986
987
  var newMeta = store.metaList[groupIndex].list.slice();
987
988
  newMeta[index].expressions[_ind][_position][_ind2].val = curObj.value;
989
+ newMeta[index].expressions[_ind][_position][_ind2].id = curObj.value;
990
+ newMeta[index].expressions[_ind][_position][_ind2].val = getConstantLabel(store.constantList, curObj.value);
988
991
  store.setMeta(newMeta, groupIndex, {
989
992
  obj: val,
990
993
  type: ChangeType[_position]
@@ -1423,16 +1426,20 @@ var JoinData = function JoinData(props) {
1423
1426
  }, index);
1424
1427
  }
1425
1428
  if (item.type === AtomsTypeEnum.CONSTANT) {
1426
- return _jsx("div", {
1427
- className: cx("Sqb-TableName", {
1428
- notSelected: !item.val
1429
- }),
1430
- "v-position": type,
1431
- "v-index": i,
1432
- "v-index2": index,
1433
- "v-val": item.val,
1434
- onClick: selectConstant,
1435
- children: item.val ? item.val : __('SqlQueryBuilder.pickConstant')
1429
+ return _jsx(ItemName, {
1430
+ isError: !!(item.id || item.val) && !getConstantLabel(store.constantList, item.id || item.val),
1431
+ message: "\u5E38\u91CF\u4E22\u5931",
1432
+ children: _jsx("div", {
1433
+ className: cx("Sqb-TableName", {
1434
+ notSelected: !item.val
1435
+ }),
1436
+ "v-position": type,
1437
+ "v-index": i,
1438
+ "v-index2": index,
1439
+ "v-val": item.id || item.val,
1440
+ onClick: selectConstant,
1441
+ children: getConstantLabel(store.constantList, item.id || item.val, item.val) || __('SqlQueryBuilder.pickConstant')
1442
+ }, index)
1436
1443
  }, index);
1437
1444
  }
1438
1445
  });
@@ -1,7 +1,5 @@
1
1
  import { MetaListType } from '../store/types';
2
- export declare const dataPatch: (newMeta: any) => any;
3
- export declare const joinDataPatch: (newMeta: any) => any;
4
- export declare const filterPatch: (newMeta: any) => any;
5
- export declare const customColumnPatch: (newMeta: any) => any;
6
- export declare const sortPatch: (newMeta: any) => any;
7
- export declare const patchMetas: (items: MetaListType[]) => MetaListType[];
2
+ export declare const joinDataPatch: (newMeta: any, constantList: any, formulaTemplates: any) => any;
3
+ export declare const filterPatch: (newMeta: any, constantList: any, formulaTemplates: any) => any;
4
+ export declare const customColumnPatch: (newMeta: any, constantList: any, formulaTemplates: any) => any;
5
+ export declare const patchMetas: (items: MetaListType[], constantList: any[], formulaTemplates: any[]) => MetaListType[];