@gingkoo/pandora-metabase 1.0.94 → 1.0.96

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.
package/lib/es/index.js CHANGED
@@ -79,17 +79,17 @@ var SqlVisionBuilder = React.forwardRef(function (props, ref) {
79
79
  getColumns && store.setFetchColumnsFn(getColumns);
80
80
  onChange && store.setFetchChangeFn(onChange);
81
81
  getModuleDiffCode && store.setFetchDiffFn(getModuleDiffCode);
82
- getExistsError && store.setExistsErrorFn(getExistsError);
83
82
  }, []);
84
83
  useEffect(function () {
85
84
  store.setProps(props);
86
85
  }, [props]);
87
86
  useEffect(function () {
88
- var _value = reassembleByUnion(patchData(value));
89
- var source_value = patchData(value);
87
+ var _value = reassembleByUnion(patchData(value, constantList, formulaTemplates));
88
+ var source_value = patchData(value, constantList, formulaTemplates);
90
89
  store.setPreData(cloneDeep(_value), isSubquery, isExit);
91
90
  store.setSourceData(source_value);
92
- }, [value]);
91
+ getExistsError && store.setExistsErrorFn(getExistsError, value);
92
+ }, [value, constantList, formulaTemplates]);
93
93
  useEffect(function () {
94
94
  store.setSourceList(isExit && exitSourceList && Array.from(exitSourceList).length > 0 ? exitSourceList || sourceList : sourceList);
95
95
  }, [sourceList, exitSourceList, isExit]);
package/lib/es/types.d.ts CHANGED
@@ -59,7 +59,7 @@ export interface MetabaseProps {
59
59
  oldCode: string;
60
60
  newCode: string;
61
61
  }>;
62
- getExistsError?: () => Promise<any[]>;
62
+ getExistsError?: (params: MetaListType[]) => Promise<any[]>;
63
63
  operatorList?: any[];
64
64
  }
65
65
  export interface OptionItem {
package/lib/es/utils.d.ts CHANGED
@@ -26,7 +26,8 @@ export declare function isValidSQLAlias(str: string): boolean;
26
26
  export declare const changeTableAlias: (list: MetaListType[] | [], curObj: Pick<MetaData_TableType, "tableUuid" | "alias">) => MetaListType[];
27
27
  export declare const changeFieldAlias: (list: MetaListType[], curObj: Pick<MetaData_ColumnsType, "fieldUuid" | "fieldAlias">) => MetaListType[];
28
28
  export declare function splitByUnion(data: any): any[];
29
- export declare const patchData: (metas: MetaListType[]) => MetaListType[];
29
+ export declare const getObjTem: (arr: any[]) => any;
30
+ export declare const patchData: (metas: MetaListType[], constantList?: any, formulaTemplates?: any) => MetaListType[];
30
31
  export declare function reassembleByUnion(target?: any[]): any[];
31
32
  export declare const buildSqlQuery: (data: MetaListType[] | undefined, type: string) => string;
32
33
  export declare const isError: (item: AtomsItem | AtomsItem[], data: DataType[]) => boolean;
package/lib/es/utils.js CHANGED
@@ -500,12 +500,28 @@ export function splitByUnion(data) {
500
500
  }
501
501
  return result;
502
502
  }
503
+ export var getObjTem = function getObjTem(arr) {
504
+ var obj = {};
505
+ arr === null || arr === void 0 || arr.map(function (v) {
506
+ v.children.map(function (vv) {
507
+ if (vv.name) {
508
+ obj[vv.name] = vv;
509
+ }
510
+ });
511
+ });
512
+ return obj;
513
+ };
503
514
  export var patchData = function patchData(metas) {
504
- return metas;
515
+ var constantList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
516
+ var formulaTemplates = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
517
+ // return metas;
505
518
  var mainTable = metas[0] || {};
506
519
  var version = (mainTable === null || mainTable === void 0 ? void 0 : mainTable.patchVersion) || '';
507
- if (version != '1.0.0') {
508
- return patchMetas(metas);
520
+ // if (version != '1.0.0') {
521
+ // return patchMetas(metas);
522
+ // }
523
+ if (version != '1.1.0') {
524
+ return patchMetas(metas, constantList, getObjTem(formulaTemplates));
509
525
  }
510
526
  return metas;
511
527
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gingkoo/pandora-metabase",
3
- "version": "1.0.94",
3
+ "version": "1.0.96",
4
4
  "description": "",
5
5
  "main": "lib/es/index.js",
6
6
  "module": "lib/es/index.js",